diff --git a/.gitignore b/.gitignore index 4f509e5..f64f22c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -*.env \ No newline at end of file +*.env +*.png +node_modules/ +__pycache__/ + diff --git a/__pycache__/graph_test.cpython-38.pyc b/__pycache__/graph_test.cpython-38.pyc deleted file mode 100644 index 61e32c3..0000000 Binary files a/__pycache__/graph_test.cpython-38.pyc and /dev/null differ diff --git a/__pycache__/loc.cpython-38.pyc b/__pycache__/loc.cpython-38.pyc deleted file mode 100644 index eb6213c..0000000 Binary files a/__pycache__/loc.cpython-38.pyc and /dev/null differ diff --git a/__pycache__/make_bar_graph.cpython-38.pyc b/__pycache__/make_bar_graph.cpython-38.pyc deleted file mode 100644 index 8315052..0000000 Binary files a/__pycache__/make_bar_graph.cpython-38.pyc and /dev/null differ diff --git a/__pycache__/make_graph.cpython-38.pyc b/__pycache__/make_graph.cpython-38.pyc deleted file mode 100644 index f253fd6..0000000 Binary files a/__pycache__/make_graph.cpython-38.pyc and /dev/null differ diff --git a/bar_graph.png b/bar_graph.png deleted file mode 100644 index fef3680..0000000 Binary files a/bar_graph.png and /dev/null differ diff --git a/chart.png b/chart.png deleted file mode 100644 index fef3680..0000000 Binary files a/chart.png and /dev/null differ diff --git a/node_modules/.bin/csv2json b/node_modules/.bin/csv2json deleted file mode 120000 index e4f6bd0..0000000 --- a/node_modules/.bin/csv2json +++ /dev/null @@ -1 +0,0 @@ -../d3-dsv/bin/dsv2json \ No newline at end of file diff --git a/node_modules/.bin/csv2tsv b/node_modules/.bin/csv2tsv deleted file mode 120000 index 6104a9b..0000000 --- a/node_modules/.bin/csv2tsv +++ /dev/null @@ -1 +0,0 @@ -../d3-dsv/bin/dsv2dsv \ No newline at end of file diff --git a/node_modules/.bin/detect-libc b/node_modules/.bin/detect-libc deleted file mode 120000 index b4c4b76..0000000 --- a/node_modules/.bin/detect-libc +++ /dev/null @@ -1 +0,0 @@ -../detect-libc/bin/detect-libc.js \ No newline at end of file diff --git a/node_modules/.bin/dsv2dsv b/node_modules/.bin/dsv2dsv deleted file mode 120000 index 6104a9b..0000000 --- a/node_modules/.bin/dsv2dsv +++ /dev/null @@ -1 +0,0 @@ -../d3-dsv/bin/dsv2dsv \ No newline at end of file diff --git a/node_modules/.bin/dsv2json b/node_modules/.bin/dsv2json deleted file mode 120000 index e4f6bd0..0000000 --- a/node_modules/.bin/dsv2json +++ /dev/null @@ -1 +0,0 @@ -../d3-dsv/bin/dsv2json \ No newline at end of file diff --git a/node_modules/.bin/geo2svg b/node_modules/.bin/geo2svg deleted file mode 120000 index 14c7f46..0000000 --- a/node_modules/.bin/geo2svg +++ /dev/null @@ -1 +0,0 @@ -../d3-geo-projection/bin/geo2svg \ No newline at end of file diff --git a/node_modules/.bin/geograticule b/node_modules/.bin/geograticule deleted file mode 120000 index dd762b9..0000000 --- a/node_modules/.bin/geograticule +++ /dev/null @@ -1 +0,0 @@ -../d3-geo-projection/bin/geograticule \ No newline at end of file diff --git a/node_modules/.bin/geoproject b/node_modules/.bin/geoproject deleted file mode 120000 index 9c8f2c6..0000000 --- a/node_modules/.bin/geoproject +++ /dev/null @@ -1 +0,0 @@ -../d3-geo-projection/bin/geoproject \ No newline at end of file diff --git a/node_modules/.bin/geoquantize b/node_modules/.bin/geoquantize deleted file mode 120000 index 49b2780..0000000 --- a/node_modules/.bin/geoquantize +++ /dev/null @@ -1 +0,0 @@ -../d3-geo-projection/bin/geoquantize \ No newline at end of file diff --git a/node_modules/.bin/geostitch b/node_modules/.bin/geostitch deleted file mode 120000 index d710ec2..0000000 --- a/node_modules/.bin/geostitch +++ /dev/null @@ -1 +0,0 @@ -../d3-geo-projection/bin/geostitch \ No newline at end of file diff --git a/node_modules/.bin/json2csv b/node_modules/.bin/json2csv deleted file mode 120000 index a4e6866..0000000 --- a/node_modules/.bin/json2csv +++ /dev/null @@ -1 +0,0 @@ -../d3-dsv/bin/json2dsv \ No newline at end of file diff --git a/node_modules/.bin/json2dsv b/node_modules/.bin/json2dsv deleted file mode 120000 index a4e6866..0000000 --- a/node_modules/.bin/json2dsv +++ /dev/null @@ -1 +0,0 @@ -../d3-dsv/bin/json2dsv \ No newline at end of file diff --git a/node_modules/.bin/json2tsv b/node_modules/.bin/json2tsv deleted file mode 120000 index a4e6866..0000000 --- a/node_modules/.bin/json2tsv +++ /dev/null @@ -1 +0,0 @@ -../d3-dsv/bin/json2dsv \ No newline at end of file diff --git a/node_modules/.bin/mkdirp b/node_modules/.bin/mkdirp deleted file mode 120000 index 017896c..0000000 --- a/node_modules/.bin/mkdirp +++ /dev/null @@ -1 +0,0 @@ -../mkdirp/bin/cmd.js \ No newline at end of file diff --git a/node_modules/.bin/needle b/node_modules/.bin/needle deleted file mode 120000 index 8280969..0000000 --- a/node_modules/.bin/needle +++ /dev/null @@ -1 +0,0 @@ -../needle/bin/needle \ No newline at end of file diff --git a/node_modules/.bin/node-pre-gyp b/node_modules/.bin/node-pre-gyp deleted file mode 120000 index 47a90a5..0000000 --- a/node_modules/.bin/node-pre-gyp +++ /dev/null @@ -1 +0,0 @@ -../node-pre-gyp/bin/node-pre-gyp \ No newline at end of file diff --git a/node_modules/.bin/nopt b/node_modules/.bin/nopt deleted file mode 120000 index 6b6566e..0000000 --- a/node_modules/.bin/nopt +++ /dev/null @@ -1 +0,0 @@ -../nopt/bin/nopt.js \ No newline at end of file diff --git a/node_modules/.bin/rc b/node_modules/.bin/rc deleted file mode 120000 index 48b3cda..0000000 --- a/node_modules/.bin/rc +++ /dev/null @@ -1 +0,0 @@ -../rc/cli.js \ No newline at end of file diff --git a/node_modules/.bin/rimraf b/node_modules/.bin/rimraf deleted file mode 120000 index 4cd49a4..0000000 --- a/node_modules/.bin/rimraf +++ /dev/null @@ -1 +0,0 @@ -../rimraf/bin.js \ No newline at end of file diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver deleted file mode 120000 index 317eb29..0000000 --- a/node_modules/.bin/semver +++ /dev/null @@ -1 +0,0 @@ -../semver/bin/semver \ No newline at end of file diff --git a/node_modules/.bin/topo2geo b/node_modules/.bin/topo2geo deleted file mode 120000 index 858c438..0000000 --- a/node_modules/.bin/topo2geo +++ /dev/null @@ -1 +0,0 @@ -../topojson-client/bin/topo2geo \ No newline at end of file diff --git a/node_modules/.bin/topomerge b/node_modules/.bin/topomerge deleted file mode 120000 index a869d92..0000000 --- a/node_modules/.bin/topomerge +++ /dev/null @@ -1 +0,0 @@ -../topojson-client/bin/topomerge \ No newline at end of file diff --git a/node_modules/.bin/topoquantize b/node_modules/.bin/topoquantize deleted file mode 120000 index 88b7c98..0000000 --- a/node_modules/.bin/topoquantize +++ /dev/null @@ -1 +0,0 @@ -../topojson-client/bin/topoquantize \ No newline at end of file diff --git a/node_modules/.bin/tsv2csv b/node_modules/.bin/tsv2csv deleted file mode 120000 index 6104a9b..0000000 --- a/node_modules/.bin/tsv2csv +++ /dev/null @@ -1 +0,0 @@ -../d3-dsv/bin/dsv2dsv \ No newline at end of file diff --git a/node_modules/.bin/tsv2json b/node_modules/.bin/tsv2json deleted file mode 120000 index e4f6bd0..0000000 --- a/node_modules/.bin/tsv2json +++ /dev/null @@ -1 +0,0 @@ -../d3-dsv/bin/dsv2json \ No newline at end of file diff --git a/node_modules/.bin/vg2pdf b/node_modules/.bin/vg2pdf deleted file mode 120000 index db11ee4..0000000 --- a/node_modules/.bin/vg2pdf +++ /dev/null @@ -1 +0,0 @@ -../vega-cli/bin/vg2pdf \ No newline at end of file diff --git a/node_modules/.bin/vg2png b/node_modules/.bin/vg2png deleted file mode 120000 index e144003..0000000 --- a/node_modules/.bin/vg2png +++ /dev/null @@ -1 +0,0 @@ -../vega-cli/bin/vg2png \ No newline at end of file diff --git a/node_modules/.bin/vg2svg b/node_modules/.bin/vg2svg deleted file mode 120000 index 50cd047..0000000 --- a/node_modules/.bin/vg2svg +++ /dev/null @@ -1 +0,0 @@ -../vega-cli/bin/vg2svg \ No newline at end of file diff --git a/node_modules/.bin/vl2pdf b/node_modules/.bin/vl2pdf deleted file mode 120000 index 30feace..0000000 --- a/node_modules/.bin/vl2pdf +++ /dev/null @@ -1 +0,0 @@ -../vega-lite/bin/vl2pdf \ No newline at end of file diff --git a/node_modules/.bin/vl2png b/node_modules/.bin/vl2png deleted file mode 120000 index b1153ad..0000000 --- a/node_modules/.bin/vl2png +++ /dev/null @@ -1 +0,0 @@ -../vega-lite/bin/vl2png \ No newline at end of file diff --git a/node_modules/.bin/vl2svg b/node_modules/.bin/vl2svg deleted file mode 120000 index 93b135f..0000000 --- a/node_modules/.bin/vl2svg +++ /dev/null @@ -1 +0,0 @@ -../vega-lite/bin/vl2svg \ No newline at end of file diff --git a/node_modules/.bin/vl2vg b/node_modules/.bin/vl2vg deleted file mode 120000 index 77f9df6..0000000 --- a/node_modules/.bin/vl2vg +++ /dev/null @@ -1 +0,0 @@ -../vega-lite/bin/vl2vg \ No newline at end of file diff --git a/node_modules/@types/clone/README.md b/node_modules/@types/clone/README.md deleted file mode 100644 index fa4bf52..0000000 --- a/node_modules/@types/clone/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Installation -> `npm install --save @types/clone` - -# Summary -This package contains type definitions for clone 0.1.11 (https://github.com/pvorb/node-clone). - -# Details -Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/clone - -Additional Details - * Last updated: Mon, 19 Sep 2016 16:15:23 GMT - * File structure: ProperModule - * Library Dependencies: none - * Module Dependencies: none - * Global values: clone - -# Credits -These definitions were written by Kieran Simpson . diff --git a/node_modules/@types/clone/index.d.ts b/node_modules/@types/clone/index.d.ts deleted file mode 100644 index 07fb70d..0000000 --- a/node_modules/@types/clone/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Type definitions for clone 0.1.11 -// Project: https://github.com/pvorb/node-clone -// Definitions by: Kieran Simpson -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/** - * See clone JS source for API docs - */ - -/** - * @param val the value that you want to clone, any type allowed - * @param circular Call clone with circular set to false if you are certain that obj contains no circular references. This will give better performance if needed. There is no error if undefined or null is passed as obj. - * @param depth to wich the object is to be cloned (optional, defaults to infinity) - */ -declare function clone(val: T, circular?: boolean, depth?: number): T; - -declare namespace clone { - /** - * @param obj the object that you want to clone - */ - function clonePrototype(obj: T): T; -} - -export = clone diff --git a/node_modules/@types/clone/package.json b/node_modules/@types/clone/package.json deleted file mode 100644 index b6bc684..0000000 --- a/node_modules/@types/clone/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "_from": "@types/clone@~0.1.30", - "_id": "@types/clone@0.1.30", - "_inBundle": false, - "_integrity": "sha1-5zZWSMG0ITalnH1QQGN7O1yDthQ=", - "_location": "/@types/clone", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@types/clone@~0.1.30", - "name": "@types/clone", - "escapedName": "@types%2fclone", - "scope": "@types", - "rawSpec": "~0.1.30", - "saveSpec": null, - "fetchSpec": "~0.1.30" - }, - "_requiredBy": [ - "/vega-lite" - ], - "_resolved": "https://registry.npmjs.org/@types/clone/-/clone-0.1.30.tgz", - "_shasum": "e7365648c1b42136a59c7d5040637b3b5c83b614", - "_spec": "@types/clone@~0.1.30", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-lite", - "author": { - "name": "Kieran Simpson", - "email": "https://github.com/kierans/DefinitelyTyped" - }, - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "TypeScript definitions for clone 0.1.11", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/clone", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "typesPublisherContentHash": "29fd82aa066f07307712c9ce140436aba20b3bfbe9bf8f702f359c230c481f03", - "typings": "index.d.ts", - "version": "0.1.30" -} diff --git a/node_modules/@types/clone/types-metadata.json b/node_modules/@types/clone/types-metadata.json deleted file mode 100644 index 90ac6ae..0000000 --- a/node_modules/@types/clone/types-metadata.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "authors": "Kieran Simpson ", - "definitionFilename": "index.d.ts", - "libraryDependencies": [], - "moduleDependencies": [], - "libraryMajorVersion": "0", - "libraryMinorVersion": "1", - "libraryName": "clone 0.1.11", - "typingsPackageName": "clone", - "projectName": "https://github.com/pvorb/node-clone", - "sourceRepoURL": "https://www.github.com/DefinitelyTyped/DefinitelyTyped", - "sourceBranch": "types-2.0", - "kind": "ProperModule", - "globals": [ - "clone" - ], - "declaredModules": [ - "clone" - ], - "files": [ - "index.d.ts" - ], - "hasPackageJson": false, - "contentHash": "29fd82aa066f07307712c9ce140436aba20b3bfbe9bf8f702f359c230c481f03" -} \ No newline at end of file diff --git a/node_modules/@types/color-name/LICENSE b/node_modules/@types/color-name/LICENSE deleted file mode 100644 index 2107107..0000000 --- a/node_modules/@types/color-name/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/node_modules/@types/color-name/README.md b/node_modules/@types/color-name/README.md deleted file mode 100644 index d08d108..0000000 --- a/node_modules/@types/color-name/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/color-name` - -# Summary -This package contains type definitions for color-name ( https://github.com/colorjs/color-name ). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/color-name - -Additional Details - * Last updated: Wed, 13 Feb 2019 16:16:48 GMT - * Dependencies: none - * Global values: none - -# Credits -These definitions were written by Junyoung Clare Jang . diff --git a/node_modules/@types/color-name/index.d.ts b/node_modules/@types/color-name/index.d.ts deleted file mode 100644 index b5bff47..0000000 --- a/node_modules/@types/color-name/index.d.ts +++ /dev/null @@ -1,161 +0,0 @@ -// Type definitions for color-name 1.1 -// Project: https://github.com/colorjs/color-name -// Definitions by: Junyoung Clare Jang -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/** - * Tuple of Red, Green, and Blue - * @example - * // Red = 55, Green = 70, Blue = 0 - * const rgb: RGB = [55, 70, 0]; - */ -export type RGB = [number, number, number]; - -export const aliceblue: RGB; -export const antiquewhite: RGB; -export const aqua: RGB; -export const aquamarine: RGB; -export const azure: RGB; -export const beige: RGB; -export const bisque: RGB; -export const black: RGB; -export const blanchedalmond: RGB; -export const blue: RGB; -export const blueviolet: RGB; -export const brown: RGB; -export const burlywood: RGB; -export const cadetblue: RGB; -export const chartreuse: RGB; -export const chocolate: RGB; -export const coral: RGB; -export const cornflowerblue: RGB; -export const cornsilk: RGB; -export const crimson: RGB; -export const cyan: RGB; -export const darkblue: RGB; -export const darkcyan: RGB; -export const darkgoldenrod: RGB; -export const darkgray: RGB; -export const darkgreen: RGB; -export const darkgrey: RGB; -export const darkkhaki: RGB; -export const darkmagenta: RGB; -export const darkolivegreen: RGB; -export const darkorange: RGB; -export const darkorchid: RGB; -export const darkred: RGB; -export const darksalmon: RGB; -export const darkseagreen: RGB; -export const darkslateblue: RGB; -export const darkslategray: RGB; -export const darkslategrey: RGB; -export const darkturquoise: RGB; -export const darkviolet: RGB; -export const deeppink: RGB; -export const deepskyblue: RGB; -export const dimgray: RGB; -export const dimgrey: RGB; -export const dodgerblue: RGB; -export const firebrick: RGB; -export const floralwhite: RGB; -export const forestgreen: RGB; -export const fuchsia: RGB; -export const gainsboro: RGB; -export const ghostwhite: RGB; -export const gold: RGB; -export const goldenrod: RGB; -export const gray: RGB; -export const green: RGB; -export const greenyellow: RGB; -export const grey: RGB; -export const honeydew: RGB; -export const hotpink: RGB; -export const indianred: RGB; -export const indigo: RGB; -export const ivory: RGB; -export const khaki: RGB; -export const lavender: RGB; -export const lavenderblush: RGB; -export const lawngreen: RGB; -export const lemonchiffon: RGB; -export const lightblue: RGB; -export const lightcoral: RGB; -export const lightcyan: RGB; -export const lightgoldenrodyellow: RGB; -export const lightgray: RGB; -export const lightgreen: RGB; -export const lightgrey: RGB; -export const lightpink: RGB; -export const lightsalmon: RGB; -export const lightseagreen: RGB; -export const lightskyblue: RGB; -export const lightslategray: RGB; -export const lightslategrey: RGB; -export const lightsteelblue: RGB; -export const lightyellow: RGB; -export const lime: RGB; -export const limegreen: RGB; -export const linen: RGB; -export const magenta: RGB; -export const maroon: RGB; -export const mediumaquamarine: RGB; -export const mediumblue: RGB; -export const mediumorchid: RGB; -export const mediumpurple: RGB; -export const mediumseagreen: RGB; -export const mediumslateblue: RGB; -export const mediumspringgreen: RGB; -export const mediumturquoise: RGB; -export const mediumvioletred: RGB; -export const midnightblue: RGB; -export const mintcream: RGB; -export const mistyrose: RGB; -export const moccasin: RGB; -export const navajowhite: RGB; -export const navy: RGB; -export const oldlace: RGB; -export const olive: RGB; -export const olivedrab: RGB; -export const orange: RGB; -export const orangered: RGB; -export const orchid: RGB; -export const palegoldenrod: RGB; -export const palegreen: RGB; -export const paleturquoise: RGB; -export const palevioletred: RGB; -export const papayawhip: RGB; -export const peachpuff: RGB; -export const peru: RGB; -export const pink: RGB; -export const plum: RGB; -export const powderblue: RGB; -export const purple: RGB; -export const rebeccapurple: RGB; -export const red: RGB; -export const rosybrown: RGB; -export const royalblue: RGB; -export const saddlebrown: RGB; -export const salmon: RGB; -export const sandybrown: RGB; -export const seagreen: RGB; -export const seashell: RGB; -export const sienna: RGB; -export const silver: RGB; -export const skyblue: RGB; -export const slateblue: RGB; -export const slategray: RGB; -export const slategrey: RGB; -export const snow: RGB; -export const springgreen: RGB; -export const steelblue: RGB; -export const tan: RGB; -export const teal: RGB; -export const thistle: RGB; -export const tomato: RGB; -export const turquoise: RGB; -export const violet: RGB; -export const wheat: RGB; -export const white: RGB; -export const whitesmoke: RGB; -export const yellow: RGB; -export const yellowgreen: RGB; diff --git a/node_modules/@types/color-name/package.json b/node_modules/@types/color-name/package.json deleted file mode 100644 index eef045e..0000000 --- a/node_modules/@types/color-name/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_from": "@types/color-name@^1.1.1", - "_id": "@types/color-name@1.1.1", - "_inBundle": false, - "_integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", - "_location": "/@types/color-name", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@types/color-name@^1.1.1", - "name": "@types/color-name", - "escapedName": "@types%2fcolor-name", - "scope": "@types", - "rawSpec": "^1.1.1", - "saveSpec": null, - "fetchSpec": "^1.1.1" - }, - "_requiredBy": [ - "/ansi-styles" - ], - "_resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "_shasum": "1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0", - "_spec": "@types/color-name@^1.1.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/ansi-styles", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Junyoung Clare Jang", - "url": "https://github.com/Ailrun" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "TypeScript definitions for color-name", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/color-name", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "typeScriptVersion": "2.0", - "types": "index", - "typesPublisherContentHash": "e22c6881e2dcf766e32142cbb82d9acf9c08258bdf0da8e76c8a448d1be44ac7", - "version": "1.1.1" -} diff --git a/node_modules/@types/fast-json-stable-stringify/LICENSE b/node_modules/@types/fast-json-stable-stringify/LICENSE deleted file mode 100644 index 2107107..0000000 --- a/node_modules/@types/fast-json-stable-stringify/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/node_modules/@types/fast-json-stable-stringify/README.md b/node_modules/@types/fast-json-stable-stringify/README.md deleted file mode 100644 index 917273f..0000000 --- a/node_modules/@types/fast-json-stable-stringify/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/fast-json-stable-stringify` - -# Summary -This package contains type definitions for fast-json-stable-stringify (https://github.com/epoberezkin/fast-json-stable-stringify). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fast-json-stable-stringify - -Additional Details - * Last updated: Tue, 25 Dec 2018 05:33:14 GMT - * Dependencies: none - * Global values: none - -# Credits -These definitions were written by BendingBender . diff --git a/node_modules/@types/fast-json-stable-stringify/index.d.ts b/node_modules/@types/fast-json-stable-stringify/index.d.ts deleted file mode 100644 index be89dd7..0000000 --- a/node_modules/@types/fast-json-stable-stringify/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Type definitions for fast-json-stable-stringify 2.0 -// Project: https://github.com/epoberezkin/fast-json-stable-stringify -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = stringify; - -declare function stringify(obj: any, options?: stringify.Options | stringify.Comparator): string; - -declare namespace stringify { - interface Options { - cmp?: (a: CompareDescriptor, b: CompareDescriptor) => number; - cycles?: boolean; - } - - type Comparator = (a: CompareDescriptor, b: CompareDescriptor) => number; - - interface CompareDescriptor { - key: string; - value: any; - } -} diff --git a/node_modules/@types/fast-json-stable-stringify/package.json b/node_modules/@types/fast-json-stable-stringify/package.json deleted file mode 100644 index b8c8cfc..0000000 --- a/node_modules/@types/fast-json-stable-stringify/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_from": "@types/fast-json-stable-stringify@^2.0.0", - "_id": "@types/fast-json-stable-stringify@2.0.0", - "_inBundle": false, - "_integrity": "sha512-mky/O83TXmGY39P1H9YbUpjV6l6voRYlufqfFCvel8l1phuy8HRjdWc1rrPuN53ITBJlbyMSV6z3niOySO5pgQ==", - "_location": "/@types/fast-json-stable-stringify", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@types/fast-json-stable-stringify@^2.0.0", - "name": "@types/fast-json-stable-stringify", - "escapedName": "@types%2ffast-json-stable-stringify", - "scope": "@types", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/vega-lite" - ], - "_resolved": "https://registry.npmjs.org/@types/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "_shasum": "40363bb847cb86b2c2e1599f1398d11e8329c921", - "_spec": "@types/fast-json-stable-stringify@^2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-lite", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "BendingBender", - "url": "https://github.com/BendingBender" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "TypeScript definitions for fast-json-stable-stringify", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/fast-json-stable-stringify", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "typeScriptVersion": "2.0", - "types": "index", - "typesPublisherContentHash": "10ecc071e68a8895448c33e019c987380665fea2ff8d5592670b5bfeb694c772", - "version": "2.0.0" -} diff --git a/node_modules/abbrev/LICENSE b/node_modules/abbrev/LICENSE deleted file mode 100644 index 9bcfa9d..0000000 --- a/node_modules/abbrev/LICENSE +++ /dev/null @@ -1,46 +0,0 @@ -This software is dual-licensed under the ISC and MIT licenses. -You may use this software under EITHER of the following licenses. - ----------- - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----------- - -Copyright Isaac Z. Schlueter and Contributors -All rights reserved. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/abbrev/README.md b/node_modules/abbrev/README.md deleted file mode 100644 index 99746fe..0000000 --- a/node_modules/abbrev/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# abbrev-js - -Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev). - -Usage: - - var abbrev = require("abbrev"); - abbrev("foo", "fool", "folding", "flop"); - - // returns: - { fl: 'flop' - , flo: 'flop' - , flop: 'flop' - , fol: 'folding' - , fold: 'folding' - , foldi: 'folding' - , foldin: 'folding' - , folding: 'folding' - , foo: 'foo' - , fool: 'fool' - } - -This is handy for command-line scripts, or other cases where you want to be able to accept shorthands. diff --git a/node_modules/abbrev/abbrev.js b/node_modules/abbrev/abbrev.js deleted file mode 100644 index 7b1dc5d..0000000 --- a/node_modules/abbrev/abbrev.js +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = exports = abbrev.abbrev = abbrev - -abbrev.monkeyPatch = monkeyPatch - -function monkeyPatch () { - Object.defineProperty(Array.prototype, 'abbrev', { - value: function () { return abbrev(this) }, - enumerable: false, configurable: true, writable: true - }) - - Object.defineProperty(Object.prototype, 'abbrev', { - value: function () { return abbrev(Object.keys(this)) }, - enumerable: false, configurable: true, writable: true - }) -} - -function abbrev (list) { - if (arguments.length !== 1 || !Array.isArray(list)) { - list = Array.prototype.slice.call(arguments, 0) - } - for (var i = 0, l = list.length, args = [] ; i < l ; i ++) { - args[i] = typeof list[i] === "string" ? list[i] : String(list[i]) - } - - // sort them lexicographically, so that they're next to their nearest kin - args = args.sort(lexSort) - - // walk through each, seeing how much it has in common with the next and previous - var abbrevs = {} - , prev = "" - for (var i = 0, l = args.length ; i < l ; i ++) { - var current = args[i] - , next = args[i + 1] || "" - , nextMatches = true - , prevMatches = true - if (current === next) continue - for (var j = 0, cl = current.length ; j < cl ; j ++) { - var curChar = current.charAt(j) - nextMatches = nextMatches && curChar === next.charAt(j) - prevMatches = prevMatches && curChar === prev.charAt(j) - if (!nextMatches && !prevMatches) { - j ++ - break - } - } - prev = current - if (j === cl) { - abbrevs[current] = current - continue - } - for (var a = current.substr(0, j) ; j <= cl ; j ++) { - abbrevs[a] = current - a += current.charAt(j) - } - } - return abbrevs -} - -function lexSort (a, b) { - return a === b ? 0 : a > b ? 1 : -1 -} diff --git a/node_modules/abbrev/package.json b/node_modules/abbrev/package.json deleted file mode 100644 index ce37411..0000000 --- a/node_modules/abbrev/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_from": "abbrev@1", - "_id": "abbrev@1.1.1", - "_inBundle": false, - "_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "_location": "/abbrev", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "abbrev@1", - "name": "abbrev", - "escapedName": "abbrev", - "rawSpec": "1", - "saveSpec": null, - "fetchSpec": "1" - }, - "_requiredBy": [ - "/nopt" - ], - "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "_shasum": "f8f2c887ad10bf67f634f005b6987fed3179aac8", - "_spec": "abbrev@1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/nopt", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me" - }, - "bugs": { - "url": "https://github.com/isaacs/abbrev-js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Like ruby's abbrev module, but in js", - "devDependencies": { - "tap": "^10.1" - }, - "files": [ - "abbrev.js" - ], - "homepage": "https://github.com/isaacs/abbrev-js#readme", - "license": "ISC", - "main": "abbrev.js", - "name": "abbrev", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/isaacs/abbrev-js.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test.js --100" - }, - "version": "1.1.1" -} diff --git a/node_modules/ansi-regex/index.js b/node_modules/ansi-regex/index.js deleted file mode 100644 index b9574ed..0000000 --- a/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -module.exports = function () { - return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; -}; diff --git a/node_modules/ansi-regex/license b/node_modules/ansi-regex/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/ansi-regex/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/ansi-regex/package.json b/node_modules/ansi-regex/package.json deleted file mode 100644 index db37063..0000000 --- a/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "_from": "ansi-regex@^2.0.0", - "_id": "ansi-regex@2.1.1", - "_inBundle": false, - "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "_location": "/ansi-regex", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ansi-regex@^2.0.0", - "name": "ansi-regex", - "escapedName": "ansi-regex", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/strip-ansi" - ], - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df", - "_spec": "ansi-regex@^2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/ansi-regex/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Regular expression for matching ANSI escape codes", - "devDependencies": { - "ava": "0.17.0", - "xo": "0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/ansi-regex#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - }, - { - "name": "JD Ballard", - "email": "i.am.qix@gmail.com", - "url": "github.com/qix-" - } - ], - "name": "ansi-regex", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/ansi-regex.git" - }, - "scripts": { - "test": "xo && ava --verbose", - "view-supported": "node fixtures/view-codes.js" - }, - "version": "2.1.1", - "xo": { - "rules": { - "guard-for-in": 0, - "no-loop-func": 0 - } - } -} diff --git a/node_modules/ansi-regex/readme.md b/node_modules/ansi-regex/readme.md deleted file mode 100644 index 6a928ed..0000000 --- a/node_modules/ansi-regex/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) - -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install --save ansi-regex -``` - - -## Usage - -```js -const ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001b[4mcake\u001b[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] -``` - -## FAQ - -### Why do you test for codes not in the ECMA 48 standard? - -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. - -On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/ansi-styles/index.d.ts b/node_modules/ansi-styles/index.d.ts deleted file mode 100644 index 7e9b2b7..0000000 --- a/node_modules/ansi-styles/index.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -import * as cssColors from 'color-name'; - -declare namespace ansiStyles { - interface ColorConvert { - /** - The RGB color space. - - @param red - (`0`-`255`) - @param green - (`0`-`255`) - @param blue - (`0`-`255`) - */ - rgb(red: number, green: number, blue: number): string; - - /** - The RGB HEX color space. - - @param hex - A hexadecimal string containing RGB data. - */ - hex(hex: string): string; - - /** - @param keyword - A CSS color name. - */ - keyword(keyword: keyof typeof cssColors): string; - - /** - The HSL color space. - - @param hue - (`0`-`360`) - @param saturation - (`0`-`100`) - @param lightness - (`0`-`100`) - */ - hsl(hue: number, saturation: number, lightness: number): string; - - /** - The HSV color space. - - @param hue - (`0`-`360`) - @param saturation - (`0`-`100`) - @param value - (`0`-`100`) - */ - hsv(hue: number, saturation: number, value: number): string; - - /** - The HSV color space. - - @param hue - (`0`-`360`) - @param whiteness - (`0`-`100`) - @param blackness - (`0`-`100`) - */ - hwb(hue: number, whiteness: number, blackness: number): string; - - /** - Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color. - */ - ansi(ansi: number): string; - - /** - Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. - */ - ansi256(ansi: number): string; - } - - interface CSPair { - /** - The ANSI terminal control sequence for starting this style. - */ - readonly open: string; - - /** - The ANSI terminal control sequence for ending this style. - */ - readonly close: string; - } - - interface ColorBase { - readonly ansi: ColorConvert; - readonly ansi256: ColorConvert; - readonly ansi16m: ColorConvert; - - /** - The ANSI terminal control sequence for ending this color. - */ - readonly close: string; - } - - interface Modifier { - /** - Resets the current color chain. - */ - readonly reset: CSPair; - - /** - Make text bold. - */ - readonly bold: CSPair; - - /** - Emitting only a small amount of light. - */ - readonly dim: CSPair; - - /** - Make text italic. (Not widely supported) - */ - readonly italic: CSPair; - - /** - Make text underline. (Not widely supported) - */ - readonly underline: CSPair; - - /** - Inverse background and foreground colors. - */ - readonly inverse: CSPair; - - /** - Prints the text, but makes it invisible. - */ - readonly hidden: CSPair; - - /** - Puts a horizontal line through the center of the text. (Not widely supported) - */ - readonly strikethrough: CSPair; - } - - interface ForegroundColor { - readonly black: CSPair; - readonly red: CSPair; - readonly green: CSPair; - readonly yellow: CSPair; - readonly blue: CSPair; - readonly cyan: CSPair; - readonly magenta: CSPair; - readonly white: CSPair; - - /** - Alias for `blackBright`. - */ - readonly gray: CSPair; - - /** - Alias for `blackBright`. - */ - readonly grey: CSPair; - - readonly blackBright: CSPair; - readonly redBright: CSPair; - readonly greenBright: CSPair; - readonly yellowBright: CSPair; - readonly blueBright: CSPair; - readonly cyanBright: CSPair; - readonly magentaBright: CSPair; - readonly whiteBright: CSPair; - } - - interface BackgroundColor { - readonly bgBlack: CSPair; - readonly bgRed: CSPair; - readonly bgGreen: CSPair; - readonly bgYellow: CSPair; - readonly bgBlue: CSPair; - readonly bgCyan: CSPair; - readonly bgMagenta: CSPair; - readonly bgWhite: CSPair; - - /** - Alias for `bgBlackBright`. - */ - readonly bgGray: CSPair; - - /** - Alias for `bgBlackBright`. - */ - readonly bgGrey: CSPair; - - readonly bgBlackBright: CSPair; - readonly bgRedBright: CSPair; - readonly bgGreenBright: CSPair; - readonly bgYellowBright: CSPair; - readonly bgBlueBright: CSPair; - readonly bgCyanBright: CSPair; - readonly bgMagentaBright: CSPair; - readonly bgWhiteBright: CSPair; - } -} - -declare const ansiStyles: { - readonly modifier: ansiStyles.Modifier; - readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase; - readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase; - readonly codes: ReadonlyMap; -} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier; - -export = ansiStyles; diff --git a/node_modules/ansi-styles/index.js b/node_modules/ansi-styles/index.js deleted file mode 100644 index 5d82581..0000000 --- a/node_modules/ansi-styles/index.js +++ /dev/null @@ -1,163 +0,0 @@ -'use strict'; - -const wrapAnsi16 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${code + offset}m`; -}; - -const wrapAnsi256 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${38 + offset};5;${code}m`; -}; - -const wrapAnsi16m = (fn, offset) => (...args) => { - const rgb = fn(...args); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; - -const ansi2ansi = n => n; -const rgb2rgb = (r, g, b) => [r, g, b]; - -const setLazyProperty = (object, property, get) => { - Object.defineProperty(object, property, { - get: () => { - const value = get(); - - Object.defineProperty(object, property, { - value, - enumerable: true, - configurable: true - }); - - return value; - }, - enumerable: true, - configurable: true - }); -}; - -/** @type {typeof import('color-convert')} */ -let colorConvert; -const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { - if (colorConvert === undefined) { - colorConvert = require('color-convert'); - } - - const offset = isBackground ? 10 : 0; - const styles = {}; - - for (const [sourceSpace, suite] of Object.entries(colorConvert)) { - const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; - if (sourceSpace === targetSpace) { - styles[name] = wrap(identity, offset); - } else if (typeof suite === 'object') { - styles[name] = wrap(suite[targetSpace], offset); - } - } - - return styles; -}; - -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - - // Bright color - blackBright: [90, 39], - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } - }; - - // Alias bright black as gray (and grey) - styles.color.gray = styles.color.blackBright; - styles.bgColor.bgGray = styles.bgColor.bgBlackBright; - styles.color.grey = styles.color.blackBright; - styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; - - for (const [groupName, group] of Object.entries(styles)) { - for (const [styleName, style] of Object.entries(group)) { - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; - - group[styleName] = styles[styleName]; - - codes.set(style[0], style[1]); - } - - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); - } - - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); - - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; - - setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); - setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); - - return styles; -} - -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); diff --git a/node_modules/ansi-styles/license b/node_modules/ansi-styles/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/ansi-styles/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/ansi-styles/package.json b/node_modules/ansi-styles/package.json deleted file mode 100644 index 8eacc44..0000000 --- a/node_modules/ansi-styles/package.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "_from": "ansi-styles@^4.0.0", - "_id": "ansi-styles@4.2.1", - "_inBundle": false, - "_integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "_location": "/ansi-styles", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ansi-styles@^4.0.0", - "name": "ansi-styles", - "escapedName": "ansi-styles", - "rawSpec": "^4.0.0", - "saveSpec": null, - "fetchSpec": "^4.0.0" - }, - "_requiredBy": [ - "/wrap-ansi" - ], - "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "_shasum": "90ae75c424d008d2624c5bf29ead3177ebfcf359", - "_spec": "ansi-styles@^4.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/wrap-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/ansi-styles/issues" - }, - "bundleDependencies": false, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, - "deprecated": false, - "description": "ANSI escape codes for styling strings in the terminal", - "devDependencies": { - "@types/color-convert": "^1.9.0", - "ava": "^2.3.0", - "svg-term-cli": "^2.1.1", - "tsd": "^0.11.0", - "xo": "^0.25.3" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "funding": "https://github.com/chalk/ansi-styles?sponsor=1", - "homepage": "https://github.com/chalk/ansi-styles#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "ansi-styles", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/ansi-styles.git" - }, - "scripts": { - "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor", - "test": "xo && ava && tsd" - }, - "version": "4.2.1" -} diff --git a/node_modules/ansi-styles/readme.md b/node_modules/ansi-styles/readme.md deleted file mode 100644 index 2a1ef65..0000000 --- a/node_modules/ansi-styles/readme.md +++ /dev/null @@ -1,158 +0,0 @@ -# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) - -> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal - -You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. - - - -## Install - -``` -$ npm install ansi-styles -``` - -## Usage - -```js -const style = require('ansi-styles'); - -console.log(`${style.green.open}Hello world!${style.green.close}`); - - -// Color conversion between 16/256/truecolor -// NOTE: If conversion goes to 16 colors or 256 colors, the original color -// may be degraded to fit that color palette. This means terminals -// that do not support 16 million colors will best-match the -// original color. -console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); -console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); -console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close); -``` - -## API - -Each style has an `open` and `close` property. - -## Styles - -### Modifiers - -- `reset` -- `bold` -- `dim` -- `italic` *(Not widely supported)* -- `underline` -- `inverse` -- `hidden` -- `strikethrough` *(Not widely supported)* - -### Colors - -- `black` -- `red` -- `green` -- `yellow` -- `blue` -- `magenta` -- `cyan` -- `white` -- `blackBright` (alias: `gray`, `grey`) -- `redBright` -- `greenBright` -- `yellowBright` -- `blueBright` -- `magentaBright` -- `cyanBright` -- `whiteBright` - -### Background colors - -- `bgBlack` -- `bgRed` -- `bgGreen` -- `bgYellow` -- `bgBlue` -- `bgMagenta` -- `bgCyan` -- `bgWhite` -- `bgBlackBright` (alias: `bgGray`, `bgGrey`) -- `bgRedBright` -- `bgGreenBright` -- `bgYellowBright` -- `bgBlueBright` -- `bgMagentaBright` -- `bgCyanBright` -- `bgWhiteBright` - -## Advanced usage - -By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. - -- `style.modifier` -- `style.color` -- `style.bgColor` - -###### Example - -```js -console.log(style.color.green.open); -``` - -Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. - -###### Example - -```js -console.log(style.codes.get(36)); -//=> 39 -``` - -## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) - -`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. - -The following color spaces from `color-convert` are supported: - -- `rgb` -- `hex` -- `keyword` -- `hsl` -- `hsv` -- `hwb` -- `ansi` -- `ansi256` - -To use these, call the associated conversion function with the intended output, for example: - -```js -style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code -style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code - -style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code -style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code - -style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code -style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code -``` - -## Related - -- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/aproba/LICENSE b/node_modules/aproba/LICENSE deleted file mode 100644 index f4be44d..0000000 --- a/node_modules/aproba/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2015, Rebecca Turner - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - diff --git a/node_modules/aproba/README.md b/node_modules/aproba/README.md deleted file mode 100644 index 0bfc594..0000000 --- a/node_modules/aproba/README.md +++ /dev/null @@ -1,94 +0,0 @@ -aproba -====== - -A ridiculously light-weight function argument validator - -``` -var validate = require("aproba") - -function myfunc(a, b, c) { - // `a` must be a string, `b` a number, `c` a function - validate('SNF', arguments) // [a,b,c] is also valid -} - -myfunc('test', 23, function () {}) // ok -myfunc(123, 23, function () {}) // type error -myfunc('test', 23) // missing arg error -myfunc('test', 23, function () {}, true) // too many args error - -``` - -Valid types are: - -| type | description -| :--: | :---------- -| * | matches any type -| A | `Array.isArray` OR an `arguments` object -| S | typeof == string -| N | typeof == number -| F | typeof == function -| O | typeof == object and not type A and not type E -| B | typeof == boolean -| E | `instanceof Error` OR `null` **(special: see below)** -| Z | == `null` - -Validation failures throw one of three exception types, distinguished by a -`code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`. - -If you pass in an invalid type then it will throw with a code of -`EUNKNOWNTYPE`. - -If an **error** argument is found and is not null then the remaining -arguments are optional. That is, if you say `ESO` then that's like using a -non-magical `E` in: `E|ESO|ZSO`. - -### But I have optional arguments?! - -You can provide more than one signature by separating them with pipes `|`. -If any signature matches the arguments then they'll be considered valid. - -So for example, say you wanted to write a signature for -`fs.createWriteStream`. The docs for it describe it thusly: - -``` -fs.createWriteStream(path[, options]) -``` - -This would be a signature of `SO|S`. That is, a string and and object, or -just a string. - -Now, if you read the full `fs` docs, you'll see that actually path can ALSO -be a buffer. And options can be a string, that is: -``` -path | -options | -``` - -To reproduce this you have to fully enumerate all of the possible -combinations and that implies a signature of `SO|SS|OO|OS|S|O`. The -awkwardness is a feature: It reminds you of the complexity you're adding to -your API when you do this sort of thing. - - -### Browser support - -This has no dependencies and should work in browsers, though you'll have -noisier stack traces. - -### Why this exists - -I wanted a very simple argument validator. It needed to do two things: - -1. Be more concise and easier to use than assertions - -2. Not encourage an infinite bikeshed of DSLs - -This is why types are specified by a single character and there's no such -thing as an optional argument. - -This is not intended to validate user data. This is specifically about -asserting the interface of your functions. - -If you need greater validation, I encourage you to write them by hand or -look elsewhere. - diff --git a/node_modules/aproba/index.js b/node_modules/aproba/index.js deleted file mode 100644 index 6f3f797..0000000 --- a/node_modules/aproba/index.js +++ /dev/null @@ -1,105 +0,0 @@ -'use strict' - -function isArguments (thingy) { - return thingy != null && typeof thingy === 'object' && thingy.hasOwnProperty('callee') -} - -var types = { - '*': {label: 'any', check: function () { return true }}, - A: {label: 'array', check: function (thingy) { return Array.isArray(thingy) || isArguments(thingy) }}, - S: {label: 'string', check: function (thingy) { return typeof thingy === 'string' }}, - N: {label: 'number', check: function (thingy) { return typeof thingy === 'number' }}, - F: {label: 'function', check: function (thingy) { return typeof thingy === 'function' }}, - O: {label: 'object', check: function (thingy) { return typeof thingy === 'object' && thingy != null && !types.A.check(thingy) && !types.E.check(thingy) }}, - B: {label: 'boolean', check: function (thingy) { return typeof thingy === 'boolean' }}, - E: {label: 'error', check: function (thingy) { return thingy instanceof Error }}, - Z: {label: 'null', check: function (thingy) { return thingy == null }} -} - -function addSchema (schema, arity) { - var group = arity[schema.length] = arity[schema.length] || [] - if (group.indexOf(schema) === -1) group.push(schema) -} - -var validate = module.exports = function (rawSchemas, args) { - if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length) - if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas') - if (!args) throw missingRequiredArg(1, 'args') - if (!types.S.check(rawSchemas)) throw invalidType(0, ['string'], rawSchemas) - if (!types.A.check(args)) throw invalidType(1, ['array'], args) - var schemas = rawSchemas.split('|') - var arity = {} - - schemas.forEach(function (schema) { - for (var ii = 0; ii < schema.length; ++ii) { - var type = schema[ii] - if (!types[type]) throw unknownType(ii, type) - } - if (/E.*E/.test(schema)) throw moreThanOneError(schema) - addSchema(schema, arity) - if (/E/.test(schema)) { - addSchema(schema.replace(/E.*$/, 'E'), arity) - addSchema(schema.replace(/E/, 'Z'), arity) - if (schema.length === 1) addSchema('', arity) - } - }) - var matching = arity[args.length] - if (!matching) { - throw wrongNumberOfArgs(Object.keys(arity), args.length) - } - for (var ii = 0; ii < args.length; ++ii) { - var newMatching = matching.filter(function (schema) { - var type = schema[ii] - var typeCheck = types[type].check - return typeCheck(args[ii]) - }) - if (!newMatching.length) { - var labels = matching.map(function (schema) { - return types[schema[ii]].label - }).filter(function (schema) { return schema != null }) - throw invalidType(ii, labels, args[ii]) - } - matching = newMatching - } -} - -function missingRequiredArg (num) { - return newException('EMISSINGARG', 'Missing required argument #' + (num + 1)) -} - -function unknownType (num, type) { - return newException('EUNKNOWNTYPE', 'Unknown type ' + type + ' in argument #' + (num + 1)) -} - -function invalidType (num, expectedTypes, value) { - var valueType - Object.keys(types).forEach(function (typeCode) { - if (types[typeCode].check(value)) valueType = types[typeCode].label - }) - return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' + - englishList(expectedTypes) + ' but got ' + valueType) -} - -function englishList (list) { - return list.join(', ').replace(/, ([^,]+)$/, ' or $1') -} - -function wrongNumberOfArgs (expected, got) { - var english = englishList(expected) - var args = expected.every(function (ex) { return ex.length === 1 }) - ? 'argument' - : 'arguments' - return newException('EWRONGARGCOUNT', 'Expected ' + english + ' ' + args + ' but got ' + got) -} - -function moreThanOneError (schema) { - return newException('ETOOMANYERRORTYPES', - 'Only one error type per argument signature is allowed, more than one found in "' + schema + '"') -} - -function newException (code, msg) { - var e = new Error(msg) - e.code = code - if (Error.captureStackTrace) Error.captureStackTrace(e, validate) - return e -} diff --git a/node_modules/aproba/package.json b/node_modules/aproba/package.json deleted file mode 100644 index 9e4567a..0000000 --- a/node_modules/aproba/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "aproba@^1.0.3", - "_id": "aproba@1.2.0", - "_inBundle": false, - "_integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "_location": "/aproba", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "aproba@^1.0.3", - "name": "aproba", - "escapedName": "aproba", - "rawSpec": "^1.0.3", - "saveSpec": null, - "fetchSpec": "^1.0.3" - }, - "_requiredBy": [ - "/gauge" - ], - "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "_shasum": "6802e6264efd18c790a1b0d517f0f2627bf2c94a", - "_spec": "aproba@^1.0.3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/gauge", - "author": { - "name": "Rebecca Turner", - "email": "me@re-becca.org" - }, - "bugs": { - "url": "https://github.com/iarna/aproba/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "A ridiculously light-weight argument validator (now browser friendly)", - "devDependencies": { - "standard": "^10.0.3", - "tap": "^10.0.2" - }, - "directories": { - "test": "test" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/iarna/aproba", - "keywords": [ - "argument", - "validate" - ], - "license": "ISC", - "main": "index.js", - "name": "aproba", - "repository": { - "type": "git", - "url": "git+https://github.com/iarna/aproba.git" - }, - "scripts": { - "test": "standard && tap -j3 test/*.js" - }, - "version": "1.2.0" -} diff --git a/node_modules/are-we-there-yet/CHANGES.md b/node_modules/are-we-there-yet/CHANGES.md deleted file mode 100644 index 21f3b1c..0000000 --- a/node_modules/are-we-there-yet/CHANGES.md +++ /dev/null @@ -1,37 +0,0 @@ -Hi, figured we could actually use a changelog now: - -## 1.1.5 2018-05-24 - -* [#92](https://github.com/iarna/are-we-there-yet/pull/92) Fix bug where - `finish` would throw errors when including `TrackerStream` objects in - `TrackerGroup` collections. (@brianloveswords) - -## 1.1.4 2017-04-21 - -* Fix typo in package.json - -## 1.1.3 2017-04-21 - -* Improve documentation and limit files included in the distribution. - -## 1.1.2 2016-03-15 - -* Add tracker group cycle detection and tests for it - -## 1.1.1 2016-01-29 - -* Fix a typo in stream completion tracker - -## 1.1.0 2016-01-29 - -* Rewrote completion percent computation to be low impact– no more walking a - tree of completion groups every time we need this info. Previously, with - medium sized tree of completion groups, even a relatively modest number of - calls to the top level `completed()` method would result in absurd numbers - of calls overall as it walked down the tree. We now, instead, keep track as - we bubble up changes, so the computation is limited to when data changes and - to the depth of that one branch, instead of _every_ node. (Plus, we were already - incurring _this_ cost, since we already bubbled out changes.) -* Moved different tracker types out to their own files. -* Made tests test for TOO MANY events too. -* Standarized the source code formatting diff --git a/node_modules/are-we-there-yet/LICENSE b/node_modules/are-we-there-yet/LICENSE deleted file mode 100644 index af45880..0000000 --- a/node_modules/are-we-there-yet/LICENSE +++ /dev/null @@ -1,5 +0,0 @@ -Copyright (c) 2015, Rebecca Turner - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/are-we-there-yet/README.md b/node_modules/are-we-there-yet/README.md deleted file mode 100644 index 7e2b42d..0000000 --- a/node_modules/are-we-there-yet/README.md +++ /dev/null @@ -1,195 +0,0 @@ -are-we-there-yet ----------------- - -Track complex hiearchies of asynchronous task completion statuses. This is -intended to give you a way of recording and reporting the progress of the big -recursive fan-out and gather type workflows that are so common in async. - -What you do with this completion data is up to you, but the most common use case is to -feed it to one of the many progress bar modules. - -Most progress bar modules include a rudamentary version of this, but my -needs were more complex. - -Usage -===== - -```javascript -var TrackerGroup = require("are-we-there-yet").TrackerGroup - -var top = new TrackerGroup("program") - -var single = top.newItem("one thing", 100) -single.completeWork(20) - -console.log(top.completed()) // 0.2 - -fs.stat("file", function(er, stat) { - if (er) throw er - var stream = top.newStream("file", stat.size) - console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete - // and 50% * 20% == 10% - fs.createReadStream("file").pipe(stream).on("data", function (chunk) { - // do stuff with chunk - }) - top.on("change", function (name) { - // called each time a chunk is read from "file" - // top.completed() will start at 0.1 and fill up to 0.6 as the file is read - }) -}) -``` - -Shared Methods -============== - -* var completed = tracker.completed() - -Implemented in: `Tracker`, `TrackerGroup`, `TrackerStream` - -Returns the ratio of completed work to work to be done. Range of 0 to 1. - -* tracker.finish() - -Implemented in: `Tracker`, `TrackerGroup` - -Marks the tracker as completed. With a TrackerGroup this marks all of its -components as completed. - -Marks all of the components of this tracker as finished, which in turn means -that `tracker.completed()` for this will now be 1. - -This will result in one or more `change` events being emitted. - -Events -====== - -All tracker objects emit `change` events with the following arguments: - -``` -function (name, completed, tracker) -``` - -`name` is the name of the tracker that originally emitted the event, -or if it didn't have one, the first containing tracker group that had one. - -`completed` is the percent complete (as returned by `tracker.completed()` method). - -`tracker` is the tracker object that you are listening for events on. - -TrackerGroup -============ - -* var tracker = new TrackerGroup(**name**) - - * **name** *(optional)* - The name of this tracker group, used in change - notifications if the component updating didn't have a name. Defaults to undefined. - -Creates a new empty tracker aggregation group. These are trackers whose -completion status is determined by the completion status of other trackers. - -* tracker.addUnit(**otherTracker**, **weight**) - - * **otherTracker** - Any of the other are-we-there-yet tracker objects - * **weight** *(optional)* - The weight to give the tracker, defaults to 1. - -Adds the **otherTracker** to this aggregation group. The weight determines -how long you expect this tracker to take to complete in proportion to other -units. So for instance, if you add one tracker with a weight of 1 and -another with a weight of 2, you're saying the second will take twice as long -to complete as the first. As such, the first will account for 33% of the -completion of this tracker and the second will account for the other 67%. - -Returns **otherTracker**. - -* var subGroup = tracker.newGroup(**name**, **weight**) - -The above is exactly equivalent to: - -```javascript - var subGroup = tracker.addUnit(new TrackerGroup(name), weight) -``` - -* var subItem = tracker.newItem(**name**, **todo**, **weight**) - -The above is exactly equivalent to: - -```javascript - var subItem = tracker.addUnit(new Tracker(name, todo), weight) -``` - -* var subStream = tracker.newStream(**name**, **todo**, **weight**) - -The above is exactly equivalent to: - -```javascript - var subStream = tracker.addUnit(new TrackerStream(name, todo), weight) -``` - -* console.log( tracker.debug() ) - -Returns a tree showing the completion of this tracker group and all of its -children, including recursively entering all of the children. - -Tracker -======= - -* var tracker = new Tracker(**name**, **todo**) - - * **name** *(optional)* The name of this counter to report in change - events. Defaults to undefined. - * **todo** *(optional)* The amount of work todo (a number). Defaults to 0. - -Ordinarily these are constructed as a part of a tracker group (via -`newItem`). - -* var completed = tracker.completed() - -Returns the ratio of completed work to work to be done. Range of 0 to 1. If -total work to be done is 0 then it will return 0. - -* tracker.addWork(**todo**) - - * **todo** A number to add to the amount of work to be done. - -Increases the amount of work to be done, thus decreasing the completion -percentage. Triggers a `change` event. - -* tracker.completeWork(**completed**) - - * **completed** A number to add to the work complete - -Increase the amount of work complete, thus increasing the completion percentage. -Will never increase the work completed past the amount of work todo. That is, -percentages > 100% are not allowed. Triggers a `change` event. - -* tracker.finish() - -Marks this tracker as finished, tracker.completed() will now be 1. Triggers -a `change` event. - -TrackerStream -============= - -* var tracker = new TrackerStream(**name**, **size**, **options**) - - * **name** *(optional)* The name of this counter to report in change - events. Defaults to undefined. - * **size** *(optional)* The number of bytes being sent through this stream. - * **options** *(optional)* A hash of stream options - -The tracker stream object is a pass through stream that updates an internal -tracker object each time a block passes through. It's intended to track -downloads, file extraction and other related activities. You use it by piping -your data source into it and then using it as your data source. - -If your data has a length attribute then that's used as the amount of work -completed when the chunk is passed through. If it does not (eg, object -streams) then each chunk counts as completing 1 unit of work, so your size -should be the total number of objects being streamed. - -* tracker.addWork(**todo**) - - * **todo** Increase the expected overall size by **todo** bytes. - -Increases the amount of work to be done, thus decreasing the completion -percentage. Triggers a `change` event. diff --git a/node_modules/are-we-there-yet/index.js b/node_modules/are-we-there-yet/index.js deleted file mode 100644 index 57d8743..0000000 --- a/node_modules/are-we-there-yet/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict' -exports.TrackerGroup = require('./tracker-group.js') -exports.Tracker = require('./tracker.js') -exports.TrackerStream = require('./tracker-stream.js') diff --git a/node_modules/are-we-there-yet/package.json b/node_modules/are-we-there-yet/package.json deleted file mode 100644 index b21713e..0000000 --- a/node_modules/are-we-there-yet/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "_from": "are-we-there-yet@~1.1.2", - "_id": "are-we-there-yet@1.1.5", - "_inBundle": false, - "_integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "_location": "/are-we-there-yet", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "are-we-there-yet@~1.1.2", - "name": "are-we-there-yet", - "escapedName": "are-we-there-yet", - "rawSpec": "~1.1.2", - "saveSpec": null, - "fetchSpec": "~1.1.2" - }, - "_requiredBy": [ - "/npmlog" - ], - "_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "_shasum": "4b35c2944f062a8bfcda66410760350fe9ddfc21", - "_spec": "are-we-there-yet@~1.1.2", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/npmlog", - "author": { - "name": "Rebecca Turner", - "url": "http://re-becca.org" - }, - "bugs": { - "url": "https://github.com/iarna/are-we-there-yet/issues" - }, - "bundleDependencies": false, - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - }, - "deprecated": false, - "description": "Keep track of the overall completion of many disparate processes", - "devDependencies": { - "standard": "^11.0.1", - "tap": "^12.0.1" - }, - "files": [ - "index.js", - "tracker-base.js", - "tracker-group.js", - "tracker-stream.js", - "tracker.js", - "CHANGES.md" - ], - "homepage": "https://github.com/iarna/are-we-there-yet", - "license": "ISC", - "main": "index.js", - "name": "are-we-there-yet", - "repository": { - "type": "git", - "url": "git+https://github.com/iarna/are-we-there-yet.git" - }, - "scripts": { - "test": "standard && tap test/*.js" - }, - "version": "1.1.5" -} diff --git a/node_modules/are-we-there-yet/tracker-base.js b/node_modules/are-we-there-yet/tracker-base.js deleted file mode 100644 index 6f43687..0000000 --- a/node_modules/are-we-there-yet/tracker-base.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict' -var EventEmitter = require('events').EventEmitter -var util = require('util') - -var trackerId = 0 -var TrackerBase = module.exports = function (name) { - EventEmitter.call(this) - this.id = ++trackerId - this.name = name -} -util.inherits(TrackerBase, EventEmitter) diff --git a/node_modules/are-we-there-yet/tracker-group.js b/node_modules/are-we-there-yet/tracker-group.js deleted file mode 100644 index 9759e12..0000000 --- a/node_modules/are-we-there-yet/tracker-group.js +++ /dev/null @@ -1,107 +0,0 @@ -'use strict' -var util = require('util') -var TrackerBase = require('./tracker-base.js') -var Tracker = require('./tracker.js') -var TrackerStream = require('./tracker-stream.js') - -var TrackerGroup = module.exports = function (name) { - TrackerBase.call(this, name) - this.parentGroup = null - this.trackers = [] - this.completion = {} - this.weight = {} - this.totalWeight = 0 - this.finished = false - this.bubbleChange = bubbleChange(this) -} -util.inherits(TrackerGroup, TrackerBase) - -function bubbleChange (trackerGroup) { - return function (name, completed, tracker) { - trackerGroup.completion[tracker.id] = completed - if (trackerGroup.finished) return - trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup) - } -} - -TrackerGroup.prototype.nameInTree = function () { - var names = [] - var from = this - while (from) { - names.unshift(from.name) - from = from.parentGroup - } - return names.join('/') -} - -TrackerGroup.prototype.addUnit = function (unit, weight) { - if (unit.addUnit) { - var toTest = this - while (toTest) { - if (unit === toTest) { - throw new Error( - 'Attempted to add tracker group ' + - unit.name + ' to tree that already includes it ' + - this.nameInTree(this)) - } - toTest = toTest.parentGroup - } - unit.parentGroup = this - } - this.weight[unit.id] = weight || 1 - this.totalWeight += this.weight[unit.id] - this.trackers.push(unit) - this.completion[unit.id] = unit.completed() - unit.on('change', this.bubbleChange) - if (!this.finished) this.emit('change', unit.name, this.completion[unit.id], unit) - return unit -} - -TrackerGroup.prototype.completed = function () { - if (this.trackers.length === 0) return 0 - var valPerWeight = 1 / this.totalWeight - var completed = 0 - for (var ii = 0; ii < this.trackers.length; ii++) { - var trackerId = this.trackers[ii].id - completed += valPerWeight * this.weight[trackerId] * this.completion[trackerId] - } - return completed -} - -TrackerGroup.prototype.newGroup = function (name, weight) { - return this.addUnit(new TrackerGroup(name), weight) -} - -TrackerGroup.prototype.newItem = function (name, todo, weight) { - return this.addUnit(new Tracker(name, todo), weight) -} - -TrackerGroup.prototype.newStream = function (name, todo, weight) { - return this.addUnit(new TrackerStream(name, todo), weight) -} - -TrackerGroup.prototype.finish = function () { - this.finished = true - if (!this.trackers.length) this.addUnit(new Tracker(), 1, true) - for (var ii = 0; ii < this.trackers.length; ii++) { - var tracker = this.trackers[ii] - tracker.finish() - tracker.removeListener('change', this.bubbleChange) - } - this.emit('change', this.name, 1, this) -} - -var buffer = ' ' -TrackerGroup.prototype.debug = function (depth) { - depth = depth || 0 - var indent = depth ? buffer.substr(0, depth) : '' - var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n' - this.trackers.forEach(function (tracker) { - if (tracker instanceof TrackerGroup) { - output += tracker.debug(depth + 1) - } else { - output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n' - } - }) - return output -} diff --git a/node_modules/are-we-there-yet/tracker-stream.js b/node_modules/are-we-there-yet/tracker-stream.js deleted file mode 100644 index e1cf850..0000000 --- a/node_modules/are-we-there-yet/tracker-stream.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict' -var util = require('util') -var stream = require('readable-stream') -var delegate = require('delegates') -var Tracker = require('./tracker.js') - -var TrackerStream = module.exports = function (name, size, options) { - stream.Transform.call(this, options) - this.tracker = new Tracker(name, size) - this.name = name - this.id = this.tracker.id - this.tracker.on('change', delegateChange(this)) -} -util.inherits(TrackerStream, stream.Transform) - -function delegateChange (trackerStream) { - return function (name, completion, tracker) { - trackerStream.emit('change', name, completion, trackerStream) - } -} - -TrackerStream.prototype._transform = function (data, encoding, cb) { - this.tracker.completeWork(data.length ? data.length : 1) - this.push(data) - cb() -} - -TrackerStream.prototype._flush = function (cb) { - this.tracker.finish() - cb() -} - -delegate(TrackerStream.prototype, 'tracker') - .method('completed') - .method('addWork') - .method('finish') diff --git a/node_modules/are-we-there-yet/tracker.js b/node_modules/are-we-there-yet/tracker.js deleted file mode 100644 index 68c2339..0000000 --- a/node_modules/are-we-there-yet/tracker.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict' -var util = require('util') -var TrackerBase = require('./tracker-base.js') - -var Tracker = module.exports = function (name, todo) { - TrackerBase.call(this, name) - this.workDone = 0 - this.workTodo = todo || 0 -} -util.inherits(Tracker, TrackerBase) - -Tracker.prototype.completed = function () { - return this.workTodo === 0 ? 0 : this.workDone / this.workTodo -} - -Tracker.prototype.addWork = function (work) { - this.workTodo += work - this.emit('change', this.name, this.completed(), this) -} - -Tracker.prototype.completeWork = function (work) { - this.workDone += work - if (this.workDone > this.workTodo) this.workDone = this.workTodo - this.emit('change', this.name, this.completed(), this) -} - -Tracker.prototype.finish = function () { - this.workTodo = this.workDone = 1 - this.emit('change', this.name, 1, this) -} diff --git a/node_modules/array-flat-polyfill/CHANGELOG.md b/node_modules/array-flat-polyfill/CHANGELOG.md deleted file mode 100644 index 5b5755e..0000000 --- a/node_modules/array-flat-polyfill/CHANGELOG.md +++ /dev/null @@ -1,10 +0,0 @@ -# Changes to Array Flat Polyfill - -### 1.0.1 (April 12, 2019) - -- Fixed an issue with the depth parameter -- Performance is improved by ~200% - -### 1.0.0 (November 28, 2018) - -- Initial version diff --git a/node_modules/array-flat-polyfill/LICENSE.md b/node_modules/array-flat-polyfill/LICENSE.md deleted file mode 100644 index 0bc1fa7..0000000 --- a/node_modules/array-flat-polyfill/LICENSE.md +++ /dev/null @@ -1,108 +0,0 @@ -# CC0 1.0 Universal - -## Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator and -subsequent owner(s) (each and all, an “owner”) of an original work of -authorship and/or a database (each, a “Work”). - -Certain owners wish to permanently relinquish those rights to a Work for the -purpose of contributing to a commons of creative, cultural and scientific works -(“Commons”) that the public can reliably and without fear of later claims of -infringement build upon, modify, incorporate in other works, reuse and -redistribute as freely as possible in any form whatsoever and for any purposes, -including without limitation commercial purposes. These owners may contribute -to the Commons to promote the ideal of a free culture and the further -production of creative, cultural and scientific works, or to gain reputation or -greater distribution for their Work in part through the use and efforts of -others. - -For these and/or other purposes and motivations, and without any expectation of -additional consideration or compensation, the person associating CC0 with a -Work (the “Affirmer”), to the extent that he or she is an owner of Copyright -and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and -publicly distribute the Work under its terms, with knowledge of his or her -Copyright and Related Rights in the Work and the meaning and intended legal -effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be - protected by copyright and related or neighboring rights (“Copyright and - Related Rights”). Copyright and Related Rights include, but are not limited - to, the following: - 1. the right to reproduce, adapt, distribute, perform, display, communicate, - and translate a Work; - 2. moral rights retained by the original author(s) and/or performer(s); - 3. publicity and privacy rights pertaining to a person’s image or likeness - depicted in a Work; - 4. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(i), below; - 5. rights protecting the extraction, dissemination, use and reuse of data in - a Work; - 6. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation thereof, - including any amended or successor version of such directive); and - 7. other similar, equivalent or corresponding rights throughout the world - based on applicable law or treaty, and any national implementations - thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention of, - applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and - unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright - and Related Rights and associated claims and causes of action, whether now - known or unknown (including existing as well as future claims and causes of - action), in the Work (i) in all territories worldwide, (ii) for the maximum - duration provided by applicable law or treaty (including future time - extensions), (iii) in any current or future medium and for any number of - copies, and (iv) for any purpose whatsoever, including without limitation - commercial, advertising or promotional purposes (the “Waiver”). Affirmer - makes the Waiver for the benefit of each member of the public at large and - to the detriment of Affirmer’s heirs and successors, fully intending that - such Waiver shall not be subject to revocation, rescission, cancellation, - termination, or any other legal or equitable action to disrupt the quiet - enjoyment of the Work by the public as contemplated by Affirmer’s express - Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason be - judged legally invalid or ineffective under applicable law, then the Waiver - shall be preserved to the maximum extent permitted taking into account - Affirmer’s express Statement of Purpose. In addition, to the extent the - Waiver is so judged Affirmer hereby grants to each affected person a - royalty-free, non transferable, non sublicensable, non exclusive, - irrevocable and unconditional license to exercise Affirmer’s Copyright and - Related Rights in the Work (i) in all territories worldwide, (ii) for the - maximum duration provided by applicable law or treaty (including future time - extensions), (iii) in any current or future medium and for any number of - copies, and (iv) for any purpose whatsoever, including without limitation - commercial, advertising or promotional purposes (the “License”). The License - shall be deemed effective as of the date CC0 was applied by Affirmer to the - Work. Should any part of the License for any reason be judged legally - invalid or ineffective under applicable law, such partial invalidity or - ineffectiveness shall not invalidate the remainder of the License, and in - such case Affirmer hereby affirms that he or she will not (i) exercise any - of his or her remaining Copyright and Related Rights in the Work or (ii) - assert any associated claims and causes of action with respect to the Work, - in either case contrary to Affirmer’s express Statement of Purpose. - -4. Limitations and Disclaimers. - 1. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - 2. Affirmer offers the Work as-is and makes no representations or warranties - of any kind concerning the Work, express, implied, statutory or - otherwise, including without limitation warranties of title, - merchantability, fitness for a particular purpose, non infringement, or - the absence of latent or other defects, accuracy, or the present or - absence of errors, whether or not discoverable, all to the greatest - extent permissible under applicable law. - 3. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person’s Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the Work. - 4. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to this - CC0 or use of the Work. - -For more information, please see -http://creativecommons.org/publicdomain/zero/1.0/. diff --git a/node_modules/array-flat-polyfill/README.md b/node_modules/array-flat-polyfill/README.md deleted file mode 100644 index 9ec7dad..0000000 --- a/node_modules/array-flat-polyfill/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# Array Flat Polyfill [][Array Flat Polyfill] - -[![NPM Version][npm-img]][npm-url] -[![Build Status][cli-img]][cli-url] -[![Support Chat][git-img]][git-url] - -[Array Flat Polyfill] is a polyfill for `Array.prototype.flat` and -`Array.prototype.flatMap`, following the [TC39 Proposal]. - -```sh -npm install array-flat-polyfill --save -``` - -The `flat()` method creates a new array with all sub-array elements -concatenated into it recursively up to the specified depth. - -```js -[1, 2, [3, 4, [5, 6]]].flat(2) // [1, 2, 3, 4, 5, 6] -``` - -The `flatMap()` method maps each element using a mapping function, then -flattens the result into a new array. - -```js -[1, 2, 3, 4].flatMap(x => [x * 2]); // [2, 4, 6, 8] -``` - -The script is 261 bytes when minified and gzipped. It works in all browsers, -going as far back as Internet Explorer 9. - -## Usage - -For immediate usage, add this script to your document: - -```html - -``` - -For Node usage, add [Array Flat Polyfill] to your project: - -```sh -npm install array-flat-polyfill -``` - -Include [Array Flat Polyfill] in your JS: - -```js -import 'array-flat-polyfill'; -``` - -[cli-img]: https://img.shields.io/travis/jonathantneal/array-flat-polyfill/master.svg -[cli-url]: https://travis-ci.org/jonathantneal/array-flat-polyfill -[git-img]: https://img.shields.io/badge/support-chat-blue.svg -[git-url]: https://gitter.im/postcss/postcss -[npm-img]: https://img.shields.io/npm/v/array-flat-polyfill.svg -[npm-url]: https://www.npmjs.com/package/array-flat-polyfill - -[Array Flat Polyfill]: https://github.com/jonathantneal/array-flat-polyfill -[TC39 Proposal]: https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flat diff --git a/node_modules/array-flat-polyfill/index.js b/node_modules/array-flat-polyfill/index.js deleted file mode 100644 index 0fba364..0000000 --- a/node_modules/array-flat-polyfill/index.js +++ /dev/null @@ -1 +0,0 @@ -Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function r(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,function(a,e){return Array.isArray(e)?a.push.apply(a,r.call(e,t-1)):a.push(e),a},[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{configurable:!0,value:function(r){return Array.prototype.map.apply(this,arguments).flat()},writable:!0}) diff --git a/node_modules/array-flat-polyfill/index.mjs b/node_modules/array-flat-polyfill/index.mjs deleted file mode 100644 index 0fba364..0000000 --- a/node_modules/array-flat-polyfill/index.mjs +++ /dev/null @@ -1 +0,0 @@ -Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function r(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,function(a,e){return Array.isArray(e)?a.push.apply(a,r.call(e,t-1)):a.push(e),a},[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{configurable:!0,value:function(r){return Array.prototype.map.apply(this,arguments).flat()},writable:!0}) diff --git a/node_modules/array-flat-polyfill/package.json b/node_modules/array-flat-polyfill/package.json deleted file mode 100644 index 11a0512..0000000 --- a/node_modules/array-flat-polyfill/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "_from": "array-flat-polyfill@^1.0.1", - "_id": "array-flat-polyfill@1.0.1", - "_inBundle": false, - "_integrity": "sha512-hfJmKupmQN0lwi0xG6FQ5U8Rd97RnIERplymOv/qpq8AoNKPPAnxJadjFA23FNWm88wykh9HmpLJUUwUtNU/iw==", - "_location": "/array-flat-polyfill", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "array-flat-polyfill@^1.0.1", - "name": "array-flat-polyfill", - "escapedName": "array-flat-polyfill", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "/vega-lite" - ], - "_resolved": "https://registry.npmjs.org/array-flat-polyfill/-/array-flat-polyfill-1.0.1.tgz", - "_shasum": "1e3a4255be619dfbffbfd1d635c1cf357cd034e7", - "_spec": "array-flat-polyfill@^1.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-lite", - "author": { - "name": "Jonathan Neal", - "email": "jonathantneal@hotmail.com" - }, - "bugs": { - "url": "https://github.com/jonathantneal/array-flat-polyfill/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "A polyfill for Array.prototype.flat and Array.prototype.flatMap", - "devDependencies": { - "@babel/core": "^7.4.3", - "@babel/preset-env": "^7.4.3", - "babel-eslint": "^10.0.1", - "babel-jest": "^24.7.1", - "eslint": "^5.16.0", - "eslint-config-dev": "^2.0.0", - "gzip-size-cli": "^3.0.0", - "jest": "^24.7.1", - "rollup": "^1.10.0", - "rollup-plugin-babel": "^4.3.2", - "rollup-plugin-terser": "^4.0.4" - }, - "engines": { - "node": ">=6.0.0" - }, - "eslintConfig": { - "extends": "dev", - "parser": "babel-eslint", - "rules": { - "no-unused-vars": [ - 0 - ] - } - }, - "files": [ - "index.js", - "index.mjs" - ], - "homepage": "https://github.com/jonathantneal/array-flat-polyfill#readme", - "keywords": [ - "javascript", - "js", - "flat", - "flatMap", - "concat", - "flatten" - ], - "license": "CC0-1.0", - "main": "index.js", - "module": "index.mjs", - "name": "array-flat-polyfill", - "repository": { - "type": "git", - "url": "git+https://github.com/jonathantneal/array-flat-polyfill.git" - }, - "scripts": { - "build": "rollup --config --silent", - "postbuild": "gzip-size index.js", - "prepublishOnly": "npm run test && npm run build", - "test": "npm run test:lint && npm run test:tape", - "test:lint": "eslint src/*.js --cache --ignore-path .gitignore --quiet", - "test:tape": "jest" - }, - "version": "1.0.1" -} diff --git a/node_modules/balanced-match/.npmignore b/node_modules/balanced-match/.npmignore deleted file mode 100644 index ae5d8c3..0000000 --- a/node_modules/balanced-match/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -test -.gitignore -.travis.yml -Makefile -example.js diff --git a/node_modules/balanced-match/LICENSE.md b/node_modules/balanced-match/LICENSE.md deleted file mode 100644 index 2cdc8e4..0000000 --- a/node_modules/balanced-match/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/balanced-match/README.md b/node_modules/balanced-match/README.md deleted file mode 100644 index 08e918c..0000000 --- a/node_modules/balanced-match/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# balanced-match - -Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! - -[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) -[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) - -[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) - -## Example - -Get the first matching pair of braces: - -```js -var balanced = require('balanced-match'); - -console.log(balanced('{', '}', 'pre{in{nested}}post')); -console.log(balanced('{', '}', 'pre{first}between{second}post')); -console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); -``` - -The matches are: - -```bash -$ node example.js -{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } -{ start: 3, - end: 9, - pre: 'pre', - body: 'first', - post: 'between{second}post' } -{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } -``` - -## API - -### var m = balanced(a, b, str) - -For the first non-nested matching pair of `a` and `b` in `str`, return an -object with those keys: - -* **start** the index of the first match of `a` -* **end** the index of the matching `b` -* **pre** the preamble, `a` and `b` not included -* **body** the match, `a` and `b` not included -* **post** the postscript, `a` and `b` not included - -If there's no match, `undefined` will be returned. - -If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. - -### var r = balanced.range(a, b, str) - -For the first non-nested matching pair of `a` and `b` in `str`, return an -array with indexes: `[ , ]`. - -If there's no match, `undefined` will be returned. - -If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. - -## Installation - -With [npm](https://npmjs.org) do: - -```bash -npm install balanced-match -``` - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/balanced-match/index.js b/node_modules/balanced-match/index.js deleted file mode 100644 index 1685a76..0000000 --- a/node_modules/balanced-match/index.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; -module.exports = balanced; -function balanced(a, b, str) { - if (a instanceof RegExp) a = maybeMatch(a, str); - if (b instanceof RegExp) b = maybeMatch(b, str); - - var r = range(a, b, str); - - return r && { - start: r[0], - end: r[1], - pre: str.slice(0, r[0]), - body: str.slice(r[0] + a.length, r[1]), - post: str.slice(r[1] + b.length) - }; -} - -function maybeMatch(reg, str) { - var m = str.match(reg); - return m ? m[0] : null; -} - -balanced.range = range; -function range(a, b, str) { - var begs, beg, left, right, result; - var ai = str.indexOf(a); - var bi = str.indexOf(b, ai + 1); - var i = ai; - - if (ai >= 0 && bi > 0) { - begs = []; - left = str.length; - - while (i >= 0 && !result) { - if (i == ai) { - begs.push(i); - ai = str.indexOf(a, i + 1); - } else if (begs.length == 1) { - result = [ begs.pop(), bi ]; - } else { - beg = begs.pop(); - if (beg < left) { - left = beg; - right = bi; - } - - bi = str.indexOf(b, i + 1); - } - - i = ai < bi && ai >= 0 ? ai : bi; - } - - if (begs.length) { - result = [ left, right ]; - } - } - - return result; -} diff --git a/node_modules/balanced-match/package.json b/node_modules/balanced-match/package.json deleted file mode 100644 index 0ccc32c..0000000 --- a/node_modules/balanced-match/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "_from": "balanced-match@^1.0.0", - "_id": "balanced-match@1.0.0", - "_inBundle": false, - "_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "_location": "/balanced-match", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "balanced-match@^1.0.0", - "name": "balanced-match", - "escapedName": "balanced-match", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/brace-expansion" - ], - "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767", - "_spec": "balanced-match@^1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/brace-expansion", - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "bugs": { - "url": "https://github.com/juliangruber/balanced-match/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Match balanced character pairs, like \"{\" and \"}\"", - "devDependencies": { - "matcha": "^0.7.0", - "tape": "^4.6.0" - }, - "homepage": "https://github.com/juliangruber/balanced-match", - "keywords": [ - "match", - "regexp", - "test", - "balanced", - "parse" - ], - "license": "MIT", - "main": "index.js", - "name": "balanced-match", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/balanced-match.git" - }, - "scripts": { - "bench": "make bench", - "test": "make test" - }, - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/8..latest", - "firefox/20..latest", - "firefox/nightly", - "chrome/25..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "1.0.0" -} diff --git a/node_modules/brace-expansion/LICENSE b/node_modules/brace-expansion/LICENSE deleted file mode 100644 index de32266..0000000 --- a/node_modules/brace-expansion/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2013 Julian Gruber - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/brace-expansion/README.md b/node_modules/brace-expansion/README.md deleted file mode 100644 index 6b4e0e1..0000000 --- a/node_modules/brace-expansion/README.md +++ /dev/null @@ -1,129 +0,0 @@ -# brace-expansion - -[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), -as known from sh/bash, in JavaScript. - -[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) -[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) -[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) - -[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) - -## Example - -```js -var expand = require('brace-expansion'); - -expand('file-{a,b,c}.jpg') -// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] - -expand('-v{,,}') -// => ['-v', '-v', '-v'] - -expand('file{0..2}.jpg') -// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] - -expand('file-{a..c}.jpg') -// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] - -expand('file{2..0}.jpg') -// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] - -expand('file{0..4..2}.jpg') -// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] - -expand('file-{a..e..2}.jpg') -// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] - -expand('file{00..10..5}.jpg') -// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] - -expand('{{A..C},{a..c}}') -// => ['A', 'B', 'C', 'a', 'b', 'c'] - -expand('ppp{,config,oe{,conf}}') -// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] -``` - -## API - -```js -var expand = require('brace-expansion'); -``` - -### var expanded = expand(str) - -Return an array of all possible and valid expansions of `str`. If none are -found, `[str]` is returned. - -Valid expansions are: - -```js -/^(.*,)+(.+)?$/ -// {a,b,...} -``` - -A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. - -```js -/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ -// {x..y[..incr]} -``` - -A numeric sequence from `x` to `y` inclusive, with optional increment. -If `x` or `y` start with a leading `0`, all the numbers will be padded -to have equal length. Negative numbers and backwards iteration work too. - -```js -/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ -// {x..y[..incr]} -``` - -An alphabetic sequence from `x` to `y` inclusive, with optional increment. -`x` and `y` must be exactly one character, and if given, `incr` must be a -number. - -For compatibility reasons, the string `${` is not eligible for brace expansion. - -## Installation - -With [npm](https://npmjs.org) do: - -```bash -npm install brace-expansion -``` - -## Contributors - -- [Julian Gruber](https://github.com/juliangruber) -- [Isaac Z. Schlueter](https://github.com/isaacs) - -## Sponsors - -This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! - -Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/brace-expansion/index.js b/node_modules/brace-expansion/index.js deleted file mode 100644 index 0478be8..0000000 --- a/node_modules/brace-expansion/index.js +++ /dev/null @@ -1,201 +0,0 @@ -var concatMap = require('concat-map'); -var balanced = require('balanced-match'); - -module.exports = expandTop; - -var escSlash = '\0SLASH'+Math.random()+'\0'; -var escOpen = '\0OPEN'+Math.random()+'\0'; -var escClose = '\0CLOSE'+Math.random()+'\0'; -var escComma = '\0COMMA'+Math.random()+'\0'; -var escPeriod = '\0PERIOD'+Math.random()+'\0'; - -function numeric(str) { - return parseInt(str, 10) == str - ? parseInt(str, 10) - : str.charCodeAt(0); -} - -function escapeBraces(str) { - return str.split('\\\\').join(escSlash) - .split('\\{').join(escOpen) - .split('\\}').join(escClose) - .split('\\,').join(escComma) - .split('\\.').join(escPeriod); -} - -function unescapeBraces(str) { - return str.split(escSlash).join('\\') - .split(escOpen).join('{') - .split(escClose).join('}') - .split(escComma).join(',') - .split(escPeriod).join('.'); -} - - -// Basically just str.split(","), but handling cases -// where we have nested braced sections, which should be -// treated as individual members, like {a,{b,c},d} -function parseCommaParts(str) { - if (!str) - return ['']; - - var parts = []; - var m = balanced('{', '}', str); - - if (!m) - return str.split(','); - - var pre = m.pre; - var body = m.body; - var post = m.post; - var p = pre.split(','); - - p[p.length-1] += '{' + body + '}'; - var postParts = parseCommaParts(post); - if (post.length) { - p[p.length-1] += postParts.shift(); - p.push.apply(p, postParts); - } - - parts.push.apply(parts, p); - - return parts; -} - -function expandTop(str) { - if (!str) - return []; - - // I don't know why Bash 4.3 does this, but it does. - // Anything starting with {} will have the first two bytes preserved - // but *only* at the top level, so {},a}b will not expand to anything, - // but a{},b}c will be expanded to [a}c,abc]. - // One could argue that this is a bug in Bash, but since the goal of - // this module is to match Bash's rules, we escape a leading {} - if (str.substr(0, 2) === '{}') { - str = '\\{\\}' + str.substr(2); - } - - return expand(escapeBraces(str), true).map(unescapeBraces); -} - -function identity(e) { - return e; -} - -function embrace(str) { - return '{' + str + '}'; -} -function isPadded(el) { - return /^-?0\d/.test(el); -} - -function lte(i, y) { - return i <= y; -} -function gte(i, y) { - return i >= y; -} - -function expand(str, isTop) { - var expansions = []; - - var m = balanced('{', '}', str); - if (!m || /\$$/.test(m.pre)) return [str]; - - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(',') >= 0; - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*\}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } - - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length - ? expand(m.post, false) - : ['']; - return post.map(function(p) { - return m.pre + n[0] + p; - }); - } - } - } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. - - // no need to expand pre, since it is guaranteed to be free of brace-sets - var pre = m.pre; - var post = m.post.length - ? expand(m.post, false) - : ['']; - - var N; - - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; - } - var pad = n.some(isPadded); - - N = []; - - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; - } - } - } - N.push(c); - } - } else { - N = concatMap(n, function(el) { return expand(el, false) }); - } - - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); - } - } - - return expansions; -} - diff --git a/node_modules/brace-expansion/package.json b/node_modules/brace-expansion/package.json deleted file mode 100644 index f25504d..0000000 --- a/node_modules/brace-expansion/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "brace-expansion@^1.1.7", - "_id": "brace-expansion@1.1.11", - "_inBundle": false, - "_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "_location": "/brace-expansion", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "brace-expansion@^1.1.7", - "name": "brace-expansion", - "escapedName": "brace-expansion", - "rawSpec": "^1.1.7", - "saveSpec": null, - "fetchSpec": "^1.1.7" - }, - "_requiredBy": [ - "/minimatch" - ], - "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "_shasum": "3c7fcbf529d87226f3d2f52b966ff5271eb441dd", - "_spec": "brace-expansion@^1.1.7", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/minimatch", - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "bugs": { - "url": "https://github.com/juliangruber/brace-expansion/issues" - }, - "bundleDependencies": false, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - }, - "deprecated": false, - "description": "Brace expansion as known from sh/bash", - "devDependencies": { - "matcha": "^0.7.0", - "tape": "^4.6.0" - }, - "homepage": "https://github.com/juliangruber/brace-expansion", - "keywords": [], - "license": "MIT", - "main": "index.js", - "name": "brace-expansion", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/brace-expansion.git" - }, - "scripts": { - "bench": "matcha test/perf/bench.js", - "gentest": "bash test/generate.sh", - "test": "tape test/*.js" - }, - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/8..latest", - "firefox/20..latest", - "firefox/nightly", - "chrome/25..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "1.1.11" -} diff --git a/node_modules/camelcase/index.d.ts b/node_modules/camelcase/index.d.ts deleted file mode 100644 index 58f2069..0000000 --- a/node_modules/camelcase/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -declare namespace camelcase { - interface Options { - /** - Uppercase the first character: `foo-bar` → `FooBar`. - - @default false - */ - readonly pascalCase?: boolean; - } -} - -declare const camelcase: { - /** - Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. - - @param input - String to convert to camel case. - - @example - ``` - import camelCase = require('camelcase'); - - camelCase('foo-bar'); - //=> 'fooBar' - - camelCase('foo_bar'); - //=> 'fooBar' - - camelCase('Foo-Bar'); - //=> 'fooBar' - - camelCase('Foo-Bar', {pascalCase: true}); - //=> 'FooBar' - - camelCase('--foo.bar', {pascalCase: false}); - //=> 'fooBar' - - camelCase('foo bar'); - //=> 'fooBar' - - console.log(process.argv[3]); - //=> '--foo-bar' - camelCase(process.argv[3]); - //=> 'fooBar' - - camelCase(['foo', 'bar']); - //=> 'fooBar' - - camelCase(['__foo__', '--bar'], {pascalCase: true}); - //=> 'FooBar' - ``` - */ - (input: string | ReadonlyArray, options?: camelcase.Options): string; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function camelcase( - // input: string | ReadonlyArray, - // options?: camelcase.Options - // ): string; - // export = camelcase; - default: typeof camelcase; -}; - -export = camelcase; diff --git a/node_modules/camelcase/index.js b/node_modules/camelcase/index.js deleted file mode 100644 index 579f99b..0000000 --- a/node_modules/camelcase/index.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -const preserveCamelCase = string => { - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - - for (let i = 0; i < string.length; i++) { - const character = string[i]; - - if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) { - string = string.slice(0, i) + '-' + string.slice(i); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) { - string = string.slice(0, i - 1) + '-' + string.slice(i - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character; - } - } - - return string; -}; - -const camelCase = (input, options) => { - if (!(typeof input === 'string' || Array.isArray(input))) { - throw new TypeError('Expected the input to be `string | string[]`'); - } - - options = Object.assign({ - pascalCase: false - }, options); - - const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; - - if (Array.isArray(input)) { - input = input.map(x => x.trim()) - .filter(x => x.length) - .join('-'); - } else { - input = input.trim(); - } - - if (input.length === 0) { - return ''; - } - - if (input.length === 1) { - return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); - } - - const hasUpperCase = input !== input.toLowerCase(); - - if (hasUpperCase) { - input = preserveCamelCase(input); - } - - input = input - .replace(/^[_.\- ]+/, '') - .toLowerCase() - .replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase()) - .replace(/\d+(\w|$)/g, m => m.toUpperCase()); - - return postProcess(input); -}; - -module.exports = camelCase; -// TODO: Remove this for the next major release -module.exports.default = camelCase; diff --git a/node_modules/camelcase/license b/node_modules/camelcase/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/camelcase/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/camelcase/package.json b/node_modules/camelcase/package.json deleted file mode 100644 index 80d2c07..0000000 --- a/node_modules/camelcase/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "camelcase@^5.0.0", - "_id": "camelcase@5.3.1", - "_inBundle": false, - "_integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "_location": "/camelcase", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "camelcase@^5.0.0", - "name": "camelcase", - "escapedName": "camelcase", - "rawSpec": "^5.0.0", - "saveSpec": null, - "fetchSpec": "^5.0.0" - }, - "_requiredBy": [ - "/yargs-parser" - ], - "_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "_shasum": "e3c9b31569e106811df242f715725a1f4c494320", - "_spec": "camelcase@^5.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs-parser", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/camelcase/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/camelcase#readme", - "keywords": [ - "camelcase", - "camel-case", - "camel", - "case", - "dash", - "hyphen", - "dot", - "underscore", - "separator", - "string", - "text", - "convert", - "pascalcase", - "pascal-case" - ], - "license": "MIT", - "name": "camelcase", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/camelcase.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "5.3.1" -} diff --git a/node_modules/camelcase/readme.md b/node_modules/camelcase/readme.md deleted file mode 100644 index fde2726..0000000 --- a/node_modules/camelcase/readme.md +++ /dev/null @@ -1,99 +0,0 @@ -# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase) - -> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` - ---- - - - ---- - -## Install - -``` -$ npm install camelcase -``` - - -## Usage - -```js -const camelCase = require('camelcase'); - -camelCase('foo-bar'); -//=> 'fooBar' - -camelCase('foo_bar'); -//=> 'fooBar' - -camelCase('Foo-Bar'); -//=> 'fooBar' - -camelCase('Foo-Bar', {pascalCase: true}); -//=> 'FooBar' - -camelCase('--foo.bar', {pascalCase: false}); -//=> 'fooBar' - -camelCase('foo bar'); -//=> 'fooBar' - -console.log(process.argv[3]); -//=> '--foo-bar' -camelCase(process.argv[3]); -//=> 'fooBar' - -camelCase(['foo', 'bar']); -//=> 'fooBar' - -camelCase(['__foo__', '--bar'], {pascalCase: true}); -//=> 'FooBar' -``` - - -## API - -### camelCase(input, [options]) - -#### input - -Type: `string` `string[]` - -String to convert to camel case. - -#### options - -Type: `Object` - -##### pascalCase - -Type: `boolean`
-Default: `false` - -Uppercase the first character: `foo-bar` → `FooBar` - - -## Security - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. - - -## Related - -- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module -- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase -- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string -- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/canvas/CHANGELOG.md b/node_modules/canvas/CHANGELOG.md deleted file mode 100644 index 36eabbf..0000000 --- a/node_modules/canvas/CHANGELOG.md +++ /dev/null @@ -1,924 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/) and this -project adheres to [Semantic Versioning](http://semver.org/). - -(Unreleased) -================== -### Changed -### Added -### Fixed - -2.6.1 -================== -### Fixed -* Ignore `maxWidth` in `fillText` and `strokeText` if it is undefined -* Fix crash (assertion failure) in Node.js 12.x when patterns or gradients are used -* Fix crash (check failure) in Node.js 12.x when using RGB16_565 format. (The - underlying arraybuffer was incorrectly sized.) - -2.6.0 -================== -### Changed -* Allow larger buffers to be returned from `toBuffer('raw')`. -### Added -* Support for various BMP headers and color depths (#1435) -### Fixed -* Fix crash when changing canvas width/height while `fillStyle` or `strokeStyle` - was set to a `CanvasPattern` or `CanvasGradient` (#1357). -* Fix crash when changing width/height of SVG canvases (#1380). -* Fix crash when using `toBuffer('raw')` with large canvases (#1158). -* Clarified meaning of byte ordering for `toBuffer('raw')` in readme. (#1416) -* Fix package.json Typings field to point to Declaration file (#1432) -* Properly check return value from `Set` and `Call`. (#1415) -* Use `Get` version from `Nan` instead of `v8`. (#1415) - -2.5.0 -================== -### Added -* Support redirects when fetching images (using [simple-get](https://github.com/feross/simple-get)) (#1398) -* Support Node.js v12 -### Fixed -* Fix object literal & arrow function syntax usage for IE. - -2.4.1 -================== -### Fixed -* Guard JPEG width/height against maximum supported (#1385) -* Fix electron 5 and node 12 compatibility -* Fix encoding options (quality) parameter in `canvas.toDataURL()` - -2.4.0 -================== -### Added -* (Actually) added `resolution` option for `canvas.toBuffer("image/png")` and - `canvas.createPNGStream()`. This was documented since 2.0.0 but not working. -* Add typescript definitions. -### Fixed -* PDF metadata (added in 2.3.0) wasn't being set with `canvas.createPDFStream()` -* Fix custom "inspect" function deprecation warnings (#1326) - -2.3.1 -================== -### Fixed -* Fix `canvas.toBuffer()` for JPEGs (#1350) - -2.3.0 -================== -### Added -* Add support for multiple PDF page sizes -* Add support for embedding document metadata in PDFs - -### Fixed -* Don't crash when font string is invalid (bug since 2.2.0) (#1328) -* Fix memory leak in `canvas.toBuffer()` (#1202, #1296) -* Fix memory leak in `ctx.font=` (#1202) - -2.2.0 -================== -### Added -* BMP support - -### Fixed -* Reset context on resurface (#1292) -* Support Jest test framework (#1311) - -2.1.0 -================== -### Added -* Warn when building with old, unsupported versions of cairo or libjpeg. - -2.0.0 -================== - -**Upgrading from 1.x** -```js -// (1) The Canvas constructor is no longer the default export from the module. -/* old: */ -const Canvas = require('canvas') -const mycanvas = new Canvas(width, height) -/* new: */ -const { createCanvas, Canvas } = require('canvas') -const mycanvas = createCanvas(width, height) -mycanvas instanceof Canvas // true - -/* old: */ -const Canvas = require('canvas') -const myimg = new Canvas.Image() -/* new: */ -const { Image } = require('canvas') -const myimg = new Image() - -// (2) The quality argument for canvas.createJPEGStream/canvas.jpegStream now -// goes from 0 to 1 instead of from 0 to 100: -canvas.createJPEGStream({ quality: 50 }) // old -canvas.createJPEGStream({ quality: 0.5 }) // new - -// (3) The ZLIB compression level and PNG filter options for canvas.toBuffer are -// now named instead of positional arguments: -canvas.toBuffer(undefined, 3, canvas.PNG_FILTER_NONE) // old -canvas.toBuffer(undefined, { compressionLevel: 3, filters: canvas.PNG_FILTER_NONE }) // new -// or specify the mime type explicitly: -canvas.toBuffer('image/png', { compressionLevel: 3, filters: canvas.PNG_FILTER_NONE }) // new - -// (4) #2 also applies for canvas.pngStream, although these arguments were not -// documented: -canvas.pngStream(3, canvas.PNG_FILTER_NONE) // old -canvas.pngStream({ compressionLevel: 3, filters: canvas.PNG_FILTER_NONE }) // new - -// (5) canvas.syncPNGStream() and canvas.syncJPEGStream() have been removed: -canvas.syncPNGStream() // old -canvas.createSyncPNGStream() // old -canvas.createPNGStream() // new - -canvas.syncJPEGStream() // old -canvas.createSyncJPEGStream() // old -canvas.createJPEGStream() // new - -// (6) Context2d.filter has been renamed to context2d.quality to avoid a -// conflict with the new standard 'filter' property. -context.filter = 'best' // old -context.quality = 'best' // new -``` - -### Breaking - * Drop support for Node.js <6.x - * Remove sync stream functions (bc53059). Note that most streams are still - synchronous (run in the main thread); this change just removed `syncPNGStream` - and `syncJPEGStream`. - * Pango is now *required* on all platforms (7716ae4). - * Make the `quality` argument for JPEG output go from 0 to 1 to match HTML spec. - * Make the `compressionLevel` and `filters` arguments for `canvas.toBuffer()` - named instead of positional. Same for `canvas.pngStream()`, although these - arguments were not documented. - * See also: *Correct some of the `globalCompositeOperator` types* under - **Fixed**. These changes were bug-fixes, but will break existing code relying - on the incorrect types. - * Rename `context2d.filter` to `context2d.quality` to avoid a conflict with the - new standard 'filter' property. Note that the standard 'filter' property is - not yet implemented. - -### Fixed - * Fix build with SVG support enabled (#1123) - * Prevent segfaults caused by loading invalid fonts (#1105) - * Fix memory leak in font loading - * Port has_lib.sh to javascript (#872) - * Correctly sample the edge of images when scaling (#1084) - * Detect CentOS libjpeg path (b180ea5) - * Improve measureText accuracy (2bbfec5) - * Fix memory leak when image callbacks reference the image (1f4b646) - * Fix putImageData(data, negative, negative) (2102e25) - * Fix SVG recognition when loading from buffer (77749e6) - * Re-rasterize SVG when drawing to a context and dimensions changed (79bf232) - * Prevent JPEG errors from crashing process (#1124) - * Improve handling of invalid arguments (#1129) - * Fix repeating patterns when drawing a canvas to itself (#1136) - * Prevent segfaults caused by creating a too large canvas - * Fix parse-font regex to allow for whitespaces. - * Allow assigning non-string values to fillStyle and strokeStyle - * Fix drawing zero-width and zero-height images. - * Fix DEP0005 deprecation warning - * Don't assume `data:` URIs assigned to `img.src` are always base64-encoded - * Fix formatting of color strings (e.g. `ctx.fillStyle`) on 32-bit platforms - * Explicitly export symbols for the C++ API - * Named CSS colors should match case-insensitive - * Correct some of the `globalCompositeOperator` types to match the spec: - * "hsl-hue" is now "hue" - * "hsl-saturation" is now "saturation" - * "hsl-color" is now "color" - * "hsl-luminosity" is now "luminosity" - * "darker" is now "darken" - * "dest" is now "destination" - * "add" is removed (but is the same as "lighter") - * "source" is now "copy" - * Provide better, Node.js core-style coded errors for failed sys calls. (For - example, provide an error with code 'ENOENT' if setting `img.src` to a path - that does not exist.) - * Support reading CMYK, YCCK JPEGs. - * Hide `Image.prototype.source` - * Fix behavior of maxWidth (#1088) - * Fix behavior of textAlignment with maxWidth (#1253) - -### Added - * Prebuilds (#992) with different libc versions to the prebuilt binary (#1140) - * Support `canvas.getContext("2d", {alpha: boolean})` and - `canvas.getContext("2d", {pixelFormat: "..."})` - * Support indexed PNG encoding. - * Support `currentTransform` (d6714ee) - * Export `CanvasGradient` (6a4c0ab) - * Support #RGBA , #RRGGBBAA hex colors (10a82ec) - * Support maxWidth arg for fill/strokeText (175b40d) - * Support image.naturalWidth/Height (a5915f8) - * Render SVG img elements when librsvg is available (1baf00e) - * Support ellipse method (4d4a726) - * Browser-compatible API (6a29a23) - * Support for jpeg on Windows (42e9a74) - * Support for backends (1a6dffe) - * Support for `canvas.toBuffer("image/jpeg")` - * Unified configuration options for `canvas.toBuffer()`, `canvas.pngStream()` - and `canvas.jpegStream()` - * ~~Added `resolution` option for `canvas.toBuffer("image/png")` and - `canvas.createPNGStream()`~~ this was not working - * Support for `canvas.toDataURI("image/jpeg")` (sync) - * Support for `img.src = ` to match browsers - * Support reading data URL on `img.src` - * Readme: add dependencies command for OpenBSD - * Throw error if calling jpegStream when canvas was not built with JPEG support - * Emit error if trying to load GIF, SVG or JPEG image when canvas was not built - with support for that format - -1.6.x (unreleased) -================== -### Fixed - * Make setLineDash able to handle full zeroed dashes (b8cf1d7) - * Fix reading fillStyle after setting it from gradient to color (a84b2bc) - -### Added - * Support for pattern repeat and no-repeat (#1066) - * Support for context globalAlpha for gradients and patterns (#1064) - -1.6.9 / 2017-12-20 -================== -### Fixed - * Fix some instances of crashes (7c9ec58, 8b792c3) - * Fix node 0.x compatibility (dca33f7) - -1.6.8 / 2017-12-12 -================== -### Fixed - * Faster, more compliant parseFont (4625efa, 37cd969) - -1.6.7 / 2017-09-08 -================== -### Fixed - * Minimal backport of #985 (rotated text baselines) (c19edb8) - -1.6.6 / 2017-05-03 -================== -### Fixed - * Use .node extension for requiring native module so webpack works (1b05599) - * Correct text baseline calculation (#1037) - -1.6.5 / 2017-03-18 -================== -### Changed - * Parse font using parse-css-font and units-css (d316416) - -1.6.4 / 2017-02-26 -================== -### Fixed - * Make sure Canvas#toDataURL is always async if callback is passed (8586d72) - -1.6.3 / 2017-02-14 -================== -### Fixed - * Fix isnan() and isinf() on clang (5941e13) - -1.6.2 / 2016-10-30 -================== -### Fixed - * Fix deprecation warnings (c264879) - * Bump nan (e4aea20) - -1.6.1 / 2016-10-23 -================== - -### Fixed - * Make has_lib.sh work on BSD OSes (1727d66) - -1.6.0 / 2016-10-16 -================== - - * Support canvas.getBuffer('raw') (#819) - -1.5.0 / 2016-09-11 -================== - - * Crude PDF stream implementation (#781) - * Update CI settings (#797) - * Reduce some of the install warnings (#794) - * Fix lineDash browser tests never finishing (#793) - * Add issue template (#791) - -1.4.0 / 2016-06-03 -================== - - * Add support for evenodd fill rule (#762) - -1.3.17 / 2016-06-03 -=================== - - * Removing redundant duplicate calls (#769) - * Cleanup examples (#776) - * Fix CanvasRenderingContext2D class name (#777) - -1.3.16 / 2016-05-29 -=================== - - * Fix leak of data when streaming JPEG (#774) - -1.3.15 / 2016-05-09 -=================== - - * Fix segfault in putImageData (#750) - -1.3.14 / 2016-05-05 -=================== - - * Clamp JPEG buffer size (#739) - -1.3.13 / 2016-05-01 -=================== - - * Bumb NAN version (#759) - -1.3.12 / 2016-03-01 -=================== - - * Expose freetype version (#718) - * Require new in constructor (#717) - -1.3.11 / 2016-03-01 -=================== - - * Properly clamp quality in toDataURL (#728) - * Strict mode (#719) - -1.3.10 / 2016-02-07 -=================== - - * Fix segfault on node 0.10.x (#712) - -1.3.9 / 2016-01-27 -================== - - * Allow to unbind onload/onerror callback handlers (#706) - -1.3.8 / 2016-01-22 -================== - - * Cleanup build scripts and fix pangocairo detection (#701) - -1.3.7 / 2016-01-13 -================== - - * Don't unbind onload/onerror callbacks after invoking them (#615) - -1.3.6 / 2016-01-06 -================== - - * Allow optional arguments in `toDataURL` to be `undefined` and improve `toDataURL`'s spec compliance (#690) - -1.3.5 / 2015-12-07 -================== - - * Add image/jpeg support to `toDataUrl` (#685) - -1.3.4 / 2015-11-21 -================== - - * Upgrade nan to 2.1.0 (#671) - -1.3.3 / 2015-11-21 -================== - - * Fix compilation on Visual Studio 2015 (#670) - -1.3.2 / 2015-11-18 -================== - - * Fix incorrect Y offset and scaling for shadows (#669) - -1.3.1 / 2015-11-09 -================== - - * Wrap std::min calls in paranthesis to prevent macro expansion on windows (#660) - -1.3.0 / 2015-10-26 -================== - - * Expose ImageData constructor and make it more spec-compliant (#569) - -1.2.11 / 2015-10-20 -=================== - - * Implement blur on images (#648) - -1.2.10 / 2015-10-12 -=================== - - * Fix segfault in Canvas#jpegStream (#629) - -1.2.9 / 2015-09-14 -================== - - * Upgrade to Nan 2.x with support for iojs 3.x and Node.js 4.x (#622) - -1.2.8 / 2015-08-30 -================== - - * Clean up the tests (#612) - * Replace CanvasPixelArray with Uint8ClampedArray to be API-compliant (#604) - * Specify travis iojs versions (#611) - -1.2.7 / 2015-07-29 -================== - - * Avoid future reserved keyword (#592) - -1.2.6 / 2015-07-29 -================== - - * Fix the build on windows (#589) - -1.2.5 / 2015-07-28 -================== - - * Another npm release, since 1.2.4 was botched (see #596) - -1.2.4 / 2015-07-23 -================== - - * Point `homepage` and `repository` links to [`github.com/Automattic/node-canvas`][repo] - * Fix Travis builds and Cairo include paths (thanks, Linus Unnebäck!) - -1.2.3 / 2015-05-21 -================== - - * Update TJ Holowaychuk's username in the readme - * Fix segmentation fault in `Image::loadFromBuffer` when buffer is empty - * Optimize getImageData() - * package: add "license" attribute - * package: update "nan" to v1.8.4 - * package: append `.git` to "repository" URL - -1.2.2 / 2015-04-18 -================== - - * Now works on io.js - * Fix 'drawImage' scaling (the dimensions of the region that gets clipped also needs to be scaled). - * Fix bug in StreamPNGSync - -1.2.1 / 2015-02-10 -================== - - * Use non-cairo 1.12 API for shadow blur - -1.2.0 / 2015-01-31 -================== - - * travis: drop support for node v0.6 - * Merge pull request #507 from salzhrani/iojs - * io.js compatibility - * Merge pull request #505 from woodcoder/shadow-blur - * Fix issue with line width not being correct in stroked shadows. - * Add another shadow/transform test. - * Refactor setSourceRGBA to allow the context to be supplied. - * Simple image shadow (no blurring or handling current transforms) based on image's alpha channel. - * Test showing issue #133, that images don't have shadows. - * The +1 on the offset seems to match the browser's output better, but I can't work out why it would be needed (unless it's pixel alignment related). - * Make the shadow radius more accurately match the browser's, making use of sigma scale as used in SKIA: https://github.com/google/skia/blob/master/src/effects/SkBlurMask.cpp#L26. - * Create a new image surface to render blurred shadows to, this means that vector formats like PDF will now render blurs. - * Add recommended calls to flush and dirty buffer, as per http://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-image-surface-get-data. - * Add PDF button to test page to easily generate PDF version of the test image. - * Fix to ensure shadowOffset is unaffected by the current transform. - * New test illustrating that canvas implementation doesn't translate the shadowOffset. - * Merge pull request #490 from AllYearbooks/master - * Merge pull request #501 from motiz88/hsl-color - * Code style + attribution. Also removed parseClipped() and commented out wrapInt (now wrap_int). - * Added visual tests for hsl() and hsla() color parsing. - * Fixed handling in hsl/hsla color parser. parseNumber() was erroring out on numbers with long fractional parts. - * hsl/hsla color parsing + rebeccapurple hsl() and hsla() color values are now supported, with corresponding unit tests. Also added rebeccapurple (from CSS Color Level 4) to the named color list. - * float rather than int for drawImage arguments - * with_pango to true and use fontconfig to load fonts - * Merge pull request #399 from nulltask/fix/lighten - * Merge pull request #465 from espadrine/master - * Merge pull request #470 from tonylukasavage/patch-1 - * Add one-liner MacPorts install to docs - * Offer SVG output. - * Readme update: node-gyp. - * Readme: fix subheading size - * Readme: remove Gemnasium badge, use SVG for npm badge - * Readme: add Travis-CI badge - * change operator lighter to lighten - -1.1.6 / 2014-08-01 -================== - - * export canvas.CanvasPixelArray instead of canvas.PixelArray which is undefined - * Glib version test into giflib exists test - * Giflib 5.1 - * install: use an even older version of giflib (v4.1.6) - * install: use an older version of giflib (v4.2.3) - * install: install `giflib` - * install: use more compatible sh syntax - * travis: attempt to run the ./install script before testintg - * travis: test node v0.6, v0.8, v0.10, and v0.11 - * Distinguish between 'add' and 'lighter' - -1.1.5 / 2014-06-26 -================== - - * Readme: remove Contributors section - * Readme: update copyright - * On Windows, copy required DLLs next to ".node" file (#442 @pandell) - * Duplicate "msvc_settings" for "Debug" configuration - * Remove unneeded #include - * Use float constants to prevent double->float conversion warning - * Ignore Visual C++ 2013 warnings (#441 @pandell) - * Add algorithm include to CanvasRenderingContext2d.cc for std::min (#435 @kkoopa) - * Updated NAN to 1.2.0 (#434 @kkoopa) - -1.1.4 / 2014-06-08 -================== - - * Fix compile error with Visual C++ - * Add support for the lineDash API - * Update NAN - * New V8 compatibility - * Correctly limit bounds in PutImageData to prevent segment fault - * Fix segfault when onload and onerror are not function - * Add support for Node 0.11.9 - -1.1.3 / 2014-01-08 -================== - - * Add CAIRO_FORMAT_INVALID - * Readjust the amount of allocated memory - * Fix argument index for filter parameter - * Make has_lib.sh work properly on Debian 64bit - -1.1.2 / 2013-10-31 -================== - - * NAN dep upgrade, full node@<=0.11.8 compatibility - * Use node::MakeCallback() instead of v8::Function::Call() - * Improve nan location discovery - * Fix enabling gif/jpeg options on Ubuntu 13.04 - -1.1.1 / 2013-10-09 -================== - - * add better support for outdated versions of Cairo - -1.1.0 / 2013-08-01 -================== - - * add png compression options - * add jpeg stream progressive mode option - * fix resource leaks on read errors - -1.0.4 / 2013-07-23 -================== - - * 0.11.4+ compatibility using NAN - * fix typo in context2d for imageSmoothingEnabled - -1.0.3 / 2013-06-04 -================== - - * add "nearest" and "bilinear" to patternQuality - * fix fread() retval check (items not bytes) - * removed unneeded private fields - -1.0.2 / 2013-03-22 -================== - - * add Context2d#imageSmoothingEnabled= - -1.0.1 / 2013-02-25 -================== - - * travis: test modern node versions - * change the node-gyp build to use pkg-config - -1.0.0 / 2013-01-16 -================== - - * add conditional pango font support [Julian Viereck] - * add `Canvas#{png,jpeg}Stream()` alias of create* legacy methods - * add support for grayscale JPEGs - * fix: explicitly cast the after work callback function to "uv_after_work_cb" - * fix test server for express 3.x - * fix: call cairo_surface_finish in ~Canvas when pdf - * remove old 0.4.x binding support. Closes #197 - -0.13.1 / 2012-08-20 -================== - - * fix cases where GIF_LIB_VERSION is not defined - * fix auto-detection of optional libraries for OS X - * fix Context2d::SetFont for pango when setting normal weight/style - -0.13.0 / 2012-08-12 -================== - - * add pango support [c-spencer] - * add pango / png / jpeg gyp auto-detection [c-spencer] - * add `.gifVersion` [tootallnate] - * add `.jpegVersion` [tootallnate] - * add moar gyp stuff [tootallnate] - * remove wscript - * fix `closure_destroy()` with cast for `AdjustAmountOfExternalAllocatedMemory()` - -0.12.1 / 2012-06-29 -================== - - * fix jpeg malloc Image issue. Closes #160 [c-spencer] - * Improve Image mode API - * Add clearData method to handle reassignment of src, and clean up mime data memory handling. - * Improve how _data_len is managed and use to adjust memory, hide more of mime API behind cairo version conditional. - * Add optional mime-data tracking to Image. - * Refactor JPEG decoding into decodeJPEGIntoSurface - -0.12.0 / 2012-05-02 -================== - - * Added `textDrawingMode` context property [c-spencer] - * Added additional TextMetrics properties [c-spencer] - -0.11.3 / 2012-04-25 -================== - - * Fixed `Image` memory leak. Closes #150 - * Fixed Context2d::hasShadow() - -0.11.2 / 2012-04-12 -================== - - * Fixed: pdf memory leak, free closure and surface in ~Canvas - -0.11.1 / 2012-04-10 -================== - - * Changed: renamed .nextPage() to .addPage() - -0.11.0 / 2012-04-10 -================== - - * Added quick PDF support - * Added `Canvas#type` getter - * Added ./examples/pdf-images.js - * Added ./examples/multiple-page-pdf.js - * Added ./examples/small-pdf.js - -0.10.3 / 2012-02-27 -================== - - * Fixed quadratic curve starting point for undefined path. Closes #155 - -0.10.2 / 2012-02-06 -================== - - * Fixed: Context2d setters with invalid values ignored - * Changed: replaced seek with `fstat()` - -0.10.1 / 2012-01-31 -================== - - * Added _/opt/local/lib_ to wscript [obarthel] - * Added bounds checking to `rgba_to_string()` [obarthel] - * Fixed cleanup in JPEG Image loading [obarthel] - * Fixed missing CSS color table values [obarthel] - -0.10.0 / 2012-01-18 -================== - - * Added `ctx.createPattern()` [slaskis] - -0.9.0 / 2012-01-13 -================== - - * Added `createJPEGStream()` [Elijah Hamovitz] - -0.8.3 / 2012-01-04 -================== - - * Added support for libjpeg62-dev or libjpeg8-dev [wwlinx] - -0.8.2 / 2011-12-14 -================== - - * Fixed two memory leaks in context2d [Tharit] - * Fixed `make test-server` - -0.8.1 / 2011-10-31 -================== - - * Added 0.5.x support [TooTallNate] - * Fixed `measureText().width`. Closes #126 - -0.8.0 / 2011-10-28 -================== - - * Added data uri support. Closes #49 - -0.7.3 / 2011-09-14 -================== - - * Added better lineTo() / moveTo() exception messages - -0.7.2 / 2011-08-30 -================== - - * Changed: prefix some private methods with _ - -0.7.1 / 2011-08-25 -================== - - * Added better image format detection - * Added libpath options to waf configuration; this was necessary to correctly detect gif and jpeg support on FreeBSD - -0.7.0 / 2011-07-12 -================== - - * Added GIF support [Brian McKinney] - -0.6.0 / 2011-06-04 -================== - - * Added `Image#src=Buffer` support. Closes #91 - * Added `devDependencies` - * Added `source-atop` test - * Added _image-src.js_ example - * Removed `V8::AdjustAmountOfExternalAllocatedMemory()` call from `toBuffer()` - * Fixed v8 memory hint when resizing canvas [atomizer] - -0.5.4 / 2011-04-20 -================== - - * Added; special case of zero-width rectangle [atomizer] - * Fixed; do not clamp arguments to integer values [atomizer] - * Fixed; preserve current path during `fillRect()` and `strokeRect()` [atomizer] - * Fixed; `restorePath()`: clear current path before appending [atomizer] - -0.5.3 / 2011-04-11 -================== - - * Clamp image bounds in `PixelArray::PixelArray()` [Marcello Bastea-Forte] - -0.5.2 / 2011-04-09 -================== - - * Changed; make `PNGStream` a real `Stream` [Marcello Bastea-Forte] - -0.5.1 / 2011-03-16 -================== - - * Fixed (kinda) `img.src=` error handling - * Fixed; move closure.h down for malloc ref. Closes #80 - -0.5.0 / 2011-03-14 -================== - - * Added several more operators (color-dodge, color-burn, difference, etc) - * Performance; no longer re-allocating `closure->data` for each png write - * Fixed freeing of `Context2d` states - * Fixed text alignment / baseline [Olaf] - * Fixed HandleScopes [Olaf] - * Fixed small misc memory leaks - * Fixed `Buffer` usage for node 0.4.x - -0.4.3 / 2011-01-11 -================== - - * Fixed font family dereferencing. Closes #72 - * Fixed; stripping of quotes from font-family before applying - * Fixed duplicate textAlign getter - * Removed sans-serif default of _Arial_ - -0.4.2 / 2010-12-28 -================== - - * Fixed font size growing issue after successive calls. Closes #70 - -0.4.1 / 2010-12-18 -================== - - * Fixed; toString() first argument of `{fill,stroke}Text()`. Closes #68 - -0.4.0 / 2010-12-12 -================== - - * Added `drawImage()` with `Canvas` instance support. Closes #67 - -0.3.3 / 2010-11-30 -================== - - * Added `CanvasRenderingContext2d#patternQuality` accessor, accepting _fast_, _good_, and _best_ - * Fixed; pre-multiply `putImageData()` components - * Fixed; `PixelArray` data is not premultiplied - -0.3.2 / 2010-11-26 -================== - - * Added --profile option to config - * Fixed `eio_custom` segfault(s). Closes #46 - * Fixed two named colors. Closes #62 [thanks noonat] - * Fixed a few warnings - * Fixed; freeing data in `Image::loadJPEG()` on failure - * Fixed; include _jpeglib_ only when __HAVE_JPEG__ - * Fixed; using `strstr()` instead of `strnstr()` - -0.3.1 / 2010-11-24 -================== - - * Fixed; `Image` loading is sync until race-condition is resolved - * Fixed; `Image::loadJPEG()` return status based on errno - -0.3.0 / 2010-11-24 -================== - - * Added arcTo(). Closes #11 - * Added c color parser, _./examples/ray.js_ is now twice as fast - * Fixed `putImageData()` bug messing up rgba channels - -0.2.1 / 2010-11-19 -================== - - * Added image _resize_ example - * Fixed canvas resizing via `{width,height}=`. Closes #57 - * Fixed `Canvas#getContext()`, caching the CanvasRenderingContext - * Fixed async image loading (test server still messed) - -0.2.0 / 2010-11-18 -================== - - * Added jpeg `Image` support (when libjpeg is available) - * Added _hsl_ / _hsla_ color support. [Tom Carden] - -0.1.0 / 2010-11-17 -================== - - * Added `Image` - * Added `ImageData` - * Added `PixelArray` - * Added `CanvasRenderingContext2d#drawImage()` - * Added `CanvasRenderingContext2d#getImageData()` - * Added `CanvasRenderingContext2d#createImageData()` - * Added kraken blur benchmark example - * Added several new tests - * Fixed instanceof checks for many c++ methods - * Fixed test runner in firefox [Don Park] - -0.0.8 / 2010-11-12 -================== - - * Added `CanvasRenderingContext2d#drawImage()` - * Fixed `free()` call missing stdlib - * Fixed Image#{width,height} initialization to 0 - * Fixed; load image on non-LOADING state - -0.0.7 / 2010-11-12 -================== - - * Fixed _lighter_ for older versions of cairo - -0.0.6 / 2010-11-12 -================== - - * Added `Image` - * Added conditional support for cairo 1.10.0 operators - -0.0.5 / 2010-11-10 -================== - - * Added custom port support to _test/server.js_ - * Added more global composite operator support - * Added `Context2d#antialias=` - * Added _voronoi_ example - * Added -D__NDEBUG__ to default build - * Added __BUFFER_DATA__ macro for backwards compat buffer data access [Don Park] - * Fixed getter bug preventing patterns from being returned via `fillStyle` etc - - * Fixed; __CAIRO_STATUS_NO_MEMORY___ on failed {re,m}alloc() - * Fixed; free `Canvas::ToBuffer()` closure data - -0.0.4 / 2010-11-09 -================== - - * Bump to fix npm engine cache bug... - -0.0.3 / 2010-11-09 -================== - - * Added async `toDataURL()` support - * Added async `toBuffer()` support - * Removed buffer utils - -0.0.2 / 2010-11-08 -================== - - * Added shadow support (faster/better gaussian blur to come) - * Added node v0.3 support [Don Park] - * Added -O3 to build - * Removed `Canvas#savePNG()` use `Canvas#createPNGStream()` - -0.0.1 / 2010-11-04 -================== - - * Initial release - -[repo]: https://github.com/Automattic/node-canvas diff --git a/node_modules/canvas/Readme.md b/node_modules/canvas/Readme.md deleted file mode 100644 index 9b8cd2a..0000000 --- a/node_modules/canvas/Readme.md +++ /dev/null @@ -1,600 +0,0 @@ -# node-canvas - -[![Build Status](https://travis-ci.org/Automattic/node-canvas.svg?branch=master)](https://travis-ci.org/Automattic/node-canvas) -[![NPM version](https://badge.fury.io/js/canvas.svg)](http://badge.fury.io/js/canvas) - -node-canvas is a [Cairo](http://cairographics.org/)-backed Canvas implementation for [Node.js](http://nodejs.org). - -## Installation - -```bash -$ npm install canvas -``` - -By default, binaries for macOS, Linux and Windows will be downloaded. If you want to build from source, use `npm install --build-from-source` and see the **Compiling** section below. - -The minimum version of Node.js required is **6.0.0**. - -### Compiling - -If you don't have a supported OS or processor architecture, or you use `--build-from-source`, the module will be compiled on your system. This requires several dependencies, including Cairo and Pango. - -For detailed installation information, see the [wiki](https://github.com/Automattic/node-canvas/wiki/_pages). One-line installation instructions for common OSes are below. Note that libgif/giflib, librsvg and libjpeg are optional and only required if you need GIF, SVG and JPEG support, respectively. Cairo v1.10.0 or later is required. - -OS | Command ------ | ----- -OS X | Using [Homebrew](https://brew.sh/):
`brew install pkg-config cairo pango libpng jpeg giflib librsvg` -Ubuntu | `sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev` -Fedora | `sudo yum install gcc-c++ cairo-devel pango-devel libjpeg-turbo-devel giflib-devel` -Solaris | `pkgin install cairo pango pkg-config xproto renderproto kbproto xextproto` -OpenBSD | `doas pkg_add cairo pango png jpeg giflib` -Windows | See the [wiki](https://github.com/Automattic/node-canvas/wiki/Installation:-Windows) -Others | See the [wiki](https://github.com/Automattic/node-canvas/wiki) - -**Mac OS X v10.11+:** If you have recently updated to Mac OS X v10.11+ and are experiencing trouble when compiling, run the following command: `xcode-select --install`. Read more about the problem [on Stack Overflow](http://stackoverflow.com/a/32929012/148072). -If you have xcode 10.0 or higher installed, in order to build from source you need NPM 6.4.1 or higher. - -## Quick Example - -```javascript -const { createCanvas, loadImage } = require('canvas') -const canvas = createCanvas(200, 200) -const ctx = canvas.getContext('2d') - -// Write "Awesome!" -ctx.font = '30px Impact' -ctx.rotate(0.1) -ctx.fillText('Awesome!', 50, 100) - -// Draw line under text -var text = ctx.measureText('Awesome!') -ctx.strokeStyle = 'rgba(0,0,0,0.5)' -ctx.beginPath() -ctx.lineTo(50, 102) -ctx.lineTo(50 + text.width, 102) -ctx.stroke() - -// Draw cat with lime helmet -loadImage('examples/images/lime-cat.jpg').then((image) => { - ctx.drawImage(image, 50, 0, 70, 70) - - console.log('') -}) -``` - -## Upgrading from 2.x - -See the [changelog](https://github.com/Automattic/node-canvas/blob/master/CHANGELOG.md) for a guide to upgrading from 1.x to 2.x. - -For version 1.x documentation, see [the v1.x branch](https://github.com/Automattic/node-canvas/tree/v1.x). - -## Documentation - -This project is an implementation of the Web Canvas API and implements that API as closely as possible. For API documentation, please visit [Mozilla Web Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). (See [Compatibility Status](https://github.com/Automattic/node-canvas/wiki/Compatibility-Status) for the current API compliance.) All utility methods and non-standard APIs are documented below. - -### Utility methods - -* [createCanvas()](#createcanvas) -* [createImageData()](#createimagedata) -* [loadImage()](#loadimage) -* [registerFont()](#registerfont) - -### Non-standard APIs - -* [Image#src](#imagesrc) -* [Image#dataMode](#imagedatamode) -* [Canvas#toBuffer()](#canvastobuffer) -* [Canvas#createPNGStream()](#canvascreatepngstream) -* [Canvas#createJPEGStream()](#canvascreatejpegstream) -* [Canvas#createPDFStream()](#canvascreatepdfstream) -* [Canvas#toDataURL()](#canvastodataurl) -* [CanvasRenderingContext2D#patternQuality](#canvasrenderingcontext2dpatternquality) -* [CanvasRenderingContext2D#quality](#canvasrenderingcontext2dquality) -* [CanvasRenderingContext2D#textDrawingMode](#canvasrenderingcontext2dtextdrawingmode) -* [CanvasRenderingContext2D#globalCompositeOperator = 'saturate'](#canvasrenderingcontext2dglobalcompositeoperator--saturate) -* [CanvasRenderingContext2D#antialias](#canvasrenderingcontext2dantialias) - -### createCanvas() - -> ```ts -> createCanvas(width: number, height: number, type?: 'PDF'|'SVG') => Canvas -> ``` - -Creates a Canvas instance. This method works in both Node.js and Web browsers, where there is no Canvas constructor. (See `browser.js` for the implementation that runs in browsers.) - -```js -const { createCanvas } = require('canvas') -const mycanvas = createCanvas(200, 200) -const myPDFcanvas = createCanvas(600, 800, 'pdf') // see "PDF Support" section -``` - -### createImageData() - -> ```ts -> createImageData(width: number, height: number) => ImageData -> createImageData(data: Uint8ClampedArray, width: number, height?: number) => ImageData -> // for alternative pixel formats: -> createImageData(data: Uint16Array, width: number, height?: number) => ImageData -> ``` - -Creates an ImageData instance. This method works in both Node.js and Web browsers. - -```js -const { createImageData } = require('canvas') -const width = 20, height = 20 -const arraySize = width * height * 4 -const mydata = createImageData(new Uint8ClampedArray(arraySize), width) -``` - -### loadImage() - -> ```ts -> loadImage() => Promise -> ``` - -Convenience method for loading images. This method works in both Node.js and Web browsers. - -```js -const { loadImage } = require('canvas') -const myimg = loadImage('http://server.com/image.png') - -myimg.then(() => { - // do something with image -}).catch(err => { - console.log('oh no!', err) -}) - -// or with async/await: -const myimg = await loadImage('http://server.com/image.png') -// do something with image -``` - -### registerFont() - -> ```ts -> registerFont(path: string, { family: string, weight?: string, style?: string }) => void -> ``` - -To use a font file that is not installed as a system font, use `registerFont()` to register the font with Canvas. *This must be done before the Canvas is created.* - -```js -const { registerFont, createCanvas } = require('canvas') -registerFont('comicsans.ttf', { family: 'Comic Sans' }) - -const canvas = createCanvas(500, 500) -const ctx = canvas.getContext('2d') - -ctx.font = '12px "Comic Sans"' -ctx.fillText('Everyone hates this font :(', 250, 10) -``` - -The second argument is an object with properties that resemble the CSS properties that are specified in `@font-face` rules. You must specify at least `family`. `weight`, and `style` are optional and default to `'normal'`. - -### Image#src - -> ```ts -> img.src: string|Buffer -> ``` - -As in browsers, `img.src` can be set to a `data:` URI or a remote URL. In addition, node-canvas allows setting `src` to a local file path or `Buffer` instance. - -```javascript -const { Image } = require('canvas') - -// From a buffer: -fs.readFile('images/squid.png', (err, squid) => { - if (err) throw err - const img = new Image() - img.onload = () => ctx.drawImage(img, 0, 0) - img.onerror = err => { throw err } - img.src = squid -}) - -// From a local file path: -const img = new Image() -img.onload = () => ctx.drawImage(img, 0, 0) -img.onerror = err => { throw err } -img.src = 'images/squid.png' - -// From a remote URL: -img.src = 'http://picsum.photos/200/300' -// ... as above - -// From a `data:` URI: -img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==' -// ... as above -``` - -*Note: In some cases, `img.src=` is currently synchronous. However, you should always use `img.onload` and `img.onerror`, as we intend to make `img.src=` always asynchronous as it is in browsers. See https://github.com/Automattic/node-canvas/issues/1007.* - -### Image#dataMode - -> ```ts -> img.dataMode: number -> ``` - -Applies to JPEG images drawn to PDF canvases only. - -Setting `img.dataMode = Image.MODE_MIME` or `Image.MODE_MIME|Image.MODE_IMAGE` enables MIME data tracking of images. When MIME data is tracked, PDF canvases can embed JPEGs directly into the output, rather than re-encoding into PNG. This can drastically reduce filesize and speed up rendering. - -```javascript -const { Image, createCanvas } = require('canvas') -const canvas = createCanvas(w, h, 'pdf') -const img = new Image() -img.dataMode = Image.MODE_IMAGE // Only image data tracked -img.dataMode = Image.MODE_MIME // Only mime data tracked -img.dataMode = Image.MODE_MIME | Image.MODE_IMAGE // Both are tracked -``` - -If working with a non-PDF canvas, image data *must* be tracked; otherwise the output will be junk. - -Enabling mime data tracking has no benefits (only a slow down) unless you are generating a PDF. - -### Canvas#toBuffer() - -> ```ts -> canvas.toBuffer((err: Error|null, result: Buffer) => void, mimeType?: string, config?: any) => void -> canvas.toBuffer(mimeType?: string, config?: any) => Buffer -> ``` - -Creates a [`Buffer`](https://nodejs.org/api/buffer.html) object representing the image contained in the canvas. - -* **callback** If provided, the buffer will be provided in the callback instead of being returned by the function. Invoked with an error as the first argument if encoding failed, or the resulting buffer as the second argument if it succeeded. Not supported for mimeType `raw` or for PDF or SVG canvases. -* **mimeType** A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support), `raw` (unencoded data in BGRA order on little-endian (most) systems, ARGB on big-endian systems; top-to-bottom), `application/pdf` (for PDF canvases) and `image/svg+xml` (for SVG canvases). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas. -* **config** - * For `image/jpeg`, an object specifying the quality (0 to 1), if progressive compression should be used and/or if chroma subsampling should be used: `{quality: 0.75, progressive: false, chromaSubsampling: true}`. All properties are optional. - - * For `image/png`, an object specifying the ZLIB compression level (between 0 and 9), the compression filter(s), the palette (indexed PNGs only), the the background palette index (indexed PNGs only) and/or the resolution (ppi): `{compressionLevel: 6, filters: canvas.PNG_ALL_FILTERS, palette: undefined, backgroundIndex: 0, resolution: undefined}`. All properties are optional. - - Note that the PNG format encodes the resolution in pixels per meter, so if you specify `96`, the file will encode 3780 ppm (~96.01 ppi). The resolution is undefined by default to match common browser behavior. - - * For `application/pdf`, an object specifying optional document metadata: `{title: string, author: string, subject: string, keywords: string, creator: string, creationDate: Date, modDate: Date}`. All properties are optional and default to `undefined`, except for `creationDate`, which defaults to the current date. *Adding metadata requires Cairo 1.16.0 or later.* - - For a description of these properties, see page 550 of [PDF 32000-1:2008](https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf). - - Note that there is no standard separator for `keywords`. A space is recommended because it is in common use by other applications, and Cairo will enclose the list of keywords in quotes if a comma or semicolon is used. - -**Return value** - -If no callback is provided, a [`Buffer`](https://nodejs.org/api/buffer.html). If a callback is provided, none. - -#### Examples - -```js -// Default: buf contains a PNG-encoded image -const buf = canvas.toBuffer() - -// PNG-encoded, zlib compression level 3 for faster compression but bigger files, no filtering -const buf2 = canvas.toBuffer('image/png', { compressionLevel: 3, filters: canvas.PNG_FILTER_NONE }) - -// JPEG-encoded, 50% quality -const buf3 = canvas.toBuffer('image/jpeg', { quality: 0.5 }) - -// Asynchronous PNG -canvas.toBuffer((err, buf) => { - if (err) throw err // encoding failed - // buf is PNG-encoded image -}) - -canvas.toBuffer((err, buf) => { - if (err) throw err // encoding failed - // buf is JPEG-encoded image at 95% quality -}, 'image/jpeg', { quality: 0.95 }) - -// BGRA pixel values, native-endian -const buf4 = canvas.toBuffer('raw') -const { stride, width } = canvas -// In memory, this is `canvas.height * canvas.stride` bytes long. -// The top row of pixels, in BGRA order on little-endian hardware, -// left-to-right, is: -const topPixelsBGRALeftToRight = buf4.slice(0, width * 4) -// And the third row is: -const row3 = buf4.slice(2 * stride, 2 * stride + width * 4) - -// SVG and PDF canvases -const myCanvas = createCanvas(w, h, 'pdf') -myCanvas.toBuffer() // returns a buffer containing a PDF-encoded canvas -// With optional metadata: -myCanvas.toBuffer('application/pdf', { - title: 'my picture', - keywords: 'node.js demo cairo', - creationDate: new Date() -}) -``` - -### Canvas#createPNGStream() - -> ```ts -> canvas.createPNGStream(config?: any) => ReadableStream -> ``` - -Creates a [`ReadableStream`](https://nodejs.org/api/stream.html#stream_class_stream_readable) that emits PNG-encoded data. - -* `config` An object specifying the ZLIB compression level (between 0 and 9), the compression filter(s), the palette (indexed PNGs only) and/or the background palette index (indexed PNGs only): `{compressionLevel: 6, filters: canvas.PNG_ALL_FILTERS, palette: undefined, backgroundIndex: 0, resolution: undefined}`. All properties are optional. - -#### Examples - -```javascript -const fs = require('fs') -const out = fs.createWriteStream(__dirname + '/test.png') -const stream = canvas.createPNGStream() -stream.pipe(out) -out.on('finish', () => console.log('The PNG file was created.')) -``` - -To encode indexed PNGs from canvases with `pixelFormat: 'A8'` or `'A1'`, provide an options object: - -```js -const palette = new Uint8ClampedArray([ - //r g b a - 0, 50, 50, 255, // index 1 - 10, 90, 90, 255, // index 2 - 127, 127, 255, 255 - // ... -]) -canvas.createPNGStream({ - palette: palette, - backgroundIndex: 0 // optional, defaults to 0 -}) -``` - -### Canvas#createJPEGStream() - -> ```ts -> canvas.createJPEGStream(config?: any) => ReadableStream -> ``` - -Creates a [`ReadableStream`](https://nodejs.org/api/stream.html#stream_class_stream_readable) that emits JPEG-encoded data. - -*Note: At the moment, `createJPEGStream()` is synchronous under the hood. That is, it runs in the main thread, not in the libuv threadpool.* - -* `config` an object specifying the quality (0 to 1), if progressive compression should be used and/or if chroma subsampling should be used: `{quality: 0.75, progressive: false, chromaSubsampling: true}`. All properties are optional. - -#### Examples - -```javascript -const fs = require('fs') -const out = fs.createWriteStream(__dirname + '/test.jpeg') -const stream = canvas.createJPEGStream() -stream.pipe(out) -out.on('finish', () => console.log('The JPEG file was created.')) - -// Disable 2x2 chromaSubsampling for deeper colors and use a higher quality -const stream = canvas.createJPEGStream({ - quality: 0.95, - chromaSubsampling: false -}) -``` - -### Canvas#createPDFStream() - -> ```ts -> canvas.createPDFStream(config?: any) => ReadableStream -> ``` - -* `config` an object specifying optional document metadata: `{title: string, author: string, subject: string, keywords: string, creator: string, creationDate: Date, modDate: Date}`. See `toBuffer()` for more information. *Adding metadata requires Cairo 1.16.0 or later.* - -Applies to PDF canvases only. Creates a [`ReadableStream`](https://nodejs.org/api/stream.html#stream_class_stream_readable) that emits the encoded PDF. `canvas.toBuffer()` also produces an encoded PDF, but `createPDFStream()` can be used to reduce memory usage. - -### Canvas#toDataURL() - -This is a standard API, but several non-standard calls are supported. The full list of supported calls is: - -```js -dataUrl = canvas.toDataURL() // defaults to PNG -dataUrl = canvas.toDataURL('image/png') -dataUrl = canvas.toDataURL('image/jpeg') -dataUrl = canvas.toDataURL('image/jpeg', quality) // quality from 0 to 1 -canvas.toDataURL((err, png) => { }) // defaults to PNG -canvas.toDataURL('image/png', (err, png) => { }) -canvas.toDataURL('image/jpeg', (err, jpeg) => { }) // sync JPEG is not supported -canvas.toDataURL('image/jpeg', {...opts}, (err, jpeg) => { }) // see Canvas#createJPEGStream for valid options -canvas.toDataURL('image/jpeg', quality, (err, jpeg) => { }) // spec-following; quality from 0 to 1 -``` - -### CanvasRenderingContext2D#patternQuality - -> ```ts -> context.patternQuality: 'fast'|'good'|'best'|'nearest'|'bilinear' -> ``` - -Defaults to `'good'`. Affects pattern (gradient, image, etc.) rendering quality. - -### CanvasRenderingContext2D#quality - -> ```ts -> context.quality: 'fast'|'good'|'best'|'nearest'|'bilinear' -> ``` - -Defaults to `'good'`. Like `patternQuality`, but applies to transformations affecting more than just patterns. - -### CanvasRenderingContext2D#textDrawingMode - -> ```ts -> context.textDrawingMode: 'path'|'glyph' -> ``` - -Defaults to `'path'`. The effect depends on the canvas type: - -* **Standard (image)** `glyph` and `path` both result in rasterized text. Glyph mode is faster than `path`, but may result in lower-quality text, especially when rotated or translated. - -* **PDF** `glyph` will embed text instead of paths into the PDF. This is faster to encode, faster to open with PDF viewers, yields a smaller file size and makes the text selectable. The subset of the font needed to render the glyphs will be embedded in the PDF. This is usually the mode you want to use with PDF canvases. - -* **SVG** `glyph` does *not* cause `` elements to be produced as one might expect ([cairo bug](https://gitlab.freedesktop.org/cairo/cairo/issues/253)). Rather, `glyph` will create a `` section with a `` for each glyph, then those glyphs be reused via `` elements. `path` mode creates a `` element for each text string. `glyph` mode is faster and yields a smaller file size. - -In `glyph` mode, `ctx.strokeText()` and `ctx.fillText()` behave the same (aside from using the stroke and fill style, respectively). - -This property is tracked as part of the canvas state in save/restore. - -### CanvasRenderingContext2D#globalCompositeOperation = 'saturate' - -In addition to all of the standard global composite operations defined by the Canvas specification, the ['saturate'](https://www.cairographics.org/operators/#saturate) operation is also available. - -### CanvasRenderingContext2D#antialias - -> ```ts -> context.antialias: 'default'|'none'|'gray'|'subpixel' -> ``` - -Sets the anti-aliasing mode. - -## PDF Output Support - -node-canvas can create PDF documents instead of images. The canvas type must be set when creating the canvas as follows: - -```js -const canvas = createCanvas(200, 500, 'pdf') -``` - -An additional method `.addPage()` is then available to create multiple page PDFs: - -```js -// On first page -ctx.font = '22px Helvetica' -ctx.fillText('Hello World', 50, 80) - -ctx.addPage() -// Now on second page -ctx.font = '22px Helvetica' -ctx.fillText('Hello World 2', 50, 80) - -canvas.toBuffer() // returns a PDF file -canvas.createPDFStream() // returns a ReadableStream that emits a PDF -// With optional document metadata (requires Cairo 1.16.0): -canvas.toBuffer('application/pdf', { - title: 'my picture', - keywords: 'node.js demo cairo', - creationDate: new Date() -}) -``` - -It is also possible to create pages with different sizes by passing `width` and `height` to the `.addPage()` method: - -```js -ctx.font = '22px Helvetica' -ctx.fillText('Hello World', 50, 80) -ctx.addPage(400, 800) - -ctx.fillText('Hello World 2', 50, 80) -``` - -See also: - -* [Image#dataMode](#imagedatamode) for embedding JPEGs in PDFs -* [Canvas#createPDFStream()](#canvascreatepdfstream) for creating PDF streams -* [CanvasRenderingContext2D#textDrawingMode](#canvasrenderingcontext2dtextdrawingmode) - for embedding text instead of paths - -## SVG Output Support - -node-canvas can create SVG documents instead of images. The canvas type must be set when creating the canvas as follows: - -```js -const canvas = createCanvas(200, 500, 'svg') -// Use the normal primitives. -fs.writeFileSync('out.svg', canvas.toBuffer()) -``` - -## SVG Image Support - -If librsvg is available when node-canvas is installed, node-canvas can render SVG images to your canvas context. This currently works by rasterizing the SVG image (i.e. drawing an SVG image to an SVG canvas will not preserve the SVG data). - -```js -const img = new Image() -img.onload = () => ctx.drawImage(img, 0, 0) -img.onerror = err => { throw err } -img.src = './example.svg' -``` - -## Image pixel formats (experimental) - -node-canvas has experimental support for additional pixel formats, roughly following the [Canvas color space proposal](https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md). - -```js -const canvas = createCanvas(200, 200) -const ctx = canvas.getContext('2d', { pixelFormat: 'A8' }) -``` - -By default, canvases are created in the `RGBA32` format, which corresponds to the native HTML Canvas behavior. Each pixel is 32 bits. The JavaScript APIs that involve pixel data (`getImageData`, `putImageData`) store the colors in the order {red, green, blue, alpha} without alpha pre-multiplication. (The C++ API stores the colors in the order {alpha, red, green, blue} in native-[endian](https://en.wikipedia.org/wiki/Endianness) ordering, with alpha pre-multiplication.) - -These additional pixel formats have experimental support: - -* `RGB24` Like `RGBA32`, but the 8 alpha bits are always opaque. This format is always used if the `alpha` context attribute is set to false (i.e. `canvas.getContext('2d', {alpha: false})`). This format can be faster than `RGBA32` because transparency does not need to be calculated. -* `A8` Each pixel is 8 bits. This format can either be used for creating grayscale images (treating each byte as an alpha value), or for creating indexed PNGs (treating each byte as a palette index) (see [the example using alpha values with `fillStyle`](examples/indexed-png-alpha.js) and [the example using `imageData`](examples/indexed-png-image-data.js)). -* `RGB16_565` Each pixel is 16 bits, with red in the upper 5 bits, green in the middle 6 bits, and blue in the lower 5 bits, in native platform endianness. Some hardware devices and frame buffers use this format. Note that PNG does not support this format; when creating a PNG, the image will be converted to 24-bit RGB. This format is thus suboptimal for generating PNGs. `ImageData` instances for this mode use a `Uint16Array` instead of a `Uint8ClampedArray`. -* `A1` Each pixel is 1 bit, and pixels are packed together into 32-bit quantities. The ordering of the bits matches the endianness of the - platform: on a little-endian machine, the first pixel is the least-significant bit. This format can be used for creating single-color images. *Support for this format is incomplete, see note below.* -* `RGB30` Each pixel is 30 bits, with red in the upper 10, green in the middle 10, and blue in the lower 10. (Requires Cairo 1.12 or later.) *Support for this format is incomplete, see note below.* - -Notes and caveats: - -* Using a non-default format can affect the behavior of APIs that involve pixel data: - - * `context2d.createImageData` The size of the array returned depends on the number of bit per pixel for the underlying image data format, per the above descriptions. - * `context2d.getImageData` The format of the array returned depends on the underlying image mode, per the above descriptions. Be aware of platform endianness, which can be determined using node.js's [`os.endianness()`](https://nodejs.org/api/os.html#os_os_endianness) - function. - * `context2d.putImageData` As above. - -* `A1` and `RGB30` do not yet support `getImageData` or `putImageData`. Have a use case and/or opinion on working with these formats? Open an issue and let us know! (See #935.) - -* `A1`, `A8`, `RGB30` and `RGB16_565` with shadow blurs may crash or not render properly. - -* The `ImageData(width, height)` and `ImageData(Uint8ClampedArray, width)` constructors assume 4 bytes per pixel. To create an `ImageData` instance with a different number of bytes per pixel, use `new ImageData(new Uint8ClampedArray(size), width, height)` or `new ImageData(new Uint16ClampedArray(size), width, height)`. - -## Testing - -First make sure you've built the latest version. Get all the deps you need (see [compiling](#compiling) above), and run: - -``` -npm install --build-from-source -``` - -For visual tests: `npm run test-server` and point your browser to http://localhost:4000. - -For unit tests: `npm run test`. - -## Benchmarks - -Benchmarks live in the `benchmarks` directory. - -## Examples - -Examples line in the `examples` directory. Most produce a png image of the same name, and others such as *live-clock.js* launch an HTTP server to be viewed in the browser. - -## Original Authors - - - TJ Holowaychuk ([tj](http://github.com/tj)) - - Nathan Rajlich ([TooTallNate](http://github.com/TooTallNate)) - - Rod Vagg ([rvagg](http://github.com/rvagg)) - - Juriy Zaytsev ([kangax](http://github.com/kangax)) - -## License - -### node-canvas - -(The MIT License) - -Copyright (c) 2010 LearnBoost, and contributors <dev@learnboost.com> - -Copyright (c) 2014 Automattic, Inc and contributors <dev@automattic.com> - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the 'Software'), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### BMP parser - -See [license](src/bmp/LICENSE.md) diff --git a/node_modules/canvas/binding.gyp b/node_modules/canvas/binding.gyp deleted file mode 100644 index 24b08d5..0000000 --- a/node_modules/canvas/binding.gyp +++ /dev/null @@ -1,221 +0,0 @@ -{ - 'conditions': [ - ['OS=="win"', { - 'variables': { - 'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle - 'with_jpeg%': 'false', - 'with_gif%': 'false', - 'with_rsvg%': 'false', - 'variables': { # Nest jpeg_root to evaluate it before with_jpeg - 'jpeg_root%': ' { - const image = new Image() - - function cleanup () { - image.onload = null - image.onerror = null - } - - image.onload = () => { cleanup(); resolve(image) } - image.onerror = (err) => { cleanup(); reject(err) } - - image.src = src - }) -} - -/** - * Resolve paths for registerFont. Must be called *before* creating a Canvas - * instance. - * @param src {string} Path to font file. - * @param fontFace {{family: string, weight?: string, style?: string}} Object - * specifying font information. `weight` and `style` default to `"normal"`. - */ -function registerFont (src, fontFace) { - // TODO this doesn't need to be on Canvas; it should just be a static method - // of `bindings`. - return Canvas._registerFont(fs.realpathSync(src), fontFace) -} - -module.exports = { - Canvas, - Context2d: CanvasRenderingContext2D, // Legacy/compat export - CanvasRenderingContext2D, - CanvasGradient: bindings.CanvasGradient, - CanvasPattern: bindings.CanvasPattern, - Image, - ImageData: bindings.ImageData, - PNGStream, - PDFStream, - JPEGStream, - DOMMatrix, - DOMPoint, - - registerFont, - parseFont, - - createCanvas, - createImageData, - loadImage, - - backends: bindings.Backends, - - /** Library version. */ - version: packageJson.version, - /** Cairo version. */ - cairoVersion: bindings.cairoVersion, - /** jpeglib version. */ - jpegVersion: bindings.jpegVersion, - /** gif_lib version. */ - gifVersion: bindings.gifVersion ? bindings.gifVersion.replace(/[^.\d]/g, '') : undefined, - /** freetype version. */ - freetypeVersion: bindings.freetypeVersion -} diff --git a/node_modules/canvas/lib/DOMMatrix.js b/node_modules/canvas/lib/DOMMatrix.js deleted file mode 100644 index 5c43c62..0000000 --- a/node_modules/canvas/lib/DOMMatrix.js +++ /dev/null @@ -1,482 +0,0 @@ -'use strict' - -const util = require('util') - -// DOMMatrix per https://drafts.fxtf.org/geometry/#DOMMatrix - -function DOMPoint(x, y, z, w) { - if (!(this instanceof DOMPoint)) { - throw new TypeError("Class constructors cannot be invoked without 'new'") - } - - if (typeof x === 'object') { - w = x.w - z = x.z - y = x.y - x = x.x - } - this.x = typeof x === 'number' ? x : 0 - this.y = typeof y === 'number' ? y : 0 - this.z = typeof z === 'number' ? z : 0 - this.w = typeof w === 'number' ? w : 1 -} - -// Constants to index into _values (col-major) -const M11 = 0, M12 = 1, M13 = 2, M14 = 3 -const M21 = 4, M22 = 5, M23 = 6, M24 = 7 -const M31 = 8, M32 = 9, M33 = 10, M34 = 11 -const M41 = 12, M42 = 13, M43 = 14, M44 = 15 - -const DEGREE_PER_RAD = 180 / Math.PI -const RAD_PER_DEGREE = Math.PI / 180 - -function parseMatrix(init) { - var parsed = init.replace(/matrix\(/, '') - parsed = parsed.split(/,/, 7) // 6 + 1 to handle too many params - if (parsed.length !== 6) throw new Error(`Failed to parse ${init}`) - parsed = parsed.map(parseFloat) - return [ - parsed[0], parsed[1], 0, 0, - parsed[2], parsed[3], 0, 0, - 0, 0, 1, 0, - parsed[4], parsed[5], 0, 1 - ] -} - -function parseMatrix3d(init) { - var parsed = init.replace(/matrix3d\(/, '') - parsed = parsed.split(/,/, 17) // 16 + 1 to handle too many params - if (parsed.length !== 16) throw new Error(`Failed to parse ${init}`) - return parsed.map(parseFloat) -} - -function parseTransform(tform) { - var type = tform.split(/\(/, 1)[0] - switch (type) { - case 'matrix': - return parseMatrix(tform) - case 'matrix3d': - return parseMatrix3d(tform) - // TODO This is supposed to support any CSS transform value. - default: - throw new Error(`${type} parsing not implemented`) - } -} - -function DOMMatrix (init) { - if (!(this instanceof DOMMatrix)) { - throw new TypeError("Class constructors cannot be invoked without 'new'") - } - - this._is2D = true - this._values = new Float64Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]) - - var i - - if (typeof init === 'string') { // parse CSS transformList - if (init === '') return // default identity matrix - var tforms = init.split(/\)\s+/, 20).map(parseTransform) - if (tforms.length === 0) return - init = tforms[0] - for (i = 1; i < tforms.length; i++) init = multiply(tforms[i], init) - } - - i = 0 - if (init && init.length === 6) { - setNumber2D(this, M11, init[i++]) - setNumber2D(this, M12, init[i++]) - setNumber2D(this, M21, init[i++]) - setNumber2D(this, M22, init[i++]) - setNumber2D(this, M41, init[i++]) - setNumber2D(this, M42, init[i++]) - } else if (init && init.length === 16) { - setNumber2D(this, M11, init[i++]) - setNumber2D(this, M12, init[i++]) - setNumber3D(this, M13, init[i++]) - setNumber3D(this, M14, init[i++]) - setNumber2D(this, M21, init[i++]) - setNumber2D(this, M22, init[i++]) - setNumber3D(this, M23, init[i++]) - setNumber3D(this, M24, init[i++]) - setNumber3D(this, M31, init[i++]) - setNumber3D(this, M32, init[i++]) - setNumber3D(this, M33, init[i++]) - setNumber3D(this, M34, init[i++]) - setNumber2D(this, M41, init[i++]) - setNumber2D(this, M42, init[i++]) - setNumber3D(this, M43, init[i++]) - setNumber3D(this, M44, init[i]) - } else if (init !== undefined) { - throw new TypeError('Expected string or array.') - } -} - -DOMMatrix.fromMatrix = function (init) { - if (!(init instanceof DOMMatrix)) throw new TypeError('Expected DOMMatrix') - return new DOMMatrix(init._values) -} -DOMMatrix.fromFloat32Array = function (init) { - if (!(init instanceof Float32Array)) throw new TypeError('Expected Float32Array') - return new DOMMatrix(init) -} -DOMMatrix.fromFloat64Array = function (init) { - if (!(init instanceof Float64Array)) throw new TypeError('Expected Float64Array') - return new DOMMatrix(init) -} - -// TODO || is for Node.js pre-v6.6.0 -DOMMatrix.prototype[util.inspect.custom || 'inspect'] = function (depth, options) { - if (depth < 0) return '[DOMMatrix]' - - return `DOMMatrix [ - a: ${this.a} - b: ${this.b} - c: ${this.c} - d: ${this.d} - e: ${this.e} - f: ${this.f} - m11: ${this.m11} - m12: ${this.m12} - m13: ${this.m13} - m14: ${this.m14} - m21: ${this.m21} - m22: ${this.m22} - m23: ${this.m23} - m23: ${this.m23} - m31: ${this.m31} - m32: ${this.m32} - m33: ${this.m33} - m34: ${this.m34} - m41: ${this.m41} - m42: ${this.m42} - m43: ${this.m43} - m44: ${this.m44} - is2D: ${this.is2D} - isIdentity: ${this.isIdentity} ]` -} - -DOMMatrix.prototype.toString = function () { - return this.is2D ? - `matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.e}, ${this.f})` : - `matrix3d(${this._values.join(', ')})` -} - -/** - * Checks that `value` is a number and sets the value. - */ -function setNumber2D(receiver, index, value) { - if (typeof value !== 'number') throw new TypeError('Expected number') - return receiver._values[index] = value -} - -/** - * Checks that `value` is a number, sets `_is2D = false` if necessary and sets - * the value. - */ -function setNumber3D(receiver, index, value) { - if (typeof value !== 'number') throw new TypeError('Expected number') - if (index === M33 || index === M44) { - if (value !== 1) receiver._is2D = false - } else if (value !== 0) receiver._is2D = false - return receiver._values[index] = value -} - -Object.defineProperties(DOMMatrix.prototype, { - m11: {get: function () { return this._values[M11] }, set: function (v) { return setNumber2D(this, M11, v) }}, - m12: {get: function () { return this._values[M12] }, set: function (v) { return setNumber2D(this, M12, v) }}, - m13: {get: function () { return this._values[M13] }, set: function (v) { return setNumber3D(this, M13, v) }}, - m14: {get: function () { return this._values[M14] }, set: function (v) { return setNumber3D(this, M14, v) }}, - m21: {get: function () { return this._values[M21] }, set: function (v) { return setNumber2D(this, M21, v) }}, - m22: {get: function () { return this._values[M22] }, set: function (v) { return setNumber2D(this, M22, v) }}, - m23: {get: function () { return this._values[M23] }, set: function (v) { return setNumber3D(this, M23, v) }}, - m24: {get: function () { return this._values[M24] }, set: function (v) { return setNumber3D(this, M24, v) }}, - m31: {get: function () { return this._values[M31] }, set: function (v) { return setNumber3D(this, M31, v) }}, - m32: {get: function () { return this._values[M32] }, set: function (v) { return setNumber3D(this, M32, v) }}, - m33: {get: function () { return this._values[M33] }, set: function (v) { return setNumber3D(this, M33, v) }}, - m34: {get: function () { return this._values[M34] }, set: function (v) { return setNumber3D(this, M34, v) }}, - m41: {get: function () { return this._values[M41] }, set: function (v) { return setNumber2D(this, M41, v) }}, - m42: {get: function () { return this._values[M42] }, set: function (v) { return setNumber2D(this, M42, v) }}, - m43: {get: function () { return this._values[M43] }, set: function (v) { return setNumber3D(this, M43, v) }}, - m44: {get: function () { return this._values[M44] }, set: function (v) { return setNumber3D(this, M44, v) }}, - - a: {get: function () { return this.m11 }, set: function (v) { return this.m11 = v }}, - b: {get: function () { return this.m12 }, set: function (v) { return this.m12 = v }}, - c: {get: function () { return this.m21 }, set: function (v) { return this.m21 = v }}, - d: {get: function () { return this.m22 }, set: function (v) { return this.m22 = v }}, - e: {get: function () { return this.m41 }, set: function (v) { return this.m41 = v }}, - f: {get: function () { return this.m42 }, set: function (v) { return this.m42 = v }}, - - is2D: {get: function () { return this._is2D }}, // read-only - - isIdentity: { - get: function () { - var values = this._values - return values[M11] === 1 && values[M12] === 0 && values[M13] === 0 && values[M14] === 0 && - values[M21] === 0 && values[M22] === 1 && values[M23] === 0 && values[M24] === 0 && - values[M31] === 0 && values[M32] === 0 && values[M33] === 1 && values[M34] === 0 && - values[M41] === 0 && values[M42] === 0 && values[M43] === 0 && values[M44] === 1 - } - } -}) - -/** - * Instantiates a DOMMatrix, bypassing the constructor. - * @param {Float64Array} values Value to assign to `_values`. This is assigned - * without copying (okay because all usages are followed by a multiply). - */ -function newInstance(values) { - var instance = Object.create(DOMMatrix.prototype) - instance.constructor = DOMMatrix - instance._is2D = true - instance._values = values - return instance -} - -function multiply(A, B) { - var dest = new Float64Array(16) - for (var i = 0; i < 4; i++) { - for (var j = 0; j < 4; j++) { - var sum = 0 - for (var k = 0; k < 4; k++) { - sum += A[i * 4 + k] * B[k * 4 + j] - } - dest[i * 4 + j] = sum - } - } - return dest -} - -DOMMatrix.prototype.multiply = function (other) { - return newInstance(this._values).multiplySelf(other) -} -DOMMatrix.prototype.multiplySelf = function (other) { - this._values = multiply(other._values, this._values) - if (!other.is2D) this._is2D = false - return this -} -DOMMatrix.prototype.preMultiplySelf = function (other) { - this._values = multiply(this._values, other._values) - if (!other.is2D) this._is2D = false - return this -} - -DOMMatrix.prototype.translate = function (tx, ty, tz) { - return newInstance(this._values).translateSelf(tx, ty, tz) -} -DOMMatrix.prototype.translateSelf = function (tx, ty, tz) { - if (typeof tx !== 'number') tx = 0 - if (typeof ty !== 'number') ty = 0 - if (typeof tz !== 'number') tz = 0 - this._values = multiply([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - tx, ty, tz, 1 - ], this._values) - if (tz !== 0) this._is2D = false - return this -} - -DOMMatrix.prototype.scale = function (scaleX, scaleY, scaleZ, originX, originY, originZ) { - return newInstance(this._values).scaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ) -} -DOMMatrix.prototype.scale3d = function (scale, originX, originY, originZ) { - return newInstance(this._values).scale3dSelf(scale, originX, originY, originZ) -} -DOMMatrix.prototype.scale3dSelf = function (scale, originX, originY, originZ) { - return this.scaleSelf(scale, scale, scale, originX, originY, originZ) -} -DOMMatrix.prototype.scaleSelf = function (scaleX, scaleY, scaleZ, originX, originY, originZ) { - // Not redundant with translate's checks because we need to negate the values later. - if (typeof originX !== 'number') originX = 0 - if (typeof originY !== 'number') originY = 0 - if (typeof originZ !== 'number') originZ = 0 - this.translateSelf(originX, originY, originZ) - if (typeof scaleX !== 'number') scaleX = 1 - if (typeof scaleY !== 'number') scaleY = scaleX - if (typeof scaleZ !== 'number') scaleZ = 1 - this._values = multiply([ - scaleX, 0, 0, 0, - 0, scaleY, 0, 0, - 0, 0, scaleZ, 0, - 0, 0, 0, 1 - ], this._values) - this.translateSelf(-originX, -originY, -originZ) - if (scaleZ !== 1 || originZ !== 0) this._is2D = false - return this -} - -DOMMatrix.prototype.rotateFromVector = function (x, y) { - return newInstance(this._values).rotateFromVectorSelf(x, y) -} -DOMMatrix.prototype.rotateFromVectorSelf = function (x, y) { - if (typeof x !== 'number') x = 0 - if (typeof y !== 'number') y = 0 - var theta = (x === 0 && y === 0) ? 0 : Math.atan2(y, x) * DEGREE_PER_RAD - return this.rotateSelf(theta) -} -DOMMatrix.prototype.rotate = function (rotX, rotY, rotZ) { - return newInstance(this._values).rotateSelf(rotX, rotY, rotZ) -} -DOMMatrix.prototype.rotateSelf = function (rotX, rotY, rotZ) { - if (rotY === undefined && rotZ === undefined) { - rotZ = rotX - rotX = rotY = 0 - } - if (typeof rotY !== 'number') rotY = 0 - if (typeof rotZ !== 'number') rotZ = 0 - if (rotX !== 0 || rotY !== 0) this._is2D = false - rotX *= RAD_PER_DEGREE - rotY *= RAD_PER_DEGREE - rotZ *= RAD_PER_DEGREE - var c, s - c = Math.cos(rotZ) - s = Math.sin(rotZ) - this._values = multiply([ - c, s, 0, 0, - -s, c, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ], this._values) - c = Math.cos(rotY) - s = Math.sin(rotY) - this._values = multiply([ - c, 0, -s, 0, - 0, 1, 0, 0, - s, 0, c, 0, - 0, 0, 0, 1 - ], this._values) - c = Math.cos(rotX) - s = Math.sin(rotX) - this._values = multiply([ - 1, 0, 0, 0, - 0, c, s, 0, - 0, -s, c, 0, - 0, 0, 0, 1 - ], this._values) - return this -} - -DOMMatrix.prototype.rotateAxisAngle = function (x, y, z, angle) { - return newInstance(this._values).rotateAxisAngleSelf(x, y, z, angle) -} -DOMMatrix.prototype.rotateAxisAngleSelf = function (x, y, z, angle) { - if (typeof x !== 'number') x = 0 - if (typeof y !== 'number') y = 0 - if (typeof z !== 'number') z = 0 - // Normalize axis - var length = Math.sqrt(x * x + y * y + z * z) - if (length === 0) return this - if (length !== 1) { - x /= length - y /= length - z /= length - } - angle *= RAD_PER_DEGREE - var c = Math.cos(angle) - var s = Math.sin(angle) - var t = 1 - c - var tx = t * x - var ty = t * y - // NB: This is the generic transform. If the axis is a major axis, there are - // faster transforms. - this._values = multiply([ - tx * x + c, tx * y + s * z, tx * z - s * y, 0, - tx * y - s * z, ty * y + c, ty * z + s * x, 0, - tx * z + s * y, ty * z - s * x, t * z * z + c, 0, - 0, 0, 0, 1 - ], this._values) - if (x !== 0 || y !== 0) this._is2D = false - return this -} - -DOMMatrix.prototype.skewX = function (sx) { - return newInstance(this._values).skewXSelf(sx) -} -DOMMatrix.prototype.skewXSelf = function (sx) { - if (typeof sx !== 'number') return this - var t = Math.tan(sx * RAD_PER_DEGREE) - this._values = multiply([ - 1, 0, 0, 0, - t, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ], this._values) - return this -} - -DOMMatrix.prototype.skewY = function (sy) { - return newInstance(this._values).skewYSelf(sy) -} -DOMMatrix.prototype.skewYSelf = function (sy) { - if (typeof sy !== 'number') return this - var t = Math.tan(sy * RAD_PER_DEGREE) - this._values = multiply([ - 1, t, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ], this._values) - return this -} - -DOMMatrix.prototype.flipX = function () { - return newInstance(multiply([ - -1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ], this._values)) -} -DOMMatrix.prototype.flipY = function () { - return newInstance(multiply([ - 1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ], this._values)) -} - -DOMMatrix.prototype.inverse = function () { - return newInstance(this._values).invertSelf() -} -DOMMatrix.prototype.invertSelf = function () { - // If not invertible, set all attributes to NaN and is2D to false - throw new Error('Not implemented') -} - -DOMMatrix.prototype.setMatrixValue = function (transformList) { - var temp = new DOMMatrix(transformList) - this._values = temp._values - this._is2D = temp._is2D - return this -} - -DOMMatrix.prototype.transformPoint = function (point) { - point = new DOMPoint(point) - var x = point.x - var y = point.y - var z = point.z - var w = point.w - var values = this._values - var nx = values[M11] * x + values[M21] * y + values[M31] * z + values[M41] * w - var ny = values[M12] * x + values[M22] * y + values[M32] * z + values[M42] * w - var nz = values[M13] * x + values[M23] * y + values[M33] * z + values[M43] * w - var nw = values[M14] * x + values[M24] * y + values[M34] * z + values[M44] * w - return new DOMPoint(nx, ny, nz, nw) -} - -DOMMatrix.prototype.toFloat32Array = function () { - return Float32Array.from(this._values) -} - -DOMMatrix.prototype.toFloat64Array = function () { - return this._values.slice(0) -} - -module.exports = {DOMMatrix, DOMPoint} diff --git a/node_modules/canvas/lib/bindings.js b/node_modules/canvas/lib/bindings.js deleted file mode 100644 index c0afc98..0000000 --- a/node_modules/canvas/lib/bindings.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../build/Release/canvas.node'); diff --git a/node_modules/canvas/lib/canvas.js b/node_modules/canvas/lib/canvas.js deleted file mode 100644 index 18b4736..0000000 --- a/node_modules/canvas/lib/canvas.js +++ /dev/null @@ -1,113 +0,0 @@ -'use strict'; - -/*! - * Canvas - * Copyright (c) 2010 LearnBoost - * MIT Licensed - */ - -const bindings = require('./bindings') -const Canvas = module.exports = bindings.Canvas -const Context2d = require('./context2d') -const PNGStream = require('./pngstream') -const PDFStream = require('./pdfstream') -const JPEGStream = require('./jpegstream') -const FORMATS = ['image/png', 'image/jpeg'] -const util = require('util') - -// TODO || is for Node.js pre-v6.6.0 -Canvas.prototype[util.inspect.custom || 'inspect'] = function () { - return `[Canvas ${this.width}x${this.height}]` -} - -Canvas.prototype.getContext = function (contextType, contextAttributes) { - if ('2d' == contextType) { - var ctx = this._context2d || (this._context2d = new Context2d(this, contextAttributes)); - this.context = ctx; - ctx.canvas = this; - return ctx; - } -}; - -Canvas.prototype.pngStream = -Canvas.prototype.createPNGStream = function(options){ - return new PNGStream(this, options); -}; - -Canvas.prototype.pdfStream = -Canvas.prototype.createPDFStream = function(options){ - return new PDFStream(this, options); -}; - -Canvas.prototype.jpegStream = -Canvas.prototype.createJPEGStream = function(options){ - return new JPEGStream(this, options); -}; - -Canvas.prototype.toDataURL = function(a1, a2, a3){ - // valid arg patterns (args -> [type, opts, fn]): - // [] -> ['image/png', null, null] - // [qual] -> ['image/png', null, null] - // [undefined] -> ['image/png', null, null] - // ['image/png'] -> ['image/png', null, null] - // ['image/png', qual] -> ['image/png', null, null] - // [fn] -> ['image/png', null, fn] - // [type, fn] -> [type, null, fn] - // [undefined, fn] -> ['image/png', null, fn] - // ['image/png', qual, fn] -> ['image/png', null, fn] - // ['image/jpeg', fn] -> ['image/jpeg', null, fn] - // ['image/jpeg', opts, fn] -> ['image/jpeg', opts, fn] - // ['image/jpeg', qual, fn] -> ['image/jpeg', {quality: qual}, fn] - // ['image/jpeg', undefined, fn] -> ['image/jpeg', null, fn] - // ['image/jpeg'] -> ['image/jpeg', null, fn] - // ['image/jpeg', opts] -> ['image/jpeg', opts, fn] - // ['image/jpeg', qual] -> ['image/jpeg', {quality: qual}, fn] - - var type = 'image/png'; - var opts = {}; - var fn; - - if ('function' === typeof a1) { - fn = a1; - } else { - if ('string' === typeof a1 && FORMATS.includes(a1.toLowerCase())) { - type = a1.toLowerCase(); - } - - if ('function' === typeof a2) { - fn = a2; - } else { - if ('object' === typeof a2) { - opts = a2; - } else if ('number' === typeof a2) { - opts = {quality: Math.max(0, Math.min(1, a2))}; - } - - if ('function' === typeof a3) { - fn = a3; - } else if (undefined !== a3) { - throw new TypeError(typeof a3 + ' is not a function'); - } - } - } - - if (this.width === 0 || this.height === 0) { - // Per spec, if the bitmap has no pixels, return this string: - var str = "data:,"; - if (fn) { - setTimeout(() => fn(null, str)); - return; - } else { - return str; - } - } - - if (fn) { - this.toBuffer((err, buf) => { - if (err) return fn(err); - fn(null, `data:${type};base64,${buf.toString('base64')}`); - }, type, opts) - } else { - return `data:${type};base64,${this.toBuffer(type, opts).toString('base64')}` - } -}; diff --git a/node_modules/canvas/lib/context2d.js b/node_modules/canvas/lib/context2d.js deleted file mode 100644 index 75f5063..0000000 --- a/node_modules/canvas/lib/context2d.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -/*! - * Canvas - Context2d - * Copyright (c) 2010 LearnBoost - * MIT Licensed - */ - -const bindings = require('./bindings') -const parseFont = require('./parse-font') -const { DOMMatrix } = require('./DOMMatrix') - -bindings.CanvasRenderingContext2dInit(DOMMatrix, parseFont) -module.exports = bindings.CanvasRenderingContext2d diff --git a/node_modules/canvas/lib/image.js b/node_modules/canvas/lib/image.js deleted file mode 100644 index 2788a5d..0000000 --- a/node_modules/canvas/lib/image.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -/*! - * Canvas - Image - * Copyright (c) 2010 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -const bindings = require('./bindings') -const Image = module.exports = bindings.Image -const util = require('util') - -// Lazily loaded simple-get -let get; - -const {GetSource, SetSource} = bindings; - -Object.defineProperty(Image.prototype, 'src', { - /** - * src setter. Valid values: - * * `data:` URI - * * Local file path - * * HTTP or HTTPS URL - * * Buffer containing image data (i.e. not a `data:` URI stored in a Buffer) - * - * @param {String|Buffer} val filename, buffer, data URI, URL - * @api public - */ - set(val) { - if (typeof val === 'string') { - if (/^\s*data:/.test(val)) { // data: URI - const commaI = val.indexOf(',') - // 'base64' must come before the comma - const isBase64 = val.lastIndexOf('base64', commaI) !== -1 - const content = val.slice(commaI + 1) - setSource(this, Buffer.from(content, isBase64 ? 'base64' : 'utf8'), val); - } else if (/^\s*https?:\/\//.test(val)) { // remote URL - const onerror = err => { - if (typeof this.onerror === 'function') { - this.onerror(err) - } else { - throw err - } - } - - if (!get) get = require('simple-get'); - - get.concat(val, (err, res, data) => { - if (err) return onerror(err) - - if (res.statusCode < 200 || res.statusCode >= 300) { - return onerror(new Error(`Server responded with ${res.statusCode}`)) - } - - setSource(this, data) - }) - } else { // local file path assumed - setSource(this, val); - } - } else if (Buffer.isBuffer(val)) { - setSource(this, val); - } - }, - - get() { - // TODO https://github.com/Automattic/node-canvas/issues/118 - return getSource(this); - }, - - configurable: true -}); - -// TODO || is for Node.js pre-v6.6.0 -Image.prototype[util.inspect.custom || 'inspect'] = function(){ - return '[Image' - + (this.complete ? ':' + this.width + 'x' + this.height : '') - + (this.src ? ' ' + this.src : '') - + (this.complete ? ' complete' : '') - + ']'; -}; - -function getSource(img){ - return img._originalSource || GetSource.call(img); -} - -function setSource(img, src, origSrc){ - SetSource.call(img, src); - img._originalSource = origSrc; -} diff --git a/node_modules/canvas/lib/jpegstream.js b/node_modules/canvas/lib/jpegstream.js deleted file mode 100644 index a057d89..0000000 --- a/node_modules/canvas/lib/jpegstream.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -/*! - * Canvas - JPEGStream - * Copyright (c) 2010 LearnBoost - * MIT Licensed - */ - -var Readable = require('stream').Readable; -var util = require('util'); - -var JPEGStream = module.exports = function JPEGStream(canvas, options) { - if (!(this instanceof JPEGStream)) { - throw new TypeError("Class constructors cannot be invoked without 'new'"); - } - - if (canvas.streamJPEGSync === undefined) { - throw new Error("node-canvas was built without JPEG support."); - } - - Readable.call(this); - - this.options = options; - this.canvas = canvas; -}; - -util.inherits(JPEGStream, Readable); - -function noop() {} - -JPEGStream.prototype._read = function _read() { - // For now we're not controlling the c++ code's data emission, so we only - // call canvas.streamJPEGSync once and let it emit data at will. - this._read = noop; - var self = this; - self.canvas.streamJPEGSync(this.options, function(err, chunk){ - if (err) { - self.emit('error', err); - } else if (chunk) { - self.push(chunk); - } else { - self.push(null); - } - }); -}; diff --git a/node_modules/canvas/lib/parse-font.js b/node_modules/canvas/lib/parse-font.js deleted file mode 100644 index ce03529..0000000 --- a/node_modules/canvas/lib/parse-font.js +++ /dev/null @@ -1,102 +0,0 @@ -'use strict' - -/** - * Font RegExp helpers. - */ - -const weights = 'bold|bolder|lighter|[1-9]00' - , styles = 'italic|oblique' - , variants = 'small-caps' - , stretches = 'ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded' - , units = 'px|pt|pc|in|cm|mm|%|em|ex|ch|rem|q' - , string = '\'([^\']+)\'|"([^"]+)"|[\\w\\s-]+' - -// [ [ <‘font-style’> || || <‘font-weight’> || <‘font-stretch’> ]? -// <‘font-size’> [ / <‘line-height’> ]? <‘font-family’> ] -// https://drafts.csswg.org/css-fonts-3/#font-prop -const weightRe = new RegExp('(' + weights + ') +', 'i') -const styleRe = new RegExp('(' + styles + ') +', 'i') -const variantRe = new RegExp('(' + variants + ') +', 'i') -const stretchRe = new RegExp('(' + stretches + ') +', 'i') -const sizeFamilyRe = new RegExp( - '([\\d\\.]+)(' + units + ') *' - + '((?:' + string + ')( *, *(?:' + string + '))*)') - -/** - * Cache font parsing. - */ - -const cache = {} - -const defaultHeight = 16 // pt, common browser default - -/** - * Parse font `str`. - * - * @param {String} str - * @return {Object} Parsed font. `size` is in device units. `unit` is the unit - * appearing in the input string. - * @api private - */ - -module.exports = function (str) { - // Cached - if (cache[str]) return cache[str] - - // Try for required properties first. - const sizeFamily = sizeFamilyRe.exec(str) - if (!sizeFamily) return // invalid - - // Default values and required properties - const font = { - weight: 'normal', - style: 'normal', - stretch: 'normal', - variant: 'normal', - size: parseFloat(sizeFamily[1]), - unit: sizeFamily[2], - family: sizeFamily[3].replace(/["']/g, '').replace(/ *, */g, ',') - } - - // Optional, unordered properties. - let weight, style, variant, stretch - // Stop search at `sizeFamily.index` - let substr = str.substring(0, sizeFamily.index) - if ((weight = weightRe.exec(substr))) font.weight = weight[1] - if ((style = styleRe.exec(substr))) font.style = style[1] - if ((variant = variantRe.exec(substr))) font.variant = variant[1] - if ((stretch = stretchRe.exec(substr))) font.stretch = stretch[1] - - // Convert to device units. (`font.unit` is the original unit) - // TODO: ch, ex - switch (font.unit) { - case 'pt': - font.size /= 0.75 - break - case 'pc': - font.size *= 16 - break - case 'in': - font.size *= 96 - break - case 'cm': - font.size *= 96.0 / 2.54 - break - case 'mm': - font.size *= 96.0 / 25.4 - break - case '%': - // TODO disabled because existing unit tests assume 100 - // font.size *= defaultHeight / 100 / 0.75 - break - case 'em': - case 'rem': - font.size *= defaultHeight / 0.75 - break - case 'q': - font.size *= 96 / 25.4 / 4 - break - } - - return (cache[str] = font) -} diff --git a/node_modules/canvas/lib/pdfstream.js b/node_modules/canvas/lib/pdfstream.js deleted file mode 100644 index 6aeec53..0000000 --- a/node_modules/canvas/lib/pdfstream.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -/*! - * Canvas - PDFStream - */ - -var Readable = require('stream').Readable; -var util = require('util'); - -var PDFStream = module.exports = function PDFStream(canvas, options) { - if (!(this instanceof PDFStream)) { - throw new TypeError("Class constructors cannot be invoked without 'new'"); - } - - Readable.call(this); - - this.canvas = canvas; - this.options = options; -}; - -util.inherits(PDFStream, Readable); - -function noop() {} - -PDFStream.prototype._read = function _read() { - // For now we're not controlling the c++ code's data emission, so we only - // call canvas.streamPDFSync once and let it emit data at will. - this._read = noop; - var self = this; - self.canvas.streamPDFSync(function(err, chunk, len){ - if (err) { - self.emit('error', err); - } else if (len) { - self.push(chunk); - } else { - self.push(null); - } - }, this.options); -}; diff --git a/node_modules/canvas/lib/pngstream.js b/node_modules/canvas/lib/pngstream.js deleted file mode 100644 index 021bb7f..0000000 --- a/node_modules/canvas/lib/pngstream.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -/*! - * Canvas - PNGStream - * Copyright (c) 2010 LearnBoost - * MIT Licensed - */ - -var Readable = require('stream').Readable; -var util = require('util'); - -var PNGStream = module.exports = function PNGStream(canvas, options) { - if (!(this instanceof PNGStream)) { - throw new TypeError("Class constructors cannot be invoked without 'new'"); - } - - Readable.call(this); - - if (options && - options.palette instanceof Uint8ClampedArray && - options.palette.length % 4 !== 0) { - throw new Error("Palette length must be a multiple of 4."); - } - this.canvas = canvas; - this.options = options || {}; -}; - -util.inherits(PNGStream, Readable); - -function noop() {} - -PNGStream.prototype._read = function _read() { - // For now we're not controlling the c++ code's data emission, so we only - // call canvas.streamPNGSync once and let it emit data at will. - this._read = noop; - var self = this; - self.canvas.streamPNGSync(function(err, chunk, len){ - if (err) { - self.emit('error', err); - } else if (len) { - self.push(chunk); - } else { - self.push(null); - } - }, self.options); -}; diff --git a/node_modules/canvas/package.json b/node_modules/canvas/package.json deleted file mode 100644 index f93abe1..0000000 --- a/node_modules/canvas/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "_from": "canvas", - "_id": "canvas@2.6.1", - "_inBundle": false, - "_integrity": "sha512-S98rKsPcuhfTcYbtF53UIJhcbgIAK533d1kJKMwsMwAIFgfd58MOyxRud3kktlzWiEkFliaJtvyZCBtud/XVEA==", - "_location": "/canvas", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "canvas", - "name": "canvas", - "escapedName": "canvas", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/", - "/vega-cli" - ], - "_resolved": "https://registry.npmjs.org/canvas/-/canvas-2.6.1.tgz", - "_shasum": "0d087dd4d60f5a5a9efa202757270abea8bef89e", - "_spec": "canvas", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@learnboost.com" - }, - "binary": { - "module_name": "canvas", - "module_path": "build/Release", - "host": "https://github.com/node-gfx/node-canvas-prebuilt/releases/download/", - "remote_path": "v{version}", - "package_name": "{module_name}-v{version}-{node_abi}-{platform}-{libc}-{arch}.tar.gz" - }, - "browser": "browser.js", - "bugs": { - "url": "https://github.com/Automattic/node-canvas/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net" - }, - { - "name": "Rod Vagg", - "email": "r@va.gg" - }, - { - "name": "Juriy Zaytsev", - "email": "kangax@gmail.com" - } - ], - "dependencies": { - "nan": "^2.14.0", - "node-pre-gyp": "^0.11.0", - "simple-get": "^3.0.3" - }, - "deprecated": false, - "description": "Canvas graphics API backed by Cairo", - "devDependencies": { - "@types/node": "^10.12.18", - "assert-rejects": "^1.0.0", - "dtslint": "^0.5.3", - "express": "^4.16.3", - "mocha": "^5.2.0", - "pixelmatch": "^4.0.2", - "standard": "^12.0.1" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "binding.gyp", - "lib/", - "src/", - "util/", - "types/index.d.ts" - ], - "homepage": "https://github.com/Automattic/node-canvas", - "keywords": [ - "canvas", - "graphic", - "graphics", - "pixman", - "cairo", - "image", - "images", - "pdf" - ], - "license": "MIT", - "main": "index.js", - "name": "canvas", - "repository": { - "type": "git", - "url": "git://github.com/Automattic/node-canvas.git" - }, - "scripts": { - "benchmark": "node benchmarks/run.js", - "dtslint": "dtslint types", - "install": "node-pre-gyp install --fallback-to-build", - "prebenchmark": "node-gyp build", - "pretest": "standard examples/*.js test/server.js test/public/*.js benchmarks/run.js lib/context2d.js util/has_lib.js browser.js index.js && node-gyp build", - "pretest-server": "node-gyp build", - "test": "mocha test/*.test.js", - "test-server": "node test/server.js" - }, - "types": "types/index.d.ts", - "version": "2.6.1" -} diff --git a/node_modules/canvas/src/Backends.cc b/node_modules/canvas/src/Backends.cc deleted file mode 100644 index 2256c32..0000000 --- a/node_modules/canvas/src/Backends.cc +++ /dev/null @@ -1,18 +0,0 @@ -#include "Backends.h" - -#include "backend/ImageBackend.h" -#include "backend/PdfBackend.h" -#include "backend/SvgBackend.h" - -using namespace v8; - -void Backends::Initialize(Local target) { - Nan::HandleScope scope; - - Local obj = Nan::New(); - ImageBackend::Initialize(obj); - PdfBackend::Initialize(obj); - SvgBackend::Initialize(obj); - - Nan::Set(target, Nan::New("Backends").ToLocalChecked(), obj).Check(); -} diff --git a/node_modules/canvas/src/Backends.h b/node_modules/canvas/src/Backends.h deleted file mode 100644 index dbea053..0000000 --- a/node_modules/canvas/src/Backends.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "backend/Backend.h" -#include -#include - -class Backends : public Nan::ObjectWrap { - public: - static void Initialize(v8::Local target); -}; diff --git a/node_modules/canvas/src/Canvas.cc b/node_modules/canvas/src/Canvas.cc deleted file mode 100644 index edeb2f4..0000000 --- a/node_modules/canvas/src/Canvas.cc +++ /dev/null @@ -1,935 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#include "Canvas.h" - -#include // std::min -#include -#include -#include -#include "CanvasRenderingContext2d.h" -#include "closure.h" -#include -#include -#include -#include -#include "PNG.h" -#include "register_font.h" -#include -#include -#include -#include -#include "Util.h" -#include -#include "node_buffer.h" - -#ifdef HAVE_JPEG -#include "JPEGStream.h" -#endif - -#include "backend/ImageBackend.h" -#include "backend/PdfBackend.h" -#include "backend/SvgBackend.h" - -#define GENERIC_FACE_ERROR \ - "The second argument to registerFont is required, and should be an object " \ - "with at least a family (string) and optionally weight (string/number) " \ - "and style (string)." - -using namespace v8; -using namespace std; - -Nan::Persistent Canvas::constructor; - -std::vector font_face_list; - -/* - * Initialize Canvas. - */ - -void -Canvas::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - Nan::HandleScope scope; - - // Constructor - Local ctor = Nan::New(Canvas::New); - constructor.Reset(ctor); - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("Canvas").ToLocalChecked()); - - // Prototype - Local proto = ctor->PrototypeTemplate(); - Nan::SetPrototypeMethod(ctor, "toBuffer", ToBuffer); - Nan::SetPrototypeMethod(ctor, "streamPNGSync", StreamPNGSync); - Nan::SetPrototypeMethod(ctor, "streamPDFSync", StreamPDFSync); -#ifdef HAVE_JPEG - Nan::SetPrototypeMethod(ctor, "streamJPEGSync", StreamJPEGSync); -#endif - SetProtoAccessor(proto, Nan::New("type").ToLocalChecked(), GetType, NULL, ctor); - SetProtoAccessor(proto, Nan::New("stride").ToLocalChecked(), GetStride, NULL, ctor); - SetProtoAccessor(proto, Nan::New("width").ToLocalChecked(), GetWidth, SetWidth, ctor); - SetProtoAccessor(proto, Nan::New("height").ToLocalChecked(), GetHeight, SetHeight, ctor); - - Nan::SetTemplate(proto, "PNG_NO_FILTERS", Nan::New(PNG_NO_FILTERS)); - Nan::SetTemplate(proto, "PNG_FILTER_NONE", Nan::New(PNG_FILTER_NONE)); - Nan::SetTemplate(proto, "PNG_FILTER_SUB", Nan::New(PNG_FILTER_SUB)); - Nan::SetTemplate(proto, "PNG_FILTER_UP", Nan::New(PNG_FILTER_UP)); - Nan::SetTemplate(proto, "PNG_FILTER_AVG", Nan::New(PNG_FILTER_AVG)); - Nan::SetTemplate(proto, "PNG_FILTER_PAETH", Nan::New(PNG_FILTER_PAETH)); - Nan::SetTemplate(proto, "PNG_ALL_FILTERS", Nan::New(PNG_ALL_FILTERS)); - - // Class methods - Nan::SetMethod(ctor, "_registerFont", RegisterFont); - - Local ctx = Nan::GetCurrentContext(); - Nan::Set(target, - Nan::New("Canvas").ToLocalChecked(), - ctor->GetFunction(ctx).ToLocalChecked()); -} - -/* - * Initialize a Canvas with the given width and height. - */ - -NAN_METHOD(Canvas::New) { - if (!info.IsConstructCall()) { - return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); - } - - Backend* backend = NULL; - if (info[0]->IsNumber()) { - int width = Nan::To(info[0]).FromMaybe(0), height = 0; - - if (info[1]->IsNumber()) height = Nan::To(info[1]).FromMaybe(0); - - if (info[2]->IsString()) { - if (0 == strcmp("pdf", *Nan::Utf8String(info[2]))) - backend = new PdfBackend(width, height); - else if (0 == strcmp("svg", *Nan::Utf8String(info[2]))) - backend = new SvgBackend(width, height); - else - backend = new ImageBackend(width, height); - } - else - backend = new ImageBackend(width, height); - } - else if (info[0]->IsObject()) { - if (Nan::New(ImageBackend::constructor)->HasInstance(info[0]) || - Nan::New(PdfBackend::constructor)->HasInstance(info[0]) || - Nan::New(SvgBackend::constructor)->HasInstance(info[0])) { - backend = Nan::ObjectWrap::Unwrap(Nan::To(info[0]).ToLocalChecked()); - }else{ - return Nan::ThrowTypeError("Invalid arguments"); - } - } - else { - backend = new ImageBackend(0, 0); - } - - if (!backend->isSurfaceValid()) { - delete backend; - return Nan::ThrowError(backend->getError()); - } - - Canvas* canvas = new Canvas(backend); - canvas->Wrap(info.This()); - - backend->setCanvas(canvas); - - info.GetReturnValue().Set(info.This()); -} - -/* - * Get type string. - */ - -NAN_GETTER(Canvas::GetType) { - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(canvas->backend()->getName()).ToLocalChecked()); -} - -/* - * Get stride. - */ -NAN_GETTER(Canvas::GetStride) { - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(canvas->stride())); -} - -/* - * Get width. - */ - -NAN_GETTER(Canvas::GetWidth) { - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(canvas->getWidth())); -} - -/* - * Set width. - */ - -NAN_SETTER(Canvas::SetWidth) { - if (value->IsNumber()) { - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.This()); - canvas->backend()->setWidth(Nan::To(value).FromMaybe(0)); - canvas->resurface(info.This()); - } -} - -/* - * Get height. - */ - -NAN_GETTER(Canvas::GetHeight) { - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(canvas->getHeight())); -} - -/* - * Set height. - */ - -NAN_SETTER(Canvas::SetHeight) { - if (value->IsNumber()) { - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.This()); - canvas->backend()->setHeight(Nan::To(value).FromMaybe(0)); - canvas->resurface(info.This()); - } -} - -/* - * EIO toBuffer callback. - */ - -void -Canvas::ToPngBufferAsync(uv_work_t *req) { - PngClosure* closure = static_cast(req->data); - - closure->status = canvas_write_to_png_stream( - closure->canvas->surface(), - PngClosure::writeVec, - closure); -} - -#ifdef HAVE_JPEG -void -Canvas::ToJpegBufferAsync(uv_work_t *req) { - JpegClosure* closure = static_cast(req->data); - write_to_jpeg_buffer(closure->canvas->surface(), closure); -} -#endif - -/* - * EIO after toBuffer callback. - */ - -void -Canvas::ToBufferAsyncAfter(uv_work_t *req) { - Nan::HandleScope scope; - Nan::AsyncResource async("canvas:ToBufferAsyncAfter"); - Closure* closure = static_cast(req->data); - delete req; - - if (closure->status) { - Local argv[1] = { Canvas::Error(closure->status) }; - closure->cb.Call(1, argv, &async); - } else { - Local buf = Nan::CopyBuffer((char*)&closure->vec[0], closure->vec.size()).ToLocalChecked(); - Local argv[2] = { Nan::Null(), buf }; - closure->cb.Call(sizeof argv / sizeof *argv, argv, &async); - } - - closure->canvas->Unref(); - delete closure; -} - -static void parsePNGArgs(Local arg, PngClosure& pngargs) { - if (arg->IsObject()) { - Local obj = Nan::To(arg).ToLocalChecked(); - - Local cLevel = Nan::Get(obj, Nan::New("compressionLevel").ToLocalChecked()).ToLocalChecked(); - if (cLevel->IsUint32()) { - uint32_t val = Nan::To(cLevel).FromMaybe(0); - // See quote below from spec section 4.12.5.5. - if (val <= 9) pngargs.compressionLevel = val; - } - - Local rez = Nan::Get(obj, Nan::New("resolution").ToLocalChecked()).ToLocalChecked(); - if (rez->IsUint32()) { - uint32_t val = Nan::To(rez).FromMaybe(0); - if (val > 0) pngargs.resolution = val; - } - - Local filters = Nan::Get(obj, Nan::New("filters").ToLocalChecked()).ToLocalChecked(); - if (filters->IsUint32()) pngargs.filters = Nan::To(filters).FromMaybe(0); - - Local palette = Nan::Get(obj, Nan::New("palette").ToLocalChecked()).ToLocalChecked(); - if (palette->IsUint8ClampedArray()) { - Local palette_ta = palette.As(); - pngargs.nPaletteColors = palette_ta->Length(); - if (pngargs.nPaletteColors % 4 != 0) { - throw "Palette length must be a multiple of 4."; - } - pngargs.nPaletteColors /= 4; - Nan::TypedArrayContents _paletteColors(palette_ta); - pngargs.palette = *_paletteColors; - // Optional background color index: - Local backgroundIndexVal = Nan::Get(obj, Nan::New("backgroundIndex").ToLocalChecked()).ToLocalChecked(); - if (backgroundIndexVal->IsUint32()) { - pngargs.backgroundIndex = static_cast(Nan::To(backgroundIndexVal).FromMaybe(0)); - } - } - } -} - -static void parseJPEGArgs(Local arg, JpegClosure& jpegargs) { - // "If Type(quality) is not Number, or if quality is outside that range, the - // user agent must use its default quality value, as if the quality argument - // had not been given." - 4.12.5.5 - if (arg->IsObject()) { - Local obj = Nan::To(arg).ToLocalChecked(); - - Local qual = Nan::Get(obj, Nan::New("quality").ToLocalChecked()).ToLocalChecked(); - if (qual->IsNumber()) { - double quality = Nan::To(qual).FromMaybe(0); - if (quality >= 0.0 && quality <= 1.0) { - jpegargs.quality = static_cast(100.0 * quality); - } - } - - Local chroma = Nan::Get(obj, Nan::New("chromaSubsampling").ToLocalChecked()).ToLocalChecked(); - if (chroma->IsBoolean()) { - bool subsample = Nan::To(chroma).FromMaybe(0); - jpegargs.chromaSubsampling = subsample ? 2 : 1; - } else if (chroma->IsNumber()) { - jpegargs.chromaSubsampling = Nan::To(chroma).FromMaybe(0); - } - - Local progressive = Nan::Get(obj, Nan::New("progressive").ToLocalChecked()).ToLocalChecked(); - if (!progressive->IsUndefined()) { - jpegargs.progressive = Nan::To(progressive).FromMaybe(0); - } - } -} - -static uint32_t getSafeBufSize(Canvas* canvas) { - // Don't allow the buffer size to exceed the size of the canvas (#674) - // TODO not sure if this is really correct, but it fixed #674 - return (std::min)(canvas->getWidth() * canvas->getHeight() * 4, static_cast(PAGE_SIZE)); -} - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 16, 0) - -static inline void setPdfMetaStr(cairo_surface_t* surf, Local opts, - cairo_pdf_metadata_t t, const char* pName) { - auto propName = Nan::New(pName).ToLocalChecked(); - auto propValue = Nan::Get(opts, propName).ToLocalChecked(); - if (propValue->IsString()) { - // (copies char data) - cairo_pdf_surface_set_metadata(surf, t, *Nan::Utf8String(propValue)); - } -} - -static inline void setPdfMetaDate(cairo_surface_t* surf, Local opts, - cairo_pdf_metadata_t t, const char* pName) { - auto propName = Nan::New(pName).ToLocalChecked(); - auto propValue = Nan::Get(opts, propName).ToLocalChecked(); - if (propValue->IsDate()) { - auto date = static_cast(propValue.As()->ValueOf() / 1000); // ms -> s - char buf[sizeof "2011-10-08T07:07:09Z"]; - strftime(buf, sizeof buf, "%FT%TZ", gmtime(&date)); - cairo_pdf_surface_set_metadata(surf, t, buf); - } -} - -static void setPdfMetadata(Canvas* canvas, Local opts) { - cairo_surface_t* surf = canvas->surface(); - - setPdfMetaStr(surf, opts, CAIRO_PDF_METADATA_TITLE, "title"); - setPdfMetaStr(surf, opts, CAIRO_PDF_METADATA_AUTHOR, "author"); - setPdfMetaStr(surf, opts, CAIRO_PDF_METADATA_SUBJECT, "subject"); - setPdfMetaStr(surf, opts, CAIRO_PDF_METADATA_KEYWORDS, "keywords"); - setPdfMetaStr(surf, opts, CAIRO_PDF_METADATA_CREATOR, "creator"); - setPdfMetaDate(surf, opts, CAIRO_PDF_METADATA_CREATE_DATE, "creationDate"); - setPdfMetaDate(surf, opts, CAIRO_PDF_METADATA_MOD_DATE, "modDate"); -} - -#endif // CAIRO 16+ - -/* - * Converts/encodes data to a Buffer. Async when a callback function is passed. - - * PDF canvases: - (any) => Buffer - ("application/pdf", config) => Buffer - - * SVG canvases: - (any) => Buffer - - * ARGB data: - ("raw") => Buffer - - * PNG-encoded - () => Buffer - (undefined|"image/png", {compressionLevel?: number, filter?: number}) => Buffer - ((err: null|Error, buffer) => any) - ((err: null|Error, buffer) => any, undefined|"image/png", {compressionLevel?: number, filter?: number}) - - * JPEG-encoded - ("image/jpeg") => Buffer - ("image/jpeg", {quality?: number, progressive?: Boolean, chromaSubsampling?: Boolean|number}) => Buffer - ((err: null|Error, buffer) => any, "image/jpeg") - ((err: null|Error, buffer) => any, "image/jpeg", {quality?: number, progressive?: Boolean, chromaSubsampling?: Boolean|number}) - */ - -NAN_METHOD(Canvas::ToBuffer) { - cairo_status_t status; - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.This()); - - // Vector canvases, sync only - const std::string name = canvas->backend()->getName(); - if (name == "pdf" || name == "svg") { - // mime type may be present, but it's not checked - PdfSvgClosure* closure; - if (name == "pdf") { - closure = static_cast(canvas->backend())->closure(); -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 16, 0) - if (info[1]->IsObject()) { // toBuffer("application/pdf", config) - setPdfMetadata(canvas, Nan::To(info[1]).ToLocalChecked()); - } -#endif // CAIRO 16+ - } else { - closure = static_cast(canvas->backend())->closure(); - } - - cairo_surface_finish(canvas->surface()); - Local buf = Nan::CopyBuffer((char*)&closure->vec[0], closure->vec.size()).ToLocalChecked(); - info.GetReturnValue().Set(buf); - return; - } - - // Raw ARGB data -- just a memcpy() - if (info[0]->StrictEquals(Nan::New("raw").ToLocalChecked())) { - cairo_surface_t *surface = canvas->surface(); - cairo_surface_flush(surface); - if (canvas->nBytes() > node::Buffer::kMaxLength) { - Nan::ThrowError("Data exceeds maximum buffer length."); - return; - } - const unsigned char *data = cairo_image_surface_get_data(surface); - Isolate* iso = Nan::GetCurrentContext()->GetIsolate(); - Local buf = node::Buffer::Copy(iso, reinterpret_cast(data), canvas->nBytes()).ToLocalChecked(); - info.GetReturnValue().Set(buf); - return; - } - - // Sync PNG, default - if (info[0]->IsUndefined() || info[0]->StrictEquals(Nan::New("image/png").ToLocalChecked())) { - try { - PngClosure closure(canvas); - parsePNGArgs(info[1], closure); - if (closure.nPaletteColors == 0xFFFFFFFF) { - Nan::ThrowError("Palette length must be a multiple of 4."); - return; - } - - Nan::TryCatch try_catch; - status = canvas_write_to_png_stream(canvas->surface(), PngClosure::writeVec, &closure); - - if (try_catch.HasCaught()) { - try_catch.ReThrow(); - } else if (status) { - throw status; - } else { - // TODO it's possible to avoid this copy - Local buf = Nan::CopyBuffer((char *)&closure.vec[0], closure.vec.size()).ToLocalChecked(); - info.GetReturnValue().Set(buf); - } - } catch (cairo_status_t ex) { - Nan::ThrowError(Canvas::Error(ex)); - } catch (const char* ex) { - Nan::ThrowError(ex); - } - return; - } - - // Async PNG - if (info[0]->IsFunction() && - (info[1]->IsUndefined() || info[1]->StrictEquals(Nan::New("image/png").ToLocalChecked()))) { - - PngClosure* closure; - try { - closure = new PngClosure(canvas); - parsePNGArgs(info[2], *closure); - } catch (cairo_status_t ex) { - Nan::ThrowError(Canvas::Error(ex)); - return; - } catch (const char* ex) { - Nan::ThrowError(ex); - return; - } - - canvas->Ref(); - closure->cb.Reset(info[0].As()); - - uv_work_t* req = new uv_work_t; - req->data = closure; - // Make sure the surface exists since we won't have an isolate context in the async block: - canvas->surface(); - uv_queue_work(uv_default_loop(), req, ToPngBufferAsync, (uv_after_work_cb)ToBufferAsyncAfter); - - return; - } - -#ifdef HAVE_JPEG - // Sync JPEG - Local jpegStr = Nan::New("image/jpeg").ToLocalChecked(); - if (info[0]->StrictEquals(jpegStr)) { - try { - JpegClosure closure(canvas); - parseJPEGArgs(info[1], closure); - - Nan::TryCatch try_catch; - write_to_jpeg_buffer(canvas->surface(), &closure); - - if (try_catch.HasCaught()) { - try_catch.ReThrow(); - } else { - // TODO it's possible to avoid this copy. - Local buf = Nan::CopyBuffer((char *)&closure.vec[0], closure.vec.size()).ToLocalChecked(); - info.GetReturnValue().Set(buf); - } - } catch (cairo_status_t ex) { - Nan::ThrowError(Canvas::Error(ex)); - } - return; - } - - // Async JPEG - if (info[0]->IsFunction() && info[1]->StrictEquals(jpegStr)) { - JpegClosure* closure = new JpegClosure(canvas); - parseJPEGArgs(info[2], *closure); - - canvas->Ref(); - closure->cb.Reset(info[0].As()); - - uv_work_t* req = new uv_work_t; - req->data = closure; - // Make sure the surface exists since we won't have an isolate context in the async block: - canvas->surface(); - uv_queue_work(uv_default_loop(), req, ToJpegBufferAsync, (uv_after_work_cb)ToBufferAsyncAfter); - - return; - } -#endif -} - -/* - * Canvas::StreamPNG callback. - */ - -static cairo_status_t -streamPNG(void *c, const uint8_t *data, unsigned len) { - Nan::HandleScope scope; - Nan::AsyncResource async("canvas:StreamPNG"); - PngClosure* closure = (PngClosure*) c; - Local buf = Nan::CopyBuffer((char *)data, len).ToLocalChecked(); - Local argv[3] = { - Nan::Null() - , buf - , Nan::New(len) }; - closure->cb.Call(sizeof argv / sizeof *argv, argv, &async); - return CAIRO_STATUS_SUCCESS; -} - -/* - * Stream PNG data synchronously. TODO async - * StreamPngSync(this, options: {palette?: Uint8ClampedArray, backgroundIndex?: uint32, compressionLevel: uint32, filters: uint32}) - */ - -NAN_METHOD(Canvas::StreamPNGSync) { - if (!info[0]->IsFunction()) - return Nan::ThrowTypeError("callback function required"); - - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.This()); - - PngClosure closure(canvas); - parsePNGArgs(info[1], closure); - - closure.cb.Reset(Local::Cast(info[0])); - - Nan::TryCatch try_catch; - - cairo_status_t status = canvas_write_to_png_stream(canvas->surface(), streamPNG, &closure); - - if (try_catch.HasCaught()) { - try_catch.ReThrow(); - return; - } else if (status) { - Local argv[1] = { Canvas::Error(status) }; - Nan::Call(closure.cb, Nan::GetCurrentContext()->Global(), sizeof argv / sizeof *argv, argv); - } else { - Local argv[3] = { - Nan::Null() - , Nan::Null() - , Nan::New(0) }; - Nan::Call(closure.cb, Nan::GetCurrentContext()->Global(), sizeof argv / sizeof *argv, argv); - } - return; -} - - -struct PdfStreamInfo { - Local fn; - uint32_t len; - uint8_t* data; -}; - - -/* - * Canvas::StreamPDF FreeCallback - */ - -void stream_pdf_free(char *, void *) {} - -/* - * Canvas::StreamPDF callback. - */ - -static cairo_status_t -streamPDF(void *c, const uint8_t *data, unsigned len) { - Nan::HandleScope scope; - Nan::AsyncResource async("canvas:StreamPDF"); - PdfStreamInfo* streaminfo = static_cast(c); - Local buf = Nan::NewBuffer(const_cast(reinterpret_cast(data)), len, stream_pdf_free, 0).ToLocalChecked(); - Local argv[3] = { - Nan::Null() - , buf - , Nan::New(len) }; - async.runInAsyncScope(Nan::GetCurrentContext()->Global(), streaminfo->fn, sizeof argv / sizeof *argv, argv); - return CAIRO_STATUS_SUCCESS; -} - - -cairo_status_t canvas_write_to_pdf_stream(cairo_surface_t *surface, cairo_write_func_t write_func, PdfStreamInfo* streaminfo) { - size_t whole_chunks = streaminfo->len / PAGE_SIZE; - size_t remainder = streaminfo->len - whole_chunks * PAGE_SIZE; - - for (size_t i = 0; i < whole_chunks; ++i) { - write_func(streaminfo, &streaminfo->data[i * PAGE_SIZE], PAGE_SIZE); - } - - if (remainder) { - write_func(streaminfo, &streaminfo->data[whole_chunks * PAGE_SIZE], remainder); - } - - return CAIRO_STATUS_SUCCESS; -} - -/* - * Stream PDF data synchronously. - */ - -NAN_METHOD(Canvas::StreamPDFSync) { - if (!info[0]->IsFunction()) - return Nan::ThrowTypeError("callback function required"); - - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.Holder()); - - if (canvas->backend()->getName() != "pdf") - return Nan::ThrowTypeError("wrong canvas type"); - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 16, 0) - if (info[1]->IsObject()) { - setPdfMetadata(canvas, Nan::To(info[1]).ToLocalChecked()); - } -#endif - - cairo_surface_finish(canvas->surface()); - - PdfSvgClosure* closure = static_cast(canvas->backend())->closure(); - Local fn = info[0].As(); - PdfStreamInfo streaminfo; - streaminfo.fn = fn; - streaminfo.data = &closure->vec[0]; - streaminfo.len = closure->vec.size(); - - Nan::TryCatch try_catch; - - cairo_status_t status = canvas_write_to_pdf_stream(canvas->surface(), streamPDF, &streaminfo); - - if (try_catch.HasCaught()) { - try_catch.ReThrow(); - } else if (status) { - Local error = Canvas::Error(status); - Nan::Call(fn, Nan::GetCurrentContext()->Global(), 1, &error); - } else { - Local argv[3] = { - Nan::Null() - , Nan::Null() - , Nan::New(0) }; - Nan::Call(fn, Nan::GetCurrentContext()->Global(), sizeof argv / sizeof *argv, argv); - } -} - -/* - * Stream JPEG data synchronously. - */ - -#ifdef HAVE_JPEG - -NAN_METHOD(Canvas::StreamJPEGSync) { - if (!info[1]->IsFunction()) - return Nan::ThrowTypeError("callback function required"); - - Canvas *canvas = Nan::ObjectWrap::Unwrap(info.This()); - JpegClosure closure(canvas); - parseJPEGArgs(info[0], closure); - closure.cb.Reset(Local::Cast(info[1])); - - Nan::TryCatch try_catch; - uint32_t bufsize = getSafeBufSize(canvas); - write_to_jpeg_stream(canvas->surface(), bufsize, &closure); - - if (try_catch.HasCaught()) { - try_catch.ReThrow(); - } - return; -} - -#endif - -char * -str_value(Local val, const char *fallback, bool can_be_number) { - if (val->IsString() || (can_be_number && val->IsNumber())) { - return g_strdup(*Nan::Utf8String(val)); - } else if (fallback) { - return g_strdup(fallback); - } else { - return NULL; - } -} - -NAN_METHOD(Canvas::RegisterFont) { - if (!info[0]->IsString()) { - return Nan::ThrowError("Wrong argument type"); - } else if (!info[1]->IsObject()) { - return Nan::ThrowError(GENERIC_FACE_ERROR); - } - - Nan::Utf8String filePath(info[0]); - PangoFontDescription *sys_desc = get_pango_font_description((unsigned char *) *filePath); - - if (!sys_desc) return Nan::ThrowError("Could not parse font file"); - - PangoFontDescription *user_desc = pango_font_description_new(); - - // now check the attrs, there are many ways to be wrong - Local js_user_desc = Nan::To(info[1]).ToLocalChecked(); - Local family_prop = Nan::New("family").ToLocalChecked(); - Local weight_prop = Nan::New("weight").ToLocalChecked(); - Local style_prop = Nan::New("style").ToLocalChecked(); - - char *family = str_value(Nan::Get(js_user_desc, family_prop).ToLocalChecked(), NULL, false); - char *weight = str_value(Nan::Get(js_user_desc, weight_prop).ToLocalChecked(), "normal", true); - char *style = str_value(Nan::Get(js_user_desc, style_prop).ToLocalChecked(), "normal", false); - - if (family && weight && style) { - pango_font_description_set_weight(user_desc, Canvas::GetWeightFromCSSString(weight)); - pango_font_description_set_style(user_desc, Canvas::GetStyleFromCSSString(style)); - pango_font_description_set_family(user_desc, family); - - auto found = std::find_if(font_face_list.begin(), font_face_list.end(), [&](FontFace& f) { - return pango_font_description_equal(f.sys_desc, sys_desc); - }); - - if (found != font_face_list.end()) { - pango_font_description_free(found->user_desc); - found->user_desc = user_desc; - } else if (register_font((unsigned char *) *filePath)) { - FontFace face; - face.user_desc = user_desc; - face.sys_desc = sys_desc; - font_face_list.push_back(face); - } else { - pango_font_description_free(user_desc); - Nan::ThrowError("Could not load font to the system's font host"); - } - } else { - pango_font_description_free(user_desc); - Nan::ThrowError(GENERIC_FACE_ERROR); - } - - g_free(family); - g_free(weight); - g_free(style); -} - -/* - * Initialize cairo surface. - */ - -Canvas::Canvas(Backend* backend) : ObjectWrap() { - _backend = backend; -} - -/* - * Destroy cairo surface. - */ - -Canvas::~Canvas() { - if (_backend != NULL) { - delete _backend; - } -} - -/* - * Get a PangoStyle from a CSS string (like "italic") - */ - -PangoStyle -Canvas::GetStyleFromCSSString(const char *style) { - PangoStyle s = PANGO_STYLE_NORMAL; - - if (strlen(style) > 0) { - if (0 == strcmp("italic", style)) { - s = PANGO_STYLE_ITALIC; - } else if (0 == strcmp("oblique", style)) { - s = PANGO_STYLE_OBLIQUE; - } - } - - return s; -} - -/* - * Get a PangoWeight from a CSS string ("bold", "100", etc) - */ - -PangoWeight -Canvas::GetWeightFromCSSString(const char *weight) { - PangoWeight w = PANGO_WEIGHT_NORMAL; - - if (strlen(weight) > 0) { - if (0 == strcmp("bold", weight)) { - w = PANGO_WEIGHT_BOLD; - } else if (0 == strcmp("100", weight)) { - w = PANGO_WEIGHT_THIN; - } else if (0 == strcmp("200", weight)) { - w = PANGO_WEIGHT_ULTRALIGHT; - } else if (0 == strcmp("300", weight)) { - w = PANGO_WEIGHT_LIGHT; - } else if (0 == strcmp("400", weight)) { - w = PANGO_WEIGHT_NORMAL; - } else if (0 == strcmp("500", weight)) { - w = PANGO_WEIGHT_MEDIUM; - } else if (0 == strcmp("600", weight)) { - w = PANGO_WEIGHT_SEMIBOLD; - } else if (0 == strcmp("700", weight)) { - w = PANGO_WEIGHT_BOLD; - } else if (0 == strcmp("800", weight)) { - w = PANGO_WEIGHT_ULTRABOLD; - } else if (0 == strcmp("900", weight)) { - w = PANGO_WEIGHT_HEAVY; - } - } - - return w; -} - -bool streq_casein(std::string& str1, std::string& str2) { - return str1.size() == str2.size() && std::equal(str1.begin(), str1.end(), str2.begin(), [](char& c1, char& c2) { - return c1 == c2 || std::toupper(c1) == std::toupper(c2); - }); -} - -/* - * Given a user description, return a description that will select the - * font either from the system or @font-face - */ - -PangoFontDescription * -Canvas::ResolveFontDescription(const PangoFontDescription *desc) { - // One of the user-specified families could map to multiple SFNT family names - // if someone registered two different fonts under the same family name. - // https://drafts.csswg.org/css-fonts-3/#font-style-matching - FontFace best; - istringstream families(pango_font_description_get_family(desc)); - unordered_set seen_families; - string resolved_families; - bool first = true; - - for (string family; getline(families, family, ','); ) { - string renamed_families; - for (auto& ff : font_face_list) { - string pangofamily = string(pango_font_description_get_family(ff.user_desc)); - if (streq_casein(family, pangofamily)) { - const char* sys_desc_family_name = pango_font_description_get_family(ff.sys_desc); - bool unseen = seen_families.find(sys_desc_family_name) == seen_families.end(); - - // Avoid sending duplicate SFNT font names due to a bug in Pango for macOS: - // https://bugzilla.gnome.org/show_bug.cgi?id=762873 - if (unseen) { - seen_families.insert(sys_desc_family_name); - if (renamed_families.size()) renamed_families += ','; - renamed_families += sys_desc_family_name; - } - - if (first && (best.user_desc == nullptr || pango_font_description_better_match(desc, best.user_desc, ff.user_desc))) { - best = ff; - } - } - } - - if (resolved_families.size()) resolved_families += ','; - resolved_families += renamed_families.size() ? renamed_families : family; - first = false; - } - - PangoFontDescription* ret = pango_font_description_copy(best.sys_desc ? best.sys_desc : desc); - pango_font_description_set_family(ret, resolved_families.c_str()); - - return ret; -} - -/* - * Re-alloc the surface, destroying the previous. - */ - -void -Canvas::resurface(Local canvas) { - Nan::HandleScope scope; - Local context; - - backend()->recreateSurface(); - - // Reset context - context = Nan::Get(canvas, Nan::New("context").ToLocalChecked()).ToLocalChecked(); - if (!context->IsUndefined()) { - Context2d *context2d = ObjectWrap::Unwrap(Nan::To(context).ToLocalChecked()); - cairo_t *prev = context2d->context(); - context2d->setContext(createCairoContext()); - context2d->resetState(); - cairo_destroy(prev); - } -} - -/** - * Wrapper around cairo_create() - * (do not call cairo_create directly, call this instead) - */ -cairo_t* -Canvas::createCairoContext() { - cairo_t* ret = cairo_create(surface()); - cairo_set_line_width(ret, 1); // Cairo defaults to 2 - return ret; -} - -/* - * Construct an Error from the given cairo status. - */ - -Local -Canvas::Error(cairo_status_t status) { - return Exception::Error(Nan::New(cairo_status_to_string(status)).ToLocalChecked()); -} diff --git a/node_modules/canvas/src/Canvas.h b/node_modules/canvas/src/Canvas.h deleted file mode 100644 index c8d2db6..0000000 --- a/node_modules/canvas/src/Canvas.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#pragma once - -#include "backend/Backend.h" -#include -#include "dll_visibility.h" -#include -#include -#include -#include - -/* - * Maxmimum states per context. - * TODO: remove/resize - */ - -#ifndef CANVAS_MAX_STATES -#define CANVAS_MAX_STATES 64 -#endif - -/* - * FontFace describes a font file in terms of one PangoFontDescription that - * will resolve to it and one that the user describes it as (like @font-face) - */ -class FontFace { - public: - PangoFontDescription *sys_desc = nullptr; - PangoFontDescription *user_desc = nullptr; -}; - -/* - * Canvas. - */ - -class Canvas: public Nan::ObjectWrap { - public: - static Nan::Persistent constructor; - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(New); - static NAN_METHOD(ToBuffer); - static NAN_GETTER(GetType); - static NAN_GETTER(GetStride); - static NAN_GETTER(GetWidth); - static NAN_GETTER(GetHeight); - static NAN_SETTER(SetWidth); - static NAN_SETTER(SetHeight); - static NAN_METHOD(StreamPNGSync); - static NAN_METHOD(StreamPDFSync); - static NAN_METHOD(StreamJPEGSync); - static NAN_METHOD(RegisterFont); - static v8::Local Error(cairo_status_t status); - static void ToPngBufferAsync(uv_work_t *req); - static void ToJpegBufferAsync(uv_work_t *req); - static void ToBufferAsyncAfter(uv_work_t *req); - static PangoWeight GetWeightFromCSSString(const char *weight); - static PangoStyle GetStyleFromCSSString(const char *style); - static PangoFontDescription *ResolveFontDescription(const PangoFontDescription *desc); - - DLL_PUBLIC inline Backend* backend() { return _backend; } - DLL_PUBLIC inline cairo_surface_t* surface(){ return backend()->getSurface(); } - cairo_t* createCairoContext(); - - DLL_PUBLIC inline uint8_t *data(){ return cairo_image_surface_get_data(surface()); } - DLL_PUBLIC inline int stride(){ return cairo_image_surface_get_stride(surface()); } - DLL_PUBLIC inline int nBytes(){ return getHeight() * stride(); } - - DLL_PUBLIC inline int getWidth() { return backend()->getWidth(); } - DLL_PUBLIC inline int getHeight() { return backend()->getHeight(); } - - Canvas(Backend* backend); - void resurface(v8::Local canvas); - - private: - ~Canvas(); - Backend* _backend; -}; diff --git a/node_modules/canvas/src/CanvasError.h b/node_modules/canvas/src/CanvasError.h deleted file mode 100644 index cb751e3..0000000 --- a/node_modules/canvas/src/CanvasError.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include - -class CanvasError { - public: - std::string message; - std::string syscall; - std::string path; - int cerrno = 0; - void set(const char* iMessage = NULL, const char* iSyscall = NULL, int iErrno = 0, const char* iPath = NULL) { - if (iMessage) message.assign(iMessage); - if (iSyscall) syscall.assign(iSyscall); - cerrno = iErrno; - if (iPath) path.assign(iPath); - } - void reset() { - message.clear(); - syscall.clear(); - path.clear(); - cerrno = 0; - } -}; diff --git a/node_modules/canvas/src/CanvasGradient.cc b/node_modules/canvas/src/CanvasGradient.cc deleted file mode 100644 index 280fc2e..0000000 --- a/node_modules/canvas/src/CanvasGradient.cc +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#include "CanvasGradient.h" - -#include "Canvas.h" -#include "color.h" - -using namespace v8; - -Nan::Persistent Gradient::constructor; - -/* - * Initialize CanvasGradient. - */ - -void -Gradient::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - Nan::HandleScope scope; - - // Constructor - Local ctor = Nan::New(Gradient::New); - constructor.Reset(ctor); - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("CanvasGradient").ToLocalChecked()); - - // Prototype - Nan::SetPrototypeMethod(ctor, "addColorStop", AddColorStop); - Local ctx = Nan::GetCurrentContext(); - Nan::Set(target, - Nan::New("CanvasGradient").ToLocalChecked(), - ctor->GetFunction(ctx).ToLocalChecked()); -} - -/* - * Initialize a new CanvasGradient. - */ - -NAN_METHOD(Gradient::New) { - if (!info.IsConstructCall()) { - return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); - } - - // Linear - if (4 == info.Length()) { - Gradient *grad = new Gradient( - Nan::To(info[0]).FromMaybe(0) - , Nan::To(info[1]).FromMaybe(0) - , Nan::To(info[2]).FromMaybe(0) - , Nan::To(info[3]).FromMaybe(0)); - grad->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - return; - } - - // Radial - if (6 == info.Length()) { - Gradient *grad = new Gradient( - Nan::To(info[0]).FromMaybe(0) - , Nan::To(info[1]).FromMaybe(0) - , Nan::To(info[2]).FromMaybe(0) - , Nan::To(info[3]).FromMaybe(0) - , Nan::To(info[4]).FromMaybe(0) - , Nan::To(info[5]).FromMaybe(0)); - grad->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - return; - } - - return Nan::ThrowTypeError("invalid arguments"); -} - -/* - * Add color stop. - */ - -NAN_METHOD(Gradient::AddColorStop) { - if (!info[0]->IsNumber()) - return Nan::ThrowTypeError("offset required"); - if (!info[1]->IsString()) - return Nan::ThrowTypeError("color string required"); - - Gradient *grad = Nan::ObjectWrap::Unwrap(info.This()); - short ok; - Nan::Utf8String str(info[1]); - uint32_t rgba = rgba_from_string(*str, &ok); - - if (ok) { - rgba_t color = rgba_create(rgba); - cairo_pattern_add_color_stop_rgba( - grad->pattern() - , Nan::To(info[0]).FromMaybe(0) - , color.r - , color.g - , color.b - , color.a); - } else { - return Nan::ThrowTypeError("parse color failed"); - } -} - -/* - * Initialize linear gradient. - */ - -Gradient::Gradient(double x0, double y0, double x1, double y1) { - _pattern = cairo_pattern_create_linear(x0, y0, x1, y1); -} - -/* - * Initialize radial gradient. - */ - -Gradient::Gradient(double x0, double y0, double r0, double x1, double y1, double r1) { - _pattern = cairo_pattern_create_radial(x0, y0, r0, x1, y1, r1); -} - -/* - * Destroy the pattern. - */ - -Gradient::~Gradient() { - cairo_pattern_destroy(_pattern); -} diff --git a/node_modules/canvas/src/CanvasGradient.h b/node_modules/canvas/src/CanvasGradient.h deleted file mode 100644 index b6902c4..0000000 --- a/node_modules/canvas/src/CanvasGradient.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#pragma once - -#include -#include -#include - -class Gradient: public Nan::ObjectWrap { - public: - static Nan::Persistent constructor; - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(New); - static NAN_METHOD(AddColorStop); - Gradient(double x0, double y0, double x1, double y1); - Gradient(double x0, double y0, double r0, double x1, double y1, double r1); - inline cairo_pattern_t *pattern(){ return _pattern; } - - private: - ~Gradient(); - cairo_pattern_t *_pattern; -}; diff --git a/node_modules/canvas/src/CanvasPattern.cc b/node_modules/canvas/src/CanvasPattern.cc deleted file mode 100644 index a604412..0000000 --- a/node_modules/canvas/src/CanvasPattern.cc +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#include "CanvasPattern.h" - -#include "Canvas.h" -#include "Image.h" - -using namespace v8; - -const cairo_user_data_key_t *pattern_repeat_key; - -Nan::Persistent Pattern::constructor; - -/* - * Initialize CanvasPattern. - */ - -void -Pattern::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - Nan::HandleScope scope; - - // Constructor - Local ctor = Nan::New(Pattern::New); - constructor.Reset(ctor); - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("CanvasPattern").ToLocalChecked()); - - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("CanvasPattern").ToLocalChecked()); - - // Prototype - Local ctx = Nan::GetCurrentContext(); - Nan::Set(target, - Nan::New("CanvasPattern").ToLocalChecked(), - ctor->GetFunction(ctx).ToLocalChecked()); -} - -/* - * Initialize a new CanvasPattern. - */ - -NAN_METHOD(Pattern::New) { - if (!info.IsConstructCall()) { - return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); - } - - cairo_surface_t *surface; - - Local obj = Nan::To(info[0]).ToLocalChecked(); - - // Image - if (Nan::New(Image::constructor)->HasInstance(obj)) { - Image *img = Nan::ObjectWrap::Unwrap(obj); - if (!img->isComplete()) { - return Nan::ThrowError("Image given has not completed loading"); - } - surface = img->surface(); - - // Canvas - } else if (Nan::New(Canvas::constructor)->HasInstance(obj)) { - Canvas *canvas = Nan::ObjectWrap::Unwrap(obj); - surface = canvas->surface(); - // Invalid - } else { - return Nan::ThrowTypeError("Image or Canvas expected"); - } - repeat_type_t repeat = REPEAT; - if (0 == strcmp("no-repeat", *Nan::Utf8String(info[1]))) { - repeat = NO_REPEAT; - } else if (0 == strcmp("repeat-x", *Nan::Utf8String(info[1]))) { - repeat = REPEAT_X; - } else if (0 == strcmp("repeat-y", *Nan::Utf8String(info[1]))) { - repeat = REPEAT_Y; - } - Pattern *pattern = new Pattern(surface, repeat); - pattern->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); -} - -/* - * Initialize pattern. - */ - -Pattern::Pattern(cairo_surface_t *surface, repeat_type_t repeat) { - _pattern = cairo_pattern_create_for_surface(surface); - _repeat = repeat; - cairo_pattern_set_user_data(_pattern, pattern_repeat_key, &_repeat, NULL); -} - -repeat_type_t Pattern::get_repeat_type_for_cairo_pattern(cairo_pattern_t *pattern) { - void *ud = cairo_pattern_get_user_data(pattern, pattern_repeat_key); - return *reinterpret_cast(ud); -} - -/* - * Destroy the pattern. - */ - -Pattern::~Pattern() { - cairo_pattern_destroy(_pattern); -} diff --git a/node_modules/canvas/src/CanvasPattern.h b/node_modules/canvas/src/CanvasPattern.h deleted file mode 100644 index 4313a28..0000000 --- a/node_modules/canvas/src/CanvasPattern.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2011 LearnBoost - -#pragma once - -#include -#include -#include - -/* - * Canvas types. - */ - -typedef enum { - NO_REPEAT, // match CAIRO_EXTEND_NONE - REPEAT, // match CAIRO_EXTEND_REPEAT - REPEAT_X, // needs custom processing - REPEAT_Y // needs custom processing -} repeat_type_t; - -extern const cairo_user_data_key_t *pattern_repeat_key; - -class Pattern: public Nan::ObjectWrap { - public: - static Nan::Persistent constructor; - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(New); - static repeat_type_t get_repeat_type_for_cairo_pattern(cairo_pattern_t *pattern); - Pattern(cairo_surface_t *surface, repeat_type_t repeat); - inline cairo_pattern_t *pattern(){ return _pattern; } - private: - ~Pattern(); - cairo_pattern_t *_pattern; - repeat_type_t _repeat; -}; diff --git a/node_modules/canvas/src/CanvasRenderingContext2d.cc b/node_modules/canvas/src/CanvasRenderingContext2d.cc deleted file mode 100644 index e0bb7ce..0000000 --- a/node_modules/canvas/src/CanvasRenderingContext2d.cc +++ /dev/null @@ -1,3047 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#include "CanvasRenderingContext2d.h" - -#include -#include "backend/ImageBackend.h" -#include -#include "Canvas.h" -#include "CanvasGradient.h" -#include "CanvasPattern.h" -#include -#include -#include "Image.h" -#include "ImageData.h" -#include -#include -#include "Point.h" -#include -#include "Util.h" -#include - -using namespace v8; - -// Windows doesn't support the C99 names for these -#ifdef _MSC_VER -#define isnan(x) _isnan(x) -#define isinf(x) (!_finite(x)) -#endif - -#ifndef isnan -#define isnan(x) std::isnan(x) -#define isinf(x) std::isinf(x) -#endif - -Nan::Persistent Context2d::constructor; - -/* - * Rectangle arg assertions. - */ - -#define RECT_ARGS \ - double args[4]; \ - if(!checkArgs(info, args, 4)) \ - return; \ - double x = args[0]; \ - double y = args[1]; \ - double width = args[2]; \ - double height = args[3]; - -/* - * Text baselines. - */ - -enum { - TEXT_BASELINE_ALPHABETIC - , TEXT_BASELINE_TOP - , TEXT_BASELINE_BOTTOM - , TEXT_BASELINE_MIDDLE - , TEXT_BASELINE_IDEOGRAPHIC - , TEXT_BASELINE_HANGING -}; - -/* - * Simple helper macro for a rather verbose function call. - */ - -#define PANGO_LAYOUT_GET_METRICS(LAYOUT) pango_context_get_metrics( \ - pango_layout_get_context(LAYOUT), \ - pango_layout_get_font_description(LAYOUT), \ - pango_context_get_language(pango_layout_get_context(LAYOUT))) - -inline static bool checkArgs(const Nan::FunctionCallbackInfo &info, double *args, int argsNum, int offset = 0){ - int argsEnd = offset + argsNum; - bool areArgsValid = true; - - for (int i = offset; i < argsEnd; i++) { - double val = Nan::To(info[i]).FromMaybe(0); - - if (areArgsValid) { - if (val != val || - val == std::numeric_limits::infinity() || - val == -std::numeric_limits::infinity()) { - // We should continue the loop instead of returning immediately - // See https://html.spec.whatwg.org/multipage/canvas.html - - areArgsValid = false; - continue; - } - - args[i - offset] = val; - } - } - - return areArgsValid; -} - -Nan::Persistent Context2d::_DOMMatrix; -Nan::Persistent Context2d::_parseFont; - -/* - * Initialize Context2d. - */ - -void -Context2d::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - Nan::HandleScope scope; - - // Constructor - Local ctor = Nan::New(Context2d::New); - constructor.Reset(ctor); - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("CanvasRenderingContext2D").ToLocalChecked()); - - // Prototype - Local proto = ctor->PrototypeTemplate(); - Nan::SetPrototypeMethod(ctor, "drawImage", DrawImage); - Nan::SetPrototypeMethod(ctor, "putImageData", PutImageData); - Nan::SetPrototypeMethod(ctor, "getImageData", GetImageData); - Nan::SetPrototypeMethod(ctor, "createImageData", CreateImageData); - Nan::SetPrototypeMethod(ctor, "addPage", AddPage); - Nan::SetPrototypeMethod(ctor, "save", Save); - Nan::SetPrototypeMethod(ctor, "restore", Restore); - Nan::SetPrototypeMethod(ctor, "rotate", Rotate); - Nan::SetPrototypeMethod(ctor, "translate", Translate); - Nan::SetPrototypeMethod(ctor, "transform", Transform); - Nan::SetPrototypeMethod(ctor, "resetTransform", ResetTransform); - Nan::SetPrototypeMethod(ctor, "setTransform", SetTransform); - Nan::SetPrototypeMethod(ctor, "isPointInPath", IsPointInPath); - Nan::SetPrototypeMethod(ctor, "scale", Scale); - Nan::SetPrototypeMethod(ctor, "clip", Clip); - Nan::SetPrototypeMethod(ctor, "fill", Fill); - Nan::SetPrototypeMethod(ctor, "stroke", Stroke); - Nan::SetPrototypeMethod(ctor, "fillText", FillText); - Nan::SetPrototypeMethod(ctor, "strokeText", StrokeText); - Nan::SetPrototypeMethod(ctor, "fillRect", FillRect); - Nan::SetPrototypeMethod(ctor, "strokeRect", StrokeRect); - Nan::SetPrototypeMethod(ctor, "clearRect", ClearRect); - Nan::SetPrototypeMethod(ctor, "rect", Rect); - Nan::SetPrototypeMethod(ctor, "measureText", MeasureText); - Nan::SetPrototypeMethod(ctor, "moveTo", MoveTo); - Nan::SetPrototypeMethod(ctor, "lineTo", LineTo); - Nan::SetPrototypeMethod(ctor, "bezierCurveTo", BezierCurveTo); - Nan::SetPrototypeMethod(ctor, "quadraticCurveTo", QuadraticCurveTo); - Nan::SetPrototypeMethod(ctor, "beginPath", BeginPath); - Nan::SetPrototypeMethod(ctor, "closePath", ClosePath); - Nan::SetPrototypeMethod(ctor, "arc", Arc); - Nan::SetPrototypeMethod(ctor, "arcTo", ArcTo); - Nan::SetPrototypeMethod(ctor, "ellipse", Ellipse); - Nan::SetPrototypeMethod(ctor, "setLineDash", SetLineDash); - Nan::SetPrototypeMethod(ctor, "getLineDash", GetLineDash); - Nan::SetPrototypeMethod(ctor, "createPattern", CreatePattern); - Nan::SetPrototypeMethod(ctor, "createLinearGradient", CreateLinearGradient); - Nan::SetPrototypeMethod(ctor, "createRadialGradient", CreateRadialGradient); - SetProtoAccessor(proto, Nan::New("pixelFormat").ToLocalChecked(), GetFormat, NULL, ctor); - SetProtoAccessor(proto, Nan::New("patternQuality").ToLocalChecked(), GetPatternQuality, SetPatternQuality, ctor); - SetProtoAccessor(proto, Nan::New("imageSmoothingEnabled").ToLocalChecked(), GetImageSmoothingEnabled, SetImageSmoothingEnabled, ctor); - SetProtoAccessor(proto, Nan::New("globalCompositeOperation").ToLocalChecked(), GetGlobalCompositeOperation, SetGlobalCompositeOperation, ctor); - SetProtoAccessor(proto, Nan::New("globalAlpha").ToLocalChecked(), GetGlobalAlpha, SetGlobalAlpha, ctor); - SetProtoAccessor(proto, Nan::New("shadowColor").ToLocalChecked(), GetShadowColor, SetShadowColor, ctor); - SetProtoAccessor(proto, Nan::New("miterLimit").ToLocalChecked(), GetMiterLimit, SetMiterLimit, ctor); - SetProtoAccessor(proto, Nan::New("lineWidth").ToLocalChecked(), GetLineWidth, SetLineWidth, ctor); - SetProtoAccessor(proto, Nan::New("lineCap").ToLocalChecked(), GetLineCap, SetLineCap, ctor); - SetProtoAccessor(proto, Nan::New("lineJoin").ToLocalChecked(), GetLineJoin, SetLineJoin, ctor); - SetProtoAccessor(proto, Nan::New("lineDashOffset").ToLocalChecked(), GetLineDashOffset, SetLineDashOffset, ctor); - SetProtoAccessor(proto, Nan::New("shadowOffsetX").ToLocalChecked(), GetShadowOffsetX, SetShadowOffsetX, ctor); - SetProtoAccessor(proto, Nan::New("shadowOffsetY").ToLocalChecked(), GetShadowOffsetY, SetShadowOffsetY, ctor); - SetProtoAccessor(proto, Nan::New("shadowBlur").ToLocalChecked(), GetShadowBlur, SetShadowBlur, ctor); - SetProtoAccessor(proto, Nan::New("antialias").ToLocalChecked(), GetAntiAlias, SetAntiAlias, ctor); - SetProtoAccessor(proto, Nan::New("textDrawingMode").ToLocalChecked(), GetTextDrawingMode, SetTextDrawingMode, ctor); - SetProtoAccessor(proto, Nan::New("quality").ToLocalChecked(), GetQuality, SetQuality, ctor); - SetProtoAccessor(proto, Nan::New("currentTransform").ToLocalChecked(), GetCurrentTransform, SetCurrentTransform, ctor); - SetProtoAccessor(proto, Nan::New("fillStyle").ToLocalChecked(), GetFillStyle, SetFillStyle, ctor); - SetProtoAccessor(proto, Nan::New("strokeStyle").ToLocalChecked(), GetStrokeStyle, SetStrokeStyle, ctor); - SetProtoAccessor(proto, Nan::New("font").ToLocalChecked(), GetFont, SetFont, ctor); - SetProtoAccessor(proto, Nan::New("textBaseline").ToLocalChecked(), GetTextBaseline, SetTextBaseline, ctor); - SetProtoAccessor(proto, Nan::New("textAlign").ToLocalChecked(), GetTextAlign, SetTextAlign, ctor); - Local ctx = Nan::GetCurrentContext(); - Nan::Set(target, Nan::New("CanvasRenderingContext2d").ToLocalChecked(), ctor->GetFunction(ctx).ToLocalChecked()); - Nan::Set(target, Nan::New("CanvasRenderingContext2dInit").ToLocalChecked(), Nan::New(SaveExternalModules)); -} - -/* - * Create a cairo context. - */ - -Context2d::Context2d(Canvas *canvas) { - _canvas = canvas; - _context = canvas->createCairoContext(); - _layout = pango_cairo_create_layout(_context); - state = states[stateno = 0] = (canvas_state_t *) malloc(sizeof(canvas_state_t)); - - resetState(true); -} - -/* - * Destroy cairo context. - */ - -Context2d::~Context2d() { - while(stateno >= 0) { - pango_font_description_free(states[stateno]->fontDescription); - free(states[stateno--]); - } - g_object_unref(_layout); - cairo_destroy(_context); - _resetPersistentHandles(); -} - -/* - * Reset canvas state. - */ - -void Context2d::resetState(bool init) { - if (!init) { - pango_font_description_free(state->fontDescription); - } - - state->shadowBlur = 0; - state->shadowOffsetX = state->shadowOffsetY = 0; - state->globalAlpha = 1; - state->textAlignment = -1; - state->fillPattern = nullptr; - state->strokePattern = nullptr; - state->fillGradient = nullptr; - state->strokeGradient = nullptr; - state->textBaseline = TEXT_BASELINE_ALPHABETIC; - rgba_t transparent = { 0, 0, 0, 1 }; - rgba_t transparent_black = { 0, 0, 0, 0 }; - state->fill = transparent; - state->stroke = transparent; - state->shadow = transparent_black; - state->patternQuality = CAIRO_FILTER_GOOD; - state->imageSmoothingEnabled = true; - state->textDrawingMode = TEXT_DRAW_PATHS; - state->fontDescription = pango_font_description_from_string("sans serif"); - pango_font_description_set_absolute_size(state->fontDescription, 10 * PANGO_SCALE); - pango_layout_set_font_description(_layout, state->fontDescription); - - _resetPersistentHandles(); -} - -void Context2d::_resetPersistentHandles() { - _fillStyle.Reset(); - _strokeStyle.Reset(); - _font.Reset(); - _textBaseline.Reset(); - _textAlign.Reset(); -} - -/* - * Save cairo / canvas state. - */ - -void -Context2d::save() { - if (stateno < CANVAS_MAX_STATES) { - cairo_save(_context); - states[++stateno] = (canvas_state_t *) malloc(sizeof(canvas_state_t)); - memcpy(states[stateno], state, sizeof(canvas_state_t)); - states[stateno]->fontDescription = pango_font_description_copy(states[stateno-1]->fontDescription); - state = states[stateno]; - } -} - -/* - * Restore cairo / canvas state. - */ - -void -Context2d::restore() { - if (stateno > 0) { - cairo_restore(_context); - pango_font_description_free(states[stateno]->fontDescription); - free(states[stateno]); - states[stateno] = NULL; - state = states[--stateno]; - pango_layout_set_font_description(_layout, state->fontDescription); - } -} - -/* - * Save flat path. - */ - -void -Context2d::savePath() { - _path = cairo_copy_path_flat(_context); - cairo_new_path(_context); -} - -/* - * Restore flat path. - */ - -void -Context2d::restorePath() { - cairo_new_path(_context); - cairo_append_path(_context, _path); - cairo_path_destroy(_path); -} - -/* - * Create temporary surface for gradient or pattern transparency - */ -cairo_pattern_t* -create_transparent_gradient(cairo_pattern_t *source, float alpha) { - double x0; - double y0; - double x1; - double y1; - double r0; - double r1; - int count; - int i; - double offset; - double r; - double g; - double b; - double a; - cairo_pattern_t *newGradient; - cairo_pattern_type_t type = cairo_pattern_get_type(source); - cairo_pattern_get_color_stop_count(source, &count); - if (type == CAIRO_PATTERN_TYPE_LINEAR) { - cairo_pattern_get_linear_points (source, &x0, &y0, &x1, &y1); - newGradient = cairo_pattern_create_linear(x0, y0, x1, y1); - } else if (type == CAIRO_PATTERN_TYPE_RADIAL) { - cairo_pattern_get_radial_circles(source, &x0, &y0, &r0, &x1, &y1, &r1); - newGradient = cairo_pattern_create_radial(x0, y0, r0, x1, y1, r1); - } else { - Nan::ThrowError("Unexpected gradient type"); - return NULL; - } - for ( i = 0; i < count; i++ ) { - cairo_pattern_get_color_stop_rgba(source, i, &offset, &r, &g, &b, &a); - cairo_pattern_add_color_stop_rgba(newGradient, offset, r, g, b, a * alpha); - } - return newGradient; -} - -cairo_pattern_t* -create_transparent_pattern(cairo_pattern_t *source, float alpha) { - cairo_surface_t *surface; - cairo_pattern_get_surface(source, &surface); - int width = cairo_image_surface_get_width(surface); - int height = cairo_image_surface_get_height(surface); - cairo_surface_t *mask_surface = cairo_image_surface_create( - CAIRO_FORMAT_ARGB32, - width, - height); - cairo_t *mask_context = cairo_create(mask_surface); - if (cairo_status(mask_context) != CAIRO_STATUS_SUCCESS) { - Nan::ThrowError("Failed to initialize context"); - return NULL; - } - cairo_set_source(mask_context, source); - cairo_paint_with_alpha(mask_context, alpha); - cairo_destroy(mask_context); - cairo_pattern_t* newPattern = cairo_pattern_create_for_surface(mask_surface); - cairo_surface_destroy(mask_surface); - return newPattern; -} - -/* - * Fill and apply shadow. - */ - -void -Context2d::setFillRule(v8::Local value) { - cairo_fill_rule_t rule = CAIRO_FILL_RULE_WINDING; - if (value->IsString()) { - Nan::Utf8String str(value); - if (std::strcmp(*str, "evenodd") == 0) { - rule = CAIRO_FILL_RULE_EVEN_ODD; - } - } - cairo_set_fill_rule(_context, rule); -} - -void -Context2d::fill(bool preserve) { - cairo_pattern_t *new_pattern; - if (state->fillPattern) { - if (state->globalAlpha < 1) { - new_pattern = create_transparent_pattern(state->fillPattern, state->globalAlpha); - if (new_pattern == NULL) { - // failed to allocate; Nan::ThrowError has already been called, so return from this fn. - return; - } - cairo_set_source(_context, new_pattern); - cairo_pattern_destroy(new_pattern); - } else { - cairo_set_source(_context, state->fillPattern); - } - repeat_type_t repeat = Pattern::get_repeat_type_for_cairo_pattern(state->fillPattern); - if (NO_REPEAT == repeat) { - cairo_pattern_set_extend(cairo_get_source(_context), CAIRO_EXTEND_NONE); - } else { - cairo_pattern_set_extend(cairo_get_source(_context), CAIRO_EXTEND_REPEAT); - } - } else if (state->fillGradient) { - if (state->globalAlpha < 1) { - new_pattern = create_transparent_gradient(state->fillGradient, state->globalAlpha); - if (new_pattern == NULL) { - // failed to recognize gradient; Nan::ThrowError has already been called, so return from this fn. - return; - } - cairo_pattern_set_filter(new_pattern, state->patternQuality); - cairo_set_source(_context, new_pattern); - cairo_pattern_destroy(new_pattern); - } else { - cairo_pattern_set_filter(state->fillGradient, state->patternQuality); - cairo_set_source(_context, state->fillGradient); - } - } else { - setSourceRGBA(state->fill); - } - if (preserve) { - hasShadow() - ? shadow(cairo_fill_preserve) - : cairo_fill_preserve(_context); - } else { - hasShadow() - ? shadow(cairo_fill) - : cairo_fill(_context); - } -} - -/* - * Stroke and apply shadow. - */ - -void -Context2d::stroke(bool preserve) { - cairo_pattern_t *new_pattern; - if (state->strokePattern) { - if (state->globalAlpha < 1) { - new_pattern = create_transparent_pattern(state->strokePattern, state->globalAlpha); - if (new_pattern == NULL) { - // failed to allocate; Nan::ThrowError has already been called, so return from this fn. - return; - } - cairo_set_source(_context, new_pattern); - cairo_pattern_destroy(new_pattern); - } else { - cairo_set_source(_context, state->strokePattern); - } - repeat_type_t repeat = Pattern::get_repeat_type_for_cairo_pattern(state->strokePattern); - if (NO_REPEAT == repeat) { - cairo_pattern_set_extend(cairo_get_source(_context), CAIRO_EXTEND_NONE); - } else { - cairo_pattern_set_extend(cairo_get_source(_context), CAIRO_EXTEND_REPEAT); - } - } else if (state->strokeGradient) { - if (state->globalAlpha < 1) { - new_pattern = create_transparent_gradient(state->strokeGradient, state->globalAlpha); - if (new_pattern == NULL) { - // failed to recognize gradient; Nan::ThrowError has already been called, so return from this fn. - return; - } - cairo_pattern_set_filter(new_pattern, state->patternQuality); - cairo_set_source(_context, new_pattern); - cairo_pattern_destroy(new_pattern); - } else { - cairo_pattern_set_filter(state->strokeGradient, state->patternQuality); - cairo_set_source(_context, state->strokeGradient); - } - } else { - setSourceRGBA(state->stroke); - } - - if (preserve) { - hasShadow() - ? shadow(cairo_stroke_preserve) - : cairo_stroke_preserve(_context); - } else { - hasShadow() - ? shadow(cairo_stroke) - : cairo_stroke(_context); - } -} - -/* - * Apply shadow with the given draw fn. - */ - -void -Context2d::shadow(void (fn)(cairo_t *cr)) { - cairo_path_t *path = cairo_copy_path_flat(_context); - cairo_save(_context); - - // shadowOffset is unaffected by current transform - cairo_matrix_t path_matrix; - cairo_get_matrix(_context, &path_matrix); - cairo_identity_matrix(_context); - - // Apply shadow - cairo_push_group(_context); - - // No need to invoke blur if shadowBlur is 0 - if (state->shadowBlur) { - // find out extent of path - double x1, y1, x2, y2; - if (fn == cairo_fill || fn == cairo_fill_preserve) { - cairo_fill_extents(_context, &x1, &y1, &x2, &y2); - } else { - cairo_stroke_extents(_context, &x1, &y1, &x2, &y2); - } - - // create new image surface that size + padding for blurring - double dx = x2-x1, dy = y2-y1; - cairo_user_to_device_distance(_context, &dx, &dy); - int pad = state->shadowBlur * 2; - cairo_surface_t *shadow_surface = cairo_image_surface_create( - CAIRO_FORMAT_ARGB32, - dx + 2 * pad, - dy + 2 * pad); - cairo_t *shadow_context = cairo_create(shadow_surface); - - // transform path to the right place - cairo_translate(shadow_context, pad-x1, pad-y1); - cairo_transform(shadow_context, &path_matrix); - - // draw the path and blur - cairo_set_line_width(shadow_context, cairo_get_line_width(_context)); - cairo_new_path(shadow_context); - cairo_append_path(shadow_context, path); - setSourceRGBA(shadow_context, state->shadow); - fn(shadow_context); - blur(shadow_surface, state->shadowBlur); - - // paint to original context - cairo_set_source_surface(_context, shadow_surface, - x1 - pad + state->shadowOffsetX + 1, - y1 - pad + state->shadowOffsetY + 1); - cairo_paint(_context); - cairo_destroy(shadow_context); - cairo_surface_destroy(shadow_surface); - } else { - // Offset first, then apply path's transform - cairo_translate( - _context - , state->shadowOffsetX - , state->shadowOffsetY); - cairo_transform(_context, &path_matrix); - - // Apply shadow - cairo_new_path(_context); - cairo_append_path(_context, path); - setSourceRGBA(state->shadow); - - fn(_context); - } - - // Paint the shadow - cairo_pop_group_to_source(_context); - cairo_paint(_context); - - // Restore state - cairo_restore(_context); - cairo_new_path(_context); - cairo_append_path(_context, path); - fn(_context); - - cairo_path_destroy(path); -} - -/* - * Set source RGBA for the current context - */ - -void -Context2d::setSourceRGBA(rgba_t color) { - setSourceRGBA(_context, color); -} - -/* - * Set source RGBA - */ - -void -Context2d::setSourceRGBA(cairo_t *ctx, rgba_t color) { - cairo_set_source_rgba( - ctx - , color.r - , color.g - , color.b - , color.a * state->globalAlpha); -} - -/* - * Check if the context has a drawable shadow. - */ - -bool -Context2d::hasShadow() { - return state->shadow.a - && (state->shadowBlur || state->shadowOffsetX || state->shadowOffsetY); -} - -/* - * Blur the given surface with the given radius. - */ - -void -Context2d::blur(cairo_surface_t *surface, int radius) { - // Steve Hanov, 2009 - // Released into the public domain. - radius = radius * 0.57735f + 0.5f; - // get width, height - int width = cairo_image_surface_get_width( surface ); - int height = cairo_image_surface_get_height( surface ); - unsigned* precalc = - (unsigned*)malloc(width*height*sizeof(unsigned)); - cairo_surface_flush( surface ); - unsigned char* src = cairo_image_surface_get_data( surface ); - double mul=1.f/((radius*2)*(radius*2)); - int channel; - - // The number of times to perform the averaging. According to wikipedia, - // three iterations is good enough to pass for a gaussian. - const int MAX_ITERATIONS = 3; - int iteration; - - for ( iteration = 0; iteration < MAX_ITERATIONS; iteration++ ) { - for( channel = 0; channel < 4; channel++ ) { - int x,y; - - // precomputation step. - unsigned char* pix = src; - unsigned* pre = precalc; - - pix += channel; - for (y=0;y0) tot+=pre[-1]; - if (y>0) tot+=pre[-width]; - if (x>0 && y>0) tot-=pre[-width-1]; - *pre++=tot; - pix += 4; - } - } - - // blur step. - pix = src + (int)radius * width * 4 + (int)radius * 4 + channel; - for (y=radius;y= width ? width - 1 : x + radius; - int b = y + radius >= height ? height - 1 : y + radius; - int tot = precalc[r+b*width] + precalc[l+t*width] - - precalc[l+b*width] - precalc[r+t*width]; - *pix=(unsigned char)(tot*mul); - pix += 4; - } - pix += (int)radius * 2 * 4; - } - } - } - - cairo_surface_mark_dirty(surface); - free(precalc); -} - -/* - * Initialize a new Context2d with the given canvas. - */ - -NAN_METHOD(Context2d::New) { - if (!info.IsConstructCall()) { - return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); - } - - if (!info[0]->IsObject()) - return Nan::ThrowTypeError("Canvas expected"); - Local obj = Nan::To(info[0]).ToLocalChecked(); - if (!Nan::New(Canvas::constructor)->HasInstance(obj)) - return Nan::ThrowTypeError("Canvas expected"); - Canvas *canvas = Nan::ObjectWrap::Unwrap(obj); - - bool isImageBackend = canvas->backend()->getName() == "image"; - if (isImageBackend) { - cairo_format_t format = ImageBackend::DEFAULT_FORMAT; - if (info[1]->IsObject()) { - Local ctxAttributes = Nan::To(info[1]).ToLocalChecked(); - - Local pixelFormat = Nan::Get(ctxAttributes, Nan::New("pixelFormat").ToLocalChecked()).ToLocalChecked(); - if (pixelFormat->IsString()) { - Nan::Utf8String utf8PixelFormat(pixelFormat); - if (!strcmp(*utf8PixelFormat, "RGBA32")) format = CAIRO_FORMAT_ARGB32; - else if (!strcmp(*utf8PixelFormat, "RGB24")) format = CAIRO_FORMAT_RGB24; - else if (!strcmp(*utf8PixelFormat, "A8")) format = CAIRO_FORMAT_A8; - else if (!strcmp(*utf8PixelFormat, "RGB16_565")) format = CAIRO_FORMAT_RGB16_565; - else if (!strcmp(*utf8PixelFormat, "A1")) format = CAIRO_FORMAT_A1; -#ifdef CAIRO_FORMAT_RGB30 - else if (!strcmp(utf8PixelFormat, "RGB30")) format = CAIRO_FORMAT_RGB30; -#endif - } - - // alpha: false forces use of RGB24 - Local alpha = Nan::Get(ctxAttributes, Nan::New("alpha").ToLocalChecked()).ToLocalChecked(); - if (alpha->IsBoolean() && !Nan::To(alpha).FromMaybe(false)) { - format = CAIRO_FORMAT_RGB24; - } - } - static_cast(canvas->backend())->setFormat(format); - } - - Context2d *context = new Context2d(canvas); - - context->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); -} - -/* - * Save some external modules as private references. - */ - -NAN_METHOD(Context2d::SaveExternalModules) { - _DOMMatrix.Reset(Nan::To(info[0]).ToLocalChecked()); - _parseFont.Reset(Nan::To(info[1]).ToLocalChecked()); -} - -/* -* Get format (string). -*/ - -NAN_GETTER(Context2d::GetFormat) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - std::string pixelFormatString; - switch (context->canvas()->backend()->getFormat()) { - case CAIRO_FORMAT_ARGB32: pixelFormatString = "RGBA32"; break; - case CAIRO_FORMAT_RGB24: pixelFormatString = "RGB24"; break; - case CAIRO_FORMAT_A8: pixelFormatString = "A8"; break; - case CAIRO_FORMAT_A1: pixelFormatString = "A1"; break; - case CAIRO_FORMAT_RGB16_565: pixelFormatString = "RGB16_565"; break; -#ifdef CAIRO_FORMAT_RGB30 - case CAIRO_FORMAT_RGB30: pixelFormatString = "RGB30"; break; -#endif - default: return info.GetReturnValue().SetNull(); - } - info.GetReturnValue().Set(Nan::New(pixelFormatString).ToLocalChecked()); -} - -/* - * Create a new page. - */ - -NAN_METHOD(Context2d::AddPage) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - if (context->canvas()->backend()->getName() != "pdf") { - return Nan::ThrowError("only PDF canvases support .addPage()"); - } - cairo_show_page(context->context()); - int width = Nan::To(info[0]).FromMaybe(0); - int height = Nan::To(info[1]).FromMaybe(0); - if (width < 1) width = context->canvas()->getWidth(); - if (height < 1) height = context->canvas()->getHeight(); - cairo_pdf_surface_set_size(context->canvas()->surface(), width, height); - return; -} - -/* - * Put image data. - * - * - imageData, dx, dy - * - imageData, dx, dy, sx, sy, sw, sh - * - */ - -NAN_METHOD(Context2d::PutImageData) { - if (!info[0]->IsObject()) - return Nan::ThrowTypeError("ImageData expected"); - Local obj = Nan::To(info[0]).ToLocalChecked(); - if (!Nan::New(ImageData::constructor)->HasInstance(obj)) - return Nan::ThrowTypeError("ImageData expected"); - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - ImageData *imageData = Nan::ObjectWrap::Unwrap(obj); - - uint8_t *src = imageData->data(); - uint8_t *dst = context->canvas()->data(); - - int dstStride = context->canvas()->stride(); - int Bpp = dstStride / context->canvas()->getWidth(); - int srcStride = Bpp * imageData->width(); - - int sx = 0 - , sy = 0 - , sw = 0 - , sh = 0 - , dx = Nan::To(info[1]).FromMaybe(0) - , dy = Nan::To(info[2]).FromMaybe(0) - , rows - , cols; - - switch (info.Length()) { - // imageData, dx, dy - case 3: - sw = imageData->width(); - sh = imageData->height(); - break; - // imageData, dx, dy, sx, sy, sw, sh - case 7: - sx = Nan::To(info[3]).FromMaybe(0); - sy = Nan::To(info[4]).FromMaybe(0); - sw = Nan::To(info[5]).FromMaybe(0); - sh = Nan::To(info[6]).FromMaybe(0); - // fix up negative height, width - if (sw < 0) sx += sw, sw = -sw; - if (sh < 0) sy += sh, sh = -sh; - // clamp the left edge - if (sx < 0) sw += sx, sx = 0; - if (sy < 0) sh += sy, sy = 0; - // clamp the right edge - if (sx + sw > imageData->width()) sw = imageData->width() - sx; - if (sy + sh > imageData->height()) sh = imageData->height() - sy; - // start destination at source offset - dx += sx; - dy += sy; - break; - default: - return Nan::ThrowError("invalid arguments"); - } - - // chop off outlying source data - if (dx < 0) sw += dx, sx -= dx, dx = 0; - if (dy < 0) sh += dy, sy -= dy, dy = 0; - // clamp width at canvas size - // Need to wrap std::min calls using parens to prevent macro expansion on - // windows. See http://stackoverflow.com/questions/5004858/stdmin-gives-error - cols = (std::min)(sw, context->canvas()->getWidth() - dx); - rows = (std::min)(sh, context->canvas()->getHeight() - dy); - - if (cols <= 0 || rows <= 0) return; - - switch (context->canvas()->backend()->getFormat()) { - case CAIRO_FORMAT_ARGB32: { - src += sy * srcStride + sx * 4; - dst += dstStride * dy + 4 * dx; - for (int y = 0; y < rows; ++y) { - uint8_t *dstRow = dst; - uint8_t *srcRow = src; - for (int x = 0; x < cols; ++x) { - // rgba - uint8_t r = *srcRow++; - uint8_t g = *srcRow++; - uint8_t b = *srcRow++; - uint8_t a = *srcRow++; - - // argb - // performance optimization: fully transparent/opaque pixels can be - // processed more efficiently. - if (a == 0) { - *dstRow++ = 0; - *dstRow++ = 0; - *dstRow++ = 0; - *dstRow++ = 0; - } else if (a == 255) { - *dstRow++ = b; - *dstRow++ = g; - *dstRow++ = r; - *dstRow++ = a; - } else { - float alpha = (float)a / 255; - *dstRow++ = b * alpha; - *dstRow++ = g * alpha; - *dstRow++ = r * alpha; - *dstRow++ = a; - } - } - dst += dstStride; - src += srcStride; - } - break; - } - case CAIRO_FORMAT_RGB24: { - src += sy * srcStride + sx * 4; - dst += dstStride * dy + 4 * dx; - for (int y = 0; y < rows; ++y) { - uint8_t *dstRow = dst; - uint8_t *srcRow = src; - for (int x = 0; x < cols; ++x) { - // rgba - uint8_t r = *srcRow++; - uint8_t g = *srcRow++; - uint8_t b = *srcRow++; - srcRow++; - - // argb - *dstRow++ = b; - *dstRow++ = g; - *dstRow++ = r; - *dstRow++ = 255; - } - dst += dstStride; - src += srcStride; - } - break; - } - case CAIRO_FORMAT_A8: { - src += sy * srcStride + sx; - dst += dstStride * dy + dx; - if (srcStride == dstStride && cols == dstStride) { - // fast path: strides are the same and doing a full-width put - memcpy(dst, src, cols * rows); - } else { - for (int y = 0; y < rows; ++y) { - memcpy(dst, src, cols); - dst += dstStride; - src += srcStride; - } - } - break; - } - case CAIRO_FORMAT_A1: { - // TODO Should this be totally packed, or maintain a stride divisible by 4? - Nan::ThrowError("putImageData for CANVAS_FORMAT_A1 is not yet implemented"); - break; - } - case CAIRO_FORMAT_RGB16_565: { - src += sy * srcStride + sx * 2; - dst += dstStride * dy + 2 * dx; - for (int y = 0; y < rows; ++y) { - memcpy(dst, src, cols * 2); - dst += dstStride; - src += srcStride; - } - break; - } -#ifdef CAIRO_FORMAT_RGB30 - case CAIRO_FORMAT_RGB30: { - // TODO - Nan::ThrowError("putImageData for CANVAS_FORMAT_RGB30 is not yet implemented"); - break; - } -#endif - default: { - Nan::ThrowError("Invalid pixel format"); - break; - } - } - - cairo_surface_mark_dirty_rectangle( - context->canvas()->surface() - , dx - , dy - , cols - , rows); -} - -/* - * Get image data. - * - * - sx, sy, sw, sh - * - */ - -NAN_METHOD(Context2d::GetImageData) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Canvas *canvas = context->canvas(); - - int sx = Nan::To(info[0]).FromMaybe(0); - int sy = Nan::To(info[1]).FromMaybe(0); - int sw = Nan::To(info[2]).FromMaybe(0); - int sh = Nan::To(info[3]).FromMaybe(0); - - if (!sw) - return Nan::ThrowError("IndexSizeError: The source width is 0."); - if (!sh) - return Nan::ThrowError("IndexSizeError: The source height is 0."); - - int width = canvas->getWidth(); - int height = canvas->getHeight(); - - if (!width) - return Nan::ThrowTypeError("Canvas width is 0"); - if (!height) - return Nan::ThrowTypeError("Canvas height is 0"); - - // WebKit and Firefox have this behavior: - // Flip the coordinates so the origin is top/left-most: - if (sw < 0) { - sx += sw; - sw = -sw; - } - if (sh < 0) { - sy += sh; - sh = -sh; - } - - if (sx + sw > width) sw = width - sx; - if (sy + sh > height) sh = height - sy; - - // WebKit/moz functionality. node-canvas used to return in either case. - if (sw <= 0) sw = 1; - if (sh <= 0) sh = 1; - - // Non-compliant. "Pixels outside the canvas must be returned as transparent - // black." This instead clips the returned array to the canvas area. - if (sx < 0) { - sw += sx; - sx = 0; - } - if (sy < 0) { - sh += sy; - sy = 0; - } - - int srcStride = canvas->stride(); - int bpp = srcStride / width; - int size = sw * sh * bpp; - int dstStride = sw * bpp; - - uint8_t *src = canvas->data(); - - Local buffer = ArrayBuffer::New(Isolate::GetCurrent(), size); - Local dataArray; - - if (canvas->backend()->getFormat() == CAIRO_FORMAT_RGB16_565) { - dataArray = Uint16Array::New(buffer, 0, size >> 1); - } else { - dataArray = Uint8ClampedArray::New(buffer, 0, size); - } - - Nan::TypedArrayContents typedArrayContents(dataArray); - uint8_t* dst = *typedArrayContents; - - switch (canvas->backend()->getFormat()) { - case CAIRO_FORMAT_ARGB32: { - // Rearrange alpha (argb -> rgba), undo alpha pre-multiplication, - // and store in big-endian format - for (int y = 0; y < sh; ++y) { - uint32_t *row = (uint32_t *)(src + srcStride * (y + sy)); - for (int x = 0; x < sw; ++x) { - int bx = x * 4; - uint32_t *pixel = row + x + sx; - uint8_t a = *pixel >> 24; - uint8_t r = *pixel >> 16; - uint8_t g = *pixel >> 8; - uint8_t b = *pixel; - dst[bx + 3] = a; - - // Performance optimization: fully transparent/opaque pixels can be - // processed more efficiently. - if (a == 0 || a == 255) { - dst[bx + 0] = r; - dst[bx + 1] = g; - dst[bx + 2] = b; - } else { - // Undo alpha pre-multiplication - float alphaR = (float)255 / a; - dst[bx + 0] = (int)((float)r * alphaR); - dst[bx + 1] = (int)((float)g * alphaR); - dst[bx + 2] = (int)((float)b * alphaR); - } - - } - dst += dstStride; - } - break; - } - case CAIRO_FORMAT_RGB24: { - // Rearrange alpha (argb -> rgba) and store in big-endian format - for (int y = 0; y < sh; ++y) { - uint32_t *row = (uint32_t *)(src + srcStride * (y + sy)); - for (int x = 0; x < sw; ++x) { - int bx = x * 4; - uint32_t *pixel = row + x + sx; - uint8_t r = *pixel >> 16; - uint8_t g = *pixel >> 8; - uint8_t b = *pixel; - - dst[bx + 0] = r; - dst[bx + 1] = g; - dst[bx + 2] = b; - dst[bx + 3] = 255; - } - dst += dstStride; - } - break; - } - case CAIRO_FORMAT_A8: { - for (int y = 0; y < sh; ++y) { - uint8_t *row = (uint8_t *)(src + srcStride * (y + sy)); - memcpy(dst, row + sx, dstStride); - dst += dstStride; - } - break; - } - case CAIRO_FORMAT_A1: { - // TODO Should this be totally packed, or maintain a stride divisible by 4? - Nan::ThrowError("getImageData for CANVAS_FORMAT_A1 is not yet implemented"); - break; - } - case CAIRO_FORMAT_RGB16_565: { - for (int y = 0; y < sh; ++y) { - uint16_t *row = (uint16_t *)(src + srcStride * (y + sy)); - memcpy(dst, row + sx, dstStride); - dst += dstStride; - } - break; - } -#ifdef CAIRO_FORMAT_RGB30 - case CAIRO_FORMAT_RGB30: { - // TODO - Nan::ThrowError("getImageData for CANVAS_FORMAT_RGB30 is not yet implemented"); - break; - } -#endif - default: { - // Unlikely - Nan::ThrowError("Invalid pixel format"); - break; - } - } - - const int argc = 3; - Local swHandle = Nan::New(sw); - Local shHandle = Nan::New(sh); - Local argv[argc] = { dataArray, swHandle, shHandle }; - - Local ctor = Nan::GetFunction(Nan::New(ImageData::constructor)).ToLocalChecked(); - Local instance = Nan::NewInstance(ctor, argc, argv).ToLocalChecked(); - - info.GetReturnValue().Set(instance); -} - -/** - * Create `ImageData` with the given dimensions or - * `ImageData` instance for dimensions. - */ - -NAN_METHOD(Context2d::CreateImageData){ - Isolate *iso = Isolate::GetCurrent(); - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Canvas *canvas = context->canvas(); - int32_t width, height; - - if (info[0]->IsObject()) { - Local obj = Nan::To(info[0]).ToLocalChecked(); - width = Nan::To(Nan::Get(obj, Nan::New("width").ToLocalChecked()).ToLocalChecked()).FromMaybe(0); - height = Nan::To(Nan::Get(obj, Nan::New("height").ToLocalChecked()).ToLocalChecked()).FromMaybe(0); - } else { - width = Nan::To(info[0]).FromMaybe(0); - height = Nan::To(info[1]).FromMaybe(0); - } - - int stride = canvas->stride(); - double Bpp = static_cast(stride) / canvas->getWidth(); - int nBytes = static_cast(Bpp * width * height + .5); - - Local ab = ArrayBuffer::New(iso, nBytes); - Local arr; - - if (canvas->backend()->getFormat() == CAIRO_FORMAT_RGB16_565) - arr = Uint16Array::New(ab, 0, nBytes / 2); - else - arr = Uint8ClampedArray::New(ab, 0, nBytes); - - const int argc = 3; - Local argv[argc] = { arr, Nan::New(width), Nan::New(height) }; - - Local ctor = Nan::GetFunction(Nan::New(ImageData::constructor)).ToLocalChecked(); - Local instance = Nan::NewInstance(ctor, argc, argv).ToLocalChecked(); - - info.GetReturnValue().Set(instance); -} - -/* - * Take a transform matrix and return its components - * 0: angle, 1: scaleX, 2: scaleY, 3: skewX, 4: translateX, 5: translateY - */ -void decompose_matrix(cairo_matrix_t matrix, double *destination) { - double denom = pow(matrix.xx, 2) + pow(matrix.yx, 2); - destination[0] = atan2(matrix.yx, matrix.xx); - destination[1] = sqrt(denom); - destination[2] = (matrix.xx * matrix.yy - matrix.xy * matrix.yx) / destination[1]; - destination[3] = atan2(matrix.xx * matrix.xy + matrix.yx * matrix.yy, denom); - destination[4] = matrix.x0; - destination[5] = matrix.y0; -} - -/* - * Draw image src image to the destination (context). - * - * - dx, dy - * - dx, dy, dw, dh - * - sx, sy, sw, sh, dx, dy, dw, dh - * - */ - -NAN_METHOD(Context2d::DrawImage) { - int infoLen = info.Length(); - if (infoLen != 3 && infoLen != 5 && infoLen != 9) - return Nan::ThrowTypeError("Invalid arguments"); - - if (!info[0]->IsObject()) - return Nan::ThrowTypeError("The first argument must be an object"); - - double args[8]; - if(!checkArgs(info, args, infoLen - 1, 1)) - return; - - double sx = 0 - , sy = 0 - , sw = 0 - , sh = 0 - , dx = 0 - , dy = 0 - , dw = 0 - , dh = 0 - , source_w = 0 - , source_h = 0; - - cairo_surface_t *surface; - - Local obj = Nan::To(info[0]).ToLocalChecked(); - - // Image - if (Nan::New(Image::constructor)->HasInstance(obj)) { - Image *img = Nan::ObjectWrap::Unwrap(obj); - if (!img->isComplete()) { - return Nan::ThrowError("Image given has not completed loading"); - } - source_w = sw = img->width; - source_h = sh = img->height; - surface = img->surface(); - - // Canvas - } else if (Nan::New(Canvas::constructor)->HasInstance(obj)) { - Canvas *canvas = Nan::ObjectWrap::Unwrap(obj); - source_w = sw = canvas->getWidth(); - source_h = sh = canvas->getHeight(); - surface = canvas->surface(); - - // Invalid - } else { - return Nan::ThrowTypeError("Image or Canvas expected"); - } - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - - // Arguments - switch (infoLen) { - // img, sx, sy, sw, sh, dx, dy, dw, dh - case 9: - sx = args[0]; - sy = args[1]; - sw = args[2]; - sh = args[3]; - dx = args[4]; - dy = args[5]; - dw = args[6]; - dh = args[7]; - break; - // img, dx, dy, dw, dh - case 5: - dx = args[0]; - dy = args[1]; - dw = args[2]; - dh = args[3]; - break; - // img, dx, dy - case 3: - dx = args[0]; - dy = args[1]; - dw = sw; - dh = sh; - break; - } - - if (!(sw && sh && dw && dh)) - return; - - // Start draw - cairo_save(ctx); - - cairo_matrix_t matrix; - double transforms[6]; - cairo_get_matrix(context->context(), &matrix); - decompose_matrix(matrix, transforms); - // extract the scale value from the current transform so that we know how many pixels we - // need for our extra canvas in the drawImage operation. - double current_scale_x = std::abs(transforms[1]); - double current_scale_y = std::abs(transforms[2]); - double extra_dx = 0; - double extra_dy = 0; - double fx = dw / sw * current_scale_x; // transforms[1] is scale on X - double fy = dh / sh * current_scale_y; // transforms[2] is scale on X - bool needScale = dw != sw || dh != sh; - bool needCut = sw != source_w || sh != source_h || sx < 0 || sy < 0; - bool sameCanvas = surface == context->canvas()->surface(); - bool needsExtraSurface = sameCanvas || needCut || needScale; - cairo_surface_t *surfTemp = NULL; - cairo_t *ctxTemp = NULL; - - if (needsExtraSurface) { - // we want to create the extra surface as small as possible. - // fx and fy are the total scaling we need to apply to sw, sh. - // from sw and sh we want to remove the part that is outside the source_w and soruce_h - double real_w = sw; - double real_h = sh; - double translate_x = 0; - double translate_y = 0; - // if sx or sy are negative, a part of the area represented by sw and sh is empty - // because there are empty pixels, so we cut it out. - // On the other hand if sx or sy are positive, but sw and sh extend outside the real - // source pixels, we cut the area in that case too. - if (sx < 0) { - extra_dx = -sx * fx; - real_w = sw + sx; - } else if (sx + sw > source_w) { - real_w = sw - (sx + sw - source_w); - } - if (sy < 0) { - extra_dy = -sy * fy; - real_h = sh + sy; - } else if (sy + sh > source_h) { - real_h = sh - (sy + sh - source_h); - } - // if after cutting we are still bigger than source pixels, we restrict again - if (real_w > source_w) { - real_w = source_w; - } - if (real_h > source_h) { - real_h = source_h; - } - // TODO: find a way to limit the surfTemp to real_w and real_h if fx and fy are bigger than 1. - // there are no more pixel than the one available in the source, no need to create a bigger surface. - surfTemp = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, round(real_w * fx), round(real_h * fy)); - ctxTemp = cairo_create(surfTemp); - cairo_scale(ctxTemp, fx, fy); - if (sx > 0) { - translate_x = sx; - } - if (sy > 0) { - translate_y = sy; - } - cairo_set_source_surface(ctxTemp, surface, -translate_x, -translate_y); - cairo_pattern_set_filter(cairo_get_source(ctxTemp), context->state->imageSmoothingEnabled ? context->state->patternQuality : CAIRO_FILTER_NEAREST); - cairo_pattern_set_extend(cairo_get_source(ctxTemp), CAIRO_EXTEND_REFLECT); - cairo_paint_with_alpha(ctxTemp, 1); - surface = surfTemp; - } - // apply shadow if there is one - if (context->hasShadow()) { - if(context->state->shadowBlur) { - // we need to create a new surface in order to blur - int pad = context->state->shadowBlur * 2; - cairo_surface_t *shadow_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, dw + 2 * pad, dh + 2 * pad); - cairo_t *shadow_context = cairo_create(shadow_surface); - - // mask and blur - context->setSourceRGBA(shadow_context, context->state->shadow); - cairo_mask_surface(shadow_context, surface, pad, pad); - context->blur(shadow_surface, context->state->shadowBlur); - - // paint - // @note: ShadowBlur looks different in each browser. This implementation matches chrome as close as possible. - // The 1.4 offset comes from visual tests with Chrome. I have read the spec and part of the shadowBlur - // implementation, and its not immediately clear why an offset is necessary, but without it, the result - // in chrome is different. - cairo_set_source_surface(ctx, shadow_surface, - dx + context->state->shadowOffsetX - pad + 1.4, - dy + context->state->shadowOffsetY - pad + 1.4); - cairo_paint(ctx); - // cleanup - cairo_destroy(shadow_context); - cairo_surface_destroy(shadow_surface); - } else { - context->setSourceRGBA(context->state->shadow); - cairo_mask_surface(ctx, surface, - dx + (context->state->shadowOffsetX), - dy + (context->state->shadowOffsetY)); - } - } - - double scaled_dx = dx; - double scaled_dy = dy; - - if (needsExtraSurface && (current_scale_x != 1 || current_scale_y != 1)) { - // in this case our surface contains already current_scale_x, we need to scale back - cairo_scale(ctx, 1 / current_scale_x, 1 / current_scale_y); - scaled_dx *= current_scale_x; - scaled_dy *= current_scale_y; - } - // Paint - cairo_set_source_surface(ctx, surface, scaled_dx + extra_dx, scaled_dy + extra_dy); - cairo_pattern_set_filter(cairo_get_source(ctx), context->state->imageSmoothingEnabled ? context->state->patternQuality : CAIRO_FILTER_NEAREST); - cairo_pattern_set_extend(cairo_get_source(ctx), CAIRO_EXTEND_NONE); - cairo_paint_with_alpha(ctx, context->state->globalAlpha); - - cairo_restore(ctx); - - if (needsExtraSurface) { - cairo_destroy(ctxTemp); - cairo_surface_destroy(surfTemp); - } -} - -/* - * Get global alpha. - */ - -NAN_GETTER(Context2d::GetGlobalAlpha) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(context->state->globalAlpha)); -} - -/* - * Set global alpha. - */ - -NAN_SETTER(Context2d::SetGlobalAlpha) { - double n = Nan::To(value).FromMaybe(0); - if (n >= 0 && n <= 1) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->state->globalAlpha = n; - } -} - -/* - * Get global composite operation. - */ - -NAN_GETTER(Context2d::GetGlobalCompositeOperation) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - - const char *op = "source-over"; - switch (cairo_get_operator(ctx)) { - // composite modes: - case CAIRO_OPERATOR_CLEAR: op = "clear"; break; - case CAIRO_OPERATOR_SOURCE: op = "copy"; break; - case CAIRO_OPERATOR_DEST: op = "destination"; break; - case CAIRO_OPERATOR_OVER: op = "source-over"; break; - case CAIRO_OPERATOR_DEST_OVER: op = "destination-over"; break; - case CAIRO_OPERATOR_IN: op = "source-in"; break; - case CAIRO_OPERATOR_DEST_IN: op = "destination-in"; break; - case CAIRO_OPERATOR_OUT: op = "source-out"; break; - case CAIRO_OPERATOR_DEST_OUT: op = "destination-out"; break; - case CAIRO_OPERATOR_ATOP: op = "source-atop"; break; - case CAIRO_OPERATOR_DEST_ATOP: op = "destination-atop"; break; - case CAIRO_OPERATOR_XOR: op = "xor"; break; - case CAIRO_OPERATOR_ADD: op = "lighter"; break; - // blend modes: - // Note: "source-over" and "normal" are synonyms. Chrome and FF both report - // "source-over" after setting gCO to "normal". - // case CAIRO_OPERATOR_OVER: op = "normal"; - case CAIRO_OPERATOR_MULTIPLY: op = "multiply"; break; - case CAIRO_OPERATOR_SCREEN: op = "screen"; break; - case CAIRO_OPERATOR_OVERLAY: op = "overlay"; break; - case CAIRO_OPERATOR_DARKEN: op = "darken"; break; - case CAIRO_OPERATOR_LIGHTEN: op = "lighten"; break; - case CAIRO_OPERATOR_COLOR_DODGE: op = "color-dodge"; break; - case CAIRO_OPERATOR_COLOR_BURN: op = "color-burn"; break; - case CAIRO_OPERATOR_HARD_LIGHT: op = "hard-light"; break; - case CAIRO_OPERATOR_SOFT_LIGHT: op = "soft-light"; break; - case CAIRO_OPERATOR_DIFFERENCE: op = "difference"; break; - case CAIRO_OPERATOR_EXCLUSION: op = "exclusion"; break; - case CAIRO_OPERATOR_HSL_HUE: op = "hue"; break; - case CAIRO_OPERATOR_HSL_SATURATION: op = "saturation"; break; - case CAIRO_OPERATOR_HSL_COLOR: op = "color"; break; - case CAIRO_OPERATOR_HSL_LUMINOSITY: op = "luminosity"; break; - // non-standard: - case CAIRO_OPERATOR_SATURATE: op = "saturate"; break; - } - - info.GetReturnValue().Set(Nan::New(op).ToLocalChecked()); -} - -/* - * Set pattern quality. - */ - -NAN_SETTER(Context2d::SetPatternQuality) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Nan::Utf8String quality(Nan::To(value).ToLocalChecked()); - if (0 == strcmp("fast", *quality)) { - context->state->patternQuality = CAIRO_FILTER_FAST; - } else if (0 == strcmp("good", *quality)) { - context->state->patternQuality = CAIRO_FILTER_GOOD; - } else if (0 == strcmp("best", *quality)) { - context->state->patternQuality = CAIRO_FILTER_BEST; - } else if (0 == strcmp("nearest", *quality)) { - context->state->patternQuality = CAIRO_FILTER_NEAREST; - } else if (0 == strcmp("bilinear", *quality)) { - context->state->patternQuality = CAIRO_FILTER_BILINEAR; - } -} - -/* - * Get pattern quality. - */ - -NAN_GETTER(Context2d::GetPatternQuality) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - const char *quality; - switch (context->state->patternQuality) { - case CAIRO_FILTER_FAST: quality = "fast"; break; - case CAIRO_FILTER_BEST: quality = "best"; break; - case CAIRO_FILTER_NEAREST: quality = "nearest"; break; - case CAIRO_FILTER_BILINEAR: quality = "bilinear"; break; - default: quality = "good"; - } - info.GetReturnValue().Set(Nan::New(quality).ToLocalChecked()); -} - -/* - * Set ImageSmoothingEnabled value. - */ - -NAN_SETTER(Context2d::SetImageSmoothingEnabled) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->state->imageSmoothingEnabled = Nan::To(value).FromMaybe(false); -} - -/* - * Get pattern quality. - */ - -NAN_GETTER(Context2d::GetImageSmoothingEnabled) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(context->state->imageSmoothingEnabled)); -} - -/* - * Set global composite operation. - */ - -NAN_SETTER(Context2d::SetGlobalCompositeOperation) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - Nan::Utf8String opStr(Nan::To(value).ToLocalChecked()); // Unlike CSS colors, this *is* case-sensitive - const std::map blendmodes = { - // composite modes: - {"clear", CAIRO_OPERATOR_CLEAR}, - {"copy", CAIRO_OPERATOR_SOURCE}, - {"destination", CAIRO_OPERATOR_DEST}, // this seems to have been omitted from the spec - {"source-over", CAIRO_OPERATOR_OVER}, - {"destination-over", CAIRO_OPERATOR_DEST_OVER}, - {"source-in", CAIRO_OPERATOR_IN}, - {"destination-in", CAIRO_OPERATOR_DEST_IN}, - {"source-out", CAIRO_OPERATOR_OUT}, - {"destination-out", CAIRO_OPERATOR_DEST_OUT}, - {"source-atop", CAIRO_OPERATOR_ATOP}, - {"destination-atop", CAIRO_OPERATOR_DEST_ATOP}, - {"xor", CAIRO_OPERATOR_XOR}, - {"lighter", CAIRO_OPERATOR_ADD}, - // blend modes: - {"normal", CAIRO_OPERATOR_OVER}, - {"multiply", CAIRO_OPERATOR_MULTIPLY}, - {"screen", CAIRO_OPERATOR_SCREEN}, - {"overlay", CAIRO_OPERATOR_OVERLAY}, - {"darken", CAIRO_OPERATOR_DARKEN}, - {"lighten", CAIRO_OPERATOR_LIGHTEN}, - {"color-dodge", CAIRO_OPERATOR_COLOR_DODGE}, - {"color-burn", CAIRO_OPERATOR_COLOR_BURN}, - {"hard-light", CAIRO_OPERATOR_HARD_LIGHT}, - {"soft-light", CAIRO_OPERATOR_SOFT_LIGHT}, - {"difference", CAIRO_OPERATOR_DIFFERENCE}, - {"exclusion", CAIRO_OPERATOR_EXCLUSION}, - {"hue", CAIRO_OPERATOR_HSL_HUE}, - {"saturation", CAIRO_OPERATOR_HSL_SATURATION}, - {"color", CAIRO_OPERATOR_HSL_COLOR}, - {"luminosity", CAIRO_OPERATOR_HSL_LUMINOSITY}, - // non-standard: - {"saturate", CAIRO_OPERATOR_SATURATE} - }; - auto op = blendmodes.find(*opStr); - if (op != blendmodes.end()) cairo_set_operator(ctx, op->second); -} - -/* - * Get shadow offset x. - */ - -NAN_GETTER(Context2d::GetShadowOffsetX) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(context->state->shadowOffsetX)); -} - -/* - * Set shadow offset x. - */ - -NAN_SETTER(Context2d::SetShadowOffsetX) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->state->shadowOffsetX = Nan::To(value).FromMaybe(0); -} - -/* - * Get shadow offset y. - */ - -NAN_GETTER(Context2d::GetShadowOffsetY) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(context->state->shadowOffsetY)); -} - -/* - * Set shadow offset y. - */ - -NAN_SETTER(Context2d::SetShadowOffsetY) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->state->shadowOffsetY = Nan::To(value).FromMaybe(0); -} - -/* - * Get shadow blur. - */ - -NAN_GETTER(Context2d::GetShadowBlur) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(context->state->shadowBlur)); -} - -/* - * Set shadow blur. - */ - -NAN_SETTER(Context2d::SetShadowBlur) { - int n = Nan::To(value).FromMaybe(0); - if (n >= 0) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->state->shadowBlur = n; - } -} - -/* - * Get current antialiasing setting. - */ - -NAN_GETTER(Context2d::GetAntiAlias) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - const char *aa; - switch (cairo_get_antialias(context->context())) { - case CAIRO_ANTIALIAS_NONE: aa = "none"; break; - case CAIRO_ANTIALIAS_GRAY: aa = "gray"; break; - case CAIRO_ANTIALIAS_SUBPIXEL: aa = "subpixel"; break; - default: aa = "default"; - } - info.GetReturnValue().Set(Nan::New(aa).ToLocalChecked()); -} - -/* - * Set antialiasing. - */ - -NAN_SETTER(Context2d::SetAntiAlias) { - Nan::Utf8String str(Nan::To(value).ToLocalChecked()); - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - cairo_antialias_t a; - if (0 == strcmp("none", *str)) { - a = CAIRO_ANTIALIAS_NONE; - } else if (0 == strcmp("default", *str)) { - a = CAIRO_ANTIALIAS_DEFAULT; - } else if (0 == strcmp("gray", *str)) { - a = CAIRO_ANTIALIAS_GRAY; - } else if (0 == strcmp("subpixel", *str)) { - a = CAIRO_ANTIALIAS_SUBPIXEL; - } else { - a = cairo_get_antialias(ctx); - } - cairo_set_antialias(ctx, a); -} - -/* - * Get text drawing mode. - */ - -NAN_GETTER(Context2d::GetTextDrawingMode) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - const char *mode; - if (context->state->textDrawingMode == TEXT_DRAW_PATHS) { - mode = "path"; - } else if (context->state->textDrawingMode == TEXT_DRAW_GLYPHS) { - mode = "glyph"; - } else { - mode = "unknown"; - } - info.GetReturnValue().Set(Nan::New(mode).ToLocalChecked()); -} - -/* - * Set text drawing mode. - */ - -NAN_SETTER(Context2d::SetTextDrawingMode) { - Nan::Utf8String str(Nan::To(value).ToLocalChecked()); - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - if (0 == strcmp("path", *str)) { - context->state->textDrawingMode = TEXT_DRAW_PATHS; - } else if (0 == strcmp("glyph", *str)) { - context->state->textDrawingMode = TEXT_DRAW_GLYPHS; - } -} - -/* - * Get filter. - */ - -NAN_GETTER(Context2d::GetQuality) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - const char *filter; - switch (cairo_pattern_get_filter(cairo_get_source(context->context()))) { - case CAIRO_FILTER_FAST: filter = "fast"; break; - case CAIRO_FILTER_BEST: filter = "best"; break; - case CAIRO_FILTER_NEAREST: filter = "nearest"; break; - case CAIRO_FILTER_BILINEAR: filter = "bilinear"; break; - default: filter = "good"; - } - info.GetReturnValue().Set(Nan::New(filter).ToLocalChecked()); -} - -/* - * Set filter. - */ - -NAN_SETTER(Context2d::SetQuality) { - Nan::Utf8String str(Nan::To(value).ToLocalChecked()); - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_filter_t filter; - if (0 == strcmp("fast", *str)) { - filter = CAIRO_FILTER_FAST; - } else if (0 == strcmp("best", *str)) { - filter = CAIRO_FILTER_BEST; - } else if (0 == strcmp("nearest", *str)) { - filter = CAIRO_FILTER_NEAREST; - } else if (0 == strcmp("bilinear", *str)) { - filter = CAIRO_FILTER_BILINEAR; - } else { - filter = CAIRO_FILTER_GOOD; - } - cairo_pattern_set_filter(cairo_get_source(context->context()), filter); -} - -/* - * Get current transform. - */ - -NAN_GETTER(Context2d::GetCurrentTransform) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Isolate *iso = Isolate::GetCurrent(); - - Local arr = Float64Array::New(ArrayBuffer::New(iso, 48), 0, 6); - Nan::TypedArrayContents dest(arr); - cairo_matrix_t matrix; - cairo_get_matrix(context->context(), &matrix); - (*dest)[0] = matrix.xx; - (*dest)[1] = matrix.yx; - (*dest)[2] = matrix.xy; - (*dest)[3] = matrix.yy; - (*dest)[4] = matrix.x0; - (*dest)[5] = matrix.y0; - - const int argc = 1; - Local argv[argc] = { arr }; - Local instance = Nan::NewInstance(_DOMMatrix.Get(iso), argc, argv).ToLocalChecked(); - - info.GetReturnValue().Set(instance); -} - -/* - * Set current transform. - */ - -NAN_SETTER(Context2d::SetCurrentTransform) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Local ctx = Nan::GetCurrentContext(); - Local mat = Nan::To(value).ToLocalChecked(); - -#if NODE_MAJOR_VERSION >= 8 - if (!mat->InstanceOf(ctx, _DOMMatrix.Get(Isolate::GetCurrent())).ToChecked()) { - return Nan::ThrowTypeError("Expected DOMMatrix"); - } -#endif - - cairo_matrix_t matrix; - cairo_matrix_init(&matrix, - Nan::To(Nan::Get(mat, Nan::New("a").ToLocalChecked()).ToLocalChecked()).FromMaybe(0), - Nan::To(Nan::Get(mat, Nan::New("b").ToLocalChecked()).ToLocalChecked()).FromMaybe(0), - Nan::To(Nan::Get(mat, Nan::New("c").ToLocalChecked()).ToLocalChecked()).FromMaybe(0), - Nan::To(Nan::Get(mat, Nan::New("d").ToLocalChecked()).ToLocalChecked()).FromMaybe(0), - Nan::To(Nan::Get(mat, Nan::New("e").ToLocalChecked()).ToLocalChecked()).FromMaybe(0), - Nan::To(Nan::Get(mat, Nan::New("f").ToLocalChecked()).ToLocalChecked()).FromMaybe(0) - ); - - cairo_transform(context->context(), &matrix); -} - -/* - * Get current fill style. - */ - -NAN_GETTER(Context2d::GetFillStyle) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Isolate *iso = Isolate::GetCurrent(); - Local style; - - if (context->_fillStyle.IsEmpty()) - style = context->_getFillColor(); - else - style = context->_fillStyle.Get(iso); - - info.GetReturnValue().Set(style); -} - -/* - * Set current fill style. - */ - -NAN_SETTER(Context2d::SetFillStyle) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - - if (Nan::New(Gradient::constructor)->HasInstance(value) || - Nan::New(Pattern::constructor)->HasInstance(value)) { - context->_fillStyle.Reset(value); - - Local obj = Nan::To(value).ToLocalChecked(); - if (Nan::New(Gradient::constructor)->HasInstance(obj)){ - Gradient *grad = Nan::ObjectWrap::Unwrap(obj); - context->state->fillGradient = grad->pattern(); - } else if(Nan::New(Pattern::constructor)->HasInstance(obj)){ - Pattern *pattern = Nan::ObjectWrap::Unwrap(obj); - context->state->fillPattern = pattern->pattern(); - } - } else { - MaybeLocal mstr = Nan::To(value); - if (mstr.IsEmpty()) return; - Local str = mstr.ToLocalChecked(); - context->_fillStyle.Reset(); - context->_setFillColor(str); - } -} - -/* - * Get current stroke style. - */ - -NAN_GETTER(Context2d::GetStrokeStyle) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Local style; - - if (context->_strokeStyle.IsEmpty()) - style = context->_getStrokeColor(); - else - style = context->_strokeStyle.Get(Isolate::GetCurrent()); - - info.GetReturnValue().Set(style); -} - -/* - * Set current stroke style. - */ - -NAN_SETTER(Context2d::SetStrokeStyle) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - - if (Nan::New(Gradient::constructor)->HasInstance(value) || - Nan::New(Pattern::constructor)->HasInstance(value)) { - context->_strokeStyle.Reset(value); - - Local obj = Nan::To(value).ToLocalChecked(); - if (Nan::New(Gradient::constructor)->HasInstance(obj)){ - Gradient *grad = Nan::ObjectWrap::Unwrap(obj); - context->state->strokeGradient = grad->pattern(); - } else if(Nan::New(Pattern::constructor)->HasInstance(obj)){ - Pattern *pattern = Nan::ObjectWrap::Unwrap(obj); - context->state->strokePattern = pattern->pattern(); - } else { - return Nan::ThrowTypeError("Gradient or Pattern expected"); - } - } else { - MaybeLocal mstr = Nan::To(value); - if (mstr.IsEmpty()) return; - Local str = mstr.ToLocalChecked(); - context->_strokeStyle.Reset(); - context->_setStrokeColor(str); - } -} - -/* - * Get miter limit. - */ - -NAN_GETTER(Context2d::GetMiterLimit) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(cairo_get_miter_limit(context->context()))); -} - -/* - * Set miter limit. - */ - -NAN_SETTER(Context2d::SetMiterLimit) { - double n = Nan::To(value).FromMaybe(0); - if (n > 0) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_set_miter_limit(context->context(), n); - } -} - -/* - * Get line width. - */ - -NAN_GETTER(Context2d::GetLineWidth) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(cairo_get_line_width(context->context()))); -} - -/* - * Set line width. - */ - -NAN_SETTER(Context2d::SetLineWidth) { - double n = Nan::To(value).FromMaybe(0); - if (n > 0 && n != std::numeric_limits::infinity()) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_set_line_width(context->context(), n); - } -} - -/* - * Get line join. - */ - -NAN_GETTER(Context2d::GetLineJoin) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - const char *join; - switch (cairo_get_line_join(context->context())) { - case CAIRO_LINE_JOIN_BEVEL: join = "bevel"; break; - case CAIRO_LINE_JOIN_ROUND: join = "round"; break; - default: join = "miter"; - } - info.GetReturnValue().Set(Nan::New(join).ToLocalChecked()); -} - -/* - * Set line join. - */ - -NAN_SETTER(Context2d::SetLineJoin) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - Nan::Utf8String type(Nan::To(value).ToLocalChecked()); - if (0 == strcmp("round", *type)) { - cairo_set_line_join(ctx, CAIRO_LINE_JOIN_ROUND); - } else if (0 == strcmp("bevel", *type)) { - cairo_set_line_join(ctx, CAIRO_LINE_JOIN_BEVEL); - } else { - cairo_set_line_join(ctx, CAIRO_LINE_JOIN_MITER); - } -} - -/* - * Get line cap. - */ - -NAN_GETTER(Context2d::GetLineCap) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - const char *cap; - switch (cairo_get_line_cap(context->context())) { - case CAIRO_LINE_CAP_ROUND: cap = "round"; break; - case CAIRO_LINE_CAP_SQUARE: cap = "square"; break; - default: cap = "butt"; - } - info.GetReturnValue().Set(Nan::New(cap).ToLocalChecked()); -} - -/* - * Set line cap. - */ - -NAN_SETTER(Context2d::SetLineCap) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - Nan::Utf8String type(Nan::To(value).ToLocalChecked()); - if (0 == strcmp("round", *type)) { - cairo_set_line_cap(ctx, CAIRO_LINE_CAP_ROUND); - } else if (0 == strcmp("square", *type)) { - cairo_set_line_cap(ctx, CAIRO_LINE_CAP_SQUARE); - } else { - cairo_set_line_cap(ctx, CAIRO_LINE_CAP_BUTT); - } -} - -/* - * Check if the given point is within the current path. - */ - -NAN_METHOD(Context2d::IsPointInPath) { - if (info[0]->IsNumber() && info[1]->IsNumber()) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - double x = Nan::To(info[0]).FromMaybe(0) - , y = Nan::To(info[1]).FromMaybe(0); - context->setFillRule(info[2]); - info.GetReturnValue().Set(Nan::New(cairo_in_fill(ctx, x, y) || cairo_in_stroke(ctx, x, y))); - return; - } - info.GetReturnValue().Set(Nan::False()); -} - -/* - * Set shadow color. - */ - -NAN_SETTER(Context2d::SetShadowColor) { - short ok; - Nan::Utf8String str(Nan::To(value).ToLocalChecked()); - uint32_t rgba = rgba_from_string(*str, &ok); - if (ok) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->state->shadow = rgba_create(rgba); - } -} - -/* - * Get shadow color. - */ - -NAN_GETTER(Context2d::GetShadowColor) { - char buf[64]; - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - rgba_to_string(context->state->shadow, buf, sizeof(buf)); - info.GetReturnValue().Set(Nan::New(buf).ToLocalChecked()); -} - -/* - * Set fill color, used internally for fillStyle= - */ - -void Context2d::_setFillColor(Local arg) { - short ok; - Nan::Utf8String str(arg); - uint32_t rgba = rgba_from_string(*str, &ok); - if (!ok) return; - state->fillPattern = state->fillGradient = NULL; - state->fill = rgba_create(rgba); -} - -/* - * Get fill color. - */ - -Local Context2d::_getFillColor() { - char buf[64]; - rgba_to_string(state->fill, buf, sizeof(buf)); - return Nan::New(buf).ToLocalChecked(); -} - -/* - * Set stroke color, used internally for strokeStyle= - */ - -void Context2d::_setStrokeColor(Local arg) { - short ok; - Nan::Utf8String str(arg); - uint32_t rgba = rgba_from_string(*str, &ok); - if (!ok) return; - state->strokePattern = state->strokeGradient = NULL; - state->stroke = rgba_create(rgba); -} - -/* - * Get stroke color. - */ - -Local Context2d::_getStrokeColor() { - char buf[64]; - rgba_to_string(state->stroke, buf, sizeof(buf)); - return Nan::New(buf).ToLocalChecked(); -} - -NAN_METHOD(Context2d::CreatePattern) { - Local image = info[0]; - Local repetition = info[1]; - - if (!Nan::To(repetition).FromMaybe(false)) - repetition = Nan::New("repeat").ToLocalChecked(); - - const int argc = 2; - Local argv[argc] = { image, repetition }; - - Local ctor = Nan::GetFunction(Nan::New(Pattern::constructor)).ToLocalChecked(); - Local instance = Nan::NewInstance(ctor, argc, argv).ToLocalChecked(); - - info.GetReturnValue().Set(instance); -} - -NAN_METHOD(Context2d::CreateLinearGradient) { - const int argc = 4; - Local argv[argc] = { info[0], info[1], info[2], info[3] }; - - Local ctor = Nan::GetFunction(Nan::New(Gradient::constructor)).ToLocalChecked(); - Local instance = Nan::NewInstance(ctor, argc, argv).ToLocalChecked(); - - info.GetReturnValue().Set(instance); -} - -NAN_METHOD(Context2d::CreateRadialGradient) { - const int argc = 6; - Local argv[argc] = { info[0], info[1], info[2], info[3], info[4], info[5] }; - - Local ctor = Nan::GetFunction(Nan::New(Gradient::constructor)).ToLocalChecked(); - Local instance = Nan::NewInstance(ctor, argc, argv).ToLocalChecked(); - - info.GetReturnValue().Set(instance); -} - -/* - * Bezier curve. - */ - -NAN_METHOD(Context2d::BezierCurveTo) { - double args[6]; - if(!checkArgs(info, args, 6)) - return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_curve_to(context->context() - , args[0] - , args[1] - , args[2] - , args[3] - , args[4] - , args[5]); -} - -/* - * Quadratic curve approximation from libsvg-cairo. - */ - -NAN_METHOD(Context2d::QuadraticCurveTo) { - double args[4]; - if(!checkArgs(info, args, 4)) - return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - - double x, y - , x1 = args[0] - , y1 = args[1] - , x2 = args[2] - , y2 = args[3]; - - cairo_get_current_point(ctx, &x, &y); - - if (0 == x && 0 == y) { - x = x1; - y = y1; - } - - cairo_curve_to(ctx - , x + 2.0 / 3.0 * (x1 - x), y + 2.0 / 3.0 * (y1 - y) - , x2 + 2.0 / 3.0 * (x1 - x2), y2 + 2.0 / 3.0 * (y1 - y2) - , x2 - , y2); -} - -/* - * Save state. - */ - -NAN_METHOD(Context2d::Save) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->save(); -} - -/* - * Restore state. - */ - -NAN_METHOD(Context2d::Restore) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->restore(); -} - -/* - * Creates a new subpath. - */ - -NAN_METHOD(Context2d::BeginPath) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_new_path(context->context()); -} - -/* - * Marks the subpath as closed. - */ - -NAN_METHOD(Context2d::ClosePath) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_close_path(context->context()); -} - -/* - * Rotate transformation. - */ - -NAN_METHOD(Context2d::Rotate) { - double args[1]; - if(!checkArgs(info, args, 1)) - return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_rotate(context->context(), args[0]); -} - -/* - * Modify the CTM. - */ - -NAN_METHOD(Context2d::Transform) { - double args[6]; - if(!checkArgs(info, args, 6)) - return; - - cairo_matrix_t matrix; - cairo_matrix_init(&matrix - , args[0] - , args[1] - , args[2] - , args[3] - , args[4] - , args[5]); - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_transform(context->context(), &matrix); -} - -/* - * Reset the CTM, used internally by setTransform(). - */ - -NAN_METHOD(Context2d::ResetTransform) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_identity_matrix(context->context()); -} - -/* - * Reset transform matrix to identity, then apply the given args. - */ - -NAN_METHOD(Context2d::SetTransform) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_identity_matrix(context->context()); - Context2d::Transform(info); -} - -/* - * Translate transformation. - */ - -NAN_METHOD(Context2d::Translate) { - double args[2]; - if(!checkArgs(info, args, 2)) - return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_translate(context->context(), args[0], args[1]); -} - -/* - * Scale transformation. - */ - -NAN_METHOD(Context2d::Scale) { - double args[2]; - if(!checkArgs(info, args, 2)) - return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_scale(context->context(), args[0], args[1]); -} - -/* - * Use path as clipping region. - */ - -NAN_METHOD(Context2d::Clip) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->setFillRule(info[0]); - cairo_t *ctx = context->context(); - cairo_clip_preserve(ctx); -} - -/* - * Fill the path. - */ - -NAN_METHOD(Context2d::Fill) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->setFillRule(info[0]); - context->fill(true); -} - -/* - * Stroke the path. - */ - -NAN_METHOD(Context2d::Stroke) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->stroke(true); -} - -/* - * Helper for fillText/strokeText - */ - -double -get_text_scale(PangoLayout *layout, double maxWidth) { - - PangoRectangle logical_rect; - pango_layout_get_pixel_extents(layout, NULL, &logical_rect); - - if (logical_rect.width > maxWidth) { - return maxWidth / logical_rect.width; - } else { - return 1.0; - } -} - -void -paintText(const Nan::FunctionCallbackInfo &info, bool stroke) { - int argsNum = info.Length() >= 4 ? 3 : 2; - - if (argsNum == 3 && info[3]->IsUndefined()) - argsNum = 2; - - double args[3]; - if(!checkArgs(info, args, argsNum, 1)) - return; - - Nan::Utf8String str(Nan::To(info[0]).ToLocalChecked()); - double x = args[0]; - double y = args[1]; - double scaled_by = 1; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - PangoLayout *layout = context->layout(); - - pango_layout_set_text(layout, *str, -1); - pango_cairo_update_layout(context->context(), layout); - - if (argsNum == 3) { - scaled_by = get_text_scale(layout, args[2]); - cairo_save(context->context()); - cairo_scale(context->context(), scaled_by, 1); - } - - context->savePath(); - if (context->state->textDrawingMode == TEXT_DRAW_GLYPHS) { - if (stroke == true) { context->stroke(); } else { context->fill(); } - context->setTextPath(x / scaled_by, y); - } else if (context->state->textDrawingMode == TEXT_DRAW_PATHS) { - context->setTextPath(x / scaled_by, y); - if (stroke == true) { context->stroke(); } else { context->fill(); } - } - context->restorePath(); - if (argsNum == 3) { - cairo_restore(context->context()); - } -} - -/* - * Fill text at (x, y). - */ - -NAN_METHOD(Context2d::FillText) { - paintText(info, false); -} - -/* - * Stroke text at (x ,y). - */ - -NAN_METHOD(Context2d::StrokeText) { - paintText(info, true); -} - -/* - * Gets the baseline adjustment in device pixels - */ -inline double getBaselineAdjustment(PangoLayout* layout, short baseline) { - PangoRectangle logical_rect; - pango_layout_line_get_extents(pango_layout_get_line(layout, 0), NULL, &logical_rect); - - double scale = 1.0 / PANGO_SCALE; - double ascent = scale * pango_layout_get_baseline(layout); - double descent = scale * logical_rect.height - ascent; - - switch (baseline) { - case TEXT_BASELINE_ALPHABETIC: - return ascent; - case TEXT_BASELINE_MIDDLE: - return (ascent + descent) / 2.0; - case TEXT_BASELINE_BOTTOM: - return ascent + descent; - default: - return 0; - } -} - -/* - * Set text path for the string in the layout at (x, y). - * This function is called by paintText and won't behave correctly - * if is not called from there. - * it needs pango_layout_set_text and pango_cairo_update_layout to be called before - */ - -void -Context2d::setTextPath(double x, double y) { - PangoRectangle logical_rect; - - switch (state->textAlignment) { - // center - case 0: - pango_layout_get_pixel_extents(_layout, NULL, &logical_rect); - x -= logical_rect.width / 2; - break; - // right - case 1: - pango_layout_get_pixel_extents(_layout, NULL, &logical_rect); - x -= logical_rect.width; - break; - } - - y -= getBaselineAdjustment(_layout, state->textBaseline); - - cairo_move_to(_context, x, y); - if (state->textDrawingMode == TEXT_DRAW_PATHS) { - pango_cairo_layout_path(_context, _layout); - } else if (state->textDrawingMode == TEXT_DRAW_GLYPHS) { - pango_cairo_show_layout(_context, _layout); - } -} - -/* - * Adds a point to the current subpath. - */ - -NAN_METHOD(Context2d::LineTo) { - double args[2]; - if(!checkArgs(info, args, 2)) - return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_line_to(context->context(), args[0], args[1]); -} - -/* - * Creates a new subpath at the given point. - */ - -NAN_METHOD(Context2d::MoveTo) { - double args[2]; - if(!checkArgs(info, args, 2)) - return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_move_to(context->context(), args[0], args[1]); -} - -/* - * Get font. - */ - -NAN_GETTER(Context2d::GetFont) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Isolate *iso = Isolate::GetCurrent(); - Local font; - - if (context->_font.IsEmpty()) - font = Nan::New("10px sans-serif").ToLocalChecked(); - else - font = context->_font.Get(iso); - - info.GetReturnValue().Set(font); -} - -/* - * Set font: - * - weight - * - style - * - size - * - unit - * - family - */ - -NAN_SETTER(Context2d::SetFont) { - if (!value->IsString()) return; - - Isolate *iso = Isolate::GetCurrent(); - Local ctx = Nan::GetCurrentContext(); - - Local str = Nan::To(value).ToLocalChecked(); - if (!str->Length()) return; - - const int argc = 1; - Local argv[argc] = { value }; - - Local mparsed = Nan::Call(_parseFont.Get(iso), ctx->Global(), argc, argv).ToLocalChecked(); - // parseFont returns undefined for invalid CSS font strings - if (mparsed->IsUndefined()) return; - Local font = Nan::To(mparsed).ToLocalChecked(); - - Nan::Utf8String weight(Nan::Get(font, Nan::New("weight").ToLocalChecked()).ToLocalChecked()); - Nan::Utf8String style(Nan::Get(font, Nan::New("style").ToLocalChecked()).ToLocalChecked()); - double size = Nan::To(Nan::Get(font, Nan::New("size").ToLocalChecked()).ToLocalChecked()).FromMaybe(0); - Nan::Utf8String unit(Nan::Get(font, Nan::New("unit").ToLocalChecked()).ToLocalChecked()); - Nan::Utf8String family(Nan::Get(font, Nan::New("family").ToLocalChecked()).ToLocalChecked()); - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - - PangoFontDescription *desc = pango_font_description_copy(context->state->fontDescription); - pango_font_description_free(context->state->fontDescription); - - pango_font_description_set_style(desc, Canvas::GetStyleFromCSSString(*style)); - pango_font_description_set_weight(desc, Canvas::GetWeightFromCSSString(*weight)); - - if (strlen(*family) > 0) pango_font_description_set_family(desc, *family); - - PangoFontDescription *sys_desc = Canvas::ResolveFontDescription(desc); - pango_font_description_free(desc); - - if (size > 0) pango_font_description_set_absolute_size(sys_desc, size * PANGO_SCALE); - - context->state->fontDescription = sys_desc; - pango_layout_set_font_description(context->_layout, sys_desc); - - context->_font.Reset(value); -} - -/* - * Get text baseline. - */ - -NAN_GETTER(Context2d::GetTextBaseline) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Isolate *iso = Isolate::GetCurrent(); - Local font; - - if (context->_textBaseline.IsEmpty()) - font = Nan::New("alphabetic").ToLocalChecked(); - else - font = context->_textBaseline.Get(iso); - - info.GetReturnValue().Set(font); -} - -/* - * Set text baseline. - */ - -NAN_SETTER(Context2d::SetTextBaseline) { - if (!value->IsString()) return; - - Nan::Utf8String opStr(Nan::To(value).ToLocalChecked()); - const std::map modes = { - {"alphabetic", 0}, - {"top", 1}, - {"bottom", 2}, - {"middle", 3}, - {"ideographic", 4}, - {"hanging", 5} - }; - auto op = modes.find(*opStr); - if (op == modes.end()) return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->state->textBaseline = op->second; - context->_textBaseline.Reset(value); -} - -/* - * Get text align. - */ - -NAN_GETTER(Context2d::GetTextAlign) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - Isolate *iso = Isolate::GetCurrent(); - Local font; - - if (context->_textAlign.IsEmpty()) - font = Nan::New("start").ToLocalChecked(); - else - font = context->_textAlign.Get(iso); - - info.GetReturnValue().Set(font); -} - -/* - * Set text align. - */ - -NAN_SETTER(Context2d::SetTextAlign) { - if (!value->IsString()) return; - - Nan::Utf8String opStr(Nan::To(value).ToLocalChecked()); - const std::map modes = { - {"center", 0}, - {"left", -1}, - {"start", -1}, - {"right", 1}, - {"end", 1} - }; - auto op = modes.find(*opStr); - if (op == modes.end()) return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - context->state->textAlignment = op->second; - context->_textAlign.Reset(value); -} - -/* - * Return the given text extents. - * TODO: Support for: - * hangingBaseline, ideographicBaseline, - * fontBoundingBoxAscent, fontBoundingBoxDescent - */ - -NAN_METHOD(Context2d::MeasureText) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - - Nan::Utf8String str(Nan::To(info[0]).ToLocalChecked()); - Local obj = Nan::New(); - - PangoRectangle _ink_rect, _logical_rect; - float_rectangle ink_rect, logical_rect; - PangoFontMetrics *metrics; - PangoLayout *layout = context->layout(); - - pango_layout_set_text(layout, *str, -1); - pango_cairo_update_layout(ctx, layout); - - // Normally you could use pango_layout_get_pixel_extents and be done, or use - // pango_extents_to_pixels, but both of those round the pixels, so we have to - // divide by PANGO_SCALE manually - pango_layout_get_extents(layout, &_ink_rect, &_logical_rect); - - float inverse_pango_scale = 1. / PANGO_SCALE; - - logical_rect.x = _logical_rect.x * inverse_pango_scale; - logical_rect.y = _logical_rect.y * inverse_pango_scale; - logical_rect.width = _logical_rect.width * inverse_pango_scale; - logical_rect.height = _logical_rect.height * inverse_pango_scale; - - ink_rect.x = _ink_rect.x * inverse_pango_scale; - ink_rect.y = _ink_rect.y * inverse_pango_scale; - ink_rect.width = _ink_rect.width * inverse_pango_scale; - ink_rect.height = _ink_rect.height * inverse_pango_scale; - - metrics = PANGO_LAYOUT_GET_METRICS(layout); - - double x_offset; - switch (context->state->textAlignment) { - case 0: // center - x_offset = logical_rect.width / 2; - break; - case 1: // right - x_offset = logical_rect.width; - break; - default: // left - x_offset = 0.0; - } - - cairo_matrix_t matrix; - cairo_get_matrix(ctx, &matrix); - double y_offset = getBaselineAdjustment(layout, context->state->textBaseline); - - Nan::Set(obj, - Nan::New("width").ToLocalChecked(), - Nan::New(logical_rect.width)).Check(); - Nan::Set(obj, - Nan::New("actualBoundingBoxLeft").ToLocalChecked(), - Nan::New(x_offset - PANGO_LBEARING(logical_rect))).Check(); - Nan::Set(obj, - Nan::New("actualBoundingBoxRight").ToLocalChecked(), - Nan::New(x_offset + PANGO_RBEARING(logical_rect))).Check(); - Nan::Set(obj, - Nan::New("actualBoundingBoxAscent").ToLocalChecked(), - Nan::New(y_offset + PANGO_ASCENT(ink_rect))).Check(); - Nan::Set(obj, - Nan::New("actualBoundingBoxDescent").ToLocalChecked(), - Nan::New(PANGO_DESCENT(ink_rect) - y_offset)).Check(); - Nan::Set(obj, - Nan::New("emHeightAscent").ToLocalChecked(), - Nan::New(-(PANGO_ASCENT(logical_rect) - y_offset))).Check(); - Nan::Set(obj, - Nan::New("emHeightDescent").ToLocalChecked(), - Nan::New(PANGO_DESCENT(logical_rect) - y_offset)).Check(); - Nan::Set(obj, - Nan::New("alphabeticBaseline").ToLocalChecked(), - Nan::New(-(pango_font_metrics_get_ascent(metrics) * inverse_pango_scale - y_offset))).Check(); - - pango_font_metrics_unref(metrics); - - info.GetReturnValue().Set(obj); -} - -/* - * Set line dash - * ref: http://www.w3.org/TR/2dcontext/#dom-context-2d-setlinedash - */ - -NAN_METHOD(Context2d::SetLineDash) { - if (!info[0]->IsArray()) return; - Local dash = Local::Cast(info[0]); - uint32_t dashes = dash->Length() & 1 ? dash->Length() * 2 : dash->Length(); - uint32_t zero_dashes = 0; - std::vector a(dashes); - for (uint32_t i=0; i d = Nan::Get(dash, i % dash->Length()).ToLocalChecked(); - if (!d->IsNumber()) return; - a[i] = Nan::To(d).FromMaybe(0); - if (a[i] == 0) zero_dashes++; - if (a[i] < 0 || isnan(a[i]) || isinf(a[i])) return; - } - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - double offset; - cairo_get_dash(ctx, NULL, &offset); - if (zero_dashes == dashes) { - std::vector b(0); - cairo_set_dash(ctx, b.data(), 0, offset); - } else { - cairo_set_dash(ctx, a.data(), dashes, offset); - } -} - -/* - * Get line dash - * ref: http://www.w3.org/TR/2dcontext/#dom-context-2d-setlinedash - */ -NAN_METHOD(Context2d::GetLineDash) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - int dashes = cairo_get_dash_count(ctx); - std::vector a(dashes); - cairo_get_dash(ctx, a.data(), NULL); - - Local dash = Nan::New(dashes); - for (int i=0; i(i), Nan::New(a[i])).Check(); - } - - info.GetReturnValue().Set(dash); -} - -/* - * Set line dash offset - * ref: http://www.w3.org/TR/2dcontext/#dom-context-2d-setlinedash - */ -NAN_SETTER(Context2d::SetLineDashOffset) { - double offset = Nan::To(value).FromMaybe(0); - if (isnan(offset) || isinf(offset)) return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - - int dashes = cairo_get_dash_count(ctx); - std::vector a(dashes); - cairo_get_dash(ctx, a.data(), NULL); - cairo_set_dash(ctx, a.data(), dashes, offset); -} - -/* - * Get line dash offset - * ref: http://www.w3.org/TR/2dcontext/#dom-context-2d-setlinedash - */ -NAN_GETTER(Context2d::GetLineDashOffset) { - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - double offset; - cairo_get_dash(ctx, NULL, &offset); - - info.GetReturnValue().Set(Nan::New(offset)); -} - -/* - * Fill the rectangle defined by x, y, width and height. - */ - -NAN_METHOD(Context2d::FillRect) { - RECT_ARGS; - if (0 == width || 0 == height) return; - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - context->savePath(); - cairo_rectangle(ctx, x, y, width, height); - context->fill(); - context->restorePath(); -} - -/* - * Stroke the rectangle defined by x, y, width and height. - */ - -NAN_METHOD(Context2d::StrokeRect) { - RECT_ARGS; - if (0 == width && 0 == height) return; - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - context->savePath(); - cairo_rectangle(ctx, x, y, width, height); - context->stroke(); - context->restorePath(); -} - -/* - * Clears all pixels defined by x, y, width and height. - */ - -NAN_METHOD(Context2d::ClearRect) { - RECT_ARGS; - if (0 == width || 0 == height) return; - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - cairo_save(ctx); - context->savePath(); - cairo_rectangle(ctx, x, y, width, height); - cairo_set_operator(ctx, CAIRO_OPERATOR_CLEAR); - cairo_fill(ctx); - context->restorePath(); - cairo_restore(ctx); -} - -/* - * Adds a rectangle subpath. - */ - -NAN_METHOD(Context2d::Rect) { - RECT_ARGS; - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - if (width == 0) { - cairo_move_to(ctx, x, y); - cairo_line_to(ctx, x, y + height); - } else if (height == 0) { - cairo_move_to(ctx, x, y); - cairo_line_to(ctx, x + width, y); - } else { - cairo_rectangle(ctx, x, y, width, height); - } -} - -/* - * Adds an arc at x, y with the given radis and start/end angles. - */ - -NAN_METHOD(Context2d::Arc) { - if (!info[0]->IsNumber() - || !info[1]->IsNumber() - || !info[2]->IsNumber() - || !info[3]->IsNumber() - || !info[4]->IsNumber()) return; - - bool anticlockwise = Nan::To(info[5]).FromMaybe(false); - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - - if (anticlockwise && M_PI * 2 != Nan::To(info[4]).FromMaybe(0)) { - cairo_arc_negative(ctx - , Nan::To(info[0]).FromMaybe(0) - , Nan::To(info[1]).FromMaybe(0) - , Nan::To(info[2]).FromMaybe(0) - , Nan::To(info[3]).FromMaybe(0) - , Nan::To(info[4]).FromMaybe(0)); - } else { - cairo_arc(ctx - , Nan::To(info[0]).FromMaybe(0) - , Nan::To(info[1]).FromMaybe(0) - , Nan::To(info[2]).FromMaybe(0) - , Nan::To(info[3]).FromMaybe(0) - , Nan::To(info[4]).FromMaybe(0)); - } -} - -/* - * Adds an arcTo point (x0,y0) to (x1,y1) with the given radius. - * - * Implementation influenced by WebKit. - */ - -NAN_METHOD(Context2d::ArcTo) { - double args[5]; - if(!checkArgs(info, args, 5)) - return; - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - - // Current path point - double x, y; - cairo_get_current_point(ctx, &x, &y); - Point p0(x, y); - - // Point (x0,y0) - Point p1(args[0], args[1]); - - // Point (x1,y1) - Point p2(args[2], args[3]); - - float radius = args[4]; - - if ((p1.x == p0.x && p1.y == p0.y) - || (p1.x == p2.x && p1.y == p2.y) - || radius == 0.f) { - cairo_line_to(ctx, p1.x, p1.y); - return; - } - - Point p1p0((p0.x - p1.x),(p0.y - p1.y)); - Point p1p2((p2.x - p1.x),(p2.y - p1.y)); - float p1p0_length = sqrtf(p1p0.x * p1p0.x + p1p0.y * p1p0.y); - float p1p2_length = sqrtf(p1p2.x * p1p2.x + p1p2.y * p1p2.y); - - double cos_phi = (p1p0.x * p1p2.x + p1p0.y * p1p2.y) / (p1p0_length * p1p2_length); - // all points on a line logic - if (-1 == cos_phi) { - cairo_line_to(ctx, p1.x, p1.y); - return; - } - - if (1 == cos_phi) { - // add infinite far away point - unsigned int max_length = 65535; - double factor_max = max_length / p1p0_length; - Point ep((p0.x + factor_max * p1p0.x), (p0.y + factor_max * p1p0.y)); - cairo_line_to(ctx, ep.x, ep.y); - return; - } - - float tangent = radius / tan(acos(cos_phi) / 2); - float factor_p1p0 = tangent / p1p0_length; - Point t_p1p0((p1.x + factor_p1p0 * p1p0.x), (p1.y + factor_p1p0 * p1p0.y)); - - Point orth_p1p0(p1p0.y, -p1p0.x); - float orth_p1p0_length = sqrt(orth_p1p0.x * orth_p1p0.x + orth_p1p0.y * orth_p1p0.y); - float factor_ra = radius / orth_p1p0_length; - - double cos_alpha = (orth_p1p0.x * p1p2.x + orth_p1p0.y * p1p2.y) / (orth_p1p0_length * p1p2_length); - if (cos_alpha < 0.f) - orth_p1p0 = Point(-orth_p1p0.x, -orth_p1p0.y); - - Point p((t_p1p0.x + factor_ra * orth_p1p0.x), (t_p1p0.y + factor_ra * orth_p1p0.y)); - - orth_p1p0 = Point(-orth_p1p0.x, -orth_p1p0.y); - float sa = acos(orth_p1p0.x / orth_p1p0_length); - if (orth_p1p0.y < 0.f) - sa = 2 * M_PI - sa; - - bool anticlockwise = false; - - float factor_p1p2 = tangent / p1p2_length; - Point t_p1p2((p1.x + factor_p1p2 * p1p2.x), (p1.y + factor_p1p2 * p1p2.y)); - Point orth_p1p2((t_p1p2.x - p.x),(t_p1p2.y - p.y)); - float orth_p1p2_length = sqrtf(orth_p1p2.x * orth_p1p2.x + orth_p1p2.y * orth_p1p2.y); - float ea = acos(orth_p1p2.x / orth_p1p2_length); - - if (orth_p1p2.y < 0) ea = 2 * M_PI - ea; - if ((sa > ea) && ((sa - ea) < M_PI)) anticlockwise = true; - if ((sa < ea) && ((ea - sa) > M_PI)) anticlockwise = true; - - cairo_line_to(ctx, t_p1p0.x, t_p1p0.y); - - if (anticlockwise && M_PI * 2 != radius) { - cairo_arc_negative(ctx - , p.x - , p.y - , radius - , sa - , ea); - } else { - cairo_arc(ctx - , p.x - , p.y - , radius - , sa - , ea); - } -} - -/* - * Adds an ellipse to the path which is centered at (x, y) position with the - * radii radiusX and radiusY starting at startAngle and ending at endAngle - * going in the given direction by anticlockwise (defaulting to clockwise). - */ - -NAN_METHOD(Context2d::Ellipse) { - double args[7]; - if(!checkArgs(info, args, 7)) - return; - - double radiusX = args[2]; - double radiusY = args[3]; - - if (radiusX == 0 || radiusY == 0) return; - - double x = args[0]; - double y = args[1]; - double rotation = args[4]; - double startAngle = args[5]; - double endAngle = args[6]; - bool anticlockwise = Nan::To(info[7]).FromMaybe(false); - - Context2d *context = Nan::ObjectWrap::Unwrap(info.This()); - cairo_t *ctx = context->context(); - - // See https://www.cairographics.org/cookbook/ellipses/ - double xRatio = radiusX / radiusY; - - cairo_matrix_t save_matrix; - cairo_get_matrix(ctx, &save_matrix); - cairo_translate(ctx, x, y); - cairo_rotate(ctx, rotation); - cairo_scale(ctx, xRatio, 1.0); - cairo_translate(ctx, -x, -y); - if (anticlockwise && M_PI * 2 != args[4]) { - cairo_arc_negative(ctx, - x, - y, - radiusY, - startAngle, - endAngle); - } else { - cairo_arc(ctx, - x, - y, - radiusY, - startAngle, - endAngle); - } - cairo_set_matrix(ctx, &save_matrix); -} diff --git a/node_modules/canvas/src/CanvasRenderingContext2d.h b/node_modules/canvas/src/CanvasRenderingContext2d.h deleted file mode 100644 index 59d6f6d..0000000 --- a/node_modules/canvas/src/CanvasRenderingContext2d.h +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#pragma once - -#include "cairo.h" -#include "Canvas.h" -#include "color.h" -#include "nan.h" -#include - -typedef enum { - TEXT_DRAW_PATHS, - TEXT_DRAW_GLYPHS -} canvas_draw_mode_t; - -/* - * State struct. - * - * Used in conjunction with Save() / Restore() since - * cairo's gstate maintains only a single source pattern at a time. - */ - -typedef struct { - rgba_t fill; - rgba_t stroke; - cairo_filter_t patternQuality; - cairo_pattern_t *fillPattern; - cairo_pattern_t *strokePattern; - cairo_pattern_t *fillGradient; - cairo_pattern_t *strokeGradient; - float globalAlpha; - short textAlignment; - short textBaseline; - rgba_t shadow; - int shadowBlur; - double shadowOffsetX; - double shadowOffsetY; - canvas_draw_mode_t textDrawingMode; - PangoFontDescription *fontDescription; - bool imageSmoothingEnabled; -} canvas_state_t; - -/* - * Equivalent to a PangoRectangle but holds floats instead of ints - * (software pixels are stored here instead of pango units) - * - * Should be compatible with PANGO_ASCENT, PANGO_LBEARING, etc. - */ - -typedef struct { - float x; - float y; - float width; - float height; -} float_rectangle; - -void state_assign_fontFamily(canvas_state_t *state, const char *str); - -class Context2d: public Nan::ObjectWrap { - public: - short stateno; - canvas_state_t *states[CANVAS_MAX_STATES]; - canvas_state_t *state; - Context2d(Canvas *canvas); - static Nan::Persistent _DOMMatrix; - static Nan::Persistent _parseFont; - static Nan::Persistent constructor; - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(New); - static NAN_METHOD(SaveExternalModules); - static NAN_METHOD(DrawImage); - static NAN_METHOD(PutImageData); - static NAN_METHOD(Save); - static NAN_METHOD(Restore); - static NAN_METHOD(Rotate); - static NAN_METHOD(Translate); - static NAN_METHOD(Scale); - static NAN_METHOD(Transform); - static NAN_METHOD(ResetTransform); - static NAN_METHOD(SetTransform); - static NAN_METHOD(IsPointInPath); - static NAN_METHOD(BeginPath); - static NAN_METHOD(ClosePath); - static NAN_METHOD(AddPage); - static NAN_METHOD(Clip); - static NAN_METHOD(Fill); - static NAN_METHOD(Stroke); - static NAN_METHOD(FillText); - static NAN_METHOD(StrokeText); - static NAN_METHOD(SetFont); - static NAN_METHOD(SetFillColor); - static NAN_METHOD(SetStrokeColor); - static NAN_METHOD(SetStrokePattern); - static NAN_METHOD(SetTextAlignment); - static NAN_METHOD(SetLineDash); - static NAN_METHOD(GetLineDash); - static NAN_METHOD(MeasureText); - static NAN_METHOD(BezierCurveTo); - static NAN_METHOD(QuadraticCurveTo); - static NAN_METHOD(LineTo); - static NAN_METHOD(MoveTo); - static NAN_METHOD(FillRect); - static NAN_METHOD(StrokeRect); - static NAN_METHOD(ClearRect); - static NAN_METHOD(Rect); - static NAN_METHOD(Arc); - static NAN_METHOD(ArcTo); - static NAN_METHOD(Ellipse); - static NAN_METHOD(GetImageData); - static NAN_METHOD(CreateImageData); - static NAN_METHOD(GetStrokeColor); - static NAN_METHOD(CreatePattern); - static NAN_METHOD(CreateLinearGradient); - static NAN_METHOD(CreateRadialGradient); - static NAN_GETTER(GetFormat); - static NAN_GETTER(GetPatternQuality); - static NAN_GETTER(GetImageSmoothingEnabled); - static NAN_GETTER(GetGlobalCompositeOperation); - static NAN_GETTER(GetGlobalAlpha); - static NAN_GETTER(GetShadowColor); - static NAN_GETTER(GetMiterLimit); - static NAN_GETTER(GetLineCap); - static NAN_GETTER(GetLineJoin); - static NAN_GETTER(GetLineWidth); - static NAN_GETTER(GetLineDashOffset); - static NAN_GETTER(GetShadowOffsetX); - static NAN_GETTER(GetShadowOffsetY); - static NAN_GETTER(GetShadowBlur); - static NAN_GETTER(GetAntiAlias); - static NAN_GETTER(GetTextDrawingMode); - static NAN_GETTER(GetQuality); - static NAN_GETTER(GetCurrentTransform); - static NAN_GETTER(GetFillStyle); - static NAN_GETTER(GetStrokeStyle); - static NAN_GETTER(GetFont); - static NAN_GETTER(GetTextBaseline); - static NAN_GETTER(GetTextAlign); - static NAN_SETTER(SetPatternQuality); - static NAN_SETTER(SetImageSmoothingEnabled); - static NAN_SETTER(SetGlobalCompositeOperation); - static NAN_SETTER(SetGlobalAlpha); - static NAN_SETTER(SetShadowColor); - static NAN_SETTER(SetMiterLimit); - static NAN_SETTER(SetLineCap); - static NAN_SETTER(SetLineJoin); - static NAN_SETTER(SetLineWidth); - static NAN_SETTER(SetLineDashOffset); - static NAN_SETTER(SetShadowOffsetX); - static NAN_SETTER(SetShadowOffsetY); - static NAN_SETTER(SetShadowBlur); - static NAN_SETTER(SetAntiAlias); - static NAN_SETTER(SetTextDrawingMode); - static NAN_SETTER(SetQuality); - static NAN_SETTER(SetCurrentTransform); - static NAN_SETTER(SetFillStyle); - static NAN_SETTER(SetStrokeStyle); - static NAN_SETTER(SetFont); - static NAN_SETTER(SetTextBaseline); - static NAN_SETTER(SetTextAlign); - inline void setContext(cairo_t *ctx) { _context = ctx; } - inline cairo_t *context(){ return _context; } - inline Canvas *canvas(){ return _canvas; } - inline bool hasShadow(); - void inline setSourceRGBA(rgba_t color); - void inline setSourceRGBA(cairo_t *ctx, rgba_t color); - void setTextPath(double x, double y); - void blur(cairo_surface_t *surface, int radius); - void shadow(void (fn)(cairo_t *cr)); - void shadowStart(); - void shadowApply(); - void savePath(); - void restorePath(); - void saveState(); - void restoreState(); - void inline setFillRule(v8::Local value); - void fill(bool preserve = false); - void stroke(bool preserve = false); - void save(); - void restore(); - void setFontFromState(); - void resetState(bool init = false); - inline PangoLayout *layout(){ return _layout; } - - private: - ~Context2d(); - void _resetPersistentHandles(); - v8::Local _getFillColor(); - v8::Local _getStrokeColor(); - void _setFillColor(v8::Local arg); - void _setFillPattern(v8::Local arg); - void _setStrokeColor(v8::Local arg); - void _setStrokePattern(v8::Local arg); - Nan::Persistent _fillStyle; - Nan::Persistent _strokeStyle; - Nan::Persistent _font; - Nan::Persistent _textBaseline; - Nan::Persistent _textAlign; - Canvas *_canvas; - cairo_t *_context; - cairo_path_t *_path; - PangoLayout *_layout; -}; diff --git a/node_modules/canvas/src/Image.cc b/node_modules/canvas/src/Image.cc deleted file mode 100644 index ed5d8c7..0000000 --- a/node_modules/canvas/src/Image.cc +++ /dev/null @@ -1,1393 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#include "Image.h" - -#include "bmp/BMPParser.h" -#include "Canvas.h" -#include -#include -#include -#include -#include "Util.h" - -/* Cairo limit: - * https://lists.cairographics.org/archives/cairo/2010-December/021422.html - */ -static constexpr int canvas_max_side = (1 << 15) - 1; - -#ifdef HAVE_GIF -typedef struct { - uint8_t *buf; - unsigned len; - unsigned pos; -} gif_data_t; -#endif - -#ifdef HAVE_JPEG -#include - -struct canvas_jpeg_error_mgr: jpeg_error_mgr { - Image* image; - jmp_buf setjmp_buffer; -}; -#endif - -/* - * Read closure used by loadFromBuffer. - */ - -typedef struct { - unsigned len; - uint8_t *buf; -} read_closure_t; - -using namespace v8; - -Nan::Persistent Image::constructor; - -/* - * Initialize Image. - */ - -void -Image::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - Nan::HandleScope scope; - - Local ctor = Nan::New(Image::New); - constructor.Reset(ctor); - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("Image").ToLocalChecked()); - - // Prototype - Local proto = ctor->PrototypeTemplate(); - SetProtoAccessor(proto, Nan::New("complete").ToLocalChecked(), GetComplete, NULL, ctor); - SetProtoAccessor(proto, Nan::New("width").ToLocalChecked(), GetWidth, SetWidth, ctor); - SetProtoAccessor(proto, Nan::New("height").ToLocalChecked(), GetHeight, SetHeight, ctor); - SetProtoAccessor(proto, Nan::New("naturalWidth").ToLocalChecked(), GetNaturalWidth, NULL, ctor); - SetProtoAccessor(proto, Nan::New("naturalHeight").ToLocalChecked(), GetNaturalHeight, NULL, ctor); - SetProtoAccessor(proto, Nan::New("dataMode").ToLocalChecked(), GetDataMode, SetDataMode, ctor); - - ctor->Set(Nan::New("MODE_IMAGE").ToLocalChecked(), Nan::New(DATA_IMAGE)); - ctor->Set(Nan::New("MODE_MIME").ToLocalChecked(), Nan::New(DATA_MIME)); - - Local ctx = Nan::GetCurrentContext(); - Nan::Set(target, Nan::New("Image").ToLocalChecked(), ctor->GetFunction(ctx).ToLocalChecked()); - - // Used internally in lib/image.js - NAN_EXPORT(target, GetSource); - NAN_EXPORT(target, SetSource); -} - -/* - * Initialize a new Image. - */ - -NAN_METHOD(Image::New) { - if (!info.IsConstructCall()) { - return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); - } - - Image *img = new Image; - img->data_mode = DATA_IMAGE; - img->Wrap(info.This()); - Nan::Set(info.This(), Nan::New("onload").ToLocalChecked(), Nan::Null()).Check(); - Nan::Set(info.This(), Nan::New("onerror").ToLocalChecked(), Nan::Null()).Check(); - info.GetReturnValue().Set(info.This()); -} - -/* - * Get complete boolean. - */ - -NAN_GETTER(Image::GetComplete) { - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(Image::COMPLETE == img->state)); -} - -/* - * Get dataMode. - */ - -NAN_GETTER(Image::GetDataMode) { - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(img->data_mode)); -} - -/* - * Set dataMode. - */ - -NAN_SETTER(Image::SetDataMode) { - if (value->IsNumber()) { - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - int mode = Nan::To(value).FromMaybe(0); - img->data_mode = (data_mode_t) mode; - } -} - -/* - * Get natural width - */ - -NAN_GETTER(Image::GetNaturalWidth) { - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(img->naturalWidth)); -} - -/* - * Get width. - */ - -NAN_GETTER(Image::GetWidth) { - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(img->width)); -} - -/* - * Set width. - */ - -NAN_SETTER(Image::SetWidth) { - if (value->IsNumber()) { - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - img->width = Nan::To(value).FromMaybe(0); - } -} - -/* - * Get natural height - */ - -NAN_GETTER(Image::GetNaturalHeight) { - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(img->naturalHeight)); -} - -/* - * Get height. - */ - -NAN_GETTER(Image::GetHeight) { - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(img->height)); -} -/* - * Set height. - */ - -NAN_SETTER(Image::SetHeight) { - if (value->IsNumber()) { - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - img->height = Nan::To(value).FromMaybe(0); - } -} - -/* - * Get src path. - */ - -NAN_METHOD(Image::GetSource){ - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(img->filename ? img->filename : "").ToLocalChecked()); -} - -/* - * Clean up assets and variables. - */ - -void -Image::clearData() { - if (_surface) { - cairo_surface_destroy(_surface); - Nan::AdjustExternalMemory(-_data_len); - _data_len = 0; - _surface = NULL; - } - - delete[] _data; - _data = nullptr; - - free(filename); - filename = NULL; - -#ifdef HAVE_RSVG - if (_rsvg != NULL) { - g_object_unref(_rsvg); - _rsvg = NULL; - } -#endif - - width = height = 0; - naturalWidth = naturalHeight = 0; - state = DEFAULT; -} - -/* - * Set src path. - */ - -NAN_METHOD(Image::SetSource){ - Image *img = Nan::ObjectWrap::Unwrap(info.This()); - cairo_status_t status = CAIRO_STATUS_READ_ERROR; - - Local value = info[0]; - - img->clearData(); - // Clear errno in case some unrelated previous syscall failed - errno = 0; - - // url string - if (value->IsString()) { - Nan::Utf8String src(value); - if (img->filename) free(img->filename); - img->filename = strdup(*src); - status = img->load(); - // Buffer - } else if (node::Buffer::HasInstance(value)) { - uint8_t *buf = (uint8_t *) node::Buffer::Data(Nan::To(value).ToLocalChecked()); - unsigned len = node::Buffer::Length(Nan::To(value).ToLocalChecked()); - status = img->loadFromBuffer(buf, len); - } - - if (status) { - Local onerrorFn = Nan::Get(info.This(), Nan::New("onerror").ToLocalChecked()).ToLocalChecked(); - if (onerrorFn->IsFunction()) { - Local argv[1]; - CanvasError errorInfo = img->errorInfo; - if (errorInfo.cerrno) { - argv[0] = Nan::ErrnoException(errorInfo.cerrno, errorInfo.syscall.c_str(), errorInfo.message.c_str(), errorInfo.path.c_str()); - } else if (!errorInfo.message.empty()) { - argv[0] = Nan::Error(Nan::New(errorInfo.message).ToLocalChecked()); - } else { - argv[0] = Nan::Error(Nan::New(cairo_status_to_string(status)).ToLocalChecked()); - } - Local ctx = Nan::GetCurrentContext(); - Nan::Call(onerrorFn.As(), ctx->Global(), 1, argv).ToLocalChecked(); - } - } else { - img->loaded(); - Local onloadFn = Nan::Get(info.This(), Nan::New("onload").ToLocalChecked()).ToLocalChecked(); - if (onloadFn->IsFunction()) { - Local ctx = Nan::GetCurrentContext(); - Nan::Call(onloadFn.As(), ctx->Global(), 0, NULL).ToLocalChecked(); - } - } -} - -/* - * Load image data from `buf` by sniffing - * the bytes to determine format. - */ - -cairo_status_t -Image::loadFromBuffer(uint8_t *buf, unsigned len) { - uint8_t data[4] = {0}; - memcpy(data, buf, (len < 4 ? len : 4) * sizeof(uint8_t)); - - if (isPNG(data)) return loadPNGFromBuffer(buf); - - if (isGIF(data)) { -#ifdef HAVE_GIF - return loadGIFFromBuffer(buf, len); -#else - this->errorInfo.set("node-canvas was built without GIF support"); - return CAIRO_STATUS_READ_ERROR; -#endif - } - - if (isJPEG(data)) { -#ifdef HAVE_JPEG - if (DATA_IMAGE == data_mode) return loadJPEGFromBuffer(buf, len); - if (DATA_MIME == data_mode) return decodeJPEGBufferIntoMimeSurface(buf, len); - if ((DATA_IMAGE | DATA_MIME) == data_mode) { - cairo_status_t status; - status = loadJPEGFromBuffer(buf, len); - if (status) return status; - return assignDataAsMime(buf, len, CAIRO_MIME_TYPE_JPEG); - } -#else // HAVE_JPEG - this->errorInfo.set("node-canvas was built without JPEG support"); - return CAIRO_STATUS_READ_ERROR; -#endif - } - - // confirm svg using first 1000 chars - // if a very long comment precedes the root tag, isSVG returns false - unsigned head_len = (len < 1000 ? len : 1000); - if (isSVG(buf, head_len)) { -#ifdef HAVE_RSVG - return loadSVGFromBuffer(buf, len); -#else - this->errorInfo.set("node-canvas was built without SVG support"); - return CAIRO_STATUS_READ_ERROR; -#endif - } - - if (isBMP(buf, len)) - return loadBMPFromBuffer(buf, len); - - this->errorInfo.set("Unsupported image type"); - return CAIRO_STATUS_READ_ERROR; -} - -/* - * Load PNG data from `buf`. - */ - -cairo_status_t -Image::loadPNGFromBuffer(uint8_t *buf) { - read_closure_t closure; - closure.len = 0; - closure.buf = buf; - _surface = cairo_image_surface_create_from_png_stream(readPNG, &closure); - cairo_status_t status = cairo_surface_status(_surface); - if (status) return status; - return CAIRO_STATUS_SUCCESS; -} - -/* - * Read PNG data. - */ - -cairo_status_t -Image::readPNG(void *c, uint8_t *data, unsigned int len) { - read_closure_t *closure = (read_closure_t *) c; - memcpy(data, closure->buf + closure->len, len); - closure->len += len; - return CAIRO_STATUS_SUCCESS; -} - -/* - * Initialize a new Image. - */ - -Image::Image() { - filename = NULL; - _data = nullptr; - _data_len = 0; - _surface = NULL; - width = height = 0; - naturalWidth = naturalHeight = 0; - state = DEFAULT; -#ifdef HAVE_RSVG - _rsvg = NULL; - _is_svg = false; - _svg_last_width = _svg_last_height = 0; -#endif -} - -/* - * Destroy image and associated surface. - */ - -Image::~Image() { - clearData(); -} - -/* - * Initiate image loading. - */ - -cairo_status_t -Image::load() { - if (LOADING != state) { - state = LOADING; - return loadSurface(); - } - return CAIRO_STATUS_READ_ERROR; -} - -/* - * Set state, assign dimensions. - */ - -void -Image::loaded() { - Nan::HandleScope scope; - state = COMPLETE; - - width = naturalWidth = cairo_image_surface_get_width(_surface); - height = naturalHeight = cairo_image_surface_get_height(_surface); - _data_len = naturalHeight * cairo_image_surface_get_stride(_surface); - Nan::AdjustExternalMemory(_data_len); -} - -/* - * Returns this image's surface. - */ -cairo_surface_t *Image::surface() { -#ifdef HAVE_RSVG - if (_is_svg && (_svg_last_width != width || _svg_last_height != height)) { - if (_surface != NULL) { - cairo_surface_destroy(_surface); - _surface = NULL; - } - - cairo_status_t status = renderSVGToSurface(); - if (status != CAIRO_STATUS_SUCCESS) { - g_object_unref(_rsvg); - Nan::ThrowError(Canvas::Error(status)); - return NULL; - } - } -#endif - return _surface; -} - -/* - * Load cairo surface from the image src. - * - * TODO: support more formats - * TODO: use node IO or at least thread pool - */ - -cairo_status_t -Image::loadSurface() { - FILE *stream = fopen(filename, "rb"); - if (!stream) { - this->errorInfo.set(NULL, "fopen", errno, filename); - return CAIRO_STATUS_READ_ERROR; - } - uint8_t buf[5]; - if (1 != fread(&buf, 5, 1, stream)) { - fclose(stream); - return CAIRO_STATUS_READ_ERROR; - } - rewind(stream); - - // png - if (isPNG(buf)) { - fclose(stream); - return loadPNG(); - } - - - if (isGIF(buf)) { -#ifdef HAVE_GIF - return loadGIF(stream); -#else - this->errorInfo.set("node-canvas was built without GIF support"); - return CAIRO_STATUS_READ_ERROR; -#endif - } - - if (isJPEG(buf)) { -#ifdef HAVE_JPEG - return loadJPEG(stream); -#else - this->errorInfo.set("node-canvas was built without JPEG support"); - return CAIRO_STATUS_READ_ERROR; -#endif - } - - // confirm svg using first 1000 chars - // if a very long comment precedes the root tag, isSVG returns false - uint8_t head[1000] = {0}; - fseek(stream, 0 , SEEK_END); - long len = ftell(stream); - unsigned head_len = (len < 1000 ? len : 1000); - unsigned head_size = head_len * sizeof(uint8_t); - rewind(stream); - if (head_size != fread(&head, 1, head_size, stream)) { - fclose(stream); - return CAIRO_STATUS_READ_ERROR; - } - rewind(stream); - if (isSVG(head, head_len)) { -#ifdef HAVE_RSVG - return loadSVG(stream); -#else - this->errorInfo.set("node-canvas was built without SVG support"); - return CAIRO_STATUS_READ_ERROR; -#endif - } - - if (isBMP(buf, 2)) - return loadBMP(stream); - - fclose(stream); - - this->errorInfo.set("Unsupported image type"); - return CAIRO_STATUS_READ_ERROR; -} - -/* - * Load PNG. - */ - -cairo_status_t -Image::loadPNG() { - _surface = cairo_image_surface_create_from_png(filename); - return cairo_surface_status(_surface); -} - -// GIF support - -#ifdef HAVE_GIF - -/* - * Return the alpha color for `gif` at `frame`, or -1. - */ - -int -get_gif_transparent_color(GifFileType *gif, int frame) { - ExtensionBlock *ext = gif->SavedImages[frame].ExtensionBlocks; - int len = gif->SavedImages[frame].ExtensionBlockCount; - for (int x = 0; x < len; ++x, ++ext) { - if ((ext->Function == GRAPHICS_EXT_FUNC_CODE) && (ext->Bytes[0] & 1)) { - return ext->Bytes[3] == 0 ? 0 : (uint8_t) ext->Bytes[3]; - } - } - return -1; -} - -/* - * Memory GIF reader callback. - */ - -int -read_gif_from_memory(GifFileType *gif, GifByteType *buf, int len) { - gif_data_t *data = (gif_data_t *) gif->UserData; - if ((data->pos + len) > data->len) len = data->len - data->pos; - memcpy(buf, data->pos + data->buf, len); - data->pos += len; - return len; -} - -/* - * Load GIF. - */ - -cairo_status_t -Image::loadGIF(FILE *stream) { - struct stat s; - int fd = fileno(stream); - - // stat - if (fstat(fd, &s) < 0) { - fclose(stream); - return CAIRO_STATUS_READ_ERROR; - } - - uint8_t *buf = (uint8_t *) malloc(s.st_size); - - if (!buf) { - fclose(stream); - this->errorInfo.set(NULL, "malloc", errno); - return CAIRO_STATUS_NO_MEMORY; - } - - size_t read = fread(buf, s.st_size, 1, stream); - fclose(stream); - - cairo_status_t result = CAIRO_STATUS_READ_ERROR; - if (1 == read) result = loadGIFFromBuffer(buf, s.st_size); - free(buf); - - return result; -} - -/* - * Load give from `buf` and the given `len`. - */ - -cairo_status_t -Image::loadGIFFromBuffer(uint8_t *buf, unsigned len) { - int i = 0; - GifFileType* gif; - - gif_data_t gifd = { buf, len, 0 }; - -#if GIFLIB_MAJOR >= 5 - int errorcode; - if ((gif = DGifOpen((void*) &gifd, read_gif_from_memory, &errorcode)) == NULL) - return CAIRO_STATUS_READ_ERROR; -#else - if ((gif = DGifOpen((void*) &gifd, read_gif_from_memory)) == NULL) - return CAIRO_STATUS_READ_ERROR; -#endif - - if (GIF_OK != DGifSlurp(gif)) { - GIF_CLOSE_FILE(gif); - return CAIRO_STATUS_READ_ERROR; - } - - if (gif->SWidth > canvas_max_side || gif->SHeight > canvas_max_side) { - GIF_CLOSE_FILE(gif); - return CAIRO_STATUS_INVALID_SIZE; - } - - width = naturalWidth = gif->SWidth; - height = naturalHeight = gif->SHeight; - - uint8_t *data = new uint8_t[naturalWidth * naturalHeight * 4]; - if (!data) { - GIF_CLOSE_FILE(gif); - this->errorInfo.set(NULL, "malloc", errno); - return CAIRO_STATUS_NO_MEMORY; - } - - GifImageDesc *img = &gif->SavedImages[i].ImageDesc; - - // local colormap takes precedence over global - ColorMapObject *colormap = img->ColorMap - ? img->ColorMap - : gif->SColorMap; - - if (colormap == nullptr) { - GIF_CLOSE_FILE(gif); - return CAIRO_STATUS_READ_ERROR; - } - - int bgColor = 0; - int alphaColor = get_gif_transparent_color(gif, i); - if (gif->SColorMap) bgColor = (uint8_t) gif->SBackGroundColor; - else if(alphaColor >= 0) bgColor = alphaColor; - - uint8_t *src_data = (uint8_t*) gif->SavedImages[i].RasterBits; - uint32_t *dst_data = (uint32_t*) data; - - if (!gif->Image.Interlace) { - if (naturalWidth == img->Width && naturalHeight == img->Height) { - for (int y = 0; y < naturalHeight; ++y) { - for (int x = 0; x < naturalWidth; ++x) { - *dst_data = ((*src_data == alphaColor) ? 0 : 255) << 24 - | colormap->Colors[*src_data].Red << 16 - | colormap->Colors[*src_data].Green << 8 - | colormap->Colors[*src_data].Blue; - - dst_data++; - src_data++; - } - } - } else { - // Image does not take up whole "screen" so we need to fill-in the background - int bottom = img->Top + img->Height; - int right = img->Left + img->Width; - - uint32_t bgPixel = - ((bgColor == alphaColor) ? 0 : 255) << 24 - | colormap->Colors[bgColor].Red << 16 - | colormap->Colors[bgColor].Green << 8 - | colormap->Colors[bgColor].Blue; - - for (int y = 0; y < naturalHeight; ++y) { - for (int x = 0; x < naturalWidth; ++x) { - if (y < img->Top || y >= bottom || x < img->Left || x >= right) { - *dst_data = bgPixel; - dst_data++; - } else { - *dst_data = ((*src_data == alphaColor) ? 0 : 255) << 24 - | colormap->Colors[*src_data].Red << 16 - | colormap->Colors[*src_data].Green << 8 - | colormap->Colors[*src_data].Blue; - dst_data++; - src_data++; - } - } - } - } - } else { - // Image is interlaced so that it streams nice over 14.4k and 28.8k modems :) - // We first load in 1/8 of the image, followed by another 1/8, followed by - // 1/4 and finally the remaining 1/2. - int ioffs[] = { 0, 4, 2, 1 }; - int ijumps[] = { 8, 8, 4, 2 }; - - uint8_t *src_ptr = src_data; - uint32_t *dst_ptr; - - for(int z = 0; z < 4; z++) { - for(int y = ioffs[z]; y < naturalHeight; y += ijumps[z]) { - dst_ptr = dst_data + naturalWidth * y; - for(int x = 0; x < naturalWidth; ++x) { - *dst_ptr = ((*src_ptr == alphaColor) ? 0 : 255) << 24 - | (colormap->Colors[*src_ptr].Red) << 16 - | (colormap->Colors[*src_ptr].Green) << 8 - | (colormap->Colors[*src_ptr].Blue); - - dst_ptr++; - src_ptr++; - } - } - } - } - - GIF_CLOSE_FILE(gif); - - // New image surface - _surface = cairo_image_surface_create_for_data( - data - , CAIRO_FORMAT_ARGB32 - , naturalWidth - , naturalHeight - , cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, naturalWidth)); - - cairo_status_t status = cairo_surface_status(_surface); - - if (status) { - delete[] data; - return status; - } - - _data = data; - - return CAIRO_STATUS_SUCCESS; -} -#endif /* HAVE_GIF */ - -// JPEG support - -#ifdef HAVE_JPEG - -// libjpeg 6.2 does not have jpeg_mem_src; define it ourselves here unless -// libjpeg 8 is installed. -#if JPEG_LIB_VERSION < 80 && !defined(MEM_SRCDST_SUPPORTED) - -/* Read JPEG image from a memory segment */ -static void -init_source(j_decompress_ptr cinfo) {} - -static boolean -fill_input_buffer(j_decompress_ptr cinfo) { - ERREXIT(cinfo, JERR_INPUT_EMPTY); - return TRUE; -} -static void -skip_input_data(j_decompress_ptr cinfo, long num_bytes) { - struct jpeg_source_mgr* src = (struct jpeg_source_mgr*) cinfo->src; - if (num_bytes > 0) { - src->next_input_byte += (size_t) num_bytes; - src->bytes_in_buffer -= (size_t) num_bytes; - } -} - -static void term_source (j_decompress_ptr cinfo) {} -static void jpeg_mem_src (j_decompress_ptr cinfo, void* buffer, long nbytes) { - struct jpeg_source_mgr* src; - - if (cinfo->src == NULL) { - cinfo->src = (struct jpeg_source_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - sizeof(struct jpeg_source_mgr)); - } - - src = (struct jpeg_source_mgr*) cinfo->src; - src->init_source = init_source; - src->fill_input_buffer = fill_input_buffer; - src->skip_input_data = skip_input_data; - src->resync_to_restart = jpeg_resync_to_restart; /* use default method */ - src->term_source = term_source; - src->bytes_in_buffer = nbytes; - src->next_input_byte = (JOCTET*)buffer; -} - -#endif - -void Image::jpegToARGB(jpeg_decompress_struct* args, uint8_t* data, uint8_t* src, JPEGDecodeL decode) { - int stride = naturalWidth * 4; - for (int y = 0; y < naturalHeight; ++y) { - jpeg_read_scanlines(args, &src, 1); - uint32_t *row = (uint32_t*)(data + stride * y); - for (int x = 0; x < naturalWidth; ++x) { - int bx = args->output_components * x; - row[x] = decode(src + bx); - } - } -} - -/* - * Takes an initialised jpeg_decompress_struct and decodes the - * data into _surface. - */ - -cairo_status_t -Image::decodeJPEGIntoSurface(jpeg_decompress_struct *args) { - cairo_status_t status = CAIRO_STATUS_SUCCESS; - - uint8_t *data = new uint8_t[naturalWidth * naturalHeight * 4]; - if (!data) { - jpeg_abort_decompress(args); - jpeg_destroy_decompress(args); - this->errorInfo.set(NULL, "malloc", errno); - return CAIRO_STATUS_NO_MEMORY; - } - - uint8_t *src = new uint8_t[naturalWidth * args->output_components]; - if (!src) { - free(data); - jpeg_abort_decompress(args); - jpeg_destroy_decompress(args); - this->errorInfo.set(NULL, "malloc", errno); - return CAIRO_STATUS_NO_MEMORY; - } - - // These are the three main cases to handle. libjpeg converts YCCK to CMYK - // and YCbCr to RGB by default. - switch (args->out_color_space) { - case JCS_CMYK: - jpegToARGB(args, data, src, [](uint8_t const* src) { - uint16_t k = static_cast(src[3]); - uint8_t r = k * src[0] / 255; - uint8_t g = k * src[1] / 255; - uint8_t b = k * src[2] / 255; - return 255 << 24 | r << 16 | g << 8 | b; - }); - break; - case JCS_RGB: - jpegToARGB(args, data, src, [](uint8_t const* src) { - uint8_t r = src[0], g = src[1], b = src[2]; - return 255 << 24 | r << 16 | g << 8 | b; - }); - break; - case JCS_GRAYSCALE: - jpegToARGB(args, data, src, [](uint8_t const* src) { - uint8_t v = src[0]; - return 255 << 24 | v << 16 | v << 8 | v; - }); - break; - default: - this->errorInfo.set("Unsupported JPEG encoding"); - status = CAIRO_STATUS_READ_ERROR; - break; - } - - if (!status) { - _surface = cairo_image_surface_create_for_data( - data - , CAIRO_FORMAT_ARGB32 - , naturalWidth - , naturalHeight - , cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, naturalWidth)); - } - - jpeg_finish_decompress(args); - jpeg_destroy_decompress(args); - status = cairo_surface_status(_surface); - - delete[] src; - - if (status) { - delete[] data; - return status; - } - - _data = data; - - return CAIRO_STATUS_SUCCESS; -} - -/* - * Callback to recover from jpeg errors - */ - -static void canvas_jpeg_error_exit(j_common_ptr cinfo) { - canvas_jpeg_error_mgr *cjerr = static_cast(cinfo->err); - cjerr->output_message(cinfo); - // Return control to the setjmp point - longjmp(cjerr->setjmp_buffer, 1); -} - -// Capture libjpeg errors instead of writing stdout -static void canvas_jpeg_output_message(j_common_ptr cinfo) { - canvas_jpeg_error_mgr *cjerr = static_cast(cinfo->err); - char buff[JMSG_LENGTH_MAX]; - cjerr->format_message(cinfo, buff); - // (Only the last message will be returned to JS land.) - cjerr->image->errorInfo.set(buff); -} - -/* - * Takes a jpeg data buffer and assigns it as mime data to a - * dummy surface - */ - -cairo_status_t -Image::decodeJPEGBufferIntoMimeSurface(uint8_t *buf, unsigned len) { - // TODO: remove this duplicate logic - // JPEG setup - struct jpeg_decompress_struct args; - struct canvas_jpeg_error_mgr err; - - err.image = this; - args.err = jpeg_std_error(&err); - args.err->error_exit = canvas_jpeg_error_exit; - args.err->output_message = canvas_jpeg_output_message; - - // Establish the setjmp return context for canvas_jpeg_error_exit to use - if (setjmp(err.setjmp_buffer)) { - // If we get here, the JPEG code has signaled an error. - // We need to clean up the JPEG object, close the input file, and return. - jpeg_destroy_decompress(&args); - return CAIRO_STATUS_READ_ERROR; - } - - jpeg_create_decompress(&args); - - jpeg_mem_src(&args, buf, len); - - jpeg_read_header(&args, 1); - jpeg_start_decompress(&args); - width = naturalWidth = args.output_width; - height = naturalHeight = args.output_height; - - // Data alloc - // 8 pixels per byte using Alpha Channel format to reduce memory requirement. - int buf_size = naturalHeight * cairo_format_stride_for_width(CAIRO_FORMAT_A1, naturalWidth); - uint8_t *data = new uint8_t[buf_size]; - if (!data) { - this->errorInfo.set(NULL, "malloc", errno); - return CAIRO_STATUS_NO_MEMORY; - } - - // New image surface - _surface = cairo_image_surface_create_for_data( - data - , CAIRO_FORMAT_A1 - , naturalWidth - , naturalHeight - , cairo_format_stride_for_width(CAIRO_FORMAT_A1, naturalWidth)); - - // Cleanup - jpeg_abort_decompress(&args); - jpeg_destroy_decompress(&args); - cairo_status_t status = cairo_surface_status(_surface); - - if (status) { - delete[] data; - return status; - } - - _data = data; - - return assignDataAsMime(buf, len, CAIRO_MIME_TYPE_JPEG); -} - -/* - * Helper function for disposing of a mime data closure. - */ - -void -clearMimeData(void *closure) { - Nan::AdjustExternalMemory( - -static_cast((static_cast(closure)->len))); - free(static_cast(closure)->buf); - free(closure); -} - -/* - * Assign a given buffer as mime data against the surface. - * The provided buffer will be copied, and the copy will - * be automatically freed when the surface is destroyed. - */ - -cairo_status_t -Image::assignDataAsMime(uint8_t *data, int len, const char *mime_type) { - uint8_t *mime_data = (uint8_t *) malloc(len); - if (!mime_data) { - this->errorInfo.set(NULL, "malloc", errno); - return CAIRO_STATUS_NO_MEMORY; - } - - read_closure_t *mime_closure = (read_closure_t *) malloc(sizeof(read_closure_t)); - if (!mime_closure) { - free(mime_data); - this->errorInfo.set(NULL, "malloc", errno); - return CAIRO_STATUS_NO_MEMORY; - } - - memcpy(mime_data, data, len); - - mime_closure->buf = mime_data; - mime_closure->len = len; - - Nan::AdjustExternalMemory(len); - - return cairo_surface_set_mime_data(_surface - , mime_type - , mime_data - , len - , clearMimeData - , mime_closure); -} - -/* - * Load jpeg from buffer. - */ - -cairo_status_t -Image::loadJPEGFromBuffer(uint8_t *buf, unsigned len) { - // TODO: remove this duplicate logic - // JPEG setup - struct jpeg_decompress_struct args; - struct canvas_jpeg_error_mgr err; - - err.image = this; - args.err = jpeg_std_error(&err); - args.err->error_exit = canvas_jpeg_error_exit; - args.err->output_message = canvas_jpeg_output_message; - - // Establish the setjmp return context for canvas_jpeg_error_exit to use - if (setjmp(err.setjmp_buffer)) { - // If we get here, the JPEG code has signaled an error. - // We need to clean up the JPEG object, close the input file, and return. - jpeg_destroy_decompress(&args); - return CAIRO_STATUS_READ_ERROR; - } - - jpeg_create_decompress(&args); - - jpeg_mem_src(&args, buf, len); - - jpeg_read_header(&args, 1); - jpeg_start_decompress(&args); - width = naturalWidth = args.output_width; - height = naturalHeight = args.output_height; - - return decodeJPEGIntoSurface(&args); -} - -/* - * Load JPEG, convert RGB to ARGB. - */ - -cairo_status_t -Image::loadJPEG(FILE *stream) { - cairo_status_t status; - -#if defined(_MSC_VER) - if (false) { // Force using loadJPEGFromBuffer -#else - if (data_mode == DATA_IMAGE) { // Can lazily read in the JPEG. -#endif - // JPEG setup - struct jpeg_decompress_struct args; - struct canvas_jpeg_error_mgr err; - - err.image = this; - args.err = jpeg_std_error(&err); - args.err->error_exit = canvas_jpeg_error_exit; - args.err->output_message = canvas_jpeg_output_message; - - // Establish the setjmp return context for canvas_jpeg_error_exit to use - if (setjmp(err.setjmp_buffer)) { - // If we get here, the JPEG code has signaled an error. - // We need to clean up the JPEG object, close the input file, and return. - jpeg_destroy_decompress(&args); - return CAIRO_STATUS_READ_ERROR; - } - - jpeg_create_decompress(&args); - - jpeg_stdio_src(&args, stream); - - jpeg_read_header(&args, 1); - jpeg_start_decompress(&args); - - if (args.output_width > canvas_max_side || args.output_height > canvas_max_side) { - jpeg_destroy_decompress(&args); - return CAIRO_STATUS_INVALID_SIZE; - } - - width = naturalWidth = args.output_width; - height = naturalHeight = args.output_height; - - status = decodeJPEGIntoSurface(&args); - fclose(stream); - } else { // We'll need the actual source jpeg data, so read fully. - uint8_t *buf; - unsigned len; - - fseek(stream, 0, SEEK_END); - len = ftell(stream); - fseek(stream, 0, SEEK_SET); - - buf = (uint8_t *) malloc(len); - if (!buf) { - this->errorInfo.set(NULL, "malloc", errno); - return CAIRO_STATUS_NO_MEMORY; - } - - if (fread(buf, len, 1, stream) != 1) { - status = CAIRO_STATUS_READ_ERROR; - } else if ((DATA_IMAGE | DATA_MIME) == data_mode) { - status = loadJPEGFromBuffer(buf, len); - if (!status) status = assignDataAsMime(buf, len, CAIRO_MIME_TYPE_JPEG); - } else if (DATA_MIME == data_mode) { - status = decodeJPEGBufferIntoMimeSurface(buf, len); - } -#if defined(_MSC_VER) - else if (DATA_IMAGE == data_mode) { - status = loadJPEGFromBuffer(buf, len); - } -#endif - else { - status = CAIRO_STATUS_READ_ERROR; - } - - fclose(stream); - free(buf); - } - - return status; -} - -#endif /* HAVE_JPEG */ - -#ifdef HAVE_RSVG - -/* - * Load SVG from buffer - */ - -cairo_status_t -Image::loadSVGFromBuffer(uint8_t *buf, unsigned len) { - _is_svg = true; - - cairo_status_t status; - GError *gerr = NULL; - - if (NULL == (_rsvg = rsvg_handle_new_from_data(buf, len, &gerr))) { - return CAIRO_STATUS_READ_ERROR; - } - - RsvgDimensionData *dims = new RsvgDimensionData(); - rsvg_handle_get_dimensions(_rsvg, dims); - - width = naturalWidth = dims->width; - height = naturalHeight = dims->height; - - status = renderSVGToSurface(); - if (status != CAIRO_STATUS_SUCCESS) { - g_object_unref(_rsvg); - return status; - } - - return CAIRO_STATUS_SUCCESS; -} - -/* - * Renders the Rsvg handle to this image's surface - */ -cairo_status_t -Image::renderSVGToSurface() { - cairo_status_t status; - - _surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); - - status = cairo_surface_status(_surface); - if (status != CAIRO_STATUS_SUCCESS) { - g_object_unref(_rsvg); - return status; - } - - cairo_t *cr = cairo_create(_surface); - cairo_scale(cr, - (double)width / (double)naturalWidth, - (double)height / (double)naturalHeight); - status = cairo_status(cr); - if (status != CAIRO_STATUS_SUCCESS) { - g_object_unref(_rsvg); - return status; - } - - gboolean render_ok = rsvg_handle_render_cairo(_rsvg, cr); - if (!render_ok) { - g_object_unref(_rsvg); - cairo_destroy(cr); - return CAIRO_STATUS_READ_ERROR; // or WRITE? - } - - cairo_destroy(cr); - - _svg_last_width = width; - _svg_last_height = height; - - return status; -} - -/* - * Load SVG - */ - -cairo_status_t -Image::loadSVG(FILE *stream) { - _is_svg = true; - - struct stat s; - int fd = fileno(stream); - - // stat - if (fstat(fd, &s) < 0) { - fclose(stream); - return CAIRO_STATUS_READ_ERROR; - } - - uint8_t *buf = (uint8_t *) malloc(s.st_size); - - if (!buf) { - fclose(stream); - return CAIRO_STATUS_NO_MEMORY; - } - - size_t read = fread(buf, s.st_size, 1, stream); - fclose(stream); - - cairo_status_t result = CAIRO_STATUS_READ_ERROR; - if (1 == read) result = loadSVGFromBuffer(buf, s.st_size); - free(buf); - - return result; -} - -#endif /* HAVE_RSVG */ - -/* - * Load BMP from buffer. - */ - -cairo_status_t Image::loadBMPFromBuffer(uint8_t *buf, unsigned len){ - BMPParser::Parser parser; - - // Reversed ARGB32 with pre-multiplied alpha - uint8_t pixFmt[5] = {2, 1, 0, 3, 1}; - parser.parse(buf, len, pixFmt); - - if (parser.getStatus() != BMPParser::Status::OK) { - errorInfo.reset(); - errorInfo.message = parser.getErrMsg(); - return CAIRO_STATUS_READ_ERROR; - } - - width = naturalWidth = parser.getWidth(); - height = naturalHeight = parser.getHeight(); - uint8_t *data = parser.getImgd(); - - _surface = cairo_image_surface_create_for_data( - data, - CAIRO_FORMAT_ARGB32, - width, - height, - cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width) - ); - - // No need to delete the data - cairo_status_t status = cairo_surface_status(_surface); - if (status) return status; - - _data = data; - parser.clearImgd(); - - return CAIRO_STATUS_SUCCESS; -} - -/* - * Load BMP. - */ - -cairo_status_t Image::loadBMP(FILE *stream){ - struct stat s; - int fd = fileno(stream); - - // Stat - if (fstat(fd, &s) < 0) { - fclose(stream); - return CAIRO_STATUS_READ_ERROR; - } - - uint8_t *buf = new uint8_t[s.st_size]; - - if (!buf) { - fclose(stream); - errorInfo.set(NULL, "malloc", errno); - return CAIRO_STATUS_NO_MEMORY; - } - - size_t read = fread(buf, s.st_size, 1, stream); - fclose(stream); - - cairo_status_t result = CAIRO_STATUS_READ_ERROR; - if (read == 1) result = loadBMPFromBuffer(buf, s.st_size); - delete[] buf; - - return result; -} - -/* - * Return UNKNOWN, SVG, GIF, JPEG, or PNG based on the filename. - */ - -Image::type -Image::extension(const char *filename) { - size_t len = strlen(filename); - filename += len; - if (len >= 5 && 0 == strcmp(".jpeg", filename - 5)) return Image::JPEG; - if (len >= 4 && 0 == strcmp(".gif", filename - 4)) return Image::GIF; - if (len >= 4 && 0 == strcmp(".jpg", filename - 4)) return Image::JPEG; - if (len >= 4 && 0 == strcmp(".png", filename - 4)) return Image::PNG; - if (len >= 4 && 0 == strcmp(".svg", filename - 4)) return Image::SVG; - return Image::UNKNOWN; -} - -/* - * Sniff bytes 0..1 for JPEG's magic number ff d8. - */ - -int -Image::isJPEG(uint8_t *data) { - return 0xff == data[0] && 0xd8 == data[1]; -} - -/* - * Sniff bytes 0..2 for "GIF". - */ - -int -Image::isGIF(uint8_t *data) { - return 'G' == data[0] && 'I' == data[1] && 'F' == data[2]; -} - -/* - * Sniff bytes 1..3 for "PNG". - */ - -int -Image::isPNG(uint8_t *data) { - return 'P' == data[1] && 'N' == data[2] && 'G' == data[3]; -} - -/* - * Skip " - -#pragma once - -#include -#include "CanvasError.h" -#include -#include -#include // node < 7 uses libstdc++ on macOS which lacks complete c++11 -#include - -#ifdef HAVE_JPEG -#include -#include -#endif - -#ifdef HAVE_GIF -#include - - #if GIFLIB_MAJOR > 5 || GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 - #define GIF_CLOSE_FILE(gif) DGifCloseFile(gif, NULL) - #else - #define GIF_CLOSE_FILE(gif) DGifCloseFile(gif) - #endif -#endif - -#ifdef HAVE_RSVG -#include - // librsvg <= 2.36.1, identified by undefined macro, needs an extra include - #ifndef LIBRSVG_CHECK_VERSION - #include - #endif -#endif - -using JPEGDecodeL = std::function; - -class Image: public Nan::ObjectWrap { - public: - char *filename; - int width, height; - int naturalWidth, naturalHeight; - static Nan::Persistent constructor; - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(New); - static NAN_GETTER(GetComplete); - static NAN_GETTER(GetWidth); - static NAN_GETTER(GetHeight); - static NAN_GETTER(GetNaturalWidth); - static NAN_GETTER(GetNaturalHeight); - static NAN_GETTER(GetDataMode); - static NAN_SETTER(SetDataMode); - static NAN_SETTER(SetWidth); - static NAN_SETTER(SetHeight); - static NAN_METHOD(GetSource); - static NAN_METHOD(SetSource); - inline uint8_t *data(){ return cairo_image_surface_get_data(_surface); } - inline int stride(){ return cairo_image_surface_get_stride(_surface); } - static int isPNG(uint8_t *data); - static int isJPEG(uint8_t *data); - static int isGIF(uint8_t *data); - static int isSVG(uint8_t *data, unsigned len); - static int isBMP(uint8_t *data, unsigned len); - static cairo_status_t readPNG(void *closure, unsigned char *data, unsigned len); - inline int isComplete(){ return COMPLETE == state; } - cairo_surface_t *surface(); - cairo_status_t loadSurface(); - cairo_status_t loadFromBuffer(uint8_t *buf, unsigned len); - cairo_status_t loadPNGFromBuffer(uint8_t *buf); - cairo_status_t loadPNG(); - void clearData(); -#ifdef HAVE_RSVG - cairo_status_t loadSVGFromBuffer(uint8_t *buf, unsigned len); - cairo_status_t loadSVG(FILE *stream); - cairo_status_t renderSVGToSurface(); -#endif -#ifdef HAVE_GIF - cairo_status_t loadGIFFromBuffer(uint8_t *buf, unsigned len); - cairo_status_t loadGIF(FILE *stream); -#endif -#ifdef HAVE_JPEG - cairo_status_t loadJPEGFromBuffer(uint8_t *buf, unsigned len); - cairo_status_t loadJPEG(FILE *stream); - void jpegToARGB(jpeg_decompress_struct* args, uint8_t* data, uint8_t* src, JPEGDecodeL decode); - cairo_status_t decodeJPEGIntoSurface(jpeg_decompress_struct *info); - cairo_status_t decodeJPEGBufferIntoMimeSurface(uint8_t *buf, unsigned len); - cairo_status_t assignDataAsMime(uint8_t *data, int len, const char *mime_type); -#endif - cairo_status_t loadBMPFromBuffer(uint8_t *buf, unsigned len); - cairo_status_t loadBMP(FILE *stream); - CanvasError errorInfo; - void loaded(); - cairo_status_t load(); - Image(); - - enum { - DEFAULT - , LOADING - , COMPLETE - } state; - - enum data_mode_t { - DATA_IMAGE = 1 - , DATA_MIME = 2 - } data_mode; - - typedef enum { - UNKNOWN - , GIF - , JPEG - , PNG - , SVG - } type; - - static type extension(const char *filename); - - private: - cairo_surface_t *_surface; - uint8_t *_data = nullptr; - int _data_len; -#ifdef HAVE_RSVG - RsvgHandle *_rsvg; - bool _is_svg; - int _svg_last_width; - int _svg_last_height; -#endif - ~Image(); -}; diff --git a/node_modules/canvas/src/ImageData.cc b/node_modules/canvas/src/ImageData.cc deleted file mode 100644 index 668733d..0000000 --- a/node_modules/canvas/src/ImageData.cc +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#include "ImageData.h" - -#include "Util.h" - -using namespace v8; - -Nan::Persistent ImageData::constructor; - -/* - * Initialize ImageData. - */ - -void -ImageData::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - Nan::HandleScope scope; - - // Constructor - Local ctor = Nan::New(ImageData::New); - constructor.Reset(ctor); - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("ImageData").ToLocalChecked()); - - // Prototype - Local proto = ctor->PrototypeTemplate(); - SetProtoAccessor(proto, Nan::New("width").ToLocalChecked(), GetWidth, NULL, ctor); - SetProtoAccessor(proto, Nan::New("height").ToLocalChecked(), GetHeight, NULL, ctor); - Local ctx = Nan::GetCurrentContext(); - Nan::Set(target, Nan::New("ImageData").ToLocalChecked(), ctor->GetFunction(ctx).ToLocalChecked()); -} - -/* - * Initialize a new ImageData object. - */ - -NAN_METHOD(ImageData::New) { - if (!info.IsConstructCall()) { - return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); - } - - Local dataArray; - uint32_t width; - uint32_t height; - int length; - - if (info[0]->IsUint32() && info[1]->IsUint32()) { - width = Nan::To(info[0]).FromMaybe(0); - if (width == 0) { - Nan::ThrowRangeError("The source width is zero."); - return; - } - height = Nan::To(info[1]).FromMaybe(0); - if (height == 0) { - Nan::ThrowRangeError("The source height is zero."); - return; - } - length = width * height * 4; // ImageData(w, h) constructor assumes 4 BPP; documented. - - dataArray = Uint8ClampedArray::New(ArrayBuffer::New(Isolate::GetCurrent(), length), 0, length); - - } else if (info[0]->IsUint8ClampedArray() && info[1]->IsUint32()) { - dataArray = info[0].As(); - - length = dataArray->Length(); - if (length == 0) { - Nan::ThrowRangeError("The input data has a zero byte length."); - return; - } - - // Don't assert that the ImageData length is a multiple of four because some - // data formats are not 4 BPP. - - width = Nan::To(info[1]).FromMaybe(0); - if (width == 0) { - Nan::ThrowRangeError("The source width is zero."); - return; - } - - // Don't assert that the byte length is a multiple of 4 * width, ditto. - - if (info[2]->IsUint32()) { // Explicit height given - height = Nan::To(info[2]).FromMaybe(0); - } else { // Calculate height assuming 4 BPP - int size = length / 4; - height = size / width; - } - - } else if (info[0]->IsUint16Array() && info[1]->IsUint32()) { // Intended for RGB16_565 format - dataArray = info[0].As(); - - length = dataArray->Length(); - if (length == 0) { - Nan::ThrowRangeError("The input data has a zero byte length."); - return; - } - - width = Nan::To(info[1]).FromMaybe(0); - if (width == 0) { - Nan::ThrowRangeError("The source width is zero."); - return; - } - - if (info[2]->IsUint32()) { // Explicit height given - height = Nan::To(info[2]).FromMaybe(0); - } else { // Calculate height assuming 2 BPP - int size = length / 2; - height = size / width; - } - - } else { - Nan::ThrowTypeError("Expected (Uint8ClampedArray, width[, height]), (Uint16Array, width[, height]) or (width, height)"); - return; - } - - Nan::TypedArrayContents dataPtr(dataArray); - - ImageData *imageData = new ImageData(reinterpret_cast(*dataPtr), width, height); - imageData->Wrap(info.This()); - Nan::Set(info.This(), Nan::New("data").ToLocalChecked(), dataArray).Check(); - info.GetReturnValue().Set(info.This()); -} - -/* - * Get width. - */ - -NAN_GETTER(ImageData::GetWidth) { - ImageData *imageData = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(imageData->width())); -} - -/* - * Get height. - */ - -NAN_GETTER(ImageData::GetHeight) { - ImageData *imageData = Nan::ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New(imageData->height())); -} diff --git a/node_modules/canvas/src/ImageData.h b/node_modules/canvas/src/ImageData.h deleted file mode 100644 index 4832b37..0000000 --- a/node_modules/canvas/src/ImageData.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#pragma once - -#include -#include // node < 7 uses libstdc++ on macOS which lacks complete c++11 -#include - -class ImageData: public Nan::ObjectWrap { - public: - static Nan::Persistent constructor; - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(New); - static NAN_GETTER(GetWidth); - static NAN_GETTER(GetHeight); - - inline int width() { return _width; } - inline int height() { return _height; } - inline uint8_t *data() { return _data; } - ImageData(uint8_t *data, int width, int height) : _width(width), _height(height), _data(data) {} - - private: - int _width; - int _height; - uint8_t *_data; - -}; diff --git a/node_modules/canvas/src/JPEGStream.h b/node_modules/canvas/src/JPEGStream.h deleted file mode 100644 index b8efeed..0000000 --- a/node_modules/canvas/src/JPEGStream.h +++ /dev/null @@ -1,167 +0,0 @@ -#pragma once - -#include "closure.h" -#include -#include - -/* - * Expanded data destination object for closure output, - * inspired by IJG's jdatadst.c - */ - -struct closure_destination_mgr { - jpeg_destination_mgr pub; - JpegClosure* closure; - JOCTET *buffer; - int bufsize; -}; - -void -init_closure_destination(j_compress_ptr cinfo){ - // we really don't have to do anything here -} - -boolean -empty_closure_output_buffer(j_compress_ptr cinfo){ - Nan::HandleScope scope; - Nan::AsyncResource async("canvas:empty_closure_output_buffer"); - closure_destination_mgr *dest = (closure_destination_mgr *) cinfo->dest; - - v8::Local buf = Nan::NewBuffer((char *)dest->buffer, dest->bufsize).ToLocalChecked(); - - // emit "data" - v8::Local argv[2] = { - Nan::Null() - , buf - }; - dest->closure->cb.Call(sizeof argv / sizeof *argv, argv, &async); - - dest->buffer = (JOCTET *)malloc(dest->bufsize); - cinfo->dest->next_output_byte = dest->buffer; - cinfo->dest->free_in_buffer = dest->bufsize; - return true; -} - -void -term_closure_destination(j_compress_ptr cinfo){ - Nan::HandleScope scope; - Nan::AsyncResource async("canvas:term_closure_destination"); - closure_destination_mgr *dest = (closure_destination_mgr *) cinfo->dest; - - /* emit remaining data */ - v8::Local buf = Nan::NewBuffer((char *)dest->buffer, dest->bufsize - dest->pub.free_in_buffer).ToLocalChecked(); - - v8::Local data_argv[2] = { - Nan::Null() - , buf - }; - dest->closure->cb.Call(sizeof data_argv / sizeof *data_argv, data_argv, &async); - - // emit "end" - v8::Local end_argv[2] = { - Nan::Null() - , Nan::Null() - }; - dest->closure->cb.Call(sizeof end_argv / sizeof *end_argv, end_argv, &async); -} - -void -jpeg_closure_dest(j_compress_ptr cinfo, JpegClosure* closure, int bufsize){ - closure_destination_mgr * dest; - - /* The destination object is made permanent so that multiple JPEG images - * can be written to the same buffer without re-executing jpeg_mem_dest. - */ - if (cinfo->dest == NULL) { /* first time for this JPEG object? */ - cinfo->dest = (struct jpeg_destination_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - sizeof(closure_destination_mgr)); - } - - dest = (closure_destination_mgr *) cinfo->dest; - - cinfo->dest->init_destination = &init_closure_destination; - cinfo->dest->empty_output_buffer = &empty_closure_output_buffer; - cinfo->dest->term_destination = &term_closure_destination; - - dest->closure = closure; - dest->bufsize = bufsize; - dest->buffer = (JOCTET *)malloc(bufsize); - - cinfo->dest->next_output_byte = dest->buffer; - cinfo->dest->free_in_buffer = dest->bufsize; -} - -void encode_jpeg(jpeg_compress_struct cinfo, cairo_surface_t *surface, int quality, bool progressive, int chromaHSampFactor, int chromaVSampFactor) { - int w = cairo_image_surface_get_width(surface); - int h = cairo_image_surface_get_height(surface); - - cinfo.in_color_space = JCS_RGB; - cinfo.input_components = 3; - cinfo.image_width = w; - cinfo.image_height = h; - jpeg_set_defaults(&cinfo); - if (progressive) - jpeg_simple_progression(&cinfo); - jpeg_set_quality(&cinfo, quality, (quality < 25) ? 0 : 1); - cinfo.comp_info[0].h_samp_factor = chromaHSampFactor; - cinfo.comp_info[0].v_samp_factor = chromaVSampFactor; - - JSAMPROW slr; - jpeg_start_compress(&cinfo, TRUE); - unsigned char *dst; - unsigned int *src = (unsigned int *)cairo_image_surface_get_data(surface); - int sl = 0; - dst = (unsigned char *)malloc(w * 3); - while (sl < h) { - unsigned char *dp = dst; - int x = 0; - while (x < w) { - dp[0] = (*src >> 16) & 255; - dp[1] = (*src >> 8) & 255; - dp[2] = *src & 255; - src++; - dp += 3; - x++; - } - slr = dst; - jpeg_write_scanlines(&cinfo, &slr, 1); - sl++; - } - free(dst); - jpeg_finish_compress(&cinfo); - jpeg_destroy_compress(&cinfo); -} - -void -write_to_jpeg_stream(cairo_surface_t *surface, int bufsize, JpegClosure* closure) { - jpeg_compress_struct cinfo; - jpeg_error_mgr jerr; - cinfo.err = jpeg_std_error(&jerr); - jpeg_create_compress(&cinfo); - jpeg_closure_dest(&cinfo, closure, bufsize); - encode_jpeg( - cinfo, - surface, - closure->quality, - closure->progressive, - closure->chromaSubsampling, - closure->chromaSubsampling); -} - -void -write_to_jpeg_buffer(cairo_surface_t* surface, JpegClosure* closure) { - jpeg_compress_struct cinfo; - jpeg_error_mgr jerr; - cinfo.err = jpeg_std_error(&jerr); - jpeg_create_compress(&cinfo); - cinfo.client_data = closure; - cinfo.dest = closure->jpeg_dest_mgr; - encode_jpeg( - cinfo, - surface, - closure->quality, - closure->progressive, - closure->chromaSubsampling, - closure->chromaSubsampling); -} diff --git a/node_modules/canvas/src/PNG.h b/node_modules/canvas/src/PNG.h deleted file mode 100644 index 30b88f8..0000000 --- a/node_modules/canvas/src/PNG.h +++ /dev/null @@ -1,292 +0,0 @@ -#pragma once - -#include -#include "closure.h" -#include // round -#include -#include -#include -#include - -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) -#define likely(expr) (__builtin_expect (!!(expr), 1)) -#define unlikely(expr) (__builtin_expect (!!(expr), 0)) -#else -#define likely(expr) (expr) -#define unlikely(expr) (expr) -#endif - -static void canvas_png_flush(png_structp png_ptr) { - /* Do nothing; fflush() is said to be just a waste of energy. */ - (void) png_ptr; /* Stifle compiler warning */ -} - -/* Converts native endian xRGB => RGBx bytes */ -static void canvas_convert_data_to_bytes(png_structp png, png_row_infop row_info, png_bytep data) { - unsigned int i; - - for (i = 0; i < row_info->rowbytes; i += 4) { - uint8_t *b = &data[i]; - uint32_t pixel; - - memcpy(&pixel, b, sizeof (uint32_t)); - - b[0] = (pixel & 0xff0000) >> 16; - b[1] = (pixel & 0x00ff00) >> 8; - b[2] = (pixel & 0x0000ff) >> 0; - b[3] = 0; - } -} - -/* Unpremultiplies data and converts native endian ARGB => RGBA bytes */ -static void canvas_unpremultiply_data(png_structp png, png_row_infop row_info, png_bytep data) { - unsigned int i; - - for (i = 0; i < row_info->rowbytes; i += 4) { - uint8_t *b = &data[i]; - uint32_t pixel; - uint8_t alpha; - - memcpy(&pixel, b, sizeof (uint32_t)); - alpha = (pixel & 0xff000000) >> 24; - if (alpha == 0) { - b[0] = b[1] = b[2] = b[3] = 0; - } else { - b[0] = (((pixel & 0xff0000) >> 16) * 255 + alpha / 2) / alpha; - b[1] = (((pixel & 0x00ff00) >> 8) * 255 + alpha / 2) / alpha; - b[2] = (((pixel & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha; - b[3] = alpha; - } - } -} - -/* Converts RGB16_565 format data to RGBA32 */ -static void canvas_convert_565_to_888(png_structp png, png_row_infop row_info, png_bytep data) { - // Loop in reverse to unpack in-place. - for (ptrdiff_t col = row_info->width - 1; col >= 0; col--) { - uint8_t* src = &data[col * sizeof(uint16_t)]; - uint8_t* dst = &data[col * 3]; - uint16_t pixel; - - memcpy(&pixel, src, sizeof(uint16_t)); - - // Convert and rescale to the full 0-255 range - // See http://stackoverflow.com/a/29326693 - const uint8_t red5 = (pixel & 0xF800) >> 11; - const uint8_t green6 = (pixel & 0x7E0) >> 5; - const uint8_t blue5 = (pixel & 0x001F); - - dst[0] = ((red5 * 255 + 15) / 31); - dst[1] = ((green6 * 255 + 31) / 63); - dst[2] = ((blue5 * 255 + 15) / 31); - } -} - -struct canvas_png_write_closure_t { - cairo_write_func_t write_func; - PngClosure* closure; -}; - -#ifdef PNG_SETJMP_SUPPORTED -bool setjmp_wrapper(png_structp png) { - return setjmp(png_jmpbuf(png)); -} -#endif - -static cairo_status_t canvas_write_png(cairo_surface_t *surface, png_rw_ptr write_func, canvas_png_write_closure_t *closure) { - unsigned int i; - cairo_status_t status = CAIRO_STATUS_SUCCESS; - uint8_t *data; - png_structp png; - png_infop info; - png_bytep *volatile rows = NULL; - png_color_16 white; - int png_color_type; - int bpc; - unsigned int width = cairo_image_surface_get_width(surface); - unsigned int height = cairo_image_surface_get_height(surface); - - data = cairo_image_surface_get_data(surface); - if (data == NULL) { - status = CAIRO_STATUS_SURFACE_TYPE_MISMATCH; - return status; - } - cairo_surface_flush(surface); - - if (width == 0 || height == 0) { - status = CAIRO_STATUS_WRITE_ERROR; - return status; - } - - rows = (png_bytep *) malloc(height * sizeof (png_byte*)); - if (unlikely(rows == NULL)) { - status = CAIRO_STATUS_NO_MEMORY; - return status; - } - - int stride = cairo_image_surface_get_stride(surface); - for (i = 0; i < height; i++) { - rows[i] = (png_byte *) data + i * stride; - } - -#ifdef PNG_USER_MEM_SUPPORTED - png = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL, NULL, NULL, NULL); -#else - png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); -#endif - - if (unlikely(png == NULL)) { - status = CAIRO_STATUS_NO_MEMORY; - free(rows); - return status; - } - - info = png_create_info_struct (png); - if (unlikely(info == NULL)) { - status = CAIRO_STATUS_NO_MEMORY; - png_destroy_write_struct(&png, &info); - free(rows); - return status; - - } - -#ifdef PNG_SETJMP_SUPPORTED - if (setjmp_wrapper(png)) { - png_destroy_write_struct(&png, &info); - free(rows); - return status; - } -#endif - - png_set_write_fn(png, closure, write_func, canvas_png_flush); - png_set_compression_level(png, closure->closure->compressionLevel); - png_set_filter(png, 0, closure->closure->filters); - if (closure->closure->resolution != 0) { - uint32_t res = static_cast(round(static_cast(closure->closure->resolution) * 39.3701)); - png_set_pHYs(png, info, res, res, PNG_RESOLUTION_METER); - } - - cairo_format_t format = cairo_image_surface_get_format(surface); - - switch (format) { - case CAIRO_FORMAT_ARGB32: - bpc = 8; - png_color_type = PNG_COLOR_TYPE_RGB_ALPHA; - break; -#ifdef CAIRO_FORMAT_RGB30 - case CAIRO_FORMAT_RGB30: - bpc = 10; - png_color_type = PNG_COLOR_TYPE_RGB; - break; -#endif - case CAIRO_FORMAT_RGB24: - bpc = 8; - png_color_type = PNG_COLOR_TYPE_RGB; - break; - case CAIRO_FORMAT_A8: - bpc = 8; - png_color_type = PNG_COLOR_TYPE_GRAY; - break; - case CAIRO_FORMAT_A1: - bpc = 1; - png_color_type = PNG_COLOR_TYPE_GRAY; -#ifndef WORDS_BIGENDIAN - png_set_packswap(png); -#endif - break; - case CAIRO_FORMAT_RGB16_565: - bpc = 8; // 565 gets upconverted to 888 - png_color_type = PNG_COLOR_TYPE_RGB; - break; - case CAIRO_FORMAT_INVALID: - default: - status = CAIRO_STATUS_INVALID_FORMAT; - png_destroy_write_struct(&png, &info); - free(rows); - return status; - } - - if ((format == CAIRO_FORMAT_A8 || format == CAIRO_FORMAT_A1) && - closure->closure->palette != NULL) { - png_color_type = PNG_COLOR_TYPE_PALETTE; - } - - png_set_IHDR(png, info, width, height, bpc, png_color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - - if (png_color_type == PNG_COLOR_TYPE_PALETTE) { - size_t nColors = closure->closure->nPaletteColors; - uint8_t* colors = closure->closure->palette; - uint8_t backgroundIndex = closure->closure->backgroundIndex; - png_colorp pngPalette = (png_colorp)png_malloc(png, nColors * sizeof(png_colorp)); - png_bytep transparency = (png_bytep)png_malloc(png, nColors * sizeof(png_bytep)); - for (i = 0; i < nColors; i++) { - pngPalette[i].red = colors[4 * i]; - pngPalette[i].green = colors[4 * i + 1]; - pngPalette[i].blue = colors[4 * i + 2]; - transparency[i] = colors[4 * i + 3]; - } - png_set_PLTE(png, info, pngPalette, nColors); - png_set_tRNS(png, info, transparency, nColors, NULL); - png_set_packing(png); // pack pixels - // have libpng free palette and trans: - png_data_freer(png, info, PNG_DESTROY_WILL_FREE_DATA, PNG_FREE_PLTE | PNG_FREE_TRNS); - png_color_16 bkg; - bkg.index = backgroundIndex; - png_set_bKGD(png, info, &bkg); - } - - if (png_color_type != PNG_COLOR_TYPE_PALETTE) { - white.gray = (1 << bpc) - 1; - white.red = white.blue = white.green = white.gray; - png_set_bKGD(png, info, &white); - } - - /* We have to call png_write_info() before setting up the write - * transformation, since it stores data internally in 'png' - * that is needed for the write transformation functions to work. - */ - png_write_info(png, info); - if (png_color_type == PNG_COLOR_TYPE_RGB_ALPHA) { - png_set_write_user_transform_fn(png, canvas_unpremultiply_data); - } else if (format == CAIRO_FORMAT_RGB16_565) { - png_set_write_user_transform_fn(png, canvas_convert_565_to_888); - } else if (png_color_type == PNG_COLOR_TYPE_RGB) { - png_set_write_user_transform_fn(png, canvas_convert_data_to_bytes); - png_set_filler(png, 0, PNG_FILLER_AFTER); - } - - png_write_image(png, rows); - png_write_end(png, info); - - png_destroy_write_struct(&png, &info); - free(rows); - return status; -} - -static void canvas_stream_write_func(png_structp png, png_bytep data, png_size_t size) { - cairo_status_t status; - struct canvas_png_write_closure_t *png_closure; - - png_closure = (struct canvas_png_write_closure_t *) png_get_io_ptr(png); - status = png_closure->write_func(png_closure->closure, data, size); - if (unlikely(status)) { - cairo_status_t *error = (cairo_status_t *) png_get_error_ptr(png); - if (*error == CAIRO_STATUS_SUCCESS) { - *error = status; - } - png_error(png, NULL); - } -} - -static cairo_status_t canvas_write_to_png_stream(cairo_surface_t *surface, cairo_write_func_t write_func, PngClosure* closure) { - struct canvas_png_write_closure_t png_closure; - - if (cairo_surface_status(surface)) { - return cairo_surface_status(surface); - } - - png_closure.write_func = write_func; - png_closure.closure = closure; - - return canvas_write_png(surface, canvas_stream_write_func, &png_closure); -} diff --git a/node_modules/canvas/src/Point.h b/node_modules/canvas/src/Point.h deleted file mode 100644 index d3228ac..0000000 --- a/node_modules/canvas/src/Point.h +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#pragma once - -template -class Point { - public: - T x, y; - Point(T x, T y): x(x), y(y) {} -}; diff --git a/node_modules/canvas/src/Util.h b/node_modules/canvas/src/Util.h deleted file mode 100644 index d60a57e..0000000 --- a/node_modules/canvas/src/Util.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include -#include - -// Wrapper around Nan::SetAccessor that makes it easier to change the last -// argument (signature). Getters/setters must be accessed only when there is -// actually an instance, i.e. MyClass.prototype.getter1 should not try to -// unwrap the non-existent 'this'. See #803, #847, #885, nodejs/node#15099, ... -inline void SetProtoAccessor( - v8::Local tpl, - v8::Local name, - Nan::GetterCallback getter, - Nan::SetterCallback setter, - v8::Local ctor - ) { - Nan::SetAccessor( - tpl, - name, - getter, - setter, - v8::Local(), - v8::DEFAULT, - v8::None, - v8::AccessorSignature::New(v8::Isolate::GetCurrent(), ctor) - ); -} diff --git a/node_modules/canvas/src/backend/Backend.cc b/node_modules/canvas/src/backend/Backend.cc deleted file mode 100644 index a78fecd..0000000 --- a/node_modules/canvas/src/backend/Backend.cc +++ /dev/null @@ -1,112 +0,0 @@ -#include "Backend.h" -#include - -Backend::Backend(std::string name, int width, int height) - : name(name) - , width(width) - , height(height) -{} - -Backend::~Backend() -{ - this->destroySurface(); -} - -void Backend::init(const Nan::FunctionCallbackInfo &info) { - int width = 0; - int height = 0; - if (info[0]->IsNumber()) width = Nan::To(info[0]).FromMaybe(0); - if (info[1]->IsNumber()) height = Nan::To(info[1]).FromMaybe(0); - - Backend *backend = construct(width, height); - - backend->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); -} - -void Backend::setCanvas(Canvas* _canvas) -{ - this->canvas = _canvas; -} - - -cairo_surface_t* Backend::recreateSurface() -{ - this->destroySurface(); - - return this->createSurface(); -} - -DLL_PUBLIC cairo_surface_t* Backend::getSurface() { - if (!surface) createSurface(); - return surface; -} - -void Backend::destroySurface() -{ - if(this->surface) - { - cairo_surface_destroy(this->surface); - this->surface = NULL; - } -} - - -std::string Backend::getName() -{ - return name; -} - -int Backend::getWidth() -{ - return this->width; -} -void Backend::setWidth(int width_) -{ - this->width = width_; - this->recreateSurface(); -} - -int Backend::getHeight() -{ - return this->height; -} -void Backend::setHeight(int height_) -{ - this->height = height_; - this->recreateSurface(); -} - -bool Backend::isSurfaceValid(){ - bool hadSurface = surface != NULL; - bool isValid = true; - - cairo_status_t status = cairo_surface_status(getSurface()); - - if (status != CAIRO_STATUS_SUCCESS) { - error = cairo_status_to_string(status); - isValid = false; - } - - if (!hadSurface) - destroySurface(); - - return isValid; -} - - -BackendOperationNotAvailable::BackendOperationNotAvailable(Backend* backend, - std::string operation_name) - : backend(backend) - , operation_name(operation_name) -{}; - -BackendOperationNotAvailable::~BackendOperationNotAvailable() throw() {}; - -const char* BackendOperationNotAvailable::what() const throw() -{ - std::string msg = "operation " + this->operation_name + - " not supported by backend " + backend->getName(); - - return msg.c_str(); -}; diff --git a/node_modules/canvas/src/backend/Backend.h b/node_modules/canvas/src/backend/Backend.h deleted file mode 100644 index c0c4e19..0000000 --- a/node_modules/canvas/src/backend/Backend.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include -#include "../dll_visibility.h" -#include -#include -#include -#include - -class Canvas; - -class Backend : public Nan::ObjectWrap -{ - private: - const std::string name; - const char* error = NULL; - - protected: - int width; - int height; - cairo_surface_t* surface = nullptr; - Canvas* canvas = nullptr; - - Backend(std::string name, int width, int height); - static void init(const Nan::FunctionCallbackInfo &info); - static Backend *construct(int width, int height){ return nullptr; } - - public: - virtual ~Backend(); - - void setCanvas(Canvas* canvas); - - virtual cairo_surface_t* createSurface() = 0; - virtual cairo_surface_t* recreateSurface(); - - DLL_PUBLIC cairo_surface_t* getSurface(); - virtual void destroySurface(); - - DLL_PUBLIC std::string getName(); - - DLL_PUBLIC int getWidth(); - virtual void setWidth(int width); - - DLL_PUBLIC int getHeight(); - virtual void setHeight(int height); - - // Overridden by ImageBackend. SVG and PDF thus always return INVALID. - virtual cairo_format_t getFormat() { - return CAIRO_FORMAT_INVALID; - } - - bool isSurfaceValid(); - inline const char* getError(){ return error; } -}; - - -class BackendOperationNotAvailable: public std::exception -{ - private: - Backend* backend; - std::string operation_name; - - public: - BackendOperationNotAvailable(Backend* backend, std::string operation_name); - ~BackendOperationNotAvailable() throw(); - - const char* what() const throw(); -}; diff --git a/node_modules/canvas/src/backend/ImageBackend.cc b/node_modules/canvas/src/backend/ImageBackend.cc deleted file mode 100644 index d354d92..0000000 --- a/node_modules/canvas/src/backend/ImageBackend.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include "ImageBackend.h" - -using namespace v8; - -ImageBackend::ImageBackend(int width, int height) - : Backend("image", width, height) - {} - -Backend *ImageBackend::construct(int width, int height){ - return new ImageBackend(width, height); -} - -// This returns an approximate value only, suitable for Nan::AdjustExternalMemory. -// The formats that don't map to intrinsic types (RGB30, A1) round up. -int32_t ImageBackend::approxBytesPerPixel() { - switch (format) { - case CAIRO_FORMAT_ARGB32: - case CAIRO_FORMAT_RGB24: - return 4; -#ifdef CAIRO_FORMAT_RGB30 - case CAIRO_FORMAT_RGB30: - return 3; -#endif - case CAIRO_FORMAT_RGB16_565: - return 2; - case CAIRO_FORMAT_A8: - case CAIRO_FORMAT_A1: - return 1; - default: - return 0; - } -} - -cairo_surface_t* ImageBackend::createSurface() { - assert(!surface); - surface = cairo_image_surface_create(format, width, height); - assert(surface); - Nan::AdjustExternalMemory(approxBytesPerPixel() * width * height); - return surface; -} - -void ImageBackend::destroySurface() { - if (surface) { - cairo_surface_destroy(surface); - surface = nullptr; - Nan::AdjustExternalMemory(-approxBytesPerPixel() * width * height); - } -} - -cairo_format_t ImageBackend::getFormat() { - return format; -} - -void ImageBackend::setFormat(cairo_format_t _format) { - this->format = _format; -} - -Nan::Persistent ImageBackend::constructor; - -void ImageBackend::Initialize(Local target) { - Nan::HandleScope scope; - - Local ctor = Nan::New(ImageBackend::New); - ImageBackend::constructor.Reset(ctor); - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("ImageBackend").ToLocalChecked()); - Nan::Set(target, - Nan::New("ImageBackend").ToLocalChecked(), - Nan::GetFunction(ctor).ToLocalChecked()).Check(); -} - -NAN_METHOD(ImageBackend::New) { - init(info); -} diff --git a/node_modules/canvas/src/backend/ImageBackend.h b/node_modules/canvas/src/backend/ImageBackend.h deleted file mode 100644 index f68dacf..0000000 --- a/node_modules/canvas/src/backend/ImageBackend.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "Backend.h" -#include - -class ImageBackend : public Backend -{ - private: - cairo_surface_t* createSurface(); - void destroySurface(); - cairo_format_t format = DEFAULT_FORMAT; - - public: - ImageBackend(int width, int height); - static Backend *construct(int width, int height); - - cairo_format_t getFormat(); - void setFormat(cairo_format_t format); - - int32_t approxBytesPerPixel(); - - static Nan::Persistent constructor; - static void Initialize(v8::Local target); - static NAN_METHOD(New); - const static cairo_format_t DEFAULT_FORMAT = CAIRO_FORMAT_ARGB32; -}; diff --git a/node_modules/canvas/src/backend/PdfBackend.cc b/node_modules/canvas/src/backend/PdfBackend.cc deleted file mode 100644 index d8bd234..0000000 --- a/node_modules/canvas/src/backend/PdfBackend.cc +++ /dev/null @@ -1,53 +0,0 @@ -#include "PdfBackend.h" - -#include -#include "../Canvas.h" -#include "../closure.h" - -using namespace v8; - -PdfBackend::PdfBackend(int width, int height) - : Backend("pdf", width, height) { - createSurface(); -} - -PdfBackend::~PdfBackend() { - cairo_surface_finish(surface); - if (_closure) delete _closure; - destroySurface(); -} - -Backend *PdfBackend::construct(int width, int height){ - return new PdfBackend(width, height); -} - -cairo_surface_t* PdfBackend::createSurface() { - if (!_closure) _closure = new PdfSvgClosure(canvas); - surface = cairo_pdf_surface_create_for_stream(PdfSvgClosure::writeVec, _closure, width, height); - return surface; -} - -cairo_surface_t* PdfBackend::recreateSurface() { - cairo_pdf_surface_set_size(surface, width, height); - - return surface; -} - - -Nan::Persistent PdfBackend::constructor; - -void PdfBackend::Initialize(Local target) { - Nan::HandleScope scope; - - Local ctor = Nan::New(PdfBackend::New); - PdfBackend::constructor.Reset(ctor); - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("PdfBackend").ToLocalChecked()); - Nan::Set(target, - Nan::New("PdfBackend").ToLocalChecked(), - Nan::GetFunction(ctor).ToLocalChecked()).Check(); -} - -NAN_METHOD(PdfBackend::New) { - init(info); -} diff --git a/node_modules/canvas/src/backend/PdfBackend.h b/node_modules/canvas/src/backend/PdfBackend.h deleted file mode 100644 index 03656f5..0000000 --- a/node_modules/canvas/src/backend/PdfBackend.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Backend.h" -#include "../closure.h" -#include - -class PdfBackend : public Backend -{ - private: - cairo_surface_t* createSurface(); - cairo_surface_t* recreateSurface(); - - public: - PdfSvgClosure* _closure = NULL; - inline PdfSvgClosure* closure() { return _closure; } - - PdfBackend(int width, int height); - ~PdfBackend(); - static Backend *construct(int width, int height); - - static Nan::Persistent constructor; - static void Initialize(v8::Local target); - static NAN_METHOD(New); -}; diff --git a/node_modules/canvas/src/backend/SvgBackend.cc b/node_modules/canvas/src/backend/SvgBackend.cc deleted file mode 100644 index 10bf4ca..0000000 --- a/node_modules/canvas/src/backend/SvgBackend.cc +++ /dev/null @@ -1,61 +0,0 @@ -#include "SvgBackend.h" - -#include -#include "../Canvas.h" -#include "../closure.h" -#include - -using namespace v8; - -SvgBackend::SvgBackend(int width, int height) - : Backend("svg", width, height) { - createSurface(); -} - -SvgBackend::~SvgBackend() { - cairo_surface_finish(surface); - if (_closure) { - delete _closure; - _closure = nullptr; - } - destroySurface(); -} - -Backend *SvgBackend::construct(int width, int height){ - return new SvgBackend(width, height); -} - -cairo_surface_t* SvgBackend::createSurface() { - assert(!_closure); - _closure = new PdfSvgClosure(canvas); - surface = cairo_svg_surface_create_for_stream(PdfSvgClosure::writeVec, _closure, width, height); - return surface; -} - -cairo_surface_t* SvgBackend::recreateSurface() { - cairo_surface_finish(surface); - delete _closure; - _closure = nullptr; - cairo_surface_destroy(surface); - - return createSurface(); - } - - -Nan::Persistent SvgBackend::constructor; - -void SvgBackend::Initialize(Local target) { - Nan::HandleScope scope; - - Local ctor = Nan::New(SvgBackend::New); - SvgBackend::constructor.Reset(ctor); - ctor->InstanceTemplate()->SetInternalFieldCount(1); - ctor->SetClassName(Nan::New("SvgBackend").ToLocalChecked()); - Nan::Set(target, - Nan::New("SvgBackend").ToLocalChecked(), - Nan::GetFunction(ctor).ToLocalChecked()).Check(); -} - -NAN_METHOD(SvgBackend::New) { - init(info); -} diff --git a/node_modules/canvas/src/backend/SvgBackend.h b/node_modules/canvas/src/backend/SvgBackend.h deleted file mode 100644 index 6377b43..0000000 --- a/node_modules/canvas/src/backend/SvgBackend.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Backend.h" -#include "../closure.h" -#include - -class SvgBackend : public Backend -{ - private: - cairo_surface_t* createSurface(); - cairo_surface_t* recreateSurface(); - - public: - PdfSvgClosure* _closure = NULL; - inline PdfSvgClosure* closure() { return _closure; } - - SvgBackend(int width, int height); - ~SvgBackend(); - static Backend *construct(int width, int height); - - static Nan::Persistent constructor; - static void Initialize(v8::Local target); - static NAN_METHOD(New); -}; diff --git a/node_modules/canvas/src/bmp/BMPParser.cc b/node_modules/canvas/src/bmp/BMPParser.cc deleted file mode 100644 index 6ceaed7..0000000 --- a/node_modules/canvas/src/bmp/BMPParser.cc +++ /dev/null @@ -1,445 +0,0 @@ -#include "BMPParser.h" - -#include - -using namespace std; -using namespace BMPParser; - -#define MAX_IMG_SIZE 10000 - -#define E(cond, msg) if(cond) return setErr(msg) -#define EU(cond, msg) if(cond) return setErrUnsupported(msg) -#define EX(cond, msg) if(cond) return setErrUnknown(msg) - -#define I1() get() -#define U1() get() -#define I2() get() -#define U2() get() -#define I4() get() -#define U4() get() - -#define I1UC() get() -#define U1UC() get() -#define I2UC() get() -#define U2UC() get() -#define I4UC() get() -#define U4UC() get() - -#define CHECK_OVERRUN(ptr, size, type) \ - if((ptr) + (size) - data > len){ \ - setErr("unexpected end of file"); \ - return type(); \ - } - -Parser::~Parser(){ - data = nullptr; - ptr = nullptr; - - if(imgd){ - delete[] imgd; - imgd = nullptr; - } -} - -void Parser::parse(uint8_t *buf, int bufSize, uint8_t *format){ - assert(status == Status::EMPTY); - - data = ptr = buf; - len = bufSize; - - // Start parsing file header - setOp("file header"); - - // File header signature - string fhSig = getStr(2); - string temp = "file header signature"; - EU(fhSig == "BA", temp + " \"BA\""); - EU(fhSig == "CI", temp + " \"CI\""); - EU(fhSig == "CP", temp + " \"CP\""); - EU(fhSig == "IC", temp + " \"IC\""); - EU(fhSig == "PT", temp + " \"PT\""); - EX(fhSig != "BM", temp); // BM - - // Length of the file should not be larger than `len` - E(U4() > static_cast(len), "inconsistent file size"); - - // Skip unused values - skip(4); - - // Offset where the pixel array (bitmap data) can be found - auto imgdOffset = U4(); - - // Start parsing DIB header - setOp("DIB header"); - - // Prepare some variables in case they are needed - uint32_t compr = 0; - uint32_t redShift = 0, greenShift = 0, blueShift = 0, alphaShift = 0; - uint32_t redMask = 0, greenMask = 0, blueMask = 0, alphaMask = 0; - double redMultp = 0, greenMultp = 0, blueMultp = 0, alphaMultp = 0; - - /** - * Type of the DIB (device-independent bitmap) header - * is determined by its size. Most BMP files use BITMAPINFOHEADER. - */ - auto dibSize = U4(); - temp = "DIB header"; - EU(dibSize == 64, temp + " \"OS22XBITMAPHEADER\""); - EU(dibSize == 16, temp + " \"OS22XBITMAPHEADER\""); - - uint32_t infoHeader = dibSize == 40 ? 1 : - dibSize == 52 ? 2 : - dibSize == 56 ? 3 : - dibSize == 108 ? 4 : - dibSize == 124 ? 5 : 0; - - // BITMAPCOREHEADER, BITMAP*INFOHEADER, BITMAP*HEADER - auto isDibValid = dibSize == 12 || infoHeader; - EX(!isDibValid, temp); - - // Image width - w = dibSize == 12 ? U2() : I4(); - E(!w, "image width is 0"); - E(w < 0, "negative image width"); - E(w > MAX_IMG_SIZE, "too large image width"); - - // Image height (specification allows negative values) - h = dibSize == 12 ? U2() : I4(); - E(!h, "image height is 0"); - E(h > MAX_IMG_SIZE, "too large image height"); - - bool isHeightNegative = h < 0; - if(isHeightNegative) h = -h; - - // Number of color planes (must be 1) - E(U2() != 1, "number of color planes must be 1"); - - // Bits per pixel (color depth) - auto bpp = U2(); - auto isBppValid = bpp == 1 || bpp == 4 || bpp == 8 || bpp == 16 || bpp == 24 || bpp == 32; - EU(!isBppValid, "color depth"); - - // Calculate image data size and padding - uint32_t expectedImgdSize = (((w * bpp + 31) >> 5) << 2) * h; - uint32_t rowPadding = (-w * bpp & 31) >> 3; - uint32_t imgdSize = 0; - - // Color palette data - uint8_t* paletteStart = nullptr; - uint32_t palColNum = 0; - - if(infoHeader){ - // Compression type - compr = U4(); - temp = "compression type"; - EU(compr == 1, temp + " \"BI_RLE8\""); - EU(compr == 2, temp + " \"BI_RLE4\""); - EU(compr == 4, temp + " \"BI_JPEG\""); - EU(compr == 5, temp + " \"BI_PNG\""); - EU(compr == 6, temp + " \"BI_ALPHABITFIELDS\""); - EU(compr == 11, temp + " \"BI_CMYK\""); - EU(compr == 12, temp + " \"BI_CMYKRLE8\""); - EU(compr == 13, temp + " \"BI_CMYKRLE4\""); - - // BI_RGB and BI_BITFIELDS - auto isComprValid = compr == 0 || compr == 3; - EX(!isComprValid, temp); - - // Uncompressed 16-bit color is not supported - EU(compr == 0 && bpp == 16, "uncompressed 16-bit color"); - - // Ensure that BI_BITFIELDS appears only with 16-bit or 32-bit color - E(compr == 3 && !(bpp == 16 || bpp == 32), "compression BI_BITFIELDS can be used only with 16-bit and 32-bit color depth"); - - // Size of the image data - imgdSize = U4(); - - // Horizontal and vertical resolution (ignored) - skip(8); - - // Number of colors in the palette or 0 if no palette is present - palColNum = U4(); - EU(palColNum && bpp > 8, "color palette and bit depth combination"); - if(palColNum) paletteStart = data + dibSize + 14; - - // Number of important colors used or 0 if all colors are important (generally ignored) - skip(4); - - if(infoHeader >= 2){ - // If BI_BITFIELDS are used, calculate masks, otherwise ignore them - if(compr == 3){ - calcMaskShift(redShift, redMask, redMultp); - calcMaskShift(greenShift, greenMask, greenMultp); - calcMaskShift(blueShift, blueMask, blueMultp); - if(infoHeader >= 3) calcMaskShift(alphaShift, alphaMask, alphaMultp); - if(status == Status::ERROR) return; - }else{ - skip(16); - } - - // Ensure that the color space is LCS_WINDOWS_COLOR_SPACE or sRGB - if(infoHeader >= 4 && !palColNum){ - string colSpace = getStr(4, 1); - EU(colSpace != "Win " && colSpace != "sRGB", "color space \"" + colSpace + "\""); - } - } - } - - // Skip to the image data (there may be other chunks between, but they are optional) - E(ptr - data > imgdOffset, "image data overlaps with another structure"); - ptr = data + imgdOffset; - - // Start parsing image data - setOp("image data"); - - if(!imgdSize){ - // Value 0 is allowed only for BI_RGB compression type - E(compr != 0, "missing image data size"); - imgdSize = expectedImgdSize; - }else{ - E(imgdSize != expectedImgdSize, "inconsistent image data size"); - } - - // Ensure that all image data is present - E(ptr - data + imgdSize > len, "not enough image data"); - - // Direction of reading rows - int yStart = h - 1; - int yEnd = -1; - int dy = isHeightNegative ? 1 : -1; - - // In case of negative height, read rows backward - if(isHeightNegative){ - yStart = 0; - yEnd = h; - } - - // Allocate output image data array - int buffLen = w * h << 2; - imgd = new (nothrow) uint8_t[buffLen]; - E(!imgd, "unable to allocate memory"); - - // Prepare color values - uint8_t color[4] = {0}; - uint8_t &red = color[0]; - uint8_t &green = color[1]; - uint8_t &blue = color[2]; - uint8_t &alpha = color[3]; - - // Check if pre-multiplied alpha is used - bool premul = format ? format[4] : 0; - - // Main loop - for(int y = yStart; y != yEnd; y += dy){ - // Use in-byte offset for bpp < 8 - uint8_t colOffset = 0; - uint8_t cval = 0; - - for(int x = 0; x != w; x++){ - // Index in the output image data - int i = (x + y * w) << 2; - - switch(compr){ - case 0: // BI_RGB - switch(bpp){ - case 1: - if(colOffset) ptr--; - cval = (U1UC() >> (7 - colOffset)) & 1; - - if(palColNum){ - uint8_t* entry = paletteStart + (cval << 2); - blue = get(entry); - green = get(entry + 1); - red = get(entry + 2); - if(status == Status::ERROR) return; - }else{ - red = green = blue = cval ? 255 : 0; - } - - alpha = 255; - colOffset = (colOffset + 1) & 7; - break; - - case 4: - if(colOffset) ptr--; - cval = (U1UC() >> (4 - colOffset)) & 15; - - if(palColNum){ - uint8_t* entry = paletteStart + (cval << 2); - blue = get(entry); - green = get(entry + 1); - red = get(entry + 2); - if(status == Status::ERROR) return; - }else{ - red = green = blue = cval << 4; - } - - alpha = 255; - colOffset = (colOffset + 4) & 7; - break; - - case 8: - cval = U1UC(); - - if(palColNum){ - uint8_t* entry = paletteStart + (cval << 2); - blue = get(entry); - green = get(entry + 1); - red = get(entry + 2); - if(status == Status::ERROR) return; - }else{ - red = green = blue = cval; - } - - alpha = 255; - break; - - case 24: - blue = U1UC(); - green = U1UC(); - red = U1UC(); - alpha = 255; - break; - - case 32: - blue = U1UC(); - green = U1UC(); - red = U1UC(); - alpha = U1UC(); - break; - } - break; - - case 3: // BI_BITFIELDS - uint32_t col = bpp == 16 ? U2UC() : U4UC(); - red = ((col >> redShift) & redMask) * redMultp + .5; - green = ((col >> greenShift) & greenMask) * greenMultp + .5; - blue = ((col >> blueShift) & blueMask) * blueMultp + .5; - alpha = alphaMask ? ((col >> alphaShift) & alphaMask) * alphaMultp + .5 : 255; - break; - } - - /** - * Pixel format: - * red, - * green, - * blue, - * alpha, - * is alpha pre-multiplied - * Default is [0, 1, 2, 3, 0] - */ - - if(premul && alpha != 255){ - double a = alpha / 255.; - red = static_cast(red * a + .5); - green = static_cast(green * a + .5); - blue = static_cast(blue * a + .5); - } - - if(format){ - imgd[i] = color[format[0]]; - imgd[i + 1] = color[format[1]]; - imgd[i + 2] = color[format[2]]; - imgd[i + 3] = color[format[3]]; - }else{ - imgd[i] = red; - imgd[i + 1] = green; - imgd[i + 2] = blue; - imgd[i + 3] = alpha; - } - } - - // Skip unused bytes in the current row - skip(rowPadding); - } - - if(status == Status::ERROR) return; - - E(ptr - data != len, "extra data found at the end of file"); - status = Status::OK; -}; - -void Parser::clearImgd(){ imgd = nullptr; } -int32_t Parser::getWidth() const{ return w; } -int32_t Parser::getHeight() const{ return h; } -uint8_t *Parser::getImgd() const{ return imgd; } -Status Parser::getStatus() const{ return status; } - -string Parser::getErrMsg() const{ - return "Error while processing " + getOp() + " - " + err; -} - -template inline T Parser::get(){ - if(check) - CHECK_OVERRUN(ptr, sizeof(T), T); - T val = *(T*)ptr; - ptr += sizeof(T); - return val; -} - -template inline T Parser::get(uint8_t* pointer){ - if(check) - CHECK_OVERRUN(pointer, sizeof(T), T); - T val = *(T*)pointer; - return val; -} - -string Parser::getStr(int size, bool reverse){ - CHECK_OVERRUN(ptr, size, string); - string val = ""; - - while(size--){ - if(reverse) val = string(1, static_cast(*ptr++)) + val; - else val += static_cast(*ptr++); - } - - return val; -} - -inline void Parser::skip(int size){ - CHECK_OVERRUN(ptr, size, void); - ptr += size; -} - -void Parser::calcMaskShift(uint32_t& shift, uint32_t& mask, double& multp){ - mask = U4(); - shift = 0; - - if(mask == 0) return; - - while(~mask & 1){ - mask >>= 1; - shift++; - } - - E(mask & (mask + 1), "invalid color mask"); - - multp = 255. / mask; -} - -void Parser::setOp(string val){ - if(status != Status::EMPTY) return; - op = val; -} - -string Parser::getOp() const{ - return op; -} - -void Parser::setErrUnsupported(string msg){ - setErr("unsupported " + msg); -} - -void Parser::setErrUnknown(string msg){ - setErr("unknown " + msg); -} - -void Parser::setErr(string msg){ - if(status != Status::EMPTY) return; - err = msg; - status = Status::ERROR; -} - -string Parser::getErr() const{ - return err; -} diff --git a/node_modules/canvas/src/bmp/BMPParser.h b/node_modules/canvas/src/bmp/BMPParser.h deleted file mode 100644 index c35f51a..0000000 --- a/node_modules/canvas/src/bmp/BMPParser.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once - -#ifdef ERROR -#define ERROR_ ERROR -#undef ERROR -#endif - -#include // node < 7 uses libstdc++ on macOS which lacks complete c++11 -#include - -namespace BMPParser{ - enum Status{ - EMPTY, - OK, - ERROR, - }; - - class Parser{ - public: - Parser()=default; - ~Parser(); - void parse(uint8_t *buf, int bufSize, uint8_t *format=nullptr); - void clearImgd(); - int32_t getWidth() const; - int32_t getHeight() const; - uint8_t *getImgd() const; - Status getStatus() const; - std::string getErrMsg() const; - - private: - Status status = Status::EMPTY; - uint8_t *data = nullptr; - uint8_t *ptr = nullptr; - int len = 0; - int32_t w = 0; - int32_t h = 0; - uint8_t *imgd = nullptr; - std::string err = ""; - std::string op = ""; - - template inline T get(); - template inline T get(uint8_t* pointer); - std::string getStr(int len, bool reverse=false); - inline void skip(int len); - void calcMaskShift(uint32_t& shift, uint32_t& mask, double& multp); - - void setOp(std::string val); - std::string getOp() const; - - void setErrUnsupported(std::string msg); - void setErrUnknown(std::string msg); - void setErr(std::string msg); - std::string getErr() const; - }; -} - -#ifdef ERROR_ -#define ERROR ERROR_ -#undef ERROR_ -#endif diff --git a/node_modules/canvas/src/bmp/LICENSE.md b/node_modules/canvas/src/bmp/LICENSE.md deleted file mode 100644 index 6bb8a29..0000000 --- a/node_modules/canvas/src/bmp/LICENSE.md +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to \ No newline at end of file diff --git a/node_modules/canvas/src/closure.cc b/node_modules/canvas/src/closure.cc deleted file mode 100644 index c633275..0000000 --- a/node_modules/canvas/src/closure.cc +++ /dev/null @@ -1,23 +0,0 @@ -#include "closure.h" - -void JpegClosure::init_destination(j_compress_ptr cinfo) { - JpegClosure* closure = (JpegClosure*)cinfo->client_data; - closure->vec.resize(PAGE_SIZE); - closure->jpeg_dest_mgr->next_output_byte = &closure->vec[0]; - closure->jpeg_dest_mgr->free_in_buffer = closure->vec.size(); -} - -boolean JpegClosure::empty_output_buffer(j_compress_ptr cinfo) { - JpegClosure* closure = (JpegClosure*)cinfo->client_data; - size_t currentSize = closure->vec.size(); - closure->vec.resize(currentSize * 1.5); - closure->jpeg_dest_mgr->next_output_byte = &closure->vec[currentSize]; - closure->jpeg_dest_mgr->free_in_buffer = closure->vec.size() - currentSize; - return true; -} - -void JpegClosure::term_destination(j_compress_ptr cinfo) { - JpegClosure* closure = (JpegClosure*)cinfo->client_data; - size_t finalSize = closure->vec.size() - closure->jpeg_dest_mgr->free_in_buffer; - closure->vec.resize(finalSize); -} diff --git a/node_modules/canvas/src/closure.h b/node_modules/canvas/src/closure.h deleted file mode 100644 index 36bec0a..0000000 --- a/node_modules/canvas/src/closure.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#pragma once - -#include "Canvas.h" -#include -#include -#include -#include // node < 7 uses libstdc++ on macOS which lacks complete c++11 -#include - -#ifndef PAGE_SIZE - #define PAGE_SIZE 4096 -#endif - -/* - * Image encoding closures. - */ - -struct Closure { - std::vector vec; - Nan::Callback cb; - Canvas* canvas = nullptr; - cairo_status_t status = CAIRO_STATUS_SUCCESS; - - static cairo_status_t writeVec(void *c, const uint8_t *odata, unsigned len) { - Closure* closure = static_cast(c); - try { - closure->vec.insert(closure->vec.end(), odata, odata + len); - } catch (const std::bad_alloc &) { - return CAIRO_STATUS_NO_MEMORY; - } - return CAIRO_STATUS_SUCCESS; - } - - Closure(Canvas* canvas) : canvas(canvas) {}; -}; - -struct PdfSvgClosure : Closure { - PdfSvgClosure(Canvas* canvas) : Closure(canvas) {}; -}; - -struct PngClosure : Closure { - uint32_t compressionLevel = 6; - uint32_t filters = PNG_ALL_FILTERS; - uint32_t resolution = 0; // 0 = unspecified - // Indexed PNGs: - uint32_t nPaletteColors = 0; - uint8_t* palette = nullptr; - uint8_t backgroundIndex = 0; - - PngClosure(Canvas* canvas) : Closure(canvas) {}; -}; - -struct JpegClosure : Closure { - uint32_t quality = 75; - uint32_t chromaSubsampling = 2; - bool progressive = false; - jpeg_destination_mgr* jpeg_dest_mgr = nullptr; - - static void init_destination(j_compress_ptr cinfo); - static boolean empty_output_buffer(j_compress_ptr cinfo); - static void term_destination(j_compress_ptr cinfo); - - JpegClosure(Canvas* canvas) : Closure(canvas) { - jpeg_dest_mgr = new jpeg_destination_mgr; - jpeg_dest_mgr->init_destination = init_destination; - jpeg_dest_mgr->empty_output_buffer = empty_output_buffer; - jpeg_dest_mgr->term_destination = term_destination; - }; - - ~JpegClosure() { - delete jpeg_dest_mgr; - } -}; diff --git a/node_modules/canvas/src/color.cc b/node_modules/canvas/src/color.cc deleted file mode 100644 index 8c41f11..0000000 --- a/node_modules/canvas/src/color.cc +++ /dev/null @@ -1,775 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#include "color.h" - -#include -#include -#include -#include -#include -#include -#include - -// Compatibility with Visual Studio versions prior to VS2015 -#if defined(_MSC_VER) && _MSC_VER < 1900 -#define snprintf _snprintf -#endif - -/* - * Parse integer value - */ - -template -static bool -parse_integer(const char** pStr, parsed_t *pParsed) { - parsed_t& c = *pParsed; - const char*& str = *pStr; - int8_t sign=1; - - c = 0; - if (*str == '-') { - sign=-1; - ++str; - } - else if (*str == '+') - ++str; - - if (*str >= '0' && *str <= '9') { - do { - c *= 10; - c += *str++ - '0'; - } while (*str >= '0' && *str <= '9'); - } else { - return false; - } - if (sign<0) - c=-c; - return true; -} - - -/* - * Parse CSS value - * Adapted from http://crackprogramming.blogspot.co.il/2012/10/implement-atof.html - */ - -template -static bool -parse_css_number(const char** pStr, parsed_t *pParsed) { - parsed_t &parsed = *pParsed; - const char*& str = *pStr; - const char* startStr = str; - if (!str || !*str) - return false; - parsed_t integerPart = 0; - parsed_t fractionPart = 0; - int divisorForFraction = 1; - int sign = 1; - int exponent = 0; - int digits = 0; - bool inFraction = false; - - if (*str == '-') { - ++str; - sign = -1; - } - else if (*str == '+') - ++str; - while (*str != '\0') { - if (*str >= '0' && *str <= '9') { - if (digits>=std::numeric_limits::digits10) { - if (!inFraction) - return false; - } - else { - ++digits; - - if (inFraction) { - fractionPart = fractionPart*10 + (*str - '0'); - divisorForFraction *= 10; - } - else { - integerPart = integerPart*10 + (*str - '0'); - } - } - } - else if (*str == '.') { - if (inFraction) - break; - else - inFraction = true; - } - else if (*str == 'e') { - ++str; - if (!parse_integer(&str, &exponent)) - return false; - break; - } - else - break; - ++str; - } - if (str != startStr) { - parsed = sign * (integerPart + fractionPart/divisorForFraction); - for (;exponent>0;--exponent) - parsed *= 10; - for (;exponent<0;++exponent) - parsed /= 10; - return true; - } - return false; -} - -/* - * Clip value to the range [minValue, maxValue] - */ - -template -static T -clip(T value, T minValue, T maxValue) { - if (value > maxValue) - value = maxValue; - if (value < minValue) - value = minValue; - return value; -} - -/* - * Wrap value to the range [0, limit] - */ - -template -static T -wrap_float(T value, T limit) { - return fmod(fmod(value, limit) + limit, limit); -} - -/* - * Wrap value to the range [0, limit] - currently-unused integer version of wrap_float - */ - -// template -// static T wrap_int(T value, T limit) { -// return (value % limit + limit) % limit; -// } - -/* - * Parse color channel value - */ - -static bool -parse_rgb_channel(const char** pStr, uint8_t *pChannel) { - int channel; - if (parse_integer(pStr, &channel)) { - *pChannel = clip(channel, 0, 255); - return true; - } - return false; -} - -/* - * Parse a value in degrees - */ - -static bool -parse_degrees(const char** pStr, float *pDegrees) { - float degrees; - if (parse_css_number(pStr, °rees)) { - *pDegrees = wrap_float(degrees, 360.0f); - return true; - } - return false; -} - -/* - * Parse and clip a percentage value. Returns a float in the range [0, 1]. - */ - -static bool -parse_clipped_percentage(const char** pStr, float *pFraction) { - float percentage; - bool result = parse_css_number(pStr,&percentage); - const char*& str = *pStr; - if (result) { - if (*str == '%') { - ++str; - *pFraction = clip(percentage, 0.0f, 100.0f) / 100.0f; - return result; - } - } - return false; -} - -/* - * Macros to help with parsing inside rgba_from_*_string - */ - -#define WHITESPACE \ - while (' ' == *str) ++str; - -#define WHITESPACE_OR_COMMA \ - while (' ' == *str || ',' == *str) ++str; - -#define CHANNEL(NAME) \ - if (!parse_rgb_channel(&str, &NAME)) \ - return 0; \ - -#define HUE(NAME) \ - if (!parse_degrees(&str, &NAME)) \ - return 0; - -#define SATURATION(NAME) \ - if (!parse_clipped_percentage(&str, &NAME)) \ - return 0; - -#define LIGHTNESS(NAME) SATURATION(NAME) - -#define ALPHA(NAME) \ - if (*str >= '1' && *str <= '9') { \ - NAME = 1; \ - } else { \ - if ('0' == *str) ++str; \ - if ('.' == *str) { \ - ++str; \ - float n = .1f; \ - while (*str >= '0' && *str <= '9') { \ - NAME += (*str++ - '0') * n; \ - n *= .1f; \ - } \ - } \ - } \ - do {} while (0) // require trailing semicolon - -/* - * Named colors. - */ -static const std::map named_colors = { - { "transparent", 0xFFFFFF00} - , { "aliceblue", 0xF0F8FFFF } - , { "antiquewhite", 0xFAEBD7FF } - , { "aqua", 0x00FFFFFF } - , { "aquamarine", 0x7FFFD4FF } - , { "azure", 0xF0FFFFFF } - , { "beige", 0xF5F5DCFF } - , { "bisque", 0xFFE4C4FF } - , { "black", 0x000000FF } - , { "blanchedalmond", 0xFFEBCDFF } - , { "blue", 0x0000FFFF } - , { "blueviolet", 0x8A2BE2FF } - , { "brown", 0xA52A2AFF } - , { "burlywood", 0xDEB887FF } - , { "cadetblue", 0x5F9EA0FF } - , { "chartreuse", 0x7FFF00FF } - , { "chocolate", 0xD2691EFF } - , { "coral", 0xFF7F50FF } - , { "cornflowerblue", 0x6495EDFF } - , { "cornsilk", 0xFFF8DCFF } - , { "crimson", 0xDC143CFF } - , { "cyan", 0x00FFFFFF } - , { "darkblue", 0x00008BFF } - , { "darkcyan", 0x008B8BFF } - , { "darkgoldenrod", 0xB8860BFF } - , { "darkgray", 0xA9A9A9FF } - , { "darkgreen", 0x006400FF } - , { "darkgrey", 0xA9A9A9FF } - , { "darkkhaki", 0xBDB76BFF } - , { "darkmagenta", 0x8B008BFF } - , { "darkolivegreen", 0x556B2FFF } - , { "darkorange", 0xFF8C00FF } - , { "darkorchid", 0x9932CCFF } - , { "darkred", 0x8B0000FF } - , { "darksalmon", 0xE9967AFF } - , { "darkseagreen", 0x8FBC8FFF } - , { "darkslateblue", 0x483D8BFF } - , { "darkslategray", 0x2F4F4FFF } - , { "darkslategrey", 0x2F4F4FFF } - , { "darkturquoise", 0x00CED1FF } - , { "darkviolet", 0x9400D3FF } - , { "deeppink", 0xFF1493FF } - , { "deepskyblue", 0x00BFFFFF } - , { "dimgray", 0x696969FF } - , { "dimgrey", 0x696969FF } - , { "dodgerblue", 0x1E90FFFF } - , { "firebrick", 0xB22222FF } - , { "floralwhite", 0xFFFAF0FF } - , { "forestgreen", 0x228B22FF } - , { "fuchsia", 0xFF00FFFF } - , { "gainsboro", 0xDCDCDCFF } - , { "ghostwhite", 0xF8F8FFFF } - , { "gold", 0xFFD700FF } - , { "goldenrod", 0xDAA520FF } - , { "gray", 0x808080FF } - , { "green", 0x008000FF } - , { "greenyellow", 0xADFF2FFF } - , { "grey", 0x808080FF } - , { "honeydew", 0xF0FFF0FF } - , { "hotpink", 0xFF69B4FF } - , { "indianred", 0xCD5C5CFF } - , { "indigo", 0x4B0082FF } - , { "ivory", 0xFFFFF0FF } - , { "khaki", 0xF0E68CFF } - , { "lavender", 0xE6E6FAFF } - , { "lavenderblush", 0xFFF0F5FF } - , { "lawngreen", 0x7CFC00FF } - , { "lemonchiffon", 0xFFFACDFF } - , { "lightblue", 0xADD8E6FF } - , { "lightcoral", 0xF08080FF } - , { "lightcyan", 0xE0FFFFFF } - , { "lightgoldenrodyellow", 0xFAFAD2FF } - , { "lightgray", 0xD3D3D3FF } - , { "lightgreen", 0x90EE90FF } - , { "lightgrey", 0xD3D3D3FF } - , { "lightpink", 0xFFB6C1FF } - , { "lightsalmon", 0xFFA07AFF } - , { "lightseagreen", 0x20B2AAFF } - , { "lightskyblue", 0x87CEFAFF } - , { "lightslategray", 0x778899FF } - , { "lightslategrey", 0x778899FF } - , { "lightsteelblue", 0xB0C4DEFF } - , { "lightyellow", 0xFFFFE0FF } - , { "lime", 0x00FF00FF } - , { "limegreen", 0x32CD32FF } - , { "linen", 0xFAF0E6FF } - , { "magenta", 0xFF00FFFF } - , { "maroon", 0x800000FF } - , { "mediumaquamarine", 0x66CDAAFF } - , { "mediumblue", 0x0000CDFF } - , { "mediumorchid", 0xBA55D3FF } - , { "mediumpurple", 0x9370DBFF } - , { "mediumseagreen", 0x3CB371FF } - , { "mediumslateblue", 0x7B68EEFF } - , { "mediumspringgreen", 0x00FA9AFF } - , { "mediumturquoise", 0x48D1CCFF } - , { "mediumvioletred", 0xC71585FF } - , { "midnightblue", 0x191970FF } - , { "mintcream", 0xF5FFFAFF } - , { "mistyrose", 0xFFE4E1FF } - , { "moccasin", 0xFFE4B5FF } - , { "navajowhite", 0xFFDEADFF } - , { "navy", 0x000080FF } - , { "oldlace", 0xFDF5E6FF } - , { "olive", 0x808000FF } - , { "olivedrab", 0x6B8E23FF } - , { "orange", 0xFFA500FF } - , { "orangered", 0xFF4500FF } - , { "orchid", 0xDA70D6FF } - , { "palegoldenrod", 0xEEE8AAFF } - , { "palegreen", 0x98FB98FF } - , { "paleturquoise", 0xAFEEEEFF } - , { "palevioletred", 0xDB7093FF } - , { "papayawhip", 0xFFEFD5FF } - , { "peachpuff", 0xFFDAB9FF } - , { "peru", 0xCD853FFF } - , { "pink", 0xFFC0CBFF } - , { "plum", 0xDDA0DDFF } - , { "powderblue", 0xB0E0E6FF } - , { "purple", 0x800080FF } - , { "rebeccapurple", 0x663399FF } // Source: CSS Color Level 4 draft - , { "red", 0xFF0000FF } - , { "rosybrown", 0xBC8F8FFF } - , { "royalblue", 0x4169E1FF } - , { "saddlebrown", 0x8B4513FF } - , { "salmon", 0xFA8072FF } - , { "sandybrown", 0xF4A460FF } - , { "seagreen", 0x2E8B57FF } - , { "seashell", 0xFFF5EEFF } - , { "sienna", 0xA0522DFF } - , { "silver", 0xC0C0C0FF } - , { "skyblue", 0x87CEEBFF } - , { "slateblue", 0x6A5ACDFF } - , { "slategray", 0x708090FF } - , { "slategrey", 0x708090FF } - , { "snow", 0xFFFAFAFF } - , { "springgreen", 0x00FF7FFF } - , { "steelblue", 0x4682B4FF } - , { "tan", 0xD2B48CFF } - , { "teal", 0x008080FF } - , { "thistle", 0xD8BFD8FF } - , { "tomato", 0xFF6347FF } - , { "turquoise", 0x40E0D0FF } - , { "violet", 0xEE82EEFF } - , { "wheat", 0xF5DEB3FF } - , { "white", 0xFFFFFFFF } - , { "whitesmoke", 0xF5F5F5FF } - , { "yellow", 0xFFFF00FF } - , { "yellowgreen", 0x9ACD32FF } -}; - -/* - * Hex digit int val. - */ - -static int -h(char c) { - switch (c) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - return c - '0'; - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - return (c - 'a') + 10; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - return (c - 'A') + 10; - } - return 0; -} - -/* - * Return rgba_t from rgba. - */ - -rgba_t -rgba_create(uint32_t rgba) { - rgba_t color; - color.r = (double) (rgba >> 24) / 255; - color.g = (double) (rgba >> 16 & 0xff) / 255; - color.b = (double) (rgba >> 8 & 0xff) / 255; - color.a = (double) (rgba & 0xff) / 255; - return color; -} - -/* - * Return a string representation of the color. - */ - -void -rgba_to_string(rgba_t rgba, char *buf, size_t len) { - if (1 == rgba.a) { - snprintf(buf, len, "#%.2x%.2x%.2x", - static_cast(round(rgba.r * 255)), - static_cast(round(rgba.g * 255)), - static_cast(round(rgba.b * 255))); - } else { - snprintf(buf, len, "rgba(%d, %d, %d, %.2f)", - static_cast(round(rgba.r * 255)), - static_cast(round(rgba.g * 255)), - static_cast(round(rgba.b * 255)), - rgba.a); - } -} - -/* - * Return rgba from (r,g,b,a). - */ - -static inline int32_t -rgba_from_rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a) { - return - r << 24 - | g << 16 - | b << 8 - | a; -} - -/* - * Helper function used in rgba_from_hsla(). - * Based on http://dev.w3.org/csswg/css-color-4/#hsl-to-rgb - */ - -static float -hue_to_rgb(float t1, float t2, float hue) { - if (hue < 0) - hue += 6; - if (hue >= 6) - hue -= 6; - - if (hue < 1) - return (t2 - t1) * hue + t1; - else if (hue < 3) - return t2; - else if (hue < 4) - return (t2 - t1) * (4 - hue) + t1; - else - return t1; -} - -/* - * Return rgba from (h,s,l,a). - * Expects h values in the range [0, 360), and s, l, a in the range [0, 1]. - * Adapted from http://dev.w3.org/csswg/css-color-4/#hsl-to-rgb - */ - -static inline int32_t -rgba_from_hsla(float h_deg, float s, float l, float a) { - uint8_t r, g, b; - float h = (6 * h_deg) / 360.0f, m1, m2; - - if (l<=0.5) - m2=l*(s+1); - else - m2=l+s-l*s; - m1 = l*2 - m2; - - // Scale and round the RGB components - r = (uint8_t)floor(hue_to_rgb(m1, m2, h + 2) * 255 + 0.5); - g = (uint8_t)floor(hue_to_rgb(m1, m2, h ) * 255 + 0.5); - b = (uint8_t)floor(hue_to_rgb(m1, m2, h - 2) * 255 + 0.5); - - return rgba_from_rgba(r, g, b, (uint8_t) (a * 255)); -} - -/* - * Return rgba from (h,s,l). - * Expects h values in the range [0, 360), and s, l in the range [0, 1]. - */ - -static inline int32_t -rgba_from_hsl(float h_deg, float s, float l) { - return rgba_from_hsla(h_deg, s, l, 1.0); -} - - -/* - * Return rgba from (r,g,b). - */ - -static int32_t -rgba_from_rgb(uint8_t r, uint8_t g, uint8_t b) { - return rgba_from_rgba(r, g, b, 255); -} - -/* - * Return rgba from #RRGGBBAA - */ - -static int32_t -rgba_from_hex8_string(const char *str) { - return rgba_from_rgba( - (h(str[0]) << 4) + h(str[1]), - (h(str[2]) << 4) + h(str[3]), - (h(str[4]) << 4) + h(str[5]), - (h(str[6]) << 4) + h(str[7]) - ); -} - -/* - * Return rgb from "#RRGGBB". - */ - -static int32_t -rgba_from_hex6_string(const char *str) { - return rgba_from_rgb( - (h(str[0]) << 4) + h(str[1]) - , (h(str[2]) << 4) + h(str[3]) - , (h(str[4]) << 4) + h(str[5]) - ); -} - -/* -* Return rgba from #RGBA -*/ - -static int32_t -rgba_from_hex4_string(const char *str) { - return rgba_from_rgba( - (h(str[0]) << 4) + h(str[0]), - (h(str[1]) << 4) + h(str[1]), - (h(str[2]) << 4) + h(str[2]), - (h(str[3]) << 4) + h(str[3]) - ); -} - -/* - * Return rgb from "#RGB" - */ - -static int32_t -rgba_from_hex3_string(const char *str) { - return rgba_from_rgb( - (h(str[0]) << 4) + h(str[0]) - , (h(str[1]) << 4) + h(str[1]) - , (h(str[2]) << 4) + h(str[2]) - ); -} - -/* - * Return rgb from "rgb()" - */ - -static int32_t -rgba_from_rgb_string(const char *str, short *ok) { - if (str == strstr(str, "rgb(")) { - str += 4; - WHITESPACE; - uint8_t r = 0, g = 0, b = 0; - CHANNEL(r); - WHITESPACE_OR_COMMA; - CHANNEL(g); - WHITESPACE_OR_COMMA; - CHANNEL(b); - WHITESPACE; - return *ok = 1, rgba_from_rgb(r, g, b); - } - return *ok = 0; -} - -/* - * Return rgb from "rgba()" - */ - -static int32_t -rgba_from_rgba_string(const char *str, short *ok) { - if (str == strstr(str, "rgba(")) { - str += 5; - WHITESPACE; - uint8_t r = 0, g = 0, b = 0; - float a = 0; - CHANNEL(r); - WHITESPACE_OR_COMMA; - CHANNEL(g); - WHITESPACE_OR_COMMA; - CHANNEL(b); - WHITESPACE_OR_COMMA; - ALPHA(a); - WHITESPACE; - return *ok = 1, rgba_from_rgba(r, g, b, (int) (a * 255)); - } - return *ok = 0; -} - -/* - * Return rgb from "hsla()" - */ - -static int32_t -rgba_from_hsla_string(const char *str, short *ok) { - if (str == strstr(str, "hsla(")) { - str += 5; - WHITESPACE; - float h_deg = 0; - float s = 0, l = 0; - float a = 0; - HUE(h_deg); - WHITESPACE_OR_COMMA; - SATURATION(s); - WHITESPACE_OR_COMMA; - LIGHTNESS(l); - WHITESPACE_OR_COMMA; - ALPHA(a); - WHITESPACE; - return *ok = 1, rgba_from_hsla(h_deg, s, l, a); - } - return *ok = 0; -} - -/* - * Return rgb from "hsl()" - */ - -static int32_t -rgba_from_hsl_string(const char *str, short *ok) { - if (str == strstr(str, "hsl(")) { - str += 4; - WHITESPACE; - float h_deg = 0; - float s = 0, l = 0; - HUE(h_deg); - WHITESPACE_OR_COMMA; - SATURATION(s); - WHITESPACE_OR_COMMA; - LIGHTNESS(l); - WHITESPACE; - return *ok = 1, rgba_from_hsl(h_deg, s, l); - } - return *ok = 0; -} - - -/* - * Return rgb from: - * - * - "#RGB" - * - "#RGBA" - * - "#RRGGBB" - * - "#RRGGBBAA" - * - */ - -static int32_t -rgba_from_hex_string(const char *str, short *ok) { - size_t len = strlen(str); - *ok = 1; - switch (len) { - case 8: return rgba_from_hex8_string(str); - case 6: return rgba_from_hex6_string(str); - case 4: return rgba_from_hex4_string(str); - case 3: return rgba_from_hex3_string(str); - } - return *ok = 0; -} - -/* - * Return named color value. - */ - -static int32_t -rgba_from_name_string(const char *str, short *ok) { - std::string lowered(str); - std::transform(lowered.begin(), lowered.end(), lowered.begin(), tolower); - auto color = named_colors.find(lowered); - if (color != named_colors.end()) { - return *ok = 1, color->second; - } - return *ok = 0; -} - -/* - * Return rgb from: - * - * - #RGB - * - #RGBA - * - #RRGGBB - * - #RRGGBBAA - * - rgb(r,g,b) - * - rgba(r,g,b,a) - * - hsl(h,s,l) - * - hsla(h,s,l,a) - * - name - * - */ - -int32_t -rgba_from_string(const char *str, short *ok) { - if ('#' == str[0]) - return rgba_from_hex_string(++str, ok); - if (str == strstr(str, "rgba")) - return rgba_from_rgba_string(str, ok); - if (str == strstr(str, "rgb")) - return rgba_from_rgb_string(str, ok); - if (str == strstr(str, "hsla")) - return rgba_from_hsla_string(str, ok); - if (str == strstr(str, "hsl")) - return rgba_from_hsl_string(str, ok); - return rgba_from_name_string(str, ok); -} - -/* - * Inspect the given rgba color. - */ - -void -rgba_inspect(int32_t rgba) { - printf("rgba(%d,%d,%d,%d)\n" - , rgba >> 24 & 0xff - , rgba >> 16 & 0xff - , rgba >> 8 & 0xff - , rgba & 0xff - ); -} diff --git a/node_modules/canvas/src/color.h b/node_modules/canvas/src/color.h deleted file mode 100644 index 137c1d6..0000000 --- a/node_modules/canvas/src/color.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#pragma once - -#include // node < 7 uses libstdc++ on macOS which lacks complete c++11 -#include - -/* - * RGBA struct. - */ - -typedef struct { - double r, g, b, a; -} rgba_t; - -/* - * Prototypes. - */ - -rgba_t -rgba_create(uint32_t rgba); - -int32_t -rgba_from_string(const char *str, short *ok); - -void -rgba_to_string(rgba_t rgba, char *buf, size_t len); - -void -rgba_inspect(int32_t rgba); diff --git a/node_modules/canvas/src/dll_visibility.h b/node_modules/canvas/src/dll_visibility.h deleted file mode 100644 index 7a1f984..0000000 --- a/node_modules/canvas/src/dll_visibility.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef DLL_PUBLIC - -#if defined _WIN32 - #ifdef __GNUC__ - #define DLL_PUBLIC __attribute__ ((dllexport)) - #else - #define DLL_PUBLIC __declspec(dllexport) - #endif - #define DLL_LOCAL -#else - #if __GNUC__ >= 4 - #define DLL_PUBLIC __attribute__ ((visibility ("default"))) - #define DLL_LOCAL __attribute__ ((visibility ("hidden"))) - #else - #define DLL_PUBLIC - #define DLL_LOCAL - #endif -#endif - -#endif diff --git a/node_modules/canvas/src/init.cc b/node_modules/canvas/src/init.cc deleted file mode 100644 index 98d00ec..0000000 --- a/node_modules/canvas/src/init.cc +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2010 LearnBoost - -#include -#include - -#include -#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 10, 0) -// CAIRO_FORMAT_RGB16_565: undeprecated in v1.10.0 -// CAIRO_STATUS_INVALID_SIZE: v1.10.0 -// CAIRO_FORMAT_INVALID: v1.10.0 -// Lots of the compositing operators: v1.10.0 -// JPEG MIME tracking: v1.10.0 -// Note: CAIRO_FORMAT_RGB30 is v1.12.0 and still optional -#error("cairo v1.10.0 or later is required") -#endif - -#include "Backends.h" -#include "Canvas.h" -#include "CanvasGradient.h" -#include "CanvasPattern.h" -#include "CanvasRenderingContext2d.h" -#include "Image.h" -#include "ImageData.h" - -#include -#include FT_FREETYPE_H - -using namespace v8; - -// Compatibility with Visual Studio versions prior to VS2015 -#if defined(_MSC_VER) && _MSC_VER < 1900 -#define snprintf _snprintf -#endif - -NAN_MODULE_INIT(init) { - Backends::Initialize(target); - Canvas::Initialize(target); - Image::Initialize(target); - ImageData::Initialize(target); - Context2d::Initialize(target); - Gradient::Initialize(target); - Pattern::Initialize(target); - - Nan::Set(target, Nan::New("cairoVersion").ToLocalChecked(), Nan::New(cairo_version_string()).ToLocalChecked()).Check(); -#ifdef HAVE_JPEG - -#ifndef JPEG_LIB_VERSION_MAJOR -#ifdef JPEG_LIB_VERSION -#define JPEG_LIB_VERSION_MAJOR (JPEG_LIB_VERSION / 10) -#else -#define JPEG_LIB_VERSION_MAJOR 0 -#endif -#endif - -#ifndef JPEG_LIB_VERSION_MINOR -#ifdef JPEG_LIB_VERSION -#define JPEG_LIB_VERSION_MINOR (JPEG_LIB_VERSION % 10) -#else -#define JPEG_LIB_VERSION_MINOR 0 -#endif -#endif - - char jpeg_version[10]; - static bool minor_gt_0 = JPEG_LIB_VERSION_MINOR > 0; - if (minor_gt_0) { - snprintf(jpeg_version, 10, "%d%c", JPEG_LIB_VERSION_MAJOR, JPEG_LIB_VERSION_MINOR + 'a' - 1); - } else { - snprintf(jpeg_version, 10, "%d", JPEG_LIB_VERSION_MAJOR); - } - Nan::Set(target, Nan::New("jpegVersion").ToLocalChecked(), Nan::New(jpeg_version).ToLocalChecked()).Check(); -#endif - -#ifdef HAVE_GIF -#ifndef GIF_LIB_VERSION - char gif_version[10]; - snprintf(gif_version, 10, "%d.%d.%d", GIFLIB_MAJOR, GIFLIB_MINOR, GIFLIB_RELEASE); - Nan::Set(target, Nan::New("gifVersion").ToLocalChecked(), Nan::New(gif_version).ToLocalChecked()).Check(); -#else - Nan::Set(target, Nan::New("gifVersion").ToLocalChecked(), Nan::New(GIF_LIB_VERSION).ToLocalChecked()).Check(); -#endif -#endif - - char freetype_version[10]; - snprintf(freetype_version, 10, "%d.%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); - Nan::Set(target, Nan::New("freetypeVersion").ToLocalChecked(), Nan::New(freetype_version).ToLocalChecked()).Check(); -} - -NODE_MODULE(canvas, init); diff --git a/node_modules/canvas/src/register_font.cc b/node_modules/canvas/src/register_font.cc deleted file mode 100644 index 2817287..0000000 --- a/node_modules/canvas/src/register_font.cc +++ /dev/null @@ -1,262 +0,0 @@ -#include "register_font.h" - -#include -#include -#include - -#ifdef __APPLE__ -#include -#elif defined(_WIN32) -#include -#else -#include -#endif - -#include -#include FT_FREETYPE_H -#include FT_TRUETYPE_TABLES_H -#include FT_SFNT_NAMES_H -#include FT_TRUETYPE_IDS_H -#ifndef FT_SFNT_OS2 -#define FT_SFNT_OS2 ft_sfnt_os2 -#endif - -// OSX seems to read the strings in MacRoman encoding and ignore Unicode entries. -// You can verify this by opening a TTF with both Unicode and Macroman on OSX. -// It uses the MacRoman name, while Fontconfig and Windows use Unicode -#ifdef __APPLE__ -#define PREFERRED_PLATFORM_ID TT_PLATFORM_MACINTOSH -#define PREFERRED_ENCODING_ID TT_MAC_ID_ROMAN -#else -#define PREFERRED_PLATFORM_ID TT_PLATFORM_MICROSOFT -#define PREFERRED_ENCODING_ID TT_MS_ID_UNICODE_CS -#endif - -#define IS_PREFERRED_ENC(X) \ - X.platform_id == PREFERRED_PLATFORM_ID && X.encoding_id == PREFERRED_ENCODING_ID - -#define GET_NAME_RANK(X) \ - (IS_PREFERRED_ENC(X) ? 1 : 0) + (X.name_id == TT_NAME_ID_PREFERRED_FAMILY ? 1 : 0) - -/* - * Return a UTF-8 encoded string given a TrueType name buf+len - * and its platform and encoding - */ - -char * -to_utf8(FT_Byte* buf, FT_UInt len, FT_UShort pid, FT_UShort eid) { - size_t ret_len = len * 4; // max chars in a utf8 string - char *ret = (char*)malloc(ret_len + 1); // utf8 string + null - - if (!ret) return NULL; - - // In my testing of hundreds of fonts from the Google Font repo, the two types - // of fonts are TT_PLATFORM_MICROSOFT with TT_MS_ID_UNICODE_CS encoding, or - // TT_PLATFORM_MACINTOSH with TT_MAC_ID_ROMAN encoding. Usually both, never neither - - char const *fromcode; - - if (pid == TT_PLATFORM_MACINTOSH && eid == TT_MAC_ID_ROMAN) { - fromcode = "MAC"; - } else if (pid == TT_PLATFORM_MICROSOFT && eid == TT_MS_ID_UNICODE_CS) { - fromcode = "UTF-16BE"; - } else { - free(ret); - return NULL; - } - - GIConv cd = g_iconv_open("UTF-8", fromcode); - - if (cd == (GIConv)-1) { - free(ret); - return NULL; - } - - size_t inbytesleft = len; - size_t outbytesleft = ret_len; - - size_t n_converted = g_iconv(cd, (char**)&buf, &inbytesleft, &ret, &outbytesleft); - - ret -= ret_len - outbytesleft; // rewind the pointers to their - buf -= len - inbytesleft; // original starting positions - - if (n_converted == (size_t)-1) { - free(ret); - return NULL; - } else { - ret[ret_len - outbytesleft] = '\0'; - return ret; - } -} - -/* - * Find a family name in the face's name table, preferring the one the - * system, fall back to the other - */ - -typedef struct _NameDef { - const char *buf; - int rank; // the higher the more desirable -} NameDef; - -gint -_name_def_compare(gconstpointer a, gconstpointer b) { - return ((NameDef*)a)->rank > ((NameDef*)b)->rank ? -1 : 1; -} - -// Some versions of GTK+ do not have this, particualrly the one we -// currently link to in node-canvas's wiki -void -_free_g_list_item(gpointer data, gpointer user_data) { - NameDef *d = (NameDef *)data; - free((void *)(d->buf)); -} - -void -_g_list_free_full(GList *list) { - g_list_foreach(list, _free_g_list_item, NULL); - g_list_free(list); -} - -char * -get_family_name(FT_Face face) { - FT_SfntName name; - GList *list = NULL; - char *utf8name = NULL; - - for (unsigned i = 0; i < FT_Get_Sfnt_Name_Count(face); ++i) { - FT_Get_Sfnt_Name(face, i, &name); - - if (name.name_id == TT_NAME_ID_FONT_FAMILY || name.name_id == TT_NAME_ID_PREFERRED_FAMILY) { - char *buf = to_utf8(name.string, name.string_len, name.platform_id, name.encoding_id); - - if (buf) { - NameDef *d = (NameDef*)malloc(sizeof(NameDef)); - d->buf = (const char*)buf; - d->rank = GET_NAME_RANK(name); - - list = g_list_insert_sorted(list, (gpointer)d, _name_def_compare); - } - } - } - - GList *best_def = g_list_first(list); - if (best_def) utf8name = (char*) strdup(((NameDef*)best_def->data)->buf); - if (list) _g_list_free_full(list); - - return utf8name; -} - -PangoWeight -get_pango_weight(FT_UShort weight) { - switch (weight) { - case 100: return PANGO_WEIGHT_THIN; - case 200: return PANGO_WEIGHT_ULTRALIGHT; - case 300: return PANGO_WEIGHT_LIGHT; - #if PANGO_VERSION >= PANGO_VERSION_ENCODE(1, 36, 7) - case 350: return PANGO_WEIGHT_SEMILIGHT; - #endif - case 380: return PANGO_WEIGHT_BOOK; - case 400: return PANGO_WEIGHT_NORMAL; - case 500: return PANGO_WEIGHT_MEDIUM; - case 600: return PANGO_WEIGHT_SEMIBOLD; - case 700: return PANGO_WEIGHT_BOLD; - case 800: return PANGO_WEIGHT_ULTRABOLD; - case 900: return PANGO_WEIGHT_HEAVY; - case 1000: return PANGO_WEIGHT_ULTRAHEAVY; - default: return PANGO_WEIGHT_NORMAL; - } -} - -PangoStretch -get_pango_stretch(FT_UShort width) { - switch (width) { - case 1: return PANGO_STRETCH_ULTRA_CONDENSED; - case 2: return PANGO_STRETCH_EXTRA_CONDENSED; - case 3: return PANGO_STRETCH_CONDENSED; - case 4: return PANGO_STRETCH_SEMI_CONDENSED; - case 5: return PANGO_STRETCH_NORMAL; - case 6: return PANGO_STRETCH_SEMI_EXPANDED; - case 7: return PANGO_STRETCH_EXPANDED; - case 8: return PANGO_STRETCH_EXTRA_EXPANDED; - case 9: return PANGO_STRETCH_ULTRA_EXPANDED; - default: return PANGO_STRETCH_NORMAL; - } -} - -PangoStyle -get_pango_style(FT_Long flags) { - if (flags & FT_STYLE_FLAG_ITALIC) { - return PANGO_STYLE_ITALIC; - } else { - return PANGO_STYLE_NORMAL; - } -} - -/* - * Return a PangoFontDescription that will resolve to the font file - */ - -PangoFontDescription * -get_pango_font_description(unsigned char* filepath) { - FT_Library library; - FT_Face face; - PangoFontDescription *desc = pango_font_description_new(); - - if (!FT_Init_FreeType(&library) && !FT_New_Face(library, (const char*)filepath, 0, &face)) { - TT_OS2 *table = (TT_OS2*)FT_Get_Sfnt_Table(face, FT_SFNT_OS2); - if (table) { - char *family = get_family_name(face); - - if (!family) { - pango_font_description_free(desc); - FT_Done_Face(face); - FT_Done_FreeType(library); - - return NULL; - } - - pango_font_description_set_family_static(desc, family); - pango_font_description_set_weight(desc, get_pango_weight(table->usWeightClass)); - pango_font_description_set_stretch(desc, get_pango_stretch(table->usWidthClass)); - pango_font_description_set_style(desc, get_pango_style(face->style_flags)); - - FT_Done_Face(face); - FT_Done_FreeType(library); - - return desc; - } - } - - pango_font_description_free(desc); - - return NULL; -} - -/* - * Register font with the OS - */ - -bool -register_font(unsigned char *filepath) { - bool success; - - #ifdef __APPLE__ - CFURLRef filepathUrl = CFURLCreateFromFileSystemRepresentation(NULL, filepath, strlen((char*)filepath), false); - success = CTFontManagerRegisterFontsForURL(filepathUrl, kCTFontManagerScopeProcess, NULL); - #elif defined(_WIN32) - success = AddFontResourceEx((LPCSTR)filepath, FR_PRIVATE, 0) != 0; - #else - success = FcConfigAppFontAddFile(FcConfigGetCurrent(), (FcChar8 *)(filepath)); - #endif - - if (!success) return false; - - // Tell Pango to throw away the current FontMap and create a new one. This - // has the effect of registering the new font in Pango by re-looking up all - // font families. - pango_cairo_font_map_set_default(NULL); - - return true; -} - diff --git a/node_modules/canvas/src/register_font.h b/node_modules/canvas/src/register_font.h deleted file mode 100644 index cfac9f9..0000000 --- a/node_modules/canvas/src/register_font.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -PangoFontDescription *get_pango_font_description(unsigned char *filepath); -bool register_font(unsigned char *filepath); diff --git a/node_modules/canvas/types/Readme.md b/node_modules/canvas/types/Readme.md deleted file mode 100644 index 4beb7f5..0000000 --- a/node_modules/canvas/types/Readme.md +++ /dev/null @@ -1,3 +0,0 @@ -Notes: - -* `"unified-signatures": false` because of https://github.com/Microsoft/dtslint/issues/183 diff --git a/node_modules/canvas/types/index.d.ts b/node_modules/canvas/types/index.d.ts deleted file mode 100644 index 21b6adb..0000000 --- a/node_modules/canvas/types/index.d.ts +++ /dev/null @@ -1,339 +0,0 @@ -// TypeScript Version: 3.0 -/// - -import { Readable } from 'stream' - -export interface PngConfig { - /** Specifies the ZLIB compression level. Defaults to 6. */ - compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 - /** - * Any bitwise combination of `PNG_FILTER_NONE`, `PNG_FITLER_SUB`, - * `PNG_FILTER_UP`, `PNG_FILTER_AVG` and `PNG_FILTER_PATETH`; or one of - * `PNG_ALL_FILTERS` or `PNG_NO_FILTERS` (all are properties of the canvas - * instance). These specify which filters *may* be used by libpng. During - * encoding, libpng will select the best filter from this list of allowed - * filters. Defaults to `canvas.PNG_ALL_FITLERS`. - */ - filters?: number - /** - * _For creating indexed PNGs._ The palette of colors. Entries should be in - * RGBA order. - */ - palette?: Uint8ClampedArray - /** - * _For creating indexed PNGs._ The index of the background color. Defaults - * to 0. - */ - backgroundIndex?: number - /** pixels per inch */ - resolution?: number -} - -export interface JpegConfig { - /** Specifies the quality, between 0 and 1. Defaults to 0.75. */ - quality?: number - /** Enables progressive encoding. Defaults to `false`. */ - progressive?: boolean - /** Enables 2x2 chroma subsampling. Defaults to `true`. */ - chromaSubsampling?: boolean -} - -export interface PdfConfig { - title?: string - author?: string - subject?: string - keywords?: string - creator?: string - creationDate?: Date - modDate?: Date -} - -export interface NodeCanvasRenderingContext2DSettings { - alpha?: boolean - pixelFormat?: 'RGBA32' | 'RGB24' | 'A8' | 'RGB16_565' | 'A1' | 'RGB30' -} - -export class Canvas { - width: number - height: number - - /** _Non standard._ The type of the canvas. */ - readonly type: 'image'|'pdf'|'svg' - - // This is a getter, but it's non-standard and I don't know why we export it. - // readonly stride: number; - - /** Constant used in PNG encoding methods. */ - readonly PNG_NO_FILTERS: number - /** Constant used in PNG encoding methods. */ - readonly PNG_ALL_FILTERS: number - /** Constant used in PNG encoding methods. */ - readonly PNG_FILTER_NONE: number - /** Constant used in PNG encoding methods. */ - readonly PNG_FILTER_SUB: number - /** Constant used in PNG encoding methods. */ - readonly PNG_FILTER_UP: number - /** Constant used in PNG encoding methods. */ - readonly PNG_FILTER_AVG: number - /** Constant used in PNG encoding methods. */ - readonly PNG_FILTER_PAETH: number - - constructor(width: number, height: number, type?: 'pdf'|'svg') - - getContext(contextId: '2d', contextAttributes?: NodeCanvasRenderingContext2DSettings): NodeCanvasRenderingContext2D - - /** - * For image canvases, encodes the canvas as a PNG. For PDF canvases, - * encodes the canvas as a PDF. For SVG canvases, encodes the canvas as an - * SVG. - */ - toBuffer(cb: (err: Error|null, result: Buffer) => void): void - toBuffer(cb: (err: Error|null, result: Buffer) => void, mimeType: 'image/png', config?: PngConfig): void - toBuffer(cb: (err: Error|null, result: Buffer) => void, mimeType: 'image/jpeg', config?: JpegConfig): void - - /** - * For image canvases, encodes the canvas as a PNG. For PDF canvases, - * encodes the canvas as a PDF. For SVG canvases, encodes the canvas as an - * SVG. - */ - toBuffer(): Buffer - toBuffer(mimeType: 'image/png', config?: PngConfig): Buffer - toBuffer(mimeType: 'image/jpeg', config?: JpegConfig): Buffer - toBuffer(mimeType: 'application/pdf', config?: PdfConfig): Buffer - - /** - * Returns the unencoded pixel data, top-to-bottom. On little-endian (most) - * systems, the array will be ordered BGRA; on big-endian systems, it will - * be ARGB. - */ - toBuffer(mimeType: 'raw'): Buffer - - createPNGStream(config?: PngConfig): PNGStream - createJPEGStream(config?: JpegConfig): JPEGStream - createPDFStream(config?: PdfConfig): PDFStream - - /** Defaults to PNG image. */ - toDataURL(): string - toDataURL(mimeType: 'image/png'): string - toDataURL(mimeType: 'image/jpeg', quality?: number): string - /** _Non-standard._ Defaults to PNG image. */ - toDataURL(cb: (err: Error|null, result: string) => void): void - /** _Non-standard._ */ - toDataURL(mimeType: 'image/png', cb: (err: Error|null, result: string) => void): void - /** _Non-standard._ */ - toDataURL(mimeType: 'image/jpeg', cb: (err: Error|null, result: string) => void): void - /** _Non-standard._ */ - toDataURL(mimeType: 'image/jpeg', config: JpegConfig, cb: (err: Error|null, result: string) => void): void - /** _Non-standard._ */ - toDataURL(mimeType: 'image/jpeg', quality: number, cb: (err: Error|null, result: string) => void): void - - /** - * For PDF canvases, adds another page. If width and/or height are omitted, - * the canvas's initial size is used. - */ - addPage(width?: number, height?: number): void -} - -declare class NodeCanvasRenderingContext2D extends CanvasRenderingContext2D { - /** - * _Non-standard_. Defaults to 'good'. Affects pattern (gradient, image, - * etc.) rendering quality. - */ - patternQuality: 'fast' | 'good' | 'best' | 'nearest' | 'bilinear' - - /** - * _Non-standard_. Defaults to 'good'. Like `patternQuality`, but applies to - * transformations affecting more than just patterns. - */ - quality: 'fast' | 'good' | 'best' | 'nearest' | 'bilinear' - - /** - * Defaults to 'path'. The effect depends on the canvas type: - * - * * **Standard (image)** `'glyph'` and `'path'` both result in rasterized - * text. Glyph mode is faster than path, but may result in lower-quality - * text, especially when rotated or translated. - * - * * **PDF** `'glyph'` will embed text instead of paths into the PDF. This - * is faster to encode, faster to open with PDF viewers, yields a smaller - * file size and makes the text selectable. The subset of the font needed - * to render the glyphs will be embedded in the PDF. This is usually the - * mode you want to use with PDF canvases. - * - * * **SVG** glyph does not cause `` elements to be produced as one - * might expect ([cairo bug](https://gitlab.freedesktop.org/cairo/cairo/issues/253)). - * Rather, glyph will create a `` section with a `` for each - * glyph, then those glyphs be reused via `` elements. `'path'` mode - * creates a `` element for each text string. glyph mode is faster - * and yields a smaller file size. - * - * In glyph mode, `ctx.strokeText()` and `ctx.fillText()` behave the same - * (aside from using the stroke and fill style, respectively). - */ - textDrawingMode: 'path' | 'glyph' - - /** _'saturate' is non-standard._ */ - globalCompositeOperation: 'saturate' | 'clear' | 'copy' | 'destination' | 'source-over' | 'destination-over' | - 'source-in' | 'destination-in' | 'source-out' | 'destination-out' | 'source-atop' | 'destination-atop' | - 'xor' | 'lighter' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | - 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity' - - /** _Non-standard_. Sets the antialiasing mode. */ - antialias: 'default' | 'gray' | 'none' | 'subpixel' - - // Standard, but not in the TS lib and needs node-canvas class return type. - /** Returns or sets a `DOMMatrix` for the current transformation matrix. */ - currentTransform: NodeCanvasDOMMatrix - - // Standard, but need node-canvas class versions: - getTransform(): NodeCanvasDOMMatrix - setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void - setTransform(transform?: NodeCanvasDOMMatrix): void - createImageData(sw: number, sh: number): NodeCanvasImageData - createImageData(imagedata: NodeCanvasImageData): NodeCanvasImageData - getImageData(sx: number, sy: number, sw: number, sh: number): NodeCanvasImageData - putImageData(imagedata: NodeCanvasImageData, dx: number, dy: number): void - putImageData(imagedata: NodeCanvasImageData, dx: number, dy: number, dirtyX: number, dirtyY: number, dirtyWidth: number, dirtyHeight: number): void - drawImage(image: Canvas|Image, dx: number, dy: number): void - drawImage(image: Canvas|Image, dx: number, dy: number, dw: number, dh: number): void - drawImage(image: Canvas|Image, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void - /** - * **Do not use this overload. Use one of the other three overloads.** This - * is a catch-all definition required for compatibility with the base - * `CanvasRenderingContext2D` interface. - */ - drawImage(...args: any[]): void - createPattern(image: Canvas|Image, repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | '' | null): NodeCanvasCanvasPattern - /** - * **Do not use this overload. Use the other three overload.** This is a - * catch-all definition required for compatibility with the base - * `CanvasRenderingContext2D` interface. - */ - createPattern(...args: any[]): NodeCanvasCanvasPattern - createLinearGradient(x0: number, y0: number, x1: number, y1: number): NodeCanvasCanvasGradient; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): NodeCanvasCanvasGradient; -} -export { NodeCanvasRenderingContext2D as CanvasRenderingContext2D } - -declare class NodeCanvasCanvasGradient extends CanvasGradient {} -export { NodeCanvasCanvasGradient as CanvasGradient } - -declare class NodeCanvasCanvasPattern extends CanvasPattern {} -export { NodeCanvasCanvasPattern as CanvasPattern } - -// This does not extend HTMLImageElement because there are dozens of inherited -// methods and properties that we do not provide. -export class Image { - /** Track image data */ - static readonly MODE_IMAGE: number - /** Track MIME data */ - static readonly MODE_MIME: number - - /** - * The URL, `data:` URI or local file path of the image to be loaded, or a - * Buffer instance containing an encoded image. - */ - src: string | Buffer - /** Retrieves whether the object is fully loaded. */ - readonly complete: boolean - /** Sets or retrieves the height of the image. */ - height: number - /** Sets or retrieves the width of the image. */ - width: number - - /** The original height of the image resource before sizing. */ - readonly naturalHeight: number - /** The original width of the image resource before sizing. */ - readonly naturalWidth: number - /** - * Applies to JPEG images drawn to PDF canvases only. Setting - * `img.dataMode = Image.MODE_MIME` or `Image.MODE_MIME|Image.MODE_IMAGE` - * enables image MIME data tracking. When MIME data is tracked, PDF canvases - * can embed JPEGs directly into the output, rather than re-encoding into - * PNG. This can drastically reduce filesize and speed up rendering. - */ - dataMode: number - - onload: (() => void) | null; - onerror: ((err: Error) => void) | null; -} - -/** - * Creates a Canvas instance. This function works in both Node.js and Web - * browsers, where there is no Canvas constructor. - * @param type Optionally specify to create a PDF or SVG canvas. Defaults to an - * image canvas. - */ -export function createCanvas(width: number, height: number, type?: 'pdf'|'svg'): Canvas - -/** - * Creates an ImageData instance. This function works in both Node.js and Web - * browsers. - * @param data An array containing the pixel representation of the image. - * @param height If omitted, the height is calculated based on the array's size - * and `width`. - */ -export function createImageData(data: Uint8ClampedArray, width: number, height?: number): ImageData -/** - * _Non-standard._ Creates an ImageData instance for an alternative pixel - * format, such as RGB16_565 - * @param data An array containing the pixel representation of the image. - * @param height If omitted, the height is calculated based on the array's size - * and `width`. - */ -export function createImageData(data: Uint16Array, width: number, height?: number): ImageData -/** - * Creates an ImageData instance. This function works in both Node.js and Web - * browsers. - */ -export function createImageData(width: number, height: number): ImageData - -/** - * Convenience function for loading an image with a Promise interface. This - * function works in both Node.js and Web browsers; however, the `src` must be - * a string in Web browsers (it can only be a Buffer in Node.js). - * @param src URL, `data: ` URI or (Node.js only) a local file path or Buffer - * instance. - */ -export function loadImage(src: string|Buffer, options?: any): Promise - -/** - * Registers a font that is not installed as a system font. This must be used - * before creating Canvas instances. - * @param path Path to local font file. - * @param fontFace Description of the font face, corresponding to CSS properties - * used in `@font-face` rules. - */ -export function registerFont(path: string, fontFace: {family: string, weight?: string, style?: string}): void - -/** This class must not be constructed directly; use `canvas.createPNGStream()`. */ -export class PNGStream extends Readable {} -/** This class must not be constructed directly; use `canvas.createJPEGStream()`. */ -export class JPEGStream extends Readable {} -/** This class must not be constructed directly; use `canvas.createPDFStream()`. */ -export class PDFStream extends Readable {} - -declare class NodeCanvasDOMMatrix extends DOMMatrix {} -export { NodeCanvasDOMMatrix as DOMMatrix } - -declare class NodeCanvasDOMPoint extends DOMPoint {} -export { NodeCanvasDOMPoint as DOMPoint } - -declare class NodeCanvasImageData extends ImageData {} -export { NodeCanvasImageData as ImageData } - -// This is marked private, but is exported... -// export function parseFont(description: string): object - -// Not documented: backends - -/** Library version. */ -export const version: string -/** Cairo version. */ -export const cairoVersion: string -/** jpeglib version, if built with JPEG support. */ -export const jpegVersion: string | undefined -/** giflib version, if built with GIF support. */ -export const gifVersion: string | undefined -/** freetype version. */ -export const freetypeVersion: string diff --git a/node_modules/canvas/util/has_lib.js b/node_modules/canvas/util/has_lib.js deleted file mode 100644 index 1ede900..0000000 --- a/node_modules/canvas/util/has_lib.js +++ /dev/null @@ -1,117 +0,0 @@ -var query = process.argv[2] -var fs = require('fs') -var childProcess = require('child_process') - -var SYSTEM_PATHS = [ - '/lib', - '/usr/lib', - '/usr/lib64', - '/usr/local/lib', - '/opt/local/lib', - '/usr/lib/x86_64-linux-gnu', - '/usr/lib/i386-linux-gnu', - '/usr/lib/arm-linux-gnueabihf', - '/usr/lib/arm-linux-gnueabi', - '/usr/lib/aarch64-linux-gnu' -] - -/** - * Checks for lib using ldconfig if present, or searching SYSTEM_PATHS - * otherwise. - * @param {string} lib - library name, e.g. 'jpeg' in 'libjpeg64.so' (see first line) - * @return {boolean} exists - */ -function hasSystemLib (lib) { - var libName = 'lib' + lib + '.+(so|dylib)' - var libNameRegex = new RegExp(libName) - - // Try using ldconfig on linux systems - if (hasLdconfig()) { - try { - if (childProcess.execSync('ldconfig -p 2>/dev/null | grep -E "' + libName + '"').length) { - return true - } - } catch (err) { - // noop -- proceed to other search methods - } - } - - // Try checking common library locations - return SYSTEM_PATHS.some(function (systemPath) { - try { - var dirListing = fs.readdirSync(systemPath) - return dirListing.some(function (file) { - return libNameRegex.test(file) - }) - } catch (err) { - return false - } - }) -} - -/** - * Checks for ldconfig on the path and /sbin - * @return {boolean} exists - */ -function hasLdconfig () { - try { - // Add /sbin to path as ldconfig is located there on some systems -- e.g. - // Debian (and it can still be used by unprivileged users): - childProcess.execSync('export PATH="$PATH:/sbin"') - process.env.PATH = '...' - // execSync throws on nonzero exit - childProcess.execSync('hash ldconfig 2>/dev/null') - return true - } catch (err) { - return false - } -} - -/** - * Checks for freetype2 with --cflags-only-I - * @return Boolean exists - */ -function hasFreetype () { - try { - if (childProcess.execSync('pkg-config cairo --cflags-only-I 2>/dev/null | grep freetype2').length) { - return true - } - } catch (err) { - // noop - } - return false -} - -/** - * Checks for lib using pkg-config. - * @param {string} lib - library name - * @return {boolean} exists - */ -function hasPkgconfigLib (lib) { - try { - // execSync throws on nonzero exit - childProcess.execSync('pkg-config --exists "' + lib + '" 2>/dev/null') - return true - } catch (err) { - return false - } -} - -function main (query) { - switch (query) { - case 'gif': - case 'jpeg': - case 'cairo': - return hasSystemLib(query) - case 'pango': - return hasPkgconfigLib(query) - case 'freetype': - return hasFreetype() - case 'rsvg': - return hasPkgconfigLib('librsvg-2.0') - default: - throw new Error('Unknown library: ' + query) - } -} - -process.stdout.write(main(query).toString()) diff --git a/node_modules/canvas/util/win_jpeg_lookup.js b/node_modules/canvas/util/win_jpeg_lookup.js deleted file mode 100644 index 8286994..0000000 --- a/node_modules/canvas/util/win_jpeg_lookup.js +++ /dev/null @@ -1,21 +0,0 @@ -var fs = require('fs') -var paths = ['C:/libjpeg-turbo'] - -if (process.arch === 'x64') { - paths.unshift('C:/libjpeg-turbo64') -} - -paths.forEach(function(path){ - if (exists(path)) { - process.stdout.write(path) - process.exit() - } -}) - -function exists(path) { - try { - return fs.lstatSync(path).isDirectory() - } catch(e) { - return false - } -} diff --git a/node_modules/chownr/LICENSE b/node_modules/chownr/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/chownr/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/chownr/README.md b/node_modules/chownr/README.md deleted file mode 100644 index 70e9a54..0000000 --- a/node_modules/chownr/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Like `chown -R`. - -Takes the same arguments as `fs.chown()` diff --git a/node_modules/chownr/chownr.js b/node_modules/chownr/chownr.js deleted file mode 100644 index 0d40932..0000000 --- a/node_modules/chownr/chownr.js +++ /dev/null @@ -1,167 +0,0 @@ -'use strict' -const fs = require('fs') -const path = require('path') - -/* istanbul ignore next */ -const LCHOWN = fs.lchown ? 'lchown' : 'chown' -/* istanbul ignore next */ -const LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync' - -/* istanbul ignore next */ -const needEISDIRHandled = fs.lchown && - !process.version.match(/v1[1-9]+\./) && - !process.version.match(/v10\.[6-9]/) - -const lchownSync = (path, uid, gid) => { - try { - return fs[LCHOWNSYNC](path, uid, gid) - } catch (er) { - if (er.code !== 'ENOENT') - throw er - } -} - -/* istanbul ignore next */ -const chownSync = (path, uid, gid) => { - try { - return fs.chownSync(path, uid, gid) - } catch (er) { - if (er.code !== 'ENOENT') - throw er - } -} - -/* istanbul ignore next */ -const handleEISDIR = - needEISDIRHandled ? (path, uid, gid, cb) => er => { - // Node prior to v10 had a very questionable implementation of - // fs.lchown, which would always try to call fs.open on a directory - // Fall back to fs.chown in those cases. - if (!er || er.code !== 'EISDIR') - cb(er) - else - fs.chown(path, uid, gid, cb) - } - : (_, __, ___, cb) => cb - -/* istanbul ignore next */ -const handleEISDirSync = - needEISDIRHandled ? (path, uid, gid) => { - try { - return lchownSync(path, uid, gid) - } catch (er) { - if (er.code !== 'EISDIR') - throw er - chownSync(path, uid, gid) - } - } - : (path, uid, gid) => lchownSync(path, uid, gid) - -// fs.readdir could only accept an options object as of node v6 -const nodeVersion = process.version -let readdir = (path, options, cb) => fs.readdir(path, options, cb) -let readdirSync = (path, options) => fs.readdirSync(path, options) -/* istanbul ignore next */ -if (/^v4\./.test(nodeVersion)) - readdir = (path, options, cb) => fs.readdir(path, cb) - -const chown = (cpath, uid, gid, cb) => { - fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, er => { - // Skip ENOENT error - cb(er && er.code !== 'ENOENT' ? er : null) - })) -} - -const chownrKid = (p, child, uid, gid, cb) => { - if (typeof child === 'string') - return fs.lstat(path.resolve(p, child), (er, stats) => { - // Skip ENOENT error - if (er) - return cb(er.code !== 'ENOENT' ? er : null) - stats.name = child - chownrKid(p, stats, uid, gid, cb) - }) - - if (child.isDirectory()) { - chownr(path.resolve(p, child.name), uid, gid, er => { - if (er) - return cb(er) - const cpath = path.resolve(p, child.name) - chown(cpath, uid, gid, cb) - }) - } else { - const cpath = path.resolve(p, child.name) - chown(cpath, uid, gid, cb) - } -} - - -const chownr = (p, uid, gid, cb) => { - readdir(p, { withFileTypes: true }, (er, children) => { - // any error other than ENOTDIR or ENOTSUP means it's not readable, - // or doesn't exist. give up. - if (er) { - if (er.code === 'ENOENT') - return cb() - else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') - return cb(er) - } - if (er || !children.length) - return chown(p, uid, gid, cb) - - let len = children.length - let errState = null - const then = er => { - if (errState) - return - if (er) - return cb(errState = er) - if (-- len === 0) - return chown(p, uid, gid, cb) - } - - children.forEach(child => chownrKid(p, child, uid, gid, then)) - }) -} - -const chownrKidSync = (p, child, uid, gid) => { - if (typeof child === 'string') { - try { - const stats = fs.lstatSync(path.resolve(p, child)) - stats.name = child - child = stats - } catch (er) { - if (er.code === 'ENOENT') - return - else - throw er - } - } - - if (child.isDirectory()) - chownrSync(path.resolve(p, child.name), uid, gid) - - handleEISDirSync(path.resolve(p, child.name), uid, gid) -} - -const chownrSync = (p, uid, gid) => { - let children - try { - children = readdirSync(p, { withFileTypes: true }) - } catch (er) { - if (er.code === 'ENOENT') - return - else if (er.code === 'ENOTDIR' || er.code === 'ENOTSUP') - return handleEISDirSync(p, uid, gid) - else - throw er - } - - if (children && children.length) - children.forEach(child => chownrKidSync(p, child, uid, gid)) - - return handleEISDirSync(p, uid, gid) -} - -module.exports = chownr -chownr.sync = chownrSync diff --git a/node_modules/chownr/package.json b/node_modules/chownr/package.json deleted file mode 100644 index dbfbb26..0000000 --- a/node_modules/chownr/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "chownr@^1.1.1", - "_id": "chownr@1.1.4", - "_inBundle": false, - "_integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "_location": "/chownr", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "chownr@^1.1.1", - "name": "chownr", - "escapedName": "chownr", - "rawSpec": "^1.1.1", - "saveSpec": null, - "fetchSpec": "^1.1.1" - }, - "_requiredBy": [ - "/tar" - ], - "_resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "_shasum": "6fc9d7b42d32a583596337666e7d08084da2cc6b", - "_spec": "chownr@^1.1.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/tar", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/chownr/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "like `chown -R`", - "devDependencies": { - "mkdirp": "0.3", - "rimraf": "^2.7.1", - "tap": "^14.10.6" - }, - "files": [ - "chownr.js" - ], - "homepage": "https://github.com/isaacs/chownr#readme", - "license": "ISC", - "main": "chownr.js", - "name": "chownr", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/chownr.git" - }, - "scripts": { - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "preversion": "npm test", - "test": "tap" - }, - "tap": { - "check-coverage": true - }, - "version": "1.1.4" -} diff --git a/node_modules/cliui/CHANGELOG.md b/node_modules/cliui/CHANGELOG.md deleted file mode 100644 index 6a77f8f..0000000 --- a/node_modules/cliui/CHANGELOG.md +++ /dev/null @@ -1,76 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -## [6.0.0](https://www.github.com/yargs/cliui/compare/v5.0.0...v6.0.0) (2019-11-10) - - -### ⚠ BREAKING CHANGES - -* update deps, drop Node 6 - -### Code Refactoring - -* update deps, drop Node 6 ([62056df](https://www.github.com/yargs/cliui/commit/62056df)) - -## [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10) - - -### Bug Fixes - -* Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae)) - - -### BREAKING CHANGES - -* Drop support for node < 6. - - - - -## [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23) - - -### Features - -* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902)) - - - - -## [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18) - - -### Bug Fixes - -* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46)) -* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36)) - - -### Chores - -* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376)) - - -### Features - -* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922)) - - -### BREAKING CHANGES - -* officially drop support for Node < 4 - - - - -## [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11) - - -### Bug Fixes - -* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33)) - -### Features - -* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32)) diff --git a/node_modules/cliui/LICENSE.txt b/node_modules/cliui/LICENSE.txt deleted file mode 100644 index c7e2747..0000000 --- a/node_modules/cliui/LICENSE.txt +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2015, Contributors - -Permission to use, copy, modify, and/or distribute this software -for any purpose with or without fee is hereby granted, provided -that the above copyright notice and this permission notice -appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE -LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/cliui/README.md b/node_modules/cliui/README.md deleted file mode 100644 index deacfa0..0000000 --- a/node_modules/cliui/README.md +++ /dev/null @@ -1,115 +0,0 @@ -# cliui - -[![Build Status](https://travis-ci.org/yargs/cliui.svg)](https://travis-ci.org/yargs/cliui) -[![Coverage Status](https://coveralls.io/repos/yargs/cliui/badge.svg?branch=)](https://coveralls.io/r/yargs/cliui?branch=) -[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui) -[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) - -easily create complex multi-column command-line-interfaces. - -## Example - -```js -var ui = require('cliui')() - -ui.div('Usage: $0 [command] [options]') - -ui.div({ - text: 'Options:', - padding: [2, 0, 2, 0] -}) - -ui.div( - { - text: "-f, --file", - width: 20, - padding: [0, 4, 0, 4] - }, - { - text: "the file to load." + - chalk.green("(if this description is long it wraps).") - , - width: 20 - }, - { - text: chalk.red("[required]"), - align: 'right' - } -) - -console.log(ui.toString()) -``` - - - -## Layout DSL - -cliui exposes a simple layout DSL: - -If you create a single `ui.div`, passing a string rather than an -object: - -* `\n`: characters will be interpreted as new rows. -* `\t`: characters will be interpreted as new columns. -* `\s`: characters will be interpreted as padding. - -**as an example...** - -```js -var ui = require('./')({ - width: 60 -}) - -ui.div( - 'Usage: node ./bin/foo.js\n' + - ' \t provide a regex\n' + - ' \t provide a glob\t [required]' -) - -console.log(ui.toString()) -``` - -**will output:** - -```shell -Usage: node ./bin/foo.js - provide a regex - provide a glob [required] -``` - -## Methods - -```js -cliui = require('cliui') -``` - -### cliui({width: integer}) - -Specify the maximum width of the UI being generated. -If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`. - -### cliui({wrap: boolean}) - -Enable or disable the wrapping of text in a column. - -### cliui.div(column, column, column) - -Create a row with any number of columns, a column -can either be a string, or an object with the following -options: - -* **text:** some text to place in the column. -* **width:** the width of a column. -* **align:** alignment, `right` or `center`. -* **padding:** `[top, right, bottom, left]`. -* **border:** should a border be placed around the div? - -### cliui.span(column, column, column) - -Similar to `div`, except the next row will be appended without -a new line being created. - -### cliui.resetOutput() - -Resets the UI elements of the current cliui instance, maintaining the values -set for `width` and `wrap`. diff --git a/node_modules/cliui/index.js b/node_modules/cliui/index.js deleted file mode 100644 index e917b00..0000000 --- a/node_modules/cliui/index.js +++ /dev/null @@ -1,354 +0,0 @@ -'use strict' - -const stringWidth = require('string-width') -const stripAnsi = require('strip-ansi') -const wrap = require('wrap-ansi') - -const align = { - right: alignRight, - center: alignCenter -} -const top = 0 -const right = 1 -const bottom = 2 -const left = 3 - -class UI { - constructor (opts) { - this.width = opts.width - this.wrap = opts.wrap - this.rows = [] - } - - span (...args) { - const cols = this.div(...args) - cols.span = true - } - - resetOutput () { - this.rows = [] - } - - div (...args) { - if (args.length === 0) { - this.div('') - } - - if (this.wrap && this._shouldApplyLayoutDSL(...args)) { - return this._applyLayoutDSL(args[0]) - } - - const cols = args.map(arg => { - if (typeof arg === 'string') { - return this._colFromString(arg) - } - - return arg - }) - - this.rows.push(cols) - return cols - } - - _shouldApplyLayoutDSL (...args) { - return args.length === 1 && typeof args[0] === 'string' && - /[\t\n]/.test(args[0]) - } - - _applyLayoutDSL (str) { - const rows = str.split('\n').map(row => row.split('\t')) - let leftColumnWidth = 0 - - // simple heuristic for layout, make sure the - // second column lines up along the left-hand. - // don't allow the first column to take up more - // than 50% of the screen. - rows.forEach(columns => { - if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) { - leftColumnWidth = Math.min( - Math.floor(this.width * 0.5), - stringWidth(columns[0]) - ) - } - }) - - // generate a table: - // replacing ' ' with padding calculations. - // using the algorithmically generated width. - rows.forEach(columns => { - this.div(...columns.map((r, i) => { - return { - text: r.trim(), - padding: this._measurePadding(r), - width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined - } - })) - }) - - return this.rows[this.rows.length - 1] - } - - _colFromString (text) { - return { - text, - padding: this._measurePadding(text) - } - } - - _measurePadding (str) { - // measure padding without ansi escape codes - const noAnsi = stripAnsi(str) - return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length] - } - - toString () { - const lines = [] - - this.rows.forEach(row => { - this.rowToString(row, lines) - }) - - // don't display any lines with the - // hidden flag set. - return lines - .filter(line => !line.hidden) - .map(line => line.text) - .join('\n') - } - - rowToString (row, lines) { - this._rasterize(row).forEach((rrow, r) => { - let str = '' - rrow.forEach((col, c) => { - const { width } = row[c] // the width with padding. - const wrapWidth = this._negatePadding(row[c]) // the width without padding. - - let ts = col // temporary string used during alignment/padding. - - if (wrapWidth > stringWidth(col)) { - ts += ' '.repeat(wrapWidth - stringWidth(col)) - } - - // align the string within its column. - if (row[c].align && row[c].align !== 'left' && this.wrap) { - ts = align[row[c].align](ts, wrapWidth) - if (stringWidth(ts) < wrapWidth) { - ts += ' '.repeat(width - stringWidth(ts) - 1) - } - } - - // apply border and padding to string. - const padding = row[c].padding || [0, 0, 0, 0] - if (padding[left]) { - str += ' '.repeat(padding[left]) - } - - str += addBorder(row[c], ts, '| ') - str += ts - str += addBorder(row[c], ts, ' |') - if (padding[right]) { - str += ' '.repeat(padding[right]) - } - - // if prior row is span, try to render the - // current row on the prior line. - if (r === 0 && lines.length > 0) { - str = this._renderInline(str, lines[lines.length - 1]) - } - }) - - // remove trailing whitespace. - lines.push({ - text: str.replace(/ +$/, ''), - span: row.span - }) - }) - - return lines - } - - // if the full 'source' can render in - // the target line, do so. - _renderInline (source, previousLine) { - const leadingWhitespace = source.match(/^ */)[0].length - const target = previousLine.text - const targetTextWidth = stringWidth(target.trimRight()) - - if (!previousLine.span) { - return source - } - - // if we're not applying wrapping logic, - // just always append to the span. - if (!this.wrap) { - previousLine.hidden = true - return target + source - } - - if (leadingWhitespace < targetTextWidth) { - return source - } - - previousLine.hidden = true - - return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft() - } - - _rasterize (row) { - const rrows = [] - const widths = this._columnWidths(row) - let wrapped - - // word wrap all columns, and create - // a data-structure that is easy to rasterize. - row.forEach((col, c) => { - // leave room for left and right padding. - col.width = widths[c] - if (this.wrap) { - wrapped = wrap(col.text, this._negatePadding(col), { hard: true }).split('\n') - } else { - wrapped = col.text.split('\n') - } - - if (col.border) { - wrapped.unshift('.' + '-'.repeat(this._negatePadding(col) + 2) + '.') - wrapped.push("'" + '-'.repeat(this._negatePadding(col) + 2) + "'") - } - - // add top and bottom padding. - if (col.padding) { - wrapped.unshift(...new Array(col.padding[top] || 0).fill('')) - wrapped.push(...new Array(col.padding[bottom] || 0).fill('')) - } - - wrapped.forEach((str, r) => { - if (!rrows[r]) { - rrows.push([]) - } - - const rrow = rrows[r] - - for (let i = 0; i < c; i++) { - if (rrow[i] === undefined) { - rrow.push('') - } - } - - rrow.push(str) - }) - }) - - return rrows - } - - _negatePadding (col) { - let wrapWidth = col.width - if (col.padding) { - wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0) - } - - if (col.border) { - wrapWidth -= 4 - } - - return wrapWidth - } - - _columnWidths (row) { - if (!this.wrap) { - return row.map(col => { - return col.width || stringWidth(col.text) - }) - } - - let unset = row.length - let remainingWidth = this.width - - // column widths can be set in config. - const widths = row.map(col => { - if (col.width) { - unset-- - remainingWidth -= col.width - return col.width - } - - return undefined - }) - - // any unset widths should be calculated. - const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0 - - return widths.map((w, i) => { - if (w === undefined) { - return Math.max(unsetWidth, _minWidth(row[i])) - } - - return w - }) - } -} - -function addBorder (col, ts, style) { - if (col.border) { - if (/[.']-+[.']/.test(ts)) { - return '' - } - - if (ts.trim().length !== 0) { - return style - } - - return ' ' - } - - return '' -} - -// calculates the minimum width of -// a column, based on padding preferences. -function _minWidth (col) { - const padding = col.padding || [] - const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0) - if (col.border) { - return minWidth + 4 - } - - return minWidth -} - -function getWindowWidth () { - /* istanbul ignore next: depends on terminal */ - if (typeof process === 'object' && process.stdout && process.stdout.columns) { - return process.stdout.columns - } -} - -function alignRight (str, width) { - str = str.trim() - const strWidth = stringWidth(str) - - if (strWidth < width) { - return ' '.repeat(width - strWidth) + str - } - - return str -} - -function alignCenter (str, width) { - str = str.trim() - const strWidth = stringWidth(str) - - /* istanbul ignore next */ - if (strWidth >= width) { - return str - } - - return ' '.repeat((width - strWidth) >> 1) + str -} - -module.exports = function (opts = {}) { - return new UI({ - width: opts.width || getWindowWidth() || /* istanbul ignore next */ 80, - wrap: opts.wrap !== false - }) -} diff --git a/node_modules/cliui/node_modules/ansi-regex/index.d.ts b/node_modules/cliui/node_modules/ansi-regex/index.d.ts deleted file mode 100644 index 2dbf6af..0000000 --- a/node_modules/cliui/node_modules/ansi-regex/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare namespace ansiRegex { - interface Options { - /** - Match only the first ANSI escape. - - @default false - */ - onlyFirst: boolean; - } -} - -/** -Regular expression for matching ANSI escape codes. - -@example -``` -import ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` -*/ -declare function ansiRegex(options?: ansiRegex.Options): RegExp; - -export = ansiRegex; diff --git a/node_modules/cliui/node_modules/ansi-regex/index.js b/node_modules/cliui/node_modules/ansi-regex/index.js deleted file mode 100644 index 35054aa..0000000 --- a/node_modules/cliui/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = ({onlyFirst = false} = {}) => { - const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' - ].join('|'); - - return new RegExp(pattern, onlyFirst ? undefined : 'g'); -}; diff --git a/node_modules/cliui/node_modules/ansi-regex/license b/node_modules/cliui/node_modules/ansi-regex/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/cliui/node_modules/ansi-regex/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cliui/node_modules/ansi-regex/package.json b/node_modules/cliui/node_modules/ansi-regex/package.json deleted file mode 100644 index dab1a68..0000000 --- a/node_modules/cliui/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "_from": "ansi-regex@^5.0.0", - "_id": "ansi-regex@5.0.0", - "_inBundle": false, - "_integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "_location": "/cliui/ansi-regex", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ansi-regex@^5.0.0", - "name": "ansi-regex", - "escapedName": "ansi-regex", - "rawSpec": "^5.0.0", - "saveSpec": null, - "fetchSpec": "^5.0.0" - }, - "_requiredBy": [ - "/cliui/strip-ansi" - ], - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "_shasum": "388539f55179bf39339c81af30a654d69f87cb75", - "_spec": "ansi-regex@^5.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/cliui/node_modules/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/ansi-regex/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Regular expression for matching ANSI escape codes", - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.9.0", - "xo": "^0.25.3" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/chalk/ansi-regex#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "license": "MIT", - "name": "ansi-regex", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/ansi-regex.git" - }, - "scripts": { - "test": "xo && ava && tsd", - "view-supported": "node fixtures/view-codes.js" - }, - "version": "5.0.0" -} diff --git a/node_modules/cliui/node_modules/ansi-regex/readme.md b/node_modules/cliui/node_modules/ansi-regex/readme.md deleted file mode 100644 index 3c2b77c..0000000 --- a/node_modules/cliui/node_modules/ansi-regex/readme.md +++ /dev/null @@ -1,78 +0,0 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) - -> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install ansi-regex -``` - - -## Usage - -```js -const ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` - - -## API - -### ansiRegex(options?) - -Returns a regex for matching ANSI escape codes. - -#### options - -Type: `object` - -##### onlyFirst - -Type: `boolean`
-Default: `false` *(Matches any ANSI escape codes in a string)* - -Match only the first ANSI escape. - - -## FAQ - -### Why do you test for codes not in the ECMA 48 standard? - -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. - -On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/cliui/node_modules/is-fullwidth-code-point/index.d.ts b/node_modules/cliui/node_modules/is-fullwidth-code-point/index.d.ts deleted file mode 100644 index 729d202..0000000 --- a/node_modules/cliui/node_modules/is-fullwidth-code-point/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms). - -@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - -@example -``` -import isFullwidthCodePoint from 'is-fullwidth-code-point'; - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` -*/ -export default function isFullwidthCodePoint(codePoint: number): boolean; diff --git a/node_modules/cliui/node_modules/is-fullwidth-code-point/index.js b/node_modules/cliui/node_modules/is-fullwidth-code-point/index.js deleted file mode 100644 index 671f97f..0000000 --- a/node_modules/cliui/node_modules/is-fullwidth-code-point/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable yoda */ -'use strict'; - -const isFullwidthCodePoint = codePoint => { - if (Number.isNaN(codePoint)) { - return false; - } - - // Code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - codePoint >= 0x1100 && ( - codePoint <= 0x115F || // Hangul Jamo - codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET - codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= codePoint && codePoint <= 0x4DBF) || - // CJK Unified Ideographs .. Yi Radicals - (0x4E00 <= codePoint && codePoint <= 0xA4C6) || - // Hangul Jamo Extended-A - (0xA960 <= codePoint && codePoint <= 0xA97C) || - // Hangul Syllables - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - // CJK Compatibility Ideographs - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - // Vertical Forms - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - // CJK Compatibility Forms .. Small Form Variants - (0xFE30 <= codePoint && codePoint <= 0xFE6B) || - // Halfwidth and Fullwidth Forms - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || - // Kana Supplement - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - // Enclosed Ideographic Supplement - (0x1F200 <= codePoint && codePoint <= 0x1F251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= codePoint && codePoint <= 0x3FFFD) - ) - ) { - return true; - } - - return false; -}; - -module.exports = isFullwidthCodePoint; -module.exports.default = isFullwidthCodePoint; diff --git a/node_modules/cliui/node_modules/is-fullwidth-code-point/license b/node_modules/cliui/node_modules/is-fullwidth-code-point/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/cliui/node_modules/is-fullwidth-code-point/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cliui/node_modules/is-fullwidth-code-point/package.json b/node_modules/cliui/node_modules/is-fullwidth-code-point/package.json deleted file mode 100644 index 69e933a..0000000 --- a/node_modules/cliui/node_modules/is-fullwidth-code-point/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "is-fullwidth-code-point@^3.0.0", - "_id": "is-fullwidth-code-point@3.0.0", - "_inBundle": false, - "_integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "_location": "/cliui/is-fullwidth-code-point", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "is-fullwidth-code-point@^3.0.0", - "name": "is-fullwidth-code-point", - "escapedName": "is-fullwidth-code-point", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/cliui/string-width" - ], - "_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "_shasum": "f116f8064fe90b3f7844a38997c0b75051269f1d", - "_spec": "is-fullwidth-code-point@^3.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/cliui/node_modules/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Check if the character represented by a given Unicode code point is fullwidth", - "devDependencies": { - "ava": "^1.3.1", - "tsd-check": "^0.5.0", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme", - "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", - "string", - "codepoint", - "code", - "point", - "is", - "detect", - "check" - ], - "license": "MIT", - "name": "is-fullwidth-code-point", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git" - }, - "scripts": { - "test": "xo && ava && tsd-check" - }, - "version": "3.0.0" -} diff --git a/node_modules/cliui/node_modules/is-fullwidth-code-point/readme.md b/node_modules/cliui/node_modules/is-fullwidth-code-point/readme.md deleted file mode 100644 index 4236bba..0000000 --- a/node_modules/cliui/node_modules/is-fullwidth-code-point/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) - -> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) - - -## Install - -``` -$ npm install is-fullwidth-code-point -``` - - -## Usage - -```js -const isFullwidthCodePoint = require('is-fullwidth-code-point'); - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` - - -## API - -### isFullwidthCodePoint(codePoint) - -#### codePoint - -Type: `number` - -The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/cliui/node_modules/string-width/index.d.ts b/node_modules/cliui/node_modules/string-width/index.d.ts deleted file mode 100644 index 12b5309..0000000 --- a/node_modules/cliui/node_modules/string-width/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare const stringWidth: { - /** - Get the visual width of a string - the number of columns required to display it. - - Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - - @example - ``` - import stringWidth = require('string-width'); - - stringWidth('a'); - //=> 1 - - stringWidth('古'); - //=> 2 - - stringWidth('\u001B[1m古\u001B[22m'); - //=> 2 - ``` - */ - (string: string): number; - - // TODO: remove this in the next major version, refactor the whole definition to: - // declare function stringWidth(string: string): number; - // export = stringWidth; - default: typeof stringWidth; -} - -export = stringWidth; diff --git a/node_modules/cliui/node_modules/string-width/index.js b/node_modules/cliui/node_modules/string-width/index.js deleted file mode 100644 index a348067..0000000 --- a/node_modules/cliui/node_modules/string-width/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; -const stripAnsi = require('strip-ansi'); -const isFullwidthCodePoint = require('is-fullwidth-code-point'); -const emojiRegex = require('emoji-regex'); - -const stringWidth = string => { - string = string.replace(emojiRegex(), ' '); - - if (typeof string !== 'string' || string.length === 0) { - return 0; - } - - string = stripAnsi(string); - - let width = 0; - - for (let i = 0; i < string.length; i++) { - const code = string.codePointAt(i); - - // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { - continue; - } - - // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { - continue; - } - - // Surrogates - if (code > 0xFFFF) { - i++; - } - - width += isFullwidthCodePoint(code) ? 2 : 1; - } - - return width; -}; - -module.exports = stringWidth; -// TODO: remove this in the next major version -module.exports.default = stringWidth; diff --git a/node_modules/cliui/node_modules/string-width/license b/node_modules/cliui/node_modules/string-width/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/cliui/node_modules/string-width/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cliui/node_modules/string-width/package.json b/node_modules/cliui/node_modules/string-width/package.json deleted file mode 100644 index b31574f..0000000 --- a/node_modules/cliui/node_modules/string-width/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_from": "string-width@^4.2.0", - "_id": "string-width@4.2.0", - "_inBundle": false, - "_integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "_location": "/cliui/string-width", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "string-width@^4.2.0", - "name": "string-width", - "escapedName": "string-width", - "rawSpec": "^4.2.0", - "saveSpec": null, - "fetchSpec": "^4.2.0" - }, - "_requiredBy": [ - "/cliui" - ], - "_resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "_shasum": "952182c46cc7b2c313d1596e623992bd163b72b5", - "_spec": "string-width@^4.2.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/cliui", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/string-width/issues" - }, - "bundleDependencies": false, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "deprecated": false, - "description": "Get the visual width of a string - the number of columns required to display it", - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/string-width#readme", - "keywords": [ - "string", - "character", - "unicode", - "width", - "visual", - "column", - "columns", - "fullwidth", - "full-width", - "full", - "ansi", - "escape", - "codes", - "cli", - "command-line", - "terminal", - "console", - "cjk", - "chinese", - "japanese", - "korean", - "fixed-width" - ], - "license": "MIT", - "name": "string-width", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/string-width.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "4.2.0" -} diff --git a/node_modules/cliui/node_modules/string-width/readme.md b/node_modules/cliui/node_modules/string-width/readme.md deleted file mode 100644 index 705f206..0000000 --- a/node_modules/cliui/node_modules/string-width/readme.md +++ /dev/null @@ -1,50 +0,0 @@ -# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width) - -> Get the visual width of a string - the number of columns required to display it - -Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - -Useful to be able to measure the actual width of command-line output. - - -## Install - -``` -$ npm install string-width -``` - - -## Usage - -```js -const stringWidth = require('string-width'); - -stringWidth('a'); -//=> 1 - -stringWidth('古'); -//=> 2 - -stringWidth('\u001B[1m古\u001B[22m'); -//=> 2 -``` - - -## Related - -- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module -- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string -- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/cliui/node_modules/strip-ansi/index.d.ts b/node_modules/cliui/node_modules/strip-ansi/index.d.ts deleted file mode 100644 index 907fccc..0000000 --- a/node_modules/cliui/node_modules/strip-ansi/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. - -@example -``` -import stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` -*/ -declare function stripAnsi(string: string): string; - -export = stripAnsi; diff --git a/node_modules/cliui/node_modules/strip-ansi/index.js b/node_modules/cliui/node_modules/strip-ansi/index.js deleted file mode 100644 index 9a593df..0000000 --- a/node_modules/cliui/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -const ansiRegex = require('ansi-regex'); - -module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/node_modules/cliui/node_modules/strip-ansi/license b/node_modules/cliui/node_modules/strip-ansi/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/cliui/node_modules/strip-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cliui/node_modules/strip-ansi/package.json b/node_modules/cliui/node_modules/strip-ansi/package.json deleted file mode 100644 index 6634bba..0000000 --- a/node_modules/cliui/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "_from": "strip-ansi@^6.0.0", - "_id": "strip-ansi@6.0.0", - "_inBundle": false, - "_integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "_location": "/cliui/strip-ansi", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "strip-ansi@^6.0.0", - "name": "strip-ansi", - "escapedName": "strip-ansi", - "rawSpec": "^6.0.0", - "saveSpec": null, - "fetchSpec": "^6.0.0" - }, - "_requiredBy": [ - "/cliui", - "/cliui/string-width" - ], - "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "_shasum": "0b1571dd7669ccd4f3e06e14ef1eed26225ae532", - "_spec": "strip-ansi@^6.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/cliui", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/strip-ansi/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "deprecated": false, - "description": "Strip ANSI escape codes from a string", - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.10.0", - "xo": "^0.25.3" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/chalk/strip-ansi#readme", - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "strip-ansi", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/strip-ansi.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "6.0.0" -} diff --git a/node_modules/cliui/node_modules/strip-ansi/readme.md b/node_modules/cliui/node_modules/strip-ansi/readme.md deleted file mode 100644 index 7c4b56d..0000000 --- a/node_modules/cliui/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,46 +0,0 @@ -# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) - -> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string - - -## Install - -``` -$ npm install strip-ansi -``` - - -## Usage - -```js -const stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` - - -## strip-ansi for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - - -## Related - -- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module -- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module -- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - diff --git a/node_modules/cliui/package.json b/node_modules/cliui/package.json deleted file mode 100644 index f89de3c..0000000 --- a/node_modules/cliui/package.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "_from": "cliui@^6.0.0", - "_id": "cliui@6.0.0", - "_inBundle": false, - "_integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "_location": "/cliui", - "_phantomChildren": { - "emoji-regex": "8.0.0" - }, - "_requested": { - "type": "range", - "registry": true, - "raw": "cliui@^6.0.0", - "name": "cliui", - "escapedName": "cliui", - "rawSpec": "^6.0.0", - "saveSpec": null, - "fetchSpec": "^6.0.0" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "_shasum": "511d702c0c4e41ca156d7d0e96021f23e13225b1", - "_spec": "cliui@^6.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "Ben Coe", - "email": "ben@npmjs.com" - }, - "bugs": { - "url": "https://github.com/yargs/cliui/issues" - }, - "bundleDependencies": false, - "config": { - "blanket": { - "pattern": [ - "index.js" - ], - "data-cover-never": [ - "node_modules", - "test" - ], - "output-reporter": "spec" - } - }, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - }, - "deprecated": false, - "description": "easily create complex multi-column command-line-interfaces", - "devDependencies": { - "chai": "^4.2.0", - "chalk": "^3.0.0", - "coveralls": "^3.0.3", - "mocha": "^6.2.2", - "nyc": "^14.1.1", - "standard": "^12.0.1" - }, - "engine": { - "node": ">=8" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/yargs/cliui#readme", - "keywords": [ - "cli", - "command-line", - "layout", - "design", - "console", - "wrap", - "table" - ], - "license": "ISC", - "main": "index.js", - "name": "cliui", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/yargs/cliui.git" - }, - "scripts": { - "coverage": "nyc --reporter=text-lcov mocha | coveralls", - "pretest": "standard", - "test": "nyc mocha" - }, - "standard": { - "ignore": [ - "**/example/**" - ], - "globals": [ - "it" - ] - }, - "version": "6.0.0" -} diff --git a/node_modules/clone/.npmignore b/node_modules/clone/.npmignore deleted file mode 100644 index 2ff84f0..0000000 --- a/node_modules/clone/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -/node_modules/ -/test.js -/.travis.yml -*.html diff --git a/node_modules/clone/LICENSE b/node_modules/clone/LICENSE deleted file mode 100644 index cc3c87b..0000000 --- a/node_modules/clone/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright © 2011-2015 Paul Vorbach - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the “Software”), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/clone/README.md b/node_modules/clone/README.md deleted file mode 100644 index 207e60a..0000000 --- a/node_modules/clone/README.md +++ /dev/null @@ -1,194 +0,0 @@ -# clone - -[![build status](https://secure.travis-ci.org/pvorb/clone.svg)](http://travis-ci.org/pvorb/clone) [![downloads](https://img.shields.io/npm/dt/clone.svg)](http://npm-stat.com/charts.html?package=clone) - -offers foolproof _deep cloning_ of objects, arrays, numbers, strings, maps, -sets, promises, etc. in JavaScript. - -**XSS vulnerability detected** - - -## Installation - - npm install clone - -(It also works with browserify, ender or standalone. You may want to use the -option `noParse` in browserify to reduce the resulting file size, since usually -`Buffer`s are not needed in browsers.) - - -## Example - -~~~ javascript -var clone = require('clone'); - -var a, b; - -a = { foo: { bar: 'baz' } }; // initial value of a - -b = clone(a); // clone a -> b -a.foo.bar = 'foo'; // change a - -console.log(a); // show a -console.log(b); // show b -~~~ - -This will print: - -~~~ javascript -{ foo: { bar: 'foo' } } -{ foo: { bar: 'baz' } } -~~~ - -**clone** masters cloning simple objects (even with custom prototype), arrays, -Date objects, and RegExp objects. Everything is cloned recursively, so that you -can clone dates in arrays in objects, for example. - - -## API - -`clone(val, circular, depth)` - - * `val` -- the value that you want to clone, any type allowed - * `circular` -- boolean - - Call `clone` with `circular` set to `false` if you are certain that `obj` - contains no circular references. This will give better performance if - needed. There is no error if `undefined` or `null` is passed as `obj`. - * `depth` -- depth to which the object is to be cloned (optional, - defaults to infinity) - * `prototype` -- sets the prototype to be used when cloning an object. - (optional, defaults to parent prototype). - * `includeNonEnumerable` -- set to `true` if the non-enumerable properties - should be cloned as well. Non-enumerable properties on the prototype chain - will be ignored. (optional, defaults to `false`) - -`clone.clonePrototype(obj)` - - * `obj` -- the object that you want to clone - -Does a prototype clone as -[described by Oran Looney](http://oranlooney.com/functional-javascript/). - - -## Circular References - -~~~ javascript -var a, b; - -a = { hello: 'world' }; - -a.myself = a; -b = clone(a); - -console.log(b); -~~~ - -This will print: - -~~~ javascript -{ hello: "world", myself: [Circular] } -~~~ - -So, `b.myself` points to `b`, not `a`. Neat! - - -## Test - - npm test - - -## Changelog - -### v2.1.2 - -#### 2018-03-21 - - - Use `Buffer.allocUnsafe()` on Node >= 4.5.0 (contributed by @ChALkeR) - -### v2.1.1 - -#### 2017-03-09 - - - Fix build badge in README - - Add support for cloning Maps and Sets on Internet Explorer - -### v2.1.0 - -#### 2016-11-22 - - - Add support for cloning Errors - - Exclude non-enumerable symbol-named object properties from cloning - - Add option to include non-enumerable own properties of objects - -### v2.0.0 - -#### 2016-09-28 - - - Add support for cloning ES6 Maps, Sets, Promises, and Symbols - -### v1.0.3 - -#### 2017-11-08 - - - Close XSS vulnerability in the NPM package, which included the file - `test-apart-ctx.html`. This vulnerability was disclosed by Juho Nurminen of - 2NS - Second Nature Security. - -### v1.0.2 (deprecated) - -#### 2015-03-25 - - - Fix call on getRegExpFlags - - Refactor utilities - - Refactor test suite - -### v1.0.1 (deprecated) - -#### 2015-03-04 - - - Fix nodeunit version - - Directly call getRegExpFlags - -### v1.0.0 (deprecated) - -#### 2015-02-10 - - - Improve browser support - - Improve browser testability - - Move helper methods to private namespace - -## Caveat - -Some special objects like a socket or `process.stdout`/`stderr` are known to not -be cloneable. If you find other objects that cannot be cloned, please [open an -issue](https://github.com/pvorb/clone/issues/new). - - -## Bugs and Issues - -If you encounter any bugs or issues, feel free to [open an issue at -github](https://github.com/pvorb/clone/issues) or send me an email to -. I also always like to hear from you, if you’re using my code. - -## License - -Copyright © 2011-2016 [Paul Vorbach](https://paul.vorba.ch/) and -[contributors](https://github.com/pvorb/clone/graphs/contributors). - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the “Software”), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/clone/clone.iml b/node_modules/clone/clone.iml deleted file mode 100644 index 30de8ae..0000000 --- a/node_modules/clone/clone.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/clone/clone.js b/node_modules/clone/clone.js deleted file mode 100644 index 3fa5fad..0000000 --- a/node_modules/clone/clone.js +++ /dev/null @@ -1,257 +0,0 @@ -var clone = (function() { -'use strict'; - -function _instanceof(obj, type) { - return type != null && obj instanceof type; -} - -var nativeMap; -try { - nativeMap = Map; -} catch(_) { - // maybe a reference error because no `Map`. Give it a dummy value that no - // value will ever be an instanceof. - nativeMap = function() {}; -} - -var nativeSet; -try { - nativeSet = Set; -} catch(_) { - nativeSet = function() {}; -} - -var nativePromise; -try { - nativePromise = Promise; -} catch(_) { - nativePromise = function() {}; -} - -/** - * Clones (copies) an Object using deep copying. - * - * This function supports circular references by default, but if you are certain - * there are no circular references in your object, you can save some CPU time - * by calling clone(obj, false). - * - * Caution: if `circular` is false and `parent` contains circular references, - * your program may enter an infinite loop and crash. - * - * @param `parent` - the object to be cloned - * @param `circular` - set to true if the object to be cloned may contain - * circular references. (optional - true by default) - * @param `depth` - set to a number if the object is only to be cloned to - * a particular depth. (optional - defaults to Infinity) - * @param `prototype` - sets the prototype to be used when cloning an object. - * (optional - defaults to parent prototype). - * @param `includeNonEnumerable` - set to true if the non-enumerable properties - * should be cloned as well. Non-enumerable properties on the prototype - * chain will be ignored. (optional - false by default) -*/ -function clone(parent, circular, depth, prototype, includeNonEnumerable) { - if (typeof circular === 'object') { - depth = circular.depth; - prototype = circular.prototype; - includeNonEnumerable = circular.includeNonEnumerable; - circular = circular.circular; - } - // maintain two arrays for circular references, where corresponding parents - // and children have the same index - var allParents = []; - var allChildren = []; - - var useBuffer = typeof Buffer != 'undefined'; - - if (typeof circular == 'undefined') - circular = true; - - if (typeof depth == 'undefined') - depth = Infinity; - - // recurse this function so we don't reset allParents and allChildren - function _clone(parent, depth) { - // cloning null always returns null - if (parent === null) - return null; - - if (depth === 0) - return parent; - - var child; - var proto; - if (typeof parent != 'object') { - return parent; - } - - if (_instanceof(parent, nativeMap)) { - child = new nativeMap(); - } else if (_instanceof(parent, nativeSet)) { - child = new nativeSet(); - } else if (_instanceof(parent, nativePromise)) { - child = new nativePromise(function (resolve, reject) { - parent.then(function(value) { - resolve(_clone(value, depth - 1)); - }, function(err) { - reject(_clone(err, depth - 1)); - }); - }); - } else if (clone.__isArray(parent)) { - child = []; - } else if (clone.__isRegExp(parent)) { - child = new RegExp(parent.source, __getRegExpFlags(parent)); - if (parent.lastIndex) child.lastIndex = parent.lastIndex; - } else if (clone.__isDate(parent)) { - child = new Date(parent.getTime()); - } else if (useBuffer && Buffer.isBuffer(parent)) { - if (Buffer.allocUnsafe) { - // Node.js >= 4.5.0 - child = Buffer.allocUnsafe(parent.length); - } else { - // Older Node.js versions - child = new Buffer(parent.length); - } - parent.copy(child); - return child; - } else if (_instanceof(parent, Error)) { - child = Object.create(parent); - } else { - if (typeof prototype == 'undefined') { - proto = Object.getPrototypeOf(parent); - child = Object.create(proto); - } - else { - child = Object.create(prototype); - proto = prototype; - } - } - - if (circular) { - var index = allParents.indexOf(parent); - - if (index != -1) { - return allChildren[index]; - } - allParents.push(parent); - allChildren.push(child); - } - - if (_instanceof(parent, nativeMap)) { - parent.forEach(function(value, key) { - var keyChild = _clone(key, depth - 1); - var valueChild = _clone(value, depth - 1); - child.set(keyChild, valueChild); - }); - } - if (_instanceof(parent, nativeSet)) { - parent.forEach(function(value) { - var entryChild = _clone(value, depth - 1); - child.add(entryChild); - }); - } - - for (var i in parent) { - var attrs; - if (proto) { - attrs = Object.getOwnPropertyDescriptor(proto, i); - } - - if (attrs && attrs.set == null) { - continue; - } - child[i] = _clone(parent[i], depth - 1); - } - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(parent); - for (var i = 0; i < symbols.length; i++) { - // Don't need to worry about cloning a symbol because it is a primitive, - // like a number or string. - var symbol = symbols[i]; - var descriptor = Object.getOwnPropertyDescriptor(parent, symbol); - if (descriptor && !descriptor.enumerable && !includeNonEnumerable) { - continue; - } - child[symbol] = _clone(parent[symbol], depth - 1); - if (!descriptor.enumerable) { - Object.defineProperty(child, symbol, { - enumerable: false - }); - } - } - } - - if (includeNonEnumerable) { - var allPropertyNames = Object.getOwnPropertyNames(parent); - for (var i = 0; i < allPropertyNames.length; i++) { - var propertyName = allPropertyNames[i]; - var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName); - if (descriptor && descriptor.enumerable) { - continue; - } - child[propertyName] = _clone(parent[propertyName], depth - 1); - Object.defineProperty(child, propertyName, { - enumerable: false - }); - } - } - - return child; - } - - return _clone(parent, depth); -} - -/** - * Simple flat clone using prototype, accepts only objects, usefull for property - * override on FLAT configuration object (no nested props). - * - * USE WITH CAUTION! This may not behave as you wish if you do not know how this - * works. - */ -clone.clonePrototype = function clonePrototype(parent) { - if (parent === null) - return null; - - var c = function () {}; - c.prototype = parent; - return new c(); -}; - -// private utility functions - -function __objToStr(o) { - return Object.prototype.toString.call(o); -} -clone.__objToStr = __objToStr; - -function __isDate(o) { - return typeof o === 'object' && __objToStr(o) === '[object Date]'; -} -clone.__isDate = __isDate; - -function __isArray(o) { - return typeof o === 'object' && __objToStr(o) === '[object Array]'; -} -clone.__isArray = __isArray; - -function __isRegExp(o) { - return typeof o === 'object' && __objToStr(o) === '[object RegExp]'; -} -clone.__isRegExp = __isRegExp; - -function __getRegExpFlags(re) { - var flags = ''; - if (re.global) flags += 'g'; - if (re.ignoreCase) flags += 'i'; - if (re.multiline) flags += 'm'; - return flags; -} -clone.__getRegExpFlags = __getRegExpFlags; - -return clone; -})(); - -if (typeof module === 'object' && module.exports) { - module.exports = clone; -} diff --git a/node_modules/clone/package.json b/node_modules/clone/package.json deleted file mode 100644 index e9b9a71..0000000 --- a/node_modules/clone/package.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "_from": "clone@~2.1.2", - "_id": "clone@2.1.2", - "_inBundle": false, - "_integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", - "_location": "/clone", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "clone@~2.1.2", - "name": "clone", - "escapedName": "clone", - "rawSpec": "~2.1.2", - "saveSpec": null, - "fetchSpec": "~2.1.2" - }, - "_requiredBy": [ - "/vega-lite" - ], - "_resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "_shasum": "1b7f4b9f591f1e8f83670401600345a02887435f", - "_spec": "clone@~2.1.2", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-lite", - "author": { - "name": "Paul Vorbach", - "email": "paul@vorba.ch", - "url": "http://paul.vorba.ch/" - }, - "bugs": { - "url": "https://github.com/pvorb/node-clone/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Blake Miner", - "email": "miner.blake@gmail.com", - "url": "http://www.blakeminer.com/" - }, - { - "name": "Tian You", - "email": "axqd001@gmail.com", - "url": "http://blog.axqd.net/" - }, - { - "name": "George Stagas", - "email": "gstagas@gmail.com", - "url": "http://stagas.com/" - }, - { - "name": "Tobiasz Cudnik", - "email": "tobiasz.cudnik@gmail.com", - "url": "https://github.com/TobiaszCudnik" - }, - { - "name": "Pavel Lang", - "email": "langpavel@phpskelet.org", - "url": "https://github.com/langpavel" - }, - { - "name": "Dan MacTough", - "url": "http://yabfog.com/" - }, - { - "name": "w1nk", - "url": "https://github.com/w1nk" - }, - { - "name": "Hugh Kennedy", - "url": "http://twitter.com/hughskennedy" - }, - { - "name": "Dustin Diaz", - "url": "http://dustindiaz.com" - }, - { - "name": "Ilya Shaisultanov", - "url": "https://github.com/diversario" - }, - { - "name": "Nathan MacInnes", - "email": "nathan@macinn.es", - "url": "http://macinn.es/" - }, - { - "name": "Benjamin E. Coe", - "email": "ben@npmjs.com", - "url": "https://twitter.com/benjamincoe" - }, - { - "name": "Nathan Zadoks", - "url": "https://github.com/nathan7" - }, - { - "name": "Róbert Oroszi", - "email": "robert+gh@oroszi.net", - "url": "https://github.com/oroce" - }, - { - "name": "Aurélio A. Heckert", - "url": "http://softwarelivre.org/aurium" - }, - { - "name": "Guy Ellis", - "url": "http://www.guyellisrocks.com/" - }, - { - "name": "fscherwi", - "url": "https://fscherwi.github.io" - }, - { - "name": "rictic", - "url": "https://github.com/rictic" - }, - { - "name": "Martin Jurča", - "url": "https://github.com/jurca" - }, - { - "name": "Misery Lee", - "email": "miserylee@foxmail.com", - "url": "https://github.com/miserylee" - }, - { - "name": "Clemens Wolff", - "url": "https://github.com/c-w" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "deep cloning of objects and arrays", - "devDependencies": { - "nodeunit": "~0.9.0" - }, - "engines": { - "node": ">=0.8" - }, - "homepage": "https://github.com/pvorb/node-clone#readme", - "license": "MIT", - "main": "clone.js", - "name": "clone", - "optionalDependencies": {}, - "repository": { - "type": "git", - "url": "git://github.com/pvorb/node-clone.git" - }, - "scripts": { - "test": "nodeunit test.js" - }, - "tags": [ - "clone", - "object", - "array", - "function", - "date" - ], - "version": "2.1.2" -} diff --git a/node_modules/code-point-at/index.js b/node_modules/code-point-at/index.js deleted file mode 100644 index 0432fe6..0000000 --- a/node_modules/code-point-at/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* eslint-disable babel/new-cap, xo/throw-new-error */ -'use strict'; -module.exports = function (str, pos) { - if (str === null || str === undefined) { - throw TypeError(); - } - - str = String(str); - - var size = str.length; - var i = pos ? Number(pos) : 0; - - if (Number.isNaN(i)) { - i = 0; - } - - if (i < 0 || i >= size) { - return undefined; - } - - var first = str.charCodeAt(i); - - if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { - var second = str.charCodeAt(i + 1); - - if (second >= 0xDC00 && second <= 0xDFFF) { - return ((first - 0xD800) * 0x400) + second - 0xDC00 + 0x10000; - } - } - - return first; -}; diff --git a/node_modules/code-point-at/license b/node_modules/code-point-at/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/code-point-at/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/code-point-at/package.json b/node_modules/code-point-at/package.json deleted file mode 100644 index 86ff30f..0000000 --- a/node_modules/code-point-at/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "_from": "code-point-at@^1.0.0", - "_id": "code-point-at@1.1.0", - "_inBundle": false, - "_integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "_location": "/code-point-at", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "code-point-at@^1.0.0", - "name": "code-point-at", - "escapedName": "code-point-at", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/string-width" - ], - "_resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "_shasum": "0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77", - "_spec": "code-point-at@^1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/code-point-at/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "ES2015 `String#codePointAt()` ponyfill", - "devDependencies": { - "ava": "*", - "xo": "^0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/code-point-at#readme", - "keywords": [ - "es2015", - "ponyfill", - "polyfill", - "shim", - "string", - "str", - "code", - "point", - "at", - "codepoint", - "unicode" - ], - "license": "MIT", - "name": "code-point-at", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/code-point-at.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "1.1.0" -} diff --git a/node_modules/code-point-at/readme.md b/node_modules/code-point-at/readme.md deleted file mode 100644 index 4c97730..0000000 --- a/node_modules/code-point-at/readme.md +++ /dev/null @@ -1,32 +0,0 @@ -# code-point-at [![Build Status](https://travis-ci.org/sindresorhus/code-point-at.svg?branch=master)](https://travis-ci.org/sindresorhus/code-point-at) - -> ES2015 [`String#codePointAt()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) [ponyfill](https://ponyfill.com) - - -## Install - -``` -$ npm install --save code-point-at -``` - - -## Usage - -```js -var codePointAt = require('code-point-at'); - -codePointAt('🐴'); -//=> 128052 - -codePointAt('abc', 2); -//=> 99 -``` - -## API - -### codePointAt(input, [position]) - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/color-convert/CHANGELOG.md b/node_modules/color-convert/CHANGELOG.md deleted file mode 100644 index 0a7bce4..0000000 --- a/node_modules/color-convert/CHANGELOG.md +++ /dev/null @@ -1,54 +0,0 @@ -# 1.0.0 - 2016-01-07 - -- Removed: unused speed test -- Added: Automatic routing between previously unsupported conversions -([#27](https://github.com/Qix-/color-convert/pull/27)) -- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions -([#27](https://github.com/Qix-/color-convert/pull/27)) -- Removed: `convert()` class -([#27](https://github.com/Qix-/color-convert/pull/27)) -- Changed: all functions to lookup dictionary -([#27](https://github.com/Qix-/color-convert/pull/27)) -- Changed: `ansi` to `ansi256` -([#27](https://github.com/Qix-/color-convert/pull/27)) -- Fixed: argument grouping for functions requiring only one argument -([#27](https://github.com/Qix-/color-convert/pull/27)) - -# 0.6.0 - 2015-07-23 - -- Added: methods to handle -[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors: - - rgb2ansi16 - - rgb2ansi - - hsl2ansi16 - - hsl2ansi - - hsv2ansi16 - - hsv2ansi - - hwb2ansi16 - - hwb2ansi - - cmyk2ansi16 - - cmyk2ansi - - keyword2ansi16 - - keyword2ansi - - ansi162rgb - - ansi162hsl - - ansi162hsv - - ansi162hwb - - ansi162cmyk - - ansi162keyword - - ansi2rgb - - ansi2hsl - - ansi2hsv - - ansi2hwb - - ansi2cmyk - - ansi2keyword -([#18](https://github.com/harthur/color-convert/pull/18)) - -# 0.5.3 - 2015-06-02 - -- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]` -([#15](https://github.com/harthur/color-convert/issues/15)) - ---- - -Check out commit logs for older releases diff --git a/node_modules/color-convert/LICENSE b/node_modules/color-convert/LICENSE deleted file mode 100644 index 5b4c386..0000000 --- a/node_modules/color-convert/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2011-2016 Heather Arthur - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/node_modules/color-convert/README.md b/node_modules/color-convert/README.md deleted file mode 100644 index d4b08fc..0000000 --- a/node_modules/color-convert/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# color-convert - -[![Build Status](https://travis-ci.org/Qix-/color-convert.svg?branch=master)](https://travis-ci.org/Qix-/color-convert) - -Color-convert is a color conversion library for JavaScript and node. -It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest): - -```js -var convert = require('color-convert'); - -convert.rgb.hsl(140, 200, 100); // [96, 48, 59] -convert.keyword.rgb('blue'); // [0, 0, 255] - -var rgbChannels = convert.rgb.channels; // 3 -var cmykChannels = convert.cmyk.channels; // 4 -var ansiChannels = convert.ansi16.channels; // 1 -``` - -# Install - -```console -$ npm install color-convert -``` - -# API - -Simply get the property of the _from_ and _to_ conversion that you're looking for. - -All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function. - -All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha). - -```js -var convert = require('color-convert'); - -// Hex to LAB -convert.hex.lab('DEADBF'); // [ 76, 21, -2 ] -convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ] - -// RGB to CMYK -convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ] -convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ] -``` - -### Arrays -All functions that accept multiple arguments also support passing an array. - -Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.) - -```js -var convert = require('color-convert'); - -convert.rgb.hex(123, 45, 67); // '7B2D43' -convert.rgb.hex([123, 45, 67]); // '7B2D43' -``` - -## Routing - -Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex). - -Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js). - -# Contribute - -If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request. - -# License -Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE). diff --git a/node_modules/color-convert/conversions.js b/node_modules/color-convert/conversions.js deleted file mode 100644 index 2657f26..0000000 --- a/node_modules/color-convert/conversions.js +++ /dev/null @@ -1,839 +0,0 @@ -/* MIT license */ -/* eslint-disable no-mixed-operators */ -const cssKeywords = require('color-name'); - -// NOTE: conversions should only return primitive values (i.e. arrays, or -// values that give correct `typeof` results). -// do not use box values types (i.e. Number(), String(), etc.) - -const reverseKeywords = {}; -for (const key of Object.keys(cssKeywords)) { - reverseKeywords[cssKeywords[key]] = key; -} - -const convert = { - rgb: {channels: 3, labels: 'rgb'}, - hsl: {channels: 3, labels: 'hsl'}, - hsv: {channels: 3, labels: 'hsv'}, - hwb: {channels: 3, labels: 'hwb'}, - cmyk: {channels: 4, labels: 'cmyk'}, - xyz: {channels: 3, labels: 'xyz'}, - lab: {channels: 3, labels: 'lab'}, - lch: {channels: 3, labels: 'lch'}, - hex: {channels: 1, labels: ['hex']}, - keyword: {channels: 1, labels: ['keyword']}, - ansi16: {channels: 1, labels: ['ansi16']}, - ansi256: {channels: 1, labels: ['ansi256']}, - hcg: {channels: 3, labels: ['h', 'c', 'g']}, - apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, - gray: {channels: 1, labels: ['gray']} -}; - -module.exports = convert; - -// Hide .channels and .labels properties -for (const model of Object.keys(convert)) { - if (!('channels' in convert[model])) { - throw new Error('missing channels property: ' + model); - } - - if (!('labels' in convert[model])) { - throw new Error('missing channel labels property: ' + model); - } - - if (convert[model].labels.length !== convert[model].channels) { - throw new Error('channel and label counts mismatch: ' + model); - } - - const {channels, labels} = convert[model]; - delete convert[model].channels; - delete convert[model].labels; - Object.defineProperty(convert[model], 'channels', {value: channels}); - Object.defineProperty(convert[model], 'labels', {value: labels}); -} - -convert.rgb.hsl = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const min = Math.min(r, g, b); - const max = Math.max(r, g, b); - const delta = max - min; - let h; - let s; - - if (max === min) { - h = 0; - } else if (r === max) { - h = (g - b) / delta; - } else if (g === max) { - h = 2 + (b - r) / delta; - } else if (b === max) { - h = 4 + (r - g) / delta; - } - - h = Math.min(h * 60, 360); - - if (h < 0) { - h += 360; - } - - const l = (min + max) / 2; - - if (max === min) { - s = 0; - } else if (l <= 0.5) { - s = delta / (max + min); - } else { - s = delta / (2 - max - min); - } - - return [h, s * 100, l * 100]; -}; - -convert.rgb.hsv = function (rgb) { - let rdif; - let gdif; - let bdif; - let h; - let s; - - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const v = Math.max(r, g, b); - const diff = v - Math.min(r, g, b); - const diffc = function (c) { - return (v - c) / 6 / diff + 1 / 2; - }; - - if (diff === 0) { - h = 0; - s = 0; - } else { - s = diff / v; - rdif = diffc(r); - gdif = diffc(g); - bdif = diffc(b); - - if (r === v) { - h = bdif - gdif; - } else if (g === v) { - h = (1 / 3) + rdif - bdif; - } else if (b === v) { - h = (2 / 3) + gdif - rdif; - } - - if (h < 0) { - h += 1; - } else if (h > 1) { - h -= 1; - } - } - - return [ - h * 360, - s * 100, - v * 100 - ]; -}; - -convert.rgb.hwb = function (rgb) { - const r = rgb[0]; - const g = rgb[1]; - let b = rgb[2]; - const h = convert.rgb.hsl(rgb)[0]; - const w = 1 / 255 * Math.min(r, Math.min(g, b)); - - b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); - - return [h, w * 100, b * 100]; -}; - -convert.rgb.cmyk = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - - const k = Math.min(1 - r, 1 - g, 1 - b); - const c = (1 - r - k) / (1 - k) || 0; - const m = (1 - g - k) / (1 - k) || 0; - const y = (1 - b - k) / (1 - k) || 0; - - return [c * 100, m * 100, y * 100, k * 100]; -}; - -function comparativeDistance(x, y) { - /* - See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance - */ - return ( - ((x[0] - y[0]) ** 2) + - ((x[1] - y[1]) ** 2) + - ((x[2] - y[2]) ** 2) - ); -} - -convert.rgb.keyword = function (rgb) { - const reversed = reverseKeywords[rgb]; - if (reversed) { - return reversed; - } - - let currentClosestDistance = Infinity; - let currentClosestKeyword; - - for (const keyword of Object.keys(cssKeywords)) { - const value = cssKeywords[keyword]; - - // Compute comparative distance - const distance = comparativeDistance(rgb, value); - - // Check if its less, if so set as closest - if (distance < currentClosestDistance) { - currentClosestDistance = distance; - currentClosestKeyword = keyword; - } - } - - return currentClosestKeyword; -}; - -convert.keyword.rgb = function (keyword) { - return cssKeywords[keyword]; -}; - -convert.rgb.xyz = function (rgb) { - let r = rgb[0] / 255; - let g = rgb[1] / 255; - let b = rgb[2] / 255; - - // Assume sRGB - r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); - g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); - b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); - - const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); - - return [x * 100, y * 100, z * 100]; -}; - -convert.rgb.lab = function (rgb) { - const xyz = convert.rgb.xyz(rgb); - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); - - return [l, a, b]; -}; - -convert.hsl.rgb = function (hsl) { - const h = hsl[0] / 360; - const s = hsl[1] / 100; - const l = hsl[2] / 100; - let t2; - let t3; - let val; - - if (s === 0) { - val = l * 255; - return [val, val, val]; - } - - if (l < 0.5) { - t2 = l * (1 + s); - } else { - t2 = l + s - l * s; - } - - const t1 = 2 * l - t2; - - const rgb = [0, 0, 0]; - for (let i = 0; i < 3; i++) { - t3 = h + 1 / 3 * -(i - 1); - if (t3 < 0) { - t3++; - } - - if (t3 > 1) { - t3--; - } - - if (6 * t3 < 1) { - val = t1 + (t2 - t1) * 6 * t3; - } else if (2 * t3 < 1) { - val = t2; - } else if (3 * t3 < 2) { - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - } else { - val = t1; - } - - rgb[i] = val * 255; - } - - return rgb; -}; - -convert.hsl.hsv = function (hsl) { - const h = hsl[0]; - let s = hsl[1] / 100; - let l = hsl[2] / 100; - let smin = s; - const lmin = Math.max(l, 0.01); - - l *= 2; - s *= (l <= 1) ? l : 2 - l; - smin *= lmin <= 1 ? lmin : 2 - lmin; - const v = (l + s) / 2; - const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); - - return [h, sv * 100, v * 100]; -}; - -convert.hsv.rgb = function (hsv) { - const h = hsv[0] / 60; - const s = hsv[1] / 100; - let v = hsv[2] / 100; - const hi = Math.floor(h) % 6; - - const f = h - Math.floor(h); - const p = 255 * v * (1 - s); - const q = 255 * v * (1 - (s * f)); - const t = 255 * v * (1 - (s * (1 - f))); - v *= 255; - - switch (hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } -}; - -convert.hsv.hsl = function (hsv) { - const h = hsv[0]; - const s = hsv[1] / 100; - const v = hsv[2] / 100; - const vmin = Math.max(v, 0.01); - let sl; - let l; - - l = (2 - s) * v; - const lmin = (2 - s) * vmin; - sl = s * vmin; - sl /= (lmin <= 1) ? lmin : 2 - lmin; - sl = sl || 0; - l /= 2; - - return [h, sl * 100, l * 100]; -}; - -// http://dev.w3.org/csswg/css-color/#hwb-to-rgb -convert.hwb.rgb = function (hwb) { - const h = hwb[0] / 360; - let wh = hwb[1] / 100; - let bl = hwb[2] / 100; - const ratio = wh + bl; - let f; - - // Wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } - - const i = Math.floor(6 * h); - const v = 1 - bl; - f = 6 * h - i; - - if ((i & 0x01) !== 0) { - f = 1 - f; - } - - const n = wh + f * (v - wh); // Linear interpolation - - let r; - let g; - let b; - /* eslint-disable max-statements-per-line,no-multi-spaces */ - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - /* eslint-enable max-statements-per-line,no-multi-spaces */ - - return [r * 255, g * 255, b * 255]; -}; - -convert.cmyk.rgb = function (cmyk) { - const c = cmyk[0] / 100; - const m = cmyk[1] / 100; - const y = cmyk[2] / 100; - const k = cmyk[3] / 100; - - const r = 1 - Math.min(1, c * (1 - k) + k); - const g = 1 - Math.min(1, m * (1 - k) + k); - const b = 1 - Math.min(1, y * (1 - k) + k); - - return [r * 255, g * 255, b * 255]; -}; - -convert.xyz.rgb = function (xyz) { - const x = xyz[0] / 100; - const y = xyz[1] / 100; - const z = xyz[2] / 100; - let r; - let g; - let b; - - r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); - g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); - b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - - // Assume sRGB - r = r > 0.0031308 - ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) - : r * 12.92; - - g = g > 0.0031308 - ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) - : g * 12.92; - - b = b > 0.0031308 - ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) - : b * 12.92; - - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); - - return [r * 255, g * 255, b * 255]; -}; - -convert.xyz.lab = function (xyz) { - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); - - return [l, a, b]; -}; - -convert.lab.xyz = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let x; - let y; - let z; - - y = (l + 16) / 116; - x = a / 500 + y; - z = y - b / 200; - - const y2 = y ** 3; - const x2 = x ** 3; - const z2 = z ** 3; - y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; - x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; - z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; - - x *= 95.047; - y *= 100; - z *= 108.883; - - return [x, y, z]; -}; - -convert.lab.lch = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let h; - - const hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; - - if (h < 0) { - h += 360; - } - - const c = Math.sqrt(a * a + b * b); - - return [l, c, h]; -}; - -convert.lch.lab = function (lch) { - const l = lch[0]; - const c = lch[1]; - const h = lch[2]; - - const hr = h / 360 * 2 * Math.PI; - const a = c * Math.cos(hr); - const b = c * Math.sin(hr); - - return [l, a, b]; -}; - -convert.rgb.ansi16 = function (args, saturation = null) { - const [r, g, b] = args; - let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization - - value = Math.round(value / 50); - - if (value === 0) { - return 30; - } - - let ansi = 30 - + ((Math.round(b / 255) << 2) - | (Math.round(g / 255) << 1) - | Math.round(r / 255)); - - if (value === 2) { - ansi += 60; - } - - return ansi; -}; - -convert.hsv.ansi16 = function (args) { - // Optimization here; we already know the value and don't need to get - // it converted for us. - return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); -}; - -convert.rgb.ansi256 = function (args) { - const r = args[0]; - const g = args[1]; - const b = args[2]; - - // We use the extended greyscale palette here, with the exception of - // black and white. normal palette only has 4 greyscale shades. - if (r === g && g === b) { - if (r < 8) { - return 16; - } - - if (r > 248) { - return 231; - } - - return Math.round(((r - 8) / 247) * 24) + 232; - } - - const ansi = 16 - + (36 * Math.round(r / 255 * 5)) - + (6 * Math.round(g / 255 * 5)) - + Math.round(b / 255 * 5); - - return ansi; -}; - -convert.ansi16.rgb = function (args) { - let color = args % 10; - - // Handle greyscale - if (color === 0 || color === 7) { - if (args > 50) { - color += 3.5; - } - - color = color / 10.5 * 255; - - return [color, color, color]; - } - - const mult = (~~(args > 50) + 1) * 0.5; - const r = ((color & 1) * mult) * 255; - const g = (((color >> 1) & 1) * mult) * 255; - const b = (((color >> 2) & 1) * mult) * 255; - - return [r, g, b]; -}; - -convert.ansi256.rgb = function (args) { - // Handle greyscale - if (args >= 232) { - const c = (args - 232) * 10 + 8; - return [c, c, c]; - } - - args -= 16; - - let rem; - const r = Math.floor(args / 36) / 5 * 255; - const g = Math.floor((rem = args % 36) / 6) / 5 * 255; - const b = (rem % 6) / 5 * 255; - - return [r, g, b]; -}; - -convert.rgb.hex = function (args) { - const integer = ((Math.round(args[0]) & 0xFF) << 16) - + ((Math.round(args[1]) & 0xFF) << 8) - + (Math.round(args[2]) & 0xFF); - - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; - -convert.hex.rgb = function (args) { - const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); - if (!match) { - return [0, 0, 0]; - } - - let colorString = match[0]; - - if (match[0].length === 3) { - colorString = colorString.split('').map(char => { - return char + char; - }).join(''); - } - - const integer = parseInt(colorString, 16); - const r = (integer >> 16) & 0xFF; - const g = (integer >> 8) & 0xFF; - const b = integer & 0xFF; - - return [r, g, b]; -}; - -convert.rgb.hcg = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const max = Math.max(Math.max(r, g), b); - const min = Math.min(Math.min(r, g), b); - const chroma = (max - min); - let grayscale; - let hue; - - if (chroma < 1) { - grayscale = min / (1 - chroma); - } else { - grayscale = 0; - } - - if (chroma <= 0) { - hue = 0; - } else - if (max === r) { - hue = ((g - b) / chroma) % 6; - } else - if (max === g) { - hue = 2 + (b - r) / chroma; - } else { - hue = 4 + (r - g) / chroma; - } - - hue /= 6; - hue %= 1; - - return [hue * 360, chroma * 100, grayscale * 100]; -}; - -convert.hsl.hcg = function (hsl) { - const s = hsl[1] / 100; - const l = hsl[2] / 100; - - const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); - - let f = 0; - if (c < 1.0) { - f = (l - 0.5 * c) / (1.0 - c); - } - - return [hsl[0], c * 100, f * 100]; -}; - -convert.hsv.hcg = function (hsv) { - const s = hsv[1] / 100; - const v = hsv[2] / 100; - - const c = s * v; - let f = 0; - - if (c < 1.0) { - f = (v - c) / (1 - c); - } - - return [hsv[0], c * 100, f * 100]; -}; - -convert.hcg.rgb = function (hcg) { - const h = hcg[0] / 360; - const c = hcg[1] / 100; - const g = hcg[2] / 100; - - if (c === 0.0) { - return [g * 255, g * 255, g * 255]; - } - - const pure = [0, 0, 0]; - const hi = (h % 1) * 6; - const v = hi % 1; - const w = 1 - v; - let mg = 0; - - /* eslint-disable max-statements-per-line */ - switch (Math.floor(hi)) { - case 0: - pure[0] = 1; pure[1] = v; pure[2] = 0; break; - case 1: - pure[0] = w; pure[1] = 1; pure[2] = 0; break; - case 2: - pure[0] = 0; pure[1] = 1; pure[2] = v; break; - case 3: - pure[0] = 0; pure[1] = w; pure[2] = 1; break; - case 4: - pure[0] = v; pure[1] = 0; pure[2] = 1; break; - default: - pure[0] = 1; pure[1] = 0; pure[2] = w; - } - /* eslint-enable max-statements-per-line */ - - mg = (1.0 - c) * g; - - return [ - (c * pure[0] + mg) * 255, - (c * pure[1] + mg) * 255, - (c * pure[2] + mg) * 255 - ]; -}; - -convert.hcg.hsv = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - - const v = c + g * (1.0 - c); - let f = 0; - - if (v > 0.0) { - f = c / v; - } - - return [hcg[0], f * 100, v * 100]; -}; - -convert.hcg.hsl = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - - const l = g * (1.0 - c) + 0.5 * c; - let s = 0; - - if (l > 0.0 && l < 0.5) { - s = c / (2 * l); - } else - if (l >= 0.5 && l < 1.0) { - s = c / (2 * (1 - l)); - } - - return [hcg[0], s * 100, l * 100]; -}; - -convert.hcg.hwb = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - const v = c + g * (1.0 - c); - return [hcg[0], (v - c) * 100, (1 - v) * 100]; -}; - -convert.hwb.hcg = function (hwb) { - const w = hwb[1] / 100; - const b = hwb[2] / 100; - const v = 1 - b; - const c = v - w; - let g = 0; - - if (c < 1) { - g = (v - c) / (1 - c); - } - - return [hwb[0], c * 100, g * 100]; -}; - -convert.apple.rgb = function (apple) { - return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; -}; - -convert.rgb.apple = function (rgb) { - return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; -}; - -convert.gray.rgb = function (args) { - return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; -}; - -convert.gray.hsl = function (args) { - return [0, 0, args[0]]; -}; - -convert.gray.hsv = convert.gray.hsl; - -convert.gray.hwb = function (gray) { - return [0, 100, gray[0]]; -}; - -convert.gray.cmyk = function (gray) { - return [0, 0, 0, gray[0]]; -}; - -convert.gray.lab = function (gray) { - return [gray[0], 0, 0]; -}; - -convert.gray.hex = function (gray) { - const val = Math.round(gray[0] / 100 * 255) & 0xFF; - const integer = (val << 16) + (val << 8) + val; - - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; - -convert.rgb.gray = function (rgb) { - const val = (rgb[0] + rgb[1] + rgb[2]) / 3; - return [val / 255 * 100]; -}; diff --git a/node_modules/color-convert/index.js b/node_modules/color-convert/index.js deleted file mode 100644 index b648e57..0000000 --- a/node_modules/color-convert/index.js +++ /dev/null @@ -1,81 +0,0 @@ -const conversions = require('./conversions'); -const route = require('./route'); - -const convert = {}; - -const models = Object.keys(conversions); - -function wrapRaw(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; - if (arg0 === undefined || arg0 === null) { - return arg0; - } - - if (arg0.length > 1) { - args = arg0; - } - - return fn(args); - }; - - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } - - return wrappedFn; -} - -function wrapRounded(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; - - if (arg0 === undefined || arg0 === null) { - return arg0; - } - - if (arg0.length > 1) { - args = arg0; - } - - const result = fn(args); - - // We're assuming the result is an array here. - // see notice in conversions.js; don't use box types - // in conversion functions. - if (typeof result === 'object') { - for (let len = result.length, i = 0; i < len; i++) { - result[i] = Math.round(result[i]); - } - } - - return result; - }; - - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } - - return wrappedFn; -} - -models.forEach(fromModel => { - convert[fromModel] = {}; - - Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); - Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); - - const routes = route(fromModel); - const routeModels = Object.keys(routes); - - routeModels.forEach(toModel => { - const fn = routes[toModel]; - - convert[fromModel][toModel] = wrapRounded(fn); - convert[fromModel][toModel].raw = wrapRaw(fn); - }); -}); - -module.exports = convert; diff --git a/node_modules/color-convert/package.json b/node_modules/color-convert/package.json deleted file mode 100644 index 5996630..0000000 --- a/node_modules/color-convert/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "_from": "color-convert@^2.0.1", - "_id": "color-convert@2.0.1", - "_inBundle": false, - "_integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "_location": "/color-convert", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "color-convert@^2.0.1", - "name": "color-convert", - "escapedName": "color-convert", - "rawSpec": "^2.0.1", - "saveSpec": null, - "fetchSpec": "^2.0.1" - }, - "_requiredBy": [ - "/ansi-styles" - ], - "_resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "_shasum": "72d3a68d598c9bdb3af2ad1e84f21d896abd4de3", - "_spec": "color-convert@^2.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/ansi-styles", - "author": { - "name": "Heather Arthur", - "email": "fayearthur@gmail.com" - }, - "bugs": { - "url": "https://github.com/Qix-/color-convert/issues" - }, - "bundleDependencies": false, - "dependencies": { - "color-name": "~1.1.4" - }, - "deprecated": false, - "description": "Plain color conversion functions", - "devDependencies": { - "chalk": "^2.4.2", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=7.0.0" - }, - "files": [ - "index.js", - "conversions.js", - "route.js" - ], - "homepage": "https://github.com/Qix-/color-convert#readme", - "keywords": [ - "color", - "colour", - "convert", - "converter", - "conversion", - "rgb", - "hsl", - "hsv", - "hwb", - "cmyk", - "ansi", - "ansi16" - ], - "license": "MIT", - "name": "color-convert", - "repository": { - "type": "git", - "url": "git+https://github.com/Qix-/color-convert.git" - }, - "scripts": { - "pretest": "xo", - "test": "node test/basic.js" - }, - "version": "2.0.1", - "xo": { - "rules": { - "default-case": 0, - "no-inline-comments": 0, - "operator-linebreak": 0 - } - } -} diff --git a/node_modules/color-convert/route.js b/node_modules/color-convert/route.js deleted file mode 100644 index 1a08521..0000000 --- a/node_modules/color-convert/route.js +++ /dev/null @@ -1,97 +0,0 @@ -const conversions = require('./conversions'); - -/* - This function routes a model to all other models. - - all functions that are routed have a property `.conversion` attached - to the returned synthetic function. This property is an array - of strings, each with the steps in between the 'from' and 'to' - color models (inclusive). - - conversions that are not possible simply are not included. -*/ - -function buildGraph() { - const graph = {}; - // https://jsperf.com/object-keys-vs-for-in-with-closure/3 - const models = Object.keys(conversions); - - for (let len = models.length, i = 0; i < len; i++) { - graph[models[i]] = { - // http://jsperf.com/1-vs-infinity - // micro-opt, but this is simple. - distance: -1, - parent: null - }; - } - - return graph; -} - -// https://en.wikipedia.org/wiki/Breadth-first_search -function deriveBFS(fromModel) { - const graph = buildGraph(); - const queue = [fromModel]; // Unshift -> queue -> pop - - graph[fromModel].distance = 0; - - while (queue.length) { - const current = queue.pop(); - const adjacents = Object.keys(conversions[current]); - - for (let len = adjacents.length, i = 0; i < len; i++) { - const adjacent = adjacents[i]; - const node = graph[adjacent]; - - if (node.distance === -1) { - node.distance = graph[current].distance + 1; - node.parent = current; - queue.unshift(adjacent); - } - } - } - - return graph; -} - -function link(from, to) { - return function (args) { - return to(from(args)); - }; -} - -function wrapConversion(toModel, graph) { - const path = [graph[toModel].parent, toModel]; - let fn = conversions[graph[toModel].parent][toModel]; - - let cur = graph[toModel].parent; - while (graph[cur].parent) { - path.unshift(graph[cur].parent); - fn = link(conversions[graph[cur].parent][cur], fn); - cur = graph[cur].parent; - } - - fn.conversion = path; - return fn; -} - -module.exports = function (fromModel) { - const graph = deriveBFS(fromModel); - const conversion = {}; - - const models = Object.keys(graph); - for (let len = models.length, i = 0; i < len; i++) { - const toModel = models[i]; - const node = graph[toModel]; - - if (node.parent === null) { - // No possible conversion, or this node is the source model. - continue; - } - - conversion[toModel] = wrapConversion(toModel, graph); - } - - return conversion; -}; - diff --git a/node_modules/color-name/LICENSE b/node_modules/color-name/LICENSE deleted file mode 100644 index 4d9802a..0000000 --- a/node_modules/color-name/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2015 Dmitry Ivanov - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/color-name/README.md b/node_modules/color-name/README.md deleted file mode 100644 index 3611a6b..0000000 --- a/node_modules/color-name/README.md +++ /dev/null @@ -1,11 +0,0 @@ -A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. - -[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) - - -```js -var colors = require('color-name'); -colors.red //[255,0,0] -``` - - diff --git a/node_modules/color-name/index.js b/node_modules/color-name/index.js deleted file mode 100644 index e42aa68..0000000 --- a/node_modules/color-name/index.js +++ /dev/null @@ -1,152 +0,0 @@ -'use strict' - -module.exports = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] -}; diff --git a/node_modules/color-name/package.json b/node_modules/color-name/package.json deleted file mode 100644 index 1b14996..0000000 --- a/node_modules/color-name/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_from": "color-name@~1.1.4", - "_id": "color-name@1.1.4", - "_inBundle": false, - "_integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "_location": "/color-name", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "color-name@~1.1.4", - "name": "color-name", - "escapedName": "color-name", - "rawSpec": "~1.1.4", - "saveSpec": null, - "fetchSpec": "~1.1.4" - }, - "_requiredBy": [ - "/color-convert" - ], - "_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "_shasum": "c2a09a87acbde69543de6f63fa3995c826c536a2", - "_spec": "color-name@~1.1.4", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/color-convert", - "author": { - "name": "DY", - "email": "dfcreative@gmail.com" - }, - "bugs": { - "url": "https://github.com/colorjs/color-name/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A list of color names and its values", - "files": [ - "index.js" - ], - "homepage": "https://github.com/colorjs/color-name", - "keywords": [ - "color-name", - "color", - "color-keyword", - "keyword" - ], - "license": "MIT", - "main": "index.js", - "name": "color-name", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/colorjs/color-name.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "1.1.4" -} diff --git a/node_modules/commander/CHANGELOG.md b/node_modules/commander/CHANGELOG.md deleted file mode 100644 index 7dce779..0000000 --- a/node_modules/commander/CHANGELOG.md +++ /dev/null @@ -1,419 +0,0 @@ -2.20.3 / 2019-10-11 -================== - - * Support Node.js 0.10 (Revert #1059) - * Ran "npm unpublish commander@2.20.2". There is no 2.20.2. - -2.20.1 / 2019-09-29 -================== - - * Improve executable subcommand tracking - * Update dev dependencies - -2.20.0 / 2019-04-02 -================== - - * fix: resolve symbolic links completely when hunting for subcommands (#935) - * Update index.d.ts (#930) - * Update Readme.md (#924) - * Remove --save option as it isn't required anymore (#918) - * Add link to the license file (#900) - * Added example of receiving args from options (#858) - * Added missing semicolon (#882) - * Add extension to .eslintrc (#876) - -2.19.0 / 2018-10-02 -================== - - * Removed newline after Options and Commands headers (#864) - * Bugfix - Error output (#862) - * Fix to change default value to string (#856) - -2.18.0 / 2018-09-07 -================== - - * Standardize help output (#853) - * chmod 644 travis.yml (#851) - * add support for execute typescript subcommand via ts-node (#849) - -2.17.1 / 2018-08-07 -================== - - * Fix bug in command emit (#844) - -2.17.0 / 2018-08-03 -================== - - * fixed newline output after help information (#833) - * Fix to emit the action even without command (#778) - * npm update (#823) - -2.16.0 / 2018-06-29 -================== - - * Remove Makefile and `test/run` (#821) - * Make 'npm test' run on Windows (#820) - * Add badge to display install size (#807) - * chore: cache node_modules (#814) - * chore: remove Node.js 4 (EOL), add Node.js 10 (#813) - * fixed typo in readme (#812) - * Fix types (#804) - * Update eslint to resolve vulnerabilities in lodash (#799) - * updated readme with custom event listeners. (#791) - * fix tests (#794) - -2.15.0 / 2018-03-07 -================== - - * Update downloads badge to point to graph of downloads over time instead of duplicating link to npm - * Arguments description - -2.14.1 / 2018-02-07 -================== - - * Fix typing of help function - -2.14.0 / 2018-02-05 -================== - - * only register the option:version event once - * Fixes issue #727: Passing empty string for option on command is set to undefined - * enable eqeqeq rule - * resolves #754 add linter configuration to project - * resolves #560 respect custom name for version option - * document how to override the version flag - * document using options per command - -2.13.0 / 2018-01-09 -================== - - * Do not print default for --no- - * remove trailing spaces in command help - * Update CI's Node.js to LTS and latest version - * typedefs: Command and Option types added to commander namespace - -2.12.2 / 2017-11-28 -================== - - * fix: typings are not shipped - -2.12.1 / 2017-11-23 -================== - - * Move @types/node to dev dependency - -2.12.0 / 2017-11-22 -================== - - * add attributeName() method to Option objects - * Documentation updated for options with --no prefix - * typings: `outputHelp` takes a string as the first parameter - * typings: use overloads - * feat(typings): update to match js api - * Print default value in option help - * Fix translation error - * Fail when using same command and alias (#491) - * feat(typings): add help callback - * fix bug when description is add after command with options (#662) - * Format js code - * Rename History.md to CHANGELOG.md (#668) - * feat(typings): add typings to support TypeScript (#646) - * use current node - -2.11.0 / 2017-07-03 -================== - - * Fix help section order and padding (#652) - * feature: support for signals to subcommands (#632) - * Fixed #37, --help should not display first (#447) - * Fix translation errors. (#570) - * Add package-lock.json - * Remove engines - * Upgrade package version - * Prefix events to prevent conflicts between commands and options (#494) - * Removing dependency on graceful-readlink - * Support setting name in #name function and make it chainable - * Add .vscode directory to .gitignore (Visual Studio Code metadata) - * Updated link to ruby commander in readme files - -2.10.0 / 2017-06-19 -================== - - * Update .travis.yml. drop support for older node.js versions. - * Fix require arguments in README.md - * On SemVer you do not start from 0.0.1 - * Add missing semi colon in readme - * Add save param to npm install - * node v6 travis test - * Update Readme_zh-CN.md - * Allow literal '--' to be passed-through as an argument - * Test subcommand alias help - * link build badge to master branch - * Support the alias of Git style sub-command - * added keyword commander for better search result on npm - * Fix Sub-Subcommands - * test node.js stable - * Fixes TypeError when a command has an option called `--description` - * Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets. - * Add chinese Readme file - -2.9.0 / 2015-10-13 -================== - - * Add option `isDefault` to set default subcommand #415 @Qix- - * Add callback to allow filtering or post-processing of help text #434 @djulien - * Fix `undefined` text in help information close #414 #416 @zhiyelee - -2.8.1 / 2015-04-22 -================== - - * Back out `support multiline description` Close #396 #397 - -2.8.0 / 2015-04-07 -================== - - * Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee - * Fix bug in Git-style sub-commands #372 @zhiyelee - * Allow commands to be hidden from help #383 @tonylukasavage - * When git-style sub-commands are in use, yet none are called, display help #382 @claylo - * Add ability to specify arguments syntax for top-level command #258 @rrthomas - * Support multiline descriptions #208 @zxqfox - -2.7.1 / 2015-03-11 -================== - - * Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367. - -2.7.0 / 2015-03-09 -================== - - * Fix git-style bug when installed globally. Close #335 #349 @zhiyelee - * Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage - * Add support for camelCase on `opts()`. Close #353 @nkzawa - * Add node.js 0.12 and io.js to travis.yml - * Allow RegEx options. #337 @palanik - * Fixes exit code when sub-command failing. Close #260 #332 @pirelenito - * git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee - -2.6.0 / 2014-12-30 -================== - - * added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee - * Add application description to the help msg. Close #112 @dalssoft - -2.5.1 / 2014-12-15 -================== - - * fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee - -2.5.0 / 2014-10-24 -================== - - * add support for variadic arguments. Closes #277 @whitlockjc - -2.4.0 / 2014-10-17 -================== - - * fixed a bug on executing the coercion function of subcommands option. Closes #270 - * added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage - * added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage - * fixed a bug on subcommand name. Closes #248 @jonathandelgado - * fixed function normalize doesn’t honor option terminator. Closes #216 @abbr - -2.3.0 / 2014-07-16 -================== - - * add command alias'. Closes PR #210 - * fix: Typos. Closes #99 - * fix: Unused fs module. Closes #217 - -2.2.0 / 2014-03-29 -================== - - * add passing of previous option value - * fix: support subcommands on windows. Closes #142 - * Now the defaultValue passed as the second argument of the coercion function. - -2.1.0 / 2013-11-21 -================== - - * add: allow cflag style option params, unit test, fixes #174 - -2.0.0 / 2013-07-18 -================== - - * remove input methods (.prompt, .confirm, etc) - -1.3.2 / 2013-07-18 -================== - - * add support for sub-commands to co-exist with the original command - -1.3.1 / 2013-07-18 -================== - - * add quick .runningCommand hack so you can opt-out of other logic when running a sub command - -1.3.0 / 2013-07-09 -================== - - * add EACCES error handling - * fix sub-command --help - -1.2.0 / 2013-06-13 -================== - - * allow "-" hyphen as an option argument - * support for RegExp coercion - -1.1.1 / 2012-11-20 -================== - - * add more sub-command padding - * fix .usage() when args are present. Closes #106 - -1.1.0 / 2012-11-16 -================== - - * add git-style executable subcommand support. Closes #94 - -1.0.5 / 2012-10-09 -================== - - * fix `--name` clobbering. Closes #92 - * fix examples/help. Closes #89 - -1.0.4 / 2012-09-03 -================== - - * add `outputHelp()` method. - -1.0.3 / 2012-08-30 -================== - - * remove invalid .version() defaulting - -1.0.2 / 2012-08-24 -================== - - * add `--foo=bar` support [arv] - * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus] - -1.0.1 / 2012-08-03 -================== - - * fix issue #56 - * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode()) - -1.0.0 / 2012-07-05 -================== - - * add support for optional option descriptions - * add defaulting of `.version()` to package.json's version - -0.6.1 / 2012-06-01 -================== - - * Added: append (yes or no) on confirmation - * Added: allow node.js v0.7.x - -0.6.0 / 2012-04-10 -================== - - * Added `.prompt(obj, callback)` support. Closes #49 - * Added default support to .choose(). Closes #41 - * Fixed the choice example - -0.5.1 / 2011-12-20 -================== - - * Fixed `password()` for recent nodes. Closes #36 - -0.5.0 / 2011-12-04 -================== - - * Added sub-command option support [itay] - -0.4.3 / 2011-12-04 -================== - - * Fixed custom help ordering. Closes #32 - -0.4.2 / 2011-11-24 -================== - - * Added travis support - * Fixed: line-buffered input automatically trimmed. Closes #31 - -0.4.1 / 2011-11-18 -================== - - * Removed listening for "close" on --help - -0.4.0 / 2011-11-15 -================== - - * Added support for `--`. Closes #24 - -0.3.3 / 2011-11-14 -================== - - * Fixed: wait for close event when writing help info [Jerry Hamlet] - -0.3.2 / 2011-11-01 -================== - - * Fixed long flag definitions with values [felixge] - -0.3.1 / 2011-10-31 -================== - - * Changed `--version` short flag to `-V` from `-v` - * Changed `.version()` so it's configurable [felixge] - -0.3.0 / 2011-10-31 -================== - - * Added support for long flags only. Closes #18 - -0.2.1 / 2011-10-24 -================== - - * "node": ">= 0.4.x < 0.7.0". Closes #20 - -0.2.0 / 2011-09-26 -================== - - * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] - -0.1.0 / 2011-08-24 -================== - - * Added support for custom `--help` output - -0.0.5 / 2011-08-18 -================== - - * Changed: when the user enters nothing prompt for password again - * Fixed issue with passwords beginning with numbers [NuckChorris] - -0.0.4 / 2011-08-15 -================== - - * Fixed `Commander#args` - -0.0.3 / 2011-08-15 -================== - - * Added default option value support - -0.0.2 / 2011-08-15 -================== - - * Added mask support to `Command#password(str[, mask], fn)` - * Added `Command#password(str, fn)` - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/commander/LICENSE b/node_modules/commander/LICENSE deleted file mode 100644 index 10f997a..0000000 --- a/node_modules/commander/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/commander/Readme.md b/node_modules/commander/Readme.md deleted file mode 100644 index c846e7a..0000000 --- a/node_modules/commander/Readme.md +++ /dev/null @@ -1,428 +0,0 @@ -# Commander.js - - -[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js) -[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander) -[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true) -[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander) -[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - - The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander). - [API documentation](http://tj.github.com/commander.js/) - - -## Installation - - $ npm install commander - -## Option parsing - -Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.1.0') - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq-sauce', 'Add bbq sauce') - .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') - .parse(process.argv); - -console.log('you ordered a pizza with:'); -if (program.peppers) console.log(' - peppers'); -if (program.pineapple) console.log(' - pineapple'); -if (program.bbqSauce) console.log(' - bbq'); -console.log(' - %s cheese', program.cheese); -``` - -Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. - -Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .option('--no-sauce', 'Remove sauce') - .parse(process.argv); - -console.log('you ordered a pizza'); -if (program.sauce) console.log(' with sauce'); -else console.log(' without sauce'); -``` - -To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs. - -e.g. ```.option('-m --myarg [myVar]', 'my super cool description')``` - -Then to access the input if it was passed in. - -e.g. ```var myInput = program.myarg``` - -**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in. - - -## Version option - -Calling the `version` implicitly adds the `-V` and `--version` options to the command. -When either of these options is present, the command prints the version number and exits. - - $ ./examples/pizza -V - 0.0.1 - -If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method. - -```js -program - .version('0.0.1', '-v, --version') -``` - -The version flags can be named anything, but the long option is required. - -## Command-specific options - -You can attach options to a command. - -```js -#!/usr/bin/env node - -var program = require('commander'); - -program - .command('rm ') - .option('-r, --recursive', 'Remove recursively') - .action(function (dir, cmd) { - console.log('remove ' + dir + (cmd.recursive ? ' recursively' : '')) - }) - -program.parse(process.argv) -``` - -A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated. - -## Coercion - -```js -function range(val) { - return val.split('..').map(Number); -} - -function list(val) { - return val.split(','); -} - -function collect(val, memo) { - memo.push(val); - return memo; -} - -function increaseVerbosity(v, total) { - return total + 1; -} - -program - .version('0.1.0') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .option('-c, --collect [value]', 'A repeatable value', collect, []) - .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0) - .parse(process.argv); - -console.log(' int: %j', program.integer); -console.log(' float: %j', program.float); -console.log(' optional: %j', program.optional); -program.range = program.range || []; -console.log(' range: %j..%j', program.range[0], program.range[1]); -console.log(' list: %j', program.list); -console.log(' collect: %j', program.collect); -console.log(' verbosity: %j', program.verbose); -console.log(' args: %j', program.args); -``` - -## Regular Expression -```js -program - .version('0.1.0') - .option('-s --size ', 'Pizza size', /^(large|medium|small)$/i, 'medium') - .option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i) - .parse(process.argv); - -console.log(' size: %j', program.size); -console.log(' drink: %j', program.drink); -``` - -## Variadic arguments - - The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to - append `...` to the argument name. Here is an example: - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.1.0') - .command('rmdir [otherDirs...]') - .action(function (dir, otherDirs) { - console.log('rmdir %s', dir); - if (otherDirs) { - otherDirs.forEach(function (oDir) { - console.log('rmdir %s', oDir); - }); - } - }); - -program.parse(process.argv); -``` - - An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed - to your action as demonstrated above. - -## Specify the argument syntax - -```js -#!/usr/bin/env node - -var program = require('commander'); - -program - .version('0.1.0') - .arguments(' [env]') - .action(function (cmd, env) { - cmdValue = cmd; - envValue = env; - }); - -program.parse(process.argv); - -if (typeof cmdValue === 'undefined') { - console.error('no command given!'); - process.exit(1); -} -console.log('command:', cmdValue); -console.log('environment:', envValue || "no environment given"); -``` -Angled brackets (e.g. ``) indicate required input. Square brackets (e.g. `[env]`) indicate optional input. - -## Git-style sub-commands - -```js -// file: ./examples/pm -var program = require('commander'); - -program - .version('0.1.0') - .command('install [name]', 'install one or more packages') - .command('search [query]', 'search with optional query') - .command('list', 'list packages installed', {isDefault: true}) - .parse(process.argv); -``` - -When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools. -The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`. - -Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified. - -If the program is designed to be installed globally, make sure the executables have proper modes, like `755`. - -### `--harmony` - -You can enable `--harmony` option in two ways: -* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version don’t support this pattern. -* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process. - -## Automated --help - - The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: - -``` -$ ./examples/pizza --help -Usage: pizza [options] - -An application for pizzas ordering - -Options: - -h, --help output usage information - -V, --version output the version number - -p, --peppers Add peppers - -P, --pineapple Add pineapple - -b, --bbq Add bbq sauce - -c, --cheese Add the specified type of cheese [marble] - -C, --no-cheese You do not want any cheese -``` - -## Custom help - - You can display arbitrary `-h, --help` information - by listening for "--help". Commander will automatically - exit once you are done so that the remainder of your program - does not execute causing undesired behaviors, for example - in the following executable "stuff" will not output when - `--help` is used. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.1.0') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', function(){ - console.log('') - console.log('Examples:'); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); -}); - -program.parse(process.argv); - -console.log('stuff'); -``` - -Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run: - -``` -Usage: custom-help [options] - -Options: - -h, --help output usage information - -V, --version output the version number - -f, --foo enable some foo - -b, --bar enable some bar - -B, --baz enable some baz - -Examples: - $ custom-help --help - $ custom-help -h -``` - -## .outputHelp(cb) - -Output help information without exiting. -Optional callback cb allows post-processing of help text before it is displayed. - -If you want to display help by default (e.g. if no command was provided), you can use something like: - -```js -var program = require('commander'); -var colors = require('colors'); - -program - .version('0.1.0') - .command('getstream [url]', 'get stream URL') - .parse(process.argv); - -if (!process.argv.slice(2).length) { - program.outputHelp(make_red); -} - -function make_red(txt) { - return colors.red(txt); //display the help text in red on the console -} -``` - -## .help(cb) - - Output help information and exit immediately. - Optional callback cb allows post-processing of help text before it is displayed. - - -## Custom event listeners - You can execute custom actions by listening to command and option events. - -```js -program.on('option:verbose', function () { - process.env.VERBOSE = this.verbose; -}); - -// error on unknown commands -program.on('command:*', function () { - console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' ')); - process.exit(1); -}); -``` - -## Examples - -```js -var program = require('commander'); - -program - .version('0.1.0') - .option('-C, --chdir ', 'change the working directory') - .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - .option('-T, --no-tests', 'ignore test hook'); - -program - .command('setup [env]') - .description('run setup commands for all envs') - .option("-s, --setup_mode [mode]", "Which setup mode to use") - .action(function(env, options){ - var mode = options.setup_mode || "normal"; - env = env || 'all'; - console.log('setup for %s env(s) with %s mode', env, mode); - }); - -program - .command('exec ') - .alias('ex') - .description('execute the given remote cmd') - .option("-e, --exec_mode ", "Which exec mode to use") - .action(function(cmd, options){ - console.log('exec "%s" using %s mode', cmd, options.exec_mode); - }).on('--help', function() { - console.log(''); - console.log('Examples:'); - console.log(''); - console.log(' $ deploy exec sequential'); - console.log(' $ deploy exec async'); - }); - -program - .command('*') - .action(function(env){ - console.log('deploying "%s"', env); - }); - -program.parse(process.argv); -``` - -More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory. - -## License - -[MIT](https://github.com/tj/commander.js/blob/master/LICENSE) diff --git a/node_modules/commander/index.js b/node_modules/commander/index.js deleted file mode 100644 index ec1d61d..0000000 --- a/node_modules/commander/index.js +++ /dev/null @@ -1,1224 +0,0 @@ -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var spawn = require('child_process').spawn; -var path = require('path'); -var dirname = path.dirname; -var basename = path.basename; -var fs = require('fs'); - -/** - * Inherit `Command` from `EventEmitter.prototype`. - */ - -require('util').inherits(Command, EventEmitter); - -/** - * Expose the root command. - */ - -exports = module.exports = new Command(); - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = flags.indexOf('<') >= 0; - this.optional = flags.indexOf('[') >= 0; - this.bool = flags.indexOf('-no-') === -1; - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description || ''; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function() { - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Return option name, in a camelcase format that can be used - * as a object attribute key. - * - * @return {String} - * @api private - */ - -Option.prototype.attributeName = function() { - return camelcase(this.name()); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg) { - return this.short === arg || this.long === arg; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this._execs = {}; - this._allowUnknownOption = false; - this._args = []; - this._name = name || ''; -} - -/** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * Examples: - * - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {String} name - * @param {String} [desc] for git-style sub-commands - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name, desc, opts) { - if (typeof desc === 'object' && desc !== null) { - opts = desc; - desc = null; - } - opts = opts || {}; - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - - if (desc) { - cmd.description(desc); - this.executables = true; - this._execs[cmd._name] = true; - if (opts.isDefault) this.defaultExecutable = cmd._name; - } - cmd._noHelp = !!opts.noHelp; - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - - if (desc) return this; - return cmd; -}; - -/** - * Define argument syntax for the top-level command. - * - * @api public - */ - -Command.prototype.arguments = function(desc) { - return this.parseExpectedArgs(desc.split(/ +/)); -}; - -/** - * Add an implicit `help [cmd]` subcommand - * which invokes `--help` for the given command. - * - * @api private - */ - -Command.prototype.addImplicitHelpCommand = function() { - this.command('help [cmd]', 'display help for [cmd]'); -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args) { - if (!args.length) return; - var self = this; - args.forEach(function(arg) { - var argDetails = { - required: false, - name: '', - variadic: false - }; - - switch (arg[0]) { - case '<': - argDetails.required = true; - argDetails.name = arg.slice(1, -1); - break; - case '[': - argDetails.name = arg.slice(1, -1); - break; - } - - if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') { - argDetails.variadic = true; - argDetails.name = argDetails.name.slice(0, -3); - } - if (argDetails.name) { - self._args.push(argDetails); - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn) { - var self = this; - var listener = function(args, unknown) { - // Parse any so-far unknown options - args = args || []; - unknown = unknown || []; - - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - // Leftover arguments need to be pushed back. Fixes issue #56 - if (parsed.args.length) args = parsed.args.concat(args); - - self._args.forEach(function(arg, i) { - if (arg.required && args[i] == null) { - self.missingArgument(arg.name); - } else if (arg.variadic) { - if (i !== self._args.length - 1) { - self.variadicArgNotLast(arg.name); - } - - args[i] = args.splice(i); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self._args.length) { - args[self._args.length] = self; - } else { - args.push(self); - } - - fn.apply(self, args); - }; - var parent = this.parent || this; - var name = parent === this ? '*' : this._name; - parent.on('command:' + name, listener); - if (this._alias) parent.on('command:' + this._alias, listener); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|*} [fn] or default - * @param {*} [defaultValue] - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue) { - var self = this, - option = new Option(flags, description), - oname = option.name(), - name = option.attributeName(); - - // default as 3rd arg - if (typeof fn !== 'function') { - if (fn instanceof RegExp) { - var regex = fn; - fn = function(val, def) { - var m = regex.exec(val); - return m ? m[0] : def; - }; - } else { - defaultValue = fn; - fn = null; - } - } - - // preassign default value only for --no-*, [optional], or - if (!option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (!option.bool) defaultValue = true; - // preassign only if we have a default - if (defaultValue !== undefined) { - self[name] = defaultValue; - option.defaultValue = defaultValue; - } - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on('option:' + oname, function(val) { - // coercion - if (val !== null && fn) { - val = fn(val, self[name] === undefined ? defaultValue : self[name]); - } - - // unassigned or bool - if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') { - // if no value, bool true, and we have a default, then use it! - if (val == null) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (val !== null) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Allow unknown options on the command line. - * - * @param {Boolean} arg if `true` or omitted, no error will be thrown - * for unknown options. - * @api public - */ -Command.prototype.allowUnknownOption = function(arg) { - this._allowUnknownOption = arguments.length === 0 || arg; - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv) { - // implicit help - if (this.executables) this.addImplicitHelpCommand(); - - // store raw args - this.rawArgs = argv; - - // guess name - this._name = this._name || basename(argv[1], '.js'); - - // github-style sub-commands with no sub-command - if (this.executables && argv.length < 3 && !this.defaultExecutable) { - // this user needs help - argv.push('--help'); - } - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - var args = this.args = parsed.args; - - var result = this.parseArgs(this.args, parsed.unknown); - - // executable sub-commands - var name = result.args[0]; - - var aliasCommand = null; - // check alias of sub commands - if (name) { - aliasCommand = this.commands.filter(function(command) { - return command.alias() === name; - })[0]; - } - - if (this._execs[name] === true) { - return this.executeSubCommand(argv, args, parsed.unknown); - } else if (aliasCommand) { - // is alias of a subCommand - args[0] = aliasCommand._name; - return this.executeSubCommand(argv, args, parsed.unknown); - } else if (this.defaultExecutable) { - // use the default subcommand - args.unshift(this.defaultExecutable); - return this.executeSubCommand(argv, args, parsed.unknown); - } - - return result; -}; - -/** - * Execute a sub-command executable. - * - * @param {Array} argv - * @param {Array} args - * @param {Array} unknown - * @api private - */ - -Command.prototype.executeSubCommand = function(argv, args, unknown) { - args = args.concat(unknown); - - if (!args.length) this.help(); - if (args[0] === 'help' && args.length === 1) this.help(); - - // --help - if (args[0] === 'help') { - args[0] = args[1]; - args[1] = '--help'; - } - - // executable - var f = argv[1]; - // name of the subcommand, link `pm-install` - var bin = basename(f, path.extname(f)) + '-' + args[0]; - - // In case of globally installed, get the base dir where executable - // subcommand file should be located at - var baseDir; - - var resolvedLink = fs.realpathSync(f); - - baseDir = dirname(resolvedLink); - - // prefer local `./` to bin in the $PATH - var localBin = path.join(baseDir, bin); - - // whether bin file is a js script with explicit `.js` or `.ts` extension - var isExplicitJS = false; - if (exists(localBin + '.js')) { - bin = localBin + '.js'; - isExplicitJS = true; - } else if (exists(localBin + '.ts')) { - bin = localBin + '.ts'; - isExplicitJS = true; - } else if (exists(localBin)) { - bin = localBin; - } - - args = args.slice(1); - - var proc; - if (process.platform !== 'win32') { - if (isExplicitJS) { - args.unshift(bin); - // add executable arguments to spawn - args = (process.execArgv || []).concat(args); - - proc = spawn(process.argv[0], args, { stdio: 'inherit', customFds: [0, 1, 2] }); - } else { - proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] }); - } - } else { - args.unshift(bin); - proc = spawn(process.execPath, args, { stdio: 'inherit' }); - } - - var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP']; - signals.forEach(function(signal) { - process.on(signal, function() { - if (proc.killed === false && proc.exitCode === null) { - proc.kill(signal); - } - }); - }); - proc.on('close', process.exit.bind(process)); - proc.on('error', function(err) { - if (err.code === 'ENOENT') { - console.error('error: %s(1) does not exist, try --help', bin); - } else if (err.code === 'EACCES') { - console.error('error: %s(1) not executable. try chmod or run with root', bin); - } - process.exit(1); - }); - - // Store the reference to the child process - this.runningCommand = proc; -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * This also normalizes equal sign and splits "--abc=def" into "--abc def". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args) { - var ret = [], - arg, - lastOpt, - index; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (i > 0) { - lastOpt = this.optionFor(args[i - 1]); - } - - if (arg === '--') { - // Honor option terminator - ret = ret.concat(args.slice(i)); - break; - } else if (lastOpt && lastOpt.required) { - ret.push(arg); - } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') { - arg.slice(1).split('').forEach(function(c) { - ret.push('-' + c); - }); - } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { - ret.push(arg.slice(0, index), arg.slice(index + 1)); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown) { - var name; - - if (args.length) { - name = args[0]; - if (this.listeners('command:' + name).length) { - this.emit('command:' + args.shift(), args, unknown); - } else { - this.emit('command:*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - if (this.commands.length === 0 && - this._args.filter(function(a) { return a.required; }).length === 0) { - this.emit('command:*'); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg) { - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv) { - var args = [], - len = argv.length, - literal, - option, - arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if (literal) { - args.push(arg); - continue; - } - - if (arg === '--') { - literal = true; - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (arg == null) return this.optionMissingArgument(option); - this.emit('option:' + option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i + 1]; - if (arg == null || (arg[0] === '-' && arg !== '-')) { - arg = null; - } else { - ++i; - } - this.emit('option:' + option.name(), arg); - // bool - } else { - this.emit('option:' + option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && arg[0] === '-') { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if ((i + 1) < argv.length && argv[i + 1][0] !== '-') { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Return an object containing options as key-value pairs - * - * @return {Object} - * @api public - */ -Command.prototype.opts = function() { - var result = {}, - len = this.options.length; - - for (var i = 0; i < len; i++) { - var key = this.options[i].attributeName(); - result[key] = key === this._versionOptionName ? this._version : this[key]; - } - return result; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name) { - console.error("error: missing required argument `%s'", name); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag) { - if (flag) { - console.error("error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error("error: option `%s' argument missing", option.flags); - } - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag) { - if (this._allowUnknownOption) return; - console.error("error: unknown option `%s'", flag); - process.exit(1); -}; - -/** - * Variadic argument with `name` is not the last argument as required. - * - * @param {String} name - * @api private - */ - -Command.prototype.variadicArgNotLast = function(name) { - console.error("error: variadic arguments must be last `%s'", name); - process.exit(1); -}; - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {String} str - * @param {String} [flags] - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags) { - if (arguments.length === 0) return this._version; - this._version = str; - flags = flags || '-V, --version'; - var versionOption = new Option(flags, 'output the version number'); - this._versionOptionName = versionOption.long.substr(2) || 'version'; - this.options.push(versionOption); - this.on('option:' + this._versionOptionName, function() { - process.stdout.write(str + '\n'); - process.exit(0); - }); - return this; -}; - -/** - * Set the description to `str`. - * - * @param {String} str - * @param {Object} argsDescription - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str, argsDescription) { - if (arguments.length === 0) return this._description; - this._description = str; - this._argsDescription = argsDescription; - return this; -}; - -/** - * Set an alias for the command - * - * @param {String} alias - * @return {String|Command} - * @api public - */ - -Command.prototype.alias = function(alias) { - var command = this; - if (this.commands.length !== 0) { - command = this.commands[this.commands.length - 1]; - } - - if (arguments.length === 0) return command._alias; - - if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); - - command._alias = alias; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str) { - var args = this._args.map(function(arg) { - return humanReadableArgName(arg); - }); - - var usage = '[options]' + - (this.commands.length ? ' [command]' : '') + - (this._args.length ? ' ' + args.join(' ') : ''); - - if (arguments.length === 0) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Get or set the name of the command - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.name = function(str) { - if (arguments.length === 0) return this._name; - this._name = str; - return this; -}; - -/** - * Return prepared commands. - * - * @return {Array} - * @api private - */ - -Command.prototype.prepareCommands = function() { - return this.commands.filter(function(cmd) { - return !cmd._noHelp; - }).map(function(cmd) { - var args = cmd._args.map(function(arg) { - return humanReadableArgName(arg); - }).join(' '); - - return [ - cmd._name + - (cmd._alias ? '|' + cmd._alias : '') + - (cmd.options.length ? ' [options]' : '') + - (args ? ' ' + args : ''), - cmd._description - ]; - }); -}; - -/** - * Return the largest command length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestCommandLength = function() { - var commands = this.prepareCommands(); - return commands.reduce(function(max, command) { - return Math.max(max, command[0].length); - }, 0); -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function() { - var options = [].slice.call(this.options); - options.push({ - flags: '-h, --help' - }); - return options.reduce(function(max, option) { - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return the largest arg length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestArgLength = function() { - return this._args.reduce(function(max, arg) { - return Math.max(max, arg.name.length); - }, 0); -}; - -/** - * Return the pad width. - * - * @return {Number} - * @api private - */ - -Command.prototype.padWidth = function() { - var width = this.largestOptionLength(); - if (this._argsDescription && this._args.length) { - if (this.largestArgLength() > width) { - width = this.largestArgLength(); - } - } - - if (this.commands && this.commands.length) { - if (this.largestCommandLength() > width) { - width = this.largestCommandLength(); - } - } - - return width; -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function() { - var width = this.padWidth(); - - // Append the help information - return this.options.map(function(option) { - return pad(option.flags, width) + ' ' + option.description + - ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : ''); - }).concat([pad('-h, --help', width) + ' ' + 'output usage information']) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function() { - if (!this.commands.length) return ''; - - var commands = this.prepareCommands(); - var width = this.padWidth(); - - return [ - 'Commands:', - commands.map(function(cmd) { - var desc = cmd[1] ? ' ' + cmd[1] : ''; - return (desc ? pad(cmd[0], width) : cmd[0]) + desc; - }).join('\n').replace(/^/gm, ' '), - '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function() { - var desc = []; - if (this._description) { - desc = [ - this._description, - '' - ]; - - var argsDescription = this._argsDescription; - if (argsDescription && this._args.length) { - var width = this.padWidth(); - desc.push('Arguments:'); - desc.push(''); - this._args.forEach(function(arg) { - desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]); - }); - desc.push(''); - } - } - - var cmdName = this._name; - if (this._alias) { - cmdName = cmdName + '|' + this._alias; - } - var usage = [ - 'Usage: ' + cmdName + ' ' + this.usage(), - '' - ]; - - var cmds = []; - var commandHelp = this.commandHelp(); - if (commandHelp) cmds = [commandHelp]; - - var options = [ - 'Options:', - '' + this.optionHelp().replace(/^/gm, ' '), - '' - ]; - - return usage - .concat(desc) - .concat(options) - .concat(cmds) - .join('\n'); -}; - -/** - * Output help information for this command - * - * @api public - */ - -Command.prototype.outputHelp = function(cb) { - if (!cb) { - cb = function(passthru) { - return passthru; - }; - } - process.stdout.write(cb(this.helpInformation())); - this.emit('--help'); -}; - -/** - * Output help information and exit. - * - * @api public - */ - -Command.prototype.help = function(cb) { - this.outputHelp(cb); - process.exit(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word) { - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] === '--help' || options[i] === '-h') { - cmd.outputHelp(); - process.exit(0); - } - } -} - -/** - * Takes an argument an returns its human readable equivalent for help usage. - * - * @param {Object} arg - * @return {String} - * @api private - */ - -function humanReadableArgName(arg) { - var nameOutput = arg.name + (arg.variadic === true ? '...' : ''); - - return arg.required - ? '<' + nameOutput + '>' - : '[' + nameOutput + ']'; -} - -// for versions before node v0.8 when there weren't `fs.existsSync` -function exists(file) { - try { - if (fs.statSync(file).isFile()) { - return true; - } - } catch (e) { - return false; - } -} diff --git a/node_modules/commander/package.json b/node_modules/commander/package.json deleted file mode 100644 index 7c62fda..0000000 --- a/node_modules/commander/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "_from": "commander@2", - "_id": "commander@2.20.3", - "_inBundle": false, - "_integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "_location": "/commander", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "commander@2", - "name": "commander", - "escapedName": "commander", - "rawSpec": "2", - "saveSpec": null, - "fetchSpec": "2" - }, - "_requiredBy": [ - "/d3-dsv", - "/d3-geo-projection", - "/topojson-client" - ], - "_resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "_shasum": "fd485e84c03eb4881c20722ba48035e8531aeb33", - "_spec": "commander@2", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/d3-dsv", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "bugs": { - "url": "https://github.com/tj/commander.js/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "the complete solution for node.js command-line programs", - "devDependencies": { - "@types/node": "^12.7.8", - "eslint": "^6.4.0", - "should": "^13.2.3", - "sinon": "^7.5.0", - "standard": "^14.3.1", - "ts-node": "^8.4.1", - "typescript": "^3.6.3" - }, - "files": [ - "index.js", - "typings/index.d.ts" - ], - "homepage": "https://github.com/tj/commander.js#readme", - "keywords": [ - "commander", - "command", - "option", - "parser" - ], - "license": "MIT", - "main": "index", - "name": "commander", - "repository": { - "type": "git", - "url": "git+https://github.com/tj/commander.js.git" - }, - "scripts": { - "lint": "eslint index.js", - "test": "node test/run.js && npm run test-typings", - "test-typings": "tsc -p tsconfig.json" - }, - "typings": "typings/index.d.ts", - "version": "2.20.3" -} diff --git a/node_modules/commander/typings/index.d.ts b/node_modules/commander/typings/index.d.ts deleted file mode 100644 index bcda277..0000000 --- a/node_modules/commander/typings/index.d.ts +++ /dev/null @@ -1,310 +0,0 @@ -// Type definitions for commander 2.11 -// Project: https://github.com/visionmedia/commander.js -// Definitions by: Alan Agius , Marcelo Dezem , vvakame , Jules Randolph -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace local { - - class Option { - flags: string; - required: boolean; - optional: boolean; - bool: boolean; - short?: string; - long: string; - description: string; - - /** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {string} flags - * @param {string} [description] - */ - constructor(flags: string, description?: string); - } - - class Command extends NodeJS.EventEmitter { - [key: string]: any; - - args: string[]; - - /** - * Initialize a new `Command`. - * - * @param {string} [name] - */ - constructor(name?: string); - - /** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {string} str - * @param {string} [flags] - * @returns {Command} for chaining - */ - version(str: string, flags?: string): Command; - - /** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * @example - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {string} name - * @param {string} [desc] for git-style sub-commands - * @param {CommandOptions} [opts] command options - * @returns {Command} the new command - */ - command(name: string, desc?: string, opts?: commander.CommandOptions): Command; - - /** - * Define argument syntax for the top-level command. - * - * @param {string} desc - * @returns {Command} for chaining - */ - arguments(desc: string): Command; - - /** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {string[]} args - * @returns {Command} for chaining - */ - parseExpectedArgs(args: string[]): Command; - - /** - * Register callback `fn` for the command. - * - * @example - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {(...args: any[]) => void} fn - * @returns {Command} for chaining - */ - action(fn: (...args: any[]) => void): Command; - - /** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * @example - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {string} flags - * @param {string} [description] - * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default - * @param {*} [defaultValue] - * @returns {Command} for chaining - */ - option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; - option(flags: string, description?: string, defaultValue?: any): Command; - - /** - * Allow unknown options on the command line. - * - * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. - * @returns {Command} for chaining - */ - allowUnknownOption(arg?: boolean): Command; - - /** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {string[]} argv - * @returns {Command} for chaining - */ - parse(argv: string[]): Command; - - /** - * Parse options from `argv` returning `argv` void of these options. - * - * @param {string[]} argv - * @returns {ParseOptionsResult} - */ - parseOptions(argv: string[]): commander.ParseOptionsResult; - - /** - * Return an object containing options as key-value pairs - * - * @returns {{[key: string]: any}} - */ - opts(): { [key: string]: any }; - - /** - * Set the description to `str`. - * - * @param {string} str - * @param {{[argName: string]: string}} argsDescription - * @return {(Command | string)} - */ - description(str: string, argsDescription?: {[argName: string]: string}): Command; - description(): string; - - /** - * Set an alias for the command. - * - * @param {string} alias - * @return {(Command | string)} - */ - alias(alias: string): Command; - alias(): string; - - /** - * Set or get the command usage. - * - * @param {string} str - * @return {(Command | string)} - */ - usage(str: string): Command; - usage(): string; - - /** - * Set the name of the command. - * - * @param {string} str - * @return {Command} - */ - name(str: string): Command; - - /** - * Get the name of the command. - * - * @return {string} - */ - name(): string; - - /** - * Output help information for this command. - * - * @param {(str: string) => string} [cb] - */ - outputHelp(cb?: (str: string) => string): void; - - /** Output help information and exit. - * - * @param {(str: string) => string} [cb] - */ - help(cb?: (str: string) => string): never; - } - -} - -declare namespace commander { - - type Command = local.Command - - type Option = local.Option - - interface CommandOptions { - noHelp?: boolean; - isDefault?: boolean; - } - - interface ParseOptionsResult { - args: string[]; - unknown: string[]; - } - - interface CommanderStatic extends Command { - Command: typeof local.Command; - Option: typeof local.Option; - CommandOptions: CommandOptions; - ParseOptionsResult: ParseOptionsResult; - } - -} - -declare const commander: commander.CommanderStatic; -export = commander; diff --git a/node_modules/concat-map/.travis.yml b/node_modules/concat-map/.travis.yml deleted file mode 100644 index f1d0f13..0000000 --- a/node_modules/concat-map/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/node_modules/concat-map/LICENSE b/node_modules/concat-map/LICENSE deleted file mode 100644 index ee27ba4..0000000 --- a/node_modules/concat-map/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/concat-map/README.markdown b/node_modules/concat-map/README.markdown deleted file mode 100644 index 408f70a..0000000 --- a/node_modules/concat-map/README.markdown +++ /dev/null @@ -1,62 +0,0 @@ -concat-map -========== - -Concatenative mapdashery. - -[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) - -[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) - -example -======= - -``` js -var concatMap = require('concat-map'); -var xs = [ 1, 2, 3, 4, 5, 6 ]; -var ys = concatMap(xs, function (x) { - return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; -}); -console.dir(ys); -``` - -*** - -``` -[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] -``` - -methods -======= - -``` js -var concatMap = require('concat-map') -``` - -concatMap(xs, fn) ------------------ - -Return an array of concatenated elements by calling `fn(x, i)` for each element -`x` and each index `i` in the array `xs`. - -When `fn(x, i)` returns an array, its result will be concatenated with the -result array. If `fn(x, i)` returns anything else, that value will be pushed -onto the end of the result array. - -install -======= - -With [npm](http://npmjs.org) do: - -``` -npm install concat-map -``` - -license -======= - -MIT - -notes -===== - -This module was written while sitting high above the ground in a tree. diff --git a/node_modules/concat-map/example/map.js b/node_modules/concat-map/example/map.js deleted file mode 100644 index 3365621..0000000 --- a/node_modules/concat-map/example/map.js +++ /dev/null @@ -1,6 +0,0 @@ -var concatMap = require('../'); -var xs = [ 1, 2, 3, 4, 5, 6 ]; -var ys = concatMap(xs, function (x) { - return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; -}); -console.dir(ys); diff --git a/node_modules/concat-map/index.js b/node_modules/concat-map/index.js deleted file mode 100644 index b29a781..0000000 --- a/node_modules/concat-map/index.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function (xs, fn) { - var res = []; - for (var i = 0; i < xs.length; i++) { - var x = fn(xs[i], i); - if (isArray(x)) res.push.apply(res, x); - else res.push(x); - } - return res; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; diff --git a/node_modules/concat-map/package.json b/node_modules/concat-map/package.json deleted file mode 100644 index 2a224a8..0000000 --- a/node_modules/concat-map/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_from": "concat-map@0.0.1", - "_id": "concat-map@0.0.1", - "_inBundle": false, - "_integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "_location": "/concat-map", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "concat-map@0.0.1", - "name": "concat-map", - "escapedName": "concat-map", - "rawSpec": "0.0.1", - "saveSpec": null, - "fetchSpec": "0.0.1" - }, - "_requiredBy": [ - "/brace-expansion" - ], - "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", - "_spec": "concat-map@0.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/brace-expansion", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "bugs": { - "url": "https://github.com/substack/node-concat-map/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "concatenative mapdashery", - "devDependencies": { - "tape": "~2.4.0" - }, - "directories": { - "example": "example", - "test": "test" - }, - "homepage": "https://github.com/substack/node-concat-map#readme", - "keywords": [ - "concat", - "concatMap", - "map", - "functional", - "higher-order" - ], - "license": "MIT", - "main": "index.js", - "name": "concat-map", - "repository": { - "type": "git", - "url": "git://github.com/substack/node-concat-map.git" - }, - "scripts": { - "test": "tape test/*.js" - }, - "testling": { - "files": "test/*.js", - "browsers": { - "ie": [ - 6, - 7, - 8, - 9 - ], - "ff": [ - 3.5, - 10, - 15 - ], - "chrome": [ - 10, - 22 - ], - "safari": [ - 5.1 - ], - "opera": [ - 12 - ] - } - }, - "version": "0.0.1" -} diff --git a/node_modules/concat-map/test/map.js b/node_modules/concat-map/test/map.js deleted file mode 100644 index fdbd702..0000000 --- a/node_modules/concat-map/test/map.js +++ /dev/null @@ -1,39 +0,0 @@ -var concatMap = require('../'); -var test = require('tape'); - -test('empty or not', function (t) { - var xs = [ 1, 2, 3, 4, 5, 6 ]; - var ixes = []; - var ys = concatMap(xs, function (x, ix) { - ixes.push(ix); - return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; - }); - t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); - t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); - t.end(); -}); - -test('always something', function (t) { - var xs = [ 'a', 'b', 'c', 'd' ]; - var ys = concatMap(xs, function (x) { - return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; - }); - t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); - t.end(); -}); - -test('scalars', function (t) { - var xs = [ 'a', 'b', 'c', 'd' ]; - var ys = concatMap(xs, function (x) { - return x === 'b' ? [ 'B', 'B', 'B' ] : x; - }); - t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); - t.end(); -}); - -test('undefs', function (t) { - var xs = [ 'a', 'b', 'c', 'd' ]; - var ys = concatMap(xs, function () {}); - t.same(ys, [ undefined, undefined, undefined, undefined ]); - t.end(); -}); diff --git a/node_modules/console-control-strings/LICENSE b/node_modules/console-control-strings/LICENSE deleted file mode 100644 index e756052..0000000 --- a/node_modules/console-control-strings/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2014, Rebecca Turner - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/console-control-strings/README.md b/node_modules/console-control-strings/README.md deleted file mode 100644 index f58cc8d..0000000 --- a/node_modules/console-control-strings/README.md +++ /dev/null @@ -1,145 +0,0 @@ -# Console Control Strings - -A library of cross-platform tested terminal/console command strings for -doing things like color and cursor positioning. This is a subset of both -ansi and vt100. All control codes included work on both Windows & Unix-like -OSes, except where noted. - -## Usage - -```js -var consoleControl = require('console-control-strings') - -console.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset')) -process.stdout.write(consoleControl.goto(75, 10)) -``` - -## Why Another? - -There are tons of libraries similar to this one. I wanted one that was: - -1. Very clear about compatibility goals. -2. Could emit, for instance, a start color code without an end one. -3. Returned strings w/o writing to streams. -4. Was not weighed down with other unrelated baggage. - -## Functions - -### var code = consoleControl.up(_num = 1_) - -Returns the escape sequence to move _num_ lines up. - -### var code = consoleControl.down(_num = 1_) - -Returns the escape sequence to move _num_ lines down. - -### var code = consoleControl.forward(_num = 1_) - -Returns the escape sequence to move _num_ lines righ. - -### var code = consoleControl.back(_num = 1_) - -Returns the escape sequence to move _num_ lines left. - -### var code = consoleControl.nextLine(_num = 1_) - -Returns the escape sequence to move _num_ lines down and to the beginning of -the line. - -### var code = consoleControl.previousLine(_num = 1_) - -Returns the escape sequence to move _num_ lines up and to the beginning of -the line. - -### var code = consoleControl.eraseData() - -Returns the escape sequence to erase everything from the current cursor -position to the bottom right of the screen. This is line based, so it -erases the remainder of the current line and all following lines. - -### var code = consoleControl.eraseLine() - -Returns the escape sequence to erase to the end of the current line. - -### var code = consoleControl.goto(_x_, _y_) - -Returns the escape sequence to move the cursor to the designated position. -Note that the origin is _1, 1_ not _0, 0_. - -### var code = consoleControl.gotoSOL() - -Returns the escape sequence to move the cursor to the beginning of the -current line. (That is, it returns a carriage return, `\r`.) - -### var code = consoleControl.beep() - -Returns the escape sequence to cause the termianl to beep. (That is, it -returns unicode character `\x0007`, a Control-G.) - -### var code = consoleControl.hideCursor() - -Returns the escape sequence to hide the cursor. - -### var code = consoleControl.showCursor() - -Returns the escape sequence to show the cursor. - -### var code = consoleControl.color(_colors = []_) - -### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_) - -Returns the escape sequence to set the current terminal display attributes -(mostly colors). Arguments can either be a list of attributes or an array -of attributes. The difference between passing in an array or list of colors -and calling `.color` separately for each one, is that in the former case a -single escape sequence will be produced where as in the latter each change -will have its own distinct escape sequence. Each attribute can be one of: - -* Reset: - * **reset** – Reset all attributes to the terminal default. -* Styles: - * **bold** – Display text as bold. In some terminals this means using a - bold font, in others this means changing the color. In some it means - both. - * **italic** – Display text as italic. This is not available in most Windows terminals. - * **underline** – Underline text. This is not available in most Windows Terminals. - * **inverse** – Invert the foreground and background colors. - * **stopBold** – Do not display text as bold. - * **stopItalic** – Do not display text as italic. - * **stopUnderline** – Do not underline text. - * **stopInverse** – Do not invert foreground and background. -* Colors: - * **white** - * **black** - * **blue** - * **cyan** - * **green** - * **magenta** - * **red** - * **yellow** - * **grey** / **brightBlack** - * **brightRed** - * **brightGreen** - * **brightYellow** - * **brightBlue** - * **brightMagenta** - * **brightCyan** - * **brightWhite** -* Background Colors: - * **bgWhite** - * **bgBlack** - * **bgBlue** - * **bgCyan** - * **bgGreen** - * **bgMagenta** - * **bgRed** - * **bgYellow** - * **bgGrey** / **bgBrightBlack** - * **bgBrightRed** - * **bgBrightGreen** - * **bgBrightYellow** - * **bgBrightBlue** - * **bgBrightMagenta** - * **bgBrightCyan** - * **bgBrightWhite** - diff --git a/node_modules/console-control-strings/README.md~ b/node_modules/console-control-strings/README.md~ deleted file mode 100644 index 6eb34e8..0000000 --- a/node_modules/console-control-strings/README.md~ +++ /dev/null @@ -1,140 +0,0 @@ -# Console Control Strings - -A library of cross-platform tested terminal/console command strings for -doing things like color and cursor positioning. This is a subset of both -ansi and vt100. All control codes included work on both Windows & Unix-like -OSes, except where noted. - -## Usage - -```js -var consoleControl = require('console-control-strings') - -console.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset')) -process.stdout.write(consoleControl.goto(75, 10)) -``` - -## Why Another? - -There are tons of libraries similar to this one. I wanted one that was: - -1. Very clear about compatibility goals. -2. Could emit, for instance, a start color code without an end one. -3. Returned strings w/o writing to streams. -4. Was not weighed down with other unrelated baggage. - -## Functions - -### var code = consoleControl.up(_num = 1_) - -Returns the escape sequence to move _num_ lines up. - -### var code = consoleControl.down(_num = 1_) - -Returns the escape sequence to move _num_ lines down. - -### var code = consoleControl.forward(_num = 1_) - -Returns the escape sequence to move _num_ lines righ. - -### var code = consoleControl.back(_num = 1_) - -Returns the escape sequence to move _num_ lines left. - -### var code = consoleControl.nextLine(_num = 1_) - -Returns the escape sequence to move _num_ lines down and to the beginning of -the line. - -### var code = consoleControl.previousLine(_num = 1_) - -Returns the escape sequence to move _num_ lines up and to the beginning of -the line. - -### var code = consoleControl.eraseData() - -Returns the escape sequence to erase everything from the current cursor -position to the bottom right of the screen. This is line based, so it -erases the remainder of the current line and all following lines. - -### var code = consoleControl.eraseLine() - -Returns the escape sequence to erase to the end of the current line. - -### var code = consoleControl.goto(_x_, _y_) - -Returns the escape sequence to move the cursor to the designated position. -Note that the origin is _1, 1_ not _0, 0_. - -### var code = consoleControl.gotoSOL() - -Returns the escape sequence to move the cursor to the beginning of the -current line. (That is, it returns a carriage return, `\r`.) - -### var code = consoleControl.hideCursor() - -Returns the escape sequence to hide the cursor. - -### var code = consoleControl.showCursor() - -Returns the escape sequence to show the cursor. - -### var code = consoleControl.color(_colors = []_) - -### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_) - -Returns the escape sequence to set the current terminal display attributes -(mostly colors). Arguments can either be a list of attributes or an array -of attributes. The difference between passing in an array or list of colors -and calling `.color` separately for each one, is that in the former case a -single escape sequence will be produced where as in the latter each change -will have its own distinct escape sequence. Each attribute can be one of: - -* Reset: - * **reset** – Reset all attributes to the terminal default. -* Styles: - * **bold** – Display text as bold. In some terminals this means using a - bold font, in others this means changing the color. In some it means - both. - * **italic** – Display text as italic. This is not available in most Windows terminals. - * **underline** – Underline text. This is not available in most Windows Terminals. - * **inverse** – Invert the foreground and background colors. - * **stopBold** – Do not display text as bold. - * **stopItalic** – Do not display text as italic. - * **stopUnderline** – Do not underline text. - * **stopInverse** – Do not invert foreground and background. -* Colors: - * **white** - * **black** - * **blue** - * **cyan** - * **green** - * **magenta** - * **red** - * **yellow** - * **grey** / **brightBlack** - * **brightRed** - * **brightGreen** - * **brightYellow** - * **brightBlue** - * **brightMagenta** - * **brightCyan** - * **brightWhite** -* Background Colors: - * **bgWhite** - * **bgBlack** - * **bgBlue** - * **bgCyan** - * **bgGreen** - * **bgMagenta** - * **bgRed** - * **bgYellow** - * **bgGrey** / **bgBrightBlack** - * **bgBrightRed** - * **bgBrightGreen** - * **bgBrightYellow** - * **bgBrightBlue** - * **bgBrightMagenta** - * **bgBrightCyan** - * **bgBrightWhite** - diff --git a/node_modules/console-control-strings/index.js b/node_modules/console-control-strings/index.js deleted file mode 100644 index bf89034..0000000 --- a/node_modules/console-control-strings/index.js +++ /dev/null @@ -1,125 +0,0 @@ -'use strict' - -// These tables borrowed from `ansi` - -var prefix = '\x1b[' - -exports.up = function up (num) { - return prefix + (num || '') + 'A' -} - -exports.down = function down (num) { - return prefix + (num || '') + 'B' -} - -exports.forward = function forward (num) { - return prefix + (num || '') + 'C' -} - -exports.back = function back (num) { - return prefix + (num || '') + 'D' -} - -exports.nextLine = function nextLine (num) { - return prefix + (num || '') + 'E' -} - -exports.previousLine = function previousLine (num) { - return prefix + (num || '') + 'F' -} - -exports.horizontalAbsolute = function horizontalAbsolute (num) { - if (num == null) throw new Error('horizontalAboslute requires a column to position to') - return prefix + num + 'G' -} - -exports.eraseData = function eraseData () { - return prefix + 'J' -} - -exports.eraseLine = function eraseLine () { - return prefix + 'K' -} - -exports.goto = function (x, y) { - return prefix + y + ';' + x + 'H' -} - -exports.gotoSOL = function () { - return '\r' -} - -exports.beep = function () { - return '\x07' -} - -exports.hideCursor = function hideCursor () { - return prefix + '?25l' -} - -exports.showCursor = function showCursor () { - return prefix + '?25h' -} - -var colors = { - reset: 0, -// styles - bold: 1, - italic: 3, - underline: 4, - inverse: 7, -// resets - stopBold: 22, - stopItalic: 23, - stopUnderline: 24, - stopInverse: 27, -// colors - white: 37, - black: 30, - blue: 34, - cyan: 36, - green: 32, - magenta: 35, - red: 31, - yellow: 33, - bgWhite: 47, - bgBlack: 40, - bgBlue: 44, - bgCyan: 46, - bgGreen: 42, - bgMagenta: 45, - bgRed: 41, - bgYellow: 43, - - grey: 90, - brightBlack: 90, - brightRed: 91, - brightGreen: 92, - brightYellow: 93, - brightBlue: 94, - brightMagenta: 95, - brightCyan: 96, - brightWhite: 97, - - bgGrey: 100, - bgBrightBlack: 100, - bgBrightRed: 101, - bgBrightGreen: 102, - bgBrightYellow: 103, - bgBrightBlue: 104, - bgBrightMagenta: 105, - bgBrightCyan: 106, - bgBrightWhite: 107 -} - -exports.color = function color (colorWith) { - if (arguments.length !== 1 || !Array.isArray(colorWith)) { - colorWith = Array.prototype.slice.call(arguments) - } - return prefix + colorWith.map(colorNameToCode).join(';') + 'm' -} - -function colorNameToCode (color) { - if (colors[color] != null) return colors[color] - throw new Error('Unknown color or style name: ' + color) -} diff --git a/node_modules/console-control-strings/package.json b/node_modules/console-control-strings/package.json deleted file mode 100644 index 679ffbe..0000000 --- a/node_modules/console-control-strings/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "_from": "console-control-strings@~1.1.0", - "_id": "console-control-strings@1.1.0", - "_inBundle": false, - "_integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "_location": "/console-control-strings", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "console-control-strings@~1.1.0", - "name": "console-control-strings", - "escapedName": "console-control-strings", - "rawSpec": "~1.1.0", - "saveSpec": null, - "fetchSpec": "~1.1.0" - }, - "_requiredBy": [ - "/gauge", - "/npmlog" - ], - "_resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "_shasum": "3d7cf4464db6446ea644bf4b39507f9851008e8e", - "_spec": "console-control-strings@~1.1.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/npmlog", - "author": { - "name": "Rebecca Turner", - "email": "me@re-becca.org", - "url": "http://re-becca.org/" - }, - "bugs": { - "url": "https://github.com/iarna/console-control-strings/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A library of cross-platform tested terminal/console command strings for doing things like color and cursor positioning. This is a subset of both ansi and vt100. All control codes included work on both Windows & Unix-like OSes, except where noted.", - "devDependencies": { - "standard": "^7.1.2", - "tap": "^5.7.2" - }, - "directories": { - "test": "test" - }, - "files": [ - "LICENSE", - "index.js" - ], - "homepage": "https://github.com/iarna/console-control-strings#readme", - "keywords": [], - "license": "ISC", - "main": "index.js", - "name": "console-control-strings", - "repository": { - "type": "git", - "url": "git+https://github.com/iarna/console-control-strings.git" - }, - "scripts": { - "test": "standard && tap test/*.js" - }, - "version": "1.1.0" -} diff --git a/node_modules/core-util-is/LICENSE b/node_modules/core-util-is/LICENSE deleted file mode 100644 index d8d7f94..0000000 --- a/node_modules/core-util-is/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright Node.js contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. diff --git a/node_modules/core-util-is/README.md b/node_modules/core-util-is/README.md deleted file mode 100644 index 5a76b41..0000000 --- a/node_modules/core-util-is/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# core-util-is - -The `util.is*` functions introduced in Node v0.12. diff --git a/node_modules/core-util-is/float.patch b/node_modules/core-util-is/float.patch deleted file mode 100644 index a06d5c0..0000000 --- a/node_modules/core-util-is/float.patch +++ /dev/null @@ -1,604 +0,0 @@ -diff --git a/lib/util.js b/lib/util.js -index a03e874..9074e8e 100644 ---- a/lib/util.js -+++ b/lib/util.js -@@ -19,430 +19,6 @@ - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - --var formatRegExp = /%[sdj%]/g; --exports.format = function(f) { -- if (!isString(f)) { -- var objects = []; -- for (var i = 0; i < arguments.length; i++) { -- objects.push(inspect(arguments[i])); -- } -- return objects.join(' '); -- } -- -- var i = 1; -- var args = arguments; -- var len = args.length; -- var str = String(f).replace(formatRegExp, function(x) { -- if (x === '%%') return '%'; -- if (i >= len) return x; -- switch (x) { -- case '%s': return String(args[i++]); -- case '%d': return Number(args[i++]); -- case '%j': -- try { -- return JSON.stringify(args[i++]); -- } catch (_) { -- return '[Circular]'; -- } -- default: -- return x; -- } -- }); -- for (var x = args[i]; i < len; x = args[++i]) { -- if (isNull(x) || !isObject(x)) { -- str += ' ' + x; -- } else { -- str += ' ' + inspect(x); -- } -- } -- return str; --}; -- -- --// Mark that a method should not be used. --// Returns a modified function which warns once by default. --// If --no-deprecation is set, then it is a no-op. --exports.deprecate = function(fn, msg) { -- // Allow for deprecating things in the process of starting up. -- if (isUndefined(global.process)) { -- return function() { -- return exports.deprecate(fn, msg).apply(this, arguments); -- }; -- } -- -- if (process.noDeprecation === true) { -- return fn; -- } -- -- var warned = false; -- function deprecated() { -- if (!warned) { -- if (process.throwDeprecation) { -- throw new Error(msg); -- } else if (process.traceDeprecation) { -- console.trace(msg); -- } else { -- console.error(msg); -- } -- warned = true; -- } -- return fn.apply(this, arguments); -- } -- -- return deprecated; --}; -- -- --var debugs = {}; --var debugEnviron; --exports.debuglog = function(set) { -- if (isUndefined(debugEnviron)) -- debugEnviron = process.env.NODE_DEBUG || ''; -- set = set.toUpperCase(); -- if (!debugs[set]) { -- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { -- var pid = process.pid; -- debugs[set] = function() { -- var msg = exports.format.apply(exports, arguments); -- console.error('%s %d: %s', set, pid, msg); -- }; -- } else { -- debugs[set] = function() {}; -- } -- } -- return debugs[set]; --}; -- -- --/** -- * Echos the value of a value. Trys to print the value out -- * in the best way possible given the different types. -- * -- * @param {Object} obj The object to print out. -- * @param {Object} opts Optional options object that alters the output. -- */ --/* legacy: obj, showHidden, depth, colors*/ --function inspect(obj, opts) { -- // default options -- var ctx = { -- seen: [], -- stylize: stylizeNoColor -- }; -- // legacy... -- if (arguments.length >= 3) ctx.depth = arguments[2]; -- if (arguments.length >= 4) ctx.colors = arguments[3]; -- if (isBoolean(opts)) { -- // legacy... -- ctx.showHidden = opts; -- } else if (opts) { -- // got an "options" object -- exports._extend(ctx, opts); -- } -- // set default options -- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; -- if (isUndefined(ctx.depth)) ctx.depth = 2; -- if (isUndefined(ctx.colors)) ctx.colors = false; -- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; -- if (ctx.colors) ctx.stylize = stylizeWithColor; -- return formatValue(ctx, obj, ctx.depth); --} --exports.inspect = inspect; -- -- --// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics --inspect.colors = { -- 'bold' : [1, 22], -- 'italic' : [3, 23], -- 'underline' : [4, 24], -- 'inverse' : [7, 27], -- 'white' : [37, 39], -- 'grey' : [90, 39], -- 'black' : [30, 39], -- 'blue' : [34, 39], -- 'cyan' : [36, 39], -- 'green' : [32, 39], -- 'magenta' : [35, 39], -- 'red' : [31, 39], -- 'yellow' : [33, 39] --}; -- --// Don't use 'blue' not visible on cmd.exe --inspect.styles = { -- 'special': 'cyan', -- 'number': 'yellow', -- 'boolean': 'yellow', -- 'undefined': 'grey', -- 'null': 'bold', -- 'string': 'green', -- 'date': 'magenta', -- // "name": intentionally not styling -- 'regexp': 'red' --}; -- -- --function stylizeWithColor(str, styleType) { -- var style = inspect.styles[styleType]; -- -- if (style) { -- return '\u001b[' + inspect.colors[style][0] + 'm' + str + -- '\u001b[' + inspect.colors[style][1] + 'm'; -- } else { -- return str; -- } --} -- -- --function stylizeNoColor(str, styleType) { -- return str; --} -- -- --function arrayToHash(array) { -- var hash = {}; -- -- array.forEach(function(val, idx) { -- hash[val] = true; -- }); -- -- return hash; --} -- -- --function formatValue(ctx, value, recurseTimes) { -- // Provide a hook for user-specified inspect functions. -- // Check that value is an object with an inspect function on it -- if (ctx.customInspect && -- value && -- isFunction(value.inspect) && -- // Filter out the util module, it's inspect function is special -- value.inspect !== exports.inspect && -- // Also filter out any prototype objects using the circular check. -- !(value.constructor && value.constructor.prototype === value)) { -- var ret = value.inspect(recurseTimes, ctx); -- if (!isString(ret)) { -- ret = formatValue(ctx, ret, recurseTimes); -- } -- return ret; -- } -- -- // Primitive types cannot have properties -- var primitive = formatPrimitive(ctx, value); -- if (primitive) { -- return primitive; -- } -- -- // Look up the keys of the object. -- var keys = Object.keys(value); -- var visibleKeys = arrayToHash(keys); -- -- if (ctx.showHidden) { -- keys = Object.getOwnPropertyNames(value); -- } -- -- // Some type of object without properties can be shortcutted. -- if (keys.length === 0) { -- if (isFunction(value)) { -- var name = value.name ? ': ' + value.name : ''; -- return ctx.stylize('[Function' + name + ']', 'special'); -- } -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } -- if (isDate(value)) { -- return ctx.stylize(Date.prototype.toString.call(value), 'date'); -- } -- if (isError(value)) { -- return formatError(value); -- } -- } -- -- var base = '', array = false, braces = ['{', '}']; -- -- // Make Array say that they are Array -- if (isArray(value)) { -- array = true; -- braces = ['[', ']']; -- } -- -- // Make functions say that they are functions -- if (isFunction(value)) { -- var n = value.name ? ': ' + value.name : ''; -- base = ' [Function' + n + ']'; -- } -- -- // Make RegExps say that they are RegExps -- if (isRegExp(value)) { -- base = ' ' + RegExp.prototype.toString.call(value); -- } -- -- // Make dates with properties first say the date -- if (isDate(value)) { -- base = ' ' + Date.prototype.toUTCString.call(value); -- } -- -- // Make error with message first say the error -- if (isError(value)) { -- base = ' ' + formatError(value); -- } -- -- if (keys.length === 0 && (!array || value.length == 0)) { -- return braces[0] + base + braces[1]; -- } -- -- if (recurseTimes < 0) { -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } else { -- return ctx.stylize('[Object]', 'special'); -- } -- } -- -- ctx.seen.push(value); -- -- var output; -- if (array) { -- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); -- } else { -- output = keys.map(function(key) { -- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); -- }); -- } -- -- ctx.seen.pop(); -- -- return reduceToSingleString(output, base, braces); --} -- -- --function formatPrimitive(ctx, value) { -- if (isUndefined(value)) -- return ctx.stylize('undefined', 'undefined'); -- if (isString(value)) { -- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') -- .replace(/'/g, "\\'") -- .replace(/\\"/g, '"') + '\''; -- return ctx.stylize(simple, 'string'); -- } -- if (isNumber(value)) { -- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, -- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . -- if (value === 0 && 1 / value < 0) -- return ctx.stylize('-0', 'number'); -- return ctx.stylize('' + value, 'number'); -- } -- if (isBoolean(value)) -- return ctx.stylize('' + value, 'boolean'); -- // For some reason typeof null is "object", so special case here. -- if (isNull(value)) -- return ctx.stylize('null', 'null'); --} -- -- --function formatError(value) { -- return '[' + Error.prototype.toString.call(value) + ']'; --} -- -- --function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { -- var output = []; -- for (var i = 0, l = value.length; i < l; ++i) { -- if (hasOwnProperty(value, String(i))) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- String(i), true)); -- } else { -- output.push(''); -- } -- } -- keys.forEach(function(key) { -- if (!key.match(/^\d+$/)) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- key, true)); -- } -- }); -- return output; --} -- -- --function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { -- var name, str, desc; -- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; -- if (desc.get) { -- if (desc.set) { -- str = ctx.stylize('[Getter/Setter]', 'special'); -- } else { -- str = ctx.stylize('[Getter]', 'special'); -- } -- } else { -- if (desc.set) { -- str = ctx.stylize('[Setter]', 'special'); -- } -- } -- if (!hasOwnProperty(visibleKeys, key)) { -- name = '[' + key + ']'; -- } -- if (!str) { -- if (ctx.seen.indexOf(desc.value) < 0) { -- if (isNull(recurseTimes)) { -- str = formatValue(ctx, desc.value, null); -- } else { -- str = formatValue(ctx, desc.value, recurseTimes - 1); -- } -- if (str.indexOf('\n') > -1) { -- if (array) { -- str = str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n').substr(2); -- } else { -- str = '\n' + str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n'); -- } -- } -- } else { -- str = ctx.stylize('[Circular]', 'special'); -- } -- } -- if (isUndefined(name)) { -- if (array && key.match(/^\d+$/)) { -- return str; -- } -- name = JSON.stringify('' + key); -- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { -- name = name.substr(1, name.length - 2); -- name = ctx.stylize(name, 'name'); -- } else { -- name = name.replace(/'/g, "\\'") -- .replace(/\\"/g, '"') -- .replace(/(^"|"$)/g, "'"); -- name = ctx.stylize(name, 'string'); -- } -- } -- -- return name + ': ' + str; --} -- -- --function reduceToSingleString(output, base, braces) { -- var numLinesEst = 0; -- var length = output.reduce(function(prev, cur) { -- numLinesEst++; -- if (cur.indexOf('\n') >= 0) numLinesEst++; -- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; -- }, 0); -- -- if (length > 60) { -- return braces[0] + -- (base === '' ? '' : base + '\n ') + -- ' ' + -- output.join(',\n ') + -- ' ' + -- braces[1]; -- } -- -- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; --} -- -- - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(ar) { -@@ -522,166 +98,10 @@ function isPrimitive(arg) { - exports.isPrimitive = isPrimitive; - - function isBuffer(arg) { -- return arg instanceof Buffer; -+ return Buffer.isBuffer(arg); - } - exports.isBuffer = isBuffer; - - function objectToString(o) { - return Object.prototype.toString.call(o); --} -- -- --function pad(n) { -- return n < 10 ? '0' + n.toString(10) : n.toString(10); --} -- -- --var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', -- 'Oct', 'Nov', 'Dec']; -- --// 26 Feb 16:19:34 --function timestamp() { -- var d = new Date(); -- var time = [pad(d.getHours()), -- pad(d.getMinutes()), -- pad(d.getSeconds())].join(':'); -- return [d.getDate(), months[d.getMonth()], time].join(' '); --} -- -- --// log is just a thin wrapper to console.log that prepends a timestamp --exports.log = function() { -- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); --}; -- -- --/** -- * Inherit the prototype methods from one constructor into another. -- * -- * The Function.prototype.inherits from lang.js rewritten as a standalone -- * function (not on Function.prototype). NOTE: If this file is to be loaded -- * during bootstrapping this function needs to be rewritten using some native -- * functions as prototype setup using normal JavaScript does not work as -- * expected during bootstrapping (see mirror.js in r114903). -- * -- * @param {function} ctor Constructor function which needs to inherit the -- * prototype. -- * @param {function} superCtor Constructor function to inherit prototype from. -- */ --exports.inherits = function(ctor, superCtor) { -- ctor.super_ = superCtor; -- ctor.prototype = Object.create(superCtor.prototype, { -- constructor: { -- value: ctor, -- enumerable: false, -- writable: true, -- configurable: true -- } -- }); --}; -- --exports._extend = function(origin, add) { -- // Don't do anything if add isn't an object -- if (!add || !isObject(add)) return origin; -- -- var keys = Object.keys(add); -- var i = keys.length; -- while (i--) { -- origin[keys[i]] = add[keys[i]]; -- } -- return origin; --}; -- --function hasOwnProperty(obj, prop) { -- return Object.prototype.hasOwnProperty.call(obj, prop); --} -- -- --// Deprecated old stuff. -- --exports.p = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- console.error(exports.inspect(arguments[i])); -- } --}, 'util.p: Use console.error() instead'); -- -- --exports.exec = exports.deprecate(function() { -- return require('child_process').exec.apply(this, arguments); --}, 'util.exec is now called `child_process.exec`.'); -- -- --exports.print = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(String(arguments[i])); -- } --}, 'util.print: Use console.log instead'); -- -- --exports.puts = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(arguments[i] + '\n'); -- } --}, 'util.puts: Use console.log instead'); -- -- --exports.debug = exports.deprecate(function(x) { -- process.stderr.write('DEBUG: ' + x + '\n'); --}, 'util.debug: Use console.error instead'); -- -- --exports.error = exports.deprecate(function(x) { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stderr.write(arguments[i] + '\n'); -- } --}, 'util.error: Use console.error instead'); -- -- --exports.pump = exports.deprecate(function(readStream, writeStream, callback) { -- var callbackCalled = false; -- -- function call(a, b, c) { -- if (callback && !callbackCalled) { -- callback(a, b, c); -- callbackCalled = true; -- } -- } -- -- readStream.addListener('data', function(chunk) { -- if (writeStream.write(chunk) === false) readStream.pause(); -- }); -- -- writeStream.addListener('drain', function() { -- readStream.resume(); -- }); -- -- readStream.addListener('end', function() { -- writeStream.end(); -- }); -- -- readStream.addListener('close', function() { -- call(); -- }); -- -- readStream.addListener('error', function(err) { -- writeStream.end(); -- call(err); -- }); -- -- writeStream.addListener('error', function(err) { -- readStream.destroy(); -- call(err); -- }); --}, 'util.pump(): Use readableStream.pipe() instead'); -- -- --var uv; --exports._errnoException = function(err, syscall) { -- if (isUndefined(uv)) uv = process.binding('uv'); -- var errname = uv.errname(err); -- var e = new Error(syscall + ' ' + errname); -- e.code = errname; -- e.errno = errname; -- e.syscall = syscall; -- return e; --}; -+} \ No newline at end of file diff --git a/node_modules/core-util-is/lib/util.js b/node_modules/core-util-is/lib/util.js deleted file mode 100644 index ff4c851..0000000 --- a/node_modules/core-util-is/lib/util.js +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. - -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} diff --git a/node_modules/core-util-is/package.json b/node_modules/core-util-is/package.json deleted file mode 100644 index 513e9fa..0000000 --- a/node_modules/core-util-is/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "core-util-is@~1.0.0", - "_id": "core-util-is@1.0.2", - "_inBundle": false, - "_integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "_location": "/core-util-is", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "core-util-is@~1.0.0", - "name": "core-util-is", - "escapedName": "core-util-is", - "rawSpec": "~1.0.0", - "saveSpec": null, - "fetchSpec": "~1.0.0" - }, - "_requiredBy": [ - "/readable-stream" - ], - "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7", - "_spec": "core-util-is@~1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/readable-stream", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/core-util-is/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "The `util.is*` functions introduced in Node v0.12.", - "devDependencies": { - "tap": "^2.3.0" - }, - "homepage": "https://github.com/isaacs/core-util-is#readme", - "keywords": [ - "util", - "isBuffer", - "isArray", - "isNumber", - "isString", - "isRegExp", - "isThis", - "isThat", - "polyfill" - ], - "license": "MIT", - "main": "lib/util.js", - "name": "core-util-is", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/core-util-is.git" - }, - "scripts": { - "test": "tap test.js" - }, - "version": "1.0.2" -} diff --git a/node_modules/core-util-is/test.js b/node_modules/core-util-is/test.js deleted file mode 100644 index 1a490c6..0000000 --- a/node_modules/core-util-is/test.js +++ /dev/null @@ -1,68 +0,0 @@ -var assert = require('tap'); - -var t = require('./lib/util'); - -assert.equal(t.isArray([]), true); -assert.equal(t.isArray({}), false); - -assert.equal(t.isBoolean(null), false); -assert.equal(t.isBoolean(true), true); -assert.equal(t.isBoolean(false), true); - -assert.equal(t.isNull(null), true); -assert.equal(t.isNull(undefined), false); -assert.equal(t.isNull(false), false); -assert.equal(t.isNull(), false); - -assert.equal(t.isNullOrUndefined(null), true); -assert.equal(t.isNullOrUndefined(undefined), true); -assert.equal(t.isNullOrUndefined(false), false); -assert.equal(t.isNullOrUndefined(), true); - -assert.equal(t.isNumber(null), false); -assert.equal(t.isNumber('1'), false); -assert.equal(t.isNumber(1), true); - -assert.equal(t.isString(null), false); -assert.equal(t.isString('1'), true); -assert.equal(t.isString(1), false); - -assert.equal(t.isSymbol(null), false); -assert.equal(t.isSymbol('1'), false); -assert.equal(t.isSymbol(1), false); -assert.equal(t.isSymbol(Symbol()), true); - -assert.equal(t.isUndefined(null), false); -assert.equal(t.isUndefined(undefined), true); -assert.equal(t.isUndefined(false), false); -assert.equal(t.isUndefined(), true); - -assert.equal(t.isRegExp(null), false); -assert.equal(t.isRegExp('1'), false); -assert.equal(t.isRegExp(new RegExp()), true); - -assert.equal(t.isObject({}), true); -assert.equal(t.isObject([]), true); -assert.equal(t.isObject(new RegExp()), true); -assert.equal(t.isObject(new Date()), true); - -assert.equal(t.isDate(null), false); -assert.equal(t.isDate('1'), false); -assert.equal(t.isDate(new Date()), true); - -assert.equal(t.isError(null), false); -assert.equal(t.isError({ err: true }), false); -assert.equal(t.isError(new Error()), true); - -assert.equal(t.isFunction(null), false); -assert.equal(t.isFunction({ }), false); -assert.equal(t.isFunction(function() {}), true); - -assert.equal(t.isPrimitive(null), true); -assert.equal(t.isPrimitive(''), true); -assert.equal(t.isPrimitive(0), true); -assert.equal(t.isPrimitive(new Date()), false); - -assert.equal(t.isBuffer(null), false); -assert.equal(t.isBuffer({}), false); -assert.equal(t.isBuffer(new Buffer(0)), true); diff --git a/node_modules/d3-array/LICENSE b/node_modules/d3-array/LICENSE deleted file mode 100644 index b1b2223..0000000 --- a/node_modules/d3-array/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2018 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-array/README.md b/node_modules/d3-array/README.md deleted file mode 100644 index 2d89fb9..0000000 --- a/node_modules/d3-array/README.md +++ /dev/null @@ -1,607 +0,0 @@ -# d3-array - -Data in JavaScript is often represented by an iterable (such as an [array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array), [set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set) or [generator](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Generator)), and so iterable manipulation is a common task when analyzing or visualizing data. For example, you might take a contiguous slice (subset) of an array, filter an array using a predicate function, or map an array to a parallel set of values using a transform function. Before looking at the methods that d3-array provides, familiarize yourself with the powerful [array methods built-in to JavaScript](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype). - -JavaScript includes **mutation methods** that modify the array: - -* [*array*.pop](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) - Remove the last element from the array. -* [*array*.push](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/push) - Add one or more elements to the end of the array. -* [*array*.reverse](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) - Reverse the order of the elements of the array. -* [*array*.shift](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) - Remove the first element from the array. -* [*array*.sort](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) - Sort the elements of the array. -* [*array*.splice](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) - Add or remove elements from the array. -* [*array*.unshift](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) - Add one or more elements to the front of the array. - -There are also **access methods** that return some representation of the array: - -* [*array*.concat](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) - Join the array with other array(s) or value(s). -* [*array*.join](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/join) - Join all elements of the array into a string. -* [*array*.slice](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) - Extract a section of the array. -* [*array*.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) - Find the first occurrence of a value within the array. -* [*array*.lastIndexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf) - Find the last occurrence of a value within the array. - -And finally **iteration methods** that apply functions to elements in the array: - -* [*array*.filter](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) - Create a new array with only the elements for which a predicate is true. -* [*array*.forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) - Call a function for each element in the array. -* [*array*.every](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/every) - See if every element in the array satisfies a predicate. -* [*array*.map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map) - Create a new array with the result of calling a function on every element in the array. -* [*array*.some](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/some) - See if at least one element in the array satisfies a predicate. -* [*array*.reduce](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) - Apply a function to reduce the array to a single value (from left-to-right). -* [*array*.reduceRight](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight) - Apply a function to reduce the array to a single value (from right-to-left). - -## Installing - -If you use NPM, `npm install d3-array`. Otherwise, download the [latest release](https://github.com/d3/d3-array/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-array.v2.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -## API Reference - -* [Statistics](#statistics) -* [Search](#search) -* [Transformations](#transformations) -* [Bins](#bins) - -### Statistics - -Methods for computing basic summary statistics. - -# d3.min(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/min.js), [Examples](https://observablehq.com/@d3/d3-min-d3-max-d3-extent) - -Returns the minimum value in the given *iterable* using natural order. If the iterable contains no comparable values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the minimum value. - -Unlike the built-in [Math.min](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/min), this method ignores undefined, null and NaN values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the minimum of the strings [“20”, “3”] is “20”, while the minimum of the numbers [20, 3] is 3. - -See also [extent](#extent). - -# d3.minIndex(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/minIndex.js), [Examples](https://observablehq.com/@d3/d3-min-d3-max-d3-extent) - -Returns the index of the minimum value in the given *iterable* using natural order. If the iterable contains no comparable values, returns -1. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the minimum value. - -Unlike the built-in [Math.min](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/min), this method ignores undefined, null and NaN values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the minimum of the strings [“20”, “3”] is “20”, while the minimum of the numbers [20, 3] is 3. - -# d3.max(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/max.js), [Examples](https://observablehq.com/@d3/d3-min-d3-max-d3-extent) - -Returns the maximum value in the given *iterable* using natural order. If the iterable contains no comparable values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the maximum value. - -Unlike the built-in [Math.max](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/max), this method ignores undefined values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the maximum of the strings [“20”, “3”] is “3”, while the maximum of the numbers [20, 3] is 20. - -See also [extent](#extent). - -# d3.maxIndex(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/maxIndex.js), [Examples](https://observablehq.com/@d3/d3-min-d3-max-d3-extent) - -Returns the index of the maximum value in the given *iterable* using natural order. If the iterable contains no comparable values, returns -1. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the maximum value. - -Unlike the built-in [Math.max](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/max), this method ignores undefined values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the maximum of the strings [“20”, “3”] is “3”, while the maximum of the numbers [20, 3] is 20. - -# d3.extent(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/extent.js), [Examples](https://observablehq.com/@d3/d3-min-d3-max-d3-extent) - -Returns the [minimum](#min) and [maximum](#max) value in the given *iterable* using natural order. If the iterable contains no comparable values, returns [undefined, undefined]. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the extent. - -# d3.sum(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/sum.js), [Examples](https://observablehq.com/@d3/d3-sum) - -Returns the sum of the given *iterable* of numbers. If the iterable contains no numbers, returns 0. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the sum. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.mean(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/mean.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) - -Returns the mean of the given *iterable* of numbers. If the iterable contains no numbers, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the mean. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.median(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/median.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) - -Returns the median of the given *iterable* of numbers using the [R-7 method](https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample). If the iterable contains no numbers, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the median. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.cumsum(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/cumsum.js), [Examples](https://observablehq.com/@d3/d3-cumsum) - -Returns the cumulative sum of the given *iterable* of numbers, as a Float64Array of the same length. If the iterable contains no numbers, returns zeros. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the cumulative sum. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.quantile(iterable, p[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/quantile.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) - -Returns the *p*-quantile of the given *iterable* of numbers, where *p* is a number in the range [0, 1]. For example, the median can be computed using *p* = 0.5, the first quartile at *p* = 0.25, and the third quartile at *p* = 0.75. This particular implementation uses the [R-7 method](http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population), which is the default for the R programming language and Excel. For example: - -```js -var a = [0, 10, 30]; -d3.quantile(a, 0); // 0 -d3.quantile(a, 0.5); // 10 -d3.quantile(a, 1); // 30 -d3.quantile(a, 0.25); // 5 -d3.quantile(a, 0.75); // 20 -d3.quantile(a, 0.1); // 2 -``` - -An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the quantile. - -# d3.quantileSorted(array, p[, accessor]) [Source](https://github.com/d3/d3-array/blob/master/src/quantile.js "Source") - -Similar to *quantile*, but expects the input to be a **sorted** *array* of values. In contrast with *quantile*, the accessor is only called on the elements needed to compute the quantile. - -# d3.variance(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/variance.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) - -Returns an [unbiased estimator of the population variance](http://mathworld.wolfram.com/SampleVariance.html) of the given *iterable* of numbers using [Welford’s algorithm](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm). If the iterable has fewer than two numbers, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the variance. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.deviation(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/deviation.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) - -Returns the standard deviation, defined as the square root of the [bias-corrected variance](#variance), of the given *iterable* of numbers. If the iterable has fewer than two numbers, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the standard deviation. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -### Search - -Methods for searching arrays for a specific element. - -# d3.least(iterable[, comparator]) · [Source](https://github.com/d3/d3-array/blob/master/src/least.js), [Examples](https://observablehq.com/@d3/d3-least) -
# d3.least(iterable[, accessor]) - -Returns the least element of the specified *iterable* according to the specified *comparator* or *accessor*. If the given *iterable* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns undefined. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: - -```js -const array = [{foo: 42}, {foo: 91}]; -d3.least(array, (a, b) => a.foo - b.foo); // {foo: 42} -d3.least(array, (a, b) => b.foo - a.foo); // {foo: 91} -d3.least(array, a => a.foo); // {foo: 42} -``` - -This function is similar to [min](#min), except it allows the use of a comparator rather than an accessor. - -# d3.leastIndex(iterable[, comparator]) · [Source](https://github.com/d3/d3-array/blob/master/src/leastIndex.js), [Examples](https://observablehq.com/@d3/d3-least) -
# d3.leastIndex(iterable[, accessor]) - -Returns the index of the least element of the specified *iterable* according to the specified *comparator* or *accessor*. If the given *iterable* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns -1. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: - -```js -const array = [{foo: 42}, {foo: 91}]; -d3.leastIndex(array, (a, b) => a.foo - b.foo); // 0 -d3.leastIndex(array, (a, b) => b.foo - a.foo); // 1 -d3.leastIndex(array, a => a.foo); // 0 -``` - -This function is similar to [minIndex](#minIndex), except it allows the use of a comparator rather than an accessor. - -# d3.greatest(iterable[, comparator]) · [Source](https://github.com/d3/d3-array/blob/master/src/greatest.js), [Examples](https://observablehq.com/@d3/d3-least) -
# d3.greatest(iterable[, accessor]) - -Returns the greatest element of the specified *iterable* according to the specified *comparator* or *accessor*. If the given *iterable* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns undefined. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: - -```js -const array = [{foo: 42}, {foo: 91}]; -d3.greatest(array, (a, b) => a.foo - b.foo); // {foo: 91} -d3.greatest(array, (a, b) => b.foo - a.foo); // {foo: 42} -d3.greatest(array, a => a.foo); // {foo: 91} -``` - -This function is similar to [max](#max), except it allows the use of a comparator rather than an accessor. - -# d3.greatestIndex(iterable[, comparator]) · [Source](https://github.com/d3/d3-array/blob/master/src/greatestIndex.js), [Examples](https://observablehq.com/@d3/d3-least) -
# d3.greatestIndex(iterable[, accessor]) - -Returns the index of the greatest element of the specified *iterable* according to the specified *comparator* or *accessor*. If the given *iterable* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns -1. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: - -```js -const array = [{foo: 42}, {foo: 91}]; -d3.greatestIndex(array, (a, b) => a.foo - b.foo); // 1 -d3.greatestIndex(array, (a, b) => b.foo - a.foo); // 0 -d3.greatestIndex(array, a => a.foo); // 1 -``` - -This function is similar to [maxIndex](#maxIndex), except it allows the use of a comparator rather than an accessor. - -# d3.bisectLeft(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/master/src/bisect.js) - -Returns the insertion point for *x* in *array* to maintain sorted order. The arguments *lo* and *hi* may be used to specify a subset of the array which should be considered; by default the entire array is used. If *x* is already present in *array*, the insertion point will be before (to the left of) any existing entries. The return value is suitable for use as the first argument to [splice](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) assuming that *array* is already sorted. The returned insertion point *i* partitions the *array* into two halves so that all *v* < *x* for *v* in *array*.slice(*lo*, *i*) for the left side and all *v* >= *x* for *v* in *array*.slice(*i*, *hi*) for the right side. - -# d3.bisect(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/master/src/bisect.js), [Examples](https://observablehq.com/@d3/d3-bisect) -
# d3.bisectRight(array, x[, lo[, hi]]) - -Similar to [bisectLeft](#bisectLeft), but returns an insertion point which comes after (to the right of) any existing entries of *x* in *array*. The returned insertion point *i* partitions the *array* into two halves so that all *v* <= *x* for *v* in *array*.slice(*lo*, *i*) for the left side and all *v* > *x* for *v* in *array*.slice(*i*, *hi*) for the right side. - -# d3.bisector(accessor) · [Source](https://github.com/d3/d3-array/blob/master/src/bisector.js) -
# d3.bisector(comparator) - -Returns a new bisector using the specified *accessor* or *comparator* function. This method can be used to bisect arrays of objects instead of being limited to simple arrays of primitives. For example, given the following array of objects: - -```js -var data = [ - {date: new Date(2011, 1, 1), value: 0.5}, - {date: new Date(2011, 2, 1), value: 0.6}, - {date: new Date(2011, 3, 1), value: 0.7}, - {date: new Date(2011, 4, 1), value: 0.8} -]; -``` - -A suitable bisect function could be constructed as: - -```js -var bisectDate = d3.bisector(function(d) { return d.date; }).right; -``` - -This is equivalent to specifying a comparator: - -```js -var bisectDate = d3.bisector(function(d, x) { return d.date - x; }).right; -``` - -And then applied as *bisectDate*(*array*, *date*), returning an index. Note that the comparator is always passed the search value *x* as the second argument. Use a comparator rather than an accessor if you want values to be sorted in an order different than natural order, such as in descending rather than ascending order. - -# bisector.left(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/master/src/bisector.js) - -Equivalent to [bisectLeft](#bisectLeft), but uses this bisector’s associated comparator. - -# bisector.right(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/master/src/bisector.js) - -Equivalent to [bisectRight](#bisectRight), but uses this bisector’s associated comparator. - -# d3.quickselect(array, k, left = 0, right = array.length - 1, compare = ascending) · [Source](https://github.com/d3/d3-array/blob/master/src/quickselect.js), [Examples](https://observablehq.com/@d3/d3-quickselect) - -See [mourner/quickselect](https://github.com/mourner/quickselect/blob/master/README.md). - -# d3.ascending(a, b) · [Source](https://github.com/d3/d3-array/blob/master/src/ascending.js), [Examples](https://observablehq.com/@d3/d3-ascending) - -Returns -1 if *a* is less than *b*, or 1 if *a* is greater than *b*, or 0. This is the comparator function for natural order, and can be used in conjunction with the built-in [*array*.sort](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) method to arrange elements in ascending order. It is implemented as: - -```js -function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} -``` - -Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic (alphabetical), not natural! This can lead to surprising behavior when sorting an array of numbers. - -# d3.descending(a, b) · [Source](https://github.com/d3/d3-array/blob/master/src/descending.js), [Examples](https://observablehq.com/@d3/d3-ascending) - -Returns -1 if *a* is greater than *b*, or 1 if *a* is less than *b*, or 0. This is the comparator function for reverse natural order, and can be used in conjunction with the built-in array sort method to arrange elements in descending order. It is implemented as: - -```js -function descending(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} -``` - -Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic (alphabetical), not natural! This can lead to surprising behavior when sorting an array of numbers. - -### Transformations - -Methods for transforming arrays and for generating new arrays. - -# d3.group(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/master/src/group.js), [Examples](https://observablehq.com/@d3/d3-group-d3-rollup) - -Groups the specified *iterable* of values into a Map from *key* to array of value. For example, given some data: - -```js -data = [ - {name: "jim", amount: "34.0", date: "11/12/2015"}, - {name: "carl", amount: "120.11", date: "11/12/2015"}, - {name: "stacy", amount: "12.01", date: "01/04/2016"}, - {name: "stacy", amount: "34.05", date: "01/04/2016"} -] -``` - -To group the data by name: - -```js -d3.group(data, d => d.name) -``` - -This produces: - -```js -Map(3) { - "jim" => Array(1) - "carl" => Array(1) - "stacy" => Array(2) -} -``` - -If more than one *key* is specified, a nested Map is returned. For example: - -```js -d3.group(data, d => d.name, d => d.date) -``` - -This produces: - -```js -Map(3) { - "jim" => Map(1) { - "11/12/2015" => Array(1) - } - "carl" => Map(1) { - "11/12/2015" => Array(1) - } - "stacy" => Map(1) { - "01/04/2016" => Array(2) - } -} -``` - -To convert a Map to an Array, use [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from). For example: - -```js -Array.from(d3.group(data, d => d.name)) -``` - -This produces: - -```js -[ - ["jim", Array(1)], - ["carl", Array(1)], - ["stacy", Array(2)] -] -``` - -You can also simultaneously convert the [*key*, *value*] to some other representation by passing a map function to Array.from: - -```js -Array.from(d3.group(data, d => d.name), ([key, value]) => ({key, value})) -``` - -This produces: - -```js -[ - {key: "jim", value: Array(1)}, - {key: "carl", value: Array(1)}, - {key: "stacy", value: Array(2)} -] -``` - -In the near future, [*selection*.data](https://github.com/d3/d3-selection/blob/master/README.md#selection_data) will accept iterables directly, meaning that you can use a Map (or Set or other iterable) to perform a data join without first needing to convert to an array. - -# d3.groups(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/master/src/group.js), [Examples](https://observablehq.com/@d3/d3-group-d3-rollup) - -Equivalent to [group](#group), but returns nested arrays instead of nested maps. - -# d3.rollup(iterable, reduce, ...keys) · [Source](https://github.com/d3/d3-array/blob/master/src/group.js), [Examples](https://observablehq.com/@d3/d3-group-d3-rollup) - -[Groups](#group) and reduces the specified *iterable* of values into a Map from *key* to value. For example, given some data: - -```js -data = [ - {name: "jim", amount: "34.0", date: "11/12/2015"}, - {name: "carl", amount: "120.11", date: "11/12/2015"}, - {name: "stacy", amount: "12.01", date: "01/04/2016"}, - {name: "stacy", amount: "34.05", date: "01/04/2016"} -] -``` - -To count the number of elements by name: - -```js -d3.rollup(data, v => v.length, d => d.name) -``` - -This produces: - -```js -Map(3) { - "jim" => 1 - "carl" => 1 - "stacy" => 2 -} -``` - -If more than one *key* is specified, a nested Map is returned. For example: - -```js -d3.rollup(data, v => v.length, d => d.name, d => d.date) -``` - -This produces: - -```js -Map(3) { - "jim" => Map(1) { - "11/12/2015" => 1 - } - "carl" => Map(1) { - "11/12/2015" => 1 - } - "stacy" => Map(1) { - "01/04/2016" => 2 - } -} -``` - -To convert a Map to an Array, use [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from). See [d3.group](#group) for examples. - -# d3.rollups(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/master/src/group.js), [Examples](https://observablehq.com/@d3/d3-group-d3-rollup) - -Equivalent to [rollup](#rollup), but returns nested arrays instead of nested maps. - -# d3.count(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/master/src/count.js), [Examples](https://observablehq.com/@d3/d3-count) - -Returns the number of valid number values (*i.e.*, not null, NaN, or undefined) in the specified *iterable*; accepts an accessor. - -For example: - -```js -d3.count([{n: "Alice", age: NaN}, {n: "Bob", age: 18}, {n: "Other"}], d => d.age) // 1 -``` -# d3.cross(...iterables[, reducer]) · [Source](https://github.com/d3/d3-array/blob/master/src/cross.js), [Examples](https://observablehq.com/@d3/d3-cross) - -Returns the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the specified *iterables*. For example, if two iterables *a* and *b* are specified, for each element *i* in the iterable *a* and each element *j* in the iterable *b*, in order, invokes the specified *reducer* function passing the element *i* and element *j*. If a *reducer* is not specified, it defaults to a function which creates a two-element array for each pair: - -```js -function pair(a, b) { - return [a, b]; -} -``` - -For example: - -```js -d3.cross([1, 2], ["x", "y"]); // returns [[1, "x"], [1, "y"], [2, "x"], [2, "y"]] -d3.cross([1, 2], ["x", "y"], (a, b) => a + b); // returns ["1x", "1y", "2x", "2y"] -``` - -# d3.merge(iterables) · [Source](https://github.com/d3/d3-array/blob/master/src/merge.js), [Examples](https://observablehq.com/@d3/d3-merge) - -Merges the specified iterable of *iterables* into a single array. This method is similar to the built-in array concat method; the only difference is that it is more convenient when you have an array of arrays. - -```js -d3.merge([[1], [2, 3]]); // returns [1, 2, 3] -``` - -# d3.pairs(iterable[, reducer]) · [Source](https://github.com/d3/d3-array/blob/master/src/pairs.js), [Examples](https://observablehq.com/@d3/d3-pairs) - -For each adjacent pair of elements in the specified *iterable*, in order, invokes the specified *reducer* function passing the element *i* and element *i* - 1. If a *reducer* is not specified, it defaults to a function which creates a two-element array for each pair: - -```js -function pair(a, b) { - return [a, b]; -} -``` - -For example: - -```js -d3.pairs([1, 2, 3, 4]); // returns [[1, 2], [2, 3], [3, 4]] -d3.pairs([1, 2, 3, 4], (a, b) => b - a); // returns [1, 1, 1]; -``` - -If the specified iterable has fewer than two elements, returns the empty array. - -# d3.permute(source, keys) · [Source](https://github.com/d3/d3-array/blob/master/src/permute.js), [Examples](https://observablehq.com/@d3/d3-permute) - -Returns a permutation of the specified *source* object (or array) using the specified iterable of *keys*. The returned array contains the corresponding property of the source object for each key in *keys*, in order. For example: - -```js -permute(["a", "b", "c"], [1, 2, 0]); // returns ["b", "c", "a"] -``` - -It is acceptable to have more keys than source elements, and for keys to be duplicated or omitted. - -This method can also be used to extract the values from an object into an array with a stable order. Extracting keyed values in order can be useful for generating data arrays in nested selections. For example: - -```js -let object = {yield: 27, variety: "Manchuria", year: 1931, site: "University Farm"}; -let fields = ["site", "variety", "yield"]; - -d3.permute(object, fields); // returns ["University Farm", "Manchuria", 27] -``` - -# d3.shuffle(array[, start[, stop]]) · [Source](https://github.com/d3/d3-array/blob/master/src/shuffle.js), [Examples](https://observablehq.com/@d3/d3-shuffle) - -Randomizes the order of the specified *array* in-place using the [Fisher–Yates shuffle](https://bost.ocks.org/mike/shuffle/) and returns the *array*. If *start* is specified, it is the starting index (inclusive) of the *array* to shuffle; if *start* is not specified, it defaults to zero. If *stop* is specified, it is the ending index (exclusive) of the *array* to shuffle; if *stop* is not specified, it defaults to *array*.length. For example, to shuffle the first ten elements of the *array*: shuffle(*array*, 0, 10). - -# d3.ticks(start, stop, count) · [Source](https://github.com/d3/d3-array/blob/master/src/ticks.js), [Examples](https://observablehq.com/@d3/d3-ticks) - -Returns an array of approximately *count* + 1 uniformly-spaced, nicely-rounded values between *start* and *stop* (inclusive). Each value is a power of ten multiplied by 1, 2 or 5. See also [d3.tickIncrement](#tickIncrement), [d3.tickStep](#tickStep) and [*linear*.ticks](https://github.com/d3/d3-scale/blob/master/README.md#linear_ticks). - -Ticks are inclusive in the sense that they may include the specified *start* and *stop* values if (and only if) they are exact, nicely-rounded values consistent with the inferred [step](#tickStep). More formally, each returned tick *t* satisfies *start* ≤ *t* and *t* ≤ *stop*. - -# d3.tickIncrement(start, stop, count) · [Source](https://github.com/d3/d3-array/blob/master/src/ticks.js), [Examples](https://observablehq.com/@d3/d3-ticks) - -Like [d3.tickStep](#tickStep), except requires that *start* is always less than or equal to *step*, and if the tick step for the given *start*, *stop* and *count* would be less than one, returns the negative inverse tick step instead. This method is always guaranteed to return an integer, and is used by [d3.ticks](#ticks) to guarantee that the returned tick values are represented as precisely as possible in IEEE 754 floating point. - -# d3.tickStep(start, stop, count) · [Source](https://github.com/d3/d3-array/blob/master/src/ticks.js), [Examples](https://observablehq.com/@d3/d3-ticks) - -Returns the difference between adjacent tick values if the same arguments were passed to [d3.ticks](#ticks): a nicely-rounded value that is a power of ten multiplied by 1, 2 or 5. Note that due to the limited precision of IEEE 754 floating point, the returned value may not be exact decimals; use [d3-format](https://github.com/d3/d3-format) to format numbers for human consumption. - -# d3.range([start, ]stop[, step]) · [Source](https://github.com/d3/d3-array/blob/master/src/range.js), [Examples](https://observablehq.com/@d3/d3-range) - -Returns an array containing an arithmetic progression, similar to the Python built-in [range](http://docs.python.org/library/functions.html#range). This method is often used to iterate over a sequence of uniformly-spaced numeric values, such as the indexes of an array or the ticks of a linear scale. (See also [d3.ticks](#ticks) for nicely-rounded values.) - -If *step* is omitted, it defaults to 1. If *start* is omitted, it defaults to 0. The *stop* value is exclusive; it is not included in the result. If *step* is positive, the last element is the largest *start* + *i* \* *step* less than *stop*; if *step* is negative, the last element is the smallest *start* + *i* \* *step* greater than *stop*. If the returned array would contain an infinite number of values, an empty range is returned. - -The arguments are not required to be integers; however, the results are more predictable if they are. The values in the returned array are defined as *start* + *i* \* *step*, where *i* is an integer from zero to one minus the total number of elements in the returned array. For example: - -```js -d3.range(0, 1, 0.2) // [0, 0.2, 0.4, 0.6000000000000001, 0.8] -``` - -This unexpected behavior is due to IEEE 754 double-precision floating point, which defines 0.2 * 3 = 0.6000000000000001. Use [d3-format](https://github.com/d3/d3-format) to format numbers for human consumption with appropriate rounding; see also [linear.tickFormat](https://github.com/d3/d3-scale/blob/master/README.md#linear_tickFormat) in [d3-scale](https://github.com/d3/d3-scale). - -Likewise, if the returned array should have a specific length, consider using [array.map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on an integer range. For example: - -```js -d3.range(0, 1, 1 / 49); // BAD: returns 50 elements! -d3.range(49).map(function(d) { return d / 49; }); // GOOD: returns 49 elements. -``` - -# d3.transpose(matrix) · [Source](https://github.com/d3/d3-array/blob/master/src/transpose.js), [Examples](https://observablehq.com/@d3/d3-transpose) - -Uses the [zip](#zip) operator as a two-dimensional [matrix transpose](http://en.wikipedia.org/wiki/Transpose). - -# d3.zip(arrays…) · [Source](https://github.com/d3/d3-array/blob/master/src/zip.js), [Examples](https://observablehq.com/@d3/d3-transpose) - -Returns an array of arrays, where the *i*th array contains the *i*th element from each of the argument *arrays*. The returned array is truncated in length to the shortest array in *arrays*. If *arrays* contains only a single array, the returned array contains one-element arrays. With no arguments, the returned array is empty. - -```js -d3.zip([1, 2], [3, 4]); // returns [[1, 3], [2, 4]] -``` - -### Bins - -[Histogram](http://bl.ocks.org/mbostock/3048450) - -Binning groups discrete samples into a smaller number of consecutive, non-overlapping intervals. They are often used to visualize the distribution of numerical data as histograms. - -# d3.bin() · [Source](https://github.com/d3/d3-array/blob/master/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin) - -Constructs a new bin generator with the default settings. - -# bin(data) · [Source](https://github.com/d3/d3-array/blob/master/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin) - -Bins the given iterable of *data* samples. Returns an array of bins, where each bin is an array containing the associated elements from the input *data*. Thus, the `length` of the bin is the number of elements in that bin. Each bin has two additional attributes: - -* `x0` - the lower bound of the bin (inclusive). -* `x1` - the upper bound of the bin (exclusive, except for the last bin). - -# bin.value([value]) · [Source](https://github.com/d3/d3-array/blob/master/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin) - -If *value* is specified, sets the value accessor to the specified function or constant and returns this bin generator. If *value* is not specified, returns the current value accessor, which defaults to the identity function. - -When bins are [generated](#_bin), the value accessor will be invoked for each element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. The default value accessor assumes that the input data are orderable (comparable), such as numbers or dates. If your data are not, then you should specify an accessor that returns the corresponding orderable value for a given datum. - -This is similar to mapping your data to values before invoking the bin generator, but has the benefit that the input data remains associated with the returned bins, thereby making it easier to access other fields of the data. - -# bin.domain([domain]) · [Source](https://github.com/d3/d3-array/blob/master/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin) - -If *domain* is specified, sets the domain accessor to the specified function or array and returns this bin generator. If *domain* is not specified, returns the current domain accessor, which defaults to [extent](#extent). The bin domain is defined as an array [*min*, *max*], where *min* is the minimum observable value and *max* is the maximum observable value; both values are inclusive. Any value outside of this domain will be ignored when the bins are [generated](#_bin). - -For example, if you are using the bin generator in conjunction with a [linear scale](https://github.com/d3/d3-scale/blob/master/README.md#linear-scales) `x`, you might say: - -```js -var bin = d3.bin() - .domain(x.domain()) - .thresholds(x.ticks(20)); -``` - -You can then compute the bins from an array of numbers like so: - -```js -var bins = bin(numbers); -``` - -Note that the domain accessor is invoked on the materialized array of [values](#bin_value), not on the input data array. - -# bin.thresholds([count]) · [Source](https://github.com/d3/d3-array/blob/master/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin) -
# bin.thresholds([thresholds]) - -If *thresholds* is specified, sets the [threshold generator](#bin-thresholds) to the specified function or array and returns this bin generator. If *thresholds* is not specified, returns the current threshold generator, which by default implements [Sturges’ formula](#thresholdSturges). (Thus by default, the values to be binned must be numbers!) Thresholds are defined as an array of values [*x0*, *x1*, …]. Any value less than *x0* will be placed in the first bin; any value greater than or equal to *x0* but less than *x1* will be placed in the second bin; and so on. Thus, the [generated bins](#_bin) will have *thresholds*.length + 1 bins. See [bin thresholds](#bin-thresholds) for more information. - -Any threshold values outside the [domain](#bin_domain) are ignored. The first *bin*.x0 is always equal to the minimum domain value, and the last *bin*.x1 is always equal to the maximum domain value. - -If a *count* is specified instead of an array of *thresholds*, then the [domain](#bin_domain) will be uniformly divided into approximately *count* bins; see [ticks](#ticks). - -#### Bin Thresholds - -These functions are typically not used directly; instead, pass them to [*bin*.thresholds](#bin_thresholds). You may also implement your own threshold generator taking three arguments: the array of input [*values*](#bin_value) derived from the data, and the [observable domain](#bin_domain) represented as *min* and *max*. The generator may then return either the array of numeric thresholds or the *count* of bins; in the latter case the domain is divided uniformly into approximately *count* bins; see [ticks](#ticks). - -# d3.thresholdFreedmanDiaconis(values, min, max) · [Source](https://github.com/d3/d3-array/blob/master/src/threshold/freedmanDiaconis.js), [Examples](https://observablehq.com/@d3/d3-bin) - -Returns the number of bins according to the [Freedman–Diaconis rule](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. - -# d3.thresholdScott(values, min, max) · [Source](https://github.com/d3/d3-array/blob/master/src/threshold/scott.js), [Examples](https://observablehq.com/@d3/d3-bin) - -Returns the number of bins according to [Scott’s normal reference rule](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. - -# d3.thresholdSturges(values) · [Source](https://github.com/d3/d3-array/blob/master/src/threshold/sturges.js), [Examples](https://observablehq.com/@d3/d3-bin) - -Returns the number of bins according to [Sturges’ formula](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. diff --git a/node_modules/d3-array/dist/d3-array.js b/node_modules/d3-array/dist/d3-array.js deleted file mode 100644 index 182e87a..0000000 --- a/node_modules/d3-array/dist/d3-array.js +++ /dev/null @@ -1,796 +0,0 @@ -// https://d3js.org/d3-array/ v2.4.0 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; -} - -function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; -} - -var ascendingBisect = bisector(ascending); -var bisectRight = ascendingBisect.right; -var bisectLeft = ascendingBisect.left; - -function count(values, valueof) { - let count = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - ++count; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - ++count; - } - } - } - return count; -} - -function length(array) { - return array.length | 0; -} - -function empty(length) { - return !(length > 0); -} - -function arrayify(values) { - return typeof values !== "object" || "length" in values ? values : Array.from(values); -} - -function reducer(reduce) { - return values => reduce(...values); -} - -function cross(...values) { - const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop()); - values = values.map(arrayify); - const lengths = values.map(length); - const j = values.length - 1; - const index = new Array(j + 1).fill(0); - const product = []; - if (j < 0 || lengths.some(empty)) return product; - while (true) { - product.push(index.map((j, i) => values[i][j])); - let i = j; - while (++index[i] === lengths[i]) { - if (i === 0) return reduce ? product.map(reduce) : product; - index[i--] = 0; - } - } -} - -function cumsum(values, valueof) { - var sum = 0, index = 0; - return Float64Array.from(values, valueof === undefined - ? v => (sum += +v || 0) - : v => (sum += +valueof(v, index++, values) || 0)); -} - -function descending(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} - -function variance(values, valueof) { - let count = 0; - let delta; - let mean = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } - if (count > 1) return sum / (count - 1); -} - -function deviation(values, valueof) { - const v = variance(values, valueof); - return v ? Math.sqrt(v) : v; -} - -function extent(values, valueof) { - let min; - let max; - if (valueof === undefined) { - for (const value of values) { - if (value != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - return [min, max]; -} - -function identity(x) { - return x; -} - -function group(values, ...keys) { - return nest(values, identity, identity, keys); -} - -function groups(values, ...keys) { - return nest(values, Array.from, identity, keys); -} - -function rollup(values, reduce, ...keys) { - return nest(values, identity, reduce, keys); -} - -function rollups(values, reduce, ...keys) { - return nest(values, Array.from, reduce, keys); -} - -function nest(values, map, reduce, keys) { - return (function regroup(values, i) { - if (i >= keys.length) return reduce(values); - const groups = new Map(); - const keyof = keys[i++]; - let index = -1; - for (const value of values) { - const key = keyof(value, ++index, values); - const group = groups.get(key); - if (group) group.push(value); - else groups.set(key, [value]); - } - for (const [key, values] of groups) { - groups.set(key, regroup(values, i)); - } - return map(groups); - })(values, 0); -} - -var array = Array.prototype; - -var slice = array.slice; - -function constant(x) { - return function() { - return x; - }; -} - -function range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} - -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; -} - -function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} - -function sturges(values) { - return Math.ceil(Math.log(count(values)) / Math.LN2) + 1; -} - -function bin() { - var value = identity, - domain = extent, - threshold = sturges; - - function histogram(data) { - if (!Array.isArray(data)) data = Array.from(data); - - var i, - n = data.length, - x, - values = new Array(n); - - for (i = 0; i < n; ++i) { - values[i] = value(data[i], i, data); - } - - var xz = domain(values), - x0 = xz[0], - x1 = xz[1], - tz = threshold(values, x0, x1); - - // Convert number of thresholds into uniform thresholds. - if (!Array.isArray(tz)) { - tz = tickStep(x0, x1, tz); - tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive - } - - // Remove any thresholds outside the domain. - var m = tz.length; - while (tz[0] <= x0) tz.shift(), --m; - while (tz[m - 1] > x1) tz.pop(), --m; - - var bins = new Array(m + 1), - bin; - - // Initialize bins. - for (i = 0; i <= m; ++i) { - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - - // Assign data to bins by value, ignoring any outside the domain. - for (i = 0; i < n; ++i) { - x = values[i]; - if (x0 <= x && x <= x1) { - bins[bisectRight(tz, x, 0, m)].push(data[i]); - } - } - - return bins; - } - - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; - }; - - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; - }; - - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; - }; - - return histogram; -} - -function max(values, valueof) { - let max; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } - return max; -} - -function min(values, valueof) { - let min; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } - return min; -} - -// Based on https://github.com/mourner/quickselect -// ISC license, Copyright 2018 Vladimir Agafonkin. -function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending) { - while (right > left) { - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - - const t = array[k]; - let i = left; - let j = right; - - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - - while (i < j) { - swap(array, i, j), ++i, --j; - while (compare(array[i], t) < 0) ++i; - while (compare(array[j], t) > 0) --j; - } - - if (compare(array[left], t) === 0) swap(array, left, j); - else ++j, swap(array, j, right); - - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array; -} - -function swap(array, i, j) { - const t = array[i]; - array[i] = array[j]; - array[j] = t; -} - -function number(x) { - return x === null ? NaN : +x; -} - -function* numbers(values, valueof) { - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - yield value; - } - } - } -} - -function quantile(values, p, valueof) { - values = Float64Array.from(numbers(values, valueof)); - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return min(values); - if (p >= 1) return max(values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), - value1 = min(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); -} - -function quantileSorted(values, p, valueof = number) { - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} - -function freedmanDiaconis(values, min, max) { - return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(count(values), -1 / 3))); -} - -function scott(values, min, max) { - return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(count(values), -1 / 3))); -} - -function maxIndex(values, valueof) { - let max; - let maxIndex = -1; - let index = -1; - if (valueof === undefined) { - for (const value of values) { - ++index; - if (value != null - && (max < value || (max === undefined && value >= value))) { - max = value, maxIndex = index; - } - } - } else { - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (max < value || (max === undefined && value >= value))) { - max = value, maxIndex = index; - } - } - } - return maxIndex; -} - -function mean(values, valueof) { - let count = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } - if (count) return sum / count; -} - -function median(values, valueof) { - return quantile(values, 0.5, valueof); -} - -function* flatten(arrays) { - for (const array of arrays) { - yield* array; - } -} - -function merge(arrays) { - return Array.from(flatten(arrays)); -} - -function minIndex(values, valueof) { - let min; - let minIndex = -1; - let index = -1; - if (valueof === undefined) { - for (const value of values) { - ++index; - if (value != null - && (min > value || (min === undefined && value >= value))) { - min = value, minIndex = index; - } - } - } else { - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (min > value || (min === undefined && value >= value))) { - min = value, minIndex = index; - } - } - } - return minIndex; -} - -function pairs(values, pairof = pair) { - const pairs = []; - let previous; - let first = false; - for (const value of values) { - if (first) pairs.push(pairof(previous, value)); - previous = value; - first = true; - } - return pairs; -} - -function pair(a, b) { - return [a, b]; -} - -function permute(source, keys) { - return Array.from(keys, key => source[key]); -} - -function least(values, compare = ascending) { - let min; - let defined = false; - if (compare.length === 1) { - let minValue; - for (const element of values) { - const value = compare(element); - if (defined - ? ascending(value, minValue) < 0 - : ascending(value, value) === 0) { - min = element; - minValue = value; - defined = true; - } - } - } else { - for (const value of values) { - if (defined - ? compare(value, min) < 0 - : compare(value, value) === 0) { - min = value; - defined = true; - } - } - } - return min; -} - -function leastIndex(values, compare = ascending) { - if (compare.length === 1) return minIndex(values, compare); - let minValue; - let min = -1; - let index = -1; - for (const value of values) { - ++index; - if (min < 0 - ? compare(value, value) === 0 - : compare(value, minValue) < 0) { - minValue = value; - min = index; - } - } - return min; -} - -function greatest(values, compare = ascending) { - let max; - let defined = false; - if (compare.length === 1) { - let maxValue; - for (const element of values) { - const value = compare(element); - if (defined - ? ascending(value, maxValue) > 0 - : ascending(value, value) === 0) { - max = element; - maxValue = value; - defined = true; - } - } - } else { - for (const value of values) { - if (defined - ? compare(value, max) > 0 - : compare(value, value) === 0) { - max = value; - defined = true; - } - } - } - return max; -} - -function greatestIndex(values, compare = ascending) { - if (compare.length === 1) return maxIndex(values, compare); - let maxValue; - let max = -1; - let index = -1; - for (const value of values) { - ++index; - if (max < 0 - ? compare(value, value) === 0 - : compare(value, maxValue) > 0) { - maxValue = value; - max = index; - } - } - return max; -} - -function scan(values, compare) { - const index = leastIndex(values, compare); - return index < 0 ? undefined : index; -} - -function shuffle(array, i0 = 0, i1 = array.length) { - var m = i1 - (i0 = +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; -} - -function sum(values, valueof) { - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value = +value) { - sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if (value = +valueof(value, ++index, values)) { - sum += value; - } - } - } - return sum; -} - -function transpose(matrix) { - if (!(n = matrix.length)) return []; - for (var i = -1, m = min(matrix, length$1), 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 length$1(d) { - return d.length; -} - -function zip() { - return transpose(arguments); -} - -exports.ascending = ascending; -exports.bin = bin; -exports.bisect = bisectRight; -exports.bisectLeft = bisectLeft; -exports.bisectRight = bisectRight; -exports.bisector = bisector; -exports.count = count; -exports.cross = cross; -exports.cumsum = cumsum; -exports.descending = descending; -exports.deviation = deviation; -exports.extent = extent; -exports.greatest = greatest; -exports.greatestIndex = greatestIndex; -exports.group = group; -exports.groups = groups; -exports.histogram = bin; -exports.least = least; -exports.leastIndex = leastIndex; -exports.max = max; -exports.maxIndex = maxIndex; -exports.mean = mean; -exports.median = median; -exports.merge = merge; -exports.min = min; -exports.minIndex = minIndex; -exports.pairs = pairs; -exports.permute = permute; -exports.quantile = quantile; -exports.quantileSorted = quantileSorted; -exports.quickselect = quickselect; -exports.range = range; -exports.rollup = rollup; -exports.rollups = rollups; -exports.scan = scan; -exports.shuffle = shuffle; -exports.sum = sum; -exports.thresholdFreedmanDiaconis = freedmanDiaconis; -exports.thresholdScott = scott; -exports.thresholdSturges = sturges; -exports.tickIncrement = tickIncrement; -exports.tickStep = tickStep; -exports.ticks = ticks; -exports.transpose = transpose; -exports.variance = variance; -exports.zip = zip; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-array/dist/d3-array.min.js b/node_modules/d3-array/dist/d3-array.min.js deleted file mode 100644 index fc74452..0000000 --- a/node_modules/d3-array/dist/d3-array.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-array/ v2.4.0 Copyright 2019 Mike Bostock -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";function n(t,n){return tn?1:t>=n?0:NaN}function r(t){var r;return 1===t.length&&(r=t,t=function(t,e){return n(r(t),e)}),{left:function(n,r,e,o){for(null==e&&(e=0),null==o&&(o=n.length);e>>1;t(n[f],r)<0?e=f+1:o=f}return e},right:function(n,r,e,o){for(null==e&&(e=0),null==o&&(o=n.length);e>>1;t(n[f],r)>0?o=f:e=f+1}return e}}}var e=r(n),o=e.right,f=e.left;function u(t,n){let r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&++r;else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&(o=+o)>=o&&++r}return r}function i(t){return 0|t.length}function l(t){return!(t>0)}function a(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function c(t,n){let r,e=0,o=0,f=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(f+=(r=n-o)*(n-(o+=r/++e)));else{let u=-1;for(let i of t)null!=(i=n(i,++u,t))&&(i=+i)>=i&&(f+=(r=i-o)*(i-(o+=r/++e)))}if(e>1)return f/(e-1)}function s(t,n){const r=c(t,n);return r?Math.sqrt(r):r}function h(t,n){let r,e;if(void 0===n)for(const n of t)null!=n&&(void 0===r?n>=n&&(r=e=n):(r>n&&(r=n),e=f&&(r=e=f):(r>f&&(r=f),e=e.length)return r(o);const u=new Map,i=e[f++];let l=-1;for(const t of o){const n=i(t,++l,o),r=u.get(n);r?r.push(t):u.set(n,[t])}for(const[n,r]of u)u.set(n,t(r,f));return n(u)}(t,0)}var M=Array.prototype.slice;function p(t){return function(){return t}}function g(t,n,r){t=+t,n=+n,r=(o=arguments.length)<2?(n=t,t=0,1):o<3?1:+r;for(var e=-1,o=0|Math.max(0,Math.ceil((n-t)/r)),f=new Array(o);++e=0?(f>=y?10:f>=m?5:f>=A?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(f>=y?10:f>=m?5:f>=A?2:1)}function w(t,n,r){var e=Math.abs(n-t)/Math.max(0,r),o=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),f=e/o;return f>=y?o*=10:f>=m?o*=5:f>=A&&(o*=2),ns;)h.pop(),--d;var v,M=new Array(d+1);for(f=0;f<=d;++f)(v=M[f]=[]).x0=f>0?h[f-1]:c,v.x1=f=n)&&(r=n);else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&(r=o)&&(r=o)}return r}function I(t,n){let r;if(void 0===n)for(const n of t)null!=n&&(r>n||void 0===r&&n>=n)&&(r=n);else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&(r>o||void 0===r&&o>=o)&&(r=o)}return r}function k(t,r,e=0,o=t.length-1,f=n){for(;o>e;){if(o-e>600){const n=o-e+1,u=r-e+1,i=Math.log(n),l=.5*Math.exp(2*i/3),a=.5*Math.sqrt(i*l*(n-l)/n)*(u-n/2<0?-1:1);k(t,r,Math.max(e,Math.floor(r-u*l/n+a)),Math.min(o,Math.floor(r+(n-u)*l/n+a)),f)}const n=t[r];let u=e,i=o;for(F(t,e,r),f(t[o],n)>0&&F(t,e,o);u0;)--i}0===f(t[e],n)?F(t,e,i):F(t,++i,o),i<=r&&(e=i+1),r<=i&&(o=i-1)}return t}function F(t,n,r){const e=t[n];t[n]=t[r],t[r]=e}function L(t,n,r){if(e=(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let r=-1;for(let e of t)null!=(e=n(e,++r,t))&&(e=+e)>=e&&(yield e)}}(t,r))).length){if((n=+n)<=0||e<2)return I(t);if(n>=1)return q(t);var e,o=(e-1)*n,f=Math.floor(o),u=q(k(t,f).subarray(0,f+1));return u+(I(t.subarray(f+1))-u)*(o-f)}}function S(t,n){let r,e=-1,o=-1;if(void 0===n)for(const n of t)++o,null!=n&&(r=n)&&(r=n,e=o);else for(let f of t)null!=(f=n(f,++o,t))&&(r=f)&&(r=f,e=o);return e}function j(t,n){let r,e=-1,o=-1;if(void 0===n)for(const n of t)++o,null!=n&&(r>n||void 0===r&&n>=n)&&(r=n,e=o);else for(let f of t)null!=(f=n(f,++o,t))&&(r>f||void 0===r&&f>=f)&&(r=f,e=o);return e}function _(t,r=n){if(1===r.length)return j(t,r);let e,o=-1,f=-1;for(const n of t)++f,(o<0?0===r(n,n):r(n,e)<0)&&(e=n,o=f);return o}function z(t){if(!(o=t.length))return[];for(var n=-1,r=I(t,D),e=new Array(r);++nt(...n)}(t.pop()),r=(t=t.map(a)).map(i),e=t.length-1,o=new Array(e+1).fill(0),f=[];if(e<0||r.some(l))return f;for(;;){f.push(o.map((n,r)=>t[r][n]));let u=e;for(;++o[u]===r[u];){if(0===u)return n?f.map(n):f;o[u--]=0}}},t.cumsum=function(t,n){var r=0,e=0;return Float64Array.from(t,void 0===n?t=>r+=+t||0:o=>r+=+n(o,e++,t)||0)},t.descending=function(t,n){return nt?1:n>=t?0:NaN},t.deviation=s,t.extent=h,t.greatest=function(t,r=n){let e,o=!1;if(1===r.length){let f;for(const u of t){const t=r(u);(o?n(t,f)>0:0===n(t,t))&&(e=u,f=t,o=!0)}}else for(const n of t)(o?r(n,e)>0:0===r(n,n))&&(e=n,o=!0);return e},t.greatestIndex=function(t,r=n){if(1===r.length)return S(t,r);let e,o=-1,f=-1;for(const n of t)++f,(o<0?0===r(n,n):r(n,e)>0)&&(e=n,o=f);return o},t.group=function(t,...n){return v(t,d,d,n)},t.groups=function(t,...n){return v(t,Array.from,d,n)},t.histogram=N,t.least=function(t,r=n){let e,o=!1;if(1===r.length){let f;for(const u of t){const t=r(u);(o?n(t,f)<0:0===n(t,t))&&(e=u,f=t,o=!0)}}else for(const n of t)(o?r(n,e)<0:0===r(n,n))&&(e=n,o=!0);return e},t.leastIndex=_,t.max=q,t.maxIndex=S,t.mean=function(t,n){let r=0,e=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++r,e+=n);else{let o=-1;for(let f of t)null!=(f=n(f,++o,t))&&(f=+f)>=f&&(++r,e+=f)}if(r)return e/r},t.median=function(t,n){return L(t,.5,n)},t.merge=function(t){return Array.from(function*(t){for(const n of t)yield*n}(t))},t.min=I,t.minIndex=j,t.pairs=function(t,n=function(t,n){return[t,n]}){const r=[];let e,o=!1;for(const f of t)o&&r.push(n(e,f)),e=f,o=!0;return r},t.permute=function(t,n){return Array.from(n,n=>t[n])},t.quantile=L,t.quantileSorted=function(t,n,r=function(t){return null===t?NaN:+t}){if(e=t.length){if((n=+n)<=0||e<2)return+r(t[0],0,t);if(n>=1)return+r(t[e-1],e-1,t);var e,o=(e-1)*n,f=Math.floor(o),u=+r(t[f],f,t);return u+(+r(t[f+1],f+1,t)-u)*(o-f)}},t.quickselect=k,t.range=g,t.rollup=function(t,n,...r){return v(t,d,n,r)},t.rollups=function(t,n,...r){return v(t,Array.from,n,r)},t.scan=function(t,n){const r=_(t,n);return r<0?void 0:r},t.shuffle=function(t,n=0,r=t.length){for(var e,o,f=r-(n=+n);f;)o=Math.random()*f--|0,e=t[f+n],t[f+n]=t[o+n],t[o+n]=e;return t},t.sum=function(t,n){let r=0;if(void 0===n)for(let n of t)(n=+n)&&(r+=n);else{let e=-1;for(let o of t)(o=+n(o,++e,t))&&(r+=o)}return r},t.thresholdFreedmanDiaconis=function(t,n,r){return Math.ceil((r-n)/(2*(L(t,.75)-L(t,.25))*Math.pow(u(t),-1/3)))},t.thresholdScott=function(t,n,r){return Math.ceil((r-n)/(3.5*s(t)*Math.pow(u(t),-1/3)))},t.thresholdSturges=b,t.tickIncrement=x,t.tickStep=w,t.ticks=function(t,n,r){var e,o,f,u,i=-1;if(r=+r,(t=+t)==(n=+n)&&r>0)return[t];if((e=n0)for(t=Math.ceil(t/u),n=Math.floor(n/u),f=new Array(o=Math.ceil(n-t+1));++i b ? 1 : a >= b ? 0 : NaN; -} diff --git a/node_modules/d3-array/src/bin.js b/node_modules/d3-array/src/bin.js deleted file mode 100644 index 173079d..0000000 --- a/node_modules/d3-array/src/bin.js +++ /dev/null @@ -1,77 +0,0 @@ -import {slice} from "./array.js"; -import bisect from "./bisect.js"; -import constant from "./constant.js"; -import extent from "./extent.js"; -import identity from "./identity.js"; -import range from "./range.js"; -import {tickStep} from "./ticks.js"; -import sturges from "./threshold/sturges.js"; - -export default function() { - var value = identity, - domain = extent, - threshold = sturges; - - function histogram(data) { - if (!Array.isArray(data)) data = Array.from(data); - - var i, - n = data.length, - x, - values = new Array(n); - - for (i = 0; i < n; ++i) { - values[i] = value(data[i], i, data); - } - - var xz = domain(values), - x0 = xz[0], - x1 = xz[1], - tz = threshold(values, x0, x1); - - // Convert number of thresholds into uniform thresholds. - if (!Array.isArray(tz)) { - tz = tickStep(x0, x1, tz); - tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive - } - - // Remove any thresholds outside the domain. - var m = tz.length; - while (tz[0] <= x0) tz.shift(), --m; - while (tz[m - 1] > x1) tz.pop(), --m; - - var bins = new Array(m + 1), - bin; - - // Initialize bins. - for (i = 0; i <= m; ++i) { - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - - // Assign data to bins by value, ignoring any outside the domain. - for (i = 0; i < n; ++i) { - x = values[i]; - if (x0 <= x && x <= x1) { - bins[bisect(tz, x, 0, m)].push(data[i]); - } - } - - return bins; - } - - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; - }; - - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; - }; - - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; - }; - - return histogram; -} diff --git a/node_modules/d3-array/src/bisect.js b/node_modules/d3-array/src/bisect.js deleted file mode 100644 index feee172..0000000 --- a/node_modules/d3-array/src/bisect.js +++ /dev/null @@ -1,7 +0,0 @@ -import ascending from "./ascending.js"; -import bisector from "./bisector.js"; - -var ascendingBisect = bisector(ascending); -export var bisectRight = ascendingBisect.right; -export var bisectLeft = ascendingBisect.left; -export default bisectRight; diff --git a/node_modules/d3-array/src/bisector.js b/node_modules/d3-array/src/bisector.js deleted file mode 100644 index d7c3f7c..0000000 --- a/node_modules/d3-array/src/bisector.js +++ /dev/null @@ -1,33 +0,0 @@ -import ascending from "./ascending.js"; - -export default function(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; -} - -function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; -} diff --git a/node_modules/d3-array/src/constant.js b/node_modules/d3-array/src/constant.js deleted file mode 100644 index b7d42e7..0000000 --- a/node_modules/d3-array/src/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(x) { - return function() { - return x; - }; -} diff --git a/node_modules/d3-array/src/count.js b/node_modules/d3-array/src/count.js deleted file mode 100644 index b8783f0..0000000 --- a/node_modules/d3-array/src/count.js +++ /dev/null @@ -1,18 +0,0 @@ -export default function count(values, valueof) { - let count = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - ++count; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - ++count; - } - } - } - return count; -} diff --git a/node_modules/d3-array/src/cross.js b/node_modules/d3-array/src/cross.js deleted file mode 100644 index 7efdbe3..0000000 --- a/node_modules/d3-array/src/cross.js +++ /dev/null @@ -1,33 +0,0 @@ -function length(array) { - return array.length | 0; -} - -function empty(length) { - return !(length > 0); -} - -function arrayify(values) { - return typeof values !== "object" || "length" in values ? values : Array.from(values); -} - -function reducer(reduce) { - return values => reduce(...values); -} - -export default function cross(...values) { - const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop()); - values = values.map(arrayify); - const lengths = values.map(length); - const j = values.length - 1; - const index = new Array(j + 1).fill(0); - const product = []; - if (j < 0 || lengths.some(empty)) return product; - while (true) { - product.push(index.map((j, i) => values[i][j])); - let i = j; - while (++index[i] === lengths[i]) { - if (i === 0) return reduce ? product.map(reduce) : product; - index[i--] = 0; - } - } -} diff --git a/node_modules/d3-array/src/cumsum.js b/node_modules/d3-array/src/cumsum.js deleted file mode 100644 index 86fb052..0000000 --- a/node_modules/d3-array/src/cumsum.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function cumsum(values, valueof) { - var sum = 0, index = 0; - return Float64Array.from(values, valueof === undefined - ? v => (sum += +v || 0) - : v => (sum += +valueof(v, index++, values) || 0)); -} \ No newline at end of file diff --git a/node_modules/d3-array/src/descending.js b/node_modules/d3-array/src/descending.js deleted file mode 100644 index a4e2d7f..0000000 --- a/node_modules/d3-array/src/descending.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} diff --git a/node_modules/d3-array/src/deviation.js b/node_modules/d3-array/src/deviation.js deleted file mode 100644 index d5dbe7a..0000000 --- a/node_modules/d3-array/src/deviation.js +++ /dev/null @@ -1,6 +0,0 @@ -import variance from "./variance.js"; - -export default function deviation(values, valueof) { - const v = variance(values, valueof); - return v ? Math.sqrt(v) : v; -} diff --git a/node_modules/d3-array/src/extent.js b/node_modules/d3-array/src/extent.js deleted file mode 100644 index 2e3738d..0000000 --- a/node_modules/d3-array/src/extent.js +++ /dev/null @@ -1,29 +0,0 @@ -export default function(values, valueof) { - let min; - let max; - if (valueof === undefined) { - for (const value of values) { - if (value != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - return [min, max]; -} diff --git a/node_modules/d3-array/src/greatest.js b/node_modules/d3-array/src/greatest.js deleted file mode 100644 index 521f4f5..0000000 --- a/node_modules/d3-array/src/greatest.js +++ /dev/null @@ -1,29 +0,0 @@ -import ascending from "./ascending.js"; - -export default function greatest(values, compare = ascending) { - let max; - let defined = false; - if (compare.length === 1) { - let maxValue; - for (const element of values) { - const value = compare(element); - if (defined - ? ascending(value, maxValue) > 0 - : ascending(value, value) === 0) { - max = element; - maxValue = value; - defined = true; - } - } - } else { - for (const value of values) { - if (defined - ? compare(value, max) > 0 - : compare(value, value) === 0) { - max = value; - defined = true; - } - } - } - return max; -} diff --git a/node_modules/d3-array/src/greatestIndex.js b/node_modules/d3-array/src/greatestIndex.js deleted file mode 100644 index 2f390e5..0000000 --- a/node_modules/d3-array/src/greatestIndex.js +++ /dev/null @@ -1,19 +0,0 @@ -import ascending from "./ascending.js"; -import maxIndex from "./maxIndex.js"; - -export default function greatestIndex(values, compare = ascending) { - if (compare.length === 1) return maxIndex(values, compare); - let maxValue; - let max = -1; - let index = -1; - for (const value of values) { - ++index; - if (max < 0 - ? compare(value, value) === 0 - : compare(value, maxValue) > 0) { - maxValue = value; - max = index; - } - } - return max; -} diff --git a/node_modules/d3-array/src/group.js b/node_modules/d3-array/src/group.js deleted file mode 100644 index 97cc57e..0000000 --- a/node_modules/d3-array/src/group.js +++ /dev/null @@ -1,36 +0,0 @@ -import identity from "./identity.js"; - -export default function group(values, ...keys) { - return nest(values, identity, identity, keys); -} - -export function groups(values, ...keys) { - return nest(values, Array.from, identity, keys); -} - -export function rollup(values, reduce, ...keys) { - return nest(values, identity, reduce, keys); -} - -export function rollups(values, reduce, ...keys) { - return nest(values, Array.from, reduce, keys); -} - -function nest(values, map, reduce, keys) { - return (function regroup(values, i) { - if (i >= keys.length) return reduce(values); - const groups = new Map(); - const keyof = keys[i++]; - let index = -1; - for (const value of values) { - const key = keyof(value, ++index, values); - const group = groups.get(key); - if (group) group.push(value); - else groups.set(key, [value]); - } - for (const [key, values] of groups) { - groups.set(key, regroup(values, i)); - } - return map(groups); - })(values, 0); -} diff --git a/node_modules/d3-array/src/identity.js b/node_modules/d3-array/src/identity.js deleted file mode 100644 index b2f94b2..0000000 --- a/node_modules/d3-array/src/identity.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x) { - return x; -} diff --git a/node_modules/d3-array/src/index.js b/node_modules/d3-array/src/index.js deleted file mode 100644 index 3420d16..0000000 --- a/node_modules/d3-array/src/index.js +++ /dev/null @@ -1,37 +0,0 @@ -export {default as bisect, bisectRight, bisectLeft} from "./bisect.js"; -export {default as ascending} from "./ascending.js"; -export {default as bisector} from "./bisector.js"; -export {default as count} from "./count.js"; -export {default as cross} from "./cross.js"; -export {default as cumsum} from "./cumsum.js"; -export {default as descending} from "./descending.js"; -export {default as deviation} from "./deviation.js"; -export {default as extent} from "./extent.js"; -export {default as group, groups, rollup, rollups} from "./group.js"; -export {default as bin, default as histogram} from "./bin.js"; // Deprecated; use bin. -export {default as thresholdFreedmanDiaconis} from "./threshold/freedmanDiaconis.js"; -export {default as thresholdScott} from "./threshold/scott.js"; -export {default as thresholdSturges} from "./threshold/sturges.js"; -export {default as max} from "./max.js"; -export {default as maxIndex} from "./maxIndex.js"; -export {default as mean} from "./mean.js"; -export {default as median} from "./median.js"; -export {default as merge} from "./merge.js"; -export {default as min} from "./min.js"; -export {default as minIndex} from "./minIndex.js"; -export {default as pairs} from "./pairs.js"; -export {default as permute} from "./permute.js"; -export {default as quantile, quantileSorted} from "./quantile.js"; -export {default as quickselect} from "./quickselect.js"; -export {default as range} from "./range.js"; -export {default as least} from "./least.js"; -export {default as leastIndex} from "./leastIndex.js"; -export {default as greatest} from "./greatest.js"; -export {default as greatestIndex} from "./greatestIndex.js"; -export {default as scan} from "./scan.js"; // Deprecated; use leastIndex. -export {default as shuffle} from "./shuffle.js"; -export {default as sum} from "./sum.js"; -export {default as ticks, tickIncrement, tickStep} from "./ticks.js"; -export {default as transpose} from "./transpose.js"; -export {default as variance} from "./variance.js"; -export {default as zip} from "./zip.js"; diff --git a/node_modules/d3-array/src/least.js b/node_modules/d3-array/src/least.js deleted file mode 100644 index a756abf..0000000 --- a/node_modules/d3-array/src/least.js +++ /dev/null @@ -1,29 +0,0 @@ -import ascending from "./ascending.js"; - -export default function least(values, compare = ascending) { - let min; - let defined = false; - if (compare.length === 1) { - let minValue; - for (const element of values) { - const value = compare(element); - if (defined - ? ascending(value, minValue) < 0 - : ascending(value, value) === 0) { - min = element; - minValue = value; - defined = true; - } - } - } else { - for (const value of values) { - if (defined - ? compare(value, min) < 0 - : compare(value, value) === 0) { - min = value; - defined = true; - } - } - } - return min; -} diff --git a/node_modules/d3-array/src/leastIndex.js b/node_modules/d3-array/src/leastIndex.js deleted file mode 100644 index ee3542b..0000000 --- a/node_modules/d3-array/src/leastIndex.js +++ /dev/null @@ -1,19 +0,0 @@ -import ascending from "./ascending.js"; -import minIndex from "./minIndex.js"; - -export default function leastIndex(values, compare = ascending) { - if (compare.length === 1) return minIndex(values, compare); - let minValue; - let min = -1; - let index = -1; - for (const value of values) { - ++index; - if (min < 0 - ? compare(value, value) === 0 - : compare(value, minValue) < 0) { - minValue = value; - min = index; - } - } - return min; -} diff --git a/node_modules/d3-array/src/max.js b/node_modules/d3-array/src/max.js deleted file mode 100644 index ce28736..0000000 --- a/node_modules/d3-array/src/max.js +++ /dev/null @@ -1,20 +0,0 @@ -export default function max(values, valueof) { - let max; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } - return max; -} diff --git a/node_modules/d3-array/src/maxIndex.js b/node_modules/d3-array/src/maxIndex.js deleted file mode 100644 index 87da1a2..0000000 --- a/node_modules/d3-array/src/maxIndex.js +++ /dev/null @@ -1,22 +0,0 @@ -export default function maxIndex(values, valueof) { - let max; - let maxIndex = -1; - let index = -1; - if (valueof === undefined) { - for (const value of values) { - ++index; - if (value != null - && (max < value || (max === undefined && value >= value))) { - max = value, maxIndex = index; - } - } - } else { - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (max < value || (max === undefined && value >= value))) { - max = value, maxIndex = index; - } - } - } - return maxIndex; -} diff --git a/node_modules/d3-array/src/mean.js b/node_modules/d3-array/src/mean.js deleted file mode 100644 index ff6fc46..0000000 --- a/node_modules/d3-array/src/mean.js +++ /dev/null @@ -1,19 +0,0 @@ -export default function mean(values, valueof) { - let count = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } - if (count) return sum / count; -} diff --git a/node_modules/d3-array/src/median.js b/node_modules/d3-array/src/median.js deleted file mode 100644 index 82cbc4e..0000000 --- a/node_modules/d3-array/src/median.js +++ /dev/null @@ -1,5 +0,0 @@ -import quantile from "./quantile.js"; - -export default function(values, valueof) { - return quantile(values, 0.5, valueof); -} diff --git a/node_modules/d3-array/src/merge.js b/node_modules/d3-array/src/merge.js deleted file mode 100644 index a368002..0000000 --- a/node_modules/d3-array/src/merge.js +++ /dev/null @@ -1,9 +0,0 @@ -function* flatten(arrays) { - for (const array of arrays) { - yield* array; - } -} - -export default function merge(arrays) { - return Array.from(flatten(arrays)); -} diff --git a/node_modules/d3-array/src/min.js b/node_modules/d3-array/src/min.js deleted file mode 100644 index df88bfb..0000000 --- a/node_modules/d3-array/src/min.js +++ /dev/null @@ -1,20 +0,0 @@ -export default function min(values, valueof) { - let min; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } - return min; -} diff --git a/node_modules/d3-array/src/minIndex.js b/node_modules/d3-array/src/minIndex.js deleted file mode 100644 index 5c07d1e..0000000 --- a/node_modules/d3-array/src/minIndex.js +++ /dev/null @@ -1,22 +0,0 @@ -export default function minIndex(values, valueof) { - let min; - let minIndex = -1; - let index = -1; - if (valueof === undefined) { - for (const value of values) { - ++index; - if (value != null - && (min > value || (min === undefined && value >= value))) { - min = value, minIndex = index; - } - } - } else { - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (min > value || (min === undefined && value >= value))) { - min = value, minIndex = index; - } - } - } - return minIndex; -} diff --git a/node_modules/d3-array/src/number.js b/node_modules/d3-array/src/number.js deleted file mode 100644 index 3a9a524..0000000 --- a/node_modules/d3-array/src/number.js +++ /dev/null @@ -1,20 +0,0 @@ -export default function(x) { - return x === null ? NaN : +x; -} - -export function* numbers(values, valueof) { - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - yield value; - } - } - } -} diff --git a/node_modules/d3-array/src/pairs.js b/node_modules/d3-array/src/pairs.js deleted file mode 100644 index bfaafec..0000000 --- a/node_modules/d3-array/src/pairs.js +++ /dev/null @@ -1,15 +0,0 @@ -export default function pairs(values, pairof = pair) { - const pairs = []; - let previous; - let first = false; - for (const value of values) { - if (first) pairs.push(pairof(previous, value)); - previous = value; - first = true; - } - return pairs; -} - -export function pair(a, b) { - return [a, b]; -} diff --git a/node_modules/d3-array/src/permute.js b/node_modules/d3-array/src/permute.js deleted file mode 100644 index c7e822d..0000000 --- a/node_modules/d3-array/src/permute.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(source, keys) { - return Array.from(keys, key => source[key]); -} diff --git a/node_modules/d3-array/src/quantile.js b/node_modules/d3-array/src/quantile.js deleted file mode 100644 index 09ddac7..0000000 --- a/node_modules/d3-array/src/quantile.js +++ /dev/null @@ -1,29 +0,0 @@ -import max from "./max.js"; -import min from "./min.js"; -import quickselect from "./quickselect.js"; -import number, {numbers} from "./number.js"; - -export default function quantile(values, p, valueof) { - values = Float64Array.from(numbers(values, valueof)); - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return min(values); - if (p >= 1) return max(values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), - value1 = min(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); -} - -export function quantileSorted(values, p, valueof = number) { - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} diff --git a/node_modules/d3-array/src/quickselect.js b/node_modules/d3-array/src/quickselect.js deleted file mode 100644 index 2a31d36..0000000 --- a/node_modules/d3-array/src/quickselect.js +++ /dev/null @@ -1,44 +0,0 @@ -import ascending from "./ascending.js"; - -// Based on https://github.com/mourner/quickselect -// ISC license, Copyright 2018 Vladimir Agafonkin. -export default function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending) { - while (right > left) { - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - - const t = array[k]; - let i = left; - let j = right; - - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - - while (i < j) { - swap(array, i, j), ++i, --j; - while (compare(array[i], t) < 0) ++i; - while (compare(array[j], t) > 0) --j; - } - - if (compare(array[left], t) === 0) swap(array, left, j); - else ++j, swap(array, j, right); - - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array; -} - -function swap(array, i, j) { - const t = array[i]; - array[i] = array[j]; - array[j] = t; -} diff --git a/node_modules/d3-array/src/range.js b/node_modules/d3-array/src/range.js deleted file mode 100644 index 5975601..0000000 --- a/node_modules/d3-array/src/range.js +++ /dev/null @@ -1,13 +0,0 @@ -export default function(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} diff --git a/node_modules/d3-array/src/scan.js b/node_modules/d3-array/src/scan.js deleted file mode 100644 index 9c538f8..0000000 --- a/node_modules/d3-array/src/scan.js +++ /dev/null @@ -1,6 +0,0 @@ -import leastIndex from "./leastIndex.js"; - -export default function scan(values, compare) { - const index = leastIndex(values, compare); - return index < 0 ? undefined : index; -} diff --git a/node_modules/d3-array/src/shuffle.js b/node_modules/d3-array/src/shuffle.js deleted file mode 100644 index 14eadef..0000000 --- a/node_modules/d3-array/src/shuffle.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function shuffle(array, i0 = 0, i1 = array.length) { - var m = i1 - (i0 = +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; -} diff --git a/node_modules/d3-array/src/sum.js b/node_modules/d3-array/src/sum.js deleted file mode 100644 index 0720e2a..0000000 --- a/node_modules/d3-array/src/sum.js +++ /dev/null @@ -1,18 +0,0 @@ -export default function sum(values, valueof) { - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value = +value) { - sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if (value = +valueof(value, ++index, values)) { - sum += value; - } - } - } - return sum; -} diff --git a/node_modules/d3-array/src/threshold/freedmanDiaconis.js b/node_modules/d3-array/src/threshold/freedmanDiaconis.js deleted file mode 100644 index 2f9a209..0000000 --- a/node_modules/d3-array/src/threshold/freedmanDiaconis.js +++ /dev/null @@ -1,6 +0,0 @@ -import count from "../count.js"; -import quantile from "../quantile.js"; - -export default function(values, min, max) { - return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(count(values), -1 / 3))); -} diff --git a/node_modules/d3-array/src/threshold/scott.js b/node_modules/d3-array/src/threshold/scott.js deleted file mode 100644 index 219e080..0000000 --- a/node_modules/d3-array/src/threshold/scott.js +++ /dev/null @@ -1,6 +0,0 @@ -import count from "../count.js"; -import deviation from "../deviation.js"; - -export default function(values, min, max) { - return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(count(values), -1 / 3))); -} diff --git a/node_modules/d3-array/src/threshold/sturges.js b/node_modules/d3-array/src/threshold/sturges.js deleted file mode 100644 index eba4ab9..0000000 --- a/node_modules/d3-array/src/threshold/sturges.js +++ /dev/null @@ -1,5 +0,0 @@ -import count from "../count.js"; - -export default function(values) { - return Math.ceil(Math.log(count(values)) / Math.LN2) + 1; -} diff --git a/node_modules/d3-array/src/ticks.js b/node_modules/d3-array/src/ticks.js deleted file mode 100644 index e9553fe..0000000 --- a/node_modules/d3-array/src/ticks.js +++ /dev/null @@ -1,51 +0,0 @@ -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -export default function(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; -} - -export function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -export function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} diff --git a/node_modules/d3-array/src/transpose.js b/node_modules/d3-array/src/transpose.js deleted file mode 100644 index 5ef3bfe..0000000 --- a/node_modules/d3-array/src/transpose.js +++ /dev/null @@ -1,15 +0,0 @@ -import min from "./min.js"; - -export default function(matrix) { - if (!(n = matrix.length)) return []; - for (var i = -1, m = min(matrix, length), 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 length(d) { - return d.length; -} diff --git a/node_modules/d3-array/src/variance.js b/node_modules/d3-array/src/variance.js deleted file mode 100644 index 2428bf8..0000000 --- a/node_modules/d3-array/src/variance.js +++ /dev/null @@ -1,25 +0,0 @@ -export default function variance(values, valueof) { - let count = 0; - let delta; - let mean = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } - if (count > 1) return sum / (count - 1); -} diff --git a/node_modules/d3-array/src/zip.js b/node_modules/d3-array/src/zip.js deleted file mode 100644 index a460380..0000000 --- a/node_modules/d3-array/src/zip.js +++ /dev/null @@ -1,5 +0,0 @@ -import transpose from "./transpose.js"; - -export default function() { - return transpose(arguments); -} diff --git a/node_modules/d3-color/LICENSE b/node_modules/d3-color/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-color/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-color/README.md b/node_modules/d3-color/README.md deleted file mode 100644 index f6d79b2..0000000 --- a/node_modules/d3-color/README.md +++ /dev/null @@ -1,177 +0,0 @@ -# d3-color - -Even though your browser understands a lot about colors, it doesn’t offer much help in manipulating colors through JavaScript. The d3-color module therefore provides representations for various color spaces, allowing specification, conversion and manipulation. (Also see [d3-interpolate](https://github.com/d3/d3-interpolate) for color interpolation.) - -For example, take the color named “steelblue”: - -```js -var c = d3.color("steelblue"); // {r: 70, g: 130, b: 180, opacity: 1} -``` - -Let’s try converting it to HSL: - -```js -var c = d3.hsl("steelblue"); // {h: 207.27…, s: 0.44, l: 0.4902…, opacity: 1} -``` - -Now rotate the hue by 90°, bump up the saturation, and format as a string for CSS: - -```js -c.h += 90; -c.s += 0.2; -c + ""; // rgb(198, 45, 205) -``` - -To fade the color slightly: - -```js -c.opacity = 0.8; -c + ""; // rgba(198, 45, 205, 0.8) -``` - -In addition to the ubiquitous and machine-friendly [RGB](#rgb) and [HSL](#hsl) color space, d3-color supports color spaces that are designed for humans: - -* [CIELAB](#lab) (*a.k.a.* “Lab”) -* [CIELChab](#lch) (*a.k.a.* “LCh” or “HCL”) -* Dave Green’s [Cubehelix](#cubehelix) - -Cubehelix features monotonic lightness, while CIELAB and its polar form CIELChab are perceptually uniform. - -For additional color spaces, see: - -* [d3-cam16](https://github.com/d3/d3-cam16) -* [d3-cam02](https://github.com/connorgr/d3-cam02) -* [d3-hsv](https://github.com/d3/d3-hsv) -* [d3-hcg](https://github.com/d3/d3-hcg) -* [d3-hsluv](https://github.com/petulla/d3-hsluv) - -## Installing - -If you use NPM, `npm install d3-color`. Otherwise, download the [latest release](https://github.com/d3/d3-color/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-color.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -[Try d3-color in your browser.](https://observablehq.com/collection/@d3/d3-color) - -## API Reference - -# d3.color(specifier) [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -Parses the specified [CSS Color Module Level 3](http://www.w3.org/TR/css3-color/#colorunits) *specifier* string, returning an [RGB](#rgb) or [HSL](#hsl) color, along with [CSS Color Module Level 4 hex](https://www.w3.org/TR/css-color-4/#hex-notation) *specifier* strings. If the specifier was not valid, null is returned. Some examples: - -* `rgb(255, 255, 255)` -* `rgb(10%, 20%, 30%)` -* `rgba(255, 255, 255, 0.4)` -* `rgba(10%, 20%, 30%, 0.4)` -* `hsl(120, 50%, 20%)` -* `hsla(120, 50%, 20%, 0.4)` -* `#ffeeaa` -* `#fea` -* `#ffeeaa22` -* `#fea2` -* `steelblue` - -The list of supported [named colors](http://www.w3.org/TR/SVG/types.html#ColorKeywords) is specified by CSS. - -Note: this function may also be used with `instanceof` to test if an object is a color instance. The same is true of color subclasses, allowing you to test whether a color is in a particular color space. - -# *color*.opacity - -This color’s opacity, typically in the range [0, 1]. - -# *color*.rgb() [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -Returns the [RGB equivalent](#rgb) of this color. For RGB colors, that’s `this`. - -# color.copy([values]) [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -Returns a copy of this color. If *values* is specified, any enumerable own properties of *values* are assigned to the new returned color. For example, to derive a copy of a *color* with opacity 0.5, say - -```js -color.copy({opacity: 0.5}) -``` - -# *color*.brighter([k]) [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -Returns a brighter copy of this color. If *k* is specified, it controls how much brighter the returned color should be. If *k* is not specified, it defaults to 1. The behavior of this method is dependent on the implementing color space. - -# *color*.darker([k]) [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -Returns a darker copy of this color. If *k* is specified, it controls how much darker the returned color should be. If *k* is not specified, it defaults to 1. The behavior of this method is dependent on the implementing color space. - -# *color*.displayable() [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -Returns true if and only if the color is displayable on standard hardware. For example, this returns false for an RGB color if any channel value is less than zero or greater than 255 when rounded, or if the opacity is not in the range [0, 1]. - -# *color*.formatHex() [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -Returns a hexadecimal string representing this color in RGB space, such as `#f7eaba`. If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - -# *color*.formatHsl() [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -Returns a string representing this color according to the [CSS Color Module Level 3 specification](https://www.w3.org/TR/css-color-3/#hsl-color), such as `hsl(257, 50%, 80%)` or `hsla(257, 50%, 80%, 0.2)`. If this color is not displayable, a suitable displayable color is returned instead by clamping S and L channel values to the interval [0, 100]. - -# *color*.formatRgb() [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -Returns a string representing this color according to the [CSS Object Model specification](https://drafts.csswg.org/cssom/#serialize-a-css-component-value), such as `rgb(247, 234, 186)` or `rgba(247, 234, 186, 0.2)`. If this color is not displayable, a suitable displayable color is returned instead by clamping RGB channel values to the interval [0, 255]. - -# *color*.toString() [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source") - -An alias for [*color*.formatRgb](#color_formatRgb). - -# d3.rgb(r, g, b[, opacity]) [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source")
-# d3.rgb(specifier)
-# d3.rgb(color)
- -Constructs a new [RGB](https://en.wikipedia.org/wiki/RGB_color_model) color. The channel values are exposed as `r`, `g` and `b` properties on the returned instance. Use the [RGB color picker](http://bl.ocks.org/mbostock/78d64ca7ef013b4dcf8f) to explore this color space. - -If *r*, *g* and *b* are specified, these represent the channel values of the returned color; an *opacity* may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to the RGB color space. See [color](#color) for examples. If a [*color*](#color) instance is specified, it is converted to the RGB color space using [*color*.rgb](#color_rgb). Note that unlike [*color*.rgb](#color_rgb) this method *always* returns a new instance, even if *color* is already an RGB color. - -# d3.hsl(h, s, l[, opacity]) [<>](https://github.com/d3/d3-color/blob/master/src/color.js "Source")
-# d3.hsl(specifier)
-# d3.hsl(color)
- -Constructs a new [HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) color. The channel values are exposed as `h`, `s` and `l` properties on the returned instance. Use the [HSL color picker](http://bl.ocks.org/mbostock/debaad4fcce9bcee14cf) to explore this color space. - -If *h*, *s* and *l* are specified, these represent the channel values of the returned color; an *opacity* may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to the HSL color space. See [color](#color) for examples. If a [*color*](#color) instance is specified, it is converted to the RGB color space using [*color*.rgb](#color_rgb) and then converted to HSL. (Colors already in the HSL color space skip the conversion to RGB.) - -# d3.lab(l, a, b[, opacity]) [<>](https://github.com/d3/d3-color/blob/master/src/lab.js "Source")
-# d3.lab(specifier)
-# d3.lab(color)
- -Constructs a new [CIELAB](https://en.wikipedia.org/wiki/Lab_color_space#CIELAB) color. The channel values are exposed as `l`, `a` and `b` properties on the returned instance. Use the [CIELAB color picker](http://bl.ocks.org/mbostock/9f37cc207c0cb166921b) to explore this color space. The value of *l* is typically in the range [0, 100], while *a* and *b* are typically in [-160, +160]. - -If *l*, *a* and *b* are specified, these represent the channel values of the returned color; an *opacity* may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to the CIELAB color space. See [color](#color) for examples. If a [*color*](#color) instance is specified, it is converted to the RGB color space using [*color*.rgb](#color_rgb) and then converted to CIELAB. (Colors already in the CIELAB color space skip the conversion to RGB, and colors in the HCL color space are converted directly to CIELAB.) - -# d3.gray(l[, opacity]) [<>](https://github.com/d3/d3-color/blob/master/src/lab.js "Source")
- -Constructs a new [CIELAB](#lab) color with the specified *l* value and *a* = *b* = 0. - -# d3.hcl(h, c, l[, opacity]) [<>](https://github.com/d3/d3-color/blob/master/src/lab.js "Source")
-# d3.hcl(specifier)
-# d3.hcl(color)
- -Equivalent to [d3.lch](#lch), but with reversed argument order. - -# d3.lch(l, c, h[, opacity]) [<>](https://github.com/d3/d3-color/blob/master/src/lab.js "Source")
-# d3.lch(specifier)
-# d3.lch(color)
- -Constructs a new [CIELChab](https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_representation:_CIELCh_or_CIEHLC) color. The channel values are exposed as `l`, `c` and `h` properties on the returned instance. Use the [CIELChab color picker](http://bl.ocks.org/mbostock/3e115519a1b495e0bd95) to explore this color space. The value of *l* is typically in the range [0, 100], *c* is typically in [0, 230], and *h* is typically in [0, 360). - -If *l*, *c*, and *h* are specified, these represent the channel values of the returned color; an *opacity* may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to CIELChab color space. See [color](#color) for examples. If a [*color*](#color) instance is specified, it is converted to the RGB color space using [*color*.rgb](#color_rgb) and then converted to CIELChab. (Colors already in CIELChab color space skip the conversion to RGB, and colors in CIELAB color space are converted directly to CIELChab.) - -# d3.cubehelix(h, s, l[, opacity]) [<>](https://github.com/d3/d3-color/blob/master/src/cubehelix.js "Source")
-# d3.cubehelix(specifier)
-# d3.cubehelix(color)
- -Constructs a new [Cubehelix](http://www.mrao.cam.ac.uk/~dag/CUBEHELIX/) color. The channel values are exposed as `h`, `s` and `l` properties on the returned instance. Use the [Cubehelix color picker](http://bl.ocks.org/mbostock/ba8d75e45794c27168b5) to explore this color space. - -If *h*, *s* and *l* are specified, these represent the channel values of the returned color; an *opacity* may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to the Cubehelix color space. See [color](#color) for examples. If a [*color*](#color) instance is specified, it is converted to the RGB color space using [*color*.rgb](#color_rgb) and then converted to Cubehelix. (Colors already in the Cubehelix color space skip the conversion to RGB.) diff --git a/node_modules/d3-color/dist/d3-color.js b/node_modules/d3-color/dist/d3-color.js deleted file mode 100644 index 0e0d99a..0000000 --- a/node_modules/d3-color/dist/d3-color.js +++ /dev/null @@ -1,581 +0,0 @@ -// https://d3js.org/d3-color/ v1.4.1 Copyright 2020 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -function define(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; -} - -function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for (var key in definition) prototype[key] = definition[key]; - return prototype; -} - -function Color() {} - -var darker = 0.7; -var brighter = 1 / darker; - -var reI = "\\s*([+-]?\\d+)\\s*", - reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", - reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", - reHex = /^#([0-9a-f]{3,8})$/, - reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), - reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), - reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), - reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), - reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), - reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); - -var named = { - 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, { - copy: function(channels) { - return Object.assign(new this.constructor, this, channels); - }, - displayable: function() { - return this.rgb().displayable(); - }, - hex: color_formatHex, // Deprecated! Use color.formatHex. - formatHex: color_formatHex, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb -}); - -function color_formatHex() { - return this.rgb().formatHex(); -} - -function color_formatHsl() { - return hslConvert(this).formatHsl(); -} - -function color_formatRgb() { - return this.rgb().formatRgb(); -} - -function color(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 - : null) // invalid hex - : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = 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]) // eslint-disable-line no-prototype-builtins - : format === "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 <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); -} - -function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); -} - -function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); -} - -function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; -} - -define(Rgb, rgb, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker: function(k) { - k = k == 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 <= this.r && this.r < 255.5) - && (-0.5 <= this.g && this.g < 255.5) - && (-0.5 <= this.b && this.b < 255.5) - && (0 <= this.opacity && this.opacity <= 1); - }, - hex: rgb_formatHex, // Deprecated! Use color.formatHex. - formatHex: rgb_formatHex, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb -})); - -function rgb_formatHex() { - return "#" + hex(this.r) + hex(this.g) + hex(this.b); -} - -function rgb_formatRgb() { - var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 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 === 1 ? ")" : ", " + a + ")"); -} - -function hex(value) { - value = 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 <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = 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 = color(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - h = NaN, - s = max - min, - l = (max + min) / 2; - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else { - s = l > 0 && l < 1 ? 0 : h; - } - return new Hsl(h, s, l, o.opacity); -} - -function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); -} - -function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} - -define(Hsl, hsl, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = this.h % 360 + (this.h < 0) * 360, - s = isNaN(h) || isNaN(this.s) ? 0 : this.s, - l = this.l, - m2 = l + (l < 0.5 ? l : 1 - l) * s, - m1 = 2 * l - m2; - return new Rgb( - hsl2rgb(h >= 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 <= this.s && this.s <= 1 || isNaN(this.s)) - && (0 <= this.l && this.l <= 1) - && (0 <= this.opacity && this.opacity <= 1); - }, - formatHsl: function() { - var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 1 ? "hsl(" : "hsla(") - + (this.h || 0) + ", " - + (this.s || 0) * 100 + "%, " - + (this.l || 0) * 100 + "%" - + (a === 1 ? ")" : ", " + a + ")"); - } -})); - -/* 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 = Math.PI / 180; -var rad2deg = 180 / Math.PI; - -// https://observablehq.com/@mbostock/lab-and-rgb -var K = 18, - Xn = 0.96422, - Yn = 1, - Zn = 0.82521, - t0 = 4 / 29, - t1 = 6 / 29, - t2 = 3 * t1 * t1, - t3 = 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 = rgbConvert(o); - var r = rgb2lrgb(o.r), - g = rgb2lrgb(o.g), - b = rgb2lrgb(o.b), - y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; - if (r === g && g === b) x = z = y; else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = 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 == null ? 1 : opacity); -} - -function lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); -} - -function Lab(l, a, b, opacity) { - this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; -} - -define(Lab, lab, extend(Color, { - brighter: function(k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker: function(k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb: function() { - var y = (this.l + 16) / 116, - x = isNaN(this.a) ? y : y + this.a / 500, - z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = 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 <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); -} - -function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 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 = labConvert(o); - if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h = 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 === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} - -function hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} - -function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; - this.l = +l; - this.opacity = +opacity; -} - -function hcl2lab(o) { - if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h = 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 == null ? 1 : k), this.opacity); - }, - darker: function(k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb: function() { - return hcl2lab(this).rgb(); - } -})); - -var A = -0.14861, - B = +1.78277, - C = -0.29227, - D = -0.90649, - E = +1.97294, - ED = E * D, - EB = E * B, - BC_DA = 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 = rgbConvert(o); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), - bl = b - l, - k = (E * (g - l) - C * bl) / D, - s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 - h = 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 === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); -} - -function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} - -define(Cubehelix, cubehelix, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, - l = +this.l, - a = isNaN(this.s) ? 0 : this.s * l * (1 - l), - cosh = Math.cos(h), - sinh = 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 - ); - } -})); - -exports.color = color; -exports.cubehelix = cubehelix; -exports.gray = gray; -exports.hcl = hcl; -exports.hsl = hsl; -exports.lab = lab; -exports.lch = lch; -exports.rgb = rgb; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-color/dist/d3-color.min.js b/node_modules/d3-color/dist/d3-color.min.js deleted file mode 100644 index 36ffffb..0000000 --- a/node_modules/d3-color/dist/d3-color.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-color/ v1.4.1 Copyright 2020 Mike Bostock -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";function e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function n(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function i(){}var r="\\s*([+-]?\\d+)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",s="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",o=/^#([0-9a-f]{3,8})$/,h=new RegExp("^rgb\\("+[r,r,r]+"\\)$"),l=new RegExp("^rgb\\("+[s,s,s]+"\\)$"),u=new RegExp("^rgba\\("+[r,r,r,a]+"\\)$"),c=new RegExp("^rgba\\("+[s,s,s,a]+"\\)$"),g=new RegExp("^hsl\\("+[a,s,s]+"\\)$"),f=new RegExp("^hsla\\("+[a,s,s,a]+"\\)$"),d={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function p(){return this.rgb().formatHex()}function b(){return this.rgb().formatRgb()}function y(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=o.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?w(e):3===n?new M(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?m(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?m(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=h.exec(t))?new M(e[1],e[2],e[3],1):(e=l.exec(t))?new M(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=u.exec(t))?m(e[1],e[2],e[3],e[4]):(e=c.exec(t))?m(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=g.exec(t))?R(e[1],e[2]/100,e[3]/100,1):(e=f.exec(t))?R(e[1],e[2]/100,e[3]/100,e[4]):d.hasOwnProperty(t)?w(d[t]):"transparent"===t?new M(NaN,NaN,NaN,0):null}function w(t){return new M(t>>16&255,t>>8&255,255&t,1)}function m(t,e,n,i){return i<=0&&(t=e=n=NaN),new M(t,e,n,i)}function N(t){return t instanceof i||(t=y(t)),t?new M((t=t.rgb()).r,t.g,t.b,t.opacity):new M}function k(t,e,n,i){return 1===arguments.length?N(t):new M(t,e,n,null==i?1:i)}function M(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function v(){return"#"+q(this.r)+q(this.g)+q(this.b)}function x(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"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))+(1===t?")":", "+t+")")}function q(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function R(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new H(t,e,n,i)}function E(t){if(t instanceof H)return new H(t.h,t.s,t.l,t.opacity);if(t instanceof i||(t=y(t)),!t)return new H;if(t instanceof H)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,a=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,h=s-a,l=(s+a)/2;return h?(o=e===s?(n-r)/h+6*(n0&&l<1?0:o,new H(o,h,l,t.opacity)}function $(t,e,n,i){return 1===arguments.length?E(t):new H(t,e,n,null==i?1:i)}function H(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function j(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}e(i,y,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:p,formatHex:p,formatHsl:function(){return E(this).formatHsl()},formatRgb:b,toString:b}),e(M,k,n(i,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new M(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new M(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:v,formatHex:v,formatRgb:x,toString:x})),e(H,$,n(i,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new H(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new H(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new M(j(t>=240?t-240:t+120,r,i),j(t,r,i),j(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var O=Math.PI/180,P=180/Math.PI,I=.96422,S=1,_=.82521,z=4/29,C=6/29,L=3*C*C,A=C*C*C;function B(t){if(t instanceof F)return new F(t.l,t.a,t.b,t.opacity);if(t instanceof V)return W(t);t instanceof M||(t=N(t));var e,n,i=Q(t.r),r=Q(t.g),a=Q(t.b),s=G((.2225045*i+.7168786*r+.0606169*a)/S);return i===r&&r===a?e=n=s:(e=G((.4360747*i+.3850649*r+.1430804*a)/I),n=G((.0139322*i+.0971045*r+.7141733*a)/_)),new F(116*s-16,500*(e-s),200*(s-n),t.opacity)}function D(t,e,n,i){return 1===arguments.length?B(t):new F(t,e,n,null==i?1:i)}function F(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function G(t){return t>A?Math.pow(t,1/3):t/L+z}function J(t){return t>C?t*t*t:L*(t-z)}function K(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Q(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function T(t){if(t instanceof V)return new V(t.h,t.c,t.l,t.opacity);if(t instanceof F||(t=B(t)),0===t.a&&0===t.b)return new V(NaN,0> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 - : null) // invalid hex - : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = 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]) // eslint-disable-line no-prototype-builtins - : format === "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 <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); -} - -export function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); -} - -export function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); -} - -export function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; -} - -define(Rgb, rgb, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker: function(k) { - k = k == 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 <= this.r && this.r < 255.5) - && (-0.5 <= this.g && this.g < 255.5) - && (-0.5 <= this.b && this.b < 255.5) - && (0 <= this.opacity && this.opacity <= 1); - }, - hex: rgb_formatHex, // Deprecated! Use color.formatHex. - formatHex: rgb_formatHex, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb -})); - -function rgb_formatHex() { - return "#" + hex(this.r) + hex(this.g) + hex(this.b); -} - -function rgb_formatRgb() { - var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 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 === 1 ? ")" : ", " + a + ")"); -} - -function hex(value) { - value = 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 <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = NaN; - return new Hsl(h, s, l, a); -} - -export function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - h = NaN, - s = max - min, - l = (max + min) / 2; - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else { - s = l > 0 && l < 1 ? 0 : h; - } - return new Hsl(h, s, l, o.opacity); -} - -export function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); -} - -function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} - -define(Hsl, hsl, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = this.h % 360 + (this.h < 0) * 360, - s = isNaN(h) || isNaN(this.s) ? 0 : this.s, - l = this.l, - m2 = l + (l < 0.5 ? l : 1 - l) * s, - m1 = 2 * l - m2; - return new Rgb( - hsl2rgb(h >= 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 <= this.s && this.s <= 1 || isNaN(this.s)) - && (0 <= this.l && this.l <= 1) - && (0 <= this.opacity && this.opacity <= 1); - }, - formatHsl: function() { - var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 1 ? "hsl(" : "hsla(") - + (this.h || 0) + ", " - + (this.s || 0) * 100 + "%, " - + (this.l || 0) * 100 + "%" - + (a === 1 ? ")" : ", " + a + ")"); - } -})); - -/* 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; -} diff --git a/node_modules/d3-color/src/cubehelix.js b/node_modules/d3-color/src/cubehelix.js deleted file mode 100644 index bc31659..0000000 --- a/node_modules/d3-color/src/cubehelix.js +++ /dev/null @@ -1,61 +0,0 @@ -import define, {extend} from "./define.js"; -import {Color, rgbConvert, Rgb, darker, brighter} from "./color.js"; -import {deg2rad, rad2deg} from "./math.js"; - -var A = -0.14861, - B = +1.78277, - C = -0.29227, - D = -0.90649, - E = +1.97294, - ED = E * D, - EB = E * B, - BC_DA = 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 = rgbConvert(o); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), - bl = b - l, - k = (E * (g - l) - C * bl) / D, - s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 - h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; - return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); -} - -export default function cubehelix(h, s, l, opacity) { - return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); -} - -export function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} - -define(Cubehelix, cubehelix, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, - l = +this.l, - a = isNaN(this.s) ? 0 : this.s * l * (1 - l), - cosh = Math.cos(h), - sinh = 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 - ); - } -})); diff --git a/node_modules/d3-color/src/define.js b/node_modules/d3-color/src/define.js deleted file mode 100644 index 2bba2d3..0000000 --- a/node_modules/d3-color/src/define.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; -} - -export function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for (var key in definition) prototype[key] = definition[key]; - return prototype; -} diff --git a/node_modules/d3-color/src/index.js b/node_modules/d3-color/src/index.js deleted file mode 100644 index 831cf52..0000000 --- a/node_modules/d3-color/src/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export {default as color, rgb, hsl} from "./color.js"; -export {default as lab, hcl, lch, gray} from "./lab.js"; -export {default as cubehelix} from "./cubehelix.js"; diff --git a/node_modules/d3-color/src/lab.js b/node_modules/d3-color/src/lab.js deleted file mode 100644 index b27196e..0000000 --- a/node_modules/d3-color/src/lab.js +++ /dev/null @@ -1,123 +0,0 @@ -import define, {extend} from "./define.js"; -import {Color, rgbConvert, Rgb} from "./color.js"; -import {deg2rad, rad2deg} from "./math.js"; - -// https://observablehq.com/@mbostock/lab-and-rgb -var K = 18, - Xn = 0.96422, - Yn = 1, - Zn = 0.82521, - t0 = 4 / 29, - t1 = 6 / 29, - t2 = 3 * t1 * t1, - t3 = 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 = rgbConvert(o); - var r = rgb2lrgb(o.r), - g = rgb2lrgb(o.g), - b = rgb2lrgb(o.b), - y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; - if (r === g && g === b) x = z = y; else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = 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); -} - -export function gray(l, opacity) { - return new Lab(l, 0, 0, opacity == null ? 1 : opacity); -} - -export default function lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); -} - -export function Lab(l, a, b, opacity) { - this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; -} - -define(Lab, lab, extend(Color, { - brighter: function(k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker: function(k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb: function() { - var y = (this.l + 16) / 116, - x = isNaN(this.a) ? y : y + this.a / 500, - z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = 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 <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); -} - -function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 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 = labConvert(o); - if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h = 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); -} - -export function lch(l, c, h, opacity) { - return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} - -export function hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} - -export function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; - this.l = +l; - this.opacity = +opacity; -} - -function hcl2lab(o) { - if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h = 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 == null ? 1 : k), this.opacity); - }, - darker: function(k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb: function() { - return hcl2lab(this).rgb(); - } -})); diff --git a/node_modules/d3-color/src/math.js b/node_modules/d3-color/src/math.js deleted file mode 100644 index e94b840..0000000 --- a/node_modules/d3-color/src/math.js +++ /dev/null @@ -1,2 +0,0 @@ -export var deg2rad = Math.PI / 180; -export var rad2deg = 180 / Math.PI; diff --git a/node_modules/d3-delaunay/LICENSE b/node_modules/d3-delaunay/LICENSE deleted file mode 100644 index cf16bc4..0000000 --- a/node_modules/d3-delaunay/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2018 Observable, Inc. - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. diff --git a/node_modules/d3-delaunay/README.md b/node_modules/d3-delaunay/README.md deleted file mode 100644 index baf0481..0000000 --- a/node_modules/d3-delaunay/README.md +++ /dev/null @@ -1,201 +0,0 @@ -# d3-delaunay - -

-

Georgy “The Voronator” Voronoy - -This is a fast, no-dependency library for computing the [Voronoi diagram](https://en.wikipedia.org/wiki/Voronoi_diagram) of a set of two-dimensional points. It is based on [Delaunator](https://github.com/mapbox/delaunator), a fast library for computing the [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation) using [sweep algorithms](https://github.com/mapbox/delaunator/blob/master/README.md#papers). The Voronoi diagram is constructed by connecting the circumcenters of adjacent triangles in the Delaunay triangulation. - -For an interactive explanation of how this library works, see [The Delaunay’s Dual](https://observablehq.com/@mbostock/the-delaunays-dual). - -## Installing - -To install, `npm install d3-delaunay` or `yarn add d3-delaunay`. You can also download the [latest release](https://github.com/d3/d3-delaunay/releases/latest) or load directly from [unpkg](https://unpkg.com/d3-delaunay/). AMD, CommonJS and ES6+ environments are supported. In vanilla, a `d3` global is exported. - -```js -import {Delaunay} from "d3-delaunay"; - -const points = [[0, 0], [0, 1], [1, 0], [1, 1]]; -const delaunay = Delaunay.from(points); -const voronoi = delaunay.voronoi([0, 0, 960, 500]); -``` - -## API Reference - -### Delaunay - -# new Delaunay(points) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Returns the Delaunay triangulation for the given flat array [*x0*, *y0*, *x1*, *y1*, …] of *points*. - -```js -const delaunay = new Delaunay(Float64Array.of(0, 0, 0, 1, 1, 0, 1, 1)); -``` - -# Delaunay.from(points[, fx[, fy[, that]]]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Returns the Delaunay triangulation for the given array or iterable of *points*. If *fx* and *fy* are not specified, then *points* is assumed to be an array of two-element arrays of numbers: [[*x0*, *y0*], [*x1*, *y1*], …]. Otherwise, *fx* and *fy* are functions that are invoked for each element in the *points* array in order, and must return the respective *x*- and *y*-coordinate for each point. If *that* is specified, the functions *fx* and *fy* are invoked with *that* as *this*. (See [Array.from](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/from) for reference.) - -```js -const delaunay = Delaunay.from([[0, 0], [0, 1], [1, 0], [1, 1]]); -``` - -# delaunay.points - -The coordinates of the points as an array [*x0*, *y0*, *x1*, *y1*, …]. Typically, this is a Float64Array, however you can use any array-like type in the [constructor](#new_Delaunay). - -# delaunay.halfedges - -The halfedge indexes as an Int32Array [*j0*, *j1*, …]. For each index 0 ≤ *i* < *halfedges*.length, there is a halfedge from triangle vertex *j* = *halfedges*[*i*] to triangle vertex *i*. Equivalently, this means that triangle ⌊*i* / 3⌋ is adjacent to triangle ⌊*j* / 3⌋. If *j* is negative, then triangle ⌊*i* / 3⌋ is an exterior triangle on the [convex hull](#delaunay_hull). For example, to render the internal edges of the Delaunay triangulation: - -```js -const {points, halfedges, triangles} = delaunay; -for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i]; - const tj = triangles[j]; - context.moveTo(points[ti * 2], points[ti * 2 + 1]); - context.lineTo(points[tj * 2], points[tj * 2 + 1]); -} -``` - -See also [*delaunay*.render](#delaunay_render). - -# delaunay.hull - -An Int32Array of point indexes that form the convex hull in counterclockwise order. If the points are collinear, returns them ordered. - -See also [*delaunay*.renderHull](#delaunay_renderHull). - -# delaunay.triangles - -The triangle vertex indexes as an Uint32Array [*i0*, *j0*, *k0*, *i1*, *j1*, *k1*, …]. Each contiguous triplet of indexes *i*, *j*, *k* forms a counterclockwise triangle. The coordinates of the triangle’s points can be found by going through [*delaunay*.points](#delaunay_points). For example, to render triangle *i*: - -```js -const {points, triangles} = delaunay; -const t0 = triangles[i * 3 + 0]; -const t1 = triangles[i * 3 + 1]; -const t2 = triangles[i * 3 + 2]; -context.moveTo(points[t0 * 2], points[t0 * 2 + 1]); -context.lineTo(points[t1 * 2], points[t1 * 2 + 1]); -context.lineTo(points[t2 * 2], points[t2 * 2 + 1]); -context.closePath(); -``` - -See also [*delaunay*.renderTriangle](#delaunay_renderTriangle). - -# delaunay.inedges - -The incoming halfedge indexes as a Int32Array [*e0*, *e1*, *e2*, …]. For each point *i*, *inedges*[*i*] is the halfedge index *e* of an incoming halfedge. For coincident points, the halfedge index is -1; for points on the convex hull, the incoming halfedge is on the convex hull; for other points, the choice of incoming halfedge is arbitrary. The *inedges* table can be used to traverse the Delaunay triangulation; see also [*delaunay*.neighbors](#delaunay_neighbors). - -# delaunay.find(x, y[, i]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Returns the index of the input point that is closest to the specified point ⟨*x*, *y*⟩. The search is started at the specified point *i*. If *i* is not specified, it defaults to zero. - -# delaunay.neighbors(i) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Returns an iterable over the indexes of the neighboring points to the specified point *i*. The iterable is empty if *i* is a coincident point. - -# delaunay.render([context]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -delaunay.render - -Renders the edges of the Delaunay triangulation to the specified *context*. The specified *context* must implement the *context*.moveTo and *context*.lineTo methods from the [CanvasPathMethods API](https://www.w3.org/TR/2dcontext/#canvaspathmethods). If a *context* is not specified, an SVG path string is returned instead. - -# delaunay.renderHull([context]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -delaunay.renderHull - -Renders the convex hull of the Delaunay triangulation to the specified *context*. The specified *context* must implement the *context*.moveTo and *context*.lineTo methods from the [CanvasPathMethods API](https://www.w3.org/TR/2dcontext/#canvaspathmethods). If a *context* is not specified, an SVG path string is returned instead. - -# delaunay.renderTriangle(i[, context]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -delaunay.renderTriangle - -Renders triangle *i* of the Delaunay triangulation to the specified *context*. The specified *context* must implement the *context*.moveTo, *context*.lineTo and *context*.closePath methods from the [CanvasPathMethods API](https://www.w3.org/TR/2dcontext/#canvaspathmethods). If a *context* is not specified, an SVG path string is returned instead. - -# delaunay.renderPoints(\[context\]\[, radius\]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Renders the input points of the Delaunay triangulation to the specified *context* as circles with the specified *radius*. If *radius* is not specified, it defaults to 2. The specified *context* must implement the *context*.moveTo and *context*.arc methods from the [CanvasPathMethods API](https://www.w3.org/TR/2dcontext/#canvaspathmethods). If a *context* is not specified, an SVG path string is returned instead. - -# delaunay.hullPolygon() [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Returns the closed polygon [[*x0*, *y0*], [*x1*, *y1*], …, [*x0*, *y0*]] representing the convex hull. - -# delaunay.trianglePolygons() [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Returns an iterable over the [polygons for each triangle](#delaunay_trianglePolygon), in order. - -# delaunay.trianglePolygon(i) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Returns the closed polygon [[*x0*, *y0*], [*x1*, *y1*], [*x2*, *y2*], [*x0*, *y0*]] representing the triangle *i*. - -# delaunay.update() [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Updates the triangulation after the points have been modified in-place. - -# delaunay.voronoi([bounds]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/delaunay.js "Source") - -Returns the [Voronoi diagram](#voronoi) for the associated [points](#delaunay_points). When rendering, the diagram will be clipped to the specified *bounds* = [*xmin*, *ymin*, *xmax*, *ymax*]. If *bounds* is not specified, it defaults to [0, 0, 960, 500]. See [To Infinity and Back Again](https://observablehq.com/@mbostock/to-infinity-and-back-again) for an interactive explanation of Voronoi cell clipping. - -The Voronoi diagram is returned even in degenerate cases where no triangulation exists — namely 0, 1 or 2 points, and collinear points. - -### Voronoi - -# voronoi.delaunay - -The Voronoi diagram’s associated [Delaunay triangulation](#delaunay). - -# voronoi.circumcenters - -The [circumcenters](http://mathworld.wolfram.com/Circumcenter.html) of the Delaunay triangles as a Float64Array [*cx0*, *cy0*, *cx1*, *cy1*, …]. Each contiguous pair of coordinates *cx*, *cy* is the circumcenter for the corresponding triangle. These circumcenters form the coordinates of the Voronoi cell polygons. - -# voronoi.vectors - -A Float64Array [*vx0*, *vy0*, *wx0*, *wy0*, …] where each non-zero quadruple describes an open (infinite) cell on the outer hull, giving the directions of two open half-lines. - -# voronoi.xmin
-# voronoi.ymin
-# voronoi.xmax
-# voronoi.ymax
- -The bounds of the viewport [*xmin*, *ymin*, *xmax*, *ymax*] for rendering the Voronoi diagram. These values only affect the rendering methods ([*voronoi*.render](#voronoi_render), [*voronoi*.renderBounds](#voronoi_renderBounds), [*cell*.render](#cell_render)). - -# voronoi.contains(i, x, y) [<>](https://github.com/d3/d3-delaunay/blob/master/src/cell.js "Source") - -Returns true if the cell with the specified index *i* contains the specified point ⟨*x*, *y*⟩. (This method is not affected by the associated Voronoi diagram’s viewport [bounds](#voronoi_xmin).) - -# voronoi.neighbors(i) [<>](https://github.com/d3/d3-delaunay/blob/master/src/voronoi.js "Source") - -Returns an iterable over the indexes of the cells that share a common edge with the specified cell *i*. Voronoi neighbors are always neighbors on the Delaunay graph, but the converse is false when the common edge has been clipped out by the Voronoi diagram’s viewport. - -# voronoi.render([context]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/voronoi.js "Source") - -voronoi.render - -Renders the mesh of Voronoi cells to the specified *context*. The specified *context* must implement the *context*.moveTo and *context*.lineTo methods from the [CanvasPathMethods API](https://www.w3.org/TR/2dcontext/#canvaspathmethods). If a *context* is not specified, an SVG path string is returned instead. - -# voronoi.renderBounds([context]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/voronoi.js "Source") - -voronoi.renderBounds - -Renders the viewport extent to the specified *context*. The specified *context* must implement the *context*.rect method from the [CanvasPathMethods API](https://www.w3.org/TR/2dcontext/#canvaspathmethods). Equivalent to *context*.rect(*voronoi*.xmin, *voronoi*.ymin, *voronoi*.xmax - *voronoi*.xmin, *voronoi*.ymax - *voronoi*.ymin). If a *context* is not specified, an SVG path string is returned instead. - -# voronoi.renderCell(i[, context]) [<>](https://github.com/d3/d3-delaunay/blob/master/src/voronoi.js "Source") - -cell.render - -Renders the cell with the specified index *i* to the specified *context*. The specified *context* must implement the *context*.moveTo , *context*.lineTo and *context*.closePath methods from the [CanvasPathMethods API](https://www.w3.org/TR/2dcontext/#canvaspathmethods). If a *context* is not specified, an SVG path string is returned instead. - -# voronoi.cellPolygons() [<>](https://github.com/d3/d3-delaunay/blob/master/src/voronoi.js "Source") - -Returns an iterable over the non-empty [polygons for each cell](#voronoi_cellPolygon), with the cell index as property. - -# voronoi.cellPolygon(i) [<>](https://github.com/d3/d3-delaunay/blob/master/src/voronoi.js "Source") - -Returns the convex, closed polygon [[*x0*, *y0*], [*x1*, *y1*], …, [*x0*, *y0*]] representing the cell for the specified point *i*. - -# voronoi.update() [<>](https://github.com/d3/d3-delaunay/blob/master/src/voronoi.js "Source") - -Updates the Voronoi diagram and underlying triangulation after the points have been modified in-place — useful for Lloyd’s relaxation. - diff --git a/node_modules/d3-delaunay/dist/d3-delaunay.js b/node_modules/d3-delaunay/dist/d3-delaunay.js deleted file mode 100644 index 6ab6164..0000000 --- a/node_modules/d3-delaunay/dist/d3-delaunay.js +++ /dev/null @@ -1,1123 +0,0 @@ -// https://github.com/d3/d3-delaunay v5.3.0 Copyright 2020 Mike Bostock -// https://github.com/mapbox/delaunator v4.0.1. Copyright 2019 Mapbox, Inc. -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -const EPSILON = Math.pow(2, -52); -const EDGE_STACK = new Uint32Array(512); - -class Delaunator { - - static from(points, getX = defaultGetX, getY = defaultGetY) { - const n = points.length; - const coords = new Float64Array(n * 2); - - for (let i = 0; i < n; i++) { - const p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - - return new Delaunator(coords); - } - - constructor(coords) { - const n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - - this.coords = coords; - - // arrays that will store the triangulation graph - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash - - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - - this.update(); - } - - update() { - const {coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash} = this; - const n = coords.length >> 1; - - // populate an array of point indices; calculate input data bbox - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - - for (let i = 0; i < n; i++) { - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - - let minDist = Infinity; - let i0, i1, i2; - - // pick a seed point close to the center - for (let i = 0; i < n; i++) { - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } - } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - - minDist = Infinity; - - // find the point closest to the seed - for (let i = 0; i < n; i++) { - if (i === i0) continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } - } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - - let minRadius = Infinity; - - // find the third point which forms the smallest circumcircle with the first two - for (let i = 0; i < n; i++) { - if (i === i0 || i === i1) continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } - } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for (let i = 0; i < n; i++) { - this._dists[i] = (coords[2 * i] - coords[0]) || (coords[2 * i + 1] - coords[1]); - } - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for (let i = 0, d0 = -Infinity; i < n; i++) { - const id = this._ids[i]; - if (this._dists[id] > d0) { - hull[j++] = id; - d0 = this._dists[id]; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } - - // swap the order of the seed points for counter-clockwise orientation - if (orient(i0x, i0y, i1x, i1y, i2x, i2y)) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - - for (let i = 0; i < n; i++) { - this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - } - - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - - // set up the seed triangle as the starting hull - this._hullStart = i0; - let hullSize = 3; - - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - - for (let k = 0, xp, yp; k < this._ids.length; k++) { - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - - // skip near-duplicate points - if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue; - xp = x; - yp = y; - - // skip seed triangle points - if (i === i0 || i === i1 || i === i2) continue; - - // find a visible edge on the convex hull using edge hash - let start = 0; - for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) { - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - - start = hullPrev[start]; - let e = start, q; - while (q = hullNext[e], !orient(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) { - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) continue; // likely a near-duplicate point; skip it - - // add the first triangle from the point - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - - // walk forward through the hull, adding more triangles and flipping recursively - let n = hullNext[e]; - while (q = hullNext[n], orient(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1])) { - t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]); - hullTri[i] = this._legalize(t + 2); - hullNext[n] = n; // mark as removed - hullSize--; - n = q; - } - - // walk backward from the other side, adding more triangles and flipping - if (e === start) { - while (q = hullPrev[e], orient(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) { - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - } - - // update the hull indices - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n] = i; - hullNext[i] = n; - - // save the two new edges in the hash table - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - - this.hull = new Uint32Array(hullSize); - for (let i = 0, e = this._hullStart; i < hullSize; i++) { - this.hull[i] = e; - e = hullNext[e]; - } - - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - - _legalize(a) { - const {_triangles: triangles, _halfedges: halfedges, coords} = this; - - let i = 0; - let ar = 0; - - // recursion eliminated with a fixed-size stack - while (true) { - const b = halfedges[a]; - - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ - const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - - if (b === -1) { // convex hull edge - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - - const illegal = inCircle( - coords[2 * p0], coords[2 * p0 + 1], - coords[2 * pr], coords[2 * pr + 1], - coords[2 * pl], coords[2 * pl + 1], - coords[2 * p1], coords[2 * p1 + 1]); - - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - - const hbl = halfedges[bl]; - - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - - const br = b0 + (b + 1) % 3; - - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = br; - } - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - - return ar; - } - - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } - - // add a new triangle given vertex indices and adjacent half-edge ids - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - - this.trianglesLen += 3; - - return t; - } -} - -// monotonically increases with real angle, but doesn't need expensive trigonometry -function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] -} - -function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; -} - -// return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check -function orientIfSure(px, py, rx, ry, qx, qy) { - const l = (ry - py) * (qx - px); - const r = (rx - px) * (qy - py); - return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0; -} - -// a more robust orientation test that's stable in a given triangle (to fix robustness issues) -function orient(rx, ry, qx, qy, px, py) { - const sign = orientIfSure(px, py, rx, ry, qx, qy) || - orientIfSure(rx, ry, qx, qy, px, py) || - orientIfSure(qx, qy, px, py, rx, ry); - return sign < 0; -} - -function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - - return dx * (ey * cp - bp * fy) - - dy * (ex * cp - bp * fx) + - ap * (ex * fy - ey * fx) < 0; -} - -function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - - return x * x + y * y; -} - -function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - - return {x, y}; -} - -function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (let i = left + 1; i <= right; i++) { - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; - ids[j + 1] = temp; - } - } else { - const median = (left + right) >> 1; - let i = left + 1; - let j = right; - swap(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); - - const temp = ids[i]; - const tempDist = dists[temp]; - while (true) { - do i++; while (dists[ids[i]] < tempDist); - do j--; while (dists[ids[j]] > tempDist); - if (j < i) break; - swap(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); - } - } -} - -function swap(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - -function defaultGetX(p) { - return p[0]; -} -function defaultGetY(p) { - return p[1]; -} - -const epsilon = 1e-6; - -class Path { - constructor() { - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; - } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; - } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; - } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; - } - value() { - return this._ || null; - } -} - -class Polygon { - constructor() { - this._ = []; - } - moveTo(x, y) { - this._.push([x, y]); - } - closePath() { - this._.push(this._[0].slice()); - } - lineTo(x, y) { - this._.push([x, y]); - } - value() { - return this._.length ? this._ : null; - } -} - -class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); - } - update() { - this.delaunay.update(); - this._init(); - return this; - } - _init() { - const {delaunay: {points, hull, triangles}, vectors} = this; - - // Compute circumcenters. - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for (let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2) { - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x1 = points[t1]; - const y1 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - - const dx = x2 - x1; - const dy = y2 - y1; - const ex = x3 - x1; - const ey = y3 - y1; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const ab = (dx * ey - dy * ex) * 2; - - if (!ab) { - // degenerate case (collinear diagram) - x = (x1 + x3) / 2 - 1e8 * ey; - y = (y1 + y3) / 2 + 1e8 * ex; - } - else if (Math.abs(ab) < 1e-8) { - // almost equal points (degenerate triangle) - x = (x1 + x3) / 2; - y = (y1 + y3) / 2; - } else { - const d = 1 / ab; - x = x1 + (ey * bl - dy * cl) * d; - y = y1 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - - // Compute exterior cell rays. - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for (let i = 0; i < hull.length; ++i) { - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new Path : undefined; - const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this; - if (hull.length <= 1) return null; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for (let i = 0; i < hull.length; ++i) { - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new Path : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new Path : undefined; - const points = this._clip(i); - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - let n = points.length; - while (points[0] === points[n-2] && points[1] === points[n-1] && n > 1) n -= 2; - for (let i = 2; i < n; i += 2) { - if (points[i] !== points[i-2] || points[i+1] !== points[i-1]) - context.lineTo(points[i], points[i + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - *cellPolygons() { - const {delaunay: {points}} = this; - for (let i = 0, n = points.length / 2; i < n; ++i) { - const cell = this.cellPolygon(i); - if (cell) cell.index = i, yield cell; - } - } - cellPolygon(i) { - const polygon = new Polygon; - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } - } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; - } - *neighbors(i) { - const ci = this._clip(i); - if (ci) for (const j of this.delaunay.neighbors(i)) { - const cj = this._clip(j); - // find the common edge - if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { - for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { - if (ci[ai] == cj[aj] - && ci[ai + 1] == cj[aj + 1] - && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] - && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj] - ) { - yield j; - break loop; - } - } - } - } - } - _cell(i) { - const {circumcenters, delaunay: {inedges, halfedges, triangles}} = this; - const e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - } while (e !== e0 && e !== -1); - return points; - } - _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - const points = this._cell(i); - if (points === null) return null; - const {vectors: V} = this; - const v = i * 4; - return V[v] || V[v + 1] - ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) - : this._clipFinite(i, points); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1; - for (let j = 0; j < n; j += 2) { - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1); - else P = [x1, y1]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0); - else P = [sx0, sy0]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1); - else P = [sx1, sy1]; - } - } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - while (true) { - if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1]; - if (c0 & c1) return null; - let x, y, c = c0 || c1; - if (c & 0b1000) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 0b0100) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 0b0010) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) { - for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; - } - return P; - } - _edge(i, e0, e1, P, j) { - while (e0 !== e1) { - let x, y; - switch (e0) { - case 0b0101: e0 = 0b0100; continue; // top-left - case 0b0100: e0 = 0b0110, x = this.xmax, y = this.ymin; break; // top - case 0b0110: e0 = 0b0010; continue; // top-right - case 0b0010: e0 = 0b1010, x = this.xmax, y = this.ymax; break; // right - case 0b1010: e0 = 0b1000; continue; // bottom-right - case 0b1000: e0 = 0b1001, x = this.xmin, y = this.ymax; break; // bottom - case 0b1001: e0 = 0b0001; continue; // bottom-left - case 0b0001: e0 = 0b0101, x = this.xmin, y = this.ymin; break; // left - } - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) { - P.splice(j, 0, x, y), j += 2; - } - } - if (P.length > 4) { - for (let i = 0; i < P.length; i+= 2) { - const j = (i + 2) % P.length, k = (i + 4) % P.length; - if (P[i] === P[j] && P[j] === P[k] - || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) - P.splice(j, 2), i -= 2; - } - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { // top - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { // bottom - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { // right - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { // left - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - return [x, y]; - } - _edgecode(x, y) { - return (x === this.xmin ? 0b0001 - : x === this.xmax ? 0b0010 : 0b0000) - | (y === this.ymin ? 0b0100 - : y === this.ymax ? 0b1000 : 0b0000); - } - _regioncode(x, y) { - return (x < this.xmin ? 0b0001 - : x > this.xmax ? 0b0010 : 0b0000) - | (y < this.ymin ? 0b0100 - : y > this.ymax ? 0b1000 : 0b0000); - } -} - -const tau = 2 * Math.PI, pow = Math.pow; - -function pointX(p) { - return p[0]; -} - -function pointY(p) { - return p[1]; -} - -// A triangulation is collinear if all its triangles have a non-null area -function collinear(d) { - const {triangles, coords} = d; - for (let i = 0; i < triangles.length; i += 3) { - const a = 2 * triangles[i], - b = 2 * triangles[i + 1], - c = 2 * triangles[i + 2], - cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1]) - - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]); - if (cross > 1e-10) return false; - } - return true; -} - -function jitter(x, y, r) { - return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r]; -} - -class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points - ? flatArray(points, fx, fy, that) - : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points) { - this._delaunator = new Delaunator(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); - } - update() { - this._delaunator.update(); - this._init(); - return this; - } - _init() { - const d = this._delaunator, points = this.points; - - // check for collinear - if (d.hull && d.hull.length > 2 && collinear(d)) { - this.collinear = Int32Array.from({length: points.length/2}, (_,i) => i) - .sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], - bounds = [ points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1] ], - r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for (let i = 0, n = points.length / 2; i < n; ++i) { - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new Delaunator(points); - } else { - delete this.collinear; - } - - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - - // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - for (let e = 0, n = halfedges.length; e < n; ++e) { - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; - } - for (let i = 0, n = hull.length; i < n; ++i) { - hullIndex[hull[i]] = i; - } - - // degenerate case: 1 or 2 (distinct) points - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - inedges[hull[0]] = 1; - if (hull.length === 2) inedges[hull[1]] = 0; - } - } - voronoi(bounds) { - return new Voronoi(this, bounds); - } - *neighbors(i) { - const {inedges, hull, _hullIndex, halfedges, triangles, collinear} = this; - - // degenerate case with several collinear points - if (collinear) { - const l = collinear.indexOf(i); - if (l > 0) yield collinear[l - 1]; - if (l < collinear.length - 1) yield collinear[l + 1]; - return; - } - - const e0 = inedges[i]; - if (e0 === -1) return; // coincident point - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) return; // bad triangulation - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) yield p; - return; - } - } while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - const i0 = i; - let c; - while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) i = c; - return c; - } - _step(i, x, y) { - const {inedges, hull, _hullIndex, halfedges, triangles, points} = this; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) return e; - } - break; - } - } while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new Path : undefined; - const {points, halfedges, triangles} = this; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r = 2) { - const buffer = context == null ? context = new Path : undefined; - const {points} = this; - for (let i = 0, n = points.length; i < n; i += 2) { - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new Path : undefined; - const {hull, points} = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for (let i = 1; i < n; ++i) { - const h = 2 * hull[i]; - context.lineTo(points[h], points[h + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - hullPolygon() { - const polygon = new Polygon; - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new Path : undefined; - const {points, triangles} = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); - } - *trianglePolygons() { - const {triangles} = this; - for (let i = 0, n = triangles.length / 3; i < n; ++i) { - yield this.trianglePolygon(i); - } - } - trianglePolygon(i) { - const polygon = new Polygon; - this.renderTriangle(i, polygon); - return polygon.value(); - } -} - -function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for (let i = 0; i < n; ++i) { - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; -} - -function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points) { - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; - } -} - -exports.Delaunay = Delaunay; -exports.Voronoi = Voronoi; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-delaunay/dist/d3-delaunay.min.js b/node_modules/d3-delaunay/dist/d3-delaunay.min.js deleted file mode 100644 index 2473bdf..0000000 --- a/node_modules/d3-delaunay/dist/d3-delaunay.min.js +++ /dev/null @@ -1,3 +0,0 @@ -// https://github.com/d3/d3-delaunay v5.3.0 Copyright 2020 Mike Bostock -// https://github.com/mapbox/delaunator v4.0.1. Copyright 2019 Mapbox, Inc. -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";const i=Math.pow(2,-52),e=new Uint32Array(512);class n{static from(t,i=u,e=_){const s=t.length,h=new Float64Array(2*s);for(let n=0;n>1;if(i>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*i-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(i)),this._hullPrev=new Uint32Array(i),this._hullNext=new Uint32Array(i),this._hullTri=new Uint32Array(i),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(i),this._dists=new Float64Array(i),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:h,_hullHash:r}=this,c=t.length>>1;let u=1/0,_=1/0,f=-1/0,d=-1/0;for(let i=0;if&&(f=e),n>d&&(d=n),this._ids[i]=i}const g=(u+f)/2,y=(_+d)/2;let m,x,p,w=1/0;for(let i=0;i0&&(x=i,w=e)}let T=t[2*x],M=t[2*x+1],A=1/0;for(let i=0;in&&(i[e++]=s,n=this._dists[s])}return this.hull=i.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(l(v,b,T,M,k,$)){const t=x,i=T,e=M;x=p,T=k,M=$,p=t,k=i,$=e}const P=function(t,i,e,n,s,h){const l=e-t,r=n-i,o=s-t,a=h-i,c=l*l+r*r,u=o*o+a*a,_=.5/(l*a-r*o);return{x:t+(a*c-r*u)*_,y:i+(l*u-o*c)*_}}(v,b,T,M,k,$);this._cx=P.x,this._cy=P.y;for(let i=0;i0&&Math.abs(u-s)<=i&&Math.abs(_-o)<=i)continue;if(s=u,o=_,c===m||c===x||c===p)continue;let f=0;for(let t=0,i=this._hashKey(u,_);t0?3-e:1+e)/4}(t-this._cx,i-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:i,_halfedges:n,coords:s}=this;let h=0,l=0;for(;;){const o=n[t],a=t-t%3;if(l=a+(t+2)%3,-1===o){if(0===h)break;t=e[--h];continue}const c=o-o%3,u=a+(t+1)%3,_=c+(o+2)%3,f=i[l],d=i[t],g=i[u],y=i[_];if(r(s[2*f],s[2*f+1],s[2*d],s[2*d+1],s[2*g],s[2*g+1],s[2*y],s[2*y+1])){i[t]=y,i[o]=f;const s=n[_];if(-1===s){let i=this._hullStart;do{if(this._hullTri[i]===_){this._hullTri[i]=t;break}i=this._hullPrev[i]}while(i!==this._hullStart)}this._link(t,s),this._link(o,n[l]),this._link(l,_);const r=c+(o+1)%3;h=33306690738754716e-32*Math.abs(l+r)?l-r:0}function l(t,i,e,n,s,l){return(h(s,l,t,i,e,n)||h(t,i,e,n,s,l)||h(e,n,s,l,t,i))<0}function r(t,i,e,n,s,h,l,r){const o=t-l,a=i-r,c=e-l,u=n-r,_=s-l,f=h-r,d=c*c+u*u,g=_*_+f*f;return o*(u*g-d*f)-a*(c*g-d*_)+(o*o+a*a)*(c*f-u*_)<0}function o(t,i,e,n,s,h){const l=e-t,r=n-i,o=s-t,a=h-i,c=l*l+r*r,u=o*o+a*a,_=.5/(l*a-r*o),f=(a*c-r*u)*_,d=(l*u-o*c)*_;return f*f+d*d}function a(t,i,e,n){if(n-e<=20)for(let s=e+1;s<=n;s++){const n=t[s],h=i[n];let l=s-1;for(;l>=e&&i[t[l]]>h;)t[l+1]=t[l--];t[l+1]=n}else{let s=e+1,h=n;c(t,e+n>>1,s),i[t[e]]>i[t[n]]&&c(t,e,n),i[t[s]]>i[t[n]]&&c(t,s,n),i[t[e]]>i[t[s]]&&c(t,e,s);const l=t[s],r=i[l];for(;;){do{s++}while(i[t[s]]r);if(h=h-e?(a(t,i,s,n),a(t,i,e,h-1)):(a(t,i,e,h-1),a(t,i,s,n))}}function c(t,i,e){const n=t[i];t[i]=t[e],t[e]=n}function u(t){return t[0]}function _(t){return t[1]}const f=1e-6;class d{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+i}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,i){this._+=`L${this._x1=+t},${this._y1=+i}`}arc(t,i,e){const n=(t=+t)+(e=+e),s=i=+i;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${n},${s}`:(Math.abs(this._x1-n)>f||Math.abs(this._y1-s)>f)&&(this._+="L"+n+","+s),e&&(this._+=`A${e},${e},0,1,1,${t-e},${i}A${e},${e},0,1,1,${this._x1=n},${this._y1=s}`)}rect(t,i,e,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+i}h${+e}v${+n}h${-e}Z`}value(){return this._||null}}class g{constructor(){this._=[]}moveTo(t,i){this._.push([t,i])}closePath(){this._.push(this._[0].slice())}lineTo(t,i){this._.push([t,i])}value(){return this._.length?this._:null}}class y{constructor(t,[i,e,n,s]=[0,0,960,500]){if(!((n=+n)>=(i=+i)&&(s=+s)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=n,this.xmin=i,this.ymax=s,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:i,triangles:e},vectors:n}=this,s=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let i,n,h=0,l=0,r=e.length;h1;)s-=2;for(let t=2;t4)for(let t=0;t0){if(i>=this.ymax)return null;(s=(this.ymax-i)/n)0){if(t>=this.xmax)return null;(s=(this.xmax-t)/e)this.xmax?2:0)|(ithis.ymax?8:0)}}const m=2*Math.PI,x=Math.pow;function p(t){return t[0]}function w(t){return t[1]}function v(t,i,e){return[t+Math.sin(t+i)*e,i+Math.cos(t-i)*e]}class b{static from(t,i=p,e=w,n){return new b("length"in t?function(t,i,e,n){const s=t.length,h=new Float64Array(2*s);for(let l=0;l2&&function(t){const{triangles:i,coords:e}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:i.length/2},(t,i)=>i).sort((t,e)=>i[2*t]-i[2*e]||i[2*t+1]-i[2*e+1]);const t=this.collinear[0],e=this.collinear[this.collinear.length-1],s=[i[2*t],i[2*t+1],i[2*e],i[2*e+1]],h=1e-8*Math.hypot(s[3]-s[1],s[2]-s[0]);for(let t=0,e=i.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=s[0],this.triangles[1]=s[1],this.triangles[2]=s[1],l[s[0]]=1,2===s.length&&(l[s[1]]=0))}voronoi(t){return new y(this,t)}*neighbors(t){const{inedges:i,hull:e,_hullIndex:n,halfedges:s,triangles:h,collinear:l}=this;if(l){const i=l.indexOf(t);return i>0&&(yield l[i-1]),void(i=0&&s!==e&&s!==n;)e=s;return s}_step(t,i,e){const{inedges:n,hull:s,_hullIndex:h,halfedges:l,triangles:r,points:o}=this;if(-1===n[t]||!o.length)return(t+1)%(o.length>>1);let a=t,c=x(i-o[2*t],2)+x(e-o[2*t+1],2);const u=n[t];let _=u;do{let n=r[_];const u=x(i-o[2*n],2)+x(e-o[2*n+1],2);if(u 1e-10) return false; - } - return true; -} - -function jitter(x, y, r) { - return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r]; -} - -export default class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points - ? flatArray(points, fx, fy, that) - : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points) { - this._delaunator = new Delaunator(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); - } - update() { - this._delaunator.update(); - this._init(); - return this; - } - _init() { - const d = this._delaunator, points = this.points; - - // check for collinear - if (d.hull && d.hull.length > 2 && collinear(d)) { - this.collinear = Int32Array.from({length: points.length/2}, (_,i) => i) - .sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], - bounds = [ points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1] ], - r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for (let i = 0, n = points.length / 2; i < n; ++i) { - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new Delaunator(points); - } else { - delete this.collinear; - } - - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - - // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - for (let e = 0, n = halfedges.length; e < n; ++e) { - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; - } - for (let i = 0, n = hull.length; i < n; ++i) { - hullIndex[hull[i]] = i; - } - - // degenerate case: 1 or 2 (distinct) points - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - inedges[hull[0]] = 1; - if (hull.length === 2) inedges[hull[1]] = 0; - } - } - voronoi(bounds) { - return new Voronoi(this, bounds); - } - *neighbors(i) { - const {inedges, hull, _hullIndex, halfedges, triangles, collinear} = this; - - // degenerate case with several collinear points - if (collinear) { - const l = collinear.indexOf(i); - if (l > 0) yield collinear[l - 1]; - if (l < collinear.length - 1) yield collinear[l + 1]; - return; - } - - const e0 = inedges[i]; - if (e0 === -1) return; // coincident point - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) return; // bad triangulation - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) yield p; - return; - } - } while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - const i0 = i; - let c; - while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) i = c; - return c; - } - _step(i, x, y) { - const {inedges, hull, _hullIndex, halfedges, triangles, points} = this; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) return e; - } - break; - } - } while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new Path : undefined; - const {points, halfedges, triangles} = this; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r = 2) { - const buffer = context == null ? context = new Path : undefined; - const {points} = this; - for (let i = 0, n = points.length; i < n; i += 2) { - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new Path : undefined; - const {hull, points} = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for (let i = 1; i < n; ++i) { - const h = 2 * hull[i]; - context.lineTo(points[h], points[h + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - hullPolygon() { - const polygon = new Polygon; - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new Path : undefined; - const {points, triangles} = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); - } - *trianglePolygons() { - const {triangles} = this; - for (let i = 0, n = triangles.length / 3; i < n; ++i) { - yield this.trianglePolygon(i); - } - } - trianglePolygon(i) { - const polygon = new Polygon; - this.renderTriangle(i, polygon); - return polygon.value(); - } -} - -function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for (let i = 0; i < n; ++i) { - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; -} - -function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points) { - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; - } -} diff --git a/node_modules/d3-delaunay/src/index.js b/node_modules/d3-delaunay/src/index.js deleted file mode 100644 index dc9022e..0000000 --- a/node_modules/d3-delaunay/src/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export {default as Delaunay} from "./delaunay.js"; -export {default as Voronoi} from "./voronoi.js"; diff --git a/node_modules/d3-delaunay/src/path.js b/node_modules/d3-delaunay/src/path.js deleted file mode 100644 index 0eaa69e..0000000 --- a/node_modules/d3-delaunay/src/path.js +++ /dev/null @@ -1,37 +0,0 @@ -const epsilon = 1e-6; - -export default class Path { - constructor() { - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; - } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; - } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; - } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; - } - value() { - return this._ || null; - } -} diff --git a/node_modules/d3-delaunay/src/polygon.js b/node_modules/d3-delaunay/src/polygon.js deleted file mode 100644 index bdbbdc3..0000000 --- a/node_modules/d3-delaunay/src/polygon.js +++ /dev/null @@ -1,17 +0,0 @@ -export default class Polygon { - constructor() { - this._ = []; - } - moveTo(x, y) { - this._.push([x, y]); - } - closePath() { - this._.push(this._[0].slice()); - } - lineTo(x, y) { - this._.push([x, y]); - } - value() { - return this._.length ? this._ : null; - } -} diff --git a/node_modules/d3-delaunay/src/voronoi.js b/node_modules/d3-delaunay/src/voronoi.js deleted file mode 100644 index b2d8d49..0000000 --- a/node_modules/d3-delaunay/src/voronoi.js +++ /dev/null @@ -1,320 +0,0 @@ -import Path from "./path.js"; -import Polygon from "./polygon.js"; - -export default class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); - } - update() { - this.delaunay.update(); - this._init(); - return this; - } - _init() { - const {delaunay: {points, hull, triangles}, vectors} = this; - - // Compute circumcenters. - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for (let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2) { - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x1 = points[t1]; - const y1 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - - const dx = x2 - x1; - const dy = y2 - y1; - const ex = x3 - x1; - const ey = y3 - y1; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const ab = (dx * ey - dy * ex) * 2; - - if (!ab) { - // degenerate case (collinear diagram) - x = (x1 + x3) / 2 - 1e8 * ey; - y = (y1 + y3) / 2 + 1e8 * ex; - } - else if (Math.abs(ab) < 1e-8) { - // almost equal points (degenerate triangle) - x = (x1 + x3) / 2; - y = (y1 + y3) / 2; - } else { - const d = 1 / ab; - x = x1 + (ey * bl - dy * cl) * d; - y = y1 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - - // Compute exterior cell rays. - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for (let i = 0; i < hull.length; ++i) { - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new Path : undefined; - const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this; - if (hull.length <= 1) return null; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for (let i = 0; i < hull.length; ++i) { - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new Path : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new Path : undefined; - const points = this._clip(i); - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - let n = points.length; - while (points[0] === points[n-2] && points[1] === points[n-1] && n > 1) n -= 2; - for (let i = 2; i < n; i += 2) { - if (points[i] !== points[i-2] || points[i+1] !== points[i-1]) - context.lineTo(points[i], points[i + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - *cellPolygons() { - const {delaunay: {points}} = this; - for (let i = 0, n = points.length / 2; i < n; ++i) { - const cell = this.cellPolygon(i); - if (cell) cell.index = i, yield cell; - } - } - cellPolygon(i) { - const polygon = new Polygon; - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } - } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; - } - *neighbors(i) { - const ci = this._clip(i); - if (ci) for (const j of this.delaunay.neighbors(i)) { - const cj = this._clip(j); - // find the common edge - if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { - for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { - if (ci[ai] == cj[aj] - && ci[ai + 1] == cj[aj + 1] - && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] - && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj] - ) { - yield j; - break loop; - } - } - } - } - } - _cell(i) { - const {circumcenters, delaunay: {inedges, halfedges, triangles}} = this; - const e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - } while (e !== e0 && e !== -1); - return points; - } - _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - const points = this._cell(i); - if (points === null) return null; - const {vectors: V} = this; - const v = i * 4; - return V[v] || V[v + 1] - ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) - : this._clipFinite(i, points); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1; - for (let j = 0; j < n; j += 2) { - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1); - else P = [x1, y1]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0); - else P = [sx0, sy0]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1); - else P = [sx1, sy1]; - } - } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - while (true) { - if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1]; - if (c0 & c1) return null; - let x, y, c = c0 || c1; - if (c & 0b1000) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 0b0100) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 0b0010) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) { - for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; - } - return P; - } - _edge(i, e0, e1, P, j) { - while (e0 !== e1) { - let x, y; - switch (e0) { - case 0b0101: e0 = 0b0100; continue; // top-left - case 0b0100: e0 = 0b0110, x = this.xmax, y = this.ymin; break; // top - case 0b0110: e0 = 0b0010; continue; // top-right - case 0b0010: e0 = 0b1010, x = this.xmax, y = this.ymax; break; // right - case 0b1010: e0 = 0b1000; continue; // bottom-right - case 0b1000: e0 = 0b1001, x = this.xmin, y = this.ymax; break; // bottom - case 0b1001: e0 = 0b0001; continue; // bottom-left - case 0b0001: e0 = 0b0101, x = this.xmin, y = this.ymin; break; // left - } - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) { - P.splice(j, 0, x, y), j += 2; - } - } - if (P.length > 4) { - for (let i = 0; i < P.length; i+= 2) { - const j = (i + 2) % P.length, k = (i + 4) % P.length; - if (P[i] === P[j] && P[j] === P[k] - || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) - P.splice(j, 2), i -= 2; - } - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { // top - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { // bottom - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { // right - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { // left - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - return [x, y]; - } - _edgecode(x, y) { - return (x === this.xmin ? 0b0001 - : x === this.xmax ? 0b0010 : 0b0000) - | (y === this.ymin ? 0b0100 - : y === this.ymax ? 0b1000 : 0b0000); - } - _regioncode(x, y) { - return (x < this.xmin ? 0b0001 - : x > this.xmax ? 0b0010 : 0b0000) - | (y < this.ymin ? 0b0100 - : y > this.ymax ? 0b1000 : 0b0000); - } -} diff --git a/node_modules/d3-dispatch/LICENSE b/node_modules/d3-dispatch/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-dispatch/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-dispatch/README.md b/node_modules/d3-dispatch/README.md deleted file mode 100644 index 9fd9c0e..0000000 --- a/node_modules/d3-dispatch/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# d3-dispatch - -Dispatching is a convenient mechanism for separating concerns with loosely-coupled code: register named callbacks and then call them with arbitrary arguments. A variety of D3 components, such as [d3-request](https://github.com/d3/d3-request), use this mechanism to emit events to listeners. Think of this like Node’s [EventEmitter](https://nodejs.org/api/events.html), except every listener has a well-defined name so it’s easy to remove or replace them. - -For example, to create a dispatch for *start* and *end* events: - -```js -var dispatch = d3.dispatch("start", "end"); -``` - -You can then register callbacks for these events using [*dispatch*.on](#dispatch_on): - -```js -dispatch.on("start", callback1); -dispatch.on("start.foo", callback2); -dispatch.on("end", callback3); -``` - -Then, you can invoke all the *start* callbacks using [*dispatch*.call](#dispatch_call) or [*dispatch*.apply](#dispatch_apply): - -```js -dispatch.call("start"); -``` - -Like *function*.call, you may also specify the `this` context and any arguments: - -```js -dispatch.call("start", {about: "I am a context object"}, "I am an argument"); -``` - -Want a more involved example? See how to use [d3-dispatch for coordinated views](http://bl.ocks.org/mbostock/5872848). - -## Installing - -If you use NPM, `npm install d3-dispatch`. Otherwise, download the [latest release](https://github.com/d3/d3-dispatch/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-dispatch.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -[Try d3-dispatch in your browser.](https://tonicdev.com/npm/d3-dispatch) - -## API Reference - -# d3.dispatch(types…) [<>](https://github.com/d3/d3-dispatch/blob/master/src/dispatch.js "Source") - -Creates a new dispatch for the specified event *types*. Each *type* is a string, such as `"start"` or `"end"`. - -# *dispatch*.on(typenames[, callback]) [<>](https://github.com/d3/d3-dispatch/blob/master/src/dispatch.js#L26 "Source") - -Adds, removes or gets the *callback* for the specified *typenames*. If a *callback* function is specified, it is registered for the specified (fully-qualified) *typenames*. If a callback was already registered for the given *typenames*, the existing callback is removed before the new callback is added. - -The specified *typenames* is a string, such as `start` or `end.foo`. The type may be optionally followed by a period (`.`) and a name; the optional name allows multiple callbacks to be registered to receive events of the same type, such as `start.foo` and `start.bar`. To specify multiple typenames, separate typenames with spaces, such as `start end` or `start.foo start.bar`. - -To remove all callbacks for a given name `foo`, say `dispatch.on(".foo", null)`. - -If *callback* is not specified, returns the current callback for the specified *typenames*, if any. If multiple typenames are specified, the first matching callback is returned. - -# *dispatch*.copy() [<>](https://github.com/d3/d3-dispatch/blob/master/src/dispatch.js#L49 "Source") - -Returns a copy of this dispatch object. Changes to this dispatch do not affect the returned copy and vice versa. - -# *dispatch*.call(type[, that[, arguments…]]) [<>](https://github.com/d3/d3-dispatch/blob/master/src/dispatch.js#L54 "Source") - -Like [*function*.call](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call), invokes each registered callback for the specified *type*, passing the callback the specified *arguments*, with *that* as the `this` context. See [*dispatch*.apply](#dispatch_apply) for more information. - -# *dispatch*.apply(type[, that[, arguments]]) [<>](https://github.com/d3/d3-dispatch/blob/master/src/dispatch.js#L59 "Source") - -Like [*function*.apply](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call), invokes each registered callback for the specified *type*, passing the callback the specified *arguments*, with *that* as the `this` context. For example, if you wanted to dispatch your *custom* callbacks after handling a native *click* event, while preserving the current `this` context and arguments, you could say: - -```js -selection.on("click", function() { - dispatch.apply("custom", this, arguments); -}); -``` - -You can pass whatever arguments you want to callbacks; most commonly, you might create an object that represents an event, or pass the current datum (*d*) and index (*i*). See [function.call](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/Call) and [function.apply](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/Apply) for further information. diff --git a/node_modules/d3-dispatch/dist/d3-dispatch.js b/node_modules/d3-dispatch/dist/d3-dispatch.js deleted file mode 100644 index 9e36314..0000000 --- a/node_modules/d3-dispatch/dist/d3-dispatch.js +++ /dev/null @@ -1,95 +0,0 @@ -// https://d3js.org/d3-dispatch/ v1.0.6 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -var noop = {value: function() {}}; - -function dispatch() { - for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { - if (!(t = arguments[i] + "") || (t in _) || /[\s.]/.test(t)) throw new Error("illegal type: " + t); - _[t] = []; - } - return new Dispatch(_); -} - -function Dispatch(_) { - this._ = _; -} - -function parseTypenames(typenames, types) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); - return {type: t, name: name}; - }); -} - -Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function(typename, callback) { - var _ = this._, - T = parseTypenames(typename + "", _), - t, - i = -1, - n = 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 = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; - return; - } - - // If a type was specified, set the callback for the given type and name. - // Otherwise, if a null callback was specified, remove callbacks of the given name. - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); - while (++i < n) { - if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); - else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null); - } - - return this; - }, - copy: function() { - var copy = {}, _ = this._; - for (var t in _) copy[t] = _[t].slice(); - return new Dispatch(copy); - }, - call: function(type, that) { - if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); - }, - apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); - } -}; - -function get(type, name) { - for (var i = 0, n = type.length, c; i < n; ++i) { - if ((c = type[i]).name === name) { - return c.value; - } - } -} - -function set(type, name, callback) { - for (var i = 0, n = type.length; i < n; ++i) { - if (type[i].name === name) { - type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); - break; - } - } - if (callback != null) type.push({name: name, value: callback}); - return type; -} - -exports.dispatch = dispatch; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-dispatch/dist/d3-dispatch.min.js b/node_modules/d3-dispatch/dist/d3-dispatch.min.js deleted file mode 100644 index 3ec1e4e..0000000 --- a/node_modules/d3-dispatch/dist/d3-dispatch.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-dispatch/ v1.0.6 Copyright 2019 Mike Bostock -!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n=n||self).d3=n.d3||{})}(this,function(n){"use strict";var e={value:function(){}};function t(){for(var n,e=0,t=arguments.length,o={};e=0&&(t=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:t}})}function i(n,e){for(var t,r=0,o=n.length;r0)for(var t,r,o=new Array(t),i=0;i= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); - return {type: t, name: name}; - }); -} - -Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function(typename, callback) { - var _ = this._, - T = parseTypenames(typename + "", _), - t, - i = -1, - n = 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 = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; - return; - } - - // If a type was specified, set the callback for the given type and name. - // Otherwise, if a null callback was specified, remove callbacks of the given name. - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); - while (++i < n) { - if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); - else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null); - } - - return this; - }, - copy: function() { - var copy = {}, _ = this._; - for (var t in _) copy[t] = _[t].slice(); - return new Dispatch(copy); - }, - call: function(type, that) { - if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); - }, - apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); - } -}; - -function get(type, name) { - for (var i = 0, n = type.length, c; i < n; ++i) { - if ((c = type[i]).name === name) { - return c.value; - } - } -} - -function set(type, name, callback) { - for (var i = 0, n = type.length; i < n; ++i) { - if (type[i].name === name) { - type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); - break; - } - } - if (callback != null) type.push({name: name, value: callback}); - return type; -} - -export default dispatch; diff --git a/node_modules/d3-dispatch/src/index.js b/node_modules/d3-dispatch/src/index.js deleted file mode 100644 index 4b8d3bd..0000000 --- a/node_modules/d3-dispatch/src/index.js +++ /dev/null @@ -1 +0,0 @@ -export {default as dispatch} from "./dispatch.js"; diff --git a/node_modules/d3-dsv/LICENSE b/node_modules/d3-dsv/LICENSE deleted file mode 100644 index 3d0802c..0000000 --- a/node_modules/d3-dsv/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2013-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-dsv/README.md b/node_modules/d3-dsv/README.md deleted file mode 100644 index 88f5765..0000000 --- a/node_modules/d3-dsv/README.md +++ /dev/null @@ -1,473 +0,0 @@ -# d3-dsv - -This module provides a parser and formatter for delimiter-separated values, most commonly [comma-](https://en.wikipedia.org/wiki/Comma-separated_values) (CSV) or tab-separated values (TSV). These tabular formats are popular with spreadsheet programs such as Microsoft Excel, and are often more space-efficient than JSON. This implementation is based on [RFC 4180](http://tools.ietf.org/html/rfc4180). - -Comma (CSV) and tab (TSV) delimiters are built-in. For example, to parse: - -```js -d3.csvParse("foo,bar\n1,2"); // [{foo: "1", bar: "2"}, columns: ["foo", "bar"]] -d3.tsvParse("foo\tbar\n1\t2"); // [{foo: "1", bar: "2"}, columns: ["foo", "bar"]] -``` - -Or to format: - -```js -d3.csvFormat([{foo: "1", bar: "2"}]); // "foo,bar\n1,2" -d3.tsvFormat([{foo: "1", bar: "2"}]); // "foo\tbar\n1\t2" -``` - -To use a different delimiter, such as “|” for pipe-separated values, use [d3.dsvFormat](#dsvFormat): - -```js -var psv = d3.dsvFormat("|"); - -console.log(psv.parse("foo|bar\n1|2")); // [{foo: "1", bar: "2"}, columns: ["foo", "bar"]] -``` - -For easy loading of DSV files in a browser, see [d3-fetch](https://github.com/d3/d3-fetch)’s [d3.csv](https://github.com/d3/d3-fetch/blob/master/README.md#csv) and [d3.tsv](https://github.com/d3/d3-fetch/blob/master/README.md#tsv) methods. - -## Installing - -If you use NPM, `npm install d3-dsv`. Otherwise, download the [latest release](https://github.com/d3/d3-dsv/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-dsv.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -[Try d3-dsv in your browser.](https://tonicdev.com/npm/d3-dsv) - -## API Reference - -# d3.csvParse(string[, row]) [<>](https://github.com/d3/d3-dsv/blob/master/src/csv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)(",").[parse](#dsv_parse). - -# d3.csvParseRows(string[, row]) [<>](https://github.com/d3/d3-dsv/blob/master/src/csv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)(",").[parseRows](#dsv_parseRows). - -# d3.csvFormat(rows[, columns]) [<>](https://github.com/d3/d3-dsv/blob/master/src/csv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)(",").[format](#dsv_format). - -# d3.csvFormatBody(rows[, columns]) [<>](https://github.com/d3/d3-dsv/blob/master/src/csv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)(",").[formatBody](#dsv_formatBody). - -# d3.csvFormatRows(rows) [<>](https://github.com/d3/d3-dsv/blob/master/src/csv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)(",").[formatRows](#dsv_formatRows). - -# d3.csvFormatRow(row) [<>](https://github.com/d3/d3-dsv/blob/master/src/csv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)(",").[formatRow](#dsv_formatRow). - -# d3.csvFormatValue(value) [<>](https://github.com/d3/d3-dsv/blob/master/src/csv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)(",").[formatValue](#dsv_formatValue). - -# d3.tsvParse(string[, row]) [<>](https://github.com/d3/d3-dsv/blob/master/src/tsv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)("\t").[parse](#dsv_parse). - -# d3.tsvParseRows(string[, row]) [<>](https://github.com/d3/d3-dsv/blob/master/src/tsv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)("\t").[parseRows](#dsv_parseRows). - -# d3.tsvFormat(rows[, columns]) [<>](https://github.com/d3/d3-dsv/blob/master/src/tsv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)("\t").[format](#dsv_format). - -# d3.tsvFormatBody(rows[, columns]) [<>](https://github.com/d3/d3-dsv/blob/master/src/tsv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)("\t").[formatBody](#dsv_formatBody). - -# d3.tsvFormatRows(rows) [<>](https://github.com/d3/d3-dsv/blob/master/src/tsv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)("\t").[formatRows](#dsv_formatRows). - -# d3.tsvFormatRow(row) [<>](https://github.com/d3/d3-dsv/blob/master/src/tsv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)("\t").[formatRow](#dsv_formatRow). - -# d3.tsvFormatValue(value) [<>](https://github.com/d3/d3-dsv/blob/master/src/tsv.js "Source") - -Equivalent to [dsvFormat](#dsvFormat)("\t").[formatValue](#dsv_formatValue). - -# d3.dsvFormat(delimiter) [<>](https://github.com/d3/d3-dsv/blob/master/src/dsv.js) - -Constructs a new DSV parser and formatter for the specified *delimiter*. The *delimiter* must be a single character (*i.e.*, a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not. - -# *dsv*.parse(string[, row]) [<>](https://github.com/d3/d3-dsv/blob/master/src/dsv.js "Source") - -Parses the specified *string*, which must be in the delimiter-separated values format with the appropriate delimiter, returning an array of objects representing the parsed rows. - -Unlike [*dsv*.parseRows](#dsv_parseRows), this method requires that the first line of the DSV content contains a delimiter-separated list of column names; these column names become the attributes on the returned objects. For example, consider the following CSV file: - -``` -Year,Make,Model,Length -1997,Ford,E350,2.34 -2000,Mercury,Cougar,2.38 -``` - -The resulting JavaScript array is: - -```js -[ - {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"}, - {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} -] -``` - -The returned array also exposes a `columns` property containing the column names in input order (in contrast to Object.keys, whose iteration order is arbitrary). For example: - -```js -data.columns; // ["Year", "Make", "Model", "Length"] -``` - -If a *row* conversion function is not specified, field values are strings. For safety, there is no automatic conversion to numbers, dates, or other types. In some cases, JavaScript may coerce strings to numbers for you automatically (for example, using the `+` operator), but better is to specify a *row* conversion function. See [d3.autoType](#autoType) for a convenient *row* conversion function that infers and coerces common types like numbers and strings. - -If a *row* conversion function is specified, the specified function is invoked for each row, being passed an object representing the current row (`d`), the index (`i`) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, the row is skipped and will be omitted from the array returned by *dsv*.parse; otherwise, the returned value defines the corresponding row object. For example: - -```js -var data = d3.csvParse(string, function(d) { - return { - year: new Date(+d.Year, 0, 1), // lowercase and convert "Year" to Date - make: d.Make, // lowercase - model: d.Model, // lowercase - length: +d.Length // lowercase and convert "Length" to number - }; -}); -``` - -Note: using `+` rather than [parseInt](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseInt) or [parseFloat](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseFloat) is typically faster, though more restrictive. For example, `"30px"` when coerced using `+` returns `NaN`, while parseInt and parseFloat return `30`. - -# dsv.parseRows(string[, row]) [<>](https://github.com/d3/d3-dsv/blob/master/src/dsv.js "Source") - -Parses the specified *string*, which must be in the delimiter-separated values format with the appropriate delimiter, returning an array of arrays representing the parsed rows. - -Unlike [*dsv*.parse](#dsv_parse), this method treats the header line as a standard row, and should be used whenever DSV content does not contain a header. Each row is represented as an array rather than an object. Rows may have variable length. For example, consider the following CSV file, which notably lacks a header line: - -``` -1997,Ford,E350,2.34 -2000,Mercury,Cougar,2.38 -``` - -The resulting JavaScript array is: - -```js -[ - ["1997", "Ford", "E350", "2.34"], - ["2000", "Mercury", "Cougar", "2.38"] -] -``` - -If a *row* conversion function is not specified, field values are strings. For safety, there is no automatic conversion to numbers, dates, or other types. In some cases, JavaScript may coerce strings to numbers for you automatically (for example, using the `+` operator), but better is to specify a *row* conversion function. See [d3.autoType](#autoType) for a convenient *row* conversion function that infers and coerces common types like numbers and strings. - -If a *row* conversion function is specified, the specified function is invoked for each row, being passed an array representing the current row (`d`), the index (`i`) starting at zero for the first row, and the array of column names. If the returned value is null or undefined, the row is skipped and will be omitted from the array returned by *dsv*.parse; otherwise, the returned value defines the corresponding row object. For example: - -```js -var data = d3.csvParseRows(string, function(d, i) { - return { - year: new Date(+d[0], 0, 1), // convert first colum column to Date - make: d[1], - model: d[2], - length: +d[3] // convert fourth column to number - }; -}); -``` - -In effect, *row* is similar to applying a [map](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map) and [filter](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/filter) operator to the returned rows. - -# dsv.format(rows[, columns]) [<>](https://github.com/d3/d3-dsv/blob/master/src/dsv.js "Source") - -Formats the specified array of object *rows* as delimiter-separated values, returning a string. This operation is the inverse of [*dsv*.parse](#dsv_parse). Each row will be separated by a newline (`\n`), and each column within each row will be separated by the delimiter (such as a comma, `,`). Values that contain either the delimiter, a double-quote (`"`) or a newline will be escaped using double-quotes. - -If *columns* is not specified, the list of column names that forms the header row is determined by the union of all properties on all objects in *rows*; the order of columns is nondeterministic. If *columns* is specified, it is an array of strings representing the column names. For example: - -```js -var string = d3.csvFormat(data, ["year", "make", "model", "length"]); -``` - -All fields on each row object will be coerced to strings. If the field value is null or undefined, the empty string is used. If the field value is a Date, the [ECMAScript date-time string format](https://www.ecma-international.org/ecma-262/9.0/index.html#sec-date-time-string-format) (a subset of ISO 8601) is used: for example, dates at UTC midnight are formatted as `YYYY-MM-DD`. For more control over which and how fields are formatted, first map *rows* to an array of array of string, and then use [*dsv*.formatRows](#dsv_formatRows). - -# dsv.formatBody(rows[, columns]) [<>](https://github.com/d3/d3-dsv/blob/master/src/dsv.js "Source") - -Equivalent to [*dsv*.format](#dsv_format), but omits the header row. This is useful, for example, when appending rows to an existing file. - -# dsv.formatRows(rows) [<>](https://github.com/d3/d3-dsv/blob/master/src/dsv.js "Source") - -Formats the specified array of array of string *rows* as delimiter-separated values, returning a string. This operation is the reverse of [*dsv*.parseRows](#dsv_parseRows). Each row will be separated by a newline (`\n`), and each column within each row will be separated by the delimiter (such as a comma, `,`). Values that contain either the delimiter, a double-quote (") or a newline will be escaped using double-quotes. - -To convert an array of objects to an array of arrays while explicitly specifying the columns, use [*array*.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). For example: - -```js -var string = d3.csvFormatRows(data.map(function(d, i) { - return [ - d.year.getFullYear(), // Assuming d.year is a Date object. - d.make, - d.model, - d.length - ]; -})); -``` - -If you like, you can also [*array*.concat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) this result with an array of column names to generate the first row: - -```js -var string = d3.csvFormatRows([[ - "year", - "make", - "model", - "length" - ]].concat(data.map(function(d, i) { - return [ - d.year.getFullYear(), // Assuming d.year is a Date object. - d.make, - d.model, - d.length - ]; -}))); -``` - -# dsv.formatRow(row) [<>](https://github.com/d3/d3-dsv/blob/master/src/dsv.js "Source") - -Formats a single array *row* of strings as delimiter-separated values, returning a string. Each column within the row will be separated by the delimiter (such as a comma, `,`). Values that contain either the delimiter, a double-quote (") or a newline will be escaped using double-quotes. - -# dsv.formatValue(value) [<>](https://github.com/d3/d3-dsv/blob/master/src/dsv.js "Source") - -Format a single *value* or string as a delimiter-separated value, returning a string. A value that contains either the delimiter, a double-quote (") or a newline will be escaped using double-quotes. - -# d3.autoType(object) [<>](https://github.com/d3/d3-dsv/blob/master/src/autoType.js "Source") - -Given an *object* (or array) representing a parsed row, infers the types of values on the *object* and coerces them accordingly, returning the mutated *object*. This function is intended to be used as a *row* accessor function in conjunction with [*dsv*.parse](#dsv_parse) and [*dsv*.parseRows](#dsv_parseRow). For example, consider the following CSV file: - -``` -Year,Make,Model,Length -1997,Ford,E350,2.34 -2000,Mercury,Cougar,2.38 -``` - -When used with [d3.csvParse](#csvParse), - -```js -d3.csvParse(string, d3.autoType) -``` - -the resulting JavaScript array is: - -```js -[ - {"Year": 1997, "Make": "Ford", "Model": "E350", "Length": 2.34}, - {"Year": 2000, "Make": "Mercury", "Model": "Cougar", "Length": 2.38} -] -``` - -Type inference works as follows. For each *value* in the given *object*, the [trimmed](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim) value is computed; the value is then re-assigned as follows: - -1. If empty, then `null`. -1. If exactly `"true"`, then `true`. -1. If exactly `"false"`, then `false`. -1. If exactly `"NaN"`, then `NaN`. -1. Otherwise, if [coercible to a number](https://www.ecma-international.org/ecma-262/9.0/index.html#sec-tonumber-applied-to-the-string-type), then a number. -1. Otherwise, if a [date-only or date-time string](https://www.ecma-international.org/ecma-262/9.0/index.html#sec-date-time-string-format), then a Date. -1. Otherwise, a string (the original untrimmed value). - -Values with leading zeroes may be coerced to numbers; for example `"08904"` coerces to `8904`. However, extra characters such as commas or units (*e.g.*, `"$1.00"`, `"(123)"`, `"1,234"` or `"32px"`) will prevent number coercion, resulting in a string. - -Date strings must be in ECMAScript’s subset of the [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). When a date-only string such as YYYY-MM-DD is specified, the inferred time is midnight UTC; however, if a date-time string such as YYYY-MM-DDTHH:MM is specified without a time zone, it is assumed to be local time. - -Automatic type inference is primarily intended to provide safe, predictable behavior in conjunction with [*dsv*.format](#dsv_format) and [*dsv*.formatRows](#dsv_formatRows) for common JavaScript types. If you need different behavior, you should implement your own row accessor function. - -For more, see [the d3.autoType notebook](https://observablehq.com/@d3/d3-autotype). - -### Content Security Policy - -If a [content security policy](http://www.w3.org/TR/CSP/) is in place, note that [*dsv*.parse](#dsv_parse) requires `unsafe-eval` in the `script-src` directive, due to the (safe) use of dynamic code generation for fast parsing. (See [source](https://github.com/d3/d3-dsv/blob/master/src/dsv.js).) Alternatively, use [*dsv*.parseRows](#dsv_parseRows). - -### Byte-Order Marks - -DSV files sometimes begin with a [byte order mark (BOM)](https://en.wikipedia.org/wiki/Byte_order_mark); saving a spreadsheet in CSV UTF-8 format from Microsoft Excel, for example, will include a BOM. On the web this is not usually a problem because the [UTF-8 decode algorithm](https://encoding.spec.whatwg.org/#utf-8-decode) specified in the Encoding standard removes the BOM. Node.js, on the other hand, [does not remove the BOM](https://github.com/nodejs/node-v0.x-archive/issues/1918) when decoding UTF-8. - -If the BOM is not removed, the first character of the text is a zero-width non-breaking space. So if a CSV file with a BOM is parsed by [d3.csvParse](#csvParse), the first column’s name will begin with a zero-width non-breaking space. This can be hard to spot since this character is usually invisible when printed. - -To remove the BOM before parsing, consider using [strip-bom](https://www.npmjs.com/package/strip-bom). - -## Command Line Reference - -### dsv2dsv - -# dsv2dsv [options…] [file] - -Converts the specified DSV input *file* to DSV (typically with a different delimiter or encoding). If *file* is not specified, defaults to reading from stdin. For example, to convert to CSV to TSV: - -``` -csv2tsv < example.csv > example.tsv -``` - -To convert windows-1252 CSV to utf-8 CSV: - -``` -dsv2dsv --input-encoding windows-1252 < latin1.csv > utf8.csv -``` - -# dsv2dsv -h -
# dsv2dsv --help - -Output usage information. - -# dsv2dsv -V -
# dsv2dsv --version - -Output the version number. - -# dsv2dsv -o file -
# dsv2dsv --out file - -Specify the output file name. Defaults to “-” for stdout. - -# dsv2dsv -r delimiter -
# dsv2dsv --input-delimiter delimiter - -Specify the input delimiter character. Defaults to “,” for reading CSV. (You can enter a tab on the command line by typing ⌃V.) - -# dsv2dsv --input-encoding encoding - -Specify the input character encoding. Defaults to “utf8”. - -# dsv2dsv -w delimiter -
# dsv2dsv --output-delimiter delimiter - -Specify the output delimiter character. Defaults to “,” for writing CSV. (You can enter a tab on the command line by typing ⌃V.) - -# dsv2dsv --output-encoding encoding - -Specify the output character encoding. Defaults to “utf8”. - -# csv2tsv [options…] [file] - -Equivalent to [dsv2dsv](#dsv2dsv), but the [output delimiter](#dsv2dsv_output_delimiter) defaults to the tab character (\t). - -# tsv2csv [options…] [file] - -Equivalent to [dsv2dsv](#dsv2dsv), but the [input delimiter](#dsv2dsv_output_delimiter) defaults to the tab character (\t). - -### dsv2json - -# dsv2json [options…] [file] - -Converts the specified DSV input *file* to JSON. If *file* is not specified, defaults to reading from stdin. For example, to convert to CSV to JSON: - -``` -csv2json < example.csv > example.json -``` - -Or to convert CSV to a newline-delimited JSON stream: - -``` -csv2json -n < example.csv > example.ndjson -``` - -# dsv2json -h -
# dsv2json --help - -Output usage information. - -# dsv2json -V -
# dsv2json --version - -Output the version number. - -# dsv2json -o file -
# dsv2json --out file - -Specify the output file name. Defaults to “-” for stdout. - -# dsv2json -r delimiter -
# dsv2json --input-delimiter delimiter - -Specify the input delimiter character. Defaults to “,” for reading CSV. (You can enter a tab on the command line by typing ⌃V.) - -# dsv2json --input-encoding encoding - -Specify the input character encoding. Defaults to “utf8”. - -# dsv2json -r encoding -
# dsv2json --output-encoding encoding - -Specify the output character encoding. Defaults to “utf8”. - -# dsv2json -n -
# dsv2json --newline-delimited - -Output [newline-delimited JSON](https://github.com/mbostock/ndjson-cli) instead of a single JSON array. - -# csv2json [options…] [file] - -Equivalent to [dsv2json](#dsv2json). - -# tsv2json [options…] [file] - -Equivalent to [dsv2json](#dsv2json), but the [input delimiter](#dsv2json_input_delimiter) defaults to the tab character (\t). - -### json2dsv - -# json2dsv [options…] [file] - -Converts the specified JSON input *file* to DSV. If *file* is not specified, defaults to reading from stdin. For example, to convert to JSON to CSV: - -``` -json2csv < example.json > example.csv -``` - -Or to convert a newline-delimited JSON stream to CSV: - -``` -json2csv -n < example.ndjson > example.csv -``` - -# json2dsv -h -
# json2dsv --help - -Output usage information. - -# json2dsv -V -
# json2dsv --version - -Output the version number. - -# json2dsv -o file -
# json2dsv --out file - -Specify the output file name. Defaults to “-” for stdout. - -# json2dsv --input-encoding encoding - -Specify the input character encoding. Defaults to “utf8”. - -# json2dsv -w delimiter -
# json2dsv --output-delimiter delimiter - -Specify the output delimiter character. Defaults to “,” for writing CSV. (You can enter a tab on the command line by typing ⌃V.) - -# json2dsv --output-encoding encoding - -Specify the output character encoding. Defaults to “utf8”. - -# json2dsv -n -
# json2dsv --newline-delimited - -Read [newline-delimited JSON](https://github.com/mbostock/ndjson-cli) instead of a single JSON array. - -# csv2json [options…] [file] - -Equivalent to [json2dsv](#json2dsv). - -# tsv2json [options…] [file] - -Equivalent to [json2dsv](#json2dsv), but the [output delimiter](#json2dsv_output_delimiter) defaults to the tab character (\t). diff --git a/node_modules/d3-dsv/bin/dsv2dsv b/node_modules/d3-dsv/bin/dsv2dsv deleted file mode 100755 index 63ca9ca..0000000 --- a/node_modules/d3-dsv/bin/dsv2dsv +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env node - -var os = require("os"), - rw = require("rw").dash, - path = require("path"), - iconv = require("iconv-lite"), - commander = require("commander"), - dsv = require("../"); - -var program = path.basename(process.argv[1]), - defaultInDelimiter = program.slice(0, 3) === "tsv" ? "\t" : ",", - defaultOutDelimiter = program.slice(-3) === "tsv" ? "\t" : ","; - -commander - .version(require("../package.json").version) - .usage("[options] [file]") - .option("-o, --out ", "output file name; defaults to “-” for stdout", "-") - .option("-r, --input-delimiter ", "input delimiter character", defaultInDelimiter) - .option("-w, --output-delimiter ", "output delimiter character", defaultOutDelimiter) - .option("--input-encoding ", "input character encoding; defaults to “utf8”", "utf8") - .option("--output-encoding ", "output character encoding; defaults to “utf8”", "utf8") - .parse(process.argv); - -var inFormat = dsv.dsvFormat(commander.inputDelimiter), - outFormat = dsv.dsvFormat(commander.outputDelimiter); - -rw.readFile(commander.args[0] || "-", function(error, text) { - if (error) throw error; - rw.writeFile("-", iconv.encode(outFormat.format(inFormat.parse(iconv.decode(text, commander.inputEncoding))) + os.EOL, commander.outputEncoding), function(error) { - if (error) throw error; - }); -}); diff --git a/node_modules/d3-dsv/bin/dsv2json b/node_modules/d3-dsv/bin/dsv2json deleted file mode 100755 index 75d4227..0000000 --- a/node_modules/d3-dsv/bin/dsv2json +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env node - -var os = require("os"), - rw = require("rw").dash, - path = require("path"), - iconv = require("iconv-lite"), - commander = require("commander"), - dsv = require("../"); - -var program = path.basename(process.argv[1]), - defaultInDelimiter = program.slice(0, 3) === "tsv" ? "\t" : ","; - -commander - .version(require("../package.json").version) - .usage("[options] [file]") - .option("-o, --out ", "output file name; defaults to “-” for stdout", "-") - .option("-r, --input-delimiter ", "input delimiter character", defaultInDelimiter) - .option("-n, --newline-delimited", "output newline-delimited JSON") - .option("--input-encoding ", "input character encoding; defaults to “utf8”", "utf8") - .option("--output-encoding ", "output character encoding; defaults to “utf8”", "utf8") - .parse(process.argv); - -var inFormat = dsv.dsvFormat(commander.inputDelimiter); - -rw.readFile(commander.args[0] || "-", function(error, text) { - if (error) throw error; - var rows = inFormat.parse(iconv.decode(text, commander.inputEncoding)); - rw.writeFile(commander.out, iconv.encode(commander.newlineDelimited - ? rows.map(function(row) { return JSON.stringify(row); }).join("\n") + "\n" - : JSON.stringify(rows) + os.EOL, commander.outputEncoding), function(error) { - if (error) throw error; - }); -}); diff --git a/node_modules/d3-dsv/bin/json2dsv b/node_modules/d3-dsv/bin/json2dsv deleted file mode 100755 index ed6f2e0..0000000 --- a/node_modules/d3-dsv/bin/json2dsv +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env node - -var os = require("os"), - rw = require("rw").dash, - path = require("path"), - iconv = require("iconv-lite"), - commander = require("commander"), - dsv = require("../"); - -var program = path.basename(process.argv[1]), - defaultOutDelimiter = program.slice(-3) === "tsv" ? "\t" : ","; - -commander - .version(require("../package.json").version) - .usage("[options] [file]") - .option("-o, --out ", "output file name; defaults to “-” for stdout", "-") - .option("-w, --output-delimiter ", "output delimiter character", defaultOutDelimiter) - .option("-n, --newline-delimited", "accept newline-delimited JSON") - .option("--input-encoding ", "input character encoding; defaults to “utf8”", "utf8") - .option("--output-encoding ", "output character encoding; defaults to “utf8”", "utf8") - .parse(process.argv); - -var outFormat = dsv.dsvFormat(commander.outputDelimiter); - -rw.readFile(commander.args[0] || "-", function(error, text) { - if (error) throw error; - text = iconv.decode(text, commander.inputEncoding); - rw.writeFile(commander.out, iconv.encode(outFormat.format(commander.newlineDelimited - ? text.trim().split(/\r?\n/g).map(function(line) { return JSON.parse(line); }) - : JSON.parse(text)) + os.EOL, commander.outputEncoding), function(error) { - if (error) throw error; - }); -}); diff --git a/node_modules/d3-dsv/dist/d3-dsv.js b/node_modules/d3-dsv/dist/d3-dsv.js deleted file mode 100644 index b165ff4..0000000 --- a/node_modules/d3-dsv/dist/d3-dsv.js +++ /dev/null @@ -1,233 +0,0 @@ -// https://d3js.org/d3-dsv/ v1.2.0 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -var EOL = {}, - EOF = {}, - QUOTE = 34, - NEWLINE = 10, - RETURN = 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 = objectConverter(columns); - return function(row, i) { - return f(object(row), i, columns); - }; -} - -// Compute unique columns in order of discovery. -function inferColumns(rows) { - var columnSet = Object.create(null), - columns = []; - - rows.forEach(function(row) { - for (var column in row) { - if (!(column in columnSet)) { - columns.push(columnSet[column] = column); - } - } - }); - - return columns; -} - -function pad(value, width) { - var s = value + "", length = 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 = date.getUTCHours(), - minutes = date.getUTCMinutes(), - seconds = date.getUTCSeconds(), - milliseconds = date.getUTCMilliseconds(); - return isNaN(date) ? "Invalid Date" - : formatYear(date.getUTCFullYear()) + "-" + 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(seconds, 2) + "Z" - : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" - : ""); -} - -function dsv(delimiter) { - var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), - DELIMITER = delimiter.charCodeAt(0); - - function parse(text, f) { - var convert, columns, rows = parseRows(text, function(row, i) { - if (convert) return convert(row, i - 1); - columns = row, convert = f ? customConverter(row, f) : objectConverter(row); - }); - rows.columns = columns || []; - return rows; - } - - function parseRows(text, f) { - var rows = [], // output rows - N = text.length, - I = 0, // current character index - n = 0, // current line number - t, // current token - eof = N <= 0, // current token followed by EOF? - eol = false; // current token followed by EOL? - - // Strip the trailing newline. - if (text.charCodeAt(N - 1) === NEWLINE) --N; - if (text.charCodeAt(N - 1) === RETURN) --N; - - function token() { - if (eof) return EOF; - if (eol) return eol = false, EOL; - - // Unescape quotes. - var i, j = I, c; - if (text.charCodeAt(j) === QUOTE) { - while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE); - if ((i = I) >= N) eof = true; - else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true; - else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; } - return text.slice(j + 1, i - 1).replace(/""/g, "\""); - } - - // Find next delimiter or newline. - while (I < N) { - if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true; - else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; } - else if (c !== DELIMITER) continue; - return text.slice(j, i); - } - - // Return last token before EOF. - return eof = true, text.slice(j, N); - } - - while ((t = token()) !== EOF) { - var row = []; - while (t !== EOL && t !== EOF) row.push(t), t = token(); - if (f && (row = f(row, n++)) == 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 == null) columns = inferColumns(rows); - return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); - } - - function formatBody(rows, columns) { - if (columns == null) columns = 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 == null ? "" - : value instanceof Date ? formatDate(value) - : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" - : value; - } - - return { - parse: parse, - parseRows: parseRows, - format: format, - formatBody: formatBody, - formatRows: formatRows, - formatRow: formatRow, - formatValue: formatValue - }; -} - -var csv = dsv(","); - -var csvParse = csv.parse; -var csvParseRows = csv.parseRows; -var csvFormat = csv.format; -var csvFormatBody = csv.formatBody; -var csvFormatRows = csv.formatRows; -var csvFormatRow = csv.formatRow; -var csvFormatValue = csv.formatValue; - -var tsv = dsv("\t"); - -var tsvParse = tsv.parse; -var tsvParseRows = tsv.parseRows; -var tsvFormat = tsv.format; -var tsvFormatBody = tsv.formatBody; -var tsvFormatRows = tsv.formatRows; -var tsvFormatRow = tsv.formatRow; -var tsvFormatValue = tsv.formatValue; - -function autoType(object) { - for (var key in object) { - var value = object[key].trim(), number, m; - if (!value) value = null; - else if (value === "true") value = true; - else if (value === "false") value = false; - else if (value === "NaN") value = NaN; - else if (!isNaN(number = +value)) value = number; - else if (m = value.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)) { - if (fixtz && !!m[4] && !m[7]) value = value.replace(/-/g, "/").replace(/T/, " "); - value = new Date(value); - } - else continue; - object[key] = value; - } - return object; -} - -// https://github.com/d3/d3-dsv/issues/45 -var fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours(); - -exports.autoType = autoType; -exports.csvFormat = csvFormat; -exports.csvFormatBody = csvFormatBody; -exports.csvFormatRow = csvFormatRow; -exports.csvFormatRows = csvFormatRows; -exports.csvFormatValue = csvFormatValue; -exports.csvParse = csvParse; -exports.csvParseRows = csvParseRows; -exports.dsvFormat = dsv; -exports.tsvFormat = tsvFormat; -exports.tsvFormatBody = tsvFormatBody; -exports.tsvFormatRow = tsvFormatRow; -exports.tsvFormatRows = tsvFormatRows; -exports.tsvFormatValue = tsvFormatValue; -exports.tsvParse = tsvParse; -exports.tsvParseRows = tsvParseRows; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-dsv/dist/d3-dsv.min.js b/node_modules/d3-dsv/dist/d3-dsv.min.js deleted file mode 100644 index 07274ed..0000000 --- a/node_modules/d3-dsv/dist/d3-dsv.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-dsv/ v1.2.0 Copyright 2019 Mike Bostock -!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).d3=r.d3||{})}(this,function(r){"use strict";var t={},e={},n=34,o=10,a=13;function u(r){return new Function("d","return {"+r.map(function(r,t){return JSON.stringify(r)+": d["+t+'] || ""'}).join(",")+"}")}function f(r){var t=Object.create(null),e=[];return r.forEach(function(r){for(var n in r)n in t||e.push(t[n]=n)}),e}function i(r,t){var e=r+"",n=e.length;return n9999?"+"+i(t,6):i(t,4))+"-"+i(r.getUTCMonth()+1,2)+"-"+i(r.getUTCDate(),2)+(a?"T"+i(e,2)+":"+i(n,2)+":"+i(o,2)+"."+i(a,3)+"Z":o?"T"+i(e,2)+":"+i(n,2)+":"+i(o,2)+"Z":n||e?"T"+i(e,2)+":"+i(n,2)+"Z":"")}function c(r){var i=new RegExp('["'+r+"\n\r]"),c=r.charCodeAt(0);function l(r,u){var f,i=[],s=r.length,l=0,d=0,m=s<=0,v=!1;function p(){if(m)return e;if(v)return v=!1,t;var u,f,i=l;if(r.charCodeAt(i)===n){for(;l++=s?m=!0:(f=r.charCodeAt(l++))===o?v=!0:f===a&&(v=!0,r.charCodeAt(l)===o&&++l),r.slice(i+1,u-1).replace(/""/g,'"')}for(;l 9999 ? "+" + pad(year, 6) - : pad(year, 4); -} - -function formatDate(date) { - var hours = date.getUTCHours(), - minutes = date.getUTCMinutes(), - seconds = date.getUTCSeconds(), - milliseconds = 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(seconds, 2) + "Z" - : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" - : ""); -} - -export default function(delimiter) { - var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), - DELIMITER = delimiter.charCodeAt(0); - - function parse(text, f) { - var convert, columns, rows = parseRows(text, function(row, i) { - if (convert) return convert(row, i - 1); - columns = row, convert = f ? customConverter(row, f) : objectConverter(row); - }); - rows.columns = columns || []; - return rows; - } - - function parseRows(text, f) { - var rows = [], // output rows - N = text.length, - I = 0, // current character index - n = 0, // current line number - t, // current token - eof = N <= 0, // current token followed by EOF? - eol = false; // current token followed by EOL? - - // Strip the trailing newline. - if (text.charCodeAt(N - 1) === NEWLINE) --N; - if (text.charCodeAt(N - 1) === RETURN) --N; - - function token() { - if (eof) return EOF; - if (eol) return eol = false, EOL; - - // Unescape quotes. - var i, j = I, c; - if (text.charCodeAt(j) === QUOTE) { - while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE); - if ((i = I) >= N) eof = true; - else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true; - else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; } - return text.slice(j + 1, i - 1).replace(/""/g, "\""); - } - - // Find next delimiter or newline. - while (I < N) { - if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true; - else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; } - else if (c !== DELIMITER) continue; - return text.slice(j, i); - } - - // Return last token before EOF. - return eof = true, text.slice(j, N); - } - - while ((t = token()) !== EOF) { - var row = []; - while (t !== EOL && t !== EOF) row.push(t), t = token(); - if (f && (row = f(row, n++)) == 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 == null) columns = inferColumns(rows); - return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); - } - - function formatBody(rows, columns) { - if (columns == null) columns = 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 == null ? "" - : value instanceof Date ? formatDate(value) - : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" - : value; - } - - return { - parse: parse, - parseRows: parseRows, - format: format, - formatBody: formatBody, - formatRows: formatRows, - formatRow: formatRow, - formatValue: formatValue - }; -} diff --git a/node_modules/d3-dsv/src/index.js b/node_modules/d3-dsv/src/index.js deleted file mode 100644 index 0a63fff..0000000 --- a/node_modules/d3-dsv/src/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export {default as dsvFormat} from "./dsv.js"; -export {csvParse, csvParseRows, csvFormat, csvFormatBody, csvFormatRows, csvFormatRow, csvFormatValue} from "./csv.js"; -export {tsvParse, tsvParseRows, tsvFormat, tsvFormatBody, tsvFormatRows, tsvFormatRow, tsvFormatValue} from "./tsv.js"; -export {default as autoType} from "./autoType.js"; diff --git a/node_modules/d3-dsv/src/tsv.js b/node_modules/d3-dsv/src/tsv.js deleted file mode 100644 index 38b16c2..0000000 --- a/node_modules/d3-dsv/src/tsv.js +++ /dev/null @@ -1,11 +0,0 @@ -import dsv from "./dsv.js"; - -var tsv = dsv("\t"); - -export var tsvParse = tsv.parse; -export var tsvParseRows = tsv.parseRows; -export var tsvFormat = tsv.format; -export var tsvFormatBody = tsv.formatBody; -export var tsvFormatRows = tsv.formatRows; -export var tsvFormatRow = tsv.formatRow; -export var tsvFormatValue = tsv.formatValue; diff --git a/node_modules/d3-force/LICENSE b/node_modules/d3-force/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-force/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-force/README.md b/node_modules/d3-force/README.md deleted file mode 100644 index a042ac7..0000000 --- a/node_modules/d3-force/README.md +++ /dev/null @@ -1,458 +0,0 @@ -# d3-force - -This module implements a [velocity Verlet](https://en.wikipedia.org/wiki/Verlet_integration) numerical integrator for simulating physical forces on particles. The simulation is simplified: it assumes a constant unit time step Δ*t* = 1 for each step, and a constant unit mass *m* = 1 for all particles. As a result, a force *F* acting on a particle is equivalent to a constant acceleration *a* over the time interval Δ*t*, and can be simulated simply by adding to the particle’s velocity, which is then added to the particle’s position. - -In the domain of information visualization, physical simulations are useful for studying [networks](http://bl.ocks.org/mbostock/ad70335eeef6d167bc36fd3c04378048) and [hierarchies](http://bl.ocks.org/mbostock/95aa92e2f4e8345aaa55a4a94d41ce37)! - -[Force Dragging III](http://bl.ocks.org/mbostock/ad70335eeef6d167bc36fd3c04378048)[Force-Directed Tree](http://bl.ocks.org/mbostock/95aa92e2f4e8345aaa55a4a94d41ce37) - -You can also simulate circles (disks) with collision, such as for [bubble charts](http://www.nytimes.com/interactive/2012/09/06/us/politics/convention-word-counts.html) or [beeswarm plots](http://bl.ocks.org/mbostock/6526445e2b44303eebf21da3b6627320): - -[Collision Detection](http://bl.ocks.org/mbostock/31ce330646fa8bcb7289ff3b97aab3f5)[Beeswarm](http://bl.ocks.org/mbostock/6526445e2b44303eebf21da3b6627320) - -You can even use it as a rudimentary physics engine, say to simulate cloth: - -[Force-Directed Lattice](http://bl.ocks.org/mbostock/1b64ec067fcfc51e7471d944f51f1611) - -To use this module, create a [simulation](#simulation) for an array of [nodes](#simulation_nodes), and compose the desired [forces](#simulation_force). Then [listen](#simulation_on) for tick events to render the nodes as they update in your preferred graphics system, such as Canvas or SVG. - -## Installing - -If you use NPM, `npm install d3-force`. Otherwise, download the [latest release](https://github.com/d3/d3-force/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-force.v2.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3_force` global is exported: - -```html - - - - - -``` - -[Try d3-force in your browser.](https://beta.observablehq.com/@mbostock/d3-force-directed-graph) - -## API Reference - -### Simulation - -# d3.forceSimulation([nodes]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js "Source") - -Creates a new simulation with the specified array of [*nodes*](#simulation_nodes) and no [forces](#simulation_force). If *nodes* is not specified, it defaults to the empty array. The simulator [starts](#simulation_restart) automatically; use [*simulation*.on](#simulation_on) to listen for tick events as the simulation runs. If you wish to run the simulation manually instead, call [*simulation*.stop](#simulation_stop), and then call [*simulation*.tick](#simulation_tick) as desired. - -# simulation.restart() [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L86 "Source") - -Restarts the simulation’s internal timer and returns the simulation. In conjunction with [*simulation*.alphaTarget](#simulation_alphaTarget) or [*simulation*.alpha](#simulation_alpha), this method can be used to “reheat” the simulation during interaction, such as when dragging a node, or to resume the simulation after temporarily pausing it with [*simulation*.stop](#simulation_stop). - -# simulation.stop() [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L90 "Source") - -Stops the simulation’s internal timer, if it is running, and returns the simulation. If the timer is already stopped, this method does nothing. This method is useful for running the simulation manually; see [*simulation*.tick](#simulation_tick). - -# simulation.tick([iterations]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L38 "Source") - -Manually steps the simulation by the specified number of *iterations*, and returns the simulation. If *iterations* is not specified, it defaults to 1 (single step). - -For each iteration, it increments the current [*alpha*](#simulation_alpha) by ([*alphaTarget*](#simulation_alphaTarget) - *alpha*) × [*alphaDecay*](#simulation_alphaDecay); then invokes each registered [force](#simulation_force), passing the new *alpha*; then decrements each [node](#simulation_nodes)’s velocity by *velocity* × [*velocityDecay*](#simulation_velocityDecay); lastly increments each node’s position by *velocity*. - -This method does not dispatch [events](#simulation_on); events are only dispatched by the internal timer when the simulation is started automatically upon [creation](#forceSimulation) or by calling [*simulation*.restart](#simulation_restart). The natural number of ticks when the simulation is started is ⌈*log*([*alphaMin*](#simulation_alphaMin)) / *log*(1 - [*alphaDecay*](#simulation_alphaDecay))⌉; by default, this is 300. - -This method can be used in conjunction with [*simulation*.stop](#simulation_stop) to compute a [static force layout](https://bl.ocks.org/mbostock/1667139). For large graphs, static layouts should be computed [in a web worker](https://bl.ocks.org/mbostock/01ab2e85e8727d6529d20391c0fd9a16) to avoid freezing the user interface. - -# simulation.nodes([nodes]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L94 "Source") - -If *nodes* is specified, sets the simulation’s nodes to the specified array of objects, initializing their positions and velocities if necessary, and then [re-initializes](#force_initialize) any bound [forces](#simulation_force); returns the simulation. If *nodes* is not specified, returns the simulation’s array of nodes as specified to the [constructor](#forceSimulation). - -Each *node* must be an object. The following properties are assigned by the simulation: - -* `index` - the node’s zero-based index into *nodes* -* `x` - the node’s current *x*-position -* `y` - the node’s current *y*-position -* `vx` - the node’s current *x*-velocity -* `vy` - the node’s current *y*-velocity - -The position ⟨*x*,*y*⟩ and velocity ⟨*vx*,*vy*⟩ may be subsequently modified by [forces](#forces) and by the simulation. If either *vx* or *vy* is NaN, the velocity is initialized to ⟨0,0⟩. If either *x* or *y* is NaN, the position is initialized in a [phyllotaxis arrangement](http://bl.ocks.org/mbostock/11478058), so chosen to ensure a deterministic, uniform distribution around the origin. - -To fix a node in a given position, you may specify two additional properties: - -* `fx` - the node’s fixed *x*-position -* `fy` - the node’s fixed *y*-position - -At the end of each [tick](#simulation_tick), after the application of any forces, a node with a defined *node*.fx has *node*.x reset to this value and *node*.vx set to zero; likewise, a node with a defined *node*.fy has *node*.y reset to this value and *node*.vy set to zero. To unfix a node that was previously fixed, set *node*.fx and *node*.fy to null, or delete these properties. - -If the specified array of *nodes* is modified, such as when nodes are added to or removed from the simulation, this method must be called again with the new (or changed) array to notify the simulation and bound forces of the change; the simulation does not make a defensive copy of the specified array. - -# simulation.alpha([alpha]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L98 "Source") - -If *alpha* is specified, sets the current alpha to the specified number in the range [0,1] and returns this simulation. If *alpha* is not specified, returns the current alpha value, which defaults to 1. - -# simulation.alphaMin([min]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L102 "Source") - -If *min* is specified, sets the minimum *alpha* to the specified number in the range [0,1] and returns this simulation. If *min* is not specified, returns the current minimum *alpha* value, which defaults to 0.001. The simulation’s internal timer stops when the current [*alpha*](#simulation_alpha) is less than the minimum *alpha*. The default [alpha decay rate](#simulation_alphaDecay) of ~0.0228 corresponds to 300 iterations. - -# simulation.alphaDecay([decay]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L106 "Source") - -If *decay* is specified, sets the [*alpha*](#simulation_alpha) decay rate to the specified number in the range [0,1] and returns this simulation. If *decay* is not specified, returns the current *alpha* decay rate, which defaults to 0.0228… = 1 - *pow*(0.001, 1 / 300) where 0.001 is the default [minimum *alpha*](#simulation_alphaMin). - -The alpha decay rate determines how quickly the current alpha interpolates towards the desired [target *alpha*](#simulation_alphaTarget); since the default target *alpha* is zero, by default this controls how quickly the simulation cools. Higher decay rates cause the simulation to stabilize more quickly, but risk getting stuck in a local minimum; lower values cause the simulation to take longer to run, but typically converge on a better layout. To have the simulation run forever at the current *alpha*, set the *decay* rate to zero; alternatively, set a [target *alpha*](#simulation_alphaTarget) greater than the [minimum *alpha*](#simulation_alphaMin). - -# simulation.alphaTarget([target]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L110 "Source") - -If *target* is specified, sets the current target [*alpha*](#simulation_alpha) to the specified number in the range [0,1] and returns this simulation. If *target* is not specified, returns the current target alpha value, which defaults to 0. - -# simulation.velocityDecay([decay]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L114 "Source") - -If *decay* is specified, sets the velocity decay factor to the specified number in the range [0,1] and returns this simulation. If *decay* is not specified, returns the current velocity decay factor, which defaults to 0.4. The decay factor is akin to atmospheric friction; after the application of any forces during a [tick](#simulation_tick), each node’s velocity is multiplied by 1 - *decay*. As with lowering the [alpha decay rate](#simulation_alphaDecay), less velocity decay may converge on a better solution, but risks numerical instabilities and oscillation. - -# simulation.force(name[, force]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L118 "Source") - -If *force* is specified, assigns the [force](#forces) for the specified *name* and returns this simulation. If *force* is not specified, returns the force with the specified name, or undefined if there is no such force. (By default, new simulations have no forces.) For example, to create a new simulation to layout a graph, you might say: - -```js -var simulation = d3.forceSimulation(nodes) - .force("charge", d3.forceManyBody()) - .force("link", d3.forceLink(links)) - .force("center", d3.forceCenter()); -``` - -To remove the force with the given *name*, pass null as the *force*. For example, to remove the charge force: - -```js -simulation.force("charge", null); -``` - -# simulation.find(x, y[, radius]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L122 "Source") - -Returns the node closest to the position ⟨*x*,*y*⟩ with the given search *radius*. If *radius* is not specified, it defaults to infinity. If there is no node within the search area, returns undefined. - -# simulation.on(typenames, [listener]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L145 "Source") - -If *listener* is specified, sets the event *listener* for the specified *typenames* and returns this simulation. If an event listener was already registered for the same type and name, the existing listener is removed before the new listener is added. If *listener* is null, removes the current event listeners for the specified *typenames*, if any. If *listener* is not specified, returns the first currently-assigned listener matching the specified *typenames*, if any. When a specified event is dispatched, each *listener* will be invoked with the `this` context as the simulation. - -The *typenames* is a string containing one or more *typename* separated by whitespace. Each *typename* is a *type*, optionally followed by a period (`.`) and a *name*, such as `tick.foo` and `tick.bar`; the name allows multiple listeners to be registered for the same *type*. The *type* must be one of the following: - -* `tick` - after each tick of the simulation’s internal timer. -* `end` - after the simulation’s timer stops when *alpha* < [*alphaMin*](#simulation_alphaMin). - -Note that *tick* events are not dispatched when [*simulation*.tick](#simulation_tick) is called manually; events are only dispatched by the internal timer and are intended for interactive rendering of the simulation. To affect the simulation, register [forces](#simulation_force) instead of modifying nodes’ positions or velocities inside a tick event listener. - -See [*dispatch*.on](https://github.com/d3/d3-dispatch#dispatch_on) for details. - -### Forces - -A *force* is simply a function that modifies nodes’ positions or velocities; in this context, a *force* can apply a classical physical force such as electrical charge or gravity, or it can resolve a geometric constraint, such as keeping nodes within a bounding box or keeping linked nodes a fixed distance apart. For example, a simple positioning force that moves nodes towards the origin ⟨0,0⟩ might be implemented as: - -```js -function force(alpha) { - for (var i = 0, n = nodes.length, node, k = alpha * 0.1; i < n; ++i) { - node = nodes[i]; - node.vx -= node.x * k; - node.vy -= node.y * k; - } -} -``` - -Forces typically read the node’s current position ⟨*x*,*y*⟩ and then add to (or subtract from) the node’s velocity ⟨*vx*,*vy*⟩. However, forces may also “peek ahead” to the anticipated next position of the node, ⟨*x* + *vx*,*y* + *vy*⟩; this is necessary for resolving geometric constraints through [iterative relaxation](https://en.wikipedia.org/wiki/Relaxation_\(iterative_method\)). Forces may also modify the position directly, which is sometimes useful to avoid adding energy to the simulation, such as when recentering the simulation in the viewport. - -Simulations typically compose multiple forces as desired. This module provides several for your enjoyment: - -* [Centering](#centering) -* [Collision](#collision) -* [Links](#links) -* [Many-Body](#many-body) -* [Positioning](#positioning) - -Forces may optionally implement [*force*.initialize](#force_initialize) to receive the simulation’s array of nodes. - -# force(alpha) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L47 "Source") - -Applies this force, optionally observing the specified *alpha*. Typically, the force is applied to the array of nodes previously passed to [*force*.initialize](#force_initialize), however, some forces may apply to a subset of nodes, or behave differently. For example, [d3.forceLink](#links) applies to the source and target of each link. - -# force.initialize(nodes) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L77 "Source") - -Assigns the array of *nodes* to this force. This method is called when a force is bound to a simulation via [*simulation*.force](#simulation_force) and when the simulation’s nodes change via [*simulation*.nodes](#simulation_nodes). A force may perform necessary work during initialization, such as evaluating per-node parameters, to avoid repeatedly performing work during each application of the force. - -#### Centering - -The centering force translates nodes uniformly so that the mean position of all nodes (the center of mass if all nodes have equal weight) is at the given position ⟨[*x*](#center_x),[*y*](#center_y)⟩. This force modifies the positions of nodes on each application; it does not modify velocities, as doing so would typically cause the nodes to overshoot and oscillate around the desired center. This force helps keeps nodes in the center of the viewport, and unlike the [positioning force](#positioning), it does not distort their relative positions. - -# d3.forceCenter([x, y]) [<>](https://github.com/d3/d3-force/blob/master/src/center.js#L1 "Source") - -Creates a new centering force with the specified [*x*-](#center_x) and [*y*-](#center_y) coordinates. If *x* and *y* are not specified, they default to ⟨0,0⟩. - -# center.x([x]) [<>](https://github.com/d3/d3-force/blob/master/src/center.js#L27 "Source") - -If *x* is specified, sets the *x*-coordinate of the centering position to the specified number and returns this force. If *x* is not specified, returns the current *x*-coordinate, which defaults to zero. - -# center.y([y]) [<>](https://github.com/d3/d3-force/blob/master/src/center.js#L31 "Source") - -If *y* is specified, sets the *y*-coordinate of the centering position to the specified number and returns this force. If *y* is not specified, returns the current *y*-coordinate, which defaults to zero. - -#### Collision - -The collision force treats nodes as circles with a given [radius](#collide_radius), rather than points, and prevents nodes from overlapping. More formally, two nodes *a* and *b* are separated so that the distance between *a* and *b* is at least *radius*(*a*) + *radius*(*b*). To reduce jitter, this is by default a “soft” constraint with a configurable [strength](#collide_strength) and [iteration count](#collide_iterations). - -# d3.forceCollide([radius]) [<>](https://github.com/d3/d3-force/blob/master/src/collide.js "Source") - -Creates a new circle collision force with the specified [*radius*](#collide_radius). If *radius* is not specified, it defaults to the constant one for all nodes. - -# collide.radius([radius]) [<>](https://github.com/d3/d3-force/blob/master/src/collide.js#L86 "Source") - -If *radius* is specified, sets the radius accessor to the specified number or function, re-evaluates the radius accessor for each node, and returns this force. If *radius* is not specified, returns the current radius accessor, which defaults to: - -```js -function radius() { - return 1; -} -``` - -The radius accessor is invoked for each [node](#simulation_nodes) in the simulation, being passed the *node* and its zero-based *index*. The resulting number is then stored internally, such that the radius of each node is only recomputed when the force is initialized or when this method is called with a new *radius*, and not on every application of the force. - -# collide.strength([strength]) [<>](https://github.com/d3/d3-force/blob/master/src/collide.js#L82 "Source") - -If *strength* is specified, sets the force strength to the specified number in the range [0,1] and returns this force. If *strength* is not specified, returns the current strength which defaults to 0.7. - -Overlapping nodes are resolved through iterative relaxation. For each node, the other nodes that are anticipated to overlap at the next tick (using the anticipated positions ⟨*x* + *vx*,*y* + *vy*⟩) are determined; the node’s velocity is then modified to push the node out of each overlapping node. The change in velocity is dampened by the force’s strength such that the resolution of simultaneous overlaps can be blended together to find a stable solution. - -# collide.iterations([iterations]) [<>](https://github.com/d3/d3-force/blob/master/src/collide.js#L78 "Source") - -If *iterations* is specified, sets the number of iterations per application to the specified number and returns this force. If *iterations* is not specified, returns the current iteration count which defaults to 1. Increasing the number of iterations greatly increases the rigidity of the constraint and avoids partial overlap of nodes, but also increases the runtime cost to evaluate the force. - -#### Links - -The link force pushes linked nodes together or apart according to the desired [link distance](#link_distance). The strength of the force is proportional to the difference between the linked nodes’ distance and the target distance, similar to a spring force. - -# d3.forceLink([links]) [<>](https://github.com/d3/d3-force/blob/master/src/link.js "Source") - -Creates a new link force with the specified *links* and default parameters. If *links* is not specified, it defaults to the empty array. - -# link.links([links]) [<>](https://github.com/d3/d3-force/blob/master/src/link.js#L92 "Source") - -If *links* is specified, sets the array of links associated with this force, recomputes the [distance](#link_distance) and [strength](#link_strength) parameters for each link, and returns this force. If *links* is not specified, returns the current array of links, which defaults to the empty array. - -Each link is an object with the following properties: - -* `source` - the link’s source node; see [*simulation*.nodes](#simulation_nodes) -* `target` - the link’s target node; see [*simulation*.nodes](#simulation_nodes) -* `index` - the zero-based index into *links*, assigned by this method - -For convenience, a link’s source and target properties may be initialized using numeric or string identifiers rather than object references; see [*link*.id](#link_id). When the link force is [initialized](#force_initialize) (or re-initialized, as when the nodes or links change), any *link*.source or *link*.target property which is *not* an object is replaced by an object reference to the corresponding *node* with the given identifier. - -If the specified array of *links* is modified, such as when links are added to or removed from the simulation, this method must be called again with the new (or changed) array to notify the force of the change; the force does not make a defensive copy of the specified array. - -# link.id([id]) [<>](https://github.com/d3/d3-force/blob/master/src/link.js#L96 "Source") - -If *id* is specified, sets the node id accessor to the specified function and returns this force. If *id* is not specified, returns the current node id accessor, which defaults to the numeric *node*.index: - -```js -function id(d) { - return d.index; -} -``` - -The default id accessor allows each link’s source and target to be specified as a zero-based index into the [nodes](#simulation_nodes) array. For example: - -```js -var nodes = [ - {"id": "Alice"}, - {"id": "Bob"}, - {"id": "Carol"} -]; - -var links = [ - {"source": 0, "target": 1}, // Alice → Bob - {"source": 1, "target": 2} // Bob → Carol -]; -``` - -Now consider a different id accessor that returns a string: - -```js -function id(d) { - return d.id; -} -``` - -With this accessor, you can use named sources and targets: - -```js -var nodes = [ - {"id": "Alice"}, - {"id": "Bob"}, - {"id": "Carol"} -]; - -var links = [ - {"source": "Alice", "target": "Bob"}, - {"source": "Bob", "target": "Carol"} -]; -``` - -This is particularly useful when representing graphs in JSON, as JSON does not allow references. See [this example](http://bl.ocks.org/mbostock/f584aa36df54c451c94a9d0798caed35). - -The id accessor is invoked for each node whenever the force is initialized, as when the [nodes](#simulation_nodes) or [links](#link_links) change, being passed the node and its zero-based index. - -# link.distance([distance]) [<>](https://github.com/d3/d3-force/blob/master/src/link.js#L108 "Source") - -If *distance* is specified, sets the distance accessor to the specified number or function, re-evaluates the distance accessor for each link, and returns this force. If *distance* is not specified, returns the current distance accessor, which defaults to: - -```js -function distance() { - return 30; -} -``` - -The distance accessor is invoked for each [link](#link_links), being passed the *link* and its zero-based *index*. The resulting number is then stored internally, such that the distance of each link is only recomputed when the force is initialized or when this method is called with a new *distance*, and not on every application of the force. - -# link.strength([strength]) [<>](https://github.com/d3/d3-force/blob/master/src/link.js#L104 "Source") - -If *strength* is specified, sets the strength accessor to the specified number or function, re-evaluates the strength accessor for each link, and returns this force. If *strength* is not specified, returns the current strength accessor, which defaults to: - -```js -function strength(link) { - return 1 / Math.min(count(link.source), count(link.target)); -} -``` - -Where *count*(*node*) is a function that returns the number of links with the given node as a source or target. This default was chosen because it automatically reduces the strength of links connected to heavily-connected nodes, improving stability. - -The strength accessor is invoked for each [link](#link_links), being passed the *link* and its zero-based *index*. The resulting number is then stored internally, such that the strength of each link is only recomputed when the force is initialized or when this method is called with a new *strength*, and not on every application of the force. - -# link.iterations([iterations]) [<>](https://github.com/d3/d3-force/blob/master/src/link.js#L100 "Source") - -If *iterations* is specified, sets the number of iterations per application to the specified number and returns this force. If *iterations* is not specified, returns the current iteration count which defaults to 1. Increasing the number of iterations greatly increases the rigidity of the constraint and is useful for [complex structures such as lattices](http://bl.ocks.org/mbostock/1b64ec067fcfc51e7471d944f51f1611), but also increases the runtime cost to evaluate the force. - -#### Many-Body - -The many-body (or *n*-body) force applies mutually amongst all [nodes](#simulation_nodes). It can be used to simulate gravity (attraction) if the [strength](#manyBody_strength) is positive, or electrostatic charge (repulsion) if the strength is negative. This implementation uses quadtrees and the [Barnes–Hut approximation](https://en.wikipedia.org/wiki/Barnes–Hut_simulation) to greatly improve performance; the accuracy can be customized using the [theta](#manyBody_theta) parameter. - -Unlike links, which only affect two linked nodes, the charge force is global: every node affects every other node, even if they are on disconnected subgraphs. - -# d3.forceManyBody() [<>](https://github.com/d3/d3-force/blob/master/src/manyBody.js "Source") - -Creates a new many-body force with the default parameters. - -# manyBody.strength([strength]) [<>](https://github.com/d3/d3-force/blob/master/src/manyBody.js#L97 "Source") - -If *strength* is specified, sets the strength accessor to the specified number or function, re-evaluates the strength accessor for each node, and returns this force. A positive value causes nodes to attract each other, similar to gravity, while a negative value causes nodes to repel each other, similar to electrostatic charge. If *strength* is not specified, returns the current strength accessor, which defaults to: - -```js -function strength() { - return -30; -} -``` - -The strength accessor is invoked for each [node](#simulation_nodes) in the simulation, being passed the *node* and its zero-based *index*. The resulting number is then stored internally, such that the strength of each node is only recomputed when the force is initialized or when this method is called with a new *strength*, and not on every application of the force. - -# manyBody.theta([theta]) [<>](https://github.com/d3/d3-force/blob/master/src/manyBody.js#L109 "Source") - -If *theta* is specified, sets the Barnes–Hut approximation criterion to the specified number and returns this force. If *theta* is not specified, returns the current value, which defaults to 0.9. - -To accelerate computation, this force implements the [Barnes–Hut approximation](http://en.wikipedia.org/wiki/Barnes–Hut_simulation) which takes O(*n* log *n*) per application where *n* is the number of [nodes](#simulation_nodes). For each application, a [quadtree](https://github.com/d3/d3-quadtree) stores the current node positions; then for each node, the combined force of all other nodes on the given node is computed. For a cluster of nodes that is far away, the charge force can be approximated by treating the cluster as a single, larger node. The *theta* parameter determines the accuracy of the approximation: if the ratio *w* / *l* of the width *w* of the quadtree cell to the distance *l* from the node to the cell’s center of mass is less than *theta*, all nodes in the given cell are treated as a single node rather than individually. - -# manyBody.distanceMin([distance]) [<>](https://github.com/d3/d3-force/blob/master/src/manyBody.js#L101 "Source") - -If *distance* is specified, sets the minimum distance between nodes over which this force is considered. If *distance* is not specified, returns the current minimum distance, which defaults to 1. A minimum distance establishes an upper bound on the strength of the force between two nearby nodes, avoiding instability. In particular, it avoids an infinitely-strong force if two nodes are exactly coincident; in this case, the direction of the force is random. - -# manyBody.distanceMax([distance]) [<>](https://github.com/d3/d3-force/blob/master/src/manyBody.js#L105 "Source") - -If *distance* is specified, sets the maximum distance between nodes over which this force is considered. If *distance* is not specified, returns the current maximum distance, which defaults to infinity. Specifying a finite maximum distance improves performance and produces a more localized layout. - -#### Positioning - -The [*x*](#forceX)- and [*y*](#forceY)-positioning forces push nodes towards a desired position along the given dimension with a configurable strength. The [*radial*](#forceRadial) force is similar, except it pushes nodes towards the closest point on a given circle. The strength of the force is proportional to the one-dimensional distance between the node’s position and the target position. While these forces can be used to position individual nodes, they are intended primarily for global forces that apply to all (or most) nodes. - -# d3.forceX([x]) [<>](https://github.com/d3/d3-force/blob/master/src/x.js "Source") - -Creates a new positioning force along the *x*-axis towards the given position [*x*](#x_x). If *x* is not specified, it defaults to 0. - -# x.strength([strength]) [<>](https://github.com/d3/d3-force/blob/master/src/x.js#L32 "Source") - -If *strength* is specified, sets the strength accessor to the specified number or function, re-evaluates the strength accessor for each node, and returns this force. The *strength* determines how much to increment the node’s *x*-velocity: ([*x*](#x_x) - *node*.x) × *strength*. For example, a value of 0.1 indicates that the node should move a tenth of the way from its current *x*-position to the target *x*-position with each application. Higher values moves nodes more quickly to the target position, often at the expense of other forces or constraints. A value outside the range [0,1] is not recommended. - -If *strength* is not specified, returns the current strength accessor, which defaults to: - -```js -function strength() { - return 0.1; -} -``` - -The strength accessor is invoked for each [node](#simulation_nodes) in the simulation, being passed the *node* and its zero-based *index*. The resulting number is then stored internally, such that the strength of each node is only recomputed when the force is initialized or when this method is called with a new *strength*, and not on every application of the force. - -# x.x([x]) [<>](https://github.com/d3/d3-force/blob/master/src/x.js#L36 "Source") - -If *x* is specified, sets the *x*-coordinate accessor to the specified number or function, re-evaluates the *x*-accessor for each node, and returns this force. If *x* is not specified, returns the current *x*-accessor, which defaults to: - -```js -function x() { - return 0; -} -``` - -The *x*-accessor is invoked for each [node](#simulation_nodes) in the simulation, being passed the *node* and its zero-based *index*. The resulting number is then stored internally, such that the target *x*-coordinate of each node is only recomputed when the force is initialized or when this method is called with a new *x*, and not on every application of the force. - -# d3.forceY([y]) [<>](https://github.com/d3/d3-force/blob/master/src/y.js "Source") - -Creates a new positioning force along the *y*-axis towards the given position [*y*](#y_y). If *y* is not specified, it defaults to 0. - -# y.strength([strength]) [<>](https://github.com/d3/d3-force/blob/master/src/y.js#L32 "Source") - -If *strength* is specified, sets the strength accessor to the specified number or function, re-evaluates the strength accessor for each node, and returns this force. The *strength* determines how much to increment the node’s *y*-velocity: ([*y*](#y_y) - *node*.y) × *strength*. For example, a value of 0.1 indicates that the node should move a tenth of the way from its current *y*-position to the target *y*-position with each application. Higher values moves nodes more quickly to the target position, often at the expense of other forces or constraints. A value outside the range [0,1] is not recommended. - -If *strength* is not specified, returns the current strength accessor, which defaults to: - -```js -function strength() { - return 0.1; -} -``` - -The strength accessor is invoked for each [node](#simulation_nodes) in the simulation, being passed the *node* and its zero-based *index*. The resulting number is then stored internally, such that the strength of each node is only recomputed when the force is initialized or when this method is called with a new *strength*, and not on every application of the force. - -# y.y([y]) [<>](https://github.com/d3/d3-force/blob/master/src/y.js#L36 "Source") - -If *y* is specified, sets the *y*-coordinate accessor to the specified number or function, re-evaluates the *y*-accessor for each node, and returns this force. If *y* is not specified, returns the current *y*-accessor, which defaults to: - -```js -function y() { - return 0; -} -``` - -The *y*-accessor is invoked for each [node](#simulation_nodes) in the simulation, being passed the *node* and its zero-based *index*. The resulting number is then stored internally, such that the target *y*-coordinate of each node is only recomputed when the force is initialized or when this method is called with a new *y*, and not on every application of the force. - -# d3.forceRadial(radius[, x][, y]) [<>](https://github.com/d3/d3-force/blob/master/src/radial.js "Source") - -[Radial Force](https://bl.ocks.org/mbostock/cd98bf52e9067e26945edd95e8cf6ef9) - -Creates a new positioning force towards a circle of the specified [*radius*](#radial_radius) centered at ⟨[*x*](#radial_x),[*y*](#radial_y)⟩. If *x* and *y* are not specified, they default to ⟨0,0⟩. - -# radial.strength([strength]) [<>](https://github.com/d3/d3-force/blob/master/src/radial.js "Source") - -If *strength* is specified, sets the strength accessor to the specified number or function, re-evaluates the strength accessor for each node, and returns this force. The *strength* determines how much to increment the node’s *x*- and *y*-velocity. For example, a value of 0.1 indicates that the node should move a tenth of the way from its current position to the closest point on the circle with each application. Higher values moves nodes more quickly to the target position, often at the expense of other forces or constraints. A value outside the range [0,1] is not recommended. - -If *strength* is not specified, returns the current strength accessor, which defaults to: - -```js -function strength() { - return 0.1; -} -``` - -The strength accessor is invoked for each [node](#simulation_nodes) in the simulation, being passed the *node* and its zero-based *index*. The resulting number is then stored internally, such that the strength of each node is only recomputed when the force is initialized or when this method is called with a new *strength*, and not on every application of the force. - -# radial.radius([radius]) [<>](https://github.com/d3/d3-force/blob/master/src/radial.js "Source") - -If *radius* is specified, sets the circle *radius* to the specified number or function, re-evaluates the *radius* accessor for each node, and returns this force. If *radius* is not specified, returns the current *radius* accessor. - -The *radius* accessor is invoked for each [node](#simulation_nodes) in the simulation, being passed the *node* and its zero-based *index*. The resulting number is then stored internally, such that the target radius of each node is only recomputed when the force is initialized or when this method is called with a new *radius*, and not on every application of the force. - -# radial.x([x]) [<>](https://github.com/d3/d3-force/blob/master/src/radial.js "Source") - -If *x* is specified, sets the *x*-coordinate of the circle center to the specified number and returns this force. If *x* is not specified, returns the current *x*-coordinate of the center, which defaults to zero. - -# radial.y([y]) [<>](https://github.com/d3/d3-force/blob/master/src/radial.js "Source") - -If *y* is specified, sets the *y*-coordinate of the circle center to the specified number and returns this force. If *y* is not specified, returns the current *y*-coordinate of the center, which defaults to zero. diff --git a/node_modules/d3-force/dist/d3-force.js b/node_modules/d3-force/dist/d3-force.js deleted file mode 100644 index e979bca..0000000 --- a/node_modules/d3-force/dist/d3-force.js +++ /dev/null @@ -1,668 +0,0 @@ -// https://d3js.org/d3-force/ v2.0.1 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-quadtree'), require('d3-dispatch'), require('d3-timer')) : -typeof define === 'function' && define.amd ? define(['exports', 'd3-quadtree', 'd3-dispatch', 'd3-timer'], factory) : -(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3)); -}(this, (function (exports,d3Quadtree,d3Dispatch,d3Timer) { 'use strict'; - -function center(x, y) { - var nodes; - - if (x == null) x = 0; - if (y == null) y = 0; - - function force() { - var i, - n = nodes.length, - node, - sx = 0, - sy = 0; - - for (i = 0; i < n; ++i) { - node = nodes[i], sx += node.x, sy += node.y; - } - - for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) { - node = nodes[i], node.x -= sx, node.y -= sy; - } - } - - force.initialize = function(_) { - nodes = _; - }; - - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; - }; - - return force; -} - -function constant(x) { - return function() { - return x; - }; -} - -function jiggle() { - return (Math.random() - 0.5) * 1e-6; -} - -function x(d) { - return d.x + d.vx; -} - -function y(d) { - return d.y + d.vy; -} - -function collide(radius) { - var nodes, - radii, - strength = 1, - iterations = 1; - - if (typeof radius !== "function") radius = constant(radius == null ? 1 : +radius); - - function force() { - var i, n = nodes.length, - tree, - node, - xi, - yi, - ri, - ri2; - - for (var k = 0; k < iterations; ++k) { - tree = d3Quadtree.quadtree(nodes, x, y).visitAfter(prepare); - for (i = 0; i < n; ++i) { - node = nodes[i]; - ri = radii[node.index], ri2 = ri * ri; - xi = node.x + node.vx; - yi = node.y + node.vy; - tree.visit(apply); - } - } - - function apply(quad, x0, y0, x1, y1) { - var data = quad.data, rj = quad.r, r = ri + rj; - if (data) { - if (data.index > node.index) { - var x = xi - data.x - data.vx, - y = yi - data.y - data.vy, - l = x * x + y * y; - if (l < r * r) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y *= l) * r; - data.vx -= x * (r = 1 - r); - data.vy -= 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 = radii[quad.data.index]; - for (var i = quad.r = 0; i < 4; ++i) { - if (quad[i] && quad[i].r > quad.r) { - quad.r = quad[i].r; - } - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - radii = new Array(n); - for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes); - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius; - }; - - return force; -} - -function index(d) { - return d.index; -} - -function find(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) throw new Error("missing: " + nodeId); - return node; -} - -function link(links) { - var id = index, - strength = defaultStrength, - strengths, - distance = constant(30), - distances, - nodes, - count, - bias, - iterations = 1; - - if (links == null) links = []; - - function defaultStrength(link) { - return 1 / Math.min(count[link.source.index], count[link.target.index]); - } - - function force(alpha) { - for (var k = 0, n = links.length; k < iterations; ++k) { - for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) { - link = links[i], source = link.source, target = link.target; - x = target.x + target.vx - source.x - source.vx || jiggle(); - y = target.y + target.vy - source.y - source.vy || jiggle(); - l = Math.sqrt(x * x + y * y); - l = (l - distances[i]) / l * alpha * strengths[i]; - x *= l, y *= l; - target.vx -= x * (b = bias[i]); - target.vy -= y * b; - source.vx += x * (b = 1 - b); - source.vy += y * b; - } - } - } - - function initialize() { - if (!nodes) return; - - var i, - n = nodes.length, - m = links.length, - nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d])), - link; - - for (i = 0, count = new Array(n); i < m; ++i) { - link = links[i], link.index = i; - if (typeof link.source !== "object") link.source = find(nodeById, link.source); - if (typeof link.target !== "object") link.target = find(nodeById, link.target); - count[link.source.index] = (count[link.source.index] || 0) + 1; - count[link.target.index] = (count[link.target.index] || 0) + 1; - } - - for (i = 0, bias = new Array(m); i < m; ++i) { - link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); - } - - strengths = new Array(m), initializeStrength(); - distances = new Array(m), initializeDistance(); - } - - function initializeStrength() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - strengths[i] = +strength(links[i], i, links); - } - } - - function initializeDistance() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - distances[i] = +distance(links[i], i, links); - } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - - force.id = function(_) { - return arguments.length ? (id = _, force) : id; - }; - - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initializeStrength(), force) : strength; - }; - - force.distance = function(_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : constant(+_), initializeDistance(), force) : distance; - }; - - return force; -} - -function x$1(d) { - return d.x; -} - -function y$1(d) { - return d.y; -} - -var initialRadius = 10, - initialAngle = Math.PI * (3 - Math.sqrt(5)); - -function simulation(nodes) { - var simulation, - alpha = 1, - alphaMin = 0.001, - alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), - alphaTarget = 0, - velocityDecay = 0.6, - forces = new Map(), - stepper = d3Timer.timer(step), - event = d3Dispatch.dispatch("tick", "end"); - - if (nodes == null) nodes = []; - - function step() { - tick(); - event.call("tick", simulation); - if (alpha < alphaMin) { - stepper.stop(); - event.call("end", simulation); - } - } - - function tick(iterations) { - var i, n = nodes.length, node; - - if (iterations === undefined) iterations = 1; - - for (var k = 0; k < iterations; ++k) { - alpha += (alphaTarget - alpha) * alphaDecay; - - forces.forEach(function(force) { - force(alpha); - }); - - for (i = 0; i < n; ++i) { - node = nodes[i]; - if (node.fx == null) node.x += node.vx *= velocityDecay; - else node.x = node.fx, node.vx = 0; - if (node.fy == null) node.y += node.vy *= velocityDecay; - else node.y = node.fy, node.vy = 0; - } - } - - return simulation; - } - - function initializeNodes() { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.index = i; - if (node.fx != null) node.x = node.fx; - if (node.fy != null) node.y = node.fy; - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - if (isNaN(node.vx) || isNaN(node.vy)) { - node.vx = node.vy = 0; - } - } - } - - function initializeForce(force) { - if (force.initialize) force.initialize(nodes); - return force; - } - - initializeNodes(); - - return simulation = { - tick: tick, - - restart: function() { - return stepper.restart(step), simulation; - }, - - stop: function() { - return stepper.stop(), simulation; - }, - - nodes: function(_) { - return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes; - }, - - alpha: function(_) { - return arguments.length ? (alpha = +_, simulation) : alpha; - }, - - alphaMin: function(_) { - return arguments.length ? (alphaMin = +_, simulation) : alphaMin; - }, - - alphaDecay: function(_) { - return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; - }, - - alphaTarget: function(_) { - return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; - }, - - velocityDecay: function(_) { - return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; - }, - - force: function(name, _) { - return arguments.length > 1 ? ((_ == null ? forces.delete(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name); - }, - - find: function(x, y, radius) { - var i = 0, - n = nodes.length, - dx, - dy, - d2, - node, - closest; - - if (radius == null) radius = Infinity; - else radius *= radius; - - for (i = 0; i < n; ++i) { - node = nodes[i]; - dx = x - node.x; - dy = y - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) closest = node, radius = d2; - } - - return closest; - }, - - on: function(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); - } - }; -} - -function manyBody() { - var nodes, - node, - alpha, - strength = constant(-30), - strengths, - distanceMin2 = 1, - distanceMax2 = Infinity, - theta2 = 0.81; - - function force(_) { - var i, n = nodes.length, tree = d3Quadtree.quadtree(nodes, x$1, y$1).visitAfter(accumulate); - for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply); - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - strengths = new Array(n); - for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes); - } - - function accumulate(quad) { - var strength = 0, q, c, weight = 0, x, y, i; - - // For internal nodes, accumulate forces from child quadrants. - if (quad.length) { - for (x = y = i = 0; i < 4; ++i) { - if ((q = quad[i]) && (c = Math.abs(q.value))) { - strength += q.value, weight += c, x += c * q.x, y += c * q.y; - } - } - quad.x = x / weight; - quad.y = y / weight; - } - - // For leaf nodes, accumulate forces from coincident quadrants. - else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - do strength += strengths[q.data.index]; - while (q = q.next); - } - - quad.value = strength; - } - - function apply(quad, x1, _, x2) { - if (!quad.value) return true; - - var x = quad.x - node.x, - y = quad.y - node.y, - w = x2 - x1, - l = 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 === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - node.vx += x * quad.value * alpha / l; - node.vy += y * quad.value * alpha / l; - } - return true; - } - - // Otherwise, process points directly. - else if (quad.length || l >= distanceMax2) return; - - // Limit forces for very close nodes; randomize direction if coincident. - if (quad.data !== node || quad.next) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - } - - do if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x * w; - node.vy += y * w; - } while (quad = quad.next); - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.distanceMin = function(_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - - force.distanceMax = function(_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - - force.theta = function(_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); - }; - - return force; -} - -function radial(radius, x, y) { - var nodes, - strength = constant(0.1), - strengths, - radiuses; - - if (typeof radius !== "function") radius = constant(+radius); - if (x == null) x = 0; - if (y == null) y = 0; - - function force(alpha) { - for (var i = 0, n = nodes.length; i < n; ++i) { - var node = nodes[i], - dx = node.x - x || 1e-6, - dy = node.y - y || 1e-6, - r = Math.sqrt(dx * dx + dy * dy), - k = (radiuses[i] - r) * strengths[i] * alpha / r; - node.vx += dx * k; - node.vy += dy * k; - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - radiuses = new Array(n); - for (i = 0; i < n; ++i) { - radiuses[i] = +radius(nodes[i], i, nodes); - strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function(_) { - nodes = _, initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius; - }; - - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; - }; - - return force; -} - -function x$2(x) { - var strength = constant(0.1), - nodes, - strengths, - xz; - - if (typeof x !== "function") x = constant(x == null ? 0 : +x); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), initialize(), force) : x; - }; - - return force; -} - -function y$2(y) { - var strength = constant(0.1), - nodes, - strengths, - yz; - - if (typeof y !== "function") y = constant(y == null ? 0 : +y); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), initialize(), force) : y; - }; - - return force; -} - -exports.forceCenter = center; -exports.forceCollide = collide; -exports.forceLink = link; -exports.forceManyBody = manyBody; -exports.forceRadial = radial; -exports.forceSimulation = simulation; -exports.forceX = x$2; -exports.forceY = y$2; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/d3-force/dist/d3-force.min.js b/node_modules/d3-force/dist/d3-force.min.js deleted file mode 100644 index 8fdda64..0000000 --- a/node_modules/d3-force/dist/d3-force.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-force/ v2.0.1 Copyright 2019 Mike Bostock -!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-quadtree"),require("d3-dispatch"),require("d3-timer")):"function"==typeof define&&define.amd?define(["exports","d3-quadtree","d3-dispatch","d3-timer"],t):t(n.d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(n,t,r,e){"use strict";function i(n){return function(){return n}}function u(){return 1e-6*(Math.random()-.5)}function o(n){return n.x+n.vx}function f(n){return n.y+n.vy}function a(n){return n.index}function c(n,t){var r=n.get(t);if(!r)throw new Error("missing: "+t);return r}function l(n){return n.x}function h(n){return n.y}var v=10,y=Math.PI*(3-Math.sqrt(5));n.forceCenter=function(n,t){var r;function e(){var e,i,u=r.length,o=0,f=0;for(e=0;ev+c||ey+c||il.index){var h=v-o.x-o.vx,g=y-o.y-o.vy,s=h*h+g*g;sn.r&&(n.r=n[t].r)}function v(){if(r){var t,i,u=r.length;for(e=new Array(u),t=0;t[l(n,t,e),n]));for(i=0,o=new Array(a);i=c)){(n.data!==r||n.next)&&(0===l&&(d+=(l=u())*l),0===h&&(d+=(h=u())*h),d1?(null==r?c.delete(n):c.set(n,s(r)),t):c.get(n)},find:function(t,r,e){var i,u,o,f,a,c=0,l=n.length;for(null==e?e=1/0:e*=e,c=0;c1?(h.on(n,r),t):h.on(n)}}},n.forceX=function(n){var t,r,e,u=i(.1);function o(n){for(var i,u=0,o=t.length;u node.index) { - var x = xi - data.x - data.vx, - y = yi - data.y - data.vy, - l = x * x + y * y; - if (l < r * r) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y *= l) * r; - data.vx -= x * (r = 1 - r); - data.vy -= 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 = radii[quad.data.index]; - for (var i = quad.r = 0; i < 4; ++i) { - if (quad[i] && quad[i].r > quad.r) { - quad.r = quad[i].r; - } - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - radii = new Array(n); - for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes); - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius; - }; - - return force; -} diff --git a/node_modules/d3-force/src/constant.js b/node_modules/d3-force/src/constant.js deleted file mode 100644 index b7d42e7..0000000 --- a/node_modules/d3-force/src/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(x) { - return function() { - return x; - }; -} diff --git a/node_modules/d3-force/src/index.js b/node_modules/d3-force/src/index.js deleted file mode 100644 index b08bf48..0000000 --- a/node_modules/d3-force/src/index.js +++ /dev/null @@ -1,8 +0,0 @@ -export {default as forceCenter} from "./center"; -export {default as forceCollide} from "./collide"; -export {default as forceLink} from "./link"; -export {default as forceManyBody} from "./manyBody"; -export {default as forceRadial} from "./radial"; -export {default as forceSimulation} from "./simulation"; -export {default as forceX} from "./x"; -export {default as forceY} from "./y"; diff --git a/node_modules/d3-force/src/jiggle.js b/node_modules/d3-force/src/jiggle.js deleted file mode 100644 index de46cff..0000000 --- a/node_modules/d3-force/src/jiggle.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function() { - return (Math.random() - 0.5) * 1e-6; -} diff --git a/node_modules/d3-force/src/link.js b/node_modules/d3-force/src/link.js deleted file mode 100644 index 6a5d616..0000000 --- a/node_modules/d3-force/src/link.js +++ /dev/null @@ -1,115 +0,0 @@ -import constant from "./constant.js"; -import jiggle from "./jiggle.js"; - -function index(d) { - return d.index; -} - -function find(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) throw new Error("missing: " + nodeId); - return node; -} - -export default function(links) { - var id = index, - strength = defaultStrength, - strengths, - distance = constant(30), - distances, - nodes, - count, - bias, - iterations = 1; - - if (links == null) links = []; - - function defaultStrength(link) { - return 1 / Math.min(count[link.source.index], count[link.target.index]); - } - - function force(alpha) { - for (var k = 0, n = links.length; k < iterations; ++k) { - for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) { - link = links[i], source = link.source, target = link.target; - x = target.x + target.vx - source.x - source.vx || jiggle(); - y = target.y + target.vy - source.y - source.vy || jiggle(); - l = Math.sqrt(x * x + y * y); - l = (l - distances[i]) / l * alpha * strengths[i]; - x *= l, y *= l; - target.vx -= x * (b = bias[i]); - target.vy -= y * b; - source.vx += x * (b = 1 - b); - source.vy += y * b; - } - } - } - - function initialize() { - if (!nodes) return; - - var i, - n = nodes.length, - m = links.length, - nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d])), - link; - - for (i = 0, count = new Array(n); i < m; ++i) { - link = links[i], link.index = i; - if (typeof link.source !== "object") link.source = find(nodeById, link.source); - if (typeof link.target !== "object") link.target = find(nodeById, link.target); - count[link.source.index] = (count[link.source.index] || 0) + 1; - count[link.target.index] = (count[link.target.index] || 0) + 1; - } - - for (i = 0, bias = new Array(m); i < m; ++i) { - link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); - } - - strengths = new Array(m), initializeStrength(); - distances = new Array(m), initializeDistance(); - } - - function initializeStrength() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - strengths[i] = +strength(links[i], i, links); - } - } - - function initializeDistance() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - distances[i] = +distance(links[i], i, links); - } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - - force.id = function(_) { - return arguments.length ? (id = _, force) : id; - }; - - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initializeStrength(), force) : strength; - }; - - force.distance = function(_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : constant(+_), initializeDistance(), force) : distance; - }; - - return force; -} diff --git a/node_modules/d3-force/src/manyBody.js b/node_modules/d3-force/src/manyBody.js deleted file mode 100644 index 045a401..0000000 --- a/node_modules/d3-force/src/manyBody.js +++ /dev/null @@ -1,114 +0,0 @@ -import {quadtree} from "d3-quadtree"; -import constant from "./constant.js"; -import jiggle from "./jiggle.js"; -import {x, y} from "./simulation.js"; - -export default function() { - var nodes, - node, - alpha, - strength = constant(-30), - strengths, - distanceMin2 = 1, - distanceMax2 = Infinity, - theta2 = 0.81; - - function force(_) { - var i, n = nodes.length, tree = quadtree(nodes, x, y).visitAfter(accumulate); - for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply); - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - strengths = new Array(n); - for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes); - } - - function accumulate(quad) { - var strength = 0, q, c, weight = 0, x, y, i; - - // For internal nodes, accumulate forces from child quadrants. - if (quad.length) { - for (x = y = i = 0; i < 4; ++i) { - if ((q = quad[i]) && (c = Math.abs(q.value))) { - strength += q.value, weight += c, x += c * q.x, y += c * q.y; - } - } - quad.x = x / weight; - quad.y = y / weight; - } - - // For leaf nodes, accumulate forces from coincident quadrants. - else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - do strength += strengths[q.data.index]; - while (q = q.next); - } - - quad.value = strength; - } - - function apply(quad, x1, _, x2) { - if (!quad.value) return true; - - var x = quad.x - node.x, - y = quad.y - node.y, - w = x2 - x1, - l = 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 === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - node.vx += x * quad.value * alpha / l; - node.vy += y * quad.value * alpha / l; - } - return true; - } - - // Otherwise, process points directly. - else if (quad.length || l >= distanceMax2) return; - - // Limit forces for very close nodes; randomize direction if coincident. - if (quad.data !== node || quad.next) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - } - - do if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x * w; - node.vy += y * w; - } while (quad = quad.next); - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.distanceMin = function(_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - - force.distanceMax = function(_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - - force.theta = function(_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); - }; - - return force; -} diff --git a/node_modules/d3-force/src/radial.js b/node_modules/d3-force/src/radial.js deleted file mode 100644 index 609516b..0000000 --- a/node_modules/d3-force/src/radial.js +++ /dev/null @@ -1,57 +0,0 @@ -import constant from "./constant.js"; - -export default function(radius, x, y) { - var nodes, - strength = constant(0.1), - strengths, - radiuses; - - if (typeof radius !== "function") radius = constant(+radius); - if (x == null) x = 0; - if (y == null) y = 0; - - function force(alpha) { - for (var i = 0, n = nodes.length; i < n; ++i) { - var node = nodes[i], - dx = node.x - x || 1e-6, - dy = node.y - y || 1e-6, - r = Math.sqrt(dx * dx + dy * dy), - k = (radiuses[i] - r) * strengths[i] * alpha / r; - node.vx += dx * k; - node.vy += dy * k; - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - radiuses = new Array(n); - for (i = 0; i < n; ++i) { - radiuses[i] = +radius(nodes[i], i, nodes); - strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function(_) { - nodes = _, initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius; - }; - - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; - }; - - return force; -} diff --git a/node_modules/d3-force/src/simulation.js b/node_modules/d3-force/src/simulation.js deleted file mode 100644 index d0a42f6..0000000 --- a/node_modules/d3-force/src/simulation.js +++ /dev/null @@ -1,150 +0,0 @@ -import {dispatch} from "d3-dispatch"; -import {timer} from "d3-timer"; - -export function x(d) { - return d.x; -} - -export function y(d) { - return d.y; -} - -var initialRadius = 10, - initialAngle = Math.PI * (3 - Math.sqrt(5)); - -export default function(nodes) { - var simulation, - alpha = 1, - alphaMin = 0.001, - alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), - alphaTarget = 0, - velocityDecay = 0.6, - forces = new Map(), - stepper = timer(step), - event = dispatch("tick", "end"); - - if (nodes == null) nodes = []; - - function step() { - tick(); - event.call("tick", simulation); - if (alpha < alphaMin) { - stepper.stop(); - event.call("end", simulation); - } - } - - function tick(iterations) { - var i, n = nodes.length, node; - - if (iterations === undefined) iterations = 1; - - for (var k = 0; k < iterations; ++k) { - alpha += (alphaTarget - alpha) * alphaDecay; - - forces.forEach(function(force) { - force(alpha); - }); - - for (i = 0; i < n; ++i) { - node = nodes[i]; - if (node.fx == null) node.x += node.vx *= velocityDecay; - else node.x = node.fx, node.vx = 0; - if (node.fy == null) node.y += node.vy *= velocityDecay; - else node.y = node.fy, node.vy = 0; - } - } - - return simulation; - } - - function initializeNodes() { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.index = i; - if (node.fx != null) node.x = node.fx; - if (node.fy != null) node.y = node.fy; - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - if (isNaN(node.vx) || isNaN(node.vy)) { - node.vx = node.vy = 0; - } - } - } - - function initializeForce(force) { - if (force.initialize) force.initialize(nodes); - return force; - } - - initializeNodes(); - - return simulation = { - tick: tick, - - restart: function() { - return stepper.restart(step), simulation; - }, - - stop: function() { - return stepper.stop(), simulation; - }, - - nodes: function(_) { - return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes; - }, - - alpha: function(_) { - return arguments.length ? (alpha = +_, simulation) : alpha; - }, - - alphaMin: function(_) { - return arguments.length ? (alphaMin = +_, simulation) : alphaMin; - }, - - alphaDecay: function(_) { - return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; - }, - - alphaTarget: function(_) { - return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; - }, - - velocityDecay: function(_) { - return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; - }, - - force: function(name, _) { - return arguments.length > 1 ? ((_ == null ? forces.delete(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name); - }, - - find: function(x, y, radius) { - var i = 0, - n = nodes.length, - dx, - dy, - d2, - node, - closest; - - if (radius == null) radius = Infinity; - else radius *= radius; - - for (i = 0; i < n; ++i) { - node = nodes[i]; - dx = x - node.x; - dy = y - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) closest = node, radius = d2; - } - - return closest; - }, - - on: function(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); - } - }; -} diff --git a/node_modules/d3-force/src/x.js b/node_modules/d3-force/src/x.js deleted file mode 100644 index 2e7a821..0000000 --- a/node_modules/d3-force/src/x.js +++ /dev/null @@ -1,41 +0,0 @@ -import constant from "./constant.js"; - -export default function(x) { - var strength = constant(0.1), - nodes, - strengths, - xz; - - if (typeof x !== "function") x = constant(x == null ? 0 : +x); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), initialize(), force) : x; - }; - - return force; -} diff --git a/node_modules/d3-force/src/y.js b/node_modules/d3-force/src/y.js deleted file mode 100644 index 5fcde67..0000000 --- a/node_modules/d3-force/src/y.js +++ /dev/null @@ -1,41 +0,0 @@ -import constant from "./constant.js"; - -export default function(y) { - var strength = constant(0.1), - nodes, - strengths, - yz; - - if (typeof y !== "function") y = constant(y == null ? 0 : +y); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), initialize(), force) : y; - }; - - return force; -} diff --git a/node_modules/d3-format/LICENSE b/node_modules/d3-format/LICENSE deleted file mode 100644 index 4f0b022..0000000 --- a/node_modules/d3-format/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2015 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-format/README.md b/node_modules/d3-format/README.md deleted file mode 100644 index 2259cde..0000000 --- a/node_modules/d3-format/README.md +++ /dev/null @@ -1,343 +0,0 @@ -# d3-format - -Ever noticed how sometimes JavaScript doesn’t display numbers the way you expect? Like, you tried to print tenths with a simple loop: - -```js -for (var i = 0; i < 10; i++) { - console.log(0.1 * i); -} -``` - -And you got this: - -```js -0 -0.1 -0.2 -0.30000000000000004 -0.4 -0.5 -0.6000000000000001 -0.7000000000000001 -0.8 -0.9 -``` - -Welcome to [binary floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)! ಠ_ಠ - -Yet rounding error is not the only reason to customize number formatting. A table of numbers should be formatted consistently for comparison; above, 0.0 would be better than 0. Large numbers should have grouped digits (e.g., 42,000) or be in scientific or metric notation (4.2e+4, 42k). Currencies should have fixed precision ($3.50). Reported numerical results should be rounded to significant digits (4021 becomes 4000). Number formats should appropriate to the reader’s locale (42.000,00 or 42,000.00). The list goes on. - -Formatting numbers for human consumption is the purpose of d3-format, which is modeled after Python 3’s [format specification mini-language](https://docs.python.org/3/library/string.html#format-specification-mini-language) ([PEP 3101](https://www.python.org/dev/peps/pep-3101/)). Revisiting the example above: - -```js -var f = d3.format(".1f"); -for (var i = 0; i < 10; i++) { - console.log(f(0.1 * i)); -} -``` - -Now you get this: - -```js -0.0 -0.1 -0.2 -0.3 -0.4 -0.5 -0.6 -0.7 -0.8 -0.9 -``` - -But d3-format is much more than an alias for [number.toFixed](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed)! A few more examples: - -```js -d3.format(".0%")(0.123); // rounded percentage, "12%" -d3.format("($.2f")(-3.5); // localized fixed-point currency, "(£3.50)" -d3.format("+20")(42); // space-filled and signed, " +42" -d3.format(".^20")(42); // dot-filled and centered, ".........42........." -d3.format(".2s")(42e6); // SI-prefix with two significant digits, "42M" -d3.format("#x")(48879); // prefixed lowercase hexadecimal, "0xbeef" -d3.format(",.2r")(4223); // grouped thousands with two significant digits, "4,200" -``` - -See [*locale*.format](#locale_format) for a detailed specification, and try running [d3.formatSpecifier](#formatSpecifier) on the above formats to decode their meaning. - -## Installing - -If you use NPM, `npm install d3-format`. Otherwise, download the [latest release](https://github.com/d3/d3-format/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-format.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -Locale files are published to npm and can be loaded using [d3.json](https://github.com/d3/d3-request/blob/master/README.md#json). For example, to set Russian as the default locale: - -```js -d3.json("https://cdn.jsdelivr.net/npm/d3-format@1/locale/ru-RU.json", function(error, locale) { - if (error) throw error; - - d3.formatDefaultLocale(locale); - - var format = d3.format("$,"); - - console.log(format(1234.56)); // 1 234,56 руб. -}); -``` - -[Try d3-format in your browser.](https://observablehq.com/@d3/d3-format) - -## API Reference - -# d3.format(specifier) [<>](https://github.com/d3/d3-format/blob/master/src/defaultLocale.js#L4 "Source") - -An alias for [*locale*.format](#locale_format) on the [default locale](#formatDefaultLocale). - -# d3.formatPrefix(specifier, value) [<>](https://github.com/d3/d3-format/blob/master/src/defaultLocale.js#L5 "Source") - -An alias for [*locale*.formatPrefix](#locale_formatPrefix) on the [default locale](#formatDefaultLocale). - -# locale.format(specifier) [<>](https://github.com/d3/d3-format/blob/master/src/locale.js#L18 "Source") - -Returns a new format function for the given string *specifier*. The returned function takes a number as the only argument, and returns a string representing the formatted number. The general form of a specifier is: - -``` -[​[fill]align][sign][symbol][0][width][,][.precision][~][type] -``` - -The *fill* can be any character. The presence of a fill character is signaled by the *align* character following it, which must be one of the following: - -* `>` - Forces the field to be right-aligned within the available space. (Default behavior). -* `<` - Forces the field to be left-aligned within the available space. -* `^` - Forces the field to be centered within the available space. -* `=` - like `>`, but with any sign and symbol to the left of any padding. - -The *sign* can be: - -* `-` - nothing for zero or positive and a minus sign for negative. (Default behavior.) -* `+` - a plus sign for zero or positive and a minus sign for negative. -* `(` - nothing for zero or positive and parentheses for negative. -* ` ` (space) - a space for zero or positive and a minus sign for negative. - -The *symbol* can be: - -* `$` - apply currency symbols per the locale definition. -* `#` - for binary, octal, or hexadecimal notation, prefix by `0b`, `0o`, or `0x`, respectively. - -The *zero* (`0`) option enables zero-padding; this implicitly sets *fill* to `0` and *align* to `=`. The *width* defines the minimum field width; if not specified, then the width will be determined by the content. The *comma* (`,`) option enables the use of a group separator, such as a comma for thousands. - -Depending on the *type*, the *precision* either indicates the number of digits that follow the decimal point (types `f` and `%`), or the number of significant digits (types `​`, `e`, `g`, `r`, `s` and `p`). If the precision is not specified, it defaults to 6 for all types except `​` (none), which defaults to 12. Precision is ignored for integer formats (types `b`, `o`, `d`, `x`, `X` and `c`). See [precisionFixed](#precisionFixed) and [precisionRound](#precisionRound) for help picking an appropriate precision. - -The `~` option trims insignificant trailing zeros across all format types. This is most commonly used in conjunction with types `r`, `e`, `s` and `%`. For example: - -```js -d3.format("s")(1500); // "1.50000k" -d3.format("~s")(1500); // "1.5k" -``` - -The available *type* values are: - -* `e` - exponent notation. -* `f` - fixed point notation. -* `g` - either decimal or exponent notation, rounded to significant digits. -* `r` - decimal notation, rounded to significant digits. -* `s` - decimal notation with an [SI prefix](#locale_formatPrefix), rounded to significant digits. -* `%` - multiply by 100, and then decimal notation with a percent sign. -* `p` - multiply by 100, round to significant digits, and then decimal notation with a percent sign. -* `b` - binary notation, rounded to integer. -* `o` - octal notation, rounded to integer. -* `d` - decimal notation, rounded to integer. -* `x` - hexadecimal notation, using lower-case letters, rounded to integer. -* `X` - hexadecimal notation, using upper-case letters, rounded to integer. -* `c` - converts the integer to the corresponding unicode character before printing. - -The type `​` (none) is also supported as shorthand for `~g` (with a default precision of 12 instead of 6), and the type `n` is shorthand for `,g`. For the `g`, `n` and `​` (none) types, decimal notation is used if the resulting string would have *precision* or fewer digits; otherwise, exponent notation is used. For example: - -```js -d3.format(".2")(42); // "42" -d3.format(".2")(4.2); // "4.2" -d3.format(".1")(42); // "4e+1" -d3.format(".1")(4.2); // "4" -``` - -# locale.formatPrefix(specifier, value) [<>](https://github.com/d3/d3-format/blob/master/src/locale.js#L127 "Source") - -Equivalent to [*locale*.format](#locale_format), except the returned function will convert values to the units of the appropriate [SI prefix](https://en.wikipedia.org/wiki/Metric_prefix#List_of_SI_prefixes) for the specified numeric reference *value* before formatting in fixed point notation. The following prefixes are supported: - -* `y` - yocto, 10⁻²⁴ -* `z` - zepto, 10⁻²¹ -* `a` - atto, 10⁻¹⁸ -* `f` - femto, 10⁻¹⁵ -* `p` - pico, 10⁻¹² -* `n` - nano, 10⁻⁹ -* `µ` - micro, 10⁻⁶ -* `m` - milli, 10⁻³ -* `​` (none) - 10⁰ -* `k` - kilo, 10³ -* `M` - mega, 10⁶ -* `G` - giga, 10⁹ -* `T` - tera, 10¹² -* `P` - peta, 10¹⁵ -* `E` - exa, 10¹⁸ -* `Z` - zetta, 10²¹ -* `Y` - yotta, 10²⁴ - -Unlike [*locale*.format](#locale_format) with the `s` format type, this method returns a formatter with a consistent SI prefix, rather than computing the prefix dynamically for each number. In addition, the *precision* for the given *specifier* represents the number of digits past the decimal point (as with `f` fixed point notation), not the number of significant digits. For example: - -```js -var f = d3.formatPrefix(",.0", 1e-6); -f(0.00042); // "420µ" -f(0.0042); // "4,200µ" -``` - -This method is useful when formatting multiple numbers in the same units for easy comparison. See [precisionPrefix](#precisionPrefix) for help picking an appropriate precision, and [bl.ocks.org/9764126](http://bl.ocks.org/mbostock/9764126) for an example. - -# d3.formatSpecifier(specifier) [<>](https://github.com/d3/d3-format/blob/master/src/formatSpecifier.js "Source") - -Parses the specified *specifier*, returning an object with exposed fields that correspond to the [format specification mini-language](#locale_format) and a toString method that reconstructs the specifier. For example, `formatSpecifier("s")` returns: - -```js -FormatSpecifier { - "fill": " ", - "align": ">", - "sign": "-", - "symbol": "", - "zero": false, - "width": undefined, - "comma": false, - "precision": undefined, - "trim": false, - "type": "s" -} -``` - -This method is useful for understanding how format specifiers are parsed and for deriving new specifiers. For example, you might compute an appropriate precision based on the numbers you want to format using [precisionFixed](#precisionFixed) and then create a new format: - -```js -var s = d3.formatSpecifier("f"); -s.precision = d3.precisionFixed(0.01); -var f = d3.format(s); -f(42); // "42.00"; -``` - -# new d3.FormatSpecifier(specifier) [<>](https://github.com/d3/d3-format/blob/master/src/formatSpecifier.js "Source") - -Given the specified *specifier* object, returning an object with exposed fields that correspond to the [format specification mini-language](#locale_format) and a toString method that reconstructs the specifier. For example, `new FormatSpecifier({type: "s"})` returns: - -```js -FormatSpecifier { - "fill": " ", - "align": ">", - "sign": "-", - "symbol": "", - "zero": false, - "width": undefined, - "comma": false, - "precision": undefined, - "trim": false, - "type": "s" -} -``` - -# d3.precisionFixed(step) [<>](https://github.com/d3/d3-format/blob/master/src/precisionFixed.js "Source") - -Returns a suggested decimal precision for fixed point notation given the specified numeric *step* value. The *step* represents the minimum absolute difference between values that will be formatted. (This assumes that the values to be formatted are also multiples of *step*.) For example, given the numbers 1, 1.5, and 2, the *step* should be 0.5 and the suggested precision is 1: - -```js -var p = d3.precisionFixed(0.5), - f = d3.format("." + p + "f"); -f(1); // "1.0" -f(1.5); // "1.5" -f(2); // "2.0" -``` - -Whereas for the numbers 1, 2 and 3, the *step* should be 1 and the suggested precision is 0: - -```js -var p = d3.precisionFixed(1), - f = d3.format("." + p + "f"); -f(1); // "1" -f(2); // "2" -f(3); // "3" -``` - -Note: for the `%` format type, subtract two: - -```js -var p = Math.max(0, d3.precisionFixed(0.05) - 2), - f = d3.format("." + p + "%"); -f(0.45); // "45%" -f(0.50); // "50%" -f(0.55); // "55%" -``` - -# d3.precisionPrefix(step, value) [<>](https://github.com/d3/d3-format/blob/master/src/precisionPrefix.js "Source") - -Returns a suggested decimal precision for use with [*locale*.formatPrefix](#locale_formatPrefix) given the specified numeric *step* and reference *value*. The *step* represents the minimum absolute difference between values that will be formatted, and *value* determines which SI prefix will be used. (This assumes that the values to be formatted are also multiples of *step*.) For example, given the numbers 1.1e6, 1.2e6, and 1.3e6, the *step* should be 1e5, the *value* could be 1.3e6, and the suggested precision is 1: - -```js -var p = d3.precisionPrefix(1e5, 1.3e6), - f = d3.formatPrefix("." + p, 1.3e6); -f(1.1e6); // "1.1M" -f(1.2e6); // "1.2M" -f(1.3e6); // "1.3M" -``` - -# d3.precisionRound(step, max) [<>](https://github.com/d3/d3-format/blob/master/src/precisionRound.js "Source") - -Returns a suggested decimal precision for format types that round to significant digits given the specified numeric *step* and *max* values. The *step* represents the minimum absolute difference between values that will be formatted, and the *max* represents the largest absolute value that will be formatted. (This assumes that the values to be formatted are also multiples of *step*.) For example, given the numbers 0.99, 1.0, and 1.01, the *step* should be 0.01, the *max* should be 1.01, and the suggested precision is 3: - -```js -var p = d3.precisionRound(0.01, 1.01), - f = d3.format("." + p + "r"); -f(0.99); // "0.990" -f(1.0); // "1.00" -f(1.01); // "1.01" -``` - -Whereas for the numbers 0.9, 1.0, and 1.1, the *step* should be 0.1, the *max* should be 1.1, and the suggested precision is 2: - -```js -var p = d3.precisionRound(0.1, 1.1), - f = d3.format("." + p + "r"); -f(0.9); // "0.90" -f(1.0); // "1.0" -f(1.1); // "1.1" -``` - -Note: for the `e` format type, subtract one: - -```js -var p = Math.max(0, d3.precisionRound(0.01, 1.01) - 1), - f = d3.format("." + p + "e"); -f(0.01); // "1.00e-2" -f(1.01); // "1.01e+0" -``` - -### Locales - -# d3.formatLocale(definition) [<>](https://github.com/d3/d3-format/blob/master/src/locale.js "Source") - -Returns a *locale* object for the specified *definition* with [*locale*.format](#locale_format) and [*locale*.formatPrefix](#locale_formatPrefix) methods. The *definition* must include the following properties: - -* `decimal` - the decimal point (e.g., `"."`). -* `thousands` - the group separator (e.g., `","`). -* `grouping` - the array of group sizes (e.g., `[3]`), cycled as needed. -* `currency` - the currency prefix and suffix (e.g., `["$", ""]`). -* `numerals` - optional; an array of ten strings to replace the numerals 0-9. -* `percent` - optional; the percent sign (defaults to `"%"`). -* `minus` - optional; the minus sign (defaults to hyphen-minus, `"-"`). -* `nan` - optional; the not-a-number value (defaults `"NaN"`). - -Note that the *thousands* property is a misnomer, as the grouping definition allows groups other than thousands. - -# d3.formatDefaultLocale(definition) [<>](https://github.com/d3/d3-format/blob/master/src/defaultLocale.js "Source") - -Equivalent to [d3.formatLocale](#formatLocale), except it also redefines [d3.format](#format) and [d3.formatPrefix](#formatPrefix) to the new locale’s [*locale*.format](#locale_format) and [*locale*.formatPrefix](#locale_formatPrefix). If you do not set a default locale, it defaults to [U.S. English](https://github.com/d3/d3-format/blob/master/locale/en-US.json). diff --git a/node_modules/d3-format/dist/d3-format.js b/node_modules/d3-format/dist/d3-format.js deleted file mode 100644 index 4b8dc4b..0000000 --- a/node_modules/d3-format/dist/d3-format.js +++ /dev/null @@ -1,339 +0,0 @@ -// https://d3js.org/d3-format/ v1.4.4 Copyright 2020 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -// 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 undefined. -// For example, formatDecimal(1.23) returns ["123", 0]. -function formatDecimal(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = 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) : coefficient, - +x.slice(i + 1) - ]; -} - -function exponent(x) { - return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; -} - -function formatGroup(grouping, thousands) { - return function(value, width) { - var i = value.length, - t = [], - j = 0, - g = grouping[0], - length = 0; - - while (i > 0 && g > 0) { - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (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 = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; - -function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; - return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] - }); -} - -formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof - -function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; - this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; - this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; - this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; -} - -FormatSpecifier.prototype.toString = function() { - return this.fill - + this.align - + this.sign - + this.symbol - + (this.zero ? "0" : "") - + (this.width === undefined ? "" : Math.max(1, this.width | 0)) - + (this.comma ? "," : "") - + (this.precision === undefined ? "" : "." + 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 = s.length, i = 1, i0 = -1, i1; i < n; ++i) { - switch (s[i]) { - case ".": i0 = i1 = i; break; - case "0": if (i0 === 0) i0 = i; i1 = i; break; - default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break; - } - } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; -} - -var prefixExponent; - -function formatPrefixAuto(x, p) { - var d = formatDecimal(x, p); - if (!d) return x + ""; - var coefficient = d[0], - exponent = d[1], - i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, - n = coefficient.length; - return i === 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 = formatDecimal(x, p); - if (!d) return x + ""; - var coefficient = d[0], - exponent = 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 = { - "%": 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(x) { - return x; -} - -var map = Array.prototype.map, - prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"]; - -function formatLocale(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), - currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", - currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", - decimal = locale.decimal === undefined ? "." : locale.decimal + "", - numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)), - percent = locale.percent === undefined ? "%" : locale.percent + "", - minus = locale.minus === undefined ? "-" : locale.minus + "", - nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - - function newFormat(specifier) { - specifier = formatSpecifier(specifier); - - var fill = specifier.fill, - align = specifier.align, - sign = specifier.sign, - symbol = specifier.symbol, - zero = specifier.zero, - width = specifier.width, - comma = specifier.comma, - precision = specifier.precision, - trim = specifier.trim, - type = specifier.type; - - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - - // The "" type, and any invalid type, is an alias for ".12~g". - else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - - // If zero fill is specified, padding goes after sign and before digits. - if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; - - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", - suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = formatTypes[type], - maybeSuffix = /[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 = precision === undefined ? 6 - : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) - : Math.max(0, Math.min(20, precision)); - - function format(value) { - var valuePrefix = prefix, - valueSuffix = suffix, - i, n, c; - - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - - // Trim insignificant zeros. - if (trim) value = formatTrim(value); - - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while (++i < n) { - if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - } - - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, - padding = length < width ? new Array(width - length + 1).join(fill) : ""; - - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - - // Reconstruct the final output based on the desired alignment. - switch (align) { - case "<": value = valuePrefix + value + valueSuffix + padding; break; - case "=": value = valuePrefix + padding + value + valueSuffix; break; - case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; - default: value = padding + valuePrefix + value + valueSuffix; break; - } - - return numerals(value); - } - - format.toString = function() { - return specifier + ""; - }; - - return format; - } - - function formatPrefix(specifier, value) { - var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), - e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, - k = Math.pow(10, -e), - prefix = 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: ["$", ""], - minus: "-" -}); - -function defaultLocale(definition) { - locale = formatLocale(definition); - exports.format = locale.format; - exports.formatPrefix = locale.formatPrefix; - return locale; -} - -function precisionFixed(step) { - return Math.max(0, -exponent(Math.abs(step))); -} - -function precisionPrefix(step, value) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); -} - -function precisionRound(step, max) { - step = Math.abs(step), max = Math.abs(max) - step; - return Math.max(0, exponent(max) - exponent(step)) + 1; -} - -exports.FormatSpecifier = FormatSpecifier; -exports.formatDefaultLocale = defaultLocale; -exports.formatLocale = formatLocale; -exports.formatSpecifier = formatSpecifier; -exports.precisionFixed = precisionFixed; -exports.precisionPrefix = precisionPrefix; -exports.precisionRound = precisionRound; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-format/dist/d3-format.min.js b/node_modules/d3-format/dist/d3-format.min.js deleted file mode 100644 index 8940de0..0000000 --- a/node_modules/d3-format/dist/d3-format.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-format/ v1.4.4 Copyright 2020 Mike Bostock -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";function n(t,n){if((i=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var i,r=t.slice(0,i);return[r.length>1?r[0]+r.slice(2):r,+t.slice(i+1)]}function i(t){return(t=n(Math.abs(t)))?t[1]:NaN}var r,e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function o(t){if(!(n=e.exec(t)))throw new Error("invalid format: "+t);var n;return new a({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function a(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function s(t,i){var r=n(t,i);if(!r)return t+"";var e=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+e:e.length>o+1?e.slice(0,o+1)+"."+e.slice(o+1):e+new Array(o-e.length+2).join("0")}o.prototype=a.prototype,a.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var u={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return s(100*t,n)},r:s,s:function(t,i){var e=n(t,i);if(!e)return t+"";var o=e[0],a=e[1],s=a-(r=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,u=o.length;return s===u?o:s>u?o+new Array(s-u+1).join("0"):s>0?o.slice(0,s)+"."+o.slice(s):"0."+new Array(1-s).join("0")+n(t,Math.max(0,i+s-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function c(t){return t}var f,h=Array.prototype.map,l=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function d(t){var n,e,a=void 0===t.grouping||void 0===t.thousands?c:(n=h.call(t.grouping,Number),e=t.thousands+"",function(t,i){for(var r=t.length,o=[],a=0,s=n[0],u=0;r>0&&s>0&&(u+s+1>i&&(s=Math.max(1,i-u)),o.push(t.substring(r-=s,r+s)),!((u+=s+1)>i));)s=n[a=(a+1)%n.length];return o.reverse().join(e)}),s=void 0===t.currency?"":t.currency[0]+"",f=void 0===t.currency?"":t.currency[1]+"",d=void 0===t.decimal?".":t.decimal+"",m=void 0===t.numerals?c:function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(h.call(t.numerals,String)),p=void 0===t.percent?"%":t.percent+"",g=void 0===t.minus?"-":t.minus+"",v=void 0===t.nan?"NaN":t.nan+"";function M(t){var n=(t=o(t)).fill,i=t.align,e=t.sign,c=t.symbol,h=t.zero,M=t.width,y=t.comma,x=t.precision,b=t.trim,w=t.type;"n"===w?(y=!0,w="g"):u[w]||(void 0===x&&(x=12),b=!0,w="g"),(h||"0"===n&&"="===i)&&(h=!0,n="0",i="=");var S="$"===c?s:"#"===c&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",j="$"===c?f:/[%p]/.test(w)?p:"",k=u[w],z=/[defgprs%]/.test(w);function A(t){var o,s,u,c=S,f=j;if("c"===w)f=k(t)+f,t="";else{var p=(t=+t)<0||1/t<0;if(t=isNaN(t)?v:k(Math.abs(t),x),b&&(t=function(t){t:for(var n,i=t.length,r=1,e=-1;r0&&(e=0)}return e>0?t.slice(0,e)+t.slice(n+1):t}(t)),p&&0==+t&&"+"!==e&&(p=!1),c=(p?"("===e?e:g:"-"===e||"("===e?"":e)+c,f=("s"===w?l[8+r/3]:"")+f+(p&&"("===e?")":""),z)for(o=-1,s=t.length;++o(u=t.charCodeAt(o))||u>57){f=(46===u?d+t.slice(o+1):t.slice(o))+f,t=t.slice(0,o);break}}y&&!h&&(t=a(t,1/0));var A=c.length+t.length+f.length,N=A>1)+c+t+f+N.slice(A);break;default:t=N+c+t+f}return m(t)}return x=void 0===x?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x)),A.toString=function(){return t+""},A}return{format:M,formatPrefix:function(t,n){var r=M(((t=o(t)).type="f",t)),e=3*Math.max(-8,Math.min(8,Math.floor(i(n)/3))),a=Math.pow(10,-e),s=l[8+e/3];return function(t){return r(a*t)+s}}}}function m(n){return f=d(n),t.format=f.format,t.formatPrefix=f.formatPrefix,f}m({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),t.FormatSpecifier=a,t.formatDefaultLocale=m,t.formatLocale=d,t.formatSpecifier=o,t.precisionFixed=function(t){return Math.max(0,-i(Math.abs(t)))},t.precisionPrefix=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(i(n)/3)))-i(Math.abs(t)))},t.precisionRound=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,i(n)-i(t))+1},Object.defineProperty(t,"__esModule",{value:!0})}); diff --git a/node_modules/d3-format/locale/ar-001.json b/node_modules/d3-format/locale/ar-001.json deleted file mode 100644 index 0376eb9..0000000 --- a/node_modules/d3-format/locale/ar-001.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", ""], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-AE.json b/node_modules/d3-format/locale/ar-AE.json deleted file mode 100644 index a827308..0000000 --- a/node_modules/d3-format/locale/ar-AE.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u062f\u002e\u0625\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-BH.json b/node_modules/d3-format/locale/ar-BH.json deleted file mode 100644 index 5f4e5dd..0000000 --- a/node_modules/d3-format/locale/ar-BH.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u062f\u002e\u0628\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-DJ.json b/node_modules/d3-format/locale/ar-DJ.json deleted file mode 100644 index b893ff0..0000000 --- a/node_modules/d3-format/locale/ar-DJ.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["\u200f\u0046\u0064\u006a ", ""], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-DZ.json b/node_modules/d3-format/locale/ar-DZ.json deleted file mode 100644 index e1438af..0000000 --- a/node_modules/d3-format/locale/ar-DZ.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": "\u002c", - "thousands": "\u002e", - "grouping": [3], - "currency": ["\u062f\u002e\u062c\u002e ", ""] -} diff --git a/node_modules/d3-format/locale/ar-EG.json b/node_modules/d3-format/locale/ar-EG.json deleted file mode 100644 index 2b1ff3a..0000000 --- a/node_modules/d3-format/locale/ar-EG.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u062c\u002e\u0645\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-EH.json b/node_modules/d3-format/locale/ar-EH.json deleted file mode 100644 index b33c32a..0000000 --- a/node_modules/d3-format/locale/ar-EH.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": "\u002e", - "thousands": "\u002c", - "grouping": [3], - "currency": ["\u062f\u002e\u0645\u002e ", ""] -} diff --git a/node_modules/d3-format/locale/ar-ER.json b/node_modules/d3-format/locale/ar-ER.json deleted file mode 100644 index b0f82bb..0000000 --- a/node_modules/d3-format/locale/ar-ER.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["\u004e\u0066\u006b ", ""], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-IL.json b/node_modules/d3-format/locale/ar-IL.json deleted file mode 100644 index ce15fb4..0000000 --- a/node_modules/d3-format/locale/ar-IL.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["\u20aa ", ""], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-IQ.json b/node_modules/d3-format/locale/ar-IQ.json deleted file mode 100644 index a6c9b3f..0000000 --- a/node_modules/d3-format/locale/ar-IQ.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u062f\u002e\u0639\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-JO.json b/node_modules/d3-format/locale/ar-JO.json deleted file mode 100644 index 94df180..0000000 --- a/node_modules/d3-format/locale/ar-JO.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u062f\u002e\u0623\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-KM.json b/node_modules/d3-format/locale/ar-KM.json deleted file mode 100644 index 84dd81a..0000000 --- a/node_modules/d3-format/locale/ar-KM.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u0641\u002e\u062c\u002e\u0642\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-KW.json b/node_modules/d3-format/locale/ar-KW.json deleted file mode 100644 index b4018ab..0000000 --- a/node_modules/d3-format/locale/ar-KW.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u062f\u002e\u0643\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-LB.json b/node_modules/d3-format/locale/ar-LB.json deleted file mode 100644 index c732df3..0000000 --- a/node_modules/d3-format/locale/ar-LB.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u0644\u002e\u0644\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-LY.json b/node_modules/d3-format/locale/ar-LY.json deleted file mode 100644 index 431f230..0000000 --- a/node_modules/d3-format/locale/ar-LY.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": "\u002c", - "thousands": "\u002e", - "grouping": [3], - "currency": ["\u062f\u002e\u0644\u002e ", ""] -} diff --git a/node_modules/d3-format/locale/ar-MA.json b/node_modules/d3-format/locale/ar-MA.json deleted file mode 100644 index abc0663..0000000 --- a/node_modules/d3-format/locale/ar-MA.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": "\u002c", - "thousands": "\u002e", - "grouping": [3], - "currency": ["\u062f\u002e\u0645\u002e ", ""] -} diff --git a/node_modules/d3-format/locale/ar-MR.json b/node_modules/d3-format/locale/ar-MR.json deleted file mode 100644 index 8d1f8c2..0000000 --- a/node_modules/d3-format/locale/ar-MR.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u0623\u002e\u0645\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-OM.json b/node_modules/d3-format/locale/ar-OM.json deleted file mode 100644 index 04ad53a..0000000 --- a/node_modules/d3-format/locale/ar-OM.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u0631\u002e\u0639\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-PS.json b/node_modules/d3-format/locale/ar-PS.json deleted file mode 100644 index ce15fb4..0000000 --- a/node_modules/d3-format/locale/ar-PS.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["\u20aa ", ""], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-QA.json b/node_modules/d3-format/locale/ar-QA.json deleted file mode 100644 index 94aef29..0000000 --- a/node_modules/d3-format/locale/ar-QA.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u0631\u002e\u0642\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-SA.json b/node_modules/d3-format/locale/ar-SA.json deleted file mode 100644 index 4d64227..0000000 --- a/node_modules/d3-format/locale/ar-SA.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u0631\u002e\u0633\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-SD.json b/node_modules/d3-format/locale/ar-SD.json deleted file mode 100644 index 1ae41ae..0000000 --- a/node_modules/d3-format/locale/ar-SD.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u062c\u002e\u0633\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-SO.json b/node_modules/d3-format/locale/ar-SO.json deleted file mode 100644 index 143b46f..0000000 --- a/node_modules/d3-format/locale/ar-SO.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["\u200f\u0053 ", ""], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-SS.json b/node_modules/d3-format/locale/ar-SS.json deleted file mode 100644 index 03ca5b4..0000000 --- a/node_modules/d3-format/locale/ar-SS.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["\u00a3 ", ""], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-SY.json b/node_modules/d3-format/locale/ar-SY.json deleted file mode 100644 index 40263fb..0000000 --- a/node_modules/d3-format/locale/ar-SY.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u0644\u002e\u0633\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-TD.json b/node_modules/d3-format/locale/ar-TD.json deleted file mode 100644 index 7bc3646..0000000 --- a/node_modules/d3-format/locale/ar-TD.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["\u200f\u0046\u0043\u0046\u0041 ", ""], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ar-TN.json b/node_modules/d3-format/locale/ar-TN.json deleted file mode 100644 index 16829aa..0000000 --- a/node_modules/d3-format/locale/ar-TN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": "\u002c", - "thousands": "\u002e", - "grouping": [3], - "currency": ["\u062f\u002e\u062a\u002e ", ""] -} diff --git a/node_modules/d3-format/locale/ar-YE.json b/node_modules/d3-format/locale/ar-YE.json deleted file mode 100644 index ed9f48e..0000000 --- a/node_modules/d3-format/locale/ar-YE.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": "\u066b", - "thousands": "\u066c", - "grouping": [3], - "currency": ["", " \u0631\u002e\u0649\u002e"], - "numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] -} diff --git a/node_modules/d3-format/locale/ca-ES.json b/node_modules/d3-format/locale/ca-ES.json deleted file mode 100644 index a249762..0000000 --- a/node_modules/d3-format/locale/ca-ES.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": ".", - "grouping": [3], - "currency": ["", "\u00a0€"] -} diff --git a/node_modules/d3-format/locale/cs-CZ.json b/node_modules/d3-format/locale/cs-CZ.json deleted file mode 100644 index 7ff40eb..0000000 --- a/node_modules/d3-format/locale/cs-CZ.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": "\u00a0", - "grouping": [3], - "currency": ["", "\u00a0Kč"] -} diff --git a/node_modules/d3-format/locale/de-CH.json b/node_modules/d3-format/locale/de-CH.json deleted file mode 100644 index 874bb56..0000000 --- a/node_modules/d3-format/locale/de-CH.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": "'", - "grouping": [3], - "currency": ["", "\u00a0CHF"] -} diff --git a/node_modules/d3-format/locale/de-DE.json b/node_modules/d3-format/locale/de-DE.json deleted file mode 100644 index a249762..0000000 --- a/node_modules/d3-format/locale/de-DE.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": ".", - "grouping": [3], - "currency": ["", "\u00a0€"] -} diff --git a/node_modules/d3-format/locale/en-CA.json b/node_modules/d3-format/locale/en-CA.json deleted file mode 100644 index f075b86..0000000 --- a/node_modules/d3-format/locale/en-CA.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3], - "currency": ["$", ""] -} diff --git a/node_modules/d3-format/locale/en-GB.json b/node_modules/d3-format/locale/en-GB.json deleted file mode 100644 index 3d22d7a..0000000 --- a/node_modules/d3-format/locale/en-GB.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3], - "currency": ["£", ""] -} diff --git a/node_modules/d3-format/locale/en-IE.json b/node_modules/d3-format/locale/en-IE.json deleted file mode 100644 index 7d64415..0000000 --- a/node_modules/d3-format/locale/en-IE.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3], - "currency": ["€", ""] -} diff --git a/node_modules/d3-format/locale/en-IN.json b/node_modules/d3-format/locale/en-IN.json deleted file mode 100644 index ada1510..0000000 --- a/node_modules/d3-format/locale/en-IN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3, 2, 2, 2, 2, 2, 2, 2, 2, 2], - "currency": ["₹", ""] -} diff --git a/node_modules/d3-format/locale/en-US.json b/node_modules/d3-format/locale/en-US.json deleted file mode 100644 index f075b86..0000000 --- a/node_modules/d3-format/locale/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3], - "currency": ["$", ""] -} diff --git a/node_modules/d3-format/locale/es-BO.json b/node_modules/d3-format/locale/es-BO.json deleted file mode 100644 index 98fe646..0000000 --- a/node_modules/d3-format/locale/es-BO.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": ",", - "thousands": ".", - "grouping": [3], - "currency": ["Bs\u00a0", ""], - "percent": "\u202f%" -} diff --git a/node_modules/d3-format/locale/es-ES.json b/node_modules/d3-format/locale/es-ES.json deleted file mode 100644 index a249762..0000000 --- a/node_modules/d3-format/locale/es-ES.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": ".", - "grouping": [3], - "currency": ["", "\u00a0€"] -} diff --git a/node_modules/d3-format/locale/es-MX.json b/node_modules/d3-format/locale/es-MX.json deleted file mode 100644 index f075b86..0000000 --- a/node_modules/d3-format/locale/es-MX.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3], - "currency": ["$", ""] -} diff --git a/node_modules/d3-format/locale/fi-FI.json b/node_modules/d3-format/locale/fi-FI.json deleted file mode 100644 index e2218ec..0000000 --- a/node_modules/d3-format/locale/fi-FI.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": "\u00a0", - "grouping": [3], - "currency": ["", "\u00a0€"] -} diff --git a/node_modules/d3-format/locale/fr-CA.json b/node_modules/d3-format/locale/fr-CA.json deleted file mode 100644 index 0d927b9..0000000 --- a/node_modules/d3-format/locale/fr-CA.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": "\u00a0", - "grouping": [3], - "currency": ["", "$"] -} diff --git a/node_modules/d3-format/locale/fr-FR.json b/node_modules/d3-format/locale/fr-FR.json deleted file mode 100644 index e0cf89d..0000000 --- a/node_modules/d3-format/locale/fr-FR.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "decimal": ",", - "thousands": "\u00a0", - "grouping": [3], - "currency": ["", "\u00a0€"], - "percent": "\u202f%" -} diff --git a/node_modules/d3-format/locale/he-IL.json b/node_modules/d3-format/locale/he-IL.json deleted file mode 100644 index 23926cb..0000000 --- a/node_modules/d3-format/locale/he-IL.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3], - "currency": ["₪", ""] -} diff --git a/node_modules/d3-format/locale/hu-HU.json b/node_modules/d3-format/locale/hu-HU.json deleted file mode 100644 index 1baff74..0000000 --- a/node_modules/d3-format/locale/hu-HU.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": "\u00a0", - "grouping": [3], - "currency": ["", "\u00a0Ft"] -} diff --git a/node_modules/d3-format/locale/it-IT.json b/node_modules/d3-format/locale/it-IT.json deleted file mode 100644 index 564ed46..0000000 --- a/node_modules/d3-format/locale/it-IT.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": ".", - "grouping": [3], - "currency": ["€", ""] -} diff --git a/node_modules/d3-format/locale/ja-JP.json b/node_modules/d3-format/locale/ja-JP.json deleted file mode 100644 index fdcba6c..0000000 --- a/node_modules/d3-format/locale/ja-JP.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3], - "currency": ["", "円"] -} diff --git a/node_modules/d3-format/locale/ko-KR.json b/node_modules/d3-format/locale/ko-KR.json deleted file mode 100644 index d1d882c..0000000 --- a/node_modules/d3-format/locale/ko-KR.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3], - "currency": ["₩", ""] -} diff --git a/node_modules/d3-format/locale/mk-MK.json b/node_modules/d3-format/locale/mk-MK.json deleted file mode 100644 index 33528b8..0000000 --- a/node_modules/d3-format/locale/mk-MK.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": ".", - "grouping": [3], - "currency": ["", "\u00a0ден."] -} diff --git a/node_modules/d3-format/locale/nl-NL.json b/node_modules/d3-format/locale/nl-NL.json deleted file mode 100644 index 7176b37..0000000 --- a/node_modules/d3-format/locale/nl-NL.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": ".", - "grouping": [3], - "currency": ["€\u00a0", ""] -} diff --git a/node_modules/d3-format/locale/pl-PL.json b/node_modules/d3-format/locale/pl-PL.json deleted file mode 100644 index 12c673f..0000000 --- a/node_modules/d3-format/locale/pl-PL.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": ".", - "grouping": [3], - "currency": ["", "zł"] -} diff --git a/node_modules/d3-format/locale/pt-BR.json b/node_modules/d3-format/locale/pt-BR.json deleted file mode 100644 index e6705f1..0000000 --- a/node_modules/d3-format/locale/pt-BR.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": ".", - "grouping": [3], - "currency": ["R$", ""] -} diff --git a/node_modules/d3-format/locale/ru-RU.json b/node_modules/d3-format/locale/ru-RU.json deleted file mode 100644 index 3b0acf6..0000000 --- a/node_modules/d3-format/locale/ru-RU.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": "\u00a0", - "grouping": [3], - "currency": ["", "\u00a0руб."] -} diff --git a/node_modules/d3-format/locale/sv-SE.json b/node_modules/d3-format/locale/sv-SE.json deleted file mode 100644 index 870eba3..0000000 --- a/node_modules/d3-format/locale/sv-SE.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": "\u00a0", - "grouping": [3], - "currency": ["", " kr"] -} diff --git a/node_modules/d3-format/locale/uk-UA.json b/node_modules/d3-format/locale/uk-UA.json deleted file mode 100644 index 75cee2d..0000000 --- a/node_modules/d3-format/locale/uk-UA.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ",", - "thousands": "\u00a0", - "grouping": [3], - "currency": ["", "\u00a0₴."] -} diff --git a/node_modules/d3-format/locale/zh-CN.json b/node_modules/d3-format/locale/zh-CN.json deleted file mode 100644 index 1ffc7b6..0000000 --- a/node_modules/d3-format/locale/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "decimal": ".", - "thousands": ",", - "grouping": [3], - "currency": ["¥", ""] -} diff --git a/node_modules/d3-format/package.json b/node_modules/d3-format/package.json deleted file mode 100644 index c287f8e..0000000 --- a/node_modules/d3-format/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "d3-format@^1.4.4", - "_id": "d3-format@1.4.4", - "_inBundle": false, - "_integrity": "sha512-TWks25e7t8/cqctxCmxpUuzZN11QxIA7YrMbram94zMQ0PXjE4LVIMe/f6a4+xxL8HQ3OsAFULOINQi1pE62Aw==", - "_location": "/d3-format", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "d3-format@^1.4.4", - "name": "d3-format", - "escapedName": "d3-format", - "rawSpec": "^1.4.4", - "saveSpec": null, - "fetchSpec": "^1.4.4" - }, - "_requiredBy": [ - "/d3-scale", - "/vega-format" - ], - "_resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.4.tgz", - "_shasum": "356925f28d0fd7c7983bfad593726fce46844030", - "_spec": "d3-format@^1.4.4", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-format", - "author": { - "name": "Mike Bostock", - "url": "http://bost.ocks.org/mike" - }, - "bugs": { - "url": "https://github.com/d3/d3-format/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Format numbers for human consumption.", - "devDependencies": { - "d3-queue": "3", - "eslint": "6", - "rollup": "1", - "rollup-plugin-terser": "5", - "tape": "4" - }, - "files": [ - "dist/**/*.js", - "src/**/*.js", - "locale/*.json" - ], - "homepage": "https://d3js.org/d3-format/", - "jsdelivr": "dist/d3-format.min.js", - "keywords": [ - "d3", - "d3-module", - "format", - "localization" - ], - "license": "BSD-3-Clause", - "main": "dist/d3-format.js", - "module": "src/index.js", - "name": "d3-format", - "repository": { - "type": "git", - "url": "git+https://github.com/d3/d3-format.git" - }, - "scripts": { - "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js", - "prepublishOnly": "rm -rf dist && yarn test", - "pretest": "rollup -c", - "test": "tape 'test/**/*-test.js' && eslint src test" - }, - "sideEffects": [ - "./src/defaultLocale.js" - ], - "unpkg": "dist/d3-format.min.js", - "version": "1.4.4" -} diff --git a/node_modules/d3-format/src/defaultLocale.js b/node_modules/d3-format/src/defaultLocale.js deleted file mode 100644 index 9ecf0fa..0000000 --- a/node_modules/d3-format/src/defaultLocale.js +++ /dev/null @@ -1,20 +0,0 @@ -import formatLocale from "./locale.js"; - -var locale; -export var format; -export var formatPrefix; - -defaultLocale({ - decimal: ".", - thousands: ",", - grouping: [3], - currency: ["$", ""], - minus: "-" -}); - -export default function defaultLocale(definition) { - locale = formatLocale(definition); - format = locale.format; - formatPrefix = locale.formatPrefix; - return locale; -} diff --git a/node_modules/d3-format/src/exponent.js b/node_modules/d3-format/src/exponent.js deleted file mode 100644 index b7b8eb1..0000000 --- a/node_modules/d3-format/src/exponent.js +++ /dev/null @@ -1,5 +0,0 @@ -import formatDecimal from "./formatDecimal.js"; - -export default function(x) { - return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; -} diff --git a/node_modules/d3-format/src/formatDecimal.js b/node_modules/d3-format/src/formatDecimal.js deleted file mode 100644 index c199ad8..0000000 --- a/node_modules/d3-format/src/formatDecimal.js +++ /dev/null @@ -1,14 +0,0 @@ -// 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 undefined. -// For example, formatDecimal(1.23) returns ["123", 0]. -export default function(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = 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) : coefficient, - +x.slice(i + 1) - ]; -} diff --git a/node_modules/d3-format/src/formatGroup.js b/node_modules/d3-format/src/formatGroup.js deleted file mode 100644 index ae603d3..0000000 --- a/node_modules/d3-format/src/formatGroup.js +++ /dev/null @@ -1,18 +0,0 @@ -export default function(grouping, thousands) { - return function(value, width) { - var i = value.length, - t = [], - j = 0, - g = grouping[0], - length = 0; - - while (i > 0 && g > 0) { - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (j + 1) % grouping.length]; - } - - return t.reverse().join(thousands); - }; -} diff --git a/node_modules/d3-format/src/formatNumerals.js b/node_modules/d3-format/src/formatNumerals.js deleted file mode 100644 index 046317e..0000000 --- a/node_modules/d3-format/src/formatNumerals.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function(numerals) { - return function(value) { - return value.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; -} diff --git a/node_modules/d3-format/src/formatPrefixAuto.js b/node_modules/d3-format/src/formatPrefixAuto.js deleted file mode 100644 index c7ef7be..0000000 --- a/node_modules/d3-format/src/formatPrefixAuto.js +++ /dev/null @@ -1,16 +0,0 @@ -import formatDecimal from "./formatDecimal.js"; - -export var prefixExponent; - -export default function(x, p) { - var d = formatDecimal(x, p); - if (!d) return x + ""; - var coefficient = d[0], - exponent = d[1], - i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, - n = coefficient.length; - return i === 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! -} diff --git a/node_modules/d3-format/src/formatRounded.js b/node_modules/d3-format/src/formatRounded.js deleted file mode 100644 index ac9ca12..0000000 --- a/node_modules/d3-format/src/formatRounded.js +++ /dev/null @@ -1,11 +0,0 @@ -import formatDecimal from "./formatDecimal.js"; - -export default function(x, p) { - var d = formatDecimal(x, p); - if (!d) return x + ""; - var coefficient = d[0], - exponent = 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"); -} diff --git a/node_modules/d3-format/src/formatSpecifier.js b/node_modules/d3-format/src/formatSpecifier.js deleted file mode 100644 index 2dabb2f..0000000 --- a/node_modules/d3-format/src/formatSpecifier.js +++ /dev/null @@ -1,47 +0,0 @@ -// [[fill]align][sign][symbol][0][width][,][.precision][~][type] -var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; - -export default function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; - return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] - }); -} - -formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof - -export function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; - this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; - this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; - this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; -} - -FormatSpecifier.prototype.toString = function() { - return this.fill - + this.align - + this.sign - + this.symbol - + (this.zero ? "0" : "") - + (this.width === undefined ? "" : Math.max(1, this.width | 0)) - + (this.comma ? "," : "") - + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) - + (this.trim ? "~" : "") - + this.type; -}; diff --git a/node_modules/d3-format/src/formatTrim.js b/node_modules/d3-format/src/formatTrim.js deleted file mode 100644 index b0d647b..0000000 --- a/node_modules/d3-format/src/formatTrim.js +++ /dev/null @@ -1,11 +0,0 @@ -// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. -export default function(s) { - out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { - switch (s[i]) { - case ".": i0 = i1 = i; break; - case "0": if (i0 === 0) i0 = i; i1 = i; break; - default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break; - } - } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; -} diff --git a/node_modules/d3-format/src/formatTypes.js b/node_modules/d3-format/src/formatTypes.js deleted file mode 100644 index cc7421d..0000000 --- a/node_modules/d3-format/src/formatTypes.js +++ /dev/null @@ -1,18 +0,0 @@ -import formatPrefixAuto from "./formatPrefixAuto.js"; -import formatRounded from "./formatRounded.js"; - -export default { - "%": 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); } -}; diff --git a/node_modules/d3-format/src/identity.js b/node_modules/d3-format/src/identity.js deleted file mode 100644 index b2f94b2..0000000 --- a/node_modules/d3-format/src/identity.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x) { - return x; -} diff --git a/node_modules/d3-format/src/index.js b/node_modules/d3-format/src/index.js deleted file mode 100644 index 22ae6b2..0000000 --- a/node_modules/d3-format/src/index.js +++ /dev/null @@ -1,6 +0,0 @@ -export {default as formatDefaultLocale, format, formatPrefix} from "./defaultLocale.js"; -export {default as formatLocale} from "./locale.js"; -export {default as formatSpecifier, FormatSpecifier} from "./formatSpecifier.js"; -export {default as precisionFixed} from "./precisionFixed.js"; -export {default as precisionPrefix} from "./precisionPrefix.js"; -export {default as precisionRound} from "./precisionRound.js"; diff --git a/node_modules/d3-format/src/locale.js b/node_modules/d3-format/src/locale.js deleted file mode 100644 index a8ea919..0000000 --- a/node_modules/d3-format/src/locale.js +++ /dev/null @@ -1,148 +0,0 @@ -import exponent from "./exponent.js"; -import formatGroup from "./formatGroup.js"; -import formatNumerals from "./formatNumerals.js"; -import formatSpecifier from "./formatSpecifier.js"; -import formatTrim from "./formatTrim.js"; -import formatTypes from "./formatTypes.js"; -import {prefixExponent} from "./formatPrefixAuto.js"; -import identity from "./identity.js"; - -var map = Array.prototype.map, - prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"]; - -export default function(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), - currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", - currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", - decimal = locale.decimal === undefined ? "." : locale.decimal + "", - numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)), - percent = locale.percent === undefined ? "%" : locale.percent + "", - minus = locale.minus === undefined ? "-" : locale.minus + "", - nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - - function newFormat(specifier) { - specifier = formatSpecifier(specifier); - - var fill = specifier.fill, - align = specifier.align, - sign = specifier.sign, - symbol = specifier.symbol, - zero = specifier.zero, - width = specifier.width, - comma = specifier.comma, - precision = specifier.precision, - trim = specifier.trim, - type = specifier.type; - - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - - // The "" type, and any invalid type, is an alias for ".12~g". - else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - - // If zero fill is specified, padding goes after sign and before digits. - if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; - - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", - suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = formatTypes[type], - maybeSuffix = /[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 = precision === undefined ? 6 - : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) - : Math.max(0, Math.min(20, precision)); - - function format(value) { - var valuePrefix = prefix, - valueSuffix = suffix, - i, n, c; - - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - - // Trim insignificant zeros. - if (trim) value = formatTrim(value); - - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while (++i < n) { - if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - } - - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, - padding = length < width ? new Array(width - length + 1).join(fill) : ""; - - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - - // Reconstruct the final output based on the desired alignment. - switch (align) { - case "<": value = valuePrefix + value + valueSuffix + padding; break; - case "=": value = valuePrefix + padding + value + valueSuffix; break; - case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; - default: value = padding + valuePrefix + value + valueSuffix; break; - } - - return numerals(value); - } - - format.toString = function() { - return specifier + ""; - }; - - return format; - } - - function formatPrefix(specifier, value) { - var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), - e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, - k = Math.pow(10, -e), - prefix = prefixes[8 + e / 3]; - return function(value) { - return f(k * value) + prefix; - }; - } - - return { - format: newFormat, - formatPrefix: formatPrefix - }; -} diff --git a/node_modules/d3-format/src/precisionFixed.js b/node_modules/d3-format/src/precisionFixed.js deleted file mode 100644 index 237f53f..0000000 --- a/node_modules/d3-format/src/precisionFixed.js +++ /dev/null @@ -1,5 +0,0 @@ -import exponent from "./exponent.js"; - -export default function(step) { - return Math.max(0, -exponent(Math.abs(step))); -} diff --git a/node_modules/d3-format/src/precisionPrefix.js b/node_modules/d3-format/src/precisionPrefix.js deleted file mode 100644 index fd6af84..0000000 --- a/node_modules/d3-format/src/precisionPrefix.js +++ /dev/null @@ -1,5 +0,0 @@ -import exponent from "./exponent.js"; - -export default function(step, value) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); -} diff --git a/node_modules/d3-format/src/precisionRound.js b/node_modules/d3-format/src/precisionRound.js deleted file mode 100644 index 5c70437..0000000 --- a/node_modules/d3-format/src/precisionRound.js +++ /dev/null @@ -1,6 +0,0 @@ -import exponent from "./exponent.js"; - -export default function(step, max) { - step = Math.abs(step), max = Math.abs(max) - step; - return Math.max(0, exponent(max) - exponent(step)) + 1; -} diff --git a/node_modules/d3-geo-projection/LICENSE b/node_modules/d3-geo-projection/LICENSE deleted file mode 100644 index d2a5d0f..0000000 --- a/node_modules/d3-geo-projection/LICENSE +++ /dev/null @@ -1,54 +0,0 @@ -Copyright 2013-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. - - - - -MIT License for https://github.com/scijs/integrate-adaptive-simpson - -The MIT License (MIT) - -Copyright (c) 2015 Ricky Reusser - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/d3-geo-projection/README.md b/node_modules/d3-geo-projection/README.md deleted file mode 100644 index dd3a509..0000000 --- a/node_modules/d3-geo-projection/README.md +++ /dev/null @@ -1,1169 +0,0 @@ -# d3-geo-projection - -Extended geographic projections for [d3-geo](https://github.com/d3/d3-geo). See [Command-Line Cartography](https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c) for an introduction. - -## Installing - -If you use NPM, `npm install d3-geo-projection`. Otherwise, download the [latest release](https://github.com/d3/d3-geo-projection/releases/latest). You can also load directly from [d3js.org](https://d3js.org) as a [standalone library](https://d3js.org/d3-geo-projection.v2.min.js). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - - - -``` - -## API Reference - -* [Projections](#projections) -* [Interrupted Projections](#interrupted-projections) -* [Polyhedral Projections](#polyhedral-projections) -* [Quincuncial Projections](#quincuncial-projections) -* [Transformations](#transformations) - -### Projections - -Note: projections tagged \[d3-geo\] are exported by [d3-geo](https://github.com/d3/d3-geo), not d3-geo-projection. These commonly-used projections are also included in the [d3](https://github.com/d3/d3) default bundle. - -# d3.geoAiry() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/airy.js), [Examples](https://observablehq.com/@d3/airys-minimum-error) -
# d3.geoAiryRaw(beta) - -[](https://observablehq.com/@d3/airys-minimum-error) - -Airy’s minimum-error azimuthal projection. - -# airy.radius([radius]) - -Defaults to 90°. - -# d3.geoAitoff() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/aitoff.js), [Examples](https://observablehq.com/@d3/aitoff) -
# d3.geoAitoffRaw - -[](https://observablehq.com/@d3/aitoff) - -The Aitoff projection. - -# d3.geoAlbers() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/albers.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoAlbers) - -[](https://observablehq.com/@d3/conic-equal-area) - -Albers’ [equal-area conic projection](#geoConicEqualArea). - -# d3.geoArmadillo() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/armadillo.js), [Examples](https://observablehq.com/@d3/armadillo) -
# d3.geoArmadilloRaw(phi0) - -[](https://observablehq.com/@d3/armadillo) - -The armadillo projection. The default center assumes the default [parallel](#armadillo_parallel) of 20° and should be changed if a different parallel is used. Note: requires clipping to the sphere. - -# armadillo.parallel([parallel]) - -Defaults to 20°. - -# d3.geoAugust() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/august.js), [Examples](https://observablehq.com/@d3/august) -
# d3.geoAugustRaw - -[](https://observablehq.com/@d3/august) - -August’s epicycloidal conformal projection. - -# d3.geoAzimuthalEqualArea() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/azimuthalEqualArea.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoAzimuthalEqualArea), [Examples](https://observablehq.com/@d3/azimuthal-equal-area) -
# d3.geoAzimuthalEqualAreaRaw - -[](https://observablehq.com/@d3/azimuthal-equal-area) - -The Lambert azimuthal equal-area projection. - -# d3.geoAzimuthalEquidistant() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/azimuthalEquidistant.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoAzimuthalEquidistant), [Examples](https://observablehq.com/@d3/azimuthal-equidistant) -
# d3.geoAzimuthalEquidistantRaw - -[](https://observablehq.com/@d3/azimuthal-equidistant) - -The azimuthal equidistant projection. - -# d3.geoBaker() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/baker.js), [Examples](https://observablehq.com/@d3/baker-dinomic) -
# d3.geoBakerRaw - -[](https://observablehq.com/@d3/baker-dinomic) - -The Baker Dinomic projection. - -# d3.geoBerghaus() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/berghaus.js), [Examples](https://observablehq.com/@d3/berghaus-star) -
# d3.geoBerghausRaw(lobes) - -[](https://observablehq.com/@d3/berghaus-star) - -Berghaus’ star projection. The default center assumes the default [lobe number](#berghaus_lobes) of 5 and should be changed if a different number of lobes is used. Note: requires clipping to the sphere. - -# berghaus.lobes([lobes]) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/berghaus.js) - -If *lobes* is specified, sets the number of lobes in the resulting star, and returns this projection. If *lobes* is not specified, returns the current lobe number, which defaults to 5. - -# d3.geoBertin1953() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/bertin.js) -
# d3.geoBertin1953Raw - -[](https://visionscarto.net/bertin-projection-1953) - -Jacques Bertin’s 1953 projection. - -# d3.geoBoggs() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/boggs.js), [Examples](https://observablehq.com/@d3/boggs-eumorphic) -
# d3.geoBoggsRaw - -[](https://observablehq.com/@d3/boggs-eumorphic) - -The Boggs eumorphic projection. More commonly used in [interrupted form](#geoInterruptedBoggs). - -# d3.geoBonne() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/bonne.js), [Examples](https://observablehq.com/@d3/bonne) -
# d3.geoBonneRaw(phi0) - -[](https://observablehq.com/@d3/bonne) - -The Bonne pseudoconical equal-area projection. The [Werner projection](https://observablehq.com/@d3/werner) is a limiting form of the Bonne projection with a standard parallel at ±90°. The default center assumes the default [parallel](#bonne_parallel) of 45° and should be changed if a different parallel is used. - -# bonne.parallel([parallel]) - -Defaults to 45°. - -# d3.geoBottomley() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/bottomley.js), [Examples](https://observablehq.com/@d3/bottomley) -
# d3.geoBottomleyRaw(sinPsi) - -[](https://observablehq.com/@d3/bottomley) - -The [Bottomley projection](https://cybergeo.revues.org/3977) “draws lines of latitude as concentric circular arcs, with arc lengths equal to their lengths on the globe, and placed symmetrically and equally spaced across the vertical central meridian.” - -# bottomley.fraction([fraction]) - -Defaults to 0.5, corresponding to a sin(ψ) where ψ = π/6. - -# d3.geoBromley() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/bromley.js), [Examples](https://observablehq.com/@d3/bromley) -
# d3.geoBromleyRaw - -[](https://observablehq.com/@d3/bromley) - -The Bromley projection is a rescaled [Mollweide projection](#geoMollweide). - -# d3.geoChamberlin(point0, point1, point2) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/chamberlin.js) -
# d3.geoChamberlinRaw(p0, p1, p2) - -The Chamberlin trimetric projection. This method does not support [*projection*.rotate](https://github.com/d3/d3-geo/blob/master/README.md#projection_rotate): the three reference points implicitly determine a fixed rotation. - -# d3.geoChamberlinAfrica() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/chamberlin.js) - -[](https://bl.ocks.org/mbostock/5625053) - -The Chamberlin projection for Africa using points [0°, 22°], [45°, 22°], [22.5°, -22°]. - -# d3.geoCollignon() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/collignon.js), [Examples](https://observablehq.com/@d3/collignon) -
# d3.geoCollignonRaw - -[](https://observablehq.com/@d3/collignon) - -The Collignon equal-area pseudocylindrical projection. This projection is used in the polar areas of the [HEALPix projection](#geoHealpix). - -# d3.geoConicConformal() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/conicConformal.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoConicConformal), [Examples](https://observablehq.com/@d3/conic-conformal) -
# d3.geoConicConformalRaw - -[](https://observablehq.com/@d3/conic-conformal) - -The Lambert conformal conic projection. - -# d3.geoConicEqualArea() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/conicEqualArea.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoConicEqualArea), [Examples](https://observablehq.com/@d3/conic-equal-area) -
# d3.geoConicEqualAreaRaw - -[](https://observablehq.com/@d3/conic-equal-area) - -Albers’ conic equal-area projection. - -# d3.geoConicEquidistant() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/conicEquidistant.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoConicEquidistant), [Examples](https://observablehq.com/@d3/conic-equidistant) -
# d3.geoConicEquidistantRaw - -[](https://observablehq.com/@d3/conic-equidistant) - -The conic equidistant projection. - -# d3.geoCraig() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/craig.js), [Examples](https://observablehq.com/@d3/craig) -
# d3.geoCraigRaw(phi) - -[](https://observablehq.com/@d3/craig) - -The Craig retroazimuthal projection. Note: this projection tends to [fold over itself](https://bl.ocks.org/mbostock/4459716) if the [standard parallel](#craig_parallel) is non-zero; we have not yet implemented the necessary advanced clipping to avoid overlap. - -# craig.parallel([parallel]) - -Defaults to 0°. - -# d3.geoCraster() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/craster.js), [Examples](https://observablehq.com/@d3/craster) -
# d3.geoCrasterRaw - -[](https://observablehq.com/@d3/craster) - -The Craster parabolic projection; also known as Putniņš P4. - -# d3.geoCylindricalEqualArea() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/cylindricalEqualArea.js), [Examples](https://observablehq.com/@mbostock/cylindrical-equal-area-projections) -
# d3.geoCylindricalEqualAreaRaw(phi0) - -[](https://observablehq.com/@mbostock/cylindrical-equal-area-projections) - -The cylindrical equal-area projection. Depending on the chosen [parallel](#cylindricalEqualArea_parallel), this projection is also known as the Lambert cylindrical equal-area (0°), Behrmann (30°), Hobo–Dyer (37.5°), Gall–Peters (45°), Balthasart (50°) and Tobler world-in-a-square (~55.654°). - -# cylindricalEqualArea.parallel([parallel]) - -Defaults to approximately 38.58°, fitting the world in a 960×500 rectangle. - -# d3.geoCylindricalStereographic() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/cylindricalStereographic.js), [Examples](https://observablehq.com/@d3/cylindrical-stereographic) -
# d3.geoCylindricalStereographicRaw(phi0) - -[](https://observablehq.com/@d3/cylindrical-stereographic) - -The cylindrical stereographic projection. Depending on the chosen [parallel](#cylindricalStereographic_parallel), this projection is also known as Braun’s stereographic (0°) and Gall’s stereographic (45°). - -# cylindricalStereographic.parallel([parallel]) - -Defaults to 0°. - -# d3.geoEckert1() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/eckert1.js), [Examples](https://observablehq.com/@d3/eckert-i) -
# d3.geoEckert1Raw - -[](https://observablehq.com/@d3/eckert-i) - -The Eckert I projection. - -# d3.geoEckert2() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/eckert2.js), [Examples](https://observablehq.com/@d3/eckert-ii) -
# d3.geoEckert2Raw - -[](https://observablehq.com/@d3/eckert-ii) - -The Eckert II projection. - -# d3.geoEckert3() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/eckert3.js), [Examples](https://observablehq.com/@d3/eckert-iii) -
# d3.geoEckert3Raw - -[](https://observablehq.com/@d3/eckert-iii) - -The Eckert III projection. - -# d3.geoEckert4() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/eckert4.js), [Examples](https://observablehq.com/@d3/eckert-iv) -
# d3.geoEckert4Raw - -[](https://observablehq.com/@d3/eckert-iv) - -The Eckert IV projection. - -# d3.geoEckert5() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/eckert5.js), [Examples](https://observablehq.com/@d3/eckert-v) -
# d3.geoEckert5Raw - -[](https://observablehq.com/@d3/eckert-v) - -The Eckert V projection. - -# d3.geoEckert6() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/eckert6.js), [Examples](https://observablehq.com/@d3/eckert-vi) -
# d3.geoEckert6Raw - -[](https://observablehq.com/@d3/eckert-vi) - -The Eckert VI projection. - -# d3.geoEisenlohr() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/eisenlohr.js), [Examples](https://observablehq.com/@d3/eisenlohr) -
# d3.geoEisenlohrRaw(lambda, phi) - -[](https://observablehq.com/@d3/eisenlohr) - -The Eisenlohr conformal projection. - -# d3.geoEquirectangular() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/equirectangular.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoEquirectangular), [Examples](https://observablehq.com/@d3/equirectangular) -
# d3.geoEquirectangularRaw - -[](https://observablehq.com/@d3/equirectangular) - -The equirectangular (plate carrée) projection. The [Cassini projection](https://observablehq.com/@d3/cassini) is the transverse aspect of the equirectangular projection. - -# d3.geoFahey() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/fahey.js), [Examples](https://observablehq.com/@d3/fahey) -
# d3.geoFaheyRaw - -[](https://observablehq.com/@d3/fahey) - -The Fahey pseudocylindrical projection. - -# d3.geoFoucaut() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/foucaut.js), [Examples](https://observablehq.com/@d3/foucaut) -
# d3.geoFoucautRaw - -[](https://www.jasondavies.com/maps/foucaut/) - -Foucaut’s stereographic equivalent projection. - -# d3.geoFoucautSinusoidal() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/foucautSinusoidal.js), [Examples](https://observablehq.com/@d3/foucaut-sinusoidal) -
# d3.geoFoucautSinusoidalRaw - -[](https://observablehq.com/@d3/foucaut-sinusoidal) - -Foucaut’s sinusoidal projection, an equal-area average of the sinusoidal and Lambert’s cylindrical projections. - -# foucautSinusoidal.alpha([alpha]) - -Relative weight of the cylindrical projection. Defaults to 0.5. - -# d3.geoGilbert([type]) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/gilbert.js), [Examples](https://observablehq.com/@d3/gilbert) - -[](https://observablehq.com/@d3/gilbert) - -Gilbert’s two-world perspective projection. Wraps an instance of the specified projection *type*; if not specified, defaults to [d3.geoOrthographic](https://github.com/d3/d3-geo/blob/master/README.md#geoOrthographic). - -# d3.geoGingery() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/gingery.js), [Examples](https://observablehq.com/@d3/gingery) -
# d3.geoGingeryRaw(rho, lobes) - -[](https://observablehq.com/@d3/gingery) - -The U.S.-centric Gingery world projection, as inspired by Cram’s Air Age. Note: requires clipping to the sphere. - -# gingery.radius([radius]) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/gingery.js) - -Defaults to 30°. - -# gingery.lobes([lobes]) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/gingery.js) - -Defaults to 6. - -# d3.geoGinzburg4() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/ginzburg4.js), [Examples](https://observablehq.com/@d3/ginzburg-iv) -
# d3.geoGinzburg4Raw - -[](https://observablehq.com/@d3/ginzburg-iv) - -The Ginzburg IV projection. - -# d3.geoGinzburg5() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/ginzburg5.js), [Examples](https://observablehq.com/@d3/ginzburg-v) -
# d3.geoGinzburg5Raw - -[](https://observablehq.com/@d3/ginzburg-v) - -The Ginzburg V projection. - -# d3.geoGinzburg6() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/ginzburg6.js), [Examples](https://observablehq.com/@d3/ginzburg-vi) -
# d3.geoGinzburg6Raw - -[](https://observablehq.com/@d3/ginzburg-vi) - -The Ginzburg VI projection. - -# d3.geoGinzburg8() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/ginzburg8.js), [Examples](https://observablehq.com/@d3/ginzburg-viii) -
# d3.geoGinzburg8Raw - -[](https://observablehq.com/@d3/ginzburg-viii) - -The Ginzburg VIII projection. - -# d3.geoGinzburg9() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/ginzburg9.js), [Examples](https://observablehq.com/@d3/ginzburg-ix) -
# d3.geoGinzburg9Raw - -[](https://observablehq.com/@d3/ginzburg-ix) - -The Ginzburg IX projection. - -# d3.geoGnomonic() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/gnomonic.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoGnomonic), [Examples](https://observablehq.com/@d3/gnomonic) -
# d3.geoGnomonicRaw - -[](https://observablehq.com/@d3/gnomonic) - -The gnomonic projection. - -# d3.geoGringorten() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/gringorten.js), [Examples](https://observablehq.com/@d3/gringorten) -
# d3.geoGringortenRaw - -[](https://observablehq.com/@d3/gringorten) - -The Gringorten square equal-area projection, rearranged to give each hemisphere an entire square. - -# d3.geoGuyou() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/guyou.js), [Examples](https://observablehq.com/@d3/guyou) -
# d3.geoGuyouRaw - -[](https://observablehq.com/@d3/guyou) - -The Guyou hemisphere-in-a-square projection. Peirce is credited with its [quincuncial form](#geoPeirceQuincuncial). - -# d3.geoHammer() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/hammer.js), [Examples](https://observablehq.com/@d3/hammer) -
# d3.geoHammerRaw(A, B) - -[](https://observablehq.com/@d3/hammer) - -The Hammer projection. Depending the chosen coefficient and aspect, also known as [Eckert–Greifendorff](https://observablehq.com/@d3/hammer?b=4), [quartic authalic](https://observablehq.com/@d3/hammer?b=Infinity), and [Briesemeister](https://observablehq.com/@d3/briesemeister-projection). - -# hammer.coefficient([coefficient]) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/hammer.js) - -Defaults to 2. - -# d3.geoHammerRetroazimuthal() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/hammerRetroazimuthal.js), [Examples](https://observablehq.com/@d3/hammer-retroazimuthal) -
# d3.geoHammerRetroazimuthalRaw(phi0) - -[](https://observablehq.com/@d3/hammer-retroazimuthal) - -The Hammer retroazimuthal projection. Note: requires clipping to the sphere. - -# hammerRetroazimuthal.parallel([parallel]) - -Defaults to 45°. - -# d3.geoHealpix() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/healpix.js), [Examples](https://observablehq.com/@d3/healpix) -
# d3.geoHealpixRaw(lobes) - -[](https://observablehq.com/@d3/healpix) - -The HEALPix projection: a Hierarchical Equal Area isoLatitude Pixelisation of a 2-sphere. In this implementation, the parameter *K* is fixed at 3. Note: requires clipping to the sphere. - -# healpix.lobes([lobes]) - -If *lobes* is specified, sets the number of lobes (the parameter *H* in the literature) and returns this projection. If *lobes* is not specified, returns the current lobe number, which defaults to 4. - -# d3.geoHill() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/hill.js), [Examples](https://observablehq.com/@d3/hill-eucyclic) -
# d3.geoHillRaw(K) - -[](https://observablehq.com/@d3/hill-eucyclic) - -Hill eucyclic projection is pseudoconic and equal-area. - -# hill.ratio([ratio]) - -Defaults to 1. With a ratio of 0, this projection becomes the [Maurer No. 73](https://observablehq.com/@d3/hill-eucyclic?b=0). As it approaches ∞, the projection converges to the [Eckert IV](#geoEckert4). - -# d3.geoHomolosine() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/homolosine.js), [Examples](https://observablehq.com/@d3/goode-homolosine) -
# d3.geoHomolosineRaw - -[](https://observablehq.com/@d3/goode-homolosine) - -The pseudocylindrical, equal-area Goode homolosine projection is normally presented in [interrupted form](#geoInterruptedHomolosine). - -# d3.geoHufnagel() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/hufnagel.js), [Examples](https://observablehq.com/@fil/hufnagel-projection) -
# d3.geoHufnagelRaw - -[](https://observablehq.com/@fil/hufnagel-projection) - -A customizable family of pseudocylindrical equal-area projections by Herbert Hufnagel. - -# hufnagel.a([a]) - -# hufnagel.b([b]) - -# hufnagel.psiMax([psiMax]) - -# hufnagel.ratio([ratio]) - -# d3.geoHyperelliptical() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/hyperelliptical.js), [Examples](https://observablehq.com/@fil/toblers-hyperelliptical-projection) -
# d3.geoHyperellipticalRaw - -[](https://observablehq.com/@fil/toblers-hyperelliptical-projection) - -Waldo R. Tobler’s hyperelliptical is a family of equal-area pseudocylindrical projections. Parameters include _k_, the exponent of the superellipse (or Lamé curve) that defines the shape of the meridians (default _k_ = 2.5); _alpha_, which governs the weight of the cylindrical projection that is averaged with the superellipse (default _alpha_ = 0); and _gamma_, that shapes the aspect ratio (default: _gamma_ = 1.183136). - -# d3.geoKavrayskiy7() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/kavrayskiy7.js), [Examples](https://observablehq.com/@d3/kavrayskiy-vii) -
# d3.geoKavrayskiy7Raw - -[](https://observablehq.com/@d3/kavrayskiy-vii) - -The Kavrayskiy VII pseudocylindrical projection. - -# d3.geoLagrange() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/lagrange.js), [Examples](https://observablehq.com/@d3/lagrange) -
# d3.geoLagrangeRaw(n) - -[](https://observablehq.com/@d3/lagrange) - -The Lagrange conformal projection. - -# lagrange.spacing([spacing]) - -Defaults to 0.5. - -# d3.geoLarrivee() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/larrivee.js), [Examples](https://observablehq.com/@d3/larrivee) -
# d3.geoLarriveeRaw - -[](https://observablehq.com/@d3/larrivee) - -The Larrivée projection. - -# d3.geoLaskowski() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/laskowski.js), [Examples](https://observablehq.com/@d3/laskowski-tri-optimal) -
# d3.geoLaskowskiRaw - -[](https://observablehq.com/@d3/laskowski-tri-optimal) - -The Laskowski tri-optimal projection simultaneously minimizes distance, angular, and areal distortion. - -# d3.geoLittrow() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/littrow.js), [Examples](https://observablehq.com/@d3/littrow) -
# d3.geoLittrowRaw - -[](https://observablehq.com/@d3/littrow) - -The Littrow projection is the only conformal retroazimuthal map projection. Typically clipped to the geographic extent [[-90°, -60°], [90°, 60°]]. - -# d3.geoLoximuthal() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/loximuthal.js), [Examples](https://observablehq.com/@d3/loximuthal) -
# d3.geoLoximuthalRaw(phi0) - -[](https://observablehq.com/@d3/loximuthal) - -The [loximuthal projection](https://en.wikipedia.org/wiki/Loximuthal_projection) is “characterized by the fact that loxodromes (rhumb lines) from one chosen central point (the intersection of the central meridian and central latitude) are shown as straight lines, correct in azimuth from the center, and are ‘true to scale’… It is neither an equal-area projection nor conformal.” - -# loximuthal.parallel([parallel]) - -Defaults to 40°. - -# d3.geoMercator() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/mercator.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoMercator), [Examples](https://observablehq.com/@d3/mercator) -
# d3.geoMercatorRaw - -[](https://observablehq.com/@d3/mercator) - -The spherical Mercator projection. - -# d3.geoMiller() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/miller.js), [Examples](https://observablehq.com/@d3/miller) -
# d3.geoMillerRaw - -[](https://observablehq.com/@d3/miller) - -The Miller cylindrical projection is a modified [Mercator](#geoMercator) projection. - -# d3.geoModifiedStereographic(coefficients, rotate) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/modifiedStereographic.js) -
# d3.geoModifiedStereographicRaw(coefficients) - -The family of [modified stereographic projections](https://www.jasondavies.com/maps/modified-stereographic/). The default [clip angle](https://github.com/d3/d3-geo/blob/master/README.md#projection_clipAngle) for these projections is 90°. These projections do not support [*projection*.rotate](https://github.com/d3/d3-geo/blob/master/README.md#projection_rotate): a fixed rotation is applied that is specific to the given *coefficients*. - -# d3.geoModifiedStereographicAlaska() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/modifiedStereographic.js) - -[](https://www.jasondavies.com/maps/modified-stereographic/alaska/) - -A [modified stereographic](#geoModifiedStereographic) projection for Alaska. - -# d3.geoModifiedStereographicGs48() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/modifiedStereographic.js) - -[](https://www.jasondavies.com/maps/modified-stereographic/gs48/) - -A [modified stereographic](#geoModifiedStereographic) projection for the conterminous United States. - -# d3.geoModifiedStereographicGs50() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/modifiedStereographic.js) - -[](https://www.jasondavies.com/maps/modified-stereographic/gs50/) - -A [modified stereographic](#geoModifiedStereographic) projection for the United States including Alaska and Hawaii. Typically clipped to the geographic extent [[-180°, 15°], [-50°, 75°]]. - -# d3.geoModifiedStereographicMiller() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/modifiedStereographic.js), [Examples](https://observablehq.com/@d3/miller-oblated-stereographic) - -[](https://www.jasondavies.com/maps/modified-stereographic/miller/) - -A [modified stereographic](#geoModifiedStereographic) projection for Europe and Africa. Typically clipped to the geographic extent [[-40°, -40°], [80°, 80°]]. - -# d3.geoModifiedStereographicLee() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/modifiedStereographic.js), [Examples](https://observablehq.com/@d3/lee-oblated-stereographic) - -[](https://www.jasondavies.com/maps/modified-stereographic/lee/) - -A [modified stereographic](#geoModifiedStereographic) projection for the Pacific ocean. - -# d3.geoMollweide() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/mollweide.js), [Examples](https://observablehq.com/@d3/mollweide) -
# d3.geoMollweideRaw - -[](https://observablehq.com/@d3/mollweide) - -The equal-area, pseudocylindrical Mollweide projection. The oblique aspect is known as the [Atlantis projection](https://observablehq.com/@d3/atlantis). [Goode’s interrupted Mollweide](#interruptedMollweide) is also widely known. - -# d3.geoMtFlatPolarParabolic() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/mtFlatPolarParabolic.js), [Examples](https://observablehq.com/@d3/flat-polar-parabolic) -
# d3.geoMtFlatPolarParabolicRaw - -[](https://observablehq.com/@d3/flat-polar-parabolic) - -The McBryde–Thomas flat-polar parabolic pseudocylindrical equal-area projection. - -# d3.geoMtFlatPolarQuartic() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/mtFlatPolarQuartic.js), [Examples](https://observablehq.com/@d3/flat-polar-quartic) -
# d3.geoMtFlatPolarQuarticRaw - -[](https://observablehq.com/@d3/flat-polar-quartic) - -The McBryde–Thomas flat-polar quartic pseudocylindrical equal-area projection. - -# d3.geoMtFlatPolarSinusoidal() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/mtFlatPolarSinusoidal.js), [Examples](https://observablehq.com/@d3/flat-polar-sinusoidal) -
# d3.geoMtFlatPolarSinusoidalRaw - -[](https://observablehq.com/@d3/flat-polar-sinusoidal) - -The McBryde–Thomas flat-polar sinusoidal equal-area projection. - -# d3.geoNaturalEarth1() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/naturalEarth1.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoNaturalEarth1), [Examples](https://observablehq.com/@d3/natural-earth) -
# d3.geoNaturalEarth1Raw - -[](https://observablehq.com/@d3/natural-earth) - -The Natural Earth projection. - -# d3.geoNaturalEarth2() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/naturalEarth2.js), [Examples](https://observablehq.com/@d3/natural-earth-ii) -
# d3.geoNaturalEarth2Raw - -[](https://observablehq.com/@d3/natural-earth-ii) - -The [Natural Earth II](http://www.shadedrelief.com/NE2_proj/) projection. Compared to [Natural Earth](#geoNaturalEarth), it is slightly taller and rounder. - -# d3.geoNellHammer() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/nellHammer.js), [Examples](https://observablehq.com/@d3/nell-hammer) -
# d3.geoNellHammerRaw - -[](https://observablehq.com/@d3/nell-hammer) - -The Nell–Hammer projection. - -# d3.geoNicolosi() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/nicolosi.js), [Examples](https://observablehq.com/@toja/nicolosi-globular-projection) -
# d3.geoNicolosiRaw - -[](https://observablehq.com/@toja/nicolosi-globular-projection) - -The Nicolosi globular projection. - -# d3.geoOrthographic() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/orthographic.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoOrthographic), [Examples](https://observablehq.com/@d3/orthographic) -
# d3.geoOrthographicRaw - -[](https://observablehq.com/@d3/orthographic) - -The orthographic projection. - -# d3.geoPatterson() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/patterson.js), [Examples](https://observablehq.com/@d3/patterson-cylindrical) -
# d3.geoPattersonRaw - -[](https://observablehq.com/@d3/patterson-cylindrical) - -The Patterson cylindrical projection. - -# d3.geoPolyconic() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/polyconic.js), [Examples](https://observablehq.com/@d3/polyconic) -
# d3.geoPolyconicRaw - -[](https://observablehq.com/@d3/polyconic) - -The American polyconic projection. - -# d3.geoRectangularPolyconic() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/rectangularPolyconic.js), [Examples](https://observablehq.com/@d3/rectangular-polyconic) -
# d3.geoRectangularPolyconicRaw(phi0) - -[](https://observablehq.com/@d3/rectangular-polyconic) - -The rectangular (War Office) polyconic projection. - -# rectangularPolyconic.parallel([parallel]) - -Defaults to 0°. - -# d3.geoRobinson() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/robinson.js), [Examples](https://observablehq.com/@d3/robinson) -
# d3.geoRobinsonRaw - -[](https://observablehq.com/@d3/robinson) - -The Robinson projection. - -# d3.geoSatellite() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/satellite.js), [Examples](https://observablehq.com/@d3/satellite) -
# d3.geoSatelliteRaw(P, omega) - -[](https://observablehq.com/@d3/satellite) - -The satellite (tilted perspective) projection. - -# satellite.tilt([tilt]) - -Defaults to 0°. - -# satellite.distance([distance]) - -Distance from the center of the sphere to the point of view, as a proportion of the sphere’s radius; defaults to 2.0. The recommended maximum [clip angle](https://github.com/d3/d3-geo/blob/master/README.md#projection_clipAngle) for a given *distance* is acos(1 / *distance*) converted to degrees. If [tilt](#satellite_tilt) is also applied, then more conservative clipping may be necessary. For exact clipping, the in-development geographic projection pipeline is needed; see the [satellite explorer](https://observablehq.com/@d3/satellite-explorer). - -# d3.geoSinusoidal() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/sinusoidal.js), [Examples](https://observablehq.com/@d3/sinusoidal) -
# d3.geoSinusoidalRaw - -[](https://observablehq.com/@d3/sinusoidal) - -The sinusoidal projection. - -# d3.geoSinuMollweide() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/sinuMollweide.js), [Examples](https://observablehq.com/@d3/sinu-mollweide) -
# d3.geoSinuMollweideRaw - -[](https://observablehq.com/@d3/sinu-mollweide) - -Allen K. Philbrick’s Sinu-Mollweide projection. See also the [interrupted form](#interruptedSinuMollweide). - -# d3.geoStereographic() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/stereographic.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoStereographic), [Examples](https://observablehq.com/@d3/stereographic) -
# d3.geoStereographicRaw - -[](https://observablehq.com/@d3/stereographic) - -The stereographic projection. - -# d3.geoTimes() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/times.js), [Examples](https://observablehq.com/@d3/times) -
# d3.geoTimesRaw - -[](https://observablehq.com/@d3/times) - -John Muir’s Times projection. - -# d3.geoTransverseMercator() · [Source](https://github.com/d3/d3-geo/blob/master/src/projection/transverseMercator.js) [\[d3-geo\]](https://github.com/d3/d3-geo/blob/master/README.md#geoTransverseMercator), [Examples](https://observablehq.com/@d3/transverse-mercator) -
# d3.geoTransverseMercatorRaw - -[](https://observablehq.com/@d3/transverse-mercator) - -The transverse spherical Mercator projection. - -# d3.geoTwoPointAzimuthal(point0, point1) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/twoPointAzimuthal.js) -
# d3.geoTwoPointAzimuthalRaw(d) - -The two-point azimuthal projection “shows correct azimuths (but not distances) from either of two points to any other point. [It can] be used to locate a ship at sea, given the exact location of two radio transmitters and the direction of the ship to the transmitters.” This projection does not support [*projection*.rotate](https://github.com/d3/d3-geo/blob/master/README.md#projection_rotate), as the rotation is fixed by the two given points. - -# d3.geoTwoPointAzimuthalUsa() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/twoPointAzimuthal.js) - -[](https://www.jasondavies.com/maps/two-point-azimuthal/) - -The two-point azimuthal projection with points [-158°, 21.5°] and [-77°, 39°], approximately representing Honolulu, HI and Washington, D.C. - -# d3.geoTwoPointEquidistant(point0, point1) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/twoPointEquidistant.js) -
# d3.geoTwoPointEquidistantRaw(z0) - -The two-point equidistant projection. This projection does not support [*projection*.rotate](https://github.com/d3/d3-geo/blob/master/README.md#projection_rotate), as the rotation is fixed by the two given points. Note: to show the whole Earth, this projection requires clipping to spherical polygons, which is not yet supported in D3. However, you can typically show most of the Earth by using D3’s great-circle clipping. - -# d3.geoTwoPointEquidistantUsa() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/twoPointEquidistant.js) - -[](https://www.jasondavies.com/maps/two-point-equidistant/) - -The two-point equidistant projection with points [-158°, 21.5°] and [-77°, 39°], approximately representing Honolulu, HI and Washington, D.C. - -# d3.geoVanDerGrinten() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/vanDerGrinten.js), [Examples](https://observablehq.com/@d3/van-der-grinten-i) -
# d3.geoVanDerGrintenRaw - -[](https://observablehq.com/@d3/van-der-grinten-i) - -The Van der Grinten projection. - -# d3.geoVanDerGrinten2() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/vanDerGrinten2.js), [Examples](https://observablehq.com/@d3/van-der-grinten-ii) -
# d3.geoVanDerGrinten2Raw - -[](https://observablehq.com/@d3/van-der-grinten-ii) - -The Van der Grinten II projection. - -# d3.geoVanDerGrinten3() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/vanDerGrinten3.js), [Examples](https://observablehq.com/@d3/van-der-grinten-iii) -
# d3.geoVanDerGrinten3Raw - -[](https://observablehq.com/@d3/van-der-grinten-iii) - -The Van der Grinten III projection. - -# d3.geoVanDerGrinten4() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/vanDerGrinten4.js), [Examples](https://observablehq.com/@d3/van-der-grinten-iv) -
# d3.geoVanDerGrinten4Raw - -[](https://observablehq.com/@d3/van-der-grinten-iv) - -The Van der Grinten IV projection. - -# d3.geoWagner() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/wagner.js), [Examples](https://observablehq.com/@fil/wagner-customizable-projection) -
# d3.geoWagnerRaw - -[](https://map-projections.net/d3-customizable-wagner/) - -The Wagner projection is customizable: default values produce the Wagner VIII projection. - -# wagner.poleline([poleline]) - -Defaults to 65°. - -# wagner.parallels([parallels]) - -Defaults to 60°. - -# wagner.inflation([inflation]) - -Defaults to 20. - -# wagner.ratio([ratio]) - -Defaults to 200. - -# d3.geoWagner4() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/wagner4.js), [Examples](https://observablehq.com/@d3/wagner-iv) -
# d3.geoWagner4Raw - -[](https://observablehq.com/@d3/wagner-iv) - -The Wagner IV projection, also known as Putniṇš P2´. - -# d3.geoWagner6() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/wagner6.js), [Examples](https://observablehq.com/@d3/wagner-vi) -
# d3.geoWagner6Raw - -[](https://observablehq.com/@d3/wagner-vi) - -The Wagner VI projection. - -# d3.geoWagner7() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/wagner7.js), [Examples](ttps://observablehq.com/@d3/wagner-vii) - -[](https://observablehq.com/@d3/wagner-vii) - -The Wagner VII projection. - -# d3.geoWiechel() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/wiechel.js), [Examples](https://observablehq.com/@d3/wiechel) -
# d3.geoWiechelRaw - -[](https://observablehq.com/@d3/wiechel) - -The Wiechel projection. - -# d3.geoWinkel3() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/winkel3.js), [Examples](https://observablehq.com/@d3/winkel-tripel) -
# d3.geoWinkel3Raw - -[](https://observablehq.com/@d3/winkel-tripel) - -The Winkel tripel projection. - -### Interrupted Projections - -# d3.geoInterrupt(project, lobes) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/interrupted/index.js), [Examples](https://observablehq.com/@d3/interrupted-sinusoidal) - -Defines a new interrupted projection for the specified [raw projection](#raw-projections) function *project* and the specified array of *lobes*. The array *lobes* contains two elements representing the hemilobes for the northern hemisphere and the southern hemisphere, respectively. Each hemilobe is an array of triangles, with each triangle represented as three points (in degrees): the start, midpoint, and end. For example, the lobes in [Goode’s interrupted homolosine](#geoInterruptedHomolosine) projection are defined as: - -```json -[ - [ - [[-180, 0], [-100, 90], [ -40, 0]], - [[ -40, 0], [ 30, 90], [ 180, 0]] - ], - [ - [[-180, 0], [-160, -90], [-100, 0]], - [[-100, 0], [ -60, -90], [ -20, 0]], - [[ -20, 0], [ 20, -90], [ 80, 0]], - [[ 80, 0], [ 140, -90], [ 180, 0]] - ] -] -``` - -Note: interrupted projections typically require clipping to the sphere. - -# interrupted.lobes([lobes]) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/interrupted/index.js) - -If *lobes* is specified, sets the new array of hemilobes and returns this projection; see [d3.geoInterrupt](#geoInterrupt) for details on the format of the hemilobes array. If *lobes* is not specified, returns the current array of hemilobes. - -# d3.geoInterruptedHomolosine() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/interrupted/homolosine.js), [Examples](https://observablehq.com/@d3/interrupted-goode-homolosine) - -[](https://observablehq.com/@d3/interrupted-goode-homolosine) - -Goode’s interrupted [homolosine projection](#geoHomolosine). Its [ocean-centric aspect](https://observablehq.com/@d3/interrupted-homolosine-oceans) is also well-known. - -# d3.geoInterruptedSinusoidal() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/interrupted/sinusoidal.js), [Examples](https://observablehq.com/@d3/interrupted-sinusoidal) - -[](https://observablehq.com/@d3/interrupted-sinusoidal) - -An interrupted [sinusoidal projection](#geoSinusoidal) with asymmetrical lobe boundaries that emphasize land masses over oceans, after the Swedish Nordisk Världs Atlas as reproduced by [C.A. Furuti](https://web.archive.org/web/20150928042327/http://www.progonos.com/furuti/MapProj/Normal/ProjInt/projInt.html#InterruptedSansonFlamsteed). - -# d3.geoInterruptedBoggs() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/interrupted/boggs.js), [Examples](https://observablehq.com/@d3/interrupted-boggs-eumorphic) - -[](https://observablehq.com/@d3/interrupted-boggs-eumorphic) - -Bogg’s interrupted [eumorphic projection](#geoBoggs). - -# d3.geoInterruptedSinuMollweide() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/interrupted/sinuMollweide.js), [Examples](https://observablehq.com/@d3/interrupted-sinu-mollweide) - -[](https://observablehq.com/@d3/interrupted-sinu-mollweide) - -Alan K. Philbrick’s interrupted [sinu-Mollweide projection](#geoSinuMollweide). - -# d3.geoInterruptedMollweide() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/interrupted/mollweide.js), [Examples](https://observablehq.com/@d3/interrupted-mollweide) - -[](https://observablehq.com/@d3/interrupted-mollweide) - -Goode’s interrupted [Mollweide projection](#geoMollweide). - -# d3.geoInterruptedMollweideHemispheres() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/interrupted/mollweideHemispheres.js), [Examples](https://observablehq.com/@d3/mollweide-hemispheres) - -[](https://observablehq.com/@d3/mollweide-hemispheres) - -The [Mollweide projection](#geoMollweide) interrupted into two (equal-area) hemispheres. - -# d3.geoInterruptedQuarticAuthalic() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/quarticAuthalic.js), [Examples](https://observablehq.com/@piwodlaiwo/interrupted-quartic-authalic-projection) - -[](https://observablehq.com/@piwodlaiwo/interrupted-quartic-authalic-projection) - -The [quartic authalic projection](https://observablehq.com/@d3/hammer?b=Infinity) interrupted into two hemispheres. - -### Polyhedral Projections - -# d3.geoPolyhedral(root, face) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/polyhedral/index.js) - -Defines a new polyhedral projection. The *root* is a spanning tree of polygon face nodes; each *node* is assigned a *node*.transform matrix. The *face* function returns the appropriate *node* for a given *lambda* and *phi* in radians. Use [*projection*.angle](https://github.com/d3/d3-geo/blob/master/README.md#projection_angle) to set the orientation of the map (the default *angle*, -30°, might change in the next major version). - -# d3.geoPolyhedralButterfly() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/polyhedral/butterfly.js), [Examples](https://observablehq.com/@d3/polyhedral-gnomonic) - -[](https://observablehq.com/@d3/polyhedral-gnomonic) - -The gnomonic butterfly projection. - -# d3.geoPolyhedralCollignon() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/polyhedral/collignon.js), [Examples](https://observablehq.com/@d3/polyhedral-collignon) - -[](https://www.jasondavies.com/maps/collignon-butterfly/) - -The Collignon butterfly projection. - -# d3.geoPolyhedralWaterman() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/polyhedral/waterman.js), [Examples](https://observablehq.com/@d3/watermans-butterfly) - -[](https://www.jasondavies.com/maps/waterman-butterfly/) - -Steve Waterman’s butterfly projection. - -### Quincuncial Projections - -# d3.geoQuincuncial(project) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/quincuncial/index.js) - -Defines a new quincuncial projection for the specified [raw projection](#raw-projections) function *project*. The default rotation is [-90°, -90°, 45°] and the default clip angle is 180° - ε. - -# d3.geoGringortenQuincuncial() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/quincuncial/gringorten.js) - - - -The Gringorten square equal-area projection. - -# d3.geoPeirceQuincuncial() · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/quincuncial/peirce.js) - -[](https://observablehq.com/@d3/peirce-quincuncial) - -The Peirce quincuncial projection is the quincuncial form of the [Guyou projection](#geoGuyou). - -### Transformations - -# d3.geoProject(object, projection) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/project/index.js) - -Projects the specified GeoJSON *object* using the specified *projection*, returning a shallow copy of the specified GeoJSON *object* with projected coordinates. Typically, the input coordinates are spherical and the output coordinates are planar, but the *projection* can also be an [arbitrary geometric transformation](https://github.com/d3/d3-geo/blob/master/README.md#transforms). - -See also [geoproject](#geoproject). - -# d3.geoStitch(object) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/stitch.js) - -Returns a shallow copy of the specified GeoJSON *object*, removing antimeridian and polar cuts, and replacing straight Cartesian line segments with geodesic segments. The input *object* must have coordinates in longitude and latitude in decimal degrees per [RFC 7946](https://tools.ietf.org/html/rfc7946). [Antimeridian cutting](https://bl.ocks.org/mbostock/3788999), if needed, can then be re-applied after rotating to the desired projection aspect. - -See also [geostitch](#geostitch). - -# d3.geoQuantize(object, digits) · [Source](https://github.com/d3/d3-geo-projection/blob/master/src/quantize.js) - -Returns a shallow copy of the specified GeoJSON *object*, rounding *x* and *y* coordinates according to [*number*.toFixed](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed). Typically this is done *after* [projecting](#geoProject). - -See also [geoproject --precision](#geoproject_precision) and [geo2svg --precision](#geo2svg_precision). - -## Command-Line Reference - -### geo2svg - -# geo2svg [options…] [file] · [Source](https://github.com/d3/d3-geo-projection/blob/master/bin/geo2svg) - -Converts the specified GeoJSON *file* to SVG. With [--newline-delimited](#geo2svg_newline_delimited), each input feature is rendered as a separate [path element](https://www.w3.org/TR/SVG/paths.html); otherwise, a single path element is generated. - -By default, the SVG’s [fill](#geo2svg_fill) is set to none and the [stroke](#geo2svg_stroke) is set to black. The default [point radius](https://github.com/d3/d3-geo/blob/master/README.md#path_pointRadius) is 4.5. To override these values on a per-feature basis, the following [GeoJSON feature](http://geojson.org/geojson-spec.html#feature-objects) properties will be propagated to attributes: - -* fill -* fill-rule (or fillRule) -* fill-opacity (or fillOpacity) -* stroke -* stroke-width (or strokeWidth) -* stroke-linecap (or strokeLinecap) -* stroke-linejoin (or strokeLinejoin) -* stroke-miterlimit (or strokeMiterlimit) -* stroke-dasharray (or strokeDasharray) -* stroke-dashoffset (or strokeDashoffset) -* stroke-opacity (or strokeOpacity) -* point-radius (or pointRadius) - -If the feature has an id, the path element will have a corresponding id attribute. If the feature has a *title* property, the path element will have a title element with the corresponding value. For an example of per-feature attributes, see this [California population density map](https://bl.ocks.org/mbostock/fb6c1e5ff700f9713a9dc2f0fd392c35). - -Note: per-feature attributes are most useful in conjunction with [newline-delimited](#geo2svg_newline_delimited) input, as otherwise the generated SVG only has a single path element. To set these properties dynamically, pass the input through [ndjson-map](https://github.com/mbostock/ndjson-cli/blob/master/README.md#map). - -# geo2svg -h -
# geo2svg --help - -Output usage information. - -# geo2svg -V -
# geo2svg --version - -Output the version number. - -# geo2svg -o file -
# geo2svg --out file - -Specify the output file name. Defaults to “-” for stdout. - -# geo2svg -w value -
# geo2svg --width value - -Specify the output width. Defaults to 960. - -# geo2svg -h value -
# geo2svg --height value - -Specify the output height. Defaults to 500. - -# geo2svg -p value -
# geo2svg --precision value - -Reduce the precision for smaller output files. Defaults to six digits after the decimal point. See also [d3.geoQuantize](#geoQuantize). - -# geo2svg --fill value - -Specify the default output fill color. Defaults to none. - -# geo2svg --stroke value - -Specify the default output stroke color. Defaults to black. - -# geo2svg --r value -
# geo2svg --radius value - -Specify the default output point radius. Defaults to 4.5. - -# geo2svg -n -
# geo2svg --newline-delimited - -Accept [newline-delimited JSON](http://ndjson.org/) as input, with one feature per line. - -### geograticule - -# geograticule [options…] · [Source](https://github.com/d3/d3-geo-projection/blob/master/bin/geograticule) - -Generates a GeoJSON graticule. See also [d3.geoGraticule](https://github.com/d3/d3-geo/blob/master/README.md#geoGraticule). - -# geograticule -h -
# geograticule --help - -Output usage information. - -# geograticule -V -
# geograticule --version - -Output the version number. - -# geograticule -o file -
# geograticule --out file - -Specify the output file name. Defaults to “-” for stdout. - -# geograticule --extent value - -Sets the graticule’s [extent](https://github.com/d3/d3-geo/blob/master/README.md#graticule_extent). - -# geograticule --extent-minor value - -Sets the graticule’s [minor extent](https://github.com/d3/d3-geo/blob/master/README.md#graticule_extentMinor). - -# geograticule --extent-major value - -Sets the graticule’s [major extent](https://github.com/d3/d3-geo/blob/master/README.md#graticule_extentMajor). - -# geograticule --step value - -Sets the graticule’s [step](https://github.com/d3/d3-geo/blob/master/README.md#graticule_step). - -# geograticule --step-minor value - -Sets the graticule’s [minor step](https://github.com/d3/d3-geo/blob/master/README.md#graticule_stepMinor). - -# geograticule --step-major value - -Sets the graticule’s [major setp](https://github.com/d3/d3-geo/blob/master/README.md#graticule_stepMajor). - -# geograticule --precision value - -Sets the graticule’s [precision](https://github.com/d3/d3-geo/blob/master/README.md#graticule_precision). - -### geoproject - -# geoproject [options…] projection [file] · [Source](https://github.com/d3/d3-geo-projection/blob/master/bin/geoproject) - -Projects the GeoJSON object in the specified input *file* using the specified *projection*, outputting a new GeoJSON *object* with projected coordinates. For example, to project standard [WGS 84](https://en.wikipedia.org/wiki/World_Geodetic_System#A_new_World_Geodetic_System:_WGS_84) input using [d3.geoAlbersUsa](https://github.com/d3/d3-geo/blob/master/README.md#geoAlbersUsa): - -```bash -geoproject 'd3.geoAlbersUsa()' us.json \ - > us-albers.json -``` - -For geometry that crosses the antimeridian or surrounds a pole, you will want to pass input through [geostitch](#geostitch) first: - -```bash -geostitch world.json \ - | geoproject 'd3.geoMercator()' \ - > world-mercator.json -``` - -Typically, the input coordinates are spherical and the output coordinates are planar, but the *projection* can also be an [arbitrary geometric transformation](https://github.com/d3/d3-geo/blob/master/README.md#transforms). For example, to invert the *y*-axis of a standard [spatial reference system](https://en.wikipedia.org/wiki/Spatial_reference_system) such as [California Albers (EPSG:3310)](http://spatialreference.org/ref/epsg/nad83-california-albers/) and fit it to a 960×500 viewport: - -```bash -shp2json planar.shp \ - | geoproject 'd3.geoIdentity().reflectY(true).fitSize([960, 500], d)' \ - > planar.json -``` - -See also [d3.geoProject](#geoProject) and [d3.geoIdentity](https://github.com/d3/d3-geo/blob/master/README.md#geoIdentity). - -# geoproject -h -
# geoproject --help - -Output usage information. - -# geoproject -V -
# geoproject --version - -Output the version number. - -# geoproject -o file -
# geoproject --out file - -Specify the output file name. Defaults to “-” for stdout. - -# geoproject -p value -
# geoproject --precision value - -Reduce the precision for smaller output files. See also [d3.geoQuantize](#geoQuantize). - -# geoproject -n -
# geoproject --newline-delimited - -Accept [newline-delimited JSON](http://ndjson.org/) as input, with one feature per line, and generate newline-delimited JSON as output. - -# geoproject -r [name=]value -
# geoproject --require [name=]value - -Requires the specified *module*, making it available for use in any expressions used by this command. The loaded module is available as the symbol *name*. If *name* is not specified, it defaults to *module*. (If *module* is not a valid identifier, you must specify a *name*.) For example, to reproject the world on the [Airocean projection](https://github.com/d3/d3-geo-polygon/blob/master/README.md#geoAirocean): - -```bash -geoproject --require d3=d3-geo-polygon 'd3.geoAirocean()' world.geojson -``` - -The required *module* is resolved relative to the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If the *module* is not found during normal resolution, the [global npm root](https://docs.npmjs.com/cli/root) is also searched, allowing you to require globally-installed modules from the command line. - -Multiple modules can be required by repeating this option. - -### geoquantize - -# geoquantize [options…] [file] · [Source](https://github.com/d3/d3-geo-projection/blob/master/bin/geoquantize) - -Reads the GeoJSON object from the specified input *file* and outputs a new GeoJSON *object* with coordinates reduced to *precision*. Same options as [geoproject](#geoproject). - -```bash -geoquantize us.json --precision 3 \ - > us-quantized.json -``` - -### geostitch - -# geostitch [options…] [file] · [Source](https://github.com/d3/d3-geo-projection/blob/master/bin/geostitch) - -Stitches the GeoJSON object in the specified input *file*, removing antimeridian and polar cuts, and replacing straight Cartesian line segments with geodesic segments. The input *object* must have coordinates in longitude and latitude in decimal degrees per [RFC 7946](https://tools.ietf.org/html/rfc7946). [Antimeridian cutting](https://bl.ocks.org/mbostock/3788999), if needed, can then be re-applied after rotating to the desired projection aspect. - -See [geoproject](#geoproject) for an example. See also [d3.geoStitch](#geoStitch). - -# geostitch -h -
# geostitch --help - -Output usage information. - -# geostitch -V -
# geostitch --version - -Output the version number. - -# geostitch -o file -
# geostitch --out file - -Specify the output file name. Defaults to “-” for stdout. - -# geostitch -n -
# geostitch --newline-delimited - -Accept [newline-delimited JSON](http://ndjson.org/) as input, with one feature per line, and generate newline-delimited JSON as output. diff --git a/node_modules/d3-geo-projection/bin/geo2svg b/node_modules/d3-geo-projection/bin/geo2svg deleted file mode 100755 index 96f9fbd..0000000 --- a/node_modules/d3-geo-projection/bin/geo2svg +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env node - -var os = require("os"), - commander = require("commander"), - d3 = Object.assign({}, require("d3-geo"), require("../")), - read = require("./read"), - write = require("./write"); - -commander - .version(require("../package.json").version) - .usage("[options] [file]") - .description("Convert GeoJSON to SVG.") - .option("-o, --out ", "output file name; defaults to “-” for stdout", "-") - .option("-w, --width ", "output width", 960) - .option("-h, --height ", "output height", 500) - .option("-p, --precision ", "number of output digits after the decimal point", 6) - .option("-n, --newline-delimited", "accept newline-delimited JSON") - .option("--fill ", "default fill", "none") - .option("--stroke ", "default stroke", "black") - .option("-r, --radius ", "default point radius", 4.5) - .parse(process.argv); - -if (commander.args.length === 0) commander.args[0] = "-"; -else if (commander.args.length !== 1) { - console.error(); - console.error(" error: multiple input files"); - console.error(); - process.exit(1); -} - -var reader = read(commander.args[0], commander.newlineDelimited, transform).then(end).catch(abort), - writer = write(commander.out), - path = d3.geoPath().pointRadius(function(d) { var p = d.properties, v; return p && (v = p["point-radius"] || p.pointRadius) != null ? v : commander.radius; }), - render = commander.precision == null ? path : function(d) { return path(d3.geoQuantize(d, commander.precision)); }; - -writer.write("" + os.EOL - + "" + os.EOL - + "" + os.EOL - + "" + os.EOL); - -function transform(d) { - var p = d.properties, v; - return writer.write(" " - + ((v = p && p["title"]) != null ? "" + text(v + "") + "" : "") - + "" + os.EOL); -} - -function end() { - return writer.write("" + os.EOL); -} - -function abort(error) { - console.error(error.stack); -} - -function text(string) { - return string.replace(/[&<>]/g, function(character) { - switch (character) { - case "&": return "&"; - case "<": return "<"; - case ">": return ">"; - } - }); -} - -function attr(string) { - return string.replace(/"/g, """); -} diff --git a/node_modules/d3-geo-projection/bin/geograticule b/node_modules/d3-geo-projection/bin/geograticule deleted file mode 100755 index 353bc75..0000000 --- a/node_modules/d3-geo-projection/bin/geograticule +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env node - -var commander = require("commander"), - graticule = require("d3-geo").geoGraticule(), - write = require("./write"); - -commander - .version(require("../package.json").version) - .usage("[options]") - .description("Generate a GeoJSON graticule.") - .option("-o, --out ", "output file name; defaults to “-” for stdout", "-") - .option("--extent ", "the major and minor extent", parseExtent) - .option("--extent-minor ", "the minor extent; defaults to " + graticule.extentMajor(), parseExtent) - .option("--extent-major ", "the major extent; defaults to " + graticule.extentMinor(), parseExtent) - .option("--step ", "the major and minor step", parseStep) - .option("--step-minor ", "the minor step; defaults to " + graticule.stepMinor(), parseStep) - .option("--step-major ", "the major step; defaults to " + graticule.stepMajor(), parseStep) - .option("--precision ", "the precision; defaults to " + graticule.precision(), graticule.precision) - .parse(process.argv); - -if (commander.args.length !== 0) { - console.error(); - console.error(" error: unexpected arguments"); - console.error(); - process.exit(1); -} - -if (commander.extent != null) { - if (commander.extentMinor == null) commander.extentMinor = commander.extent; - if (commander.extentMajor == null) commander.extentMajor = commander.extent; -} -if (commander.step != null) { - if (commander.stepMinor == null) commander.stepMinor = commander.step; - if (commander.stepMajor == null) commander.stepMajor = commander.step; -} -if (commander.extentMinor != null) graticule.extentMinor(commander.extentMinor); -if (commander.extentMajor != null) graticule.extentMajor(commander.extentMajor); -if (commander.stepMinor != null) graticule.stepMinor(commander.stepMinor); -if (commander.stepMajor != null) graticule.stepMajor(commander.stepMajor); - -var writer = write(commander.out); -writer.write(JSON.stringify(graticule()) + "\n"); -writer.end().catch(abort); - -function parseStep(x) { - return x = x.split(","), x.length === 1 ? [+x[0], +x[0]] : [+x[0], +x[1]]; -} - -function parseExtent(x) { - return x = x.split(","), [[+x[0], +x[1]], [+x[2], +x[3]]]; -} - -function abort(error) { - console.error(error.stack); -} diff --git a/node_modules/d3-geo-projection/bin/geoproject b/node_modules/d3-geo-projection/bin/geoproject deleted file mode 100755 index db23e13..0000000 --- a/node_modules/d3-geo-projection/bin/geoproject +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env node - -var commander = require("commander"), - vm = require("vm"), - d3 = Object.assign({}, require("d3-geo"), require("../")), - read = require("./read"), - requires = require("./requires"), - write = require("./write"); - -commander - .version(require("../package.json").version) - .usage("[options] [file]") - .description("Transform GeoJSON, such as to project from spherical to planar coordinates.") - .option("-o, --out ", "output file name; defaults to “-” for stdout", "-") - .option("-p, --precision ", "number of output digits after the decimal point") - .option("-n, --newline-delimited", "use newline-delimited JSON") - .option("-r, --require <[name=]module>", "require a module", requires, {d3: d3, d: undefined, i: -1}) - .parse(process.argv); - -if (commander.args.length < 1) { - console.error(); - console.error(" error: missing projection"); - console.error(); - process.exit(1); -} else if (commander.args.length > 2) { - console.error(); - console.error(" error: multiple input files"); - console.error(); - process.exit(1); -} else if (commander.args.length === 1) { - commander.args.push("-"); -} - -var sandbox = commander.require, - context = new vm.createContext(sandbox), - projection = new vm.Script("(" + commander.args[0] + ")"), - reader = read(commander.args[1], commander.newlineDelimited, project).then(end).catch(abort), - writer = write(commander.out); - -function project(d, i) { - sandbox.d = d, sandbox.i = i; - d = d3.geoProject(d, projection.runInContext(context)); - if (commander.precision != null) d = d3.geoQuantize(d, commander.precision); - return writer.write(JSON.stringify(d) + "\n"); -} - -function end() { - return writer.end(); -} - -function abort(error) { - console.error(error.stack); -} diff --git a/node_modules/d3-geo-projection/bin/geoquantize b/node_modules/d3-geo-projection/bin/geoquantize deleted file mode 100755 index b472cb6..0000000 --- a/node_modules/d3-geo-projection/bin/geoquantize +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env node - -var commander = require("commander"), - d3 = Object.assign({}, require("d3-geo"), require("../")), - read = require("./read"), - write = require("./write"); - -commander - .version(require("../package.json").version) - .usage("[options] [file]") - .description("Quantize GeoJSON.") - .option("-o, --out ", "output file name; defaults to “-” for stdout", "-") - .option("-p, --precision ", "number of output digits after the decimal point") - .option("-n, --newline-delimited", "use newline-delimited JSON") - .parse(process.argv); - -if (commander.args.length > 1) { - console.error(); - console.error(" error: multiple input files"); - console.error(); - process.exit(1); -} else if (commander.args.length === 0) { - commander.args.push("-"); -} - -var reader = read(commander.args[0], commander.newlineDelimited, quantize).then(end).catch(abort), - writer = write(commander.out); - -function quantize(d, i) { - if (commander.precision != null) d = d3.geoQuantize(d, commander.precision); - return writer.write(JSON.stringify(d) + "\n"); -} - -function end() { - return writer.end(); -} - -function abort(error) { - console.error(error.stack); -} diff --git a/node_modules/d3-geo-projection/bin/geostitch b/node_modules/d3-geo-projection/bin/geostitch deleted file mode 100755 index 7307b8a..0000000 --- a/node_modules/d3-geo-projection/bin/geostitch +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env node - -var commander = require("commander"), - d3 = require("../"), - read = require("./read"), - write = require("./write"); - -commander - .version(require("../package.json").version) - .usage("[options] [file]") - .description("Stitch equirectangular GeoJSON in degrees, removing antimeridian and polar cuts.") - .option("-o, --out ", "output file name; defaults to “-” for stdout", "-") - .option("-n, --newline-delimited", "use newline-delimited JSON") - .parse(process.argv); - -if (commander.args.length === 0) commander.args[0] = "-"; -else if (commander.args.length !== 1) { - console.error(); - console.error(" error: multiple input files"); - console.error(); - process.exit(1); -} - -var reader = read(commander.args[0], commander.newlineDelimited, stitch).then(end).catch(abort), - writer = write(commander.out); - -function stitch(d) { - return writer.write(JSON.stringify(d3.geoStitch(d)) + "\n"); -} - -function end() { - return writer.end(); -} - -function abort(error) { - console.error(error.stack); -} diff --git a/node_modules/d3-geo-projection/bin/read.js b/node_modules/d3-geo-projection/bin/read.js deleted file mode 100644 index a413e93..0000000 --- a/node_modules/d3-geo-projection/bin/read.js +++ /dev/null @@ -1,39 +0,0 @@ -var fs = require("fs"), - readline = require("readline"); - -module.exports = function(file, newlineDelimited, callback) { - var index = -1, - input = file === "-" ? process.stdin : fs.createReadStream(file); - - function readObject() { - return new Promise(function(resolve, reject) { - var data = []; - input - .on("data", function(d) { data.push(d); }) - .on("end", function() { resolve(JSON.parse(Buffer.concat(data))); }) - .on("error", reject); - }); - } - - function readNewlineDelimitedObjects() { - return new Promise(function(resolve, reject) { - var queue = Promise.resolve(); - readline.createInterface({ - input: input, - output: null - }).on("line", function(line) { - queue = queue.then(function() { return callbackObject(JSON.parse(line)); }); - }).on("close", function() { - queue.then(function() { resolve(); }, reject); - }).on("error", reject); - }); - } - - function callbackObject(object) { - return callback(object, ++index); - } - - return newlineDelimited - ? readNewlineDelimitedObjects() - : readObject().then(callbackObject); -}; diff --git a/node_modules/d3-geo-projection/bin/requires.js b/node_modules/d3-geo-projection/bin/requires.js deleted file mode 100644 index 0ad293c..0000000 --- a/node_modules/d3-geo-projection/bin/requires.js +++ /dev/null @@ -1,10 +0,0 @@ -var resolve = require("./resolve"); - -module.exports = function(module, sandbox) { - var i = module.indexOf("="), name = module; - if (i >= 0) name = module.slice(0, i), module = module.slice(i + 1); - module = require(resolve(module)); - if (sandbox[name]) Object.assign(sandbox[name], module); - else sandbox[name] = module; - return sandbox; -}; diff --git a/node_modules/d3-geo-projection/bin/resolve.js b/node_modules/d3-geo-projection/bin/resolve.js deleted file mode 100644 index 97ad316..0000000 --- a/node_modules/d3-geo-projection/bin/resolve.js +++ /dev/null @@ -1,16 +0,0 @@ -var child_process = require("child_process"), - resolve = require("resolve"), - options = {basedir: process.cwd(), paths: []}; - -module.exports = function(module) { - try { - return resolve.sync(module, options); // Attempt fast local resolve first. - } catch (error) { - if (!options.paths.length) { - options.paths.push(child_process.execSync("npm root -g").toString().trim()); - return resolve.sync(module, options); - } else { - throw error; - } - } -}; diff --git a/node_modules/d3-geo-projection/bin/write.js b/node_modules/d3-geo-projection/bin/write.js deleted file mode 100644 index be719c6..0000000 --- a/node_modules/d3-geo-projection/bin/write.js +++ /dev/null @@ -1,35 +0,0 @@ -var fs = require("fs"); - -function handleEpipe(error) { - if (error.code === "EPIPE" || error.errno === "EPIPE") { - process.exit(0); - } -} - -module.exports = function(file) { - var output = (file === "-" ? process.stdout : fs.createWriteStream(file)).on("error", handleEpipe), - queue = Promise.resolve(); - return { - write: function(data) { - return queue = queue.then(function() { - return new Promise(function(resolve, reject) { - output.write(data, function(error) { - if (error) reject(error); - else resolve(); - }); - }); - }); - }, - end: function() { - if (output === process.stdout) return queue; - return queue = queue.then(function() { - return new Promise(function(resolve, reject) { - output.end(function(error) { - if (error) reject(error); - else resolve(); - }); - }); - }); - } - }; -}; diff --git a/node_modules/d3-geo-projection/dist/d3-geo-projection.js b/node_modules/d3-geo-projection/dist/d3-geo-projection.js deleted file mode 100644 index 65cf409..0000000 --- a/node_modules/d3-geo-projection/dist/d3-geo-projection.js +++ /dev/null @@ -1,5007 +0,0 @@ -// https://d3js.org/d3-geo-projection/ v2.9.0 Copyright 2020 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-geo'), require('d3-array')) : -typeof define === 'function' && define.amd ? define(['exports', 'd3-geo', 'd3-array'], factory) : -(factory((global.d3 = global.d3 || {}),global.d3,global.d3)); -}(this, (function (exports,d3Geo,d3Array) { 'use strict'; - -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var cos = Math.cos; -var exp = Math.exp; -var floor = Math.floor; -var log = Math.log; -var max = Math.max; -var min = Math.min; -var pow = Math.pow; -var round = Math.round; -var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; -var sin = Math.sin; -var tan = Math.tan; - -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var sqrt1_2 = Math.SQRT1_2; -var sqrt2 = sqrt(2); -var sqrtPi = sqrt(pi); -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; - -function sinci(x) { - return x ? x / Math.sin(x) : 1; -} - -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} - -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} - -function sqrt(x) { - return x > 0 ? Math.sqrt(x) : 0; -} - -function tanh(x) { - x = exp(2 * x); - return (x - 1) / (x + 1); -} - -function sinh(x) { - return (exp(x) - exp(-x)) / 2; -} - -function cosh(x) { - return (exp(x) + exp(-x)) / 2; -} - -function arsinh(x) { - return log(x + sqrt(x * x + 1)); -} - -function arcosh(x) { - return log(x + sqrt(x * x - 1)); -} - -function airyRaw(beta) { - var tanBeta_2 = tan(beta / 2), - b = 2 * log(cos(beta / 2)) / (tanBeta_2 * tanBeta_2); - - function forward(x, y) { - var cosx = cos(x), - cosy = cos(y), - siny = sin(y), - cosz = cosy * cosx, - k = -((1 - cosz ? log((1 + cosz) / 2) / (1 - cosz) : -0.5) + b / (1 + cosz)); - return [k * cosy * sin(x), k * siny]; - } - - forward.invert = function(x, y) { - var r = sqrt(x * x + y * y), - z = -beta / 2, - i = 50, delta; - if (!r) return [0, 0]; - do { - var z_2 = z / 2, - cosz_2 = cos(z_2), - sinz_2 = sin(z_2), - tanz_2 = sinz_2 / cosz_2, - lnsecz_2 = -log(abs(cosz_2)); - z -= delta = (2 / tanz_2 * lnsecz_2 - b * tanz_2 - r) / (-lnsecz_2 / (sinz_2 * sinz_2) + 1 - b / (2 * cosz_2 * cosz_2)) * (cosz_2 < 0 ? 0.7 : 1); - } while (abs(delta) > epsilon && --i > 0); - var sinz = sin(z); - return [atan2(x * sinz, r * cos(z)), asin(y * sinz / r)]; - }; - - return forward; -} - -function airy() { - var beta = halfPi, - m = d3Geo.geoProjectionMutator(airyRaw), - p = m(beta); - - p.radius = function(_) { - return arguments.length ? m(beta = _ * radians) : beta * degrees; - }; - - return p - .scale(179.976) - .clipAngle(147); -} - -function aitoffRaw(x, y) { - var cosy = cos(y), sincia = sinci(acos(cosy * cos(x /= 2))); - return [2 * cosy * sin(x) * sincia, sin(y) * sincia]; -} - -// Abort if [x, y] is not within an ellipse centered at [0, 0] with -// semi-major axis pi and semi-minor axis pi/2. -aitoffRaw.invert = function(x, y) { - if (x * x + 4 * y * y > pi * pi + epsilon) return; - var x1 = x, y1 = y, i = 25; - do { - var sinx = sin(x1), - sinx_2 = sin(x1 / 2), - cosx_2 = cos(x1 / 2), - siny = sin(y1), - cosy = cos(y1), - sin_2y = sin(2 * y1), - sin2y = siny * siny, - cos2y = cosy * cosy, - sin2x_2 = sinx_2 * sinx_2, - c = 1 - cos2y * cosx_2 * cosx_2, - e = c ? acos(cosy * cosx_2) * sqrt(f = 1 / c) : f = 0, - f, - fx = 2 * e * cosy * sinx_2 - x, - fy = e * siny - y, - dxdx = f * (cos2y * sin2x_2 + e * cosy * cosx_2 * sin2y), - dxdy = f * (0.5 * sinx * sin_2y - e * 2 * siny * sinx_2), - dydx = f * 0.25 * (sin_2y * sinx_2 - e * siny * cos2y * sinx), - dydy = f * (sin2y * cosx_2 + e * sin2x_2 * cosy), - z = dxdy * dydx - dydy * dxdx; - if (!z) break; - var dx = (fy * dxdy - fx * dydy) / z, - dy = (fx * dydx - fy * dxdx) / z; - x1 -= dx, y1 -= dy; - } while ((abs(dx) > epsilon || abs(dy) > epsilon) && --i > 0); - return [x1, y1]; -}; - -function aitoff() { - return d3Geo.geoProjection(aitoffRaw) - .scale(152.63); -} - -function armadilloRaw(phi0) { - var sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0), - sPhi0 = phi0 >= 0 ? 1 : -1, - tanPhi0 = tan(sPhi0 * phi0), - k = (1 + sinPhi0 - cosPhi0) / 2; - - function forward(lambda, phi) { - var cosPhi = cos(phi), - cosLambda = cos(lambda /= 2); - return [ - (1 + cosPhi) * sin(lambda), - (sPhi0 * phi > -atan2(cosLambda, tanPhi0) - 1e-3 ? 0 : -sPhi0 * 10) + k + sin(phi) * cosPhi0 - (1 + cosPhi) * sinPhi0 * cosLambda // TODO D3 core should allow null or [NaN, NaN] to be returned. - ]; - } - - forward.invert = function(x, y) { - var lambda = 0, - phi = 0, - i = 50; - do { - var cosLambda = cos(lambda), - sinLambda = sin(lambda), - cosPhi = cos(phi), - sinPhi = sin(phi), - A = 1 + cosPhi, - fx = A * sinLambda - x, - fy = k + sinPhi * cosPhi0 - A * sinPhi0 * cosLambda - y, - dxdLambda = A * cosLambda / 2, - dxdPhi = -sinLambda * sinPhi, - dydLambda = sinPhi0 * A * sinLambda / 2, - dydPhi = cosPhi0 * cosPhi + sinPhi0 * cosLambda * sinPhi, - denominator = dxdPhi * dydLambda - dydPhi * dxdLambda, - dLambda = (fy * dxdPhi - fx * dydPhi) / denominator / 2, - dPhi = (fx * dydLambda - fy * dxdLambda) / denominator; - if (abs(dPhi) > 2) dPhi /= 2; - lambda -= dLambda, phi -= dPhi; - } while ((abs(dLambda) > epsilon || abs(dPhi) > epsilon) && --i > 0); - return sPhi0 * phi > -atan2(cos(lambda), tanPhi0) - 1e-3 ? [lambda * 2, phi] : null; - }; - - return forward; -} - -function armadillo() { - var phi0 = 20 * radians, - sPhi0 = phi0 >= 0 ? 1 : -1, - tanPhi0 = tan(sPhi0 * phi0), - m = d3Geo.geoProjectionMutator(armadilloRaw), - p = m(phi0), - stream_ = p.stream; - - p.parallel = function(_) { - if (!arguments.length) return phi0 * degrees; - tanPhi0 = tan((sPhi0 = (phi0 = _ * radians) >= 0 ? 1 : -1) * phi0); - return m(phi0); - }; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = stream_(stream), - sphereStream = (p.rotate([0, 0]), stream_(stream)), - precision = p.precision(); - p.rotate(rotate); - rotateStream.sphere = function() { - sphereStream.polygonStart(), sphereStream.lineStart(); - for (var lambda = sPhi0 * -180; sPhi0 * lambda < 180; lambda += sPhi0 * 90) - sphereStream.point(lambda, sPhi0 * 90); - if (phi0) while (sPhi0 * (lambda -= 3 * sPhi0 * precision) >= -180) { - sphereStream.point(lambda, sPhi0 * -atan2(cos(lambda * radians / 2), tanPhi0) * degrees); - } - sphereStream.lineEnd(), sphereStream.polygonEnd(); - }; - return rotateStream; - }; - - return p - .scale(218.695) - .center([0, 28.0974]); -} - -function augustRaw(lambda, phi) { - var tanPhi = tan(phi / 2), - k = sqrt(1 - tanPhi * tanPhi), - c = 1 + k * cos(lambda /= 2), - x = sin(lambda) * k / c, - y = tanPhi / c, - x2 = x * x, - y2 = y * y; - return [ - 4 / 3 * x * (3 + x2 - 3 * y2), - 4 / 3 * y * (3 + 3 * x2 - y2) - ]; -} - -augustRaw.invert = function(x, y) { - x *= 3 / 8, y *= 3 / 8; - if (!x && abs(y) > 1) return null; - var x2 = x * x, - y2 = y * y, - s = 1 + x2 + y2, - sin3Eta = sqrt((s - sqrt(s * s - 4 * y * y)) / 2), - eta = asin(sin3Eta) / 3, - xi = sin3Eta ? arcosh(abs(y / sin3Eta)) / 3 : arsinh(abs(x)) / 3, - cosEta = cos(eta), - coshXi = cosh(xi), - d = coshXi * coshXi - cosEta * cosEta; - return [ - sign(x) * 2 * atan2(sinh(xi) * cosEta, 0.25 - d), - sign(y) * 2 * atan2(coshXi * sin(eta), 0.25 + d) - ]; -}; - -function august() { - return d3Geo.geoProjection(augustRaw) - .scale(66.1603); -} - -var sqrt8 = sqrt(8), - phi0 = log(1 + sqrt2); - -function bakerRaw(lambda, phi) { - var phi0 = abs(phi); - return phi0 < quarterPi - ? [lambda, log(tan(quarterPi + phi / 2))] - : [lambda * cos(phi0) * (2 * sqrt2 - 1 / sin(phi0)), sign(phi) * (2 * sqrt2 * (phi0 - quarterPi) - log(tan(phi0 / 2)))]; -} - -bakerRaw.invert = function(x, y) { - if ((y0 = abs(y)) < phi0) return [x, 2 * atan(exp(y)) - halfPi]; - var phi = quarterPi, i = 25, delta, y0; - do { - var cosPhi_2 = cos(phi / 2), tanPhi_2 = tan(phi / 2); - phi -= delta = (sqrt8 * (phi - quarterPi) - log(tanPhi_2) - y0) / (sqrt8 - cosPhi_2 * cosPhi_2 / (2 * tanPhi_2)); - } while (abs(delta) > epsilon2 && --i > 0); - return [x / (cos(phi) * (sqrt8 - 1 / sin(phi))), sign(y) * phi]; -}; - -function baker() { - return d3Geo.geoProjection(bakerRaw) - .scale(112.314); -} - -function berghausRaw(lobes) { - var k = 2 * pi / lobes; - - function forward(lambda, phi) { - var p = d3Geo.geoAzimuthalEquidistantRaw(lambda, phi); - if (abs(lambda) > halfPi) { // back hemisphere - var theta = atan2(p[1], p[0]), - r = sqrt(p[0] * p[0] + p[1] * p[1]), - theta0 = k * round((theta - halfPi) / k) + halfPi, - alpha = atan2(sin(theta -= theta0), 2 - cos(theta)); // angle relative to lobe end - theta = theta0 + asin(pi / r * sin(alpha)) - alpha; - p[0] = r * cos(theta); - p[1] = r * sin(theta); - } - return p; - } - - forward.invert = function(x, y) { - var r = sqrt(x * x + y * y); - if (r > halfPi) { - var theta = atan2(y, x), - theta0 = k * round((theta - halfPi) / k) + halfPi, - s = theta > theta0 ? -1 : 1, - A = r * cos(theta0 - theta), - cotAlpha = 1 / tan(s * acos((A - pi) / sqrt(pi * (pi - 2 * A) + r * r))); - theta = theta0 + 2 * atan((cotAlpha + s * sqrt(cotAlpha * cotAlpha - 3)) / 3); - x = r * cos(theta), y = r * sin(theta); - } - return d3Geo.geoAzimuthalEquidistantRaw.invert(x, y); - }; - - return forward; -} - -function berghaus() { - var lobes = 5, - m = d3Geo.geoProjectionMutator(berghausRaw), - p = m(lobes), - projectionStream = p.stream, - epsilon$$1 = 1e-2, - cr = -cos(epsilon$$1 * radians), - sr = sin(epsilon$$1 * radians); - - p.lobes = function(_) { - return arguments.length ? m(lobes = +_) : lobes; - }; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = projectionStream(stream), - sphereStream = (p.rotate([0, 0]), projectionStream(stream)); - p.rotate(rotate); - rotateStream.sphere = function() { - sphereStream.polygonStart(), sphereStream.lineStart(); - for (var i = 0, delta = 360 / lobes, delta0 = 2 * pi / lobes, phi = 90 - 180 / lobes, phi0 = halfPi; i < lobes; ++i, phi -= delta, phi0 -= delta0) { - sphereStream.point(atan2(sr * cos(phi0), cr) * degrees, asin(sr * sin(phi0)) * degrees); - if (phi < -90) { - sphereStream.point(-90, -180 - phi - epsilon$$1); - sphereStream.point(-90, -180 - phi + epsilon$$1); - } else { - sphereStream.point(90, phi + epsilon$$1); - sphereStream.point(90, phi - epsilon$$1); - } - } - sphereStream.lineEnd(), sphereStream.polygonEnd(); - }; - return rotateStream; - }; - - return p - .scale(87.8076) - .center([0, 17.1875]) - .clipAngle(180 - 1e-3); -} - -function hammerRaw(A, B) { - if (arguments.length < 2) B = A; - if (B === 1) return d3Geo.geoAzimuthalEqualAreaRaw; - if (B === Infinity) return hammerQuarticAuthalicRaw; - - function forward(lambda, phi) { - var coordinates = d3Geo.geoAzimuthalEqualAreaRaw(lambda / B, phi); - coordinates[0] *= A; - return coordinates; - } - - forward.invert = function(x, y) { - var coordinates = d3Geo.geoAzimuthalEqualAreaRaw.invert(x / A, y); - coordinates[0] *= B; - return coordinates; - }; - - return forward; -} - -function hammerQuarticAuthalicRaw(lambda, phi) { - return [ - lambda * cos(phi) / cos(phi /= 2), - 2 * sin(phi) - ]; -} - -hammerQuarticAuthalicRaw.invert = function(x, y) { - var phi = 2 * asin(y / 2); - return [ - x * cos(phi / 2) / cos(phi), - phi - ]; -}; - -function hammer() { - var B = 2, - m = d3Geo.geoProjectionMutator(hammerRaw), - p = m(B); - - p.coefficient = function(_) { - if (!arguments.length) return B; - return m(B = +_); - }; - - return p - .scale(169.529); -} - -// Approximate Newton-Raphson -// Solve f(x) = y, start from x -function solve(f, y, x) { - var steps = 100, delta, f0, f1; - x = x === undefined ? 0 : +x; - y = +y; - do { - f0 = f(x); - f1 = f(x + epsilon); - if (f0 === f1) f1 = f0 + epsilon; - x -= delta = (-1 * epsilon * (f0 - y)) / (f0 - f1); - } while (steps-- > 0 && abs(delta) > epsilon); - return steps < 0 ? NaN : x; -} - -// Approximate Newton-Raphson in 2D -// Solve f(a,b) = [x,y] -function solve2d(f, MAX_ITERATIONS, eps) { - if (MAX_ITERATIONS === undefined) MAX_ITERATIONS = 40; - if (eps === undefined) eps = epsilon2; - return function(x, y, a, b) { - var err2, da, db; - a = a === undefined ? 0 : +a; - b = b === undefined ? 0 : +b; - for (var i = 0; i < MAX_ITERATIONS; i++) { - var p = f(a, b), - // diffs - tx = p[0] - x, - ty = p[1] - y; - if (abs(tx) < eps && abs(ty) < eps) break; // we're there! - - // backtrack if we overshot - var h = tx * tx + ty * ty; - if (h > err2) { - a -= da /= 2; - b -= db /= 2; - continue; - } - err2 = h; - - // partial derivatives - var ea = (a > 0 ? -1 : 1) * eps, - eb = (b > 0 ? -1 : 1) * eps, - pa = f(a + ea, b), - pb = f(a, b + eb), - dxa = (pa[0] - p[0]) / ea, - dya = (pa[1] - p[1]) / ea, - dxb = (pb[0] - p[0]) / eb, - dyb = (pb[1] - p[1]) / eb, - // determinant - D = dyb * dxa - dya * dxb, - // newton step — or half-step for small D - l = (abs(D) < 0.5 ? 0.5 : 1) / D; - da = (ty * dxb - tx * dyb) * l; - db = (tx * dya - ty * dxa) * l; - a += da; - b += db; - if (abs(da) < eps && abs(db) < eps) break; // we're crawling - } - return [a, b]; - }; -} - -// Bertin 1953 as a modified Briesemeister -// https://bl.ocks.org/Fil/5b9ee9636dfb6ffa53443c9006beb642 -function bertin1953Raw() { - var hammer$$1 = hammerRaw(1.68, 2), - fu = 1.4, k = 12; - - function forward(lambda, phi) { - - if (lambda + phi < -fu) { - var u = (lambda - phi + 1.6) * (lambda + phi + fu) / 8; - lambda += u; - phi -= 0.8 * u * sin(phi + pi / 2); - } - - var r = hammer$$1(lambda, phi); - - var d = (1 - cos(lambda * phi)) / k; - - if (r[1] < 0) { - r[0] *= 1 + d; - } - if (r[1] > 0) { - r[1] *= 1 + d / 1.5 * r[0] * r[0]; - } - - return r; - } - - forward.invert = solve2d(forward); - return forward; -} - -function bertin() { - // this projection should not be rotated - return d3Geo.geoProjection(bertin1953Raw()) - .rotate([-16.5, -42]) - .scale(176.57) - .center([7.93, 0.09]); -} - -function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * sin(phi), i = 30, delta; - do phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi)); - while (abs(delta) > epsilon && --i > 0); - return phi / 2; -} - -function mollweideBromleyRaw(cx, cy, cp) { - - function forward(lambda, phi) { - return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)]; - } - - forward.invert = function(x, y) { - return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)]; - }; - - return forward; -} - -var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); - -function mollweide() { - return d3Geo.geoProjection(mollweideRaw) - .scale(169.529); -} - -var k = 2.00276, - w = 1.11072; - -function boggsRaw(lambda, phi) { - var theta = mollweideBromleyTheta(pi, phi); - return [k * lambda / (1 / cos(phi) + w / cos(theta)), (phi + sqrt2 * sin(theta)) / k]; -} - -boggsRaw.invert = function(x, y) { - var ky = k * y, theta = y < 0 ? -quarterPi : quarterPi, i = 25, delta, phi; - do { - phi = ky - sqrt2 * sin(theta); - theta -= delta = (sin(2 * theta) + 2 * theta - pi * sin(phi)) / (2 * cos(2 * theta) + 2 + pi * cos(phi) * sqrt2 * cos(theta)); - } while (abs(delta) > epsilon && --i > 0); - phi = ky - sqrt2 * sin(theta); - return [x * (1 / cos(phi) + w / cos(theta)) / k, phi]; -}; - -function boggs() { - return d3Geo.geoProjection(boggsRaw) - .scale(160.857); -} - -function parallel1(projectAt) { - var phi0 = 0, - m = d3Geo.geoProjectionMutator(projectAt), - p = m(phi0); - - p.parallel = function(_) { - return arguments.length ? m(phi0 = _ * radians) : phi0 * degrees; - }; - - return p; -} - -function sinusoidalRaw(lambda, phi) { - return [lambda * cos(phi), phi]; -} - -sinusoidalRaw.invert = function(x, y) { - return [x / cos(y), y]; -}; - -function sinusoidal() { - return d3Geo.geoProjection(sinusoidalRaw) - .scale(152.63); -} - -function bonneRaw(phi0) { - if (!phi0) return sinusoidalRaw; - var cotPhi0 = 1 / tan(phi0); - - function forward(lambda, phi) { - var rho = cotPhi0 + phi0 - phi, - e = rho ? lambda * cos(phi) / rho : rho; - return [rho * sin(e), cotPhi0 - rho * cos(e)]; - } - - forward.invert = function(x, y) { - var rho = sqrt(x * x + (y = cotPhi0 - y) * y), - phi = cotPhi0 + phi0 - rho; - return [rho / cos(phi) * atan2(x, y), phi]; - }; - - return forward; -} - -function bonne() { - return parallel1(bonneRaw) - .scale(123.082) - .center([0, 26.1441]) - .parallel(45); -} - -function bottomleyRaw(sinPsi) { - - function forward(lambda, phi) { - var rho = halfPi - phi, - eta = rho ? lambda * sinPsi * sin(rho) / rho : rho; - return [rho * sin(eta) / sinPsi, halfPi - rho * cos(eta)]; - } - - forward.invert = function(x, y) { - var x1 = x * sinPsi, - y1 = halfPi - y, - rho = sqrt(x1 * x1 + y1 * y1), - eta = atan2(x1, y1); - return [(rho ? rho / sin(rho) : 1) * eta / sinPsi, halfPi - rho]; - }; - - return forward; -} - -function bottomley() { - var sinPsi = 0.5, - m = d3Geo.geoProjectionMutator(bottomleyRaw), - p = m(sinPsi); - - p.fraction = function(_) { - return arguments.length ? m(sinPsi = +_) : sinPsi; - }; - - return p - .scale(158.837); -} - -var bromleyRaw = mollweideBromleyRaw(1, 4 / pi, pi); - -function bromley() { - return d3Geo.geoProjection(bromleyRaw) - .scale(152.63); -} - -// Azimuthal distance. -function distance(dPhi, c1, s1, c2, s2, dLambda) { - var cosdLambda = cos(dLambda), r; - if (abs(dPhi) > 1 || abs(dLambda) > 1) { - r = acos(s1 * s2 + c1 * c2 * cosdLambda); - } else { - var sindPhi = sin(dPhi / 2), sindLambda = sin(dLambda / 2); - r = 2 * asin(sqrt(sindPhi * sindPhi + c1 * c2 * sindLambda * sindLambda)); - } - return abs(r) > epsilon ? [r, atan2(c2 * sin(dLambda), c1 * s2 - s1 * c2 * cosdLambda)] : [0, 0]; -} - -// Angle opposite a, and contained between sides of lengths b and c. -function angle(b, c, a) { - return acos((b * b + c * c - a * a) / (2 * b * c)); -} - -// Normalize longitude. -function longitude(lambda) { - return lambda - 2 * pi * floor((lambda + pi) / (2 * pi)); -} - -function chamberlinRaw(p0, p1, p2) { - var points = [ - [p0[0], p0[1], sin(p0[1]), cos(p0[1])], - [p1[0], p1[1], sin(p1[1]), cos(p1[1])], - [p2[0], p2[1], sin(p2[1]), cos(p2[1])] - ]; - - for (var a = points[2], b, i = 0; i < 3; ++i, a = b) { - b = points[i]; - a.v = distance(b[1] - a[1], a[3], a[2], b[3], b[2], b[0] - a[0]); - a.point = [0, 0]; - } - - var beta0 = angle(points[0].v[0], points[2].v[0], points[1].v[0]), - beta1 = angle(points[0].v[0], points[1].v[0], points[2].v[0]), - beta2 = pi - beta0; - - points[2].point[1] = 0; - points[0].point[0] = -(points[1].point[0] = points[0].v[0] / 2); - - var mean = [ - points[2].point[0] = points[0].point[0] + points[2].v[0] * cos(beta0), - 2 * (points[0].point[1] = points[1].point[1] = points[2].v[0] * sin(beta0)) - ]; - - function forward(lambda, phi) { - var sinPhi = sin(phi), - cosPhi = cos(phi), - v = new Array(3), i; - - // Compute distance and azimuth from control points. - for (i = 0; i < 3; ++i) { - var p = points[i]; - v[i] = distance(phi - p[1], p[3], p[2], cosPhi, sinPhi, lambda - p[0]); - if (!v[i][0]) return p.point; - v[i][1] = longitude(v[i][1] - p.v[1]); - } - - // Arithmetic mean of interception points. - var point = mean.slice(); - for (i = 0; i < 3; ++i) { - var j = i == 2 ? 0 : i + 1; - var a = angle(points[i].v[0], v[i][0], v[j][0]); - if (v[i][1] < 0) a = -a; - - if (!i) { - point[0] += v[i][0] * cos(a); - point[1] -= v[i][0] * sin(a); - } else if (i == 1) { - a = beta1 - a; - point[0] -= v[i][0] * cos(a); - point[1] -= v[i][0] * sin(a); - } else { - a = beta2 - a; - point[0] += v[i][0] * cos(a); - point[1] += v[i][0] * sin(a); - } - } - - point[0] /= 3, point[1] /= 3; - return point; - } - - return forward; -} - -function pointRadians(p) { - return p[0] *= radians, p[1] *= radians, p; -} - -function chamberlinAfrica() { - return chamberlin([0, 22], [45, 22], [22.5, -22]) - .scale(380) - .center([22.5, 2]); -} - -function chamberlin(p0, p1, p2) { // TODO order matters! - var c = d3Geo.geoCentroid({type: "MultiPoint", coordinates: [p0, p1, p2]}), - R = [-c[0], -c[1]], - r = d3Geo.geoRotation(R), - f = chamberlinRaw(pointRadians(r(p0)), pointRadians(r(p1)), pointRadians(r(p2))); - f.invert = solve2d(f); - var p = d3Geo.geoProjection(f).rotate(R), - center = p.center; - - delete p.rotate; - - p.center = function(_) { - return arguments.length ? center(r(_)) : r.invert(center()); - }; - - return p - .clipAngle(90); -} - -function collignonRaw(lambda, phi) { - var alpha = sqrt(1 - sin(phi)); - return [(2 / sqrtPi) * lambda * alpha, sqrtPi * (1 - alpha)]; -} - -collignonRaw.invert = function(x, y) { - var lambda = (lambda = y / sqrtPi - 1) * lambda; - return [lambda > 0 ? x * sqrt(pi / lambda) / 2 : 0, asin(1 - lambda)]; -}; - -function collignon() { - return d3Geo.geoProjection(collignonRaw) - .scale(95.6464) - .center([0, 30]); -} - -function craigRaw(phi0) { - var tanPhi0 = tan(phi0); - - function forward(lambda, phi) { - return [lambda, (lambda ? lambda / sin(lambda) : 1) * (sin(phi) * cos(lambda) - tanPhi0 * cos(phi))]; - } - - forward.invert = tanPhi0 ? function(x, y) { - if (x) y *= sin(x) / x; - var cosLambda = cos(x); - return [x, 2 * atan2(sqrt(cosLambda * cosLambda + tanPhi0 * tanPhi0 - y * y) - cosLambda, tanPhi0 - y)]; - } : function(x, y) { - return [x, asin(x ? y * tan(x) / x : y)]; - }; - - return forward; -} - -function craig() { - return parallel1(craigRaw) - .scale(249.828) - .clipAngle(90); -} - -var sqrt3 = sqrt(3); - -function crasterRaw(lambda, phi) { - return [sqrt3 * lambda * (2 * cos(2 * phi / 3) - 1) / sqrtPi, sqrt3 * sqrtPi * sin(phi / 3)]; -} - -crasterRaw.invert = function(x, y) { - var phi = 3 * asin(y / (sqrt3 * sqrtPi)); - return [sqrtPi * x / (sqrt3 * (2 * cos(2 * phi / 3) - 1)), phi]; -}; - -function craster() { - return d3Geo.geoProjection(crasterRaw) - .scale(156.19); -} - -function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = cos(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, sin(phi) / cosPhi0]; - } - - forward.invert = function(x, y) { - return [x / cosPhi0, asin(y * cosPhi0)]; - }; - - return forward; -} - -function cylindricalEqualArea() { - return parallel1(cylindricalEqualAreaRaw) - .parallel(38.58) // acos(sqrt(width / height / pi)) * radians - .scale(195.044); // width / (sqrt(width / height / pi) * 2 * pi) -} - -function cylindricalStereographicRaw(phi0) { - var cosPhi0 = cos(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, (1 + cosPhi0) * tan(phi / 2)]; - } - - forward.invert = function(x, y) { - return [x / cosPhi0, atan(y / (1 + cosPhi0)) * 2]; - }; - - return forward; -} - -function cylindricalStereographic() { - return parallel1(cylindricalStereographicRaw) - .scale(124.75); -} - -function eckert1Raw(lambda, phi) { - var alpha = sqrt(8 / (3 * pi)); - return [ - alpha * lambda * (1 - abs(phi) / pi), - alpha * phi - ]; -} - -eckert1Raw.invert = function(x, y) { - var alpha = sqrt(8 / (3 * pi)), - phi = y / alpha; - return [ - x / (alpha * (1 - abs(phi) / pi)), - phi - ]; -}; - -function eckert1() { - return d3Geo.geoProjection(eckert1Raw) - .scale(165.664); -} - -function eckert2Raw(lambda, phi) { - var alpha = sqrt(4 - 3 * sin(abs(phi))); - return [ - 2 / sqrt(6 * pi) * lambda * alpha, - sign(phi) * sqrt(2 * pi / 3) * (2 - alpha) - ]; -} - -eckert2Raw.invert = function(x, y) { - var alpha = 2 - abs(y) / sqrt(2 * pi / 3); - return [ - x * sqrt(6 * pi) / (2 * alpha), - sign(y) * asin((4 - alpha * alpha) / 3) - ]; -}; - -function eckert2() { - return d3Geo.geoProjection(eckert2Raw) - .scale(165.664); -} - -function eckert3Raw(lambda, phi) { - var k = sqrt(pi * (4 + pi)); - return [ - 2 / k * lambda * (1 + sqrt(1 - 4 * phi * phi / (pi * pi))), - 4 / k * phi - ]; -} - -eckert3Raw.invert = function(x, y) { - var k = sqrt(pi * (4 + pi)) / 2; - return [ - x * k / (1 + sqrt(1 - y * y * (4 + pi) / (4 * pi))), - y * k / 2 - ]; -}; - -function eckert3() { - return d3Geo.geoProjection(eckert3Raw) - .scale(180.739); -} - -function eckert4Raw(lambda, phi) { - var k = (2 + halfPi) * sin(phi); - phi /= 2; - for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; i++) { - var cosPhi = cos(phi); - phi -= delta = (phi + sin(phi) * (cosPhi + 2) - k) / (2 * cosPhi * (1 + cosPhi)); - } - return [ - 2 / sqrt(pi * (4 + pi)) * lambda * (1 + cos(phi)), - 2 * sqrt(pi / (4 + pi)) * sin(phi) - ]; -} - -eckert4Raw.invert = function(x, y) { - var A = y * sqrt((4 + pi) / pi) / 2, - k = asin(A), - c = cos(k); - return [ - x / (2 / sqrt(pi * (4 + pi)) * (1 + c)), - asin((k + A * (c + 2)) / (2 + halfPi)) - ]; -}; - -function eckert4() { - return d3Geo.geoProjection(eckert4Raw) - .scale(180.739); -} - -function eckert5Raw(lambda, phi) { - return [ - lambda * (1 + cos(phi)) / sqrt(2 + pi), - 2 * phi / sqrt(2 + pi) - ]; -} - -eckert5Raw.invert = function(x, y) { - var k = sqrt(2 + pi), - phi = y * k / 2; - return [ - k * x / (1 + cos(phi)), - phi - ]; -}; - -function eckert5() { - return d3Geo.geoProjection(eckert5Raw) - .scale(173.044); -} - -function eckert6Raw(lambda, phi) { - var k = (1 + halfPi) * sin(phi); - for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; i++) { - phi -= delta = (phi + sin(phi) - k) / (1 + cos(phi)); - } - k = sqrt(2 + pi); - return [ - lambda * (1 + cos(phi)) / k, - 2 * phi / k - ]; -} - -eckert6Raw.invert = function(x, y) { - var j = 1 + halfPi, - k = sqrt(j / 2); - return [ - x * 2 * k / (1 + cos(y *= k)), - asin((y + sin(y)) / j) - ]; -}; - -function eckert6() { - return d3Geo.geoProjection(eckert6Raw) - .scale(173.044); -} - -var eisenlohrK = 3 + 2 * sqrt2; - -function eisenlohrRaw(lambda, phi) { - var s0 = sin(lambda /= 2), - c0 = cos(lambda), - k = sqrt(cos(phi)), - c1 = cos(phi /= 2), - t = sin(phi) / (c1 + sqrt2 * c0 * k), - c = sqrt(2 / (1 + t * t)), - v = sqrt((sqrt2 * c1 + (c0 + s0) * k) / (sqrt2 * c1 + (c0 - s0) * k)); - return [ - eisenlohrK * (c * (v - 1 / v) - 2 * log(v)), - eisenlohrK * (c * t * (v + 1 / v) - 2 * atan(t)) - ]; -} - -eisenlohrRaw.invert = function(x, y) { - if (!(p = augustRaw.invert(x / 1.2, y * 1.065))) return null; - var lambda = p[0], phi = p[1], i = 20, p; - x /= eisenlohrK, y /= eisenlohrK; - do { - var _0 = lambda / 2, - _1 = phi / 2, - s0 = sin(_0), - c0 = cos(_0), - s1 = sin(_1), - c1 = cos(_1), - cos1 = cos(phi), - k = sqrt(cos1), - t = s1 / (c1 + sqrt2 * c0 * k), - t2 = t * t, - c = sqrt(2 / (1 + t2)), - v0 = (sqrt2 * c1 + (c0 + s0) * k), - v1 = (sqrt2 * c1 + (c0 - s0) * k), - v2 = v0 / v1, - v = sqrt(v2), - vm1v = v - 1 / v, - vp1v = v + 1 / v, - fx = c * vm1v - 2 * log(v) - x, - fy = c * t * vp1v - 2 * atan(t) - y, - deltatDeltaLambda = s1 && sqrt1_2 * k * s0 * t2 / s1, - deltatDeltaPhi = (sqrt2 * c0 * c1 + k) / (2 * (c1 + sqrt2 * c0 * k) * (c1 + sqrt2 * c0 * k) * k), - deltacDeltat = -0.5 * t * c * c * c, - deltacDeltaLambda = deltacDeltat * deltatDeltaLambda, - deltacDeltaPhi = deltacDeltat * deltatDeltaPhi, - A = (A = 2 * c1 + sqrt2 * k * (c0 - s0)) * A * v, - deltavDeltaLambda = (sqrt2 * c0 * c1 * k + cos1) / A, - deltavDeltaPhi = -(sqrt2 * s0 * s1) / (k * A), - deltaxDeltaLambda = vm1v * deltacDeltaLambda - 2 * deltavDeltaLambda / v + c * (deltavDeltaLambda + deltavDeltaLambda / v2), - deltaxDeltaPhi = vm1v * deltacDeltaPhi - 2 * deltavDeltaPhi / v + c * (deltavDeltaPhi + deltavDeltaPhi / v2), - deltayDeltaLambda = t * vp1v * deltacDeltaLambda - 2 * deltatDeltaLambda / (1 + t2) + c * vp1v * deltatDeltaLambda + c * t * (deltavDeltaLambda - deltavDeltaLambda / v2), - deltayDeltaPhi = t * vp1v * deltacDeltaPhi - 2 * deltatDeltaPhi / (1 + t2) + c * vp1v * deltatDeltaPhi + c * t * (deltavDeltaPhi - deltavDeltaPhi / v2), - denominator = deltaxDeltaPhi * deltayDeltaLambda - deltayDeltaPhi * deltaxDeltaLambda; - if (!denominator) break; - var deltaLambda = (fy * deltaxDeltaPhi - fx * deltayDeltaPhi) / denominator, - deltaPhi = (fx * deltayDeltaLambda - fy * deltaxDeltaLambda) / denominator; - lambda -= deltaLambda; - phi = max(-halfPi, min(halfPi, phi - deltaPhi)); - } while ((abs(deltaLambda) > epsilon || abs(deltaPhi) > epsilon) && --i > 0); - return abs(abs(phi) - halfPi) < epsilon ? [0, phi] : i && [lambda, phi]; -}; - -function eisenlohr() { - return d3Geo.geoProjection(eisenlohrRaw) - .scale(62.5271); -} - -var faheyK = cos(35 * radians); - -function faheyRaw(lambda, phi) { - var t = tan(phi / 2); - return [lambda * faheyK * sqrt(1 - t * t), (1 + faheyK) * t]; -} - -faheyRaw.invert = function(x, y) { - var t = y / (1 + faheyK); - return [x && x / (faheyK * sqrt(1 - t * t)), 2 * atan(t)]; -}; - -function fahey() { - return d3Geo.geoProjection(faheyRaw) - .scale(137.152); -} - -function foucautRaw(lambda, phi) { - var k = phi / 2, cosk = cos(k); - return [ 2 * lambda / sqrtPi * cos(phi) * cosk * cosk, sqrtPi * tan(k)]; -} - -foucautRaw.invert = function(x, y) { - var k = atan(y / sqrtPi), cosk = cos(k), phi = 2 * k; - return [x * sqrtPi / 2 / (cos(phi) * cosk * cosk), phi]; -}; - -function foucaut() { - return d3Geo.geoProjection(foucautRaw) - .scale(135.264); -} - -function foucautSinusoidalRaw(alpha) { - var beta = 1 - alpha, - equatorial = raw(pi, 0)[0] - raw(-pi, 0)[0], - polar = raw(0, halfPi)[1] - raw(0, -halfPi)[1], - ratio = sqrt(2 * polar / equatorial); - - function raw(lambda, phi) { - var cosphi = cos(phi), - sinphi = sin(phi); - return [ - cosphi / (beta + alpha * cosphi) * lambda, - beta * phi + alpha * sinphi - ]; - } - - function forward(lambda, phi) { - var p = raw(lambda, phi); - return [p[0] * ratio, p[1] / ratio]; - } - - function forwardMeridian(phi) { - return forward(0, phi)[1]; - } - - forward.invert = function(x, y) { - var phi = solve(forwardMeridian, y), - lambda = x / ratio * (alpha + beta / cos(phi)); - return [lambda, phi]; - }; - - return forward; -} - -function foucautSinusoidal() { - var alpha = 0.5, - m = d3Geo.geoProjectionMutator(foucautSinusoidalRaw), - p = m(alpha); - - p.alpha = function(_) { - return arguments.length ? m(alpha = +_) : alpha; - }; - - return p - .scale(168.725); -} - -function gilbertForward(point) { - return [point[0] / 2, asin(tan(point[1] / 2 * radians)) * degrees]; -} - -function gilbertInvert(point) { - return [point[0] * 2, 2 * atan(sin(point[1] * radians)) * degrees]; -} - -function gilbert(projectionType) { - if (projectionType == null) projectionType = d3Geo.geoOrthographic; - var projection = projectionType(), - equirectangular = d3Geo.geoEquirectangular().scale(degrees).precision(0).clipAngle(null).translate([0, 0]); // antimeridian cutting - - function gilbert(point) { - return projection(gilbertForward(point)); - } - - if (projection.invert) gilbert.invert = function(point) { - return gilbertInvert(projection.invert(point)); - }; - - gilbert.stream = function(stream) { - var s1 = projection.stream(stream), s0 = equirectangular.stream({ - point: function(lambda, phi) { s1.point(lambda / 2, asin(tan(-phi / 2 * radians)) * degrees); }, - lineStart: function() { s1.lineStart(); }, - lineEnd: function() { s1.lineEnd(); }, - polygonStart: function() { s1.polygonStart(); }, - polygonEnd: function() { s1.polygonEnd(); } - }); - s0.sphere = s1.sphere; - return s0; - }; - - function property(name) { - gilbert[name] = function() { - return arguments.length ? (projection[name].apply(projection, arguments), gilbert) : projection[name](); - }; - } - - gilbert.rotate = function(_) { - return arguments.length ? (equirectangular.rotate(_), gilbert) : equirectangular.rotate(); - }; - - gilbert.center = function(_) { - return arguments.length ? (projection.center(gilbertForward(_)), gilbert) : gilbertInvert(projection.center()); - }; - - property("angle"); - property("clipAngle"); - property("clipExtent"); - property("fitExtent"); - property("fitHeight"); - property("fitSize"); - property("fitWidth"); - property("scale"); - property("translate"); - property("precision"); - - return gilbert - .scale(249.5); -} - -function gingeryRaw(rho, n) { - var k = 2 * pi / n, - rho2 = rho * rho; - - function forward(lambda, phi) { - var p = d3Geo.geoAzimuthalEquidistantRaw(lambda, phi), - x = p[0], - y = p[1], - r2 = x * x + y * y; - - if (r2 > rho2) { - var r = sqrt(r2), - theta = atan2(y, x), - theta0 = k * round(theta / k), - alpha = theta - theta0, - rhoCosAlpha = rho * cos(alpha), - k_ = (rho * sin(alpha) - alpha * sin(rhoCosAlpha)) / (halfPi - rhoCosAlpha), - s_ = gingeryLength(alpha, k_), - e = (pi - rho) / gingeryIntegrate(s_, rhoCosAlpha, pi); - - x = r; - var i = 50, delta; - do { - x -= delta = (rho + gingeryIntegrate(s_, rhoCosAlpha, x) * e - r) / (s_(x) * e); - } while (abs(delta) > epsilon && --i > 0); - - y = alpha * sin(x); - if (x < halfPi) y -= k_ * (x - halfPi); - - var s = sin(theta0), - c = cos(theta0); - p[0] = x * c - y * s; - p[1] = x * s + y * c; - } - return p; - } - - forward.invert = function(x, y) { - var r2 = x * x + y * y; - if (r2 > rho2) { - var r = sqrt(r2), - theta = atan2(y, x), - theta0 = k * round(theta / k), - dTheta = theta - theta0; - - x = r * cos(dTheta); - y = r * sin(dTheta); - - var x_halfPi = x - halfPi, - sinx = sin(x), - alpha = y / sinx, - delta = x < halfPi ? Infinity : 0, - i = 10; - - while (true) { - var rhosinAlpha = rho * sin(alpha), - rhoCosAlpha = rho * cos(alpha), - sinRhoCosAlpha = sin(rhoCosAlpha), - halfPi_RhoCosAlpha = halfPi - rhoCosAlpha, - k_ = (rhosinAlpha - alpha * sinRhoCosAlpha) / halfPi_RhoCosAlpha, - s_ = gingeryLength(alpha, k_); - - if (abs(delta) < epsilon2 || !--i) break; - - alpha -= delta = (alpha * sinx - k_ * x_halfPi - y) / ( - sinx - x_halfPi * 2 * ( - halfPi_RhoCosAlpha * (rhoCosAlpha + alpha * rhosinAlpha * cos(rhoCosAlpha) - sinRhoCosAlpha) - - rhosinAlpha * (rhosinAlpha - alpha * sinRhoCosAlpha) - ) / (halfPi_RhoCosAlpha * halfPi_RhoCosAlpha)); - } - r = rho + gingeryIntegrate(s_, rhoCosAlpha, x) * (pi - rho) / gingeryIntegrate(s_, rhoCosAlpha, pi); - theta = theta0 + alpha; - x = r * cos(theta); - y = r * sin(theta); - } - return d3Geo.geoAzimuthalEquidistantRaw.invert(x, y); - }; - - return forward; -} - -function gingeryLength(alpha, k) { - return function(x) { - var y_ = alpha * cos(x); - if (x < halfPi) y_ -= k; - return sqrt(1 + y_ * y_); - }; -} - -// Numerical integration: trapezoidal rule. -function gingeryIntegrate(f, a, b) { - var n = 50, - h = (b - a) / n, - s = f(a) + f(b); - for (var i = 1, x = a; i < n; ++i) s += 2 * f(x += h); - return s * 0.5 * h; -} - -function gingery() { - var n = 6, - rho = 30 * radians, - cRho = cos(rho), - sRho = sin(rho), - m = d3Geo.geoProjectionMutator(gingeryRaw), - p = m(rho, n), - stream_ = p.stream, - epsilon$$1 = 1e-2, - cr = -cos(epsilon$$1 * radians), - sr = sin(epsilon$$1 * radians); - - p.radius = function(_) { - if (!arguments.length) return rho * degrees; - cRho = cos(rho = _ * radians); - sRho = sin(rho); - return m(rho, n); - }; - - p.lobes = function(_) { - if (!arguments.length) return n; - return m(rho, n = +_); - }; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = stream_(stream), - sphereStream = (p.rotate([0, 0]), stream_(stream)); - p.rotate(rotate); - rotateStream.sphere = function() { - sphereStream.polygonStart(), sphereStream.lineStart(); - for (var i = 0, delta = 2 * pi / n, phi = 0; i < n; ++i, phi -= delta) { - sphereStream.point(atan2(sr * cos(phi), cr) * degrees, asin(sr * sin(phi)) * degrees); - sphereStream.point(atan2(sRho * cos(phi - delta / 2), cRho) * degrees, asin(sRho * sin(phi - delta / 2)) * degrees); - } - sphereStream.lineEnd(), sphereStream.polygonEnd(); - }; - return rotateStream; - }; - - return p - .rotate([90, -40]) - .scale(91.7095) - .clipAngle(180 - 1e-3); -} - -function ginzburgPolyconicRaw(a, b, c, d, e, f, g, h) { - if (arguments.length < 8) h = 0; - - function forward(lambda, phi) { - if (!phi) return [a * lambda / pi, 0]; - var phi2 = phi * phi, - xB = a + phi2 * (b + phi2 * (c + phi2 * d)), - yB = phi * (e - 1 + phi2 * (f - h + phi2 * g)), - m = (xB * xB + yB * yB) / (2 * yB), - alpha = lambda * asin(xB / m) / pi; - return [m * sin(alpha), phi * (1 + phi2 * h) + m * (1 - cos(alpha))]; - } - - forward.invert = function(x, y) { - var lambda = pi * x / a, - phi = y, - deltaLambda, deltaPhi, i = 50; - do { - var phi2 = phi * phi, - xB = a + phi2 * (b + phi2 * (c + phi2 * d)), - yB = phi * (e - 1 + phi2 * (f - h + phi2 * g)), - p = xB * xB + yB * yB, - q = 2 * yB, - m = p / q, - m2 = m * m, - dAlphadLambda = asin(xB / m) / pi, - alpha = lambda * dAlphadLambda, - xB2 = xB * xB, - dxBdPhi = (2 * b + phi2 * (4 * c + phi2 * 6 * d)) * phi, - dyBdPhi = e + phi2 * (3 * f + phi2 * 5 * g), - dpdPhi = 2 * (xB * dxBdPhi + yB * (dyBdPhi - 1)), - dqdPhi = 2 * (dyBdPhi - 1), - dmdPhi = (dpdPhi * q - p * dqdPhi) / (q * q), - cosAlpha = cos(alpha), - sinAlpha = sin(alpha), - mcosAlpha = m * cosAlpha, - msinAlpha = m * sinAlpha, - dAlphadPhi = ((lambda / pi) * (1 / sqrt(1 - xB2 / m2)) * (dxBdPhi * m - xB * dmdPhi)) / m2, - fx = msinAlpha - x, - fy = phi * (1 + phi2 * h) + m - mcosAlpha - y, - deltaxDeltaPhi = dmdPhi * sinAlpha + mcosAlpha * dAlphadPhi, - deltaxDeltaLambda = mcosAlpha * dAlphadLambda, - deltayDeltaPhi = 1 + dmdPhi - (dmdPhi * cosAlpha - msinAlpha * dAlphadPhi), - deltayDeltaLambda = msinAlpha * dAlphadLambda, - denominator = deltaxDeltaPhi * deltayDeltaLambda - deltayDeltaPhi * deltaxDeltaLambda; - if (!denominator) break; - lambda -= deltaLambda = (fy * deltaxDeltaPhi - fx * deltayDeltaPhi) / denominator; - phi -= deltaPhi = (fx * deltayDeltaLambda - fy * deltaxDeltaLambda) / denominator; - } while ((abs(deltaLambda) > epsilon || abs(deltaPhi) > epsilon) && --i > 0); - return [lambda, phi]; - }; - - return forward; -} - -var ginzburg4Raw = ginzburgPolyconicRaw(2.8284, -1.6988, 0.75432, -0.18071, 1.76003, -0.38914, 0.042555); - -function ginzburg4() { - return d3Geo.geoProjection(ginzburg4Raw) - .scale(149.995); -} - -var ginzburg5Raw = ginzburgPolyconicRaw(2.583819, -0.835827, 0.170354, -0.038094, 1.543313, -0.411435,0.082742); - -function ginzburg5() { - return d3Geo.geoProjection(ginzburg5Raw) - .scale(153.93); -} - -var ginzburg6Raw = ginzburgPolyconicRaw(5 / 6 * pi, -0.62636, -0.0344, 0, 1.3493, -0.05524, 0, 0.045); - -function ginzburg6() { - return d3Geo.geoProjection(ginzburg6Raw) - .scale(130.945); -} - -function ginzburg8Raw(lambda, phi) { - var lambda2 = lambda * lambda, - phi2 = phi * phi; - return [ - lambda * (1 - 0.162388 * phi2) * (0.87 - 0.000952426 * lambda2 * lambda2), - phi * (1 + phi2 / 12) - ]; -} - -ginzburg8Raw.invert = function(x, y) { - var lambda = x, - phi = y, - i = 50, delta; - do { - var phi2 = phi * phi; - phi -= delta = (phi * (1 + phi2 / 12) - y) / (1 + phi2 / 4); - } while (abs(delta) > epsilon && --i > 0); - i = 50; - x /= 1 -0.162388 * phi2; - do { - var lambda4 = (lambda4 = lambda * lambda) * lambda4; - lambda -= delta = (lambda * (0.87 - 0.000952426 * lambda4) - x) / (0.87 - 0.00476213 * lambda4); - } while (abs(delta) > epsilon && --i > 0); - return [lambda, phi]; -}; - -function ginzburg8() { - return d3Geo.geoProjection(ginzburg8Raw) - .scale(131.747); -} - -var ginzburg9Raw = ginzburgPolyconicRaw(2.6516, -0.76534, 0.19123, -0.047094, 1.36289, -0.13965,0.031762); - -function ginzburg9() { - return d3Geo.geoProjection(ginzburg9Raw) - .scale(131.087); -} - -function squareRaw(project) { - var dx = project(halfPi, 0)[0] - project(-halfPi, 0)[0]; - - function projectSquare(lambda, phi) { - var s = lambda > 0 ? -0.5 : 0.5, - point = project(lambda + s * pi, phi); - point[0] -= s * dx; - return point; - } - - if (project.invert) projectSquare.invert = function(x, y) { - var s = x > 0 ? -0.5 : 0.5, - location = project.invert(x + s * dx, y), - lambda = location[0] - s * pi; - if (lambda < -pi) lambda += 2 * pi; - else if (lambda > pi) lambda -= 2 * pi; - location[0] = lambda; - return location; - }; - - return projectSquare; -} - -function gringortenRaw(lambda, phi) { - var sLambda = sign(lambda), - sPhi = sign(phi), - cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(sPhi * phi); - lambda = abs(atan2(y, z)); - phi = asin(x); - if (abs(lambda - halfPi) > epsilon) lambda %= halfPi; - var point = gringortenHexadecant(lambda > pi / 4 ? halfPi - lambda : lambda, phi); - if (lambda > pi / 4) z = point[0], point[0] = -point[1], point[1] = -z; - return (point[0] *= sLambda, point[1] *= -sPhi, point); -} - -gringortenRaw.invert = function(x, y) { - if (abs(x) > 1) x = sign(x) * 2 - x; - if (abs(y) > 1) y = sign(y) * 2 - y; - var sx = sign(x), - sy = sign(y), - x0 = -sx * x, - y0 = -sy * y, - t = y0 / x0 < 1, - p = gringortenHexadecantInvert(t ? y0 : x0, t ? x0 : y0), - lambda = p[0], - phi = p[1], - cosPhi = cos(phi); - if (t) lambda = -halfPi - lambda; - return [sx * (atan2(sin(lambda) * cosPhi, -sin(phi)) + pi), sy * asin(cos(lambda) * cosPhi)]; -}; - -function gringortenHexadecant(lambda, phi) { - if (phi === halfPi) return [0, 0]; - - var sinPhi = sin(phi), - r = sinPhi * sinPhi, - r2 = r * r, - j = 1 + r2, - k = 1 + 3 * r2, - q = 1 - r2, - z = asin(1 / sqrt(j)), - v = q + r * j * z, - p2 = (1 - sinPhi) / v, - p = sqrt(p2), - a2 = p2 * j, - a = sqrt(a2), - h = p * q, - x, - i; - - if (lambda === 0) return [0, -(h + r * a)]; - - var cosPhi = cos(phi), - secPhi = 1 / cosPhi, - drdPhi = 2 * sinPhi * cosPhi, - dvdPhi = (-3 * r + z * k) * drdPhi, - dp2dPhi = (-v * cosPhi - (1 - sinPhi) * dvdPhi) / (v * v), - dpdPhi = (0.5 * dp2dPhi) / p, - dhdPhi = q * dpdPhi - 2 * r * p * drdPhi, - dra2dPhi = r * j * dp2dPhi + p2 * k * drdPhi, - mu = -secPhi * drdPhi, - nu = -secPhi * dra2dPhi, - zeta = -2 * secPhi * dhdPhi, - lambda1 = 4 * lambda / pi, - delta; - - // Slower but accurate bisection method. - if (lambda > 0.222 * pi || phi < pi / 4 && lambda > 0.175 * pi) { - x = (h + r * sqrt(a2 * (1 + r2) - h * h)) / (1 + r2); - if (lambda > pi / 4) return [x, x]; - var x1 = x, x0 = 0.5 * x; - x = 0.5 * (x0 + x1), i = 50; - do { - var g = sqrt(a2 - x * x), - f = (x * (zeta + mu * g) + nu * asin(x / a)) - lambda1; - if (!f) break; - if (f < 0) x0 = x; - else x1 = x; - x = 0.5 * (x0 + x1); - } while (abs(x1 - x0) > epsilon && --i > 0); - } - - // Newton-Raphson. - else { - x = epsilon, i = 25; - do { - var x2 = x * x, - g2 = sqrt(a2 - x2), - zetaMug = zeta + mu * g2, - f2 = x * zetaMug + nu * asin(x / a) - lambda1, - df = zetaMug + (nu - mu * x2) / g2; - x -= delta = g2 ? f2 / df : 0; - } while (abs(delta) > epsilon && --i > 0); - } - - return [x, -h - r * sqrt(a2 - x * x)]; -} - -function gringortenHexadecantInvert(x, y) { - var x0 = 0, - x1 = 1, - r = 0.5, - i = 50; - - while (true) { - var r2 = r * r, - sinPhi = sqrt(r), - z = asin(1 / sqrt(1 + r2)), - v = (1 - r2) + r * (1 + r2) * z, - p2 = (1 - sinPhi) / v, - p = sqrt(p2), - a2 = p2 * (1 + r2), - h = p * (1 - r2), - g2 = a2 - x * x, - g = sqrt(g2), - y0 = y + h + r * g; - if (abs(x1 - x0) < epsilon2 || --i === 0 || y0 === 0) break; - if (y0 > 0) x0 = r; - else x1 = r; - r = 0.5 * (x0 + x1); - } - - if (!i) return null; - - var phi = asin(sinPhi), - cosPhi = cos(phi), - secPhi = 1 / cosPhi, - drdPhi = 2 * sinPhi * cosPhi, - dvdPhi = (-3 * r + z * (1 + 3 * r2)) * drdPhi, - dp2dPhi = (-v * cosPhi - (1 - sinPhi) * dvdPhi) / (v * v), - dpdPhi = 0.5 * dp2dPhi / p, - dhdPhi = (1 - r2) * dpdPhi - 2 * r * p * drdPhi, - zeta = -2 * secPhi * dhdPhi, - mu = -secPhi * drdPhi, - nu = -secPhi * (r * (1 + r2) * dp2dPhi + p2 * (1 + 3 * r2) * drdPhi); - - return [pi / 4 * (x * (zeta + mu * g) + nu * asin(x / sqrt(a2))), phi]; -} - -function gringorten() { - return d3Geo.geoProjection(squareRaw(gringortenRaw)) - .scale(239.75); -} - -// Returns [sn, cn, dn](u + iv|m). -function ellipticJi(u, v, m) { - var a, b, c; - if (!u) { - b = ellipticJ(v, 1 - m); - return [ - [0, b[0] / b[1]], - [1 / b[1], 0], - [b[2] / b[1], 0] - ]; - } - a = ellipticJ(u, m); - if (!v) return [[a[0], 0], [a[1], 0], [a[2], 0]]; - b = ellipticJ(v, 1 - m); - c = b[1] * b[1] + m * a[0] * a[0] * b[0] * b[0]; - return [ - [a[0] * b[2] / c, a[1] * a[2] * b[0] * b[1] / c], - [a[1] * b[1] / c, -a[0] * a[2] * b[0] * b[2] / c], - [a[2] * b[1] * b[2] / c, -m * a[0] * a[1] * b[0] / c] - ]; -} - -// Returns [sn, cn, dn, ph](u|m). -function ellipticJ(u, m) { - var ai, b, phi, t, twon; - if (m < epsilon) { - t = sin(u); - b = cos(u); - ai = m * (u - t * b) / 4; - return [ - t - ai * b, - b + ai * t, - 1 - m * t * t / 2, - u - ai - ]; - } - if (m >= 1 - epsilon) { - ai = (1 - m) / 4; - b = cosh(u); - t = tanh(u); - phi = 1 / b; - twon = b * sinh(u); - return [ - t + ai * (twon - u) / (b * b), - phi - ai * t * phi * (twon - u), - phi + ai * t * phi * (twon + u), - 2 * atan(exp(u)) - halfPi + ai * (twon - u) / b - ]; - } - - var a = [1, 0, 0, 0, 0, 0, 0, 0, 0], - c = [sqrt(m), 0, 0, 0, 0, 0, 0, 0, 0], - i = 0; - b = sqrt(1 - m); - twon = 1; - - while (abs(c[i] / a[i]) > epsilon && i < 8) { - ai = a[i++]; - c[i] = (ai - b) / 2; - a[i] = (ai + b) / 2; - b = sqrt(ai * b); - twon *= 2; - } - - phi = twon * a[i] * u; - do { - t = c[i] * sin(b = phi) / a[i]; - phi = (asin(t) + phi) / 2; - } while (--i); - - return [sin(phi), t = cos(phi), t / cos(phi - b), phi]; -} - -// Calculate F(phi+iPsi|m). -// See Abramowitz and Stegun, 17.4.11. -function ellipticFi(phi, psi, m) { - var r = abs(phi), - i = abs(psi), - sinhPsi = sinh(i); - if (r) { - var cscPhi = 1 / sin(r), - cotPhi2 = 1 / (tan(r) * tan(r)), - b = -(cotPhi2 + m * (sinhPsi * sinhPsi * cscPhi * cscPhi) - 1 + m), - c = (m - 1) * cotPhi2, - cotLambda2 = (-b + sqrt(b * b - 4 * c)) / 2; - return [ - ellipticF(atan(1 / sqrt(cotLambda2)), m) * sign(phi), - ellipticF(atan(sqrt((cotLambda2 / cotPhi2 - 1) / m)), 1 - m) * sign(psi) - ]; - } - return [ - 0, - ellipticF(atan(sinhPsi), 1 - m) * sign(psi) - ]; -} - -// Calculate F(phi|m) where m = k² = sin²α. -// See Abramowitz and Stegun, 17.6.7. -function ellipticF(phi, m) { - if (!m) return phi; - if (m === 1) return log(tan(phi / 2 + quarterPi)); - var a = 1, - b = sqrt(1 - m), - c = sqrt(m); - for (var i = 0; abs(c) > epsilon; i++) { - if (phi % pi) { - var dPhi = atan(b * tan(phi) / a); - if (dPhi < 0) dPhi += pi; - phi += dPhi + ~~(phi / pi) * pi; - } else phi += phi; - c = (a + b) / 2; - b = sqrt(a * b); - c = ((a = c) - b) / 2; - } - return phi / (pow(2, i) * a); -} - -function guyouRaw(lambda, phi) { - var k_ = (sqrt2 - 1) / (sqrt2 + 1), - k = sqrt(1 - k_ * k_), - K = ellipticF(halfPi, k * k), - f = -1, - psi = log(tan(pi / 4 + abs(phi) / 2)), - r = exp(f * psi) / sqrt(k_), - at = guyouComplexAtan(r * cos(f * lambda), r * sin(f * lambda)), - t = ellipticFi(at[0], at[1], k * k); - return [-t[1], (phi >= 0 ? 1 : -1) * (0.5 * K - t[0])]; -} - -function guyouComplexAtan(x, y) { - var x2 = x * x, - y_1 = y + 1, - t = 1 - x2 - y * y; - return [ - 0.5 * ((x >= 0 ? halfPi : -halfPi) - atan2(t, 2 * x)), - -0.25 * log(t * t + 4 * x2) +0.5 * log(y_1 * y_1 + x2) - ]; -} - -function guyouComplexDivide(a, b) { - var denominator = b[0] * b[0] + b[1] * b[1]; - return [ - (a[0] * b[0] + a[1] * b[1]) / denominator, - (a[1] * b[0] - a[0] * b[1]) / denominator - ]; -} - -guyouRaw.invert = function(x, y) { - var k_ = (sqrt2 - 1) / (sqrt2 + 1), - k = sqrt(1 - k_ * k_), - K = ellipticF(halfPi, k * k), - f = -1, - j = ellipticJi(0.5 * K - y, -x, k * k), - tn = guyouComplexDivide(j[0], j[1]), - lambda = atan2(tn[1], tn[0]) / f; - return [ - lambda, - 2 * atan(exp(0.5 / f * log(k_ * tn[0] * tn[0] + k_ * tn[1] * tn[1]))) - halfPi - ]; -}; - -function guyou() { - return d3Geo.geoProjection(squareRaw(guyouRaw)) - .scale(151.496); -} - -function hammerRetroazimuthalRaw(phi0) { - var sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0), - rotate = hammerRetroazimuthalRotation(phi0); - - rotate.invert = hammerRetroazimuthalRotation(-phi0); - - function forward(lambda, phi) { - var p = rotate(lambda, phi); - lambda = p[0], phi = p[1]; - var sinPhi = sin(phi), - cosPhi = cos(phi), - cosLambda = cos(lambda), - z = acos(sinPhi0 * sinPhi + cosPhi0 * cosPhi * cosLambda), - sinz = sin(z), - K = abs(sinz) > epsilon ? z / sinz : 1; - return [ - K * cosPhi0 * sin(lambda), - (abs(lambda) > halfPi ? K : -K) // rotate for back hemisphere - * (sinPhi0 * cosPhi - cosPhi0 * sinPhi * cosLambda) - ]; - } - - forward.invert = function(x, y) { - var rho = sqrt(x * x + y * y), - sinz = -sin(rho), - cosz = cos(rho), - a = rho * cosz, - b = -y * sinz, - c = rho * sinPhi0, - d = sqrt(a * a + b * b - c * c), - phi = atan2(a * c + b * d, b * c - a * d), - lambda = (rho > halfPi ? -1 : 1) * atan2(x * sinz, rho * cos(phi) * cosz + y * sin(phi) * sinz); - return rotate.invert(lambda, phi); - }; - - return forward; -} - -// Latitudinal rotation by phi0. -// Temporary hack until D3 supports arbitrary small-circle clipping origins. -function hammerRetroazimuthalRotation(phi0) { - var sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0); - - return function(lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi); - return [ - atan2(y, x * cosPhi0 - z * sinPhi0), - asin(z * cosPhi0 + x * sinPhi0) - ]; - }; -} - -function hammerRetroazimuthal() { - var phi0 = 0, - m = d3Geo.geoProjectionMutator(hammerRetroazimuthalRaw), - p = m(phi0), - rotate_ = p.rotate, - stream_ = p.stream, - circle = d3Geo.geoCircle(); - - p.parallel = function(_) { - if (!arguments.length) return phi0 * degrees; - var r = p.rotate(); - return m(phi0 = _ * radians).rotate(r); - }; - - // Temporary hack; see hammerRetroazimuthalRotation. - p.rotate = function(_) { - if (!arguments.length) return (_ = rotate_.call(p), _[1] += phi0 * degrees, _); - rotate_.call(p, [_[0], _[1] - phi0 * degrees]); - circle.center([-_[0], -_[1]]); - return p; - }; - - p.stream = function(stream) { - stream = stream_(stream); - stream.sphere = function() { - stream.polygonStart(); - var epsilon$$1 = 1e-2, - ring = circle.radius(90 - epsilon$$1)().coordinates[0], - n = ring.length - 1, - i = -1, - p; - stream.lineStart(); - while (++i < n) stream.point((p = ring[i])[0], p[1]); - stream.lineEnd(); - ring = circle.radius(90 + epsilon$$1)().coordinates[0]; - n = ring.length - 1; - stream.lineStart(); - while (--i >= 0) stream.point((p = ring[i])[0], p[1]); - stream.lineEnd(); - stream.polygonEnd(); - }; - return stream; - }; - - return p - .scale(79.4187) - .parallel(45) - .clipAngle(180 - 1e-3); -} - -var K = 3, - healpixParallel = asin(1 - 1 / K) * degrees, - healpixLambert = cylindricalEqualAreaRaw(0); - -function healpixRaw(H) { - var phi0 = healpixParallel * radians, - dx = collignonRaw(pi, phi0)[0] - collignonRaw(-pi, phi0)[0], - y0 = healpixLambert(0, phi0)[1], - y1 = collignonRaw(0, phi0)[1], - dy1 = sqrtPi - y1, - k = tau / H, - w = 4 / tau, - h = y0 + (dy1 * dy1 * 4) / tau; - - function forward(lambda, phi) { - var point, - phi2 = abs(phi); - if (phi2 > phi0) { - var i = min(H - 1, max(0, floor((lambda + pi) / k))); - lambda += pi * (H - 1) / H - i * k; - point = collignonRaw(lambda, phi2); - point[0] = point[0] * tau / dx - tau * (H - 1) / (2 * H) + i * tau / H; - point[1] = y0 + (point[1] - y1) * 4 * dy1 / tau; - if (phi < 0) point[1] = -point[1]; - } else { - point = healpixLambert(lambda, phi); - } - point[0] *= w, point[1] /= h; - return point; - } - - forward.invert = function(x, y) { - x /= w, y *= h; - var y2 = abs(y); - if (y2 > y0) { - var i = min(H - 1, max(0, floor((x + pi) / k))); - x = (x + pi * (H - 1) / H - i * k) * dx / tau; - var point = collignonRaw.invert(x, 0.25 * (y2 - y0) * tau / dy1 + y1); - point[0] -= pi * (H - 1) / H - i * k; - if (y < 0) point[1] = -point[1]; - return point; - } - return healpixLambert.invert(x, y); - }; - - return forward; -} - -function sphereTop(x, i) { - return [x, i & 1 ? 90 - epsilon : healpixParallel]; -} - -function sphereBottom(x, i) { - return [x, i & 1 ? -90 + epsilon : -healpixParallel]; -} - -function sphereNudge(d) { - return [d[0] * (1 - epsilon), d[1]]; -} - -function sphere(step) { - var c = [].concat( - d3Array.range(-180, 180 + step / 2, step).map(sphereTop), - d3Array.range(180, -180 - step / 2, -step).map(sphereBottom) - ); - return { - type: "Polygon", - coordinates: [step === 180 ? c.map(sphereNudge) : c] - }; -} - -function healpix() { - var H = 4, - m = d3Geo.geoProjectionMutator(healpixRaw), - p = m(H), - stream_ = p.stream; - - p.lobes = function(_) { - return arguments.length ? m(H = +_) : H; - }; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = stream_(stream), - sphereStream = (p.rotate([0, 0]), stream_(stream)); - p.rotate(rotate); - rotateStream.sphere = function() { d3Geo.geoStream(sphere(180 / H), sphereStream); }; - return rotateStream; - }; - - return p - .scale(239.75); -} - -function hillRaw(K) { - var L = 1 + K, - sinBt = sin(1 / L), - Bt = asin(sinBt), - A = 2 * sqrt(pi / (B = pi + 4 * Bt * L)), - B, - rho0 = 0.5 * A * (L + sqrt(K * (2 + K))), - K2 = K * K, - L2 = L * L; - - function forward(lambda, phi) { - var t = 1 - sin(phi), - rho, - omega; - if (t && t < 2) { - var theta = halfPi - phi, i = 25, delta; - do { - var sinTheta = sin(theta), - cosTheta = cos(theta), - Bt_Bt1 = Bt + atan2(sinTheta, L - cosTheta), - C = 1 + L2 - 2 * L * cosTheta; - theta -= delta = (theta - K2 * Bt - L * sinTheta + C * Bt_Bt1 -0.5 * t * B) / (2 * L * sinTheta * Bt_Bt1); - } while (abs(delta) > epsilon2 && --i > 0); - rho = A * sqrt(C); - omega = lambda * Bt_Bt1 / pi; - } else { - rho = A * (K + t); - omega = lambda * Bt / pi; - } - return [ - rho * sin(omega), - rho0 - rho * cos(omega) - ]; - } - - forward.invert = function(x, y) { - var rho2 = x * x + (y -= rho0) * y, - cosTheta = (1 + L2 - rho2 / (A * A)) / (2 * L), - theta = acos(cosTheta), - sinTheta = sin(theta), - Bt_Bt1 = Bt + atan2(sinTheta, L - cosTheta); - return [ - asin(x / sqrt(rho2)) * pi / Bt_Bt1, - asin(1 - 2 * (theta - K2 * Bt - L * sinTheta + (1 + L2 - 2 * L * cosTheta) * Bt_Bt1) / B) - ]; - }; - - return forward; -} - -function hill() { - var K = 1, - m = d3Geo.geoProjectionMutator(hillRaw), - p = m(K); - - p.ratio = function(_) { - return arguments.length ? m(K = +_) : K; - }; - - return p - .scale(167.774) - .center([0, 18.67]); -} - -var sinuMollweidePhi = 0.7109889596207567; - -var sinuMollweideY = 0.0528035274542; - -function sinuMollweideRaw(lambda, phi) { - return phi > -sinuMollweidePhi - ? (lambda = mollweideRaw(lambda, phi), lambda[1] += sinuMollweideY, lambda) - : sinusoidalRaw(lambda, phi); -} - -sinuMollweideRaw.invert = function(x, y) { - return y > -sinuMollweidePhi - ? mollweideRaw.invert(x, y - sinuMollweideY) - : sinusoidalRaw.invert(x, y); -}; - -function sinuMollweide() { - return d3Geo.geoProjection(sinuMollweideRaw) - .rotate([-20, -55]) - .scale(164.263) - .center([0, -5.4036]); -} - -function homolosineRaw(lambda, phi) { - return abs(phi) > sinuMollweidePhi - ? (lambda = mollweideRaw(lambda, phi), lambda[1] -= phi > 0 ? sinuMollweideY : -sinuMollweideY, lambda) - : sinusoidalRaw(lambda, phi); -} - -homolosineRaw.invert = function(x, y) { - return abs(y) > sinuMollweidePhi - ? mollweideRaw.invert(x, y + (y > 0 ? sinuMollweideY : -sinuMollweideY)) - : sinusoidalRaw.invert(x, y); -}; - -function homolosine() { - return d3Geo.geoProjection(homolosineRaw) - .scale(152.63); -} - -function hufnagelRaw(a, b, psiMax, ratio) { - var k = sqrt( - (4 * pi) / - (2 * psiMax + - (1 + a - b / 2) * sin(2 * psiMax) + - ((a + b) / 2) * sin(4 * psiMax) + - (b / 2) * sin(6 * psiMax)) - ), - c = sqrt( - ratio * - sin(psiMax) * - sqrt((1 + a * cos(2 * psiMax) + b * cos(4 * psiMax)) / (1 + a + b)) - ), - M = psiMax * mapping(1); - - function radius(psi) { - return sqrt(1 + a * cos(2 * psi) + b * cos(4 * psi)); - } - - function mapping(t) { - var psi = t * psiMax; - return ( - (2 * psi + - (1 + a - b / 2) * sin(2 * psi) + - ((a + b) / 2) * sin(4 * psi) + - (b / 2) * sin(6 * psi)) / - psiMax - ); - } - - function inversemapping(psi) { - return radius(psi) * sin(psi); - } - - var forward = function(lambda, phi) { - var psi = psiMax * solve(mapping, (M * sin(phi)) / psiMax, phi / pi); - if (isNaN(psi)) psi = psiMax * sign(phi); - var kr = k * radius(psi); - return [((kr * c * lambda) / pi) * cos(psi), (kr / c) * sin(psi)]; - }; - - forward.invert = function(x, y) { - var psi = solve(inversemapping, (y * c) / k); - return [ - (x * pi) / (cos(psi) * k * c * radius(psi)), - asin((psiMax * mapping(psi / psiMax)) / M) - ]; - }; - - if (psiMax === 0) { - k = sqrt(ratio / pi); - forward = function(lambda, phi) { - return [lambda * k, sin(phi) / k]; - }; - forward.invert = function(x, y) { - return [x / k, asin(y * k)]; - }; - } - - return forward; -} - -function hufnagel() { - var a = 1, - b = 0, - psiMax = 45 * radians, - ratio = 2, - mutate = d3Geo.geoProjectionMutator(hufnagelRaw), - projection = mutate(a, b, psiMax, ratio); - - projection.a = function(_) { - return arguments.length ? mutate((a = +_), b, psiMax, ratio) : a; - }; - projection.b = function(_) { - return arguments.length ? mutate(a, (b = +_), psiMax, ratio) : b; - }; - projection.psiMax = function(_) { - return arguments.length - ? mutate(a, b, (psiMax = +_ * radians), ratio) - : psiMax * degrees; - }; - projection.ratio = function(_) { - return arguments.length ? mutate(a, b, psiMax, (ratio = +_)) : ratio; - }; - - return projection.scale(180.739); -} - -// https://github.com/scijs/integrate-adaptive-simpson - -// This algorithm adapted from pseudocode in: -// http://www.math.utk.edu/~ccollins/refs/Handouts/rich.pdf -function adsimp (f, a, b, fa, fm, fb, V0, tol, maxdepth, depth, state) { - if (state.nanEncountered) { - return NaN; - } - - var h, f1, f2, sl, sr, s2, m, V1, V2, err; - - h = b - a; - f1 = f(a + h * 0.25); - f2 = f(b - h * 0.25); - - // Simple check for NaN: - if (isNaN(f1)) { - state.nanEncountered = true; - return; - } - - // Simple check for NaN: - if (isNaN(f2)) { - state.nanEncountered = true; - return; - } - - sl = h * (fa + 4 * f1 + fm) / 12; - sr = h * (fm + 4 * f2 + fb) / 12; - s2 = sl + sr; - err = (s2 - V0) / 15; - - if (depth > maxdepth) { - state.maxDepthCount++; - return s2 + err; - } else if (Math.abs(err) < tol) { - return s2 + err; - } else { - m = a + h * 0.5; - - V1 = adsimp(f, a, m, fa, f1, fm, sl, tol * 0.5, maxdepth, depth + 1, state); - - if (isNaN(V1)) { - state.nanEncountered = true; - return NaN; - } - - V2 = adsimp(f, m, b, fm, f2, fb, sr, tol * 0.5, maxdepth, depth + 1, state); - - if (isNaN(V2)) { - state.nanEncountered = true; - return NaN; - } - - return V1 + V2; - } -} - -function integrate (f, a, b, tol, maxdepth) { - var state = { - maxDepthCount: 0, - nanEncountered: false - }; - - if (tol === undefined) { - tol = 1e-8; - } - if (maxdepth === undefined) { - maxdepth = 20; - } - - var fa = f(a); - var fm = f(0.5 * (a + b)); - var fb = f(b); - - var V0 = (fa + 4 * fm + fb) * (b - a) / 6; - - var result = adsimp(f, a, b, fa, fm, fb, V0, tol, maxdepth, 1, state); - -/* - if (state.maxDepthCount > 0 && console && console.warn) { - console.warn('integrate-adaptive-simpson: Warning: maximum recursion depth (' + maxdepth + ') reached ' + state.maxDepthCount + ' times'); - } - - if (state.nanEncountered && console && console.warn) { - console.warn('integrate-adaptive-simpson: Warning: NaN encountered. Halting early.'); - } -*/ - - return result; -} - -function hyperellipticalRaw(alpha, k, gamma) { - - function elliptic (f) { - return alpha + (1 - alpha) * pow(1 - pow(f, k), 1 / k); - } - - function z(f) { - return integrate(elliptic, 0, f, 1e-4); - } - - var G = 1 / z(1), - n = 1000, - m = (1 + 1e-8) * G, - approx = []; - for (var i = 0; i <= n; i++) - approx.push(z(i / n) * m); - - function Y(sinphi) { - var rmin = 0, rmax = n, r = n >> 1; - do { - if (approx[r] > sinphi) rmax = r; else rmin = r; - r = (rmin + rmax) >> 1; - } while (r > rmin); - var u = approx[r + 1] - approx[r]; - if (u) u = (sinphi - approx[r + 1]) / u; - return (r + 1 + u) / n; - } - - var ratio = 2 * Y(1) / pi * G / gamma; - - var forward = function(lambda, phi) { - var y = Y(abs(sin(phi))), - x = elliptic(y) * lambda; - y /= ratio; - return [ x, (phi >= 0) ? y : -y ]; - }; - - forward.invert = function(x, y) { - var phi; - y *= ratio; - if (abs(y) < 1) phi = sign(y) * asin(z(abs(y)) * G); - return [ x / elliptic(abs(y)), phi ]; - }; - - return forward; -} - -function hyperelliptical() { - var alpha = 0, - k = 2.5, - gamma = 1.183136, // affine = sqrt(2 * gamma / pi) = 0.8679 - m = d3Geo.geoProjectionMutator(hyperellipticalRaw), - p = m(alpha, k, gamma); - - p.alpha = function(_) { - return arguments.length ? m(alpha = +_, k, gamma) : alpha; - }; - - p.k = function(_) { - return arguments.length ? m(alpha, k = +_, gamma) : k; - }; - - p.gamma = function(_) { - return arguments.length ? m(alpha, k, gamma = +_) : gamma; - }; - - return p - .scale(152.63); -} - -function pointEqual(a, b) { - return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon; -} - -function interpolateLine(coordinates, m) { - var i = -1, - n = coordinates.length, - p0 = coordinates[0], - p1, - dx, - dy, - resampled = []; - while (++i < n) { - p1 = coordinates[i]; - dx = (p1[0] - p0[0]) / m; - dy = (p1[1] - p0[1]) / m; - for (var j = 0; j < m; ++j) resampled.push([p0[0] + j * dx, p0[1] + j * dy]); - p0 = p1; - } - resampled.push(p1); - return resampled; -} - -function interpolateSphere(lobes) { - var coordinates = [], - lobe, - lambda0, phi0, phi1, - lambda2, phi2, - i, n = lobes[0].length; - - // Northern Hemisphere - for (i = 0; i < n; ++i) { - lobe = lobes[0][i]; - lambda0 = lobe[0][0], phi0 = lobe[0][1], phi1 = lobe[1][1]; - lambda2 = lobe[2][0], phi2 = lobe[2][1]; - coordinates.push(interpolateLine([ - [lambda0 + epsilon, phi0 + epsilon], - [lambda0 + epsilon, phi1 - epsilon], - [lambda2 - epsilon, phi1 - epsilon], - [lambda2 - epsilon, phi2 + epsilon] - ], 30)); - } - - // Southern Hemisphere - for (i = lobes[1].length - 1; i >= 0; --i) { - lobe = lobes[1][i]; - lambda0 = lobe[0][0], phi0 = lobe[0][1], phi1 = lobe[1][1]; - lambda2 = lobe[2][0], phi2 = lobe[2][1]; - coordinates.push(interpolateLine([ - [lambda2 - epsilon, phi2 - epsilon], - [lambda2 - epsilon, phi1 + epsilon], - [lambda0 + epsilon, phi1 + epsilon], - [lambda0 + epsilon, phi0 - epsilon] - ], 30)); - } - - return { - type: "Polygon", - coordinates: [d3Array.merge(coordinates)] - }; -} - -function interrupt(project, lobes, inverse) { - var sphere, bounds; - - function forward(lambda, phi) { - var sign$$1 = phi < 0 ? -1 : +1, lobe = lobes[+(phi < 0)]; - for (var i = 0, n = lobe.length - 1; i < n && lambda > lobe[i][2][0]; ++i); - var p = project(lambda - lobe[i][1][0], phi); - p[0] += project(lobe[i][1][0], sign$$1 * phi > sign$$1 * lobe[i][0][1] ? lobe[i][0][1] : phi)[0]; - return p; - } - - if (inverse) { - forward.invert = inverse(forward); - } else if (project.invert) { - forward.invert = function(x, y) { - var bound = bounds[+(y < 0)], lobe = lobes[+(y < 0)]; - for (var i = 0, n = bound.length; i < n; ++i) { - var b = bound[i]; - if (b[0][0] <= x && x < b[1][0] && b[0][1] <= y && y < b[1][1]) { - var p = project.invert(x - project(lobe[i][1][0], 0)[0], y); - p[0] += lobe[i][1][0]; - return pointEqual(forward(p[0], p[1]), [x, y]) ? p : null; - } - } - }; - } - - var p = d3Geo.geoProjection(forward), - stream_ = p.stream; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = stream_(stream), - sphereStream = (p.rotate([0, 0]), stream_(stream)); - p.rotate(rotate); - rotateStream.sphere = function() { d3Geo.geoStream(sphere, sphereStream); }; - return rotateStream; - }; - - p.lobes = function(_) { - if (!arguments.length) return lobes.map(function(lobe) { - return lobe.map(function(l) { - return [ - [l[0][0] * degrees, l[0][1] * degrees], - [l[1][0] * degrees, l[1][1] * degrees], - [l[2][0] * degrees, l[2][1] * degrees] - ]; - }); - }); - - sphere = interpolateSphere(_); - - lobes = _.map(function(lobe) { - return lobe.map(function(l) { - return [ - [l[0][0] * radians, l[0][1] * radians], - [l[1][0] * radians, l[1][1] * radians], - [l[2][0] * radians, l[2][1] * radians] - ]; - }); - }); - - bounds = lobes.map(function(lobe) { - return lobe.map(function(l) { - var x0 = project(l[0][0], l[0][1])[0], - x1 = project(l[2][0], l[2][1])[0], - y0 = project(l[1][0], l[0][1])[1], - y1 = project(l[1][0], l[1][1])[1], - t; - if (y0 > y1) t = y0, y0 = y1, y1 = t; - return [[x0, y0], [x1, y1]]; - }); - }); - - return p; - }; - - if (lobes != null) p.lobes(lobes); - - return p; -} - -var lobes = [[ // northern hemisphere - [[-180, 0], [-100, 90], [ -40, 0]], - [[ -40, 0], [ 30, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-160, -90], [-100, 0]], - [[-100, 0], [ -60, -90], [ -20, 0]], - [[ -20, 0], [ 20, -90], [ 80, 0]], - [[ 80, 0], [ 140, -90], [ 180, 0]] -]]; - -function boggs$1() { - return interrupt(boggsRaw, lobes) - .scale(160.857); -} - -var lobes$1 = [[ // northern hemisphere - [[-180, 0], [-100, 90], [ -40, 0]], - [[ -40, 0], [ 30, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-160, -90], [-100, 0]], - [[-100, 0], [ -60, -90], [ -20, 0]], - [[ -20, 0], [ 20, -90], [ 80, 0]], - [[ 80, 0], [ 140, -90], [ 180, 0]] -]]; - -function homolosine$1() { - return interrupt(homolosineRaw, lobes$1) - .scale(152.63); -} - -var lobes$2 = [[ // northern hemisphere - [[-180, 0], [-100, 90], [ -40, 0]], - [[ -40, 0], [ 30, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-160, -90], [-100, 0]], - [[-100, 0], [ -60, -90], [ -20, 0]], - [[ -20, 0], [ 20, -90], [ 80, 0]], - [[ 80, 0], [ 140, -90], [ 180, 0]] -]]; - -function mollweide$1() { - return interrupt(mollweideRaw, lobes$2) - .scale(169.529); -} - -var lobes$3 = [[ // northern hemisphere - [[-180, 0], [ -90, 90], [ 0, 0]], - [[ 0, 0], [ 90, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [ -90, -90], [ 0, 0]], - [[ 0, 0], [ 90, -90], [ 180, 0]] -]]; - -function mollweideHemispheres() { - return interrupt(mollweideRaw, lobes$3) - .scale(169.529) - .rotate([20, 0]); -} - -var lobes$4 = [[ // northern hemisphere - [[-180, 35], [ -30, 90], [ 0, 35]], - [[ 0, 35], [ 30, 90], [ 180, 35]] -], [ // southern hemisphere - [[-180, -10], [-102, -90], [ -65, -10]], - [[ -65, -10], [ 5, -90], [ 77, -10]], - [[ 77, -10], [ 103, -90], [ 180, -10]] -]]; - -function sinuMollweide$1() { - return interrupt(sinuMollweideRaw, lobes$4, solve2d) - .rotate([-20, -55]) - .scale(164.263) - .center([0, -5.4036]); -} - -var lobes$5 = [[ // northern hemisphere - [[-180, 0], [-110, 90], [ -40, 0]], - [[ -40, 0], [ 0, 90], [ 40, 0]], - [[ 40, 0], [ 110, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-110, -90], [ -40, 0]], - [[ -40, 0], [ 0, -90], [ 40, 0]], - [[ 40, 0], [ 110, -90], [ 180, 0]] -]]; - -function sinusoidal$1() { - return interrupt(sinusoidalRaw, lobes$5) - .scale(152.63) - .rotate([-20, 0]); -} - -function kavrayskiy7Raw(lambda, phi) { - return [3 / tau * lambda * sqrt(pi * pi / 3 - phi * phi), phi]; -} - -kavrayskiy7Raw.invert = function(x, y) { - return [tau / 3 * x / sqrt(pi * pi / 3 - y * y), y]; -}; - -function kavrayskiy7() { - return d3Geo.geoProjection(kavrayskiy7Raw) - .scale(158.837); -} - -function lagrangeRaw(n) { - - function forward(lambda, phi) { - if (abs(abs(phi) - halfPi) < epsilon) return [0, phi < 0 ? -2 : 2]; - var sinPhi = sin(phi), - v = pow((1 + sinPhi) / (1 - sinPhi), n / 2), - c = 0.5 * (v + 1 / v) + cos(lambda *= n); - return [ - 2 * sin(lambda) / c, - (v - 1 / v) / c - ]; - } - - forward.invert = function(x, y) { - var y0 = abs(y); - if (abs(y0 - 2) < epsilon) return x ? null : [0, sign(y) * halfPi]; - if (y0 > 2) return null; - - x /= 2, y /= 2; - var x2 = x * x, - y2 = y * y, - t = 2 * y / (1 + x2 + y2); // tanh(nPhi) - t = pow((1 + t) / (1 - t), 1 / n); - return [ - atan2(2 * x, 1 - x2 - y2) / n, - asin((t - 1) / (t + 1)) - ]; - }; - - return forward; -} - -function lagrange() { - var n = 0.5, - m = d3Geo.geoProjectionMutator(lagrangeRaw), - p = m(n); - - p.spacing = function(_) { - return arguments.length ? m(n = +_) : n; - }; - - return p - .scale(124.75); -} - -var pi_sqrt2 = pi / sqrt2; - -function larriveeRaw(lambda, phi) { - return [ - lambda * (1 + sqrt(cos(phi))) / 2, - phi / (cos(phi / 2) * cos(lambda / 6)) - ]; -} - -larriveeRaw.invert = function(x, y) { - var x0 = abs(x), - y0 = abs(y), - lambda = epsilon, - phi = halfPi; - if (y0 < pi_sqrt2) phi *= y0 / pi_sqrt2; - else lambda += 6 * acos(pi_sqrt2 / y0); - for (var i = 0; i < 25; i++) { - var sinPhi = sin(phi), - sqrtcosPhi = sqrt(cos(phi)), - sinPhi_2 = sin(phi / 2), - cosPhi_2 = cos(phi / 2), - sinLambda_6 = sin(lambda / 6), - cosLambda_6 = cos(lambda / 6), - f0 = 0.5 * lambda * (1 + sqrtcosPhi) - x0, - f1 = phi / (cosPhi_2 * cosLambda_6) - y0, - df0dPhi = sqrtcosPhi ? -0.25 * lambda * sinPhi / sqrtcosPhi : 0, - df0dLambda = 0.5 * (1 + sqrtcosPhi), - df1dPhi = (1 + 0.5 * phi * sinPhi_2 / cosPhi_2) / (cosPhi_2 * cosLambda_6), - df1dLambda = (phi / cosPhi_2) * (sinLambda_6 / 6) / (cosLambda_6 * cosLambda_6), - denom = df0dPhi * df1dLambda - df1dPhi * df0dLambda, - dPhi = (f0 * df1dLambda - f1 * df0dLambda) / denom, - dLambda = (f1 * df0dPhi - f0 * df1dPhi) / denom; - phi -= dPhi; - lambda -= dLambda; - if (abs(dPhi) < epsilon && abs(dLambda) < epsilon) break; - } - return [x < 0 ? -lambda : lambda, y < 0 ? -phi : phi]; -}; - -function larrivee() { - return d3Geo.geoProjection(larriveeRaw) - .scale(97.2672); -} - -function laskowskiRaw(lambda, phi) { - var lambda2 = lambda * lambda, phi2 = phi * phi; - return [ - lambda * (0.975534 + phi2 * (-0.119161 + lambda2 * -0.0143059 + phi2 * -0.0547009)), - phi * (1.00384 + lambda2 * (0.0802894 + phi2 * -0.02855 + lambda2 * 0.000199025) + phi2 * (0.0998909 + phi2 * -0.0491032)) - ]; -} - -laskowskiRaw.invert = function(x, y) { - var lambda = sign(x) * pi, - phi = y / 2, - i = 50; - do { - var lambda2 = lambda * lambda, - phi2 = phi * phi, - lambdaPhi = lambda * phi, - fx = lambda * (0.975534 + phi2 * (-0.119161 + lambda2 * -0.0143059 + phi2 * -0.0547009)) - x, - fy = phi * (1.00384 + lambda2 * (0.0802894 + phi2 * -0.02855 + lambda2 * 0.000199025) + phi2 * (0.0998909 + phi2 * -0.0491032)) - y, - deltaxDeltaLambda = 0.975534 - phi2 * (0.119161 + 3 * lambda2 * 0.0143059 + phi2 * 0.0547009), - deltaxDeltaPhi = -lambdaPhi * (2 * 0.119161 + 4 * 0.0547009 * phi2 + 2 * 0.0143059 * lambda2), - deltayDeltaLambda = lambdaPhi * (2 * 0.0802894 + 4 * 0.000199025 * lambda2 + 2 * -0.02855 * phi2), - deltayDeltaPhi = 1.00384 + lambda2 * (0.0802894 + 0.000199025 * lambda2) + phi2 * (3 * (0.0998909 - 0.02855 * lambda2) - 5 * 0.0491032 * phi2), - denominator = deltaxDeltaPhi * deltayDeltaLambda - deltayDeltaPhi * deltaxDeltaLambda, - deltaLambda = (fy * deltaxDeltaPhi - fx * deltayDeltaPhi) / denominator, - deltaPhi = (fx * deltayDeltaLambda - fy * deltaxDeltaLambda) / denominator; - lambda -= deltaLambda, phi -= deltaPhi; - } while ((abs(deltaLambda) > epsilon || abs(deltaPhi) > epsilon) && --i > 0); - return i && [lambda, phi]; -}; - -function laskowski() { - return d3Geo.geoProjection(laskowskiRaw) - .scale(139.98); -} - -function littrowRaw(lambda, phi) { - return [ - sin(lambda) / cos(phi), - tan(phi) * cos(lambda) - ]; -} - -littrowRaw.invert = function(x, y) { - var x2 = x * x, - y2 = y * y, - y2_1 = y2 + 1, - x2_y2_1 = x2 + y2_1, - cosPhi = x - ? sqrt1_2 * sqrt((x2_y2_1 - sqrt(x2_y2_1 * x2_y2_1 - 4 * x2)) / x2) - : 1 / sqrt(y2_1); - return [ - asin(x * cosPhi), - sign(y) * acos(cosPhi) - ]; -}; - -function littrow() { - return d3Geo.geoProjection(littrowRaw) - .scale(144.049) - .clipAngle(90 - 1e-3); -} - -function loximuthalRaw(phi0) { - var cosPhi0 = cos(phi0), - tanPhi0 = tan(quarterPi + phi0 / 2); - - function forward(lambda, phi) { - var y = phi - phi0, - x = abs(y) < epsilon ? lambda * cosPhi0 - : abs(x = quarterPi + phi / 2) < epsilon || abs(abs(x) - halfPi) < epsilon - ? 0 : lambda * y / log(tan(x) / tanPhi0); - return [x, y]; - } - - forward.invert = function(x, y) { - var lambda, - phi = y + phi0; - return [ - abs(y) < epsilon ? x / cosPhi0 - : (abs(lambda = quarterPi + phi / 2) < epsilon || abs(abs(lambda) - halfPi) < epsilon) ? 0 - : x * log(tan(lambda) / tanPhi0) / y, - phi - ]; - }; - - return forward; -} - -function loximuthal() { - return parallel1(loximuthalRaw) - .parallel(40) - .scale(158.837); -} - -function millerRaw(lambda, phi) { - return [lambda, 1.25 * log(tan(quarterPi + 0.4 * phi))]; -} - -millerRaw.invert = function(x, y) { - return [x, 2.5 * atan(exp(0.8 * y)) - 0.625 * pi]; -}; - -function miller() { - return d3Geo.geoProjection(millerRaw) - .scale(108.318); -} - -function modifiedStereographicRaw(C) { - var m = C.length - 1; - - function forward(lambda, phi) { - var cosPhi = cos(phi), - k = 2 / (1 + cosPhi * cos(lambda)), - zr = k * cosPhi * sin(lambda), - zi = k * sin(phi), - i = m, - w = C[i], - ar = w[0], - ai = w[1], - t; - while (--i >= 0) { - w = C[i]; - ar = w[0] + zr * (t = ar) - zi * ai; - ai = w[1] + zr * ai + zi * t; - } - ar = zr * (t = ar) - zi * ai; - ai = zr * ai + zi * t; - return [ar, ai]; - } - - forward.invert = function(x, y) { - var i = 20, - zr = x, - zi = y; - do { - var j = m, - w = C[j], - ar = w[0], - ai = w[1], - br = 0, - bi = 0, - t; - - while (--j >= 0) { - w = C[j]; - br = ar + zr * (t = br) - zi * bi; - bi = ai + zr * bi + zi * t; - ar = w[0] + zr * (t = ar) - zi * ai; - ai = w[1] + zr * ai + zi * t; - } - br = ar + zr * (t = br) - zi * bi; - bi = ai + zr * bi + zi * t; - ar = zr * (t = ar) - zi * ai - x; - ai = zr * ai + zi * t - y; - - var denominator = br * br + bi * bi, deltar, deltai; - zr -= deltar = (ar * br + ai * bi) / denominator; - zi -= deltai = (ai * br - ar * bi) / denominator; - } while (abs(deltar) + abs(deltai) > epsilon * epsilon && --i > 0); - - if (i) { - var rho = sqrt(zr * zr + zi * zi), - c = 2 * atan(rho * 0.5), - sinc = sin(c); - return [atan2(zr * sinc, rho * cos(c)), rho ? asin(zi * sinc / rho) : 0]; - } - }; - - return forward; -} - -var alaska = [[0.9972523, 0], [0.0052513, -0.0041175], [0.0074606, 0.0048125], [-0.0153783, -0.1968253], [0.0636871, -0.1408027], [0.3660976, -0.2937382]], - gs48 = [[0.98879, 0], [0, 0], [-0.050909, 0], [0, 0], [0.075528, 0]], - gs50 = [[0.9842990, 0], [0.0211642, 0.0037608], [-0.1036018, -0.0575102], [-0.0329095, -0.0320119], [0.0499471, 0.1223335], [0.0260460, 0.0899805], [0.0007388, -0.1435792], [0.0075848, -0.1334108], [-0.0216473, 0.0776645], [-0.0225161, 0.0853673]], - miller$1 = [[0.9245, 0], [0, 0], [0.01943, 0]], - lee = [[0.721316, 0], [0, 0], [-0.00881625, -0.00617325]]; - -function modifiedStereographicAlaska() { - return modifiedStereographic(alaska, [152, -64]) - .scale(1400) - .center([-160.908, 62.4864]) - .clipAngle(30) - .angle(7.8); -} - -function modifiedStereographicGs48() { - return modifiedStereographic(gs48, [95, -38]) - .scale(1000) - .clipAngle(55) - .center([-96.5563, 38.8675]); -} - -function modifiedStereographicGs50() { - return modifiedStereographic(gs50, [120, -45]) - .scale(359.513) - .clipAngle(55) - .center([-117.474, 53.0628]); -} - -function modifiedStereographicMiller() { - return modifiedStereographic(miller$1, [-20, -18]) - .scale(209.091) - .center([20, 16.7214]) - .clipAngle(82); -} - -function modifiedStereographicLee() { - return modifiedStereographic(lee, [165, 10]) - .scale(250) - .clipAngle(130) - .center([-165, -10]); -} - -function modifiedStereographic(coefficients, rotate) { - var p = d3Geo.geoProjection(modifiedStereographicRaw(coefficients)).rotate(rotate).clipAngle(90), - r = d3Geo.geoRotation(rotate), - center = p.center; - - delete p.rotate; - - p.center = function(_) { - return arguments.length ? center(r(_)) : r.invert(center()); - }; - - return p; -} - -var sqrt6 = sqrt(6), - sqrt7 = sqrt(7); - -function mtFlatPolarParabolicRaw(lambda, phi) { - var theta = asin(7 * sin(phi) / (3 * sqrt6)); - return [ - sqrt6 * lambda * (2 * cos(2 * theta / 3) - 1) / sqrt7, - 9 * sin(theta / 3) / sqrt7 - ]; -} - -mtFlatPolarParabolicRaw.invert = function(x, y) { - var theta = 3 * asin(y * sqrt7 / 9); - return [ - x * sqrt7 / (sqrt6 * (2 * cos(2 * theta / 3) - 1)), - asin(sin(theta) * 3 * sqrt6 / 7) - ]; -}; - -function mtFlatPolarParabolic() { - return d3Geo.geoProjection(mtFlatPolarParabolicRaw) - .scale(164.859); -} - -function mtFlatPolarQuarticRaw(lambda, phi) { - var k = (1 + sqrt1_2) * sin(phi), - theta = phi; - for (var i = 0, delta; i < 25; i++) { - theta -= delta = (sin(theta / 2) + sin(theta) - k) / (0.5 * cos(theta / 2) + cos(theta)); - if (abs(delta) < epsilon) break; - } - return [ - lambda * (1 + 2 * cos(theta) / cos(theta / 2)) / (3 * sqrt2), - 2 * sqrt(3) * sin(theta / 2) / sqrt(2 + sqrt2) - ]; -} - -mtFlatPolarQuarticRaw.invert = function(x, y) { - var sinTheta_2 = y * sqrt(2 + sqrt2) / (2 * sqrt(3)), - theta = 2 * asin(sinTheta_2); - return [ - 3 * sqrt2 * x / (1 + 2 * cos(theta) / cos(theta / 2)), - asin((sinTheta_2 + sin(theta)) / (1 + sqrt1_2)) - ]; -}; - -function mtFlatPolarQuartic() { - return d3Geo.geoProjection(mtFlatPolarQuarticRaw) - .scale(188.209); -} - -function mtFlatPolarSinusoidalRaw(lambda, phi) { - var A = sqrt(6 / (4 + pi)), - k = (1 + pi / 4) * sin(phi), - theta = phi / 2; - for (var i = 0, delta; i < 25; i++) { - theta -= delta = (theta / 2 + sin(theta) - k) / (0.5 + cos(theta)); - if (abs(delta) < epsilon) break; - } - return [ - A * (0.5 + cos(theta)) * lambda / 1.5, - A * theta - ]; -} - -mtFlatPolarSinusoidalRaw.invert = function(x, y) { - var A = sqrt(6 / (4 + pi)), - theta = y / A; - if (abs(abs(theta) - halfPi) < epsilon) theta = theta < 0 ? -halfPi : halfPi; - return [ - 1.5 * x / (A * (0.5 + cos(theta))), - asin((theta / 2 + sin(theta)) / (1 + pi / 4)) - ]; -}; - -function mtFlatPolarSinusoidal() { - return d3Geo.geoProjection(mtFlatPolarSinusoidalRaw) - .scale(166.518); -} - -function naturalEarth2Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2, phi6 = phi2 * phi4; - return [ - lambda * (0.84719 - 0.13063 * phi2 + phi6 * phi6 * (-0.04515 + 0.05494 * phi2 - 0.02326 * phi4 + 0.00331 * phi6)), - phi * (1.01183 + phi4 * phi4 * (-0.02625 + 0.01926 * phi2 - 0.00396 * phi4)) - ]; -} - -naturalEarth2Raw.invert = function(x, y) { - var phi = y, i = 25, delta, phi2, phi4, phi6; - do { - phi2 = phi * phi; phi4 = phi2 * phi2; - phi -= delta = ((phi * (1.01183 + phi4 * phi4 * (-0.02625 + 0.01926 * phi2 - 0.00396 * phi4))) - y) / - (1.01183 + phi4 * phi4 * ((9 * -0.02625) + (11 * 0.01926) * phi2 + (13 * -0.00396) * phi4)); - } while (abs(delta) > epsilon2 && --i > 0); - phi2 = phi * phi; phi4 = phi2 * phi2; phi6 = phi2 * phi4; - return [ - x / (0.84719 - 0.13063 * phi2 + phi6 * phi6 * (-0.04515 + 0.05494 * phi2 - 0.02326 * phi4 + 0.00331 * phi6)), - phi - ]; -}; - -function naturalEarth2() { - return d3Geo.geoProjection(naturalEarth2Raw) - .scale(175.295); -} - -function nellHammerRaw(lambda, phi) { - return [ - lambda * (1 + cos(phi)) / 2, - 2 * (phi - tan(phi / 2)) - ]; -} - -nellHammerRaw.invert = function(x, y) { - var p = y / 2; - for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; ++i) { - var c = cos(y / 2); - y -= delta = (y - tan(y / 2) - p) / (1 - 0.5 / (c * c)); - } - return [ - 2 * x / (1 + cos(y)), - y - ]; -}; - -function nellHammer() { - return d3Geo.geoProjection(nellHammerRaw) - .scale(152.63); -} - -var lobes$6 = [[ // northern hemisphere - [[-180, 0], [-90, 90], [ 0, 0]], - [[ 0, 0], [ 90, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-90, -90], [ 0, 0]], - [[ 0, 0], [ 90, -90], [180, 0]] -]]; - -function quarticAuthalic() { - return interrupt(hammerRaw(Infinity), lobes$6) - .rotate([20, 0]) - .scale(152.63); -} - -// Based on Torben Jansen's implementation -// https://beta.observablehq.com/@toja/nicolosi-globular-projection -// https://beta.observablehq.com/@toja/nicolosi-globular-inverse - -function nicolosiRaw(lambda, phi) { - var sinPhi = sin(phi), - q = cos(phi), - s = sign(lambda); - - if (lambda === 0 || abs(phi) === halfPi) return [0, phi]; - else if (phi === 0) return [lambda, 0]; - else if (abs(lambda) === halfPi) return [lambda * q, halfPi * sinPhi]; - - var b = pi / (2 * lambda) - (2 * lambda) / pi, - c = (2 * phi) / pi, - d = (1 - c * c) / (sinPhi - c); - - var b2 = b * b, - d2 = d * d, - b2d2 = 1 + b2 / d2, - d2b2 = 1 + d2 / b2; - - var M = ((b * sinPhi) / d - b / 2) / b2d2, - N = ((d2 * sinPhi) / b2 + d / 2) / d2b2, - m = M * M + (q * q) / b2d2, - n = N * N - ((d2 * sinPhi * sinPhi) / b2 + d * sinPhi - 1) / d2b2; - - return [ - halfPi * (M + sqrt(m) * s), - halfPi * (N + sqrt(n < 0 ? 0 : n) * sign(-phi * b) * s) - ]; -} - -nicolosiRaw.invert = function(x, y) { - - x /= halfPi; - y /= halfPi; - - var x2 = x * x, - y2 = y * y, - x2y2 = x2 + y2, - pi2 = pi * pi; - - return [ - x ? (x2y2 -1 + sqrt((1 - x2y2) * (1 - x2y2) + 4 * x2)) / (2 * x) * halfPi : 0, - solve(function(phi) { - return ( - x2y2 * (pi * sin(phi) - 2 * phi) * pi + - 4 * phi * phi * (y - sin(phi)) + - 2 * pi * phi - - pi2 * y - ); - }, 0) - ]; -}; - -function nicolosi() { - return d3Geo.geoProjection(nicolosiRaw) - .scale(127.267); -} - -// Based on Java implementation by Bojan Savric. -// https://github.com/OSUCartography/JMapProjLib/blob/master/src/com/jhlabs/map/proj/PattersonProjection.java - -var pattersonK1 = 1.0148, - pattersonK2 = 0.23185, - pattersonK3 = -0.14499, - pattersonK4 = 0.02406, - pattersonC1 = pattersonK1, - pattersonC2 = 5 * pattersonK2, - pattersonC3 = 7 * pattersonK3, - pattersonC4 = 9 * pattersonK4, - pattersonYmax = 1.790857183; - -function pattersonRaw(lambda, phi) { - var phi2 = phi * phi; - return [ - lambda, - phi * (pattersonK1 + phi2 * phi2 * (pattersonK2 + phi2 * (pattersonK3 + pattersonK4 * phi2))) - ]; -} - -pattersonRaw.invert = function(x, y) { - if (y > pattersonYmax) y = pattersonYmax; - else if (y < -pattersonYmax) y = -pattersonYmax; - var yc = y, delta; - - do { // Newton-Raphson - var y2 = yc * yc; - yc -= delta = ((yc * (pattersonK1 + y2 * y2 * (pattersonK2 + y2 * (pattersonK3 + pattersonK4 * y2)))) - y) / (pattersonC1 + y2 * y2 * (pattersonC2 + y2 * (pattersonC3 + pattersonC4 * y2))); - } while (abs(delta) > epsilon); - - return [x, yc]; -}; - -function patterson() { - return d3Geo.geoProjection(pattersonRaw) - .scale(139.319); -} - -function polyconicRaw(lambda, phi) { - if (abs(phi) < epsilon) return [lambda, 0]; - var tanPhi = tan(phi), - k = lambda * sin(phi); - return [ - sin(k) / tanPhi, - phi + (1 - cos(k)) / tanPhi - ]; -} - -polyconicRaw.invert = function(x, y) { - if (abs(y) < epsilon) return [x, 0]; - var k = x * x + y * y, - phi = y * 0.5, - i = 10, delta; - do { - var tanPhi = tan(phi), - secPhi = 1 / cos(phi), - j = k - 2 * y * phi + phi * phi; - phi -= delta = (tanPhi * j + 2 * (phi - y)) / (2 + j * secPhi * secPhi + 2 * (phi - y) * tanPhi); - } while (abs(delta) > epsilon && --i > 0); - tanPhi = tan(phi); - return [ - (abs(y) < abs(phi + 1 / tanPhi) ? asin(x * tanPhi) : sign(y) * sign(x) * (acos(abs(x * tanPhi)) + halfPi)) / sin(phi), - phi - ]; -}; - -function polyconic() { - return d3Geo.geoProjection(polyconicRaw) - .scale(103.74); -} - -// Note: 6-element arrays are used to denote the 3x3 affine transform matrix: -// [a, b, c, -// d, e, f, -// 0, 0, 1] - this redundant row is left out. - -// Transform matrix for [a0, a1] -> [b0, b1]. -function matrix(a, b) { - var u = subtract(a[1], a[0]), - v = subtract(b[1], b[0]), - phi = angle$1(u, v), - s = length(u) / length(v); - - return multiply([ - 1, 0, a[0][0], - 0, 1, a[0][1] - ], multiply([ - s, 0, 0, - 0, s, 0 - ], multiply([ - cos(phi), sin(phi), 0, - -sin(phi), cos(phi), 0 - ], [ - 1, 0, -b[0][0], - 0, 1, -b[0][1] - ]))); -} - -// Inverts a transform matrix. -function inverse(m) { - var k = 1 / (m[0] * m[4] - m[1] * m[3]); - return [ - k * m[4], -k * m[1], k * (m[1] * m[5] - m[2] * m[4]), - -k * m[3], k * m[0], k * (m[2] * m[3] - m[0] * m[5]) - ]; -} - -// Multiplies two 3x2 matrices. -function multiply(a, b) { - return [ - a[0] * b[0] + a[1] * b[3], - a[0] * b[1] + a[1] * b[4], - a[0] * b[2] + a[1] * b[5] + a[2], - a[3] * b[0] + a[4] * b[3], - a[3] * b[1] + a[4] * b[4], - a[3] * b[2] + a[4] * b[5] + a[5] - ]; -} - -// Subtracts 2D vectors. -function subtract(a, b) { - return [a[0] - b[0], a[1] - b[1]]; -} - -// Magnitude of a 2D vector. -function length(v) { - return sqrt(v[0] * v[0] + v[1] * v[1]); -} - -// Angle between two 2D vectors. -function angle$1(a, b) { - return atan2(a[0] * b[1] - a[1] * b[0], a[0] * b[0] + a[1] * b[1]); -} - -// Creates a polyhedral projection. -// * root: a spanning tree of polygon faces. Nodes are automatically -// augmented with a transform matrix. -// * face: a function that returns the appropriate node for a given {lambda, phi} -// point (radians). -// * r: rotation angle for root face [deprecated by .angle()]. -function polyhedral(root, face, r) { - - recurse(root, {transform: null}); - - function recurse(node, parent) { - node.edges = faceEdges(node.face); - // Find shared edge. - if (parent.face) { - var shared = node.shared = sharedEdge(node.face, parent.face), - m = matrix(shared.map(parent.project), shared.map(node.project)); - node.transform = parent.transform ? multiply(parent.transform, m) : m; - // Replace shared edge in parent edges array. - var edges = parent.edges; - for (var i = 0, n = edges.length; i < n; ++i) { - if (pointEqual$1(shared[0], edges[i][1]) && pointEqual$1(shared[1], edges[i][0])) edges[i] = node; - if (pointEqual$1(shared[0], edges[i][0]) && pointEqual$1(shared[1], edges[i][1])) edges[i] = node; - } - edges = node.edges; - for (i = 0, n = edges.length; i < n; ++i) { - if (pointEqual$1(shared[0], edges[i][0]) && pointEqual$1(shared[1], edges[i][1])) edges[i] = parent; - if (pointEqual$1(shared[0], edges[i][1]) && pointEqual$1(shared[1], edges[i][0])) edges[i] = parent; - } - } else { - node.transform = parent.transform; - } - if (node.children) { - node.children.forEach(function(child) { - recurse(child, node); - }); - } - return node; - } - - function forward(lambda, phi) { - var node = face(lambda, phi), - point = node.project([lambda * degrees, phi * degrees]), - t; - if (t = node.transform) { - return [ - t[0] * point[0] + t[1] * point[1] + t[2], - -(t[3] * point[0] + t[4] * point[1] + t[5]) - ]; - } - point[1] = -point[1]; - return point; - } - - // Naive inverse! A faster solution would use bounding boxes, or even a - // polygonal quadtree. - if (hasInverse(root)) forward.invert = function(x, y) { - var coordinates = faceInvert(root, [x, -y]); - return coordinates && (coordinates[0] *= radians, coordinates[1] *= radians, coordinates); - }; - - function faceInvert(node, coordinates) { - var invert = node.project.invert, - t = node.transform, - point = coordinates; - if (t) { - t = inverse(t); - point = [ - t[0] * point[0] + t[1] * point[1] + t[2], - (t[3] * point[0] + t[4] * point[1] + t[5]) - ]; - } - if (invert && node === faceDegrees(p = invert(point))) return p; - var p, - children = node.children; - for (var i = 0, n = children && children.length; i < n; ++i) { - if (p = faceInvert(children[i], coordinates)) return p; - } - } - - function faceDegrees(coordinates) { - return face(coordinates[0] * radians, coordinates[1] * radians); - } - - var proj = d3Geo.geoProjection(forward), - stream_ = proj.stream; - - proj.stream = function(stream) { - var rotate = proj.rotate(), - rotateStream = stream_(stream), - sphereStream = (proj.rotate([0, 0]), stream_(stream)); - proj.rotate(rotate); - rotateStream.sphere = function() { - sphereStream.polygonStart(); - sphereStream.lineStart(); - outline(sphereStream, root); - sphereStream.lineEnd(); - sphereStream.polygonEnd(); - }; - return rotateStream; - }; - - return proj.angle(r == null ? -30 : r * degrees); -} - -function outline(stream, node, parent) { - var point, - edges = node.edges, - n = edges.length, - edge, - multiPoint = {type: "MultiPoint", coordinates: node.face}, - notPoles = node.face.filter(function(d) { return abs(d[1]) !== 90; }), - b = d3Geo.geoBounds({type: "MultiPoint", coordinates: notPoles}), - inside = false, - j = -1, - dx = b[1][0] - b[0][0]; - // TODO - var c = dx === 180 || dx === 360 - ? [(b[0][0] + b[1][0]) / 2, (b[0][1] + b[1][1]) / 2] - : d3Geo.geoCentroid(multiPoint); - // First find the shared edge… - if (parent) while (++j < n) { - if (edges[j] === parent) break; - } - ++j; - for (var i = 0; i < n; ++i) { - edge = edges[(i + j) % n]; - if (Array.isArray(edge)) { - if (!inside) { - stream.point((point = d3Geo.geoInterpolate(edge[0], c)(epsilon))[0], point[1]); - inside = true; - } - stream.point((point = d3Geo.geoInterpolate(edge[1], c)(epsilon))[0], point[1]); - } else { - inside = false; - if (edge !== parent) outline(stream, edge, node); - } - } -} - -// Tests equality of two spherical points. -function pointEqual$1(a, b) { - return a && b && a[0] === b[0] && a[1] === b[1]; -} - -// Finds a shared edge given two clockwise polygons. -function sharedEdge(a, b) { - var x, y, n = a.length, found = null; - for (var i = 0; i < n; ++i) { - x = a[i]; - for (var j = b.length; --j >= 0;) { - y = b[j]; - if (x[0] === y[0] && x[1] === y[1]) { - if (found) return [found, x]; - found = x; - } - } - } -} - -// Converts an array of n face vertices to an array of n + 1 edges. -function faceEdges(face) { - var n = face.length, - edges = []; - for (var a = face[n - 1], i = 0; i < n; ++i) edges.push([a, a = face[i]]); - return edges; -} - -function hasInverse(node) { - return node.project.invert || node.children && node.children.some(hasInverse); -} - -// TODO generate on-the-fly to avoid external modification. -var octahedron = [ - [0, 90], - [-90, 0], [0, 0], [90, 0], [180, 0], - [0, -90] -]; - -var octahedron$1 = [ - [0, 2, 1], - [0, 3, 2], - [5, 1, 2], - [5, 2, 3], - [0, 1, 4], - [0, 4, 3], - [5, 4, 1], - [5, 3, 4] -].map(function(face) { - return face.map(function(i) { - return octahedron[i]; - }); -}); - -function butterfly(faceProjection) { - - faceProjection = faceProjection || function(face) { - var c = d3Geo.geoCentroid({type: "MultiPoint", coordinates: face}); - return d3Geo.geoGnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]); - }; - - var faces = octahedron$1.map(function(face) { - return {face: face, project: faceProjection(face)}; - }); - - [-1, 0, 0, 1, 0, 1, 4, 5].forEach(function(d, i) { - var node = faces[d]; - node && (node.children || (node.children = [])).push(faces[i]); - }); - - return polyhedral(faces[0], function(lambda, phi) { - return faces[lambda < -pi / 2 ? phi < 0 ? 6 : 4 - : lambda < 0 ? phi < 0 ? 2 : 0 - : lambda < pi / 2 ? phi < 0 ? 3 : 1 - : phi < 0 ? 7 : 5]; - }) - .angle(-30) - .scale(101.858) - .center([0, 45]); -} - -var kx = 2 / sqrt(3); - -function collignonK(a, b) { - var p = collignonRaw(a, b); - return [p[0] * kx, p[1]]; -} - -collignonK.invert = function(x,y) { - return collignonRaw.invert(x / kx, y); -}; - -function collignon$1(faceProjection) { - - faceProjection = faceProjection || function(face) { - var c = d3Geo.geoCentroid({type: "MultiPoint", coordinates: face}); - return d3Geo.geoProjection(collignonK).translate([0, 0]).scale(1).rotate(c[1] > 0 ? [-c[0], 0] : [180 - c[0], 180]); - }; - - var faces = octahedron$1.map(function(face) { - return {face: face, project: faceProjection(face)}; - }); - - [-1, 0, 0, 1, 0, 1, 4, 5].forEach(function(d, i) { - var node = faces[d]; - node && (node.children || (node.children = [])).push(faces[i]); - }); - - return polyhedral(faces[0], function(lambda, phi) { - return faces[lambda < -pi / 2 ? phi < 0 ? 6 : 4 - : lambda < 0 ? phi < 0 ? 2 : 0 - : lambda < pi / 2 ? phi < 0 ? 3 : 1 - : phi < 0 ? 7 : 5]; - }) - .angle(-30) - .scale(121.906) - .center([0, 48.5904]); -} - -function waterman(faceProjection) { - - faceProjection = faceProjection || function(face) { - var c = face.length === 6 ? d3Geo.geoCentroid({type: "MultiPoint", coordinates: face}) : face[0]; - return d3Geo.geoGnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]); - }; - - var w5 = octahedron$1.map(function(face) { - var xyz = face.map(cartesian), - n = xyz.length, - a = xyz[n - 1], - b, - hexagon = []; - for (var i = 0; i < n; ++i) { - b = xyz[i]; - hexagon.push(spherical([ - a[0] * 0.9486832980505138 + b[0] * 0.31622776601683794, - a[1] * 0.9486832980505138 + b[1] * 0.31622776601683794, - a[2] * 0.9486832980505138 + b[2] * 0.31622776601683794 - ]), spherical([ - b[0] * 0.9486832980505138 + a[0] * 0.31622776601683794, - b[1] * 0.9486832980505138 + a[1] * 0.31622776601683794, - b[2] * 0.9486832980505138 + a[2] * 0.31622776601683794 - ])); - a = b; - } - return hexagon; - }); - - var cornerNormals = []; - - var parents = [-1, 0, 0, 1, 0, 1, 4, 5]; - - w5.forEach(function(hexagon, j) { - var face = octahedron$1[j], - n = face.length, - normals = cornerNormals[j] = []; - for (var i = 0; i < n; ++i) { - w5.push([ - face[i], - hexagon[(i * 2 + 2) % (2 * n)], - hexagon[(i * 2 + 1) % (2 * n)] - ]); - parents.push(j); - normals.push(cross( - cartesian(hexagon[(i * 2 + 2) % (2 * n)]), - cartesian(hexagon[(i * 2 + 1) % (2 * n)]) - )); - } - }); - - var faces = w5.map(function(face) { - return { - project: faceProjection(face), - face: face - }; - }); - - parents.forEach(function(d, i) { - var parent = faces[d]; - parent && (parent.children || (parent.children = [])).push(faces[i]); - }); - - function face(lambda, phi) { - var cosphi = cos(phi), - p = [cosphi * cos(lambda), cosphi * sin(lambda), sin(phi)]; - - var hexagon = lambda < -pi / 2 ? phi < 0 ? 6 : 4 - : lambda < 0 ? phi < 0 ? 2 : 0 - : lambda < pi / 2 ? phi < 0 ? 3 : 1 - : phi < 0 ? 7 : 5; - - var n = cornerNormals[hexagon]; - - return faces[dot(n[0], p) < 0 ? 8 + 3 * hexagon - : dot(n[1], p) < 0 ? 8 + 3 * hexagon + 1 - : dot(n[2], p) < 0 ? 8 + 3 * hexagon + 2 - : hexagon]; - } - - return polyhedral(faces[0], face) - .angle(-30) - .scale(110.625) - .center([0,45]); -} - -function dot(a, b) { - for (var i = 0, n = a.length, s = 0; i < n; ++i) s += a[i] * b[i]; - return s; -} - -function cross(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] - ]; -} - -// Converts 3D Cartesian to spherical coordinates (degrees). -function spherical(cartesian) { - return [ - atan2(cartesian[1], cartesian[0]) * degrees, - asin(max(-1, min(1, cartesian[2]))) * degrees - ]; -} - -// Converts spherical coordinates (degrees) to 3D Cartesian. -function cartesian(coordinates) { - var lambda = coordinates[0] * radians, - phi = coordinates[1] * radians, - cosphi = cos(phi); - return [ - cosphi * cos(lambda), - cosphi * sin(lambda), - sin(phi) - ]; -} - -function noop() {} - -function clockwise(ring) { - if ((n = ring.length) < 4) return false; - var i = 0, - n, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area <= 0; -} - -function contains(ring, point) { - var x = point[0], - y = point[1], - contains = false; - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], xi = pi[0], yi = pi[1], - pj = ring[j], xj = pj[0], yj = pj[1]; - if (((yi > y) ^ (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi)) contains = !contains; - } - return contains; -} - -function index(object, projection) { - var stream = projection.stream, project; - if (!stream) throw new Error("invalid projection"); - switch (object && object.type) { - case "Feature": project = projectFeature; break; - case "FeatureCollection": project = projectFeatureCollection; break; - default: project = projectGeometry; break; - } - return project(object, stream); -} - -function projectFeatureCollection(o, stream) { - return { - type: "FeatureCollection", - features: o.features.map(function(f) { - return projectFeature(f, stream); - }) - }; -} - -function projectFeature(o, stream) { - return { - type: "Feature", - id: o.id, - properties: o.properties, - geometry: projectGeometry(o.geometry, stream) - }; -} - -function projectGeometryCollection(o, stream) { - return { - type: "GeometryCollection", - geometries: o.geometries.map(function(o) { - return projectGeometry(o, stream); - }) - }; -} - -function projectGeometry(o, stream) { - if (!o) return null; - if (o.type === "GeometryCollection") return projectGeometryCollection(o, stream); - var sink; - switch (o.type) { - case "Point": sink = sinkPoint; break; - case "MultiPoint": sink = sinkPoint; break; - case "LineString": sink = sinkLine; break; - case "MultiLineString": sink = sinkLine; break; - case "Polygon": sink = sinkPolygon; break; - case "MultiPolygon": sink = sinkPolygon; break; - case "Sphere": sink = sinkPolygon; break; - default: return null; - } - d3Geo.geoStream(o, stream(sink)); - return sink.result(); -} - -var points = [], - lines = []; - -var sinkPoint = { - point: function(x, y) { - points.push([x, y]); - }, - result: function() { - var result = !points.length ? null - : points.length < 2 ? {type: "Point", coordinates: points[0]} - : {type: "MultiPoint", coordinates: points}; - points = []; - return result; - } -}; - -var sinkLine = { - lineStart: noop, - point: function(x, y) { - points.push([x, y]); - }, - lineEnd: function() { - if (points.length) lines.push(points), points = []; - }, - result: function() { - var result = !lines.length ? null - : lines.length < 2 ? {type: "LineString", coordinates: lines[0]} - : {type: "MultiLineString", coordinates: lines}; - lines = []; - return result; - } -}; - -var sinkPolygon = { - polygonStart: noop, - lineStart: noop, - point: function(x, y) { - points.push([x, y]); - }, - lineEnd: function() { - var n = points.length; - if (n) { - do points.push(points[0].slice()); while (++n < 4); - lines.push(points), points = []; - } - }, - polygonEnd: noop, - result: function() { - if (!lines.length) return null; - var polygons = [], - holes = []; - - // https://github.com/d3/d3/issues/1558 - lines.forEach(function(ring) { - if (clockwise(ring)) polygons.push([ring]); - else holes.push(ring); - }); - - holes.forEach(function(hole) { - var point = hole[0]; - polygons.some(function(polygon) { - if (contains(polygon[0], point)) { - polygon.push(hole); - return true; - } - }) || polygons.push([hole]); - }); - - lines = []; - - return !polygons.length ? null - : polygons.length > 1 ? {type: "MultiPolygon", coordinates: polygons} - : {type: "Polygon", coordinates: polygons[0]}; - } -}; - -function quincuncial(project) { - var dx = project(halfPi, 0)[0] - project(-halfPi, 0)[0]; - - function projectQuincuncial(lambda, phi) { - var t = abs(lambda) < halfPi, - p = project(t ? lambda : lambda > 0 ? lambda - pi : lambda + pi, phi), - x = (p[0] - p[1]) * sqrt1_2, - y = (p[0] + p[1]) * sqrt1_2; - if (t) return [x, y]; - var d = dx * sqrt1_2, - s = x > 0 ^ y > 0 ? -1 : 1; - return [s * x - sign(y) * d, s * y - sign(x) * d]; - } - - if (project.invert) projectQuincuncial.invert = function(x0, y0) { - var x = (x0 + y0) * sqrt1_2, - y = (y0 - x0) * sqrt1_2, - t = abs(x) < 0.5 * dx && abs(y) < 0.5 * dx; - - if (!t) { - var d = dx * sqrt1_2, - s = x > 0 ^ y > 0 ? -1 : 1, - x1 = -s * x0 + (y > 0 ? 1 : -1) * d, - y1 = -s * y0 + (x > 0 ? 1 : -1) * d; - x = (-x1 - y1) * sqrt1_2; - y = (x1 - y1) * sqrt1_2; - } - - var p = project.invert(x, y); - if (!t) p[0] += x > 0 ? pi : -pi; - return p; - }; - - return d3Geo.geoProjection(projectQuincuncial) - .rotate([-90, -90, 45]) - .clipAngle(180 - 1e-3); -} - -function gringorten$1() { - return quincuncial(gringortenRaw) - .scale(176.423); -} - -function peirce() { - return quincuncial(guyouRaw) - .scale(111.48); -} - -function quantize(input, digits) { - if (!(0 <= (digits = +digits) && digits <= 20)) throw new Error("invalid digits"); - - function quantizePoint(input) { - var n = input.length, i = 2, output = new Array(n); - output[0] = +input[0].toFixed(digits); - output[1] = +input[1].toFixed(digits); - while (i < n) output[i] = input[i], ++i; - return output; - } - - function quantizePoints(input) { - return input.map(quantizePoint); - } - - function quantizePointsNoDuplicates(input) { - var point0 = quantizePoint(input[0]); - var output = [point0]; - for (var i = 1; i < input.length; i++) { - var point = quantizePoint(input[i]); - if (point.length > 2 || point[0] != point0[0] || point[1] != point0[1]) { - output.push(point); - point0 = point; - } - } - if (output.length === 1 && input.length > 1) { - output.push(quantizePoint(input[input.length - 1])); - } - return output; - } - - function quantizePolygon(input) { - return input.map(quantizePointsNoDuplicates); - } - - function quantizeGeometry(input) { - if (input == null) return input; - var output; - switch (input.type) { - case "GeometryCollection": output = {type: "GeometryCollection", geometries: input.geometries.map(quantizeGeometry)}; break; - case "Point": output = {type: "Point", coordinates: quantizePoint(input.coordinates)}; break; - case "MultiPoint": output = {type: input.type, coordinates: quantizePoints(input.coordinates)}; break; - case "LineString": output = {type: input.type, coordinates: quantizePointsNoDuplicates(input.coordinates)}; break; - case "MultiLineString": case "Polygon": output = {type: input.type, coordinates: quantizePolygon(input.coordinates)}; break; - case "MultiPolygon": output = {type: "MultiPolygon", coordinates: input.coordinates.map(quantizePolygon)}; break; - default: return input; - } - if (input.bbox != null) output.bbox = input.bbox; - return output; - } - - function quantizeFeature(input) { - var output = {type: "Feature", properties: input.properties, geometry: quantizeGeometry(input.geometry)}; - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - return output; - } - - if (input != null) switch (input.type) { - case "Feature": return quantizeFeature(input); - case "FeatureCollection": { - var output = {type: "FeatureCollection", features: input.features.map(quantizeFeature)}; - if (input.bbox != null) output.bbox = input.bbox; - return output; - } - default: return quantizeGeometry(input); - } - - return input; -} - -function rectangularPolyconicRaw(phi0) { - var sinPhi0 = sin(phi0); - - function forward(lambda, phi) { - var A = sinPhi0 ? tan(lambda * sinPhi0 / 2) / sinPhi0 : lambda / 2; - if (!phi) return [2 * A, -phi0]; - var E = 2 * atan(A * sin(phi)), - cotPhi = 1 / tan(phi); - return [ - sin(E) * cotPhi, - phi + (1 - cos(E)) * cotPhi - phi0 - ]; - } - - // TODO return null for points outside outline. - forward.invert = function(x, y) { - if (abs(y += phi0) < epsilon) return [sinPhi0 ? 2 * atan(sinPhi0 * x / 2) / sinPhi0 : x, 0]; - var k = x * x + y * y, - phi = 0, - i = 10, delta; - do { - var tanPhi = tan(phi), - secPhi = 1 / cos(phi), - j = k - 2 * y * phi + phi * phi; - phi -= delta = (tanPhi * j + 2 * (phi - y)) / (2 + j * secPhi * secPhi + 2 * (phi - y) * tanPhi); - } while (abs(delta) > epsilon && --i > 0); - var E = x * (tanPhi = tan(phi)), - A = tan(abs(y) < abs(phi + 1 / tanPhi) ? asin(E) * 0.5 : acos(E) * 0.5 + pi / 4) / sin(phi); - return [ - sinPhi0 ? 2 * atan(sinPhi0 * A) / sinPhi0 : 2 * A, - phi - ]; - }; - - return forward; -} - -function rectangularPolyconic() { - return parallel1(rectangularPolyconicRaw) - .scale(131.215); -} - -var K$1 = [ - [0.9986, -0.062], - [1.0000, 0.0000], - [0.9986, 0.0620], - [0.9954, 0.1240], - [0.9900, 0.1860], - [0.9822, 0.2480], - [0.9730, 0.3100], - [0.9600, 0.3720], - [0.9427, 0.4340], - [0.9216, 0.4958], - [0.8962, 0.5571], - [0.8679, 0.6176], - [0.8350, 0.6769], - [0.7986, 0.7346], - [0.7597, 0.7903], - [0.7186, 0.8435], - [0.6732, 0.8936], - [0.6213, 0.9394], - [0.5722, 0.9761], - [0.5322, 1.0000] -]; - -K$1.forEach(function(d) { - d[1] *= 1.0144; -}); - -function robinsonRaw(lambda, phi) { - var i = min(18, abs(phi) * 36 / pi), - i0 = floor(i), - di = i - i0, - ax = (k = K$1[i0])[0], - ay = k[1], - bx = (k = K$1[++i0])[0], - by = k[1], - cx = (k = K$1[min(19, ++i0)])[0], - cy = k[1], - k; - return [ - lambda * (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2), - (phi > 0 ? halfPi : -halfPi) * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2) - ]; -} - -robinsonRaw.invert = function(x, y) { - var yy = y / halfPi, - phi = yy * 90, - i = min(18, abs(phi / 5)), - i0 = max(0, floor(i)); - do { - var ay = K$1[i0][1], - by = K$1[i0 + 1][1], - cy = K$1[min(19, i0 + 2)][1], - u = cy - ay, - v = cy - 2 * by + ay, - t = 2 * (abs(yy) - by) / u, - c = v / u, - di = t * (1 - c * t * (1 - 2 * c * t)); - if (di >= 0 || i0 === 1) { - phi = (y >= 0 ? 5 : -5) * (di + i); - var j = 50, delta; - do { - i = min(18, abs(phi) / 5); - i0 = floor(i); - di = i - i0; - ay = K$1[i0][1]; - by = K$1[i0 + 1][1]; - cy = K$1[min(19, i0 + 2)][1]; - phi -= (delta = (y >= 0 ? halfPi : -halfPi) * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2) - y) * degrees; - } while (abs(delta) > epsilon2 && --j > 0); - break; - } - } while (--i0 >= 0); - var ax = K$1[i0][0], - bx = K$1[i0 + 1][0], - cx = K$1[min(19, i0 + 2)][0]; - return [ - x / (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2), - phi * radians - ]; -}; - -function robinson() { - return d3Geo.geoProjection(robinsonRaw) - .scale(152.63); -} - -function satelliteVerticalRaw(P) { - function forward(lambda, phi) { - var cosPhi = cos(phi), - k = (P - 1) / (P - cosPhi * cos(lambda)); - return [ - k * cosPhi * sin(lambda), - k * sin(phi) - ]; - } - - forward.invert = function(x, y) { - var rho2 = x * x + y * y, - rho = sqrt(rho2), - sinc = (P - sqrt(1 - rho2 * (P + 1) / (P - 1))) / ((P - 1) / rho + rho / (P - 1)); - return [ - atan2(x * sinc, rho * sqrt(1 - sinc * sinc)), - rho ? asin(y * sinc / rho) : 0 - ]; - }; - - return forward; -} - -function satelliteRaw(P, omega) { - var vertical = satelliteVerticalRaw(P); - if (!omega) return vertical; - var cosOmega = cos(omega), - sinOmega = sin(omega); - - function forward(lambda, phi) { - var coordinates = vertical(lambda, phi), - y = coordinates[1], - A = y * sinOmega / (P - 1) + cosOmega; - return [ - coordinates[0] * cosOmega / A, - y / A - ]; - } - - forward.invert = function(x, y) { - var k = (P - 1) / (P - 1 - y * sinOmega); - return vertical.invert(k * x, k * y * cosOmega); - }; - - return forward; -} - -function satellite() { - var distance = 2, - omega = 0, - m = d3Geo.geoProjectionMutator(satelliteRaw), - p = m(distance, omega); - - // As a multiple of radius. - p.distance = function(_) { - if (!arguments.length) return distance; - return m(distance = +_, omega); - }; - - p.tilt = function(_) { - if (!arguments.length) return omega * degrees; - return m(distance, omega = _ * radians); - }; - - return p - .scale(432.147) - .clipAngle(acos(1 / distance) * degrees - 1e-6); -} - -var epsilon$1 = 1e-4, - epsilonInverse = 1e4, - x0 = -180, x0e = x0 + epsilon$1, - x1 = 180, x1e = x1 - epsilon$1, - y0 = -90, y0e = y0 + epsilon$1, - y1 = 90, y1e = y1 - epsilon$1; - -function nonempty(coordinates) { - return coordinates.length > 0; -} - -function quantize$1(x) { - return Math.floor(x * epsilonInverse) / epsilonInverse; -} - -function normalizePoint(y) { - return y === y0 || y === y1 ? [0, y] : [x0, quantize$1(y)]; // pole or antimeridian? -} - -function clampPoint(p) { - var x = p[0], y = p[1], clamped = false; - if (x <= x0e) x = x0, clamped = true; - else if (x >= x1e) x = x1, clamped = true; - if (y <= y0e) y = y0, clamped = true; - else if (y >= y1e) y = y1, clamped = true; - return clamped ? [x, y] : p; -} - -function clampPoints(points) { - return points.map(clampPoint); -} - -// For each ring, detect where it crosses the antimeridian or pole. -function extractFragments(rings, polygon, fragments) { - for (var j = 0, m = rings.length; j < m; ++j) { - var ring = rings[j].slice(); - - // By default, assume that this ring doesn’t need any stitching. - fragments.push({index: -1, polygon: polygon, ring: ring}); - - for (var i = 0, n = ring.length; i < n; ++i) { - var point = ring[i], - x = point[0], - y = point[1]; - - // If this is an antimeridian or polar point… - if (x <= x0e || x >= x1e || y <= y0e || y >= y1e) { - ring[i] = clampPoint(point); - - // Advance through any antimeridian or polar points… - for (var k = i + 1; k < n; ++k) { - var pointk = ring[k], - xk = pointk[0], - yk = pointk[1]; - if (xk > x0e && xk < x1e && yk > y0e && yk < y1e) break; - } - - // If this was just a single antimeridian or polar point, - // we don’t need to cut this ring into a fragment; - // we can just leave it as-is. - if (k === i + 1) continue; - - // Otherwise, if this is not the first point in the ring, - // cut the current fragment so that it ends at the current point. - // The current point is also normalized for later joining. - if (i) { - var fragmentBefore = {index: -1, polygon: polygon, ring: ring.slice(0, i + 1)}; - fragmentBefore.ring[fragmentBefore.ring.length - 1] = normalizePoint(y); - fragments[fragments.length - 1] = fragmentBefore; - } - - // If the ring started with an antimeridian fragment, - // we can ignore that fragment entirely. - else fragments.pop(); - - // If the remainder of the ring is an antimeridian fragment, - // move on to the next ring. - if (k >= n) break; - - // Otherwise, add the remaining ring fragment and continue. - fragments.push({index: -1, polygon: polygon, ring: ring = ring.slice(k - 1)}); - ring[0] = normalizePoint(ring[0][1]); - i = -1; - n = ring.length; - } - } - } -} - -// Now stitch the fragments back together into rings. -function stitchFragments(fragments) { - var i, n = fragments.length; - - // To connect the fragments start-to-end, create a simple index by end. - var fragmentByStart = {}, - fragmentByEnd = {}, - fragment, - start, - startFragment, - end, - endFragment; - - // For each fragment… - for (i = 0; i < n; ++i) { - fragment = fragments[i]; - start = fragment.ring[0]; - end = fragment.ring[fragment.ring.length - 1]; - - // If this fragment is closed, add it as a standalone ring. - if (start[0] === end[0] && start[1] === end[1]) { - fragment.polygon.push(fragment.ring); - fragments[i] = null; - continue; - } - - fragment.index = i; - fragmentByStart[start] = fragmentByEnd[end] = fragment; - } - - // For each open fragment… - for (i = 0; i < n; ++i) { - fragment = fragments[i]; - if (fragment) { - start = fragment.ring[0]; - end = fragment.ring[fragment.ring.length - 1]; - startFragment = fragmentByEnd[start]; - endFragment = fragmentByStart[end]; - - delete fragmentByStart[start]; - delete fragmentByEnd[end]; - - // If this fragment is closed, add it as a standalone ring. - if (start[0] === end[0] && start[1] === end[1]) { - fragment.polygon.push(fragment.ring); - continue; - } - - if (startFragment) { - delete fragmentByEnd[start]; - delete fragmentByStart[startFragment.ring[0]]; - startFragment.ring.pop(); // drop the shared coordinate - fragments[startFragment.index] = null; - fragment = {index: -1, polygon: startFragment.polygon, ring: startFragment.ring.concat(fragment.ring)}; - - if (startFragment === endFragment) { - // Connect both ends to this single fragment to create a ring. - fragment.polygon.push(fragment.ring); - } else { - fragment.index = n++; - fragments.push(fragmentByStart[fragment.ring[0]] = fragmentByEnd[fragment.ring[fragment.ring.length - 1]] = fragment); - } - } else if (endFragment) { - delete fragmentByStart[end]; - delete fragmentByEnd[endFragment.ring[endFragment.ring.length - 1]]; - fragment.ring.pop(); // drop the shared coordinate - fragment = {index: n++, polygon: endFragment.polygon, ring: fragment.ring.concat(endFragment.ring)}; - fragments[endFragment.index] = null; - fragments.push(fragmentByStart[fragment.ring[0]] = fragmentByEnd[fragment.ring[fragment.ring.length - 1]] = fragment); - } else { - fragment.ring.push(fragment.ring[0]); // close ring - fragment.polygon.push(fragment.ring); - } - } - } -} - -function stitchFeature(input) { - var output = {type: "Feature", geometry: stitchGeometry(input.geometry)}; - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - if (input.properties != null) output.properties = input.properties; - return output; -} - -function stitchGeometry(input) { - if (input == null) return input; - var output, fragments, i, n; - switch (input.type) { - case "GeometryCollection": output = {type: "GeometryCollection", geometries: input.geometries.map(stitchGeometry)}; break; - case "Point": output = {type: "Point", coordinates: clampPoint(input.coordinates)}; break; - case "MultiPoint": case "LineString": output = {type: input.type, coordinates: clampPoints(input.coordinates)}; break; - case "MultiLineString": output = {type: "MultiLineString", coordinates: input.coordinates.map(clampPoints)}; break; - case "Polygon": { - var polygon = []; - extractFragments(input.coordinates, polygon, fragments = []); - stitchFragments(fragments); - output = {type: "Polygon", coordinates: polygon}; - break; - } - case "MultiPolygon": { - fragments = [], i = -1, n = input.coordinates.length; - var polygons = new Array(n); - while (++i < n) extractFragments(input.coordinates[i], polygons[i] = [], fragments); - stitchFragments(fragments); - output = {type: "MultiPolygon", coordinates: polygons.filter(nonempty)}; - break; - } - default: return input; - } - if (input.bbox != null) output.bbox = input.bbox; - return output; -} - -function stitch(input) { - if (input == null) return input; - switch (input.type) { - case "Feature": return stitchFeature(input); - case "FeatureCollection": { - var output = {type: "FeatureCollection", features: input.features.map(stitchFeature)}; - if (input.bbox != null) output.bbox = input.bbox; - return output; - } - default: return stitchGeometry(input); - } -} - -function timesRaw(lambda, phi) { - var t = tan(phi / 2), - s = sin(quarterPi * t); - return [ - lambda * (0.74482 - 0.34588 * s * s), - 1.70711 * t - ]; -} - -timesRaw.invert = function(x, y) { - var t = y / 1.70711, - s = sin(quarterPi * t); - return [ - x / (0.74482 - 0.34588 * s * s), - 2 * atan(t) - ]; -}; - -function times() { - return d3Geo.geoProjection(timesRaw) - .scale(146.153); -} - -// Compute the origin as the midpoint of the two reference points. -// Rotate one of the reference points by the origin. -// Apply the spherical law of sines to compute gamma rotation. -function twoPoint(raw, p0, p1) { - var i = d3Geo.geoInterpolate(p0, p1), - o = i(0.5), - a = d3Geo.geoRotation([-o[0], -o[1]])(p0), - b = i.distance / 2, - y = -asin(sin(a[1] * radians) / sin(b)), - R = [-o[0], -o[1], -(a[0] > 0 ? pi - y : y) * degrees], - p = d3Geo.geoProjection(raw(b)).rotate(R), - r = d3Geo.geoRotation(R), - center = p.center; - - delete p.rotate; - - p.center = function(_) { - return arguments.length ? center(r(_)) : r.invert(center()); - }; - - return p - .clipAngle(90); -} - -function twoPointAzimuthalRaw(d) { - var cosd = cos(d); - - function forward(lambda, phi) { - var coordinates = d3Geo.geoGnomonicRaw(lambda, phi); - coordinates[0] *= cosd; - return coordinates; - } - - forward.invert = function(x, y) { - return d3Geo.geoGnomonicRaw.invert(x / cosd, y); - }; - - return forward; -} - -function twoPointAzimuthalUsa() { - return twoPointAzimuthal([-158, 21.5], [-77, 39]) - .clipAngle(60) - .scale(400); -} - -function twoPointAzimuthal(p0, p1) { - return twoPoint(twoPointAzimuthalRaw, p0, p1); -} - -// TODO clip to ellipse -function twoPointEquidistantRaw(z0) { - if (!(z0 *= 2)) return d3Geo.geoAzimuthalEquidistantRaw; - var lambdaa = -z0 / 2, - lambdab = -lambdaa, - z02 = z0 * z0, - tanLambda0 = tan(lambdab), - S = 0.5 / sin(lambdab); - - function forward(lambda, phi) { - var za = acos(cos(phi) * cos(lambda - lambdaa)), - zb = acos(cos(phi) * cos(lambda - lambdab)), - ys = phi < 0 ? -1 : 1; - za *= za, zb *= zb; - return [ - (za - zb) / (2 * z0), - ys * sqrt(4 * z02 * zb - (z02 - za + zb) * (z02 - za + zb)) / (2 * z0) - ]; - } - - forward.invert = function(x, y) { - var y2 = y * y, - cosza = cos(sqrt(y2 + (t = x + lambdaa) * t)), - coszb = cos(sqrt(y2 + (t = x + lambdab) * t)), - t, - d; - return [ - atan2(d = cosza - coszb, t = (cosza + coszb) * tanLambda0), - (y < 0 ? -1 : 1) * acos(sqrt(t * t + d * d) * S) - ]; - }; - - return forward; -} - -function twoPointEquidistantUsa() { - return twoPointEquidistant([-158, 21.5], [-77, 39]) - .clipAngle(130) - .scale(122.571); -} - -function twoPointEquidistant(p0, p1) { - return twoPoint(twoPointEquidistantRaw, p0, p1); -} - -function vanDerGrintenRaw(lambda, phi) { - if (abs(phi) < epsilon) return [lambda, 0]; - var sinTheta = abs(phi / halfPi), - theta = asin(sinTheta); - if (abs(lambda) < epsilon || abs(abs(phi) - halfPi) < epsilon) return [0, sign(phi) * pi * tan(theta / 2)]; - var cosTheta = cos(theta), - A = abs(pi / lambda - lambda / pi) / 2, - A2 = A * A, - G = cosTheta / (sinTheta + cosTheta - 1), - P = G * (2 / sinTheta - 1), - P2 = P * P, - P2_A2 = P2 + A2, - G_P2 = G - P2, - Q = A2 + G; - return [ - sign(lambda) * pi * (A * G_P2 + sqrt(A2 * G_P2 * G_P2 - P2_A2 * (G * G - P2))) / P2_A2, - sign(phi) * pi * (P * Q - A * sqrt((A2 + 1) * P2_A2 - Q * Q)) / P2_A2 - ]; -} - -vanDerGrintenRaw.invert = function(x, y) { - if (abs(y) < epsilon) return [x, 0]; - if (abs(x) < epsilon) return [0, halfPi * sin(2 * atan(y / pi))]; - var x2 = (x /= pi) * x, - y2 = (y /= pi) * y, - x2_y2 = x2 + y2, - z = x2_y2 * x2_y2, - c1 = -abs(y) * (1 + x2_y2), - c2 = c1 - 2 * y2 + x2, - c3 = -2 * c1 + 1 + 2 * y2 + z, - d = y2 / c3 + (2 * c2 * c2 * c2 / (c3 * c3 * c3) - 9 * c1 * c2 / (c3 * c3)) / 27, - a1 = (c1 - c2 * c2 / (3 * c3)) / c3, - m1 = 2 * sqrt(-a1 / 3), - theta1 = acos(3 * d / (a1 * m1)) / 3; - return [ - pi * (x2_y2 - 1 + sqrt(1 + 2 * (x2 - y2) + z)) / (2 * x), - sign(y) * pi * (-m1 * cos(theta1 + pi / 3) - c2 / (3 * c3)) - ]; -}; - -function vanDerGrinten() { - return d3Geo.geoProjection(vanDerGrintenRaw) - .scale(79.4183); -} - -function vanDerGrinten2Raw(lambda, phi) { - if (abs(phi) < epsilon) return [lambda, 0]; - var sinTheta = abs(phi / halfPi), - theta = asin(sinTheta); - if (abs(lambda) < epsilon || abs(abs(phi) - halfPi) < epsilon) return [0, sign(phi) * pi * tan(theta / 2)]; - var cosTheta = cos(theta), - A = abs(pi / lambda - lambda / pi) / 2, - A2 = A * A, - x1 = cosTheta * (sqrt(1 + A2) - A * cosTheta) / (1 + A2 * sinTheta * sinTheta); - return [ - sign(lambda) * pi * x1, - sign(phi) * pi * sqrt(1 - x1 * (2 * A + x1)) - ]; -} - -vanDerGrinten2Raw.invert = function(x, y) { - if (!x) return [0, halfPi * sin(2 * atan(y / pi))]; - var x1 = abs(x / pi), - A = (1 - x1 * x1 - (y /= pi) * y) / (2 * x1), - A2 = A * A, - B = sqrt(A2 + 1); - return [ - sign(x) * pi * (B - A), - sign(y) * halfPi * sin(2 * atan2(sqrt((1 - 2 * A * x1) * (A + B) - x1), sqrt(B + A + x1))) - ]; -}; - -function vanDerGrinten2() { - return d3Geo.geoProjection(vanDerGrinten2Raw) - .scale(79.4183); -} - -function vanDerGrinten3Raw(lambda, phi) { - if (abs(phi) < epsilon) return [lambda, 0]; - var sinTheta = phi / halfPi, - theta = asin(sinTheta); - if (abs(lambda) < epsilon || abs(abs(phi) - halfPi) < epsilon) return [0, pi * tan(theta / 2)]; - var A = (pi / lambda - lambda / pi) / 2, - y1 = sinTheta / (1 + cos(theta)); - return [ - pi * (sign(lambda) * sqrt(A * A + 1 - y1 * y1) - A), - pi * y1 - ]; -} - -vanDerGrinten3Raw.invert = function(x, y) { - if (!y) return [x, 0]; - var y1 = y / pi, - A = (pi * pi * (1 - y1 * y1) - x * x) / (2 * pi * x); - return [ - x ? pi * (sign(x) * sqrt(A * A + 1) - A) : 0, - halfPi * sin(2 * atan(y1)) - ]; -}; - -function vanDerGrinten3() { - return d3Geo.geoProjection(vanDerGrinten3Raw) - .scale(79.4183); -} - -function vanDerGrinten4Raw(lambda, phi) { - if (!phi) return [lambda, 0]; - var phi0 = abs(phi); - if (!lambda || phi0 === halfPi) return [0, phi]; - var B = phi0 / halfPi, - B2 = B * B, - C = (8 * B - B2 * (B2 + 2) - 5) / (2 * B2 * (B - 1)), - C2 = C * C, - BC = B * C, - B_C2 = B2 + C2 + 2 * BC, - B_3C = B + 3 * C, - lambda0 = lambda / halfPi, - lambda1 = lambda0 + 1 / lambda0, - D = sign(abs(lambda) - halfPi) * sqrt(lambda1 * lambda1 - 4), - D2 = D * D, - F = B_C2 * (B2 + C2 * D2 - 1) + (1 - B2) * (B2 * (B_3C * B_3C + 4 * C2) + 12 * BC * C2 + 4 * C2 * C2), - x1 = (D * (B_C2 + C2 - 1) + 2 * sqrt(F)) / (4 * B_C2 + D2); - return [ - sign(lambda) * halfPi * x1, - sign(phi) * halfPi * sqrt(1 + D * abs(x1) - x1 * x1) - ]; -} - -vanDerGrinten4Raw.invert = function(x, y) { - var delta; - if (!x || !y) return [x, y]; - y /= pi; - var x1 = sign(x) * x / halfPi, - D = (x1 * x1 - 1 + 4 * y * y) / abs(x1), - D2 = D * D, - B = 2 * y, - i = 50; - do { - var B2 = B * B, - C = (8 * B - B2 * (B2 + 2) - 5) / (2 * B2 * (B - 1)), - C_ = (3 * B - B2 * B - 10) / (2 * B2 * B), - C2 = C * C, - BC = B * C, - B_C = B + C, - B_C2 = B_C * B_C, - B_3C = B + 3 * C, - F = B_C2 * (B2 + C2 * D2 - 1) + (1 - B2) * (B2 * (B_3C * B_3C + 4 * C2) + C2 * (12 * BC + 4 * C2)), - F_ = -2 * B_C * (4 * BC * C2 + (1 - 4 * B2 + 3 * B2 * B2) * (1 + C_) + C2 * (-6 + 14 * B2 - D2 + (-8 + 8 * B2 - 2 * D2) * C_) + BC * (-8 + 12 * B2 + (-10 + 10 * B2 - D2) * C_)), - sqrtF = sqrt(F), - f = D * (B_C2 + C2 - 1) + 2 * sqrtF - x1 * (4 * B_C2 + D2), - f_ = D * (2 * C * C_ + 2 * B_C * (1 + C_)) + F_ / sqrtF - 8 * B_C * (D * (-1 + C2 + B_C2) + 2 * sqrtF) * (1 + C_) / (D2 + 4 * B_C2); - B -= delta = f / f_; - } while (delta > epsilon && --i > 0); - return [ - sign(x) * (sqrt(D * D + 4) + D) * pi / 4, - halfPi * B - ]; -}; - -function vanDerGrinten4() { - return d3Geo.geoProjection(vanDerGrinten4Raw) - .scale(127.16); -} - -function wagnerFormula(cx, cy, m1, m2, n) { - function forward(lambda, phi) { - var s = m1 * sin(m2 * phi), - c0 = sqrt(1 - s * s), - c1 = sqrt(2 / (1 + c0 * cos(lambda *= n))); - return [ - cx * c0 * c1 * sin(lambda), - cy * s * c1 - ]; - } - - forward.invert = function(x, y) { - var t1 = x / cx, - t2 = y / cy, - p = sqrt(t1 * t1 + t2 * t2), - c = 2 * asin(p / 2); - return [ - atan2(x * tan(c), cx * p) / n, - p && asin(y * sin(c) / (cy * m1 * p)) / m2 - ]; - }; - - return forward; -} - -function wagnerRaw(poleline, parallels, inflation, ratio) { - // 60 is always used as reference parallel - var phi1 = pi / 3; - - // sanitizing the input values - // poleline and parallels may approximate but never equal 0 - poleline = max(poleline, epsilon); - parallels = max(parallels, epsilon); - // poleline must be <= 90; parallels may approximate but never equal 180 - poleline = min(poleline, halfPi); - parallels = min(parallels, pi - epsilon); - // 0 <= inflation <= 99.999 - inflation = max(inflation, 0); - inflation = min(inflation, 100 - epsilon); - // ratio > 0. - // sensible values, i.e. something that renders a map which still can be - // recognized as world map, are e.g. 20 <= ratio <= 1000. - ratio = max(ratio, epsilon); - - // convert values from boehm notation - // areal inflation e.g. from 0 to 1 or 20 to 1.2: - var vinflation = inflation/100 + 1; - // axial ratio e.g. from 200 to 2: - var vratio = ratio / 100; - // the other ones are a bit more complicated... - var m2 = acos(vinflation * cos(phi1)) / phi1, - m1 = sin(poleline) / sin(m2 * halfPi), - n = parallels / pi, - k = sqrt(vratio * sin(poleline / 2) / sin(parallels / 2)), - cx = k / sqrt(n * m1 * m2), - cy = 1 / (k * sqrt(n * m1 * m2)); - - return wagnerFormula(cx, cy, m1, m2, n); -} - -function wagner() { - // default values generate wagner8 - var poleline = 65 * radians, - parallels = 60 * radians, - inflation = 20, - ratio = 200, - mutate = d3Geo.geoProjectionMutator(wagnerRaw), - projection = mutate(poleline, parallels, inflation, ratio); - - projection.poleline = function(_) { - return arguments.length ? mutate(poleline = +_ * radians, parallels, inflation, ratio) : poleline * degrees; - }; - - projection.parallels = function(_) { - return arguments.length ? mutate(poleline, parallels = +_ * radians, inflation, ratio) : parallels * degrees; - }; - projection.inflation = function(_) { - return arguments.length ? mutate(poleline, parallels, inflation = +_, ratio) : inflation; - }; - projection.ratio = function(_) { - return arguments.length ? mutate(poleline, parallels, inflation, ratio = +_) : ratio; - }; - - return projection - .scale(163.775); -} - -function wagner7() { - return wagner() - .poleline(65) - .parallels(60) - .inflation(0) - .ratio(200) - .scale(172.633); -} - -var A = 4 * pi + 3 * sqrt(3), - B = 2 * sqrt(2 * pi * sqrt(3) / A); - -var wagner4Raw = mollweideBromleyRaw(B * sqrt(3) / pi, B, A / 6); - -function wagner4() { - return d3Geo.geoProjection(wagner4Raw) - .scale(176.84); -} - -function wagner6Raw(lambda, phi) { - return [lambda * sqrt(1 - 3 * phi * phi / (pi * pi)), phi]; -} - -wagner6Raw.invert = function(x, y) { - return [x / sqrt(1 - 3 * y * y / (pi * pi)), y]; -}; - -function wagner6() { - return d3Geo.geoProjection(wagner6Raw) - .scale(152.63); -} - -function wiechelRaw(lambda, phi) { - var cosPhi = cos(phi), - sinPhi = cos(lambda) * cosPhi, - sin1_Phi = 1 - sinPhi, - cosLambda = cos(lambda = atan2(sin(lambda) * cosPhi, -sin(phi))), - sinLambda = sin(lambda); - cosPhi = sqrt(1 - sinPhi * sinPhi); - return [ - sinLambda * cosPhi - cosLambda * sin1_Phi, - -cosLambda * cosPhi - sinLambda * sin1_Phi - ]; -} - -wiechelRaw.invert = function(x, y) { - var w = (x * x + y * y) / -2, - k = sqrt(-w * (2 + w)), - b = y * w + x * k, - a = x * w - y * k, - D = sqrt(a * a + b * b); - return [ - atan2(k * b, D * (1 + w)), - D ? -asin(k * a / D) : 0 - ]; -}; - -function wiechel() { - return d3Geo.geoProjection(wiechelRaw) - .rotate([0, -90, 45]) - .scale(124.75) - .clipAngle(180 - 1e-3); -} - -function winkel3Raw(lambda, phi) { - var coordinates = aitoffRaw(lambda, phi); - return [ - (coordinates[0] + lambda / halfPi) / 2, - (coordinates[1] + phi) / 2 - ]; -} - -winkel3Raw.invert = function(x, y) { - var lambda = x, phi = y, i = 25; - do { - var cosphi = cos(phi), - sinphi = sin(phi), - sin_2phi = sin(2 * phi), - sin2phi = sinphi * sinphi, - cos2phi = cosphi * cosphi, - sinlambda = sin(lambda), - coslambda_2 = cos(lambda / 2), - sinlambda_2 = sin(lambda / 2), - sin2lambda_2 = sinlambda_2 * sinlambda_2, - C = 1 - cos2phi * coslambda_2 * coslambda_2, - E = C ? acos(cosphi * coslambda_2) * sqrt(F = 1 / C) : F = 0, - F, - fx = 0.5 * (2 * E * cosphi * sinlambda_2 + lambda / halfPi) - x, - fy = 0.5 * (E * sinphi + phi) - y, - dxdlambda = 0.5 * F * (cos2phi * sin2lambda_2 + E * cosphi * coslambda_2 * sin2phi) + 0.5 / halfPi, - dxdphi = F * (sinlambda * sin_2phi / 4 - E * sinphi * sinlambda_2), - dydlambda = 0.125 * F * (sin_2phi * sinlambda_2 - E * sinphi * cos2phi * sinlambda), - dydphi = 0.5 * F * (sin2phi * coslambda_2 + E * sin2lambda_2 * cosphi) + 0.5, - denominator = dxdphi * dydlambda - dydphi * dxdlambda, - dlambda = (fy * dxdphi - fx * dydphi) / denominator, - dphi = (fx * dydlambda - fy * dxdlambda) / denominator; - lambda -= dlambda, phi -= dphi; - } while ((abs(dlambda) > epsilon || abs(dphi) > epsilon) && --i > 0); - return [lambda, phi]; -}; - -function winkel3() { - return d3Geo.geoProjection(winkel3Raw) - .scale(158.837); -} - -exports.geoNaturalEarth = d3Geo.geoNaturalEarth1; -exports.geoNaturalEarthRaw = d3Geo.geoNaturalEarth1Raw; -exports.geoAiry = airy; -exports.geoAiryRaw = airyRaw; -exports.geoAitoff = aitoff; -exports.geoAitoffRaw = aitoffRaw; -exports.geoArmadillo = armadillo; -exports.geoArmadilloRaw = armadilloRaw; -exports.geoAugust = august; -exports.geoAugustRaw = augustRaw; -exports.geoBaker = baker; -exports.geoBakerRaw = bakerRaw; -exports.geoBerghaus = berghaus; -exports.geoBerghausRaw = berghausRaw; -exports.geoBertin1953 = bertin; -exports.geoBertin1953Raw = bertin1953Raw; -exports.geoBoggs = boggs; -exports.geoBoggsRaw = boggsRaw; -exports.geoBonne = bonne; -exports.geoBonneRaw = bonneRaw; -exports.geoBottomley = bottomley; -exports.geoBottomleyRaw = bottomleyRaw; -exports.geoBromley = bromley; -exports.geoBromleyRaw = bromleyRaw; -exports.geoChamberlin = chamberlin; -exports.geoChamberlinRaw = chamberlinRaw; -exports.geoChamberlinAfrica = chamberlinAfrica; -exports.geoCollignon = collignon; -exports.geoCollignonRaw = collignonRaw; -exports.geoCraig = craig; -exports.geoCraigRaw = craigRaw; -exports.geoCraster = craster; -exports.geoCrasterRaw = crasterRaw; -exports.geoCylindricalEqualArea = cylindricalEqualArea; -exports.geoCylindricalEqualAreaRaw = cylindricalEqualAreaRaw; -exports.geoCylindricalStereographic = cylindricalStereographic; -exports.geoCylindricalStereographicRaw = cylindricalStereographicRaw; -exports.geoEckert1 = eckert1; -exports.geoEckert1Raw = eckert1Raw; -exports.geoEckert2 = eckert2; -exports.geoEckert2Raw = eckert2Raw; -exports.geoEckert3 = eckert3; -exports.geoEckert3Raw = eckert3Raw; -exports.geoEckert4 = eckert4; -exports.geoEckert4Raw = eckert4Raw; -exports.geoEckert5 = eckert5; -exports.geoEckert5Raw = eckert5Raw; -exports.geoEckert6 = eckert6; -exports.geoEckert6Raw = eckert6Raw; -exports.geoEisenlohr = eisenlohr; -exports.geoEisenlohrRaw = eisenlohrRaw; -exports.geoFahey = fahey; -exports.geoFaheyRaw = faheyRaw; -exports.geoFoucaut = foucaut; -exports.geoFoucautRaw = foucautRaw; -exports.geoFoucautSinusoidal = foucautSinusoidal; -exports.geoFoucautSinusoidalRaw = foucautSinusoidalRaw; -exports.geoGilbert = gilbert; -exports.geoGingery = gingery; -exports.geoGingeryRaw = gingeryRaw; -exports.geoGinzburg4 = ginzburg4; -exports.geoGinzburg4Raw = ginzburg4Raw; -exports.geoGinzburg5 = ginzburg5; -exports.geoGinzburg5Raw = ginzburg5Raw; -exports.geoGinzburg6 = ginzburg6; -exports.geoGinzburg6Raw = ginzburg6Raw; -exports.geoGinzburg8 = ginzburg8; -exports.geoGinzburg8Raw = ginzburg8Raw; -exports.geoGinzburg9 = ginzburg9; -exports.geoGinzburg9Raw = ginzburg9Raw; -exports.geoGringorten = gringorten; -exports.geoGringortenRaw = gringortenRaw; -exports.geoGuyou = guyou; -exports.geoGuyouRaw = guyouRaw; -exports.geoHammer = hammer; -exports.geoHammerRaw = hammerRaw; -exports.geoHammerRetroazimuthal = hammerRetroazimuthal; -exports.geoHammerRetroazimuthalRaw = hammerRetroazimuthalRaw; -exports.geoHealpix = healpix; -exports.geoHealpixRaw = healpixRaw; -exports.geoHill = hill; -exports.geoHillRaw = hillRaw; -exports.geoHomolosine = homolosine; -exports.geoHomolosineRaw = homolosineRaw; -exports.geoHufnagel = hufnagel; -exports.geoHufnagelRaw = hufnagelRaw; -exports.geoHyperelliptical = hyperelliptical; -exports.geoHyperellipticalRaw = hyperellipticalRaw; -exports.geoInterrupt = interrupt; -exports.geoInterruptedBoggs = boggs$1; -exports.geoInterruptedHomolosine = homolosine$1; -exports.geoInterruptedMollweide = mollweide$1; -exports.geoInterruptedMollweideHemispheres = mollweideHemispheres; -exports.geoInterruptedSinuMollweide = sinuMollweide$1; -exports.geoInterruptedSinusoidal = sinusoidal$1; -exports.geoKavrayskiy7 = kavrayskiy7; -exports.geoKavrayskiy7Raw = kavrayskiy7Raw; -exports.geoLagrange = lagrange; -exports.geoLagrangeRaw = lagrangeRaw; -exports.geoLarrivee = larrivee; -exports.geoLarriveeRaw = larriveeRaw; -exports.geoLaskowski = laskowski; -exports.geoLaskowskiRaw = laskowskiRaw; -exports.geoLittrow = littrow; -exports.geoLittrowRaw = littrowRaw; -exports.geoLoximuthal = loximuthal; -exports.geoLoximuthalRaw = loximuthalRaw; -exports.geoMiller = miller; -exports.geoMillerRaw = millerRaw; -exports.geoModifiedStereographic = modifiedStereographic; -exports.geoModifiedStereographicRaw = modifiedStereographicRaw; -exports.geoModifiedStereographicAlaska = modifiedStereographicAlaska; -exports.geoModifiedStereographicGs48 = modifiedStereographicGs48; -exports.geoModifiedStereographicGs50 = modifiedStereographicGs50; -exports.geoModifiedStereographicMiller = modifiedStereographicMiller; -exports.geoModifiedStereographicLee = modifiedStereographicLee; -exports.geoMollweide = mollweide; -exports.geoMollweideRaw = mollweideRaw; -exports.geoMtFlatPolarParabolic = mtFlatPolarParabolic; -exports.geoMtFlatPolarParabolicRaw = mtFlatPolarParabolicRaw; -exports.geoMtFlatPolarQuartic = mtFlatPolarQuartic; -exports.geoMtFlatPolarQuarticRaw = mtFlatPolarQuarticRaw; -exports.geoMtFlatPolarSinusoidal = mtFlatPolarSinusoidal; -exports.geoMtFlatPolarSinusoidalRaw = mtFlatPolarSinusoidalRaw; -exports.geoNaturalEarth2 = naturalEarth2; -exports.geoNaturalEarth2Raw = naturalEarth2Raw; -exports.geoNellHammer = nellHammer; -exports.geoNellHammerRaw = nellHammerRaw; -exports.geoInterruptedQuarticAuthalic = quarticAuthalic; -exports.geoNicolosi = nicolosi; -exports.geoNicolosiRaw = nicolosiRaw; -exports.geoPatterson = patterson; -exports.geoPattersonRaw = pattersonRaw; -exports.geoPolyconic = polyconic; -exports.geoPolyconicRaw = polyconicRaw; -exports.geoPolyhedral = polyhedral; -exports.geoPolyhedralButterfly = butterfly; -exports.geoPolyhedralCollignon = collignon$1; -exports.geoPolyhedralWaterman = waterman; -exports.geoProject = index; -exports.geoGringortenQuincuncial = gringorten$1; -exports.geoPeirceQuincuncial = peirce; -exports.geoPierceQuincuncial = peirce; -exports.geoQuantize = quantize; -exports.geoQuincuncial = quincuncial; -exports.geoRectangularPolyconic = rectangularPolyconic; -exports.geoRectangularPolyconicRaw = rectangularPolyconicRaw; -exports.geoRobinson = robinson; -exports.geoRobinsonRaw = robinsonRaw; -exports.geoSatellite = satellite; -exports.geoSatelliteRaw = satelliteRaw; -exports.geoSinuMollweide = sinuMollweide; -exports.geoSinuMollweideRaw = sinuMollweideRaw; -exports.geoSinusoidal = sinusoidal; -exports.geoSinusoidalRaw = sinusoidalRaw; -exports.geoStitch = stitch; -exports.geoTimes = times; -exports.geoTimesRaw = timesRaw; -exports.geoTwoPointAzimuthal = twoPointAzimuthal; -exports.geoTwoPointAzimuthalRaw = twoPointAzimuthalRaw; -exports.geoTwoPointAzimuthalUsa = twoPointAzimuthalUsa; -exports.geoTwoPointEquidistant = twoPointEquidistant; -exports.geoTwoPointEquidistantRaw = twoPointEquidistantRaw; -exports.geoTwoPointEquidistantUsa = twoPointEquidistantUsa; -exports.geoVanDerGrinten = vanDerGrinten; -exports.geoVanDerGrintenRaw = vanDerGrintenRaw; -exports.geoVanDerGrinten2 = vanDerGrinten2; -exports.geoVanDerGrinten2Raw = vanDerGrinten2Raw; -exports.geoVanDerGrinten3 = vanDerGrinten3; -exports.geoVanDerGrinten3Raw = vanDerGrinten3Raw; -exports.geoVanDerGrinten4 = vanDerGrinten4; -exports.geoVanDerGrinten4Raw = vanDerGrinten4Raw; -exports.geoWagner = wagner; -exports.geoWagner7 = wagner7; -exports.geoWagnerRaw = wagnerRaw; -exports.geoWagner4 = wagner4; -exports.geoWagner4Raw = wagner4Raw; -exports.geoWagner6 = wagner6; -exports.geoWagner6Raw = wagner6Raw; -exports.geoWiechel = wiechel; -exports.geoWiechelRaw = wiechelRaw; -exports.geoWinkel3 = winkel3; -exports.geoWinkel3Raw = winkel3Raw; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/d3-geo-projection/dist/d3-geo-projection.min.js b/node_modules/d3-geo-projection/dist/d3-geo-projection.min.js deleted file mode 100644 index 75cd727..0000000 --- a/node_modules/d3-geo-projection/dist/d3-geo-projection.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-geo-projection/ v2.9.0 Copyright 2020 Mike Bostock -!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("d3-geo"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-geo","d3-array"],r):r(n.d3=n.d3||{},n.d3,n.d3)}(this,function(n,r,e){"use strict";var t=Math.abs,o=Math.atan,i=Math.atan2,u=Math.cos,a=Math.exp,c=Math.floor,f=Math.log,l=Math.max,g=Math.min,v=Math.pow,s=Math.round,p=Math.sign||function(n){return n>0?1:n<0?-1:0},h=Math.sin,d=Math.tan,w=1e-6,y=1e-12,m=Math.PI,P=m/2,R=m/4,b=Math.SQRT1_2,j=G(2),M=G(m),E=2*m,S=180/m,k=m/180;function A(n){return n>1?P:n<-1?-P:Math.asin(n)}function x(n){return n>1?0:n<-1?m:Math.acos(n)}function G(n){return n>0?Math.sqrt(n):0}function C(n){return(a(n)-a(-n))/2}function N(n){return(a(n)+a(-n))/2}function F(n){var r=d(n/2),e=2*f(u(n/2))/(r*r);function o(n,r){var t=u(n),o=u(r),i=h(r),a=o*t,c=-((1-a?f((1+a)/2)/(1-a):-.5)+e/(1+a));return[c*o*h(n),c*i]}return o.invert=function(r,o){var a,c=G(r*r+o*o),l=-n/2,g=50;if(!c)return[0,0];do{var v=l/2,s=u(v),p=h(v),d=p/s,y=-f(t(s));l-=a=(2/d*y-e*d-c)/(-y/(p*p)+1-e/(2*s*s))*(s<0?.7:1)}while(t(a)>w&&--g>0);var m=h(l);return[i(r*m,c*u(l)),A(o*m/c)]},o}function z(n,r){var e=u(r),t=function(n){return n?n/Math.sin(n):1}(x(e*u(n/=2)));return[2*e*h(n)*t,h(r)*t]}function L(n){var r=h(n),e=u(n),o=n>=0?1:-1,a=d(o*n),c=(1+r-e)/2;function f(n,t){var f=u(t),l=u(n/=2);return[(1+f)*h(n),(o*t>-i(l,a)-.001?0:10*-o)+c+h(t)*e-(1+f)*r*l]}return f.invert=function(n,f){var l=0,g=0,v=50;do{var s=u(l),p=h(l),d=u(g),y=h(g),m=1+d,P=m*p-n,R=c+y*e-m*r*s-f,b=m*s/2,j=-p*y,M=r*m*p/2,E=e*d+r*s*y,S=j*M-E*b,k=(R*j-P*E)/S/2,A=(P*M-R*b)/S;t(A)>2&&(A/=2),l-=k,g-=A}while((t(k)>w||t(A)>w)&&--v>0);return o*g>-i(u(l),a)-.001?[2*l,g]:null},f}function H(n,r){var e=d(r/2),t=G(1-e*e),o=1+t*u(n/=2),i=h(n)*t/o,a=e/o,c=i*i,f=a*a;return[4/3*i*(3+c-3*f),4/3*a*(3+3*c-f)]}z.invert=function(n,r){if(!(n*n+4*r*r>m*m+w)){var e=n,o=r,i=25;do{var a,c=h(e),f=h(e/2),l=u(e/2),g=h(o),v=u(o),s=h(2*o),p=g*g,d=v*v,y=f*f,P=1-d*l*l,R=P?x(v*l)*G(a=1/P):a=0,b=2*R*v*f-n,j=R*g-r,M=a*(d*y+R*v*l*p),E=a*(.5*c*s-2*R*g*f),S=.25*a*(s*f-R*g*d*c),k=a*(p*l+R*y*v),A=E*S-k*M;if(!A)break;var C=(j*E-b*k)/A,N=(b*S-j*M)/A;e-=C,o-=N}while((t(C)>w||t(N)>w)&&--i>0);return[e,o]}},H.invert=function(n,r){if(r*=3/8,!(n*=3/8)&&t(r)>1)return null;var e=1+n*n+r*r,o=G((e-G(e*e-4*r*r))/2),a=A(o)/3,c=o?function(n){return f(n+G(n*n-1))}(t(r/o))/3:function(n){return f(n+G(n*n+1))}(t(n))/3,l=u(a),g=N(c),v=g*g-l*l;return[2*p(n)*i(C(c)*l,.25-v),2*p(r)*i(g*h(a),.25+v)]};var q=G(8),B=f(1+j);function W(n,r){var e=t(r);return eP){var c=i(a[1],a[0]),f=G(a[0]*a[0]+a[1]*a[1]),l=e*s((c-P)/e)+P,g=i(h(c-=l),2-u(c));c=l+A(m/f*h(g))-g,a[0]=f*u(c),a[1]=f*h(c)}return a}return a.invert=function(n,t){var a=G(n*n+t*t);if(a>P){var c=i(t,n),f=e*s((c-P)/e)+P,l=c>f?-1:1,g=a*u(f-c),v=1/d(l*x((g-m)/G(m*(m-2*g)+a*a)));c=f+2*o((v+l*G(v*v-3))/3),n=a*u(c),t=a*h(c)}return r.geoAzimuthalEquidistantRaw.invert(n,t)},a}function D(n,e){if(arguments.length<2&&(e=n),1===e)return r.geoAzimuthalEqualAreaRaw;if(e===1/0)return Q;function t(t,o){var i=r.geoAzimuthalEqualAreaRaw(t/e,o);return i[0]*=n,i}return t.invert=function(t,o){var i=r.geoAzimuthalEqualAreaRaw.invert(t/n,o);return i[0]*=e,i},t}function Q(n,r){return[n*u(r)/u(r/=2),2*h(r)]}function T(n,r,e){var o,i,u,a=100;e=void 0===e?0:+e,r=+r;do{(i=n(e))===(u=n(e+w))&&(u=i+w),e-=o=-1*w*(i-r)/(i-u)}while(a-- >0&&t(o)>w);return a<0?NaN:e}function V(n,r,e){return void 0===r&&(r=40),void 0===e&&(e=y),function(o,i,u,a){var c,f,l;u=void 0===u?0:+u,a=void 0===a?0:+a;for(var g=0;gc)u-=f/=2,a-=l/=2;else{c=h;var d=(u>0?-1:1)*e,w=(a>0?-1:1)*e,y=n(u+d,a),m=n(u,a+w),P=(y[0]-v[0])/d,R=(y[1]-v[1])/d,b=(m[0]-v[0])/w,j=(m[1]-v[1])/w,M=j*P-R*b,E=(t(M)<.5?.5:1)/M;if(u+=f=(p*b-s*j)*E,a+=l=(s*R-p*P)*E,t(f)0&&(a[1]*=1+c/1.5*a[0]*a[0]),a}return t.invert=V(t),t}function K(n,r){var e,o=n*h(r),i=30;do{r-=e=(r+h(r)-o)/(1+u(r))}while(t(e)>w&&--i>0);return r/2}function O(n,r,e){function t(t,o){return[n*t*u(o=K(e,o)),r*h(o)]}return t.invert=function(t,o){return o=A(o/r),[t/(n*u(o)),A((2*o+h(2*o))/e)]},t}W.invert=function(n,r){if((i=t(r))y&&--l>0);return[n/(u(c)*(q-1/h(c))),p(r)*c]},Q.invert=function(n,r){var e=2*A(r/2);return[n*u(e/2)/u(e),e]};var U=O(j/P,j,m);var J=2.00276,X=1.11072;function Y(n,r){var e=K(m,r);return[J*n/(1/u(r)+X/u(e)),(r+j*h(e))/J]}function Z(n){var e=0,t=r.geoProjectionMutator(n),o=t(e);return o.parallel=function(n){return arguments.length?t(e=n*k):e*S},o}function $(n,r){return[n*u(r),r]}function nn(n){if(!n)return $;var r=1/d(n);function e(e,t){var o=r+n-t,i=o?e*u(t)/o:o;return[o*h(i),r-o*u(i)]}return e.invert=function(e,t){var o=G(e*e+(t=r-t)*t),a=r+n-o;return[o/u(a)*i(e,t),a]},e}function rn(n){function r(r,e){var t=P-e,o=t?r*n*h(t)/t:t;return[t*h(o)/n,P-t*u(o)]}return r.invert=function(r,e){var t=r*n,o=P-e,u=G(t*t+o*o),a=i(t,o);return[(u?u/h(u):1)*a/n,P-u]},r}Y.invert=function(n,r){var e,o,i=J*r,a=r<0?-R:R,c=25;do{o=i-j*h(a),a-=e=(h(2*a)+2*a-m*h(o))/(2*u(2*a)+2+m*u(o)*j*u(a))}while(t(e)>w&&--c>0);return o=i-j*h(a),[n*(1/u(o)+X/u(a))/J,o]},$.invert=function(n,r){return[n/u(r),r]};var en=O(1,4/m,m);function tn(n,r,e,o,a,c){var f,l=u(c);if(t(n)>1||t(c)>1)f=x(e*a+r*o*l);else{var g=h(n/2),v=h(c/2);f=2*A(G(g*g+r*o*v*v))}return t(f)>w?[f,i(o*h(c),r*a-e*o*l)]:[0,0]}function on(n,r,e){return x((n*n+r*r-e*e)/(2*n*r))}function un(n){return n-2*m*c((n+m)/(2*m))}function an(n,r,e){for(var t,o=[[n[0],n[1],h(n[1]),u(n[1])],[r[0],r[1],h(r[1]),u(r[1])],[e[0],e[1],h(e[1]),u(e[1])]],i=o[2],a=0;a<3;++a,i=t)t=o[a],i.v=tn(t[1]-i[1],i[3],i[2],t[3],t[2],t[0]-i[0]),i.point=[0,0];var c=on(o[0].v[0],o[2].v[0],o[1].v[0]),f=on(o[0].v[0],o[1].v[0],o[2].v[0]),l=m-c;o[2].point[1]=0,o[0].point[0]=-(o[1].point[0]=o[0].v[0]/2);var g=[o[2].point[0]=o[0].point[0]+o[2].v[0]*u(c),2*(o[0].point[1]=o[1].point[1]=o[2].v[0]*h(c))];return function(n,r){var e,t=h(r),i=u(r),a=new Array(3);for(e=0;e<3;++e){var c=o[e];if(a[e]=tn(r-c[1],c[3],c[2],i,t,n-c[0]),!a[e][0])return c.point;a[e][1]=un(a[e][1]-c.v[1])}var v=g.slice();for(e=0;e<3;++e){var s=2==e?0:e+1,p=on(o[e].v[0],a[e][0],a[s][0]);a[e][1]<0&&(p=-p),e?1==e?(p=f-p,v[0]-=a[e][0]*u(p),v[1]-=a[e][0]*h(p)):(p=l-p,v[0]+=a[e][0]*u(p),v[1]+=a[e][0]*h(p)):(v[0]+=a[e][0]*u(p),v[1]-=a[e][0]*h(p))}return v[0]/=3,v[1]/=3,v}}function cn(n){return n[0]*=k,n[1]*=k,n}function fn(n,e,t){var o=r.geoCentroid({type:"MultiPoint",coordinates:[n,e,t]}),i=[-o[0],-o[1]],u=r.geoRotation(i),a=an(cn(u(n)),cn(u(e)),cn(u(t)));a.invert=V(a);var c=r.geoProjection(a).rotate(i),f=c.center;return delete c.rotate,c.center=function(n){return arguments.length?f(u(n)):u.invert(f())},c.clipAngle(90)}function ln(n,r){var e=G(1-h(r));return[2/M*n*e,M*(1-e)]}function gn(n){var r=d(n);function e(n,e){return[n,(n?n/h(n):1)*(h(e)*u(n)-r*u(e))]}return e.invert=r?function(n,e){n&&(e*=h(n)/n);var t=u(n);return[n,2*i(G(t*t+r*r-e*e)-t,r-e)]}:function(n,r){return[n,A(n?r*d(n)/n:r)]},e}ln.invert=function(n,r){var e=(e=r/M-1)*e;return[e>0?n*G(m/e)/2:0,A(1-e)]};var vn=G(3);function sn(n,r){return[vn*n*(2*u(2*r/3)-1)/M,vn*M*h(r/3)]}function pn(n){var r=u(n);function e(n,e){return[n*r,h(e)/r]}return e.invert=function(n,e){return[n/r,A(e*r)]},e}function hn(n){var r=u(n);function e(n,e){return[n*r,(1+r)*d(e/2)]}return e.invert=function(n,e){return[n/r,2*o(e/(1+r))]},e}function dn(n,r){var e=G(8/(3*m));return[e*n*(1-t(r)/m),e*r]}function wn(n,r){var e=G(4-3*h(t(r)));return[2/G(6*m)*n*e,p(r)*G(2*m/3)*(2-e)]}function yn(n,r){var e=G(m*(4+m));return[2/e*n*(1+G(1-4*r*r/(m*m))),4/e*r]}function mn(n,r){var e=(2+P)*h(r);r/=2;for(var o=0,i=1/0;o<10&&t(i)>w;o++){var a=u(r);r-=i=(r+h(r)*(a+2)-e)/(2*a*(1+a))}return[2/G(m*(4+m))*n*(1+u(r)),2*G(m/(4+m))*h(r)]}function Pn(n,r){return[n*(1+u(r))/G(2+m),2*r/G(2+m)]}function Rn(n,r){for(var e=(1+P)*h(r),o=0,i=1/0;o<10&&t(i)>w;o++)r-=i=(r+h(r)-e)/(1+u(r));return e=G(2+m),[n*(1+u(r))/e,2*r/e]}sn.invert=function(n,r){var e=3*A(r/(vn*M));return[M*n/(vn*(2*u(2*e/3)-1)),e]},dn.invert=function(n,r){var e=G(8/(3*m)),o=r/e;return[n/(e*(1-t(o)/m)),o]},wn.invert=function(n,r){var e=2-t(r)/G(2*m/3);return[n*G(6*m)/(2*e),p(r)*A((4-e*e)/3)]},yn.invert=function(n,r){var e=G(m*(4+m))/2;return[n*e/(1+G(1-r*r*(4+m)/(4*m))),r*e/2]},mn.invert=function(n,r){var e=r*G((4+m)/m)/2,t=A(e),o=u(t);return[n/(2/G(m*(4+m))*(1+o)),A((t+e*(o+2))/(2+P))]},Pn.invert=function(n,r){var e=G(2+m),t=r*e/2;return[e*n/(1+u(t)),t]},Rn.invert=function(n,r){var e=1+P,t=G(e/2);return[2*n*t/(1+u(r*=t)),A((r+h(r))/e)]};var bn=3+2*j;function jn(n,r){var e=h(n/=2),t=u(n),i=G(u(r)),a=u(r/=2),c=h(r)/(a+j*t*i),l=G(2/(1+c*c)),g=G((j*a+(t+e)*i)/(j*a+(t-e)*i));return[bn*(l*(g-1/g)-2*f(g)),bn*(l*c*(g+1/g)-2*o(c))]}jn.invert=function(n,r){if(!(e=H.invert(n/1.2,1.065*r)))return null;var e,i=e[0],a=e[1],c=20;n/=bn,r/=bn;do{var v=i/2,s=a/2,p=h(v),d=u(v),y=h(s),m=u(s),R=u(a),M=G(R),E=y/(m+j*d*M),S=E*E,k=G(2/(1+S)),A=(j*m+(d+p)*M)/(j*m+(d-p)*M),x=G(A),C=x-1/x,N=x+1/x,F=k*C-2*f(x)-n,z=k*E*N-2*o(E)-r,L=y&&b*M*p*S/y,q=(j*d*m+M)/(2*(m+j*d*M)*(m+j*d*M)*M),B=-.5*E*k*k*k,W=B*L,I=B*q,D=(D=2*m+j*M*(d-p))*D*x,Q=(j*d*m*M+R)/D,T=-j*p*y/(M*D),V=C*W-2*Q/x+k*(Q+Q/A),_=C*I-2*T/x+k*(T+T/A),K=E*N*W-2*L/(1+S)+k*N*L+k*E*(Q-Q/A),O=E*N*I-2*q/(1+S)+k*N*q+k*E*(T-T/A),U=_*K-O*V;if(!U)break;var J=(z*_-F*O)/U,X=(F*K-z*V)/U;i-=J,a=l(-P,g(P,a-X))}while((t(J)>w||t(X)>w)&&--c>0);return t(t(a)-P)a){var p=G(v),d=i(g,l),y=o*s(d/o),R=d-y,b=n*u(R),j=(n*h(R)-R*h(b))/(P-b),M=Cn(R,j),E=(m-n)/Nn(M,b,m);l=p;var S,k=50;do{l-=S=(n+Nn(M,b,l)*E-p)/(M(l)*E)}while(t(S)>w&&--k>0);g=R*h(l),la){var l=G(f),g=i(c,e),v=o*s(g/o),p=g-v;e=l*u(p),c=l*h(p);for(var d=e-P,w=h(e),R=c/w,b=ew||t(s)>w)&&--y>0);return[p,d]},l}En.invert=function(n,r){var e=r/(1+Mn);return[n&&n/(Mn*G(1-e*e)),2*o(e)]},Sn.invert=function(n,r){var e=o(r/M),t=u(e),i=2*e;return[n*M/2/(u(i)*t*t),i]};var zn=Fn(2.8284,-1.6988,.75432,-.18071,1.76003,-.38914,.042555);var Ln=Fn(2.583819,-.835827,.170354,-.038094,1.543313,-.411435,.082742);var Hn=Fn(5/6*m,-.62636,-.0344,0,1.3493,-.05524,0,.045);function qn(n,r){var e=n*n,t=r*r;return[n*(1-.162388*t)*(.87-952426e-9*e*e),r*(1+t/12)]}qn.invert=function(n,r){var e,o=n,i=r,u=50;do{var a=i*i;i-=e=(i*(1+a/12)-r)/(1+a/4)}while(t(e)>w&&--u>0);u=50,n/=1-.162388*a;do{var c=(c=o*o)*c;o-=e=(o*(.87-952426e-9*c)-n)/(.87-.00476213*c)}while(t(e)>w&&--u>0);return[o,i]};var Bn=Fn(2.6516,-.76534,.19123,-.047094,1.36289,-.13965,.031762);function Wn(n){var r=n(P,0)[0]-n(-P,0)[0];function e(e,t){var o=e>0?-.5:.5,i=n(e+o*m,t);return i[0]-=o*r,i}return n.invert&&(e.invert=function(e,t){var o=e>0?-.5:.5,i=n.invert(e+o*r,t),u=i[0]-o*m;return u<-m?u+=2*m:u>m&&(u-=2*m),i[0]=u,i}),e}function In(n,r){var e=p(n),o=p(r),a=u(r),c=u(n)*a,f=h(n)*a,l=h(o*r);n=t(i(f,l)),r=A(c),t(n-P)>w&&(n%=P);var g=function(n,r){if(r===P)return[0,0];var e,o,i=h(r),a=i*i,c=a*a,f=1+c,l=1+3*c,g=1-c,v=A(1/G(f)),s=g+a*f*v,p=(1-i)/s,d=G(p),y=p*f,R=G(y),b=d*g;if(0===n)return[0,-(b+a*R)];var j,M=u(r),E=1/M,S=2*i*M,k=(-s*M-(-3*a+v*l)*S*(1-i))/(s*s),x=-E*S,C=-E*(a*f*k+p*l*S),N=-2*E*(g*(.5*k/d)-2*a*d*S),F=4*n/m;if(n>.222*m||r.175*m){if(e=(b+a*G(y*(1+c)-b*b))/(1+c),n>m/4)return[e,e];var z=e,L=.5*e;e=.5*(L+z),o=50;do{var H=G(y-e*e),q=e*(N+x*H)+C*A(e/R)-F;if(!q)break;q<0?L=e:z=e,e=.5*(L+z)}while(t(z-L)>w&&--o>0)}else{e=w,o=25;do{var B=e*e,W=G(y-B),I=N+x*W,D=e*I+C*A(e/R)-F,Q=I+(C-x*B)/W;e-=j=W?D/Q:0}while(t(j)>w&&--o>0)}return[e,-b-a*G(y-e*e)]}(n>m/4?P-n:n,r);return n>m/4&&(l=g[0],g[0]=-g[1],g[1]=-l),g[0]*=e,g[1]*=-o,g}function Dn(n,r){var e,i,c,f,l,g;if(r=1-w)return e=(1-r)/4,c=1/(i=N(n)),[(f=((g=a(2*(g=n)))-1)/(g+1))+e*((l=i*C(n))-n)/(i*i),c-e*f*c*(l-n),c+e*f*c*(l+n),2*o(a(n))-P+e*(l-n)/i];var v=[1,0,0,0,0,0,0,0,0],s=[G(r),0,0,0,0,0,0,0,0],p=0;for(i=G(1-r),l=1;t(s[p]/v[p])>w&&p<8;)e=v[p++],s[p]=(e-i)/2,v[p]=(e+i)/2,i=G(e*i),l*=2;c=l*v[p]*n;do{c=(A(f=s[p]*h(i=c)/v[p])+c)/2}while(--p);return[h(c),f=u(c),f/u(c-i),c]}function Qn(n,r){if(!r)return n;if(1===r)return f(d(n/2+R));for(var e=1,i=G(1-r),u=G(r),a=0;t(u)>w;a++){if(n%m){var c=o(i*d(n)/e);c<0&&(c+=m),n+=c+~~(n/m)*m}else n+=n;u=(e+i)/2,i=G(e*i),u=((e=u)-i)/2}return n/(v(2,a)*e)}function Tn(n,r){var e=(j-1)/(j+1),c=G(1-e*e),l=Qn(P,c*c),g=f(d(m/4+t(r)/2)),v=a(-1*g)/G(e),s=function(n,r){var e=n*n,t=r+1,o=1-e-r*r;return[.5*((n>=0?P:-P)-i(o,2*n)),-.25*f(o*o+4*e)+.5*f(t*t+e)]}(v*u(-1*n),v*h(-1*n)),w=function(n,r,e){var i=t(n),u=C(t(r));if(i){var a=1/h(i),c=1/(d(i)*d(i)),f=-(c+e*(u*u*a*a)-1+e),l=(-f+G(f*f-(e-1)*c*4))/2;return[Qn(o(1/G(l)),e)*p(n),Qn(o(G((l/c-1)/e)),1-e)*p(r)]}return[0,Qn(o(u),1-e)*p(r)]}(s[0],s[1],c*c);return[-w[1],(r>=0?1:-1)*(.5*l-w[0])]}function Vn(n){var r=h(n),e=u(n),o=_n(n);function a(n,i){var a=o(n,i);n=a[0],i=a[1];var c=h(i),f=u(i),l=u(n),g=x(r*c+e*f*l),v=h(g),s=t(v)>w?g/v:1;return[s*e*h(n),(t(n)>P?s:-s)*(r*f-e*c*l)]}return o.invert=_n(-n),a.invert=function(n,e){var t=G(n*n+e*e),a=-h(t),c=u(t),f=t*c,l=-e*a,g=t*r,v=G(f*f+l*l-g*g),s=i(f*g+l*v,l*g-f*v),p=(t>P?-1:1)*i(n*a,t*u(s)*c+e*h(s)*a);return o.invert(p,s)},a}function _n(n){var r=h(n),e=u(n);return function(n,t){var o=u(t),a=u(n)*o,c=h(n)*o,f=h(t);return[i(c,a*e-f*r),A(f*e+a*r)]}}In.invert=function(n,r){t(n)>1&&(n=2*p(n)-n),t(r)>1&&(r=2*p(r)-r);var e=p(n),o=p(r),a=-e*n,c=-o*r,f=c/a<1,l=function(n,r){var e=0,o=1,i=.5,a=50;for(;;){var c=i*i,f=G(i),l=A(1/G(1+c)),g=1-c+i*(1+c)*l,v=(1-f)/g,s=G(v),p=v*(1+c),h=s*(1-c),d=p-n*n,w=G(d),P=r+h+i*w;if(t(o-e)0?e=i:o=i,i=.5*(e+o)}if(!a)return null;var R=A(f),b=u(R),j=1/b,M=2*f*b,E=(-g*b-(-3*i+l*(1+3*c))*M*(1-f))/(g*g);return[m/4*(n*(-2*j*(.5*E/s*(1-c)-2*i*s*M)+-j*M*w)+-j*(i*(1+c)*E+v*(1+3*c)*M)*A(n/G(p))),R]}(f?c:a,f?a:c),g=l[0],v=l[1],s=u(v);return f&&(g=-P-g),[e*(i(h(g)*s,-h(v))+m),o*A(u(g)*s)]},Tn.invert=function(n,r){var e,t,u,c,l,g,v=(j-1)/(j+1),s=G(1-v*v),p=Qn(P,s*s),h=(t=-n,u=s*s,(e=.5*p-r)?(c=Dn(e,u),t?(g=(l=Dn(t,1-u))[1]*l[1]+u*c[0]*c[0]*l[0]*l[0],[[c[0]*l[2]/g,c[1]*c[2]*l[0]*l[1]/g],[c[1]*l[1]/g,-c[0]*c[2]*l[0]*l[2]/g],[c[2]*l[1]*l[2]/g,-u*c[0]*c[1]*l[0]/g]]):[[c[0],0],[c[1],0],[c[2],0]]):[[0,(l=Dn(t,1-u))[0]/l[1]],[1/l[1],0],[l[2]/l[1],0]]),d=function(n,r){var e=r[0]*r[0]+r[1]*r[1];return[(n[0]*r[0]+n[1]*r[1])/e,(n[1]*r[0]-n[0]*r[1])/e]}(h[0],h[1]);return[i(d[1],d[0])/-1,2*o(a(-.5*f(v*d[0]*d[0]+v*d[1]*d[1])))-P]};var Kn=A(1-1/3)*S,On=pn(0);function Un(n){var r=Kn*k,e=ln(m,r)[0]-ln(-m,r)[0],o=On(0,r)[1],i=ln(0,r)[1],u=M-i,a=E/n,f=4/E,v=o+u*u*4/E;function s(s,p){var h,d=t(p);if(d>r){var w=g(n-1,l(0,c((s+m)/a)));(h=ln(s+=m*(n-1)/n-w*a,d))[0]=h[0]*E/e-E*(n-1)/(2*n)+w*E/n,h[1]=o+4*(h[1]-i)*u/E,p<0&&(h[1]=-h[1])}else h=On(s,p);return h[0]*=f,h[1]/=v,h}return s.invert=function(r,s){r/=f;var p=t(s*=v);if(p>o){var h=g(n-1,l(0,c((r+m)/a)));r=(r+m*(n-1)/n-h*a)*e/E;var d=ln.invert(r,.25*(p-o)*E/u+i);return d[0]-=m*(n-1)/n-h*a,s<0&&(d[1]=-d[1]),d}return On.invert(r,s)},s}function Jn(n,r){return[n,1&r?90-w:Kn]}function Xn(n,r){return[n,1&r?-90+w:-Kn]}function Yn(n){return[n[0]*(1-w),n[1]]}function Zn(n){var r,e=1+n,o=A(h(1/e)),a=2*G(m/(r=m+4*o*e)),c=.5*a*(e+G(n*(2+n))),f=n*n,l=e*e;function g(g,v){var s,p,d=1-h(v);if(d&&d<2){var w,R=P-v,b=25;do{var j=h(R),M=u(R),E=o+i(j,e-M),S=1+l-2*e*M;R-=w=(R-f*o-e*j+S*E-.5*d*r)/(2*e*j*E)}while(t(w)>y&&--b>0);s=a*G(S),p=g*E/m}else s=a*(n+d),p=g*o/m;return[s*h(p),c-s*u(p)]}return g.invert=function(n,t){var u=n*n+(t-=c)*t,g=(1+l-u/(a*a))/(2*e),v=x(g),s=h(v),p=o+i(s,e-g);return[A(n/G(u))*m/p,A(1-2*(v-f*o-e*s+(1+l-2*e*g)*p)/r)]},g}var $n=.7109889596207567,nr=.0528035274542;function rr(n,r){return r>-$n?((n=U(n,r))[1]+=nr,n):$(n,r)}function er(n,r){return t(r)>$n?((n=U(n,r))[1]-=r>0?nr:-nr,n):$(n,r)}function tr(n,r,e,t){var o=G(4*m/(2*e+(1+n-r/2)*h(2*e)+(n+r)/2*h(4*e)+r/2*h(6*e))),i=G(t*h(e)*G((1+n*u(2*e)+r*u(4*e))/(1+n+r))),a=e*f(1);function c(e){return G(1+n*u(2*e)+r*u(4*e))}function f(t){var o=t*e;return(2*o+(1+n-r/2)*h(2*o)+(n+r)/2*h(4*o)+r/2*h(6*o))/e}function l(n){return c(n)*h(n)}var g=function(n,r){var t=e*T(f,a*h(r)/e,r/m);isNaN(t)&&(t=e*p(r));var l=o*c(t);return[l*i*n/m*u(t),l/i*h(t)]};return g.invert=function(n,r){var t=T(l,r*i/o);return[n*m/(u(t)*o*i*c(t)),A(e*f(t/e)/a)]},0===e&&(o=G(t/m),(g=function(n,r){return[n*o,h(r)/o]}).invert=function(n,r){return[n/o,A(r*o)]}),g}function or(n,r,e,t,o){void 0===t&&(t=1e-8),void 0===o&&(o=20);var i=n(r),u=n(.5*(r+e)),a=n(e);return function n(r,e,t,o,i,u,a,c,f,l,g){if(g.nanEncountered)return NaN;var v,s,p,h,d,w,y,m,P,R;if(s=r(e+.25*(v=t-e)),p=r(t-.25*v),isNaN(s))g.nanEncountered=!0;else{if(!isNaN(p))return R=((w=(h=v*(o+4*s+i)/12)+(d=v*(i+4*p+u)/12))-a)/15,l>f?(g.maxDepthCount++,w+R):Math.abs(R)>1;do{f[t]>n?e=t:r=t,t=r+e>>1}while(t>r);var o=f[t+1]-f[t];return o&&(o=(n-f[t+1])/o),(t+1+o)/a}var s=2*g(1)/m*u/e,d=function(n,r){var e=g(t(h(r))),i=o(e)*n;return e/=s,[i,r>=0?e:-e]};return d.invert=function(n,r){var e;return t(r*=s)<1&&(e=p(r)*A(i(t(r))*u)),[n/o(t(r)),e]},d}function ur(n,r){return t(n[0]-r[0])i[u][2][0];++u);var c=n(r-i[u][1][0],e);return c[0]+=n(i[u][1][0],o*e>o*i[u][0][1]?i[u][0][1]:e)[0],c}o?a.invert=o(a):n.invert&&(a.invert=function(r,e){for(var o=u[+(e<0)],i=t[+(e<0)],c=0,f=o.length;c=0;--c)t=(r=n[1][c])[0][0],o=r[0][1],i=r[1][1],u=r[2][0],a=r[2][1],f.push(ar([[u-w,a-w],[u-w,i+w],[t+w,i+w],[t+w,o-w]],30));return{type:"Polygon",coordinates:[e.merge(f)]}}(r),t=r.map(function(n){return n.map(function(n){return[[n[0][0]*k,n[0][1]*k],[n[1][0]*k,n[1][1]*k],[n[2][0]*k,n[2][1]*k]]})}),u=t.map(function(r){return r.map(function(r){var e,t=n(r[0][0],r[0][1])[0],o=n(r[2][0],r[2][1])[0],i=n(r[1][0],r[0][1])[1],u=n(r[1][0],r[1][1])[1];return i>u&&(e=i,i=u,u=e),[[t,i],[o,u]]})}),c):t.map(function(n){return n.map(function(n){return[[n[0][0]*S,n[0][1]*S],[n[1][0]*S,n[1][1]*S],[n[2][0]*S,n[2][1]*S]]})})},null!=t&&c.lobes(t),c}rr.invert=function(n,r){return r>-$n?U.invert(n,r-nr):$.invert(n,r)},er.invert=function(n,r){return t(r)>$n?U.invert(n,r+(r>0?nr:-nr)):$.invert(n,r)};var fr=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];var lr=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];var gr=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];var vr=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]];var sr=[[[[-180,35],[-30,90],[0,35]],[[0,35],[30,90],[180,35]]],[[[-180,-10],[-102,-90],[-65,-10]],[[-65,-10],[5,-90],[77,-10]],[[77,-10],[103,-90],[180,-10]]]];var pr=[[[[-180,0],[-110,90],[-40,0]],[[-40,0],[0,90],[40,0]],[[40,0],[110,90],[180,0]]],[[[-180,0],[-110,-90],[-40,0]],[[-40,0],[0,-90],[40,0]],[[40,0],[110,-90],[180,0]]]];function hr(n,r){return[3/E*n*G(m*m/3-r*r),r]}function dr(n){function r(r,e){if(t(t(e)-P)2)return null;var u=(r/=2)*r,a=(e/=2)*e,c=2*e/(1+u+a);return c=v((1+c)/(1-c),1/n),[i(2*r,1-u-a)/n,A((c-1)/(c+1))]},r}hr.invert=function(n,r){return[E/3*n/G(m*m/3-r*r),r]};var wr=m/j;function yr(n,r){return[n*(1+G(u(r)))/2,r/(u(r/2)*u(n/6))]}function mr(n,r){var e=n*n,t=r*r;return[n*(.975534+t*(-.0143059*e-.119161+-.0547009*t)),r*(1.00384+e*(.0802894+-.02855*t+199025e-9*e)+t*(.0998909+-.0491032*t))]}function Pr(n,r){return[h(n)/u(r),d(r)*u(n)]}function Rr(n){var r=u(n),e=d(R+n/2);function o(o,i){var u=i-n,a=t(u)=0;)v=(g=n[l])[0]+c*(o=v)-f*s,s=g[1]+c*s+f*o;return[v=c*(o=v)-f*s,s=c*s+f*o]}return e.invert=function(e,a){var c=20,f=e,l=a;do{for(var g,v=r,s=n[v],p=s[0],d=s[1],y=0,m=0;--v>=0;)y=p+f*(g=y)-l*m,m=d+f*m+l*g,p=(s=n[v])[0]+f*(g=p)-l*d,d=s[1]+f*d+l*g;var P,R,b=(y=p+f*(g=y)-l*m)*y+(m=d+f*m+l*g)*m;f-=P=((p=f*(g=p)-l*d-e)*y+(d=f*d+l*g-a)*m)/b,l-=R=(d*y-p*m)/b}while(t(P)+t(R)>w*w&&--c>0);if(c){var j=G(f*f+l*l),M=2*o(.5*j),E=h(M);return[i(f*E,j*u(M)),j?A(l*E/j):0]}},e}yr.invert=function(n,r){var e=t(n),o=t(r),i=w,a=P;ow||t(P)>w)&&--i>0);return i&&[e,o]},Pr.invert=function(n,r){var e=n*n,t=r*r+1,o=e+t,i=n?b*G((o-G(o*o-4*e))/e):1/G(t);return[A(n*i),p(r)*x(i)]},br.invert=function(n,r){return[n,2.5*o(a(.8*r))-.625*m]};var Mr=[[.9972523,0],[.0052513,-.0041175],[.0074606,.0048125],[-.0153783,-.1968253],[.0636871,-.1408027],[.3660976,-.2937382]],Er=[[.98879,0],[0,0],[-.050909,0],[0,0],[.075528,0]],Sr=[[.984299,0],[.0211642,.0037608],[-.1036018,-.0575102],[-.0329095,-.0320119],[.0499471,.1223335],[.026046,.0899805],[7388e-7,-.1435792],[.0075848,-.1334108],[-.0216473,.0776645],[-.0225161,.0853673]],kr=[[.9245,0],[0,0],[.01943,0]],Ar=[[.721316,0],[0,0],[-.00881625,-.00617325]];function xr(n,e){var t=r.geoProjection(jr(n)).rotate(e).clipAngle(90),o=r.geoRotation(e),i=t.center;return delete t.rotate,t.center=function(n){return arguments.length?i(o(n)):o.invert(i())},t}var Gr=G(6),Cr=G(7);function Nr(n,r){var e=A(7*h(r)/(3*Gr));return[Gr*n*(2*u(2*e/3)-1)/Cr,9*h(e/3)/Cr]}function Fr(n,r){for(var e,o=(1+b)*h(r),i=r,a=0;a<25&&(i-=e=(h(i/2)+h(i)-o)/(.5*u(i/2)+u(i)),!(t(e)y&&--c>0);return[n/(.84719-.13063*(o=a*a)+(u=o*(i=o*o))*u*(.05494*o-.04515-.02326*i+.00331*u)),a]},Hr.invert=function(n,r){for(var e=r/2,o=0,i=1/0;o<10&&t(i)>w;++o){var a=u(r/2);r-=i=(r-d(r/2)-e)/(1-.5/(a*a))}return[2*n/(1+u(r)),r]};var qr=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]];function Br(n,r){var e=h(r),o=u(r),i=p(n);if(0===n||t(r)===P)return[0,r];if(0===r)return[n,0];if(t(n)===P)return[n*o,P*e];var a=m/(2*n)-2*n/m,c=2*r/m,f=(1-c*c)/(e-c),l=a*a,g=f*f,v=1+l/g,s=1+g/l,d=(a*e/f-a/2)/v,w=(g*e/l+f/2)/s,y=w*w-(g*e*e/l+f*e-1)/s;return[P*(d+G(d*d+o*o/v)*i),P*(w+G(y<0?0:y)*p(-r*a)*i)]}Br.invert=function(n,r){var e=(n/=P)*n,t=e+(r/=P)*r,o=m*m;return[n?(t-1+G((1-t)*(1-t)+4*e))/(2*n)*P:0,T(function(n){return t*(m*h(n)-2*n)*m+4*n*n*(r-h(n))+2*m*n-o*r},0)]};var Wr=1.0148,Ir=.23185,Dr=-.14499,Qr=.02406,Tr=Wr,Vr=5*Ir,_r=7*Dr,Kr=9*Qr;function Or(n,r){var e=r*r;return[n,r*(Wr+e*e*(Ir+e*(Dr+Qr*e)))]}function Ur(n,r){if(t(r)=0;)if(t=r[a],e[0]===t[0]&&e[1]===t[1]){if(i)return[i,e];i=e}}}(r.face,e.face),o=Jr(t.map(e.project),t.map(r.project));r.transform=e.transform?Xr(e.transform,o):o;for(var i=e.edges,u=0,a=i.length;u1.790857183?r=1.790857183:r<-1.790857183&&(r=-1.790857183);var e,o=r;do{var i=o*o;o-=e=(o*(Wr+i*i*(Ir+i*(Dr+Qr*i)))-r)/(Tr+i*i*(Vr+i*(_r+Kr*i)))}while(t(e)>w);return[n,o]},Ur.invert=function(n,r){if(t(r)w&&--a>0);return c=d(i),[(t(r)t^s>t&&e<(v-f)*(t-l)/(s-l)+f&&(o=!o)}return o}(n[0],e))return n.push(r),!0})||n.push([r])}),pe=[],n.length?n.length>1?{type:"MultiPolygon",coordinates:n}:{type:"Polygon",coordinates:n[0]}:null}};function ye(n){var e=n(P,0)[0]-n(-P,0)[0];function o(r,o){var i=t(r)0?r-m:r+m,o),a=(u[0]-u[1])*b,c=(u[0]+u[1])*b;if(i)return[a,c];var f=e*b,l=a>0^c>0?-1:1;return[l*a-p(c)*f,l*c-p(a)*f]}return n.invert&&(o.invert=function(r,o){var i=(r+o)*b,u=(o-r)*b,a=t(i)<.5*e&&t(u)<.5*e;if(!a){var c=e*b,f=i>0^u>0?-1:1,l=-f*r+(u>0?1:-1)*c,g=-f*o+(i>0?1:-1)*c;i=(-l-g)*b,u=(l-g)*b}var v=n.invert(i,u);return a||(v[0]+=i>0?m:-m),v}),r.geoProjection(o).rotate([-90,-90,45]).clipAngle(179.999)}function me(){return ye(Tn).scale(111.48)}function Pe(n){var r=h(n);function e(e,t){var i=r?d(e*r/2)/r:e/2;if(!t)return[2*i,-n];var a=2*o(i*h(t)),c=1/d(t);return[h(a)*c,t+(1-u(a))*c-n]}return e.invert=function(e,i){if(t(i+=n)w&&--l>0);var p=e*(g=d(f)),y=d(t(i)0?P:-P)*(v+u*(p-f)/2+u*u*(p-2*v+f)/2)]}function je(n,r){var e=function(n){function r(r,e){var t=u(e),o=(n-1)/(n-t*u(r));return[o*t*h(r),o*h(e)]}return r.invert=function(r,e){var t=r*r+e*e,o=G(t),u=(n-G(1-t*(n+1)/(n-1)))/((n-1)/o+o/(n-1));return[i(r*u,o*G(1-u*u)),o?A(e*u/o):0]},r}(n);if(!r)return e;var t=u(r),o=h(r);function a(r,i){var u=e(r,i),a=u[1],c=a*o/(n-1)+t;return[u[0]*t/c,a/c]}return a.invert=function(r,i){var u=(n-1)/(n-1-i*o);return e.invert(u*r,u*i*t)},a}Re.forEach(function(n){n[1]*=1.0144}),be.invert=function(n,r){var e=r/P,o=90*e,i=g(18,t(o/5)),u=l(0,c(i));do{var a=Re[u][1],f=Re[u+1][1],v=Re[g(19,u+2)][1],s=v-a,p=v-2*f+a,h=2*(t(e)-f)/s,d=p/s,w=h*(1-d*h*(1-2*d*h));if(w>=0||1===u){o=(r>=0?5:-5)*(w+i);var m,R=50;do{w=(i=g(18,t(o)/5))-(u=c(i)),a=Re[u][1],f=Re[u+1][1],v=Re[g(19,u+2)][1],o-=(m=(r>=0?P:-P)*(f+w*(v-a)/2+w*w*(v-2*f+a)/2)-r)*S}while(t(m)>y&&--R>0);break}}while(--u>=0);var b=Re[u][0],j=Re[u+1][0],M=Re[g(19,u+2)][0];return[n/(j+w*(M-b)/2+w*w*(M-2*j+b)/2),o*k]};var Me=1e4,Ee=-180,Se=Ee+1e-4,ke=180,Ae=ke-1e-4,xe=-90,Ge=xe+1e-4,Ce=90,Ne=Ce-1e-4;function Fe(n){return n.length>0}function ze(n){return n===xe||n===Ce?[0,n]:[Ee,(r=n,Math.floor(r*Me)/Me)];var r}function Le(n){var r=n[0],e=n[1],t=!1;return r<=Se?(r=Ee,t=!0):r>=Ae&&(r=ke,t=!0),e<=Ge?(e=xe,t=!0):e>=Ne&&(e=Ce,t=!0),t?[r,e]:n}function He(n){return n.map(Le)}function qe(n,r,e){for(var t=0,o=n.length;t=Ae||l<=Ge||l>=Ne){i[u]=Le(c);for(var g=u+1;gSe&&sGe&&p=a)break;e.push({index:-1,polygon:r,ring:i=i.slice(g-1)}),i[0]=ze(i[0][1]),u=-1,a=i.length}}}}function Be(n){var r,e,t,o,i,u,a=n.length,c={},f={};for(r=0;r0?m-c:c)*S],l=r.geoProjection(n(a)).rotate(f),g=r.geoRotation(f),v=l.center;return delete l.rotate,l.center=function(n){return arguments.length?v(g(n)):g.invert(v())},l.clipAngle(90)}function Te(n){var e=u(n);function t(n,t){var o=r.geoGnomonicRaw(n,t);return o[0]*=e,o}return t.invert=function(n,t){return r.geoGnomonicRaw.invert(n/e,t)},t}function Ve(n,r){return Qe(Te,n,r)}function _e(n){if(!(n*=2))return r.geoAzimuthalEquidistantRaw;var e=-n/2,t=-e,o=n*n,a=d(t),c=.5/h(t);function f(r,i){var a=x(u(i)*u(r-e)),c=x(u(i)*u(r-t));return[((a*=a)-(c*=c))/(2*n),(i<0?-1:1)*G(4*o*c-(o-a+c)*(o-a+c))/(2*n)]}return f.invert=function(n,r){var o,f,l=r*r,g=u(G(l+(o=n+e)*o)),v=u(G(l+(o=n+t)*o));return[i(f=g-v,o=(g+v)*a),(r<0?-1:1)*x(G(o*o+f*f)*c)]},f}function Ke(n,r){return Qe(_e,n,r)}function Oe(n,r){if(t(r)w&&--c>0);return[p(n)*(G(i*i+4)+i)*m/4,P*a]};var $e=4*m+3*G(3),nt=2*G(2*m*G(3)/$e),rt=O(nt*G(3)/m,nt,$e/6);function et(n,r){return[n*G(1-3*r*r/(m*m)),r]}function tt(n,r){var e=u(r),t=u(n)*e,o=1-t,a=u(n=i(h(n)*e,-h(r))),c=h(n);return[c*(e=G(1-t*t))-a*o,-a*e-c*o]}function ot(n,r){var e=z(n,r);return[(e[0]+n/P)/2,(e[1]+r)/2]}et.invert=function(n,r){return[n/G(1-3*r*r/(m*m)),r]},tt.invert=function(n,r){var e=(n*n+r*r)/-2,t=G(-e*(2+e)),o=r*e+n*t,u=n*e-r*t,a=G(u*u+o*o);return[i(t*o,a*(1+e)),a?-A(t*u/a):0]},ot.invert=function(n,r){var e=n,o=r,i=25;do{var a,c=u(o),f=h(o),l=h(2*o),g=f*f,v=c*c,s=h(e),p=u(e/2),d=h(e/2),y=d*d,m=1-v*p*p,R=m?x(c*p)*G(a=1/m):a=0,b=.5*(2*R*c*d+e/P)-n,j=.5*(R*f+o)-r,M=.5*a*(v*y+R*c*p*g)+.5/P,E=a*(s*l/4-R*f*d),S=.125*a*(l*d-R*f*v*s),k=.5*a*(g*p+R*y*c)+.5,A=E*S-k*M,C=(j*E-b*k)/A,N=(b*S-j*M)/A;e-=C,o-=N}while((t(C)>w||t(N)>w)&&--i>0);return[e,o]},n.geoNaturalEarth=r.geoNaturalEarth1,n.geoNaturalEarthRaw=r.geoNaturalEarth1Raw,n.geoAiry=function(){var n=P,e=r.geoProjectionMutator(F),t=e(n);return t.radius=function(r){return arguments.length?e(n=r*k):n*S},t.scale(179.976).clipAngle(147)},n.geoAiryRaw=F,n.geoAitoff=function(){return r.geoProjection(z).scale(152.63)},n.geoAitoffRaw=z,n.geoArmadillo=function(){var n=20*k,e=n>=0?1:-1,t=d(e*n),o=r.geoProjectionMutator(L),a=o(n),c=a.stream;return a.parallel=function(r){return arguments.length?(t=d((e=(n=r*k)>=0?1:-1)*n),o(n)):n*S},a.stream=function(r){var o=a.rotate(),f=c(r),l=(a.rotate([0,0]),c(r)),g=a.precision();return a.rotate(o),f.sphere=function(){l.polygonStart(),l.lineStart();for(var r=-180*e;e*r<180;r+=90*e)l.point(r,90*e);if(n)for(;e*(r-=3*e*g)>=-180;)l.point(r,e*-i(u(r*k/2),t)*S);l.lineEnd(),l.polygonEnd()},f},a.scale(218.695).center([0,28.0974])},n.geoArmadilloRaw=L,n.geoAugust=function(){return r.geoProjection(H).scale(66.1603)},n.geoAugustRaw=H,n.geoBaker=function(){return r.geoProjection(W).scale(112.314)},n.geoBakerRaw=W,n.geoBerghaus=function(){var n=5,e=r.geoProjectionMutator(I),t=e(n),o=t.stream,a=-u(.01*k),c=h(.01*k);return t.lobes=function(r){return arguments.length?e(n=+r):n},t.stream=function(r){var e=t.rotate(),f=o(r),l=(t.rotate([0,0]),o(r));return t.rotate(e),f.sphere=function(){l.polygonStart(),l.lineStart();for(var r=0,e=360/n,t=2*m/n,o=90-180/n,f=P;r=0;)n.point((r=e[o])[0],r[1]);n.lineEnd(),n.polygonEnd()},n},t.scale(79.4187).parallel(45).clipAngle(179.999)},n.geoHammerRetroazimuthalRaw=Vn,n.geoHealpix=function(){var n=4,t=r.geoProjectionMutator(Un),o=t(n),i=o.stream;return o.lobes=function(r){return arguments.length?t(n=+r):n},o.stream=function(t){var u=o.rotate(),a=i(t),c=(o.rotate([0,0]),i(t));return o.rotate(u),a.sphere=function(){var t,o;r.geoStream((t=180/n,o=[].concat(e.range(-180,180+t/2,t).map(Jn),e.range(180,-180-t/2,-t).map(Xn)),{type:"Polygon",coordinates:[180===t?o.map(Yn):o]}),c)},a},o.scale(239.75)},n.geoHealpixRaw=Un,n.geoHill=function(){var n=1,e=r.geoProjectionMutator(Zn),t=e(n);return t.ratio=function(r){return arguments.length?e(n=+r):n},t.scale(167.774).center([0,18.67])},n.geoHillRaw=Zn,n.geoHomolosine=function(){return r.geoProjection(er).scale(152.63)},n.geoHomolosineRaw=er,n.geoHufnagel=function(){var n=1,e=0,t=45*k,o=2,i=r.geoProjectionMutator(tr),u=i(n,e,t,o);return u.a=function(r){return arguments.length?i(n=+r,e,t,o):n},u.b=function(r){return arguments.length?i(n,e=+r,t,o):e},u.psiMax=function(r){return arguments.length?i(n,e,t=+r*k,o):t*S},u.ratio=function(r){return arguments.length?i(n,e,t,o=+r):o},u.scale(180.739)},n.geoHufnagelRaw=tr,n.geoHyperelliptical=function(){var n=0,e=2.5,t=1.183136,o=r.geoProjectionMutator(ir),i=o(n,e,t);return i.alpha=function(r){return arguments.length?o(n=+r,e,t):n},i.k=function(r){return arguments.length?o(n,e=+r,t):e},i.gamma=function(r){return arguments.length?o(n,e,t=+r):t},i.scale(152.63)},n.geoHyperellipticalRaw=ir,n.geoInterrupt=cr,n.geoInterruptedBoggs=function(){return cr(Y,fr).scale(160.857)},n.geoInterruptedHomolosine=function(){return cr(er,lr).scale(152.63)},n.geoInterruptedMollweide=function(){return cr(U,gr).scale(169.529)},n.geoInterruptedMollweideHemispheres=function(){return cr(U,vr).scale(169.529).rotate([20,0])},n.geoInterruptedSinuMollweide=function(){return cr(rr,sr,V).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},n.geoInterruptedSinusoidal=function(){return cr($,pr).scale(152.63).rotate([-20,0])},n.geoKavrayskiy7=function(){return r.geoProjection(hr).scale(158.837)},n.geoKavrayskiy7Raw=hr,n.geoLagrange=function(){var n=.5,e=r.geoProjectionMutator(dr),t=e(n);return t.spacing=function(r){return arguments.length?e(n=+r):n},t.scale(124.75)},n.geoLagrangeRaw=dr,n.geoLarrivee=function(){return r.geoProjection(yr).scale(97.2672)},n.geoLarriveeRaw=yr,n.geoLaskowski=function(){return r.geoProjection(mr).scale(139.98)},n.geoLaskowskiRaw=mr,n.geoLittrow=function(){return r.geoProjection(Pr).scale(144.049).clipAngle(89.999)},n.geoLittrowRaw=Pr,n.geoLoximuthal=function(){return Z(Rr).parallel(40).scale(158.837)},n.geoLoximuthalRaw=Rr,n.geoMiller=function(){return r.geoProjection(br).scale(108.318)},n.geoMillerRaw=br,n.geoModifiedStereographic=xr,n.geoModifiedStereographicRaw=jr,n.geoModifiedStereographicAlaska=function(){return xr(Mr,[152,-64]).scale(1400).center([-160.908,62.4864]).clipAngle(30).angle(7.8)},n.geoModifiedStereographicGs48=function(){return xr(Er,[95,-38]).scale(1e3).clipAngle(55).center([-96.5563,38.8675])},n.geoModifiedStereographicGs50=function(){return xr(Sr,[120,-45]).scale(359.513).clipAngle(55).center([-117.474,53.0628])},n.geoModifiedStereographicMiller=function(){return xr(kr,[-20,-18]).scale(209.091).center([20,16.7214]).clipAngle(82)},n.geoModifiedStereographicLee=function(){return xr(Ar,[165,10]).scale(250).clipAngle(130).center([-165,-10])},n.geoMollweide=function(){return r.geoProjection(U).scale(169.529)},n.geoMollweideRaw=U,n.geoMtFlatPolarParabolic=function(){return r.geoProjection(Nr).scale(164.859)},n.geoMtFlatPolarParabolicRaw=Nr,n.geoMtFlatPolarQuartic=function(){return r.geoProjection(Fr).scale(188.209)},n.geoMtFlatPolarQuarticRaw=Fr,n.geoMtFlatPolarSinusoidal=function(){return r.geoProjection(zr).scale(166.518)},n.geoMtFlatPolarSinusoidalRaw=zr,n.geoNaturalEarth2=function(){return r.geoProjection(Lr).scale(175.295)},n.geoNaturalEarth2Raw=Lr,n.geoNellHammer=function(){return r.geoProjection(Hr).scale(152.63)},n.geoNellHammerRaw=Hr,n.geoInterruptedQuarticAuthalic=function(){return cr(D(1/0),qr).rotate([20,0]).scale(152.63)},n.geoNicolosi=function(){return r.geoProjection(Br).scale(127.267)},n.geoNicolosiRaw=Br,n.geoPatterson=function(){return r.geoProjection(Or).scale(139.319)},n.geoPattersonRaw=Or,n.geoPolyconic=function(){return r.geoProjection(Ur).scale(103.74)},n.geoPolyconicRaw=Ur,n.geoPolyhedral=$r,n.geoPolyhedralButterfly=function(n){n=n||function(n){var e=r.geoCentroid({type:"MultiPoint",coordinates:n});return r.geoGnomonic().scale(1).translate([0,0]).rotate([-e[0],-e[1]])};var e=te.map(function(r){return{face:r,project:n(r)}});return[-1,0,0,1,0,1,4,5].forEach(function(n,r){var t=e[n];t&&(t.children||(t.children=[])).push(e[r])}),$r(e[0],function(n,r){return e[n<-m/2?r<0?6:4:n<0?r<0?2:0:n0?[-e[0],0]:[180-e[0],180])};var e=te.map(function(r){return{face:r,project:n(r)}});return[-1,0,0,1,0,1,4,5].forEach(function(n,r){var t=e[n];t&&(t.children||(t.children=[])).push(e[r])}),$r(e[0],function(n,r){return e[n<-m/2?r<0?6:4:n<0?r<0?2:0:n2||i[0]!=r[0]||i[1]!=r[1])&&(t.push(i),r=i)}return 1===t.length&&n.length>1&&t.push(e(n[n.length-1])),t}function i(n){return n.map(o)}function u(n){if(null==n)return n;var r;switch(n.type){case"GeometryCollection":r={type:"GeometryCollection",geometries:n.geometries.map(u)};break;case"Point":r={type:"Point",coordinates:e(n.coordinates)};break;case"MultiPoint":r={type:n.type,coordinates:t(n.coordinates)};break;case"LineString":r={type:n.type,coordinates:o(n.coordinates)};break;case"MultiLineString":case"Polygon":r={type:n.type,coordinates:i(n.coordinates)};break;case"MultiPolygon":r={type:"MultiPolygon",coordinates:n.coordinates.map(i)};break;default:return n}return null!=n.bbox&&(r.bbox=n.bbox),r}function a(n){var r={type:"Feature",properties:n.properties,geometry:u(n.geometry)};return null!=n.id&&(r.id=n.id),null!=n.bbox&&(r.bbox=n.bbox),r}if(null!=n)switch(n.type){case"Feature":return a(n);case"FeatureCollection":var c={type:"FeatureCollection",features:n.features.map(a)};return null!=n.bbox&&(c.bbox=n.bbox),c;default:return u(n)}return n},n.geoQuincuncial=ye,n.geoRectangularPolyconic=function(){return Z(Pe).scale(131.215)},n.geoRectangularPolyconicRaw=Pe,n.geoRobinson=function(){return r.geoProjection(be).scale(152.63)},n.geoRobinsonRaw=be,n.geoSatellite=function(){var n=2,e=0,t=r.geoProjectionMutator(je),o=t(n,e);return o.distance=function(r){return arguments.length?t(n=+r,e):n},o.tilt=function(r){return arguments.length?t(n,e=r*k):e*S},o.scale(432.147).clipAngle(x(1/n)*S-1e-6)},n.geoSatelliteRaw=je,n.geoSinuMollweide=function(){return r.geoProjection(rr).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},n.geoSinuMollweideRaw=rr,n.geoSinusoidal=function(){return r.geoProjection($).scale(152.63)},n.geoSinusoidalRaw=$,n.geoStitch=function(n){if(null==n)return n;switch(n.type){case"Feature":return We(n);case"FeatureCollection":var r={type:"FeatureCollection",features:n.features.map(We)};return null!=n.bbox&&(r.bbox=n.bbox),r;default:return Ie(n)}},n.geoTimes=function(){return r.geoProjection(De).scale(146.153)},n.geoTimesRaw=De,n.geoTwoPointAzimuthal=Ve,n.geoTwoPointAzimuthalRaw=Te,n.geoTwoPointAzimuthalUsa=function(){return Ve([-158,21.5],[-77,39]).clipAngle(60).scale(400)},n.geoTwoPointEquidistant=Ke,n.geoTwoPointEquidistantRaw=_e,n.geoTwoPointEquidistantUsa=function(){return Ke([-158,21.5],[-77,39]).clipAngle(130).scale(122.571)},n.geoVanDerGrinten=function(){return r.geoProjection(Oe).scale(79.4183)},n.geoVanDerGrintenRaw=Oe,n.geoVanDerGrinten2=function(){return r.geoProjection(Ue).scale(79.4183)},n.geoVanDerGrinten2Raw=Ue,n.geoVanDerGrinten3=function(){return r.geoProjection(Je).scale(79.4183)},n.geoVanDerGrinten3Raw=Je,n.geoVanDerGrinten4=function(){return r.geoProjection(Xe).scale(127.16)},n.geoVanDerGrinten4Raw=Xe,n.geoWagner=Ze,n.geoWagner7=function(){return Ze().poleline(65).parallels(60).inflation(0).ratio(200).scale(172.633)},n.geoWagnerRaw=Ye,n.geoWagner4=function(){return r.geoProjection(rt).scale(176.84)},n.geoWagner4Raw=rt,n.geoWagner6=function(){return r.geoProjection(et).scale(152.63)},n.geoWagner6Raw=et,n.geoWiechel=function(){return r.geoProjection(tt).rotate([0,-90,45]).scale(124.75).clipAngle(179.999)},n.geoWiechelRaw=tt,n.geoWinkel3=function(){return r.geoProjection(ot).scale(158.837)},n.geoWinkel3Raw=ot,Object.defineProperty(n,"__esModule",{value:!0})}); diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/.eslintrc.json b/node_modules/d3-geo-projection/node_modules/d3-array/.eslintrc.json deleted file mode 100644 index 8287875..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/.eslintrc.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "eslint:recommended", - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 8 - }, - "env": { - "es6": true, - "node": true, - "browser": true - }, - "rules": { - "no-cond-assign": 0 - } -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/LICENSE b/node_modules/d3-geo-projection/node_modules/d3-array/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/README.md b/node_modules/d3-geo-projection/node_modules/d3-array/README.md deleted file mode 100644 index 17df6e2..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/README.md +++ /dev/null @@ -1,382 +0,0 @@ -# d3-array - -Data in JavaScript is often represented by an array, and so one tends to manipulate arrays when visualizing or analyzing data. Some common forms of manipulation include taking a contiguous slice (subset) of an array, filtering an array using a predicate function, and mapping an array to a parallel set of values using a transform function. Before looking at the set of utilities that this module provides, familiarize yourself with the powerful [array methods built-in to JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype). - -JavaScript includes **mutation methods** that modify the array: - -* [*array*.pop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) - Remove the last element from the array. -* [*array*.push](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) - Add one or more elements to the end of the array. -* [*array*.reverse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) - Reverse the order of the elements of the array. -* [*array*.shift](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) - Remove the first element from the array. -* [*array*.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) - Sort the elements of the array. -* [*array*.splice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) - Add or remove elements from the array. -* [*array*.unshift](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) - Add one or more elements to the front of the array. - -There are also **access methods** that return some representation of the array: - -* [*array*.concat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) - Join the array with other array(s) or value(s). -* [*array*.join](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join) - Join all elements of the array into a string. -* [*array*.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) - Extract a section of the array. -* [*array*.indexOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) - Find the first occurrence of a value within the array. -* [*array*.lastIndexOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf) - Find the last occurrence of a value within the array. - -And finally **iteration methods** that apply functions to elements in the array: - -* [*array*.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) - Create a new array with only the elements for which a predicate is true. -* [*array*.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) - Call a function for each element in the array. -* [*array*.every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) - See if every element in the array satisfies a predicate. -* [*array*.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) - Create a new array with the result of calling a function on every element in the array. -* [*array*.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) - See if at least one element in the array satisfies a predicate. -* [*array*.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) - Apply a function to reduce the array to a single value (from left-to-right). -* [*array*.reduceRight](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight) - Apply a function to reduce the array to a single value (from right-to-left). - -## Installing - -If you use NPM, `npm install d3-array`. Otherwise, download the [latest release](https://github.com/d3/d3-array/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-array.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -[Try d3-array in your browser.](https://tonicdev.com/npm/d3-array) - -## API Reference - -* [Statistics](#statistics) -* [Search](#search) -* [Transformations](#transformations) -* [Histograms](#histograms) -* [Histogram Thresholds](#histogram-thresholds) - -### Statistics - -Methods for computing basic summary statistics. - -# d3.min(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/min.js "Source") - -Returns the minimum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the minimum value. - -Unlike the built-in [Math.min](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/min), this method ignores undefined, null and NaN values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the minimum of the strings [“20”, “3”] is “20”, while the minimum of the numbers [20, 3] is 3. - -See also [scan](#scan) and [extent](#extent). - -# d3.max(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/max.js "Source") - -Returns the maximum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the maximum value. - -Unlike the built-in [Math.max](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/max), this method ignores undefined values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the maximum of the strings [“20”, “3”] is “3”, while the maximum of the numbers [20, 3] is 20. - -See also [scan](#scan) and [extent](#extent). - -# d3.extent(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/extent.js "Source") - -Returns the [minimum](#min) and [maximum](#max) value in the given *array* using natural order. If the array is empty, returns [undefined, undefined]. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the extent. - -# d3.sum(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/sum.js "Source") - -Returns the sum of the given *array* of numbers. If the array is empty, returns 0. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the sum. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.mean(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/mean.js "Source") - -Returns the mean of the given *array* of numbers. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the mean. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.median(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/median.js "Source") - -Returns the median of the given *array* of numbers using the [R-7 method](https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample). If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the median. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.quantile(array, p[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/quantile.js "Source") - -Returns the *p*-quantile of the given **sorted** *array* of numbers, where *p* is a number in the range [0, 1]. For example, the median can be computed using *p* = 0.5, the first quartile at *p* = 0.25, and the third quartile at *p* = 0.75. This particular implementation uses the [R-7 method](http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population), which is the default for the R programming language and Excel. For example: - -```js -var a = [0, 10, 30]; -d3.quantile(a, 0); // 0 -d3.quantile(a, 0.5); // 10 -d3.quantile(a, 1); // 30 -d3.quantile(a, 0.25); // 5 -d3.quantile(a, 0.75); // 20 -d3.quantile(a, 0.1); // 2 -``` - -An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the quantile. - -# d3.variance(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/variance.js "Source") - -Returns an [unbiased estimator of the population variance](http://mathworld.wolfram.com/SampleVariance.html) of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the variance. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.deviation(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/deviation.js "Source") - -Returns the standard deviation, defined as the square root of the [bias-corrected variance](#variance), of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the standard deviation. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -### Search - -Methods for searching arrays for a specific element. - -# d3.scan(array[, comparator]) [<>](https://github.com/d3/d3-array/blob/master/src/scan.js "Source") - -Performs a linear scan of the specified *array*, returning the index of the least element according to the specified *comparator*. If the given *array* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns undefined. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: - -```js -var array = [{foo: 42}, {foo: 91}]; -d3.scan(array, function(a, b) { return a.foo - b.foo; }); // 0 -d3.scan(array, function(a, b) { return b.foo - a.foo; }); // 1 -``` - -This function is similar to [min](#min), except it allows the use of a comparator rather than an accessor and it returns the index instead of the accessed value. See also [bisect](#bisect). - -# d3.bisectLeft(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisect.js#L6 "Source") - -Returns the insertion point for *x* in *array* to maintain sorted order. The arguments *lo* and *hi* may be used to specify a subset of the array which should be considered; by default the entire array is used. If *x* is already present in *array*, the insertion point will be before (to the left of) any existing entries. The return value is suitable for use as the first argument to [splice](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice) assuming that *array* is already sorted. The returned insertion point *i* partitions the *array* into two halves so that all *v* < *x* for *v* in *array*.slice(*lo*, *i*) for the left side and all *v* >= *x* for *v* in *array*.slice(*i*, *hi*) for the right side. - -# d3.bisect(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisect.js "Source")
-# d3.bisectRight(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisect.js#L6 "Source") - -Similar to [bisectLeft](#bisectLeft), but returns an insertion point which comes after (to the right of) any existing entries of *x* in *array*. The returned insertion point *i* partitions the *array* into two halves so that all *v* <= *x* for *v* in *array*.slice(*lo*, *i*) for the left side and all *v* > *x* for *v* in *array*.slice(*i*, *hi*) for the right side. - -# d3.bisector(accessor) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js "Source") -
# d3.bisector(comparator) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js "Source") - -Returns a new bisector using the specified *accessor* or *comparator* function. This method can be used to bisect arrays of objects instead of being limited to simple arrays of primitives. For example, given the following array of objects: - -```js -var data = [ - {date: new Date(2011, 1, 1), value: 0.5}, - {date: new Date(2011, 2, 1), value: 0.6}, - {date: new Date(2011, 3, 1), value: 0.7}, - {date: new Date(2011, 4, 1), value: 0.8} -]; -``` - -A suitable bisect function could be constructed as: - -```js -var bisectDate = d3.bisector(function(d) { return d.date; }).right; -``` - -This is equivalent to specifying a comparator: - -```js -var bisectDate = d3.bisector(function(d, x) { return d.date - x; }).right; -``` - -And then applied as *bisectDate*(*array*, *date*), returning an index. Note that the comparator is always passed the search value *x* as the second argument. Use a comparator rather than an accessor if you want values to be sorted in an order different than natural order, such as in descending rather than ascending order. - -# bisector.left(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js#L6 "Source") - -Equivalent to [bisectLeft](#bisectLeft), but uses this bisector’s associated comparator. - -# bisector.right(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js#L16 "Source") - -Equivalent to [bisectRight](#bisectRight), but uses this bisector’s associated comparator. - -# d3.ascending(a, b) [<>](https://github.com/d3/d3-array/blob/master/src/ascending.js "Source") - -Returns -1 if *a* is less than *b*, or 1 if *a* is greater than *b*, or 0. This is the comparator function for natural order, and can be used in conjunction with the built-in [*array*.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) method to arrange elements in ascending order. It is implemented as: - -```js -function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} -``` - -Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic (alphabetical), not natural! This can lead to surprising behavior when sorting an array of numbers. - -# d3.descending(a, b) [<>](https://github.com/d3/d3-array/blob/master/src/descending.js "Source") - -Returns -1 if *a* is greater than *b*, or 1 if *a* is less than *b*, or 0. This is the comparator function for reverse natural order, and can be used in conjunction with the built-in array sort method to arrange elements in descending order. It is implemented as: - -```js -function descending(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} -``` - -Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic (alphabetical), not natural! This can lead to surprising behavior when sorting an array of numbers. - -### Transformations - -Methods for transforming arrays and for generating new arrays. - -# d3.cross(a, b[, reducer]) [<>](https://github.com/d3/d3-array/blob/master/src/cross.js "Source") - -Returns the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the two arrays *a* and *b*. For each element *i* in the specified array *a* and each element *j* in the specified array *b*, in order, invokes the specified *reducer* function passing the element *i* and element *j*. If a *reducer* is not specified, it defaults to a function which creates a two-element array for each pair: - -```js -function pair(a, b) { - return [a, b]; -} -``` - -For example: - -```js -d3.cross([1, 2], ["x", "y"]); // returns [[1, "x"], [1, "y"], [2, "x"], [2, "y"]] -d3.cross([1, 2], ["x", "y"], (a, b) => a + b); // returns ["1x", "1y", "2x", "2y"] -``` - -# d3.merge(arrays) [<>](https://github.com/d3/d3-array/blob/master/src/merge.js "Source") - -Merges the specified *arrays* into a single array. This method is similar to the built-in array concat method; the only difference is that it is more convenient when you have an array of arrays. - -```js -d3.merge([[1], [2, 3]]); // returns [1, 2, 3] -``` - -# d3.pairs(array[, reducer]) [<>](https://github.com/d3/d3-array/blob/master/src/pairs.js "Source") - -For each adjacent pair of elements in the specified *array*, in order, invokes the specified *reducer* function passing the element *i* and element *i* - 1. If a *reducer* is not specified, it defaults to a function which creates a two-element array for each pair: - -```js -function pair(a, b) { - return [a, b]; -} -``` - -For example: - -```js -d3.pairs([1, 2, 3, 4]); // returns [[1, 2], [2, 3], [3, 4]] -d3.pairs([1, 2, 3, 4], (a, b) => b - a); // returns [1, 1, 1]; -``` - -If the specified array has fewer than two elements, returns the empty array. - -# d3.permute(array, indexes) [<>](https://github.com/d3/d3-array/blob/master/src/permute.js "Source") - -Returns a permutation of the specified *array* using the specified array of *indexes*. The returned array contains the corresponding element in array for each index in indexes, in order. For example, permute(["a", "b", "c"], [1, 2, 0]) -returns ["b", "c", "a"]. It is acceptable for the array of indexes to be a different length from the array of elements, and for indexes to be duplicated or omitted. - -This method can also be used to extract the values from an object into an array with a stable order. Extracting keyed values in order can be useful for generating data arrays in nested selections. For example: - -```js -var object = {yield: 27, variety: "Manchuria", year: 1931, site: "University Farm"}, - fields = ["site", "variety", "yield"]; - -d3.permute(object, fields); // returns ["University Farm", "Manchuria", 27] -``` - -# d3.shuffle(array[, start[, stop]]) [<>](https://github.com/d3/d3-array/blob/master/src/shuffle.js "Source") - -Randomizes the order of the specified *array* in-place using the [Fisher–Yates shuffle](https://bost.ocks.org/mike/shuffle/) and returns the *array*. If *start* is specified, it is the starting index (inclusive) of the *array* to shuffle; if *start* is not specified, it defaults to zero. If *stop* is specified, it is the ending index (exclusive) of the *array* to shuffle; if *stop* is not specified, it defaults to *array*.length. For example, to shuffle the first ten elements of the *array*: shuffle(*array*, 0, 10). - -# d3.ticks(start, stop, count) [<>](https://github.com/d3/d3-array/blob/master/src/ticks.js "Source") - -Returns an array of approximately *count* + 1 uniformly-spaced, nicely-rounded values between *start* and *stop* (inclusive). Each value is a power of ten multiplied by 1, 2 or 5. See also [d3.tickIncrement](#tickIncrement), [d3.tickStep](#tickStep) and [*linear*.ticks](https://github.com/d3/d3-scale/blob/master/README.md#linear_ticks). - -Ticks are inclusive in the sense that they may include the specified *start* and *stop* values if (and only if) they are exact, nicely-rounded values consistent with the inferred [step](#tickStep). More formally, each returned tick *t* satisfies *start* ≤ *t* and *t* ≤ *stop*. - -# d3.tickIncrement(start, stop, count) [<>](https://github.com/d3/d3-array/blob/master/src/ticks.js#L16 "Source") - -Like [d3.tickStep](#tickStep), except requires that *start* is always less than or equal to *step*, and if the tick step for the given *start*, *stop* and *count* would be less than one, returns the negative inverse tick step instead. This method is always guaranteed to return an integer, and is used by [d3.ticks](#ticks) to avoid guarantee that the returned tick values are represented as precisely as possible in IEEE 754 floating point. - -# d3.tickStep(start, stop, count) [<>](https://github.com/d3/d3-array/blob/master/src/ticks.js#L16 "Source") - -Returns the difference between adjacent tick values if the same arguments were passed to [d3.ticks](#ticks): a nicely-rounded value that is a power of ten multiplied by 1, 2 or 5. Note that due to the limited precision of IEEE 754 floating point, the returned value may not be exact decimals; use [d3-format](https://github.com/d3/d3-format) to format numbers for human consumption. - -# d3.range([start, ]stop[, step]) [<>](https://github.com/d3/d3-array/blob/master/src/range.js "Source") - -Returns an array containing an arithmetic progression, similar to the Python built-in [range](http://docs.python.org/library/functions.html#range). This method is often used to iterate over a sequence of uniformly-spaced numeric values, such as the indexes of an array or the ticks of a linear scale. (See also [d3.ticks](#ticks) for nicely-rounded values.) - -If *step* is omitted, it defaults to 1. If *start* is omitted, it defaults to 0. The *stop* value is exclusive; it is not included in the result. If *step* is positive, the last element is the largest *start* + *i* \* *step* less than *stop*; if *step* is negative, the last element is the smallest *start* + *i* \* *step* greater than *stop*. If the returned array would contain an infinite number of values, an empty range is returned. - -The arguments are not required to be integers; however, the results are more predictable if they are. The values in the returned array are defined as *start* + *i* \* *step*, where *i* is an integer from zero to one minus the total number of elements in the returned array. For example: - -```js -d3.range(0, 1, 0.2) // [0, 0.2, 0.4, 0.6000000000000001, 0.8] -``` - -This unexpected behavior is due to IEEE 754 double-precision floating point, which defines 0.2 * 3 = 0.6000000000000001. Use [d3-format](https://github.com/d3/d3-format) to format numbers for human consumption with appropriate rounding; see also [linear.tickFormat](https://github.com/d3/d3-scale/blob/master/README.md#linear_tickFormat) in [d3-scale](https://github.com/d3/d3-scale). - -Likewise, if the returned array should have a specific length, consider using [array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on an integer range. For example: - -```js -d3.range(0, 1, 1 / 49); // BAD: returns 50 elements! -d3.range(49).map(function(d) { return d / 49; }); // GOOD: returns 49 elements. -``` - -# d3.transpose(matrix) [<>](https://github.com/d3/d3-array/blob/master/src/transpose.js "Source") - -Uses the [zip](#zip) operator as a two-dimensional [matrix transpose](http://en.wikipedia.org/wiki/Transpose). - -# d3.zip(arrays…) [<>](https://github.com/d3/d3-array/blob/master/src/zip.js "Source") - -Returns an array of arrays, where the *i*th array contains the *i*th element from each of the argument *arrays*. The returned array is truncated in length to the shortest array in *arrays*. If *arrays* contains only a single array, the returned array contains one-element arrays. With no arguments, the returned array is empty. - -```js -d3.zip([1, 2], [3, 4]); // returns [[1, 3], [2, 4]] -``` - -### Histograms - -[Histogram](http://bl.ocks.org/mbostock/3048450) - -Histograms bin many discrete samples into a smaller number of consecutive, non-overlapping intervals. They are often used to visualize the distribution of numerical data. - -# d3.histogram() [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js "Source") - -Constructs a new histogram generator with the default settings. - -# histogram(data) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L14 "Source") - -Computes the histogram for the given array of *data* samples. Returns an array of bins, where each bin is an array containing the associated elements from the input *data*. Thus, the `length` of the bin is the number of elements in that bin. Each bin has two additional attributes: - -* `x0` - the lower bound of the bin (inclusive). -* `x1` - the upper bound of the bin (exclusive, except for the last bin). - -# histogram.value([value]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L58 "Source") - -If *value* is specified, sets the value accessor to the specified function or constant and returns this histogram generator. If *value* is not specified, returns the current value accessor, which defaults to the identity function. - -When a histogram is [generated](#_histogram), the value accessor will be invoked for each element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. The default value accessor assumes that the input data are orderable (comparable), such as numbers or dates. If your data are not, then you should specify an accessor that returns the corresponding orderable value for a given datum. - -This is similar to mapping your data to values before invoking the histogram generator, but has the benefit that the input data remains associated with the returned bins, thereby making it easier to access other fields of the data. - -# histogram.domain([domain]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L62 "Source") - -If *domain* is specified, sets the domain accessor to the specified function or array and returns this histogram generator. If *domain* is not specified, returns the current domain accessor, which defaults to [extent](#extent). The histogram domain is defined as an array [*min*, *max*], where *min* is the minimum observable value and *max* is the maximum observable value; both values are inclusive. Any value outside of this domain will be ignored when the histogram is [generated](#_histogram). - -For example, if you are using the the histogram in conjunction with a [linear scale](https://github.com/d3/d3-scale/blob/master/README.md#linear-scales) `x`, you might say: - -```js -var histogram = d3.histogram() - .domain(x.domain()) - .thresholds(x.ticks(20)); -``` - -You can then compute the bins from an array of numbers like so: - -```js -var bins = histogram(numbers); -``` - -Note that the domain accessor is invoked on the materialized array of [values](#histogram_value), not on the input data array. - -# histogram.thresholds([count]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L66 "Source") -
# histogram.thresholds([thresholds]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L66 "Source") - -If *thresholds* is specified, sets the [threshold generator](#histogram-thresholds) to the specified function or array and returns this histogram generator. If *thresholds* is not specified, returns the current threshold generator, which by default implements [Sturges’ formula](#thresholdSturges). (Thus by default, the histogram values must be numbers!) Thresholds are defined as an array of values [*x0*, *x1*, …]. Any value less than *x0* will be placed in the first bin; any value greater than or equal to *x0* but less than *x1* will be placed in the second bin; and so on. Thus, the [generated histogram](#_histogram) will have *thresholds*.length + 1 bins. See [histogram thresholds](#histogram-thresholds) for more information. - -Any threshold values outside the [domain](#histogram_domain) are ignored. The first *bin*.x0 is always equal to the minimum domain value, and the last *bin*.x1 is always equal to the maximum domain value. - -If a *count* is specified instead of an array of *thresholds*, then the [domain](#histogram_domain) will be uniformly divided into approximately *count* bins; see [ticks](#ticks). - -### Histogram Thresholds - -These functions are typically not used directly; instead, pass them to [*histogram*.thresholds](#histogram_thresholds). You may also implement your own threshold generator taking three arguments: the array of input [*values*](#histogram_value) derived from the data, and the [observable domain](#histogram_domain) represented as *min* and *max*. The generator may then return either the array of numeric thresholds or the *count* of bins; in the latter case the domain is divided uniformly into approximately *count* bins; see [ticks](#ticks). - -# d3.thresholdFreedmanDiaconis(values, min, max) [<>](https://github.com/d3/d3-array/blob/master/src/threshold/freedmanDiaconis.js "Source") - -Returns the number of bins according to the [Freedman–Diaconis rule](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. - -# d3.thresholdScott(values, min, max) [<>](https://github.com/d3/d3-array/blob/master/src/threshold/scott.js "Source") - -Returns the number of bins according to [Scott’s normal reference rule](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. - -# d3.thresholdSturges(values) [<>](https://github.com/d3/d3-array/blob/master/src/threshold/sturges.js "Source") - -Returns the number of bins according to [Sturges’ formula](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/dist/d3-array.js b/node_modules/d3-geo-projection/node_modules/d3-array/dist/d3-array.js deleted file mode 100644 index 89d17e7..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/dist/d3-array.js +++ /dev/null @@ -1,590 +0,0 @@ -// https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(factory((global.d3 = global.d3 || {}))); -}(this, (function (exports) { 'use strict'; - -function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; -} - -function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; -} - -var ascendingBisect = bisector(ascending); -var bisectRight = ascendingBisect.right; -var bisectLeft = ascendingBisect.left; - -function pairs(array, f) { - if (f == null) f = pair; - var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); - while (i < n) pairs[i] = f(p, p = array[++i]); - return pairs; -} - -function pair(a, b) { - return [a, b]; -} - -function cross(values0, values1, reduce) { - var n0 = values0.length, - n1 = values1.length, - values = new Array(n0 * n1), - i0, - i1, - i, - value0; - - if (reduce == null) reduce = pair; - - for (i0 = i = 0; i0 < n0; ++i0) { - for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) { - values[i] = reduce(value0, values1[i1]); - } - } - - return values; -} - -function descending(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} - -function number(x) { - return x === null ? NaN : +x; -} - -function variance(values, valueof) { - var n = values.length, - m = 0, - i = -1, - mean = 0, - value, - delta, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } - } - } - - if (m > 1) return sum / (m - 1); -} - -function deviation(array, f) { - var v = variance(array, f); - return v ? Math.sqrt(v) : v; -} - -function extent(values, valueof) { - var n = values.length, - i = -1, - value, - min, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - } - - return [min, max]; -} - -var array = Array.prototype; - -var slice = array.slice; -var map = array.map; - -function constant(x) { - return function() { - return x; - }; -} - -function identity(x) { - return x; -} - -function range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} - -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; -} - -function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} - -function sturges(values) { - return Math.ceil(Math.log(values.length) / Math.LN2) + 1; -} - -function histogram() { - var value = identity, - domain = extent, - threshold = sturges; - - function histogram(data) { - var i, - n = data.length, - x, - values = new Array(n); - - for (i = 0; i < n; ++i) { - values[i] = value(data[i], i, data); - } - - var xz = domain(values), - x0 = xz[0], - x1 = xz[1], - tz = threshold(values, x0, x1); - - // Convert number of thresholds into uniform thresholds. - if (!Array.isArray(tz)) { - tz = tickStep(x0, x1, tz); - tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive - } - - // Remove any thresholds outside the domain. - var m = tz.length; - while (tz[0] <= x0) tz.shift(), --m; - while (tz[m - 1] > x1) tz.pop(), --m; - - var bins = new Array(m + 1), - bin; - - // Initialize bins. - for (i = 0; i <= m; ++i) { - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - - // Assign data to bins by value, ignoring any outside the domain. - for (i = 0; i < n; ++i) { - x = values[i]; - if (x0 <= x && x <= x1) { - bins[bisectRight(tz, x, 0, m)].push(data[i]); - } - } - - return bins; - } - - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; - }; - - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; - }; - - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; - }; - - return histogram; -} - -function quantile(values, p, valueof) { - if (valueof == null) valueof = number; - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} - -function freedmanDiaconis(values, min, max) { - values = map.call(values, number).sort(ascending); - return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(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.length, -1 / 3))); -} - -function max(values, valueof) { - var n = values.length, - i = -1, - value, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && value > max) { - max = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && value > max) { - max = value; - } - } - } - } - } - - return max; -} - -function mean(values, valueof) { - var n = values.length, - m = n, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) sum += value; - else --m; - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value; - else --m; - } - } - - if (m) return sum / m; -} - -function median(values, valueof) { - var n = values.length, - i = -1, - value, - numbers = []; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - numbers.push(value); - } - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - numbers.push(value); - } - } - } - - return quantile(numbers.sort(ascending), 0.5); -} - -function merge(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; -} - -function min(values, valueof) { - var n = values.length, - i = -1, - value, - min; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && min > value) { - min = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && min > value) { - min = value; - } - } - } - } - } - - return min; -} - -function permute(array, indexes) { - var i = indexes.length, permutes = new Array(i); - while (i--) permutes[i] = array[indexes[i]]; - return permutes; -} - -function scan(values, compare) { - if (!(n = values.length)) return; - var n, - i = 0, - j = 0, - xi, - xj = values[j]; - - if (compare == null) compare = ascending; - - while (++i < n) { - if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) { - xj = xi, j = i; - } - } - - if (compare(xj, xj) === 0) return j; -} - -function shuffle(array, i0, i1) { - var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +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; -} - -function sum(values, valueof) { - var n = values.length, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (value = +values[i]) sum += value; // Note: zero and null are equivalent. - } - } - - else { - while (++i < n) { - if (value = +valueof(values[i], i, values)) sum += value; - } - } - - return sum; -} - -function transpose(matrix) { - if (!(n = matrix.length)) return []; - for (var i = -1, m = min(matrix, length), 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 length(d) { - return d.length; -} - -function zip() { - return transpose(arguments); -} - -exports.bisect = bisectRight; -exports.bisectRight = bisectRight; -exports.bisectLeft = bisectLeft; -exports.ascending = ascending; -exports.bisector = bisector; -exports.cross = cross; -exports.descending = descending; -exports.deviation = deviation; -exports.extent = extent; -exports.histogram = histogram; -exports.thresholdFreedmanDiaconis = freedmanDiaconis; -exports.thresholdScott = scott; -exports.thresholdSturges = sturges; -exports.max = max; -exports.mean = mean; -exports.median = median; -exports.merge = merge; -exports.min = min; -exports.pairs = pairs; -exports.permute = permute; -exports.quantile = quantile; -exports.range = range; -exports.scan = scan; -exports.shuffle = shuffle; -exports.sum = sum; -exports.ticks = ticks; -exports.tickIncrement = tickIncrement; -exports.tickStep = tickStep; -exports.transpose = transpose; -exports.variance = variance; -exports.zip = zip; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/dist/d3-array.min.js b/node_modules/d3-geo-projection/node_modules/d3-array/dist/d3-array.min.js deleted file mode 100644 index c8d0f31..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/dist/d3-array.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock -!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.d3=n.d3||{})}(this,function(n){"use strict";function r(n,r){return nr?1:n>=r?0:NaN}function t(n){var t;return 1===n.length&&(t=n,n=function(n,e){return r(t(n),e)}),{left:function(r,t,e,o){for(null==e&&(e=0),null==o&&(o=r.length);e>>1;n(r[u],t)<0?e=u+1:o=u}return e},right:function(r,t,e,o){for(null==e&&(e=0),null==o&&(o=r.length);e>>1;n(r[u],t)>0?o=u:e=u+1}return e}}}var e=t(r),o=e.right,u=e.left;function f(n,r){return[n,r]}function l(n){return null===n?NaN:+n}function i(n,r){var t,e,o=n.length,u=0,f=-1,i=0,a=0;if(null==r)for(;++f1)return a/(u-1)}function a(n,r){var t=i(n,r);return t?Math.sqrt(t):t}function h(n,r){var t,e,o,u=n.length,f=-1;if(null==r){for(;++f=t)for(e=o=t;++ft&&(e=t),o=t)for(e=o=t;++ft&&(e=t),o=0?(u>=d?10:u>=y?5:u>=N?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(u>=d?10:u>=y?5:u>=N?2:1)}function w(n,r,t){var e=Math.abs(r-n)/Math.max(0,t),o=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),u=e/o;return u>=d?o*=10:u>=y?o*=5:u>=N&&(o*=2),r=1)return+t(n[e-1],e-1,n);var e,o=(e-1)*r,u=Math.floor(o),f=+t(n[u],u,n);return f+(+t(n[u+1],u+1,n)-f)*(o-u)}}function b(n,r){var t,e,o=n.length,u=-1;if(null==r){for(;++u=t)for(e=t;++ut&&(e=t)}else for(;++u=t)for(e=t;++ut&&(e=t);return e}function q(n){if(!(o=n.length))return[];for(var r=-1,t=b(n,L),e=new Array(t);++rn?1:r>=n?0:NaN},n.deviation=a,n.extent=h,n.histogram=function(){var n=M,r=h,t=A;function e(e){var u,f,l=e.length,i=new Array(l);for(u=0;uc;)s.pop(),--g;var v,M=new Array(g+1);for(u=0;u<=g;++u)(v=M[u]=[]).x0=u>0?s[u-1]:h,v.x1=u=t)for(e=t;++ue&&(e=t)}else for(;++u=t)for(e=t;++ue&&(e=t);return e},n.mean=function(n,r){var t,e=n.length,o=e,u=-1,f=0;if(null==r)for(;++u=0;)for(r=(e=n[o]).length;--r>=0;)t[--f]=e[r];return t},n.min=b,n.pairs=function(n,r){null==r&&(r=f);for(var t=0,e=n.length-1,o=n[0],u=new Array(e<0?0:e);t0)return[n];if((e=r0)for(n=Math.ceil(n/f),r=Math.floor(r/f),u=new Array(o=Math.ceil(r-n+1));++l /^d3-/.test(key)), - output: { - file: `dist/${meta.name}.js`, - name: "d3", - format: "umd", - indent: false, - extend: true, - banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`, - globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) - }, - plugins: [] -}; - -export default [ - config, - { - ...config, - output: { - ...config.output, - file: `dist/${meta.name}.min.js` - }, - plugins: [ - ...config.plugins, - terser({ - output: { - preamble: config.output.banner - } - }) - ] - } -]; diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/array.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/array.js deleted file mode 100644 index 8008403..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/array.js +++ /dev/null @@ -1,4 +0,0 @@ -var array = Array.prototype; - -export var slice = array.slice; -export var map = array.map; diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/ascending.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/ascending.js deleted file mode 100644 index 21a4b8f..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/ascending.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/bisect.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/bisect.js deleted file mode 100644 index a4be741..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/bisect.js +++ /dev/null @@ -1,7 +0,0 @@ -import ascending from "./ascending"; -import bisector from "./bisector"; - -var ascendingBisect = bisector(ascending); -export var bisectRight = ascendingBisect.right; -export var bisectLeft = ascendingBisect.left; -export default bisectRight; diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/bisector.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/bisector.js deleted file mode 100644 index bbab44a..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/bisector.js +++ /dev/null @@ -1,33 +0,0 @@ -import ascending from "./ascending"; - -export default function(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; -} - -function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/constant.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/constant.js deleted file mode 100644 index b7d42e7..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(x) { - return function() { - return x; - }; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/cross.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/cross.js deleted file mode 100644 index 26d9b4c..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/cross.js +++ /dev/null @@ -1,21 +0,0 @@ -import {pair} from "./pairs"; - -export default function(values0, values1, reduce) { - var n0 = values0.length, - n1 = values1.length, - values = new Array(n0 * n1), - i0, - i1, - i, - value0; - - if (reduce == null) reduce = pair; - - for (i0 = i = 0; i0 < n0; ++i0) { - for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) { - values[i] = reduce(value0, values1[i1]); - } - } - - return values; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/descending.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/descending.js deleted file mode 100644 index a4e2d7f..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/descending.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/deviation.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/deviation.js deleted file mode 100644 index 48e6618..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/deviation.js +++ /dev/null @@ -1,6 +0,0 @@ -import variance from "./variance"; - -export default function(array, f) { - var v = variance(array, f); - return v ? Math.sqrt(v) : v; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/extent.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/extent.js deleted file mode 100644 index 3650407..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/extent.js +++ /dev/null @@ -1,37 +0,0 @@ -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - min, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - } - - return [min, max]; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/histogram.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/histogram.js deleted file mode 100644 index 8cb7f48..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/histogram.js +++ /dev/null @@ -1,75 +0,0 @@ -import {slice} from "./array"; -import bisect from "./bisect"; -import constant from "./constant"; -import extent from "./extent"; -import identity from "./identity"; -import range from "./range"; -import {tickStep} from "./ticks"; -import sturges from "./threshold/sturges"; - -export default function() { - var value = identity, - domain = extent, - threshold = sturges; - - function histogram(data) { - var i, - n = data.length, - x, - values = new Array(n); - - for (i = 0; i < n; ++i) { - values[i] = value(data[i], i, data); - } - - var xz = domain(values), - x0 = xz[0], - x1 = xz[1], - tz = threshold(values, x0, x1); - - // Convert number of thresholds into uniform thresholds. - if (!Array.isArray(tz)) { - tz = tickStep(x0, x1, tz); - tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive - } - - // Remove any thresholds outside the domain. - var m = tz.length; - while (tz[0] <= x0) tz.shift(), --m; - while (tz[m - 1] > x1) tz.pop(), --m; - - var bins = new Array(m + 1), - bin; - - // Initialize bins. - for (i = 0; i <= m; ++i) { - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - - // Assign data to bins by value, ignoring any outside the domain. - for (i = 0; i < n; ++i) { - x = values[i]; - if (x0 <= x && x <= x1) { - bins[bisect(tz, x, 0, m)].push(data[i]); - } - } - - return bins; - } - - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; - }; - - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; - }; - - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; - }; - - return histogram; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/identity.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/identity.js deleted file mode 100644 index b2f94b2..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/identity.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x) { - return x; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/index.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/index.js deleted file mode 100644 index 1d2b3a7..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -export {default as bisect, bisectRight, bisectLeft} from "./bisect"; -export {default as ascending} from "./ascending"; -export {default as bisector} from "./bisector"; -export {default as cross} from "./cross"; -export {default as descending} from "./descending"; -export {default as deviation} from "./deviation"; -export {default as extent} from "./extent"; -export {default as histogram} from "./histogram"; -export {default as thresholdFreedmanDiaconis} from "./threshold/freedmanDiaconis"; -export {default as thresholdScott} from "./threshold/scott"; -export {default as thresholdSturges} from "./threshold/sturges"; -export {default as max} from "./max"; -export {default as mean} from "./mean"; -export {default as median} from "./median"; -export {default as merge} from "./merge"; -export {default as min} from "./min"; -export {default as pairs} from "./pairs"; -export {default as permute} from "./permute"; -export {default as quantile} from "./quantile"; -export {default as range} from "./range"; -export {default as scan} from "./scan"; -export {default as shuffle} from "./shuffle"; -export {default as sum} from "./sum"; -export {default as ticks, tickIncrement, tickStep} from "./ticks"; -export {default as transpose} from "./transpose"; -export {default as variance} from "./variance"; -export {default as zip} from "./zip"; diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/max.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/max.js deleted file mode 100644 index db45a0f..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/max.js +++ /dev/null @@ -1,34 +0,0 @@ -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && value > max) { - max = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && value > max) { - max = value; - } - } - } - } - } - - return max; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/mean.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/mean.js deleted file mode 100644 index de4b4bb..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/mean.js +++ /dev/null @@ -1,25 +0,0 @@ -import number from "./number"; - -export default function(values, valueof) { - var n = values.length, - m = n, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) sum += value; - else --m; - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value; - else --m; - } - } - - if (m) return sum / m; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/median.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/median.js deleted file mode 100644 index 75df453..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/median.js +++ /dev/null @@ -1,28 +0,0 @@ -import ascending from "./ascending"; -import number from "./number"; -import quantile from "./quantile"; - -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - numbers = []; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - numbers.push(value); - } - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - numbers.push(value); - } - } - } - - return quantile(numbers.sort(ascending), 0.5); -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/merge.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/merge.js deleted file mode 100644 index d08221e..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/merge.js +++ /dev/null @@ -1,21 +0,0 @@ -export default 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; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/min.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/min.js deleted file mode 100644 index 8c0807a..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/min.js +++ /dev/null @@ -1,34 +0,0 @@ -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - min; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && min > value) { - min = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && min > value) { - min = value; - } - } - } - } - } - - return min; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/number.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/number.js deleted file mode 100644 index 3768189..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/number.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x) { - return x === null ? NaN : +x; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/pairs.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/pairs.js deleted file mode 100644 index 644dc23..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/pairs.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function(array, f) { - if (f == null) f = pair; - var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); - while (i < n) pairs[i] = f(p, p = array[++i]); - return pairs; -} - -export function pair(a, b) { - return [a, b]; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/permute.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/permute.js deleted file mode 100644 index cd19524..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/permute.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(array, indexes) { - var i = indexes.length, permutes = new Array(i); - while (i--) permutes[i] = array[indexes[i]]; - return permutes; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/quantile.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/quantile.js deleted file mode 100644 index 889b793..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/quantile.js +++ /dev/null @@ -1,14 +0,0 @@ -import number from "./number"; - -export default function(values, p, valueof) { - if (valueof == null) valueof = number; - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/range.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/range.js deleted file mode 100644 index 5975601..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/range.js +++ /dev/null @@ -1,13 +0,0 @@ -export default function(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/scan.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/scan.js deleted file mode 100644 index 98115b2..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/scan.js +++ /dev/null @@ -1,20 +0,0 @@ -import ascending from "./ascending"; - -export default function(values, compare) { - if (!(n = values.length)) return; - var n, - i = 0, - j = 0, - xi, - xj = values[j]; - - if (compare == null) compare = ascending; - - while (++i < n) { - if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) { - xj = xi, j = i; - } - } - - if (compare(xj, xj) === 0) return j; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/shuffle.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/shuffle.js deleted file mode 100644 index 02c6676..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/shuffle.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function(array, i0, i1) { - var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +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; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/sum.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/sum.js deleted file mode 100644 index a9ce82b..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/sum.js +++ /dev/null @@ -1,20 +0,0 @@ -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (value = +values[i]) sum += value; // Note: zero and null are equivalent. - } - } - - else { - while (++i < n) { - if (value = +valueof(values[i], i, values)) sum += value; - } - } - - return sum; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/threshold/freedmanDiaconis.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/threshold/freedmanDiaconis.js deleted file mode 100644 index 8cc07fb..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/threshold/freedmanDiaconis.js +++ /dev/null @@ -1,9 +0,0 @@ -import {map} from "../array"; -import ascending from "../ascending"; -import number from "../number"; -import quantile from "../quantile"; - -export default function(values, min, max) { - values = map.call(values, number).sort(ascending); - return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3))); -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/threshold/scott.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/threshold/scott.js deleted file mode 100644 index dc6e0b7..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/threshold/scott.js +++ /dev/null @@ -1,5 +0,0 @@ -import deviation from "../deviation"; - -export default function(values, min, max) { - return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3))); -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/threshold/sturges.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/threshold/sturges.js deleted file mode 100644 index 28ac9bd..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/threshold/sturges.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(values) { - return Math.ceil(Math.log(values.length) / Math.LN2) + 1; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/ticks.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/ticks.js deleted file mode 100644 index e9553fe..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/ticks.js +++ /dev/null @@ -1,51 +0,0 @@ -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -export default function(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; -} - -export function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -export function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/transpose.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/transpose.js deleted file mode 100644 index a2eb406..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/transpose.js +++ /dev/null @@ -1,15 +0,0 @@ -import min from "./min"; - -export default function(matrix) { - if (!(n = matrix.length)) return []; - for (var i = -1, m = min(matrix, length), 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 length(d) { - return d.length; -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/variance.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/variance.js deleted file mode 100644 index 09da08e..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/variance.js +++ /dev/null @@ -1,33 +0,0 @@ -import number from "./number"; - -export default function(values, valueof) { - var n = values.length, - m = 0, - i = -1, - mean = 0, - value, - delta, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } - } - } - - if (m > 1) return sum / (m - 1); -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/src/zip.js b/node_modules/d3-geo-projection/node_modules/d3-array/src/zip.js deleted file mode 100644 index e9a8898..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/src/zip.js +++ /dev/null @@ -1,5 +0,0 @@ -import transpose from "./transpose"; - -export default function() { - return transpose(arguments); -} diff --git a/node_modules/d3-geo-projection/node_modules/d3-array/yarn.lock b/node_modules/d3-geo-projection/node_modules/d3-array/yarn.lock deleted file mode 100644 index 5cbda40..0000000 --- a/node_modules/d3-geo-projection/node_modules/d3-array/yarn.lock +++ /dev/null @@ -1,939 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/code-frame@^7.0.0-beta.47": - version "7.0.0-rc.3" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-rc.3.tgz#d77a587401f818a3168700f596e41cd6905947b2" - dependencies: - "@babel/highlight" "7.0.0-rc.3" - -"@babel/highlight@7.0.0-rc.3": - version "7.0.0-rc.3" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-rc.3.tgz#c2ee83f8e5c0c387279a8c48e06fef2e32027004" - dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^4.0.0" - -"@types/estree@0.0.39": - version "0.0.39" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" - -"@types/node@*": - version "10.9.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.1.tgz#06f002136fbcf51e730995149050bb3c45ee54e6" - -acorn-jsx@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-4.1.1.tgz#e8e41e48ea2fe0c896740610ab6a4ffd8add225e" - dependencies: - acorn "^5.0.3" - -acorn@^5.0.3, acorn@^5.6.0: - version "5.7.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.2.tgz#91fa871883485d06708800318404e72bfb26dcc5" - -ajv-keywords@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" - -ajv@^6.0.1, ajv@^6.5.0: - version "6.5.3" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.3.tgz#71a569d189ecf4f4f321224fecb166f071dd90f9" - dependencies: - fast-deep-equal "^2.0.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ansi-escapes@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - dependencies: - color-convert "^1.9.0" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - dependencies: - sprintf-js "~1.0.2" - -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - dependencies: - array-uniq "^1.0.1" - -array-uniq@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - -arrify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - -babel-code-frame@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" - dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - dependencies: - callsites "^0.2.0" - -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - -chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -chalk@^2.0.0, chalk@^2.1.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chardet@^0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" - -circular-json@^0.3.1: - version "0.3.3" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" - -cli-cursor@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" - dependencies: - restore-cursor "^2.0.0" - -cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - -color-convert@^1.9.0: - version "1.9.2" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" - dependencies: - color-name "1.1.1" - -color-name@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" - -commander@~2.16.0: - version "2.16.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -cross-spawn@^6.0.5: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -debug@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - dependencies: - ms "2.0.0" - -deep-equal@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" - -deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - -define-properties@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" - dependencies: - object-keys "^1.0.12" - -defined@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" - -del@^2.0.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" - dependencies: - globby "^5.0.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - rimraf "^2.2.8" - -doctrine@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" - dependencies: - esutils "^2.0.2" - -es-abstract@^1.5.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" - dependencies: - es-to-primitive "^1.1.1" - function-bind "^1.1.1" - has "^1.0.1" - is-callable "^1.1.3" - is-regex "^1.0.4" - -es-to-primitive@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" - dependencies: - is-callable "^1.1.1" - is-date-object "^1.0.1" - is-symbol "^1.0.1" - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -eslint-scope@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - -eslint-utils@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" - -eslint-visitor-keys@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" - -eslint@5: - version "5.4.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.4.0.tgz#d068ec03006bb9e06b429dc85f7e46c1b69fac62" - dependencies: - ajv "^6.5.0" - babel-code-frame "^6.26.0" - chalk "^2.1.0" - cross-spawn "^6.0.5" - debug "^3.1.0" - doctrine "^2.1.0" - eslint-scope "^4.0.0" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^4.0.0" - esquery "^1.0.1" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.7.0" - ignore "^4.0.2" - imurmurhash "^0.1.4" - inquirer "^5.2.0" - is-resolvable "^1.1.0" - js-yaml "^3.11.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.5" - minimatch "^3.0.4" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" - progress "^2.0.0" - regexpp "^2.0.0" - require-uncached "^1.0.3" - semver "^5.5.0" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" - table "^4.0.3" - text-table "^0.2.0" - -espree@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-4.0.0.tgz#253998f20a0f82db5d866385799d912a83a36634" - dependencies: - acorn "^5.6.0" - acorn-jsx "^4.1.1" - -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - -esquery@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" - dependencies: - estraverse "^4.0.0" - -esrecurse@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" - dependencies: - estraverse "^4.1.0" - -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: - version "4.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" - -esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" - -external-editor@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" - dependencies: - chardet "^0.4.0" - iconv-lite "^0.4.17" - tmp "^0.0.33" - -fast-deep-equal@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" - -fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - -fast-levenshtein@~2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - -figures@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" - dependencies: - escape-string-regexp "^1.0.5" - -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" - dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" - -flat-cache@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" - dependencies: - circular-json "^0.3.1" - del "^2.0.2" - graceful-fs "^4.1.2" - write "^0.2.1" - -for-each@~0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" - dependencies: - is-callable "^1.1.3" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - -glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@~7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^11.7.0: - version "11.7.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" - -globby@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" - dependencies: - array-union "^1.0.1" - arrify "^1.0.0" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - dependencies: - ansi-regex "^2.0.0" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - -has@^1.0.1, has@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - dependencies: - function-bind "^1.1.1" - -iconv-lite@^0.4.17: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - dependencies: - safer-buffer ">= 2.1.2 < 3" - -ignore@^4.0.2: - version "4.0.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -inquirer@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-5.2.0.tgz#db350c2b73daca77ff1243962e9f22f099685726" - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^2.1.0" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rxjs "^5.5.2" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - -is-callable@^1.1.1, is-callable@^1.1.3: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" - -is-date-object@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" - -is-path-in-cwd@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" - dependencies: - is-path-inside "^1.0.0" - -is-path-inside@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" - dependencies: - path-is-inside "^1.0.1" - -is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - -is-regex@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" - dependencies: - has "^1.0.1" - -is-resolvable@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" - -is-symbol@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - -js-tokens@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - -js-yaml@^3.11.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - -json-stable-stringify-without-jsonify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - -levn@^0.3.0, levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0: - version "4.17.10" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" - -mimic-fn@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" - -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - -mute-stream@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - -nice-try@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" - -object-assign@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -object-inspect@~1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" - -object-keys@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -onetime@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" - dependencies: - mimic-fn "^1.0.0" - -optionator@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.4" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - wordwrap "~1.0.0" - -os-tmpdir@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -path-is-inside@^1.0.1, path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - -path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - -path-parse@^1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - -pify@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - -pluralize@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" - -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - -progress@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" - -punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - -regexpp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365" - -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - -resolve@~1.7.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3" - dependencies: - path-parse "^1.0.5" - -restore-cursor@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" - dependencies: - onetime "^2.0.0" - signal-exit "^3.0.2" - -resumer@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" - dependencies: - through "~2.3.4" - -rimraf@^2.2.8: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - dependencies: - glob "^7.0.5" - -rollup-plugin-terser@1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-1.0.1.tgz#ba5f497cbc9aa38ba19d3ee2167c04ea3ed279af" - dependencies: - "@babel/code-frame" "^7.0.0-beta.47" - terser "^3.7.5" - -rollup@0.64: - version "0.64.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.64.1.tgz#9188ee368e5fcd43ffbc00ec414e72eeb5de87ba" - dependencies: - "@types/estree" "0.0.39" - "@types/node" "*" - -run-async@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" - dependencies: - is-promise "^2.1.0" - -rxjs@^5.5.2: - version "5.5.11" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.11.tgz#f733027ca43e3bec6b994473be4ab98ad43ced87" - dependencies: - symbol-observable "1.0.1" - -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - -seedrandom@2: - version "2.4.4" - resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-2.4.4.tgz#b25ea98632c73e45f58b77cfaa931678df01f9ba" - -semver@^5.5.0: - version "5.5.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" - -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - dependencies: - shebang-regex "^1.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - -signal-exit@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - -slice-ansi@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" - dependencies: - is-fullwidth-code-point "^2.0.0" - -source-map-support@~0.5.6: - version "0.5.9" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - -string-width@^2.1.0, string-width@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string.prototype.trim@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" - dependencies: - define-properties "^1.1.2" - es-abstract "^1.5.0" - function-bind "^1.0.2" - -strip-ansi@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - dependencies: - ansi-regex "^3.0.0" - -strip-json-comments@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - dependencies: - has-flag "^3.0.0" - -symbol-observable@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" - -table@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" - dependencies: - ajv "^6.0.1" - ajv-keywords "^3.0.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" - -tape@4: - version "4.9.1" - resolved "https://registry.yarnpkg.com/tape/-/tape-4.9.1.tgz#1173d7337e040c76fbf42ec86fcabedc9b3805c9" - dependencies: - deep-equal "~1.0.1" - defined "~1.0.0" - for-each "~0.3.3" - function-bind "~1.1.1" - glob "~7.1.2" - has "~1.0.3" - inherits "~2.0.3" - minimist "~1.2.0" - object-inspect "~1.6.0" - resolve "~1.7.1" - resumer "~0.0.0" - string.prototype.trim "~1.1.2" - through "~2.3.8" - -terser@^3.7.5: - version "3.8.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-3.8.1.tgz#cb70070ac9e0a71add169dfb63c0a64fca2738ac" - dependencies: - commander "~2.16.0" - source-map "~0.6.1" - source-map-support "~0.5.6" - -text-table@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - -through@^2.3.6, through@~2.3.4, through@~2.3.8: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - -tmp@^0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - dependencies: - os-tmpdir "~1.0.2" - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - dependencies: - prelude-ls "~1.1.2" - -uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - dependencies: - punycode "^2.1.0" - -which@^1.2.9: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - dependencies: - isexe "^2.0.0" - -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -write@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" - dependencies: - mkdirp "^0.5.1" diff --git a/node_modules/d3-geo-projection/package.json b/node_modules/d3-geo-projection/package.json deleted file mode 100644 index 4020869..0000000 --- a/node_modules/d3-geo-projection/package.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "_from": "d3-geo-projection@^2.9.0", - "_id": "d3-geo-projection@2.9.0", - "_inBundle": false, - "_integrity": "sha512-ZULvK/zBn87of5rWAfFMc9mJOipeSo57O+BBitsKIXmU4rTVAnX1kSsJkE0R+TxY8pGNoM1nbyRRE7GYHhdOEQ==", - "_location": "/d3-geo-projection", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "d3-geo-projection@^2.9.0", - "name": "d3-geo-projection", - "escapedName": "d3-geo-projection", - "rawSpec": "^2.9.0", - "saveSpec": null, - "fetchSpec": "^2.9.0" - }, - "_requiredBy": [ - "/vega-projection" - ], - "_resolved": "https://registry.npmjs.org/d3-geo-projection/-/d3-geo-projection-2.9.0.tgz", - "_shasum": "826db62f748e8ecd67cd00aced4c26a236ec030c", - "_spec": "d3-geo-projection@^2.9.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-projection", - "author": { - "name": "Mike Bostock", - "url": "https://bost.ocks.org/mike" - }, - "bin": { - "geo2svg": "bin/geo2svg", - "geograticule": "bin/geograticule", - "geoproject": "bin/geoproject", - "geoquantize": "bin/geoquantize", - "geostitch": "bin/geostitch" - }, - "bugs": { - "url": "https://github.com/d3/d3-geo-projection/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Jason Davies", - "url": "http://www.jasondavies.com" - }, - { - "name": "Philippe Rivière", - "url": "https://visionscarto.net" - } - ], - "dependencies": { - "commander": "2", - "d3-array": "1", - "d3-geo": "^1.12.0", - "resolve": "^1.1.10" - }, - "deprecated": false, - "description": "Extended geographic projections for d3-geo.", - "devDependencies": { - "canvas": "1", - "d3-format": "1", - "eslint": "5", - "rollup": "0.64", - "rollup-plugin-terser": "1", - "tape": "4", - "topojson-client": "3", - "us-atlas": "1", - "world-atlas": "1" - }, - "files": [ - "bin/geo*", - "bin/**/*.js", - "dist/**/*.js", - "src/**/*.js" - ], - "homepage": "https://d3js.org/d3-geo-projection/", - "jsdelivr": "dist/d3-geo-projection.min.js", - "keywords": [ - "d3", - "d3-module", - "cartography", - "projection" - ], - "license": "BSD-3-Clause", - "main": "dist/d3-geo-projection.js", - "module": "src/index.js", - "name": "d3-geo-projection", - "repository": { - "type": "git", - "url": "git+https://github.com/d3/d3-geo-projection.git" - }, - "scripts": { - "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js", - "prepublishOnly": "rm -rf dist && yarn test && mkdir -p test/output && test/compare-images", - "pretest": "rollup -c", - "test": "tape 'test/**/*-test.js' && eslint src" - }, - "sideEffects": false, - "unpkg": "dist/d3-geo-projection.min.js", - "version": "2.9.0" -} diff --git a/node_modules/d3-geo-projection/src/airy.js b/node_modules/d3-geo-projection/src/airy.js deleted file mode 100644 index fa88ab4..0000000 --- a/node_modules/d3-geo-projection/src/airy.js +++ /dev/null @@ -1,49 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {abs, asin, atan2, cos, degrees, epsilon, halfPi, log, radians, sin, sqrt, tan} from "./math.js"; - -export function airyRaw(beta) { - var tanBeta_2 = tan(beta / 2), - b = 2 * log(cos(beta / 2)) / (tanBeta_2 * tanBeta_2); - - function forward(x, y) { - var cosx = cos(x), - cosy = cos(y), - siny = sin(y), - cosz = cosy * cosx, - k = -((1 - cosz ? log((1 + cosz) / 2) / (1 - cosz) : -0.5) + b / (1 + cosz)); - return [k * cosy * sin(x), k * siny]; - } - - forward.invert = function(x, y) { - var r = sqrt(x * x + y * y), - z = -beta / 2, - i = 50, delta; - if (!r) return [0, 0]; - do { - var z_2 = z / 2, - cosz_2 = cos(z_2), - sinz_2 = sin(z_2), - tanz_2 = sinz_2 / cosz_2, - lnsecz_2 = -log(abs(cosz_2)); - z -= delta = (2 / tanz_2 * lnsecz_2 - b * tanz_2 - r) / (-lnsecz_2 / (sinz_2 * sinz_2) + 1 - b / (2 * cosz_2 * cosz_2)) * (cosz_2 < 0 ? 0.7 : 1); - } while (abs(delta) > epsilon && --i > 0); - var sinz = sin(z); - return [atan2(x * sinz, r * cos(z)), asin(y * sinz / r)]; - }; - - return forward; -} - -export default function() { - var beta = halfPi, - m = projectionMutator(airyRaw), - p = m(beta); - - p.radius = function(_) { - return arguments.length ? m(beta = _ * radians) : beta * degrees; - }; - - return p - .scale(179.976) - .clipAngle(147); -} diff --git a/node_modules/d3-geo-projection/src/aitoff.js b/node_modules/d3-geo-projection/src/aitoff.js deleted file mode 100644 index a88efe7..0000000 --- a/node_modules/d3-geo-projection/src/aitoff.js +++ /dev/null @@ -1,45 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, acos, cos, epsilon, pi, sin, sinci, sqrt} from "./math.js"; - -export function aitoffRaw(x, y) { - var cosy = cos(y), sincia = sinci(acos(cosy * cos(x /= 2))); - return [2 * cosy * sin(x) * sincia, sin(y) * sincia]; -} - -// Abort if [x, y] is not within an ellipse centered at [0, 0] with -// semi-major axis pi and semi-minor axis pi/2. -aitoffRaw.invert = function(x, y) { - if (x * x + 4 * y * y > pi * pi + epsilon) return; - var x1 = x, y1 = y, i = 25; - do { - var sinx = sin(x1), - sinx_2 = sin(x1 / 2), - cosx_2 = cos(x1 / 2), - siny = sin(y1), - cosy = cos(y1), - sin_2y = sin(2 * y1), - sin2y = siny * siny, - cos2y = cosy * cosy, - sin2x_2 = sinx_2 * sinx_2, - c = 1 - cos2y * cosx_2 * cosx_2, - e = c ? acos(cosy * cosx_2) * sqrt(f = 1 / c) : f = 0, - f, - fx = 2 * e * cosy * sinx_2 - x, - fy = e * siny - y, - dxdx = f * (cos2y * sin2x_2 + e * cosy * cosx_2 * sin2y), - dxdy = f * (0.5 * sinx * sin_2y - e * 2 * siny * sinx_2), - dydx = f * 0.25 * (sin_2y * sinx_2 - e * siny * cos2y * sinx), - dydy = f * (sin2y * cosx_2 + e * sin2x_2 * cosy), - z = dxdy * dydx - dydy * dxdx; - if (!z) break; - var dx = (fy * dxdy - fx * dydy) / z, - dy = (fx * dydx - fy * dxdx) / z; - x1 -= dx, y1 -= dy; - } while ((abs(dx) > epsilon || abs(dy) > epsilon) && --i > 0); - return [x1, y1]; -}; - -export default function() { - return projection(aitoffRaw) - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/armadillo.js b/node_modules/d3-geo-projection/src/armadillo.js deleted file mode 100644 index fc355ef..0000000 --- a/node_modules/d3-geo-projection/src/armadillo.js +++ /dev/null @@ -1,83 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {abs, atan2, cos, degrees, epsilon, radians, sin, tan} from "./math.js"; - -export function armadilloRaw(phi0) { - var sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0), - sPhi0 = phi0 >= 0 ? 1 : -1, - tanPhi0 = tan(sPhi0 * phi0), - k = (1 + sinPhi0 - cosPhi0) / 2; - - function forward(lambda, phi) { - var cosPhi = cos(phi), - cosLambda = cos(lambda /= 2); - return [ - (1 + cosPhi) * sin(lambda), - (sPhi0 * phi > -atan2(cosLambda, tanPhi0) - 1e-3 ? 0 : -sPhi0 * 10) + k + sin(phi) * cosPhi0 - (1 + cosPhi) * sinPhi0 * cosLambda // TODO D3 core should allow null or [NaN, NaN] to be returned. - ]; - } - - forward.invert = function(x, y) { - var lambda = 0, - phi = 0, - i = 50; - do { - var cosLambda = cos(lambda), - sinLambda = sin(lambda), - cosPhi = cos(phi), - sinPhi = sin(phi), - A = 1 + cosPhi, - fx = A * sinLambda - x, - fy = k + sinPhi * cosPhi0 - A * sinPhi0 * cosLambda - y, - dxdLambda = A * cosLambda / 2, - dxdPhi = -sinLambda * sinPhi, - dydLambda = sinPhi0 * A * sinLambda / 2, - dydPhi = cosPhi0 * cosPhi + sinPhi0 * cosLambda * sinPhi, - denominator = dxdPhi * dydLambda - dydPhi * dxdLambda, - dLambda = (fy * dxdPhi - fx * dydPhi) / denominator / 2, - dPhi = (fx * dydLambda - fy * dxdLambda) / denominator; - if (abs(dPhi) > 2) dPhi /= 2; - lambda -= dLambda, phi -= dPhi; - } while ((abs(dLambda) > epsilon || abs(dPhi) > epsilon) && --i > 0); - return sPhi0 * phi > -atan2(cos(lambda), tanPhi0) - 1e-3 ? [lambda * 2, phi] : null; - }; - - return forward; -} - -export default function() { - var phi0 = 20 * radians, - sPhi0 = phi0 >= 0 ? 1 : -1, - tanPhi0 = tan(sPhi0 * phi0), - m = projectionMutator(armadilloRaw), - p = m(phi0), - stream_ = p.stream; - - p.parallel = function(_) { - if (!arguments.length) return phi0 * degrees; - tanPhi0 = tan((sPhi0 = (phi0 = _ * radians) >= 0 ? 1 : -1) * phi0); - return m(phi0); - }; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = stream_(stream), - sphereStream = (p.rotate([0, 0]), stream_(stream)), - precision = p.precision(); - p.rotate(rotate); - rotateStream.sphere = function() { - sphereStream.polygonStart(), sphereStream.lineStart(); - for (var lambda = sPhi0 * -180; sPhi0 * lambda < 180; lambda += sPhi0 * 90) - sphereStream.point(lambda, sPhi0 * 90); - if (phi0) while (sPhi0 * (lambda -= 3 * sPhi0 * precision) >= -180) { - sphereStream.point(lambda, sPhi0 * -atan2(cos(lambda * radians / 2), tanPhi0) * degrees); - } - sphereStream.lineEnd(), sphereStream.polygonEnd(); - }; - return rotateStream; - }; - - return p - .scale(218.695) - .center([0, 28.0974]); -} diff --git a/node_modules/d3-geo-projection/src/august.js b/node_modules/d3-geo-projection/src/august.js deleted file mode 100644 index f037626..0000000 --- a/node_modules/d3-geo-projection/src/august.js +++ /dev/null @@ -1,39 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, arcosh, arsinh, asin, atan2, cos, cosh, sign, sin, sinh, sqrt, tan} from "./math.js"; - -export function augustRaw(lambda, phi) { - var tanPhi = tan(phi / 2), - k = sqrt(1 - tanPhi * tanPhi), - c = 1 + k * cos(lambda /= 2), - x = sin(lambda) * k / c, - y = tanPhi / c, - x2 = x * x, - y2 = y * y; - return [ - 4 / 3 * x * (3 + x2 - 3 * y2), - 4 / 3 * y * (3 + 3 * x2 - y2) - ]; -} - -augustRaw.invert = function(x, y) { - x *= 3 / 8, y *= 3 / 8; - if (!x && abs(y) > 1) return null; - var x2 = x * x, - y2 = y * y, - s = 1 + x2 + y2, - sin3Eta = sqrt((s - sqrt(s * s - 4 * y * y)) / 2), - eta = asin(sin3Eta) / 3, - xi = sin3Eta ? arcosh(abs(y / sin3Eta)) / 3 : arsinh(abs(x)) / 3, - cosEta = cos(eta), - coshXi = cosh(xi), - d = coshXi * coshXi - cosEta * cosEta; - return [ - sign(x) * 2 * atan2(sinh(xi) * cosEta, 0.25 - d), - sign(y) * 2 * atan2(coshXi * sin(eta), 0.25 + d) - ]; -}; - -export default function() { - return projection(augustRaw) - .scale(66.1603); -} diff --git a/node_modules/d3-geo-projection/src/baker.js b/node_modules/d3-geo-projection/src/baker.js deleted file mode 100644 index ffd7b9f..0000000 --- a/node_modules/d3-geo-projection/src/baker.js +++ /dev/null @@ -1,27 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, atan, cos, epsilon2, exp, halfPi, log, quarterPi, sign, sin, sqrt, sqrt2, tan} from "./math.js"; - -var sqrt8 = sqrt(8), - phi0 = log(1 + sqrt2); - -export function bakerRaw(lambda, phi) { - var phi0 = abs(phi); - return phi0 < quarterPi - ? [lambda, log(tan(quarterPi + phi / 2))] - : [lambda * cos(phi0) * (2 * sqrt2 - 1 / sin(phi0)), sign(phi) * (2 * sqrt2 * (phi0 - quarterPi) - log(tan(phi0 / 2)))]; -} - -bakerRaw.invert = function(x, y) { - if ((y0 = abs(y)) < phi0) return [x, 2 * atan(exp(y)) - halfPi]; - var phi = quarterPi, i = 25, delta, y0; - do { - var cosPhi_2 = cos(phi / 2), tanPhi_2 = tan(phi / 2); - phi -= delta = (sqrt8 * (phi - quarterPi) - log(tanPhi_2) - y0) / (sqrt8 - cosPhi_2 * cosPhi_2 / (2 * tanPhi_2)); - } while (abs(delta) > epsilon2 && --i > 0); - return [x / (cos(phi) * (sqrt8 - 1 / sin(phi))), sign(y) * phi]; -}; - -export default function() { - return projection(bakerRaw) - .scale(112.314); -} diff --git a/node_modules/d3-geo-projection/src/berghaus.js b/node_modules/d3-geo-projection/src/berghaus.js deleted file mode 100644 index 738c6ce..0000000 --- a/node_modules/d3-geo-projection/src/berghaus.js +++ /dev/null @@ -1,77 +0,0 @@ -import {geoProjectionMutator as projectionMutator, geoAzimuthalEquidistantRaw as azimuthalEquidistantRaw} from "d3-geo"; -import {abs, acos, asin, atan, atan2, cos, degrees, halfPi, pi, radians, round, sin, sqrt, tan} from "./math.js"; - -export function berghausRaw(lobes) { - var k = 2 * pi / lobes; - - function forward(lambda, phi) { - var p = azimuthalEquidistantRaw(lambda, phi); - if (abs(lambda) > halfPi) { // back hemisphere - var theta = atan2(p[1], p[0]), - r = sqrt(p[0] * p[0] + p[1] * p[1]), - theta0 = k * round((theta - halfPi) / k) + halfPi, - alpha = atan2(sin(theta -= theta0), 2 - cos(theta)); // angle relative to lobe end - theta = theta0 + asin(pi / r * sin(alpha)) - alpha; - p[0] = r * cos(theta); - p[1] = r * sin(theta); - } - return p; - } - - forward.invert = function(x, y) { - var r = sqrt(x * x + y * y); - if (r > halfPi) { - var theta = atan2(y, x), - theta0 = k * round((theta - halfPi) / k) + halfPi, - s = theta > theta0 ? -1 : 1, - A = r * cos(theta0 - theta), - cotAlpha = 1 / tan(s * acos((A - pi) / sqrt(pi * (pi - 2 * A) + r * r))); - theta = theta0 + 2 * atan((cotAlpha + s * sqrt(cotAlpha * cotAlpha - 3)) / 3); - x = r * cos(theta), y = r * sin(theta); - } - return azimuthalEquidistantRaw.invert(x, y); - }; - - return forward; -} - -export default function() { - var lobes = 5, - m = projectionMutator(berghausRaw), - p = m(lobes), - projectionStream = p.stream, - epsilon = 1e-2, - cr = -cos(epsilon * radians), - sr = sin(epsilon * radians); - - p.lobes = function(_) { - return arguments.length ? m(lobes = +_) : lobes; - }; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = projectionStream(stream), - sphereStream = (p.rotate([0, 0]), projectionStream(stream)); - p.rotate(rotate); - rotateStream.sphere = function() { - sphereStream.polygonStart(), sphereStream.lineStart(); - for (var i = 0, delta = 360 / lobes, delta0 = 2 * pi / lobes, phi = 90 - 180 / lobes, phi0 = halfPi; i < lobes; ++i, phi -= delta, phi0 -= delta0) { - sphereStream.point(atan2(sr * cos(phi0), cr) * degrees, asin(sr * sin(phi0)) * degrees); - if (phi < -90) { - sphereStream.point(-90, -180 - phi - epsilon); - sphereStream.point(-90, -180 - phi + epsilon); - } else { - sphereStream.point(90, phi + epsilon); - sphereStream.point(90, phi - epsilon); - } - } - sphereStream.lineEnd(), sphereStream.polygonEnd(); - }; - return rotateStream; - }; - - return p - .scale(87.8076) - .center([0, 17.1875]) - .clipAngle(180 - 1e-3); -} diff --git a/node_modules/d3-geo-projection/src/bertin.js b/node_modules/d3-geo-projection/src/bertin.js deleted file mode 100644 index de9012e..0000000 --- a/node_modules/d3-geo-projection/src/bertin.js +++ /dev/null @@ -1,44 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {hammerRaw} from "./hammer.js"; -import {cos, pi, sin} from "./math.js"; -import {solve2d} from "./newton.js"; - -// Bertin 1953 as a modified Briesemeister -// https://bl.ocks.org/Fil/5b9ee9636dfb6ffa53443c9006beb642 -export function bertin1953Raw() { - var hammer = hammerRaw(1.68, 2), - fu = 1.4, k = 12; - - function forward(lambda, phi) { - - if (lambda + phi < -fu) { - var u = (lambda - phi + 1.6) * (lambda + phi + fu) / 8; - lambda += u; - phi -= 0.8 * u * sin(phi + pi / 2); - } - - var r = hammer(lambda, phi); - - var d = (1 - cos(lambda * phi)) / k; - - if (r[1] < 0) { - r[0] *= 1 + d; - } - if (r[1] > 0) { - r[1] *= 1 + d / 1.5 * r[0] * r[0]; - } - - return r; - } - - forward.invert = solve2d(forward); - return forward; -} - -export default function() { - // this projection should not be rotated - return projection(bertin1953Raw()) - .rotate([-16.5, -42]) - .scale(176.57) - .center([7.93, 0.09]); -} diff --git a/node_modules/d3-geo-projection/src/boggs.js b/node_modules/d3-geo-projection/src/boggs.js deleted file mode 100644 index 1633adf..0000000 --- a/node_modules/d3-geo-projection/src/boggs.js +++ /dev/null @@ -1,26 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {mollweideBromleyTheta} from "./mollweide.js"; -import {abs, cos, epsilon, pi, quarterPi, sin, sqrt2} from "./math.js"; - -var k = 2.00276, - w = 1.11072; - -export function boggsRaw(lambda, phi) { - var theta = mollweideBromleyTheta(pi, phi); - return [k * lambda / (1 / cos(phi) + w / cos(theta)), (phi + sqrt2 * sin(theta)) / k]; -} - -boggsRaw.invert = function(x, y) { - var ky = k * y, theta = y < 0 ? -quarterPi : quarterPi, i = 25, delta, phi; - do { - phi = ky - sqrt2 * sin(theta); - theta -= delta = (sin(2 * theta) + 2 * theta - pi * sin(phi)) / (2 * cos(2 * theta) + 2 + pi * cos(phi) * sqrt2 * cos(theta)); - } while (abs(delta) > epsilon && --i > 0); - phi = ky - sqrt2 * sin(theta); - return [x * (1 / cos(phi) + w / cos(theta)) / k, phi]; -}; - -export default function() { - return projection(boggsRaw) - .scale(160.857); -} diff --git a/node_modules/d3-geo-projection/src/bonne.js b/node_modules/d3-geo-projection/src/bonne.js deleted file mode 100644 index 68978e8..0000000 --- a/node_modules/d3-geo-projection/src/bonne.js +++ /dev/null @@ -1,29 +0,0 @@ -import parallel1 from "./parallel1.js"; -import {atan2, cos, sin, sqrt, tan} from "./math.js"; -import {sinusoidalRaw} from "./sinusoidal.js"; - -export function bonneRaw(phi0) { - if (!phi0) return sinusoidalRaw; - var cotPhi0 = 1 / tan(phi0); - - function forward(lambda, phi) { - var rho = cotPhi0 + phi0 - phi, - e = rho ? lambda * cos(phi) / rho : rho; - return [rho * sin(e), cotPhi0 - rho * cos(e)]; - } - - forward.invert = function(x, y) { - var rho = sqrt(x * x + (y = cotPhi0 - y) * y), - phi = cotPhi0 + phi0 - rho; - return [rho / cos(phi) * atan2(x, y), phi]; - }; - - return forward; -} - -export default function() { - return parallel1(bonneRaw) - .scale(123.082) - .center([0, 26.1441]) - .parallel(45); -} diff --git a/node_modules/d3-geo-projection/src/bottomley.js b/node_modules/d3-geo-projection/src/bottomley.js deleted file mode 100644 index 84f8feb..0000000 --- a/node_modules/d3-geo-projection/src/bottomley.js +++ /dev/null @@ -1,34 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {atan2, cos, halfPi, sin, sqrt} from "./math.js"; - -export function bottomleyRaw(sinPsi) { - - function forward(lambda, phi) { - var rho = halfPi - phi, - eta = rho ? lambda * sinPsi * sin(rho) / rho : rho; - return [rho * sin(eta) / sinPsi, halfPi - rho * cos(eta)]; - } - - forward.invert = function(x, y) { - var x1 = x * sinPsi, - y1 = halfPi - y, - rho = sqrt(x1 * x1 + y1 * y1), - eta = atan2(x1, y1); - return [(rho ? rho / sin(rho) : 1) * eta / sinPsi, halfPi - rho]; - }; - - return forward; -} - -export default function() { - var sinPsi = 0.5, - m = projectionMutator(bottomleyRaw), - p = m(sinPsi); - - p.fraction = function(_) { - return arguments.length ? m(sinPsi = +_) : sinPsi; - }; - - return p - .scale(158.837); -} diff --git a/node_modules/d3-geo-projection/src/bromley.js b/node_modules/d3-geo-projection/src/bromley.js deleted file mode 100644 index 5fc40a7..0000000 --- a/node_modules/d3-geo-projection/src/bromley.js +++ /dev/null @@ -1,10 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {pi} from "./math.js"; -import {mollweideBromleyRaw} from "./mollweide.js"; - -export var bromleyRaw = mollweideBromleyRaw(1, 4 / pi, pi); - -export default function() { - return projection(bromleyRaw) - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/chamberlin.js b/node_modules/d3-geo-projection/src/chamberlin.js deleted file mode 100644 index c379be6..0000000 --- a/node_modules/d3-geo-projection/src/chamberlin.js +++ /dev/null @@ -1,120 +0,0 @@ -import {geoCentroid as centroid, geoProjection as projection, geoRotation as rotation} from "d3-geo"; -import {abs, acos, asin, atan2, cos, epsilon, floor, pi, radians, sin, sqrt} from "./math.js"; -import {solve2d} from "./newton.js"; - -// Azimuthal distance. -function distance(dPhi, c1, s1, c2, s2, dLambda) { - var cosdLambda = cos(dLambda), r; - if (abs(dPhi) > 1 || abs(dLambda) > 1) { - r = acos(s1 * s2 + c1 * c2 * cosdLambda); - } else { - var sindPhi = sin(dPhi / 2), sindLambda = sin(dLambda / 2); - r = 2 * asin(sqrt(sindPhi * sindPhi + c1 * c2 * sindLambda * sindLambda)); - } - return abs(r) > epsilon ? [r, atan2(c2 * sin(dLambda), c1 * s2 - s1 * c2 * cosdLambda)] : [0, 0]; -} - -// Angle opposite a, and contained between sides of lengths b and c. -function angle(b, c, a) { - return acos((b * b + c * c - a * a) / (2 * b * c)); -} - -// Normalize longitude. -function longitude(lambda) { - return lambda - 2 * pi * floor((lambda + pi) / (2 * pi)); -} - -export function chamberlinRaw(p0, p1, p2) { - var points = [ - [p0[0], p0[1], sin(p0[1]), cos(p0[1])], - [p1[0], p1[1], sin(p1[1]), cos(p1[1])], - [p2[0], p2[1], sin(p2[1]), cos(p2[1])] - ]; - - for (var a = points[2], b, i = 0; i < 3; ++i, a = b) { - b = points[i]; - a.v = distance(b[1] - a[1], a[3], a[2], b[3], b[2], b[0] - a[0]); - a.point = [0, 0]; - } - - var beta0 = angle(points[0].v[0], points[2].v[0], points[1].v[0]), - beta1 = angle(points[0].v[0], points[1].v[0], points[2].v[0]), - beta2 = pi - beta0; - - points[2].point[1] = 0; - points[0].point[0] = -(points[1].point[0] = points[0].v[0] / 2); - - var mean = [ - points[2].point[0] = points[0].point[0] + points[2].v[0] * cos(beta0), - 2 * (points[0].point[1] = points[1].point[1] = points[2].v[0] * sin(beta0)) - ]; - - function forward(lambda, phi) { - var sinPhi = sin(phi), - cosPhi = cos(phi), - v = new Array(3), i; - - // Compute distance and azimuth from control points. - for (i = 0; i < 3; ++i) { - var p = points[i]; - v[i] = distance(phi - p[1], p[3], p[2], cosPhi, sinPhi, lambda - p[0]); - if (!v[i][0]) return p.point; - v[i][1] = longitude(v[i][1] - p.v[1]); - } - - // Arithmetic mean of interception points. - var point = mean.slice(); - for (i = 0; i < 3; ++i) { - var j = i == 2 ? 0 : i + 1; - var a = angle(points[i].v[0], v[i][0], v[j][0]); - if (v[i][1] < 0) a = -a; - - if (!i) { - point[0] += v[i][0] * cos(a); - point[1] -= v[i][0] * sin(a); - } else if (i == 1) { - a = beta1 - a; - point[0] -= v[i][0] * cos(a); - point[1] -= v[i][0] * sin(a); - } else { - a = beta2 - a; - point[0] += v[i][0] * cos(a); - point[1] += v[i][0] * sin(a); - } - } - - point[0] /= 3, point[1] /= 3; - return point; - } - - return forward; -} - -function pointRadians(p) { - return p[0] *= radians, p[1] *= radians, p; -} - -export function chamberlinAfrica() { - return chamberlin([0, 22], [45, 22], [22.5, -22]) - .scale(380) - .center([22.5, 2]); -} - -export default function chamberlin(p0, p1, p2) { // TODO order matters! - var c = centroid({type: "MultiPoint", coordinates: [p0, p1, p2]}), - R = [-c[0], -c[1]], - r = rotation(R), - f = chamberlinRaw(pointRadians(r(p0)), pointRadians(r(p1)), pointRadians(r(p2))); - f.invert = solve2d(f); - var p = projection(f).rotate(R), - center = p.center; - - delete p.rotate; - - p.center = function(_) { - return arguments.length ? center(r(_)) : r.invert(center()); - }; - - return p - .clipAngle(90); -} diff --git a/node_modules/d3-geo-projection/src/collignon.js b/node_modules/d3-geo-projection/src/collignon.js deleted file mode 100644 index c375dce..0000000 --- a/node_modules/d3-geo-projection/src/collignon.js +++ /dev/null @@ -1,18 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {asin, pi, sin, sqrt, sqrtPi} from "./math.js"; - -export function collignonRaw(lambda, phi) { - var alpha = sqrt(1 - sin(phi)); - return [(2 / sqrtPi) * lambda * alpha, sqrtPi * (1 - alpha)]; -} - -collignonRaw.invert = function(x, y) { - var lambda = (lambda = y / sqrtPi - 1) * lambda; - return [lambda > 0 ? x * sqrt(pi / lambda) / 2 : 0, asin(1 - lambda)]; -}; - -export default function() { - return projection(collignonRaw) - .scale(95.6464) - .center([0, 30]); -} diff --git a/node_modules/d3-geo-projection/src/craig.js b/node_modules/d3-geo-projection/src/craig.js deleted file mode 100644 index 8d0bb3b..0000000 --- a/node_modules/d3-geo-projection/src/craig.js +++ /dev/null @@ -1,26 +0,0 @@ -import {asin, atan2, cos, sin, sqrt, tan} from "./math.js"; -import parallel1 from "./parallel1.js"; - -export function craigRaw(phi0) { - var tanPhi0 = tan(phi0); - - function forward(lambda, phi) { - return [lambda, (lambda ? lambda / sin(lambda) : 1) * (sin(phi) * cos(lambda) - tanPhi0 * cos(phi))]; - } - - forward.invert = tanPhi0 ? function(x, y) { - if (x) y *= sin(x) / x; - var cosLambda = cos(x); - return [x, 2 * atan2(sqrt(cosLambda * cosLambda + tanPhi0 * tanPhi0 - y * y) - cosLambda, tanPhi0 - y)]; - } : function(x, y) { - return [x, asin(x ? y * tan(x) / x : y)]; - }; - - return forward; -} - -export default function() { - return parallel1(craigRaw) - .scale(249.828) - .clipAngle(90); -} diff --git a/node_modules/d3-geo-projection/src/craster.js b/node_modules/d3-geo-projection/src/craster.js deleted file mode 100644 index de662dc..0000000 --- a/node_modules/d3-geo-projection/src/craster.js +++ /dev/null @@ -1,18 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {asin, cos, sin, sqrt, sqrtPi} from "./math.js"; - -var sqrt3 = sqrt(3); - -export function crasterRaw(lambda, phi) { - return [sqrt3 * lambda * (2 * cos(2 * phi / 3) - 1) / sqrtPi, sqrt3 * sqrtPi * sin(phi / 3)]; -} - -crasterRaw.invert = function(x, y) { - var phi = 3 * asin(y / (sqrt3 * sqrtPi)); - return [sqrtPi * x / (sqrt3 * (2 * cos(2 * phi / 3) - 1)), phi]; -}; - -export default function() { - return projection(crasterRaw) - .scale(156.19); -} diff --git a/node_modules/d3-geo-projection/src/cylindricalEqualArea.js b/node_modules/d3-geo-projection/src/cylindricalEqualArea.js deleted file mode 100644 index 34daed1..0000000 --- a/node_modules/d3-geo-projection/src/cylindricalEqualArea.js +++ /dev/null @@ -1,22 +0,0 @@ -import {asin, cos, sin} from "./math.js"; -import parallel1 from "./parallel1.js"; - -export function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = cos(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, sin(phi) / cosPhi0]; - } - - forward.invert = function(x, y) { - return [x / cosPhi0, asin(y * cosPhi0)]; - }; - - return forward; -} - -export default function() { - return parallel1(cylindricalEqualAreaRaw) - .parallel(38.58) // acos(sqrt(width / height / pi)) * radians - .scale(195.044); // width / (sqrt(width / height / pi) * 2 * pi) -} diff --git a/node_modules/d3-geo-projection/src/cylindricalStereographic.js b/node_modules/d3-geo-projection/src/cylindricalStereographic.js deleted file mode 100644 index 7173eb5..0000000 --- a/node_modules/d3-geo-projection/src/cylindricalStereographic.js +++ /dev/null @@ -1,21 +0,0 @@ -import {atan, cos, tan} from "./math.js"; -import parallel1 from "./parallel1.js"; - -export function cylindricalStereographicRaw(phi0) { - var cosPhi0 = cos(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, (1 + cosPhi0) * tan(phi / 2)]; - } - - forward.invert = function(x, y) { - return [x / cosPhi0, atan(y / (1 + cosPhi0)) * 2]; - }; - - return forward; -} - -export default function() { - return parallel1(cylindricalStereographicRaw) - .scale(124.75); -} diff --git a/node_modules/d3-geo-projection/src/eckert1.js b/node_modules/d3-geo-projection/src/eckert1.js deleted file mode 100644 index 1afc025..0000000 --- a/node_modules/d3-geo-projection/src/eckert1.js +++ /dev/null @@ -1,24 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, pi, sqrt} from "./math.js"; - -export function eckert1Raw(lambda, phi) { - var alpha = sqrt(8 / (3 * pi)); - return [ - alpha * lambda * (1 - abs(phi) / pi), - alpha * phi - ]; -} - -eckert1Raw.invert = function(x, y) { - var alpha = sqrt(8 / (3 * pi)), - phi = y / alpha; - return [ - x / (alpha * (1 - abs(phi) / pi)), - phi - ]; -}; - -export default function() { - return projection(eckert1Raw) - .scale(165.664); -} diff --git a/node_modules/d3-geo-projection/src/eckert2.js b/node_modules/d3-geo-projection/src/eckert2.js deleted file mode 100644 index dcb2a52..0000000 --- a/node_modules/d3-geo-projection/src/eckert2.js +++ /dev/null @@ -1,23 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, asin, pi, sign, sin, sqrt} from "./math.js"; - -export function eckert2Raw(lambda, phi) { - var alpha = sqrt(4 - 3 * sin(abs(phi))); - return [ - 2 / sqrt(6 * pi) * lambda * alpha, - sign(phi) * sqrt(2 * pi / 3) * (2 - alpha) - ]; -} - -eckert2Raw.invert = function(x, y) { - var alpha = 2 - abs(y) / sqrt(2 * pi / 3); - return [ - x * sqrt(6 * pi) / (2 * alpha), - sign(y) * asin((4 - alpha * alpha) / 3) - ]; -}; - -export default function() { - return projection(eckert2Raw) - .scale(165.664); -} diff --git a/node_modules/d3-geo-projection/src/eckert3.js b/node_modules/d3-geo-projection/src/eckert3.js deleted file mode 100644 index 7bce19a..0000000 --- a/node_modules/d3-geo-projection/src/eckert3.js +++ /dev/null @@ -1,23 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {pi, sqrt} from "./math.js"; - -export function eckert3Raw(lambda, phi) { - var k = sqrt(pi * (4 + pi)); - return [ - 2 / k * lambda * (1 + sqrt(1 - 4 * phi * phi / (pi * pi))), - 4 / k * phi - ]; -} - -eckert3Raw.invert = function(x, y) { - var k = sqrt(pi * (4 + pi)) / 2; - return [ - x * k / (1 + sqrt(1 - y * y * (4 + pi) / (4 * pi))), - y * k / 2 - ]; -}; - -export default function() { - return projection(eckert3Raw) - .scale(180.739); -} diff --git a/node_modules/d3-geo-projection/src/eckert4.js b/node_modules/d3-geo-projection/src/eckert4.js deleted file mode 100644 index 485a802..0000000 --- a/node_modules/d3-geo-projection/src/eckert4.js +++ /dev/null @@ -1,30 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, asin, cos, epsilon, halfPi, pi, sin, sqrt} from "./math.js"; - -export function eckert4Raw(lambda, phi) { - var k = (2 + halfPi) * sin(phi); - phi /= 2; - for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; i++) { - var cosPhi = cos(phi); - phi -= delta = (phi + sin(phi) * (cosPhi + 2) - k) / (2 * cosPhi * (1 + cosPhi)); - } - return [ - 2 / sqrt(pi * (4 + pi)) * lambda * (1 + cos(phi)), - 2 * sqrt(pi / (4 + pi)) * sin(phi) - ]; -} - -eckert4Raw.invert = function(x, y) { - var A = y * sqrt((4 + pi) / pi) / 2, - k = asin(A), - c = cos(k); - return [ - x / (2 / sqrt(pi * (4 + pi)) * (1 + c)), - asin((k + A * (c + 2)) / (2 + halfPi)) - ]; -}; - -export default function() { - return projection(eckert4Raw) - .scale(180.739); -} diff --git a/node_modules/d3-geo-projection/src/eckert5.js b/node_modules/d3-geo-projection/src/eckert5.js deleted file mode 100644 index abfbbc9..0000000 --- a/node_modules/d3-geo-projection/src/eckert5.js +++ /dev/null @@ -1,23 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {cos, pi, sqrt} from "./math.js"; - -export function eckert5Raw(lambda, phi) { - return [ - lambda * (1 + cos(phi)) / sqrt(2 + pi), - 2 * phi / sqrt(2 + pi) - ]; -} - -eckert5Raw.invert = function(x, y) { - var k = sqrt(2 + pi), - phi = y * k / 2; - return [ - k * x / (1 + cos(phi)), - phi - ]; -}; - -export default function() { - return projection(eckert5Raw) - .scale(173.044); -} diff --git a/node_modules/d3-geo-projection/src/eckert6.js b/node_modules/d3-geo-projection/src/eckert6.js deleted file mode 100644 index 49afd7e..0000000 --- a/node_modules/d3-geo-projection/src/eckert6.js +++ /dev/null @@ -1,28 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, asin, cos, epsilon, halfPi, pi, sin, sqrt} from "./math.js"; - -export function eckert6Raw(lambda, phi) { - var k = (1 + halfPi) * sin(phi); - for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; i++) { - phi -= delta = (phi + sin(phi) - k) / (1 + cos(phi)); - } - k = sqrt(2 + pi); - return [ - lambda * (1 + cos(phi)) / k, - 2 * phi / k - ]; -} - -eckert6Raw.invert = function(x, y) { - var j = 1 + halfPi, - k = sqrt(j / 2); - return [ - x * 2 * k / (1 + cos(y *= k)), - asin((y + sin(y)) / j) - ]; -}; - -export default function() { - return projection(eckert6Raw) - .scale(173.044); -} diff --git a/node_modules/d3-geo-projection/src/eisenlohr.js b/node_modules/d3-geo-projection/src/eisenlohr.js deleted file mode 100644 index e643aa9..0000000 --- a/node_modules/d3-geo-projection/src/eisenlohr.js +++ /dev/null @@ -1,70 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {augustRaw} from "./august.js"; -import {abs, atan, cos, epsilon, halfPi, log, max, min, sin, sqrt, sqrt1_2, sqrt2} from "./math.js"; - -var eisenlohrK = 3 + 2 * sqrt2; - -export function eisenlohrRaw(lambda, phi) { - var s0 = sin(lambda /= 2), - c0 = cos(lambda), - k = sqrt(cos(phi)), - c1 = cos(phi /= 2), - t = sin(phi) / (c1 + sqrt2 * c0 * k), - c = sqrt(2 / (1 + t * t)), - v = sqrt((sqrt2 * c1 + (c0 + s0) * k) / (sqrt2 * c1 + (c0 - s0) * k)); - return [ - eisenlohrK * (c * (v - 1 / v) - 2 * log(v)), - eisenlohrK * (c * t * (v + 1 / v) - 2 * atan(t)) - ]; -} - -eisenlohrRaw.invert = function(x, y) { - if (!(p = augustRaw.invert(x / 1.2, y * 1.065))) return null; - var lambda = p[0], phi = p[1], i = 20, p; - x /= eisenlohrK, y /= eisenlohrK; - do { - var _0 = lambda / 2, - _1 = phi / 2, - s0 = sin(_0), - c0 = cos(_0), - s1 = sin(_1), - c1 = cos(_1), - cos1 = cos(phi), - k = sqrt(cos1), - t = s1 / (c1 + sqrt2 * c0 * k), - t2 = t * t, - c = sqrt(2 / (1 + t2)), - v0 = (sqrt2 * c1 + (c0 + s0) * k), - v1 = (sqrt2 * c1 + (c0 - s0) * k), - v2 = v0 / v1, - v = sqrt(v2), - vm1v = v - 1 / v, - vp1v = v + 1 / v, - fx = c * vm1v - 2 * log(v) - x, - fy = c * t * vp1v - 2 * atan(t) - y, - deltatDeltaLambda = s1 && sqrt1_2 * k * s0 * t2 / s1, - deltatDeltaPhi = (sqrt2 * c0 * c1 + k) / (2 * (c1 + sqrt2 * c0 * k) * (c1 + sqrt2 * c0 * k) * k), - deltacDeltat = -0.5 * t * c * c * c, - deltacDeltaLambda = deltacDeltat * deltatDeltaLambda, - deltacDeltaPhi = deltacDeltat * deltatDeltaPhi, - A = (A = 2 * c1 + sqrt2 * k * (c0 - s0)) * A * v, - deltavDeltaLambda = (sqrt2 * c0 * c1 * k + cos1) / A, - deltavDeltaPhi = -(sqrt2 * s0 * s1) / (k * A), - deltaxDeltaLambda = vm1v * deltacDeltaLambda - 2 * deltavDeltaLambda / v + c * (deltavDeltaLambda + deltavDeltaLambda / v2), - deltaxDeltaPhi = vm1v * deltacDeltaPhi - 2 * deltavDeltaPhi / v + c * (deltavDeltaPhi + deltavDeltaPhi / v2), - deltayDeltaLambda = t * vp1v * deltacDeltaLambda - 2 * deltatDeltaLambda / (1 + t2) + c * vp1v * deltatDeltaLambda + c * t * (deltavDeltaLambda - deltavDeltaLambda / v2), - deltayDeltaPhi = t * vp1v * deltacDeltaPhi - 2 * deltatDeltaPhi / (1 + t2) + c * vp1v * deltatDeltaPhi + c * t * (deltavDeltaPhi - deltavDeltaPhi / v2), - denominator = deltaxDeltaPhi * deltayDeltaLambda - deltayDeltaPhi * deltaxDeltaLambda; - if (!denominator) break; - var deltaLambda = (fy * deltaxDeltaPhi - fx * deltayDeltaPhi) / denominator, - deltaPhi = (fx * deltayDeltaLambda - fy * deltaxDeltaLambda) / denominator; - lambda -= deltaLambda; - phi = max(-halfPi, min(halfPi, phi - deltaPhi)); - } while ((abs(deltaLambda) > epsilon || abs(deltaPhi) > epsilon) && --i > 0); - return abs(abs(phi) - halfPi) < epsilon ? [0, phi] : i && [lambda, phi]; -}; - -export default function() { - return projection(eisenlohrRaw) - .scale(62.5271); -} diff --git a/node_modules/d3-geo-projection/src/elliptic.js b/node_modules/d3-geo-projection/src/elliptic.js deleted file mode 100644 index a43b798..0000000 --- a/node_modules/d3-geo-projection/src/elliptic.js +++ /dev/null @@ -1,118 +0,0 @@ -import {abs, asin, atan, cos, cosh, epsilon, exp, halfPi, log, pi, pow, quarterPi, sign, sin, sinh, sqrt, tan, tanh} from "./math.js"; - -// Returns [sn, cn, dn](u + iv|m). -export function ellipticJi(u, v, m) { - var a, b, c; - if (!u) { - b = ellipticJ(v, 1 - m); - return [ - [0, b[0] / b[1]], - [1 / b[1], 0], - [b[2] / b[1], 0] - ]; - } - a = ellipticJ(u, m); - if (!v) return [[a[0], 0], [a[1], 0], [a[2], 0]]; - b = ellipticJ(v, 1 - m); - c = b[1] * b[1] + m * a[0] * a[0] * b[0] * b[0]; - return [ - [a[0] * b[2] / c, a[1] * a[2] * b[0] * b[1] / c], - [a[1] * b[1] / c, -a[0] * a[2] * b[0] * b[2] / c], - [a[2] * b[1] * b[2] / c, -m * a[0] * a[1] * b[0] / c] - ]; -} - -// Returns [sn, cn, dn, ph](u|m). -export function ellipticJ(u, m) { - var ai, b, phi, t, twon; - if (m < epsilon) { - t = sin(u); - b = cos(u); - ai = m * (u - t * b) / 4; - return [ - t - ai * b, - b + ai * t, - 1 - m * t * t / 2, - u - ai - ]; - } - if (m >= 1 - epsilon) { - ai = (1 - m) / 4; - b = cosh(u); - t = tanh(u); - phi = 1 / b; - twon = b * sinh(u); - return [ - t + ai * (twon - u) / (b * b), - phi - ai * t * phi * (twon - u), - phi + ai * t * phi * (twon + u), - 2 * atan(exp(u)) - halfPi + ai * (twon - u) / b - ]; - } - - var a = [1, 0, 0, 0, 0, 0, 0, 0, 0], - c = [sqrt(m), 0, 0, 0, 0, 0, 0, 0, 0], - i = 0; - b = sqrt(1 - m); - twon = 1; - - while (abs(c[i] / a[i]) > epsilon && i < 8) { - ai = a[i++]; - c[i] = (ai - b) / 2; - a[i] = (ai + b) / 2; - b = sqrt(ai * b); - twon *= 2; - } - - phi = twon * a[i] * u; - do { - t = c[i] * sin(b = phi) / a[i]; - phi = (asin(t) + phi) / 2; - } while (--i); - - return [sin(phi), t = cos(phi), t / cos(phi - b), phi]; -} - -// Calculate F(phi+iPsi|m). -// See Abramowitz and Stegun, 17.4.11. -export function ellipticFi(phi, psi, m) { - var r = abs(phi), - i = abs(psi), - sinhPsi = sinh(i); - if (r) { - var cscPhi = 1 / sin(r), - cotPhi2 = 1 / (tan(r) * tan(r)), - b = -(cotPhi2 + m * (sinhPsi * sinhPsi * cscPhi * cscPhi) - 1 + m), - c = (m - 1) * cotPhi2, - cotLambda2 = (-b + sqrt(b * b - 4 * c)) / 2; - return [ - ellipticF(atan(1 / sqrt(cotLambda2)), m) * sign(phi), - ellipticF(atan(sqrt((cotLambda2 / cotPhi2 - 1) / m)), 1 - m) * sign(psi) - ]; - } - return [ - 0, - ellipticF(atan(sinhPsi), 1 - m) * sign(psi) - ]; -} - -// Calculate F(phi|m) where m = k² = sin²α. -// See Abramowitz and Stegun, 17.6.7. -export function ellipticF(phi, m) { - if (!m) return phi; - if (m === 1) return log(tan(phi / 2 + quarterPi)); - var a = 1, - b = sqrt(1 - m), - c = sqrt(m); - for (var i = 0; abs(c) > epsilon; i++) { - if (phi % pi) { - var dPhi = atan(b * tan(phi) / a); - if (dPhi < 0) dPhi += pi; - phi += dPhi + ~~(phi / pi) * pi; - } else phi += phi; - c = (a + b) / 2; - b = sqrt(a * b); - c = ((a = c) - b) / 2; - } - return phi / (pow(2, i) * a); -} diff --git a/node_modules/d3-geo-projection/src/fahey.js b/node_modules/d3-geo-projection/src/fahey.js deleted file mode 100644 index ea43979..0000000 --- a/node_modules/d3-geo-projection/src/fahey.js +++ /dev/null @@ -1,19 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {atan, cos, radians, sqrt, tan} from "./math.js"; - -var faheyK = cos(35 * radians); - -export function faheyRaw(lambda, phi) { - var t = tan(phi / 2); - return [lambda * faheyK * sqrt(1 - t * t), (1 + faheyK) * t]; -} - -faheyRaw.invert = function(x, y) { - var t = y / (1 + faheyK); - return [x && x / (faheyK * sqrt(1 - t * t)), 2 * atan(t)]; -}; - -export default function() { - return projection(faheyRaw) - .scale(137.152); -} diff --git a/node_modules/d3-geo-projection/src/foucaut.js b/node_modules/d3-geo-projection/src/foucaut.js deleted file mode 100644 index fa3bd17..0000000 --- a/node_modules/d3-geo-projection/src/foucaut.js +++ /dev/null @@ -1,17 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {atan, cos, sqrtPi, tan} from "./math.js"; - -export function foucautRaw(lambda, phi) { - var k = phi / 2, cosk = cos(k); - return [ 2 * lambda / sqrtPi * cos(phi) * cosk * cosk, sqrtPi * tan(k)]; -} - -foucautRaw.invert = function(x, y) { - var k = atan(y / sqrtPi), cosk = cos(k), phi = 2 * k; - return [x * sqrtPi / 2 / (cos(phi) * cosk * cosk), phi]; -}; - -export default function() { - return projection(foucautRaw) - .scale(135.264); -} diff --git a/node_modules/d3-geo-projection/src/foucautSinusoidal.js b/node_modules/d3-geo-projection/src/foucautSinusoidal.js deleted file mode 100644 index c4c43b6..0000000 --- a/node_modules/d3-geo-projection/src/foucautSinusoidal.js +++ /dev/null @@ -1,49 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {cos, halfPi, pi, sin, sqrt} from "./math.js"; -import {solve} from "./newton.js"; - -export function foucautSinusoidalRaw(alpha) { - var beta = 1 - alpha, - equatorial = raw(pi, 0)[0] - raw(-pi, 0)[0], - polar = raw(0, halfPi)[1] - raw(0, -halfPi)[1], - ratio = sqrt(2 * polar / equatorial); - - function raw(lambda, phi) { - var cosphi = cos(phi), - sinphi = sin(phi); - return [ - cosphi / (beta + alpha * cosphi) * lambda, - beta * phi + alpha * sinphi - ]; - } - - function forward(lambda, phi) { - var p = raw(lambda, phi); - return [p[0] * ratio, p[1] / ratio]; - } - - function forwardMeridian(phi) { - return forward(0, phi)[1]; - } - - forward.invert = function(x, y) { - var phi = solve(forwardMeridian, y), - lambda = x / ratio * (alpha + beta / cos(phi)); - return [lambda, phi]; - }; - - return forward; -} - -export default function() { - var alpha = 0.5, - m = projectionMutator(foucautSinusoidalRaw), - p = m(alpha); - - p.alpha = function(_) { - return arguments.length ? m(alpha = +_) : alpha; - }; - - return p - .scale(168.725); -} diff --git a/node_modules/d3-geo-projection/src/gilbert.js b/node_modules/d3-geo-projection/src/gilbert.js deleted file mode 100644 index e317c6f..0000000 --- a/node_modules/d3-geo-projection/src/gilbert.js +++ /dev/null @@ -1,64 +0,0 @@ -import {geoEquirectangular, geoOrthographic} from "d3-geo"; -import {asin, atan, degrees, radians, sin, tan} from "./math.js"; - -function gilbertForward(point) { - return [point[0] / 2, asin(tan(point[1] / 2 * radians)) * degrees]; -} - -function gilbertInvert(point) { - return [point[0] * 2, 2 * atan(sin(point[1] * radians)) * degrees]; -} - -export default function(projectionType) { - if (projectionType == null) projectionType = geoOrthographic; - var projection = projectionType(), - equirectangular = geoEquirectangular().scale(degrees).precision(0).clipAngle(null).translate([0, 0]); // antimeridian cutting - - function gilbert(point) { - return projection(gilbertForward(point)); - } - - if (projection.invert) gilbert.invert = function(point) { - return gilbertInvert(projection.invert(point)); - }; - - gilbert.stream = function(stream) { - var s1 = projection.stream(stream), s0 = equirectangular.stream({ - point: function(lambda, phi) { s1.point(lambda / 2, asin(tan(-phi / 2 * radians)) * degrees); }, - lineStart: function() { s1.lineStart(); }, - lineEnd: function() { s1.lineEnd(); }, - polygonStart: function() { s1.polygonStart(); }, - polygonEnd: function() { s1.polygonEnd(); } - }); - s0.sphere = s1.sphere; - return s0; - }; - - function property(name) { - gilbert[name] = function() { - return arguments.length ? (projection[name].apply(projection, arguments), gilbert) : projection[name](); - }; - } - - gilbert.rotate = function(_) { - return arguments.length ? (equirectangular.rotate(_), gilbert) : equirectangular.rotate(); - }; - - gilbert.center = function(_) { - return arguments.length ? (projection.center(gilbertForward(_)), gilbert) : gilbertInvert(projection.center()); - }; - - property("angle"); - property("clipAngle"); - property("clipExtent"); - property("fitExtent"); - property("fitHeight"); - property("fitSize"); - property("fitWidth"); - property("scale"); - property("translate"); - property("precision"); - - return gilbert - .scale(249.5); -} diff --git a/node_modules/d3-geo-projection/src/gingery.js b/node_modules/d3-geo-projection/src/gingery.js deleted file mode 100644 index 6ee01a7..0000000 --- a/node_modules/d3-geo-projection/src/gingery.js +++ /dev/null @@ -1,146 +0,0 @@ -import {geoAzimuthalEquidistantRaw as azimuthalEquidistantRaw, geoProjectionMutator as projectionMutator} from "d3-geo"; -import {abs, asin, atan2, cos, degrees, epsilon, epsilon2, halfPi, pi, radians, round, sin, sqrt} from "./math.js"; - -export function gingeryRaw(rho, n) { - var k = 2 * pi / n, - rho2 = rho * rho; - - function forward(lambda, phi) { - var p = azimuthalEquidistantRaw(lambda, phi), - x = p[0], - y = p[1], - r2 = x * x + y * y; - - if (r2 > rho2) { - var r = sqrt(r2), - theta = atan2(y, x), - theta0 = k * round(theta / k), - alpha = theta - theta0, - rhoCosAlpha = rho * cos(alpha), - k_ = (rho * sin(alpha) - alpha * sin(rhoCosAlpha)) / (halfPi - rhoCosAlpha), - s_ = gingeryLength(alpha, k_), - e = (pi - rho) / gingeryIntegrate(s_, rhoCosAlpha, pi); - - x = r; - var i = 50, delta; - do { - x -= delta = (rho + gingeryIntegrate(s_, rhoCosAlpha, x) * e - r) / (s_(x) * e); - } while (abs(delta) > epsilon && --i > 0); - - y = alpha * sin(x); - if (x < halfPi) y -= k_ * (x - halfPi); - - var s = sin(theta0), - c = cos(theta0); - p[0] = x * c - y * s; - p[1] = x * s + y * c; - } - return p; - } - - forward.invert = function(x, y) { - var r2 = x * x + y * y; - if (r2 > rho2) { - var r = sqrt(r2), - theta = atan2(y, x), - theta0 = k * round(theta / k), - dTheta = theta - theta0; - - x = r * cos(dTheta); - y = r * sin(dTheta); - - var x_halfPi = x - halfPi, - sinx = sin(x), - alpha = y / sinx, - delta = x < halfPi ? Infinity : 0, - i = 10; - - while (true) { - var rhosinAlpha = rho * sin(alpha), - rhoCosAlpha = rho * cos(alpha), - sinRhoCosAlpha = sin(rhoCosAlpha), - halfPi_RhoCosAlpha = halfPi - rhoCosAlpha, - k_ = (rhosinAlpha - alpha * sinRhoCosAlpha) / halfPi_RhoCosAlpha, - s_ = gingeryLength(alpha, k_); - - if (abs(delta) < epsilon2 || !--i) break; - - alpha -= delta = (alpha * sinx - k_ * x_halfPi - y) / ( - sinx - x_halfPi * 2 * ( - halfPi_RhoCosAlpha * (rhoCosAlpha + alpha * rhosinAlpha * cos(rhoCosAlpha) - sinRhoCosAlpha) - - rhosinAlpha * (rhosinAlpha - alpha * sinRhoCosAlpha) - ) / (halfPi_RhoCosAlpha * halfPi_RhoCosAlpha)); - } - r = rho + gingeryIntegrate(s_, rhoCosAlpha, x) * (pi - rho) / gingeryIntegrate(s_, rhoCosAlpha, pi); - theta = theta0 + alpha; - x = r * cos(theta); - y = r * sin(theta); - } - return azimuthalEquidistantRaw.invert(x, y); - }; - - return forward; -} - -function gingeryLength(alpha, k) { - return function(x) { - var y_ = alpha * cos(x); - if (x < halfPi) y_ -= k; - return sqrt(1 + y_ * y_); - }; -} - -// Numerical integration: trapezoidal rule. -function gingeryIntegrate(f, a, b) { - var n = 50, - h = (b - a) / n, - s = f(a) + f(b); - for (var i = 1, x = a; i < n; ++i) s += 2 * f(x += h); - return s * 0.5 * h; -} - -export default function() { - var n = 6, - rho = 30 * radians, - cRho = cos(rho), - sRho = sin(rho), - m = projectionMutator(gingeryRaw), - p = m(rho, n), - stream_ = p.stream, - epsilon = 1e-2, - cr = -cos(epsilon * radians), - sr = sin(epsilon * radians); - - p.radius = function(_) { - if (!arguments.length) return rho * degrees; - cRho = cos(rho = _ * radians); - sRho = sin(rho); - return m(rho, n); - }; - - p.lobes = function(_) { - if (!arguments.length) return n; - return m(rho, n = +_); - }; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = stream_(stream), - sphereStream = (p.rotate([0, 0]), stream_(stream)); - p.rotate(rotate); - rotateStream.sphere = function() { - sphereStream.polygonStart(), sphereStream.lineStart(); - for (var i = 0, delta = 2 * pi / n, phi = 0; i < n; ++i, phi -= delta) { - sphereStream.point(atan2(sr * cos(phi), cr) * degrees, asin(sr * sin(phi)) * degrees); - sphereStream.point(atan2(sRho * cos(phi - delta / 2), cRho) * degrees, asin(sRho * sin(phi - delta / 2)) * degrees); - } - sphereStream.lineEnd(), sphereStream.polygonEnd(); - }; - return rotateStream; - }; - - return p - .rotate([90, -40]) - .scale(91.7095) - .clipAngle(180 - 1e-3); -} diff --git a/node_modules/d3-geo-projection/src/ginzburg4.js b/node_modules/d3-geo-projection/src/ginzburg4.js deleted file mode 100644 index 414c263..0000000 --- a/node_modules/d3-geo-projection/src/ginzburg4.js +++ /dev/null @@ -1,9 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import ginzburgPolyconicRaw from "./ginzburgPolyconic.js"; - -export var ginzburg4Raw = ginzburgPolyconicRaw(2.8284, -1.6988, 0.75432, -0.18071, 1.76003, -0.38914, 0.042555); - -export default function() { - return projection(ginzburg4Raw) - .scale(149.995); -} diff --git a/node_modules/d3-geo-projection/src/ginzburg5.js b/node_modules/d3-geo-projection/src/ginzburg5.js deleted file mode 100644 index 9285689..0000000 --- a/node_modules/d3-geo-projection/src/ginzburg5.js +++ /dev/null @@ -1,9 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import ginzburgPolyconicRaw from "./ginzburgPolyconic.js"; - -export var ginzburg5Raw = ginzburgPolyconicRaw(2.583819, -0.835827, 0.170354, -0.038094, 1.543313, -0.411435,0.082742); - -export default function() { - return projection(ginzburg5Raw) - .scale(153.93); -} diff --git a/node_modules/d3-geo-projection/src/ginzburg6.js b/node_modules/d3-geo-projection/src/ginzburg6.js deleted file mode 100644 index c6eea0a..0000000 --- a/node_modules/d3-geo-projection/src/ginzburg6.js +++ /dev/null @@ -1,10 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import ginzburgPolyconicRaw from "./ginzburgPolyconic.js"; -import {pi} from "./math.js"; - -export var ginzburg6Raw = ginzburgPolyconicRaw(5 / 6 * pi, -0.62636, -0.0344, 0, 1.3493, -0.05524, 0, 0.045); - -export default function() { - return projection(ginzburg6Raw) - .scale(130.945); -} diff --git a/node_modules/d3-geo-projection/src/ginzburg8.js b/node_modules/d3-geo-projection/src/ginzburg8.js deleted file mode 100644 index 6cd25c1..0000000 --- a/node_modules/d3-geo-projection/src/ginzburg8.js +++ /dev/null @@ -1,33 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, epsilon} from "./math.js"; - -export function ginzburg8Raw(lambda, phi) { - var lambda2 = lambda * lambda, - phi2 = phi * phi; - return [ - lambda * (1 - 0.162388 * phi2) * (0.87 - 0.000952426 * lambda2 * lambda2), - phi * (1 + phi2 / 12) - ]; -} - -ginzburg8Raw.invert = function(x, y) { - var lambda = x, - phi = y, - i = 50, delta; - do { - var phi2 = phi * phi; - phi -= delta = (phi * (1 + phi2 / 12) - y) / (1 + phi2 / 4); - } while (abs(delta) > epsilon && --i > 0); - i = 50; - x /= 1 -0.162388 * phi2; - do { - var lambda4 = (lambda4 = lambda * lambda) * lambda4; - lambda -= delta = (lambda * (0.87 - 0.000952426 * lambda4) - x) / (0.87 - 0.00476213 * lambda4); - } while (abs(delta) > epsilon && --i > 0); - return [lambda, phi]; -}; - -export default function() { - return projection(ginzburg8Raw) - .scale(131.747); -} diff --git a/node_modules/d3-geo-projection/src/ginzburg9.js b/node_modules/d3-geo-projection/src/ginzburg9.js deleted file mode 100644 index 4a1e199..0000000 --- a/node_modules/d3-geo-projection/src/ginzburg9.js +++ /dev/null @@ -1,9 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import ginzburgPolyconicRaw from "./ginzburgPolyconic.js"; - -export var ginzburg9Raw = ginzburgPolyconicRaw(2.6516, -0.76534, 0.19123, -0.047094, 1.36289, -0.13965,0.031762); - -export default function() { - return projection(ginzburg9Raw) - .scale(131.087); -} diff --git a/node_modules/d3-geo-projection/src/ginzburgPolyconic.js b/node_modules/d3-geo-projection/src/ginzburgPolyconic.js deleted file mode 100644 index 3338884..0000000 --- a/node_modules/d3-geo-projection/src/ginzburgPolyconic.js +++ /dev/null @@ -1,56 +0,0 @@ -import {abs, asin, cos, epsilon, pi, sin, sqrt} from "./math.js"; - -export default function(a, b, c, d, e, f, g, h) { - if (arguments.length < 8) h = 0; - - function forward(lambda, phi) { - if (!phi) return [a * lambda / pi, 0]; - var phi2 = phi * phi, - xB = a + phi2 * (b + phi2 * (c + phi2 * d)), - yB = phi * (e - 1 + phi2 * (f - h + phi2 * g)), - m = (xB * xB + yB * yB) / (2 * yB), - alpha = lambda * asin(xB / m) / pi; - return [m * sin(alpha), phi * (1 + phi2 * h) + m * (1 - cos(alpha))]; - } - - forward.invert = function(x, y) { - var lambda = pi * x / a, - phi = y, - deltaLambda, deltaPhi, i = 50; - do { - var phi2 = phi * phi, - xB = a + phi2 * (b + phi2 * (c + phi2 * d)), - yB = phi * (e - 1 + phi2 * (f - h + phi2 * g)), - p = xB * xB + yB * yB, - q = 2 * yB, - m = p / q, - m2 = m * m, - dAlphadLambda = asin(xB / m) / pi, - alpha = lambda * dAlphadLambda, - xB2 = xB * xB, - dxBdPhi = (2 * b + phi2 * (4 * c + phi2 * 6 * d)) * phi, - dyBdPhi = e + phi2 * (3 * f + phi2 * 5 * g), - dpdPhi = 2 * (xB * dxBdPhi + yB * (dyBdPhi - 1)), - dqdPhi = 2 * (dyBdPhi - 1), - dmdPhi = (dpdPhi * q - p * dqdPhi) / (q * q), - cosAlpha = cos(alpha), - sinAlpha = sin(alpha), - mcosAlpha = m * cosAlpha, - msinAlpha = m * sinAlpha, - dAlphadPhi = ((lambda / pi) * (1 / sqrt(1 - xB2 / m2)) * (dxBdPhi * m - xB * dmdPhi)) / m2, - fx = msinAlpha - x, - fy = phi * (1 + phi2 * h) + m - mcosAlpha - y, - deltaxDeltaPhi = dmdPhi * sinAlpha + mcosAlpha * dAlphadPhi, - deltaxDeltaLambda = mcosAlpha * dAlphadLambda, - deltayDeltaPhi = 1 + dmdPhi - (dmdPhi * cosAlpha - msinAlpha * dAlphadPhi), - deltayDeltaLambda = msinAlpha * dAlphadLambda, - denominator = deltaxDeltaPhi * deltayDeltaLambda - deltayDeltaPhi * deltaxDeltaLambda; - if (!denominator) break; - lambda -= deltaLambda = (fy * deltaxDeltaPhi - fx * deltayDeltaPhi) / denominator; - phi -= deltaPhi = (fx * deltayDeltaLambda - fy * deltaxDeltaLambda) / denominator; - } while ((abs(deltaLambda) > epsilon || abs(deltaPhi) > epsilon) && --i > 0); - return [lambda, phi]; - }; - - return forward; -} diff --git a/node_modules/d3-geo-projection/src/gringorten.js b/node_modules/d3-geo-projection/src/gringorten.js deleted file mode 100644 index d7dcfd7..0000000 --- a/node_modules/d3-geo-projection/src/gringorten.js +++ /dev/null @@ -1,147 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, asin, atan2, cos, sign, epsilon, epsilon2, halfPi, pi, sin, sqrt} from "./math.js"; -import squareRaw from "./square.js"; - -export function gringortenRaw(lambda, phi) { - var sLambda = sign(lambda), - sPhi = sign(phi), - cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(sPhi * phi); - lambda = abs(atan2(y, z)); - phi = asin(x); - if (abs(lambda - halfPi) > epsilon) lambda %= halfPi; - var point = gringortenHexadecant(lambda > pi / 4 ? halfPi - lambda : lambda, phi); - if (lambda > pi / 4) z = point[0], point[0] = -point[1], point[1] = -z; - return (point[0] *= sLambda, point[1] *= -sPhi, point); -} - -gringortenRaw.invert = function(x, y) { - if (abs(x) > 1) x = sign(x) * 2 - x; - if (abs(y) > 1) y = sign(y) * 2 - y; - var sx = sign(x), - sy = sign(y), - x0 = -sx * x, - y0 = -sy * y, - t = y0 / x0 < 1, - p = gringortenHexadecantInvert(t ? y0 : x0, t ? x0 : y0), - lambda = p[0], - phi = p[1], - cosPhi = cos(phi); - if (t) lambda = -halfPi - lambda; - return [sx * (atan2(sin(lambda) * cosPhi, -sin(phi)) + pi), sy * asin(cos(lambda) * cosPhi)]; -}; - -function gringortenHexadecant(lambda, phi) { - if (phi === halfPi) return [0, 0]; - - var sinPhi = sin(phi), - r = sinPhi * sinPhi, - r2 = r * r, - j = 1 + r2, - k = 1 + 3 * r2, - q = 1 - r2, - z = asin(1 / sqrt(j)), - v = q + r * j * z, - p2 = (1 - sinPhi) / v, - p = sqrt(p2), - a2 = p2 * j, - a = sqrt(a2), - h = p * q, - x, - i; - - if (lambda === 0) return [0, -(h + r * a)]; - - var cosPhi = cos(phi), - secPhi = 1 / cosPhi, - drdPhi = 2 * sinPhi * cosPhi, - dvdPhi = (-3 * r + z * k) * drdPhi, - dp2dPhi = (-v * cosPhi - (1 - sinPhi) * dvdPhi) / (v * v), - dpdPhi = (0.5 * dp2dPhi) / p, - dhdPhi = q * dpdPhi - 2 * r * p * drdPhi, - dra2dPhi = r * j * dp2dPhi + p2 * k * drdPhi, - mu = -secPhi * drdPhi, - nu = -secPhi * dra2dPhi, - zeta = -2 * secPhi * dhdPhi, - lambda1 = 4 * lambda / pi, - delta; - - // Slower but accurate bisection method. - if (lambda > 0.222 * pi || phi < pi / 4 && lambda > 0.175 * pi) { - x = (h + r * sqrt(a2 * (1 + r2) - h * h)) / (1 + r2); - if (lambda > pi / 4) return [x, x]; - var x1 = x, x0 = 0.5 * x; - x = 0.5 * (x0 + x1), i = 50; - do { - var g = sqrt(a2 - x * x), - f = (x * (zeta + mu * g) + nu * asin(x / a)) - lambda1; - if (!f) break; - if (f < 0) x0 = x; - else x1 = x; - x = 0.5 * (x0 + x1); - } while (abs(x1 - x0) > epsilon && --i > 0); - } - - // Newton-Raphson. - else { - x = epsilon, i = 25; - do { - var x2 = x * x, - g2 = sqrt(a2 - x2), - zetaMug = zeta + mu * g2, - f2 = x * zetaMug + nu * asin(x / a) - lambda1, - df = zetaMug + (nu - mu * x2) / g2; - x -= delta = g2 ? f2 / df : 0; - } while (abs(delta) > epsilon && --i > 0); - } - - return [x, -h - r * sqrt(a2 - x * x)]; -} - -function gringortenHexadecantInvert(x, y) { - var x0 = 0, - x1 = 1, - r = 0.5, - i = 50; - - while (true) { - var r2 = r * r, - sinPhi = sqrt(r), - z = asin(1 / sqrt(1 + r2)), - v = (1 - r2) + r * (1 + r2) * z, - p2 = (1 - sinPhi) / v, - p = sqrt(p2), - a2 = p2 * (1 + r2), - h = p * (1 - r2), - g2 = a2 - x * x, - g = sqrt(g2), - y0 = y + h + r * g; - if (abs(x1 - x0) < epsilon2 || --i === 0 || y0 === 0) break; - if (y0 > 0) x0 = r; - else x1 = r; - r = 0.5 * (x0 + x1); - } - - if (!i) return null; - - var phi = asin(sinPhi), - cosPhi = cos(phi), - secPhi = 1 / cosPhi, - drdPhi = 2 * sinPhi * cosPhi, - dvdPhi = (-3 * r + z * (1 + 3 * r2)) * drdPhi, - dp2dPhi = (-v * cosPhi - (1 - sinPhi) * dvdPhi) / (v * v), - dpdPhi = 0.5 * dp2dPhi / p, - dhdPhi = (1 - r2) * dpdPhi - 2 * r * p * drdPhi, - zeta = -2 * secPhi * dhdPhi, - mu = -secPhi * drdPhi, - nu = -secPhi * (r * (1 + r2) * dp2dPhi + p2 * (1 + 3 * r2) * drdPhi); - - return [pi / 4 * (x * (zeta + mu * g) + nu * asin(x / sqrt(a2))), phi]; -} - -export default function() { - return projection(squareRaw(gringortenRaw)) - .scale(239.75); -} diff --git a/node_modules/d3-geo-projection/src/guyou.js b/node_modules/d3-geo-projection/src/guyou.js deleted file mode 100644 index 355147f..0000000 --- a/node_modules/d3-geo-projection/src/guyou.js +++ /dev/null @@ -1,53 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {ellipticF, ellipticFi, ellipticJi} from "./elliptic.js"; -import {abs, atan, atan2, cos, exp, halfPi, log, pi, sin, sqrt, sqrt2, tan} from "./math.js"; -import squareRaw from "./square.js"; - -export function guyouRaw(lambda, phi) { - var k_ = (sqrt2 - 1) / (sqrt2 + 1), - k = sqrt(1 - k_ * k_), - K = ellipticF(halfPi, k * k), - f = -1, - psi = log(tan(pi / 4 + abs(phi) / 2)), - r = exp(f * psi) / sqrt(k_), - at = guyouComplexAtan(r * cos(f * lambda), r * sin(f * lambda)), - t = ellipticFi(at[0], at[1], k * k); - return [-t[1], (phi >= 0 ? 1 : -1) * (0.5 * K - t[0])]; -} - -function guyouComplexAtan(x, y) { - var x2 = x * x, - y_1 = y + 1, - t = 1 - x2 - y * y; - return [ - 0.5 * ((x >= 0 ? halfPi : -halfPi) - atan2(t, 2 * x)), - -0.25 * log(t * t + 4 * x2) +0.5 * log(y_1 * y_1 + x2) - ]; -} - -function guyouComplexDivide(a, b) { - var denominator = b[0] * b[0] + b[1] * b[1]; - return [ - (a[0] * b[0] + a[1] * b[1]) / denominator, - (a[1] * b[0] - a[0] * b[1]) / denominator - ]; -} - -guyouRaw.invert = function(x, y) { - var k_ = (sqrt2 - 1) / (sqrt2 + 1), - k = sqrt(1 - k_ * k_), - K = ellipticF(halfPi, k * k), - f = -1, - j = ellipticJi(0.5 * K - y, -x, k * k), - tn = guyouComplexDivide(j[0], j[1]), - lambda = atan2(tn[1], tn[0]) / f; - return [ - lambda, - 2 * atan(exp(0.5 / f * log(k_ * tn[0] * tn[0] + k_ * tn[1] * tn[1]))) - halfPi - ]; -}; - -export default function() { - return projection(squareRaw(guyouRaw)) - .scale(151.496); -} diff --git a/node_modules/d3-geo-projection/src/hammer.js b/node_modules/d3-geo-projection/src/hammer.js deleted file mode 100644 index c39974c..0000000 --- a/node_modules/d3-geo-projection/src/hammer.js +++ /dev/null @@ -1,51 +0,0 @@ -import {geoAzimuthalEqualAreaRaw as azimuthalEqualAreaRaw, geoProjectionMutator as projectionMutator} from "d3-geo"; -import {asin, cos, sin} from "./math.js"; - -export function hammerRaw(A, B) { - if (arguments.length < 2) B = A; - if (B === 1) return azimuthalEqualAreaRaw; - if (B === Infinity) return hammerQuarticAuthalicRaw; - - function forward(lambda, phi) { - var coordinates = azimuthalEqualAreaRaw(lambda / B, phi); - coordinates[0] *= A; - return coordinates; - } - - forward.invert = function(x, y) { - var coordinates = azimuthalEqualAreaRaw.invert(x / A, y); - coordinates[0] *= B; - return coordinates; - }; - - return forward; -} - -function hammerQuarticAuthalicRaw(lambda, phi) { - return [ - lambda * cos(phi) / cos(phi /= 2), - 2 * sin(phi) - ]; -} - -hammerQuarticAuthalicRaw.invert = function(x, y) { - var phi = 2 * asin(y / 2); - return [ - x * cos(phi / 2) / cos(phi), - phi - ]; -}; - -export default function() { - var B = 2, - m = projectionMutator(hammerRaw), - p = m(B); - - p.coefficient = function(_) { - if (!arguments.length) return B; - return m(B = +_); - }; - - return p - .scale(169.529); -} diff --git a/node_modules/d3-geo-projection/src/hammerRetroazimuthal.js b/node_modules/d3-geo-projection/src/hammerRetroazimuthal.js deleted file mode 100644 index 5836243..0000000 --- a/node_modules/d3-geo-projection/src/hammerRetroazimuthal.js +++ /dev/null @@ -1,109 +0,0 @@ -import {geoProjectionMutator as projectionMutator, geoCircle} from "d3-geo"; -import {abs, acos, asin, atan2, cos, degrees, epsilon, halfPi, radians, sqrt, sin} from "./math.js"; - -export function hammerRetroazimuthalRaw(phi0) { - var sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0), - rotate = hammerRetroazimuthalRotation(phi0); - - rotate.invert = hammerRetroazimuthalRotation(-phi0); - - function forward(lambda, phi) { - var p = rotate(lambda, phi); - lambda = p[0], phi = p[1]; - var sinPhi = sin(phi), - cosPhi = cos(phi), - cosLambda = cos(lambda), - z = acos(sinPhi0 * sinPhi + cosPhi0 * cosPhi * cosLambda), - sinz = sin(z), - K = abs(sinz) > epsilon ? z / sinz : 1; - return [ - K * cosPhi0 * sin(lambda), - (abs(lambda) > halfPi ? K : -K) // rotate for back hemisphere - * (sinPhi0 * cosPhi - cosPhi0 * sinPhi * cosLambda) - ]; - } - - forward.invert = function(x, y) { - var rho = sqrt(x * x + y * y), - sinz = -sin(rho), - cosz = cos(rho), - a = rho * cosz, - b = -y * sinz, - c = rho * sinPhi0, - d = sqrt(a * a + b * b - c * c), - phi = atan2(a * c + b * d, b * c - a * d), - lambda = (rho > halfPi ? -1 : 1) * atan2(x * sinz, rho * cos(phi) * cosz + y * sin(phi) * sinz); - return rotate.invert(lambda, phi); - }; - - return forward; -} - -// Latitudinal rotation by phi0. -// Temporary hack until D3 supports arbitrary small-circle clipping origins. -function hammerRetroazimuthalRotation(phi0) { - var sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0); - - return function(lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi); - return [ - atan2(y, x * cosPhi0 - z * sinPhi0), - asin(z * cosPhi0 + x * sinPhi0) - ]; - }; -} - -export default function() { - var phi0 = 0, - m = projectionMutator(hammerRetroazimuthalRaw), - p = m(phi0), - rotate_ = p.rotate, - stream_ = p.stream, - circle = geoCircle(); - - p.parallel = function(_) { - if (!arguments.length) return phi0 * degrees; - var r = p.rotate(); - return m(phi0 = _ * radians).rotate(r); - }; - - // Temporary hack; see hammerRetroazimuthalRotation. - p.rotate = function(_) { - if (!arguments.length) return (_ = rotate_.call(p), _[1] += phi0 * degrees, _); - rotate_.call(p, [_[0], _[1] - phi0 * degrees]); - circle.center([-_[0], -_[1]]); - return p; - }; - - p.stream = function(stream) { - stream = stream_(stream); - stream.sphere = function() { - stream.polygonStart(); - var epsilon = 1e-2, - ring = circle.radius(90 - epsilon)().coordinates[0], - n = ring.length - 1, - i = -1, - p; - stream.lineStart(); - while (++i < n) stream.point((p = ring[i])[0], p[1]); - stream.lineEnd(); - ring = circle.radius(90 + epsilon)().coordinates[0]; - n = ring.length - 1; - stream.lineStart(); - while (--i >= 0) stream.point((p = ring[i])[0], p[1]); - stream.lineEnd(); - stream.polygonEnd(); - }; - return stream; - }; - - return p - .scale(79.4187) - .parallel(45) - .clipAngle(180 - 1e-3); -} diff --git a/node_modules/d3-geo-projection/src/healpix.js b/node_modules/d3-geo-projection/src/healpix.js deleted file mode 100644 index 0ddae9e..0000000 --- a/node_modules/d3-geo-projection/src/healpix.js +++ /dev/null @@ -1,99 +0,0 @@ -import {range} from "d3-array"; -import {geoStream, geoProjectionMutator as projectionMutator} from "d3-geo"; -import {collignonRaw} from "./collignon.js"; -import {cylindricalEqualAreaRaw} from "./cylindricalEqualArea.js"; -import {abs, asin, degrees, epsilon, floor, max, min, pi, radians, sqrtPi, tau} from "./math.js"; - -var K = 3, - healpixParallel = asin(1 - 1 / K) * degrees, - healpixLambert = cylindricalEqualAreaRaw(0); - -export function healpixRaw(H) { - var phi0 = healpixParallel * radians, - dx = collignonRaw(pi, phi0)[0] - collignonRaw(-pi, phi0)[0], - y0 = healpixLambert(0, phi0)[1], - y1 = collignonRaw(0, phi0)[1], - dy1 = sqrtPi - y1, - k = tau / H, - w = 4 / tau, - h = y0 + (dy1 * dy1 * 4) / tau; - - function forward(lambda, phi) { - var point, - phi2 = abs(phi); - if (phi2 > phi0) { - var i = min(H - 1, max(0, floor((lambda + pi) / k))); - lambda += pi * (H - 1) / H - i * k; - point = collignonRaw(lambda, phi2); - point[0] = point[0] * tau / dx - tau * (H - 1) / (2 * H) + i * tau / H; - point[1] = y0 + (point[1] - y1) * 4 * dy1 / tau; - if (phi < 0) point[1] = -point[1]; - } else { - point = healpixLambert(lambda, phi); - } - point[0] *= w, point[1] /= h; - return point; - } - - forward.invert = function(x, y) { - x /= w, y *= h; - var y2 = abs(y); - if (y2 > y0) { - var i = min(H - 1, max(0, floor((x + pi) / k))); - x = (x + pi * (H - 1) / H - i * k) * dx / tau; - var point = collignonRaw.invert(x, 0.25 * (y2 - y0) * tau / dy1 + y1); - point[0] -= pi * (H - 1) / H - i * k; - if (y < 0) point[1] = -point[1]; - return point; - } - return healpixLambert.invert(x, y); - }; - - return forward; -} - -function sphereTop(x, i) { - return [x, i & 1 ? 90 - epsilon : healpixParallel]; -} - -function sphereBottom(x, i) { - return [x, i & 1 ? -90 + epsilon : -healpixParallel]; -} - -function sphereNudge(d) { - return [d[0] * (1 - epsilon), d[1]]; -} - -function sphere(step) { - var c = [].concat( - range(-180, 180 + step / 2, step).map(sphereTop), - range(180, -180 - step / 2, -step).map(sphereBottom) - ); - return { - type: "Polygon", - coordinates: [step === 180 ? c.map(sphereNudge) : c] - }; -} - -export default function() { - var H = 4, - m = projectionMutator(healpixRaw), - p = m(H), - stream_ = p.stream; - - p.lobes = function(_) { - return arguments.length ? m(H = +_) : H; - }; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = stream_(stream), - sphereStream = (p.rotate([0, 0]), stream_(stream)); - p.rotate(rotate); - rotateStream.sphere = function() { geoStream(sphere(180 / H), sphereStream); }; - return rotateStream; - }; - - return p - .scale(239.75); -} diff --git a/node_modules/d3-geo-projection/src/hill.js b/node_modules/d3-geo-projection/src/hill.js deleted file mode 100644 index dd68754..0000000 --- a/node_modules/d3-geo-projection/src/hill.js +++ /dev/null @@ -1,66 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {abs, acos, asin, atan2, cos, epsilon2, halfPi, pi, sin, sqrt} from "./math.js"; - -export function hillRaw(K) { - var L = 1 + K, - sinBt = sin(1 / L), - Bt = asin(sinBt), - A = 2 * sqrt(pi / (B = pi + 4 * Bt * L)), - B, - rho0 = 0.5 * A * (L + sqrt(K * (2 + K))), - K2 = K * K, - L2 = L * L; - - function forward(lambda, phi) { - var t = 1 - sin(phi), - rho, - omega; - if (t && t < 2) { - var theta = halfPi - phi, i = 25, delta; - do { - var sinTheta = sin(theta), - cosTheta = cos(theta), - Bt_Bt1 = Bt + atan2(sinTheta, L - cosTheta), - C = 1 + L2 - 2 * L * cosTheta; - theta -= delta = (theta - K2 * Bt - L * sinTheta + C * Bt_Bt1 -0.5 * t * B) / (2 * L * sinTheta * Bt_Bt1); - } while (abs(delta) > epsilon2 && --i > 0); - rho = A * sqrt(C); - omega = lambda * Bt_Bt1 / pi; - } else { - rho = A * (K + t); - omega = lambda * Bt / pi; - } - return [ - rho * sin(omega), - rho0 - rho * cos(omega) - ]; - } - - forward.invert = function(x, y) { - var rho2 = x * x + (y -= rho0) * y, - cosTheta = (1 + L2 - rho2 / (A * A)) / (2 * L), - theta = acos(cosTheta), - sinTheta = sin(theta), - Bt_Bt1 = Bt + atan2(sinTheta, L - cosTheta); - return [ - asin(x / sqrt(rho2)) * pi / Bt_Bt1, - asin(1 - 2 * (theta - K2 * Bt - L * sinTheta + (1 + L2 - 2 * L * cosTheta) * Bt_Bt1) / B) - ]; - }; - - return forward; -} - -export default function() { - var K = 1, - m = projectionMutator(hillRaw), - p = m(K); - - p.ratio = function(_) { - return arguments.length ? m(K = +_) : K; - }; - - return p - .scale(167.774) - .center([0, 18.67]); -} diff --git a/node_modules/d3-geo-projection/src/homolosine.js b/node_modules/d3-geo-projection/src/homolosine.js deleted file mode 100644 index d4acd68..0000000 --- a/node_modules/d3-geo-projection/src/homolosine.js +++ /dev/null @@ -1,22 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs} from "./math.js"; -import {mollweideRaw} from "./mollweide.js"; -import {sinusoidalRaw} from "./sinusoidal.js"; -import {sinuMollweidePhi, sinuMollweideY} from "./sinuMollweide.js"; - -export function homolosineRaw(lambda, phi) { - return abs(phi) > sinuMollweidePhi - ? (lambda = mollweideRaw(lambda, phi), lambda[1] -= phi > 0 ? sinuMollweideY : -sinuMollweideY, lambda) - : sinusoidalRaw(lambda, phi); -} - -homolosineRaw.invert = function(x, y) { - return abs(y) > sinuMollweidePhi - ? mollweideRaw.invert(x, y + (y > 0 ? sinuMollweideY : -sinuMollweideY)) - : sinusoidalRaw.invert(x, y); -}; - -export default function() { - return projection(homolosineRaw) - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/hufnagel.js b/node_modules/d3-geo-projection/src/hufnagel.js deleted file mode 100644 index 2978dcd..0000000 --- a/node_modules/d3-geo-projection/src/hufnagel.js +++ /dev/null @@ -1,91 +0,0 @@ -import { geoProjectionMutator as projectionMutator } from "d3-geo"; -import { asin, cos, degrees, pi, radians, sign, sin, sqrt } from "./math.js"; -import { solve } from "./newton.js"; - -export function hufnagelRaw(a, b, psiMax, ratio) { - var k = sqrt( - (4 * pi) / - (2 * psiMax + - (1 + a - b / 2) * sin(2 * psiMax) + - ((a + b) / 2) * sin(4 * psiMax) + - (b / 2) * sin(6 * psiMax)) - ), - c = sqrt( - ratio * - sin(psiMax) * - sqrt((1 + a * cos(2 * psiMax) + b * cos(4 * psiMax)) / (1 + a + b)) - ), - M = psiMax * mapping(1); - - function radius(psi) { - return sqrt(1 + a * cos(2 * psi) + b * cos(4 * psi)); - } - - function mapping(t) { - var psi = t * psiMax; - return ( - (2 * psi + - (1 + a - b / 2) * sin(2 * psi) + - ((a + b) / 2) * sin(4 * psi) + - (b / 2) * sin(6 * psi)) / - psiMax - ); - } - - function inversemapping(psi) { - return radius(psi) * sin(psi); - } - - var forward = function(lambda, phi) { - var psi = psiMax * solve(mapping, (M * sin(phi)) / psiMax, phi / pi); - if (isNaN(psi)) psi = psiMax * sign(phi); - var kr = k * radius(psi); - return [((kr * c * lambda) / pi) * cos(psi), (kr / c) * sin(psi)]; - }; - - forward.invert = function(x, y) { - var psi = solve(inversemapping, (y * c) / k); - return [ - (x * pi) / (cos(psi) * k * c * radius(psi)), - asin((psiMax * mapping(psi / psiMax)) / M) - ]; - }; - - if (psiMax === 0) { - k = sqrt(ratio / pi); - forward = function(lambda, phi) { - return [lambda * k, sin(phi) / k]; - }; - forward.invert = function(x, y) { - return [x / k, asin(y * k)]; - }; - } - - return forward; -} - -export default function() { - var a = 1, - b = 0, - psiMax = 45 * radians, - ratio = 2, - mutate = projectionMutator(hufnagelRaw), - projection = mutate(a, b, psiMax, ratio); - - projection.a = function(_) { - return arguments.length ? mutate((a = +_), b, psiMax, ratio) : a; - }; - projection.b = function(_) { - return arguments.length ? mutate(a, (b = +_), psiMax, ratio) : b; - }; - projection.psiMax = function(_) { - return arguments.length - ? mutate(a, b, (psiMax = +_ * radians), ratio) - : psiMax * degrees; - }; - projection.ratio = function(_) { - return arguments.length ? mutate(a, b, psiMax, (ratio = +_)) : ratio; - }; - - return projection.scale(180.739); -} diff --git a/node_modules/d3-geo-projection/src/hyperelliptical.js b/node_modules/d3-geo-projection/src/hyperelliptical.js deleted file mode 100644 index 0c5bd9b..0000000 --- a/node_modules/d3-geo-projection/src/hyperelliptical.js +++ /dev/null @@ -1,73 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {abs, asin, pi, pow, sign, sin} from "./math.js"; -import {integrate} from "./integrate.js"; - -export function hyperellipticalRaw(alpha, k, gamma) { - - function elliptic (f) { - return alpha + (1 - alpha) * pow(1 - pow(f, k), 1 / k); - } - - function z(f) { - return integrate(elliptic, 0, f, 1e-4); - } - - var G = 1 / z(1), - n = 1000, - m = (1 + 1e-8) * G, - approx = []; - for (var i = 0; i <= n; i++) - approx.push(z(i / n) * m); - - function Y(sinphi) { - var rmin = 0, rmax = n, r = n >> 1; - do { - if (approx[r] > sinphi) rmax = r; else rmin = r; - r = (rmin + rmax) >> 1; - } while (r > rmin); - var u = approx[r + 1] - approx[r]; - if (u) u = (sinphi - approx[r + 1]) / u; - return (r + 1 + u) / n; - } - - var ratio = 2 * Y(1) / pi * G / gamma; - - var forward = function(lambda, phi) { - var y = Y(abs(sin(phi))), - x = elliptic(y) * lambda; - y /= ratio; - return [ x, (phi >= 0) ? y : -y ]; - }; - - forward.invert = function(x, y) { - var phi; - y *= ratio; - if (abs(y) < 1) phi = sign(y) * asin(z(abs(y)) * G); - return [ x / elliptic(abs(y)), phi ]; - }; - - return forward; -} - -export default function() { - var alpha = 0, - k = 2.5, - gamma = 1.183136, // affine = sqrt(2 * gamma / pi) = 0.8679 - m = projectionMutator(hyperellipticalRaw), - p = m(alpha, k, gamma); - - p.alpha = function(_) { - return arguments.length ? m(alpha = +_, k, gamma) : alpha; - }; - - p.k = function(_) { - return arguments.length ? m(alpha, k = +_, gamma) : k; - }; - - p.gamma = function(_) { - return arguments.length ? m(alpha, k, gamma = +_) : gamma; - }; - - return p - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/index.js b/node_modules/d3-geo-projection/src/index.js deleted file mode 100644 index 43cc0c0..0000000 --- a/node_modules/d3-geo-projection/src/index.js +++ /dev/null @@ -1,97 +0,0 @@ -export {default as geoAiry, airyRaw as geoAiryRaw} from "./airy"; -export {default as geoAitoff, aitoffRaw as geoAitoffRaw} from "./aitoff"; -export {default as geoArmadillo, armadilloRaw as geoArmadilloRaw} from "./armadillo"; -export {default as geoAugust, augustRaw as geoAugustRaw} from "./august"; -export {default as geoBaker, bakerRaw as geoBakerRaw} from "./baker"; -export {default as geoBerghaus, berghausRaw as geoBerghausRaw} from "./berghaus"; -export {default as geoBertin1953, bertin1953Raw as geoBertin1953Raw} from "./bertin"; -export {default as geoBoggs, boggsRaw as geoBoggsRaw} from "./boggs"; -export {default as geoBonne, bonneRaw as geoBonneRaw} from "./bonne"; -export {default as geoBottomley, bottomleyRaw as geoBottomleyRaw} from "./bottomley"; -export {default as geoBromley, bromleyRaw as geoBromleyRaw} from "./bromley"; -export {default as geoChamberlin, chamberlinRaw as geoChamberlinRaw, chamberlinAfrica as geoChamberlinAfrica} from "./chamberlin"; -export {default as geoCollignon, collignonRaw as geoCollignonRaw} from "./collignon"; -export {default as geoCraig, craigRaw as geoCraigRaw} from "./craig"; -export {default as geoCraster, crasterRaw as geoCrasterRaw} from "./craster"; -export {default as geoCylindricalEqualArea, cylindricalEqualAreaRaw as geoCylindricalEqualAreaRaw} from "./cylindricalEqualArea"; -export {default as geoCylindricalStereographic, cylindricalStereographicRaw as geoCylindricalStereographicRaw} from "./cylindricalStereographic"; -export {default as geoEckert1, eckert1Raw as geoEckert1Raw} from "./eckert1.js"; -export {default as geoEckert2, eckert2Raw as geoEckert2Raw} from "./eckert2.js"; -export {default as geoEckert3, eckert3Raw as geoEckert3Raw} from "./eckert3.js"; -export {default as geoEckert4, eckert4Raw as geoEckert4Raw} from "./eckert4.js"; -export {default as geoEckert5, eckert5Raw as geoEckert5Raw} from "./eckert5.js"; -export {default as geoEckert6, eckert6Raw as geoEckert6Raw} from "./eckert6.js"; -export {default as geoEisenlohr, eisenlohrRaw as geoEisenlohrRaw} from "./eisenlohr.js"; -export {default as geoFahey, faheyRaw as geoFaheyRaw} from "./fahey.js"; -export {default as geoFoucaut, foucautRaw as geoFoucautRaw} from "./foucaut.js"; -export {default as geoFoucautSinusoidal, foucautSinusoidalRaw as geoFoucautSinusoidalRaw} from "./foucautSinusoidal.js"; -export {default as geoGilbert} from "./gilbert.js"; -export {default as geoGingery, gingeryRaw as geoGingeryRaw} from "./gingery.js"; -export {default as geoGinzburg4, ginzburg4Raw as geoGinzburg4Raw} from "./ginzburg4.js"; -export {default as geoGinzburg5, ginzburg5Raw as geoGinzburg5Raw} from "./ginzburg5.js"; -export {default as geoGinzburg6, ginzburg6Raw as geoGinzburg6Raw} from "./ginzburg6.js"; -export {default as geoGinzburg8, ginzburg8Raw as geoGinzburg8Raw} from "./ginzburg8.js"; -export {default as geoGinzburg9, ginzburg9Raw as geoGinzburg9Raw} from "./ginzburg9.js"; -export {default as geoGringorten, gringortenRaw as geoGringortenRaw} from "./gringorten.js"; -export {default as geoGuyou, guyouRaw as geoGuyouRaw} from "./guyou.js"; -export {default as geoHammer, hammerRaw as geoHammerRaw} from "./hammer.js"; -export {default as geoHammerRetroazimuthal, hammerRetroazimuthalRaw as geoHammerRetroazimuthalRaw} from "./hammerRetroazimuthal.js"; -export {default as geoHealpix, healpixRaw as geoHealpixRaw} from "./healpix.js"; -export {default as geoHill, hillRaw as geoHillRaw} from "./hill.js"; -export {default as geoHomolosine, homolosineRaw as geoHomolosineRaw} from "./homolosine.js"; -export {default as geoHufnagel, hufnagelRaw as geoHufnagelRaw} from "./hufnagel.js"; -export {default as geoHyperelliptical, hyperellipticalRaw as geoHyperellipticalRaw} from "./hyperelliptical"; -export {default as geoInterrupt} from "./interrupted/index"; -export {default as geoInterruptedBoggs} from "./interrupted/boggs"; -export {default as geoInterruptedHomolosine} from "./interrupted/homolosine"; -export {default as geoInterruptedMollweide} from "./interrupted/mollweide"; -export {default as geoInterruptedMollweideHemispheres} from "./interrupted/mollweideHemispheres"; -export {default as geoInterruptedSinuMollweide} from "./interrupted/sinuMollweide"; -export {default as geoInterruptedSinusoidal} from "./interrupted/sinusoidal"; -export {default as geoKavrayskiy7, kavrayskiy7Raw as geoKavrayskiy7Raw} from "./kavrayskiy7.js"; -export {default as geoLagrange, lagrangeRaw as geoLagrangeRaw} from "./lagrange.js"; -export {default as geoLarrivee, larriveeRaw as geoLarriveeRaw} from "./larrivee"; -export {default as geoLaskowski, laskowskiRaw as geoLaskowskiRaw} from "./laskowski"; -export {default as geoLittrow, littrowRaw as geoLittrowRaw} from "./littrow.js"; -export {default as geoLoximuthal, loximuthalRaw as geoLoximuthalRaw} from "./loximuthal.js"; -export {default as geoMiller, millerRaw as geoMillerRaw} from "./miller"; -export {default as geoModifiedStereographic, modifiedStereographicRaw as geoModifiedStereographicRaw, modifiedStereographicAlaska as geoModifiedStereographicAlaska, modifiedStereographicGs48 as geoModifiedStereographicGs48, modifiedStereographicGs50 as geoModifiedStereographicGs50, modifiedStereographicMiller as geoModifiedStereographicMiller, modifiedStereographicLee as geoModifiedStereographicLee} from "./modifiedStereographic"; -export {default as geoMollweide, mollweideRaw as geoMollweideRaw} from "./mollweide"; -export {default as geoMtFlatPolarParabolic, mtFlatPolarParabolicRaw as geoMtFlatPolarParabolicRaw} from "./mtFlatPolarParabolic"; -export {default as geoMtFlatPolarQuartic, mtFlatPolarQuarticRaw as geoMtFlatPolarQuarticRaw} from "./mtFlatPolarQuartic"; -export {default as geoMtFlatPolarSinusoidal, mtFlatPolarSinusoidalRaw as geoMtFlatPolarSinusoidalRaw} from "./mtFlatPolarSinusoidal"; -export {geoNaturalEarth1 as geoNaturalEarth, geoNaturalEarth1Raw as geoNaturalEarthRaw} from "d3-geo"; // DEPRECATED moved to d3-geo -export {default as geoNaturalEarth2, naturalEarth2Raw as geoNaturalEarth2Raw} from "./naturalEarth2"; -export {default as geoNellHammer, nellHammerRaw as geoNellHammerRaw} from "./nellHammer"; -export {default as geoInterruptedQuarticAuthalic} from "./interrupted/quarticAuthalic"; -export {default as geoNicolosi, nicolosiRaw as geoNicolosiRaw} from "./nicolosi"; -export {default as geoPatterson, pattersonRaw as geoPattersonRaw} from "./patterson"; -export {default as geoPolyconic, polyconicRaw as geoPolyconicRaw} from "./polyconic"; -export {default as geoPolyhedral} from "./polyhedral/index.js"; -export {default as geoPolyhedralButterfly} from "./polyhedral/butterfly.js"; -export {default as geoPolyhedralCollignon} from "./polyhedral/collignon.js"; -export {default as geoPolyhedralWaterman} from "./polyhedral/waterman.js"; -export {default as geoProject} from "./project/index"; -export {default as geoGringortenQuincuncial} from "./quincuncial/gringorten.js"; -export {default as geoPeirceQuincuncial} from "./quincuncial/peirce.js"; -export {default as geoPierceQuincuncial} from "./quincuncial/peirce.js"; // DEPRECATED misspelling -export {default as geoQuantize} from "./quantize"; -export {default as geoQuincuncial} from "./quincuncial/index.js"; -export {default as geoRectangularPolyconic, rectangularPolyconicRaw as geoRectangularPolyconicRaw} from "./rectangularPolyconic"; -export {default as geoRobinson, robinsonRaw as geoRobinsonRaw} from "./robinson"; -export {default as geoSatellite, satelliteRaw as geoSatelliteRaw} from "./satellite"; -export {default as geoSinuMollweide, sinuMollweideRaw as geoSinuMollweideRaw} from "./sinuMollweide"; -export {default as geoSinusoidal, sinusoidalRaw as geoSinusoidalRaw} from "./sinusoidal"; -export {default as geoStitch} from "./stitch"; -export {default as geoTimes, timesRaw as geoTimesRaw} from "./times"; -export {default as geoTwoPointAzimuthal, twoPointAzimuthalRaw as geoTwoPointAzimuthalRaw, twoPointAzimuthalUsa as geoTwoPointAzimuthalUsa} from "./twoPointAzimuthal"; -export {default as geoTwoPointEquidistant, twoPointEquidistantRaw as geoTwoPointEquidistantRaw, twoPointEquidistantUsa as geoTwoPointEquidistantUsa} from "./twoPointEquidistant"; -export {default as geoVanDerGrinten, vanDerGrintenRaw as geoVanDerGrintenRaw} from "./vanDerGrinten"; -export {default as geoVanDerGrinten2, vanDerGrinten2Raw as geoVanDerGrinten2Raw} from "./vanDerGrinten2"; -export {default as geoVanDerGrinten3, vanDerGrinten3Raw as geoVanDerGrinten3Raw} from "./vanDerGrinten3"; -export {default as geoVanDerGrinten4, vanDerGrinten4Raw as geoVanDerGrinten4Raw} from "./vanDerGrinten4"; -export {default as geoWagner, wagner7 as geoWagner7, wagnerRaw as geoWagnerRaw} from "./wagner.js"; -export {default as geoWagner4, wagner4Raw as geoWagner4Raw} from "./wagner4.js"; -export {default as geoWagner6, wagner6Raw as geoWagner6Raw} from "./wagner6.js"; -export {default as geoWiechel, wiechelRaw as geoWiechelRaw} from "./wiechel.js"; -export {default as geoWinkel3, winkel3Raw as geoWinkel3Raw} from "./winkel3"; diff --git a/node_modules/d3-geo-projection/src/integrate.js b/node_modules/d3-geo-projection/src/integrate.js deleted file mode 100644 index 8a8d0cb..0000000 --- a/node_modules/d3-geo-projection/src/integrate.js +++ /dev/null @@ -1,91 +0,0 @@ -// https://github.com/scijs/integrate-adaptive-simpson - -// This algorithm adapted from pseudocode in: -// http://www.math.utk.edu/~ccollins/refs/Handouts/rich.pdf -function adsimp (f, a, b, fa, fm, fb, V0, tol, maxdepth, depth, state) { - if (state.nanEncountered) { - return NaN; - } - - var h, f1, f2, sl, sr, s2, m, V1, V2, err; - - h = b - a; - f1 = f(a + h * 0.25); - f2 = f(b - h * 0.25); - - // Simple check for NaN: - if (isNaN(f1)) { - state.nanEncountered = true; - return; - } - - // Simple check for NaN: - if (isNaN(f2)) { - state.nanEncountered = true; - return; - } - - sl = h * (fa + 4 * f1 + fm) / 12; - sr = h * (fm + 4 * f2 + fb) / 12; - s2 = sl + sr; - err = (s2 - V0) / 15; - - if (depth > maxdepth) { - state.maxDepthCount++; - return s2 + err; - } else if (Math.abs(err) < tol) { - return s2 + err; - } else { - m = a + h * 0.5; - - V1 = adsimp(f, a, m, fa, f1, fm, sl, tol * 0.5, maxdepth, depth + 1, state); - - if (isNaN(V1)) { - state.nanEncountered = true; - return NaN; - } - - V2 = adsimp(f, m, b, fm, f2, fb, sr, tol * 0.5, maxdepth, depth + 1, state); - - if (isNaN(V2)) { - state.nanEncountered = true; - return NaN; - } - - return V1 + V2; - } -} - -export function integrate (f, a, b, tol, maxdepth) { - var state = { - maxDepthCount: 0, - nanEncountered: false - }; - - if (tol === undefined) { - tol = 1e-8; - } - if (maxdepth === undefined) { - maxdepth = 20; - } - - var fa = f(a); - var fm = f(0.5 * (a + b)); - var fb = f(b); - - var V0 = (fa + 4 * fm + fb) * (b - a) / 6; - - var result = adsimp(f, a, b, fa, fm, fb, V0, tol, maxdepth, 1, state); - -/* - if (state.maxDepthCount > 0 && console && console.warn) { - console.warn('integrate-adaptive-simpson: Warning: maximum recursion depth (' + maxdepth + ') reached ' + state.maxDepthCount + ' times'); - } - - if (state.nanEncountered && console && console.warn) { - console.warn('integrate-adaptive-simpson: Warning: NaN encountered. Halting early.'); - } -*/ - - return result; -} \ No newline at end of file diff --git a/node_modules/d3-geo-projection/src/interrupted/boggs.js b/node_modules/d3-geo-projection/src/interrupted/boggs.js deleted file mode 100644 index 3d5b326..0000000 --- a/node_modules/d3-geo-projection/src/interrupted/boggs.js +++ /dev/null @@ -1,17 +0,0 @@ -import {boggsRaw} from "../boggs.js"; -import interrupt from "./index.js"; - -var lobes = [[ // northern hemisphere - [[-180, 0], [-100, 90], [ -40, 0]], - [[ -40, 0], [ 30, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-160, -90], [-100, 0]], - [[-100, 0], [ -60, -90], [ -20, 0]], - [[ -20, 0], [ 20, -90], [ 80, 0]], - [[ 80, 0], [ 140, -90], [ 180, 0]] -]]; - -export default function() { - return interrupt(boggsRaw, lobes) - .scale(160.857); -} diff --git a/node_modules/d3-geo-projection/src/interrupted/homolosine.js b/node_modules/d3-geo-projection/src/interrupted/homolosine.js deleted file mode 100644 index 1735ac5..0000000 --- a/node_modules/d3-geo-projection/src/interrupted/homolosine.js +++ /dev/null @@ -1,17 +0,0 @@ -import {homolosineRaw} from "../homolosine.js"; -import interrupt from "./index.js"; - -var lobes = [[ // northern hemisphere - [[-180, 0], [-100, 90], [ -40, 0]], - [[ -40, 0], [ 30, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-160, -90], [-100, 0]], - [[-100, 0], [ -60, -90], [ -20, 0]], - [[ -20, 0], [ 20, -90], [ 80, 0]], - [[ 80, 0], [ 140, -90], [ 180, 0]] -]]; - -export default function() { - return interrupt(homolosineRaw, lobes) - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/interrupted/index.js b/node_modules/d3-geo-projection/src/interrupted/index.js deleted file mode 100644 index 24ac40a..0000000 --- a/node_modules/d3-geo-projection/src/interrupted/index.js +++ /dev/null @@ -1,147 +0,0 @@ -import {merge} from "d3-array"; -import {geoStream, geoProjection as projection} from "d3-geo"; -import {abs, degrees, epsilon, radians} from "../math.js"; - -function pointEqual(a, b) { - return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon; -} - -function interpolateLine(coordinates, m) { - var i = -1, - n = coordinates.length, - p0 = coordinates[0], - p1, - dx, - dy, - resampled = []; - while (++i < n) { - p1 = coordinates[i]; - dx = (p1[0] - p0[0]) / m; - dy = (p1[1] - p0[1]) / m; - for (var j = 0; j < m; ++j) resampled.push([p0[0] + j * dx, p0[1] + j * dy]); - p0 = p1; - } - resampled.push(p1); - return resampled; -} - -function interpolateSphere(lobes) { - var coordinates = [], - lobe, - lambda0, phi0, phi1, - lambda2, phi2, - i, n = lobes[0].length; - - // Northern Hemisphere - for (i = 0; i < n; ++i) { - lobe = lobes[0][i]; - lambda0 = lobe[0][0], phi0 = lobe[0][1], phi1 = lobe[1][1]; - lambda2 = lobe[2][0], phi2 = lobe[2][1]; - coordinates.push(interpolateLine([ - [lambda0 + epsilon, phi0 + epsilon], - [lambda0 + epsilon, phi1 - epsilon], - [lambda2 - epsilon, phi1 - epsilon], - [lambda2 - epsilon, phi2 + epsilon] - ], 30)); - } - - // Southern Hemisphere - for (i = lobes[1].length - 1; i >= 0; --i) { - lobe = lobes[1][i]; - lambda0 = lobe[0][0], phi0 = lobe[0][1], phi1 = lobe[1][1]; - lambda2 = lobe[2][0], phi2 = lobe[2][1]; - coordinates.push(interpolateLine([ - [lambda2 - epsilon, phi2 - epsilon], - [lambda2 - epsilon, phi1 + epsilon], - [lambda0 + epsilon, phi1 + epsilon], - [lambda0 + epsilon, phi0 - epsilon] - ], 30)); - } - - return { - type: "Polygon", - coordinates: [merge(coordinates)] - }; -} - -export default function(project, lobes, inverse) { - var sphere, bounds; - - function forward(lambda, phi) { - var sign = phi < 0 ? -1 : +1, lobe = lobes[+(phi < 0)]; - for (var i = 0, n = lobe.length - 1; i < n && lambda > lobe[i][2][0]; ++i); - var p = project(lambda - lobe[i][1][0], phi); - p[0] += project(lobe[i][1][0], sign * phi > sign * lobe[i][0][1] ? lobe[i][0][1] : phi)[0]; - return p; - } - - if (inverse) { - forward.invert = inverse(forward); - } else if (project.invert) { - forward.invert = function(x, y) { - var bound = bounds[+(y < 0)], lobe = lobes[+(y < 0)]; - for (var i = 0, n = bound.length; i < n; ++i) { - var b = bound[i]; - if (b[0][0] <= x && x < b[1][0] && b[0][1] <= y && y < b[1][1]) { - var p = project.invert(x - project(lobe[i][1][0], 0)[0], y); - p[0] += lobe[i][1][0]; - return pointEqual(forward(p[0], p[1]), [x, y]) ? p : null; - } - } - }; - } - - var p = projection(forward), - stream_ = p.stream; - - p.stream = function(stream) { - var rotate = p.rotate(), - rotateStream = stream_(stream), - sphereStream = (p.rotate([0, 0]), stream_(stream)); - p.rotate(rotate); - rotateStream.sphere = function() { geoStream(sphere, sphereStream); }; - return rotateStream; - }; - - p.lobes = function(_) { - if (!arguments.length) return lobes.map(function(lobe) { - return lobe.map(function(l) { - return [ - [l[0][0] * degrees, l[0][1] * degrees], - [l[1][0] * degrees, l[1][1] * degrees], - [l[2][0] * degrees, l[2][1] * degrees] - ]; - }); - }); - - sphere = interpolateSphere(_); - - lobes = _.map(function(lobe) { - return lobe.map(function(l) { - return [ - [l[0][0] * radians, l[0][1] * radians], - [l[1][0] * radians, l[1][1] * radians], - [l[2][0] * radians, l[2][1] * radians] - ]; - }); - }); - - bounds = lobes.map(function(lobe) { - return lobe.map(function(l) { - var x0 = project(l[0][0], l[0][1])[0], - x1 = project(l[2][0], l[2][1])[0], - y0 = project(l[1][0], l[0][1])[1], - y1 = project(l[1][0], l[1][1])[1], - t; - if (y0 > y1) t = y0, y0 = y1, y1 = t; - return [[x0, y0], [x1, y1]]; - }); - }); - - return p; - }; - - if (lobes != null) p.lobes(lobes); - - return p; -} diff --git a/node_modules/d3-geo-projection/src/interrupted/mollweide.js b/node_modules/d3-geo-projection/src/interrupted/mollweide.js deleted file mode 100644 index c97c955..0000000 --- a/node_modules/d3-geo-projection/src/interrupted/mollweide.js +++ /dev/null @@ -1,17 +0,0 @@ -import {mollweideRaw} from "../mollweide.js"; -import interrupt from "./index.js"; - -var lobes = [[ // northern hemisphere - [[-180, 0], [-100, 90], [ -40, 0]], - [[ -40, 0], [ 30, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-160, -90], [-100, 0]], - [[-100, 0], [ -60, -90], [ -20, 0]], - [[ -20, 0], [ 20, -90], [ 80, 0]], - [[ 80, 0], [ 140, -90], [ 180, 0]] -]]; - -export default function() { - return interrupt(mollweideRaw, lobes) - .scale(169.529); -} diff --git a/node_modules/d3-geo-projection/src/interrupted/mollweideHemispheres.js b/node_modules/d3-geo-projection/src/interrupted/mollweideHemispheres.js deleted file mode 100644 index 7cd1f2a..0000000 --- a/node_modules/d3-geo-projection/src/interrupted/mollweideHemispheres.js +++ /dev/null @@ -1,16 +0,0 @@ -import {mollweideRaw} from "../mollweide.js"; -import interrupt from "./index.js"; - -var lobes = [[ // northern hemisphere - [[-180, 0], [ -90, 90], [ 0, 0]], - [[ 0, 0], [ 90, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [ -90, -90], [ 0, 0]], - [[ 0, 0], [ 90, -90], [ 180, 0]] -]]; - -export default function() { - return interrupt(mollweideRaw, lobes) - .scale(169.529) - .rotate([20, 0]); -} diff --git a/node_modules/d3-geo-projection/src/interrupted/quarticAuthalic.js b/node_modules/d3-geo-projection/src/interrupted/quarticAuthalic.js deleted file mode 100644 index a67b5b6..0000000 --- a/node_modules/d3-geo-projection/src/interrupted/quarticAuthalic.js +++ /dev/null @@ -1,16 +0,0 @@ -import {hammerRaw} from "../hammer.js"; -import interrupt from "./index.js"; - -var lobes = [[ // northern hemisphere - [[-180, 0], [-90, 90], [ 0, 0]], - [[ 0, 0], [ 90, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-90, -90], [ 0, 0]], - [[ 0, 0], [ 90, -90], [180, 0]] -]]; - -export default function() { - return interrupt(hammerRaw(Infinity), lobes) - .rotate([20, 0]) - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/interrupted/sinuMollweide.js b/node_modules/d3-geo-projection/src/interrupted/sinuMollweide.js deleted file mode 100644 index d46505f..0000000 --- a/node_modules/d3-geo-projection/src/interrupted/sinuMollweide.js +++ /dev/null @@ -1,19 +0,0 @@ -import {sinuMollweideRaw} from "../sinuMollweide.js"; -import interrupt from "./index.js"; -import {solve2d} from "../newton.js"; - -var lobes = [[ // northern hemisphere - [[-180, 35], [ -30, 90], [ 0, 35]], - [[ 0, 35], [ 30, 90], [ 180, 35]] -], [ // southern hemisphere - [[-180, -10], [-102, -90], [ -65, -10]], - [[ -65, -10], [ 5, -90], [ 77, -10]], - [[ 77, -10], [ 103, -90], [ 180, -10]] -]]; - -export default function() { - return interrupt(sinuMollweideRaw, lobes, solve2d) - .rotate([-20, -55]) - .scale(164.263) - .center([0, -5.4036]); -} diff --git a/node_modules/d3-geo-projection/src/interrupted/sinusoidal.js b/node_modules/d3-geo-projection/src/interrupted/sinusoidal.js deleted file mode 100644 index fde1a20..0000000 --- a/node_modules/d3-geo-projection/src/interrupted/sinusoidal.js +++ /dev/null @@ -1,18 +0,0 @@ -import {sinusoidalRaw} from "../sinusoidal.js"; -import interrupt from "./index.js"; - -var lobes = [[ // northern hemisphere - [[-180, 0], [-110, 90], [ -40, 0]], - [[ -40, 0], [ 0, 90], [ 40, 0]], - [[ 40, 0], [ 110, 90], [ 180, 0]] -], [ // southern hemisphere - [[-180, 0], [-110, -90], [ -40, 0]], - [[ -40, 0], [ 0, -90], [ 40, 0]], - [[ 40, 0], [ 110, -90], [ 180, 0]] -]]; - -export default function() { - return interrupt(sinusoidalRaw, lobes) - .scale(152.63) - .rotate([-20, 0]); -} diff --git a/node_modules/d3-geo-projection/src/kavrayskiy7.js b/node_modules/d3-geo-projection/src/kavrayskiy7.js deleted file mode 100644 index 5830ea3..0000000 --- a/node_modules/d3-geo-projection/src/kavrayskiy7.js +++ /dev/null @@ -1,15 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {pi, sqrt, tau} from "./math.js"; - -export function kavrayskiy7Raw(lambda, phi) { - return [3 / tau * lambda * sqrt(pi * pi / 3 - phi * phi), phi]; -} - -kavrayskiy7Raw.invert = function(x, y) { - return [tau / 3 * x / sqrt(pi * pi / 3 - y * y), y]; -}; - -export default function() { - return projection(kavrayskiy7Raw) - .scale(158.837); -} diff --git a/node_modules/d3-geo-projection/src/lagrange.js b/node_modules/d3-geo-projection/src/lagrange.js deleted file mode 100644 index 5dddd1b..0000000 --- a/node_modules/d3-geo-projection/src/lagrange.js +++ /dev/null @@ -1,47 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {abs, asin, atan2, cos, epsilon, halfPi, pow, sign, sin} from "./math.js"; - -export function lagrangeRaw(n) { - - function forward(lambda, phi) { - if (abs(abs(phi) - halfPi) < epsilon) return [0, phi < 0 ? -2 : 2]; - var sinPhi = sin(phi), - v = pow((1 + sinPhi) / (1 - sinPhi), n / 2), - c = 0.5 * (v + 1 / v) + cos(lambda *= n); - return [ - 2 * sin(lambda) / c, - (v - 1 / v) / c - ]; - } - - forward.invert = function(x, y) { - var y0 = abs(y); - if (abs(y0 - 2) < epsilon) return x ? null : [0, sign(y) * halfPi]; - if (y0 > 2) return null; - - x /= 2, y /= 2; - var x2 = x * x, - y2 = y * y, - t = 2 * y / (1 + x2 + y2); // tanh(nPhi) - t = pow((1 + t) / (1 - t), 1 / n); - return [ - atan2(2 * x, 1 - x2 - y2) / n, - asin((t - 1) / (t + 1)) - ]; - }; - - return forward; -} - -export default function() { - var n = 0.5, - m = projectionMutator(lagrangeRaw), - p = m(n); - - p.spacing = function(_) { - return arguments.length ? m(n = +_) : n; - }; - - return p - .scale(124.75); -} diff --git a/node_modules/d3-geo-projection/src/larrivee.js b/node_modules/d3-geo-projection/src/larrivee.js deleted file mode 100644 index cb65846..0000000 --- a/node_modules/d3-geo-projection/src/larrivee.js +++ /dev/null @@ -1,46 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, acos, cos, epsilon, halfPi, sin, pi, sqrt, sqrt2} from "./math.js"; - -var pi_sqrt2 = pi / sqrt2; - -export function larriveeRaw(lambda, phi) { - return [ - lambda * (1 + sqrt(cos(phi))) / 2, - phi / (cos(phi / 2) * cos(lambda / 6)) - ]; -} - -larriveeRaw.invert = function(x, y) { - var x0 = abs(x), - y0 = abs(y), - lambda = epsilon, - phi = halfPi; - if (y0 < pi_sqrt2) phi *= y0 / pi_sqrt2; - else lambda += 6 * acos(pi_sqrt2 / y0); - for (var i = 0; i < 25; i++) { - var sinPhi = sin(phi), - sqrtcosPhi = sqrt(cos(phi)), - sinPhi_2 = sin(phi / 2), - cosPhi_2 = cos(phi / 2), - sinLambda_6 = sin(lambda / 6), - cosLambda_6 = cos(lambda / 6), - f0 = 0.5 * lambda * (1 + sqrtcosPhi) - x0, - f1 = phi / (cosPhi_2 * cosLambda_6) - y0, - df0dPhi = sqrtcosPhi ? -0.25 * lambda * sinPhi / sqrtcosPhi : 0, - df0dLambda = 0.5 * (1 + sqrtcosPhi), - df1dPhi = (1 + 0.5 * phi * sinPhi_2 / cosPhi_2) / (cosPhi_2 * cosLambda_6), - df1dLambda = (phi / cosPhi_2) * (sinLambda_6 / 6) / (cosLambda_6 * cosLambda_6), - denom = df0dPhi * df1dLambda - df1dPhi * df0dLambda, - dPhi = (f0 * df1dLambda - f1 * df0dLambda) / denom, - dLambda = (f1 * df0dPhi - f0 * df1dPhi) / denom; - phi -= dPhi; - lambda -= dLambda; - if (abs(dPhi) < epsilon && abs(dLambda) < epsilon) break; - } - return [x < 0 ? -lambda : lambda, y < 0 ? -phi : phi]; -}; - -export default function() { - return projection(larriveeRaw) - .scale(97.2672); -} diff --git a/node_modules/d3-geo-projection/src/laskowski.js b/node_modules/d3-geo-projection/src/laskowski.js deleted file mode 100644 index 36278a5..0000000 --- a/node_modules/d3-geo-projection/src/laskowski.js +++ /dev/null @@ -1,37 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, epsilon, pi, sign} from "./math.js"; - -export function laskowskiRaw(lambda, phi) { - var lambda2 = lambda * lambda, phi2 = phi * phi; - return [ - lambda * (0.975534 + phi2 * (-0.119161 + lambda2 * -0.0143059 + phi2 * -0.0547009)), - phi * (1.00384 + lambda2 * (0.0802894 + phi2 * -0.02855 + lambda2 * 0.000199025) + phi2 * (0.0998909 + phi2 * -0.0491032)) - ]; -} - -laskowskiRaw.invert = function(x, y) { - var lambda = sign(x) * pi, - phi = y / 2, - i = 50; - do { - var lambda2 = lambda * lambda, - phi2 = phi * phi, - lambdaPhi = lambda * phi, - fx = lambda * (0.975534 + phi2 * (-0.119161 + lambda2 * -0.0143059 + phi2 * -0.0547009)) - x, - fy = phi * (1.00384 + lambda2 * (0.0802894 + phi2 * -0.02855 + lambda2 * 0.000199025) + phi2 * (0.0998909 + phi2 * -0.0491032)) - y, - deltaxDeltaLambda = 0.975534 - phi2 * (0.119161 + 3 * lambda2 * 0.0143059 + phi2 * 0.0547009), - deltaxDeltaPhi = -lambdaPhi * (2 * 0.119161 + 4 * 0.0547009 * phi2 + 2 * 0.0143059 * lambda2), - deltayDeltaLambda = lambdaPhi * (2 * 0.0802894 + 4 * 0.000199025 * lambda2 + 2 * -0.02855 * phi2), - deltayDeltaPhi = 1.00384 + lambda2 * (0.0802894 + 0.000199025 * lambda2) + phi2 * (3 * (0.0998909 - 0.02855 * lambda2) - 5 * 0.0491032 * phi2), - denominator = deltaxDeltaPhi * deltayDeltaLambda - deltayDeltaPhi * deltaxDeltaLambda, - deltaLambda = (fy * deltaxDeltaPhi - fx * deltayDeltaPhi) / denominator, - deltaPhi = (fx * deltayDeltaLambda - fy * deltaxDeltaLambda) / denominator; - lambda -= deltaLambda, phi -= deltaPhi; - } while ((abs(deltaLambda) > epsilon || abs(deltaPhi) > epsilon) && --i > 0); - return i && [lambda, phi]; -}; - -export default function() { - return projection(laskowskiRaw) - .scale(139.98); -} diff --git a/node_modules/d3-geo-projection/src/littrow.js b/node_modules/d3-geo-projection/src/littrow.js deleted file mode 100644 index 89a6db1..0000000 --- a/node_modules/d3-geo-projection/src/littrow.js +++ /dev/null @@ -1,29 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {acos, asin, cos, sign, sin, tan, sqrt, sqrt1_2} from "./math.js"; - -export function littrowRaw(lambda, phi) { - return [ - sin(lambda) / cos(phi), - tan(phi) * cos(lambda) - ]; -} - -littrowRaw.invert = function(x, y) { - var x2 = x * x, - y2 = y * y, - y2_1 = y2 + 1, - x2_y2_1 = x2 + y2_1, - cosPhi = x - ? sqrt1_2 * sqrt((x2_y2_1 - sqrt(x2_y2_1 * x2_y2_1 - 4 * x2)) / x2) - : 1 / sqrt(y2_1); - return [ - asin(x * cosPhi), - sign(y) * acos(cosPhi) - ]; -}; - -export default function() { - return projection(littrowRaw) - .scale(144.049) - .clipAngle(90 - 1e-3); -} diff --git a/node_modules/d3-geo-projection/src/loximuthal.js b/node_modules/d3-geo-projection/src/loximuthal.js deleted file mode 100644 index a685aea..0000000 --- a/node_modules/d3-geo-projection/src/loximuthal.js +++ /dev/null @@ -1,34 +0,0 @@ -import parallel1 from "./parallel1.js"; -import {abs, cos, epsilon, halfPi, log, quarterPi, tan} from "./math.js"; - -export function loximuthalRaw(phi0) { - var cosPhi0 = cos(phi0), - tanPhi0 = tan(quarterPi + phi0 / 2); - - function forward(lambda, phi) { - var y = phi - phi0, - x = abs(y) < epsilon ? lambda * cosPhi0 - : abs(x = quarterPi + phi / 2) < epsilon || abs(abs(x) - halfPi) < epsilon - ? 0 : lambda * y / log(tan(x) / tanPhi0); - return [x, y]; - } - - forward.invert = function(x, y) { - var lambda, - phi = y + phi0; - return [ - abs(y) < epsilon ? x / cosPhi0 - : (abs(lambda = quarterPi + phi / 2) < epsilon || abs(abs(lambda) - halfPi) < epsilon) ? 0 - : x * log(tan(lambda) / tanPhi0) / y, - phi - ]; - }; - - return forward; -} - -export default function() { - return parallel1(loximuthalRaw) - .parallel(40) - .scale(158.837); -} diff --git a/node_modules/d3-geo-projection/src/math.js b/node_modules/d3-geo-projection/src/math.js deleted file mode 100644 index 2d82df3..0000000 --- a/node_modules/d3-geo-projection/src/math.js +++ /dev/null @@ -1,64 +0,0 @@ -export var abs = Math.abs; -export var atan = Math.atan; -export var atan2 = Math.atan2; -export var ceil = Math.ceil; -export var cos = Math.cos; -export var exp = Math.exp; -export var floor = Math.floor; -export var log = Math.log; -export var max = Math.max; -export var min = Math.min; -export var pow = Math.pow; -export var round = Math.round; -export var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; -export var sin = Math.sin; -export var tan = Math.tan; - -export var epsilon = 1e-6; -export var epsilon2 = 1e-12; -export var pi = Math.PI; -export var halfPi = pi / 2; -export var quarterPi = pi / 4; -export var sqrt1_2 = Math.SQRT1_2; -export var sqrt2 = sqrt(2); -export var sqrtPi = sqrt(pi); -export var tau = pi * 2; -export var degrees = 180 / pi; -export var radians = pi / 180; - -export function sinci(x) { - return x ? x / Math.sin(x) : 1; -} - -export function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} - -export function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} - -export function sqrt(x) { - return x > 0 ? Math.sqrt(x) : 0; -} - -export function tanh(x) { - x = exp(2 * x); - return (x - 1) / (x + 1); -} - -export function sinh(x) { - return (exp(x) - exp(-x)) / 2; -} - -export function cosh(x) { - return (exp(x) + exp(-x)) / 2; -} - -export function arsinh(x) { - return log(x + sqrt(x * x + 1)); -} - -export function arcosh(x) { - return log(x + sqrt(x * x - 1)); -} diff --git a/node_modules/d3-geo-projection/src/miller.js b/node_modules/d3-geo-projection/src/miller.js deleted file mode 100644 index 7f1629a..0000000 --- a/node_modules/d3-geo-projection/src/miller.js +++ /dev/null @@ -1,15 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {atan, exp, log, quarterPi, pi, tan} from "./math.js"; - -export function millerRaw(lambda, phi) { - return [lambda, 1.25 * log(tan(quarterPi + 0.4 * phi))]; -} - -millerRaw.invert = function(x, y) { - return [x, 2.5 * atan(exp(0.8 * y)) - 0.625 * pi]; -}; - -export default function() { - return projection(millerRaw) - .scale(108.318); -} diff --git a/node_modules/d3-geo-projection/src/modifiedStereographic.js b/node_modules/d3-geo-projection/src/modifiedStereographic.js deleted file mode 100644 index e4db8ed..0000000 --- a/node_modules/d3-geo-projection/src/modifiedStereographic.js +++ /dev/null @@ -1,122 +0,0 @@ -import {geoProjection as projection, geoRotation as rotation} from "d3-geo"; -import {abs, asin, atan, atan2, cos, epsilon, sin, sqrt} from "./math.js"; - -export function modifiedStereographicRaw(C) { - var m = C.length - 1; - - function forward(lambda, phi) { - var cosPhi = cos(phi), - k = 2 / (1 + cosPhi * cos(lambda)), - zr = k * cosPhi * sin(lambda), - zi = k * sin(phi), - i = m, - w = C[i], - ar = w[0], - ai = w[1], - t; - while (--i >= 0) { - w = C[i]; - ar = w[0] + zr * (t = ar) - zi * ai; - ai = w[1] + zr * ai + zi * t; - } - ar = zr * (t = ar) - zi * ai; - ai = zr * ai + zi * t; - return [ar, ai]; - } - - forward.invert = function(x, y) { - var i = 20, - zr = x, - zi = y; - do { - var j = m, - w = C[j], - ar = w[0], - ai = w[1], - br = 0, - bi = 0, - t; - - while (--j >= 0) { - w = C[j]; - br = ar + zr * (t = br) - zi * bi; - bi = ai + zr * bi + zi * t; - ar = w[0] + zr * (t = ar) - zi * ai; - ai = w[1] + zr * ai + zi * t; - } - br = ar + zr * (t = br) - zi * bi; - bi = ai + zr * bi + zi * t; - ar = zr * (t = ar) - zi * ai - x; - ai = zr * ai + zi * t - y; - - var denominator = br * br + bi * bi, deltar, deltai; - zr -= deltar = (ar * br + ai * bi) / denominator; - zi -= deltai = (ai * br - ar * bi) / denominator; - } while (abs(deltar) + abs(deltai) > epsilon * epsilon && --i > 0); - - if (i) { - var rho = sqrt(zr * zr + zi * zi), - c = 2 * atan(rho * 0.5), - sinc = sin(c); - return [atan2(zr * sinc, rho * cos(c)), rho ? asin(zi * sinc / rho) : 0]; - } - }; - - return forward; -} - -var alaska = [[0.9972523, 0], [0.0052513, -0.0041175], [0.0074606, 0.0048125], [-0.0153783, -0.1968253], [0.0636871, -0.1408027], [0.3660976, -0.2937382]], - gs48 = [[0.98879, 0], [0, 0], [-0.050909, 0], [0, 0], [0.075528, 0]], - gs50 = [[0.9842990, 0], [0.0211642, 0.0037608], [-0.1036018, -0.0575102], [-0.0329095, -0.0320119], [0.0499471, 0.1223335], [0.0260460, 0.0899805], [0.0007388, -0.1435792], [0.0075848, -0.1334108], [-0.0216473, 0.0776645], [-0.0225161, 0.0853673]], - miller = [[0.9245, 0], [0, 0], [0.01943, 0]], - lee = [[0.721316, 0], [0, 0], [-0.00881625, -0.00617325]]; - -export function modifiedStereographicAlaska() { - return modifiedStereographic(alaska, [152, -64]) - .scale(1400) - .center([-160.908, 62.4864]) - .clipAngle(30) - .angle(7.8); -} - -export function modifiedStereographicGs48() { - return modifiedStereographic(gs48, [95, -38]) - .scale(1000) - .clipAngle(55) - .center([-96.5563, 38.8675]); -} - -export function modifiedStereographicGs50() { - return modifiedStereographic(gs50, [120, -45]) - .scale(359.513) - .clipAngle(55) - .center([-117.474, 53.0628]); -} - -export function modifiedStereographicMiller() { - return modifiedStereographic(miller, [-20, -18]) - .scale(209.091) - .center([20, 16.7214]) - .clipAngle(82); -} - -export function modifiedStereographicLee() { - return modifiedStereographic(lee, [165, 10]) - .scale(250) - .clipAngle(130) - .center([-165, -10]); -} - -export default function modifiedStereographic(coefficients, rotate) { - var p = projection(modifiedStereographicRaw(coefficients)).rotate(rotate).clipAngle(90), - r = rotation(rotate), - center = p.center; - - delete p.rotate; - - p.center = function(_) { - return arguments.length ? center(r(_)) : r.invert(center()); - }; - - return p; -} diff --git a/node_modules/d3-geo-projection/src/mollweide.js b/node_modules/d3-geo-projection/src/mollweide.js deleted file mode 100644 index 2c3b8f8..0000000 --- a/node_modules/d3-geo-projection/src/mollweide.js +++ /dev/null @@ -1,29 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, asin, cos, epsilon, halfPi, pi, sin, sqrt2} from "./math.js"; - -export function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * sin(phi), i = 30, delta; - do phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi)); - while (abs(delta) > epsilon && --i > 0); - return phi / 2; -} - -export function mollweideBromleyRaw(cx, cy, cp) { - - function forward(lambda, phi) { - return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)]; - } - - forward.invert = function(x, y) { - return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)]; - }; - - return forward; -} - -export var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); - -export default function() { - return projection(mollweideRaw) - .scale(169.529); -} diff --git a/node_modules/d3-geo-projection/src/mtFlatPolarParabolic.js b/node_modules/d3-geo-projection/src/mtFlatPolarParabolic.js deleted file mode 100644 index 2afeb86..0000000 --- a/node_modules/d3-geo-projection/src/mtFlatPolarParabolic.js +++ /dev/null @@ -1,26 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {asin, cos, sin, sqrt} from "./math.js"; - -var sqrt6 = sqrt(6), - sqrt7 = sqrt(7); - -export function mtFlatPolarParabolicRaw(lambda, phi) { - var theta = asin(7 * sin(phi) / (3 * sqrt6)); - return [ - sqrt6 * lambda * (2 * cos(2 * theta / 3) - 1) / sqrt7, - 9 * sin(theta / 3) / sqrt7 - ]; -} - -mtFlatPolarParabolicRaw.invert = function(x, y) { - var theta = 3 * asin(y * sqrt7 / 9); - return [ - x * sqrt7 / (sqrt6 * (2 * cos(2 * theta / 3) - 1)), - asin(sin(theta) * 3 * sqrt6 / 7) - ]; -}; - -export default function() { - return projection(mtFlatPolarParabolicRaw) - .scale(164.859); -} diff --git a/node_modules/d3-geo-projection/src/mtFlatPolarQuartic.js b/node_modules/d3-geo-projection/src/mtFlatPolarQuartic.js deleted file mode 100644 index 5b1e98d..0000000 --- a/node_modules/d3-geo-projection/src/mtFlatPolarQuartic.js +++ /dev/null @@ -1,29 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, asin, cos, epsilon, sin, sqrt, sqrt1_2, sqrt2} from "./math.js"; - -export function mtFlatPolarQuarticRaw(lambda, phi) { - var k = (1 + sqrt1_2) * sin(phi), - theta = phi; - for (var i = 0, delta; i < 25; i++) { - theta -= delta = (sin(theta / 2) + sin(theta) - k) / (0.5 * cos(theta / 2) + cos(theta)); - if (abs(delta) < epsilon) break; - } - return [ - lambda * (1 + 2 * cos(theta) / cos(theta / 2)) / (3 * sqrt2), - 2 * sqrt(3) * sin(theta / 2) / sqrt(2 + sqrt2) - ]; -} - -mtFlatPolarQuarticRaw.invert = function(x, y) { - var sinTheta_2 = y * sqrt(2 + sqrt2) / (2 * sqrt(3)), - theta = 2 * asin(sinTheta_2); - return [ - 3 * sqrt2 * x / (1 + 2 * cos(theta) / cos(theta / 2)), - asin((sinTheta_2 + sin(theta)) / (1 + sqrt1_2)) - ]; -}; - -export default function() { - return projection(mtFlatPolarQuarticRaw) - .scale(188.209); -} diff --git a/node_modules/d3-geo-projection/src/mtFlatPolarSinusoidal.js b/node_modules/d3-geo-projection/src/mtFlatPolarSinusoidal.js deleted file mode 100644 index 77aac51..0000000 --- a/node_modules/d3-geo-projection/src/mtFlatPolarSinusoidal.js +++ /dev/null @@ -1,31 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, asin, cos, epsilon, halfPi, pi, sin, sqrt} from "./math.js"; - -export function mtFlatPolarSinusoidalRaw(lambda, phi) { - var A = sqrt(6 / (4 + pi)), - k = (1 + pi / 4) * sin(phi), - theta = phi / 2; - for (var i = 0, delta; i < 25; i++) { - theta -= delta = (theta / 2 + sin(theta) - k) / (0.5 + cos(theta)); - if (abs(delta) < epsilon) break; - } - return [ - A * (0.5 + cos(theta)) * lambda / 1.5, - A * theta - ]; -} - -mtFlatPolarSinusoidalRaw.invert = function(x, y) { - var A = sqrt(6 / (4 + pi)), - theta = y / A; - if (abs(abs(theta) - halfPi) < epsilon) theta = theta < 0 ? -halfPi : halfPi; - return [ - 1.5 * x / (A * (0.5 + cos(theta))), - asin((theta / 2 + sin(theta)) / (1 + pi / 4)) - ]; -}; - -export default function() { - return projection(mtFlatPolarSinusoidalRaw) - .scale(166.518); -} diff --git a/node_modules/d3-geo-projection/src/naturalEarth2.js b/node_modules/d3-geo-projection/src/naturalEarth2.js deleted file mode 100644 index 7914f75..0000000 --- a/node_modules/d3-geo-projection/src/naturalEarth2.js +++ /dev/null @@ -1,29 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, epsilon2} from "./math.js"; - -export function naturalEarth2Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2, phi6 = phi2 * phi4; - return [ - lambda * (0.84719 - 0.13063 * phi2 + phi6 * phi6 * (-0.04515 + 0.05494 * phi2 - 0.02326 * phi4 + 0.00331 * phi6)), - phi * (1.01183 + phi4 * phi4 * (-0.02625 + 0.01926 * phi2 - 0.00396 * phi4)) - ]; -} - -naturalEarth2Raw.invert = function(x, y) { - var phi = y, i = 25, delta, phi2, phi4, phi6; - do { - phi2 = phi * phi; phi4 = phi2 * phi2; - phi -= delta = ((phi * (1.01183 + phi4 * phi4 * (-0.02625 + 0.01926 * phi2 - 0.00396 * phi4))) - y) / - (1.01183 + phi4 * phi4 * ((9 * -0.02625) + (11 * 0.01926) * phi2 + (13 * -0.00396) * phi4)); - } while (abs(delta) > epsilon2 && --i > 0); - phi2 = phi * phi; phi4 = phi2 * phi2; phi6 = phi2 * phi4; - return [ - x / (0.84719 - 0.13063 * phi2 + phi6 * phi6 * (-0.04515 + 0.05494 * phi2 - 0.02326 * phi4 + 0.00331 * phi6)), - phi - ]; -}; - -export default function() { - return projection(naturalEarth2Raw) - .scale(175.295); -} diff --git a/node_modules/d3-geo-projection/src/nellHammer.js b/node_modules/d3-geo-projection/src/nellHammer.js deleted file mode 100644 index 1c6ffea..0000000 --- a/node_modules/d3-geo-projection/src/nellHammer.js +++ /dev/null @@ -1,26 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, cos, epsilon, tan} from "./math.js"; - -export function nellHammerRaw(lambda, phi) { - return [ - lambda * (1 + cos(phi)) / 2, - 2 * (phi - tan(phi / 2)) - ]; -} - -nellHammerRaw.invert = function(x, y) { - var p = y / 2; - for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; ++i) { - var c = cos(y / 2); - y -= delta = (y - tan(y / 2) - p) / (1 - 0.5 / (c * c)); - } - return [ - 2 * x / (1 + cos(y)), - y - ]; -}; - -export default function() { - return projection(nellHammerRaw) - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/newton.js b/node_modules/d3-geo-projection/src/newton.js deleted file mode 100644 index b556733..0000000 --- a/node_modules/d3-geo-projection/src/newton.js +++ /dev/null @@ -1,64 +0,0 @@ -import {abs, epsilon, epsilon2} from "./math.js"; - -// Approximate Newton-Raphson -// Solve f(x) = y, start from x -export function solve(f, y, x) { - var steps = 100, delta, f0, f1; - x = x === undefined ? 0 : +x; - y = +y; - do { - f0 = f(x); - f1 = f(x + epsilon); - if (f0 === f1) f1 = f0 + epsilon; - x -= delta = (-1 * epsilon * (f0 - y)) / (f0 - f1); - } while (steps-- > 0 && abs(delta) > epsilon); - return steps < 0 ? NaN : x; -} - -// Approximate Newton-Raphson in 2D -// Solve f(a,b) = [x,y] -export function solve2d(f, MAX_ITERATIONS, eps) { - if (MAX_ITERATIONS === undefined) MAX_ITERATIONS = 40; - if (eps === undefined) eps = epsilon2; - return function(x, y, a, b) { - var err2, da, db; - a = a === undefined ? 0 : +a; - b = b === undefined ? 0 : +b; - for (var i = 0; i < MAX_ITERATIONS; i++) { - var p = f(a, b), - // diffs - tx = p[0] - x, - ty = p[1] - y; - if (abs(tx) < eps && abs(ty) < eps) break; // we're there! - - // backtrack if we overshot - var h = tx * tx + ty * ty; - if (h > err2) { - a -= da /= 2; - b -= db /= 2; - continue; - } - err2 = h; - - // partial derivatives - var ea = (a > 0 ? -1 : 1) * eps, - eb = (b > 0 ? -1 : 1) * eps, - pa = f(a + ea, b), - pb = f(a, b + eb), - dxa = (pa[0] - p[0]) / ea, - dya = (pa[1] - p[1]) / ea, - dxb = (pb[0] - p[0]) / eb, - dyb = (pb[1] - p[1]) / eb, - // determinant - D = dyb * dxa - dya * dxb, - // newton step — or half-step for small D - l = (abs(D) < 0.5 ? 0.5 : 1) / D; - da = (ty * dxb - tx * dyb) * l; - db = (tx * dya - ty * dxa) * l; - a += da; - b += db; - if (abs(da) < eps && abs(db) < eps) break; // we're crawling - } - return [a, b]; - }; -} \ No newline at end of file diff --git a/node_modules/d3-geo-projection/src/nicolosi.js b/node_modules/d3-geo-projection/src/nicolosi.js deleted file mode 100644 index cc6aba1..0000000 --- a/node_modules/d3-geo-projection/src/nicolosi.js +++ /dev/null @@ -1,64 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, cos, halfPi, pi, sign, sin, sqrt} from "./math.js"; -import {solve} from "./newton.js"; - -// Based on Torben Jansen's implementation -// https://beta.observablehq.com/@toja/nicolosi-globular-projection -// https://beta.observablehq.com/@toja/nicolosi-globular-inverse - -export function nicolosiRaw(lambda, phi) { - var sinPhi = sin(phi), - q = cos(phi), - s = sign(lambda); - - if (lambda === 0 || abs(phi) === halfPi) return [0, phi]; - else if (phi === 0) return [lambda, 0]; - else if (abs(lambda) === halfPi) return [lambda * q, halfPi * sinPhi]; - - var b = pi / (2 * lambda) - (2 * lambda) / pi, - c = (2 * phi) / pi, - d = (1 - c * c) / (sinPhi - c); - - var b2 = b * b, - d2 = d * d, - b2d2 = 1 + b2 / d2, - d2b2 = 1 + d2 / b2; - - var M = ((b * sinPhi) / d - b / 2) / b2d2, - N = ((d2 * sinPhi) / b2 + d / 2) / d2b2, - m = M * M + (q * q) / b2d2, - n = N * N - ((d2 * sinPhi * sinPhi) / b2 + d * sinPhi - 1) / d2b2; - - return [ - halfPi * (M + sqrt(m) * s), - halfPi * (N + sqrt(n < 0 ? 0 : n) * sign(-phi * b) * s) - ]; -} - -nicolosiRaw.invert = function(x, y) { - - x /= halfPi; - y /= halfPi; - - var x2 = x * x, - y2 = y * y, - x2y2 = x2 + y2, - pi2 = pi * pi; - - return [ - x ? (x2y2 -1 + sqrt((1 - x2y2) * (1 - x2y2) + 4 * x2)) / (2 * x) * halfPi : 0, - solve(function(phi) { - return ( - x2y2 * (pi * sin(phi) - 2 * phi) * pi + - 4 * phi * phi * (y - sin(phi)) + - 2 * pi * phi - - pi2 * y - ); - }, 0) - ]; -}; - -export default function() { - return projection(nicolosiRaw) - .scale(127.267); -} diff --git a/node_modules/d3-geo-projection/src/noop.js b/node_modules/d3-geo-projection/src/noop.js deleted file mode 100644 index 6ab80bc..0000000 --- a/node_modules/d3-geo-projection/src/noop.js +++ /dev/null @@ -1 +0,0 @@ -export default function() {} diff --git a/node_modules/d3-geo-projection/src/parallel1.js b/node_modules/d3-geo-projection/src/parallel1.js deleted file mode 100644 index 96e2da2..0000000 --- a/node_modules/d3-geo-projection/src/parallel1.js +++ /dev/null @@ -1,14 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {degrees, radians} from "./math.js"; - -export default function(projectAt) { - var phi0 = 0, - m = projectionMutator(projectAt), - p = m(phi0); - - p.parallel = function(_) { - return arguments.length ? m(phi0 = _ * radians) : phi0 * degrees; - }; - - return p; -} diff --git a/node_modules/d3-geo-projection/src/patterson.js b/node_modules/d3-geo-projection/src/patterson.js deleted file mode 100644 index 8ef14d3..0000000 --- a/node_modules/d3-geo-projection/src/patterson.js +++ /dev/null @@ -1,41 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, epsilon} from "./math.js"; - -// Based on Java implementation by Bojan Savric. -// https://github.com/OSUCartography/JMapProjLib/blob/master/src/com/jhlabs/map/proj/PattersonProjection.java - -var pattersonK1 = 1.0148, - pattersonK2 = 0.23185, - pattersonK3 = -0.14499, - pattersonK4 = 0.02406, - pattersonC1 = pattersonK1, - pattersonC2 = 5 * pattersonK2, - pattersonC3 = 7 * pattersonK3, - pattersonC4 = 9 * pattersonK4, - pattersonYmax = 1.790857183; - -export function pattersonRaw(lambda, phi) { - var phi2 = phi * phi; - return [ - lambda, - phi * (pattersonK1 + phi2 * phi2 * (pattersonK2 + phi2 * (pattersonK3 + pattersonK4 * phi2))) - ]; -} - -pattersonRaw.invert = function(x, y) { - if (y > pattersonYmax) y = pattersonYmax; - else if (y < -pattersonYmax) y = -pattersonYmax; - var yc = y, delta; - - do { // Newton-Raphson - var y2 = yc * yc; - yc -= delta = ((yc * (pattersonK1 + y2 * y2 * (pattersonK2 + y2 * (pattersonK3 + pattersonK4 * y2)))) - y) / (pattersonC1 + y2 * y2 * (pattersonC2 + y2 * (pattersonC3 + pattersonC4 * y2))); - } while (abs(delta) > epsilon); - - return [x, yc]; -}; - -export default function() { - return projection(pattersonRaw) - .scale(139.319); -} diff --git a/node_modules/d3-geo-projection/src/polyconic.js b/node_modules/d3-geo-projection/src/polyconic.js deleted file mode 100644 index 0aa6565..0000000 --- a/node_modules/d3-geo-projection/src/polyconic.js +++ /dev/null @@ -1,35 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, acos, asin, cos, epsilon, halfPi, sign, sin, tan} from "./math.js"; - -export function polyconicRaw(lambda, phi) { - if (abs(phi) < epsilon) return [lambda, 0]; - var tanPhi = tan(phi), - k = lambda * sin(phi); - return [ - sin(k) / tanPhi, - phi + (1 - cos(k)) / tanPhi - ]; -} - -polyconicRaw.invert = function(x, y) { - if (abs(y) < epsilon) return [x, 0]; - var k = x * x + y * y, - phi = y * 0.5, - i = 10, delta; - do { - var tanPhi = tan(phi), - secPhi = 1 / cos(phi), - j = k - 2 * y * phi + phi * phi; - phi -= delta = (tanPhi * j + 2 * (phi - y)) / (2 + j * secPhi * secPhi + 2 * (phi - y) * tanPhi); - } while (abs(delta) > epsilon && --i > 0); - tanPhi = tan(phi); - return [ - (abs(y) < abs(phi + 1 / tanPhi) ? asin(x * tanPhi) : sign(y) * sign(x) * (acos(abs(x * tanPhi)) + halfPi)) / sin(phi), - phi - ]; -}; - -export default function() { - return projection(polyconicRaw) - .scale(103.74); -} diff --git a/node_modules/d3-geo-projection/src/polyhedral/butterfly.js b/node_modules/d3-geo-projection/src/polyhedral/butterfly.js deleted file mode 100644 index 2136d52..0000000 --- a/node_modules/d3-geo-projection/src/polyhedral/butterfly.js +++ /dev/null @@ -1,31 +0,0 @@ -import {geoCentroid as centroid, geoGnomonic as gnomonic} from "d3-geo"; -import {pi} from "../math.js"; -import polyhedral from "./index.js"; -import octahedron from "./octahedron.js"; - -export default function(faceProjection) { - - faceProjection = faceProjection || function(face) { - var c = centroid({type: "MultiPoint", coordinates: face}); - return gnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]); - }; - - var faces = octahedron.map(function(face) { - return {face: face, project: faceProjection(face)}; - }); - - [-1, 0, 0, 1, 0, 1, 4, 5].forEach(function(d, i) { - var node = faces[d]; - node && (node.children || (node.children = [])).push(faces[i]); - }); - - return polyhedral(faces[0], function(lambda, phi) { - return faces[lambda < -pi / 2 ? phi < 0 ? 6 : 4 - : lambda < 0 ? phi < 0 ? 2 : 0 - : lambda < pi / 2 ? phi < 0 ? 3 : 1 - : phi < 0 ? 7 : 5]; - }) - .angle(-30) - .scale(101.858) - .center([0, 45]); -} diff --git a/node_modules/d3-geo-projection/src/polyhedral/collignon.js b/node_modules/d3-geo-projection/src/polyhedral/collignon.js deleted file mode 100644 index 99cb55f..0000000 --- a/node_modules/d3-geo-projection/src/polyhedral/collignon.js +++ /dev/null @@ -1,43 +0,0 @@ -import {geoCentroid as centroid, geoProjection as projection} from "d3-geo"; -import {collignonRaw} from "../collignon.js"; -import {pi, sqrt} from "../math.js"; -import polyhedral from "./index.js"; -import octahedron from "./octahedron.js"; - -var kx = 2 / sqrt(3); - -function collignonK(a, b) { - var p = collignonRaw(a, b); - return [p[0] * kx, p[1]]; -} - -collignonK.invert = function(x,y) { - return collignonRaw.invert(x / kx, y); -}; - -export default function(faceProjection) { - - faceProjection = faceProjection || function(face) { - var c = centroid({type: "MultiPoint", coordinates: face}); - return projection(collignonK).translate([0, 0]).scale(1).rotate(c[1] > 0 ? [-c[0], 0] : [180 - c[0], 180]); - }; - - var faces = octahedron.map(function(face) { - return {face: face, project: faceProjection(face)}; - }); - - [-1, 0, 0, 1, 0, 1, 4, 5].forEach(function(d, i) { - var node = faces[d]; - node && (node.children || (node.children = [])).push(faces[i]); - }); - - return polyhedral(faces[0], function(lambda, phi) { - return faces[lambda < -pi / 2 ? phi < 0 ? 6 : 4 - : lambda < 0 ? phi < 0 ? 2 : 0 - : lambda < pi / 2 ? phi < 0 ? 3 : 1 - : phi < 0 ? 7 : 5]; - }) - .angle(-30) - .scale(121.906) - .center([0, 48.5904]); -} diff --git a/node_modules/d3-geo-projection/src/polyhedral/cube.js b/node_modules/d3-geo-projection/src/polyhedral/cube.js deleted file mode 100644 index 7e55211..0000000 --- a/node_modules/d3-geo-projection/src/polyhedral/cube.js +++ /dev/null @@ -1,21 +0,0 @@ -import {atan, degrees, sqrt1_2} from "../math.js"; - -var phi1 = atan(sqrt1_2) * degrees; - -var cube = [ - [0, phi1], [90, phi1], [180, phi1], [-90, phi1], - [0, -phi1], [90, -phi1], [180, -phi1], [-90, -phi1] -]; - -export default [ - [0, 3, 2, 1], // N - [0, 1, 5, 4], - [1, 2, 6, 5], - [2, 3, 7, 6], - [3, 0, 4, 7], - [4, 5, 6, 7] // S -].map(function(face) { - return face.map(function(i) { - return cube[i]; - }); -}); diff --git a/node_modules/d3-geo-projection/src/polyhedral/index.js b/node_modules/d3-geo-projection/src/polyhedral/index.js deleted file mode 100644 index a1e2fca..0000000 --- a/node_modules/d3-geo-projection/src/polyhedral/index.js +++ /dev/null @@ -1,174 +0,0 @@ -import {geoBounds as bounds, geoCentroid as centroid, geoInterpolate as interpolate, geoProjection as projection} from "d3-geo"; -import {abs, degrees, epsilon, radians} from "../math.js"; -import {default as matrix, multiply, inverse} from "./matrix.js"; - -// Creates a polyhedral projection. -// * root: a spanning tree of polygon faces. Nodes are automatically -// augmented with a transform matrix. -// * face: a function that returns the appropriate node for a given {lambda, phi} -// point (radians). -// * r: rotation angle for root face [deprecated by .angle()]. -export default function(root, face, r) { - - recurse(root, {transform: null}); - - function recurse(node, parent) { - node.edges = faceEdges(node.face); - // Find shared edge. - if (parent.face) { - var shared = node.shared = sharedEdge(node.face, parent.face), - m = matrix(shared.map(parent.project), shared.map(node.project)); - node.transform = parent.transform ? multiply(parent.transform, m) : m; - // Replace shared edge in parent edges array. - var edges = parent.edges; - for (var i = 0, n = edges.length; i < n; ++i) { - if (pointEqual(shared[0], edges[i][1]) && pointEqual(shared[1], edges[i][0])) edges[i] = node; - if (pointEqual(shared[0], edges[i][0]) && pointEqual(shared[1], edges[i][1])) edges[i] = node; - } - edges = node.edges; - for (i = 0, n = edges.length; i < n; ++i) { - if (pointEqual(shared[0], edges[i][0]) && pointEqual(shared[1], edges[i][1])) edges[i] = parent; - if (pointEqual(shared[0], edges[i][1]) && pointEqual(shared[1], edges[i][0])) edges[i] = parent; - } - } else { - node.transform = parent.transform; - } - if (node.children) { - node.children.forEach(function(child) { - recurse(child, node); - }); - } - return node; - } - - function forward(lambda, phi) { - var node = face(lambda, phi), - point = node.project([lambda * degrees, phi * degrees]), - t; - if (t = node.transform) { - return [ - t[0] * point[0] + t[1] * point[1] + t[2], - -(t[3] * point[0] + t[4] * point[1] + t[5]) - ]; - } - point[1] = -point[1]; - return point; - } - - // Naive inverse! A faster solution would use bounding boxes, or even a - // polygonal quadtree. - if (hasInverse(root)) forward.invert = function(x, y) { - var coordinates = faceInvert(root, [x, -y]); - return coordinates && (coordinates[0] *= radians, coordinates[1] *= radians, coordinates); - }; - - function faceInvert(node, coordinates) { - var invert = node.project.invert, - t = node.transform, - point = coordinates; - if (t) { - t = inverse(t); - point = [ - t[0] * point[0] + t[1] * point[1] + t[2], - (t[3] * point[0] + t[4] * point[1] + t[5]) - ]; - } - if (invert && node === faceDegrees(p = invert(point))) return p; - var p, - children = node.children; - for (var i = 0, n = children && children.length; i < n; ++i) { - if (p = faceInvert(children[i], coordinates)) return p; - } - } - - function faceDegrees(coordinates) { - return face(coordinates[0] * radians, coordinates[1] * radians); - } - - var proj = projection(forward), - stream_ = proj.stream; - - proj.stream = function(stream) { - var rotate = proj.rotate(), - rotateStream = stream_(stream), - sphereStream = (proj.rotate([0, 0]), stream_(stream)); - proj.rotate(rotate); - rotateStream.sphere = function() { - sphereStream.polygonStart(); - sphereStream.lineStart(); - outline(sphereStream, root); - sphereStream.lineEnd(); - sphereStream.polygonEnd(); - }; - return rotateStream; - }; - - return proj.angle(r == null ? -30 : r * degrees); -} - -function outline(stream, node, parent) { - var point, - edges = node.edges, - n = edges.length, - edge, - multiPoint = {type: "MultiPoint", coordinates: node.face}, - notPoles = node.face.filter(function(d) { return abs(d[1]) !== 90; }), - b = bounds({type: "MultiPoint", coordinates: notPoles}), - inside = false, - j = -1, - dx = b[1][0] - b[0][0]; - // TODO - var c = dx === 180 || dx === 360 - ? [(b[0][0] + b[1][0]) / 2, (b[0][1] + b[1][1]) / 2] - : centroid(multiPoint); - // First find the shared edge… - if (parent) while (++j < n) { - if (edges[j] === parent) break; - } - ++j; - for (var i = 0; i < n; ++i) { - edge = edges[(i + j) % n]; - if (Array.isArray(edge)) { - if (!inside) { - stream.point((point = interpolate(edge[0], c)(epsilon))[0], point[1]); - inside = true; - } - stream.point((point = interpolate(edge[1], c)(epsilon))[0], point[1]); - } else { - inside = false; - if (edge !== parent) outline(stream, edge, node); - } - } -} - -// Tests equality of two spherical points. -function pointEqual(a, b) { - return a && b && a[0] === b[0] && a[1] === b[1]; -} - -// Finds a shared edge given two clockwise polygons. -function sharedEdge(a, b) { - var x, y, n = a.length, found = null; - for (var i = 0; i < n; ++i) { - x = a[i]; - for (var j = b.length; --j >= 0;) { - y = b[j]; - if (x[0] === y[0] && x[1] === y[1]) { - if (found) return [found, x]; - found = x; - } - } - } -} - -// Converts an array of n face vertices to an array of n + 1 edges. -function faceEdges(face) { - var n = face.length, - edges = []; - for (var a = face[n - 1], i = 0; i < n; ++i) edges.push([a, a = face[i]]); - return edges; -} - -function hasInverse(node) { - return node.project.invert || node.children && node.children.some(hasInverse); -} diff --git a/node_modules/d3-geo-projection/src/polyhedral/matrix.js b/node_modules/d3-geo-projection/src/polyhedral/matrix.js deleted file mode 100644 index 0e28b63..0000000 --- a/node_modules/d3-geo-projection/src/polyhedral/matrix.js +++ /dev/null @@ -1,64 +0,0 @@ -import {atan2, cos, sin, sqrt} from "../math.js"; - -// Note: 6-element arrays are used to denote the 3x3 affine transform matrix: -// [a, b, c, -// d, e, f, -// 0, 0, 1] - this redundant row is left out. - -// Transform matrix for [a0, a1] -> [b0, b1]. -export default function(a, b) { - var u = subtract(a[1], a[0]), - v = subtract(b[1], b[0]), - phi = angle(u, v), - s = length(u) / length(v); - - return multiply([ - 1, 0, a[0][0], - 0, 1, a[0][1] - ], multiply([ - s, 0, 0, - 0, s, 0 - ], multiply([ - cos(phi), sin(phi), 0, - -sin(phi), cos(phi), 0 - ], [ - 1, 0, -b[0][0], - 0, 1, -b[0][1] - ]))); -} - -// Inverts a transform matrix. -export function inverse(m) { - var k = 1 / (m[0] * m[4] - m[1] * m[3]); - return [ - k * m[4], -k * m[1], k * (m[1] * m[5] - m[2] * m[4]), - -k * m[3], k * m[0], k * (m[2] * m[3] - m[0] * m[5]) - ]; -} - -// Multiplies two 3x2 matrices. -export function multiply(a, b) { - return [ - a[0] * b[0] + a[1] * b[3], - a[0] * b[1] + a[1] * b[4], - a[0] * b[2] + a[1] * b[5] + a[2], - a[3] * b[0] + a[4] * b[3], - a[3] * b[1] + a[4] * b[4], - a[3] * b[2] + a[4] * b[5] + a[5] - ]; -} - -// Subtracts 2D vectors. -function subtract(a, b) { - return [a[0] - b[0], a[1] - b[1]]; -} - -// Magnitude of a 2D vector. -function length(v) { - return sqrt(v[0] * v[0] + v[1] * v[1]); -} - -// Angle between two 2D vectors. -function angle(a, b) { - return atan2(a[0] * b[1] - a[1] * b[0], a[0] * b[0] + a[1] * b[1]); -} diff --git a/node_modules/d3-geo-projection/src/polyhedral/octahedron.js b/node_modules/d3-geo-projection/src/polyhedral/octahedron.js deleted file mode 100644 index 8229c12..0000000 --- a/node_modules/d3-geo-projection/src/polyhedral/octahedron.js +++ /dev/null @@ -1,21 +0,0 @@ -// TODO generate on-the-fly to avoid external modification. -var octahedron = [ - [0, 90], - [-90, 0], [0, 0], [90, 0], [180, 0], - [0, -90] -]; - -export default [ - [0, 2, 1], - [0, 3, 2], - [5, 1, 2], - [5, 2, 3], - [0, 1, 4], - [0, 4, 3], - [5, 4, 1], - [5, 3, 4] -].map(function(face) { - return face.map(function(i) { - return octahedron[i]; - }); -}); diff --git a/node_modules/d3-geo-projection/src/polyhedral/waterman.js b/node_modules/d3-geo-projection/src/polyhedral/waterman.js deleted file mode 100644 index 0f73de8..0000000 --- a/node_modules/d3-geo-projection/src/polyhedral/waterman.js +++ /dev/null @@ -1,123 +0,0 @@ -import {geoCentroid as centroid, geoGnomonic as gnomonic} from "d3-geo"; -import {asin, atan2, cos, degrees, max, min, pi, radians, sin} from "../math.js"; -import polyhedral from "./index.js"; -import octahedron from "./octahedron.js"; - -export default function(faceProjection) { - - faceProjection = faceProjection || function(face) { - var c = face.length === 6 ? centroid({type: "MultiPoint", coordinates: face}) : face[0]; - return gnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]); - }; - - var w5 = octahedron.map(function(face) { - var xyz = face.map(cartesian), - n = xyz.length, - a = xyz[n - 1], - b, - hexagon = []; - for (var i = 0; i < n; ++i) { - b = xyz[i]; - hexagon.push(spherical([ - a[0] * 0.9486832980505138 + b[0] * 0.31622776601683794, - a[1] * 0.9486832980505138 + b[1] * 0.31622776601683794, - a[2] * 0.9486832980505138 + b[2] * 0.31622776601683794 - ]), spherical([ - b[0] * 0.9486832980505138 + a[0] * 0.31622776601683794, - b[1] * 0.9486832980505138 + a[1] * 0.31622776601683794, - b[2] * 0.9486832980505138 + a[2] * 0.31622776601683794 - ])); - a = b; - } - return hexagon; - }); - - var cornerNormals = []; - - var parents = [-1, 0, 0, 1, 0, 1, 4, 5]; - - w5.forEach(function(hexagon, j) { - var face = octahedron[j], - n = face.length, - normals = cornerNormals[j] = []; - for (var i = 0; i < n; ++i) { - w5.push([ - face[i], - hexagon[(i * 2 + 2) % (2 * n)], - hexagon[(i * 2 + 1) % (2 * n)] - ]); - parents.push(j); - normals.push(cross( - cartesian(hexagon[(i * 2 + 2) % (2 * n)]), - cartesian(hexagon[(i * 2 + 1) % (2 * n)]) - )); - } - }); - - var faces = w5.map(function(face) { - return { - project: faceProjection(face), - face: face - }; - }); - - parents.forEach(function(d, i) { - var parent = faces[d]; - parent && (parent.children || (parent.children = [])).push(faces[i]); - }); - - function face(lambda, phi) { - var cosphi = cos(phi), - p = [cosphi * cos(lambda), cosphi * sin(lambda), sin(phi)]; - - var hexagon = lambda < -pi / 2 ? phi < 0 ? 6 : 4 - : lambda < 0 ? phi < 0 ? 2 : 0 - : lambda < pi / 2 ? phi < 0 ? 3 : 1 - : phi < 0 ? 7 : 5; - - var n = cornerNormals[hexagon]; - - return faces[dot(n[0], p) < 0 ? 8 + 3 * hexagon - : dot(n[1], p) < 0 ? 8 + 3 * hexagon + 1 - : dot(n[2], p) < 0 ? 8 + 3 * hexagon + 2 - : hexagon]; - } - - return polyhedral(faces[0], face) - .angle(-30) - .scale(110.625) - .center([0,45]); -} - -function dot(a, b) { - for (var i = 0, n = a.length, s = 0; i < n; ++i) s += a[i] * b[i]; - return s; -} - -function cross(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] - ]; -} - -// Converts 3D Cartesian to spherical coordinates (degrees). -function spherical(cartesian) { - return [ - atan2(cartesian[1], cartesian[0]) * degrees, - asin(max(-1, min(1, cartesian[2]))) * degrees - ]; -} - -// Converts spherical coordinates (degrees) to 3D Cartesian. -function cartesian(coordinates) { - var lambda = coordinates[0] * radians, - phi = coordinates[1] * radians, - cosphi = cos(phi); - return [ - cosphi * cos(lambda), - cosphi * sin(lambda), - sin(phi) - ]; -} diff --git a/node_modules/d3-geo-projection/src/project/clockwise.js b/node_modules/d3-geo-projection/src/project/clockwise.js deleted file mode 100644 index 71cea48..0000000 --- a/node_modules/d3-geo-projection/src/project/clockwise.js +++ /dev/null @@ -1,8 +0,0 @@ -export default function(ring) { - if ((n = ring.length) < 4) return false; - var i = 0, - n, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area <= 0; -} diff --git a/node_modules/d3-geo-projection/src/project/contains.js b/node_modules/d3-geo-projection/src/project/contains.js deleted file mode 100644 index 5ebdfc0..0000000 --- a/node_modules/d3-geo-projection/src/project/contains.js +++ /dev/null @@ -1,11 +0,0 @@ -export default function(ring, point) { - var x = point[0], - y = point[1], - contains = false; - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], xi = pi[0], yi = pi[1], - pj = ring[j], xj = pj[0], yj = pj[1]; - if (((yi > y) ^ (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi)) contains = !contains; - } - return contains; -} diff --git a/node_modules/d3-geo-projection/src/project/index.js b/node_modules/d3-geo-projection/src/project/index.js deleted file mode 100644 index 347d3ba..0000000 --- a/node_modules/d3-geo-projection/src/project/index.js +++ /dev/null @@ -1,136 +0,0 @@ -import {geoStream} from "d3-geo"; -import noop from "../noop.js"; -import clockwise from "./clockwise.js"; -import contains from "./contains.js"; - -export default function(object, projection) { - var stream = projection.stream, project; - if (!stream) throw new Error("invalid projection"); - switch (object && object.type) { - case "Feature": project = projectFeature; break; - case "FeatureCollection": project = projectFeatureCollection; break; - default: project = projectGeometry; break; - } - return project(object, stream); -} - -function projectFeatureCollection(o, stream) { - return { - type: "FeatureCollection", - features: o.features.map(function(f) { - return projectFeature(f, stream); - }) - }; -} - -function projectFeature(o, stream) { - return { - type: "Feature", - id: o.id, - properties: o.properties, - geometry: projectGeometry(o.geometry, stream) - }; -} - -function projectGeometryCollection(o, stream) { - return { - type: "GeometryCollection", - geometries: o.geometries.map(function(o) { - return projectGeometry(o, stream); - }) - }; -} - -function projectGeometry(o, stream) { - if (!o) return null; - if (o.type === "GeometryCollection") return projectGeometryCollection(o, stream); - var sink; - switch (o.type) { - case "Point": sink = sinkPoint; break; - case "MultiPoint": sink = sinkPoint; break; - case "LineString": sink = sinkLine; break; - case "MultiLineString": sink = sinkLine; break; - case "Polygon": sink = sinkPolygon; break; - case "MultiPolygon": sink = sinkPolygon; break; - case "Sphere": sink = sinkPolygon; break; - default: return null; - } - geoStream(o, stream(sink)); - return sink.result(); -} - -var points = [], - lines = []; - -var sinkPoint = { - point: function(x, y) { - points.push([x, y]); - }, - result: function() { - var result = !points.length ? null - : points.length < 2 ? {type: "Point", coordinates: points[0]} - : {type: "MultiPoint", coordinates: points}; - points = []; - return result; - } -}; - -var sinkLine = { - lineStart: noop, - point: function(x, y) { - points.push([x, y]); - }, - lineEnd: function() { - if (points.length) lines.push(points), points = []; - }, - result: function() { - var result = !lines.length ? null - : lines.length < 2 ? {type: "LineString", coordinates: lines[0]} - : {type: "MultiLineString", coordinates: lines}; - lines = []; - return result; - } -}; - -var sinkPolygon = { - polygonStart: noop, - lineStart: noop, - point: function(x, y) { - points.push([x, y]); - }, - lineEnd: function() { - var n = points.length; - if (n) { - do points.push(points[0].slice()); while (++n < 4); - lines.push(points), points = []; - } - }, - polygonEnd: noop, - result: function() { - if (!lines.length) return null; - var polygons = [], - holes = []; - - // https://github.com/d3/d3/issues/1558 - lines.forEach(function(ring) { - if (clockwise(ring)) polygons.push([ring]); - else holes.push(ring); - }); - - holes.forEach(function(hole) { - var point = hole[0]; - polygons.some(function(polygon) { - if (contains(polygon[0], point)) { - polygon.push(hole); - return true; - } - }) || polygons.push([hole]); - }); - - lines = []; - - return !polygons.length ? null - : polygons.length > 1 ? {type: "MultiPolygon", coordinates: polygons} - : {type: "Polygon", coordinates: polygons[0]}; - } -}; diff --git a/node_modules/d3-geo-projection/src/quantize.js b/node_modules/d3-geo-projection/src/quantize.js deleted file mode 100644 index ed78788..0000000 --- a/node_modules/d3-geo-projection/src/quantize.js +++ /dev/null @@ -1,70 +0,0 @@ -export default function(input, digits) { - if (!(0 <= (digits = +digits) && digits <= 20)) throw new Error("invalid digits"); - - function quantizePoint(input) { - var n = input.length, i = 2, output = new Array(n); - output[0] = +input[0].toFixed(digits); - output[1] = +input[1].toFixed(digits); - while (i < n) output[i] = input[i], ++i; - return output; - } - - function quantizePoints(input) { - return input.map(quantizePoint); - } - - function quantizePointsNoDuplicates(input) { - var point0 = quantizePoint(input[0]); - var output = [point0]; - for (var i = 1; i < input.length; i++) { - var point = quantizePoint(input[i]); - if (point.length > 2 || point[0] != point0[0] || point[1] != point0[1]) { - output.push(point); - point0 = point; - } - } - if (output.length === 1 && input.length > 1) { - output.push(quantizePoint(input[input.length - 1])); - } - return output; - } - - function quantizePolygon(input) { - return input.map(quantizePointsNoDuplicates); - } - - function quantizeGeometry(input) { - if (input == null) return input; - var output; - switch (input.type) { - case "GeometryCollection": output = {type: "GeometryCollection", geometries: input.geometries.map(quantizeGeometry)}; break; - case "Point": output = {type: "Point", coordinates: quantizePoint(input.coordinates)}; break; - case "MultiPoint": output = {type: input.type, coordinates: quantizePoints(input.coordinates)}; break; - case "LineString": output = {type: input.type, coordinates: quantizePointsNoDuplicates(input.coordinates)}; break; - case "MultiLineString": case "Polygon": output = {type: input.type, coordinates: quantizePolygon(input.coordinates)}; break; - case "MultiPolygon": output = {type: "MultiPolygon", coordinates: input.coordinates.map(quantizePolygon)}; break; - default: return input; - } - if (input.bbox != null) output.bbox = input.bbox; - return output; - } - - function quantizeFeature(input) { - var output = {type: "Feature", properties: input.properties, geometry: quantizeGeometry(input.geometry)}; - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - return output; - } - - if (input != null) switch (input.type) { - case "Feature": return quantizeFeature(input); - case "FeatureCollection": { - var output = {type: "FeatureCollection", features: input.features.map(quantizeFeature)}; - if (input.bbox != null) output.bbox = input.bbox; - return output; - } - default: return quantizeGeometry(input); - } - - return input; -} diff --git a/node_modules/d3-geo-projection/src/quincuncial/gringorten.js b/node_modules/d3-geo-projection/src/quincuncial/gringorten.js deleted file mode 100644 index 0abb1f6..0000000 --- a/node_modules/d3-geo-projection/src/quincuncial/gringorten.js +++ /dev/null @@ -1,7 +0,0 @@ -import {gringortenRaw} from "../gringorten.js"; -import quincuncial from "./index.js"; - -export default function() { - return quincuncial(gringortenRaw) - .scale(176.423); -} diff --git a/node_modules/d3-geo-projection/src/quincuncial/index.js b/node_modules/d3-geo-projection/src/quincuncial/index.js deleted file mode 100644 index 5b4a374..0000000 --- a/node_modules/d3-geo-projection/src/quincuncial/index.js +++ /dev/null @@ -1,40 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, halfPi, pi, sign, sqrt1_2} from "../math.js"; - -export default function(project) { - var dx = project(halfPi, 0)[0] - project(-halfPi, 0)[0]; - - function projectQuincuncial(lambda, phi) { - var t = abs(lambda) < halfPi, - p = project(t ? lambda : lambda > 0 ? lambda - pi : lambda + pi, phi), - x = (p[0] - p[1]) * sqrt1_2, - y = (p[0] + p[1]) * sqrt1_2; - if (t) return [x, y]; - var d = dx * sqrt1_2, - s = x > 0 ^ y > 0 ? -1 : 1; - return [s * x - sign(y) * d, s * y - sign(x) * d]; - } - - if (project.invert) projectQuincuncial.invert = function(x0, y0) { - var x = (x0 + y0) * sqrt1_2, - y = (y0 - x0) * sqrt1_2, - t = abs(x) < 0.5 * dx && abs(y) < 0.5 * dx; - - if (!t) { - var d = dx * sqrt1_2, - s = x > 0 ^ y > 0 ? -1 : 1, - x1 = -s * x0 + (y > 0 ? 1 : -1) * d, - y1 = -s * y0 + (x > 0 ? 1 : -1) * d; - x = (-x1 - y1) * sqrt1_2; - y = (x1 - y1) * sqrt1_2; - } - - var p = project.invert(x, y); - if (!t) p[0] += x > 0 ? pi : -pi; - return p; - }; - - return projection(projectQuincuncial) - .rotate([-90, -90, 45]) - .clipAngle(180 - 1e-3); -} diff --git a/node_modules/d3-geo-projection/src/quincuncial/peirce.js b/node_modules/d3-geo-projection/src/quincuncial/peirce.js deleted file mode 100644 index 1addcb0..0000000 --- a/node_modules/d3-geo-projection/src/quincuncial/peirce.js +++ /dev/null @@ -1,7 +0,0 @@ -import {guyouRaw} from "../guyou.js"; -import quincuncial from "./index.js"; - -export default function() { - return quincuncial(guyouRaw) - .scale(111.48); -} diff --git a/node_modules/d3-geo-projection/src/rectangularPolyconic.js b/node_modules/d3-geo-projection/src/rectangularPolyconic.js deleted file mode 100644 index a1c67ca..0000000 --- a/node_modules/d3-geo-projection/src/rectangularPolyconic.js +++ /dev/null @@ -1,44 +0,0 @@ -import {abs, acos, asin, atan, cos, epsilon, pi, sin, tan} from "./math.js"; -import parallel1 from "./parallel1.js"; - -export function rectangularPolyconicRaw(phi0) { - var sinPhi0 = sin(phi0); - - function forward(lambda, phi) { - var A = sinPhi0 ? tan(lambda * sinPhi0 / 2) / sinPhi0 : lambda / 2; - if (!phi) return [2 * A, -phi0]; - var E = 2 * atan(A * sin(phi)), - cotPhi = 1 / tan(phi); - return [ - sin(E) * cotPhi, - phi + (1 - cos(E)) * cotPhi - phi0 - ]; - } - - // TODO return null for points outside outline. - forward.invert = function(x, y) { - if (abs(y += phi0) < epsilon) return [sinPhi0 ? 2 * atan(sinPhi0 * x / 2) / sinPhi0 : x, 0]; - var k = x * x + y * y, - phi = 0, - i = 10, delta; - do { - var tanPhi = tan(phi), - secPhi = 1 / cos(phi), - j = k - 2 * y * phi + phi * phi; - phi -= delta = (tanPhi * j + 2 * (phi - y)) / (2 + j * secPhi * secPhi + 2 * (phi - y) * tanPhi); - } while (abs(delta) > epsilon && --i > 0); - var E = x * (tanPhi = tan(phi)), - A = tan(abs(y) < abs(phi + 1 / tanPhi) ? asin(E) * 0.5 : acos(E) * 0.5 + pi / 4) / sin(phi); - return [ - sinPhi0 ? 2 * atan(sinPhi0 * A) / sinPhi0 : 2 * A, - phi - ]; - }; - - return forward; -} - -export default function() { - return parallel1(rectangularPolyconicRaw) - .scale(131.215); -} diff --git a/node_modules/d3-geo-projection/src/robinson.js b/node_modules/d3-geo-projection/src/robinson.js deleted file mode 100644 index 965a403..0000000 --- a/node_modules/d3-geo-projection/src/robinson.js +++ /dev/null @@ -1,89 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, degrees, epsilon2, floor, halfPi, max, min, pi, radians} from "./math.js"; - -var K = [ - [0.9986, -0.062], - [1.0000, 0.0000], - [0.9986, 0.0620], - [0.9954, 0.1240], - [0.9900, 0.1860], - [0.9822, 0.2480], - [0.9730, 0.3100], - [0.9600, 0.3720], - [0.9427, 0.4340], - [0.9216, 0.4958], - [0.8962, 0.5571], - [0.8679, 0.6176], - [0.8350, 0.6769], - [0.7986, 0.7346], - [0.7597, 0.7903], - [0.7186, 0.8435], - [0.6732, 0.8936], - [0.6213, 0.9394], - [0.5722, 0.9761], - [0.5322, 1.0000] -]; - -K.forEach(function(d) { - d[1] *= 1.0144; -}); - -export function robinsonRaw(lambda, phi) { - var i = min(18, abs(phi) * 36 / pi), - i0 = floor(i), - di = i - i0, - ax = (k = K[i0])[0], - ay = k[1], - bx = (k = K[++i0])[0], - by = k[1], - cx = (k = K[min(19, ++i0)])[0], - cy = k[1], - k; - return [ - lambda * (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2), - (phi > 0 ? halfPi : -halfPi) * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2) - ]; -} - -robinsonRaw.invert = function(x, y) { - var yy = y / halfPi, - phi = yy * 90, - i = min(18, abs(phi / 5)), - i0 = max(0, floor(i)); - do { - var ay = K[i0][1], - by = K[i0 + 1][1], - cy = K[min(19, i0 + 2)][1], - u = cy - ay, - v = cy - 2 * by + ay, - t = 2 * (abs(yy) - by) / u, - c = v / u, - di = t * (1 - c * t * (1 - 2 * c * t)); - if (di >= 0 || i0 === 1) { - phi = (y >= 0 ? 5 : -5) * (di + i); - var j = 50, delta; - do { - i = min(18, abs(phi) / 5); - i0 = floor(i); - di = i - i0; - ay = K[i0][1]; - by = K[i0 + 1][1]; - cy = K[min(19, i0 + 2)][1]; - phi -= (delta = (y >= 0 ? halfPi : -halfPi) * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2) - y) * degrees; - } while (abs(delta) > epsilon2 && --j > 0); - break; - } - } while (--i0 >= 0); - var ax = K[i0][0], - bx = K[i0 + 1][0], - cx = K[min(19, i0 + 2)][0]; - return [ - x / (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2), - phi * radians - ]; -}; - -export default function() { - return projection(robinsonRaw) - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/satellite.js b/node_modules/d3-geo-projection/src/satellite.js deleted file mode 100644 index d184386..0000000 --- a/node_modules/d3-geo-projection/src/satellite.js +++ /dev/null @@ -1,71 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {acos, asin, atan2, cos, degrees, radians, sin, sqrt} from "./math.js"; - -function satelliteVerticalRaw(P) { - function forward(lambda, phi) { - var cosPhi = cos(phi), - k = (P - 1) / (P - cosPhi * cos(lambda)); - return [ - k * cosPhi * sin(lambda), - k * sin(phi) - ]; - } - - forward.invert = function(x, y) { - var rho2 = x * x + y * y, - rho = sqrt(rho2), - sinc = (P - sqrt(1 - rho2 * (P + 1) / (P - 1))) / ((P - 1) / rho + rho / (P - 1)); - return [ - atan2(x * sinc, rho * sqrt(1 - sinc * sinc)), - rho ? asin(y * sinc / rho) : 0 - ]; - }; - - return forward; -} - -export function satelliteRaw(P, omega) { - var vertical = satelliteVerticalRaw(P); - if (!omega) return vertical; - var cosOmega = cos(omega), - sinOmega = sin(omega); - - function forward(lambda, phi) { - var coordinates = vertical(lambda, phi), - y = coordinates[1], - A = y * sinOmega / (P - 1) + cosOmega; - return [ - coordinates[0] * cosOmega / A, - y / A - ]; - } - - forward.invert = function(x, y) { - var k = (P - 1) / (P - 1 - y * sinOmega); - return vertical.invert(k * x, k * y * cosOmega); - }; - - return forward; -} - -export default function() { - var distance = 2, - omega = 0, - m = projectionMutator(satelliteRaw), - p = m(distance, omega); - - // As a multiple of radius. - p.distance = function(_) { - if (!arguments.length) return distance; - return m(distance = +_, omega); - }; - - p.tilt = function(_) { - if (!arguments.length) return omega * degrees; - return m(distance, omega = _ * radians); - }; - - return p - .scale(432.147) - .clipAngle(acos(1 / distance) * degrees - 1e-6); -} diff --git a/node_modules/d3-geo-projection/src/sinuMollweide.js b/node_modules/d3-geo-projection/src/sinuMollweide.js deleted file mode 100644 index 091c5ca..0000000 --- a/node_modules/d3-geo-projection/src/sinuMollweide.js +++ /dev/null @@ -1,26 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {mollweideRaw} from "./mollweide.js"; -import {sinusoidalRaw} from "./sinusoidal.js"; - -export var sinuMollweidePhi = 0.7109889596207567; - -export var sinuMollweideY = 0.0528035274542; - -export function sinuMollweideRaw(lambda, phi) { - return phi > -sinuMollweidePhi - ? (lambda = mollweideRaw(lambda, phi), lambda[1] += sinuMollweideY, lambda) - : sinusoidalRaw(lambda, phi); -} - -sinuMollweideRaw.invert = function(x, y) { - return y > -sinuMollweidePhi - ? mollweideRaw.invert(x, y - sinuMollweideY) - : sinusoidalRaw.invert(x, y); -}; - -export default function() { - return projection(sinuMollweideRaw) - .rotate([-20, -55]) - .scale(164.263) - .center([0, -5.4036]); -} diff --git a/node_modules/d3-geo-projection/src/sinusoidal.js b/node_modules/d3-geo-projection/src/sinusoidal.js deleted file mode 100644 index 92ca7fa..0000000 --- a/node_modules/d3-geo-projection/src/sinusoidal.js +++ /dev/null @@ -1,15 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {cos} from "./math.js"; - -export function sinusoidalRaw(lambda, phi) { - return [lambda * cos(phi), phi]; -} - -sinusoidalRaw.invert = function(x, y) { - return [x / cos(y), y]; -}; - -export default function() { - return projection(sinusoidalRaw) - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/square.js b/node_modules/d3-geo-projection/src/square.js deleted file mode 100644 index b5645be..0000000 --- a/node_modules/d3-geo-projection/src/square.js +++ /dev/null @@ -1,24 +0,0 @@ -import {halfPi, pi} from "./math.js"; - -export default function(project) { - var dx = project(halfPi, 0)[0] - project(-halfPi, 0)[0]; - - function projectSquare(lambda, phi) { - var s = lambda > 0 ? -0.5 : 0.5, - point = project(lambda + s * pi, phi); - point[0] -= s * dx; - return point; - } - - if (project.invert) projectSquare.invert = function(x, y) { - var s = x > 0 ? -0.5 : 0.5, - location = project.invert(x + s * dx, y), - lambda = location[0] - s * pi; - if (lambda < -pi) lambda += 2 * pi; - else if (lambda > pi) lambda -= 2 * pi; - location[0] = lambda; - return location; - }; - - return projectSquare; -} diff --git a/node_modules/d3-geo-projection/src/stitch.js b/node_modules/d3-geo-projection/src/stitch.js deleted file mode 100644 index 64a7c4d..0000000 --- a/node_modules/d3-geo-projection/src/stitch.js +++ /dev/null @@ -1,215 +0,0 @@ -var epsilon = 1e-4, - epsilonInverse = 1e4, - x0 = -180, x0e = x0 + epsilon, - x1 = 180, x1e = x1 - epsilon, - y0 = -90, y0e = y0 + epsilon, - y1 = 90, y1e = y1 - epsilon; - -function nonempty(coordinates) { - return coordinates.length > 0; -} - -function quantize(x) { - return Math.floor(x * epsilonInverse) / epsilonInverse; -} - -function normalizePoint(y) { - return y === y0 || y === y1 ? [0, y] : [x0, quantize(y)]; // pole or antimeridian? -} - -function clampPoint(p) { - var x = p[0], y = p[1], clamped = false; - if (x <= x0e) x = x0, clamped = true; - else if (x >= x1e) x = x1, clamped = true; - if (y <= y0e) y = y0, clamped = true; - else if (y >= y1e) y = y1, clamped = true; - return clamped ? [x, y] : p; -} - -function clampPoints(points) { - return points.map(clampPoint); -} - -// For each ring, detect where it crosses the antimeridian or pole. -function extractFragments(rings, polygon, fragments) { - for (var j = 0, m = rings.length; j < m; ++j) { - var ring = rings[j].slice(); - - // By default, assume that this ring doesn’t need any stitching. - fragments.push({index: -1, polygon: polygon, ring: ring}); - - for (var i = 0, n = ring.length; i < n; ++i) { - var point = ring[i], - x = point[0], - y = point[1]; - - // If this is an antimeridian or polar point… - if (x <= x0e || x >= x1e || y <= y0e || y >= y1e) { - ring[i] = clampPoint(point); - - // Advance through any antimeridian or polar points… - for (var k = i + 1; k < n; ++k) { - var pointk = ring[k], - xk = pointk[0], - yk = pointk[1]; - if (xk > x0e && xk < x1e && yk > y0e && yk < y1e) break; - } - - // If this was just a single antimeridian or polar point, - // we don’t need to cut this ring into a fragment; - // we can just leave it as-is. - if (k === i + 1) continue; - - // Otherwise, if this is not the first point in the ring, - // cut the current fragment so that it ends at the current point. - // The current point is also normalized for later joining. - if (i) { - var fragmentBefore = {index: -1, polygon: polygon, ring: ring.slice(0, i + 1)}; - fragmentBefore.ring[fragmentBefore.ring.length - 1] = normalizePoint(y); - fragments[fragments.length - 1] = fragmentBefore; - } - - // If the ring started with an antimeridian fragment, - // we can ignore that fragment entirely. - else fragments.pop(); - - // If the remainder of the ring is an antimeridian fragment, - // move on to the next ring. - if (k >= n) break; - - // Otherwise, add the remaining ring fragment and continue. - fragments.push({index: -1, polygon: polygon, ring: ring = ring.slice(k - 1)}); - ring[0] = normalizePoint(ring[0][1]); - i = -1; - n = ring.length; - } - } - } -} - -// Now stitch the fragments back together into rings. -function stitchFragments(fragments) { - var i, n = fragments.length; - - // To connect the fragments start-to-end, create a simple index by end. - var fragmentByStart = {}, - fragmentByEnd = {}, - fragment, - start, - startFragment, - end, - endFragment; - - // For each fragment… - for (i = 0; i < n; ++i) { - fragment = fragments[i]; - start = fragment.ring[0]; - end = fragment.ring[fragment.ring.length - 1]; - - // If this fragment is closed, add it as a standalone ring. - if (start[0] === end[0] && start[1] === end[1]) { - fragment.polygon.push(fragment.ring); - fragments[i] = null; - continue; - } - - fragment.index = i; - fragmentByStart[start] = fragmentByEnd[end] = fragment; - } - - // For each open fragment… - for (i = 0; i < n; ++i) { - fragment = fragments[i]; - if (fragment) { - start = fragment.ring[0]; - end = fragment.ring[fragment.ring.length - 1]; - startFragment = fragmentByEnd[start]; - endFragment = fragmentByStart[end]; - - delete fragmentByStart[start]; - delete fragmentByEnd[end]; - - // If this fragment is closed, add it as a standalone ring. - if (start[0] === end[0] && start[1] === end[1]) { - fragment.polygon.push(fragment.ring); - continue; - } - - if (startFragment) { - delete fragmentByEnd[start]; - delete fragmentByStart[startFragment.ring[0]]; - startFragment.ring.pop(); // drop the shared coordinate - fragments[startFragment.index] = null; - fragment = {index: -1, polygon: startFragment.polygon, ring: startFragment.ring.concat(fragment.ring)}; - - if (startFragment === endFragment) { - // Connect both ends to this single fragment to create a ring. - fragment.polygon.push(fragment.ring); - } else { - fragment.index = n++; - fragments.push(fragmentByStart[fragment.ring[0]] = fragmentByEnd[fragment.ring[fragment.ring.length - 1]] = fragment); - } - } else if (endFragment) { - delete fragmentByStart[end]; - delete fragmentByEnd[endFragment.ring[endFragment.ring.length - 1]]; - fragment.ring.pop(); // drop the shared coordinate - fragment = {index: n++, polygon: endFragment.polygon, ring: fragment.ring.concat(endFragment.ring)}; - fragments[endFragment.index] = null; - fragments.push(fragmentByStart[fragment.ring[0]] = fragmentByEnd[fragment.ring[fragment.ring.length - 1]] = fragment); - } else { - fragment.ring.push(fragment.ring[0]); // close ring - fragment.polygon.push(fragment.ring); - } - } - } -} - -function stitchFeature(input) { - var output = {type: "Feature", geometry: stitchGeometry(input.geometry)}; - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - if (input.properties != null) output.properties = input.properties; - return output; -} - -function stitchGeometry(input) { - if (input == null) return input; - var output, fragments, i, n; - switch (input.type) { - case "GeometryCollection": output = {type: "GeometryCollection", geometries: input.geometries.map(stitchGeometry)}; break; - case "Point": output = {type: "Point", coordinates: clampPoint(input.coordinates)}; break; - case "MultiPoint": case "LineString": output = {type: input.type, coordinates: clampPoints(input.coordinates)}; break; - case "MultiLineString": output = {type: "MultiLineString", coordinates: input.coordinates.map(clampPoints)}; break; - case "Polygon": { - var polygon = []; - extractFragments(input.coordinates, polygon, fragments = []); - stitchFragments(fragments); - output = {type: "Polygon", coordinates: polygon}; - break; - } - case "MultiPolygon": { - fragments = [], i = -1, n = input.coordinates.length; - var polygons = new Array(n); - while (++i < n) extractFragments(input.coordinates[i], polygons[i] = [], fragments); - stitchFragments(fragments); - output = {type: "MultiPolygon", coordinates: polygons.filter(nonempty)}; - break; - } - default: return input; - } - if (input.bbox != null) output.bbox = input.bbox; - return output; -} - -export default function(input) { - if (input == null) return input; - switch (input.type) { - case "Feature": return stitchFeature(input); - case "FeatureCollection": { - var output = {type: "FeatureCollection", features: input.features.map(stitchFeature)}; - if (input.bbox != null) output.bbox = input.bbox; - return output; - } - default: return stitchGeometry(input); - } -} diff --git a/node_modules/d3-geo-projection/src/times.js b/node_modules/d3-geo-projection/src/times.js deleted file mode 100644 index fbf45a9..0000000 --- a/node_modules/d3-geo-projection/src/times.js +++ /dev/null @@ -1,25 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {atan, quarterPi, sin, tan} from "./math.js"; - -export function timesRaw(lambda, phi) { - var t = tan(phi / 2), - s = sin(quarterPi * t); - return [ - lambda * (0.74482 - 0.34588 * s * s), - 1.70711 * t - ]; -} - -timesRaw.invert = function(x, y) { - var t = y / 1.70711, - s = sin(quarterPi * t); - return [ - x / (0.74482 - 0.34588 * s * s), - 2 * atan(t) - ]; -}; - -export default function() { - return projection(timesRaw) - .scale(146.153); -} diff --git a/node_modules/d3-geo-projection/src/twoPoint.js b/node_modules/d3-geo-projection/src/twoPoint.js deleted file mode 100644 index c3b0dc5..0000000 --- a/node_modules/d3-geo-projection/src/twoPoint.js +++ /dev/null @@ -1,26 +0,0 @@ -import {geoInterpolate as interpolate, geoProjection as projection, geoRotation as rotation} from "d3-geo"; -import {asin, degrees, pi, sin, radians} from "./math.js"; - -// Compute the origin as the midpoint of the two reference points. -// Rotate one of the reference points by the origin. -// Apply the spherical law of sines to compute gamma rotation. -export default function(raw, p0, p1) { - var i = interpolate(p0, p1), - o = i(0.5), - a = rotation([-o[0], -o[1]])(p0), - b = i.distance / 2, - y = -asin(sin(a[1] * radians) / sin(b)), - R = [-o[0], -o[1], -(a[0] > 0 ? pi - y : y) * degrees], - p = projection(raw(b)).rotate(R), - r = rotation(R), - center = p.center; - - delete p.rotate; - - p.center = function(_) { - return arguments.length ? center(r(_)) : r.invert(center()); - }; - - return p - .clipAngle(90); -} diff --git a/node_modules/d3-geo-projection/src/twoPointAzimuthal.js b/node_modules/d3-geo-projection/src/twoPointAzimuthal.js deleted file mode 100644 index 5b5123b..0000000 --- a/node_modules/d3-geo-projection/src/twoPointAzimuthal.js +++ /dev/null @@ -1,29 +0,0 @@ -import {geoGnomonicRaw as gnomonicRaw} from "d3-geo"; -import {cos} from "./math.js"; -import twoPoint from "./twoPoint.js"; - -export function twoPointAzimuthalRaw(d) { - var cosd = cos(d); - - function forward(lambda, phi) { - var coordinates = gnomonicRaw(lambda, phi); - coordinates[0] *= cosd; - return coordinates; - } - - forward.invert = function(x, y) { - return gnomonicRaw.invert(x / cosd, y); - }; - - return forward; -} - -export function twoPointAzimuthalUsa() { - return twoPointAzimuthal([-158, 21.5], [-77, 39]) - .clipAngle(60) - .scale(400); -} - -export default function twoPointAzimuthal(p0, p1) { - return twoPoint(twoPointAzimuthalRaw, p0, p1); -} diff --git a/node_modules/d3-geo-projection/src/twoPointEquidistant.js b/node_modules/d3-geo-projection/src/twoPointEquidistant.js deleted file mode 100644 index 99c96be..0000000 --- a/node_modules/d3-geo-projection/src/twoPointEquidistant.js +++ /dev/null @@ -1,48 +0,0 @@ -import {geoAzimuthalEquidistantRaw as azimuthalEquidistantRaw} from "d3-geo"; -import {acos, atan2, cos, sin, sqrt, tan} from "./math.js"; -import twoPoint from "./twoPoint.js"; - -// TODO clip to ellipse -export function twoPointEquidistantRaw(z0) { - if (!(z0 *= 2)) return azimuthalEquidistantRaw; - var lambdaa = -z0 / 2, - lambdab = -lambdaa, - z02 = z0 * z0, - tanLambda0 = tan(lambdab), - S = 0.5 / sin(lambdab); - - function forward(lambda, phi) { - var za = acos(cos(phi) * cos(lambda - lambdaa)), - zb = acos(cos(phi) * cos(lambda - lambdab)), - ys = phi < 0 ? -1 : 1; - za *= za, zb *= zb; - return [ - (za - zb) / (2 * z0), - ys * sqrt(4 * z02 * zb - (z02 - za + zb) * (z02 - za + zb)) / (2 * z0) - ]; - } - - forward.invert = function(x, y) { - var y2 = y * y, - cosza = cos(sqrt(y2 + (t = x + lambdaa) * t)), - coszb = cos(sqrt(y2 + (t = x + lambdab) * t)), - t, - d; - return [ - atan2(d = cosza - coszb, t = (cosza + coszb) * tanLambda0), - (y < 0 ? -1 : 1) * acos(sqrt(t * t + d * d) * S) - ]; - }; - - return forward; -} - -export function twoPointEquidistantUsa() { - return twoPointEquidistant([-158, 21.5], [-77, 39]) - .clipAngle(130) - .scale(122.571); -} - -export default function twoPointEquidistant(p0, p1) { - return twoPoint(twoPointEquidistantRaw, p0, p1); -} diff --git a/node_modules/d3-geo-projection/src/vanDerGrinten.js b/node_modules/d3-geo-projection/src/vanDerGrinten.js deleted file mode 100644 index caa9a32..0000000 --- a/node_modules/d3-geo-projection/src/vanDerGrinten.js +++ /dev/null @@ -1,47 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, acos, asin, atan, cos, epsilon, halfPi, pi, sign, sin, sqrt, tan} from "./math.js"; - -export function vanDerGrintenRaw(lambda, phi) { - if (abs(phi) < epsilon) return [lambda, 0]; - var sinTheta = abs(phi / halfPi), - theta = asin(sinTheta); - if (abs(lambda) < epsilon || abs(abs(phi) - halfPi) < epsilon) return [0, sign(phi) * pi * tan(theta / 2)]; - var cosTheta = cos(theta), - A = abs(pi / lambda - lambda / pi) / 2, - A2 = A * A, - G = cosTheta / (sinTheta + cosTheta - 1), - P = G * (2 / sinTheta - 1), - P2 = P * P, - P2_A2 = P2 + A2, - G_P2 = G - P2, - Q = A2 + G; - return [ - sign(lambda) * pi * (A * G_P2 + sqrt(A2 * G_P2 * G_P2 - P2_A2 * (G * G - P2))) / P2_A2, - sign(phi) * pi * (P * Q - A * sqrt((A2 + 1) * P2_A2 - Q * Q)) / P2_A2 - ]; -} - -vanDerGrintenRaw.invert = function(x, y) { - if (abs(y) < epsilon) return [x, 0]; - if (abs(x) < epsilon) return [0, halfPi * sin(2 * atan(y / pi))]; - var x2 = (x /= pi) * x, - y2 = (y /= pi) * y, - x2_y2 = x2 + y2, - z = x2_y2 * x2_y2, - c1 = -abs(y) * (1 + x2_y2), - c2 = c1 - 2 * y2 + x2, - c3 = -2 * c1 + 1 + 2 * y2 + z, - d = y2 / c3 + (2 * c2 * c2 * c2 / (c3 * c3 * c3) - 9 * c1 * c2 / (c3 * c3)) / 27, - a1 = (c1 - c2 * c2 / (3 * c3)) / c3, - m1 = 2 * sqrt(-a1 / 3), - theta1 = acos(3 * d / (a1 * m1)) / 3; - return [ - pi * (x2_y2 - 1 + sqrt(1 + 2 * (x2 - y2) + z)) / (2 * x), - sign(y) * pi * (-m1 * cos(theta1 + pi / 3) - c2 / (3 * c3)) - ]; -}; - -export default function() { - return projection(vanDerGrintenRaw) - .scale(79.4183); -} diff --git a/node_modules/d3-geo-projection/src/vanDerGrinten2.js b/node_modules/d3-geo-projection/src/vanDerGrinten2.js deleted file mode 100644 index 5d5f668..0000000 --- a/node_modules/d3-geo-projection/src/vanDerGrinten2.js +++ /dev/null @@ -1,34 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, asin, atan, atan2, cos, halfPi, epsilon, pi, sign, sin, sqrt, tan} from "./math.js"; - -export function vanDerGrinten2Raw(lambda, phi) { - if (abs(phi) < epsilon) return [lambda, 0]; - var sinTheta = abs(phi / halfPi), - theta = asin(sinTheta); - if (abs(lambda) < epsilon || abs(abs(phi) - halfPi) < epsilon) return [0, sign(phi) * pi * tan(theta / 2)]; - var cosTheta = cos(theta), - A = abs(pi / lambda - lambda / pi) / 2, - A2 = A * A, - x1 = cosTheta * (sqrt(1 + A2) - A * cosTheta) / (1 + A2 * sinTheta * sinTheta); - return [ - sign(lambda) * pi * x1, - sign(phi) * pi * sqrt(1 - x1 * (2 * A + x1)) - ]; -} - -vanDerGrinten2Raw.invert = function(x, y) { - if (!x) return [0, halfPi * sin(2 * atan(y / pi))]; - var x1 = abs(x / pi), - A = (1 - x1 * x1 - (y /= pi) * y) / (2 * x1), - A2 = A * A, - B = sqrt(A2 + 1); - return [ - sign(x) * pi * (B - A), - sign(y) * halfPi * sin(2 * atan2(sqrt((1 - 2 * A * x1) * (A + B) - x1), sqrt(B + A + x1))) - ]; -}; - -export default function() { - return projection(vanDerGrinten2Raw) - .scale(79.4183); -} diff --git a/node_modules/d3-geo-projection/src/vanDerGrinten3.js b/node_modules/d3-geo-projection/src/vanDerGrinten3.js deleted file mode 100644 index 439d33b..0000000 --- a/node_modules/d3-geo-projection/src/vanDerGrinten3.js +++ /dev/null @@ -1,30 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, asin, atan, cos, epsilon, halfPi, pi, sign, sin, sqrt, tan} from "./math.js"; - -export function vanDerGrinten3Raw(lambda, phi) { - if (abs(phi) < epsilon) return [lambda, 0]; - var sinTheta = phi / halfPi, - theta = asin(sinTheta); - if (abs(lambda) < epsilon || abs(abs(phi) - halfPi) < epsilon) return [0, pi * tan(theta / 2)]; - var A = (pi / lambda - lambda / pi) / 2, - y1 = sinTheta / (1 + cos(theta)); - return [ - pi * (sign(lambda) * sqrt(A * A + 1 - y1 * y1) - A), - pi * y1 - ]; -} - -vanDerGrinten3Raw.invert = function(x, y) { - if (!y) return [x, 0]; - var y1 = y / pi, - A = (pi * pi * (1 - y1 * y1) - x * x) / (2 * pi * x); - return [ - x ? pi * (sign(x) * sqrt(A * A + 1) - A) : 0, - halfPi * sin(2 * atan(y1)) - ]; -}; - -export default function() { - return projection(vanDerGrinten3Raw) - .scale(79.4183); -} diff --git a/node_modules/d3-geo-projection/src/vanDerGrinten4.js b/node_modules/d3-geo-projection/src/vanDerGrinten4.js deleted file mode 100644 index 8eb14f2..0000000 --- a/node_modules/d3-geo-projection/src/vanDerGrinten4.js +++ /dev/null @@ -1,61 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {abs, epsilon, halfPi, pi, sign, sqrt} from "./math.js"; - -export function vanDerGrinten4Raw(lambda, phi) { - if (!phi) return [lambda, 0]; - var phi0 = abs(phi); - if (!lambda || phi0 === halfPi) return [0, phi]; - var B = phi0 / halfPi, - B2 = B * B, - C = (8 * B - B2 * (B2 + 2) - 5) / (2 * B2 * (B - 1)), - C2 = C * C, - BC = B * C, - B_C2 = B2 + C2 + 2 * BC, - B_3C = B + 3 * C, - lambda0 = lambda / halfPi, - lambda1 = lambda0 + 1 / lambda0, - D = sign(abs(lambda) - halfPi) * sqrt(lambda1 * lambda1 - 4), - D2 = D * D, - F = B_C2 * (B2 + C2 * D2 - 1) + (1 - B2) * (B2 * (B_3C * B_3C + 4 * C2) + 12 * BC * C2 + 4 * C2 * C2), - x1 = (D * (B_C2 + C2 - 1) + 2 * sqrt(F)) / (4 * B_C2 + D2); - return [ - sign(lambda) * halfPi * x1, - sign(phi) * halfPi * sqrt(1 + D * abs(x1) - x1 * x1) - ]; -} - -vanDerGrinten4Raw.invert = function(x, y) { - var delta; - if (!x || !y) return [x, y]; - y /= pi; - var x1 = sign(x) * x / halfPi, - D = (x1 * x1 - 1 + 4 * y * y) / abs(x1), - D2 = D * D, - B = 2 * y, - i = 50; - do { - var B2 = B * B, - C = (8 * B - B2 * (B2 + 2) - 5) / (2 * B2 * (B - 1)), - C_ = (3 * B - B2 * B - 10) / (2 * B2 * B), - C2 = C * C, - BC = B * C, - B_C = B + C, - B_C2 = B_C * B_C, - B_3C = B + 3 * C, - F = B_C2 * (B2 + C2 * D2 - 1) + (1 - B2) * (B2 * (B_3C * B_3C + 4 * C2) + C2 * (12 * BC + 4 * C2)), - F_ = -2 * B_C * (4 * BC * C2 + (1 - 4 * B2 + 3 * B2 * B2) * (1 + C_) + C2 * (-6 + 14 * B2 - D2 + (-8 + 8 * B2 - 2 * D2) * C_) + BC * (-8 + 12 * B2 + (-10 + 10 * B2 - D2) * C_)), - sqrtF = sqrt(F), - f = D * (B_C2 + C2 - 1) + 2 * sqrtF - x1 * (4 * B_C2 + D2), - f_ = D * (2 * C * C_ + 2 * B_C * (1 + C_)) + F_ / sqrtF - 8 * B_C * (D * (-1 + C2 + B_C2) + 2 * sqrtF) * (1 + C_) / (D2 + 4 * B_C2); - B -= delta = f / f_; - } while (delta > epsilon && --i > 0); - return [ - sign(x) * (sqrt(D * D + 4) + D) * pi / 4, - halfPi * B - ]; -}; - -export default function() { - return projection(vanDerGrinten4Raw) - .scale(127.16); -} diff --git a/node_modules/d3-geo-projection/src/wagner.js b/node_modules/d3-geo-projection/src/wagner.js deleted file mode 100644 index df8cc67..0000000 --- a/node_modules/d3-geo-projection/src/wagner.js +++ /dev/null @@ -1,98 +0,0 @@ -import {geoProjectionMutator as projectionMutator} from "d3-geo"; -import {acos, asin, atan2, cos, degrees, epsilon, halfPi, max, min, pi, radians, sin, sqrt, tan} from "./math.js"; - -function wagnerFormula(cx, cy, m1, m2, n) { - function forward(lambda, phi) { - var s = m1 * sin(m2 * phi), - c0 = sqrt(1 - s * s), - c1 = sqrt(2 / (1 + c0 * cos(lambda *= n))); - return [ - cx * c0 * c1 * sin(lambda), - cy * s * c1 - ]; - } - - forward.invert = function(x, y) { - var t1 = x / cx, - t2 = y / cy, - p = sqrt(t1 * t1 + t2 * t2), - c = 2 * asin(p / 2); - return [ - atan2(x * tan(c), cx * p) / n, - p && asin(y * sin(c) / (cy * m1 * p)) / m2 - ]; - }; - - return forward; -} - -export function wagnerRaw(poleline, parallels, inflation, ratio) { - // 60 is always used as reference parallel - var phi1 = pi / 3; - - // sanitizing the input values - // poleline and parallels may approximate but never equal 0 - poleline = max(poleline, epsilon); - parallels = max(parallels, epsilon); - // poleline must be <= 90; parallels may approximate but never equal 180 - poleline = min(poleline, halfPi); - parallels = min(parallels, pi - epsilon); - // 0 <= inflation <= 99.999 - inflation = max(inflation, 0); - inflation = min(inflation, 100 - epsilon); - // ratio > 0. - // sensible values, i.e. something that renders a map which still can be - // recognized as world map, are e.g. 20 <= ratio <= 1000. - ratio = max(ratio, epsilon); - - // convert values from boehm notation - // areal inflation e.g. from 0 to 1 or 20 to 1.2: - var vinflation = inflation/100 + 1; - // axial ratio e.g. from 200 to 2: - var vratio = ratio / 100; - // the other ones are a bit more complicated... - var m2 = acos(vinflation * cos(phi1)) / phi1, - m1 = sin(poleline) / sin(m2 * halfPi), - n = parallels / pi, - k = sqrt(vratio * sin(poleline / 2) / sin(parallels / 2)), - cx = k / sqrt(n * m1 * m2), - cy = 1 / (k * sqrt(n * m1 * m2)); - - return wagnerFormula(cx, cy, m1, m2, n); -} - -export default function wagner() { - // default values generate wagner8 - var poleline = 65 * radians, - parallels = 60 * radians, - inflation = 20, - ratio = 200, - mutate = projectionMutator(wagnerRaw), - projection = mutate(poleline, parallels, inflation, ratio); - - projection.poleline = function(_) { - return arguments.length ? mutate(poleline = +_ * radians, parallels, inflation, ratio) : poleline * degrees; - }; - - projection.parallels = function(_) { - return arguments.length ? mutate(poleline, parallels = +_ * radians, inflation, ratio) : parallels * degrees; - }; - projection.inflation = function(_) { - return arguments.length ? mutate(poleline, parallels, inflation = +_, ratio) : inflation; - }; - projection.ratio = function(_) { - return arguments.length ? mutate(poleline, parallels, inflation, ratio = +_) : ratio; - }; - - return projection - .scale(163.775); -} - -export function wagner7() { - return wagner() - .poleline(65) - .parallels(60) - .inflation(0) - .ratio(200) - .scale(172.633); -} diff --git a/node_modules/d3-geo-projection/src/wagner4.js b/node_modules/d3-geo-projection/src/wagner4.js deleted file mode 100644 index 798a194..0000000 --- a/node_modules/d3-geo-projection/src/wagner4.js +++ /dev/null @@ -1,13 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {sqrt, pi} from "./math.js"; -import {mollweideBromleyRaw} from "./mollweide.js"; - -var A = 4 * pi + 3 * sqrt(3), - B = 2 * sqrt(2 * pi * sqrt(3) / A); - -export var wagner4Raw = mollweideBromleyRaw(B * sqrt(3) / pi, B, A / 6); - -export default function() { - return projection(wagner4Raw) - .scale(176.84); -} diff --git a/node_modules/d3-geo-projection/src/wagner6.js b/node_modules/d3-geo-projection/src/wagner6.js deleted file mode 100644 index 2ae2755..0000000 --- a/node_modules/d3-geo-projection/src/wagner6.js +++ /dev/null @@ -1,15 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {pi, sqrt} from "./math.js"; - -export function wagner6Raw(lambda, phi) { - return [lambda * sqrt(1 - 3 * phi * phi / (pi * pi)), phi]; -} - -wagner6Raw.invert = function(x, y) { - return [x / sqrt(1 - 3 * y * y / (pi * pi)), y]; -}; - -export default function() { - return projection(wagner6Raw) - .scale(152.63); -} diff --git a/node_modules/d3-geo-projection/src/wagner7.js b/node_modules/d3-geo-projection/src/wagner7.js deleted file mode 100644 index a7366ee..0000000 --- a/node_modules/d3-geo-projection/src/wagner7.js +++ /dev/null @@ -1,28 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {asin, atan2, cos, sin, sqrt, tan} from "./math.js"; - -export function wagner7Raw(lambda, phi) { - var s = 0.90631 * sin(phi), - c0 = sqrt(1 - s * s), - c1 = sqrt(2 / (1 + c0 * cos(lambda /= 3))); - return [ - 2.66723 * c0 * c1 * sin(lambda), - 1.24104 * s * c1 - ]; -} - -wagner7Raw.invert = function(x, y) { - var t1 = x / 2.66723, - t2 = y / 1.24104, - p = sqrt(t1 * t1 + t2 * t2), - c = 2 * asin(p / 2); - return [ - 3 * atan2(x * tan(c), 2.66723 * p), - p && asin(y * sin(c) / (1.24104 * 0.90631 * p)) - ]; -}; - -export default function() { - return projection(wagner7Raw) - .scale(172.632); -} diff --git a/node_modules/d3-geo-projection/src/wiechel.js b/node_modules/d3-geo-projection/src/wiechel.js deleted file mode 100644 index bd3b430..0000000 --- a/node_modules/d3-geo-projection/src/wiechel.js +++ /dev/null @@ -1,34 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {asin, atan2, cos, sin, sqrt} from "./math.js"; - -export function wiechelRaw(lambda, phi) { - var cosPhi = cos(phi), - sinPhi = cos(lambda) * cosPhi, - sin1_Phi = 1 - sinPhi, - cosLambda = cos(lambda = atan2(sin(lambda) * cosPhi, -sin(phi))), - sinLambda = sin(lambda); - cosPhi = sqrt(1 - sinPhi * sinPhi); - return [ - sinLambda * cosPhi - cosLambda * sin1_Phi, - -cosLambda * cosPhi - sinLambda * sin1_Phi - ]; -} - -wiechelRaw.invert = function(x, y) { - var w = (x * x + y * y) / -2, - k = sqrt(-w * (2 + w)), - b = y * w + x * k, - a = x * w - y * k, - D = sqrt(a * a + b * b); - return [ - atan2(k * b, D * (1 + w)), - D ? -asin(k * a / D) : 0 - ]; -}; - -export default function() { - return projection(wiechelRaw) - .rotate([0, -90, 45]) - .scale(124.75) - .clipAngle(180 - 1e-3); -} diff --git a/node_modules/d3-geo-projection/src/winkel3.js b/node_modules/d3-geo-projection/src/winkel3.js deleted file mode 100644 index 437f153..0000000 --- a/node_modules/d3-geo-projection/src/winkel3.js +++ /dev/null @@ -1,45 +0,0 @@ -import {geoProjection as projection} from "d3-geo"; -import {aitoffRaw} from "./aitoff.js"; -import {halfPi, epsilon, sin, cos, sqrt, abs, acos} from "./math.js"; - -export function winkel3Raw(lambda, phi) { - var coordinates = aitoffRaw(lambda, phi); - return [ - (coordinates[0] + lambda / halfPi) / 2, - (coordinates[1] + phi) / 2 - ]; -} - -winkel3Raw.invert = function(x, y) { - var lambda = x, phi = y, i = 25; - do { - var cosphi = cos(phi), - sinphi = sin(phi), - sin_2phi = sin(2 * phi), - sin2phi = sinphi * sinphi, - cos2phi = cosphi * cosphi, - sinlambda = sin(lambda), - coslambda_2 = cos(lambda / 2), - sinlambda_2 = sin(lambda / 2), - sin2lambda_2 = sinlambda_2 * sinlambda_2, - C = 1 - cos2phi * coslambda_2 * coslambda_2, - E = C ? acos(cosphi * coslambda_2) * sqrt(F = 1 / C) : F = 0, - F, - fx = 0.5 * (2 * E * cosphi * sinlambda_2 + lambda / halfPi) - x, - fy = 0.5 * (E * sinphi + phi) - y, - dxdlambda = 0.5 * F * (cos2phi * sin2lambda_2 + E * cosphi * coslambda_2 * sin2phi) + 0.5 / halfPi, - dxdphi = F * (sinlambda * sin_2phi / 4 - E * sinphi * sinlambda_2), - dydlambda = 0.125 * F * (sin_2phi * sinlambda_2 - E * sinphi * cos2phi * sinlambda), - dydphi = 0.5 * F * (sin2phi * coslambda_2 + E * sin2lambda_2 * cosphi) + 0.5, - denominator = dxdphi * dydlambda - dydphi * dxdlambda, - dlambda = (fy * dxdphi - fx * dydphi) / denominator, - dphi = (fx * dydlambda - fy * dxdlambda) / denominator; - lambda -= dlambda, phi -= dphi; - } while ((abs(dlambda) > epsilon || abs(dphi) > epsilon) && --i > 0); - return [lambda, phi]; -}; - -export default function() { - return projection(winkel3Raw) - .scale(158.837); -} diff --git a/node_modules/d3-geo/LICENSE b/node_modules/d3-geo/LICENSE deleted file mode 100644 index f9488eb..0000000 --- a/node_modules/d3-geo/LICENSE +++ /dev/null @@ -1,48 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. - -This license applies to GeographicLib, versions 1.12 and later. - -Copyright (c) 2008-2012, Charles Karney - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/d3-geo/README.md b/node_modules/d3-geo/README.md deleted file mode 100644 index 0fca577..0000000 --- a/node_modules/d3-geo/README.md +++ /dev/null @@ -1,683 +0,0 @@ -# d3-geo - -Map projections are sometimes implemented as point transformations. For instance, spherical Mercator: - -```js -function mercator(x, y) { - return [x, Math.log(Math.tan(Math.PI / 4 + y / 2))]; -} -``` - -This is a reasonable *mathematical* approach if your geometry consists of continuous, infinite point sets. Yet computers do not have infinite memory, so we must instead work with discrete geometry such as polygons and polylines! - -Discrete geometry makes the challenge of projecting from the sphere to the plane much harder. The edges of a spherical polygon are [geodesics](https://en.wikipedia.org/wiki/Geodesic) (segments of great circles), not straight lines. Projected to the plane, geodesics are curves in all map projections except [gnomonic](#geoGnomonic), and thus accurate projection requires interpolation along each arc. D3 uses [adaptive sampling](https://bl.ocks.org/mbostock/3795544) inspired by a popular [line simplification method](https://bost.ocks.org/mike/simplify/) to balance accuracy and performance. - -The projection of polygons and polylines must also deal with the topological differences between the sphere and the plane. Some projections require cutting geometry that [crosses the antimeridian](https://bl.ocks.org/mbostock/3788999), while others require [clipping geometry to a great circle](https://bl.ocks.org/mbostock/3021474). - -Spherical polygons also require a [winding order convention](https://bl.ocks.org/mbostock/a7bdfeb041e850799a8d3dce4d8c50c8) to determine which side of the polygon is the inside: the exterior ring for polygons smaller than a hemisphere must be clockwise, while the exterior ring for polygons [larger than a hemisphere](https://bl.ocks.org/mbostock/6713736) must be anticlockwise. Interior rings representing holes must use the opposite winding order of their exterior ring. This winding order convention is also used by [TopoJSON](https://github.com/topojson) and [ESRI shapefiles](https://github.com/mbostock/shapefile); however, it is the **opposite** convention of GeoJSON’s [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1.6). (Also note that standard GeoJSON WGS84 uses planar equirectangular coordinates, not spherical coordinates, and thus may require [stitching](https://github.com/d3/d3-geo-projection/blob/master/README.md#geostitch) to remove antimeridian cuts.) - -D3’s approach affords great expressiveness: you can choose the right projection, and the right aspect, for your data. D3 supports a wide variety of common and [unusual map projections](https://github.com/d3/d3-geo-projection). For more, see Part 2 of [The Toolmaker’s Guide](https://vimeo.com/106198518#t=20m0s). - -D3 uses [GeoJSON](http://geojson.org/geojson-spec.html) to represent geographic features in JavaScript. (See also [TopoJSON](https://github.com/mbostock/topojson), an extension of GeoJSON that is significantly more compact and encodes topology.) To convert shapefiles to GeoJSON, use [shp2json](https://github.com/mbostock/shapefile/blob/master/README.md#shp2json), part of the [shapefile package](https://github.com/mbostock/shapefile). See [Command-Line Cartography](https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c) for an introduction to d3-geo and related tools. - -## Installing - -If you use NPM, `npm install d3-geo`. Otherwise, download the [latest release](https://github.com/d3/d3-geo/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-geo.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - - -``` - -[Try d3-geo in your browser.](https://observablehq.com/collection/@d3/d3-geo) - -## API Reference - -* [Paths](#paths) -* [Projections](#projections) ([Azimuthal](#azimuthal-projections), [Composite](#composite-projections), [Conic](#conic-projections), [Cylindrical](#cylindrical-projections)) -* [Raw Projections](#raw-projections) -* [Spherical Math](#spherical-math) -* [Spherical Shapes](#spherical-shapes) -* [Streams](#streams) -* [Transforms](#transforms) -* [Clipping](#clipping) - -### Paths - -The geographic path generator, [d3.geoPath](#geoPath), is similar to the shape generators in [d3-shape](https://github.com/d3/d3-shape): given a GeoJSON geometry or feature object, it generates an SVG path data string or [renders the path to a Canvas](https://bl.ocks.org/mbostock/3783604). Canvas is recommended for dynamic or interactive projections to improve performance. Paths can be used with [projections](#projections) or [transforms](#transforms), or they can be used to render planar geometry directly to Canvas or SVG. - -# d3.geoPath([projection[, context]]) [<>](https://github.com/d3/d3-geo/blob/master/src/path/index.js "Source") - -Creates a new geographic path generator with the default settings. If *projection* is specified, sets the [current projection](#path_projection). If *context* is specified, sets the [current context](#path_context). - -# path(object[, arguments…]) [<>](https://github.com/d3/d3-geo/blob/master/src/path/index.js "Source") - -Renders the given *object*, which may be any GeoJSON feature or geometry object: - -* Point - a single position. -* MultiPoint - an array of positions. -* LineString - an array of positions forming a continuous line. -* MultiLineString - an array of arrays of positions forming several lines. -* Polygon - an array of arrays of positions forming a polygon (possibly with holes). -* MultiPolygon - a multidimensional array of positions forming multiple polygons. -* GeometryCollection - an array of geometry objects. -* Feature - a feature containing one of the above geometry objects. -* FeatureCollection - an array of feature objects. - -The type *Sphere* is also supported, which is useful for rendering the outline of the globe; a sphere has no coordinates. Any additional *arguments* are passed along to the [pointRadius](#path_pointRadius) accessor. - -To display multiple features, combine them into a feature collection: - -```js -svg.append("path") - .datum({type: "FeatureCollection", features: features}) - .attr("d", d3.geoPath()); -``` - -Or use multiple path elements: - -```js -svg.selectAll("path") - .data(features) - .enter().append("path") - .attr("d", d3.geoPath()); -``` - -Separate path elements are typically slower than a single path element. However, distinct path elements are useful for styling and interaction (e.g., click or mouseover). Canvas rendering (see [*path*.context](#path_context)) is typically faster than SVG, but requires more effort to implement styling and interaction. - -# path.area(object) [<>](https://github.com/d3/d3-geo/blob/master/src/path/area.js "Source") - -Returns the projected planar area (typically in square pixels) for the specified GeoJSON *object*. Point, MultiPoint, LineString and MultiLineString geometries have zero area. For Polygon and MultiPolygon geometries, this method first computes the area of the exterior ring, and then subtracts the area of any interior holes. This method observes any clipping performed by the [projection](#path_projection); see [*projection*.clipAngle](#projection_clipAngle) and [*projection*.clipExtent](#projection_clipExtent). This is the planar equivalent of [d3.geoArea](#geoArea). - -# path.bounds(object) [<>](https://github.com/d3/d3-geo/blob/master/src/path/bounds.js "Source") - -Returns the projected planar bounding box (typically in pixels) for the specified GeoJSON *object*. The bounding box is represented by a two-dimensional array: \[\[*x₀*, *y₀*\], \[*x₁*, *y₁*\]\], where *x₀* is the minimum *x*-coordinate, *y₀* is the minimum *y*-coordinate, *x₁* is maximum *x*-coordinate, and *y₁* is the maximum *y*-coordinate. This is handy for, say, zooming in to a particular feature. (Note that in projected planar coordinates, the minimum latitude is typically the maximum *y*-value, and the maximum latitude is typically the minimum *y*-value.) This method observes any clipping performed by the [projection](#path_projection); see [*projection*.clipAngle](#projection_clipAngle) and [*projection*.clipExtent](#projection_clipExtent). This is the planar equivalent of [d3.geoBounds](#geoBounds). - -# path.centroid(object) [<>](https://github.com/d3/d3-geo/blob/master/src/path/centroid.js "Source") - -Returns the projected planar centroid (typically in pixels) for the specified GeoJSON *object*. This is handy for, say, labeling state or county boundaries, or displaying a symbol map. For example, a [noncontiguous cartogram](https://bl.ocks.org/mbostock/4055908) might scale each state around its centroid. This method observes any clipping performed by the [projection](#path_projection); see [*projection*.clipAngle](#projection_clipAngle) and [*projection*.clipExtent](#projection_clipExtent). This is the planar equivalent of [d3.geoCentroid](#geoCentroid). - -# path.measure(object) [<>](https://github.com/d3/d3-geo/blob/master/src/path/measure.js "Source") - -Returns the projected planar length (typically in pixels) for the specified GeoJSON *object*. Point and MultiPoint geometries have zero length. For Polygon and MultiPolygon geometries, this method computes the summed length of all rings. This method observes any clipping performed by the [projection](#path_projection); see [*projection*.clipAngle](#projection_clipAngle) and [*projection*.clipExtent](#projection_clipExtent). This is the planar equivalent of [d3.geoLength](#geoLength). - -# path.projection([projection]) [<>](https://github.com/d3/d3-geo/blob/master/src/path/index.js "Source") - -If a *projection* is specified, sets the current projection to the specified projection. If *projection* is not specified, returns the current projection, which defaults to null. The null projection represents the identity transformation: the input geometry is not projected and is instead rendered directly in raw coordinates. This can be useful for fast rendering of [pre-projected geometry](https://bl.ocks.org/mbostock/5557726), or for fast rendering of the equirectangular projection. - -The given *projection* is typically one of D3’s built-in [geographic projections](#projections); however, any object that exposes a [*projection*.stream](#projection_stream) function can be used, enabling the use of [custom projections](https://bl.ocks.org/mbostock/5663666). See D3’s [transforms](#transforms) for more examples of arbitrary geometric transformations. - -# path.context([context]) [<>](https://github.com/d3/d3-geo/blob/master/src/path/index.js "Source") - -If *context* is specified, sets the current render context and returns the path generator. If the *context* is null, then the [path generator](#_path) will return an SVG path string; if the context is non-null, the path generator will instead call methods on the specified context to render geometry. The context must implement the following subset of the [CanvasRenderingContext2D API](https://www.w3.org/TR/2dcontext/#canvasrenderingcontext2d): - -* *context*.beginPath() -* *context*.moveTo(*x*, *y*) -* *context*.lineTo(*x*, *y*) -* *context*.arc(*x*, *y*, *radius*, *startAngle*, *endAngle*) -* *context*.closePath() - -If a *context* is not specified, returns the current render context which defaults to null. - -# path.pointRadius([radius]) [<>](https://github.com/d3/d3-geo/blob/master/src/path/index.js "Source") - -If *radius* is specified, sets the radius used to display Point and MultiPoint geometries to the specified number. If *radius* is not specified, returns the current radius accessor, which defaults to 4.5. While the radius is commonly specified as a number constant, it may also be specified as a function which is computed per feature, being passed the any arguments passed to the [path generator](#_path). For example, if your GeoJSON data has additional properties, you might access those properties inside the radius function to vary the point size; alternatively, you could [d3.symbol](https://github.com/d3/d3-shape#symbols) and a [projection](#geoProjection) for greater flexibility. - -### Projections - -Projections transform spherical polygonal geometry to planar polygonal geometry. D3 provides implementations of several classes of standard projections: - -* [Azimuthal](#azimuthal-projections) -* [Composite](#composite-projections) -* [Conic](#conic-projections) -* [Cylindrical](#cylindrical-projections) - -For many more projections, see [d3-geo-projection](https://github.com/d3/d3-geo-projection). You can implement [custom projections](#raw-projections) using [d3.geoProjection](#geoProjection) or [d3.geoProjectionMutator](#geoProjectionMutator). - -# projection(point) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -Returns a new array \[*x*, *y*\] (typically in pixels) representing the projected point of the given *point*. The point must be specified as a two-element array \[*longitude*, *latitude*\] in degrees. May return null if the specified *point* has no defined projected position, such as when the point is outside the clipping bounds of the projection. - -# projection.invert(point) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -Returns a new array \[*longitude*, *latitude*\] in degrees representing the unprojected point of the given projected *point*. The point must be specified as a two-element array \[*x*, *y*\] (typically in pixels). May return null if the specified *point* has no defined projected position, such as when the point is outside the clipping bounds of the projection. - -This method is only defined on invertible projections. - -# projection.stream(stream) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -Returns a [projection stream](#streams) for the specified output *stream*. Any input geometry is projected before being streamed to the output stream. A typical projection involves several geometry transformations: the input geometry is first converted to radians, rotated on three axes, clipped to the small circle or cut along the antimeridian, and lastly projected to the plane with adaptive resampling, scale and translation. - -# projection.preclip([preclip]) - -If *preclip* is specified, sets the projection’s spherical clipping to the specified function and returns the projection. If *preclip* is not specified, returns the current spherical clipping function (see [preclip](#preclip)). - -# projection.postclip([postclip]) - -If *postclip* is specified, sets the projection’s cartesian clipping to the specified function and returns the projection. If *postclip* is not specified, returns the current cartesian clipping function (see [postclip](#postclip)). - -# projection.clipAngle([angle]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -If *angle* is specified, sets the projection’s clipping circle radius to the specified angle in degrees and returns the projection. If *angle* is null, switches to [antimeridian cutting](https://bl.ocks.org/mbostock/3788999) rather than small-circle clipping. If *angle* is not specified, returns the current clip angle which defaults to null. Small-circle clipping is independent of viewport clipping via [*projection*.clipExtent](#projection_clipExtent). - -See also [*projection*.preclip](#projection_preclip), [d3.geoClipAntimeridian](#geoClipAntimeridian), [d3.geoClipCircle](#geoClipCircle). - -# projection.clipExtent([extent]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -If *extent* is specified, sets the projection’s viewport clip extent to the specified bounds in pixels and returns the projection. The *extent* bounds are specified as an array \[\[x₀, y₀\], \[x₁, y₁\]\], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom. If *extent* is null, no viewport clipping is performed. If *extent* is not specified, returns the current viewport clip extent which defaults to null. Viewport clipping is independent of small-circle clipping via [*projection*.clipAngle](#projection_clipAngle). - -See also [*projection*.postclip](#projection_postclip), [d3.geoClipRectangle](#geoClipRectangle). - -# projection.scale([scale]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -If *scale* is specified, sets the projection’s scale factor to the specified value and returns the projection. If *scale* is not specified, returns the current scale factor; the default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections. - -# projection.translate([translate]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -If *translate* is specified, sets the projection’s translation offset to the specified two-element array [tx, ty] and returns the projection. If *translate* is not specified, returns the current translation offset which defaults to [480, 250]. The translation offset determines the pixel coordinates of the projection’s [center](#projection_center). The default translation offset places ⟨0°,0°⟩ at the center of a 960×500 area. - -# projection.center([center]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -If *center* is specified, sets the projection’s center to the specified *center*, a two-element array of [*longitude*, *latitude*] in degrees and returns the projection. If *center* is not specified, returns the current center, which defaults to ⟨0°,0°⟩. - -# projection.angle([angle]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -If *angle* is specified, sets the projection’s post-projection planar rotation angle to the specified *angle* in degrees and returns the projection. If *angle* is not specified, returns the projection’s current angle, which defaults to 0°. Note that it may be faster to rotate during rendering (e.g., using [*context*.rotate](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/rotate)) rather than during projection. - -# projection.reflectX([reflect]) - -If *reflect* is specified, sets whether or not the *x*-dimension is reflected (negated) in the output. If *reflect* is not specified, returns true if *x*-reflection is enabled, which defaults to false. This can be useful to display sky and astronomical data with the orb seen from below: right ascension (eastern direction) will point to the left when North is pointing up. - -# projection.reflectY([reflect]) - -If *reflect* is specified, sets whether or not the *y*-dimension is reflected (negated) in the output. If *reflect* is not specified, returns true if *y*-reflection is enabled, which defaults to false. This is especially useful for transforming from standard [spatial reference systems](https://en.wikipedia.org/wiki/Spatial_reference_system), which treat positive *y* as pointing up, to display coordinate systems such as Canvas and SVG, which treat positive *y* as pointing down. - -# projection.rotate([angles]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -If *rotation* is specified, sets the projection’s [three-axis spherical rotation](https://bl.ocks.org/mbostock/4282586) to the specified *angles*, which must be a two- or three-element array of numbers [*lambda*, *phi*, *gamma*] specifying the rotation angles in degrees about [each spherical axis](https://bl.ocks.org/mbostock/4282586). (These correspond to [yaw, pitch and roll](https://en.wikipedia.org/wiki/Aircraft_principal_axes).) If the rotation angle *gamma* is omitted, it defaults to 0. See also [d3.geoRotation](#geoRotation). If *rotation* is not specified, returns the current rotation which defaults [0, 0, 0]. - -# projection.precision([precision]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -If *precision* is specified, sets the threshold for the projection’s [adaptive resampling](https://bl.ocks.org/mbostock/3795544) to the specified value in pixels and returns the projection. This value corresponds to the [Douglas–Peucker](https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm) distance. If *precision* is not specified, returns the projection’s current resampling precision which defaults to √0.5 ≅ 0.70710… - -# projection.fitExtent(extent, object) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -Sets the projection’s [scale](#projection_scale) and [translate](#projection_translate) to fit the specified GeoJSON *object* in the center of the given *extent*. The extent is specified as an array \[\[x₀, y₀\], \[x₁, y₁\]\], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. Returns the projection. - -For example, to scale and translate the [New Jersey State Plane projection](https://bl.ocks.org/mbostock/5126418) to fit a GeoJSON object *nj* in the center of a 960×500 bounding box with 20 pixels of padding on each side: - -```js -var projection = d3.geoTransverseMercator() - .rotate([74 + 30 / 60, -38 - 50 / 60]) - .fitExtent([[20, 20], [940, 480]], nj); -``` - -Any [clip extent](#projection_clipExtent) is ignored when determining the new scale and translate. The [precision](#projection_precision) used to compute the bounding box of the given *object* is computed at an effective scale of 150. - -# projection.fitSize(size, object) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -A convenience method for [*projection*.fitExtent](#projection_fitExtent) where the top-left corner of the extent is [0, 0]. The following two statements are equivalent: - -```js -projection.fitExtent([[0, 0], [width, height]], object); -projection.fitSize([width, height], object); -``` - -# projection.fitWidth(width, object) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -A convenience method for [*projection*.fitSize](#projection_fitSize) where the height is automatically chosen from the aspect ratio of *object* and the given constraint on *width*. - -# projection.fitHeight(height, object) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -A convenience method for [*projection*.fitSize](#projection_fitSize) where the width is automatically chosen from the aspect ratio of *object* and the given constraint on *height*. - -#### Azimuthal Projections - -Azimuthal projections project the sphere directly onto a plane. - -# d3.geoAzimuthalEqualArea() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/azimuthalEqualArea.js "Source") -
# d3.geoAzimuthalEqualAreaRaw - -[](https://observablehq.com/@d3/azimuthal-equal-area) - -The azimuthal equal-area projection. - -# d3.geoAzimuthalEquidistant() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/azimuthalEquidistant.js "Source") -
# d3.geoAzimuthalEquidistantRaw - -[](https://observablehq.com/@d3/azimuthal-equidistant) - -The azimuthal equidistant projection. - -# d3.geoGnomonic() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/gnomonic.js "Source") -
# d3.geoGnomonicRaw - -[](https://observablehq.com/@d3/gnomonic) - -The gnomonic projection. - -# d3.geoOrthographic() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/orthographic.js "Source") -
# d3.geoOrthographicRaw - -[](https://observablehq.com/@d3/orthographic) - -The orthographic projection. - -# d3.geoStereographic() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/stereographic.js "Source") -
# d3.geoStereographicRaw - -[](https://observablehq.com/@d3/stereographic) - -The stereographic projection. - -#### Equal-Earth - -# d3.geoEqualEarth() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/equalEarth.js "Source") -
# d3.geoEqualEarthRaw - -[](https://observablehq.com/@d3/equal-earth) - -The Equal Earth projection, by Bojan Šavrič _et al._, 2018. - -#### Composite Projections - -Composite consist of several projections that are composed into a single display. The constituent projections have fixed clip, center and rotation, and thus composite projections do not support [*projection*.center](#projection_center), [*projection*.rotate](#projection_rotate), [*projection*.clipAngle](#projection_clipAngle), or [*projection*.clipExtent](#projection_clipExtent). - -# d3.geoAlbersUsa() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/albersUsa.js "Source") - -[](https://observablehq.com/@d3/u-s-map) - -This is a U.S.-centric composite projection of three [d3.geoConicEqualArea](#geoConicEqualArea) projections: [d3.geoAlbers](#geoAlbers) is used for the lower forty-eight states, and separate conic equal-area projections are used for Alaska and Hawaii. Note that the scale for Alaska is diminished: it is projected at 0.35× its true relative area. This diagram by Philippe Rivière illustrates how this projection uses two rectangular insets for Alaska and Hawaii: - -[](https://bl.ocks.org/Fil/7723167596af40d9159be34ffbf8d36b) - -See [d3-composite-projections](http://geoexamples.com/d3-composite-projections/) for more examples. - -#### Conic Projections - -Conic projections project the sphere onto a cone, and then unroll the cone onto the plane. Conic projections have [two standard parallels](#conic_parallels). - -# conic.parallels([parallels]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/conic.js "Source") - -The [two standard parallels](https://en.wikipedia.org/wiki/Map_projection#Conic) that define the map layout in conic projections. - -# d3.geoAlbers() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/albers.js "Source") - -[](https://observablehq.com/@d3/u-s-map) - -The Albers’ equal area-conic projection. This is a U.S.-centric configuration of [d3.geoConicEqualArea](#geoConicEqualArea). - -# d3.geoConicConformal() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/conicConformal.js "Source") -
# d3.geoConicConformalRaw(phi0, phi1) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/conicConformal.js "Source") - -[](https://observablehq.com/@d3/conic-conformal) - -The conic conformal projection. The parallels default to [30°, 30°] resulting in flat top. See also [*conic*.parallels](#conic_parallels). - -# d3.geoConicEqualArea() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/conicEqualArea.js "Source") -
# d3.geoConicEqualAreaRaw(phi0, phi1) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/conicEqualArea.js "Source") - -[](https://observablehq.com/@d3/conic-equal-area) - -The Albers’ equal-area conic projection. See also [*conic*.parallels](#conic_parallels). - -# d3.geoConicEquidistant() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/conicEquidistant.js "Source") -
# d3.geoConicEquidistantRaw(phi0, phi1) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/conicEquidistant.js "Source") - -[](https://observablehq.com/@d3/conic-equidistant) - -The conic equidistant projection. See also [*conic*.parallels](#conic_parallels). - -#### Cylindrical Projections - -Cylindrical projections project the sphere onto a containing cylinder, and then unroll the cylinder onto the plane. [Pseudocylindrical projections](https://web.archive.org/web/20150928042327/http://www.progonos.com/furuti/MapProj/Normal/ProjPCyl/projPCyl.html) are a generalization of cylindrical projections. - -# d3.geoEquirectangular() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/equirectangular.js "Source") -
# d3.geoEquirectangularRaw - -[](https://observablehq.com/@d3/equirectangular) - -The equirectangular (plate carrée) projection. - -# d3.geoMercator() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/mercator.js "Source") -
# d3.geoMercatorRaw - -[](https://observablehq.com/@d3/mercator) - -The spherical Mercator projection. Defines a default [*projection*.clipExtent](#projection_clipExtent) such that the world is projected to a square, clipped to approximately ±85° latitude. - -# d3.geoTransverseMercator() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/transverseMercator.js "Source") -
# d3.geoTransverseMercatorRaw - -[](https://observablehq.com/@d3/transverse-mercator) - -The transverse spherical Mercator projection. Defines a default [*projection*.clipExtent](#projection_clipExtent) such that the world is projected to a square, clipped to approximately ±85° latitude. - -# d3.geoNaturalEarth1() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/naturalEarth1.js "Source") -
# d3.geoNaturalEarth1Raw - -[](https://observablehq.com/@d3/natural-earth) - -The [Natural Earth projection](http://www.shadedrelief.com/NE_proj/) is a pseudocylindrical projection designed by Tom Patterson. It is neither conformal nor equal-area, but appealing to the eye for small-scale maps of the whole world. - -### Raw Projections - -Raw projections are point transformation functions that are used to implement custom projections; they typically passed to [d3.geoProjection](#geoProjection) or [d3.geoProjectionMutator](#geoProjectionMutator). They are exposed here to facilitate the derivation of related projections. Raw projections take spherical coordinates \[*lambda*, *phi*\] in radians (not degrees!) and return a point \[*x*, *y*\], typically in the unit square centered around the origin. - -# project(lambda, phi) - -Projects the specified point [lambda, phi] in radians, returning a new point \[*x*, *y*\] in unitless coordinates. - -# project.invert(x, y) - -The inverse of [*project*](#_project). - -# d3.geoProjection(project) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -Constructs a new projection from the specified [raw projection](#_project), *project*. The *project* function takes the *longitude* and *latitude* of a given point in [radians](http://mathworld.wolfram.com/Radian.html), often referred to as *lambda* (λ) and *phi* (φ), and returns a two-element array \[*x*, *y*\] representing its unit projection. The *project* function does not need to scale or translate the point, as these are applied automatically by [*projection*.scale](#projection_scale), [*projection*.translate](#projection_translate), and [*projection*.center](#projection_center). Likewise, the *project* function does not need to perform any spherical rotation, as [*projection*.rotate](#projection_rotate) is applied prior to projection. - -For example, a spherical Mercator projection can be implemented as: - -```js -var mercator = d3.geoProjection(function(x, y) { - return [x, Math.log(Math.tan(Math.PI / 4 + y / 2))]; -}); -``` - -If the *project* function exposes an *invert* method, the returned projection will also expose [*projection*.invert](#projection_invert). - -# d3.geoProjectionMutator(factory) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js "Source") - -Constructs a new projection from the specified [raw projection](#_project) *factory* and returns a *mutate* function to call whenever the raw projection changes. The *factory* must return a raw projection. The returned *mutate* function returns the wrapped projection. For example, a conic projection typically has two configurable parallels. A suitable *factory* function, such as [d3.geoConicEqualAreaRaw](#geoConicEqualAreaRaw), would have the form: - -```js -// y0 and y1 represent two parallels -function conicFactory(phi0, phi1) { - return function conicRaw(lambda, phi) { - return […, …]; - }; -} -``` - -Using d3.geoProjectionMutator, you can implement a standard projection that allows the parallels to be changed, reassigning the raw projection used internally by [d3.geoProjection](#geoProjection): - -```js -function conicCustom() { - var phi0 = 29.5, - phi1 = 45.5, - mutate = d3.geoProjectionMutator(conicFactory), - projection = mutate(phi0, phi1); - - projection.parallels = function(_) { - return arguments.length ? mutate(phi0 = +_[0], phi1 = +_[1]) : [phi0, phi1]; - }; - - return projection; -} -``` - -When creating a mutable projection, the *mutate* function is typically not exposed. - -### Spherical Math - -# d3.geoArea(object) [<>](https://github.com/d3/d3-geo/blob/master/src/area.js "Source") - -Returns the spherical area of the specified GeoJSON *object* in [steradians](http://mathworld.wolfram.com/Steradian.html). This is the spherical equivalent of [*path*.area](#path_area). - -# d3.geoBounds(object) [<>](https://github.com/d3/d3-geo/blob/master/src/bounds.js "Source") - -Returns the [spherical bounding box](https://www.jasondavies.com/maps/bounds/) for the specified GeoJSON *object*. The bounding box is represented by a two-dimensional array: \[\[*left*, *bottom*], \[*right*, *top*\]\], where *left* is the minimum longitude, *bottom* is the minimum latitude, *right* is maximum longitude, and *top* is the maximum latitude. All coordinates are given in degrees. (Note that in projected planar coordinates, the minimum latitude is typically the maximum *y*-value, and the maximum latitude is typically the minimum *y*-value.) This is the spherical equivalent of [*path*.bounds](#path_bounds). - -# d3.geoCentroid(object) [<>](https://github.com/d3/d3-geo/blob/master/src/centroid.js "Source") - -Returns the spherical centroid of the specified GeoJSON *object*. This is the spherical equivalent of [*path*.centroid](#path_centroid). - -# d3.geoDistance(a, b) [<>](https://github.com/d3/d3-geo/blob/master/src/distance.js "Source") - -Returns the great-arc distance in [radians](http://mathworld.wolfram.com/Radian.html) between the two points *a* and *b*. Each point must be specified as a two-element array \[*longitude*, *latitude*\] in degrees. This is the spherical equivalent of [*path*.measure](#path_measure) given a LineString of two points. - -# d3.geoLength(object) [<>](https://github.com/d3/d3-geo/blob/master/src/length.js "Source") - -Returns the great-arc length of the specified GeoJSON *object* in [radians](http://mathworld.wolfram.com/Radian.html). For polygons, returns the perimeter of the exterior ring plus that of any interior rings. This is the spherical equivalent of [*path*.measure](#path_measure). - -# d3.geoInterpolate(a, b) [<>](https://github.com/d3/d3-geo/blob/master/src/interpolate.js "Source") - -Returns an interpolator function given two points *a* and *b*. Each point must be specified as a two-element array \[*longitude*, *latitude*\] in degrees. The returned interpolator function takes a single argument *t*, where *t* is a number ranging from 0 to 1; a value of 0 returns the point *a*, while a value of 1 returns the point *b*. Intermediate values interpolate from *a* to *b* along the great arc that passes through both *a* and *b*. If *a* and *b* are antipodes, an arbitrary great arc is chosen. - -# d3.geoContains(object, point) [<>](https://github.com/d3/d3-geo/blob/master/src/contains.js "Source") - -Returns true if and only if the specified GeoJSON *object* contains the specified *point*, or false if the *object* does not contain the *point*. The point must be specified as a two-element array \[*longitude*, *latitude*\] in degrees. For Point and MultiPoint geometries, an exact test is used; for a Sphere, true is always returned; for other geometries, an epsilon threshold is applied. - -# d3.geoRotation(angles) [<>](https://github.com/d3/d3-geo/blob/master/src/rotation.js "Source") - -Returns a [rotation function](#_rotation) for the given *angles*, which must be a two- or three-element array of numbers [*lambda*, *phi*, *gamma*] specifying the rotation angles in degrees about [each spherical axis](https://bl.ocks.org/mbostock/4282586). (These correspond to [yaw, pitch and roll](https://en.wikipedia.org/wiki/Aircraft_principal_axes).) If the rotation angle *gamma* is omitted, it defaults to 0. See also [*projection*.rotate](#projection_rotate). - -# rotation(point) [<>](https://github.com/d3/d3-geo/blob/master/src/rotation.js "Source") - -Returns a new array \[*longitude*, *latitude*\] in degrees representing the rotated point of the given *point*. The point must be specified as a two-element array \[*longitude*, *latitude*\] in degrees. - -# rotation.invert(point) [<>](https://github.com/d3/d3-geo/blob/master/src/rotation.js "Source") - -Returns a new array \[*longitude*, *latitude*\] in degrees representing the point of the given rotated *point*; the inverse of [*rotation*](#_rotation). The point must be specified as a two-element array \[*longitude*, *latitude*\] in degrees. - -### Spherical Shapes - -To generate a [great arc](https://en.wikipedia.org/wiki/Great-circle_distance) (a segment of a great circle), simply pass a GeoJSON LineString geometry object to a [d3.geoPath](#geoPath). D3’s projections use great-arc interpolation for intermediate points, so there’s no need for a great arc shape generator. - -# d3.geoCircle() [<>](https://github.com/d3/d3-geo/blob/master/src/circle.js "Source") - -Returns a new circle generator. - -# circle(arguments…) [<>](https://github.com/d3/d3-geo/blob/master/src/circle.js "Source") - -Returns a new GeoJSON geometry object of type “Polygon” approximating a circle on the surface of a sphere, with the current [center](#circle_center), [radius](#circle_radius) and [precision](#circle_precision). Any *arguments* are passed to the accessors. - -# circle.center([center]) [<>](https://github.com/d3/d3-geo/blob/master/src/circle.js "Source") - -If *center* is specified, sets the circle center to the specified point \[*longitude*, *latitude*\] in degrees, and returns this circle generator. The center may also be specified as a function; this function will be invoked whenever a circle is [generated](#_circle), being passed any arguments passed to the circle generator. If *center* is not specified, returns the current center accessor, which defaults to: - -```js -function center() { - return [0, 0]; -} -``` - -# circle.radius([radius]) [<>](https://github.com/d3/d3-geo/blob/master/src/circle.js "Source") - -If *radius* is specified, sets the circle radius to the specified angle in degrees, and returns this circle generator. The radius may also be specified as a function; this function will be invoked whenever a circle is [generated](#_circle), being passed any arguments passed to the circle generator. If *radius* is not specified, returns the current radius accessor, which defaults to: - -```js -function radius() { - return 90; -} -``` - -# circle.precision([angle]) [<>](https://github.com/d3/d3-geo/blob/master/src/circle.js "Source") - -If *precision* is specified, sets the circle precision to the specified angle in degrees, and returns this circle generator. The precision may also be specified as a function; this function will be invoked whenever a circle is [generated](#_circle), being passed any arguments passed to the circle generator. If *precision* is not specified, returns the current precision accessor, which defaults to: - -```js -function precision() { - return 6; -} -``` - -Small circles do not follow great arcs and thus the generated polygon is only an approximation. Specifying a smaller precision angle improves the accuracy of the approximate polygon, but also increase the cost to generate and render it. - -# d3.geoGraticule() [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -Constructs a geometry generator for creating graticules: a uniform grid of [meridians](https://en.wikipedia.org/wiki/Meridian_\(geography\)) and [parallels](https://en.wikipedia.org/wiki/Circle_of_latitude) for showing projection distortion. The default graticule has meridians and parallels every 10° between ±80° latitude; for the polar regions, there are meridians every 90°. - - - -# graticule() [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -Returns a GeoJSON MultiLineString geometry object representing all meridians and parallels for this graticule. - -# graticule.lines() [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -Returns an array of GeoJSON LineString geometry objects, one for each meridian or parallel for this graticule. - -# graticule.outline() [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -Returns a GeoJSON Polygon geometry object representing the outline of this graticule, i.e. along the meridians and parallels defining its extent. - -# graticule.extent([extent]) [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -If *extent* is specified, sets the major and minor extents of this graticule. If *extent* is not specified, returns the current minor extent, which defaults to ⟨⟨-180°, -80° - ε⟩, ⟨180°, 80° + ε⟩⟩. - -# graticule.extentMajor([extent]) [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -If *extent* is specified, sets the major extent of this graticule. If *extent* is not specified, returns the current major extent, which defaults to ⟨⟨-180°, -90° + ε⟩, ⟨180°, 90° - ε⟩⟩. - -# graticule.extentMinor([extent]) [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -If *extent* is specified, sets the minor extent of this graticule. If *extent* is not specified, returns the current minor extent, which defaults to ⟨⟨-180°, -80° - ε⟩, ⟨180°, 80° + ε⟩⟩. - -# graticule.step([step]) [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -If *step* is specified, sets the major and minor step for this graticule. If *step* is not specified, returns the current minor step, which defaults to ⟨10°, 10°⟩. - -# graticule.stepMajor([step]) [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -If *step* is specified, sets the major step for this graticule. If *step* is not specified, returns the current major step, which defaults to ⟨90°, 360°⟩. - -# graticule.stepMinor([step]) [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -If *step* is specified, sets the minor step for this graticule. If *step* is not specified, returns the current minor step, which defaults to ⟨10°, 10°⟩. - -# graticule.precision([angle]) [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -If *precision* is specified, sets the precision for this graticule, in degrees. If *precision* is not specified, returns the current precision, which defaults to 2.5°. - -# d3.geoGraticule10() [<>](https://github.com/d3/d3-geo/blob/master/src/graticule.js "Source") - -A convenience method for directly generating the default 10° global graticule as a GeoJSON MultiLineString geometry object. Equivalent to: - -```js -function geoGraticule10() { - return d3.geoGraticule()(); -} -``` - -### Streams - -D3 transforms geometry using a sequence of function calls, rather than materializing intermediate representations, to minimize overhead. Streams must implement several methods to receive input geometry. Streams are inherently stateful; the meaning of a [point](#point) depends on whether the point is inside of a [line](#lineStart), and likewise a line is distinguished from a ring by a [polygon](#polygonStart). Despite the name “stream”, these method calls are currently synchronous. - -# d3.geoStream(object, stream) [<>](https://github.com/d3/d3-geo/blob/master/src/stream.js "Source") - -Streams the specified [GeoJSON](http://geojson.org) *object* to the specified [projection *stream*](#projection-streams). While both features and geometry objects are supported as input, the stream interface only describes the geometry, and thus additional feature properties are not visible to streams. - -# stream.point(x, y[, z]) - -Indicates a point with the specified coordinates *x* and *y* (and optionally *z*). The coordinate system is unspecified and implementation-dependent; for example, [projection streams](https://github.com/d3/d3-geo-projection) require spherical coordinates in degrees as input. Outside the context of a polygon or line, a point indicates a point geometry object ([Point](http://www.geojson.org/geojson-spec.html#point) or [MultiPoint](http://www.geojson.org/geojson-spec.html#multipoint)). Within a line or polygon ring, the point indicates a control point. - -# stream.lineStart() - -Indicates the start of a line or ring. Within a polygon, indicates the start of a ring. The first ring of a polygon is the exterior ring, and is typically clockwise. Any subsequent rings indicate holes in the polygon, and are typically counterclockwise. - -# stream.lineEnd() - -Indicates the end of a line or ring. Within a polygon, indicates the end of a ring. Unlike GeoJSON, the redundant closing coordinate of a ring is *not* indicated via [point](#point), and instead is implied via lineEnd within a polygon. Thus, the given polygon input: - -```json -{ - "type": "Polygon", - "coordinates": [ - [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]] - ] -} -``` - -Will produce the following series of method calls on the stream: - -```js -stream.polygonStart(); -stream.lineStart(); -stream.point(0, 0); -stream.point(0, 1); -stream.point(1, 1); -stream.point(1, 0); -stream.lineEnd(); -stream.polygonEnd(); -``` - -# stream.polygonStart() - -Indicates the start of a polygon. The first line of a polygon indicates the exterior ring, and any subsequent lines indicate interior holes. - -# stream.polygonEnd() - -Indicates the end of a polygon. - -# stream.sphere() - -Indicates the sphere (the globe; the unit sphere centered at ⟨0,0,0⟩). - -### Transforms - -Transforms are a generalization of projections. Transform implement [*projection*.stream](#projection_stream) and can be passed to [*path*.projection](#path_projection). However, they only implement a subset of the other projection methods, and represent arbitrary geometric transformations rather than projections from spherical to planar coordinates. - -# d3.geoTransform(methods) [<>](https://github.com/d3/d3-geo/blob/master/src/transform.js "Source") - -Defines an arbitrary transform using the methods defined on the specified *methods* object. Any undefined methods will use pass-through methods that propagate inputs to the output stream. For example, to reflect the *y*-dimension (see also [*identity*.reflectY](#identity_reflectY)): - -```js -var reflectY = d3.geoTransform({ - point: function(x, y) { - this.stream.point(x, -y); - } -}); -``` - -Or to define an affine matrix transformation: - -```js -function matrix(a, b, c, d, tx, ty) { - return d3.geoTransform({ - point: function(x, y) { - this.stream.point(a * x + b * y + tx, c * x + d * y + ty); - } - }); -} -``` - -# d3.geoIdentity() [<>](https://github.com/d3/d3-geo/blob/master/src/projection/identity.js "Source") - -The identity transform can be used to scale, translate and clip planar geometry. It implements [*projection*.scale](#projection_scale), [*projection*.translate](#projection_translate), [*projection*.fitExtent](#projection_fitExtent), [*projection*.fitSize](#projection_fitSize), [*projection*.fitWidth](#projection_fitWidth), [*projection*.fitHeight](#projection_fitHeight), [*projection*.clipExtent](#projection_clipExtent), [*projection*.angle](#projection_angle), [*projection*.reflectX](#projection_reflectX) and [*projection*.reflectY](#projection_reflectY). - -### Clipping - -Projections perform cutting or clipping of geometries in two stages. - -# preclip(stream) - -Pre-clipping occurs in geographic coordinates. Cutting along the antimeridian line, or clipping along a small circle are the most common strategies. - -See [*projection*.preclip](#projection_preclip). - -# postclip(stream) - -Post-clipping occurs on the plane, when a projection is bounded to a certain extent such as a rectangle. - -See [*projection*.postclip](#projection_postclip). - -Clipping functions are implemented as transformations of a [projection stream](#streams). Pre-clipping operates on spherical coordinates, in radians. Post-clipping operates on planar coordinates, in pixels. - -# d3.geoClipAntimeridian - -A clipping function which transforms a stream such that geometries (lines or polygons) that cross the antimeridian line are cut in two, one on each side. Typically used for pre-clipping. - -# d3.geoClipCircle(angle) - -Generates a clipping function which transforms a stream such that geometries are bounded by a small circle of radius *angle* around the projection’s [center](#projection_center). Typically used for pre-clipping. - -# d3.geoClipRectangle(x0, y0, x1, y1) - -Generates a clipping function which transforms a stream such that geometries are bounded by a rectangle of coordinates [[x0, y0], [x1, y1]]. Typically used for post-clipping. diff --git a/node_modules/d3-geo/dist/d3-geo.js b/node_modules/d3-geo/dist/d3-geo.js deleted file mode 100644 index 3d753b2..0000000 --- a/node_modules/d3-geo/dist/d3-geo.js +++ /dev/null @@ -1,3165 +0,0 @@ -// https://d3js.org/d3-geo/ v1.12.1 Copyright 2020 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array')) : -typeof define === 'function' && define.amd ? define(['exports', 'd3-array'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {}, global.d3)); -}(this, (function (exports, d3Array) { 'use strict'; - -// 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–363 (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 = { - constructor: Adder, - reset: function() { - this.s = // rounded value - this.t = 0; // exact error - }, - add: function(y) { - add(temp, y, this.t); - add(this, temp.s, this.s); - if (this.s) this.t += temp.t; - else this.s = temp.t; - }, - valueOf: function() { - return this.s; - } -}; - -var temp = new Adder; - -function add(adder, a, b) { - var x = adder.s = a + b, - bv = x - a, - av = x - bv; - adder.t = (a - av) + (b - bv); -} - -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var tau = pi * 2; - -var degrees = 180 / pi; -var radians = pi / 180; - -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var cos = Math.cos; -var ceil = Math.ceil; -var exp = Math.exp; -var log = Math.log; -var pow = Math.pow; -var sin = Math.sin; -var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; -var sqrt = Math.sqrt; -var tan = Math.tan; - -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} - -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} - -function haversin(x) { - return (x = sin(x / 2)) * x; -} - -function noop() {} - -function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { - streamGeometryType[geometry.type](geometry, stream); - } -} - -var streamObjectType = { - Feature: function(object, stream) { - streamGeometry(object.geometry, stream); - }, - FeatureCollection: function(object, stream) { - var features = object.features, i = -1, n = features.length; - while (++i < n) streamGeometry(features[i].geometry, stream); - } -}; - -var streamGeometryType = { - Sphere: function(object, stream) { - stream.sphere(); - }, - Point: function(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); - }, - MultiPoint: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]); - }, - LineString: function(object, stream) { - streamLine(object.coordinates, stream, 0); - }, - MultiLineString: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamLine(coordinates[i], stream, 0); - }, - Polygon: function(object, stream) { - streamPolygon(object.coordinates, stream); - }, - MultiPolygon: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamPolygon(coordinates[i], stream); - }, - GeometryCollection: function(object, stream) { - var geometries = object.geometries, i = -1, n = geometries.length; - while (++i < n) streamGeometry(geometries[i], stream); - } -}; - -function streamLine(coordinates, stream, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - stream.lineStart(); - while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - stream.lineEnd(); -} - -function streamPolygon(coordinates, stream) { - var i = -1, n = 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 = adder(); - -var areaSum = adder(), - lambda00, - phi00, - lambda0, - cosPhi0, - sinPhi0; - -var areaStream = { - point: noop, - lineStart: noop, - lineEnd: noop, - polygonStart: function() { - areaRingSum.reset(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? tau + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = noop; - }, - sphere: function() { - areaSum.add(tau); - } -}; - -function areaRingStart() { - areaStream.point = areaPointFirst; -} - -function areaRingEnd() { - areaPoint(lambda00, phi00); -} - -function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= radians, phi *= radians; - lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi); -} - -function areaPoint(lambda, phi) { - lambda *= radians, phi *= radians; - phi = 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’s - // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). - var dLambda = lambda - lambda0, - sdLambda = dLambda >= 0 ? 1 : -1, - adLambda = sdLambda * dLambda, - cosPhi = cos(phi), - sinPhi = sin(phi), - k = sinPhi0 * sinPhi, - u = cosPhi0 * cosPhi + k * cos(adLambda), - v = k * sdLambda * sin(adLambda); - areaRingSum.add(atan2(v, u)); - - // Advance the previous points. - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; -} - -function area(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 = spherical[0], phi = spherical[1], cosPhi = cos(phi); - return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(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] += b[0], a[1] += b[1], a[2] += b[2]; -} - -function cartesianScale(vector, k) { - return [vector[0] * k, vector[1] * k, vector[2] * k]; -} - -// TODO return d -function cartesianNormalizeInPlace(d) { - var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; -} - -var lambda0$1, phi0, lambda1, phi1, // bounds - lambda2, // previous lambda-coordinate - lambda00$1, phi00$1, // first point - p0, // previous 3D point - deltaSum = adder(), - ranges, - range; - -var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum.reset(); - areaStream.polygonStart(); - }, - polygonEnd: function() { - areaStream.polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > epsilon) phi1 = 90; - else if (deltaSum < -epsilon) phi0 = -90; - range[0] = lambda0$1, range[1] = lambda1; - }, - sphere: function() { - lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); - } -}; - -function boundsPoint(lambda, phi) { - ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; -} - -function linePoint(lambda, phi) { - var p = cartesian([lambda * radians, phi * radians]); - if (p0) { - var normal = cartesianCross(p0, p), - equatorial = [normal[1], -normal[0], 0], - inflection = cartesianCross(equatorial, normal); - cartesianNormalizeInPlace(inflection); - inflection = spherical(inflection); - var delta = lambda - lambda2, - sign = delta > 0 ? 1 : -1, - lambdai = inflection[0] * degrees * sign, - phii, - antimeridian = abs(delta) > 180; - if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = inflection[1] * degrees; - if (phii > phi1) phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = -inflection[1] * degrees; - if (phii < phi0) phi0 = phii; - } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - if (antimeridian) { - if (lambda < lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; - } - } else { - if (lambda1 >= lambda0$1) { - if (lambda < lambda0$1) lambda0$1 = lambda; - if (lambda > lambda1) lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; - } - } - } - } else { - ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); - } - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - p0 = p, lambda2 = lambda; -} - -function boundsLineStart() { - boundsStream.point = linePoint; -} - -function boundsLineEnd() { - range[0] = lambda0$1, range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; -} - -function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else { - lambda00$1 = lambda, phi00$1 = 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) lambda0$1 = -(lambda1 = 180); - range[0] = lambda0$1, range[1] = lambda1; - p0 = null; -} - -// Finds the left-right distance between two longitudes. -// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want -// the distance between ±180° to be 360°. -function angle(lambda0, lambda1) { - return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; -} - -function rangeCompare(a, b) { - return a[0] - b[0]; -} - -function rangeContains(range, x) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; -} - -function bounds(feature) { - var i, n, a, b, merged, deltaMax, delta; - - phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity); - ranges = []; - geoStream(feature, boundsStream); - - // First, sort ranges by their minimum longitudes. - if (n = ranges.length) { - ranges.sort(rangeCompare); - - // Then, merge any ranges that overlap. - for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) { - b = ranges[i]; - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - 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. - for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) { - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1]; - } - } - - ranges = range = null; - - return lambda0$1 === Infinity || phi0 === 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 = { - sphere: noop, - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } -}; - -// Arithmetic mean of Cartesian vectors. -function centroidPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi); - centroidPointCartesian(cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)); -} - -function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; -} - -function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; -} - -function centroidLinePointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi); - x0 = cosPhi * cos(lambda); - y0 = cosPhi * sin(lambda); - z0 = sin(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); -} - -function centroidLinePoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi), - x = cosPhi * cos(lambda), - y = cosPhi * sin(lambda), - z = sin(phi), - w = atan2(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); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} - -// See J. E. Brock, The Inertia Tensor for a Spherical Triangle, -// J. Applied Mechanics 42, 239 (1975). -function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; -} - -function centroidRingEnd() { - centroidRingPoint(lambda00$2, phi00$2); - centroidStream.point = centroidPoint; -} - -function centroidRingPointFirst(lambda, phi) { - lambda00$2 = lambda, phi00$2 = phi; - lambda *= radians, phi *= radians; - centroidStream.point = centroidRingPoint; - var cosPhi = cos(phi); - x0 = cosPhi * cos(lambda); - y0 = cosPhi * sin(lambda); - z0 = sin(phi); - centroidPointCartesian(x0, y0, z0); -} - -function centroidRingPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi), - x = cosPhi * cos(lambda), - y = cosPhi * sin(lambda), - z = sin(phi), - cx = y0 * z - z0 * y, - cy = z0 * x - x0 * z, - cz = x0 * y - y0 * x, - m = sqrt(cx * cx + cy * cy + cz * cz), - w = asin(m), // line weight = angle - v = m && -w / m; // area weight multiplier - X2 += v * cx; - Y2 += v * cy; - Z2 += v * cz; - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -function centroid(object) { - W0 = W1 = - X0 = Y0 = Z0 = - X1 = Y1 = Z1 = - X2 = Y2 = Z2 = 0; - geoStream(object, centroidStream); - - var x = X2, - y = Y2, - z = Z2, - m = x * x + y * y + z * z; - - // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. - if (m < epsilon2) { - x = X1, y = Y1, z = Z1; - // If the feature has zero length, fall back to arithmetic mean of point vectors. - if (W1 < epsilon) x = X0, y = Y0, z = Z0; - m = x * x + y * y + z * z; - // If the feature still has an undefined ccentroid, then return. - if (m < epsilon2) return [NaN, NaN]; - } - - return [atan2(y, x) * degrees, asin(z / sqrt(m)) * degrees]; -} - -function constant(x) { - return function() { - return x; - }; -} - -function compose(a, b) { - - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - - return compose; -} - -function rotationIdentity(lambda, phi) { - return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi]; -} - -rotationIdentity.invert = rotationIdentity; - -function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= tau) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) - : rotationLambda(deltaLambda)) - : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) - : rotationIdentity); -} - -function forwardRotationLambda(deltaLambda) { - return function(lambda, phi) { - return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi]; - }; -} - -function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; -} - -function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = cos(deltaPhi), - sinDeltaPhi = sin(deltaPhi), - cosDeltaGamma = cos(deltaGamma), - sinDeltaGamma = sin(deltaGamma); - - function rotation(lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi), - k = z * cosDeltaPhi + x * sinDeltaPhi; - return [ - atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), - asin(k * cosDeltaGamma + y * sinDeltaGamma) - ]; - } - - rotation.invert = function(lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi), - k = z * cosDeltaGamma - y * sinDeltaGamma; - return [ - atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), - asin(k * cosDeltaPhi - x * sinDeltaPhi) - ]; - }; - - return rotation; -} - -function rotation(rotate) { - rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0); - - function forward(coordinates) { - coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; - } - - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; - }; - - return forward; -} - -// Generates a circle centered at [0°, 0°], with a given radius and precision. -function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = cos(radius), - sinRadius = sin(radius), - step = direction * delta; - if (t0 == null) { - t0 = radius + direction * tau; - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau; - } - for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) { - point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(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 = cartesian(point), point[0] -= cosRadius; - cartesianNormalizeInPlace(point); - var radius = acos(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau; -} - -function circle() { - var center = constant([0, 0]), - radius = constant(90), - precision = constant(6), - ring, - rotate, - stream = {point: point}; - - function point(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= degrees, x[1] *= degrees; - } - - function circle() { - var c = center.apply(this, arguments), - r = radius.apply(this, arguments) * radians, - p = precision.apply(this, arguments) * radians; - ring = []; - rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert; - circleStream(stream, r, p, 1); - c = {type: "Polygon", coordinates: [ring]}; - ring = rotate = null; - return c; - } - - circle.center = function(_) { - return arguments.length ? (center = typeof _ === "function" ? _ : constant([+_[0], +_[1]]), circle) : center; - }; - - circle.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), circle) : radius; - }; - - circle.precision = function(_) { - return arguments.length ? (precision = typeof _ === "function" ? _ : constant(+_), circle) : precision; - }; - - return circle; -} - -function clipBuffer() { - var lines = [], - line; - return { - point: function(x, y, m) { - line.push([x, y, m]); - }, - lineStart: function() { - lines.push(line = []); - }, - lineEnd: noop, - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function() { - var result = lines; - lines = []; - line = null; - return result; - } - }; -} - -function pointEqual(a, b) { - return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon; -} - -function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - this.e = entry; // is an entry? - this.v = false; // visited - this.n = this.p = 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 = [], - clip = [], - i, - n; - - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n], x; - - if (pointEqual(p0, p1)) { - if (!p0[2] && !p1[2]) { - stream.lineStart(); - for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]); - stream.lineEnd(); - return; - } - // handle degenerate cases by moving the point - p1[0] += 2 * epsilon; - } - - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - - if (!subject.length) return; - - clip.sort(compareIntersection); - link(subject); - link(clip); - - for (i = 0, n = clip.length; i < n; ++i) { - clip[i].e = startInside = !startInside; - } - - var start = subject[0], - points, - point; - - while (1) { - // Find first unvisited intersection. - var current = start, - isSubject = true; - while (current.v) if ((current = current.n) === start) return; - points = current.z; - stream.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) { - for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.n.x, 1, stream); - } - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.p.x, -1, stream); - } - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - } while (!current.v); - stream.lineEnd(); - } -} - -function link(array) { - if (!(n = array.length)) return; - var n, - i = 0, - a = array[0], - b; - while (++i < n) { - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; -} - -var sum = adder(); - -function longitude(point) { - if (abs(point[0]) <= pi) - return point[0]; - else - return sign(point[0]) * ((abs(point[0]) + pi) % tau - pi); -} - -function polygonContains(polygon, point) { - var lambda = longitude(point), - phi = point[1], - sinPhi = sin(phi), - normal = [sin(lambda), -cos(lambda), 0], - angle = 0, - winding = 0; - - sum.reset(); - - if (sinPhi === 1) phi = halfPi + epsilon; - else if (sinPhi === -1) phi = -halfPi - epsilon; - - for (var i = 0, n = polygon.length; i < n; ++i) { - if (!(m = (ring = polygon[i]).length)) continue; - var ring, - m, - point0 = ring[m - 1], - lambda0 = longitude(point0), - phi0 = point0[1] / 2 + quarterPi, - sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0); - - for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) { - var point1 = ring[j], - lambda1 = longitude(point1), - phi1 = point1[1] / 2 + quarterPi, - sinPhi1 = sin(phi1), - cosPhi1 = cos(phi1), - delta = lambda1 - lambda0, - sign = delta >= 0 ? 1 : -1, - absDelta = sign * delta, - antimeridian = absDelta > pi, - k = sinPhi0 * sinPhi1; - - sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta))); - angle += antimeridian ? delta + sign * tau : delta; - - // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = cartesianCross(cartesian(point0), cartesian(point1)); - cartesianNormalizeInPlace(arc); - var intersection = cartesianCross(normal, arc); - cartesianNormalizeInPlace(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]); - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) { - winding += antimeridian ^ delta >= 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 negative - // (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 || angle < epsilon && sum < -epsilon) ^ (winding & 1); -} - -function clip(pointVisible, clipLine, interpolate, start) { - return function(sink) { - var line = clipLine(sink), - ringBuffer = clipBuffer(), - ringSink = clipLine(ringBuffer), - polygonStarted = false, - polygon, - segments, - ring; - - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = d3Array.merge(segments); - var startInside = polygonContains(polygon, start); - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - clipRejoin(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = 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 = pointLine; - line.lineStart(); - } - - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - - function pointRing(lambda, phi) { - ring.push([lambda, phi]); - ringSink.point(lambda, phi); - } - - function ringStart() { - ringSink.lineStart(); - ring = []; - } - - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - - var clean = ringSink.clean(), - ringSegments = ringBuffer.result(), - i, n = ringSegments.length, m, - segment, - point; - - ring.pop(); - polygon.push(ring); - ring = null; - - if (!n) return; - - // No intersections. - if (clean & 1) { - segment = ringSegments[0]; - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]); - sink.lineEnd(); - } - return; - } - - // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.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 cutting -// and circle clipping, the same comparison is used. -function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]); -} - -var clipAntimeridian = clip( - function() { return true; }, - clipAntimeridianLine, - clipAntimeridianInterpolate, - [-pi, -halfPi] -); - -// Takes a line and cuts into visible segments. Return values: 0 - there were -// 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 = NaN, - phi0 = NaN, - sign0 = NaN, - clean; // no intersections - - return { - lineStart: function() { - stream.lineStart(); - clean = 1; - }, - point: function(lambda1, phi1) { - var sign1 = lambda1 > 0 ? pi : -pi, - delta = abs(lambda1 - lambda0); - if (abs(delta - pi) < epsilon) { // line crosses a pole - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - clean = 0; - } else if (sign0 !== sign1 && delta >= pi) { // line crosses antimeridian - if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies - if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon; - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - clean = 0; - } - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function() { - return 2 - clean; // if intersections, rejoin first and last segments - } - }; -} - -function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, - cosPhi1, - sinLambda0Lambda1 = sin(lambda0 - lambda1); - return abs(sinLambda0Lambda1) > epsilon - ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1) - - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0)) - / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) - : (phi0 + phi1) / 2; -} - -function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - if (from == null) { - phi = direction * halfPi; - stream.point(-pi, phi); - stream.point(0, phi); - stream.point(pi, phi); - stream.point(pi, 0); - stream.point(pi, -phi); - stream.point(0, -phi); - stream.point(-pi, -phi); - stream.point(-pi, 0); - stream.point(-pi, phi); - } else if (abs(from[0] - to[0]) > epsilon) { - var lambda = from[0] < to[0] ? pi : -pi; - phi = 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 = cos(radius), - delta = 6 * radians, - smallRadius = cr > 0, - notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case - - function interpolate(from, to, direction, stream) { - circleStream(stream, radius, delta, direction, from, to); - } - - function visible(lambda, phi) { - return cos(lambda) * cos(phi) > cr; - } - - // Takes a line and cuts into visible segments. Return values used for polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // 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 = v0 = false; - clean = 1; - }, - point: function(lambda, phi) { - var point1 = [lambda, phi], - point2, - v = visible(lambda, phi), - c = smallRadius - ? v ? 0 : code(lambda, phi) - : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) - point1[2] = 1; - } - if (v !== v0) { - clean = 0; - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - point0 = 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 = intersect(point1, point0, true))) { - clean = 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], 3); - } - } - } - if (v && (!point0 || !pointEqual(point0, point1))) { - stream.point(point1[0], point1[1]); - } - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) stream.lineEnd(); - point0 = 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 = cartesian(a), - pb = cartesian(b); - - // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - var n1 = [1, 0, 0], // normal - n2 = cartesianCross(pa, pb), - n2n2 = cartesianDot(n2, n2), - n1n2 = n2[0], // cartesianDot(n1, n2), - determinant = n2n2 - n1n2 * n1n2; - - // Two polar points. - if (!determinant) return !two && a; - - var c1 = cr * n2n2 / determinant, - c2 = -cr * n1n2 / determinant, - n1xn2 = cartesianCross(n1, n2), - A = cartesianScale(n1, c1), - B = cartesianScale(n2, c2); - cartesianAddInPlace(A, B); - - // Solve |p(t)|^2 = 1. - var u = n1xn2, - w = cartesianDot(A, u), - uu = cartesianDot(u, u), - t2 = w * w - uu * (cartesianDot(A, A) - 1); - - if (t2 < 0) return; - - var t = sqrt(t2), - q = cartesianScale(u, (-w - t) / uu); - cartesianAddInPlace(q, A); - q = spherical(q); - - if (!two) return q; - - // Two intersection points. - var lambda0 = a[0], - lambda1 = b[0], - phi0 = a[1], - phi1 = b[1], - z; - - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - - var delta = lambda1 - lambda0, - polar = abs(delta - pi) < epsilon, - meridian = polar || delta < epsilon; - - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; - - // Check that the first point is between a and b. - if (meridian - ? polar - ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1) - : phi0 <= q[1] && q[1] <= phi1 - : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = 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 = smallRadius ? radius : pi - radius, - code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - return code; - } - - return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]); -} - -function clipLine(a, b, x0, y0, x1, y1) { - var ax = a[0], - ay = a[1], - bx = b[0], - by = b[1], - t0 = 0, - t1 = 1, - dx = bx - ax, - dy = by - ay, - r; - - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; -} - -var clipMax = 1e9, clipMin = -clipMax; - -// TODO Use d3-polygon’s 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 <= x && x <= x1 && y0 <= y && y <= y1; - } - - function interpolate(from, to, direction, stream) { - var a = 0, a1 = 0; - if (from == null - || (a = corner(from, direction)) !== (a1 = corner(to, direction)) - || comparePoint(from, to) < 0 ^ direction > 0) { - do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - while ((a = (a + direction + 4) % 4) !== a1); - } else { - stream.point(to[0], to[1]); - } - } - - function corner(p, direction) { - return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3 - : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1 - : abs(p[1] - y0) < epsilon ? 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 = corner(a, 1), - cb = corner(b, 1); - return ca !== cb ? ca - cb - : ca === 0 ? b[1] - a[1] - : ca === 1 ? a[0] - b[0] - : ca === 2 ? a[1] - b[1] - : b[0] - a[0]; - } - - return function(stream) { - var activeStream = stream, - bufferStream = clipBuffer(), - segments, - polygon, - ring, - x__, y__, v__, // first point - x_, y_, v_, // previous point - first, - clean; - - var clipStream = { - 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 = 0; - - for (var i = 0, n = polygon.length; i < n; ++i) { - for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) { - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; } - else { if (b1 <= 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 = bufferStream, segments = [], polygon = [], clean = true; - } - - function polygonEnd() { - var startInside = polygonInside(), - cleanInside = clean && startInside, - visible = (segments = d3Array.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, interpolate, stream); - } - stream.polygonEnd(); - } - activeStream = stream, segments = polygon = ring = null; - } - - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - - // TODO rather than special-case polygons, simply handle them separately. - // 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 = point; - if (v_) activeStream.lineEnd(); - } - - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([x, y]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else { - if (v && v_) activeStream.point(x, y); - else { - var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], - b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.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 = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - } - x_ = x, y_ = y, v_ = v; - } - - return clipStream; - }; -} - -function extent() { - var x0 = 0, - y0 = 0, - x1 = 960, - y1 = 500, - cache, - cacheStream, - clip; - - return clip = { - stream: function(stream) { - return cache && cacheStream === stream ? cache : cache = clipRectangle(x0, y0, x1, y1)(cacheStream = stream); - }, - extent: function(_) { - return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]]; - } - }; -} - -var lengthSum = adder(), - lambda0$2, - sinPhi0$1, - cosPhi0$1; - -var lengthStream = { - sphere: noop, - point: noop, - lineStart: lengthLineStart, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop -}; - -function lengthLineStart() { - lengthStream.point = lengthPointFirst; - lengthStream.lineEnd = lengthLineEnd; -} - -function lengthLineEnd() { - lengthStream.point = lengthStream.lineEnd = noop; -} - -function lengthPointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - lambda0$2 = lambda, sinPhi0$1 = sin(phi), cosPhi0$1 = cos(phi); - lengthStream.point = lengthPoint; -} - -function lengthPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var sinPhi = sin(phi), - cosPhi = cos(phi), - delta = abs(lambda - lambda0$2), - cosDelta = cos(delta), - sinDelta = sin(delta), - x = cosPhi * sinDelta, - y = cosPhi0$1 * sinPhi - sinPhi0$1 * cosPhi * cosDelta, - z = sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta; - lengthSum.add(atan2(sqrt(x * x + y * y), z)); - lambda0$2 = lambda, sinPhi0$1 = sinPhi, cosPhi0$1 = cosPhi; -} - -function length(object) { - lengthSum.reset(); - geoStream(object, lengthStream); - return +lengthSum; -} - -var coordinates = [null, null], - object = {type: "LineString", coordinates: coordinates}; - -function distance(a, b) { - coordinates[0] = a; - coordinates[1] = b; - return length(object); -} - -var containsObjectType = { - Feature: function(object, point) { - return containsGeometry(object.geometry, point); - }, - FeatureCollection: function(object, point) { - var features = object.features, i = -1, n = features.length; - while (++i < n) if (containsGeometry(features[i].geometry, point)) return true; - return false; - } -}; - -var containsGeometryType = { - Sphere: function() { - return true; - }, - Point: function(object, point) { - return containsPoint(object.coordinates, point); - }, - MultiPoint: function(object, point) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - 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 = object.coordinates, i = -1, n = coordinates.length; - 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 = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) if (containsPolygon(coordinates[i], point)) return true; - return false; - }, - GeometryCollection: function(object, point) { - var geometries = object.geometries, i = -1, n = 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) === 0; -} - -function containsLine(coordinates, point) { - var ao, bo, ab; - for (var i = 0, n = coordinates.length; i < n; i++) { - bo = distance(coordinates[i], point); - if (bo === 0) return true; - if (i > 0) { - ab = distance(coordinates[i], coordinates[i - 1]); - if ( - ab > 0 && - ao <= ab && - bo <= ab && - (ao + bo - ab) * (1 - Math.pow((ao - bo) / ab, 2)) < epsilon2 * ab - ) - return true; - } - ao = bo; - } - return false; -} - -function containsPolygon(coordinates, point) { - return !!polygonContains(coordinates.map(ringRadians), pointRadians(point)); -} - -function ringRadians(ring) { - return ring = ring.map(pointRadians), ring.pop(), ring; -} - -function pointRadians(point) { - return [point[0] * radians, point[1] * radians]; -} - -function contains(object, point) { - return (object && containsObjectType.hasOwnProperty(object.type) - ? containsObjectType[object.type] - : containsGeometry)(object, point); -} - -function graticuleX(y0, y1, dy) { - var y = d3Array.range(y0, y1 - epsilon, dy).concat(y1); - return function(x) { return y.map(function(y) { return [x, y]; }); }; -} - -function graticuleY(x0, x1, dx) { - var x = d3Array.range(x0, x1 - epsilon, 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 = 10, dy = dx, DX = 90, DY = 360, - x, y, X, Y, - precision = 2.5; - - function graticule() { - return {type: "MultiLineString", coordinates: lines()}; - } - - function lines() { - return d3Array.range(ceil(X0 / DX) * DX, X1, DX).map(X) - .concat(d3Array.range(ceil(Y0 / DY) * DY, Y1, DY).map(Y)) - .concat(d3Array.range(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs(x % DX) > epsilon; }).map(x)) - .concat(d3Array.range(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs(y % DY) > epsilon; }).map(y)); - } - - graticule.lines = function() { - return lines().map(function(coordinates) { return {type: "LineString", coordinates: coordinates}; }); - }; - - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ - X(X0).concat( - Y(Y1).slice(1), - X(X1).reverse().slice(1), - Y(Y0).reverse().slice(1)) - ] - }; - }; - - graticule.extent = function(_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - - graticule.extentMajor = function(_) { - if (!arguments.length) return [[X0, Y0], [X1, Y1]]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - - graticule.extentMinor = function(_) { - if (!arguments.length) return [[x0, y0], [x1, y1]]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - - graticule.step = function(_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - - graticule.stepMajor = function(_) { - if (!arguments.length) return [DX, DY]; - DX = +_[0], DY = +_[1]; - return graticule; - }; - - graticule.stepMinor = function(_) { - if (!arguments.length) return [dx, dy]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - - return graticule - .extentMajor([[-180, -90 + epsilon], [180, 90 - epsilon]]) - .extentMinor([[-180, -80 - epsilon], [180, 80 + epsilon]]); -} - -function graticule10() { - return graticule()(); -} - -function interpolate(a, b) { - var x0 = a[0] * radians, - y0 = a[1] * radians, - x1 = b[0] * radians, - y1 = b[1] * radians, - cy0 = cos(y0), - sy0 = sin(y0), - cy1 = cos(y1), - sy1 = sin(y1), - kx0 = cy0 * cos(x0), - ky0 = cy0 * sin(x0), - kx1 = cy1 * cos(x1), - ky1 = cy1 * sin(x1), - d = 2 * asin(sqrt(haversin(y1 - y0) + cy0 * cy1 * haversin(x1 - x0))), - k = sin(d); - - var interpolate = d ? function(t) { - var B = sin(t *= d) / k, - A = sin(d - t) / k, - x = A * kx0 + B * kx1, - y = A * ky0 + B * ky1, - z = A * sy0 + B * sy1; - return [ - atan2(y, x) * degrees, - atan2(z, sqrt(x * x + y * y)) * degrees - ]; - } : function() { - return [x0 * degrees, y0 * degrees]; - }; - - interpolate.distance = d; - - return interpolate; -} - -function identity(x) { - return x; -} - -var areaSum$1 = adder(), - areaRingSum$1 = adder(), - x00, - y00, - x0$1, - y0$1; - -var areaStream$1 = { - point: noop, - lineStart: noop, - lineEnd: noop, - polygonStart: function() { - areaStream$1.lineStart = areaRingStart$1; - areaStream$1.lineEnd = areaRingEnd$1; - }, - polygonEnd: function() { - areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop; - areaSum$1.add(abs(areaRingSum$1)); - areaRingSum$1.reset(); - }, - result: function() { - var area = areaSum$1 / 2; - areaSum$1.reset(); - return area; - } -}; - -function areaRingStart$1() { - areaStream$1.point = areaPointFirst$1; -} - -function areaPointFirst$1(x, y) { - areaStream$1.point = areaPoint$1; - x00 = x0$1 = x, y00 = y0$1 = y; -} - -function areaPoint$1(x, y) { - areaRingSum$1.add(y0$1 * x - x0$1 * y); - x0$1 = x, y0$1 = y; -} - -function areaRingEnd$1() { - areaPoint$1(x00, y00); -} - -var x0$2 = Infinity, - y0$2 = x0$2, - x1 = -x0$2, - y1 = x1; - -var boundsStream$1 = { - point: boundsPoint$1, - lineStart: noop, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop, - result: function() { - var bounds = [[x0$2, y0$2], [x1, y1]]; - x1 = y1 = -(y0$2 = x0$2 = Infinity); - return bounds; - } -}; - -function boundsPoint$1(x, y) { - if (x < x0$2) x0$2 = x; - if (x > x1) x1 = x; - if (y < y0$2) y0$2 = y; - if (y > y1) y1 = y; -} - -// TODO Enforce positive area for exterior, negative area for interior? - -var X0$1 = 0, - Y0$1 = 0, - Z0$1 = 0, - X1$1 = 0, - Y1$1 = 0, - Z1$1 = 0, - X2$1 = 0, - Y2$1 = 0, - Z2$1 = 0, - x00$1, - y00$1, - x0$3, - y0$3; - -var centroidStream$1 = { - point: centroidPoint$1, - lineStart: centroidLineStart$1, - lineEnd: centroidLineEnd$1, - polygonStart: function() { - centroidStream$1.lineStart = centroidRingStart$1; - centroidStream$1.lineEnd = centroidRingEnd$1; - }, - polygonEnd: function() { - centroidStream$1.point = centroidPoint$1; - centroidStream$1.lineStart = centroidLineStart$1; - centroidStream$1.lineEnd = centroidLineEnd$1; - }, - result: function() { - var centroid = 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 = Y0$1 = Z0$1 = - X1$1 = Y1$1 = Z1$1 = - X2$1 = Y2$1 = Z2$1 = 0; - return centroid; - } -}; - -function centroidPoint$1(x, y) { - X0$1 += x; - Y0$1 += y; - ++Z0$1; -} - -function centroidLineStart$1() { - centroidStream$1.point = centroidPointFirstLine; -} - -function centroidPointFirstLine(x, y) { - centroidStream$1.point = centroidPointLine; - centroidPoint$1(x0$3 = x, y0$3 = y); -} - -function centroidPointLine(x, y) { - var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy); - X1$1 += z * (x0$3 + x) / 2; - Y1$1 += z * (y0$3 + y) / 2; - Z1$1 += z; - centroidPoint$1(x0$3 = x, y0$3 = y); -} - -function centroidLineEnd$1() { - centroidStream$1.point = centroidPoint$1; -} - -function centroidRingStart$1() { - centroidStream$1.point = centroidPointFirstRing; -} - -function centroidRingEnd$1() { - centroidPointRing(x00$1, y00$1); -} - -function centroidPointFirstRing(x, y) { - centroidStream$1.point = centroidPointRing; - centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y); -} - -function centroidPointRing(x, y) { - var dx = x - x0$3, - dy = y - y0$3, - z = sqrt(dx * dx + dy * dy); - - X1$1 += z * (x0$3 + x) / 2; - Y1$1 += z * (y0$3 + y) / 2; - Z1$1 += z; - - z = y0$3 * x - x0$3 * y; - X2$1 += z * (x0$3 + x); - Y2$1 += z * (y0$3 + y); - Z2$1 += z * 3; - centroidPoint$1(x0$3 = x, y0$3 = y); -} - -function PathContext(context) { - this._context = context; -} - -PathContext.prototype = { - _radius: 4.5, - pointRadius: function(_) { - return this._radius = _, this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._context.moveTo(x, y); - this._point = 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); - break; - } - } - }, - result: noop -}; - -var lengthSum$1 = adder(), - lengthRing, - x00$2, - y00$2, - x0$4, - y0$4; - -var lengthStream$1 = { - point: noop, - lineStart: function() { - lengthStream$1.point = lengthPointFirst$1; - }, - lineEnd: function() { - if (lengthRing) lengthPoint$1(x00$2, y00$2); - lengthStream$1.point = noop; - }, - polygonStart: function() { - lengthRing = true; - }, - polygonEnd: function() { - lengthRing = null; - }, - result: function() { - var length = +lengthSum$1; - lengthSum$1.reset(); - return length; - } -}; - -function lengthPointFirst$1(x, y) { - lengthStream$1.point = lengthPoint$1; - x00$2 = x0$4 = x, y00$2 = y0$4 = y; -} - -function lengthPoint$1(x, y) { - x0$4 -= x, y0$4 -= y; - lengthSum$1.add(sqrt(x0$4 * x0$4 + y0$4 * y0$4)); - x0$4 = x, y0$4 = y; -} - -function PathString() { - this._string = []; -} - -PathString.prototype = { - _radius: 4.5, - _circle: circle$1(4.5), - pointRadius: function(_) { - if ((_ = +_) !== this._radius) this._radius = _, this._circle = null; - return this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._string.push("Z"); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._string.push("M", x, ",", y); - this._point = 1; - break; - } - case 1: { - this._string.push("L", x, ",", y); - break; - } - default: { - if (this._circle == null) this._circle = circle$1(this._radius); - this._string.push("M", x, ",", y, this._circle); - break; - } - } - }, - result: function() { - if (this._string.length) { - var result = this._string.join(""); - this._string = []; - 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(projection, context) { - var pointRadius = 4.5, - projectionStream, - contextStream; - - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - geoStream(object, projectionStream(contextStream)); - } - return contextStream.result(); - } - - path.area = function(object) { - geoStream(object, projectionStream(areaStream$1)); - return areaStream$1.result(); - }; - - path.measure = function(object) { - geoStream(object, projectionStream(lengthStream$1)); - return lengthStream$1.result(); - }; - - path.bounds = function(object) { - geoStream(object, projectionStream(boundsStream$1)); - return boundsStream$1.result(); - }; - - path.centroid = function(object) { - geoStream(object, projectionStream(centroidStream$1)); - return centroidStream$1.result(); - }; - - path.projection = function(_) { - return arguments.length ? (projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream, path) : projection; - }; - - path.context = function(_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - - return path.projection(projection).context(context); -} - -function transform(methods) { - return { - stream: transformer(methods) - }; -} - -function transformer(methods) { - return function(stream) { - var s = new TransformStream; - for (var key in methods) s[key] = methods[key]; - s.stream = stream; - return s; - }; -} - -function TransformStream() {} - -TransformStream.prototype = { - 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 = projection.clipExtent && projection.clipExtent(); - projection.scale(150).translate([0, 0]); - if (clip != null) projection.clipExtent(null); - geoStream(object, projection.stream(boundsStream$1)); - fitBounds(boundsStream$1.result()); - if (clip != null) projection.clipExtent(clip); - return projection; -} - -function fitExtent(projection, extent, object) { - return fit(projection, function(b) { - var w = extent[1][0] - extent[0][0], - h = extent[1][1] - extent[0][1], - k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), - x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, - y = +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 = +width, - k = w / (b[1][0] - b[0][0]), - x = (w - k * (b[1][0] + b[0][0])) / 2, - y = -k * b[0][1]; - projection.scale(150 * k).translate([x, y]); - }, object); -} - -function fitHeight(projection, height, object) { - return fit(projection, function(b) { - var h = +height, - k = h / (b[1][1] - b[0][1]), - x = -k * b[0][0], - y = (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([x, y]); - }, object); -} - -var maxDepth = 16, // maximum depth of subdivision - cosMinDistance = cos(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 = 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 = x1 - x0, - dy = y1 - y0, - d2 = dx * dx + dy * dy; - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, - b = b0 + b1, - c = c0 + c1, - m = sqrt(a * a + b * b + c * c), - phi2 = asin(c /= m), - lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a), - p = project(lambda2, phi2), - x2 = p[0], - y2 = p[1], - dx2 = x2 - x0, - dy2 = y2 - y0, - dz = 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 distance - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } - } - } - return function(stream) { - var lambda00, x00, y00, a00, b00, c00, // first point - lambda0, x0, y0, a0, b0, c0; // previous point - - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; }, - polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; } - }; - - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - - function linePoint(lambda, phi) { - var c = cartesian([lambda, phi]), p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - - return resampleStream; - }; -} - -var transformRadians = transformer({ - point: function(x, y) { - this.stream.point(x * radians, y * radians); - } -}); - -function transformRotate(rotate) { - return transformer({ - point: function(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); - } - }); -} - -function scaleTranslate(k, dx, dy, sx, sy) { - function transform(x, y) { - x *= sx; y *= sy; - return [dx + k * x, dy - k * y]; - } - transform.invert = function(x, y) { - return [(x - dx) / k * sx, (dy - y) / k * sy]; - }; - return transform; -} - -function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - var cosAlpha = cos(alpha), - sinAlpha = sin(alpha), - a = cosAlpha * k, - b = sinAlpha * k, - ai = cosAlpha / k, - bi = sinAlpha / k, - ci = (sinAlpha * dy - cosAlpha * dx) / k, - fi = (sinAlpha * dx + cosAlpha * dy) / k; - function transform(x, y) { - x *= sx; y *= sy; - return [a * x - b * y + dx, dy - b * x - a * y]; - } - transform.invert = function(x, y) { - return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)]; - }; - return transform; -} - -function projection(project) { - return projectionMutator(function() { return project; })(); -} - -function projectionMutator(projectAt) { - var project, - k = 150, // scale - x = 480, y = 250, // translate - lambda = 0, phi = 0, // center - deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate - alpha = 0, // post-rotate angle - sx = 1, // reflectX - sy = 1, // reflectX - theta = null, preclip = clipAntimeridian, // pre-clip angle - x0 = null, y0, x1, y1, postclip = identity, // post-clip extent - delta2 = 0.5, // precision - projectResample, - projectTransform, - projectRotateTransform, - cache, - cacheStream; - - function projection(point) { - return projectRotateTransform(point[0] * radians, point[1] * radians); - } - - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [point[0] * degrees, point[1] * degrees]; - } - - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); - }; - - projection.preclip = function(_) { - return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; - }; - - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - - projection.clipAngle = function(_) { - return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees; - }; - - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - projection.scale = function(_) { - return arguments.length ? (k = +_, recenter()) : k; - }; - - projection.translate = function(_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y]; - }; - - projection.center = function(_) { - return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees]; - }; - - projection.rotate = function(_) { - return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; - }; - - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees; - }; - - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; - }; - - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; - }; - - projection.precision = function(_) { - return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2); - }; - - projection.fitExtent = function(extent, object) { - return fitExtent(projection, extent, object); - }; - - projection.fitSize = function(size, object) { - return fitSize(projection, size, object); - }; - - projection.fitWidth = function(width, object) { - return fitWidth(projection, width, object); - }; - - projection.fitHeight = function(height, object) { - return fitHeight(projection, height, object); - }; - - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), - transform = (alpha ? scaleTranslateRotate : scaleTranslate)(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma); - projectTransform = compose(project, transform); - projectRotateTransform = compose(rotate, projectTransform); - projectResample = resample(projectTransform, delta2); - return reset(); - } - - function reset() { - cache = cacheStream = null; - return projection; - } - - return function() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; -} - -function conicProjection(projectAt) { - var phi0 = 0, - phi1 = pi / 3, - m = projectionMutator(projectAt), - p = m(phi0, phi1); - - p.parallels = function(_) { - return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees]; - }; - - return p; -} - -function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = cos(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, sin(phi) / cosPhi0]; - } - - forward.invert = function(x, y) { - return [x / cosPhi0, asin(y * cosPhi0)]; - }; - - return forward; -} - -function conicEqualAreaRaw(y0, y1) { - var sy0 = sin(y0), n = (sy0 + sin(y1)) / 2; - - // Are the parallels symmetrical around the Equator? - if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0); - - var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n; - - function project(x, y) { - var r = sqrt(c - 2 * n * sin(y)) / n; - return [r * sin(x *= n), r0 - r * cos(x)]; - } - - project.invert = function(x, y) { - var r0y = r0 - y, - l = atan2(x, abs(r0y)) * sign(r0y); - if (r0y * n < 0) - l -= pi * sign(x) * sign(r0y); - return [l / n, asin((c - (x * x + r0y * r0y) * 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 = streams.length; - return { - point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); }, - sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); }, - lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); }, - lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); }, - polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); }, - polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); } - }; -} - -// A composite projection for the United States, configured by default for -// 960×500. The projection also works quite well at 960×600 if you 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 = albers(), lower48Point, - alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338 - hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007 - point, pointStream = {point: function(x, y) { point = [x, y]; }}; - - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - return point = null, - (lower48Point.point(x, y), point) - || (alaskaPoint.point(x, y), point) - || (hawaiiPoint.point(x, y), 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); - }; - - albersUsa.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]); - }; - - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - - 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); - - alaskaPoint = alaska - .translate([x - 0.307 * k, y + 0.201 * k]) - .clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]]) - .stream(pointStream); - - hawaiiPoint = hawaii - .translate([x - 0.205 * k, y + 0.212 * k]) - .clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]]) - .stream(pointStream); - - return reset(); - }; - - albersUsa.fitExtent = function(extent, object) { - return fitExtent(albersUsa, extent, object); - }; - - albersUsa.fitSize = function(size, object) { - return fitSize(albersUsa, size, object); - }; - - albersUsa.fitWidth = function(width, object) { - return fitWidth(albersUsa, width, object); - }; - - albersUsa.fitHeight = function(height, object) { - return fitHeight(albersUsa, height, object); - }; - - function reset() { - cache = cacheStream = null; - return albersUsa; - } - - return albersUsa.scale(1070); -} - -function azimuthalRaw(scale) { - return function(x, y) { - var cx = cos(x), - cy = cos(y), - k = scale(cx * cy); - return [ - k * cy * sin(x), - k * sin(y) - ]; - } -} - -function azimuthalInvert(angle) { - return function(x, y) { - var z = sqrt(x * x + y * y), - c = angle(z), - sc = sin(c), - cc = cos(c); - return [ - atan2(x * sc, z * cc), - asin(z && y * sc / z) - ]; - } -} - -var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { - return sqrt(2 / (1 + cxcy)); -}); - -azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) { - return 2 * asin(z / 2); -}); - -function azimuthalEqualArea() { - return projection(azimuthalEqualAreaRaw) - .scale(124.75) - .clipAngle(180 - 1e-3); -} - -var azimuthalEquidistantRaw = azimuthalRaw(function(c) { - return (c = acos(c)) && c / sin(c); -}); - -azimuthalEquidistantRaw.invert = 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 + phi) / 2))]; -} - -mercatorRaw.invert = function(x, y) { - return [x, 2 * atan(exp(y)) - halfPi]; -}; - -function mercator() { - return mercatorProjection(mercatorRaw) - .scale(961 / tau); -} - -function mercatorProjection(project) { - var m = projection(project), - center = m.center, - scale = m.scale, - translate = m.translate, - clipExtent = m.clipExtent, - x0 = null, y0, x1, y1; // clip extent - - m.scale = function(_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - - m.translate = function(_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - - m.center = function(_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - - m.clipExtent = function(_) { - return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - function reclip() { - var k = pi * scale(), - t = m(rotation(m.rotate()).invert([0, 0])); - return clipExtent(x0 == null - ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === 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 + y) / 2); -} - -function conicConformalRaw(y0, y1) { - var cy0 = cos(y0), - n = y0 === y1 ? sin(y0) : log(cy0 / cos(y1)) / log(tany(y1) / tany(y0)), - f = cy0 * pow(tany(y0), n) / n; - - if (!n) return mercatorRaw; - - function project(x, y) { - if (f > 0) { if (y < -halfPi + epsilon) y = -halfPi + epsilon; } - else { if (y > halfPi - epsilon) y = halfPi - epsilon; } - var r = f / pow(tany(y), n); - return [r * sin(n * x), f - r * cos(n * x)]; - } - - project.invert = function(x, y) { - var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy), - l = atan2(x, abs(fy)) * sign(fy); - if (fy * n < 0) - l -= pi * sign(x) * sign(fy); - return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi]; - }; - - return project; -} - -function conicConformal() { - return conicProjection(conicConformalRaw) - .scale(109.5) - .parallels([30, 30]); -} - -function equirectangularRaw(lambda, phi) { - return [lambda, phi]; -} - -equirectangularRaw.invert = equirectangularRaw; - -function equirectangular() { - return projection(equirectangularRaw) - .scale(152.63); -} - -function conicEquidistantRaw(y0, y1) { - var cy0 = cos(y0), - n = y0 === y1 ? sin(y0) : (cy0 - cos(y1)) / (y1 - y0), - g = cy0 / n + y0; - - if (abs(n) < epsilon) return equirectangularRaw; - - function project(x, y) { - var gy = g - y, nx = n * x; - return [gy * sin(nx), g - gy * cos(nx)]; - } - - project.invert = function(x, y) { - var gy = g - y, - l = atan2(x, abs(gy)) * sign(gy); - if (gy * n < 0) - l -= pi * sign(x) * sign(gy); - return [l / n, g - sign(n) * sqrt(x * x + gy * gy)]; - }; - - return project; -} - -function conicEquidistant() { - return conicProjection(conicEquidistantRaw) - .scale(131.154) - .center([0, 13.9389]); -} - -var A1 = 1.340264, - A2 = -0.081106, - A3 = 0.000893, - A4 = 0.003796, - M = sqrt(3) / 2, - iterations = 12; - -function equalEarthRaw(lambda, phi) { - var l = asin(M * sin(phi)), l2 = l * l, l6 = l2 * l2 * l2; - return [ - lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), - l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - ]; -} - -equalEarthRaw.invert = function(x, y) { - var l = y, l2 = l * l, l6 = l2 * l2 * l2; - for (var i = 0, delta, fy, fpy; i < iterations; ++i) { - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if (abs(delta) < epsilon2) break; - } - return [ - M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l), - asin(sin(l) / M) - ]; -}; - -function equalEarth() { - return projection(equalEarthRaw) - .scale(177.158); -} - -function gnomonicRaw(x, y) { - var cy = cos(y), k = cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; -} - -gnomonicRaw.invert = azimuthalInvert(atan); - -function gnomonic() { - return projection(gnomonicRaw) - .scale(144.049) - .clipAngle(60); -} - -function identity$1() { - var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, // scale, translate and reflect - alpha = 0, ca, sa, // angle - x0 = null, y0, x1, y1, // clip extent - kx = 1, ky = 1, - transform = transformer({ - point: function(x, y) { - var p = projection([x, y]); - this.stream.point(p[0], p[1]); - } - }), - postclip = identity, - cache, - cacheStream; - - function reset() { - kx = k * sx; - ky = k * sy; - cache = cacheStream = null; - return projection; - } - - function projection (p) { - var x = p[0] * kx, y = p[1] * ky; - if (alpha) { - var t = y * ca - x * sa; - x = x * ca + y * sa; - y = t; - } - return [x + tx, y + ty]; - } - projection.invert = function(p) { - var x = p[0] - tx, y = p[1] - ty; - if (alpha) { - var t = y * ca + x * sa; - x = x * ca - y * sa; - y = t; - } - return [x / kx, y / ky]; - }; - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream)); - }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - projection.scale = function(_) { - return arguments.length ? (k = +_, reset()) : k; - }; - projection.translate = function(_) { - return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty]; - }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees; - }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0; - }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0; - }; - projection.fitExtent = function(extent, object) { - return fitExtent(projection, extent, object); - }; - projection.fitSize = function(size, object) { - return fitSize(projection, size, object); - }; - projection.fitWidth = function(width, object) { - return fitWidth(projection, width, object); - }; - projection.fitHeight = function(height, object) { - return fitHeight(projection, height, object); - }; - - return projection; -} - -function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2; - return [ - lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), - phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - ]; -} - -naturalEarth1Raw.invert = function(x, y) { - var phi = y, i = 25, delta; - do { - var phi2 = phi * phi, phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 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 && --i > 0); - return [ - x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), - phi - ]; -}; - -function naturalEarth1() { - return projection(naturalEarth1Raw) - .scale(175.295); -} - -function orthographicRaw(x, y) { - return [cos(y) * sin(x), sin(y)]; -} - -orthographicRaw.invert = azimuthalInvert(asin); - -function orthographic() { - return projection(orthographicRaw) - .scale(249.5) - .clipAngle(90 + epsilon); -} - -function stereographicRaw(x, y) { - var cy = cos(y), k = 1 + cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; -} - -stereographicRaw.invert = azimuthalInvert(function(z) { - return 2 * atan(z); -}); - -function stereographic() { - return projection(stereographicRaw) - .scale(250) - .clipAngle(142); -} - -function transverseMercatorRaw(lambda, phi) { - return [log(tan((halfPi + phi) / 2)), -lambda]; -} - -transverseMercatorRaw.invert = function(x, y) { - return [-y, 2 * atan(exp(x)) - halfPi]; -}; - -function transverseMercator() { - var m = mercatorProjection(transverseMercatorRaw), - center = m.center, - rotate = m.rotate; - - m.center = function(_) { - return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); - }; - - m.rotate = function(_) { - return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]); - }; - - return rotate([0, 0, 90]) - .scale(159.155); -} - -exports.geoAlbers = albers; -exports.geoAlbersUsa = albersUsa; -exports.geoArea = area; -exports.geoAzimuthalEqualArea = azimuthalEqualArea; -exports.geoAzimuthalEqualAreaRaw = azimuthalEqualAreaRaw; -exports.geoAzimuthalEquidistant = azimuthalEquidistant; -exports.geoAzimuthalEquidistantRaw = azimuthalEquidistantRaw; -exports.geoBounds = bounds; -exports.geoCentroid = centroid; -exports.geoCircle = circle; -exports.geoClipAntimeridian = clipAntimeridian; -exports.geoClipCircle = clipCircle; -exports.geoClipExtent = extent; -exports.geoClipRectangle = clipRectangle; -exports.geoConicConformal = conicConformal; -exports.geoConicConformalRaw = conicConformalRaw; -exports.geoConicEqualArea = conicEqualArea; -exports.geoConicEqualAreaRaw = conicEqualAreaRaw; -exports.geoConicEquidistant = conicEquidistant; -exports.geoConicEquidistantRaw = conicEquidistantRaw; -exports.geoContains = contains; -exports.geoDistance = distance; -exports.geoEqualEarth = equalEarth; -exports.geoEqualEarthRaw = equalEarthRaw; -exports.geoEquirectangular = equirectangular; -exports.geoEquirectangularRaw = equirectangularRaw; -exports.geoGnomonic = gnomonic; -exports.geoGnomonicRaw = gnomonicRaw; -exports.geoGraticule = graticule; -exports.geoGraticule10 = graticule10; -exports.geoIdentity = identity$1; -exports.geoInterpolate = interpolate; -exports.geoLength = length; -exports.geoMercator = mercator; -exports.geoMercatorRaw = mercatorRaw; -exports.geoNaturalEarth1 = naturalEarth1; -exports.geoNaturalEarth1Raw = naturalEarth1Raw; -exports.geoOrthographic = orthographic; -exports.geoOrthographicRaw = orthographicRaw; -exports.geoPath = index; -exports.geoProjection = projection; -exports.geoProjectionMutator = projectionMutator; -exports.geoRotation = rotation; -exports.geoStereographic = stereographic; -exports.geoStereographicRaw = stereographicRaw; -exports.geoStream = geoStream; -exports.geoTransform = transform; -exports.geoTransverseMercator = transverseMercator; -exports.geoTransverseMercatorRaw = transverseMercatorRaw; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/d3-geo/dist/d3-geo.min.js b/node_modules/d3-geo/dist/d3-geo.min.js deleted file mode 100644 index 94d7ce0..0000000 --- a/node_modules/d3-geo/dist/d3-geo.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-geo/ v1.12.1 Copyright 2020 Mike Bostock -!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],t):t((n=n||self).d3=n.d3||{},n.d3)}(this,(function(n,t){"use strict";function r(){return new i}function i(){this.reset()}i.prototype={constructor:i,reset:function(){this.s=this.t=0},add:function(n){o(e,n,this.t),o(this,e.s,this.s),this.s?this.t+=e.t:this.s=e.t},valueOf:function(){return this.s}};var e=new i;function o(n,t,r){var i=n.s=t+r,e=i-t,o=i-e;n.t=t-o+(r-e)}var u=1e-6,c=1e-12,a=Math.PI,l=a/2,f=a/4,s=2*a,p=180/a,h=a/180,g=Math.abs,v=Math.atan,d=Math.atan2,E=Math.cos,y=Math.ceil,S=Math.exp,m=Math.log,M=Math.pow,x=Math.sin,_=Math.sign||function(n){return n>0?1:n<0?-1:0},N=Math.sqrt,w=Math.tan;function R(n){return n>1?0:n<-1?a:Math.acos(n)}function C(n){return n>1?l:n<-1?-l:Math.asin(n)}function P(n){return(n=x(n/2))*n}function A(){}function j(n,t){n&&z.hasOwnProperty(n.type)&&z[n.type](n,t)}var q={Feature:function(n,t){j(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i=0?1:-1,e=i*r,o=E(t=(t*=h)/2+f),u=x(t),c=H*u,a=F*o+c*E(e),l=c*i*x(e);I.add(d(l,a)),k=n,F=o,H=u}function Z(n){return[d(n[1],n[0]),C(n[2])]}function J(n){var t=n[0],r=n[1],i=E(r);return[i*E(t),i*x(t),x(r)]}function K(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function Q(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function V(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function $(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function nn(n){var t=N(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var tn,rn,en,on,un,cn,an,ln,fn,sn,pn,hn,gn,vn,dn,En,yn,Sn,mn,Mn,xn,_n,Nn,wn,Rn,Cn,Pn=r(),An={point:jn,lineStart:zn,lineEnd:bn,polygonStart:function(){An.point=Ln,An.lineStart=On,An.lineEnd=Gn,Pn.reset(),X.polygonStart()},polygonEnd:function(){X.polygonEnd(),An.point=jn,An.lineStart=zn,An.lineEnd=bn,I<0?(tn=-(en=180),rn=-(on=90)):Pn>u?on=90:Pn<-u&&(rn=-90),sn[0]=tn,sn[1]=en},sphere:function(){tn=-(en=180),rn=-(on=90)}};function jn(n,t){fn.push(sn=[tn=n,en=n]),ton&&(on=t)}function qn(n,t){var r=J([n*h,t*h]);if(ln){var i=Q(ln,r),e=Q([i[1],-i[0],0],i);nn(e),e=Z(e);var o,u=n-un,c=u>0?1:-1,a=e[0]*p*c,l=g(u)>180;l^(c*unon&&(on=o):l^(c*un<(a=(a+360)%360-180)&&aon&&(on=t)),l?nTn(tn,en)&&(en=n):Tn(n,en)>Tn(tn,en)&&(tn=n):en>=tn?(nen&&(en=n)):n>un?Tn(tn,n)>Tn(tn,en)&&(en=n):Tn(n,en)>Tn(tn,en)&&(tn=n)}else fn.push(sn=[tn=n,en=n]);ton&&(on=t),ln=r,un=n}function zn(){An.point=qn}function bn(){sn[0]=tn,sn[1]=en,An.point=jn,ln=null}function Ln(n,t){if(ln){var r=n-un;Pn.add(g(r)>180?r+(r>0?360:-360):r)}else cn=n,an=t;X.point(n,t),qn(n,t)}function On(){X.lineStart()}function Gn(){Ln(cn,an),X.lineEnd(),g(Pn)>u&&(tn=-(en=180)),sn[0]=tn,sn[1]=en,ln=null}function Tn(n,t){return(t-=n)<0?t+360:t}function kn(n,t){return n[0]-t[0]}function Fn(n,t){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:ta?n+Math.round(-n/s)*s:n,t]}function nt(n,t,r){return(n%=s)?t||r?Vn(rt(n),it(t,r)):rt(n):t||r?it(t,r):$n}function tt(n){return function(t,r){return[(t+=n)>a?t-s:t<-a?t+s:t,r]}}function rt(n){var t=tt(n);return t.invert=tt(-n),t}function it(n,t){var r=E(n),i=x(n),e=E(t),o=x(t);function u(n,t){var u=E(t),c=E(n)*u,a=x(n)*u,l=x(t),f=l*r+c*i;return[d(a*e-f*o,c*r-l*i),C(f*e+a*o)]}return u.invert=function(n,t){var u=E(t),c=E(n)*u,a=x(n)*u,l=x(t),f=l*e-a*o;return[d(a*e+l*o,c*r+f*i),C(f*r-c*i)]},u}function et(n){function t(t){return(t=n(t[0]*h,t[1]*h))[0]*=p,t[1]*=p,t}return n=nt(n[0]*h,n[1]*h,n.length>2?n[2]*h:0),t.invert=function(t){return(t=n.invert(t[0]*h,t[1]*h))[0]*=p,t[1]*=p,t},t}function ot(n,t,r,i,e,o){if(r){var u=E(t),c=x(t),a=i*r;null==e?(e=t+i*s,o=t-a/2):(e=ut(u,e),o=ut(u,o),(i>0?eo)&&(e+=i*s));for(var l,f=e;i>0?f>o:f1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],n=null,r}}}function at(n,t){return g(n[0]-t[0])=0;--o)e.point((s=f[o])[0],s[1]);else i(h.x,h.p.x,-1,e);h=h.p}f=(h=h.o).z,g=!g}while(!h.v);e.lineEnd()}}}function st(n){if(t=n.length){for(var t,r,i=0,e=n[0];++i=0?1:-1,L=b*z,O=L>a,G=_*j;if(pt.add(d(G*b*x(L),N*q+G*E(L))),c+=O?z+b*s:z,O^m>=r^P>=r){var T=Q(J(S),J(R));nn(T);var k=Q(o,T);nn(k);var F=(O^z>=0?-1:1)*C(k[2]);(i>F||i===F&&(T[0]||T[1]))&&(p+=O^z>=0?1:-1)}}return(c<-u||c0){for(p||(o.polygonStart(),p=!0),o.lineStart(),n=0;n1&&2&e&&l.push(l.pop().concat(l.shift())),c.push(l.filter(dt))}return h}}function dt(n){return n.length>1}function Et(n,t){return((n=n.x)[0]<0?n[1]-l-u:l-n[1])-((t=t.x)[0]<0?t[1]-l-u:l-t[1])}var yt=vt((function(){return!0}),(function(n){var t,r=NaN,i=NaN,e=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,c){var f=o>0?a:-a,s=g(o-r);g(s-a)0?l:-l),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(f,i),n.point(o,i),t=0):e!==f&&s>=a&&(g(r-e)u?v((x(t)*(o=E(i))*x(r)-x(i)*(e=E(t))*x(n))/(e*o*c)):(t+i)/2}(r,i,o,c),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(f,i),t=0),n.point(r=o,i=c),e=f},lineEnd:function(){n.lineEnd(),r=i=NaN},clean:function(){return 2-t}}}),(function(n,t,r,i){var e;if(null==n)e=r*l,i.point(-a,e),i.point(0,e),i.point(a,e),i.point(a,0),i.point(a,-e),i.point(0,-e),i.point(-a,-e),i.point(-a,0),i.point(-a,e);else if(g(n[0]-t[0])>u){var o=n[0]0,e=g(t)>u;function o(n,r){return E(n)*E(r)>t}function c(n,r,i){var e=[1,0,0],o=Q(J(n),J(r)),c=K(o,o),l=o[0],f=c-l*l;if(!f)return!i&&n;var s=t*c/f,p=-t*l/f,h=Q(e,o),v=$(e,s);V(v,$(o,p));var d=h,E=K(v,d),y=K(d,d),S=E*E-y*(K(v,v)-1);if(!(S<0)){var m=N(S),M=$(d,(-E-m)/y);if(V(M,v),M=Z(M),!i)return M;var x,_=n[0],w=r[0],R=n[1],C=r[1];w<_&&(x=_,_=w,w=x);var P=w-_,A=g(P-a)0^M[1]<(g(M[0]-_)a^(_<=M[0]&&M[0]<=w)){var j=$(d,(-E+m)/y);return V(j,v),[M,Z(j)]}}}function l(t,r){var e=i?n:a-n,o=0;return t<-e?o|=1:t>e&&(o|=2),r<-e?o|=4:r>e&&(o|=8),o}return vt(o,(function(n){var t,r,u,f,s;return{lineStart:function(){f=u=!1,s=1},point:function(p,h){var g,v=[p,h],d=o(p,h),E=i?d?0:l(p,h):d?l(p+(p<0?a:-a),h):0;if(!t&&(f=u=d)&&n.lineStart(),d!==u&&(!(g=c(t,v))||at(t,g)||at(v,g))&&(v[2]=1),d!==u)s=0,d?(n.lineStart(),g=c(v,t),n.point(g[0],g[1])):(g=c(t,v),n.point(g[0],g[1],2),n.lineEnd()),t=g;else if(e&&t&&i^d){var y;E&r||!(y=c(v,t,!0))||(s=0,i?(n.lineStart(),n.point(y[0][0],y[0][1]),n.point(y[1][0],y[1][1]),n.lineEnd()):(n.point(y[1][0],y[1][1]),n.lineEnd(),n.lineStart(),n.point(y[0][0],y[0][1],3)))}!d||t&&at(t,v)||n.point(v[0],v[1]),t=v,u=d,r=E},lineEnd:function(){u&&n.lineEnd(),t=null},clean:function(){return s|(f&&u)<<1}}}),(function(t,i,e,o){ot(o,n,r,e,t,i)}),i?[0,-n]:[-a,n-a])}var mt=1e9,Mt=-mt;function xt(n,r,i,e){function o(t,o){return n<=t&&t<=i&&r<=o&&o<=e}function c(t,o,u,c){var l=0,s=0;if(null==t||(l=a(t,u))!==(s=a(o,u))||f(t,o)<0^u>0)do{c.point(0===l||3===l?n:i,l>1?e:r)}while((l=(l+u+4)%4)!==s);else c.point(o[0],o[1])}function a(t,e){return g(t[0]-n)0?0:3:g(t[0]-i)0?2:1:g(t[1]-r)0?1:0:e>0?3:2}function l(n,t){return f(n.x,t.x)}function f(n,t){var r=a(n,1),i=a(t,1);return r!==i?r-i:0===r?t[1]-n[1]:1===r?n[0]-t[0]:2===r?n[1]-t[1]:t[0]-n[0]}return function(u){var a,f,s,p,h,g,v,d,E,y,S,m=u,M=ct(),x={point:_,lineStart:function(){x.point=N,f&&f.push(s=[]);y=!0,E=!1,v=d=NaN},lineEnd:function(){a&&(N(p,h),g&&E&&M.rejoin(),a.push(M.result()));x.point=_,E&&m.lineEnd()},polygonStart:function(){m=M,a=[],f=[],S=!0},polygonEnd:function(){var r=function(){for(var t=0,r=0,i=f.length;re&&(p-o)*(e-u)>(h-u)*(n-o)&&++t:h<=e&&(p-o)*(e-u)<(h-u)*(n-o)&&--t;return t}(),i=S&&r,o=(a=t.merge(a)).length;(i||o)&&(u.polygonStart(),i&&(u.lineStart(),c(null,null,1,u),u.lineEnd()),o&&ft(a,l,r,c,u),u.polygonEnd());m=u,a=f=s=null}};function _(n,t){o(n,t)&&m.point(n,t)}function N(t,u){var c=o(t,u);if(f&&s.push([t,u]),y)p=t,h=u,g=c,y=!1,c&&(m.lineStart(),m.point(t,u));else if(c&&E)m.point(t,u);else{var a=[v=Math.max(Mt,Math.min(mt,v)),d=Math.max(Mt,Math.min(mt,d))],l=[t=Math.max(Mt,Math.min(mt,t)),u=Math.max(Mt,Math.min(mt,u))];!function(n,t,r,i,e,o){var u,c=n[0],a=n[1],l=0,f=1,s=t[0]-c,p=t[1]-a;if(u=r-c,s||!(u>0)){if(u/=s,s<0){if(u0){if(u>f)return;u>l&&(l=u)}if(u=e-c,s||!(u<0)){if(u/=s,s<0){if(u>f)return;u>l&&(l=u)}else if(s>0){if(u0)){if(u/=p,p<0){if(u0){if(u>f)return;u>l&&(l=u)}if(u=o-a,p||!(u<0)){if(u/=p,p<0){if(u>f)return;u>l&&(l=u)}else if(p>0){if(u0&&(n[0]=c+l*s,n[1]=a+l*p),f<1&&(t[0]=c+f*s,t[1]=a+f*p),!0}}}}}(a,l,n,r,i,e)?c&&(m.lineStart(),m.point(t,u),S=!1):(E||(m.lineStart(),m.point(a[0],a[1])),m.point(l[0],l[1]),c||m.lineEnd(),S=!1)}v=t,d=u,E=c}return x}}var _t,Nt,wt,Rt=r(),Ct={sphere:A,point:A,lineStart:function(){Ct.point=At,Ct.lineEnd=Pt},lineEnd:A,polygonStart:A,polygonEnd:A};function Pt(){Ct.point=Ct.lineEnd=A}function At(n,t){_t=n*=h,Nt=x(t*=h),wt=E(t),Ct.point=jt}function jt(n,t){n*=h;var r=x(t*=h),i=E(t),e=g(n-_t),o=E(e),u=i*x(e),c=wt*r-Nt*i*o,a=Nt*r+wt*i*o;Rt.add(d(N(u*u+c*c),a)),_t=n,Nt=r,wt=i}function qt(n){return Rt.reset(),O(n,Ct),+Rt}var zt=[null,null],bt={type:"LineString",coordinates:zt};function Lt(n,t){return zt[0]=n,zt[1]=t,qt(bt)}var Ot={Feature:function(n,t){return Tt(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i0&&(e=Lt(n[o],n[o-1]))>0&&r<=e&&i<=e&&(r+i-e)*(1-Math.pow((r-i)/e,2))u})).map(f)).concat(t.range(y(c/d)*d,o,d).filter((function(n){return g(n%S)>u})).map(s))}return M.lines=function(){return x().map((function(n){return{type:"LineString",coordinates:n}}))},M.outline=function(){return{type:"Polygon",coordinates:[p(e).concat(h(a).slice(1),p(i).reverse().slice(1),h(l).reverse().slice(1))]}},M.extent=function(n){return arguments.length?M.extentMajor(n).extentMinor(n):M.extentMinor()},M.extentMajor=function(n){return arguments.length?(e=+n[0][0],i=+n[1][0],l=+n[0][1],a=+n[1][1],e>i&&(n=e,e=i,i=n),l>a&&(n=l,l=a,a=n),M.precision(m)):[[e,l],[i,a]]},M.extentMinor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],c=+t[0][1],o=+t[1][1],r>n&&(t=r,r=n,n=t),c>o&&(t=c,c=o,o=t),M.precision(m)):[[r,c],[n,o]]},M.step=function(n){return arguments.length?M.stepMajor(n).stepMinor(n):M.stepMinor()},M.stepMajor=function(n){return arguments.length?(E=+n[0],S=+n[1],M):[E,S]},M.stepMinor=function(n){return arguments.length?(v=+n[0],d=+n[1],M):[v,d]},M.precision=function(t){return arguments.length?(m=+t,f=Xt(c,o,90),s=Yt(r,n,m),p=Xt(l,a,90),h=Yt(e,i,m),M):m},M.extentMajor([[-180,-90+u],[180,90-u]]).extentMinor([[-180,-80-u],[180,80+u]])}function Dt(n){return n}var Ut,Zt,Jt,Kt,Qt=r(),Vt=r(),$t={point:A,lineStart:A,lineEnd:A,polygonStart:function(){$t.lineStart=nr,$t.lineEnd=ir},polygonEnd:function(){$t.lineStart=$t.lineEnd=$t.point=A,Qt.add(g(Vt)),Vt.reset()},result:function(){var n=Qt/2;return Qt.reset(),n}};function nr(){$t.point=tr}function tr(n,t){$t.point=rr,Ut=Jt=n,Zt=Kt=t}function rr(n,t){Vt.add(Kt*n-Jt*t),Jt=n,Kt=t}function ir(){rr(Ut,Zt)}var er=1/0,or=er,ur=-er,cr=ur,ar={point:function(n,t){nur&&(ur=n);tcr&&(cr=t)},lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A,result:function(){var n=[[er,or],[ur,cr]];return ur=cr=-(or=er=1/0),n}};var lr,fr,sr,pr,hr=0,gr=0,vr=0,dr=0,Er=0,yr=0,Sr=0,mr=0,Mr=0,xr={point:_r,lineStart:Nr,lineEnd:Cr,polygonStart:function(){xr.lineStart=Pr,xr.lineEnd=Ar},polygonEnd:function(){xr.point=_r,xr.lineStart=Nr,xr.lineEnd=Cr},result:function(){var n=Mr?[Sr/Mr,mr/Mr]:yr?[dr/yr,Er/yr]:vr?[hr/vr,gr/vr]:[NaN,NaN];return hr=gr=vr=dr=Er=yr=Sr=mr=Mr=0,n}};function _r(n,t){hr+=n,gr+=t,++vr}function Nr(){xr.point=wr}function wr(n,t){xr.point=Rr,_r(sr=n,pr=t)}function Rr(n,t){var r=n-sr,i=t-pr,e=N(r*r+i*i);dr+=e*(sr+n)/2,Er+=e*(pr+t)/2,yr+=e,_r(sr=n,pr=t)}function Cr(){xr.point=_r}function Pr(){xr.point=jr}function Ar(){qr(lr,fr)}function jr(n,t){xr.point=qr,_r(lr=sr=n,fr=pr=t)}function qr(n,t){var r=n-sr,i=t-pr,e=N(r*r+i*i);dr+=e*(sr+n)/2,Er+=e*(pr+t)/2,yr+=e,Sr+=(e=pr*n-sr*t)*(sr+n),mr+=e*(pr+t),Mr+=3*e,_r(sr=n,pr=t)}function zr(n){this._context=n}zr.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:this._context.moveTo(n,t),this._point=1;break;case 1:this._context.lineTo(n,t);break;default:this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,s)}},result:A};var br,Lr,Or,Gr,Tr,kr=r(),Fr={point:A,lineStart:function(){Fr.point=Hr},lineEnd:function(){br&&Ir(Lr,Or),Fr.point=A},polygonStart:function(){br=!0},polygonEnd:function(){br=null},result:function(){var n=+kr;return kr.reset(),n}};function Hr(n,t){Fr.point=Ir,Lr=Gr=n,Or=Tr=t}function Ir(n,t){Gr-=n,Tr-=t,kr.add(N(Gr*Gr+Tr*Tr)),Gr=n,Tr=t}function Wr(){this._string=[]}function Xr(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Yr(n){return function(t){var r=new Br;for(var i in n)r[i]=n[i];return r.stream=t,r}}function Br(){}function Dr(n,t,r){var i=n.clipExtent&&n.clipExtent();return n.scale(150).translate([0,0]),null!=i&&n.clipExtent(null),O(r,n.stream(ar)),t(ar.result()),null!=i&&n.clipExtent(i),n}function Ur(n,t,r){return Dr(n,(function(r){var i=t[1][0]-t[0][0],e=t[1][1]-t[0][1],o=Math.min(i/(r[1][0]-r[0][0]),e/(r[1][1]-r[0][1])),u=+t[0][0]+(i-o*(r[1][0]+r[0][0]))/2,c=+t[0][1]+(e-o*(r[1][1]+r[0][1]))/2;n.scale(150*o).translate([u,c])}),r)}function Zr(n,t,r){return Ur(n,[[0,0],t],r)}function Jr(n,t,r){return Dr(n,(function(r){var i=+t,e=i/(r[1][0]-r[0][0]),o=(i-e*(r[1][0]+r[0][0]))/2,u=-e*r[0][1];n.scale(150*e).translate([o,u])}),r)}function Kr(n,t,r){return Dr(n,(function(r){var i=+t,e=i/(r[1][1]-r[0][1]),o=-e*r[0][0],u=(i-e*(r[1][1]+r[0][1]))/2;n.scale(150*e).translate([o,u])}),r)}Wr.prototype={_radius:4.5,_circle:Xr(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:this._string.push("M",n,",",t),this._point=1;break;case 1:this._string.push("L",n,",",t);break;default:null==this._circle&&(this._circle=Xr(this._radius)),this._string.push("M",n,",",t,this._circle)}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}return null}},Br.prototype={constructor:Br,point:function(n,t){this.stream.point(n,t)},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()}};var Qr=16,Vr=E(30*h);function $r(n,t){return+t?function(n,t){function r(i,e,o,c,a,l,f,s,p,h,v,E,y,S){var m=f-i,M=s-e,x=m*m+M*M;if(x>4*t&&y--){var _=c+h,w=a+v,R=l+E,P=N(_*_+w*w+R*R),A=C(R/=P),j=g(g(R)-1)t||g((m*L+M*O)/x-.5)>.3||c*h+a*v+l*E2?n[2]%360*h:0,z()):[y*p,S*p,m*p]},j.angle=function(n){return arguments.length?(M=n%360*h,z()):M*p},j.reflectX=function(n){return arguments.length?(x=n?-1:1,z()):x<0},j.reflectY=function(n){return arguments.length?(_=n?-1:1,z()):_<0},j.precision=function(n){return arguments.length?(u=$r(c,A=n*n),b()):N(A)},j.fitExtent=function(n,t){return Ur(j,n,t)},j.fitSize=function(n,t){return Zr(j,n,t)},j.fitWidth=function(n,t){return Jr(j,n,t)},j.fitHeight=function(n,t){return Kr(j,n,t)},function(){return t=n.apply(this,arguments),j.invert=t.invert&&q,z()}}function oi(n){var t=0,r=a/3,i=ei(n),e=i(t,r);return e.parallels=function(n){return arguments.length?i(t=n[0]*h,r=n[1]*h):[t*p,r*p]},e}function ui(n,t){var r=x(n),i=(r+x(t))/2;if(g(i)0?t<-l+u&&(t=-l+u):t>l-u&&(t=l-u);var r=e/M(vi(t),i);return[r*x(i*n),e-r*E(i*n)]}return o.invert=function(n,t){var r=e-t,o=_(i)*N(n*n+r*r),u=d(n,g(r))*_(r);return r*i<0&&(u-=a*_(n)*_(r)),[u/i,2*v(M(e/o,1/i))-l]},o}function Ei(n,t){return[n,t]}function yi(n,t){var r=E(n),i=n===t?x(n):(r-E(t))/(t-n),e=r/i+n;if(g(i)u&&--e>0);return[n/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},Ci.invert=fi(C),Pi.invert=fi((function(n){return 2*v(n)})),Ai.invert=function(n,t){return[-t,2*v(S(n))-l]},n.geoAlbers=ai,n.geoAlbersUsa=function(){var n,t,r,i,e,o,c=ai(),a=ci().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ci().rotate([157,0]).center([-3,19.9]).parallels([8,18]),f={point:function(n,t){o=[n,t]}};function s(n){var t=n[0],u=n[1];return o=null,r.point(t,u),o||(i.point(t,u),o)||(e.point(t,u),o)}function p(){return n=t=null,s}return s.invert=function(n){var t=c.scale(),r=c.translate(),i=(n[0]-r[0])/t,e=(n[1]-r[1])/t;return(e>=.12&&e<.234&&i>=-.425&&i<-.214?a:e>=.166&&e<.234&&i>=-.214&&i<-.115?l:c).invert(n)},s.stream=function(r){return n&&t===r?n:(i=[c.stream(t=r),a.stream(r),l.stream(r)],e=i.length,n={point:function(n,t){for(var r=-1;++rTn(i[0],i[1])&&(i[1]=e[1]),Tn(e[0],i[1])>Tn(i[0],i[1])&&(i[0]=e[0])):o.push(i=e);for(u=-1/0,t=0,i=o[r=o.length-1];t<=r;i=e,++t)e=o[t],(c=Tn(i[1],e[0]))>u&&(u=c,tn=e[0],en=i[1])}return fn=sn=null,tn===1/0||rn===1/0?[[NaN,NaN],[NaN,NaN]]:[[tn,rn],[en,on]]},n.geoCentroid=function(n){pn=hn=gn=vn=dn=En=yn=Sn=mn=Mn=xn=0,O(n,Hn);var t=mn,r=Mn,i=xn,e=t*t+r*r+i*i;return e2?n[2]+90:90]):[(n=r())[0],n[1],n[2]-90]},r([0,0,90]).scale(159.155)},n.geoTransverseMercatorRaw=Ai,Object.defineProperty(n,"__esModule",{value:!0})})); diff --git a/node_modules/d3-geo/node_modules/d3-array/.eslintrc.json b/node_modules/d3-geo/node_modules/d3-array/.eslintrc.json deleted file mode 100644 index 8287875..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/.eslintrc.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "eslint:recommended", - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 8 - }, - "env": { - "es6": true, - "node": true, - "browser": true - }, - "rules": { - "no-cond-assign": 0 - } -} diff --git a/node_modules/d3-geo/node_modules/d3-array/LICENSE b/node_modules/d3-geo/node_modules/d3-array/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-geo/node_modules/d3-array/README.md b/node_modules/d3-geo/node_modules/d3-array/README.md deleted file mode 100644 index 17df6e2..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/README.md +++ /dev/null @@ -1,382 +0,0 @@ -# d3-array - -Data in JavaScript is often represented by an array, and so one tends to manipulate arrays when visualizing or analyzing data. Some common forms of manipulation include taking a contiguous slice (subset) of an array, filtering an array using a predicate function, and mapping an array to a parallel set of values using a transform function. Before looking at the set of utilities that this module provides, familiarize yourself with the powerful [array methods built-in to JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype). - -JavaScript includes **mutation methods** that modify the array: - -* [*array*.pop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) - Remove the last element from the array. -* [*array*.push](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) - Add one or more elements to the end of the array. -* [*array*.reverse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) - Reverse the order of the elements of the array. -* [*array*.shift](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) - Remove the first element from the array. -* [*array*.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) - Sort the elements of the array. -* [*array*.splice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) - Add or remove elements from the array. -* [*array*.unshift](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) - Add one or more elements to the front of the array. - -There are also **access methods** that return some representation of the array: - -* [*array*.concat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) - Join the array with other array(s) or value(s). -* [*array*.join](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join) - Join all elements of the array into a string. -* [*array*.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) - Extract a section of the array. -* [*array*.indexOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) - Find the first occurrence of a value within the array. -* [*array*.lastIndexOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf) - Find the last occurrence of a value within the array. - -And finally **iteration methods** that apply functions to elements in the array: - -* [*array*.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) - Create a new array with only the elements for which a predicate is true. -* [*array*.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) - Call a function for each element in the array. -* [*array*.every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) - See if every element in the array satisfies a predicate. -* [*array*.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) - Create a new array with the result of calling a function on every element in the array. -* [*array*.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) - See if at least one element in the array satisfies a predicate. -* [*array*.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) - Apply a function to reduce the array to a single value (from left-to-right). -* [*array*.reduceRight](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight) - Apply a function to reduce the array to a single value (from right-to-left). - -## Installing - -If you use NPM, `npm install d3-array`. Otherwise, download the [latest release](https://github.com/d3/d3-array/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-array.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -[Try d3-array in your browser.](https://tonicdev.com/npm/d3-array) - -## API Reference - -* [Statistics](#statistics) -* [Search](#search) -* [Transformations](#transformations) -* [Histograms](#histograms) -* [Histogram Thresholds](#histogram-thresholds) - -### Statistics - -Methods for computing basic summary statistics. - -# d3.min(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/min.js "Source") - -Returns the minimum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the minimum value. - -Unlike the built-in [Math.min](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/min), this method ignores undefined, null and NaN values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the minimum of the strings [“20”, “3”] is “20”, while the minimum of the numbers [20, 3] is 3. - -See also [scan](#scan) and [extent](#extent). - -# d3.max(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/max.js "Source") - -Returns the maximum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the maximum value. - -Unlike the built-in [Math.max](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/max), this method ignores undefined values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the maximum of the strings [“20”, “3”] is “3”, while the maximum of the numbers [20, 3] is 20. - -See also [scan](#scan) and [extent](#extent). - -# d3.extent(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/extent.js "Source") - -Returns the [minimum](#min) and [maximum](#max) value in the given *array* using natural order. If the array is empty, returns [undefined, undefined]. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the extent. - -# d3.sum(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/sum.js "Source") - -Returns the sum of the given *array* of numbers. If the array is empty, returns 0. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the sum. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.mean(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/mean.js "Source") - -Returns the mean of the given *array* of numbers. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the mean. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.median(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/median.js "Source") - -Returns the median of the given *array* of numbers using the [R-7 method](https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample). If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the median. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.quantile(array, p[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/quantile.js "Source") - -Returns the *p*-quantile of the given **sorted** *array* of numbers, where *p* is a number in the range [0, 1]. For example, the median can be computed using *p* = 0.5, the first quartile at *p* = 0.25, and the third quartile at *p* = 0.75. This particular implementation uses the [R-7 method](http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population), which is the default for the R programming language and Excel. For example: - -```js -var a = [0, 10, 30]; -d3.quantile(a, 0); // 0 -d3.quantile(a, 0.5); // 10 -d3.quantile(a, 1); // 30 -d3.quantile(a, 0.25); // 5 -d3.quantile(a, 0.75); // 20 -d3.quantile(a, 0.1); // 2 -``` - -An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the quantile. - -# d3.variance(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/variance.js "Source") - -Returns an [unbiased estimator of the population variance](http://mathworld.wolfram.com/SampleVariance.html) of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the variance. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -# d3.deviation(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/deviation.js "Source") - -Returns the standard deviation, defined as the square root of the [bias-corrected variance](#variance), of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the standard deviation. This method ignores undefined and NaN values; this is useful for ignoring missing data. - -### Search - -Methods for searching arrays for a specific element. - -# d3.scan(array[, comparator]) [<>](https://github.com/d3/d3-array/blob/master/src/scan.js "Source") - -Performs a linear scan of the specified *array*, returning the index of the least element according to the specified *comparator*. If the given *array* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns undefined. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: - -```js -var array = [{foo: 42}, {foo: 91}]; -d3.scan(array, function(a, b) { return a.foo - b.foo; }); // 0 -d3.scan(array, function(a, b) { return b.foo - a.foo; }); // 1 -``` - -This function is similar to [min](#min), except it allows the use of a comparator rather than an accessor and it returns the index instead of the accessed value. See also [bisect](#bisect). - -# d3.bisectLeft(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisect.js#L6 "Source") - -Returns the insertion point for *x* in *array* to maintain sorted order. The arguments *lo* and *hi* may be used to specify a subset of the array which should be considered; by default the entire array is used. If *x* is already present in *array*, the insertion point will be before (to the left of) any existing entries. The return value is suitable for use as the first argument to [splice](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice) assuming that *array* is already sorted. The returned insertion point *i* partitions the *array* into two halves so that all *v* < *x* for *v* in *array*.slice(*lo*, *i*) for the left side and all *v* >= *x* for *v* in *array*.slice(*i*, *hi*) for the right side. - -# d3.bisect(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisect.js "Source")
-# d3.bisectRight(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisect.js#L6 "Source") - -Similar to [bisectLeft](#bisectLeft), but returns an insertion point which comes after (to the right of) any existing entries of *x* in *array*. The returned insertion point *i* partitions the *array* into two halves so that all *v* <= *x* for *v* in *array*.slice(*lo*, *i*) for the left side and all *v* > *x* for *v* in *array*.slice(*i*, *hi*) for the right side. - -# d3.bisector(accessor) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js "Source") -
# d3.bisector(comparator) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js "Source") - -Returns a new bisector using the specified *accessor* or *comparator* function. This method can be used to bisect arrays of objects instead of being limited to simple arrays of primitives. For example, given the following array of objects: - -```js -var data = [ - {date: new Date(2011, 1, 1), value: 0.5}, - {date: new Date(2011, 2, 1), value: 0.6}, - {date: new Date(2011, 3, 1), value: 0.7}, - {date: new Date(2011, 4, 1), value: 0.8} -]; -``` - -A suitable bisect function could be constructed as: - -```js -var bisectDate = d3.bisector(function(d) { return d.date; }).right; -``` - -This is equivalent to specifying a comparator: - -```js -var bisectDate = d3.bisector(function(d, x) { return d.date - x; }).right; -``` - -And then applied as *bisectDate*(*array*, *date*), returning an index. Note that the comparator is always passed the search value *x* as the second argument. Use a comparator rather than an accessor if you want values to be sorted in an order different than natural order, such as in descending rather than ascending order. - -# bisector.left(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js#L6 "Source") - -Equivalent to [bisectLeft](#bisectLeft), but uses this bisector’s associated comparator. - -# bisector.right(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js#L16 "Source") - -Equivalent to [bisectRight](#bisectRight), but uses this bisector’s associated comparator. - -# d3.ascending(a, b) [<>](https://github.com/d3/d3-array/blob/master/src/ascending.js "Source") - -Returns -1 if *a* is less than *b*, or 1 if *a* is greater than *b*, or 0. This is the comparator function for natural order, and can be used in conjunction with the built-in [*array*.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) method to arrange elements in ascending order. It is implemented as: - -```js -function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} -``` - -Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic (alphabetical), not natural! This can lead to surprising behavior when sorting an array of numbers. - -# d3.descending(a, b) [<>](https://github.com/d3/d3-array/blob/master/src/descending.js "Source") - -Returns -1 if *a* is greater than *b*, or 1 if *a* is less than *b*, or 0. This is the comparator function for reverse natural order, and can be used in conjunction with the built-in array sort method to arrange elements in descending order. It is implemented as: - -```js -function descending(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} -``` - -Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic (alphabetical), not natural! This can lead to surprising behavior when sorting an array of numbers. - -### Transformations - -Methods for transforming arrays and for generating new arrays. - -# d3.cross(a, b[, reducer]) [<>](https://github.com/d3/d3-array/blob/master/src/cross.js "Source") - -Returns the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the two arrays *a* and *b*. For each element *i* in the specified array *a* and each element *j* in the specified array *b*, in order, invokes the specified *reducer* function passing the element *i* and element *j*. If a *reducer* is not specified, it defaults to a function which creates a two-element array for each pair: - -```js -function pair(a, b) { - return [a, b]; -} -``` - -For example: - -```js -d3.cross([1, 2], ["x", "y"]); // returns [[1, "x"], [1, "y"], [2, "x"], [2, "y"]] -d3.cross([1, 2], ["x", "y"], (a, b) => a + b); // returns ["1x", "1y", "2x", "2y"] -``` - -# d3.merge(arrays) [<>](https://github.com/d3/d3-array/blob/master/src/merge.js "Source") - -Merges the specified *arrays* into a single array. This method is similar to the built-in array concat method; the only difference is that it is more convenient when you have an array of arrays. - -```js -d3.merge([[1], [2, 3]]); // returns [1, 2, 3] -``` - -# d3.pairs(array[, reducer]) [<>](https://github.com/d3/d3-array/blob/master/src/pairs.js "Source") - -For each adjacent pair of elements in the specified *array*, in order, invokes the specified *reducer* function passing the element *i* and element *i* - 1. If a *reducer* is not specified, it defaults to a function which creates a two-element array for each pair: - -```js -function pair(a, b) { - return [a, b]; -} -``` - -For example: - -```js -d3.pairs([1, 2, 3, 4]); // returns [[1, 2], [2, 3], [3, 4]] -d3.pairs([1, 2, 3, 4], (a, b) => b - a); // returns [1, 1, 1]; -``` - -If the specified array has fewer than two elements, returns the empty array. - -# d3.permute(array, indexes) [<>](https://github.com/d3/d3-array/blob/master/src/permute.js "Source") - -Returns a permutation of the specified *array* using the specified array of *indexes*. The returned array contains the corresponding element in array for each index in indexes, in order. For example, permute(["a", "b", "c"], [1, 2, 0]) -returns ["b", "c", "a"]. It is acceptable for the array of indexes to be a different length from the array of elements, and for indexes to be duplicated or omitted. - -This method can also be used to extract the values from an object into an array with a stable order. Extracting keyed values in order can be useful for generating data arrays in nested selections. For example: - -```js -var object = {yield: 27, variety: "Manchuria", year: 1931, site: "University Farm"}, - fields = ["site", "variety", "yield"]; - -d3.permute(object, fields); // returns ["University Farm", "Manchuria", 27] -``` - -# d3.shuffle(array[, start[, stop]]) [<>](https://github.com/d3/d3-array/blob/master/src/shuffle.js "Source") - -Randomizes the order of the specified *array* in-place using the [Fisher–Yates shuffle](https://bost.ocks.org/mike/shuffle/) and returns the *array*. If *start* is specified, it is the starting index (inclusive) of the *array* to shuffle; if *start* is not specified, it defaults to zero. If *stop* is specified, it is the ending index (exclusive) of the *array* to shuffle; if *stop* is not specified, it defaults to *array*.length. For example, to shuffle the first ten elements of the *array*: shuffle(*array*, 0, 10). - -# d3.ticks(start, stop, count) [<>](https://github.com/d3/d3-array/blob/master/src/ticks.js "Source") - -Returns an array of approximately *count* + 1 uniformly-spaced, nicely-rounded values between *start* and *stop* (inclusive). Each value is a power of ten multiplied by 1, 2 or 5. See also [d3.tickIncrement](#tickIncrement), [d3.tickStep](#tickStep) and [*linear*.ticks](https://github.com/d3/d3-scale/blob/master/README.md#linear_ticks). - -Ticks are inclusive in the sense that they may include the specified *start* and *stop* values if (and only if) they are exact, nicely-rounded values consistent with the inferred [step](#tickStep). More formally, each returned tick *t* satisfies *start* ≤ *t* and *t* ≤ *stop*. - -# d3.tickIncrement(start, stop, count) [<>](https://github.com/d3/d3-array/blob/master/src/ticks.js#L16 "Source") - -Like [d3.tickStep](#tickStep), except requires that *start* is always less than or equal to *step*, and if the tick step for the given *start*, *stop* and *count* would be less than one, returns the negative inverse tick step instead. This method is always guaranteed to return an integer, and is used by [d3.ticks](#ticks) to avoid guarantee that the returned tick values are represented as precisely as possible in IEEE 754 floating point. - -# d3.tickStep(start, stop, count) [<>](https://github.com/d3/d3-array/blob/master/src/ticks.js#L16 "Source") - -Returns the difference between adjacent tick values if the same arguments were passed to [d3.ticks](#ticks): a nicely-rounded value that is a power of ten multiplied by 1, 2 or 5. Note that due to the limited precision of IEEE 754 floating point, the returned value may not be exact decimals; use [d3-format](https://github.com/d3/d3-format) to format numbers for human consumption. - -# d3.range([start, ]stop[, step]) [<>](https://github.com/d3/d3-array/blob/master/src/range.js "Source") - -Returns an array containing an arithmetic progression, similar to the Python built-in [range](http://docs.python.org/library/functions.html#range). This method is often used to iterate over a sequence of uniformly-spaced numeric values, such as the indexes of an array or the ticks of a linear scale. (See also [d3.ticks](#ticks) for nicely-rounded values.) - -If *step* is omitted, it defaults to 1. If *start* is omitted, it defaults to 0. The *stop* value is exclusive; it is not included in the result. If *step* is positive, the last element is the largest *start* + *i* \* *step* less than *stop*; if *step* is negative, the last element is the smallest *start* + *i* \* *step* greater than *stop*. If the returned array would contain an infinite number of values, an empty range is returned. - -The arguments are not required to be integers; however, the results are more predictable if they are. The values in the returned array are defined as *start* + *i* \* *step*, where *i* is an integer from zero to one minus the total number of elements in the returned array. For example: - -```js -d3.range(0, 1, 0.2) // [0, 0.2, 0.4, 0.6000000000000001, 0.8] -``` - -This unexpected behavior is due to IEEE 754 double-precision floating point, which defines 0.2 * 3 = 0.6000000000000001. Use [d3-format](https://github.com/d3/d3-format) to format numbers for human consumption with appropriate rounding; see also [linear.tickFormat](https://github.com/d3/d3-scale/blob/master/README.md#linear_tickFormat) in [d3-scale](https://github.com/d3/d3-scale). - -Likewise, if the returned array should have a specific length, consider using [array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on an integer range. For example: - -```js -d3.range(0, 1, 1 / 49); // BAD: returns 50 elements! -d3.range(49).map(function(d) { return d / 49; }); // GOOD: returns 49 elements. -``` - -# d3.transpose(matrix) [<>](https://github.com/d3/d3-array/blob/master/src/transpose.js "Source") - -Uses the [zip](#zip) operator as a two-dimensional [matrix transpose](http://en.wikipedia.org/wiki/Transpose). - -# d3.zip(arrays…) [<>](https://github.com/d3/d3-array/blob/master/src/zip.js "Source") - -Returns an array of arrays, where the *i*th array contains the *i*th element from each of the argument *arrays*. The returned array is truncated in length to the shortest array in *arrays*. If *arrays* contains only a single array, the returned array contains one-element arrays. With no arguments, the returned array is empty. - -```js -d3.zip([1, 2], [3, 4]); // returns [[1, 3], [2, 4]] -``` - -### Histograms - -[Histogram](http://bl.ocks.org/mbostock/3048450) - -Histograms bin many discrete samples into a smaller number of consecutive, non-overlapping intervals. They are often used to visualize the distribution of numerical data. - -# d3.histogram() [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js "Source") - -Constructs a new histogram generator with the default settings. - -# histogram(data) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L14 "Source") - -Computes the histogram for the given array of *data* samples. Returns an array of bins, where each bin is an array containing the associated elements from the input *data*. Thus, the `length` of the bin is the number of elements in that bin. Each bin has two additional attributes: - -* `x0` - the lower bound of the bin (inclusive). -* `x1` - the upper bound of the bin (exclusive, except for the last bin). - -# histogram.value([value]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L58 "Source") - -If *value* is specified, sets the value accessor to the specified function or constant and returns this histogram generator. If *value* is not specified, returns the current value accessor, which defaults to the identity function. - -When a histogram is [generated](#_histogram), the value accessor will be invoked for each element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. The default value accessor assumes that the input data are orderable (comparable), such as numbers or dates. If your data are not, then you should specify an accessor that returns the corresponding orderable value for a given datum. - -This is similar to mapping your data to values before invoking the histogram generator, but has the benefit that the input data remains associated with the returned bins, thereby making it easier to access other fields of the data. - -# histogram.domain([domain]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L62 "Source") - -If *domain* is specified, sets the domain accessor to the specified function or array and returns this histogram generator. If *domain* is not specified, returns the current domain accessor, which defaults to [extent](#extent). The histogram domain is defined as an array [*min*, *max*], where *min* is the minimum observable value and *max* is the maximum observable value; both values are inclusive. Any value outside of this domain will be ignored when the histogram is [generated](#_histogram). - -For example, if you are using the the histogram in conjunction with a [linear scale](https://github.com/d3/d3-scale/blob/master/README.md#linear-scales) `x`, you might say: - -```js -var histogram = d3.histogram() - .domain(x.domain()) - .thresholds(x.ticks(20)); -``` - -You can then compute the bins from an array of numbers like so: - -```js -var bins = histogram(numbers); -``` - -Note that the domain accessor is invoked on the materialized array of [values](#histogram_value), not on the input data array. - -# histogram.thresholds([count]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L66 "Source") -
# histogram.thresholds([thresholds]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L66 "Source") - -If *thresholds* is specified, sets the [threshold generator](#histogram-thresholds) to the specified function or array and returns this histogram generator. If *thresholds* is not specified, returns the current threshold generator, which by default implements [Sturges’ formula](#thresholdSturges). (Thus by default, the histogram values must be numbers!) Thresholds are defined as an array of values [*x0*, *x1*, …]. Any value less than *x0* will be placed in the first bin; any value greater than or equal to *x0* but less than *x1* will be placed in the second bin; and so on. Thus, the [generated histogram](#_histogram) will have *thresholds*.length + 1 bins. See [histogram thresholds](#histogram-thresholds) for more information. - -Any threshold values outside the [domain](#histogram_domain) are ignored. The first *bin*.x0 is always equal to the minimum domain value, and the last *bin*.x1 is always equal to the maximum domain value. - -If a *count* is specified instead of an array of *thresholds*, then the [domain](#histogram_domain) will be uniformly divided into approximately *count* bins; see [ticks](#ticks). - -### Histogram Thresholds - -These functions are typically not used directly; instead, pass them to [*histogram*.thresholds](#histogram_thresholds). You may also implement your own threshold generator taking three arguments: the array of input [*values*](#histogram_value) derived from the data, and the [observable domain](#histogram_domain) represented as *min* and *max*. The generator may then return either the array of numeric thresholds or the *count* of bins; in the latter case the domain is divided uniformly into approximately *count* bins; see [ticks](#ticks). - -# d3.thresholdFreedmanDiaconis(values, min, max) [<>](https://github.com/d3/d3-array/blob/master/src/threshold/freedmanDiaconis.js "Source") - -Returns the number of bins according to the [Freedman–Diaconis rule](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. - -# d3.thresholdScott(values, min, max) [<>](https://github.com/d3/d3-array/blob/master/src/threshold/scott.js "Source") - -Returns the number of bins according to [Scott’s normal reference rule](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. - -# d3.thresholdSturges(values) [<>](https://github.com/d3/d3-array/blob/master/src/threshold/sturges.js "Source") - -Returns the number of bins according to [Sturges’ formula](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. diff --git a/node_modules/d3-geo/node_modules/d3-array/dist/d3-array.js b/node_modules/d3-geo/node_modules/d3-array/dist/d3-array.js deleted file mode 100644 index 89d17e7..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/dist/d3-array.js +++ /dev/null @@ -1,590 +0,0 @@ -// https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(factory((global.d3 = global.d3 || {}))); -}(this, (function (exports) { 'use strict'; - -function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; -} - -function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; -} - -var ascendingBisect = bisector(ascending); -var bisectRight = ascendingBisect.right; -var bisectLeft = ascendingBisect.left; - -function pairs(array, f) { - if (f == null) f = pair; - var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); - while (i < n) pairs[i] = f(p, p = array[++i]); - return pairs; -} - -function pair(a, b) { - return [a, b]; -} - -function cross(values0, values1, reduce) { - var n0 = values0.length, - n1 = values1.length, - values = new Array(n0 * n1), - i0, - i1, - i, - value0; - - if (reduce == null) reduce = pair; - - for (i0 = i = 0; i0 < n0; ++i0) { - for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) { - values[i] = reduce(value0, values1[i1]); - } - } - - return values; -} - -function descending(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} - -function number(x) { - return x === null ? NaN : +x; -} - -function variance(values, valueof) { - var n = values.length, - m = 0, - i = -1, - mean = 0, - value, - delta, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } - } - } - - if (m > 1) return sum / (m - 1); -} - -function deviation(array, f) { - var v = variance(array, f); - return v ? Math.sqrt(v) : v; -} - -function extent(values, valueof) { - var n = values.length, - i = -1, - value, - min, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - } - - return [min, max]; -} - -var array = Array.prototype; - -var slice = array.slice; -var map = array.map; - -function constant(x) { - return function() { - return x; - }; -} - -function identity(x) { - return x; -} - -function range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} - -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; -} - -function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} - -function sturges(values) { - return Math.ceil(Math.log(values.length) / Math.LN2) + 1; -} - -function histogram() { - var value = identity, - domain = extent, - threshold = sturges; - - function histogram(data) { - var i, - n = data.length, - x, - values = new Array(n); - - for (i = 0; i < n; ++i) { - values[i] = value(data[i], i, data); - } - - var xz = domain(values), - x0 = xz[0], - x1 = xz[1], - tz = threshold(values, x0, x1); - - // Convert number of thresholds into uniform thresholds. - if (!Array.isArray(tz)) { - tz = tickStep(x0, x1, tz); - tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive - } - - // Remove any thresholds outside the domain. - var m = tz.length; - while (tz[0] <= x0) tz.shift(), --m; - while (tz[m - 1] > x1) tz.pop(), --m; - - var bins = new Array(m + 1), - bin; - - // Initialize bins. - for (i = 0; i <= m; ++i) { - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - - // Assign data to bins by value, ignoring any outside the domain. - for (i = 0; i < n; ++i) { - x = values[i]; - if (x0 <= x && x <= x1) { - bins[bisectRight(tz, x, 0, m)].push(data[i]); - } - } - - return bins; - } - - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; - }; - - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; - }; - - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; - }; - - return histogram; -} - -function quantile(values, p, valueof) { - if (valueof == null) valueof = number; - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} - -function freedmanDiaconis(values, min, max) { - values = map.call(values, number).sort(ascending); - return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(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.length, -1 / 3))); -} - -function max(values, valueof) { - var n = values.length, - i = -1, - value, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && value > max) { - max = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && value > max) { - max = value; - } - } - } - } - } - - return max; -} - -function mean(values, valueof) { - var n = values.length, - m = n, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) sum += value; - else --m; - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value; - else --m; - } - } - - if (m) return sum / m; -} - -function median(values, valueof) { - var n = values.length, - i = -1, - value, - numbers = []; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - numbers.push(value); - } - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - numbers.push(value); - } - } - } - - return quantile(numbers.sort(ascending), 0.5); -} - -function merge(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; -} - -function min(values, valueof) { - var n = values.length, - i = -1, - value, - min; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && min > value) { - min = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && min > value) { - min = value; - } - } - } - } - } - - return min; -} - -function permute(array, indexes) { - var i = indexes.length, permutes = new Array(i); - while (i--) permutes[i] = array[indexes[i]]; - return permutes; -} - -function scan(values, compare) { - if (!(n = values.length)) return; - var n, - i = 0, - j = 0, - xi, - xj = values[j]; - - if (compare == null) compare = ascending; - - while (++i < n) { - if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) { - xj = xi, j = i; - } - } - - if (compare(xj, xj) === 0) return j; -} - -function shuffle(array, i0, i1) { - var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +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; -} - -function sum(values, valueof) { - var n = values.length, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (value = +values[i]) sum += value; // Note: zero and null are equivalent. - } - } - - else { - while (++i < n) { - if (value = +valueof(values[i], i, values)) sum += value; - } - } - - return sum; -} - -function transpose(matrix) { - if (!(n = matrix.length)) return []; - for (var i = -1, m = min(matrix, length), 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 length(d) { - return d.length; -} - -function zip() { - return transpose(arguments); -} - -exports.bisect = bisectRight; -exports.bisectRight = bisectRight; -exports.bisectLeft = bisectLeft; -exports.ascending = ascending; -exports.bisector = bisector; -exports.cross = cross; -exports.descending = descending; -exports.deviation = deviation; -exports.extent = extent; -exports.histogram = histogram; -exports.thresholdFreedmanDiaconis = freedmanDiaconis; -exports.thresholdScott = scott; -exports.thresholdSturges = sturges; -exports.max = max; -exports.mean = mean; -exports.median = median; -exports.merge = merge; -exports.min = min; -exports.pairs = pairs; -exports.permute = permute; -exports.quantile = quantile; -exports.range = range; -exports.scan = scan; -exports.shuffle = shuffle; -exports.sum = sum; -exports.ticks = ticks; -exports.tickIncrement = tickIncrement; -exports.tickStep = tickStep; -exports.transpose = transpose; -exports.variance = variance; -exports.zip = zip; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/d3-geo/node_modules/d3-array/dist/d3-array.min.js b/node_modules/d3-geo/node_modules/d3-array/dist/d3-array.min.js deleted file mode 100644 index c8d0f31..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/dist/d3-array.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock -!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.d3=n.d3||{})}(this,function(n){"use strict";function r(n,r){return nr?1:n>=r?0:NaN}function t(n){var t;return 1===n.length&&(t=n,n=function(n,e){return r(t(n),e)}),{left:function(r,t,e,o){for(null==e&&(e=0),null==o&&(o=r.length);e>>1;n(r[u],t)<0?e=u+1:o=u}return e},right:function(r,t,e,o){for(null==e&&(e=0),null==o&&(o=r.length);e>>1;n(r[u],t)>0?o=u:e=u+1}return e}}}var e=t(r),o=e.right,u=e.left;function f(n,r){return[n,r]}function l(n){return null===n?NaN:+n}function i(n,r){var t,e,o=n.length,u=0,f=-1,i=0,a=0;if(null==r)for(;++f1)return a/(u-1)}function a(n,r){var t=i(n,r);return t?Math.sqrt(t):t}function h(n,r){var t,e,o,u=n.length,f=-1;if(null==r){for(;++f=t)for(e=o=t;++ft&&(e=t),o=t)for(e=o=t;++ft&&(e=t),o=0?(u>=d?10:u>=y?5:u>=N?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(u>=d?10:u>=y?5:u>=N?2:1)}function w(n,r,t){var e=Math.abs(r-n)/Math.max(0,t),o=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),u=e/o;return u>=d?o*=10:u>=y?o*=5:u>=N&&(o*=2),r=1)return+t(n[e-1],e-1,n);var e,o=(e-1)*r,u=Math.floor(o),f=+t(n[u],u,n);return f+(+t(n[u+1],u+1,n)-f)*(o-u)}}function b(n,r){var t,e,o=n.length,u=-1;if(null==r){for(;++u=t)for(e=t;++ut&&(e=t)}else for(;++u=t)for(e=t;++ut&&(e=t);return e}function q(n){if(!(o=n.length))return[];for(var r=-1,t=b(n,L),e=new Array(t);++rn?1:r>=n?0:NaN},n.deviation=a,n.extent=h,n.histogram=function(){var n=M,r=h,t=A;function e(e){var u,f,l=e.length,i=new Array(l);for(u=0;uc;)s.pop(),--g;var v,M=new Array(g+1);for(u=0;u<=g;++u)(v=M[u]=[]).x0=u>0?s[u-1]:h,v.x1=u=t)for(e=t;++ue&&(e=t)}else for(;++u=t)for(e=t;++ue&&(e=t);return e},n.mean=function(n,r){var t,e=n.length,o=e,u=-1,f=0;if(null==r)for(;++u=0;)for(r=(e=n[o]).length;--r>=0;)t[--f]=e[r];return t},n.min=b,n.pairs=function(n,r){null==r&&(r=f);for(var t=0,e=n.length-1,o=n[0],u=new Array(e<0?0:e);t0)return[n];if((e=r0)for(n=Math.ceil(n/f),r=Math.floor(r/f),u=new Array(o=Math.ceil(r-n+1));++l /^d3-/.test(key)), - output: { - file: `dist/${meta.name}.js`, - name: "d3", - format: "umd", - indent: false, - extend: true, - banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`, - globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) - }, - plugins: [] -}; - -export default [ - config, - { - ...config, - output: { - ...config.output, - file: `dist/${meta.name}.min.js` - }, - plugins: [ - ...config.plugins, - terser({ - output: { - preamble: config.output.banner - } - }) - ] - } -]; diff --git a/node_modules/d3-geo/node_modules/d3-array/src/array.js b/node_modules/d3-geo/node_modules/d3-array/src/array.js deleted file mode 100644 index 8008403..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/array.js +++ /dev/null @@ -1,4 +0,0 @@ -var array = Array.prototype; - -export var slice = array.slice; -export var map = array.map; diff --git a/node_modules/d3-geo/node_modules/d3-array/src/ascending.js b/node_modules/d3-geo/node_modules/d3-array/src/ascending.js deleted file mode 100644 index 21a4b8f..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/ascending.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/bisect.js b/node_modules/d3-geo/node_modules/d3-array/src/bisect.js deleted file mode 100644 index a4be741..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/bisect.js +++ /dev/null @@ -1,7 +0,0 @@ -import ascending from "./ascending"; -import bisector from "./bisector"; - -var ascendingBisect = bisector(ascending); -export var bisectRight = ascendingBisect.right; -export var bisectLeft = ascendingBisect.left; -export default bisectRight; diff --git a/node_modules/d3-geo/node_modules/d3-array/src/bisector.js b/node_modules/d3-geo/node_modules/d3-array/src/bisector.js deleted file mode 100644 index bbab44a..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/bisector.js +++ /dev/null @@ -1,33 +0,0 @@ -import ascending from "./ascending"; - -export default function(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; -} - -function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/constant.js b/node_modules/d3-geo/node_modules/d3-array/src/constant.js deleted file mode 100644 index b7d42e7..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(x) { - return function() { - return x; - }; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/cross.js b/node_modules/d3-geo/node_modules/d3-array/src/cross.js deleted file mode 100644 index 26d9b4c..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/cross.js +++ /dev/null @@ -1,21 +0,0 @@ -import {pair} from "./pairs"; - -export default function(values0, values1, reduce) { - var n0 = values0.length, - n1 = values1.length, - values = new Array(n0 * n1), - i0, - i1, - i, - value0; - - if (reduce == null) reduce = pair; - - for (i0 = i = 0; i0 < n0; ++i0) { - for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) { - values[i] = reduce(value0, values1[i1]); - } - } - - return values; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/descending.js b/node_modules/d3-geo/node_modules/d3-array/src/descending.js deleted file mode 100644 index a4e2d7f..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/descending.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/deviation.js b/node_modules/d3-geo/node_modules/d3-array/src/deviation.js deleted file mode 100644 index 48e6618..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/deviation.js +++ /dev/null @@ -1,6 +0,0 @@ -import variance from "./variance"; - -export default function(array, f) { - var v = variance(array, f); - return v ? Math.sqrt(v) : v; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/extent.js b/node_modules/d3-geo/node_modules/d3-array/src/extent.js deleted file mode 100644 index 3650407..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/extent.js +++ /dev/null @@ -1,37 +0,0 @@ -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - min, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } - } - } - - return [min, max]; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/histogram.js b/node_modules/d3-geo/node_modules/d3-array/src/histogram.js deleted file mode 100644 index 8cb7f48..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/histogram.js +++ /dev/null @@ -1,75 +0,0 @@ -import {slice} from "./array"; -import bisect from "./bisect"; -import constant from "./constant"; -import extent from "./extent"; -import identity from "./identity"; -import range from "./range"; -import {tickStep} from "./ticks"; -import sturges from "./threshold/sturges"; - -export default function() { - var value = identity, - domain = extent, - threshold = sturges; - - function histogram(data) { - var i, - n = data.length, - x, - values = new Array(n); - - for (i = 0; i < n; ++i) { - values[i] = value(data[i], i, data); - } - - var xz = domain(values), - x0 = xz[0], - x1 = xz[1], - tz = threshold(values, x0, x1); - - // Convert number of thresholds into uniform thresholds. - if (!Array.isArray(tz)) { - tz = tickStep(x0, x1, tz); - tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive - } - - // Remove any thresholds outside the domain. - var m = tz.length; - while (tz[0] <= x0) tz.shift(), --m; - while (tz[m - 1] > x1) tz.pop(), --m; - - var bins = new Array(m + 1), - bin; - - // Initialize bins. - for (i = 0; i <= m; ++i) { - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - - // Assign data to bins by value, ignoring any outside the domain. - for (i = 0; i < n; ++i) { - x = values[i]; - if (x0 <= x && x <= x1) { - bins[bisect(tz, x, 0, m)].push(data[i]); - } - } - - return bins; - } - - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; - }; - - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; - }; - - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; - }; - - return histogram; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/identity.js b/node_modules/d3-geo/node_modules/d3-array/src/identity.js deleted file mode 100644 index b2f94b2..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/identity.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x) { - return x; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/index.js b/node_modules/d3-geo/node_modules/d3-array/src/index.js deleted file mode 100644 index 1d2b3a7..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -export {default as bisect, bisectRight, bisectLeft} from "./bisect"; -export {default as ascending} from "./ascending"; -export {default as bisector} from "./bisector"; -export {default as cross} from "./cross"; -export {default as descending} from "./descending"; -export {default as deviation} from "./deviation"; -export {default as extent} from "./extent"; -export {default as histogram} from "./histogram"; -export {default as thresholdFreedmanDiaconis} from "./threshold/freedmanDiaconis"; -export {default as thresholdScott} from "./threshold/scott"; -export {default as thresholdSturges} from "./threshold/sturges"; -export {default as max} from "./max"; -export {default as mean} from "./mean"; -export {default as median} from "./median"; -export {default as merge} from "./merge"; -export {default as min} from "./min"; -export {default as pairs} from "./pairs"; -export {default as permute} from "./permute"; -export {default as quantile} from "./quantile"; -export {default as range} from "./range"; -export {default as scan} from "./scan"; -export {default as shuffle} from "./shuffle"; -export {default as sum} from "./sum"; -export {default as ticks, tickIncrement, tickStep} from "./ticks"; -export {default as transpose} from "./transpose"; -export {default as variance} from "./variance"; -export {default as zip} from "./zip"; diff --git a/node_modules/d3-geo/node_modules/d3-array/src/max.js b/node_modules/d3-geo/node_modules/d3-array/src/max.js deleted file mode 100644 index db45a0f..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/max.js +++ /dev/null @@ -1,34 +0,0 @@ -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && value > max) { - max = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && value > max) { - max = value; - } - } - } - } - } - - return max; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/mean.js b/node_modules/d3-geo/node_modules/d3-array/src/mean.js deleted file mode 100644 index de4b4bb..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/mean.js +++ /dev/null @@ -1,25 +0,0 @@ -import number from "./number"; - -export default function(values, valueof) { - var n = values.length, - m = n, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) sum += value; - else --m; - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value; - else --m; - } - } - - if (m) return sum / m; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/median.js b/node_modules/d3-geo/node_modules/d3-array/src/median.js deleted file mode 100644 index 75df453..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/median.js +++ /dev/null @@ -1,28 +0,0 @@ -import ascending from "./ascending"; -import number from "./number"; -import quantile from "./quantile"; - -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - numbers = []; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - numbers.push(value); - } - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - numbers.push(value); - } - } - } - - return quantile(numbers.sort(ascending), 0.5); -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/merge.js b/node_modules/d3-geo/node_modules/d3-array/src/merge.js deleted file mode 100644 index d08221e..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/merge.js +++ /dev/null @@ -1,21 +0,0 @@ -export default 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; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/min.js b/node_modules/d3-geo/node_modules/d3-array/src/min.js deleted file mode 100644 index 8c0807a..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/min.js +++ /dev/null @@ -1,34 +0,0 @@ -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - min; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && min > value) { - min = value; - } - } - } - } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && min > value) { - min = value; - } - } - } - } - } - - return min; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/number.js b/node_modules/d3-geo/node_modules/d3-array/src/number.js deleted file mode 100644 index 3768189..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/number.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x) { - return x === null ? NaN : +x; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/pairs.js b/node_modules/d3-geo/node_modules/d3-array/src/pairs.js deleted file mode 100644 index 644dc23..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/pairs.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function(array, f) { - if (f == null) f = pair; - var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); - while (i < n) pairs[i] = f(p, p = array[++i]); - return pairs; -} - -export function pair(a, b) { - return [a, b]; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/permute.js b/node_modules/d3-geo/node_modules/d3-array/src/permute.js deleted file mode 100644 index cd19524..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/permute.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(array, indexes) { - var i = indexes.length, permutes = new Array(i); - while (i--) permutes[i] = array[indexes[i]]; - return permutes; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/quantile.js b/node_modules/d3-geo/node_modules/d3-array/src/quantile.js deleted file mode 100644 index 889b793..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/quantile.js +++ /dev/null @@ -1,14 +0,0 @@ -import number from "./number"; - -export default function(values, p, valueof) { - if (valueof == null) valueof = number; - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/range.js b/node_modules/d3-geo/node_modules/d3-array/src/range.js deleted file mode 100644 index 5975601..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/range.js +++ /dev/null @@ -1,13 +0,0 @@ -export default function(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/scan.js b/node_modules/d3-geo/node_modules/d3-array/src/scan.js deleted file mode 100644 index 98115b2..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/scan.js +++ /dev/null @@ -1,20 +0,0 @@ -import ascending from "./ascending"; - -export default function(values, compare) { - if (!(n = values.length)) return; - var n, - i = 0, - j = 0, - xi, - xj = values[j]; - - if (compare == null) compare = ascending; - - while (++i < n) { - if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) { - xj = xi, j = i; - } - } - - if (compare(xj, xj) === 0) return j; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/shuffle.js b/node_modules/d3-geo/node_modules/d3-array/src/shuffle.js deleted file mode 100644 index 02c6676..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/shuffle.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function(array, i0, i1) { - var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +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; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/sum.js b/node_modules/d3-geo/node_modules/d3-array/src/sum.js deleted file mode 100644 index a9ce82b..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/sum.js +++ /dev/null @@ -1,20 +0,0 @@ -export default function(values, valueof) { - var n = values.length, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (value = +values[i]) sum += value; // Note: zero and null are equivalent. - } - } - - else { - while (++i < n) { - if (value = +valueof(values[i], i, values)) sum += value; - } - } - - return sum; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/threshold/freedmanDiaconis.js b/node_modules/d3-geo/node_modules/d3-array/src/threshold/freedmanDiaconis.js deleted file mode 100644 index 8cc07fb..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/threshold/freedmanDiaconis.js +++ /dev/null @@ -1,9 +0,0 @@ -import {map} from "../array"; -import ascending from "../ascending"; -import number from "../number"; -import quantile from "../quantile"; - -export default function(values, min, max) { - values = map.call(values, number).sort(ascending); - return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3))); -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/threshold/scott.js b/node_modules/d3-geo/node_modules/d3-array/src/threshold/scott.js deleted file mode 100644 index dc6e0b7..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/threshold/scott.js +++ /dev/null @@ -1,5 +0,0 @@ -import deviation from "../deviation"; - -export default function(values, min, max) { - return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3))); -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/threshold/sturges.js b/node_modules/d3-geo/node_modules/d3-array/src/threshold/sturges.js deleted file mode 100644 index 28ac9bd..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/threshold/sturges.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(values) { - return Math.ceil(Math.log(values.length) / Math.LN2) + 1; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/ticks.js b/node_modules/d3-geo/node_modules/d3-array/src/ticks.js deleted file mode 100644 index e9553fe..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/ticks.js +++ /dev/null @@ -1,51 +0,0 @@ -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -export default function(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; -} - -export function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -export function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/transpose.js b/node_modules/d3-geo/node_modules/d3-array/src/transpose.js deleted file mode 100644 index a2eb406..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/transpose.js +++ /dev/null @@ -1,15 +0,0 @@ -import min from "./min"; - -export default function(matrix) { - if (!(n = matrix.length)) return []; - for (var i = -1, m = min(matrix, length), 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 length(d) { - return d.length; -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/variance.js b/node_modules/d3-geo/node_modules/d3-array/src/variance.js deleted file mode 100644 index 09da08e..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/variance.js +++ /dev/null @@ -1,33 +0,0 @@ -import number from "./number"; - -export default function(values, valueof) { - var n = values.length, - m = 0, - i = -1, - mean = 0, - value, - delta, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } - } - } - - if (m > 1) return sum / (m - 1); -} diff --git a/node_modules/d3-geo/node_modules/d3-array/src/zip.js b/node_modules/d3-geo/node_modules/d3-array/src/zip.js deleted file mode 100644 index e9a8898..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/src/zip.js +++ /dev/null @@ -1,5 +0,0 @@ -import transpose from "./transpose"; - -export default function() { - return transpose(arguments); -} diff --git a/node_modules/d3-geo/node_modules/d3-array/yarn.lock b/node_modules/d3-geo/node_modules/d3-array/yarn.lock deleted file mode 100644 index 5cbda40..0000000 --- a/node_modules/d3-geo/node_modules/d3-array/yarn.lock +++ /dev/null @@ -1,939 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/code-frame@^7.0.0-beta.47": - version "7.0.0-rc.3" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-rc.3.tgz#d77a587401f818a3168700f596e41cd6905947b2" - dependencies: - "@babel/highlight" "7.0.0-rc.3" - -"@babel/highlight@7.0.0-rc.3": - version "7.0.0-rc.3" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-rc.3.tgz#c2ee83f8e5c0c387279a8c48e06fef2e32027004" - dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^4.0.0" - -"@types/estree@0.0.39": - version "0.0.39" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" - -"@types/node@*": - version "10.9.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.1.tgz#06f002136fbcf51e730995149050bb3c45ee54e6" - -acorn-jsx@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-4.1.1.tgz#e8e41e48ea2fe0c896740610ab6a4ffd8add225e" - dependencies: - acorn "^5.0.3" - -acorn@^5.0.3, acorn@^5.6.0: - version "5.7.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.2.tgz#91fa871883485d06708800318404e72bfb26dcc5" - -ajv-keywords@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" - -ajv@^6.0.1, ajv@^6.5.0: - version "6.5.3" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.3.tgz#71a569d189ecf4f4f321224fecb166f071dd90f9" - dependencies: - fast-deep-equal "^2.0.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ansi-escapes@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - dependencies: - color-convert "^1.9.0" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - dependencies: - sprintf-js "~1.0.2" - -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - dependencies: - array-uniq "^1.0.1" - -array-uniq@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - -arrify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - -babel-code-frame@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" - dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - dependencies: - callsites "^0.2.0" - -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - -chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -chalk@^2.0.0, chalk@^2.1.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chardet@^0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" - -circular-json@^0.3.1: - version "0.3.3" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" - -cli-cursor@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" - dependencies: - restore-cursor "^2.0.0" - -cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - -color-convert@^1.9.0: - version "1.9.2" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" - dependencies: - color-name "1.1.1" - -color-name@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" - -commander@~2.16.0: - version "2.16.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -cross-spawn@^6.0.5: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -debug@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - dependencies: - ms "2.0.0" - -deep-equal@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" - -deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - -define-properties@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" - dependencies: - object-keys "^1.0.12" - -defined@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" - -del@^2.0.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" - dependencies: - globby "^5.0.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - rimraf "^2.2.8" - -doctrine@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" - dependencies: - esutils "^2.0.2" - -es-abstract@^1.5.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" - dependencies: - es-to-primitive "^1.1.1" - function-bind "^1.1.1" - has "^1.0.1" - is-callable "^1.1.3" - is-regex "^1.0.4" - -es-to-primitive@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" - dependencies: - is-callable "^1.1.1" - is-date-object "^1.0.1" - is-symbol "^1.0.1" - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -eslint-scope@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - -eslint-utils@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" - -eslint-visitor-keys@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" - -eslint@5: - version "5.4.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.4.0.tgz#d068ec03006bb9e06b429dc85f7e46c1b69fac62" - dependencies: - ajv "^6.5.0" - babel-code-frame "^6.26.0" - chalk "^2.1.0" - cross-spawn "^6.0.5" - debug "^3.1.0" - doctrine "^2.1.0" - eslint-scope "^4.0.0" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^4.0.0" - esquery "^1.0.1" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.7.0" - ignore "^4.0.2" - imurmurhash "^0.1.4" - inquirer "^5.2.0" - is-resolvable "^1.1.0" - js-yaml "^3.11.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.5" - minimatch "^3.0.4" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" - progress "^2.0.0" - regexpp "^2.0.0" - require-uncached "^1.0.3" - semver "^5.5.0" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" - table "^4.0.3" - text-table "^0.2.0" - -espree@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-4.0.0.tgz#253998f20a0f82db5d866385799d912a83a36634" - dependencies: - acorn "^5.6.0" - acorn-jsx "^4.1.1" - -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - -esquery@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" - dependencies: - estraverse "^4.0.0" - -esrecurse@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" - dependencies: - estraverse "^4.1.0" - -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: - version "4.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" - -esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" - -external-editor@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" - dependencies: - chardet "^0.4.0" - iconv-lite "^0.4.17" - tmp "^0.0.33" - -fast-deep-equal@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" - -fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - -fast-levenshtein@~2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - -figures@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" - dependencies: - escape-string-regexp "^1.0.5" - -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" - dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" - -flat-cache@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" - dependencies: - circular-json "^0.3.1" - del "^2.0.2" - graceful-fs "^4.1.2" - write "^0.2.1" - -for-each@~0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" - dependencies: - is-callable "^1.1.3" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - -glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@~7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^11.7.0: - version "11.7.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" - -globby@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" - dependencies: - array-union "^1.0.1" - arrify "^1.0.0" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - dependencies: - ansi-regex "^2.0.0" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - -has@^1.0.1, has@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - dependencies: - function-bind "^1.1.1" - -iconv-lite@^0.4.17: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - dependencies: - safer-buffer ">= 2.1.2 < 3" - -ignore@^4.0.2: - version "4.0.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -inquirer@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-5.2.0.tgz#db350c2b73daca77ff1243962e9f22f099685726" - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^2.1.0" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rxjs "^5.5.2" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - -is-callable@^1.1.1, is-callable@^1.1.3: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" - -is-date-object@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" - -is-path-in-cwd@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" - dependencies: - is-path-inside "^1.0.0" - -is-path-inside@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" - dependencies: - path-is-inside "^1.0.1" - -is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - -is-regex@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" - dependencies: - has "^1.0.1" - -is-resolvable@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" - -is-symbol@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - -js-tokens@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - -js-yaml@^3.11.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - -json-stable-stringify-without-jsonify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - -levn@^0.3.0, levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0: - version "4.17.10" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" - -mimic-fn@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" - -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - -mute-stream@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - -nice-try@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" - -object-assign@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -object-inspect@~1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" - -object-keys@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -onetime@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" - dependencies: - mimic-fn "^1.0.0" - -optionator@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.4" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - wordwrap "~1.0.0" - -os-tmpdir@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -path-is-inside@^1.0.1, path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - -path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - -path-parse@^1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - -pify@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - -pluralize@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" - -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - -progress@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" - -punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - -regexpp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365" - -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - -resolve@~1.7.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3" - dependencies: - path-parse "^1.0.5" - -restore-cursor@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" - dependencies: - onetime "^2.0.0" - signal-exit "^3.0.2" - -resumer@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" - dependencies: - through "~2.3.4" - -rimraf@^2.2.8: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - dependencies: - glob "^7.0.5" - -rollup-plugin-terser@1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-1.0.1.tgz#ba5f497cbc9aa38ba19d3ee2167c04ea3ed279af" - dependencies: - "@babel/code-frame" "^7.0.0-beta.47" - terser "^3.7.5" - -rollup@0.64: - version "0.64.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.64.1.tgz#9188ee368e5fcd43ffbc00ec414e72eeb5de87ba" - dependencies: - "@types/estree" "0.0.39" - "@types/node" "*" - -run-async@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" - dependencies: - is-promise "^2.1.0" - -rxjs@^5.5.2: - version "5.5.11" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.11.tgz#f733027ca43e3bec6b994473be4ab98ad43ced87" - dependencies: - symbol-observable "1.0.1" - -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - -seedrandom@2: - version "2.4.4" - resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-2.4.4.tgz#b25ea98632c73e45f58b77cfaa931678df01f9ba" - -semver@^5.5.0: - version "5.5.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" - -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - dependencies: - shebang-regex "^1.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - -signal-exit@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - -slice-ansi@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" - dependencies: - is-fullwidth-code-point "^2.0.0" - -source-map-support@~0.5.6: - version "0.5.9" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - -string-width@^2.1.0, string-width@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string.prototype.trim@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" - dependencies: - define-properties "^1.1.2" - es-abstract "^1.5.0" - function-bind "^1.0.2" - -strip-ansi@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - dependencies: - ansi-regex "^3.0.0" - -strip-json-comments@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - dependencies: - has-flag "^3.0.0" - -symbol-observable@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" - -table@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" - dependencies: - ajv "^6.0.1" - ajv-keywords "^3.0.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" - -tape@4: - version "4.9.1" - resolved "https://registry.yarnpkg.com/tape/-/tape-4.9.1.tgz#1173d7337e040c76fbf42ec86fcabedc9b3805c9" - dependencies: - deep-equal "~1.0.1" - defined "~1.0.0" - for-each "~0.3.3" - function-bind "~1.1.1" - glob "~7.1.2" - has "~1.0.3" - inherits "~2.0.3" - minimist "~1.2.0" - object-inspect "~1.6.0" - resolve "~1.7.1" - resumer "~0.0.0" - string.prototype.trim "~1.1.2" - through "~2.3.8" - -terser@^3.7.5: - version "3.8.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-3.8.1.tgz#cb70070ac9e0a71add169dfb63c0a64fca2738ac" - dependencies: - commander "~2.16.0" - source-map "~0.6.1" - source-map-support "~0.5.6" - -text-table@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - -through@^2.3.6, through@~2.3.4, through@~2.3.8: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - -tmp@^0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - dependencies: - os-tmpdir "~1.0.2" - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - dependencies: - prelude-ls "~1.1.2" - -uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - dependencies: - punycode "^2.1.0" - -which@^1.2.9: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - dependencies: - isexe "^2.0.0" - -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -write@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" - dependencies: - mkdirp "^0.5.1" diff --git a/node_modules/d3-geo/package.json b/node_modules/d3-geo/package.json deleted file mode 100644 index 47898a7..0000000 --- a/node_modules/d3-geo/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "_from": "d3-geo@^1.12.1", - "_id": "d3-geo@1.12.1", - "_inBundle": false, - "_integrity": "sha512-XG4d1c/UJSEX9NfU02KwBL6BYPj8YKHxgBEw5om2ZnTRSbIcego6dhHwcxuSR3clxh0EpE38os1DVPOmnYtTPg==", - "_location": "/d3-geo", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "d3-geo@^1.12.1", - "name": "d3-geo", - "escapedName": "d3-geo", - "rawSpec": "^1.12.1", - "saveSpec": null, - "fetchSpec": "^1.12.1" - }, - "_requiredBy": [ - "/d3-geo-projection", - "/vega-functions", - "/vega-geo", - "/vega-projection" - ], - "_resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-1.12.1.tgz", - "_shasum": "7fc2ab7414b72e59fbcbd603e80d9adc029b035f", - "_spec": "d3-geo@^1.12.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-functions", - "author": { - "name": "Mike Bostock", - "url": "https://bost.ocks.org/mike" - }, - "bugs": { - "url": "https://github.com/d3/d3-geo/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "1" - }, - "deprecated": false, - "description": "Shapes and calculators for spherical coordinates.", - "devDependencies": { - "canvas": "1", - "d3-format": "1", - "eslint": "6", - "eslint-plugin-es5": "1", - "esm": "3", - "rollup": "1", - "rollup-plugin-terser": "5", - "tape": "4", - "topojson-client": "3", - "world-atlas": "1" - }, - "files": [ - "dist/**/*.js", - "src/**/*.js" - ], - "homepage": "https://d3js.org/d3-geo/", - "jsdelivr": "dist/d3-geo.min.js", - "keywords": [ - "d3", - "d3-module", - "geo", - "maps", - "cartography" - ], - "license": "BSD-3-Clause", - "main": "dist/d3-geo.js", - "module": "src/index.js", - "name": "d3-geo", - "repository": { - "type": "git", - "url": "git+https://github.com/d3/d3-geo.git" - }, - "scripts": { - "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js", - "prepublishOnly": "rm -rf dist && yarn test && mkdir -p test/output && test/compare-images", - "pretest": "rollup -c", - "test": "tape -r esm 'test/**/*-test.js' && eslint src" - }, - "sideEffects": false, - "unpkg": "dist/d3-geo.min.js", - "version": "1.12.1" -} diff --git a/node_modules/d3-geo/src/adder.js b/node_modules/d3-geo/src/adder.js deleted file mode 100644 index c9efd99..0000000 --- a/node_modules/d3-geo/src/adder.js +++ /dev/null @@ -1,40 +0,0 @@ -// 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–363 (1997). -// Code adapted from GeographicLib by Charles F. F. Karney, -// http://geographiclib.sourceforge.net/ - -export default function() { - return new Adder; -} - -function Adder() { - this.reset(); -} - -Adder.prototype = { - constructor: Adder, - reset: function() { - this.s = // rounded value - this.t = 0; // exact error - }, - add: function(y) { - add(temp, y, this.t); - add(this, temp.s, this.s); - if (this.s) this.t += temp.t; - else this.s = temp.t; - }, - valueOf: function() { - return this.s; - } -}; - -var temp = new Adder; - -function add(adder, a, b) { - var x = adder.s = a + b, - bv = x - a, - av = x - bv; - adder.t = (a - av) + (b - bv); -} diff --git a/node_modules/d3-geo/src/area.js b/node_modules/d3-geo/src/area.js deleted file mode 100644 index 6336dac..0000000 --- a/node_modules/d3-geo/src/area.js +++ /dev/null @@ -1,74 +0,0 @@ -import adder from "./adder.js"; -import {atan2, cos, quarterPi, radians, sin, tau} from "./math.js"; -import noop from "./noop.js"; -import stream from "./stream.js"; - -export var areaRingSum = adder(); - -var areaSum = adder(), - lambda00, - phi00, - lambda0, - cosPhi0, - sinPhi0; - -export var areaStream = { - point: noop, - lineStart: noop, - lineEnd: noop, - polygonStart: function() { - areaRingSum.reset(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? tau + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = noop; - }, - sphere: function() { - areaSum.add(tau); - } -}; - -function areaRingStart() { - areaStream.point = areaPointFirst; -} - -function areaRingEnd() { - areaPoint(lambda00, phi00); -} - -function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= radians, phi *= radians; - lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi); -} - -function areaPoint(lambda, phi) { - lambda *= radians, phi *= radians; - phi = 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’s - // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). - var dLambda = lambda - lambda0, - sdLambda = dLambda >= 0 ? 1 : -1, - adLambda = sdLambda * dLambda, - cosPhi = cos(phi), - sinPhi = sin(phi), - k = sinPhi0 * sinPhi, - u = cosPhi0 * cosPhi + k * cos(adLambda), - v = k * sdLambda * sin(adLambda); - areaRingSum.add(atan2(v, u)); - - // Advance the previous points. - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; -} - -export default function(object) { - areaSum.reset(); - stream(object, areaStream); - return areaSum * 2; -} diff --git a/node_modules/d3-geo/src/bounds.js b/node_modules/d3-geo/src/bounds.js deleted file mode 100644 index 6935b97..0000000 --- a/node_modules/d3-geo/src/bounds.js +++ /dev/null @@ -1,179 +0,0 @@ -import adder from "./adder.js"; -import {areaStream, areaRingSum} from "./area.js"; -import {cartesian, cartesianCross, cartesianNormalizeInPlace, spherical} from "./cartesian.js"; -import {abs, degrees, epsilon, radians} from "./math.js"; -import stream from "./stream.js"; - -var lambda0, phi0, lambda1, phi1, // bounds - lambda2, // previous lambda-coordinate - lambda00, phi00, // first point - p0, // previous 3D point - deltaSum = adder(), - ranges, - range; - -var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum.reset(); - areaStream.polygonStart(); - }, - polygonEnd: function() { - areaStream.polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if (areaRingSum < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > epsilon) phi1 = 90; - else if (deltaSum < -epsilon) phi0 = -90; - range[0] = lambda0, range[1] = lambda1; - }, - sphere: function() { - lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - } -}; - -function boundsPoint(lambda, phi) { - ranges.push(range = [lambda0 = lambda, lambda1 = lambda]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; -} - -function linePoint(lambda, phi) { - var p = cartesian([lambda * radians, phi * radians]); - if (p0) { - var normal = cartesianCross(p0, p), - equatorial = [normal[1], -normal[0], 0], - inflection = cartesianCross(equatorial, normal); - cartesianNormalizeInPlace(inflection); - inflection = spherical(inflection); - var delta = lambda - lambda2, - sign = delta > 0 ? 1 : -1, - lambdai = inflection[0] * degrees * sign, - phii, - antimeridian = abs(delta) > 180; - if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = inflection[1] * degrees; - if (phii > phi1) phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = -inflection[1] * degrees; - if (phii < phi0) phi0 = phii; - } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - if (antimeridian) { - if (lambda < lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } - } else { - if (lambda1 >= lambda0) { - if (lambda < lambda0) lambda0 = lambda; - if (lambda > lambda1) lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } - } - } - } else { - ranges.push(range = [lambda0 = lambda, lambda1 = lambda]); - } - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - p0 = p, lambda2 = lambda; -} - -function boundsLineStart() { - boundsStream.point = linePoint; -} - -function boundsLineEnd() { - range[0] = lambda0, range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; -} - -function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else { - lambda00 = lambda, phi00 = phi; - } - areaStream.point(lambda, phi); - linePoint(lambda, phi); -} - -function boundsRingStart() { - areaStream.lineStart(); -} - -function boundsRingEnd() { - boundsRingPoint(lambda00, phi00); - areaStream.lineEnd(); - if (abs(deltaSum) > epsilon) lambda0 = -(lambda1 = 180); - range[0] = lambda0, range[1] = lambda1; - p0 = null; -} - -// Finds the left-right distance between two longitudes. -// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want -// the distance between ±180° to be 360°. -function angle(lambda0, lambda1) { - return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; -} - -function rangeCompare(a, b) { - return a[0] - b[0]; -} - -function rangeContains(range, x) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; -} - -export default function(feature) { - var i, n, a, b, merged, deltaMax, delta; - - phi1 = lambda1 = -(lambda0 = phi0 = Infinity); - ranges = []; - stream(feature, boundsStream); - - // First, sort ranges by their minimum longitudes. - if (n = ranges.length) { - ranges.sort(rangeCompare); - - // Then, merge any ranges that overlap. - for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) { - b = ranges[i]; - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - 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. - for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) { - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1]; - } - } - - ranges = range = null; - - return lambda0 === Infinity || phi0 === Infinity - ? [[NaN, NaN], [NaN, NaN]] - : [[lambda0, phi0], [lambda1, phi1]]; -} diff --git a/node_modules/d3-geo/src/cartesian.js b/node_modules/d3-geo/src/cartesian.js deleted file mode 100644 index 73790a6..0000000 --- a/node_modules/d3-geo/src/cartesian.js +++ /dev/null @@ -1,33 +0,0 @@ -import {asin, atan2, cos, sin, sqrt} from "./math.js"; - -export function spherical(cartesian) { - return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])]; -} - -export function cartesian(spherical) { - var lambda = spherical[0], phi = spherical[1], cosPhi = cos(phi); - return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)]; -} - -export function cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} - -export 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 -export function cartesianAddInPlace(a, b) { - a[0] += b[0], a[1] += b[1], a[2] += b[2]; -} - -export function cartesianScale(vector, k) { - return [vector[0] * k, vector[1] * k, vector[2] * k]; -} - -// TODO return d -export function cartesianNormalizeInPlace(d) { - var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; -} diff --git a/node_modules/d3-geo/src/centroid.js b/node_modules/d3-geo/src/centroid.js deleted file mode 100644 index e509298..0000000 --- a/node_modules/d3-geo/src/centroid.js +++ /dev/null @@ -1,140 +0,0 @@ -import {asin, atan2, cos, degrees, epsilon, epsilon2, radians, sin, sqrt} from "./math.js"; -import noop from "./noop.js"; -import stream from "./stream.js"; - -var W0, W1, - X0, Y0, Z0, - X1, Y1, Z1, - X2, Y2, Z2, - lambda00, phi00, // first point - x0, y0, z0; // previous point - -var centroidStream = { - sphere: noop, - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } -}; - -// Arithmetic mean of Cartesian vectors. -function centroidPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi); - centroidPointCartesian(cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)); -} - -function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; -} - -function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; -} - -function centroidLinePointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi); - x0 = cosPhi * cos(lambda); - y0 = cosPhi * sin(lambda); - z0 = sin(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); -} - -function centroidLinePoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi), - x = cosPhi * cos(lambda), - y = cosPhi * sin(lambda), - z = sin(phi), - w = atan2(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); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} - -// See J. E. Brock, The Inertia Tensor for a Spherical Triangle, -// J. Applied Mechanics 42, 239 (1975). -function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; -} - -function centroidRingEnd() { - centroidRingPoint(lambda00, phi00); - centroidStream.point = centroidPoint; -} - -function centroidRingPointFirst(lambda, phi) { - lambda00 = lambda, phi00 = phi; - lambda *= radians, phi *= radians; - centroidStream.point = centroidRingPoint; - var cosPhi = cos(phi); - x0 = cosPhi * cos(lambda); - y0 = cosPhi * sin(lambda); - z0 = sin(phi); - centroidPointCartesian(x0, y0, z0); -} - -function centroidRingPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi), - x = cosPhi * cos(lambda), - y = cosPhi * sin(lambda), - z = sin(phi), - cx = y0 * z - z0 * y, - cy = z0 * x - x0 * z, - cz = x0 * y - y0 * x, - m = sqrt(cx * cx + cy * cy + cz * cz), - w = asin(m), // line weight = angle - v = m && -w / m; // area weight multiplier - X2 += v * cx; - Y2 += v * cy; - Z2 += v * cz; - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -export default function(object) { - W0 = W1 = - X0 = Y0 = Z0 = - X1 = Y1 = Z1 = - X2 = Y2 = Z2 = 0; - stream(object, centroidStream); - - var x = X2, - y = Y2, - z = Z2, - m = x * x + y * y + z * z; - - // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. - if (m < epsilon2) { - x = X1, y = Y1, z = Z1; - // If the feature has zero length, fall back to arithmetic mean of point vectors. - if (W1 < epsilon) x = X0, y = Y0, z = Z0; - m = x * x + y * y + z * z; - // If the feature still has an undefined ccentroid, then return. - if (m < epsilon2) return [NaN, NaN]; - } - - return [atan2(y, x) * degrees, asin(z / sqrt(m)) * degrees]; -} diff --git a/node_modules/d3-geo/src/circle.js b/node_modules/d3-geo/src/circle.js deleted file mode 100644 index 85a0af9..0000000 --- a/node_modules/d3-geo/src/circle.js +++ /dev/null @@ -1,72 +0,0 @@ -import {cartesian, cartesianNormalizeInPlace, spherical} from "./cartesian.js"; -import constant from "./constant.js"; -import {acos, cos, degrees, epsilon, radians, sin, tau} from "./math.js"; -import {rotateRadians} from "./rotation.js"; - -// Generates a circle centered at [0°, 0°], with a given radius and precision. -export function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = cos(radius), - sinRadius = sin(radius), - step = direction * delta; - if (t0 == null) { - t0 = radius + direction * tau; - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau; - } - for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) { - point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(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 = cartesian(point), point[0] -= cosRadius; - cartesianNormalizeInPlace(point); - var radius = acos(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau; -} - -export default function() { - var center = constant([0, 0]), - radius = constant(90), - precision = constant(6), - ring, - rotate, - stream = {point: point}; - - function point(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= degrees, x[1] *= degrees; - } - - function circle() { - var c = center.apply(this, arguments), - r = radius.apply(this, arguments) * radians, - p = precision.apply(this, arguments) * radians; - ring = []; - rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert; - circleStream(stream, r, p, 1); - c = {type: "Polygon", coordinates: [ring]}; - ring = rotate = null; - return c; - } - - circle.center = function(_) { - return arguments.length ? (center = typeof _ === "function" ? _ : constant([+_[0], +_[1]]), circle) : center; - }; - - circle.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), circle) : radius; - }; - - circle.precision = function(_) { - return arguments.length ? (precision = typeof _ === "function" ? _ : constant(+_), circle) : precision; - }; - - return circle; -} diff --git a/node_modules/d3-geo/src/clip/antimeridian.js b/node_modules/d3-geo/src/clip/antimeridian.js deleted file mode 100644 index 7ed32d4..0000000 --- a/node_modules/d3-geo/src/clip/antimeridian.js +++ /dev/null @@ -1,92 +0,0 @@ -import clip from "./index.js"; -import {abs, atan, cos, epsilon, halfPi, pi, sin} from "../math.js"; - -export default clip( - function() { return true; }, - clipAntimeridianLine, - clipAntimeridianInterpolate, - [-pi, -halfPi] -); - -// Takes a line and cuts into visible segments. Return values: 0 - there were -// 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 = NaN, - phi0 = NaN, - sign0 = NaN, - clean; // no intersections - - return { - lineStart: function() { - stream.lineStart(); - clean = 1; - }, - point: function(lambda1, phi1) { - var sign1 = lambda1 > 0 ? pi : -pi, - delta = abs(lambda1 - lambda0); - if (abs(delta - pi) < epsilon) { // line crosses a pole - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - clean = 0; - } else if (sign0 !== sign1 && delta >= pi) { // line crosses antimeridian - if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies - if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon; - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - clean = 0; - } - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function() { - return 2 - clean; // if intersections, rejoin first and last segments - } - }; -} - -function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, - cosPhi1, - sinLambda0Lambda1 = sin(lambda0 - lambda1); - return abs(sinLambda0Lambda1) > epsilon - ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1) - - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0)) - / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) - : (phi0 + phi1) / 2; -} - -function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - if (from == null) { - phi = direction * halfPi; - stream.point(-pi, phi); - stream.point(0, phi); - stream.point(pi, phi); - stream.point(pi, 0); - stream.point(pi, -phi); - stream.point(0, -phi); - stream.point(-pi, -phi); - stream.point(-pi, 0); - stream.point(-pi, phi); - } else if (abs(from[0] - to[0]) > epsilon) { - var lambda = from[0] < to[0] ? pi : -pi; - phi = direction * lambda / 2; - stream.point(-lambda, phi); - stream.point(0, phi); - stream.point(lambda, phi); - } else { - stream.point(to[0], to[1]); - } -} diff --git a/node_modules/d3-geo/src/clip/buffer.js b/node_modules/d3-geo/src/clip/buffer.js deleted file mode 100644 index f5e1ece..0000000 --- a/node_modules/d3-geo/src/clip/buffer.js +++ /dev/null @@ -1,24 +0,0 @@ -import noop from "../noop.js"; - -export default function() { - var lines = [], - line; - return { - point: function(x, y, m) { - line.push([x, y, m]); - }, - lineStart: function() { - lines.push(line = []); - }, - lineEnd: noop, - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function() { - var result = lines; - lines = []; - line = null; - return result; - } - }; -} diff --git a/node_modules/d3-geo/src/clip/circle.js b/node_modules/d3-geo/src/clip/circle.js deleted file mode 100644 index 30dcf44..0000000 --- a/node_modules/d3-geo/src/clip/circle.js +++ /dev/null @@ -1,177 +0,0 @@ -import {cartesian, cartesianAddInPlace, cartesianCross, cartesianDot, cartesianScale, spherical} from "../cartesian.js"; -import {circleStream} from "../circle.js"; -import {abs, cos, epsilon, pi, radians, sqrt} from "../math.js"; -import pointEqual from "../pointEqual.js"; -import clip from "./index.js"; - -export default function(radius) { - var cr = cos(radius), - delta = 6 * radians, - smallRadius = cr > 0, - notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case - - function interpolate(from, to, direction, stream) { - circleStream(stream, radius, delta, direction, from, to); - } - - function visible(lambda, phi) { - return cos(lambda) * cos(phi) > cr; - } - - // Takes a line and cuts into visible segments. Return values used for polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // 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 = v0 = false; - clean = 1; - }, - point: function(lambda, phi) { - var point1 = [lambda, phi], - point2, - v = visible(lambda, phi), - c = smallRadius - ? v ? 0 : code(lambda, phi) - : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) - point1[2] = 1; - } - if (v !== v0) { - clean = 0; - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - point0 = 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 = intersect(point1, point0, true))) { - clean = 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], 3); - } - } - } - if (v && (!point0 || !pointEqual(point0, point1))) { - stream.point(point1[0], point1[1]); - } - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) stream.lineEnd(); - point0 = 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 = cartesian(a), - pb = cartesian(b); - - // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - var n1 = [1, 0, 0], // normal - n2 = cartesianCross(pa, pb), - n2n2 = cartesianDot(n2, n2), - n1n2 = n2[0], // cartesianDot(n1, n2), - determinant = n2n2 - n1n2 * n1n2; - - // Two polar points. - if (!determinant) return !two && a; - - var c1 = cr * n2n2 / determinant, - c2 = -cr * n1n2 / determinant, - n1xn2 = cartesianCross(n1, n2), - A = cartesianScale(n1, c1), - B = cartesianScale(n2, c2); - cartesianAddInPlace(A, B); - - // Solve |p(t)|^2 = 1. - var u = n1xn2, - w = cartesianDot(A, u), - uu = cartesianDot(u, u), - t2 = w * w - uu * (cartesianDot(A, A) - 1); - - if (t2 < 0) return; - - var t = sqrt(t2), - q = cartesianScale(u, (-w - t) / uu); - cartesianAddInPlace(q, A); - q = spherical(q); - - if (!two) return q; - - // Two intersection points. - var lambda0 = a[0], - lambda1 = b[0], - phi0 = a[1], - phi1 = b[1], - z; - - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - - var delta = lambda1 - lambda0, - polar = abs(delta - pi) < epsilon, - meridian = polar || delta < epsilon; - - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; - - // Check that the first point is between a and b. - if (meridian - ? polar - ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1) - : phi0 <= q[1] && q[1] <= phi1 - : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = 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 = smallRadius ? radius : pi - radius, - code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - return code; - } - - return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]); -} diff --git a/node_modules/d3-geo/src/clip/extent.js b/node_modules/d3-geo/src/clip/extent.js deleted file mode 100644 index 5ff06ee..0000000 --- a/node_modules/d3-geo/src/clip/extent.js +++ /dev/null @@ -1,20 +0,0 @@ -import clipRectangle from "./rectangle.js"; - -export default function() { - var x0 = 0, - y0 = 0, - x1 = 960, - y1 = 500, - cache, - cacheStream, - clip; - - return clip = { - stream: function(stream) { - return cache && cacheStream === stream ? cache : cache = clipRectangle(x0, y0, x1, y1)(cacheStream = stream); - }, - extent: function(_) { - return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]]; - } - }; -} diff --git a/node_modules/d3-geo/src/clip/index.js b/node_modules/d3-geo/src/clip/index.js deleted file mode 100644 index af7ac91..0000000 --- a/node_modules/d3-geo/src/clip/index.js +++ /dev/null @@ -1,131 +0,0 @@ -import clipBuffer from "./buffer.js"; -import clipRejoin from "./rejoin.js"; -import {epsilon, halfPi} from "../math.js"; -import polygonContains from "../polygonContains.js"; -import {merge} from "d3-array"; - -export default function(pointVisible, clipLine, interpolate, start) { - return function(sink) { - var line = clipLine(sink), - ringBuffer = clipBuffer(), - ringSink = clipLine(ringBuffer), - polygonStarted = false, - polygon, - segments, - ring; - - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = merge(segments); - var startInside = polygonContains(polygon, start); - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - clipRejoin(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = 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 = pointLine; - line.lineStart(); - } - - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - - function pointRing(lambda, phi) { - ring.push([lambda, phi]); - ringSink.point(lambda, phi); - } - - function ringStart() { - ringSink.lineStart(); - ring = []; - } - - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - - var clean = ringSink.clean(), - ringSegments = ringBuffer.result(), - i, n = ringSegments.length, m, - segment, - point; - - ring.pop(); - polygon.push(ring); - ring = null; - - if (!n) return; - - // No intersections. - if (clean & 1) { - segment = ringSegments[0]; - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]); - sink.lineEnd(); - } - return; - } - - // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.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 cutting -// and circle clipping, the same comparison is used. -function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]); -} diff --git a/node_modules/d3-geo/src/clip/line.js b/node_modules/d3-geo/src/clip/line.js deleted file mode 100644 index 3b173d7..0000000 --- a/node_modules/d3-geo/src/clip/line.js +++ /dev/null @@ -1,59 +0,0 @@ -export default function(a, b, x0, y0, x1, y1) { - var ax = a[0], - ay = a[1], - bx = b[0], - by = b[1], - t0 = 0, - t1 = 1, - dx = bx - ax, - dy = by - ay, - r; - - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; -} diff --git a/node_modules/d3-geo/src/clip/rectangle.js b/node_modules/d3-geo/src/clip/rectangle.js deleted file mode 100644 index 4767626..0000000 --- a/node_modules/d3-geo/src/clip/rectangle.js +++ /dev/null @@ -1,168 +0,0 @@ -import {abs, epsilon} from "../math.js"; -import clipBuffer from "./buffer.js"; -import clipLine from "./line.js"; -import clipRejoin from "./rejoin.js"; -import {merge} from "d3-array"; - -var clipMax = 1e9, clipMin = -clipMax; - -// TODO Use d3-polygon’s polygonContains here for the ring check? -// TODO Eliminate duplicate buffering in clipBuffer and polygon.push? - -export default function clipRectangle(x0, y0, x1, y1) { - - function visible(x, y) { - return x0 <= x && x <= x1 && y0 <= y && y <= y1; - } - - function interpolate(from, to, direction, stream) { - var a = 0, a1 = 0; - if (from == null - || (a = corner(from, direction)) !== (a1 = corner(to, direction)) - || comparePoint(from, to) < 0 ^ direction > 0) { - do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - while ((a = (a + direction + 4) % 4) !== a1); - } else { - stream.point(to[0], to[1]); - } - } - - function corner(p, direction) { - return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3 - : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1 - : abs(p[1] - y0) < epsilon ? 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 = corner(a, 1), - cb = corner(b, 1); - return ca !== cb ? ca - cb - : ca === 0 ? b[1] - a[1] - : ca === 1 ? a[0] - b[0] - : ca === 2 ? a[1] - b[1] - : b[0] - a[0]; - } - - return function(stream) { - var activeStream = stream, - bufferStream = clipBuffer(), - segments, - polygon, - ring, - x__, y__, v__, // first point - x_, y_, v_, // previous point - first, - clean; - - var clipStream = { - 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 = 0; - - for (var i = 0, n = polygon.length; i < n; ++i) { - for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) { - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; } - else { if (b1 <= 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 = bufferStream, segments = [], polygon = [], clean = true; - } - - function polygonEnd() { - var startInside = polygonInside(), - cleanInside = clean && startInside, - visible = (segments = 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, interpolate, stream); - } - stream.polygonEnd(); - } - activeStream = stream, segments = polygon = ring = null; - } - - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - - // TODO rather than special-case polygons, simply handle them separately. - // 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 = point; - if (v_) activeStream.lineEnd(); - } - - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([x, y]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else { - if (v && v_) activeStream.point(x, y); - else { - var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], - b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.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 = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - } - x_ = x, y_ = y, v_ = v; - } - - return clipStream; - }; -} diff --git a/node_modules/d3-geo/src/clip/rejoin.js b/node_modules/d3-geo/src/clip/rejoin.js deleted file mode 100644 index 37e0241..0000000 --- a/node_modules/d3-geo/src/clip/rejoin.js +++ /dev/null @@ -1,103 +0,0 @@ -import pointEqual from "../pointEqual.js"; -import {epsilon} from "../math.js"; - -function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - this.e = entry; // is an entry? - this.v = false; // visited - this.n = this.p = 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. -export default function(segments, compareIntersection, startInside, interpolate, stream) { - var subject = [], - clip = [], - i, - n; - - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n], x; - - if (pointEqual(p0, p1)) { - if (!p0[2] && !p1[2]) { - stream.lineStart(); - for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]); - stream.lineEnd(); - return; - } - // handle degenerate cases by moving the point - p1[0] += 2 * epsilon; - } - - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - - if (!subject.length) return; - - clip.sort(compareIntersection); - link(subject); - link(clip); - - for (i = 0, n = clip.length; i < n; ++i) { - clip[i].e = startInside = !startInside; - } - - var start = subject[0], - points, - point; - - while (1) { - // Find first unvisited intersection. - var current = start, - isSubject = true; - while (current.v) if ((current = current.n) === start) return; - points = current.z; - stream.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) { - for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.n.x, 1, stream); - } - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.p.x, -1, stream); - } - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - } while (!current.v); - stream.lineEnd(); - } -} - -function link(array) { - if (!(n = array.length)) return; - var n, - i = 0, - a = array[0], - b; - while (++i < n) { - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; -} diff --git a/node_modules/d3-geo/src/compose.js b/node_modules/d3-geo/src/compose.js deleted file mode 100644 index f6a967a..0000000 --- a/node_modules/d3-geo/src/compose.js +++ /dev/null @@ -1,12 +0,0 @@ -export default function(a, b) { - - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - - return compose; -} diff --git a/node_modules/d3-geo/src/constant.js b/node_modules/d3-geo/src/constant.js deleted file mode 100644 index b7d42e7..0000000 --- a/node_modules/d3-geo/src/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(x) { - return function() { - return x; - }; -} diff --git a/node_modules/d3-geo/src/contains.js b/node_modules/d3-geo/src/contains.js deleted file mode 100644 index 923f4d4..0000000 --- a/node_modules/d3-geo/src/contains.js +++ /dev/null @@ -1,97 +0,0 @@ -import {default as polygonContains} from "./polygonContains.js"; -import {default as distance} from "./distance.js"; -import {epsilon2, radians} from "./math.js"; - -var containsObjectType = { - Feature: function(object, point) { - return containsGeometry(object.geometry, point); - }, - FeatureCollection: function(object, point) { - var features = object.features, i = -1, n = features.length; - while (++i < n) if (containsGeometry(features[i].geometry, point)) return true; - return false; - } -}; - -var containsGeometryType = { - Sphere: function() { - return true; - }, - Point: function(object, point) { - return containsPoint(object.coordinates, point); - }, - MultiPoint: function(object, point) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - 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 = object.coordinates, i = -1, n = coordinates.length; - 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 = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) if (containsPolygon(coordinates[i], point)) return true; - return false; - }, - GeometryCollection: function(object, point) { - var geometries = object.geometries, i = -1, n = 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) === 0; -} - -function containsLine(coordinates, point) { - var ao, bo, ab; - for (var i = 0, n = coordinates.length; i < n; i++) { - bo = distance(coordinates[i], point); - if (bo === 0) return true; - if (i > 0) { - ab = distance(coordinates[i], coordinates[i - 1]); - if ( - ab > 0 && - ao <= ab && - bo <= ab && - (ao + bo - ab) * (1 - Math.pow((ao - bo) / ab, 2)) < epsilon2 * ab - ) - return true; - } - ao = bo; - } - return false; -} - -function containsPolygon(coordinates, point) { - return !!polygonContains(coordinates.map(ringRadians), pointRadians(point)); -} - -function ringRadians(ring) { - return ring = ring.map(pointRadians), ring.pop(), ring; -} - -function pointRadians(point) { - return [point[0] * radians, point[1] * radians]; -} - -export default function(object, point) { - return (object && containsObjectType.hasOwnProperty(object.type) - ? containsObjectType[object.type] - : containsGeometry)(object, point); -} diff --git a/node_modules/d3-geo/src/distance.js b/node_modules/d3-geo/src/distance.js deleted file mode 100644 index 0cd23db..0000000 --- a/node_modules/d3-geo/src/distance.js +++ /dev/null @@ -1,10 +0,0 @@ -import length from "./length.js"; - -var coordinates = [null, null], - object = {type: "LineString", coordinates: coordinates}; - -export default function(a, b) { - coordinates[0] = a; - coordinates[1] = b; - return length(object); -} diff --git a/node_modules/d3-geo/src/graticule.js b/node_modules/d3-geo/src/graticule.js deleted file mode 100644 index dc8daaf..0000000 --- a/node_modules/d3-geo/src/graticule.js +++ /dev/null @@ -1,105 +0,0 @@ -import {range} from "d3-array"; -import {abs, ceil, epsilon} from "./math.js"; - -function graticuleX(y0, y1, dy) { - var y = range(y0, y1 - epsilon, dy).concat(y1); - return function(x) { return y.map(function(y) { return [x, y]; }); }; -} - -function graticuleY(x0, x1, dx) { - var x = range(x0, x1 - epsilon, dx).concat(x1); - return function(y) { return x.map(function(x) { return [x, y]; }); }; -} - -export default function graticule() { - var x1, x0, X1, X0, - y1, y0, Y1, Y0, - dx = 10, dy = dx, DX = 90, DY = 360, - x, y, X, Y, - precision = 2.5; - - function graticule() { - return {type: "MultiLineString", coordinates: lines()}; - } - - function lines() { - return range(ceil(X0 / DX) * DX, X1, DX).map(X) - .concat(range(ceil(Y0 / DY) * DY, Y1, DY).map(Y)) - .concat(range(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs(x % DX) > epsilon; }).map(x)) - .concat(range(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs(y % DY) > epsilon; }).map(y)); - } - - graticule.lines = function() { - return lines().map(function(coordinates) { return {type: "LineString", coordinates: coordinates}; }); - }; - - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ - X(X0).concat( - Y(Y1).slice(1), - X(X1).reverse().slice(1), - Y(Y0).reverse().slice(1)) - ] - }; - }; - - graticule.extent = function(_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - - graticule.extentMajor = function(_) { - if (!arguments.length) return [[X0, Y0], [X1, Y1]]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - - graticule.extentMinor = function(_) { - if (!arguments.length) return [[x0, y0], [x1, y1]]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - - graticule.step = function(_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - - graticule.stepMajor = function(_) { - if (!arguments.length) return [DX, DY]; - DX = +_[0], DY = +_[1]; - return graticule; - }; - - graticule.stepMinor = function(_) { - if (!arguments.length) return [dx, dy]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - - return graticule - .extentMajor([[-180, -90 + epsilon], [180, 90 - epsilon]]) - .extentMinor([[-180, -80 - epsilon], [180, 80 + epsilon]]); -} - -export function graticule10() { - return graticule()(); -} diff --git a/node_modules/d3-geo/src/identity.js b/node_modules/d3-geo/src/identity.js deleted file mode 100644 index b2f94b2..0000000 --- a/node_modules/d3-geo/src/identity.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x) { - return x; -} diff --git a/node_modules/d3-geo/src/index.js b/node_modules/d3-geo/src/index.js deleted file mode 100644 index 9a36976..0000000 --- a/node_modules/d3-geo/src/index.js +++ /dev/null @@ -1,34 +0,0 @@ -export {default as geoArea} from "./area.js"; -export {default as geoBounds} from "./bounds.js"; -export {default as geoCentroid} from "./centroid.js"; -export {default as geoCircle} from "./circle.js"; -export {default as geoClipAntimeridian} from "./clip/antimeridian.js"; -export {default as geoClipCircle} from "./clip/circle.js"; -export {default as geoClipExtent} from "./clip/extent.js"; // DEPRECATED! Use d3.geoIdentity().clipExtent(…). -export {default as geoClipRectangle} from "./clip/rectangle.js"; -export {default as geoContains} from "./contains.js"; -export {default as geoDistance} from "./distance.js"; -export {default as geoGraticule, graticule10 as geoGraticule10} from "./graticule.js"; -export {default as geoInterpolate} from "./interpolate.js"; -export {default as geoLength} from "./length.js"; -export {default as geoPath} from "./path/index.js"; -export {default as geoAlbers} from "./projection/albers.js"; -export {default as geoAlbersUsa} from "./projection/albersUsa.js"; -export {default as geoAzimuthalEqualArea, azimuthalEqualAreaRaw as geoAzimuthalEqualAreaRaw} from "./projection/azimuthalEqualArea.js"; -export {default as geoAzimuthalEquidistant, azimuthalEquidistantRaw as geoAzimuthalEquidistantRaw} from "./projection/azimuthalEquidistant.js"; -export {default as geoConicConformal, conicConformalRaw as geoConicConformalRaw} from "./projection/conicConformal.js"; -export {default as geoConicEqualArea, conicEqualAreaRaw as geoConicEqualAreaRaw} from "./projection/conicEqualArea.js"; -export {default as geoConicEquidistant, conicEquidistantRaw as geoConicEquidistantRaw} from "./projection/conicEquidistant.js"; -export {default as geoEqualEarth, equalEarthRaw as geoEqualEarthRaw} from "./projection/equalEarth.js"; -export {default as geoEquirectangular, equirectangularRaw as geoEquirectangularRaw} from "./projection/equirectangular.js"; -export {default as geoGnomonic, gnomonicRaw as geoGnomonicRaw} from "./projection/gnomonic.js"; -export {default as geoIdentity} from "./projection/identity.js"; -export {default as geoProjection, projectionMutator as geoProjectionMutator} from "./projection/index.js"; -export {default as geoMercator, mercatorRaw as geoMercatorRaw} from "./projection/mercator.js"; -export {default as geoNaturalEarth1, naturalEarth1Raw as geoNaturalEarth1Raw} from "./projection/naturalEarth1.js"; -export {default as geoOrthographic, orthographicRaw as geoOrthographicRaw} from "./projection/orthographic.js"; -export {default as geoStereographic, stereographicRaw as geoStereographicRaw} from "./projection/stereographic.js"; -export {default as geoTransverseMercator, transverseMercatorRaw as geoTransverseMercatorRaw} from "./projection/transverseMercator.js"; -export {default as geoRotation} from "./rotation.js"; -export {default as geoStream} from "./stream.js"; -export {default as geoTransform} from "./transform.js"; diff --git a/node_modules/d3-geo/src/interpolate.js b/node_modules/d3-geo/src/interpolate.js deleted file mode 100644 index b19fbba..0000000 --- a/node_modules/d3-geo/src/interpolate.js +++ /dev/null @@ -1,36 +0,0 @@ -import {asin, atan2, cos, degrees, haversin, radians, sin, sqrt} from "./math.js"; - -export default function(a, b) { - var x0 = a[0] * radians, - y0 = a[1] * radians, - x1 = b[0] * radians, - y1 = b[1] * radians, - cy0 = cos(y0), - sy0 = sin(y0), - cy1 = cos(y1), - sy1 = sin(y1), - kx0 = cy0 * cos(x0), - ky0 = cy0 * sin(x0), - kx1 = cy1 * cos(x1), - ky1 = cy1 * sin(x1), - d = 2 * asin(sqrt(haversin(y1 - y0) + cy0 * cy1 * haversin(x1 - x0))), - k = sin(d); - - var interpolate = d ? function(t) { - var B = sin(t *= d) / k, - A = sin(d - t) / k, - x = A * kx0 + B * kx1, - y = A * ky0 + B * ky1, - z = A * sy0 + B * sy1; - return [ - atan2(y, x) * degrees, - atan2(z, sqrt(x * x + y * y)) * degrees - ]; - } : function() { - return [x0 * degrees, y0 * degrees]; - }; - - interpolate.distance = d; - - return interpolate; -} diff --git a/node_modules/d3-geo/src/length.js b/node_modules/d3-geo/src/length.js deleted file mode 100644 index 9329369..0000000 --- a/node_modules/d3-geo/src/length.js +++ /dev/null @@ -1,53 +0,0 @@ -import adder from "./adder.js"; -import {abs, atan2, cos, radians, sin, sqrt} from "./math.js"; -import noop from "./noop.js"; -import stream from "./stream.js"; - -var lengthSum = adder(), - lambda0, - sinPhi0, - cosPhi0; - -var lengthStream = { - sphere: noop, - point: noop, - lineStart: lengthLineStart, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop -}; - -function lengthLineStart() { - lengthStream.point = lengthPointFirst; - lengthStream.lineEnd = lengthLineEnd; -} - -function lengthLineEnd() { - lengthStream.point = lengthStream.lineEnd = noop; -} - -function lengthPointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - lambda0 = lambda, sinPhi0 = sin(phi), cosPhi0 = cos(phi); - lengthStream.point = lengthPoint; -} - -function lengthPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var sinPhi = sin(phi), - cosPhi = cos(phi), - delta = abs(lambda - lambda0), - cosDelta = cos(delta), - sinDelta = sin(delta), - x = cosPhi * sinDelta, - y = cosPhi0 * sinPhi - sinPhi0 * cosPhi * cosDelta, - z = sinPhi0 * sinPhi + cosPhi0 * cosPhi * cosDelta; - lengthSum.add(atan2(sqrt(x * x + y * y), z)); - lambda0 = lambda, sinPhi0 = sinPhi, cosPhi0 = cosPhi; -} - -export default function(object) { - lengthSum.reset(); - stream(object, lengthStream); - return +lengthSum; -} diff --git a/node_modules/d3-geo/src/math.js b/node_modules/d3-geo/src/math.js deleted file mode 100644 index 32f41fb..0000000 --- a/node_modules/d3-geo/src/math.js +++ /dev/null @@ -1,35 +0,0 @@ -export var epsilon = 1e-6; -export var epsilon2 = 1e-12; -export var pi = Math.PI; -export var halfPi = pi / 2; -export var quarterPi = pi / 4; -export var tau = pi * 2; - -export var degrees = 180 / pi; -export var radians = pi / 180; - -export var abs = Math.abs; -export var atan = Math.atan; -export var atan2 = Math.atan2; -export var cos = Math.cos; -export var ceil = Math.ceil; -export var exp = Math.exp; -export var floor = Math.floor; -export var log = Math.log; -export var pow = Math.pow; -export var sin = Math.sin; -export var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; -export var sqrt = Math.sqrt; -export var tan = Math.tan; - -export function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} - -export function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} - -export function haversin(x) { - return (x = sin(x / 2)) * x; -} diff --git a/node_modules/d3-geo/src/noop.js b/node_modules/d3-geo/src/noop.js deleted file mode 100644 index ca6a744..0000000 --- a/node_modules/d3-geo/src/noop.js +++ /dev/null @@ -1 +0,0 @@ -export default function noop() {} diff --git a/node_modules/d3-geo/src/path/area.js b/node_modules/d3-geo/src/path/area.js deleted file mode 100644 index f9944ff..0000000 --- a/node_modules/d3-geo/src/path/area.js +++ /dev/null @@ -1,50 +0,0 @@ -import adder from "../adder.js"; -import {abs} from "../math.js"; -import noop from "../noop.js"; - -var areaSum = adder(), - areaRingSum = adder(), - x00, - y00, - x0, - y0; - -var areaStream = { - point: noop, - lineStart: noop, - lineEnd: noop, - polygonStart: function() { - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop; - areaSum.add(abs(areaRingSum)); - areaRingSum.reset(); - }, - result: function() { - var area = areaSum / 2; - areaSum.reset(); - return area; - } -}; - -function areaRingStart() { - areaStream.point = areaPointFirst; -} - -function areaPointFirst(x, y) { - areaStream.point = areaPoint; - x00 = x0 = x, y00 = y0 = y; -} - -function areaPoint(x, y) { - areaRingSum.add(y0 * x - x0 * y); - x0 = x, y0 = y; -} - -function areaRingEnd() { - areaPoint(x00, y00); -} - -export default areaStream; diff --git a/node_modules/d3-geo/src/path/bounds.js b/node_modules/d3-geo/src/path/bounds.js deleted file mode 100644 index 0c83258..0000000 --- a/node_modules/d3-geo/src/path/bounds.js +++ /dev/null @@ -1,28 +0,0 @@ -import noop from "../noop.js"; - -var x0 = Infinity, - y0 = x0, - x1 = -x0, - y1 = x1; - -var boundsStream = { - point: boundsPoint, - lineStart: noop, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop, - result: function() { - var bounds = [[x0, y0], [x1, y1]]; - x1 = y1 = -(y0 = x0 = Infinity); - return bounds; - } -}; - -function boundsPoint(x, y) { - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; -} - -export default boundsStream; diff --git a/node_modules/d3-geo/src/path/centroid.js b/node_modules/d3-geo/src/path/centroid.js deleted file mode 100644 index 852ef76..0000000 --- a/node_modules/d3-geo/src/path/centroid.js +++ /dev/null @@ -1,100 +0,0 @@ -import {sqrt} from "../math.js"; - -// TODO Enforce positive area for exterior, negative area for interior? - -var X0 = 0, - Y0 = 0, - Z0 = 0, - X1 = 0, - Y1 = 0, - Z1 = 0, - X2 = 0, - Y2 = 0, - Z2 = 0, - x00, - y00, - x0, - y0; - -var centroidStream = { - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.point = centroidPoint; - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - }, - result: function() { - var centroid = Z2 ? [X2 / Z2, Y2 / Z2] - : Z1 ? [X1 / Z1, Y1 / Z1] - : Z0 ? [X0 / Z0, Y0 / Z0] - : [NaN, NaN]; - X0 = Y0 = Z0 = - X1 = Y1 = Z1 = - X2 = Y2 = Z2 = 0; - return centroid; - } -}; - -function centroidPoint(x, y) { - X0 += x; - Y0 += y; - ++Z0; -} - -function centroidLineStart() { - centroidStream.point = centroidPointFirstLine; -} - -function centroidPointFirstLine(x, y) { - centroidStream.point = centroidPointLine; - centroidPoint(x0 = x, y0 = y); -} - -function centroidPointLine(x, y) { - var dx = x - x0, dy = y - y0, z = sqrt(dx * dx + dy * dy); - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - centroidPoint(x0 = x, y0 = y); -} - -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} - -function centroidRingStart() { - centroidStream.point = centroidPointFirstRing; -} - -function centroidRingEnd() { - centroidPointRing(x00, y00); -} - -function centroidPointFirstRing(x, y) { - centroidStream.point = centroidPointRing; - centroidPoint(x00 = x0 = x, y00 = y0 = y); -} - -function centroidPointRing(x, y) { - var dx = x - x0, - dy = y - y0, - z = sqrt(dx * dx + dy * dy); - - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - - z = y0 * x - x0 * y; - X2 += z * (x0 + x); - Y2 += z * (y0 + y); - Z2 += z * 3; - centroidPoint(x0 = x, y0 = y); -} - -export default centroidStream; diff --git a/node_modules/d3-geo/src/path/context.js b/node_modules/d3-geo/src/path/context.js deleted file mode 100644 index 5137fc9..0000000 --- a/node_modules/d3-geo/src/path/context.js +++ /dev/null @@ -1,45 +0,0 @@ -import {tau} from "../math.js"; -import noop from "../noop.js"; - -export default function PathContext(context) { - this._context = context; -} - -PathContext.prototype = { - _radius: 4.5, - pointRadius: function(_) { - return this._radius = _, this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._context.moveTo(x, y); - this._point = 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); - break; - } - } - }, - result: noop -}; diff --git a/node_modules/d3-geo/src/path/index.js b/node_modules/d3-geo/src/path/index.js deleted file mode 100644 index 45da305..0000000 --- a/node_modules/d3-geo/src/path/index.js +++ /dev/null @@ -1,61 +0,0 @@ -import identity from "../identity.js"; -import stream from "../stream.js"; -import pathArea from "./area.js"; -import pathBounds from "./bounds.js"; -import pathCentroid from "./centroid.js"; -import PathContext from "./context.js"; -import pathMeasure from "./measure.js"; -import PathString from "./string.js"; - -export default function(projection, context) { - var pointRadius = 4.5, - projectionStream, - contextStream; - - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - stream(object, projectionStream(contextStream)); - } - return contextStream.result(); - } - - path.area = function(object) { - stream(object, projectionStream(pathArea)); - return pathArea.result(); - }; - - path.measure = function(object) { - stream(object, projectionStream(pathMeasure)); - return pathMeasure.result(); - }; - - path.bounds = function(object) { - stream(object, projectionStream(pathBounds)); - return pathBounds.result(); - }; - - path.centroid = function(object) { - stream(object, projectionStream(pathCentroid)); - return pathCentroid.result(); - }; - - path.projection = function(_) { - return arguments.length ? (projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream, path) : projection; - }; - - path.context = function(_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - - return path.projection(projection).context(context); -} diff --git a/node_modules/d3-geo/src/path/measure.js b/node_modules/d3-geo/src/path/measure.js deleted file mode 100644 index 725a54d..0000000 --- a/node_modules/d3-geo/src/path/measure.js +++ /dev/null @@ -1,45 +0,0 @@ -import adder from "../adder.js"; -import {sqrt} from "../math.js"; -import noop from "../noop.js"; - -var lengthSum = adder(), - lengthRing, - x00, - y00, - x0, - y0; - -var lengthStream = { - point: noop, - lineStart: function() { - lengthStream.point = lengthPointFirst; - }, - lineEnd: function() { - if (lengthRing) lengthPoint(x00, y00); - lengthStream.point = noop; - }, - polygonStart: function() { - lengthRing = true; - }, - polygonEnd: function() { - lengthRing = null; - }, - result: function() { - var length = +lengthSum; - lengthSum.reset(); - return length; - } -}; - -function lengthPointFirst(x, y) { - lengthStream.point = lengthPoint; - x00 = x0 = x, y00 = y0 = y; -} - -function lengthPoint(x, y) { - x0 -= x, y0 -= y; - lengthSum.add(sqrt(x0 * x0 + y0 * y0)); - x0 = x, y0 = y; -} - -export default lengthStream; diff --git a/node_modules/d3-geo/src/path/string.js b/node_modules/d3-geo/src/path/string.js deleted file mode 100644 index 02e57b0..0000000 --- a/node_modules/d3-geo/src/path/string.js +++ /dev/null @@ -1,59 +0,0 @@ -export default function PathString() { - this._string = []; -} - -PathString.prototype = { - _radius: 4.5, - _circle: circle(4.5), - pointRadius: function(_) { - if ((_ = +_) !== this._radius) this._radius = _, this._circle = null; - return this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._string.push("Z"); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._string.push("M", x, ",", y); - this._point = 1; - break; - } - case 1: { - this._string.push("L", x, ",", y); - break; - } - default: { - if (this._circle == null) this._circle = circle(this._radius); - this._string.push("M", x, ",", y, this._circle); - break; - } - } - }, - result: function() { - if (this._string.length) { - var result = this._string.join(""); - this._string = []; - return result; - } else { - return null; - } - } -}; - -function circle(radius) { - return "m0," + radius - + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius - + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius - + "z"; -} diff --git a/node_modules/d3-geo/src/pointEqual.js b/node_modules/d3-geo/src/pointEqual.js deleted file mode 100644 index d25aa11..0000000 --- a/node_modules/d3-geo/src/pointEqual.js +++ /dev/null @@ -1,5 +0,0 @@ -import {abs, epsilon} from "./math.js"; - -export default function(a, b) { - return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon; -} diff --git a/node_modules/d3-geo/src/polygonContains.js b/node_modules/d3-geo/src/polygonContains.js deleted file mode 100644 index f1688d0..0000000 --- a/node_modules/d3-geo/src/polygonContains.js +++ /dev/null @@ -1,79 +0,0 @@ -import adder from "./adder.js"; -import {cartesian, cartesianCross, cartesianNormalizeInPlace} from "./cartesian.js"; -import {abs, asin, atan2, cos, epsilon, halfPi, pi, quarterPi, sign, sin, tau} from "./math.js"; - -var sum = adder(); - -function longitude(point) { - if (abs(point[0]) <= pi) - return point[0]; - else - return sign(point[0]) * ((abs(point[0]) + pi) % tau - pi); -} - -export default function(polygon, point) { - var lambda = longitude(point), - phi = point[1], - sinPhi = sin(phi), - normal = [sin(lambda), -cos(lambda), 0], - angle = 0, - winding = 0; - - sum.reset(); - - if (sinPhi === 1) phi = halfPi + epsilon; - else if (sinPhi === -1) phi = -halfPi - epsilon; - - for (var i = 0, n = polygon.length; i < n; ++i) { - if (!(m = (ring = polygon[i]).length)) continue; - var ring, - m, - point0 = ring[m - 1], - lambda0 = longitude(point0), - phi0 = point0[1] / 2 + quarterPi, - sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0); - - for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) { - var point1 = ring[j], - lambda1 = longitude(point1), - phi1 = point1[1] / 2 + quarterPi, - sinPhi1 = sin(phi1), - cosPhi1 = cos(phi1), - delta = lambda1 - lambda0, - sign = delta >= 0 ? 1 : -1, - absDelta = sign * delta, - antimeridian = absDelta > pi, - k = sinPhi0 * sinPhi1; - - sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta))); - angle += antimeridian ? delta + sign * tau : delta; - - // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = cartesianCross(cartesian(point0), cartesian(point1)); - cartesianNormalizeInPlace(arc); - var intersection = cartesianCross(normal, arc); - cartesianNormalizeInPlace(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]); - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) { - winding += antimeridian ^ delta >= 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 negative - // (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 || angle < epsilon && sum < -epsilon) ^ (winding & 1); -} diff --git a/node_modules/d3-geo/src/projection/albers.js b/node_modules/d3-geo/src/projection/albers.js deleted file mode 100644 index 180425d..0000000 --- a/node_modules/d3-geo/src/projection/albers.js +++ /dev/null @@ -1,10 +0,0 @@ -import conicEqualArea from "./conicEqualArea.js"; - -export default function() { - return conicEqualArea() - .parallels([29.5, 45.5]) - .scale(1070) - .translate([480, 250]) - .rotate([96, 0]) - .center([-0.6, 38.7]); -} diff --git a/node_modules/d3-geo/src/projection/albersUsa.js b/node_modules/d3-geo/src/projection/albersUsa.js deleted file mode 100644 index fd295ed..0000000 --- a/node_modules/d3-geo/src/projection/albersUsa.js +++ /dev/null @@ -1,111 +0,0 @@ -import {epsilon} from "../math.js"; -import albers from "./albers.js"; -import conicEqualArea from "./conicEqualArea.js"; -import {fitExtent, fitSize, fitWidth, fitHeight} from "./fit.js"; - -// 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 = streams.length; - return { - point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); }, - sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); }, - lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); }, - lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); }, - polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); }, - polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); } - }; -} - -// A composite projection for the United States, configured by default for -// 960×500. The projection also works quite well at 960×600 if you 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 -export default function() { - var cache, - cacheStream, - lower48 = albers(), lower48Point, - alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338 - hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007 - point, pointStream = {point: function(x, y) { point = [x, y]; }}; - - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - return point = null, - (lower48Point.point(x, y), point) - || (alaskaPoint.point(x, y), point) - || (hawaiiPoint.point(x, y), 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); - }; - - albersUsa.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]); - }; - - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - - 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); - - alaskaPoint = alaska - .translate([x - 0.307 * k, y + 0.201 * k]) - .clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]]) - .stream(pointStream); - - hawaiiPoint = hawaii - .translate([x - 0.205 * k, y + 0.212 * k]) - .clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]]) - .stream(pointStream); - - return reset(); - }; - - albersUsa.fitExtent = function(extent, object) { - return fitExtent(albersUsa, extent, object); - }; - - albersUsa.fitSize = function(size, object) { - return fitSize(albersUsa, size, object); - }; - - albersUsa.fitWidth = function(width, object) { - return fitWidth(albersUsa, width, object); - }; - - albersUsa.fitHeight = function(height, object) { - return fitHeight(albersUsa, height, object); - }; - - function reset() { - cache = cacheStream = null; - return albersUsa; - } - - return albersUsa.scale(1070); -} diff --git a/node_modules/d3-geo/src/projection/azimuthal.js b/node_modules/d3-geo/src/projection/azimuthal.js deleted file mode 100644 index 94ebb9b..0000000 --- a/node_modules/d3-geo/src/projection/azimuthal.js +++ /dev/null @@ -1,26 +0,0 @@ -import {asin, atan2, cos, sin, sqrt} from "../math.js"; - -export function azimuthalRaw(scale) { - return function(x, y) { - var cx = cos(x), - cy = cos(y), - k = scale(cx * cy); - return [ - k * cy * sin(x), - k * sin(y) - ]; - } -} - -export function azimuthalInvert(angle) { - return function(x, y) { - var z = sqrt(x * x + y * y), - c = angle(z), - sc = sin(c), - cc = cos(c); - return [ - atan2(x * sc, z * cc), - asin(z && y * sc / z) - ]; - } -} diff --git a/node_modules/d3-geo/src/projection/azimuthalEqualArea.js b/node_modules/d3-geo/src/projection/azimuthalEqualArea.js deleted file mode 100644 index 795d4c7..0000000 --- a/node_modules/d3-geo/src/projection/azimuthalEqualArea.js +++ /dev/null @@ -1,17 +0,0 @@ -import {asin, sqrt} from "../math.js"; -import {azimuthalRaw, azimuthalInvert} from "./azimuthal.js"; -import projection from "./index.js"; - -export var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { - return sqrt(2 / (1 + cxcy)); -}); - -azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) { - return 2 * asin(z / 2); -}); - -export default function() { - return projection(azimuthalEqualAreaRaw) - .scale(124.75) - .clipAngle(180 - 1e-3); -} diff --git a/node_modules/d3-geo/src/projection/azimuthalEquidistant.js b/node_modules/d3-geo/src/projection/azimuthalEquidistant.js deleted file mode 100644 index 9b89eb9..0000000 --- a/node_modules/d3-geo/src/projection/azimuthalEquidistant.js +++ /dev/null @@ -1,17 +0,0 @@ -import {acos, sin} from "../math.js"; -import {azimuthalRaw, azimuthalInvert} from "./azimuthal.js"; -import projection from "./index.js"; - -export var azimuthalEquidistantRaw = azimuthalRaw(function(c) { - return (c = acos(c)) && c / sin(c); -}); - -azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) { - return z; -}); - -export default function() { - return projection(azimuthalEquidistantRaw) - .scale(79.4188) - .clipAngle(180 - 1e-3); -} diff --git a/node_modules/d3-geo/src/projection/conic.js b/node_modules/d3-geo/src/projection/conic.js deleted file mode 100644 index 81c5744..0000000 --- a/node_modules/d3-geo/src/projection/conic.js +++ /dev/null @@ -1,15 +0,0 @@ -import {degrees, pi, radians} from "../math.js"; -import {projectionMutator} from "./index.js"; - -export function conicProjection(projectAt) { - var phi0 = 0, - phi1 = pi / 3, - m = projectionMutator(projectAt), - p = m(phi0, phi1); - - p.parallels = function(_) { - return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees]; - }; - - return p; -} diff --git a/node_modules/d3-geo/src/projection/conicConformal.js b/node_modules/d3-geo/src/projection/conicConformal.js deleted file mode 100644 index adf73da..0000000 --- a/node_modules/d3-geo/src/projection/conicConformal.js +++ /dev/null @@ -1,38 +0,0 @@ -import {abs, atan, atan2, cos, epsilon, halfPi, log, pi, pow, sign, sin, sqrt, tan} from "../math.js"; -import {conicProjection} from "./conic.js"; -import {mercatorRaw} from "./mercator.js"; - -function tany(y) { - return tan((halfPi + y) / 2); -} - -export function conicConformalRaw(y0, y1) { - var cy0 = cos(y0), - n = y0 === y1 ? sin(y0) : log(cy0 / cos(y1)) / log(tany(y1) / tany(y0)), - f = cy0 * pow(tany(y0), n) / n; - - if (!n) return mercatorRaw; - - function project(x, y) { - if (f > 0) { if (y < -halfPi + epsilon) y = -halfPi + epsilon; } - else { if (y > halfPi - epsilon) y = halfPi - epsilon; } - var r = f / pow(tany(y), n); - return [r * sin(n * x), f - r * cos(n * x)]; - } - - project.invert = function(x, y) { - var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy), - l = atan2(x, abs(fy)) * sign(fy); - if (fy * n < 0) - l -= pi * sign(x) * sign(fy); - return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi]; - }; - - return project; -} - -export default function() { - return conicProjection(conicConformalRaw) - .scale(109.5) - .parallels([30, 30]); -} diff --git a/node_modules/d3-geo/src/projection/conicEqualArea.js b/node_modules/d3-geo/src/projection/conicEqualArea.js deleted file mode 100644 index b4238e4..0000000 --- a/node_modules/d3-geo/src/projection/conicEqualArea.js +++ /dev/null @@ -1,33 +0,0 @@ -import {abs, asin, atan2, cos, epsilon, pi, sign, sin, sqrt} from "../math.js"; -import {conicProjection} from "./conic.js"; -import {cylindricalEqualAreaRaw} from "./cylindricalEqualArea.js"; - -export function conicEqualAreaRaw(y0, y1) { - var sy0 = sin(y0), n = (sy0 + sin(y1)) / 2; - - // Are the parallels symmetrical around the Equator? - if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0); - - var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n; - - function project(x, y) { - var r = sqrt(c - 2 * n * sin(y)) / n; - return [r * sin(x *= n), r0 - r * cos(x)]; - } - - project.invert = function(x, y) { - var r0y = r0 - y, - l = atan2(x, abs(r0y)) * sign(r0y); - if (r0y * n < 0) - l -= pi * sign(x) * sign(r0y); - return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))]; - }; - - return project; -} - -export default function() { - return conicProjection(conicEqualAreaRaw) - .scale(155.424) - .center([0, 33.6442]); -} diff --git a/node_modules/d3-geo/src/projection/conicEquidistant.js b/node_modules/d3-geo/src/projection/conicEquidistant.js deleted file mode 100644 index 796710e..0000000 --- a/node_modules/d3-geo/src/projection/conicEquidistant.js +++ /dev/null @@ -1,32 +0,0 @@ -import {abs, atan2, cos, epsilon, pi, sign, sin, sqrt} from "../math.js"; -import {conicProjection} from "./conic.js"; -import {equirectangularRaw} from "./equirectangular.js"; - -export function conicEquidistantRaw(y0, y1) { - var cy0 = cos(y0), - n = y0 === y1 ? sin(y0) : (cy0 - cos(y1)) / (y1 - y0), - g = cy0 / n + y0; - - if (abs(n) < epsilon) return equirectangularRaw; - - function project(x, y) { - var gy = g - y, nx = n * x; - return [gy * sin(nx), g - gy * cos(nx)]; - } - - project.invert = function(x, y) { - var gy = g - y, - l = atan2(x, abs(gy)) * sign(gy); - if (gy * n < 0) - l -= pi * sign(x) * sign(gy); - return [l / n, g - sign(n) * sqrt(x * x + gy * gy)]; - }; - - return project; -} - -export default function() { - return conicProjection(conicEquidistantRaw) - .scale(131.154) - .center([0, 13.9389]); -} diff --git a/node_modules/d3-geo/src/projection/cylindricalEqualArea.js b/node_modules/d3-geo/src/projection/cylindricalEqualArea.js deleted file mode 100644 index 1d38b40..0000000 --- a/node_modules/d3-geo/src/projection/cylindricalEqualArea.js +++ /dev/null @@ -1,15 +0,0 @@ -import {asin, cos, sin} from "../math.js"; - -export function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = cos(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, sin(phi) / cosPhi0]; - } - - forward.invert = function(x, y) { - return [x / cosPhi0, asin(y * cosPhi0)]; - }; - - return forward; -} diff --git a/node_modules/d3-geo/src/projection/equalEarth.js b/node_modules/d3-geo/src/projection/equalEarth.js deleted file mode 100644 index dc5ce2c..0000000 --- a/node_modules/d3-geo/src/projection/equalEarth.js +++ /dev/null @@ -1,36 +0,0 @@ -import projection from "./index.js"; -import {abs, asin, cos, epsilon2, sin, sqrt} from "../math.js"; - -var A1 = 1.340264, - A2 = -0.081106, - A3 = 0.000893, - A4 = 0.003796, - M = sqrt(3) / 2, - iterations = 12; - -export function equalEarthRaw(lambda, phi) { - var l = asin(M * sin(phi)), l2 = l * l, l6 = l2 * l2 * l2; - return [ - lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), - l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - ]; -} - -equalEarthRaw.invert = function(x, y) { - var l = y, l2 = l * l, l6 = l2 * l2 * l2; - for (var i = 0, delta, fy, fpy; i < iterations; ++i) { - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if (abs(delta) < epsilon2) break; - } - return [ - M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l), - asin(sin(l) / M) - ]; -}; - -export default function() { - return projection(equalEarthRaw) - .scale(177.158); -} diff --git a/node_modules/d3-geo/src/projection/equirectangular.js b/node_modules/d3-geo/src/projection/equirectangular.js deleted file mode 100644 index d47065c..0000000 --- a/node_modules/d3-geo/src/projection/equirectangular.js +++ /dev/null @@ -1,12 +0,0 @@ -import projection from "./index.js"; - -export function equirectangularRaw(lambda, phi) { - return [lambda, phi]; -} - -equirectangularRaw.invert = equirectangularRaw; - -export default function() { - return projection(equirectangularRaw) - .scale(152.63); -} diff --git a/node_modules/d3-geo/src/projection/fit.js b/node_modules/d3-geo/src/projection/fit.js deleted file mode 100644 index d496d0f..0000000 --- a/node_modules/d3-geo/src/projection/fit.js +++ /dev/null @@ -1,47 +0,0 @@ -import {default as geoStream} from "../stream.js"; -import boundsStream from "../path/bounds.js"; - -function fit(projection, fitBounds, object) { - var clip = projection.clipExtent && projection.clipExtent(); - projection.scale(150).translate([0, 0]); - if (clip != null) projection.clipExtent(null); - geoStream(object, projection.stream(boundsStream)); - fitBounds(boundsStream.result()); - if (clip != null) projection.clipExtent(clip); - return projection; -} - -export function fitExtent(projection, extent, object) { - return fit(projection, function(b) { - var w = extent[1][0] - extent[0][0], - h = extent[1][1] - extent[0][1], - k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), - x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, - y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([x, y]); - }, object); -} - -export function fitSize(projection, size, object) { - return fitExtent(projection, [[0, 0], size], object); -} - -export function fitWidth(projection, width, object) { - return fit(projection, function(b) { - var w = +width, - k = w / (b[1][0] - b[0][0]), - x = (w - k * (b[1][0] + b[0][0])) / 2, - y = -k * b[0][1]; - projection.scale(150 * k).translate([x, y]); - }, object); -} - -export function fitHeight(projection, height, object) { - return fit(projection, function(b) { - var h = +height, - k = h / (b[1][1] - b[0][1]), - x = -k * b[0][0], - y = (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([x, y]); - }, object); -} diff --git a/node_modules/d3-geo/src/projection/gnomonic.js b/node_modules/d3-geo/src/projection/gnomonic.js deleted file mode 100644 index 5da1cc7..0000000 --- a/node_modules/d3-geo/src/projection/gnomonic.js +++ /dev/null @@ -1,16 +0,0 @@ -import {atan, cos, sin} from "../math.js"; -import {azimuthalInvert} from "./azimuthal.js"; -import projection from "./index.js"; - -export function gnomonicRaw(x, y) { - var cy = cos(y), k = cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; -} - -gnomonicRaw.invert = azimuthalInvert(atan); - -export default function() { - return projection(gnomonicRaw) - .scale(144.049) - .clipAngle(60); -} diff --git a/node_modules/d3-geo/src/projection/identity.js b/node_modules/d3-geo/src/projection/identity.js deleted file mode 100644 index cc439d8..0000000 --- a/node_modules/d3-geo/src/projection/identity.js +++ /dev/null @@ -1,85 +0,0 @@ -import clipRectangle from "../clip/rectangle.js"; -import identity from "../identity.js"; -import {transformer} from "../transform.js"; -import {fitExtent, fitSize, fitWidth, fitHeight} from "./fit.js"; -import {cos, degrees, radians, sin} from "../math.js"; - -export default function() { - var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, // scale, translate and reflect - alpha = 0, ca, sa, // angle - x0 = null, y0, x1, y1, // clip extent - kx = 1, ky = 1, - transform = transformer({ - point: function(x, y) { - var p = projection([x, y]) - this.stream.point(p[0], p[1]); - } - }), - postclip = identity, - cache, - cacheStream; - - function reset() { - kx = k * sx; - ky = k * sy; - cache = cacheStream = null; - return projection; - } - - function projection (p) { - var x = p[0] * kx, y = p[1] * ky; - if (alpha) { - var t = y * ca - x * sa; - x = x * ca + y * sa; - y = t; - } - return [x + tx, y + ty]; - } - projection.invert = function(p) { - var x = p[0] - tx, y = p[1] - ty; - if (alpha) { - var t = y * ca + x * sa; - x = x * ca - y * sa; - y = t; - } - return [x / kx, y / ky]; - }; - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream)); - }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - projection.scale = function(_) { - return arguments.length ? (k = +_, reset()) : k; - }; - projection.translate = function(_) { - return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty]; - } - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees; - }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0; - }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0; - }; - projection.fitExtent = function(extent, object) { - return fitExtent(projection, extent, object); - }; - projection.fitSize = function(size, object) { - return fitSize(projection, size, object); - }; - projection.fitWidth = function(width, object) { - return fitWidth(projection, width, object); - }; - projection.fitHeight = function(height, object) { - return fitHeight(projection, height, object); - }; - - return projection; -} diff --git a/node_modules/d3-geo/src/projection/index.js b/node_modules/d3-geo/src/projection/index.js deleted file mode 100644 index 8db563d..0000000 --- a/node_modules/d3-geo/src/projection/index.js +++ /dev/null @@ -1,176 +0,0 @@ -import clipAntimeridian from "../clip/antimeridian.js"; -import clipCircle from "../clip/circle.js"; -import clipRectangle from "../clip/rectangle.js"; -import compose from "../compose.js"; -import identity from "../identity.js"; -import {cos, degrees, radians, sin, sqrt} from "../math.js"; -import {rotateRadians} from "../rotation.js"; -import {transformer} from "../transform.js"; -import {fitExtent, fitSize, fitWidth, fitHeight} from "./fit.js"; -import resample from "./resample.js"; - -var transformRadians = transformer({ - point: function(x, y) { - this.stream.point(x * radians, y * radians); - } -}); - -function transformRotate(rotate) { - return transformer({ - point: function(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); - } - }); -} - -function scaleTranslate(k, dx, dy, sx, sy) { - function transform(x, y) { - x *= sx; y *= sy; - return [dx + k * x, dy - k * y]; - } - transform.invert = function(x, y) { - return [(x - dx) / k * sx, (dy - y) / k * sy]; - }; - return transform; -} - -function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - var cosAlpha = cos(alpha), - sinAlpha = sin(alpha), - a = cosAlpha * k, - b = sinAlpha * k, - ai = cosAlpha / k, - bi = sinAlpha / k, - ci = (sinAlpha * dy - cosAlpha * dx) / k, - fi = (sinAlpha * dx + cosAlpha * dy) / k; - function transform(x, y) { - x *= sx; y *= sy; - return [a * x - b * y + dx, dy - b * x - a * y]; - } - transform.invert = function(x, y) { - return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)]; - }; - return transform; -} - -export default function projection(project) { - return projectionMutator(function() { return project; })(); -} - -export function projectionMutator(projectAt) { - var project, - k = 150, // scale - x = 480, y = 250, // translate - lambda = 0, phi = 0, // center - deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate - alpha = 0, // post-rotate angle - sx = 1, // reflectX - sy = 1, // reflectX - theta = null, preclip = clipAntimeridian, // pre-clip angle - x0 = null, y0, x1, y1, postclip = identity, // post-clip extent - delta2 = 0.5, // precision - projectResample, - projectTransform, - projectRotateTransform, - cache, - cacheStream; - - function projection(point) { - return projectRotateTransform(point[0] * radians, point[1] * radians); - } - - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [point[0] * degrees, point[1] * degrees]; - } - - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); - }; - - projection.preclip = function(_) { - return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; - }; - - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - - projection.clipAngle = function(_) { - return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees; - }; - - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - projection.scale = function(_) { - return arguments.length ? (k = +_, recenter()) : k; - }; - - projection.translate = function(_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y]; - }; - - projection.center = function(_) { - return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees]; - }; - - projection.rotate = function(_) { - return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; - }; - - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees; - }; - - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; - }; - - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; - }; - - projection.precision = function(_) { - return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2); - }; - - projection.fitExtent = function(extent, object) { - return fitExtent(projection, extent, object); - }; - - projection.fitSize = function(size, object) { - return fitSize(projection, size, object); - }; - - projection.fitWidth = function(width, object) { - return fitWidth(projection, width, object); - }; - - projection.fitHeight = function(height, object) { - return fitHeight(projection, height, object); - }; - - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), - transform = (alpha ? scaleTranslateRotate : scaleTranslate)(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma); - projectTransform = compose(project, transform); - projectRotateTransform = compose(rotate, projectTransform); - projectResample = resample(projectTransform, delta2); - return reset(); - } - - function reset() { - cache = cacheStream = null; - return projection; - } - - return function() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; -} diff --git a/node_modules/d3-geo/src/projection/mercator.js b/node_modules/d3-geo/src/projection/mercator.js deleted file mode 100644 index be975a9..0000000 --- a/node_modules/d3-geo/src/projection/mercator.js +++ /dev/null @@ -1,52 +0,0 @@ -import {atan, exp, halfPi, log, pi, tan, tau} from "../math.js"; -import rotation from "../rotation.js"; -import projection from "./index.js"; - -export function mercatorRaw(lambda, phi) { - return [lambda, log(tan((halfPi + phi) / 2))]; -} - -mercatorRaw.invert = function(x, y) { - return [x, 2 * atan(exp(y)) - halfPi]; -}; - -export default function() { - return mercatorProjection(mercatorRaw) - .scale(961 / tau); -} - -export function mercatorProjection(project) { - var m = projection(project), - center = m.center, - scale = m.scale, - translate = m.translate, - clipExtent = m.clipExtent, - x0 = null, y0, x1, y1; // clip extent - - m.scale = function(_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - - m.translate = function(_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - - m.center = function(_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - - m.clipExtent = function(_) { - return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - function reclip() { - var k = pi * scale(), - t = m(rotation(m.rotate()).invert([0, 0])); - return clipExtent(x0 == null - ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === 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(); -} diff --git a/node_modules/d3-geo/src/projection/naturalEarth1.js b/node_modules/d3-geo/src/projection/naturalEarth1.js deleted file mode 100644 index fe5ed31..0000000 --- a/node_modules/d3-geo/src/projection/naturalEarth1.js +++ /dev/null @@ -1,28 +0,0 @@ -import projection from "./index.js"; -import {abs, epsilon} from "../math.js"; - -export function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2; - return [ - lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), - phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - ]; -} - -naturalEarth1Raw.invert = function(x, y) { - var phi = y, i = 25, delta; - do { - var phi2 = phi * phi, phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 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 && --i > 0); - return [ - x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), - phi - ]; -}; - -export default function() { - return projection(naturalEarth1Raw) - .scale(175.295); -} diff --git a/node_modules/d3-geo/src/projection/orthographic.js b/node_modules/d3-geo/src/projection/orthographic.js deleted file mode 100644 index b5a8351..0000000 --- a/node_modules/d3-geo/src/projection/orthographic.js +++ /dev/null @@ -1,15 +0,0 @@ -import {asin, cos, epsilon, sin} from "../math.js"; -import {azimuthalInvert} from "./azimuthal.js"; -import projection from "./index.js"; - -export function orthographicRaw(x, y) { - return [cos(y) * sin(x), sin(y)]; -} - -orthographicRaw.invert = azimuthalInvert(asin); - -export default function() { - return projection(orthographicRaw) - .scale(249.5) - .clipAngle(90 + epsilon); -} diff --git a/node_modules/d3-geo/src/projection/resample.js b/node_modules/d3-geo/src/projection/resample.js deleted file mode 100644 index 268fc44..0000000 --- a/node_modules/d3-geo/src/projection/resample.js +++ /dev/null @@ -1,102 +0,0 @@ -import {cartesian} from "../cartesian.js"; -import {abs, asin, atan2, cos, epsilon, radians, sqrt} from "../math.js"; -import {transformer} from "../transform.js"; - -var maxDepth = 16, // maximum depth of subdivision - cosMinDistance = cos(30 * radians); // cos(minimum angular distance) - -export default function(project, delta2) { - return +delta2 ? resample(project, delta2) : resampleNone(project); -} - -function resampleNone(project) { - return transformer({ - point: function(x, y) { - x = project(x, y); - this.stream.point(x[0], x[1]); - } - }); -} - -function resample(project, delta2) { - - function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) { - var dx = x1 - x0, - dy = y1 - y0, - d2 = dx * dx + dy * dy; - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, - b = b0 + b1, - c = c0 + c1, - m = sqrt(a * a + b * b + c * c), - phi2 = asin(c /= m), - lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a), - p = project(lambda2, phi2), - x2 = p[0], - y2 = p[1], - dx2 = x2 - x0, - dy2 = y2 - y0, - dz = 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 distance - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } - } - } - return function(stream) { - var lambda00, x00, y00, a00, b00, c00, // first point - lambda0, x0, y0, a0, b0, c0; // previous point - - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; }, - polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; } - }; - - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - - function linePoint(lambda, phi) { - var c = cartesian([lambda, phi]), p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - - return resampleStream; - }; -} diff --git a/node_modules/d3-geo/src/projection/stereographic.js b/node_modules/d3-geo/src/projection/stereographic.js deleted file mode 100644 index 5f9694a..0000000 --- a/node_modules/d3-geo/src/projection/stereographic.js +++ /dev/null @@ -1,18 +0,0 @@ -import {atan, cos, sin} from "../math.js"; -import {azimuthalInvert} from "./azimuthal.js"; -import projection from "./index.js"; - -export function stereographicRaw(x, y) { - var cy = cos(y), k = 1 + cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; -} - -stereographicRaw.invert = azimuthalInvert(function(z) { - return 2 * atan(z); -}); - -export default function() { - return projection(stereographicRaw) - .scale(250) - .clipAngle(142); -} diff --git a/node_modules/d3-geo/src/projection/transverseMercator.js b/node_modules/d3-geo/src/projection/transverseMercator.js deleted file mode 100644 index bedd1c3..0000000 --- a/node_modules/d3-geo/src/projection/transverseMercator.js +++ /dev/null @@ -1,27 +0,0 @@ -import {atan, exp, halfPi, log, tan} from "../math.js"; -import {mercatorProjection} from "./mercator.js"; - -export function transverseMercatorRaw(lambda, phi) { - return [log(tan((halfPi + phi) / 2)), -lambda]; -} - -transverseMercatorRaw.invert = function(x, y) { - return [-y, 2 * atan(exp(x)) - halfPi]; -}; - -export default function() { - var m = mercatorProjection(transverseMercatorRaw), - center = m.center, - rotate = m.rotate; - - m.center = function(_) { - return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); - }; - - m.rotate = function(_) { - return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]); - }; - - return rotate([0, 0, 90]) - .scale(159.155); -} diff --git a/node_modules/d3-geo/src/rotation.js b/node_modules/d3-geo/src/rotation.js deleted file mode 100644 index 4e2def3..0000000 --- a/node_modules/d3-geo/src/rotation.js +++ /dev/null @@ -1,76 +0,0 @@ -import compose from "./compose.js"; -import {abs, asin, atan2, cos, degrees, pi, radians, sin, tau} from "./math.js"; - -function rotationIdentity(lambda, phi) { - return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi]; -} - -rotationIdentity.invert = rotationIdentity; - -export function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= tau) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) - : rotationLambda(deltaLambda)) - : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) - : rotationIdentity); -} - -function forwardRotationLambda(deltaLambda) { - return function(lambda, phi) { - return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi]; - }; -} - -function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; -} - -function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = cos(deltaPhi), - sinDeltaPhi = sin(deltaPhi), - cosDeltaGamma = cos(deltaGamma), - sinDeltaGamma = sin(deltaGamma); - - function rotation(lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi), - k = z * cosDeltaPhi + x * sinDeltaPhi; - return [ - atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), - asin(k * cosDeltaGamma + y * sinDeltaGamma) - ]; - } - - rotation.invert = function(lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi), - k = z * cosDeltaGamma - y * sinDeltaGamma; - return [ - atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), - asin(k * cosDeltaPhi - x * sinDeltaPhi) - ]; - }; - - return rotation; -} - -export default function(rotate) { - rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0); - - function forward(coordinates) { - coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; - } - - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; - }; - - return forward; -} diff --git a/node_modules/d3-geo/src/stream.js b/node_modules/d3-geo/src/stream.js deleted file mode 100644 index ee994ae..0000000 --- a/node_modules/d3-geo/src/stream.js +++ /dev/null @@ -1,69 +0,0 @@ -function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { - streamGeometryType[geometry.type](geometry, stream); - } -} - -var streamObjectType = { - Feature: function(object, stream) { - streamGeometry(object.geometry, stream); - }, - FeatureCollection: function(object, stream) { - var features = object.features, i = -1, n = features.length; - while (++i < n) streamGeometry(features[i].geometry, stream); - } -}; - -var streamGeometryType = { - Sphere: function(object, stream) { - stream.sphere(); - }, - Point: function(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); - }, - MultiPoint: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]); - }, - LineString: function(object, stream) { - streamLine(object.coordinates, stream, 0); - }, - MultiLineString: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamLine(coordinates[i], stream, 0); - }, - Polygon: function(object, stream) { - streamPolygon(object.coordinates, stream); - }, - MultiPolygon: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamPolygon(coordinates[i], stream); - }, - GeometryCollection: function(object, stream) { - var geometries = object.geometries, i = -1, n = geometries.length; - while (++i < n) streamGeometry(geometries[i], stream); - } -}; - -function streamLine(coordinates, stream, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - stream.lineStart(); - while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - stream.lineEnd(); -} - -function streamPolygon(coordinates, stream) { - var i = -1, n = coordinates.length; - stream.polygonStart(); - while (++i < n) streamLine(coordinates[i], stream, 1); - stream.polygonEnd(); -} - -export default function(object, stream) { - if (object && streamObjectType.hasOwnProperty(object.type)) { - streamObjectType[object.type](object, stream); - } else { - streamGeometry(object, stream); - } -} diff --git a/node_modules/d3-geo/src/transform.js b/node_modules/d3-geo/src/transform.js deleted file mode 100644 index a954bc5..0000000 --- a/node_modules/d3-geo/src/transform.js +++ /dev/null @@ -1,26 +0,0 @@ -export default function(methods) { - return { - stream: transformer(methods) - }; -} - -export function transformer(methods) { - return function(stream) { - var s = new TransformStream; - for (var key in methods) s[key] = methods[key]; - s.stream = stream; - return s; - }; -} - -function TransformStream() {} - -TransformStream.prototype = { - 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(); } -}; diff --git a/node_modules/d3-hierarchy/LICENSE b/node_modules/d3-hierarchy/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-hierarchy/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-hierarchy/README.md b/node_modules/d3-hierarchy/README.md deleted file mode 100644 index 07ce2b1..0000000 --- a/node_modules/d3-hierarchy/README.md +++ /dev/null @@ -1,548 +0,0 @@ -# d3-hierarchy - -Many datasets are intrinsically hierarchical. Consider [geographic entities](https://www.census.gov/geo/reference/hierarchy.html), such as census blocks, census tracts, counties and states; the command structure of businesses and governments; file systems and software packages. And even non-hierarchical data may be arranged empirically into a hierarchy, as with [*k*-means clustering](https://en.wikipedia.org/wiki/K-means_clustering) or [phylogenetic trees](https://observablehq.com/@mbostock/tree-of-life). - -This module implements several popular techniques for visualizing hierarchical data: - -**Node-link diagrams** show topology using discrete marks for nodes and links, such as a circle for each node and a line connecting each parent and child. The [“tidy” tree](#tree) is delightfully compact, while the [dendrogram](#cluster) places leaves at the same level. (These have both polar and Cartesian forms.) [Indented trees](https://bl.ocks.org/mbostock/1093025) are useful for interactive browsing. - -**Adjacency diagrams** show topology through the relative placement of nodes. They may also encode a quantitative dimension in the area of each node, for example to show revenue or file size. The [“icicle” diagram](#partition) uses rectangles, while the “sunburst” uses annular segments. - -**Enclosure diagrams** also use an area encoding, but show topology through containment. A [treemap](#treemap) recursively subdivides area into rectangles. [Circle-packing](#pack) tightly nests circles; this is not as space-efficient as a treemap, but perhaps more readily shows topology. - -A good hierarchical visualization facilitates rapid multiscale inference: micro-observations of individual elements and macro-observations of large groups. - -## Installing - -If you use NPM, `npm install d3-hierarchy`. Otherwise, download the [latest release](https://github.com/d3/d3-hierarchy/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-hierarchy.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -## API Reference - -* [Hierarchy](#hierarchy) ([Stratify](#stratify)) -* [Cluster](#cluster) -* [Tree](#tree) -* [Treemap](#treemap) ([Treemap Tiling](#treemap-tiling)) -* [Partition](#partition) -* [Pack](#pack) - -### Hierarchy - -Before you can compute a hierarchical layout, you need a root node. If your data is already in a hierarchical format, such as JSON, you can pass it directly to [d3.hierarchy](#hierarchy); otherwise, you can rearrange tabular data, such as comma-separated values (CSV), into a hierarchy using [d3.stratify](#stratify). - -# d3.hierarchy(data[, children]) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/index.js), [Examples](https://observablehq.com/@d3/d3-hierarchy) - -Constructs a root node from the specified hierarchical *data*. The specified *data* must be an object representing the root node. For example: - -```json -{ - "name": "Eve", - "children": [ - { - "name": "Cain" - }, - { - "name": "Seth", - "children": [ - { - "name": "Enos" - }, - { - "name": "Noam" - } - ] - }, - { - "name": "Abel" - }, - { - "name": "Awan", - "children": [ - { - "name": "Enoch" - } - ] - }, - { - "name": "Azura" - } - ] -} -``` - -The specified *children* accessor function is invoked for each datum, starting with the root *data*, and must return an array of data representing the children, or null if the current datum has no children. If *children* is not specified, it defaults to: - -```js -function children(d) { - return d.children; -} -``` - -The returned node and each descendant has the following properties: - -* *node*.data - the associated data, as specified to the [constructor](#hierarchy). -* *node*.depth - zero for the root node, and increasing by one for each descendant generation. -* *node*.height - zero for leaf nodes, and the greatest distance from any descendant leaf for internal nodes. -* *node*.parent - the parent node, or null for the root node. -* *node*.children - an array of child nodes, if any; undefined for leaf nodes. -* *node*.value - the summed value of the node and its [descendants](#node_descendants); optional, see [*node*.sum](#node_sum) and [*node*.count](#node_count). - -This method can also be used to test if a node is an `instanceof d3.hierarchy` and to extend the node prototype. - -# node.ancestors() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/ancestors.js), [Examples](https://observablehq.com/@d3/d3-hierarchy) - -Returns the array of ancestors nodes, starting with this node, then followed by each parent up to the root. - -# node.descendants() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/descendants.js), [Examples](https://observablehq.com/@d3/d3-hierarchy) - -Returns the array of descendant nodes, starting with this node, then followed by each child in topological order. - -# node.leaves() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/leaves.js), [Examples](https://observablehq.com/@d3/d3-hierarchy) - -Returns the array of leaf nodes in traversal order; leaves are nodes with no children. - -# node.path(target) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/path.js), [Examples](https://observablehq.com/@d3/d3-hierarchy) - -Returns the shortest path through the hierarchy from this *node* to the specified *target* node. The path starts at this *node*, ascends to the least common ancestor of this *node* and the *target* node, and then descends to the *target* node. This is particularly useful for [hierarchical edge bundling](https://observablehq.com/@d3/hierarchical-edge-bundling). - -# node.links() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/links.js), [Examples](https://observablehq.com/@d3/d3-hierarchy) - -Returns an array of links for this *node*, where each *link* is an object that defines source and target properties. The source of each link is the parent node, and the target is a child node. - -# node.sum(value) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/sum.js), [Examples](https://observablehq.com/@d3/visiting-a-d3-hierarchy) - -Evaluates the specified *value* function for this *node* and each descendant in [post-order traversal](#node_eachAfter), and returns this *node*. The *node*.value property of each node is set to the numeric value returned by the specified function plus the combined value of all children. The function is passed the node’s data, and must return a non-negative number. The *value* accessor is evaluated for *node* and every descendant, including internal nodes; if you only want leaf nodes to have internal value, then return zero for any node with children. [For example](https://observablehq.com/@d3/treemap-by-count), as an alternative to [*node*.count](#node_count): - -```js -root.sum(function(d) { return d.value ? 1 : 0; }); -``` - -You must call *node*.sum or [*node*.count](#node_count) before invoking a hierarchical layout that requires *node*.value, such as [d3.treemap](#treemap). Since the API supports [method chaining](https://en.wikipedia.org/wiki/Method_chaining), you can invoke *node*.sum and [*node*.sort](#node_sort) before computing the layout, and then subsequently generate an array of all [descendant nodes](#node_descendants) like so: - -```js -var treemap = d3.treemap() - .size([width, height]) - .padding(2); - -var nodes = treemap(root - .sum(function(d) { return d.value; }) - .sort(function(a, b) { return b.height - a.height || b.value - a.value; })) - .descendants(); -``` - -This example assumes that the node data has a value field. - -# node.count() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/count.js), [Examples](https://observablehq.com/@d3/visiting-a-d3-hierarchy) - -Computes the number of leaves under this *node* and assigns it to *node*.value, and similarly for every descendant of *node*. If this *node* is a leaf, its count is one. Returns this *node*. See also [*node*.sum](#node_sum). - -# node.sort(compare) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/sort.js), [Examples](https://observablehq.com/@d3/visiting-a-d3-hierarchy) - -Sorts the children of this *node*, if any, and each of this *node*’s descendants’ children, in [pre-order traversal](#node_eachBefore) using the specified *compare* function, and returns this *node*. The specified function is passed two nodes *a* and *b* to compare. If *a* should be before *b*, the function must return a value less than zero; if *b* should be before *a*, the function must return a value greater than zero; otherwise, the relative order of *a* and *b* are not specified. See [*array*.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) for more. - -Unlike [*node*.sum](#node_sum), the *compare* function is passed two [nodes](#hierarchy) rather than two nodes’ data. For example, if the data has a value property, this sorts nodes by the descending aggregate value of the node and all its descendants, as is recommended for [circle-packing](#pack): - -```js -root - .sum(function(d) { return d.value; }) - .sort(function(a, b) { return b.value - a.value; }); -`````` - -Similarly, to sort nodes by descending height (greatest distance from any descendant leaf) and then descending value, as is recommended for [treemaps](#treemap) and [icicles](#partition): - -```js -root - .sum(function(d) { return d.value; }) - .sort(function(a, b) { return b.height - a.height || b.value - a.value; }); -``` - -To sort nodes by descending height and then ascending id, as is recommended for [trees](#tree) and [dendrograms](#cluster): - -```js -root - .sum(function(d) { return d.value; }) - .sort(function(a, b) { return b.height - a.height || a.id.localeCompare(b.id); }); -``` - -You must call *node*.sort before invoking a hierarchical layout if you want the new sort order to affect the layout; see [*node*.sum](#node_sum) for an example. - -# node.each(function) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/each.js), [Examples](https://observablehq.com/@d3/visiting-a-d3-hierarchy) - -Invokes the specified *function* for *node* and each descendant in [breadth-first order](https://en.wikipedia.org/wiki/Breadth-first_search), such that a given *node* is only visited if all nodes of lesser depth have already been visited, as well as all preceding nodes of the same depth. The specified function is passed the current *node*. - -# node.eachAfter(function) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/eachAfter.js), [Examples](https://observablehq.com/@d3/visiting-a-d3-hierarchy) - -Invokes the specified *function* for *node* and each descendant in [post-order traversal](https://en.wikipedia.org/wiki/Tree_traversal#Post-order), such that a given *node* is only visited after all of its descendants have already been visited. The specified function is passed the current *node*. - -# node.eachBefore(function) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/eachBefore.js), [Examples](https://observablehq.com/@d3/visiting-a-d3-hierarchy) - -Invokes the specified *function* for *node* and each descendant in [pre-order traversal](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order), such that a given *node* is only visited after all of its ancestors have already been visited. The specified function is passed the current *node*. - -# node.copy() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy/index.js), [Examples](https://observablehq.com/@d3/d3-hierarchy) - -Return a deep copy of the subtree starting at this *node*. (The returned deep copy shares the same data, however.) The returned node is the root of a new tree; the returned node’s parent is always null and its depth is always zero. - -#### Stratify - -Consider the following table of relationships: - -Name | Parent -------|-------- -Eve | -Cain | Eve -Seth | Eve -Enos | Seth -Noam | Seth -Abel | Eve -Awan | Eve -Enoch | Awan -Azura | Eve - -These names are conveniently unique, so we can unambiguously represent the hierarchy as a CSV file: - -``` -name,parent -Eve, -Cain,Eve -Seth,Eve -Enos,Seth -Noam,Seth -Abel,Eve -Awan,Eve -Enoch,Awan -Azura,Eve -``` - -To parse the CSV using [d3.csvParse](https://github.com/d3/d3-dsv#csvParse): - -```js -var table = d3.csvParse(text); -``` - -This returns: - -```json -[ - {"name": "Eve", "parent": ""}, - {"name": "Cain", "parent": "Eve"}, - {"name": "Seth", "parent": "Eve"}, - {"name": "Enos", "parent": "Seth"}, - {"name": "Noam", "parent": "Seth"}, - {"name": "Abel", "parent": "Eve"}, - {"name": "Awan", "parent": "Eve"}, - {"name": "Enoch", "parent": "Awan"}, - {"name": "Azura", "parent": "Eve"} -] -``` - -To convert to a hierarchy: - -```js -var root = d3.stratify() - .id(function(d) { return d.name; }) - .parentId(function(d) { return d.parent; }) - (table); -``` - -This returns: - -[Stratify](https://runkit.com/mbostock/56fed33d8630b01300f72daa) - -This hierarchy can now be passed to a hierarchical layout, such as [d3.tree](#_tree), for visualization. - -# d3.stratify() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/stratify.js), [Examples](https://observablehq.com/@d3/d3-stratify) - -Constructs a new stratify operator with the default settings. - -# stratify(data) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/stratify.js), [Examples](https://observablehq.com/@d3/d3-stratify) - -Generates a new hierarchy from the specified tabular *data*. - -# stratify.id([id]) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/stratify.js), [Examples](https://observablehq.com/@d3/d3-stratify) - -If *id* is specified, sets the id accessor to the given function and returns this stratify operator. Otherwise, returns the current id accessor, which defaults to: - -```js -function id(d) { - return d.id; -} -``` - -The id accessor is invoked for each element in the input data passed to the [stratify operator](#_stratify), being passed the current datum (*d*) and the current index (*i*). The returned string is then used to identify the node’s relationships in conjunction with the [parent id](#stratify_parentId). For leaf nodes, the id may be undefined; otherwise, the id must be unique. (Null and the empty string are equivalent to undefined.) - -# stratify.parentId([parentId]) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/stratify.js), [Examples](https://observablehq.com/@d3/d3-stratify) - -If *parentId* is specified, sets the parent id accessor to the given function and returns this stratify operator. Otherwise, returns the current parent id accessor, which defaults to: - -```js -function parentId(d) { - return d.parentId; -} -``` - -The parent id accessor is invoked for each element in the input data passed to the [stratify operator](#_stratify), being passed the current datum (*d*) and the current index (*i*). The returned string is then used to identify the node’s relationships in conjunction with the [id](#stratify_id). For the root node, the parent id should be undefined. (Null and the empty string are equivalent to undefined.) There must be exactly one root node in the input data, and no circular relationships. - -### Cluster - -[Dendrogram](https://observablehq.com/@d3/cluster-dendrogram) - -The **cluster layout** produces [dendrograms](http://en.wikipedia.org/wiki/Dendrogram): node-link diagrams that place leaf nodes of the tree at the same depth. Dendrograms are typically less compact than [tidy trees](#tree), but are useful when all the leaves should be at the same level, such as for hierarchical clustering or [phylogenetic tree diagrams](https://observablehq.com/@mbostock/tree-of-life). - -# d3.cluster() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/cluster.js), [Examples](https://observablehq.com/@d3/cluster-dendrogram) - -Creates a new cluster layout with default settings. - -# cluster(root) - -Lays out the specified *root* [hierarchy](#hierarchy), assigning the following properties on *root* and its descendants: - -* *node*.x - the *x*-coordinate of the node -* *node*.y - the *y*-coordinate of the node - -The coordinates *x* and *y* represent an arbitrary coordinate system; for example, you can treat *x* as an angle and *y* as a radius to produce a [radial layout](https://observablehq.com/@d3/radial-dendrogram). You may want to call [*root*.sort](#node_sort) before passing the hierarchy to the cluster layout. - -# cluster.size([size]) - -If *size* is specified, sets this cluster layout’s size to the specified two-element array of numbers [*width*, *height*] and returns this cluster layout. If *size* is not specified, returns the current layout size, which defaults to [1, 1]. A layout size of null indicates that a [node size](#cluster_nodeSize) will be used instead. The coordinates *x* and *y* represent an arbitrary coordinate system; for example, to produce a [radial layout](https://observablehq.com/@d3/radial-dendrogram), a size of [360, *radius*] corresponds to a breadth of 360° and a depth of *radius*. - -# cluster.nodeSize([size]) - -If *size* is specified, sets this cluster layout’s node size to the specified two-element array of numbers [*width*, *height*] and returns this cluster layout. If *size* is not specified, returns the current node size, which defaults to null. A node size of null indicates that a [layout size](#cluster_size) will be used instead. When a node size is specified, the root node is always positioned at ⟨0, 0⟩. - -# cluster.separation([separation]) - -If *separation* is specified, sets the separation accessor to the specified function and returns this cluster layout. If *separation* is not specified, returns the current separation accessor, which defaults to: - -```js -function separation(a, b) { - return a.parent == b.parent ? 1 : 2; -} -``` - -The separation accessor is used to separate neighboring leaves. The separation function is passed two leaves *a* and *b*, and must return the desired separation. The nodes are typically siblings, though the nodes may be more distantly related if the layout decides to place such nodes adjacent. - -### Tree - -[Tidy Tree](https://observablehq.com/@d3/tidy-tree) - -The **tree** layout produces tidy node-link diagrams of trees using the [Reingold–Tilford “tidy” algorithm](http://reingold.co/tidier-drawings.pdf), improved to run in linear time by [Buchheim *et al.*](http://dirk.jivas.de/papers/buchheim02improving.pdf) Tidy trees are typically more compact than [dendrograms](#cluster). - -# d3.tree() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/tree.js), [Examples](https://observablehq.com/@d3/tidy-tree) - -Creates a new tree layout with default settings. - -# tree(root) - -Lays out the specified *root* [hierarchy](#hierarchy), assigning the following properties on *root* and its descendants: - -* *node*.x - the *x*-coordinate of the node -* *node*.y - the *y*-coordinate of the node - -The coordinates *x* and *y* represent an arbitrary coordinate system; for example, you can treat *x* as an angle and *y* as a radius to produce a [radial layout](https://observablehq.com/@d3/radial-tidy-tree). You may want to call [*root*.sort](#node_sort) before passing the hierarchy to the tree layout. - -# tree.size([size]) - -If *size* is specified, sets this tree layout’s size to the specified two-element array of numbers [*width*, *height*] and returns this tree layout. If *size* is not specified, returns the current layout size, which defaults to [1, 1]. A layout size of null indicates that a [node size](#tree_nodeSize) will be used instead. The coordinates *x* and *y* represent an arbitrary coordinate system; for example, to produce a [radial layout](https://observablehq.com/@d3/radial-tidy-tree), a size of [360, *radius*] corresponds to a breadth of 360° and a depth of *radius*. - -# tree.nodeSize([size]) - -If *size* is specified, sets this tree layout’s node size to the specified two-element array of numbers [*width*, *height*] and returns this tree layout. If *size* is not specified, returns the current node size, which defaults to null. A node size of null indicates that a [layout size](#tree_size) will be used instead. When a node size is specified, the root node is always positioned at ⟨0, 0⟩. - -# tree.separation([separation]) - -If *separation* is specified, sets the separation accessor to the specified function and returns this tree layout. If *separation* is not specified, returns the current separation accessor, which defaults to: - -```js -function separation(a, b) { - return a.parent == b.parent ? 1 : 2; -} -``` - -A variation that is more appropriate for radial layouts reduces the separation gap proportionally to the radius: - -```js -function separation(a, b) { - return (a.parent == b.parent ? 1 : 2) / a.depth; -} -``` - -The separation accessor is used to separate neighboring nodes. The separation function is passed two nodes *a* and *b*, and must return the desired separation. The nodes are typically siblings, though the nodes may be more distantly related if the layout decides to place such nodes adjacent. - -### Treemap - -[Treemap](https://observablehq.com/@d3/treemap) - -Introduced by [Ben Shneiderman](http://www.cs.umd.edu/hcil/treemap-history/) in 1991, a **treemap** recursively subdivides area into rectangles according to each node’s associated value. D3’s treemap implementation supports an extensible [tiling method](#treemap_tile): the default [squarified](#treemapSquarify) method seeks to generate rectangles with a [golden](https://en.wikipedia.org/wiki/Golden_ratio) aspect ratio; this offers better readability and size estimation than [slice-and-dice](#treemapSliceDice), which simply alternates between horizontal and vertical subdivision by depth. - -# d3.treemap() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/treemap/index.js), [Examples](https://observablehq.com/@d3/treemap) - -Creates a new treemap layout with default settings. - -# treemap(root) - -Lays out the specified *root* [hierarchy](#hierarchy), assigning the following properties on *root* and its descendants: - -* *node*.x0 - the left edge of the rectangle -* *node*.y0 - the top edge of the rectangle -* *node*.x1 - the right edge of the rectangle -* *node*.y1 - the bottom edge of the rectangle - -You must call [*root*.sum](#node_sum) before passing the hierarchy to the treemap layout. You probably also want to call [*root*.sort](#node_sort) to order the hierarchy before computing the layout. - -# treemap.tile([tile]) - -If *tile* is specified, sets the [tiling method](#treemap-tiling) to the specified function and returns this treemap layout. If *tile* is not specified, returns the current tiling method, which defaults to [d3.treemapSquarify](#treemapSquarify) with the golden ratio. - -# treemap.size([size]) - -If *size* is specified, sets this treemap layout’s size to the specified two-element array of numbers [*width*, *height*] and returns this treemap layout. If *size* is not specified, returns the current size, which defaults to [1, 1]. - -# treemap.round([round]) - -If *round* is specified, enables or disables rounding according to the given boolean and returns this treemap layout. If *round* is not specified, returns the current rounding state, which defaults to false. - -# treemap.padding([padding]) - -If *padding* is specified, sets the [inner](#treemap_paddingInner) and [outer](#treemap_paddingOuter) padding to the specified number or function and returns this treemap layout. If *padding* is not specified, returns the current inner padding function. - -# treemap.paddingInner([padding]) - -If *padding* is specified, sets the inner padding to the specified number or function and returns this treemap layout. If *padding* is not specified, returns the current inner padding function, which defaults to the constant zero. If *padding* is a function, it is invoked for each node with children, being passed the current node. The inner padding is used to separate a node’s adjacent children. - -# treemap.paddingOuter([padding]) - -If *padding* is specified, sets the [top](#treemap_paddingTop), [right](#treemap_paddingRight), [bottom](#treemap_paddingBottom) and [left](#treemap_paddingLeft) padding to the specified number or function and returns this treemap layout. If *padding* is not specified, returns the current top padding function. - -# treemap.paddingTop([padding]) - -If *padding* is specified, sets the top padding to the specified number or function and returns this treemap layout. If *padding* is not specified, returns the current top padding function, which defaults to the constant zero. If *padding* is a function, it is invoked for each node with children, being passed the current node. The top padding is used to separate the top edge of a node from its children. - -# treemap.paddingRight([padding]) - -If *padding* is specified, sets the right padding to the specified number or function and returns this treemap layout. If *padding* is not specified, returns the current right padding function, which defaults to the constant zero. If *padding* is a function, it is invoked for each node with children, being passed the current node. The right padding is used to separate the right edge of a node from its children. - -# treemap.paddingBottom([padding]) - -If *padding* is specified, sets the bottom padding to the specified number or function and returns this treemap layout. If *padding* is not specified, returns the current bottom padding function, which defaults to the constant zero. If *padding* is a function, it is invoked for each node with children, being passed the current node. The bottom padding is used to separate the bottom edge of a node from its children. - -# treemap.paddingLeft([padding]) - -If *padding* is specified, sets the left padding to the specified number or function and returns this treemap layout. If *padding* is not specified, returns the current left padding function, which defaults to the constant zero. If *padding* is a function, it is invoked for each node with children, being passed the current node. The left padding is used to separate the left edge of a node from its children. - -#### Treemap Tiling - -Several built-in tiling methods are provided for use with [*treemap*.tile](#treemap_tile). - -# d3.treemapBinary(node, x0, y0, x1, y1) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/treemap/binary.js), [Examples](https://observablehq.com/@d3/treemap) - -Recursively partitions the specified *nodes* into an approximately-balanced binary tree, choosing horizontal partitioning for wide rectangles and vertical partitioning for tall rectangles. - -# d3.treemapDice(node, x0, y0, x1, y1) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/treemap/dice.js), [Examples](https://observablehq.com/@d3/treemap) - -Divides the rectangular area specified by *x0*, *y0*, *x1*, *y1* horizontally according the value of each of the specified *node*’s children. The children are positioned in order, starting with the left edge (*x0*) of the given rectangle. If the sum of the children’s values is less than the specified *node*’s value (*i.e.*, if the specified *node* has a non-zero internal value), the remaining empty space will be positioned on the right edge (*x1*) of the given rectangle. - -# d3.treemapSlice(node, x0, y0, x1, y1) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/treemap/slice.js), [Examples](https://observablehq.com/@d3/treemap) - -Divides the rectangular area specified by *x0*, *y0*, *x1*, *y1* vertically according the value of each of the specified *node*’s children. The children are positioned in order, starting with the top edge (*y0*) of the given rectangle. If the sum of the children’s values is less than the specified *node*’s value (*i.e.*, if the specified *node* has a non-zero internal value), the remaining empty space will be positioned on the bottom edge (*y1*) of the given rectangle. - -# d3.treemapSliceDice(node, x0, y0, x1, y1) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/treemap/sliceDice.js), [Examples](https://observablehq.com/@d3/treemap) - -If the specified *node* has odd depth, delegates to [treemapSlice](#treemapSlice); otherwise delegates to [treemapDice](#treemapDice). - -# d3.treemapSquarify(node, x0, y0, x1, y1) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/treemap/squarify.js), [Examples](https://observablehq.com/@d3/treemap) - -Implements the [squarified treemap](https://www.win.tue.nl/~vanwijk/stm.pdf) algorithm by Bruls *et al.*, which seeks to produce rectangles of a given [aspect ratio](#squarify_ratio). - -# d3.treemapResquarify(node, x0, y0, x1, y1) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/treemap/resquarify.js), [Examples](https://observablehq.com/@d3/animated-treemap) - -Like [d3.treemapSquarify](#treemapSquarify), except preserves the topology (node adjacencies) of the previous layout computed by d3.treemapResquarify, if there is one and it used the same [target aspect ratio](#squarify_ratio). This tiling method is good for animating changes to treemaps because it only changes node sizes and not their relative positions, thus avoiding distracting shuffling and occlusion. The downside of a stable update, however, is a suboptimal layout for subsequent updates: only the first layout uses the Bruls *et al.* squarified algorithm. - -# squarify.ratio(ratio) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/treemap/squarify.js), [Examples](https://observablehq.com/@d3/treemap) - -Specifies the desired aspect ratio of the generated rectangles. The *ratio* must be specified as a number greater than or equal to one. Note that the orientation of the generated rectangles (tall or wide) is not implied by the ratio; for example, a ratio of two will attempt to produce a mixture of rectangles whose *width*:*height* ratio is either 2:1 or 1:2. (However, you can approximately achieve this result by generating a square treemap at different dimensions, and then [stretching the treemap](https://observablehq.com/@d3/stretched-treemap) to the desired aspect ratio.) Furthermore, the specified *ratio* is merely a hint to the tiling algorithm; the rectangles are not guaranteed to have the specified aspect ratio. If not specified, the aspect ratio defaults to the golden ratio, φ = (1 + sqrt(5)) / 2, per [Kong *et al.*](http://vis.stanford.edu/papers/perception-treemaps) - -### Partition - -[Partition](https://observablehq.com/@d3/icicle) - -The **partition layout** produces adjacency diagrams: a space-filling variant of a node-link tree diagram. Rather than drawing a link between parent and child in the hierarchy, nodes are drawn as solid areas (either arcs or rectangles), and their placement relative to other nodes reveals their position in the hierarchy. The size of the nodes encodes a quantitative dimension that would be difficult to show in a node-link diagram. - -# d3.partition() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/partition.js), [Examples](https://observablehq.com/@d3/icicle) - -Creates a new partition layout with the default settings. - -# partition(root) - -Lays out the specified *root* [hierarchy](#hierarchy), assigning the following properties on *root* and its descendants: - -* *node*.x0 - the left edge of the rectangle -* *node*.y0 - the top edge of the rectangle -* *node*.x1 - the right edge of the rectangle -* *node*.y1 - the bottom edge of the rectangle - -You must call [*root*.sum](#node_sum) before passing the hierarchy to the partition layout. You probably also want to call [*root*.sort](#node_sort) to order the hierarchy before computing the layout. - -# partition.size([size]) - -If *size* is specified, sets this partition layout’s size to the specified two-element array of numbers [*width*, *height*] and returns this partition layout. If *size* is not specified, returns the current size, which defaults to [1, 1]. - -# partition.round([round]) - -If *round* is specified, enables or disables rounding according to the given boolean and returns this partition layout. If *round* is not specified, returns the current rounding state, which defaults to false. - -# partition.padding([padding]) - -If *padding* is specified, sets the padding to the specified number and returns this partition layout. If *padding* is not specified, returns the current padding, which defaults to zero. The padding is used to separate a node’s adjacent children. - -### Pack - -[Circle-Packing](https://observablehq.com/@d3/circle-packing) - -Enclosure diagrams use containment (nesting) to represent a hierarchy. The size of the leaf circles encodes a quantitative dimension of the data. The enclosing circles show the approximate cumulative size of each subtree, but due to wasted space there is some distortion; only the leaf nodes can be compared accurately. Although [circle packing](http://en.wikipedia.org/wiki/Circle_packing) does not use space as efficiently as a [treemap](#treemap), the “wasted” space more prominently reveals the hierarchical structure. - -# d3.pack() · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/pack/index.js), [Examples](https://observablehq.com/@d3/circle-packing) - -Creates a new pack layout with the default settings. - -# pack(root) - -Lays out the specified *root* [hierarchy](#hierarchy), assigning the following properties on *root* and its descendants: - -* *node*.x - the *x*-coordinate of the circle’s center -* *node*.y - the *y*-coordinate of the circle’s center -* *node*.r - the radius of the circle - -You must call [*root*.sum](#node_sum) before passing the hierarchy to the pack layout. You probably also want to call [*root*.sort](#node_sort) to order the hierarchy before computing the layout. - -# pack.radius([radius]) - -If *radius* is specified, sets the pack layout’s radius accessor to the specified function and returns this pack layout. If *radius* is not specified, returns the current radius accessor, which defaults to null. If the radius accessor is null, the radius of each leaf circle is derived from the leaf *node*.value (computed by [*node*.sum](#node_sum)); the radii are then scaled proportionally to fit the [layout size](#pack_size). If the radius accessor is not null, the radius of each leaf circle is specified exactly by the function. - -# pack.size([size]) - -If *size* is specified, sets this pack layout’s size to the specified two-element array of numbers [*width*, *height*] and returns this pack layout. If *size* is not specified, returns the current size, which defaults to [1, 1]. - -# pack.padding([padding]) - -If *padding* is specified, sets this pack layout’s padding accessor to the specified number or function and returns this pack layout. If *padding* is not specified, returns the current padding accessor, which defaults to the constant zero. When siblings are packed, tangent siblings will be separated by approximately the specified padding; the enclosing parent circle will also be separated from its children by approximately the specified padding. If an [explicit radius](#pack_radius) is not specified, the padding is approximate because a two-pass algorithm is needed to fit within the [layout size](#pack_size): the circles are first packed without padding; a scaling factor is computed and applied to the specified padding; and lastly the circles are re-packed with padding. - -# d3.packSiblings(circles) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/pack/siblings.js) - -Packs the specified array of *circles*, each of which must have a *circle*.r property specifying the circle’s radius. Assigns the following properties to each circle: - -* *circle*.x - the *x*-coordinate of the circle’s center -* *circle*.y - the *y*-coordinate of the circle’s center - -The circles are positioned according to the front-chain packing algorithm by [Wang *et al.*](https://dl.acm.org/citation.cfm?id=1124851) - -# d3.packEnclose(circles) · [Source](https://github.com/d3/d3-hierarchy/blob/master/src/pack/enclose.js), [Examples](https://observablehq.com/@d3/d3-packenclose) - -Computes the [smallest circle](https://en.wikipedia.org/wiki/Smallest-circle_problem) that encloses the specified array of *circles*, each of which must have a *circle*.r property specifying the circle’s radius, and *circle*.x and *circle*.y properties specifying the circle’s center. The enclosing circle is computed using the [Matoušek-Sharir-Welzl algorithm](http://www.inf.ethz.ch/personal/emo/PublFiles/SubexLinProg_ALG16_96.pdf). (See also [Apollonius’ Problem](https://bl.ocks.org/mbostock/751fdd637f4bc2e3f08b).) diff --git a/node_modules/d3-hierarchy/dist/d3-hierarchy.js b/node_modules/d3-hierarchy/dist/d3-hierarchy.js deleted file mode 100644 index 85e185f..0000000 --- a/node_modules/d3-hierarchy/dist/d3-hierarchy.js +++ /dev/null @@ -1,1290 +0,0 @@ -// https://d3js.org/d3-hierarchy/ v1.1.9 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -function defaultSeparation(a, b) { - return a.parent === 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 = node.children) node = children[0]; - return node; -} - -function leafRight(node) { - var children; - while (children = node.children) node = children[children.length - 1]; - return node; -} - -function cluster() { - var separation = defaultSeparation, - dx = 1, - dy = 1, - nodeSize = false; - - function cluster(root) { - var previousNode, - x = 0; - - // First walk, computing the initial x & y values. - root.eachAfter(function(node) { - var children = node.children; - if (children) { - node.x = meanX(children); - node.y = maxY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - - var left = leafLeft(root), - right = leafRight(root), - x0 = left.x - separation(left, right) / 2, - x1 = right.x + separation(right, left) / 2; - - // Second walk, normalizing x & y to the desired size. - return root.eachAfter(nodeSize ? function(node) { - node.x = (node.x - root.x) * dx; - node.y = (root.y - node.y) * dy; - } : function(node) { - node.x = (node.x - x0) / (x1 - x0) * dx; - node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; - }); - } - - cluster.separation = function(x) { - return arguments.length ? (separation = x, cluster) : separation; - }; - - cluster.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]); - }; - - cluster.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null); - }; - - return cluster; -} - -function count(node) { - var sum = 0, - children = node.children, - i = children && children.length; - if (!i) sum = 1; - else while (--i >= 0) sum += children[i].value; - node.value = sum; -} - -function node_count() { - return this.eachAfter(count); -} - -function node_each(callback) { - var node = this, current, next = [node], children, i, n; - do { - current = next.reverse(), next = []; - while (node = current.pop()) { - callback(node), children = node.children; - if (children) for (i = 0, n = children.length; i < n; ++i) { - next.push(children[i]); - } - } - } while (next.length); - return this; -} - -function node_eachBefore(callback) { - var node = this, nodes = [node], children, i; - while (node = nodes.pop()) { - callback(node), children = node.children; - if (children) for (i = children.length - 1; i >= 0; --i) { - nodes.push(children[i]); - } - } - return this; -} - -function node_eachAfter(callback) { - var node = this, nodes = [node], next = [], children, i, n; - while (node = nodes.pop()) { - next.push(node), children = node.children; - if (children) for (i = 0, n = children.length; i < n; ++i) { - nodes.push(children[i]); - } - } - while (node = next.pop()) { - callback(node); - } - return this; -} - -function node_sum(value) { - return this.eachAfter(function(node) { - var sum = +value(node.data) || 0, - children = node.children, - i = children && children.length; - while (--i >= 0) sum += children[i].value; - node.value = sum; - }); -} - -function node_sort(compare) { - return this.eachBefore(function(node) { - if (node.children) { - node.children.sort(compare); - } - }); -} - -function node_path(end) { - var start = this, - ancestor = leastCommonAncestor(start, end), - nodes = [start]; - while (start !== ancestor) { - start = start.parent; - nodes.push(start); - } - var k = nodes.length; - while (end !== ancestor) { - nodes.splice(k, 0, end); - end = end.parent; - } - return nodes; -} - -function leastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = a.ancestors(), - bNodes = b.ancestors(), - c = null; - a = aNodes.pop(); - b = bNodes.pop(); - while (a === b) { - c = a; - a = aNodes.pop(); - b = bNodes.pop(); - } - return c; -} - -function node_ancestors() { - var node = this, nodes = [node]; - while (node = node.parent) { - nodes.push(node); - } - return nodes; -} - -function node_descendants() { - var nodes = []; - this.each(function(node) { - nodes.push(node); - }); - return nodes; -} - -function node_leaves() { - var leaves = []; - this.eachBefore(function(node) { - if (!node.children) { - leaves.push(node); - } - }); - return leaves; -} - -function node_links() { - var root = this, links = []; - root.each(function(node) { - if (node !== root) { // Don’t include the root’s parent, if any. - links.push({source: node.parent, target: node}); - } - }); - return links; -} - -function hierarchy(data, children) { - var root = new Node(data), - valued = +data.value && (root.value = data.value), - node, - nodes = [root], - child, - childs, - i, - n; - - if (children == null) children = defaultChildren; - - while (node = nodes.pop()) { - if (valued) node.value = +node.data.value; - if ((childs = children(node.data)) && (n = childs.length)) { - node.children = new Array(n); - for (i = n - 1; i >= 0; --i) { - nodes.push(child = node.children[i] = new Node(childs[i])); - child.parent = node; - child.depth = 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 = node.data.data; -} - -function computeHeight(node) { - var height = 0; - do node.height = height; - while ((node = node.parent) && (node.height < ++height)); -} - -function Node(data) { - this.data = data; - this.depth = - this.height = 0; - this.parent = null; -} - -Node.prototype = hierarchy.prototype = { - 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 = Array.prototype.slice; - -function shuffle(array) { - var m = array.length, - t, - i; - - while (m) { - i = Math.random() * m-- | 0; - t = array[m]; - array[m] = array[i]; - array[i] = t; - } - - return array; -} - -function enclose(circles) { - var i = 0, n = (circles = shuffle(slice.call(circles))).length, B = [], p, e; - - while (i < n) { - p = circles[i]; - if (e && enclosesWeak(e, p)) ++i; - else e = encloseBasis(B = extendBasis(B, p)), i = 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 = 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 = 0; i < B.length - 1; ++i) { - for (j = 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 = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y; - return dr < 0 || dr * dr < dx * dx + dy * dy; -} - -function enclosesWeak(a, b) { - var dr = a.r - b.r + 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} - -function enclosesWeakAll(a, B) { - for (var i = 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 = a.x, y1 = a.y, r1 = a.r, - x2 = b.x, y2 = b.y, r2 = b.r, - x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, - l = 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 = a.x, y1 = a.y, r1 = a.r, - x2 = b.x, y2 = b.y, r2 = b.r, - x3 = c.x, y3 = c.y, r3 = c.r, - a2 = x1 - x2, - a3 = x1 - x3, - b2 = y1 - y2, - b3 = y1 - y3, - c2 = r2 - r1, - c3 = r3 - r1, - d1 = x1 * x1 + y1 * y1 - r1 * r1, - d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, - d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, - ab = a3 * b2 - a2 * b3, - xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, - xb = (b3 * c2 - b2 * c3) / ab, - ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, - yb = (a2 * c3 - a3 * c2) / ab, - A = xb * xb + yb * yb - 1, - B = 2 * (r1 + xa * xb + ya * yb), - C = xa * xa + ya * ya - r1 * r1, - r = -(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 = b.x - a.x, x, a2, - dy = b.y - a.y, y, b2, - d2 = dx * dx + dy * dy; - if (d2) { - a2 = a.r + c.r, a2 *= a2; - b2 = b.r + c.r, b2 *= b2; - if (a2 > b2) { - x = (d2 + b2 - a2) / (2 * d2); - y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); - c.x = b.x - x * dx - y * dy; - c.y = b.y - x * dy + y * dx; - } else { - x = (d2 + a2 - b2) / (2 * d2); - y = Math.sqrt(Math.max(0, a2 / d2 - x * x)); - c.x = a.x + x * dx - y * dy; - c.y = a.y + x * dy + y * dx; - } - } else { - c.x = a.x + c.r; - c.y = a.y; - } -} - -function intersects(a, b) { - var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} - -function score(node) { - var a = node._, - b = node.next._, - ab = a.r + b.r, - dx = (a.x * b.r + b.x * a.r) / ab, - dy = (a.y * b.r + b.y * a.r) / ab; - return dx * dx + dy * dy; -} - -function Node$1(circle) { - this._ = circle; - this.next = null; - this.previous = null; -} - -function packEnclose(circles) { - if (!(n = circles.length)) return 0; - - var a, b, c, n, aa, ca, i, j, k, sj, sk; - - // Place the first circle. - a = circles[0], a.x = 0, a.y = 0; - if (!(n > 1)) return a.r; - - // Place the second circle. - b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; - if (!(n > 2)) return a.r + b.r; - - // Place the third circle. - place(b, a, c = circles[2]); - - // Initialize the front-chain using the first three circles a, b and c. - a = new Node$1(a), b = new Node$1(b), c = new Node$1(c); - a.next = c.previous = b; - b.next = a.previous = c; - c.next = b.previous = a; - - // Attempt to place each remaining circle… - pack: for (i = 3; i < n; ++i) { - place(a._, b._, c = circles[i]), c = new Node$1(c); - - // Find the closest intersecting circle on the front-chain, if any. - // “Closeness” is determined by linear distance along the front-chain. - // “Ahead” or “behind” is likewise determined by linear distance. - j = b.next, k = a.previous, sj = b._.r, sk = a._.r; - do { - if (sj <= sk) { - if (intersects(j._, c._)) { - b = j, a.next = b, b.previous = a, --i; - continue pack; - } - sj += j._.r, j = j.next; - } else { - if (intersects(k._, c._)) { - a = k, a.next = b, b.previous = a, --i; - continue pack; - } - sk += k._.r, k = k.previous; - } - } while (j !== k.next); - - // Success! Insert the new circle c between a and b. - c.previous = a, c.next = b, a.next = b.previous = b = c; - - // Compute the new closest circle pair to the centroid. - aa = score(a); - while ((c = c.next) !== b) { - if ((ca = score(c)) < aa) { - a = c, aa = ca; - } - } - b = a.next; - } - - // Compute the enclosing circle of the front chain. - a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a); - - // Translate the circles to put the enclosing circle around the origin. - for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y; - - return c.r; -} - -function siblings(circles) { - packEnclose(circles); - return circles; -} - -function optional(f) { - return f == null ? null : required(f); -} - -function required(f) { - if (typeof f !== "function") throw new Error; - return f; -} - -function constantZero() { - return 0; -} - -function constant(x) { - return function() { - return x; - }; -} - -function defaultRadius(d) { - return Math.sqrt(d.value); -} - -function index() { - var radius = null, - dx = 1, - dy = 1, - padding = constantZero; - - function pack(root) { - root.x = dx / 2, root.y = dy / 2; - if (radius) { - root.eachBefore(radiusLeaf(radius)) - .eachAfter(packChildren(padding, 0.5)) - .eachBefore(translateChild(1)); - } else { - root.eachBefore(radiusLeaf(defaultRadius)) - .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 = function(x) { - return arguments.length ? (radius = optional(x), pack) : radius; - }; - - pack.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy]; - }; - - pack.padding = function(x) { - return arguments.length ? (padding = typeof x === "function" ? x : constant(+x), pack) : padding; - }; - - return pack; -} - -function radiusLeaf(radius) { - return function(node) { - if (!node.children) { - node.r = Math.max(0, +radius(node) || 0); - } - }; -} - -function packChildren(padding, k) { - return function(node) { - if (children = node.children) { - var children, - i, - n = children.length, - r = padding(node) * k || 0, - e; - - if (r) for (i = 0; i < n; ++i) children[i].r += r; - e = packEnclose(children); - if (r) for (i = 0; i < n; ++i) children[i].r -= r; - node.r = e + r; - } - }; -} - -function translateChild(k) { - return function(node) { - var parent = node.parent; - node.r *= k; - if (parent) { - node.x = parent.x + k * node.x; - node.y = parent.y + k * node.y; - } - }; -} - -function roundNode(node) { - node.x0 = Math.round(node.x0); - node.y0 = Math.round(node.y0); - node.x1 = Math.round(node.x1); - node.y1 = Math.round(node.y1); -} - -function treemapDice(parent, x0, y0, x1, y1) { - var nodes = parent.children, - node, - i = -1, - n = nodes.length, - k = parent.value && (x1 - x0) / parent.value; - - while (++i < n) { - node = nodes[i], node.y0 = y0, node.y1 = y1; - node.x0 = x0, node.x1 = x0 += node.value * k; - } -} - -function partition() { - var dx = 1, - dy = 1, - padding = 0, - round = false; - - function partition(root) { - var n = root.height + 1; - root.x0 = - root.y0 = padding; - root.x1 = dx; - root.y1 = 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 = node.x0, - y0 = node.y0, - x1 = node.x1 - padding, - y1 = node.y1 - padding; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - }; - } - - partition.round = function(x) { - return arguments.length ? (round = !!x, partition) : round; - }; - - partition.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy]; - }; - - partition.padding = function(x) { - return arguments.length ? (padding = +x, partition) : padding; - }; - - return partition; -} - -var keyPrefix = "$", // Protect against keys like “__proto__”. - preroot = {depth: -1}, - ambiguous = {}; - -function defaultId(d) { - return d.id; -} - -function defaultParentId(d) { - return d.parentId; -} - -function stratify() { - var id = defaultId, - parentId = defaultParentId; - - function stratify(data) { - var d, - i, - n = data.length, - root, - parent, - node, - nodes = new Array(n), - nodeId, - nodeKey, - nodeByKey = {}; - - for (i = 0; i < n; ++i) { - d = data[i], node = nodes[i] = new Node(d); - if ((nodeId = id(d, i, data)) != null && (nodeId += "")) { - nodeKey = keyPrefix + (node.id = nodeId); - nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node; - } - } - - for (i = 0; i < n; ++i) { - node = nodes[i], nodeId = parentId(data[i], i, data); - if (nodeId == null || !(nodeId += "")) { - if (root) throw new Error("multiple roots"); - root = node; - } else { - parent = nodeByKey[keyPrefix + nodeId]; - if (!parent) throw new Error("missing: " + nodeId); - if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); - if (parent.children) parent.children.push(node); - else parent.children = [node]; - node.parent = parent; - } - } - - if (!root) throw new Error("no root"); - root.parent = preroot; - root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight); - root.parent = null; - if (n > 0) throw new Error("cycle"); - - return root; - } - - stratify.id = function(x) { - return arguments.length ? (id = required(x), stratify) : id; - }; - - stratify.parentId = function(x) { - return arguments.length ? (parentId = required(x), stratify) : parentId; - }; - - return stratify; -} - -function defaultSeparation$1(a, b) { - return a.parent === b.parent ? 1 : 2; -} - -// function radialSeparation(a, b) { -// return (a.parent === 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 successor is -// either given by the leftmost child of v or by the thread of v. The function -// returns null if and only if v is on the highest level of its subtree. -function nextLeft(v) { - var children = v.children; - return children ? children[0] : v.t; -} - -// This function works analogously to nextLeft. -function nextRight(v) { - var children = 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 = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.m += 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 = 0, - change = 0, - children = v.children, - i = children.length, - w; - while (--i >= 0) { - w = children[i]; - w.z += shift; - w.m += shift; - shift += w.s + (change += w.c); - } -} - -// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, -// returns the specified (default) ancestor. -function nextAncestor(vim, v, ancestor) { - return vim.a.parent === v.parent ? vim.a : ancestor; -} - -function TreeNode(node, i) { - this._ = node; - this.parent = null; - this.children = null; - this.A = null; // default ancestor - this.a = this; // ancestor - this.z = 0; // prelim - this.m = 0; // mod - this.c = 0; // change - this.s = 0; // shift - this.t = null; // thread - this.i = i; // number -} - -TreeNode.prototype = Object.create(Node.prototype); - -function treeRoot(root) { - var tree = new TreeNode(root, 0), - node, - nodes = [tree], - child, - children, - i, - n; - - while (node = nodes.pop()) { - if (children = node._.children) { - node.children = new Array(n = children.length); - for (i = n - 1; i >= 0; --i) { - nodes.push(child = node.children[i] = new TreeNode(children[i], i)); - child.parent = node; - } - } - } - - (tree.parent = new TreeNode(null, 0)).children = [tree]; - return tree; -} - -// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm -function tree() { - var separation = defaultSeparation$1, - dx = 1, - dy = 1, - nodeSize = null; - - function tree(root) { - var t = treeRoot(root); - - // Compute the layout using Buchheim et al.’s algorithm. - t.eachAfter(firstWalk), t.parent.m = -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 = root, - right = root, - bottom = root; - root.eachBefore(function(node) { - if (node.x < left.x) left = node; - if (node.x > right.x) right = node; - if (node.depth > bottom.depth) bottom = node; - }); - var s = left === right ? 1 : separation(left, right) / 2, - tx = s - left.x, - kx = dx / (right.x + s + tx), - ky = dy / (bottom.depth || 1); - root.eachBefore(function(node) { - node.x = (node.x + tx) * kx; - node.y = 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, the - // node v is placed to the midpoint of its outermost children. - function firstWalk(v) { - var children = v.children, - siblings = v.parent.children, - w = v.i ? siblings[v.i - 1] : null; - if (children) { - executeShifts(v); - var midpoint = (children[0].z + children[children.length - 1].z) / 2; - if (w) { - v.z = w.z + separation(v._, w._); - v.m = v.z - midpoint; - } else { - v.z = midpoint; - } - } else if (w) { - v.z = w.z + separation(v._, w._); - } - v.parent.A = apportion(v, w, v.parent.A || siblings[0]); - } - - // Computes all real x-coordinates by summing up the modifiers recursively. - function secondWalk(v) { - v._.x = v.z + v.parent.m; - v.m += 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 subtrees. - // Finally, we add a new thread (if necessary). - function apportion(v, w, ancestor) { - if (w) { - var vip = v, - vop = v, - vim = w, - vom = vip.parent.children[0], - sip = vip.m, - sop = vop.m, - sim = vim.m, - som = vom.m, - shift; - while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { - vom = nextLeft(vom); - vop = nextRight(vop); - vop.a = v; - shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); - if (shift > 0) { - moveSubtree(nextAncestor(vim, v, ancestor), v, shift); - sip += shift; - sop += shift; - } - sim += vim.m; - sip += vip.m; - som += vom.m; - sop += vop.m; - } - if (vim && !nextRight(vop)) { - vop.t = vim; - vop.m += sim - sop; - } - if (vip && !nextLeft(vom)) { - vom.t = vip; - vom.m += sip - som; - ancestor = v; - } - } - return ancestor; - } - - function sizeNode(node) { - node.x *= dx; - node.y = node.depth * dy; - } - - tree.separation = function(x) { - return arguments.length ? (separation = x, tree) : separation; - }; - - tree.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]); - }; - - tree.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null); - }; - - return tree; -} - -function treemapSlice(parent, x0, y0, x1, y1) { - var nodes = parent.children, - node, - i = -1, - n = nodes.length, - k = parent.value && (y1 - y0) / parent.value; - - while (++i < n) { - node = nodes[i], node.x0 = x0, node.x1 = x1; - node.y0 = y0, node.y1 = y0 += node.value * k; - } -} - -var phi = (1 + Math.sqrt(5)) / 2; - -function squarifyRatio(ratio, parent, x0, y0, x1, y1) { - var rows = [], - nodes = parent.children, - row, - nodeValue, - i0 = 0, - i1 = 0, - n = nodes.length, - dx, dy, - value = parent.value, - sumValue, - minValue, - maxValue, - newRatio, - minRatio, - alpha, - beta; - - while (i0 < n) { - dx = x1 - x0, dy = y1 - y0; - - // Find the next non-empty node. - do sumValue = nodes[i1++].value; while (!sumValue && i1 < n); - minValue = maxValue = sumValue; - alpha = Math.max(dy / dx, dx / dy) / (value * ratio); - beta = sumValue * sumValue * alpha; - minRatio = Math.max(maxValue / beta, beta / minValue); - - // Keep adding nodes while the aspect ratio maintains or improves. - for (; i1 < n; ++i1) { - sumValue += nodeValue = nodes[i1].value; - if (nodeValue < minValue) minValue = nodeValue; - if (nodeValue > maxValue) maxValue = nodeValue; - beta = sumValue * sumValue * alpha; - newRatio = Math.max(maxValue / beta, beta / minValue); - if (newRatio > minRatio) { sumValue -= nodeValue; break; } - minRatio = newRatio; - } - - // Position and record the row orientation. - rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)}); - if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); - else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); - value -= sumValue, i0 = i1; - } - - return rows; -} - -var squarify = (function custom(ratio) { - - function squarify(parent, x0, y0, x1, y1) { - squarifyRatio(ratio, parent, x0, y0, x1, y1); - } - - squarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - - return squarify; -})(phi); - -function index$1() { - var tile = squarify, - round = false, - dx = 1, - dy = 1, - paddingStack = [0], - paddingInner = constantZero, - paddingTop = constantZero, - paddingRight = constantZero, - paddingBottom = constantZero, - paddingLeft = constantZero; - - function treemap(root) { - root.x0 = - root.y0 = 0; - root.x1 = dx; - root.y1 = dy; - root.eachBefore(positionNode); - paddingStack = [0]; - if (round) root.eachBefore(roundNode); - return root; - } - - function positionNode(node) { - var p = paddingStack[node.depth], - x0 = node.x0 + p, - y0 = node.y0 + p, - x1 = node.x1 - p, - y1 = node.y1 - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - if (node.children) { - p = paddingStack[node.depth + 1] = paddingInner(node) / 2; - x0 += paddingLeft(node) - p; - y0 += paddingTop(node) - p; - x1 -= paddingRight(node) - p; - y1 -= paddingBottom(node) - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - tile(node, x0, y0, x1, y1); - } - } - - treemap.round = function(x) { - return arguments.length ? (round = !!x, treemap) : round; - }; - - treemap.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy]; - }; - - treemap.tile = function(x) { - return arguments.length ? (tile = required(x), treemap) : tile; - }; - - treemap.padding = function(x) { - return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); - }; - - treemap.paddingInner = function(x) { - return arguments.length ? (paddingInner = typeof x === "function" ? x : constant(+x), treemap) : paddingInner; - }; - - treemap.paddingOuter = function(x) { - return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); - }; - - treemap.paddingTop = function(x) { - return arguments.length ? (paddingTop = typeof x === "function" ? x : constant(+x), treemap) : paddingTop; - }; - - treemap.paddingRight = function(x) { - return arguments.length ? (paddingRight = typeof x === "function" ? x : constant(+x), treemap) : paddingRight; - }; - - treemap.paddingBottom = function(x) { - return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant(+x), treemap) : paddingBottom; - }; - - treemap.paddingLeft = function(x) { - return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant(+x), treemap) : paddingLeft; - }; - - return treemap; -} - -function binary(parent, x0, y0, x1, y1) { - var nodes = parent.children, - i, n = nodes.length, - sum, sums = new Array(n + 1); - - for (sums[0] = sum = i = 0; i < n; ++i) { - sums[i + 1] = sum += nodes[i].value; - } - - partition(0, n, parent.value, x0, y0, x1, y1); - - function partition(i, j, value, x0, y0, x1, y1) { - if (i >= j - 1) { - var node = nodes[i]; - node.x0 = x0, node.y0 = y0; - node.x1 = x1, node.y1 = y1; - return; - } - - var valueOffset = sums[i], - valueTarget = (value / 2) + valueOffset, - k = i + 1, - hi = j - 1; - - while (k < hi) { - var mid = k + hi >>> 1; - if (sums[mid] < valueTarget) k = mid + 1; - else hi = mid; - } - - if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k; - - var valueLeft = sums[k] - valueOffset, - valueRight = value - valueLeft; - - if ((x1 - x0) > (y1 - y0)) { - var xk = (x0 * valueRight + x1 * valueLeft) / value; - partition(i, k, valueLeft, x0, y0, xk, y1); - partition(k, j, valueRight, xk, y0, x1, y1); - } else { - var yk = (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 = (function custom(ratio) { - - function resquarify(parent, x0, y0, x1, y1) { - if ((rows = parent._squarify) && (rows.ratio === ratio)) { - var rows, - row, - nodes, - i, - j = -1, - n, - m = rows.length, - value = parent.value; - - while (++j < m) { - row = rows[j], nodes = row.children; - for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; - if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value); - else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1); - value -= row.value; - } - } else { - parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1); - rows.ratio = ratio; - } - } - - resquarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - - return resquarify; -})(phi); - -exports.cluster = cluster; -exports.hierarchy = hierarchy; -exports.pack = index; -exports.packEnclose = enclose; -exports.packSiblings = siblings; -exports.partition = partition; -exports.stratify = stratify; -exports.tree = tree; -exports.treemap = index$1; -exports.treemapBinary = binary; -exports.treemapDice = treemapDice; -exports.treemapResquarify = resquarify; -exports.treemapSlice = treemapSlice; -exports.treemapSliceDice = sliceDice; -exports.treemapSquarify = squarify; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-hierarchy/dist/d3-hierarchy.min.js b/node_modules/d3-hierarchy/dist/d3-hierarchy.min.js deleted file mode 100644 index e6cec6e..0000000 --- a/node_modules/d3-hierarchy/dist/d3-hierarchy.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-hierarchy/ v1.1.9 Copyright 2019 Mike Bostock -!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((n=n||self).d3=n.d3||{})}(this,function(n){"use strict";function r(n,r){return n.parent===r.parent?1:2}function e(n,r){return n+r.x}function t(n,r){return Math.max(n,r.y)}function u(n){var r=0,e=n.children,t=e&&e.length;if(t)for(;--t>=0;)r+=e[t].value;else r=1;n.value=r}function i(n,r){var e,t,u,i,a,h=new c(n),l=+n.value&&(h.value=n.value),p=[h];for(null==r&&(r=o);e=p.pop();)if(l&&(e.value=+e.data.value),(u=r(e.data))&&(a=u.length))for(e.children=new Array(a),i=a-1;i>=0;--i)p.push(t=e.children[i]=new c(u[i])),t.parent=e,t.depth=e.depth+1;return h.eachBefore(f)}function o(n){return n.children}function a(n){n.data=n.data.data}function f(n){var r=0;do{n.height=r}while((n=n.parent)&&n.height<++r)}function c(n){this.data=n,this.depth=this.height=0,this.parent=null}c.prototype=i.prototype={constructor:c,count:function(){return this.eachAfter(u)},each:function(n){var r,e,t,u,i=this,o=[i];do{for(r=o.reverse(),o=[];i=r.pop();)if(n(i),e=i.children)for(t=0,u=e.length;t=0;--e)u.push(r[e]);return this},sum:function(n){return this.eachAfter(function(r){for(var e=+n(r.data)||0,t=r.children,u=t&&t.length;--u>=0;)e+=t[u].value;r.value=e})},sort:function(n){return this.eachBefore(function(r){r.children&&r.children.sort(n)})},path:function(n){for(var r=this,e=function(n,r){if(n===r)return n;var e=n.ancestors(),t=r.ancestors(),u=null;for(n=e.pop(),r=t.pop();n===r;)u=n,n=e.pop(),r=t.pop();return u}(r,n),t=[r];r!==e;)r=r.parent,t.push(r);for(var u=t.length;n!==e;)t.splice(u,0,n),n=n.parent;return t},ancestors:function(){for(var n=this,r=[n];n=n.parent;)r.push(n);return r},descendants:function(){var n=[];return this.each(function(r){n.push(r)}),n},leaves:function(){var n=[];return this.eachBefore(function(r){r.children||n.push(r)}),n},links:function(){var n=this,r=[];return n.each(function(e){e!==n&&r.push({source:e.parent,target:e})}),r},copy:function(){return i(this).eachBefore(a)}};var h=Array.prototype.slice;function l(n){for(var r,e,t=0,u=(n=function(n){for(var r,e,t=n.length;t;)e=Math.random()*t--|0,r=n[t],n[t]=n[e],n[e]=r;return n}(h.call(n))).length,i=[];t0&&e*e>t*t+u*u}function v(n,r){for(var e=0;e(o*=o)?(t=(c+o-u)/(2*c),i=Math.sqrt(Math.max(0,o/c-t*t)),e.x=n.x-t*a-i*f,e.y=n.y-t*f+i*a):(t=(c+u-o)/(2*c),i=Math.sqrt(Math.max(0,u/c-t*t)),e.x=r.x+t*a-i*f,e.y=r.y+t*f+i*a)):(e.x=r.x+e.r,e.y=r.y)}function w(n,r){var e=n.r+r.r-1e-6,t=r.x-n.x,u=r.y-n.y;return e>0&&e*e>t*t+u*u}function _(n){var r=n._,e=n.next._,t=r.r+e.r,u=(r.x*e.r+e.x*r.r)/t,i=(r.y*e.r+e.y*r.r)/t;return u*u+i*i}function z(n){this._=n,this.next=null,this.previous=null}function B(n){if(!(u=n.length))return 0;var r,e,t,u,i,o,a,f,c,h,p;if((r=n[0]).x=0,r.y=0,!(u>1))return r.r;if(e=n[1],r.x=-e.r,e.x=r.r,e.y=0,!(u>2))return r.r+e.r;m(e,r,t=n[2]),r=new z(r),e=new z(e),t=new z(t),r.next=t.previous=e,e.next=r.previous=t,t.next=e.previous=r;n:for(a=3;ap&&(p=a),x=h*h*v,(d=Math.max(p/x,x/l))>s){h-=a;break}s=d}y.push(o={value:h,dice:f1?r:1)},e}(N);var V=function n(r){function e(n,e,t,u,i){if((o=n._squarify)&&o.ratio===r)for(var o,a,f,c,h,l=-1,p=o.length,d=n.value;++l1?r:1)},e}(N);n.cluster=function(){var n=r,u=1,i=1,o=!1;function a(r){var a,f=0;r.eachAfter(function(r){var u=r.children;u?(r.x=function(n){return n.reduce(e,0)/n.length}(u),r.y=function(n){return 1+n.reduce(t,0)}(u)):(r.x=a?f+=n(r,a):0,r.y=0,a=r)});var c=function(n){for(var r;r=n.children;)n=r[0];return n}(r),h=function(n){for(var r;r=n.children;)n=r[r.length-1];return n}(r),l=c.x-n(c,h)/2,p=h.x+n(h,c)/2;return r.eachAfter(o?function(n){n.x=(n.x-r.x)*u,n.y=(r.y-n.y)*i}:function(n){n.x=(n.x-l)/(p-l)*u,n.y=(1-(r.y?n.y/r.y:1))*i})}return a.separation=function(r){return arguments.length?(n=r,a):n},a.size=function(n){return arguments.length?(o=!1,u=+n[0],i=+n[1],a):o?null:[u,i]},a.nodeSize=function(n){return arguments.length?(o=!0,u=+n[0],i=+n[1],a):o?[u,i]:null},a},n.hierarchy=i,n.pack=function(){var n=null,r=1,e=1,t=q;function u(u){return u.x=r/2,u.y=e/2,n?u.eachBefore(S(n)).eachAfter(k(t,.5)).eachBefore(I(1)):u.eachBefore(S(b)).eachAfter(k(q,1)).eachAfter(k(t,u.r/Math.min(r,e))).eachBefore(I(Math.min(r,e)/(2*u.r))),u}return u.radius=function(r){return arguments.length?(n=M(r),u):n},u.size=function(n){return arguments.length?(r=+n[0],e=+n[1],u):[r,e]},u.padding=function(n){return arguments.length?(t="function"==typeof n?n:E(+n),u):t},u},n.packEnclose=l,n.packSiblings=function(n){return B(n),n},n.partition=function(){var n=1,r=1,e=0,t=!1;function u(u){var i=u.height+1;return u.x0=u.y0=e,u.x1=n,u.y1=r/i,u.eachBefore(function(n,r){return function(t){t.children&&j(t,t.x0,n*(t.depth+1)/r,t.x1,n*(t.depth+2)/r);var u=t.x0,i=t.y0,o=t.x1-e,a=t.y1-e;o0)throw new Error("cycle");return i}return e.id=function(r){return arguments.length?(n=A(r),e):n},e.parentId=function(n){return arguments.length?(r=A(n),e):r},e},n.tree=function(){var n=$,r=1,e=1,t=null;function u(u){var f=function(n){for(var r,e,t,u,i,o=new J(n,0),a=[o];r=a.pop();)if(t=r._.children)for(r.children=new Array(i=t.length),u=i-1;u>=0;--u)a.push(e=r.children[u]=new J(t[u],u)),e.parent=r;return(o.parent=new J(null,0)).children=[o],o}(u);if(f.eachAfter(i),f.parent.m=-f.z,f.eachBefore(o),t)u.eachBefore(a);else{var c=u,h=u,l=u;u.eachBefore(function(n){n.xh.x&&(h=n),n.depth>l.depth&&(l=n)});var p=c===h?1:n(c,h)/2,d=p-c.x,s=r/(h.x+p+d),v=e/(l.depth||1);u.eachBefore(function(n){n.x=(n.x+d)*s,n.y=n.depth*v})}return u}function i(r){var e=r.children,t=r.parent.children,u=r.i?t[r.i-1]:null;if(e){!function(n){for(var r,e=0,t=0,u=n.children,i=u.length;--i>=0;)(r=u[i]).z+=e,r.m+=e,e+=r.s+(t+=r.c)}(r);var i=(e[0].z+e[e.length-1].z)/2;u?(r.z=u.z+n(r._,u._),r.m=r.z-i):r.z=i}else u&&(r.z=u.z+n(r._,u._));r.parent.A=function(r,e,t){if(e){for(var u,i=r,o=r,a=e,f=i.parent.children[0],c=i.m,h=o.m,l=a.m,p=f.m;a=F(a),i=C(i),a&&i;)f=C(f),(o=F(o)).a=r,(u=a.z+l-i.z-c+n(a._,i._))>0&&(G(H(a,r,t),r,u),c+=u,h+=u),l+=a.m,c+=i.m,p+=f.m,h+=o.m;a&&!F(o)&&(o.t=a,o.m+=l-h),i&&!C(f)&&(f.t=i,f.m+=c-p,t=r)}return t}(r,u,r.parent.A||t[0])}function o(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function a(n){n.x*=r,n.y=n.depth*e}return u.separation=function(r){return arguments.length?(n=r,u):n},u.size=function(n){return arguments.length?(t=!1,r=+n[0],e=+n[1],u):t?null:[r,e]},u.nodeSize=function(n){return arguments.length?(t=!0,r=+n[0],e=+n[1],u):t?[r,e]:null},u},n.treemap=function(){var n=U,r=!1,e=1,t=1,u=[0],i=q,o=q,a=q,f=q,c=q;function h(n){return n.x0=n.y0=0,n.x1=e,n.y1=t,n.eachBefore(l),u=[0],r&&n.eachBefore(O),n}function l(r){var e=u[r.depth],t=r.x0+e,h=r.y0+e,l=r.x1-e,p=r.y1-e;l=e-1){var h=a[r];return h.x0=u,h.y0=i,h.x1=o,void(h.y1=f)}for(var l=c[r],p=t/2+l,d=r+1,s=e-1;d>>1;c[v]f-i){var g=(u*y+o*x)/t;n(r,d,x,u,i,g,f),n(d,e,y,g,i,o,f)}else{var m=(i*y+f*x)/t;n(r,d,x,u,i,o,m),n(d,e,y,u,m,o,f)}}(0,f,n.value,r,e,t,u)},n.treemapDice=j,n.treemapResquarify=V,n.treemapSlice=K,n.treemapSliceDice=function(n,r,e,t,u){(1&n.depth?K:j)(n,r,e,t,u)},n.treemapSquarify=U,Object.defineProperty(n,"__esModule",{value:!0})}); diff --git a/node_modules/d3-hierarchy/package.json b/node_modules/d3-hierarchy/package.json deleted file mode 100644 index 57df755..0000000 --- a/node_modules/d3-hierarchy/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "_from": "d3-hierarchy@^1.1.9", - "_id": "d3-hierarchy@1.1.9", - "_inBundle": false, - "_integrity": "sha512-j8tPxlqh1srJHAtxfvOUwKNYJkQuBFdM1+JAUfq6xqH5eAqf93L7oG1NVqDa4CpFZNvnNKtCYEUC8KY9yEn9lQ==", - "_location": "/d3-hierarchy", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "d3-hierarchy@^1.1.9", - "name": "d3-hierarchy", - "escapedName": "d3-hierarchy", - "rawSpec": "^1.1.9", - "saveSpec": null, - "fetchSpec": "^1.1.9" - }, - "_requiredBy": [ - "/vega-hierarchy" - ], - "_resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-1.1.9.tgz", - "_shasum": "2f6bee24caaea43f8dc37545fa01628559647a83", - "_spec": "d3-hierarchy@^1.1.9", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-hierarchy", - "author": { - "name": "Mike Bostock", - "url": "http://bost.ocks.org/mike" - }, - "bugs": { - "url": "https://github.com/d3/d3-hierarchy/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Layout algorithms for visualizing hierarchical data.", - "devDependencies": { - "benchmark": "^2.1.4", - "d3-array": "1.2.0 - 2", - "d3-dsv": "1", - "d3-queue": "3", - "d3-random": "1.1.0 - 2", - "eslint": "6", - "rollup": "1", - "rollup-plugin-terser": "5", - "tape": "4" - }, - "files": [ - "dist/**/*.js", - "src/**/*.js" - ], - "homepage": "https://d3js.org/d3-hierarchy/", - "jsdelivr": "dist/d3-hierarchy.min.js", - "keywords": [ - "d3", - "d3-module", - "layout", - "tree", - "treemap", - "hierarchy", - "infovis" - ], - "license": "BSD-3-Clause", - "main": "dist/d3-hierarchy.js", - "module": "src/index.js", - "name": "d3-hierarchy", - "repository": { - "type": "git", - "url": "git+https://github.com/d3/d3-hierarchy.git" - }, - "scripts": { - "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js", - "prepublishOnly": "rm -rf dist && yarn test", - "pretest": "rollup -c", - "test": "tape 'test/**/*-test.js' && eslint src test" - }, - "sideEffects": false, - "unpkg": "dist/d3-hierarchy.min.js", - "version": "1.1.9" -} diff --git a/node_modules/d3-hierarchy/src/accessors.js b/node_modules/d3-hierarchy/src/accessors.js deleted file mode 100644 index 369c414..0000000 --- a/node_modules/d3-hierarchy/src/accessors.js +++ /dev/null @@ -1,8 +0,0 @@ -export function optional(f) { - return f == null ? null : required(f); -} - -export function required(f) { - if (typeof f !== "function") throw new Error; - return f; -} diff --git a/node_modules/d3-hierarchy/src/array.js b/node_modules/d3-hierarchy/src/array.js deleted file mode 100644 index c015cc9..0000000 --- a/node_modules/d3-hierarchy/src/array.js +++ /dev/null @@ -1,16 +0,0 @@ -export var slice = Array.prototype.slice; - -export function shuffle(array) { - var m = array.length, - t, - i; - - while (m) { - i = Math.random() * m-- | 0; - t = array[m]; - array[m] = array[i]; - array[i] = t; - } - - return array; -} diff --git a/node_modules/d3-hierarchy/src/cluster.js b/node_modules/d3-hierarchy/src/cluster.js deleted file mode 100644 index f5a280e..0000000 --- a/node_modules/d3-hierarchy/src/cluster.js +++ /dev/null @@ -1,84 +0,0 @@ -function defaultSeparation(a, b) { - return a.parent === 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 = node.children) node = children[0]; - return node; -} - -function leafRight(node) { - var children; - while (children = node.children) node = children[children.length - 1]; - return node; -} - -export default function() { - var separation = defaultSeparation, - dx = 1, - dy = 1, - nodeSize = false; - - function cluster(root) { - var previousNode, - x = 0; - - // First walk, computing the initial x & y values. - root.eachAfter(function(node) { - var children = node.children; - if (children) { - node.x = meanX(children); - node.y = maxY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - - var left = leafLeft(root), - right = leafRight(root), - x0 = left.x - separation(left, right) / 2, - x1 = right.x + separation(right, left) / 2; - - // Second walk, normalizing x & y to the desired size. - return root.eachAfter(nodeSize ? function(node) { - node.x = (node.x - root.x) * dx; - node.y = (root.y - node.y) * dy; - } : function(node) { - node.x = (node.x - x0) / (x1 - x0) * dx; - node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; - }); - } - - cluster.separation = function(x) { - return arguments.length ? (separation = x, cluster) : separation; - }; - - cluster.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]); - }; - - cluster.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null); - }; - - return cluster; -} diff --git a/node_modules/d3-hierarchy/src/constant.js b/node_modules/d3-hierarchy/src/constant.js deleted file mode 100644 index 1d947c4..0000000 --- a/node_modules/d3-hierarchy/src/constant.js +++ /dev/null @@ -1,9 +0,0 @@ -export function constantZero() { - return 0; -} - -export default function(x) { - return function() { - return x; - }; -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/ancestors.js b/node_modules/d3-hierarchy/src/hierarchy/ancestors.js deleted file mode 100644 index f70c726..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/ancestors.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function() { - var node = this, nodes = [node]; - while (node = node.parent) { - nodes.push(node); - } - return nodes; -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/count.js b/node_modules/d3-hierarchy/src/hierarchy/count.js deleted file mode 100644 index 0b90f1b..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/count.js +++ /dev/null @@ -1,12 +0,0 @@ -function count(node) { - var sum = 0, - children = node.children, - i = children && children.length; - if (!i) sum = 1; - else while (--i >= 0) sum += children[i].value; - node.value = sum; -} - -export default function() { - return this.eachAfter(count); -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/descendants.js b/node_modules/d3-hierarchy/src/hierarchy/descendants.js deleted file mode 100644 index 1e3b5e6..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/descendants.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function() { - var nodes = []; - this.each(function(node) { - nodes.push(node); - }); - return nodes; -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/each.js b/node_modules/d3-hierarchy/src/hierarchy/each.js deleted file mode 100644 index 767e2da..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/each.js +++ /dev/null @@ -1,13 +0,0 @@ -export default function(callback) { - var node = this, current, next = [node], children, i, n; - do { - current = next.reverse(), next = []; - while (node = current.pop()) { - callback(node), children = node.children; - if (children) for (i = 0, n = children.length; i < n; ++i) { - next.push(children[i]); - } - } - } while (next.length); - return this; -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js b/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js deleted file mode 100644 index 4ad4f15..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js +++ /dev/null @@ -1,13 +0,0 @@ -export default function(callback) { - var node = this, nodes = [node], next = [], children, i, n; - while (node = nodes.pop()) { - next.push(node), children = node.children; - if (children) for (i = 0, n = children.length; i < n; ++i) { - nodes.push(children[i]); - } - } - while (node = next.pop()) { - callback(node); - } - return this; -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js b/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js deleted file mode 100644 index 23c5ccd..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function(callback) { - var node = this, nodes = [node], children, i; - while (node = nodes.pop()) { - callback(node), children = node.children; - if (children) for (i = children.length - 1; i >= 0; --i) { - nodes.push(children[i]); - } - } - return this; -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/index.js b/node_modules/d3-hierarchy/src/hierarchy/index.js deleted file mode 100644 index e0ac026..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/index.js +++ /dev/null @@ -1,79 +0,0 @@ -import node_count from "./count.js"; -import node_each from "./each.js"; -import node_eachBefore from "./eachBefore.js"; -import node_eachAfter from "./eachAfter.js"; -import node_sum from "./sum.js"; -import node_sort from "./sort.js"; -import node_path from "./path.js"; -import node_ancestors from "./ancestors.js"; -import node_descendants from "./descendants.js"; -import node_leaves from "./leaves.js"; -import node_links from "./links.js"; - -export default function hierarchy(data, children) { - var root = new Node(data), - valued = +data.value && (root.value = data.value), - node, - nodes = [root], - child, - childs, - i, - n; - - if (children == null) children = defaultChildren; - - while (node = nodes.pop()) { - if (valued) node.value = +node.data.value; - if ((childs = children(node.data)) && (n = childs.length)) { - node.children = new Array(n); - for (i = n - 1; i >= 0; --i) { - nodes.push(child = node.children[i] = new Node(childs[i])); - child.parent = node; - child.depth = 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 = node.data.data; -} - -export function computeHeight(node) { - var height = 0; - do node.height = height; - while ((node = node.parent) && (node.height < ++height)); -} - -export function Node(data) { - this.data = data; - this.depth = - this.height = 0; - this.parent = null; -} - -Node.prototype = hierarchy.prototype = { - 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 -}; diff --git a/node_modules/d3-hierarchy/src/hierarchy/leaves.js b/node_modules/d3-hierarchy/src/hierarchy/leaves.js deleted file mode 100644 index 401c5b5..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/leaves.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function() { - var leaves = []; - this.eachBefore(function(node) { - if (!node.children) { - leaves.push(node); - } - }); - return leaves; -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/links.js b/node_modules/d3-hierarchy/src/hierarchy/links.js deleted file mode 100644 index 6fcb82f..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/links.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function() { - var root = this, links = []; - root.each(function(node) { - if (node !== root) { // Don’t include the root’s parent, if any. - links.push({source: node.parent, target: node}); - } - }); - return links; -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/path.js b/node_modules/d3-hierarchy/src/hierarchy/path.js deleted file mode 100644 index 9958913..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/path.js +++ /dev/null @@ -1,30 +0,0 @@ -export default function(end) { - var start = this, - ancestor = leastCommonAncestor(start, end), - nodes = [start]; - while (start !== ancestor) { - start = start.parent; - nodes.push(start); - } - var k = nodes.length; - while (end !== ancestor) { - nodes.splice(k, 0, end); - end = end.parent; - } - return nodes; -} - -function leastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = a.ancestors(), - bNodes = b.ancestors(), - c = null; - a = aNodes.pop(); - b = bNodes.pop(); - while (a === b) { - c = a; - a = aNodes.pop(); - b = bNodes.pop(); - } - return c; -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/sort.js b/node_modules/d3-hierarchy/src/hierarchy/sort.js deleted file mode 100644 index 5d0426d..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/sort.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function(compare) { - return this.eachBefore(function(node) { - if (node.children) { - node.children.sort(compare); - } - }); -} diff --git a/node_modules/d3-hierarchy/src/hierarchy/sum.js b/node_modules/d3-hierarchy/src/hierarchy/sum.js deleted file mode 100644 index 350a965..0000000 --- a/node_modules/d3-hierarchy/src/hierarchy/sum.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function(value) { - return this.eachAfter(function(node) { - var sum = +value(node.data) || 0, - children = node.children, - i = children && children.length; - while (--i >= 0) sum += children[i].value; - node.value = sum; - }); -} diff --git a/node_modules/d3-hierarchy/src/index.js b/node_modules/d3-hierarchy/src/index.js deleted file mode 100644 index cd4cca3..0000000 --- a/node_modules/d3-hierarchy/src/index.js +++ /dev/null @@ -1,15 +0,0 @@ -export {default as cluster} from "./cluster.js"; -export {default as hierarchy} from "./hierarchy/index.js"; -export {default as pack} from "./pack/index.js"; -export {default as packSiblings} from "./pack/siblings.js"; -export {default as packEnclose} from "./pack/enclose.js"; -export {default as partition} from "./partition.js"; -export {default as stratify} from "./stratify.js"; -export {default as tree} from "./tree.js"; -export {default as treemap} from "./treemap/index.js"; -export {default as treemapBinary} from "./treemap/binary.js"; -export {default as treemapDice} from "./treemap/dice.js"; -export {default as treemapSlice} from "./treemap/slice.js"; -export {default as treemapSliceDice} from "./treemap/sliceDice.js"; -export {default as treemapSquarify} from "./treemap/squarify.js"; -export {default as treemapResquarify} from "./treemap/resquarify.js"; diff --git a/node_modules/d3-hierarchy/src/pack/enclose.js b/node_modules/d3-hierarchy/src/pack/enclose.js deleted file mode 100644 index c8dbd2a..0000000 --- a/node_modules/d3-hierarchy/src/pack/enclose.js +++ /dev/null @@ -1,118 +0,0 @@ -import {shuffle, slice} from "../array.js"; - -export default function(circles) { - var i = 0, n = (circles = shuffle(slice.call(circles))).length, B = [], p, e; - - while (i < n) { - p = circles[i]; - if (e && enclosesWeak(e, p)) ++i; - else e = encloseBasis(B = extendBasis(B, p)), i = 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 = 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 = 0; i < B.length - 1; ++i) { - for (j = 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 = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y; - return dr < 0 || dr * dr < dx * dx + dy * dy; -} - -function enclosesWeak(a, b) { - var dr = a.r - b.r + 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} - -function enclosesWeakAll(a, B) { - for (var i = 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 = a.x, y1 = a.y, r1 = a.r, - x2 = b.x, y2 = b.y, r2 = b.r, - x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, - l = 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 = a.x, y1 = a.y, r1 = a.r, - x2 = b.x, y2 = b.y, r2 = b.r, - x3 = c.x, y3 = c.y, r3 = c.r, - a2 = x1 - x2, - a3 = x1 - x3, - b2 = y1 - y2, - b3 = y1 - y3, - c2 = r2 - r1, - c3 = r3 - r1, - d1 = x1 * x1 + y1 * y1 - r1 * r1, - d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, - d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, - ab = a3 * b2 - a2 * b3, - xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, - xb = (b3 * c2 - b2 * c3) / ab, - ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, - yb = (a2 * c3 - a3 * c2) / ab, - A = xb * xb + yb * yb - 1, - B = 2 * (r1 + xa * xb + ya * yb), - C = xa * xa + ya * ya - r1 * r1, - r = -(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 - }; -} diff --git a/node_modules/d3-hierarchy/src/pack/index.js b/node_modules/d3-hierarchy/src/pack/index.js deleted file mode 100644 index 6ef2d7c..0000000 --- a/node_modules/d3-hierarchy/src/pack/index.js +++ /dev/null @@ -1,79 +0,0 @@ -import {packEnclose} from "./siblings.js"; -import {optional} from "../accessors.js"; -import constant, {constantZero} from "../constant.js"; - -function defaultRadius(d) { - return Math.sqrt(d.value); -} - -export default function() { - var radius = null, - dx = 1, - dy = 1, - padding = constantZero; - - function pack(root) { - root.x = dx / 2, root.y = dy / 2; - if (radius) { - root.eachBefore(radiusLeaf(radius)) - .eachAfter(packChildren(padding, 0.5)) - .eachBefore(translateChild(1)); - } else { - root.eachBefore(radiusLeaf(defaultRadius)) - .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 = function(x) { - return arguments.length ? (radius = optional(x), pack) : radius; - }; - - pack.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy]; - }; - - pack.padding = function(x) { - return arguments.length ? (padding = typeof x === "function" ? x : constant(+x), pack) : padding; - }; - - return pack; -} - -function radiusLeaf(radius) { - return function(node) { - if (!node.children) { - node.r = Math.max(0, +radius(node) || 0); - } - }; -} - -function packChildren(padding, k) { - return function(node) { - if (children = node.children) { - var children, - i, - n = children.length, - r = padding(node) * k || 0, - e; - - if (r) for (i = 0; i < n; ++i) children[i].r += r; - e = packEnclose(children); - if (r) for (i = 0; i < n; ++i) children[i].r -= r; - node.r = e + r; - } - }; -} - -function translateChild(k) { - return function(node) { - var parent = node.parent; - node.r *= k; - if (parent) { - node.x = parent.x + k * node.x; - node.y = parent.y + k * node.y; - } - }; -} diff --git a/node_modules/d3-hierarchy/src/pack/siblings.js b/node_modules/d3-hierarchy/src/pack/siblings.js deleted file mode 100644 index 4488126..0000000 --- a/node_modules/d3-hierarchy/src/pack/siblings.js +++ /dev/null @@ -1,118 +0,0 @@ -import enclose from "./enclose.js"; - -function place(b, a, c) { - var dx = b.x - a.x, x, a2, - dy = b.y - a.y, y, b2, - d2 = dx * dx + dy * dy; - if (d2) { - a2 = a.r + c.r, a2 *= a2; - b2 = b.r + c.r, b2 *= b2; - if (a2 > b2) { - x = (d2 + b2 - a2) / (2 * d2); - y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); - c.x = b.x - x * dx - y * dy; - c.y = b.y - x * dy + y * dx; - } else { - x = (d2 + a2 - b2) / (2 * d2); - y = Math.sqrt(Math.max(0, a2 / d2 - x * x)); - c.x = a.x + x * dx - y * dy; - c.y = a.y + x * dy + y * dx; - } - } else { - c.x = a.x + c.r; - c.y = a.y; - } -} - -function intersects(a, b) { - var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} - -function score(node) { - var a = node._, - b = node.next._, - ab = a.r + b.r, - dx = (a.x * b.r + b.x * a.r) / ab, - dy = (a.y * b.r + b.y * a.r) / ab; - return dx * dx + dy * dy; -} - -function Node(circle) { - this._ = circle; - this.next = null; - this.previous = null; -} - -export function packEnclose(circles) { - if (!(n = circles.length)) return 0; - - var a, b, c, n, aa, ca, i, j, k, sj, sk; - - // Place the first circle. - a = circles[0], a.x = 0, a.y = 0; - if (!(n > 1)) return a.r; - - // Place the second circle. - b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; - if (!(n > 2)) return a.r + b.r; - - // Place the third circle. - place(b, a, c = circles[2]); - - // Initialize the front-chain using the first three circles a, b and c. - a = new Node(a), b = new Node(b), c = new Node(c); - a.next = c.previous = b; - b.next = a.previous = c; - c.next = b.previous = a; - - // Attempt to place each remaining circle… - pack: for (i = 3; i < n; ++i) { - place(a._, b._, c = circles[i]), c = new Node(c); - - // Find the closest intersecting circle on the front-chain, if any. - // “Closeness” is determined by linear distance along the front-chain. - // “Ahead” or “behind” is likewise determined by linear distance. - j = b.next, k = a.previous, sj = b._.r, sk = a._.r; - do { - if (sj <= sk) { - if (intersects(j._, c._)) { - b = j, a.next = b, b.previous = a, --i; - continue pack; - } - sj += j._.r, j = j.next; - } else { - if (intersects(k._, c._)) { - a = k, a.next = b, b.previous = a, --i; - continue pack; - } - sk += k._.r, k = k.previous; - } - } while (j !== k.next); - - // Success! Insert the new circle c between a and b. - c.previous = a, c.next = b, a.next = b.previous = b = c; - - // Compute the new closest circle pair to the centroid. - aa = score(a); - while ((c = c.next) !== b) { - if ((ca = score(c)) < aa) { - a = c, aa = ca; - } - } - b = a.next; - } - - // Compute the enclosing circle of the front chain. - a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a); - - // Translate the circles to put the enclosing circle around the origin. - for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y; - - return c.r; -} - -export default function(circles) { - packEnclose(circles); - return circles; -} diff --git a/node_modules/d3-hierarchy/src/partition.js b/node_modules/d3-hierarchy/src/partition.js deleted file mode 100644 index 0165ef7..0000000 --- a/node_modules/d3-hierarchy/src/partition.js +++ /dev/null @@ -1,52 +0,0 @@ -import roundNode from "./treemap/round.js"; -import treemapDice from "./treemap/dice.js"; - -export default function() { - var dx = 1, - dy = 1, - padding = 0, - round = false; - - function partition(root) { - var n = root.height + 1; - root.x0 = - root.y0 = padding; - root.x1 = dx; - root.y1 = 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 = node.x0, - y0 = node.y0, - x1 = node.x1 - padding, - y1 = node.y1 - padding; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - }; - } - - partition.round = function(x) { - return arguments.length ? (round = !!x, partition) : round; - }; - - partition.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy]; - }; - - partition.padding = function(x) { - return arguments.length ? (padding = +x, partition) : padding; - }; - - return partition; -} diff --git a/node_modules/d3-hierarchy/src/stratify.js b/node_modules/d3-hierarchy/src/stratify.js deleted file mode 100644 index 9bd691a..0000000 --- a/node_modules/d3-hierarchy/src/stratify.js +++ /dev/null @@ -1,73 +0,0 @@ -import {required} from "./accessors.js"; -import {Node, computeHeight} from "./hierarchy/index.js"; - -var keyPrefix = "$", // Protect against keys like “__proto__”. - preroot = {depth: -1}, - ambiguous = {}; - -function defaultId(d) { - return d.id; -} - -function defaultParentId(d) { - return d.parentId; -} - -export default function() { - var id = defaultId, - parentId = defaultParentId; - - function stratify(data) { - var d, - i, - n = data.length, - root, - parent, - node, - nodes = new Array(n), - nodeId, - nodeKey, - nodeByKey = {}; - - for (i = 0; i < n; ++i) { - d = data[i], node = nodes[i] = new Node(d); - if ((nodeId = id(d, i, data)) != null && (nodeId += "")) { - nodeKey = keyPrefix + (node.id = nodeId); - nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node; - } - } - - for (i = 0; i < n; ++i) { - node = nodes[i], nodeId = parentId(data[i], i, data); - if (nodeId == null || !(nodeId += "")) { - if (root) throw new Error("multiple roots"); - root = node; - } else { - parent = nodeByKey[keyPrefix + nodeId]; - if (!parent) throw new Error("missing: " + nodeId); - if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); - if (parent.children) parent.children.push(node); - else parent.children = [node]; - node.parent = parent; - } - } - - if (!root) throw new Error("no root"); - root.parent = preroot; - root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight); - root.parent = null; - if (n > 0) throw new Error("cycle"); - - return root; - } - - stratify.id = function(x) { - return arguments.length ? (id = required(x), stratify) : id; - }; - - stratify.parentId = function(x) { - return arguments.length ? (parentId = required(x), stratify) : parentId; - }; - - return stratify; -} diff --git a/node_modules/d3-hierarchy/src/tree.js b/node_modules/d3-hierarchy/src/tree.js deleted file mode 100644 index dc4275e..0000000 --- a/node_modules/d3-hierarchy/src/tree.js +++ /dev/null @@ -1,237 +0,0 @@ -import {Node} from "./hierarchy/index.js"; - -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} - -// function radialSeparation(a, b) { -// return (a.parent === 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 successor is -// either given by the leftmost child of v or by the thread of v. The function -// returns null if and only if v is on the highest level of its subtree. -function nextLeft(v) { - var children = v.children; - return children ? children[0] : v.t; -} - -// This function works analogously to nextLeft. -function nextRight(v) { - var children = 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 = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.m += 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 = 0, - change = 0, - children = v.children, - i = children.length, - w; - while (--i >= 0) { - w = children[i]; - w.z += shift; - w.m += shift; - shift += w.s + (change += w.c); - } -} - -// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, -// returns the specified (default) ancestor. -function nextAncestor(vim, v, ancestor) { - return vim.a.parent === v.parent ? vim.a : ancestor; -} - -function TreeNode(node, i) { - this._ = node; - this.parent = null; - this.children = null; - this.A = null; // default ancestor - this.a = this; // ancestor - this.z = 0; // prelim - this.m = 0; // mod - this.c = 0; // change - this.s = 0; // shift - this.t = null; // thread - this.i = i; // number -} - -TreeNode.prototype = Object.create(Node.prototype); - -function treeRoot(root) { - var tree = new TreeNode(root, 0), - node, - nodes = [tree], - child, - children, - i, - n; - - while (node = nodes.pop()) { - if (children = node._.children) { - node.children = new Array(n = children.length); - for (i = n - 1; i >= 0; --i) { - nodes.push(child = node.children[i] = new TreeNode(children[i], i)); - child.parent = node; - } - } - } - - (tree.parent = new TreeNode(null, 0)).children = [tree]; - return tree; -} - -// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm -export default function() { - var separation = defaultSeparation, - dx = 1, - dy = 1, - nodeSize = null; - - function tree(root) { - var t = treeRoot(root); - - // Compute the layout using Buchheim et al.’s algorithm. - t.eachAfter(firstWalk), t.parent.m = -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 = root, - right = root, - bottom = root; - root.eachBefore(function(node) { - if (node.x < left.x) left = node; - if (node.x > right.x) right = node; - if (node.depth > bottom.depth) bottom = node; - }); - var s = left === right ? 1 : separation(left, right) / 2, - tx = s - left.x, - kx = dx / (right.x + s + tx), - ky = dy / (bottom.depth || 1); - root.eachBefore(function(node) { - node.x = (node.x + tx) * kx; - node.y = 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, the - // node v is placed to the midpoint of its outermost children. - function firstWalk(v) { - var children = v.children, - siblings = v.parent.children, - w = v.i ? siblings[v.i - 1] : null; - if (children) { - executeShifts(v); - var midpoint = (children[0].z + children[children.length - 1].z) / 2; - if (w) { - v.z = w.z + separation(v._, w._); - v.m = v.z - midpoint; - } else { - v.z = midpoint; - } - } else if (w) { - v.z = w.z + separation(v._, w._); - } - v.parent.A = apportion(v, w, v.parent.A || siblings[0]); - } - - // Computes all real x-coordinates by summing up the modifiers recursively. - function secondWalk(v) { - v._.x = v.z + v.parent.m; - v.m += 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 subtrees. - // Finally, we add a new thread (if necessary). - function apportion(v, w, ancestor) { - if (w) { - var vip = v, - vop = v, - vim = w, - vom = vip.parent.children[0], - sip = vip.m, - sop = vop.m, - sim = vim.m, - som = vom.m, - shift; - while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { - vom = nextLeft(vom); - vop = nextRight(vop); - vop.a = v; - shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); - if (shift > 0) { - moveSubtree(nextAncestor(vim, v, ancestor), v, shift); - sip += shift; - sop += shift; - } - sim += vim.m; - sip += vip.m; - som += vom.m; - sop += vop.m; - } - if (vim && !nextRight(vop)) { - vop.t = vim; - vop.m += sim - sop; - } - if (vip && !nextLeft(vom)) { - vom.t = vip; - vom.m += sip - som; - ancestor = v; - } - } - return ancestor; - } - - function sizeNode(node) { - node.x *= dx; - node.y = node.depth * dy; - } - - tree.separation = function(x) { - return arguments.length ? (separation = x, tree) : separation; - }; - - tree.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]); - }; - - tree.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null); - }; - - return tree; -} diff --git a/node_modules/d3-hierarchy/src/treemap/binary.js b/node_modules/d3-hierarchy/src/treemap/binary.js deleted file mode 100644 index a24aaf0..0000000 --- a/node_modules/d3-hierarchy/src/treemap/binary.js +++ /dev/null @@ -1,46 +0,0 @@ -export default function(parent, x0, y0, x1, y1) { - var nodes = parent.children, - i, n = nodes.length, - sum, sums = new Array(n + 1); - - for (sums[0] = sum = i = 0; i < n; ++i) { - sums[i + 1] = sum += nodes[i].value; - } - - partition(0, n, parent.value, x0, y0, x1, y1); - - function partition(i, j, value, x0, y0, x1, y1) { - if (i >= j - 1) { - var node = nodes[i]; - node.x0 = x0, node.y0 = y0; - node.x1 = x1, node.y1 = y1; - return; - } - - var valueOffset = sums[i], - valueTarget = (value / 2) + valueOffset, - k = i + 1, - hi = j - 1; - - while (k < hi) { - var mid = k + hi >>> 1; - if (sums[mid] < valueTarget) k = mid + 1; - else hi = mid; - } - - if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k; - - var valueLeft = sums[k] - valueOffset, - valueRight = value - valueLeft; - - if ((x1 - x0) > (y1 - y0)) { - var xk = (x0 * valueRight + x1 * valueLeft) / value; - partition(i, k, valueLeft, x0, y0, xk, y1); - partition(k, j, valueRight, xk, y0, x1, y1); - } else { - var yk = (y0 * valueRight + y1 * valueLeft) / value; - partition(i, k, valueLeft, x0, y0, x1, yk); - partition(k, j, valueRight, x0, yk, x1, y1); - } - } -} diff --git a/node_modules/d3-hierarchy/src/treemap/dice.js b/node_modules/d3-hierarchy/src/treemap/dice.js deleted file mode 100644 index 605c1f6..0000000 --- a/node_modules/d3-hierarchy/src/treemap/dice.js +++ /dev/null @@ -1,12 +0,0 @@ -export default function(parent, x0, y0, x1, y1) { - var nodes = parent.children, - node, - i = -1, - n = nodes.length, - k = parent.value && (x1 - x0) / parent.value; - - while (++i < n) { - node = nodes[i], node.y0 = y0, node.y1 = y1; - node.x0 = x0, node.x1 = x0 += node.value * k; - } -} diff --git a/node_modules/d3-hierarchy/src/treemap/index.js b/node_modules/d3-hierarchy/src/treemap/index.js deleted file mode 100644 index ccc42c9..0000000 --- a/node_modules/d3-hierarchy/src/treemap/index.js +++ /dev/null @@ -1,94 +0,0 @@ -import roundNode from "./round.js"; -import squarify from "./squarify.js"; -import {required} from "../accessors.js"; -import constant, {constantZero} from "../constant.js"; - -export default function() { - var tile = squarify, - round = false, - dx = 1, - dy = 1, - paddingStack = [0], - paddingInner = constantZero, - paddingTop = constantZero, - paddingRight = constantZero, - paddingBottom = constantZero, - paddingLeft = constantZero; - - function treemap(root) { - root.x0 = - root.y0 = 0; - root.x1 = dx; - root.y1 = dy; - root.eachBefore(positionNode); - paddingStack = [0]; - if (round) root.eachBefore(roundNode); - return root; - } - - function positionNode(node) { - var p = paddingStack[node.depth], - x0 = node.x0 + p, - y0 = node.y0 + p, - x1 = node.x1 - p, - y1 = node.y1 - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - if (node.children) { - p = paddingStack[node.depth + 1] = paddingInner(node) / 2; - x0 += paddingLeft(node) - p; - y0 += paddingTop(node) - p; - x1 -= paddingRight(node) - p; - y1 -= paddingBottom(node) - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - tile(node, x0, y0, x1, y1); - } - } - - treemap.round = function(x) { - return arguments.length ? (round = !!x, treemap) : round; - }; - - treemap.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy]; - }; - - treemap.tile = function(x) { - return arguments.length ? (tile = required(x), treemap) : tile; - }; - - treemap.padding = function(x) { - return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); - }; - - treemap.paddingInner = function(x) { - return arguments.length ? (paddingInner = typeof x === "function" ? x : constant(+x), treemap) : paddingInner; - }; - - treemap.paddingOuter = function(x) { - return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); - }; - - treemap.paddingTop = function(x) { - return arguments.length ? (paddingTop = typeof x === "function" ? x : constant(+x), treemap) : paddingTop; - }; - - treemap.paddingRight = function(x) { - return arguments.length ? (paddingRight = typeof x === "function" ? x : constant(+x), treemap) : paddingRight; - }; - - treemap.paddingBottom = function(x) { - return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant(+x), treemap) : paddingBottom; - }; - - treemap.paddingLeft = function(x) { - return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant(+x), treemap) : paddingLeft; - }; - - return treemap; -} diff --git a/node_modules/d3-hierarchy/src/treemap/resquarify.js b/node_modules/d3-hierarchy/src/treemap/resquarify.js deleted file mode 100644 index e75a205..0000000 --- a/node_modules/d3-hierarchy/src/treemap/resquarify.js +++ /dev/null @@ -1,36 +0,0 @@ -import treemapDice from "./dice.js"; -import treemapSlice from "./slice.js"; -import {phi, squarifyRatio} from "./squarify.js"; - -export default (function custom(ratio) { - - function resquarify(parent, x0, y0, x1, y1) { - if ((rows = parent._squarify) && (rows.ratio === ratio)) { - var rows, - row, - nodes, - i, - j = -1, - n, - m = rows.length, - value = parent.value; - - while (++j < m) { - row = rows[j], nodes = row.children; - for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; - if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value); - else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1); - value -= row.value; - } - } else { - parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1); - rows.ratio = ratio; - } - } - - resquarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - - return resquarify; -})(phi); diff --git a/node_modules/d3-hierarchy/src/treemap/round.js b/node_modules/d3-hierarchy/src/treemap/round.js deleted file mode 100644 index 7ac45ec..0000000 --- a/node_modules/d3-hierarchy/src/treemap/round.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function(node) { - node.x0 = Math.round(node.x0); - node.y0 = Math.round(node.y0); - node.x1 = Math.round(node.x1); - node.y1 = Math.round(node.y1); -} diff --git a/node_modules/d3-hierarchy/src/treemap/slice.js b/node_modules/d3-hierarchy/src/treemap/slice.js deleted file mode 100644 index 1022bfa..0000000 --- a/node_modules/d3-hierarchy/src/treemap/slice.js +++ /dev/null @@ -1,12 +0,0 @@ -export default function(parent, x0, y0, x1, y1) { - var nodes = parent.children, - node, - i = -1, - n = nodes.length, - k = parent.value && (y1 - y0) / parent.value; - - while (++i < n) { - node = nodes[i], node.x0 = x0, node.x1 = x1; - node.y0 = y0, node.y1 = y0 += node.value * k; - } -} diff --git a/node_modules/d3-hierarchy/src/treemap/sliceDice.js b/node_modules/d3-hierarchy/src/treemap/sliceDice.js deleted file mode 100644 index 545ad42..0000000 --- a/node_modules/d3-hierarchy/src/treemap/sliceDice.js +++ /dev/null @@ -1,6 +0,0 @@ -import dice from "./dice.js"; -import slice from "./slice.js"; - -export default function(parent, x0, y0, x1, y1) { - (parent.depth & 1 ? slice : dice)(parent, x0, y0, x1, y1); -} diff --git a/node_modules/d3-hierarchy/src/treemap/squarify.js b/node_modules/d3-hierarchy/src/treemap/squarify.js deleted file mode 100644 index f801070..0000000 --- a/node_modules/d3-hierarchy/src/treemap/squarify.js +++ /dev/null @@ -1,66 +0,0 @@ -import treemapDice from "./dice.js"; -import treemapSlice from "./slice.js"; - -export var phi = (1 + Math.sqrt(5)) / 2; - -export function squarifyRatio(ratio, parent, x0, y0, x1, y1) { - var rows = [], - nodes = parent.children, - row, - nodeValue, - i0 = 0, - i1 = 0, - n = nodes.length, - dx, dy, - value = parent.value, - sumValue, - minValue, - maxValue, - newRatio, - minRatio, - alpha, - beta; - - while (i0 < n) { - dx = x1 - x0, dy = y1 - y0; - - // Find the next non-empty node. - do sumValue = nodes[i1++].value; while (!sumValue && i1 < n); - minValue = maxValue = sumValue; - alpha = Math.max(dy / dx, dx / dy) / (value * ratio); - beta = sumValue * sumValue * alpha; - minRatio = Math.max(maxValue / beta, beta / minValue); - - // Keep adding nodes while the aspect ratio maintains or improves. - for (; i1 < n; ++i1) { - sumValue += nodeValue = nodes[i1].value; - if (nodeValue < minValue) minValue = nodeValue; - if (nodeValue > maxValue) maxValue = nodeValue; - beta = sumValue * sumValue * alpha; - newRatio = Math.max(maxValue / beta, beta / minValue); - if (newRatio > minRatio) { sumValue -= nodeValue; break; } - minRatio = newRatio; - } - - // Position and record the row orientation. - rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)}); - if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); - else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); - value -= sumValue, i0 = i1; - } - - return rows; -} - -export default (function custom(ratio) { - - function squarify(parent, x0, y0, x1, y1) { - squarifyRatio(ratio, parent, x0, y0, x1, y1); - } - - squarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - - return squarify; -})(phi); diff --git a/node_modules/d3-interpolate/LICENSE b/node_modules/d3-interpolate/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-interpolate/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-interpolate/README.md b/node_modules/d3-interpolate/README.md deleted file mode 100644 index 046c3a6..0000000 --- a/node_modules/d3-interpolate/README.md +++ /dev/null @@ -1,250 +0,0 @@ -# d3-interpolate - -This module provides a variety of interpolation methods for blending between two values. Values may be numbers, colors, strings, arrays, or even deeply-nested objects. For example: - -```js -var i = d3.interpolateNumber(10, 20); -i(0.0); // 10 -i(0.2); // 12 -i(0.5); // 15 -i(1.0); // 20 -``` - -The returned function `i` is called an *interpolator*. Given a starting value *a* and an ending value *b*, it takes a parameter *t* in the domain [0, 1] and returns the corresponding interpolated value between *a* and *b*. An interpolator typically returns a value equivalent to *a* at *t* = 0 and a value equivalent to *b* at *t* = 1. - -You can interpolate more than just numbers. To find the perceptual midpoint between steelblue and brown: - -```js -d3.interpolateLab("steelblue", "brown")(0.5); // "rgb(142, 92, 109)" -``` - -Here’s a more elaborate example demonstrating type inference used by [interpolate](#interpolate): - -```js -var i = d3.interpolate({colors: ["red", "blue"]}, {colors: ["white", "black"]}); -i(0.0); // {colors: ["rgb(255, 0, 0)", "rgb(0, 0, 255)"]} -i(0.5); // {colors: ["rgb(255, 128, 128)", "rgb(0, 0, 128)"]} -i(1.0); // {colors: ["rgb(255, 255, 255)", "rgb(0, 0, 0)"]} -``` - -Note that the generic value interpolator detects not only nested objects and arrays, but also color strings and numbers embedded in strings! - -## Installing - -If you use NPM, `npm install d3-interpolate`. Otherwise, download the [latest release](https://github.com/d3/d3-interpolate/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-interpolate.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - - -``` - -## API Reference - -# d3.interpolate(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/value.js), [Examples](https://observablehq.com/@d3/d3-interpolate) - -Returns an interpolator between the two arbitrary values *a* and *b*. The interpolator implementation is based on the type of the end value *b*, using the following algorithm: - -1. If *b* is null, undefined or a boolean, use the constant *b*. -2. If *b* is a number, use [interpolateNumber](#interpolateNumber). -3. If *b* is a [color](https://github.com/d3/d3-color/blob/master/README.md#color) or a string coercible to a color, use [interpolateRgb](#interpolateRgb). -4. If *b* is a [date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date), use [interpolateDate](#interpolateDate). -5. If *b* is a string, use [interpolateString](#interpolateString). -6. If *b* is a [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) of numbers, use [interpolateNumberArray](#interpolateNumberArray). -7. If *b* is a generic [array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray), use [interpolateArray](#interpolateArray). -8. If *b* is coercible to a number, use [interpolateNumber](#interpolateNumber). -9. Use [interpolateObject](#interpolateObject). - -Based on the chosen interpolator, *a* is coerced to the suitable corresponding type. - -# d3.interpolateNumber(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/number.js), [Examples](https://observablehq.com/@d3/d3-interpolatenumber) - -Returns an interpolator between the two numbers *a* and *b*. The returned interpolator is equivalent to: - -```js -function interpolator(t) { - return a * (1 - t) + b * t; -} -``` - -Caution: avoid interpolating to or from the number zero when the interpolator is used to generate a string. When very small values are stringified, they may be converted to scientific notation, which is an invalid attribute or style property value in older browsers. For example, the number `0.0000001` is converted to the string `"1e-7"`. This is particularly noticeable with interpolating opacity. To avoid scientific notation, start or end the transition at 1e-6: the smallest value that is not stringified in scientific notation. - -# d3.interpolateRound(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/round.js), [Examples](https://observablehq.com/@d3/d3-interpolatenumber) - -Returns an interpolator between the two numbers *a* and *b*; the interpolator is similar to [interpolateNumber](#interpolateNumber), except it will round the resulting value to the nearest integer. - -# d3.interpolateString(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/string.js), [Examples](https://observablehq.com/@d3/d3-interpolatestring) - -Returns an interpolator between the two strings *a* and *b*. The string interpolator finds numbers embedded in *a* and *b*, where each number is of the form understood by JavaScript. A few examples of numbers that will be detected within a string: `-1`, `42`, `3.14159`, and `6.0221413e+23`. - -For each number embedded in *b*, the interpolator will attempt to find a corresponding number in *a*. If a corresponding number is found, a numeric interpolator is created using [interpolateNumber](#interpolateNumber). The remaining parts of the string *b* are used as a template: the static parts of the string *b* remain constant for the interpolation, with the interpolated numeric values embedded in the template. - -For example, if *a* is `"300 12px sans-serif"`, and *b* is `"500 36px Comic-Sans"`, two embedded numbers are found. The remaining static parts (of string *b*) are a space between the two numbers (`" "`), and the suffix (`"px Comic-Sans"`). The result of the interpolator at *t* = 0.5 is `"400 24px Comic-Sans"`. - -# d3.interpolateDate(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/date.js), [Examples](https://observablehq.com/@d3/d3-interpolatedate) - -Returns an interpolator between the two [dates](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) *a* and *b*. - -Note: **no defensive copy** of the returned date is created; the same Date instance is returned for every evaluation of the interpolator. No copy is made for performance reasons; interpolators are often part of the inner loop of [animated transitions](https://github.com/d3/d3-transition). - -# d3.interpolateArray(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/array.js), [Examples](https://observablehq.com/@d3/d3-interpolateobject) - -Returns an interpolator between the two arrays *a* and *b*. If *b* is a typed array (e.g., Float64Array), [interpolateNumberArray](#interpolateNumberArray) is called instead. - -Internally, an array template is created that is the same length as *b*. For each element in *b*, if there exists a corresponding element in *a*, a generic interpolator is created for the two elements using [interpolate](#interpolate). If there is no such element, the static value from *b* is used in the template. Then, for the given parameter *t*, the template’s embedded interpolators are evaluated. The updated array template is then returned. - -For example, if *a* is the array `[0, 1]` and *b* is the array `[1, 10, 100]`, then the result of the interpolator for *t* = 0.5 is the array `[0.5, 5.5, 100]`. - -Note: **no defensive copy** of the template array is created; modifications of the returned array may adversely affect subsequent evaluation of the interpolator. No copy is made for performance reasons; interpolators are often part of the inner loop of [animated transitions](https://github.com/d3/d3-transition). - -# d3.interpolateNumberArray(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/numberArray.js), [Examples](https://observablehq.com/@d3/d3-interpolatenumberarray) - -Returns an interpolator between the two arrays of numbers *a* and *b*. Internally, an array template is created that is the same type and length as *b*. For each element in *b*, if there exists a corresponding element in *a*, the values are directly interpolated in the array template. If there is no such element, the static value from *b* is copied. The updated array template is then returned. - -Note: For performance reasons, **no defensive copy** is made of the template array and the arguments *a* and *b*; modifications of these arrays may affect subsequent evaluation of the interpolator. - -# d3.interpolateObject(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/object.js), [Examples](https://observablehq.com/@d3/d3-interpolateobject) - -Returns an interpolator between the two objects *a* and *b*. Internally, an object template is created that has the same properties as *b*. For each property in *b*, if there exists a corresponding property in *a*, a generic interpolator is created for the two elements using [interpolate](#interpolate). If there is no such property, the static value from *b* is used in the template. Then, for the given parameter *t*, the template's embedded interpolators are evaluated and the updated object template is then returned. - -For example, if *a* is the object `{x: 0, y: 1}` and *b* is the object `{x: 1, y: 10, z: 100}`, the result of the interpolator for *t* = 0.5 is the object `{x: 0.5, y: 5.5, z: 100}`. - -Object interpolation is particularly useful for *dataspace interpolation*, where data is interpolated rather than attribute values. For example, you can interpolate an object which describes an arc in a pie chart, and then use [d3.arc](https://github.com/d3/d3-shape/blob/master/README.md#arc) to compute the new SVG path data. - -Note: **no defensive copy** of the template object is created; modifications of the returned object may adversely affect subsequent evaluation of the interpolator. No copy is made for performance reasons; interpolators are often part of the inner loop of [animated transitions](https://github.com/d3/d3-transition). - -# d3.interpolateTransformCss(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/transform/index.js#L62), [Examples](https://observablehq.com/@d3/d3-interpolatetransformcss) - -Returns an interpolator between the two 2D CSS transforms represented by *a* and *b*. Each transform is decomposed to a standard representation of translate, rotate, *x*-skew and scale; these component transformations are then interpolated. This behavior is standardized by CSS: see [matrix decomposition for animation](http://www.w3.org/TR/css3-2d-transforms/#matrix-decomposition). - -# d3.interpolateTransformSvg(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/transform/index.js#L63), [Examples](https://observablehq.com/@d3/d3-interpolatetransformcss) - -Returns an interpolator between the two 2D SVG transforms represented by *a* and *b*. Each transform is decomposed to a standard representation of translate, rotate, *x*-skew and scale; these component transformations are then interpolated. This behavior is standardized by CSS: see [matrix decomposition for animation](http://www.w3.org/TR/css3-2d-transforms/#matrix-decomposition). - -# d3.interpolateZoom(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/zoom.js), [Examples](https://observablehq.com/@d3/d3-interpolatezoom) - -Returns an interpolator between the two views *a* and *b* of a two-dimensional plane, based on [“Smooth and efficient zooming and panning”](http://www.win.tue.nl/~vanwijk/zoompan.pdf) by Jarke J. van Wijk and Wim A.A. Nuij. Each view is defined as an array of three numbers: *cx*, *cy* and *width*. The first two coordinates *cx*, *cy* represent the center of the viewport; the last coordinate *width* represents the size of the viewport. - -The returned interpolator exposes a *duration* property which encodes the recommended transition duration in milliseconds. This duration is based on the path length of the curved trajectory through *x,y* space. If you want a slower or faster transition, multiply this by an arbitrary scale factor (V as described in the original paper). - -# d3.interpolateDiscrete(values) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/discrete.js), [Examples](https://observablehq.com/@d3/d3-interpolatediscrete) - -Returns a discrete interpolator for the given array of *values*. The returned interpolator maps *t* in [0, 1 / *n*) to *values*[0], *t* in [1 / *n*, 2 / *n*) to *values*[1], and so on, where *n* = *values*.length. In effect, this is a lightweight [quantize scale](https://github.com/d3/d3-scale/blob/master/README.md#quantize-scales) with a fixed domain of [0, 1]. - -### Sampling - -# d3.quantize(interpolator, n) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/d3-quantize) - -Returns *n* uniformly-spaced samples from the specified *interpolator*, where *n* is an integer greater than one. The first sample is always at *t* = 0, and the last sample is always at *t* = 1. This can be useful in generating a fixed number of samples from a given interpolator, such as to derive the range of a [quantize scale](https://github.com/d3/d3-scale/blob/master/README.md#quantize-scales) from a [continuous interpolator](https://github.com/d3/d3-scale-chromatic/blob/master/README.md#interpolateWarm). - -Caution: this method will not work with interpolators that do not return defensive copies of their output, such as [d3.interpolateArray](#interpolateArray), [d3.interpolateDate](#interpolateDate) and [d3.interpolateObject](#interpolateObject). For those interpolators, you must wrap the interpolator and create a copy for each returned value. - -### Color Spaces - -# d3.interpolateRgb(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/rgb.js), [Examples](https://observablehq.com/@d3/working-with-color) - -rgb - -Or, with a corrected [gamma](#interpolate_gamma) of 2.2: - -rgbGamma - -Returns an RGB color space interpolator between the two colors *a* and *b* with a configurable [gamma](#interpolate_gamma). If the gamma is not specified, it defaults to 1.0. The colors *a* and *b* need not be in RGB; they will be converted to RGB using [d3.rgb](https://github.com/d3/d3-color/blob/master/README.md#rgb). The return value of the interpolator is an RGB string. - -# d3.interpolateRgbBasis(colors) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/rgb.js#L54), [Examples](https://observablehq.com/@d3/working-with-color) - -Returns a uniform nonrational B-spline interpolator through the specified array of *colors*, which are converted to [RGB color space](https://github.com/d3/d3-color/blob/master/README.md#rgb). Implicit control points are generated such that the interpolator returns *colors*[0] at *t* = 0 and *colors*[*colors*.length - 1] at *t* = 1. Opacity interpolation is not currently supported. See also [d3.interpolateBasis](#interpolateBasis), and see [d3-scale-chromatic](https://github.com/d3/d3-scale-chromatic) for examples. - -# d3.interpolateRgbBasisClosed(colors) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/rgb.js#L55), [Examples](https://observablehq.com/@d3/working-with-color) - -Returns a uniform nonrational B-spline interpolator through the specified array of *colors*, which are converted to [RGB color space](https://github.com/d3/d3-color/blob/master/README.md#rgb). The control points are implicitly repeated such that the resulting spline has cyclical C² continuity when repeated around *t* in [0,1]; this is useful, for example, to create cyclical color scales. Opacity interpolation is not currently supported. See also [d3.interpolateBasisClosed](#interpolateBasisClosed), and see [d3-scale-chromatic](https://github.com/d3/d3-scale-chromatic) for examples. - -# d3.interpolateHsl(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/hsl.js), [Examples](https://observablehq.com/@d3/working-with-color) - -hsl - -Returns an HSL color space interpolator between the two colors *a* and *b*. The colors *a* and *b* need not be in HSL; they will be converted to HSL using [d3.hsl](https://github.com/d3/d3-color/blob/master/README.md#hsl). If either color’s hue or saturation is NaN, the opposing color’s channel value is used. The shortest path between hues is used. The return value of the interpolator is an RGB string. - -# d3.interpolateHslLong(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/hsl.js#L21), [Examples](https://observablehq.com/@d3/working-with-color) - -hslLong - -Like [interpolateHsl](#interpolateHsl), but does not use the shortest path between hues. - -# d3.interpolateLab(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/lab.js), [Examples](https://observablehq.com/@d3/working-with-color) - -lab - -Returns a [CIELAB color space](https://en.wikipedia.org/wiki/Lab_color_space#CIELAB) interpolator between the two colors *a* and *b*. The colors *a* and *b* need not be in CIELAB; they will be converted to CIELAB using [d3.lab](https://github.com/d3/d3-color/blob/master/README.md#lab). The return value of the interpolator is an RGB string. - -# d3.interpolateHcl(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/hcl.js), [Examples](https://observablehq.com/@d3/working-with-color) - -hcl - -Returns a [CIELChab color space](https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_representation:_CIELCh_or_CIEHLC) interpolator between the two colors *a* and *b*. The colors *a* and *b* need not be in CIELChab; they will be converted to CIELChab using [d3.hcl](https://github.com/d3/d3-color/blob/master/README.md#hcl). If either color’s hue or chroma is NaN, the opposing color’s channel value is used. The shortest path between hues is used. The return value of the interpolator is an RGB string. - -# d3.interpolateHclLong(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/hcl.js#L21), [Examples](https://observablehq.com/@d3/working-with-color) - -hclLong - -Like [interpolateHcl](#interpolateHcl), but does not use the shortest path between hues. - -# d3.interpolateCubehelix(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/cubehelix.js), [Examples](https://observablehq.com/@d3/working-with-color) - -cubehelix - -Or, with a [gamma](#interpolate_gamma) of 3.0 to emphasize high-intensity values: - -cubehelixGamma - -Returns a Cubehelix color space interpolator between the two colors *a* and *b* using a configurable [gamma](#interpolate_gamma). If the gamma is not specified, it defaults to 1.0. The colors *a* and *b* need not be in Cubehelix; they will be converted to Cubehelix using [d3.cubehelix](https://github.com/d3/d3-color/blob/master/README.md#cubehelix). If either color’s hue or saturation is NaN, the opposing color’s channel value is used. The shortest path between hues is used. The return value of the interpolator is an RGB string. - -# d3.interpolateCubehelixLong(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/cubehelix.js#L29), [Examples](https://observablehq.com/@d3/working-with-color) - -cubehelixLong - -Or, with a [gamma](#interpolate_gamma) of 3.0 to emphasize high-intensity values: - -cubehelixGammaLong - -Like [interpolateCubehelix](#interpolateCubehelix), but does not use the shortest path between hues. - -# interpolate.gamma(gamma) - -Given that *interpolate* is one of [interpolateRgb](#interpolateRgb), [interpolateCubehelix](#interpolateCubehelix) or [interpolateCubehelixLong](#interpolateCubehelixLong), returns a new interpolator factory of the same type using the specified *gamma*. For example, to interpolate from purple to orange with a gamma of 2.2 in RGB space: - -```js -var interpolator = d3.interpolateRgb.gamma(2.2)("purple", "orange"); -``` - -See Eric Brasseur’s article, [Gamma error in picture scaling](https://web.archive.org/web/20160112115812/http://www.4p8.com/eric.brasseur/gamma.html), for more on gamma correction. - -# d3.interpolateHue(a, b) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/hue.js), [Examples](https://observablehq.com/@d3/working-with-color) - -Returns an interpolator between the two hue angles *a* and *b*. If either hue is NaN, the opposing value is used. The shortest path between hues is used. The return value of the interpolator is a number in [0, 360). - -### Splines - -Whereas standard interpolators blend from a starting value *a* at *t* = 0 to an ending value *b* at *t* = 1, spline interpolators smoothly blend multiple input values for *t* in [0,1] using piecewise polynomial functions. Only cubic uniform nonrational [B-splines](https://en.wikipedia.org/wiki/B-spline) are currently supported, also known as basis splines. - -# d3.interpolateBasis(values) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/basis.js), [Examples](https://observablehq.com/@d3/d3-interpolatebasis) - -Returns a uniform nonrational B-spline interpolator through the specified array of *values*, which must be numbers. Implicit control points are generated such that the interpolator returns *values*[0] at *t* = 0 and *values*[*values*.length - 1] at *t* = 1. See also [d3.curveBasis](https://github.com/d3/d3-shape/blob/master/README.md#curveBasis). - -# d3.interpolateBasisClosed(values) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/basisClosed.js), [Examples](https://observablehq.com/@d3/d3-interpolatebasis) - -Returns a uniform nonrational B-spline interpolator through the specified array of *values*, which must be numbers. The control points are implicitly repeated such that the resulting one-dimensional spline has cyclical C² continuity when repeated around *t* in [0,1]. See also [d3.curveBasisClosed](https://github.com/d3/d3-shape/blob/master/README.md#curveBasisClosed). - -### Piecewise - -# d3.piecewise(interpolate, values) · [Source](https://github.com/d3/d3-interpolate/blob/master/src/piecewise.js), [Examples](https://observablehq.com/@d3/d3-piecewise) - -Returns a piecewise interpolator, composing interpolators for each adjacent pair of *values*. The returned interpolator maps *t* in [0, 1 / (*n* - 1)] to *interpolate*(*values*[0], *values*[1]), *t* in [1 / (*n* - 1), 2 / (*n* - 1)] to *interpolate*(*values*[1], *values*[2]), and so on, where *n* = *values*.length. In effect, this is a lightweight [linear scale](https://github.com/d3/d3-scale/blob/master/README.md#linear-scales). For example, to blend through red, green and blue: - -```js -var interpolate = d3.piecewise(d3.interpolateRgb.gamma(2.2), ["red", "green", "blue"]); -``` diff --git a/node_modules/d3-interpolate/dist/d3-interpolate.js b/node_modules/d3-interpolate/dist/d3-interpolate.js deleted file mode 100644 index 7742c62..0000000 --- a/node_modules/d3-interpolate/dist/d3-interpolate.js +++ /dev/null @@ -1,593 +0,0 @@ -// https://d3js.org/d3-interpolate/ v1.4.0 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-color')) : -typeof define === 'function' && define.amd ? define(['exports', 'd3-color'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {}, global.d3)); -}(this, function (exports, d3Color) { 'use strict'; - -function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, t3 = 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 = values.length - 1; - return function(t) { - var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), - v1 = values[i], - v2 = values[i + 1], - v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, - v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; -} - -function basisClosed(values) { - var n = values.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), - v0 = values[(i + n - 1) % n], - v1 = values[i % n], - v2 = values[(i + 1) % n], - v3 = values[(i + 2) % n]; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; -} - -function constant(x) { - return function() { - return x; - }; -} - -function linear(a, d) { - return function(t) { - return a + t * d; - }; -} - -function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; -} - -function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a); -} - -function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a); - }; -} - -function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : constant(isNaN(a) ? b : a); -} - -var rgb = (function rgbGamma(y) { - var color = gamma(y); - - function rgb(start, end) { - var r = color((start = d3Color.rgb(start)).r, (end = d3Color.rgb(end)).r), - g = color(start.g, end.g), - b = color(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - - rgb.gamma = rgbGamma; - - return rgb; -})(1); - -function rgbSpline(spline) { - return function(colors) { - var n = colors.length, - r = new Array(n), - g = new Array(n), - b = new Array(n), - i, color; - for (i = 0; i < n; ++i) { - color = d3Color.rgb(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function(t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; - }; -} - -var rgbBasis = rgbSpline(basis$1); -var rgbBasisClosed = rgbSpline(basisClosed); - -function numberArray(a, b) { - if (!b) b = []; - var n = a ? Math.min(b.length, a.length) : 0, - c = b.slice(), - i; - return function(t) { - for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; - return c; - }; -} - -function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); -} - -function array(a, b) { - return (isNumberArray(b) ? numberArray : genericArray)(a, b); -} - -function genericArray(a, b) { - var nb = b ? b.length : 0, - na = a ? Math.min(nb, a.length) : 0, - x = new Array(na), - c = new Array(nb), - i; - - for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]); - for (; i < nb; ++i) c[i] = b[i]; - - return function(t) { - for (i = 0; i < na; ++i) c[i] = x[i](t); - return c; - }; -} - -function date(a, b) { - var d = new Date; - return a = +a, b = +b, function(t) { - return d.setTime(a * (1 - t) + b * t), d; - }; -} - -function number(a, b) { - return a = +a, b = +b, function(t) { - return a * (1 - t) + b * t; - }; -} - -function object(a, b) { - var i = {}, - c = {}, - k; - - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; - - for (k in b) { - if (k in a) { - i[k] = value(a[k], b[k]); - } else { - c[k] = b[k]; - } - } - - return function(t) { - for (k in i) c[k] = i[k](t); - return c; - }; -} - -var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, - reB = new RegExp(reA.source, "g"); - -function zero(b) { - return function() { - return b; - }; -} - -function one(b) { - return function(t) { - return b(t) + ""; - }; -} - -function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 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 = -1, // index in s - s = [], // string constants and placeholders - q = []; // number interpolators - - // Coerce inputs to strings. - a = a + "", b = b + ""; - - // Interpolate pairs of numbers in a & b. - while ((am = reA.exec(a)) - && (bm = reB.exec(b))) { - if ((bs = bm.index) > bi) { // a string precedes the next number in b - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; - } else { // interpolate non-matching numbers - s[++i] = null; - q.push({i: i, x: number(am, bm)}); - } - bi = reB.lastIndex; - } - - // Add remains of b. - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = 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 = q.length, function(t) { - for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }); -} - -function value(a, b) { - var t = typeof b, c; - return b == null || t === "boolean" ? constant(b) - : (t === "number" ? number - : t === "string" ? ((c = d3Color.color(b)) ? (b = c, rgb) : string) - : b instanceof d3Color.color ? rgb - : b instanceof Date ? date - : isNumberArray(b) ? numberArray - : Array.isArray(b) ? genericArray - : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object - : number)(a, b); -} - -function discrete(range) { - var n = 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 = hue(+a, +b); - return function(t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; -} - -function round(a, b) { - return a = +a, b = +b, function(t) { - return Math.round(a * (1 - t) + b * t); - }; -} - -var degrees = 180 / Math.PI; - -var identity = { - 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 = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - 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 === "none") return identity; - if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; - cssNode.style.transform = value; - value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); - cssRoot.removeChild(cssNode); - value = value.slice(7, -1).split(","); - return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); -} - -function parseSvg(value) { - if (value == null) return identity; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return identity; - value = 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 !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); - } else if (xb || yb) { - s.push("translate(" + xb + pxComma + yb + pxParen); - } - } - - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path - q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)}); - } else if (b) { - s.push(pop(s) + "rotate(" + b + degParen); - } - } - - function skewX(a, b, s, q) { - if (a !== b) { - q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)}); - } else if (b) { - s.push(pop(s) + "skewX(" + b + degParen); - } - } - - function scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); - } else if (xb !== 1 || yb !== 1) { - s.push(pop(s) + "scale(" + xb + "," + yb + ")"); - } - } - - return function(a, b) { - var s = [], // string constants and placeholders - q = []; // number interpolators - a = parse(a), b = 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 = b = null; // gc - return function(t) { - var i = -1, n = q.length, o; - while (++i < n) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; - }; -} - -var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); -var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); - -var rho = Math.SQRT2, - rho2 = 2, - rho4 = 4, - epsilon2 = 1e-12; - -function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; -} - -function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; -} - -function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); -} - -// p0 = [ux0, uy0, w0] -// p1 = [ux1, uy1, w1] -function zoom(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], - ux1 = p1[0], uy1 = p1[1], w1 = p1[2], - dx = ux1 - ux0, - dy = uy1 - uy0, - d2 = dx * dx + dy * dy, - i, - S; - - // Special case for u0 ≅ u1. - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; - }; - } - - // General case. - else { - var d1 = Math.sqrt(d2), - b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), - b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), - r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), - r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s = t * S, - coshr0 = cosh(r0), - u = 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 = S * 1000; - - return i; -} - -function hsl(hue) { - return function(start, end) { - var h = hue((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h), - s = nogamma(start.s, end.s), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - } -} - -var hsl$1 = hsl(hue); -var hslLong = hsl(nogamma); - -function lab(start, end) { - var l = nogamma((start = d3Color.lab(start)).l, (end = d3Color.lab(end)).l), - a = nogamma(start.a, end.a), - b = nogamma(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; -} - -function hcl(hue) { - return function(start, end) { - var h = hue((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h), - c = nogamma(start.c, end.c), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - } -} - -var hcl$1 = hcl(hue); -var hclLong = hcl(nogamma); - -function cubehelix(hue) { - return (function cubehelixGamma(y) { - y = +y; - - function cubehelix(start, end) { - var h = hue((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h), - s = nogamma(start.s, end.s), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - - cubehelix.gamma = cubehelixGamma; - - return cubehelix; - })(1); -} - -var cubehelix$1 = cubehelix(hue); -var cubehelixLong = cubehelix(nogamma); - -function piecewise(interpolate, values) { - var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); - while (i < n) I[i] = interpolate(v, v = values[++i]); - return function(t) { - var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i](t - i); - }; -} - -function quantize(interpolator, n) { - var samples = new Array(n); - for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); - return samples; -} - -exports.interpolate = value; -exports.interpolateArray = array; -exports.interpolateBasis = basis$1; -exports.interpolateBasisClosed = basisClosed; -exports.interpolateCubehelix = cubehelix$1; -exports.interpolateCubehelixLong = cubehelixLong; -exports.interpolateDate = date; -exports.interpolateDiscrete = discrete; -exports.interpolateHcl = hcl$1; -exports.interpolateHclLong = hclLong; -exports.interpolateHsl = hsl$1; -exports.interpolateHslLong = hslLong; -exports.interpolateHue = hue$1; -exports.interpolateLab = lab; -exports.interpolateNumber = number; -exports.interpolateNumberArray = numberArray; -exports.interpolateObject = object; -exports.interpolateRgb = rgb; -exports.interpolateRgbBasis = rgbBasis; -exports.interpolateRgbBasisClosed = rgbBasisClosed; -exports.interpolateRound = round; -exports.interpolateString = string; -exports.interpolateTransformCss = interpolateTransformCss; -exports.interpolateTransformSvg = interpolateTransformSvg; -exports.interpolateZoom = zoom; -exports.piecewise = piecewise; -exports.quantize = quantize; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-interpolate/dist/d3-interpolate.min.js b/node_modules/d3-interpolate/dist/d3-interpolate.min.js deleted file mode 100644 index 155c9b7..0000000 --- a/node_modules/d3-interpolate/dist/d3-interpolate.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-interpolate/ v1.4.0 Copyright 2019 Mike Bostock -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-color")):"function"==typeof define&&define.amd?define(["exports","d3-color"],n):n((t=t||self).d3=t.d3||{},t.d3)}(this,function(t,n){"use strict";function r(t,n,r,e,a){var o=t*t,u=o*t;return((1-3*t+3*o-u)*n+(4-6*o+3*u)*r+(1+3*t+3*o-3*u)*e+u*a)/6}function e(t){var n=t.length-1;return function(e){var a=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),o=t[a],u=t[a+1],i=a>0?t[a-1]:2*o-u,l=a180||r<-180?r-360*Math.round(r/360):r):o(isNaN(t)?n:t)}function l(t){return 1==(t=+t)?c:function(n,r){return r-n?function(t,n,r){return t=Math.pow(t,r),n=Math.pow(n,r)-t,r=1/r,function(e){return Math.pow(t+e*n,r)}}(n,r,t):o(isNaN(n)?r:n)}}function c(t,n){var r=n-t;return r?u(t,r):o(isNaN(t)?n:t)}var f=function t(r){var e=l(r);function a(t,r){var a=e((t=n.rgb(t)).r,(r=n.rgb(r)).r),o=e(t.g,r.g),u=e(t.b,r.b),i=c(t.opacity,r.opacity);return function(n){return t.r=a(n),t.g=o(n),t.b=u(n),t.opacity=i(n),t+""}}return a.gamma=t,a}(1);function s(t){return function(r){var e,a,o=r.length,u=new Array(o),i=new Array(o),l=new Array(o);for(e=0;eo&&(a=n.slice(o,a),i[u]?i[u]+=a:i[++u]=a),(r=r[0])===(e=e[0])?i[u]?i[u]+=e:i[++u]=e:(i[++u]=null,l.push({i:u,x:m(r,e)})),o=x.lastIndex;return o180?n+=360:n-t>180&&(t+=360),o.push({i:r.push(a(r)+"rotate(",null,e)-2,x:m(t,n)})):n&&r.push(a(r)+"rotate("+n+e)}(o.rotate,u.rotate,i,l),function(t,n,r,o){t!==n?o.push({i:r.push(a(r)+"skewX(",null,e)-2,x:m(t,n)}):n&&r.push(a(r)+"skewX("+n+e)}(o.skewX,u.skewX,i,l),function(t,n,r,e,o,u){if(t!==r||n!==e){var i=o.push(a(o)+"scale(",null,",",null,")");u.push({i:i-4,x:m(t,r)},{i:i-2,x:m(n,e)})}else 1===r&&1===e||o.push(a(o)+"scale("+r+","+e+")")}(o.scaleX,o.scaleY,u.scaleX,u.scaleY,i,l),o=u=null,function(t){for(var n,r=-1,e=l.length;++r= 1 ? (t = 1, n - 1) : Math.floor(t * n), - v1 = values[i], - v2 = values[i + 1], - v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, - v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; -} diff --git a/node_modules/d3-interpolate/src/basisClosed.js b/node_modules/d3-interpolate/src/basisClosed.js deleted file mode 100644 index 2639d92..0000000 --- a/node_modules/d3-interpolate/src/basisClosed.js +++ /dev/null @@ -1,13 +0,0 @@ -import {basis} from "./basis.js"; - -export default function(values) { - var n = values.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), - v0 = values[(i + n - 1) % n], - v1 = values[i % n], - v2 = values[(i + 1) % n], - v3 = values[(i + 2) % n]; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; -} diff --git a/node_modules/d3-interpolate/src/color.js b/node_modules/d3-interpolate/src/color.js deleted file mode 100644 index 4630fb2..0000000 --- a/node_modules/d3-interpolate/src/color.js +++ /dev/null @@ -1,29 +0,0 @@ -import constant from "./constant.js"; - -function linear(a, d) { - return function(t) { - return a + t * d; - }; -} - -function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; -} - -export function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a); -} - -export function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a); - }; -} - -export default function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : constant(isNaN(a) ? b : a); -} diff --git a/node_modules/d3-interpolate/src/constant.js b/node_modules/d3-interpolate/src/constant.js deleted file mode 100644 index b7d42e7..0000000 --- a/node_modules/d3-interpolate/src/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(x) { - return function() { - return x; - }; -} diff --git a/node_modules/d3-interpolate/src/cubehelix.js b/node_modules/d3-interpolate/src/cubehelix.js deleted file mode 100644 index 2c4f64b..0000000 --- a/node_modules/d3-interpolate/src/cubehelix.js +++ /dev/null @@ -1,29 +0,0 @@ -import {cubehelix as colorCubehelix} from "d3-color"; -import color, {hue} from "./color.js"; - -function cubehelix(hue) { - return (function cubehelixGamma(y) { - y = +y; - - function cubehelix(start, end) { - var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h), - s = color(start.s, end.s), - l = color(start.l, end.l), - opacity = color(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - - cubehelix.gamma = cubehelixGamma; - - return cubehelix; - })(1); -} - -export default cubehelix(hue); -export var cubehelixLong = cubehelix(color); diff --git a/node_modules/d3-interpolate/src/date.js b/node_modules/d3-interpolate/src/date.js deleted file mode 100644 index cdfbea7..0000000 --- a/node_modules/d3-interpolate/src/date.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function(a, b) { - var d = new Date; - return a = +a, b = +b, function(t) { - return d.setTime(a * (1 - t) + b * t), d; - }; -} diff --git a/node_modules/d3-interpolate/src/discrete.js b/node_modules/d3-interpolate/src/discrete.js deleted file mode 100644 index b3d1e3b..0000000 --- a/node_modules/d3-interpolate/src/discrete.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function(range) { - var n = range.length; - return function(t) { - return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; -} diff --git a/node_modules/d3-interpolate/src/hcl.js b/node_modules/d3-interpolate/src/hcl.js deleted file mode 100644 index 0312580..0000000 --- a/node_modules/d3-interpolate/src/hcl.js +++ /dev/null @@ -1,21 +0,0 @@ -import {hcl as colorHcl} from "d3-color"; -import color, {hue} from "./color.js"; - -function hcl(hue) { - return function(start, end) { - var h = hue((start = colorHcl(start)).h, (end = colorHcl(end)).h), - c = color(start.c, end.c), - l = color(start.l, end.l), - opacity = color(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - } -} - -export default hcl(hue); -export var hclLong = hcl(color); diff --git a/node_modules/d3-interpolate/src/hsl.js b/node_modules/d3-interpolate/src/hsl.js deleted file mode 100644 index 2f78a90..0000000 --- a/node_modules/d3-interpolate/src/hsl.js +++ /dev/null @@ -1,21 +0,0 @@ -import {hsl as colorHsl} from "d3-color"; -import color, {hue} from "./color.js"; - -function hsl(hue) { - return function(start, end) { - var h = hue((start = colorHsl(start)).h, (end = colorHsl(end)).h), - s = color(start.s, end.s), - l = color(start.l, end.l), - opacity = color(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - } -} - -export default hsl(hue); -export var hslLong = hsl(color); diff --git a/node_modules/d3-interpolate/src/hue.js b/node_modules/d3-interpolate/src/hue.js deleted file mode 100644 index 5d8d4b9..0000000 --- a/node_modules/d3-interpolate/src/hue.js +++ /dev/null @@ -1,9 +0,0 @@ -import {hue} from "./color.js"; - -export default function(a, b) { - var i = hue(+a, +b); - return function(t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; -} diff --git a/node_modules/d3-interpolate/src/index.js b/node_modules/d3-interpolate/src/index.js deleted file mode 100644 index b4dce7d..0000000 --- a/node_modules/d3-interpolate/src/index.js +++ /dev/null @@ -1,21 +0,0 @@ -export {default as interpolate} from "./value.js"; -export {default as interpolateArray} from "./array.js"; -export {default as interpolateBasis} from "./basis.js"; -export {default as interpolateBasisClosed} from "./basisClosed.js"; -export {default as interpolateDate} from "./date.js"; -export {default as interpolateDiscrete} from "./discrete.js"; -export {default as interpolateHue} from "./hue.js"; -export {default as interpolateNumber} from "./number.js"; -export {default as interpolateNumberArray} from "./numberArray.js"; -export {default as interpolateObject} from "./object.js"; -export {default as interpolateRound} from "./round.js"; -export {default as interpolateString} from "./string.js"; -export {interpolateTransformCss, interpolateTransformSvg} from "./transform/index.js"; -export {default as interpolateZoom} from "./zoom.js"; -export {default as interpolateRgb, rgbBasis as interpolateRgbBasis, rgbBasisClosed as interpolateRgbBasisClosed} from "./rgb.js"; -export {default as interpolateHsl, hslLong as interpolateHslLong} from "./hsl.js"; -export {default as interpolateLab} from "./lab.js"; -export {default as interpolateHcl, hclLong as interpolateHclLong} from "./hcl.js"; -export {default as interpolateCubehelix, cubehelixLong as interpolateCubehelixLong} from "./cubehelix.js"; -export {default as piecewise} from "./piecewise.js"; -export {default as quantize} from "./quantize.js"; diff --git a/node_modules/d3-interpolate/src/lab.js b/node_modules/d3-interpolate/src/lab.js deleted file mode 100644 index 8fbf7f3..0000000 --- a/node_modules/d3-interpolate/src/lab.js +++ /dev/null @@ -1,16 +0,0 @@ -import {lab as colorLab} from "d3-color"; -import color from "./color.js"; - -export default function lab(start, end) { - var l = color((start = colorLab(start)).l, (end = colorLab(end)).l), - a = color(start.a, end.a), - b = color(start.b, end.b), - opacity = color(start.opacity, end.opacity); - return function(t) { - start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; -} diff --git a/node_modules/d3-interpolate/src/number.js b/node_modules/d3-interpolate/src/number.js deleted file mode 100644 index 837b13d..0000000 --- a/node_modules/d3-interpolate/src/number.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(a, b) { - return a = +a, b = +b, function(t) { - return a * (1 - t) + b * t; - }; -} diff --git a/node_modules/d3-interpolate/src/numberArray.js b/node_modules/d3-interpolate/src/numberArray.js deleted file mode 100644 index 4081086..0000000 --- a/node_modules/d3-interpolate/src/numberArray.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function(a, b) { - if (!b) b = []; - var n = a ? Math.min(b.length, a.length) : 0, - c = b.slice(), - i; - return function(t) { - for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; - return c; - }; -} - -export function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); -} diff --git a/node_modules/d3-interpolate/src/object.js b/node_modules/d3-interpolate/src/object.js deleted file mode 100644 index b521c33..0000000 --- a/node_modules/d3-interpolate/src/object.js +++ /dev/null @@ -1,23 +0,0 @@ -import value from "./value.js"; - -export default function(a, b) { - var i = {}, - c = {}, - k; - - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; - - for (k in b) { - if (k in a) { - i[k] = value(a[k], b[k]); - } else { - c[k] = b[k]; - } - } - - return function(t) { - for (k in i) c[k] = i[k](t); - return c; - }; -} diff --git a/node_modules/d3-interpolate/src/piecewise.js b/node_modules/d3-interpolate/src/piecewise.js deleted file mode 100644 index 41f76ae..0000000 --- a/node_modules/d3-interpolate/src/piecewise.js +++ /dev/null @@ -1,8 +0,0 @@ -export default function piecewise(interpolate, values) { - var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); - while (i < n) I[i] = interpolate(v, v = values[++i]); - return function(t) { - var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i](t - i); - }; -} diff --git a/node_modules/d3-interpolate/src/quantize.js b/node_modules/d3-interpolate/src/quantize.js deleted file mode 100644 index d7c23e6..0000000 --- a/node_modules/d3-interpolate/src/quantize.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(interpolator, n) { - var samples = new Array(n); - for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); - return samples; -} diff --git a/node_modules/d3-interpolate/src/rgb.js b/node_modules/d3-interpolate/src/rgb.js deleted file mode 100644 index 495c1f8..0000000 --- a/node_modules/d3-interpolate/src/rgb.js +++ /dev/null @@ -1,55 +0,0 @@ -import {rgb as colorRgb} from "d3-color"; -import basis from "./basis.js"; -import basisClosed from "./basisClosed.js"; -import nogamma, {gamma} from "./color.js"; - -export default (function rgbGamma(y) { - var color = gamma(y); - - function rgb(start, end) { - var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r), - g = color(start.g, end.g), - b = color(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - - rgb.gamma = rgbGamma; - - return rgb; -})(1); - -function rgbSpline(spline) { - return function(colors) { - var n = colors.length, - r = new Array(n), - g = new Array(n), - b = new Array(n), - i, color; - for (i = 0; i < n; ++i) { - color = colorRgb(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function(t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; - }; -} - -export var rgbBasis = rgbSpline(basis); -export var rgbBasisClosed = rgbSpline(basisClosed); diff --git a/node_modules/d3-interpolate/src/round.js b/node_modules/d3-interpolate/src/round.js deleted file mode 100644 index 2635d28..0000000 --- a/node_modules/d3-interpolate/src/round.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(a, b) { - return a = +a, b = +b, function(t) { - return Math.round(a * (1 - t) + b * t); - }; -} diff --git a/node_modules/d3-interpolate/src/string.js b/node_modules/d3-interpolate/src/string.js deleted file mode 100644 index 7f04d2d..0000000 --- a/node_modules/d3-interpolate/src/string.js +++ /dev/null @@ -1,64 +0,0 @@ -import number from "./number.js"; - -var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, - reB = new RegExp(reA.source, "g"); - -function zero(b) { - return function() { - return b; - }; -} - -function one(b) { - return function(t) { - return b(t) + ""; - }; -} - -export default function(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 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 = -1, // index in s - s = [], // string constants and placeholders - q = []; // number interpolators - - // Coerce inputs to strings. - a = a + "", b = b + ""; - - // Interpolate pairs of numbers in a & b. - while ((am = reA.exec(a)) - && (bm = reB.exec(b))) { - if ((bs = bm.index) > bi) { // a string precedes the next number in b - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; - } else { // interpolate non-matching numbers - s[++i] = null; - q.push({i: i, x: number(am, bm)}); - } - bi = reB.lastIndex; - } - - // Add remains of b. - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = 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 = q.length, function(t) { - for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }); -} diff --git a/node_modules/d3-interpolate/src/transform/decompose.js b/node_modules/d3-interpolate/src/transform/decompose.js deleted file mode 100644 index 3535f23..0000000 --- a/node_modules/d3-interpolate/src/transform/decompose.js +++ /dev/null @@ -1,26 +0,0 @@ -var degrees = 180 / Math.PI; - -export var identity = { - translateX: 0, - translateY: 0, - rotate: 0, - skewX: 0, - scaleX: 1, - scaleY: 1 -}; - -export default function(a, b, c, d, e, f) { - var scaleX, scaleY, skewX; - if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - return { - translateX: e, - translateY: f, - rotate: Math.atan2(b, a) * degrees, - skewX: Math.atan(skewX) * degrees, - scaleX: scaleX, - scaleY: scaleY - }; -} diff --git a/node_modules/d3-interpolate/src/transform/index.js b/node_modules/d3-interpolate/src/transform/index.js deleted file mode 100644 index 5383d5f..0000000 --- a/node_modules/d3-interpolate/src/transform/index.js +++ /dev/null @@ -1,63 +0,0 @@ -import number from "../number.js"; -import {parseCss, parseSvg} from "./parse.js"; - -function interpolateTransform(parse, pxComma, pxParen, degParen) { - - function pop(s) { - return s.length ? s.pop() + " " : ""; - } - - function translate(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); - } else if (xb || yb) { - s.push("translate(" + xb + pxComma + yb + pxParen); - } - } - - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path - q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)}); - } else if (b) { - s.push(pop(s) + "rotate(" + b + degParen); - } - } - - function skewX(a, b, s, q) { - if (a !== b) { - q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)}); - } else if (b) { - s.push(pop(s) + "skewX(" + b + degParen); - } - } - - function scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); - } else if (xb !== 1 || yb !== 1) { - s.push(pop(s) + "scale(" + xb + "," + yb + ")"); - } - } - - return function(a, b) { - var s = [], // string constants and placeholders - q = []; // number interpolators - a = parse(a), b = 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 = b = null; // gc - return function(t) { - var i = -1, n = q.length, o; - while (++i < n) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; - }; -} - -export var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); -export var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); diff --git a/node_modules/d3-interpolate/src/transform/parse.js b/node_modules/d3-interpolate/src/transform/parse.js deleted file mode 100644 index ef7b95f..0000000 --- a/node_modules/d3-interpolate/src/transform/parse.js +++ /dev/null @@ -1,25 +0,0 @@ -import decompose, {identity} from "./decompose.js"; - -var cssNode, - cssRoot, - cssView, - svgNode; - -export function parseCss(value) { - if (value === "none") return identity; - if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; - cssNode.style.transform = value; - value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); - cssRoot.removeChild(cssNode); - value = value.slice(7, -1).split(","); - return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); -} - -export function parseSvg(value) { - if (value == null) return identity; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return identity; - value = value.matrix; - return decompose(value.a, value.b, value.c, value.d, value.e, value.f); -} diff --git a/node_modules/d3-interpolate/src/value.js b/node_modules/d3-interpolate/src/value.js deleted file mode 100644 index 6a67ac4..0000000 --- a/node_modules/d3-interpolate/src/value.js +++ /dev/null @@ -1,22 +0,0 @@ -import {color} from "d3-color"; -import rgb from "./rgb.js"; -import {genericArray} from "./array.js"; -import date from "./date.js"; -import number from "./number.js"; -import object from "./object.js"; -import string from "./string.js"; -import constant from "./constant.js"; -import numberArray, {isNumberArray} from "./numberArray.js"; - -export default function(a, b) { - var t = typeof b, c; - return b == null || t === "boolean" ? constant(b) - : (t === "number" ? number - : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string) - : b instanceof color ? rgb - : b instanceof Date ? date - : isNumberArray(b) ? numberArray - : Array.isArray(b) ? genericArray - : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object - : number)(a, b); -} diff --git a/node_modules/d3-interpolate/src/zoom.js b/node_modules/d3-interpolate/src/zoom.js deleted file mode 100644 index 3368b01..0000000 --- a/node_modules/d3-interpolate/src/zoom.js +++ /dev/null @@ -1,64 +0,0 @@ -var rho = Math.SQRT2, - rho2 = 2, - rho4 = 4, - epsilon2 = 1e-12; - -function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; -} - -function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; -} - -function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); -} - -// p0 = [ux0, uy0, w0] -// p1 = [ux1, uy1, w1] -export default function(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], - ux1 = p1[0], uy1 = p1[1], w1 = p1[2], - dx = ux1 - ux0, - dy = uy1 - uy0, - d2 = dx * dx + dy * dy, - i, - S; - - // Special case for u0 ≅ u1. - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; - } - } - - // General case. - else { - var d1 = Math.sqrt(d2), - b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), - b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), - r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), - r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s = t * S, - coshr0 = cosh(r0), - u = 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 = S * 1000; - - return i; -} diff --git a/node_modules/d3-path/LICENSE b/node_modules/d3-path/LICENSE deleted file mode 100644 index 576b910..0000000 --- a/node_modules/d3-path/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2015-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-path/README.md b/node_modules/d3-path/README.md deleted file mode 100644 index b3f8641..0000000 --- a/node_modules/d3-path/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# d3-path - -Say you have some code that draws to a 2D canvas: - -```js -function drawCircle(context, radius) { - context.moveTo(radius, 0); - context.arc(0, 0, radius, 0, 2 * Math.PI); -} -``` - -The d3-path module lets you take this exact code and additionally render to [SVG](http://www.w3.org/TR/SVG/paths.html). It works by [serializing](#path_toString) [CanvasPathMethods](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls to [SVG path data](http://www.w3.org/TR/SVG/paths.html#PathData). For example: - -```js -var context = d3.path(); -drawCircle(context, 40); -pathElement.setAttribute("d", context.toString()); -``` - -Now code you write once can be used with both Canvas (for performance) and SVG (for convenience). For a practical example, see [d3-shape](https://github.com/d3/d3-shape). - -## Installing - -If you use NPM, `npm install d3-path`. Otherwise, download the [latest release](https://github.com/d3/d3-path/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-path.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -## API Reference - -# d3.path() · [Source](https://github.com/d3/d3-path/blob/master/src/path.js), [Examples](https://observablehq.com/@d3/d3-path) - -Constructs a new path serializer that implements [CanvasPathMethods](http://www.w3.org/TR/2dcontext/#canvaspathmethods). - -# path.moveTo(x, y) - -Move to the specified point ⟨*x*, *y*⟩. Equivalent to [*context*.moveTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-moveto) and SVG’s [“moveto” command](http://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands). - -# path.closePath() - -Ends the current subpath and causes an automatic straight line to be drawn from the current point to the initial point of the current subpath. Equivalent to [*context*.closePath](http://www.w3.org/TR/2dcontext/#dom-context-2d-closepath) and SVG’s [“closepath” command](http://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand). - -# path.lineTo(x, y) - -Draws a straight line from the current point to the specified point ⟨*x*, *y*⟩. Equivalent to [*context*.lineTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-lineto) and SVG’s [“lineto” command](http://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands). - -# path.quadraticCurveTo(cpx, cpy, x, y) - -Draws a quadratic Bézier segment from the current point to the specified point ⟨*x*, *y*⟩, with the specified control point ⟨*cpx*, *cpy*⟩. Equivalent to [*context*.quadraticCurveTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-quadraticcurveto) and SVG’s [quadratic Bézier curve commands](http://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands). - -# path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y) - -Draws a cubic Bézier segment from the current point to the specified point ⟨*x*, *y*⟩, with the specified control points ⟨*cpx1*, *cpy1*⟩ and ⟨*cpx2*, *cpy2*⟩. Equivalent to [*context*.bezierCurveTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-beziercurveto) and SVG’s [cubic Bézier curve commands](http://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands). - -# path.arcTo(x1, y1, x2, y2, radius) - -Draws a circular arc segment with the specified *radius* that starts tangent to the line between the current point and the specified point ⟨*x1*, *y1*⟩ and ends tangent to the line between the specified points ⟨*x1*, *y1*⟩ and ⟨*x2*, *y2*⟩. If the first tangent point is not equal to the current point, a straight line is drawn between the current point and the first tangent point. Equivalent to [*context*.arcTo](http://www.w3.org/TR/2dcontext/#dom-context-2d-arcto) and uses SVG’s [elliptical arc curve commands](http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands). - -# path.arc(x, y, radius, startAngle, endAngle[, anticlockwise]) - -Draws a circular arc segment with the specified center ⟨*x*, *y*⟩, *radius*, *startAngle* and *endAngle*. If *anticlockwise* is true, the arc is drawn in the anticlockwise direction; otherwise, it is drawn in the clockwise direction. If the current point is not equal to the starting point of the arc, a straight line is drawn from the current point to the start of the arc. Equivalent to [*context*.arc](http://www.w3.org/TR/2dcontext/#dom-context-2d-arc) and uses SVG’s [elliptical arc curve commands](http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands). - -# path.rect(x, y, w, h) - -Creates a new subpath containing just the four points ⟨*x*, *y*⟩, ⟨*x* + *w*, *y*⟩, ⟨*x* + *w*, *y* + *h*⟩, ⟨*x*, *y* + *h*⟩, with those four points connected by straight lines, and then marks the subpath as closed. Equivalent to [*context*.rect](http://www.w3.org/TR/2dcontext/#dom-context-2d-rect) and uses SVG’s [“lineto” commands](http://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands). - -# path.toString() - -Returns the string representation of this *path* according to SVG’s [path data specification](http://www.w3.org/TR/SVG/paths.html#PathData). diff --git a/node_modules/d3-path/dist/d3-path.js b/node_modules/d3-path/dist/d3-path.js deleted file mode 100644 index 05ac835..0000000 --- a/node_modules/d3-path/dist/d3-path.js +++ /dev/null @@ -1,141 +0,0 @@ -// https://d3js.org/d3-path/ v1.0.9 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -var pi = Math.PI, - tau = 2 * pi, - epsilon = 1e-6, - tauEpsilon = tau - epsilon; - -function Path() { - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - this._ = ""; -} - -function path() { - return new Path; -} - -Path.prototype = path.prototype = { - constructor: Path, - moveTo: function(x, y) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y); - }, - closePath: function() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - }, - lineTo: function(x, y) { - this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y); - }, - quadraticCurveTo: function(x1, y1, x, y) { - this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - bezierCurveTo: function(x1, y1, x2, y2, x, y) { - this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - arcTo: function(x1, y1, x2, y2, r) { - x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; - var x0 = this._x1, - y0 = this._y1, - x21 = x2 - x1, - y21 = y2 - y1, - x01 = x0 - x1, - y01 = y0 - y1, - l01_2 = 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 === null) { - this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1); - } - - // Or, is (x1,y1) coincident with (x0,y0)? Do nothing. - else if (!(l01_2 > epsilon)); - - // 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) || !r) { - this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); - } - - // Otherwise, draw an arc! - else { - var x20 = x2 - x0, - y20 = y2 - y0, - l21_2 = x21 * x21 + y21 * y21, - l20_2 = x20 * x20 + y20 * y20, - l21 = Math.sqrt(l21_2), - l01 = Math.sqrt(l01_2), - l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), - t01 = l / l01, - t21 = l / l21; - - // If the start tangent is not coincident with (x0,y0), line to. - if (Math.abs(t01 - 1) > epsilon) { - this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); - } - - this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21); - } - }, - arc: function(x, y, r, a0, a1, ccw) { - x = +x, y = +y, r = +r, ccw = !!ccw; - var dx = r * Math.cos(a0), - dy = r * Math.sin(a0), - x0 = x + dx, - y0 = y + dy, - cw = 1 ^ ccw, - da = 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 === null) { - this._ += "M" + x0 + "," + y0; - } - - // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0). - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) { - this._ += "L" + x0 + "," + y0; - } - - // Is this arc empty? We’re done. - if (!r) return; - - // Does the angle go the wrong way? Flip the direction. - if (da < 0) da = da % tau + tau; - - // Is this a complete circle? Draw two arcs to complete the circle. - if (da > tauEpsilon) { - this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0); - } - - // Is this arc non-empty? Draw an arc! - else if (da > epsilon) { - this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1)); - } - }, - rect: function(x, y, w, h) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z"; - }, - toString: function() { - return this._; - } -}; - -exports.path = path; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-path/dist/d3-path.min.js b/node_modules/d3-path/dist/d3-path.min.js deleted file mode 100644 index 6292a7b..0000000 --- a/node_modules/d3-path/dist/d3-path.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-path/ v1.0.9 Copyright 2019 Mike Bostock -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";var i=Math.PI,s=2*i,h=s-1e-6;function e(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function _(){return new e}e.prototype=_.prototype={constructor:e,moveTo:function(t,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,i){this._+="L"+(this._x1=+t)+","+(this._y1=+i)},quadraticCurveTo:function(t,i,s,h){this._+="Q"+ +t+","+ +i+","+(this._x1=+s)+","+(this._y1=+h)},bezierCurveTo:function(t,i,s,h,e,_){this._+="C"+ +t+","+ +i+","+ +s+","+ +h+","+(this._x1=+e)+","+(this._y1=+_)},arcTo:function(t,s,h,e,_){t=+t,s=+s,h=+h,e=+e,_=+_;var n=this._x1,o=this._y1,r=h-t,a=e-s,u=n-t,f=o-s,c=u*u+f*f;if(_<0)throw new Error("negative radius: "+_);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=s);else if(c>1e-6)if(Math.abs(f*r-a*u)>1e-6&&_){var x=h-n,y=e-o,M=r*r+a*a,l=x*x+y*y,d=Math.sqrt(M),p=Math.sqrt(c),v=_*Math.tan((i-Math.acos((M+c-l)/(2*d*p)))/2),b=v/p,w=v/d;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*u)+","+(s+b*f)),this._+="A"+_+","+_+",0,0,"+ +(f*x>u*y)+","+(this._x1=t+w*r)+","+(this._y1=s+w*a)}else this._+="L"+(this._x1=t)+","+(this._y1=s);else;},arc:function(t,e,_,n,o,r){t=+t,e=+e,r=!!r;var a=(_=+_)*Math.cos(n),u=_*Math.sin(n),f=t+a,c=e+u,x=1^r,y=r?n-o:o-n;if(_<0)throw new Error("negative radius: "+_);null===this._x1?this._+="M"+f+","+c:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-c)>1e-6)&&(this._+="L"+f+","+c),_&&(y<0&&(y=y%s+s),y>h?this._+="A"+_+","+_+",0,1,"+x+","+(t-a)+","+(e-u)+"A"+_+","+_+",0,1,"+x+","+(this._x1=f)+","+(this._y1=c):y>1e-6&&(this._+="A"+_+","+_+",0,"+ +(y>=i)+","+x+","+(this._x1=t+_*Math.cos(o))+","+(this._y1=e+_*Math.sin(o))))},rect:function(t,i,s,h){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)+"h"+ +s+"v"+ +h+"h"+-s+"Z"},toString:function(){return this._}},t.path=_,Object.defineProperty(t,"__esModule",{value:!0})}); diff --git a/node_modules/d3-path/package.json b/node_modules/d3-path/package.json deleted file mode 100644 index 4633e6b..0000000 --- a/node_modules/d3-path/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "_from": "d3-path@^1.0.9", - "_id": "d3-path@1.0.9", - "_inBundle": false, - "_integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==", - "_location": "/d3-path", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "d3-path@^1.0.9", - "name": "d3-path", - "escapedName": "d3-path", - "rawSpec": "^1.0.9", - "saveSpec": null, - "fetchSpec": "^1.0.9" - }, - "_requiredBy": [ - "/d3-shape", - "/vega-scenegraph" - ], - "_resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz", - "_shasum": "48c050bb1fe8c262493a8caf5524e3e9591701cf", - "_spec": "d3-path@^1.0.9", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-scenegraph", - "author": { - "name": "Mike Bostock", - "url": "http://bost.ocks.org/mike" - }, - "bugs": { - "url": "https://github.com/d3/d3-path/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Serialize Canvas path commands to SVG.", - "devDependencies": { - "eslint": "6", - "rollup": "1", - "rollup-plugin-terser": "5", - "tape": "4" - }, - "files": [ - "dist/**/*.js", - "src/**/*.js" - ], - "homepage": "https://d3js.org/d3-path/", - "jsdelivr": "dist/d3-path.min.js", - "keywords": [ - "d3", - "d3-module", - "canvas", - "path", - "svg", - "graphics", - "CanvasRenderingContext2D", - "CanvasPathMethods", - "Path2D" - ], - "license": "BSD-3-Clause", - "main": "dist/d3-path.js", - "module": "src/index.js", - "name": "d3-path", - "repository": { - "type": "git", - "url": "git+https://github.com/d3/d3-path.git" - }, - "scripts": { - "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js", - "prepublishOnly": "rm -rf dist && yarn test", - "pretest": "rollup -c", - "test": "tape 'test/**/*-test.js' && eslint src test" - }, - "sideEffects": false, - "unpkg": "dist/d3-path.min.js", - "version": "1.0.9" -} diff --git a/node_modules/d3-path/src/index.js b/node_modules/d3-path/src/index.js deleted file mode 100644 index 968e6e5..0000000 --- a/node_modules/d3-path/src/index.js +++ /dev/null @@ -1 +0,0 @@ -export {default as path} from "./path.js"; diff --git a/node_modules/d3-path/src/path.js b/node_modules/d3-path/src/path.js deleted file mode 100644 index b10ba9e..0000000 --- a/node_modules/d3-path/src/path.js +++ /dev/null @@ -1,130 +0,0 @@ -var pi = Math.PI, - tau = 2 * pi, - epsilon = 1e-6, - tauEpsilon = tau - epsilon; - -function Path() { - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - this._ = ""; -} - -function path() { - return new Path; -} - -Path.prototype = path.prototype = { - constructor: Path, - moveTo: function(x, y) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y); - }, - closePath: function() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - }, - lineTo: function(x, y) { - this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y); - }, - quadraticCurveTo: function(x1, y1, x, y) { - this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - bezierCurveTo: function(x1, y1, x2, y2, x, y) { - this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - arcTo: function(x1, y1, x2, y2, r) { - x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; - var x0 = this._x1, - y0 = this._y1, - x21 = x2 - x1, - y21 = y2 - y1, - x01 = x0 - x1, - y01 = y0 - y1, - l01_2 = 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 === null) { - this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1); - } - - // Or, is (x1,y1) coincident with (x0,y0)? Do nothing. - else if (!(l01_2 > epsilon)); - - // 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) || !r) { - this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); - } - - // Otherwise, draw an arc! - else { - var x20 = x2 - x0, - y20 = y2 - y0, - l21_2 = x21 * x21 + y21 * y21, - l20_2 = x20 * x20 + y20 * y20, - l21 = Math.sqrt(l21_2), - l01 = Math.sqrt(l01_2), - l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), - t01 = l / l01, - t21 = l / l21; - - // If the start tangent is not coincident with (x0,y0), line to. - if (Math.abs(t01 - 1) > epsilon) { - this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); - } - - this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21); - } - }, - arc: function(x, y, r, a0, a1, ccw) { - x = +x, y = +y, r = +r, ccw = !!ccw; - var dx = r * Math.cos(a0), - dy = r * Math.sin(a0), - x0 = x + dx, - y0 = y + dy, - cw = 1 ^ ccw, - da = 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 === null) { - this._ += "M" + x0 + "," + y0; - } - - // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0). - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) { - this._ += "L" + x0 + "," + y0; - } - - // Is this arc empty? We’re done. - if (!r) return; - - // Does the angle go the wrong way? Flip the direction. - if (da < 0) da = da % tau + tau; - - // Is this a complete circle? Draw two arcs to complete the circle. - if (da > tauEpsilon) { - this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0); - } - - // Is this arc non-empty? Draw an arc! - else if (da > epsilon) { - this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1)); - } - }, - rect: function(x, y, w, h) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z"; - }, - toString: function() { - return this._; - } -}; - -export default path; diff --git a/node_modules/d3-quadtree/LICENSE b/node_modules/d3-quadtree/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-quadtree/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-quadtree/README.md b/node_modules/d3-quadtree/README.md deleted file mode 100644 index 05692ff..0000000 --- a/node_modules/d3-quadtree/README.md +++ /dev/null @@ -1,163 +0,0 @@ -# d3-quadtree - -A [quadtree](https://en.wikipedia.org/wiki/Quadtree) recursively partitions two-dimensional space into squares, dividing each square into four equally-sized squares. Each distinct point exists in a unique leaf [node](#nodes); coincident points are represented by a linked list. Quadtrees can accelerate various spatial operations, such as the [Barnes–Hut approximation](https://en.wikipedia.org/wiki/Barnes–Hut_simulation) for computing many-body forces, collision detection, and searching for nearby points. - - - - -## Installing - -If you use NPM, `npm install d3-quadtree`. Otherwise, download the [latest release](https://github.com/d3/d3-quadtree/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-quadtree.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -## API Reference - -# d3.quadtree([data[, x, y]]) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/quadtree.js "Source") - -Creates a new, empty quadtree with an empty [extent](#quadtree_extent) and the default [*x*-](#quadtree_x) and [*y*-](#quadtree_y)accessors. If *data* is specified, [adds](#quadtree_addAll) the specified array of data to the quadtree. This is equivalent to: - -```js -var tree = d3.quadtree() - .addAll(data); -``` - -If *x* and *y* are also specified, sets the [*x*-](#quadtree_x) and [*y*-](#quadtree_y) accessors to the specified functions before adding the specified array of data to the quadtree, equivalent to: - -```js -var tree = d3.quadtree() - .x(x) - .y(y) - .addAll(data); -``` - -# quadtree.x([x]) [<>](https://github.com/d3/d3-quadtree/blob/master/src/x.js "Source") - -If *x* is specified, sets the current *x*-coordinate accessor and returns the quadtree. If *x* is not specified, returns the current *x*-accessor, which defaults to: - -```js -function x(d) { - return d[0]; -} -``` - -The *x*-acccessor is used to derive the *x*-coordinate of data when [adding](#quadtree_add) to and [removing](#quadtree_remove) from the tree. It is also used when [finding](#quadtree_find) to re-access the coordinates of data previously added to the tree; therefore, the *x*- and *y*-accessors must be consistent, returning the same value given the same input. - -# quadtree.y([y]) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/y.js "Source") - -If *y* is specified, sets the current *y*-coordinate accessor and returns the quadtree. If *y* is not specified, returns the current *y*-accessor, which defaults to: - -```js -function y(d) { - return d[1]; -} -``` - -The *y*-acccessor is used to derive the *y*-coordinate of data when [adding](#quadtree_add) to and [removing](#quadtree_remove) from the tree. It is also used when [finding](#quadtree_find) to re-access the coordinates of data previously added to the tree; therefore, the *x*- and *y*-accessors must be consistent, returning the same value given the same input. - -# quadtree.extent([*extent*]) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/extent.js "Source") - -If *extent* is specified, expands the quadtree to [cover](#quadtree_cover) the specified points [[*x0*, *y0*], [*x1*, *y1*]] and returns the quadtree. If *extent* is not specified, returns the quadtree’s current extent [[*x0*, *y0*], [*x1*, *y1*]], where *x0* and *y0* are the inclusive lower bounds and *x1* and *y1* are the inclusive upper bounds, or undefined if the quadtree has no extent. The extent may also be expanded by calling [*quadtree*.cover](#quadtree_cover) or [*quadtree*.add](#quadtree_add). - -# quadtree.cover(x, y) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/cover.js "Source") - -Expands the quadtree to cover the specified point ⟨*x*,*y*⟩, and returns the quadtree. If the quadtree’s extent already covers the specified point, this method does nothing. If the quadtree has an extent, the extent is repeatedly doubled to cover the specified point, wrapping the [root](#quadtree_root) [node](#nodes) as necessary; if the quadtree is empty, the extent is initialized to the extent [[⌊*x*⌋, ⌊*y*⌋], [⌈*x*⌉, ⌈*y*⌉]]. (Rounding is necessary such that if the extent is later doubled, the boundaries of existing quadrants do not change due to floating point error.) - -# quadtree.add(datum) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/add.js "Source") - -Adds the specified *datum* to the quadtree, deriving its coordinates ⟨*x*,*y*⟩ using the current [*x*-](#quadtree_x) and [*y*-](#quadtree_y)accessors, and returns the quadtree. If the new point is outside the current [extent](#quadtree_extent) of the quadtree, the quadtree is automatically expanded to [cover](#quadtree_cover) the new point. - -# quadtree.addAll(data) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/add.js "Source") - -Adds the specified array of *data* to the quadtree, deriving each element’s coordinates ⟨*x*,*y*⟩ using the current [*x*-](#quadtree_x) and [*y*-](#quadtree_y)accessors, and return this quadtree. This is approximately equivalent to calling [*quadtree*.add](#quadtree_add) repeatedly: - -```js -for (var i = 0, n = data.length; i < n; ++i) { - quadtree.add(data[i]); -} -``` - -However, this method results in a more compact quadtree because the extent of the *data* is computed first before adding the data. - -# quadtree.remove(datum) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/remove.js "Source") - -Removes the specified *datum* from the quadtree, deriving its coordinates ⟨*x*,*y*⟩ using the current [*x*-](#quadtree_x) and [*y*-](#quadtree_y)accessors, and returns the quadtree. If the specified *datum* does not exist in this quadtree, this method does nothing. - -# quadtree.removeAll(data) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/remove.js "Source") - -Removes the specified *data* from the quadtree, deriving their coordinates ⟨*x*,*y*⟩ using the current [*x*-](#quadtree_x) and [*y*-](#quadtree_y)accessors, and returns the quadtree. If a specified datum does not exist in this quadtree, it is ignored. - -# quadtree.copy() - -Returns a copy of the quadtree. All [nodes](#nodes) in the returned quadtree are identical copies of the corresponding node in the quadtree; however, any data in the quadtree is shared by reference and not copied. - -# quadtree.root() - [<>](https://github.com/d3/d3-quadtree/blob/master/src/root.js "Source") - -Returns the root [node](#nodes) of the quadtree. - -# quadtree.data() - [<>](https://github.com/d3/d3-quadtree/blob/master/src/data.js "Source") - -Returns an array of all data in the quadtree. - -# quadtree.size() - [<>](https://github.com/d3/d3-quadtree/blob/master/src/size.js "Source") - -Returns the total number of data in the quadtree. - -# quadtree.find(x, y[, radius]) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/find.js "Source") - -Returns the datum closest to the position ⟨*x*,*y*⟩ with the given search *radius*. If *radius* is not specified, it defaults to infinity. If there is no datum within the search area, returns undefined. - -# quadtree.visit(callback) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/visit.js "Source") - -Visits each [node](#nodes) in the quadtree in pre-order traversal, invoking the specified *callback* with arguments *node*, *x0*, *y0*, *x1*, *y1* for each node, where *node* is the node being visited, ⟨*x0*, *y0*⟩ are the lower bounds of the node, and ⟨*x1*, *y1*⟩ are the upper bounds, and returns the quadtree. (Assuming that positive *x* is right and positive *y* is down, as is typically the case in Canvas and SVG, ⟨*x0*, *y0*⟩ is the top-left corner and ⟨*x1*, *y1*⟩ is the lower-right corner; however, the coordinate system is arbitrary, so more formally *x0* <= *x1* and *y0* <= *y1*.) - -If the *callback* returns true for a given node, then the children of that node are not visited; otherwise, all child nodes are visited. This can be used to quickly visit only parts of the tree, for example when using the [Barnes–Hut approximation](https://en.wikipedia.org/wiki/Barnes–Hut_simulation). Note, however, that child quadrants are always visited in sibling order: top-left, top-right, bottom-left, bottom-right. In cases such as [search](#quadtree_find), visiting siblings in a specific order may be faster. - -# quadtree.visitAfter(callback) - [<>](https://github.com/d3/d3-quadtree/blob/master/src/visitAfter.js "Source") - -Visits each [node](#nodes) in the quadtree in post-order traversal, invoking the specified *callback* with arguments *node*, *x0*, *y0*, *x1*, *y1* for each node, where *node* is the node being visited, ⟨*x0*, *y0*⟩ are the lower bounds of the node, and ⟨*x1*, *y1*⟩ are the upper bounds, and returns the quadtree. (Assuming that positive *x* is right and positive *y* is down, as is typically the case in Canvas and SVG, ⟨*x0*, *y0*⟩ is the top-left corner and ⟨*x1*, *y1*⟩ is the lower-right corner; however, the coordinate system is arbitrary, so more formally *x0* <= *x1* and *y0* <= *y1*.) Returns *root*. - -### Nodes - -Internal nodes of the quadtree are represented as four-element arrays in left-to-right, top-to-bottom order: - -* `0` - the top-left quadrant, if any. -* `1` - the top-right quadrant, if any. -* `2` - the bottom-left quadrant, if any. -* `3` - the bottom-right quadrant, if any. - -A child quadrant may be undefined if it is empty. - -Leaf nodes are represented as objects with the following properties: - -* `data` - the data associated with this point, as passed to [*quadtree*.add](#quadtree_add). -* `next` - the next datum in this leaf, if any. - -The `length` property may be used to distinguish leaf nodes from internal nodes: it is undefined for leaf nodes, and 4 for internal nodes. For example, to iterate over all data in a leaf node: - -```js -if (!node.length) do console.log(node.data); while (node = node.next); -``` - -The point’s *x*- and *y*-coordinates **must not be modified** while the point is in the quadtree. To update a point’s position, [remove](#quadtree_remove) the point and then re-[add](#quadtree_add) it to the quadtree at the new position. Alternatively, you may discard the existing quadtree entirely and create a new one from scratch; this may be more efficient if many of the points have moved. diff --git a/node_modules/d3-quadtree/dist/d3-quadtree.js b/node_modules/d3-quadtree/dist/d3-quadtree.js deleted file mode 100644 index 02b9a00..0000000 --- a/node_modules/d3-quadtree/dist/d3-quadtree.js +++ /dev/null @@ -1,419 +0,0 @@ -// https://d3js.org/d3-quadtree/ v1.0.7 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -function tree_add(d) { - var x = +this._x.call(null, d), - y = +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 = tree._root, - leaf = {data: d}, - x0 = tree._x0, - y0 = tree._y0, - x1 = tree._x1, - y1 = 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 = leaf, tree; - - // Find the existing leaf for the new point, or add it. - while (node.length) { - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; - } - - // Is the new point is exactly coincident with the existing point? - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; - - // Otherwise, split the leaf node until the old and new point are separated. - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm))); - return parent[j] = node, parent[i] = leaf, tree; -} - -function addAll(data) { - var d, i, n = data.length, - x, - y, - xz = new Array(n), - yz = new Array(n), - x0 = Infinity, - y0 = Infinity, - x1 = -Infinity, - y1 = -Infinity; - - // Compute the points and their extent. - for (i = 0; i < n; ++i) { - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; - xz[i] = x; - yz[i] = y; - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = 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 = 0; i < n; ++i) { - add(this, xz[i], yz[i], data[i]); - } - - return this; -} - -function tree_cover(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points - - var x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = 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’t change due to floating point error! - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; - } - - // Otherwise, double repeatedly to cover. - else { - var z = x1 - x0, - node = this._root, - parent, - i; - - while (x0 > x || x >= x1 || y0 > y || y >= y1) { - i = (y < y0) << 1 | (x < x0); - parent = new Array(4), parent[i] = node, node = parent, z *= 2; - switch (i) { - case 0: x1 = x0 + z, y1 = y0 + z; break; - case 1: x0 = x1 - z, y1 = y0 + z; break; - case 2: x1 = x0 + z, y0 = y1 - z; break; - case 3: x0 = x1 - z, y0 = y1 - z; break; - } - } - - if (this._root && this._root.length) this._root = node; - } - - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; -} - -function tree_data() { - var data = []; - this.visit(function(node) { - if (!node.length) do data.push(node.data); while (node = 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, this._y1]]; -} - -function Quad(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; -} - -function tree_find(x, y, radius) { - var data, - x0 = this._x0, - y0 = this._y0, - x1, - y1, - x2, - y2, - x3 = this._x1, - y3 = this._y1, - quads = [], - node = this._root, - q, - i; - - if (node) quads.push(new Quad(node, x0, y0, x3, y3)); - if (radius == null) radius = Infinity; - else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; - } - - while (q = quads.pop()) { - - // Stop searching if this quadrant can’t contain a closer node. - if (!(node = q.node) - || (x1 = q.x0) > x3 - || (y1 = q.y0) > y3 - || (x2 = q.x1) < x0 - || (y2 = q.y1) < y0) continue; - - // Bisect the current quadrant. - if (node.length) { - var xm = (x1 + x2) / 2, - ym = (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 = (y >= ym) << 1 | (x >= xm)) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; - } - } - - // Visit this point. (Visiting coincident points isn’t necessary!) - else { - var dx = x - +this._x.call(null, node.data), - dy = y - +this._y.call(null, node.data), - d2 = dx * dx + dy * dy; - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } - } - - return data; -} - -function tree_remove(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points - - var parent, - node = this._root, - retainer, - previous, - next, - x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = 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 sibling. - if (node.length) while (true) { - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) return this; - if (!node.length) break; - if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i; - } - - // Find the point to remove. - while (node.data !== d) if (!(previous = node, node = node.next)) return this; - if (next = node.next) delete node.next; - - // If there are multiple coincident points, remove just the point. - if (previous) return (next ? previous.next = next : delete previous.next), this; - - // If this is the root point, remove it. - if (!parent) return this._root = next, this; - - // Remove this leaf. - next ? parent[i] = next : delete parent[i]; - - // If the parent now contains exactly one leaf, collapse superfluous parents. - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) - && node === (parent[3] || parent[2] || parent[1] || parent[0]) - && !node.length) { - if (retainer) retainer[j] = node; - else this._root = node; - } - - return this; -} - -function removeAll(data) { - for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]); - return this; -} - -function tree_root() { - return this._root; -} - -function tree_size() { - var size = 0; - this.visit(function(node) { - if (!node.length) do ++size; while (node = node.next) - }); - return size; -} - -function tree_visit(callback) { - var quads = [], q, node = this._root, child, x0, y0, x1, y1; - if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); - } - } - return this; -} - -function tree_visitAfter(callback) { - var quads = [], next = [], q; - if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - var node = q.node; - if (node.length) { - var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); - } - next.push(q); - } - while (q = next.pop()) { - callback(q.node, q.x0, q.y0, q.x1, q.y1); - } - return this; -} - -function defaultX(d) { - return d[0]; -} - -function tree_x(_) { - return arguments.length ? (this._x = _, this) : this._x; -} - -function defaultY(d) { - return d[1]; -} - -function tree_y(_) { - return arguments.length ? (this._y = _, this) : this._y; -} - -function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); -} - -function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = undefined; -} - -function leaf_copy(leaf) { - var copy = {data: leaf.data}, next = copy; - while (leaf = leaf.next) next = next.next = {data: leaf.data}; - return copy; -} - -var treeProto = quadtree.prototype = Quadtree.prototype; - -treeProto.copy = function() { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), - node = this._root, - nodes, - child; - - if (!node) return copy; - - if (!node.length) return copy._root = leaf_copy(node), copy; - - nodes = [{source: node, target: copy._root = new Array(4)}]; - while (node = nodes.pop()) { - for (var i = 0; i < 4; ++i) { - if (child = node.source[i]) { - if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)}); - else node.target[i] = leaf_copy(child); - } - } - } - - return copy; -}; - -treeProto.add = tree_add; -treeProto.addAll = addAll; -treeProto.cover = tree_cover; -treeProto.data = tree_data; -treeProto.extent = tree_extent; -treeProto.find = tree_find; -treeProto.remove = tree_remove; -treeProto.removeAll = removeAll; -treeProto.root = tree_root; -treeProto.size = tree_size; -treeProto.visit = tree_visit; -treeProto.visitAfter = tree_visitAfter; -treeProto.x = tree_x; -treeProto.y = tree_y; - -exports.quadtree = quadtree; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-quadtree/dist/d3-quadtree.min.js b/node_modules/d3-quadtree/dist/d3-quadtree.min.js deleted file mode 100644 index dae056b..0000000 --- a/node_modules/d3-quadtree/dist/d3-quadtree.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-quadtree/ v1.0.7 Copyright 2019 Mike Bostock -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";function i(t,i,r,e){if(isNaN(i)||isNaN(r))return t;var n,s,h,o,a,u,l,_,f,c=t._root,x={data:e},y=t._x0,d=t._y0,v=t._x1,p=t._y1;if(!c)return t._root=x,t;for(;c.length;)if((u=i>=(s=(y+v)/2))?y=s:v=s,(l=r>=(h=(d+p)/2))?d=h:p=h,n=c,!(c=c[_=l<<1|u]))return n[_]=x,t;if(o=+t._x.call(null,c.data),a=+t._y.call(null,c.data),i===o&&r===a)return x.next=c,n?n[_]=x:t._root=x,t;do{n=n?n[_]=new Array(4):t._root=new Array(4),(u=i>=(s=(y+v)/2))?y=s:v=s,(l=r>=(h=(d+p)/2))?d=h:p=h}while((_=l<<1|u)==(f=(a>=h)<<1|o>=s));return n[f]=c,n[_]=x,t}function r(t,i,r,e,n){this.node=t,this.x0=i,this.y0=r,this.x1=e,this.y1=n}function e(t){return t[0]}function n(t){return t[1]}function s(t,i,r){var s=new h(null==i?e:i,null==r?n:r,NaN,NaN,NaN,NaN);return null==t?s:s.addAll(t)}function h(t,i,r,e,n,s){this._x=t,this._y=i,this._x0=r,this._y0=e,this._x1=n,this._y1=s,this._root=void 0}function o(t){for(var i={data:t.data},r=i;t=t.next;)r=r.next={data:t.data};return i}var a=s.prototype=h.prototype;a.copy=function(){var t,i,r=new h(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root;if(!e)return r;if(!e.length)return r._root=o(e),r;for(t=[{source:e,target:r._root=new Array(4)}];e=t.pop();)for(var n=0;n<4;++n)(i=e.source[n])&&(i.length?t.push({source:i,target:e.target[n]=new Array(4)}):e.target[n]=o(i));return r},a.add=function(t){var r=+this._x.call(null,t),e=+this._y.call(null,t);return i(this.cover(r,e),r,e,t)},a.addAll=function(t){var r,e,n,s,h=t.length,o=new Array(h),a=new Array(h),u=1/0,l=1/0,_=-1/0,f=-1/0;for(e=0;e_&&(_=n),sf&&(f=s));if(u>_||l>f)return this;for(this.cover(u,l).cover(_,f),e=0;et||t>=n||e>i||i>=s;)switch(o=(ic||(h=u.y0)>x||(o=u.x1)<_||(a=u.y1)=p)<<1|t>=v)&&(u=y[y.length-1],y[y.length-1]=y[y.length-1-l],y[y.length-1-l]=u)}else{var w=t-+this._x.call(null,d.data),N=i-+this._y.call(null,d.data),g=w*w+N*N;if(g=(o=(x+d)/2))?x=o:d=o,(l=h>=(a=(y+v)/2))?y=a:v=a,i=c,!(c=c[_=l<<1|u]))return this;if(!c.length)break;(i[_+1&3]||i[_+2&3]||i[_+3&3])&&(r=i,f=_)}for(;c.data!==t;)if(e=c,!(c=c.next))return this;return(n=c.next)&&delete c.next,e?(n?e.next=n:delete e.next,this):i?(n?i[_]=n:delete i[_],(c=i[0]||i[1]||i[2]||i[3])&&c===(i[3]||i[2]||i[1]||i[0])&&!c.length&&(r?r[f]=c:this._root=c),this):(this._root=n,this)},a.removeAll=function(t){for(var i=0,r=t.length;i= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; - } - - // Is the new point is exactly coincident with the existing point? - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; - - // Otherwise, split the leaf node until the old and new point are separated. - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm))); - return parent[j] = node, parent[i] = leaf, tree; -} - -export function addAll(data) { - var d, i, n = data.length, - x, - y, - xz = new Array(n), - yz = new Array(n), - x0 = Infinity, - y0 = Infinity, - x1 = -Infinity, - y1 = -Infinity; - - // Compute the points and their extent. - for (i = 0; i < n; ++i) { - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; - xz[i] = x; - yz[i] = y; - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = 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 = 0; i < n; ++i) { - add(this, xz[i], yz[i], data[i]); - } - - return this; -} diff --git a/node_modules/d3-quadtree/src/cover.js b/node_modules/d3-quadtree/src/cover.js deleted file mode 100644 index a981a3d..0000000 --- a/node_modules/d3-quadtree/src/cover.js +++ /dev/null @@ -1,43 +0,0 @@ -export default function(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points - - var x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = 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’t change due to floating point error! - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; - } - - // Otherwise, double repeatedly to cover. - else { - var z = x1 - x0, - node = this._root, - parent, - i; - - while (x0 > x || x >= x1 || y0 > y || y >= y1) { - i = (y < y0) << 1 | (x < x0); - parent = new Array(4), parent[i] = node, node = parent, z *= 2; - switch (i) { - case 0: x1 = x0 + z, y1 = y0 + z; break; - case 1: x0 = x1 - z, y1 = y0 + z; break; - case 2: x1 = x0 + z, y0 = y1 - z; break; - case 3: x0 = x1 - z, y0 = y1 - z; break; - } - } - - if (this._root && this._root.length) this._root = node; - } - - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; -} diff --git a/node_modules/d3-quadtree/src/data.js b/node_modules/d3-quadtree/src/data.js deleted file mode 100644 index e934fa9..0000000 --- a/node_modules/d3-quadtree/src/data.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function() { - var data = []; - this.visit(function(node) { - if (!node.length) do data.push(node.data); while (node = node.next) - }); - return data; -} diff --git a/node_modules/d3-quadtree/src/extent.js b/node_modules/d3-quadtree/src/extent.js deleted file mode 100644 index 9e65a90..0000000 --- a/node_modules/d3-quadtree/src/extent.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(_) { - return arguments.length - ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) - : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]]; -} diff --git a/node_modules/d3-quadtree/src/find.js b/node_modules/d3-quadtree/src/find.js deleted file mode 100644 index e9db6c4..0000000 --- a/node_modules/d3-quadtree/src/find.js +++ /dev/null @@ -1,70 +0,0 @@ -import Quad from "./quad.js"; - -export default function(x, y, radius) { - var data, - x0 = this._x0, - y0 = this._y0, - x1, - y1, - x2, - y2, - x3 = this._x1, - y3 = this._y1, - quads = [], - node = this._root, - q, - i; - - if (node) quads.push(new Quad(node, x0, y0, x3, y3)); - if (radius == null) radius = Infinity; - else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; - } - - while (q = quads.pop()) { - - // Stop searching if this quadrant can’t contain a closer node. - if (!(node = q.node) - || (x1 = q.x0) > x3 - || (y1 = q.y0) > y3 - || (x2 = q.x1) < x0 - || (y2 = q.y1) < y0) continue; - - // Bisect the current quadrant. - if (node.length) { - var xm = (x1 + x2) / 2, - ym = (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 = (y >= ym) << 1 | (x >= xm)) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; - } - } - - // Visit this point. (Visiting coincident points isn’t necessary!) - else { - var dx = x - +this._x.call(null, node.data), - dy = y - +this._y.call(null, node.data), - d2 = dx * dx + dy * dy; - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } - } - - return data; -} diff --git a/node_modules/d3-quadtree/src/index.js b/node_modules/d3-quadtree/src/index.js deleted file mode 100644 index e2b2c31..0000000 --- a/node_modules/d3-quadtree/src/index.js +++ /dev/null @@ -1 +0,0 @@ -export {default as quadtree} from "./quadtree.js"; diff --git a/node_modules/d3-quadtree/src/quad.js b/node_modules/d3-quadtree/src/quad.js deleted file mode 100644 index 6f714db..0000000 --- a/node_modules/d3-quadtree/src/quad.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; -} diff --git a/node_modules/d3-quadtree/src/quadtree.js b/node_modules/d3-quadtree/src/quadtree.js deleted file mode 100644 index 5d58593..0000000 --- a/node_modules/d3-quadtree/src/quadtree.js +++ /dev/null @@ -1,73 +0,0 @@ -import tree_add, {addAll as tree_addAll} from "./add.js"; -import tree_cover from "./cover.js"; -import tree_data from "./data.js"; -import tree_extent from "./extent.js"; -import tree_find from "./find.js"; -import tree_remove, {removeAll as tree_removeAll} from "./remove.js"; -import tree_root from "./root.js"; -import tree_size from "./size.js"; -import tree_visit from "./visit.js"; -import tree_visitAfter from "./visitAfter.js"; -import tree_x, {defaultX} from "./x.js"; -import tree_y, {defaultY} from "./y.js"; - -export default function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); -} - -function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = undefined; -} - -function leaf_copy(leaf) { - var copy = {data: leaf.data}, next = copy; - while (leaf = leaf.next) next = next.next = {data: leaf.data}; - return copy; -} - -var treeProto = quadtree.prototype = Quadtree.prototype; - -treeProto.copy = function() { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), - node = this._root, - nodes, - child; - - if (!node) return copy; - - if (!node.length) return copy._root = leaf_copy(node), copy; - - nodes = [{source: node, target: copy._root = new Array(4)}]; - while (node = nodes.pop()) { - for (var i = 0; i < 4; ++i) { - if (child = node.source[i]) { - if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)}); - else node.target[i] = leaf_copy(child); - } - } - } - - return copy; -}; - -treeProto.add = tree_add; -treeProto.addAll = tree_addAll; -treeProto.cover = tree_cover; -treeProto.data = tree_data; -treeProto.extent = tree_extent; -treeProto.find = tree_find; -treeProto.remove = tree_remove; -treeProto.removeAll = tree_removeAll; -treeProto.root = tree_root; -treeProto.size = tree_size; -treeProto.visit = tree_visit; -treeProto.visitAfter = tree_visitAfter; -treeProto.x = tree_x; -treeProto.y = tree_y; diff --git a/node_modules/d3-quadtree/src/remove.js b/node_modules/d3-quadtree/src/remove.js deleted file mode 100644 index 0ba27ab..0000000 --- a/node_modules/d3-quadtree/src/remove.js +++ /dev/null @@ -1,62 +0,0 @@ -export default function(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points - - var parent, - node = this._root, - retainer, - previous, - next, - x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = 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 sibling. - if (node.length) while (true) { - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) return this; - if (!node.length) break; - if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i; - } - - // Find the point to remove. - while (node.data !== d) if (!(previous = node, node = node.next)) return this; - if (next = node.next) delete node.next; - - // If there are multiple coincident points, remove just the point. - if (previous) return (next ? previous.next = next : delete previous.next), this; - - // If this is the root point, remove it. - if (!parent) return this._root = next, this; - - // Remove this leaf. - next ? parent[i] = next : delete parent[i]; - - // If the parent now contains exactly one leaf, collapse superfluous parents. - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) - && node === (parent[3] || parent[2] || parent[1] || parent[0]) - && !node.length) { - if (retainer) retainer[j] = node; - else this._root = node; - } - - return this; -} - -export function removeAll(data) { - for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]); - return this; -} diff --git a/node_modules/d3-quadtree/src/root.js b/node_modules/d3-quadtree/src/root.js deleted file mode 100644 index c32889f..0000000 --- a/node_modules/d3-quadtree/src/root.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function() { - return this._root; -} diff --git a/node_modules/d3-quadtree/src/size.js b/node_modules/d3-quadtree/src/size.js deleted file mode 100644 index d2d5ab6..0000000 --- a/node_modules/d3-quadtree/src/size.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function() { - var size = 0; - this.visit(function(node) { - if (!node.length) do ++size; while (node = node.next) - }); - return size; -} diff --git a/node_modules/d3-quadtree/src/visit.js b/node_modules/d3-quadtree/src/visit.js deleted file mode 100644 index 941ab88..0000000 --- a/node_modules/d3-quadtree/src/visit.js +++ /dev/null @@ -1,16 +0,0 @@ -import Quad from "./quad.js"; - -export default function(callback) { - var quads = [], q, node = this._root, child, x0, y0, x1, y1; - if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); - } - } - return this; -} diff --git a/node_modules/d3-quadtree/src/visitAfter.js b/node_modules/d3-quadtree/src/visitAfter.js deleted file mode 100644 index 2096655..0000000 --- a/node_modules/d3-quadtree/src/visitAfter.js +++ /dev/null @@ -1,21 +0,0 @@ -import Quad from "./quad.js"; - -export default function(callback) { - var quads = [], next = [], q; - if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - var node = q.node; - if (node.length) { - var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); - } - next.push(q); - } - while (q = next.pop()) { - callback(q.node, q.x0, q.y0, q.x1, q.y1); - } - return this; -} diff --git a/node_modules/d3-quadtree/src/x.js b/node_modules/d3-quadtree/src/x.js deleted file mode 100644 index ffea507..0000000 --- a/node_modules/d3-quadtree/src/x.js +++ /dev/null @@ -1,7 +0,0 @@ -export function defaultX(d) { - return d[0]; -} - -export default function(_) { - return arguments.length ? (this._x = _, this) : this._x; -} diff --git a/node_modules/d3-quadtree/src/y.js b/node_modules/d3-quadtree/src/y.js deleted file mode 100644 index d2d29cb..0000000 --- a/node_modules/d3-quadtree/src/y.js +++ /dev/null @@ -1,7 +0,0 @@ -export function defaultY(d) { - return d[1]; -} - -export default function(_) { - return arguments.length ? (this._y = _, this) : this._y; -} diff --git a/node_modules/d3-scale/LICENSE b/node_modules/d3-scale/LICENSE deleted file mode 100644 index 4f0b022..0000000 --- a/node_modules/d3-scale/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2015 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-scale/README.md b/node_modules/d3-scale/README.md deleted file mode 100644 index 0dc694b..0000000 --- a/node_modules/d3-scale/README.md +++ /dev/null @@ -1,983 +0,0 @@ -# d3-scale - -Scales are a convenient abstraction for a fundamental task in visualization: mapping a dimension of abstract data to a visual representation. Although most often used for position-encoding quantitative data, such as mapping a measurement in meters to a position in pixels for dots in a scatterplot, scales can represent virtually any visual encoding, such as diverging colors, stroke widths, or symbol size. Scales can also be used with virtually any type of data, such as named categorical data or discrete data that requires sensible breaks. - -For [continuous](#continuous-scales) quantitative data, you typically want a [linear scale](#linear-scales). (For time series data, a [time scale](#time-scales).) If the distribution calls for it, consider transforming data using a [power](#power-scales) or [log](#log-scales) scale. A [quantize scale](#quantize-scales) may aid differentiation by rounding continuous data to a fixed set of discrete values; similarly, a [quantile scale](#quantile-scales) computes quantiles from a sample population, and a [threshold scale](#threshold-scales) allows you to specify arbitrary breaks in continuous data. - -For discrete ordinal (ordered) or categorical (unordered) data, an [ordinal scale](#ordinal-scales) specifies an explicit mapping from a set of data values to a corresponding set of visual attributes (such as colors). The related [band](#band-scales) and [point](#point-scales) scales are useful for position-encoding ordinal data, such as bars in a bar chart or dots in an categorical scatterplot. - -This repository does not provide color schemes; see [d3-scale-chromatic](https://github.com/d3/d3-scale-chromatic) for color schemes designed to work with d3-scale. - -Scales have no intrinsic visual representation. However, most scales can [generate](#continuous_ticks) and [format](#continuous_tickFormat) ticks for reference marks to aid in the construction of axes. - -For a longer introduction, see these recommended tutorials: - -* [Introducing d3-scale](https://medium.com/@mbostock/introducing-d3-scale-61980c51545f) by Mike Bostock - -* Chapter 7. Scales of [*Interactive Data Visualization for the Web*](http://alignedleft.com/work/d3-book) by Scott Murray - -* [d3: scales, and color.](http://www.jeromecukier.net/2011/08/11/d3-scales-and-color/) by Jérôme Cukier - -## Installing - -If you use NPM, `npm install d3-scale`. Otherwise, download the [latest release](https://github.com/d3/d3-scale/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-scale.v3.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - - - - - - - -``` - -(You can omit d3-time and d3-time-format if you’re not using [d3.scaleTime](#scaleTime) or [d3.scaleUtc](#scaleUtc).) - -## API Reference - -* [Continuous](#continuous-scales) ([Linear](#linear-scales), [Power](#power-scales), [Log](#log-scales), [Identity](#identity-scales), [Time](#time-scales), [Radial](#radial-scales)) -* [Sequential](#sequential-scales) -* [Diverging](#diverging-scales) -* [Quantize](#quantize-scales) -* [Quantile](#quantile-scales) -* [Threshold](#threshold-scales) -* [Ordinal](#ordinal-scales) ([Band](#band-scales), [Point](#point-scales)) - -### Continuous Scales - -Continuous scales map a continuous, quantitative input [domain](#continuous_domain) to a continuous output [range](#continuous_range). If the range is also numeric, the mapping may be [inverted](#continuous_invert). A continuous scale is not constructed directly; instead, try a [linear](#linear-scales), [power](#power-scales), [log](#log-scales), [identity](#identity-scales), [radial](#radial-scales), [time](#time-scales) or [sequential color](#sequential-scales) scale. - -# continuous(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -Given a *value* from the [domain](#continuous_domain), returns the corresponding value from the [range](#continuous_range). If the given *value* is outside the domain, and [clamping](#continuous_clamp) is not enabled, the mapping may be extrapolated such that the returned value is outside the range. For example, to apply a position encoding: - -```js -var x = d3.scaleLinear() - .domain([10, 130]) - .range([0, 960]); - -x(20); // 80 -x(50); // 320 -``` - -Or to apply a color encoding: - -```js -var color = d3.scaleLinear() - .domain([10, 100]) - .range(["brown", "steelblue"]); - -color(20); // "#9a3439" -color(50); // "#7b5167" -``` - -Or, in shorthand: - -```js -var x = d3.scaleLinear([10, 130], [0, 960]); -var color = d3.scaleLinear([10, 100], ["brown", "steelblue"]); -``` - -# continuous.invert(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -Given a *value* from the [range](#continuous_range), returns the corresponding value from the [domain](#continuous_domain). Inversion is useful for interaction, say to determine the data value corresponding to the position of the mouse. For example, to invert a position encoding: - -```js -var x = d3.scaleLinear() - .domain([10, 130]) - .range([0, 960]); - -x.invert(80); // 20 -x.invert(320); // 50 -``` - -If the given *value* is outside the range, and [clamping](#continuous_clamp) is not enabled, the mapping may be extrapolated such that the returned value is outside the domain. This method is only supported if the range is numeric. If the range is not numeric, returns NaN. - -For a valid value *y* in the range, continuous(continuous.invert(y)) approximately equals *y*; similarly, for a valid value *x* in the domain, continuous.invert(continuous(x)) approximately equals *x*. The scale and its inverse may not be exact due to the limitations of floating point precision. - -# continuous.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -If *domain* is specified, sets the scale’s domain to the specified array of numbers. The array must contain two or more elements. If the elements in the given array are not numbers, they will be coerced to numbers. If *domain* is not specified, returns a copy of the scale’s current domain. - -Although continuous scales typically have two values each in their domain and range, specifying more than two values produces a piecewise scale. For example, to create a [diverging color scale](#diverging-scales) that interpolates between white and red for negative values, and white and green for positive values, say: - -```js -var color = d3.scaleLinear() - .domain([-1, 0, 1]) - .range(["red", "white", "green"]); - -color(-0.5); // "rgb(255, 128, 128)" -color(+0.5); // "rgb(128, 192, 128)" -``` - -Internally, a piecewise scale performs a [binary search](https://github.com/d3/d3-array/blob/master/README.md#bisect) for the range interpolator corresponding to the given domain value. Thus, the domain must be in ascending or descending order. If the domain and range have different lengths *N* and *M*, only the first *min(N,M)* elements in each are observed. - -# continuous.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -If *range* is specified, sets the scale’s range to the specified array of values. The array must contain two or more elements. Unlike the [domain](#continuous_domain), elements in the given array need not be numbers; any value that is supported by the underlying [interpolator](#continuous_interpolate) will work, though note that numeric ranges are required for [invert](#continuous_invert). If *range* is not specified, returns a copy of the scale’s current range. See [*continuous*.interpolate](#continuous_interpolate) for more examples. - -# continuous.rangeRound([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -Sets the scale’s [*range*](#continuous_range) to the specified array of values while also setting the scale’s [interpolator](#continuous_interpolate) to [interpolateRound](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolateRound). This is a convenience method equivalent to: - -```js -continuous - .range(range) - .interpolate(d3.interpolateRound); -``` - -The rounding interpolator is sometimes useful for avoiding antialiasing artifacts, though also consider the [shape-rendering](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering) “crispEdges” styles. Note that this interpolator can only be used with numeric ranges. - -# continuous.clamp(clamp) · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -If *clamp* is specified, enables or disables clamping accordingly. If clamping is disabled and the scale is passed a value outside the [domain](#continuous_domain), the scale may return a value outside the [range](#continuous_range) through extrapolation. If clamping is enabled, the return value of the scale is always within the scale’s range. Clamping similarly applies to [*continuous*.invert](#continuous_invert). For example: - -```js -var x = d3.scaleLinear() - .domain([10, 130]) - .range([0, 960]); - -x(-10); // -160, outside range -x.invert(-160); // -10, outside domain - -x.clamp(true); -x(-10); // 0, clamped to range -x.invert(-160); // 10, clamped to domain -``` - -If *clamp* is not specified, returns whether or not the scale currently clamps values to within the range. - -# continuous.unknown([value]) · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -If *value* is specified, sets the output value of the scale for undefined (or NaN) input values and returns this scale. If *value* is not specified, returns the current unknown value, which defaults to undefined. - -# continuous.interpolate(interpolate) · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -If *interpolate* is specified, sets the scale’s [range](#continuous_range) interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; these interpolators then map a normalized domain parameter *t* in [0, 1] to the corresponding value in the range. If *factory* is not specified, returns the scale’s current interpolator factory, which defaults to [d3.interpolate](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate). See [d3-interpolate](https://github.com/d3/d3-interpolate) for more interpolators. - -For example, consider a diverging color scale with three colors in the range: - -```js -var color = d3.scaleLinear() - .domain([-100, 0, +100]) - .range(["red", "white", "green"]); -``` - -Two interpolators are created internally by the scale, equivalent to: - -```js -var i0 = d3.interpolate("red", "white"), - i1 = d3.interpolate("white", "green"); -``` - -A common reason to specify a custom interpolator is to change the color space of interpolation. For example, to use [HCL](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolateHcl): - -```js -var color = d3.scaleLinear() - .domain([10, 100]) - .range(["brown", "steelblue"]) - .interpolate(d3.interpolateHcl); -``` - -Or for [Cubehelix](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolateCubehelix) with a custom gamma: - -```js -var color = d3.scaleLinear() - .domain([10, 100]) - .range(["brown", "steelblue"]) - .interpolate(d3.interpolateCubehelix.gamma(3)); -``` - -Note: the [default interpolator](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate) **may reuse return values**. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. - -# continuous.ticks([count]) - -Returns approximately *count* representative values from the scale’s [domain](#continuous_domain). If *count* is not specified, it defaults to 10. The returned tick values are uniformly spaced, have human-readable values (such as multiples of powers of 10), and are guaranteed to be within the extent of the domain. Ticks are often used to display reference lines, or tick marks, in conjunction with the visualized data. The specified *count* is only a hint; the scale may return more or fewer values depending on the domain. See also d3-array’s [ticks](https://github.com/d3/d3-array/blob/master/README.md#ticks). - -# continuous.tickFormat([count[, specifier]]) · [Source](https://github.com/d3/d3-scale/blob/master/src/tickFormat.js), [Examples](https://observablehq.com/@d3/scale-ticks) - -Returns a [number format](https://github.com/d3/d3-format) function suitable for displaying a tick value, automatically computing the appropriate precision based on the fixed interval between tick values. The specified *count* should have the same value as the count that is used to generate the [tick values](#continuous_ticks). - -An optional *specifier* allows a [custom format](https://github.com/d3/d3-format/blob/master/README.md#locale_format) where the precision of the format is automatically set by the scale as appropriate for the tick interval. For example, to format percentage change, you might say: - -```js -var x = d3.scaleLinear() - .domain([-1, 1]) - .range([0, 960]); - -var ticks = x.ticks(5), - tickFormat = x.tickFormat(5, "+%"); - -ticks.map(tickFormat); // ["-100%", "-50%", "+0%", "+50%", "+100%"] -``` - -If *specifier* uses the format type `s`, the scale will return a [SI-prefix format](https://github.com/d3/d3-format/blob/master/README.md#locale_formatPrefix) based on the largest value in the domain. If the *specifier* already specifies a precision, this method is equivalent to [*locale*.format](https://github.com/d3/d3-format/blob/master/README.md#locale_format). - -See also [d3.tickFormat](#tickFormat). - -# continuous.nice([count]) · [Source](https://github.com/d3/d3-scale/blob/master/src/nice.js), [Examples](https://observablehq.com/@d3/d3-scalelinear) - -Extends the [domain](#continuous_domain) so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. An optional tick *count* argument allows greater control over the step size used to extend the bounds, guaranteeing that the returned [ticks](#continuous_ticks) will exactly cover the domain. Nicing is useful if the domain is computed from data, say using [extent](https://github.com/d3/d3-array/blob/master/README.md#extent), and may be irregular. For example, for a domain of [0.201479…, 0.996679…], a nice domain might be [0.2, 1.0]. If the domain has more than two values, nicing the domain only affects the first and last value. See also d3-array’s [tickStep](https://github.com/d3/d3-array/blob/master/README.md#tickStep). - -Nicing a scale only modifies the current domain; it does not automatically nice domains that are subsequently set using [*continuous*.domain](#continuous_domain). You must re-nice the scale after setting the new domain, if desired. - -# continuous.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. - -# d3.tickFormat(start, stop, count[, specifier]) · [Source](https://github.com/d3/d3-scale/blob/master/src/tickFormat.js), [Examples](https://observablehq.com/@d3/scale-ticks) - -Returns a [number format](https://github.com/d3/d3-format) function suitable for displaying a tick value, automatically computing the appropriate precision based on the fixed interval between tick values, as determined by [d3.tickStep](https://github.com/d3/d3-array/blob/master/README.md#tickStep). - -An optional *specifier* allows a [custom format](https://github.com/d3/d3-format/blob/master/README.md#locale_format) where the precision of the format is automatically set by the scale as appropriate for the tick interval. For example, to format percentage change, you might say: - -```js -var tickFormat = d3.tickFormat(-1, 1, 5, "+%"); - -tickFormat(-0.5); // "-50%" -``` - -If *specifier* uses the format type `s`, the scale will return a [SI-prefix format](https://github.com/d3/d3-format/blob/master/README.md#locale_formatPrefix) based on the larger absolute value of *start* and *stop*. If the *specifier* already specifies a precision, this method is equivalent to [*locale*.format](https://github.com/d3/d3-format/blob/master/README.md#locale_format). - -#### Linear Scales - -# d3.scaleLinear([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/linear.js), [Examples](https://observablehq.com/@d3/d3-scalelinear) - -Constructs a new [continuous scale](#continuous-scales) with the specified [domain](#continuous_domain) and [range](#continuous_range), the [default](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate) [interpolator](#continuous_interpolate) and [clamping](#continuous_clamp) disabled. If either *domain* or *range* are not specified, each defaults to [0, 1]. Linear scales are a good default choice for continuous quantitative data because they preserve proportional differences. Each range value *y* can be expressed as a function of the domain value *x*: *y* = *mx* + *b*. - -#### Power Scales - -Power scales are similar to [linear scales](#linear-scales), except an exponential transform is applied to the input domain value before the output range value is computed. Each range value *y* can be expressed as a function of the domain value *x*: *y* = *mx^k* + *b*, where *k* is the [exponent](#pow_exponent) value. Power scales also support negative domain values, in which case the input value and the resulting output value are multiplied by -1. - -# d3.scalePow([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -Constructs a new [continuous scale](#continuous-scales) with the specified [domain](#continuous_domain) and [range](#continuous_range), the [exponent](#pow_exponent) 1, the [default](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate) [interpolator](#continuous_interpolate) and [clamping](#continuous_clamp) disabled. If either *domain* or *range* are not specified, each defaults to [0, 1]. (Note that this is effectively a [linear](#linear-scales) scale until you set a different exponent.) - -# pow(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*](#_continuous). - -# pow.invert(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.invert](#continuous_invert). - -# pow.exponent([exponent]) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -If *exponent* is specified, sets the current exponent to the given numeric value. If *exponent* is not specified, returns the current exponent, which defaults to 1. (Note that this is effectively a [linear](#linear-scales) scale until you set a different exponent.) - -# pow.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.domain](#continuous_domain). - -# pow.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.range](#continuous_range). - -# pow.rangeRound([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.rangeRound](#continuous_rangeRound). - -# pow.clamp(clamp) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.clamp](#continuous_clamp). - -# pow.interpolate(interpolate) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.interpolate](#continuous_interpolate). - -# pow.ticks([count]) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/scale-ticks) - -See [*continuous*.ticks](#continuous_ticks). - -# pow.tickFormat([count[, specifier]]) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/scale-ticks) - -See [*continuous*.tickFormat](#continuous_tickFormat). - -# pow.nice([count]) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.nice](#continuous_nice). - -# pow.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.copy](#continuous_copy). - -# d3.scaleSqrt([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/pow.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -Constructs a new [continuous](#continuous-scales) [power scale](#power-scales) with the specified [domain](#continuous_domain) and [range](#continuous_range), the [exponent](#pow_exponent) 0.5, the [default](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate) [interpolator](#continuous_interpolate) and [clamping](#continuous_clamp) disabled. If either *domain* or *range* are not specified, each defaults to [0, 1]. This is a convenience method equivalent to `d3.scalePow(…).exponent(0.5)`. - -#### Log Scales - -Log scales are similar to [linear scales](#linear-scales), except a logarithmic transform is applied to the input domain value before the output range value is computed. The mapping to the range value *y* can be expressed as a function of the domain value *x*: *y* = *m* log(x) + *b*. - -As log(0) = -∞, a log scale domain must be **strictly-positive or strictly-negative**; the domain must not include or cross zero. A log scale with a positive domain has a well-defined behavior for positive values, and a log scale with a negative domain has a well-defined behavior for negative values. (For a negative domain, input and output values are implicitly multiplied by -1.) The behavior of the scale is undefined if you pass a negative value to a log scale with a positive domain or vice versa. - -# d3.scaleLog([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -Constructs a new [continuous scale](#continuous-scales) with the specified [domain](#log_domain) and [range](#log_range), the [base](#log_base) 10, the [default](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate) [interpolator](#log_interpolate) and [clamping](#log_clamp) disabled. If *domain* is not specified, it defaults to [1, 10]. If *range* is not specified, it defaults to [0, 1]. - -# log(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*](#_continuous). - -# log.invert(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.invert](#continuous_invert). - -# log.base([base]) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -If *base* is specified, sets the base for this logarithmic scale to the specified value. If *base* is not specified, returns the current base, which defaults to 10. - -# log.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.domain](#continuous_domain). - -# log.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/continuous.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.range](#continuous_range). - -# log.rangeRound([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.rangeRound](#continuous_rangeRound). - -# log.clamp(clamp) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.clamp](#continuous_clamp). - -# log.interpolate(interpolate) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.interpolate](#continuous_interpolate). - -# log.ticks([count]) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/scale-ticks) - -Like [*continuous*.ticks](#continuous_ticks), but customized for a log scale. If the [base](#log_base) is an integer, the returned ticks are uniformly spaced within each integer power of base; otherwise, one tick per power of base is returned. The returned ticks are guaranteed to be within the extent of the domain. If the orders of magnitude in the [domain](#log_domain) is greater than *count*, then at most one tick per power is returned. Otherwise, the tick values are unfiltered, but note that you can use [*log*.tickFormat](#log_tickFormat) to filter the display of tick labels. If *count* is not specified, it defaults to 10. - -# log.tickFormat([count[, specifier]]) · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/scale-ticks) - -Like [*continuous*.tickFormat](#continuous_tickFormat), but customized for a log scale. The specified *count* typically has the same value as the count that is used to generate the [tick values](#continuous_ticks). If there are too many ticks, the formatter may return the empty string for some of the tick labels; however, note that the ticks are still shown. To disable filtering, specify a *count* of Infinity. When specifying a count, you may also provide a format *specifier* or format function. For example, to get a tick formatter that will display 20 ticks of a currency, say `log.tickFormat(20, "$,f")`. If the specifier does not have a defined precision, the precision will be set automatically by the scale, returning the appropriate format. This provides a convenient way of specifying a format whose precision will be automatically set by the scale. - -# log.nice() · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/d3-scalelinear) - -Like [*continuous*.nice](#continuous_nice), except extends the domain to integer powers of [base](#log_base). For example, for a domain of [0.201479…, 0.996679…], and base 10, the nice domain is [0.1, 1]. If the domain has more than two values, nicing the domain only affects the first and last value. - -# log.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/log.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -See [*continuous*.copy](#continuous_copy). - -#### Symlog Scales - -See [A bi-symmetric log transformation for wide-range data](https://www.researchgate.net/profile/John_Webber4/publication/233967063_A_bi-symmetric_log_transformation_for_wide-range_data/links/0fcfd50d791c85082e000000.pdf) by Webber for more. - -# d3.scaleSymlog([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/symlog.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -Constructs a new [continuous scale](#continuous-scales) with the specified [domain](#continuous_domain) and [range](#continuous_range), the [constant](#symlog_constant) 1, the [default](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate) [interpolator](#continuous_interpolate) and [clamping](#continuous_clamp) disabled. If *domain* is not specified, it defaults to [0, 1]. If *range* is not specified, it defaults to [0, 1]. - -# symlog.constant([constant]) · [Source](https://github.com/d3/d3-scale/blob/master/src/symlog.js), [Examples](https://observablehq.com/@d3/continuous-scales) - -If *constant* is specified, sets the symlog constant to the specified number and returns this scale; otherwise returns the current value of the symlog constant, which defaults to 1. See “A bi-symmetric log transformation for wide-range data” by Webber for more. - -#### Identity Scales - -Identity scales are a special case of [linear scales](#linear-scales) where the domain and range are identical; the scale and its invert method are thus the identity function. These scales are occasionally useful when working with pixel coordinates, say in conjunction with an axis. Identity scales do not support [rangeRound](#continuous_rangeRound), [clamp](#continuous_clamp) or [interpolate](#continuous_interpolate). - -# d3.scaleIdentity([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/identity.js), [Examples](https://observablehq.com/@d3/d3-scalelinear) - -Constructs a new identity scale with the specified [domain](#continuous_domain) and [range](#continuous_range). If *range* is not specified, it defaults to [0, 1]. - -#### Radial Scales - -Radial scales are a variant of [linear scales](#linear-scales) where the range is internally squared so that an input value corresponds linearly to the squared output value. These scales are useful when you want the input value to correspond to the area of a graphical mark and the mark is specified by radius, as in a radial bar chart. Radial scales do not support [interpolate](#continuous_interpolate). - -# d3.scaleRadial([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/radial.js), [Examples](https://observablehq.com/@d3/radial-stacked-bar-chart) - -Constructs a new radial scale with the specified [domain](#continuous_domain) and [range](#continuous_range). If *domain* or *range* is not specified, each defaults to [0, 1]. - -#### Time Scales - -Time scales are a variant of [linear scales](#linear-scales) that have a temporal domain: domain values are coerced to [dates](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date) rather than numbers, and [invert](#continuous_invert) likewise returns a date. Time scales implement [ticks](#time_ticks) based on [calendar intervals](https://github.com/d3/d3-time), taking the pain out of generating axes for temporal domains. - -For example, to create a position encoding: - -```js -var x = d3.scaleTime() - .domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]) - .range([0, 960]); - -x(new Date(2000, 0, 1, 5)); // 200 -x(new Date(2000, 0, 1, 16)); // 640 -x.invert(200); // Sat Jan 01 2000 05:00:00 GMT-0800 (PST) -x.invert(640); // Sat Jan 01 2000 16:00:00 GMT-0800 (PST) -``` - -For a valid value *y* in the range, time(time.invert(y)) equals *y*; similarly, for a valid value *x* in the domain, time.invert(time(x)) equals *x*. The invert method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse. - -# d3.scaleTime([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) - -Constructs a new time scale with the specified [domain](#time_domain) and [range](#time_range), the [default](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate) [interpolator](#time_interpolate) and [clamping](#time_clamp) disabled. If *domain* is not specified, it defaults to [2000-01-01, 2000-01-02]. If *range* is not specified, it defaults to [0, 1]. - -# time(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) - -See [*continuous*](#_continuous). - -# time.invert(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) - -See [*continuous*.invert](#continuous_invert). - -# time.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) - -See [*continuous*.domain](#continuous_domain). - -# time.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) - -See [*continuous*.range](#continuous_range). - -# time.rangeRound([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) - -See [*continuous*.rangeRound](#continuous_rangeRound). - -# time.clamp(clamp) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) - -See [*continuous*.clamp](#continuous_clamp). - -# time.interpolate(interpolate) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) - -See [*continuous*.interpolate](#continuous_interpolate). - -# time.ticks([count]) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) -
# time.ticks([interval]) - -Returns representative dates from the scale’s [domain](#time_domain). The returned tick values are uniformly-spaced (mostly), have sensible values (such as every day at midnight), and are guaranteed to be within the extent of the domain. Ticks are often used to display reference lines, or tick marks, in conjunction with the visualized data. - -An optional *count* may be specified to affect how many ticks are generated. If *count* is not specified, it defaults to 10. The specified *count* is only a hint; the scale may return more or fewer values depending on the domain. For example, to create ten default ticks, say: - -```js -var x = d3.scaleTime(); - -x.ticks(10); -// [Sat Jan 01 2000 00:00:00 GMT-0800 (PST), -// Sat Jan 01 2000 03:00:00 GMT-0800 (PST), -// Sat Jan 01 2000 06:00:00 GMT-0800 (PST), -// Sat Jan 01 2000 09:00:00 GMT-0800 (PST), -// Sat Jan 01 2000 12:00:00 GMT-0800 (PST), -// Sat Jan 01 2000 15:00:00 GMT-0800 (PST), -// Sat Jan 01 2000 18:00:00 GMT-0800 (PST), -// Sat Jan 01 2000 21:00:00 GMT-0800 (PST), -// Sun Jan 02 2000 00:00:00 GMT-0800 (PST)] -``` - -The following time intervals are considered for automatic ticks: - -* 1-, 5-, 15- and 30-second. -* 1-, 5-, 15- and 30-minute. -* 1-, 3-, 6- and 12-hour. -* 1- and 2-day. -* 1-week. -* 1- and 3-month. -* 1-year. - -In lieu of a *count*, a [time *interval*](https://github.com/d3/d3-time/blob/master/README.md#intervals) may be explicitly specified. To prune the generated ticks for a given time *interval*, use [*interval*.every](https://github.com/d3/d3-time/blob/master/README.md#interval_every). For example, to generate ticks at 15-[minute](https://github.com/d3/d3-time/blob/master/README.md#minute) intervals: - -```js -var x = d3.scaleTime() - .domain([new Date(2000, 0, 1, 0), new Date(2000, 0, 1, 2)]); - -x.ticks(d3.timeMinute.every(15)); -// [Sat Jan 01 2000 00:00:00 GMT-0800 (PST), -// Sat Jan 01 2000 00:15:00 GMT-0800 (PST), -// Sat Jan 01 2000 00:30:00 GMT-0800 (PST), -// Sat Jan 01 2000 00:45:00 GMT-0800 (PST), -// Sat Jan 01 2000 01:00:00 GMT-0800 (PST), -// Sat Jan 01 2000 01:15:00 GMT-0800 (PST), -// Sat Jan 01 2000 01:30:00 GMT-0800 (PST), -// Sat Jan 01 2000 01:45:00 GMT-0800 (PST), -// Sat Jan 01 2000 02:00:00 GMT-0800 (PST)] -``` - -Alternatively, pass a test function to [*interval*.filter](https://github.com/d3/d3-time/blob/master/README.md#interval_filter): - -```js -x.ticks(d3.timeMinute.filter(function(d) { - return d.getMinutes() % 15 === 0; -})); -``` - -Note: in some cases, such as with day ticks, specifying a *step* can result in irregular spacing of ticks because time intervals have varying length. - -# time.tickFormat([count[, specifier]]) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/scale-ticks) -
# time.tickFormat([interval[, specifier]]) - -Returns a time format function suitable for displaying [tick](#time_ticks) values. The specified *count* or *interval* is currently ignored, but is accepted for consistency with other scales such as [*continuous*.tickFormat](#continuous_tickFormat). If a format *specifier* is specified, this method is equivalent to [format](https://github.com/d3/d3-time-format/blob/master/README.md#format). If *specifier* is not specified, the default time format is returned. The default multi-scale time format chooses a human-readable representation based on the specified date as follows: - -* `%Y` - for year boundaries, such as `2011`. -* `%B` - for month boundaries, such as `February`. -* `%b %d` - for week boundaries, such as `Feb 06`. -* `%a %d` - for day boundaries, such as `Mon 07`. -* `%I %p` - for hour boundaries, such as `01 AM`. -* `%I:%M` - for minute boundaries, such as `01:23`. -* `:%S` - for second boundaries, such as `:45`. -* `.%L` - milliseconds for all other times, such as `.012`. - -Although somewhat unusual, this default behavior has the benefit of providing both local and global context: for example, formatting a sequence of ticks as [11 PM, Mon 07, 01 AM] reveals information about hours, dates, and day simultaneously, rather than just the hours [11 PM, 12 AM, 01 AM]. See [d3-time-format](https://github.com/d3/d3-time-format) if you’d like to roll your own conditional time format. - -# time.nice([count]) · [Source](https://github.com/d3/d3-scale/blob/master/src/time.js), [Examples](https://observablehq.com/@d3/d3-scaletime) -
# time.nice([interval]) - -Extends the [domain](#time_domain) so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. See [*continuous*.nice](#continuous_nice) for more. - -An optional tick *count* argument allows greater control over the step size used to extend the bounds, guaranteeing that the returned [ticks](#time_ticks) will exactly cover the domain. Alternatively, a [time *interval*](https://github.com/d3/d3-time/blob/master/README.md#intervals) may be specified to explicitly set the ticks. If an *interval* is specified, an optional *step* may also be specified to skip some ticks. For example, `time.nice(d3.timeSecond.every(10))` will extend the domain to an even ten seconds (0, 10, 20, etc.). See [*time*.ticks](#time_ticks) and [*interval*.every](https://github.com/d3/d3-time/blob/master/README.md#interval_every) for further detail. - -Nicing is useful if the domain is computed from data, say using [extent](https://github.com/d3/d3-array/blob/master/README.md#extent), and may be irregular. For example, for a domain of [2009-07-13T00:02, 2009-07-13T23:48], the nice domain is [2009-07-13, 2009-07-14]. If the domain has more than two values, nicing the domain only affects the first and last value. - -# d3.scaleUtc([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/utcTime.js), [Examples](https://observablehq.com/@d3/d3-scaletime) - -Equivalent to [scaleTime](#scaleTime), but the returned time scale operates in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) rather than local time. - -### Sequential Scales - -Sequential scales, like [diverging scales](#diverging-scales), are similar to [continuous scales](#continuous-scales) in that they map a continuous, numeric input domain to a continuous output range. However, unlike continuous scales, the input domain and output range of a sequential scale always has exactly two elements, and the output range is typically specified as an interpolator rather than an array of values. These scales do not expose [invert](#continuous_invert) and [interpolate](#continuous_interpolate) methods. - -# d3.scaleSequential([[domain, ]interpolator]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -Constructs a new sequential scale with the specified [*domain*](#sequential_domain) and [*interpolator*](#sequential_interpolator) function. If *domain* is not specified, it defaults to [0, 1]. If *interpolator* is not specified, it defaults to the identity function. When the scale is [applied](#_sequential), the interpolator will be invoked with a value typically in the range [0, 1], where 0 represents the minimum value and 1 represents the maximum value. For example, to implement the ill-advised [HSL](https://github.com/d3/d3-color/blob/master/README.md#hsl) rainbow scale: - -```js -var rainbow = d3.scaleSequential(function(t) { - return d3.hsl(t * 360, 1, 0.5) + ""; -}); -``` - -A more aesthetically-pleasing and perceptually-effective cyclical hue encoding is to use [d3.interpolateRainbow](https://github.com/d3/d3-scale-chromatic/blob/master/README.md#interpolateRainbow): - -```js -var rainbow = d3.scaleSequential(d3.interpolateRainbow); -``` - -# sequential(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -See [*continuous*](#_continuous). - -# sequential.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -See [*continuous*.domain](#continuous_domain). Note that a sequential scale’s domain must be numeric and must contain exactly two values. - -# sequential.clamp([clamp]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -See [*continuous*.clamp](#continuous_clamp). - -# sequential.interpolator([interpolator]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -If *interpolator* is specified, sets the scale’s interpolator to the specified function. If *interpolator* is not specified, returns the scale’s current interpolator. - -# sequential.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -See [*continuous*.range](#continuous_range). If *range* is specified, implicitly uses [d3.interpolate](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate) as the interpolator. - -# sequential.rangeRound([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -See [*continuous*.rangeRound](#continuous_rangeRound). If *range* is specified, implicitly uses [d3.interpolateRound](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolateRound) as the interpolator. - -# sequential.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -See [*continuous*.copy](#continuous_copy). - -# d3.scaleSequentialLog([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -A [sequential scale](#sequential-scales) with a logarithmic transform, analogous to a [log scale](#log-scales). - -# d3.scaleSequentialPow([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -A [sequential scale](#sequential-scales) with an exponential transform, analogous to a [power scale](#pow-scales). - -# d3.scaleSequentialSqrt([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -A [sequential scale](#sequential-scales) with a square-root transform, analogous to a [d3.scaleSqrt](#scaleSqrt). - -# d3.scaleSequentialSymlog([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequential.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -A [sequential scale](#sequential-scales) with a symmetric logarithmic transform, analogous to a [symlog scale](#symlog-scales). - -# d3.scaleSequentialQuantile([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequentialQuantile.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -A [sequential scale](#sequential-scales) using a *p*-quantile transform, analogous to a [quantile scale](#quantile-scales). - -# sequentialQuantile.quantiles(n) · [Source](https://github.com/d3/d3-scale/blob/master/src/sequentialQuantile.js), [Examples](https://observablehq.com/@d3/sequential-scales) - -Returns an array of *n* + 1 quantiles. For example, if *n* = 4, returns an array of five numbers: the minimum value, the first quartile, the median, the third quartile, and the maximum. - -### Diverging Scales - -Diverging scales, like [sequential scales](#sequential-scales), are similar to [continuous scales](#continuous-scales) in that they map a continuous, numeric input domain to a continuous output range. However, unlike continuous scales, the input domain and output range of a diverging scale always has exactly three elements, and the output range is typically specified as an interpolator rather than an array of values. These scales do not expose [invert](#continuous_invert) and [interpolate](#continuous_interpolate) methods. - -# d3.scaleDiverging([[domain, ]interpolator]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -Constructs a new diverging scale with the specified [*domain*](#diverging_domain) and [*interpolator*](#diverging_interpolator) function. If *domain* is not specified, it defaults to [0, 1]. If *interpolator* is not specified, it defaults to the identity function. When the scale is [applied](#_diverging), the interpolator will be invoked with a value typically in the range [0, 1], where 0 represents the extreme negative value, 0.5 represents the neutral value, and 1 represents the extreme positive value. For example, using [d3.interpolateSpectral](https://github.com/d3/d3-scale-chromatic/blob/master/README.md#interpolateSpectral): - -```js -var spectral = d3.scaleDiverging(d3.interpolateSpectral); -``` - -# diverging(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -See [*continuous*](#_continuous). - -# diverging.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -See [*continuous*.domain](#continuous_domain). Note that a diverging scale’s domain must be numeric and must contain exactly three values. The default domain is [0, 0.5, 1]. - -# diverging.clamp([clamp]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -See [*continuous*.clamp](#continuous_clamp). - -# diverging.interpolator([interpolator]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -If *interpolator* is specified, sets the scale’s interpolator to the specified function. If *interpolator* is not specified, returns the scale’s current interpolator. - -# diverging.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -See [*continuous*.range](#continuous_range). If *range* is specified, implicitly uses [d3.interpolate](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolate) as the interpolator. - -# diverging.rangeRound([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -See [*continuous*.range](#continuous_rangeRound). If *range* is specified, implicitly uses [d3.interpolateRound](https://github.com/d3/d3-interpolate/blob/master/README.md#interpolateRound) as the interpolator. - -# diverging.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -See [*continuous*.copy](#continuous_copy). - -# diverging.unknown() · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -See [*continuous*.unknown](#continuous_unknown). - -# d3.scaleDivergingLog([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -A [diverging scale](#diverging-scales) with a logarithmic transform, analogous to a [log scale](#log-scales). - -# d3.scaleDivergingPow([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -A [diverging scale](#diverging-scales) with an exponential transform, analogous to a [power scale](#pow-scales). - -# d3.scaleDivergingSqrt([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -A [diverging scale](#diverging-scales) with a square-root transform, analogous to a [d3.scaleSqrt](#scaleSqrt). - -# d3.scaleDivergingSymlog([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/diverging.js), [Examples](https://observablehq.com/@d3/diverging-scales) - -A [diverging scale](#diverging-scales) with a symmetric logarithmic transform, analogous to a [symlog scale](#symlog-scales). - -### Quantize Scales - -Quantize scales are similar to [linear scales](#linear-scales), except they use a discrete rather than continuous range. The continuous input domain is divided into uniform segments based on the number of values in (*i.e.*, the cardinality of) the output range. Each range value *y* can be expressed as a quantized linear function of the domain value *x*: *y* = *m round(x)* + *b*. See [this choropleth](https://observablehq.com/@d3/choropleth) for an example. - -# d3.scaleQuantize([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Constructs a new quantize scale with the specified [*domain*](#quantize_domain) and [*range*](#quantize_range). If either *domain* or *range* is not specified, each defaults to [0, 1]. Thus, the default quantize scale is equivalent to the [Math.round](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/round) function. - -# quantize(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Given a *value* in the input [domain](#quantize_domain), returns the corresponding value in the output [range](#quantize_range). For example, to apply a color encoding: - -```js -var color = d3.scaleQuantize() - .domain([0, 1]) - .range(["brown", "steelblue"]); - -color(0.49); // "brown" -color(0.51); // "steelblue" -``` - -Or dividing the domain into three equally-sized parts with different range values to compute an appropriate stroke width: - -```js -var width = d3.scaleQuantize() - .domain([10, 100]) - .range([1, 2, 4]); - -width(20); // 1 -width(50); // 2 -width(80); // 4 -``` - -# quantize.invertExtent(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Returns the extent of values in the [domain](#quantize_domain) [x0, x1] for the corresponding *value* in the [range](#quantize_range): the inverse of [*quantize*](#_quantize). This method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse. - -```js -var width = d3.scaleQuantize() - .domain([10, 100]) - .range([1, 2, 4]); - -width.invertExtent(2); // [40, 70] -``` - -# quantize.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -If *domain* is specified, sets the scale’s domain to the specified two-element array of numbers. If the elements in the given array are not numbers, they will be coerced to numbers. The numbers must be in ascending order or the behavior of the scale is undefined. If *domain* is not specified, returns the scale’s current domain. - -# quantize.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -If *range* is specified, sets the scale’s range to the specified array of values. The array may contain any number of discrete values. The elements in the given array need not be numbers; any value or type will work. If *range* is not specified, returns the scale’s current range. - -# quantize.ticks([count]) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/scale-ticks) - -Equivalent to [*continuous*.ticks](#continuous_ticks). - -# quantize.tickFormat([count[, specifier]]) · [Source](https://github.com/d3/d3-scale/blob/master/src/linear.js), [Examples](https://observablehq.com/@d3/scale-ticks) - -Equivalent to [*continuous*.tickFormat](#continuous_tickFormat). - -# quantize.nice() · [Source](https://github.com/d3/d3-scale/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Equivalent to [*continuous*.nice](#continuous_nice). - -# quantize.thresholds() · [Source](https://github.com/d3/d3-scale/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Returns the array of computed thresholds within the [domain](#quantize_domain). - -# quantize.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/quantize.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. - -### Quantile Scales - -Quantile scales map a sampled input domain to a discrete range. The domain is considered continuous and thus the scale will accept any reasonable input value; however, the domain is specified as a discrete set of sample values. The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the domain. To compute the quantiles, the domain is sorted, and treated as a [population of discrete values](https://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population); see d3-array’s [quantile](https://github.com/d3/d3-array/blob/master/README.md#quantile). See [this quantile choropleth](https://observablehq.com/@d3/quantile-choropleth) for an example. - -# d3.scaleQuantile([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantile.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Constructs a new quantile scale with the specified [*domain*](#quantile_domain) and [*range*](#quantile_range). If either *domain* or *range* is not specified, each defaults to the empty array. The quantile scale is invalid until both a domain and range are specified. - -# quantile(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantile.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Given a *value* in the input [domain](#quantile_domain), returns the corresponding value in the output [range](#quantile_range). - -# quantile.invertExtent(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantile.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Returns the extent of values in the [domain](#quantile_domain) [x0, x1] for the corresponding *value* in the [range](#quantile_range): the inverse of [*quantile*](#_quantile). This method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse. - -# quantile.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantile.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -If *domain* is specified, sets the domain of the quantile scale to the specified set of discrete numeric values. The array must not be empty, and must contain at least one numeric value; NaN, null and undefined values are ignored and not considered part of the sample population. If the elements in the given array are not numbers, they will be coerced to numbers. A copy of the input array is sorted and stored internally. If *domain* is not specified, returns the scale’s current domain. - -# quantile.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/quantile.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -If *range* is specified, sets the discrete values in the range. The array must not be empty, and may contain any type of value. The number of values in (the cardinality, or length, of) the *range* array determines the number of quantiles that are computed. For example, to compute quartiles, *range* must be an array of four elements such as [0, 1, 2, 3]. If *range* is not specified, returns the current range. - -# quantile.quantiles() · [Source](https://github.com/d3/d3-scale/blob/master/src/quantile.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Returns the quantile thresholds. If the [range](#quantile_range) contains *n* discrete values, the returned array will contain *n* - 1 thresholds. Values less than the first threshold are considered in the first quantile; values greater than or equal to the first threshold but less than the second threshold are in the second quantile, and so on. Internally, the thresholds array is used with [bisect](https://github.com/d3/d3-array/blob/master/README.md#bisect) to find the output quantile associated with the given input value. - -# quantile.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/quantile.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. - -### Threshold Scales - -Threshold scales are similar to [quantize scales](#quantize-scales), except they allow you to map arbitrary subsets of the domain to discrete values in the range. The input domain is still continuous, and divided into slices based on a set of threshold values. See [this choropleth](https://observablehq.com/@d3/threshold-choropleth) for an example. - -# d3.scaleThreshold([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/threshold.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Constructs a new threshold scale with the specified [*domain*](#threshold_domain) and [*range*](#threshold_range). It *domain* is not specified, it defaults to [0.5]. If *range* is not specified, it defaults to [0, 1]. Thus, the default threshold scale is equivalent to the [Math.round](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/round) function for numbers; for example threshold(0.49) returns 0, and threshold(0.51) returns 1. - -# threshold(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/threshold.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Given a *value* in the input [domain](#threshold_domain), returns the corresponding value in the output [range](#threshold_range). For example: - -```js -var color = d3.scaleThreshold() - .domain([0, 1]) - .range(["red", "white", "green"]); - -color(-1); // "red" -color(0); // "white" -color(0.5); // "white" -color(1); // "green" -color(1000); // "green" -``` - -# threshold.invertExtent(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/threshold.js), [Examples](https://observablehq.com/@d3/choropleth) - -Returns the extent of values in the [domain](#threshold_domain) [x0, x1] for the corresponding *value* in the [range](#threshold_range), representing the inverse mapping from range to domain. This method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse. For example: - -```js -var color = d3.scaleThreshold() - .domain([0, 1]) - .range(["red", "white", "green"]); - -color.invertExtent("red"); // [undefined, 0] -color.invertExtent("white"); // [0, 1] -color.invertExtent("green"); // [1, undefined] -``` - -# threshold.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/threshold.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -If *domain* is specified, sets the scale’s domain to the specified array of values. The values must be in ascending order or the behavior of the scale is undefined. The values are typically numbers, but any naturally ordered values (such as strings) will work; a threshold scale can be used to encode any type that is ordered. If the number of values in the scale’s range is N+1, the number of values in the scale’s domain must be N. If there are fewer than N elements in the domain, the additional values in the range are ignored. If there are more than N elements in the domain, the scale may return undefined for some inputs. If *domain* is not specified, returns the scale’s current domain. - -# threshold.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/threshold.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -If *range* is specified, sets the scale’s range to the specified array of values. If the number of values in the scale’s domain is N, the number of values in the scale’s range must be N+1. If there are fewer than N+1 elements in the range, the scale may return undefined for some inputs. If there are more than N+1 elements in the range, the additional values are ignored. The elements in the given array need not be numbers; any value or type will work. If *range* is not specified, returns the scale’s current range. - -# threshold.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/threshold.js), [Examples](https://observablehq.com/@d3/quantile-quantize-and-threshold-scales) - -Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. - -### Ordinal Scales - -Unlike [continuous scales](#continuous-scales), ordinal scales have a discrete domain and range. For example, an ordinal scale might map a set of named categories to a set of colors, or determine the horizontal positions of columns in a column chart. - -# d3.scaleOrdinal([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/ordinal.js), [Examples](https://observablehq.com/@d3/d3-scaleordinal) - -Constructs a new ordinal scale with the specified [*domain*](#ordinal_domain) and [*range*](#ordinal_range). If *domain* is not specified, it defaults to the empty array. If *range* is not specified, it defaults to the empty array; an ordinal scale always returns undefined until a non-empty range is defined. - -# ordinal(value) · [Source](https://github.com/d3/d3-scale/blob/master/src/ordinal.js), [Examples](https://observablehq.com/@d3/d3-scaleordinal) - -Given a *value* in the input [domain](#ordinal_domain), returns the corresponding value in the output [range](#ordinal_range). If the given *value* is not in the scale’s [domain](#ordinal_domain), returns the [unknown](#ordinal_unknown); or, if the unknown value is [implicit](#scaleImplicit) (the default), then the *value* is implicitly added to the domain and the next-available value in the range is assigned to *value*, such that this and subsequent invocations of the scale given the same input *value* return the same output value. - -# ordinal.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/ordinal.js), [Examples](https://observablehq.com/@d3/d3-scaleordinal) - -If *domain* is specified, sets the domain to the specified array of values. The first element in *domain* will be mapped to the first element in the range, the second domain value to the second range value, and so on. Domain values are stored internally in a map from stringified value to index; the resulting index is then used to retrieve a value from the range. Thus, an ordinal scale’s values must be coercible to a string, and the stringified version of the domain value uniquely identifies the corresponding range value. If *domain* is not specified, this method returns the current domain. - -Setting the domain on an ordinal scale is optional if the [unknown value](#ordinal_unknown) is [implicit](#scaleImplicit) (the default). In this case, the domain will be inferred implicitly from usage by assigning each unique value passed to the scale a new value from the range. Note that an explicit domain is recommended to ensure deterministic behavior, as inferring the domain from usage will be dependent on ordering. - -# ordinal.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/ordinal.js), [Examples](https://observablehq.com/@d3/d3-scaleordinal) - -If *range* is specified, sets the range of the ordinal scale to the specified array of values. The first element in the domain will be mapped to the first element in *range*, the second domain value to the second range value, and so on. If there are fewer elements in the range than in the domain, the scale will reuse values from the start of the range. If *range* is not specified, this method returns the current range. - -# ordinal.unknown([value]) · [Source](https://github.com/d3/d3-scale/blob/master/src/ordinal.js), [Examples](https://observablehq.com/@d3/d3-scaleordinal) - -If *value* is specified, sets the output value of the scale for unknown input values and returns this scale. If *value* is not specified, returns the current unknown value, which defaults to [implicit](#scaleImplicit). The implicit value enables implicit domain construction; see [*ordinal*.domain](#ordinal_domain). - -# ordinal.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/ordinal.js), [Examples](https://observablehq.com/@d3/d3-scaleordinal) - -Returns an exact copy of this ordinal scale. Changes to this scale will not affect the returned scale, and vice versa. - -# d3.scaleImplicit · [Source](https://github.com/d3/d3-scale/blob/master/src/ordinal.js), [Examples](https://observablehq.com/@d3/d3-scaleordinal) - -A special value for [*ordinal*.unknown](#ordinal_unknown) that enables implicit domain construction: unknown values are implicitly added to the domain. - -#### Band Scales - -Band scales are like [ordinal scales](#ordinal-scales) except the output range is continuous and numeric. Discrete output values are automatically computed by the scale by dividing the continuous range into uniform bands. Band scales are typically used for bar charts with an ordinal or categorical dimension. The [unknown value](#ordinal_unknown) of a band scale is effectively undefined: they do not allow implicit domain construction. - -band - -# d3.scaleBand([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -Constructs a new band scale with the specified [*domain*](#band_domain) and [*range*](#band_range), no [padding](#band_padding), no [rounding](#band_round) and center [alignment](#band_align). If *domain* is not specified, it defaults to the empty domain. If *range* is not specified, it defaults to the unit range [0, 1]. - -# band(*value*) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -Given a *value* in the input [domain](#band_domain), returns the start of the corresponding band derived from the output [range](#band_range). If the given *value* is not in the scale’s domain, returns undefined. - -# band.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -If *domain* is specified, sets the domain to the specified array of values. The first element in *domain* will be mapped to the first band, the second domain value to the second band, and so on. Domain values are stored internally in a map from stringified value to index; the resulting index is then used to determine the band. Thus, a band scale’s values must be coercible to a string, and the stringified version of the domain value uniquely identifies the corresponding band. If *domain* is not specified, this method returns the current domain. - -# band.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -If *range* is specified, sets the scale’s range to the specified two-element array of numbers. If the elements in the given array are not numbers, they will be coerced to numbers. If *range* is not specified, returns the scale’s current range, which defaults to [0, 1]. - -# band.rangeRound([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -Sets the scale’s [*range*](#band_range) to the specified two-element array of numbers while also enabling [rounding](#band_round). This is a convenience method equivalent to: - -```js -band - .range(range) - .round(true); -``` - -Rounding is sometimes useful for avoiding antialiasing artifacts, though also consider the [shape-rendering](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering) “crispEdges” styles. - -# band.round([round]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -If *round* is specified, enables or disables rounding accordingly. If rounding is enabled, the start and stop of each band will be integers. Rounding is sometimes useful for avoiding antialiasing artifacts, though also consider the [shape-rendering](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering) “crispEdges” styles. Note that if the width of the domain is not a multiple of the cardinality of the range, there may be leftover unused space, even without padding! Use [*band*.align](#band_align) to specify how the leftover space is distributed. - -# band.paddingInner([padding]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -If *padding* is specified, sets the inner padding to the specified number which must be less than or equal to 1. If *padding* is not specified, returns the current inner padding which defaults to 0. The inner padding specifies the proportion of the range that is reserved for blank space between bands; a value of 0 means no blank space between bands, and a value of 1 means a [bandwidth](#band_bandwidth) of zero. - -# band.paddingOuter([padding]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -If *padding* is specified, sets the outer padding to the specified number which is typically in the range [0, 1]. If *padding* is not specified, returns the current outer padding which defaults to 0. The outer padding specifies the amount of blank space, in terms of multiples of the [step](#band_step), to reserve before the first band and after the last band. - -# band.padding([padding]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -A convenience method for setting the [inner](#band_paddingInner) and [outer](#band_paddingOuter) padding to the same *padding* value. If *padding* is not specified, returns the inner padding. - -# band.align([align]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -If *align* is specified, sets the alignment to the specified value which must be in the range [0, 1]. If *align* is not specified, returns the current alignment which defaults to 0.5. The alignment specifies how outer padding is distributed in the range. A value of 0.5 indicates that the outer padding should be equally distributed before the first band and after the last band; *i.e.*, the bands should be centered within the range. A value of 0 or 1 may be used to shift the bands to one side, say to position them adjacent to an axis. For more, [see this explainer](https://observablehq.com/@d3/band-align). - -# band.bandwidth() · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -Returns the width of each band. - -# band.step() · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -Returns the distance between the starts of adjacent bands. - -# band.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scaleband) - -Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. - -#### Point Scales - -Point scales are a variant of [band scales](#band-scales) with the bandwidth fixed to zero. Point scales are typically used for scatterplots with an ordinal or categorical dimension. The [unknown value](#ordinal_unknown) of a point scale is always undefined: they do not allow implicit domain construction. - -point - -# d3.scalePoint([[domain, ]range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -Constructs a new point scale with the specified [*domain*](#point_domain) and [*range*](#point_range), no [padding](#point_padding), no [rounding](#point_round) and center [alignment](#point_align). If *domain* is not specified, it defaults to the empty domain. If *range* is not specified, it defaults to the unit range [0, 1]. - -# point(*value*) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -Given a *value* in the input [domain](#point_domain), returns the corresponding point derived from the output [range](#point_range). If the given *value* is not in the scale’s domain, returns undefined. - -# point.domain([domain]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -If *domain* is specified, sets the domain to the specified array of values. The first element in *domain* will be mapped to the first point, the second domain value to the second point, and so on. Domain values are stored internally in a map from stringified value to index; the resulting index is then used to determine the point. Thus, a point scale’s values must be coercible to a string, and the stringified version of the domain value uniquely identifies the corresponding point. If *domain* is not specified, this method returns the current domain. - -# point.range([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -If *range* is specified, sets the scale’s range to the specified two-element array of numbers. If the elements in the given array are not numbers, they will be coerced to numbers. If *range* is not specified, returns the scale’s current range, which defaults to [0, 1]. - -# point.rangeRound([range]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -Sets the scale’s [*range*](#point_range) to the specified two-element array of numbers while also enabling [rounding](#point_round). This is a convenience method equivalent to: - -```js -point - .range(range) - .round(true); -``` - -Rounding is sometimes useful for avoiding antialiasing artifacts, though also consider the [shape-rendering](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering) “crispEdges” styles. - -# point.round([round]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -If *round* is specified, enables or disables rounding accordingly. If rounding is enabled, the position of each point will be integers. Rounding is sometimes useful for avoiding antialiasing artifacts, though also consider the [shape-rendering](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering) “crispEdges” styles. Note that if the width of the domain is not a multiple of the cardinality of the range, there may be leftover unused space, even without padding! Use [*point*.align](#point_align) to specify how the leftover space is distributed. - -# point.padding([padding]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -If *padding* is specified, sets the outer padding to the specified number which is typically in the range [0, 1]. If *padding* is not specified, returns the current outer padding which defaults to 0. The outer padding specifies the amount of blank space, in terms of multiples of the [step](#band_step), to reserve before the first point and after the last point. Equivalent to [*band*.paddingOuter](#band_paddingOuter). - -# point.align([align]) · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -If *align* is specified, sets the alignment to the specified value which must be in the range [0, 1]. If *align* is not specified, returns the current alignment which defaults to 0.5. The alignment specifies how any leftover unused space in the range is distributed. A value of 0.5 indicates that the leftover space should be equally distributed before the first point and after the last point; *i.e.*, the points should be centered within the range. A value of 0 or 1 may be used to shift the points to one side, say to position them adjacent to an axis. - -# point.bandwidth() · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -Returns zero. - -# point.step() · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -Returns the distance between the starts of adjacent points. - -# point.copy() · [Source](https://github.com/d3/d3-scale/blob/master/src/band.js), [Examples](https://observablehq.com/@d3/d3-scalepoint) - -Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. diff --git a/node_modules/d3-scale/dist/d3-scale.js b/node_modules/d3-scale/dist/d3-scale.js deleted file mode 100644 index fdd2cd1..0000000 --- a/node_modules/d3-scale/dist/d3-scale.js +++ /dev/null @@ -1,1269 +0,0 @@ -// https://d3js.org/d3-scale/ v3.2.1 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format')) : -typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {}, global.d3, global.d3, global.d3, global.d3, global.d3)); -}(this, function (exports, d3Array, d3Interpolate, d3Format, d3Time, d3TimeFormat) { 'use strict'; - -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: { - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); - break; - } - default: { - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; - } - } - return this; -} - -const implicit = Symbol("implicit"); - -function ordinal() { - var index = new Map(), - domain = [], - range = [], - unknown = implicit; - - function scale(d) { - var key = d + "", i = index.get(key); - if (!i) { - if (unknown !== implicit) return unknown; - index.set(key, i = domain.push(d)); - } - return range[(i - 1) % range.length]; - } - - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new Map(); - for (const value of _) { - const key = value + ""; - if (index.has(key)) continue; - index.set(key, domain.push(value)); - } - return scale; - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return ordinal(domain, range).unknown(unknown); - }; - - initRange.apply(scale, arguments); - - return scale; -} - -function band() { - var scale = ordinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - r0 = 0, - r1 = 1, - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = r1 < r0, - start = reverse ? r1 : r0, - stop = reverse ? r0 : r1; - step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); - var values = d3Array.range(n).map(function(i) { return start + step * i; }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.range = function(_) { - return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1]; - }; - - scale.rangeRound = function(_) { - return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale(); - }; - - scale.bandwidth = function() { - return bandwidth; - }; - - scale.step = function() { - return step; - }; - - scale.round = function(_) { - return arguments.length ? (round = !!_, rescale()) : round; - }; - - scale.padding = function(_) { - return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner; - }; - - scale.paddingInner = function(_) { - return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner; - }; - - scale.paddingOuter = function(_) { - return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter; - }; - - scale.align = function(_) { - return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; - }; - - scale.copy = function() { - return band(domain(), [r0, r1]) - .round(round) - .paddingInner(paddingInner) - .paddingOuter(paddingOuter) - .align(align); - }; - - return initRange.apply(rescale(), arguments); -} - -function pointish(scale) { - var copy = scale.copy; - - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - delete scale.paddingOuter; - - scale.copy = function() { - return pointish(copy()); - }; - - return scale; -} - -function point() { - return pointish(band.apply(null, arguments).paddingInner(1)); -} - -function constant(x) { - return function() { - return x; - }; -} - -function number(x) { - return +x; -} - -var unit = [0, 1]; - -function identity(x) { - return x; -} - -function normalize(a, b) { - return (b -= (a = +a)) - ? function(x) { return (x - a) / b; } - : constant(isNaN(b) ? NaN : 0.5); -} - -function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = 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 corresponding parameter t in [0,1]. -// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. -function bimap(domain, range, interpolate) { - var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function(x) { return r0(d0(x)); }; -} - -function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, - d = new Array(j), - r = new Array(j), - i = -1; - - // Reverse descending domains. - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - - while (++i < j) { - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - - return function(x) { - var i = d3Array.bisect(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() { - var domain = unit, - range = unit, - interpolate = d3Interpolate.interpolate, - transform, - untransform, - unknown, - clamp = identity, - piecewise, - output, - input; - - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); - } - - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), d3Interpolate.interpolateNumber)))(y))); - }; - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.rangeRound = function(_) { - return range = Array.from(_), interpolate = d3Interpolate.interpolateRound, rescale(); - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity; - }; - - scale.interpolate = function(_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t, u) { - transform = t, untransform = u; - return rescale(); - }; -} - -function continuous() { - return transformer()(identity, identity); -} - -function tickFormat(start, stop, count, specifier) { - var step = d3Array.tickStep(start, stop, count), - precision; - specifier = d3Format.formatSpecifier(specifier == null ? ",f" : specifier); - switch (specifier.type) { - case "s": { - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = d3Format.precisionPrefix(step, value))) specifier.precision = precision; - return d3Format.formatPrefix(specifier, value); - } - case "": - case "e": - case "g": - case "p": - case "r": { - if (specifier.precision == null && !isNaN(precision = d3Format.precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - } - case "f": - case "%": { - if (specifier.precision == null && !isNaN(precision = d3Format.precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - return d3Format.format(specifier); -} - -function linearish(scale) { - var domain = scale.domain; - - scale.ticks = function(count) { - var d = domain(); - return d3Array.ticks(d[0], d[d.length - 1], count == null ? 10 : count); - }; - - scale.tickFormat = function(count, specifier) { - var d = domain(); - return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - - scale.nice = function(count) { - if (count == null) count = 10; - - var d = domain(), - i0 = 0, - i1 = d.length - 1, - start = d[i0], - stop = d[i1], - step; - - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - - step = d3Array.tickIncrement(start, stop, count); - - if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - step = d3Array.tickIncrement(start, stop, count); - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - step = d3Array.tickIncrement(start, stop, count); - } - - if (step > 0) { - d[i0] = Math.floor(start / step) * step; - d[i1] = Math.ceil(stop / step) * step; - domain(d); - } else if (step < 0) { - d[i0] = Math.ceil(start * step) / step; - d[i1] = Math.floor(stop * step) / step; - domain(d); - } - - return scale; - }; - - return scale; -} - -function linear() { - var scale = continuous(); - - scale.copy = function() { - return copy(scale, linear()); - }; - - initRange.apply(scale, arguments); - - return linearish(scale); -} - -function identity$1(domain) { - var unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : x; - } - - scale.invert = scale; - - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, number), scale) : domain.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return identity$1(domain).unknown(unknown); - }; - - domain = arguments.length ? Array.from(domain, number) : [0, 1]; - - return linearish(scale); -} - -function nice(domain, interval) { - domain = domain.slice(); - - var i0 = 0, - i1 = domain.length - 1, - x0 = domain[i0], - x1 = domain[i1], - t; - - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - - domain[i0] = interval.floor(x0); - domain[i1] = 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 === 10 ? pow10 - : base === Math.E ? Math.exp - : function(x) { return Math.pow(base, x); }; -} - -function logp(base) { - return base === Math.E ? Math.log - : base === 10 && Math.log10 - || base === 2 && Math.log2 - || (base = Math.log(base), function(x) { return Math.log(x) / base; }); -} - -function reflect(f) { - return function(x) { - return -f(-x); - }; -} - -function loggish(transform) { - var scale = transform(transformLog, transformExp), - domain = scale.domain, - base = 10, - logs, - pows; - - function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else { - transform(transformLog, transformExp); - } - return scale; - } - - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.ticks = function(count) { - var d = domain(), - u = d[0], - v = d[d.length - 1], - r; - - if (r = v < u) i = u, u = v, v = i; - - var i = logs(u), - j = logs(v), - p, - k, - t, - n = count == null ? 10 : +count, - z = []; - - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for (; i <= j; ++i) { - for (k = 1, p = pows(i); k < base; ++k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } else for (; i <= j; ++i) { - for (k = base - 1, p = pows(i); k >= 1; --k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } - if (z.length * 2 < n) z = d3Array.ticks(u, v, n); - } else { - z = d3Array.ticks(i, j, Math.min(j - i, n)).map(pows); - } - - return r ? z.reverse() : z; - }; - - scale.tickFormat = function(count, specifier) { - if (specifier == null) specifier = base === 10 ? ".0e" : ","; - if (typeof specifier !== "function") specifier = d3Format.format(specifier); - if (count === Infinity) return specifier; - if (count == null) count = 10; - var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - return function(d) { - var i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; - }; - - scale.nice = 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() { - var scale = loggish(transformer()).domain([1, 10]); - - scale.copy = function() { - return copy(scale, log()).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 = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - - return linearish(scale); -} - -function symlog() { - var scale = symlogish(transformer()); - - scale.copy = 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 = transform(identity, identity), - exponent = 1; - - function rescale() { - return exponent === 1 ? transform(identity, identity) - : exponent === 0.5 ? transform(transformSqrt, transformSquare) - : transform(transformPow(exponent), transformPow(1 / exponent)); - } - - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - - return linearish(scale); -} - -function pow() { - var scale = powish(transformer()); - - scale.copy = function() { - return copy(scale, pow()).exponent(scale.exponent()); - }; - - initRange.apply(scale, arguments); - - return scale; -} - -function sqrt() { - return pow.apply(null, arguments).exponent(0.5); -} - -function square(x) { - return Math.sign(x) * x * x; -} - -function unsquare(x) { - return Math.sign(x) * Math.sqrt(Math.abs(x)); -} - -function radial() { - var squared = continuous(), - range = [0, 1], - round = false, - unknown; - - function scale(x) { - var y = unsquare(squared(x)); - return isNaN(y) ? unknown : round ? Math.round(y) : y; - } - - scale.invert = function(y) { - return squared.invert(square(y)); - }; - - scale.domain = function(_) { - return arguments.length ? (squared.domain(_), scale) : squared.domain(); - }; - - scale.range = function(_) { - return arguments.length ? (squared.range((range = Array.from(_, number)).map(square)), scale) : range.slice(); - }; - - scale.rangeRound = function(_) { - return scale.range(_).round(true); - }; - - scale.round = function(_) { - return arguments.length ? (round = !!_, scale) : round; - }; - - scale.clamp = function(_) { - return arguments.length ? (squared.clamp(_), scale) : squared.clamp(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return radial(squared.domain(), range) - .round(round) - .clamp(squared.clamp()) - .unknown(unknown); - }; - - initRange.apply(scale, arguments); - - return linearish(scale); -} - -function quantile() { - var domain = [], - range = [], - thresholds = [], - unknown; - - function rescale() { - var i = 0, n = Math.max(1, range.length); - thresholds = new Array(n - 1); - while (++i < n) thresholds[i - 1] = d3Array.quantile(domain, i / n); - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : range[d3Array.bisect(thresholds, x)]; - } - - scale.invertExtent = function(y) { - var i = 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 = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort(d3Array.ascending); - return rescale(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.quantiles = function() { - return thresholds.slice(); - }; - - scale.copy = function() { - return quantile() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); -} - -function quantize() { - var x0 = 0, - x1 = 1, - n = 1, - domain = [0.5], - range = [0, 1], - unknown; - - function scale(x) { - return x <= x ? range[d3Array.bisect(domain, x, 0, n)] : unknown; - } - - function rescale() { - var i = -1; - domain = new Array(n); - while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; - }; - - scale.range = function(_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [NaN, NaN] - : i < 1 ? [x0, domain[0]] - : i >= n ? [domain[n - 1], x1] - : [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - - scale.thresholds = function() { - return domain.slice(); - }; - - scale.copy = function() { - return quantize() - .domain([x0, x1]) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(linearish(scale), arguments); -} - -function threshold() { - var domain = [0.5], - range = [0, 1], - unknown, - n = 1; - - function scale(x) { - return x <= x ? range[d3Array.bisect(domain, x, 0, n)] : unknown; - } - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return threshold() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); -} - -var durationSecond = 1000, - durationMinute = durationSecond * 60, - durationHour = durationMinute * 60, - durationDay = durationHour * 24, - durationWeek = durationDay * 7, - durationMonth = durationDay * 30, - durationYear = durationDay * 365; - -function date(t) { - return new Date(t); -} - -function number$1(t) { - return t instanceof Date ? +t : +new Date(+t); -} - -function calendar(year, month, week, day, hour, minute, second, millisecond, format) { - var scale = continuous(), - invert = scale.invert, - domain = scale.domain; - - var formatMillisecond = format(".%L"), - formatSecond = format(":%S"), - formatMinute = format("%I:%M"), - formatHour = format("%I %p"), - formatDay = format("%a %d"), - formatWeek = format("%b %d"), - formatMonth = format("%B"), - formatYear = format("%Y"); - - var tickIntervals = [ - [second, 1, durationSecond], - [second, 5, 5 * durationSecond], - [second, 15, 15 * durationSecond], - [second, 30, 30 * durationSecond], - [minute, 1, durationMinute], - [minute, 5, 5 * durationMinute], - [minute, 15, 15 * durationMinute], - [minute, 30, 30 * durationMinute], - [ hour, 1, durationHour ], - [ hour, 3, 3 * durationHour ], - [ hour, 6, 6 * durationHour ], - [ hour, 12, 12 * durationHour ], - [ day, 1, durationDay ], - [ day, 2, 2 * durationDay ], - [ week, 1, durationWeek ], - [ month, 1, durationMonth ], - [ month, 3, 3 * durationMonth ], - [ year, 1, durationYear ] - ]; - - function tickFormat(date) { - return (second(date) < date ? formatMillisecond - : minute(date) < date ? formatSecond - : hour(date) < date ? formatMinute - : day(date) < date ? formatHour - : month(date) < date ? (week(date) < date ? formatDay : formatWeek) - : year(date) < date ? formatMonth - : formatYear)(date); - } - - function tickInterval(interval, start, stop) { - if (interval == null) interval = 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 === "number") { - var target = Math.abs(stop - start) / interval, - i = d3Array.bisector(function(i) { return i[2]; }).right(tickIntervals, target), - step; - if (i === tickIntervals.length) { - step = d3Array.tickStep(start / durationYear, stop / durationYear, interval); - interval = year; - } else if (i) { - i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - step = i[1]; - interval = i[0]; - } else { - step = Math.max(d3Array.tickStep(start, stop, interval), 1); - interval = millisecond; - } - return interval.every(step); - } - - return interval; - } - - scale.invert = function(y) { - return new Date(invert(y)); - }; - - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number$1)) : domain().map(date); - }; - - scale.ticks = function(interval) { - var d = domain(), - t0 = d[0], - t1 = d[d.length - 1], - r = t1 < t0, - t; - if (r) t = t0, t0 = t1, t1 = t; - t = tickInterval(interval, t0, t1); - t = t ? t.range(t0, t1 + 1) : []; // inclusive stop - return r ? t.reverse() : t; - }; - - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - - scale.nice = function(interval) { - var d = domain(); - return (interval = tickInterval(interval, d[0], d[d.length - 1])) - ? domain(nice(d, interval)) - : scale; - }; - - scale.copy = function() { - return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); - }; - - return scale; -} - -function time() { - return initRange.apply(calendar(d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3Time.timeMillisecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); -} - -function utcTime() { - return initRange.apply(calendar(d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3Time.utcMillisecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); -} - -function transformer$1() { - var x0 = 0, - x1 = 1, - t0, - t1, - k10, - transform, - interpolator = identity, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; - }; - } - - scale.range = range(d3Interpolate.interpolate); - - scale.rangeRound = range(d3Interpolate.interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === 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 = linearish(transformer$1()(identity)); - - scale.copy = function() { - return copy$1(scale, sequential()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function sequentialLog() { - var scale = loggish(transformer$1()).domain([1, 10]); - - scale.copy = function() { - return copy$1(scale, sequentialLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function sequentialSymlog() { - var scale = symlogish(transformer$1()); - - scale.copy = function() { - return copy$1(scale, sequentialSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function sequentialPow() { - var scale = powish(transformer$1()); - - scale.copy = 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 = [], - interpolator = identity; - - function scale(x) { - if (!isNaN(x = +x)) return interpolator((d3Array.bisect(domain, x, 1) - 1) / (domain.length - 1)); - } - - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort(d3Array.ascending); - return scale; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - scale.range = function() { - return domain.map((d, i) => interpolator(i / (domain.length - 1))); - }; - - scale.quantiles = function(n) { - return Array.from({length: n + 1}, (_, i) => d3Array.quantile(domain, i / n)); - }; - - scale.copy = function() { - return sequentialQuantile(interpolator).domain(domain); - }; - - return initInterpolator.apply(scale, arguments); -} - -function transformer$2() { - var x0 = 0, - x1 = 0.5, - x2 = 1, - s = 1, - t0, - t1, - t2, - k10, - k21, - interpolator = identity, - transform, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = d3Interpolate.piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - - scale.range = range(d3Interpolate.interpolate); - - scale.rangeRound = range(d3Interpolate.interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; -} - -function diverging() { - var scale = linearish(transformer$2()(identity)); - - scale.copy = function() { - return copy$1(scale, diverging()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingLog() { - var scale = loggish(transformer$2()).domain([0.1, 1, 10]); - - scale.copy = function() { - return copy$1(scale, divergingLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingSymlog() { - var scale = symlogish(transformer$2()); - - scale.copy = function() { - return copy$1(scale, divergingSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingPow() { - var scale = powish(transformer$2()); - - scale.copy = function() { - return copy$1(scale, divergingPow()).exponent(scale.exponent()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingSqrt() { - return divergingPow.apply(null, arguments).exponent(0.5); -} - -exports.scaleBand = band; -exports.scaleDiverging = diverging; -exports.scaleDivergingLog = divergingLog; -exports.scaleDivergingPow = divergingPow; -exports.scaleDivergingSqrt = divergingSqrt; -exports.scaleDivergingSymlog = divergingSymlog; -exports.scaleIdentity = identity$1; -exports.scaleImplicit = implicit; -exports.scaleLinear = linear; -exports.scaleLog = log; -exports.scaleOrdinal = ordinal; -exports.scalePoint = point; -exports.scalePow = pow; -exports.scaleQuantile = quantile; -exports.scaleQuantize = quantize; -exports.scaleRadial = radial; -exports.scaleSequential = sequential; -exports.scaleSequentialLog = sequentialLog; -exports.scaleSequentialPow = sequentialPow; -exports.scaleSequentialQuantile = sequentialQuantile; -exports.scaleSequentialSqrt = sequentialSqrt; -exports.scaleSequentialSymlog = sequentialSymlog; -exports.scaleSqrt = sqrt; -exports.scaleSymlog = symlog; -exports.scaleThreshold = threshold; -exports.scaleTime = time; -exports.scaleUtc = utcTime; -exports.tickFormat = tickFormat; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-scale/dist/d3-scale.min.js b/node_modules/d3-scale/dist/d3-scale.min.js deleted file mode 100644 index d85996d..0000000 --- a/node_modules/d3-scale/dist/d3-scale.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-scale/ v3.2.1 Copyright 2019 Mike Bostock -!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-interpolate"),require("d3-format"),require("d3-time"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-interpolate","d3-format","d3-time","d3-time-format"],t):t((n=n||self).d3=n.d3||{},n.d3,n.d3,n.d3,n.d3,n.d3)}(this,function(n,t,r,e,u,i){"use strict";function o(n,t){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(t).domain(n)}return this}function a(n,t){switch(arguments.length){case 0:break;case 1:"function"==typeof n?this.interpolator(n):this.range(n);break;default:this.domain(n),"function"==typeof t?this.interpolator(t):this.range(t)}return this}const c=Symbol("implicit");function f(){var n=new Map,t=[],r=[],e=c;function u(u){var i=u+"",o=n.get(i);if(!o){if(e!==c)return e;n.set(i,o=t.push(u))}return r[(o-1)%r.length]}return u.domain=function(r){if(!arguments.length)return t.slice();t=[],n=new Map;for(const e of r){const r=e+"";n.has(r)||n.set(r,t.push(e))}return u},u.range=function(n){return arguments.length?(r=Array.from(n),u):r.slice()},u.unknown=function(n){return arguments.length?(e=n,u):e},u.copy=function(){return f(t,r).unknown(e)},o.apply(u,arguments),u}function l(){var n,r,e=f().unknown(void 0),u=e.domain,i=e.range,a=0,c=1,p=!1,h=0,s=0,g=.5;function m(){var e=u().length,o=ct&&(r=n,n=t,t=r),l=function(r){return Math.max(n,Math.min(t,r))}),u=e>2?d:m,i=o=null,y}function y(t){return isNaN(t=+t)?e:(i||(i=u(a.map(n),c,f)))(n(l(t)))}return y.invert=function(e){return l(t((o||(o=u(c,a.map(n),r.interpolateNumber)))(e)))},y.domain=function(n){return arguments.length?(a=Array.from(n,p),g()):a.slice()},y.range=function(n){return arguments.length?(c=Array.from(n),g()):c.slice()},y.rangeRound=function(n){return c=Array.from(n),f=r.interpolateRound,g()},y.clamp=function(n){return arguments.length?(l=!!n||s,g()):l!==s},y.interpolate=function(n){return arguments.length?(f=n,g()):f},y.unknown=function(n){return arguments.length?(e=n,y):e},function(r,e){return n=r,t=e,g()}}function M(){return v()(s,s)}function k(n,r,u,i){var o,a=t.tickStep(n,r,u);switch((i=e.formatSpecifier(null==i?",f":i)).type){case"s":var c=Math.max(Math.abs(n),Math.abs(r));return null!=i.precision||isNaN(o=e.precisionPrefix(a,c))||(i.precision=o),e.formatPrefix(i,c);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=e.precisionRound(a,Math.max(Math.abs(n),Math.abs(r))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=e.precisionFixed(a))||(i.precision=o-2*("%"===i.type))}return e.format(i)}function w(n){var r=n.domain;return n.ticks=function(n){var e=r();return t.ticks(e[0],e[e.length-1],null==n?10:n)},n.tickFormat=function(n,t){var e=r();return k(e[0],e[e.length-1],null==n?10:n,t)},n.nice=function(e){null==e&&(e=10);var u,i=r(),o=0,a=i.length-1,c=i[o],f=i[a];return f0?(c=Math.floor(c/u)*u,f=Math.ceil(f/u)*u,u=t.tickIncrement(c,f,e)):u<0&&(c=Math.ceil(c*u)/u,f=Math.floor(f*u)/u,u=t.tickIncrement(c,f,e)),u>0?(i[o]=Math.floor(c/u)*u,i[a]=Math.ceil(f/u)*u,r(i)):u<0&&(i[o]=Math.ceil(c*u)/u,i[a]=Math.floor(f*u)/u,r(i)),n},n}function N(n,t){var r,e=0,u=(n=n.slice()).length-1,i=n[e],o=n[u];return o0){for(;s<=g;++s)for(p=1,l=u(s);pf)break;d.push(h)}}else for(;s<=g;++s)for(p=a-1,l=u(s);p>=1;--p)if(!((h=l*p)f)break;d.push(h)}2*d.length0?i[t-1]:e[0],t=i?[a[i-1],u]:[a[t-1],a[t]]},f.unknown=function(n){return arguments.length?(r=n,f):f},f.thresholds=function(){return a.slice()},f.copy=function(){return n().domain([e,u]).range(c).unknown(r)},o.apply(w(f),arguments)},n.scaleRadial=function n(){var t,r=M(),e=[0,1],u=!1;function i(n){var e=function(n){return Math.sign(n)*Math.sqrt(Math.abs(n))}(r(n));return isNaN(e)?t:u?Math.round(e):e}return i.invert=function(n){return r.invert(U(n))},i.domain=function(n){return arguments.length?(r.domain(n),i):r.domain()},i.range=function(n){return arguments.length?(r.range((e=Array.from(n,p)).map(U)),i):e.slice()},i.rangeRound=function(n){return i.range(n).round(!0)},i.round=function(n){return arguments.length?(u=!!n,i):u},i.clamp=function(n){return arguments.length?(r.clamp(n),i):r.clamp()},i.unknown=function(n){return arguments.length?(t=n,i):t},i.copy=function(){return n(r.domain(),e).round(u).clamp(r.clamp()).unknown(t)},o.apply(i,arguments),w(i)},n.scaleSequential=function n(){var t=w(K()(s));return t.copy=function(){return V(t,n())},a.apply(t,arguments)},n.scaleSequentialLog=function n(){var t=I(K()).domain([1,10]);return t.copy=function(){return V(t,n()).base(t.base())},a.apply(t,arguments)},n.scaleSequentialPow=X,n.scaleSequentialQuantile=function n(){var r=[],e=s;function u(n){if(!isNaN(n=+n))return e((t.bisect(r,n,1)-1)/(r.length-1))}return u.domain=function(n){if(!arguments.length)return r.slice();r=[];for(let t of n)null==t||isNaN(t=+t)||r.push(t);return r.sort(t.ascending),u},u.interpolator=function(n){return arguments.length?(e=n,u):e},u.range=function(){return r.map((n,t)=>e(t/(r.length-1)))},u.quantiles=function(n){return Array.from({length:n+1},(e,u)=>t.quantile(r,u/n))},u.copy=function(){return n(e).domain(r)},a.apply(u,arguments)},n.scaleSequentialSqrt=function(){return X.apply(null,arguments).exponent(.5)},n.scaleSequentialSymlog=function n(){var t=F(K());return t.copy=function(){return V(t,n()).constant(t.constant())},a.apply(t,arguments)},n.scaleSqrt=function(){return Q.apply(null,arguments).exponent(.5)},n.scaleSymlog=function n(){var t=F(v());return t.copy=function(){return y(t,n()).constant(t.constant())},o.apply(t,arguments)},n.scaleThreshold=function n(){var r,e=[.5],u=[0,1],i=1;function a(n){return n<=n?u[t.bisect(e,n,0,i)]:r}return a.domain=function(n){return arguments.length?(e=Array.from(n),i=Math.min(e.length,u.length-1),a):e.slice()},a.range=function(n){return arguments.length?(u=Array.from(n),i=Math.min(e.length,u.length-1),a):u.slice()},a.invertExtent=function(n){var t=u.indexOf(n);return[e[t-1],e[t]]},a.unknown=function(n){return arguments.length?(r=n,a):r},a.copy=function(){return n().domain(e).range(u).unknown(r)},o.apply(a,arguments)},n.scaleTime=function(){return o.apply(J(u.timeYear,u.timeMonth,u.timeWeek,u.timeDay,u.timeHour,u.timeMinute,u.timeSecond,u.timeMillisecond,i.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},n.scaleUtc=function(){return o.apply(J(u.utcYear,u.utcMonth,u.utcWeek,u.utcDay,u.utcHour,u.utcMinute,u.utcSecond,u.utcMillisecond,i.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},n.tickFormat=k,Object.defineProperty(n,"__esModule",{value:!0})}); diff --git a/node_modules/d3-scale/package.json b/node_modules/d3-scale/package.json deleted file mode 100644 index 23de984..0000000 --- a/node_modules/d3-scale/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "_from": "d3-scale@^3.2.1", - "_id": "d3-scale@3.2.1", - "_inBundle": false, - "_integrity": "sha512-huz5byJO/6MPpz6Q8d4lg7GgSpTjIZW/l+1MQkzKfu2u8P6hjaXaStOpmyrD6ymKoW87d2QVFCKvSjLwjzx/rA==", - "_location": "/d3-scale", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "d3-scale@^3.2.1", - "name": "d3-scale", - "escapedName": "d3-scale", - "rawSpec": "^3.2.1", - "saveSpec": null, - "fetchSpec": "^3.2.1" - }, - "_requiredBy": [ - "/vega-scale" - ], - "_resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.1.tgz", - "_shasum": "da1684adce7261b4bc7a76fe193d887f0e909e69", - "_spec": "d3-scale@^3.2.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-scale", - "author": { - "name": "Mike Bostock", - "url": "http://bost.ocks.org/mike" - }, - "bugs": { - "url": "https://github.com/d3/d3-scale/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "1.2.0 - 2", - "d3-format": "1", - "d3-interpolate": "^1.2.0", - "d3-time": "1", - "d3-time-format": "2" - }, - "deprecated": false, - "description": "Encodings that map abstract data to visual representation.", - "devDependencies": { - "d3-color": "1", - "eslint": "6", - "rollup": "1", - "rollup-plugin-terser": "5", - "tape": "4" - }, - "files": [ - "dist/**/*.js", - "src/**/*.js" - ], - "homepage": "https://d3js.org/d3-scale/", - "jsdelivr": "dist/d3-scale.min.js", - "keywords": [ - "d3", - "d3-module", - "scale", - "visualization" - ], - "license": "BSD-3-Clause", - "main": "dist/d3-scale.js", - "module": "src/index.js", - "name": "d3-scale", - "repository": { - "type": "git", - "url": "git+https://github.com/d3/d3-scale.git" - }, - "scripts": { - "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js", - "prepublishOnly": "rm -rf dist && yarn test", - "pretest": "rollup -c", - "test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint src" - }, - "sideEffects": false, - "unpkg": "dist/d3-scale.min.js", - "version": "3.2.1" -} diff --git a/node_modules/d3-scale/src/band.js b/node_modules/d3-scale/src/band.js deleted file mode 100644 index 88e1fbd..0000000 --- a/node_modules/d3-scale/src/band.js +++ /dev/null @@ -1,101 +0,0 @@ -import {range as sequence} from "d3-array"; -import {initRange} from "./init.js"; -import ordinal from "./ordinal.js"; - -export default function band() { - var scale = ordinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - r0 = 0, - r1 = 1, - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = r1 < r0, - start = reverse ? r1 : r0, - stop = reverse ? r0 : r1; - step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); - var values = sequence(n).map(function(i) { return start + step * i; }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.range = function(_) { - return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1]; - }; - - scale.rangeRound = function(_) { - return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale(); - }; - - scale.bandwidth = function() { - return bandwidth; - }; - - scale.step = function() { - return step; - }; - - scale.round = function(_) { - return arguments.length ? (round = !!_, rescale()) : round; - }; - - scale.padding = function(_) { - return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner; - }; - - scale.paddingInner = function(_) { - return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner; - }; - - scale.paddingOuter = function(_) { - return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter; - }; - - scale.align = function(_) { - return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; - }; - - scale.copy = function() { - return band(domain(), [r0, r1]) - .round(round) - .paddingInner(paddingInner) - .paddingOuter(paddingOuter) - .align(align); - }; - - return initRange.apply(rescale(), arguments); -} - -function pointish(scale) { - var copy = scale.copy; - - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - delete scale.paddingOuter; - - scale.copy = function() { - return pointish(copy()); - }; - - return scale; -} - -export function point() { - return pointish(band.apply(null, arguments).paddingInner(1)); -} diff --git a/node_modules/d3-scale/src/colors.js b/node_modules/d3-scale/src/colors.js deleted file mode 100644 index 0ae5cc9..0000000 --- a/node_modules/d3-scale/src/colors.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(s) { - return s.match(/.{6}/g).map(function(x) { - return "#" + x; - }); -} diff --git a/node_modules/d3-scale/src/constant.js b/node_modules/d3-scale/src/constant.js deleted file mode 100644 index b7d42e7..0000000 --- a/node_modules/d3-scale/src/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(x) { - return function() { - return x; - }; -} diff --git a/node_modules/d3-scale/src/continuous.js b/node_modules/d3-scale/src/continuous.js deleted file mode 100644 index 2dd1cf9..0000000 --- a/node_modules/d3-scale/src/continuous.js +++ /dev/null @@ -1,125 +0,0 @@ -import {bisect} from "d3-array"; -import {interpolate as interpolateValue, interpolateNumber, interpolateRound} from "d3-interpolate"; -import constant from "./constant.js"; -import number from "./number.js"; - -var unit = [0, 1]; - -export function identity(x) { - return x; -} - -function normalize(a, b) { - return (b -= (a = +a)) - ? function(x) { return (x - a) / b; } - : constant(isNaN(b) ? NaN : 0.5); -} - -function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = 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 corresponding parameter t in [0,1]. -// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. -function bimap(domain, range, interpolate) { - var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function(x) { return r0(d0(x)); }; -} - -function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, - d = new Array(j), - r = new Array(j), - i = -1; - - // Reverse descending domains. - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - - while (++i < j) { - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - - return function(x) { - var i = bisect(domain, x, 1, j) - 1; - return r[i](d[i](x)); - }; -} - -export function copy(source, target) { - return target - .domain(source.domain()) - .range(source.range()) - .interpolate(source.interpolate()) - .clamp(source.clamp()) - .unknown(source.unknown()); -} - -export function transformer() { - var domain = unit, - range = unit, - interpolate = interpolateValue, - transform, - untransform, - unknown, - clamp = identity, - piecewise, - output, - input; - - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); - } - - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y))); - }; - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.rangeRound = function(_) { - return range = Array.from(_), interpolate = interpolateRound, rescale(); - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity; - }; - - scale.interpolate = function(_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t, u) { - transform = t, untransform = u; - return rescale(); - }; -} - -export default function continuous() { - return transformer()(identity, identity); -} diff --git a/node_modules/d3-scale/src/diverging.js b/node_modules/d3-scale/src/diverging.js deleted file mode 100644 index f590748..0000000 --- a/node_modules/d3-scale/src/diverging.js +++ /dev/null @@ -1,104 +0,0 @@ -import {interpolate, interpolateRound, piecewise} from "d3-interpolate"; -import {identity} from "./continuous.js"; -import {initInterpolator} from "./init.js"; -import {linearish} from "./linear.js"; -import {loggish} from "./log.js"; -import {copy} from "./sequential.js"; -import {symlogish} from "./symlog.js"; -import {powish} from "./pow.js"; - -function transformer() { - var x0 = 0, - x1 = 0.5, - x2 = 1, - s = 1, - t0, - t1, - t2, - k10, - k21, - interpolator = identity, - transform, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - - scale.range = range(interpolate); - - scale.rangeRound = range(interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; -} - -export default function diverging() { - var scale = linearish(transformer()(identity)); - - scale.copy = function() { - return copy(scale, diverging()); - }; - - return initInterpolator.apply(scale, arguments); -} - -export function divergingLog() { - var scale = loggish(transformer()).domain([0.1, 1, 10]); - - scale.copy = function() { - return copy(scale, divergingLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); -} - -export function divergingSymlog() { - var scale = symlogish(transformer()); - - scale.copy = function() { - return copy(scale, divergingSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); -} - -export function divergingPow() { - var scale = powish(transformer()); - - scale.copy = function() { - return copy(scale, divergingPow()).exponent(scale.exponent()); - }; - - return initInterpolator.apply(scale, arguments); -} - -export function divergingSqrt() { - return divergingPow.apply(null, arguments).exponent(0.5); -} diff --git a/node_modules/d3-scale/src/identity.js b/node_modules/d3-scale/src/identity.js deleted file mode 100644 index af41c59..0000000 --- a/node_modules/d3-scale/src/identity.js +++ /dev/null @@ -1,28 +0,0 @@ -import {linearish} from "./linear.js"; -import number from "./number.js"; - -export default function identity(domain) { - var unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : x; - } - - scale.invert = scale; - - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, number), scale) : domain.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return identity(domain).unknown(unknown); - }; - - domain = arguments.length ? Array.from(domain, number) : [0, 1]; - - return linearish(scale); -} diff --git a/node_modules/d3-scale/src/index.js b/node_modules/d3-scale/src/index.js deleted file mode 100644 index 510103c..0000000 --- a/node_modules/d3-scale/src/index.js +++ /dev/null @@ -1,78 +0,0 @@ -export { - default as scaleBand, - point as scalePoint -} from "./band.js"; - -export { - default as scaleIdentity -} from "./identity.js"; - -export { - default as scaleLinear -} from "./linear.js"; - -export { - default as scaleLog -} from "./log.js"; - -export { - default as scaleSymlog -} from "./symlog.js"; - -export { - default as scaleOrdinal, - implicit as scaleImplicit -} from "./ordinal.js"; - -export { - default as scalePow, - sqrt as scaleSqrt -} from "./pow.js"; - -export { - default as scaleRadial -} from "./radial.js"; - -export { - default as scaleQuantile -} from "./quantile.js"; - -export { - default as scaleQuantize -} from "./quantize.js"; - -export { - default as scaleThreshold -} from "./threshold.js"; - -export { - default as scaleTime -} from "./time.js"; - -export { - default as scaleUtc -} from "./utcTime.js"; - -export { - default as scaleSequential, - sequentialLog as scaleSequentialLog, - sequentialPow as scaleSequentialPow, - sequentialSqrt as scaleSequentialSqrt, - sequentialSymlog as scaleSequentialSymlog -} from "./sequential.js"; - -export { - default as scaleSequentialQuantile -} from "./sequentialQuantile.js"; - -export { - default as scaleDiverging, - divergingLog as scaleDivergingLog, - divergingPow as scaleDivergingPow, - divergingSqrt as scaleDivergingSqrt, - divergingSymlog as scaleDivergingSymlog -} from "./diverging.js"; - -export { - default as tickFormat -} from "./tickFormat.js"; diff --git a/node_modules/d3-scale/src/init.js b/node_modules/d3-scale/src/init.js deleted file mode 100644 index 61f51a0..0000000 --- a/node_modules/d3-scale/src/init.js +++ /dev/null @@ -1,26 +0,0 @@ -export 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; -} - -export function initInterpolator(domain, interpolator) { - switch (arguments.length) { - case 0: break; - case 1: { - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); - break; - } - default: { - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; - } - } - return this; -} diff --git a/node_modules/d3-scale/src/linear.js b/node_modules/d3-scale/src/linear.js deleted file mode 100644 index b91f712..0000000 --- a/node_modules/d3-scale/src/linear.js +++ /dev/null @@ -1,72 +0,0 @@ -import {ticks, tickIncrement} from "d3-array"; -import continuous, {copy} from "./continuous.js"; -import {initRange} from "./init.js"; -import tickFormat from "./tickFormat.js"; - -export function linearish(scale) { - var domain = scale.domain; - - scale.ticks = function(count) { - var d = domain(); - return ticks(d[0], d[d.length - 1], count == null ? 10 : count); - }; - - scale.tickFormat = function(count, specifier) { - var d = domain(); - return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - - scale.nice = function(count) { - if (count == null) count = 10; - - var d = domain(), - i0 = 0, - i1 = d.length - 1, - start = d[i0], - stop = d[i1], - step; - - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - - step = tickIncrement(start, stop, count); - - if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - step = tickIncrement(start, stop, count); - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - step = tickIncrement(start, stop, count); - } - - if (step > 0) { - d[i0] = Math.floor(start / step) * step; - d[i1] = Math.ceil(stop / step) * step; - domain(d); - } else if (step < 0) { - d[i0] = Math.ceil(start * step) / step; - d[i1] = Math.floor(stop * step) / step; - domain(d); - } - - return scale; - }; - - return scale; -} - -export default function linear() { - var scale = continuous(); - - scale.copy = function() { - return copy(scale, linear()); - }; - - initRange.apply(scale, arguments); - - return linearish(scale); -} diff --git a/node_modules/d3-scale/src/log.js b/node_modules/d3-scale/src/log.js deleted file mode 100644 index ad3f231..0000000 --- a/node_modules/d3-scale/src/log.js +++ /dev/null @@ -1,146 +0,0 @@ -import {ticks} from "d3-array"; -import {format} from "d3-format"; -import nice from "./nice.js"; -import {copy, transformer} from "./continuous.js"; -import {initRange} from "./init.js"; - -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 === 10 ? pow10 - : base === Math.E ? Math.exp - : function(x) { return Math.pow(base, x); }; -} - -function logp(base) { - return base === Math.E ? Math.log - : base === 10 && Math.log10 - || base === 2 && Math.log2 - || (base = Math.log(base), function(x) { return Math.log(x) / base; }); -} - -function reflect(f) { - return function(x) { - return -f(-x); - }; -} - -export function loggish(transform) { - var scale = transform(transformLog, transformExp), - domain = scale.domain, - base = 10, - logs, - pows; - - function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else { - transform(transformLog, transformExp); - } - return scale; - } - - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.ticks = function(count) { - var d = domain(), - u = d[0], - v = d[d.length - 1], - r; - - if (r = v < u) i = u, u = v, v = i; - - var i = logs(u), - j = logs(v), - p, - k, - t, - n = count == null ? 10 : +count, - z = []; - - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for (; i <= j; ++i) { - for (k = 1, p = pows(i); k < base; ++k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } else for (; i <= j; ++i) { - for (k = base - 1, p = pows(i); k >= 1; --k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } - if (z.length * 2 < n) z = ticks(u, v, n); - } else { - z = ticks(i, j, Math.min(j - i, n)).map(pows); - } - - return r ? z.reverse() : z; - }; - - scale.tickFormat = function(count, specifier) { - if (specifier == null) specifier = base === 10 ? ".0e" : ","; - if (typeof specifier !== "function") specifier = format(specifier); - if (count === Infinity) return specifier; - if (count == null) count = 10; - var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - return function(d) { - var i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; - }; - - scale.nice = 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; -} - -export default function log() { - var scale = loggish(transformer()).domain([1, 10]); - - scale.copy = function() { - return copy(scale, log()).base(scale.base()); - }; - - initRange.apply(scale, arguments); - - return scale; -} diff --git a/node_modules/d3-scale/src/nice.js b/node_modules/d3-scale/src/nice.js deleted file mode 100644 index b377c76..0000000 --- a/node_modules/d3-scale/src/nice.js +++ /dev/null @@ -1,18 +0,0 @@ -export default function(domain, interval) { - domain = domain.slice(); - - var i0 = 0, - i1 = domain.length - 1, - x0 = domain[i0], - x1 = domain[i1], - t; - - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - - domain[i0] = interval.floor(x0); - domain[i1] = interval.ceil(x1); - return domain; -} diff --git a/node_modules/d3-scale/src/number.js b/node_modules/d3-scale/src/number.js deleted file mode 100644 index 8cf8caa..0000000 --- a/node_modules/d3-scale/src/number.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x) { - return +x; -} diff --git a/node_modules/d3-scale/src/ordinal.js b/node_modules/d3-scale/src/ordinal.js deleted file mode 100644 index e98f600..0000000 --- a/node_modules/d3-scale/src/ordinal.js +++ /dev/null @@ -1,46 +0,0 @@ -import {initRange} from "./init.js"; - -export const implicit = Symbol("implicit"); - -export default function ordinal() { - var index = new Map(), - domain = [], - range = [], - unknown = implicit; - - function scale(d) { - var key = d + "", i = index.get(key); - if (!i) { - if (unknown !== implicit) return unknown; - index.set(key, i = domain.push(d)); - } - return range[(i - 1) % range.length]; - } - - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new Map(); - for (const value of _) { - const key = value + ""; - if (index.has(key)) continue; - index.set(key, domain.push(value)); - } - return scale; - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return ordinal(domain, range).unknown(unknown); - }; - - initRange.apply(scale, arguments); - - return scale; -} diff --git a/node_modules/d3-scale/src/pow.js b/node_modules/d3-scale/src/pow.js deleted file mode 100644 index 8146f1c..0000000 --- a/node_modules/d3-scale/src/pow.js +++ /dev/null @@ -1,50 +0,0 @@ -import {linearish} from "./linear.js"; -import {copy, identity, transformer} from "./continuous.js"; -import {initRange} from "./init.js"; - -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; -} - -export function powish(transform) { - var scale = transform(identity, identity), - exponent = 1; - - function rescale() { - return exponent === 1 ? transform(identity, identity) - : exponent === 0.5 ? transform(transformSqrt, transformSquare) - : transform(transformPow(exponent), transformPow(1 / exponent)); - } - - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - - return linearish(scale); -} - -export default function pow() { - var scale = powish(transformer()); - - scale.copy = function() { - return copy(scale, pow()).exponent(scale.exponent()); - }; - - initRange.apply(scale, arguments); - - return scale; -} - -export function sqrt() { - return pow.apply(null, arguments).exponent(0.5); -} diff --git a/node_modules/d3-scale/src/quantile.js b/node_modules/d3-scale/src/quantile.js deleted file mode 100644 index 61c04c0..0000000 --- a/node_modules/d3-scale/src/quantile.js +++ /dev/null @@ -1,57 +0,0 @@ -import {ascending, bisect, quantile as threshold} from "d3-array"; -import {initRange} from "./init.js"; - -export default function quantile() { - var domain = [], - range = [], - thresholds = [], - unknown; - - function rescale() { - var i = 0, n = Math.max(1, range.length); - thresholds = new Array(n - 1); - while (++i < n) thresholds[i - 1] = threshold(domain, i / n); - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : range[bisect(thresholds, x)]; - } - - scale.invertExtent = function(y) { - var i = 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 = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort(ascending); - return rescale(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.quantiles = function() { - return thresholds.slice(); - }; - - scale.copy = function() { - return quantile() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); -} diff --git a/node_modules/d3-scale/src/quantize.js b/node_modules/d3-scale/src/quantize.js deleted file mode 100644 index 735a531..0000000 --- a/node_modules/d3-scale/src/quantize.js +++ /dev/null @@ -1,56 +0,0 @@ -import {bisect} from "d3-array"; -import {linearish} from "./linear.js"; -import {initRange} from "./init.js"; - -export default function quantize() { - var x0 = 0, - x1 = 1, - n = 1, - domain = [0.5], - range = [0, 1], - unknown; - - function scale(x) { - return x <= x ? range[bisect(domain, x, 0, n)] : unknown; - } - - function rescale() { - var i = -1; - domain = new Array(n); - while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; - }; - - scale.range = function(_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [NaN, NaN] - : i < 1 ? [x0, domain[0]] - : i >= n ? [domain[n - 1], x1] - : [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - - scale.thresholds = function() { - return domain.slice(); - }; - - scale.copy = function() { - return quantize() - .domain([x0, x1]) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(linearish(scale), arguments); -} diff --git a/node_modules/d3-scale/src/radial.js b/node_modules/d3-scale/src/radial.js deleted file mode 100644 index 5c00cc6..0000000 --- a/node_modules/d3-scale/src/radial.js +++ /dev/null @@ -1,63 +0,0 @@ -import continuous from "./continuous.js"; -import {initRange} from "./init.js"; -import {linearish} from "./linear.js"; -import number from "./number.js"; - -function square(x) { - return Math.sign(x) * x * x; -} - -function unsquare(x) { - return Math.sign(x) * Math.sqrt(Math.abs(x)); -} - -export default function radial() { - var squared = continuous(), - range = [0, 1], - round = false, - unknown; - - function scale(x) { - var y = unsquare(squared(x)); - return isNaN(y) ? unknown : round ? Math.round(y) : y; - } - - scale.invert = function(y) { - return squared.invert(square(y)); - }; - - scale.domain = function(_) { - return arguments.length ? (squared.domain(_), scale) : squared.domain(); - }; - - scale.range = function(_) { - return arguments.length ? (squared.range((range = Array.from(_, number)).map(square)), scale) : range.slice(); - }; - - scale.rangeRound = function(_) { - return scale.range(_).round(true); - }; - - scale.round = function(_) { - return arguments.length ? (round = !!_, scale) : round; - }; - - scale.clamp = function(_) { - return arguments.length ? (squared.clamp(_), scale) : squared.clamp(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return radial(squared.domain(), range) - .round(round) - .clamp(squared.clamp()) - .unknown(unknown); - }; - - initRange.apply(scale, arguments); - - return linearish(scale); -} diff --git a/node_modules/d3-scale/src/sequential.js b/node_modules/d3-scale/src/sequential.js deleted file mode 100644 index bd38dba..0000000 --- a/node_modules/d3-scale/src/sequential.js +++ /dev/null @@ -1,107 +0,0 @@ -import {interpolate, interpolateRound} from "d3-interpolate"; -import {identity} from "./continuous.js"; -import {initInterpolator} from "./init.js"; -import {linearish} from "./linear.js"; -import {loggish} from "./log.js"; -import {symlogish} from "./symlog.js"; -import {powish} from "./pow.js"; - -function transformer() { - var x0 = 0, - x1 = 1, - t0, - t1, - k10, - transform, - interpolator = identity, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; - }; - } - - scale.range = range(interpolate); - - scale.rangeRound = range(interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0); - return scale; - }; -} - -export function copy(source, target) { - return target - .domain(source.domain()) - .interpolator(source.interpolator()) - .clamp(source.clamp()) - .unknown(source.unknown()); -} - -export default function sequential() { - var scale = linearish(transformer()(identity)); - - scale.copy = function() { - return copy(scale, sequential()); - }; - - return initInterpolator.apply(scale, arguments); -} - -export function sequentialLog() { - var scale = loggish(transformer()).domain([1, 10]); - - scale.copy = function() { - return copy(scale, sequentialLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); -} - -export function sequentialSymlog() { - var scale = symlogish(transformer()); - - scale.copy = function() { - return copy(scale, sequentialSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); -} - -export function sequentialPow() { - var scale = powish(transformer()); - - scale.copy = function() { - return copy(scale, sequentialPow()).exponent(scale.exponent()); - }; - - return initInterpolator.apply(scale, arguments); -} - -export function sequentialSqrt() { - return sequentialPow.apply(null, arguments).exponent(0.5); -} diff --git a/node_modules/d3-scale/src/sequentialQuantile.js b/node_modules/d3-scale/src/sequentialQuantile.js deleted file mode 100644 index 132ebd0..0000000 --- a/node_modules/d3-scale/src/sequentialQuantile.js +++ /dev/null @@ -1,38 +0,0 @@ -import {ascending, bisect, quantile} from "d3-array"; -import {identity} from "./continuous.js"; -import {initInterpolator} from "./init.js"; - -export default function sequentialQuantile() { - var domain = [], - interpolator = identity; - - function scale(x) { - if (!isNaN(x = +x)) return interpolator((bisect(domain, x, 1) - 1) / (domain.length - 1)); - } - - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort(ascending); - return scale; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - scale.range = function() { - return domain.map((d, i) => interpolator(i / (domain.length - 1))); - }; - - scale.quantiles = function(n) { - return Array.from({length: n + 1}, (_, i) => quantile(domain, i / n)); - }; - - scale.copy = function() { - return sequentialQuantile(interpolator).domain(domain); - }; - - return initInterpolator.apply(scale, arguments); -} diff --git a/node_modules/d3-scale/src/symlog.js b/node_modules/d3-scale/src/symlog.js deleted file mode 100644 index 125fa7b..0000000 --- a/node_modules/d3-scale/src/symlog.js +++ /dev/null @@ -1,35 +0,0 @@ -import {linearish} from "./linear.js"; -import {copy, transformer} from "./continuous.js"; -import {initRange} from "./init.js"; - -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; - }; -} - -export function symlogish(transform) { - var c = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - - return linearish(scale); -} - -export default function symlog() { - var scale = symlogish(transformer()); - - scale.copy = function() { - return copy(scale, symlog()).constant(scale.constant()); - }; - - return initRange.apply(scale, arguments); -} diff --git a/node_modules/d3-scale/src/threshold.js b/node_modules/d3-scale/src/threshold.js deleted file mode 100644 index 79d3559..0000000 --- a/node_modules/d3-scale/src/threshold.js +++ /dev/null @@ -1,39 +0,0 @@ -import {bisect} from "d3-array"; -import {initRange} from "./init.js"; - -export default function threshold() { - var domain = [0.5], - range = [0, 1], - unknown, - n = 1; - - function scale(x) { - return x <= x ? range[bisect(domain, x, 0, n)] : unknown; - } - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return threshold() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); -} diff --git a/node_modules/d3-scale/src/tickFormat.js b/node_modules/d3-scale/src/tickFormat.js deleted file mode 100644 index 2f370ee..0000000 --- a/node_modules/d3-scale/src/tickFormat.js +++ /dev/null @@ -1,29 +0,0 @@ -import {tickStep} from "d3-array"; -import {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from "d3-format"; - -export default function(start, stop, count, specifier) { - var step = tickStep(start, stop, count), - precision; - specifier = formatSpecifier(specifier == null ? ",f" : specifier); - switch (specifier.type) { - case "s": { - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision; - return formatPrefix(specifier, value); - } - case "": - case "e": - case "g": - case "p": - case "r": { - if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - } - case "f": - case "%": { - if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - return format(specifier); -} diff --git a/node_modules/d3-scale/src/time.js b/node_modules/d3-scale/src/time.js deleted file mode 100644 index bfe7839..0000000 --- a/node_modules/d3-scale/src/time.js +++ /dev/null @@ -1,136 +0,0 @@ -import {bisector, tickStep} from "d3-array"; -import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond} from "d3-time"; -import {timeFormat} from "d3-time-format"; -import continuous, {copy} from "./continuous.js"; -import {initRange} from "./init.js"; -import nice from "./nice.js"; - -var durationSecond = 1000, - durationMinute = durationSecond * 60, - durationHour = durationMinute * 60, - durationDay = durationHour * 24, - durationWeek = durationDay * 7, - durationMonth = durationDay * 30, - durationYear = durationDay * 365; - -function date(t) { - return new Date(t); -} - -function number(t) { - return t instanceof Date ? +t : +new Date(+t); -} - -export function calendar(year, month, week, day, hour, minute, second, millisecond, format) { - var scale = continuous(), - invert = scale.invert, - domain = scale.domain; - - var formatMillisecond = format(".%L"), - formatSecond = format(":%S"), - formatMinute = format("%I:%M"), - formatHour = format("%I %p"), - formatDay = format("%a %d"), - formatWeek = format("%b %d"), - formatMonth = format("%B"), - formatYear = format("%Y"); - - var tickIntervals = [ - [second, 1, durationSecond], - [second, 5, 5 * durationSecond], - [second, 15, 15 * durationSecond], - [second, 30, 30 * durationSecond], - [minute, 1, durationMinute], - [minute, 5, 5 * durationMinute], - [minute, 15, 15 * durationMinute], - [minute, 30, 30 * durationMinute], - [ hour, 1, durationHour ], - [ hour, 3, 3 * durationHour ], - [ hour, 6, 6 * durationHour ], - [ hour, 12, 12 * durationHour ], - [ day, 1, durationDay ], - [ day, 2, 2 * durationDay ], - [ week, 1, durationWeek ], - [ month, 1, durationMonth ], - [ month, 3, 3 * durationMonth ], - [ year, 1, durationYear ] - ]; - - function tickFormat(date) { - return (second(date) < date ? formatMillisecond - : minute(date) < date ? formatSecond - : hour(date) < date ? formatMinute - : day(date) < date ? formatHour - : month(date) < date ? (week(date) < date ? formatDay : formatWeek) - : year(date) < date ? formatMonth - : formatYear)(date); - } - - function tickInterval(interval, start, stop) { - if (interval == null) interval = 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 === "number") { - var target = Math.abs(stop - start) / interval, - i = bisector(function(i) { return i[2]; }).right(tickIntervals, target), - step; - if (i === tickIntervals.length) { - step = tickStep(start / durationYear, stop / durationYear, interval); - interval = year; - } else if (i) { - i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - step = i[1]; - interval = i[0]; - } else { - step = Math.max(tickStep(start, stop, interval), 1); - interval = millisecond; - } - return interval.every(step); - } - - return interval; - } - - scale.invert = function(y) { - return new Date(invert(y)); - }; - - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number)) : domain().map(date); - }; - - scale.ticks = function(interval) { - var d = domain(), - t0 = d[0], - t1 = d[d.length - 1], - r = t1 < t0, - t; - if (r) t = t0, t0 = t1, t1 = t; - t = tickInterval(interval, t0, t1); - t = t ? t.range(t0, t1 + 1) : []; // inclusive stop - return r ? t.reverse() : t; - }; - - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - - scale.nice = function(interval) { - var d = domain(); - return (interval = tickInterval(interval, d[0], d[d.length - 1])) - ? domain(nice(d, interval)) - : scale; - }; - - scale.copy = function() { - return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); - }; - - return scale; -} - -export default function() { - return initRange.apply(calendar(timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); -} diff --git a/node_modules/d3-scale/src/utcTime.js b/node_modules/d3-scale/src/utcTime.js deleted file mode 100644 index 1652a8e..0000000 --- a/node_modules/d3-scale/src/utcTime.js +++ /dev/null @@ -1,8 +0,0 @@ -import {calendar} from "./time.js"; -import {utcFormat} from "d3-time-format"; -import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcMillisecond} from "d3-time"; -import {initRange} from "./init.js"; - -export default function() { - return initRange.apply(calendar(utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcMillisecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); -} diff --git a/node_modules/d3-shape/LICENSE b/node_modules/d3-shape/LICENSE deleted file mode 100644 index 4f0b022..0000000 --- a/node_modules/d3-shape/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2015 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-shape/README.md b/node_modules/d3-shape/README.md deleted file mode 100644 index 8d4e8f4..0000000 --- a/node_modules/d3-shape/README.md +++ /dev/null @@ -1,1149 +0,0 @@ -# d3-shape - -Visualizations typically consist of discrete graphical marks, such as [symbols](#symbols), [arcs](#arcs), [lines](#lines) and [areas](#areas). While the rectangles of a bar chart may be easy enough to generate directly using [SVG](http://www.w3.org/TR/SVG/paths.html#PathData) or [Canvas](http://www.w3.org/TR/2dcontext/#canvaspathmethods), other shapes are complex, such as rounded annular sectors and centripetal Catmull–Rom splines. This module provides a variety of shape generators for your convenience. - -As with other aspects of D3, these shapes are driven by data: each shape generator exposes accessors that control how the input data are mapped to a visual representation. For example, you might define a line generator for a time series by [scaling](https://github.com/d3/d3-scale) fields of your data to fit the chart: - -```js -var line = d3.line() - .x(function(d) { return x(d.date); }) - .y(function(d) { return y(d.value); }); -``` - -This line generator can then be used to compute the `d` attribute of an SVG path element: - -```js -path.datum(data).attr("d", line); -``` - -Or you can use it to render to a Canvas 2D context: - -```js -line.context(context)(data); -``` - -For more, read [Introducing d3-shape](https://medium.com/@mbostock/introducing-d3-shape-73f8367e6d12). - -## Installing - -If you use NPM, `npm install d3-shape`. Otherwise, download the [latest release](https://github.com/d3/d3-shape/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-shape.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - - -``` - - -## API Reference - -* [Arcs](#arcs) -* [Pies](#pies) -* [Lines](#lines) -* [Areas](#areas) -* [Curves](#curves) -* [Custom Curves](#custom-curves) -* [Links](#links) -* [Symbols](#symbols) -* [Custom Symbol Types](#custom-symbol-types) -* [Stacks](#stacks) - -### Arcs - -[Pie Chart](http://bl.ocks.org/mbostock/8878e7fd82034f1d63cf)[Donut Chart](http://bl.ocks.org/mbostock/2394b23da1994fc202e1) - -The arc generator produces a [circular](https://en.wikipedia.org/wiki/Circular_sector) or [annular](https://en.wikipedia.org/wiki/Annulus_\(mathematics\)) sector, as in a pie or donut chart. If the difference between the [start](#arc_startAngle) and [end](#arc_endAngle) angles (the *angular span*) is greater than [τ](https://en.wikipedia.org/wiki/Turn_\(geometry\)#Tau_proposal), the arc generator will produce a complete circle or annulus. If it is less than τ, arcs may have [rounded corners](#arc_cornerRadius) and [angular padding](#arc_padAngle). Arcs are always centered at ⟨0,0⟩; use a transform (see: [SVG](http://www.w3.org/TR/SVG/coords.html#TransformAttribute), [Canvas](http://www.w3.org/TR/2dcontext/#transformations)) to move the arc to a different position. - -See also the [pie generator](#pies), which computes the necessary angles to represent an array of data as a pie or donut chart; these angles can then be passed to an arc generator. - -# d3.arc() · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -Constructs a new arc generator with the default settings. - -# arc(arguments…) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -Generates an arc for the given *arguments*. The *arguments* are arbitrary; they are simply propagated to the arc generator’s accessor functions along with the `this` object. For example, with the default settings, an object with radii and angles is expected: - -```js -var arc = d3.arc(); - -arc({ - innerRadius: 0, - outerRadius: 100, - startAngle: 0, - endAngle: Math.PI / 2 -}); // "M0,-100A100,100,0,0,1,100,0L0,0Z" -``` - -If the radii and angles are instead defined as constants, you can generate an arc without any arguments: - -```js -var arc = d3.arc() - .innerRadius(0) - .outerRadius(100) - .startAngle(0) - .endAngle(Math.PI / 2); - -arc(); // "M0,-100A100,100,0,0,1,100,0L0,0Z" -``` - -If the arc generator has a [context](#arc_context), then the arc is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls and this function returns void. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string is returned. - -# arc.centroid(arguments…) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -Computes the midpoint [*x*, *y*] of the center line of the arc that would be [generated](#_arc) by the given *arguments*. The *arguments* are arbitrary; they are simply propagated to the arc generator’s accessor functions along with the `this` object. To be consistent with the generated arc, the accessors must be deterministic, *i.e.*, return the same value given the same arguments. The midpoint is defined as ([startAngle](#arc_startAngle) + [endAngle](#arc_endAngle)) / 2 and ([innerRadius](#arc_innerRadius) + [outerRadius](#arc_outerRadius)) / 2. For example: - -[Circular Sector Centroids](http://bl.ocks.org/mbostock/9b5a2fd1ce1a146f27e4)[Annular Sector Centroids](http://bl.ocks.org/mbostock/c274877f647361f3df7d) - -Note that this is **not the geometric center** of the arc, which may be outside the arc; this method is merely a convenience for positioning labels. - -# arc.innerRadius([radius]) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -If *radius* is specified, sets the inner radius to the specified function or number and returns this arc generator. If *radius* is not specified, returns the current inner radius accessor, which defaults to: - -```js -function innerRadius(d) { - return d.innerRadius; -} -``` - -Specifying the inner radius as a function is useful for constructing a stacked polar bar chart, often in conjunction with a [sqrt scale](https://github.com/d3/d3-scale#sqrt). More commonly, a constant inner radius is used for a donut or pie chart. If the outer radius is smaller than the inner radius, the inner and outer radii are swapped. A negative value is treated as zero. - -# arc.outerRadius([radius]) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -If *radius* is specified, sets the outer radius to the specified function or number and returns this arc generator. If *radius* is not specified, returns the current outer radius accessor, which defaults to: - -```js -function outerRadius(d) { - return d.outerRadius; -} -``` - -Specifying the outer radius as a function is useful for constructing a coxcomb or polar bar chart, often in conjunction with a [sqrt scale](https://github.com/d3/d3-scale#sqrt). More commonly, a constant outer radius is used for a pie or donut chart. If the outer radius is smaller than the inner radius, the inner and outer radii are swapped. A negative value is treated as zero. - -# arc.cornerRadius([radius]) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -If *radius* is specified, sets the corner radius to the specified function or number and returns this arc generator. If *radius* is not specified, returns the current corner radius accessor, which defaults to: - -```js -function cornerRadius() { - return 0; -} -``` - -If the corner radius is greater than zero, the corners of the arc are rounded using circles of the given radius. For a circular sector, the two outer corners are rounded; for an annular sector, all four corners are rounded. The corner circles are shown in this diagram: - -[Rounded Circular Sectors](http://bl.ocks.org/mbostock/e5e3680f3079cf5c3437)[Rounded Annular Sectors](http://bl.ocks.org/mbostock/f41f50e06a6c04828b6e) - -The corner radius may not be larger than ([outerRadius](#arc_outerRadius) - [innerRadius](#arc_innerRadius)) / 2. In addition, for arcs whose angular span is less than π, the corner radius may be reduced as two adjacent rounded corners intersect. This is occurs more often with the inner corners. See the [arc corners animation](http://bl.ocks.org/mbostock/b7671cb38efdfa5da3af) for illustration. - -# arc.startAngle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -If *angle* is specified, sets the start angle to the specified function or number and returns this arc generator. If *angle* is not specified, returns the current start angle accessor, which defaults to: - -```js -function startAngle(d) { - return d.startAngle; -} -``` - -The *angle* is specified in radians, with 0 at -*y* (12 o’clock) and positive angles proceeding clockwise. If |endAngle - startAngle| ≥ τ, a complete circle or annulus is generated rather than a sector. - -# arc.endAngle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -If *angle* is specified, sets the end angle to the specified function or number and returns this arc generator. If *angle* is not specified, returns the current end angle accessor, which defaults to: - -```js -function endAngle(d) { - return d.endAngle; -} -``` - -The *angle* is specified in radians, with 0 at -*y* (12 o’clock) and positive angles proceeding clockwise. If |endAngle - startAngle| ≥ τ, a complete circle or annulus is generated rather than a sector. - -# arc.padAngle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -If *angle* is specified, sets the pad angle to the specified function or number and returns this arc generator. If *angle* is not specified, returns the current pad angle accessor, which defaults to: - -```js -function padAngle() { - return d && d.padAngle; -} -``` - -The pad angle is converted to a fixed linear distance separating adjacent arcs, defined as [padRadius](#arc_padRadius) * padAngle. This distance is subtracted equally from the [start](#arc_startAngle) and [end](#arc_endAngle) of the arc. If the arc forms a complete circle or annulus, as when |endAngle - startAngle| ≥ τ, the pad angle is ignored. - -If the [inner radius](#arc_innerRadius) or angular span is small relative to the pad angle, it may not be possible to maintain parallel edges between adjacent arcs. In this case, the inner edge of the arc may collapse to a point, similar to a circular sector. For this reason, padding is typically only applied to annular sectors (*i.e.*, when innerRadius is positive), as shown in this diagram: - -[Padded Circular Sectors](http://bl.ocks.org/mbostock/f37b07b92633781a46f7)[Padded Annular Sectors](http://bl.ocks.org/mbostock/99f0a6533f7c949cf8b8) - -The recommended minimum inner radius when using padding is outerRadius \* padAngle / sin(θ), where θ is the angular span of the smallest arc before padding. For example, if the outer radius is 200 pixels and the pad angle is 0.02 radians, a reasonable θ is 0.04 radians, and a reasonable inner radius is 100 pixels. See the [arc padding animation](http://bl.ocks.org/mbostock/053fcc2295a445afab07) for illustration. - -Often, the pad angle is not set directly on the arc generator, but is instead computed by the [pie generator](#pies) so as to ensure that the area of padded arcs is proportional to their value; see [*pie*.padAngle](#pie_padAngle). See the [pie padding animation](http://bl.ocks.org/mbostock/3e961b4c97a1b543fff2) for illustration. If you apply a constant pad angle to the arc generator directly, it tends to subtract disproportionately from smaller arcs, introducing distortion. - -# arc.padRadius([radius]) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -If *radius* is specified, sets the pad radius to the specified function or number and returns this arc generator. If *radius* is not specified, returns the current pad radius accessor, which defaults to null, indicating that the pad radius should be automatically computed as sqrt([innerRadius](#arc_innerRadius) * innerRadius + [outerRadius](#arc_outerRadius) * outerRadius). The pad radius determines the fixed linear distance separating adjacent arcs, defined as padRadius * [padAngle](#arc_padAngle). - -# arc.context([context]) · [Source](https://github.com/d3/d3-shape/blob/master/src/arc.js) - -If *context* is specified, sets the context and returns this arc generator. If *context* is not specified, returns the current context, which defaults to null. If the context is not null, then the [generated arc](#_arc) is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string representing the generated arc is returned. - -### Pies - -The pie generator does not produce a shape directly, but instead computes the necessary angles to represent a tabular dataset as a pie or donut chart; these angles can then be passed to an [arc generator](#arcs). - -# d3.pie() · [Source](https://github.com/d3/d3-shape/blob/master/src/pie.js) - -Constructs a new pie generator with the default settings. - -# pie(data[, arguments…]) · [Source](https://github.com/d3/d3-shape/blob/master/src/pie.js) - -Generates a pie for the given array of *data*, returning an array of objects representing each datum’s arc angles. Any additional *arguments* are arbitrary; they are simply propagated to the pie generator’s accessor functions along with the `this` object. The length of the returned array is the same as *data*, and each element *i* in the returned array corresponds to the element *i* in the input data. Each object in the returned array has the following properties: - -* `data` - the input datum; the corresponding element in the input data array. -* `value` - the numeric [value](#pie_value) of the arc. -* `index` - the zero-based [sorted index](#pie_sort) of the arc. -* `startAngle` - the [start angle](#pie_startAngle) of the arc. -* `endAngle` - the [end angle](#pie_endAngle) of the arc. -* `padAngle` - the [pad angle](#pie_padAngle) of the arc. - -This representation is designed to work with the arc generator’s default [startAngle](#arc_startAngle), [endAngle](#arc_endAngle) and [padAngle](#arc_padAngle) accessors. The angular units are arbitrary, but if you plan to use the pie generator in conjunction with an [arc generator](#arcs), you should specify angles in radians, with 0 at -*y* (12 o’clock) and positive angles proceeding clockwise. - -Given a small dataset of numbers, here is how to compute the arc angles to render this data as a pie chart: - -```js -var data = [1, 1, 2, 3, 5, 8, 13, 21]; -var arcs = d3.pie()(data); -``` - -The first pair of parens, `pie()`, [constructs](#pie) a default pie generator. The second, `pie()(data)`, [invokes](#_pie) this generator on the dataset, returning an array of objects: - -```json -[ - {"data": 1, "value": 1, "index": 6, "startAngle": 6.050474740247008, "endAngle": 6.166830023713296, "padAngle": 0}, - {"data": 1, "value": 1, "index": 7, "startAngle": 6.166830023713296, "endAngle": 6.283185307179584, "padAngle": 0}, - {"data": 2, "value": 2, "index": 5, "startAngle": 5.817764173314431, "endAngle": 6.050474740247008, "padAngle": 0}, - {"data": 3, "value": 3, "index": 4, "startAngle": 5.468698322915565, "endAngle": 5.817764173314431, "padAngle": 0}, - {"data": 5, "value": 5, "index": 3, "startAngle": 4.886921905584122, "endAngle": 5.468698322915565, "padAngle": 0}, - {"data": 8, "value": 8, "index": 2, "startAngle": 3.956079637853813, "endAngle": 4.886921905584122, "padAngle": 0}, - {"data": 13, "value": 13, "index": 1, "startAngle": 2.443460952792061, "endAngle": 3.956079637853813, "padAngle": 0}, - {"data": 21, "value": 21, "index": 0, "startAngle": 0.000000000000000, "endAngle": 2.443460952792061, "padAngle": 0} -] -``` - -Note that the returned array is in the same order as the data, even though this pie chart is [sorted](#pie_sortValues) by descending value, starting with the arc for the last datum (value 21) at 12 o’clock. - -# pie.value([value]) · [Source](https://github.com/d3/d3-shape/blob/master/src/pie.js) - -If *value* is specified, sets the value accessor to the specified function or number and returns this pie generator. If *value* is not specified, returns the current value accessor, which defaults to: - -```js -function value(d) { - return d; -} -``` - -When a pie is [generated](#_pie), the value accessor will be invoked for each element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. The default value accessor assumes that the input data are numbers, or that they are coercible to numbers using [valueOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf). If your data are not simply numbers, then you should specify an accessor that returns the corresponding numeric value for a given datum. For example: - -```js -var data = [ - {"number": 4, "name": "Locke"}, - {"number": 8, "name": "Reyes"}, - {"number": 15, "name": "Ford"}, - {"number": 16, "name": "Jarrah"}, - {"number": 23, "name": "Shephard"}, - {"number": 42, "name": "Kwon"} -]; - -var arcs = d3.pie() - .value(function(d) { return d.number; }) - (data); -``` - -This is similar to [mapping](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) your data to values before invoking the pie generator: - -```js -var arcs = d3.pie()(data.map(function(d) { return d.number; })); -``` - -The benefit of an accessor is that the input data remains associated with the returned objects, thereby making it easier to access other fields of the data, for example to set the color or to add text labels. - -# pie.sort([compare]) · [Source](https://github.com/d3/d3-shape/blob/master/src/pie.js) - -If *compare* is specified, sets the data comparator to the specified function and returns this pie generator. If *compare* is not specified, returns the current data comparator, which defaults to null. If both the data comparator and the value comparator are null, then arcs are positioned in the original input order. Otherwise, the data is sorted according to the data comparator, and the resulting order is used. Setting the data comparator implicitly sets the [value comparator](#pie_sortValues) to null. - -The *compare* function takes two arguments *a* and *b*, each elements from the input data array. If the arc for *a* should be before the arc for *b*, then the comparator must return a number less than zero; if the arc for *a* should be after the arc for *b*, then the comparator must return a number greater than zero; returning zero means that the relative order of *a* and *b* is unspecified. For example, to sort arcs by their associated name: - -```js -pie.sort(function(a, b) { return a.name.localeCompare(b.name); }); -``` - -Sorting does not affect the order of the [generated arc array](#_pie) which is always in the same order as the input data array; it merely affects the computed angles of each arc. The first arc starts at the [start angle](#pie_startAngle) and the last arc ends at the [end angle](#pie_endAngle). - -# pie.sortValues([compare]) · [Source](https://github.com/d3/d3-shape/blob/master/src/pie.js) - -If *compare* is specified, sets the value comparator to the specified function and returns this pie generator. If *compare* is not specified, returns the current value comparator, which defaults to descending value. The default value comparator is implemented as: - -```js -function compare(a, b) { - return b - a; -} -``` - -If both the data comparator and the value comparator are null, then arcs are positioned in the original input order. Otherwise, the data is sorted according to the data comparator, and the resulting order is used. Setting the value comparator implicitly sets the [data comparator](#pie_sort) to null. - -The value comparator is similar to the [data comparator](#pie_sort), except the two arguments *a* and *b* are values derived from the input data array using the [value accessor](#pie_value), not the data elements. If the arc for *a* should be before the arc for *b*, then the comparator must return a number less than zero; if the arc for *a* should be after the arc for *b*, then the comparator must return a number greater than zero; returning zero means that the relative order of *a* and *b* is unspecified. For example, to sort arcs by ascending value: - -```js -pie.sortValues(function(a, b) { return a - b; }); -``` - -Sorting does not affect the order of the [generated arc array](#_pie) which is always in the same order as the input data array; it merely affects the computed angles of each arc. The first arc starts at the [start angle](#pie_startAngle) and the last arc ends at the [end angle](#pie_endAngle). - -# pie.startAngle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/pie.js) - -If *angle* is specified, sets the overall start angle of the pie to the specified function or number and returns this pie generator. If *angle* is not specified, returns the current start angle accessor, which defaults to: - -```js -function startAngle() { - return 0; -} -``` - -The start angle here means the *overall* start angle of the pie, *i.e.*, the start angle of the first arc. The start angle accessor is invoked once, being passed the same arguments and `this` context as the [pie generator](#_pie). The units of *angle* are arbitrary, but if you plan to use the pie generator in conjunction with an [arc generator](#arcs), you should specify an angle in radians, with 0 at -*y* (12 o’clock) and positive angles proceeding clockwise. - -# pie.endAngle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/pie.js) - -If *angle* is specified, sets the overall end angle of the pie to the specified function or number and returns this pie generator. If *angle* is not specified, returns the current end angle accessor, which defaults to: - -```js -function endAngle() { - return 2 * Math.PI; -} -``` - -The end angle here means the *overall* end angle of the pie, *i.e.*, the end angle of the last arc. The end angle accessor is invoked once, being passed the same arguments and `this` context as the [pie generator](#_pie). The units of *angle* are arbitrary, but if you plan to use the pie generator in conjunction with an [arc generator](#arcs), you should specify an angle in radians, with 0 at -*y* (12 o’clock) and positive angles proceeding clockwise. - -The value of the end angle is constrained to [startAngle](#pie_startAngle) ± τ, such that |endAngle - startAngle| ≤ τ. - -# pie.padAngle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/pie.js) - -If *angle* is specified, sets the pad angle to the specified function or number and returns this pie generator. If *angle* is not specified, returns the current pad angle accessor, which defaults to: - -```js -function padAngle() { - return 0; -} -``` - -The pad angle here means the angular separation between each adjacent arc. The total amount of padding reserved is the specified *angle* times the number of elements in the input data array, and at most |endAngle - startAngle|; the remaining space is then divided proportionally by [value](#pie_value) such that the relative area of each arc is preserved. See the [pie padding animation](http://bl.ocks.org/mbostock/3e961b4c97a1b543fff2) for illustration. The pad angle accessor is invoked once, being passed the same arguments and `this` context as the [pie generator](#_pie). The units of *angle* are arbitrary, but if you plan to use the pie generator in conjunction with an [arc generator](#arcs), you should specify an angle in radians. - -### Lines - -[Line Chart](https://observablehq.com/@d3/line-chart) - -The line generator produces a [spline](https://en.wikipedia.org/wiki/Spline_\(mathematics\)) or [polyline](https://en.wikipedia.org/wiki/Polygonal_chain), as in a line chart. Lines also appear in many other visualization types, such as the links in [hierarchical edge bundling](https://observablehq.com/@d3/hierarchical-edge-bundling). - -# d3.line() · [Source](https://github.com/d3/d3-shape/blob/master/src/line.js), [Examples](https://observablehq.com/@d3/d3-line) - -Constructs a new line generator with the default settings. - -# line(data) · [Source](https://github.com/d3/d3-shape/blob/master/src/line.js), [Examples](https://observablehq.com/@d3/d3-line) - -Generates a line for the given array of *data*. Depending on this line generator’s associated [curve](#line_curve), the given input *data* may need to be sorted by *x*-value before being passed to the line generator. If the line generator has a [context](#line_context), then the line is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls and this function returns void. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string is returned. - -# line.x([x]) · [Source](https://github.com/d3/d3-shape/blob/master/src/line.js), [Examples](https://observablehq.com/@d3/d3-line) - -If *x* is specified, sets the x accessor to the specified function or number and returns this line generator. If *x* is not specified, returns the current x accessor, which defaults to: - -```js -function x(d) { - return d[0]; -} -``` - -When a line is [generated](#_line), the x accessor will be invoked for each [defined](#line_defined) element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. The default x accessor assumes that the input data are two-element arrays of numbers. If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. For example, if `x` is a [time scale](https://github.com/d3/d3-scale#time-scales) and `y` is a [linear scale](https://github.com/d3/d3-scale#linear-scales): - -```js -var data = [ - {date: new Date(2007, 3, 24), value: 93.24}, - {date: new Date(2007, 3, 25), value: 95.35}, - {date: new Date(2007, 3, 26), value: 98.84}, - {date: new Date(2007, 3, 27), value: 99.92}, - {date: new Date(2007, 3, 30), value: 99.80}, - {date: new Date(2007, 4, 1), value: 99.47}, - … -]; - -var line = d3.line() - .x(function(d) { return x(d.date); }) - .y(function(d) { return y(d.value); }); -``` - -# line.y([y]) · [Source](https://github.com/d3/d3-shape/blob/master/src/line.js), [Examples](https://observablehq.com/@d3/d3-line) - -If *y* is specified, sets the y accessor to the specified function or number and returns this line generator. If *y* is not specified, returns the current y accessor, which defaults to: - -```js -function y(d) { - return d[1]; -} -``` - -When a line is [generated](#_line), the y accessor will be invoked for each [defined](#line_defined) element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. The default y accessor assumes that the input data are two-element arrays of numbers. See [*line*.x](#line_x) for more information. - -# line.defined([defined]) · [Source](https://github.com/d3/d3-shape/blob/master/src/line.js), [Examples](https://observablehq.com/@d3/d3-line) - -If *defined* is specified, sets the defined accessor to the specified function or boolean and returns this line generator. If *defined* is not specified, returns the current defined accessor, which defaults to: - -```js -function defined() { - return true; -} -``` - -The default accessor thus assumes that the input data is always defined. When a line is [generated](#_line), the defined accessor will be invoked for each element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. If the given element is defined (*i.e.*, if the defined accessor returns a truthy value for this element), the [x](#line_x) and [y](#line_y) accessors will subsequently be evaluated and the point will be added to the current line segment. Otherwise, the element will be skipped, the current line segment will be ended, and a new line segment will be generated for the next defined point. As a result, the generated line may have several discrete segments. For example: - -[Line with Missing Data](http://bl.ocks.org/mbostock/0533f44f2cfabecc5e3a) - -Note that if a line segment consists of only a single point, it may appear invisible unless rendered with rounded or square [line caps](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap). In addition, some curves such as [curveCardinalOpen](#curveCardinalOpen) only render a visible segment if it contains multiple points. - -# line.curve([curve]) · [Source](https://github.com/d3/d3-shape/blob/master/src/line.js), [Examples](https://observablehq.com/@d3/d3-line) - -If *curve* is specified, sets the [curve factory](#curves) and returns this line generator. If *curve* is not specified, returns the current curve factory, which defaults to [curveLinear](#curveLinear). - -# line.context([context]) · [Source](https://github.com/d3/d3-shape/blob/master/src/line.js), [Examples](https://observablehq.com/@d3/d3-line) - -If *context* is specified, sets the context and returns this line generator. If *context* is not specified, returns the current context, which defaults to null. If the context is not null, then the [generated line](#_line) is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string representing the generated line is returned. - -# d3.lineRadial() · [Source](https://github.com/d3/d3-shape/blob/master/src/lineRadial.js), [Examples](https://observablehq.com/@d3/d3-lineradial) - -Radial Line - -Constructs a new radial line generator with the default settings. A radial line generator is equivalent to the standard Cartesian [line generator](#line), except the [x](#line_x) and [y](#line_y) accessors are replaced with [angle](#lineRadial_angle) and [radius](#lineRadial_radius) accessors. Radial lines are always positioned relative to ⟨0,0⟩; use a transform (see: [SVG](http://www.w3.org/TR/SVG/coords.html#TransformAttribute), [Canvas](http://www.w3.org/TR/2dcontext/#transformations)) to change the origin. - -# lineRadial(data) · [Source](https://github.com/d3/d3-shape/blob/master/src/lineRadial.js#L4), [Examples](https://observablehq.com/@d3/d3-lineradial) - -Equivalent to [*line*](#_line). - -# lineRadial.angle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/lineRadial.js#L7), [Examples](https://observablehq.com/@d3/d3-lineradial) - -Equivalent to [*line*.x](#line_x), except the accessor returns the angle in radians, with 0 at -*y* (12 o’clock). - -# lineRadial.radius([radius]) · [Source](https://github.com/d3/d3-shape/blob/master/src/lineRadial.js#L8), [Examples](https://observablehq.com/@d3/d3-lineradial) - -Equivalent to [*line*.y](#line_y), except the accessor returns the radius: the distance from the origin ⟨0,0⟩. - -# lineRadial.defined([defined]) - -Equivalent to [*line*.defined](#line_defined). - -# lineRadial.curve([curve]) · [Source](https://github.com/d3/d3-shape/blob/master/src/lineRadial.js), [Examples](https://observablehq.com/@d3/d3-lineradial) - -Equivalent to [*line*.curve](#line_curve). Note that [curveMonotoneX](#curveMonotoneX) or [curveMonotoneY](#curveMonotoneY) are not recommended for radial lines because they assume that the data is monotonic in *x* or *y*, which is typically untrue of radial lines. - -# lineRadial.context([context]) - -Equivalent to [*line*.context](#line_context). - -### Areas - -[Area Chart](https://observablehq.com/@d3/area-chart)[Stacked Area Chart](https://observablehq.com/@d3/stacked-area-chart)[Difference Chart](https://observablehq.com/@d3/difference-chart) - -The area generator produces an area, as in an area chart. An area is defined by two bounding [lines](#lines), either splines or polylines. Typically, the two lines share the same [*x*-values](#area_x) ([x0](#area_x0) = [x1](#area_x1)), differing only in *y*-value ([y0](#area_y0) and [y1](#area_y1)); most commonly, y0 is defined as a constant representing [zero](http://www.vox.com/2015/11/19/9758062/y-axis-zero-chart). The first line (the topline) is defined by x1 and y1 and is rendered first; the second line (the baseline) is defined by x0 and y0 and is rendered second, with the points in reverse order. With a [curveLinear](#curveLinear) [curve](#area_curve), this produces a clockwise polygon. - -# d3.area() · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -Constructs a new area generator with the default settings. - -# area(data) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -Generates an area for the given array of *data*. Depending on this area generator’s associated [curve](#area_curve), the given input *data* may need to be sorted by *x*-value before being passed to the area generator. If the area generator has a [context](#line_context), then the area is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls and this function returns void. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string is returned. - -# area.x([x]) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -If *x* is specified, sets [x0](#area_x0) to *x* and [x1](#area_x1) to null and returns this area generator. If *x* is not specified, returns the current x0 accessor. - -# area.x0([x]) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -If *x* is specified, sets the x0 accessor to the specified function or number and returns this area generator. If *x* is not specified, returns the current x0 accessor, which defaults to: - -```js -function x(d) { - return d[0]; -} -``` - -When an area is [generated](#_area), the x0 accessor will be invoked for each [defined](#area_defined) element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. The default x0 accessor assumes that the input data are two-element arrays of numbers. If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. For example, if `x` is a [time scale](https://github.com/d3/d3-scale#time-scales) and `y` is a [linear scale](https://github.com/d3/d3-scale#linear-scales): - -```js -var data = [ - {date: new Date(2007, 3, 24), value: 93.24}, - {date: new Date(2007, 3, 25), value: 95.35}, - {date: new Date(2007, 3, 26), value: 98.84}, - {date: new Date(2007, 3, 27), value: 99.92}, - {date: new Date(2007, 3, 30), value: 99.80}, - {date: new Date(2007, 4, 1), value: 99.47}, - … -]; - -var area = d3.area() - .x(function(d) { return x(d.date); }) - .y1(function(d) { return y(d.value); }) - .y0(y(0)); -``` - -# area.x1([x]) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -If *x* is specified, sets the x1 accessor to the specified function or number and returns this area generator. If *x* is not specified, returns the current x1 accessor, which defaults to null, indicating that the previously-computed [x0](#area_x0) value should be reused for the x1 value. - -When an area is [generated](#_area), the x1 accessor will be invoked for each [defined](#area_defined) element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. See [*area*.x0](#area_x0) for more information. - -# area.y([y]) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -If *y* is specified, sets [y0](#area_y0) to *y* and [y1](#area_y1) to null and returns this area generator. If *y* is not specified, returns the current y0 accessor. - -# area.y0([y]) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -If *y* is specified, sets the y0 accessor to the specified function or number and returns this area generator. If *y* is not specified, returns the current y0 accessor, which defaults to: - -```js -function y() { - return 0; -} -``` - -When an area is [generated](#_area), the y0 accessor will be invoked for each [defined](#area_defined) element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. See [*area*.x0](#area_x0) for more information. - -# area.y1([y]) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -If *y* is specified, sets the y1 accessor to the specified function or number and returns this area generator. If *y* is not specified, returns the current y1 accessor, which defaults to: - -```js -function y(d) { - return d[1]; -} -``` - -A null accessor is also allowed, indicating that the previously-computed [y0](#area_y0) value should be reused for the y1 value. When an area is [generated](#_area), the y1 accessor will be invoked for each [defined](#area_defined) element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. See [*area*.x0](#area_x0) for more information. - -# area.defined([defined]) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -If *defined* is specified, sets the defined accessor to the specified function or boolean and returns this area generator. If *defined* is not specified, returns the current defined accessor, which defaults to: - -```js -function defined() { - return true; -} -``` - -The default accessor thus assumes that the input data is always defined. When an area is [generated](#_area), the defined accessor will be invoked for each element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. If the given element is defined (*i.e.*, if the defined accessor returns a truthy value for this element), the [x0](#area_x0), [x1](#area_x1), [y0](#area_y0) and [y1](#area_y1) accessors will subsequently be evaluated and the point will be added to the current area segment. Otherwise, the element will be skipped, the current area segment will be ended, and a new area segment will be generated for the next defined point. As a result, the generated area may have several discrete segments. For example: - -[Area with Missing Data](http://bl.ocks.org/mbostock/3035090) - -Note that if an area segment consists of only a single point, it may appear invisible unless rendered with rounded or square [line caps](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap). In addition, some curves such as [curveCardinalOpen](#curveCardinalOpen) only render a visible segment if it contains multiple points. - -# area.curve([curve]) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -If *curve* is specified, sets the [curve factory](#curves) and returns this area generator. If *curve* is not specified, returns the current curve factory, which defaults to [curveLinear](#curveLinear). - -# area.context([context]) · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -If *context* is specified, sets the context and returns this area generator. If *context* is not specified, returns the current context, which defaults to null. If the context is not null, then the [generated area](#_area) is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string representing the generated area is returned. - -# area.lineX0() · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) -
# area.lineY0() · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -Returns a new [line generator](#lines) that has this area generator’s current [defined accessor](#area_defined), [curve](#area_curve) and [context](#area_context). The line’s [*x*-accessor](#line_x) is this area’s [*x0*-accessor](#area_x0), and the line’s [*y*-accessor](#line_y) is this area’s [*y0*-accessor](#area_y0). - -# area.lineX1() · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -Returns a new [line generator](#lines) that has this area generator’s current [defined accessor](#area_defined), [curve](#area_curve) and [context](#area_context). The line’s [*x*-accessor](#line_x) is this area’s [*x1*-accessor](#area_x1), and the line’s [*y*-accessor](#line_y) is this area’s [*y0*-accessor](#area_y0). - -# area.lineY1() · [Source](https://github.com/d3/d3-shape/blob/master/src/area.js) - -Returns a new [line generator](#lines) that has this area generator’s current [defined accessor](#area_defined), [curve](#area_curve) and [context](#area_context). The line’s [*x*-accessor](#line_x) is this area’s [*x0*-accessor](#area_x0), and the line’s [*y*-accessor](#line_y) is this area’s [*y1*-accessor](#area_y1). - -# d3.areaRadial() · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Radial Area - -Constructs a new radial area generator with the default settings. A radial area generator is equivalent to the standard Cartesian [area generator](#area), except the [x](#area_x) and [y](#area_y) accessors are replaced with [angle](#areaRadial_angle) and [radius](#areaRadial_radius) accessors. Radial areas are always positioned relative to ⟨0,0⟩; use a transform (see: [SVG](http://www.w3.org/TR/SVG/coords.html#TransformAttribute), [Canvas](http://www.w3.org/TR/2dcontext/#transformations)) to change the origin. - -# areaRadial(data) - -Equivalent to [*area*](#_area). - -# areaRadial.angle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Equivalent to [*area*.x](#area_x), except the accessor returns the angle in radians, with 0 at -*y* (12 o’clock). - -# areaRadial.startAngle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Equivalent to [*area*.x0](#area_x0), except the accessor returns the angle in radians, with 0 at -*y* (12 o’clock). Note: typically [angle](#areaRadial_angle) is used instead of setting separate start and end angles. - -# areaRadial.endAngle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Equivalent to [*area*.x1](#area_x1), except the accessor returns the angle in radians, with 0 at -*y* (12 o’clock). Note: typically [angle](#areaRadial_angle) is used instead of setting separate start and end angles. - -# areaRadial.radius([radius]) · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Equivalent to [*area*.y](#area_y), except the accessor returns the radius: the distance from the origin ⟨0,0⟩. - -# areaRadial.innerRadius([radius]) · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Equivalent to [*area*.y0](#area_y0), except the accessor returns the radius: the distance from the origin ⟨0,0⟩. - -# areaRadial.outerRadius([radius]) · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Equivalent to [*area*.y1](#area_y1), except the accessor returns the radius: the distance from the origin ⟨0,0⟩. - -# areaRadial.defined([defined]) - -Equivalent to [*area*.defined](#area_defined). - -# areaRadial.curve([curve]) · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Equivalent to [*area*.curve](#area_curve). Note that [curveMonotoneX](#curveMonotoneX) or [curveMonotoneY](#curveMonotoneY) are not recommended for radial areas because they assume that the data is monotonic in *x* or *y*, which is typically untrue of radial areas. - -# areaRadial.context([context]) - -Equivalent to [*line*.context](#line_context). - -# areaRadial.lineStartAngle() · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) -
# areaRadial.lineInnerRadius() · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Returns a new [radial line generator](#lineRadial) that has this radial area generator’s current [defined accessor](#areaRadial_defined), [curve](#areaRadial_curve) and [context](#areaRadial_context). The line’s [angle accessor](#lineRadial_angle) is this area’s [start angle accessor](#areaRadial_startAngle), and the line’s [radius accessor](#lineRadial_radius) is this area’s [inner radius accessor](#areaRadial_innerRadius). - -# areaRadial.lineEndAngle() · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Returns a new [radial line generator](#lineRadial) that has this radial area generator’s current [defined accessor](#areaRadial_defined), [curve](#areaRadial_curve) and [context](#areaRadial_context). The line’s [angle accessor](#lineRadial_angle) is this area’s [end angle accessor](#areaRadial_endAngle), and the line’s [radius accessor](#lineRadial_radius) is this area’s [inner radius accessor](#areaRadial_innerRadius). - -# areaRadial.lineOuterRadius() · [Source](https://github.com/d3/d3-shape/blob/master/src/areaRadial.js) - -Returns a new [radial line generator](#lineRadial) that has this radial area generator’s current [defined accessor](#areaRadial_defined), [curve](#areaRadial_curve) and [context](#areaRadial_context). The line’s [angle accessor](#lineRadial_angle) is this area’s [start angle accessor](#areaRadial_startAngle), and the line’s [radius accessor](#lineRadial_radius) is this area’s [outer radius accessor](#areaRadial_outerRadius). - -### Curves - -While [lines](#lines) are defined as a sequence of two-dimensional [*x*, *y*] points, and [areas](#areas) are similarly defined by a topline and a baseline, there remains the task of transforming this discrete representation into a continuous shape: *i.e.*, how to interpolate between the points. A variety of curves are provided for this purpose. - -Curves are typically not constructed or used directly, instead being passed to [*line*.curve](#line_curve) and [*area*.curve](#area_curve). For example: - -```js -var line = d3.line() - .x(function(d) { return x(d.date); }) - .y(function(d) { return y(d.value); }) - .curve(d3.curveCatmullRom.alpha(0.5)); -``` - -# d3.curveBasis(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/basis.js) - -basis - -Produces a cubic [basis spline](https://en.wikipedia.org/wiki/B-spline) using the specified control points. The first and last points are triplicated such that the spline starts at the first point and ends at the last point, and is tangent to the line between the first and second points, and to the line between the penultimate and last points. - -# d3.curveBasisClosed(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/basisClosed.js) - -basisClosed - -Produces a closed cubic [basis spline](https://en.wikipedia.org/wiki/B-spline) using the specified control points. When a line segment ends, the first three control points are repeated, producing a closed loop with C2 continuity. - -# d3.curveBasisOpen(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/basisOpen.js) - -basisOpen - -Produces a cubic [basis spline](https://en.wikipedia.org/wiki/B-spline) using the specified control points. Unlike [basis](#basis), the first and last points are not repeated, and thus the curve typically does not intersect these points. - -# d3.curveBundle(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/bundle.js) - -bundle - -Produces a straightened cubic [basis spline](https://en.wikipedia.org/wiki/B-spline) using the specified control points, with the spline straightened according to the curve’s [*beta*](#curveBundle_beta), which defaults to 0.85. This curve is typically used in [hierarchical edge bundling](https://observablehq.com/@d3/hierarchical-edge-bundling) to disambiguate connections, as proposed by [Danny Holten](https://www.win.tue.nl/vis1/home/dholten/) in [Hierarchical Edge Bundles: Visualization of Adjacency Relations in Hierarchical Data](https://www.win.tue.nl/vis1/home/dholten/papers/bundles_infovis.pdf). This curve does not implement [*curve*.areaStart](#curve_areaStart) and [*curve*.areaEnd](#curve_areaEnd); it is intended to work with [d3.line](#lines), not [d3.area](#areas). - -# bundle.beta(beta) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/bundle.js) - -Returns a bundle curve with the specified *beta* in the range [0, 1], representing the bundle strength. If *beta* equals zero, a straight line between the first and last point is produced; if *beta* equals one, a standard [basis](#basis) spline is produced. For example: - -```js -var line = d3.line().curve(d3.curveBundle.beta(0.5)); -``` - -# d3.curveCardinal(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/cardinal.js) - -cardinal - -Produces a cubic [cardinal spline](https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline) using the specified control points, with one-sided differences used for the first and last piece. The default [tension](#curveCardinal_tension) is 0. - -# d3.curveCardinalClosed(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/cardinalClosed.js) - -cardinalClosed - -Produces a closed cubic [cardinal spline](https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline) using the specified control points. When a line segment ends, the first three control points are repeated, producing a closed loop. The default [tension](#curveCardinal_tension) is 0. - -# d3.curveCardinalOpen(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/cardinalOpen.js) - -cardinalOpen - -Produces a cubic [cardinal spline](https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline) using the specified control points. Unlike [curveCardinal](#curveCardinal), one-sided differences are not used for the first and last piece, and thus the curve starts at the second point and ends at the penultimate point. The default [tension](#curveCardinal_tension) is 0. - -# cardinal.tension(tension) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/cardinalOpen.js) - -Returns a cardinal curve with the specified *tension* in the range [0, 1]. The *tension* determines the length of the tangents: a *tension* of one yields all zero tangents, equivalent to [curveLinear](#curveLinear); a *tension* of zero produces a uniform [Catmull–Rom](#curveCatmullRom) spline. For example: - -```js -var line = d3.line().curve(d3.curveCardinal.tension(0.5)); -``` - -# d3.curveCatmullRom(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/catmullRom.js) - -catmullRom - -Produces a cubic Catmull–Rom spline using the specified control points and the parameter [*alpha*](#curveCatmullRom_alpha), which defaults to 0.5, as proposed by Yuksel et al. in [On the Parameterization of Catmull–Rom Curves](http://www.cemyuksel.com/research/catmullrom_param/), with one-sided differences used for the first and last piece. - -# d3.curveCatmullRomClosed(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/catmullRomClosed.js) - -catmullRomClosed - -Produces a closed cubic Catmull–Rom spline using the specified control points and the parameter [*alpha*](#curveCatmullRom_alpha), which defaults to 0.5, as proposed by Yuksel et al. When a line segment ends, the first three control points are repeated, producing a closed loop. - -# d3.curveCatmullRomOpen(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/catmullRomOpen.js) - -catmullRomOpen - -Produces a cubic Catmull–Rom spline using the specified control points and the parameter [*alpha*](#curveCatmullRom_alpha), which defaults to 0.5, as proposed by Yuksel et al. Unlike [curveCatmullRom](#curveCatmullRom), one-sided differences are not used for the first and last piece, and thus the curve starts at the second point and ends at the penultimate point. - -# catmullRom.alpha(alpha) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/catmullRom.js) - -Returns a cubic Catmull–Rom curve with the specified *alpha* in the range [0, 1]. If *alpha* is zero, produces a uniform spline, equivalent to [curveCardinal](#curveCardinal) with a tension of zero; if *alpha* is one, produces a chordal spline; if *alpha* is 0.5, produces a [centripetal spline](https://en.wikipedia.org/wiki/Centripetal_Catmull–Rom_spline). Centripetal splines are recommended to avoid self-intersections and overshoot. For example: - -```js -var line = d3.line().curve(d3.curveCatmullRom.alpha(0.5)); -``` - -# d3.curveLinear(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/linear.js) - -linear - -Produces a polyline through the specified points. - -# d3.curveLinearClosed(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/linearClosed.js) - -linearClosed - -Produces a closed polyline through the specified points by repeating the first point when the line segment ends. - -# d3.curveMonotoneX(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/monotone.js) - -monotoneX - -Produces a cubic spline that [preserves monotonicity](https://en.wikipedia.org/wiki/Monotone_cubic_interpolation) in *y*, assuming monotonicity in *x*, as proposed by Steffen in [A simple method for monotonic interpolation in one dimension](http://adsabs.harvard.edu/full/1990A%26A...239..443S): “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations. Local extrema can occur only at grid points where they are given by the data, but not in between two adjacent grid points.” - -# d3.curveMonotoneY(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/monotone.js) - -monotoneY - -Produces a cubic spline that [preserves monotonicity](https://en.wikipedia.org/wiki/Monotone_cubic_interpolation) in *x*, assuming monotonicity in *y*, as proposed by Steffen in [A simple method for monotonic interpolation in one dimension](http://adsabs.harvard.edu/full/1990A%26A...239..443S): “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations. Local extrema can occur only at grid points where they are given by the data, but not in between two adjacent grid points.” - -# d3.curveNatural(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/natural.js) - -natural - -Produces a [natural](https://en.wikipedia.org/wiki/Spline_interpolation) [cubic spline](http://mathworld.wolfram.com/CubicSpline.html) with the second derivative of the spline set to zero at the endpoints. - -# d3.curveStep(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/step.js) - -step - -Produces a piecewise constant function (a [step function](https://en.wikipedia.org/wiki/Step_function)) consisting of alternating horizontal and vertical lines. The *y*-value changes at the midpoint of each pair of adjacent *x*-values. - -# d3.curveStepAfter(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/step.js) - -stepAfter - -Produces a piecewise constant function (a [step function](https://en.wikipedia.org/wiki/Step_function)) consisting of alternating horizontal and vertical lines. The *y*-value changes after the *x*-value. - -# d3.curveStepBefore(context) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/step.js) - -stepBefore - -Produces a piecewise constant function (a [step function](https://en.wikipedia.org/wiki/Step_function)) consisting of alternating horizontal and vertical lines. The *y*-value changes before the *x*-value. - -### Custom Curves - -Curves are typically not used directly, instead being passed to [*line*.curve](#line_curve) and [*area*.curve](#area_curve). However, you can define your own curve implementation should none of the built-in curves satisfy your needs using the following interface. You can also use this low-level interface with a built-in curve type as an alternative to the line and area generators. - -# curve.areaStart() · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/step.js#L7) - -Indicates the start of a new area segment. Each area segment consists of exactly two [line segments](#curve_lineStart): the topline, followed by the baseline, with the baseline points in reverse order. - -# curve.areaEnd() · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/step.js) - -Indicates the end of the current area segment. - -# curve.lineStart() · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/step.js) - -Indicates the start of a new line segment. Zero or more [points](#curve_point) will follow. - -# curve.lineEnd() · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/step.js) - -Indicates the end of the current line segment. - -# curve.point(x, y) · [Source](https://github.com/d3/d3-shape/blob/master/src/curve/step.js) - -Indicates a new point in the current line segment with the given *x*- and *y*-values. - -### Links - -[Tidy Tree](https://observablehq.com/@d3/tidy-tree) - -The **link** shape generates a smooth cubic Bézier curve from a source point to a target point. The tangents of the curve at the start and end are either [vertical](#linkVertical), [horizontal](#linkHorizontal) or [radial](#linkRadial). - -# d3.linkVertical() · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -Returns a new [link generator](#_link) with vertical tangents. For example, to visualize [links](https://github.com/d3/d3-hierarchy/blob/master/README.md#node_links) in a [tree diagram](https://github.com/d3/d3-hierarchy/blob/master/README.md#tree) rooted on the top edge of the display, you might say: - -```js -var link = d3.linkVertical() - .x(function(d) { return d.x; }) - .y(function(d) { return d.y; }); -``` - -# d3.linkHorizontal() · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -Returns a new [link generator](#_link) with horizontal tangents. For example, to visualize [links](https://github.com/d3/d3-hierarchy/blob/master/README.md#node_links) in a [tree diagram](https://github.com/d3/d3-hierarchy/blob/master/README.md#tree) rooted on the left edge of the display, you might say: - -```js -var link = d3.linkHorizontal() - .x(function(d) { return d.y; }) - .y(function(d) { return d.x; }); -``` - -# link(arguments…) · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -Generates a link for the given *arguments*. The *arguments* are arbitrary; they are simply propagated to the link generator’s accessor functions along with the `this` object. For example, with the default settings, an object expected: - -```js -link({ - source: [100, 100], - target: [300, 300] -}); -``` - -# link.source([source]) · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -If *source* is specified, sets the source accessor to the specified function and returns this link generator. If *source* is not specified, returns the current source accessor, which defaults to: - -```js -function source(d) { - return d.source; -} -``` - -# link.target([target]) · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -If *target* is specified, sets the target accessor to the specified function and returns this link generator. If *target* is not specified, returns the current target accessor, which defaults to: - -```js -function target(d) { - return d.target; -} -``` - -# link.x([x]) · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -If *x* is specified, sets the *x*-accessor to the specified function or number and returns this link generator. If *x* is not specified, returns the current *x*-accessor, which defaults to: - -```js -function x(d) { - return d[0]; -} -``` - -# link.y([y]) · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -If *y* is specified, sets the *y*-accessor to the specified function or number and returns this link generator. If *y* is not specified, returns the current *y*-accessor, which defaults to: - -```js -function y(d) { - return d[1]; -} -``` - -# link.context([context]) · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -If *context* is specified, sets the context and returns this link generator. If *context* is not specified, returns the current context, which defaults to null. If the context is not null, then the [generated link](#_link) is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string representing the generated link is returned. See also [d3-path](https://github.com/d3/d3-path). - -# d3.linkRadial() · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -Returns a new [link generator](#_link) with radial tangents. For example, to visualize [links](https://github.com/d3/d3-hierarchy/blob/master/README.md#node_links) in a [tree diagram](https://github.com/d3/d3-hierarchy/blob/master/README.md#tree) rooted in the center of the display, you might say: - -```js -var link = d3.linkRadial() - .angle(function(d) { return d.x; }) - .radius(function(d) { return d.y; }); -``` - -# linkRadial.angle([angle]) · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -Equivalent to [*link*.x](#link_x), except the accessor returns the angle in radians, with 0 at -*y* (12 o’clock). - -# linkRadial.radius([radius]) · [Source](https://github.com/d3/d3-shape/blob/master/src/link/index.js) - -Equivalent to [*link*.y](#link_y), except the accessor returns the radius: the distance from the origin ⟨0,0⟩. - -### Symbols - - - -Symbols provide a categorical shape encoding as is commonly used in scatterplots. Symbols are always centered at ⟨0,0⟩; use a transform (see: [SVG](http://www.w3.org/TR/SVG/coords.html#TransformAttribute), [Canvas](http://www.w3.org/TR/2dcontext/#transformations)) to move the symbol to a different position. - -# d3.symbol() · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol.js) - -Constructs a new symbol generator with the default settings. - -# symbol(arguments…) · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol.js) - -Generates a symbol for the given *arguments*. The *arguments* are arbitrary; they are simply propagated to the symbol generator’s accessor functions along with the `this` object. For example, with the default settings, no arguments are needed to produce a circle with area 64 square pixels. If the symbol generator has a [context](#symbol_context), then the symbol is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls and this function returns void. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string is returned. - -# symbol.type([type]) · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol.js) - -If *type* is specified, sets the symbol type to the specified function or symbol type and returns this symbol generator. If *type* is a function, the symbol generator’s arguments and *this* are passed through. (See [*selection*.attr](https://github.com/d3/d3-selection/blob/master/README.md#selection_attr) if you are using d3-selection.) If *type* is not specified, returns the current symbol type accessor, which defaults to: - -```js -function type() { - return circle; -} -``` - -See [symbols](#symbols) for the set of built-in symbol types. To implement a custom symbol type, pass an object that implements [*symbolType*.draw](#symbolType_draw). - -# symbol.size([size]) · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol.js) - -If *size* is specified, sets the size to the specified function or number and returns this symbol generator. If *size* is a function, the symbol generator’s arguments and *this* are passed through. (See [*selection*.attr](https://github.com/d3/d3-selection/blob/master/README.md#selection_attr) if you are using d3-selection.) If *size* is not specified, returns the current size accessor, which defaults to: - -```js -function size() { - return 64; -} -``` - -Specifying the size as a function is useful for constructing a scatterplot with a size encoding. If you wish to scale the symbol to fit a given bounding box, rather than by area, try [SVG’s getBBox](https://observablehq.com/d/1fac2626b9e1b65f). - -# symbol.context([context]) · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol.js) - -If *context* is specified, sets the context and returns this symbol generator. If *context* is not specified, returns the current context, which defaults to null. If the context is not null, then the [generated symbol](#_symbol) is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string representing the generated symbol is returned. - -# d3.symbols - -An array containing the set of all built-in symbol types: [circle](#symbolCircle), [cross](#symbolCross), [diamond](#symbolDiamond), [square](#symbolSquare), [star](#symbolStar), [triangle](#symbolTriangle), and [wye](#symbolWye). Useful for constructing the range of an [ordinal scale](https://github.com/d3/d3-scale#ordinal-scales) should you wish to use a shape encoding for categorical data. - -# d3.symbolCircle · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol/circle.js) - -The circle symbol type. - -# d3.symbolCross · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol/cross.js) - -The Greek cross symbol type, with arms of equal length. - -# d3.symbolDiamond · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol/diamond.js) - -The rhombus symbol type. - -# d3.symbolSquare · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol/square.js) - -The square symbol type. - -# d3.symbolStar · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol/star.js) - -The pentagonal star (pentagram) symbol type. - -# d3.symbolTriangle · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol/triangle.js) - -The up-pointing triangle symbol type. - -# d3.symbolWye · [Source](https://github.com/d3/d3-shape/blob/master/src/symbol/wye.js) - -The Y-shape symbol type. - -# d3.pointRadial(angle, radius) · [Source](https://github.com/d3/d3-shape/blob/master/src/pointRadial.js) - -Returns the point [x, y] for the given *angle* in radians, with 0 at -*y* (12 o’clock) and positive angles proceeding clockwise, and the given *radius*. - -### Custom Symbol Types - -Symbol types are typically not used directly, instead being passed to [*symbol*.type](#symbol_type). However, you can define your own symbol type implementation should none of the built-in types satisfy your needs using the following interface. You can also use this low-level interface with a built-in symbol type as an alternative to the symbol generator. - -# symbolType.draw(context, size) - -Renders this symbol type to the specified *context* with the specified *size* in square pixels. The *context* implements the [CanvasPathMethods](http://www.w3.org/TR/2dcontext/#canvaspathmethods) interface. (Note that this is a subset of the CanvasRenderingContext2D interface!) - -### Stacks - -[Stacked Bar Chart](https://observablehq.com/@d3/stacked-bar-chart)[Streamgraph](https://observablehq.com/@mbostock/streamgraph-transitions) - -Some shape types can be stacked, placing one shape adjacent to another. For example, a bar chart of monthly sales might be broken down into a multi-series bar chart by product category, stacking bars vertically. This is equivalent to subdividing a bar chart by an ordinal dimension (such as product category) and applying a color encoding. - -Stacked charts can show overall value and per-category value simultaneously; however, it is typically harder to compare across categories, as only the bottom layer of the stack is aligned. So, chose the [stack order](#stack_order) carefully, and consider a [streamgraph](#stackOffsetWiggle). (See also [grouped charts](https://observablehq.com/@d3/grouped-bar-chart).) - -Like the [pie generator](#pies), the stack generator does not produce a shape directly. Instead it computes positions which you can then pass to an [area generator](#areas) or use directly, say to position bars. - -# d3.stack() · [Source](https://github.com/d3/d3-shape/blob/master/src/stack.js) - -Constructs a new stack generator with the default settings. - -# stack(data[, arguments…]) · [Source](https://github.com/d3/d3-shape/blob/master/src/stack.js) - -Generates a stack for the given array of *data*, returning an array representing each series. Any additional *arguments* are arbitrary; they are simply propagated to accessors along with the `this` object. - -The series are determined by the [keys accessor](#stack_keys); each series *i* in the returned array corresponds to the *i*th key. Each series is an array of points, where each point *j* corresponds to the *j*th element in the input *data*. Lastly, each point is represented as an array [*y0*, *y1*] where *y0* is the lower value (baseline) and *y1* is the upper value (topline); the difference between *y0* and *y1* corresponds to the computed [value](#stack_value) for this point. The key for each series is available as *series*.key, and the [index](#stack_order) as *series*.index. The input data element for each point is available as *point*.data. - -For example, consider the following table representing monthly sales of fruits: - -Month | Apples | Bananas | Cherries | Dates ---------|--------|---------|----------|------- - 1/2015 | 3840 | 1920 | 960 | 400 - 2/2015 | 1600 | 1440 | 960 | 400 - 3/2015 | 640 | 960 | 640 | 400 - 4/2015 | 320 | 480 | 640 | 400 - -This might be represented in JavaScript as an array of objects: - -```js -var data = [ - {month: new Date(2015, 0, 1), apples: 3840, bananas: 1920, cherries: 960, dates: 400}, - {month: new Date(2015, 1, 1), apples: 1600, bananas: 1440, cherries: 960, dates: 400}, - {month: new Date(2015, 2, 1), apples: 640, bananas: 960, cherries: 640, dates: 400}, - {month: new Date(2015, 3, 1), apples: 320, bananas: 480, cherries: 640, dates: 400} -]; -``` - -To produce a stack for this data: - -```js -var stack = d3.stack() - .keys(["apples", "bananas", "cherries", "dates"]) - .order(d3.stackOrderNone) - .offset(d3.stackOffsetNone); - -var series = stack(data); -``` - -The resulting array has one element per *series*. Each series has one point per month, and each point has a lower and upper value defining the baseline and topline: - -```js -[ - [[ 0, 3840], [ 0, 1600], [ 0, 640], [ 0, 320]], // apples - [[3840, 5760], [1600, 3040], [ 640, 1600], [ 320, 800]], // bananas - [[5760, 6720], [3040, 4000], [1600, 2240], [ 800, 1440]], // cherries - [[6720, 7120], [4000, 4400], [2240, 2640], [1440, 1840]], // dates -] -``` - -Each series in then typically passed to an [area generator](#areas) to render an area chart, or used to construct rectangles for a bar chart. - -# stack.keys([keys]) · [Source](https://github.com/d3/d3-shape/blob/master/src/stack.js) - -If *keys* is specified, sets the keys accessor to the specified function or array and returns this stack generator. If *keys* is not specified, returns the current keys accessor, which defaults to the empty array. A series (layer) is [generated](#_stack) for each key. Keys are typically strings, but they may be arbitrary values. The series’ key is passed to the [value accessor](#stack_value), along with each data point, to compute the point’s value. - -# stack.value([value]) · [Source](https://github.com/d3/d3-shape/blob/master/src/stack.js) - -If *value* is specified, sets the value accessor to the specified function or number and returns this stack generator. If *value* is not specified, returns the current value accessor, which defaults to: - -```js -function value(d, key) { - return d[key]; -} -``` - -Thus, by default the stack generator assumes that the input data is an array of objects, with each object exposing named properties with numeric values; see [*stack*](#_stack) for an example. - -# stack.order([order]) · [Source](https://github.com/d3/d3-shape/blob/master/src/stack.js) - -If *order* is specified, sets the order accessor to the specified function or array and returns this stack generator. If *order* is not specified, returns the current order acccesor, which defaults to [stackOrderNone](#stackOrderNone); this uses the order given by the [key accessor](#stack_key). See [stack orders](#stack-orders) for the built-in orders. - -If *order* is a function, it is passed the generated series array and must return an array of numeric indexes representing the stack order. For example, the default order is defined as: - -```js -function orderNone(series) { - var n = series.length, o = new Array(n); - while (--n >= 0) o[n] = n; - return o; -} -``` - -The stack order is computed prior to the [offset](#stack_offset); thus, the lower value for all points is zero at the time the order is computed. The index attribute for each series is also not set until after the order is computed. - -# stack.offset([offset]) · [Source](https://github.com/d3/d3-shape/blob/master/src/stack.js) - -If *offset* is specified, sets the offset accessor to the specified function or array and returns this stack generator. If *offset* is not specified, returns the current offset acccesor, which defaults to [stackOffsetNone](#stackOffsetNone); this uses a zero baseline. See [stack offsets](#stack-offsets) for the built-in offsets. - -If *offset* is a function, it is passed the generated series array and the order index array. The offset function is then responsible for updating the lower and upper values in the series array to layout the stack. For example, the default offset is defined as: - -```js -function offsetNone(series, order) { - if (!((n = series.length) > 1)) return; - for (var i = 1, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) { - s0 = s1, s1 = series[order[i]]; - for (var j = 0; j < m; ++j) { - s1[j][1] += s1[j][0] = s0[j][1]; - } - } -} -``` - -### Stack Orders - -Stack orders are typically not used directly, but are instead passed to [*stack*.order](#stack_order). - -# d3.stackOrderAppearance(series) · [Source](https://github.com/d3/d3-shape/blob/master/src/order/appearance.js) - -Returns a series order such that the earliest series (according to the maximum value) is at the bottom. - -# d3.stackOrderAscending(series) · [Source](https://github.com/d3/d3-shape/blob/master/src/order/ascending.js) - -Returns a series order such that the smallest series (according to the sum of values) is at the bottom. - -# d3.stackOrderDescending(series) · [Source](https://github.com/d3/d3-shape/blob/master/src/order/descending.js) - -Returns a series order such that the largest series (according to the sum of values) is at the bottom. - -# d3.stackOrderInsideOut(series) · [Source](https://github.com/d3/d3-shape/blob/master/src/order/insideOut.js) - -Returns a series order such that the earliest series (according to the maximum value) are on the inside and the later series are on the outside. This order is recommended for streamgraphs in conjunction with the [wiggle offset](#stackOffsetWiggle). See [Stacked Graphs—Geometry & Aesthetics](http://leebyron.com/streamgraph/) by Byron & Wattenberg for more information. - -# d3.stackOrderNone(series) · [Source](https://github.com/d3/d3-shape/blob/master/src/order/none.js) - -Returns the given series order [0, 1, … *n* - 1] where *n* is the number of elements in *series*. Thus, the stack order is given by the [key accessor](#stack_keys). - -# d3.stackOrderReverse(series) · [Source](https://github.com/d3/d3-shape/blob/master/src/order/reverse.js) - -Returns the reverse of the given series order [*n* - 1, *n* - 2, … 0] where *n* is the number of elements in *series*. Thus, the stack order is given by the reverse of the [key accessor](#stack_keys). - -### Stack Offsets - -Stack offsets are typically not used directly, but are instead passed to [*stack*.offset](#stack_offset). - -# d3.stackOffsetExpand(series, order) · [Source](https://github.com/d3/d3-shape/blob/master/src/offset/expand.js) - -Applies a zero baseline and normalizes the values for each point such that the topline is always one. - -# d3.stackOffsetDiverging(series, order) · [Source](https://github.com/d3/d3-shape/blob/master/src/offset/diverging.js) - -Positive values are stacked above zero, negative values are [stacked below zero](https://bl.ocks.org/mbostock/b5935342c6d21928111928401e2c8608), and zero values are stacked at zero. - -# d3.stackOffsetNone(series, order) · [Source](https://github.com/d3/d3-shape/blob/master/src/offset/none.js) - -Applies a zero baseline. - -# d3.stackOffsetSilhouette(series, order) · [Source](https://github.com/d3/d3-shape/blob/master/src/offset/silhouette.js) - -Shifts the baseline down such that the center of the streamgraph is always at zero. - -# d3.stackOffsetWiggle(series, order) · [Source](https://github.com/d3/d3-shape/blob/master/src/offset/wiggle.js) - -Shifts the baseline so as to minimize the weighted wiggle of layers. This offset is recommended for streamgraphs in conjunction with the [inside-out order](#stackOrderInsideOut). See [Stacked Graphs—Geometry & Aesthetics](http://leebyron.com/streamgraph/) by Bryon & Wattenberg for more information. diff --git a/node_modules/d3-shape/dist/d3-shape.js b/node_modules/d3-shape/dist/d3-shape.js deleted file mode 100644 index 054a0ff..0000000 --- a/node_modules/d3-shape/dist/d3-shape.js +++ /dev/null @@ -1,1949 +0,0 @@ -// https://d3js.org/d3-shape/ v1.3.7 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-path')) : -typeof define === 'function' && define.amd ? define(['exports', 'd3-path'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {}, global.d3)); -}(this, function (exports, d3Path) { 'use strict'; - -function constant(x) { - return function constant() { - return x; - }; -} - -var abs = Math.abs; -var atan2 = Math.atan2; -var cos = Math.cos; -var max = Math.max; -var min = Math.min; -var sin = Math.sin; -var sqrt = Math.sqrt; - -var epsilon = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var tau = 2 * pi; - -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} - -function asin(x) { - return x >= 1 ? halfPi : x <= -1 ? -halfPi : 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 = x1 - x0, y10 = y1 - y0, - x32 = x3 - x2, y32 = y3 - y2, - t = y32 * x10 - x32 * y10; - if (t * t < epsilon) return; - t = (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 = x0 - x1, - y01 = y0 - y1, - lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), - ox = lo * y01, - oy = -lo * x01, - x11 = x0 + ox, - y11 = y0 + oy, - x10 = x1 + ox, - y10 = y1 + oy, - x00 = (x11 + x10) / 2, - y00 = (y11 + y10) / 2, - dx = x10 - x11, - dy = y10 - y11, - d2 = dx * dx + dy * dy, - r = r1 - rc, - D = x11 * y10 - x10 * y11, - d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), - cx0 = (D * dy - dx * d) / d2, - cy0 = (-D * dx - dy * d) / d2, - cx1 = (D * dy + dx * d) / d2, - cy1 = (-D * dx + dy * d) / d2, - dx0 = cx0 - x00, - dy0 = cy0 - y00, - dx1 = cx1 - x00, - dy1 = 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 = cx1, cy0 = cy1; - - return { - cx: cx0, - cy: cy0, - x01: -ox, - y01: -oy, - x11: cx0 * (r1 / r - 1), - y11: cy0 * (r1 / r - 1) - }; -} - -function arc() { - var innerRadius = arcInnerRadius, - outerRadius = arcOuterRadius, - cornerRadius = constant(0), - padRadius = null, - startAngle = arcStartAngle, - endAngle = arcEndAngle, - padAngle = arcPadAngle, - context = null; - - function arc() { - var buffer, - r, - r0 = +innerRadius.apply(this, arguments), - r1 = +outerRadius.apply(this, arguments), - a0 = startAngle.apply(this, arguments) - halfPi, - a1 = endAngle.apply(this, arguments) - halfPi, - da = abs(a1 - a0), - cw = a1 > a0; - - if (!context) context = buffer = d3Path.path(); - - // Ensure that the outer radius is always larger than the inner radius. - if (r1 < r0) r = r1, r1 = r0, r0 = r; - - // Is it a point? - if (!(r1 > epsilon)) context.moveTo(0, 0); - - // Or is it a circle or annulus? - else if (da > tau - epsilon) { - context.moveTo(r1 * cos(a0), r1 * sin(a0)); - context.arc(0, 0, r1, a0, a1, !cw); - if (r0 > epsilon) { - context.moveTo(r0 * cos(a1), r0 * sin(a1)); - context.arc(0, 0, r0, a1, a0, cw); - } - } - - // Or is it a circular or annular sector? - else { - var a01 = a0, - a11 = a1, - a00 = a0, - a10 = a1, - da0 = da, - da1 = da, - ap = padAngle.apply(this, arguments) / 2, - rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), - rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), - rc0 = rc, - rc1 = rc, - t0, - t1; - - // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. - if (rp > epsilon) { - var p0 = asin(rp / r0 * sin(ap)), - p1 = asin(rp / r1 * sin(ap)); - if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0; - else da0 = 0, a00 = a10 = (a0 + a1) / 2; - if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1; - else da1 = 0, a01 = a11 = (a0 + a1) / 2; - } - - var x01 = r1 * cos(a01), - y01 = r1 * sin(a01), - x10 = r0 * cos(a10), - y10 = r0 * sin(a10); - - // Apply rounded corners? - if (rc > epsilon) { - var x11 = r1 * cos(a11), - y11 = r1 * sin(a11), - x00 = r0 * cos(a00), - y00 = r0 * sin(a00), - oc; - - // Restrict the corner radius according to the sector angle. - if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) { - var ax = x01 - oc[0], - ay = y01 - oc[1], - bx = x11 - oc[0], - by = y11 - oc[1], - kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), - lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = min(rc, (r0 - lc) / (kc - 1)); - rc1 = min(rc, (r1 - lc) / (kc + 1)); - } - } - - // Is the sector collapsed to a line? - if (!(da1 > epsilon)) context.moveTo(x01, y01); - - // Does the sector’s outer ring have rounded corners? - else if (rc1 > epsilon) { - t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); - t1 = 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(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); - - // Otherwise, draw the two corners and the ring. - else { - context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); - context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.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’s a circular sector? - // Or perhaps it’s an annular sector collapsed due to padding? - if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10); - - // Does the sector’s inner ring (or point) have rounded corners? - else if (rc0 > epsilon) { - t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); - t1 = 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(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); - - // Otherwise, draw the two corners and the ring. - else { - context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); - context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.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 = null, buffer + "" || null; - } - - arc.centroid = function() { - var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, - a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2; - return [cos(a) * r, sin(a) * r]; - }; - - arc.innerRadius = function(_) { - return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius; - }; - - arc.outerRadius = function(_) { - return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius; - }; - - arc.cornerRadius = function(_) { - return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius; - }; - - arc.padRadius = function(_) { - return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius; - }; - - arc.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle; - }; - - arc.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle; - }; - - arc.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle; - }; - - arc.context = function(_) { - return arguments.length ? ((context = _ == null ? null : _), arc) : context; - }; - - return arc; -} - -function Linear(context) { - this._context = context; -} - -Linear.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; // proceed - default: this._context.lineTo(x, y); break; - } - } -}; - -function curveLinear(context) { - return new Linear(context); -} - -function x(p) { - return p[0]; -} - -function y(p) { - return p[1]; -} - -function line() { - var x$1 = x, - y$1 = y, - defined = constant(true), - context = null, - curve = curveLinear, - output = null; - - function line(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - - if (context == null) output = curve(buffer = d3Path.path()); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) output.lineStart(); - else output.lineEnd(); - } - if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data)); - } - - if (buffer) return output = null, buffer + "" || null; - } - - line.x = function(_) { - return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), line) : x$1; - }; - - line.y = function(_) { - return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), line) : y$1; - }; - - line.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined; - }; - - line.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; - }; - - line.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; - }; - - return line; -} - -function area() { - var x0 = x, - x1 = null, - y0 = constant(0), - y1 = y, - defined = constant(true), - context = null, - curve = curveLinear, - output = null; - - function area(data) { - var i, - j, - k, - n = data.length, - d, - defined0 = false, - buffer, - x0z = new Array(n), - y0z = new Array(n); - - if (context == null) output = curve(buffer = d3Path.path()); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) { - j = i; - output.areaStart(); - output.lineStart(); - } else { - output.lineEnd(); - output.lineStart(); - for (k = i - 1; k >= j; --k) { - output.point(x0z[k], y0z[k]); - } - output.lineEnd(); - output.areaEnd(); - } - } - if (defined0) { - x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); - output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); - } - } - - if (buffer) return output = null, buffer + "" || null; - } - - function arealine() { - return line().defined(defined).curve(curve).context(context); - } - - area.x = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area) : x0; - }; - - area.x0 = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), area) : x0; - }; - - area.x1 = function(_) { - return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : x1; - }; - - area.y = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area) : y0; - }; - - area.y0 = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), area) : y0; - }; - - area.y1 = function(_) { - return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : y1; - }; - - area.lineX0 = - area.lineY0 = function() { - return arealine().x(x0).y(y0); - }; - - area.lineY1 = function() { - return arealine().x(x0).y(y1); - }; - - area.lineX1 = function() { - return arealine().x(x1).y(y0); - }; - - area.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), area) : defined; - }; - - area.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; - }; - - area.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; - }; - - return area; -} - -function descending(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} - -function identity(d) { - return d; -} - -function pie() { - var value = identity, - sortValues = descending, - sort = null, - startAngle = constant(0), - endAngle = constant(tau), - padAngle = constant(0); - - function pie(data) { - var i, - n = data.length, - j, - k, - sum = 0, - index = new Array(n), - arcs = new Array(n), - a0 = +startAngle.apply(this, arguments), - da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), - a1, - p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), - pa = p * (da < 0 ? -1 : 1), - v; - - for (i = 0; i < n; ++i) { - if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) { - sum += v; - } - } - - // Optionally sort the arcs by previously-computed values or by data. - if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); }); - else if (sort != 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 = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) { - j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = { - data: data[j], - index: i, - value: v, - startAngle: a0, - endAngle: a1, - padAngle: p - }; - } - - return arcs; - } - - pie.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value; - }; - - pie.sortValues = function(_) { - return arguments.length ? (sortValues = _, sort = null, pie) : sortValues; - }; - - pie.sort = function(_) { - return arguments.length ? (sort = _, sortValues = null, pie) : sort; - }; - - pie.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle; - }; - - pie.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle; - }; - - pie.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle; - }; - - return pie; -} - -var curveRadialLinear = curveRadial(curveLinear); - -function Radial(curve) { - this._curve = curve; -} - -Radial.prototype = { - 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 = curve; - - return radial; -} - -function lineRadial(l) { - var c = l.curve; - - l.angle = l.x, delete l.x; - l.radius = l.y, delete l.y; - - l.curve = function(_) { - return arguments.length ? c(curveRadial(_)) : c()._curve; - }; - - return l; -} - -function lineRadial$1() { - return lineRadial(line().curve(curveRadialLinear)); -} - -function areaRadial() { - var a = area().curve(curveRadialLinear), - c = a.curve, - x0 = a.lineX0, - x1 = a.lineX1, - y0 = a.lineY0, - y1 = a.lineY1; - - a.angle = a.x, delete a.x; - a.startAngle = a.x0, delete a.x0; - a.endAngle = a.x1, delete a.x1; - a.radius = a.y, delete a.y; - a.innerRadius = a.y0, delete a.y0; - a.outerRadius = a.y1, delete a.y1; - a.lineStartAngle = function() { return lineRadial(x0()); }, delete a.lineX0; - a.lineEndAngle = function() { return lineRadial(x1()); }, delete a.lineX1; - a.lineInnerRadius = function() { return lineRadial(y0()); }, delete a.lineY0; - a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1; - - a.curve = function(_) { - return arguments.length ? c(curveRadial(_)) : c()._curve; - }; - - return a; -} - -function pointRadial(x, y) { - return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)]; -} - -var slice = Array.prototype.slice; - -function linkSource(d) { - return d.source; -} - -function linkTarget(d) { - return d.target; -} - -function link(curve) { - var source = linkSource, - target = linkTarget, - x$1 = x, - y$1 = y, - context = null; - - function link() { - var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv); - if (!context) context = buffer = d3Path.path(); - curve(context, +x$1.apply(this, (argv[0] = s, argv)), +y$1.apply(this, argv), +x$1.apply(this, (argv[0] = t, argv)), +y$1.apply(this, argv)); - if (buffer) return context = null, buffer + "" || null; - } - - link.source = function(_) { - return arguments.length ? (source = _, link) : source; - }; - - link.target = function(_) { - return arguments.length ? (target = _, link) : target; - }; - - link.x = function(_) { - return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), link) : x$1; - }; - - link.y = function(_) { - return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), link) : y$1; - }; - - link.context = function(_) { - return arguments.length ? ((context = _ == null ? null : _), link) : context; - }; - - return link; -} - -function curveHorizontal(context, x0, y0, x1, y1) { - context.moveTo(x0, y0); - context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1); -} - -function curveVertical(context, x0, y0, x1, y1) { - context.moveTo(x0, y0); - context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1); -} - -function curveRadial$1(context, x0, y0, x1, y1) { - var p0 = pointRadial(x0, y0), - p1 = pointRadial(x0, y0 = (y0 + y1) / 2), - p2 = pointRadial(x1, y0), - p3 = 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(curveHorizontal); -} - -function linkVertical() { - return link(curveVertical); -} - -function linkRadial() { - var l = link(curveRadial$1); - l.angle = l.x, delete l.x; - l.radius = l.y, delete l.y; - return l; -} - -var circle = { - draw: function(context, size) { - var r = Math.sqrt(size / pi); - context.moveTo(r, 0); - context.arc(0, 0, r, 0, tau); - } -}; - -var cross = { - draw: function(context, size) { - var r = 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 = Math.sqrt(1 / 3), - tan30_2 = tan30 * 2; - -var diamond = { - draw: function(context, size) { - var y = Math.sqrt(size / tan30_2), - x = y * tan30; - context.moveTo(0, -y); - context.lineTo(x, 0); - context.lineTo(0, y); - context.lineTo(-x, 0); - context.closePath(); - } -}; - -var ka = 0.89081309152928522810, - kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10), - kx = Math.sin(tau / 10) * kr, - ky = -Math.cos(tau / 10) * kr; - -var star = { - draw: function(context, size) { - var r = Math.sqrt(size * ka), - x = kx * r, - y = ky * r; - context.moveTo(0, -r); - context.lineTo(x, y); - for (var i = 1; i < 5; ++i) { - var a = tau * i / 5, - c = Math.cos(a), - s = Math.sin(a); - context.lineTo(s * r, -c * r); - context.lineTo(c * x - s * y, s * x + c * y); - } - context.closePath(); - } -}; - -var square = { - draw: function(context, size) { - var w = Math.sqrt(size), - x = -w / 2; - context.rect(x, x, w, w); - } -}; - -var sqrt3 = Math.sqrt(3); - -var triangle = { - draw: function(context, size) { - var y = -Math.sqrt(size / (sqrt3 * 3)); - context.moveTo(0, y * 2); - context.lineTo(-sqrt3 * y, -y); - context.lineTo(sqrt3 * y, -y); - context.closePath(); - } -}; - -var c = -0.5, - s = Math.sqrt(3) / 2, - k = 1 / Math.sqrt(12), - a = (k / 2 + 1) * 3; - -var wye = { - draw: function(context, size) { - var r = Math.sqrt(size / a), - x0 = r / 2, - y0 = r * k, - x1 = x0, - y1 = r * k + r, - x2 = -x1, - y2 = y1; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - context.lineTo(c * x0 - s * y0, s * x0 + c * y0); - context.lineTo(c * x1 - s * y1, s * x1 + c * y1); - context.lineTo(c * x2 - s * y2, s * x2 + c * y2); - context.lineTo(c * x0 + s * y0, c * y0 - s * x0); - context.lineTo(c * x1 + s * y1, c * y1 - s * x1); - context.lineTo(c * x2 + s * y2, c * y2 - s * x2); - context.closePath(); - } -}; - -var symbols = [ - circle, - cross, - diamond, - square, - star, - triangle, - wye -]; - -function symbol() { - var type = constant(circle), - size = constant(64), - context = null; - - function symbol() { - var buffer; - if (!context) context = buffer = d3Path.path(); - type.apply(this, arguments).draw(context, +size.apply(this, arguments)); - if (buffer) return context = null, buffer + "" || null; - } - - symbol.type = function(_) { - return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type; - }; - - symbol.size = function(_) { - return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size; - }; - - symbol.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, symbol) : context; - }; - - return symbol; -} - -function noop() {} - -function point(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 = context; -} - -Basis.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = - this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 3: point(this, this._x1, this._y1); // proceed - case 2: this._context.lineTo(this._x1, this._y1); break; - } - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; break; - case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -function basis(context) { - return new Basis(context); -} - -function BasisClosed(context) { - this._context = context; -} - -BasisClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = - this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; - this._point = 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 = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._x2 = x, this._y2 = y; break; - case 1: this._point = 2; this._x3 = x, this._y3 = y; break; - case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break; - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -function basisClosed(context) { - return new BasisClosed(context); -} - -function BasisOpen(context) { - this._context = context; -} - -BasisOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = - this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; break; - case 1: this._point = 2; break; - case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break; - case 3: this._point = 4; // proceed - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -function basisOpen(context) { - return new BasisOpen(context); -} - -function Bundle(context, beta) { - this._basis = new Basis(context); - this._beta = beta; -} - -Bundle.prototype = { - lineStart: function() { - this._x = []; - this._y = []; - this._basis.lineStart(); - }, - lineEnd: function() { - var x = this._x, - y = this._y, - j = x.length - 1; - - if (j > 0) { - var x0 = x[0], - y0 = y[0], - dx = x[j] - x0, - dy = y[j] - y0, - i = -1, - t; - - while (++i <= j) { - t = 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 = this._y = null; - this._basis.lineEnd(); - }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; - -var bundle = (function custom(beta) { - - function bundle(context) { - return beta === 1 ? new Basis(context) : new Bundle(context, beta); - } - - bundle.beta = function(beta) { - return custom(+beta); - }; - - return bundle; -})(0.85); - -function point$1(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 = context; - this._k = (1 - tension) / 6; -} - -Cardinal.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 2: this._context.lineTo(this._x2, this._y2); break; - case 3: point$1(this, this._x1, this._y1); break; - } - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; this._x1 = x, this._y1 = y; break; - case 2: this._point = 3; // proceed - default: point$1(this, x, y); break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -var cardinal = (function custom(tension) { - - function cardinal(context) { - return new Cardinal(context, tension); - } - - cardinal.tension = function(tension) { - return custom(+tension); - }; - - return cardinal; -})(0); - -function CardinalClosed(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} - -CardinalClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = - this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._point = 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 = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._x3 = x, this._y3 = y; break; - case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; - case 2: this._point = 3; this._x5 = x, this._y5 = y; break; - default: point$1(this, x, y); break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -var cardinalClosed = (function custom(tension) { - - function cardinal(context) { - return new CardinalClosed(context, tension); - } - - cardinal.tension = function(tension) { - return custom(+tension); - }; - - return cardinal; -})(0); - -function CardinalOpen(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} - -CardinalOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; break; - case 1: this._point = 2; break; - case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; - case 3: this._point = 4; // proceed - default: point$1(this, x, y); break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -var cardinalOpen = (function custom(tension) { - - function cardinal(context) { - return new CardinalOpen(context, tension); - } - - cardinal.tension = function(tension) { - return custom(+tension); - }; - - return cardinal; -})(0); - -function point$2(that, x, y) { - var x1 = that._x1, - y1 = that._y1, - x2 = that._x2, - y2 = that._y2; - - if (that._l01_a > epsilon) { - var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, - n = 3 * that._l01_a * (that._l01_a + that._l12_a); - x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; - y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; - } - - if (that._l23_a > epsilon) { - var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, - m = 3 * that._l23_a * (that._l23_a + that._l12_a); - x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; - y2 = (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 = context; - this._alpha = alpha; -} - -CatmullRom.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = - this._l01_2a = this._l12_2a = this._l23_2a = - this._point = 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 !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; break; - case 2: this._point = 3; // proceed - default: point$2(this, x, y); break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -var catmullRom = (function custom(alpha) { - - function catmullRom(context) { - return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); - } - - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - - return catmullRom; -})(0.5); - -function CatmullRomClosed(context, alpha) { - this._context = context; - this._alpha = alpha; -} - -CatmullRomClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = - this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._l01_a = this._l12_a = this._l23_a = - this._l01_2a = this._l12_2a = this._l23_2a = - this._point = 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 = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: this._point = 1; this._x3 = x, this._y3 = y; break; - case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; - case 2: this._point = 3; this._x5 = x, this._y5 = y; break; - default: point$2(this, x, y); break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -var catmullRomClosed = (function custom(alpha) { - - function catmullRom(context) { - return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); - } - - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - - return catmullRom; -})(0.5); - -function CatmullRomOpen(context, alpha) { - this._context = context; - this._alpha = alpha; -} - -CatmullRomOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = - this._l01_2a = this._l12_2a = this._l23_2a = - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: this._point = 1; break; - case 1: this._point = 2; break; - case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; - case 3: this._point = 4; // proceed - default: point$2(this, x, y); break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -var catmullRomOpen = (function custom(alpha) { - - function catmullRom(context) { - return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); - } - - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - - return catmullRom; -})(0.5); - -function LinearClosed(context) { - this._context = context; -} - -LinearClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._point) this._context.closePath(); - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) this._context.lineTo(x, y); - else this._point = 1, this._context.moveTo(x, y); - } -}; - -function linearClosed(context) { - return new LinearClosed(context); -} - -function sign(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 = that._x1 - that._x0, - h1 = x2 - that._x1, - s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), - s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), - p = (s0 * h1 + s1 * h0) / (h0 + h1); - return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; -} - -// Calculate a one-sided slope. -function slope2(that, t) { - var h = 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#Representations -// "you can express cubic Hermite interpolation in terms of cubic Bézier curves -// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". -function point$3(that, t0, t1) { - var x0 = that._x0, - y0 = that._y0, - x1 = that._x1, - y1 = that._y1, - dx = (x1 - x0) / 3; - that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); -} - -function MonotoneX(context) { - this._context = context; -} - -MonotoneX.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = - this._y0 = this._y1 = - this._t0 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 2: this._context.lineTo(this._x1, this._y1); break; - case 3: point$3(this, this._t0, slope2(this, this._t0)); break; - } - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - var t1 = NaN; - - x = +x, y = +y; - if (x === this._x1 && y === this._y1) return; // Ignore coincident points. - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; break; - case 2: this._point = 3; point$3(this, slope2(this, t1 = slope3(this, x, y)), t1); break; - default: point$3(this, this._t0, t1 = slope3(this, x, y)); break; - } - - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - this._t0 = t1; - } -}; - -function MonotoneY(context) { - this._context = new ReflectContext(context); -} - -(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { - MonotoneX.prototype.point.call(this, y, x); -}; - -function ReflectContext(context) { - this._context = context; -} - -ReflectContext.prototype = { - 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.bezierCurveTo(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 = context; -} - -Natural.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = []; - this._y = []; - }, - lineEnd: function() { - var x = this._x, - y = this._y, - n = x.length; - - if (n) { - this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); - if (n === 2) { - this._context.lineTo(x[1], y[1]); - } else { - var px = controlPoints(x), - py = controlPoints(y); - for (var i0 = 0, i1 = 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 !== 0 && n === 1)) this._context.closePath(); - this._line = 1 - this._line; - this._x = this._y = 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 = x.length - 1, - m, - a = new Array(n), - b = new Array(n), - r = new Array(n); - a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; - for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; - a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; - for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; - a[n - 1] = r[n - 1] / b[n - 1]; - for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i]; - b[n - 1] = (x[n] + a[n - 1]) / 2; - for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1]; - return [a, b]; -} - -function natural(context) { - return new Natural(context); -} - -function Step(context, t) { - this._context = context; - this._t = t; -} - -Step.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = this._y = NaN; - this._point = 0; - }, - lineEnd: function() { - if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; // proceed - default: { - if (this._t <= 0) { - this._context.lineTo(this._x, y); - this._context.lineTo(x, y); - } else { - var x1 = this._x * (1 - this._t) + x * this._t; - this._context.lineTo(x1, this._y); - this._context.lineTo(x1, y); - } - break; - } - } - this._x = x, this._y = 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(series, order) { - if (!((n = series.length) > 1)) return; - for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) { - s0 = s1, s1 = series[order[i]]; - for (j = 0; j < m; ++j) { - s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; - } - } -} - -function none$1(series) { - var n = series.length, o = new Array(n); - while (--n >= 0) o[n] = n; - return o; -} - -function stackValue(d, key) { - return d[key]; -} - -function stack() { - var keys = constant([]), - order = none$1, - offset = none, - value = stackValue; - - function stack(data) { - var kz = keys.apply(this, arguments), - i, - m = data.length, - n = kz.length, - sz = new Array(n), - oz; - - for (i = 0; i < n; ++i) { - for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) { - si[j] = sij = [0, +value(data[j], ki, j, data)]; - sij.data = data[j]; - } - si.key = ki; - } - - for (i = 0, oz = order(sz); i < n; ++i) { - sz[oz[i]].index = i; - } - - offset(sz, oz); - return sz; - } - - stack.keys = function(_) { - return arguments.length ? (keys = typeof _ === "function" ? _ : constant(slice.call(_)), stack) : keys; - }; - - stack.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack) : value; - }; - - stack.order = function(_) { - return arguments.length ? (order = _ == null ? none$1 : typeof _ === "function" ? _ : constant(slice.call(_)), stack) : order; - }; - - stack.offset = function(_) { - return arguments.length ? (offset = _ == null ? none : _, stack) : offset; - }; - - return stack; -} - -function expand(series, order) { - if (!((n = series.length) > 0)) return; - for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) { - for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0; - if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y; - } - none(series, order); -} - -function diverging(series, order) { - if (!((n = series.length) > 0)) return; - for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) { - for (yp = yn = 0, i = 0; i < n; ++i) { - if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) { - d[0] = yp, d[1] = yp += dy; - } else if (dy < 0) { - d[1] = yn, d[0] = yn += dy; - } else { - d[0] = 0, d[1] = dy; - } - } - } -} - -function silhouette(series, order) { - if (!((n = series.length) > 0)) return; - for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) { - for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0; - s0[j][1] += s0[j][0] = -y / 2; - } - none(series, order); -} - -function wiggle(series, order) { - if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return; - for (var y = 0, j = 1, s0, m, n; j < m; ++j) { - for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { - var si = series[order[i]], - sij0 = si[j][1] || 0, - sij1 = si[j - 1][1] || 0, - s3 = (sij0 - sij1) / 2; - for (var k = 0; k < i; ++k) { - var sk = series[order[k]], - skj0 = sk[j][1] || 0, - skj1 = sk[j - 1][1] || 0; - s3 += skj0 - skj1; - } - s1 += sij0, s2 += s3 * sij0; - } - s0[j - 1][1] += s0[j - 1][0] = y; - if (s1) y -= s2 / s1; - } - s0[j - 1][1] += s0[j - 1][0] = y; - none(series, order); -} - -function appearance(series) { - var peaks = series.map(peak); - return none$1(series).sort(function(a, b) { return peaks[a] - peaks[b]; }); -} - -function peak(series) { - var i = -1, j = 0, n = series.length, vi, vj = -Infinity; - while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i; - return j; -} - -function ascending(series) { - var sums = series.map(sum); - return none$1(series).sort(function(a, b) { return sums[a] - sums[b]; }); -} - -function sum(series) { - var s = 0, i = -1, n = series.length, v; - while (++i < n) if (v = +series[i][1]) s += v; - return s; -} - -function descending$1(series) { - return ascending(series).reverse(); -} - -function insideOut(series) { - var n = series.length, - i, - j, - sums = series.map(sum), - order = appearance(series), - top = 0, - bottom = 0, - tops = [], - bottoms = []; - - for (i = 0; i < n; ++i) { - j = order[i]; - if (top < bottom) { - top += sums[j]; - tops.push(j); - } else { - bottom += sums[j]; - bottoms.push(j); - } - } - - return bottoms.reverse().concat(tops); -} - -function reverse(series) { - return none$1(series).reverse(); -} - -exports.arc = arc; -exports.area = area; -exports.areaRadial = areaRadial; -exports.curveBasis = basis; -exports.curveBasisClosed = basisClosed; -exports.curveBasisOpen = basisOpen; -exports.curveBundle = bundle; -exports.curveCardinal = cardinal; -exports.curveCardinalClosed = cardinalClosed; -exports.curveCardinalOpen = cardinalOpen; -exports.curveCatmullRom = catmullRom; -exports.curveCatmullRomClosed = catmullRomClosed; -exports.curveCatmullRomOpen = catmullRomOpen; -exports.curveLinear = curveLinear; -exports.curveLinearClosed = linearClosed; -exports.curveMonotoneX = monotoneX; -exports.curveMonotoneY = monotoneY; -exports.curveNatural = natural; -exports.curveStep = step; -exports.curveStepAfter = stepAfter; -exports.curveStepBefore = stepBefore; -exports.line = line; -exports.lineRadial = lineRadial$1; -exports.linkHorizontal = linkHorizontal; -exports.linkRadial = linkRadial; -exports.linkVertical = linkVertical; -exports.pie = pie; -exports.pointRadial = pointRadial; -exports.radialArea = areaRadial; -exports.radialLine = lineRadial$1; -exports.stack = stack; -exports.stackOffsetDiverging = diverging; -exports.stackOffsetExpand = expand; -exports.stackOffsetNone = none; -exports.stackOffsetSilhouette = silhouette; -exports.stackOffsetWiggle = wiggle; -exports.stackOrderAppearance = appearance; -exports.stackOrderAscending = ascending; -exports.stackOrderDescending = descending$1; -exports.stackOrderInsideOut = insideOut; -exports.stackOrderNone = none$1; -exports.stackOrderReverse = reverse; -exports.symbol = symbol; -exports.symbolCircle = circle; -exports.symbolCross = cross; -exports.symbolDiamond = diamond; -exports.symbolSquare = square; -exports.symbolStar = star; -exports.symbolTriangle = triangle; -exports.symbolWye = wye; -exports.symbols = symbols; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-shape/dist/d3-shape.min.js b/node_modules/d3-shape/dist/d3-shape.min.js deleted file mode 100644 index 88c96e3..0000000 --- a/node_modules/d3-shape/dist/d3-shape.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-shape/ v1.3.7 Copyright 2019 Mike Bostock -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-path"],n):n((t=t||self).d3=t.d3||{},t.d3)}(this,function(t,n){"use strict";function i(t){return function(){return t}}var e=Math.abs,s=Math.atan2,h=Math.cos,o=Math.max,_=Math.min,r=Math.sin,a=Math.sqrt,c=1e-12,l=Math.PI,u=l/2,f=2*l;function x(t){return t>=1?u:t<=-1?-u:Math.asin(t)}function y(t){return t.innerRadius}function p(t){return t.outerRadius}function v(t){return t.startAngle}function d(t){return t.endAngle}function T(t){return t&&t.padAngle}function g(t,n,i,e,s,h,_){var r=t-i,c=n-e,l=(_?h:-h)/a(r*r+c*c),u=l*c,f=-l*r,x=t+u,y=n+f,p=i+u,v=e+f,d=(x+p)/2,T=(y+v)/2,g=p-x,b=v-y,w=g*g+b*b,k=s-h,m=x*v-p*y,N=(b<0?-1:1)*a(o(0,k*k*w-m*m)),M=(m*b-g*N)/w,S=(-m*g-b*N)/w,E=(m*b+g*N)/w,A=(-m*g+b*N)/w,P=M-d,C=S-T,O=E-d,R=A-T;return P*P+C*C>O*O+R*R&&(M=E,S=A),{cx:M,cy:S,x01:-u,y01:-f,x11:M*(s/k-1),y11:S*(s/k-1)}}function b(t){this._context=t}function w(t){return new b(t)}function k(t){return t[0]}function m(t){return t[1]}function N(){var t=k,e=m,s=i(!0),h=null,o=w,_=null;function r(i){var r,a,c,l=i.length,u=!1;for(null==h&&(_=o(c=n.path())),r=0;r<=l;++r)!(r=l;--u)a.point(v[u],d[u]);a.lineEnd(),a.areaEnd()}p&&(v[c]=+t(f,c,i),d[c]=+s(f,c,i),a.point(e?+e(f,c,i):v[c],h?+h(f,c,i):d[c]))}if(x)return a=null,x+""||null}function l(){return N().defined(o).curve(r).context(_)}return c.x=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),e=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),c):t},c.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:i(+t),c):e},c.y=function(t){return arguments.length?(s="function"==typeof t?t:i(+t),h=null,c):s},c.y0=function(t){return arguments.length?(s="function"==typeof t?t:i(+t),c):s},c.y1=function(t){return arguments.length?(h=null==t?null:"function"==typeof t?t:i(+t),c):h},c.lineX0=c.lineY0=function(){return l().x(t).y(s)},c.lineY1=function(){return l().x(t).y(h)},c.lineX1=function(){return l().x(e).y(s)},c.defined=function(t){return arguments.length?(o="function"==typeof t?t:i(!!t),c):o},c.curve=function(t){return arguments.length?(r=t,null!=_&&(a=r(_)),c):r},c.context=function(t){return arguments.length?(null==t?_=a=null:a=r(_=t),c):_},c}function S(t,n){return nt?1:n>=t?0:NaN}function E(t){return t}b.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var A=C(w);function P(t){this._curve=t}function C(t){function n(n){return new P(t(n))}return n._curve=t,n}function O(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(C(t)):n()._curve},t}function R(){return O(N().curve(A))}function q(){var t=M().curve(A),n=t.curve,i=t.lineX0,e=t.lineX1,s=t.lineY0,h=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return O(i())},delete t.lineX0,t.lineEndAngle=function(){return O(e())},delete t.lineX1,t.lineInnerRadius=function(){return O(s())},delete t.lineY0,t.lineOuterRadius=function(){return O(h())},delete t.lineY1,t.curve=function(t){return arguments.length?n(C(t)):n()._curve},t}function z(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}P.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var X=Array.prototype.slice;function Y(t){return t.source}function B(t){return t.target}function I(t){var e=Y,s=B,h=k,o=m,_=null;function r(){var i,r=X.call(arguments),a=e.apply(this,r),c=s.apply(this,r);if(_||(_=i=n.path()),t(_,+h.apply(this,(r[0]=a,r)),+o.apply(this,r),+h.apply(this,(r[0]=c,r)),+o.apply(this,r)),i)return _=null,i+""||null}return r.source=function(t){return arguments.length?(e=t,r):e},r.target=function(t){return arguments.length?(s=t,r):s},r.x=function(t){return arguments.length?(h="function"==typeof t?t:i(+t),r):h},r.y=function(t){return arguments.length?(o="function"==typeof t?t:i(+t),r):o},r.context=function(t){return arguments.length?(_=null==t?null:t,r):_},r}function j(t,n,i,e,s){t.moveTo(n,i),t.bezierCurveTo(n=(n+e)/2,i,n,s,e,s)}function D(t,n,i,e,s){t.moveTo(n,i),t.bezierCurveTo(n,i=(i+s)/2,e,i,e,s)}function L(t,n,i,e,s){var h=z(n,i),o=z(n,i=(i+s)/2),_=z(e,i),r=z(e,s);t.moveTo(h[0],h[1]),t.bezierCurveTo(o[0],o[1],_[0],_[1],r[0],r[1])}var V={draw:function(t,n){var i=Math.sqrt(n/l);t.moveTo(i,0),t.arc(0,0,i,0,f)}},W={draw:function(t,n){var i=Math.sqrt(n/5)/2;t.moveTo(-3*i,-i),t.lineTo(-i,-i),t.lineTo(-i,-3*i),t.lineTo(i,-3*i),t.lineTo(i,-i),t.lineTo(3*i,-i),t.lineTo(3*i,i),t.lineTo(i,i),t.lineTo(i,3*i),t.lineTo(-i,3*i),t.lineTo(-i,i),t.lineTo(-3*i,i),t.closePath()}},H=Math.sqrt(1/3),F=2*H,G={draw:function(t,n){var i=Math.sqrt(n/F),e=i*H;t.moveTo(0,-i),t.lineTo(e,0),t.lineTo(0,i),t.lineTo(-e,0),t.closePath()}},J=Math.sin(l/10)/Math.sin(7*l/10),K=Math.sin(f/10)*J,Q=-Math.cos(f/10)*J,U={draw:function(t,n){var i=Math.sqrt(.8908130915292852*n),e=K*i,s=Q*i;t.moveTo(0,-i),t.lineTo(e,s);for(var h=1;h<5;++h){var o=f*h/5,_=Math.cos(o),r=Math.sin(o);t.lineTo(r*i,-_*i),t.lineTo(_*e-r*s,r*e+_*s)}t.closePath()}},Z={draw:function(t,n){var i=Math.sqrt(n),e=-i/2;t.rect(e,e,i,i)}},$=Math.sqrt(3),tt={draw:function(t,n){var i=-Math.sqrt(n/(3*$));t.moveTo(0,2*i),t.lineTo(-$*i,-i),t.lineTo($*i,-i),t.closePath()}},nt=-.5,it=Math.sqrt(3)/2,et=1/Math.sqrt(12),st=3*(et/2+1),ht={draw:function(t,n){var i=Math.sqrt(n/st),e=i/2,s=i*et,h=e,o=i*et+i,_=-h,r=o;t.moveTo(e,s),t.lineTo(h,o),t.lineTo(_,r),t.lineTo(nt*e-it*s,it*e+nt*s),t.lineTo(nt*h-it*o,it*h+nt*o),t.lineTo(nt*_-it*r,it*_+nt*r),t.lineTo(nt*e+it*s,nt*s-it*e),t.lineTo(nt*h+it*o,nt*o-it*h),t.lineTo(nt*_+it*r,nt*r-it*_),t.closePath()}},ot=[V,W,G,Z,U,tt,ht];function _t(){}function rt(t,n,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+i)/6)}function at(t){this._context=t}function ct(t){this._context=t}function lt(t){this._context=t}function ut(t,n){this._basis=new at(t),this._beta=n}at.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:rt(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:rt(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},ct.prototype={areaStart:_t,areaEnd:_t,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=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)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:rt(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},lt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var i=(this._x0+4*this._x1+t)/6,e=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 3:this._point=4;default:rt(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},ut.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,i=t.length-1;if(i>0)for(var e,s=t[0],h=n[0],o=t[i]-s,_=n[i]-h,r=-1;++r<=i;)e=r/i,this._basis.point(this._beta*t[r]+(1-this._beta)*(s+e*o),this._beta*n[r]+(1-this._beta)*(h+e*_));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var ft=function t(n){function i(t){return 1===n?new at(t):new ut(t,n)}return i.beta=function(n){return t(+n)},i}(.85);function xt(t,n,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function yt(t,n){this._context=t,this._k=(1-n)/6}yt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:xt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:xt(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var pt=function t(n){function i(t){return new yt(t,n)}return i.tension=function(n){return t(+n)},i}(0);function vt(t,n){this._context=t,this._k=(1-n)/6}vt.prototype={areaStart:_t,areaEnd:_t,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=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)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:xt(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var dt=function t(n){function i(t){return new vt(t,n)}return i.tension=function(n){return t(+n)},i}(0);function Tt(t,n){this._context=t,this._k=(1-n)/6}Tt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:xt(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var gt=function t(n){function i(t){return new Tt(t,n)}return i.tension=function(n){return t(+n)},i}(0);function bt(t,n,i){var e=t._x1,s=t._y1,h=t._x2,o=t._y2;if(t._l01_a>c){var _=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,r=3*t._l01_a*(t._l01_a+t._l12_a);e=(e*_-t._x0*t._l12_2a+t._x2*t._l01_2a)/r,s=(s*_-t._y0*t._l12_2a+t._y2*t._l01_2a)/r}if(t._l23_a>c){var a=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);h=(h*a+t._x1*t._l23_2a-n*t._l12_2a)/l,o=(o*a+t._y1*t._l23_2a-i*t._l12_2a)/l}t._context.bezierCurveTo(e,s,h,o,t._x2,t._y2)}function wt(t,n){this._context=t,this._alpha=n}wt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:bt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var kt=function t(n){function i(t){return n?new wt(t,n):new yt(t,0)}return i.alpha=function(n){return t(+n)},i}(.5);function mt(t,n){this._context=t,this._alpha=n}mt.prototype={areaStart:_t,areaEnd:_t,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=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)}},point:function(t,n){if(t=+t,n=+n,this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:bt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Nt=function t(n){function i(t){return n?new mt(t,n):new vt(t,0)}return i.alpha=function(n){return t(+n)},i}(.5);function Mt(t,n){this._context=t,this._alpha=n}Mt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:bt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var St=function t(n){function i(t){return n?new Mt(t,n):new Tt(t,0)}return i.alpha=function(n){return t(+n)},i}(.5);function Et(t){this._context=t}function At(t){return t<0?-1:1}function Pt(t,n,i){var e=t._x1-t._x0,s=n-t._x1,h=(t._y1-t._y0)/(e||s<0&&-0),o=(i-t._y1)/(s||e<0&&-0),_=(h*s+o*e)/(e+s);return(At(h)+At(o))*Math.min(Math.abs(h),Math.abs(o),.5*Math.abs(_))||0}function Ct(t,n){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-n)/2:n}function Ot(t,n,i){var e=t._x0,s=t._y0,h=t._x1,o=t._y1,_=(h-e)/3;t._context.bezierCurveTo(e+_,s+_*n,h-_,o-_*i,h,o)}function Rt(t){this._context=t}function qt(t){this._context=new zt(t)}function zt(t){this._context=t}function Xt(t){this._context=t}function Yt(t){var n,i,e=t.length-1,s=new Array(e),h=new Array(e),o=new Array(e);for(s[0]=0,h[0]=2,o[0]=t[0]+2*t[1],n=1;n=0;--n)s[n]=(o[n]-s[n+1])/h[n];for(h[e-1]=(t[e]+s[e-1])/2,n=0;n1)for(var i,e,s,h=1,o=t[n[0]],_=o.length;h=0;)i[n]=n;return i}function Dt(t,n){return t[n]}function Lt(t){var n=t.map(Vt);return jt(t).sort(function(t,i){return n[t]-n[i]})}function Vt(t){for(var n,i=-1,e=0,s=t.length,h=-1/0;++ih&&(h=n,e=i);return e}function Wt(t){var n=t.map(Ht);return jt(t).sort(function(t,i){return n[t]-n[i]})}function Ht(t){for(var n,i=0,e=-1,s=t.length;++e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y),this._context.lineTo(i,n)}}this._x=t,this._y=n}},t.arc=function(){var t=y,o=p,b=i(0),w=null,k=v,m=d,N=T,M=null;function S(){var i,y,p=+t.apply(this,arguments),v=+o.apply(this,arguments),d=k.apply(this,arguments)-u,T=m.apply(this,arguments)-u,S=e(T-d),E=T>d;if(M||(M=i=n.path()),vc)if(S>f-c)M.moveTo(v*h(d),v*r(d)),M.arc(0,0,v,d,T,!E),p>c&&(M.moveTo(p*h(T),p*r(T)),M.arc(0,0,p,T,d,E));else{var A,P,C=d,O=T,R=d,q=T,z=S,X=S,Y=N.apply(this,arguments)/2,B=Y>c&&(w?+w.apply(this,arguments):a(p*p+v*v)),I=_(e(v-p)/2,+b.apply(this,arguments)),j=I,D=I;if(B>c){var L=x(B/p*r(Y)),V=x(B/v*r(Y));(z-=2*L)>c?(R+=L*=E?1:-1,q-=L):(z=0,R=q=(d+T)/2),(X-=2*V)>c?(C+=V*=E?1:-1,O-=V):(X=0,C=O=(d+T)/2)}var W=v*h(C),H=v*r(C),F=p*h(q),G=p*r(q);if(I>c){var J,K=v*h(O),Q=v*r(O),U=p*h(R),Z=p*r(R);if(S1?0:t<-1?l:Math.acos(t)}(($*nt+tt*it)/(a($*$+tt*tt)*a(nt*nt+it*it)))/2),st=a(J[0]*J[0]+J[1]*J[1]);j=_(I,(p-st)/(et-1)),D=_(I,(v-st)/(et+1))}}X>c?D>c?(A=g(U,Z,W,H,v,D,E),P=g(K,Q,F,G,v,D,E),M.moveTo(A.cx+A.x01,A.cy+A.y01),Dc&&z>c?j>c?(A=g(F,G,K,Q,p,-j,E),P=g(W,H,U,Z,p,-j,E),M.lineTo(A.cx+A.x01,A.cy+A.y01),j0&&(x+=l);for(null!=n?y.sort(function(t,i){return n(p[t],p[i])}):null!=e&&y.sort(function(t,n){return e(i[t],i[n])}),_=0,a=x?(d-u*g)/x:0;_0?l*a:0)+g,p[r]={data:i[r],index:_,value:l,startAngle:v,endAngle:c,padAngle:T};return p}return _.value=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),_):t},_.sortValues=function(t){return arguments.length?(n=t,e=null,_):n},_.sort=function(t){return arguments.length?(e=t,n=null,_):e},_.startAngle=function(t){return arguments.length?(s="function"==typeof t?t:i(+t),_):s},_.endAngle=function(t){return arguments.length?(h="function"==typeof t?t:i(+t),_):h},_.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:i(+t),_):o},_},t.pointRadial=z,t.radialArea=q,t.radialLine=R,t.stack=function(){var t=i([]),n=jt,e=It,s=Dt;function h(i){var h,o,_=t.apply(this,arguments),r=i.length,a=_.length,c=new Array(a);for(h=0;h0)for(var i,e,s,h,o,_,r=0,a=t[n[0]].length;r0?(e[0]=h,e[1]=h+=s):s<0?(e[1]=o,e[0]=o+=s):(e[0]=0,e[1]=s)},t.stackOffsetExpand=function(t,n){if((e=t.length)>0){for(var i,e,s,h=0,o=t[0].length;h0){for(var i,e=0,s=t[n[0]],h=s.length;e0&&(e=(i=t[n[0]]).length)>0){for(var i,e,s,h=0,o=1;o dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; - - return { - cx: cx0, - cy: cy0, - x01: -ox, - y01: -oy, - x11: cx0 * (r1 / r - 1), - y11: cy0 * (r1 / r - 1) - }; -} - -export default function() { - var innerRadius = arcInnerRadius, - outerRadius = arcOuterRadius, - cornerRadius = constant(0), - padRadius = null, - startAngle = arcStartAngle, - endAngle = arcEndAngle, - padAngle = arcPadAngle, - context = null; - - function arc() { - var buffer, - r, - r0 = +innerRadius.apply(this, arguments), - r1 = +outerRadius.apply(this, arguments), - a0 = startAngle.apply(this, arguments) - halfPi, - a1 = endAngle.apply(this, arguments) - halfPi, - da = abs(a1 - a0), - cw = a1 > a0; - - if (!context) context = buffer = path(); - - // Ensure that the outer radius is always larger than the inner radius. - if (r1 < r0) r = r1, r1 = r0, r0 = r; - - // Is it a point? - if (!(r1 > epsilon)) context.moveTo(0, 0); - - // Or is it a circle or annulus? - else if (da > tau - epsilon) { - context.moveTo(r1 * cos(a0), r1 * sin(a0)); - context.arc(0, 0, r1, a0, a1, !cw); - if (r0 > epsilon) { - context.moveTo(r0 * cos(a1), r0 * sin(a1)); - context.arc(0, 0, r0, a1, a0, cw); - } - } - - // Or is it a circular or annular sector? - else { - var a01 = a0, - a11 = a1, - a00 = a0, - a10 = a1, - da0 = da, - da1 = da, - ap = padAngle.apply(this, arguments) / 2, - rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), - rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), - rc0 = rc, - rc1 = rc, - t0, - t1; - - // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. - if (rp > epsilon) { - var p0 = asin(rp / r0 * sin(ap)), - p1 = asin(rp / r1 * sin(ap)); - if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0; - else da0 = 0, a00 = a10 = (a0 + a1) / 2; - if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1; - else da1 = 0, a01 = a11 = (a0 + a1) / 2; - } - - var x01 = r1 * cos(a01), - y01 = r1 * sin(a01), - x10 = r0 * cos(a10), - y10 = r0 * sin(a10); - - // Apply rounded corners? - if (rc > epsilon) { - var x11 = r1 * cos(a11), - y11 = r1 * sin(a11), - x00 = r0 * cos(a00), - y00 = r0 * sin(a00), - oc; - - // Restrict the corner radius according to the sector angle. - if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) { - var ax = x01 - oc[0], - ay = y01 - oc[1], - bx = x11 - oc[0], - by = y11 - oc[1], - kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), - lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = min(rc, (r0 - lc) / (kc - 1)); - rc1 = min(rc, (r1 - lc) / (kc + 1)); - } - } - - // Is the sector collapsed to a line? - if (!(da1 > epsilon)) context.moveTo(x01, y01); - - // Does the sector’s outer ring have rounded corners? - else if (rc1 > epsilon) { - t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); - t1 = 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(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); - - // Otherwise, draw the two corners and the ring. - else { - context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); - context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.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’s a circular sector? - // Or perhaps it’s an annular sector collapsed due to padding? - if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10); - - // Does the sector’s inner ring (or point) have rounded corners? - else if (rc0 > epsilon) { - t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); - t1 = 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(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); - - // Otherwise, draw the two corners and the ring. - else { - context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); - context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.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 = null, buffer + "" || null; - } - - arc.centroid = function() { - var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, - a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2; - return [cos(a) * r, sin(a) * r]; - }; - - arc.innerRadius = function(_) { - return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius; - }; - - arc.outerRadius = function(_) { - return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius; - }; - - arc.cornerRadius = function(_) { - return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius; - }; - - arc.padRadius = function(_) { - return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius; - }; - - arc.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle; - }; - - arc.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle; - }; - - arc.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle; - }; - - arc.context = function(_) { - return arguments.length ? ((context = _ == null ? null : _), arc) : context; - }; - - return arc; -} diff --git a/node_modules/d3-shape/src/area.js b/node_modules/d3-shape/src/area.js deleted file mode 100644 index a048a01..0000000 --- a/node_modules/d3-shape/src/area.js +++ /dev/null @@ -1,109 +0,0 @@ -import {path} from "d3-path"; -import constant from "./constant.js"; -import curveLinear from "./curve/linear.js"; -import line from "./line.js"; -import {x as pointX, y as pointY} from "./point.js"; - -export default function() { - var x0 = pointX, - x1 = null, - y0 = constant(0), - y1 = pointY, - defined = constant(true), - context = null, - curve = curveLinear, - output = null; - - function area(data) { - var i, - j, - k, - n = data.length, - d, - defined0 = false, - buffer, - x0z = new Array(n), - y0z = new Array(n); - - if (context == null) output = curve(buffer = path()); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) { - j = i; - output.areaStart(); - output.lineStart(); - } else { - output.lineEnd(); - output.lineStart(); - for (k = i - 1; k >= j; --k) { - output.point(x0z[k], y0z[k]); - } - output.lineEnd(); - output.areaEnd(); - } - } - if (defined0) { - x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); - output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); - } - } - - if (buffer) return output = null, buffer + "" || null; - } - - function arealine() { - return line().defined(defined).curve(curve).context(context); - } - - area.x = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area) : x0; - }; - - area.x0 = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), area) : x0; - }; - - area.x1 = function(_) { - return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : x1; - }; - - area.y = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area) : y0; - }; - - area.y0 = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), area) : y0; - }; - - area.y1 = function(_) { - return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : y1; - }; - - area.lineX0 = - area.lineY0 = function() { - return arealine().x(x0).y(y0); - }; - - area.lineY1 = function() { - return arealine().x(x0).y(y1); - }; - - area.lineX1 = function() { - return arealine().x(x1).y(y0); - }; - - area.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), area) : defined; - }; - - area.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; - }; - - area.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; - }; - - return area; -} diff --git a/node_modules/d3-shape/src/areaRadial.js b/node_modules/d3-shape/src/areaRadial.js deleted file mode 100644 index 61e01d7..0000000 --- a/node_modules/d3-shape/src/areaRadial.js +++ /dev/null @@ -1,29 +0,0 @@ -import curveRadial, {curveRadialLinear} from "./curve/radial.js"; -import area from "./area.js"; -import {lineRadial} from "./lineRadial.js"; - -export default function() { - var a = area().curve(curveRadialLinear), - c = a.curve, - x0 = a.lineX0, - x1 = a.lineX1, - y0 = a.lineY0, - y1 = a.lineY1; - - a.angle = a.x, delete a.x; - a.startAngle = a.x0, delete a.x0; - a.endAngle = a.x1, delete a.x1; - a.radius = a.y, delete a.y; - a.innerRadius = a.y0, delete a.y0; - a.outerRadius = a.y1, delete a.y1; - a.lineStartAngle = function() { return lineRadial(x0()); }, delete a.lineX0; - a.lineEndAngle = function() { return lineRadial(x1()); }, delete a.lineX1; - a.lineInnerRadius = function() { return lineRadial(y0()); }, delete a.lineY0; - a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1; - - a.curve = function(_) { - return arguments.length ? c(curveRadial(_)) : c()._curve; - }; - - return a; -} diff --git a/node_modules/d3-shape/src/array.js b/node_modules/d3-shape/src/array.js deleted file mode 100644 index 8eeac16..0000000 --- a/node_modules/d3-shape/src/array.js +++ /dev/null @@ -1 +0,0 @@ -export var slice = Array.prototype.slice; diff --git a/node_modules/d3-shape/src/constant.js b/node_modules/d3-shape/src/constant.js deleted file mode 100644 index 6fa95b7..0000000 --- a/node_modules/d3-shape/src/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(x) { - return function constant() { - return x; - }; -} diff --git a/node_modules/d3-shape/src/curve/basis.js b/node_modules/d3-shape/src/curve/basis.js deleted file mode 100644 index b186bed..0000000 --- a/node_modules/d3-shape/src/curve/basis.js +++ /dev/null @@ -1,51 +0,0 @@ -export function point(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 - ); -} - -export function Basis(context) { - this._context = context; -} - -Basis.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = - this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 3: point(this, this._x1, this._y1); // proceed - case 2: this._context.lineTo(this._x1, this._y1); break; - } - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; break; - case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -export default function(context) { - return new Basis(context); -} diff --git a/node_modules/d3-shape/src/curve/basisClosed.js b/node_modules/d3-shape/src/curve/basisClosed.js deleted file mode 100644 index 535df90..0000000 --- a/node_modules/d3-shape/src/curve/basisClosed.js +++ /dev/null @@ -1,52 +0,0 @@ -import noop from "../noop.js"; -import {point} from "./basis.js"; - -function BasisClosed(context) { - this._context = context; -} - -BasisClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = - this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; - this._point = 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 = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._x2 = x, this._y2 = y; break; - case 1: this._point = 2; this._x3 = x, this._y3 = y; break; - case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break; - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -export default function(context) { - return new BasisClosed(context); -} diff --git a/node_modules/d3-shape/src/curve/basisOpen.js b/node_modules/d3-shape/src/curve/basisOpen.js deleted file mode 100644 index 4f2e5b1..0000000 --- a/node_modules/d3-shape/src/curve/basisOpen.js +++ /dev/null @@ -1,39 +0,0 @@ -import {point} from "./basis.js"; - -function BasisOpen(context) { - this._context = context; -} - -BasisOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = - this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; break; - case 1: this._point = 2; break; - case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break; - case 3: this._point = 4; // proceed - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -export default function(context) { - return new BasisOpen(context); -} diff --git a/node_modules/d3-shape/src/curve/bundle.js b/node_modules/d3-shape/src/curve/bundle.js deleted file mode 100644 index ac1014e..0000000 --- a/node_modules/d3-shape/src/curve/bundle.js +++ /dev/null @@ -1,56 +0,0 @@ -import {Basis} from "./basis.js"; - -function Bundle(context, beta) { - this._basis = new Basis(context); - this._beta = beta; -} - -Bundle.prototype = { - lineStart: function() { - this._x = []; - this._y = []; - this._basis.lineStart(); - }, - lineEnd: function() { - var x = this._x, - y = this._y, - j = x.length - 1; - - if (j > 0) { - var x0 = x[0], - y0 = y[0], - dx = x[j] - x0, - dy = y[j] - y0, - i = -1, - t; - - while (++i <= j) { - t = 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 = this._y = null; - this._basis.lineEnd(); - }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; - -export default (function custom(beta) { - - function bundle(context) { - return beta === 1 ? new Basis(context) : new Bundle(context, beta); - } - - bundle.beta = function(beta) { - return custom(+beta); - }; - - return bundle; -})(0.85); diff --git a/node_modules/d3-shape/src/curve/cardinal.js b/node_modules/d3-shape/src/curve/cardinal.js deleted file mode 100644 index 3ab1070..0000000 --- a/node_modules/d3-shape/src/curve/cardinal.js +++ /dev/null @@ -1,61 +0,0 @@ -export function point(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 - ); -} - -export function Cardinal(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} - -Cardinal.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 2: this._context.lineTo(this._x2, this._y2); break; - case 3: point(this, this._x1, this._y1); break; - } - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; this._x1 = x, this._y1 = y; break; - case 2: this._point = 3; // proceed - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -export default (function custom(tension) { - - function cardinal(context) { - return new Cardinal(context, tension); - } - - cardinal.tension = function(tension) { - return custom(+tension); - }; - - return cardinal; -})(0); diff --git a/node_modules/d3-shape/src/curve/cardinalClosed.js b/node_modules/d3-shape/src/curve/cardinalClosed.js deleted file mode 100644 index acef52e..0000000 --- a/node_modules/d3-shape/src/curve/cardinalClosed.js +++ /dev/null @@ -1,61 +0,0 @@ -import noop from "../noop.js"; -import {point} from "./cardinal.js"; - -export function CardinalClosed(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} - -CardinalClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = - this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._point = 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 = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._x3 = x, this._y3 = y; break; - case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; - case 2: this._point = 3; this._x5 = x, this._y5 = y; break; - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -export default (function custom(tension) { - - function cardinal(context) { - return new CardinalClosed(context, tension); - } - - cardinal.tension = function(tension) { - return custom(+tension); - }; - - return cardinal; -})(0); diff --git a/node_modules/d3-shape/src/curve/cardinalOpen.js b/node_modules/d3-shape/src/curve/cardinalOpen.js deleted file mode 100644 index e736841..0000000 --- a/node_modules/d3-shape/src/curve/cardinalOpen.js +++ /dev/null @@ -1,49 +0,0 @@ -import {point} from "./cardinal.js"; - -export function CardinalOpen(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} - -CardinalOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; break; - case 1: this._point = 2; break; - case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; - case 3: this._point = 4; // proceed - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -export default (function custom(tension) { - - function cardinal(context) { - return new CardinalOpen(context, tension); - } - - cardinal.tension = function(tension) { - return custom(+tension); - }; - - return cardinal; -})(0); diff --git a/node_modules/d3-shape/src/curve/catmullRom.js b/node_modules/d3-shape/src/curve/catmullRom.js deleted file mode 100644 index 643d10f..0000000 --- a/node_modules/d3-shape/src/curve/catmullRom.js +++ /dev/null @@ -1,88 +0,0 @@ -import {epsilon} from "../math.js"; -import {Cardinal} from "./cardinal.js"; - -export function point(that, x, y) { - var x1 = that._x1, - y1 = that._y1, - x2 = that._x2, - y2 = that._y2; - - if (that._l01_a > epsilon) { - var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, - n = 3 * that._l01_a * (that._l01_a + that._l12_a); - x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; - y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; - } - - if (that._l23_a > epsilon) { - var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, - m = 3 * that._l23_a * (that._l23_a + that._l12_a); - x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; - y2 = (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 = context; - this._alpha = alpha; -} - -CatmullRom.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = - this._l01_2a = this._l12_2a = this._l23_2a = - this._point = 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 !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; break; - case 2: this._point = 3; // proceed - default: point(this, x, y); break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -export default (function custom(alpha) { - - function catmullRom(context) { - return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); - } - - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - - return catmullRom; -})(0.5); diff --git a/node_modules/d3-shape/src/curve/catmullRomClosed.js b/node_modules/d3-shape/src/curve/catmullRomClosed.js deleted file mode 100644 index 6c6b965..0000000 --- a/node_modules/d3-shape/src/curve/catmullRomClosed.js +++ /dev/null @@ -1,74 +0,0 @@ -import {CardinalClosed} from "./cardinalClosed.js"; -import noop from "../noop.js"; -import {point} from "./catmullRom.js"; - -function CatmullRomClosed(context, alpha) { - this._context = context; - this._alpha = alpha; -} - -CatmullRomClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = - this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._l01_a = this._l12_a = this._l23_a = - this._l01_2a = this._l12_2a = this._l23_2a = - this._point = 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 = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: this._point = 1; this._x3 = x, this._y3 = y; break; - case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; - case 2: this._point = 3; this._x5 = x, this._y5 = y; break; - default: point(this, x, y); break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -export default (function custom(alpha) { - - function catmullRom(context) { - return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); - } - - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - - return catmullRom; -})(0.5); diff --git a/node_modules/d3-shape/src/curve/catmullRomOpen.js b/node_modules/d3-shape/src/curve/catmullRomOpen.js deleted file mode 100644 index 7e4c5ca..0000000 --- a/node_modules/d3-shape/src/curve/catmullRomOpen.js +++ /dev/null @@ -1,62 +0,0 @@ -import {CardinalOpen} from "./cardinalOpen.js"; -import {point} from "./catmullRom.js"; - -function CatmullRomOpen(context, alpha) { - this._context = context; - this._alpha = alpha; -} - -CatmullRomOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = - this._l01_2a = this._l12_2a = this._l23_2a = - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: this._point = 1; break; - case 1: this._point = 2; break; - case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; - case 3: this._point = 4; // proceed - default: point(this, x, y); break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; - -export default (function custom(alpha) { - - function catmullRom(context) { - return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); - } - - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - - return catmullRom; -})(0.5); diff --git a/node_modules/d3-shape/src/curve/linear.js b/node_modules/d3-shape/src/curve/linear.js deleted file mode 100644 index 6245493..0000000 --- a/node_modules/d3-shape/src/curve/linear.js +++ /dev/null @@ -1,31 +0,0 @@ -function Linear(context) { - this._context = context; -} - -Linear.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; // proceed - default: this._context.lineTo(x, y); break; - } - } -}; - -export default function(context) { - return new Linear(context); -} diff --git a/node_modules/d3-shape/src/curve/linearClosed.js b/node_modules/d3-shape/src/curve/linearClosed.js deleted file mode 100644 index e25606f..0000000 --- a/node_modules/d3-shape/src/curve/linearClosed.js +++ /dev/null @@ -1,25 +0,0 @@ -import noop from "../noop.js"; - -function LinearClosed(context) { - this._context = context; -} - -LinearClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._point) this._context.closePath(); - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) this._context.lineTo(x, y); - else this._point = 1, this._context.moveTo(x, y); - } -}; - -export default function(context) { - return new LinearClosed(context); -} diff --git a/node_modules/d3-shape/src/curve/monotone.js b/node_modules/d3-shape/src/curve/monotone.js deleted file mode 100644 index 2599031..0000000 --- a/node_modules/d3-shape/src/curve/monotone.js +++ /dev/null @@ -1,104 +0,0 @@ -function sign(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 = that._x1 - that._x0, - h1 = x2 - that._x1, - s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), - s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), - p = (s0 * h1 + s1 * h0) / (h0 + h1); - return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; -} - -// Calculate a one-sided slope. -function slope2(that, t) { - var h = 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#Representations -// "you can express cubic Hermite interpolation in terms of cubic Bézier curves -// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". -function point(that, t0, t1) { - var x0 = that._x0, - y0 = that._y0, - x1 = that._x1, - y1 = that._y1, - dx = (x1 - x0) / 3; - that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); -} - -function MonotoneX(context) { - this._context = context; -} - -MonotoneX.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = - this._y0 = this._y1 = - this._t0 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 2: this._context.lineTo(this._x1, this._y1); break; - case 3: point(this, this._t0, slope2(this, this._t0)); break; - } - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - var t1 = NaN; - - x = +x, y = +y; - if (x === this._x1 && y === this._y1) return; // Ignore coincident points. - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; break; - case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break; - default: point(this, this._t0, t1 = slope3(this, x, y)); break; - } - - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - this._t0 = t1; - } -} - -function MonotoneY(context) { - this._context = new ReflectContext(context); -} - -(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { - MonotoneX.prototype.point.call(this, y, x); -}; - -function ReflectContext(context) { - this._context = context; -} - -ReflectContext.prototype = { - 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.bezierCurveTo(y1, x1, y2, x2, y, x); } -}; - -export function monotoneX(context) { - return new MonotoneX(context); -} - -export function monotoneY(context) { - return new MonotoneY(context); -} diff --git a/node_modules/d3-shape/src/curve/natural.js b/node_modules/d3-shape/src/curve/natural.js deleted file mode 100644 index d51eb51..0000000 --- a/node_modules/d3-shape/src/curve/natural.js +++ /dev/null @@ -1,65 +0,0 @@ -function Natural(context) { - this._context = context; -} - -Natural.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = []; - this._y = []; - }, - lineEnd: function() { - var x = this._x, - y = this._y, - n = x.length; - - if (n) { - this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); - if (n === 2) { - this._context.lineTo(x[1], y[1]); - } else { - var px = controlPoints(x), - py = controlPoints(y); - for (var i0 = 0, i1 = 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 !== 0 && n === 1)) this._context.closePath(); - this._line = 1 - this._line; - this._x = this._y = 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 = x.length - 1, - m, - a = new Array(n), - b = new Array(n), - r = new Array(n); - a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; - for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; - a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; - for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; - a[n - 1] = r[n - 1] / b[n - 1]; - for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i]; - b[n - 1] = (x[n] + a[n - 1]) / 2; - for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1]; - return [a, b]; -} - -export default function(context) { - return new Natural(context); -} diff --git a/node_modules/d3-shape/src/curve/radial.js b/node_modules/d3-shape/src/curve/radial.js deleted file mode 100644 index 730c989..0000000 --- a/node_modules/d3-shape/src/curve/radial.js +++ /dev/null @@ -1,36 +0,0 @@ -import curveLinear from "./linear.js"; - -export var curveRadialLinear = curveRadial(curveLinear); - -function Radial(curve) { - this._curve = curve; -} - -Radial.prototype = { - 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)); - } -}; - -export default function curveRadial(curve) { - - function radial(context) { - return new Radial(curve(context)); - } - - radial._curve = curve; - - return radial; -} diff --git a/node_modules/d3-shape/src/curve/step.js b/node_modules/d3-shape/src/curve/step.js deleted file mode 100644 index e9fb78f..0000000 --- a/node_modules/d3-shape/src/curve/step.js +++ /dev/null @@ -1,53 +0,0 @@ -function Step(context, t) { - this._context = context; - this._t = t; -} - -Step.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = this._y = NaN; - this._point = 0; - }, - lineEnd: function() { - if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; // proceed - default: { - if (this._t <= 0) { - this._context.lineTo(this._x, y); - this._context.lineTo(x, y); - } else { - var x1 = this._x * (1 - this._t) + x * this._t; - this._context.lineTo(x1, this._y); - this._context.lineTo(x1, y); - } - break; - } - } - this._x = x, this._y = y; - } -}; - -export default function(context) { - return new Step(context, 0.5); -} - -export function stepBefore(context) { - return new Step(context, 0); -} - -export function stepAfter(context) { - return new Step(context, 1); -} diff --git a/node_modules/d3-shape/src/descending.js b/node_modules/d3-shape/src/descending.js deleted file mode 100644 index a4e2d7f..0000000 --- a/node_modules/d3-shape/src/descending.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} diff --git a/node_modules/d3-shape/src/identity.js b/node_modules/d3-shape/src/identity.js deleted file mode 100644 index ca161ab..0000000 --- a/node_modules/d3-shape/src/identity.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(d) { - return d; -} diff --git a/node_modules/d3-shape/src/index.js b/node_modules/d3-shape/src/index.js deleted file mode 100644 index aca91a5..0000000 --- a/node_modules/d3-shape/src/index.js +++ /dev/null @@ -1,46 +0,0 @@ -export {default as arc} from "./arc.js"; -export {default as area} from "./area.js"; -export {default as line} from "./line.js"; -export {default as pie} from "./pie.js"; -export {default as areaRadial, default as radialArea} from "./areaRadial.js"; // Note: radialArea is deprecated! -export {default as lineRadial, default as radialLine} from "./lineRadial.js"; // Note: radialLine is deprecated! -export {default as pointRadial} from "./pointRadial.js"; -export {linkHorizontal, linkVertical, linkRadial} from "./link/index.js"; - -export {default as symbol, symbols} from "./symbol.js"; -export {default as symbolCircle} from "./symbol/circle.js"; -export {default as symbolCross} from "./symbol/cross.js"; -export {default as symbolDiamond} from "./symbol/diamond.js"; -export {default as symbolSquare} from "./symbol/square.js"; -export {default as symbolStar} from "./symbol/star.js"; -export {default as symbolTriangle} from "./symbol/triangle.js"; -export {default as symbolWye} from "./symbol/wye.js"; - -export {default as curveBasisClosed} from "./curve/basisClosed.js"; -export {default as curveBasisOpen} from "./curve/basisOpen.js"; -export {default as curveBasis} from "./curve/basis.js"; -export {default as curveBundle} from "./curve/bundle.js"; -export {default as curveCardinalClosed} from "./curve/cardinalClosed.js"; -export {default as curveCardinalOpen} from "./curve/cardinalOpen.js"; -export {default as curveCardinal} from "./curve/cardinal.js"; -export {default as curveCatmullRomClosed} from "./curve/catmullRomClosed.js"; -export {default as curveCatmullRomOpen} from "./curve/catmullRomOpen.js"; -export {default as curveCatmullRom} from "./curve/catmullRom.js"; -export {default as curveLinearClosed} from "./curve/linearClosed.js"; -export {default as curveLinear} from "./curve/linear.js"; -export {monotoneX as curveMonotoneX, monotoneY as curveMonotoneY} from "./curve/monotone.js"; -export {default as curveNatural} from "./curve/natural.js"; -export {default as curveStep, stepAfter as curveStepAfter, stepBefore as curveStepBefore} from "./curve/step.js"; - -export {default as stack} from "./stack.js"; -export {default as stackOffsetExpand} from "./offset/expand.js"; -export {default as stackOffsetDiverging} from "./offset/diverging.js"; -export {default as stackOffsetNone} from "./offset/none.js"; -export {default as stackOffsetSilhouette} from "./offset/silhouette.js"; -export {default as stackOffsetWiggle} from "./offset/wiggle.js"; -export {default as stackOrderAppearance} from "./order/appearance.js"; -export {default as stackOrderAscending} from "./order/ascending.js"; -export {default as stackOrderDescending} from "./order/descending.js"; -export {default as stackOrderInsideOut} from "./order/insideOut.js"; -export {default as stackOrderNone} from "./order/none.js"; -export {default as stackOrderReverse} from "./order/reverse.js"; diff --git a/node_modules/d3-shape/src/line.js b/node_modules/d3-shape/src/line.js deleted file mode 100644 index 3ba2ab3..0000000 --- a/node_modules/d3-shape/src/line.js +++ /dev/null @@ -1,55 +0,0 @@ -import {path} from "d3-path"; -import constant from "./constant.js"; -import curveLinear from "./curve/linear.js"; -import {x as pointX, y as pointY} from "./point.js"; - -export default function() { - var x = pointX, - y = pointY, - defined = constant(true), - context = null, - curve = curveLinear, - output = null; - - function line(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - - if (context == null) output = curve(buffer = path()); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) output.lineStart(); - else output.lineEnd(); - } - if (defined0) output.point(+x(d, i, data), +y(d, i, data)); - } - - if (buffer) return output = null, buffer + "" || null; - } - - line.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), line) : x; - }; - - line.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), line) : y; - }; - - line.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined; - }; - - line.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; - }; - - line.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; - }; - - return line; -} diff --git a/node_modules/d3-shape/src/lineRadial.js b/node_modules/d3-shape/src/lineRadial.js deleted file mode 100644 index beaf577..0000000 --- a/node_modules/d3-shape/src/lineRadial.js +++ /dev/null @@ -1,19 +0,0 @@ -import curveRadial, {curveRadialLinear} from "./curve/radial.js"; -import line from "./line.js"; - -export function lineRadial(l) { - var c = l.curve; - - l.angle = l.x, delete l.x; - l.radius = l.y, delete l.y; - - l.curve = function(_) { - return arguments.length ? c(curveRadial(_)) : c()._curve; - }; - - return l; -} - -export default function() { - return lineRadial(line().curve(curveRadialLinear)); -} diff --git a/node_modules/d3-shape/src/link/index.js b/node_modules/d3-shape/src/link/index.js deleted file mode 100644 index b3075d3..0000000 --- a/node_modules/d3-shape/src/link/index.js +++ /dev/null @@ -1,84 +0,0 @@ -import {path} from "d3-path"; -import {slice} from "../array.js"; -import constant from "../constant.js"; -import {x as pointX, y as pointY} from "../point.js"; -import pointRadial from "../pointRadial.js"; - -function linkSource(d) { - return d.source; -} - -function linkTarget(d) { - return d.target; -} - -function link(curve) { - var source = linkSource, - target = linkTarget, - x = pointX, - y = pointY, - context = null; - - function link() { - var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv); - if (!context) context = buffer = path(); - curve(context, +x.apply(this, (argv[0] = s, argv)), +y.apply(this, argv), +x.apply(this, (argv[0] = t, argv)), +y.apply(this, argv)); - if (buffer) return context = null, buffer + "" || null; - } - - link.source = function(_) { - return arguments.length ? (source = _, link) : source; - }; - - link.target = function(_) { - return arguments.length ? (target = _, link) : target; - }; - - link.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), link) : x; - }; - - link.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), link) : y; - }; - - link.context = function(_) { - return arguments.length ? ((context = _ == null ? null : _), link) : context; - }; - - return link; -} - -function curveHorizontal(context, x0, y0, x1, y1) { - context.moveTo(x0, y0); - context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1); -} - -function curveVertical(context, x0, y0, x1, y1) { - context.moveTo(x0, y0); - context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1); -} - -function curveRadial(context, x0, y0, x1, y1) { - var p0 = pointRadial(x0, y0), - p1 = pointRadial(x0, y0 = (y0 + y1) / 2), - p2 = pointRadial(x1, y0), - p3 = pointRadial(x1, y1); - context.moveTo(p0[0], p0[1]); - context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]); -} - -export function linkHorizontal() { - return link(curveHorizontal); -} - -export function linkVertical() { - return link(curveVertical); -} - -export function linkRadial() { - var l = link(curveRadial); - l.angle = l.x, delete l.x; - l.radius = l.y, delete l.y; - return l; -} diff --git a/node_modules/d3-shape/src/math.js b/node_modules/d3-shape/src/math.js deleted file mode 100644 index 131af62..0000000 --- a/node_modules/d3-shape/src/math.js +++ /dev/null @@ -1,20 +0,0 @@ -export var abs = Math.abs; -export var atan2 = Math.atan2; -export var cos = Math.cos; -export var max = Math.max; -export var min = Math.min; -export var sin = Math.sin; -export var sqrt = Math.sqrt; - -export var epsilon = 1e-12; -export var pi = Math.PI; -export var halfPi = pi / 2; -export var tau = 2 * pi; - -export function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} - -export function asin(x) { - return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); -} diff --git a/node_modules/d3-shape/src/noop.js b/node_modules/d3-shape/src/noop.js deleted file mode 100644 index 6ab80bc..0000000 --- a/node_modules/d3-shape/src/noop.js +++ /dev/null @@ -1 +0,0 @@ -export default function() {} diff --git a/node_modules/d3-shape/src/offset/diverging.js b/node_modules/d3-shape/src/offset/diverging.js deleted file mode 100644 index 45a5fff..0000000 --- a/node_modules/d3-shape/src/offset/diverging.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function(series, order) { - if (!((n = series.length) > 0)) return; - for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) { - for (yp = yn = 0, i = 0; i < n; ++i) { - if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) { - d[0] = yp, d[1] = yp += dy; - } else if (dy < 0) { - d[1] = yn, d[0] = yn += dy; - } else { - d[0] = 0, d[1] = dy; - } - } - } -} diff --git a/node_modules/d3-shape/src/offset/expand.js b/node_modules/d3-shape/src/offset/expand.js deleted file mode 100644 index 965bea1..0000000 --- a/node_modules/d3-shape/src/offset/expand.js +++ /dev/null @@ -1,10 +0,0 @@ -import none from "./none.js"; - -export default function(series, order) { - if (!((n = series.length) > 0)) return; - for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) { - for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0; - if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y; - } - none(series, order); -} diff --git a/node_modules/d3-shape/src/offset/none.js b/node_modules/d3-shape/src/offset/none.js deleted file mode 100644 index d8e11dc..0000000 --- a/node_modules/d3-shape/src/offset/none.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function(series, order) { - if (!((n = series.length) > 1)) return; - for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) { - s0 = s1, s1 = series[order[i]]; - for (j = 0; j < m; ++j) { - s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; - } - } -} diff --git a/node_modules/d3-shape/src/offset/silhouette.js b/node_modules/d3-shape/src/offset/silhouette.js deleted file mode 100644 index 87829be..0000000 --- a/node_modules/d3-shape/src/offset/silhouette.js +++ /dev/null @@ -1,10 +0,0 @@ -import none from "./none.js"; - -export default function(series, order) { - if (!((n = series.length) > 0)) return; - for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) { - for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0; - s0[j][1] += s0[j][0] = -y / 2; - } - none(series, order); -} diff --git a/node_modules/d3-shape/src/offset/wiggle.js b/node_modules/d3-shape/src/offset/wiggle.js deleted file mode 100644 index 8db717c..0000000 --- a/node_modules/d3-shape/src/offset/wiggle.js +++ /dev/null @@ -1,24 +0,0 @@ -import none from "./none.js"; - -export default function(series, order) { - if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return; - for (var y = 0, j = 1, s0, m, n; j < m; ++j) { - for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { - var si = series[order[i]], - sij0 = si[j][1] || 0, - sij1 = si[j - 1][1] || 0, - s3 = (sij0 - sij1) / 2; - for (var k = 0; k < i; ++k) { - var sk = series[order[k]], - skj0 = sk[j][1] || 0, - skj1 = sk[j - 1][1] || 0; - s3 += skj0 - skj1; - } - s1 += sij0, s2 += s3 * sij0; - } - s0[j - 1][1] += s0[j - 1][0] = y; - if (s1) y -= s2 / s1; - } - s0[j - 1][1] += s0[j - 1][0] = y; - none(series, order); -} diff --git a/node_modules/d3-shape/src/order/appearance.js b/node_modules/d3-shape/src/order/appearance.js deleted file mode 100644 index e052924..0000000 --- a/node_modules/d3-shape/src/order/appearance.js +++ /dev/null @@ -1,12 +0,0 @@ -import none from "./none.js"; - -export default function(series) { - var peaks = series.map(peak); - return none(series).sort(function(a, b) { return peaks[a] - peaks[b]; }); -} - -function peak(series) { - var i = -1, j = 0, n = series.length, vi, vj = -Infinity; - while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i; - return j; -} diff --git a/node_modules/d3-shape/src/order/ascending.js b/node_modules/d3-shape/src/order/ascending.js deleted file mode 100644 index e0d28e3..0000000 --- a/node_modules/d3-shape/src/order/ascending.js +++ /dev/null @@ -1,12 +0,0 @@ -import none from "./none.js"; - -export default function(series) { - var sums = series.map(sum); - return none(series).sort(function(a, b) { return sums[a] - sums[b]; }); -} - -export function sum(series) { - var s = 0, i = -1, n = series.length, v; - while (++i < n) if (v = +series[i][1]) s += v; - return s; -} diff --git a/node_modules/d3-shape/src/order/descending.js b/node_modules/d3-shape/src/order/descending.js deleted file mode 100644 index dd27201..0000000 --- a/node_modules/d3-shape/src/order/descending.js +++ /dev/null @@ -1,5 +0,0 @@ -import ascending from "./ascending.js"; - -export default function(series) { - return ascending(series).reverse(); -} diff --git a/node_modules/d3-shape/src/order/insideOut.js b/node_modules/d3-shape/src/order/insideOut.js deleted file mode 100644 index b0b2abd..0000000 --- a/node_modules/d3-shape/src/order/insideOut.js +++ /dev/null @@ -1,27 +0,0 @@ -import appearance from "./appearance.js"; -import {sum} from "./ascending.js"; - -export default function(series) { - var n = series.length, - i, - j, - sums = series.map(sum), - order = appearance(series), - top = 0, - bottom = 0, - tops = [], - bottoms = []; - - for (i = 0; i < n; ++i) { - j = order[i]; - if (top < bottom) { - top += sums[j]; - tops.push(j); - } else { - bottom += sums[j]; - bottoms.push(j); - } - } - - return bottoms.reverse().concat(tops); -} diff --git a/node_modules/d3-shape/src/order/none.js b/node_modules/d3-shape/src/order/none.js deleted file mode 100644 index b0d7d6f..0000000 --- a/node_modules/d3-shape/src/order/none.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(series) { - var n = series.length, o = new Array(n); - while (--n >= 0) o[n] = n; - return o; -} diff --git a/node_modules/d3-shape/src/order/reverse.js b/node_modules/d3-shape/src/order/reverse.js deleted file mode 100644 index 8380ca0..0000000 --- a/node_modules/d3-shape/src/order/reverse.js +++ /dev/null @@ -1,5 +0,0 @@ -import none from "./none.js"; - -export default function(series) { - return none(series).reverse(); -} diff --git a/node_modules/d3-shape/src/pie.js b/node_modules/d3-shape/src/pie.js deleted file mode 100644 index 1108722..0000000 --- a/node_modules/d3-shape/src/pie.js +++ /dev/null @@ -1,79 +0,0 @@ -import constant from "./constant.js"; -import descending from "./descending.js"; -import identity from "./identity.js"; -import {tau} from "./math.js"; - -export default function() { - var value = identity, - sortValues = descending, - sort = null, - startAngle = constant(0), - endAngle = constant(tau), - padAngle = constant(0); - - function pie(data) { - var i, - n = data.length, - j, - k, - sum = 0, - index = new Array(n), - arcs = new Array(n), - a0 = +startAngle.apply(this, arguments), - da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), - a1, - p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), - pa = p * (da < 0 ? -1 : 1), - v; - - for (i = 0; i < n; ++i) { - if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) { - sum += v; - } - } - - // Optionally sort the arcs by previously-computed values or by data. - if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); }); - else if (sort != 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 = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) { - j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = { - data: data[j], - index: i, - value: v, - startAngle: a0, - endAngle: a1, - padAngle: p - }; - } - - return arcs; - } - - pie.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value; - }; - - pie.sortValues = function(_) { - return arguments.length ? (sortValues = _, sort = null, pie) : sortValues; - }; - - pie.sort = function(_) { - return arguments.length ? (sort = _, sortValues = null, pie) : sort; - }; - - pie.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle; - }; - - pie.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle; - }; - - pie.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle; - }; - - return pie; -} diff --git a/node_modules/d3-shape/src/point.js b/node_modules/d3-shape/src/point.js deleted file mode 100644 index c345257..0000000 --- a/node_modules/d3-shape/src/point.js +++ /dev/null @@ -1,7 +0,0 @@ -export function x(p) { - return p[0]; -} - -export function y(p) { - return p[1]; -} diff --git a/node_modules/d3-shape/src/pointRadial.js b/node_modules/d3-shape/src/pointRadial.js deleted file mode 100644 index 1cccb70..0000000 --- a/node_modules/d3-shape/src/pointRadial.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x, y) { - return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)]; -} diff --git a/node_modules/d3-shape/src/stack.js b/node_modules/d3-shape/src/stack.js deleted file mode 100644 index ab4008e..0000000 --- a/node_modules/d3-shape/src/stack.js +++ /dev/null @@ -1,57 +0,0 @@ -import {slice} from "./array.js"; -import constant from "./constant.js"; -import offsetNone from "./offset/none.js"; -import orderNone from "./order/none.js"; - -function stackValue(d, key) { - return d[key]; -} - -export default function() { - var keys = constant([]), - order = orderNone, - offset = offsetNone, - value = stackValue; - - function stack(data) { - var kz = keys.apply(this, arguments), - i, - m = data.length, - n = kz.length, - sz = new Array(n), - oz; - - for (i = 0; i < n; ++i) { - for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) { - si[j] = sij = [0, +value(data[j], ki, j, data)]; - sij.data = data[j]; - } - si.key = ki; - } - - for (i = 0, oz = order(sz); i < n; ++i) { - sz[oz[i]].index = i; - } - - offset(sz, oz); - return sz; - } - - stack.keys = function(_) { - return arguments.length ? (keys = typeof _ === "function" ? _ : constant(slice.call(_)), stack) : keys; - }; - - stack.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack) : value; - }; - - stack.order = function(_) { - return arguments.length ? (order = _ == null ? orderNone : typeof _ === "function" ? _ : constant(slice.call(_)), stack) : order; - }; - - stack.offset = function(_) { - return arguments.length ? (offset = _ == null ? offsetNone : _, stack) : offset; - }; - - return stack; -} diff --git a/node_modules/d3-shape/src/symbol.js b/node_modules/d3-shape/src/symbol.js deleted file mode 100644 index 74530de..0000000 --- a/node_modules/d3-shape/src/symbol.js +++ /dev/null @@ -1,46 +0,0 @@ -import {path} from "d3-path"; -import circle from "./symbol/circle.js"; -import cross from "./symbol/cross.js"; -import diamond from "./symbol/diamond.js"; -import star from "./symbol/star.js"; -import square from "./symbol/square.js"; -import triangle from "./symbol/triangle.js"; -import wye from "./symbol/wye.js"; -import constant from "./constant.js"; - -export var symbols = [ - circle, - cross, - diamond, - square, - star, - triangle, - wye -]; - -export default function() { - var type = constant(circle), - size = constant(64), - context = null; - - function symbol() { - var buffer; - if (!context) context = buffer = path(); - type.apply(this, arguments).draw(context, +size.apply(this, arguments)); - if (buffer) return context = null, buffer + "" || null; - } - - symbol.type = function(_) { - return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type; - }; - - symbol.size = function(_) { - return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size; - }; - - symbol.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, symbol) : context; - }; - - return symbol; -} diff --git a/node_modules/d3-shape/src/symbol/circle.js b/node_modules/d3-shape/src/symbol/circle.js deleted file mode 100644 index 4653651..0000000 --- a/node_modules/d3-shape/src/symbol/circle.js +++ /dev/null @@ -1,9 +0,0 @@ -import {pi, tau} from "../math.js"; - -export default { - draw: function(context, size) { - var r = Math.sqrt(size / pi); - context.moveTo(r, 0); - context.arc(0, 0, r, 0, tau); - } -}; diff --git a/node_modules/d3-shape/src/symbol/cross.js b/node_modules/d3-shape/src/symbol/cross.js deleted file mode 100644 index a282f80..0000000 --- a/node_modules/d3-shape/src/symbol/cross.js +++ /dev/null @@ -1,18 +0,0 @@ -export default { - draw: function(context, size) { - var r = 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(); - } -}; diff --git a/node_modules/d3-shape/src/symbol/diamond.js b/node_modules/d3-shape/src/symbol/diamond.js deleted file mode 100644 index 9f4ff1a..0000000 --- a/node_modules/d3-shape/src/symbol/diamond.js +++ /dev/null @@ -1,14 +0,0 @@ -var tan30 = Math.sqrt(1 / 3), - tan30_2 = tan30 * 2; - -export default { - draw: function(context, size) { - var y = Math.sqrt(size / tan30_2), - x = y * tan30; - context.moveTo(0, -y); - context.lineTo(x, 0); - context.lineTo(0, y); - context.lineTo(-x, 0); - context.closePath(); - } -}; diff --git a/node_modules/d3-shape/src/symbol/square.js b/node_modules/d3-shape/src/symbol/square.js deleted file mode 100644 index 10beccd..0000000 --- a/node_modules/d3-shape/src/symbol/square.js +++ /dev/null @@ -1,7 +0,0 @@ -export default { - draw: function(context, size) { - var w = Math.sqrt(size), - x = -w / 2; - context.rect(x, x, w, w); - } -}; diff --git a/node_modules/d3-shape/src/symbol/star.js b/node_modules/d3-shape/src/symbol/star.js deleted file mode 100644 index c3560c3..0000000 --- a/node_modules/d3-shape/src/symbol/star.js +++ /dev/null @@ -1,24 +0,0 @@ -import {pi, tau} from "../math.js"; - -var ka = 0.89081309152928522810, - kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10), - kx = Math.sin(tau / 10) * kr, - ky = -Math.cos(tau / 10) * kr; - -export default { - draw: function(context, size) { - var r = Math.sqrt(size * ka), - x = kx * r, - y = ky * r; - context.moveTo(0, -r); - context.lineTo(x, y); - for (var i = 1; i < 5; ++i) { - var a = tau * i / 5, - c = Math.cos(a), - s = Math.sin(a); - context.lineTo(s * r, -c * r); - context.lineTo(c * x - s * y, s * x + c * y); - } - context.closePath(); - } -}; diff --git a/node_modules/d3-shape/src/symbol/triangle.js b/node_modules/d3-shape/src/symbol/triangle.js deleted file mode 100644 index a323d20..0000000 --- a/node_modules/d3-shape/src/symbol/triangle.js +++ /dev/null @@ -1,11 +0,0 @@ -var sqrt3 = Math.sqrt(3); - -export default { - draw: function(context, size) { - var y = -Math.sqrt(size / (sqrt3 * 3)); - context.moveTo(0, y * 2); - context.lineTo(-sqrt3 * y, -y); - context.lineTo(sqrt3 * y, -y); - context.closePath(); - } -}; diff --git a/node_modules/d3-shape/src/symbol/wye.js b/node_modules/d3-shape/src/symbol/wye.js deleted file mode 100644 index 697f2c3..0000000 --- a/node_modules/d3-shape/src/symbol/wye.js +++ /dev/null @@ -1,26 +0,0 @@ -var c = -0.5, - s = Math.sqrt(3) / 2, - k = 1 / Math.sqrt(12), - a = (k / 2 + 1) * 3; - -export default { - draw: function(context, size) { - var r = Math.sqrt(size / a), - x0 = r / 2, - y0 = r * k, - x1 = x0, - y1 = r * k + r, - x2 = -x1, - y2 = y1; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - context.lineTo(c * x0 - s * y0, s * x0 + c * y0); - context.lineTo(c * x1 - s * y1, s * x1 + c * y1); - context.lineTo(c * x2 - s * y2, s * x2 + c * y2); - context.lineTo(c * x0 + s * y0, c * y0 - s * x0); - context.lineTo(c * x1 + s * y1, c * y1 - s * x1); - context.lineTo(c * x2 + s * y2, c * y2 - s * x2); - context.closePath(); - } -}; diff --git a/node_modules/d3-time-format/LICENSE b/node_modules/d3-time-format/LICENSE deleted file mode 100644 index 1d9d875..0000000 --- a/node_modules/d3-time-format/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2017 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-time-format/README.md b/node_modules/d3-time-format/README.md deleted file mode 100644 index 2d83420..0000000 --- a/node_modules/d3-time-format/README.md +++ /dev/null @@ -1,197 +0,0 @@ -# d3-time-format - -This module provides a JavaScript implementation of the venerable [strptime](http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html) and [strftime](http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html) functions from the C standard library, and can be used to parse or format [dates](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) in a variety of locale-specific representations. To format a date, create a [formatter](#locale_format) from a specifier (a string with the desired format *directives*, indicated by `%`); then pass a date to the formatter, which returns a string. For example, to convert the current date to a human-readable string: - -```js -var formatTime = d3.timeFormat("%B %d, %Y"); -formatTime(new Date); // "June 30, 2015" -``` - -Likewise, to convert a string back to a date, create a [parser](#locale_parse): - -```js -var parseTime = d3.timeParse("%B %d, %Y"); -parseTime("June 30, 2015"); // Tue Jun 30 2015 00:00:00 GMT-0700 (PDT) -``` - -You can implement more elaborate conditional time formats, too. For example, here’s a [multi-scale time format](http://bl.ocks.org/mbostock/4149176) using [time intervals](https://github.com/d3/d3-time): - -```js -var formatMillisecond = d3.timeFormat(".%L"), - formatSecond = d3.timeFormat(":%S"), - formatMinute = d3.timeFormat("%I:%M"), - formatHour = d3.timeFormat("%I %p"), - formatDay = d3.timeFormat("%a %d"), - formatWeek = d3.timeFormat("%b %d"), - formatMonth = d3.timeFormat("%B"), - formatYear = d3.timeFormat("%Y"); - -function multiFormat(date) { - return (d3.timeSecond(date) < date ? formatMillisecond - : d3.timeMinute(date) < date ? formatSecond - : d3.timeHour(date) < date ? formatMinute - : d3.timeDay(date) < date ? formatHour - : d3.timeMonth(date) < date ? (d3.timeWeek(date) < date ? formatDay : formatWeek) - : d3.timeYear(date) < date ? formatMonth - : formatYear)(date); -} -``` - -This module is used by D3 [time scales](https://github.com/d3/d3-scale/blob/master/README.md#time-scales) to generate human-readable ticks. - -## Installing - -If you use NPM, `npm install d3-time-format`. Otherwise, download the [latest release](https://github.com/d3/d3-time-format/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-time-format.v2.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - - -``` - -Locale files are published to npm and can be loaded using [d3.json](https://github.com/d3/d3-request/blob/master/README.md#json). For example, to set Russian as the default locale: - -```js -d3.json("https://cdn.jsdelivr.net/npm/d3-time-format@2/locale/ru-RU.json", function(error, locale) { - if (error) throw error; - - d3.timeFormatDefaultLocale(locale); - - var format = d3.timeFormat("%c"); - - console.log(format(new Date)); // понедельник, 5 декабря 2016 г. 10:31:59 -}); -``` - -## API Reference - -# d3.timeFormat(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L4 "Source") - -An alias for [*locale*.format](#locale_format) on the [default locale](#timeFormatDefaultLocale). - -# d3.timeParse(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L5 "Source") - -An alias for [*locale*.parse](#locale_parse) on the [default locale](#timeFormatDefaultLocale). - -# d3.utcFormat(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L6 "Source") - -An alias for [*locale*.utcFormat](#locale_utcFormat) on the [default locale](#timeFormatDefaultLocale). - -# d3.utcParse(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L7 "Source") - -An alias for [*locale*.utcParse](#locale_utcParse) on the [default locale](#timeFormatDefaultLocale). - -# d3.isoFormat [<>](https://github.com/d3/d3-time-format/blob/master/src/isoFormat.js "Source") - -The full [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) UTC time formatter. Where available, this method will use [Date.toISOString](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString) to format. - -# d3.isoParse [<>](https://github.com/d3/d3-time-format/blob/master/src/isoParse.js "Source") - -The full [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) UTC time parser. Where available, this method will use the [Date constructor](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date) to parse strings. If you depend on strict validation of the input format according to ISO 8601, you should construct a [UTC parser function](#utcParse): - -```js -var strictIsoParse = d3.utcParse("%Y-%m-%dT%H:%M:%S.%LZ"); -``` - -# locale.format(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L293 "Source") - -Returns a new formatter for the given string *specifier*. The specifier string may contain the following directives: - -* `%a` - abbreviated weekday name.* -* `%A` - full weekday name.* -* `%b` - abbreviated month name.* -* `%B` - full month name.* -* `%c` - the locale’s date and time, such as `%x, %X`.* -* `%d` - zero-padded day of the month as a decimal number [01,31]. -* `%e` - space-padded day of the month as a decimal number [ 1,31]; equivalent to `%_d`. -* `%f` - microseconds as a decimal number [000000, 999999]. -* `%H` - hour (24-hour clock) as a decimal number [00,23]. -* `%I` - hour (12-hour clock) as a decimal number [01,12]. -* `%j` - day of the year as a decimal number [001,366]. -* `%m` - month as a decimal number [01,12]. -* `%M` - minute as a decimal number [00,59]. -* `%L` - milliseconds as a decimal number [000, 999]. -* `%p` - either AM or PM.* -* `%q` - quarter of the year as a decimal number [1,4]. -* `%Q` - milliseconds since UNIX epoch. -* `%s` - seconds since UNIX epoch. -* `%S` - second as a decimal number [00,61]. -* `%u` - Monday-based (ISO 8601) weekday as a decimal number [1,7]. -* `%U` - Sunday-based week of the year as a decimal number [00,53]. -* `%V` - ISO 8601 week of the year as a decimal number [01, 53]. -* `%w` - Sunday-based weekday as a decimal number [0,6]. -* `%W` - Monday-based week of the year as a decimal number [00,53]. -* `%x` - the locale’s date, such as `%-m/%-d/%Y`.* -* `%X` - the locale’s time, such as `%-I:%M:%S %p`.* -* `%y` - year without century as a decimal number [00,99]. -* `%Y` - year with century as a decimal number, such as `1999`. -* `%Z` - time zone offset, such as `-0700`, `-07:00`, `-07`, or `Z`. -* `%%` - a literal percent sign (`%`). - -Directives marked with an asterisk (\*) may be affected by the [locale definition](#localeFormat). - -For `%U`, all days in a new year preceding the first Sunday are considered to be in week 0. For `%W`, all days in a new year preceding the first Monday are considered to be in week 0. Week numbers are computed using [*interval*.count](https://github.com/d3/d3-time/blob/master/README.md#interval_count). For example, 2015-52 and 2016-00 represent Monday, December 28, 2015, while 2015-53 and 2016-01 represent Monday, January 4, 2016. This differs from the [ISO week date](https://en.wikipedia.org/wiki/ISO_week_date) specification (`%V`), which uses a more complicated definition! - -For `%V`, per the [strftime man page](http://man7.org/linux/man-pages/man3/strftime.3.html): - -> In this system, weeks start on a Monday, and are numbered from 01, for the first week, up to 52 or 53, for the last week. Week 1 is the first week where four or more days fall within the new year (or, synonymously, week 01 is: the first week of the year that contains a Thursday; or, the week that has 4 January in it). - -The `%` sign indicating a directive may be immediately followed by a padding modifier: - -* `0` - zero-padding -* `_` - space-padding -* `-` - disable padding - -If no padding modifier is specified, the default is `0` for all directives except `%e`, which defaults to `_`. (In some implementations of strftime and strptime, a directive may include an optional field width or precision; this feature is not yet implemented.) - -The returned function formats a specified *[date](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date)*, returning the corresponding string. - -```js -var formatMonth = d3.timeFormat("%B"), - formatDay = d3.timeFormat("%A"), - date = new Date(2014, 4, 1); // Thu May 01 2014 00:00:00 GMT-0700 (PDT) - -formatMonth(date); // "May" -formatDay(date); // "Thursday" -``` - -# locale.parse(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L298 "Source") - -Returns a new parser for the given string *specifier*. The specifier string may contain the same directives as [*locale*.format](#locale_format). The `%d` and `%e` directives are considered equivalent for parsing. - -The returned function parses a specified *string*, returning the corresponding [date](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date) or null if the string could not be parsed according to this format’s specifier. Parsing is strict: if the specified string does not exactly match the associated specifier, this method returns null. For example, if the associated specifier is `%Y-%m-%dT%H:%M:%SZ`, then the string `"2011-07-01T19:15:28Z"` will be parsed as expected, but `"2011-07-01T19:15:28"`, `"2011-07-01 19:15:28"` and `"2011-07-01"` will return null. (Note that the literal `Z` here is different from the time zone offset directive `%Z`.) If a more flexible parser is desired, try multiple formats sequentially until one returns non-null. - -# locale.utcFormat(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L303 "Source") - -Equivalent to [*locale*.format](#locale_format), except all directives are interpreted as [Coordinated Universal Time (UTC)](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) rather than local time. - -# locale.utcParse(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L308 "Source") - -Equivalent to [*locale*.parse](#locale_parse), except all directives are interpreted as [Coordinated Universal Time (UTC)](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) rather than local time. - -### Locales - -# d3.timeFormatLocale(definition) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js "Source") - -Returns a *locale* object for the specified *definition* with [*locale*.format](#locale_format), [*locale*.parse](#locale_parse), [*locale*.utcFormat](#locale_utcFormat), [*locale*.utcParse](#locale_utcParse) methods. The *definition* must include the following properties: - -* `dateTime` - the date and time (`%c`) format specifier (e.g., `"%a %b %e %X %Y"`). -* `date` - the date (`%x`) format specifier (e.g., `"%m/%d/%Y"`). -* `time` - the time (`%X`) format specifier (e.g., `"%H:%M:%S"`). -* `periods` - the A.M. and P.M. equivalents (e.g., `["AM", "PM"]`). -* `days` - the full names of the weekdays, starting with Sunday. -* `shortDays` - the abbreviated names of the weekdays, starting with Sunday. -* `months` - the full names of the months (starting with January). -* `shortMonths` - the abbreviated names of the months (starting with January). - -For an example, see [Localized Time Axis II](https://bl.ocks.org/mbostock/805115ebaa574e771db1875a6d828949). - -# d3.timeFormatDefaultLocale(definition) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js "Source") - -Equivalent to [d3.timeFormatLocale](#timeFormatLocale), except it also redefines [d3.timeFormat](#timeFormat), [d3.timeParse](#timeParse), [d3.utcFormat](#utcFormat) and [d3.utcParse](#utcParse) to the new locale’s [*locale*.format](#locale_format), [*locale*.parse](#locale_parse), [*locale*.utcFormat](#locale_utcFormat) and [*locale*.utcParse](#locale_utcParse). If you do not set a default locale, it defaults to [U.S. English](https://github.com/d3/d3-time-format/blob/master/locale/en-US.json). - -For an example, see [Localized Time Axis](https://bl.ocks.org/mbostock/6f1cc065d4d172bcaf322e399aa8d62f). diff --git a/node_modules/d3-time-format/dist/d3-time-format.js b/node_modules/d3-time-format/dist/d3-time-format.js deleted file mode 100644 index 737649c..0000000 --- a/node_modules/d3-time-format/dist/d3-time-format.js +++ /dev/null @@ -1,707 +0,0 @@ -// https://d3js.org/d3-time-format/ v2.2.3 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-time')) : -typeof define === 'function' && define.amd ? define(['exports', 'd3-time'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {}, global.d3)); -}(this, function (exports, d3Time) { 'use strict'; - -function localDate(d) { - if (0 <= d.y && d.y < 100) { - var date = 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 <= d.y && d.y < 100) { - var date = 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 newDate(y, m, d) { - return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0}; -} - -function formatLocale(locale) { - var locale_dateTime = locale.dateTime, - locale_date = locale.date, - locale_time = locale.time, - locale_periods = locale.periods, - locale_weekdays = locale.days, - locale_shortWeekdays = locale.shortDays, - locale_months = locale.months, - locale_shortMonths = locale.shortMonths; - - var periodRe = formatRe(locale_periods), - periodLookup = formatLookup(locale_periods), - weekdayRe = formatRe(locale_weekdays), - weekdayLookup = formatLookup(locale_weekdays), - shortWeekdayRe = formatRe(locale_shortWeekdays), - shortWeekdayLookup = formatLookup(locale_shortWeekdays), - monthRe = formatRe(locale_months), - monthLookup = formatLookup(locale_months), - shortMonthRe = formatRe(locale_shortMonths), - shortMonthLookup = formatLookup(locale_shortMonths); - - var formats = { - "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": formatQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatSeconds, - "u": formatWeekdayNumberMonday, - "U": formatWeekNumberSunday, - "V": formatWeekNumberISO, - "w": formatWeekdayNumberSunday, - "W": formatWeekNumberMonday, - "x": null, - "X": null, - "y": formatYear, - "Y": formatFullYear, - "Z": formatZone, - "%": formatLiteralPercent - }; - - var utcFormats = { - "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": formatUTCQuarter, - "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 = { - "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": parseQuarter, - "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 = newFormat(locale_date, formats); - formats.X = newFormat(locale_time, formats); - formats.c = newFormat(locale_dateTime, formats); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - - function newFormat(specifier, formats) { - return function(date) { - var string = [], - i = -1, - j = 0, - n = specifier.length, - c, - pad, - format; - - if (!(date instanceof Date)) date = new Date(+date); - - while (++i < n) { - if (specifier.charCodeAt(i) === 37) { - string.push(specifier.slice(j, i)); - if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); - else pad = c === "e" ? " " : "0"; - if (format = formats[c]) c = format(date, pad); - string.push(c); - j = i + 1; - } - } - - string.push(specifier.slice(j, i)); - return string.join(""); - }; - } - - function newParse(specifier, Z) { - return function(string) { - var d = newDate(1900, undefined, 1), - i = parseSpecifier(d, specifier, string += "", 0), - week, day; - if (i != string.length) return null; - - // If a UNIX timestamp is specified, return it. - if ("Q" in d) return new Date(d.Q); - if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); - - // If this is utcParse, never use the local timezone. - if (Z && !("Z" in d)) d.Z = 0; - - // The am-pm flag is 0 for AM, and 1 for PM. - if ("p" in d) d.H = d.H % 12 + d.p * 12; - - // If the month was not specified, inherit from the quarter. - if (d.m === undefined) d.m = "q" in d ? d.q : 0; - - // 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 = 1; - if ("Z" in d) { - week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay(); - week = day > 4 || day === 0 ? d3Time.utcMonday.ceil(week) : d3Time.utcMonday(week); - week = d3Time.utcDay.offset(week, (d.V - 1) * 7); - d.y = week.getUTCFullYear(); - d.m = week.getUTCMonth(); - d.d = week.getUTCDate() + (d.w + 6) % 7; - } else { - week = localDate(newDate(d.y, 0, 1)), day = week.getDay(); - week = day > 4 || day === 0 ? d3Time.timeMonday.ceil(week) : d3Time.timeMonday(week); - week = d3Time.timeDay.offset(week, (d.V - 1) * 7); - d.y = week.getFullYear(); - d.m = week.getMonth(); - d.d = week.getDate() + (d.w + 6) % 7; - } - } else if ("W" in d || "U" in d) { - if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; - day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); - d.m = 0; - d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 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 += d.Z / 100 | 0; - d.M += d.Z % 100; - return utcDate(d); - } - - // Otherwise, all fields are in local time. - return localDate(d); - }; - } - - function parseSpecifier(d, specifier, string, j) { - var i = 0, - n = specifier.length, - m = string.length, - c, - parse; - - while (i < n) { - if (j >= m) return -1; - c = specifier.charCodeAt(i++); - if (c === 37) { - c = specifier.charAt(i++); - parse = parses[c in pads ? specifier.charAt(i++) : c]; - if (!parse || ((j = parse(d, string, j)) < 0)) return -1; - } else if (c != string.charCodeAt(j++)) { - return -1; - } - } - - return j; - } - - function parsePeriod(d, string, i) { - var n = periodRe.exec(string.slice(i)); - return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseShortWeekday(d, string, i) { - var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseWeekday(d, string, i) { - var n = weekdayRe.exec(string.slice(i)); - return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseShortMonth(d, string, i) { - var n = shortMonthRe.exec(string.slice(i)); - return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseMonth(d, string, i) { - var n = monthRe.exec(string.slice(i)); - return n ? (d.m = 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() >= 12)]; - } - - function formatQuarter(d) { - return 1 + ~~(d.getMonth() / 3); - } - - 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() >= 12)]; - } - - function formatUTCQuarter(d) { - return 1 + ~~(d.getUTCMonth() / 3); - } - - return { - format: function(specifier) { - var f = newFormat(specifier += "", formats); - f.toString = function() { return specifier; }; - return f; - }, - parse: function(specifier) { - var p = newParse(specifier += "", false); - p.toString = function() { return specifier; }; - return p; - }, - utcFormat: function(specifier) { - var f = newFormat(specifier += "", utcFormats); - f.toString = function() { return specifier; }; - return f; - }, - utcParse: function(specifier) { - var p = newParse(specifier += "", true); - p.toString = function() { return specifier; }; - return p; - } - }; -} - -var pads = {"-": "", "_": " ", "0": "0"}, - numberRe = /^\s*\d+/, // note: ignores next directive - percentRe = /^%/, - requoteRe = /[\\^$*+?|[\]().{}]/g; - -function pad(value, fill, width) { - var sign = value < 0 ? "-" : "", - string = (sign ? -value : value) + "", - length = 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 = {}, i = -1, n = names.length; - while (++i < n) map[names[i].toLowerCase()] = i; - return map; -} - -function parseWeekdayNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.w = +n[0], i + n[0].length) : -1; -} - -function parseWeekdayNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.u = +n[0], i + n[0].length) : -1; -} - -function parseWeekNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.U = +n[0], i + n[0].length) : -1; -} - -function parseWeekNumberISO(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.V = +n[0], i + n[0].length) : -1; -} - -function parseWeekNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.W = +n[0], i + n[0].length) : -1; -} - -function parseFullYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 4)); - return n ? (d.y = +n[0], i + n[0].length) : -1; -} - -function parseYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; -} - -function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); - return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; -} - -function parseQuarter(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; -} - -function parseMonthNumber(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.m = n[0] - 1, i + n[0].length) : -1; -} - -function parseDayOfMonth(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.d = +n[0], i + n[0].length) : -1; -} - -function parseDayOfYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; -} - -function parseHour24(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.H = +n[0], i + n[0].length) : -1; -} - -function parseMinutes(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.M = +n[0], i + n[0].length) : -1; -} - -function parseSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.S = +n[0], i + n[0].length) : -1; -} - -function parseMilliseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.L = +n[0], i + n[0].length) : -1; -} - -function parseMicroseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 6)); - return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; -} - -function parseLiteralPercent(d, string, i) { - var n = percentRe.exec(string.slice(i, i + 1)); - return n ? i + n[0].length : -1; -} - -function parseUnixTimestamp(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.Q = +n[0], i + n[0].length) : -1; -} - -function parseUnixTimestampSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.s = +n[0], i + n[0].length) : -1; -} - -function formatDayOfMonth(d, p) { - return pad(d.getDate(), p, 2); -} - -function formatHour24(d, p) { - return pad(d.getHours(), p, 2); -} - -function formatHour12(d, p) { - return pad(d.getHours() % 12 || 12, p, 2); -} - -function formatDayOfYear(d, p) { - return pad(1 + d3Time.timeDay.count(d3Time.timeYear(d), d), p, 3); -} - -function formatMilliseconds(d, p) { - return pad(d.getMilliseconds(), p, 3); -} - -function formatMicroseconds(d, p) { - return formatMilliseconds(d, p) + "000"; -} - -function formatMonthNumber(d, p) { - return pad(d.getMonth() + 1, p, 2); -} - -function formatMinutes(d, p) { - return pad(d.getMinutes(), p, 2); -} - -function formatSeconds(d, p) { - return pad(d.getSeconds(), p, 2); -} - -function formatWeekdayNumberMonday(d) { - var day = d.getDay(); - return day === 0 ? 7 : day; -} - -function formatWeekNumberSunday(d, p) { - return pad(d3Time.timeSunday.count(d3Time.timeYear(d) - 1, d), p, 2); -} - -function formatWeekNumberISO(d, p) { - var day = d.getDay(); - d = (day >= 4 || day === 0) ? d3Time.timeThursday(d) : d3Time.timeThursday.ceil(d); - return pad(d3Time.timeThursday.count(d3Time.timeYear(d), d) + (d3Time.timeYear(d).getDay() === 4), p, 2); -} - -function formatWeekdayNumberSunday(d) { - return d.getDay(); -} - -function formatWeekNumberMonday(d, p) { - return pad(d3Time.timeMonday.count(d3Time.timeYear(d) - 1, d), p, 2); -} - -function formatYear(d, p) { - return pad(d.getFullYear() % 100, p, 2); -} - -function formatFullYear(d, p) { - return pad(d.getFullYear() % 10000, p, 4); -} - -function formatZone(d) { - var z = d.getTimezoneOffset(); - return (z > 0 ? "-" : (z *= -1, "+")) - + pad(z / 60 | 0, "0", 2) - + pad(z % 60, "0", 2); -} - -function formatUTCDayOfMonth(d, p) { - return pad(d.getUTCDate(), p, 2); -} - -function formatUTCHour24(d, p) { - return pad(d.getUTCHours(), p, 2); -} - -function formatUTCHour12(d, p) { - return pad(d.getUTCHours() % 12 || 12, p, 2); -} - -function formatUTCDayOfYear(d, p) { - return pad(1 + d3Time.utcDay.count(d3Time.utcYear(d), d), p, 3); -} - -function formatUTCMilliseconds(d, p) { - return pad(d.getUTCMilliseconds(), p, 3); -} - -function formatUTCMicroseconds(d, p) { - return formatUTCMilliseconds(d, p) + "000"; -} - -function formatUTCMonthNumber(d, p) { - return pad(d.getUTCMonth() + 1, p, 2); -} - -function formatUTCMinutes(d, p) { - return pad(d.getUTCMinutes(), p, 2); -} - -function formatUTCSeconds(d, p) { - return pad(d.getUTCSeconds(), p, 2); -} - -function formatUTCWeekdayNumberMonday(d) { - var dow = d.getUTCDay(); - return dow === 0 ? 7 : dow; -} - -function formatUTCWeekNumberSunday(d, p) { - return pad(d3Time.utcSunday.count(d3Time.utcYear(d) - 1, d), p, 2); -} - -function formatUTCWeekNumberISO(d, p) { - var day = d.getUTCDay(); - d = (day >= 4 || day === 0) ? d3Time.utcThursday(d) : d3Time.utcThursday.ceil(d); - return pad(d3Time.utcThursday.count(d3Time.utcYear(d), d) + (d3Time.utcYear(d).getUTCDay() === 4), p, 2); -} - -function formatUTCWeekdayNumberSunday(d) { - return d.getUTCDay(); -} - -function formatUTCWeekNumberMonday(d, p) { - return pad(d3Time.utcMonday.count(d3Time.utcYear(d) - 1, d), p, 2); -} - -function formatUTCYear(d, p) { - return pad(d.getUTCFullYear() % 100, p, 2); -} - -function formatUTCFullYear(d, p) { - return pad(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; - -defaultLocale({ - 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", "Sep", "Oct", "Nov", "Dec"] -}); - -function defaultLocale(definition) { - locale = formatLocale(definition); - exports.timeFormat = locale.format; - exports.timeParse = locale.parse; - exports.utcFormat = locale.utcFormat; - exports.utcParse = locale.utcParse; - return locale; -} - -var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; - -function formatIsoNative(date) { - return date.toISOString(); -} - -var formatIso = Date.prototype.toISOString - ? formatIsoNative - : exports.utcFormat(isoSpecifier); - -function parseIsoNative(string) { - var date = new Date(string); - return isNaN(date) ? null : date; -} - -var parseIso = +new Date("2000-01-01T00:00:00.000Z") - ? parseIsoNative - : exports.utcParse(isoSpecifier); - -exports.isoFormat = formatIso; -exports.isoParse = parseIso; -exports.timeFormatDefaultLocale = defaultLocale; -exports.timeFormatLocale = formatLocale; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-time-format/dist/d3-time-format.min.js b/node_modules/d3-time-format/dist/d3-time-format.min.js deleted file mode 100644 index 8955484..0000000 --- a/node_modules/d3-time-format/dist/d3-time-format.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-time-format/ v2.2.3 Copyright 2019 Mike Bostock -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-time")):"function"==typeof define&&define.amd?define(["exports","d3-time"],n):n((e=e||self).d3=e.d3||{},e.d3)}(this,function(e,n){"use strict";function t(e){if(0<=e.y&&e.y<100){var n=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return n.setFullYear(e.y),n}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function r(e){if(0<=e.y&&e.y<100){var n=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return n.setUTCFullYear(e.y),n}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function u(e,n,t){return{y:e,m:n,d:t,H:0,M:0,S:0,L:0}}function i(e){var i=e.dateTime,c=e.date,a=e.time,f=e.periods,l=e.days,s=e.shortDays,g=e.months,Me=e.shortMonths,Te=y(f),De=d(f),Ce=y(l),xe=d(l),Ue=y(s),we=d(s),pe=y(g),Se=d(g),Ye=y(Me),Le=d(Me),Fe={a:function(e){return s[e.getDay()]},A:function(e){return l[e.getDay()]},b:function(e){return Me[e.getMonth()]},B:function(e){return g[e.getMonth()]},c:null,d:V,e:V,f:J,H:j,I:P,j:q,L:I,m:O,M:Q,p:function(e){return f[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:me,s:ve,S:X,u:N,U:B,V:_,w:$,W:z,x:null,X:null,y:E,Y:R,Z:k,"%":he},He={a:function(e){return s[e.getUTCDay()]},A:function(e){return l[e.getUTCDay()]},b:function(e){return Me[e.getUTCMonth()]},B:function(e){return g[e.getUTCMonth()]},c:null,d:G,e:G,f:re,H:K,I:ee,j:ne,L:te,m:ue,M:ie,p:function(e){return f[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:me,s:ve,S:ce,u:oe,U:ae,V:fe,w:le,W:se,x:null,X:null,y:ge,Y:ye,Z:de,"%":he},Ae={a:function(e,n,t){var r=Ue.exec(n.slice(t));return r?(e.w=we[r[0].toLowerCase()],t+r[0].length):-1},A:function(e,n,t){var r=Ce.exec(n.slice(t));return r?(e.w=xe[r[0].toLowerCase()],t+r[0].length):-1},b:function(e,n,t){var r=Ye.exec(n.slice(t));return r?(e.m=Le[r[0].toLowerCase()],t+r[0].length):-1},B:function(e,n,t){var r=pe.exec(n.slice(t));return r?(e.m=Se[r[0].toLowerCase()],t+r[0].length):-1},c:function(e,n,t){return We(e,i,n,t)},d:p,e:p,f:A,H:Y,I:Y,j:S,L:H,m:w,M:L,p:function(e,n,t){var r=Te.exec(n.slice(t));return r?(e.p=De[r[0].toLowerCase()],t+r[0].length):-1},q:U,Q:b,s:W,S:F,u:m,U:v,V:M,w:h,W:T,x:function(e,n,t){return We(e,c,n,t)},X:function(e,n,t){return We(e,a,n,t)},y:C,Y:D,Z:x,"%":Z};function Ze(e,n){return function(t){var r,u,i,c=[],a=-1,f=0,l=e.length;for(t instanceof Date||(t=new Date(+t));++a53)return null;"w"in f||(f.w=1),"Z"in f?(a=(o=r(u(f.y,0,1))).getUTCDay(),o=a>4||0===a?n.utcMonday.ceil(o):n.utcMonday(o),o=n.utcDay.offset(o,7*(f.V-1)),f.y=o.getUTCFullYear(),f.m=o.getUTCMonth(),f.d=o.getUTCDate()+(f.w+6)%7):(a=(o=t(u(f.y,0,1))).getDay(),o=a>4||0===a?n.timeMonday.ceil(o):n.timeMonday(o),o=n.timeDay.offset(o,7*(f.V-1)),f.y=o.getFullYear(),f.m=o.getMonth(),f.d=o.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),a="Z"in f?r(u(f.y,0,1)).getUTCDay():t(u(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+7*f.W-(a+5)%7:f.w+7*f.U-(a+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,r(f)):t(f)}}function We(e,n,t,r){for(var u,i,c=0,a=n.length,f=t.length;c=f)return-1;if(37===(u=n.charCodeAt(c++))){if(u=n.charAt(c++),!(i=Ae[u in o?n.charAt(c++):u])||(r=i(e,t,r))<0)return-1}else if(u!=t.charCodeAt(r++))return-1}return r}return Fe.x=Ze(c,Fe),Fe.X=Ze(a,Fe),Fe.c=Ze(i,Fe),He.x=Ze(c,He),He.X=Ze(a,He),He.c=Ze(i,He),{format:function(e){var n=Ze(e+="",Fe);return n.toString=function(){return e},n},parse:function(e){var n=be(e+="",!1);return n.toString=function(){return e},n},utcFormat:function(e){var n=Ze(e+="",He);return n.toString=function(){return e},n},utcParse:function(e){var n=be(e+="",!0);return n.toString=function(){return e},n}}}var c,o={"-":"",_:" ",0:"0"},a=/^\s*\d+/,f=/^%/,l=/[\\^$*+?|[\]().{}]/g;function s(e,n,t){var r=e<0?"-":"",u=(r?-e:e)+"",i=u.length;return r+(i68?1900:2e3),t+r[0].length):-1}function x(e,n,t){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(t,t+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),t+r[0].length):-1}function U(e,n,t){var r=a.exec(n.slice(t,t+1));return r?(e.q=3*r[0]-3,t+r[0].length):-1}function w(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.m=r[0]-1,t+r[0].length):-1}function p(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.d=+r[0],t+r[0].length):-1}function S(e,n,t){var r=a.exec(n.slice(t,t+3));return r?(e.m=0,e.d=+r[0],t+r[0].length):-1}function Y(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.H=+r[0],t+r[0].length):-1}function L(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.M=+r[0],t+r[0].length):-1}function F(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.S=+r[0],t+r[0].length):-1}function H(e,n,t){var r=a.exec(n.slice(t,t+3));return r?(e.L=+r[0],t+r[0].length):-1}function A(e,n,t){var r=a.exec(n.slice(t,t+6));return r?(e.L=Math.floor(r[0]/1e3),t+r[0].length):-1}function Z(e,n,t){var r=f.exec(n.slice(t,t+1));return r?t+r[0].length:-1}function b(e,n,t){var r=a.exec(n.slice(t));return r?(e.Q=+r[0],t+r[0].length):-1}function W(e,n,t){var r=a.exec(n.slice(t));return r?(e.s=+r[0],t+r[0].length):-1}function V(e,n){return s(e.getDate(),n,2)}function j(e,n){return s(e.getHours(),n,2)}function P(e,n){return s(e.getHours()%12||12,n,2)}function q(e,t){return s(1+n.timeDay.count(n.timeYear(e),e),t,3)}function I(e,n){return s(e.getMilliseconds(),n,3)}function J(e,n){return I(e,n)+"000"}function O(e,n){return s(e.getMonth()+1,n,2)}function Q(e,n){return s(e.getMinutes(),n,2)}function X(e,n){return s(e.getSeconds(),n,2)}function N(e){var n=e.getDay();return 0===n?7:n}function B(e,t){return s(n.timeSunday.count(n.timeYear(e)-1,e),t,2)}function _(e,t){var r=e.getDay();return e=r>=4||0===r?n.timeThursday(e):n.timeThursday.ceil(e),s(n.timeThursday.count(n.timeYear(e),e)+(4===n.timeYear(e).getDay()),t,2)}function $(e){return e.getDay()}function z(e,t){return s(n.timeMonday.count(n.timeYear(e)-1,e),t,2)}function E(e,n){return s(e.getFullYear()%100,n,2)}function R(e,n){return s(e.getFullYear()%1e4,n,4)}function k(e){var n=e.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+s(n/60|0,"0",2)+s(n%60,"0",2)}function G(e,n){return s(e.getUTCDate(),n,2)}function K(e,n){return s(e.getUTCHours(),n,2)}function ee(e,n){return s(e.getUTCHours()%12||12,n,2)}function ne(e,t){return s(1+n.utcDay.count(n.utcYear(e),e),t,3)}function te(e,n){return s(e.getUTCMilliseconds(),n,3)}function re(e,n){return te(e,n)+"000"}function ue(e,n){return s(e.getUTCMonth()+1,n,2)}function ie(e,n){return s(e.getUTCMinutes(),n,2)}function ce(e,n){return s(e.getUTCSeconds(),n,2)}function oe(e){var n=e.getUTCDay();return 0===n?7:n}function ae(e,t){return s(n.utcSunday.count(n.utcYear(e)-1,e),t,2)}function fe(e,t){var r=e.getUTCDay();return e=r>=4||0===r?n.utcThursday(e):n.utcThursday.ceil(e),s(n.utcThursday.count(n.utcYear(e),e)+(4===n.utcYear(e).getUTCDay()),t,2)}function le(e){return e.getUTCDay()}function se(e,t){return s(n.utcMonday.count(n.utcYear(e)-1,e),t,2)}function ge(e,n){return s(e.getUTCFullYear()%100,n,2)}function ye(e,n){return s(e.getUTCFullYear()%1e4,n,4)}function de(){return"+0000"}function he(){return"%"}function me(e){return+e}function ve(e){return Math.floor(+e/1e3)}function Me(n){return c=i(n),e.timeFormat=c.format,e.timeParse=c.parse,e.utcFormat=c.utcFormat,e.utcParse=c.utcParse,c}Me({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","Sep","Oct","Nov","Dec"]});var Te=Date.prototype.toISOString?function(e){return e.toISOString()}:e.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var De=+new Date("2000-01-01T00:00:00.000Z")?function(e){var n=new Date(e);return isNaN(n)?null:n}:e.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");e.isoFormat=Te,e.isoParse=De,e.timeFormatDefaultLocale=Me,e.timeFormatLocale=i,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/node_modules/d3-time-format/locale/ar-EG.json b/node_modules/d3-time-format/locale/ar-EG.json deleted file mode 100644 index 8ac0265..0000000 --- a/node_modules/d3-time-format/locale/ar-EG.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%x, %X", - "date": "%-d/%-m/%Y", - "time": "%-I:%M:%S %p", - "periods": ["ص", "م"], - "days": ["الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"], - "shortDays": ["أحد", "إثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"], - "months": ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"], - "shortMonths": ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"] -} diff --git a/node_modules/d3-time-format/locale/ca-ES.json b/node_modules/d3-time-format/locale/ca-ES.json deleted file mode 100644 index a270873..0000000 --- a/node_modules/d3-time-format/locale/ca-ES.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, %e de %B de %Y, %X", - "date": "%d/%m/%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["diumenge", "dilluns", "dimarts", "dimecres", "dijous", "divendres", "dissabte"], - "shortDays": ["dg.", "dl.", "dt.", "dc.", "dj.", "dv.", "ds."], - "months": ["gener", "febrer", "març", "abril", "maig", "juny", "juliol", "agost", "setembre", "octubre", "novembre", "desembre"], - "shortMonths": ["gen.", "febr.", "març", "abr.", "maig", "juny", "jul.", "ag.", "set.", "oct.", "nov.", "des."] -} diff --git a/node_modules/d3-time-format/locale/cs-CZ.json b/node_modules/d3-time-format/locale/cs-CZ.json deleted file mode 100644 index ced34ea..0000000 --- a/node_modules/d3-time-format/locale/cs-CZ.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A,%e.%B %Y, %X", - "date": "%-d.%-m.%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["neděle", "pondělí", "úterý", "středa", "čvrtek", "pátek", "sobota"], - "shortDays": ["ne.", "po.", "út.", "st.", "čt.", "pá.", "so."], - "months": ["leden", "únor", "březen", "duben", "květen", "červen", "červenec", "srpen", "září", "říjen", "listopad", "prosinec"], - "shortMonths": ["led", "úno", "břez", "dub", "kvě", "čer", "červ", "srp", "zář", "říj", "list", "pros"] -} diff --git a/node_modules/d3-time-format/locale/da-DK.json b/node_modules/d3-time-format/locale/da-DK.json deleted file mode 100644 index f0c2349..0000000 --- a/node_modules/d3-time-format/locale/da-DK.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A den %d %B %Y %X", - "date": "%d-%m-%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], - "shortDays": ["søn", "man", "tir", "ons", "tor", "fre", "lør"], - "months": ["januar", "februar", "marts", "april", "maj", "juni", "juli", "august", "september", "oktober", "november", "december"], - "shortMonths": ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"] -} diff --git a/node_modules/d3-time-format/locale/de-CH.json b/node_modules/d3-time-format/locale/de-CH.json deleted file mode 100644 index 466b749..0000000 --- a/node_modules/d3-time-format/locale/de-CH.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, der %e. %B %Y, %X", - "date": "%d.%m.%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], - "shortDays": ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], - "months": ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], - "shortMonths": ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"] -} diff --git a/node_modules/d3-time-format/locale/de-DE.json b/node_modules/d3-time-format/locale/de-DE.json deleted file mode 100644 index 466b749..0000000 --- a/node_modules/d3-time-format/locale/de-DE.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, der %e. %B %Y, %X", - "date": "%d.%m.%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], - "shortDays": ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], - "months": ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], - "shortMonths": ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"] -} diff --git a/node_modules/d3-time-format/locale/en-CA.json b/node_modules/d3-time-format/locale/en-CA.json deleted file mode 100644 index 5c13ae3..0000000 --- a/node_modules/d3-time-format/locale/en-CA.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%a %b %e %X %Y", - "date": "%Y-%m-%d", - "time": "%H:%M:%S", - "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", "Sep", "Oct", "Nov", "Dec"] -} diff --git a/node_modules/d3-time-format/locale/en-GB.json b/node_modules/d3-time-format/locale/en-GB.json deleted file mode 100644 index 9f651c5..0000000 --- a/node_modules/d3-time-format/locale/en-GB.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%a %e %b %X %Y", - "date": "%d/%m/%Y", - "time": "%H:%M:%S", - "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", "Sep", "Oct", "Nov", "Dec"] -} diff --git a/node_modules/d3-time-format/locale/en-US.json b/node_modules/d3-time-format/locale/en-US.json deleted file mode 100644 index a7ac951..0000000 --- a/node_modules/d3-time-format/locale/en-US.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "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", "Sep", "Oct", "Nov", "Dec"] -} diff --git a/node_modules/d3-time-format/locale/es-ES.json b/node_modules/d3-time-format/locale/es-ES.json deleted file mode 100644 index 8c5f754..0000000 --- a/node_modules/d3-time-format/locale/es-ES.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, %e de %B de %Y, %X", - "date": "%d/%m/%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], - "shortDays": ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"], - "months": ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], - "shortMonths": ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"] -} diff --git a/node_modules/d3-time-format/locale/es-MX.json b/node_modules/d3-time-format/locale/es-MX.json deleted file mode 100644 index 4dc2077..0000000 --- a/node_modules/d3-time-format/locale/es-MX.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%x, %X", - "date": "%d/%m/%Y", - "time": "%-I:%M:%S %p", - "periods": ["AM", "PM"], - "days": ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], - "shortDays": ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"], - "months": ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], - "shortMonths": ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"] -} diff --git a/node_modules/d3-time-format/locale/fa-IR.json b/node_modules/d3-time-format/locale/fa-IR.json deleted file mode 100644 index badff07..0000000 --- a/node_modules/d3-time-format/locale/fa-IR.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%x, %X", - "date": "%-d/%-m/%Y", - "time": "%-I:%M:%S %p", - "periods": ["صبح", "عصر"], - "days": ["یکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"], - "shortDays": ["یکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"], - "months": ["ژانویه", "فوریه", "مارس", "آوریل", "مه", "ژوئن", "ژوئیه", "اوت", "سپتامبر", "اکتبر", "نوامبر", "دسامبر"], - "shortMonths": ["ژانویه", "فوریه", "مارس", "آوریل", "مه", "ژوئن", "ژوئیه", "اوت", "سپتامبر", "اکتبر", "نوامبر", "دسامبر"] -} diff --git a/node_modules/d3-time-format/locale/fi-FI.json b/node_modules/d3-time-format/locale/fi-FI.json deleted file mode 100644 index 2422199..0000000 --- a/node_modules/d3-time-format/locale/fi-FI.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, %-d. %Bta %Y klo %X", - "date": "%-d.%-m.%Y", - "time": "%H:%M:%S", - "periods": ["a.m.", "p.m."], - "days": ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"], - "shortDays": ["Su", "Ma", "Ti", "Ke", "To", "Pe", "La"], - "months": ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"], - "shortMonths": ["Tammi", "Helmi", "Maalis", "Huhti", "Touko", "Kesä", "Heinä", "Elo", "Syys", "Loka", "Marras", "Joulu"] -} diff --git a/node_modules/d3-time-format/locale/fr-CA.json b/node_modules/d3-time-format/locale/fr-CA.json deleted file mode 100644 index 1300cab..0000000 --- a/node_modules/d3-time-format/locale/fr-CA.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%a %e %b %Y %X", - "date": "%Y-%m-%d", - "time": "%H:%M:%S", - "periods": ["", ""], - "days": ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], - "shortDays": ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"], - "months": ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], - "shortMonths": ["jan", "fév", "mar", "avr", "mai", "jui", "jul", "aoû", "sep", "oct", "nov", "déc"] -} diff --git a/node_modules/d3-time-format/locale/fr-FR.json b/node_modules/d3-time-format/locale/fr-FR.json deleted file mode 100644 index 8a8b707..0000000 --- a/node_modules/d3-time-format/locale/fr-FR.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, le %e %B %Y, %X", - "date": "%d/%m/%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], - "shortDays": ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."], - "months": ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], - "shortMonths": ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."] -} diff --git a/node_modules/d3-time-format/locale/he-IL.json b/node_modules/d3-time-format/locale/he-IL.json deleted file mode 100644 index 0ce27cd..0000000 --- a/node_modules/d3-time-format/locale/he-IL.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, %e ב%B %Y %X", - "date": "%d.%m.%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"], - "shortDays": ["א׳", "ב׳", "ג׳", "ד׳", "ה׳", "ו׳", "ש׳"], - "months": ["ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"], - "shortMonths": ["ינו׳", "פבר׳", "מרץ", "אפר׳", "מאי", "יוני", "יולי", "אוג׳", "ספט׳", "אוק׳", "נוב׳", "דצמ׳"] -} diff --git a/node_modules/d3-time-format/locale/hu-HU.json b/node_modules/d3-time-format/locale/hu-HU.json deleted file mode 100644 index d81acf2..0000000 --- a/node_modules/d3-time-format/locale/hu-HU.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%Y. %B %-e., %A %X", - "date": "%Y. %m. %d.", - "time": "%H:%M:%S", - "periods": ["de.", "du."], - "days": ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"], - "shortDays": ["V", "H", "K", "Sze", "Cs", "P", "Szo"], - "months": ["január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december"], - "shortMonths": ["jan.", "feb.", "már.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."] -} diff --git a/node_modules/d3-time-format/locale/it-IT.json b/node_modules/d3-time-format/locale/it-IT.json deleted file mode 100644 index 0fc08e0..0000000 --- a/node_modules/d3-time-format/locale/it-IT.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A %e %B %Y, %X", - "date": "%d/%m/%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"], - "shortDays": ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"], - "months": ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"], - "shortMonths": ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"] -} diff --git a/node_modules/d3-time-format/locale/ja-JP.json b/node_modules/d3-time-format/locale/ja-JP.json deleted file mode 100644 index 61abbea..0000000 --- a/node_modules/d3-time-format/locale/ja-JP.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%Y %b %e %a %X", - "date": "%Y/%m/%d", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"], - "shortDays": ["日", "月", "火", "水", "木", "金", "土"], - "months": ["睦月", "如月", "弥生", "卯月", "皐月", "水無月", "文月", "葉月", "長月", "神無月", "霜月", "師走"], - "shortMonths": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"] -} diff --git a/node_modules/d3-time-format/locale/ko-KR.json b/node_modules/d3-time-format/locale/ko-KR.json deleted file mode 100644 index 7055666..0000000 --- a/node_modules/d3-time-format/locale/ko-KR.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%Y/%m/%d %a %X", - "date": "%Y/%m/%d", - "time": "%H:%M:%S", - "periods": ["오전", "오후"], - "days": ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"], - "shortDays": ["일", "월", "화", "수", "목", "금", "토"], - "months": ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], - "shortMonths": ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"] -} diff --git a/node_modules/d3-time-format/locale/mk-MK.json b/node_modules/d3-time-format/locale/mk-MK.json deleted file mode 100644 index 4a47fd1..0000000 --- a/node_modules/d3-time-format/locale/mk-MK.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, %e %B %Y г. %X", - "date": "%d.%m.%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["недела", "понеделник", "вторник", "среда", "четврток", "петок", "сабота"], - "shortDays": ["нед", "пон", "вто", "сре", "чет", "пет", "саб"], - "months": ["јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"], - "shortMonths": ["јан", "фев", "мар", "апр", "мај", "јун", "јул", "авг", "сеп", "окт", "ное", "дек"] -} diff --git a/node_modules/d3-time-format/locale/nb-NO.json b/node_modules/d3-time-format/locale/nb-NO.json deleted file mode 100644 index a8bfd20..0000000 --- a/node_modules/d3-time-format/locale/nb-NO.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A den %d. %B %Y %X", - "date": "%d.%m.%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], - "shortDays": ["søn", "man", "tir", "ons", "tor", "fre", "lør"], - "months": ["januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember"], - "shortMonths": ["jan", "feb", "mars", "apr", "mai", "juni", "juli", "aug", "sep", "okt", "nov", "des"] -} diff --git a/node_modules/d3-time-format/locale/nl-NL.json b/node_modules/d3-time-format/locale/nl-NL.json deleted file mode 100644 index dbec6dc..0000000 --- a/node_modules/d3-time-format/locale/nl-NL.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%a %e %B %Y %T", - "date": "%d-%m-%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"], - "shortDays": ["zo", "ma", "di", "wo", "do", "vr", "za"], - "months": ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"], - "shortMonths": ["jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"] -} diff --git a/node_modules/d3-time-format/locale/pl-PL.json b/node_modules/d3-time-format/locale/pl-PL.json deleted file mode 100644 index 616b4cd..0000000 --- a/node_modules/d3-time-format/locale/pl-PL.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, %e %B %Y, %X", - "date": "%d/%m/%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"], - "shortDays": ["Niedz.", "Pon.", "Wt.", "Śr.", "Czw.", "Pt.", "Sob."], - "months": ["Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"], - "shortMonths": ["Stycz.", "Luty", "Marz.", "Kwie.", "Maj", "Czerw.", "Lipc.", "Sierp.", "Wrz.", "Paźdz.", "Listop.", "Grudz."] -} diff --git a/node_modules/d3-time-format/locale/pt-BR.json b/node_modules/d3-time-format/locale/pt-BR.json deleted file mode 100644 index 4e9ff89..0000000 --- a/node_modules/d3-time-format/locale/pt-BR.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, %e de %B de %Y. %X", - "date": "%d/%m/%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"], - "shortDays": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"], - "months": ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], - "shortMonths": ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"] -} diff --git a/node_modules/d3-time-format/locale/ru-RU.json b/node_modules/d3-time-format/locale/ru-RU.json deleted file mode 100644 index c042318..0000000 --- a/node_modules/d3-time-format/locale/ru-RU.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, %e %B %Y г. %X", - "date": "%d.%m.%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"], - "shortDays": ["вс", "пн", "вт", "ср", "чт", "пт", "сб"], - "months": ["января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"], - "shortMonths": ["янв", "фев", "мар", "апр", "май", "июн", "июл", "авг", "сен", "окт", "ноя", "дек"] -} diff --git a/node_modules/d3-time-format/locale/sv-SE.json b/node_modules/d3-time-format/locale/sv-SE.json deleted file mode 100644 index 2318388..0000000 --- a/node_modules/d3-time-format/locale/sv-SE.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A den %d %B %Y %X", - "date": "%Y-%m-%d", - "time": "%H:%M:%S", - "periods": ["fm", "em"], - "days": ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"], - "shortDays": ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"], - "months": ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"], - "shortMonths": ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"] -} diff --git a/node_modules/d3-time-format/locale/tr-TR.json b/node_modules/d3-time-format/locale/tr-TR.json deleted file mode 100644 index ea0557e..0000000 --- a/node_modules/d3-time-format/locale/tr-TR.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%a %e %b %X %Y", - "date": "%d/%m/%Y", - "time": "%H:%M:%S", - "periods": ["AM", "PM"], - "days": ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"], - "shortDays": ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"], - "months": ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"], - "shortMonths": ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"] -} diff --git a/node_modules/d3-time-format/locale/uk-UA.json b/node_modules/d3-time-format/locale/uk-UA.json deleted file mode 100644 index 555eed4..0000000 --- a/node_modules/d3-time-format/locale/uk-UA.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%A, %e %B %Y р. %X", - "date": "%d.%m.%Y", - "time": "%H:%M:%S", - "periods": ["дп", "пп"], - "days": ["неділя", "понеділок", "вівторок", "середа", "четвер", "п'ятниця", "субота"], - "shortDays": ["нд", "пн", "вт", "ср", "чт", "пт", "сб"], - "months": ["січня", "лютого", "березня", "квітня", "травня", "червня", "липня", "серпня", "вересня", "жовтня", "листопада", "грудня"], - "shortMonths": ["січ.", "лют.", "бер.", "квіт.", "трав.", "черв.", "лип.", "серп.", "вер.", "жовт.", "лист.", "груд."] -} diff --git a/node_modules/d3-time-format/locale/zh-CN.json b/node_modules/d3-time-format/locale/zh-CN.json deleted file mode 100644 index 762f212..0000000 --- a/node_modules/d3-time-format/locale/zh-CN.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%x %A %X", - "date": "%Y年%-m月%-d日", - "time": "%H:%M:%S", - "periods": ["上午", "下午"], - "days": ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], - "shortDays": ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], - "months": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], - "shortMonths": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"] -} diff --git a/node_modules/d3-time-format/locale/zh-TW.json b/node_modules/d3-time-format/locale/zh-TW.json deleted file mode 100644 index 2dd9a67..0000000 --- a/node_modules/d3-time-format/locale/zh-TW.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dateTime": "%x %A %X", - "date": "%Y年%-m月%-d日", - "time": "%H:%M:%S", - "periods": ["上午", "下午"], - "days": ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], - "shortDays": ["週日", "週一", "週二", "週三", "週四", "週五", "週六"], - "months": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], - "shortMonths": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"] -} diff --git a/node_modules/d3-time-format/package.json b/node_modules/d3-time-format/package.json deleted file mode 100644 index e9d9002..0000000 --- a/node_modules/d3-time-format/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "_from": "d3-time-format@^2.2.3", - "_id": "d3-time-format@2.2.3", - "_inBundle": false, - "_integrity": "sha512-RAHNnD8+XvC4Zc4d2A56Uw0yJoM7bsvOlJR33bclxq399Rak/b9bhvu/InjxdWhPtkgU53JJcleJTGkNRnN6IA==", - "_location": "/d3-time-format", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "d3-time-format@^2.2.3", - "name": "d3-time-format", - "escapedName": "d3-time-format", - "rawSpec": "^2.2.3", - "saveSpec": null, - "fetchSpec": "^2.2.3" - }, - "_requiredBy": [ - "/d3-scale", - "/vega-format" - ], - "_resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.2.3.tgz", - "_shasum": "0c9a12ee28342b2037e5ea1cf0b9eb4dd75f29cb", - "_spec": "d3-time-format@^2.2.3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-format", - "author": { - "name": "Mike Bostock", - "url": "http://bost.ocks.org/mike" - }, - "bugs": { - "url": "https://github.com/d3/d3-time-format/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-time": "1" - }, - "deprecated": false, - "description": "A JavaScript time formatter and parser inspired by strftime and strptime.", - "devDependencies": { - "d3-queue": "3", - "eslint": "6", - "rollup": "1", - "rollup-plugin-terser": "5", - "tape": "4" - }, - "files": [ - "dist/**/*.js", - "src/**/*.js", - "locale/*.json" - ], - "homepage": "https://d3js.org/d3-time-format/", - "jsdelivr": "dist/d3-time-format.min.js", - "keywords": [ - "d3", - "d3-module", - "time", - "format", - "strftime", - "strptime" - ], - "license": "BSD-3-Clause", - "main": "dist/d3-time-format.js", - "module": "src/index.js", - "name": "d3-time-format", - "repository": { - "type": "git", - "url": "git+https://github.com/d3/d3-time-format.git" - }, - "scripts": { - "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js", - "prepublishOnly": "rm -rf dist && yarn test", - "pretest": "rollup -c", - "test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint src" - }, - "sideEffects": [ - "./src/defaultLocale.js" - ], - "unpkg": "dist/d3-time-format.min.js", - "version": "2.2.3" -} diff --git a/node_modules/d3-time-format/src/defaultLocale.js b/node_modules/d3-time-format/src/defaultLocale.js deleted file mode 100644 index d762db5..0000000 --- a/node_modules/d3-time-format/src/defaultLocale.js +++ /dev/null @@ -1,27 +0,0 @@ -import formatLocale from "./locale.js"; - -var locale; -export var timeFormat; -export var timeParse; -export var utcFormat; -export var utcParse; - -defaultLocale({ - 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", "Sep", "Oct", "Nov", "Dec"] -}); - -export default function defaultLocale(definition) { - locale = formatLocale(definition); - timeFormat = locale.format; - timeParse = locale.parse; - utcFormat = locale.utcFormat; - utcParse = locale.utcParse; - return locale; -} diff --git a/node_modules/d3-time-format/src/index.js b/node_modules/d3-time-format/src/index.js deleted file mode 100644 index 6c93971..0000000 --- a/node_modules/d3-time-format/src/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export {default as timeFormatDefaultLocale, timeFormat, timeParse, utcFormat, utcParse} from "./defaultLocale.js"; -export {default as timeFormatLocale} from "./locale.js"; -export {default as isoFormat} from "./isoFormat.js"; -export {default as isoParse} from "./isoParse.js"; diff --git a/node_modules/d3-time-format/src/isoFormat.js b/node_modules/d3-time-format/src/isoFormat.js deleted file mode 100644 index 43185a3..0000000 --- a/node_modules/d3-time-format/src/isoFormat.js +++ /dev/null @@ -1,13 +0,0 @@ -import {utcFormat} from "./defaultLocale.js"; - -export var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; - -function formatIsoNative(date) { - return date.toISOString(); -} - -var formatIso = Date.prototype.toISOString - ? formatIsoNative - : utcFormat(isoSpecifier); - -export default formatIso; diff --git a/node_modules/d3-time-format/src/isoParse.js b/node_modules/d3-time-format/src/isoParse.js deleted file mode 100644 index 381d1c9..0000000 --- a/node_modules/d3-time-format/src/isoParse.js +++ /dev/null @@ -1,13 +0,0 @@ -import {isoSpecifier} from "./isoFormat.js"; -import {utcParse} from "./defaultLocale.js"; - -function parseIsoNative(string) { - var date = new Date(string); - return isNaN(date) ? null : date; -} - -var parseIso = +new Date("2000-01-01T00:00:00.000Z") - ? parseIsoNative - : utcParse(isoSpecifier); - -export default parseIso; diff --git a/node_modules/d3-time-format/src/locale.js b/node_modules/d3-time-format/src/locale.js deleted file mode 100644 index 1277298..0000000 --- a/node_modules/d3-time-format/src/locale.js +++ /dev/null @@ -1,663 +0,0 @@ -import { - timeDay, - timeSunday, - timeMonday, - timeThursday, - timeYear, - utcDay, - utcSunday, - utcMonday, - utcThursday, - utcYear -} from "d3-time"; - -function localDate(d) { - if (0 <= d.y && d.y < 100) { - var date = 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 <= d.y && d.y < 100) { - var date = 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 newDate(y, m, d) { - return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0}; -} - -export default function formatLocale(locale) { - var locale_dateTime = locale.dateTime, - locale_date = locale.date, - locale_time = locale.time, - locale_periods = locale.periods, - locale_weekdays = locale.days, - locale_shortWeekdays = locale.shortDays, - locale_months = locale.months, - locale_shortMonths = locale.shortMonths; - - var periodRe = formatRe(locale_periods), - periodLookup = formatLookup(locale_periods), - weekdayRe = formatRe(locale_weekdays), - weekdayLookup = formatLookup(locale_weekdays), - shortWeekdayRe = formatRe(locale_shortWeekdays), - shortWeekdayLookup = formatLookup(locale_shortWeekdays), - monthRe = formatRe(locale_months), - monthLookup = formatLookup(locale_months), - shortMonthRe = formatRe(locale_shortMonths), - shortMonthLookup = formatLookup(locale_shortMonths); - - var formats = { - "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": formatQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatSeconds, - "u": formatWeekdayNumberMonday, - "U": formatWeekNumberSunday, - "V": formatWeekNumberISO, - "w": formatWeekdayNumberSunday, - "W": formatWeekNumberMonday, - "x": null, - "X": null, - "y": formatYear, - "Y": formatFullYear, - "Z": formatZone, - "%": formatLiteralPercent - }; - - var utcFormats = { - "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": formatUTCQuarter, - "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 = { - "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": parseQuarter, - "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 = newFormat(locale_date, formats); - formats.X = newFormat(locale_time, formats); - formats.c = newFormat(locale_dateTime, formats); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - - function newFormat(specifier, formats) { - return function(date) { - var string = [], - i = -1, - j = 0, - n = specifier.length, - c, - pad, - format; - - if (!(date instanceof Date)) date = new Date(+date); - - while (++i < n) { - if (specifier.charCodeAt(i) === 37) { - string.push(specifier.slice(j, i)); - if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); - else pad = c === "e" ? " " : "0"; - if (format = formats[c]) c = format(date, pad); - string.push(c); - j = i + 1; - } - } - - string.push(specifier.slice(j, i)); - return string.join(""); - }; - } - - function newParse(specifier, Z) { - return function(string) { - var d = newDate(1900, undefined, 1), - i = parseSpecifier(d, specifier, string += "", 0), - week, day; - if (i != string.length) return null; - - // If a UNIX timestamp is specified, return it. - if ("Q" in d) return new Date(d.Q); - if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); - - // If this is utcParse, never use the local timezone. - if (Z && !("Z" in d)) d.Z = 0; - - // The am-pm flag is 0 for AM, and 1 for PM. - if ("p" in d) d.H = d.H % 12 + d.p * 12; - - // If the month was not specified, inherit from the quarter. - if (d.m === undefined) d.m = "q" in d ? d.q : 0; - - // 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 = 1; - if ("Z" in d) { - week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay(); - week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week); - week = utcDay.offset(week, (d.V - 1) * 7); - d.y = week.getUTCFullYear(); - d.m = week.getUTCMonth(); - d.d = week.getUTCDate() + (d.w + 6) % 7; - } else { - week = localDate(newDate(d.y, 0, 1)), day = week.getDay(); - week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week); - week = timeDay.offset(week, (d.V - 1) * 7); - d.y = week.getFullYear(); - d.m = week.getMonth(); - d.d = week.getDate() + (d.w + 6) % 7; - } - } else if ("W" in d || "U" in d) { - if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; - day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); - d.m = 0; - d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 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 += d.Z / 100 | 0; - d.M += d.Z % 100; - return utcDate(d); - } - - // Otherwise, all fields are in local time. - return localDate(d); - }; - } - - function parseSpecifier(d, specifier, string, j) { - var i = 0, - n = specifier.length, - m = string.length, - c, - parse; - - while (i < n) { - if (j >= m) return -1; - c = specifier.charCodeAt(i++); - if (c === 37) { - c = specifier.charAt(i++); - parse = parses[c in pads ? specifier.charAt(i++) : c]; - if (!parse || ((j = parse(d, string, j)) < 0)) return -1; - } else if (c != string.charCodeAt(j++)) { - return -1; - } - } - - return j; - } - - function parsePeriod(d, string, i) { - var n = periodRe.exec(string.slice(i)); - return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseShortWeekday(d, string, i) { - var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseWeekday(d, string, i) { - var n = weekdayRe.exec(string.slice(i)); - return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseShortMonth(d, string, i) { - var n = shortMonthRe.exec(string.slice(i)); - return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseMonth(d, string, i) { - var n = monthRe.exec(string.slice(i)); - return n ? (d.m = 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() >= 12)]; - } - - function formatQuarter(d) { - return 1 + ~~(d.getMonth() / 3); - } - - 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() >= 12)]; - } - - function formatUTCQuarter(d) { - return 1 + ~~(d.getUTCMonth() / 3); - } - - return { - format: function(specifier) { - var f = newFormat(specifier += "", formats); - f.toString = function() { return specifier; }; - return f; - }, - parse: function(specifier) { - var p = newParse(specifier += "", false); - p.toString = function() { return specifier; }; - return p; - }, - utcFormat: function(specifier) { - var f = newFormat(specifier += "", utcFormats); - f.toString = function() { return specifier; }; - return f; - }, - utcParse: function(specifier) { - var p = newParse(specifier += "", true); - p.toString = function() { return specifier; }; - return p; - } - }; -} - -var pads = {"-": "", "_": " ", "0": "0"}, - numberRe = /^\s*\d+/, // note: ignores next directive - percentRe = /^%/, - requoteRe = /[\\^$*+?|[\]().{}]/g; - -function pad(value, fill, width) { - var sign = value < 0 ? "-" : "", - string = (sign ? -value : value) + "", - length = 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 = {}, i = -1, n = names.length; - while (++i < n) map[names[i].toLowerCase()] = i; - return map; -} - -function parseWeekdayNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.w = +n[0], i + n[0].length) : -1; -} - -function parseWeekdayNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.u = +n[0], i + n[0].length) : -1; -} - -function parseWeekNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.U = +n[0], i + n[0].length) : -1; -} - -function parseWeekNumberISO(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.V = +n[0], i + n[0].length) : -1; -} - -function parseWeekNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.W = +n[0], i + n[0].length) : -1; -} - -function parseFullYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 4)); - return n ? (d.y = +n[0], i + n[0].length) : -1; -} - -function parseYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; -} - -function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); - return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; -} - -function parseQuarter(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; -} - -function parseMonthNumber(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.m = n[0] - 1, i + n[0].length) : -1; -} - -function parseDayOfMonth(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.d = +n[0], i + n[0].length) : -1; -} - -function parseDayOfYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; -} - -function parseHour24(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.H = +n[0], i + n[0].length) : -1; -} - -function parseMinutes(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.M = +n[0], i + n[0].length) : -1; -} - -function parseSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.S = +n[0], i + n[0].length) : -1; -} - -function parseMilliseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.L = +n[0], i + n[0].length) : -1; -} - -function parseMicroseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 6)); - return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; -} - -function parseLiteralPercent(d, string, i) { - var n = percentRe.exec(string.slice(i, i + 1)); - return n ? i + n[0].length : -1; -} - -function parseUnixTimestamp(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.Q = +n[0], i + n[0].length) : -1; -} - -function parseUnixTimestampSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.s = +n[0], i + n[0].length) : -1; -} - -function formatDayOfMonth(d, p) { - return pad(d.getDate(), p, 2); -} - -function formatHour24(d, p) { - return pad(d.getHours(), p, 2); -} - -function formatHour12(d, p) { - return pad(d.getHours() % 12 || 12, p, 2); -} - -function formatDayOfYear(d, p) { - return pad(1 + timeDay.count(timeYear(d), d), p, 3); -} - -function formatMilliseconds(d, p) { - return pad(d.getMilliseconds(), p, 3); -} - -function formatMicroseconds(d, p) { - return formatMilliseconds(d, p) + "000"; -} - -function formatMonthNumber(d, p) { - return pad(d.getMonth() + 1, p, 2); -} - -function formatMinutes(d, p) { - return pad(d.getMinutes(), p, 2); -} - -function formatSeconds(d, p) { - return pad(d.getSeconds(), p, 2); -} - -function formatWeekdayNumberMonday(d) { - var day = d.getDay(); - return day === 0 ? 7 : day; -} - -function formatWeekNumberSunday(d, p) { - return pad(timeSunday.count(timeYear(d) - 1, d), p, 2); -} - -function formatWeekNumberISO(d, p) { - var day = d.getDay(); - d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d); - return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2); -} - -function formatWeekdayNumberSunday(d) { - return d.getDay(); -} - -function formatWeekNumberMonday(d, p) { - return pad(timeMonday.count(timeYear(d) - 1, d), p, 2); -} - -function formatYear(d, p) { - return pad(d.getFullYear() % 100, p, 2); -} - -function formatFullYear(d, p) { - return pad(d.getFullYear() % 10000, p, 4); -} - -function formatZone(d) { - var z = d.getTimezoneOffset(); - return (z > 0 ? "-" : (z *= -1, "+")) - + pad(z / 60 | 0, "0", 2) - + pad(z % 60, "0", 2); -} - -function formatUTCDayOfMonth(d, p) { - return pad(d.getUTCDate(), p, 2); -} - -function formatUTCHour24(d, p) { - return pad(d.getUTCHours(), p, 2); -} - -function formatUTCHour12(d, p) { - return pad(d.getUTCHours() % 12 || 12, p, 2); -} - -function formatUTCDayOfYear(d, p) { - return pad(1 + utcDay.count(utcYear(d), d), p, 3); -} - -function formatUTCMilliseconds(d, p) { - return pad(d.getUTCMilliseconds(), p, 3); -} - -function formatUTCMicroseconds(d, p) { - return formatUTCMilliseconds(d, p) + "000"; -} - -function formatUTCMonthNumber(d, p) { - return pad(d.getUTCMonth() + 1, p, 2); -} - -function formatUTCMinutes(d, p) { - return pad(d.getUTCMinutes(), p, 2); -} - -function formatUTCSeconds(d, p) { - return pad(d.getUTCSeconds(), p, 2); -} - -function formatUTCWeekdayNumberMonday(d) { - var dow = d.getUTCDay(); - return dow === 0 ? 7 : dow; -} - -function formatUTCWeekNumberSunday(d, p) { - return pad(utcSunday.count(utcYear(d) - 1, d), p, 2); -} - -function formatUTCWeekNumberISO(d, p) { - var day = d.getUTCDay(); - d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d); - return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); -} - -function formatUTCWeekdayNumberSunday(d) { - return d.getUTCDay(); -} - -function formatUTCWeekNumberMonday(d, p) { - return pad(utcMonday.count(utcYear(d) - 1, d), p, 2); -} - -function formatUTCYear(d, p) { - return pad(d.getUTCFullYear() % 100, p, 2); -} - -function formatUTCFullYear(d, p) { - return pad(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); -} diff --git a/node_modules/d3-time/LICENSE b/node_modules/d3-time/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-time/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-time/README.md b/node_modules/d3-time/README.md deleted file mode 100644 index 67f494e..0000000 --- a/node_modules/d3-time/README.md +++ /dev/null @@ -1,333 +0,0 @@ -# d3-time - -When visualizing time series data, analyzing temporal patterns, or working with time in general, the irregularities of conventional time units quickly become apparent. In the [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian_calendar), for example, most months have 31 days but some have 28, 29 or 30; most years have 365 days but [leap years](https://en.wikipedia.org/wiki/Leap_year) have 366; and with [daylight saving](https://en.wikipedia.org/wiki/Daylight_saving_time), most days have 24 hours but some have 23 or 25. Adding to complexity, daylight saving conventions vary around the world. - -As a result of these temporal peculiarities, it can be difficult to perform seemingly-trivial tasks. For example, if you want to compute the number of days that have passed between two dates, you can’t simply subtract and divide by 24 hours (86,400,000 ms): - -```js -var start = new Date(2015, 02, 01), // Sun Mar 01 2015 00:00:00 GMT-0800 (PST) - end = new Date(2015, 03, 01); // Wed Apr 01 2015 00:00:00 GMT-0700 (PDT) -(end - start) / 864e5; // 30.958333333333332, oops! -``` - -You can, however, use [d3.timeDay](#timeDay).[count](#interval_count): - -```js -d3.timeDay.count(start, end); // 31 -``` - -The [day](#day) [interval](#api-reference) is one of several provided by d3-time. Each interval represents a conventional unit of time—[hours](#timeHour), [weeks](#timeWeek), [months](#timeMonth), *etc.*—and has methods to calculate boundary dates. For example, [d3.timeDay](#timeDay) computes midnight (typically 12:00 AM local time) of the corresponding day. In addition to [rounding](#interval_round) and [counting](#interval_count), intervals can also be used to generate arrays of boundary dates. For example, to compute each Sunday in the current month: - -```js -var now = new Date; -d3.timeWeek.range(d3.timeMonth.floor(now), d3.timeMonth.ceil(now)); -// [Sun Jun 07 2015 00:00:00 GMT-0700 (PDT), -// Sun Jun 14 2015 00:00:00 GMT-0700 (PDT), -// Sun Jun 21 2015 00:00:00 GMT-0700 (PDT), -// Sun Jun 28 2015 00:00:00 GMT-0700 (PDT)] -``` - -The d3-time module does not implement its own calendaring system; it merely implements a convenient API for calendar math on top of ECMAScript [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). Thus, it ignores leap seconds and can only work with the local time zone and [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC). - -This module is used by D3’s time scales to generate sensible ticks, by D3’s time format, and can also be used directly to do things like [calendar layouts](http://bl.ocks.org/mbostock/4063318). - -## Installing - -If you use NPM, `npm install d3-time`. Otherwise, download the [latest release](https://github.com/d3/d3-time/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-time.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -[Try d3-time in your browser.](https://tonicdev.com/npm/d3-time) - -## API Reference - -# interval([date]) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L6 "Source") - -Equivalent to [*interval*.floor](#interval_floor), except it *date* is not specified, it defaults to the current time. For example, [d3.timeYear](#timeYear)(*date*) and d3.timeYear.floor(*date*) are equivalent. - -```js -var monday = d3.timeMonday(); // The latest preceeding Monday, local time. -``` - -# interval.floor(date) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L10 "Source") - -Returns a new date representing the latest interval boundary date before or equal to *date*. For example, [d3.timeDay](#timeDay).floor(*date*) typically returns 12:00 AM local time on the given *date*. - -This method is idempotent: if the specified *date* is already floored to the current interval, a new date with an identical time is returned. Furthermore, the returned date is the minimum expressible value of the associated interval, such that *interval*.floor(*interval*.floor(*date*) - 1) returns the preceeding interval boundary date. - -Note that the `==` and `===` operators do not compare by value with [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) objects, and thus you cannot use them to tell whether the specified *date* has already been floored. Instead, coerce to a number and then compare: - -```js -// Returns true if the specified date is a day boundary. -function isDay(date) { - return +d3.timeDay.floor(date) === +date; -} -``` - -This is more reliable than testing whether the time is 12:00 AM, as in some time zones midnight may not exist due to daylight saving. - -# interval.round(date) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L16 "Source") - -Returns a new date representing the closest interval boundary date to *date*. For example, [d3.timeDay](#timeDay).round(*date*) typically returns 12:00 AM local time on the given *date* if it is on or before noon, and 12:00 AM of the following day if it is after noon. - -This method is idempotent: if the specified *date* is already rounded to the current interval, a new date with an identical time is returned. - -# interval.ceil(date) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L12 "Source") - -Returns a new date representing the earliest interval boundary date after or equal to *date*. For example, [d3.timeDay](#timeDay).ceil(*date*) typically returns 12:00 AM local time on the date following the given *date*. - -This method is idempotent: if the specified *date* is already ceilinged to the current interval, a new date with an identical time is returned. Furthermore, the returned date is the maximum expressible value of the associated interval, such that *interval*.ceil(*interval*.ceil(*date*) + 1) returns the following interval boundary date. - -# interval.offset(date[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L22 "Source") - -Returns a new date equal to *date* plus *step* intervals. If *step* is not specified it defaults to 1. If *step* is negative, then the returned date will be before the specified *date*; if *step* is zero, then a copy of the specified *date* is returned; if *step* is not an integer, it is [floored](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor). This method does not round the specified *date* to the interval. For example, if *date* is today at 5:34 PM, then [d3.timeDay](#timeDay).offset(*date*, 1) returns 5:34 PM tomorrow (even if daylight saving changes!). - -# interval.range(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L26 "Source") - -Returns an array of dates representing every interval boundary after or equal to *start* (inclusive) and before *stop* (exclusive). If *step* is specified, then every *step*th boundary will be returned; for example, for the [d3.timeDay](#timeDay) interval a *step* of 2 will return every other day. If *step* is not an integer, it is [floored](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor). - -The first date in the returned array is the earliest boundary after or equal to *start*; subsequent dates are [offset](#interval_offset) by *step* intervals and [floored](#interval_floor). Thus, two overlapping ranges may be consistent. For example, this range contains odd days: - -```js -d3.timeDay.range(new Date(2015, 0, 1), new Date(2015, 0, 7), 2); -// [Thu Jan 01 2015 00:00:00 GMT-0800 (PST), -// Sat Jan 03 2015 00:00:00 GMT-0800 (PST), -// Mon Jan 05 2015 00:00:00 GMT-0800 (PST)] -``` - -While this contains even days: - -```js -d3.timeDay.range(new Date(2015, 0, 2), new Date(2015, 0, 8), 2); -// [Fri Jan 02 2015 00:00:00 GMT-0800 (PST), -// Sun Jan 04 2015 00:00:00 GMT-0800 (PST), -// Tue Jan 06 2015 00:00:00 GMT-0800 (PST)] -``` - -To make ranges consistent when a *step* is specified, use [*interval*.every](#interval_every) instead. - -# interval.filter(test) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L35 "Source") - -Returns a new interval that is a filtered subset of this interval using the specified *test* function. The *test* function is passed a date and should return true if and only if the specified date should be considered part of the interval. For example, to create an interval that returns the 1st, 11th, 21th and 31th (if it exists) of each month: - -```js -var i = d3.timeDay.filter(function(d) { return (d.getDate() - 1) % 10 === 0; }); -``` - -The returned filtered interval does not support [*interval*.count](#interval_count). See also [*interval*.every](#interval_every). - -# interval.every(step) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L50 "Source") - -Returns a [filtered](#interval_filter) view of this interval representing every *step*th date. The meaning of *step* is dependent on this interval’s parent interval as defined by the field function. For example, [d3.timeMinute](#timeMinute).every(15) returns an interval representing every fifteen minutes, starting on the hour: :00, :15, :30, :45, etc. Note that for some intervals, the resulting dates may not be uniformly-spaced; [d3.timeDay](#timeDay)’s parent interval is [d3.timeMonth](#timeMonth), and thus the interval number resets at the start of each month. If *step* is not valid, returns null. If *step* is one, returns this interval. - -This method can be used in conjunction with [*interval*.range](#interval_range) to ensure that two overlapping ranges are consistent. For example, this range contains odd days: - -```js -d3.timeDay.every(2).range(new Date(2015, 0, 1), new Date(2015, 0, 7)); -// [Thu Jan 01 2015 00:00:00 GMT-0800 (PST), -// Sat Jan 03 2015 00:00:00 GMT-0800 (PST), -// Mon Jan 05 2015 00:00:00 GMT-0800 (PST)] -``` - -As does this one: - -```js -d3.timeDay.every(2).range(new Date(2015, 0, 2), new Date(2015, 0, 8)); -// [Sat Jan 03 2015 00:00:00 GMT-0800 (PST), -// Mon Jan 05 2015 00:00:00 GMT-0800 (PST), -// Wed Jan 07 2015 00:00:00 GMT-0800 (PST)] -``` - -The returned filtered interval does not support [*interval*.count](#interval_count). See also [*interval*.filter](#interval_filter). - -# interval.count(start, end) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L44 "Source") - -Returns the number of interval boundaries after *start* (exclusive) and before or equal to *end* (inclusive). Note that this behavior is slightly different than [*interval*.range](#interval_range) because its purpose is to return the zero-based number of the specified *end* date relative to the specified *start* date. For example, to compute the current zero-based day-of-year number: - -```js -var now = new Date; -d3.timeDay.count(d3.timeYear(now), now); // 177 -``` - -Likewise, to compute the current zero-based week-of-year number for weeks that start on Sunday: - -```js -d3.timeSunday.count(d3.timeYear(now), now); // 25 -``` - -# d3.timeInterval(floor, offset[, count[, field]]) [<>](https://github.com/d3/d3-time/blob/master/src/interval.js#L4 "Source") - -Constructs a new custom interval given the specified *floor* and *offset* functions and an optional *count* function. - -The *floor* function takes a single date as an argument and rounds it down to the nearest interval boundary. - -The *offset* function takes a date and an integer step as arguments and advances the specified date by the specified number of boundaries; the step may be positive, negative or zero. - -The optional *count* function takes a start date and an end date, already floored to the current interval, and returns the number of boundaries between the start (exclusive) and end (inclusive). If a *count* function is not specified, the returned interval does not expose [*interval*.count](#interval_count) or [*interval*.every](#interval_every) methods. Note: due to an internal optimization, the specified *count* function must not invoke *interval*.count on other time intervals. - -The optional *field* function takes a date, already floored to the current interval, and returns the field value of the specified date, corresponding to the number of boundaries between this date (exclusive) and the latest previous parent boundary. For example, for the [d3.timeDay](#timeDay) interval, this returns the number of days since the start of the month. If a *field* function is not specified, it defaults to counting the number of interval boundaries since the UNIX epoch of January 1, 1970 UTC. The *field* function defines the behavior of [*interval*.every](#interval_every). - -### Intervals - -The following intervals are provided: - -# d3.timeMillisecond [<>](https://github.com/d3/d3-time/blob/master/src/millisecond.js "Source") -
# d3.utcMillisecond - -Milliseconds; the shortest available time unit. - -# d3.timeSecond [<>](https://github.com/d3/d3-time/blob/master/src/second.js "Source") -
# d3.utcSecond - -Seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. - -# d3.timeMinute [<>](https://github.com/d3/d3-time/blob/master/src/minute.js "Source") -
# d3.utcMinute [<>](https://github.com/d3/d3-time/blob/master/src/utcMinute.js "Source") - -Minutes (e.g., 01:02:00 AM); 60 seconds. Note that ECMAScript [ignores leap seconds](http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.1). - -# d3.timeHour [<>](https://github.com/d3/d3-time/blob/master/src/hour.js "Source") -
# d3.utcHour [<>](https://github.com/d3/d3-time/blob/master/src/utcHour.js "Source") - -Hours (e.g., 01:00 AM); 60 minutes. Note that advancing time by one hour in local time can return the same hour or skip an hour due to daylight saving. - -# d3.timeDay [<>](https://github.com/d3/d3-time/blob/master/src/day.js "Source") -
# d3.utcDay [<>](https://github.com/d3/d3-time/blob/master/src/utcDay.js "Source") - -Days (e.g., February 7, 2012 at 12:00 AM); typically 24 hours. Days in local time may range from 23 to 25 hours due to daylight saving. - -# d3.timeWeek [<>](https://github.com/d3/d3-time/blob/master/src/week.js "Source") -
# d3.utcWeek [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js "Source") - -Alias for [d3.timeSunday](#timeSunday); 7 days and typically 168 hours. Weeks in local time may range from 167 to 169 hours due on daylight saving. - -# d3.timeSunday [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L15 "Source") -
# d3.utcSunday [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L15 "Source") - -Sunday-based weeks (e.g., February 5, 2012 at 12:00 AM). - -# d3.timeMonday [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L16 "Source") -
# d3.utcMonday [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L16 "Source") - -Monday-based weeks (e.g., February 6, 2012 at 12:00 AM). - -# d3.timeTuesday [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L17 "Source") -
# d3.utcTuesday [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L17 "Source") - -Tuesday-based weeks (e.g., February 7, 2012 at 12:00 AM). - -# d3.timeWednesday [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L18 "Source") -
# d3.utcWednesday [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L18 "Source") - -Wednesday-based weeks (e.g., February 8, 2012 at 12:00 AM). - -# d3.timeThursday [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L19 "Source") -
# d3.utcThursday [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L19 "Source") - -Thursday-based weeks (e.g., February 9, 2012 at 12:00 AM). - -# d3.timeFriday [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L20 "Source") -
# d3.utcFriday [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L20 "Source") - -Friday-based weeks (e.g., February 10, 2012 at 12:00 AM). - -# d3.timeSaturday [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L21 "Source") -
# d3.utcSaturday [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L21 "Source") - -Saturday-based weeks (e.g., February 11, 2012 at 12:00 AM). - -# d3.timeMonth [<>](https://github.com/d3/d3-time/blob/master/src/month.js "Source") -
# d3.utcMonth [<>](https://github.com/d3/d3-time/blob/master/src/utcMonth.js "Source") - -Months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. - -# d3.timeYear [<>](https://github.com/d3/d3-time/blob/master/src/year.js "Source") -
# d3.utcYear [<>](https://github.com/d3/d3-time/blob/master/src/utcYear.js "Source") - -Years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. - -### Ranges - -For convenience, aliases for [*interval*.range](#interval_range) are also provided as plural forms of the corresponding interval. - -# d3.timeMilliseconds(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/millisecond.js#L26 "Source") -
# d3.utcMilliseconds(start, stop[, step]) - -Aliases for [d3.timeMillisecond](#timeMillisecond).[range](#interval_range) and [d3.utcMillisecond](#timeMillisecond).[range](#interval_range). - -# d3.timeSeconds(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/second.js#L15 "Source") -
# d3.utcSeconds(start, stop[, step]) - -Aliases for [d3.timeSecond](#timeSecond).[range](#interval_range) and [d3.utcSecond](#timeSecond).[range](#interval_range). - -# d3.timeMinutes(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/minute.js#L15 "Source") -
# d3.utcMinutes(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcMinute.js#L15 "Source") - -Aliases for [d3.timeMinute](#timeMinute).[range](#interval_range) and [d3.utcMinute](#timeMinute).[range](#interval_range). - -# d3.timeHours(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/hour.js#L17 "Source") -
# d3.utcHours(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcHour.js#L15 "Source") - -Aliases for [d3.timeHour](#timeHour).[range](#interval_range) and [d3.utcHour](#timeHour).[range](#interval_range). - -# d3.timeDays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/day.js#L15 "Source") -
# d3.utcDays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcDay.js#L15 "Source") - -Aliases for [d3.timeDay](#timeDay).[range](#interval_range) and [d3.utcDay](#timeDay).[range](#interval_range). - -# d3.timeWeeks(start, stop[, step]) -
# d3.utcWeeks(start, stop[, step]) - -Aliases for [d3.timeWeek](#timeWeek).[range](#interval_range) and [d3.utcWeek](#timeWeek).[range](#interval_range). - -# d3.timeSundays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L23 "Source") -
# d3.utcSundays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L23 "Source") - -Aliases for [d3.timeSunday](#timeSunday).[range](#interval_range) and [d3.utcSunday](#timeSunday).[range](#interval_range). - -# d3.timeMondays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L24 "Source") -
# d3.utcMondays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L24 "Source") - -Aliases for [d3.timeMonday](#timeMonday).[range](#interval_range) and [d3.utcMonday](#timeMonday).[range](#interval_range). - -# d3.timeTuesdays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L25 "Source") -
# d3.utcTuesdays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L25 "Source") - -Aliases for [d3.timeTuesday](#timeTuesday).[range](#interval_range) and [d3.utcTuesday](#timeTuesday).[range](#interval_range). - -# d3.timeWednesdays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L26 "Source") -
# d3.utcWednesdays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L26 "Source") - -Aliases for [d3.timeWednesday](#timeWednesday).[range](#interval_range) and [d3.utcWednesday](#timeWednesday).[range](#interval_range). - -# d3.timeThursdays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L27 "Source") -
# d3.utcThursdays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L27 "Source") - -Aliases for [d3.timeThursday](#timeThursday).[range](#interval_range) and [d3.utcThursday](#timeThursday).[range](#interval_range). - -# d3.timeFridays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L28 "Source") -
# d3.utcFridays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L28 "Source") - -Aliases for [d3.timeFriday](#timeFriday).[range](#interval_range) and [d3.utcFriday](#timeFriday).[range](#interval_range). - -# d3.timeSaturdays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/week.js#L29 "Source") -
# d3.utcSaturdays(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcWeek.js#L29 "Source") - -Aliases for [d3.timeSaturday](#timeSaturday).[range](#interval_range) and [d3.utcSaturday](#timeSaturday).[range](#interval_range). - -# d3.timeMonths(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/month.js#L15 "Source") -
# d3.utcMonths(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcMonth.js#L15 "Source") - -Aliases for [d3.timeMonth](#timeMonth).[range](#interval_range) and [d3.utcMonth](#timeMonth).[range](#interval_range). - -# d3.timeYears(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/year.js#L26 "Source") -
# d3.utcYears(start, stop[, step]) [<>](https://github.com/d3/d3-time/blob/master/src/utcYear.js#L26 "Source") - -Aliases for [d3.timeYear](#timeYear).[range](#interval_range) and [d3.utcYear](#timeYear).[range](#interval_range). diff --git a/node_modules/d3-time/dist/d3-time.js b/node_modules/d3-time/dist/d3-time.js deleted file mode 100644 index 23bec18..0000000 --- a/node_modules/d3-time/dist/d3-time.js +++ /dev/null @@ -1,373 +0,0 @@ -// https://d3js.org/d3-time/ v1.1.0 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -var t0 = new Date, - t1 = new Date; - -function newInterval(floori, offseti, count, field) { - - function interval(date) { - return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date; - } - - interval.floor = function(date) { - return floori(date = new Date(+date)), date; - }; - - interval.ceil = function(date) { - return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; - }; - - interval.round = function(date) { - var d0 = interval(date), - d1 = interval.ceil(date); - return date - d0 < d1 - date ? d0 : d1; - }; - - interval.offset = function(date, step) { - return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; - }; - - interval.range = function(start, stop, step) { - var range = [], previous; - start = interval.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date - do range.push(previous = new Date(+start)), offseti(start, step), floori(start); - while (previous < start && start < stop); - return range; - }; - - interval.filter = function(test) { - return newInterval(function(date) { - if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); - }, function(date, step) { - if (date >= date) { - if (step < 0) while (++step <= 0) { - while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty - } else while (--step >= 0) { - while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty - } - } - }); - }; - - if (count) { - interval.count = function(start, end) { - t0.setTime(+start), t1.setTime(+end); - floori(t0), floori(t1); - return Math.floor(count(t0, t1)); - }; - - interval.every = function(step) { - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null - : !(step > 1) ? interval - : interval.filter(field - ? function(d) { return field(d) % step === 0; } - : function(d) { return interval.count(0, d) % step === 0; }); - }; - } - - return interval; -} - -var millisecond = 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 = function(k) { - k = 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 = millisecond.range; - -var durationSecond = 1e3; -var durationMinute = 6e4; -var durationHour = 36e5; -var durationDay = 864e5; -var durationWeek = 6048e5; - -var second = 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 = second.range; - -var minute = newInterval(function(date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond); -}, function(date, step) { - date.setTime(+date + step * durationMinute); -}, function(start, end) { - return (end - start) / durationMinute; -}, function(date) { - return date.getMinutes(); -}); -var minutes = minute.range; - -var hour = newInterval(function(date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - 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 = hour.range; - -var day = 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 = 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.getTimezoneOffset()) * durationMinute) / durationWeek; - }); -} - -var sunday = weekday(0); -var monday = weekday(1); -var tuesday = weekday(2); -var wednesday = weekday(3); -var thursday = weekday(4); -var friday = weekday(5); -var saturday = weekday(6); - -var sundays = sunday.range; -var mondays = monday.range; -var tuesdays = tuesday.range; -var wednesdays = wednesday.range; -var thursdays = thursday.range; -var fridays = friday.range; -var saturdays = saturday.range; - -var month = 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.getFullYear()) * 12; -}, function(date) { - return date.getMonth(); -}); -var months = month.range; - -var year = 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 = function(k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(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 = year.range; - -var utcMinute = 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 = utcMinute.range; - -var utcHour = 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 = utcHour.range; - -var utcDay = 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 = 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 = utcWeekday(0); -var utcMonday = utcWeekday(1); -var utcTuesday = utcWeekday(2); -var utcWednesday = utcWeekday(3); -var utcThursday = utcWeekday(4); -var utcFriday = utcWeekday(5); -var utcSaturday = utcWeekday(6); - -var utcSundays = utcSunday.range; -var utcMondays = utcMonday.range; -var utcTuesdays = utcTuesday.range; -var utcWednesdays = utcWednesday.range; -var utcThursdays = utcThursday.range; -var utcFridays = utcFriday.range; -var utcSaturdays = utcSaturday.range; - -var utcMonth = 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 = utcMonth.range; - -var utcYear = 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 = function(k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(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 = utcYear.range; - -exports.timeDay = day; -exports.timeDays = days; -exports.timeFriday = friday; -exports.timeFridays = fridays; -exports.timeHour = hour; -exports.timeHours = hours; -exports.timeInterval = newInterval; -exports.timeMillisecond = millisecond; -exports.timeMilliseconds = milliseconds; -exports.timeMinute = minute; -exports.timeMinutes = minutes; -exports.timeMonday = monday; -exports.timeMondays = mondays; -exports.timeMonth = month; -exports.timeMonths = months; -exports.timeSaturday = saturday; -exports.timeSaturdays = saturdays; -exports.timeSecond = second; -exports.timeSeconds = seconds; -exports.timeSunday = sunday; -exports.timeSundays = sundays; -exports.timeThursday = thursday; -exports.timeThursdays = thursdays; -exports.timeTuesday = tuesday; -exports.timeTuesdays = tuesdays; -exports.timeWednesday = wednesday; -exports.timeWednesdays = wednesdays; -exports.timeWeek = sunday; -exports.timeWeeks = sundays; -exports.timeYear = year; -exports.timeYears = years; -exports.utcDay = utcDay; -exports.utcDays = utcDays; -exports.utcFriday = utcFriday; -exports.utcFridays = utcFridays; -exports.utcHour = utcHour; -exports.utcHours = utcHours; -exports.utcMillisecond = millisecond; -exports.utcMilliseconds = milliseconds; -exports.utcMinute = utcMinute; -exports.utcMinutes = utcMinutes; -exports.utcMonday = utcMonday; -exports.utcMondays = utcMondays; -exports.utcMonth = utcMonth; -exports.utcMonths = utcMonths; -exports.utcSaturday = utcSaturday; -exports.utcSaturdays = utcSaturdays; -exports.utcSecond = second; -exports.utcSeconds = seconds; -exports.utcSunday = utcSunday; -exports.utcSundays = utcSundays; -exports.utcThursday = utcThursday; -exports.utcThursdays = utcThursdays; -exports.utcTuesday = utcTuesday; -exports.utcTuesdays = utcTuesdays; -exports.utcWednesday = utcWednesday; -exports.utcWednesdays = utcWednesdays; -exports.utcWeek = utcSunday; -exports.utcWeeks = utcSundays; -exports.utcYear = utcYear; -exports.utcYears = utcYears; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-time/dist/d3-time.min.js b/node_modules/d3-time/dist/d3-time.min.js deleted file mode 100644 index 77a48d5..0000000 --- a/node_modules/d3-time/dist/d3-time.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-time/ v1.1.0 Copyright 2019 Mike Bostock -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).d3=e.d3||{})}(this,function(e){"use strict";var t=new Date,n=new Date;function u(e,r,i,o){function a(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return a.floor=function(t){return e(t=new Date(+t)),t},a.ceil=function(t){return e(t=new Date(t-1)),r(t,1),e(t),t},a.round=function(e){var t=a(e),n=a.ceil(e);return e-t0))return o;do{o.push(i=new Date(+t)),r(t,u),e(t)}while(i=n)for(;e(n),!t(n);)n.setTime(n-1)},function(e,n){if(e>=e)if(n<0)for(;++n<=0;)for(;r(e,-1),!t(e););else for(;--n>=0;)for(;r(e,1),!t(e););})},i&&(a.count=function(u,r){return t.setTime(+u),n.setTime(+r),e(t),e(n),Math.floor(i(t,n))},a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?a.filter(o?function(t){return o(t)%e==0}:function(t){return a.count(0,t)%e==0}):a:null}),a}var r=u(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});r.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?u(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):r:null};var i=r.range,o=6e4,a=6048e5,s=u(function(e){e.setTime(e-e.getMilliseconds())},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3},function(e){return e.getUTCSeconds()}),c=s.range,f=u(function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},function(e,t){e.setTime(+e+t*o)},function(e,t){return(t-e)/o},function(e){return e.getMinutes()}),l=f.range,g=u(function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-e.getMinutes()*o)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getHours()}),T=g.range,d=u(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*o)/864e5},function(e){return e.getDate()-1}),m=d.range;function M(e){return u(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*o)/a})}var y=M(0),C=M(1),U=M(2),h=M(3),D=M(4),F=M(5),Y=M(6),H=y.range,S=C.range,v=U.range,w=h.range,p=D.range,W=F.range,O=Y.range,k=u(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),z=k.range,x=u(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});x.every=function(e){return isFinite(e=Math.floor(e))&&e>0?u(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)}):null};var b=x.range,j=u(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*o)},function(e,t){return(t-e)/o},function(e){return e.getUTCMinutes()}),_=j.range,I=u(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getUTCHours()}),P=I.range,q=u(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1}),A=q.range;function B(e){return u(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/a})}var E=B(0),G=B(1),J=B(2),K=B(3),L=B(4),N=B(5),Q=B(6),R=E.range,V=G.range,X=J.range,Z=K.range,$=L.range,ee=N.range,te=Q.range,ne=u(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()}),ue=ne.range,re=u(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});re.every=function(e){return isFinite(e=Math.floor(e))&&e>0?u(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null};var ie=re.range;e.timeDay=d,e.timeDays=m,e.timeFriday=F,e.timeFridays=W,e.timeHour=g,e.timeHours=T,e.timeInterval=u,e.timeMillisecond=r,e.timeMilliseconds=i,e.timeMinute=f,e.timeMinutes=l,e.timeMonday=C,e.timeMondays=S,e.timeMonth=k,e.timeMonths=z,e.timeSaturday=Y,e.timeSaturdays=O,e.timeSecond=s,e.timeSeconds=c,e.timeSunday=y,e.timeSundays=H,e.timeThursday=D,e.timeThursdays=p,e.timeTuesday=U,e.timeTuesdays=v,e.timeWednesday=h,e.timeWednesdays=w,e.timeWeek=y,e.timeWeeks=H,e.timeYear=x,e.timeYears=b,e.utcDay=q,e.utcDays=A,e.utcFriday=N,e.utcFridays=ee,e.utcHour=I,e.utcHours=P,e.utcMillisecond=r,e.utcMilliseconds=i,e.utcMinute=j,e.utcMinutes=_,e.utcMonday=G,e.utcMondays=V,e.utcMonth=ne,e.utcMonths=ue,e.utcSaturday=Q,e.utcSaturdays=te,e.utcSecond=s,e.utcSeconds=c,e.utcSunday=E,e.utcSundays=R,e.utcThursday=L,e.utcThursdays=$,e.utcTuesday=J,e.utcTuesdays=X,e.utcWednesday=K,e.utcWednesdays=Z,e.utcWeek=E,e.utcWeeks=R,e.utcYear=re,e.utcYears=ie,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/node_modules/d3-time/package.json b/node_modules/d3-time/package.json deleted file mode 100644 index 979a3cf..0000000 --- a/node_modules/d3-time/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_from": "d3-time@1", - "_id": "d3-time@1.1.0", - "_inBundle": false, - "_integrity": "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA==", - "_location": "/d3-time", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "d3-time@1", - "name": "d3-time", - "escapedName": "d3-time", - "rawSpec": "1", - "saveSpec": null, - "fetchSpec": "1" - }, - "_requiredBy": [ - "/d3-scale", - "/d3-time-format", - "/vega-time" - ], - "_resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.1.0.tgz", - "_shasum": "b1e19d307dae9c900b7e5b25ffc5dcc249a8a0f1", - "_spec": "d3-time@1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/d3-time-format", - "author": { - "name": "Mike Bostock", - "url": "http://bost.ocks.org/mike" - }, - "bugs": { - "url": "https://github.com/d3/d3-time/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A calculator for humanity’s peculiar conventions of time.", - "devDependencies": { - "eslint": "6", - "rollup": "1", - "rollup-plugin-terser": "5", - "tape": "4" - }, - "files": [ - "dist/**/*.js", - "src/**/*.js" - ], - "homepage": "https://d3js.org/d3-time/", - "jsdelivr": "dist/d3-time.min.js", - "keywords": [ - "d3", - "d3-module", - "time", - "interval", - "calendar" - ], - "license": "BSD-3-Clause", - "main": "dist/d3-time.js", - "module": "src/index.js", - "name": "d3-time", - "repository": { - "type": "git", - "url": "git+https://github.com/d3/d3-time.git" - }, - "scripts": { - "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js", - "prepublishOnly": "rm -rf dist && yarn test", - "pretest": "rollup -c", - "test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint src" - }, - "sideEffects": false, - "unpkg": "dist/d3-time.min.js", - "version": "1.1.0" -} diff --git a/node_modules/d3-time/src/day.js b/node_modules/d3-time/src/day.js deleted file mode 100644 index 8e0feec..0000000 --- a/node_modules/d3-time/src/day.js +++ /dev/null @@ -1,15 +0,0 @@ -import interval from "./interval.js"; -import {durationDay, durationMinute} from "./duration.js"; - -var day = interval(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; -}); - -export default day; -export var days = day.range; diff --git a/node_modules/d3-time/src/duration.js b/node_modules/d3-time/src/duration.js deleted file mode 100644 index fee16e7..0000000 --- a/node_modules/d3-time/src/duration.js +++ /dev/null @@ -1,5 +0,0 @@ -export var durationSecond = 1e3; -export var durationMinute = 6e4; -export var durationHour = 36e5; -export var durationDay = 864e5; -export var durationWeek = 6048e5; diff --git a/node_modules/d3-time/src/hour.js b/node_modules/d3-time/src/hour.js deleted file mode 100644 index 9b944d6..0000000 --- a/node_modules/d3-time/src/hour.js +++ /dev/null @@ -1,15 +0,0 @@ -import interval from "./interval.js"; -import {durationHour, durationMinute, durationSecond} from "./duration.js"; - -var hour = interval(function(date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute); -}, function(date, step) { - date.setTime(+date + step * durationHour); -}, function(start, end) { - return (end - start) / durationHour; -}, function(date) { - return date.getHours(); -}); - -export default hour; -export var hours = hour.range; diff --git a/node_modules/d3-time/src/index.js b/node_modules/d3-time/src/index.js deleted file mode 100644 index 354dc70..0000000 --- a/node_modules/d3-time/src/index.js +++ /dev/null @@ -1,105 +0,0 @@ -export { - default as timeInterval -} from "./interval.js"; - -export { - default as timeMillisecond, - milliseconds as timeMilliseconds, - default as utcMillisecond, - milliseconds as utcMilliseconds -} from "./millisecond.js"; - -export { - default as timeSecond, - seconds as timeSeconds, - default as utcSecond, - seconds as utcSeconds -} from "./second.js"; - -export { - default as timeMinute, - minutes as timeMinutes -} from "./minute.js"; - -export { - default as timeHour, - hours as timeHours -} from "./hour.js"; - -export { - default as timeDay, - days as timeDays -} from "./day.js"; - -export { - sunday as timeWeek, - sundays as timeWeeks, - sunday as timeSunday, - sundays as timeSundays, - monday as timeMonday, - mondays as timeMondays, - tuesday as timeTuesday, - tuesdays as timeTuesdays, - wednesday as timeWednesday, - wednesdays as timeWednesdays, - thursday as timeThursday, - thursdays as timeThursdays, - friday as timeFriday, - fridays as timeFridays, - saturday as timeSaturday, - saturdays as timeSaturdays -} from "./week.js"; - -export { - default as timeMonth, - months as timeMonths -} from "./month.js"; - -export { - default as timeYear, - years as timeYears -} from "./year.js"; - -export { - default as utcMinute, - utcMinutes as utcMinutes -} from "./utcMinute.js"; - -export { - default as utcHour, - utcHours as utcHours -} from "./utcHour.js"; - -export { - default as utcDay, - utcDays as utcDays -} from "./utcDay.js"; - -export { - utcSunday as utcWeek, - utcSundays as utcWeeks, - utcSunday as utcSunday, - utcSundays as utcSundays, - utcMonday as utcMonday, - utcMondays as utcMondays, - utcTuesday as utcTuesday, - utcTuesdays as utcTuesdays, - utcWednesday as utcWednesday, - utcWednesdays as utcWednesdays, - utcThursday as utcThursday, - utcThursdays as utcThursdays, - utcFriday as utcFriday, - utcFridays as utcFridays, - utcSaturday as utcSaturday, - utcSaturdays as utcSaturdays -} from "./utcWeek.js"; - -export { - default as utcMonth, - utcMonths as utcMonths -} from "./utcMonth.js"; - -export { - default as utcYear, - utcYears as utcYears -} from "./utcYear.js"; diff --git a/node_modules/d3-time/src/interval.js b/node_modules/d3-time/src/interval.js deleted file mode 100644 index 2714a81..0000000 --- a/node_modules/d3-time/src/interval.js +++ /dev/null @@ -1,70 +0,0 @@ -var t0 = new Date, - t1 = new Date; - -export default function newInterval(floori, offseti, count, field) { - - function interval(date) { - return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date; - } - - interval.floor = function(date) { - return floori(date = new Date(+date)), date; - }; - - interval.ceil = function(date) { - return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; - }; - - interval.round = function(date) { - var d0 = interval(date), - d1 = interval.ceil(date); - return date - d0 < d1 - date ? d0 : d1; - }; - - interval.offset = function(date, step) { - return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; - }; - - interval.range = function(start, stop, step) { - var range = [], previous; - start = interval.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date - do range.push(previous = new Date(+start)), offseti(start, step), floori(start); - while (previous < start && start < stop); - return range; - }; - - interval.filter = function(test) { - return newInterval(function(date) { - if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); - }, function(date, step) { - if (date >= date) { - if (step < 0) while (++step <= 0) { - while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty - } else while (--step >= 0) { - while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty - } - } - }); - }; - - if (count) { - interval.count = function(start, end) { - t0.setTime(+start), t1.setTime(+end); - floori(t0), floori(t1); - return Math.floor(count(t0, t1)); - }; - - interval.every = function(step) { - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null - : !(step > 1) ? interval - : interval.filter(field - ? function(d) { return field(d) % step === 0; } - : function(d) { return interval.count(0, d) % step === 0; }); - }; - } - - return interval; -} diff --git a/node_modules/d3-time/src/millisecond.js b/node_modules/d3-time/src/millisecond.js deleted file mode 100644 index d89585c..0000000 --- a/node_modules/d3-time/src/millisecond.js +++ /dev/null @@ -1,26 +0,0 @@ -import interval from "./interval.js"; - -var millisecond = interval(function() { - // noop -}, function(date, step) { - date.setTime(+date + step); -}, function(start, end) { - return end - start; -}); - -// An optimized implementation for this simple case. -millisecond.every = function(k) { - k = Math.floor(k); - if (!isFinite(k) || !(k > 0)) return null; - if (!(k > 1)) return millisecond; - return interval(function(date) { - date.setTime(Math.floor(date / k) * k); - }, function(date, step) { - date.setTime(+date + step * k); - }, function(start, end) { - return (end - start) / k; - }); -}; - -export default millisecond; -export var milliseconds = millisecond.range; diff --git a/node_modules/d3-time/src/minute.js b/node_modules/d3-time/src/minute.js deleted file mode 100644 index 2ed894b..0000000 --- a/node_modules/d3-time/src/minute.js +++ /dev/null @@ -1,15 +0,0 @@ -import interval from "./interval.js"; -import {durationMinute, durationSecond} from "./duration.js"; - -var minute = interval(function(date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond); -}, function(date, step) { - date.setTime(+date + step * durationMinute); -}, function(start, end) { - return (end - start) / durationMinute; -}, function(date) { - return date.getMinutes(); -}); - -export default minute; -export var minutes = minute.range; diff --git a/node_modules/d3-time/src/month.js b/node_modules/d3-time/src/month.js deleted file mode 100644 index ac995de..0000000 --- a/node_modules/d3-time/src/month.js +++ /dev/null @@ -1,15 +0,0 @@ -import interval from "./interval.js"; - -var month = interval(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.getFullYear()) * 12; -}, function(date) { - return date.getMonth(); -}); - -export default month; -export var months = month.range; diff --git a/node_modules/d3-time/src/second.js b/node_modules/d3-time/src/second.js deleted file mode 100644 index 62069ef..0000000 --- a/node_modules/d3-time/src/second.js +++ /dev/null @@ -1,15 +0,0 @@ -import interval from "./interval.js"; -import {durationSecond} from "./duration.js"; - -var second = interval(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(); -}); - -export default second; -export var seconds = second.range; diff --git a/node_modules/d3-time/src/utcDay.js b/node_modules/d3-time/src/utcDay.js deleted file mode 100644 index 8023be1..0000000 --- a/node_modules/d3-time/src/utcDay.js +++ /dev/null @@ -1,15 +0,0 @@ -import interval from "./interval.js"; -import {durationDay} from "./duration.js"; - -var utcDay = interval(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; -}); - -export default utcDay; -export var utcDays = utcDay.range; diff --git a/node_modules/d3-time/src/utcHour.js b/node_modules/d3-time/src/utcHour.js deleted file mode 100644 index 98b8822..0000000 --- a/node_modules/d3-time/src/utcHour.js +++ /dev/null @@ -1,15 +0,0 @@ -import interval from "./interval.js"; -import {durationHour} from "./duration.js"; - -var utcHour = interval(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(); -}); - -export default utcHour; -export var utcHours = utcHour.range; diff --git a/node_modules/d3-time/src/utcMinute.js b/node_modules/d3-time/src/utcMinute.js deleted file mode 100644 index 4e5e7e5..0000000 --- a/node_modules/d3-time/src/utcMinute.js +++ /dev/null @@ -1,15 +0,0 @@ -import interval from "./interval.js"; -import {durationMinute} from "./duration.js"; - -var utcMinute = interval(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(); -}); - -export default utcMinute; -export var utcMinutes = utcMinute.range; diff --git a/node_modules/d3-time/src/utcMonth.js b/node_modules/d3-time/src/utcMonth.js deleted file mode 100644 index 3991b18..0000000 --- a/node_modules/d3-time/src/utcMonth.js +++ /dev/null @@ -1,15 +0,0 @@ -import interval from "./interval.js"; - -var utcMonth = interval(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(); -}); - -export default utcMonth; -export var utcMonths = utcMonth.range; diff --git a/node_modules/d3-time/src/utcWeek.js b/node_modules/d3-time/src/utcWeek.js deleted file mode 100644 index e36fac8..0000000 --- a/node_modules/d3-time/src/utcWeek.js +++ /dev/null @@ -1,29 +0,0 @@ -import interval from "./interval.js"; -import {durationWeek} from "./duration.js"; - -function utcWeekday(i) { - return interval(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; - }); -} - -export var utcSunday = utcWeekday(0); -export var utcMonday = utcWeekday(1); -export var utcTuesday = utcWeekday(2); -export var utcWednesday = utcWeekday(3); -export var utcThursday = utcWeekday(4); -export var utcFriday = utcWeekday(5); -export var utcSaturday = utcWeekday(6); - -export var utcSundays = utcSunday.range; -export var utcMondays = utcMonday.range; -export var utcTuesdays = utcTuesday.range; -export var utcWednesdays = utcWednesday.range; -export var utcThursdays = utcThursday.range; -export var utcFridays = utcFriday.range; -export var utcSaturdays = utcSaturday.range; diff --git a/node_modules/d3-time/src/utcYear.js b/node_modules/d3-time/src/utcYear.js deleted file mode 100644 index ee89764..0000000 --- a/node_modules/d3-time/src/utcYear.js +++ /dev/null @@ -1,26 +0,0 @@ -import interval from "./interval.js"; - -var utcYear = interval(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 = function(k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : interval(function(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); - }); -}; - -export default utcYear; -export var utcYears = utcYear.range; diff --git a/node_modules/d3-time/src/week.js b/node_modules/d3-time/src/week.js deleted file mode 100644 index c0f1b03..0000000 --- a/node_modules/d3-time/src/week.js +++ /dev/null @@ -1,29 +0,0 @@ -import interval from "./interval.js"; -import {durationMinute, durationWeek} from "./duration.js"; - -function weekday(i) { - return interval(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.getTimezoneOffset()) * durationMinute) / durationWeek; - }); -} - -export var sunday = weekday(0); -export var monday = weekday(1); -export var tuesday = weekday(2); -export var wednesday = weekday(3); -export var thursday = weekday(4); -export var friday = weekday(5); -export var saturday = weekday(6); - -export var sundays = sunday.range; -export var mondays = monday.range; -export var tuesdays = tuesday.range; -export var wednesdays = wednesday.range; -export var thursdays = thursday.range; -export var fridays = friday.range; -export var saturdays = saturday.range; diff --git a/node_modules/d3-time/src/year.js b/node_modules/d3-time/src/year.js deleted file mode 100644 index a86872d..0000000 --- a/node_modules/d3-time/src/year.js +++ /dev/null @@ -1,26 +0,0 @@ -import interval from "./interval.js"; - -var year = interval(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 = function(k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : interval(function(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); - }); -}; - -export default year; -export var years = year.range; diff --git a/node_modules/d3-timer/LICENSE b/node_modules/d3-timer/LICENSE deleted file mode 100644 index 721bd22..0000000 --- a/node_modules/d3-timer/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike 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. - -* Neither the name of the author nor the names of contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/d3-timer/README.md b/node_modules/d3-timer/README.md deleted file mode 100644 index fee12a5..0000000 --- a/node_modules/d3-timer/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# d3-timer - -This module provides an efficient queue capable of managing thousands of concurrent animations, while guaranteeing consistent, synchronized timing with concurrent or staged animations. Internally, it uses [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) for fluid animation (if available), switching to [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout) for delays longer than 24ms. - -## Installing - -If you use NPM, `npm install d3-timer`. Otherwise, download the [latest release](https://github.com/d3/d3-timer/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-timer.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: - -```html - - -``` - -## API Reference - -# d3.now() [<>](https://github.com/d3/d3-timer/blob/master/src/timer.js#L15 "Source") - -Returns the current time as defined by [performance.now](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) if available, and [Date.now](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now) if not. The current time is updated at the start of a frame; it is thus consistent during the frame, and any timers scheduled during the same frame will be synchronized. If this method is called outside of a frame, such as in response to a user event, the current time is calculated and then fixed until the next frame, again ensuring consistent timing during event handling. - -# d3.timer(callback[, delay[, time]]) [<>](https://github.com/d3/d3-timer/blob/master/src/timer.js#L52 "Source") - -Schedules a new timer, invoking the specified *callback* repeatedly until the timer is [stopped](#timer_stop). An optional numeric *delay* in milliseconds may be specified to invoke the given *callback* after a delay; if *delay* is not specified, it defaults to zero. The delay is relative to the specified *time* in milliseconds; if *time* is not specified, it defaults to [now](#now). - -The *callback* is passed the (apparent) *elapsed* time since the timer became active. For example: - -```js -var t = d3.timer(function(elapsed) { - console.log(elapsed); - if (elapsed > 200) t.stop(); -}, 150); -``` - -This produces roughly the following console output: - -``` -3 -25 -48 -65 -85 -106 -125 -146 -167 -189 -209 -``` - -(The exact values may vary depending on your JavaScript runtime and what else your computer is doing.) Note that the first *elapsed* time is 3ms: this is the elapsed time since the timer started, not since the timer was scheduled. Here the timer started 150ms after it was scheduled due to the specified delay. The apparent *elapsed* time may be less than the true *elapsed* time if the page is backgrounded and [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) is paused; in the background, apparent time is frozen. - -If [timer](#timer) is called within the callback of another timer, the new timer callback (if eligible as determined by the specified *delay* and *time*) will be invoked immediately at the end of the current frame, rather than waiting until the next frame. Within a frame, timer callbacks are guaranteed to be invoked in the order they were scheduled, regardless of their start time. - -# timer.restart(callback[, delay[, time]]) [<>](https://github.com/d3/d3-timer/blob/master/src/timer.js#L31 "Source") - -Restart a timer with the specified *callback* and optional *delay* and *time*. This is equivalent to stopping this timer and creating a new timer with the specified arguments, although this timer retains the original invocation priority. - -# timer.stop() [<>](https://github.com/d3/d3-timer/blob/master/src/timer.js#L43 "Source") - -Stops this timer, preventing subsequent callbacks. This method has no effect if the timer has already stopped. - -# d3.timerFlush() [<>](https://github.com/d3/d3-timer/blob/master/src/timer.js#L58 "Source") - -Immediately invoke any eligible timer callbacks. Note that zero-delay timers are normally first executed after one frame (~17ms). This can cause a brief flicker because the browser renders the page twice: once at the end of the first event loop, then again immediately on the first timer callback. By flushing the timer queue at the end of the first event loop, you can run any zero-delay timers immediately and avoid the flicker. - -# d3.timeout(callback[, delay[, time]]) [<>](https://github.com/d3/d3-timer/blob/master/src/timeout.js "Source") - -Like [timer](#timer), except the timer automatically [stops](#timer_stop) on its first callback. A suitable replacement for [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout) that is guaranteed to not run in the background. The *callback* is passed the elapsed time. - -# d3.interval(callback[, delay[, time]]) [<>](https://github.com/d3/d3-timer/blob/master/src/interval.js "Source") - -Like [timer](#timer), except the *callback* is invoked only every *delay* milliseconds; if *delay* is not specified, this is equivalent to [timer](#timer). A suitable replacement for [setInterval](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval) that is guaranteed to not run in the background. The *callback* is passed the elapsed time. diff --git a/node_modules/d3-timer/dist/d3-timer.js b/node_modules/d3-timer/dist/d3-timer.js deleted file mode 100644 index 636f7e0..0000000 --- a/node_modules/d3-timer/dist/d3-timer.js +++ /dev/null @@ -1,149 +0,0 @@ -// https://d3js.org/d3-timer/ v1.0.10 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.d3 = global.d3 || {})); -}(this, function (exports) { 'use strict'; - -var frame = 0, // is an animation frame pending? - timeout = 0, // is a timeout pending? - interval = 0, // are any timers active? - pokeDelay = 1000, // how frequently we check for clock skew - taskHead, - taskTail, - clockLast = 0, - clockNow = 0, - clockSkew = 0, - clock = typeof performance === "object" && performance.now ? performance : Date, - setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); }; - -function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); -} - -function clearNow() { - clockNow = 0; -} - -function Timer() { - this._call = - this._time = - this._next = null; -} - -Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this; - else taskHead = this; - taskTail = this; - } - this._call = callback; - this._time = time; - sleep(); - }, - stop: function() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); - } - } -}; - -function timer(callback, delay, time) { - var t = new Timer; - t.restart(callback, delay, time); - return t; -} - -function timerFlush() { - now(); // Get the current time, if not already set. - ++frame; // Pretend we’ve set an alarm, if we haven’t already. - var t = taskHead, e; - while (t) { - if ((e = clockNow - t._time) >= 0) t._call.call(null, e); - t = t._next; - } - --frame; -} - -function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - try { - timerFlush(); - } finally { - frame = 0; - nap(); - clockNow = 0; - } -} - -function poke() { - var now = clock.now(), delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; -} - -function nap() { - var t0, t1 = taskHead, t2, time = Infinity; - while (t1) { - if (t1._call) { - if (time > t1._time) time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } - } - taskTail = t0; - sleep(time); -} - -function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - if (timeout) timeout = clearTimeout(timeout); - var delay = time - clockNow; // Strictly less than if we recomputed clockNow. - if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); - } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); - } -} - -function timeout$1(callback, delay, time) { - var t = new Timer; - delay = delay == null ? 0 : +delay; - t.restart(function(elapsed) { - t.stop(); - callback(elapsed + delay); - }, delay, time); - return t; -} - -function interval$1(callback, delay, time) { - var t = new Timer, total = delay; - if (delay == null) return t.restart(callback, delay, time), t; - delay = +delay, time = time == null ? now() : +time; - t.restart(function tick(elapsed) { - elapsed += total; - t.restart(tick, total += delay, time); - callback(elapsed); - }, delay, time); - return t; -} - -exports.interval = interval$1; -exports.now = now; -exports.timeout = timeout$1; -exports.timer = timer; -exports.timerFlush = timerFlush; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/d3-timer/dist/d3-timer.min.js b/node_modules/d3-timer/dist/d3-timer.min.js deleted file mode 100644 index 627d365..0000000 --- a/node_modules/d3-timer/dist/d3-timer.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://d3js.org/d3-timer/ v1.0.10 Copyright 2019 Mike Bostock -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";var n,e,o=0,i=0,r=0,u=1e3,l=0,c=0,f=0,a="object"==typeof performance&&performance.now?performance:Date,s="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function _(){return c||(s(m),c=a.now()+f)}function m(){c=0}function p(){this._call=this._time=this._next=null}function w(t,n,e){var o=new p;return o.restart(t,n,e),o}function d(){_(),++o;for(var t,e=n;e;)(t=c-e._time)>=0&&e._call.call(null,t),e=e._next;--o}function h(){c=(l=a.now())+f,o=i=0;try{d()}finally{o=0,function(){var t,o,i=n,r=1/0;for(;i;)i._call?(r>i._time&&(r=i._time),t=i,i=i._next):(o=i._next,i._next=null,i=t?t._next=o:n=o);e=t,v(r)}(),c=0}}function y(){var t=a.now(),n=t-l;n>u&&(f-=n,l=t)}function v(t){o||(i&&(i=clearTimeout(i)),t-c>24?(t<1/0&&(i=setTimeout(h,t-a.now()-f)),r&&(r=clearInterval(r))):(r||(l=a.now(),r=setInterval(y,u)),o=1,s(h)))}p.prototype=w.prototype={constructor:p,restart:function(t,o,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?_():+i)+(null==o?0:+o),this._next||e===this||(e?e._next=this:n=this,e=this),this._call=t,this._time=i,v()},stop:function(){this._call&&(this._call=null,this._time=1/0,v())}},t.interval=function(t,n,e){var o=new p,i=n;return null==n?(o.restart(t,n,e),o):(n=+n,e=null==e?_():+e,o.restart(function r(u){u+=i,o.restart(r,i+=n,e),t(u)},n,e),o)},t.now=_,t.timeout=function(t,n,e){var o=new p;return n=null==n?0:+n,o.restart(function(e){o.stop(),t(e+n)},n,e),o},t.timer=w,t.timerFlush=d,Object.defineProperty(t,"__esModule",{value:!0})}); diff --git a/node_modules/d3-timer/package.json b/node_modules/d3-timer/package.json deleted file mode 100644 index 1e92fe7..0000000 --- a/node_modules/d3-timer/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "d3-timer@1", - "_id": "d3-timer@1.0.10", - "_inBundle": false, - "_integrity": "sha512-B1JDm0XDaQC+uvo4DT79H0XmBskgS3l6Ve+1SBCfxgmtIb1AVrPIoqd+nPSv+loMX8szQ0sVUhGngL7D5QPiXw==", - "_location": "/d3-timer", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "d3-timer@1", - "name": "d3-timer", - "escapedName": "d3-timer", - "rawSpec": "1", - "saveSpec": null, - "fetchSpec": "1" - }, - "_requiredBy": [ - "/d3-force", - "/vega-view" - ], - "_resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-1.0.10.tgz", - "_shasum": "dfe76b8a91748831b13b6d9c793ffbd508dd9de5", - "_spec": "d3-timer@1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/d3-force", - "author": { - "name": "Mike Bostock", - "url": "http://bost.ocks.org/mike" - }, - "bugs": { - "url": "https://github.com/d3/d3-timer/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "An efficient queue capable of managing thousands of concurrent animations.", - "devDependencies": { - "eslint": "6", - "rollup": "1", - "rollup-plugin-terser": "5", - "tape": "4" - }, - "files": [ - "dist/**/*.js", - "src/**/*.js" - ], - "homepage": "https://d3js.org/d3-timer/", - "jsdelivr": "dist/d3-timer.min.js", - "keywords": [ - "d3", - "d3-module", - "timer", - "transition", - "animation", - "requestAnimationFrame", - "setTimeout", - "setInterval" - ], - "license": "BSD-3-Clause", - "main": "dist/d3-timer.js", - "module": "src/index.js", - "name": "d3-timer", - "repository": { - "type": "git", - "url": "git+https://github.com/d3/d3-timer.git" - }, - "scripts": { - "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js", - "prepublishOnly": "rm -rf dist && yarn test", - "pretest": "rollup -c", - "test": "tape 'test/**/*-test.js' && eslint src" - }, - "sideEffects": false, - "unpkg": "dist/d3-timer.min.js", - "version": "1.0.10" -} diff --git a/node_modules/d3-timer/src/index.js b/node_modules/d3-timer/src/index.js deleted file mode 100644 index 66fb8c9..0000000 --- a/node_modules/d3-timer/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -export { - now, - timer, - timerFlush -} from "./timer.js"; - -export { - default as timeout -} from "./timeout.js"; - -export { - default as interval -} from "./interval.js"; diff --git a/node_modules/d3-timer/src/interval.js b/node_modules/d3-timer/src/interval.js deleted file mode 100644 index b523538..0000000 --- a/node_modules/d3-timer/src/interval.js +++ /dev/null @@ -1,13 +0,0 @@ -import {Timer, now} from "./timer.js"; - -export default function(callback, delay, time) { - var t = new Timer, total = delay; - if (delay == null) return t.restart(callback, delay, time), t; - delay = +delay, time = time == null ? now() : +time; - t.restart(function tick(elapsed) { - elapsed += total; - t.restart(tick, total += delay, time); - callback(elapsed); - }, delay, time); - return t; -} diff --git a/node_modules/d3-timer/src/timeout.js b/node_modules/d3-timer/src/timeout.js deleted file mode 100644 index 62400cf..0000000 --- a/node_modules/d3-timer/src/timeout.js +++ /dev/null @@ -1,11 +0,0 @@ -import {Timer} from "./timer.js"; - -export default function(callback, delay, time) { - var t = new Timer; - delay = delay == null ? 0 : +delay; - t.restart(function(elapsed) { - t.stop(); - callback(elapsed + delay); - }, delay, time); - return t; -} diff --git a/node_modules/d3-timer/src/timer.js b/node_modules/d3-timer/src/timer.js deleted file mode 100644 index 7db3564..0000000 --- a/node_modules/d3-timer/src/timer.js +++ /dev/null @@ -1,110 +0,0 @@ -var frame = 0, // is an animation frame pending? - timeout = 0, // is a timeout pending? - interval = 0, // are any timers active? - pokeDelay = 1000, // how frequently we check for clock skew - taskHead, - taskTail, - clockLast = 0, - clockNow = 0, - clockSkew = 0, - clock = typeof performance === "object" && performance.now ? performance : Date, - setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); }; - -export function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); -} - -function clearNow() { - clockNow = 0; -} - -export function Timer() { - this._call = - this._time = - this._next = null; -} - -Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this; - else taskHead = this; - taskTail = this; - } - this._call = callback; - this._time = time; - sleep(); - }, - stop: function() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); - } - } -}; - -export function timer(callback, delay, time) { - var t = new Timer; - t.restart(callback, delay, time); - return t; -} - -export function timerFlush() { - now(); // Get the current time, if not already set. - ++frame; // Pretend we’ve set an alarm, if we haven’t already. - var t = taskHead, e; - while (t) { - if ((e = clockNow - t._time) >= 0) t._call.call(null, e); - t = t._next; - } - --frame; -} - -function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - try { - timerFlush(); - } finally { - frame = 0; - nap(); - clockNow = 0; - } -} - -function poke() { - var now = clock.now(), delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; -} - -function nap() { - var t0, t1 = taskHead, t2, time = Infinity; - while (t1) { - if (t1._call) { - if (time > t1._time) time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } - } - taskTail = t0; - sleep(time); -} - -function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - if (timeout) timeout = clearTimeout(timeout); - var delay = time - clockNow; // Strictly less than if we recomputed clockNow. - if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); - } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); - } -} diff --git a/node_modules/debug/CHANGELOG.md b/node_modules/debug/CHANGELOG.md deleted file mode 100644 index 820d21e..0000000 --- a/node_modules/debug/CHANGELOG.md +++ /dev/null @@ -1,395 +0,0 @@ - -3.1.0 / 2017-09-26 -================== - - * Add `DEBUG_HIDE_DATE` env var (#486) - * Remove ReDoS regexp in %o formatter (#504) - * Remove "component" from package.json - * Remove `component.json` - * Ignore package-lock.json - * Examples: fix colors printout - * Fix: browser detection - * Fix: spelling mistake (#496, @EdwardBetts) - -3.0.1 / 2017-08-24 -================== - - * Fix: Disable colors in Edge and Internet Explorer (#489) - -3.0.0 / 2017-08-08 -================== - - * Breaking: Remove DEBUG_FD (#406) - * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) - * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) - * Addition: document `enabled` flag (#465) - * Addition: add 256 colors mode (#481) - * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) - * Update: component: update "ms" to v2.0.0 - * Update: separate the Node and Browser tests in Travis-CI - * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots - * Update: separate Node.js and web browser examples for organization - * Update: update "browserify" to v14.4.0 - * Fix: fix Readme typo (#473) - -2.6.9 / 2017-09-22 -================== - - * remove ReDoS regexp in %o formatter (#504) - -2.6.8 / 2017-05-18 -================== - - * Fix: Check for undefined on browser globals (#462, @marbemac) - -2.6.7 / 2017-05-16 -================== - - * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) - * Fix: Inline extend function in node implementation (#452, @dougwilson) - * Docs: Fix typo (#455, @msasad) - -2.6.5 / 2017-04-27 -================== - - * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) - * Misc: clean up browser reference checks (#447, @thebigredgeek) - * Misc: add npm-debug.log to .gitignore (@thebigredgeek) - - -2.6.4 / 2017-04-20 -================== - - * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) - * Chore: ignore bower.json in npm installations. (#437, @joaovieira) - * Misc: update "ms" to v0.7.3 (@tootallnate) - -2.6.3 / 2017-03-13 -================== - - * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) - * Docs: Changelog fix (@thebigredgeek) - -2.6.2 / 2017-03-10 -================== - - * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) - * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) - * Docs: Add Slackin invite badge (@tootallnate) - -2.6.1 / 2017-02-10 -================== - - * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error - * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) - * Fix: IE8 "Expected identifier" error (#414, @vgoma) - * Fix: Namespaces would not disable once enabled (#409, @musikov) - -2.6.0 / 2016-12-28 -================== - - * Fix: added better null pointer checks for browser useColors (@thebigredgeek) - * Improvement: removed explicit `window.debug` export (#404, @tootallnate) - * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) - -2.5.2 / 2016-12-25 -================== - - * Fix: reference error on window within webworkers (#393, @KlausTrainer) - * Docs: fixed README typo (#391, @lurch) - * Docs: added notice about v3 api discussion (@thebigredgeek) - -2.5.1 / 2016-12-20 -================== - - * Fix: babel-core compatibility - -2.5.0 / 2016-12-20 -================== - - * Fix: wrong reference in bower file (@thebigredgeek) - * Fix: webworker compatibility (@thebigredgeek) - * Fix: output formatting issue (#388, @kribblo) - * Fix: babel-loader compatibility (#383, @escwald) - * Misc: removed built asset from repo and publications (@thebigredgeek) - * Misc: moved source files to /src (#378, @yamikuronue) - * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) - * Test: coveralls integration (#378, @yamikuronue) - * Docs: simplified language in the opening paragraph (#373, @yamikuronue) - -2.4.5 / 2016-12-17 -================== - - * Fix: `navigator` undefined in Rhino (#376, @jochenberger) - * Fix: custom log function (#379, @hsiliev) - * Improvement: bit of cleanup + linting fixes (@thebigredgeek) - * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) - * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) - -2.4.4 / 2016-12-14 -================== - - * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) - -2.4.3 / 2016-12-14 -================== - - * Fix: navigation.userAgent error for react native (#364, @escwald) - -2.4.2 / 2016-12-14 -================== - - * Fix: browser colors (#367, @tootallnate) - * Misc: travis ci integration (@thebigredgeek) - * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) - -2.4.1 / 2016-12-13 -================== - - * Fix: typo that broke the package (#356) - -2.4.0 / 2016-12-13 -================== - - * Fix: bower.json references unbuilt src entry point (#342, @justmatt) - * Fix: revert "handle regex special characters" (@tootallnate) - * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) - * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) - * Improvement: allow colors in workers (#335, @botverse) - * Improvement: use same color for same namespace. (#338, @lchenay) - -2.3.3 / 2016-11-09 -================== - - * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) - * Fix: Returning `localStorage` saved values (#331, Levi Thomason) - * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) - -2.3.2 / 2016-11-09 -================== - - * Fix: be super-safe in index.js as well (@TooTallNate) - * Fix: should check whether process exists (Tom Newby) - -2.3.1 / 2016-11-09 -================== - - * Fix: Added electron compatibility (#324, @paulcbetts) - * Improvement: Added performance optimizations (@tootallnate) - * Readme: Corrected PowerShell environment variable example (#252, @gimre) - * Misc: Removed yarn lock file from source control (#321, @fengmk2) - -2.3.0 / 2016-11-07 -================== - - * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) - * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) - * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) - * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) - * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) - * Package: Update "ms" to 0.7.2 (#315, @DevSide) - * Package: removed superfluous version property from bower.json (#207 @kkirsche) - * Readme: fix USE_COLORS to DEBUG_COLORS - * Readme: Doc fixes for format string sugar (#269, @mlucool) - * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) - * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) - * Readme: better docs for browser support (#224, @matthewmueller) - * Tooling: Added yarn integration for development (#317, @thebigredgeek) - * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) - * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) - * Misc: Updated contributors (@thebigredgeek) - -2.2.0 / 2015-05-09 -================== - - * package: update "ms" to v0.7.1 (#202, @dougwilson) - * README: add logging to file example (#193, @DanielOchoa) - * README: fixed a typo (#191, @amir-s) - * browser: expose `storage` (#190, @stephenmathieson) - * Makefile: add a `distclean` target (#189, @stephenmathieson) - -2.1.3 / 2015-03-13 -================== - - * Updated stdout/stderr example (#186) - * Updated example/stdout.js to match debug current behaviour - * Renamed example/stderr.js to stdout.js - * Update Readme.md (#184) - * replace high intensity foreground color for bold (#182, #183) - -2.1.2 / 2015-03-01 -================== - - * dist: recompile - * update "ms" to v0.7.0 - * package: update "browserify" to v9.0.3 - * component: fix "ms.js" repo location - * changed bower package name - * updated documentation about using debug in a browser - * fix: security error on safari (#167, #168, @yields) - -2.1.1 / 2014-12-29 -================== - - * browser: use `typeof` to check for `console` existence - * browser: check for `console.log` truthiness (fix IE 8/9) - * browser: add support for Chrome apps - * Readme: added Windows usage remarks - * Add `bower.json` to properly support bower install - -2.1.0 / 2014-10-15 -================== - - * node: implement `DEBUG_FD` env variable support - * package: update "browserify" to v6.1.0 - * package: add "license" field to package.json (#135, @panuhorsmalahti) - -2.0.0 / 2014-09-01 -================== - - * package: update "browserify" to v5.11.0 - * node: use stderr rather than stdout for logging (#29, @stephenmathieson) - -1.0.4 / 2014-07-15 -================== - - * dist: recompile - * example: remove `console.info()` log usage - * example: add "Content-Type" UTF-8 header to browser example - * browser: place %c marker after the space character - * browser: reset the "content" color via `color: inherit` - * browser: add colors support for Firefox >= v31 - * debug: prefer an instance `log()` function over the global one (#119) - * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) - -1.0.3 / 2014-07-09 -================== - - * Add support for multiple wildcards in namespaces (#122, @seegno) - * browser: fix lint - -1.0.2 / 2014-06-10 -================== - - * browser: update color palette (#113, @gscottolson) - * common: make console logging function configurable (#108, @timoxley) - * node: fix %o colors on old node <= 0.8.x - * Makefile: find node path using shell/which (#109, @timoxley) - -1.0.1 / 2014-06-06 -================== - - * browser: use `removeItem()` to clear localStorage - * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) - * package: add "contributors" section - * node: fix comment typo - * README: list authors - -1.0.0 / 2014-06-04 -================== - - * make ms diff be global, not be scope - * debug: ignore empty strings in enable() - * node: make DEBUG_COLORS able to disable coloring - * *: export the `colors` array - * npmignore: don't publish the `dist` dir - * Makefile: refactor to use browserify - * package: add "browserify" as a dev dependency - * Readme: add Web Inspector Colors section - * node: reset terminal color for the debug content - * node: map "%o" to `util.inspect()` - * browser: map "%j" to `JSON.stringify()` - * debug: add custom "formatters" - * debug: use "ms" module for humanizing the diff - * Readme: add "bash" syntax highlighting - * browser: add Firebug color support - * browser: add colors for WebKit browsers - * node: apply log to `console` - * rewrite: abstract common logic for Node & browsers - * add .jshintrc file - -0.8.1 / 2014-04-14 -================== - - * package: re-add the "component" section - -0.8.0 / 2014-03-30 -================== - - * add `enable()` method for nodejs. Closes #27 - * change from stderr to stdout - * remove unnecessary index.js file - -0.7.4 / 2013-11-13 -================== - - * remove "browserify" key from package.json (fixes something in browserify) - -0.7.3 / 2013-10-30 -================== - - * fix: catch localStorage security error when cookies are blocked (Chrome) - * add debug(err) support. Closes #46 - * add .browser prop to package.json. Closes #42 - -0.7.2 / 2013-02-06 -================== - - * fix package.json - * fix: Mobile Safari (private mode) is broken with debug - * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript - -0.7.1 / 2013-02-05 -================== - - * add repository URL to package.json - * add DEBUG_COLORED to force colored output - * add browserify support - * fix component. Closes #24 - -0.7.0 / 2012-05-04 -================== - - * Added .component to package.json - * Added debug.component.js build - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/debug/LICENSE b/node_modules/debug/LICENSE deleted file mode 100644 index 658c933..0000000 --- a/node_modules/debug/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the 'Software'), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/node_modules/debug/README.md b/node_modules/debug/README.md deleted file mode 100644 index 0ee7634..0000000 --- a/node_modules/debug/README.md +++ /dev/null @@ -1,437 +0,0 @@ -# debug -[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) -[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) - - - -A tiny JavaScript debugging utility modelled after Node.js core's debugging -technique. Works in Node.js and web browsers. - -## Installation - -```bash -$ npm install debug -``` - -## Usage - -`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. - -Example [_app.js_](./examples/node/app.js): - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %o', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example [_worker.js_](./examples/node/worker.js): - -```js -var a = require('debug')('worker:a') - , b = require('debug')('worker:b'); - -function work() { - a('doing lots of uninteresting work'); - setTimeout(work, Math.random() * 1000); -} - -work(); - -function workb() { - b('doing some work'); - setTimeout(workb, Math.random() * 2000); -} - -workb(); -``` - -The `DEBUG` environment variable is then used to enable these based on space or -comma-delimited names. - -Here are some examples: - -screen shot 2017-08-08 at 12 53 04 pm -screen shot 2017-08-08 at 12 53 38 pm -screen shot 2017-08-08 at 12 53 25 pm - -#### Windows command prompt notes - -##### CMD - -On Windows the environment variable is set using the `set` command. - -```cmd -set DEBUG=*,-not_this -``` - -Example: - -```cmd -set DEBUG=* & node app.js -``` - -##### PowerShell (VS Code default) - -PowerShell uses different syntax to set environment variables. - -```cmd -$env:DEBUG = "*,-not_this" -``` - -Example: - -```cmd -$env:DEBUG='app';node app.js -``` - -Then, run the program to be debugged as usual. - -npm script example: -```js - "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", -``` - -## Namespace Colors - -Every debug instance has a color generated for it based on its namespace name. -This helps when visually parsing the debug output to identify which debug instance -a debug line belongs to. - -#### Node.js - -In Node.js, colors are enabled when stderr is a TTY. You also _should_ install -the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, -otherwise debug will only use a small handful of basic colors. - - - -#### Web Browser - -Colors are also enabled on "Web Inspectors" that understand the `%c` formatting -option. These are WebKit web inspectors, Firefox ([since version -31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) -and the Firebug plugin for Firefox (any version). - - - - -## Millisecond diff - -When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - - -When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: - - - - -## Conventions - -If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. - -## Wildcards - -The `*` character may be used as a wildcard. Suppose for example your library has -debuggers named "connect:bodyParser", "connect:compress", "connect:session", -instead of listing all three with -`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do -`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - -You can also exclude specific debuggers by prefixing them with a "-" character. -For example, `DEBUG=*,-connect:*` would include all debuggers except those -starting with "connect:". - -## Environment Variables - -When running through Node.js, you can set a few environment variables that will -change the behavior of the debug logging: - -| Name | Purpose | -|-----------|-------------------------------------------------| -| `DEBUG` | Enables/disables specific debugging namespaces. | -| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | -| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | -| `DEBUG_DEPTH` | Object inspection depth. | -| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | - - -__Note:__ The environment variables beginning with `DEBUG_` end up being -converted into an Options object that gets used with `%o`/`%O` formatters. -See the Node.js documentation for -[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) -for the complete list. - -## Formatters - -Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. -Below are the officially supported formatters: - -| Formatter | Representation | -|-----------|----------------| -| `%O` | Pretty-print an Object on multiple lines. | -| `%o` | Pretty-print an Object all on a single line. | -| `%s` | String. | -| `%d` | Number (both integer and float). | -| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | -| `%%` | Single percent sign ('%'). This does not consume an argument. | - - -### Custom formatters - -You can add custom formatters by extending the `debug.formatters` object. -For example, if you wanted to add support for rendering a Buffer as hex with -`%h`, you could do something like: - -```js -const createDebug = require('debug') -createDebug.formatters.h = (v) => { - return v.toString('hex') -} - -// …elsewhere -const debug = createDebug('foo') -debug('this is hex: %h', new Buffer('hello world')) -// foo this is hex: 68656c6c6f20776f726c6421 +0ms -``` - - -## Browser Support - -You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), -or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), -if you don't want to build it yourself. - -Debug's enable state is currently persisted by `localStorage`. -Consider the situation shown below where you have `worker:a` and `worker:b`, -and wish to debug both. You can enable this using `localStorage.debug`: - -```js -localStorage.debug = 'worker:*' -``` - -And then refresh the page. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - - -## Output streams - - By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: - -Example [_stdout.js_](./examples/node/stdout.js): - -```js -var debug = require('debug'); -var error = debug('app:error'); - -// by default stderr is used -error('goes to stderr!'); - -var log = debug('app:log'); -// set this namespace to log via console.log -log.log = console.log.bind(console); // don't forget to bind to console! -log('goes to stdout'); -error('still goes to stderr!'); - -// set all output to go via console.info -// overrides all per-namespace log settings -debug.log = console.info.bind(console); -error('now goes to stdout via console.info'); -log('still goes to stdout, but via console.info now'); -``` - -## Extend -You can simply extend debugger -```js -const log = require('debug')('auth'); - -//creates new debug instance with extended namespace -const logSign = log.extend('sign'); -const logLogin = log.extend('login'); - -log('hello'); // auth hello -logSign('hello'); //auth:sign hello -logLogin('hello'); //auth:login hello -``` - -## Set dynamically - -You can also enable debug dynamically by calling the `enable()` method : - -```js -let debug = require('debug'); - -console.log(1, debug.enabled('test')); - -debug.enable('test'); -console.log(2, debug.enabled('test')); - -debug.disable(); -console.log(3, debug.enabled('test')); - -``` - -print : -``` -1 false -2 true -3 false -``` - -Usage : -`enable(namespaces)` -`namespaces` can include modes separated by a colon and wildcards. - -Note that calling `enable()` completely overrides previously set DEBUG variable : - -``` -$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' -=> false -``` - -## Checking whether a debug target is enabled - -After you've created a debug instance, you can determine whether or not it is -enabled by checking the `enabled` property: - -```javascript -const debug = require('debug')('http'); - -if (debug.enabled) { - // do stuff... -} -``` - -You can also manually toggle this property to force the debug instance to be -enabled or disabled. - - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - - Andrew Rhyne - -## Backers - -Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## Sponsors - -Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## License - -(The MIT License) - -Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/debug/dist/debug.js b/node_modules/debug/dist/debug.js deleted file mode 100644 index f271e01..0000000 --- a/node_modules/debug/dist/debug.js +++ /dev/null @@ -1,886 +0,0 @@ -"use strict"; - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -(function (f) { - if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") { - module.exports = f(); - } else if (typeof define === "function" && define.amd) { - define([], f); - } else { - var g; - - if (typeof window !== "undefined") { - g = window; - } else if (typeof global !== "undefined") { - g = global; - } else if (typeof self !== "undefined") { - g = self; - } else { - g = this; - } - - g.debug = f(); - } -})(function () { - var define, module, exports; - return function () { - function r(e, n, t) { - function o(i, f) { - if (!n[i]) { - if (!e[i]) { - var c = "function" == typeof require && require; - if (!f && c) return c(i, !0); - if (u) return u(i, !0); - var a = new Error("Cannot find module '" + i + "'"); - throw a.code = "MODULE_NOT_FOUND", a; - } - - var p = n[i] = { - exports: {} - }; - e[i][0].call(p.exports, function (r) { - var n = e[i][1][r]; - return o(n || r); - }, p, p.exports, r, e, n, t); - } - - return n[i].exports; - } - - for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { - o(t[i]); - } - - return o; - } - - return r; - }()({ - 1: [function (require, module, exports) { - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var w = d * 7; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - - module.exports = function (val, options) { - options = options || {}; - - var type = _typeof(val); - - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isNaN(val) === false) { - return options.long ? fmtLong(val) : fmtShort(val); - } - - throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); - }; - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - - - function parse(str) { - str = String(str); - - if (str.length > 100) { - return; - } - - var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); - - if (!match) { - return; - } - - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - - case 'weeks': - case 'week': - case 'w': - return n * w; - - case 'days': - case 'day': - case 'd': - return n * d; - - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - - default: - return undefined; - } - } - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function fmtShort(ms) { - var msAbs = Math.abs(ms); - - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - - return ms + 'ms'; - } - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function fmtLong(ms) { - var msAbs = Math.abs(ms); - - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - - return ms + ' ms'; - } - /** - * Pluralization helper. - */ - - - function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); - } - }, {}], - 2: [function (require, module, exports) { - // shim for using process in browser - var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. - - var cachedSetTimeout; - var cachedClearTimeout; - - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - - function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); - } - - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - })(); - - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } // if setTimeout wasn't available but was latter defined - - - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - } - - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } // if clearTimeout wasn't available but was latter defined - - - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - } - - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - - draining = false; - - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - - if (queue.length) { - drainQueue(); - } - } - - function drainQueue() { - if (draining) { - return; - } - - var timeout = runTimeout(cleanUpNextTick); - draining = true; - var len = queue.length; - - while (len) { - currentQueue = queue; - queue = []; - - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - - queueIndex = -1; - len = queue.length; - } - - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - - queue.push(new Item(fun, args)); - - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; // v8 likes predictible objects - - - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - - process.versions = {}; - - function noop() {} - - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - - process.listeners = function (name) { - return []; - }; - - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - - process.cwd = function () { - return '/'; - }; - - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - - process.umask = function () { - return 0; - }; - }, {}], - 3: [function (require, module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ - function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require('ms'); - Object.keys(env).forEach(function (key) { - createDebug[key] = env[key]; - }); - /** - * Active `debug` instances. - */ - - createDebug.instances = []; - /** - * The currently active debug mode names, and names to skip. - */ - - createDebug.names = []; - createDebug.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - - createDebug.formatters = {}; - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - - function selectColor(namespace) { - var hash = 0; - - for (var i = 0; i < namespace.length; i++) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - - createDebug.selectColor = selectColor; - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - - function createDebug(namespace) { - var prevTime; - - function debug() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - // Disabled? - if (!debug.enabled) { - return; - } - - var self = debug; // Set `diff` timestamp - - var curr = Number(new Date()); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - args[0] = createDebug.coerce(args[0]); - - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } // Apply any `formatters` transformations - - - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return match; - } - - index++; - var formatter = createDebug.formatters[format]; - - if (typeof formatter === 'function') { - var val = args[index]; - match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` - - args.splice(index, 1); - index--; - } - - return match; - }); // Apply env-specific formatting (colors, etc.) - - createDebug.formatArgs.call(self, args); - var logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); - debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; - debug.extend = extend; // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; - // env-specific initialization logic for debug instances - - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } - - createDebug.instances.push(debug); - return debug; - } - - function destroy() { - var index = createDebug.instances.indexOf(this); - - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - - return false; - } - - function extend(namespace, delimiter) { - return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - } - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - - - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.names = []; - createDebug.skips = []; - var i; - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - - for (i = 0; i < createDebug.instances.length; i++) { - var instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } - } - /** - * Disable debug output. - * - * @api public - */ - - - function disable() { - createDebug.enable(''); - } - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - - - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - - var i; - var len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - - return false; - } - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - - - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - - return val; - } - - createDebug.enable(createDebug.load()); - return createDebug; - } - - module.exports = setup; - }, { - "ms": 1 - }], - 4: [function (require, module, exports) { - (function (process) { - /* eslint-env browser */ - - /** - * This is the web browser implementation of `debug()`. - */ - exports.log = log; - exports.formatArgs = formatArgs; - exports.save = save; - exports.load = load; - exports.useColors = useColors; - exports.storage = localstorage(); - /** - * Colors. - */ - - exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; - /** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - // eslint-disable-next-line complexity - - function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } // Internet Explorer and Edge do not support colors. - - - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - - - return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 - typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); - } - /** - * Colorize log arguments if enabled. - * - * @api public - */ - - - function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); - - if (!this.useColors) { - return; - } - - var c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function (match) { - if (match === '%%') { - return; - } - - index++; - - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - args.splice(lastC, 0, c); - } - /** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - - - function log() { - var _console; - - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); - } - /** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - - - function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } - } - /** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - - - function load() { - var r; - - try { - r = exports.storage.getItem('debug'); - } catch (error) {} // Swallow - // XXX (@Qix-) should we be logging these? - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - - - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; - } - /** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - - - function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } - } - - module.exports = require('./common')(exports); - var formatters = module.exports.formatters; - /** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - - formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } - }; - }).call(this, require('_process')); - }, { - "./common": 3, - "_process": 2 - }] - }, {}, [4])(4); -}); - diff --git a/node_modules/debug/node.js b/node_modules/debug/node.js deleted file mode 100644 index 7fc36fe..0000000 --- a/node_modules/debug/node.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./src/node'); diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json deleted file mode 100644 index f462ce3..0000000 --- a/node_modules/debug/package.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "_from": "debug@^3.2.6", - "_id": "debug@3.2.6", - "_inBundle": false, - "_integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "_location": "/debug", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "debug@^3.2.6", - "name": "debug", - "escapedName": "debug", - "rawSpec": "^3.2.6", - "saveSpec": null, - "fetchSpec": "^3.2.6" - }, - "_requiredBy": [ - "/needle" - ], - "_resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "_shasum": "e83d17de16d8a7efb7717edbe5fb10135eee629b", - "_spec": "debug@^3.2.6", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/needle", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "browser": "./src/browser.js", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io" - }, - { - "name": "Andrew Rhyne", - "email": "rhyneandrew@gmail.com" - } - ], - "dependencies": { - "ms": "^2.1.1" - }, - "deprecated": false, - "description": "small debugging utility", - "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "browserify": "14.4.0", - "chai": "^3.5.0", - "concurrently": "^3.1.0", - "coveralls": "^3.0.2", - "istanbul": "^0.4.5", - "karma": "^3.0.0", - "karma-chai": "^0.1.0", - "karma-mocha": "^1.3.0", - "karma-phantomjs-launcher": "^1.0.2", - "mocha": "^5.2.0", - "mocha-lcov-reporter": "^1.2.0", - "rimraf": "^2.5.4", - "xo": "^0.23.0" - }, - "files": [ - "src", - "node.js", - "dist/debug.js", - "LICENSE", - "README.md" - ], - "homepage": "https://github.com/visionmedia/debug#readme", - "keywords": [ - "debug", - "log", - "debugger" - ], - "license": "MIT", - "main": "./src/index.js", - "name": "debug", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "unpkg": "./dist/debug.js", - "version": "3.2.6" -} diff --git a/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js deleted file mode 100644 index c924b0a..0000000 --- a/node_modules/debug/src/browser.js +++ /dev/null @@ -1,180 +0,0 @@ -"use strict"; - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -/* eslint-env browser */ - -/** - * This is the web browser implementation of `debug()`. - */ -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = localstorage(); -/** - * Colors. - */ - -exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ -// eslint-disable-next-line complexity - -function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } // Internet Explorer and Edge do not support colors. - - - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - - - return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 - typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); -} -/** - * Colorize log arguments if enabled. - * - * @api public - */ - - -function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); - - if (!this.useColors) { - return; - } - - var c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function (match) { - if (match === '%%') { - return; - } - - index++; - - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - args.splice(lastC, 0, c); -} -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - - -function log() { - var _console; - - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); -} -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - - -function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } -} -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - - -function load() { - var r; - - try { - r = exports.storage.getItem('debug'); - } catch (error) {} // Swallow - // XXX (@Qix-) should we be logging these? - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - - - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; -} -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - - -function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } -} - -module.exports = require('./common')(exports); -var formatters = module.exports.formatters; -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } -}; - diff --git a/node_modules/debug/src/common.js b/node_modules/debug/src/common.js deleted file mode 100644 index e0de3fb..0000000 --- a/node_modules/debug/src/common.js +++ /dev/null @@ -1,249 +0,0 @@ -"use strict"; - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ -function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require('ms'); - Object.keys(env).forEach(function (key) { - createDebug[key] = env[key]; - }); - /** - * Active `debug` instances. - */ - - createDebug.instances = []; - /** - * The currently active debug mode names, and names to skip. - */ - - createDebug.names = []; - createDebug.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - - createDebug.formatters = {}; - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - - function selectColor(namespace) { - var hash = 0; - - for (var i = 0; i < namespace.length; i++) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - - createDebug.selectColor = selectColor; - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - - function createDebug(namespace) { - var prevTime; - - function debug() { - // Disabled? - if (!debug.enabled) { - return; - } - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var self = debug; // Set `diff` timestamp - - var curr = Number(new Date()); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - args[0] = createDebug.coerce(args[0]); - - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } // Apply any `formatters` transformations - - - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return match; - } - - index++; - var formatter = createDebug.formatters[format]; - - if (typeof formatter === 'function') { - var val = args[index]; - match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` - - args.splice(index, 1); - index--; - } - - return match; - }); // Apply env-specific formatting (colors, etc.) - - createDebug.formatArgs.call(self, args); - var logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); - debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; - debug.extend = extend; // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; - // env-specific initialization logic for debug instances - - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } - - createDebug.instances.push(debug); - return debug; - } - - function destroy() { - var index = createDebug.instances.indexOf(this); - - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - - return false; - } - - function extend(namespace, delimiter) { - return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - } - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - - - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.names = []; - createDebug.skips = []; - var i; - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - - for (i = 0; i < createDebug.instances.length; i++) { - var instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } - } - /** - * Disable debug output. - * - * @api public - */ - - - function disable() { - createDebug.enable(''); - } - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - - - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - - var i; - var len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - - return false; - } - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - - - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - - return val; - } - - createDebug.enable(createDebug.load()); - return createDebug; -} - -module.exports = setup; - diff --git a/node_modules/debug/src/index.js b/node_modules/debug/src/index.js deleted file mode 100644 index 0217315..0000000 --- a/node_modules/debug/src/index.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -/** - * Detect Electron renderer / nwjs process, which is node, but we should - * treat as a browser. - */ -if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { - module.exports = require('./browser.js'); -} else { - module.exports = require('./node.js'); -} - diff --git a/node_modules/debug/src/node.js b/node_modules/debug/src/node.js deleted file mode 100644 index dbbb5f1..0000000 --- a/node_modules/debug/src/node.js +++ /dev/null @@ -1,174 +0,0 @@ -"use strict"; - -/** - * Module dependencies. - */ -var tty = require('tty'); - -var util = require('util'); -/** - * This is the Node.js implementation of `debug()`. - */ - - -exports.init = init; -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -try { - // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) - // eslint-disable-next-line import/no-extraneous-dependencies - var supportsColor = require('supports-color'); - - if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { - exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221]; - } -} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be. - -/** - * Build up the default `inspectOpts` object from the environment variables. - * - * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js - */ - - -exports.inspectOpts = Object.keys(process.env).filter(function (key) { - return /^debug_/i.test(key); -}).reduce(function (obj, key) { - // Camel-case - var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) { - return k.toUpperCase(); - }); // Coerce string value into JS value - - var val = process.env[key]; - - if (/^(yes|on|true|enabled)$/i.test(val)) { - val = true; - } else if (/^(no|off|false|disabled)$/i.test(val)) { - val = false; - } else if (val === 'null') { - val = null; - } else { - val = Number(val); - } - - obj[prop] = val; - return obj; -}, {}); -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); -} -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - - -function formatArgs(args) { - var name = this.namespace, - useColors = this.useColors; - - if (useColors) { - var c = this.color; - var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c); - var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m"); - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m"); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } -} - -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } - - return new Date().toISOString() + ' '; -} -/** - * Invokes `util.format()` with the specified arguments and writes to stderr. - */ - - -function log() { - return process.stderr.write(util.format.apply(util, arguments) + '\n'); -} -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - - -function save(namespaces) { - if (namespaces) { - process.env.DEBUG = namespaces; - } else { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } -} -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - - -function load() { - return process.env.DEBUG; -} -/** - * Init logic for `debug` instances. - * - * Create a new `inspectOpts` object in case `useColors` is set - * differently for a particular `debug` instance. - */ - - -function init(debug) { - debug.inspectOpts = {}; - var keys = Object.keys(exports.inspectOpts); - - for (var i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; - } -} - -module.exports = require('./common')(exports); -var formatters = module.exports.formatters; -/** - * Map %o to `util.inspect()`, all on a single line. - */ - -formatters.o = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts).replace(/\s*\n\s*/g, ' '); -}; -/** - * Map %O to `util.inspect()`, allowing multiple lines if needed. - */ - - -formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -}; - diff --git a/node_modules/decamelize/index.js b/node_modules/decamelize/index.js deleted file mode 100644 index 8d5bab7..0000000 --- a/node_modules/decamelize/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; -module.exports = function (str, sep) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - sep = typeof sep === 'undefined' ? '_' : sep; - - return str - .replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2') - .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2') - .toLowerCase(); -}; diff --git a/node_modules/decamelize/license b/node_modules/decamelize/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/decamelize/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/decamelize/package.json b/node_modules/decamelize/package.json deleted file mode 100644 index 117779e..0000000 --- a/node_modules/decamelize/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "_from": "decamelize@^1.2.0", - "_id": "decamelize@1.2.0", - "_inBundle": false, - "_integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "_location": "/decamelize", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "decamelize@^1.2.0", - "name": "decamelize", - "escapedName": "decamelize", - "rawSpec": "^1.2.0", - "saveSpec": null, - "fetchSpec": "^1.2.0" - }, - "_requiredBy": [ - "/yargs", - "/yargs-parser" - ], - "_resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "_shasum": "f6534d15148269b20352e7bee26f501f9a191290", - "_spec": "decamelize@^1.2.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/decamelize/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow", - "devDependencies": { - "ava": "*", - "xo": "*" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/decamelize#readme", - "keywords": [ - "decamelize", - "decamelcase", - "camelcase", - "lowercase", - "case", - "dash", - "hyphen", - "string", - "str", - "text", - "convert" - ], - "license": "MIT", - "name": "decamelize", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/decamelize.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "1.2.0" -} diff --git a/node_modules/decamelize/readme.md b/node_modules/decamelize/readme.md deleted file mode 100644 index 624c7ee..0000000 --- a/node_modules/decamelize/readme.md +++ /dev/null @@ -1,48 +0,0 @@ -# decamelize [![Build Status](https://travis-ci.org/sindresorhus/decamelize.svg?branch=master)](https://travis-ci.org/sindresorhus/decamelize) - -> Convert a camelized string into a lowercased one with a custom separator
-> Example: `unicornRainbow` → `unicorn_rainbow` - - -## Install - -``` -$ npm install --save decamelize -``` - - -## Usage - -```js -const decamelize = require('decamelize'); - -decamelize('unicornRainbow'); -//=> 'unicorn_rainbow' - -decamelize('unicornRainbow', '-'); -//=> 'unicorn-rainbow' -``` - - -## API - -### decamelize(input, [separator]) - -#### input - -Type: `string` - -#### separator - -Type: `string`
-Default: `_` - - -## Related - -See [`camelcase`](https://github.com/sindresorhus/camelcase) for the inverse. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/decompress-response/index.d.ts b/node_modules/decompress-response/index.d.ts deleted file mode 100644 index 18918fa..0000000 --- a/node_modules/decompress-response/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// -import {IncomingMessage} from 'http'; - -declare const decompressResponse: { - /** - Decompress a HTTP response if needed. - - @param response - The HTTP incoming stream with compressed data. - @returns The decompressed HTTP response stream. - - @example - ``` - import {http} from 'http'; - import decompressResponse = require('decompress-response'); - - http.get('https://sindresorhus.com', response => { - response = decompressResponse(response); - }); - ``` - */ - (response: IncomingMessage): IncomingMessage; - - // TODO: remove this in the next major version, refactor the whole definition to: - // declare function decompressResponse(response: IncomingMessage): IncomingMessage; - // export = decompressResponse; - default: typeof decompressResponse; -}; - -export = decompressResponse; diff --git a/node_modules/decompress-response/index.js b/node_modules/decompress-response/index.js deleted file mode 100644 index 0379dc5..0000000 --- a/node_modules/decompress-response/index.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; -const {PassThrough: PassThroughStream} = require('stream'); -const zlib = require('zlib'); -const mimicResponse = require('mimic-response'); - -const decompressResponse = response => { - const contentEncoding = (response.headers['content-encoding'] || '').toLowerCase(); - - if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) { - return response; - } - - const isBrotli = contentEncoding === 'br'; - if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') { - return response; - } - - const decompress = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip(); - const stream = new PassThroughStream(); - - mimicResponse(response, stream); - - decompress.on('error', error => { - // Ignore empty response - if (error.code === 'Z_BUF_ERROR') { - stream.end(); - return; - } - - stream.emit('error', error); - }); - - response.pipe(decompress).pipe(stream); - - return stream; -}; - -module.exports = decompressResponse; -// TODO: remove this in the next major version -module.exports.default = decompressResponse; diff --git a/node_modules/decompress-response/license b/node_modules/decompress-response/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/decompress-response/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/decompress-response/package.json b/node_modules/decompress-response/package.json deleted file mode 100644 index 34095f3..0000000 --- a/node_modules/decompress-response/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "_from": "decompress-response@^4.2.0", - "_id": "decompress-response@4.2.1", - "_inBundle": false, - "_integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", - "_location": "/decompress-response", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "decompress-response@^4.2.0", - "name": "decompress-response", - "escapedName": "decompress-response", - "rawSpec": "^4.2.0", - "saveSpec": null, - "fetchSpec": "^4.2.0" - }, - "_requiredBy": [ - "/simple-get" - ], - "_resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", - "_shasum": "414023cc7a302da25ce2ec82d0d5238ccafd8986", - "_spec": "decompress-response@^4.2.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/simple-get", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/decompress-response/issues" - }, - "bundleDependencies": false, - "dependencies": { - "mimic-response": "^2.0.0" - }, - "deprecated": false, - "description": "Decompress a HTTP response if needed", - "devDependencies": { - "@types/node": "^12.7.1", - "ava": "^2.2.0", - "get-stream": "^5.0.0", - "pify": "^4.0.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/decompress-response#readme", - "keywords": [ - "decompress", - "response", - "http", - "https", - "zlib", - "gzip", - "zip", - "deflate", - "unzip", - "ungzip", - "incoming", - "message", - "stream", - "compressed", - "brotli" - ], - "license": "MIT", - "name": "decompress-response", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/decompress-response.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "4.2.1" -} diff --git a/node_modules/decompress-response/readme.md b/node_modules/decompress-response/readme.md deleted file mode 100644 index c87431a..0000000 --- a/node_modules/decompress-response/readme.md +++ /dev/null @@ -1,52 +0,0 @@ -# decompress-response [![Build Status](https://travis-ci.org/sindresorhus/decompress-response.svg?branch=master)](https://travis-ci.org/sindresorhus/decompress-response) - -> Decompress a HTTP response if needed - -Decompresses the [response](https://nodejs.org/api/http.html#http_class_http_incomingmessage) from [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) if it's gzipped, deflated or compressed with Brotli, otherwise just passes it through. - -Used by [`got`](https://github.com/sindresorhus/got). - - -## Install - -``` -$ npm install decompress-response -``` - - -## Usage - -```js -const http = require('http'); -const decompressResponse = require('decompress-response'); - -http.get('https://sindresorhus.com', response => { - response = decompressResponse(response); -}); -``` - - -## API - -### decompressResponse(response) - -Returns the decompressed HTTP response stream. - -#### response - -Type: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) - -The HTTP incoming stream with compressed data. - - ---- - -

- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/deep-extend/CHANGELOG.md b/node_modules/deep-extend/CHANGELOG.md deleted file mode 100644 index dd13ec1..0000000 --- a/node_modules/deep-extend/CHANGELOG.md +++ /dev/null @@ -1,46 +0,0 @@ -Changelog -========= - -v0.6.0 ------- - -- Updated "devDependencies" versions to fix vulnerability alerts -- Dropped support of io.js and node.js v0.12.x and lower since new versions of - "devDependencies" couldn't work with those old node.js versions - (minimal supported version of node.js now is v4.0.0) - -v0.5.1 ------- - -- Fix prototype pollution vulnerability (thanks to @mwakerman for the PR) -- Avoid using deprecated Buffer API (thanks to @ChALkeR for the PR) - -v0.5.0 ------- - -- Auto-testing provided by Travis CI; -- Support older Node.JS versions (`v0.11.x` and `v0.10.x`); -- Removed tests files from npm package. - -v0.4.2 ------- - -- Fix for `null` as an argument. - -v0.4.1 ------- - -- Removed test code from npm package - ([see pull request #21](https://github.com/unclechu/node-deep-extend/pull/21)); -- Increased minimal version of Node from `0.4.0` to `0.12.0` - (because can't run tests on lesser version anyway). - -v0.4.0 ------- - -- **WARNING!** Broken backward compatibility with `v0.3.x`; -- Fixed bug with extending arrays instead of cloning; -- Deep cloning for arrays; -- Check for own property; -- Fixed some documentation issues; -- Strict JS mode. diff --git a/node_modules/deep-extend/LICENSE b/node_modules/deep-extend/LICENSE deleted file mode 100644 index 5c58916..0000000 --- a/node_modules/deep-extend/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013-2018, Viacheslav Lotsmanov - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/deep-extend/README.md b/node_modules/deep-extend/README.md deleted file mode 100644 index 67c7fc0..0000000 --- a/node_modules/deep-extend/README.md +++ /dev/null @@ -1,91 +0,0 @@ -Deep Extend -=========== - -Recursive object extending. - -[![Build Status](https://api.travis-ci.org/unclechu/node-deep-extend.svg?branch=master)](https://travis-ci.org/unclechu/node-deep-extend) - -[![NPM](https://nodei.co/npm/deep-extend.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/deep-extend/) - -Install -------- - -```bash -$ npm install deep-extend -``` - -Usage ------ - -```javascript -var deepExtend = require('deep-extend'); -var obj1 = { - a: 1, - b: 2, - d: { - a: 1, - b: [], - c: { test1: 123, test2: 321 } - }, - f: 5, - g: 123, - i: 321, - j: [1, 2] -}; -var obj2 = { - b: 3, - c: 5, - d: { - b: { first: 'one', second: 'two' }, - c: { test2: 222 } - }, - e: { one: 1, two: 2 }, - f: [], - g: (void 0), - h: /abc/g, - i: null, - j: [3, 4] -}; - -deepExtend(obj1, obj2); - -console.log(obj1); -/* -{ a: 1, - b: 3, - d: - { a: 1, - b: { first: 'one', second: 'two' }, - c: { test1: 123, test2: 222 } }, - f: [], - g: undefined, - c: 5, - e: { one: 1, two: 2 }, - h: /abc/g, - i: null, - j: [3, 4] } -*/ -``` - -Unit testing ------------- - -```bash -$ npm test -``` - -Changelog ---------- - -[CHANGELOG.md](./CHANGELOG.md) - -Any issues? ------------ - -Please, report about issues -[here](https://github.com/unclechu/node-deep-extend/issues). - -License -------- - -[MIT](./LICENSE) diff --git a/node_modules/deep-extend/index.js b/node_modules/deep-extend/index.js deleted file mode 100644 index 762d81e..0000000 --- a/node_modules/deep-extend/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/deep-extend'); diff --git a/node_modules/deep-extend/lib/deep-extend.js b/node_modules/deep-extend/lib/deep-extend.js deleted file mode 100644 index 651fd8d..0000000 --- a/node_modules/deep-extend/lib/deep-extend.js +++ /dev/null @@ -1,150 +0,0 @@ -/*! - * @description Recursive object extending - * @author Viacheslav Lotsmanov - * @license MIT - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Viacheslav Lotsmanov - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -'use strict'; - -function isSpecificValue(val) { - return ( - val instanceof Buffer - || val instanceof Date - || val instanceof RegExp - ) ? true : false; -} - -function cloneSpecificValue(val) { - if (val instanceof Buffer) { - var x = Buffer.alloc - ? Buffer.alloc(val.length) - : new Buffer(val.length); - val.copy(x); - return x; - } else if (val instanceof Date) { - return new Date(val.getTime()); - } else if (val instanceof RegExp) { - return new RegExp(val); - } else { - throw new Error('Unexpected situation'); - } -} - -/** - * Recursive cloning array. - */ -function deepCloneArray(arr) { - var clone = []; - arr.forEach(function (item, index) { - if (typeof item === 'object' && item !== null) { - if (Array.isArray(item)) { - clone[index] = deepCloneArray(item); - } else if (isSpecificValue(item)) { - clone[index] = cloneSpecificValue(item); - } else { - clone[index] = deepExtend({}, item); - } - } else { - clone[index] = item; - } - }); - return clone; -} - -function safeGetProperty(object, property) { - return property === '__proto__' ? undefined : object[property]; -} - -/** - * Extening object that entered in first argument. - * - * Returns extended object or false if have no target object or incorrect type. - * - * If you wish to clone source object (without modify it), just use empty new - * object as first argument, like this: - * deepExtend({}, yourObj_1, [yourObj_N]); - */ -var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) { - if (arguments.length < 1 || typeof arguments[0] !== 'object') { - return false; - } - - if (arguments.length < 2) { - return arguments[0]; - } - - var target = arguments[0]; - - // convert arguments to array and cut off target object - var args = Array.prototype.slice.call(arguments, 1); - - var val, src, clone; - - args.forEach(function (obj) { - // skip argument if isn't an object, is null, or is an array - if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) { - return; - } - - Object.keys(obj).forEach(function (key) { - src = safeGetProperty(target, key); // source value - val = safeGetProperty(obj, key); // new value - - // recursion prevention - if (val === target) { - return; - - /** - * if new value isn't object then just overwrite by new value - * instead of extending. - */ - } else if (typeof val !== 'object' || val === null) { - target[key] = val; - return; - - // just clone arrays (and recursive clone objects inside) - } else if (Array.isArray(val)) { - target[key] = deepCloneArray(val); - return; - - // custom cloning and overwrite for specific objects - } else if (isSpecificValue(val)) { - target[key] = cloneSpecificValue(val); - return; - - // overwrite by new value if source isn't object or array - } else if (typeof src !== 'object' || src === null || Array.isArray(src)) { - target[key] = deepExtend({}, val); - return; - - // source value and new value is objects both, extending... - } else { - target[key] = deepExtend(src, val); - return; - } - }); - }); - - return target; -}; diff --git a/node_modules/deep-extend/package.json b/node_modules/deep-extend/package.json deleted file mode 100644 index cf0123a..0000000 --- a/node_modules/deep-extend/package.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "_from": "deep-extend@^0.6.0", - "_id": "deep-extend@0.6.0", - "_inBundle": false, - "_integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "_location": "/deep-extend", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "deep-extend@^0.6.0", - "name": "deep-extend", - "escapedName": "deep-extend", - "rawSpec": "^0.6.0", - "saveSpec": null, - "fetchSpec": "^0.6.0" - }, - "_requiredBy": [ - "/rc" - ], - "_resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "_shasum": "c4fa7c95404a17a9c3e8ca7e1537312b736330ac", - "_spec": "deep-extend@^0.6.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/rc", - "author": { - "name": "Viacheslav Lotsmanov", - "email": "lotsmanov89@gmail.com" - }, - "bugs": { - "url": "https://github.com/unclechu/node-deep-extend/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Romain Prieto", - "url": "https://github.com/rprieto" - }, - { - "name": "Max Maximov", - "url": "https://github.com/maxmaximov" - }, - { - "name": "Marshall Bowers", - "url": "https://github.com/maxdeviant" - }, - { - "name": "Misha Wakerman", - "url": "https://github.com/mwakerman" - } - ], - "deprecated": false, - "description": "Recursive object extending", - "devDependencies": { - "mocha": "5.2.0", - "should": "13.2.1" - }, - "engines": { - "node": ">=4.0.0" - }, - "files": [ - "index.js", - "lib/" - ], - "homepage": "https://github.com/unclechu/node-deep-extend", - "keywords": [ - "deep-extend", - "extend", - "deep", - "recursive", - "xtend", - "clone", - "merge", - "json" - ], - "license": "MIT", - "licenses": [ - { - "type": "MIT", - "url": "https://raw.githubusercontent.com/unclechu/node-deep-extend/master/LICENSE" - } - ], - "main": "lib/deep-extend.js", - "name": "deep-extend", - "repository": { - "type": "git", - "url": "git://github.com/unclechu/node-deep-extend.git" - }, - "scripts": { - "test": "mocha" - }, - "version": "0.6.0" -} diff --git a/node_modules/delaunator/LICENSE b/node_modules/delaunator/LICENSE deleted file mode 100644 index 6f4f868..0000000 --- a/node_modules/delaunator/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -ISC License - -Copyright (c) 2017, Mapbox - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. diff --git a/node_modules/delaunator/README.md b/node_modules/delaunator/README.md deleted file mode 100644 index b97bff9..0000000 --- a/node_modules/delaunator/README.md +++ /dev/null @@ -1,127 +0,0 @@ -# Delaunator [![Build Status](https://travis-ci.org/mapbox/delaunator.svg?branch=master)](https://travis-ci.org/mapbox/delaunator) [![](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects) - -An incredibly fast JavaScript library for -[Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation) of 2D points. - -- [Interactive Demo](https://mapbox.github.io/delaunator/demo.html) -- [Guide to data structures](https://mapbox.github.io/delaunator/) - -### Projects based on Delaunator - -- [d3-delaunay](https://github.com/d3/d3-delaunay) for Voronoi diagrams, search, traversal and rendering. -- [d3-geo-voronoi](https://github.com/Fil/d3-geo-voronoi) for Delaunay triangulations and Voronoi diagrams on a sphere (e.g. for geographic locations). - -### Ports to other languages - -- [delaunator-rs](https://github.com/mourner/delaunator-rs) (Rust) -- [fogleman/delaunay](https://github.com/fogleman/delaunay) (Go) -- [delaunator-cpp](https://github.com/delfrrr/delaunator-cpp) (C++) - -Delaunay triangulation example - -## Example - -```js -const points = [[168, 180], [168, 178], [168, 179], [168, 181], [168, 183], ...]; - -const delaunay = Delaunator.from(points); -console.log(delaunay.triangles); -// [623, 636, 619, 636, 444, 619, ...] -``` - -## Install - -Install with NPM (`npm install delaunator`) or Yarn (`yarn add delaunator`), then: - -```js -// import as an ES module -import Delaunator from 'delaunator'; - -// or require in Node / Browserify -const Delaunator = require('delaunator'); -``` - -Or use a browser build directly: - -```html - - -``` - -## API Reference - -#### Delaunator.from(points[, getX, getY]) - -Constructs a delaunay triangulation object given an array of points (`[x, y]` by default). -`getX` and `getY` are optional functions of the form `(point) => value` for custom point formats. -Duplicate points are skipped. - -#### new Delaunator(coords) - -Constructs a delaunay triangulation object given an array of point coordinates of the form: -`[x0, y0, x1, y1, ...]` (use a typed array for best performance). - -#### delaunay.triangles - -A `Uint32Array` array of triangle vertex indices (each group of three numbers forms a triangle). -All triangles are directed counterclockwise. - -To get the coordinates of all triangles, use: - -```js -for (let i = 0; i < triangles.length; i += 3) { - coordinates.push([ - points[triangles[i]], - points[triangles[i + 1]], - points[triangles[i + 2]] - ]); -} -``` - -#### delaunay.halfedges - -A `Int32Array` array of triangle half-edge indices that allows you to traverse the triangulation. -`i`-th half-edge in the array corresponds to vertex `triangles[i]` the half-edge is coming from. -`halfedges[i]` is the index of a twin half-edge in an adjacent triangle -(or `-1` for outer half-edges on the convex hull). - -The flat array-based data structures might be counterintuitive, -but they're one of the key reasons this library is fast. - -#### delaunay.hull - -A `Uint32Array` array of indices that reference points on the convex hull of the input data, counter-clockwise. - -#### delaunay.coords - -An array of input coordinates in the form `[x0, y0, x1, y1, ....]`, -of the type provided in the constructor (or `Float64Array` if you used `Delaunator.from`). - -#### delaunay.update() - -Updates the triangulation if you modified `delaunay.coords` values in place, avoiding expensive memory allocations. -Useful for iterative relaxation algorithms such as [Lloyd's](https://en.wikipedia.org/wiki/Lloyd%27s_algorithm). - -## Performance - -Benchmark results against other Delaunay JS libraries -(`npm run bench` on Macbook Pro Retina 15" 2017, Node v10.10.0): - -  | uniform 100k | gauss 100k | grid 100k | degen 100k | uniform 1 million | gauss 1 million | grid 1 million | degen 1 million -:-- | --: | --: | --: | --: | --: | --: | --: | --: -**delaunator** | 82ms | 61ms | 66ms | 25ms | 1.07s | 950ms | 830ms | 278ms -[faster‑delaunay](https://github.com/Bathlamos/delaunay-triangulation) | 473ms | 411ms | 272ms | 68ms | 4.27s | 4.62s | 4.3s | 810ms -[incremental‑delaunay](https://github.com/mikolalysenko/incremental-delaunay) | 547ms | 505ms | 172ms | 528ms | 5.9s | 6.08s | 2.11s | 6.09s -[d3‑voronoi](https://github.com/d3/d3-voronoi) | 972ms | 909ms | 358ms | 720ms | 15.04s | 13.86s | 5.55s | 11.13s -[delaunay‑fast](https://github.com/ironwallaby/delaunay) | 3.8s | 4s | 12.57s | timeout | 132s | 138s | 399s | timeout -[delaunay](https://github.com/darkskyapp/delaunay) | 4.85s | 5.73s | 15.05s | timeout | 156s | 178s | 326s | timeout -[delaunay‑triangulate](https://github.com/mikolalysenko/delaunay-triangulate) | 2.24s | 2.04s | OOM | 1.51s | OOM | OOM | OOM | OOM -[cdt2d](https://github.com/mikolalysenko/cdt2d) | 45s | 51s | 118s | 17s | timeout | timeout | timeout | timeout - -## Papers - -The algorithm is based on ideas from the following papers: - -- [A simple sweep-line Delaunay triangulation algorithm](http://www.academicpub.org/jao/paperInfo.aspx?paperid=15630), 2013, Liu Yonghe, Feng Jinming and Shao Yuehong -- [S-hull: a fast radial sweep-hull routine for Delaunay triangulation](http://www.s-hull.org/paper/s_hull.pdf), 2010, David Sinclair -- [A faster circle-sweep Delaunay triangulation algorithm](http://cglab.ca/~biniaz/papers/Sweep%20Circle.pdf), 2011, Ahmad Biniaz and Gholamhossein Dastghaibyfard diff --git a/node_modules/delaunator/delaunator.js b/node_modules/delaunator/delaunator.js deleted file mode 100644 index 2046537..0000000 --- a/node_modules/delaunator/delaunator.js +++ /dev/null @@ -1,512 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.Delaunator = factory()); -}(this, function () { 'use strict'; - - var EPSILON = Math.pow(2, -52); - var EDGE_STACK = new Uint32Array(512); - - var Delaunator = function Delaunator(coords) { - var n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') { throw new Error('Expected coords to contain numbers.'); } - - this.coords = coords; - - // arrays that will store the triangulation graph - var maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash - - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - - this.update(); - }; - - Delaunator.from = function from (points, getX, getY) { - if ( getX === void 0 ) getX = defaultGetX; - if ( getY === void 0 ) getY = defaultGetY; - - var n = points.length; - var coords = new Float64Array(n * 2); - - for (var i = 0; i < n; i++) { - var p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - - return new Delaunator(coords); - }; - - Delaunator.prototype.update = function update () { - var ref = this; - var coords = ref.coords; - var hullPrev = ref._hullPrev; - var hullNext = ref._hullNext; - var hullTri = ref._hullTri; - var hullHash = ref._hullHash; - var n = coords.length >> 1; - - // populate an array of point indices; calculate input data bbox - var minX = Infinity; - var minY = Infinity; - var maxX = -Infinity; - var maxY = -Infinity; - - for (var i = 0; i < n; i++) { - var x = coords[2 * i]; - var y = coords[2 * i + 1]; - if (x < minX) { minX = x; } - if (y < minY) { minY = y; } - if (x > maxX) { maxX = x; } - if (y > maxY) { maxY = y; } - this._ids[i] = i; - } - var cx = (minX + maxX) / 2; - var cy = (minY + maxY) / 2; - - var minDist = Infinity; - var i0, i1, i2; - - // pick a seed point close to the center - for (var i$1 = 0; i$1 < n; i$1++) { - var d = dist(cx, cy, coords[2 * i$1], coords[2 * i$1 + 1]); - if (d < minDist) { - i0 = i$1; - minDist = d; - } - } - var i0x = coords[2 * i0]; - var i0y = coords[2 * i0 + 1]; - - minDist = Infinity; - - // find the point closest to the seed - for (var i$2 = 0; i$2 < n; i$2++) { - if (i$2 === i0) { continue; } - var d$1 = dist(i0x, i0y, coords[2 * i$2], coords[2 * i$2 + 1]); - if (d$1 < minDist && d$1 > 0) { - i1 = i$2; - minDist = d$1; - } - } - var i1x = coords[2 * i1]; - var i1y = coords[2 * i1 + 1]; - - var minRadius = Infinity; - - // find the third point which forms the smallest circumcircle with the first two - for (var i$3 = 0; i$3 < n; i$3++) { - if (i$3 === i0 || i$3 === i1) { continue; } - var r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i$3], coords[2 * i$3 + 1]); - if (r < minRadius) { - i2 = i$3; - minRadius = r; - } - } - var i2x = coords[2 * i2]; - var i2y = coords[2 * i2 + 1]; - - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for (var i$4 = 0; i$4 < n; i$4++) { - this._dists[i$4] = (coords[2 * i$4] - coords[0]) || (coords[2 * i$4 + 1] - coords[1]); - } - quicksort(this._ids, this._dists, 0, n - 1); - var hull = new Uint32Array(n); - var j = 0; - for (var i$5 = 0, d0 = -Infinity; i$5 < n; i$5++) { - var id = this._ids[i$5]; - if (this._dists[id] > d0) { - hull[j++] = id; - d0 = this._dists[id]; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } - - // swap the order of the seed points for counter-clockwise orientation - if (orient(i0x, i0y, i1x, i1y, i2x, i2y)) { - var i$6 = i1; - var x$1 = i1x; - var y$1 = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i$6; - i2x = x$1; - i2y = y$1; - } - - var center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - - for (var i$7 = 0; i$7 < n; i$7++) { - this._dists[i$7] = dist(coords[2 * i$7], coords[2 * i$7 + 1], center.x, center.y); - } - - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - - // set up the seed triangle as the starting hull - this._hullStart = i0; - var hullSize = 3; - - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - - for (var k = 0, xp = (void 0), yp = (void 0); k < this._ids.length; k++) { - var i$8 = this._ids[k]; - var x$2 = coords[2 * i$8]; - var y$2 = coords[2 * i$8 + 1]; - - // skip near-duplicate points - if (k > 0 && Math.abs(x$2 - xp) <= EPSILON && Math.abs(y$2 - yp) <= EPSILON) { continue; } - xp = x$2; - yp = y$2; - - // skip seed triangle points - if (i$8 === i0 || i$8 === i1 || i$8 === i2) { continue; } - - // find a visible edge on the convex hull using edge hash - var start = 0; - for (var j$1 = 0, key = this._hashKey(x$2, y$2); j$1 < this._hashSize; j$1++) { - start = hullHash[(key + j$1) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) { break; } - } - - start = hullPrev[start]; - var e = start, q = (void 0); - while (q = hullNext[e], !orient(x$2, y$2, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) { - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) { continue; } // likely a near-duplicate point; skip it - - // add the first triangle from the point - var t = this._addTriangle(e, i$8, hullNext[e], -1, -1, hullTri[e]); - - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i$8] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - - // walk forward through the hull, adding more triangles and flipping recursively - var n$1 = hullNext[e]; - while (q = hullNext[n$1], orient(x$2, y$2, coords[2 * n$1], coords[2 * n$1 + 1], coords[2 * q], coords[2 * q + 1])) { - t = this._addTriangle(n$1, i$8, q, hullTri[i$8], -1, hullTri[n$1]); - hullTri[i$8] = this._legalize(t + 2); - hullNext[n$1] = n$1; // mark as removed - hullSize--; - n$1 = q; - } - - // walk backward from the other side, adding more triangles and flipping - if (e === start) { - while (q = hullPrev[e], orient(x$2, y$2, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) { - t = this._addTriangle(q, i$8, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - } - - // update the hull indices - this._hullStart = hullPrev[i$8] = e; - hullNext[e] = hullPrev[n$1] = i$8; - hullNext[i$8] = n$1; - - // save the two new edges in the hash table - hullHash[this._hashKey(x$2, y$2)] = i$8; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - - this.hull = new Uint32Array(hullSize); - for (var i$9 = 0, e$1 = this._hullStart; i$9 < hullSize; i$9++) { - this.hull[i$9] = e$1; - e$1 = hullNext[e$1]; - } - - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - }; - - Delaunator.prototype._hashKey = function _hashKey (x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - }; - - Delaunator.prototype._legalize = function _legalize (a) { - var ref = this; - var triangles = ref._triangles; - var halfedges = ref._halfedges; - var coords = ref.coords; - - var i = 0; - var ar = 0; - - // recursion eliminated with a fixed-size stack - while (true) { - var b = halfedges[a]; - - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/\a - * / || \ / \ - * / a||b \flip/___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\/br - * \||/ \ / - * pr pr - */ - var a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - - if (b === -1) { // convex hull edge - if (i === 0) { break; } - a = EDGE_STACK[--i]; - continue; - } - - var b0 = b - b % 3; - var al = a0 + (a + 1) % 3; - var bl = b0 + (b + 2) % 3; - - var p0 = triangles[ar]; - var pr = triangles[a]; - var pl = triangles[al]; - var p1 = triangles[bl]; - - var illegal = inCircle( - coords[2 * p0], coords[2 * p0 + 1], - coords[2 * pr], coords[2 * pr + 1], - coords[2 * pl], coords[2 * pl + 1], - coords[2 * p1], coords[2 * p1 + 1]); - - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - - var hbl = halfedges[bl]; - - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - var e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - - var br = b0 + (b + 1) % 3; - - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = br; - } - } else { - if (i === 0) { break; } - a = EDGE_STACK[--i]; - } - } - - return ar; - }; - - Delaunator.prototype._link = function _link (a, b) { - this._halfedges[a] = b; - if (b !== -1) { this._halfedges[b] = a; } - }; - - // add a new triangle given vertex indices and adjacent half-edge ids - Delaunator.prototype._addTriangle = function _addTriangle (i0, i1, i2, a, b, c) { - var t = this.trianglesLen; - - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - - this.trianglesLen += 3; - - return t; - }; - - // monotonically increases with real angle, but doesn't need expensive trigonometry - function pseudoAngle(dx, dy) { - var p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] - } - - function dist(ax, ay, bx, by) { - var dx = ax - bx; - var dy = ay - by; - return dx * dx + dy * dy; - } - - // return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check - function orientIfSure(px, py, rx, ry, qx, qy) { - var l = (ry - py) * (qx - px); - var r = (rx - px) * (qy - py); - return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0; - } - - // a more robust orientation test that's stable in a given triangle (to fix robustness issues) - function orient(rx, ry, qx, qy, px, py) { - var sign = orientIfSure(px, py, rx, ry, qx, qy) || - orientIfSure(rx, ry, qx, qy, px, py) || - orientIfSure(qx, qy, px, py, rx, ry); - return sign < 0; - } - - function inCircle(ax, ay, bx, by, cx, cy, px, py) { - var dx = ax - px; - var dy = ay - py; - var ex = bx - px; - var ey = by - py; - var fx = cx - px; - var fy = cy - py; - - var ap = dx * dx + dy * dy; - var bp = ex * ex + ey * ey; - var cp = fx * fx + fy * fy; - - return dx * (ey * cp - bp * fy) - - dy * (ex * cp - bp * fx) + - ap * (ex * fy - ey * fx) < 0; - } - - function circumradius(ax, ay, bx, by, cx, cy) { - var dx = bx - ax; - var dy = by - ay; - var ex = cx - ax; - var ey = cy - ay; - - var bl = dx * dx + dy * dy; - var cl = ex * ex + ey * ey; - var d = 0.5 / (dx * ey - dy * ex); - - var x = (ey * bl - dy * cl) * d; - var y = (dx * cl - ex * bl) * d; - - return x * x + y * y; - } - - function circumcenter(ax, ay, bx, by, cx, cy) { - var dx = bx - ax; - var dy = by - ay; - var ex = cx - ax; - var ey = cy - ay; - - var bl = dx * dx + dy * dy; - var cl = ex * ex + ey * ey; - var d = 0.5 / (dx * ey - dy * ex); - - var x = ax + (ey * bl - dy * cl) * d; - var y = ay + (dx * cl - ex * bl) * d; - - return {x: x, y: y}; - } - - function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (var i = left + 1; i <= right; i++) { - var temp = ids[i]; - var tempDist = dists[temp]; - var j = i - 1; - while (j >= left && dists[ids[j]] > tempDist) { ids[j + 1] = ids[j--]; } - ids[j + 1] = temp; - } - } else { - var median = (left + right) >> 1; - var i$1 = left + 1; - var j$1 = right; - swap(ids, median, i$1); - if (dists[ids[left]] > dists[ids[right]]) { swap(ids, left, right); } - if (dists[ids[i$1]] > dists[ids[right]]) { swap(ids, i$1, right); } - if (dists[ids[left]] > dists[ids[i$1]]) { swap(ids, left, i$1); } - - var temp$1 = ids[i$1]; - var tempDist$1 = dists[temp$1]; - while (true) { - do { i$1++; } while (dists[ids[i$1]] < tempDist$1); - do { j$1--; } while (dists[ids[j$1]] > tempDist$1); - if (j$1 < i$1) { break; } - swap(ids, i$1, j$1); - } - ids[left + 1] = ids[j$1]; - ids[j$1] = temp$1; - - if (right - i$1 + 1 >= j$1 - left) { - quicksort(ids, dists, i$1, right); - quicksort(ids, dists, left, j$1 - 1); - } else { - quicksort(ids, dists, left, j$1 - 1); - quicksort(ids, dists, i$1, right); - } - } - } - - function swap(arr, i, j) { - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; - } - - function defaultGetX(p) { - return p[0]; - } - function defaultGetY(p) { - return p[1]; - } - - return Delaunator; - -})); diff --git a/node_modules/delaunator/delaunator.min.js b/node_modules/delaunator/delaunator.min.js deleted file mode 100644 index 9cb8799..0000000 --- a/node_modules/delaunator/delaunator.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(i=i||self).Delaunator=t()}(this,function(){"use strict";var i=Math.pow(2,-52),t=new Uint32Array(512),r=function(i){var t=i.length>>1;if(t>0&&"number"!=typeof i[0])throw new Error("Expected coords to contain numbers.");this.coords=i;var r=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()};function s(i,t,r,s){var h=i-r,a=t-s;return h*h+a*a}function h(i,t,r,s,h,a){var e=(s-t)*(h-i),n=(r-i)*(a-t);return Math.abs(e-n)>=33306690738754716e-32*Math.abs(e+n)?e-n:0}function a(i,t,r,s,a,e){return(h(a,e,i,t,r,s)||h(i,t,r,s,a,e)||h(r,s,a,e,i,t))<0}function e(i,t,r,s,h,a){var e=r-i,n=s-t,l=h-i,o=a-t,f=e*e+n*n,_=l*l+o*o,d=.5/(e*o-n*l),v=(o*f-n*_)*d,u=(e*_-l*f)*d;return v*v+u*u}function n(i,t,r,s){if(s-r<=20)for(var h=r+1;h<=s;h++){for(var a=i[h],e=t[a],o=h-1;o>=r&&t[i[o]]>e;)i[o+1]=i[o--];i[o+1]=a}else{var f=r+1,_=s;l(i,r+s>>1,f),t[i[r]]>t[i[s]]&&l(i,r,s),t[i[f]]>t[i[s]]&&l(i,f,s),t[i[r]]>t[i[f]]&&l(i,r,f);for(var d=i[f],v=t[d];;){do{f++}while(t[i[f]]v);if(_=_-r?(n(i,t,f,s),n(i,t,r,_-1)):(n(i,t,r,_-1),n(i,t,f,s))}}function l(i,t,r){var s=i[t];i[t]=i[r],i[r]=s}function o(i){return i[0]}function f(i){return i[1]}return r.from=function(i,t,s){void 0===t&&(t=o),void 0===s&&(s=f);for(var h=i.length,a=new Float64Array(2*h),e=0;e>1,_=1/0,d=1/0,v=-1/0,u=-1/0,y=0;yv&&(v=g),c>u&&(u=c),this._ids[y]=y}for(var w,p,b,A=(_+v)/2,k=(d+u)/2,x=1/0,M=0;M0&&(p=T,x=m)}for(var K=t[2*p],L=t[2*p+1],P=1/0,E=0;EB&&(j[q++]=C,B=this._dists[C])}return this.hull=j.subarray(0,q),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(a(z,U,K,L,H,I)){var G=p,J=K,O=L;p=b,K=H,L=I,b=G,H=J,I=O}var Q=function(i,t,r,s,h,a){var e=r-i,n=s-t,l=h-i,o=a-t,f=e*e+n*n,_=l*l+o*o,d=.5/(e*o-n*l);return{x:i+(o*f-n*_)*d,y:t+(e*_-l*f)*d}}(z,U,K,L,H,I);this._cx=Q.x,this._cy=Q.y;for(var R=0;R0&&Math.abs($-X)<=i&&Math.abs(ii-Y)<=i)&&(X=$,Y=ii,Z!==w&&Z!==p&&Z!==b)){for(var ti=0,ri=0,si=this._hashKey($,ii);ri0?3-h:1+h)/4*this._hashSize))%this._hashSize;var r,s,h},r.prototype._legalize=function(i){for(var r,s,h,a,e,n,l,o,f,_,d,v,u,y,g,c,w=this._triangles,p=this._halfedges,b=this.coords,A=0,k=0;;){var x=p[i],M=i-i%3;if(k=M+(i+2)%3,-1!==x){var S=x-x%3,z=M+(i+1)%3,U=S+(x+2)%3,T=w[k],m=w[i],K=w[z],L=w[U];if(r=b[2*T],s=b[2*T+1],h=b[2*m],a=b[2*m+1],e=b[2*K],n=b[2*K+1],l=b[2*L],o=b[2*L+1],f=void 0,_=void 0,d=void 0,v=void 0,u=void 0,y=void 0,void 0,g=void 0,c=void 0,(f=r-l)*((v=a-o)*(c=(u=e-l)*u+(y=n-o)*y)-(g=(d=h-l)*d+v*v)*y)-(_=s-o)*(d*c-g*u)+(f*f+_*_)*(d*y-v*u)<0){w[i]=L,w[x]=T;var P=p[U];if(-1===P){var E=this._hullStart;do{if(this._hullTri[E]===U){this._hullTri[E]=i;break}E=this._hullPrev[E]}while(E!==this._hullStart)}this._link(i,P),this._link(x,p[k]),this._link(k,U);var F=S+(x+1)%3;A> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - - this.coords = coords; - - // arrays that will store the triangulation graph - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash - - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - - this.update(); - } - - update() { - const {coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash} = this; - const n = coords.length >> 1; - - // populate an array of point indices; calculate input data bbox - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - - for (let i = 0; i < n; i++) { - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - - let minDist = Infinity; - let i0, i1, i2; - - // pick a seed point close to the center - for (let i = 0; i < n; i++) { - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } - } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - - minDist = Infinity; - - // find the point closest to the seed - for (let i = 0; i < n; i++) { - if (i === i0) continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } - } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - - let minRadius = Infinity; - - // find the third point which forms the smallest circumcircle with the first two - for (let i = 0; i < n; i++) { - if (i === i0 || i === i1) continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } - } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for (let i = 0; i < n; i++) { - this._dists[i] = (coords[2 * i] - coords[0]) || (coords[2 * i + 1] - coords[1]); - } - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for (let i = 0, d0 = -Infinity; i < n; i++) { - const id = this._ids[i]; - if (this._dists[id] > d0) { - hull[j++] = id; - d0 = this._dists[id]; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } - - // swap the order of the seed points for counter-clockwise orientation - if (orient(i0x, i0y, i1x, i1y, i2x, i2y)) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - - for (let i = 0; i < n; i++) { - this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - } - - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - - // set up the seed triangle as the starting hull - this._hullStart = i0; - let hullSize = 3; - - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - - for (let k = 0, xp, yp; k < this._ids.length; k++) { - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - - // skip near-duplicate points - if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue; - xp = x; - yp = y; - - // skip seed triangle points - if (i === i0 || i === i1 || i === i2) continue; - - // find a visible edge on the convex hull using edge hash - let start = 0; - for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) { - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - - start = hullPrev[start]; - let e = start, q; - while (q = hullNext[e], !orient(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) { - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) continue; // likely a near-duplicate point; skip it - - // add the first triangle from the point - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - - // walk forward through the hull, adding more triangles and flipping recursively - let n = hullNext[e]; - while (q = hullNext[n], orient(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1])) { - t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]); - hullTri[i] = this._legalize(t + 2); - hullNext[n] = n; // mark as removed - hullSize--; - n = q; - } - - // walk backward from the other side, adding more triangles and flipping - if (e === start) { - while (q = hullPrev[e], orient(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) { - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - } - - // update the hull indices - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n] = i; - hullNext[i] = n; - - // save the two new edges in the hash table - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - - this.hull = new Uint32Array(hullSize); - for (let i = 0, e = this._hullStart; i < hullSize; i++) { - this.hull[i] = e; - e = hullNext[e]; - } - - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - - _legalize(a) { - const {_triangles: triangles, _halfedges: halfedges, coords} = this; - - let i = 0; - let ar = 0; - - // recursion eliminated with a fixed-size stack - while (true) { - const b = halfedges[a]; - - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ - const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - - if (b === -1) { // convex hull edge - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - - const illegal = inCircle( - coords[2 * p0], coords[2 * p0 + 1], - coords[2 * pr], coords[2 * pr + 1], - coords[2 * pl], coords[2 * pl + 1], - coords[2 * p1], coords[2 * p1 + 1]); - - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - - const hbl = halfedges[bl]; - - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - - const br = b0 + (b + 1) % 3; - - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = br; - } - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - - return ar; - } - - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } - - // add a new triangle given vertex indices and adjacent half-edge ids - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - - this.trianglesLen += 3; - - return t; - } -} - -// monotonically increases with real angle, but doesn't need expensive trigonometry -function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] -} - -function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; -} - -// return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check -function orientIfSure(px, py, rx, ry, qx, qy) { - const l = (ry - py) * (qx - px); - const r = (rx - px) * (qy - py); - return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0; -} - -// a more robust orientation test that's stable in a given triangle (to fix robustness issues) -function orient(rx, ry, qx, qy, px, py) { - const sign = orientIfSure(px, py, rx, ry, qx, qy) || - orientIfSure(rx, ry, qx, qy, px, py) || - orientIfSure(qx, qy, px, py, rx, ry); - return sign < 0; -} - -function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - - return dx * (ey * cp - bp * fy) - - dy * (ex * cp - bp * fx) + - ap * (ex * fy - ey * fx) < 0; -} - -function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - - return x * x + y * y; -} - -function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - - return {x, y}; -} - -function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (let i = left + 1; i <= right; i++) { - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; - ids[j + 1] = temp; - } - } else { - const median = (left + right) >> 1; - let i = left + 1; - let j = right; - swap(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); - - const temp = ids[i]; - const tempDist = dists[temp]; - while (true) { - do i++; while (dists[ids[i]] < tempDist); - do j--; while (dists[ids[j]] > tempDist); - if (j < i) break; - swap(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); - } - } -} - -function swap(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - -function defaultGetX(p) { - return p[0]; -} -function defaultGetY(p) { - return p[1]; -} diff --git a/node_modules/delaunator/package.json b/node_modules/delaunator/package.json deleted file mode 100644 index ed54d37..0000000 --- a/node_modules/delaunator/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "_from": "delaunator@4", - "_id": "delaunator@4.0.1", - "_inBundle": false, - "_integrity": "sha512-WNPWi1IRKZfCt/qIDMfERkDp93+iZEmOxN2yy4Jg+Xhv8SLk2UTqqbe1sfiipn0and9QrE914/ihdx82Y/Giag==", - "_location": "/delaunator", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "delaunator@4", - "name": "delaunator", - "escapedName": "delaunator", - "rawSpec": "4", - "saveSpec": null, - "fetchSpec": "4" - }, - "_requiredBy": [ - "/d3-delaunay" - ], - "_resolved": "https://registry.npmjs.org/delaunator/-/delaunator-4.0.1.tgz", - "_shasum": "3d779687f57919a7a418f8ab947d3bddb6846957", - "_spec": "delaunator@4", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/d3-delaunay", - "author": { - "name": "Vladimir Agafonkin" - }, - "bugs": { - "url": "https://github.com/mapbox/delaunator/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "An incredibly fast JavaScript library for Delaunay triangulation of 2D points", - "devDependencies": { - "c8": "^5.0.1", - "eslint": "^6.2.2", - "eslint-config-mourner": "^3.0.0", - "esm": "^3.2.25", - "rollup": "^1.20.3", - "rollup-plugin-buble": "^0.19.8", - "rollup-plugin-terser": "^5.1.1", - "tape": "^4.11.0" - }, - "eslintConfig": { - "extends": "mourner", - "rules": { - "no-sequences": 0 - } - }, - "files": [ - "index.js", - "delaunator.js", - "delaunator.min.js" - ], - "homepage": "https://github.com/mapbox/delaunator#readme", - "jsdelivr": "delaunator.min.js", - "keywords": [ - "delaunay triangulation", - "computational geometry", - "algorithms" - ], - "license": "ISC", - "main": "delaunator.js", - "module": "index.js", - "name": "delaunator", - "repository": { - "type": "git", - "url": "git+https://github.com/mapbox/delaunator.git" - }, - "scripts": { - "bench": "node -r esm bench.js", - "build": "rollup -c", - "cov": "c8 node -r esm test/test.js && c8 report -r html", - "lint": "eslint index.js test/test.js bench.js rollup.config.js docs/diagrams.js", - "prepublishOnly": "npm test && npm run build", - "pretest": "npm run lint", - "start": "rollup -cw", - "test": "node -r esm test/test.js" - }, - "unpkg": "delaunator.min.js", - "version": "4.0.1" -} diff --git a/node_modules/delegates/.npmignore b/node_modules/delegates/.npmignore deleted file mode 100644 index c2658d7..0000000 --- a/node_modules/delegates/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/node_modules/delegates/History.md b/node_modules/delegates/History.md deleted file mode 100644 index 25959ea..0000000 --- a/node_modules/delegates/History.md +++ /dev/null @@ -1,22 +0,0 @@ - -1.0.0 / 2015-12-14 -================== - - * Merge pull request #12 from kasicka/master - * Add license text - -0.1.0 / 2014-10-17 -================== - - * adds `.fluent()` to api - -0.0.3 / 2014-01-13 -================== - - * fix receiver for .method() - -0.0.2 / 2014-01-13 -================== - - * Object.defineProperty() sucks - * Initial commit diff --git a/node_modules/delegates/License b/node_modules/delegates/License deleted file mode 100644 index 60de60a..0000000 --- a/node_modules/delegates/License +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2015 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/delegates/Makefile b/node_modules/delegates/Makefile deleted file mode 100644 index a9dcfd5..0000000 --- a/node_modules/delegates/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec \ - --bail - -.PHONY: test \ No newline at end of file diff --git a/node_modules/delegates/Readme.md b/node_modules/delegates/Readme.md deleted file mode 100644 index ab8cf4a..0000000 --- a/node_modules/delegates/Readme.md +++ /dev/null @@ -1,94 +0,0 @@ - -# delegates - - Node method and accessor delegation utilty. - -## Installation - -``` -$ npm install delegates -``` - -## Example - -```js -var delegate = require('delegates'); - -... - -delegate(proto, 'request') - .method('acceptsLanguages') - .method('acceptsEncodings') - .method('acceptsCharsets') - .method('accepts') - .method('is') - .access('querystring') - .access('idempotent') - .access('socket') - .access('length') - .access('query') - .access('search') - .access('status') - .access('method') - .access('path') - .access('body') - .access('host') - .access('url') - .getter('subdomains') - .getter('protocol') - .getter('header') - .getter('stale') - .getter('fresh') - .getter('secure') - .getter('ips') - .getter('ip') -``` - -# API - -## Delegate(proto, prop) - -Creates a delegator instance used to configure using the `prop` on the given -`proto` object. (which is usually a prototype) - -## Delegate#method(name) - -Allows the given method `name` to be accessed on the host. - -## Delegate#getter(name) - -Creates a "getter" for the property with the given `name` on the delegated -object. - -## Delegate#setter(name) - -Creates a "setter" for the property with the given `name` on the delegated -object. - -## Delegate#access(name) - -Creates an "accessor" (ie: both getter *and* setter) for the property with the -given `name` on the delegated object. - -## Delegate#fluent(name) - -A unique type of "accessor" that works for a "fluent" API. When called as a -getter, the method returns the expected value. However, if the method is called -with a value, it will return itself so it can be chained. For example: - -```js -delegate(proto, 'request') - .fluent('query') - -// getter -var q = request.query(); - -// setter (chainable) -request - .query({ a: 1 }) - .query({ b: 2 }); -``` - -# License - - MIT diff --git a/node_modules/delegates/index.js b/node_modules/delegates/index.js deleted file mode 100644 index 17c222d..0000000 --- a/node_modules/delegates/index.js +++ /dev/null @@ -1,121 +0,0 @@ - -/** - * Expose `Delegator`. - */ - -module.exports = Delegator; - -/** - * Initialize a delegator. - * - * @param {Object} proto - * @param {String} target - * @api public - */ - -function Delegator(proto, target) { - if (!(this instanceof Delegator)) return new Delegator(proto, target); - this.proto = proto; - this.target = target; - this.methods = []; - this.getters = []; - this.setters = []; - this.fluents = []; -} - -/** - * Delegate method `name`. - * - * @param {String} name - * @return {Delegator} self - * @api public - */ - -Delegator.prototype.method = function(name){ - var proto = this.proto; - var target = this.target; - this.methods.push(name); - - proto[name] = function(){ - return this[target][name].apply(this[target], arguments); - }; - - return this; -}; - -/** - * Delegator accessor `name`. - * - * @param {String} name - * @return {Delegator} self - * @api public - */ - -Delegator.prototype.access = function(name){ - return this.getter(name).setter(name); -}; - -/** - * Delegator getter `name`. - * - * @param {String} name - * @return {Delegator} self - * @api public - */ - -Delegator.prototype.getter = function(name){ - var proto = this.proto; - var target = this.target; - this.getters.push(name); - - proto.__defineGetter__(name, function(){ - return this[target][name]; - }); - - return this; -}; - -/** - * Delegator setter `name`. - * - * @param {String} name - * @return {Delegator} self - * @api public - */ - -Delegator.prototype.setter = function(name){ - var proto = this.proto; - var target = this.target; - this.setters.push(name); - - proto.__defineSetter__(name, function(val){ - return this[target][name] = val; - }); - - return this; -}; - -/** - * Delegator fluent accessor - * - * @param {String} name - * @return {Delegator} self - * @api public - */ - -Delegator.prototype.fluent = function (name) { - var proto = this.proto; - var target = this.target; - this.fluents.push(name); - - proto[name] = function(val){ - if ('undefined' != typeof val) { - this[target][name] = val; - return this; - } else { - return this[target][name]; - } - }; - - return this; -}; diff --git a/node_modules/delegates/package.json b/node_modules/delegates/package.json deleted file mode 100644 index 224ef45..0000000 --- a/node_modules/delegates/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "_from": "delegates@^1.0.0", - "_id": "delegates@1.0.0", - "_inBundle": false, - "_integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "_location": "/delegates", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "delegates@^1.0.0", - "name": "delegates", - "escapedName": "delegates", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/are-we-there-yet" - ], - "_resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "_shasum": "84c6e159b81904fdca59a0ef44cd870d31250f9a", - "_spec": "delegates@^1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/are-we-there-yet", - "bugs": { - "url": "https://github.com/visionmedia/node-delegates/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "delegate methods and accessors to another property", - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "homepage": "https://github.com/visionmedia/node-delegates#readme", - "keywords": [ - "delegate", - "delegation" - ], - "license": "MIT", - "name": "delegates", - "repository": { - "type": "git", - "url": "git+https://github.com/visionmedia/node-delegates.git" - }, - "version": "1.0.0" -} diff --git a/node_modules/delegates/test/index.js b/node_modules/delegates/test/index.js deleted file mode 100644 index 7b6e3d4..0000000 --- a/node_modules/delegates/test/index.js +++ /dev/null @@ -1,94 +0,0 @@ - -var assert = require('assert'); -var delegate = require('..'); - -describe('.method(name)', function(){ - it('should delegate methods', function(){ - var obj = {}; - - obj.request = { - foo: function(bar){ - assert(this == obj.request); - return bar; - } - }; - - delegate(obj, 'request').method('foo'); - - obj.foo('something').should.equal('something'); - }) -}) - -describe('.getter(name)', function(){ - it('should delegate getters', function(){ - var obj = {}; - - obj.request = { - get type() { - return 'text/html'; - } - } - - delegate(obj, 'request').getter('type'); - - obj.type.should.equal('text/html'); - }) -}) - -describe('.setter(name)', function(){ - it('should delegate setters', function(){ - var obj = {}; - - obj.request = { - get type() { - return this._type.toUpperCase(); - }, - - set type(val) { - this._type = val; - } - } - - delegate(obj, 'request').setter('type'); - - obj.type = 'hey'; - obj.request.type.should.equal('HEY'); - }) -}) - -describe('.access(name)', function(){ - it('should delegate getters and setters', function(){ - var obj = {}; - - obj.request = { - get type() { - return this._type.toUpperCase(); - }, - - set type(val) { - this._type = val; - } - } - - delegate(obj, 'request').access('type'); - - obj.type = 'hey'; - obj.type.should.equal('HEY'); - }) -}) - -describe('.fluent(name)', function () { - it('should delegate in a fluent fashion', function () { - var obj = { - settings: { - env: 'development' - } - }; - - delegate(obj, 'settings').fluent('env'); - - obj.env().should.equal('development'); - obj.env('production').should.equal(obj); - obj.settings.env.should.equal('production'); - }) -}) diff --git a/node_modules/detect-libc/.npmignore b/node_modules/detect-libc/.npmignore deleted file mode 100644 index 8fc0e8d..0000000 --- a/node_modules/detect-libc/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -.nyc_output -.travis.yml -coverage -test.js -node_modules -/.circleci -/tests/integration diff --git a/node_modules/detect-libc/LICENSE b/node_modules/detect-libc/LICENSE deleted file mode 100644 index 8dada3e..0000000 --- a/node_modules/detect-libc/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/detect-libc/README.md b/node_modules/detect-libc/README.md deleted file mode 100644 index 3176357..0000000 --- a/node_modules/detect-libc/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# detect-libc - -Node.js module to detect the C standard library (libc) implementation -family and version in use on a given Linux system. - -Provides a value suitable for use with the `LIBC` option of -[prebuild](https://www.npmjs.com/package/prebuild), -[prebuild-ci](https://www.npmjs.com/package/prebuild-ci) and -[prebuild-install](https://www.npmjs.com/package/prebuild-install), -therefore allowing build and provision of pre-compiled binaries -for musl-based Linux e.g. Alpine as well as glibc-based. - -Currently supports libc detection of `glibc` and `musl`. - -## Install - -```sh -npm install detect-libc -``` - -## Usage - -### API - -```js -const { GLIBC, MUSL, family, version, isNonGlibcLinux } = require('detect-libc'); -``` - -* `GLIBC` is a String containing the value "glibc" for comparison with `family`. -* `MUSL` is a String containing the value "musl" for comparison with `family`. -* `family` is a String representing the system libc family. -* `version` is a String representing the system libc version number. -* `isNonGlibcLinux` is a Boolean representing whether the system is a non-glibc Linux, e.g. Alpine. - -### detect-libc command line tool - -When run on a Linux system with a non-glibc libc, -the child command will be run with the `LIBC` environment variable -set to the relevant value. - -On all other platforms will run the child command as-is. - -The command line feature requires `spawnSync` provided by Node v0.12+. - -```sh -detect-libc child-command -``` - -## Integrating with prebuild - -```json - "scripts": { - "install": "detect-libc prebuild-install || node-gyp rebuild", - "test": "mocha && detect-libc prebuild-ci" - }, - "dependencies": { - "detect-libc": "^1.0.2", - "prebuild-install": "^2.2.0" - }, - "devDependencies": { - "prebuild": "^6.2.1", - "prebuild-ci": "^2.2.3" - } -``` - -## Licence - -Copyright 2017 Lovell Fuller - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/node_modules/detect-libc/bin/detect-libc.js b/node_modules/detect-libc/bin/detect-libc.js deleted file mode 100755 index 5486127..0000000 --- a/node_modules/detect-libc/bin/detect-libc.js +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env node - -'use strict'; - -var spawnSync = require('child_process').spawnSync; -var libc = require('../'); - -var spawnOptions = { - env: process.env, - shell: true, - stdio: 'inherit' -}; - -if (libc.isNonGlibcLinux) { - spawnOptions.env.LIBC = process.env.LIBC || libc.family; -} - -process.exit(spawnSync(process.argv[2], process.argv.slice(3), spawnOptions).status); diff --git a/node_modules/detect-libc/lib/detect-libc.js b/node_modules/detect-libc/lib/detect-libc.js deleted file mode 100644 index 1855fe1..0000000 --- a/node_modules/detect-libc/lib/detect-libc.js +++ /dev/null @@ -1,92 +0,0 @@ -'use strict'; - -var platform = require('os').platform(); -var spawnSync = require('child_process').spawnSync; -var readdirSync = require('fs').readdirSync; - -var GLIBC = 'glibc'; -var MUSL = 'musl'; - -var spawnOptions = { - encoding: 'utf8', - env: process.env -}; - -if (!spawnSync) { - spawnSync = function () { - return { status: 126, stdout: '', stderr: '' }; - }; -} - -function contains (needle) { - return function (haystack) { - return haystack.indexOf(needle) !== -1; - }; -} - -function versionFromMuslLdd (out) { - return out.split(/[\r\n]+/)[1].trim().split(/\s/)[1]; -} - -function safeReaddirSync (path) { - try { - return readdirSync(path); - } catch (e) {} - return []; -} - -var family = ''; -var version = ''; -var method = ''; - -if (platform === 'linux') { - // Try getconf - var glibc = spawnSync('getconf', ['GNU_LIBC_VERSION'], spawnOptions); - if (glibc.status === 0) { - family = GLIBC; - version = glibc.stdout.trim().split(' ')[1]; - method = 'getconf'; - } else { - // Try ldd - var ldd = spawnSync('ldd', ['--version'], spawnOptions); - if (ldd.status === 0 && ldd.stdout.indexOf(MUSL) !== -1) { - family = MUSL; - version = versionFromMuslLdd(ldd.stdout); - method = 'ldd'; - } else if (ldd.status === 1 && ldd.stderr.indexOf(MUSL) !== -1) { - family = MUSL; - version = versionFromMuslLdd(ldd.stderr); - method = 'ldd'; - } else { - // Try filesystem (family only) - var lib = safeReaddirSync('/lib'); - if (lib.some(contains('-linux-gnu'))) { - family = GLIBC; - method = 'filesystem'; - } else if (lib.some(contains('libc.musl-'))) { - family = MUSL; - method = 'filesystem'; - } else if (lib.some(contains('ld-musl-'))) { - family = MUSL; - method = 'filesystem'; - } else { - var usrSbin = safeReaddirSync('/usr/sbin'); - if (usrSbin.some(contains('glibc'))) { - family = GLIBC; - method = 'filesystem'; - } - } - } - } -} - -var isNonGlibcLinux = (family !== '' && family !== GLIBC); - -module.exports = { - GLIBC: GLIBC, - MUSL: MUSL, - family: family, - version: version, - method: method, - isNonGlibcLinux: isNonGlibcLinux -}; diff --git a/node_modules/detect-libc/package.json b/node_modules/detect-libc/package.json deleted file mode 100644 index d1800f1..0000000 --- a/node_modules/detect-libc/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "_from": "detect-libc@^1.0.2", - "_id": "detect-libc@1.0.3", - "_inBundle": false, - "_integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", - "_location": "/detect-libc", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "detect-libc@^1.0.2", - "name": "detect-libc", - "escapedName": "detect-libc", - "rawSpec": "^1.0.2", - "saveSpec": null, - "fetchSpec": "^1.0.2" - }, - "_requiredBy": [ - "/node-pre-gyp" - ], - "_resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "_shasum": "fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b", - "_spec": "detect-libc@^1.0.2", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/node-pre-gyp", - "author": { - "name": "Lovell Fuller", - "email": "npm@lovell.info" - }, - "bin": { - "detect-libc": "bin/detect-libc.js" - }, - "bugs": { - "url": "https://github.com/lovell/detect-libc/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Niklas Salmoukas", - "email": "niklas@salmoukas.com" - } - ], - "deprecated": false, - "description": "Node.js module to detect the C standard library (libc) implementation family and version", - "devDependencies": { - "ava": "^0.23.0", - "nyc": "^11.3.0", - "proxyquire": "^1.8.0", - "semistandard": "^11.0.0" - }, - "engines": { - "node": ">=0.10" - }, - "homepage": "https://github.com/lovell/detect-libc#readme", - "keywords": [ - "libc", - "glibc", - "musl" - ], - "license": "Apache-2.0", - "main": "lib/detect-libc.js", - "name": "detect-libc", - "repository": { - "type": "git", - "url": "git://github.com/lovell/detect-libc.git" - }, - "scripts": { - "test": "semistandard && nyc --reporter=lcov ava" - }, - "version": "1.0.3" -} diff --git a/node_modules/emoji-regex/LICENSE-MIT.txt b/node_modules/emoji-regex/LICENSE-MIT.txt deleted file mode 100644 index a41e0a7..0000000 --- a/node_modules/emoji-regex/LICENSE-MIT.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright Mathias Bynens - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/emoji-regex/README.md b/node_modules/emoji-regex/README.md deleted file mode 100644 index f10e173..0000000 --- a/node_modules/emoji-regex/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# emoji-regex [![Build status](https://travis-ci.org/mathiasbynens/emoji-regex.svg?branch=master)](https://travis-ci.org/mathiasbynens/emoji-regex) - -_emoji-regex_ offers a regular expression to match all emoji symbols (including textual representations of emoji) as per the Unicode Standard. - -This repository contains a script that generates this regular expression based on [the data from Unicode v12](https://github.com/mathiasbynens/unicode-12.0.0). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard. - -## Installation - -Via [npm](https://www.npmjs.com/): - -```bash -npm install emoji-regex -``` - -In [Node.js](https://nodejs.org/): - -```js -const emojiRegex = require('emoji-regex'); -// Note: because the regular expression has the global flag set, this module -// exports a function that returns the regex rather than exporting the regular -// expression itself, to make it impossible to (accidentally) mutate the -// original regular expression. - -const text = ` -\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation) -\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji -\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base) -\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier -`; - -const regex = emojiRegex(); -let match; -while (match = regex.exec(text)) { - const emoji = match[0]; - console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`); -} -``` - -Console output: - -``` -Matched sequence ⌚ — code points: 1 -Matched sequence ⌚ — code points: 1 -Matched sequence ↔️ — code points: 2 -Matched sequence ↔️ — code points: 2 -Matched sequence 👩 — code points: 1 -Matched sequence 👩 — code points: 1 -Matched sequence 👩🏿 — code points: 2 -Matched sequence 👩🏿 — code points: 2 -``` - -To match emoji in their textual representation as well (i.e. emoji that are not `Emoji_Presentation` symbols and that aren’t forced to render as emoji by a variation selector), `require` the other regex: - -```js -const emojiRegex = require('emoji-regex/text.js'); -``` - -Additionally, in environments which support ES2015 Unicode escapes, you may `require` ES2015-style versions of the regexes: - -```js -const emojiRegex = require('emoji-regex/es2015/index.js'); -const emojiRegexText = require('emoji-regex/es2015/text.js'); -``` - -## Author - -| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | -|---| -| [Mathias Bynens](https://mathiasbynens.be/) | - -## License - -_emoji-regex_ is available under the [MIT](https://mths.be/mit) license. diff --git a/node_modules/emoji-regex/es2015/index.js b/node_modules/emoji-regex/es2015/index.js deleted file mode 100644 index b4cf3dc..0000000 --- a/node_modules/emoji-regex/es2015/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; - -module.exports = () => { - // https://mths.be/emoji - return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F3F4}\u200D\u2620)\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F415}\u200D\u{1F9BA}|\u{1F469}\u200D\u{1F466}|\u{1F469}\u200D\u{1F467}|\u{1F1FD}\u{1F1F0}|\u{1F1F4}\u{1F1F2}|\u{1F1F6}\u{1F1E6}|[#\*0-9]\uFE0F\u20E3|\u{1F1E7}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EF}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1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3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]\uFE0F|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; -}; diff --git a/node_modules/emoji-regex/es2015/text.js b/node_modules/emoji-regex/es2015/text.js deleted file mode 100644 index 780309d..0000000 --- a/node_modules/emoji-regex/es2015/text.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; - -module.exports = () => { - // https://mths.be/emoji - return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D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\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]\uFE0F?|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; -}; diff --git a/node_modules/emoji-regex/index.d.ts b/node_modules/emoji-regex/index.d.ts deleted file mode 100644 index 1955b47..0000000 --- a/node_modules/emoji-regex/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module 'emoji-regex' { - function emojiRegex(): RegExp; - - export default emojiRegex; -} - -declare module 'emoji-regex/text' { - function emojiRegex(): RegExp; - - export default emojiRegex; -} - -declare module 'emoji-regex/es2015' { - function emojiRegex(): RegExp; - - export default emojiRegex; -} - -declare module 'emoji-regex/es2015/text' { - function emojiRegex(): RegExp; - - export default emojiRegex; -} diff --git a/node_modules/emoji-regex/index.js b/node_modules/emoji-regex/index.js deleted file mode 100644 index d993a3a..0000000 --- a/node_modules/emoji-regex/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; - -module.exports = function () { - // https://mths.be/emoji - return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\u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83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; -}; diff --git a/node_modules/emoji-regex/package.json b/node_modules/emoji-regex/package.json deleted file mode 100644 index 3817096..0000000 --- a/node_modules/emoji-regex/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "_from": "emoji-regex@^8.0.0", - "_id": "emoji-regex@8.0.0", - "_inBundle": false, - "_integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "_location": "/emoji-regex", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "emoji-regex@^8.0.0", - "name": "emoji-regex", - "escapedName": "emoji-regex", - "rawSpec": "^8.0.0", - "saveSpec": null, - "fetchSpec": "^8.0.0" - }, - "_requiredBy": [ - "/cliui/string-width", - "/wrap-ansi/string-width", - "/yargs/string-width" - ], - "_resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "_shasum": "e818fd69ce5ccfcb404594f842963bf53164cc37", - "_spec": "emoji-regex@^8.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/cliui/node_modules/string-width", - "author": { - "name": "Mathias Bynens", - "url": "https://mathiasbynens.be/" - }, - "bugs": { - "url": "https://github.com/mathiasbynens/emoji-regex/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.", - "devDependencies": { - "@babel/cli": "^7.2.3", - "@babel/core": "^7.3.4", - "@babel/plugin-proposal-unicode-property-regex": "^7.2.0", - "@babel/preset-env": "^7.3.4", - "mocha": "^6.0.2", - "regexgen": "^1.3.0", - "unicode-12.0.0": "^0.7.9" - }, - "files": [ - "LICENSE-MIT.txt", - "index.js", - "index.d.ts", - "text.js", - "es2015/index.js", - "es2015/text.js" - ], - "homepage": "https://mths.be/emoji-regex", - "keywords": [ - "unicode", - "regex", - "regexp", - "regular expressions", - "code points", - "symbols", - "characters", - "emoji" - ], - "license": "MIT", - "main": "index.js", - "name": "emoji-regex", - "repository": { - "type": "git", - "url": "git+https://github.com/mathiasbynens/emoji-regex.git" - }, - "scripts": { - "build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src -d ./es2015; node script/inject-sequences.js", - "test": "mocha", - "test:watch": "npm run test -- --watch" - }, - "types": "index.d.ts", - "version": "8.0.0" -} diff --git a/node_modules/emoji-regex/text.js b/node_modules/emoji-regex/text.js deleted file mode 100644 index 0a55ce2..0000000 --- a/node_modules/emoji-regex/text.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; - -module.exports = function () { - // https://mths.be/emoji - return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uD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267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F?|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; -}; diff --git a/node_modules/fast-deep-equal/LICENSE b/node_modules/fast-deep-equal/LICENSE deleted file mode 100644 index 7f15435..0000000 --- a/node_modules/fast-deep-equal/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Evgeny Poberezkin - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/fast-deep-equal/README.md b/node_modules/fast-deep-equal/README.md deleted file mode 100644 index d3f4ffc..0000000 --- a/node_modules/fast-deep-equal/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# fast-deep-equal -The fastest deep equal with ES6 Map, Set and Typed arrays support. - -[![Build Status](https://travis-ci.org/epoberezkin/fast-deep-equal.svg?branch=master)](https://travis-ci.org/epoberezkin/fast-deep-equal) -[![npm](https://img.shields.io/npm/v/fast-deep-equal.svg)](https://www.npmjs.com/package/fast-deep-equal) -[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/fast-deep-equal/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/fast-deep-equal?branch=master) - - -## Install - -```bash -npm install fast-deep-equal -``` - - -## Features - -- ES5 compatible -- works in node.js (8+) and browsers (IE9+) -- checks equality of Date and RegExp objects by value. - -ES6 equal (`require('fast-deep-equal/es6')`) also supports: -- Maps -- Sets -- Typed arrays - - -## Usage - -```javascript -var equal = require('fast-deep-equal'); -console.log(equal({foo: 'bar'}, {foo: 'bar'})); // true -``` - -To support ES6 Maps, Sets and Typed arrays equality use: - -```javascript -var equal = require('fast-deep-equal/es6'); -console.log(equal(Int16Array([1, 2]), Int16Array([1, 2]))); // true -``` - -To use with React (avoiding the traversal of React elements' _owner -property that contains circular references and is not needed when -comparing the elements - borrowed from [react-fast-compare](https://github.com/FormidableLabs/react-fast-compare)): - -```javascript -var equal = require('fast-deep-equal/react'); -var equal = require('fast-deep-equal/es6/react'); -``` - - -## Performance benchmark - -Node.js v12.6.0: - -``` -fast-deep-equal x 261,950 ops/sec ±0.52% (89 runs sampled) -fast-deep-equal/es6 x 212,991 ops/sec ±0.34% (92 runs sampled) -fast-equals x 230,957 ops/sec ±0.83% (85 runs sampled) -nano-equal x 187,995 ops/sec ±0.53% (88 runs sampled) -shallow-equal-fuzzy x 138,302 ops/sec ±0.49% (90 runs sampled) -underscore.isEqual x 74,423 ops/sec ±0.38% (89 runs sampled) -lodash.isEqual x 36,637 ops/sec ±0.72% (90 runs sampled) -deep-equal x 2,310 ops/sec ±0.37% (90 runs sampled) -deep-eql x 35,312 ops/sec ±0.67% (91 runs sampled) -ramda.equals x 12,054 ops/sec ±0.40% (91 runs sampled) -util.isDeepStrictEqual x 46,440 ops/sec ±0.43% (90 runs sampled) -assert.deepStrictEqual x 456 ops/sec ±0.71% (88 runs sampled) - -The fastest is fast-deep-equal -``` - -To run benchmark (requires node.js 6+): - -```bash -npm run benchmark -``` - -__Please note__: this benchmark runs against the available test cases. To choose the most performant library for your application, it is recommended to benchmark against your data and to NOT expect this benchmark to reflect the performance difference in your application. - - -## Enterprise support - -fast-deep-equal package is a part of [Tidelift enterprise subscription](https://tidelift.com/subscription/pkg/npm-fast-deep-equal?utm_source=npm-fast-deep-equal&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers. - - -## Security contact - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues. - - -## License - -[MIT](https://github.com/epoberezkin/fast-deep-equal/blob/master/LICENSE) diff --git a/node_modules/fast-deep-equal/es6/index.d.ts b/node_modules/fast-deep-equal/es6/index.d.ts deleted file mode 100644 index c7eb9c7..0000000 --- a/node_modules/fast-deep-equal/es6/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const equal: (a: any, b: any) => boolean; -export = equal; diff --git a/node_modules/fast-deep-equal/es6/index.js b/node_modules/fast-deep-equal/es6/index.js deleted file mode 100644 index d980be2..0000000 --- a/node_modules/fast-deep-equal/es6/index.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -// do not edit .js files directly - edit src/index.jst - - - var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; - - -module.exports = function equal(a, b) { - if (a === b) return true; - - if (a && b && typeof a == 'object' && typeof b == 'object') { - if (a.constructor !== b.constructor) return false; - - var length, i, keys; - if (Array.isArray(a)) { - length = a.length; - if (length != b.length) return false; - for (i = length; i-- !== 0;) - if (!equal(a[i], b[i])) return false; - return true; - } - - - if ((a instanceof Map) && (b instanceof Map)) { - if (a.size !== b.size) return false; - for (i of a.entries()) - if (!b.has(i[0])) return false; - for (i of a.entries()) - if (!equal(i[1], b.get(i[0]))) return false; - return true; - } - - if ((a instanceof Set) && (b instanceof Set)) { - if (a.size !== b.size) return false; - for (i of a.entries()) - if (!b.has(i[0])) return false; - return true; - } - - if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { - length = a.length; - if (length != b.length) return false; - for (i = length; i-- !== 0;) - if (a[i] !== b[i]) return false; - return true; - } - - - if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; - if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); - if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); - - keys = Object.keys(a); - length = keys.length; - if (length !== Object.keys(b).length) return false; - - for (i = length; i-- !== 0;) - if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; - - for (i = length; i-- !== 0;) { - var key = keys[i]; - - if (!equal(a[key], b[key])) return false; - } - - return true; - } - - // true if both NaN, false otherwise - return a!==a && b!==b; -}; diff --git a/node_modules/fast-deep-equal/es6/react.d.ts b/node_modules/fast-deep-equal/es6/react.d.ts deleted file mode 100644 index c7eb9c7..0000000 --- a/node_modules/fast-deep-equal/es6/react.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const equal: (a: any, b: any) => boolean; -export = equal; diff --git a/node_modules/fast-deep-equal/es6/react.js b/node_modules/fast-deep-equal/es6/react.js deleted file mode 100644 index 98e2f9b..0000000 --- a/node_modules/fast-deep-equal/es6/react.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict'; - -// do not edit .js files directly - edit src/index.jst - - - var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; - - -module.exports = function equal(a, b) { - if (a === b) return true; - - if (a && b && typeof a == 'object' && typeof b == 'object') { - if (a.constructor !== b.constructor) return false; - - var length, i, keys; - if (Array.isArray(a)) { - length = a.length; - if (length != b.length) return false; - for (i = length; i-- !== 0;) - if (!equal(a[i], b[i])) return false; - return true; - } - - - if ((a instanceof Map) && (b instanceof Map)) { - if (a.size !== b.size) return false; - for (i of a.entries()) - if (!b.has(i[0])) return false; - for (i of a.entries()) - if (!equal(i[1], b.get(i[0]))) return false; - return true; - } - - if ((a instanceof Set) && (b instanceof Set)) { - if (a.size !== b.size) return false; - for (i of a.entries()) - if (!b.has(i[0])) return false; - return true; - } - - if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { - length = a.length; - if (length != b.length) return false; - for (i = length; i-- !== 0;) - if (a[i] !== b[i]) return false; - return true; - } - - - if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; - if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); - if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); - - keys = Object.keys(a); - length = keys.length; - if (length !== Object.keys(b).length) return false; - - for (i = length; i-- !== 0;) - if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; - - for (i = length; i-- !== 0;) { - var key = keys[i]; - - if (key === '_owner' && a.$$typeof) { - // React-specific: avoid traversing React elements' _owner. - // _owner contains circular references - // and is not needed when comparing the actual elements (and not their owners) - continue; - } - - if (!equal(a[key], b[key])) return false; - } - - return true; - } - - // true if both NaN, false otherwise - return a!==a && b!==b; -}; diff --git a/node_modules/fast-deep-equal/index.d.ts b/node_modules/fast-deep-equal/index.d.ts deleted file mode 100644 index 3c042ca..0000000 --- a/node_modules/fast-deep-equal/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module 'fast-deep-equal' { - const equal: (a: any, b: any) => boolean; - export = equal; -} diff --git a/node_modules/fast-deep-equal/index.js b/node_modules/fast-deep-equal/index.js deleted file mode 100644 index 30dd1ba..0000000 --- a/node_modules/fast-deep-equal/index.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -// do not edit .js files directly - edit src/index.jst - - - -module.exports = function equal(a, b) { - if (a === b) return true; - - if (a && b && typeof a == 'object' && typeof b == 'object') { - if (a.constructor !== b.constructor) return false; - - var length, i, keys; - if (Array.isArray(a)) { - length = a.length; - if (length != b.length) return false; - for (i = length; i-- !== 0;) - if (!equal(a[i], b[i])) return false; - return true; - } - - - - if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; - if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); - if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); - - keys = Object.keys(a); - length = keys.length; - if (length !== Object.keys(b).length) return false; - - for (i = length; i-- !== 0;) - if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; - - for (i = length; i-- !== 0;) { - var key = keys[i]; - - if (!equal(a[key], b[key])) return false; - } - - return true; - } - - // true if both NaN, false otherwise - return a!==a && b!==b; -}; diff --git a/node_modules/fast-deep-equal/package.json b/node_modules/fast-deep-equal/package.json deleted file mode 100644 index e58244d..0000000 --- a/node_modules/fast-deep-equal/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_from": "fast-deep-equal@~3.1.3", - "_id": "fast-deep-equal@3.1.3", - "_inBundle": false, - "_integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "_location": "/fast-deep-equal", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "fast-deep-equal@~3.1.3", - "name": "fast-deep-equal", - "escapedName": "fast-deep-equal", - "rawSpec": "~3.1.3", - "saveSpec": null, - "fetchSpec": "~3.1.3" - }, - "_requiredBy": [ - "/vega-lite" - ], - "_resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "_shasum": "3a7d56b559d6cbc3eb512325244e619a65c6c525", - "_spec": "fast-deep-equal@~3.1.3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-lite", - "author": { - "name": "Evgeny Poberezkin" - }, - "bugs": { - "url": "https://github.com/epoberezkin/fast-deep-equal/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Fast deep equal", - "devDependencies": { - "coveralls": "^3.1.0", - "dot": "^1.1.2", - "eslint": "^7.2.0", - "mocha": "^7.2.0", - "nyc": "^15.1.0", - "pre-commit": "^1.2.2", - "react": "^16.12.0", - "react-test-renderer": "^16.12.0", - "sinon": "^9.0.2", - "typescript": "^3.9.5" - }, - "files": [ - "index.js", - "index.d.ts", - "react.js", - "react.d.ts", - "es6/" - ], - "homepage": "https://github.com/epoberezkin/fast-deep-equal#readme", - "keywords": [ - "fast", - "equal", - "deep-equal" - ], - "license": "MIT", - "main": "index.js", - "name": "fast-deep-equal", - "nyc": { - "exclude": [ - "**/spec/**", - "node_modules" - ], - "reporter": [ - "lcov", - "text-summary" - ] - }, - "repository": { - "type": "git", - "url": "git+https://github.com/epoberezkin/fast-deep-equal.git" - }, - "scripts": { - "benchmark": "npm i && npm run build && cd ./benchmark && npm i && node ./", - "build": "node build", - "eslint": "eslint *.js benchmark/*.js spec/*.js", - "prepublish": "npm run build", - "test": "npm run build && npm run eslint && npm run test-ts && npm run test-cov", - "test-cov": "nyc npm run test-spec", - "test-spec": "mocha spec/*.spec.js -R spec", - "test-ts": "tsc --target ES5 --noImplicitAny index.d.ts" - }, - "types": "index.d.ts", - "version": "3.1.3" -} diff --git a/node_modules/fast-deep-equal/react.d.ts b/node_modules/fast-deep-equal/react.d.ts deleted file mode 100644 index c7eb9c7..0000000 --- a/node_modules/fast-deep-equal/react.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const equal: (a: any, b: any) => boolean; -export = equal; diff --git a/node_modules/fast-deep-equal/react.js b/node_modules/fast-deep-equal/react.js deleted file mode 100644 index 3489b98..0000000 --- a/node_modules/fast-deep-equal/react.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -// do not edit .js files directly - edit src/index.jst - - - -module.exports = function equal(a, b) { - if (a === b) return true; - - if (a && b && typeof a == 'object' && typeof b == 'object') { - if (a.constructor !== b.constructor) return false; - - var length, i, keys; - if (Array.isArray(a)) { - length = a.length; - if (length != b.length) return false; - for (i = length; i-- !== 0;) - if (!equal(a[i], b[i])) return false; - return true; - } - - - - if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; - if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); - if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); - - keys = Object.keys(a); - length = keys.length; - if (length !== Object.keys(b).length) return false; - - for (i = length; i-- !== 0;) - if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; - - for (i = length; i-- !== 0;) { - var key = keys[i]; - - if (key === '_owner' && a.$$typeof) { - // React-specific: avoid traversing React elements' _owner. - // _owner contains circular references - // and is not needed when comparing the actual elements (and not their owners) - continue; - } - - if (!equal(a[key], b[key])) return false; - } - - return true; - } - - // true if both NaN, false otherwise - return a!==a && b!==b; -}; diff --git a/node_modules/fast-json-stable-stringify/.eslintrc.yml b/node_modules/fast-json-stable-stringify/.eslintrc.yml deleted file mode 100644 index 1c77b0d..0000000 --- a/node_modules/fast-json-stable-stringify/.eslintrc.yml +++ /dev/null @@ -1,26 +0,0 @@ -extends: eslint:recommended -env: - node: true - browser: true -rules: - block-scoped-var: 2 - callback-return: 2 - dot-notation: 2 - indent: 2 - linebreak-style: [2, unix] - new-cap: 2 - no-console: [2, allow: [warn, error]] - no-else-return: 2 - no-eq-null: 2 - no-fallthrough: 2 - no-invalid-this: 2 - no-return-assign: 2 - no-shadow: 1 - no-trailing-spaces: 2 - no-use-before-define: [2, nofunc] - quotes: [2, single, avoid-escape] - semi: [2, always] - strict: [2, global] - valid-jsdoc: [2, requireReturn: false] - no-control-regex: 0 - no-useless-escape: 2 diff --git a/node_modules/fast-json-stable-stringify/.github/FUNDING.yml b/node_modules/fast-json-stable-stringify/.github/FUNDING.yml deleted file mode 100644 index 61f9daa..0000000 --- a/node_modules/fast-json-stable-stringify/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -tidelift: "npm/fast-json-stable-stringify" diff --git a/node_modules/fast-json-stable-stringify/.travis.yml b/node_modules/fast-json-stable-stringify/.travis.yml deleted file mode 100644 index b61e8f0..0000000 --- a/node_modules/fast-json-stable-stringify/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - "8" - - "10" - - "12" - - "13" -after_script: - - coveralls < coverage/lcov.info diff --git a/node_modules/fast-json-stable-stringify/LICENSE b/node_modules/fast-json-stable-stringify/LICENSE deleted file mode 100644 index c932223..0000000 --- a/node_modules/fast-json-stable-stringify/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -This software is released under the MIT license: - -Copyright (c) 2017 Evgeny Poberezkin -Copyright (c) 2013 James Halliday - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/fast-json-stable-stringify/README.md b/node_modules/fast-json-stable-stringify/README.md deleted file mode 100644 index 02cf49f..0000000 --- a/node_modules/fast-json-stable-stringify/README.md +++ /dev/null @@ -1,131 +0,0 @@ -# fast-json-stable-stringify - -Deterministic `JSON.stringify()` - a faster version of [@substack](https://github.com/substack)'s json-stable-strigify without [jsonify](https://github.com/substack/jsonify). - -You can also pass in a custom comparison function. - -[![Build Status](https://travis-ci.org/epoberezkin/fast-json-stable-stringify.svg?branch=master)](https://travis-ci.org/epoberezkin/fast-json-stable-stringify) -[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/fast-json-stable-stringify/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/fast-json-stable-stringify?branch=master) - -# example - -``` js -var stringify = require('fast-json-stable-stringify'); -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -console.log(stringify(obj)); -``` - -output: - -``` -{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8} -``` - - -# methods - -``` js -var stringify = require('fast-json-stable-stringify') -``` - -## var str = stringify(obj, opts) - -Return a deterministic stringified string `str` from the object `obj`. - - -## options - -### cmp - -If `opts` is given, you can supply an `opts.cmp` to have a custom comparison -function for object keys. Your function `opts.cmp` is called with these -parameters: - -``` js -opts.cmp({ key: akey, value: avalue }, { key: bkey, value: bvalue }) -``` - -For example, to sort on the object key names in reverse order you could write: - -``` js -var stringify = require('fast-json-stable-stringify'); - -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -var s = stringify(obj, function (a, b) { - return a.key < b.key ? 1 : -1; -}); -console.log(s); -``` - -which results in the output string: - -``` -{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3} -``` - -Or if you wanted to sort on the object values in reverse order, you could write: - -``` -var stringify = require('fast-json-stable-stringify'); - -var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 }; -var s = stringify(obj, function (a, b) { - return a.value < b.value ? 1 : -1; -}); -console.log(s); -``` - -which outputs: - -``` -{"d":6,"c":5,"b":[{"z":3,"y":2,"x":1},9],"a":10} -``` - -### cycles - -Pass `true` in `opts.cycles` to stringify circular property as `__cycle__` - the result will not be a valid JSON string in this case. - -TypeError will be thrown in case of circular object without this option. - - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install fast-json-stable-stringify -``` - - -# benchmark - -To run benchmark (requires Node.js 6+): -``` -node benchmark -``` - -Results: -``` -fast-json-stable-stringify x 17,189 ops/sec ±1.43% (83 runs sampled) -json-stable-stringify x 13,634 ops/sec ±1.39% (85 runs sampled) -fast-stable-stringify x 20,212 ops/sec ±1.20% (84 runs sampled) -faster-stable-stringify x 15,549 ops/sec ±1.12% (84 runs sampled) -The fastest is fast-stable-stringify -``` - - -## Enterprise support - -fast-json-stable-stringify package is a part of [Tidelift enterprise subscription](https://tidelift.com/subscription/pkg/npm-fast-json-stable-stringify?utm_source=npm-fast-json-stable-stringify&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers. - - -## Security contact - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues. - - -# license - -[MIT](https://github.com/epoberezkin/fast-json-stable-stringify/blob/master/LICENSE) diff --git a/node_modules/fast-json-stable-stringify/benchmark/index.js b/node_modules/fast-json-stable-stringify/benchmark/index.js deleted file mode 100644 index e725f9f..0000000 --- a/node_modules/fast-json-stable-stringify/benchmark/index.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -const Benchmark = require('benchmark'); -const suite = new Benchmark.Suite; -const testData = require('./test.json'); - - -const stringifyPackages = { - // 'JSON.stringify': JSON.stringify, - 'fast-json-stable-stringify': require('../index'), - 'json-stable-stringify': true, - 'fast-stable-stringify': true, - 'faster-stable-stringify': true -}; - - -for (const name in stringifyPackages) { - let func = stringifyPackages[name]; - if (func === true) func = require(name); - - suite.add(name, function() { - func(testData); - }); -} - -suite - .on('cycle', (event) => console.log(String(event.target))) - .on('complete', function () { - console.log('The fastest is ' + this.filter('fastest').map('name')); - }) - .run({async: true}); diff --git a/node_modules/fast-json-stable-stringify/benchmark/test.json b/node_modules/fast-json-stable-stringify/benchmark/test.json deleted file mode 100644 index c9118c1..0000000 --- a/node_modules/fast-json-stable-stringify/benchmark/test.json +++ /dev/null @@ -1,137 +0,0 @@ -[ - { - "_id": "59ef4a83ee8364808d761beb", - "index": 0, - "guid": "e50ffae9-7128-4148-9ee5-40c3fc523c5d", - "isActive": false, - "balance": "$2,341.81", - "picture": "http://placehold.it/32x32", - "age": 28, - "eyeColor": "brown", - "name": "Carey Savage", - "gender": "female", - "company": "VERAQ", - "email": "careysavage@veraq.com", - "phone": "+1 (897) 574-3014", - "address": "458 Willow Street, Henrietta, California, 7234", - "about": "Nisi reprehenderit nulla ad officia pariatur non dolore laboris irure cupidatat laborum. Minim eu ex Lorem adipisicing exercitation irure minim sunt est enim mollit incididunt voluptate nulla. Ut mollit anim reprehenderit et aliqua ex esse aliquip. Aute sit duis deserunt do incididunt consequat minim qui dolor commodo deserunt et voluptate.\r\n", - "registered": "2014-05-21T01:56:51 -01:00", - "latitude": 63.89502, - "longitude": 62.369807, - "tags": [ - "nostrud", - "nisi", - "consectetur", - "ullamco", - "cupidatat", - "culpa", - "commodo" - ], - "friends": [ - { - "id": 0, - "name": "Henry Walls" - }, - { - "id": 1, - "name": "Janice Baker" - }, - { - "id": 2, - "name": "Russell Bush" - } - ], - "greeting": "Hello, Carey Savage! You have 4 unread messages.", - "favoriteFruit": "banana" - }, - { - "_id": "59ef4a83ff5774a691454e89", - "index": 1, - "guid": "2bee9efc-4095-4c2e-87ef-d08c8054c89d", - "isActive": true, - "balance": "$1,618.15", - "picture": "http://placehold.it/32x32", - "age": 35, - "eyeColor": "blue", - "name": "Elinor Pearson", - "gender": "female", - "company": "FLEXIGEN", - "email": "elinorpearson@flexigen.com", - "phone": "+1 (923) 548-3751", - "address": "600 Bayview Avenue, Draper, Montana, 3088", - "about": "Mollit commodo ea sit Lorem velit. Irure anim esse Lorem sint quis officia ut. Aliqua nisi dolore in aute deserunt mollit ex ea in mollit.\r\n", - "registered": "2017-04-22T07:58:41 -01:00", - "latitude": -87.824919, - "longitude": 69.538927, - "tags": [ - "fugiat", - "labore", - "proident", - "quis", - "eiusmod", - "qui", - "est" - ], - "friends": [ - { - "id": 0, - "name": "Massey Wagner" - }, - { - "id": 1, - "name": "Marcella Ferrell" - }, - { - "id": 2, - "name": "Evans Mckee" - } - ], - "greeting": "Hello, Elinor Pearson! You have 3 unread messages.", - "favoriteFruit": "strawberry" - }, - { - "_id": "59ef4a839ec8a4be4430b36b", - "index": 2, - "guid": "ddd6e8c0-95bd-416d-8b46-a768d6363809", - "isActive": false, - "balance": "$2,046.95", - "picture": "http://placehold.it/32x32", - "age": 40, - "eyeColor": "green", - "name": "Irwin Davidson", - "gender": "male", - "company": "DANJA", - "email": "irwindavidson@danja.com", - "phone": "+1 (883) 537-2041", - "address": "439 Cook Street, Chapin, Kentucky, 7398", - "about": "Irure velit non commodo aliqua exercitation ut nostrud minim magna. Dolor ad ad ut irure eu. Non pariatur dolor eiusmod ipsum do et exercitation cillum. Et amet laboris minim eiusmod ullamco magna ea reprehenderit proident sunt.\r\n", - "registered": "2016-09-01T07:49:08 -01:00", - "latitude": -49.803812, - "longitude": 104.93279, - "tags": [ - "consequat", - "enim", - "quis", - "magna", - "est", - "culpa", - "tempor" - ], - "friends": [ - { - "id": 0, - "name": "Ruth Hansen" - }, - { - "id": 1, - "name": "Kathrine Austin" - }, - { - "id": 2, - "name": "Rivera Munoz" - } - ], - "greeting": "Hello, Irwin Davidson! You have 2 unread messages.", - "favoriteFruit": "banana" - } -] diff --git a/node_modules/fast-json-stable-stringify/example/key_cmp.js b/node_modules/fast-json-stable-stringify/example/key_cmp.js deleted file mode 100644 index d5f6675..0000000 --- a/node_modules/fast-json-stable-stringify/example/key_cmp.js +++ /dev/null @@ -1,7 +0,0 @@ -var stringify = require('../'); - -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -var s = stringify(obj, function (a, b) { - return a.key < b.key ? 1 : -1; -}); -console.log(s); diff --git a/node_modules/fast-json-stable-stringify/example/nested.js b/node_modules/fast-json-stable-stringify/example/nested.js deleted file mode 100644 index 9a672fc..0000000 --- a/node_modules/fast-json-stable-stringify/example/nested.js +++ /dev/null @@ -1,3 +0,0 @@ -var stringify = require('../'); -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -console.log(stringify(obj)); diff --git a/node_modules/fast-json-stable-stringify/example/str.js b/node_modules/fast-json-stable-stringify/example/str.js deleted file mode 100644 index 9b4b3cd..0000000 --- a/node_modules/fast-json-stable-stringify/example/str.js +++ /dev/null @@ -1,3 +0,0 @@ -var stringify = require('../'); -var obj = { c: 6, b: [4,5], a: 3 }; -console.log(stringify(obj)); diff --git a/node_modules/fast-json-stable-stringify/example/value_cmp.js b/node_modules/fast-json-stable-stringify/example/value_cmp.js deleted file mode 100644 index 09f1c5f..0000000 --- a/node_modules/fast-json-stable-stringify/example/value_cmp.js +++ /dev/null @@ -1,7 +0,0 @@ -var stringify = require('../'); - -var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 }; -var s = stringify(obj, function (a, b) { - return a.value < b.value ? 1 : -1; -}); -console.log(s); diff --git a/node_modules/fast-json-stable-stringify/index.d.ts b/node_modules/fast-json-stable-stringify/index.d.ts deleted file mode 100644 index 23e46ca..0000000 --- a/node_modules/fast-json-stable-stringify/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module 'fast-json-stable-stringify' { - function stringify(obj: any): string; - export = stringify; -} diff --git a/node_modules/fast-json-stable-stringify/index.js b/node_modules/fast-json-stable-stringify/index.js deleted file mode 100644 index c44e6a4..0000000 --- a/node_modules/fast-json-stable-stringify/index.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; - -module.exports = function (data, opts) { - if (!opts) opts = {}; - if (typeof opts === 'function') opts = { cmp: opts }; - var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; - - var cmp = opts.cmp && (function (f) { - return function (node) { - return function (a, b) { - var aobj = { key: a, value: node[a] }; - var bobj = { key: b, value: node[b] }; - return f(aobj, bobj); - }; - }; - })(opts.cmp); - - var seen = []; - return (function stringify (node) { - if (node && node.toJSON && typeof node.toJSON === 'function') { - node = node.toJSON(); - } - - if (node === undefined) return; - if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; - if (typeof node !== 'object') return JSON.stringify(node); - - var i, out; - if (Array.isArray(node)) { - out = '['; - for (i = 0; i < node.length; i++) { - if (i) out += ','; - out += stringify(node[i]) || 'null'; - } - return out + ']'; - } - - if (node === null) return 'null'; - - if (seen.indexOf(node) !== -1) { - if (cycles) return JSON.stringify('__cycle__'); - throw new TypeError('Converting circular structure to JSON'); - } - - var seenIndex = seen.push(node) - 1; - var keys = Object.keys(node).sort(cmp && cmp(node)); - out = ''; - for (i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = stringify(node[key]); - - if (!value) continue; - if (out) out += ','; - out += JSON.stringify(key) + ':' + value; - } - seen.splice(seenIndex, 1); - return '{' + out + '}'; - })(data); -}; diff --git a/node_modules/fast-json-stable-stringify/package.json b/node_modules/fast-json-stable-stringify/package.json deleted file mode 100644 index 13ee901..0000000 --- a/node_modules/fast-json-stable-stringify/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "_from": "fast-json-stable-stringify@~2.1.0", - "_id": "fast-json-stable-stringify@2.1.0", - "_inBundle": false, - "_integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "_location": "/fast-json-stable-stringify", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "fast-json-stable-stringify@~2.1.0", - "name": "fast-json-stable-stringify", - "escapedName": "fast-json-stable-stringify", - "rawSpec": "~2.1.0", - "saveSpec": null, - "fetchSpec": "~2.1.0" - }, - "_requiredBy": [ - "/vega-lite" - ], - "_resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "_shasum": "874bf69c6f404c2b5d99c481341399fd55892633", - "_spec": "fast-json-stable-stringify@~2.1.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-lite", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "bugs": { - "url": "https://github.com/epoberezkin/fast-json-stable-stringify/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify without jsonify", - "devDependencies": { - "benchmark": "^2.1.4", - "coveralls": "^3.0.0", - "eslint": "^6.7.0", - "fast-stable-stringify": "latest", - "faster-stable-stringify": "latest", - "json-stable-stringify": "latest", - "nyc": "^14.1.0", - "pre-commit": "^1.2.2", - "tape": "^4.11.0" - }, - "homepage": "https://github.com/epoberezkin/fast-json-stable-stringify", - "keywords": [ - "json", - "stringify", - "deterministic", - "hash", - "stable" - ], - "license": "MIT", - "main": "index.js", - "name": "fast-json-stable-stringify", - "nyc": { - "exclude": [ - "test", - "node_modules" - ], - "reporter": [ - "lcov", - "text-summary" - ] - }, - "repository": { - "type": "git", - "url": "git://github.com/epoberezkin/fast-json-stable-stringify.git" - }, - "scripts": { - "eslint": "eslint index.js test", - "test": "npm run eslint && nyc npm run test-spec", - "test-spec": "tape test/*.js" - }, - "types": "index.d.ts", - "version": "2.1.0" -} diff --git a/node_modules/fast-json-stable-stringify/test/cmp.js b/node_modules/fast-json-stable-stringify/test/cmp.js deleted file mode 100644 index 4efd6b5..0000000 --- a/node_modules/fast-json-stable-stringify/test/cmp.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -var test = require('tape'); -var stringify = require('../'); - -test('custom comparison function', function (t) { - t.plan(1); - var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; - var s = stringify(obj, function (a, b) { - return a.key < b.key ? 1 : -1; - }); - t.equal(s, '{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}'); -}); diff --git a/node_modules/fast-json-stable-stringify/test/nested.js b/node_modules/fast-json-stable-stringify/test/nested.js deleted file mode 100644 index 167a358..0000000 --- a/node_modules/fast-json-stable-stringify/test/nested.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -var test = require('tape'); -var stringify = require('../'); - -test('nested', function (t) { - t.plan(1); - var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; - t.equal(stringify(obj), '{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}'); -}); - -test('cyclic (default)', function (t) { - t.plan(1); - var one = { a: 1 }; - var two = { a: 2, one: one }; - one.two = two; - try { - stringify(one); - } catch (ex) { - t.equal(ex.toString(), 'TypeError: Converting circular structure to JSON'); - } -}); - -test('cyclic (specifically allowed)', function (t) { - t.plan(1); - var one = { a: 1 }; - var two = { a: 2, one: one }; - one.two = two; - t.equal(stringify(one, {cycles:true}), '{"a":1,"two":{"a":2,"one":"__cycle__"}}'); -}); - -test('repeated non-cyclic value', function(t) { - t.plan(1); - var one = { x: 1 }; - var two = { a: one, b: one }; - t.equal(stringify(two), '{"a":{"x":1},"b":{"x":1}}'); -}); - -test('acyclic but with reused obj-property pointers', function (t) { - t.plan(1); - var x = { a: 1 }; - var y = { b: x, c: x }; - t.equal(stringify(y), '{"b":{"a":1},"c":{"a":1}}'); -}); diff --git a/node_modules/fast-json-stable-stringify/test/str.js b/node_modules/fast-json-stable-stringify/test/str.js deleted file mode 100644 index 99a9ade..0000000 --- a/node_modules/fast-json-stable-stringify/test/str.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -var test = require('tape'); -var stringify = require('../'); - -test('simple object', function (t) { - t.plan(1); - var obj = { c: 6, b: [4,5], a: 3, z: null }; - t.equal(stringify(obj), '{"a":3,"b":[4,5],"c":6,"z":null}'); -}); - -test('object with undefined', function (t) { - t.plan(1); - var obj = { a: 3, z: undefined }; - t.equal(stringify(obj), '{"a":3}'); -}); - -test('object with null', function (t) { - t.plan(1); - var obj = { a: 3, z: null }; - t.equal(stringify(obj), '{"a":3,"z":null}'); -}); - -test('object with NaN and Infinity', function (t) { - t.plan(1); - var obj = { a: 3, b: NaN, c: Infinity }; - t.equal(stringify(obj), '{"a":3,"b":null,"c":null}'); -}); - -test('array with undefined', function (t) { - t.plan(1); - var obj = [4, undefined, 6]; - t.equal(stringify(obj), '[4,null,6]'); -}); - -test('object with empty string', function (t) { - t.plan(1); - var obj = { a: 3, z: '' }; - t.equal(stringify(obj), '{"a":3,"z":""}'); -}); - -test('array with empty string', function (t) { - t.plan(1); - var obj = [4, '', 6]; - t.equal(stringify(obj), '[4,"",6]'); -}); diff --git a/node_modules/fast-json-stable-stringify/test/to-json.js b/node_modules/fast-json-stable-stringify/test/to-json.js deleted file mode 100644 index 2fb2cfa..0000000 --- a/node_modules/fast-json-stable-stringify/test/to-json.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -var test = require('tape'); -var stringify = require('../'); - -test('toJSON function', function (t) { - t.plan(1); - var obj = { one: 1, two: 2, toJSON: function() { return { one: 1 }; } }; - t.equal(stringify(obj), '{"one":1}' ); -}); - -test('toJSON returns string', function (t) { - t.plan(1); - var obj = { one: 1, two: 2, toJSON: function() { return 'one'; } }; - t.equal(stringify(obj), '"one"'); -}); - -test('toJSON returns array', function (t) { - t.plan(1); - var obj = { one: 1, two: 2, toJSON: function() { return ['one']; } }; - t.equal(stringify(obj), '["one"]'); -}); diff --git a/node_modules/find-up/index.d.ts b/node_modules/find-up/index.d.ts deleted file mode 100644 index 41e3192..0000000 --- a/node_modules/find-up/index.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -import {Options as LocatePathOptions} from 'locate-path'; - -declare const stop: unique symbol; - -declare namespace findUp { - interface Options extends LocatePathOptions {} - - type StopSymbol = typeof stop; - - type Match = string | StopSymbol | undefined; -} - -declare const findUp: { - /** - Find a file or directory by walking up parent directories. - - @param name - Name of the file or directory to find. Can be multiple. - @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. - - @example - ``` - // / - // └── Users - // └── sindresorhus - // ├── unicorn.png - // └── foo - // └── bar - // ├── baz - // └── example.js - - // example.js - import findUp = require('find-up'); - - (async () => { - console.log(await findUp('unicorn.png')); - //=> '/Users/sindresorhus/unicorn.png' - - console.log(await findUp(['rainbow.png', 'unicorn.png'])); - //=> '/Users/sindresorhus/unicorn.png' - })(); - ``` - */ - (name: string | string[], options?: findUp.Options): Promise; - - /** - Find a file or directory by walking up parent directories. - - @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search. - @returns The first path found or `undefined` if none could be found. - - @example - ``` - import path = require('path'); - import findUp = require('find-up'); - - (async () => { - console.log(await findUp(async directory => { - const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png')); - return hasUnicorns && directory; - }, {type: 'directory'})); - //=> '/Users/sindresorhus' - })(); - ``` - */ - (matcher: (directory: string) => (findUp.Match | Promise), options?: findUp.Options): Promise; - - sync: { - /** - Synchronously find a file or directory by walking up parent directories. - - @param name - Name of the file or directory to find. Can be multiple. - @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. - */ - (name: string | string[], options?: findUp.Options): string | undefined; - - /** - Synchronously find a file or directory by walking up parent directories. - - @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search. - @returns The first path found or `undefined` if none could be found. - - @example - ``` - import path = require('path'); - import findUp = require('find-up'); - - console.log(findUp.sync(directory => { - const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png')); - return hasUnicorns && directory; - }, {type: 'directory'})); - //=> '/Users/sindresorhus' - ``` - */ - (matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined; - - /** - Synchronously check if a path exists. - - @param path - Path to the file or directory. - @returns Whether the path exists. - - @example - ``` - import findUp = require('find-up'); - - console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png')); - //=> true - ``` - */ - exists(path: string): boolean; - } - - /** - Check if a path exists. - - @param path - Path to a file or directory. - @returns Whether the path exists. - - @example - ``` - import findUp = require('find-up'); - - (async () => { - console.log(await findUp.exists('/Users/sindresorhus/unicorn.png')); - //=> true - })(); - ``` - */ - exists(path: string): Promise; - - /** - Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`. - */ - readonly stop: findUp.StopSymbol; -}; - -export = findUp; diff --git a/node_modules/find-up/index.js b/node_modules/find-up/index.js deleted file mode 100644 index ce564e5..0000000 --- a/node_modules/find-up/index.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; -const path = require('path'); -const locatePath = require('locate-path'); -const pathExists = require('path-exists'); - -const stop = Symbol('findUp.stop'); - -module.exports = async (name, options = {}) => { - let directory = path.resolve(options.cwd || ''); - const {root} = path.parse(directory); - const paths = [].concat(name); - - const runMatcher = async locateOptions => { - if (typeof name !== 'function') { - return locatePath(paths, locateOptions); - } - - const foundPath = await name(locateOptions.cwd); - if (typeof foundPath === 'string') { - return locatePath([foundPath], locateOptions); - } - - return foundPath; - }; - - // eslint-disable-next-line no-constant-condition - while (true) { - // eslint-disable-next-line no-await-in-loop - const foundPath = await runMatcher({...options, cwd: directory}); - - if (foundPath === stop) { - return; - } - - if (foundPath) { - return path.resolve(directory, foundPath); - } - - if (directory === root) { - return; - } - - directory = path.dirname(directory); - } -}; - -module.exports.sync = (name, options = {}) => { - let directory = path.resolve(options.cwd || ''); - const {root} = path.parse(directory); - const paths = [].concat(name); - - const runMatcher = locateOptions => { - if (typeof name !== 'function') { - return locatePath.sync(paths, locateOptions); - } - - const foundPath = name(locateOptions.cwd); - if (typeof foundPath === 'string') { - return locatePath.sync([foundPath], locateOptions); - } - - return foundPath; - }; - - // eslint-disable-next-line no-constant-condition - while (true) { - const foundPath = runMatcher({...options, cwd: directory}); - - if (foundPath === stop) { - return; - } - - if (foundPath) { - return path.resolve(directory, foundPath); - } - - if (directory === root) { - return; - } - - directory = path.dirname(directory); - } -}; - -module.exports.exists = pathExists; - -module.exports.sync.exists = pathExists.sync; - -module.exports.stop = stop; diff --git a/node_modules/find-up/license b/node_modules/find-up/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/find-up/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/find-up/package.json b/node_modules/find-up/package.json deleted file mode 100644 index d607b78..0000000 --- a/node_modules/find-up/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "_from": "find-up@^4.1.0", - "_id": "find-up@4.1.0", - "_inBundle": false, - "_integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "_location": "/find-up", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "find-up@^4.1.0", - "name": "find-up", - "escapedName": "find-up", - "rawSpec": "^4.1.0", - "saveSpec": null, - "fetchSpec": "^4.1.0" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "_shasum": "97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19", - "_spec": "find-up@^4.1.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/find-up/issues" - }, - "bundleDependencies": false, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "deprecated": false, - "description": "Find a file or directory by walking up parent directories", - "devDependencies": { - "ava": "^2.1.0", - "is-path-inside": "^2.1.0", - "tempy": "^0.3.0", - "tsd": "^0.7.3", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/find-up#readme", - "keywords": [ - "find", - "up", - "find-up", - "findup", - "look-up", - "look", - "file", - "search", - "match", - "package", - "resolve", - "parent", - "parents", - "folder", - "directory", - "walk", - "walking", - "path" - ], - "license": "MIT", - "name": "find-up", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/find-up.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "4.1.0" -} diff --git a/node_modules/find-up/readme.md b/node_modules/find-up/readme.md deleted file mode 100644 index d6a21e5..0000000 --- a/node_modules/find-up/readme.md +++ /dev/null @@ -1,156 +0,0 @@ -# find-up [![Build Status](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) - -> Find a file or directory by walking up parent directories - - -## Install - -``` -$ npm install find-up -``` - - -## Usage - -``` -/ -└── Users - └── sindresorhus - ├── unicorn.png - └── foo - └── bar - ├── baz - └── example.js -``` - -`example.js` - -```js -const path = require('path'); -const findUp = require('find-up'); - -(async () => { - console.log(await findUp('unicorn.png')); - //=> '/Users/sindresorhus/unicorn.png' - - console.log(await findUp(['rainbow.png', 'unicorn.png'])); - //=> '/Users/sindresorhus/unicorn.png' - - console.log(await findUp(async directory => { - const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png')); - return hasUnicorns && directory; - }, {type: 'directory'})); - //=> '/Users/sindresorhus' -})(); -``` - - -## API - -### findUp(name, options?) -### findUp(matcher, options?) - -Returns a `Promise` for either the path or `undefined` if it couldn't be found. - -### findUp([...name], options?) - -Returns a `Promise` for either the first path found (by respecting the order of the array) or `undefined` if none could be found. - -### findUp.sync(name, options?) -### findUp.sync(matcher, options?) - -Returns a path or `undefined` if it couldn't be found. - -### findUp.sync([...name], options?) - -Returns the first path found (by respecting the order of the array) or `undefined` if none could be found. - -#### name - -Type: `string` - -Name of the file or directory to find. - -#### matcher - -Type: `Function` - -A function that will be called with each directory until it returns a `string` with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use-cases. - -When using async mode, the `matcher` may optionally be an async or promise-returning function that returns the path. - -#### options - -Type: `object` - -##### cwd - -Type: `string`
-Default: `process.cwd()` - -Directory to start from. - -##### type - -Type: `string`
-Default: `'file'`
-Values: `'file'` `'directory'` - -The type of paths that can match. - -##### allowSymlinks - -Type: `boolean`
-Default: `true` - -Allow symbolic links to match if they point to the chosen path type. - -### findUp.exists(path) - -Returns a `Promise` of whether the path exists. - -### findUp.sync.exists(path) - -Returns a `boolean` of whether the path exists. - -#### path - -Type: `string` - -Path to a file or directory. - -### findUp.stop - -A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem. - -```js -const path = require('path'); -const findUp = require('find-up'); - -(async () => { - await findUp(directory => { - return path.basename(directory) === 'work' ? findUp.stop : 'logo.png'; - }); -})(); -``` - - -## Related - -- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module -- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file -- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package -- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path - - ---- - -
- - Get professional support for 'find-up' with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/fs-minipass/LICENSE b/node_modules/fs-minipass/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/fs-minipass/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/fs-minipass/README.md b/node_modules/fs-minipass/README.md deleted file mode 100644 index 1e61241..0000000 --- a/node_modules/fs-minipass/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# fs-minipass - -Filesystem streams based on [minipass](http://npm.im/minipass). - -4 classes are exported: - -- ReadStream -- ReadStreamSync -- WriteStream -- WriteStreamSync - -When using `ReadStreamSync`, all of the data is made available -immediately upon consuming the stream. Nothing is buffered in memory -when the stream is constructed. If the stream is piped to a writer, -then it will synchronously `read()` and emit data into the writer as -fast as the writer can consume it. (That is, it will respect -backpressure.) If you call `stream.read()` then it will read the -entire file and return the contents. - -When using `WriteStreamSync`, every write is flushed to the file -synchronously. If your writes all come in a single tick, then it'll -write it all out in a single tick. It's as synchronous as you are. - -The async versions work much like their node builtin counterparts, -with the exception of introducing significantly less Stream machinery -overhead. - -## USAGE - -It's just streams, you pipe them or read() them or write() to them. - -```js -const fsm = require('fs-minipass') -const readStream = new fsm.ReadStream('file.txt') -const writeStream = new fsm.WriteStream('output.txt') -writeStream.write('some file header or whatever\n') -readStream.pipe(writeStream) -``` - -## ReadStream(path, options) - -Path string is required, but somewhat irrelevant if an open file -descriptor is passed in as an option. - -Options: - -- `fd` Pass in a numeric file descriptor, if the file is already open. -- `readSize` The size of reads to do, defaults to 16MB -- `size` The size of the file, if known. Prevents zero-byte read() - call at the end. -- `autoClose` Set to `false` to prevent the file descriptor from being - closed when the file is done being read. - -## WriteStream(path, options) - -Path string is required, but somewhat irrelevant if an open file -descriptor is passed in as an option. - -Options: - -- `fd` Pass in a numeric file descriptor, if the file is already open. -- `mode` The mode to create the file with. Defaults to `0o666`. -- `start` The position in the file to start reading. If not - specified, then the file will start writing at position zero, and be - truncated by default. -- `autoClose` Set to `false` to prevent the file descriptor from being - closed when the stream is ended. -- `flags` Flags to use when opening the file. Irrelevant if `fd` is - passed in, since file won't be opened in that case. Defaults to - `'a'` if a `pos` is specified, or `'w'` otherwise. diff --git a/node_modules/fs-minipass/index.js b/node_modules/fs-minipass/index.js deleted file mode 100644 index cd585a8..0000000 --- a/node_modules/fs-minipass/index.js +++ /dev/null @@ -1,387 +0,0 @@ -'use strict' -const MiniPass = require('minipass') -const EE = require('events').EventEmitter -const fs = require('fs') - -// for writev -const binding = process.binding('fs') -const writeBuffers = binding.writeBuffers -/* istanbul ignore next */ -const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback - -const _autoClose = Symbol('_autoClose') -const _close = Symbol('_close') -const _ended = Symbol('_ended') -const _fd = Symbol('_fd') -const _finished = Symbol('_finished') -const _flags = Symbol('_flags') -const _flush = Symbol('_flush') -const _handleChunk = Symbol('_handleChunk') -const _makeBuf = Symbol('_makeBuf') -const _mode = Symbol('_mode') -const _needDrain = Symbol('_needDrain') -const _onerror = Symbol('_onerror') -const _onopen = Symbol('_onopen') -const _onread = Symbol('_onread') -const _onwrite = Symbol('_onwrite') -const _open = Symbol('_open') -const _path = Symbol('_path') -const _pos = Symbol('_pos') -const _queue = Symbol('_queue') -const _read = Symbol('_read') -const _readSize = Symbol('_readSize') -const _reading = Symbol('_reading') -const _remain = Symbol('_remain') -const _size = Symbol('_size') -const _write = Symbol('_write') -const _writing = Symbol('_writing') -const _defaultFlag = Symbol('_defaultFlag') - -class ReadStream extends MiniPass { - constructor (path, opt) { - opt = opt || {} - super(opt) - - this.writable = false - - if (typeof path !== 'string') - throw new TypeError('path must be a string') - - this[_fd] = typeof opt.fd === 'number' ? opt.fd : null - this[_path] = path - this[_readSize] = opt.readSize || 16*1024*1024 - this[_reading] = false - this[_size] = typeof opt.size === 'number' ? opt.size : Infinity - this[_remain] = this[_size] - this[_autoClose] = typeof opt.autoClose === 'boolean' ? - opt.autoClose : true - - if (typeof this[_fd] === 'number') - this[_read]() - else - this[_open]() - } - - get fd () { return this[_fd] } - get path () { return this[_path] } - - write () { - throw new TypeError('this is a readable stream') - } - - end () { - throw new TypeError('this is a readable stream') - } - - [_open] () { - fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)) - } - - [_onopen] (er, fd) { - if (er) - this[_onerror](er) - else { - this[_fd] = fd - this.emit('open', fd) - this[_read]() - } - } - - [_makeBuf] () { - return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])) - } - - [_read] () { - if (!this[_reading]) { - this[_reading] = true - const buf = this[_makeBuf]() - /* istanbul ignore if */ - if (buf.length === 0) return process.nextTick(() => this[_onread](null, 0, buf)) - fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) => - this[_onread](er, br, buf)) - } - } - - [_onread] (er, br, buf) { - this[_reading] = false - if (er) - this[_onerror](er) - else if (this[_handleChunk](br, buf)) - this[_read]() - } - - [_close] () { - if (this[_autoClose] && typeof this[_fd] === 'number') { - fs.close(this[_fd], _ => this.emit('close')) - this[_fd] = null - } - } - - [_onerror] (er) { - this[_reading] = true - this[_close]() - this.emit('error', er) - } - - [_handleChunk] (br, buf) { - let ret = false - // no effect if infinite - this[_remain] -= br - if (br > 0) - ret = super.write(br < buf.length ? buf.slice(0, br) : buf) - - if (br === 0 || this[_remain] <= 0) { - ret = false - this[_close]() - super.end() - } - - return ret - } - - emit (ev, data) { - switch (ev) { - case 'prefinish': - case 'finish': - break - - case 'drain': - if (typeof this[_fd] === 'number') - this[_read]() - break - - default: - return super.emit(ev, data) - } - } -} - -class ReadStreamSync extends ReadStream { - [_open] () { - let threw = true - try { - this[_onopen](null, fs.openSync(this[_path], 'r')) - threw = false - } finally { - if (threw) - this[_close]() - } - } - - [_read] () { - let threw = true - try { - if (!this[_reading]) { - this[_reading] = true - do { - const buf = this[_makeBuf]() - /* istanbul ignore next */ - const br = buf.length === 0 ? 0 : fs.readSync(this[_fd], buf, 0, buf.length, null) - if (!this[_handleChunk](br, buf)) - break - } while (true) - this[_reading] = false - } - threw = false - } finally { - if (threw) - this[_close]() - } - } - - [_close] () { - if (this[_autoClose] && typeof this[_fd] === 'number') { - try { - fs.closeSync(this[_fd]) - } catch (er) {} - this[_fd] = null - this.emit('close') - } - } -} - -class WriteStream extends EE { - constructor (path, opt) { - opt = opt || {} - super(opt) - this.readable = false - this[_writing] = false - this[_ended] = false - this[_needDrain] = false - this[_queue] = [] - this[_path] = path - this[_fd] = typeof opt.fd === 'number' ? opt.fd : null - this[_mode] = opt.mode === undefined ? 0o666 : opt.mode - this[_pos] = typeof opt.start === 'number' ? opt.start : null - this[_autoClose] = typeof opt.autoClose === 'boolean' ? - opt.autoClose : true - - // truncating makes no sense when writing into the middle - const defaultFlag = this[_pos] !== null ? 'r+' : 'w' - this[_defaultFlag] = opt.flags === undefined - this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags - - if (this[_fd] === null) - this[_open]() - } - - get fd () { return this[_fd] } - get path () { return this[_path] } - - [_onerror] (er) { - this[_close]() - this[_writing] = true - this.emit('error', er) - } - - [_open] () { - fs.open(this[_path], this[_flags], this[_mode], - (er, fd) => this[_onopen](er, fd)) - } - - [_onopen] (er, fd) { - if (this[_defaultFlag] && - this[_flags] === 'r+' && - er && er.code === 'ENOENT') { - this[_flags] = 'w' - this[_open]() - } else if (er) - this[_onerror](er) - else { - this[_fd] = fd - this.emit('open', fd) - this[_flush]() - } - } - - end (buf, enc) { - if (buf) - this.write(buf, enc) - - this[_ended] = true - - // synthetic after-write logic, where drain/finish live - if (!this[_writing] && !this[_queue].length && - typeof this[_fd] === 'number') - this[_onwrite](null, 0) - } - - write (buf, enc) { - if (typeof buf === 'string') - buf = new Buffer(buf, enc) - - if (this[_ended]) { - this.emit('error', new Error('write() after end()')) - return false - } - - if (this[_fd] === null || this[_writing] || this[_queue].length) { - this[_queue].push(buf) - this[_needDrain] = true - return false - } - - this[_writing] = true - this[_write](buf) - return true - } - - [_write] (buf) { - fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => - this[_onwrite](er, bw)) - } - - [_onwrite] (er, bw) { - if (er) - this[_onerror](er) - else { - if (this[_pos] !== null) - this[_pos] += bw - if (this[_queue].length) - this[_flush]() - else { - this[_writing] = false - - if (this[_ended] && !this[_finished]) { - this[_finished] = true - this[_close]() - this.emit('finish') - } else if (this[_needDrain]) { - this[_needDrain] = false - this.emit('drain') - } - } - } - } - - [_flush] () { - if (this[_queue].length === 0) { - if (this[_ended]) - this[_onwrite](null, 0) - } else if (this[_queue].length === 1) - this[_write](this[_queue].pop()) - else { - const iovec = this[_queue] - this[_queue] = [] - writev(this[_fd], iovec, this[_pos], - (er, bw) => this[_onwrite](er, bw)) - } - } - - [_close] () { - if (this[_autoClose] && typeof this[_fd] === 'number') { - fs.close(this[_fd], _ => this.emit('close')) - this[_fd] = null - } - } -} - -class WriteStreamSync extends WriteStream { - [_open] () { - let fd - try { - fd = fs.openSync(this[_path], this[_flags], this[_mode]) - } catch (er) { - if (this[_defaultFlag] && - this[_flags] === 'r+' && - er && er.code === 'ENOENT') { - this[_flags] = 'w' - return this[_open]() - } else - throw er - } - this[_onopen](null, fd) - } - - [_close] () { - if (this[_autoClose] && typeof this[_fd] === 'number') { - try { - fs.closeSync(this[_fd]) - } catch (er) {} - this[_fd] = null - this.emit('close') - } - } - - [_write] (buf) { - try { - this[_onwrite](null, - fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos])) - } catch (er) { - this[_onwrite](er, 0) - } - } -} - -const writev = (fd, iovec, pos, cb) => { - const done = (er, bw) => cb(er, bw, iovec) - const req = new FSReqWrap() - req.oncomplete = done - binding.writeBuffers(fd, iovec, pos, req) -} - -exports.ReadStream = ReadStream -exports.ReadStreamSync = ReadStreamSync - -exports.WriteStream = WriteStream -exports.WriteStreamSync = WriteStreamSync diff --git a/node_modules/fs-minipass/package.json b/node_modules/fs-minipass/package.json deleted file mode 100644 index be5b209..0000000 --- a/node_modules/fs-minipass/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_from": "fs-minipass@^1.2.5", - "_id": "fs-minipass@1.2.7", - "_inBundle": false, - "_integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", - "_location": "/fs-minipass", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "fs-minipass@^1.2.5", - "name": "fs-minipass", - "escapedName": "fs-minipass", - "rawSpec": "^1.2.5", - "saveSpec": null, - "fetchSpec": "^1.2.5" - }, - "_requiredBy": [ - "/tar" - ], - "_resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", - "_shasum": "ccff8570841e7fe4265693da88936c55aed7f7c7", - "_spec": "fs-minipass@^1.2.5", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/tar", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/npm/fs-minipass/issues" - }, - "bundleDependencies": false, - "dependencies": { - "minipass": "^2.6.0" - }, - "deprecated": false, - "description": "fs read and write streams based on minipass", - "devDependencies": { - "mutate-fs": "^2.0.1", - "tap": "^14.6.4" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/npm/fs-minipass#readme", - "keywords": [], - "license": "ISC", - "main": "index.js", - "name": "fs-minipass", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/fs-minipass.git" - }, - "scripts": { - "postpublish": "git push origin --follow-tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap" - }, - "tap": { - "check-coverage": true - }, - "version": "1.2.7" -} diff --git a/node_modules/fs.realpath/LICENSE b/node_modules/fs.realpath/LICENSE deleted file mode 100644 index 5bd884c..0000000 --- a/node_modules/fs.realpath/LICENSE +++ /dev/null @@ -1,43 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----- - -This library bundles a version of the `fs.realpath` and `fs.realpathSync` -methods from Node.js v0.10 under the terms of the Node.js MIT license. - -Node's license follows, also included at the header of `old.js` which contains -the licensed code: - - Copyright Joyent, Inc. and other Node contributors. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. diff --git a/node_modules/fs.realpath/README.md b/node_modules/fs.realpath/README.md deleted file mode 100644 index a42ceac..0000000 --- a/node_modules/fs.realpath/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# fs.realpath - -A backwards-compatible fs.realpath for Node v6 and above - -In Node v6, the JavaScript implementation of fs.realpath was replaced -with a faster (but less resilient) native implementation. That raises -new and platform-specific errors and cannot handle long or excessively -symlink-looping paths. - -This module handles those cases by detecting the new errors and -falling back to the JavaScript implementation. On versions of Node -prior to v6, it has no effect. - -## USAGE - -```js -var rp = require('fs.realpath') - -// async version -rp.realpath(someLongAndLoopingPath, function (er, real) { - // the ELOOP was handled, but it was a bit slower -}) - -// sync version -var real = rp.realpathSync(someLongAndLoopingPath) - -// monkeypatch at your own risk! -// This replaces the fs.realpath/fs.realpathSync builtins -rp.monkeypatch() - -// un-do the monkeypatching -rp.unmonkeypatch() -``` diff --git a/node_modules/fs.realpath/index.js b/node_modules/fs.realpath/index.js deleted file mode 100644 index b09c7c7..0000000 --- a/node_modules/fs.realpath/index.js +++ /dev/null @@ -1,66 +0,0 @@ -module.exports = realpath -realpath.realpath = realpath -realpath.sync = realpathSync -realpath.realpathSync = realpathSync -realpath.monkeypatch = monkeypatch -realpath.unmonkeypatch = unmonkeypatch - -var fs = require('fs') -var origRealpath = fs.realpath -var origRealpathSync = fs.realpathSync - -var version = process.version -var ok = /^v[0-5]\./.test(version) -var old = require('./old.js') - -function newError (er) { - return er && er.syscall === 'realpath' && ( - er.code === 'ELOOP' || - er.code === 'ENOMEM' || - er.code === 'ENAMETOOLONG' - ) -} - -function realpath (p, cache, cb) { - if (ok) { - return origRealpath(p, cache, cb) - } - - if (typeof cache === 'function') { - cb = cache - cache = null - } - origRealpath(p, cache, function (er, result) { - if (newError(er)) { - old.realpath(p, cache, cb) - } else { - cb(er, result) - } - }) -} - -function realpathSync (p, cache) { - if (ok) { - return origRealpathSync(p, cache) - } - - try { - return origRealpathSync(p, cache) - } catch (er) { - if (newError(er)) { - return old.realpathSync(p, cache) - } else { - throw er - } - } -} - -function monkeypatch () { - fs.realpath = realpath - fs.realpathSync = realpathSync -} - -function unmonkeypatch () { - fs.realpath = origRealpath - fs.realpathSync = origRealpathSync -} diff --git a/node_modules/fs.realpath/old.js b/node_modules/fs.realpath/old.js deleted file mode 100644 index b40305e..0000000 --- a/node_modules/fs.realpath/old.js +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var pathModule = require('path'); -var isWindows = process.platform === 'win32'; -var fs = require('fs'); - -// JavaScript implementation of realpath, ported from node pre-v6 - -var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); - -function rethrow() { - // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and - // is fairly slow to generate. - var callback; - if (DEBUG) { - var backtrace = new Error; - callback = debugCallback; - } else - callback = missingCallback; - - return callback; - - function debugCallback(err) { - if (err) { - backtrace.message = err.message; - err = backtrace; - missingCallback(err); - } - } - - function missingCallback(err) { - if (err) { - if (process.throwDeprecation) - throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs - else if (!process.noDeprecation) { - var msg = 'fs: missing callback ' + (err.stack || err.message); - if (process.traceDeprecation) - console.trace(msg); - else - console.error(msg); - } - } - } -} - -function maybeCallback(cb) { - return typeof cb === 'function' ? cb : rethrow(); -} - -var normalize = pathModule.normalize; - -// Regexp that finds the next partion of a (partial) path -// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] -if (isWindows) { - var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; -} else { - var nextPartRe = /(.*?)(?:[\/]+|$)/g; -} - -// Regex to find the device root, including trailing slash. E.g. 'c:\\'. -if (isWindows) { - var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; -} else { - var splitRootRe = /^[\/]*/; -} - -exports.realpathSync = function realpathSync(p, cache) { - // make p is absolute - p = pathModule.resolve(p); - - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return cache[p]; - } - - var original = p, - seenLinks = {}, - knownHard = {}; - - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; - - start(); - - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; - - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstatSync(base); - knownHard[base] = true; - } - } - - // walk down the path, swapping out linked pathparts for their real - // values - // NB: p.length changes. - while (pos < p.length) { - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; - - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - continue; - } - - var resolvedLink; - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // some known symbolic link. no need to stat again. - resolvedLink = cache[base]; - } else { - var stat = fs.lstatSync(base); - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - continue; - } - - // read the link if it wasn't read before - // dev/ino always return 0 on windows, so skip the check. - var linkTarget = null; - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - linkTarget = seenLinks[id]; - } - } - if (linkTarget === null) { - fs.statSync(base); - linkTarget = fs.readlinkSync(base); - } - resolvedLink = pathModule.resolve(previous, linkTarget); - // track this, if given a cache. - if (cache) cache[base] = resolvedLink; - if (!isWindows) seenLinks[id] = linkTarget; - } - - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } - - if (cache) cache[original] = p; - - return p; -}; - - -exports.realpath = function realpath(p, cache, cb) { - if (typeof cb !== 'function') { - cb = maybeCallback(cache); - cache = null; - } - - // make p is absolute - p = pathModule.resolve(p); - - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return process.nextTick(cb.bind(null, null, cache[p])); - } - - var original = p, - seenLinks = {}, - knownHard = {}; - - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; - - start(); - - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; - - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstat(base, function(err) { - if (err) return cb(err); - knownHard[base] = true; - LOOP(); - }); - } else { - process.nextTick(LOOP); - } - } - - // walk down the path, swapping out linked pathparts for their real - // values - function LOOP() { - // stop if scanned past end of path - if (pos >= p.length) { - if (cache) cache[original] = p; - return cb(null, p); - } - - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; - - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - return process.nextTick(LOOP); - } - - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // known symbolic link. no need to stat again. - return gotResolvedLink(cache[base]); - } - - return fs.lstat(base, gotStat); - } - - function gotStat(err, stat) { - if (err) return cb(err); - - // if not a symlink, skip to the next path part - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - return process.nextTick(LOOP); - } - - // stat & read the link if not read before - // call gotTarget as soon as the link target is known - // dev/ino always return 0 on windows, so skip the check. - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - return gotTarget(null, seenLinks[id], base); - } - } - fs.stat(base, function(err) { - if (err) return cb(err); - - fs.readlink(base, function(err, target) { - if (!isWindows) seenLinks[id] = target; - gotTarget(err, target); - }); - }); - } - - function gotTarget(err, target, base) { - if (err) return cb(err); - - var resolvedLink = pathModule.resolve(previous, target); - if (cache) cache[base] = resolvedLink; - gotResolvedLink(resolvedLink); - } - - function gotResolvedLink(resolvedLink) { - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } -}; diff --git a/node_modules/fs.realpath/package.json b/node_modules/fs.realpath/package.json deleted file mode 100644 index 03bc022..0000000 --- a/node_modules/fs.realpath/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "_from": "fs.realpath@^1.0.0", - "_id": "fs.realpath@1.0.0", - "_inBundle": false, - "_integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "_location": "/fs.realpath", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "fs.realpath@^1.0.0", - "name": "fs.realpath", - "escapedName": "fs.realpath", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/glob" - ], - "_resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "_shasum": "1504ad2523158caa40db4a2787cb01411994ea4f", - "_spec": "fs.realpath@^1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/glob", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/fs.realpath/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails", - "devDependencies": {}, - "files": [ - "old.js", - "index.js" - ], - "homepage": "https://github.com/isaacs/fs.realpath#readme", - "keywords": [ - "realpath", - "fs", - "polyfill" - ], - "license": "ISC", - "main": "index.js", - "name": "fs.realpath", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/fs.realpath.git" - }, - "scripts": { - "test": "tap test/*.js --cov" - }, - "version": "1.0.0" -} diff --git a/node_modules/gauge/CHANGELOG.md b/node_modules/gauge/CHANGELOG.md deleted file mode 100644 index 407bc19..0000000 --- a/node_modules/gauge/CHANGELOG.md +++ /dev/null @@ -1,160 +0,0 @@ -### v2.7.4 - -* Reset colors prior to ending a line, to eliminate flicker when a line - is trucated between start and end color sequences. - -### v2.7.3 - -* Only create our onExit handler when we're enabled and remove it when we're - disabled. This stops us from creating multiple onExit handlers when - multiple gauge objects are being used. -* Fix bug where if a theme name were given instead of a theme object, it - would crash. -* Remove supports-color because it's not actually used. Uhm. Yes, I just - updated it. >.> - -### v2.7.2 - -* Use supports-color instead of has-color (as the module has been renamed) - -### v2.7.1 - -* Bug fix: Calls to show/pulse while the progress bar is disabled should still - update our internal representation of what would be shown should it be enabled. - -### v2.7.0 - -* New feature: Add new `isEnabled` method to allow introspection of the gauge's - "enabledness" as controlled by `.enable()` and `.disable()`. - -### v2.6.0 - -* Bug fix: Don't run the code associated with `enable`/`disable` if the gauge - is already enabled or disabled respectively. This prevents leaking event - listeners, amongst other weirdness. -* New feature: Template items can have default values that will be used if no - value was otherwise passed in. - -### v2.5.3 - -* Default to `enabled` only if we have a tty. Users can always override - this by passing in the `enabled` option explicitly or by calling calling - `gauge.enable()`. - -### v2.5.2 - -* Externalized `./console-strings.js` into `console-control-strings`. - -### v2.5.1 - -* Update to `signal-exit@3.0.0`, which fixes a compatibility bug with the - node profiler. -* [#39](https://github.com/iarna/gauge/pull/39) Fix tests on 0.10 and add - a missing devDependency. ([@helloyou2012](https://github.com/helloyou2012)) - -### v2.5.0 - -* Add way to programmatically fetch a list of theme names in a themeset - (`Themeset.getThemeNames`). - -### v2.4.0 - -* Add support for setting themesets on existing gauge objects. -* Add post-IO callback to `gauge.hide()` as it is somtetimes necessary when - your terminal is interleaving output from multiple filehandles (ie, stdout - & stderr). - -### v2.3.1 - -* Fix a refactor bug in setTheme where it wasn't accepting the various types - of args it should. - -### v2.3.0 - -#### FEATURES - -* Add setTemplate & setTheme back in. -* Add support for named themes, you can now ask for things like 'colorASCII' - and 'brailleSpinner'. Of course, you can still pass in theme objects. - Additionally you can now pass in an object with `hasUnicode`, `hasColor` and - `platform` keys in order to override our guesses as to those values when - selecting a default theme from the themeset. -* Make the output stream optional (it defaults to `process.stderr` now). -* Add `setWriteTo(stream[, tty])` to change the output stream and, - optionally, tty. - -#### BUG FIXES & REFACTORING - -* Abort the display phase early if we're supposed to be hidden and we are. -* Stop printing a bunch of spaces at the end of lines, since we're already - using an erase-to-end-of-line code anyway. -* The unicode themes were missing the subsection separator. - -### v2.2.1 - -* Fix image in readme - -### v2.2.0 - -* All new themes API– reference themes by name and pass in custom themes and - themesets (themesets get platform support autodetection done on them to - select the best theme). Theme mixins let you add features to all existing - themes. -* Much, much improved test coverage. - -### v2.1.0 - -* Got rid of ░ in the default platform, noUnicode, hasColor theme. Thanks - to @yongtw123 for pointing out this had snuck in. -* Fiddled with the demo output to make it easier to see the spinner spin. Also - added prints before each platforms test output. -* I forgot to include `signal-exit` in our deps. <.< Thank you @KenanY for - finding this. Then I was lazy and made a new commit instead of using his - PR. Again, thank you for your patience @KenenY. -* Drastically speed up travis testing. -* Add a small javascript demo (demo.js) for showing off the various themes - (and testing them on diff platforms). -* Change: The subsection separator from ⁄ and / (different chars) to >. -* Fix crasher: A show or pulse without a label would cause the template renderer - to complain about a missing value. -* New feature: Add the ability to disable the clean-up-on-exit behavior. - Not something I expect to be widely desirable, but important if you have - multiple distinct gauge instances in your app. -* Use our own color support detection. - The `has-color` module proved too magic for my needs, making assumptions - as to which stream we write to and reading command line arguments. - -### v2.0.0 - -This is a major rewrite of the internals. Externally there are fewer -changes: - -* On node>0.8 gauge object now prints updates at a fixed rate. This means - that when you call `show` it may wate up to `updateInterval` ms before it - actually prints an update. You override this behavior with the - `fixedFramerate` option. -* The gauge object now keeps the cursor hidden as long as it's enabled and - shown. -* The constructor's arguments have changed, now it takes a mandatory output - stream and an optional options object. The stream no longer needs to be - an `ansi`ified stream, although it can be if you want (but we won't make - use of its special features). -* Previously the gauge was disabled by default if `process.stdout` wasn't a - tty. Now it always defaults to enabled. If you want the previous - behavior set the `enabled` option to `process.stdout.isTTY`. -* The constructor's options have changed– see the docs for details. -* Themes are entirely different. If you were using a custom theme, or - referring to one directly (eg via `Gauge.unicode` or `Gauge.ascii`) then - you'll need to change your code. You can get the equivalent of the latter - with: - ``` - var themes = require('gauge/themes') - var unicodeTheme = themes(true, true) // returns the color unicode theme for your platform - ``` - The default themes no longer use any ambiguous width characters, so even - if you choose to display those as wide your progress bar should still - display correctly. -* Templates are entirely different and if you were using a custom one, you - should consult the documentation to learn how to recreate it. If you were - using the default, be aware that it has changed and the result looks quite - a bit different. diff --git a/node_modules/gauge/LICENSE b/node_modules/gauge/LICENSE deleted file mode 100644 index e756052..0000000 --- a/node_modules/gauge/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2014, Rebecca Turner - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/gauge/README.md b/node_modules/gauge/README.md deleted file mode 100644 index bdd60e3..0000000 --- a/node_modules/gauge/README.md +++ /dev/null @@ -1,399 +0,0 @@ -gauge -===== - -A nearly stateless terminal based horizontal gauge / progress bar. - -```javascript -var Gauge = require("gauge") - -var gauge = new Gauge() - -gauge.show("test", 0.20) - -gauge.pulse("this") - -gauge.hide() -``` - -![](gauge-demo.gif) - - -### CHANGES FROM 1.x - -Gauge 2.x is breaking release, please see the [changelog] for details on -what's changed if you were previously a user of this module. - -[changelog]: CHANGELOG.md - -### THE GAUGE CLASS - -This is the typical interface to the module– it provides a pretty -fire-and-forget interface to displaying your status information. - -``` -var Gauge = require("gauge") - -var gauge = new Gauge([stream], [options]) -``` - -* **stream** – *(optional, default STDERR)* A stream that progress bar - updates are to be written to. Gauge honors backpressure and will pause - most writing if it is indicated. -* **options** – *(optional)* An option object. - -Constructs a new gauge. Gauges are drawn on a single line, and are not drawn -if **stream** isn't a tty and a tty isn't explicitly provided. - -If **stream** is a terminal or if you pass in **tty** to **options** then we -will detect terminal resizes and redraw to fit. We do this by watching for -`resize` events on the tty. (To work around a bug in verisons of Node prior -to 2.5.0, we watch for them on stdout if the tty is stderr.) Resizes to -larger window sizes will be clean, but shrinking the window will always -result in some cruft. - -**IMPORTANT:** If you prevously were passing in a non-tty stream but you still -want output (for example, a stream wrapped by the `ansi` module) then you -need to pass in the **tty** option below, as `gauge` needs access to -the underlying tty in order to do things like terminal resizes and terminal -width detection. - -The **options** object can have the following properties, all of which are -optional: - -* **updateInterval**: How often gauge updates should be drawn, in miliseconds. -* **fixedFramerate**: Defaults to false on node 0.8, true on everything - else. When this is true a timer is created to trigger once every - `updateInterval` ms, when false, updates are printed as soon as they come - in but updates more often than `updateInterval` are ignored. The reason - 0.8 doesn't have this set to true is that it can't `unref` its timer and - so it would stop your program from exiting– if you want to use this - feature with 0.8 just make sure you call `gauge.disable()` before you - expect your program to exit. -* **themes**: A themeset to use when selecting the theme to use. Defaults - to `gauge/themes`, see the [themes] documentation for details. -* **theme**: Select a theme for use, it can be a: - * Theme object, in which case the **themes** is not used. - * The name of a theme, which will be looked up in the current *themes* - object. - * A configuration object with any of `hasUnicode`, `hasColor` or - `platform` keys, which if wlll be used to override our guesses when making - a default theme selection. - - If no theme is selected then a default is picked using a combination of our - best guesses at your OS, color support and unicode support. -* **template**: Describes what you want your gauge to look like. The - default is what npm uses. Detailed [documentation] is later in this - document. -* **hideCursor**: Defaults to true. If true, then the cursor will be hidden - while the gauge is displayed. -* **tty**: The tty that you're ultimately writing to. Defaults to the same - as **stream**. This is used for detecting the width of the terminal and - resizes. The width used is `tty.columns - 1`. If no tty is available then - a width of `79` is assumed. -* **enabled**: Defaults to true if `tty` is a TTY, false otherwise. If true - the gauge starts enabled. If disabled then all update commands are - ignored and no gauge will be printed until you call `.enable()`. -* **Plumbing**: The class to use to actually generate the gauge for - printing. This defaults to `require('gauge/plumbing')` and ordinarly you - shouldn't need to override this. -* **cleanupOnExit**: Defaults to true. Ordinarily we register an exit - handler to make sure your cursor is turned back on and the progress bar - erased when your process exits, even if you Ctrl-C out or otherwise exit - unexpectedly. You can disable this and it won't register the exit handler. - -[has-unicode]: https://www.npmjs.com/package/has-unicode -[themes]: #themes -[documentation]: #templates - -#### `gauge.show(section | status, [completed])` - -The first argument is either the section, the name of the current thing -contributing to progress, or an object with keys like **section**, -**subsection** & **completed** (or any others you have types for in a custom -template). If you don't want to update or set any of these you can pass -`null` and it will be ignored. - -The second argument is the percent completed as a value between 0 and 1. -Without it, completion is just not updated. You'll also note that completion -can be passed in as part of a status object as the first argument. If both -it and the completed argument are passed in, the completed argument wins. - -#### `gauge.hide([cb])` - -Removes the gauge from the terminal. Optionally, callback `cb` after IO has -had an opportunity to happen (currently this just means after `setImmediate` -has called back.) - -It turns out this is important when you're pausing the progress bar on one -filehandle and printing to another– otherwise (with a big enough print) node -can end up printing the "end progress bar" bits to the progress bar filehandle -while other stuff is printing to another filehandle. These getting interleaved -can cause corruption in some terminals. - -#### `gauge.pulse([subsection])` - -* **subsection** – *(optional)* The specific thing that triggered this pulse - -Spins the spinner in the gauge to show output. If **subsection** is -included then it will be combined with the last name passed to `gauge.show`. - -#### `gauge.disable()` - -Hides the gauge and ignores further calls to `show` or `pulse`. - -#### `gauge.enable()` - -Shows the gauge and resumes updating when `show` or `pulse` is called. - -#### `gauge.isEnabled()` - -Returns true if the gauge is enabled. - -#### `gauge.setThemeset(themes)` - -Change the themeset to select a theme from. The same as the `themes` option -used in the constructor. The theme will be reselected from this themeset. - -#### `gauge.setTheme(theme)` - -Change the active theme, will be displayed with the next show or pulse. This can be: - -* Theme object, in which case the **themes** is not used. -* The name of a theme, which will be looked up in the current *themes* - object. -* A configuration object with any of `hasUnicode`, `hasColor` or - `platform` keys, which if wlll be used to override our guesses when making - a default theme selection. - -If no theme is selected then a default is picked using a combination of our -best guesses at your OS, color support and unicode support. - -#### `gauge.setTemplate(template)` - -Change the active template, will be displayed with the next show or pulse - -### Tracking Completion - -If you have more than one thing going on that you want to track completion -of, you may find the related [are-we-there-yet] helpful. It's `change` -event can be wired up to the `show` method to get a more traditional -progress bar interface. - -[are-we-there-yet]: https://www.npmjs.com/package/are-we-there-yet - -### THEMES - -``` -var themes = require('gauge/themes') - -// fetch the default color unicode theme for this platform -var ourTheme = themes({hasUnicode: true, hasColor: true}) - -// fetch the default non-color unicode theme for osx -var ourTheme = themes({hasUnicode: true, hasColor: false, platform: 'darwin'}) - -// create a new theme based on the color ascii theme for this platform -// that brackets the progress bar with arrows -var ourTheme = themes.newTheme(theme(hasUnicode: false, hasColor: true}), { - preProgressbar: '→', - postProgressbar: '←' -}) -``` - -The object returned by `gauge/themes` is an instance of the `ThemeSet` class. - -``` -var ThemeSet = require('gauge/theme-set') -var themes = new ThemeSet() -// or -var themes = require('gauge/themes') -var mythemes = themes.newThemeset() // creates a new themeset based on the default themes -``` - -#### themes(opts) -#### themes.getDefault(opts) - -Theme objects are a function that fetches the default theme based on -platform, unicode and color support. - -Options is an object with the following properties: - -* **hasUnicode** - If true, fetch a unicode theme, if no unicode theme is - available then a non-unicode theme will be used. -* **hasColor** - If true, fetch a color theme, if no color theme is - available a non-color theme will be used. -* **platform** (optional) - Defaults to `process.platform`. If no - platform match is available then `fallback` is used instead. - -If no compatible theme can be found then an error will be thrown with a -`code` of `EMISSINGTHEME`. - -#### themes.addTheme(themeName, themeObj) -#### themes.addTheme(themeName, [parentTheme], newTheme) - -Adds a named theme to the themeset. You can pass in either a theme object, -as returned by `themes.newTheme` or the arguments you'd pass to -`themes.newTheme`. - -#### themes.getThemeNames() - -Return a list of all of the names of the themes in this themeset. Suitable -for use in `themes.getTheme(…)`. - -#### themes.getTheme(name) - -Returns the theme object from this theme set named `name`. - -If `name` does not exist in this themeset an error will be thrown with -a `code` of `EMISSINGTHEME`. - -#### themes.setDefault([opts], themeName) - -`opts` is an object with the following properties. - -* **platform** - Defaults to `'fallback'`. If your theme is platform - specific, specify that here with the platform from `process.platform`, eg, - `win32`, `darwin`, etc. -* **hasUnicode** - Defaults to `false`. If your theme uses unicode you - should set this to true. -* **hasColor** - Defaults to `false`. If your theme uses color you should - set this to true. - -`themeName` is the name of the theme (as given to `addTheme`) to use for -this set of `opts`. - -#### themes.newTheme([parentTheme,] newTheme) - -Create a new theme object based on `parentTheme`. If no `parentTheme` is -provided then a minimal parentTheme that defines functions for rendering the -activity indicator (spinner) and progress bar will be defined. (This -fallback parent is defined in `gauge/base-theme`.) - -newTheme should be a bare object– we'll start by discussing the properties -defined by the default themes: - -* **preProgressbar** - displayed prior to the progress bar, if the progress - bar is displayed. -* **postProgressbar** - displayed after the progress bar, if the progress bar - is displayed. -* **progressBarTheme** - The subtheme passed through to the progress bar - renderer, it's an object with `complete` and `remaining` properties - that are the strings you want repeated for those sections of the progress - bar. -* **activityIndicatorTheme** - The theme for the activity indicator (spinner), - this can either be a string, in which each character is a different step, or - an array of strings. -* **preSubsection** - Displayed as a separator between the `section` and - `subsection` when the latter is printed. - -More generally, themes can have any value that would be a valid value when rendering -templates. The properties in the theme are used when their name matches a type in -the template. Their values can be: - -* **strings & numbers** - They'll be included as is -* **function (values, theme, width)** - Should return what you want in your output. - *values* is an object with values provided via `gauge.show`, - *theme* is the theme specific to this item (see below) or this theme object, - and *width* is the number of characters wide your result should be. - -There are a couple of special prefixes: - -* **pre** - Is shown prior to the property, if its displayed. -* **post** - Is shown after the property, if its displayed. - -And one special suffix: - -* **Theme** - Its value is passed to a function-type item as the theme. - -#### themes.addToAllThemes(theme) - -This *mixes-in* `theme` into all themes currently defined. It also adds it -to the default parent theme for this themeset, so future themes added to -this themeset will get the values from `theme` by default. - -#### themes.newThemeset() - -Copy the current themeset into a new one. This allows you to easily inherit -one themeset from another. - -### TEMPLATES - -A template is an array of objects and strings that, after being evaluated, -will be turned into the gauge line. The default template is: - -```javascript -[ - {type: 'progressbar', length: 20}, - {type: 'activityIndicator', kerning: 1, length: 1}, - {type: 'section', kerning: 1, default: ''}, - {type: 'subsection', kerning: 1, default: ''} -] -``` - -The various template elements can either be **plain strings**, in which case they will -be be included verbatum in the output, or objects with the following properties: - -* *type* can be any of the following plus any keys you pass into `gauge.show` plus - any keys you have on a custom theme. - * `section` – What big thing you're working on now. - * `subsection` – What component of that thing is currently working. - * `activityIndicator` – Shows a spinner using the `activityIndicatorTheme` - from your active theme. - * `progressbar` – A progress bar representing your current `completed` - using the `progressbarTheme` from your active theme. -* *kerning* – Number of spaces that must be between this item and other - items, if this item is displayed at all. -* *maxLength* – The maximum length for this element. If its value is longer it - will be truncated. -* *minLength* – The minimum length for this element. If its value is shorter it - will be padded according to the *align* value. -* *align* – (Default: left) Possible values "left", "right" and "center". Works - as you'd expect from word processors. -* *length* – Provides a single value for both *minLength* and *maxLength*. If both - *length* and *minLength or *maxLength* are specifed then the latter take precedence. -* *value* – A literal value to use for this template item. -* *default* – A default value to use for this template item if a value - wasn't otherwise passed in. - -### PLUMBING - -This is the super simple, assume nothing, do no magic internals used by gauge to -implement its ordinary interface. - -``` -var Plumbing = require('gauge/plumbing') -var gauge = new Plumbing(theme, template, width) -``` - -* **theme**: The theme to use. -* **template**: The template to use. -* **width**: How wide your gauge should be - -#### `gauge.setTheme(theme)` - -Change the active theme. - -#### `gauge.setTemplate(template)` - -Change the active template. - -#### `gauge.setWidth(width)` - -Change the width to render at. - -#### `gauge.hide()` - -Return the string necessary to hide the progress bar - -#### `gauge.hideCursor()` - -Return a string to hide the cursor. - -#### `gauge.showCursor()` - -Return a string to show the cursor. - -#### `gauge.show(status)` - -Using `status` for values, render the provided template with the theme and return -a string that is suitable for printing to update the gauge. diff --git a/node_modules/gauge/base-theme.js b/node_modules/gauge/base-theme.js deleted file mode 100644 index 0b67638..0000000 --- a/node_modules/gauge/base-theme.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' -var spin = require('./spin.js') -var progressBar = require('./progress-bar.js') - -module.exports = { - activityIndicator: function (values, theme, width) { - if (values.spun == null) return - return spin(theme, values.spun) - }, - progressbar: function (values, theme, width) { - if (values.completed == null) return - return progressBar(theme, width, values.completed) - } -} diff --git a/node_modules/gauge/error.js b/node_modules/gauge/error.js deleted file mode 100644 index d9914ba..0000000 --- a/node_modules/gauge/error.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict' -var util = require('util') - -var User = exports.User = function User (msg) { - var err = new Error(msg) - Error.captureStackTrace(err, User) - err.code = 'EGAUGE' - return err -} - -exports.MissingTemplateValue = function MissingTemplateValue (item, values) { - var err = new User(util.format('Missing template value "%s"', item.type)) - Error.captureStackTrace(err, MissingTemplateValue) - err.template = item - err.values = values - return err -} - -exports.Internal = function Internal (msg) { - var err = new Error(msg) - Error.captureStackTrace(err, Internal) - err.code = 'EGAUGEINTERNAL' - return err -} diff --git a/node_modules/gauge/has-color.js b/node_modules/gauge/has-color.js deleted file mode 100644 index e283a25..0000000 --- a/node_modules/gauge/has-color.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict' - -module.exports = isWin32() || isColorTerm() - -function isWin32 () { - return process.platform === 'win32' -} - -function isColorTerm () { - var termHasColor = /^screen|^xterm|^vt100|color|ansi|cygwin|linux/i - return !!process.env.COLORTERM || termHasColor.test(process.env.TERM) -} diff --git a/node_modules/gauge/index.js b/node_modules/gauge/index.js deleted file mode 100644 index c553240..0000000 --- a/node_modules/gauge/index.js +++ /dev/null @@ -1,233 +0,0 @@ -'use strict' -var Plumbing = require('./plumbing.js') -var hasUnicode = require('has-unicode') -var hasColor = require('./has-color.js') -var onExit = require('signal-exit') -var defaultThemes = require('./themes') -var setInterval = require('./set-interval.js') -var process = require('./process.js') -var setImmediate = require('./set-immediate') - -module.exports = Gauge - -function callWith (obj, method) { - return function () { - return method.call(obj) - } -} - -function Gauge (arg1, arg2) { - var options, writeTo - if (arg1 && arg1.write) { - writeTo = arg1 - options = arg2 || {} - } else if (arg2 && arg2.write) { - writeTo = arg2 - options = arg1 || {} - } else { - writeTo = process.stderr - options = arg1 || arg2 || {} - } - - this._status = { - spun: 0, - section: '', - subsection: '' - } - this._paused = false // are we paused for back pressure? - this._disabled = true // are all progress bar updates disabled? - this._showing = false // do we WANT the progress bar on screen - this._onScreen = false // IS the progress bar on screen - this._needsRedraw = false // should we print something at next tick? - this._hideCursor = options.hideCursor == null ? true : options.hideCursor - this._fixedFramerate = options.fixedFramerate == null - ? !(/^v0\.8\./.test(process.version)) - : options.fixedFramerate - this._lastUpdateAt = null - this._updateInterval = options.updateInterval == null ? 50 : options.updateInterval - - this._themes = options.themes || defaultThemes - this._theme = options.theme - var theme = this._computeTheme(options.theme) - var template = options.template || [ - {type: 'progressbar', length: 20}, - {type: 'activityIndicator', kerning: 1, length: 1}, - {type: 'section', kerning: 1, default: ''}, - {type: 'subsection', kerning: 1, default: ''} - ] - this.setWriteTo(writeTo, options.tty) - var PlumbingClass = options.Plumbing || Plumbing - this._gauge = new PlumbingClass(theme, template, this.getWidth()) - - this._$$doRedraw = callWith(this, this._doRedraw) - this._$$handleSizeChange = callWith(this, this._handleSizeChange) - - this._cleanupOnExit = options.cleanupOnExit == null || options.cleanupOnExit - this._removeOnExit = null - - if (options.enabled || (options.enabled == null && this._tty && this._tty.isTTY)) { - this.enable() - } else { - this.disable() - } -} -Gauge.prototype = {} - -Gauge.prototype.isEnabled = function () { - return !this._disabled -} - -Gauge.prototype.setTemplate = function (template) { - this._gauge.setTemplate(template) - if (this._showing) this._requestRedraw() -} - -Gauge.prototype._computeTheme = function (theme) { - if (!theme) theme = {} - if (typeof theme === 'string') { - theme = this._themes.getTheme(theme) - } else if (theme && (Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null)) { - var useUnicode = theme.hasUnicode == null ? hasUnicode() : theme.hasUnicode - var useColor = theme.hasColor == null ? hasColor : theme.hasColor - theme = this._themes.getDefault({hasUnicode: useUnicode, hasColor: useColor, platform: theme.platform}) - } - return theme -} - -Gauge.prototype.setThemeset = function (themes) { - this._themes = themes - this.setTheme(this._theme) -} - -Gauge.prototype.setTheme = function (theme) { - this._gauge.setTheme(this._computeTheme(theme)) - if (this._showing) this._requestRedraw() - this._theme = theme -} - -Gauge.prototype._requestRedraw = function () { - this._needsRedraw = true - if (!this._fixedFramerate) this._doRedraw() -} - -Gauge.prototype.getWidth = function () { - return ((this._tty && this._tty.columns) || 80) - 1 -} - -Gauge.prototype.setWriteTo = function (writeTo, tty) { - var enabled = !this._disabled - if (enabled) this.disable() - this._writeTo = writeTo - this._tty = tty || - (writeTo === process.stderr && process.stdout.isTTY && process.stdout) || - (writeTo.isTTY && writeTo) || - this._tty - if (this._gauge) this._gauge.setWidth(this.getWidth()) - if (enabled) this.enable() -} - -Gauge.prototype.enable = function () { - if (!this._disabled) return - this._disabled = false - if (this._tty) this._enableEvents() - if (this._showing) this.show() -} - -Gauge.prototype.disable = function () { - if (this._disabled) return - if (this._showing) { - this._lastUpdateAt = null - this._showing = false - this._doRedraw() - this._showing = true - } - this._disabled = true - if (this._tty) this._disableEvents() -} - -Gauge.prototype._enableEvents = function () { - if (this._cleanupOnExit) { - this._removeOnExit = onExit(callWith(this, this.disable)) - } - this._tty.on('resize', this._$$handleSizeChange) - if (this._fixedFramerate) { - this.redrawTracker = setInterval(this._$$doRedraw, this._updateInterval) - if (this.redrawTracker.unref) this.redrawTracker.unref() - } -} - -Gauge.prototype._disableEvents = function () { - this._tty.removeListener('resize', this._$$handleSizeChange) - if (this._fixedFramerate) clearInterval(this.redrawTracker) - if (this._removeOnExit) this._removeOnExit() -} - -Gauge.prototype.hide = function (cb) { - if (this._disabled) return cb && process.nextTick(cb) - if (!this._showing) return cb && process.nextTick(cb) - this._showing = false - this._doRedraw() - cb && setImmediate(cb) -} - -Gauge.prototype.show = function (section, completed) { - this._showing = true - if (typeof section === 'string') { - this._status.section = section - } else if (typeof section === 'object') { - var sectionKeys = Object.keys(section) - for (var ii = 0; ii < sectionKeys.length; ++ii) { - var key = sectionKeys[ii] - this._status[key] = section[key] - } - } - if (completed != null) this._status.completed = completed - if (this._disabled) return - this._requestRedraw() -} - -Gauge.prototype.pulse = function (subsection) { - this._status.subsection = subsection || '' - this._status.spun ++ - if (this._disabled) return - if (!this._showing) return - this._requestRedraw() -} - -Gauge.prototype._handleSizeChange = function () { - this._gauge.setWidth(this._tty.columns - 1) - this._requestRedraw() -} - -Gauge.prototype._doRedraw = function () { - if (this._disabled || this._paused) return - if (!this._fixedFramerate) { - var now = Date.now() - if (this._lastUpdateAt && now - this._lastUpdateAt < this._updateInterval) return - this._lastUpdateAt = now - } - if (!this._showing && this._onScreen) { - this._onScreen = false - var result = this._gauge.hide() - if (this._hideCursor) { - result += this._gauge.showCursor() - } - return this._writeTo.write(result) - } - if (!this._showing && !this._onScreen) return - if (this._showing && !this._onScreen) { - this._onScreen = true - this._needsRedraw = true - if (this._hideCursor) { - this._writeTo.write(this._gauge.hideCursor()) - } - } - if (!this._needsRedraw) return - if (!this._writeTo.write(this._gauge.show(this._status))) { - this._paused = true - this._writeTo.on('drain', callWith(this, function () { - this._paused = false - this._doRedraw() - })) - } -} diff --git a/node_modules/gauge/package.json b/node_modules/gauge/package.json deleted file mode 100644 index b937bd8..0000000 --- a/node_modules/gauge/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "_from": "gauge@~2.7.3", - "_id": "gauge@2.7.4", - "_inBundle": false, - "_integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "_location": "/gauge", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "gauge@~2.7.3", - "name": "gauge", - "escapedName": "gauge", - "rawSpec": "~2.7.3", - "saveSpec": null, - "fetchSpec": "~2.7.3" - }, - "_requiredBy": [ - "/npmlog" - ], - "_resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "_shasum": "2c03405c7538c39d7eb37b317022e325fb018bf7", - "_spec": "gauge@~2.7.3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/npmlog", - "author": { - "name": "Rebecca Turner", - "email": "me@re-becca.org" - }, - "bugs": { - "url": "https://github.com/iarna/gauge/issues" - }, - "bundleDependencies": false, - "dependencies": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - }, - "deprecated": false, - "description": "A terminal based horizontal guage", - "devDependencies": { - "readable-stream": "^2.0.6", - "require-inject": "^1.4.0", - "standard": "^7.1.2", - "tap": "^5.7.2", - "through2": "^2.0.0" - }, - "files": [ - "base-theme.js", - "CHANGELOG.md", - "error.js", - "has-color.js", - "index.js", - "LICENSE", - "package.json", - "plumbing.js", - "process.js", - "progress-bar.js", - "README.md", - "render-template.js", - "set-immediate.js", - "set-interval.js", - "spin.js", - "template-item.js", - "theme-set.js", - "themes.js", - "wide-truncate.js" - ], - "homepage": "https://github.com/iarna/gauge", - "keywords": [ - "progressbar", - "progress", - "gauge" - ], - "license": "ISC", - "main": "index.js", - "name": "gauge", - "repository": { - "type": "git", - "url": "git+https://github.com/iarna/gauge.git" - }, - "scripts": { - "prepublish": "rm -f *~", - "test": "standard && tap test/*.js --coverage" - }, - "version": "2.7.4" -} diff --git a/node_modules/gauge/plumbing.js b/node_modules/gauge/plumbing.js deleted file mode 100644 index 1afb4af..0000000 --- a/node_modules/gauge/plumbing.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict' -var consoleControl = require('console-control-strings') -var renderTemplate = require('./render-template.js') -var validate = require('aproba') - -var Plumbing = module.exports = function (theme, template, width) { - if (!width) width = 80 - validate('OAN', [theme, template, width]) - this.showing = false - this.theme = theme - this.width = width - this.template = template -} -Plumbing.prototype = {} - -Plumbing.prototype.setTheme = function (theme) { - validate('O', [theme]) - this.theme = theme -} - -Plumbing.prototype.setTemplate = function (template) { - validate('A', [template]) - this.template = template -} - -Plumbing.prototype.setWidth = function (width) { - validate('N', [width]) - this.width = width -} - -Plumbing.prototype.hide = function () { - return consoleControl.gotoSOL() + consoleControl.eraseLine() -} - -Plumbing.prototype.hideCursor = consoleControl.hideCursor - -Plumbing.prototype.showCursor = consoleControl.showCursor - -Plumbing.prototype.show = function (status) { - var values = Object.create(this.theme) - for (var key in status) { - values[key] = status[key] - } - - return renderTemplate(this.width, this.template, values).trim() + - consoleControl.color('reset') + - consoleControl.eraseLine() + consoleControl.gotoSOL() -} diff --git a/node_modules/gauge/process.js b/node_modules/gauge/process.js deleted file mode 100644 index 05e8569..0000000 --- a/node_modules/gauge/process.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict' -// this exists so we can replace it during testing -module.exports = process diff --git a/node_modules/gauge/progress-bar.js b/node_modules/gauge/progress-bar.js deleted file mode 100644 index 7f8dd68..0000000 --- a/node_modules/gauge/progress-bar.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict' -var validate = require('aproba') -var renderTemplate = require('./render-template.js') -var wideTruncate = require('./wide-truncate') -var stringWidth = require('string-width') - -module.exports = function (theme, width, completed) { - validate('ONN', [theme, width, completed]) - if (completed < 0) completed = 0 - if (completed > 1) completed = 1 - if (width <= 0) return '' - var sofar = Math.round(width * completed) - var rest = width - sofar - var template = [ - {type: 'complete', value: repeat(theme.complete, sofar), length: sofar}, - {type: 'remaining', value: repeat(theme.remaining, rest), length: rest} - ] - return renderTemplate(width, template, theme) -} - -// lodash's way of repeating -function repeat (string, width) { - var result = '' - var n = width - do { - if (n % 2) { - result += string - } - n = Math.floor(n / 2) - /*eslint no-self-assign: 0*/ - string += string - } while (n && stringWidth(result) < width) - - return wideTruncate(result, width) -} diff --git a/node_modules/gauge/render-template.js b/node_modules/gauge/render-template.js deleted file mode 100644 index 3261bfb..0000000 --- a/node_modules/gauge/render-template.js +++ /dev/null @@ -1,181 +0,0 @@ -'use strict' -var align = require('wide-align') -var validate = require('aproba') -var objectAssign = require('object-assign') -var wideTruncate = require('./wide-truncate') -var error = require('./error') -var TemplateItem = require('./template-item') - -function renderValueWithValues (values) { - return function (item) { - return renderValue(item, values) - } -} - -var renderTemplate = module.exports = function (width, template, values) { - var items = prepareItems(width, template, values) - var rendered = items.map(renderValueWithValues(values)).join('') - return align.left(wideTruncate(rendered, width), width) -} - -function preType (item) { - var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1) - return 'pre' + cappedTypeName -} - -function postType (item) { - var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1) - return 'post' + cappedTypeName -} - -function hasPreOrPost (item, values) { - if (!item.type) return - return values[preType(item)] || values[postType(item)] -} - -function generatePreAndPost (baseItem, parentValues) { - var item = objectAssign({}, baseItem) - var values = Object.create(parentValues) - var template = [] - var pre = preType(item) - var post = postType(item) - if (values[pre]) { - template.push({value: values[pre]}) - values[pre] = null - } - item.minLength = null - item.length = null - item.maxLength = null - template.push(item) - values[item.type] = values[item.type] - if (values[post]) { - template.push({value: values[post]}) - values[post] = null - } - return function ($1, $2, length) { - return renderTemplate(length, template, values) - } -} - -function prepareItems (width, template, values) { - function cloneAndObjectify (item, index, arr) { - var cloned = new TemplateItem(item, width) - var type = cloned.type - if (cloned.value == null) { - if (!(type in values)) { - if (cloned.default == null) { - throw new error.MissingTemplateValue(cloned, values) - } else { - cloned.value = cloned.default - } - } else { - cloned.value = values[type] - } - } - if (cloned.value == null || cloned.value === '') return null - cloned.index = index - cloned.first = index === 0 - cloned.last = index === arr.length - 1 - if (hasPreOrPost(cloned, values)) cloned.value = generatePreAndPost(cloned, values) - return cloned - } - - var output = template.map(cloneAndObjectify).filter(function (item) { return item != null }) - - var outputLength = 0 - var remainingSpace = width - var variableCount = output.length - - function consumeSpace (length) { - if (length > remainingSpace) length = remainingSpace - outputLength += length - remainingSpace -= length - } - - function finishSizing (item, length) { - if (item.finished) throw new error.Internal('Tried to finish template item that was already finished') - if (length === Infinity) throw new error.Internal('Length of template item cannot be infinity') - if (length != null) item.length = length - item.minLength = null - item.maxLength = null - --variableCount - item.finished = true - if (item.length == null) item.length = item.getBaseLength() - if (item.length == null) throw new error.Internal('Finished template items must have a length') - consumeSpace(item.getLength()) - } - - output.forEach(function (item) { - if (!item.kerning) return - var prevPadRight = item.first ? 0 : output[item.index - 1].padRight - if (!item.first && prevPadRight < item.kerning) item.padLeft = item.kerning - prevPadRight - if (!item.last) item.padRight = item.kerning - }) - - // Finish any that have a fixed (literal or intuited) length - output.forEach(function (item) { - if (item.getBaseLength() == null) return - finishSizing(item) - }) - - var resized = 0 - var resizing - var hunkSize - do { - resizing = false - hunkSize = Math.round(remainingSpace / variableCount) - output.forEach(function (item) { - if (item.finished) return - if (!item.maxLength) return - if (item.getMaxLength() < hunkSize) { - finishSizing(item, item.maxLength) - resizing = true - } - }) - } while (resizing && resized++ < output.length) - if (resizing) throw new error.Internal('Resize loop iterated too many times while determining maxLength') - - resized = 0 - do { - resizing = false - hunkSize = Math.round(remainingSpace / variableCount) - output.forEach(function (item) { - if (item.finished) return - if (!item.minLength) return - if (item.getMinLength() >= hunkSize) { - finishSizing(item, item.minLength) - resizing = true - } - }) - } while (resizing && resized++ < output.length) - if (resizing) throw new error.Internal('Resize loop iterated too many times while determining minLength') - - hunkSize = Math.round(remainingSpace / variableCount) - output.forEach(function (item) { - if (item.finished) return - finishSizing(item, hunkSize) - }) - - return output -} - -function renderFunction (item, values, length) { - validate('OON', arguments) - if (item.type) { - return item.value(values, values[item.type + 'Theme'] || {}, length) - } else { - return item.value(values, {}, length) - } -} - -function renderValue (item, values) { - var length = item.getBaseLength() - var value = typeof item.value === 'function' ? renderFunction(item, values, length) : item.value - if (value == null || value === '') return '' - var alignWith = align[item.align] || align.left - var leftPadding = item.padLeft ? align.left('', item.padLeft) : '' - var rightPadding = item.padRight ? align.right('', item.padRight) : '' - var truncated = wideTruncate(String(value), length) - var aligned = alignWith(truncated, length) - return leftPadding + aligned + rightPadding -} diff --git a/node_modules/gauge/set-immediate.js b/node_modules/gauge/set-immediate.js deleted file mode 100644 index 6650a48..0000000 --- a/node_modules/gauge/set-immediate.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' -var process = require('./process') -try { - module.exports = setImmediate -} catch (ex) { - module.exports = process.nextTick -} diff --git a/node_modules/gauge/set-interval.js b/node_modules/gauge/set-interval.js deleted file mode 100644 index 5761987..0000000 --- a/node_modules/gauge/set-interval.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict' -// this exists so we can replace it during testing -module.exports = setInterval diff --git a/node_modules/gauge/spin.js b/node_modules/gauge/spin.js deleted file mode 100644 index 34142ee..0000000 --- a/node_modules/gauge/spin.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict' - -module.exports = function spin (spinstr, spun) { - return spinstr[spun % spinstr.length] -} diff --git a/node_modules/gauge/template-item.js b/node_modules/gauge/template-item.js deleted file mode 100644 index e46f447..0000000 --- a/node_modules/gauge/template-item.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict' -var stringWidth = require('string-width') - -module.exports = TemplateItem - -function isPercent (num) { - if (typeof num !== 'string') return false - return num.slice(-1) === '%' -} - -function percent (num) { - return Number(num.slice(0, -1)) / 100 -} - -function TemplateItem (values, outputLength) { - this.overallOutputLength = outputLength - this.finished = false - this.type = null - this.value = null - this.length = null - this.maxLength = null - this.minLength = null - this.kerning = null - this.align = 'left' - this.padLeft = 0 - this.padRight = 0 - this.index = null - this.first = null - this.last = null - if (typeof values === 'string') { - this.value = values - } else { - for (var prop in values) this[prop] = values[prop] - } - // Realize percents - if (isPercent(this.length)) { - this.length = Math.round(this.overallOutputLength * percent(this.length)) - } - if (isPercent(this.minLength)) { - this.minLength = Math.round(this.overallOutputLength * percent(this.minLength)) - } - if (isPercent(this.maxLength)) { - this.maxLength = Math.round(this.overallOutputLength * percent(this.maxLength)) - } - return this -} - -TemplateItem.prototype = {} - -TemplateItem.prototype.getBaseLength = function () { - var length = this.length - if (length == null && typeof this.value === 'string' && this.maxLength == null && this.minLength == null) { - length = stringWidth(this.value) - } - return length -} - -TemplateItem.prototype.getLength = function () { - var length = this.getBaseLength() - if (length == null) return null - return length + this.padLeft + this.padRight -} - -TemplateItem.prototype.getMaxLength = function () { - if (this.maxLength == null) return null - return this.maxLength + this.padLeft + this.padRight -} - -TemplateItem.prototype.getMinLength = function () { - if (this.minLength == null) return null - return this.minLength + this.padLeft + this.padRight -} - diff --git a/node_modules/gauge/theme-set.js b/node_modules/gauge/theme-set.js deleted file mode 100644 index 68971d5..0000000 --- a/node_modules/gauge/theme-set.js +++ /dev/null @@ -1,115 +0,0 @@ -'use strict' -var objectAssign = require('object-assign') - -module.exports = function () { - return ThemeSetProto.newThemeSet() -} - -var ThemeSetProto = {} - -ThemeSetProto.baseTheme = require('./base-theme.js') - -ThemeSetProto.newTheme = function (parent, theme) { - if (!theme) { - theme = parent - parent = this.baseTheme - } - return objectAssign({}, parent, theme) -} - -ThemeSetProto.getThemeNames = function () { - return Object.keys(this.themes) -} - -ThemeSetProto.addTheme = function (name, parent, theme) { - this.themes[name] = this.newTheme(parent, theme) -} - -ThemeSetProto.addToAllThemes = function (theme) { - var themes = this.themes - Object.keys(themes).forEach(function (name) { - objectAssign(themes[name], theme) - }) - objectAssign(this.baseTheme, theme) -} - -ThemeSetProto.getTheme = function (name) { - if (!this.themes[name]) throw this.newMissingThemeError(name) - return this.themes[name] -} - -ThemeSetProto.setDefault = function (opts, name) { - if (name == null) { - name = opts - opts = {} - } - var platform = opts.platform == null ? 'fallback' : opts.platform - var hasUnicode = !!opts.hasUnicode - var hasColor = !!opts.hasColor - if (!this.defaults[platform]) this.defaults[platform] = {true: {}, false: {}} - this.defaults[platform][hasUnicode][hasColor] = name -} - -ThemeSetProto.getDefault = function (opts) { - if (!opts) opts = {} - var platformName = opts.platform || process.platform - var platform = this.defaults[platformName] || this.defaults.fallback - var hasUnicode = !!opts.hasUnicode - var hasColor = !!opts.hasColor - if (!platform) throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor) - if (!platform[hasUnicode][hasColor]) { - if (hasUnicode && hasColor && platform[!hasUnicode][hasColor]) { - hasUnicode = false - } else if (hasUnicode && hasColor && platform[hasUnicode][!hasColor]) { - hasColor = false - } else if (hasUnicode && hasColor && platform[!hasUnicode][!hasColor]) { - hasUnicode = false - hasColor = false - } else if (hasUnicode && !hasColor && platform[!hasUnicode][hasColor]) { - hasUnicode = false - } else if (!hasUnicode && hasColor && platform[hasUnicode][!hasColor]) { - hasColor = false - } else if (platform === this.defaults.fallback) { - throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor) - } - } - if (platform[hasUnicode][hasColor]) { - return this.getTheme(platform[hasUnicode][hasColor]) - } else { - return this.getDefault(objectAssign({}, opts, {platform: 'fallback'})) - } -} - -ThemeSetProto.newMissingThemeError = function newMissingThemeError (name) { - var err = new Error('Could not find a gauge theme named "' + name + '"') - Error.captureStackTrace.call(err, newMissingThemeError) - err.theme = name - err.code = 'EMISSINGTHEME' - return err -} - -ThemeSetProto.newMissingDefaultThemeError = function newMissingDefaultThemeError (platformName, hasUnicode, hasColor) { - var err = new Error( - 'Could not find a gauge theme for your platform/unicode/color use combo:\n' + - ' platform = ' + platformName + '\n' + - ' hasUnicode = ' + hasUnicode + '\n' + - ' hasColor = ' + hasColor) - Error.captureStackTrace.call(err, newMissingDefaultThemeError) - err.platform = platformName - err.hasUnicode = hasUnicode - err.hasColor = hasColor - err.code = 'EMISSINGTHEME' - return err -} - -ThemeSetProto.newThemeSet = function () { - var themeset = function (opts) { - return themeset.getDefault(opts) - } - return objectAssign(themeset, ThemeSetProto, { - themes: objectAssign({}, this.themes), - baseTheme: objectAssign({}, this.baseTheme), - defaults: JSON.parse(JSON.stringify(this.defaults || {})) - }) -} - diff --git a/node_modules/gauge/themes.js b/node_modules/gauge/themes.js deleted file mode 100644 index eb5a4f5..0000000 --- a/node_modules/gauge/themes.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict' -var consoleControl = require('console-control-strings') -var ThemeSet = require('./theme-set.js') - -var themes = module.exports = new ThemeSet() - -themes.addTheme('ASCII', { - preProgressbar: '[', - postProgressbar: ']', - progressbarTheme: { - complete: '#', - remaining: '.' - }, - activityIndicatorTheme: '-\\|/', - preSubsection: '>' -}) - -themes.addTheme('colorASCII', themes.getTheme('ASCII'), { - progressbarTheme: { - preComplete: consoleControl.color('inverse'), - complete: ' ', - postComplete: consoleControl.color('stopInverse'), - preRemaining: consoleControl.color('brightBlack'), - remaining: '.', - postRemaining: consoleControl.color('reset') - } -}) - -themes.addTheme('brailleSpinner', { - preProgressbar: '⸨', - postProgressbar: '⸩', - progressbarTheme: { - complete: '░', - remaining: '⠂' - }, - activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏', - preSubsection: '>' -}) - -themes.addTheme('colorBrailleSpinner', themes.getTheme('brailleSpinner'), { - progressbarTheme: { - preComplete: consoleControl.color('inverse'), - complete: ' ', - postComplete: consoleControl.color('stopInverse'), - preRemaining: consoleControl.color('brightBlack'), - remaining: '░', - postRemaining: consoleControl.color('reset') - } -}) - -themes.setDefault({}, 'ASCII') -themes.setDefault({hasColor: true}, 'colorASCII') -themes.setDefault({platform: 'darwin', hasUnicode: true}, 'brailleSpinner') -themes.setDefault({platform: 'darwin', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner') diff --git a/node_modules/gauge/wide-truncate.js b/node_modules/gauge/wide-truncate.js deleted file mode 100644 index c531bc4..0000000 --- a/node_modules/gauge/wide-truncate.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict' -var stringWidth = require('string-width') -var stripAnsi = require('strip-ansi') - -module.exports = wideTruncate - -function wideTruncate (str, target) { - if (stringWidth(str) === 0) return str - if (target <= 0) return '' - if (stringWidth(str) <= target) return str - - // We compute the number of bytes of ansi sequences here and add - // that to our initial truncation to ensure that we don't slice one - // that we want to keep in half. - var noAnsi = stripAnsi(str) - var ansiSize = str.length + noAnsi.length - var truncated = str.slice(0, target + ansiSize) - - // we have to shrink the result to account for our ansi sequence buffer - // (if an ansi sequence was truncated) and double width characters. - while (stringWidth(truncated) > target) { - truncated = truncated.slice(0, -1) - } - return truncated -} diff --git a/node_modules/get-caller-file/LICENSE.md b/node_modules/get-caller-file/LICENSE.md deleted file mode 100644 index bf3e1c0..0000000 --- a/node_modules/get-caller-file/LICENSE.md +++ /dev/null @@ -1,6 +0,0 @@ -ISC License (ISC) -Copyright 2018 Stefan Penner - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/get-caller-file/README.md b/node_modules/get-caller-file/README.md deleted file mode 100644 index a7d8c07..0000000 --- a/node_modules/get-caller-file/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# get-caller-file - -[![Build Status](https://travis-ci.org/stefanpenner/get-caller-file.svg?branch=master)](https://travis-ci.org/stefanpenner/get-caller-file) -[![Build status](https://ci.appveyor.com/api/projects/status/ol2q94g1932cy14a/branch/master?svg=true)](https://ci.appveyor.com/project/embercli/get-caller-file/branch/master) - -This is a utility, which allows a function to figure out from which file it was invoked. It does so by inspecting v8's stack trace at the time it is invoked. - -Inspired by http://stackoverflow.com/questions/13227489 - -*note: this relies on Node/V8 specific APIs, as such other runtimes may not work* - -## Installation - -```bash -yarn add get-caller-file -``` - -## Usage - -Given: - -```js -// ./foo.js -const getCallerFile = require('get-caller-file'); - -module.exports = function() { - return getCallerFile(); // figures out who called it -}; -``` - -```js -// index.js -const foo = require('./foo'); - -foo() // => /full/path/to/this/file/index.js -``` - - -## Options: - -* `getCallerFile(position = 2)`: where position is stack frame whos fileName we want. diff --git a/node_modules/get-caller-file/index.d.ts b/node_modules/get-caller-file/index.d.ts deleted file mode 100644 index babed69..0000000 --- a/node_modules/get-caller-file/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: (position?: number) => any; -export = _default; diff --git a/node_modules/get-caller-file/index.js b/node_modules/get-caller-file/index.js deleted file mode 100644 index 57304f8..0000000 --- a/node_modules/get-caller-file/index.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -// Call this function in a another function to find out the file from -// which that function was called from. (Inspects the v8 stack trace) -// -// Inspired by http://stackoverflow.com/questions/13227489 -module.exports = function getCallerFile(position) { - if (position === void 0) { position = 2; } - if (position >= Error.stackTraceLimit) { - throw new TypeError('getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `' + position + '` and Error.stackTraceLimit was: `' + Error.stackTraceLimit + '`'); - } - var oldPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = function (_, stack) { return stack; }; - var stack = new Error().stack; - Error.prepareStackTrace = oldPrepareStackTrace; - if (stack !== null && typeof stack === 'object') { - // stack[0] holds this file - // stack[1] holds where this function was called - // stack[2] holds the file we're interested in - return stack[position] ? stack[position].getFileName() : undefined; - } -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/get-caller-file/index.js.map b/node_modules/get-caller-file/index.js.map deleted file mode 100644 index 89c655c..0000000 --- a/node_modules/get-caller-file/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,qEAAqE;AACrE,EAAE;AACF,0DAA0D;AAE1D,iBAAS,SAAS,aAAa,CAAC,QAAY;IAAZ,yBAAA,EAAA,YAAY;IAC1C,IAAI,QAAQ,IAAI,KAAK,CAAC,eAAe,EAAE;QACrC,MAAM,IAAI,SAAS,CAAC,kGAAkG,GAAG,QAAQ,GAAG,oCAAoC,GAAG,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,CAAC;KACzM;IAED,IAAM,oBAAoB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD,KAAK,CAAC,iBAAiB,GAAG,UAAC,CAAC,EAAE,KAAK,IAAM,OAAA,KAAK,EAAL,CAAK,CAAC;IAC/C,IAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAChC,KAAK,CAAC,iBAAiB,GAAG,oBAAoB,CAAC;IAG/C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC/C,2BAA2B;QAC3B,gDAAgD;QAChD,8CAA8C;QAC9C,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAE,KAAK,CAAC,QAAQ,CAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;KAC7E;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/get-caller-file/package.json b/node_modules/get-caller-file/package.json deleted file mode 100644 index 9b7ffd3..0000000 --- a/node_modules/get-caller-file/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_from": "get-caller-file@^2.0.1", - "_id": "get-caller-file@2.0.5", - "_inBundle": false, - "_integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "_location": "/get-caller-file", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "get-caller-file@^2.0.1", - "name": "get-caller-file", - "escapedName": "get-caller-file", - "rawSpec": "^2.0.1", - "saveSpec": null, - "fetchSpec": "^2.0.1" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "_shasum": "4f94412a82db32f36e3b0b9741f8a97feb031f7e", - "_spec": "get-caller-file@^2.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "Stefan Penner" - }, - "bugs": { - "url": "https://github.com/stefanpenner/get-caller-file/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "[![Build Status](https://travis-ci.org/stefanpenner/get-caller-file.svg?branch=master)](https://travis-ci.org/stefanpenner/get-caller-file) [![Build status](https://ci.appveyor.com/api/projects/status/ol2q94g1932cy14a/branch/master?svg=true)](https://ci.appveyor.com/project/embercli/get-caller-file/branch/master)", - "devDependencies": { - "@types/chai": "^4.1.7", - "@types/ensure-posix-path": "^1.0.0", - "@types/mocha": "^5.2.6", - "@types/node": "^11.10.5", - "chai": "^4.1.2", - "ensure-posix-path": "^1.0.1", - "mocha": "^5.2.0", - "typescript": "^3.3.3333" - }, - "directories": { - "test": "tests" - }, - "engines": { - "node": "6.* || 8.* || >= 10.*" - }, - "files": [ - "index.js", - "index.js.map", - "index.d.ts" - ], - "homepage": "https://github.com/stefanpenner/get-caller-file#readme", - "license": "ISC", - "main": "index.js", - "name": "get-caller-file", - "repository": { - "type": "git", - "url": "git+https://github.com/stefanpenner/get-caller-file.git" - }, - "scripts": { - "prepare": "tsc", - "test": "mocha test", - "test:debug": "mocha test" - }, - "version": "2.0.5" -} diff --git a/node_modules/glob/LICENSE b/node_modules/glob/LICENSE deleted file mode 100644 index 42ca266..0000000 --- a/node_modules/glob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -## Glob Logo - -Glob's logo created by Tanya Brassie , licensed -under a Creative Commons Attribution-ShareAlike 4.0 International License -https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/node_modules/glob/README.md b/node_modules/glob/README.md deleted file mode 100644 index 0916a48..0000000 --- a/node_modules/glob/README.md +++ /dev/null @@ -1,375 +0,0 @@ -# Glob - -Match files using the patterns the shell uses, like stars and stuff. - -[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) - -This is a glob implementation in JavaScript. It uses the `minimatch` -library to do its matching. - -![](logo/glob.png) - -## Usage - -Install with npm - -``` -npm i glob -``` - -```javascript -var glob = require("glob") - -// options is optional -glob("**/*.js", options, function (er, files) { - // files is an array of filenames. - // If the `nonull` option is set, and nothing - // was found, then files is ["**/*.js"] - // er is an error object or null. -}) -``` - -## Glob Primer - -"Globs" are the patterns you type when you do stuff like `ls *.js` on -the command line, or put `build/*` in a `.gitignore` file. - -Before parsing the path part patterns, braced sections are expanded -into a set. Braced sections start with `{` and end with `}`, with any -number of comma-delimited sections within. Braced sections may contain -slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. - -The following characters have special magic meaning when used in a -path portion: - -* `*` Matches 0 or more characters in a single path portion -* `?` Matches 1 character -* `[...]` Matches a range of characters, similar to a RegExp range. - If the first character of the range is `!` or `^` then it matches - any character not in the range. -* `!(pattern|pattern|pattern)` Matches anything that does not match - any of the patterns provided. -* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the - patterns provided. -* `+(pattern|pattern|pattern)` Matches one or more occurrences of the - patterns provided. -* `*(a|b|c)` Matches zero or more occurrences of the patterns provided -* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns - provided -* `**` If a "globstar" is alone in a path portion, then it matches - zero or more directories and subdirectories searching for matches. - It does not crawl symlinked directories. - -### Dots - -If a file or directory path portion has a `.` as the first character, -then it will not match any glob pattern unless that pattern's -corresponding path part also has a `.` as its first character. - -For example, the pattern `a/.*/c` would match the file at `a/.b/c`. -However the pattern `a/*/c` would not, because `*` does not start with -a dot character. - -You can make glob treat dots as normal characters by setting -`dot:true` in the options. - -### Basename Matching - -If you set `matchBase:true` in the options, and the pattern has no -slashes in it, then it will seek for any file anywhere in the tree -with a matching basename. For example, `*.js` would match -`test/simple/basic.js`. - -### Empty Sets - -If no matching files are found, then an empty array is returned. This -differs from the shell, where the pattern itself is returned. For -example: - - $ echo a*s*d*f - a*s*d*f - -To get the bash-style behavior, set the `nonull:true` in the options. - -### See Also: - -* `man sh` -* `man bash` (Search for "Pattern Matching") -* `man 3 fnmatch` -* `man 5 gitignore` -* [minimatch documentation](https://github.com/isaacs/minimatch) - -## glob.hasMagic(pattern, [options]) - -Returns `true` if there are any special characters in the pattern, and -`false` otherwise. - -Note that the options affect the results. If `noext:true` is set in -the options object, then `+(a|b)` will not be considered a magic -pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` -then that is considered magical, unless `nobrace:true` is set in the -options. - -## glob(pattern, [options], cb) - -* `pattern` `{String}` Pattern to be matched -* `options` `{Object}` -* `cb` `{Function}` - * `err` `{Error | null}` - * `matches` `{Array}` filenames found matching the pattern - -Perform an asynchronous glob search. - -## glob.sync(pattern, [options]) - -* `pattern` `{String}` Pattern to be matched -* `options` `{Object}` -* return: `{Array}` filenames found matching the pattern - -Perform a synchronous glob search. - -## Class: glob.Glob - -Create a Glob object by instantiating the `glob.Glob` class. - -```javascript -var Glob = require("glob").Glob -var mg = new Glob(pattern, options, cb) -``` - -It's an EventEmitter, and starts walking the filesystem to find matches -immediately. - -### new glob.Glob(pattern, [options], [cb]) - -* `pattern` `{String}` pattern to search for -* `options` `{Object}` -* `cb` `{Function}` Called when an error occurs, or matches are found - * `err` `{Error | null}` - * `matches` `{Array}` filenames found matching the pattern - -Note that if the `sync` flag is set in the options, then matches will -be immediately available on the `g.found` member. - -### Properties - -* `minimatch` The minimatch object that the glob uses. -* `options` The options object passed in. -* `aborted` Boolean which is set to true when calling `abort()`. There - is no way at this time to continue a glob search after aborting, but - you can re-use the statCache to avoid having to duplicate syscalls. -* `cache` Convenience object. Each field has the following possible - values: - * `false` - Path does not exist - * `true` - Path exists - * `'FILE'` - Path exists, and is not a directory - * `'DIR'` - Path exists, and is a directory - * `[file, entries, ...]` - Path exists, is a directory, and the - array value is the results of `fs.readdir` -* `statCache` Cache of `fs.stat` results, to prevent statting the same - path multiple times. -* `symlinks` A record of which paths are symbolic links, which is - relevant in resolving `**` patterns. -* `realpathCache` An optional object which is passed to `fs.realpath` - to minimize unnecessary syscalls. It is stored on the instantiated - Glob object, and may be re-used. - -### Events - -* `end` When the matching is finished, this is emitted with all the - matches found. If the `nonull` option is set, and no match was found, - then the `matches` list contains the original pattern. The matches - are sorted, unless the `nosort` flag is set. -* `match` Every time a match is found, this is emitted with the specific - thing that matched. It is not deduplicated or resolved to a realpath. -* `error` Emitted when an unexpected error is encountered, or whenever - any fs error occurs if `options.strict` is set. -* `abort` When `abort()` is called, this event is raised. - -### Methods - -* `pause` Temporarily stop the search -* `resume` Resume the search -* `abort` Stop the search forever - -### Options - -All the options that can be passed to Minimatch can also be passed to -Glob to change pattern matching behavior. Also, some have been added, -or have glob-specific ramifications. - -All options are false by default, unless otherwise noted. - -All options are added to the Glob object, as well. - -If you are running many `glob` operations, you can pass a Glob object -as the `options` argument to a subsequent operation to shortcut some -`stat` and `readdir` calls. At the very least, you may pass in shared -`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that -parallel glob operations will be sped up by sharing information about -the filesystem. - -* `cwd` The current working directory in which to search. Defaults - to `process.cwd()`. -* `root` The place where patterns starting with `/` will be mounted - onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix - systems, and `C:\` or some such on Windows.) -* `dot` Include `.dot` files in normal matches and `globstar` matches. - Note that an explicit dot in a portion of the pattern will always - match dot files. -* `nomount` By default, a pattern starting with a forward-slash will be - "mounted" onto the root setting, so that a valid filesystem path is - returned. Set this flag to disable that behavior. -* `mark` Add a `/` character to directory matches. Note that this - requires additional stat calls. -* `nosort` Don't sort the results. -* `stat` Set to true to stat *all* results. This reduces performance - somewhat, and is completely unnecessary, unless `readdir` is presumed - to be an untrustworthy indicator of file existence. -* `silent` When an unusual error is encountered when attempting to - read a directory, a warning will be printed to stderr. Set the - `silent` option to true to suppress these warnings. -* `strict` When an unusual error is encountered when attempting to - read a directory, the process will just continue on in search of - other matches. Set the `strict` option to raise an error in these - cases. -* `cache` See `cache` property above. Pass in a previously generated - cache object to save some fs calls. -* `statCache` A cache of results of filesystem information, to prevent - unnecessary stat calls. While it should not normally be necessary - to set this, you may pass the statCache from one glob() call to the - options object of another, if you know that the filesystem will not - change between calls. (See "Race Conditions" below.) -* `symlinks` A cache of known symbolic links. You may pass in a - previously generated `symlinks` object to save `lstat` calls when - resolving `**` matches. -* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. -* `nounique` In some cases, brace-expanded patterns can result in the - same file showing up multiple times in the result set. By default, - this implementation prevents duplicates in the result set. Set this - flag to disable that behavior. -* `nonull` Set to never return an empty set, instead returning a set - containing the pattern itself. This is the default in glob(3). -* `debug` Set to enable debug logging in minimatch and glob. -* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. -* `noglobstar` Do not match `**` against multiple filenames. (Ie, - treat it as a normal `*` instead.) -* `noext` Do not match `+(a|b)` "extglob" patterns. -* `nocase` Perform a case-insensitive match. Note: on - case-insensitive filesystems, non-magic patterns will match by - default, since `stat` and `readdir` will not raise errors. -* `matchBase` Perform a basename-only match if the pattern does not - contain any slash characters. That is, `*.js` would be treated as - equivalent to `**/*.js`, matching all js files in all directories. -* `nodir` Do not match directories, only files. (Note: to match - *only* directories, simply put a `/` at the end of the pattern.) -* `ignore` Add a pattern or an array of glob patterns to exclude matches. - Note: `ignore` patterns are *always* in `dot:true` mode, regardless - of any other settings. -* `follow` Follow symlinked directories when expanding `**` patterns. - Note that this can result in a lot of duplicate references in the - presence of cyclic links. -* `realpath` Set to true to call `fs.realpath` on all of the results. - In the case of a symlink that cannot be resolved, the full absolute - path to the matched entry is returned (though it will usually be a - broken symlink) -* `absolute` Set to true to always receive absolute paths for matched - files. Unlike `realpath`, this also affects the values returned in - the `match` event. - -## Comparisons to other fnmatch/glob implementations - -While strict compliance with the existing standards is a worthwhile -goal, some discrepancies exist between node-glob and other -implementations, and are intentional. - -The double-star character `**` is supported by default, unless the -`noglobstar` flag is set. This is supported in the manner of bsdglob -and bash 4.3, where `**` only has special significance if it is the only -thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but -`a/**b` will not. - -Note that symlinked directories are not crawled as part of a `**`, -though their contents may match against subsequent portions of the -pattern. This prevents infinite loops and duplicates and the like. - -If an escaped pattern has no matches, and the `nonull` flag is set, -then glob returns the pattern as-provided, rather than -interpreting the character escapes. For example, -`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than -`"*a?"`. This is akin to setting the `nullglob` option in bash, except -that it does not resolve escaped pattern characters. - -If brace expansion is not disabled, then it is performed before any -other interpretation of the glob pattern. Thus, a pattern like -`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded -**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are -checked for validity. Since those two are valid, matching proceeds. - -### Comments and Negation - -Previously, this module let you mark a pattern as a "comment" if it -started with a `#` character, or a "negated" pattern if it started -with a `!` character. - -These options were deprecated in version 5, and removed in version 6. - -To specify things that should not match, use the `ignore` option. - -## Windows - -**Please only use forward-slashes in glob expressions.** - -Though windows uses either `/` or `\` as its path separator, only `/` -characters are used by this glob implementation. You must use -forward-slashes **only** in glob expressions. Back-slashes will always -be interpreted as escape characters, not path separators. - -Results from absolute patterns such as `/foo/*` are mounted onto the -root setting using `path.join`. On windows, this will by default result -in `/foo/*` matching `C:\foo\bar.txt`. - -## Race Conditions - -Glob searching, by its very nature, is susceptible to race conditions, -since it relies on directory walking and such. - -As a result, it is possible that a file that exists when glob looks for -it may have been deleted or modified by the time it returns the result. - -As part of its internal implementation, this program caches all stat -and readdir calls that it makes, in order to cut down on system -overhead. However, this also makes it even more susceptible to races, -especially if the cache or statCache objects are reused between glob -calls. - -Users are thus advised not to use a glob result as a guarantee of -filesystem state in the face of rapid changes. For the vast majority -of operations, this is never a problem. - -## Glob Logo -Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo). - -The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). - -## Contributing - -Any change to behavior (including bugfixes) must come with a test. - -Patches that fail tests or reduce performance will be rejected. - -``` -# to run tests -npm test - -# to re-generate test fixtures -npm run test-regen - -# to benchmark against bash/zsh -npm run bench - -# to profile javascript -npm run prof -``` - -![](oh-my-glob.gif) diff --git a/node_modules/glob/changelog.md b/node_modules/glob/changelog.md deleted file mode 100644 index 4163677..0000000 --- a/node_modules/glob/changelog.md +++ /dev/null @@ -1,67 +0,0 @@ -## 7.0 - -- Raise error if `options.cwd` is specified, and not a directory - -## 6.0 - -- Remove comment and negation pattern support -- Ignore patterns are always in `dot:true` mode - -## 5.0 - -- Deprecate comment and negation patterns -- Fix regression in `mark` and `nodir` options from making all cache - keys absolute path. -- Abort if `fs.readdir` returns an error that's unexpected -- Don't emit `match` events for ignored items -- Treat ENOTSUP like ENOTDIR in readdir - -## 4.5 - -- Add `options.follow` to always follow directory symlinks in globstar -- Add `options.realpath` to call `fs.realpath` on all results -- Always cache based on absolute path - -## 4.4 - -- Add `options.ignore` -- Fix handling of broken symlinks - -## 4.3 - -- Bump minimatch to 2.x -- Pass all tests on Windows - -## 4.2 - -- Add `glob.hasMagic` function -- Add `options.nodir` flag - -## 4.1 - -- Refactor sync and async implementations for performance -- Throw if callback provided to sync glob function -- Treat symbolic links in globstar results the same as Bash 4.3 - -## 4.0 - -- Use `^` for dependency versions (bumped major because this breaks - older npm versions) -- Ensure callbacks are only ever called once -- switch to ISC license - -## 3.x - -- Rewrite in JavaScript -- Add support for setting root, cwd, and windows support -- Cache many fs calls -- Add globstar support -- emit match events - -## 2.x - -- Use `glob.h` and `fnmatch.h` from NetBSD - -## 1.x - -- `glob.h` static binding. diff --git a/node_modules/glob/common.js b/node_modules/glob/common.js deleted file mode 100644 index 66651bb..0000000 --- a/node_modules/glob/common.js +++ /dev/null @@ -1,240 +0,0 @@ -exports.alphasort = alphasort -exports.alphasorti = alphasorti -exports.setopts = setopts -exports.ownProp = ownProp -exports.makeAbs = makeAbs -exports.finish = finish -exports.mark = mark -exports.isIgnored = isIgnored -exports.childrenIgnored = childrenIgnored - -function ownProp (obj, field) { - return Object.prototype.hasOwnProperty.call(obj, field) -} - -var path = require("path") -var minimatch = require("minimatch") -var isAbsolute = require("path-is-absolute") -var Minimatch = minimatch.Minimatch - -function alphasorti (a, b) { - return a.toLowerCase().localeCompare(b.toLowerCase()) -} - -function alphasort (a, b) { - return a.localeCompare(b) -} - -function setupIgnores (self, options) { - self.ignore = options.ignore || [] - - if (!Array.isArray(self.ignore)) - self.ignore = [self.ignore] - - if (self.ignore.length) { - self.ignore = self.ignore.map(ignoreMap) - } -} - -// ignore patterns are always in dot:true mode. -function ignoreMap (pattern) { - var gmatcher = null - if (pattern.slice(-3) === '/**') { - var gpattern = pattern.replace(/(\/\*\*)+$/, '') - gmatcher = new Minimatch(gpattern, { dot: true }) - } - - return { - matcher: new Minimatch(pattern, { dot: true }), - gmatcher: gmatcher - } -} - -function setopts (self, pattern, options) { - if (!options) - options = {} - - // base-matching: just use globstar for that. - if (options.matchBase && -1 === pattern.indexOf("/")) { - if (options.noglobstar) { - throw new Error("base matching requires globstar") - } - pattern = "**/" + pattern - } - - self.silent = !!options.silent - self.pattern = pattern - self.strict = options.strict !== false - self.realpath = !!options.realpath - self.realpathCache = options.realpathCache || Object.create(null) - self.follow = !!options.follow - self.dot = !!options.dot - self.mark = !!options.mark - self.nodir = !!options.nodir - if (self.nodir) - self.mark = true - self.sync = !!options.sync - self.nounique = !!options.nounique - self.nonull = !!options.nonull - self.nosort = !!options.nosort - self.nocase = !!options.nocase - self.stat = !!options.stat - self.noprocess = !!options.noprocess - self.absolute = !!options.absolute - - self.maxLength = options.maxLength || Infinity - self.cache = options.cache || Object.create(null) - self.statCache = options.statCache || Object.create(null) - self.symlinks = options.symlinks || Object.create(null) - - setupIgnores(self, options) - - self.changedCwd = false - var cwd = process.cwd() - if (!ownProp(options, "cwd")) - self.cwd = cwd - else { - self.cwd = path.resolve(options.cwd) - self.changedCwd = self.cwd !== cwd - } - - self.root = options.root || path.resolve(self.cwd, "/") - self.root = path.resolve(self.root) - if (process.platform === "win32") - self.root = self.root.replace(/\\/g, "/") - - // TODO: is an absolute `cwd` supposed to be resolved against `root`? - // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') - self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) - if (process.platform === "win32") - self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") - self.nomount = !!options.nomount - - // disable comments and negation in Minimatch. - // Note that they are not supported in Glob itself anyway. - options.nonegate = true - options.nocomment = true - - self.minimatch = new Minimatch(pattern, options) - self.options = self.minimatch.options -} - -function finish (self) { - var nou = self.nounique - var all = nou ? [] : Object.create(null) - - for (var i = 0, l = self.matches.length; i < l; i ++) { - var matches = self.matches[i] - if (!matches || Object.keys(matches).length === 0) { - if (self.nonull) { - // do like the shell, and spit out the literal glob - var literal = self.minimatch.globSet[i] - if (nou) - all.push(literal) - else - all[literal] = true - } - } else { - // had matches - var m = Object.keys(matches) - if (nou) - all.push.apply(all, m) - else - m.forEach(function (m) { - all[m] = true - }) - } - } - - if (!nou) - all = Object.keys(all) - - if (!self.nosort) - all = all.sort(self.nocase ? alphasorti : alphasort) - - // at *some* point we statted all of these - if (self.mark) { - for (var i = 0; i < all.length; i++) { - all[i] = self._mark(all[i]) - } - if (self.nodir) { - all = all.filter(function (e) { - var notDir = !(/\/$/.test(e)) - var c = self.cache[e] || self.cache[makeAbs(self, e)] - if (notDir && c) - notDir = c !== 'DIR' && !Array.isArray(c) - return notDir - }) - } - } - - if (self.ignore.length) - all = all.filter(function(m) { - return !isIgnored(self, m) - }) - - self.found = all -} - -function mark (self, p) { - var abs = makeAbs(self, p) - var c = self.cache[abs] - var m = p - if (c) { - var isDir = c === 'DIR' || Array.isArray(c) - var slash = p.slice(-1) === '/' - - if (isDir && !slash) - m += '/' - else if (!isDir && slash) - m = m.slice(0, -1) - - if (m !== p) { - var mabs = makeAbs(self, m) - self.statCache[mabs] = self.statCache[abs] - self.cache[mabs] = self.cache[abs] - } - } - - return m -} - -// lotta situps... -function makeAbs (self, f) { - var abs = f - if (f.charAt(0) === '/') { - abs = path.join(self.root, f) - } else if (isAbsolute(f) || f === '') { - abs = f - } else if (self.changedCwd) { - abs = path.resolve(self.cwd, f) - } else { - abs = path.resolve(f) - } - - if (process.platform === 'win32') - abs = abs.replace(/\\/g, '/') - - return abs -} - - -// Return true, if pattern ends with globstar '**', for the accompanying parent directory. -// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents -function isIgnored (self, path) { - if (!self.ignore.length) - return false - - return self.ignore.some(function(item) { - return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) - }) -} - -function childrenIgnored (self, path) { - if (!self.ignore.length) - return false - - return self.ignore.some(function(item) { - return !!(item.gmatcher && item.gmatcher.match(path)) - }) -} diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js deleted file mode 100644 index 58dec0f..0000000 --- a/node_modules/glob/glob.js +++ /dev/null @@ -1,790 +0,0 @@ -// Approach: -// -// 1. Get the minimatch set -// 2. For each pattern in the set, PROCESS(pattern, false) -// 3. Store matches per-set, then uniq them -// -// PROCESS(pattern, inGlobStar) -// Get the first [n] items from pattern that are all strings -// Join these together. This is PREFIX. -// If there is no more remaining, then stat(PREFIX) and -// add to matches if it succeeds. END. -// -// If inGlobStar and PREFIX is symlink and points to dir -// set ENTRIES = [] -// else readdir(PREFIX) as ENTRIES -// If fail, END -// -// with ENTRIES -// If pattern[n] is GLOBSTAR -// // handle the case where the globstar match is empty -// // by pruning it out, and testing the resulting pattern -// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) -// // handle other cases. -// for ENTRY in ENTRIES (not dotfiles) -// // attach globstar + tail onto the entry -// // Mark that this entry is a globstar match -// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) -// -// else // not globstar -// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) -// Test ENTRY against pattern[n] -// If fails, continue -// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) -// -// Caveat: -// Cache all stats and readdirs results to minimize syscall. Since all -// we ever care about is existence and directory-ness, we can just keep -// `true` for files, and [children,...] for directories, or `false` for -// things that don't exist. - -module.exports = glob - -var fs = require('fs') -var rp = require('fs.realpath') -var minimatch = require('minimatch') -var Minimatch = minimatch.Minimatch -var inherits = require('inherits') -var EE = require('events').EventEmitter -var path = require('path') -var assert = require('assert') -var isAbsolute = require('path-is-absolute') -var globSync = require('./sync.js') -var common = require('./common.js') -var alphasort = common.alphasort -var alphasorti = common.alphasorti -var setopts = common.setopts -var ownProp = common.ownProp -var inflight = require('inflight') -var util = require('util') -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored - -var once = require('once') - -function glob (pattern, options, cb) { - if (typeof options === 'function') cb = options, options = {} - if (!options) options = {} - - if (options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return globSync(pattern, options) - } - - return new Glob(pattern, options, cb) -} - -glob.sync = globSync -var GlobSync = glob.GlobSync = globSync.GlobSync - -// old api surface -glob.glob = glob - -function extend (origin, add) { - if (add === null || typeof add !== 'object') { - return origin - } - - var keys = Object.keys(add) - var i = keys.length - while (i--) { - origin[keys[i]] = add[keys[i]] - } - return origin -} - -glob.hasMagic = function (pattern, options_) { - var options = extend({}, options_) - options.noprocess = true - - var g = new Glob(pattern, options) - var set = g.minimatch.set - - if (!pattern) - return false - - if (set.length > 1) - return true - - for (var j = 0; j < set[0].length; j++) { - if (typeof set[0][j] !== 'string') - return true - } - - return false -} - -glob.Glob = Glob -inherits(Glob, EE) -function Glob (pattern, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - - if (options && options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return new GlobSync(pattern, options) - } - - if (!(this instanceof Glob)) - return new Glob(pattern, options, cb) - - setopts(this, pattern, options) - this._didRealPath = false - - // process each pattern in the minimatch set - var n = this.minimatch.set.length - - // The matches are stored as {: true,...} so that - // duplicates are automagically pruned. - // Later, we do an Object.keys() on these. - // Keep them as a list so we can fill in when nonull is set. - this.matches = new Array(n) - - if (typeof cb === 'function') { - cb = once(cb) - this.on('error', cb) - this.on('end', function (matches) { - cb(null, matches) - }) - } - - var self = this - this._processing = 0 - - this._emitQueue = [] - this._processQueue = [] - this.paused = false - - if (this.noprocess) - return this - - if (n === 0) - return done() - - var sync = true - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false, done) - } - sync = false - - function done () { - --self._processing - if (self._processing <= 0) { - if (sync) { - process.nextTick(function () { - self._finish() - }) - } else { - self._finish() - } - } - } -} - -Glob.prototype._finish = function () { - assert(this instanceof Glob) - if (this.aborted) - return - - if (this.realpath && !this._didRealpath) - return this._realpath() - - common.finish(this) - this.emit('end', this.found) -} - -Glob.prototype._realpath = function () { - if (this._didRealpath) - return - - this._didRealpath = true - - var n = this.matches.length - if (n === 0) - return this._finish() - - var self = this - for (var i = 0; i < this.matches.length; i++) - this._realpathSet(i, next) - - function next () { - if (--n === 0) - self._finish() - } -} - -Glob.prototype._realpathSet = function (index, cb) { - var matchset = this.matches[index] - if (!matchset) - return cb() - - var found = Object.keys(matchset) - var self = this - var n = found.length - - if (n === 0) - return cb() - - var set = this.matches[index] = Object.create(null) - found.forEach(function (p, i) { - // If there's a problem with the stat, then it means that - // one or more of the links in the realpath couldn't be - // resolved. just return the abs value in that case. - p = self._makeAbs(p) - rp.realpath(p, self.realpathCache, function (er, real) { - if (!er) - set[real] = true - else if (er.syscall === 'stat') - set[p] = true - else - self.emit('error', er) // srsly wtf right here - - if (--n === 0) { - self.matches[index] = set - cb() - } - }) - }) -} - -Glob.prototype._mark = function (p) { - return common.mark(this, p) -} - -Glob.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} - -Glob.prototype.abort = function () { - this.aborted = true - this.emit('abort') -} - -Glob.prototype.pause = function () { - if (!this.paused) { - this.paused = true - this.emit('pause') - } -} - -Glob.prototype.resume = function () { - if (this.paused) { - this.emit('resume') - this.paused = false - if (this._emitQueue.length) { - var eq = this._emitQueue.slice(0) - this._emitQueue.length = 0 - for (var i = 0; i < eq.length; i ++) { - var e = eq[i] - this._emitMatch(e[0], e[1]) - } - } - if (this._processQueue.length) { - var pq = this._processQueue.slice(0) - this._processQueue.length = 0 - for (var i = 0; i < pq.length; i ++) { - var p = pq[i] - this._processing-- - this._process(p[0], p[1], p[2], p[3]) - } - } - } -} - -Glob.prototype._process = function (pattern, index, inGlobStar, cb) { - assert(this instanceof Glob) - assert(typeof cb === 'function') - - if (this.aborted) - return - - this._processing++ - if (this.paused) { - this._processQueue.push([pattern, index, inGlobStar, cb]) - return - } - - //console.error('PROCESS %d', this._processing, pattern) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. - - // see if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index, cb) - return - - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break - - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } - - var remain = pattern.slice(n) - - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix - - var abs = this._makeAbs(read) - - //if ignored, skip _processing - if (childrenIgnored(this, read)) - return cb() - - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) -} - -Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} - -Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - - // if the abs isn't a dir, then nothing can match! - if (!entries) - return cb() - - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' - - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) - } - } - - //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return cb() - - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. - - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) - } - // This was the last one, and no stats were needed - return cb() - } - - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - this._process([e].concat(remain), index, inGlobStar, cb) - } - cb() -} - -Glob.prototype._emitMatch = function (index, e) { - if (this.aborted) - return - - if (isIgnored(this, e)) - return - - if (this.paused) { - this._emitQueue.push([index, e]) - return - } - - var abs = isAbsolute(e) ? e : this._makeAbs(e) - - if (this.mark) - e = this._mark(e) - - if (this.absolute) - e = abs - - if (this.matches[index][e]) - return - - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return - } - - this.matches[index][e] = true - - var st = this.statCache[abs] - if (st) - this.emit('stat', e, st) - - this.emit('match', e) -} - -Glob.prototype._readdirInGlobStar = function (abs, cb) { - if (this.aborted) - return - - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false, cb) - - var lstatkey = 'lstat\0' + abs - var self = this - var lstatcb = inflight(lstatkey, lstatcb_) - - if (lstatcb) - fs.lstat(abs, lstatcb) - - function lstatcb_ (er, lstat) { - if (er && er.code === 'ENOENT') - return cb() - - var isSym = lstat && lstat.isSymbolicLink() - self.symlinks[abs] = isSym - - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) { - self.cache[abs] = 'FILE' - cb() - } else - self._readdir(abs, false, cb) - } -} - -Glob.prototype._readdir = function (abs, inGlobStar, cb) { - if (this.aborted) - return - - cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) - if (!cb) - return - - //console.error('RD %j %j', +inGlobStar, abs) - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs, cb) - - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return cb() - - if (Array.isArray(c)) - return cb(null, c) - } - - var self = this - fs.readdir(abs, readdirCb(this, abs, cb)) -} - -function readdirCb (self, abs, cb) { - return function (er, entries) { - if (er) - self._readdirError(abs, er, cb) - else - self._readdirEntries(abs, entries, cb) - } -} - -Glob.prototype._readdirEntries = function (abs, entries, cb) { - if (this.aborted) - return - - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } - } - - this.cache[abs] = entries - return cb(null, entries) -} - -Glob.prototype._readdirError = function (f, er, cb) { - if (this.aborted) - return - - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - this.emit('error', error) - this.abort() - } - break - - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break - - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) { - this.emit('error', er) - // If the error is handled, then we abort - // if not, we threw out of here - this.abort() - } - if (!this.silent) - console.error('glob error', er) - break - } - - return cb() -} - -Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} - - -Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - //console.error('pgs2', prefix, remain[0], entries) - - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return cb() - - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) - - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false, cb) - - var isSym = this.symlinks[abs] - var len = entries.length - - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return cb() - - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue - - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true, cb) - - var below = gspref.concat(entries[i], remain) - this._process(below, index, true, cb) - } - - cb() -} - -Glob.prototype._processSimple = function (prefix, index, cb) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var self = this - this._stat(prefix, function (er, exists) { - self._processSimple2(prefix, index, er, exists, cb) - }) -} -Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { - - //console.error('ps2', prefix, exists) - - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - // If it doesn't exist, then just mark the lack of results - if (!exists) - return cb() - - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } - } - - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') - - // Mark this as a match - this._emitMatch(index, prefix) - cb() -} - -// Returns either 'DIR', 'FILE', or false -Glob.prototype._stat = function (f, cb) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' - - if (f.length > this.maxLength) - return cb() - - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] - - if (Array.isArray(c)) - c = 'DIR' - - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return cb(null, c) - - if (needDir && c === 'FILE') - return cb() - - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } - - var exists - var stat = this.statCache[abs] - if (stat !== undefined) { - if (stat === false) - return cb(null, stat) - else { - var type = stat.isDirectory() ? 'DIR' : 'FILE' - if (needDir && type === 'FILE') - return cb() - else - return cb(null, type, stat) - } - } - - var self = this - var statcb = inflight('stat\0' + abs, lstatcb_) - if (statcb) - fs.lstat(abs, statcb) - - function lstatcb_ (er, lstat) { - if (lstat && lstat.isSymbolicLink()) { - // If it's a symlink, then treat it as the target, unless - // the target does not exist, then treat it as a file. - return fs.stat(abs, function (er, stat) { - if (er) - self._stat2(f, abs, null, lstat, cb) - else - self._stat2(f, abs, er, stat, cb) - }) - } else { - self._stat2(f, abs, er, lstat, cb) - } - } -} - -Glob.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return cb() - } - - var needDir = f.slice(-1) === '/' - this.statCache[abs] = stat - - if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) - return cb(null, false, stat) - - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - this.cache[abs] = this.cache[abs] || c - - if (needDir && c === 'FILE') - return cb() - - return cb(null, c, stat) -} diff --git a/node_modules/glob/package.json b/node_modules/glob/package.json deleted file mode 100644 index 41252d0..0000000 --- a/node_modules/glob/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "_from": "glob@^7.1.3", - "_id": "glob@7.1.6", - "_inBundle": false, - "_integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "_location": "/glob", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "glob@^7.1.3", - "name": "glob", - "escapedName": "glob", - "rawSpec": "^7.1.3", - "saveSpec": null, - "fetchSpec": "^7.1.3" - }, - "_requiredBy": [ - "/rimraf" - ], - "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "_shasum": "141f33b81a7c2492e125594307480c46679278a6", - "_spec": "glob@^7.1.3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/rimraf", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/node-glob/issues" - }, - "bundleDependencies": false, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "deprecated": false, - "description": "a little globber", - "devDependencies": { - "mkdirp": "0", - "rimraf": "^2.2.8", - "tap": "^12.0.1", - "tick": "0.0.6" - }, - "engines": { - "node": "*" - }, - "files": [ - "glob.js", - "sync.js", - "common.js" - ], - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "homepage": "https://github.com/isaacs/node-glob#readme", - "license": "ISC", - "main": "glob.js", - "name": "glob", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/node-glob.git" - }, - "scripts": { - "bench": "bash benchmark.sh", - "benchclean": "node benchclean.js", - "prepublish": "npm run benchclean", - "prof": "bash prof.sh && cat profile.txt", - "profclean": "rm -f v8.log profile.txt", - "test": "tap test/*.js --cov", - "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" - }, - "version": "7.1.6" -} diff --git a/node_modules/glob/sync.js b/node_modules/glob/sync.js deleted file mode 100644 index c952134..0000000 --- a/node_modules/glob/sync.js +++ /dev/null @@ -1,486 +0,0 @@ -module.exports = globSync -globSync.GlobSync = GlobSync - -var fs = require('fs') -var rp = require('fs.realpath') -var minimatch = require('minimatch') -var Minimatch = minimatch.Minimatch -var Glob = require('./glob.js').Glob -var util = require('util') -var path = require('path') -var assert = require('assert') -var isAbsolute = require('path-is-absolute') -var common = require('./common.js') -var alphasort = common.alphasort -var alphasorti = common.alphasorti -var setopts = common.setopts -var ownProp = common.ownProp -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored - -function globSync (pattern, options) { - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') - - return new GlobSync(pattern, options).found -} - -function GlobSync (pattern, options) { - if (!pattern) - throw new Error('must provide pattern') - - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') - - if (!(this instanceof GlobSync)) - return new GlobSync(pattern, options) - - setopts(this, pattern, options) - - if (this.noprocess) - return this - - var n = this.minimatch.set.length - this.matches = new Array(n) - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false) - } - this._finish() -} - -GlobSync.prototype._finish = function () { - assert(this instanceof GlobSync) - if (this.realpath) { - var self = this - this.matches.forEach(function (matchset, index) { - var set = self.matches[index] = Object.create(null) - for (var p in matchset) { - try { - p = self._makeAbs(p) - var real = rp.realpathSync(p, self.realpathCache) - set[real] = true - } catch (er) { - if (er.syscall === 'stat') - set[self._makeAbs(p)] = true - else - throw er - } - } - }) - } - common.finish(this) -} - - -GlobSync.prototype._process = function (pattern, index, inGlobStar) { - assert(this instanceof GlobSync) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. - - // See if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index) - return - - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break - - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } - - var remain = pattern.slice(n) - - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix - - var abs = this._makeAbs(read) - - //if ignored, skip processing - if (childrenIgnored(this, read)) - return - - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar) -} - - -GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { - var entries = this._readdir(abs, inGlobStar) - - // if the abs isn't a dir, then nothing can match! - if (!entries) - return - - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' - - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) - } - } - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return - - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. - - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix.slice(-1) !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) - } - // This was the last one, and no stats were needed - return - } - - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) - newPattern = [prefix, e] - else - newPattern = [e] - this._process(newPattern.concat(remain), index, inGlobStar) - } -} - - -GlobSync.prototype._emitMatch = function (index, e) { - if (isIgnored(this, e)) - return - - var abs = this._makeAbs(e) - - if (this.mark) - e = this._mark(e) - - if (this.absolute) { - e = abs - } - - if (this.matches[index][e]) - return - - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return - } - - this.matches[index][e] = true - - if (this.stat) - this._stat(e) -} - - -GlobSync.prototype._readdirInGlobStar = function (abs) { - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false) - - var entries - var lstat - var stat - try { - lstat = fs.lstatSync(abs) - } catch (er) { - if (er.code === 'ENOENT') { - // lstat failed, doesn't exist - return null - } - } - - var isSym = lstat && lstat.isSymbolicLink() - this.symlinks[abs] = isSym - - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) - this.cache[abs] = 'FILE' - else - entries = this._readdir(abs, false) - - return entries -} - -GlobSync.prototype._readdir = function (abs, inGlobStar) { - var entries - - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs) - - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return null - - if (Array.isArray(c)) - return c - } - - try { - return this._readdirEntries(abs, fs.readdirSync(abs)) - } catch (er) { - this._readdirError(abs, er) - return null - } -} - -GlobSync.prototype._readdirEntries = function (abs, entries) { - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } - } - - this.cache[abs] = entries - - // mark and cache dir-ness - return entries -} - -GlobSync.prototype._readdirError = function (f, er) { - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - throw error - } - break - - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break - - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) - throw er - if (!this.silent) - console.error('glob error', er) - break - } -} - -GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { - - var entries = this._readdir(abs, inGlobStar) - - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return - - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) - - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false) - - var len = entries.length - var isSym = this.symlinks[abs] - - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return - - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue - - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true) - - var below = gspref.concat(entries[i], remain) - this._process(below, index, true) - } -} - -GlobSync.prototype._processSimple = function (prefix, index) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var exists = this._stat(prefix) - - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - // If it doesn't exist, then just mark the lack of results - if (!exists) - return - - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } - } - - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') - - // Mark this as a match - this._emitMatch(index, prefix) -} - -// Returns either 'DIR', 'FILE', or false -GlobSync.prototype._stat = function (f) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' - - if (f.length > this.maxLength) - return false - - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] - - if (Array.isArray(c)) - c = 'DIR' - - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return c - - if (needDir && c === 'FILE') - return false - - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } - - var exists - var stat = this.statCache[abs] - if (!stat) { - var lstat - try { - lstat = fs.lstatSync(abs) - } catch (er) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return false - } - } - - if (lstat && lstat.isSymbolicLink()) { - try { - stat = fs.statSync(abs) - } catch (er) { - stat = lstat - } - } else { - stat = lstat - } - } - - this.statCache[abs] = stat - - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - - this.cache[abs] = this.cache[abs] || c - - if (needDir && c === 'FILE') - return false - - return c -} - -GlobSync.prototype._mark = function (p) { - return common.mark(this, p) -} - -GlobSync.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} diff --git a/node_modules/has-unicode/LICENSE b/node_modules/has-unicode/LICENSE deleted file mode 100644 index d42e25e..0000000 --- a/node_modules/has-unicode/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2014, Rebecca Turner - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - diff --git a/node_modules/has-unicode/README.md b/node_modules/has-unicode/README.md deleted file mode 100644 index 5a03e59..0000000 --- a/node_modules/has-unicode/README.md +++ /dev/null @@ -1,43 +0,0 @@ -has-unicode -=========== - -Try to guess if your terminal supports unicode - -```javascript -var hasUnicode = require("has-unicode") - -if (hasUnicode()) { - // the terminal probably has unicode support -} -``` -```javascript -var hasUnicode = require("has-unicode").tryHarder -hasUnicode(function(unicodeSupported) { - if (unicodeSupported) { - // the terminal probably has unicode support - } -}) -``` - -## Detecting Unicode - -What we actually detect is UTF-8 support, as that's what Node itself supports. -If you have a UTF-16 locale then you won't be detected as unicode capable. - -### Windows - -Since at least Windows 7, `cmd` and `powershell` have been unicode capable, -but unfortunately even then it's not guaranteed. In many localizations it -still uses legacy code pages and there's no facility short of running -programs or linking C++ that will let us detect this. As such, we -report any Windows installation as NOT unicode capable, and recommend -that you encourage your users to override this via config. - -### Unix Like Operating Systems - -We look at the environment variables `LC_ALL`, `LC_CTYPE`, and `LANG` in -that order. For `LC_ALL` and `LANG`, it looks for `.UTF-8` in the value. -For `LC_CTYPE` it looks to see if the value is `UTF-8`. This is sufficient -for most POSIX systems. While locale data can be put in `/etc/locale.conf` -as well, AFAIK it's always copied into the environment. - diff --git a/node_modules/has-unicode/index.js b/node_modules/has-unicode/index.js deleted file mode 100644 index 9b0fe44..0000000 --- a/node_modules/has-unicode/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict" -var os = require("os") - -var hasUnicode = module.exports = function () { - // Recent Win32 platforms (>XP) CAN support unicode in the console but - // don't have to, and in non-english locales often use traditional local - // code pages. There's no way, short of windows system calls or execing - // the chcp command line program to figure this out. As such, we default - // this to false and encourage your users to override it via config if - // appropriate. - if (os.type() == "Windows_NT") { return false } - - var isUTF8 = /UTF-?8$/i - var ctype = process.env.LC_ALL || process.env.LC_CTYPE || process.env.LANG - return isUTF8.test(ctype) -} diff --git a/node_modules/has-unicode/package.json b/node_modules/has-unicode/package.json deleted file mode 100644 index 61dbf89..0000000 --- a/node_modules/has-unicode/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "_from": "has-unicode@^2.0.0", - "_id": "has-unicode@2.0.1", - "_inBundle": false, - "_integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "_location": "/has-unicode", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "has-unicode@^2.0.0", - "name": "has-unicode", - "escapedName": "has-unicode", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/gauge" - ], - "_resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "_shasum": "e0e6fe6a28cf51138855e086d1691e771de2a8b9", - "_spec": "has-unicode@^2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/gauge", - "author": { - "name": "Rebecca Turner", - "email": "me@re-becca.org" - }, - "bugs": { - "url": "https://github.com/iarna/has-unicode/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Try to guess if your terminal supports unicode", - "devDependencies": { - "require-inject": "^1.3.0", - "tap": "^2.3.1" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/iarna/has-unicode", - "keywords": [ - "unicode", - "terminal" - ], - "license": "ISC", - "main": "index.js", - "name": "has-unicode", - "repository": { - "type": "git", - "url": "git+https://github.com/iarna/has-unicode.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "2.0.1" -} diff --git a/node_modules/iconv-lite/Changelog.md b/node_modules/iconv-lite/Changelog.md deleted file mode 100644 index f252313..0000000 --- a/node_modules/iconv-lite/Changelog.md +++ /dev/null @@ -1,162 +0,0 @@ -# 0.4.24 / 2018-08-22 - - * Added MIK encoding (#196, by @Ivan-Kalatchev) - - -# 0.4.23 / 2018-05-07 - - * Fix deprecation warning in Node v10 due to the last usage of `new Buffer` (#185, by @felixbuenemann) - * Switched from NodeBuffer to Buffer in typings (#155 by @felixfbecker, #186 by @larssn) - - -# 0.4.22 / 2018-05-05 - - * Use older semver style for dependencies to be compatible with Node version 0.10 (#182, by @dougwilson) - * Fix tests to accomodate fixes in Node v10 (#182, by @dougwilson) - - -# 0.4.21 / 2018-04-06 - - * Fix encoding canonicalization (#156) - * Fix the paths in the "browser" field in package.json (#174 by @LMLB) - * Removed "contributors" section in package.json - see Git history instead. - - -# 0.4.20 / 2018-04-06 - - * Updated `new Buffer()` usages with recommended replacements as it's being deprecated in Node v10 (#176, #178 by @ChALkeR) - - -# 0.4.19 / 2017-09-09 - - * Fixed iso8859-1 codec regression in handling untranslatable characters (#162, caused by #147) - * Re-generated windows1255 codec, because it was updated in iconv project - * Fixed grammar in error message when iconv-lite is loaded with encoding other than utf8 - - -# 0.4.18 / 2017-06-13 - - * Fixed CESU-8 regression in Node v8. - - -# 0.4.17 / 2017-04-22 - - * Updated typescript definition file to support Angular 2 AoT mode (#153 by @larssn) - - -# 0.4.16 / 2017-04-22 - - * Added support for React Native (#150) - * Changed iso8859-1 encoding to usine internal 'binary' encoding, as it's the same thing (#147 by @mscdex) - * Fixed typo in Readme (#138 by @jiangzhuo) - * Fixed build for Node v6.10+ by making correct version comparison - * Added a warning if iconv-lite is loaded not as utf-8 (see #142) - - -# 0.4.15 / 2016-11-21 - - * Fixed typescript type definition (#137) - - -# 0.4.14 / 2016-11-20 - - * Preparation for v1.0 - * Added Node v6 and latest Node versions to Travis CI test rig - * Deprecated Node v0.8 support - * Typescript typings (@larssn) - * Fix encoding of Euro character in GB 18030 (inspired by @lygstate) - * Add ms prefix to dbcs windows encodings (@rokoroku) - - -# 0.4.13 / 2015-10-01 - - * Fix silly mistake in deprecation notice. - - -# 0.4.12 / 2015-09-26 - - * Node v4 support: - * Added CESU-8 decoding (#106) - * Added deprecation notice for `extendNodeEncodings` - * Added Travis tests for Node v4 and io.js latest (#105 by @Mithgol) - - -# 0.4.11 / 2015-07-03 - - * Added CESU-8 encoding. - - -# 0.4.10 / 2015-05-26 - - * Changed UTF-16 endianness heuristic to take into account any ASCII chars, not - just spaces. This should minimize the importance of "default" endianness. - - -# 0.4.9 / 2015-05-24 - - * Streamlined BOM handling: strip BOM by default, add BOM when encoding if - addBOM: true. Added docs to Readme. - * UTF16 now uses UTF16-LE by default. - * Fixed minor issue with big5 encoding. - * Added io.js testing on Travis; updated node-iconv version to test against. - Now we just skip testing SBCS encodings that node-iconv doesn't support. - * (internal refactoring) Updated codec interface to use classes. - * Use strict mode in all files. - - -# 0.4.8 / 2015-04-14 - - * added alias UNICODE-1-1-UTF-7 for UTF-7 encoding (#94) - - -# 0.4.7 / 2015-02-05 - - * stop official support of Node.js v0.8. Should still work, but no guarantees. - reason: Packages needed for testing are hard to get on Travis CI. - * work in environment where Object.prototype is monkey patched with enumerable - props (#89). - - -# 0.4.6 / 2015-01-12 - - * fix rare aliases of single-byte encodings (thanks @mscdex) - * double the timeout for dbcs tests to make them less flaky on travis - - -# 0.4.5 / 2014-11-20 - - * fix windows-31j and x-sjis encoding support (@nleush) - * minor fix: undefined variable reference when internal error happens - - -# 0.4.4 / 2014-07-16 - - * added encodings UTF-7 (RFC2152) and UTF-7-IMAP (RFC3501 Section 5.1.3) - * fixed streaming base64 encoding - - -# 0.4.3 / 2014-06-14 - - * added encodings UTF-16BE and UTF-16 with BOM - - -# 0.4.2 / 2014-06-12 - - * don't throw exception if `extendNodeEncodings()` is called more than once - - -# 0.4.1 / 2014-06-11 - - * codepage 808 added - - -# 0.4.0 / 2014-06-10 - - * code is rewritten from scratch - * all widespread encodings are supported - * streaming interface added - * browserify compatibility added - * (optional) extend core primitive encodings to make usage even simpler - * moved from vows to mocha as the testing framework - - diff --git a/node_modules/iconv-lite/LICENSE b/node_modules/iconv-lite/LICENSE deleted file mode 100644 index d518d83..0000000 --- a/node_modules/iconv-lite/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2011 Alexander Shtuchkin - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/node_modules/iconv-lite/README.md b/node_modules/iconv-lite/README.md deleted file mode 100644 index c981c37..0000000 --- a/node_modules/iconv-lite/README.md +++ /dev/null @@ -1,156 +0,0 @@ -## Pure JS character encoding conversion [![Build Status](https://travis-ci.org/ashtuchkin/iconv-lite.svg?branch=master)](https://travis-ci.org/ashtuchkin/iconv-lite) - - * Doesn't need native code compilation. Works on Windows and in sandboxed environments like [Cloud9](http://c9.io). - * Used in popular projects like [Express.js (body_parser)](https://github.com/expressjs/body-parser), - [Grunt](http://gruntjs.com/), [Nodemailer](http://www.nodemailer.com/), [Yeoman](http://yeoman.io/) and others. - * Faster than [node-iconv](https://github.com/bnoordhuis/node-iconv) (see below for performance comparison). - * Intuitive encode/decode API - * Streaming support for Node v0.10+ - * [Deprecated] Can extend Node.js primitives (buffers, streams) to support all iconv-lite encodings. - * In-browser usage via [Browserify](https://github.com/substack/node-browserify) (~180k gzip compressed with Buffer shim included). - * Typescript [type definition file](https://github.com/ashtuchkin/iconv-lite/blob/master/lib/index.d.ts) included. - * React Native is supported (need to explicitly `npm install` two more modules: `buffer` and `stream`). - * License: MIT. - -[![NPM Stats](https://nodei.co/npm/iconv-lite.png?downloads=true&downloadRank=true)](https://npmjs.org/packages/iconv-lite/) - -## Usage -### Basic API -```javascript -var iconv = require('iconv-lite'); - -// Convert from an encoded buffer to js string. -str = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251'); - -// Convert from js string to an encoded buffer. -buf = iconv.encode("Sample input string", 'win1251'); - -// Check if encoding is supported -iconv.encodingExists("us-ascii") -``` - -### Streaming API (Node v0.10+) -```javascript - -// Decode stream (from binary stream to js strings) -http.createServer(function(req, res) { - var converterStream = iconv.decodeStream('win1251'); - req.pipe(converterStream); - - converterStream.on('data', function(str) { - console.log(str); // Do something with decoded strings, chunk-by-chunk. - }); -}); - -// Convert encoding streaming example -fs.createReadStream('file-in-win1251.txt') - .pipe(iconv.decodeStream('win1251')) - .pipe(iconv.encodeStream('ucs2')) - .pipe(fs.createWriteStream('file-in-ucs2.txt')); - -// Sugar: all encode/decode streams have .collect(cb) method to accumulate data. -http.createServer(function(req, res) { - req.pipe(iconv.decodeStream('win1251')).collect(function(err, body) { - assert(typeof body == 'string'); - console.log(body); // full request body string - }); -}); -``` - -### [Deprecated] Extend Node.js own encodings -> NOTE: This doesn't work on latest Node versions. See [details](https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility). - -```javascript -// After this call all Node basic primitives will understand iconv-lite encodings. -iconv.extendNodeEncodings(); - -// Examples: -buf = new Buffer(str, 'win1251'); -buf.write(str, 'gbk'); -str = buf.toString('latin1'); -assert(Buffer.isEncoding('iso-8859-15')); -Buffer.byteLength(str, 'us-ascii'); - -http.createServer(function(req, res) { - req.setEncoding('big5'); - req.collect(function(err, body) { - console.log(body); - }); -}); - -fs.createReadStream("file.txt", "shift_jis"); - -// External modules are also supported (if they use Node primitives, which they probably do). -request = require('request'); -request({ - url: "http://github.com/", - encoding: "cp932" -}); - -// To remove extensions -iconv.undoExtendNodeEncodings(); -``` - -## Supported encodings - - * All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex. - * Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap. - * All widespread singlebyte encodings: Windows 125x family, ISO-8859 family, - IBM/DOS codepages, Macintosh family, KOI8 family, all others supported by iconv library. - Aliases like 'latin1', 'us-ascii' also supported. - * All widespread multibyte encodings: CP932, CP936, CP949, CP950, GB2312, GBK, GB18030, Big5, Shift_JIS, EUC-JP. - -See [all supported encodings on wiki](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings). - -Most singlebyte encodings are generated automatically from [node-iconv](https://github.com/bnoordhuis/node-iconv). Thank you Ben Noordhuis and libiconv authors! - -Multibyte encodings are generated from [Unicode.org mappings](http://www.unicode.org/Public/MAPPINGS/) and [WHATWG Encoding Standard mappings](http://encoding.spec.whatwg.org/). Thank you, respective authors! - - -## Encoding/decoding speed - -Comparison with node-iconv module (1000x256kb, on MacBook Pro, Core i5/2.6 GHz, Node v0.12.0). -Note: your results may vary, so please always check on your hardware. - - operation iconv@2.1.4 iconv-lite@0.4.7 - ---------------------------------------------------------- - encode('win1251') ~96 Mb/s ~320 Mb/s - decode('win1251') ~95 Mb/s ~246 Mb/s - -## BOM handling - - * Decoding: BOM is stripped by default, unless overridden by passing `stripBOM: false` in options - (f.ex. `iconv.decode(buf, enc, {stripBOM: false})`). - A callback might also be given as a `stripBOM` parameter - it'll be called if BOM character was actually found. - * If you want to detect UTF-8 BOM when decoding other encodings, use [node-autodetect-decoder-stream](https://github.com/danielgindi/node-autodetect-decoder-stream) module. - * Encoding: No BOM added, unless overridden by `addBOM: true` option. - -## UTF-16 Encodings - -This library supports UTF-16LE, UTF-16BE and UTF-16 encodings. First two are straightforward, but UTF-16 is trying to be -smart about endianness in the following ways: - * Decoding: uses BOM and 'spaces heuristic' to determine input endianness. Default is UTF-16LE, but can be - overridden with `defaultEncoding: 'utf-16be'` option. Strips BOM unless `stripBOM: false`. - * Encoding: uses UTF-16LE and writes BOM by default. Use `addBOM: false` to override. - -## Other notes - -When decoding, be sure to supply a Buffer to decode() method, otherwise [bad things usually happen](https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding). -Untranslatable characters are set to � or ?. No transliteration is currently supported. -Node versions 0.10.31 and 0.11.13 are buggy, don't use them (see #65, #77). - -## Testing - -```bash -$ git clone git@github.com:ashtuchkin/iconv-lite.git -$ cd iconv-lite -$ npm install -$ npm test - -$ # To view performance: -$ node test/performance.js - -$ # To view test coverage: -$ npm run coverage -$ open coverage/lcov-report/index.html -``` diff --git a/node_modules/iconv-lite/encodings/dbcs-codec.js b/node_modules/iconv-lite/encodings/dbcs-codec.js deleted file mode 100644 index 1fe3e16..0000000 --- a/node_modules/iconv-lite/encodings/dbcs-codec.js +++ /dev/null @@ -1,555 +0,0 @@ -"use strict"; -var Buffer = require("safer-buffer").Buffer; - -// Multibyte codec. In this scheme, a character is represented by 1 or more bytes. -// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences. -// To save memory and loading time, we read table files only when requested. - -exports._dbcs = DBCSCodec; - -var UNASSIGNED = -1, - GB18030_CODE = -2, - SEQ_START = -10, - NODE_START = -1000, - UNASSIGNED_NODE = new Array(0x100), - DEF_CHAR = -1; - -for (var i = 0; i < 0x100; i++) - UNASSIGNED_NODE[i] = UNASSIGNED; - - -// Class DBCSCodec reads and initializes mapping tables. -function DBCSCodec(codecOptions, iconv) { - this.encodingName = codecOptions.encodingName; - if (!codecOptions) - throw new Error("DBCS codec is called without the data.") - if (!codecOptions.table) - throw new Error("Encoding '" + this.encodingName + "' has no data."); - - // Load tables. - var mappingTable = codecOptions.table(); - - - // Decode tables: MBCS -> Unicode. - - // decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256. - // Trie root is decodeTables[0]. - // Values: >= 0 -> unicode character code. can be > 0xFFFF - // == UNASSIGNED -> unknown/unassigned sequence. - // == GB18030_CODE -> this is the end of a GB18030 4-byte sequence. - // <= NODE_START -> index of the next node in our trie to process next byte. - // <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq. - this.decodeTables = []; - this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node. - - // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here. - this.decodeTableSeq = []; - - // Actual mapping tables consist of chunks. Use them to fill up decode tables. - for (var i = 0; i < mappingTable.length; i++) - this._addDecodeChunk(mappingTable[i]); - - this.defaultCharUnicode = iconv.defaultCharUnicode; - - - // Encode tables: Unicode -> DBCS. - - // `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance. - // Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null. - // Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.). - // == UNASSIGNED -> no conversion found. Output a default char. - // <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence. - this.encodeTable = []; - - // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of - // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key - // means end of sequence (needed when one sequence is a strict subsequence of another). - // Objects are kept separately from encodeTable to increase performance. - this.encodeTableSeq = []; - - // Some chars can be decoded, but need not be encoded. - var skipEncodeChars = {}; - if (codecOptions.encodeSkipVals) - for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) { - var val = codecOptions.encodeSkipVals[i]; - if (typeof val === 'number') - skipEncodeChars[val] = true; - else - for (var j = val.from; j <= val.to; j++) - skipEncodeChars[j] = true; - } - - // Use decode trie to recursively fill out encode tables. - this._fillEncodeTable(0, 0, skipEncodeChars); - - // Add more encoding pairs when needed. - if (codecOptions.encodeAdd) { - for (var uChar in codecOptions.encodeAdd) - if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) - this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]); - } - - this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)]; - if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?']; - if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0); - - - // Load & create GB18030 tables when needed. - if (typeof codecOptions.gb18030 === 'function') { - this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges. - - // Add GB18030 decode tables. - var thirdByteNodeIdx = this.decodeTables.length; - var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0); - - var fourthByteNodeIdx = this.decodeTables.length; - var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0); - - for (var i = 0x81; i <= 0xFE; i++) { - var secondByteNodeIdx = NODE_START - this.decodeTables[0][i]; - var secondByteNode = this.decodeTables[secondByteNodeIdx]; - for (var j = 0x30; j <= 0x39; j++) - secondByteNode[j] = NODE_START - thirdByteNodeIdx; - } - for (var i = 0x81; i <= 0xFE; i++) - thirdByteNode[i] = NODE_START - fourthByteNodeIdx; - for (var i = 0x30; i <= 0x39; i++) - fourthByteNode[i] = GB18030_CODE - } -} - -DBCSCodec.prototype.encoder = DBCSEncoder; -DBCSCodec.prototype.decoder = DBCSDecoder; - -// Decoder helpers -DBCSCodec.prototype._getDecodeTrieNode = function(addr) { - var bytes = []; - for (; addr > 0; addr >>= 8) - bytes.push(addr & 0xFF); - if (bytes.length == 0) - bytes.push(0); - - var node = this.decodeTables[0]; - for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie. - var val = node[bytes[i]]; - - if (val == UNASSIGNED) { // Create new node. - node[bytes[i]] = NODE_START - this.decodeTables.length; - this.decodeTables.push(node = UNASSIGNED_NODE.slice(0)); - } - else if (val <= NODE_START) { // Existing node. - node = this.decodeTables[NODE_START - val]; - } - else - throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16)); - } - return node; -} - - -DBCSCodec.prototype._addDecodeChunk = function(chunk) { - // First element of chunk is the hex mbcs code where we start. - var curAddr = parseInt(chunk[0], 16); - - // Choose the decoding node where we'll write our chars. - var writeTable = this._getDecodeTrieNode(curAddr); - curAddr = curAddr & 0xFF; - - // Write all other elements of the chunk to the table. - for (var k = 1; k < chunk.length; k++) { - var part = chunk[k]; - if (typeof part === "string") { // String, write as-is. - for (var l = 0; l < part.length;) { - var code = part.charCodeAt(l++); - if (0xD800 <= code && code < 0xDC00) { // Decode surrogate - var codeTrail = part.charCodeAt(l++); - if (0xDC00 <= codeTrail && codeTrail < 0xE000) - writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00); - else - throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]); - } - else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used) - var len = 0xFFF - code + 2; - var seq = []; - for (var m = 0; m < len; m++) - seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq. - - writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length; - this.decodeTableSeq.push(seq); - } - else - writeTable[curAddr++] = code; // Basic char - } - } - else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character. - var charCode = writeTable[curAddr - 1] + 1; - for (var l = 0; l < part; l++) - writeTable[curAddr++] = charCode++; - } - else - throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]); - } - if (curAddr > 0xFF) - throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr); -} - -// Encoder helpers -DBCSCodec.prototype._getEncodeBucket = function(uCode) { - var high = uCode >> 8; // This could be > 0xFF because of astral characters. - if (this.encodeTable[high] === undefined) - this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand. - return this.encodeTable[high]; -} - -DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) { - var bucket = this._getEncodeBucket(uCode); - var low = uCode & 0xFF; - if (bucket[low] <= SEQ_START) - this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it. - else if (bucket[low] == UNASSIGNED) - bucket[low] = dbcsCode; -} - -DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) { - - // Get the root of character tree according to first character of the sequence. - var uCode = seq[0]; - var bucket = this._getEncodeBucket(uCode); - var low = uCode & 0xFF; - - var node; - if (bucket[low] <= SEQ_START) { - // There's already a sequence with - use it. - node = this.encodeTableSeq[SEQ_START-bucket[low]]; - } - else { - // There was no sequence object - allocate a new one. - node = {}; - if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence. - bucket[low] = SEQ_START - this.encodeTableSeq.length; - this.encodeTableSeq.push(node); - } - - // Traverse the character tree, allocating new nodes as needed. - for (var j = 1; j < seq.length-1; j++) { - var oldVal = node[uCode]; - if (typeof oldVal === 'object') - node = oldVal; - else { - node = node[uCode] = {} - if (oldVal !== undefined) - node[DEF_CHAR] = oldVal - } - } - - // Set the leaf to given dbcsCode. - uCode = seq[seq.length-1]; - node[uCode] = dbcsCode; -} - -DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) { - var node = this.decodeTables[nodeIdx]; - for (var i = 0; i < 0x100; i++) { - var uCode = node[i]; - var mbCode = prefix + i; - if (skipEncodeChars[mbCode]) - continue; - - if (uCode >= 0) - this._setEncodeChar(uCode, mbCode); - else if (uCode <= NODE_START) - this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars); - else if (uCode <= SEQ_START) - this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode); - } -} - - - -// == Encoder ================================================================== - -function DBCSEncoder(options, codec) { - // Encoder state - this.leadSurrogate = -1; - this.seqObj = undefined; - - // Static data - this.encodeTable = codec.encodeTable; - this.encodeTableSeq = codec.encodeTableSeq; - this.defaultCharSingleByte = codec.defCharSB; - this.gb18030 = codec.gb18030; -} - -DBCSEncoder.prototype.write = function(str) { - var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)), - leadSurrogate = this.leadSurrogate, - seqObj = this.seqObj, nextChar = -1, - i = 0, j = 0; - - while (true) { - // 0. Get next character. - if (nextChar === -1) { - if (i == str.length) break; - var uCode = str.charCodeAt(i++); - } - else { - var uCode = nextChar; - nextChar = -1; - } - - // 1. Handle surrogates. - if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates. - if (uCode < 0xDC00) { // We've got lead surrogate. - if (leadSurrogate === -1) { - leadSurrogate = uCode; - continue; - } else { - leadSurrogate = uCode; - // Double lead surrogate found. - uCode = UNASSIGNED; - } - } else { // We've got trail surrogate. - if (leadSurrogate !== -1) { - uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00); - leadSurrogate = -1; - } else { - // Incomplete surrogate pair - only trail surrogate found. - uCode = UNASSIGNED; - } - - } - } - else if (leadSurrogate !== -1) { - // Incomplete surrogate pair - only lead surrogate found. - nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char. - leadSurrogate = -1; - } - - // 2. Convert uCode character. - var dbcsCode = UNASSIGNED; - if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence - var resCode = seqObj[uCode]; - if (typeof resCode === 'object') { // Sequence continues. - seqObj = resCode; - continue; - - } else if (typeof resCode == 'number') { // Sequence finished. Write it. - dbcsCode = resCode; - - } else if (resCode == undefined) { // Current character is not part of the sequence. - - // Try default character for this sequence - resCode = seqObj[DEF_CHAR]; - if (resCode !== undefined) { - dbcsCode = resCode; // Found. Write it. - nextChar = uCode; // Current character will be written too in the next iteration. - - } else { - // TODO: What if we have no default? (resCode == undefined) - // Then, we should write first char of the sequence as-is and try the rest recursively. - // Didn't do it for now because no encoding has this situation yet. - // Currently, just skip the sequence and write current char. - } - } - seqObj = undefined; - } - else if (uCode >= 0) { // Regular character - var subtable = this.encodeTable[uCode >> 8]; - if (subtable !== undefined) - dbcsCode = subtable[uCode & 0xFF]; - - if (dbcsCode <= SEQ_START) { // Sequence start - seqObj = this.encodeTableSeq[SEQ_START-dbcsCode]; - continue; - } - - if (dbcsCode == UNASSIGNED && this.gb18030) { - // Use GB18030 algorithm to find character(s) to write. - var idx = findIdx(this.gb18030.uChars, uCode); - if (idx != -1) { - var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]); - newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600; - newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260; - newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10; - newBuf[j++] = 0x30 + dbcsCode; - continue; - } - } - } - - // 3. Write dbcsCode character. - if (dbcsCode === UNASSIGNED) - dbcsCode = this.defaultCharSingleByte; - - if (dbcsCode < 0x100) { - newBuf[j++] = dbcsCode; - } - else if (dbcsCode < 0x10000) { - newBuf[j++] = dbcsCode >> 8; // high byte - newBuf[j++] = dbcsCode & 0xFF; // low byte - } - else { - newBuf[j++] = dbcsCode >> 16; - newBuf[j++] = (dbcsCode >> 8) & 0xFF; - newBuf[j++] = dbcsCode & 0xFF; - } - } - - this.seqObj = seqObj; - this.leadSurrogate = leadSurrogate; - return newBuf.slice(0, j); -} - -DBCSEncoder.prototype.end = function() { - if (this.leadSurrogate === -1 && this.seqObj === undefined) - return; // All clean. Most often case. - - var newBuf = Buffer.alloc(10), j = 0; - - if (this.seqObj) { // We're in the sequence. - var dbcsCode = this.seqObj[DEF_CHAR]; - if (dbcsCode !== undefined) { // Write beginning of the sequence. - if (dbcsCode < 0x100) { - newBuf[j++] = dbcsCode; - } - else { - newBuf[j++] = dbcsCode >> 8; // high byte - newBuf[j++] = dbcsCode & 0xFF; // low byte - } - } else { - // See todo above. - } - this.seqObj = undefined; - } - - if (this.leadSurrogate !== -1) { - // Incomplete surrogate pair - only lead surrogate found. - newBuf[j++] = this.defaultCharSingleByte; - this.leadSurrogate = -1; - } - - return newBuf.slice(0, j); -} - -// Export for testing -DBCSEncoder.prototype.findIdx = findIdx; - - -// == Decoder ================================================================== - -function DBCSDecoder(options, codec) { - // Decoder state - this.nodeIdx = 0; - this.prevBuf = Buffer.alloc(0); - - // Static data - this.decodeTables = codec.decodeTables; - this.decodeTableSeq = codec.decodeTableSeq; - this.defaultCharUnicode = codec.defaultCharUnicode; - this.gb18030 = codec.gb18030; -} - -DBCSDecoder.prototype.write = function(buf) { - var newBuf = Buffer.alloc(buf.length*2), - nodeIdx = this.nodeIdx, - prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length, - seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence. - uCode; - - if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later. - prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]); - - for (var i = 0, j = 0; i < buf.length; i++) { - var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset]; - - // Lookup in current trie node. - var uCode = this.decodeTables[nodeIdx][curByte]; - - if (uCode >= 0) { - // Normal character, just use it. - } - else if (uCode === UNASSIGNED) { // Unknown char. - // TODO: Callback with seq. - //var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); - i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle). - uCode = this.defaultCharUnicode.charCodeAt(0); - } - else if (uCode === GB18030_CODE) { - var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); - var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30); - var idx = findIdx(this.gb18030.gbChars, ptr); - uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx]; - } - else if (uCode <= NODE_START) { // Go to next trie node. - nodeIdx = NODE_START - uCode; - continue; - } - else if (uCode <= SEQ_START) { // Output a sequence of chars. - var seq = this.decodeTableSeq[SEQ_START - uCode]; - for (var k = 0; k < seq.length - 1; k++) { - uCode = seq[k]; - newBuf[j++] = uCode & 0xFF; - newBuf[j++] = uCode >> 8; - } - uCode = seq[seq.length-1]; - } - else - throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte); - - // Write the character to buffer, handling higher planes using surrogate pair. - if (uCode > 0xFFFF) { - uCode -= 0x10000; - var uCodeLead = 0xD800 + Math.floor(uCode / 0x400); - newBuf[j++] = uCodeLead & 0xFF; - newBuf[j++] = uCodeLead >> 8; - - uCode = 0xDC00 + uCode % 0x400; - } - newBuf[j++] = uCode & 0xFF; - newBuf[j++] = uCode >> 8; - - // Reset trie node. - nodeIdx = 0; seqStart = i+1; - } - - this.nodeIdx = nodeIdx; - this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset); - return newBuf.slice(0, j).toString('ucs2'); -} - -DBCSDecoder.prototype.end = function() { - var ret = ''; - - // Try to parse all remaining chars. - while (this.prevBuf.length > 0) { - // Skip 1 character in the buffer. - ret += this.defaultCharUnicode; - var buf = this.prevBuf.slice(1); - - // Parse remaining as usual. - this.prevBuf = Buffer.alloc(0); - this.nodeIdx = 0; - if (buf.length > 0) - ret += this.write(buf); - } - - this.nodeIdx = 0; - return ret; -} - -// Binary search for GB18030. Returns largest i such that table[i] <= val. -function findIdx(table, val) { - if (table[0] > val) - return -1; - - var l = 0, r = table.length; - while (l < r-1) { // always table[l] <= val < table[r] - var mid = l + Math.floor((r-l+1)/2); - if (table[mid] <= val) - l = mid; - else - r = mid; - } - return l; -} - diff --git a/node_modules/iconv-lite/encodings/dbcs-data.js b/node_modules/iconv-lite/encodings/dbcs-data.js deleted file mode 100644 index 4b61914..0000000 --- a/node_modules/iconv-lite/encodings/dbcs-data.js +++ /dev/null @@ -1,176 +0,0 @@ -"use strict"; - -// Description of supported double byte encodings and aliases. -// Tables are not require()-d until they are needed to speed up library load. -// require()-s are direct to support Browserify. - -module.exports = { - - // == Japanese/ShiftJIS ==================================================== - // All japanese encodings are based on JIS X set of standards: - // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF. - // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes. - // Has several variations in 1978, 1983, 1990 and 1997. - // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead. - // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233. - // 2 planes, first is superset of 0208, second - revised 0212. - // Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx) - - // Byte encodings are: - // * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte - // encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC. - // Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI. - // * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes. - // 0x00-0x7F - lower part of 0201 - // 0x8E, 0xA1-0xDF - upper part of 0201 - // (0xA1-0xFE)x2 - 0208 plane (94x94). - // 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94). - // * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon. - // Used as-is in ISO2022 family. - // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII, - // 0201-1976 Roman, 0208-1978, 0208-1983. - // * ISO2022-JP-1: Adds esc seq for 0212-1990. - // * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7. - // * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2. - // * ISO2022-JP-2004: Adds 0213-2004 Plane 1. - // - // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes. - // - // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html - - 'shiftjis': { - type: '_dbcs', - table: function() { return require('./tables/shiftjis.json') }, - encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, - encodeSkipVals: [{from: 0xED40, to: 0xF940}], - }, - 'csshiftjis': 'shiftjis', - 'mskanji': 'shiftjis', - 'sjis': 'shiftjis', - 'windows31j': 'shiftjis', - 'ms31j': 'shiftjis', - 'xsjis': 'shiftjis', - 'windows932': 'shiftjis', - 'ms932': 'shiftjis', - '932': 'shiftjis', - 'cp932': 'shiftjis', - - 'eucjp': { - type: '_dbcs', - table: function() { return require('./tables/eucjp.json') }, - encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, - }, - - // TODO: KDDI extension to Shift_JIS - // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes. - // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars. - - - // == Chinese/GBK ========================================================== - // http://en.wikipedia.org/wiki/GBK - // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder - - // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936 - 'gb2312': 'cp936', - 'gb231280': 'cp936', - 'gb23121980': 'cp936', - 'csgb2312': 'cp936', - 'csiso58gb231280': 'cp936', - 'euccn': 'cp936', - - // Microsoft's CP936 is a subset and approximation of GBK. - 'windows936': 'cp936', - 'ms936': 'cp936', - '936': 'cp936', - 'cp936': { - type: '_dbcs', - table: function() { return require('./tables/cp936.json') }, - }, - - // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other. - 'gbk': { - type: '_dbcs', - table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) }, - }, - 'xgbk': 'gbk', - 'isoir58': 'gbk', - - // GB18030 is an algorithmic extension of GBK. - // Main source: https://www.w3.org/TR/encoding/#gbk-encoder - // http://icu-project.org/docs/papers/gb18030.html - // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml - // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0 - 'gb18030': { - type: '_dbcs', - table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) }, - gb18030: function() { return require('./tables/gb18030-ranges.json') }, - encodeSkipVals: [0x80], - encodeAdd: {'€': 0xA2E3}, - }, - - 'chinese': 'gb18030', - - - // == Korean =============================================================== - // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same. - 'windows949': 'cp949', - 'ms949': 'cp949', - '949': 'cp949', - 'cp949': { - type: '_dbcs', - table: function() { return require('./tables/cp949.json') }, - }, - - 'cseuckr': 'cp949', - 'csksc56011987': 'cp949', - 'euckr': 'cp949', - 'isoir149': 'cp949', - 'korean': 'cp949', - 'ksc56011987': 'cp949', - 'ksc56011989': 'cp949', - 'ksc5601': 'cp949', - - - // == Big5/Taiwan/Hong Kong ================================================ - // There are lots of tables for Big5 and cp950. Please see the following links for history: - // http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html - // Variations, in roughly number of defined chars: - // * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT - // * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/ - // * Big5-2003 (Taiwan standard) almost superset of cp950. - // * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers. - // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard. - // many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years. - // Plus, it has 4 combining sequences. - // Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299 - // because big5-hkscs is the only encoding to include astral characters in non-algorithmic way. - // Implementations are not consistent within browsers; sometimes labeled as just big5. - // MS Internet Explorer switches from big5 to big5-hkscs when a patch applied. - // Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31 - // In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s. - // Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt - // http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt - // - // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder - // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong. - - 'windows950': 'cp950', - 'ms950': 'cp950', - '950': 'cp950', - 'cp950': { - type: '_dbcs', - table: function() { return require('./tables/cp950.json') }, - }, - - // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus. - 'big5': 'big5hkscs', - 'big5hkscs': { - type: '_dbcs', - table: function() { return require('./tables/cp950.json').concat(require('./tables/big5-added.json')) }, - encodeSkipVals: [0xa2cc], - }, - - 'cnbig5': 'big5hkscs', - 'csbig5': 'big5hkscs', - 'xxbig5': 'big5hkscs', -}; diff --git a/node_modules/iconv-lite/encodings/index.js b/node_modules/iconv-lite/encodings/index.js deleted file mode 100644 index e304003..0000000 --- a/node_modules/iconv-lite/encodings/index.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -// Update this array if you add/rename/remove files in this directory. -// We support Browserify by skipping automatic module discovery and requiring modules directly. -var modules = [ - require("./internal"), - require("./utf16"), - require("./utf7"), - require("./sbcs-codec"), - require("./sbcs-data"), - require("./sbcs-data-generated"), - require("./dbcs-codec"), - require("./dbcs-data"), -]; - -// Put all encoding/alias/codec definitions to single object and export it. -for (var i = 0; i < modules.length; i++) { - var module = modules[i]; - for (var enc in module) - if (Object.prototype.hasOwnProperty.call(module, enc)) - exports[enc] = module[enc]; -} diff --git a/node_modules/iconv-lite/encodings/internal.js b/node_modules/iconv-lite/encodings/internal.js deleted file mode 100644 index 05ce38b..0000000 --- a/node_modules/iconv-lite/encodings/internal.js +++ /dev/null @@ -1,188 +0,0 @@ -"use strict"; -var Buffer = require("safer-buffer").Buffer; - -// Export Node.js internal encodings. - -module.exports = { - // Encodings - utf8: { type: "_internal", bomAware: true}, - cesu8: { type: "_internal", bomAware: true}, - unicode11utf8: "utf8", - - ucs2: { type: "_internal", bomAware: true}, - utf16le: "ucs2", - - binary: { type: "_internal" }, - base64: { type: "_internal" }, - hex: { type: "_internal" }, - - // Codec. - _internal: InternalCodec, -}; - -//------------------------------------------------------------------------------ - -function InternalCodec(codecOptions, iconv) { - this.enc = codecOptions.encodingName; - this.bomAware = codecOptions.bomAware; - - if (this.enc === "base64") - this.encoder = InternalEncoderBase64; - else if (this.enc === "cesu8") { - this.enc = "utf8"; // Use utf8 for decoding. - this.encoder = InternalEncoderCesu8; - - // Add decoder for versions of Node not supporting CESU-8 - if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') { - this.decoder = InternalDecoderCesu8; - this.defaultCharUnicode = iconv.defaultCharUnicode; - } - } -} - -InternalCodec.prototype.encoder = InternalEncoder; -InternalCodec.prototype.decoder = InternalDecoder; - -//------------------------------------------------------------------------------ - -// We use node.js internal decoder. Its signature is the same as ours. -var StringDecoder = require('string_decoder').StringDecoder; - -if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method. - StringDecoder.prototype.end = function() {}; - - -function InternalDecoder(options, codec) { - StringDecoder.call(this, codec.enc); -} - -InternalDecoder.prototype = StringDecoder.prototype; - - -//------------------------------------------------------------------------------ -// Encoder is mostly trivial - -function InternalEncoder(options, codec) { - this.enc = codec.enc; -} - -InternalEncoder.prototype.write = function(str) { - return Buffer.from(str, this.enc); -} - -InternalEncoder.prototype.end = function() { -} - - -//------------------------------------------------------------------------------ -// Except base64 encoder, which must keep its state. - -function InternalEncoderBase64(options, codec) { - this.prevStr = ''; -} - -InternalEncoderBase64.prototype.write = function(str) { - str = this.prevStr + str; - var completeQuads = str.length - (str.length % 4); - this.prevStr = str.slice(completeQuads); - str = str.slice(0, completeQuads); - - return Buffer.from(str, "base64"); -} - -InternalEncoderBase64.prototype.end = function() { - return Buffer.from(this.prevStr, "base64"); -} - - -//------------------------------------------------------------------------------ -// CESU-8 encoder is also special. - -function InternalEncoderCesu8(options, codec) { -} - -InternalEncoderCesu8.prototype.write = function(str) { - var buf = Buffer.alloc(str.length * 3), bufIdx = 0; - for (var i = 0; i < str.length; i++) { - var charCode = str.charCodeAt(i); - // Naive implementation, but it works because CESU-8 is especially easy - // to convert from UTF-16 (which all JS strings are encoded in). - if (charCode < 0x80) - buf[bufIdx++] = charCode; - else if (charCode < 0x800) { - buf[bufIdx++] = 0xC0 + (charCode >>> 6); - buf[bufIdx++] = 0x80 + (charCode & 0x3f); - } - else { // charCode will always be < 0x10000 in javascript. - buf[bufIdx++] = 0xE0 + (charCode >>> 12); - buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f); - buf[bufIdx++] = 0x80 + (charCode & 0x3f); - } - } - return buf.slice(0, bufIdx); -} - -InternalEncoderCesu8.prototype.end = function() { -} - -//------------------------------------------------------------------------------ -// CESU-8 decoder is not implemented in Node v4.0+ - -function InternalDecoderCesu8(options, codec) { - this.acc = 0; - this.contBytes = 0; - this.accBytes = 0; - this.defaultCharUnicode = codec.defaultCharUnicode; -} - -InternalDecoderCesu8.prototype.write = function(buf) { - var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, - res = ''; - for (var i = 0; i < buf.length; i++) { - var curByte = buf[i]; - if ((curByte & 0xC0) !== 0x80) { // Leading byte - if (contBytes > 0) { // Previous code is invalid - res += this.defaultCharUnicode; - contBytes = 0; - } - - if (curByte < 0x80) { // Single-byte code - res += String.fromCharCode(curByte); - } else if (curByte < 0xE0) { // Two-byte code - acc = curByte & 0x1F; - contBytes = 1; accBytes = 1; - } else if (curByte < 0xF0) { // Three-byte code - acc = curByte & 0x0F; - contBytes = 2; accBytes = 1; - } else { // Four or more are not supported for CESU-8. - res += this.defaultCharUnicode; - } - } else { // Continuation byte - if (contBytes > 0) { // We're waiting for it. - acc = (acc << 6) | (curByte & 0x3f); - contBytes--; accBytes++; - if (contBytes === 0) { - // Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80) - if (accBytes === 2 && acc < 0x80 && acc > 0) - res += this.defaultCharUnicode; - else if (accBytes === 3 && acc < 0x800) - res += this.defaultCharUnicode; - else - // Actually add character. - res += String.fromCharCode(acc); - } - } else { // Unexpected continuation byte - res += this.defaultCharUnicode; - } - } - } - this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes; - return res; -} - -InternalDecoderCesu8.prototype.end = function() { - var res = 0; - if (this.contBytes > 0) - res += this.defaultCharUnicode; - return res; -} diff --git a/node_modules/iconv-lite/encodings/sbcs-codec.js b/node_modules/iconv-lite/encodings/sbcs-codec.js deleted file mode 100644 index abac5ff..0000000 --- a/node_modules/iconv-lite/encodings/sbcs-codec.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -var Buffer = require("safer-buffer").Buffer; - -// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that -// correspond to encoded bytes (if 128 - then lower half is ASCII). - -exports._sbcs = SBCSCodec; -function SBCSCodec(codecOptions, iconv) { - if (!codecOptions) - throw new Error("SBCS codec is called without the data.") - - // Prepare char buffer for decoding. - if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256)) - throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)"); - - if (codecOptions.chars.length === 128) { - var asciiString = ""; - for (var i = 0; i < 128; i++) - asciiString += String.fromCharCode(i); - codecOptions.chars = asciiString + codecOptions.chars; - } - - this.decodeBuf = Buffer.from(codecOptions.chars, 'ucs2'); - - // Encoding buffer. - var encodeBuf = Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0)); - - for (var i = 0; i < codecOptions.chars.length; i++) - encodeBuf[codecOptions.chars.charCodeAt(i)] = i; - - this.encodeBuf = encodeBuf; -} - -SBCSCodec.prototype.encoder = SBCSEncoder; -SBCSCodec.prototype.decoder = SBCSDecoder; - - -function SBCSEncoder(options, codec) { - this.encodeBuf = codec.encodeBuf; -} - -SBCSEncoder.prototype.write = function(str) { - var buf = Buffer.alloc(str.length); - for (var i = 0; i < str.length; i++) - buf[i] = this.encodeBuf[str.charCodeAt(i)]; - - return buf; -} - -SBCSEncoder.prototype.end = function() { -} - - -function SBCSDecoder(options, codec) { - this.decodeBuf = codec.decodeBuf; -} - -SBCSDecoder.prototype.write = function(buf) { - // Strings are immutable in JS -> we use ucs2 buffer to speed up computations. - var decodeBuf = this.decodeBuf; - var newBuf = Buffer.alloc(buf.length*2); - var idx1 = 0, idx2 = 0; - for (var i = 0; i < buf.length; i++) { - idx1 = buf[i]*2; idx2 = i*2; - newBuf[idx2] = decodeBuf[idx1]; - newBuf[idx2+1] = decodeBuf[idx1+1]; - } - return newBuf.toString('ucs2'); -} - -SBCSDecoder.prototype.end = function() { -} diff --git a/node_modules/iconv-lite/encodings/sbcs-data-generated.js b/node_modules/iconv-lite/encodings/sbcs-data-generated.js deleted file mode 100644 index 9b48236..0000000 --- a/node_modules/iconv-lite/encodings/sbcs-data-generated.js +++ /dev/null @@ -1,451 +0,0 @@ -"use strict"; - -// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script. -module.exports = { - "437": "cp437", - "737": "cp737", - "775": "cp775", - "850": "cp850", - "852": "cp852", - "855": "cp855", - "856": "cp856", - "857": "cp857", - "858": "cp858", - "860": "cp860", - "861": "cp861", - "862": "cp862", - "863": "cp863", - "864": "cp864", - "865": "cp865", - "866": "cp866", - "869": "cp869", - "874": "windows874", - "922": "cp922", - "1046": "cp1046", - "1124": "cp1124", - "1125": "cp1125", - "1129": "cp1129", - "1133": "cp1133", - "1161": "cp1161", - "1162": "cp1162", - "1163": "cp1163", - "1250": "windows1250", - "1251": "windows1251", - "1252": "windows1252", - "1253": "windows1253", - "1254": "windows1254", - "1255": "windows1255", - "1256": "windows1256", - "1257": "windows1257", - "1258": "windows1258", - "28591": "iso88591", - "28592": "iso88592", - "28593": "iso88593", - "28594": "iso88594", - "28595": "iso88595", - "28596": "iso88596", - "28597": "iso88597", - "28598": "iso88598", - "28599": "iso88599", - "28600": "iso885910", - "28601": "iso885911", - "28603": "iso885913", - "28604": "iso885914", - "28605": "iso885915", - "28606": "iso885916", - "windows874": { - "type": "_sbcs", - "chars": "€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" - }, - "win874": "windows874", - "cp874": "windows874", - "windows1250": { - "type": "_sbcs", - "chars": "€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬­®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" - }, - "win1250": "windows1250", - "cp1250": "windows1250", - "windows1251": { - "type": "_sbcs", - "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬­®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" - }, - "win1251": "windows1251", - "cp1251": "windows1251", - "windows1252": { - "type": "_sbcs", - "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" - }, - "win1252": "windows1252", - "cp1252": "windows1252", - "windows1253": { - "type": "_sbcs", - "chars": "€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬­®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" - }, - "win1253": "windows1253", - "cp1253": "windows1253", - "windows1254": { - "type": "_sbcs", - "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖרÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" - }, - "win1254": "windows1254", - "cp1254": "windows1254", - "windows1255": { - "type": "_sbcs", - "chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹֺֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" - }, - "win1255": "windows1255", - "cp1255": "windows1255", - "windows1256": { - "type": "_sbcs", - "chars": "€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œ‌‍ں ،¢£¤¥¦§¨©ھ«¬­®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûü‎‏ے" - }, - "win1256": "windows1256", - "cp1256": "windows1256", - "windows1257": { - "type": "_sbcs", - "chars": "€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬­®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙" - }, - "win1257": "windows1257", - "cp1257": "windows1257", - "windows1258": { - "type": "_sbcs", - "chars": "€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" - }, - "win1258": "windows1258", - "cp1258": "windows1258", - "iso88591": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" - }, - "cp28591": "iso88591", - "iso88592": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" - }, - "cp28592": "iso88592", - "iso88593": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ħ˘£¤�Ĥ§¨İŞĞĴ­�ݰħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙" - }, - "cp28593": "iso88593", - "iso88594": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĸŖ¤Ĩϧ¨ŠĒĢŦ­Ž¯°ą˛ŗ´ĩšēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖרŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙" - }, - "cp28594": "iso88594", - "iso88595": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂЃЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ" - }, - "cp28595": "iso88595", - "iso88596": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ���¤�������،­�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ�������������" - }, - "cp28596": "iso88596", - "iso88597": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ‘’£€₯¦§¨©ͺ«¬­�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" - }, - "cp28597": "iso88597", - "iso88598": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �¢£¤¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" - }, - "cp28598": "iso88598", - "iso88599": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖרÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" - }, - "cp28599": "iso88599", - "iso885910": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĒĢĪĨͧĻĐŠŦŽ­ŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ" - }, - "cp28600": "iso885910", - "iso885911": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" - }, - "cp28601": "iso885911", - "iso885913": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ”¢£¤„¦§Ø©Ŗ«¬­®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’" - }, - "cp28603": "iso885913", - "iso885914": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ­®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ" - }, - "cp28604": "iso885914", - "iso885915": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" - }, - "cp28605": "iso885915", - "iso885916": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄąŁ€„Чš©Ș«Ź­źŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ" - }, - "cp28606": "iso885916", - "cp437": { - "type": "_sbcs", - "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " - }, - "ibm437": "cp437", - "csibm437": "cp437", - "cp737": { - "type": "_sbcs", - "chars": "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ " - }, - "ibm737": "cp737", - "csibm737": "cp737", - "cp775": { - "type": "_sbcs", - "chars": "ĆüéāäģåćłēŖŗīŹÄÅÉæÆōöĢ¢ŚśÖÜø£Ø×¤ĀĪóŻżź”¦©®¬½¼Ł«»░▒▓│┤ĄČĘĖ╣║╗╝ĮŠ┐└┴┬├─┼ŲŪ╚╔╩╦╠═╬Žąčęėįšųūž┘┌█▄▌▐▀ÓßŌŃõÕµńĶķĻļņĒŅ’­±“¾¶§÷„°∙·¹³²■ " - }, - "ibm775": "cp775", - "csibm775": "cp775", - "cp850": { - "type": "_sbcs", - "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " - }, - "ibm850": "cp850", - "csibm850": "cp850", - "cp852": { - "type": "_sbcs", - "chars": "ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘ꬟Ⱥ«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´­˝˛ˇ˘§÷¸°¨˙űŘř■ " - }, - "ibm852": "cp852", - "csibm852": "cp852", - "cp855": { - "type": "_sbcs", - "chars": "ђЂѓЃёЁєЄѕЅіІїЇјЈљЉњЊћЋќЌўЎџЏюЮъЪаАбБцЦдДеЕфФгГ«»░▒▓│┤хХиИ╣║╗╝йЙ┐└┴┬├─┼кК╚╔╩╦╠═╬¤лЛмМнНоОп┘┌█▄Пя▀ЯрРсСтТуУжЖвВьЬ№­ыЫзЗшШэЭщЩчЧ§■ " - }, - "ibm855": "cp855", - "csibm855": "cp855", - "cp856": { - "type": "_sbcs", - "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת�£�×����������®¬½¼�«»░▒▓│┤���©╣║╗╝¢¥┐└┴┬├─┼��╚╔╩╦╠═╬¤���������┘┌█▄¦�▀������µ�������¯´­±‗¾¶§÷¸°¨·¹³²■ " - }, - "ibm856": "cp856", - "csibm856": "cp856", - "cp857": { - "type": "_sbcs", - "chars": "ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞ𿮬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´­±�¾¶§÷¸°¨·¹³²■ " - }, - "ibm857": "cp857", - "csibm857": "cp857", - "cp858": { - "type": "_sbcs", - "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈ€ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " - }, - "ibm858": "cp858", - "csibm858": "cp858", - "cp860": { - "type": "_sbcs", - "chars": "ÇüéâãàÁçêÊèÍÔìÃÂÉÀÈôõòÚùÌÕÜ¢£Ù₧ÓáíóúñѪº¿Ò¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " - }, - "ibm860": "cp860", - "csibm860": "cp860", - "cp861": { - "type": "_sbcs", - "chars": "ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " - }, - "ibm861": "cp861", - "csibm861": "cp861", - "cp862": { - "type": "_sbcs", - "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " - }, - "ibm862": "cp862", - "csibm862": "cp862", - "cp863": { - "type": "_sbcs", - "chars": "ÇüéâÂà¶çêëèïî‗À§ÉÈÊôËÏûù¤ÔÜ¢£ÙÛƒ¦´óú¨¸³¯Î⌐¬½¼¾«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " - }, - "ibm863": "cp863", - "csibm863": "cp863", - "cp864": { - "type": "_sbcs", - "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�" - }, - "ibm864": "cp864", - "csibm864": "cp864", - "cp865": { - "type": "_sbcs", - "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " - }, - "ibm865": "cp865", - "csibm865": "cp865", - "cp866": { - "type": "_sbcs", - "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ " - }, - "ibm866": "cp866", - "csibm866": "cp866", - "cp869": { - "type": "_sbcs", - "chars": "������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ " - }, - "ibm869": "cp869", - "csibm869": "cp869", - "cp922": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖרÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ" - }, - "ibm922": "cp922", - "csibm922": "cp922", - "cp1046": { - "type": "_sbcs", - "chars": "ﺈ×÷ﹱˆ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�" - }, - "ibm1046": "cp1046", - "csibm1046": "cp1046", - "cp1124": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ" - }, - "ibm1124": "cp1124", - "csibm1124": "cp1124", - "cp1125": { - "type": "_sbcs", - "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ " - }, - "ibm1125": "cp1125", - "csibm1125": "cp1125", - "cp1129": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" - }, - "ibm1129": "cp1129", - "csibm1129": "cp1129", - "cp1133": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�" - }, - "ibm1133": "cp1133", - "csibm1133": "cp1133", - "cp1161": { - "type": "_sbcs", - "chars": "��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ " - }, - "ibm1161": "cp1161", - "csibm1161": "cp1161", - "cp1162": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" - }, - "ibm1162": "cp1162", - "csibm1162": "cp1162", - "cp1163": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" - }, - "ibm1163": "cp1163", - "csibm1163": "cp1163", - "maccroatian": { - "type": "_sbcs", - "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊�©⁄¤‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ" - }, - "maccyrillic": { - "type": "_sbcs", - "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" - }, - "macgreek": { - "type": "_sbcs", - "chars": "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦­ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�" - }, - "maciceland": { - "type": "_sbcs", - "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" - }, - "macroman": { - "type": "_sbcs", - "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" - }, - "macromania": { - "type": "_sbcs", - "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" - }, - "macthai": { - "type": "_sbcs", - "chars": "«»…“”�•‘’� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู​–—฿เแโใไๅๆ็่้๊๋์ํ™๏๐๑๒๓๔๕๖๗๘๙®©����" - }, - "macturkish": { - "type": "_sbcs", - "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ" - }, - "macukraine": { - "type": "_sbcs", - "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" - }, - "koi8r": { - "type": "_sbcs", - "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" - }, - "koi8u": { - "type": "_sbcs", - "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґ╝╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪Ґ╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" - }, - "koi8ru": { - "type": "_sbcs", - "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" - }, - "koi8t": { - "type": "_sbcs", - "chars": "қғ‚Ғ„…†‡�‰ҳ‹ҲҷҶ�Қ‘’“”•–—�™�›�����ӯӮё¤ӣ¦§���«¬­®�°±²Ё�Ӣ¶·�№�»���©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" - }, - "armscii8": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �և։)(»«—.՝,-֊…՜՛՞ԱաԲբԳգԴդԵեԶզԷէԸըԹթԺժԻիԼլԽխԾծԿկՀհՁձՂղՃճՄմՅյՆնՇշՈոՉչՊպՋջՌռՍսՎվՏտՐրՑցՒւՓփՔքՕօՖֆ՚�" - }, - "rk1048": { - "type": "_sbcs", - "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊҚҺЏђ‘’“”•–—�™љ›њқһџ ҰұӘ¤Ө¦§Ё©Ғ«¬­®Ү°±Ііөµ¶·ё№ғ»әҢңүАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" - }, - "tcvn": { - "type": "_sbcs", - "chars": "\u0000ÚỤ\u0003ỪỬỮ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010ỨỰỲỶỸÝỴ\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ" - }, - "georgianacademy": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ" - }, - "georgianps": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" - }, - "pt154": { - "type": "_sbcs", - "chars": "ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" - }, - "viscii": { - "type": "_sbcs", - "chars": "\u0000\u0001Ẳ\u0003\u0004ẴẪ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013Ỷ\u0015\u0016\u0017\u0018Ỹ\u001a\u001b\u001c\u001dỴ\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ" - }, - "iso646cn": { - "type": "_sbcs", - "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" - }, - "iso646jp": { - "type": "_sbcs", - "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" - }, - "hproman8": { - "type": "_sbcs", - "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�" - }, - "macintosh": { - "type": "_sbcs", - "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" - }, - "ascii": { - "type": "_sbcs", - "chars": "��������������������������������������������������������������������������������������������������������������������������������" - }, - "tis620": { - "type": "_sbcs", - "chars": "���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" - } -} \ No newline at end of file diff --git a/node_modules/iconv-lite/encodings/sbcs-data.js b/node_modules/iconv-lite/encodings/sbcs-data.js deleted file mode 100644 index fdb81a3..0000000 --- a/node_modules/iconv-lite/encodings/sbcs-data.js +++ /dev/null @@ -1,174 +0,0 @@ -"use strict"; - -// Manually added data to be used by sbcs codec in addition to generated one. - -module.exports = { - // Not supported by iconv, not sure why. - "10029": "maccenteuro", - "maccenteuro": { - "type": "_sbcs", - "chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ" - }, - - "808": "cp808", - "ibm808": "cp808", - "cp808": { - "type": "_sbcs", - "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ " - }, - - "mik": { - "type": "_sbcs", - "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " - }, - - // Aliases of generated encodings. - "ascii8bit": "ascii", - "usascii": "ascii", - "ansix34": "ascii", - "ansix341968": "ascii", - "ansix341986": "ascii", - "csascii": "ascii", - "cp367": "ascii", - "ibm367": "ascii", - "isoir6": "ascii", - "iso646us": "ascii", - "iso646irv": "ascii", - "us": "ascii", - - "latin1": "iso88591", - "latin2": "iso88592", - "latin3": "iso88593", - "latin4": "iso88594", - "latin5": "iso88599", - "latin6": "iso885910", - "latin7": "iso885913", - "latin8": "iso885914", - "latin9": "iso885915", - "latin10": "iso885916", - - "csisolatin1": "iso88591", - "csisolatin2": "iso88592", - "csisolatin3": "iso88593", - "csisolatin4": "iso88594", - "csisolatincyrillic": "iso88595", - "csisolatinarabic": "iso88596", - "csisolatingreek" : "iso88597", - "csisolatinhebrew": "iso88598", - "csisolatin5": "iso88599", - "csisolatin6": "iso885910", - - "l1": "iso88591", - "l2": "iso88592", - "l3": "iso88593", - "l4": "iso88594", - "l5": "iso88599", - "l6": "iso885910", - "l7": "iso885913", - "l8": "iso885914", - "l9": "iso885915", - "l10": "iso885916", - - "isoir14": "iso646jp", - "isoir57": "iso646cn", - "isoir100": "iso88591", - "isoir101": "iso88592", - "isoir109": "iso88593", - "isoir110": "iso88594", - "isoir144": "iso88595", - "isoir127": "iso88596", - "isoir126": "iso88597", - "isoir138": "iso88598", - "isoir148": "iso88599", - "isoir157": "iso885910", - "isoir166": "tis620", - "isoir179": "iso885913", - "isoir199": "iso885914", - "isoir203": "iso885915", - "isoir226": "iso885916", - - "cp819": "iso88591", - "ibm819": "iso88591", - - "cyrillic": "iso88595", - - "arabic": "iso88596", - "arabic8": "iso88596", - "ecma114": "iso88596", - "asmo708": "iso88596", - - "greek" : "iso88597", - "greek8" : "iso88597", - "ecma118" : "iso88597", - "elot928" : "iso88597", - - "hebrew": "iso88598", - "hebrew8": "iso88598", - - "turkish": "iso88599", - "turkish8": "iso88599", - - "thai": "iso885911", - "thai8": "iso885911", - - "celtic": "iso885914", - "celtic8": "iso885914", - "isoceltic": "iso885914", - - "tis6200": "tis620", - "tis62025291": "tis620", - "tis62025330": "tis620", - - "10000": "macroman", - "10006": "macgreek", - "10007": "maccyrillic", - "10079": "maciceland", - "10081": "macturkish", - - "cspc8codepage437": "cp437", - "cspc775baltic": "cp775", - "cspc850multilingual": "cp850", - "cspcp852": "cp852", - "cspc862latinhebrew": "cp862", - "cpgr": "cp869", - - "msee": "cp1250", - "mscyrl": "cp1251", - "msansi": "cp1252", - "msgreek": "cp1253", - "msturk": "cp1254", - "mshebr": "cp1255", - "msarab": "cp1256", - "winbaltrim": "cp1257", - - "cp20866": "koi8r", - "20866": "koi8r", - "ibm878": "koi8r", - "cskoi8r": "koi8r", - - "cp21866": "koi8u", - "21866": "koi8u", - "ibm1168": "koi8u", - - "strk10482002": "rk1048", - - "tcvn5712": "tcvn", - "tcvn57121": "tcvn", - - "gb198880": "iso646cn", - "cn": "iso646cn", - - "csiso14jisc6220ro": "iso646jp", - "jisc62201969ro": "iso646jp", - "jp": "iso646jp", - - "cshproman8": "hproman8", - "r8": "hproman8", - "roman8": "hproman8", - "xroman8": "hproman8", - "ibm1051": "hproman8", - - "mac": "macintosh", - "csmacintosh": "macintosh", -}; - diff --git a/node_modules/iconv-lite/encodings/tables/big5-added.json b/node_modules/iconv-lite/encodings/tables/big5-added.json deleted file mode 100644 index 3c3d3c2..0000000 --- a/node_modules/iconv-lite/encodings/tables/big5-added.json +++ /dev/null @@ -1,122 +0,0 @@ -[ -["8740","䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻"], -["8767","綕夝𨮹㷴霴𧯯寛𡵞媤㘥𩺰嫑宷峼杮薓𩥅瑡璝㡵𡵓𣚞𦀡㻬"], -["87a1","𥣞㫵竼龗𤅡𨤍𣇪𠪊𣉞䌊蒄龖鐯䤰蘓墖靊鈘秐稲晠権袝瑌篅枂稬剏遆㓦珄𥶹瓆鿇垳䤯呌䄱𣚎堘穲𧭥讏䚮𦺈䆁𥶙箮𢒼鿈𢓁𢓉𢓌鿉蔄𣖻䂴鿊䓡𪷿拁灮鿋"], -["8840","㇀",4,"𠄌㇅𠃑𠃍㇆㇇𠃋𡿨㇈𠃊㇉㇊㇋㇌𠄎㇍㇎ĀÁǍÀĒÉĚÈŌÓǑÒ࿿Ê̄Ế࿿Ê̌ỀÊāáǎàɑēéěèīíǐìōóǒòūúǔùǖǘǚ"], -["88a1","ǜü࿿ê̄ế࿿ê̌ềêɡ⏚⏛"], -["8940","𪎩𡅅"], -["8943","攊"], -["8946","丽滝鵎釟"], -["894c","𧜵撑会伨侨兖兴农凤务动医华发变团声处备夲头学实実岚庆总斉柾栄桥济炼电纤纬纺织经统缆缷艺苏药视设询车轧轮"], -["89a1","琑糼緍楆竉刧"], -["89ab","醌碸酞肼"], -["89b0","贋胶𠧧"], -["89b5","肟黇䳍鷉鸌䰾𩷶𧀎鸊𪄳㗁"], -["89c1","溚舾甙"], -["89c5","䤑马骏龙禇𨑬𡷊𠗐𢫦两亁亀亇亿仫伷㑌侽㹈倃傈㑽㒓㒥円夅凛凼刅争剹劐匧㗇厩㕑厰㕓参吣㕭㕲㚁咓咣咴咹哐哯唘唣唨㖘唿㖥㖿嗗㗅"], -["8a40","𧶄唥"], -["8a43","𠱂𠴕𥄫喐𢳆㧬𠍁蹆𤶸𩓥䁓𨂾睺𢰸㨴䟕𨅝𦧲𤷪擝𠵼𠾴𠳕𡃴撍蹾𠺖𠰋𠽤𢲩𨉖𤓓"], -["8a64","𠵆𩩍𨃩䟴𤺧𢳂骲㩧𩗴㿭㔆𥋇𩟔𧣈𢵄鵮頕"], -["8a76","䏙𦂥撴哣𢵌𢯊𡁷㧻𡁯"], -["8aa1","𦛚𦜖𧦠擪𥁒𠱃蹨𢆡𨭌𠜱"], -["8aac","䠋𠆩㿺塳𢶍"], -["8ab2","𤗈𠓼𦂗𠽌𠶖啹䂻䎺"], -["8abb","䪴𢩦𡂝膪飵𠶜捹㧾𢝵跀嚡摼㹃"], -["8ac9","𪘁𠸉𢫏𢳉"], -["8ace","𡃈𣧂㦒㨆𨊛㕸𥹉𢃇噒𠼱𢲲𩜠㒼氽𤸻"], -["8adf","𧕴𢺋𢈈𪙛𨳍𠹺𠰴𦠜羓𡃏𢠃𢤹㗻𥇣𠺌𠾍𠺪㾓𠼰𠵇𡅏𠹌"], -["8af6","𠺫𠮩𠵈𡃀𡄽㿹𢚖搲𠾭"], -["8b40","𣏴𧘹𢯎𠵾𠵿𢱑𢱕㨘𠺘𡃇𠼮𪘲𦭐𨳒𨶙𨳊閪哌苄喹"], -["8b55","𩻃鰦骶𧝞𢷮煀腭胬尜𦕲脴㞗卟𨂽醶𠻺𠸏𠹷𠻻㗝𤷫㘉𠳖嚯𢞵𡃉𠸐𠹸𡁸𡅈𨈇𡑕𠹹𤹐𢶤婔𡀝𡀞𡃵𡃶垜𠸑"], -["8ba1","𧚔𨋍𠾵𠹻𥅾㜃𠾶𡆀𥋘𪊽𤧚𡠺𤅷𨉼墙剨㘚𥜽箲孨䠀䬬鼧䧧鰟鮍𥭴𣄽嗻㗲嚉丨夂𡯁屮靑𠂆乛亻㔾尣彑忄㣺扌攵歺氵氺灬爫丬犭𤣩罒礻糹罓𦉪㓁"], -["8bde","𦍋耂肀𦘒𦥑卝衤见𧢲讠贝钅镸长门𨸏韦页风飞饣𩠐鱼鸟黄歯龜丷𠂇阝户钢"], -["8c40","倻淾𩱳龦㷉袏𤅎灷峵䬠𥇍㕙𥴰愢𨨲辧釶熑朙玺𣊁𪄇㲋𡦀䬐磤琂冮𨜏䀉橣𪊺䈣蘏𠩯稪𩥇𨫪靕灍匤𢁾鏴盙𨧣龧矝亣俰傼丯众龨吴綋墒壐𡶶庒庙忂𢜒斋"], -["8ca1","𣏹椙橃𣱣泿"], -["8ca7","爀𤔅玌㻛𤨓嬕璹讃𥲤𥚕窓篬糃繬苸薗龩袐龪躹龫迏蕟駠鈡龬𨶹𡐿䁱䊢娚"], -["8cc9","顨杫䉶圽"], -["8cce","藖𤥻芿𧄍䲁𦵴嵻𦬕𦾾龭龮宖龯曧繛湗秊㶈䓃𣉖𢞖䎚䔶"], -["8ce6","峕𣬚諹屸㴒𣕑嵸龲煗䕘𤃬𡸣䱷㥸㑊𠆤𦱁諌侴𠈹妿腬顖𩣺弻"], -["8d40","𠮟"], -["8d42","𢇁𨥭䄂䚻𩁹㼇龳𪆵䃸㟖䛷𦱆䅼𨚲𧏿䕭㣔𥒚䕡䔛䶉䱻䵶䗪㿈𤬏㙡䓞䒽䇭崾嵈嵖㷼㠏嶤嶹㠠㠸幂庽弥徃㤈㤔㤿㥍惗愽峥㦉憷憹懏㦸戬抐拥挘㧸嚱"], -["8da1","㨃揢揻搇摚㩋擀崕嘡龟㪗斆㪽旿晓㫲暒㬢朖㭂枤栀㭘桊梄㭲㭱㭻椉楃牜楤榟榅㮼槖㯝橥橴橱檂㯬檙㯲檫檵櫔櫶殁毁毪汵沪㳋洂洆洦涁㳯涤涱渕渘温溆𨧀溻滢滚齿滨滩漤漴㵆𣽁澁澾㵪㵵熷岙㶊瀬㶑灐灔灯灿炉𠌥䏁㗱𠻘"], -["8e40","𣻗垾𦻓焾𥟠㙎榢𨯩孴穉𥣡𩓙穥穽𥦬窻窰竂竃燑𦒍䇊竚竝竪䇯咲𥰁笋筕笩𥌎𥳾箢筯莜𥮴𦱿篐萡箒箸𥴠㶭𥱥蒒篺簆簵𥳁籄粃𤢂粦晽𤕸糉糇糦籴糳糵糎"], -["8ea1","繧䔝𦹄絝𦻖璍綉綫焵綳緒𤁗𦀩緤㴓緵𡟹緥𨍭縝𦄡𦅚繮纒䌫鑬縧罀罁罇礶𦋐駡羗𦍑羣𡙡𠁨䕜𣝦䔃𨌺翺𦒉者耈耝耨耯𪂇𦳃耻耼聡𢜔䦉𦘦𣷣𦛨朥肧𨩈脇脚墰𢛶汿𦒘𤾸擧𡒊舘𡡞橓𤩥𤪕䑺舩𠬍𦩒𣵾俹𡓽蓢荢𦬊𤦧𣔰𡝳𣷸芪椛芳䇛"], -["8f40","蕋苐茚𠸖𡞴㛁𣅽𣕚艻苢茘𣺋𦶣𦬅𦮗𣗎㶿茝嗬莅䔋𦶥莬菁菓㑾𦻔橗蕚㒖𦹂𢻯葘𥯤葱㷓䓤檧葊𣲵祘蒨𦮖𦹷𦹃蓞萏莑䒠蒓蓤𥲑䉀𥳀䕃蔴嫲𦺙䔧蕳䔖枿蘖"], -["8fa1","𨘥𨘻藁𧂈蘂𡖂𧃍䕫䕪蘨㙈𡢢号𧎚虾蝱𪃸蟮𢰧螱蟚蠏噡虬桖䘏衅衆𧗠𣶹𧗤衞袜䙛袴袵揁装睷𧜏覇覊覦覩覧覼𨨥觧𧤤𧪽誜瞓釾誐𧩙竩𧬺𣾏䜓𧬸煼謌謟𥐰𥕥謿譌譍誩𤩺讐讛誯𡛟䘕衏貛𧵔𧶏貫㜥𧵓賖𧶘𧶽贒贃𡤐賛灜贑𤳉㻐起"], -["9040","趩𨀂𡀔𤦊㭼𨆼𧄌竧躭躶軃鋔輙輭𨍥𨐒辥錃𪊟𠩐辳䤪𨧞𨔽𣶻廸𣉢迹𪀔𨚼𨔁𢌥㦀𦻗逷𨔼𧪾遡𨕬𨘋邨𨜓郄𨛦邮都酧㫰醩釄粬𨤳𡺉鈎沟鉁鉢𥖹銹𨫆𣲛𨬌𥗛"], -["90a1","𠴱錬鍫𨫡𨯫炏嫃𨫢𨫥䥥鉄𨯬𨰹𨯿鍳鑛躼閅閦鐦閠濶䊹𢙺𨛘𡉼𣸮䧟氜陻隖䅬隣𦻕懚隶磵𨫠隽双䦡𦲸𠉴𦐐𩂯𩃥𤫑𡤕𣌊霱虂霶䨏䔽䖅𤫩灵孁霛靜𩇕靗孊𩇫靟鐥僐𣂷𣂼鞉鞟鞱鞾韀韒韠𥑬韮琜𩐳響韵𩐝𧥺䫑頴頳顋顦㬎𧅵㵑𠘰𤅜"], -["9140","𥜆飊颷飈飇䫿𦴧𡛓喰飡飦飬鍸餹𤨩䭲𩡗𩤅駵騌騻騐驘𥜥㛄𩂱𩯕髠髢𩬅髴䰎鬔鬭𨘀倴鬴𦦨㣃𣁽魐魀𩴾婅𡡣鮎𤉋鰂鯿鰌𩹨鷔𩾷𪆒𪆫𪃡𪄣𪇟鵾鶃𪄴鸎梈"], -["91a1","鷄𢅛𪆓𪈠𡤻𪈳鴹𪂹𪊴麐麕麞麢䴴麪麯𤍤黁㭠㧥㴝伲㞾𨰫鼂鼈䮖鐤𦶢鼗鼖鼹嚟嚊齅馸𩂋韲葿齢齩竜龎爖䮾𤥵𤦻煷𤧸𤍈𤩑玞𨯚𡣺禟𨥾𨸶鍩鏳𨩄鋬鎁鏋𨥬𤒹爗㻫睲穃烐𤑳𤏸煾𡟯炣𡢾𣖙㻇𡢅𥐯𡟸㜢𡛻𡠹㛡𡝴𡣑𥽋㜣𡛀坛𤨥𡏾𡊨"], -["9240","𡏆𡒶蔃𣚦蔃葕𤦔𧅥𣸱𥕜𣻻𧁒䓴𣛮𩦝𦼦柹㜳㰕㷧塬𡤢栐䁗𣜿𤃡𤂋𤄏𦰡哋嚞𦚱嚒𠿟𠮨𠸍鏆𨬓鎜仸儫㠙𤐶亼𠑥𠍿佋侊𥙑婨𠆫𠏋㦙𠌊𠐔㐵伩𠋀𨺳𠉵諚𠈌亘"], -["92a1","働儍侢伃𤨎𣺊佂倮偬傁俌俥偘僼兙兛兝兞湶𣖕𣸹𣺿浲𡢄𣺉冨凃𠗠䓝𠒣𠒒𠒑赺𨪜𠜎剙劤𠡳勡鍮䙺熌𤎌𠰠𤦬𡃤槑𠸝瑹㻞璙琔瑖玘䮎𤪼𤂍叐㖄爏𤃉喴𠍅响𠯆圝鉝雴鍦埝垍坿㘾壋媙𨩆𡛺𡝯𡜐娬妸銏婾嫏娒𥥆𡧳𡡡𤊕㛵洅瑃娡𥺃"], -["9340","媁𨯗𠐓鏠璌𡌃焅䥲鐈𨧻鎽㞠尞岞幞幈𡦖𡥼𣫮廍孏𡤃𡤄㜁𡢠㛝𡛾㛓脪𨩇𡶺𣑲𨦨弌弎𡤧𡞫婫𡜻孄蘔𧗽衠恾𢡠𢘫忛㺸𢖯𢖾𩂈𦽳懀𠀾𠁆𢘛憙憘恵𢲛𢴇𤛔𩅍"], -["93a1","摱𤙥𢭪㨩𢬢𣑐𩣪𢹸挷𪑛撶挱揑𤧣𢵧护𢲡搻敫楲㯴𣂎𣊭𤦉𣊫唍𣋠𡣙𩐿曎𣊉𣆳㫠䆐𥖄𨬢𥖏𡛼𥕛𥐥磮𣄃𡠪𣈴㑤𣈏𣆂𤋉暎𦴤晫䮓昰𧡰𡷫晣𣋒𣋡昞𥡲㣑𣠺𣞼㮙𣞢𣏾瓐㮖枏𤘪梶栞㯄檾㡣𣟕𤒇樳橒櫉欅𡤒攑梘橌㯗橺歗𣿀𣲚鎠鋲𨯪𨫋"], -["9440","銉𨀞𨧜鑧涥漋𤧬浧𣽿㶏渄𤀼娽渊塇洤硂焻𤌚𤉶烱牐犇犔𤞏𤜥兹𤪤𠗫瑺𣻸𣙟𤩊𤤗𥿡㼆㺱𤫟𨰣𣼵悧㻳瓌琼鎇琷䒟𦷪䕑疃㽣𤳙𤴆㽘畕癳𪗆㬙瑨𨫌𤦫𤦎㫻"], -["94a1","㷍𤩎㻿𤧅𤣳釺圲鍂𨫣𡡤僟𥈡𥇧睸𣈲眎眏睻𤚗𣞁㩞𤣰琸璛㺿𤪺𤫇䃈𤪖𦆮錇𥖁砞碍碈磒珐祙𧝁𥛣䄎禛蒖禥樭𣻺稺秴䅮𡛦䄲鈵秱𠵌𤦌𠊙𣶺𡝮㖗啫㕰㚪𠇔𠰍竢婙𢛵𥪯𥪜娍𠉛磰娪𥯆竾䇹籝籭䈑𥮳𥺼𥺦糍𤧹𡞰粎籼粮檲緜縇緓罎𦉡"], -["9540","𦅜𧭈綗𥺂䉪𦭵𠤖柖𠁎𣗏埄𦐒𦏸𤥢翝笧𠠬𥫩𥵃笌𥸎駦虅驣樜𣐿㧢𤧷𦖭騟𦖠蒀𧄧𦳑䓪脷䐂胆脉腂𦞴飃𦩂艢艥𦩑葓𦶧蘐𧈛媆䅿𡡀嬫𡢡嫤𡣘蚠蜨𣶏蠭𧐢娂"], -["95a1","衮佅袇袿裦襥襍𥚃襔𧞅𧞄𨯵𨯙𨮜𨧹㺭蒣䛵䛏㟲訽訜𩑈彍鈫𤊄旔焩烄𡡅鵭貟賩𧷜妚矃姰䍮㛔踪躧𤰉輰轊䋴汘澻𢌡䢛潹溋𡟚鯩㚵𤤯邻邗啱䤆醻鐄𨩋䁢𨫼鐧𨰝𨰻蓥訫閙閧閗閖𨴴瑅㻂𤣿𤩂𤏪㻧𣈥随𨻧𨹦𨹥㻌𤧭𤩸𣿮琒瑫㻼靁𩂰"], -["9640","桇䨝𩂓𥟟靝鍨𨦉𨰦𨬯𦎾銺嬑譩䤼珹𤈛鞛靱餸𠼦巁𨯅𤪲頟𩓚鋶𩗗釥䓀𨭐𤩧𨭤飜𨩅㼀鈪䤥萔餻饍𧬆㷽馛䭯馪驜𨭥𥣈檏騡嫾騯𩣱䮐𩥈馼䮽䮗鍽塲𡌂堢𤦸"], -["96a1","𡓨硄𢜟𣶸棅㵽鑘㤧慐𢞁𢥫愇鱏鱓鱻鰵鰐魿鯏𩸭鮟𪇵𪃾鴡䲮𤄄鸘䲰鴌𪆴𪃭𪃳𩤯鶥蒽𦸒𦿟𦮂藼䔳𦶤𦺄𦷰萠藮𦸀𣟗𦁤秢𣖜𣙀䤭𤧞㵢鏛銾鍈𠊿碹鉷鑍俤㑀遤𥕝砽硔碶硋𡝗𣇉𤥁㚚佲濚濙瀞瀞吔𤆵垻壳垊鴖埗焴㒯𤆬燫𦱀𤾗嬨𡞵𨩉"], -["9740","愌嫎娋䊼𤒈㜬䭻𨧼鎻鎸𡣖𠼝葲𦳀𡐓𤋺𢰦𤏁妔𣶷𦝁綨𦅛𦂤𤦹𤦋𨧺鋥珢㻩璴𨭣𡢟㻡𤪳櫘珳珻㻖𤨾𤪔𡟙𤩦𠎧𡐤𤧥瑈𤤖炥𤥶銄珦鍟𠓾錱𨫎𨨖鎆𨯧𥗕䤵𨪂煫"], -["97a1","𤥃𠳿嚤𠘚𠯫𠲸唂秄𡟺緾𡛂𤩐𡡒䔮鐁㜊𨫀𤦭妰𡢿𡢃𧒄媡㛢𣵛㚰鉟婹𨪁𡡢鍴㳍𠪴䪖㦊僴㵩㵌𡎜煵䋻𨈘渏𩃤䓫浗𧹏灧沯㳖𣿭𣸭渂漌㵯𠏵畑㚼㓈䚀㻚䡱姄鉮䤾轁𨰜𦯀堒埈㛖𡑒烾𤍢𤩱𢿣𡊰𢎽梹楧𡎘𣓥𧯴𣛟𨪃𣟖𣏺𤲟樚𣚭𦲷萾䓟䓎"], -["9840","𦴦𦵑𦲂𦿞漗𧄉茽𡜺菭𦲀𧁓𡟛妉媂𡞳婡婱𡤅𤇼㜭姯𡜼㛇熎鎐暚𤊥婮娫𤊓樫𣻹𧜶𤑛𤋊焝𤉙𨧡侰𦴨峂𤓎𧹍𤎽樌𤉖𡌄炦焳𤏩㶥泟勇𤩏繥姫崯㷳彜𤩝𡟟綤萦"], -["98a1","咅𣫺𣌀𠈔坾𠣕𠘙㿥𡾞𪊶瀃𩅛嵰玏糓𨩙𩐠俈翧狍猐𧫴猸猹𥛶獁獈㺩𧬘遬燵𤣲珡臶㻊県㻑沢国琙琞琟㻢㻰㻴㻺瓓㼎㽓畂畭畲疍㽼痈痜㿀癍㿗癴㿜発𤽜熈嘣覀塩䀝睃䀹条䁅㗛瞘䁪䁯属瞾矋売砘点砜䂨砹硇硑硦葈𥔵礳栃礲䄃"], -["9940","䄉禑禙辻稆込䅧窑䆲窼艹䇄竏竛䇏両筢筬筻簒簛䉠䉺类粜䊌粸䊔糭输烀𠳏総緔緐緽羮羴犟䎗耠耥笹耮耱联㷌垴炠肷胩䏭脌猪脎脒畠脔䐁㬹腖腙腚"], -["99a1","䐓堺腼膄䐥膓䐭膥埯臁臤艔䒏芦艶苊苘苿䒰荗险榊萅烵葤惣蒈䔄蒾蓡蓸蔐蔸蕒䔻蕯蕰藠䕷虲蚒蚲蛯际螋䘆䘗袮裿褤襇覑𧥧訩訸誔誴豑賔賲贜䞘塟跃䟭仮踺嗘坔蹱嗵躰䠷軎転軤軭軲辷迁迊迌逳駄䢭飠鈓䤞鈨鉘鉫銱銮銿"], -["9a40","鋣鋫鋳鋴鋽鍃鎄鎭䥅䥑麿鐗匁鐝鐭鐾䥪鑔鑹锭関䦧间阳䧥枠䨤靀䨵鞲韂噔䫤惨颹䬙飱塄餎餙冴餜餷饂饝饢䭰駅䮝騼鬏窃魩鮁鯝鯱鯴䱭鰠㝯𡯂鵉鰺"], -["9aa1","黾噐鶓鶽鷀鷼银辶鹻麬麱麽黆铜黢黱黸竈齄𠂔𠊷𠎠椚铃妬𠓗塀铁㞹𠗕𠘕𠙶𡚺块煳𠫂𠫍𠮿呪吆𠯋咞𠯻𠰻𠱓𠱥𠱼惧𠲍噺𠲵𠳝𠳭𠵯𠶲𠷈楕鰯螥𠸄𠸎𠻗𠾐𠼭𠹳尠𠾼帋𡁜𡁏𡁶朞𡁻𡂈𡂖㙇𡂿𡃓𡄯𡄻卤蒭𡋣𡍵𡌶讁𡕷𡘙𡟃𡟇乸炻𡠭𡥪"], -["9b40","𡨭𡩅𡰪𡱰𡲬𡻈拃𡻕𡼕熘桕𢁅槩㛈𢉼𢏗𢏺𢜪𢡱𢥏苽𢥧𢦓𢫕覥𢫨辠𢬎鞸𢬿顇骽𢱌"], -["9b62","𢲈𢲷𥯨𢴈𢴒𢶷𢶕𢹂𢽴𢿌𣀳𣁦𣌟𣏞徱晈暿𧩹𣕧𣗳爁𤦺矗𣘚𣜖纇𠍆墵朎"], -["9ba1","椘𣪧𧙗𥿢𣸑𣺹𧗾𢂚䣐䪸𤄙𨪚𤋮𤌍𤀻𤌴𤎖𤩅𠗊凒𠘑妟𡺨㮾𣳿𤐄𤓖垈𤙴㦛𤜯𨗨𩧉㝢𢇃譞𨭎駖𤠒𤣻𤨕爉𤫀𠱸奥𤺥𤾆𠝹軚𥀬劏圿煱𥊙𥐙𣽊𤪧喼𥑆𥑮𦭒釔㑳𥔿𧘲𥕞䜘𥕢𥕦𥟇𤤿𥡝偦㓻𣏌惞𥤃䝼𨥈𥪮𥮉𥰆𡶐垡煑澶𦄂𧰒遖𦆲𤾚譢𦐂𦑊"], -["9c40","嵛𦯷輶𦒄𡤜諪𤧶𦒈𣿯𦔒䯀𦖿𦚵𢜛鑥𥟡憕娧晉侻嚹𤔡𦛼乪𤤴陖涏𦲽㘘襷𦞙𦡮𦐑𦡞營𦣇筂𩃀𠨑𦤦鄄𦤹穅鷰𦧺騦𦨭㙟𦑩𠀡禃𦨴𦭛崬𣔙菏𦮝䛐𦲤画补𦶮墶"], -["9ca1","㜜𢖍𧁋𧇍㱔𧊀𧊅銁𢅺𧊋錰𧋦𤧐氹钟𧑐𠻸蠧裵𢤦𨑳𡞱溸𤨪𡠠㦤㚹尐秣䔿暶𩲭𩢤襃𧟌𧡘囖䃟𡘊㦡𣜯𨃨𡏅熭荦𧧝𩆨婧䲷𧂯𨦫𧧽𧨊𧬋𧵦𤅺筃祾𨀉澵𪋟樃𨌘厢𦸇鎿栶靝𨅯𨀣𦦵𡏭𣈯𨁈嶅𨰰𨂃圕頣𨥉嶫𤦈斾槕叒𤪥𣾁㰑朶𨂐𨃴𨄮𡾡𨅏"], -["9d40","𨆉𨆯𨈚𨌆𨌯𨎊㗊𨑨𨚪䣺揦𨥖砈鉕𨦸䏲𨧧䏟𨧨𨭆𨯔姸𨰉輋𨿅𩃬筑𩄐𩄼㷷𩅞𤫊运犏嚋𩓧𩗩𩖰𩖸𩜲𩣑𩥉𩥪𩧃𩨨𩬎𩵚𩶛纟𩻸𩼣䲤镇𪊓熢𪋿䶑递𪗋䶜𠲜达嗁"], -["9da1","辺𢒰边𤪓䔉繿潖檱仪㓤𨬬𧢝㜺躀𡟵𨀤𨭬𨮙𧨾𦚯㷫𧙕𣲷𥘵𥥖亚𥺁𦉘嚿𠹭踎孭𣺈𤲞揞拐𡟶𡡻攰嘭𥱊吚𥌑㷆𩶘䱽嘢嘞罉𥻘奵𣵀蝰东𠿪𠵉𣚺脗鵞贘瘻鱅癎瞹鍅吲腈苷嘥脲萘肽嗪祢噃吖𠺝㗎嘅嗱曱𨋢㘭甴嗰喺咗啲𠱁𠲖廐𥅈𠹶𢱢"], -["9e40","𠺢麫絚嗞𡁵抝靭咔賍燶酶揼掹揾啩𢭃鱲𢺳冚㓟𠶧冧呍唞唓癦踭𦢊疱肶蠄螆裇膶萜𡃁䓬猄𤜆宐茋𦢓噻𢛴𧴯𤆣𧵳𦻐𧊶酰𡇙鈈𣳼𪚩𠺬𠻹牦𡲢䝎𤿂𧿹𠿫䃺"], -["9ea1","鱝攟𢶠䣳𤟠𩵼𠿬𠸊恢𧖣𠿭"], -["9ead","𦁈𡆇熣纎鵐业丄㕷嬍沲卧㚬㧜卽㚥𤘘墚𤭮舭呋垪𥪕𠥹"], -["9ec5","㩒𢑥獴𩺬䴉鯭𣳾𩼰䱛𤾩𩖞𩿞葜𣶶𧊲𦞳𣜠挮紥𣻷𣸬㨪逈勌㹴㙺䗩𠒎癀嫰𠺶硺𧼮墧䂿噼鮋嵴癔𪐴麅䳡痹㟻愙𣃚𤏲"], -["9ef5","噝𡊩垧𤥣𩸆刴𧂮㖭汊鵼"], -["9f40","籖鬹埞𡝬屓擓𩓐𦌵𧅤蚭𠴨𦴢𤫢𠵱"], -["9f4f","凾𡼏嶎霃𡷑麁遌笟鬂峑箣扨挵髿篏鬪籾鬮籂粆鰕篼鬉鼗鰛𤤾齚啳寃俽麘俲剠㸆勑坧偖妷帒韈鶫轜呩鞴饀鞺匬愰"], -["9fa1","椬叚鰊鴂䰻陁榀傦畆𡝭駚剳"], -["9fae","酙隁酜"], -["9fb2","酑𨺗捿𦴣櫊嘑醎畺抅𠏼獏籰𥰡𣳽"], -["9fc1","𤤙盖鮝个𠳔莾衂"], -["9fc9","届槀僭坺刟巵从氱𠇲伹咜哚劚趂㗾弌㗳"], -["9fdb","歒酼龥鮗頮颴骺麨麄煺笔"], -["9fe7","毺蠘罸"], -["9feb","嘠𪙊蹷齓"], -["9ff0","跔蹏鸜踁抂𨍽踨蹵竓𤩷稾磘泪詧瘇"], -["a040","𨩚鼦泎蟖痃𪊲硓咢贌狢獱謭猂瓱賫𤪻蘯徺袠䒷"], -["a055","𡠻𦸅"], -["a058","詾𢔛"], -["a05b","惽癧髗鵄鍮鮏蟵"], -["a063","蠏賷猬霡鮰㗖犲䰇籑饊𦅙慙䰄麖慽"], -["a073","坟慯抦戹拎㩜懢厪𣏵捤栂㗒"], -["a0a1","嵗𨯂迚𨸹"], -["a0a6","僙𡵆礆匲阸𠼻䁥"], -["a0ae","矾"], -["a0b0","糂𥼚糚稭聦聣絍甅瓲覔舚朌聢𧒆聛瓰脃眤覉𦟌畓𦻑螩蟎臈螌詉貭譃眫瓸蓚㘵榲趦"], -["a0d4","覩瑨涹蟁𤀑瓧㷛煶悤憜㳑煢恷"], -["a0e2","罱𨬭牐惩䭾删㰘𣳇𥻗𧙖𥔱𡥄𡋾𩤃𦷜𧂭峁𦆭𨨏𣙷𠃮𦡆𤼎䕢嬟𦍌齐麦𦉫"], -["a3c0","␀",31,"␡"], -["c6a1","①",9,"⑴",9,"ⅰ",9,"丶丿亅亠冂冖冫勹匸卩厶夊宀巛⼳广廴彐彡攴无疒癶辵隶¨ˆヽヾゝゞ〃仝々〆〇ー[]✽ぁ",23], -["c740","す",58,"ァアィイ"], -["c7a1","ゥ",81,"А",5,"ЁЖ",4], -["c840","Л",26,"ёж",25,"⇧↸↹㇏𠃌乚𠂊刂䒑"], -["c8a1","龰冈龱𧘇"], -["c8cd","¬¦'"㈱№℡゛゜⺀⺄⺆⺇⺈⺊⺌⺍⺕⺜⺝⺥⺧⺪⺬⺮⺶⺼⺾⻆⻊⻌⻍⻏⻖⻗⻞⻣"], -["c8f5","ʃɐɛɔɵœøŋʊɪ"], -["f9fe","■"], -["fa40","𠕇鋛𠗟𣿅蕌䊵珯况㙉𤥂𨧤鍄𡧛苮𣳈砼杄拟𤤳𨦪𠊠𦮳𡌅侫𢓭倈𦴩𧪄𣘀𤪱𢔓倩𠍾徤𠎀𠍇滛𠐟偽儁㑺儎顬㝃萖𤦤𠒇兠𣎴兪𠯿𢃼𠋥𢔰𠖎𣈳𡦃宂蝽𠖳𣲙冲冸"], -["faa1","鴴凉减凑㳜凓𤪦决凢卂凭菍椾𣜭彻刋刦刼劵剗劔効勅簕蕂勠蘍𦬓包𨫞啉滙𣾀𠥔𣿬匳卄𠯢泋𡜦栛珕恊㺪㣌𡛨燝䒢卭却𨚫卾卿𡖖𡘓矦厓𨪛厠厫厮玧𥝲㽙玜叁叅汉义埾叙㪫𠮏叠𣿫𢶣叶𠱷吓灹唫晗浛呭𦭓𠵴啝咏咤䞦𡜍𠻝㶴𠵍"], -["fb40","𨦼𢚘啇䳭启琗喆喩嘅𡣗𤀺䕒𤐵暳𡂴嘷曍𣊊暤暭噍噏磱囱鞇叾圀囯园𨭦㘣𡉏坆𤆥汮炋坂㚱𦱾埦𡐖堃𡑔𤍣堦𤯵塜墪㕡壠壜𡈼壻寿坃𪅐𤉸鏓㖡够梦㛃湙"], -["fba1","𡘾娤啓𡚒蔅姉𠵎𦲁𦴪𡟜姙𡟻𡞲𦶦浱𡠨𡛕姹𦹅媫婣㛦𤦩婷㜈媖瑥嫓𦾡𢕔㶅𡤑㜲𡚸広勐孶斈孼𧨎䀄䡝𠈄寕慠𡨴𥧌𠖥寳宝䴐尅𡭄尓珎尔𡲥𦬨屉䣝岅峩峯嶋𡷹𡸷崐崘嵆𡺤岺巗苼㠭𤤁𢁉𢅳芇㠶㯂帮檊幵幺𤒼𠳓厦亷廐厨𡝱帉廴𨒂"], -["fc40","廹廻㢠廼栾鐛弍𠇁弢㫞䢮𡌺强𦢈𢏐彘𢑱彣鞽𦹮彲鍀𨨶徧嶶㵟𥉐𡽪𧃸𢙨釖𠊞𨨩怱暅𡡷㥣㷇㘹垐𢞴祱㹀悞悤悳𤦂𤦏𧩓璤僡媠慤萤慂慈𦻒憁凴𠙖憇宪𣾷"], -["fca1","𢡟懓𨮝𩥝懐㤲𢦀𢣁怣慜攞掋𠄘担𡝰拕𢸍捬𤧟㨗搸揸𡎎𡟼撐澊𢸶頔𤂌𥜝擡擥鑻㩦携㩗敍漖𤨨𤨣斅敭敟𣁾斵𤥀䬷旑䃘𡠩无旣忟𣐀昘𣇷𣇸晄𣆤𣆥晋𠹵晧𥇦晳晴𡸽𣈱𨗴𣇈𥌓矅𢣷馤朂𤎜𤨡㬫槺𣟂杞杧杢𤇍𩃭柗䓩栢湐鈼栁𣏦𦶠桝"], -["fd40","𣑯槡樋𨫟楳棃𣗍椁椀㴲㨁𣘼㮀枬楡𨩊䋼椶榘㮡𠏉荣傐槹𣙙𢄪橅𣜃檝㯳枱櫈𩆜㰍欝𠤣惞欵歴𢟍溵𣫛𠎵𡥘㝀吡𣭚毡𣻼毜氷𢒋𤣱𦭑汚舦汹𣶼䓅𣶽𤆤𤤌𤤀"], -["fda1","𣳉㛥㳫𠴲鮃𣇹𢒑羏样𦴥𦶡𦷫涖浜湼漄𤥿𤂅𦹲蔳𦽴凇沜渝萮𨬡港𣸯瑓𣾂秌湏媑𣁋濸㜍澝𣸰滺𡒗𤀽䕕鏰潄潜㵎潴𩅰㴻澟𤅄濓𤂑𤅕𤀹𣿰𣾴𤄿凟𤅖𤅗𤅀𦇝灋灾炧炁烌烕烖烟䄄㷨熴熖𤉷焫煅媈煊煮岜𤍥煏鍢𤋁焬𤑚𤨧𤨢熺𨯨炽爎"], -["fe40","鑂爕夑鑃爤鍁𥘅爮牀𤥴梽牕牗㹕𣁄栍漽犂猪猫𤠣𨠫䣭𨠄猨献珏玪𠰺𦨮珉瑉𤇢𡛧𤨤昣㛅𤦷𤦍𤧻珷琕椃𤨦琹𠗃㻗瑜𢢭瑠𨺲瑇珤瑶莹瑬㜰瑴鏱樬璂䥓𤪌"], -["fea1","𤅟𤩹𨮏孆𨰃𡢞瓈𡦈甎瓩甞𨻙𡩋寗𨺬鎅畍畊畧畮𤾂㼄𤴓疎瑝疞疴瘂瘬癑癏癯癶𦏵皐臯㟸𦤑𦤎皡皥皷盌𦾟葢𥂝𥅽𡸜眞眦着撯𥈠睘𣊬瞯𨥤𨥨𡛁矴砉𡍶𤨒棊碯磇磓隥礮𥗠磗礴碱𧘌辸袄𨬫𦂃𢘜禆褀椂禀𥡗禝𧬹礼禩渪𧄦㺨秆𩄍秔"] -] diff --git a/node_modules/iconv-lite/encodings/tables/cp936.json b/node_modules/iconv-lite/encodings/tables/cp936.json deleted file mode 100644 index 49ddb9a..0000000 --- a/node_modules/iconv-lite/encodings/tables/cp936.json +++ /dev/null @@ -1,264 +0,0 @@ -[ -["0","\u0000",127,"€"], -["8140","丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱丳丵丷丼乀乁乂乄乆乊乑乕乗乚乛乢乣乤乥乧乨乪",5,"乲乴",9,"乿",6,"亇亊"], -["8180","亐亖亗亙亜亝亞亣亪亯亰亱亴亶亷亸亹亼亽亾仈仌仏仐仒仚仛仜仠仢仦仧仩仭仮仯仱仴仸仹仺仼仾伀伂",6,"伋伌伒",4,"伜伝伡伣伨伩伬伭伮伱伳伵伷伹伻伾",4,"佄佅佇",5,"佒佔佖佡佢佦佨佪佫佭佮佱佲併佷佸佹佺佽侀侁侂侅來侇侊侌侎侐侒侓侕侖侘侙侚侜侞侟価侢"], -["8240","侤侫侭侰",4,"侶",8,"俀俁係俆俇俈俉俋俌俍俒",4,"俙俛俠俢俤俥俧俫俬俰俲俴俵俶俷俹俻俼俽俿",11], -["8280","個倎倐們倓倕倖倗倛倝倞倠倢倣値倧倫倯",10,"倻倽倿偀偁偂偄偅偆偉偊偋偍偐",4,"偖偗偘偙偛偝",7,"偦",5,"偭",8,"偸偹偺偼偽傁傂傃傄傆傇傉傊傋傌傎",20,"傤傦傪傫傭",4,"傳",6,"傼"], -["8340","傽",17,"僐",5,"僗僘僙僛",10,"僨僩僪僫僯僰僱僲僴僶",4,"僼",9,"儈"], -["8380","儉儊儌",5,"儓",13,"儢",28,"兂兇兊兌兎兏児兒兓兗兘兙兛兝",4,"兣兤兦內兩兪兯兲兺兾兿冃冄円冇冊冋冎冏冐冑冓冔冘冚冝冞冟冡冣冦",4,"冭冮冴冸冹冺冾冿凁凂凃凅凈凊凍凎凐凒",5], -["8440","凘凙凚凜凞凟凢凣凥",5,"凬凮凱凲凴凷凾刄刅刉刋刌刏刐刓刔刕刜刞刟刡刢刣別刦刧刪刬刯刱刲刴刵刼刾剄",5,"剋剎剏剒剓剕剗剘"], -["8480","剙剚剛剝剟剠剢剣剤剦剨剫剬剭剮剰剱剳",9,"剾劀劃",4,"劉",6,"劑劒劔",6,"劜劤劥劦劧劮劯劰労",9,"勀勁勂勄勅勆勈勊勌勍勎勏勑勓勔動勗務",5,"勠勡勢勣勥",10,"勱",7,"勻勼勽匁匂匃匄匇匉匊匋匌匎"], -["8540","匑匒匓匔匘匛匜匞匟匢匤匥匧匨匩匫匬匭匯",9,"匼匽區卂卄卆卋卌卍卐協単卙卛卝卥卨卪卬卭卲卶卹卻卼卽卾厀厁厃厇厈厊厎厏"], -["8580","厐",4,"厖厗厙厛厜厞厠厡厤厧厪厫厬厭厯",6,"厷厸厹厺厼厽厾叀參",4,"収叏叐叒叓叕叚叜叝叞叡叢叧叴叺叾叿吀吂吅吇吋吔吘吙吚吜吢吤吥吪吰吳吶吷吺吽吿呁呂呄呅呇呉呌呍呎呏呑呚呝",4,"呣呥呧呩",7,"呴呹呺呾呿咁咃咅咇咈咉咊咍咑咓咗咘咜咞咟咠咡"], -["8640","咢咥咮咰咲咵咶咷咹咺咼咾哃哅哊哋哖哘哛哠",4,"哫哬哯哰哱哴",5,"哻哾唀唂唃唄唅唈唊",4,"唒唓唕",5,"唜唝唞唟唡唥唦"], -["8680","唨唩唫唭唲唴唵唶唸唹唺唻唽啀啂啅啇啈啋",4,"啑啒啓啔啗",4,"啝啞啟啠啢啣啨啩啫啯",5,"啹啺啽啿喅喆喌喍喎喐喒喓喕喖喗喚喛喞喠",6,"喨",8,"喲喴営喸喺喼喿",4,"嗆嗇嗈嗊嗋嗎嗏嗐嗕嗗",4,"嗞嗠嗢嗧嗩嗭嗮嗰嗱嗴嗶嗸",4,"嗿嘂嘃嘄嘅"], -["8740","嘆嘇嘊嘋嘍嘐",7,"嘙嘚嘜嘝嘠嘡嘢嘥嘦嘨嘩嘪嘫嘮嘯嘰嘳嘵嘷嘸嘺嘼嘽嘾噀",11,"噏",4,"噕噖噚噛噝",4], -["8780","噣噥噦噧噭噮噯噰噲噳噴噵噷噸噹噺噽",7,"嚇",6,"嚐嚑嚒嚔",14,"嚤",10,"嚰",6,"嚸嚹嚺嚻嚽",12,"囋",8,"囕囖囘囙囜団囥",5,"囬囮囯囲図囶囷囸囻囼圀圁圂圅圇國",6], -["8840","園",9,"圝圞圠圡圢圤圥圦圧圫圱圲圴",4,"圼圽圿坁坃坄坅坆坈坉坋坒",4,"坘坙坢坣坥坧坬坮坰坱坲坴坵坸坹坺坽坾坿垀"], -["8880","垁垇垈垉垊垍",4,"垔",6,"垜垝垞垟垥垨垪垬垯垰垱垳垵垶垷垹",8,"埄",6,"埌埍埐埑埓埖埗埛埜埞埡埢埣埥",7,"埮埰埱埲埳埵埶執埻埼埾埿堁堃堄堅堈堉堊堌堎堏堐堒堓堔堖堗堘堚堛堜堝堟堢堣堥",4,"堫",4,"報堲堳場堶",7], -["8940","堾",5,"塅",6,"塎塏塐塒塓塕塖塗塙",4,"塟",5,"塦",4,"塭",16,"塿墂墄墆墇墈墊墋墌"], -["8980","墍",4,"墔",4,"墛墜墝墠",7,"墪",17,"墽墾墿壀壂壃壄壆",10,"壒壓壔壖",13,"壥",5,"壭壯壱売壴壵壷壸壺",7,"夃夅夆夈",4,"夎夐夑夒夓夗夘夛夝夞夠夡夢夣夦夨夬夰夲夳夵夶夻"], -["8a40","夽夾夿奀奃奅奆奊奌奍奐奒奓奙奛",4,"奡奣奤奦",12,"奵奷奺奻奼奾奿妀妅妉妋妌妎妏妐妑妔妕妘妚妛妜妝妟妠妡妢妦"], -["8a80","妧妬妭妰妱妳",5,"妺妼妽妿",6,"姇姈姉姌姍姎姏姕姖姙姛姞",4,"姤姦姧姩姪姫姭",11,"姺姼姽姾娀娂娊娋娍娎娏娐娒娔娕娖娗娙娚娛娝娞娡娢娤娦娧娨娪",6,"娳娵娷",4,"娽娾娿婁",4,"婇婈婋",9,"婖婗婘婙婛",5], -["8b40","婡婣婤婥婦婨婩婫",8,"婸婹婻婼婽婾媀",17,"媓",6,"媜",13,"媫媬"], -["8b80","媭",4,"媴媶媷媹",4,"媿嫀嫃",5,"嫊嫋嫍",4,"嫓嫕嫗嫙嫚嫛嫝嫞嫟嫢嫤嫥嫧嫨嫪嫬",4,"嫲",22,"嬊",11,"嬘",25,"嬳嬵嬶嬸",7,"孁",6], -["8c40","孈",7,"孒孖孞孠孡孧孨孫孭孮孯孲孴孶孷學孹孻孼孾孿宂宆宊宍宎宐宑宒宔宖実宧宨宩宬宭宮宯宱宲宷宺宻宼寀寁寃寈寉寊寋寍寎寏"], -["8c80","寑寔",8,"寠寢寣實寧審",4,"寯寱",6,"寽対尀専尃尅將專尋尌對導尐尒尓尗尙尛尞尟尠尡尣尦尨尩尪尫尭尮尯尰尲尳尵尶尷屃屄屆屇屌屍屒屓屔屖屗屘屚屛屜屝屟屢層屧",6,"屰屲",6,"屻屼屽屾岀岃",4,"岉岊岋岎岏岒岓岕岝",4,"岤",4], -["8d40","岪岮岯岰岲岴岶岹岺岻岼岾峀峂峃峅",5,"峌",5,"峓",5,"峚",6,"峢峣峧峩峫峬峮峯峱",9,"峼",4], -["8d80","崁崄崅崈",5,"崏",4,"崕崗崘崙崚崜崝崟",4,"崥崨崪崫崬崯",4,"崵",7,"崿",7,"嵈嵉嵍",10,"嵙嵚嵜嵞",10,"嵪嵭嵮嵰嵱嵲嵳嵵",12,"嶃",21,"嶚嶛嶜嶞嶟嶠"], -["8e40","嶡",21,"嶸",12,"巆",6,"巎",12,"巜巟巠巣巤巪巬巭"], -["8e80","巰巵巶巸",4,"巿帀帄帇帉帊帋帍帎帒帓帗帞",7,"帨",4,"帯帰帲",4,"帹帺帾帿幀幁幃幆",5,"幍",6,"幖",4,"幜幝幟幠幣",14,"幵幷幹幾庁庂広庅庈庉庌庍庎庒庘庛庝庡庢庣庤庨",4,"庮",4,"庴庺庻庼庽庿",6], -["8f40","廆廇廈廋",5,"廔廕廗廘廙廚廜",11,"廩廫",8,"廵廸廹廻廼廽弅弆弇弉弌弍弎弐弒弔弖弙弚弜弝弞弡弢弣弤"], -["8f80","弨弫弬弮弰弲",6,"弻弽弾弿彁",14,"彑彔彙彚彛彜彞彟彠彣彥彧彨彫彮彯彲彴彵彶彸彺彽彾彿徃徆徍徎徏徑従徔徖徚徛徝從徟徠徢",5,"復徫徬徯",5,"徶徸徹徺徻徾",4,"忇忈忊忋忎忓忔忕忚忛応忞忟忢忣忥忦忨忩忬忯忰忲忳忴忶忷忹忺忼怇"], -["9040","怈怉怋怌怐怑怓怗怘怚怞怟怢怣怤怬怭怮怰",4,"怶",4,"怽怾恀恄",6,"恌恎恏恑恓恔恖恗恘恛恜恞恟恠恡恥恦恮恱恲恴恵恷恾悀"], -["9080","悁悂悅悆悇悈悊悋悎悏悐悑悓悕悗悘悙悜悞悡悢悤悥悧悩悪悮悰悳悵悶悷悹悺悽",7,"惇惈惉惌",4,"惒惓惔惖惗惙惛惞惡",4,"惪惱惲惵惷惸惻",4,"愂愃愄愅愇愊愋愌愐",4,"愖愗愘愙愛愜愝愞愡愢愥愨愩愪愬",18,"慀",6], -["9140","慇慉態慍慏慐慒慓慔慖",6,"慞慟慠慡慣慤慥慦慩",6,"慱慲慳慴慶慸",18,"憌憍憏",4,"憕"], -["9180","憖",6,"憞",8,"憪憫憭",9,"憸",5,"憿懀懁懃",4,"應懌",4,"懓懕",16,"懧",13,"懶",8,"戀",5,"戇戉戓戔戙戜戝戞戠戣戦戧戨戩戫戭戯戰戱戲戵戶戸",4,"扂扄扅扆扊"], -["9240","扏扐払扖扗扙扚扜",6,"扤扥扨扱扲扴扵扷扸扺扻扽抁抂抃抅抆抇抈抋",5,"抔抙抜抝択抣抦抧抩抪抭抮抯抰抲抳抴抶抷抸抺抾拀拁"], -["9280","拃拋拏拑拕拝拞拠拡拤拪拫拰拲拵拸拹拺拻挀挃挄挅挆挊挋挌挍挏挐挒挓挔挕挗挘挙挜挦挧挩挬挭挮挰挱挳",5,"挻挼挾挿捀捁捄捇捈捊捑捒捓捔捖",7,"捠捤捥捦捨捪捫捬捯捰捲捳捴捵捸捹捼捽捾捿掁掃掄掅掆掋掍掑掓掔掕掗掙",6,"採掤掦掫掯掱掲掵掶掹掻掽掿揀"], -["9340","揁揂揃揅揇揈揊揋揌揑揓揔揕揗",6,"揟揢揤",4,"揫揬揮揯揰揱揳揵揷揹揺揻揼揾搃搄搆",4,"損搎搑搒搕",5,"搝搟搢搣搤"], -["9380","搥搧搨搩搫搮",5,"搵",4,"搻搼搾摀摂摃摉摋",6,"摓摕摖摗摙",4,"摟",7,"摨摪摫摬摮",9,"摻",6,"撃撆撈",8,"撓撔撗撘撚撛撜撝撟",4,"撥撦撧撨撪撫撯撱撲撳撴撶撹撻撽撾撿擁擃擄擆",6,"擏擑擓擔擕擖擙據"], -["9440","擛擜擝擟擠擡擣擥擧",24,"攁",7,"攊",7,"攓",4,"攙",8], -["9480","攢攣攤攦",4,"攬攭攰攱攲攳攷攺攼攽敀",4,"敆敇敊敋敍敎敐敒敓敔敗敘敚敜敟敠敡敤敥敧敨敩敪敭敮敯敱敳敵敶數",14,"斈斉斊斍斎斏斒斔斕斖斘斚斝斞斠斢斣斦斨斪斬斮斱",7,"斺斻斾斿旀旂旇旈旉旊旍旐旑旓旔旕旘",7,"旡旣旤旪旫"], -["9540","旲旳旴旵旸旹旻",4,"昁昄昅昇昈昉昋昍昐昑昒昖昗昘昚昛昜昞昡昢昣昤昦昩昪昫昬昮昰昲昳昷",4,"昽昿晀時晄",6,"晍晎晐晑晘"], -["9580","晙晛晜晝晞晠晢晣晥晧晩",4,"晱晲晳晵晸晹晻晼晽晿暀暁暃暅暆暈暉暊暋暍暎暏暐暒暓暔暕暘",4,"暞",8,"暩",4,"暯",4,"暵暶暷暸暺暻暼暽暿",25,"曚曞",7,"曧曨曪",5,"曱曵曶書曺曻曽朁朂會"], -["9640","朄朅朆朇朌朎朏朑朒朓朖朘朙朚朜朞朠",5,"朧朩朮朰朲朳朶朷朸朹朻朼朾朿杁杄杅杇杊杋杍杒杔杕杗",4,"杝杢杣杤杦杧杫杬杮東杴杶"], -["9680","杸杹杺杻杽枀枂枃枅枆枈枊枌枍枎枏枑枒枓枔枖枙枛枟枠枡枤枦枩枬枮枱枲枴枹",7,"柂柅",9,"柕柖柗柛柟柡柣柤柦柧柨柪柫柭柮柲柵",7,"柾栁栂栃栄栆栍栐栒栔栕栘",4,"栞栟栠栢",6,"栫",6,"栴栵栶栺栻栿桇桋桍桏桒桖",5], -["9740","桜桝桞桟桪桬",7,"桵桸",8,"梂梄梇",7,"梐梑梒梔梕梖梘",9,"梣梤梥梩梪梫梬梮梱梲梴梶梷梸"], -["9780","梹",6,"棁棃",5,"棊棌棎棏棐棑棓棔棖棗棙棛",4,"棡棢棤",9,"棯棲棳棴棶棷棸棻棽棾棿椀椂椃椄椆",4,"椌椏椑椓",11,"椡椢椣椥",7,"椮椯椱椲椳椵椶椷椸椺椻椼椾楀楁楃",16,"楕楖楘楙楛楜楟"], -["9840","楡楢楤楥楧楨楩楪楬業楯楰楲",4,"楺楻楽楾楿榁榃榅榊榋榌榎",5,"榖榗榙榚榝",9,"榩榪榬榮榯榰榲榳榵榶榸榹榺榼榽"], -["9880","榾榿槀槂",7,"構槍槏槑槒槓槕",5,"槜槝槞槡",11,"槮槯槰槱槳",9,"槾樀",9,"樋",11,"標",5,"樠樢",5,"権樫樬樭樮樰樲樳樴樶",6,"樿",4,"橅橆橈",7,"橑",6,"橚"], -["9940","橜",4,"橢橣橤橦",10,"橲",6,"橺橻橽橾橿檁檂檃檅",8,"檏檒",4,"檘",7,"檡",5], -["9980","檧檨檪檭",114,"欥欦欨",6], -["9a40","欯欰欱欳欴欵欶欸欻欼欽欿歀歁歂歄歅歈歊歋歍",11,"歚",7,"歨歩歫",13,"歺歽歾歿殀殅殈"], -["9a80","殌殎殏殐殑殔殕殗殘殙殜",4,"殢",7,"殫",7,"殶殸",6,"毀毃毄毆",4,"毌毎毐毑毘毚毜",4,"毢",7,"毬毭毮毰毱毲毴毶毷毸毺毻毼毾",6,"氈",4,"氎氒気氜氝氞氠氣氥氫氬氭氱氳氶氷氹氺氻氼氾氿汃汄汅汈汋",4,"汑汒汓汖汘"], -["9b40","汙汚汢汣汥汦汧汫",4,"汱汳汵汷汸決汻汼汿沀沄沇沊沋沍沎沑沒沕沖沗沘沚沜沝沞沠沢沨沬沯沰沴沵沶沷沺泀況泂泃泆泇泈泋泍泎泏泑泒泘"], -["9b80","泙泚泜泝泟泤泦泧泩泬泭泲泴泹泿洀洂洃洅洆洈洉洊洍洏洐洑洓洔洕洖洘洜洝洟",5,"洦洨洩洬洭洯洰洴洶洷洸洺洿浀浂浄浉浌浐浕浖浗浘浛浝浟浡浢浤浥浧浨浫浬浭浰浱浲浳浵浶浹浺浻浽",4,"涃涄涆涇涊涋涍涏涐涒涖",4,"涜涢涥涬涭涰涱涳涴涶涷涹",5,"淁淂淃淈淉淊"], -["9c40","淍淎淏淐淒淓淔淕淗淚淛淜淟淢淣淥淧淨淩淪淭淯淰淲淴淵淶淸淺淽",7,"渆渇済渉渋渏渒渓渕渘渙減渜渞渟渢渦渧渨渪測渮渰渱渳渵"], -["9c80","渶渷渹渻",7,"湅",7,"湏湐湑湒湕湗湙湚湜湝湞湠",10,"湬湭湯",14,"満溁溂溄溇溈溊",4,"溑",6,"溙溚溛溝溞溠溡溣溤溦溨溩溫溬溭溮溰溳溵溸溹溼溾溿滀滃滄滅滆滈滉滊滌滍滎滐滒滖滘滙滛滜滝滣滧滪",5], -["9d40","滰滱滲滳滵滶滷滸滺",7,"漃漄漅漇漈漊",4,"漐漑漒漖",9,"漡漢漣漥漦漧漨漬漮漰漲漴漵漷",6,"漿潀潁潂"], -["9d80","潃潄潅潈潉潊潌潎",9,"潙潚潛潝潟潠潡潣潤潥潧",5,"潯潰潱潳潵潶潷潹潻潽",6,"澅澆澇澊澋澏",12,"澝澞澟澠澢",4,"澨",10,"澴澵澷澸澺",5,"濁濃",5,"濊",6,"濓",10,"濟濢濣濤濥"], -["9e40","濦",7,"濰",32,"瀒",7,"瀜",6,"瀤",6], -["9e80","瀫",9,"瀶瀷瀸瀺",17,"灍灎灐",13,"灟",11,"灮灱灲灳灴灷灹灺灻災炁炂炃炄炆炇炈炋炌炍炏炐炑炓炗炘炚炛炞",12,"炰炲炴炵炶為炾炿烄烅烆烇烉烋",12,"烚"], -["9f40","烜烝烞烠烡烢烣烥烪烮烰",6,"烸烺烻烼烾",10,"焋",4,"焑焒焔焗焛",10,"焧",7,"焲焳焴"], -["9f80","焵焷",13,"煆煇煈煉煋煍煏",12,"煝煟",4,"煥煩",4,"煯煰煱煴煵煶煷煹煻煼煾",5,"熅",4,"熋熌熍熎熐熑熒熓熕熖熗熚",4,"熡",6,"熩熪熫熭",5,"熴熶熷熸熺",8,"燄",9,"燏",4], -["a040","燖",9,"燡燢燣燤燦燨",5,"燯",9,"燺",11,"爇",19], -["a080","爛爜爞",9,"爩爫爭爮爯爲爳爴爺爼爾牀",6,"牉牊牋牎牏牐牑牓牔牕牗牘牚牜牞牠牣牤牥牨牪牫牬牭牰牱牳牴牶牷牸牻牼牽犂犃犅",4,"犌犎犐犑犓",11,"犠",11,"犮犱犲犳犵犺",6,"狅狆狇狉狊狋狌狏狑狓狔狕狖狘狚狛"], -["a1a1"," 、。·ˉˇ¨〃々—~‖…‘’“”〔〕〈",7,"〖〗【】±×÷∶∧∨∑∏∪∩∈∷√⊥∥∠⌒⊙∫∮≡≌≈∽∝≠≮≯≤≥∞∵∴♂♀°′″℃$¤¢£‰§№☆★○●◎◇◆□■△▲※→←↑↓〓"], -["a2a1","ⅰ",9], -["a2b1","⒈",19,"⑴",19,"①",9], -["a2e5","㈠",9], -["a2f1","Ⅰ",11], -["a3a1","!"#¥%",88," ̄"], -["a4a1","ぁ",82], -["a5a1","ァ",85], -["a6a1","Α",16,"Σ",6], -["a6c1","α",16,"σ",6], -["a6e0","︵︶︹︺︿﹀︽︾﹁﹂﹃﹄"], -["a6ee","︻︼︷︸︱"], -["a6f4","︳︴"], -["a7a1","А",5,"ЁЖ",25], -["a7d1","а",5,"ёж",25], -["a840","ˊˋ˙–―‥‵℅℉↖↗↘↙∕∟∣≒≦≧⊿═",35,"▁",6], -["a880","█",7,"▓▔▕▼▽◢◣◤◥☉⊕〒〝〞"], -["a8a1","āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜüêɑ"], -["a8bd","ńň"], -["a8c0","ɡ"], -["a8c5","ㄅ",36], -["a940","〡",8,"㊣㎎㎏㎜㎝㎞㎡㏄㏎㏑㏒㏕︰¬¦"], -["a959","℡㈱"], -["a95c","‐"], -["a960","ー゛゜ヽヾ〆ゝゞ﹉",9,"﹔﹕﹖﹗﹙",8], -["a980","﹢",4,"﹨﹩﹪﹫"], -["a996","〇"], -["a9a4","─",75], -["aa40","狜狝狟狢",5,"狪狫狵狶狹狽狾狿猀猂猄",5,"猋猌猍猏猐猑猒猔猘猙猚猟猠猣猤猦猧猨猭猯猰猲猳猵猶猺猻猼猽獀",8], -["aa80","獉獊獋獌獎獏獑獓獔獕獖獘",7,"獡",10,"獮獰獱"], -["ab40","獲",11,"獿",4,"玅玆玈玊玌玍玏玐玒玓玔玕玗玘玙玚玜玝玞玠玡玣",5,"玪玬玭玱玴玵玶玸玹玼玽玾玿珁珃",4], -["ab80","珋珌珎珒",6,"珚珛珜珝珟珡珢珣珤珦珨珪珫珬珮珯珰珱珳",4], -["ac40","珸",10,"琄琇琈琋琌琍琎琑",8,"琜",5,"琣琤琧琩琫琭琯琱琲琷",4,"琽琾琿瑀瑂",11], -["ac80","瑎",6,"瑖瑘瑝瑠",12,"瑮瑯瑱",4,"瑸瑹瑺"], -["ad40","瑻瑼瑽瑿璂璄璅璆璈璉璊璌璍璏璑",10,"璝璟",7,"璪",15,"璻",12], -["ad80","瓈",9,"瓓",8,"瓝瓟瓡瓥瓧",6,"瓰瓱瓲"], -["ae40","瓳瓵瓸",6,"甀甁甂甃甅",7,"甎甐甒甔甕甖甗甛甝甞甠",4,"甦甧甪甮甴甶甹甼甽甿畁畂畃畄畆畇畉畊畍畐畑畒畓畕畖畗畘"], -["ae80","畝",7,"畧畨畩畫",6,"畳畵當畷畺",4,"疀疁疂疄疅疇"], -["af40","疈疉疊疌疍疎疐疓疕疘疛疜疞疢疦",4,"疭疶疷疺疻疿痀痁痆痋痌痎痏痐痑痓痗痙痚痜痝痟痠痡痥痩痬痭痮痯痲痳痵痶痷痸痺痻痽痾瘂瘄瘆瘇"], -["af80","瘈瘉瘋瘍瘎瘏瘑瘒瘓瘔瘖瘚瘜瘝瘞瘡瘣瘧瘨瘬瘮瘯瘱瘲瘶瘷瘹瘺瘻瘽癁療癄"], -["b040","癅",6,"癎",5,"癕癗",4,"癝癟癠癡癢癤",6,"癬癭癮癰",7,"癹発發癿皀皁皃皅皉皊皌皍皏皐皒皔皕皗皘皚皛"], -["b080","皜",7,"皥",8,"皯皰皳皵",9,"盀盁盃啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞包褒剥"], -["b140","盄盇盉盋盌盓盕盙盚盜盝盞盠",4,"盦",7,"盰盳盵盶盷盺盻盽盿眀眂眃眅眆眊県眎",10,"眛眜眝眞眡眣眤眥眧眪眫"], -["b180","眬眮眰",4,"眹眻眽眾眿睂睄睅睆睈",7,"睒",7,"睜薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳"], -["b240","睝睞睟睠睤睧睩睪睭",11,"睺睻睼瞁瞂瞃瞆",5,"瞏瞐瞓",11,"瞡瞣瞤瞦瞨瞫瞭瞮瞯瞱瞲瞴瞶",4], -["b280","瞼瞾矀",12,"矎",8,"矘矙矚矝",4,"矤病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖"], -["b340","矦矨矪矯矰矱矲矴矵矷矹矺矻矼砃",5,"砊砋砎砏砐砓砕砙砛砞砠砡砢砤砨砪砫砮砯砱砲砳砵砶砽砿硁硂硃硄硆硈硉硊硋硍硏硑硓硔硘硙硚"], -["b380","硛硜硞",11,"硯",7,"硸硹硺硻硽",6,"场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚"], -["b440","碄碅碆碈碊碋碏碐碒碔碕碖碙碝碞碠碢碤碦碨",7,"碵碶碷碸確碻碼碽碿磀磂磃磄磆磇磈磌磍磎磏磑磒磓磖磗磘磚",9], -["b480","磤磥磦磧磩磪磫磭",4,"磳磵磶磸磹磻",5,"礂礃礄礆",6,"础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮"], -["b540","礍",5,"礔",9,"礟",4,"礥",14,"礵",4,"礽礿祂祃祄祅祇祊",8,"祔祕祘祙祡祣"], -["b580","祤祦祩祪祫祬祮祰",6,"祹祻",4,"禂禃禆禇禈禉禋禌禍禎禐禑禒怠耽担丹单郸掸胆旦氮但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟蝶迭谍叠"], -["b640","禓",6,"禛",11,"禨",10,"禴",4,"禼禿秂秄秅秇秈秊秌秎秏秐秓秔秖秗秙",5,"秠秡秢秥秨秪"], -["b680","秬秮秱",6,"秹秺秼秾秿稁稄稅稇稈稉稊稌稏",4,"稕稖稘稙稛稜丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二"], -["b740","稝稟稡稢稤",14,"稴稵稶稸稺稾穀",5,"穇",9,"穒",4,"穘",16], -["b780","穩",6,"穱穲穳穵穻穼穽穾窂窅窇窉窊窋窌窎窏窐窓窔窙窚窛窞窡窢贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服"], -["b840","窣窤窧窩窪窫窮",4,"窴",10,"竀",10,"竌",9,"竗竘竚竛竜竝竡竢竤竧",5,"竮竰竱竲竳"], -["b880","竴",4,"竻竼竾笀笁笂笅笇笉笌笍笎笐笒笓笖笗笘笚笜笝笟笡笢笣笧笩笭浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹"], -["b940","笯笰笲笴笵笶笷笹笻笽笿",5,"筆筈筊筍筎筓筕筗筙筜筞筟筡筣",10,"筯筰筳筴筶筸筺筼筽筿箁箂箃箄箆",6,"箎箏"], -["b980","箑箒箓箖箘箙箚箛箞箟箠箣箤箥箮箯箰箲箳箵箶箷箹",7,"篂篃範埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈"], -["ba40","篅篈築篊篋篍篎篏篐篒篔",4,"篛篜篞篟篠篢篣篤篧篨篩篫篬篭篯篰篲",4,"篸篹篺篻篽篿",7,"簈簉簊簍簎簐",5,"簗簘簙"], -["ba80","簚",4,"簠",5,"簨簩簫",12,"簹",5,"籂骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖"], -["bb40","籃",9,"籎",36,"籵",5,"籾",9], -["bb80","粈粊",6,"粓粔粖粙粚粛粠粡粣粦粧粨粩粫粬粭粯粰粴",4,"粺粻弧虎唬护互沪户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸击圾基机畸稽积箕"], -["bc40","粿糀糂糃糄糆糉糋糎",6,"糘糚糛糝糞糡",6,"糩",5,"糰",7,"糹糺糼",13,"紋",5], -["bc80","紑",14,"紡紣紤紥紦紨紩紪紬紭紮細",6,"肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件"], -["bd40","紷",54,"絯",7], -["bd80","絸",32,"健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸"], -["be40","継",12,"綧",6,"綯",42], -["be80","線",32,"尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻"], -["bf40","緻",62], -["bf80","縺縼",4,"繂",4,"繈",21,"俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀"], -["c040","繞",35,"纃",23,"纜纝纞"], -["c080","纮纴纻纼绖绤绬绹缊缐缞缷缹缻",6,"罃罆",9,"罒罓馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐"], -["c140","罖罙罛罜罝罞罠罣",4,"罫罬罭罯罰罳罵罶罷罸罺罻罼罽罿羀羂",7,"羋羍羏",4,"羕",4,"羛羜羠羢羣羥羦羨",6,"羱"], -["c180","羳",4,"羺羻羾翀翂翃翄翆翇翈翉翋翍翏",4,"翖翗翙",5,"翢翣痢立粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫馏留刘瘤流柳六龙聋咙笼窿"], -["c240","翤翧翨翪翫翬翭翯翲翴",6,"翽翾翿耂耇耈耉耊耎耏耑耓耚耛耝耞耟耡耣耤耫",5,"耲耴耹耺耼耾聀聁聄聅聇聈聉聎聏聐聑聓聕聖聗"], -["c280","聙聛",13,"聫",5,"聲",11,"隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫"], -["c340","聾肁肂肅肈肊肍",5,"肔肕肗肙肞肣肦肧肨肬肰肳肵肶肸肹肻胅胇",4,"胏",6,"胘胟胠胢胣胦胮胵胷胹胻胾胿脀脁脃脄脅脇脈脋"], -["c380","脌脕脗脙脛脜脝脟",12,"脭脮脰脳脴脵脷脹",4,"脿谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸"], -["c440","腀",5,"腇腉腍腎腏腒腖腗腘腛",4,"腡腢腣腤腦腨腪腫腬腯腲腳腵腶腷腸膁膃",4,"膉膋膌膍膎膐膒",5,"膙膚膞",4,"膤膥"], -["c480","膧膩膫",7,"膴",5,"膼膽膾膿臄臅臇臈臉臋臍",6,"摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁"], -["c540","臔",14,"臤臥臦臨臩臫臮",4,"臵",5,"臽臿舃與",4,"舎舏舑舓舕",5,"舝舠舤舥舦舧舩舮舲舺舼舽舿"], -["c580","艀艁艂艃艅艆艈艊艌艍艎艐",7,"艙艛艜艝艞艠",7,"艩拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗"], -["c640","艪艫艬艭艱艵艶艷艸艻艼芀芁芃芅芆芇芉芌芐芓芔芕芖芚芛芞芠芢芣芧芲芵芶芺芻芼芿苀苂苃苅苆苉苐苖苙苚苝苢苧苨苩苪苬苭苮苰苲苳苵苶苸"], -["c680","苺苼",4,"茊茋茍茐茒茓茖茘茙茝",9,"茩茪茮茰茲茷茻茽啤脾疲皮匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫掐"], -["c740","茾茿荁荂荄荅荈荊",4,"荓荕",4,"荝荢荰",6,"荹荺荾",6,"莇莈莊莋莌莍莏莐莑莔莕莖莗莙莚莝莟莡",6,"莬莭莮"], -["c780","莯莵莻莾莿菂菃菄菆菈菉菋菍菎菐菑菒菓菕菗菙菚菛菞菢菣菤菦菧菨菫菬菭恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠"], -["c840","菮華菳",4,"菺菻菼菾菿萀萂萅萇萈萉萊萐萒",5,"萙萚萛萞",5,"萩",7,"萲",5,"萹萺萻萾",7,"葇葈葉"], -["c880","葊",6,"葒",4,"葘葝葞葟葠葢葤",4,"葪葮葯葰葲葴葷葹葻葼取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁"], -["c940","葽",4,"蒃蒄蒅蒆蒊蒍蒏",7,"蒘蒚蒛蒝蒞蒟蒠蒢",12,"蒰蒱蒳蒵蒶蒷蒻蒼蒾蓀蓂蓃蓅蓆蓇蓈蓋蓌蓎蓏蓒蓔蓕蓗"], -["c980","蓘",4,"蓞蓡蓢蓤蓧",4,"蓭蓮蓯蓱",10,"蓽蓾蔀蔁蔂伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳"], -["ca40","蔃",8,"蔍蔎蔏蔐蔒蔔蔕蔖蔘蔙蔛蔜蔝蔞蔠蔢",8,"蔭",9,"蔾",4,"蕄蕅蕆蕇蕋",10], -["ca80","蕗蕘蕚蕛蕜蕝蕟",4,"蕥蕦蕧蕩",8,"蕳蕵蕶蕷蕸蕼蕽蕿薀薁省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱"], -["cb40","薂薃薆薈",6,"薐",10,"薝",6,"薥薦薧薩薫薬薭薱",5,"薸薺",6,"藂",6,"藊",4,"藑藒"], -["cb80","藔藖",5,"藝",6,"藥藦藧藨藪",14,"恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔"], -["cc40","藹藺藼藽藾蘀",4,"蘆",10,"蘒蘓蘔蘕蘗",15,"蘨蘪",13,"蘹蘺蘻蘽蘾蘿虀"], -["cc80","虁",11,"虒虓處",4,"虛虜虝號虠虡虣",7,"獭挞蹋踏胎苔抬台泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳贴铁帖厅听烃"], -["cd40","虭虯虰虲",6,"蚃",6,"蚎",4,"蚔蚖",5,"蚞",4,"蚥蚦蚫蚭蚮蚲蚳蚷蚸蚹蚻",4,"蛁蛂蛃蛅蛈蛌蛍蛒蛓蛕蛖蛗蛚蛜"], -["cd80","蛝蛠蛡蛢蛣蛥蛦蛧蛨蛪蛫蛬蛯蛵蛶蛷蛺蛻蛼蛽蛿蜁蜄蜅蜆蜋蜌蜎蜏蜐蜑蜔蜖汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威"], -["ce40","蜙蜛蜝蜟蜠蜤蜦蜧蜨蜪蜫蜬蜭蜯蜰蜲蜳蜵蜶蜸蜹蜺蜼蜽蝀",6,"蝊蝋蝍蝏蝐蝑蝒蝔蝕蝖蝘蝚",5,"蝡蝢蝦",7,"蝯蝱蝲蝳蝵"], -["ce80","蝷蝸蝹蝺蝿螀螁螄螆螇螉螊螌螎",4,"螔螕螖螘",6,"螠",4,"巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺"], -["cf40","螥螦螧螩螪螮螰螱螲螴螶螷螸螹螻螼螾螿蟁",4,"蟇蟈蟉蟌",4,"蟔",6,"蟜蟝蟞蟟蟡蟢蟣蟤蟦蟧蟨蟩蟫蟬蟭蟯",9], -["cf80","蟺蟻蟼蟽蟿蠀蠁蠂蠄",5,"蠋",7,"蠔蠗蠘蠙蠚蠜",4,"蠣稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓"], -["d040","蠤",13,"蠳",5,"蠺蠻蠽蠾蠿衁衂衃衆",5,"衎",5,"衕衖衘衚",6,"衦衧衪衭衯衱衳衴衵衶衸衹衺"], -["d080","衻衼袀袃袆袇袉袊袌袎袏袐袑袓袔袕袗",4,"袝",4,"袣袥",5,"小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄"], -["d140","袬袮袯袰袲",4,"袸袹袺袻袽袾袿裀裃裄裇裈裊裋裌裍裏裐裑裓裖裗裚",4,"裠裡裦裧裩",6,"裲裵裶裷裺裻製裿褀褁褃",5], -["d180","褉褋",4,"褑褔",4,"褜",4,"褢褣褤褦褧褨褩褬褭褮褯褱褲褳褵褷选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶"], -["d240","褸",8,"襂襃襅",24,"襠",5,"襧",19,"襼"], -["d280","襽襾覀覂覄覅覇",26,"摇尧遥窑谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音阴姻吟银淫寅饮尹引隐"], -["d340","覢",30,"觃觍觓觔觕觗觘觙觛觝觟觠觡觢觤觧觨觩觪觬觭觮觰觱觲觴",6], -["d380","觻",4,"訁",5,"計",21,"印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉"], -["d440","訞",31,"訿",8,"詉",21], -["d480","詟",25,"詺",6,"浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧"], -["d540","誁",7,"誋",7,"誔",46], -["d580","諃",32,"铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政"], -["d640","諤",34,"謈",27], -["d680","謤謥謧",30,"帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑"], -["d740","譆",31,"譧",4,"譭",25], -["d780","讇",24,"讬讱讻诇诐诪谉谞住注祝驻抓爪拽专砖转撰赚篆桩庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"], -["d840","谸",8,"豂豃豄豅豈豊豋豍",7,"豖豗豘豙豛",5,"豣",6,"豬",6,"豴豵豶豷豻",6,"貃貄貆貇"], -["d880","貈貋貍",6,"貕貖貗貙",20,"亍丌兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乜乩亓芈孛啬嘏仄厍厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜蒯剽劂劁劐劓冂罔亻仃仉仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝"], -["d940","貮",62], -["d980","賭",32,"佟佗伲伽佶佴侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俟俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佘佥俎龠汆籴兮巽黉馘冁夔勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼"], -["da40","贎",14,"贠赑赒赗赟赥赨赩赪赬赮赯赱赲赸",8,"趂趃趆趇趈趉趌",4,"趒趓趕",9,"趠趡"], -["da80","趢趤",12,"趲趶趷趹趻趽跀跁跂跅跇跈跉跊跍跐跒跓跔凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谯谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隗隰邗邛邝邙邬邡邴邳邶邺"], -["db40","跕跘跙跜跠跡跢跥跦跧跩跭跮跰跱跲跴跶跼跾",6,"踆踇踈踋踍踎踐踑踒踓踕",7,"踠踡踤",4,"踫踭踰踲踳踴踶踷踸踻踼踾"], -["db80","踿蹃蹅蹆蹌",4,"蹓",5,"蹚",11,"蹧蹨蹪蹫蹮蹱邸邰郏郅邾郐郄郇郓郦郢郜郗郛郫郯郾鄄鄢鄞鄣鄱鄯鄹酃酆刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝"], -["dc40","蹳蹵蹷",4,"蹽蹾躀躂躃躄躆躈",6,"躑躒躓躕",6,"躝躟",11,"躭躮躰躱躳",6,"躻",7], -["dc80","軃",10,"軏",21,"堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷芮苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟荀茗荠茭茺茳荦荥"], -["dd40","軥",62], -["dd80","輤",32,"荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莘莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蔺"], -["de40","轅",32,"轪辀辌辒辝辠辡辢辤辥辦辧辪辬辭辮辯農辳辴辵辷辸辺辻込辿迀迃迆"], -["de80","迉",4,"迏迒迖迗迚迠迡迣迧迬迯迱迲迴迵迶迺迻迼迾迿逇逈逌逎逓逕逘蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奚奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖"], -["df40","這逜連逤逥逧",5,"逰",4,"逷逹逺逽逿遀遃遅遆遈",4,"過達違遖遙遚遜",5,"遤遦遧適遪遫遬遯",4,"遶",6,"遾邁"], -["df80","還邅邆邇邉邊邌",4,"邒邔邖邘邚邜邞邟邠邤邥邧邨邩邫邭邲邷邼邽邿郀摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼"], -["e040","郂郃郆郈郉郋郌郍郒郔郕郖郘郙郚郞郟郠郣郤郥郩郪郬郮郰郱郲郳郵郶郷郹郺郻郼郿鄀鄁鄃鄅",19,"鄚鄛鄜"], -["e080","鄝鄟鄠鄡鄤",10,"鄰鄲",6,"鄺",8,"酄唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼"], -["e140","酅酇酈酑酓酔酕酖酘酙酛酜酟酠酦酧酨酫酭酳酺酻酼醀",4,"醆醈醊醎醏醓",6,"醜",5,"醤",5,"醫醬醰醱醲醳醶醷醸醹醻"], -["e180","醼",10,"釈釋釐釒",9,"針",8,"帷幄幔幛幞幡岌屺岍岐岖岈岘岙岑岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺"], -["e240","釦",62], -["e280","鈥",32,"狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧",5,"饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庾庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂"], -["e340","鉆",45,"鉵",16], -["e380","銆",7,"銏",24,"恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾"], -["e440","銨",5,"銯",24,"鋉",31], -["e480","鋩",32,"洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑"], -["e540","錊",51,"錿",10], -["e580","鍊",31,"鍫濉澧澹澶濂濡濮濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逄逋逦逑逍逖逡逵逶逭逯遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣"], -["e640","鍬",34,"鎐",27], -["e680","鎬",29,"鏋鏌鏍妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩"], -["e740","鏎",7,"鏗",54], -["e780","鐎",32,"纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缑缒缗缙缜缛缟缡",6,"缪缫缬缭缯",4,"缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬"], -["e840","鐯",14,"鐿",43,"鑬鑭鑮鑯"], -["e880","鑰",20,"钑钖钘铇铏铓铔铚铦铻锜锠琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璩璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀栾桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹"], -["e940","锧锳锽镃镈镋镕镚镠镮镴镵長",7,"門",42], -["e980","閫",32,"椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋"], -["ea40","闌",27,"闬闿阇阓阘阛阞阠阣",6,"阫阬阭阯阰阷阸阹阺阾陁陃陊陎陏陑陒陓陖陗"], -["ea80","陘陙陚陜陝陞陠陣陥陦陫陭",4,"陳陸",12,"隇隉隊辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬臧瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昝昴昱昶昵耆晟晔晁晏晖晡晗晷暄暌暧暝暾曛曜曦曩贲贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰"], -["eb40","隌階隑隒隓隕隖隚際隝",9,"隨",7,"隱隲隴隵隷隸隺隻隿雂雃雈雊雋雐雑雓雔雖",9,"雡",6,"雫"], -["eb80","雬雭雮雰雱雲雴雵雸雺電雼雽雿霂霃霅霊霋霌霐霑霒霔霕霗",4,"霝霟霠搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑滕膣膪臌朦臊膻"], -["ec40","霡",8,"霫霬霮霯霱霳",4,"霺霻霼霽霿",18,"靔靕靗靘靚靜靝靟靣靤靦靧靨靪",7], -["ec80","靲靵靷",4,"靽",7,"鞆",4,"鞌鞎鞏鞐鞓鞕鞖鞗鞙",4,"臁膦欤欷欹歃歆歙飑飒飓飕飙飚殳彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扈扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐"], -["ed40","鞞鞟鞡鞢鞤",6,"鞬鞮鞰鞱鞳鞵",46], -["ed80","韤韥韨韮",4,"韴韷",23,"怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨"], -["ee40","頏",62], -["ee80","顎",32,"睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钭钬钯钰钲钴钶",4,"钼钽钿铄铈",6,"铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪"], -["ef40","顯",5,"颋颎颒颕颙颣風",37,"飏飐飔飖飗飛飜飝飠",4], -["ef80","飥飦飩",30,"铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒",4,"锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤",8,"镯镱镲镳锺矧矬雉秕秭秣秫稆嵇稃稂稞稔"], -["f040","餈",4,"餎餏餑",28,"餯",26], -["f080","饊",9,"饖",12,"饤饦饳饸饹饻饾馂馃馉稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨",4,"鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦",6,"鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙"], -["f140","馌馎馚",10,"馦馧馩",47], -["f180","駙",32,"瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窦窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱褚裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋胥皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃"], -["f240","駺",62], -["f280","騹",32,"颉颌颍颏颔颚颛颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒"], -["f340","驚",17,"驲骃骉骍骎骔骕骙骦骩",6,"骲骳骴骵骹骻骽骾骿髃髄髆",4,"髍髎髏髐髒體髕髖髗髙髚髛髜"], -["f380","髝髞髠髢髣髤髥髧髨髩髪髬髮髰",8,"髺髼",6,"鬄鬅鬆蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竺竽笈笃笄笕笊笫笏筇笸笪笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋"], -["f440","鬇鬉",5,"鬐鬑鬒鬔",10,"鬠鬡鬢鬤",10,"鬰鬱鬳",7,"鬽鬾鬿魀魆魊魋魌魎魐魒魓魕",5], -["f480","魛",32,"簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裘裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮暨羿翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤"], -["f540","魼",62], -["f580","鮻",32,"酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜"], -["f640","鯜",62], -["f680","鰛",32,"觥觫觯訾謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅",5,"龌黾鼋鼍隹隼隽雎雒瞿雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞",5,"鲥",4,"鲫鲭鲮鲰",7,"鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋"], -["f740","鰼",62], -["f780","鱻鱽鱾鲀鲃鲄鲉鲊鲌鲏鲓鲖鲗鲘鲙鲝鲪鲬鲯鲹鲾",4,"鳈鳉鳑鳒鳚鳛鳠鳡鳌",4,"鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄"], -["f840","鳣",62], -["f880","鴢",32], -["f940","鵃",62], -["f980","鶂",32], -["fa40","鶣",62], -["fa80","鷢",32], -["fb40","鸃",27,"鸤鸧鸮鸰鸴鸻鸼鹀鹍鹐鹒鹓鹔鹖鹙鹝鹟鹠鹡鹢鹥鹮鹯鹲鹴",9,"麀"], -["fb80","麁麃麄麅麆麉麊麌",5,"麔",8,"麞麠",5,"麧麨麩麪"], -["fc40","麫",8,"麵麶麷麹麺麼麿",4,"黅黆黇黈黊黋黌黐黒黓黕黖黗黙黚點黡黣黤黦黨黫黬黭黮黰",8,"黺黽黿",6], -["fc80","鼆",4,"鼌鼏鼑鼒鼔鼕鼖鼘鼚",5,"鼡鼣",8,"鼭鼮鼰鼱"], -["fd40","鼲",4,"鼸鼺鼼鼿",4,"齅",10,"齒",38], -["fd80","齹",5,"龁龂龍",11,"龜龝龞龡",4,"郎凉秊裏隣"], -["fe40","兀嗀﨎﨏﨑﨓﨔礼﨟蘒﨡﨣﨤﨧﨨﨩"] -] diff --git a/node_modules/iconv-lite/encodings/tables/cp949.json b/node_modules/iconv-lite/encodings/tables/cp949.json deleted file mode 100644 index 2022a00..0000000 --- a/node_modules/iconv-lite/encodings/tables/cp949.json +++ /dev/null @@ -1,273 +0,0 @@ -[ -["0","\u0000",127], -["8141","갂갃갅갆갋",4,"갘갞갟갡갢갣갥",6,"갮갲갳갴"], -["8161","갵갶갷갺갻갽갾갿걁",9,"걌걎",5,"걕"], -["8181","걖걗걙걚걛걝",18,"걲걳걵걶걹걻",4,"겂겇겈겍겎겏겑겒겓겕",6,"겞겢",5,"겫겭겮겱",6,"겺겾겿곀곂곃곅곆곇곉곊곋곍",7,"곖곘",7,"곢곣곥곦곩곫곭곮곲곴곷",4,"곾곿괁괂괃괅괇",4,"괎괐괒괓"], -["8241","괔괕괖괗괙괚괛괝괞괟괡",7,"괪괫괮",5], -["8261","괶괷괹괺괻괽",6,"굆굈굊",5,"굑굒굓굕굖굗"], -["8281","굙",7,"굢굤",7,"굮굯굱굲굷굸굹굺굾궀궃",4,"궊궋궍궎궏궑",10,"궞",5,"궥",17,"궸",7,"귂귃귅귆귇귉",6,"귒귔",7,"귝귞귟귡귢귣귥",18], -["8341","귺귻귽귾긂",5,"긊긌긎",5,"긕",7], -["8361","긝",18,"긲긳긵긶긹긻긼"], -["8381","긽긾긿깂깄깇깈깉깋깏깑깒깓깕깗",4,"깞깢깣깤깦깧깪깫깭깮깯깱",6,"깺깾",5,"꺆",5,"꺍",46,"꺿껁껂껃껅",6,"껎껒",5,"껚껛껝",8], -["8441","껦껧껩껪껬껮",5,"껵껶껷껹껺껻껽",8], -["8461","꼆꼉꼊꼋꼌꼎꼏꼑",18], -["8481","꼤",7,"꼮꼯꼱꼳꼵",6,"꼾꽀꽄꽅꽆꽇꽊",5,"꽑",10,"꽞",5,"꽦",18,"꽺",5,"꾁꾂꾃꾅꾆꾇꾉",6,"꾒꾓꾔꾖",5,"꾝",26,"꾺꾻꾽꾾"], -["8541","꾿꿁",5,"꿊꿌꿏",4,"꿕",6,"꿝",4], -["8561","꿢",5,"꿪",5,"꿲꿳꿵꿶꿷꿹",6,"뀂뀃"], -["8581","뀅",6,"뀍뀎뀏뀑뀒뀓뀕",6,"뀞",9,"뀩",26,"끆끇끉끋끍끏끐끑끒끖끘끚끛끜끞",29,"끾끿낁낂낃낅",6,"낎낐낒",5,"낛낝낞낣낤"], -["8641","낥낦낧낪낰낲낶낷낹낺낻낽",6,"냆냊",5,"냒"], -["8661","냓냕냖냗냙",6,"냡냢냣냤냦",10], -["8681","냱",22,"넊넍넎넏넑넔넕넖넗넚넞",4,"넦넧넩넪넫넭",6,"넶넺",5,"녂녃녅녆녇녉",6,"녒녓녖녗녙녚녛녝녞녟녡",22,"녺녻녽녾녿놁놃",4,"놊놌놎놏놐놑놕놖놗놙놚놛놝"], -["8741","놞",9,"놩",15], -["8761","놹",18,"뇍뇎뇏뇑뇒뇓뇕"], -["8781","뇖",5,"뇞뇠",7,"뇪뇫뇭뇮뇯뇱",7,"뇺뇼뇾",5,"눆눇눉눊눍",6,"눖눘눚",5,"눡",18,"눵",6,"눽",26,"뉙뉚뉛뉝뉞뉟뉡",6,"뉪",4], -["8841","뉯",4,"뉶",5,"뉽",6,"늆늇늈늊",4], -["8861","늏늒늓늕늖늗늛",4,"늢늤늧늨늩늫늭늮늯늱늲늳늵늶늷"], -["8881","늸",15,"닊닋닍닎닏닑닓",4,"닚닜닞닟닠닡닣닧닩닪닰닱닲닶닼닽닾댂댃댅댆댇댉",6,"댒댖",5,"댝",54,"덗덙덚덝덠덡덢덣"], -["8941","덦덨덪덬덭덯덲덳덵덶덷덹",6,"뎂뎆",5,"뎍"], -["8961","뎎뎏뎑뎒뎓뎕",10,"뎢",5,"뎩뎪뎫뎭"], -["8981","뎮",21,"돆돇돉돊돍돏돑돒돓돖돘돚돜돞돟돡돢돣돥돦돧돩",18,"돽",18,"됑",6,"됙됚됛됝됞됟됡",6,"됪됬",7,"됵",15], -["8a41","둅",10,"둒둓둕둖둗둙",6,"둢둤둦"], -["8a61","둧",4,"둭",18,"뒁뒂"], -["8a81","뒃",4,"뒉",19,"뒞",5,"뒥뒦뒧뒩뒪뒫뒭",7,"뒶뒸뒺",5,"듁듂듃듅듆듇듉",6,"듑듒듓듔듖",5,"듞듟듡듢듥듧",4,"듮듰듲",5,"듹",26,"딖딗딙딚딝"], -["8b41","딞",5,"딦딫",4,"딲딳딵딶딷딹",6,"땂땆"], -["8b61","땇땈땉땊땎땏땑땒땓땕",6,"땞땢",8], -["8b81","땫",52,"떢떣떥떦떧떩떬떭떮떯떲떶",4,"떾떿뗁뗂뗃뗅",6,"뗎뗒",5,"뗙",18,"뗭",18], -["8c41","똀",15,"똒똓똕똖똗똙",4], -["8c61","똞",6,"똦",5,"똭",6,"똵",5], -["8c81","똻",12,"뙉",26,"뙥뙦뙧뙩",50,"뚞뚟뚡뚢뚣뚥",5,"뚭뚮뚯뚰뚲",16], -["8d41","뛃",16,"뛕",8], -["8d61","뛞",17,"뛱뛲뛳뛵뛶뛷뛹뛺"], -["8d81","뛻",4,"뜂뜃뜄뜆",33,"뜪뜫뜭뜮뜱",6,"뜺뜼",7,"띅띆띇띉띊띋띍",6,"띖",9,"띡띢띣띥띦띧띩",6,"띲띴띶",5,"띾띿랁랂랃랅",6,"랎랓랔랕랚랛랝랞"], -["8e41","랟랡",6,"랪랮",5,"랶랷랹",8], -["8e61","럂",4,"럈럊",19], -["8e81","럞",13,"럮럯럱럲럳럵",6,"럾렂",4,"렊렋렍렎렏렑",6,"렚렜렞",5,"렦렧렩렪렫렭",6,"렶렺",5,"롁롂롃롅",11,"롒롔",7,"롞롟롡롢롣롥",6,"롮롰롲",5,"롹롺롻롽",7], -["8f41","뢅",7,"뢎",17], -["8f61","뢠",7,"뢩",6,"뢱뢲뢳뢵뢶뢷뢹",4], -["8f81","뢾뢿룂룄룆",5,"룍룎룏룑룒룓룕",7,"룞룠룢",5,"룪룫룭룮룯룱",6,"룺룼룾",5,"뤅",18,"뤙",6,"뤡",26,"뤾뤿륁륂륃륅",6,"륍륎륐륒",5], -["9041","륚륛륝륞륟륡",6,"륪륬륮",5,"륶륷륹륺륻륽"], -["9061","륾",5,"릆릈릋릌릏",15], -["9081","릟",12,"릮릯릱릲릳릵",6,"릾맀맂",5,"맊맋맍맓",4,"맚맜맟맠맢맦맧맩맪맫맭",6,"맶맻",4,"먂",5,"먉",11,"먖",33,"먺먻먽먾먿멁멃멄멅멆"], -["9141","멇멊멌멏멐멑멒멖멗멙멚멛멝",6,"멦멪",5], -["9161","멲멳멵멶멷멹",9,"몆몈몉몊몋몍",5], -["9181","몓",20,"몪몭몮몯몱몳",4,"몺몼몾",5,"뫅뫆뫇뫉",14,"뫚",33,"뫽뫾뫿묁묂묃묅",7,"묎묐묒",5,"묙묚묛묝묞묟묡",6], -["9241","묨묪묬",7,"묷묹묺묿",4,"뭆뭈뭊뭋뭌뭎뭑뭒"], -["9261","뭓뭕뭖뭗뭙",7,"뭢뭤",7,"뭭",4], -["9281","뭲",21,"뮉뮊뮋뮍뮎뮏뮑",18,"뮥뮦뮧뮩뮪뮫뮭",6,"뮵뮶뮸",7,"믁믂믃믅믆믇믉",6,"믑믒믔",35,"믺믻믽믾밁"], -["9341","밃",4,"밊밎밐밒밓밙밚밠밡밢밣밦밨밪밫밬밮밯밲밳밵"], -["9361","밶밷밹",6,"뱂뱆뱇뱈뱊뱋뱎뱏뱑",8], -["9381","뱚뱛뱜뱞",37,"벆벇벉벊벍벏",4,"벖벘벛",4,"벢벣벥벦벩",6,"벲벶",5,"벾벿볁볂볃볅",7,"볎볒볓볔볖볗볙볚볛볝",22,"볷볹볺볻볽"], -["9441","볾",5,"봆봈봊",5,"봑봒봓봕",8], -["9461","봞",5,"봥",6,"봭",12], -["9481","봺",5,"뵁",6,"뵊뵋뵍뵎뵏뵑",6,"뵚",9,"뵥뵦뵧뵩",22,"붂붃붅붆붋",4,"붒붔붖붗붘붛붝",6,"붥",10,"붱",6,"붹",24], -["9541","뷒뷓뷖뷗뷙뷚뷛뷝",11,"뷪",5,"뷱"], -["9561","뷲뷳뷵뷶뷷뷹",6,"븁븂븄븆",5,"븎븏븑븒븓"], -["9581","븕",6,"븞븠",35,"빆빇빉빊빋빍빏",4,"빖빘빜빝빞빟빢빣빥빦빧빩빫",4,"빲빶",4,"빾빿뺁뺂뺃뺅",6,"뺎뺒",5,"뺚",13,"뺩",14], -["9641","뺸",23,"뻒뻓"], -["9661","뻕뻖뻙",6,"뻡뻢뻦",5,"뻭",8], -["9681","뻶",10,"뼂",5,"뼊",13,"뼚뼞",33,"뽂뽃뽅뽆뽇뽉",6,"뽒뽓뽔뽖",44], -["9741","뾃",16,"뾕",8], -["9761","뾞",17,"뾱",7], -["9781","뾹",11,"뿆",5,"뿎뿏뿑뿒뿓뿕",6,"뿝뿞뿠뿢",89,"쀽쀾쀿"], -["9841","쁀",16,"쁒",5,"쁙쁚쁛"], -["9861","쁝쁞쁟쁡",6,"쁪",15], -["9881","쁺",21,"삒삓삕삖삗삙",6,"삢삤삦",5,"삮삱삲삷",4,"삾샂샃샄샆샇샊샋샍샎샏샑",6,"샚샞",5,"샦샧샩샪샫샭",6,"샶샸샺",5,"섁섂섃섅섆섇섉",6,"섑섒섓섔섖",5,"섡섢섥섨섩섪섫섮"], -["9941","섲섳섴섵섷섺섻섽섾섿셁",6,"셊셎",5,"셖셗"], -["9961","셙셚셛셝",6,"셦셪",5,"셱셲셳셵셶셷셹셺셻"], -["9981","셼",8,"솆",5,"솏솑솒솓솕솗",4,"솞솠솢솣솤솦솧솪솫솭솮솯솱",11,"솾",5,"쇅쇆쇇쇉쇊쇋쇍",6,"쇕쇖쇙",6,"쇡쇢쇣쇥쇦쇧쇩",6,"쇲쇴",7,"쇾쇿숁숂숃숅",6,"숎숐숒",5,"숚숛숝숞숡숢숣"], -["9a41","숤숥숦숧숪숬숮숰숳숵",16], -["9a61","쉆쉇쉉",6,"쉒쉓쉕쉖쉗쉙",6,"쉡쉢쉣쉤쉦"], -["9a81","쉧",4,"쉮쉯쉱쉲쉳쉵",6,"쉾슀슂",5,"슊",5,"슑",6,"슙슚슜슞",5,"슦슧슩슪슫슮",5,"슶슸슺",33,"싞싟싡싢싥",5,"싮싰싲싳싴싵싷싺싽싾싿쌁",6,"쌊쌋쌎쌏"], -["9b41","쌐쌑쌒쌖쌗쌙쌚쌛쌝",6,"쌦쌧쌪",8], -["9b61","쌳",17,"썆",7], -["9b81","썎",25,"썪썫썭썮썯썱썳",4,"썺썻썾",5,"쎅쎆쎇쎉쎊쎋쎍",50,"쏁",22,"쏚"], -["9c41","쏛쏝쏞쏡쏣",4,"쏪쏫쏬쏮",5,"쏶쏷쏹",5], -["9c61","쏿",8,"쐉",6,"쐑",9], -["9c81","쐛",8,"쐥",6,"쐭쐮쐯쐱쐲쐳쐵",6,"쐾",9,"쑉",26,"쑦쑧쑩쑪쑫쑭",6,"쑶쑷쑸쑺",5,"쒁",18,"쒕",6,"쒝",12], -["9d41","쒪",13,"쒹쒺쒻쒽",8], -["9d61","쓆",25], -["9d81","쓠",8,"쓪",5,"쓲쓳쓵쓶쓷쓹쓻쓼쓽쓾씂",9,"씍씎씏씑씒씓씕",6,"씝",10,"씪씫씭씮씯씱",6,"씺씼씾",5,"앆앇앋앏앐앑앒앖앚앛앜앟앢앣앥앦앧앩",6,"앲앶",5,"앾앿얁얂얃얅얆얈얉얊얋얎얐얒얓얔"], -["9e41","얖얙얚얛얝얞얟얡",7,"얪",9,"얶"], -["9e61","얷얺얿",4,"엋엍엏엒엓엕엖엗엙",6,"엢엤엦엧"], -["9e81","엨엩엪엫엯엱엲엳엵엸엹엺엻옂옃옄옉옊옋옍옎옏옑",6,"옚옝",6,"옦옧옩옪옫옯옱옲옶옸옺옼옽옾옿왂왃왅왆왇왉",6,"왒왖",5,"왞왟왡",10,"왭왮왰왲",5,"왺왻왽왾왿욁",6,"욊욌욎",5,"욖욗욙욚욛욝",6,"욦"], -["9f41","욨욪",5,"욲욳욵욶욷욻",4,"웂웄웆",5,"웎"], -["9f61","웏웑웒웓웕",6,"웞웟웢",5,"웪웫웭웮웯웱웲"], -["9f81","웳",4,"웺웻웼웾",5,"윆윇윉윊윋윍",6,"윖윘윚",5,"윢윣윥윦윧윩",6,"윲윴윶윸윹윺윻윾윿읁읂읃읅",4,"읋읎읐읙읚읛읝읞읟읡",6,"읩읪읬",7,"읶읷읹읺읻읿잀잁잂잆잋잌잍잏잒잓잕잙잛",4,"잢잧",4,"잮잯잱잲잳잵잶잷"], -["a041","잸잹잺잻잾쟂",5,"쟊쟋쟍쟏쟑",6,"쟙쟚쟛쟜"], -["a061","쟞",5,"쟥쟦쟧쟩쟪쟫쟭",13], -["a081","쟻",4,"젂젃젅젆젇젉젋",4,"젒젔젗",4,"젞젟젡젢젣젥",6,"젮젰젲",5,"젹젺젻젽젾젿졁",6,"졊졋졎",5,"졕",26,"졲졳졵졶졷졹졻",4,"좂좄좈좉좊좎",5,"좕",7,"좞좠좢좣좤"], -["a141","좥좦좧좩",18,"좾좿죀죁"], -["a161","죂죃죅죆죇죉죊죋죍",6,"죖죘죚",5,"죢죣죥"], -["a181","죦",14,"죶",5,"죾죿줁줂줃줇",4,"줎 、。·‥…¨〃­―∥\∼‘’“”〔〕〈",9,"±×÷≠≤≥∞∴°′″℃Å¢£¥♂♀∠⊥⌒∂∇≡≒§※☆★○●◎◇◆□■△▲▽▼→←↑↓↔〓≪≫√∽∝∵∫∬∈∋⊆⊇⊂⊃∪∩∧∨¬"], -["a241","줐줒",5,"줙",18], -["a261","줭",6,"줵",18], -["a281","쥈",7,"쥒쥓쥕쥖쥗쥙",6,"쥢쥤",7,"쥭쥮쥯⇒⇔∀∃´~ˇ˘˝˚˙¸˛¡¿ː∮∑∏¤℉‰◁◀▷▶♤♠♡♥♧♣⊙◈▣◐◑▒▤▥▨▧▦▩♨☏☎☜☞¶†‡↕↗↙↖↘♭♩♪♬㉿㈜№㏇™㏂㏘℡€®"], -["a341","쥱쥲쥳쥵",6,"쥽",10,"즊즋즍즎즏"], -["a361","즑",6,"즚즜즞",16], -["a381","즯",16,"짂짃짅짆짉짋",4,"짒짔짗짘짛!",58,"₩]",32," ̄"], -["a441","짞짟짡짣짥짦짨짩짪짫짮짲",5,"짺짻짽짾짿쨁쨂쨃쨄"], -["a461","쨅쨆쨇쨊쨎",5,"쨕쨖쨗쨙",12], -["a481","쨦쨧쨨쨪",28,"ㄱ",93], -["a541","쩇",4,"쩎쩏쩑쩒쩓쩕",6,"쩞쩢",5,"쩩쩪"], -["a561","쩫",17,"쩾",5,"쪅쪆"], -["a581","쪇",16,"쪙",14,"ⅰ",9], -["a5b0","Ⅰ",9], -["a5c1","Α",16,"Σ",6], -["a5e1","α",16,"σ",6], -["a641","쪨",19,"쪾쪿쫁쫂쫃쫅"], -["a661","쫆",5,"쫎쫐쫒쫔쫕쫖쫗쫚",5,"쫡",6], -["a681","쫨쫩쫪쫫쫭",6,"쫵",18,"쬉쬊─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂┒┑┚┙┖┕┎┍┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃",7], -["a741","쬋",4,"쬑쬒쬓쬕쬖쬗쬙",6,"쬢",7], -["a761","쬪",22,"쭂쭃쭄"], -["a781","쭅쭆쭇쭊쭋쭍쭎쭏쭑",6,"쭚쭛쭜쭞",5,"쭥",7,"㎕㎖㎗ℓ㎘㏄㎣㎤㎥㎦㎙",9,"㏊㎍㎎㎏㏏㎈㎉㏈㎧㎨㎰",9,"㎀",4,"㎺",5,"㎐",4,"Ω㏀㏁㎊㎋㎌㏖㏅㎭㎮㎯㏛㎩㎪㎫㎬㏝㏐㏓㏃㏉㏜㏆"], -["a841","쭭",10,"쭺",14], -["a861","쮉",18,"쮝",6], -["a881","쮤",19,"쮹",11,"ÆÐªĦ"], -["a8a6","IJ"], -["a8a8","ĿŁØŒºÞŦŊ"], -["a8b1","㉠",27,"ⓐ",25,"①",14,"½⅓⅔¼¾⅛⅜⅝⅞"], -["a941","쯅",14,"쯕",10], -["a961","쯠쯡쯢쯣쯥쯦쯨쯪",18], -["a981","쯽",14,"찎찏찑찒찓찕",6,"찞찟찠찣찤æđðħıijĸŀłøœßþŧŋʼn㈀",27,"⒜",25,"⑴",14,"¹²³⁴ⁿ₁₂₃₄"], -["aa41","찥찦찪찫찭찯찱",6,"찺찿",4,"챆챇챉챊챋챍챎"], -["aa61","챏",4,"챖챚",5,"챡챢챣챥챧챩",6,"챱챲"], -["aa81","챳챴챶",29,"ぁ",82], -["ab41","첔첕첖첗첚첛첝첞첟첡",6,"첪첮",5,"첶첷첹"], -["ab61","첺첻첽",6,"쳆쳈쳊",5,"쳑쳒쳓쳕",5], -["ab81","쳛",8,"쳥",6,"쳭쳮쳯쳱",12,"ァ",85], -["ac41","쳾쳿촀촂",5,"촊촋촍촎촏촑",6,"촚촜촞촟촠"], -["ac61","촡촢촣촥촦촧촩촪촫촭",11,"촺",4], -["ac81","촿",28,"쵝쵞쵟А",5,"ЁЖ",25], -["acd1","а",5,"ёж",25], -["ad41","쵡쵢쵣쵥",6,"쵮쵰쵲",5,"쵹",7], -["ad61","춁",6,"춉",10,"춖춗춙춚춛춝춞춟"], -["ad81","춠춡춢춣춦춨춪",5,"춱",18,"췅"], -["ae41","췆",5,"췍췎췏췑",16], -["ae61","췢",5,"췩췪췫췭췮췯췱",6,"췺췼췾",4], -["ae81","츃츅츆츇츉츊츋츍",6,"츕츖츗츘츚",5,"츢츣츥츦츧츩츪츫"], -["af41","츬츭츮츯츲츴츶",19], -["af61","칊",13,"칚칛칝칞칢",5,"칪칬"], -["af81","칮",5,"칶칷칹칺칻칽",6,"캆캈캊",5,"캒캓캕캖캗캙"], -["b041","캚",5,"캢캦",5,"캮",12], -["b061","캻",5,"컂",19], -["b081","컖",13,"컦컧컩컪컭",6,"컶컺",5,"가각간갇갈갉갊감",7,"같",4,"갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆"], -["b141","켂켃켅켆켇켉",6,"켒켔켖",5,"켝켞켟켡켢켣"], -["b161","켥",6,"켮켲",5,"켹",11], -["b181","콅",14,"콖콗콙콚콛콝",6,"콦콨콪콫콬괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸"], -["b241","콭콮콯콲콳콵콶콷콹",6,"쾁쾂쾃쾄쾆",5,"쾍"], -["b261","쾎",18,"쾢",5,"쾩"], -["b281","쾪",5,"쾱",18,"쿅",6,"깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙"], -["b341","쿌",19,"쿢쿣쿥쿦쿧쿩"], -["b361","쿪",5,"쿲쿴쿶",5,"쿽쿾쿿퀁퀂퀃퀅",5], -["b381","퀋",5,"퀒",5,"퀙",19,"끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫",4,"낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝"], -["b441","퀮",5,"퀶퀷퀹퀺퀻퀽",6,"큆큈큊",5], -["b461","큑큒큓큕큖큗큙",6,"큡",10,"큮큯"], -["b481","큱큲큳큵",6,"큾큿킀킂",18,"뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫",4,"닳담답닷",4,"닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥"], -["b541","킕",14,"킦킧킩킪킫킭",5], -["b561","킳킶킸킺",5,"탂탃탅탆탇탊",5,"탒탖",4], -["b581","탛탞탟탡탢탣탥",6,"탮탲",5,"탹",11,"덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸"], -["b641","턅",7,"턎",17], -["b661","턠",15,"턲턳턵턶턷턹턻턼턽턾"], -["b681","턿텂텆",5,"텎텏텑텒텓텕",6,"텞텠텢",5,"텩텪텫텭땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗"], -["b741","텮",13,"텽",6,"톅톆톇톉톊"], -["b761","톋",20,"톢톣톥톦톧"], -["b781","톩",6,"톲톴톶톷톸톹톻톽톾톿퇁",14,"래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩"], -["b841","퇐",7,"퇙",17], -["b861","퇫",8,"퇵퇶퇷퇹",13], -["b881","툈툊",5,"툑",24,"륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많",4,"맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼"], -["b941","툪툫툮툯툱툲툳툵",6,"툾퉀퉂",5,"퉉퉊퉋퉌"], -["b961","퉍",14,"퉝",6,"퉥퉦퉧퉨"], -["b981","퉩",22,"튂튃튅튆튇튉튊튋튌묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바",4,"받",4,"밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗"], -["ba41","튍튎튏튒튓튔튖",5,"튝튞튟튡튢튣튥",6,"튭"], -["ba61","튮튯튰튲",5,"튺튻튽튾틁틃",4,"틊틌",5], -["ba81","틒틓틕틖틗틙틚틛틝",6,"틦",9,"틲틳틵틶틷틹틺벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤"], -["bb41","틻",4,"팂팄팆",5,"팏팑팒팓팕팗",4,"팞팢팣"], -["bb61","팤팦팧팪팫팭팮팯팱",6,"팺팾",5,"퍆퍇퍈퍉"], -["bb81","퍊",31,"빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤"], -["bc41","퍪",17,"퍾퍿펁펂펃펅펆펇"], -["bc61","펈펉펊펋펎펒",5,"펚펛펝펞펟펡",6,"펪펬펮"], -["bc81","펯",4,"펵펶펷펹펺펻펽",6,"폆폇폊",5,"폑",5,"샥샨샬샴샵샷샹섀섄섈섐섕서",4,"섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭"], -["bd41","폗폙",7,"폢폤",7,"폮폯폱폲폳폵폶폷"], -["bd61","폸폹폺폻폾퐀퐂",5,"퐉",13], -["bd81","퐗",5,"퐞",25,"숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰"], -["be41","퐸",7,"푁푂푃푅",14], -["be61","푔",7,"푝푞푟푡푢푣푥",7,"푮푰푱푲"], -["be81","푳",4,"푺푻푽푾풁풃",4,"풊풌풎",5,"풕",8,"쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄",6,"엌엎"], -["bf41","풞",10,"풪",14], -["bf61","풹",18,"퓍퓎퓏퓑퓒퓓퓕"], -["bf81","퓖",5,"퓝퓞퓠",7,"퓩퓪퓫퓭퓮퓯퓱",6,"퓹퓺퓼에엑엔엘엠엡엣엥여역엮연열엶엷염",5,"옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝왠왬왯왱외왹왼욀욈욉욋욍요욕욘욜욤욥욧용우욱운울욹욺움웁웃웅워웍원월웜웝웠웡웨"], -["c041","퓾",5,"픅픆픇픉픊픋픍",6,"픖픘",5], -["c061","픞",25], -["c081","픸픹픺픻픾픿핁핂핃핅",6,"핎핐핒",5,"핚핛핝핞핟핡핢핣웩웬웰웸웹웽위윅윈윌윔윕윗윙유육윤율윰윱윳융윷으윽은을읊음읍읏응",7,"읜읠읨읫이익인일읽읾잃임입잇있잉잊잎자작잔잖잗잘잚잠잡잣잤장잦재잭잰잴잼잽잿쟀쟁쟈쟉쟌쟎쟐쟘쟝쟤쟨쟬저적전절젊"], -["c141","핤핦핧핪핬핮",5,"핶핷핹핺핻핽",6,"햆햊햋"], -["c161","햌햍햎햏햑",19,"햦햧"], -["c181","햨",31,"점접젓정젖제젝젠젤젬젭젯젱져젼졀졈졉졌졍졔조족존졸졺좀좁좃종좆좇좋좌좍좔좝좟좡좨좼좽죄죈죌죔죕죗죙죠죡죤죵주죽준줄줅줆줌줍줏중줘줬줴쥐쥑쥔쥘쥠쥡쥣쥬쥰쥴쥼즈즉즌즐즘즙즛증지직진짇질짊짐집짓"], -["c241","헊헋헍헎헏헑헓",4,"헚헜헞",5,"헦헧헩헪헫헭헮"], -["c261","헯",4,"헶헸헺",5,"혂혃혅혆혇혉",6,"혒"], -["c281","혖",5,"혝혞혟혡혢혣혥",7,"혮",9,"혺혻징짖짙짚짜짝짠짢짤짧짬짭짯짰짱째짹짼쨀쨈쨉쨋쨌쨍쨔쨘쨩쩌쩍쩐쩔쩜쩝쩟쩠쩡쩨쩽쪄쪘쪼쪽쫀쫄쫌쫍쫏쫑쫓쫘쫙쫠쫬쫴쬈쬐쬔쬘쬠쬡쭁쭈쭉쭌쭐쭘쭙쭝쭤쭸쭹쮜쮸쯔쯤쯧쯩찌찍찐찔찜찝찡찢찧차착찬찮찰참찹찻"], -["c341","혽혾혿홁홂홃홄홆홇홊홌홎홏홐홒홓홖홗홙홚홛홝",4], -["c361","홢",4,"홨홪",5,"홲홳홵",11], -["c381","횁횂횄횆",5,"횎횏횑횒횓횕",7,"횞횠횢",5,"횩횪찼창찾채책챈챌챔챕챗챘챙챠챤챦챨챰챵처척천철첨첩첫첬청체첵첸첼쳄쳅쳇쳉쳐쳔쳤쳬쳰촁초촉촌촐촘촙촛총촤촨촬촹최쵠쵤쵬쵭쵯쵱쵸춈추축춘출춤춥춧충춰췄췌췐취췬췰췸췹췻췽츄츈츌츔츙츠측츤츨츰츱츳층"], -["c441","횫횭횮횯횱",7,"횺횼",7,"훆훇훉훊훋"], -["c461","훍훎훏훐훒훓훕훖훘훚",5,"훡훢훣훥훦훧훩",4], -["c481","훮훯훱훲훳훴훶",5,"훾훿휁휂휃휅",11,"휒휓휔치칙친칟칠칡침칩칫칭카칵칸칼캄캅캇캉캐캑캔캘캠캡캣캤캥캬캭컁커컥컨컫컬컴컵컷컸컹케켁켄켈켐켑켓켕켜켠켤켬켭켯켰켱켸코콕콘콜콤콥콧콩콰콱콴콸쾀쾅쾌쾡쾨쾰쿄쿠쿡쿤쿨쿰쿱쿳쿵쿼퀀퀄퀑퀘퀭퀴퀵퀸퀼"], -["c541","휕휖휗휚휛휝휞휟휡",6,"휪휬휮",5,"휶휷휹"], -["c561","휺휻휽",6,"흅흆흈흊",5,"흒흓흕흚",4], -["c581","흟흢흤흦흧흨흪흫흭흮흯흱흲흳흵",6,"흾흿힀힂",5,"힊힋큄큅큇큉큐큔큘큠크큭큰클큼큽킁키킥킨킬킴킵킷킹타탁탄탈탉탐탑탓탔탕태택탠탤탬탭탯탰탱탸턍터턱턴털턺텀텁텃텄텅테텍텐텔템텝텟텡텨텬텼톄톈토톡톤톨톰톱톳통톺톼퇀퇘퇴퇸툇툉툐투툭툰툴툼툽툿퉁퉈퉜"], -["c641","힍힎힏힑",6,"힚힜힞",5], -["c6a1","퉤튀튁튄튈튐튑튕튜튠튤튬튱트특튼튿틀틂틈틉틋틔틘틜틤틥티틱틴틸팀팁팃팅파팍팎판팔팖팜팝팟팠팡팥패팩팬팰팸팹팻팼팽퍄퍅퍼퍽펀펄펌펍펏펐펑페펙펜펠펨펩펫펭펴편펼폄폅폈평폐폘폡폣포폭폰폴폼폽폿퐁"], -["c7a1","퐈퐝푀푄표푠푤푭푯푸푹푼푿풀풂품풉풋풍풔풩퓌퓐퓔퓜퓟퓨퓬퓰퓸퓻퓽프픈플픔픕픗피픽핀필핌핍핏핑하학한할핥함합핫항해핵핸핼햄햅햇했행햐향허헉헌헐헒험헙헛헝헤헥헨헬헴헵헷헹혀혁현혈혐협혓혔형혜혠"], -["c8a1","혤혭호혹혼홀홅홈홉홋홍홑화확환활홧황홰홱홴횃횅회획횐횔횝횟횡효횬횰횹횻후훅훈훌훑훔훗훙훠훤훨훰훵훼훽휀휄휑휘휙휜휠휨휩휫휭휴휵휸휼흄흇흉흐흑흔흖흗흘흙흠흡흣흥흩희흰흴흼흽힁히힉힌힐힘힙힛힝"], -["caa1","伽佳假價加可呵哥嘉嫁家暇架枷柯歌珂痂稼苛茄街袈訶賈跏軻迦駕刻却各恪慤殼珏脚覺角閣侃刊墾奸姦干幹懇揀杆柬桿澗癎看磵稈竿簡肝艮艱諫間乫喝曷渴碣竭葛褐蝎鞨勘坎堪嵌感憾戡敢柑橄減甘疳監瞰紺邯鑑鑒龕"], -["cba1","匣岬甲胛鉀閘剛堈姜岡崗康强彊慷江畺疆糠絳綱羌腔舡薑襁講鋼降鱇介价個凱塏愷愾慨改槪漑疥皆盖箇芥蓋豈鎧開喀客坑更粳羹醵倨去居巨拒据據擧渠炬祛距踞車遽鉅鋸乾件健巾建愆楗腱虔蹇鍵騫乞傑杰桀儉劍劒檢"], -["cca1","瞼鈐黔劫怯迲偈憩揭擊格檄激膈覡隔堅牽犬甄絹繭肩見譴遣鵑抉決潔結缺訣兼慊箝謙鉗鎌京俓倞傾儆勁勍卿坰境庚徑慶憬擎敬景暻更梗涇炅烱璟璥瓊痙硬磬竟競絅經耕耿脛莖警輕逕鏡頃頸驚鯨係啓堺契季屆悸戒桂械"], -["cda1","棨溪界癸磎稽系繫繼計誡谿階鷄古叩告呱固姑孤尻庫拷攷故敲暠枯槁沽痼皐睾稿羔考股膏苦苽菰藁蠱袴誥賈辜錮雇顧高鼓哭斛曲梏穀谷鵠困坤崑昆梱棍滾琨袞鯤汨滑骨供公共功孔工恐恭拱控攻珙空蚣貢鞏串寡戈果瓜"], -["cea1","科菓誇課跨過鍋顆廓槨藿郭串冠官寬慣棺款灌琯瓘管罐菅觀貫關館刮恝括适侊光匡壙廣曠洸炚狂珖筐胱鑛卦掛罫乖傀塊壞怪愧拐槐魁宏紘肱轟交僑咬喬嬌嶠巧攪敎校橋狡皎矯絞翹膠蕎蛟較轎郊餃驕鮫丘久九仇俱具勾"], -["cfa1","區口句咎嘔坵垢寇嶇廐懼拘救枸柩構歐毆毬求溝灸狗玖球瞿矩究絿耉臼舅舊苟衢謳購軀逑邱鉤銶駒驅鳩鷗龜國局菊鞠鞫麴君窘群裙軍郡堀屈掘窟宮弓穹窮芎躬倦券勸卷圈拳捲權淃眷厥獗蕨蹶闕机櫃潰詭軌饋句晷歸貴"], -["d0a1","鬼龜叫圭奎揆槻珪硅窺竅糾葵規赳逵閨勻均畇筠菌鈞龜橘克剋劇戟棘極隙僅劤勤懃斤根槿瑾筋芹菫覲謹近饉契今妗擒昑檎琴禁禽芩衾衿襟金錦伋及急扱汲級給亘兢矜肯企伎其冀嗜器圻基埼夔奇妓寄岐崎己幾忌技旗旣"], -["d1a1","朞期杞棋棄機欺氣汽沂淇玘琦琪璂璣畸畿碁磯祁祇祈祺箕紀綺羈耆耭肌記譏豈起錡錤飢饑騎騏驥麒緊佶吉拮桔金喫儺喇奈娜懦懶拏拿癩",5,"那樂",4,"諾酪駱亂卵暖欄煖爛蘭難鸞捏捺南嵐枏楠湳濫男藍襤拉"], -["d2a1","納臘蠟衲囊娘廊",4,"乃來內奈柰耐冷女年撚秊念恬拈捻寧寗努勞奴弩怒擄櫓爐瑙盧",5,"駑魯",10,"濃籠聾膿農惱牢磊腦賂雷尿壘",7,"嫩訥杻紐勒",5,"能菱陵尼泥匿溺多茶"], -["d3a1","丹亶但單團壇彖斷旦檀段湍短端簞緞蛋袒鄲鍛撻澾獺疸達啖坍憺擔曇淡湛潭澹痰聃膽蕁覃談譚錟沓畓答踏遝唐堂塘幢戇撞棠當糖螳黨代垈坮大對岱帶待戴擡玳臺袋貸隊黛宅德悳倒刀到圖堵塗導屠島嶋度徒悼挑掉搗桃"], -["d4a1","棹櫂淘渡滔濤燾盜睹禱稻萄覩賭跳蹈逃途道都鍍陶韜毒瀆牘犢獨督禿篤纛讀墩惇敦旽暾沌焞燉豚頓乭突仝冬凍動同憧東桐棟洞潼疼瞳童胴董銅兜斗杜枓痘竇荳讀豆逗頭屯臀芚遁遯鈍得嶝橙燈登等藤謄鄧騰喇懶拏癩羅"], -["d5a1","蘿螺裸邏樂洛烙珞絡落諾酪駱丹亂卵欄欒瀾爛蘭鸞剌辣嵐擥攬欖濫籃纜藍襤覽拉臘蠟廊朗浪狼琅瑯螂郞來崍徠萊冷掠略亮倆兩凉梁樑粮粱糧良諒輛量侶儷勵呂廬慮戾旅櫚濾礪藜蠣閭驢驪麗黎力曆歷瀝礫轢靂憐戀攣漣"], -["d6a1","煉璉練聯蓮輦連鍊冽列劣洌烈裂廉斂殮濂簾獵令伶囹寧岺嶺怜玲笭羚翎聆逞鈴零靈領齡例澧禮醴隷勞怒撈擄櫓潞瀘爐盧老蘆虜路輅露魯鷺鹵碌祿綠菉錄鹿麓論壟弄朧瀧瓏籠聾儡瀨牢磊賂賚賴雷了僚寮廖料燎療瞭聊蓼"], -["d7a1","遼鬧龍壘婁屢樓淚漏瘻累縷蔞褸鏤陋劉旒柳榴流溜瀏琉瑠留瘤硫謬類六戮陸侖倫崙淪綸輪律慄栗率隆勒肋凜凌楞稜綾菱陵俚利厘吏唎履悧李梨浬犁狸理璃異痢籬罹羸莉裏裡里釐離鯉吝潾燐璘藺躪隣鱗麟林淋琳臨霖砬"], -["d8a1","立笠粒摩瑪痲碼磨馬魔麻寞幕漠膜莫邈万卍娩巒彎慢挽晩曼滿漫灣瞞萬蔓蠻輓饅鰻唜抹末沫茉襪靺亡妄忘忙望網罔芒茫莽輞邙埋妹媒寐昧枚梅每煤罵買賣邁魅脈貊陌驀麥孟氓猛盲盟萌冪覓免冕勉棉沔眄眠綿緬面麵滅"], -["d9a1","蔑冥名命明暝椧溟皿瞑茗蓂螟酩銘鳴袂侮冒募姆帽慕摸摹暮某模母毛牟牡瑁眸矛耗芼茅謀謨貌木沐牧目睦穆鶩歿沒夢朦蒙卯墓妙廟描昴杳渺猫竗苗錨務巫憮懋戊拇撫无楙武毋無珷畝繆舞茂蕪誣貿霧鵡墨默們刎吻問文"], -["daa1","汶紊紋聞蚊門雯勿沕物味媚尾嵋彌微未梶楣渼湄眉米美薇謎迷靡黴岷悶愍憫敏旻旼民泯玟珉緡閔密蜜謐剝博拍搏撲朴樸泊珀璞箔粕縛膊舶薄迫雹駁伴半反叛拌搬攀斑槃泮潘班畔瘢盤盼磐磻礬絆般蟠返頒飯勃拔撥渤潑"], -["dba1","發跋醱鉢髮魃倣傍坊妨尨幇彷房放方旁昉枋榜滂磅紡肪膀舫芳蒡蚌訪謗邦防龐倍俳北培徘拜排杯湃焙盃背胚裴裵褙賠輩配陪伯佰帛柏栢白百魄幡樊煩燔番磻繁蕃藩飜伐筏罰閥凡帆梵氾汎泛犯範范法琺僻劈壁擘檗璧癖"], -["dca1","碧蘗闢霹便卞弁變辨辯邊別瞥鱉鼈丙倂兵屛幷昞昺柄棅炳甁病秉竝輧餠騈保堡報寶普步洑湺潽珤甫菩補褓譜輔伏僕匐卜宓復服福腹茯蔔複覆輹輻馥鰒本乶俸奉封峯峰捧棒烽熢琫縫蓬蜂逢鋒鳳不付俯傅剖副否咐埠夫婦"], -["dda1","孚孵富府復扶敷斧浮溥父符簿缶腐腑膚艀芙莩訃負賦賻赴趺部釜阜附駙鳧北分吩噴墳奔奮忿憤扮昐汾焚盆粉糞紛芬賁雰不佛弗彿拂崩朋棚硼繃鵬丕備匕匪卑妃婢庇悲憊扉批斐枇榧比毖毗毘沸泌琵痺砒碑秕秘粃緋翡肥"], -["dea1","脾臂菲蜚裨誹譬費鄙非飛鼻嚬嬪彬斌檳殯浜濱瀕牝玭貧賓頻憑氷聘騁乍事些仕伺似使俟僿史司唆嗣四士奢娑寫寺射巳師徙思捨斜斯柶査梭死沙泗渣瀉獅砂社祀祠私篩紗絲肆舍莎蓑蛇裟詐詞謝賜赦辭邪飼駟麝削數朔索"], -["dfa1","傘刪山散汕珊産疝算蒜酸霰乷撒殺煞薩三參杉森渗芟蔘衫揷澁鈒颯上傷像償商喪嘗孀尙峠常床庠廂想桑橡湘爽牀狀相祥箱翔裳觴詳象賞霜塞璽賽嗇塞穡索色牲生甥省笙墅壻嶼序庶徐恕抒捿敍暑曙書栖棲犀瑞筮絮緖署"], -["e0a1","胥舒薯西誓逝鋤黍鼠夕奭席惜昔晳析汐淅潟石碩蓆釋錫仙僊先善嬋宣扇敾旋渲煽琁瑄璇璿癬禪線繕羨腺膳船蘚蟬詵跣選銑鐥饍鮮卨屑楔泄洩渫舌薛褻設說雪齧剡暹殲纖蟾贍閃陝攝涉燮葉城姓宬性惺成星晟猩珹盛省筬"], -["e1a1","聖聲腥誠醒世勢歲洗稅笹細說貰召嘯塑宵小少巢所掃搔昭梳沼消溯瀟炤燒甦疏疎瘙笑篠簫素紹蔬蕭蘇訴逍遡邵銷韶騷俗屬束涑粟續謖贖速孫巽損蓀遜飡率宋悚松淞訟誦送頌刷殺灑碎鎖衰釗修受嗽囚垂壽嫂守岫峀帥愁"], -["e2a1","戍手授搜收數樹殊水洙漱燧狩獸琇璲瘦睡秀穗竪粹綏綬繡羞脩茱蒐蓚藪袖誰讐輸遂邃酬銖銹隋隧隨雖需須首髓鬚叔塾夙孰宿淑潚熟琡璹肅菽巡徇循恂旬栒楯橓殉洵淳珣盾瞬筍純脣舜荀蓴蕣詢諄醇錞順馴戌術述鉥崇崧"], -["e3a1","嵩瑟膝蝨濕拾習褶襲丞乘僧勝升承昇繩蠅陞侍匙嘶始媤尸屎屍市弑恃施是時枾柴猜矢示翅蒔蓍視試詩諡豕豺埴寔式息拭植殖湜熄篒蝕識軾食飾伸侁信呻娠宸愼新晨燼申神紳腎臣莘薪藎蜃訊身辛辰迅失室實悉審尋心沁"], -["e4a1","沈深瀋甚芯諶什十拾雙氏亞俄兒啞娥峨我牙芽莪蛾衙訝阿雅餓鴉鵝堊岳嶽幄惡愕握樂渥鄂鍔顎鰐齷安岸按晏案眼雁鞍顔鮟斡謁軋閼唵岩巖庵暗癌菴闇壓押狎鴨仰央怏昻殃秧鴦厓哀埃崖愛曖涯碍艾隘靄厄扼掖液縊腋額"], -["e5a1","櫻罌鶯鸚也倻冶夜惹揶椰爺耶若野弱掠略約若葯蒻藥躍亮佯兩凉壤孃恙揚攘敭暘梁楊樣洋瀁煬痒瘍禳穰糧羊良襄諒讓釀陽量養圄御於漁瘀禦語馭魚齬億憶抑檍臆偃堰彦焉言諺孼蘖俺儼嚴奄掩淹嶪業円予余勵呂女如廬"], -["e6a1","旅歟汝濾璵礖礪與艅茹輿轝閭餘驪麗黎亦力域役易曆歷疫繹譯轢逆驛嚥堧姸娟宴年延憐戀捐挻撚椽沇沿涎涓淵演漣烟然煙煉燃燕璉硏硯秊筵緣練縯聯衍軟輦蓮連鉛鍊鳶列劣咽悅涅烈熱裂說閱厭廉念捻染殮炎焰琰艶苒"], -["e7a1","簾閻髥鹽曄獵燁葉令囹塋寧嶺嶸影怜映暎楹榮永泳渶潁濚瀛瀯煐營獰玲瑛瑩瓔盈穎纓羚聆英詠迎鈴鍈零霙靈領乂倪例刈叡曳汭濊猊睿穢芮藝蘂禮裔詣譽豫醴銳隸霓預五伍俉傲午吾吳嗚塢墺奧娛寤悟惡懊敖旿晤梧汚澳"], -["e8a1","烏熬獒筽蜈誤鰲鼇屋沃獄玉鈺溫瑥瘟穩縕蘊兀壅擁瓮甕癰翁邕雍饔渦瓦窩窪臥蛙蝸訛婉完宛梡椀浣玩琓琬碗緩翫脘腕莞豌阮頑曰往旺枉汪王倭娃歪矮外嵬巍猥畏了僚僥凹堯夭妖姚寥寮尿嶢拗搖撓擾料曜樂橈燎燿瑤療"], -["e9a1","窈窯繇繞耀腰蓼蟯要謠遙遼邀饒慾欲浴縟褥辱俑傭冗勇埇墉容庸慂榕涌湧溶熔瑢用甬聳茸蓉踊鎔鏞龍于佑偶優又友右宇寓尤愚憂旴牛玗瑀盂祐禑禹紆羽芋藕虞迂遇郵釪隅雨雩勖彧旭昱栯煜稶郁頊云暈橒殞澐熉耘芸蕓"], -["eaa1","運隕雲韻蔚鬱亐熊雄元原員圓園垣媛嫄寃怨愿援沅洹湲源爰猿瑗苑袁轅遠阮院願鴛月越鉞位偉僞危圍委威尉慰暐渭爲瑋緯胃萎葦蔿蝟衛褘謂違韋魏乳侑儒兪劉唯喩孺宥幼幽庾悠惟愈愉揄攸有杻柔柚柳楡楢油洧流游溜"], -["eba1","濡猶猷琉瑜由留癒硫紐維臾萸裕誘諛諭踰蹂遊逾遺酉釉鍮類六堉戮毓肉育陸倫允奫尹崙淪潤玧胤贇輪鈗閏律慄栗率聿戎瀜絨融隆垠恩慇殷誾銀隱乙吟淫蔭陰音飮揖泣邑凝應膺鷹依倚儀宜意懿擬椅毅疑矣義艤薏蟻衣誼"], -["eca1","議醫二以伊利吏夷姨履已弛彛怡易李梨泥爾珥理異痍痢移罹而耳肄苡荑裏裡貽貳邇里離飴餌匿溺瀷益翊翌翼謚人仁刃印吝咽因姻寅引忍湮燐璘絪茵藺蚓認隣靭靷鱗麟一佚佾壹日溢逸鎰馹任壬妊姙恁林淋稔臨荏賃入卄"], -["eda1","立笠粒仍剩孕芿仔刺咨姉姿子字孜恣慈滋炙煮玆瓷疵磁紫者自茨蔗藉諮資雌作勺嚼斫昨灼炸爵綽芍酌雀鵲孱棧殘潺盞岑暫潛箴簪蠶雜丈仗匠場墻壯奬將帳庄張掌暲杖樟檣欌漿牆狀獐璋章粧腸臟臧莊葬蔣薔藏裝贓醬長"], -["eea1","障再哉在宰才材栽梓渽滓災縡裁財載齋齎爭箏諍錚佇低儲咀姐底抵杵楮樗沮渚狙猪疽箸紵苧菹著藷詛貯躇這邸雎齟勣吊嫡寂摘敵滴狄炙的積笛籍績翟荻謫賊赤跡蹟迪迹適鏑佃佺傳全典前剪塡塼奠專展廛悛戰栓殿氈澱"], -["efa1","煎琠田甸畑癲筌箋箭篆纏詮輾轉鈿銓錢鐫電顚顫餞切截折浙癤竊節絶占岾店漸点粘霑鮎點接摺蝶丁井亭停偵呈姃定幀庭廷征情挺政整旌晶晸柾楨檉正汀淀淨渟湞瀞炡玎珽町睛碇禎程穽精綎艇訂諪貞鄭酊釘鉦鋌錠霆靖"], -["f0a1","靜頂鼎制劑啼堤帝弟悌提梯濟祭第臍薺製諸蹄醍除際霽題齊俎兆凋助嘲弔彫措操早晁曺曹朝條棗槽漕潮照燥爪璪眺祖祚租稠窕粗糟組繰肇藻蚤詔調趙躁造遭釣阻雕鳥族簇足鏃存尊卒拙猝倧宗從悰慫棕淙琮種終綜縱腫"], -["f1a1","踪踵鍾鐘佐坐左座挫罪主住侏做姝胄呪周嗾奏宙州廚晝朱柱株注洲湊澍炷珠疇籌紂紬綢舟蛛註誅走躊輳週酎酒鑄駐竹粥俊儁准埈寯峻晙樽浚準濬焌畯竣蠢逡遵雋駿茁中仲衆重卽櫛楫汁葺增憎曾拯烝甑症繒蒸證贈之只"], -["f2a1","咫地址志持指摯支旨智枝枳止池沚漬知砥祉祗紙肢脂至芝芷蜘誌識贄趾遲直稙稷織職唇嗔塵振搢晉晋桭榛殄津溱珍瑨璡畛疹盡眞瞋秦縉縝臻蔯袗診賑軫辰進鎭陣陳震侄叱姪嫉帙桎瓆疾秩窒膣蛭質跌迭斟朕什執潗緝輯"], -["f3a1","鏶集徵懲澄且侘借叉嗟嵯差次此磋箚茶蹉車遮捉搾着窄錯鑿齪撰澯燦璨瓚竄簒纂粲纘讚贊鑽餐饌刹察擦札紮僭參塹慘慙懺斬站讒讖倉倡創唱娼廠彰愴敞昌昶暢槍滄漲猖瘡窓脹艙菖蒼債埰寀寨彩採砦綵菜蔡采釵冊柵策"], -["f4a1","責凄妻悽處倜刺剔尺慽戚拓擲斥滌瘠脊蹠陟隻仟千喘天川擅泉淺玔穿舛薦賤踐遷釧闡阡韆凸哲喆徹撤澈綴輟轍鐵僉尖沾添甛瞻簽籤詹諂堞妾帖捷牒疊睫諜貼輒廳晴淸聽菁請靑鯖切剃替涕滯締諦逮遞體初剿哨憔抄招梢"], -["f5a1","椒楚樵炒焦硝礁礎秒稍肖艸苕草蕉貂超酢醋醮促囑燭矗蜀觸寸忖村邨叢塚寵悤憁摠總聰蔥銃撮催崔最墜抽推椎楸樞湫皺秋芻萩諏趨追鄒酋醜錐錘鎚雛騶鰍丑畜祝竺筑築縮蓄蹙蹴軸逐春椿瑃出朮黜充忠沖蟲衝衷悴膵萃"], -["f6a1","贅取吹嘴娶就炊翠聚脆臭趣醉驟鷲側仄厠惻測層侈値嗤峙幟恥梔治淄熾痔痴癡稚穉緇緻置致蚩輜雉馳齒則勅飭親七柒漆侵寢枕沈浸琛砧針鍼蟄秤稱快他咤唾墮妥惰打拖朶楕舵陀馱駝倬卓啄坼度托拓擢晫柝濁濯琢琸託"], -["f7a1","鐸呑嘆坦彈憚歎灘炭綻誕奪脫探眈耽貪塔搭榻宕帑湯糖蕩兌台太怠態殆汰泰笞胎苔跆邰颱宅擇澤撑攄兎吐土討慟桶洞痛筒統通堆槌腿褪退頹偸套妬投透鬪慝特闖坡婆巴把播擺杷波派爬琶破罷芭跛頗判坂板版瓣販辦鈑"], -["f8a1","阪八叭捌佩唄悖敗沛浿牌狽稗覇貝彭澎烹膨愎便偏扁片篇編翩遍鞭騙貶坪平枰萍評吠嬖幣廢弊斃肺蔽閉陛佈包匍匏咆哺圃布怖抛抱捕暴泡浦疱砲胞脯苞葡蒲袍褒逋鋪飽鮑幅暴曝瀑爆輻俵剽彪慓杓標漂瓢票表豹飇飄驃"], -["f9a1","品稟楓諷豊風馮彼披疲皮被避陂匹弼必泌珌畢疋筆苾馝乏逼下何厦夏廈昰河瑕荷蝦賀遐霞鰕壑學虐謔鶴寒恨悍旱汗漢澣瀚罕翰閑閒限韓割轄函含咸啣喊檻涵緘艦銜陷鹹合哈盒蛤閤闔陜亢伉姮嫦巷恒抗杭桁沆港缸肛航"], -["faa1","行降項亥偕咳垓奚孩害懈楷海瀣蟹解該諧邂駭骸劾核倖幸杏荇行享向嚮珦鄕響餉饗香噓墟虛許憲櫶獻軒歇險驗奕爀赫革俔峴弦懸晛泫炫玄玹現眩睍絃絢縣舷衒見賢鉉顯孑穴血頁嫌俠協夾峽挾浹狹脅脇莢鋏頰亨兄刑型"], -["fba1","形泂滎瀅灐炯熒珩瑩荊螢衡逈邢鎣馨兮彗惠慧暳蕙蹊醯鞋乎互呼壕壺好岵弧戶扈昊晧毫浩淏湖滸澔濠濩灝狐琥瑚瓠皓祜糊縞胡芦葫蒿虎號蝴護豪鎬頀顥惑或酷婚昏混渾琿魂忽惚笏哄弘汞泓洪烘紅虹訌鴻化和嬅樺火畵"], -["fca1","禍禾花華話譁貨靴廓擴攫確碻穫丸喚奐宦幻患換歡晥桓渙煥環紈還驩鰥活滑猾豁闊凰幌徨恍惶愰慌晃晄榥況湟滉潢煌璜皇篁簧荒蝗遑隍黃匯回廻徊恢悔懷晦會檜淮澮灰獪繪膾茴蛔誨賄劃獲宖橫鐄哮嚆孝效斅曉梟涍淆"], -["fda1","爻肴酵驍侯候厚后吼喉嗅帿後朽煦珝逅勛勳塤壎焄熏燻薰訓暈薨喧暄煊萱卉喙毁彙徽揮暉煇諱輝麾休携烋畦虧恤譎鷸兇凶匈洶胸黑昕欣炘痕吃屹紇訖欠欽歆吸恰洽翕興僖凞喜噫囍姬嬉希憙憘戱晞曦熙熹熺犧禧稀羲詰"] -] diff --git a/node_modules/iconv-lite/encodings/tables/cp950.json b/node_modules/iconv-lite/encodings/tables/cp950.json deleted file mode 100644 index d8bc871..0000000 --- a/node_modules/iconv-lite/encodings/tables/cp950.json +++ /dev/null @@ -1,177 +0,0 @@ -[ -["0","\u0000",127], -["a140"," ,、。.‧;:?!︰…‥﹐﹑﹒·﹔﹕﹖﹗|–︱—︳╴︴﹏()︵︶{}︷︸〔〕︹︺【】︻︼《》︽︾〈〉︿﹀「」﹁﹂『』﹃﹄﹙﹚"], -["a1a1","﹛﹜﹝﹞‘’“”〝〞‵′#&*※§〃○●△▲◎☆★◇◆□■▽▼㊣℅¯ ̄_ˍ﹉﹊﹍﹎﹋﹌﹟﹠﹡+-×÷±√<>=≦≧≠∞≒≡﹢",4,"~∩∪⊥∠∟⊿㏒㏑∫∮∵∴♀♂⊕⊙↑↓←→↖↗↙↘∥∣/"], -["a240","\∕﹨$¥〒¢£%@℃℉﹩﹪﹫㏕㎜㎝㎞㏎㎡㎎㎏㏄°兙兛兞兝兡兣嗧瓩糎▁",7,"▏▎▍▌▋▊▉┼┴┬┤├▔─│▕┌┐└┘╭"], -["a2a1","╮╰╯═╞╪╡◢◣◥◤╱╲╳0",9,"Ⅰ",9,"〡",8,"十卄卅A",25,"a",21], -["a340","wxyzΑ",16,"Σ",6,"α",16,"σ",6,"ㄅ",10], -["a3a1","ㄐ",25,"˙ˉˊˇˋ"], -["a3e1","€"], -["a440","一乙丁七乃九了二人儿入八几刀刁力匕十卜又三下丈上丫丸凡久么也乞于亡兀刃勺千叉口土士夕大女子孑孓寸小尢尸山川工己已巳巾干廾弋弓才"], -["a4a1","丑丐不中丰丹之尹予云井互五亢仁什仃仆仇仍今介仄元允內六兮公冗凶分切刈勻勾勿化匹午升卅卞厄友及反壬天夫太夭孔少尤尺屯巴幻廿弔引心戈戶手扎支文斗斤方日曰月木欠止歹毋比毛氏水火爪父爻片牙牛犬王丙"], -["a540","世丕且丘主乍乏乎以付仔仕他仗代令仙仞充兄冉冊冬凹出凸刊加功包匆北匝仟半卉卡占卯卮去可古右召叮叩叨叼司叵叫另只史叱台句叭叻四囚外"], -["a5a1","央失奴奶孕它尼巨巧左市布平幼弁弘弗必戊打扔扒扑斥旦朮本未末札正母民氐永汁汀氾犯玄玉瓜瓦甘生用甩田由甲申疋白皮皿目矛矢石示禾穴立丞丟乒乓乩亙交亦亥仿伉伙伊伕伍伐休伏仲件任仰仳份企伋光兇兆先全"], -["a640","共再冰列刑划刎刖劣匈匡匠印危吉吏同吊吐吁吋各向名合吃后吆吒因回囝圳地在圭圬圯圩夙多夷夸妄奸妃好她如妁字存宇守宅安寺尖屹州帆并年"], -["a6a1","式弛忙忖戎戌戍成扣扛托收早旨旬旭曲曳有朽朴朱朵次此死氖汝汗汙江池汐汕污汛汍汎灰牟牝百竹米糸缶羊羽老考而耒耳聿肉肋肌臣自至臼舌舛舟艮色艾虫血行衣西阡串亨位住佇佗佞伴佛何估佐佑伽伺伸佃佔似但佣"], -["a740","作你伯低伶余佝佈佚兌克免兵冶冷別判利刪刨劫助努劬匣即卵吝吭吞吾否呎吧呆呃吳呈呂君吩告吹吻吸吮吵吶吠吼呀吱含吟听囪困囤囫坊坑址坍"], -["a7a1","均坎圾坐坏圻壯夾妝妒妨妞妣妙妖妍妤妓妊妥孝孜孚孛完宋宏尬局屁尿尾岐岑岔岌巫希序庇床廷弄弟彤形彷役忘忌志忍忱快忸忪戒我抄抗抖技扶抉扭把扼找批扳抒扯折扮投抓抑抆改攻攸旱更束李杏材村杜杖杞杉杆杠"], -["a840","杓杗步每求汞沙沁沈沉沅沛汪決沐汰沌汨沖沒汽沃汲汾汴沆汶沍沔沘沂灶灼災灸牢牡牠狄狂玖甬甫男甸皂盯矣私秀禿究系罕肖肓肝肘肛肚育良芒"], -["a8a1","芋芍見角言谷豆豕貝赤走足身車辛辰迂迆迅迄巡邑邢邪邦那酉釆里防阮阱阪阬並乖乳事些亞享京佯依侍佳使佬供例來侃佰併侈佩佻侖佾侏侑佺兔兒兕兩具其典冽函刻券刷刺到刮制剁劾劻卒協卓卑卦卷卸卹取叔受味呵"], -["a940","咖呸咕咀呻呷咄咒咆呼咐呱呶和咚呢周咋命咎固垃坷坪坩坡坦坤坼夜奉奇奈奄奔妾妻委妹妮姑姆姐姍始姓姊妯妳姒姅孟孤季宗定官宜宙宛尚屈居"], -["a9a1","屆岷岡岸岩岫岱岳帘帚帖帕帛帑幸庚店府底庖延弦弧弩往征彿彼忝忠忽念忿怏怔怯怵怖怪怕怡性怩怫怛或戕房戾所承拉拌拄抿拂抹拒招披拓拔拋拈抨抽押拐拙拇拍抵拚抱拘拖拗拆抬拎放斧於旺昔易昌昆昂明昀昏昕昊"], -["aa40","昇服朋杭枋枕東果杳杷枇枝林杯杰板枉松析杵枚枓杼杪杲欣武歧歿氓氛泣注泳沱泌泥河沽沾沼波沫法泓沸泄油況沮泗泅泱沿治泡泛泊沬泯泜泖泠"], -["aaa1","炕炎炒炊炙爬爭爸版牧物狀狎狙狗狐玩玨玟玫玥甽疝疙疚的盂盲直知矽社祀祁秉秈空穹竺糾罔羌羋者肺肥肢肱股肫肩肴肪肯臥臾舍芳芝芙芭芽芟芹花芬芥芯芸芣芰芾芷虎虱初表軋迎返近邵邸邱邶采金長門阜陀阿阻附"], -["ab40","陂隹雨青非亟亭亮信侵侯便俠俑俏保促侶俘俟俊俗侮俐俄係俚俎俞侷兗冒冑冠剎剃削前剌剋則勇勉勃勁匍南卻厚叛咬哀咨哎哉咸咦咳哇哂咽咪品"], -["aba1","哄哈咯咫咱咻咩咧咿囿垂型垠垣垢城垮垓奕契奏奎奐姜姘姿姣姨娃姥姪姚姦威姻孩宣宦室客宥封屎屏屍屋峙峒巷帝帥帟幽庠度建弈弭彥很待徊律徇後徉怒思怠急怎怨恍恰恨恢恆恃恬恫恪恤扁拜挖按拼拭持拮拽指拱拷"], -["ac40","拯括拾拴挑挂政故斫施既春昭映昧是星昨昱昤曷柿染柱柔某柬架枯柵柩柯柄柑枴柚查枸柏柞柳枰柙柢柝柒歪殃殆段毒毗氟泉洋洲洪流津洌洱洞洗"], -["aca1","活洽派洶洛泵洹洧洸洩洮洵洎洫炫為炳炬炯炭炸炮炤爰牲牯牴狩狠狡玷珊玻玲珍珀玳甚甭畏界畎畋疫疤疥疢疣癸皆皇皈盈盆盃盅省盹相眉看盾盼眇矜砂研砌砍祆祉祈祇禹禺科秒秋穿突竿竽籽紂紅紀紉紇約紆缸美羿耄"], -["ad40","耐耍耑耶胖胥胚胃胄背胡胛胎胞胤胝致舢苧范茅苣苛苦茄若茂茉苒苗英茁苜苔苑苞苓苟苯茆虐虹虻虺衍衫要觔計訂訃貞負赴赳趴軍軌述迦迢迪迥"], -["ada1","迭迫迤迨郊郎郁郃酋酊重閂限陋陌降面革韋韭音頁風飛食首香乘亳倌倍倣俯倦倥俸倩倖倆值借倚倒們俺倀倔倨俱倡個候倘俳修倭倪俾倫倉兼冤冥冢凍凌准凋剖剜剔剛剝匪卿原厝叟哨唐唁唷哼哥哲唆哺唔哩哭員唉哮哪"], -["ae40","哦唧唇哽唏圃圄埂埔埋埃堉夏套奘奚娑娘娜娟娛娓姬娠娣娩娥娌娉孫屘宰害家宴宮宵容宸射屑展屐峭峽峻峪峨峰島崁峴差席師庫庭座弱徒徑徐恙"], -["aea1","恣恥恐恕恭恩息悄悟悚悍悔悌悅悖扇拳挈拿捎挾振捕捂捆捏捉挺捐挽挪挫挨捍捌效敉料旁旅時晉晏晃晒晌晅晁書朔朕朗校核案框桓根桂桔栩梳栗桌桑栽柴桐桀格桃株桅栓栘桁殊殉殷氣氧氨氦氤泰浪涕消涇浦浸海浙涓"], -["af40","浬涉浮浚浴浩涌涊浹涅浥涔烊烘烤烙烈烏爹特狼狹狽狸狷玆班琉珮珠珪珞畔畝畜畚留疾病症疲疳疽疼疹痂疸皋皰益盍盎眩真眠眨矩砰砧砸砝破砷"], -["afa1","砥砭砠砟砲祕祐祠祟祖神祝祗祚秤秣秧租秦秩秘窄窈站笆笑粉紡紗紋紊素索純紐紕級紜納紙紛缺罟羔翅翁耆耘耕耙耗耽耿胱脂胰脅胭胴脆胸胳脈能脊胼胯臭臬舀舐航舫舨般芻茫荒荔荊茸荐草茵茴荏茲茹茶茗荀茱茨荃"], -["b040","虔蚊蚪蚓蚤蚩蚌蚣蚜衰衷袁袂衽衹記訐討訌訕訊託訓訖訏訑豈豺豹財貢起躬軒軔軏辱送逆迷退迺迴逃追逅迸邕郡郝郢酒配酌釘針釗釜釙閃院陣陡"], -["b0a1","陛陝除陘陞隻飢馬骨高鬥鬲鬼乾偺偽停假偃偌做偉健偶偎偕偵側偷偏倏偯偭兜冕凰剪副勒務勘動匐匏匙匿區匾參曼商啪啦啄啞啡啃啊唱啖問啕唯啤唸售啜唬啣唳啁啗圈國圉域堅堊堆埠埤基堂堵執培夠奢娶婁婉婦婪婀"], -["b140","娼婢婚婆婊孰寇寅寄寂宿密尉專將屠屜屝崇崆崎崛崖崢崑崩崔崙崤崧崗巢常帶帳帷康庸庶庵庾張強彗彬彩彫得徙從徘御徠徜恿患悉悠您惋悴惦悽"], -["b1a1","情悻悵惜悼惘惕惆惟悸惚惇戚戛扈掠控捲掖探接捷捧掘措捱掩掉掃掛捫推掄授掙採掬排掏掀捻捩捨捺敝敖救教敗啟敏敘敕敔斜斛斬族旋旌旎晝晚晤晨晦晞曹勗望梁梯梢梓梵桿桶梱梧梗械梃棄梭梆梅梔條梨梟梡梂欲殺"], -["b240","毫毬氫涎涼淳淙液淡淌淤添淺清淇淋涯淑涮淞淹涸混淵淅淒渚涵淚淫淘淪深淮淨淆淄涪淬涿淦烹焉焊烽烯爽牽犁猜猛猖猓猙率琅琊球理現琍瓠瓶"], -["b2a1","瓷甜產略畦畢異疏痔痕疵痊痍皎盔盒盛眷眾眼眶眸眺硫硃硎祥票祭移窒窕笠笨笛第符笙笞笮粒粗粕絆絃統紮紹紼絀細紳組累終紲紱缽羞羚翌翎習耜聊聆脯脖脣脫脩脰脤舂舵舷舶船莎莞莘荸莢莖莽莫莒莊莓莉莠荷荻荼"], -["b340","莆莧處彪蛇蛀蚶蛄蚵蛆蛋蚱蚯蛉術袞袈被袒袖袍袋覓規訪訝訣訥許設訟訛訢豉豚販責貫貨貪貧赧赦趾趺軛軟這逍通逗連速逝逐逕逞造透逢逖逛途"], -["b3a1","部郭都酗野釵釦釣釧釭釩閉陪陵陳陸陰陴陶陷陬雀雪雩章竟頂頃魚鳥鹵鹿麥麻傢傍傅備傑傀傖傘傚最凱割剴創剩勞勝勛博厥啻喀喧啼喊喝喘喂喜喪喔喇喋喃喳單喟唾喲喚喻喬喱啾喉喫喙圍堯堪場堤堰報堡堝堠壹壺奠"], -["b440","婷媚婿媒媛媧孳孱寒富寓寐尊尋就嵌嵐崴嵇巽幅帽幀幃幾廊廁廂廄弼彭復循徨惑惡悲悶惠愜愣惺愕惰惻惴慨惱愎惶愉愀愒戟扉掣掌描揀揩揉揆揍"], -["b4a1","插揣提握揖揭揮捶援揪換摒揚揹敞敦敢散斑斐斯普晰晴晶景暑智晾晷曾替期朝棺棕棠棘棗椅棟棵森棧棹棒棲棣棋棍植椒椎棉棚楮棻款欺欽殘殖殼毯氮氯氬港游湔渡渲湧湊渠渥渣減湛湘渤湖湮渭渦湯渴湍渺測湃渝渾滋"], -["b540","溉渙湎湣湄湲湩湟焙焚焦焰無然煮焜牌犄犀猶猥猴猩琺琪琳琢琥琵琶琴琯琛琦琨甥甦畫番痢痛痣痙痘痞痠登發皖皓皴盜睏短硝硬硯稍稈程稅稀窘"], -["b5a1","窗窖童竣等策筆筐筒答筍筋筏筑粟粥絞結絨絕紫絮絲絡給絢絰絳善翔翕耋聒肅腕腔腋腑腎脹腆脾腌腓腴舒舜菩萃菸萍菠菅萋菁華菱菴著萊菰萌菌菽菲菊萸萎萄菜萇菔菟虛蛟蛙蛭蛔蛛蛤蛐蛞街裁裂袱覃視註詠評詞証詁"], -["b640","詔詛詐詆訴診訶詖象貂貯貼貳貽賁費賀貴買貶貿貸越超趁跎距跋跚跑跌跛跆軻軸軼辜逮逵週逸進逶鄂郵鄉郾酣酥量鈔鈕鈣鈉鈞鈍鈐鈇鈑閔閏開閑"], -["b6a1","間閒閎隊階隋陽隅隆隍陲隄雁雅雄集雇雯雲韌項順須飧飪飯飩飲飭馮馭黃黍黑亂傭債傲傳僅傾催傷傻傯僇剿剷剽募勦勤勢勣匯嗟嗨嗓嗦嗎嗜嗇嗑嗣嗤嗯嗚嗡嗅嗆嗥嗉園圓塞塑塘塗塚塔填塌塭塊塢塒塋奧嫁嫉嫌媾媽媼"], -["b740","媳嫂媲嵩嵯幌幹廉廈弒彙徬微愚意慈感想愛惹愁愈慎慌慄慍愾愴愧愍愆愷戡戢搓搾搞搪搭搽搬搏搜搔損搶搖搗搆敬斟新暗暉暇暈暖暄暘暍會榔業"], -["b7a1","楚楷楠楔極椰概楊楨楫楞楓楹榆楝楣楛歇歲毀殿毓毽溢溯滓溶滂源溝滇滅溥溘溼溺溫滑準溜滄滔溪溧溴煎煙煩煤煉照煜煬煦煌煥煞煆煨煖爺牒猷獅猿猾瑯瑚瑕瑟瑞瑁琿瑙瑛瑜當畸瘀痰瘁痲痱痺痿痴痳盞盟睛睫睦睞督"], -["b840","睹睪睬睜睥睨睢矮碎碰碗碘碌碉硼碑碓硿祺祿禁萬禽稜稚稠稔稟稞窟窠筷節筠筮筧粱粳粵經絹綑綁綏絛置罩罪署義羨群聖聘肆肄腱腰腸腥腮腳腫"], -["b8a1","腹腺腦舅艇蒂葷落萱葵葦葫葉葬葛萼萵葡董葩葭葆虞虜號蛹蜓蜈蜇蜀蛾蛻蜂蜃蜆蜊衙裟裔裙補裘裝裡裊裕裒覜解詫該詳試詩詰誇詼詣誠話誅詭詢詮詬詹詻訾詨豢貊貉賊資賈賄貲賃賂賅跡跟跨路跳跺跪跤跦躲較載軾輊"], -["b940","辟農運遊道遂達逼違遐遇遏過遍遑逾遁鄒鄗酬酪酩釉鈷鉗鈸鈽鉀鈾鉛鉋鉤鉑鈴鉉鉍鉅鈹鈿鉚閘隘隔隕雍雋雉雊雷電雹零靖靴靶預頑頓頊頒頌飼飴"], -["b9a1","飽飾馳馱馴髡鳩麂鼎鼓鼠僧僮僥僖僭僚僕像僑僱僎僩兢凳劃劂匱厭嗾嘀嘛嘗嗽嘔嘆嘉嘍嘎嗷嘖嘟嘈嘐嗶團圖塵塾境墓墊塹墅塽壽夥夢夤奪奩嫡嫦嫩嫗嫖嫘嫣孵寞寧寡寥實寨寢寤察對屢嶄嶇幛幣幕幗幔廓廖弊彆彰徹慇"], -["ba40","愿態慷慢慣慟慚慘慵截撇摘摔撤摸摟摺摑摧搴摭摻敲斡旗旖暢暨暝榜榨榕槁榮槓構榛榷榻榫榴槐槍榭槌榦槃榣歉歌氳漳演滾漓滴漩漾漠漬漏漂漢"], -["baa1","滿滯漆漱漸漲漣漕漫漯澈漪滬漁滲滌滷熔熙煽熊熄熒爾犒犖獄獐瑤瑣瑪瑰瑭甄疑瘧瘍瘋瘉瘓盡監瞄睽睿睡磁碟碧碳碩碣禎福禍種稱窪窩竭端管箕箋筵算箝箔箏箸箇箄粹粽精綻綰綜綽綾綠緊綴網綱綺綢綿綵綸維緒緇綬"], -["bb40","罰翠翡翟聞聚肇腐膀膏膈膊腿膂臧臺與舔舞艋蓉蒿蓆蓄蒙蒞蒲蒜蓋蒸蓀蓓蒐蒼蓑蓊蜿蜜蜻蜢蜥蜴蜘蝕蜷蜩裳褂裴裹裸製裨褚裯誦誌語誣認誡誓誤"], -["bba1","說誥誨誘誑誚誧豪貍貌賓賑賒赫趙趕跼輔輒輕輓辣遠遘遜遣遙遞遢遝遛鄙鄘鄞酵酸酷酴鉸銀銅銘銖鉻銓銜銨鉼銑閡閨閩閣閥閤隙障際雌雒需靼鞅韶頗領颯颱餃餅餌餉駁骯骰髦魁魂鳴鳶鳳麼鼻齊億儀僻僵價儂儈儉儅凜"], -["bc40","劇劈劉劍劊勰厲嘮嘻嘹嘲嘿嘴嘩噓噎噗噴嘶嘯嘰墀墟增墳墜墮墩墦奭嬉嫻嬋嫵嬌嬈寮寬審寫層履嶝嶔幢幟幡廢廚廟廝廣廠彈影德徵慶慧慮慝慕憂"], -["bca1","慼慰慫慾憧憐憫憎憬憚憤憔憮戮摩摯摹撞撲撈撐撰撥撓撕撩撒撮播撫撚撬撙撢撳敵敷數暮暫暴暱樣樟槨樁樞標槽模樓樊槳樂樅槭樑歐歎殤毅毆漿潼澄潑潦潔澆潭潛潸潮澎潺潰潤澗潘滕潯潠潟熟熬熱熨牖犛獎獗瑩璋璃"], -["bd40","瑾璀畿瘠瘩瘟瘤瘦瘡瘢皚皺盤瞎瞇瞌瞑瞋磋磅確磊碾磕碼磐稿稼穀稽稷稻窯窮箭箱範箴篆篇篁箠篌糊締練緯緻緘緬緝編緣線緞緩綞緙緲緹罵罷羯"], -["bda1","翩耦膛膜膝膠膚膘蔗蔽蔚蓮蔬蔭蔓蔑蔣蔡蔔蓬蔥蓿蔆螂蝴蝶蝠蝦蝸蝨蝙蝗蝌蝓衛衝褐複褒褓褕褊誼諒談諄誕請諸課諉諂調誰論諍誶誹諛豌豎豬賠賞賦賤賬賭賢賣賜質賡赭趟趣踫踐踝踢踏踩踟踡踞躺輝輛輟輩輦輪輜輞"], -["be40","輥適遮遨遭遷鄰鄭鄧鄱醇醉醋醃鋅銻銷鋪銬鋤鋁銳銼鋒鋇鋰銲閭閱霄霆震霉靠鞍鞋鞏頡頫頜颳養餓餒餘駝駐駟駛駑駕駒駙骷髮髯鬧魅魄魷魯鴆鴉"], -["bea1","鴃麩麾黎墨齒儒儘儔儐儕冀冪凝劑劓勳噙噫噹噩噤噸噪器噥噱噯噬噢噶壁墾壇壅奮嬝嬴學寰導彊憲憑憩憊懍憶憾懊懈戰擅擁擋撻撼據擄擇擂操撿擒擔撾整曆曉暹曄曇暸樽樸樺橙橫橘樹橄橢橡橋橇樵機橈歙歷氅濂澱澡"], -["bf40","濃澤濁澧澳激澹澶澦澠澴熾燉燐燒燈燕熹燎燙燜燃燄獨璜璣璘璟璞瓢甌甍瘴瘸瘺盧盥瞠瞞瞟瞥磨磚磬磧禦積穎穆穌穋窺篙簑築篤篛篡篩篦糕糖縊"], -["bfa1","縑縈縛縣縞縝縉縐罹羲翰翱翮耨膳膩膨臻興艘艙蕊蕙蕈蕨蕩蕃蕉蕭蕪蕞螃螟螞螢融衡褪褲褥褫褡親覦諦諺諫諱謀諜諧諮諾謁謂諷諭諳諶諼豫豭貓賴蹄踱踴蹂踹踵輻輯輸輳辨辦遵遴選遲遼遺鄴醒錠錶鋸錳錯錢鋼錫錄錚"], -["c040","錐錦錡錕錮錙閻隧隨險雕霎霑霖霍霓霏靛靜靦鞘頰頸頻頷頭頹頤餐館餞餛餡餚駭駢駱骸骼髻髭鬨鮑鴕鴣鴦鴨鴒鴛默黔龍龜優償儡儲勵嚎嚀嚐嚅嚇"], -["c0a1","嚏壕壓壑壎嬰嬪嬤孺尷屨嶼嶺嶽嶸幫彌徽應懂懇懦懋戲戴擎擊擘擠擰擦擬擱擢擭斂斃曙曖檀檔檄檢檜櫛檣橾檗檐檠歜殮毚氈濘濱濟濠濛濤濫濯澀濬濡濩濕濮濰燧營燮燦燥燭燬燴燠爵牆獰獲璩環璦璨癆療癌盪瞳瞪瞰瞬"], -["c140","瞧瞭矯磷磺磴磯礁禧禪穗窿簇簍篾篷簌篠糠糜糞糢糟糙糝縮績繆縷縲繃縫總縱繅繁縴縹繈縵縿縯罄翳翼聱聲聰聯聳臆臃膺臂臀膿膽臉膾臨舉艱薪"], -["c1a1","薄蕾薜薑薔薯薛薇薨薊虧蟀蟑螳蟒蟆螫螻螺蟈蟋褻褶襄褸褽覬謎謗謙講謊謠謝謄謐豁谿豳賺賽購賸賻趨蹉蹋蹈蹊轄輾轂轅輿避遽還邁邂邀鄹醣醞醜鍍鎂錨鍵鍊鍥鍋錘鍾鍬鍛鍰鍚鍔闊闋闌闈闆隱隸雖霜霞鞠韓顆颶餵騁"], -["c240","駿鮮鮫鮪鮭鴻鴿麋黏點黜黝黛鼾齋叢嚕嚮壙壘嬸彝懣戳擴擲擾攆擺擻擷斷曜朦檳檬櫃檻檸櫂檮檯歟歸殯瀉瀋濾瀆濺瀑瀏燻燼燾燸獷獵璧璿甕癖癘"], -["c2a1","癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶臍臏舊藏薩藍藐藉薰薺薹薦蟯蟬蟲蟠覆覲觴謨謹謬謫豐贅蹙蹣蹦蹤蹟蹕軀轉轍邇邃邈醫醬釐鎔鎊鎖鎢鎳鎮鎬鎰鎘鎚鎗闔闖闐闕離雜雙雛雞霤鞣鞦"], -["c340","鞭韹額顏題顎顓颺餾餿餽餮馥騎髁鬃鬆魏魎魍鯊鯉鯽鯈鯀鵑鵝鵠黠鼕鼬儳嚥壞壟壢寵龐廬懲懷懶懵攀攏曠曝櫥櫝櫚櫓瀛瀟瀨瀚瀝瀕瀘爆爍牘犢獸"], -["c3a1","獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩藝藪藕藤藥藷蟻蠅蠍蟹蟾襠襟襖襞譁譜識證譚譎譏譆譙贈贊蹼蹲躇蹶蹬蹺蹴轔轎辭邊邋醱醮鏡鏑鏟鏃鏈鏜鏝鏖鏢鏍鏘鏤鏗鏨關隴難霪霧靡韜韻類"], -["c440","願顛颼饅饉騖騙鬍鯨鯧鯖鯛鶉鵡鵲鵪鵬麒麗麓麴勸嚨嚷嚶嚴嚼壤孀孃孽寶巉懸懺攘攔攙曦朧櫬瀾瀰瀲爐獻瓏癢癥礦礪礬礫竇競籌籃籍糯糰辮繽繼"], -["c4a1","纂罌耀臚艦藻藹蘑藺蘆蘋蘇蘊蠔蠕襤覺觸議譬警譯譟譫贏贍躉躁躅躂醴釋鐘鐃鏽闡霰飄饒饑馨騫騰騷騵鰓鰍鹹麵黨鼯齟齣齡儷儸囁囀囂夔屬巍懼懾攝攜斕曩櫻欄櫺殲灌爛犧瓖瓔癩矓籐纏續羼蘗蘭蘚蠣蠢蠡蠟襪襬覽譴"], -["c540","護譽贓躊躍躋轟辯醺鐮鐳鐵鐺鐸鐲鐫闢霸霹露響顧顥饗驅驃驀騾髏魔魑鰭鰥鶯鶴鷂鶸麝黯鼙齜齦齧儼儻囈囊囉孿巔巒彎懿攤權歡灑灘玀瓤疊癮癬"], -["c5a1","禳籠籟聾聽臟襲襯觼讀贖贗躑躓轡酈鑄鑑鑒霽霾韃韁顫饕驕驍髒鬚鱉鰱鰾鰻鷓鷗鼴齬齪龔囌巖戀攣攫攪曬欐瓚竊籤籣籥纓纖纔臢蘸蘿蠱變邐邏鑣鑠鑤靨顯饜驚驛驗髓體髑鱔鱗鱖鷥麟黴囑壩攬灞癱癲矗罐羈蠶蠹衢讓讒"], -["c640","讖艷贛釀鑪靂靈靄韆顰驟鬢魘鱟鷹鷺鹼鹽鼇齷齲廳欖灣籬籮蠻觀躡釁鑲鑰顱饞髖鬣黌灤矚讚鑷韉驢驥纜讜躪釅鑽鑾鑼鱷鱸黷豔鑿鸚爨驪鬱鸛鸞籲"], -["c940","乂乜凵匚厂万丌乇亍囗兀屮彳丏冇与丮亓仂仉仈冘勼卬厹圠夃夬尐巿旡殳毌气爿丱丼仨仜仩仡仝仚刌匜卌圢圣夗夯宁宄尒尻屴屳帄庀庂忉戉扐氕"], -["c9a1","氶汃氿氻犮犰玊禸肊阞伎优伬仵伔仱伀价伈伝伂伅伢伓伄仴伒冱刓刉刐劦匢匟卍厊吇囡囟圮圪圴夼妀奼妅奻奾奷奿孖尕尥屼屺屻屾巟幵庄异弚彴忕忔忏扜扞扤扡扦扢扙扠扚扥旯旮朾朹朸朻机朿朼朳氘汆汒汜汏汊汔汋"], -["ca40","汌灱牞犴犵玎甪癿穵网艸艼芀艽艿虍襾邙邗邘邛邔阢阤阠阣佖伻佢佉体佤伾佧佒佟佁佘伭伳伿佡冏冹刜刞刡劭劮匉卣卲厎厏吰吷吪呔呅吙吜吥吘"], -["caa1","吽呏呁吨吤呇囮囧囥坁坅坌坉坋坒夆奀妦妘妠妗妎妢妐妏妧妡宎宒尨尪岍岏岈岋岉岒岊岆岓岕巠帊帎庋庉庌庈庍弅弝彸彶忒忑忐忭忨忮忳忡忤忣忺忯忷忻怀忴戺抃抌抎抏抔抇扱扻扺扰抁抈扷扽扲扴攷旰旴旳旲旵杅杇"], -["cb40","杙杕杌杈杝杍杚杋毐氙氚汸汧汫沄沋沏汱汯汩沚汭沇沕沜汦汳汥汻沎灴灺牣犿犽狃狆狁犺狅玕玗玓玔玒町甹疔疕皁礽耴肕肙肐肒肜芐芏芅芎芑芓"], -["cba1","芊芃芄豸迉辿邟邡邥邞邧邠阰阨阯阭丳侘佼侅佽侀侇佶佴侉侄佷佌侗佪侚佹侁佸侐侜侔侞侒侂侕佫佮冞冼冾刵刲刳剆刱劼匊匋匼厒厔咇呿咁咑咂咈呫呺呾呥呬呴呦咍呯呡呠咘呣呧呤囷囹坯坲坭坫坱坰坶垀坵坻坳坴坢"], -["cc40","坨坽夌奅妵妺姏姎妲姌姁妶妼姃姖妱妽姀姈妴姇孢孥宓宕屄屇岮岤岠岵岯岨岬岟岣岭岢岪岧岝岥岶岰岦帗帔帙弨弢弣弤彔徂彾彽忞忥怭怦怙怲怋"], -["cca1","怴怊怗怳怚怞怬怢怍怐怮怓怑怌怉怜戔戽抭抴拑抾抪抶拊抮抳抯抻抩抰抸攽斨斻昉旼昄昒昈旻昃昋昍昅旽昑昐曶朊枅杬枎枒杶杻枘枆构杴枍枌杺枟枑枙枃杽极杸杹枔欥殀歾毞氝沓泬泫泮泙沶泔沭泧沷泐泂沺泃泆泭泲"], -["cd40","泒泝沴沊沝沀泞泀洰泍泇沰泹泏泩泑炔炘炅炓炆炄炑炖炂炚炃牪狖狋狘狉狜狒狔狚狌狑玤玡玭玦玢玠玬玝瓝瓨甿畀甾疌疘皯盳盱盰盵矸矼矹矻矺"], -["cda1","矷祂礿秅穸穻竻籵糽耵肏肮肣肸肵肭舠芠苀芫芚芘芛芵芧芮芼芞芺芴芨芡芩苂芤苃芶芢虰虯虭虮豖迒迋迓迍迖迕迗邲邴邯邳邰阹阽阼阺陃俍俅俓侲俉俋俁俔俜俙侻侳俛俇俖侺俀侹俬剄剉勀勂匽卼厗厖厙厘咺咡咭咥哏"], -["ce40","哃茍咷咮哖咶哅哆咠呰咼咢咾呲哞咰垵垞垟垤垌垗垝垛垔垘垏垙垥垚垕壴复奓姡姞姮娀姱姝姺姽姼姶姤姲姷姛姩姳姵姠姾姴姭宨屌峐峘峌峗峋峛"], -["cea1","峞峚峉峇峊峖峓峔峏峈峆峎峟峸巹帡帢帣帠帤庰庤庢庛庣庥弇弮彖徆怷怹恔恲恞恅恓恇恉恛恌恀恂恟怤恄恘恦恮扂扃拏挍挋拵挎挃拫拹挏挌拸拶挀挓挔拺挕拻拰敁敃斪斿昶昡昲昵昜昦昢昳昫昺昝昴昹昮朏朐柁柲柈枺"], -["cf40","柜枻柸柘柀枷柅柫柤柟枵柍枳柷柶柮柣柂枹柎柧柰枲柼柆柭柌枮柦柛柺柉柊柃柪柋欨殂殄殶毖毘毠氠氡洨洴洭洟洼洿洒洊泚洳洄洙洺洚洑洀洝浂"], -["cfa1","洁洘洷洃洏浀洇洠洬洈洢洉洐炷炟炾炱炰炡炴炵炩牁牉牊牬牰牳牮狊狤狨狫狟狪狦狣玅珌珂珈珅玹玶玵玴珫玿珇玾珃珆玸珋瓬瓮甮畇畈疧疪癹盄眈眃眄眅眊盷盻盺矧矨砆砑砒砅砐砏砎砉砃砓祊祌祋祅祄秕种秏秖秎窀"], -["d040","穾竑笀笁籺籸籹籿粀粁紃紈紁罘羑羍羾耇耎耏耔耷胘胇胠胑胈胂胐胅胣胙胜胊胕胉胏胗胦胍臿舡芔苙苾苹茇苨茀苕茺苫苖苴苬苡苲苵茌苻苶苰苪"], -["d0a1","苤苠苺苳苭虷虴虼虳衁衎衧衪衩觓訄訇赲迣迡迮迠郱邽邿郕郅邾郇郋郈釔釓陔陏陑陓陊陎倞倅倇倓倢倰倛俵俴倳倷倬俶俷倗倜倠倧倵倯倱倎党冔冓凊凄凅凈凎剡剚剒剞剟剕剢勍匎厞唦哢唗唒哧哳哤唚哿唄唈哫唑唅哱"], -["d140","唊哻哷哸哠唎唃唋圁圂埌堲埕埒垺埆垽垼垸垶垿埇埐垹埁夎奊娙娖娭娮娕娏娗娊娞娳孬宧宭宬尃屖屔峬峿峮峱峷崀峹帩帨庨庮庪庬弳弰彧恝恚恧"], -["d1a1","恁悢悈悀悒悁悝悃悕悛悗悇悜悎戙扆拲挐捖挬捄捅挶捃揤挹捋捊挼挩捁挴捘捔捙挭捇挳捚捑挸捗捀捈敊敆旆旃旄旂晊晟晇晑朒朓栟栚桉栲栳栻桋桏栖栱栜栵栫栭栯桎桄栴栝栒栔栦栨栮桍栺栥栠欬欯欭欱欴歭肂殈毦毤"], -["d240","毨毣毢毧氥浺浣浤浶洍浡涒浘浢浭浯涑涍淯浿涆浞浧浠涗浰浼浟涂涘洯浨涋浾涀涄洖涃浻浽浵涐烜烓烑烝烋缹烢烗烒烞烠烔烍烅烆烇烚烎烡牂牸"], -["d2a1","牷牶猀狺狴狾狶狳狻猁珓珙珥珖玼珧珣珩珜珒珛珔珝珚珗珘珨瓞瓟瓴瓵甡畛畟疰痁疻痄痀疿疶疺皊盉眝眛眐眓眒眣眑眕眙眚眢眧砣砬砢砵砯砨砮砫砡砩砳砪砱祔祛祏祜祓祒祑秫秬秠秮秭秪秜秞秝窆窉窅窋窌窊窇竘笐"], -["d340","笄笓笅笏笈笊笎笉笒粄粑粊粌粈粍粅紞紝紑紎紘紖紓紟紒紏紌罜罡罞罠罝罛羖羒翃翂翀耖耾耹胺胲胹胵脁胻脀舁舯舥茳茭荄茙荑茥荖茿荁茦茜茢"], -["d3a1","荂荎茛茪茈茼荍茖茤茠茷茯茩荇荅荌荓茞茬荋茧荈虓虒蚢蚨蚖蚍蚑蚞蚇蚗蚆蚋蚚蚅蚥蚙蚡蚧蚕蚘蚎蚝蚐蚔衃衄衭衵衶衲袀衱衿衯袃衾衴衼訒豇豗豻貤貣赶赸趵趷趶軑軓迾迵适迿迻逄迼迶郖郠郙郚郣郟郥郘郛郗郜郤酐"], -["d440","酎酏釕釢釚陜陟隼飣髟鬯乿偰偪偡偞偠偓偋偝偲偈偍偁偛偊偢倕偅偟偩偫偣偤偆偀偮偳偗偑凐剫剭剬剮勖勓匭厜啵啶唼啍啐唴唪啑啢唶唵唰啒啅"], -["d4a1","唌唲啥啎唹啈唭唻啀啋圊圇埻堔埢埶埜埴堀埭埽堈埸堋埳埏堇埮埣埲埥埬埡堎埼堐埧堁堌埱埩埰堍堄奜婠婘婕婧婞娸娵婭婐婟婥婬婓婤婗婃婝婒婄婛婈媎娾婍娹婌婰婩婇婑婖婂婜孲孮寁寀屙崞崋崝崚崠崌崨崍崦崥崏"], -["d540","崰崒崣崟崮帾帴庱庴庹庲庳弶弸徛徖徟悊悐悆悾悰悺惓惔惏惤惙惝惈悱惛悷惊悿惃惍惀挲捥掊掂捽掽掞掭掝掗掫掎捯掇掐据掯捵掜捭掮捼掤挻掟"], -["d5a1","捸掅掁掑掍捰敓旍晥晡晛晙晜晢朘桹梇梐梜桭桮梮梫楖桯梣梬梩桵桴梲梏桷梒桼桫桲梪梀桱桾梛梖梋梠梉梤桸桻梑梌梊桽欶欳欷欸殑殏殍殎殌氪淀涫涴涳湴涬淩淢涷淶淔渀淈淠淟淖涾淥淜淝淛淴淊涽淭淰涺淕淂淏淉"], -["d640","淐淲淓淽淗淍淣涻烺焍烷焗烴焌烰焄烳焐烼烿焆焓焀烸烶焋焂焎牾牻牼牿猝猗猇猑猘猊猈狿猏猞玈珶珸珵琄琁珽琇琀珺珼珿琌琋珴琈畤畣痎痒痏"], -["d6a1","痋痌痑痐皏皉盓眹眯眭眱眲眴眳眽眥眻眵硈硒硉硍硊硌砦硅硐祤祧祩祪祣祫祡离秺秸秶秷窏窔窐笵筇笴笥笰笢笤笳笘笪笝笱笫笭笯笲笸笚笣粔粘粖粣紵紽紸紶紺絅紬紩絁絇紾紿絊紻紨罣羕羜羝羛翊翋翍翐翑翇翏翉耟"], -["d740","耞耛聇聃聈脘脥脙脛脭脟脬脞脡脕脧脝脢舑舸舳舺舴舲艴莐莣莨莍荺荳莤荴莏莁莕莙荵莔莩荽莃莌莝莛莪莋荾莥莯莈莗莰荿莦莇莮荶莚虙虖蚿蚷"], -["d7a1","蛂蛁蛅蚺蚰蛈蚹蚳蚸蛌蚴蚻蚼蛃蚽蚾衒袉袕袨袢袪袚袑袡袟袘袧袙袛袗袤袬袌袓袎覂觖觙觕訰訧訬訞谹谻豜豝豽貥赽赻赹趼跂趹趿跁軘軞軝軜軗軠軡逤逋逑逜逌逡郯郪郰郴郲郳郔郫郬郩酖酘酚酓酕釬釴釱釳釸釤釹釪"], -["d840","釫釷釨釮镺閆閈陼陭陫陱陯隿靪頄飥馗傛傕傔傞傋傣傃傌傎傝偨傜傒傂傇兟凔匒匑厤厧喑喨喥喭啷噅喢喓喈喏喵喁喣喒喤啽喌喦啿喕喡喎圌堩堷"], -["d8a1","堙堞堧堣堨埵塈堥堜堛堳堿堶堮堹堸堭堬堻奡媯媔媟婺媢媞婸媦婼媥媬媕媮娷媄媊媗媃媋媩婻婽媌媜媏媓媝寪寍寋寔寑寊寎尌尰崷嵃嵫嵁嵋崿崵嵑嵎嵕崳崺嵒崽崱嵙嵂崹嵉崸崼崲崶嵀嵅幄幁彘徦徥徫惉悹惌惢惎惄愔"], -["d940","惲愊愖愅惵愓惸惼惾惁愃愘愝愐惿愄愋扊掔掱掰揎揥揨揯揃撝揳揊揠揶揕揲揵摡揟掾揝揜揄揘揓揂揇揌揋揈揰揗揙攲敧敪敤敜敨敥斌斝斞斮旐旒"], -["d9a1","晼晬晻暀晱晹晪晲朁椌棓椄棜椪棬棪棱椏棖棷棫棤棶椓椐棳棡椇棌椈楰梴椑棯棆椔棸棐棽棼棨椋椊椗棎棈棝棞棦棴棑椆棔棩椕椥棇欹欻欿欼殔殗殙殕殽毰毲毳氰淼湆湇渟湉溈渼渽湅湢渫渿湁湝湳渜渳湋湀湑渻渃渮湞"], -["da40","湨湜湡渱渨湠湱湫渹渢渰湓湥渧湸湤湷湕湹湒湦渵渶湚焠焞焯烻焮焱焣焥焢焲焟焨焺焛牋牚犈犉犆犅犋猒猋猰猢猱猳猧猲猭猦猣猵猌琮琬琰琫琖"], -["daa1","琚琡琭琱琤琣琝琩琠琲瓻甯畯畬痧痚痡痦痝痟痤痗皕皒盚睆睇睄睍睅睊睎睋睌矞矬硠硤硥硜硭硱硪确硰硩硨硞硢祴祳祲祰稂稊稃稌稄窙竦竤筊笻筄筈筌筎筀筘筅粢粞粨粡絘絯絣絓絖絧絪絏絭絜絫絒絔絩絑絟絎缾缿罥"], -["db40","罦羢羠羡翗聑聏聐胾胔腃腊腒腏腇脽腍脺臦臮臷臸臹舄舼舽舿艵茻菏菹萣菀菨萒菧菤菼菶萐菆菈菫菣莿萁菝菥菘菿菡菋菎菖菵菉萉萏菞萑萆菂菳"], -["dba1","菕菺菇菑菪萓菃菬菮菄菻菗菢萛菛菾蛘蛢蛦蛓蛣蛚蛪蛝蛫蛜蛬蛩蛗蛨蛑衈衖衕袺裗袹袸裀袾袶袼袷袽袲褁裉覕覘覗觝觚觛詎詍訹詙詀詗詘詄詅詒詈詑詊詌詏豟貁貀貺貾貰貹貵趄趀趉跘跓跍跇跖跜跏跕跙跈跗跅軯軷軺"], -["dc40","軹軦軮軥軵軧軨軶軫軱軬軴軩逭逴逯鄆鄬鄄郿郼鄈郹郻鄁鄀鄇鄅鄃酡酤酟酢酠鈁鈊鈥鈃鈚鈦鈏鈌鈀鈒釿釽鈆鈄鈧鈂鈜鈤鈙鈗鈅鈖镻閍閌閐隇陾隈"], -["dca1","隉隃隀雂雈雃雱雰靬靰靮頇颩飫鳦黹亃亄亶傽傿僆傮僄僊傴僈僂傰僁傺傱僋僉傶傸凗剺剸剻剼嗃嗛嗌嗐嗋嗊嗝嗀嗔嗄嗩喿嗒喍嗏嗕嗢嗖嗈嗲嗍嗙嗂圔塓塨塤塏塍塉塯塕塎塝塙塥塛堽塣塱壼嫇嫄嫋媺媸媱媵媰媿嫈媻嫆"], -["dd40","媷嫀嫊媴媶嫍媹媐寖寘寙尟尳嵱嵣嵊嵥嵲嵬嵞嵨嵧嵢巰幏幎幊幍幋廅廌廆廋廇彀徯徭惷慉慊愫慅愶愲愮慆愯慏愩慀戠酨戣戥戤揅揱揫搐搒搉搠搤"], -["dda1","搳摃搟搕搘搹搷搢搣搌搦搰搨摁搵搯搊搚摀搥搧搋揧搛搮搡搎敯斒旓暆暌暕暐暋暊暙暔晸朠楦楟椸楎楢楱椿楅楪椹楂楗楙楺楈楉椵楬椳椽楥棰楸椴楩楀楯楄楶楘楁楴楌椻楋椷楜楏楑椲楒椯楻椼歆歅歃歂歈歁殛嗀毻毼"], -["de40","毹毷毸溛滖滈溏滀溟溓溔溠溱溹滆滒溽滁溞滉溷溰滍溦滏溲溾滃滜滘溙溒溎溍溤溡溿溳滐滊溗溮溣煇煔煒煣煠煁煝煢煲煸煪煡煂煘煃煋煰煟煐煓"], -["dea1","煄煍煚牏犍犌犑犐犎猼獂猻猺獀獊獉瑄瑊瑋瑒瑑瑗瑀瑏瑐瑎瑂瑆瑍瑔瓡瓿瓾瓽甝畹畷榃痯瘏瘃痷痾痼痹痸瘐痻痶痭痵痽皙皵盝睕睟睠睒睖睚睩睧睔睙睭矠碇碚碔碏碄碕碅碆碡碃硹碙碀碖硻祼禂祽祹稑稘稙稒稗稕稢稓"], -["df40","稛稐窣窢窞竫筦筤筭筴筩筲筥筳筱筰筡筸筶筣粲粴粯綈綆綀綍絿綅絺綎絻綃絼綌綔綄絽綒罭罫罧罨罬羦羥羧翛翜耡腤腠腷腜腩腛腢腲朡腞腶腧腯"], -["dfa1","腄腡舝艉艄艀艂艅蓱萿葖葶葹蒏蒍葥葑葀蒆葧萰葍葽葚葙葴葳葝蔇葞萷萺萴葺葃葸萲葅萩菙葋萯葂萭葟葰萹葎葌葒葯蓅蒎萻葇萶萳葨葾葄萫葠葔葮葐蜋蜄蛷蜌蛺蛖蛵蝍蛸蜎蜉蜁蛶蜍蜅裖裋裍裎裞裛裚裌裐覅覛觟觥觤"], -["e040","觡觠觢觜触詶誆詿詡訿詷誂誄詵誃誁詴詺谼豋豊豥豤豦貆貄貅賌赨赩趑趌趎趏趍趓趔趐趒跰跠跬跱跮跐跩跣跢跧跲跫跴輆軿輁輀輅輇輈輂輋遒逿"], -["e0a1","遄遉逽鄐鄍鄏鄑鄖鄔鄋鄎酮酯鉈鉒鈰鈺鉦鈳鉥鉞銃鈮鉊鉆鉭鉬鉏鉠鉧鉯鈶鉡鉰鈱鉔鉣鉐鉲鉎鉓鉌鉖鈲閟閜閞閛隒隓隑隗雎雺雽雸雵靳靷靸靲頏頍頎颬飶飹馯馲馰馵骭骫魛鳪鳭鳧麀黽僦僔僗僨僳僛僪僝僤僓僬僰僯僣僠"], -["e140","凘劀劁勩勫匰厬嘧嘕嘌嘒嗼嘏嘜嘁嘓嘂嗺嘝嘄嗿嗹墉塼墐墘墆墁塿塴墋塺墇墑墎塶墂墈塻墔墏壾奫嫜嫮嫥嫕嫪嫚嫭嫫嫳嫢嫠嫛嫬嫞嫝嫙嫨嫟孷寠"], -["e1a1","寣屣嶂嶀嵽嶆嵺嶁嵷嶊嶉嶈嵾嵼嶍嵹嵿幘幙幓廘廑廗廎廜廕廙廒廔彄彃彯徶愬愨慁慞慱慳慒慓慲慬憀慴慔慺慛慥愻慪慡慖戩戧戫搫摍摛摝摴摶摲摳摽摵摦撦摎撂摞摜摋摓摠摐摿搿摬摫摙摥摷敳斠暡暠暟朅朄朢榱榶槉"], -["e240","榠槎榖榰榬榼榑榙榎榧榍榩榾榯榿槄榽榤槔榹槊榚槏榳榓榪榡榞槙榗榐槂榵榥槆歊歍歋殞殟殠毃毄毾滎滵滱漃漥滸漷滻漮漉潎漙漚漧漘漻漒滭漊"], -["e2a1","漶潳滹滮漭潀漰漼漵滫漇漎潃漅滽滶漹漜滼漺漟漍漞漈漡熇熐熉熀熅熂熏煻熆熁熗牄牓犗犕犓獃獍獑獌瑢瑳瑱瑵瑲瑧瑮甀甂甃畽疐瘖瘈瘌瘕瘑瘊瘔皸瞁睼瞅瞂睮瞀睯睾瞃碲碪碴碭碨硾碫碞碥碠碬碢碤禘禊禋禖禕禔禓"], -["e340","禗禈禒禐稫穊稰稯稨稦窨窫窬竮箈箜箊箑箐箖箍箌箛箎箅箘劄箙箤箂粻粿粼粺綧綷緂綣綪緁緀緅綝緎緄緆緋緌綯綹綖綼綟綦綮綩綡緉罳翢翣翥翞"], -["e3a1","耤聝聜膉膆膃膇膍膌膋舕蒗蒤蒡蒟蒺蓎蓂蒬蒮蒫蒹蒴蓁蓍蒪蒚蒱蓐蒝蒧蒻蒢蒔蓇蓌蒛蒩蒯蒨蓖蒘蒶蓏蒠蓗蓔蓒蓛蒰蒑虡蜳蜣蜨蝫蝀蜮蜞蜡蜙蜛蝃蜬蝁蜾蝆蜠蜲蜪蜭蜼蜒蜺蜱蜵蝂蜦蜧蜸蜤蜚蜰蜑裷裧裱裲裺裾裮裼裶裻"], -["e440","裰裬裫覝覡覟覞觩觫觨誫誙誋誒誏誖谽豨豩賕賏賗趖踉踂跿踍跽踊踃踇踆踅跾踀踄輐輑輎輍鄣鄜鄠鄢鄟鄝鄚鄤鄡鄛酺酲酹酳銥銤鉶銛鉺銠銔銪銍"], -["e4a1","銦銚銫鉹銗鉿銣鋮銎銂銕銢鉽銈銡銊銆銌銙銧鉾銇銩銝銋鈭隞隡雿靘靽靺靾鞃鞀鞂靻鞄鞁靿韎韍頖颭颮餂餀餇馝馜駃馹馻馺駂馽駇骱髣髧鬾鬿魠魡魟鳱鳲鳵麧僿儃儰僸儆儇僶僾儋儌僽儊劋劌勱勯噈噂噌嘵噁噊噉噆噘"], -["e540","噚噀嘳嘽嘬嘾嘸嘪嘺圚墫墝墱墠墣墯墬墥墡壿嫿嫴嫽嫷嫶嬃嫸嬂嫹嬁嬇嬅嬏屧嶙嶗嶟嶒嶢嶓嶕嶠嶜嶡嶚嶞幩幝幠幜緳廛廞廡彉徲憋憃慹憱憰憢憉"], -["e5a1","憛憓憯憭憟憒憪憡憍慦憳戭摮摰撖撠撅撗撜撏撋撊撌撣撟摨撱撘敶敺敹敻斲斳暵暰暩暲暷暪暯樀樆樗槥槸樕槱槤樠槿槬槢樛樝槾樧槲槮樔槷槧橀樈槦槻樍槼槫樉樄樘樥樏槶樦樇槴樖歑殥殣殢殦氁氀毿氂潁漦潾澇濆澒"], -["e640","澍澉澌潢潏澅潚澖潶潬澂潕潲潒潐潗澔澓潝漀潡潫潽潧澐潓澋潩潿澕潣潷潪潻熲熯熛熰熠熚熩熵熝熥熞熤熡熪熜熧熳犘犚獘獒獞獟獠獝獛獡獚獙"], -["e6a1","獢璇璉璊璆璁瑽璅璈瑼瑹甈甇畾瘥瘞瘙瘝瘜瘣瘚瘨瘛皜皝皞皛瞍瞏瞉瞈磍碻磏磌磑磎磔磈磃磄磉禚禡禠禜禢禛歶稹窲窴窳箷篋箾箬篎箯箹篊箵糅糈糌糋緷緛緪緧緗緡縃緺緦緶緱緰緮緟罶羬羰羭翭翫翪翬翦翨聤聧膣膟"], -["e740","膞膕膢膙膗舖艏艓艒艐艎艑蔤蔻蔏蔀蔩蔎蔉蔍蔟蔊蔧蔜蓻蔫蓺蔈蔌蓴蔪蓲蔕蓷蓫蓳蓼蔒蓪蓩蔖蓾蔨蔝蔮蔂蓽蔞蓶蔱蔦蓧蓨蓰蓯蓹蔘蔠蔰蔋蔙蔯虢"], -["e7a1","蝖蝣蝤蝷蟡蝳蝘蝔蝛蝒蝡蝚蝑蝞蝭蝪蝐蝎蝟蝝蝯蝬蝺蝮蝜蝥蝏蝻蝵蝢蝧蝩衚褅褌褔褋褗褘褙褆褖褑褎褉覢覤覣觭觰觬諏諆誸諓諑諔諕誻諗誾諀諅諘諃誺誽諙谾豍貏賥賟賙賨賚賝賧趠趜趡趛踠踣踥踤踮踕踛踖踑踙踦踧"], -["e840","踔踒踘踓踜踗踚輬輤輘輚輠輣輖輗遳遰遯遧遫鄯鄫鄩鄪鄲鄦鄮醅醆醊醁醂醄醀鋐鋃鋄鋀鋙銶鋏鋱鋟鋘鋩鋗鋝鋌鋯鋂鋨鋊鋈鋎鋦鋍鋕鋉鋠鋞鋧鋑鋓"], -["e8a1","銵鋡鋆銴镼閬閫閮閰隤隢雓霅霈霂靚鞊鞎鞈韐韏頞頝頦頩頨頠頛頧颲餈飺餑餔餖餗餕駜駍駏駓駔駎駉駖駘駋駗駌骳髬髫髳髲髱魆魃魧魴魱魦魶魵魰魨魤魬鳼鳺鳽鳿鳷鴇鴀鳹鳻鴈鴅鴄麃黓鼏鼐儜儓儗儚儑凞匴叡噰噠噮"], -["e940","噳噦噣噭噲噞噷圜圛壈墽壉墿墺壂墼壆嬗嬙嬛嬡嬔嬓嬐嬖嬨嬚嬠嬞寯嶬嶱嶩嶧嶵嶰嶮嶪嶨嶲嶭嶯嶴幧幨幦幯廩廧廦廨廥彋徼憝憨憖懅憴懆懁懌憺"], -["e9a1","憿憸憌擗擖擐擏擉撽撉擃擛擳擙攳敿敼斢曈暾曀曊曋曏暽暻暺曌朣樴橦橉橧樲橨樾橝橭橶橛橑樨橚樻樿橁橪橤橐橏橔橯橩橠樼橞橖橕橍橎橆歕歔歖殧殪殫毈毇氄氃氆澭濋澣濇澼濎濈潞濄澽澞濊澨瀄澥澮澺澬澪濏澿澸"], -["ea40","澢濉澫濍澯澲澰燅燂熿熸燖燀燁燋燔燊燇燏熽燘熼燆燚燛犝犞獩獦獧獬獥獫獪瑿璚璠璔璒璕璡甋疀瘯瘭瘱瘽瘳瘼瘵瘲瘰皻盦瞚瞝瞡瞜瞛瞢瞣瞕瞙"], -["eaa1","瞗磝磩磥磪磞磣磛磡磢磭磟磠禤穄穈穇窶窸窵窱窷篞篣篧篝篕篥篚篨篹篔篪篢篜篫篘篟糒糔糗糐糑縒縡縗縌縟縠縓縎縜縕縚縢縋縏縖縍縔縥縤罃罻罼罺羱翯耪耩聬膱膦膮膹膵膫膰膬膴膲膷膧臲艕艖艗蕖蕅蕫蕍蕓蕡蕘"], -["eb40","蕀蕆蕤蕁蕢蕄蕑蕇蕣蔾蕛蕱蕎蕮蕵蕕蕧蕠薌蕦蕝蕔蕥蕬虣虥虤螛螏螗螓螒螈螁螖螘蝹螇螣螅螐螑螝螄螔螜螚螉褞褦褰褭褮褧褱褢褩褣褯褬褟觱諠"], -["eba1","諢諲諴諵諝謔諤諟諰諈諞諡諨諿諯諻貑貒貐賵賮賱賰賳赬赮趥趧踳踾踸蹀蹅踶踼踽蹁踰踿躽輶輮輵輲輹輷輴遶遹遻邆郺鄳鄵鄶醓醐醑醍醏錧錞錈錟錆錏鍺錸錼錛錣錒錁鍆錭錎錍鋋錝鋺錥錓鋹鋷錴錂錤鋿錩錹錵錪錔錌"], -["ec40","錋鋾錉錀鋻錖閼闍閾閹閺閶閿閵閽隩雔霋霒霐鞙鞗鞔韰韸頵頯頲餤餟餧餩馞駮駬駥駤駰駣駪駩駧骹骿骴骻髶髺髹髷鬳鮀鮅鮇魼魾魻鮂鮓鮒鮐魺鮕"], -["eca1","魽鮈鴥鴗鴠鴞鴔鴩鴝鴘鴢鴐鴙鴟麈麆麇麮麭黕黖黺鼒鼽儦儥儢儤儠儩勴嚓嚌嚍嚆嚄嚃噾嚂噿嚁壖壔壏壒嬭嬥嬲嬣嬬嬧嬦嬯嬮孻寱寲嶷幬幪徾徻懃憵憼懧懠懥懤懨懞擯擩擣擫擤擨斁斀斶旚曒檍檖檁檥檉檟檛檡檞檇檓檎"], -["ed40","檕檃檨檤檑橿檦檚檅檌檒歛殭氉濌澩濴濔濣濜濭濧濦濞濲濝濢濨燡燱燨燲燤燰燢獳獮獯璗璲璫璐璪璭璱璥璯甐甑甒甏疄癃癈癉癇皤盩瞵瞫瞲瞷瞶"], -["eda1","瞴瞱瞨矰磳磽礂磻磼磲礅磹磾礄禫禨穜穛穖穘穔穚窾竀竁簅簏篲簀篿篻簎篴簋篳簂簉簃簁篸篽簆篰篱簐簊糨縭縼繂縳顈縸縪繉繀繇縩繌縰縻縶繄縺罅罿罾罽翴翲耬膻臄臌臊臅臇膼臩艛艚艜薃薀薏薧薕薠薋薣蕻薤薚薞"], -["ee40","蕷蕼薉薡蕺蕸蕗薎薖薆薍薙薝薁薢薂薈薅蕹蕶薘薐薟虨螾螪螭蟅螰螬螹螵螼螮蟉蟃蟂蟌螷螯蟄蟊螴螶螿螸螽蟞螲褵褳褼褾襁襒褷襂覭覯覮觲觳謞"], -["eea1","謘謖謑謅謋謢謏謒謕謇謍謈謆謜謓謚豏豰豲豱豯貕貔賹赯蹎蹍蹓蹐蹌蹇轃轀邅遾鄸醚醢醛醙醟醡醝醠鎡鎃鎯鍤鍖鍇鍼鍘鍜鍶鍉鍐鍑鍠鍭鎏鍌鍪鍹鍗鍕鍒鍏鍱鍷鍻鍡鍞鍣鍧鎀鍎鍙闇闀闉闃闅閷隮隰隬霠霟霘霝霙鞚鞡鞜"], -["ef40","鞞鞝韕韔韱顁顄顊顉顅顃餥餫餬餪餳餲餯餭餱餰馘馣馡騂駺駴駷駹駸駶駻駽駾駼騃骾髾髽鬁髼魈鮚鮨鮞鮛鮦鮡鮥鮤鮆鮢鮠鮯鴳鵁鵧鴶鴮鴯鴱鴸鴰"], -["efa1","鵅鵂鵃鴾鴷鵀鴽翵鴭麊麉麍麰黈黚黻黿鼤鼣鼢齔龠儱儭儮嚘嚜嚗嚚嚝嚙奰嬼屩屪巀幭幮懘懟懭懮懱懪懰懫懖懩擿攄擽擸攁攃擼斔旛曚曛曘櫅檹檽櫡櫆檺檶檷櫇檴檭歞毉氋瀇瀌瀍瀁瀅瀔瀎濿瀀濻瀦濼濷瀊爁燿燹爃燽獶"], -["f040","璸瓀璵瓁璾璶璻瓂甔甓癜癤癙癐癓癗癚皦皽盬矂瞺磿礌礓礔礉礐礒礑禭禬穟簜簩簙簠簟簭簝簦簨簢簥簰繜繐繖繣繘繢繟繑繠繗繓羵羳翷翸聵臑臒"], -["f0a1","臐艟艞薴藆藀藃藂薳薵薽藇藄薿藋藎藈藅薱薶藒蘤薸薷薾虩蟧蟦蟢蟛蟫蟪蟥蟟蟳蟤蟔蟜蟓蟭蟘蟣螤蟗蟙蠁蟴蟨蟝襓襋襏襌襆襐襑襉謪謧謣謳謰謵譇謯謼謾謱謥謷謦謶謮謤謻謽謺豂豵貙貘貗賾贄贂贀蹜蹢蹠蹗蹖蹞蹥蹧"], -["f140","蹛蹚蹡蹝蹩蹔轆轇轈轋鄨鄺鄻鄾醨醥醧醯醪鎵鎌鎒鎷鎛鎝鎉鎧鎎鎪鎞鎦鎕鎈鎙鎟鎍鎱鎑鎲鎤鎨鎴鎣鎥闒闓闑隳雗雚巂雟雘雝霣霢霥鞬鞮鞨鞫鞤鞪"], -["f1a1","鞢鞥韗韙韖韘韺顐顑顒颸饁餼餺騏騋騉騍騄騑騊騅騇騆髀髜鬈鬄鬅鬩鬵魊魌魋鯇鯆鯃鮿鯁鮵鮸鯓鮶鯄鮹鮽鵜鵓鵏鵊鵛鵋鵙鵖鵌鵗鵒鵔鵟鵘鵚麎麌黟鼁鼀鼖鼥鼫鼪鼩鼨齌齕儴儵劖勷厴嚫嚭嚦嚧嚪嚬壚壝壛夒嬽嬾嬿巃幰"], -["f240","徿懻攇攐攍攉攌攎斄旞旝曞櫧櫠櫌櫑櫙櫋櫟櫜櫐櫫櫏櫍櫞歠殰氌瀙瀧瀠瀖瀫瀡瀢瀣瀩瀗瀤瀜瀪爌爊爇爂爅犥犦犤犣犡瓋瓅璷瓃甖癠矉矊矄矱礝礛"], -["f2a1","礡礜礗礞禰穧穨簳簼簹簬簻糬糪繶繵繸繰繷繯繺繲繴繨罋罊羃羆羷翽翾聸臗臕艤艡艣藫藱藭藙藡藨藚藗藬藲藸藘藟藣藜藑藰藦藯藞藢蠀蟺蠃蟶蟷蠉蠌蠋蠆蟼蠈蟿蠊蠂襢襚襛襗襡襜襘襝襙覈覷覶觶譐譈譊譀譓譖譔譋譕"], -["f340","譑譂譒譗豃豷豶貚贆贇贉趬趪趭趫蹭蹸蹳蹪蹯蹻軂轒轑轏轐轓辴酀鄿醰醭鏞鏇鏏鏂鏚鏐鏹鏬鏌鏙鎩鏦鏊鏔鏮鏣鏕鏄鏎鏀鏒鏧镽闚闛雡霩霫霬霨霦"], -["f3a1","鞳鞷鞶韝韞韟顜顙顝顗颿颽颻颾饈饇饃馦馧騚騕騥騝騤騛騢騠騧騣騞騜騔髂鬋鬊鬎鬌鬷鯪鯫鯠鯞鯤鯦鯢鯰鯔鯗鯬鯜鯙鯥鯕鯡鯚鵷鶁鶊鶄鶈鵱鶀鵸鶆鶋鶌鵽鵫鵴鵵鵰鵩鶅鵳鵻鶂鵯鵹鵿鶇鵨麔麑黀黼鼭齀齁齍齖齗齘匷嚲"], -["f440","嚵嚳壣孅巆巇廮廯忀忁懹攗攖攕攓旟曨曣曤櫳櫰櫪櫨櫹櫱櫮櫯瀼瀵瀯瀷瀴瀱灂瀸瀿瀺瀹灀瀻瀳灁爓爔犨獽獼璺皫皪皾盭矌矎矏矍矲礥礣礧礨礤礩"], -["f4a1","禲穮穬穭竷籉籈籊籇籅糮繻繾纁纀羺翿聹臛臙舋艨艩蘢藿蘁藾蘛蘀藶蘄蘉蘅蘌藽蠙蠐蠑蠗蠓蠖襣襦覹觷譠譪譝譨譣譥譧譭趮躆躈躄轙轖轗轕轘轚邍酃酁醷醵醲醳鐋鐓鏻鐠鐏鐔鏾鐕鐐鐨鐙鐍鏵鐀鏷鐇鐎鐖鐒鏺鐉鏸鐊鏿"], -["f540","鏼鐌鏶鐑鐆闞闠闟霮霯鞹鞻韽韾顠顢顣顟飁飂饐饎饙饌饋饓騲騴騱騬騪騶騩騮騸騭髇髊髆鬐鬒鬑鰋鰈鯷鰅鰒鯸鱀鰇鰎鰆鰗鰔鰉鶟鶙鶤鶝鶒鶘鶐鶛"], -["f5a1","鶠鶔鶜鶪鶗鶡鶚鶢鶨鶞鶣鶿鶩鶖鶦鶧麙麛麚黥黤黧黦鼰鼮齛齠齞齝齙龑儺儹劘劗囃嚽嚾孈孇巋巏廱懽攛欂櫼欃櫸欀灃灄灊灈灉灅灆爝爚爙獾甗癪矐礭礱礯籔籓糲纊纇纈纋纆纍罍羻耰臝蘘蘪蘦蘟蘣蘜蘙蘧蘮蘡蘠蘩蘞蘥"], -["f640","蠩蠝蠛蠠蠤蠜蠫衊襭襩襮襫觺譹譸譅譺譻贐贔趯躎躌轞轛轝酆酄酅醹鐿鐻鐶鐩鐽鐼鐰鐹鐪鐷鐬鑀鐱闥闤闣霵霺鞿韡顤飉飆飀饘饖騹騽驆驄驂驁騺"], -["f6a1","騿髍鬕鬗鬘鬖鬺魒鰫鰝鰜鰬鰣鰨鰩鰤鰡鶷鶶鶼鷁鷇鷊鷏鶾鷅鷃鶻鶵鷎鶹鶺鶬鷈鶱鶭鷌鶳鷍鶲鹺麜黫黮黭鼛鼘鼚鼱齎齥齤龒亹囆囅囋奱孋孌巕巑廲攡攠攦攢欋欈欉氍灕灖灗灒爞爟犩獿瓘瓕瓙瓗癭皭礵禴穰穱籗籜籙籛籚"], -["f740","糴糱纑罏羇臞艫蘴蘵蘳蘬蘲蘶蠬蠨蠦蠪蠥襱覿覾觻譾讄讂讆讅譿贕躕躔躚躒躐躖躗轠轢酇鑌鑐鑊鑋鑏鑇鑅鑈鑉鑆霿韣顪顩飋饔饛驎驓驔驌驏驈驊"], -["f7a1","驉驒驐髐鬙鬫鬻魖魕鱆鱈鰿鱄鰹鰳鱁鰼鰷鰴鰲鰽鰶鷛鷒鷞鷚鷋鷐鷜鷑鷟鷩鷙鷘鷖鷵鷕鷝麶黰鼵鼳鼲齂齫龕龢儽劙壨壧奲孍巘蠯彏戁戃戄攩攥斖曫欑欒欏毊灛灚爢玂玁玃癰矔籧籦纕艬蘺虀蘹蘼蘱蘻蘾蠰蠲蠮蠳襶襴襳觾"], -["f840","讌讎讋讈豅贙躘轤轣醼鑢鑕鑝鑗鑞韄韅頀驖驙鬞鬟鬠鱒鱘鱐鱊鱍鱋鱕鱙鱌鱎鷻鷷鷯鷣鷫鷸鷤鷶鷡鷮鷦鷲鷰鷢鷬鷴鷳鷨鷭黂黐黲黳鼆鼜鼸鼷鼶齃齏"], -["f8a1","齱齰齮齯囓囍孎屭攭曭曮欓灟灡灝灠爣瓛瓥矕礸禷禶籪纗羉艭虃蠸蠷蠵衋讔讕躞躟躠躝醾醽釂鑫鑨鑩雥靆靃靇韇韥驞髕魙鱣鱧鱦鱢鱞鱠鸂鷾鸇鸃鸆鸅鸀鸁鸉鷿鷽鸄麠鼞齆齴齵齶囔攮斸欘欙欗欚灢爦犪矘矙礹籩籫糶纚"], -["f940","纘纛纙臠臡虆虇虈襹襺襼襻觿讘讙躥躤躣鑮鑭鑯鑱鑳靉顲饟鱨鱮鱭鸋鸍鸐鸏鸒鸑麡黵鼉齇齸齻齺齹圞灦籯蠼趲躦釃鑴鑸鑶鑵驠鱴鱳鱱鱵鸔鸓黶鼊"], -["f9a1","龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓"] -] diff --git a/node_modules/iconv-lite/encodings/tables/eucjp.json b/node_modules/iconv-lite/encodings/tables/eucjp.json deleted file mode 100644 index 4fa61ca..0000000 --- a/node_modules/iconv-lite/encodings/tables/eucjp.json +++ /dev/null @@ -1,182 +0,0 @@ -[ -["0","\u0000",127], -["8ea1","。",62], -["a1a1"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇"], -["a2a1","◆□■△▲▽▼※〒→←↑↓〓"], -["a2ba","∈∋⊆⊇⊂⊃∪∩"], -["a2ca","∧∨¬⇒⇔∀∃"], -["a2dc","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"], -["a2f2","ʼn♯♭♪†‡¶"], -["a2fe","◯"], -["a3b0","0",9], -["a3c1","A",25], -["a3e1","a",25], -["a4a1","ぁ",82], -["a5a1","ァ",85], -["a6a1","Α",16,"Σ",6], -["a6c1","α",16,"σ",6], -["a7a1","А",5,"ЁЖ",25], -["a7d1","а",5,"ёж",25], -["a8a1","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"], -["ada1","①",19,"Ⅰ",9], -["adc0","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"], -["addf","㍻〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"], -["b0a1","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"], -["b1a1","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応"], -["b2a1","押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"], -["b3a1","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱"], -["b4a1","粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"], -["b5a1","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京"], -["b6a1","供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"], -["b7a1","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲"], -["b8a1","検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"], -["b9a1","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込"], -["baa1","此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"], -["bba1","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時"], -["bca1","次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"], -["bda1","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償"], -["bea1","勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"], -["bfa1","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾"], -["c0a1","澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"], -["c1a1","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎"], -["c2a1","臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"], -["c3a1","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵"], -["c4a1","帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"], -["c5a1","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到"], -["c6a1","董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"], -["c7a1","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦"], -["c8a1","函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"], -["c9a1","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服"], -["caa1","福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"], -["cba1","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満"], -["cca1","漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"], -["cda1","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃"], -["cea1","痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"], -["cfa1","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"], -["d0a1","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"], -["d1a1","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨"], -["d2a1","辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"], -["d3a1","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉"], -["d4a1","圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"], -["d5a1","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓"], -["d6a1","屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"], -["d7a1","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚"], -["d8a1","悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"], -["d9a1","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼"], -["daa1","據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"], -["dba1","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍"], -["dca1","棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"], -["dda1","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾"], -["dea1","沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"], -["dfa1","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼"], -["e0a1","燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"], -["e1a1","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰"], -["e2a1","癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"], -["e3a1","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐"], -["e4a1","筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"], -["e5a1","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺"], -["e6a1","罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"], -["e7a1","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙"], -["e8a1","茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"], -["e9a1","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙"], -["eaa1","蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"], -["eba1","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫"], -["eca1","譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"], -["eda1","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸"], -["eea1","遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"], -["efa1","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞"], -["f0a1","陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"], -["f1a1","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷"], -["f2a1","髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"], -["f3a1","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠"], -["f4a1","堯槇遙瑤凜熙"], -["f9a1","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德"], -["faa1","忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"], -["fba1","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚"], -["fca1","釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"], -["fcf1","ⅰ",9,"¬¦'""], -["8fa2af","˘ˇ¸˙˝¯˛˚~΄΅"], -["8fa2c2","¡¦¿"], -["8fa2eb","ºª©®™¤№"], -["8fa6e1","ΆΈΉΊΪ"], -["8fa6e7","Ό"], -["8fa6e9","ΎΫ"], -["8fa6ec","Ώ"], -["8fa6f1","άέήίϊΐόςύϋΰώ"], -["8fa7c2","Ђ",10,"ЎЏ"], -["8fa7f2","ђ",10,"ўџ"], -["8fa9a1","ÆĐ"], -["8fa9a4","Ħ"], -["8fa9a6","IJ"], -["8fa9a8","ŁĿ"], -["8fa9ab","ŊØŒ"], -["8fa9af","ŦÞ"], -["8fa9c1","æđðħıijĸłŀʼnŋøœßŧþ"], -["8faaa1","ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈËÊĚĖĒĘ"], -["8faaba","ĜĞĢĠĤÍÌÏÎǏİĪĮĨĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙǕŴÝŸŶŹŽŻ"], -["8faba1","áàäâăǎāąåãćĉčçċďéèëêěėēęǵĝğ"], -["8fabbd","ġĥíìïîǐ"], -["8fabc5","īįĩĵķĺľļńňņñóòöôǒőōõŕřŗśŝšşťţúùüûŭǔűūųůũǘǜǚǖŵýÿŷźžż"], -["8fb0a1","丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄"], -["8fb1a1","侅侉侊侌侎侐侒侓侔侗侙侚侞侟侲侷侹侻侼侽侾俀俁俅俆俈俉俋俌俍俏俒俜俠俢俰俲俼俽俿倀倁倄倇倊倌倎倐倓倗倘倛倜倝倞倢倧倮倰倲倳倵偀偁偂偅偆偊偌偎偑偒偓偗偙偟偠偢偣偦偧偪偭偰偱倻傁傃傄傆傊傎傏傐"], -["8fb2a1","傒傓傔傖傛傜傞",4,"傪傯傰傹傺傽僀僃僄僇僌僎僐僓僔僘僜僝僟僢僤僦僨僩僯僱僶僺僾儃儆儇儈儋儌儍儎僲儐儗儙儛儜儝儞儣儧儨儬儭儯儱儳儴儵儸儹兂兊兏兓兕兗兘兟兤兦兾冃冄冋冎冘冝冡冣冭冸冺冼冾冿凂"], -["8fb3a1","凈减凑凒凓凕凘凞凢凥凮凲凳凴凷刁刂刅划刓刕刖刘刢刨刱刲刵刼剅剉剕剗剘剚剜剟剠剡剦剮剷剸剹劀劂劅劊劌劓劕劖劗劘劚劜劤劥劦劧劯劰劶劷劸劺劻劽勀勄勆勈勌勏勑勔勖勛勜勡勥勨勩勪勬勰勱勴勶勷匀匃匊匋"], -["8fb4a1","匌匑匓匘匛匜匞匟匥匧匨匩匫匬匭匰匲匵匼匽匾卂卌卋卙卛卡卣卥卬卭卲卹卾厃厇厈厎厓厔厙厝厡厤厪厫厯厲厴厵厷厸厺厽叀叅叏叒叓叕叚叝叞叠另叧叵吂吓吚吡吧吨吪启吱吴吵呃呄呇呍呏呞呢呤呦呧呩呫呭呮呴呿"], -["8fb5a1","咁咃咅咈咉咍咑咕咖咜咟咡咦咧咩咪咭咮咱咷咹咺咻咿哆哊响哎哠哪哬哯哶哼哾哿唀唁唅唈唉唌唍唎唕唪唫唲唵唶唻唼唽啁啇啉啊啍啐啑啘啚啛啞啠啡啤啦啿喁喂喆喈喎喏喑喒喓喔喗喣喤喭喲喿嗁嗃嗆嗉嗋嗌嗎嗑嗒"], -["8fb6a1","嗓嗗嗘嗛嗞嗢嗩嗶嗿嘅嘈嘊嘍",5,"嘙嘬嘰嘳嘵嘷嘹嘻嘼嘽嘿噀噁噃噄噆噉噋噍噏噔噞噠噡噢噣噦噩噭噯噱噲噵嚄嚅嚈嚋嚌嚕嚙嚚嚝嚞嚟嚦嚧嚨嚩嚫嚬嚭嚱嚳嚷嚾囅囉囊囋囏囐囌囍囙囜囝囟囡囤",4,"囱囫园"], -["8fb7a1","囶囷圁圂圇圊圌圑圕圚圛圝圠圢圣圤圥圩圪圬圮圯圳圴圽圾圿坅坆坌坍坒坢坥坧坨坫坭",4,"坳坴坵坷坹坺坻坼坾垁垃垌垔垗垙垚垜垝垞垟垡垕垧垨垩垬垸垽埇埈埌埏埕埝埞埤埦埧埩埭埰埵埶埸埽埾埿堃堄堈堉埡"], -["8fb8a1","堌堍堛堞堟堠堦堧堭堲堹堿塉塌塍塏塐塕塟塡塤塧塨塸塼塿墀墁墇墈墉墊墌墍墏墐墔墖墝墠墡墢墦墩墱墲壄墼壂壈壍壎壐壒壔壖壚壝壡壢壩壳夅夆夋夌夒夓夔虁夝夡夣夤夨夯夰夳夵夶夿奃奆奒奓奙奛奝奞奟奡奣奫奭"], -["8fb9a1","奯奲奵奶她奻奼妋妌妎妒妕妗妟妤妧妭妮妯妰妳妷妺妼姁姃姄姈姊姍姒姝姞姟姣姤姧姮姯姱姲姴姷娀娄娌娍娎娒娓娞娣娤娧娨娪娭娰婄婅婇婈婌婐婕婞婣婥婧婭婷婺婻婾媋媐媓媖媙媜媞媟媠媢媧媬媱媲媳媵媸媺媻媿"], -["8fbaa1","嫄嫆嫈嫏嫚嫜嫠嫥嫪嫮嫵嫶嫽嬀嬁嬈嬗嬴嬙嬛嬝嬡嬥嬭嬸孁孋孌孒孖孞孨孮孯孼孽孾孿宁宄宆宊宎宐宑宓宔宖宨宩宬宭宯宱宲宷宺宼寀寁寍寏寖",4,"寠寯寱寴寽尌尗尞尟尣尦尩尫尬尮尰尲尵尶屙屚屜屢屣屧屨屩"], -["8fbba1","屭屰屴屵屺屻屼屽岇岈岊岏岒岝岟岠岢岣岦岪岲岴岵岺峉峋峒峝峗峮峱峲峴崁崆崍崒崫崣崤崦崧崱崴崹崽崿嵂嵃嵆嵈嵕嵑嵙嵊嵟嵠嵡嵢嵤嵪嵭嵰嵹嵺嵾嵿嶁嶃嶈嶊嶒嶓嶔嶕嶙嶛嶟嶠嶧嶫嶰嶴嶸嶹巃巇巋巐巎巘巙巠巤"], -["8fbca1","巩巸巹帀帇帍帒帔帕帘帟帠帮帨帲帵帾幋幐幉幑幖幘幛幜幞幨幪",4,"幰庀庋庎庢庤庥庨庪庬庱庳庽庾庿廆廌廋廎廑廒廔廕廜廞廥廫异弆弇弈弎弙弜弝弡弢弣弤弨弫弬弮弰弴弶弻弽弿彀彄彅彇彍彐彔彘彛彠彣彤彧"], -["8fbda1","彯彲彴彵彸彺彽彾徉徍徏徖徜徝徢徧徫徤徬徯徰徱徸忄忇忈忉忋忐",4,"忞忡忢忨忩忪忬忭忮忯忲忳忶忺忼怇怊怍怓怔怗怘怚怟怤怭怳怵恀恇恈恉恌恑恔恖恗恝恡恧恱恾恿悂悆悈悊悎悑悓悕悘悝悞悢悤悥您悰悱悷"], -["8fbea1","悻悾惂惄惈惉惊惋惎惏惔惕惙惛惝惞惢惥惲惵惸惼惽愂愇愊愌愐",4,"愖愗愙愜愞愢愪愫愰愱愵愶愷愹慁慅慆慉慞慠慬慲慸慻慼慿憀憁憃憄憋憍憒憓憗憘憜憝憟憠憥憨憪憭憸憹憼懀懁懂懎懏懕懜懝懞懟懡懢懧懩懥"], -["8fbfa1","懬懭懯戁戃戄戇戓戕戜戠戢戣戧戩戫戹戽扂扃扄扆扌扐扑扒扔扖扚扜扤扭扯扳扺扽抍抎抏抐抦抨抳抶抷抺抾抿拄拎拕拖拚拪拲拴拼拽挃挄挊挋挍挐挓挖挘挩挪挭挵挶挹挼捁捂捃捄捆捊捋捎捒捓捔捘捛捥捦捬捭捱捴捵"], -["8fc0a1","捸捼捽捿掂掄掇掊掐掔掕掙掚掞掤掦掭掮掯掽揁揅揈揎揑揓揔揕揜揠揥揪揬揲揳揵揸揹搉搊搐搒搔搘搞搠搢搤搥搩搪搯搰搵搽搿摋摏摑摒摓摔摚摛摜摝摟摠摡摣摭摳摴摻摽撅撇撏撐撑撘撙撛撝撟撡撣撦撨撬撳撽撾撿"], -["8fc1a1","擄擉擊擋擌擎擐擑擕擗擤擥擩擪擭擰擵擷擻擿攁攄攈攉攊攏攓攔攖攙攛攞攟攢攦攩攮攱攺攼攽敃敇敉敐敒敔敟敠敧敫敺敽斁斅斊斒斕斘斝斠斣斦斮斲斳斴斿旂旈旉旎旐旔旖旘旟旰旲旴旵旹旾旿昀昄昈昉昍昑昒昕昖昝"], -["8fc2a1","昞昡昢昣昤昦昩昪昫昬昮昰昱昳昹昷晀晅晆晊晌晑晎晗晘晙晛晜晠晡曻晪晫晬晾晳晵晿晷晸晹晻暀晼暋暌暍暐暒暙暚暛暜暟暠暤暭暱暲暵暻暿曀曂曃曈曌曎曏曔曛曟曨曫曬曮曺朅朇朎朓朙朜朠朢朳朾杅杇杈杌杔杕杝"], -["8fc3a1","杦杬杮杴杶杻极构枎枏枑枓枖枘枙枛枰枱枲枵枻枼枽柹柀柂柃柅柈柉柒柗柙柜柡柦柰柲柶柷桒栔栙栝栟栨栧栬栭栯栰栱栳栻栿桄桅桊桌桕桗桘桛桫桮",4,"桵桹桺桻桼梂梄梆梈梖梘梚梜梡梣梥梩梪梮梲梻棅棈棌棏"], -["8fc4a1","棐棑棓棖棙棜棝棥棨棪棫棬棭棰棱棵棶棻棼棽椆椉椊椐椑椓椖椗椱椳椵椸椻楂楅楉楎楗楛楣楤楥楦楨楩楬楰楱楲楺楻楿榀榍榒榖榘榡榥榦榨榫榭榯榷榸榺榼槅槈槑槖槗槢槥槮槯槱槳槵槾樀樁樃樏樑樕樚樝樠樤樨樰樲"], -["8fc5a1","樴樷樻樾樿橅橆橉橊橎橐橑橒橕橖橛橤橧橪橱橳橾檁檃檆檇檉檋檑檛檝檞檟檥檫檯檰檱檴檽檾檿櫆櫉櫈櫌櫐櫔櫕櫖櫜櫝櫤櫧櫬櫰櫱櫲櫼櫽欂欃欆欇欉欏欐欑欗欛欞欤欨欫欬欯欵欶欻欿歆歊歍歒歖歘歝歠歧歫歮歰歵歽"], -["8fc6a1","歾殂殅殗殛殟殠殢殣殨殩殬殭殮殰殸殹殽殾毃毄毉毌毖毚毡毣毦毧毮毱毷毹毿氂氄氅氉氍氎氐氒氙氟氦氧氨氬氮氳氵氶氺氻氿汊汋汍汏汒汔汙汛汜汫汭汯汴汶汸汹汻沅沆沇沉沔沕沗沘沜沟沰沲沴泂泆泍泏泐泑泒泔泖"], -["8fc7a1","泚泜泠泧泩泫泬泮泲泴洄洇洊洎洏洑洓洚洦洧洨汧洮洯洱洹洼洿浗浞浟浡浥浧浯浰浼涂涇涑涒涔涖涗涘涪涬涴涷涹涽涿淄淈淊淎淏淖淛淝淟淠淢淥淩淯淰淴淶淼渀渄渞渢渧渲渶渹渻渼湄湅湈湉湋湏湑湒湓湔湗湜湝湞"], -["8fc8a1","湢湣湨湳湻湽溍溓溙溠溧溭溮溱溳溻溿滀滁滃滇滈滊滍滎滏滫滭滮滹滻滽漄漈漊漌漍漖漘漚漛漦漩漪漯漰漳漶漻漼漭潏潑潒潓潗潙潚潝潞潡潢潨潬潽潾澃澇澈澋澌澍澐澒澓澔澖澚澟澠澥澦澧澨澮澯澰澵澶澼濅濇濈濊"], -["8fc9a1","濚濞濨濩濰濵濹濼濽瀀瀅瀆瀇瀍瀗瀠瀣瀯瀴瀷瀹瀼灃灄灈灉灊灋灔灕灝灞灎灤灥灬灮灵灶灾炁炅炆炔",4,"炛炤炫炰炱炴炷烊烑烓烔烕烖烘烜烤烺焃",4,"焋焌焏焞焠焫焭焯焰焱焸煁煅煆煇煊煋煐煒煗煚煜煞煠"], -["8fcaa1","煨煹熀熅熇熌熒熚熛熠熢熯熰熲熳熺熿燀燁燄燋燌燓燖燙燚燜燸燾爀爇爈爉爓爗爚爝爟爤爫爯爴爸爹牁牂牃牅牎牏牐牓牕牖牚牜牞牠牣牨牫牮牯牱牷牸牻牼牿犄犉犍犎犓犛犨犭犮犱犴犾狁狇狉狌狕狖狘狟狥狳狴狺狻"], -["8fcba1","狾猂猄猅猇猋猍猒猓猘猙猞猢猤猧猨猬猱猲猵猺猻猽獃獍獐獒獖獘獝獞獟獠獦獧獩獫獬獮獯獱獷獹獼玀玁玃玅玆玎玐玓玕玗玘玜玞玟玠玢玥玦玪玫玭玵玷玹玼玽玿珅珆珉珋珌珏珒珓珖珙珝珡珣珦珧珩珴珵珷珹珺珻珽"], -["8fcca1","珿琀琁琄琇琊琑琚琛琤琦琨",9,"琹瑀瑃瑄瑆瑇瑋瑍瑑瑒瑗瑝瑢瑦瑧瑨瑫瑭瑮瑱瑲璀璁璅璆璇璉璏璐璑璒璘璙璚璜璟璠璡璣璦璨璩璪璫璮璯璱璲璵璹璻璿瓈瓉瓌瓐瓓瓘瓚瓛瓞瓟瓤瓨瓪瓫瓯瓴瓺瓻瓼瓿甆"], -["8fcda1","甒甖甗甠甡甤甧甩甪甯甶甹甽甾甿畀畃畇畈畎畐畒畗畞畟畡畯畱畹",5,"疁疅疐疒疓疕疙疜疢疤疴疺疿痀痁痄痆痌痎痏痗痜痟痠痡痤痧痬痮痯痱痹瘀瘂瘃瘄瘇瘈瘊瘌瘏瘒瘓瘕瘖瘙瘛瘜瘝瘞瘣瘥瘦瘩瘭瘲瘳瘵瘸瘹"], -["8fcea1","瘺瘼癊癀癁癃癄癅癉癋癕癙癟癤癥癭癮癯癱癴皁皅皌皍皕皛皜皝皟皠皢",6,"皪皭皽盁盅盉盋盌盎盔盙盠盦盨盬盰盱盶盹盼眀眆眊眎眒眔眕眗眙眚眜眢眨眭眮眯眴眵眶眹眽眾睂睅睆睊睍睎睏睒睖睗睜睞睟睠睢"], -["8fcfa1","睤睧睪睬睰睲睳睴睺睽瞀瞄瞌瞍瞔瞕瞖瞚瞟瞢瞧瞪瞮瞯瞱瞵瞾矃矉矑矒矕矙矞矟矠矤矦矪矬矰矱矴矸矻砅砆砉砍砎砑砝砡砢砣砭砮砰砵砷硃硄硇硈硌硎硒硜硞硠硡硣硤硨硪确硺硾碊碏碔碘碡碝碞碟碤碨碬碭碰碱碲碳"], -["8fd0a1","碻碽碿磇磈磉磌磎磒磓磕磖磤磛磟磠磡磦磪磲磳礀磶磷磺磻磿礆礌礐礚礜礞礟礠礥礧礩礭礱礴礵礻礽礿祄祅祆祊祋祏祑祔祘祛祜祧祩祫祲祹祻祼祾禋禌禑禓禔禕禖禘禛禜禡禨禩禫禯禱禴禸离秂秄秇秈秊秏秔秖秚秝秞"], -["8fd1a1","秠秢秥秪秫秭秱秸秼稂稃稇稉稊稌稑稕稛稞稡稧稫稭稯稰稴稵稸稹稺穄穅穇穈穌穕穖穙穜穝穟穠穥穧穪穭穵穸穾窀窂窅窆窊窋窐窑窔窞窠窣窬窳窵窹窻窼竆竉竌竎竑竛竨竩竫竬竱竴竻竽竾笇笔笟笣笧笩笪笫笭笮笯笰"], -["8fd2a1","笱笴笽笿筀筁筇筎筕筠筤筦筩筪筭筯筲筳筷箄箉箎箐箑箖箛箞箠箥箬箯箰箲箵箶箺箻箼箽篂篅篈篊篔篖篗篙篚篛篨篪篲篴篵篸篹篺篼篾簁簂簃簄簆簉簋簌簎簏簙簛簠簥簦簨簬簱簳簴簶簹簺籆籊籕籑籒籓籙",5], -["8fd3a1","籡籣籧籩籭籮籰籲籹籼籽粆粇粏粔粞粠粦粰粶粷粺粻粼粿糄糇糈糉糍糏糓糔糕糗糙糚糝糦糩糫糵紃紇紈紉紏紑紒紓紖紝紞紣紦紪紭紱紼紽紾絀絁絇絈絍絑絓絗絙絚絜絝絥絧絪絰絸絺絻絿綁綂綃綅綆綈綋綌綍綑綖綗綝"], -["8fd4a1","綞綦綧綪綳綶綷綹緂",4,"緌緍緎緗緙縀緢緥緦緪緫緭緱緵緶緹緺縈縐縑縕縗縜縝縠縧縨縬縭縯縳縶縿繄繅繇繎繐繒繘繟繡繢繥繫繮繯繳繸繾纁纆纇纊纍纑纕纘纚纝纞缼缻缽缾缿罃罄罇罏罒罓罛罜罝罡罣罤罥罦罭"], -["8fd5a1","罱罽罾罿羀羋羍羏羐羑羖羗羜羡羢羦羪羭羴羼羿翀翃翈翎翏翛翟翣翥翨翬翮翯翲翺翽翾翿耇耈耊耍耎耏耑耓耔耖耝耞耟耠耤耦耬耮耰耴耵耷耹耺耼耾聀聄聠聤聦聭聱聵肁肈肎肜肞肦肧肫肸肹胈胍胏胒胔胕胗胘胠胭胮"], -["8fd6a1","胰胲胳胶胹胺胾脃脋脖脗脘脜脞脠脤脧脬脰脵脺脼腅腇腊腌腒腗腠腡腧腨腩腭腯腷膁膐膄膅膆膋膎膖膘膛膞膢膮膲膴膻臋臃臅臊臎臏臕臗臛臝臞臡臤臫臬臰臱臲臵臶臸臹臽臿舀舃舏舓舔舙舚舝舡舢舨舲舴舺艃艄艅艆"], -["8fd7a1","艋艎艏艑艖艜艠艣艧艭艴艻艽艿芀芁芃芄芇芉芊芎芑芔芖芘芚芛芠芡芣芤芧芨芩芪芮芰芲芴芷芺芼芾芿苆苐苕苚苠苢苤苨苪苭苯苶苷苽苾茀茁茇茈茊茋荔茛茝茞茟茡茢茬茭茮茰茳茷茺茼茽荂荃荄荇荍荎荑荕荖荗荰荸"], -["8fd8a1","荽荿莀莂莄莆莍莒莔莕莘莙莛莜莝莦莧莩莬莾莿菀菇菉菏菐菑菔菝荓菨菪菶菸菹菼萁萆萊萏萑萕萙莭萯萹葅葇葈葊葍葏葑葒葖葘葙葚葜葠葤葥葧葪葰葳葴葶葸葼葽蒁蒅蒒蒓蒕蒞蒦蒨蒩蒪蒯蒱蒴蒺蒽蒾蓀蓂蓇蓈蓌蓏蓓"], -["8fd9a1","蓜蓧蓪蓯蓰蓱蓲蓷蔲蓺蓻蓽蔂蔃蔇蔌蔎蔐蔜蔞蔢蔣蔤蔥蔧蔪蔫蔯蔳蔴蔶蔿蕆蕏",4,"蕖蕙蕜",6,"蕤蕫蕯蕹蕺蕻蕽蕿薁薅薆薉薋薌薏薓薘薝薟薠薢薥薧薴薶薷薸薼薽薾薿藂藇藊藋藎薭藘藚藟藠藦藨藭藳藶藼"], -["8fdaa1","藿蘀蘄蘅蘍蘎蘐蘑蘒蘘蘙蘛蘞蘡蘧蘩蘶蘸蘺蘼蘽虀虂虆虒虓虖虗虘虙虝虠",4,"虩虬虯虵虶虷虺蚍蚑蚖蚘蚚蚜蚡蚦蚧蚨蚭蚱蚳蚴蚵蚷蚸蚹蚿蛀蛁蛃蛅蛑蛒蛕蛗蛚蛜蛠蛣蛥蛧蚈蛺蛼蛽蜄蜅蜇蜋蜎蜏蜐蜓蜔蜙蜞蜟蜡蜣"], -["8fdba1","蜨蜮蜯蜱蜲蜹蜺蜼蜽蜾蝀蝃蝅蝍蝘蝝蝡蝤蝥蝯蝱蝲蝻螃",6,"螋螌螐螓螕螗螘螙螞螠螣螧螬螭螮螱螵螾螿蟁蟈蟉蟊蟎蟕蟖蟙蟚蟜蟟蟢蟣蟤蟪蟫蟭蟱蟳蟸蟺蟿蠁蠃蠆蠉蠊蠋蠐蠙蠒蠓蠔蠘蠚蠛蠜蠞蠟蠨蠭蠮蠰蠲蠵"], -["8fdca1","蠺蠼衁衃衅衈衉衊衋衎衑衕衖衘衚衜衟衠衤衩衱衹衻袀袘袚袛袜袟袠袨袪袺袽袾裀裊",4,"裑裒裓裛裞裧裯裰裱裵裷褁褆褍褎褏褕褖褘褙褚褜褠褦褧褨褰褱褲褵褹褺褾襀襂襅襆襉襏襒襗襚襛襜襡襢襣襫襮襰襳襵襺"], -["8fdda1","襻襼襽覉覍覐覔覕覛覜覟覠覥覰覴覵覶覷覼觔",4,"觥觩觫觭觱觳觶觹觽觿訄訅訇訏訑訒訔訕訞訠訢訤訦訫訬訯訵訷訽訾詀詃詅詇詉詍詎詓詖詗詘詜詝詡詥詧詵詶詷詹詺詻詾詿誀誃誆誋誏誐誒誖誗誙誟誧誩誮誯誳"], -["8fdea1","誶誷誻誾諃諆諈諉諊諑諓諔諕諗諝諟諬諰諴諵諶諼諿謅謆謋謑謜謞謟謊謭謰謷謼譂",4,"譈譒譓譔譙譍譞譣譭譶譸譹譼譾讁讄讅讋讍讏讔讕讜讞讟谸谹谽谾豅豇豉豋豏豑豓豔豗豘豛豝豙豣豤豦豨豩豭豳豵豶豻豾貆"], -["8fdfa1","貇貋貐貒貓貙貛貜貤貹貺賅賆賉賋賏賖賕賙賝賡賨賬賯賰賲賵賷賸賾賿贁贃贉贒贗贛赥赩赬赮赿趂趄趈趍趐趑趕趞趟趠趦趫趬趯趲趵趷趹趻跀跅跆跇跈跊跎跑跔跕跗跙跤跥跧跬跰趼跱跲跴跽踁踄踅踆踋踑踔踖踠踡踢"], -["8fe0a1","踣踦踧踱踳踶踷踸踹踽蹀蹁蹋蹍蹎蹏蹔蹛蹜蹝蹞蹡蹢蹩蹬蹭蹯蹰蹱蹹蹺蹻躂躃躉躐躒躕躚躛躝躞躢躧躩躭躮躳躵躺躻軀軁軃軄軇軏軑軔軜軨軮軰軱軷軹軺軭輀輂輇輈輏輐輖輗輘輞輠輡輣輥輧輨輬輭輮輴輵輶輷輺轀轁"], -["8fe1a1","轃轇轏轑",4,"轘轝轞轥辝辠辡辤辥辦辵辶辸达迀迁迆迊迋迍运迒迓迕迠迣迤迨迮迱迵迶迻迾适逄逈逌逘逛逨逩逯逪逬逭逳逴逷逿遃遄遌遛遝遢遦遧遬遰遴遹邅邈邋邌邎邐邕邗邘邙邛邠邡邢邥邰邲邳邴邶邽郌邾郃"], -["8fe2a1","郄郅郇郈郕郗郘郙郜郝郟郥郒郶郫郯郰郴郾郿鄀鄄鄅鄆鄈鄍鄐鄔鄖鄗鄘鄚鄜鄞鄠鄥鄢鄣鄧鄩鄮鄯鄱鄴鄶鄷鄹鄺鄼鄽酃酇酈酏酓酗酙酚酛酡酤酧酭酴酹酺酻醁醃醅醆醊醎醑醓醔醕醘醞醡醦醨醬醭醮醰醱醲醳醶醻醼醽醿"], -["8fe3a1","釂釃釅釓釔釗釙釚釞釤釥釩釪釬",5,"釷釹釻釽鈀鈁鈄鈅鈆鈇鈉鈊鈌鈐鈒鈓鈖鈘鈜鈝鈣鈤鈥鈦鈨鈮鈯鈰鈳鈵鈶鈸鈹鈺鈼鈾鉀鉂鉃鉆鉇鉊鉍鉎鉏鉑鉘鉙鉜鉝鉠鉡鉥鉧鉨鉩鉮鉯鉰鉵",4,"鉻鉼鉽鉿銈銉銊銍銎銒銗"], -["8fe4a1","銙銟銠銤銥銧銨銫銯銲銶銸銺銻銼銽銿",4,"鋅鋆鋇鋈鋋鋌鋍鋎鋐鋓鋕鋗鋘鋙鋜鋝鋟鋠鋡鋣鋥鋧鋨鋬鋮鋰鋹鋻鋿錀錂錈錍錑錔錕錜錝錞錟錡錤錥錧錩錪錳錴錶錷鍇鍈鍉鍐鍑鍒鍕鍗鍘鍚鍞鍤鍥鍧鍩鍪鍭鍯鍰鍱鍳鍴鍶"], -["8fe5a1","鍺鍽鍿鎀鎁鎂鎈鎊鎋鎍鎏鎒鎕鎘鎛鎞鎡鎣鎤鎦鎨鎫鎴鎵鎶鎺鎩鏁鏄鏅鏆鏇鏉",4,"鏓鏙鏜鏞鏟鏢鏦鏧鏹鏷鏸鏺鏻鏽鐁鐂鐄鐈鐉鐍鐎鐏鐕鐖鐗鐟鐮鐯鐱鐲鐳鐴鐻鐿鐽鑃鑅鑈鑊鑌鑕鑙鑜鑟鑡鑣鑨鑫鑭鑮鑯鑱鑲钄钃镸镹"], -["8fe6a1","镾閄閈閌閍閎閝閞閟閡閦閩閫閬閴閶閺閽閿闆闈闉闋闐闑闒闓闙闚闝闞闟闠闤闦阝阞阢阤阥阦阬阱阳阷阸阹阺阼阽陁陒陔陖陗陘陡陮陴陻陼陾陿隁隂隃隄隉隑隖隚隝隟隤隥隦隩隮隯隳隺雊雒嶲雘雚雝雞雟雩雯雱雺霂"], -["8fe7a1","霃霅霉霚霛霝霡霢霣霨霱霳靁靃靊靎靏靕靗靘靚靛靣靧靪靮靳靶靷靸靻靽靿鞀鞉鞕鞖鞗鞙鞚鞞鞟鞢鞬鞮鞱鞲鞵鞶鞸鞹鞺鞼鞾鞿韁韄韅韇韉韊韌韍韎韐韑韔韗韘韙韝韞韠韛韡韤韯韱韴韷韸韺頇頊頙頍頎頔頖頜頞頠頣頦"], -["8fe8a1","頫頮頯頰頲頳頵頥頾顄顇顊顑顒顓顖顗顙顚顢顣顥顦顪顬颫颭颮颰颴颷颸颺颻颿飂飅飈飌飡飣飥飦飧飪飳飶餂餇餈餑餕餖餗餚餛餜餟餢餦餧餫餱",4,"餹餺餻餼饀饁饆饇饈饍饎饔饘饙饛饜饞饟饠馛馝馟馦馰馱馲馵"], -["8fe9a1","馹馺馽馿駃駉駓駔駙駚駜駞駧駪駫駬駰駴駵駹駽駾騂騃騄騋騌騐騑騖騞騠騢騣騤騧騭騮騳騵騶騸驇驁驄驊驋驌驎驑驔驖驝骪骬骮骯骲骴骵骶骹骻骾骿髁髃髆髈髎髐髒髕髖髗髛髜髠髤髥髧髩髬髲髳髵髹髺髽髿",4], -["8feaa1","鬄鬅鬈鬉鬋鬌鬍鬎鬐鬒鬖鬙鬛鬜鬠鬦鬫鬭鬳鬴鬵鬷鬹鬺鬽魈魋魌魕魖魗魛魞魡魣魥魦魨魪",4,"魳魵魷魸魹魿鮀鮄鮅鮆鮇鮉鮊鮋鮍鮏鮐鮔鮚鮝鮞鮦鮧鮩鮬鮰鮱鮲鮷鮸鮻鮼鮾鮿鯁鯇鯈鯎鯐鯗鯘鯝鯟鯥鯧鯪鯫鯯鯳鯷鯸"], -["8feba1","鯹鯺鯽鯿鰀鰂鰋鰏鰑鰖鰘鰙鰚鰜鰞鰢鰣鰦",4,"鰱鰵鰶鰷鰽鱁鱃鱄鱅鱉鱊鱎鱏鱐鱓鱔鱖鱘鱛鱝鱞鱟鱣鱩鱪鱜鱫鱨鱮鱰鱲鱵鱷鱻鳦鳲鳷鳹鴋鴂鴑鴗鴘鴜鴝鴞鴯鴰鴲鴳鴴鴺鴼鵅鴽鵂鵃鵇鵊鵓鵔鵟鵣鵢鵥鵩鵪鵫鵰鵶鵷鵻"], -["8feca1","鵼鵾鶃鶄鶆鶊鶍鶎鶒鶓鶕鶖鶗鶘鶡鶪鶬鶮鶱鶵鶹鶼鶿鷃鷇鷉鷊鷔鷕鷖鷗鷚鷞鷟鷠鷥鷧鷩鷫鷮鷰鷳鷴鷾鸊鸂鸇鸎鸐鸑鸒鸕鸖鸙鸜鸝鹺鹻鹼麀麂麃麄麅麇麎麏麖麘麛麞麤麨麬麮麯麰麳麴麵黆黈黋黕黟黤黧黬黭黮黰黱黲黵"], -["8feda1","黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃",4,"齓齕齖齗齘齚齝齞齨齩齭",4,"齳齵齺齽龏龐龑龒龔龖龗龞龡龢龣龥"] -] diff --git a/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json b/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json deleted file mode 100644 index 85c6934..0000000 --- a/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +++ /dev/null @@ -1 +0,0 @@ -{"uChars":[128,165,169,178,184,216,226,235,238,244,248,251,253,258,276,284,300,325,329,334,364,463,465,467,469,471,473,475,477,506,594,610,712,716,730,930,938,962,970,1026,1104,1106,8209,8215,8218,8222,8231,8241,8244,8246,8252,8365,8452,8454,8458,8471,8482,8556,8570,8596,8602,8713,8720,8722,8726,8731,8737,8740,8742,8748,8751,8760,8766,8777,8781,8787,8802,8808,8816,8854,8858,8870,8896,8979,9322,9372,9548,9588,9616,9622,9634,9652,9662,9672,9676,9680,9702,9735,9738,9793,9795,11906,11909,11913,11917,11928,11944,11947,11951,11956,11960,11964,11979,12284,12292,12312,12319,12330,12351,12436,12447,12535,12543,12586,12842,12850,12964,13200,13215,13218,13253,13263,13267,13270,13384,13428,13727,13839,13851,14617,14703,14801,14816,14964,15183,15471,15585,16471,16736,17208,17325,17330,17374,17623,17997,18018,18212,18218,18301,18318,18760,18811,18814,18820,18823,18844,18848,18872,19576,19620,19738,19887,40870,59244,59336,59367,59413,59417,59423,59431,59437,59443,59452,59460,59478,59493,63789,63866,63894,63976,63986,64016,64018,64021,64025,64034,64037,64042,65074,65093,65107,65112,65127,65132,65375,65510,65536],"gbChars":[0,36,38,45,50,81,89,95,96,100,103,104,105,109,126,133,148,172,175,179,208,306,307,308,309,310,311,312,313,341,428,443,544,545,558,741,742,749,750,805,819,820,7922,7924,7925,7927,7934,7943,7944,7945,7950,8062,8148,8149,8152,8164,8174,8236,8240,8262,8264,8374,8380,8381,8384,8388,8390,8392,8393,8394,8396,8401,8406,8416,8419,8424,8437,8439,8445,8482,8485,8496,8521,8603,8936,8946,9046,9050,9063,9066,9076,9092,9100,9108,9111,9113,9131,9162,9164,9218,9219,11329,11331,11334,11336,11346,11361,11363,11366,11370,11372,11375,11389,11682,11686,11687,11692,11694,11714,11716,11723,11725,11730,11736,11982,11989,12102,12336,12348,12350,12384,12393,12395,12397,12510,12553,12851,12962,12973,13738,13823,13919,13933,14080,14298,14585,14698,15583,15847,16318,16434,16438,16481,16729,17102,17122,17315,17320,17402,17418,17859,17909,17911,17915,17916,17936,17939,17961,18664,18703,18814,18962,19043,33469,33470,33471,33484,33485,33490,33497,33501,33505,33513,33520,33536,33550,37845,37921,37948,38029,38038,38064,38065,38066,38069,38075,38076,38078,39108,39109,39113,39114,39115,39116,39265,39394,189000]} \ No newline at end of file diff --git a/node_modules/iconv-lite/encodings/tables/gbk-added.json b/node_modules/iconv-lite/encodings/tables/gbk-added.json deleted file mode 100644 index 8abfa9f..0000000 --- a/node_modules/iconv-lite/encodings/tables/gbk-added.json +++ /dev/null @@ -1,55 +0,0 @@ -[ -["a140","",62], -["a180","",32], -["a240","",62], -["a280","",32], -["a2ab","",5], -["a2e3","€"], -["a2ef",""], -["a2fd",""], -["a340","",62], -["a380","",31," "], -["a440","",62], -["a480","",32], -["a4f4","",10], -["a540","",62], -["a580","",32], -["a5f7","",7], -["a640","",62], -["a680","",32], -["a6b9","",7], -["a6d9","",6], -["a6ec",""], -["a6f3",""], -["a6f6","",8], -["a740","",62], -["a780","",32], -["a7c2","",14], -["a7f2","",12], -["a896","",10], -["a8bc",""], -["a8bf","ǹ"], -["a8c1",""], -["a8ea","",20], -["a958",""], -["a95b",""], -["a95d",""], -["a989","〾⿰",11], -["a997","",12], -["a9f0","",14], -["aaa1","",93], -["aba1","",93], -["aca1","",93], -["ada1","",93], -["aea1","",93], -["afa1","",93], -["d7fa","",4], -["f8a1","",93], -["f9a1","",93], -["faa1","",93], -["fba1","",93], -["fca1","",93], -["fda1","",93], -["fe50","⺁⺄㑳㑇⺈⺋㖞㘚㘎⺌⺗㥮㤘㧏㧟㩳㧐㭎㱮㳠⺧⺪䁖䅟⺮䌷⺳⺶⺷䎱䎬⺻䏝䓖䙡䙌"], -["fe80","䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶䲣䲟䲠䲡䱷䲢䴓",6,"䶮",93] -] diff --git a/node_modules/iconv-lite/encodings/tables/shiftjis.json b/node_modules/iconv-lite/encodings/tables/shiftjis.json deleted file mode 100644 index 5a3a43c..0000000 --- a/node_modules/iconv-lite/encodings/tables/shiftjis.json +++ /dev/null @@ -1,125 +0,0 @@ -[ -["0","\u0000",128], -["a1","。",62], -["8140"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×"], -["8180","÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓"], -["81b8","∈∋⊆⊇⊂⊃∪∩"], -["81c8","∧∨¬⇒⇔∀∃"], -["81da","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"], -["81f0","ʼn♯♭♪†‡¶"], -["81fc","◯"], -["824f","0",9], -["8260","A",25], -["8281","a",25], -["829f","ぁ",82], -["8340","ァ",62], -["8380","ム",22], -["839f","Α",16,"Σ",6], -["83bf","α",16,"σ",6], -["8440","А",5,"ЁЖ",25], -["8470","а",5,"ёж",7], -["8480","о",17], -["849f","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"], -["8740","①",19,"Ⅰ",9], -["875f","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"], -["877e","㍻"], -["8780","〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"], -["889f","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"], -["8940","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円"], -["8980","園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"], -["8a40","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫"], -["8a80","橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"], -["8b40","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救"], -["8b80","朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"], -["8c40","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨"], -["8c80","劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"], -["8d40","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降"], -["8d80","項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"], -["8e40","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止"], -["8e80","死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"], -["8f40","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳"], -["8f80","準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"], -["9040","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨"], -["9080","逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"], -["9140","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻"], -["9180","操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"], -["9240","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄"], -["9280","逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"], -["9340","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬"], -["9380","凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"], -["9440","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅"], -["9480","楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"], -["9540","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷"], -["9580","斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"], -["9640","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆"], -["9680","摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"], -["9740","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲"], -["9780","沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"], -["9840","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"], -["989f","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"], -["9940","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭"], -["9980","凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"], -["9a40","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸"], -["9a80","噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"], -["9b40","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀"], -["9b80","它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"], -["9c40","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠"], -["9c80","怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"], -["9d40","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫"], -["9d80","捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"], -["9e40","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎"], -["9e80","梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"], -["9f40","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯"], -["9f80","麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"], -["e040","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝"], -["e080","烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"], -["e140","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿"], -["e180","痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"], -["e240","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰"], -["e280","窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"], -["e340","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷"], -["e380","縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"], -["e440","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤"], -["e480","艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"], -["e540","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬"], -["e580","蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"], -["e640","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧"], -["e680","諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"], -["e740","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜"], -["e780","轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"], -["e840","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙"], -["e880","閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"], -["e940","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃"], -["e980","騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"], -["ea40","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯"], -["ea80","黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙"], -["ed40","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏"], -["ed80","塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"], -["ee40","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙"], -["ee80","蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"], -["eeef","ⅰ",9,"¬¦'""], -["f040","",62], -["f080","",124], -["f140","",62], -["f180","",124], -["f240","",62], -["f280","",124], -["f340","",62], -["f380","",124], -["f440","",62], -["f480","",124], -["f540","",62], -["f580","",124], -["f640","",62], -["f680","",124], -["f740","",62], -["f780","",124], -["f840","",62], -["f880","",124], -["f940",""], -["fa40","ⅰ",9,"Ⅰ",9,"¬¦'"㈱№℡∵纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊"], -["fa80","兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯"], -["fb40","涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神"], -["fb80","祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙"], -["fc40","髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"] -] diff --git a/node_modules/iconv-lite/encodings/utf16.js b/node_modules/iconv-lite/encodings/utf16.js deleted file mode 100644 index 54765ae..0000000 --- a/node_modules/iconv-lite/encodings/utf16.js +++ /dev/null @@ -1,177 +0,0 @@ -"use strict"; -var Buffer = require("safer-buffer").Buffer; - -// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js - -// == UTF16-BE codec. ========================================================== - -exports.utf16be = Utf16BECodec; -function Utf16BECodec() { -} - -Utf16BECodec.prototype.encoder = Utf16BEEncoder; -Utf16BECodec.prototype.decoder = Utf16BEDecoder; -Utf16BECodec.prototype.bomAware = true; - - -// -- Encoding - -function Utf16BEEncoder() { -} - -Utf16BEEncoder.prototype.write = function(str) { - var buf = Buffer.from(str, 'ucs2'); - for (var i = 0; i < buf.length; i += 2) { - var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp; - } - return buf; -} - -Utf16BEEncoder.prototype.end = function() { -} - - -// -- Decoding - -function Utf16BEDecoder() { - this.overflowByte = -1; -} - -Utf16BEDecoder.prototype.write = function(buf) { - if (buf.length == 0) - return ''; - - var buf2 = Buffer.alloc(buf.length + 1), - i = 0, j = 0; - - if (this.overflowByte !== -1) { - buf2[0] = buf[0]; - buf2[1] = this.overflowByte; - i = 1; j = 2; - } - - for (; i < buf.length-1; i += 2, j+= 2) { - buf2[j] = buf[i+1]; - buf2[j+1] = buf[i]; - } - - this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1; - - return buf2.slice(0, j).toString('ucs2'); -} - -Utf16BEDecoder.prototype.end = function() { -} - - -// == UTF-16 codec ============================================================= -// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic. -// Defaults to UTF-16LE, as it's prevalent and default in Node. -// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le -// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'}); - -// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false). - -exports.utf16 = Utf16Codec; -function Utf16Codec(codecOptions, iconv) { - this.iconv = iconv; -} - -Utf16Codec.prototype.encoder = Utf16Encoder; -Utf16Codec.prototype.decoder = Utf16Decoder; - - -// -- Encoding (pass-through) - -function Utf16Encoder(options, codec) { - options = options || {}; - if (options.addBOM === undefined) - options.addBOM = true; - this.encoder = codec.iconv.getEncoder('utf-16le', options); -} - -Utf16Encoder.prototype.write = function(str) { - return this.encoder.write(str); -} - -Utf16Encoder.prototype.end = function() { - return this.encoder.end(); -} - - -// -- Decoding - -function Utf16Decoder(options, codec) { - this.decoder = null; - this.initialBytes = []; - this.initialBytesLen = 0; - - this.options = options || {}; - this.iconv = codec.iconv; -} - -Utf16Decoder.prototype.write = function(buf) { - if (!this.decoder) { - // Codec is not chosen yet. Accumulate initial bytes. - this.initialBytes.push(buf); - this.initialBytesLen += buf.length; - - if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below) - return ''; - - // We have enough bytes -> detect endianness. - var buf = Buffer.concat(this.initialBytes), - encoding = detectEncoding(buf, this.options.defaultEncoding); - this.decoder = this.iconv.getDecoder(encoding, this.options); - this.initialBytes.length = this.initialBytesLen = 0; - } - - return this.decoder.write(buf); -} - -Utf16Decoder.prototype.end = function() { - if (!this.decoder) { - var buf = Buffer.concat(this.initialBytes), - encoding = detectEncoding(buf, this.options.defaultEncoding); - this.decoder = this.iconv.getDecoder(encoding, this.options); - - var res = this.decoder.write(buf), - trail = this.decoder.end(); - - return trail ? (res + trail) : res; - } - return this.decoder.end(); -} - -function detectEncoding(buf, defaultEncoding) { - var enc = defaultEncoding || 'utf-16le'; - - if (buf.length >= 2) { - // Check BOM. - if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM - enc = 'utf-16be'; - else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM - enc = 'utf-16le'; - else { - // No BOM found. Try to deduce encoding from initial content. - // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon. - // So, we count ASCII as if it was LE or BE, and decide from that. - var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions - _len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even. - - for (var i = 0; i < _len; i += 2) { - if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++; - if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++; - } - - if (asciiCharsBE > asciiCharsLE) - enc = 'utf-16be'; - else if (asciiCharsBE < asciiCharsLE) - enc = 'utf-16le'; - } - } - - return enc; -} - - diff --git a/node_modules/iconv-lite/encodings/utf7.js b/node_modules/iconv-lite/encodings/utf7.js deleted file mode 100644 index b7631c2..0000000 --- a/node_modules/iconv-lite/encodings/utf7.js +++ /dev/null @@ -1,290 +0,0 @@ -"use strict"; -var Buffer = require("safer-buffer").Buffer; - -// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152 -// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3 - -exports.utf7 = Utf7Codec; -exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7 -function Utf7Codec(codecOptions, iconv) { - this.iconv = iconv; -}; - -Utf7Codec.prototype.encoder = Utf7Encoder; -Utf7Codec.prototype.decoder = Utf7Decoder; -Utf7Codec.prototype.bomAware = true; - - -// -- Encoding - -var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g; - -function Utf7Encoder(options, codec) { - this.iconv = codec.iconv; -} - -Utf7Encoder.prototype.write = function(str) { - // Naive implementation. - // Non-direct chars are encoded as "+-"; single "+" char is encoded as "+-". - return Buffer.from(str.replace(nonDirectChars, function(chunk) { - return "+" + (chunk === '+' ? '' : - this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) - + "-"; - }.bind(this))); -} - -Utf7Encoder.prototype.end = function() { -} - - -// -- Decoding - -function Utf7Decoder(options, codec) { - this.iconv = codec.iconv; - this.inBase64 = false; - this.base64Accum = ''; -} - -var base64Regex = /[A-Za-z0-9\/+]/; -var base64Chars = []; -for (var i = 0; i < 256; i++) - base64Chars[i] = base64Regex.test(String.fromCharCode(i)); - -var plusChar = '+'.charCodeAt(0), - minusChar = '-'.charCodeAt(0), - andChar = '&'.charCodeAt(0); - -Utf7Decoder.prototype.write = function(buf) { - var res = "", lastI = 0, - inBase64 = this.inBase64, - base64Accum = this.base64Accum; - - // The decoder is more involved as we must handle chunks in stream. - - for (var i = 0; i < buf.length; i++) { - if (!inBase64) { // We're in direct mode. - // Write direct chars until '+' - if (buf[i] == plusChar) { - res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. - lastI = i+1; - inBase64 = true; - } - } else { // We decode base64. - if (!base64Chars[buf[i]]) { // Base64 ended. - if (i == lastI && buf[i] == minusChar) {// "+-" -> "+" - res += "+"; - } else { - var b64str = base64Accum + buf.slice(lastI, i).toString(); - res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); - } - - if (buf[i] != minusChar) // Minus is absorbed after base64. - i--; - - lastI = i+1; - inBase64 = false; - base64Accum = ''; - } - } - } - - if (!inBase64) { - res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. - } else { - var b64str = base64Accum + buf.slice(lastI).toString(); - - var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. - base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. - b64str = b64str.slice(0, canBeDecoded); - - res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); - } - - this.inBase64 = inBase64; - this.base64Accum = base64Accum; - - return res; -} - -Utf7Decoder.prototype.end = function() { - var res = ""; - if (this.inBase64 && this.base64Accum.length > 0) - res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); - - this.inBase64 = false; - this.base64Accum = ''; - return res; -} - - -// UTF-7-IMAP codec. -// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3) -// Differences: -// * Base64 part is started by "&" instead of "+" -// * Direct characters are 0x20-0x7E, except "&" (0x26) -// * In Base64, "," is used instead of "/" -// * Base64 must not be used to represent direct characters. -// * No implicit shift back from Base64 (should always end with '-') -// * String must end in non-shifted position. -// * "-&" while in base64 is not allowed. - - -exports.utf7imap = Utf7IMAPCodec; -function Utf7IMAPCodec(codecOptions, iconv) { - this.iconv = iconv; -}; - -Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder; -Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder; -Utf7IMAPCodec.prototype.bomAware = true; - - -// -- Encoding - -function Utf7IMAPEncoder(options, codec) { - this.iconv = codec.iconv; - this.inBase64 = false; - this.base64Accum = Buffer.alloc(6); - this.base64AccumIdx = 0; -} - -Utf7IMAPEncoder.prototype.write = function(str) { - var inBase64 = this.inBase64, - base64Accum = this.base64Accum, - base64AccumIdx = this.base64AccumIdx, - buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0; - - for (var i = 0; i < str.length; i++) { - var uChar = str.charCodeAt(i); - if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'. - if (inBase64) { - if (base64AccumIdx > 0) { - bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); - base64AccumIdx = 0; - } - - buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. - inBase64 = false; - } - - if (!inBase64) { - buf[bufIdx++] = uChar; // Write direct character - - if (uChar === andChar) // Ampersand -> '&-' - buf[bufIdx++] = minusChar; - } - - } else { // Non-direct character - if (!inBase64) { - buf[bufIdx++] = andChar; // Write '&', then go to base64 mode. - inBase64 = true; - } - if (inBase64) { - base64Accum[base64AccumIdx++] = uChar >> 8; - base64Accum[base64AccumIdx++] = uChar & 0xFF; - - if (base64AccumIdx == base64Accum.length) { - bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx); - base64AccumIdx = 0; - } - } - } - } - - this.inBase64 = inBase64; - this.base64AccumIdx = base64AccumIdx; - - return buf.slice(0, bufIdx); -} - -Utf7IMAPEncoder.prototype.end = function() { - var buf = Buffer.alloc(10), bufIdx = 0; - if (this.inBase64) { - if (this.base64AccumIdx > 0) { - bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); - this.base64AccumIdx = 0; - } - - buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. - this.inBase64 = false; - } - - return buf.slice(0, bufIdx); -} - - -// -- Decoding - -function Utf7IMAPDecoder(options, codec) { - this.iconv = codec.iconv; - this.inBase64 = false; - this.base64Accum = ''; -} - -var base64IMAPChars = base64Chars.slice(); -base64IMAPChars[','.charCodeAt(0)] = true; - -Utf7IMAPDecoder.prototype.write = function(buf) { - var res = "", lastI = 0, - inBase64 = this.inBase64, - base64Accum = this.base64Accum; - - // The decoder is more involved as we must handle chunks in stream. - // It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end). - - for (var i = 0; i < buf.length; i++) { - if (!inBase64) { // We're in direct mode. - // Write direct chars until '&' - if (buf[i] == andChar) { - res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. - lastI = i+1; - inBase64 = true; - } - } else { // We decode base64. - if (!base64IMAPChars[buf[i]]) { // Base64 ended. - if (i == lastI && buf[i] == minusChar) { // "&-" -> "&" - res += "&"; - } else { - var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/'); - res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); - } - - if (buf[i] != minusChar) // Minus may be absorbed after base64. - i--; - - lastI = i+1; - inBase64 = false; - base64Accum = ''; - } - } - } - - if (!inBase64) { - res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. - } else { - var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/'); - - var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. - base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. - b64str = b64str.slice(0, canBeDecoded); - - res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); - } - - this.inBase64 = inBase64; - this.base64Accum = base64Accum; - - return res; -} - -Utf7IMAPDecoder.prototype.end = function() { - var res = ""; - if (this.inBase64 && this.base64Accum.length > 0) - res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); - - this.inBase64 = false; - this.base64Accum = ''; - return res; -} - - diff --git a/node_modules/iconv-lite/lib/bom-handling.js b/node_modules/iconv-lite/lib/bom-handling.js deleted file mode 100644 index 1050872..0000000 --- a/node_modules/iconv-lite/lib/bom-handling.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -var BOMChar = '\uFEFF'; - -exports.PrependBOM = PrependBOMWrapper -function PrependBOMWrapper(encoder, options) { - this.encoder = encoder; - this.addBOM = true; -} - -PrependBOMWrapper.prototype.write = function(str) { - if (this.addBOM) { - str = BOMChar + str; - this.addBOM = false; - } - - return this.encoder.write(str); -} - -PrependBOMWrapper.prototype.end = function() { - return this.encoder.end(); -} - - -//------------------------------------------------------------------------------ - -exports.StripBOM = StripBOMWrapper; -function StripBOMWrapper(decoder, options) { - this.decoder = decoder; - this.pass = false; - this.options = options || {}; -} - -StripBOMWrapper.prototype.write = function(buf) { - var res = this.decoder.write(buf); - if (this.pass || !res) - return res; - - if (res[0] === BOMChar) { - res = res.slice(1); - if (typeof this.options.stripBOM === 'function') - this.options.stripBOM(); - } - - this.pass = true; - return res; -} - -StripBOMWrapper.prototype.end = function() { - return this.decoder.end(); -} - diff --git a/node_modules/iconv-lite/lib/extend-node.js b/node_modules/iconv-lite/lib/extend-node.js deleted file mode 100644 index 87f5394..0000000 --- a/node_modules/iconv-lite/lib/extend-node.js +++ /dev/null @@ -1,217 +0,0 @@ -"use strict"; -var Buffer = require("buffer").Buffer; -// Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer - -// == Extend Node primitives to use iconv-lite ================================= - -module.exports = function (iconv) { - var original = undefined; // Place to keep original methods. - - // Node authors rewrote Buffer internals to make it compatible with - // Uint8Array and we cannot patch key functions since then. - // Note: this does use older Buffer API on a purpose - iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array); - - iconv.extendNodeEncodings = function extendNodeEncodings() { - if (original) return; - original = {}; - - if (!iconv.supportsNodeEncodingsExtension) { - console.error("ACTION NEEDED: require('iconv-lite').extendNodeEncodings() is not supported in your version of Node"); - console.error("See more info at https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility"); - return; - } - - var nodeNativeEncodings = { - 'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true, - 'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true, - }; - - Buffer.isNativeEncoding = function(enc) { - return enc && nodeNativeEncodings[enc.toLowerCase()]; - } - - // -- SlowBuffer ----------------------------------------------------------- - var SlowBuffer = require('buffer').SlowBuffer; - - original.SlowBufferToString = SlowBuffer.prototype.toString; - SlowBuffer.prototype.toString = function(encoding, start, end) { - encoding = String(encoding || 'utf8').toLowerCase(); - - // Use native conversion when possible - if (Buffer.isNativeEncoding(encoding)) - return original.SlowBufferToString.call(this, encoding, start, end); - - // Otherwise, use our decoding method. - if (typeof start == 'undefined') start = 0; - if (typeof end == 'undefined') end = this.length; - return iconv.decode(this.slice(start, end), encoding); - } - - original.SlowBufferWrite = SlowBuffer.prototype.write; - SlowBuffer.prototype.write = function(string, offset, length, encoding) { - // Support both (string, offset, length, encoding) - // and the legacy (string, encoding, offset, length) - if (isFinite(offset)) { - if (!isFinite(length)) { - encoding = length; - length = undefined; - } - } else { // legacy - var swap = encoding; - encoding = offset; - offset = length; - length = swap; - } - - offset = +offset || 0; - var remaining = this.length - offset; - if (!length) { - length = remaining; - } else { - length = +length; - if (length > remaining) { - length = remaining; - } - } - encoding = String(encoding || 'utf8').toLowerCase(); - - // Use native conversion when possible - if (Buffer.isNativeEncoding(encoding)) - return original.SlowBufferWrite.call(this, string, offset, length, encoding); - - if (string.length > 0 && (length < 0 || offset < 0)) - throw new RangeError('attempt to write beyond buffer bounds'); - - // Otherwise, use our encoding method. - var buf = iconv.encode(string, encoding); - if (buf.length < length) length = buf.length; - buf.copy(this, offset, 0, length); - return length; - } - - // -- Buffer --------------------------------------------------------------- - - original.BufferIsEncoding = Buffer.isEncoding; - Buffer.isEncoding = function(encoding) { - return Buffer.isNativeEncoding(encoding) || iconv.encodingExists(encoding); - } - - original.BufferByteLength = Buffer.byteLength; - Buffer.byteLength = SlowBuffer.byteLength = function(str, encoding) { - encoding = String(encoding || 'utf8').toLowerCase(); - - // Use native conversion when possible - if (Buffer.isNativeEncoding(encoding)) - return original.BufferByteLength.call(this, str, encoding); - - // Slow, I know, but we don't have a better way yet. - return iconv.encode(str, encoding).length; - } - - original.BufferToString = Buffer.prototype.toString; - Buffer.prototype.toString = function(encoding, start, end) { - encoding = String(encoding || 'utf8').toLowerCase(); - - // Use native conversion when possible - if (Buffer.isNativeEncoding(encoding)) - return original.BufferToString.call(this, encoding, start, end); - - // Otherwise, use our decoding method. - if (typeof start == 'undefined') start = 0; - if (typeof end == 'undefined') end = this.length; - return iconv.decode(this.slice(start, end), encoding); - } - - original.BufferWrite = Buffer.prototype.write; - Buffer.prototype.write = function(string, offset, length, encoding) { - var _offset = offset, _length = length, _encoding = encoding; - // Support both (string, offset, length, encoding) - // and the legacy (string, encoding, offset, length) - if (isFinite(offset)) { - if (!isFinite(length)) { - encoding = length; - length = undefined; - } - } else { // legacy - var swap = encoding; - encoding = offset; - offset = length; - length = swap; - } - - encoding = String(encoding || 'utf8').toLowerCase(); - - // Use native conversion when possible - if (Buffer.isNativeEncoding(encoding)) - return original.BufferWrite.call(this, string, _offset, _length, _encoding); - - offset = +offset || 0; - var remaining = this.length - offset; - if (!length) { - length = remaining; - } else { - length = +length; - if (length > remaining) { - length = remaining; - } - } - - if (string.length > 0 && (length < 0 || offset < 0)) - throw new RangeError('attempt to write beyond buffer bounds'); - - // Otherwise, use our encoding method. - var buf = iconv.encode(string, encoding); - if (buf.length < length) length = buf.length; - buf.copy(this, offset, 0, length); - return length; - - // TODO: Set _charsWritten. - } - - - // -- Readable ------------------------------------------------------------- - if (iconv.supportsStreams) { - var Readable = require('stream').Readable; - - original.ReadableSetEncoding = Readable.prototype.setEncoding; - Readable.prototype.setEncoding = function setEncoding(enc, options) { - // Use our own decoder, it has the same interface. - // We cannot use original function as it doesn't handle BOM-s. - this._readableState.decoder = iconv.getDecoder(enc, options); - this._readableState.encoding = enc; - } - - Readable.prototype.collect = iconv._collect; - } - } - - // Remove iconv-lite Node primitive extensions. - iconv.undoExtendNodeEncodings = function undoExtendNodeEncodings() { - if (!iconv.supportsNodeEncodingsExtension) - return; - if (!original) - throw new Error("require('iconv-lite').undoExtendNodeEncodings(): Nothing to undo; extendNodeEncodings() is not called.") - - delete Buffer.isNativeEncoding; - - var SlowBuffer = require('buffer').SlowBuffer; - - SlowBuffer.prototype.toString = original.SlowBufferToString; - SlowBuffer.prototype.write = original.SlowBufferWrite; - - Buffer.isEncoding = original.BufferIsEncoding; - Buffer.byteLength = original.BufferByteLength; - Buffer.prototype.toString = original.BufferToString; - Buffer.prototype.write = original.BufferWrite; - - if (iconv.supportsStreams) { - var Readable = require('stream').Readable; - - Readable.prototype.setEncoding = original.ReadableSetEncoding; - delete Readable.prototype.collect; - } - - original = undefined; - } -} diff --git a/node_modules/iconv-lite/lib/index.d.ts b/node_modules/iconv-lite/lib/index.d.ts deleted file mode 100644 index 0547eb3..0000000 --- a/node_modules/iconv-lite/lib/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. - * REQUIREMENT: This definition is dependent on the @types/node definition. - * Install with `npm install @types/node --save-dev` - *--------------------------------------------------------------------------------------------*/ - -declare module 'iconv-lite' { - export function decode(buffer: Buffer, encoding: string, options?: Options): string; - - export function encode(content: string, encoding: string, options?: Options): Buffer; - - export function encodingExists(encoding: string): boolean; - - export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; - - export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; -} - -export interface Options { - stripBOM?: boolean; - addBOM?: boolean; - defaultEncoding?: string; -} diff --git a/node_modules/iconv-lite/lib/index.js b/node_modules/iconv-lite/lib/index.js deleted file mode 100644 index 5391919..0000000 --- a/node_modules/iconv-lite/lib/index.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -// Some environments don't have global Buffer (e.g. React Native). -// Solution would be installing npm modules "buffer" and "stream" explicitly. -var Buffer = require("safer-buffer").Buffer; - -var bomHandling = require("./bom-handling"), - iconv = module.exports; - -// All codecs and aliases are kept here, keyed by encoding name/alias. -// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`. -iconv.encodings = null; - -// Characters emitted in case of error. -iconv.defaultCharUnicode = '�'; -iconv.defaultCharSingleByte = '?'; - -// Public API. -iconv.encode = function encode(str, encoding, options) { - str = "" + (str || ""); // Ensure string. - - var encoder = iconv.getEncoder(encoding, options); - - var res = encoder.write(str); - var trail = encoder.end(); - - return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res; -} - -iconv.decode = function decode(buf, encoding, options) { - if (typeof buf === 'string') { - if (!iconv.skipDecodeWarning) { - console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding'); - iconv.skipDecodeWarning = true; - } - - buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer. - } - - var decoder = iconv.getDecoder(encoding, options); - - var res = decoder.write(buf); - var trail = decoder.end(); - - return trail ? (res + trail) : res; -} - -iconv.encodingExists = function encodingExists(enc) { - try { - iconv.getCodec(enc); - return true; - } catch (e) { - return false; - } -} - -// Legacy aliases to convert functions -iconv.toEncoding = iconv.encode; -iconv.fromEncoding = iconv.decode; - -// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache. -iconv._codecDataCache = {}; -iconv.getCodec = function getCodec(encoding) { - if (!iconv.encodings) - iconv.encodings = require("../encodings"); // Lazy load all encoding definitions. - - // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. - var enc = iconv._canonicalizeEncoding(encoding); - - // Traverse iconv.encodings to find actual codec. - var codecOptions = {}; - while (true) { - var codec = iconv._codecDataCache[enc]; - if (codec) - return codec; - - var codecDef = iconv.encodings[enc]; - - switch (typeof codecDef) { - case "string": // Direct alias to other encoding. - enc = codecDef; - break; - - case "object": // Alias with options. Can be layered. - for (var key in codecDef) - codecOptions[key] = codecDef[key]; - - if (!codecOptions.encodingName) - codecOptions.encodingName = enc; - - enc = codecDef.type; - break; - - case "function": // Codec itself. - if (!codecOptions.encodingName) - codecOptions.encodingName = enc; - - // The codec function must load all tables and return object with .encoder and .decoder methods. - // It'll be called only once (for each different options object). - codec = new codecDef(codecOptions, iconv); - - iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later. - return codec; - - default: - throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')"); - } - } -} - -iconv._canonicalizeEncoding = function(encoding) { - // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. - return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, ""); -} - -iconv.getEncoder = function getEncoder(encoding, options) { - var codec = iconv.getCodec(encoding), - encoder = new codec.encoder(options, codec); - - if (codec.bomAware && options && options.addBOM) - encoder = new bomHandling.PrependBOM(encoder, options); - - return encoder; -} - -iconv.getDecoder = function getDecoder(encoding, options) { - var codec = iconv.getCodec(encoding), - decoder = new codec.decoder(options, codec); - - if (codec.bomAware && !(options && options.stripBOM === false)) - decoder = new bomHandling.StripBOM(decoder, options); - - return decoder; -} - - -// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json. -var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node; -if (nodeVer) { - - // Load streaming support in Node v0.10+ - var nodeVerArr = nodeVer.split(".").map(Number); - if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) { - require("./streams")(iconv); - } - - // Load Node primitive extensions. - require("./extend-node")(iconv); -} - -if ("Ā" != "\u0100") { - console.error("iconv-lite warning: javascript files use encoding different from utf-8. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info."); -} diff --git a/node_modules/iconv-lite/lib/streams.js b/node_modules/iconv-lite/lib/streams.js deleted file mode 100644 index 4409552..0000000 --- a/node_modules/iconv-lite/lib/streams.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; - -var Buffer = require("buffer").Buffer, - Transform = require("stream").Transform; - - -// == Exports ================================================================== -module.exports = function(iconv) { - - // Additional Public API. - iconv.encodeStream = function encodeStream(encoding, options) { - return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options); - } - - iconv.decodeStream = function decodeStream(encoding, options) { - return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options); - } - - iconv.supportsStreams = true; - - - // Not published yet. - iconv.IconvLiteEncoderStream = IconvLiteEncoderStream; - iconv.IconvLiteDecoderStream = IconvLiteDecoderStream; - iconv._collect = IconvLiteDecoderStream.prototype.collect; -}; - - -// == Encoder stream ======================================================= -function IconvLiteEncoderStream(conv, options) { - this.conv = conv; - options = options || {}; - options.decodeStrings = false; // We accept only strings, so we don't need to decode them. - Transform.call(this, options); -} - -IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, { - constructor: { value: IconvLiteEncoderStream } -}); - -IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) { - if (typeof chunk != 'string') - return done(new Error("Iconv encoding stream needs strings as its input.")); - try { - var res = this.conv.write(chunk); - if (res && res.length) this.push(res); - done(); - } - catch (e) { - done(e); - } -} - -IconvLiteEncoderStream.prototype._flush = function(done) { - try { - var res = this.conv.end(); - if (res && res.length) this.push(res); - done(); - } - catch (e) { - done(e); - } -} - -IconvLiteEncoderStream.prototype.collect = function(cb) { - var chunks = []; - this.on('error', cb); - this.on('data', function(chunk) { chunks.push(chunk); }); - this.on('end', function() { - cb(null, Buffer.concat(chunks)); - }); - return this; -} - - -// == Decoder stream ======================================================= -function IconvLiteDecoderStream(conv, options) { - this.conv = conv; - options = options || {}; - options.encoding = this.encoding = 'utf8'; // We output strings. - Transform.call(this, options); -} - -IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, { - constructor: { value: IconvLiteDecoderStream } -}); - -IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) { - if (!Buffer.isBuffer(chunk)) - return done(new Error("Iconv decoding stream needs buffers as its input.")); - try { - var res = this.conv.write(chunk); - if (res && res.length) this.push(res, this.encoding); - done(); - } - catch (e) { - done(e); - } -} - -IconvLiteDecoderStream.prototype._flush = function(done) { - try { - var res = this.conv.end(); - if (res && res.length) this.push(res, this.encoding); - done(); - } - catch (e) { - done(e); - } -} - -IconvLiteDecoderStream.prototype.collect = function(cb) { - var res = ''; - this.on('error', cb); - this.on('data', function(chunk) { res += chunk; }); - this.on('end', function() { - cb(null, res); - }); - return this; -} - diff --git a/node_modules/iconv-lite/package.json b/node_modules/iconv-lite/package.json deleted file mode 100644 index f554938..0000000 --- a/node_modules/iconv-lite/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "_from": "iconv-lite@^0.4.4", - "_id": "iconv-lite@0.4.24", - "_inBundle": false, - "_integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "_location": "/iconv-lite", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "iconv-lite@^0.4.4", - "name": "iconv-lite", - "escapedName": "iconv-lite", - "rawSpec": "^0.4.4", - "saveSpec": null, - "fetchSpec": "^0.4.4" - }, - "_requiredBy": [ - "/d3-dsv", - "/needle" - ], - "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "_shasum": "2022b4b25fbddc21d2f524974a474aafe733908b", - "_spec": "iconv-lite@^0.4.4", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/needle", - "author": { - "name": "Alexander Shtuchkin", - "email": "ashtuchkin@gmail.com" - }, - "browser": { - "./lib/extend-node": false, - "./lib/streams": false - }, - "bugs": { - "url": "https://github.com/ashtuchkin/iconv-lite/issues" - }, - "bundleDependencies": false, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "deprecated": false, - "description": "Convert character encodings in pure javascript.", - "devDependencies": { - "async": "*", - "errto": "*", - "iconv": "*", - "istanbul": "*", - "mocha": "^3.1.0", - "request": "~2.87.0", - "semver": "*", - "unorm": "*" - }, - "engines": { - "node": ">=0.10.0" - }, - "homepage": "https://github.com/ashtuchkin/iconv-lite", - "keywords": [ - "iconv", - "convert", - "charset", - "icu" - ], - "license": "MIT", - "main": "./lib/index.js", - "name": "iconv-lite", - "repository": { - "type": "git", - "url": "git://github.com/ashtuchkin/iconv-lite.git" - }, - "scripts": { - "coverage": "istanbul cover _mocha -- --grep .", - "coverage-open": "open coverage/lcov-report/index.html", - "test": "mocha --reporter spec --grep ." - }, - "typings": "./lib/index.d.ts", - "version": "0.4.24" -} diff --git a/node_modules/ignore-walk/LICENSE b/node_modules/ignore-walk/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/ignore-walk/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/ignore-walk/README.md b/node_modules/ignore-walk/README.md deleted file mode 100644 index 278f610..0000000 --- a/node_modules/ignore-walk/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# ignore-walk - -[![Build -Status](https://travis-ci.org/npm/ignore-walk.svg?branch=master)](https://travis-ci.org/npm/ignore-walk) - -Nested/recursive `.gitignore`/`.npmignore` parsing and filtering. - -Walk a directory creating a list of entries, parsing any `.ignore` -files met along the way to exclude files. - -## USAGE - -```javascript -const walk = require('ignore-walk') - -// All options are optional, defaults provided. - -// this function returns a promise, but you can also pass a cb -// if you like that approach better. -walk({ - path: '...', // root dir to start in. defaults to process.cwd() - ignoreFiles: [ '.gitignore' ], // list of filenames. defaults to ['.ignore'] - includeEmpty: true|false, // true to include empty dirs, default false - follow: true|false // true to follow symlink dirs, default false -}, callback) - -// to walk synchronously, do it this way: -const result = walk.sync({ path: '/wow/such/filepath' }) -``` - -If you want to get at the underlying classes, they're at `walk.Walker` -and `walk.WalkerSync`. - -## OPTIONS - -* `path` The path to start in. Defaults to `process.cwd()` - -* `ignoreFiles` Filenames to treat as ignore files. The default is - `['.ignore']`. (This is where you'd put `.gitignore` or - `.npmignore` or whatever.) If multiple ignore files are in a - directory, then rules from each are applied in the order that the - files are listed. - -* `includeEmpty` Set to `true` to include empty directories, assuming - they are not excluded by any of the ignore rules. If not set, then - this follows the standard `git` behavior of not including - directories that are empty. - - Note: this will cause an empty directory to be included if it - would contain an included entry, even if it would have otherwise - been excluded itself. - - For example, given the rules `*` (ignore everything) and `!/a/b/c` - (re-include the entry at `/a/b/c`), the directory `/a/b` will be - included if it is empty. - -* `follow` Set to `true` to treat symbolically linked directories as - directories, recursing into them. There is no handling for nested - symlinks, so `ELOOP` errors can occur in some cases when using this - option. Defaults to `false`. diff --git a/node_modules/ignore-walk/index.js b/node_modules/ignore-walk/index.js deleted file mode 100644 index eec6851..0000000 --- a/node_modules/ignore-walk/index.js +++ /dev/null @@ -1,269 +0,0 @@ -'use strict' - -const fs = require('fs') -const path = require('path') -const EE = require('events').EventEmitter -const Minimatch = require('minimatch').Minimatch - -class Walker extends EE { - constructor (opts) { - opts = opts || {} - super(opts) - this.path = opts.path || process.cwd() - this.basename = path.basename(this.path) - this.ignoreFiles = opts.ignoreFiles || [ '.ignore' ] - this.ignoreRules = {} - this.parent = opts.parent || null - this.includeEmpty = !!opts.includeEmpty - this.root = this.parent ? this.parent.root : this.path - this.follow = !!opts.follow - this.result = this.parent ? this.parent.result : new Set() - this.entries = null - this.sawError = false - } - - sort (a, b) { - return a.localeCompare(b) - } - - emit (ev, data) { - let ret = false - if (!(this.sawError && ev === 'error')) { - if (ev === 'error') - this.sawError = true - else if (ev === 'done' && !this.parent) { - data = Array.from(data) - .map(e => /^@/.test(e) ? `./${e}` : e).sort(this.sort) - this.result = data - } - - if (ev === 'error' && this.parent) - ret = this.parent.emit('error', data) - else - ret = super.emit(ev, data) - } - return ret - } - - start () { - fs.readdir(this.path, (er, entries) => - er ? this.emit('error', er) : this.onReaddir(entries)) - return this - } - - isIgnoreFile (e) { - return e !== "." && - e !== ".." && - -1 !== this.ignoreFiles.indexOf(e) - } - - onReaddir (entries) { - this.entries = entries - if (entries.length === 0) { - if (this.includeEmpty) - this.result.add(this.path.substr(this.root.length + 1)) - this.emit('done', this.result) - } else { - const hasIg = this.entries.some(e => - this.isIgnoreFile(e)) - - if (hasIg) - this.addIgnoreFiles() - else - this.filterEntries() - } - } - - addIgnoreFiles () { - const newIg = this.entries - .filter(e => this.isIgnoreFile(e)) - - let igCount = newIg.length - const then = _ => { - if (--igCount === 0) - this.filterEntries() - } - - newIg.forEach(e => this.addIgnoreFile(e, then)) - } - - addIgnoreFile (file, then) { - const ig = path.resolve(this.path, file) - fs.readFile(ig, 'utf8', (er, data) => - er ? this.emit('error', er) : this.onReadIgnoreFile(file, data, then)) - } - - onReadIgnoreFile (file, data, then) { - const mmopt = { - matchBase: true, - dot: true, - flipNegate: true, - nocase: true - } - const rules = data.split(/\r?\n/) - .filter(line => !/^#|^$/.test(line.trim())) - .map(r => new Minimatch(r, mmopt)) - - this.ignoreRules[file] = rules - - then() - } - - filterEntries () { - // at this point we either have ignore rules, or just inheriting - // this exclusion is at the point where we know the list of - // entries in the dir, but don't know what they are. since - // some of them *might* be directories, we have to run the - // match in dir-mode as well, so that we'll pick up partials - // of files that will be included later. Anything included - // at this point will be checked again later once we know - // what it is. - const filtered = this.entries.map(entry => { - // at this point, we don't know if it's a dir or not. - const passFile = this.filterEntry(entry) - const passDir = this.filterEntry(entry, true) - return (passFile || passDir) ? [entry, passFile, passDir] : false - }).filter(e => e) - - // now we stat them all - // if it's a dir, and passes as a dir, then recurse - // if it's not a dir, but passes as a file, add to set - let entryCount = filtered.length - if (entryCount === 0) { - this.emit('done', this.result) - } else { - const then = _ => { - if (-- entryCount === 0) - this.emit('done', this.result) - } - filtered.forEach(filt => { - const entry = filt[0] - const file = filt[1] - const dir = filt[2] - this.stat(entry, file, dir, then) - }) - } - } - - onstat (st, entry, file, dir, then) { - const abs = this.path + '/' + entry - if (!st.isDirectory()) { - if (file) - this.result.add(abs.substr(this.root.length + 1)) - then() - } else { - // is a directory - if (dir) - this.walker(entry, then) - else - then() - } - } - - stat (entry, file, dir, then) { - const abs = this.path + '/' + entry - fs[this.follow ? 'stat' : 'lstat'](abs, (er, st) => { - if (er) - this.emit('error', er) - else - this.onstat(st, entry, file, dir, then) - }) - } - - walkerOpt (entry) { - return { - path: this.path + '/' + entry, - parent: this, - ignoreFiles: this.ignoreFiles, - follow: this.follow, - includeEmpty: this.includeEmpty - } - } - - walker (entry, then) { - new Walker(this.walkerOpt(entry)).on('done', then).start() - } - - filterEntry (entry, partial) { - let included = true - - // this = /a/b/c - // entry = d - // parent /a/b sees c/d - if (this.parent && this.parent.filterEntry) { - var pt = this.basename + "/" + entry - included = this.parent.filterEntry(pt, partial) - } - - this.ignoreFiles.forEach(f => { - if (this.ignoreRules[f]) { - this.ignoreRules[f].forEach(rule => { - // negation means inclusion - // so if it's negated, and already included, no need to check - // likewise if it's neither negated nor included - if (rule.negate !== included) { - // first, match against /foo/bar - // then, against foo/bar - // then, in the case of partials, match with a / - const match = rule.match('/' + entry) || - rule.match(entry) || - (!!partial && ( - rule.match('/' + entry + '/') || - rule.match(entry + '/'))) || - (!!partial && rule.negate && ( - rule.match('/' + entry, true) || - rule.match(entry, true))) - - if (match) - included = rule.negate - } - }) - } - }) - - return included - } -} - -class WalkerSync extends Walker { - constructor (opt) { - super(opt) - } - - start () { - this.onReaddir(fs.readdirSync(this.path)) - return this - } - - addIgnoreFile (file, then) { - const ig = path.resolve(this.path, file) - this.onReadIgnoreFile(file, fs.readFileSync(ig, 'utf8'), then) - } - - stat (entry, file, dir, then) { - const abs = this.path + '/' + entry - const st = fs[this.follow ? 'statSync' : 'lstatSync'](abs) - this.onstat(st, entry, file, dir, then) - } - - walker (entry, then) { - new WalkerSync(this.walkerOpt(entry)).start() - then() - } -} - -const walk = (options, callback) => { - const p = new Promise((resolve, reject) => { - new Walker(options).on('done', resolve).on('error', reject).start() - }) - return callback ? p.then(res => callback(null, res), callback) : p -} - -const walkSync = options => { - return new WalkerSync(options).start().result -} - -module.exports = walk -walk.sync = walkSync -walk.Walker = Walker -walk.WalkerSync = WalkerSync diff --git a/node_modules/ignore-walk/package.json b/node_modules/ignore-walk/package.json deleted file mode 100644 index dfbe2b7..0000000 --- a/node_modules/ignore-walk/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "ignore-walk@^3.0.1", - "_id": "ignore-walk@3.0.3", - "_inBundle": false, - "_integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", - "_location": "/ignore-walk", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ignore-walk@^3.0.1", - "name": "ignore-walk", - "escapedName": "ignore-walk", - "rawSpec": "^3.0.1", - "saveSpec": null, - "fetchSpec": "^3.0.1" - }, - "_requiredBy": [ - "/npm-packlist" - ], - "_resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", - "_shasum": "017e2447184bfeade7c238e4aefdd1e8f95b1e37", - "_spec": "ignore-walk@^3.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/npm-packlist", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/ignore-walk/issues" - }, - "bundleDependencies": false, - "dependencies": { - "minimatch": "^3.0.4" - }, - "deprecated": false, - "description": "Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.", - "devDependencies": { - "mkdirp": "^0.5.1", - "mutate-fs": "^1.1.0", - "rimraf": "^2.6.1", - "tap": "^14.6.9" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/isaacs/ignore-walk#readme", - "keywords": [ - "ignorefile", - "ignore", - "file", - ".gitignore", - ".npmignore", - "glob" - ], - "license": "ISC", - "main": "index.js", - "name": "ignore-walk", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/ignore-walk.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap" - }, - "tap": { - "jobs": 1 - }, - "version": "3.0.3" -} diff --git a/node_modules/inflight/LICENSE b/node_modules/inflight/LICENSE deleted file mode 100644 index 05eeeb8..0000000 --- a/node_modules/inflight/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/inflight/README.md b/node_modules/inflight/README.md deleted file mode 100644 index 6dc8929..0000000 --- a/node_modules/inflight/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# inflight - -Add callbacks to requests in flight to avoid async duplication - -## USAGE - -```javascript -var inflight = require('inflight') - -// some request that does some stuff -function req(key, callback) { - // key is any random string. like a url or filename or whatever. - // - // will return either a falsey value, indicating that the - // request for this key is already in flight, or a new callback - // which when called will call all callbacks passed to inflightk - // with the same key - callback = inflight(key, callback) - - // If we got a falsey value back, then there's already a req going - if (!callback) return - - // this is where you'd fetch the url or whatever - // callback is also once()-ified, so it can safely be assigned - // to multiple events etc. First call wins. - setTimeout(function() { - callback(null, key) - }, 100) -} - -// only assigns a single setTimeout -// when it dings, all cbs get called -req('foo', cb1) -req('foo', cb2) -req('foo', cb3) -req('foo', cb4) -``` diff --git a/node_modules/inflight/inflight.js b/node_modules/inflight/inflight.js deleted file mode 100644 index 48202b3..0000000 --- a/node_modules/inflight/inflight.js +++ /dev/null @@ -1,54 +0,0 @@ -var wrappy = require('wrappy') -var reqs = Object.create(null) -var once = require('once') - -module.exports = wrappy(inflight) - -function inflight (key, cb) { - if (reqs[key]) { - reqs[key].push(cb) - return null - } else { - reqs[key] = [cb] - return makeres(key) - } -} - -function makeres (key) { - return once(function RES () { - var cbs = reqs[key] - var len = cbs.length - var args = slice(arguments) - - // XXX It's somewhat ambiguous whether a new callback added in this - // pass should be queued for later execution if something in the - // list of callbacks throws, or if it should just be discarded. - // However, it's such an edge case that it hardly matters, and either - // choice is likely as surprising as the other. - // As it happens, we do go ahead and schedule it for later execution. - try { - for (var i = 0; i < len; i++) { - cbs[i].apply(null, args) - } - } finally { - if (cbs.length > len) { - // added more in the interim. - // de-zalgo, just in case, but don't call again. - cbs.splice(0, len) - process.nextTick(function () { - RES.apply(null, args) - }) - } else { - delete reqs[key] - } - } - }) -} - -function slice (args) { - var length = args.length - var array = [] - - for (var i = 0; i < length; i++) array[i] = args[i] - return array -} diff --git a/node_modules/inflight/package.json b/node_modules/inflight/package.json deleted file mode 100644 index 04ac452..0000000 --- a/node_modules/inflight/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "_from": "inflight@^1.0.4", - "_id": "inflight@1.0.6", - "_inBundle": false, - "_integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "_location": "/inflight", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "inflight@^1.0.4", - "name": "inflight", - "escapedName": "inflight", - "rawSpec": "^1.0.4", - "saveSpec": null, - "fetchSpec": "^1.0.4" - }, - "_requiredBy": [ - "/glob" - ], - "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9", - "_spec": "inflight@^1.0.4", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/glob", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/inflight/issues" - }, - "bundleDependencies": false, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - }, - "deprecated": false, - "description": "Add callbacks to requests in flight to avoid async duplication", - "devDependencies": { - "tap": "^7.1.2" - }, - "files": [ - "inflight.js" - ], - "homepage": "https://github.com/isaacs/inflight", - "license": "ISC", - "main": "inflight.js", - "name": "inflight", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/inflight.git" - }, - "scripts": { - "test": "tap test.js --100" - }, - "version": "1.0.6" -} diff --git a/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE deleted file mode 100644 index dea3013..0000000 --- a/node_modules/inherits/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - diff --git a/node_modules/inherits/README.md b/node_modules/inherits/README.md deleted file mode 100644 index b1c5665..0000000 --- a/node_modules/inherits/README.md +++ /dev/null @@ -1,42 +0,0 @@ -Browser-friendly inheritance fully compatible with standard node.js -[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). - -This package exports standard `inherits` from node.js `util` module in -node environment, but also provides alternative browser-friendly -implementation through [browser -field](https://gist.github.com/shtylman/4339901). Alternative -implementation is a literal copy of standard one located in standalone -module to avoid requiring of `util`. It also has a shim for old -browsers with no `Object.create` support. - -While keeping you sure you are using standard `inherits` -implementation in node.js environment, it allows bundlers such as -[browserify](https://github.com/substack/node-browserify) to not -include full `util` package to your client code if all you need is -just `inherits` function. It worth, because browser shim for `util` -package is large and `inherits` is often the single function you need -from it. - -It's recommended to use this package instead of -`require('util').inherits` for any code that has chances to be used -not only in node.js but in browser too. - -## usage - -```js -var inherits = require('inherits'); -// then use exactly as the standard one -``` - -## note on version ~1.0 - -Version ~1.0 had completely different motivation and is not compatible -neither with 2.0 nor with standard node.js `inherits`. - -If you are using version ~1.0 and planning to switch to ~2.0, be -careful: - -* new version uses `super_` instead of `super` for referencing - superclass -* new version overwrites current prototype while old one preserves any - existing fields on it diff --git a/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js deleted file mode 100644 index f71f2d9..0000000 --- a/node_modules/inherits/inherits.js +++ /dev/null @@ -1,9 +0,0 @@ -try { - var util = require('util'); - /* istanbul ignore next */ - if (typeof util.inherits !== 'function') throw ''; - module.exports = util.inherits; -} catch (e) { - /* istanbul ignore next */ - module.exports = require('./inherits_browser.js'); -} diff --git a/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js deleted file mode 100644 index 86bbb3d..0000000 --- a/node_modules/inherits/inherits_browser.js +++ /dev/null @@ -1,27 +0,0 @@ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json deleted file mode 100644 index a8b847c..0000000 --- a/node_modules/inherits/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "inherits@~2.0.3", - "_id": "inherits@2.0.4", - "_inBundle": false, - "_integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "_location": "/inherits", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "inherits@~2.0.3", - "name": "inherits", - "escapedName": "inherits", - "rawSpec": "~2.0.3", - "saveSpec": null, - "fetchSpec": "~2.0.3" - }, - "_requiredBy": [ - "/glob", - "/readable-stream" - ], - "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "_shasum": "0fa2c64f932917c3433a0ded55363aae37416b7c", - "_spec": "inherits@~2.0.3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/readable-stream", - "browser": "./inherits_browser.js", - "bugs": { - "url": "https://github.com/isaacs/inherits/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "devDependencies": { - "tap": "^14.2.4" - }, - "files": [ - "inherits.js", - "inherits_browser.js" - ], - "homepage": "https://github.com/isaacs/inherits#readme", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "license": "ISC", - "main": "./inherits.js", - "name": "inherits", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/inherits.git" - }, - "scripts": { - "test": "tap" - }, - "version": "2.0.4" -} diff --git a/node_modules/ini/LICENSE b/node_modules/ini/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/ini/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/ini/README.md b/node_modules/ini/README.md deleted file mode 100644 index 33df258..0000000 --- a/node_modules/ini/README.md +++ /dev/null @@ -1,102 +0,0 @@ -An ini format parser and serializer for node. - -Sections are treated as nested objects. Items before the first -heading are saved on the object directly. - -## Usage - -Consider an ini-file `config.ini` that looks like this: - - ; this comment is being ignored - scope = global - - [database] - user = dbuser - password = dbpassword - database = use_this_database - - [paths.default] - datadir = /var/lib/data - array[] = first value - array[] = second value - array[] = third value - -You can read, manipulate and write the ini-file like so: - - var fs = require('fs') - , ini = require('ini') - - var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8')) - - config.scope = 'local' - config.database.database = 'use_another_database' - config.paths.default.tmpdir = '/tmp' - delete config.paths.default.datadir - config.paths.default.array.push('fourth value') - - fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' })) - -This will result in a file called `config_modified.ini` being written -to the filesystem with the following content: - - [section] - scope=local - [section.database] - user=dbuser - password=dbpassword - database=use_another_database - [section.paths.default] - tmpdir=/tmp - array[]=first value - array[]=second value - array[]=third value - array[]=fourth value - - -## API - -### decode(inistring) - -Decode the ini-style formatted `inistring` into a nested object. - -### parse(inistring) - -Alias for `decode(inistring)` - -### encode(object, [options]) - -Encode the object `object` into an ini-style formatted string. If the -optional parameter `section` is given, then all top-level properties -of the object are put into this section and the `section`-string is -prepended to all sub-sections, see the usage example above. - -The `options` object may contain the following: - -* `section` A string which will be the first `section` in the encoded - ini data. Defaults to none. -* `whitespace` Boolean to specify whether to put whitespace around the - `=` character. By default, whitespace is omitted, to be friendly to - some persnickety old parsers that don't tolerate it well. But some - find that it's more human-readable and pretty with the whitespace. - -For backwards compatibility reasons, if a `string` options is passed -in, then it is assumed to be the `section` value. - -### stringify(object, [options]) - -Alias for `encode(object, [options])` - -### safe(val) - -Escapes the string `val` such that it is safe to be used as a key or -value in an ini-file. Basically escapes quotes. For example - - ini.safe('"unsafe string"') - -would result in - - "\"unsafe string\"" - -### unsafe(val) - -Unescapes the string `val` diff --git a/node_modules/ini/ini.js b/node_modules/ini/ini.js deleted file mode 100644 index 590195d..0000000 --- a/node_modules/ini/ini.js +++ /dev/null @@ -1,194 +0,0 @@ -exports.parse = exports.decode = decode - -exports.stringify = exports.encode = encode - -exports.safe = safe -exports.unsafe = unsafe - -var eol = typeof process !== 'undefined' && - process.platform === 'win32' ? '\r\n' : '\n' - -function encode (obj, opt) { - var children = [] - var out = '' - - if (typeof opt === 'string') { - opt = { - section: opt, - whitespace: false - } - } else { - opt = opt || {} - opt.whitespace = opt.whitespace === true - } - - var separator = opt.whitespace ? ' = ' : '=' - - Object.keys(obj).forEach(function (k, _, __) { - var val = obj[k] - if (val && Array.isArray(val)) { - val.forEach(function (item) { - out += safe(k + '[]') + separator + safe(item) + '\n' - }) - } else if (val && typeof val === 'object') { - children.push(k) - } else { - out += safe(k) + separator + safe(val) + eol - } - }) - - if (opt.section && out.length) { - out = '[' + safe(opt.section) + ']' + eol + out - } - - children.forEach(function (k, _, __) { - var nk = dotSplit(k).join('\\.') - var section = (opt.section ? opt.section + '.' : '') + nk - var child = encode(obj[k], { - section: section, - whitespace: opt.whitespace - }) - if (out.length && child.length) { - out += eol - } - out += child - }) - - return out -} - -function dotSplit (str) { - return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002') - .replace(/\\\./g, '\u0001') - .split(/\./).map(function (part) { - return part.replace(/\1/g, '\\.') - .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001') - }) -} - -function decode (str) { - var out = {} - var p = out - var section = null - // section |key = value - var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i - var lines = str.split(/[\r\n]+/g) - - lines.forEach(function (line, _, __) { - if (!line || line.match(/^\s*[;#]/)) return - var match = line.match(re) - if (!match) return - if (match[1] !== undefined) { - section = unsafe(match[1]) - p = out[section] = out[section] || {} - return - } - var key = unsafe(match[2]) - var value = match[3] ? unsafe(match[4]) : true - switch (value) { - case 'true': - case 'false': - case 'null': value = JSON.parse(value) - } - - // Convert keys with '[]' suffix to an array - if (key.length > 2 && key.slice(-2) === '[]') { - key = key.substring(0, key.length - 2) - if (!p[key]) { - p[key] = [] - } else if (!Array.isArray(p[key])) { - p[key] = [p[key]] - } - } - - // safeguard against resetting a previously defined - // array by accidentally forgetting the brackets - if (Array.isArray(p[key])) { - p[key].push(value) - } else { - p[key] = value - } - }) - - // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} - // use a filter to return the keys that have to be deleted. - Object.keys(out).filter(function (k, _, __) { - if (!out[k] || - typeof out[k] !== 'object' || - Array.isArray(out[k])) { - return false - } - // see if the parent section is also an object. - // if so, add it to that, and mark this one for deletion - var parts = dotSplit(k) - var p = out - var l = parts.pop() - var nl = l.replace(/\\\./g, '.') - parts.forEach(function (part, _, __) { - if (!p[part] || typeof p[part] !== 'object') p[part] = {} - p = p[part] - }) - if (p === out && nl === l) { - return false - } - p[nl] = out[k] - return true - }).forEach(function (del, _, __) { - delete out[del] - }) - - return out -} - -function isQuoted (val) { - return (val.charAt(0) === '"' && val.slice(-1) === '"') || - (val.charAt(0) === "'" && val.slice(-1) === "'") -} - -function safe (val) { - return (typeof val !== 'string' || - val.match(/[=\r\n]/) || - val.match(/^\[/) || - (val.length > 1 && - isQuoted(val)) || - val !== val.trim()) - ? JSON.stringify(val) - : val.replace(/;/g, '\\;').replace(/#/g, '\\#') -} - -function unsafe (val, doUnesc) { - val = (val || '').trim() - if (isQuoted(val)) { - // remove the single quotes before calling JSON.parse - if (val.charAt(0) === "'") { - val = val.substr(1, val.length - 2) - } - try { val = JSON.parse(val) } catch (_) {} - } else { - // walk the val to find the first not-escaped ; character - var esc = false - var unesc = '' - for (var i = 0, l = val.length; i < l; i++) { - var c = val.charAt(i) - if (esc) { - if ('\\;#'.indexOf(c) !== -1) { - unesc += c - } else { - unesc += '\\' + c - } - esc = false - } else if (';#'.indexOf(c) !== -1) { - break - } else if (c === '\\') { - esc = true - } else { - unesc += c - } - } - if (esc) { - unesc += '\\' - } - return unesc.trim() - } - return val -} diff --git a/node_modules/ini/package.json b/node_modules/ini/package.json deleted file mode 100644 index ef255b2..0000000 --- a/node_modules/ini/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "_from": "ini@~1.3.0", - "_id": "ini@1.3.5", - "_inBundle": false, - "_integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "_location": "/ini", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ini@~1.3.0", - "name": "ini", - "escapedName": "ini", - "rawSpec": "~1.3.0", - "saveSpec": null, - "fetchSpec": "~1.3.0" - }, - "_requiredBy": [ - "/rc" - ], - "_resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "_shasum": "eee25f56db1c9ec6085e0c22778083f596abf927", - "_spec": "ini@~1.3.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/rc", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/ini/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "An ini encoder/decoder for node", - "devDependencies": { - "standard": "^10.0.3", - "tap": "^10.7.3 || 11" - }, - "engines": { - "node": "*" - }, - "files": [ - "ini.js" - ], - "homepage": "https://github.com/isaacs/ini#readme", - "license": "ISC", - "main": "ini.js", - "name": "ini", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/ini.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "pretest": "standard ini.js", - "preversion": "npm test", - "test": "tap test/*.js --100 -J" - }, - "version": "1.3.5" -} diff --git a/node_modules/is-fullwidth-code-point/index.js b/node_modules/is-fullwidth-code-point/index.js deleted file mode 100644 index a7d3e38..0000000 --- a/node_modules/is-fullwidth-code-point/index.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; -var numberIsNan = require('number-is-nan'); - -module.exports = function (x) { - if (numberIsNan(x)) { - return false; - } - - // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369 - - // code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if (x >= 0x1100 && ( - x <= 0x115f || // Hangul Jamo - 0x2329 === x || // LEFT-POINTING ANGLE BRACKET - 0x232a === x || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - 0x3250 <= x && x <= 0x4dbf || - // CJK Unified Ideographs .. Yi Radicals - 0x4e00 <= x && x <= 0xa4c6 || - // Hangul Jamo Extended-A - 0xa960 <= x && x <= 0xa97c || - // Hangul Syllables - 0xac00 <= x && x <= 0xd7a3 || - // CJK Compatibility Ideographs - 0xf900 <= x && x <= 0xfaff || - // Vertical Forms - 0xfe10 <= x && x <= 0xfe19 || - // CJK Compatibility Forms .. Small Form Variants - 0xfe30 <= x && x <= 0xfe6b || - // Halfwidth and Fullwidth Forms - 0xff01 <= x && x <= 0xff60 || - 0xffe0 <= x && x <= 0xffe6 || - // Kana Supplement - 0x1b000 <= x && x <= 0x1b001 || - // Enclosed Ideographic Supplement - 0x1f200 <= x && x <= 0x1f251 || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - 0x20000 <= x && x <= 0x3fffd)) { - return true; - } - - return false; -} diff --git a/node_modules/is-fullwidth-code-point/license b/node_modules/is-fullwidth-code-point/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/is-fullwidth-code-point/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/is-fullwidth-code-point/package.json b/node_modules/is-fullwidth-code-point/package.json deleted file mode 100644 index 30c7f12..0000000 --- a/node_modules/is-fullwidth-code-point/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "_from": "is-fullwidth-code-point@^1.0.0", - "_id": "is-fullwidth-code-point@1.0.0", - "_inBundle": false, - "_integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "_location": "/is-fullwidth-code-point", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "is-fullwidth-code-point@^1.0.0", - "name": "is-fullwidth-code-point", - "escapedName": "is-fullwidth-code-point", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/string-width" - ], - "_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "_shasum": "ef9e31386f031a7f0d643af82fde50c457ef00cb", - "_spec": "is-fullwidth-code-point@^1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues" - }, - "bundleDependencies": false, - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "deprecated": false, - "description": "Check if the character represented by a given Unicode code point is fullwidth", - "devDependencies": { - "ava": "0.0.4", - "code-point-at": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme", - "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", - "char", - "string", - "str", - "codepoint", - "code", - "point", - "is", - "detect", - "check" - ], - "license": "MIT", - "name": "is-fullwidth-code-point", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "1.0.0" -} diff --git a/node_modules/is-fullwidth-code-point/readme.md b/node_modules/is-fullwidth-code-point/readme.md deleted file mode 100644 index 4936464..0000000 --- a/node_modules/is-fullwidth-code-point/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) - -> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) - - -## Install - -``` -$ npm install --save is-fullwidth-code-point -``` - - -## Usage - -```js -var isFullwidthCodePoint = require('is-fullwidth-code-point'); - -isFullwidthCodePoint('谢'.codePointAt()); -//=> true - -isFullwidthCodePoint('a'.codePointAt()); -//=> false -``` - - -## API - -### isFullwidthCodePoint(input) - -#### input - -Type: `number` - -[Code point](https://en.wikipedia.org/wiki/Code_point) of a character. - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/isarray/.npmignore b/node_modules/isarray/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/isarray/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/isarray/.travis.yml b/node_modules/isarray/.travis.yml deleted file mode 100644 index cc4dba2..0000000 --- a/node_modules/isarray/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/node_modules/isarray/Makefile b/node_modules/isarray/Makefile deleted file mode 100644 index 787d56e..0000000 --- a/node_modules/isarray/Makefile +++ /dev/null @@ -1,6 +0,0 @@ - -test: - @node_modules/.bin/tape test.js - -.PHONY: test - diff --git a/node_modules/isarray/README.md b/node_modules/isarray/README.md deleted file mode 100644 index 16d2c59..0000000 --- a/node_modules/isarray/README.md +++ /dev/null @@ -1,60 +0,0 @@ - -# isarray - -`Array#isArray` for older browsers. - -[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) -[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) - -[![browser support](https://ci.testling.com/juliangruber/isarray.png) -](https://ci.testling.com/juliangruber/isarray) - -## Usage - -```js -var isArray = require('isarray'); - -console.log(isArray([])); // => true -console.log(isArray({})); // => false -``` - -## Installation - -With [npm](http://npmjs.org) do - -```bash -$ npm install isarray -``` - -Then bundle for the browser with -[browserify](https://github.com/substack/browserify). - -With [component](http://component.io) do - -```bash -$ component install juliangruber/isarray -``` - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/isarray/component.json b/node_modules/isarray/component.json deleted file mode 100644 index 9e31b68..0000000 --- a/node_modules/isarray/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name" : "isarray", - "description" : "Array#isArray for older browsers", - "version" : "0.0.1", - "repository" : "juliangruber/isarray", - "homepage": "https://github.com/juliangruber/isarray", - "main" : "index.js", - "scripts" : [ - "index.js" - ], - "dependencies" : {}, - "keywords": ["browser","isarray","array"], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT" -} diff --git a/node_modules/isarray/index.js b/node_modules/isarray/index.js deleted file mode 100644 index a57f634..0000000 --- a/node_modules/isarray/index.js +++ /dev/null @@ -1,5 +0,0 @@ -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; diff --git a/node_modules/isarray/package.json b/node_modules/isarray/package.json deleted file mode 100644 index acbd065..0000000 --- a/node_modules/isarray/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_from": "isarray@~1.0.0", - "_id": "isarray@1.0.0", - "_inBundle": false, - "_integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "_location": "/isarray", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "isarray@~1.0.0", - "name": "isarray", - "escapedName": "isarray", - "rawSpec": "~1.0.0", - "saveSpec": null, - "fetchSpec": "~1.0.0" - }, - "_requiredBy": [ - "/readable-stream" - ], - "_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "_shasum": "bb935d48582cba168c06834957a54a3e07124f11", - "_spec": "isarray@~1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/readable-stream", - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "bugs": { - "url": "https://github.com/juliangruber/isarray/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Array#isArray for older browsers", - "devDependencies": { - "tape": "~2.13.4" - }, - "homepage": "https://github.com/juliangruber/isarray", - "keywords": [ - "browser", - "isarray", - "array" - ], - "license": "MIT", - "main": "index.js", - "name": "isarray", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/isarray.git" - }, - "scripts": { - "test": "tape test.js" - }, - "testling": { - "files": "test.js", - "browsers": [ - "ie/8..latest", - "firefox/17..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "1.0.0" -} diff --git a/node_modules/isarray/test.js b/node_modules/isarray/test.js deleted file mode 100644 index e0c3444..0000000 --- a/node_modules/isarray/test.js +++ /dev/null @@ -1,20 +0,0 @@ -var isArray = require('./'); -var test = require('tape'); - -test('is array', function(t){ - t.ok(isArray([])); - t.notOk(isArray({})); - t.notOk(isArray(null)); - t.notOk(isArray(false)); - - var obj = {}; - obj[0] = true; - t.notOk(isArray(obj)); - - var arr = []; - arr.foo = 'bar'; - t.ok(isArray(arr)); - - t.end(); -}); - diff --git a/node_modules/json-stringify-pretty-compact/CHANGELOG.md b/node_modules/json-stringify-pretty-compact/CHANGELOG.md deleted file mode 100644 index 65a6d12..0000000 --- a/node_modules/json-stringify-pretty-compact/CHANGELOG.md +++ /dev/null @@ -1,45 +0,0 @@ -### Version 2.0.0 (2019-02-02) - -- Removed: The `margins` option. Check out - [@aitodotai/json-stringify-pretty-compact] if you miss it. This package is now - purely a combination of `JSON.stringify(obj)` and - `JSON.stringify(obj, null, 2)` with no additional formatting features on top - of that. -- Added: Support for the [replacer] argument. -- Changed: Passing `undefined` to options now result in the default value being - used. This is to align with how destructuring defaults work in ES2015. - -### Version 1.2.0 (2018-04-22) - -- Added: TypeScript definition. Thanks to @domoritz! - -### Version 1.1.0 (2018-01-12) - -- Added: The `margins` option. Thanks to @randallsquared! - -### Version 1.0.4 (2017-04-29) - -- Fixed: String contents are no longer accidentally modified in some cases. - Thanks to @powellquiring! - -### Version 1.0.3 (2017-03-30) - -- No code changes. Just trying to get the readme to show on npmjs.com. - -### Version 1.0.2 (2016-09-08) - -- Improved: Limited npm package contents for a smaller download. - -### Version 1.0.1 (2014-11-03) - -- Fixed: Commas are now accounted for when calculating the available length of a - line, so that they do not appear outside `options.maxLength`. - -### Version 1.0.0 (2014-11-01) - -- Initial release. - - -[@aitodotai/json-stringify-pretty-compact]: https://www.npmjs.com/package/@aitodotai/json-stringify-pretty-compact -[replacer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter - diff --git a/node_modules/json-stringify-pretty-compact/LICENSE b/node_modules/json-stringify-pretty-compact/LICENSE deleted file mode 100644 index 5d7dc18..0000000 --- a/node_modules/json-stringify-pretty-compact/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014, 2016, 2017, 2019 Simon Lydell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/json-stringify-pretty-compact/README.md b/node_modules/json-stringify-pretty-compact/README.md deleted file mode 100644 index af32a45..0000000 --- a/node_modules/json-stringify-pretty-compact/README.md +++ /dev/null @@ -1,88 +0,0 @@ -# json-stringify-pretty-compact [![Build Status][travis-badge]][travis-link] - -The output of [JSON.stringify] comes in two flavors: _compact_ and _pretty._ The -former is usually too compact to be read by humans, while the latter sometimes -is too spacious. This module trades performance for a compromise between the -two. The result is a _pretty_ compact string, where “pretty” means both “kind -of” and “nice”. - - -```json -{ - "bool": true, - "short array": [1, 2, 3], - "long array": [ - {"x": 1, "y": 2}, - {"x": 2, "y": 1}, - {"x": 1, "y": 1}, - {"x": 2, "y": 2} - ] -} -``` - -While the “pretty” mode of [JSON.stringify] puts every item of arrays and -objects on its own line, this module puts the whole array or object on a single -line, unless the line becomes too long (the default maximum is 80 characters). -Making arrays and objects multi-line is the only attempt made to enforce the -maximum line length; if that doesn’t help then so be it. - -## Installation - -``` -npm install json-stringify-pretty-compact -``` - -```js -const stringify = require("json-stringify-pretty-compact"); -``` - -## `stringify(obj, options = {})` - -It’s like `JSON.stringify(obj, options.replacer, options.indent)`, except that -objects and arrays are on one line if they fit (according to -`options.maxLength`). - -`options`: - -- indent: Defaults to 2. Works exactly like the third parameter of - [JSON.stringify]. -- maxLength: Defaults to 80. Lines will be tried to be kept at maximum this many - characters long. -- replacer: Defaults to undefined. Works exactly like the second parameter of - [JSON.stringify]. - -`stringify(obj, {maxLength: 0, indent: indent})` gives the exact same result as -`JSON.stringify(obj, null, indent)`. (However, if you use a `replacer`, integer -keys might be moved first.) - -`stringify(obj, {maxLength: Infinity})` gives the exact same result as -`JSON.stringify(obj)`, except that there are spaces after colons and commas. - -**Want more options?** Check out [@aitodotai/json-stringify-pretty-compact]! - -## Development - -You need Node.js 10 and npm 6. - -### npm scripts - -- `npm run eslint`: Run [ESLint] \(including [Prettier]). -- `npm run eslint:fix`: Autofix [ESLint] errors. -- `npm run prettier`: Run [Prettier] for files other than JS. -- `npm run jest`: Run unit tests. During development, `npm run jest -- --watch` - is nice. -- `npm run coverage`: Run unit tests with code coverage. -- `npm test`: Check that everything works. - -## License - -[MIT](LICENSE). - - -[@aitodotai/json-stringify-pretty-compact]: https://www.npmjs.com/package/@aitodotai/json-stringify-pretty-compact -[eslint]: https://eslint.org/ -[json.stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify -[prettier]: https://prettier.io/ -[travis-badge]: https://travis-ci.org/lydell/json-stringify-pretty-compact.svg?branch=master -[travis-link]: https://travis-ci.org/lydell/json-stringify-pretty-compact - diff --git a/node_modules/json-stringify-pretty-compact/index.d.ts b/node_modules/json-stringify-pretty-compact/index.d.ts deleted file mode 100644 index 24fe3be..0000000 --- a/node_modules/json-stringify-pretty-compact/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -declare module "json-stringify-pretty-compact" { - const stringify: ( - object: any, - options?: { - indent?: number | string; - maxLength?: number; - replacer?: - | ((key: string, value: any) => any) - | (number | string)[] - | null; - } - ) => string; - export = stringify; -} diff --git a/node_modules/json-stringify-pretty-compact/index.js b/node_modules/json-stringify-pretty-compact/index.js deleted file mode 100644 index fcdbe96..0000000 --- a/node_modules/json-stringify-pretty-compact/index.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; - -// Note: This regex matches even invalid JSON strings, but since we’re -// working on the output of `JSON.stringify` we know that only valid strings -// are present (unless the user supplied a weird `options.indent` but in -// that case we don’t care since the output would be invalid anyway). -var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,]/g; - -module.exports = function stringify(passedObj, options) { - var indent, maxLength, replacer; - - options = options || {}; - indent = JSON.stringify( - [1], - undefined, - options.indent === undefined ? 2 : options.indent - ).slice(2, -3); - maxLength = - indent === "" - ? Infinity - : options.maxLength === undefined - ? 80 - : options.maxLength; - replacer = options.replacer; - - return (function _stringify(obj, currentIndent, reserved) { - // prettier-ignore - var end, index, items, key, keyPart, keys, length, nextIndent, prettified, start, string, value; - - if (obj && typeof obj.toJSON === "function") { - obj = obj.toJSON(); - } - - string = JSON.stringify(obj, replacer); - - if (string === undefined) { - return string; - } - - length = maxLength - currentIndent.length - reserved; - - if (string.length <= length) { - prettified = string.replace(stringOrChar, function(match, stringLiteral) { - return stringLiteral || match + " "; - }); - if (prettified.length <= length) { - return prettified; - } - } - - if (replacer != null) { - obj = JSON.parse(string); - replacer = undefined; - } - - if (typeof obj === "object" && obj !== null) { - nextIndent = currentIndent + indent; - items = []; - index = 0; - - if (Array.isArray(obj)) { - start = "["; - end = "]"; - length = obj.length; - for (; index < length; index++) { - items.push( - _stringify(obj[index], nextIndent, index === length - 1 ? 0 : 1) || - "null" - ); - } - } else { - start = "{"; - end = "}"; - keys = Object.keys(obj); - length = keys.length; - for (; index < length; index++) { - key = keys[index]; - keyPart = JSON.stringify(key) + ": "; - value = _stringify( - obj[key], - nextIndent, - keyPart.length + (index === length - 1 ? 0 : 1) - ); - if (value !== undefined) { - items.push(keyPart + value); - } - } - } - - if (items.length > 0) { - return [start, indent + items.join(",\n" + nextIndent), end].join( - "\n" + currentIndent - ); - } - } - - return string; - })(passedObj, "", 0); -}; diff --git a/node_modules/json-stringify-pretty-compact/package.json b/node_modules/json-stringify-pretty-compact/package.json deleted file mode 100644 index 66bb968..0000000 --- a/node_modules/json-stringify-pretty-compact/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "json-stringify-pretty-compact@~2.0.0", - "_id": "json-stringify-pretty-compact@2.0.0", - "_inBundle": false, - "_integrity": "sha512-WRitRfs6BGq4q8gTgOy4ek7iPFXjbra0H3PmDLKm2xnZ+Gh1HUhiKGgCZkSPNULlP7mvfu6FV/mOLhCarspADQ==", - "_location": "/json-stringify-pretty-compact", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "json-stringify-pretty-compact@~2.0.0", - "name": "json-stringify-pretty-compact", - "escapedName": "json-stringify-pretty-compact", - "rawSpec": "~2.0.0", - "saveSpec": null, - "fetchSpec": "~2.0.0" - }, - "_requiredBy": [ - "/vega-lite" - ], - "_resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-2.0.0.tgz", - "_shasum": "e77c419f52ff00c45a31f07f4c820c2433143885", - "_spec": "json-stringify-pretty-compact@~2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-lite", - "author": { - "name": "Simon Lydell" - }, - "bugs": { - "url": "https://github.com/lydell/json-stringify-pretty-compact/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "The best of both `JSON.stringify(obj)` and `JSON.stringify(obj, null, indent)`.", - "devDependencies": { - "eslint": "5.13.0", - "eslint-config-lydell": "13.0.0", - "eslint-plugin-jest": "22.2.2", - "eslint-plugin-prettier": "3.0.1", - "jest": "24.0.0", - "prettier": "1.16.3" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/lydell/json-stringify-pretty-compact#readme", - "keywords": [ - "JSON", - "stringify", - "pretty", - "print", - "pretty-print", - "compact", - "indent", - "format", - "formatter" - ], - "license": "MIT", - "main": "index.js", - "name": "json-stringify-pretty-compact", - "repository": { - "type": "git", - "url": "git+https://github.com/lydell/json-stringify-pretty-compact.git" - }, - "scripts": { - "coverage": "jest --coverage", - "eslint": "eslint .", - "eslint:fix": "npm run eslint -- --fix", - "jest": "jest", - "prepublishOnly": "npm test", - "prettier": "prettier --write \"**/*.{md,ts}\"", - "test": "npm run eslint && npm run coverage" - }, - "version": "2.0.0" -} diff --git a/node_modules/locate-path/index.d.ts b/node_modules/locate-path/index.d.ts deleted file mode 100644 index fbde526..0000000 --- a/node_modules/locate-path/index.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -declare namespace locatePath { - interface Options { - /** - Current working directory. - - @default process.cwd() - */ - readonly cwd?: string; - - /** - Type of path to match. - - @default 'file' - */ - readonly type?: 'file' | 'directory'; - - /** - Allow symbolic links to match if they point to the requested path type. - - @default true - */ - readonly allowSymlinks?: boolean; - } - - interface AsyncOptions extends Options { - /** - Number of concurrently pending promises. Minimum: `1`. - - @default Infinity - */ - readonly concurrency?: number; - - /** - Preserve `paths` order when searching. - - Disable this to improve performance if you don't care about the order. - - @default true - */ - readonly preserveOrder?: boolean; - } -} - -declare const locatePath: { - /** - Get the first path that exists on disk of multiple paths. - - @param paths - Paths to check. - @returns The first path that exists or `undefined` if none exists. - - @example - ``` - import locatePath = require('locate-path'); - - const files = [ - 'unicorn.png', - 'rainbow.png', // Only this one actually exists on disk - 'pony.png' - ]; - - (async () => { - console(await locatePath(files)); - //=> 'rainbow' - })(); - ``` - */ - (paths: Iterable, options?: locatePath.AsyncOptions): Promise< - string | undefined - >; - - /** - Synchronously get the first path that exists on disk of multiple paths. - - @param paths - Paths to check. - @returns The first path that exists or `undefined` if none exists. - */ - sync( - paths: Iterable, - options?: locatePath.Options - ): string | undefined; -}; - -export = locatePath; diff --git a/node_modules/locate-path/index.js b/node_modules/locate-path/index.js deleted file mode 100644 index 4604bbf..0000000 --- a/node_modules/locate-path/index.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; -const path = require('path'); -const fs = require('fs'); -const {promisify} = require('util'); -const pLocate = require('p-locate'); - -const fsStat = promisify(fs.stat); -const fsLStat = promisify(fs.lstat); - -const typeMappings = { - directory: 'isDirectory', - file: 'isFile' -}; - -function checkType({type}) { - if (type in typeMappings) { - return; - } - - throw new Error(`Invalid type specified: ${type}`); -} - -const matchType = (type, stat) => type === undefined || stat[typeMappings[type]](); - -module.exports = async (paths, options) => { - options = { - cwd: process.cwd(), - type: 'file', - allowSymlinks: true, - ...options - }; - checkType(options); - const statFn = options.allowSymlinks ? fsStat : fsLStat; - - return pLocate(paths, async path_ => { - try { - const stat = await statFn(path.resolve(options.cwd, path_)); - return matchType(options.type, stat); - } catch (_) { - return false; - } - }, options); -}; - -module.exports.sync = (paths, options) => { - options = { - cwd: process.cwd(), - allowSymlinks: true, - type: 'file', - ...options - }; - checkType(options); - const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync; - - for (const path_ of paths) { - try { - const stat = statFn(path.resolve(options.cwd, path_)); - - if (matchType(options.type, stat)) { - return path_; - } - } catch (_) { - } - } -}; diff --git a/node_modules/locate-path/license b/node_modules/locate-path/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/locate-path/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/locate-path/package.json b/node_modules/locate-path/package.json deleted file mode 100644 index 0eee3d4..0000000 --- a/node_modules/locate-path/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "_from": "locate-path@^5.0.0", - "_id": "locate-path@5.0.0", - "_inBundle": false, - "_integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "_location": "/locate-path", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "locate-path@^5.0.0", - "name": "locate-path", - "escapedName": "locate-path", - "rawSpec": "^5.0.0", - "saveSpec": null, - "fetchSpec": "^5.0.0" - }, - "_requiredBy": [ - "/find-up" - ], - "_resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "_shasum": "1afba396afd676a6d42504d0a67a3a7eb9f62aa0", - "_spec": "locate-path@^5.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/find-up", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/locate-path/issues" - }, - "bundleDependencies": false, - "dependencies": { - "p-locate": "^4.1.0" - }, - "deprecated": false, - "description": "Get the first path that exists on disk of multiple paths", - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/locate-path#readme", - "keywords": [ - "locate", - "path", - "paths", - "file", - "files", - "exists", - "find", - "finder", - "search", - "searcher", - "array", - "iterable", - "iterator" - ], - "license": "MIT", - "name": "locate-path", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/locate-path.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "5.0.0" -} diff --git a/node_modules/locate-path/readme.md b/node_modules/locate-path/readme.md deleted file mode 100644 index 2184c6f..0000000 --- a/node_modules/locate-path/readme.md +++ /dev/null @@ -1,122 +0,0 @@ -# locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path) - -> Get the first path that exists on disk of multiple paths - - -## Install - -``` -$ npm install locate-path -``` - - -## Usage - -Here we find the first file that exists on disk, in array order. - -```js -const locatePath = require('locate-path'); - -const files = [ - 'unicorn.png', - 'rainbow.png', // Only this one actually exists on disk - 'pony.png' -]; - -(async () => { - console(await locatePath(files)); - //=> 'rainbow' -})(); -``` - - -## API - -### locatePath(paths, [options]) - -Returns a `Promise` for the first path that exists or `undefined` if none exists. - -#### paths - -Type: `Iterable` - -Paths to check. - -#### options - -Type: `Object` - -##### concurrency - -Type: `number`
-Default: `Infinity`
-Minimum: `1` - -Number of concurrently pending promises. - -##### preserveOrder - -Type: `boolean`
-Default: `true` - -Preserve `paths` order when searching. - -Disable this to improve performance if you don't care about the order. - -##### cwd - -Type: `string`
-Default: `process.cwd()` - -Current working directory. - -##### type - -Type: `string`
-Default: `file`
-Values: `file` `directory` - -The type of paths that can match. - -##### allowSymlinks - -Type: `boolean`
-Default: `true` - -Allow symbolic links to match if they point to the chosen path type. - -### locatePath.sync(paths, [options]) - -Returns the first path that exists or `undefined` if none exists. - -#### paths - -Type: `Iterable` - -Paths to check. - -#### options - -Type: `Object` - -##### cwd - -Same as above. - -##### type - -Same as above. - -##### allowSymlinks - -Same as above. - - -## Related - -- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/mimic-response/index.d.ts b/node_modules/mimic-response/index.d.ts deleted file mode 100644 index 8ff98e2..0000000 --- a/node_modules/mimic-response/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {IncomingMessage} from 'http'; - -/** -Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) - -Makes `toStream` include the properties from `fromStream`. - -@param fromStream - The stream to copy the properties from. -@param toStream - The stream to copy the properties to. -@return The same object as `toStream`. -*/ -declare function mimicResponse( - fromStream: IncomingMessage, - toStream: T, -): IncomingMessage & T; - -export = mimicResponse; diff --git a/node_modules/mimic-response/index.js b/node_modules/mimic-response/index.js deleted file mode 100644 index edd0faf..0000000 --- a/node_modules/mimic-response/index.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -// We define these manually to ensure they're always copied -// even if they would move up the prototype chain -// https://nodejs.org/api/http.html#http_class_http_incomingmessage -const knownProperties = [ - 'aborted', - 'complete', - 'destroy', - 'headers', - 'httpVersion', - 'httpVersionMinor', - 'httpVersionMajor', - 'method', - 'rawHeaders', - 'rawTrailers', - 'setTimeout', - 'socket', - 'statusCode', - 'statusMessage', - 'trailers', - 'url' -]; - -module.exports = (fromStream, toStream) => { - const fromProperties = new Set(Object.keys(fromStream).concat(knownProperties)); - - for (const property of fromProperties) { - // Don't overwrite existing properties. - if (property in toStream) { - continue; - } - - toStream[property] = typeof fromStream[property] === 'function' ? fromStream[property].bind(fromStream) : fromStream[property]; - } - - return toStream; -}; diff --git a/node_modules/mimic-response/license b/node_modules/mimic-response/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/mimic-response/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mimic-response/package.json b/node_modules/mimic-response/package.json deleted file mode 100644 index dd073aa..0000000 --- a/node_modules/mimic-response/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "mimic-response@^2.0.0", - "_id": "mimic-response@2.1.0", - "_inBundle": false, - "_integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", - "_location": "/mimic-response", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "mimic-response@^2.0.0", - "name": "mimic-response", - "escapedName": "mimic-response", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/decompress-response" - ], - "_resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", - "_shasum": "d13763d35f613d09ec37ebb30bac0469c0ee8f43", - "_spec": "mimic-response@^2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/decompress-response", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/mimic-response/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Mimic a Node.js HTTP response stream", - "devDependencies": { - "@sindresorhus/tsconfig": "^0.3.0", - "@types/node": "^12.0.0", - "ava": "^1.1.0", - "create-test-server": "^2.4.0", - "pify": "^4.0.1", - "tsd": "^0.7.3", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.d.ts", - "index.js" - ], - "funding": "https://github.com/sponsors/sindresorhus", - "homepage": "https://github.com/sindresorhus/mimic-response#readme", - "keywords": [ - "mimic", - "response", - "stream", - "http", - "https", - "request", - "get", - "core" - ], - "license": "MIT", - "name": "mimic-response", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/mimic-response.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "2.1.0" -} diff --git a/node_modules/mimic-response/readme.md b/node_modules/mimic-response/readme.md deleted file mode 100644 index b7d1ec9..0000000 --- a/node_modules/mimic-response/readme.md +++ /dev/null @@ -1,57 +0,0 @@ -# mimic-response [![Build Status](https://travis-ci.org/sindresorhus/mimic-response.svg?branch=master)](https://travis-ci.org/sindresorhus/mimic-response) - -> Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) - -## Install - -``` -$ npm install mimic-response -``` - -## Usage - -```js -const stream = require('stream'); -const mimicResponse = require('mimic-response'); - -const responseStream = getHttpResponseStream(); -const myStream = new stream.PassThrough(); - -mimicResponse(responseStream, myStream); - -console.log(myStream.statusCode); -//=> 200 -``` - -## API - -### mimicResponse(from, to) - -#### from - -Type: `Stream` - -[Node.js HTTP response stream.](https://nodejs.org/api/http.html#http_class_http_incomingmessage) - -#### to - -Type: `Stream` - -Any stream. - -## Related - -- [mimic-fn](https://github.com/sindresorhus/mimic-fn) - Make a function mimic another one -- [clone-response](https://github.com/lukechilds/clone-response) - Clone a Node.js response stream - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/minimatch/LICENSE b/node_modules/minimatch/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/minimatch/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/minimatch/README.md b/node_modules/minimatch/README.md deleted file mode 100644 index ad72b81..0000000 --- a/node_modules/minimatch/README.md +++ /dev/null @@ -1,209 +0,0 @@ -# minimatch - -A minimal matching utility. - -[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.svg)](http://travis-ci.org/isaacs/minimatch) - - -This is the matching library used internally by npm. - -It works by converting glob expressions into JavaScript `RegExp` -objects. - -## Usage - -```javascript -var minimatch = require("minimatch") - -minimatch("bar.foo", "*.foo") // true! -minimatch("bar.foo", "*.bar") // false! -minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! -``` - -## Features - -Supports these glob features: - -* Brace Expansion -* Extended glob matching -* "Globstar" `**` matching - -See: - -* `man sh` -* `man bash` -* `man 3 fnmatch` -* `man 5 gitignore` - -## Minimatch Class - -Create a minimatch object by instantiating the `minimatch.Minimatch` class. - -```javascript -var Minimatch = require("minimatch").Minimatch -var mm = new Minimatch(pattern, options) -``` - -### Properties - -* `pattern` The original pattern the minimatch object represents. -* `options` The options supplied to the constructor. -* `set` A 2-dimensional array of regexp or string expressions. - Each row in the - array corresponds to a brace-expanded pattern. Each item in the row - corresponds to a single path-part. For example, the pattern - `{a,b/c}/d` would expand to a set of patterns like: - - [ [ a, d ] - , [ b, c, d ] ] - - If a portion of the pattern doesn't have any "magic" in it - (that is, it's something like `"foo"` rather than `fo*o?`), then it - will be left as a string rather than converted to a regular - expression. - -* `regexp` Created by the `makeRe` method. A single regular expression - expressing the entire pattern. This is useful in cases where you wish - to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. -* `negate` True if the pattern is negated. -* `comment` True if the pattern is a comment. -* `empty` True if the pattern is `""`. - -### Methods - -* `makeRe` Generate the `regexp` member if necessary, and return it. - Will return `false` if the pattern is invalid. -* `match(fname)` Return true if the filename matches the pattern, or - false otherwise. -* `matchOne(fileArray, patternArray, partial)` Take a `/`-split - filename, and match it against a single row in the `regExpSet`. This - method is mainly for internal use, but is exposed so that it can be - used by a glob-walker that needs to avoid excessive filesystem calls. - -All other methods are internal, and will be called as necessary. - -### minimatch(path, pattern, options) - -Main export. Tests a path against the pattern using the options. - -```javascript -var isJS = minimatch(file, "*.js", { matchBase: true }) -``` - -### minimatch.filter(pattern, options) - -Returns a function that tests its -supplied argument, suitable for use with `Array.filter`. Example: - -```javascript -var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) -``` - -### minimatch.match(list, pattern, options) - -Match against the list of -files, in the style of fnmatch or glob. If nothing is matched, and -options.nonull is set, then return a list containing the pattern itself. - -```javascript -var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) -``` - -### minimatch.makeRe(pattern, options) - -Make a regular expression object from the pattern. - -## Options - -All options are `false` by default. - -### debug - -Dump a ton of stuff to stderr. - -### nobrace - -Do not expand `{a,b}` and `{1..3}` brace sets. - -### noglobstar - -Disable `**` matching against multiple folder names. - -### dot - -Allow patterns to match filenames starting with a period, even if -the pattern does not explicitly have a period in that spot. - -Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` -is set. - -### noext - -Disable "extglob" style patterns like `+(a|b)`. - -### nocase - -Perform a case-insensitive match. - -### nonull - -When a match is not found by `minimatch.match`, return a list containing -the pattern itself if this option is set. When not set, an empty list -is returned if there are no matches. - -### matchBase - -If set, then patterns without slashes will be matched -against the basename of the path if it contains slashes. For example, -`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. - -### nocomment - -Suppress the behavior of treating `#` at the start of a pattern as a -comment. - -### nonegate - -Suppress the behavior of treating a leading `!` character as negation. - -### flipNegate - -Returns from negate expressions the same as if they were not negated. -(Ie, true on a hit, false on a miss.) - - -## Comparisons to other fnmatch/glob implementations - -While strict compliance with the existing standards is a worthwhile -goal, some discrepancies exist between minimatch and other -implementations, and are intentional. - -If the pattern starts with a `!` character, then it is negated. Set the -`nonegate` flag to suppress this behavior, and treat leading `!` -characters normally. This is perhaps relevant if you wish to start the -pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` -characters at the start of a pattern will negate the pattern multiple -times. - -If a pattern starts with `#`, then it is treated as a comment, and -will not match anything. Use `\#` to match a literal `#` at the -start of a line, or set the `nocomment` flag to suppress this behavior. - -The double-star character `**` is supported by default, unless the -`noglobstar` flag is set. This is supported in the manner of bsdglob -and bash 4.1, where `**` only has special significance if it is the only -thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but -`a/**b` will not. - -If an escaped pattern has no matches, and the `nonull` flag is set, -then minimatch.match returns the pattern as-provided, rather than -interpreting the character escapes. For example, -`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than -`"*a?"`. This is akin to setting the `nullglob` option in bash, except -that it does not resolve escaped pattern characters. - -If brace expansion is not disabled, then it is performed before any -other interpretation of the glob pattern. Thus, a pattern like -`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded -**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are -checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/minimatch/minimatch.js b/node_modules/minimatch/minimatch.js deleted file mode 100644 index 5b5f8cf..0000000 --- a/node_modules/minimatch/minimatch.js +++ /dev/null @@ -1,923 +0,0 @@ -module.exports = minimatch -minimatch.Minimatch = Minimatch - -var path = { sep: '/' } -try { - path = require('path') -} catch (er) {} - -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = require('brace-expansion') - -var plTypes = { - '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, - '?': { open: '(?:', close: ')?' }, - '+': { open: '(?:', close: ')+' }, - '*': { open: '(?:', close: ')*' }, - '@': { open: '(?:', close: ')' } -} - -// any single thing other than / -// don't need to escape / when using new RegExp() -var qmark = '[^/]' - -// * => any number of characters -var star = qmark + '*?' - -// ** when dots are allowed. Anything goes, except .. and . -// not (^ or / followed by one or two dots followed by $ or /), -// followed by anything, any number of times. -var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' - -// not a ^ or / followed by a dot, -// followed by anything, any number of times. -var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' - -// characters that need to be escaped in RegExp. -var reSpecials = charSet('().*{}+?[]^$\\!') - -// "abc" -> { a:true, b:true, c:true } -function charSet (s) { - return s.split('').reduce(function (set, c) { - set[c] = true - return set - }, {}) -} - -// normalizes slashes. -var slashSplit = /\/+/ - -minimatch.filter = filter -function filter (pattern, options) { - options = options || {} - return function (p, i, list) { - return minimatch(p, pattern, options) - } -} - -function ext (a, b) { - a = a || {} - b = b || {} - var t = {} - Object.keys(b).forEach(function (k) { - t[k] = b[k] - }) - Object.keys(a).forEach(function (k) { - t[k] = a[k] - }) - return t -} - -minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return minimatch - - var orig = minimatch - - var m = function minimatch (p, pattern, options) { - return orig.minimatch(p, pattern, ext(def, options)) - } - - m.Minimatch = function Minimatch (pattern, options) { - return new orig.Minimatch(pattern, ext(def, options)) - } - - return m -} - -Minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return Minimatch - return minimatch.defaults(def).Minimatch -} - -function minimatch (p, pattern, options) { - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } - - if (!options) options = {} - - // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - return false - } - - // "" only matches "" - if (pattern.trim() === '') return p === '' - - return new Minimatch(pattern, options).match(p) -} - -function Minimatch (pattern, options) { - if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options) - } - - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } - - if (!options) options = {} - pattern = pattern.trim() - - // windows support: need to use /, not \ - if (path.sep !== '/') { - pattern = pattern.split(path.sep).join('/') - } - - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false - - // make the set of regexps etc. - this.make() -} - -Minimatch.prototype.debug = function () {} - -Minimatch.prototype.make = make -function make () { - // don't do it more than once. - if (this._made) return - - var pattern = this.pattern - var options = this.options - - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return - } - - // step 1: figure out negation, etc. - this.parseNegate() - - // step 2: expand braces - var set = this.globSet = this.braceExpand() - - if (options.debug) this.debug = console.error - - this.debug(this.pattern, set) - - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(function (s) { - return s.split(slashSplit) - }) - - this.debug(this.pattern, set) - - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this) - - this.debug(this.pattern, set) - - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }) - - this.debug(this.pattern, set) - - this.set = set -} - -Minimatch.prototype.parseNegate = parseNegate -function parseNegate () { - var pattern = this.pattern - var negate = false - var options = this.options - var negateOffset = 0 - - if (options.nonegate) return - - for (var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === '!' - ; i++) { - negate = !negate - negateOffset++ - } - - if (negateOffset) this.pattern = pattern.substr(negateOffset) - this.negate = negate -} - -// Brace expansion: -// a{b,c}d -> abd acd -// a{b,}c -> abc ac -// a{0..3}d -> a0d a1d a2d a3d -// a{b,c{d,e}f}g -> abg acdfg acefg -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg -// -// Invalid sets are not expanded. -// a{2..}b -> a{2..}b -// a{b}c -> a{b}c -minimatch.braceExpand = function (pattern, options) { - return braceExpand(pattern, options) -} - -Minimatch.prototype.braceExpand = braceExpand - -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options - } else { - options = {} - } - } - - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern - - if (typeof pattern === 'undefined') { - throw new TypeError('undefined pattern') - } - - if (options.nobrace || - !pattern.match(/\{.*\}/)) { - // shortcut. no need to expand. - return [pattern] - } - - return expand(pattern) -} - -// parse a component of the expanded set. -// At this point, no pattern may contain "/" in it -// so we're going to return a 2d array, where each entry is the full -// pattern, split on '/', and then turned into a regular expression. -// A regexp is made at the end which joins each array with an -// escaped /, and another full one which joins each regexp with |. -// -// Following the lead of Bash 4.1, note that "**" only has special meaning -// when it is the *only* thing in a path portion. Otherwise, any series -// of * is equivalent to a single *. Globstar behavior is enabled by -// default, and can be disabled by setting options.noglobstar. -Minimatch.prototype.parse = parse -var SUBPARSE = {} -function parse (pattern, isSub) { - if (pattern.length > 1024 * 64) { - throw new TypeError('pattern is too long') - } - - var options = this.options - - // shortcuts - if (!options.noglobstar && pattern === '**') return GLOBSTAR - if (pattern === '') return '' - - var re = '' - var hasMagic = !!options.nocase - var escaping = false - // ? => one single character - var patternListStack = [] - var negativeLists = [] - var stateChar - var inClass = false - var reClassStart = -1 - var classStart = -1 - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - var patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)' - var self = this - - function clearStateChar () { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star - hasMagic = true - break - case '?': - re += qmark - hasMagic = true - break - default: - re += '\\' + stateChar - break - } - self.debug('clearStateChar %j %j', stateChar, re) - stateChar = false - } - } - - for (var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c) - - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c - escaping = false - continue - } - - switch (c) { - case '/': - // completely not allowed, even escaped. - // Should already be path-split by now. - return false - - case '\\': - clearStateChar() - escaping = true - continue - - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) - - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class') - if (c === '!' && i === classStart + 1) c = '^' - re += c - continue - } - - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - self.debug('call clearStateChar %j', stateChar) - clearStateChar() - stateChar = c - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar() - continue - - case '(': - if (inClass) { - re += '(' - continue - } - - if (!stateChar) { - re += '\\(' - continue - } - - patternListStack.push({ - type: stateChar, - start: i - 1, - reStart: re.length, - open: plTypes[stateChar].open, - close: plTypes[stateChar].close - }) - // negation is (?:(?!js)[^/]*) - re += stateChar === '!' ? '(?:(?!(?:' : '(?:' - this.debug('plType %j %j', stateChar, re) - stateChar = false - continue - - case ')': - if (inClass || !patternListStack.length) { - re += '\\)' - continue - } - - clearStateChar() - hasMagic = true - var pl = patternListStack.pop() - // negation is (?:(?!js)[^/]*) - // The others are (?:) - re += pl.close - if (pl.type === '!') { - negativeLists.push(pl) - } - pl.reEnd = re.length - continue - - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|' - escaping = false - continue - } - - clearStateChar() - re += '|' - continue - - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar() - - if (inClass) { - re += '\\' + c - continue - } - - inClass = true - classStart = i - reClassStart = re.length - re += c - continue - - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c - escaping = false - continue - } - - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - if (inClass) { - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - var cs = pattern.substring(classStart + 1, i) - try { - RegExp('[' + cs + ']') - } catch (er) { - // not a valid class! - var sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' - hasMagic = hasMagic || sp[1] - inClass = false - continue - } - } - - // finish up the class. - hasMagic = true - inClass = false - re += c - continue - - default: - // swallow any state char that wasn't consumed - clearStateChar() - - if (escaping) { - // no need - escaping = false - } else if (reSpecials[c] - && !(c === '^' && inClass)) { - re += '\\' - } - - re += c - - } // switch - } // for - - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] - hasMagic = hasMagic || sp[1] - } - - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + pl.open.length) - this.debug('setting tail', re, pl) - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\' - } - - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }) - - this.debug('tail=%j\n %s', tail, tail, pl, re) - var t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type - - hasMagic = true - re = re.slice(0, pl.reStart) + t + '\\(' + tail - } - - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' - } - - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - var addPatternStart = false - switch (re.charAt(0)) { - case '.': - case '[': - case '(': addPatternStart = true - } - - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n] - - var nlBefore = re.slice(0, nl.reStart) - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) - var nlAfter = re.slice(nl.reEnd) - - nlLast += nlAfter - - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - var openParensBefore = nlBefore.split('(').length - 1 - var cleanAfter = nlAfter - for (i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') - } - nlAfter = cleanAfter - - var dollar = '' - if (nlAfter === '' && isSub !== SUBPARSE) { - dollar = '$' - } - var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast - re = newRe - } - - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re - } - - if (addPatternStart) { - re = patternStart + re - } - - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } - - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) - } - - var flags = options.nocase ? 'i' : '' - try { - var regExp = new RegExp('^' + re + '$', flags) - } catch (er) { - // If it was an invalid regular expression, then it can't match - // anything. This trick looks for a character after the end of - // the string, which is of course impossible, except in multi-line - // mode, but it's not a /m regex. - return new RegExp('$.') - } - - regExp._glob = pattern - regExp._src = re - - return regExp -} - -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() -} - -Minimatch.prototype.makeRe = makeRe -function makeRe () { - if (this.regexp || this.regexp === false) return this.regexp - - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - var set = this.set - - if (!set.length) { - this.regexp = false - return this.regexp - } - var options = this.options - - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - var flags = options.nocase ? 'i' : '' - - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|') - - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$' - - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$' - - try { - this.regexp = new RegExp(re, flags) - } catch (ex) { - this.regexp = false - } - return this.regexp -} - -minimatch.match = function (list, pattern, options) { - options = options || {} - var mm = new Minimatch(pattern, options) - list = list.filter(function (f) { - return mm.match(f) - }) - if (mm.options.nonull && !list.length) { - list.push(pattern) - } - return list -} - -Minimatch.prototype.match = match -function match (f, partial) { - this.debug('match', f, this.pattern) - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' - - if (f === '/' && partial) return true - - var options = this.options - - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } - - // treat the test path as a set of pathparts. - f = f.split(slashSplit) - this.debug(this.pattern, 'split', f) - - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. - - var set = this.set - this.debug(this.pattern, 'set', set) - - // Find the basename of the path by looking for the last non-empty segment - var filename - var i - for (i = f.length - 1; i >= 0; i--) { - filename = f[i] - if (filename) break - } - - for (i = 0; i < set.length; i++) { - var pattern = set[i] - var file = f - if (options.matchBase && pattern.length === 1) { - file = [filename] - } - var hit = this.matchOne(file, pattern, partial) - if (hit) { - if (options.flipNegate) return true - return !this.negate - } - } - - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate -} - -// set partial to true to test if, for example, -// "/a/b" matches the start of "/*/b/*/d" -// Partial means, if you run out of file before you run -// out of pattern, then that's fine, as long as all -// the parts match. -Minimatch.prototype.matchOne = function (file, pattern, partial) { - var options = this.options - - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) - - this.debug('matchOne', file.length, pattern.length) - - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop') - var p = pattern[pi] - var f = file[fi] - - this.debug(pattern, p, f) - - // should be impossible. - // some invalid regexp stuff in the set. - if (p === false) return false - - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) - - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi - var pr = pi + 1 - if (pr === pl) { - this.debug('** at the end') - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } - - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] - - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) - - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee) - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr) - break - } - - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } - - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr) - if (fr === fl) return true - } - return false - } - - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit - if (typeof p === 'string') { - if (options.nocase) { - hit = f.toLowerCase() === p.toLowerCase() - } else { - hit = f === p - } - this.debug('string match', p, f, hit) - } else { - hit = f.match(p) - this.debug('pattern match', p, f, hit) - } - - if (!hit) return false - } - - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* - - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') - return emptyFileEnd - } - - // should be unreachable. - throw new Error('wtf?') -} - -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') -} - -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') -} diff --git a/node_modules/minimatch/package.json b/node_modules/minimatch/package.json deleted file mode 100644 index f512329..0000000 --- a/node_modules/minimatch/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "_from": "minimatch@^3.0.4", - "_id": "minimatch@3.0.4", - "_inBundle": false, - "_integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "_location": "/minimatch", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "minimatch@^3.0.4", - "name": "minimatch", - "escapedName": "minimatch", - "rawSpec": "^3.0.4", - "saveSpec": null, - "fetchSpec": "^3.0.4" - }, - "_requiredBy": [ - "/glob", - "/ignore-walk" - ], - "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "_shasum": "5166e286457f03306064be5497e8dbb0c3d32083", - "_spec": "minimatch@^3.0.4", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/ignore-walk", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - }, - "bugs": { - "url": "https://github.com/isaacs/minimatch/issues" - }, - "bundleDependencies": false, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "deprecated": false, - "description": "a glob matcher in javascript", - "devDependencies": { - "tap": "^10.3.2" - }, - "engines": { - "node": "*" - }, - "files": [ - "minimatch.js" - ], - "homepage": "https://github.com/isaacs/minimatch#readme", - "license": "ISC", - "main": "minimatch.js", - "name": "minimatch", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/minimatch.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js --cov" - }, - "version": "3.0.4" -} diff --git a/node_modules/minimist/.travis.yml b/node_modules/minimist/.travis.yml deleted file mode 100644 index 74c57bf..0000000 --- a/node_modules/minimist/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.12" - - "iojs" -before_install: - - npm install -g npm@~1.4.6 diff --git a/node_modules/minimist/LICENSE b/node_modules/minimist/LICENSE deleted file mode 100644 index ee27ba4..0000000 --- a/node_modules/minimist/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/minimist/example/parse.js b/node_modules/minimist/example/parse.js deleted file mode 100644 index f7c8d49..0000000 --- a/node_modules/minimist/example/parse.js +++ /dev/null @@ -1,2 +0,0 @@ -var argv = require('../')(process.argv.slice(2)); -console.log(argv); diff --git a/node_modules/minimist/index.js b/node_modules/minimist/index.js deleted file mode 100644 index d2afe5e..0000000 --- a/node_modules/minimist/index.js +++ /dev/null @@ -1,245 +0,0 @@ -module.exports = function (args, opts) { - if (!opts) opts = {}; - - var flags = { bools : {}, strings : {}, unknownFn: null }; - - if (typeof opts['unknown'] === 'function') { - flags.unknownFn = opts['unknown']; - } - - if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { - flags.allBools = true; - } else { - [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { - flags.bools[key] = true; - }); - } - - var aliases = {}; - Object.keys(opts.alias || {}).forEach(function (key) { - aliases[key] = [].concat(opts.alias[key]); - aliases[key].forEach(function (x) { - aliases[x] = [key].concat(aliases[key].filter(function (y) { - return x !== y; - })); - }); - }); - - [].concat(opts.string).filter(Boolean).forEach(function (key) { - flags.strings[key] = true; - if (aliases[key]) { - flags.strings[aliases[key]] = true; - } - }); - - var defaults = opts['default'] || {}; - - var argv = { _ : [] }; - Object.keys(flags.bools).forEach(function (key) { - setArg(key, defaults[key] === undefined ? false : defaults[key]); - }); - - var notFlags = []; - - if (args.indexOf('--') !== -1) { - notFlags = args.slice(args.indexOf('--')+1); - args = args.slice(0, args.indexOf('--')); - } - - function argDefined(key, arg) { - return (flags.allBools && /^--[^=]+$/.test(arg)) || - flags.strings[key] || flags.bools[key] || aliases[key]; - } - - function setArg (key, val, arg) { - if (arg && flags.unknownFn && !argDefined(key, arg)) { - if (flags.unknownFn(arg) === false) return; - } - - var value = !flags.strings[key] && isNumber(val) - ? Number(val) : val - ; - setKey(argv, key.split('.'), value); - - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), value); - }); - } - - function setKey (obj, keys, value) { - var o = obj; - for (var i = 0; i < keys.length-1; i++) { - var key = keys[i]; - if (key === '__proto__') return; - if (o[key] === undefined) o[key] = {}; - if (o[key] === Object.prototype || o[key] === Number.prototype - || o[key] === String.prototype) o[key] = {}; - if (o[key] === Array.prototype) o[key] = []; - o = o[key]; - } - - var key = keys[keys.length - 1]; - if (key === '__proto__') return; - if (o === Object.prototype || o === Number.prototype - || o === String.prototype) o = {}; - if (o === Array.prototype) o = []; - if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { - o[key] = value; - } - else if (Array.isArray(o[key])) { - o[key].push(value); - } - else { - o[key] = [ o[key], value ]; - } - } - - function aliasIsBoolean(key) { - return aliases[key].some(function (x) { - return flags.bools[x]; - }); - } - - for (var i = 0; i < args.length; i++) { - var arg = args[i]; - - if (/^--.+=/.test(arg)) { - // Using [\s\S] instead of . because js doesn't support the - // 'dotall' regex modifier. See: - // http://stackoverflow.com/a/1068308/13216 - var m = arg.match(/^--([^=]+)=([\s\S]*)$/); - var key = m[1]; - var value = m[2]; - if (flags.bools[key]) { - value = value !== 'false'; - } - setArg(key, value, arg); - } - else if (/^--no-.+/.test(arg)) { - var key = arg.match(/^--no-(.+)/)[1]; - setArg(key, false, arg); - } - else if (/^--.+/.test(arg)) { - var key = arg.match(/^--(.+)/)[1]; - var next = args[i + 1]; - if (next !== undefined && !/^-/.test(next) - && !flags.bools[key] - && !flags.allBools - && (aliases[key] ? !aliasIsBoolean(key) : true)) { - setArg(key, next, arg); - i++; - } - else if (/^(true|false)$/.test(next)) { - setArg(key, next === 'true', arg); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true, arg); - } - } - else if (/^-[^-]+/.test(arg)) { - var letters = arg.slice(1,-1).split(''); - - var broken = false; - for (var j = 0; j < letters.length; j++) { - var next = arg.slice(j+2); - - if (next === '-') { - setArg(letters[j], next, arg) - continue; - } - - if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { - setArg(letters[j], next.split('=')[1], arg); - broken = true; - break; - } - - if (/[A-Za-z]/.test(letters[j]) - && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { - setArg(letters[j], next, arg); - broken = true; - break; - } - - if (letters[j+1] && letters[j+1].match(/\W/)) { - setArg(letters[j], arg.slice(j+2), arg); - broken = true; - break; - } - else { - setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); - } - } - - var key = arg.slice(-1)[0]; - if (!broken && key !== '-') { - if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) - && !flags.bools[key] - && (aliases[key] ? !aliasIsBoolean(key) : true)) { - setArg(key, args[i+1], arg); - i++; - } - else if (args[i+1] && /^(true|false)$/.test(args[i+1])) { - setArg(key, args[i+1] === 'true', arg); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true, arg); - } - } - } - else { - if (!flags.unknownFn || flags.unknownFn(arg) !== false) { - argv._.push( - flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) - ); - } - if (opts.stopEarly) { - argv._.push.apply(argv._, args.slice(i + 1)); - break; - } - } - } - - Object.keys(defaults).forEach(function (key) { - if (!hasKey(argv, key.split('.'))) { - setKey(argv, key.split('.'), defaults[key]); - - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), defaults[key]); - }); - } - }); - - if (opts['--']) { - argv['--'] = new Array(); - notFlags.forEach(function(key) { - argv['--'].push(key); - }); - } - else { - notFlags.forEach(function(key) { - argv._.push(key); - }); - } - - return argv; -}; - -function hasKey (obj, keys) { - var o = obj; - keys.slice(0,-1).forEach(function (key) { - o = (o[key] || {}); - }); - - var key = keys[keys.length - 1]; - return key in o; -} - -function isNumber (x) { - if (typeof x === 'number') return true; - if (/^0x[0-9a-f]+$/i.test(x)) return true; - return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); -} - diff --git a/node_modules/minimist/package.json b/node_modules/minimist/package.json deleted file mode 100644 index f6d8fcf..0000000 --- a/node_modules/minimist/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "minimist@^1.2.5", - "_id": "minimist@1.2.5", - "_inBundle": false, - "_integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "_location": "/minimist", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "minimist@^1.2.5", - "name": "minimist", - "escapedName": "minimist", - "rawSpec": "^1.2.5", - "saveSpec": null, - "fetchSpec": "^1.2.5" - }, - "_requiredBy": [ - "/mkdirp", - "/rc" - ], - "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "_shasum": "67d66014b66a6a8aaa0c083c5fd58df4e4e97602", - "_spec": "minimist@^1.2.5", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/mkdirp", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "bugs": { - "url": "https://github.com/substack/minimist/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "parse argument options", - "devDependencies": { - "covert": "^1.0.0", - "tap": "~0.4.0", - "tape": "^3.5.0" - }, - "homepage": "https://github.com/substack/minimist", - "keywords": [ - "argv", - "getopt", - "parser", - "optimist" - ], - "license": "MIT", - "main": "index.js", - "name": "minimist", - "repository": { - "type": "git", - "url": "git://github.com/substack/minimist.git" - }, - "scripts": { - "coverage": "covert test/*.js", - "test": "tap test/*.js" - }, - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/6..latest", - "ff/5", - "firefox/latest", - "chrome/10", - "chrome/latest", - "safari/5.1", - "safari/latest", - "opera/12" - ] - }, - "version": "1.2.5" -} diff --git a/node_modules/minimist/readme.markdown b/node_modules/minimist/readme.markdown deleted file mode 100644 index 5fd97ab..0000000 --- a/node_modules/minimist/readme.markdown +++ /dev/null @@ -1,95 +0,0 @@ -# minimist - -parse argument options - -This module is the guts of optimist's argument parser without all the -fanciful decoration. - -# example - -``` js -var argv = require('minimist')(process.argv.slice(2)); -console.log(argv); -``` - -``` -$ node example/parse.js -a beep -b boop -{ _: [], a: 'beep', b: 'boop' } -``` - -``` -$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz -{ _: [ 'foo', 'bar', 'baz' ], - x: 3, - y: 4, - n: 5, - a: true, - b: true, - c: true, - beep: 'boop' } -``` - -# security - -Previous versions had a prototype pollution bug that could cause privilege -escalation in some circumstances when handling untrusted user input. - -Please use version 1.2.3 or later: https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 - -# methods - -``` js -var parseArgs = require('minimist') -``` - -## var argv = parseArgs(args, opts={}) - -Return an argument object `argv` populated with the array arguments from `args`. - -`argv._` contains all the arguments that didn't have an option associated with -them. - -Numeric-looking arguments will be returned as numbers unless `opts.string` or -`opts.boolean` is set for that argument name. - -Any arguments after `'--'` will not be parsed and will end up in `argv._`. - -options can be: - -* `opts.string` - a string or array of strings argument names to always treat as -strings -* `opts.boolean` - a boolean, string or array of strings to always treat as -booleans. if `true` will treat all double hyphenated arguments without equal signs -as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) -* `opts.alias` - an object mapping string names to strings or arrays of string -argument names to use as aliases -* `opts.default` - an object mapping string argument names to default values -* `opts.stopEarly` - when true, populate `argv._` with everything after the -first non-option -* `opts['--']` - when true, populate `argv._` with everything before the `--` -and `argv['--']` with everything after the `--`. Here's an example: - - ``` - > require('./')('one two three -- four five --six'.split(' '), { '--': true }) - { _: [ 'one', 'two', 'three' ], - '--': [ 'four', 'five', '--six' ] } - ``` - - Note that with `opts['--']` set, parsing for arguments still stops after the - `--`. - -* `opts.unknown` - a function which is invoked with a command line parameter not -defined in the `opts` configuration object. If the function returns `false`, the -unknown option is not added to `argv`. - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install minimist -``` - -# license - -MIT diff --git a/node_modules/minimist/test/all_bool.js b/node_modules/minimist/test/all_bool.js deleted file mode 100644 index ac83548..0000000 --- a/node_modules/minimist/test/all_bool.js +++ /dev/null @@ -1,32 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('flag boolean true (default all --args to boolean)', function (t) { - var argv = parse(['moo', '--honk', 'cow'], { - boolean: true - }); - - t.deepEqual(argv, { - honk: true, - _: ['moo', 'cow'] - }); - - t.deepEqual(typeof argv.honk, 'boolean'); - t.end(); -}); - -test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { - var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { - boolean: true - }); - - t.deepEqual(argv, { - honk: true, - tacos: 'good', - p: 55, - _: ['moo', 'cow'] - }); - - t.deepEqual(typeof argv.honk, 'boolean'); - t.end(); -}); diff --git a/node_modules/minimist/test/bool.js b/node_modules/minimist/test/bool.js deleted file mode 100644 index 5f7dbde..0000000 --- a/node_modules/minimist/test/bool.js +++ /dev/null @@ -1,178 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('flag boolean default false', function (t) { - var argv = parse(['moo'], { - boolean: ['t', 'verbose'], - default: { verbose: false, t: false } - }); - - t.deepEqual(argv, { - verbose: false, - t: false, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); - -}); - -test('boolean groups', function (t) { - var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { - boolean: ['x','y','z'] - }); - - t.deepEqual(argv, { - x : true, - y : false, - z : true, - _ : [ 'one', 'two', 'three' ] - }); - - t.deepEqual(typeof argv.x, 'boolean'); - t.deepEqual(typeof argv.y, 'boolean'); - t.deepEqual(typeof argv.z, 'boolean'); - t.end(); -}); -test('boolean and alias with chainable api', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - herp: { alias: 'h', boolean: true } - }; - var aliasedArgv = parse(aliased, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var propertyArgv = parse(regular, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias with options hash', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - alias: { 'h': 'herp' }, - boolean: 'herp' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias array with options hash', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var alt = [ '--harp', 'derp' ]; - var opts = { - alias: { 'h': ['herp', 'harp'] }, - boolean: 'h' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var altPropertyArgv = parse(alt, opts); - var expected = { - harp: true, - herp: true, - h: true, - '_': [ 'derp' ] - }; - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.same(altPropertyArgv, expected); - t.end(); -}); - -test('boolean and alias using explicit true', function (t) { - var aliased = [ '-h', 'true' ]; - var regular = [ '--herp', 'true' ]; - var opts = { - alias: { h: 'herp' }, - boolean: 'h' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -// regression, see https://github.com/substack/node-optimist/issues/71 -test('boolean and --x=true', function(t) { - var parsed = parse(['--boool', '--other=true'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'true'); - - parsed = parse(['--boool', '--other=false'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'false'); - t.end(); -}); - -test('boolean --boool=true', function (t) { - var parsed = parse(['--boool=true'], { - default: { - boool: false - }, - boolean: ['boool'] - }); - - t.same(parsed.boool, true); - t.end(); -}); - -test('boolean --boool=false', function (t) { - var parsed = parse(['--boool=false'], { - default: { - boool: true - }, - boolean: ['boool'] - }); - - t.same(parsed.boool, false); - t.end(); -}); - -test('boolean using something similar to true', function (t) { - var opts = { boolean: 'h' }; - var result = parse(['-h', 'true.txt'], opts); - var expected = { - h: true, - '_': ['true.txt'] - }; - - t.same(result, expected); - t.end(); -}); \ No newline at end of file diff --git a/node_modules/minimist/test/dash.js b/node_modules/minimist/test/dash.js deleted file mode 100644 index 5a4fa5b..0000000 --- a/node_modules/minimist/test/dash.js +++ /dev/null @@ -1,31 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('-', function (t) { - t.plan(5); - t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); - t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); - t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); - t.deepEqual( - parse([ '-b', '-' ], { boolean: 'b' }), - { b: true, _: [ '-' ] } - ); - t.deepEqual( - parse([ '-s', '-' ], { string: 's' }), - { s: '-', _: [] } - ); -}); - -test('-a -- b', function (t) { - t.plan(3); - t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); -}); - -test('move arguments after the -- into their own `--` array', function(t) { - t.plan(1); - t.deepEqual( - parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }), - { name: 'John', _: [ 'before' ], '--': [ 'after' ] }); -}); diff --git a/node_modules/minimist/test/default_bool.js b/node_modules/minimist/test/default_bool.js deleted file mode 100644 index 780a311..0000000 --- a/node_modules/minimist/test/default_bool.js +++ /dev/null @@ -1,35 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('boolean default true', function (t) { - var argv = parse([], { - boolean: 'sometrue', - default: { sometrue: true } - }); - t.equal(argv.sometrue, true); - t.end(); -}); - -test('boolean default false', function (t) { - var argv = parse([], { - boolean: 'somefalse', - default: { somefalse: false } - }); - t.equal(argv.somefalse, false); - t.end(); -}); - -test('boolean default to null', function (t) { - var argv = parse([], { - boolean: 'maybe', - default: { maybe: null } - }); - t.equal(argv.maybe, null); - var argv = parse(['--maybe'], { - boolean: 'maybe', - default: { maybe: null } - }); - t.equal(argv.maybe, true); - t.end(); - -}) diff --git a/node_modules/minimist/test/dotted.js b/node_modules/minimist/test/dotted.js deleted file mode 100644 index d8b3e85..0000000 --- a/node_modules/minimist/test/dotted.js +++ /dev/null @@ -1,22 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('dotted alias', function (t) { - var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 22); - t.equal(argv.aa.bb, 22); - t.end(); -}); - -test('dotted default', function (t) { - var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 11); - t.equal(argv.aa.bb, 11); - t.end(); -}); - -test('dotted default with no alias', function (t) { - var argv = parse('', {default: {'a.b': 11}}); - t.equal(argv.a.b, 11); - t.end(); -}); diff --git a/node_modules/minimist/test/kv_short.js b/node_modules/minimist/test/kv_short.js deleted file mode 100644 index f813b30..0000000 --- a/node_modules/minimist/test/kv_short.js +++ /dev/null @@ -1,16 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('short -k=v' , function (t) { - t.plan(1); - - var argv = parse([ '-b=123' ]); - t.deepEqual(argv, { b: 123, _: [] }); -}); - -test('multi short -k=v' , function (t) { - t.plan(1); - - var argv = parse([ '-a=whatever', '-b=robots' ]); - t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); -}); diff --git a/node_modules/minimist/test/long.js b/node_modules/minimist/test/long.js deleted file mode 100644 index 5d3a1e0..0000000 --- a/node_modules/minimist/test/long.js +++ /dev/null @@ -1,31 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('long opts', function (t) { - t.deepEqual( - parse([ '--bool' ]), - { bool : true, _ : [] }, - 'long boolean' - ); - t.deepEqual( - parse([ '--pow', 'xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture sp' - ); - t.deepEqual( - parse([ '--pow=xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture eq' - ); - t.deepEqual( - parse([ '--host', 'localhost', '--port', '555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures sp' - ); - t.deepEqual( - parse([ '--host=localhost', '--port=555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures eq' - ); - t.end(); -}); diff --git a/node_modules/minimist/test/num.js b/node_modules/minimist/test/num.js deleted file mode 100644 index 2cc77f4..0000000 --- a/node_modules/minimist/test/num.js +++ /dev/null @@ -1,36 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('nums', function (t) { - var argv = parse([ - '-x', '1234', - '-y', '5.67', - '-z', '1e7', - '-w', '10f', - '--hex', '0xdeadbeef', - '789' - ]); - t.deepEqual(argv, { - x : 1234, - y : 5.67, - z : 1e7, - w : '10f', - hex : 0xdeadbeef, - _ : [ 789 ] - }); - t.deepEqual(typeof argv.x, 'number'); - t.deepEqual(typeof argv.y, 'number'); - t.deepEqual(typeof argv.z, 'number'); - t.deepEqual(typeof argv.w, 'string'); - t.deepEqual(typeof argv.hex, 'number'); - t.deepEqual(typeof argv._[0], 'number'); - t.end(); -}); - -test('already a number', function (t) { - var argv = parse([ '-x', 1234, 789 ]); - t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); - t.deepEqual(typeof argv.x, 'number'); - t.deepEqual(typeof argv._[0], 'number'); - t.end(); -}); diff --git a/node_modules/minimist/test/parse.js b/node_modules/minimist/test/parse.js deleted file mode 100644 index 7b4a2a1..0000000 --- a/node_modules/minimist/test/parse.js +++ /dev/null @@ -1,197 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse args', function (t) { - t.deepEqual( - parse([ '--no-moo' ]), - { moo : false, _ : [] }, - 'no' - ); - t.deepEqual( - parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), - { v : ['a','b','c'], _ : [] }, - 'multi' - ); - t.end(); -}); - -test('comprehensive', function (t) { - t.deepEqual( - parse([ - '--name=meowmers', 'bare', '-cats', 'woo', - '-h', 'awesome', '--multi=quux', - '--key', 'value', - '-b', '--bool', '--no-meep', '--multi=baz', - '--', '--not-a-flag', 'eek' - ]), - { - c : true, - a : true, - t : true, - s : 'woo', - h : 'awesome', - b : true, - bool : true, - key : 'value', - multi : [ 'quux', 'baz' ], - meep : false, - name : 'meowmers', - _ : [ 'bare', '--not-a-flag', 'eek' ] - } - ); - t.end(); -}); - -test('flag boolean', function (t) { - var argv = parse([ '-t', 'moo' ], { boolean: 't' }); - t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('flag boolean value', function (t) { - var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { - boolean: [ 't', 'verbose' ], - default: { verbose: true } - }); - - t.deepEqual(argv, { - verbose: false, - t: true, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('newlines in params' , function (t) { - var args = parse([ '-s', "X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - - // reproduce in bash: - // VALUE="new - // line" - // node program.js --s="$VALUE" - args = parse([ "--s=X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - t.end(); -}); - -test('strings' , function (t) { - var s = parse([ '-s', '0001234' ], { string: 's' }).s; - t.equal(s, '0001234'); - t.equal(typeof s, 'string'); - - var x = parse([ '-x', '56' ], { string: 'x' }).x; - t.equal(x, '56'); - t.equal(typeof x, 'string'); - t.end(); -}); - -test('stringArgs', function (t) { - var s = parse([ ' ', ' ' ], { string: '_' })._; - t.same(s.length, 2); - t.same(typeof s[0], 'string'); - t.same(s[0], ' '); - t.same(typeof s[1], 'string'); - t.same(s[1], ' '); - t.end(); -}); - -test('empty strings', function(t) { - var s = parse([ '-s' ], { string: 's' }).s; - t.equal(s, ''); - t.equal(typeof s, 'string'); - - var str = parse([ '--str' ], { string: 'str' }).str; - t.equal(str, ''); - t.equal(typeof str, 'string'); - - var letters = parse([ '-art' ], { - string: [ 'a', 't' ] - }); - - t.equal(letters.a, ''); - t.equal(letters.r, true); - t.equal(letters.t, ''); - - t.end(); -}); - - -test('string and alias', function(t) { - var x = parse([ '--str', '000123' ], { - string: 's', - alias: { s: 'str' } - }); - - t.equal(x.str, '000123'); - t.equal(typeof x.str, 'string'); - t.equal(x.s, '000123'); - t.equal(typeof x.s, 'string'); - - var y = parse([ '-s', '000123' ], { - string: 'str', - alias: { str: 's' } - }); - - t.equal(y.str, '000123'); - t.equal(typeof y.str, 'string'); - t.equal(y.s, '000123'); - t.equal(typeof y.s, 'string'); - t.end(); -}); - -test('slashBreak', function (t) { - t.same( - parse([ '-I/foo/bar/baz' ]), - { I : '/foo/bar/baz', _ : [] } - ); - t.same( - parse([ '-xyz/foo/bar/baz' ]), - { x : true, y : true, z : '/foo/bar/baz', _ : [] } - ); - t.end(); -}); - -test('alias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: 'zoom' } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.f, 11); - t.end(); -}); - -test('multiAlias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: [ 'zm', 'zoom' ] } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.z, argv.zm); - t.equal(argv.f, 11); - t.end(); -}); - -test('nested dotted objects', function (t) { - var argv = parse([ - '--foo.bar', '3', '--foo.baz', '4', - '--foo.quux.quibble', '5', '--foo.quux.o_O', - '--beep.boop' - ]); - - t.same(argv.foo, { - bar : 3, - baz : 4, - quux : { - quibble : 5, - o_O : true - } - }); - t.same(argv.beep, { boop : true }); - t.end(); -}); diff --git a/node_modules/minimist/test/parse_modified.js b/node_modules/minimist/test/parse_modified.js deleted file mode 100644 index ab620dc..0000000 --- a/node_modules/minimist/test/parse_modified.js +++ /dev/null @@ -1,9 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse with modifier functions' , function (t) { - t.plan(1); - - var argv = parse([ '-b', '123' ], { boolean: 'b' }); - t.deepEqual(argv, { b: true, _: [123] }); -}); diff --git a/node_modules/minimist/test/proto.js b/node_modules/minimist/test/proto.js deleted file mode 100644 index 8649107..0000000 --- a/node_modules/minimist/test/proto.js +++ /dev/null @@ -1,44 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('proto pollution', function (t) { - var argv = parse(['--__proto__.x','123']); - t.equal({}.x, undefined); - t.equal(argv.__proto__.x, undefined); - t.equal(argv.x, undefined); - t.end(); -}); - -test('proto pollution (array)', function (t) { - var argv = parse(['--x','4','--x','5','--x.__proto__.z','789']); - t.equal({}.z, undefined); - t.deepEqual(argv.x, [4,5]); - t.equal(argv.x.z, undefined); - t.equal(argv.x.__proto__.z, undefined); - t.end(); -}); - -test('proto pollution (number)', function (t) { - var argv = parse(['--x','5','--x.__proto__.z','100']); - t.equal({}.z, undefined); - t.equal((4).z, undefined); - t.equal(argv.x, 5); - t.equal(argv.x.z, undefined); - t.end(); -}); - -test('proto pollution (string)', function (t) { - var argv = parse(['--x','abc','--x.__proto__.z','def']); - t.equal({}.z, undefined); - t.equal('...'.z, undefined); - t.equal(argv.x, 'abc'); - t.equal(argv.x.z, undefined); - t.end(); -}); - -test('proto pollution (constructor)', function (t) { - var argv = parse(['--constructor.prototype.y','123']); - t.equal({}.y, undefined); - t.equal(argv.y, undefined); - t.end(); -}); diff --git a/node_modules/minimist/test/short.js b/node_modules/minimist/test/short.js deleted file mode 100644 index d513a1c..0000000 --- a/node_modules/minimist/test/short.js +++ /dev/null @@ -1,67 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('numeric short args', function (t) { - t.plan(2); - t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); - t.deepEqual( - parse([ '-123', '456' ]), - { 1: true, 2: true, 3: 456, _: [] } - ); -}); - -test('short', function (t) { - t.deepEqual( - parse([ '-b' ]), - { b : true, _ : [] }, - 'short boolean' - ); - t.deepEqual( - parse([ 'foo', 'bar', 'baz' ]), - { _ : [ 'foo', 'bar', 'baz' ] }, - 'bare' - ); - t.deepEqual( - parse([ '-cats' ]), - { c : true, a : true, t : true, s : true, _ : [] }, - 'group' - ); - t.deepEqual( - parse([ '-cats', 'meow' ]), - { c : true, a : true, t : true, s : 'meow', _ : [] }, - 'short group next' - ); - t.deepEqual( - parse([ '-h', 'localhost' ]), - { h : 'localhost', _ : [] }, - 'short capture' - ); - t.deepEqual( - parse([ '-h', 'localhost', '-p', '555' ]), - { h : 'localhost', p : 555, _ : [] }, - 'short captures' - ); - t.end(); -}); - -test('mixed short bool and capture', function (t) { - t.same( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); - -test('short and long', function (t) { - t.deepEqual( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); diff --git a/node_modules/minimist/test/stop_early.js b/node_modules/minimist/test/stop_early.js deleted file mode 100644 index bdf9fbc..0000000 --- a/node_modules/minimist/test/stop_early.js +++ /dev/null @@ -1,15 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('stops parsing on the first non-option when stopEarly is set', function (t) { - var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { - stopEarly: true - }); - - t.deepEqual(argv, { - aaa: 'bbb', - _: ['ccc', '--ddd'] - }); - - t.end(); -}); diff --git a/node_modules/minimist/test/unknown.js b/node_modules/minimist/test/unknown.js deleted file mode 100644 index 462a36b..0000000 --- a/node_modules/minimist/test/unknown.js +++ /dev/null @@ -1,102 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('boolean and alias is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '-h', 'true', '--derp', 'true' ]; - var regular = [ '--herp', 'true', '-d', 'true' ]; - var opts = { - alias: { h: 'herp' }, - boolean: 'h', - unknown: unknownFn - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - - t.same(unknown, ['--derp', '-d']); - t.end(); -}); - -test('flag boolean true any double hyphen argument is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { - boolean: true, - unknown: unknownFn - }); - t.same(unknown, ['--tacos=good', 'cow', '-p']); - t.same(argv, { - honk: true, - _: [] - }); - t.end(); -}); - -test('string and alias is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '-h', 'hello', '--derp', 'goodbye' ]; - var regular = [ '--herp', 'hello', '-d', 'moon' ]; - var opts = { - alias: { h: 'herp' }, - string: 'h', - unknown: unknownFn - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - - t.same(unknown, ['--derp', '-d']); - t.end(); -}); - -test('default and alias is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '-h', 'hello' ]; - var regular = [ '--herp', 'hello' ]; - var opts = { - default: { 'h': 'bar' }, - alias: { 'h': 'herp' }, - unknown: unknownFn - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - - t.same(unknown, []); - t.end(); - unknownFn(); // exercise fn for 100% coverage -}); - -test('value following -- is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '--bad', '--', 'good', 'arg' ]; - var opts = { - '--': true, - unknown: unknownFn - }; - var argv = parse(aliased, opts); - - t.same(unknown, ['--bad']); - t.same(argv, { - '--': ['good', 'arg'], - '_': [] - }) - t.end(); -}); diff --git a/node_modules/minimist/test/whitespace.js b/node_modules/minimist/test/whitespace.js deleted file mode 100644 index 8a52a58..0000000 --- a/node_modules/minimist/test/whitespace.js +++ /dev/null @@ -1,8 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('whitespace should be whitespace' , function (t) { - t.plan(1); - var x = parse([ '-x', '\t' ]).x; - t.equal(x, '\t'); -}); diff --git a/node_modules/minipass/LICENSE b/node_modules/minipass/LICENSE deleted file mode 100644 index 20a4762..0000000 --- a/node_modules/minipass/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) npm, Inc. and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/minipass/README.md b/node_modules/minipass/README.md deleted file mode 100644 index c989bee..0000000 --- a/node_modules/minipass/README.md +++ /dev/null @@ -1,606 +0,0 @@ -# minipass - -A _very_ minimal implementation of a [PassThrough -stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough) - -[It's very -fast](https://docs.google.com/spreadsheets/d/1oObKSrVwLX_7Ut4Z6g3fZW-AX1j1-k6w-cDsrkaSbHM/edit#gid=0) -for objects, strings, and buffers. - -Supports pipe()ing (including multi-pipe() and backpressure -transmission), buffering data until either a `data` event handler or -`pipe()` is added (so you don't lose the first chunk), and most other -cases where PassThrough is a good idea. - -There is a `read()` method, but it's much more efficient to consume -data from this stream via `'data'` events or by calling `pipe()` into -some other stream. Calling `read()` requires the buffer to be -flattened in some cases, which requires copying memory. - -There is also no `unpipe()` method. Once you start piping, there is -no stopping it! - -If you set `objectMode: true` in the options, then whatever is written -will be emitted. Otherwise, it'll do a minimal amount of Buffer -copying to ensure proper Streams semantics when `read(n)` is called. - -`objectMode` can also be set by doing `stream.objectMode = true`, or by -writing any non-string/non-buffer data. `objectMode` cannot be set to -false once it is set. - -This is not a `through` or `through2` stream. It doesn't transform -the data, it just passes it right through. If you want to transform -the data, extend the class, and override the `write()` method. Once -you're done transforming the data however you want, call -`super.write()` with the transform output. - -For some examples of streams that extend Minipass in various ways, check -out: - -- [minizlib](http://npm.im/minizlib) -- [fs-minipass](http://npm.im/fs-minipass) -- [tar](http://npm.im/tar) -- [minipass-collect](http://npm.im/minipass-collect) -- [minipass-flush](http://npm.im/minipass-flush) -- [minipass-pipeline](http://npm.im/minipass-pipeline) -- [tap](http://npm.im/tap) -- [tap-parser](http://npm.im/tap) -- [treport](http://npm.im/tap) - -## Differences from Node.js Streams - -There are several things that make Minipass streams different from (and in -some ways superior to) Node.js core streams. - -Please read these caveats if you are familiar with noode-core streams and -intend to use Minipass streams in your programs. - -### Timing - -Minipass streams are designed to support synchronous use-cases. Thus, data -is emitted as soon as it is available, always. It is buffered until read, -but no longer. Another way to look at it is that Minipass streams are -exactly as synchronous as the logic that writes into them. - -This can be surprising if your code relies on `PassThrough.write()` always -providing data on the next tick rather than the current one, or being able -to call `resume()` and not have the entire buffer disappear immediately. - -However, without this synchronicity guarantee, there would be no way for -Minipass to achieve the speeds it does, or support the synchronous use -cases that it does. Simply put, waiting takes time. - -This non-deferring approach makes Minipass streams much easier to reason -about, especially in the context of Promises and other flow-control -mechanisms. - -### No High/Low Water Marks - -Node.js core streams will optimistically fill up a buffer, returning `true` -on all writes until the limit is hit, even if the data has nowhere to go. -Then, they will not attempt to draw more data in until the buffer size dips -below a minimum value. - -Minipass streams are much simpler. The `write()` method will return `true` -if the data has somewhere to go (which is to say, given the timing -guarantees, that the data is already there by the time `write()` returns). - -If the data has nowhere to go, then `write()` returns false, and the data -sits in a buffer, to be drained out immediately as soon as anyone consumes -it. - -### Hazards of Buffering (or: Why Minipass Is So Fast) - -Since data written to a Minipass stream is immediately written all the way -through the pipeline, and `write()` always returns true/false based on -whether the data was fully flushed, backpressure is communicated -immediately to the upstream caller. This minimizes buffering. - -Consider this case: - -```js -const {PassThrough} = require('stream') -const p1 = new PassThrough({ highWaterMark: 1024 }) -const p2 = new PassThrough({ highWaterMark: 1024 }) -const p3 = new PassThrough({ highWaterMark: 1024 }) -const p4 = new PassThrough({ highWaterMark: 1024 }) - -p1.pipe(p2).pipe(p3).pipe(p4) -p4.on('data', () => console.log('made it through')) - -// this returns false and buffers, then writes to p2 on next tick (1) -// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2) -// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3) -// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain' -// on next tick (4) -// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and -// 'drain' on next tick (5) -// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6) -// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next -// tick (7) - -p1.write(Buffer.alloc(2048)) // returns false -``` - -Along the way, the data was buffered and deferred at each stage, and -multiple event deferrals happened, for an unblocked pipeline where it was -perfectly safe to write all the way through! - -Furthermore, setting a `highWaterMark` of `1024` might lead someone reading -the code to think an advisory maximum of 1KiB is being set for the -pipeline. However, the actual advisory buffering level is the _sum_ of -`highWaterMark` values, since each one has its own bucket. - -Consider the Minipass case: - -```js -const m1 = new Minipass() -const m2 = new Minipass() -const m3 = new Minipass() -const m4 = new Minipass() - -m1.pipe(m2).pipe(m3).pipe(m4) -m4.on('data', () => console.log('made it through')) - -// m1 is flowing, so it writes the data to m2 immediately -// m2 is flowing, so it writes the data to m3 immediately -// m3 is flowing, so it writes the data to m4 immediately -// m4 is flowing, so it fires the 'data' event immediately, returns true -// m4's write returned true, so m3 is still flowing, returns true -// m3's write returned true, so m2 is still flowing, returns true -// m2's write returned true, so m1 is still flowing, returns true -// No event deferrals or buffering along the way! - -m1.write(Buffer.alloc(2048)) // returns true -``` - -It is extremely unlikely that you _don't_ want to buffer any data written, -or _ever_ buffer data that can be flushed all the way through. Neither -node-core streams nor Minipass ever fail to buffer written data, but -node-core streams do a lot of unnecessary buffering and pausing. - -As always, the faster implementation is the one that does less stuff and -waits less time to do it. - -### Immediately emit `end` for empty streams (when not paused) - -If a stream is not paused, and `end()` is called before writing any data -into it, then it will emit `end` immediately. - -If you have logic that occurs on the `end` event which you don't want to -potentially happen immediately (for example, closing file descriptors, -moving on to the next entry in an archive parse stream, etc.) then be sure -to call `stream.pause()` on creation, and then `stream.resume()` once you -are ready to respond to the `end` event. - -### Emit `end` When Asked - -One hazard of immediately emitting `'end'` is that you may not yet have had -a chance to add a listener. In order to avoid this hazard, Minipass -streams safely re-emit the `'end'` event if a new listener is added after -`'end'` has been emitted. - -Ie, if you do `stream.on('end', someFunction)`, and the stream has already -emitted `end`, then it will call the handler right away. (You can think of -this somewhat like attaching a new `.then(fn)` to a previously-resolved -Promise.) - -To prevent calling handlers multiple times who would not expect multiple -ends to occur, all listeners are removed from the `'end'` event whenever it -is emitted. - -### Impact of "immediate flow" on Tee-streams - -A "tee stream" is a stream piping to multiple destinations: - -```js -const tee = new Minipass() -t.pipe(dest1) -t.pipe(dest2) -t.write('foo') // goes to both destinations -``` - -Since Minipass streams _immediately_ process any pending data through the -pipeline when a new pipe destination is added, this can have surprising -effects, especially when a stream comes in from some other function and may -or may not have data in its buffer. - -```js -// WARNING! WILL LOSE DATA! -const src = new Minipass() -src.write('foo') -src.pipe(dest1) // 'foo' chunk flows to dest1 immediately, and is gone -src.pipe(dest2) // gets nothing! -``` - -The solution is to create a dedicated tee-stream junction that pipes to -both locations, and then pipe to _that_ instead. - -```js -// Safe example: tee to both places -const src = new Minipass() -src.write('foo') -const tee = new Minipass() -tee.pipe(dest1) -tee.pipe(dest2) -stream.pipe(tee) // tee gets 'foo', pipes to both locations -``` - -The same caveat applies to `on('data')` event listeners. The first one -added will _immediately_ receive all of the data, leaving nothing for the -second: - -```js -// WARNING! WILL LOSE DATA! -const src = new Minipass() -src.write('foo') -src.on('data', handler1) // receives 'foo' right away -src.on('data', handler2) // nothing to see here! -``` - -Using a dedicated tee-stream can be used in this case as well: - -```js -// Safe example: tee to both data handlers -const src = new Minipass() -src.write('foo') -const tee = new Minipass() -tee.on('data', handler1) -tee.on('data', handler2) -src.pipe(tee) -``` - -## USAGE - -It's a stream! Use it like a stream and it'll most likely do what you want. - -```js -const Minipass = require('minipass') -const mp = new Minipass(options) // optional: { encoding, objectMode } -mp.write('foo') -mp.pipe(someOtherStream) -mp.end('bar') -``` - -### OPTIONS - -* `encoding` How would you like the data coming _out_ of the stream to be - encoded? Accepts any values that can be passed to `Buffer.toString()`. -* `objectMode` Emit data exactly as it comes in. This will be flipped on - by default if you write() something other than a string or Buffer at any - point. Setting `objectMode: true` will prevent setting any encoding - value. - -### API - -Implements the user-facing portions of Node.js's `Readable` and `Writable` -streams. - -### Methods - -* `write(chunk, [encoding], [callback])` - Put data in. (Note that, in the - base Minipass class, the same data will come out.) Returns `false` if - the stream will buffer the next write, or true if it's still in - "flowing" mode. -* `end([chunk, [encoding]], [callback])` - Signal that you have no more - data to write. This will queue an `end` event to be fired when all the - data has been consumed. -* `setEncoding(encoding)` - Set the encoding for data coming of the - stream. This can only be done once. -* `pause()` - No more data for a while, please. This also prevents `end` - from being emitted for empty streams until the stream is resumed. -* `resume()` - Resume the stream. If there's data in the buffer, it is - all discarded. Any buffered events are immediately emitted. -* `pipe(dest)` - Send all output to the stream provided. There is no way - to unpipe. When data is emitted, it is immediately written to any and - all pipe destinations. -* `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are EventEmitters. - Some events are given special treatment, however. (See below under - "events".) -* `promise()` - Returns a Promise that resolves when the stream emits - `end`, or rejects if the stream emits `error`. -* `collect()` - Return a Promise that resolves on `end` with an array - containing each chunk of data that was emitted, or rejects if the - stream emits `error`. Note that this consumes the stream data. -* `concat()` - Same as `collect()`, but concatenates the data into a - single Buffer object. Will reject the returned promise if the stream is - in objectMode, or if it goes into objectMode by the end of the data. -* `read(n)` - Consume `n` bytes of data out of the buffer. If `n` is not - provided, then consume all of it. If `n` bytes are not available, then - it returns null. **Note** consuming streams in this way is less - efficient, and can lead to unnecessary Buffer copying. -* `destroy([er])` - Destroy the stream. If an error is provided, then an - `'error'` event is emitted. If the stream has a `close()` method, and - has not emitted a `'close'` event yet, then `stream.close()` will be - called. Any Promises returned by `.promise()`, `.collect()` or - `.concat()` will be rejected. After being destroyed, writing to the - stream will emit an error. No more data will be emitted if the stream is - destroyed, even if it was previously buffered. - -### Properties - -* `bufferLength` Read-only. Total number of bytes buffered, or in the case - of objectMode, the total number of objects. -* `encoding` The encoding that has been set. (Setting this is equivalent - to calling `setEncoding(enc)` and has the same prohibition against - setting multiple times.) -* `flowing` Read-only. Boolean indicating whether a chunk written to the - stream will be immediately emitted. -* `emittedEnd` Read-only. Boolean indicating whether the end-ish events - (ie, `end`, `prefinish`, `finish`) have been emitted. Note that - listening on any end-ish event will immediateyl re-emit it if it has - already been emitted. -* `writable` Whether the stream is writable. Default `true`. Set to - `false` when `end()` -* `readable` Whether the stream is readable. Default `true`. -* `buffer` A [yallist](http://npm.im/yallist) linked list of chunks written - to the stream that have not yet been emitted. (It's probably a bad idea - to mess with this.) -* `pipes` A [yallist](http://npm.im/yallist) linked list of streams that - this stream is piping into. (It's probably a bad idea to mess with - this.) -* `destroyed` A getter that indicates whether the stream was destroyed. -* `paused` True if the stream has been explicitly paused, otherwise false. -* `objectMode` Indicates whether the stream is in `objectMode`. Once set - to `true`, it cannot be set to `false`. - -### Events - -* `data` Emitted when there's data to read. Argument is the data to read. - This is never emitted while not flowing. If a listener is attached, that - will resume the stream. -* `end` Emitted when there's no more data to read. This will be emitted - immediately for empty streams when `end()` is called. If a listener is - attached, and `end` was already emitted, then it will be emitted again. - All listeners are removed when `end` is emitted. -* `prefinish` An end-ish event that follows the same logic as `end` and is - emitted in the same conditions where `end` is emitted. Emitted after - `'end'`. -* `finish` An end-ish event that follows the same logic as `end` and is - emitted in the same conditions where `end` is emitted. Emitted after - `'prefinish'`. -* `close` An indication that an underlying resource has been released. - Minipass does not emit this event, but will defer it until after `end` - has been emitted, since it throws off some stream libraries otherwise. -* `drain` Emitted when the internal buffer empties, and it is again - suitable to `write()` into the stream. -* `readable` Emitted when data is buffered and ready to be read by a - consumer. -* `resume` Emitted when stream changes state from buffering to flowing - mode. (Ie, when `resume` is called, `pipe` is called, or a `data` event - listener is added.) - -### Static Methods - -* `Minipass.isStream(stream)` Returns `true` if the argument is a stream, - and false otherwise. To be considered a stream, the object must be - either an instance of Minipass, or an EventEmitter that has either a - `pipe()` method, or both `write()` and `end()` methods. (Pretty much any - stream in node-land will return `true` for this.) - -## EXAMPLES - -Here are some examples of things you can do with Minipass streams. - -### simple "are you done yet" promise - -```js -mp.promise().then(() => { - // stream is finished -}, er => { - // stream emitted an error -}) -``` - -### collecting - -```js -mp.collect().then(all => { - // all is an array of all the data emitted - // encoding is supported in this case, so - // so the result will be a collection of strings if - // an encoding is specified, or buffers/objects if not. - // - // In an async function, you may do - // const data = await stream.collect() -}) -``` - -### collecting into a single blob - -This is a bit slower because it concatenates the data into one chunk for -you, but if you're going to do it yourself anyway, it's convenient this -way: - -```js -mp.concat().then(onebigchunk => { - // onebigchunk is a string if the stream - // had an encoding set, or a buffer otherwise. -}) -``` - -### iteration - -You can iterate over streams synchronously or asynchronously in -platforms that support it. - -Synchronous iteration will end when the currently available data is -consumed, even if the `end` event has not been reached. In string and -buffer mode, the data is concatenated, so unless multiple writes are -occurring in the same tick as the `read()`, sync iteration loops will -generally only have a single iteration. - -To consume chunks in this way exactly as they have been written, with -no flattening, create the stream with the `{ objectMode: true }` -option. - -```js -const mp = new Minipass({ objectMode: true }) -mp.write('a') -mp.write('b') -for (let letter of mp) { - console.log(letter) // a, b -} -mp.write('c') -mp.write('d') -for (let letter of mp) { - console.log(letter) // c, d -} -mp.write('e') -mp.end() -for (let letter of mp) { - console.log(letter) // e -} -for (let letter of mp) { - console.log(letter) // nothing -} -``` - -Asynchronous iteration will continue until the end event is reached, -consuming all of the data. - -```js -const mp = new Minipass({ encoding: 'utf8' }) - -// some source of some data -let i = 5 -const inter = setInterval(() => { - if (i --> 0) - mp.write(Buffer.from('foo\n', 'utf8')) - else { - mp.end() - clearInterval(inter) - } -}, 100) - -// consume the data with asynchronous iteration -async function consume () { - for await (let chunk of mp) { - console.log(chunk) - } - return 'ok' -} - -consume().then(res => console.log(res)) -// logs `foo\n` 5 times, and then `ok` -``` - -### subclass that `console.log()`s everything written into it - -```js -class Logger extends Minipass { - write (chunk, encoding, callback) { - console.log('WRITE', chunk, encoding) - return super.write(chunk, encoding, callback) - } - end (chunk, encoding, callback) { - console.log('END', chunk, encoding) - return super.end(chunk, encoding, callback) - } -} - -someSource.pipe(new Logger()).pipe(someDest) -``` - -### same thing, but using an inline anonymous class - -```js -// js classes are fun -someSource - .pipe(new (class extends Minipass { - emit (ev, ...data) { - // let's also log events, because debugging some weird thing - console.log('EMIT', ev) - return super.emit(ev, ...data) - } - write (chunk, encoding, callback) { - console.log('WRITE', chunk, encoding) - return super.write(chunk, encoding, callback) - } - end (chunk, encoding, callback) { - console.log('END', chunk, encoding) - return super.end(chunk, encoding, callback) - } - })) - .pipe(someDest) -``` - -### subclass that defers 'end' for some reason - -```js -class SlowEnd extends Minipass { - emit (ev, ...args) { - if (ev === 'end') { - console.log('going to end, hold on a sec') - setTimeout(() => { - console.log('ok, ready to end now') - super.emit('end', ...args) - }, 100) - } else { - return super.emit(ev, ...args) - } - } -} -``` - -### transform that creates newline-delimited JSON - -```js -class NDJSONEncode extends Minipass { - write (obj, cb) { - try { - // JSON.stringify can throw, emit an error on that - return super.write(JSON.stringify(obj) + '\n', 'utf8', cb) - } catch (er) { - this.emit('error', er) - } - } - end (obj, cb) { - if (typeof obj === 'function') { - cb = obj - obj = undefined - } - if (obj !== undefined) { - this.write(obj) - } - return super.end(cb) - } -} -``` - -### transform that parses newline-delimited JSON - -```js -class NDJSONDecode extends Minipass { - constructor (options) { - // always be in object mode, as far as Minipass is concerned - super({ objectMode: true }) - this._jsonBuffer = '' - } - write (chunk, encoding, cb) { - if (typeof chunk === 'string' && - typeof encoding === 'string' && - encoding !== 'utf8') { - chunk = Buffer.from(chunk, encoding).toString() - } else if (Buffer.isBuffer(chunk)) - chunk = chunk.toString() - } - if (typeof encoding === 'function') { - cb = encoding - } - const jsonData = (this._jsonBuffer + chunk).split('\n') - this._jsonBuffer = jsonData.pop() - for (let i = 0; i < jsonData.length; i++) { - let parsed - try { - super.write(parsed) - } catch (er) { - this.emit('error', er) - continue - } - } - if (cb) - cb() - } -} -``` diff --git a/node_modules/minipass/index.js b/node_modules/minipass/index.js deleted file mode 100644 index c072352..0000000 --- a/node_modules/minipass/index.js +++ /dev/null @@ -1,537 +0,0 @@ -'use strict' -const EE = require('events') -const Yallist = require('yallist') -const SD = require('string_decoder').StringDecoder - -const EOF = Symbol('EOF') -const MAYBE_EMIT_END = Symbol('maybeEmitEnd') -const EMITTED_END = Symbol('emittedEnd') -const EMITTING_END = Symbol('emittingEnd') -const CLOSED = Symbol('closed') -const READ = Symbol('read') -const FLUSH = Symbol('flush') -const FLUSHCHUNK = Symbol('flushChunk') -const ENCODING = Symbol('encoding') -const DECODER = Symbol('decoder') -const FLOWING = Symbol('flowing') -const PAUSED = Symbol('paused') -const RESUME = Symbol('resume') -const BUFFERLENGTH = Symbol('bufferLength') -const BUFFERPUSH = Symbol('bufferPush') -const BUFFERSHIFT = Symbol('bufferShift') -const OBJECTMODE = Symbol('objectMode') -const DESTROYED = Symbol('destroyed') - -// TODO remove when Node v8 support drops -const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1' -const ASYNCITERATOR = doIter && Symbol.asyncIterator - || Symbol('asyncIterator not implemented') -const ITERATOR = doIter && Symbol.iterator - || Symbol('iterator not implemented') - -// Buffer in node 4.x < 4.5.0 doesn't have working Buffer.from -// or Buffer.alloc, and Buffer in node 10 deprecated the ctor. -// .M, this is fine .\^/M.. -const B = Buffer.alloc ? Buffer - : /* istanbul ignore next */ require('safe-buffer').Buffer - -// events that mean 'the stream is over' -// these are treated specially, and re-emitted -// if they are listened for after emitting. -const isEndish = ev => - ev === 'end' || - ev === 'finish' || - ev === 'prefinish' - -const isArrayBuffer = b => b instanceof ArrayBuffer || - typeof b === 'object' && - b.constructor && - b.constructor.name === 'ArrayBuffer' && - b.byteLength >= 0 - -const isArrayBufferView = b => !B.isBuffer(b) && ArrayBuffer.isView(b) - -module.exports = class Minipass extends EE { - constructor (options) { - super() - this[FLOWING] = false - // whether we're explicitly paused - this[PAUSED] = false - this.pipes = new Yallist() - this.buffer = new Yallist() - this[OBJECTMODE] = options && options.objectMode || false - if (this[OBJECTMODE]) - this[ENCODING] = null - else - this[ENCODING] = options && options.encoding || null - if (this[ENCODING] === 'buffer') - this[ENCODING] = null - this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null - this[EOF] = false - this[EMITTED_END] = false - this[EMITTING_END] = false - this[CLOSED] = false - this.writable = true - this.readable = true - this[BUFFERLENGTH] = 0 - this[DESTROYED] = false - } - - get bufferLength () { return this[BUFFERLENGTH] } - - get encoding () { return this[ENCODING] } - set encoding (enc) { - if (this[OBJECTMODE]) - throw new Error('cannot set encoding in objectMode') - - if (this[ENCODING] && enc !== this[ENCODING] && - (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH])) - throw new Error('cannot change encoding') - - if (this[ENCODING] !== enc) { - this[DECODER] = enc ? new SD(enc) : null - if (this.buffer.length) - this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk)) - } - - this[ENCODING] = enc - } - - setEncoding (enc) { - this.encoding = enc - } - - get objectMode () { return this[OBJECTMODE] } - set objectMode (ॐ ) { this[OBJECTMODE] = this[OBJECTMODE] || !!ॐ } - - write (chunk, encoding, cb) { - if (this[EOF]) - throw new Error('write after end') - - if (this[DESTROYED]) { - this.emit('error', Object.assign( - new Error('Cannot call write after a stream was destroyed'), - { code: 'ERR_STREAM_DESTROYED' } - )) - return true - } - - if (typeof encoding === 'function') - cb = encoding, encoding = 'utf8' - - if (!encoding) - encoding = 'utf8' - - // convert array buffers and typed array views into buffers - // at some point in the future, we may want to do the opposite! - // leave strings and buffers as-is - // anything else switches us into object mode - if (!this[OBJECTMODE] && !B.isBuffer(chunk)) { - if (isArrayBufferView(chunk)) - chunk = B.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) - else if (isArrayBuffer(chunk)) - chunk = B.from(chunk) - else if (typeof chunk !== 'string') - // use the setter so we throw if we have encoding set - this.objectMode = true - } - - // this ensures at this point that the chunk is a buffer or string - // don't buffer it up or send it to the decoder - if (!this.objectMode && !chunk.length) { - const ret = this.flowing - if (this[BUFFERLENGTH] !== 0) - this.emit('readable') - if (cb) - cb() - return ret - } - - // fast-path writing strings of same encoding to a stream with - // an empty buffer, skipping the buffer/decoder dance - if (typeof chunk === 'string' && !this[OBJECTMODE] && - // unless it is a string already ready for us to use - !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) { - chunk = B.from(chunk, encoding) - } - - if (B.isBuffer(chunk) && this[ENCODING]) - chunk = this[DECODER].write(chunk) - - try { - return this.flowing - ? (this.emit('data', chunk), this.flowing) - : (this[BUFFERPUSH](chunk), false) - } finally { - if (this[BUFFERLENGTH] !== 0) - this.emit('readable') - if (cb) - cb() - } - } - - read (n) { - if (this[DESTROYED]) - return null - - try { - if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) - return null - - if (this[OBJECTMODE]) - n = null - - if (this.buffer.length > 1 && !this[OBJECTMODE]) { - if (this.encoding) - this.buffer = new Yallist([ - Array.from(this.buffer).join('') - ]) - else - this.buffer = new Yallist([ - B.concat(Array.from(this.buffer), this[BUFFERLENGTH]) - ]) - } - - return this[READ](n || null, this.buffer.head.value) - } finally { - this[MAYBE_EMIT_END]() - } - } - - [READ] (n, chunk) { - if (n === chunk.length || n === null) - this[BUFFERSHIFT]() - else { - this.buffer.head.value = chunk.slice(n) - chunk = chunk.slice(0, n) - this[BUFFERLENGTH] -= n - } - - this.emit('data', chunk) - - if (!this.buffer.length && !this[EOF]) - this.emit('drain') - - return chunk - } - - end (chunk, encoding, cb) { - if (typeof chunk === 'function') - cb = chunk, chunk = null - if (typeof encoding === 'function') - cb = encoding, encoding = 'utf8' - if (chunk) - this.write(chunk, encoding) - if (cb) - this.once('end', cb) - this[EOF] = true - this.writable = false - - // if we haven't written anything, then go ahead and emit, - // even if we're not reading. - // we'll re-emit if a new 'end' listener is added anyway. - // This makes MP more suitable to write-only use cases. - if (this.flowing || !this[PAUSED]) - this[MAYBE_EMIT_END]() - return this - } - - // don't let the internal resume be overwritten - [RESUME] () { - if (this[DESTROYED]) - return - - this[PAUSED] = false - this[FLOWING] = true - this.emit('resume') - if (this.buffer.length) - this[FLUSH]() - else if (this[EOF]) - this[MAYBE_EMIT_END]() - else - this.emit('drain') - } - - resume () { - return this[RESUME]() - } - - pause () { - this[FLOWING] = false - this[PAUSED] = true - } - - get destroyed () { - return this[DESTROYED] - } - - get flowing () { - return this[FLOWING] - } - - get paused () { - return this[PAUSED] - } - - [BUFFERPUSH] (chunk) { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] += 1 - else - this[BUFFERLENGTH] += chunk.length - return this.buffer.push(chunk) - } - - [BUFFERSHIFT] () { - if (this.buffer.length) { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] -= 1 - else - this[BUFFERLENGTH] -= this.buffer.head.value.length - } - return this.buffer.shift() - } - - [FLUSH] () { - do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]())) - - if (!this.buffer.length && !this[EOF]) - this.emit('drain') - } - - [FLUSHCHUNK] (chunk) { - return chunk ? (this.emit('data', chunk), this.flowing) : false - } - - pipe (dest, opts) { - if (this[DESTROYED]) - return - - const ended = this[EMITTED_END] - opts = opts || {} - if (dest === process.stdout || dest === process.stderr) - opts.end = false - else - opts.end = opts.end !== false - - const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() } - this.pipes.push(p) - - dest.on('drain', p.ondrain) - this[RESUME]() - // piping an ended stream ends immediately - if (ended && p.opts.end) - p.dest.end() - return dest - } - - addListener (ev, fn) { - return this.on(ev, fn) - } - - on (ev, fn) { - try { - return super.on(ev, fn) - } finally { - if (ev === 'data' && !this.pipes.length && !this.flowing) - this[RESUME]() - else if (isEndish(ev) && this[EMITTED_END]) { - super.emit(ev) - this.removeAllListeners(ev) - } - } - } - - get emittedEnd () { - return this[EMITTED_END] - } - - [MAYBE_EMIT_END] () { - if (!this[EMITTING_END] && - !this[EMITTED_END] && - !this[DESTROYED] && - this.buffer.length === 0 && - this[EOF]) { - this[EMITTING_END] = true - this.emit('end') - this.emit('prefinish') - this.emit('finish') - if (this[CLOSED]) - this.emit('close') - this[EMITTING_END] = false - } - } - - emit (ev, data) { - // error and close are only events allowed after calling destroy() - if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED]) - return - else if (ev === 'data') { - if (!data) - return - - if (this.pipes.length) - this.pipes.forEach(p => - p.dest.write(data) === false && this.pause()) - } else if (ev === 'end') { - // only actual end gets this treatment - if (this[EMITTED_END] === true) - return - - this[EMITTED_END] = true - this.readable = false - - if (this[DECODER]) { - data = this[DECODER].end() - if (data) { - this.pipes.forEach(p => p.dest.write(data)) - super.emit('data', data) - } - } - - this.pipes.forEach(p => { - p.dest.removeListener('drain', p.ondrain) - if (p.opts.end) - p.dest.end() - }) - } else if (ev === 'close') { - this[CLOSED] = true - // don't emit close before 'end' and 'finish' - if (!this[EMITTED_END] && !this[DESTROYED]) - return - } - - // TODO: replace with a spread operator when Node v4 support drops - const args = new Array(arguments.length) - args[0] = ev - args[1] = data - if (arguments.length > 2) { - for (let i = 2; i < arguments.length; i++) { - args[i] = arguments[i] - } - } - - try { - return super.emit.apply(this, args) - } finally { - if (!isEndish(ev)) - this[MAYBE_EMIT_END]() - else - this.removeAllListeners(ev) - } - } - - // const all = await stream.collect() - collect () { - const buf = [] - buf.dataLength = 0 - this.on('data', c => { - buf.push(c) - buf.dataLength += c.length - }) - return this.promise().then(() => buf) - } - - // const data = await stream.concat() - concat () { - return this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this.collect().then(buf => - this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this[ENCODING] ? buf.join('') : B.concat(buf, buf.dataLength)) - } - - // stream.promise().then(() => done, er => emitted error) - promise () { - return new Promise((resolve, reject) => { - this.on(DESTROYED, () => reject(new Error('stream destroyed'))) - this.on('end', () => resolve()) - this.on('error', er => reject(er)) - }) - } - - // for await (let chunk of stream) - [ASYNCITERATOR] () { - const next = () => { - const res = this.read() - if (res !== null) - return Promise.resolve({ done: false, value: res }) - - if (this[EOF]) - return Promise.resolve({ done: true }) - - let resolve = null - let reject = null - const onerr = er => { - this.removeListener('data', ondata) - this.removeListener('end', onend) - reject(er) - } - const ondata = value => { - this.removeListener('error', onerr) - this.removeListener('end', onend) - this.pause() - resolve({ value: value, done: !!this[EOF] }) - } - const onend = () => { - this.removeListener('error', onerr) - this.removeListener('data', ondata) - resolve({ done: true }) - } - const ondestroy = () => onerr(new Error('stream destroyed')) - return new Promise((res, rej) => { - reject = rej - resolve = res - this.once(DESTROYED, ondestroy) - this.once('error', onerr) - this.once('end', onend) - this.once('data', ondata) - }) - } - - return { next } - } - - // for (let chunk of stream) - [ITERATOR] () { - const next = () => { - const value = this.read() - const done = value === null - return { value, done } - } - return { next } - } - - destroy (er) { - if (this[DESTROYED]) { - if (er) - this.emit('error', er) - else - this.emit(DESTROYED) - return this - } - - this[DESTROYED] = true - - // throw away all buffered data, it's never coming out - this.buffer = new Yallist() - this[BUFFERLENGTH] = 0 - - if (typeof this.close === 'function' && !this[CLOSED]) - this.close() - - if (er) - this.emit('error', er) - else // if no error to emit, still reject pending promises - this.emit(DESTROYED) - - return this - } - - static isStream (s) { - return !!s && (s instanceof Minipass || s instanceof EE && ( - typeof s.pipe === 'function' || // readable - (typeof s.write === 'function' && typeof s.end === 'function') // writable - )) - } -} diff --git a/node_modules/minipass/package.json b/node_modules/minipass/package.json deleted file mode 100644 index 8096983..0000000 --- a/node_modules/minipass/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "_from": "minipass@^2.8.6", - "_id": "minipass@2.9.0", - "_inBundle": false, - "_integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", - "_location": "/minipass", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "minipass@^2.8.6", - "name": "minipass", - "escapedName": "minipass", - "rawSpec": "^2.8.6", - "saveSpec": null, - "fetchSpec": "^2.8.6" - }, - "_requiredBy": [ - "/fs-minipass", - "/minizlib", - "/tar" - ], - "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", - "_shasum": "e713762e7d3e32fed803115cf93e04bca9fcc9a6", - "_spec": "minipass@^2.8.6", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/tar", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/minipass/issues" - }, - "bundleDependencies": false, - "dependencies": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - }, - "deprecated": false, - "description": "minimal implementation of a PassThrough stream", - "devDependencies": { - "end-of-stream": "^1.4.0", - "tap": "^14.6.5", - "through2": "^2.0.3" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/isaacs/minipass#readme", - "keywords": [ - "passthrough", - "stream" - ], - "license": "ISC", - "main": "index.js", - "name": "minipass", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/minipass.git" - }, - "scripts": { - "postpublish": "git push origin --follow-tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap" - }, - "tap": { - "check-coverage": true - }, - "version": "2.9.0" -} diff --git a/node_modules/minizlib/LICENSE b/node_modules/minizlib/LICENSE deleted file mode 100644 index ffce738..0000000 --- a/node_modules/minizlib/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Minizlib was created by Isaac Z. Schlueter. -It is a derivative work of the Node.js project. - -""" -Copyright Isaac Z. Schlueter and Contributors -Copyright Node.js contributors. All rights reserved. -Copyright Joyent, Inc. and other Node contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" diff --git a/node_modules/minizlib/README.md b/node_modules/minizlib/README.md deleted file mode 100644 index 4097b85..0000000 --- a/node_modules/minizlib/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# minizlib - -A fast zlib stream built on [minipass](http://npm.im/minipass) and -Node.js's zlib binding. - -This module was created to serve the needs of -[node-tar](http://npm.im/tar) and -[minipass-fetch](http://npm.im/minipass-fetch). - -Brotli is supported in versions of node with a Brotli binding. - -## How does this differ from the streams in `require('zlib')`? - -First, there are no convenience methods to compress or decompress a -buffer. If you want those, use the built-in `zlib` module. This is -only streams. That being said, Minipass streams to make it fairly easy to -use as one-liners: `new zlib.Deflate().end(data).read()` will return the -deflate compressed result. - -This module compresses and decompresses the data as fast as you feed -it in. It is synchronous, and runs on the main process thread. Zlib -and Brotli operations can be high CPU, but they're very fast, and doing it -this way means much less bookkeeping and artificial deferral. - -Node's built in zlib streams are built on top of `stream.Transform`. -They do the maximally safe thing with respect to consistent -asynchrony, buffering, and backpressure. - -See [Minipass](http://npm.im/minipass) for more on the differences between -Node.js core streams and Minipass streams, and the convenience methods -provided by that class. - -## Classes - -- Deflate -- Inflate -- Gzip -- Gunzip -- DeflateRaw -- InflateRaw -- Unzip -- BrotliCompress (Node v10 and higher) -- BrotliDecompress (Node v10 and higher) - -## USAGE - -```js -const zlib = require('minizlib') -const input = sourceOfCompressedData() -const decode = new zlib.BrotliDecompress() -const output = whereToWriteTheDecodedData() -input.pipe(decode).pipe(output) -``` diff --git a/node_modules/minizlib/constants.js b/node_modules/minizlib/constants.js deleted file mode 100644 index 641ebc7..0000000 --- a/node_modules/minizlib/constants.js +++ /dev/null @@ -1,115 +0,0 @@ -// Update with any zlib constants that are added or changed in the future. -// Node v6 didn't export this, so we just hard code the version and rely -// on all the other hard-coded values from zlib v4736. When node v6 -// support drops, we can just export the realZlibConstants object. -const realZlibConstants = require('zlib').constants || - /* istanbul ignore next */ { ZLIB_VERNUM: 4736 } - -module.exports = Object.freeze(Object.assign(Object.create(null), { - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - Z_VERSION_ERROR: -6, - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - DEFLATE: 1, - INFLATE: 2, - GZIP: 3, - GUNZIP: 4, - DEFLATERAW: 5, - INFLATERAW: 6, - UNZIP: 7, - BROTLI_DECODE: 8, - BROTLI_ENCODE: 9, - Z_MIN_WINDOWBITS: 8, - Z_MAX_WINDOWBITS: 15, - Z_DEFAULT_WINDOWBITS: 15, - Z_MIN_CHUNK: 64, - Z_MAX_CHUNK: Infinity, - Z_DEFAULT_CHUNK: 16384, - Z_MIN_MEMLEVEL: 1, - Z_MAX_MEMLEVEL: 9, - Z_DEFAULT_MEMLEVEL: 8, - Z_MIN_LEVEL: -1, - Z_MAX_LEVEL: 9, - Z_DEFAULT_LEVEL: -1, - BROTLI_OPERATION_PROCESS: 0, - BROTLI_OPERATION_FLUSH: 1, - BROTLI_OPERATION_FINISH: 2, - BROTLI_OPERATION_EMIT_METADATA: 3, - BROTLI_MODE_GENERIC: 0, - BROTLI_MODE_TEXT: 1, - BROTLI_MODE_FONT: 2, - BROTLI_DEFAULT_MODE: 0, - BROTLI_MIN_QUALITY: 0, - BROTLI_MAX_QUALITY: 11, - BROTLI_DEFAULT_QUALITY: 11, - BROTLI_MIN_WINDOW_BITS: 10, - BROTLI_MAX_WINDOW_BITS: 24, - BROTLI_LARGE_MAX_WINDOW_BITS: 30, - BROTLI_DEFAULT_WINDOW: 22, - BROTLI_MIN_INPUT_BLOCK_BITS: 16, - BROTLI_MAX_INPUT_BLOCK_BITS: 24, - BROTLI_PARAM_MODE: 0, - BROTLI_PARAM_QUALITY: 1, - BROTLI_PARAM_LGWIN: 2, - BROTLI_PARAM_LGBLOCK: 3, - BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4, - BROTLI_PARAM_SIZE_HINT: 5, - BROTLI_PARAM_LARGE_WINDOW: 6, - BROTLI_PARAM_NPOSTFIX: 7, - BROTLI_PARAM_NDIRECT: 8, - BROTLI_DECODER_RESULT_ERROR: 0, - BROTLI_DECODER_RESULT_SUCCESS: 1, - BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2, - BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3, - BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0, - BROTLI_DECODER_PARAM_LARGE_WINDOW: 1, - BROTLI_DECODER_NO_ERROR: 0, - BROTLI_DECODER_SUCCESS: 1, - BROTLI_DECODER_NEEDS_MORE_INPUT: 2, - BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3, - BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1, - BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2, - BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3, - BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4, - BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5, - BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6, - BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7, - BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8, - BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9, - BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10, - BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11, - BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12, - BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13, - BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14, - BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15, - BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16, - BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19, - BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20, - BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21, - BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22, - BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25, - BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26, - BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27, - BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30, - BROTLI_DECODER_ERROR_UNREACHABLE: -31, -}, realZlibConstants)) diff --git a/node_modules/minizlib/index.js b/node_modules/minizlib/index.js deleted file mode 100644 index 295047b..0000000 --- a/node_modules/minizlib/index.js +++ /dev/null @@ -1,320 +0,0 @@ -'use strict' - -const assert = require('assert') -const Buffer = require('buffer').Buffer -const realZlib = require('zlib') - -const constants = exports.constants = require('./constants.js') -const Minipass = require('minipass') - -const OriginalBufferConcat = Buffer.concat - -class ZlibError extends Error { - constructor (err) { - super('zlib: ' + err.message) - this.code = err.code - this.errno = err.errno - /* istanbul ignore if */ - if (!this.code) - this.code = 'ZLIB_ERROR' - - this.message = 'zlib: ' + err.message - Error.captureStackTrace(this, this.constructor) - } - - get name () { - return 'ZlibError' - } -} - -// the Zlib class they all inherit from -// This thing manages the queue of requests, and returns -// true or false if there is anything in the queue when -// you call the .write() method. -const _opts = Symbol('opts') -const _flushFlag = Symbol('flushFlag') -const _finishFlushFlag = Symbol('finishFlushFlag') -const _fullFlushFlag = Symbol('fullFlushFlag') -const _handle = Symbol('handle') -const _onError = Symbol('onError') -const _sawError = Symbol('sawError') -const _level = Symbol('level') -const _strategy = Symbol('strategy') -const _ended = Symbol('ended') -const _defaultFullFlush = Symbol('_defaultFullFlush') - -class ZlibBase extends Minipass { - constructor (opts, mode) { - if (!opts || typeof opts !== 'object') - throw new TypeError('invalid options for ZlibBase constructor') - - super(opts) - this[_ended] = false - this[_opts] = opts - - this[_flushFlag] = opts.flush - this[_finishFlushFlag] = opts.finishFlush - // this will throw if any options are invalid for the class selected - try { - this[_handle] = new realZlib[mode](opts) - } catch (er) { - // make sure that all errors get decorated properly - throw new ZlibError(er) - } - - this[_onError] = (err) => { - this[_sawError] = true - // there is no way to cleanly recover. - // continuing only obscures problems. - this.close() - this.emit('error', err) - } - - this[_handle].on('error', er => this[_onError](new ZlibError(er))) - this.once('end', () => this.close) - } - - close () { - if (this[_handle]) { - this[_handle].close() - this[_handle] = null - this.emit('close') - } - } - - reset () { - if (!this[_sawError]) { - assert(this[_handle], 'zlib binding closed') - return this[_handle].reset() - } - } - - flush (flushFlag) { - if (this.ended) - return - - if (typeof flushFlag !== 'number') - flushFlag = this[_fullFlushFlag] - this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag })) - } - - end (chunk, encoding, cb) { - if (chunk) - this.write(chunk, encoding) - this.flush(this[_finishFlushFlag]) - this[_ended] = true - return super.end(null, null, cb) - } - - get ended () { - return this[_ended] - } - - write (chunk, encoding, cb) { - // process the chunk using the sync process - // then super.write() all the outputted chunks - if (typeof encoding === 'function') - cb = encoding, encoding = 'utf8' - - if (typeof chunk === 'string') - chunk = Buffer.from(chunk, encoding) - - if (this[_sawError]) - return - assert(this[_handle], 'zlib binding closed') - - // _processChunk tries to .close() the native handle after it's done, so we - // intercept that by temporarily making it a no-op. - const nativeHandle = this[_handle]._handle - const originalNativeClose = nativeHandle.close - nativeHandle.close = () => {} - const originalClose = this[_handle].close - this[_handle].close = () => {} - // It also calls `Buffer.concat()` at the end, which may be convenient - // for some, but which we are not interested in as it slows us down. - Buffer.concat = (args) => args - let result - try { - const flushFlag = typeof chunk[_flushFlag] === 'number' - ? chunk[_flushFlag] : this[_flushFlag] - result = this[_handle]._processChunk(chunk, flushFlag) - // if we don't throw, reset it back how it was - Buffer.concat = OriginalBufferConcat - } catch (err) { - // or if we do, put Buffer.concat() back before we emit error - // Error events call into user code, which may call Buffer.concat() - Buffer.concat = OriginalBufferConcat - this[_onError](new ZlibError(err)) - } finally { - if (this[_handle]) { - // Core zlib resets `_handle` to null after attempting to close the - // native handle. Our no-op handler prevented actual closure, but we - // need to restore the `._handle` property. - this[_handle]._handle = nativeHandle - nativeHandle.close = originalNativeClose - this[_handle].close = originalClose - // `_processChunk()` adds an 'error' listener. If we don't remove it - // after each call, these handlers start piling up. - this[_handle].removeAllListeners('error') - } - } - - let writeReturn - if (result) { - if (Array.isArray(result) && result.length > 0) { - // The first buffer is always `handle._outBuffer`, which would be - // re-used for later invocations; so, we always have to copy that one. - writeReturn = super.write(Buffer.from(result[0])) - for (let i = 1; i < result.length; i++) { - writeReturn = super.write(result[i]) - } - } else { - writeReturn = super.write(Buffer.from(result)) - } - } - - if (cb) - cb() - return writeReturn - } -} - -class Zlib extends ZlibBase { - constructor (opts, mode) { - opts = opts || {} - - opts.flush = opts.flush || constants.Z_NO_FLUSH - opts.finishFlush = opts.finishFlush || constants.Z_FINISH - super(opts, mode) - - this[_fullFlushFlag] = constants.Z_FULL_FLUSH - this[_level] = opts.level - this[_strategy] = opts.strategy - } - - params (level, strategy) { - if (this[_sawError]) - return - - if (!this[_handle]) - throw new Error('cannot switch params when binding is closed') - - // no way to test this without also not supporting params at all - /* istanbul ignore if */ - if (!this[_handle].params) - throw new Error('not supported in this implementation') - - if (this[_level] !== level || this[_strategy] !== strategy) { - this.flush(constants.Z_SYNC_FLUSH) - assert(this[_handle], 'zlib binding closed') - // .params() calls .flush(), but the latter is always async in the - // core zlib. We override .flush() temporarily to intercept that and - // flush synchronously. - const origFlush = this[_handle].flush - this[_handle].flush = (flushFlag, cb) => { - this.flush(flushFlag) - cb() - } - try { - this[_handle].params(level, strategy) - } finally { - this[_handle].flush = origFlush - } - /* istanbul ignore else */ - if (this[_handle]) { - this[_level] = level - this[_strategy] = strategy - } - } - } -} - -// minimal 2-byte header -class Deflate extends Zlib { - constructor (opts) { - super(opts, 'Deflate') - } -} - -class Inflate extends Zlib { - constructor (opts) { - super(opts, 'Inflate') - } -} - -// gzip - bigger header, same deflate compression -class Gzip extends Zlib { - constructor (opts) { - super(opts, 'Gzip') - } -} - -class Gunzip extends Zlib { - constructor (opts) { - super(opts, 'Gunzip') - } -} - -// raw - no header -class DeflateRaw extends Zlib { - constructor (opts) { - super(opts, 'DeflateRaw') - } -} - -class InflateRaw extends Zlib { - constructor (opts) { - super(opts, 'InflateRaw') - } -} - -// auto-detect header. -class Unzip extends Zlib { - constructor (opts) { - super(opts, 'Unzip') - } -} - -class Brotli extends ZlibBase { - constructor (opts, mode) { - opts = opts || {} - - opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS - opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH - - super(opts, mode) - - this[_fullFlushFlag] = constants.BROTLI_OPERATION_FLUSH - } -} - -class BrotliCompress extends Brotli { - constructor (opts) { - super(opts, 'BrotliCompress') - } -} - -class BrotliDecompress extends Brotli { - constructor (opts) { - super(opts, 'BrotliDecompress') - } -} - -exports.Deflate = Deflate -exports.Inflate = Inflate -exports.Gzip = Gzip -exports.Gunzip = Gunzip -exports.DeflateRaw = DeflateRaw -exports.InflateRaw = InflateRaw -exports.Unzip = Unzip -/* istanbul ignore else */ -if (typeof realZlib.BrotliCompress === 'function') { - exports.BrotliCompress = BrotliCompress - exports.BrotliDecompress = BrotliDecompress -} else { - exports.BrotliCompress = exports.BrotliDecompress = class { - constructor () { - throw new Error('Brotli is not supported in this version of Node.js') - } - } -} diff --git a/node_modules/minizlib/package.json b/node_modules/minizlib/package.json deleted file mode 100644 index 29758f8..0000000 --- a/node_modules/minizlib/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "_from": "minizlib@^1.2.1", - "_id": "minizlib@1.3.3", - "_inBundle": false, - "_integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", - "_location": "/minizlib", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "minizlib@^1.2.1", - "name": "minizlib", - "escapedName": "minizlib", - "rawSpec": "^1.2.1", - "saveSpec": null, - "fetchSpec": "^1.2.1" - }, - "_requiredBy": [ - "/tar" - ], - "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", - "_shasum": "2290de96818a34c29551c8a8d301216bd65a861d", - "_spec": "minizlib@^1.2.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/tar", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/minizlib/issues" - }, - "bundleDependencies": false, - "dependencies": { - "minipass": "^2.9.0" - }, - "deprecated": false, - "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.", - "devDependencies": { - "tap": "^12.0.1" - }, - "files": [ - "index.js", - "constants.js" - ], - "homepage": "https://github.com/isaacs/minizlib#readme", - "keywords": [ - "zlib", - "gzip", - "gunzip", - "deflate", - "inflate", - "compression", - "zip", - "unzip" - ], - "license": "MIT", - "main": "index.js", - "name": "minizlib", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/minizlib.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js --100 -J" - }, - "version": "1.3.3" -} diff --git a/node_modules/mkdirp/LICENSE b/node_modules/mkdirp/LICENSE deleted file mode 100644 index 432d1ae..0000000 --- a/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/mkdirp/bin/cmd.js b/node_modules/mkdirp/bin/cmd.js deleted file mode 100755 index d95de15..0000000 --- a/node_modules/mkdirp/bin/cmd.js +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env node - -var mkdirp = require('../'); -var minimist = require('minimist'); -var fs = require('fs'); - -var argv = minimist(process.argv.slice(2), { - alias: { m: 'mode', h: 'help' }, - string: [ 'mode' ] -}); -if (argv.help) { - fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout); - return; -} - -var paths = argv._.slice(); -var mode = argv.mode ? parseInt(argv.mode, 8) : undefined; - -(function next () { - if (paths.length === 0) return; - var p = paths.shift(); - - if (mode === undefined) mkdirp(p, cb) - else mkdirp(p, mode, cb) - - function cb (err) { - if (err) { - console.error(err.message); - process.exit(1); - } - else next(); - } -})(); diff --git a/node_modules/mkdirp/bin/usage.txt b/node_modules/mkdirp/bin/usage.txt deleted file mode 100644 index f952aa2..0000000 --- a/node_modules/mkdirp/bin/usage.txt +++ /dev/null @@ -1,12 +0,0 @@ -usage: mkdirp [DIR1,DIR2..] {OPTIONS} - - Create each supplied directory including any necessary parent directories that - don't yet exist. - - If the directory already exists, do nothing. - -OPTIONS are: - - -m, --mode If a directory needs to be created, set the mode as an octal - permission string. - diff --git a/node_modules/mkdirp/index.js b/node_modules/mkdirp/index.js deleted file mode 100644 index 468d7cd..0000000 --- a/node_modules/mkdirp/index.js +++ /dev/null @@ -1,99 +0,0 @@ -var path = require('path'); -var fs = require('fs'); -var _0777 = parseInt('0777', 8); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, opts, f, made) { - if (typeof opts === 'function') { - f = opts; - opts = {}; - } - else if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 - } - if (!made) made = null; - - var cb = f || function () {}; - p = path.resolve(p); - - xfs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - if (path.dirname(p) === p) return cb(er); - mkdirP(path.dirname(p), opts, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, opts, cb, made); - }); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} - -mkdirP.sync = function sync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 - } - if (!made) made = null; - - p = path.resolve(p); - - try { - xfs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), opts, made); - sync(p, opts, made); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = xfs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; diff --git a/node_modules/mkdirp/package.json b/node_modules/mkdirp/package.json deleted file mode 100644 index e072d3f..0000000 --- a/node_modules/mkdirp/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "_from": "mkdirp@^0.5.1", - "_id": "mkdirp@0.5.5", - "_inBundle": false, - "_integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "_location": "/mkdirp", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "mkdirp@^0.5.1", - "name": "mkdirp", - "escapedName": "mkdirp", - "rawSpec": "^0.5.1", - "saveSpec": null, - "fetchSpec": "^0.5.1" - }, - "_requiredBy": [ - "/node-pre-gyp", - "/tar" - ], - "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "_shasum": "d91cefd62d1436ca0f41620e251288d420099def", - "_spec": "mkdirp@^0.5.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/node-pre-gyp", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "bin": { - "mkdirp": "bin/cmd.js" - }, - "bugs": { - "url": "https://github.com/substack/node-mkdirp/issues" - }, - "bundleDependencies": false, - "dependencies": { - "minimist": "^1.2.5" - }, - "deprecated": false, - "description": "Recursively mkdir, like `mkdir -p`", - "devDependencies": { - "mock-fs": "^3.7.0", - "tap": "^5.4.2" - }, - "files": [ - "bin", - "index.js" - ], - "homepage": "https://github.com/substack/node-mkdirp#readme", - "keywords": [ - "mkdir", - "directory" - ], - "license": "MIT", - "main": "index.js", - "name": "mkdirp", - "publishConfig": { - "tag": "legacy" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/substack/node-mkdirp.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "0.5.5" -} diff --git a/node_modules/mkdirp/readme.markdown b/node_modules/mkdirp/readme.markdown deleted file mode 100644 index fc314bf..0000000 --- a/node_modules/mkdirp/readme.markdown +++ /dev/null @@ -1,100 +0,0 @@ -# mkdirp - -Like `mkdir -p`, but in node.js! - -[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) - -# example - -## pow.js - -```js -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); -``` - -Output - -``` -pow! -``` - -And now /tmp/foo/bar/baz exists, huzzah! - -# methods - -```js -var mkdirp = require('mkdirp'); -``` - -## mkdirp(dir, opts, cb) - -Create a new directory and any necessary subdirectories at `dir` with octal -permission string `opts.mode`. If `opts` is a non-object, it will be treated as -the `opts.mode`. - -If `opts.mode` isn't specified, it defaults to `0777`. - -`cb(err, made)` fires with the error or the first directory `made` -that had to be created, if any. - -You can optionally pass in an alternate `fs` implementation by passing in -`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and -`opts.fs.stat(path, cb)`. - -## mkdirp.sync(dir, opts) - -Synchronously create a new directory and any necessary subdirectories at `dir` -with octal permission string `opts.mode`. If `opts` is a non-object, it will be -treated as the `opts.mode`. - -If `opts.mode` isn't specified, it defaults to `0777`. - -Returns the first directory that had to be created, if any. - -You can optionally pass in an alternate `fs` implementation by passing in -`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and -`opts.fs.statSync(path)`. - -# usage - -This package also ships with a `mkdirp` command. - -``` -usage: mkdirp [DIR1,DIR2..] {OPTIONS} - - Create each supplied directory including any necessary parent directories that - don't yet exist. - - If the directory already exists, do nothing. - -OPTIONS are: - - -m, --mode If a directory needs to be created, set the mode as an octal - permission string. - -``` - -# install - -With [npm](http://npmjs.org) do: - -``` -npm install mkdirp -``` - -to get the library, or - -``` -npm install -g mkdirp -``` - -to get the command. - -# license - -MIT diff --git a/node_modules/ms/index.js b/node_modules/ms/index.js deleted file mode 100644 index c4498bc..0000000 --- a/node_modules/ms/index.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var w = d * 7; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isFinite(val)) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - 'val is not a non-empty string or a valid number. val=' + - JSON.stringify(val) - ); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'weeks': - case 'week': - case 'w': - return n * w; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - default: - return undefined; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - return ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); -} diff --git a/node_modules/ms/license.md b/node_modules/ms/license.md deleted file mode 100644 index 69b6125..0000000 --- a/node_modules/ms/license.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Zeit, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/ms/package.json b/node_modules/ms/package.json deleted file mode 100644 index b69ae0e..0000000 --- a/node_modules/ms/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_from": "ms@^2.1.1", - "_id": "ms@2.1.2", - "_inBundle": false, - "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "_location": "/ms", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ms@^2.1.1", - "name": "ms", - "escapedName": "ms", - "rawSpec": "^2.1.1", - "saveSpec": null, - "fetchSpec": "^2.1.1" - }, - "_requiredBy": [ - "/debug" - ], - "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", - "_spec": "ms@^2.1.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/debug", - "bugs": { - "url": "https://github.com/zeit/ms/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Tiny millisecond conversion utility", - "devDependencies": { - "eslint": "4.12.1", - "expect.js": "0.3.1", - "husky": "0.14.3", - "lint-staged": "5.0.0", - "mocha": "4.0.1" - }, - "eslintConfig": { - "extends": "eslint:recommended", - "env": { - "node": true, - "es6": true - } - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/zeit/ms#readme", - "license": "MIT", - "lint-staged": { - "*.js": [ - "npm run lint", - "prettier --single-quote --write", - "git add" - ] - }, - "main": "./index", - "name": "ms", - "repository": { - "type": "git", - "url": "git+https://github.com/zeit/ms.git" - }, - "scripts": { - "lint": "eslint lib/* bin/*", - "precommit": "lint-staged", - "test": "mocha tests.js" - }, - "version": "2.1.2" -} diff --git a/node_modules/ms/readme.md b/node_modules/ms/readme.md deleted file mode 100644 index 9a1996b..0000000 --- a/node_modules/ms/readme.md +++ /dev/null @@ -1,60 +0,0 @@ -# ms - -[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) -[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) - -Use this package to easily convert various time formats to milliseconds. - -## Examples - -```js -ms('2 days') // 172800000 -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2.5 hrs') // 9000000 -ms('2h') // 7200000 -ms('1m') // 60000 -ms('5s') // 5000 -ms('1y') // 31557600000 -ms('100') // 100 -ms('-3 days') // -259200000 -ms('-1h') // -3600000 -ms('-200') // -200 -``` - -### Convert from Milliseconds - -```js -ms(60000) // "1m" -ms(2 * 60000) // "2m" -ms(-3 * 60000) // "-3m" -ms(ms('10 hours')) // "10h" -``` - -### Time Format Written-Out - -```js -ms(60000, { long: true }) // "1 minute" -ms(2 * 60000, { long: true }) // "2 minutes" -ms(-3 * 60000, { long: true }) // "-3 minutes" -ms(ms('10 hours'), { long: true }) // "10 hours" -``` - -## Features - -- Works both in [Node.js](https://nodejs.org) and in the browser -- If a number is supplied to `ms`, a string with a unit is returned -- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) -- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned - -## Related Packages - -- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. - -## Caught a Bug? - -1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device -2. Link the package to the global module directory: `npm link` -3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! - -As always, you can run the tests using: `npm test` diff --git a/node_modules/nan/CHANGELOG.md b/node_modules/nan/CHANGELOG.md deleted file mode 100644 index 44858c7..0000000 --- a/node_modules/nan/CHANGELOG.md +++ /dev/null @@ -1,533 +0,0 @@ -# NAN ChangeLog - -**Version 2.14.1: current Node 14.0.0, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1** - -### 2.14.1 Apr 21 2020 - - - Bugfix: use GetBackingStore() instead of GetContents() (#888) 2c023bd447661a61071da318b0ff4003c3858d39 - -### 2.14.0 May 16 2019 - - - Feature: Add missing methods to Nan::Maybe (#852) 4e962489fb84a184035b9fa74f245f650249aca6 - -### 2.13.2 Mar 24 2019 - - - Bugfix: remove usage of deprecated `IsNearDeath` (#842) fbaf42252af279c3d867c6b193571f9711c39847 - -### 2.13.1 Mar 14 2019 - - - Bugfix: check V8 version directly instead of inferring from NMV (#840) 12f9df9f393285de8fb4a8cd01478dc4fe3b089d - -### 2.13.0 Mar 13 2019 - - - Feature: add support for node master (#831) 113c0282072e7ff4f9dfc98b432fd894b798c2c - -### 2.12.1 Dec 18 2018 - - - Bugfix: Fix build breakage with Node.js 10.0.0-10.9.0. (#833) 625e90e8fef8d39ffa7247250a76a100b2487474 - -### 2.12.0 Dec 16 2018 - - - Bugfix: Add scope.Escape() to Call() (#817) 2e5ed4fc3a8ac80a6ef1f2a55099ab3ac8800dc6 - - Bugfix: Fix Node.js v10.12.0 deprecation warnings. 509859cc23b1770376b56550a027840a2ce0f73d - - Feature: Allow SetWeak() for non-object persistent handles. (#824) e6ef6a48e7e671fe3e4b7dddaa8912a3f8262ecd - -### 2.11.1 Sep 29 2018 - - - Fix: adapt to V8 7.0 24a22c3b25eeeec2016c6ec239bdd6169e985447 - -### 2.11.0 Aug 25 2018 - - - Removal: remove `FunctionCallbackInfo::Callee` for nodejs `>= 10` 1a56c0a6efd4fac944cb46c30912a8e023bda7d4 - - Bugfix: Fix `AsyncProgressWorkerBase::WorkProgress` sends invalid data b0c764d1dab11e9f8b37ffb81e2560a4498aad5e - - Feature: Introduce `GetCurrentEventLoop` b4911b0bb1f6d47d860e10ec014d941c51efac5e - - Feature: Add `NAN_MODULE_WORKER_ENABLED` macro as a replacement for `NAN_MODULE` b058fb047d18a58250e66ae831444441c1f2ac7a - -### 2.10.0 Mar 16 2018 - - - Deprecation: Deprecate `MakeCallback` 5e92b19a59e194241d6a658bd6ff7bfbda372950 - - Feature: add `Nan::Call` overload 4482e1242fe124d166fc1a5b2be3c1cc849fe452 - - Feature: add more `Nan::Call` overloads 8584e63e6d04c7d2eb8c4a664e4ef57d70bf672b - - Feature: Fix deprecation warnings for Node 10 1caf258243b0602ed56922bde74f1c91b0cbcb6a - -### 2.9.2 Feb 22 2018 - - - Bugfix: Bandaid for async hooks 212bd2f849be14ef1b02fc85010b053daa24252b - -### 2.9.1 Feb 22 2018 - - - Bugfix: Avoid deprecation warnings in deprecated `Nan::Callback::operator()` 372b14d91289df4604b0f81780709708c45a9aa4 - - Bugfix: Avoid deprecation warnings in `Nan::JSON` 3bc294bce0b7d0a3ee4559926303e5ed4866fda2 - -### 2.9.0 Feb 22 2018 - - - Deprecation: Deprecate legacy `Callback::Call` 6dd5fa690af61ca3523004b433304c581b3ea309 - - Feature: introduce `AsyncResource` class 90c0a179c0d8cb5fd26f1a7d2b1d6231eb402d48o - - Feature: Add context aware `Nan::Callback::Call` functions 7169e09fb088418b6e388222e88b4c13f07ebaee - - Feature: Make `AsyncWorker` context aware 066ba21a6fb9e2b5230c9ed3a6fc51f1211736a4 - - Feature: add `Callback` overload to `Nan::Call` 5328daf66e202658c1dc0d916c3aaba99b3cc606 - - Bugfix: fix warning: suggest parentheses around `&&` within `||` b2bb63d68b8ae623a526b542764e1ac82319cb2c - - Bugfix: Fix compilation on io.js 3 d06114dba0a522fb436f0c5f47b994210968cd7b - -### 2.8.0 Nov 15 2017 - - - Deprecation: Deprecate `Nan::ForceSet` in favor of `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 - - Feature: Add `Nan::AsyncProgressQueueWorker` a976636ecc2ef617d1b061ce4a6edf39923691cb - - Feature: Add `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 - - Bugfix: Fix compiling on io.js 1 & 2 82705a64503ce60c62e98df5bd02972bba090900 - - Bugfix: Use DefineOwnProperty instead of ForceSet 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 - -### 2.7.0 Aug 30 2017 - - - Feature: Add `Nan::To()` overload. b93280670c9f6da42ed4cf6cbf085ffdd87bd65b - - Bugfix: Fix ternary in `Nan::MaybeLocal::FromMaybe()`. 79a26f7d362e756a9524e672a82c3d603b542867 - -### 2.6.2 Apr 12 2017 - - - Bugfix: Fix v8::JSON::Parse() deprecation warning. 87f6a3c65815fa062296a994cc863e2fa124867d - -### 2.6.1 Apr 6 2017 - - - Bugfix: nan_json.h: fix build breakage in Node 6 ac8d47dc3c10bfbf3f15a6b951633120c0ee6d51 - -### 2.6.0 Apr 6 2017 - - - Feature: nan: add support for JSON::Parse & Stringify b533226c629cce70e1932a873bb6f849044a56c5 - -### 2.5.1 Jan 23 2017 - - - Bugfix: Fix disappearing handle for private value 6a80995694f162ef63dbc9948fbefd45d4485aa0 - - Bugfix: Add missing scopes a93b8bae6bc7d32a170db6e89228b7f60ee57112 - - Bugfix: Use string::data instead of string::front in NewOneByteString d5f920371e67e1f3b268295daee6e83af86b6e50 - -### 2.5.0 Dec 21 2016 - - - Feature: Support Private accessors a86255cb357e8ad8ccbf1f6a4a901c921e39a178 - - Bugfix: Abort in delete operators that shouldn't be called 0fe38215ff8581703967dfd26c12793feb960018 - -### 2.4.0 Jul 10 2016 - - - Feature: Rewrite Callback to add Callback::Reset c4cf44d61f8275cd5f7b0c911d7a806d4004f649 - - Feature: AsyncProgressWorker: add template types for .send 1242c9a11a7ed481c8f08ec06316385cacc513d0 - - Bugfix: Add constness to old Persistent comparison operators bd43cb9982c7639605d60fd073efe8cae165d9b2 - -### 2.3.5 May 31 2016 - - - Bugfix: Replace NAN_INLINE with 'inline' keyword. 71819d8725f822990f439479c9aba3b240804909 - -### 2.3.4 May 31 2016 - - - Bugfix: Remove V8 deprecation warnings 0592fb0a47f3a1c7763087ebea8e1138829f24f9 - - Bugfix: Fix new versions not to use WeakCallbackInfo::IsFirstPass 615c19d9e03d4be2049c10db0151edbc3b229246 - - Bugfix: Make ObjectWrap::handle() const d19af99595587fe7a26bd850af6595c2a7145afc - - Bugfix: Fix compilation errors related to 0592fb0a47f3a1c7763087ebea8e1138829f24f9 e9191c525b94f652718325e28610a1adcf90fed8 - -### 2.3.3 May 4 2016 - - - Bugfix: Refactor SetMethod() to deal with v8::Templates (#566) b9083cf6d5de6ebe6bcb49c7502fbb7c0d9ddda8 - -### 2.3.2 Apr 27 2016 - - - Bugfix: Fix compilation on outdated versions due to Handle removal f8b7c875d04d425a41dfd4f3f8345bc3a11e6c52 - -### 2.3.1 Apr 27 2016 - - - Bugfix: Don't use deprecated v8::Template::Set() in SetMethod a90951e9ea70fa1b3836af4b925322919159100e - -### 2.3.0 Apr 27 2016 - - - Feature: added Signal() for invoking async callbacks without sending data from AsyncProgressWorker d8adba45f20e077d00561b20199133620c990b38 - - Bugfix: Don't use deprecated v8::Template::Set() 00dacf0a4b86027415867fa7f1059acc499dcece - -### 2.2.1 Mar 29 2016 - - - Bugfix: Use NewFromUnsigned in ReturnValue::Set(uint32_t i) for pre_12 3a18f9bdce29826e0e4c217854bc476918241a58 - - Performance: Remove unneeeded nullptr checks b715ef44887931c94f0d1605b3b1a4156eebece9 - -### 2.2.0 Jan 9 2016 - - - Feature: Add Function::Call wrapper 4c157474dacf284d125c324177b45aa5dabc08c6 - - Feature: Rename GC*logueCallback to GCCallback for > 4.0 3603435109f981606d300eb88004ca101283acec - - Bugfix: Fix Global::Pass for old versions 367e82a60fbaa52716232cc89db1cc3f685d77d9 - - Bugfix: Remove weird MaybeLocal wrapping of what already is a MaybeLocal 23b4590db10c2ba66aee2338aebe9751c4cb190b - -### 2.1.0 Oct 8 2015 - - - Deprecation: Deprecate NanErrnoException in favor of ErrnoException 0af1ca4cf8b3f0f65ed31bc63a663ab3319da55c - - Feature: added helper class for accessing contents of typedarrays 17b51294c801e534479d5463697a73462d0ca555 - - Feature: [Maybe types] Add MakeMaybe(...) 48d7b53d9702b0c7a060e69ea10fea8fb48d814d - - Feature: new: allow utf16 string with length 66ac6e65c8ab9394ef588adfc59131b3b9d8347b - - Feature: Introduce SetCallHandler and SetCallAsFunctionHandler 7764a9a115d60ba10dc24d86feb0fbc9b4f75537 - - Bugfix: Enable creating Locals from Globals under Node 0.10. 9bf9b8b190821af889790fdc18ace57257e4f9ff - - Bugfix: Fix issue #462 where PropertyCallbackInfo data is not stored safely. 55f50adedd543098526c7b9f4fffd607d3f9861f - -### 2.0.9 Sep 8 2015 - - - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7 - -### 2.0.8 Aug 28 2015 - - - Work around duplicate linking bug in clang 11902da - -### 2.0.7 Aug 26 2015 - - - Build: Repackage - -### 2.0.6 Aug 26 2015 - - - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1 - - Bugfix: Remove unused static std::map instances 525bddc - - Bugfix: Make better use of maybe versions of APIs bfba85b - - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d - -### 2.0.5 Aug 10 2015 - - - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1 - - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d - -### 2.0.4 Aug 6 2015 - - - Build: Repackage - -### 2.0.3 Aug 6 2015 - - - Bugfix: Don't use clang++ / g++ syntax extension. 231450e - -### 2.0.2 Aug 6 2015 - - - Build: Repackage - -### 2.0.1 Aug 6 2015 - - - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687 - - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601 - - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f - - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed - -### 2.0.0 Jul 31 2015 - - - Change: Renamed identifiers with leading underscores b5932b4 - - Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1 - - Change: Replace NanScope and NanEscpableScope macros with classes 47751c4 - - Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99 - - Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5 - - Change: Rename NanNewBuffer to NanCopyBuffer d6af78d - - Change: Remove Nan prefix from all names 72d1f67 - - Change: Update Buffer API for new upstream changes d5d3291 - - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a - - Change: Get rid of Handles e6c0daf - - Feature: Support io.js 3 with V8 4.4 - - Feature: Introduce NanPersistent 7fed696 - - Feature: Introduce NanGlobal 4408da1 - - Feature: Added NanTryCatch 10f1ca4 - - Feature: Update for V8 v4.3 4b6404a - - Feature: Introduce NanNewOneByteString c543d32 - - Feature: Introduce namespace Nan 67ed1b1 - - Removal: Remove NanLocker and NanUnlocker dd6e401 - - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9 - - Removal: Remove NanReturn* macros d90a25c - - Removal: Remove HasInstance e8f84fe - - -### 1.9.0 Jul 31 2015 - - - Feature: Added `NanFatalException` 81d4a2c - - Feature: Added more error types 4265f06 - - Feature: Added dereference and function call operators to NanCallback c4b2ed0 - - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c - - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6 - - Feature: Added NanErrnoException dd87d9e - - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130 - - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c - - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b - -### 1.8.4 Apr 26 2015 - - - Build: Repackage - -### 1.8.3 Apr 26 2015 - - - Bugfix: Include missing header 1af8648 - -### 1.8.2 Apr 23 2015 - - - Build: Repackage - -### 1.8.1 Apr 23 2015 - - - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3 - -### 1.8.0 Apr 23 2015 - - - Feature: Allow primitives with NanReturnValue 2e4475e - - Feature: Added comparison operators to NanCallback 55b075e - - Feature: Backport thread local storage 15bb7fa - - Removal: Remove support for signatures with arguments 8a2069d - - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59 - -### 1.7.0 Feb 28 2015 - - - Feature: Made NanCallback::Call accept optional target 8d54da7 - - Feature: Support atom-shell 0.21 0b7f1bb - -### 1.6.2 Feb 6 2015 - - - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 - -### 1.6.1 Jan 23 2015 - - - Build: version bump - -### 1.5.3 Jan 23 2015 - - - Build: repackage - -### 1.6.0 Jan 23 2015 - - - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af - - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 - - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 - -### 1.5.2 Jan 23 2015 - - - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 - - Bugfix: Readded missing String constructors 18d828f - - Bugfix: Add overload handling NanNew(..) 5ef813b - - Bugfix: Fix uv_work_cb versioning 997e4ae - - Bugfix: Add function factory and test 4eca89c - - Bugfix: Add object template factory and test cdcb951 - - Correctness: Lifted an io.js related typedef c9490be - - Correctness: Make explicit downcasts of String lengths 00074e6 - - Windows: Limit the scope of disabled warning C4530 83d7deb - -### 1.5.1 Jan 15 2015 - - - Build: version bump - -### 1.4.3 Jan 15 2015 - - - Build: version bump - -### 1.4.2 Jan 15 2015 - - - Feature: Support io.js 0dbc5e8 - -### 1.5.0 Jan 14 2015 - - - Feature: Support io.js b003843 - - Correctness: Improved NanNew internals 9cd4f6a - - Feature: Implement progress to NanAsyncWorker 8d6a160 - -### 1.4.1 Nov 8 2014 - - - Bugfix: Handle DEBUG definition correctly - - Bugfix: Accept int as Boolean - -### 1.4.0 Nov 1 2014 - - - Feature: Added NAN_GC_CALLBACK 6a5c245 - - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 - - Correctness: Added constness to references in NanHasInstance 02c61cd - - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 - - Windoze: Shut Visual Studio up when compiling 8d558c1 - - License: Switch to plain MIT from custom hacked MIT license 11de983 - - Build: Added test target to Makefile e232e46 - - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 - - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 - - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 - -### 1.3.0 Aug 2 2014 - - - Added NanNew(std::string) - - Added NanNew(std::string&) - - Added NanAsciiString helper class - - Added NanUtf8String helper class - - Added NanUcs2String helper class - - Deprecated NanRawString() - - Deprecated NanCString() - - Added NanGetIsolateData(v8::Isolate *isolate) - - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) - - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) - - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - -### 1.2.0 Jun 5 2014 - - - Add NanSetPrototypeTemplate - - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, - introduced _NanWeakCallbackDispatcher - - Removed -Wno-unused-local-typedefs from test builds - - Made test builds Windows compatible ('Sleep()') - -### 1.1.2 May 28 2014 - - - Release to fix more stuff-ups in 1.1.1 - -### 1.1.1 May 28 2014 - - - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 - -### 1.1.0 May 25 2014 - - - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead - - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), - (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, - v8::String::ExternalAsciiStringResource* - - Deprecate NanSymbol() - - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker - -### 1.0.0 May 4 2014 - - - Heavy API changes for V8 3.25 / Node 0.11.13 - - Use cpplint.py - - Removed NanInitPersistent - - Removed NanPersistentToLocal - - Removed NanFromV8String - - Removed NanMakeWeak - - Removed NanNewLocal - - Removed NAN_WEAK_CALLBACK_OBJECT - - Removed NAN_WEAK_CALLBACK_DATA - - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions - - Introduce NanUndefined, NanNull, NanTrue and NanFalse - - Introduce NanEscapableScope and NanEscapeScope - - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) - - Introduce NanMakeCallback for node::MakeCallback - - Introduce NanSetTemplate - - Introduce NanGetCurrentContext - - Introduce NanCompileScript and NanRunScript - - Introduce NanAdjustExternalMemory - - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback - - Introduce NanGetHeapStatistics - - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() - -### 0.8.0 Jan 9 2014 - - - NanDispose -> NanDisposePersistent, deprecate NanDispose - - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() - -### 0.7.1 Jan 9 2014 - - - Fixes to work against debug builds of Node - - Safer NanPersistentToLocal (avoid reinterpret_cast) - - Speed up common NanRawString case by only extracting flattened string when necessary - -### 0.7.0 Dec 17 2013 - - - New no-arg form of NanCallback() constructor. - - NanCallback#Call takes Handle rather than Local - - Removed deprecated NanCallback#Run method, use NanCallback#Call instead - - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS - - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() - - Introduce NanRawString() for char* (or appropriate void*) from v8::String - (replacement for NanFromV8String) - - Introduce NanCString() for null-terminated char* from v8::String - -### 0.6.0 Nov 21 2013 - - - Introduce NanNewLocal(v8::Handle value) for use in place of - v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 - -### 0.5.2 Nov 16 2013 - - - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public - -### 0.5.1 Nov 12 2013 - - - Use node::MakeCallback() instead of direct v8::Function::Call() - -### 0.5.0 Nov 11 2013 - - - Added @TooTallNate as collaborator - - New, much simpler, "include_dirs" for binding.gyp - - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros - -### 0.4.4 Nov 2 2013 - - - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ - -### 0.4.3 Nov 2 2013 - - - Include node_object_wrap.h, removed from node.h for Node 0.11.8. - -### 0.4.2 Nov 2 2013 - - - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for - Node 0.11.8 release. - -### 0.4.1 Sep 16 2013 - - - Added explicit `#include ` as it was removed from node.h for v0.11.8 - -### 0.4.0 Sep 2 2013 - - - Added NAN_INLINE and NAN_DEPRECATED and made use of them - - Added NanError, NanTypeError and NanRangeError - - Cleaned up code - -### 0.3.2 Aug 30 2013 - - - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent - in NanAsyncWorker - -### 0.3.1 Aug 20 2013 - - - fix "not all control paths return a value" compile warning on some platforms - -### 0.3.0 Aug 19 2013 - - - Made NAN work with NPM - - Lots of fixes to NanFromV8String, pulling in features from new Node core - - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API - - Added optional error number argument for NanThrowError() - - Added NanInitPersistent() - - Added NanReturnNull() and NanReturnEmptyString() - - Added NanLocker and NanUnlocker - - Added missing scopes - - Made sure to clear disposed Persistent handles - - Changed NanAsyncWorker to allocate error messages on the heap - - Changed NanThrowError(Local) to NanThrowError(Handle) - - Fixed leak in NanAsyncWorker when errmsg is used - -### 0.2.2 Aug 5 2013 - - - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() - -### 0.2.1 Aug 5 2013 - - - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for - NanFromV8String() - -### 0.2.0 Aug 5 2013 - - - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, - NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY - - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, - _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, - _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, - _NAN_PROPERTY_QUERY_ARGS - - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer - - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, - NAN_WEAK_CALLBACK_DATA, NanMakeWeak - - Renamed THROW_ERROR to _NAN_THROW_ERROR - - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) - - Added NanBufferUse(char*, uint32_t) - - Added NanNewContextHandle(v8::ExtensionConfiguration*, - v8::Handle, v8::Handle) - - Fixed broken NanCallback#GetFunction() - - Added optional encoding and size arguments to NanFromV8String() - - Added NanGetPointerSafe() and NanSetPointerSafe() - - Added initial test suite (to be expanded) - - Allow NanUInt32OptionValue to convert any Number object - -### 0.1.0 Jul 21 2013 - - - Added `NAN_GETTER`, `NAN_SETTER` - - Added `NanThrowError` with single Local argument - - Added `NanNewBufferHandle` with single uint32_t argument - - Added `NanHasInstance(Persistent&, Handle)` - - Added `Local NanCallback#GetFunction()` - - Added `NanCallback#Call(int, Local[])` - - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/nan/LICENSE.md b/node_modules/nan/LICENSE.md deleted file mode 100644 index dddd13d..0000000 --- a/node_modules/nan/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright (c) 2018 NAN contributors ------------------------------------ - -*NAN contributors listed at * - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/nan/README.md b/node_modules/nan/README.md deleted file mode 100644 index 9b5f38a..0000000 --- a/node_modules/nan/README.md +++ /dev/null @@ -1,455 +0,0 @@ -Native Abstractions for Node.js -=============================== - -**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 and 14.** - -***Current version: 2.14.1*** - -*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)* - -[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/) - -[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](https://travis-ci.org/nodejs/nan) -[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan) - -Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle. - -This project also contains some helper utilities that make addon development a bit more pleasant. - - * **[News & Updates](#news)** - * **[Usage](#usage)** - * **[Example](#example)** - * **[API](#api)** - * **[Tests](#tests)** - * **[Known issues](#issues)** - * **[Governance & Contributing](#governance)** - - - -## News & Updates - - - -## Usage - -Simply add **NAN** as a dependency in the *package.json* of your Node addon: - -``` bash -$ npm install --save nan -``` - -Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include ` in your *.cpp* files: - -``` python -"include_dirs" : [ - "` when compiling your addon. - - - -## Example - -Just getting started with Nan? Take a look at the **[Node Add-on Examples](https://github.com/nodejs/node-addon-examples)**. - -Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality. - -For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**. - -Yet another example is **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon. - -Also take a look at our comprehensive **[C++ test suite](https://github.com/nodejs/nan/tree/master/test/cpp)** which has a plethora of code snippets for your pasting pleasure. - - - -## API - -Additional to the NAN documentation below, please consult: - -* [The V8 Getting Started * Guide](https://v8.dev/docs/embed) -* [V8 API Documentation](https://v8docs.nodesource.com/) -* [Node Add-on Documentation](https://nodejs.org/api/addons.html) - - - -### JavaScript-accessible methods - -A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. - -In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. - -* **Method argument types** - - Nan::FunctionCallbackInfo - - Nan::PropertyCallbackInfo - - Nan::ReturnValue -* **Method declarations** - - Method declaration - - Getter declaration - - Setter declaration - - Property getter declaration - - Property setter declaration - - Property enumerator declaration - - Property deleter declaration - - Property query declaration - - Index getter declaration - - Index setter declaration - - Index enumerator declaration - - Index deleter declaration - - Index query declaration -* Method and template helpers - - Nan::SetMethod() - - Nan::SetPrototypeMethod() - - Nan::SetAccessor() - - Nan::SetNamedPropertyHandler() - - Nan::SetIndexedPropertyHandler() - - Nan::SetTemplate() - - Nan::SetPrototypeTemplate() - - Nan::SetInstanceTemplate() - - Nan::SetCallHandler() - - Nan::SetCallAsFunctionHandler() - -### Scopes - -A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. - -A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. - -The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. - - - Nan::HandleScope - - Nan::EscapableHandleScope - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). - -### Persistent references - -An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. - -Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. - - - Nan::PersistentBase & v8::PersistentBase - - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - - Nan::Persistent - - Nan::Global - - Nan::WeakCallbackInfo - - Nan::WeakCallbackType - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - -### New - -NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. - - - Nan::New() - - Nan::Undefined() - - Nan::Null() - - Nan::True() - - Nan::False() - - Nan::EmptyString() - - -### Converters - -NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. - - - Nan::To() - -### Maybe Types - -The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. - -* **Maybe Types** - - Nan::MaybeLocal - - Nan::Maybe - - Nan::Nothing - - Nan::Just -* **Maybe Helpers** - - Nan::Call() - - Nan::ToDetailString() - - Nan::ToArrayIndex() - - Nan::Equals() - - Nan::NewInstance() - - Nan::GetFunction() - - Nan::Set() - - Nan::DefineOwnProperty() - - Nan::ForceSet() - - Nan::Get() - - Nan::GetPropertyAttributes() - - Nan::Has() - - Nan::Delete() - - Nan::GetPropertyNames() - - Nan::GetOwnPropertyNames() - - Nan::SetPrototype() - - Nan::ObjectProtoToString() - - Nan::HasOwnProperty() - - Nan::HasRealNamedProperty() - - Nan::HasRealIndexedProperty() - - Nan::HasRealNamedCallbackProperty() - - Nan::GetRealNamedPropertyInPrototypeChain() - - Nan::GetRealNamedProperty() - - Nan::CallAsFunction() - - Nan::CallAsConstructor() - - Nan::GetSourceLine() - - Nan::GetLineNumber() - - Nan::GetStartColumn() - - Nan::GetEndColumn() - - Nan::CloneElementAt() - - Nan::HasPrivate() - - Nan::GetPrivate() - - Nan::SetPrivate() - - Nan::DeletePrivate() - - Nan::MakeMaybe() - -### Script - -NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. - - - Nan::CompileScript() - - Nan::RunScript() - - -### JSON - -The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. - - - Nan::JSON.Parse - - Nan::JSON.Stringify - -Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. - -### Errors - -NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. - - - Nan::Error() - - Nan::RangeError() - - Nan::ReferenceError() - - Nan::SyntaxError() - - Nan::TypeError() - - Nan::ThrowError() - - Nan::ThrowRangeError() - - Nan::ThrowReferenceError() - - Nan::ThrowSyntaxError() - - Nan::ThrowTypeError() - - Nan::FatalException() - - Nan::ErrnoException() - - Nan::TryCatch - - -### Buffers - -NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. - - - Nan::NewBuffer() - - Nan::CopyBuffer() - - Nan::FreeCallback() - -### Nan::Callback - -`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. - - - Nan::Callback - -### Asynchronous work helpers - -`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. - - - Nan::AsyncWorker - - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker - - Nan::AsyncProgressQueueWorker - - Nan::AsyncQueueWorker - -### Strings & Bytes - -Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. - - - Nan::Encoding - - Nan::Encode() - - Nan::DecodeBytes() - - Nan::DecodeWrite() - - -### Object Wrappers - -The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. - - - Nan::ObjectWrap - - -### V8 internals - -The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. - - - NAN_GC_CALLBACK() - - Nan::AddGCEpilogueCallback() - - Nan::RemoveGCEpilogueCallback() - - Nan::AddGCPrologueCallback() - - Nan::RemoveGCPrologueCallback() - - Nan::GetHeapStatistics() - - Nan::SetCounterFunction() - - Nan::SetCreateHistogramFunction() - - Nan::SetAddHistogramSampleFunction() - - Nan::IdleNotification() - - Nan::LowMemoryNotification() - - Nan::ContextDisposedNotification() - - Nan::GetInternalFieldPointer() - - Nan::SetInternalFieldPointer() - - Nan::AdjustExternalMemory() - - -### Miscellaneous V8 Helpers - - - Nan::Utf8String - - Nan::GetCurrentContext() - - Nan::SetIsolateData() - - Nan::GetIsolateData() - - Nan::TypedArrayContents - - -### Miscellaneous Node Helpers - - - Nan::AsyncResource - - Nan::MakeCallback() - - NAN_MODULE_INIT() - - Nan::Export() - - - - - - -### Tests - -To run the NAN tests do: - -``` sh -npm install -npm run-script rebuild-tests -npm test -``` - -Or just: - -``` sh -npm install -make test -``` - - - -## Known issues - -### Compiling against Node.js 0.12 on OSX - -With new enough compilers available on OSX, the versions of V8 headers corresponding to Node.js 0.12 -do not compile anymore. The error looks something like: - -``` -❯ CXX(target) Release/obj.target/accessors/cpp/accessors.o -In file included from ../cpp/accessors.cpp:9: -In file included from ../../nan.h:51: -In file included from /Users/ofrobots/.node-gyp/0.12.18/include/node/node.h:61: -/Users/ofrobots/.node-gyp/0.12.18/include/node/v8.h:5800:54: error: 'CreateHandle' is a protected member of 'v8::HandleScope' - return Handle(reinterpret_cast(HandleScope::CreateHandle( - ~~~~~~~~~~~~~^~~~~~~~~~~~ -``` - -This can be worked around by patching your local versions of v8.h corresponding to Node 0.12 to make -`v8::Handle` a friend of `v8::HandleScope`. Since neither Node.js not V8 support this release line anymore -this patch cannot be released by either project in an official release. - -For this reason, we do not test against Node.js 0.12 on OSX in this project's CI. If you need to support -that configuration, you will need to either get an older compiler, or apply a source patch to the version -of V8 headers as a workaround. - - - -## Governance & Contributing - -NAN is governed by the [Node.js Addon API Working Group](https://github.com/nodejs/CTC/blob/master/WORKING_GROUPS.md#addon-api) - -### Addon API Working Group (WG) - -The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project. - -Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other Node.js projects. - -The WG has final authority over this project including: - -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Maintaining the list of additional Collaborators - -For the current list of WG members, see the project [README.md](./README.md#collaborators). - -Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote. - -_Note:_ If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly. - -For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators). - -### Consensus Seeking Process - -The WG follows a [Consensus Seeking](https://en.wikipedia.org/wiki/Consensus-seeking_decision-making) decision making model. - -Modifications of the contents of the NAN repository are made on a collaborative basis. Anybody with a GitHub account may propose a modification via pull request and it will be considered by the WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification. - -If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins. - - - -## Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -* (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -* (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -* (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -* (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - - - -### WG Members / Collaborators - - - - - - - - - - -
Rod VaggGitHub/rvaggTwitter/@rvagg
Benjamin ByholmGitHub/kkoopa-
Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
Nathan RajlichGitHub/TooTallNateTwitter/@TooTallNate
Brett LawsonGitHub/brett19Twitter/@brett19x
Ben NoordhuisGitHub/bnoordhuisTwitter/@bnoordhuis
David SiegelGitHub/agnatTwitter/@agnat
Michael Ira KrufkyGitHub/mkrufkyTwitter/@mkrufky
- -## Licence & copyright - -Copyright (c) 2018 NAN WG Members / Collaborators (listed above). - -Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/node_modules/nan/doc/asyncworker.md b/node_modules/nan/doc/asyncworker.md deleted file mode 100644 index 04231f8..0000000 --- a/node_modules/nan/doc/asyncworker.md +++ /dev/null @@ -1,146 +0,0 @@ -## Asynchronous work helpers - -`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. - - - Nan::AsyncWorker - - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker - - Nan::AsyncProgressQueueWorker - - Nan::AsyncQueueWorker - - -### Nan::AsyncWorker - -`Nan::AsyncWorker` is an _abstract_ class that you can subclass to have much of the annoying asynchronous queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the asynchronous work is in progress. - -This class internally handles the details of creating an [`AsyncResource`][AsyncResource], and running the callback in the -correct async context. To be able to identify the async resources created by this class in async-hooks, provide a -`resource_name` to the constructor. It is recommended that the module name be used as a prefix to the `resource_name` to avoid -collisions in the names. For more details see [`AsyncResource`][AsyncResource] documentation. The `resource_name` needs to stay valid for the lifetime of the worker instance. - -Definition: - -```c++ -class AsyncWorker { - public: - explicit AsyncWorker(Callback *callback_, const char* resource_name = "nan:AsyncWorker"); - - virtual ~AsyncWorker(); - - virtual void WorkComplete(); - - void SaveToPersistent(const char *key, const v8::Local &value); - - void SaveToPersistent(const v8::Local &key, - const v8::Local &value); - - void SaveToPersistent(uint32_t index, - const v8::Local &value); - - v8::Local GetFromPersistent(const char *key) const; - - v8::Local GetFromPersistent(const v8::Local &key) const; - - v8::Local GetFromPersistent(uint32_t index) const; - - virtual void Execute() = 0; - - uv_work_t request; - - virtual void Destroy(); - - protected: - Persistent persistentHandle; - - Callback *callback; - - virtual void HandleOKCallback(); - - virtual void HandleErrorCallback(); - - void SetErrorMessage(const char *msg); - - const char* ErrorMessage(); -}; -``` - - -### Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker - -`Nan::AsyncProgressWorkerBase` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. - -Previously the definition of `Nan::AsyncProgressWorker` only allowed sending `const char` data. Now extending `Nan::AsyncProgressWorker` will yield an instance of the implicit `Nan::AsyncProgressWorkerBase` template with type `` for compatibility. - -`Nan::AsyncProgressWorkerBase` & `Nan::AsyncProgressWorker` is intended for best-effort delivery of nonessential progress messages, e.g. a progress bar. The last event sent before the main thread is woken will be delivered. - -Definition: - -```c++ -template -class AsyncProgressWorkerBase : public AsyncWorker { - public: - explicit AsyncProgressWorkerBase(Callback *callback_, const char* resource_name = ...); - - virtual ~AsyncProgressWorkerBase(); - - void WorkProgress(); - - class ExecutionProgress { - public: - void Signal() const; - void Send(const T* data, size_t count) const; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - - virtual void HandleProgressCallback(const T *data, size_t count) = 0; - - virtual void Destroy(); -}; - -typedef AsyncProgressWorkerBase AsyncProgressWorker; -``` - - -### Nan::AsyncProgressQueueWorker - -`Nan::AsyncProgressQueueWorker` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. - -`Nan::AsyncProgressQueueWorker` behaves exactly the same as `Nan::AsyncProgressWorker`, except all events are queued and delivered to the main thread. - -Definition: - -```c++ -template -class AsyncProgressQueueWorker : public AsyncWorker { - public: - explicit AsyncProgressQueueWorker(Callback *callback_, const char* resource_name = "nan:AsyncProgressQueueWorker"); - - virtual ~AsyncProgressQueueWorker(); - - void WorkProgress(); - - class ExecutionProgress { - public: - void Send(const T* data, size_t count) const; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - - virtual void HandleProgressCallback(const T *data, size_t count) = 0; - - virtual void Destroy(); -}; -``` - - -### Nan::AsyncQueueWorker - -`Nan::AsyncQueueWorker` will run a `Nan::AsyncWorker` asynchronously via libuv. Both the `execute` and `after_work` steps are taken care of for you. Most of the logic for this is embedded in `Nan::AsyncWorker`. - -Definition: - -```c++ -void AsyncQueueWorker(AsyncWorker *); -``` - -[AsyncResource]: node_misc.md#api_nan_asyncresource diff --git a/node_modules/nan/doc/buffers.md b/node_modules/nan/doc/buffers.md deleted file mode 100644 index 8d8d25c..0000000 --- a/node_modules/nan/doc/buffers.md +++ /dev/null @@ -1,54 +0,0 @@ -## Buffers - -NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. - - - Nan::NewBuffer() - - Nan::CopyBuffer() - - Nan::FreeCallback() - - -### Nan::NewBuffer() - -Allocate a new `node::Buffer` object with the specified size and optional data. Calls `node::Buffer::New()`. - -Note that when creating a `Buffer` using `Nan::NewBuffer()` and an existing `char*`, it is assumed that the ownership of the pointer is being transferred to the new `Buffer` for management. -When a `node::Buffer` instance is garbage collected and a `FreeCallback` has not been specified, `data` will be disposed of via a call to `free()`. -You _must not_ free the memory space manually once you have created a `Buffer` in this way. - -Signature: - -```c++ -Nan::MaybeLocal Nan::NewBuffer(uint32_t size) -Nan::MaybeLocal Nan::NewBuffer(char* data, uint32_t size) -Nan::MaybeLocal Nan::NewBuffer(char *data, - size_t length, - Nan::FreeCallback callback, - void *hint) -``` - - - -### Nan::CopyBuffer() - -Similar to [`Nan::NewBuffer()`](#api_nan_new_buffer) except that an implicit memcpy will occur within Node. Calls `node::Buffer::Copy()`. - -Management of the `char*` is left to the user, you should manually free the memory space if necessary as the new `Buffer` will have its own copy. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CopyBuffer(const char *data, uint32_t size) -``` - - - -### Nan::FreeCallback() - -A free callback that can be provided to [`Nan::NewBuffer()`](#api_nan_new_buffer). -The supplied callback will be invoked when the `Buffer` undergoes garbage collection. - -Signature: - -```c++ -typedef void (*FreeCallback)(char *data, void *hint); -``` diff --git a/node_modules/nan/doc/callback.md b/node_modules/nan/doc/callback.md deleted file mode 100644 index f7af0bf..0000000 --- a/node_modules/nan/doc/callback.md +++ /dev/null @@ -1,76 +0,0 @@ -## Nan::Callback - -`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. - - - Nan::Callback - - -### Nan::Callback - -```c++ -class Callback { - public: - Callback(); - - explicit Callback(const v8::Local &fn); - - ~Callback(); - - bool operator==(const Callback &other) const; - - bool operator!=(const Callback &other) const; - - v8::Local operator*() const; - - MaybeLocal operator()(AsyncResource* async_resource, - v8::Local target, - int argc = 0, - v8::Local argv[] = 0) const; - - MaybeLocal operator()(AsyncResource* async_resource, - int argc = 0, - v8::Local argv[] = 0) const; - - void SetFunction(const v8::Local &fn); - - v8::Local GetFunction() const; - - bool IsEmpty() const; - - void Reset(const v8::Local &fn); - - void Reset(); - - MaybeLocal Call(v8::Local target, - int argc, - v8::Local argv[], - AsyncResource* async_resource) const; - MaybeLocal Call(int argc, - v8::Local argv[], - AsyncResource* async_resource) const; - - // Deprecated versions. Use the versions that accept an async_resource instead - // as they run the callback in the correct async context as specified by the - // resource. If you want to call a synchronous JS function (i.e. on a - // non-empty JS stack), you can use Nan::Call instead. - v8::Local operator()(v8::Local target, - int argc = 0, - v8::Local argv[] = 0) const; - - v8::Local operator()(int argc = 0, - v8::Local argv[] = 0) const; - v8::Local Call(v8::Local target, - int argc, - v8::Local argv[]) const; - - v8::Local Call(int argc, v8::Local argv[]) const; -}; -``` - -Example usage: - -```c++ -v8::Local function; -Nan::Callback callback(function); -callback.Call(0, 0); -``` diff --git a/node_modules/nan/doc/converters.md b/node_modules/nan/doc/converters.md deleted file mode 100644 index d20861b..0000000 --- a/node_modules/nan/doc/converters.md +++ /dev/null @@ -1,41 +0,0 @@ -## Converters - -NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. - - - Nan::To() - - -### Nan::To() - -Converts a `v8::Local` to a different subtype of `v8::Value` or to a native data type. Returns a `Nan::MaybeLocal<>` or a `Nan::Maybe<>` accordingly. - -See [maybe_types.md](./maybe_types.md) for more information on `Nan::Maybe` types. - -Signatures: - -```c++ -// V8 types -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); - -// Native types -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -``` - -### Example - -```c++ -v8::Local val; -Nan::MaybeLocal str = Nan::To(val); -Nan::Maybe d = Nan::To(val); -``` - diff --git a/node_modules/nan/doc/errors.md b/node_modules/nan/doc/errors.md deleted file mode 100644 index 843435b..0000000 --- a/node_modules/nan/doc/errors.md +++ /dev/null @@ -1,226 +0,0 @@ -## Errors - -NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. - - - Nan::Error() - - Nan::RangeError() - - Nan::ReferenceError() - - Nan::SyntaxError() - - Nan::TypeError() - - Nan::ThrowError() - - Nan::ThrowRangeError() - - Nan::ThrowReferenceError() - - Nan::ThrowSyntaxError() - - Nan::ThrowTypeError() - - Nan::FatalException() - - Nan::ErrnoException() - - Nan::TryCatch - - - -### Nan::Error() - -Create a new Error object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::Error(const char *msg); -v8::Local Nan::Error(v8::Local msg); -``` - - - -### Nan::RangeError() - -Create a new RangeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an RangeError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::RangeError(const char *msg); -v8::Local Nan::RangeError(v8::Local msg); -``` - - - -### Nan::ReferenceError() - -Create a new ReferenceError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an ReferenceError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::ReferenceError(const char *msg); -v8::Local Nan::ReferenceError(v8::Local msg); -``` - - - -### Nan::SyntaxError() - -Create a new SyntaxError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an SyntaxError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::SyntaxError(const char *msg); -v8::Local Nan::SyntaxError(v8::Local msg); -``` - - - -### Nan::TypeError() - -Create a new TypeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an TypeError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::TypeError(const char *msg); -v8::Local Nan::TypeError(v8::Local msg); -``` - - - -### Nan::ThrowError() - -Throw an Error object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new Error object will be created. - -Signature: - -```c++ -void Nan::ThrowError(const char *msg); -void Nan::ThrowError(v8::Local msg); -void Nan::ThrowError(v8::Local error); -``` - - - -### Nan::ThrowRangeError() - -Throw an RangeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new RangeError object will be created. - -Signature: - -```c++ -void Nan::ThrowRangeError(const char *msg); -void Nan::ThrowRangeError(v8::Local msg); -void Nan::ThrowRangeError(v8::Local error); -``` - - - -### Nan::ThrowReferenceError() - -Throw an ReferenceError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new ReferenceError object will be created. - -Signature: - -```c++ -void Nan::ThrowReferenceError(const char *msg); -void Nan::ThrowReferenceError(v8::Local msg); -void Nan::ThrowReferenceError(v8::Local error); -``` - - - -### Nan::ThrowSyntaxError() - -Throw an SyntaxError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new SyntaxError object will be created. - -Signature: - -```c++ -void Nan::ThrowSyntaxError(const char *msg); -void Nan::ThrowSyntaxError(v8::Local msg); -void Nan::ThrowSyntaxError(v8::Local error); -``` - - - -### Nan::ThrowTypeError() - -Throw an TypeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new TypeError object will be created. - -Signature: - -```c++ -void Nan::ThrowTypeError(const char *msg); -void Nan::ThrowTypeError(v8::Local msg); -void Nan::ThrowTypeError(v8::Local error); -``` - - -### Nan::FatalException() - -Replaces `node::FatalException()` which has a different API across supported versions of Node. For use with [`Nan::TryCatch`](#api_nan_try_catch). - -Signature: - -```c++ -void Nan::FatalException(const Nan::TryCatch& try_catch); -``` - - -### Nan::ErrnoException() - -Replaces `node::ErrnoException()` which has a different API across supported versions of Node. - -Signature: - -```c++ -v8::Local Nan::ErrnoException(int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL); -``` - - - -### Nan::TryCatch - -A simple wrapper around [`v8::TryCatch`](https://v8docs.nodesource.com/node-8.16/d4/dc6/classv8_1_1_try_catch.html) compatible with all supported versions of V8. Can be used as a direct replacement in most cases. See also [`Nan::FatalException()`](#api_nan_fatal_exception) for an internal use compatible with `node::FatalException`. - -Signature: - -```c++ -class Nan::TryCatch { - public: - Nan::TryCatch(); - - bool HasCaught() const; - - bool CanContinue() const; - - v8::Local ReThrow(); - - v8::Local Exception() const; - - // Nan::MaybeLocal for older versions of V8 - v8::MaybeLocal StackTrace() const; - - v8::Local Message() const; - - void Reset(); - - void SetVerbose(bool value); - - void SetCaptureMessage(bool value); -}; -``` - diff --git a/node_modules/nan/doc/json.md b/node_modules/nan/doc/json.md deleted file mode 100644 index d142597..0000000 --- a/node_modules/nan/doc/json.md +++ /dev/null @@ -1,62 +0,0 @@ -## JSON - -The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. - - - Nan::JSON.Parse - - Nan::JSON.Stringify - -Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. - - - -### Nan::JSON.Parse - -A simple wrapper around [`v8::JSON::Parse`](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html#a936310d2540fb630ed37d3ee3ffe4504). - -Definition: - -```c++ -Nan::MaybeLocal Nan::JSON::Parse(v8::Local json_string); -``` - -Use `JSON.Parse(json_string)` to parse a string into a `v8::Value`. - -Example: - -```c++ -v8::Local json_string = Nan::New("{ \"JSON\": \"object\" }").ToLocalChecked(); - -Nan::JSON NanJSON; -Nan::MaybeLocal result = NanJSON.Parse(json_string); -if (!result.IsEmpty()) { - v8::Local val = result.ToLocalChecked(); -} -``` - - - -### Nan::JSON.Stringify - -A simple wrapper around [`v8::JSON::Stringify`](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html#a44b255c3531489ce43f6110209138860). - -Definition: - -```c++ -Nan::MaybeLocal Nan::JSON::Stringify(v8::Local json_object, v8::Local gap = v8::Local()); -``` - -Use `JSON.Stringify(value)` to stringify a `v8::Object`. - -Example: - -```c++ -// using `v8::Local val` from the `JSON::Parse` example -v8::Local obj = Nan::To(val).ToLocalChecked(); - -Nan::JSON NanJSON; -Nan::MaybeLocal result = NanJSON.Stringify(obj); -if (!result.IsEmpty()) { - v8::Local stringified = result.ToLocalChecked(); -} -``` - diff --git a/node_modules/nan/doc/maybe_types.md b/node_modules/nan/doc/maybe_types.md deleted file mode 100644 index 142851a..0000000 --- a/node_modules/nan/doc/maybe_types.md +++ /dev/null @@ -1,583 +0,0 @@ -## Maybe Types - -The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. - -* **Maybe Types** - - Nan::MaybeLocal - - Nan::Maybe - - Nan::Nothing - - Nan::Just -* **Maybe Helpers** - - Nan::Call() - - Nan::ToDetailString() - - Nan::ToArrayIndex() - - Nan::Equals() - - Nan::NewInstance() - - Nan::GetFunction() - - Nan::Set() - - Nan::DefineOwnProperty() - - Nan::ForceSet() - - Nan::Get() - - Nan::GetPropertyAttributes() - - Nan::Has() - - Nan::Delete() - - Nan::GetPropertyNames() - - Nan::GetOwnPropertyNames() - - Nan::SetPrototype() - - Nan::ObjectProtoToString() - - Nan::HasOwnProperty() - - Nan::HasRealNamedProperty() - - Nan::HasRealIndexedProperty() - - Nan::HasRealNamedCallbackProperty() - - Nan::GetRealNamedPropertyInPrototypeChain() - - Nan::GetRealNamedProperty() - - Nan::CallAsFunction() - - Nan::CallAsConstructor() - - Nan::GetSourceLine() - - Nan::GetLineNumber() - - Nan::GetStartColumn() - - Nan::GetEndColumn() - - Nan::CloneElementAt() - - Nan::HasPrivate() - - Nan::GetPrivate() - - Nan::SetPrivate() - - Nan::DeletePrivate() - - Nan::MakeMaybe() - - -### Nan::MaybeLocal - -A `Nan::MaybeLocal` is a wrapper around [`v8::Local`](https://v8docs.nodesource.com/node-8.16/de/deb/classv8_1_1_local.html) that enforces a check that determines whether the `v8::Local` is empty before it can be used. - -If an API method returns a `Nan::MaybeLocal`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, an empty `Nan::MaybeLocal` is returned. - -Definition: - -```c++ -template class Nan::MaybeLocal { - public: - MaybeLocal(); - - template MaybeLocal(v8::Local that); - - bool IsEmpty() const; - - template bool ToLocal(v8::Local *out); - - // Will crash if the MaybeLocal<> is empty. - v8::Local ToLocalChecked(); - - template v8::Local FromMaybe(v8::Local default_value) const; -}; -``` - -See the documentation for [`v8::MaybeLocal`](https://v8docs.nodesource.com/node-8.16/d8/d7d/classv8_1_1_maybe_local.html) for further details. - - -### Nan::Maybe - -A simple `Nan::Maybe` type, representing an object which may or may not have a value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html. - -If an API method returns a `Nan::Maybe<>`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, a "Nothing" value is returned. - -Definition: - -```c++ -template class Nan::Maybe { - public: - bool IsNothing() const; - bool IsJust() const; - - // Will crash if the Maybe<> is nothing. - T FromJust(); - - T FromMaybe(const T& default_value); - - bool operator==(const Maybe &other); - - bool operator!=(const Maybe &other); -}; -``` - -See the documentation for [`v8::Maybe`](https://v8docs.nodesource.com/node-8.16/d9/d4b/classv8_1_1_maybe.html) for further details. - - -### Nan::Nothing - -Construct an empty `Nan::Maybe` type representing _nothing_. - -```c++ -template Nan::Maybe Nan::Nothing(); -``` - - -### Nan::Just - -Construct a `Nan::Maybe` type representing _just_ a value. - -```c++ -template Nan::Maybe Nan::Just(const T &t); -``` - - -### Nan::Call() - -A helper method for calling a synchronous [`v8::Function#Call()`](https://v8docs.nodesource.com/node-8.16/d5/d54/classv8_1_1_function.html#a9c3d0e4e13ddd7721fce238aa5b94a11) in a way compatible across supported versions of V8. - -For asynchronous callbacks, use Nan::Callback::Call along with an AsyncResource. - -Signature: - -```c++ -Nan::MaybeLocal Nan::Call(v8::Local fun, v8::Local recv, int argc, v8::Local argv[]); -Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, v8::Local recv, - int argc, v8::Local argv[]); -Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, int argc, v8::Local argv[]); -``` - - - -### Nan::ToDetailString() - -A helper method for calling [`v8::Value#ToDetailString()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#a2f9770296dc2c8d274bc8cc0dca243e5) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::ToDetailString(v8::Local val); -``` - - - -### Nan::ToArrayIndex() - -A helper method for calling [`v8::Value#ToArrayIndex()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#acc5bbef3c805ec458470c0fcd6f13493) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::ToArrayIndex(v8::Local val); -``` - - - -### Nan::Equals() - -A helper method for calling [`v8::Value#Equals()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#a08fba1d776a59bbf6864b25f9152c64b) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Equals(v8::Local a, v8::Local(b)); -``` - - - -### Nan::NewInstance() - -A helper method for calling [`v8::Function#NewInstance()`](https://v8docs.nodesource.com/node-8.16/d5/d54/classv8_1_1_function.html#ae477558b10c14b76ed00e8dbab44ce5b) and [`v8::ObjectTemplate#NewInstance()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#ad605a7543cfbc5dab54cdb0883d14ae4) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::NewInstance(v8::Local h); -Nan::MaybeLocal Nan::NewInstance(v8::Local h, int argc, v8::Local argv[]); -Nan::MaybeLocal Nan::NewInstance(v8::Local h); -``` - - - -### Nan::GetFunction() - -A helper method for calling [`v8::FunctionTemplate#GetFunction()`](https://v8docs.nodesource.com/node-8.16/d8/d83/classv8_1_1_function_template.html#a56d904662a86eca78da37d9bb0ed3705) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetFunction(v8::Local t); -``` - - - -### Nan::Set() - -A helper method for calling [`v8::Object#Set()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a67604ea3734f170c66026064ea808f20) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Set(v8::Local obj, - v8::Local key, - v8::Local value) -Nan::Maybe Nan::Set(v8::Local obj, - uint32_t index, - v8::Local value); -``` - - - -### Nan::DefineOwnProperty() - -A helper method for calling [`v8::Object#DefineOwnProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a6f76b2ed605cb8f9185b92de0033a820) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::DefineOwnProperty(v8::Local obj, - v8::Local key, - v8::Local value, - v8::PropertyAttribute attribs = v8::None); -``` - - - -### Nan::ForceSet() - -Deprecated, use Nan::DefineOwnProperty(). - -A helper method for calling [`v8::Object#ForceSet()`](https://v8docs.nodesource.com/node-0.12/db/d85/classv8_1_1_object.html#acfbdfd7427b516ebdb5c47c4df5ed96c) in a way compatible across supported versions of V8. - -Signature: - -```c++ -NAN_DEPRECATED Nan::Maybe Nan::ForceSet(v8::Local obj, - v8::Local key, - v8::Local value, - v8::PropertyAttribute attribs = v8::None); -``` - - - -### Nan::Get() - -A helper method for calling [`v8::Object#Get()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a2565f03e736694f6b1e1cf22a0b4eac2) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::Get(v8::Local obj, - v8::Local key); -Nan::MaybeLocal Nan::Get(v8::Local obj, uint32_t index); -``` - - - -### Nan::GetPropertyAttributes() - -A helper method for calling [`v8::Object#GetPropertyAttributes()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a9b898894da3d1db2714fd9325a54fe57) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetPropertyAttributes( - v8::Local obj, - v8::Local key); -``` - - - -### Nan::Has() - -A helper method for calling [`v8::Object#Has()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c3d89ea7c2f9afd08965bd7299a41d) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Has(v8::Local obj, v8::Local key); -Nan::Maybe Nan::Has(v8::Local obj, uint32_t index); -``` - - - -### Nan::Delete() - -A helper method for calling [`v8::Object#Delete()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a48e4a19b2cedff867eecc73ddb7d377f) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Delete(v8::Local obj, - v8::Local key); -Nan::Maybe Nan::Delete(v8::Local obj, uint32_t index); -``` - - - -### Nan::GetPropertyNames() - -A helper method for calling [`v8::Object#GetPropertyNames()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#aced885270cfd2c956367b5eedc7fbfe8) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetPropertyNames(v8::Local obj); -``` - - - -### Nan::GetOwnPropertyNames() - -A helper method for calling [`v8::Object#GetOwnPropertyNames()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a79a6e4d66049b9aa648ed4dfdb23e6eb) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetOwnPropertyNames(v8::Local obj); -``` - - - -### Nan::SetPrototype() - -A helper method for calling [`v8::Object#SetPrototype()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a442706b22fceda6e6d1f632122a9a9f4) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::SetPrototype(v8::Local obj, - v8::Local prototype); -``` - - - -### Nan::ObjectProtoToString() - -A helper method for calling [`v8::Object#ObjectProtoToString()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab7a92b4dcf822bef72f6c0ac6fea1f0b) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::ObjectProtoToString(v8::Local obj); -``` - - - -### Nan::HasOwnProperty() - -A helper method for calling [`v8::Object#HasOwnProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab7b7245442ca6de1e1c145ea3fd653ff) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasOwnProperty(v8::Local obj, - v8::Local key); -``` - - - -### Nan::HasRealNamedProperty() - -A helper method for calling [`v8::Object#HasRealNamedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ad8b80a59c9eb3c1e6c3cd6c84571f767) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasRealNamedProperty(v8::Local obj, - v8::Local key); -``` - - - -### Nan::HasRealIndexedProperty() - -A helper method for calling [`v8::Object#HasRealIndexedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af94fc1135a5e74a2193fb72c3a1b9855) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasRealIndexedProperty(v8::Local obj, - uint32_t index); -``` - - - -### Nan::HasRealNamedCallbackProperty() - -A helper method for calling [`v8::Object#HasRealNamedCallbackProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af743b7ea132b89f84d34d164d0668811) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasRealNamedCallbackProperty( - v8::Local obj, - v8::Local key); -``` - - - -### Nan::GetRealNamedPropertyInPrototypeChain() - -A helper method for calling [`v8::Object#GetRealNamedPropertyInPrototypeChain()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a8700b1862e6b4783716964ba4d5e6172) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetRealNamedPropertyInPrototypeChain( - v8::Local obj, - v8::Local key); -``` - - - -### Nan::GetRealNamedProperty() - -A helper method for calling [`v8::Object#GetRealNamedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a84471a824576a5994fdd0ffcbf99ccc0) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetRealNamedProperty(v8::Local obj, - v8::Local key); -``` - - - -### Nan::CallAsFunction() - -A helper method for calling [`v8::Object#CallAsFunction()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ad3ffc36f3dfc3592ce2a96bc047ee2cd) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CallAsFunction(v8::Local obj, - v8::Local recv, - int argc, - v8::Local argv[]); -``` - - - -### Nan::CallAsConstructor() - -A helper method for calling [`v8::Object#CallAsConstructor()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a50d571de50d0b0dfb28795619d07a01b) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CallAsConstructor(v8::Local obj, - int argc, - v8::Local argv[]); -``` - - - -### Nan::GetSourceLine() - -A helper method for calling [`v8::Message#GetSourceLine()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#a849f7a6c41549d83d8159825efccd23a) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetSourceLine(v8::Local msg); -``` - - - -### Nan::GetLineNumber() - -A helper method for calling [`v8::Message#GetLineNumber()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#adbe46c10a88a6565f2732a2d2adf99b9) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetLineNumber(v8::Local msg); -``` - - - -### Nan::GetStartColumn() - -A helper method for calling [`v8::Message#GetStartColumn()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#a60ede616ba3822d712e44c7a74487ba6) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetStartColumn(v8::Local msg); -``` - - - -### Nan::GetEndColumn() - -A helper method for calling [`v8::Message#GetEndColumn()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#aaa004cf19e529da980bc19fcb76d93be) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetEndColumn(v8::Local msg); -``` - - - -### Nan::CloneElementAt() - -A helper method for calling [`v8::Array#CloneElementAt()`](https://v8docs.nodesource.com/node-4.8/d3/d32/classv8_1_1_array.html#a1d3a878d4c1c7cae974dd50a1639245e) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CloneElementAt(v8::Local array, uint32_t index); -``` - - -### Nan::HasPrivate() - -A helper method for calling [`v8::Object#HasPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af68a0b98066cfdeb8f943e98a40ba08d) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasPrivate(v8::Local object, v8::Local key); -``` - - -### Nan::GetPrivate() - -A helper method for calling [`v8::Object#GetPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a169f2da506acbec34deadd9149a1925a) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetPrivate(v8::Local object, v8::Local key); -``` - - -### Nan::SetPrivate() - -A helper method for calling [`v8::Object#SetPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ace1769b0f3b86bfe9fda1010916360ee) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::SetPrivate(v8::Local object, v8::Local key, v8::Local value); -``` - - -### Nan::DeletePrivate() - -A helper method for calling [`v8::Object#DeletePrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a138bb32a304f3982be02ad499693b8fd) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::DeletePrivate(v8::Local object, v8::Local key); -``` - - -### Nan::MakeMaybe() - -Wraps a `v8::Local<>` in a `Nan::MaybeLocal<>`. When called with a `Nan::MaybeLocal<>` it just returns its argument. This is useful in generic template code that builds on NAN. - -Synopsis: - -```c++ - MaybeLocal someNumber = MakeMaybe(New(3.141592654)); - MaybeLocal someString = MakeMaybe(New("probably")); -``` - -Signature: - -```c++ -template class MaybeMaybe> -Nan::MaybeLocal Nan::MakeMaybe(MaybeMaybe v); -``` diff --git a/node_modules/nan/doc/methods.md b/node_modules/nan/doc/methods.md deleted file mode 100644 index 9642d02..0000000 --- a/node_modules/nan/doc/methods.md +++ /dev/null @@ -1,664 +0,0 @@ -## JavaScript-accessible methods - -A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. - -In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. - -* **Method argument types** - - Nan::FunctionCallbackInfo - - Nan::PropertyCallbackInfo - - Nan::ReturnValue -* **Method declarations** - - Method declaration - - Getter declaration - - Setter declaration - - Property getter declaration - - Property setter declaration - - Property enumerator declaration - - Property deleter declaration - - Property query declaration - - Index getter declaration - - Index setter declaration - - Index enumerator declaration - - Index deleter declaration - - Index query declaration -* Method and template helpers - - Nan::SetMethod() - - Nan::SetPrototypeMethod() - - Nan::SetAccessor() - - Nan::SetNamedPropertyHandler() - - Nan::SetIndexedPropertyHandler() - - Nan::SetTemplate() - - Nan::SetPrototypeTemplate() - - Nan::SetInstanceTemplate() - - Nan::SetCallHandler() - - Nan::SetCallAsFunctionHandler() - - -### Nan::FunctionCallbackInfo - -`Nan::FunctionCallbackInfo` should be used in place of [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.16/dd/d0d/classv8_1_1_function_callback_info.html), even with older versions of Node where `v8::FunctionCallbackInfo` does not exist. - -Definition: - -```c++ -template class FunctionCallbackInfo { - public: - ReturnValue GetReturnValue() const; - v8::Local Callee(); // NOTE: Not available in NodeJS >= 10.0.0 - v8::Local Data(); - v8::Local Holder(); - bool IsConstructCall(); - int Length() const; - v8::Local operator[](int i) const; - v8::Local This() const; - v8::Isolate *GetIsolate() const; -}; -``` - -See the [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.16/dd/d0d/classv8_1_1_function_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from methods. - -**Note:** `FunctionCallbackInfo::Callee` is removed in Node.js after `10.0.0` because it is was deprecated in V8. Consider using `info.Data()` to pass any information you need. - - -### Nan::PropertyCallbackInfo - -`Nan::PropertyCallbackInfo` should be used in place of [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d7/dc5/classv8_1_1_property_callback_info.html), even with older versions of Node where `v8::PropertyCallbackInfo` does not exist. - -Definition: - -```c++ -template class PropertyCallbackInfo : public PropertyCallbackInfoBase { - public: - ReturnValue GetReturnValue() const; - v8::Isolate* GetIsolate() const; - v8::Local Data() const; - v8::Local This() const; - v8::Local Holder() const; -}; -``` - -See the [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d7/dc5/classv8_1_1_property_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from property accessor methods. - - -### Nan::ReturnValue - -`Nan::ReturnValue` is used in place of [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.16/da/da7/classv8_1_1_return_value.html) on both [`Nan::FunctionCallbackInfo`](#api_nan_function_callback_info) and [`Nan::PropertyCallbackInfo`](#api_nan_property_callback_info) as the return type of `GetReturnValue()`. - -Example usage: - -```c++ -void EmptyArray(const Nan::FunctionCallbackInfo& info) { - info.GetReturnValue().Set(Nan::New()); -} -``` - -Definition: - -```c++ -template class ReturnValue { - public: - // Handle setters - template void Set(const v8::Local &handle); - template void Set(const Nan::Global &handle); - - // Fast primitive setters - void Set(bool value); - void Set(double i); - void Set(int32_t i); - void Set(uint32_t i); - - // Fast JS primitive setters - void SetNull(); - void SetUndefined(); - void SetEmptyString(); - - // Convenience getter for isolate - v8::Isolate *GetIsolate() const; -}; -``` - -See the documentation on [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.16/da/da7/classv8_1_1_return_value.html) for further information on this. - - -### Method declaration - -JavaScript-accessible methods should be declared with the following signature to form a `Nan::FunctionCallback`: - -```c++ -typedef void(*FunctionCallback)(const FunctionCallbackInfo&); -``` - -Example: - -```c++ -void MethodName(const Nan::FunctionCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a method as one is implicitly created for you. - -**Example usage** - -```c++ -// .h: -class Foo : public Nan::ObjectWrap { - ... - - static void Bar(const Nan::FunctionCallbackInfo& info); - static void Baz(const Nan::FunctionCallbackInfo& info); -} - - -// .cc: -void Foo::Bar(const Nan::FunctionCallbackInfo& info) { - ... -} - -void Foo::Baz(const Nan::FunctionCallbackInfo& info) { - ... -} -``` - -A helper macro `NAN_METHOD(methodname)` exists, compatible with NAN v1 method declarations. - -**Example usage with `NAN_METHOD(methodname)`** - -```c++ -// .h: -class Foo : public Nan::ObjectWrap { - ... - - static NAN_METHOD(Bar); - static NAN_METHOD(Baz); -} - - -// .cc: -NAN_METHOD(Foo::Bar) { - ... -} - -NAN_METHOD(Foo::Baz) { - ... -} -``` - -Use [`Nan::SetPrototypeMethod`](#api_nan_set_prototype_method) to attach a method to a JavaScript function prototype or [`Nan::SetMethod`](#api_nan_set_method) to attach a method directly on a JavaScript object. - - -### Getter declaration - -JavaScript-accessible getters should be declared with the following signature to form a `Nan::GetterCallback`: - -```c++ -typedef void(*GetterCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void GetterName(v8::Local property, - const Nan::PropertyCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a getter as one is implicitly created for you. - -A helper macro `NAN_GETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). - - -### Setter declaration - -JavaScript-accessible setters should be declared with the following signature to form a Nan::SetterCallback: - -```c++ -typedef void(*SetterCallback)(v8::Local, - v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void SetterName(v8::Local property, - v8::Local value, - const Nan::PropertyCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a setter as one is implicitly created for you. - -A helper macro `NAN_SETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). - - -### Property getter declaration - -JavaScript-accessible property getters should be declared with the following signature to form a Nan::PropertyGetterCallback: - -```c++ -typedef void(*PropertyGetterCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyGetterName(v8::Local property, - const Nan::PropertyCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a property getter as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_GETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property setter declaration - -JavaScript-accessible property setters should be declared with the following signature to form a Nan::PropertySetterCallback: - -```c++ -typedef void(*PropertySetterCallback)(v8::Local, - v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertySetterName(v8::Local property, - v8::Local value, - const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property setter as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_SETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property enumerator declaration - -JavaScript-accessible property enumerators should be declared with the following signature to form a Nan::PropertyEnumeratorCallback: - -```c++ -typedef void(*PropertyEnumeratorCallback)(const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyEnumeratorName(const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property enumerator as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property deleter declaration - -JavaScript-accessible property deleters should be declared with the following signature to form a Nan::PropertyDeleterCallback: - -```c++ -typedef void(*PropertyDeleterCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyDeleterName(v8::Local property, - const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property deleter as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_DELETER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property query declaration - -JavaScript-accessible property query methods should be declared with the following signature to form a Nan::PropertyQueryCallback: - -```c++ -typedef void(*PropertyQueryCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyQueryName(v8::Local property, - const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property query method as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_QUERY(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index getter declaration - -JavaScript-accessible index getter methods should be declared with the following signature to form a Nan::IndexGetterCallback: - -```c++ -typedef void(*IndexGetterCallback)(uint32_t, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexGetterName(uint32_t index, const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index getter as one is implicitly created for you. - -A helper macro `NAN_INDEX_GETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index setter declaration - -JavaScript-accessible index setter methods should be declared with the following signature to form a Nan::IndexSetterCallback: - -```c++ -typedef void(*IndexSetterCallback)(uint32_t, - v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexSetterName(uint32_t index, - v8::Local value, - const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index setter as one is implicitly created for you. - -A helper macro `NAN_INDEX_SETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index enumerator declaration - -JavaScript-accessible index enumerator methods should be declared with the following signature to form a Nan::IndexEnumeratorCallback: - -```c++ -typedef void(*IndexEnumeratorCallback)(const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexEnumeratorName(const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index enumerator as one is implicitly created for you. - -A helper macro `NAN_INDEX_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index deleter declaration - -JavaScript-accessible index deleter methods should be declared with the following signature to form a Nan::IndexDeleterCallback: - -```c++ -typedef void(*IndexDeleterCallback)(uint32_t, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexDeleterName(uint32_t index, const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index deleter as one is implicitly created for you. - -A helper macro `NAN_INDEX_DELETER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index query declaration - -JavaScript-accessible index query methods should be declared with the following signature to form a Nan::IndexQueryCallback: - -```c++ -typedef void(*IndexQueryCallback)(uint32_t, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexQueryName(uint32_t index, const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index query method as one is implicitly created for you. - -A helper macro `NAN_INDEX_QUERY(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Nan::SetMethod() - -Sets a method with a given name directly on a JavaScript object where the method has the `Nan::FunctionCallback` signature (see Method declaration). - -Signature: - -```c++ -void Nan::SetMethod(v8::Local recv, - const char *name, - Nan::FunctionCallback callback, - v8::Local data = v8::Local()) -void Nan::SetMethod(v8::Local templ, - const char *name, - Nan::FunctionCallback callback, - v8::Local data = v8::Local()) -``` - - -### Nan::SetPrototypeMethod() - -Sets a method with a given name on a `FunctionTemplate`'s prototype where the method has the `Nan::FunctionCallback` signature (see Method declaration). - -Signature: - -```c++ -void Nan::SetPrototypeMethod(v8::Local recv, - const char* name, - Nan::FunctionCallback callback, - v8::Local data = v8::Local()) -``` - - -### Nan::SetAccessor() - -Sets getters and setters for a property with a given name on an `ObjectTemplate` or a plain `Object`. Accepts getters with the `Nan::GetterCallback` signature (see Getter declaration) and setters with the `Nan::SetterCallback` signature (see Setter declaration). - -Signature: - -```c++ -void SetAccessor(v8::Local tpl, - v8::Local name, - Nan::GetterCallback getter, - Nan::SetterCallback setter = 0, - v8::Local data = v8::Local(), - v8::AccessControl settings = v8::DEFAULT, - v8::PropertyAttribute attribute = v8::None, - imp::Sig signature = imp::Sig()); -bool SetAccessor(v8::Local obj, - v8::Local name, - Nan::GetterCallback getter, - Nan::SetterCallback setter = 0, - v8::Local data = v8::Local(), - v8::AccessControl settings = v8::DEFAULT, - v8::PropertyAttribute attribute = v8::None) -``` - -See the V8 [`ObjectTemplate#SetAccessor()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#aca0ed196f8a9adb1f68b1aadb6c9cd77) and [`Object#SetAccessor()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ae91b3b56b357f285288c89fbddc46d1b) for further information about how to use `Nan::SetAccessor()`. - - -### Nan::SetNamedPropertyHandler() - -Sets named property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: - -* Property getters with the `Nan::PropertyGetterCallback` signature (see Property getter declaration) -* Property setters with the `Nan::PropertySetterCallback` signature (see Property setter declaration) -* Property query methods with the `Nan::PropertyQueryCallback` signature (see Property query declaration) -* Property deleters with the `Nan::PropertyDeleterCallback` signature (see Property deleter declaration) -* Property enumerators with the `Nan::PropertyEnumeratorCallback` signature (see Property enumerator declaration) - -Signature: - -```c++ -void SetNamedPropertyHandler(v8::Local tpl, - Nan::PropertyGetterCallback getter, - Nan::PropertySetterCallback setter = 0, - Nan::PropertyQueryCallback query = 0, - Nan::PropertyDeleterCallback deleter = 0, - Nan::PropertyEnumeratorCallback enumerator = 0, - v8::Local data = v8::Local()) -``` - -See the V8 [`ObjectTemplate#SetNamedPropertyHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#a33b3ebd7de641f6cc6414b7de01fc1c7) for further information about how to use `Nan::SetNamedPropertyHandler()`. - - -### Nan::SetIndexedPropertyHandler() - -Sets indexed property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: - -* Indexed property getters with the `Nan::IndexGetterCallback` signature (see Index getter declaration) -* Indexed property setters with the `Nan::IndexSetterCallback` signature (see Index setter declaration) -* Indexed property query methods with the `Nan::IndexQueryCallback` signature (see Index query declaration) -* Indexed property deleters with the `Nan::IndexDeleterCallback` signature (see Index deleter declaration) -* Indexed property enumerators with the `Nan::IndexEnumeratorCallback` signature (see Index enumerator declaration) - -Signature: - -```c++ -void SetIndexedPropertyHandler(v8::Local tpl, - Nan::IndexGetterCallback getter, - Nan::IndexSetterCallback setter = 0, - Nan::IndexQueryCallback query = 0, - Nan::IndexDeleterCallback deleter = 0, - Nan::IndexEnumeratorCallback enumerator = 0, - v8::Local data = v8::Local()) -``` - -See the V8 [`ObjectTemplate#SetIndexedPropertyHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#ac89f06d634add0e890452033f7d17ff1) for further information about how to use `Nan::SetIndexedPropertyHandler()`. - - -### Nan::SetTemplate() - -Adds properties on an `Object`'s or `Function`'s template. - -Signature: - -```c++ -void Nan::SetTemplate(v8::Local templ, - const char *name, - v8::Local value); -void Nan::SetTemplate(v8::Local templ, - v8::Local name, - v8::Local value, - v8::PropertyAttribute attributes) -``` - -Calls the `Template`'s [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#ae3fbaff137557aa6a0233bc7e52214ac). - - -### Nan::SetPrototypeTemplate() - -Adds properties on an `Object`'s or `Function`'s prototype template. - -Signature: - -```c++ -void Nan::SetPrototypeTemplate(v8::Local templ, - const char *name, - v8::Local value); -void Nan::SetPrototypeTemplate(v8::Local templ, - v8::Local name, - v8::Local value, - v8::PropertyAttribute attributes) -``` - -Calls the `FunctionTemplate`'s _PrototypeTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). - - -### Nan::SetInstanceTemplate() - -Use to add instance properties on `FunctionTemplate`'s. - -Signature: - -```c++ -void Nan::SetInstanceTemplate(v8::Local templ, - const char *name, - v8::Local value); -void Nan::SetInstanceTemplate(v8::Local templ, - v8::Local name, - v8::Local value, - v8::PropertyAttribute attributes) -``` - -Calls the `FunctionTemplate`'s _InstanceTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). - - -### Nan::SetCallHandler() - -Set the call-handler callback for a `v8::FunctionTemplate`. -This callback is called whenever the function created from this FunctionTemplate is called. - -Signature: - -```c++ -void Nan::SetCallHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) -``` - -Calls the `FunctionTemplate`'s [`SetCallHandler()`](https://v8docs.nodesource.com/node-8.16/d8/d83/classv8_1_1_function_template.html#ab7574b298db3c27fbc2ed465c08ea2f8). - - -### Nan::SetCallAsFunctionHandler() - -Sets the callback to be used when calling instances created from the `v8::ObjectTemplate` as a function. -If no callback is set, instances behave like normal JavaScript objects that cannot be called as a function. - -Signature: - -```c++ -void Nan::SetCallAsFunctionHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) -``` - -Calls the `ObjectTemplate`'s [`SetCallAsFunctionHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#a5e9612fc80bf6db8f2da199b9b0bd04e). - diff --git a/node_modules/nan/doc/new.md b/node_modules/nan/doc/new.md deleted file mode 100644 index 0f28a0e..0000000 --- a/node_modules/nan/doc/new.md +++ /dev/null @@ -1,147 +0,0 @@ -## New - -NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. - - - Nan::New() - - Nan::Undefined() - - Nan::Null() - - Nan::True() - - Nan::False() - - Nan::EmptyString() - - - -### Nan::New() - -`Nan::New()` should be used to instantiate new JavaScript objects. - -Refer to the specific V8 type in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/d1/d83/classv8_1_1_data.html) for information on the types of arguments required for instantiation. - -Signatures: - -Return types are mostly omitted from the signatures for simplicity. In most cases the type will be contained within a `v8::Local`. The following types will be contained within a `Nan::MaybeLocal`: `v8::String`, `v8::Date`, `v8::RegExp`, `v8::Script`, `v8::UnboundScript`. - -Empty objects: - -```c++ -Nan::New(); -``` - -Generic single and multiple-argument: - -```c++ -Nan::New(A0 arg0); -Nan::New(A0 arg0, A1 arg1); -Nan::New(A0 arg0, A1 arg1, A2 arg2); -Nan::New(A0 arg0, A1 arg1, A2 arg2, A3 arg3); -``` - -For creating `v8::FunctionTemplate` and `v8::Function` objects: - -_The definition of `Nan::FunctionCallback` can be found in the [Method declaration](./methods.md#api_nan_method) documentation._ - -```c++ -Nan::New(Nan::FunctionCallback callback, - v8::Local data = v8::Local()); -Nan::New(Nan::FunctionCallback callback, - v8::Local data = v8::Local(), - A2 a2 = A2()); -``` - -Native number types: - -```c++ -v8::Local Nan::New(bool value); -v8::Local Nan::New(int32_t value); -v8::Local Nan::New(uint32_t value); -v8::Local Nan::New(double value); -``` - -String types: - -```c++ -Nan::MaybeLocal Nan::New(std::string const& value); -Nan::MaybeLocal Nan::New(const char * value, int length); -Nan::MaybeLocal Nan::New(const char * value); -Nan::MaybeLocal Nan::New(const uint16_t * value); -Nan::MaybeLocal Nan::New(const uint16_t * value, int length); -``` - -Specialized types: - -```c++ -v8::Local Nan::New(v8::String::ExternalStringResource * value); -v8::Local Nan::New(Nan::ExternalOneByteStringResource * value); -v8::Local Nan::New(v8::Local pattern, v8::RegExp::Flags flags); -``` - -Note that `Nan::ExternalOneByteStringResource` maps to [`v8::String::ExternalOneByteStringResource`](https://v8docs.nodesource.com/node-8.16/d9/db3/classv8_1_1_string_1_1_external_one_byte_string_resource.html), and `v8::String::ExternalAsciiStringResource` in older versions of V8. - - - -### Nan::Undefined() - -A helper method to reference the `v8::Undefined` object in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::Undefined() -``` - - -### Nan::Null() - -A helper method to reference the `v8::Null` object in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::Null() -``` - - -### Nan::True() - -A helper method to reference the `v8::Boolean` object representing the `true` value in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::True() -``` - - -### Nan::False() - -A helper method to reference the `v8::Boolean` object representing the `false` value in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::False() -``` - - -### Nan::EmptyString() - -Call [`v8::String::Empty`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a7c1bc8886115d7ee46f1d571dd6ebc6d) to reference the empty string in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::EmptyString() -``` - - - -### Nan::NewOneByteString() - -An implementation of [`v8::String::NewFromOneByte()`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a5264d50b96d2c896ce525a734dc10f09) provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data. - -Signature: - -```c++ -Nan::MaybeLocal Nan::NewOneByteString(const uint8_t * value, - int length = -1) -``` diff --git a/node_modules/nan/doc/node_misc.md b/node_modules/nan/doc/node_misc.md deleted file mode 100644 index 17578e3..0000000 --- a/node_modules/nan/doc/node_misc.md +++ /dev/null @@ -1,123 +0,0 @@ -## Miscellaneous Node Helpers - - - Nan::AsyncResource - - Nan::MakeCallback() - - NAN_MODULE_INIT() - - Nan::Export() - - -### Nan::AsyncResource - -This class is analogous to the `AsyncResource` JavaScript class exposed by Node's [async_hooks][] API. - -When calling back into JavaScript asynchronously, special care must be taken to ensure that the runtime can properly track -async hops. `Nan::AsyncResource` is a class that provides an RAII wrapper around `node::EmitAsyncInit`, `node::EmitAsyncDestroy`, -and `node::MakeCallback`. Using this mechanism to call back into JavaScript, as opposed to `Nan::MakeCallback` or -`v8::Function::Call` ensures that the callback is executed in the correct async context. This ensures that async mechanisms -such as domains and [async_hooks][] function correctly. - -Definition: - -```c++ -class AsyncResource { - public: - AsyncResource(v8::Local name, - v8::Local resource = New()); - AsyncResource(const char* name, - v8::Local resource = New()); - ~AsyncResource(); - - v8::MaybeLocal runInAsyncScope(v8::Local target, - v8::Local func, - int argc, - v8::Local* argv); - v8::MaybeLocal runInAsyncScope(v8::Local target, - v8::Local symbol, - int argc, - v8::Local* argv); - v8::MaybeLocal runInAsyncScope(v8::Local target, - const char* method, - int argc, - v8::Local* argv); -}; -``` - -* `name`: Identifier for the kind of resource that is being provided for diagnostics information exposed by the [async_hooks][] - API. This will be passed to the possible `init` hook as the `type`. To avoid name collisions with other modules we recommend - that the name include the name of the owning module as a prefix. For example `mysql` module could use something like - `mysql:batch-db-query-resource`. -* `resource`: An optional object associated with the async work that will be passed to the possible [async_hooks][] - `init` hook. If this parameter is omitted, or an empty handle is provided, this object will be created automatically. -* When calling JS on behalf of this resource, one can use `runInAsyncScope`. This will ensure that the callback runs in the - correct async execution context. -* `AsyncDestroy` is automatically called when an AsyncResource object is destroyed. - -For more details, see the Node [async_hooks][] documentation. You might also want to take a look at the documentation for the -[N-API counterpart][napi]. For example usage, see the `asyncresource.cpp` example in the `test/cpp` directory. - - -### Nan::MakeCallback() - -Deprecated wrappers around the legacy `node::MakeCallback()` APIs. Node.js 10+ -has deprecated these legacy APIs as they do not provide a mechanism to preserve -async context. - -We recommend that you use the `AsyncResource` class and `AsyncResource::runInAsyncScope` instead of using `Nan::MakeCallback` or -`v8::Function#Call()` directly. `AsyncResource` properly takes care of running the callback in the correct async execution -context – something that is essential for functionality like domains, async_hooks and async debugging. - -Signatures: - -```c++ -NAN_DEPRECATED -v8::Local Nan::MakeCallback(v8::Local target, - v8::Local func, - int argc, - v8::Local* argv); -NAN_DEPRECATED -v8::Local Nan::MakeCallback(v8::Local target, - v8::Local symbol, - int argc, - v8::Local* argv); -NAN_DEPRECATED -v8::Local Nan::MakeCallback(v8::Local target, - const char* method, - int argc, - v8::Local* argv); -``` - - - -### NAN_MODULE_INIT() - -Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object. - -See example below. - - -### Nan::Export() - -A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript. - -Signature: - -```c++ -void Export(v8::Local target, const char *name, Nan::FunctionCallback f) -``` - -Also available as the shortcut `NAN_EXPORT` macro. - -Example: - -```c++ -NAN_METHOD(Foo) { - ... -} - -NAN_MODULE_INIT(Init) { - NAN_EXPORT(target, Foo); -} -``` - -[async_hooks]: https://nodejs.org/dist/latest-v9.x/docs/api/async_hooks.html -[napi]: https://nodejs.org/dist/latest-v9.x/docs/api/n-api.html#n_api_custom_asynchronous_operations diff --git a/node_modules/nan/doc/object_wrappers.md b/node_modules/nan/doc/object_wrappers.md deleted file mode 100644 index 07d8c05..0000000 --- a/node_modules/nan/doc/object_wrappers.md +++ /dev/null @@ -1,263 +0,0 @@ -## Object Wrappers - -The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. - - - Nan::ObjectWrap - - - -### Nan::ObjectWrap() - -A reimplementation of `node::ObjectWrap` that adds some API not present in older versions of Node. Should be preferred over `node::ObjectWrap` in all cases for consistency. - -Definition: - -```c++ -class ObjectWrap { - public: - ObjectWrap(); - - virtual ~ObjectWrap(); - - template - static inline T* Unwrap(v8::Local handle); - - inline v8::Local handle(); - - inline Nan::Persistent& persistent(); - - protected: - inline void Wrap(v8::Local handle); - - inline void MakeWeak(); - - /* Ref() marks the object as being attached to an event loop. - * Refed objects will not be garbage collected, even if - * all references are lost. - */ - virtual void Ref(); - - /* Unref() marks an object as detached from the event loop. This is its - * default state. When an object with a "weak" reference changes from - * attached to detached state it will be freed. Be careful not to access - * the object after making this call as it might be gone! - * (A "weak reference" means an object that only has a - * persistent handle.) - * - * DO NOT CALL THIS FROM DESTRUCTOR - */ - virtual void Unref(); - - int refs_; // ro -}; -``` - -See the Node documentation on [Wrapping C++ Objects](https://nodejs.org/api/addons.html#addons_wrapping_c_objects) for more details. - -### This vs. Holder - -When calling `Unwrap`, it is important that the argument is indeed some JavaScript object which got wrapped by a `Wrap` call for this class or any derived class. -The `Signature` installed by [`Nan::SetPrototypeMethod()`](methods.md#api_nan_set_prototype_method) does ensure that `info.Holder()` is just such an instance. -In Node 0.12 and later, `info.This()` will also be of such a type, since otherwise the invocation will get rejected. -However, in Node 0.10 and before it was possible to invoke a method on a JavaScript object which just had the extension type in its prototype chain. -In such a situation, calling `Unwrap` on `info.This()` will likely lead to a failed assertion causing a crash, but could lead to even more serious corruption. - -On the other hand, calling `Unwrap` in an [accessor](methods.md#api_nan_set_accessor) should not use `Holder()` if the accessor is defined on the prototype. -So either define your accessors on the instance template, -or use `This()` after verifying that it is indeed a valid object. - -### Examples - -#### Basic - -```c++ -class MyObject : public Nan::ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - v8::Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("MyObject").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Nan::SetPrototypeMethod(tpl, "getHandle", GetHandle); - Nan::SetPrototypeMethod(tpl, "getValue", GetValue); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - Nan::Set(target, Nan::New("MyObject").ToLocalChecked(), - Nan::GetFunction(tpl).ToLocalChecked()); - } - - private: - explicit MyObject(double value = 0) : value_(value) {} - ~MyObject() {} - - static NAN_METHOD(New) { - if (info.IsConstructCall()) { - double value = info[0]->IsUndefined() ? 0 : Nan::To(info[0]).FromJust(); - MyObject *obj = new MyObject(value); - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } else { - const int argc = 1; - v8::Local argv[argc] = {info[0]}; - v8::Local cons = Nan::New(constructor()); - info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); - } - } - - static NAN_METHOD(GetHandle) { - MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); - info.GetReturnValue().Set(obj->handle()); - } - - static NAN_METHOD(GetValue) { - MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); - info.GetReturnValue().Set(obj->value_); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - double value_; -}; - -NODE_MODULE(objectwrapper, MyObject::Init) -``` - -To use in Javascript: - -```Javascript -var objectwrapper = require('bindings')('objectwrapper'); - -var obj = new objectwrapper.MyObject(5); -console.log('Should be 5: ' + obj.getValue()); -``` - -#### Factory of wrapped objects - -```c++ -class MyFactoryObject : public Nan::ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - v8::Local tpl = Nan::New(New); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Nan::SetPrototypeMethod(tpl, "getValue", GetValue); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - } - - static NAN_METHOD(NewInstance) { - v8::Local cons = Nan::New(constructor()); - double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; - const int argc = 1; - v8::Local argv[1] = {Nan::New(value)}; - info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); - } - - // Needed for the next example: - inline double value() const { - return value_; - } - - private: - explicit MyFactoryObject(double value = 0) : value_(value) {} - ~MyFactoryObject() {} - - static NAN_METHOD(New) { - if (info.IsConstructCall()) { - double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; - MyFactoryObject * obj = new MyFactoryObject(value); - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } else { - const int argc = 1; - v8::Local argv[argc] = {info[0]}; - v8::Local cons = Nan::New(constructor()); - info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); - } - } - - static NAN_METHOD(GetValue) { - MyFactoryObject* obj = ObjectWrap::Unwrap(info.Holder()); - info.GetReturnValue().Set(obj->value_); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - double value_; -}; - -NAN_MODULE_INIT(Init) { - MyFactoryObject::Init(target); - Nan::Set(target, - Nan::New("newFactoryObjectInstance").ToLocalChecked(), - Nan::GetFunction( - Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() - ); -} - -NODE_MODULE(wrappedobjectfactory, Init) -``` - -To use in Javascript: - -```Javascript -var wrappedobjectfactory = require('bindings')('wrappedobjectfactory'); - -var obj = wrappedobjectfactory.newFactoryObjectInstance(10); -console.log('Should be 10: ' + obj.getValue()); -``` - -#### Passing wrapped objects around - -Use the `MyFactoryObject` class above along with the following: - -```c++ -static NAN_METHOD(Sum) { - Nan::MaybeLocal maybe1 = Nan::To(info[0]); - Nan::MaybeLocal maybe2 = Nan::To(info[1]); - - // Quick check: - if (maybe1.IsEmpty() || maybe2.IsEmpty()) { - // return value is undefined by default - return; - } - - MyFactoryObject* obj1 = - Nan::ObjectWrap::Unwrap(maybe1.ToLocalChecked()); - MyFactoryObject* obj2 = - Nan::ObjectWrap::Unwrap(maybe2.ToLocalChecked()); - - info.GetReturnValue().Set(Nan::New(obj1->value() + obj2->value())); -} - -NAN_MODULE_INIT(Init) { - MyFactoryObject::Init(target); - Nan::Set(target, - Nan::New("newFactoryObjectInstance").ToLocalChecked(), - Nan::GetFunction( - Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() - ); - Nan::Set(target, - Nan::New("sum").ToLocalChecked(), - Nan::GetFunction(Nan::New(Sum)).ToLocalChecked() - ); -} - -NODE_MODULE(myaddon, Init) -``` - -To use in Javascript: - -```Javascript -var myaddon = require('bindings')('myaddon'); - -var obj1 = myaddon.newFactoryObjectInstance(5); -var obj2 = myaddon.newFactoryObjectInstance(10); -console.log('sum of object values: ' + myaddon.sum(obj1, obj2)); -``` diff --git a/node_modules/nan/doc/persistent.md b/node_modules/nan/doc/persistent.md deleted file mode 100644 index 2e13f6b..0000000 --- a/node_modules/nan/doc/persistent.md +++ /dev/null @@ -1,296 +0,0 @@ -## Persistent references - -An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. - -Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. - - - Nan::PersistentBase & v8::PersistentBase - - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - - Nan::Persistent - - Nan::Global - - Nan::WeakCallbackInfo - - Nan::WeakCallbackType - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - - -### Nan::PersistentBase & v8::PersistentBase - -A persistent handle contains a reference to a storage cell in V8 which holds an object value and which is updated by the garbage collector whenever the object is moved. A new storage cell can be created using the constructor or `Nan::PersistentBase::Reset()`. Existing handles can be disposed using an argument-less `Nan::PersistentBase::Reset()`. - -Definition: - -_(note: this is implemented as `Nan::PersistentBase` for older versions of V8 and the native `v8::PersistentBase` is used for newer versions of V8)_ - -```c++ -template class PersistentBase { - public: - /** - * If non-empty, destroy the underlying storage cell - */ - void Reset(); - - /** - * If non-empty, destroy the underlying storage cell and create a new one with - * the contents of another if it is also non-empty - */ - template void Reset(const v8::Local &other); - - /** - * If non-empty, destroy the underlying storage cell and create a new one with - * the contents of another if it is also non-empty - */ - template void Reset(const PersistentBase &other); - - /** Returns true if the handle is empty. */ - bool IsEmpty() const; - - /** - * If non-empty, destroy the underlying storage cell - * IsEmpty() will return true after this call. - */ - void Empty(); - - template bool operator==(const PersistentBase &that); - - template bool operator==(const v8::Local &that); - - template bool operator!=(const PersistentBase &that); - - template bool operator!=(const v8::Local &that); - - /** - * Install a finalization callback on this object. - * NOTE: There is no guarantee as to *when* or even *if* the callback is - * invoked. The invocation is performed solely on a best effort basis. - * As always, GC-based finalization should *not* be relied upon for any - * critical form of resource management! At the moment you can either - * specify a parameter for the callback or the location of two internal - * fields in the dying object. - */ - template - void SetWeak(P *parameter, - typename WeakCallbackInfo

::Callback callback, - WeakCallbackType type); - - void ClearWeak(); - - /** - * Marks the reference to this object independent. Garbage collector is free - * to ignore any object groups containing this object. Weak callback for an - * independent handle should not assume that it will be preceded by a global - * GC prologue callback or followed by a global GC epilogue callback. - */ - void MarkIndependent() const; - - bool IsIndependent() const; - - /** Checks if the handle holds the only reference to an object. */ - bool IsNearDeath() const; - - /** Returns true if the handle's reference is weak. */ - bool IsWeak() const -}; -``` - -See the V8 documentation for [`PersistentBase`](https://v8docs.nodesource.com/node-8.16/d4/dca/classv8_1_1_persistent_base.html) for further information. - -**Tip:** To get a `v8::Local` reference to the original object back from a `PersistentBase` or `Persistent` object: - -```c++ -v8::Local object = Nan::New(persistent); -``` - - -### Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - -Default traits for `Nan::Persistent`. This class does not allow use of the a copy constructor or assignment operator. At present `kResetInDestructor` is not set, but that will change in a future version. - -Definition: - -_(note: this is implemented as `Nan::NonCopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ - -```c++ -template class NonCopyablePersistentTraits { - public: - typedef Persistent > NonCopyablePersistent; - - static const bool kResetInDestructor = false; - - template - static void Copy(const Persistent &source, - NonCopyablePersistent *dest); - - template static void Uncompilable(); -}; -``` - -See the V8 documentation for [`NonCopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/de/d73/classv8_1_1_non_copyable_persistent_traits.html) for further information. - - -### Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - -A helper class of traits to allow copying and assignment of `Persistent`. This will clone the contents of storage cell, but not any of the flags, etc.. - -Definition: - -_(note: this is implemented as `Nan::CopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ - -```c++ -template -class CopyablePersistentTraits { - public: - typedef Persistent > CopyablePersistent; - - static const bool kResetInDestructor = true; - - template - static void Copy(const Persistent &source, - CopyablePersistent *dest); -}; -``` - -See the V8 documentation for [`CopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/da/d5c/structv8_1_1_copyable_persistent_traits.html) for further information. - - -### Nan::Persistent - -A type of `PersistentBase` which allows copy and assignment. Copy, assignment and destructor behavior is controlled by the traits class `M`. - -Definition: - -```c++ -template > -class Persistent; - -template class Persistent : public PersistentBase { - public: - /** - * A Persistent with no storage cell. - */ - Persistent(); - - /** - * Construct a Persistent from a v8::Local. When the v8::Local is non-empty, a - * new storage cell is created pointing to the same object, and no flags are - * set. - */ - template Persistent(v8::Local that); - - /** - * Construct a Persistent from a Persistent. When the Persistent is non-empty, - * a new storage cell is created pointing to the same object, and no flags are - * set. - */ - Persistent(const Persistent &that); - - /** - * The copy constructors and assignment operator create a Persistent exactly - * as the Persistent constructor, but the Copy function from the traits class - * is called, allowing the setting of flags based on the copied Persistent. - */ - Persistent &operator=(const Persistent &that); - - template - Persistent &operator=(const Persistent &that); - - /** - * The destructor will dispose the Persistent based on the kResetInDestructor - * flags in the traits class. Since not calling dispose can result in a - * memory leak, it is recommended to always set this flag. - */ - ~Persistent(); -}; -``` - -See the V8 documentation for [`Persistent`](https://v8docs.nodesource.com/node-8.16/d2/d78/classv8_1_1_persistent.html) for further information. - - -### Nan::Global - -A type of `PersistentBase` which has move semantics. - -```c++ -template class Global : public PersistentBase { - public: - /** - * A Global with no storage cell. - */ - Global(); - - /** - * Construct a Global from a v8::Local. When the v8::Local is non-empty, a new - * storage cell is created pointing to the same object, and no flags are set. - */ - template Global(v8::Local that); - /** - * Construct a Global from a PersistentBase. When the Persistent is non-empty, - * a new storage cell is created pointing to the same object, and no flags are - * set. - */ - template Global(const PersistentBase &that); - - /** - * Pass allows returning globals from functions, etc. - */ - Global Pass(); -}; -``` - -See the V8 documentation for [`Global`](https://v8docs.nodesource.com/node-8.16/d5/d40/classv8_1_1_global.html) for further information. - - -### Nan::WeakCallbackInfo - -`Nan::WeakCallbackInfo` is used as an argument when setting a persistent reference as weak. You may need to free any external resources attached to the object. It is a mirror of `v8:WeakCallbackInfo` as found in newer versions of V8. - -Definition: - -```c++ -template class WeakCallbackInfo { - public: - typedef void (*Callback)(const WeakCallbackInfo& data); - - v8::Isolate *GetIsolate() const; - - /** - * Get the parameter that was associated with the weak handle. - */ - T *GetParameter() const; - - /** - * Get pointer from internal field, index can be 0 or 1. - */ - void *GetInternalField(int index) const; -}; -``` - -Example usage: - -```c++ -void weakCallback(const WeakCallbackInfo &data) { - int *parameter = data.GetParameter(); - delete parameter; -} - -Persistent obj; -int *data = new int(0); -obj.SetWeak(data, callback, WeakCallbackType::kParameter); -``` - -See the V8 documentation for [`WeakCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d8/d06/classv8_1_1_weak_callback_info.html) for further information. - - -### Nan::WeakCallbackType - -Represents the type of a weak callback. -A weak callback of type `kParameter` makes the supplied parameter to `Nan::PersistentBase::SetWeak` available through `WeakCallbackInfo::GetParameter`. -A weak callback of type `kInternalFields` uses up to two internal fields at indices 0 and 1 on the `Nan::PersistentBase` being made weak. -Note that only `v8::Object`s and derivatives can have internal fields. - -Definition: - -```c++ -enum class WeakCallbackType { kParameter, kInternalFields }; -``` diff --git a/node_modules/nan/doc/scopes.md b/node_modules/nan/doc/scopes.md deleted file mode 100644 index 84000ee..0000000 --- a/node_modules/nan/doc/scopes.md +++ /dev/null @@ -1,73 +0,0 @@ -## Scopes - -A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. - -A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. - -The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. - - - Nan::HandleScope - - Nan::EscapableHandleScope - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). - - -### Nan::HandleScope - -A simple wrapper around [`v8::HandleScope`](https://v8docs.nodesource.com/node-8.16/d3/d95/classv8_1_1_handle_scope.html). - -Definition: - -```c++ -class Nan::HandleScope { - public: - Nan::HandleScope(); - static int NumberOfHandles(); -}; -``` - -Allocate a new `Nan::HandleScope` whenever you are creating new V8 JavaScript objects. Note that an implicit `HandleScope` is created for you on JavaScript-accessible methods so you do not need to insert one yourself. - -Example: - -```c++ -// new object is created, it needs a new scope: -void Pointless() { - Nan::HandleScope scope; - v8::Local obj = Nan::New(); -} - -// JavaScript-accessible method already has a HandleScope -NAN_METHOD(Pointless2) { - v8::Local obj = Nan::New(); -} -``` - - -### Nan::EscapableHandleScope - -Similar to [`Nan::HandleScope`](#api_nan_handle_scope) but should be used in cases where a function needs to return a V8 JavaScript type that has been created within it. - -Definition: - -```c++ -class Nan::EscapableHandleScope { - public: - Nan::EscapableHandleScope(); - static int NumberOfHandles(); - template v8::Local Escape(v8::Local value); -} -``` - -Use `Escape(value)` to return the object. - -Example: - -```c++ -v8::Local EmptyObj() { - Nan::EscapableHandleScope scope; - v8::Local obj = Nan::New(); - return scope.Escape(obj); -} -``` - diff --git a/node_modules/nan/doc/script.md b/node_modules/nan/doc/script.md deleted file mode 100644 index 213320a..0000000 --- a/node_modules/nan/doc/script.md +++ /dev/null @@ -1,38 +0,0 @@ -## Script - -NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. - - - Nan::CompileScript() - - Nan::RunScript() - - - -### Nan::CompileScript() - -A wrapper around [`v8::ScriptCompiler::Compile()`](https://v8docs.nodesource.com/node-8.16/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b). - -Note that `Nan::BoundScript` is an alias for `v8::Script`. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CompileScript( - v8::Local s, - const v8::ScriptOrigin& origin); -Nan::MaybeLocal Nan::CompileScript(v8::Local s); -``` - - - -### Nan::RunScript() - -Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`. - -Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::RunScript(v8::Local script) -Nan::MaybeLocal Nan::RunScript(v8::Local script) -``` diff --git a/node_modules/nan/doc/string_bytes.md b/node_modules/nan/doc/string_bytes.md deleted file mode 100644 index 7c1bd32..0000000 --- a/node_modules/nan/doc/string_bytes.md +++ /dev/null @@ -1,62 +0,0 @@ -## Strings & Bytes - -Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. - - - Nan::Encoding - - Nan::Encode() - - Nan::DecodeBytes() - - Nan::DecodeWrite() - - - -### Nan::Encoding - -An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node. - -Definition: - -```c++ -enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER } -``` - - - -### Nan::Encode() - -A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node. - -Signature: - -```c++ -v8::Local Nan::Encode(const void *buf, - size_t len, - enum Nan::Encoding encoding = BINARY); -``` - - - -### Nan::DecodeBytes() - -A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node. - -Signature: - -```c++ -ssize_t Nan::DecodeBytes(v8::Local val, - enum Nan::Encoding encoding = BINARY); -``` - - - -### Nan::DecodeWrite() - -A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node. - -Signature: - -```c++ -ssize_t Nan::DecodeWrite(char *buf, - size_t len, - v8::Local val, - enum Nan::Encoding encoding = BINARY); -``` diff --git a/node_modules/nan/doc/v8_internals.md b/node_modules/nan/doc/v8_internals.md deleted file mode 100644 index 08dd6d0..0000000 --- a/node_modules/nan/doc/v8_internals.md +++ /dev/null @@ -1,199 +0,0 @@ -## V8 internals - -The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. - - - NAN_GC_CALLBACK() - - Nan::AddGCEpilogueCallback() - - Nan::RemoveGCEpilogueCallback() - - Nan::AddGCPrologueCallback() - - Nan::RemoveGCPrologueCallback() - - Nan::GetHeapStatistics() - - Nan::SetCounterFunction() - - Nan::SetCreateHistogramFunction() - - Nan::SetAddHistogramSampleFunction() - - Nan::IdleNotification() - - Nan::LowMemoryNotification() - - Nan::ContextDisposedNotification() - - Nan::GetInternalFieldPointer() - - Nan::SetInternalFieldPointer() - - Nan::AdjustExternalMemory() - - - -### NAN_GC_CALLBACK(callbackname) - -Use `NAN_GC_CALLBACK` to declare your callbacks for `Nan::AddGCPrologueCallback()` and `Nan::AddGCEpilogueCallback()`. Your new method receives the arguments `v8::GCType type` and `v8::GCCallbackFlags flags`. - -```c++ -static Nan::Persistent callback; - -NAN_GC_CALLBACK(gcPrologueCallback) { - v8::Local argv[] = { Nan::New("prologue").ToLocalChecked() }; - Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(callback), 1, argv); -} - -NAN_METHOD(Hook) { - callback.Reset(To(args[0]).ToLocalChecked()); - Nan::AddGCPrologueCallback(gcPrologueCallback); - info.GetReturnValue().Set(info.Holder()); -} -``` - - -### Nan::AddGCEpilogueCallback() - -Signature: - -```c++ -void Nan::AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, v8::GCType gc_type_filter = v8::kGCTypeAll) -``` - -Calls V8's [`AddGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a580f976e4290cead62c2fc4dd396be3e). - - -### Nan::RemoveGCEpilogueCallback() - -Signature: - -```c++ -void Nan::RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback) -``` - -Calls V8's [`RemoveGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#adca9294555a3908e9f23c7bb0f0f284c). - - -### Nan::AddGCPrologueCallback() - -Signature: - -```c++ -void Nan::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback, v8::GCType gc_type_filter callback) -``` - -Calls V8's [`AddGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a6dbef303603ebdb03da6998794ea05b8). - - -### Nan::RemoveGCPrologueCallback() - -Signature: - -```c++ -void Nan::RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback) -``` - -Calls V8's [`RemoveGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5f72c7cda21415ce062bbe5c58abe09e). - - -### Nan::GetHeapStatistics() - -Signature: - -```c++ -void Nan::GetHeapStatistics(v8::HeapStatistics *heap_statistics) -``` - -Calls V8's [`GetHeapStatistics()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5593ac74687b713095c38987e5950b34). - - -### Nan::SetCounterFunction() - -Signature: - -```c++ -void Nan::SetCounterFunction(v8::CounterLookupCallback cb) -``` - -Calls V8's [`SetCounterFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a045d7754e62fa0ec72ae6c259b29af94). - - -### Nan::SetCreateHistogramFunction() - -Signature: - -```c++ -void Nan::SetCreateHistogramFunction(v8::CreateHistogramCallback cb) -``` - -Calls V8's [`SetCreateHistogramFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a542d67e85089cb3f92aadf032f99e732). - - -### Nan::SetAddHistogramSampleFunction() - -Signature: - -```c++ -void Nan::SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) -``` - -Calls V8's [`SetAddHistogramSampleFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aeb420b690bc2c216882d6fdd00ddd3ea). - - -### Nan::IdleNotification() - -Signature: - -```c++ -bool Nan::IdleNotification(int idle_time_in_ms) -``` - -Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version. - - -### Nan::LowMemoryNotification() - -Signature: - -```c++ -void Nan::LowMemoryNotification() -``` - -Calls V8's [`LowMemoryNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a24647f61d6b41f69668094bdcd6ea91f). - - -### Nan::ContextDisposedNotification() - -Signature: - -```c++ -void Nan::ContextDisposedNotification() -``` - -Calls V8's [`ContextDisposedNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad7f5dc559866343fe6cd8db1f134d48b). - - -### Nan::GetInternalFieldPointer() - -Gets a pointer to the internal field with at `index` from a V8 `Object` handle. - -Signature: - -```c++ -void* Nan::GetInternalFieldPointer(v8::Local object, int index) -``` - -Calls the Object's [`GetAlignedPointerFromInternalField()` or `GetPointerFromInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a580ea84afb26c005d6762eeb9e3c308f) depending on the version of V8. - - -### Nan::SetInternalFieldPointer() - -Sets the value of the internal field at `index` on a V8 `Object` handle. - -Signature: - -```c++ -void Nan::SetInternalFieldPointer(v8::Local object, int index, void* value) -``` - -Calls the Object's [`SetAlignedPointerInInternalField()` or `SetPointerInInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c57184263cf29963ef0017bec82281) depending on the version of V8. - - -### Nan::AdjustExternalMemory() - -Signature: - -```c++ -int Nan::AdjustExternalMemory(int bytesChange) -``` - -Calls V8's [`AdjustAmountOfExternalAllocatedMemory()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ae1a59cac60409d3922582c4af675473e). - diff --git a/node_modules/nan/doc/v8_misc.md b/node_modules/nan/doc/v8_misc.md deleted file mode 100644 index 1bd46d3..0000000 --- a/node_modules/nan/doc/v8_misc.md +++ /dev/null @@ -1,85 +0,0 @@ -## Miscellaneous V8 Helpers - - - Nan::Utf8String - - Nan::GetCurrentContext() - - Nan::SetIsolateData() - - Nan::GetIsolateData() - - Nan::TypedArrayContents - - - -### Nan::Utf8String - -Converts an object to a UTF-8-encoded character array. If conversion to a string fails (e.g. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL. The underlying memory used for this object is managed by the object. - -An implementation of [`v8::String::Utf8Value`](https://v8docs.nodesource.com/node-8.16/d4/d1b/classv8_1_1_string_1_1_utf8_value.html) that is consistent across all supported versions of V8. - -Definition: - -```c++ -class Nan::Utf8String { - public: - Nan::Utf8String(v8::Local from); - - int length() const; - - char* operator*(); - const char* operator*() const; -}; -``` - - -### Nan::GetCurrentContext() - -A call to [`v8::Isolate::GetCurrent()->GetCurrentContext()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a81c7a1ed7001ae2a65e89107f75fd053) that works across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::GetCurrentContext() -``` - - -### Nan::SetIsolateData() - -A helper to provide a consistent API to [`v8::Isolate#SetData()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a7acadfe7965997e9c386a05f098fbe36). - -Signature: - -```c++ -void Nan::SetIsolateData(v8::Isolate *isolate, T *data) -``` - - - -### Nan::GetIsolateData() - -A helper to provide a consistent API to [`v8::Isolate#GetData()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aabd223436bc1100a787dadaa024c6257). - -Signature: - -```c++ -T *Nan::GetIsolateData(v8::Isolate *isolate) -``` - - -### Nan::TypedArrayContents - -A helper class for accessing the contents of an ArrayBufferView (aka a typedarray) from C++. If the input array is not a valid typedarray, then the data pointer of TypedArrayContents will default to `NULL` and the length will be 0. If the data pointer is not compatible with the alignment requirements of type, an assertion error will fail. - -Note that you must store a reference to the `array` object while you are accessing its contents. - -Definition: - -```c++ -template -class Nan::TypedArrayContents { - public: - TypedArrayContents(v8::Local array); - - size_t length() const; - - T* const operator*(); - const T* const operator*() const; -}; -``` diff --git a/node_modules/nan/include_dirs.js b/node_modules/nan/include_dirs.js deleted file mode 100644 index 4f1dfb4..0000000 --- a/node_modules/nan/include_dirs.js +++ /dev/null @@ -1 +0,0 @@ -console.log(require('path').relative('.', __dirname)); diff --git a/node_modules/nan/nan.h b/node_modules/nan/nan.h deleted file mode 100644 index 648e6e2..0000000 --- a/node_modules/nan/nan.h +++ /dev/null @@ -1,2891 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors: - * - Rod Vagg - * - Benjamin Byholm - * - Trevor Norris - * - Nathan Rajlich - * - Brett Lawson - * - Ben Noordhuis - * - David Siegel - * - Michael Ira Krufky - * - * MIT License - * - * Version 2.14.1: current Node 14.0.0, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1 - * - * See https://github.com/nodejs/nan for the latest update to this file - **********************************************************************************/ - -#ifndef NAN_H_ -#define NAN_H_ - -#include - -#define NODE_0_10_MODULE_VERSION 11 -#define NODE_0_12_MODULE_VERSION 14 -#define ATOM_0_21_MODULE_VERSION 41 -#define IOJS_1_0_MODULE_VERSION 42 -#define IOJS_1_1_MODULE_VERSION 43 -#define IOJS_2_0_MODULE_VERSION 44 -#define IOJS_3_0_MODULE_VERSION 45 -#define NODE_4_0_MODULE_VERSION 46 -#define NODE_5_0_MODULE_VERSION 47 -#define NODE_6_0_MODULE_VERSION 48 -#define NODE_7_0_MODULE_VERSION 51 -#define NODE_8_0_MODULE_VERSION 57 -#define NODE_9_0_MODULE_VERSION 59 -#define NODE_10_0_MODULE_VERSION 64 -#define NODE_11_0_MODULE_VERSION 67 -#define NODE_12_0_MODULE_VERSION 72 -#define NODE_13_0_MODULE_VERSION 79 -#define NODE_14_0_MODULE_VERSION 83 - -#ifdef _MSC_VER -# define NAN_HAS_CPLUSPLUS_11 (_MSC_VER >= 1800) -#else -# define NAN_HAS_CPLUSPLUS_11 (__cplusplus >= 201103L) -#endif - -#if NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION && !NAN_HAS_CPLUSPLUS_11 -# error This version of node/NAN/v8 requires a C++11 compiler -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(_MSC_VER) -# pragma warning( push ) -# pragma warning( disable : 4530 ) -# include -# include -# include -# pragma warning( pop ) -#else -# include -# include -# include -#endif - -// uv helpers -#ifdef UV_VERSION_MAJOR -# ifndef UV_VERSION_PATCH -# define UV_VERSION_PATCH 0 -# endif -# define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \ - (UV_VERSION_MINOR << 8) | \ - (UV_VERSION_PATCH)) -#else -# define NAUV_UVVERSION 0x000b00 -#endif - -#if NAUV_UVVERSION < 0x000b0b -# ifdef WIN32 -# include -# else -# include -# endif -#endif - -namespace Nan { - -#define NAN_CONCAT(a, b) NAN_CONCAT_HELPER(a, b) -#define NAN_CONCAT_HELPER(a, b) a##b - -#define NAN_INLINE inline // TODO(bnoordhuis) Remove in v3.0.0. - -#if defined(__GNUC__) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __declspec(deprecated) -#else -# define NAN_DEPRECATED -#endif - -#if NAN_HAS_CPLUSPLUS_11 -# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&) = delete; -# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&) = delete; -# define NAN_DISALLOW_MOVE(CLASS) \ - CLASS(CLASS&&) = delete; /* NOLINT(build/c++11) */ \ - void operator=(CLASS&&) = delete; -#else -# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&); -# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&); -# define NAN_DISALLOW_MOVE(CLASS) -#endif - -#define NAN_DISALLOW_ASSIGN_COPY(CLASS) \ - NAN_DISALLOW_ASSIGN(CLASS) \ - NAN_DISALLOW_COPY(CLASS) - -#define NAN_DISALLOW_ASSIGN_MOVE(CLASS) \ - NAN_DISALLOW_ASSIGN(CLASS) \ - NAN_DISALLOW_MOVE(CLASS) - -#define NAN_DISALLOW_COPY_MOVE(CLASS) \ - NAN_DISALLOW_COPY(CLASS) \ - NAN_DISALLOW_MOVE(CLASS) - -#define NAN_DISALLOW_ASSIGN_COPY_MOVE(CLASS) \ - NAN_DISALLOW_ASSIGN(CLASS) \ - NAN_DISALLOW_COPY(CLASS) \ - NAN_DISALLOW_MOVE(CLASS) - -#define TYPE_CHECK(T, S) \ - while (false) { \ - *(static_cast(0)) = static_cast(0); \ - } - -//=== RegistrationFunction ===================================================== - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - typedef v8::Handle ADDON_REGISTER_FUNCTION_ARGS_TYPE; -#else - typedef v8::Local ADDON_REGISTER_FUNCTION_ARGS_TYPE; -#endif - -#define NAN_MODULE_INIT(name) \ - void name(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) - -#if NODE_MAJOR_VERSION >= 10 || \ - NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 -#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ - extern "C" NODE_MODULE_EXPORT void \ - NAN_CONCAT(node_register_module_v, NODE_MODULE_VERSION)( \ - v8::Local exports, v8::Local module, \ - v8::Local context) \ - { \ - registration(exports); \ - } -#else -#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ - NODE_MODULE(module_name, registration) -#endif - -//=== CallbackInfo ============================================================= - -#include "nan_callbacks.h" // NOLINT(build/include) - -//============================================================================== - -#if (NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION) -typedef v8::Script UnboundScript; -typedef v8::Script BoundScript; -#else -typedef v8::UnboundScript UnboundScript; -typedef v8::Script BoundScript; -#endif - -#if (NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION) -typedef v8::String::ExternalAsciiStringResource - ExternalOneByteStringResource; -#else -typedef v8::String::ExternalOneByteStringResource - ExternalOneByteStringResource; -#endif - -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) -template -class NonCopyablePersistentTraits : - public v8::NonCopyablePersistentTraits {}; -template -class CopyablePersistentTraits : - public v8::CopyablePersistentTraits {}; - -template -class PersistentBase : - public v8::PersistentBase {}; - -template > -class Persistent; -#else -template class NonCopyablePersistentTraits; -template class PersistentBase; -template class WeakCallbackData; -template > -class Persistent; -#endif // NODE_MODULE_VERSION - -template -class Maybe { - public: - inline bool IsNothing() const { return !has_value_; } - inline bool IsJust() const { return has_value_; } - - inline T ToChecked() const { return FromJust(); } - inline void Check() const { FromJust(); } - - inline bool To(T* out) const { - if (IsJust()) *out = value_; - return IsJust(); - } - - inline T FromJust() const { -#if defined(V8_ENABLE_CHECKS) - assert(IsJust() && "FromJust is Nothing"); -#endif // V8_ENABLE_CHECKS - return value_; - } - - inline T FromMaybe(const T& default_value) const { - return has_value_ ? value_ : default_value; - } - - inline bool operator==(const Maybe &other) const { - return (IsJust() == other.IsJust()) && - (!IsJust() || FromJust() == other.FromJust()); - } - - inline bool operator!=(const Maybe &other) const { - return !operator==(other); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - // Allow implicit conversions from v8::Maybe to Nan::Maybe. - Maybe(const v8::Maybe& that) // NOLINT(runtime/explicit) - : has_value_(that.IsJust()) - , value_(that.FromMaybe(T())) {} -#endif - - private: - Maybe() : has_value_(false) {} - explicit Maybe(const T& t) : has_value_(true), value_(t) {} - bool has_value_; - T value_; - - template - friend Maybe Nothing(); - template - friend Maybe Just(const U& u); -}; - -template -inline Maybe Nothing() { - return Maybe(); -} - -template -inline Maybe Just(const T& t) { - return Maybe(t); -} - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -# include "nan_maybe_43_inl.h" // NOLINT(build/include) -#else -# include "nan_maybe_pre_43_inl.h" // NOLINT(build/include) -#endif - -#include "nan_converters.h" // NOLINT(build/include) -#include "nan_new.h" // NOLINT(build/include) - -#if NAUV_UVVERSION < 0x000b17 -#define NAUV_WORK_CB(func) \ - void func(uv_async_t *async, int) -#else -#define NAUV_WORK_CB(func) \ - void func(uv_async_t *async) -#endif - -#if NAUV_UVVERSION >= 0x000b0b - -typedef uv_key_t nauv_key_t; - -inline int nauv_key_create(nauv_key_t *key) { - return uv_key_create(key); -} - -inline void nauv_key_delete(nauv_key_t *key) { - uv_key_delete(key); -} - -inline void* nauv_key_get(nauv_key_t *key) { - return uv_key_get(key); -} - -inline void nauv_key_set(nauv_key_t *key, void *value) { - uv_key_set(key, value); -} - -#else - -/* Implement thread local storage for older versions of libuv. - * This is essentially a backport of libuv commit 5d2434bf - * written by Ben Noordhuis, adjusted for names and inline. - */ - -#ifndef WIN32 - -typedef pthread_key_t nauv_key_t; - -inline int nauv_key_create(nauv_key_t* key) { - return -pthread_key_create(key, NULL); -} - -inline void nauv_key_delete(nauv_key_t* key) { - if (pthread_key_delete(*key)) - abort(); -} - -inline void* nauv_key_get(nauv_key_t* key) { - return pthread_getspecific(*key); -} - -inline void nauv_key_set(nauv_key_t* key, void* value) { - if (pthread_setspecific(*key, value)) - abort(); -} - -#else - -typedef struct { - DWORD tls_index; -} nauv_key_t; - -inline int nauv_key_create(nauv_key_t* key) { - key->tls_index = TlsAlloc(); - if (key->tls_index == TLS_OUT_OF_INDEXES) - return UV_ENOMEM; - return 0; -} - -inline void nauv_key_delete(nauv_key_t* key) { - if (TlsFree(key->tls_index) == FALSE) - abort(); - key->tls_index = TLS_OUT_OF_INDEXES; -} - -inline void* nauv_key_get(nauv_key_t* key) { - void* value = TlsGetValue(key->tls_index); - if (value == NULL) - if (GetLastError() != ERROR_SUCCESS) - abort(); - return value; -} - -inline void nauv_key_set(nauv_key_t* key, void* value) { - if (TlsSetValue(key->tls_index, value) == FALSE) - abort(); -} - -#endif -#endif - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION -template -v8::Local New(v8::Handle); -#endif - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - typedef v8::WeakCallbackType WeakCallbackType; -#else -struct WeakCallbackType { - enum E {kParameter, kInternalFields}; - E type; - WeakCallbackType(E other) : type(other) {} // NOLINT(runtime/explicit) - inline bool operator==(E other) { return other == this->type; } - inline bool operator!=(E other) { return !operator==(other); } -}; -#endif - -template class WeakCallbackInfo; - -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -# include "nan_persistent_12_inl.h" // NOLINT(build/include) -#else -# include "nan_persistent_pre_12_inl.h" // NOLINT(build/include) -#endif - -namespace imp { - static const size_t kMaxLength = 0x3fffffff; - // v8::String::REPLACE_INVALID_UTF8 was introduced - // in node.js v0.10.29 and v0.8.27. -#if NODE_MAJOR_VERSION > 0 || \ - NODE_MINOR_VERSION > 10 || \ - NODE_MINOR_VERSION == 10 && NODE_PATCH_VERSION >= 29 || \ - NODE_MINOR_VERSION == 8 && NODE_PATCH_VERSION >= 27 - static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8; -#else - static const unsigned kReplaceInvalidUtf8 = 0; -#endif -} // end of namespace imp - -//=== HandleScope ============================================================== - -class HandleScope { - v8::HandleScope scope; - - public: -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - inline HandleScope() : scope(v8::Isolate::GetCurrent()) {} - inline static int NumberOfHandles() { - return v8::HandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); - } -#else - inline HandleScope() : scope() {} - inline static int NumberOfHandles() { - return v8::HandleScope::NumberOfHandles(); - } -#endif - - private: - // Make it hard to create heap-allocated or illegal handle scopes by - // disallowing certain operations. - HandleScope(const HandleScope &); - void operator=(const HandleScope &); - void *operator new(size_t size); - void operator delete(void *, size_t) { - abort(); - } -}; - -class EscapableHandleScope { - public: -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - inline EscapableHandleScope() : scope(v8::Isolate::GetCurrent()) {} - - inline static int NumberOfHandles() { - return v8::EscapableHandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); - } - - template - inline v8::Local Escape(v8::Local value) { - return scope.Escape(value); - } - - private: - v8::EscapableHandleScope scope; -#else - inline EscapableHandleScope() : scope() {} - - inline static int NumberOfHandles() { - return v8::HandleScope::NumberOfHandles(); - } - - template - inline v8::Local Escape(v8::Local value) { - return scope.Close(value); - } - - private: - v8::HandleScope scope; -#endif - - private: - // Make it hard to create heap-allocated or illegal handle scopes by - // disallowing certain operations. - EscapableHandleScope(const EscapableHandleScope &); - void operator=(const EscapableHandleScope &); - void *operator new(size_t size); - void operator delete(void *, size_t) { - abort(); - } -}; - -//=== TryCatch ================================================================= - -class TryCatch { - v8::TryCatch try_catch_; - friend void FatalException(const TryCatch&); - - public: -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - TryCatch() : try_catch_(v8::Isolate::GetCurrent()) {} -#endif - - inline bool HasCaught() const { return try_catch_.HasCaught(); } - - inline bool CanContinue() const { return try_catch_.CanContinue(); } - - inline v8::Local ReThrow() { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - return New(try_catch_.ReThrow()); -#else - return try_catch_.ReThrow(); -#endif - } - - inline v8::Local Exception() const { - return try_catch_.Exception(); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline v8::MaybeLocal StackTrace() const { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(try_catch_.StackTrace(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); - } -#else - inline MaybeLocal StackTrace() const { - return try_catch_.StackTrace(); - } -#endif - - inline v8::Local Message() const { - return try_catch_.Message(); - } - - inline void Reset() { try_catch_.Reset(); } - - inline void SetVerbose(bool value) { try_catch_.SetVerbose(value); } - - inline void SetCaptureMessage(bool value) { - try_catch_.SetCaptureMessage(value); - } -}; - -v8::Local MakeCallback(v8::Local target, - v8::Local func, - int argc, - v8::Local* argv); -v8::Local MakeCallback(v8::Local target, - v8::Local symbol, - int argc, - v8::Local* argv); -v8::Local MakeCallback(v8::Local target, - const char* method, - int argc, - v8::Local* argv); - -// === AsyncResource =========================================================== - -class AsyncResource { - public: - AsyncResource( - v8::Local name - , v8::Local resource = New()) { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - - if (resource.IsEmpty()) { - resource = New(); - } - - context = node::EmitAsyncInit(isolate, resource, name); -#endif - } - - AsyncResource( - const char* name - , v8::Local resource = New()) { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - - if (resource.IsEmpty()) { - resource = New(); - } - - v8::Local name_string = - New(name).ToLocalChecked(); - context = node::EmitAsyncInit(isolate, resource, name_string); -#endif - } - - ~AsyncResource() { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - node::EmitAsyncDestroy(isolate, context); -#endif - } - - inline MaybeLocal runInAsyncScope( - v8::Local target - , v8::Local func - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION - return MakeCallback(target, func, argc, argv); -#else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv, context); -#endif - } - - inline MaybeLocal runInAsyncScope( - v8::Local target - , v8::Local symbol - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION - return MakeCallback(target, symbol, argc, argv); -#else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv, context); -#endif - } - - inline MaybeLocal runInAsyncScope( - v8::Local target - , const char* method - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION - return MakeCallback(target, method, argc, argv); -#else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv, context); -#endif - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncResource) -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - node::async_context context; -#endif -}; - -inline uv_loop_t* GetCurrentEventLoop() { -#if NODE_MAJOR_VERSION >= 10 || \ - NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 || \ - NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION >= 10 - return node::GetCurrentEventLoop(v8::Isolate::GetCurrent()); -#else - return uv_default_loop(); -#endif -} - -//============ ================================================================= - -/* node 0.12 */ -#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION - inline - void SetCounterFunction(v8::CounterLookupCallback cb) { - v8::Isolate::GetCurrent()->SetCounterFunction(cb); - } - - inline - void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { - v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); - } - - inline - void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { - v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline bool IdleNotification(int idle_time_in_ms) { - return v8::Isolate::GetCurrent()->IdleNotificationDeadline( - idle_time_in_ms * 0.001); - } -# else - inline bool IdleNotification(int idle_time_in_ms) { - return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); - } -#endif - - inline void LowMemoryNotification() { - v8::Isolate::GetCurrent()->LowMemoryNotification(); - } - - inline void ContextDisposedNotification() { - v8::Isolate::GetCurrent()->ContextDisposedNotification(); - } -#else - inline - void SetCounterFunction(v8::CounterLookupCallback cb) { - v8::V8::SetCounterFunction(cb); - } - - inline - void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { - v8::V8::SetCreateHistogramFunction(cb); - } - - inline - void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { - v8::V8::SetAddHistogramSampleFunction(cb); - } - - inline bool IdleNotification(int idle_time_in_ms) { - return v8::V8::IdleNotification(idle_time_in_ms); - } - - inline void LowMemoryNotification() { - v8::V8::LowMemoryNotification(); - } - - inline void ContextDisposedNotification() { - v8::V8::ContextDisposedNotification(); - } -#endif - -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) // Node 0.12 - inline v8::Local Undefined() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::Undefined(v8::Isolate::GetCurrent()))); -# else - return v8::Undefined(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local Null() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::Null(v8::Isolate::GetCurrent()))); -# else - return v8::Null(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local True() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::True(v8::Isolate::GetCurrent()))); -# else - return v8::True(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local False() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::False(v8::Isolate::GetCurrent()))); -# else - return v8::False(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local EmptyString() { - return v8::String::Empty(v8::Isolate::GetCurrent()); - } - - inline int AdjustExternalMemory(int bc) { - return static_cast( - v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); - } - - inline void SetTemplate( - v8::Local templ - , const char *name - , v8::Local value) { - templ->Set(v8::Isolate::GetCurrent(), name, value); - } - - inline void SetTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - inline v8::Local GetCurrentContext() { - return v8::Isolate::GetCurrent()->GetCurrentContext(); - } - - inline void* GetInternalFieldPointer( - v8::Local object - , int index) { - return object->GetAlignedPointerFromInternalField(index); - } - - inline void SetInternalFieldPointer( - v8::Local object - , int index - , void* value) { - object->SetAlignedPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) - -#if NODE_MODULE_VERSION <= NODE_4_0_MODULE_VERSION - typedef v8::Isolate::GCEpilogueCallback GCEpilogueCallback; - typedef v8::Isolate::GCPrologueCallback GCPrologueCallback; -#else - typedef v8::Isolate::GCCallback GCEpilogueCallback; - typedef v8::Isolate::GCCallback GCPrologueCallback; -#endif - - inline void AddGCEpilogueCallback( - GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); - } - - inline void RemoveGCEpilogueCallback( - GCEpilogueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); - } - - inline void AddGCPrologueCallback( - GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); - } - - inline void RemoveGCPrologueCallback( - GCPrologueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); - } - - inline void GetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); - } - -# define X(NAME) \ - inline v8::Local NAME(const char *msg) { \ - EscapableHandleScope scope; \ - return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline \ - v8::Local NAME(v8::Local msg) { \ - return v8::Exception::NAME(msg); \ - } \ - \ - inline void Throw ## NAME(const char *msg) { \ - HandleScope scope; \ - v8::Isolate::GetCurrent()->ThrowException( \ - v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline void Throw ## NAME(v8::Local msg) { \ - HandleScope scope; \ - v8::Isolate::GetCurrent()->ThrowException( \ - v8::Exception::NAME(msg)); \ - } - - X(Error) - X(RangeError) - X(ReferenceError) - X(SyntaxError) - X(TypeError) - -# undef X - - inline void ThrowError(v8::Local error) { - v8::Isolate::GetCurrent()->ThrowException(error); - } - - inline MaybeLocal NewBuffer( - char *data - , size_t length -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - , node::Buffer::FreeCallback callback -#else - , node::smalloc::FreeCallback callback -#endif - , void *hint - ) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(length <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::New( - v8::Isolate::GetCurrent(), data, length, callback, hint); -#else - return node::Buffer::New(v8::Isolate::GetCurrent(), data, length, callback, - hint); -#endif - } - - inline MaybeLocal CopyBuffer( - const char *data - , uint32_t size - ) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::Copy( - v8::Isolate::GetCurrent(), data, size); -#else - return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); -#endif - } - - inline MaybeLocal NewBuffer(uint32_t size) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::New( - v8::Isolate::GetCurrent(), size); -#else - return node::Buffer::New(v8::Isolate::GetCurrent(), size); -#endif - } - - inline MaybeLocal NewBuffer( - char* data - , uint32_t size - ) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); -#else - return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); -#endif - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline MaybeLocal - NewOneByteString(const uint8_t * value, int length = -1) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, - v8::NewStringType::kNormal, length); - } - - inline MaybeLocal CompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source source(s, origin); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) - .FromMaybe(v8::Local())); - } - - inline MaybeLocal CompileScript( - v8::Local s - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source source(s); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) - .FromMaybe(v8::Local())); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(script->BindToCurrentContext() - ->Run(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(script->Run(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); - } -#else - inline MaybeLocal - NewOneByteString(const uint8_t * value, int length = -1) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, - v8::String::kNormalString, length); - } - - inline MaybeLocal CompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - v8::ScriptCompiler::Source source(s, origin); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - inline MaybeLocal CompileScript( - v8::Local s - ) { - v8::ScriptCompiler::Source source(s); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - EscapableHandleScope scope; - return scope.Escape(script->BindToCurrentContext()->Run()); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - return script->Run(); - } -#endif - - NAN_DEPRECATED inline v8::Local MakeCallback( - v8::Local target - , v8::Local func - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv))); -#else -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource res("nan:makeCallback"); - return res.runInAsyncScope(target, func, argc, argv) - .FromMaybe(v8::Local()); -# else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - } - - NAN_DEPRECATED inline v8::Local MakeCallback( - v8::Local target - , v8::Local symbol - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv))); -#else -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource res("nan:makeCallback"); - return res.runInAsyncScope(target, symbol, argc, argv) - .FromMaybe(v8::Local()); -# else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - } - - NAN_DEPRECATED inline v8::Local MakeCallback( - v8::Local target - , const char* method - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv))); -#else -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource res("nan:makeCallback"); - return res.runInAsyncScope(target, method, argc, argv) - .FromMaybe(v8::Local()); -# else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - } - - inline void FatalException(const TryCatch& try_catch) { - node::FatalException(v8::Isolate::GetCurrent(), try_catch.try_catch_); - } - - inline v8::Local ErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return node::ErrnoException(v8::Isolate::GetCurrent(), errorno, syscall, - message, path); - } - - NAN_DEPRECATED inline v8::Local NanErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return ErrnoException(errorno, syscall, message, path); - } - - template - inline void SetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(0, data); - } - - template - inline T *GetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData(0)); - } - -class Utf8String { - public: - inline explicit Utf8String(v8::Local from) : - length_(0), str_(str_st_) { - HandleScope scope; - if (!from.IsEmpty()) { -#if NODE_MAJOR_VERSION >= 10 - v8::Local context = GetCurrentContext(); - v8::Local string = - from->ToString(context).FromMaybe(v8::Local()); -#else - v8::Local string = from->ToString(); -#endif - if (!string.IsEmpty()) { - size_t len = 3 * string->Length() + 1; - assert(len <= INT_MAX); - if (len > sizeof (str_st_)) { - str_ = static_cast(malloc(len)); - assert(str_ != 0); - } - const int flags = - v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; -#if NODE_MAJOR_VERSION >= 11 - length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, - static_cast(len), 0, flags); -#else - // See https://github.com/nodejs/nan/issues/832. - // Disable the warning as there is no way around it. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4996) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#endif // NODE_MAJOR_VERSION < 11 - str_[length_] = '\0'; - } - } - } - - inline int length() const { - return length_; - } - - inline char* operator*() { return str_; } - inline const char* operator*() const { return str_; } - - inline ~Utf8String() { - if (str_ != str_st_) { - free(str_); - } - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) - - int length_; - char *str_; - char str_st_[1024]; -}; - -#else // Node 0.8 and 0.10 - inline v8::Local Undefined() { - EscapableHandleScope scope; - return scope.Escape(New(v8::Undefined())); - } - - inline v8::Local Null() { - EscapableHandleScope scope; - return scope.Escape(New(v8::Null())); - } - - inline v8::Local True() { - EscapableHandleScope scope; - return scope.Escape(New(v8::True())); - } - - inline v8::Local False() { - EscapableHandleScope scope; - return scope.Escape(New(v8::False())); - } - - inline v8::Local EmptyString() { - return v8::String::Empty(); - } - - inline int AdjustExternalMemory(int bc) { - return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); - } - - inline void SetTemplate( - v8::Local templ - , const char *name - , v8::Local value) { - templ->Set(name, value); - } - - inline void SetTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - inline v8::Local GetCurrentContext() { - return v8::Context::GetCurrent(); - } - - inline void* GetInternalFieldPointer( - v8::Local object - , int index) { - return object->GetPointerFromInternalField(index); - } - - inline void SetInternalFieldPointer( - v8::Local object - , int index - , void* value) { - object->SetPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::GCType type, v8::GCCallbackFlags flags) - - inline void AddGCEpilogueCallback( - v8::GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCEpilogueCallback(callback, gc_type_filter); - } - inline void RemoveGCEpilogueCallback( - v8::GCEpilogueCallback callback) { - v8::V8::RemoveGCEpilogueCallback(callback); - } - inline void AddGCPrologueCallback( - v8::GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCPrologueCallback(callback, gc_type_filter); - } - inline void RemoveGCPrologueCallback( - v8::GCPrologueCallback callback) { - v8::V8::RemoveGCPrologueCallback(callback); - } - inline void GetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::V8::GetHeapStatistics(heap_statistics); - } - -# define X(NAME) \ - inline v8::Local NAME(const char *msg) { \ - EscapableHandleScope scope; \ - return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline \ - v8::Local NAME(v8::Local msg) { \ - return v8::Exception::NAME(msg); \ - } \ - \ - inline void Throw ## NAME(const char *msg) { \ - HandleScope scope; \ - v8::ThrowException(v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline \ - void Throw ## NAME(v8::Local errmsg) { \ - HandleScope scope; \ - v8::ThrowException(v8::Exception::NAME(errmsg)); \ - } - - X(Error) - X(RangeError) - X(ReferenceError) - X(SyntaxError) - X(TypeError) - -# undef X - - inline void ThrowError(v8::Local error) { - v8::ThrowException(error); - } - - inline MaybeLocal NewBuffer( - char *data - , size_t length - , node::Buffer::free_callback callback - , void *hint - ) { - EscapableHandleScope scope; - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(length <= imp::kMaxLength && "too large buffer"); - return scope.Escape( - New(node::Buffer::New(data, length, callback, hint)->handle_)); - } - - inline MaybeLocal CopyBuffer( - const char *data - , uint32_t size - ) { - EscapableHandleScope scope; - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION - return scope.Escape(New(node::Buffer::New(data, size)->handle_)); -#else - return scope.Escape( - New(node::Buffer::New(const_cast(data), size)->handle_)); -#endif - } - - inline MaybeLocal NewBuffer(uint32_t size) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - assert(size <= imp::kMaxLength && "too large buffer"); - return scope.Escape(New(node::Buffer::New(size)->handle_)); - } - - inline void FreeData(char *data, void *hint) { - (void) hint; // unused - delete[] data; - } - - inline MaybeLocal NewBuffer( - char* data - , uint32_t size - ) { - EscapableHandleScope scope; - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); - return scope.Escape( - New(node::Buffer::New(data, size, FreeData, NULL)->handle_)); - } - -namespace imp { -inline void -widenString(std::vector *ws, const uint8_t *s, int l) { - size_t len = static_cast(l); - if (l < 0) { - len = strlen(reinterpret_cast(s)); - } - assert(len <= INT_MAX && "string too long"); - ws->resize(len); - std::copy(s, s + len, ws->begin()); // NOLINT(build/include_what_you_use) -} -} // end of namespace imp - - inline MaybeLocal - NewOneByteString(const uint8_t * value, int length = -1) { - std::vector wideString; // NOLINT(build/include_what_you_use) - imp::widenString(&wideString, value, length); - return v8::String::New(wideString.data(), - static_cast(wideString.size())); - } - - inline MaybeLocal CompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - return v8::Script::Compile(s, const_cast(&origin)); - } - - inline MaybeLocal CompileScript( - v8::Local s - ) { - return v8::Script::Compile(s); - } - - inline - MaybeLocal RunScript(v8::Local script) { - return script->Run(); - } - - inline v8::Local MakeCallback( - v8::Local target - , v8::Local func - , int argc - , v8::Local* argv) { - v8::HandleScope scope; - return scope.Close(New(node::MakeCallback(target, func, argc, argv))); - } - - inline v8::Local MakeCallback( - v8::Local target - , v8::Local symbol - , int argc - , v8::Local* argv) { - v8::HandleScope scope; - return scope.Close(New(node::MakeCallback(target, symbol, argc, argv))); - } - - inline v8::Local MakeCallback( - v8::Local target - , const char* method - , int argc - , v8::Local* argv) { - v8::HandleScope scope; - return scope.Close(New(node::MakeCallback(target, method, argc, argv))); - } - - inline void FatalException(const TryCatch& try_catch) { - node::FatalException(const_cast(try_catch.try_catch_)); - } - - inline v8::Local ErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return node::ErrnoException(errorno, syscall, message, path); - } - - NAN_DEPRECATED inline v8::Local NanErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return ErrnoException(errorno, syscall, message, path); - } - - - template - inline void SetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(data); - } - - template - inline T *GetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData()); - } - -class Utf8String { - public: - inline explicit Utf8String(v8::Local from) : - length_(0), str_(str_st_) { - v8::HandleScope scope; - if (!from.IsEmpty()) { - v8::Local string = from->ToString(); - if (!string.IsEmpty()) { - size_t len = 3 * string->Length() + 1; - assert(len <= INT_MAX); - if (len > sizeof (str_st_)) { - str_ = static_cast(malloc(len)); - assert(str_ != 0); - } - const int flags = - v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; - length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); - str_[length_] = '\0'; - } - } - } - - inline int length() const { - return length_; - } - - inline char* operator*() { return str_; } - inline const char* operator*() const { return str_; } - - inline ~Utf8String() { - if (str_ != str_st_) { - free(str_); - } - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) - - int length_; - char *str_; - char str_st_[1024]; -}; - -#endif // NODE_MODULE_VERSION - -typedef void (*FreeCallback)(char *data, void *hint); - -typedef const FunctionCallbackInfo& NAN_METHOD_ARGS_TYPE; -typedef void NAN_METHOD_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_GETTER_ARGS_TYPE; -typedef void NAN_GETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_SETTER_ARGS_TYPE; -typedef void NAN_SETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_GETTER_ARGS_TYPE; -typedef void NAN_PROPERTY_GETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_SETTER_ARGS_TYPE; -typedef void NAN_PROPERTY_SETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_ENUMERATOR_ARGS_TYPE; -typedef void NAN_PROPERTY_ENUMERATOR_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_DELETER_ARGS_TYPE; -typedef void NAN_PROPERTY_DELETER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_QUERY_ARGS_TYPE; -typedef void NAN_PROPERTY_QUERY_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_INDEX_GETTER_ARGS_TYPE; -typedef void NAN_INDEX_GETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_INDEX_SETTER_ARGS_TYPE; -typedef void NAN_INDEX_SETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_INDEX_ENUMERATOR_ARGS_TYPE; -typedef void NAN_INDEX_ENUMERATOR_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_INDEX_DELETER_ARGS_TYPE; -typedef void NAN_INDEX_DELETER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_INDEX_QUERY_ARGS_TYPE; -typedef void NAN_INDEX_QUERY_RETURN_TYPE; - -#define NAN_METHOD(name) \ - Nan::NAN_METHOD_RETURN_TYPE name(Nan::NAN_METHOD_ARGS_TYPE info) -#define NAN_GETTER(name) \ - Nan::NAN_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_GETTER_ARGS_TYPE info) -#define NAN_SETTER(name) \ - Nan::NAN_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , Nan::NAN_SETTER_ARGS_TYPE info) -#define NAN_PROPERTY_GETTER(name) \ - Nan::NAN_PROPERTY_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_PROPERTY_GETTER_ARGS_TYPE info) -#define NAN_PROPERTY_SETTER(name) \ - Nan::NAN_PROPERTY_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , Nan::NAN_PROPERTY_SETTER_ARGS_TYPE info) -#define NAN_PROPERTY_ENUMERATOR(name) \ - Nan::NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name( \ - Nan::NAN_PROPERTY_ENUMERATOR_ARGS_TYPE info) -#define NAN_PROPERTY_DELETER(name) \ - Nan::NAN_PROPERTY_DELETER_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_PROPERTY_DELETER_ARGS_TYPE info) -#define NAN_PROPERTY_QUERY(name) \ - Nan::NAN_PROPERTY_QUERY_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_PROPERTY_QUERY_ARGS_TYPE info) -# define NAN_INDEX_GETTER(name) \ - Nan::NAN_INDEX_GETTER_RETURN_TYPE name( \ - uint32_t index \ - , Nan::NAN_INDEX_GETTER_ARGS_TYPE info) -#define NAN_INDEX_SETTER(name) \ - Nan::NAN_INDEX_SETTER_RETURN_TYPE name( \ - uint32_t index \ - , v8::Local value \ - , Nan::NAN_INDEX_SETTER_ARGS_TYPE info) -#define NAN_INDEX_ENUMERATOR(name) \ - Nan::NAN_INDEX_ENUMERATOR_RETURN_TYPE \ - name(Nan::NAN_INDEX_ENUMERATOR_ARGS_TYPE info) -#define NAN_INDEX_DELETER(name) \ - Nan::NAN_INDEX_DELETER_RETURN_TYPE name( \ - uint32_t index \ - , Nan::NAN_INDEX_DELETER_ARGS_TYPE info) -#define NAN_INDEX_QUERY(name) \ - Nan::NAN_INDEX_QUERY_RETURN_TYPE name( \ - uint32_t index \ - , Nan::NAN_INDEX_QUERY_ARGS_TYPE info) - -class Callback { - public: - Callback() {} - - explicit Callback(const v8::Local &fn) : handle_(fn) {} - - ~Callback() { - handle_.Reset(); - } - - bool operator==(const Callback &other) const { - return handle_ == other.handle_; - } - - bool operator!=(const Callback &other) const { - return !operator==(other); - } - - inline - v8::Local operator*() const { return GetFunction(); } - - NAN_DEPRECATED inline v8::Local operator()( - v8::Local target - , int argc = 0 - , v8::Local argv[] = 0) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:operator()"); - return Call_(isolate, target, argc, argv, &async) - .FromMaybe(v8::Local()); -# else - return Call_(isolate, target, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - return Call_(target, argc, argv); -#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - } - - NAN_DEPRECATED inline v8::Local operator()( - int argc = 0 - , v8::Local argv[] = 0) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:operator()"); - return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), - argc, argv, &async) - .FromMaybe(v8::Local())); -# else - return scope.Escape( - Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - v8::HandleScope scope; - return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); -#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - } - - inline MaybeLocal operator()( - AsyncResource* resource - , int argc = 0 - , v8::Local argv[] = 0) const { - return this->Call(argc, argv, resource); - } - - inline MaybeLocal operator()( - AsyncResource* resource - , v8::Local target - , int argc = 0 - , v8::Local argv[] = 0) const { - return this->Call(target, argc, argv, resource); - } - - // TODO(kkoopa): remove - inline void SetFunction(const v8::Local &fn) { - Reset(fn); - } - - inline void Reset(const v8::Local &fn) { - handle_.Reset(fn); - } - - inline void Reset() { - handle_.Reset(); - } - - inline v8::Local GetFunction() const { - return New(handle_); - } - - inline bool IsEmpty() const { - return handle_.IsEmpty(); - } - - // Deprecated: For async callbacks Use the versions that accept an - // AsyncResource. If this callback does not correspond to an async resource, - // that is, it is a synchronous function call on a non-empty JS stack, you - // should Nan::Call instead. - NAN_DEPRECATED inline v8::Local - Call(v8::Local target - , int argc - , v8::Local argv[]) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:Call"); - return Call_(isolate, target, argc, argv, &async) - .FromMaybe(v8::Local()); -# else - return Call_(isolate, target, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - return Call_(target, argc, argv); -#endif - } - - // Deprecated: For async callbacks Use the versions that accept an - // AsyncResource. If this callback does not correspond to an async resource, - // that is, it is a synchronous function call on a non-empty JS stack, you - // should Nan::Call instead. - NAN_DEPRECATED inline v8::Local - Call(int argc, v8::Local argv[]) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:Call"); - return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), - argc, argv, &async) - .FromMaybe(v8::Local())); -# else - return scope.Escape( - Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - v8::HandleScope scope; - return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); -#endif - } - - inline MaybeLocal - Call(v8::Local target - , int argc - , v8::Local argv[] - , AsyncResource* resource) const { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - return Call_(isolate, target, argc, argv, resource); -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - return Call_(isolate, target, argc, argv); -#else - return Call_(target, argc, argv); -#endif - } - - inline MaybeLocal - Call(int argc, v8::Local argv[], AsyncResource* resource) const { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - return Call(isolate->GetCurrentContext()->Global(), argc, argv, resource); -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); -#else - v8::HandleScope scope; - return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); -#endif - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(Callback) - Persistent handle_; - -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - MaybeLocal Call_(v8::Isolate *isolate - , v8::Local target - , int argc - , v8::Local argv[] - , AsyncResource* resource) const { - EscapableHandleScope scope; - v8::Local func = New(handle_); - auto maybe = resource->runInAsyncScope(target, func, argc, argv); - v8::Local local; - if (!maybe.ToLocal(&local)) return MaybeLocal(); - return scope.Escape(local); - } -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Local Call_(v8::Isolate *isolate - , v8::Local target - , int argc - , v8::Local argv[]) const { - EscapableHandleScope scope; - - v8::Local callback = New(handle_); -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - return scope.Escape(New(node::MakeCallback( - isolate - , target - , callback - , argc - , argv - ))); -# else - return scope.Escape(node::MakeCallback( - isolate - , target - , callback - , argc - , argv - )); -# endif - } -#else - v8::Local Call_(v8::Local target - , int argc - , v8::Local argv[]) const { - EscapableHandleScope scope; - - v8::Local callback = New(handle_); - return scope.Escape(New(node::MakeCallback( - target - , callback - , argc - , argv - ))); - } -#endif -}; - -inline MaybeLocal Call( - const Nan::Callback& callback - , v8::Local recv - , int argc - , v8::Local argv[]) { - return Call(*callback, recv, argc, argv); -} - -inline MaybeLocal Call( - const Nan::Callback& callback - , int argc - , v8::Local argv[]) { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - Call(*callback, isolate->GetCurrentContext()->Global(), argc, argv) - .FromMaybe(v8::Local())); -#else - EscapableHandleScope scope; - return scope.Escape( - Call(*callback, v8::Context::GetCurrent()->Global(), argc, argv) - .FromMaybe(v8::Local())); -#endif -} - -inline MaybeLocal Call( - v8::Local symbol - , v8::Local recv - , int argc - , v8::Local argv[]) { - EscapableHandleScope scope; - v8::Local fn_v = - Get(recv, symbol).FromMaybe(v8::Local()); - if (fn_v.IsEmpty() || !fn_v->IsFunction()) return v8::Local(); - v8::Local fn = fn_v.As(); - return scope.Escape( - Call(fn, recv, argc, argv).FromMaybe(v8::Local())); -} - -inline MaybeLocal Call( - const char* method - , v8::Local recv - , int argc - , v8::Local argv[]) { - EscapableHandleScope scope; - v8::Local method_string = - New(method).ToLocalChecked(); - return scope.Escape( - Call(method_string, recv, argc, argv).FromMaybe(v8::Local())); -} - -/* abstract */ class AsyncWorker { - public: - explicit AsyncWorker(Callback *callback_, - const char* resource_name = "nan:AsyncWorker") - : callback(callback_), errmsg_(NULL) { - request.data = this; - - HandleScope scope; - v8::Local obj = New(); - persistentHandle.Reset(obj); - async_resource = new AsyncResource(resource_name, obj); - } - - virtual ~AsyncWorker() { - HandleScope scope; - - if (!persistentHandle.IsEmpty()) - persistentHandle.Reset(); - delete callback; - delete[] errmsg_; - delete async_resource; - } - - virtual void WorkComplete() { - HandleScope scope; - - if (errmsg_ == NULL) - HandleOKCallback(); - else - HandleErrorCallback(); - delete callback; - callback = NULL; - } - - inline void SaveToPersistent( - const char *key, const v8::Local &value) { - HandleScope scope; - Set(New(persistentHandle), New(key).ToLocalChecked(), value).FromJust(); - } - - inline void SaveToPersistent( - const v8::Local &key, const v8::Local &value) { - HandleScope scope; - Set(New(persistentHandle), key, value).FromJust(); - } - - inline void SaveToPersistent( - uint32_t index, const v8::Local &value) { - HandleScope scope; - Set(New(persistentHandle), index, value).FromJust(); - } - - inline v8::Local GetFromPersistent(const char *key) const { - EscapableHandleScope scope; - return scope.Escape( - Get(New(persistentHandle), New(key).ToLocalChecked()) - .FromMaybe(v8::Local())); - } - - inline v8::Local - GetFromPersistent(const v8::Local &key) const { - EscapableHandleScope scope; - return scope.Escape( - Get(New(persistentHandle), key) - .FromMaybe(v8::Local())); - } - - inline v8::Local GetFromPersistent(uint32_t index) const { - EscapableHandleScope scope; - return scope.Escape( - Get(New(persistentHandle), index) - .FromMaybe(v8::Local())); - } - - virtual void Execute() = 0; - - uv_work_t request; - - virtual void Destroy() { - delete this; - } - - protected: - Persistent persistentHandle; - Callback *callback; - AsyncResource *async_resource; - - virtual void HandleOKCallback() { - HandleScope scope; - - callback->Call(0, NULL, async_resource); - } - - virtual void HandleErrorCallback() { - HandleScope scope; - - v8::Local argv[] = { - v8::Exception::Error(New(ErrorMessage()).ToLocalChecked()) - }; - callback->Call(1, argv, async_resource); - } - - void SetErrorMessage(const char *msg) { - delete[] errmsg_; - - size_t size = strlen(msg) + 1; - errmsg_ = new char[size]; - memcpy(errmsg_, msg, size); - } - - const char* ErrorMessage() const { - return errmsg_; - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncWorker) - char *errmsg_; -}; - -/* abstract */ class AsyncBareProgressWorkerBase : public AsyncWorker { - public: - explicit AsyncBareProgressWorkerBase( - Callback *callback_, - const char* resource_name = "nan:AsyncBareProgressWorkerBase") - : AsyncWorker(callback_, resource_name) { - uv_async_init( - GetCurrentEventLoop() - , &async - , AsyncProgress_ - ); - async.data = this; - } - - virtual ~AsyncBareProgressWorkerBase() { - } - - virtual void WorkProgress() = 0; - - virtual void Destroy() { - uv_close(reinterpret_cast(&async), AsyncClose_); - } - - private: - inline static NAUV_WORK_CB(AsyncProgress_) { - AsyncBareProgressWorkerBase *worker = - static_cast(async->data); - worker->WorkProgress(); - } - - inline static void AsyncClose_(uv_handle_t* handle) { - AsyncBareProgressWorkerBase *worker = - static_cast(handle->data); - delete worker; - } - - protected: - uv_async_t async; -}; - -template -/* abstract */ -class AsyncBareProgressWorker : public AsyncBareProgressWorkerBase { - public: - explicit AsyncBareProgressWorker( - Callback *callback_, - const char* resource_name = "nan:AsyncBareProgressWorker") - : AsyncBareProgressWorkerBase(callback_, resource_name) { - uv_mutex_init(&async_lock); - } - - virtual ~AsyncBareProgressWorker() { - uv_mutex_destroy(&async_lock); - } - - class ExecutionProgress { - friend class AsyncBareProgressWorker; - public: - void Signal() const { - uv_mutex_lock(&that_->async_lock); - uv_async_send(&that_->async); - uv_mutex_unlock(&that_->async_lock); - } - - void Send(const T* data, size_t count) const { - that_->SendProgress_(data, count); - } - - private: - explicit ExecutionProgress(AsyncBareProgressWorker *that) : that_(that) {} - NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) - AsyncBareProgressWorker* const that_; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - virtual void HandleProgressCallback(const T *data, size_t size) = 0; - - protected: - uv_mutex_t async_lock; - - private: - void Execute() /*final override*/ { - ExecutionProgress progress(this); - Execute(progress); - } - - virtual void SendProgress_(const T *data, size_t count) = 0; -}; - -template -/* abstract */ -class AsyncProgressWorkerBase : public AsyncBareProgressWorker { - public: - explicit AsyncProgressWorkerBase( - Callback *callback_, - const char* resource_name = "nan:AsyncProgressWorkerBase") - : AsyncBareProgressWorker(callback_, resource_name), asyncdata_(NULL), - asyncsize_(0) { - } - - virtual ~AsyncProgressWorkerBase() { - delete[] asyncdata_; - } - - void WorkProgress() { - uv_mutex_lock(&this->async_lock); - T *data = asyncdata_; - size_t size = asyncsize_; - asyncdata_ = NULL; - asyncsize_ = 0; - uv_mutex_unlock(&this->async_lock); - - // Don't send progress events after we've already completed. - if (this->callback) { - this->HandleProgressCallback(data, size); - } - delete[] data; - } - - private: - void SendProgress_(const T *data, size_t count) { - T *new_data = new T[count]; - std::copy(data, data + count, new_data); - - uv_mutex_lock(&this->async_lock); - T *old_data = asyncdata_; - asyncdata_ = new_data; - asyncsize_ = count; - uv_async_send(&this->async); - uv_mutex_unlock(&this->async_lock); - - delete[] old_data; - } - - T *asyncdata_; - size_t asyncsize_; -}; - -// This ensures compatibility to the previous un-templated AsyncProgressWorker -// class definition. -typedef AsyncProgressWorkerBase AsyncProgressWorker; - -template -/* abstract */ -class AsyncBareProgressQueueWorker : public AsyncBareProgressWorkerBase { - public: - explicit AsyncBareProgressQueueWorker( - Callback *callback_, - const char* resource_name = "nan:AsyncBareProgressQueueWorker") - : AsyncBareProgressWorkerBase(callback_, resource_name) { - } - - virtual ~AsyncBareProgressQueueWorker() { - } - - class ExecutionProgress { - friend class AsyncBareProgressQueueWorker; - public: - void Send(const T* data, size_t count) const { - that_->SendProgress_(data, count); - } - - private: - explicit ExecutionProgress(AsyncBareProgressQueueWorker *that) - : that_(that) {} - NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) - AsyncBareProgressQueueWorker* const that_; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - virtual void HandleProgressCallback(const T *data, size_t size) = 0; - - private: - void Execute() /*final override*/ { - ExecutionProgress progress(this); - Execute(progress); - } - - virtual void SendProgress_(const T *data, size_t count) = 0; -}; - -template -/* abstract */ -class AsyncProgressQueueWorker : public AsyncBareProgressQueueWorker { - public: - explicit AsyncProgressQueueWorker( - Callback *callback_, - const char* resource_name = "nan:AsyncProgressQueueWorker") - : AsyncBareProgressQueueWorker(callback_) { - uv_mutex_init(&async_lock); - } - - virtual ~AsyncProgressQueueWorker() { - uv_mutex_lock(&async_lock); - - while (!asyncdata_.empty()) { - std::pair &datapair = asyncdata_.front(); - T *data = datapair.first; - - asyncdata_.pop(); - - delete[] data; - } - - uv_mutex_unlock(&async_lock); - uv_mutex_destroy(&async_lock); - } - - void WorkComplete() { - WorkProgress(); - AsyncWorker::WorkComplete(); - } - - void WorkProgress() { - uv_mutex_lock(&async_lock); - - while (!asyncdata_.empty()) { - std::pair &datapair = asyncdata_.front(); - - T *data = datapair.first; - size_t size = datapair.second; - - asyncdata_.pop(); - uv_mutex_unlock(&async_lock); - - // Don't send progress events after we've already completed. - if (this->callback) { - this->HandleProgressCallback(data, size); - } - - delete[] data; - - uv_mutex_lock(&async_lock); - } - - uv_mutex_unlock(&async_lock); - } - - private: - void SendProgress_(const T *data, size_t count) { - T *new_data = new T[count]; - std::copy(data, data + count, new_data); - - uv_mutex_lock(&async_lock); - asyncdata_.push(std::pair(new_data, count)); - uv_mutex_unlock(&async_lock); - - uv_async_send(&this->async); - } - - uv_mutex_t async_lock; - std::queue > asyncdata_; -}; - -inline void AsyncExecute (uv_work_t* req) { - AsyncWorker *worker = static_cast(req->data); - worker->Execute(); -} - -inline void AsyncExecuteComplete (uv_work_t* req) { - AsyncWorker* worker = static_cast(req->data); - worker->WorkComplete(); - worker->Destroy(); -} - -inline void AsyncQueueWorker (AsyncWorker* worker) { - uv_queue_work( - GetCurrentEventLoop() - , &worker->request - , AsyncExecute - , reinterpret_cast(AsyncExecuteComplete) - ); -} - -namespace imp { - -inline -ExternalOneByteStringResource const* -GetExternalResource(v8::Local str) { -#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION - return str->GetExternalAsciiStringResource(); -#else - return str->GetExternalOneByteStringResource(); -#endif -} - -inline -bool -IsExternal(v8::Local str) { -#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION - return str->IsExternalAscii(); -#else - return str->IsExternalOneByte(); -#endif -} - -} // end of namespace imp - -enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; - -#if NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION -# include "nan_string_bytes.h" // NOLINT(build/include) -#endif - -inline v8::Local Encode( - const void *buf, size_t len, enum Encoding encoding = BINARY) { -#if (NODE_MODULE_VERSION >= ATOM_0_21_MODULE_VERSION) - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - node::encoding node_enc = static_cast(encoding); - - if (encoding == UCS2) { - return node::Encode( - isolate - , reinterpret_cast(buf) - , len / 2); - } else { - return node::Encode( - isolate - , reinterpret_cast(buf) - , len - , node_enc); - } -#elif (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) - return node::Encode( - v8::Isolate::GetCurrent() - , buf, len - , static_cast(encoding)); -#else -# if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION - return node::Encode(buf, len, static_cast(encoding)); -# else - return imp::Encode(reinterpret_cast(buf), len, encoding); -# endif -#endif -} - -inline ssize_t DecodeBytes( - v8::Local val, enum Encoding encoding = BINARY) { -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) - return node::DecodeBytes( - v8::Isolate::GetCurrent() - , val - , static_cast(encoding)); -#else -# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) - if (encoding == BUFFER) { - return node::DecodeBytes(val, node::BINARY); - } -# endif - return node::DecodeBytes(val, static_cast(encoding)); -#endif -} - -inline ssize_t DecodeWrite( - char *buf - , size_t len - , v8::Local val - , enum Encoding encoding = BINARY) { -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) - return node::DecodeWrite( - v8::Isolate::GetCurrent() - , buf - , len - , val - , static_cast(encoding)); -#else -# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) - if (encoding == BUFFER) { - return node::DecodeWrite(buf, len, val, node::BINARY); - } -# endif - return node::DecodeWrite( - buf - , len - , val - , static_cast(encoding)); -#endif -} - -inline void SetPrototypeTemplate( - v8::Local templ - , const char *name - , v8::Local value -) { - HandleScope scope; - SetTemplate(templ->PrototypeTemplate(), name, value); -} - -inline void SetPrototypeTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes -) { - HandleScope scope; - SetTemplate(templ->PrototypeTemplate(), name, value, attributes); -} - -inline void SetInstanceTemplate( - v8::Local templ - , const char *name - , v8::Local value -) { - HandleScope scope; - SetTemplate(templ->InstanceTemplate(), name, value); -} - -inline void SetInstanceTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes -) { - HandleScope scope; - SetTemplate(templ->InstanceTemplate(), name, value, attributes); -} - -namespace imp { - -// Note(@agnat): Helper to distinguish different receiver types. The first -// version deals with receivers derived from v8::Template. The second version -// handles everything else. The final argument only serves as discriminator and -// is unused. -template -inline -void -SetMethodAux(T recv, - v8::Local name, - v8::Local tpl, - v8::Template *) { - recv->Set(name, tpl); -} - -template -inline -void -SetMethodAux(T recv, - v8::Local name, - v8::Local tpl, - ...) { - Set(recv, name, GetFunction(tpl).ToLocalChecked()); -} - -} // end of namespace imp - -template class HandleType> -inline void SetMethod( - HandleType recv - , const char *name - , FunctionCallback callback - , v8::Local data = v8::Local()) { - HandleScope scope; - v8::Local t = New(callback, data); - v8::Local fn_name = New(name).ToLocalChecked(); - t->SetClassName(fn_name); - // Note(@agnat): Pass an empty T* as discriminator. See note on - // SetMethodAux(...) above - imp::SetMethodAux(recv, fn_name, t, static_cast(0)); -} - -inline void SetPrototypeMethod( - v8::Local recv - , const char* name - , FunctionCallback callback - , v8::Local data = v8::Local()) { - HandleScope scope; - v8::Local t = New( - callback - , data - , New(recv)); - v8::Local fn_name = New(name).ToLocalChecked(); - recv->PrototypeTemplate()->Set(fn_name, t); - t->SetClassName(fn_name); -} - -//=== Accessors and Such ======================================================= - -inline void SetAccessor( - v8::Local tpl - , v8::Local name - , GetterCallback getter - , SetterCallback setter = 0 - , v8::Local data = v8::Local() - , v8::AccessControl settings = v8::DEFAULT - , v8::PropertyAttribute attribute = v8::None - , imp::Sig signature = imp::Sig()) { - HandleScope scope; - - imp::NativeGetter getter_ = - imp::GetterCallbackWrapper; - imp::NativeSetter setter_ = - setter ? imp::SetterCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kAccessorFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kGetterIndex - , New(reinterpret_cast(getter))); - - if (setter != 0) { - obj->SetInternalField( - imp::kSetterIndex - , New(reinterpret_cast(setter))); - } - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - - tpl->SetAccessor( - name - , getter_ - , setter_ - , obj - , settings - , attribute - , signature); -} - -inline bool SetAccessor( - v8::Local obj - , v8::Local name - , GetterCallback getter - , SetterCallback setter = 0 - , v8::Local data = v8::Local() - , v8::AccessControl settings = v8::DEFAULT - , v8::PropertyAttribute attribute = v8::None) { - HandleScope scope; - - imp::NativeGetter getter_ = - imp::GetterCallbackWrapper; - imp::NativeSetter setter_ = - setter ? imp::SetterCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kAccessorFieldCount); - v8::Local dataobj = NewInstance(otpl).ToLocalChecked(); - - dataobj->SetInternalField( - imp::kGetterIndex - , New(reinterpret_cast(getter))); - - if (!data.IsEmpty()) { - dataobj->SetInternalField(imp::kDataIndex, data); - } - - if (setter) { - dataobj->SetInternalField( - imp::kSetterIndex - , New(reinterpret_cast(setter))); - } - -#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - return obj->SetAccessor( - GetCurrentContext() - , name - , getter_ - , setter_ - , dataobj - , settings - , attribute).FromMaybe(false); -#else - return obj->SetAccessor( - name - , getter_ - , setter_ - , dataobj - , settings - , attribute); -#endif -} - -inline void SetNamedPropertyHandler( - v8::Local tpl - , PropertyGetterCallback getter - , PropertySetterCallback setter = 0 - , PropertyQueryCallback query = 0 - , PropertyDeleterCallback deleter = 0 - , PropertyEnumeratorCallback enumerator = 0 - , v8::Local data = v8::Local()) { - HandleScope scope; - - imp::NativePropertyGetter getter_ = - imp::PropertyGetterCallbackWrapper; - imp::NativePropertySetter setter_ = - setter ? imp::PropertySetterCallbackWrapper : 0; - imp::NativePropertyQuery query_ = - query ? imp::PropertyQueryCallbackWrapper : 0; - imp::NativePropertyDeleter *deleter_ = - deleter ? imp::PropertyDeleterCallbackWrapper : 0; - imp::NativePropertyEnumerator enumerator_ = - enumerator ? imp::PropertyEnumeratorCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kPropertyFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - obj->SetInternalField( - imp::kPropertyGetterIndex - , New(reinterpret_cast(getter))); - - if (setter) { - obj->SetInternalField( - imp::kPropertySetterIndex - , New(reinterpret_cast(setter))); - } - - if (query) { - obj->SetInternalField( - imp::kPropertyQueryIndex - , New(reinterpret_cast(query))); - } - - if (deleter) { - obj->SetInternalField( - imp::kPropertyDeleterIndex - , New(reinterpret_cast(deleter))); - } - - if (enumerator) { - obj->SetInternalField( - imp::kPropertyEnumeratorIndex - , New(reinterpret_cast(enumerator))); - } - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - tpl->SetHandler(v8::NamedPropertyHandlerConfiguration( - getter_, setter_, query_, deleter_, enumerator_, obj)); -#else - tpl->SetNamedPropertyHandler( - getter_ - , setter_ - , query_ - , deleter_ - , enumerator_ - , obj); -#endif -} - -inline void SetIndexedPropertyHandler( - v8::Local tpl - , IndexGetterCallback getter - , IndexSetterCallback setter = 0 - , IndexQueryCallback query = 0 - , IndexDeleterCallback deleter = 0 - , IndexEnumeratorCallback enumerator = 0 - , v8::Local data = v8::Local()) { - HandleScope scope; - - imp::NativeIndexGetter getter_ = - imp::IndexGetterCallbackWrapper; - imp::NativeIndexSetter setter_ = - setter ? imp::IndexSetterCallbackWrapper : 0; - imp::NativeIndexQuery query_ = - query ? imp::IndexQueryCallbackWrapper : 0; - imp::NativeIndexDeleter deleter_ = - deleter ? imp::IndexDeleterCallbackWrapper : 0; - imp::NativeIndexEnumerator enumerator_ = - enumerator ? imp::IndexEnumeratorCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kIndexPropertyFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - obj->SetInternalField( - imp::kIndexPropertyGetterIndex - , New(reinterpret_cast(getter))); - - if (setter) { - obj->SetInternalField( - imp::kIndexPropertySetterIndex - , New(reinterpret_cast(setter))); - } - - if (query) { - obj->SetInternalField( - imp::kIndexPropertyQueryIndex - , New(reinterpret_cast(query))); - } - - if (deleter) { - obj->SetInternalField( - imp::kIndexPropertyDeleterIndex - , New(reinterpret_cast(deleter))); - } - - if (enumerator) { - obj->SetInternalField( - imp::kIndexPropertyEnumeratorIndex - , New(reinterpret_cast(enumerator))); - } - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - tpl->SetHandler(v8::IndexedPropertyHandlerConfiguration( - getter_, setter_, query_, deleter_, enumerator_, obj)); -#else - tpl->SetIndexedPropertyHandler( - getter_ - , setter_ - , query_ - , deleter_ - , enumerator_ - , obj); -#endif -} - -inline void SetCallHandler( - v8::Local tpl - , FunctionCallback callback - , v8::Local data = v8::Local()) { - HandleScope scope; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , New(reinterpret_cast(callback))); - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - - tpl->SetCallHandler(imp::FunctionCallbackWrapper, obj); -} - - -inline void SetCallAsFunctionHandler( - v8::Local tpl, - FunctionCallback callback, - v8::Local data = v8::Local()) { - HandleScope scope; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , New(reinterpret_cast(callback))); - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - - tpl->SetCallAsFunctionHandler(imp::FunctionCallbackWrapper, obj); -} - -//=== Weak Persistent Handling ================================================= - -#include "nan_weak.h" // NOLINT(build/include) - -//=== ObjectWrap =============================================================== - -#include "nan_object_wrap.h" // NOLINT(build/include) - -//=== HiddenValue/Private ====================================================== - -#include "nan_private.h" // NOLINT(build/include) - -//=== Export ================================================================== - -inline -void -Export(ADDON_REGISTER_FUNCTION_ARGS_TYPE target, const char *name, - FunctionCallback f) { - HandleScope scope; - - Set(target, New(name).ToLocalChecked(), - GetFunction(New(f)).ToLocalChecked()); -} - -//=== Tap Reverse Binding ===================================================== - -struct Tap { - explicit Tap(v8::Local t) : t_() { - HandleScope scope; - - t_.Reset(To(t).ToLocalChecked()); - } - - ~Tap() { t_.Reset(); } // not sure if necessary - - inline void plan(int i) { - HandleScope scope; - v8::Local arg = New(i); - Call("plan", New(t_), 1, &arg); - } - - inline void ok(bool isOk, const char *msg = NULL) { - HandleScope scope; - v8::Local args[2]; - args[0] = New(isOk); - if (msg) args[1] = New(msg).ToLocalChecked(); - Call("ok", New(t_), msg ? 2 : 1, args); - } - - inline void pass(const char * msg = NULL) { - HandleScope scope; - v8::Local hmsg; - if (msg) hmsg = New(msg).ToLocalChecked(); - Call("pass", New(t_), msg ? 1 : 0, &hmsg); - } - - inline void end() { - HandleScope scope; - Call("end", New(t_), 0, NULL); - } - - private: - Persistent t_; -}; - -#define NAN_STRINGIZE2(x) #x -#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) -#define NAN_TEST_EXPRESSION(expression) \ - ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression - -#define NAN_EXPORT(target, function) Export(target, #function, function) - -#undef TYPE_CHECK - -//=== Generic Maybefication =================================================== - -namespace imp { - -template struct Maybefier; - -template struct Maybefier > { - inline static MaybeLocal convert(v8::Local v) { - return v; - } -}; - -template struct Maybefier > { - inline static MaybeLocal convert(MaybeLocal v) { - return v; - } -}; - -} // end of namespace imp - -template class MaybeMaybe> -inline MaybeLocal -MakeMaybe(MaybeMaybe v) { - return imp::Maybefier >::convert(v); -} - -//=== TypedArrayContents ======================================================= - -#include "nan_typedarray_contents.h" // NOLINT(build/include) - -//=== JSON ===================================================================== - -#include "nan_json.h" // NOLINT(build/include) - -} // end of namespace Nan - -#endif // NAN_H_ diff --git a/node_modules/nan/nan_callbacks.h b/node_modules/nan/nan_callbacks.h deleted file mode 100644 index 53ede84..0000000 --- a/node_modules/nan/nan_callbacks.h +++ /dev/null @@ -1,88 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CALLBACKS_H_ -#define NAN_CALLBACKS_H_ - -template class FunctionCallbackInfo; -template class PropertyCallbackInfo; -template class Global; - -typedef void(*FunctionCallback)(const FunctionCallbackInfo&); -typedef void(*GetterCallback) - (v8::Local, const PropertyCallbackInfo&); -typedef void(*SetterCallback)( - v8::Local, - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertyGetterCallback)( - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertySetterCallback)( - v8::Local, - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertyEnumeratorCallback) - (const PropertyCallbackInfo&); -typedef void(*PropertyDeleterCallback)( - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertyQueryCallback)( - v8::Local, - const PropertyCallbackInfo&); -typedef void(*IndexGetterCallback)( - uint32_t, - const PropertyCallbackInfo&); -typedef void(*IndexSetterCallback)( - uint32_t, - v8::Local, - const PropertyCallbackInfo&); -typedef void(*IndexEnumeratorCallback) - (const PropertyCallbackInfo&); -typedef void(*IndexDeleterCallback)( - uint32_t, - const PropertyCallbackInfo&); -typedef void(*IndexQueryCallback)( - uint32_t, - const PropertyCallbackInfo&); - -namespace imp { -typedef v8::Local Sig; - -static const int kDataIndex = 0; - -static const int kFunctionIndex = 1; -static const int kFunctionFieldCount = 2; - -static const int kGetterIndex = 1; -static const int kSetterIndex = 2; -static const int kAccessorFieldCount = 3; - -static const int kPropertyGetterIndex = 1; -static const int kPropertySetterIndex = 2; -static const int kPropertyEnumeratorIndex = 3; -static const int kPropertyDeleterIndex = 4; -static const int kPropertyQueryIndex = 5; -static const int kPropertyFieldCount = 6; - -static const int kIndexPropertyGetterIndex = 1; -static const int kIndexPropertySetterIndex = 2; -static const int kIndexPropertyEnumeratorIndex = 3; -static const int kIndexPropertyDeleterIndex = 4; -static const int kIndexPropertyQueryIndex = 5; -static const int kIndexPropertyFieldCount = 6; - -} // end of namespace imp - -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -# include "nan_callbacks_12_inl.h" // NOLINT(build/include) -#else -# include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include) -#endif - -#endif // NAN_CALLBACKS_H_ diff --git a/node_modules/nan/nan_callbacks_12_inl.h b/node_modules/nan/nan_callbacks_12_inl.h deleted file mode 100644 index c27b18d..0000000 --- a/node_modules/nan/nan_callbacks_12_inl.h +++ /dev/null @@ -1,514 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CALLBACKS_12_INL_H_ -#define NAN_CALLBACKS_12_INL_H_ - -template -class ReturnValue { - v8::ReturnValue value_; - - public: - template - explicit inline ReturnValue(const v8::ReturnValue &value) : - value_(value) {} - template - explicit inline ReturnValue(const ReturnValue& that) - : value_(that.value_) { - TYPE_CHECK(T, S); - } - - // Handle setters - template inline void Set(const v8::Local &handle) { - TYPE_CHECK(T, S); - value_.Set(handle); - } - - template inline void Set(const Global &handle) { - TYPE_CHECK(T, S); -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && \ - (V8_MINOR_VERSION > 5 || (V8_MINOR_VERSION == 5 && \ - defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER >= 8)))) - value_.Set(handle); -#else - value_.Set(*reinterpret_cast*>(&handle)); - const_cast &>(handle).Reset(); -#endif - } - - // Fast primitive setters - inline void Set(bool value) { - TYPE_CHECK(T, v8::Boolean); - value_.Set(value); - } - - inline void Set(double i) { - TYPE_CHECK(T, v8::Number); - value_.Set(i); - } - - inline void Set(int32_t i) { - TYPE_CHECK(T, v8::Integer); - value_.Set(i); - } - - inline void Set(uint32_t i) { - TYPE_CHECK(T, v8::Integer); - value_.Set(i); - } - - // Fast JS primitive setters - inline void SetNull() { - TYPE_CHECK(T, v8::Primitive); - value_.SetNull(); - } - - inline void SetUndefined() { - TYPE_CHECK(T, v8::Primitive); - value_.SetUndefined(); - } - - inline void SetEmptyString() { - TYPE_CHECK(T, v8::String); - value_.SetEmptyString(); - } - - // Convenience getter for isolate - inline v8::Isolate *GetIsolate() const { - return value_.GetIsolate(); - } - - // Pointer setter: Uncompilable to prevent inadvertent misuse. - template - inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } -}; - -template -class FunctionCallbackInfo { - const v8::FunctionCallbackInfo &info_; - const v8::Local data_; - - public: - explicit inline FunctionCallbackInfo( - const v8::FunctionCallbackInfo &info - , v8::Local data) : - info_(info) - , data_(data) {} - - inline ReturnValue GetReturnValue() const { - return ReturnValue(info_.GetReturnValue()); - } - -#if NODE_MAJOR_VERSION < 10 - inline v8::Local Callee() const { return info_.Callee(); } -#endif - inline v8::Local Data() const { return data_; } - inline v8::Local Holder() const { return info_.Holder(); } - inline bool IsConstructCall() const { return info_.IsConstructCall(); } - inline int Length() const { return info_.Length(); } - inline v8::Local operator[](int i) const { return info_[i]; } - inline v8::Local This() const { return info_.This(); } - inline v8::Isolate *GetIsolate() const { return info_.GetIsolate(); } - - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kCalleeIndex = 5; - static const int kContextSaveIndex = 6; - static const int kArgsLength = 7; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) -}; - -template -class PropertyCallbackInfo { - const v8::PropertyCallbackInfo &info_; - const v8::Local data_; - - public: - explicit inline PropertyCallbackInfo( - const v8::PropertyCallbackInfo &info - , const v8::Local data) : - info_(info) - , data_(data) {} - - inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } - inline v8::Local Data() const { return data_; } - inline v8::Local This() const { return info_.This(); } - inline v8::Local Holder() const { return info_.Holder(); } - inline ReturnValue GetReturnValue() const { - return ReturnValue(info_.GetReturnValue()); - } - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kThisIndex = 5; - static const int kArgsLength = 6; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo) -}; - -namespace imp { -static -void FunctionCallbackWrapper(const v8::FunctionCallbackInfo &info) { - v8::Local obj = info.Data().As(); - FunctionCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kFunctionIndex).As()->Value())); - FunctionCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - callback(cbinfo); -} - -typedef void (*NativeFunction)(const v8::FunctionCallbackInfo &); - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -static -void GetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - GetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kGetterIndex).As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (*NativeGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void SetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - SetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kSetterIndex).As()->Value())); - callback(property.As(), value, cbinfo); -} - -typedef void (*NativeSetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); -#else -static -void GetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - GetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kGetterIndex).As()->Value())); - callback(property, cbinfo); -} - -typedef void (*NativeGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void SetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - SetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kSetterIndex).As()->Value())); - callback(property, value, cbinfo); -} - -typedef void (*NativeSetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); -#endif - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -static -void PropertyGetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (*NativePropertyGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertySetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertySetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As()->Value())); - callback(property.As(), value, cbinfo); -} - -typedef void (*NativePropertySetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); - -static -void PropertyEnumeratorCallbackWrapper( - const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyEnumeratorCallback callback = - reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); -} - -typedef void (*NativePropertyEnumerator) - (const v8::PropertyCallbackInfo &); - -static -void PropertyDeleterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (NativePropertyDeleter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertyQueryCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (*NativePropertyQuery) - (v8::Local, const v8::PropertyCallbackInfo &); -#else -static -void PropertyGetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As()->Value())); - callback(property, cbinfo); -} - -typedef void (*NativePropertyGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertySetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertySetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As()->Value())); - callback(property, value, cbinfo); -} - -typedef void (*NativePropertySetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); - -static -void PropertyEnumeratorCallbackWrapper( - const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyEnumeratorCallback callback = - reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); -} - -typedef void (*NativePropertyEnumerator) - (const v8::PropertyCallbackInfo &); - -static -void PropertyDeleterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As()->Value())); - callback(property, cbinfo); -} - -typedef void (NativePropertyDeleter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertyQueryCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As()->Value())); - callback(property, cbinfo); -} - -typedef void (*NativePropertyQuery) - (v8::Local, const v8::PropertyCallbackInfo &); -#endif - -static -void IndexGetterCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyGetterIndex) - .As()->Value())); - callback(index, cbinfo); -} - -typedef void (*NativeIndexGetter) - (uint32_t, const v8::PropertyCallbackInfo &); - -static -void IndexSetterCallbackWrapper( - uint32_t index - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexSetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertySetterIndex) - .As()->Value())); - callback(index, value, cbinfo); -} - -typedef void (*NativeIndexSetter)( - uint32_t - , v8::Local - , const v8::PropertyCallbackInfo &); - -static -void IndexEnumeratorCallbackWrapper( - const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexEnumeratorCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField( - kIndexPropertyEnumeratorIndex).As()->Value())); - callback(cbinfo); -} - -typedef void (*NativeIndexEnumerator) - (const v8::PropertyCallbackInfo &); - -static -void IndexDeleterCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyDeleterIndex) - .As()->Value())); - callback(index, cbinfo); -} - -typedef void (*NativeIndexDeleter) - (uint32_t, const v8::PropertyCallbackInfo &); - -static -void IndexQueryCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyQueryIndex) - .As()->Value())); - callback(index, cbinfo); -} - -typedef void (*NativeIndexQuery) - (uint32_t, const v8::PropertyCallbackInfo &); -} // end of namespace imp - -#endif // NAN_CALLBACKS_12_INL_H_ diff --git a/node_modules/nan/nan_callbacks_pre_12_inl.h b/node_modules/nan/nan_callbacks_pre_12_inl.h deleted file mode 100644 index c9ba499..0000000 --- a/node_modules/nan/nan_callbacks_pre_12_inl.h +++ /dev/null @@ -1,520 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CALLBACKS_PRE_12_INL_H_ -#define NAN_CALLBACKS_PRE_12_INL_H_ - -namespace imp { -template class ReturnValueImp; -} // end of namespace imp - -template -class ReturnValue { - v8::Isolate *isolate_; - v8::Persistent *value_; - friend class imp::ReturnValueImp; - - public: - template - explicit inline ReturnValue(v8::Isolate *isolate, v8::Persistent *p) : - isolate_(isolate), value_(p) {} - template - explicit inline ReturnValue(const ReturnValue& that) - : isolate_(that.isolate_), value_(that.value_) { - TYPE_CHECK(T, S); - } - - // Handle setters - template inline void Set(const v8::Local &handle) { - TYPE_CHECK(T, S); - value_->Dispose(); - *value_ = v8::Persistent::New(handle); - } - - template inline void Set(const Global &handle) { - TYPE_CHECK(T, S); - value_->Dispose(); - *value_ = v8::Persistent::New(handle.persistent); - const_cast &>(handle).Reset(); - } - - // Fast primitive setters - inline void Set(bool value) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Boolean); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Boolean::New(value)); - } - - inline void Set(double i) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Number); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Number::New(i)); - } - - inline void Set(int32_t i) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Integer); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Int32::New(i)); - } - - inline void Set(uint32_t i) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Integer); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Uint32::NewFromUnsigned(i)); - } - - // Fast JS primitive setters - inline void SetNull() { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Primitive); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Null()); - } - - inline void SetUndefined() { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Primitive); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Undefined()); - } - - inline void SetEmptyString() { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::String); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::String::Empty()); - } - - // Convenience getter for isolate - inline v8::Isolate *GetIsolate() const { - return isolate_; - } - - // Pointer setter: Uncompilable to prevent inadvertent misuse. - template - inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } -}; - -template -class FunctionCallbackInfo { - const v8::Arguments &args_; - v8::Local data_; - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline FunctionCallbackInfo( - const v8::Arguments &args - , v8::Local data) : - args_(args) - , data_(data) - , return_value_(args.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Undefined())) {} - - inline ~FunctionCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return ReturnValue(return_value_); - } - - inline v8::Local Callee() const { return args_.Callee(); } - inline v8::Local Data() const { return data_; } - inline v8::Local Holder() const { return args_.Holder(); } - inline bool IsConstructCall() const { return args_.IsConstructCall(); } - inline int Length() const { return args_.Length(); } - inline v8::Local operator[](int i) const { return args_[i]; } - inline v8::Local This() const { return args_.This(); } - inline v8::Isolate *GetIsolate() const { return args_.GetIsolate(); } - - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kCalleeIndex = 5; - static const int kContextSaveIndex = 6; - static const int kArgsLength = 7; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) -}; - -template -class PropertyCallbackInfoBase { - const v8::AccessorInfo &info_; - const v8::Local data_; - - public: - explicit inline PropertyCallbackInfoBase( - const v8::AccessorInfo &info - , const v8::Local data) : - info_(info) - , data_(data) {} - - inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } - inline v8::Local Data() const { return data_; } - inline v8::Local This() const { return info_.This(); } - inline v8::Local Holder() const { return info_.Holder(); } - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kThisIndex = 5; - static const int kArgsLength = 6; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfoBase) -}; - -template -class PropertyCallbackInfo : public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Undefined())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { return return_value_; } -}; - -template<> -class PropertyCallbackInfo : - public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Local())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return return_value_; - } -}; - -template<> -class PropertyCallbackInfo : - public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Local())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return return_value_; - } -}; - -template<> -class PropertyCallbackInfo : - public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Local())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return return_value_; - } -}; - -namespace imp { -template -class ReturnValueImp : public ReturnValue { - public: - explicit ReturnValueImp(ReturnValue that) : - ReturnValue(that) {} - inline v8::Handle Value() { - return *ReturnValue::value_; - } -}; - -static -v8::Handle FunctionCallbackWrapper(const v8::Arguments &args) { - v8::Local obj = args.Data().As(); - FunctionCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kFunctionIndex).As()->Value())); - FunctionCallbackInfo - cbinfo(args, obj->GetInternalField(kDataIndex)); - callback(cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeFunction)(const v8::Arguments &); - -static -v8::Handle GetterCallbackWrapper( - v8::Local property, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - GetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kGetterIndex).As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeGetter) - (v8::Local, const v8::AccessorInfo &); - -static -void SetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - SetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kSetterIndex).As()->Value())); - callback(property, value, cbinfo); -} - -typedef void (*NativeSetter) - (v8::Local, v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertyGetterCallbackWrapper( - v8::Local property, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertyGetter) - (v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertySetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertySetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As()->Value())); - callback(property, value, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertySetter) - (v8::Local, v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertyEnumeratorCallbackWrapper( - const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyEnumeratorCallback callback = - reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertyEnumerator) - (const v8::AccessorInfo &); - -static -v8::Handle PropertyDeleterCallbackWrapper( - v8::Local property - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (NativePropertyDeleter) - (v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertyQueryCallbackWrapper( - v8::Local property, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertyQuery) - (v8::Local, const v8::AccessorInfo &); - -static -v8::Handle IndexGetterCallbackWrapper( - uint32_t index, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyGetterIndex) - .As()->Value())); - callback(index, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexGetter) - (uint32_t, const v8::AccessorInfo &); - -static -v8::Handle IndexSetterCallbackWrapper( - uint32_t index - , v8::Local value - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexSetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertySetterIndex) - .As()->Value())); - callback(index, value, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexSetter) - (uint32_t, v8::Local, const v8::AccessorInfo &); - -static -v8::Handle IndexEnumeratorCallbackWrapper( - const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexEnumeratorCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexEnumerator) - (const v8::AccessorInfo &); - -static -v8::Handle IndexDeleterCallbackWrapper( - uint32_t index, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyDeleterIndex) - .As()->Value())); - callback(index, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexDeleter) - (uint32_t, const v8::AccessorInfo &); - -static -v8::Handle IndexQueryCallbackWrapper( - uint32_t index, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyQueryIndex) - .As()->Value())); - callback(index, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexQuery) - (uint32_t, const v8::AccessorInfo &); -} // end of namespace imp - -#endif // NAN_CALLBACKS_PRE_12_INL_H_ diff --git a/node_modules/nan/nan_converters.h b/node_modules/nan/nan_converters.h deleted file mode 100644 index c0b3272..0000000 --- a/node_modules/nan/nan_converters.h +++ /dev/null @@ -1,72 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CONVERTERS_H_ -#define NAN_CONVERTERS_H_ - -namespace imp { -template struct ToFactoryBase { - typedef MaybeLocal return_t; -}; -template struct ValueFactoryBase { typedef Maybe return_t; }; - -template struct ToFactory; - -template<> -struct ToFactory : ToFactoryBase { - static inline return_t convert(v8::Local val) { - if (val.IsEmpty() || !val->IsFunction()) return MaybeLocal(); - return MaybeLocal(val.As()); - } -}; - -#define X(TYPE) \ - template<> \ - struct ToFactory : ToFactoryBase { \ - static inline return_t convert(v8::Local val); \ - }; - -X(Boolean) -X(Number) -X(String) -X(Object) -X(Integer) -X(Uint32) -X(Int32) - -#undef X - -#define X(TYPE) \ - template<> \ - struct ToFactory : ValueFactoryBase { \ - static inline return_t convert(v8::Local val); \ - }; - -X(bool) -X(double) -X(int64_t) -X(uint32_t) -X(int32_t) - -#undef X -} // end of namespace imp - -template -inline -typename imp::ToFactory::return_t To(v8::Local val) { - return imp::ToFactory::convert(val); -} - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -# include "nan_converters_43_inl.h" -#else -# include "nan_converters_pre_43_inl.h" -#endif - -#endif // NAN_CONVERTERS_H_ diff --git a/node_modules/nan/nan_converters_43_inl.h b/node_modules/nan/nan_converters_43_inl.h deleted file mode 100644 index 41b72de..0000000 --- a/node_modules/nan/nan_converters_43_inl.h +++ /dev/null @@ -1,68 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CONVERTERS_43_INL_H_ -#define NAN_CONVERTERS_43_INL_H_ - -#define X(TYPE) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::EscapableHandleScope scope(isolate); \ - return scope.Escape( \ - val->To ## TYPE(isolate->GetCurrentContext()) \ - .FromMaybe(v8::Local())); \ -} - -X(Number) -X(String) -X(Object) -X(Integer) -X(Uint32) -X(Int32) -// V8 <= 7.0 -#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) -X(Boolean) -#else -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::EscapableHandleScope scope(isolate); \ - return scope.Escape(val->ToBoolean(isolate)); \ -} -#endif - -#undef X - -#define X(TYPE, NAME) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::HandleScope scope(isolate); \ - return val->NAME ## Value(isolate->GetCurrentContext()); \ -} - -X(double, Number) -X(int64_t, Integer) -X(uint32_t, Uint32) -X(int32_t, Int32) -// V8 <= 7.0 -#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) -X(bool, Boolean) -#else -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::HandleScope scope(isolate); \ - return Just(val->BooleanValue(isolate)); \ -} -#endif - -#undef X - -#endif // NAN_CONVERTERS_43_INL_H_ diff --git a/node_modules/nan/nan_converters_pre_43_inl.h b/node_modules/nan/nan_converters_pre_43_inl.h deleted file mode 100644 index ae0518a..0000000 --- a/node_modules/nan/nan_converters_pre_43_inl.h +++ /dev/null @@ -1,42 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CONVERTERS_PRE_43_INL_H_ -#define NAN_CONVERTERS_PRE_43_INL_H_ - -#define X(TYPE) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - return val->To ## TYPE(); \ -} - -X(Boolean) -X(Number) -X(String) -X(Object) -X(Integer) -X(Uint32) -X(Int32) - -#undef X - -#define X(TYPE, NAME) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - return Just(val->NAME ## Value()); \ -} - -X(bool, Boolean) -X(double, Number) -X(int64_t, Integer) -X(uint32_t, Uint32) -X(int32_t, Int32) - -#undef X - -#endif // NAN_CONVERTERS_PRE_43_INL_H_ diff --git a/node_modules/nan/nan_define_own_property_helper.h b/node_modules/nan/nan_define_own_property_helper.h deleted file mode 100644 index d710ef2..0000000 --- a/node_modules/nan/nan_define_own_property_helper.h +++ /dev/null @@ -1,29 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_ -#define NAN_DEFINE_OWN_PROPERTY_HELPER_H_ - -namespace imp { - -inline Maybe DefineOwnPropertyHelper( - v8::PropertyAttribute current - , v8::Handle obj - , v8::Handle key - , v8::Handle value - , v8::PropertyAttribute attribs = v8::None) { - return !(current & v8::DontDelete) || // configurable OR - (!(current & v8::ReadOnly) && // writable AND - !((attribs ^ current) & ~v8::ReadOnly)) // same excluding RO - ? Just(obj->ForceSet(key, value, attribs)) - : Nothing(); -} - -} // end of namespace imp - -#endif // NAN_DEFINE_OWN_PROPERTY_HELPER_H_ diff --git a/node_modules/nan/nan_implementation_12_inl.h b/node_modules/nan/nan_implementation_12_inl.h deleted file mode 100644 index 255293a..0000000 --- a/node_modules/nan/nan_implementation_12_inl.h +++ /dev/null @@ -1,430 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_IMPLEMENTATION_12_INL_H_ -#define NAN_IMPLEMENTATION_12_INL_H_ -//============================================================================== -// node v0.11 implementation -//============================================================================== - -namespace imp { - -//=== Array ==================================================================== - -Factory::return_t -Factory::New() { - return v8::Array::New(v8::Isolate::GetCurrent()); -} - -Factory::return_t -Factory::New(int length) { - return v8::Array::New(v8::Isolate::GetCurrent(), length); -} - -//=== Boolean ================================================================== - -Factory::return_t -Factory::New(bool value) { - return v8::Boolean::New(v8::Isolate::GetCurrent(), value); -} - -//=== Boolean Object =========================================================== - -Factory::return_t -Factory::New(bool value) { -#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - return v8::BooleanObject::New( - v8::Isolate::GetCurrent(), value).As(); -#else - return v8::BooleanObject::New(value).As(); -#endif -} - -//=== Context ================================================================== - -Factory::return_t -Factory::New( v8::ExtensionConfiguration* extensions - , v8::Local tmpl - , v8::Local obj) { - return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj); -} - -//=== Date ===================================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New(double value) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(v8::Date::New(isolate->GetCurrentContext(), value) - .FromMaybe(v8::Local()).As()); -} -#else -Factory::return_t -Factory::New(double value) { - return v8::Date::New(v8::Isolate::GetCurrent(), value).As(); -} -#endif - -//=== External ================================================================= - -Factory::return_t -Factory::New(void * value) { - return v8::External::New(v8::Isolate::GetCurrent(), value); -} - -//=== Function ================================================================= - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::Local tpl = v8::ObjectTemplate::New(isolate); - tpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(tpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , v8::External::New(isolate, reinterpret_cast(callback))); - - v8::Local val = v8::Local::New(isolate, data); - - if (!val.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, val); - } - -#if NODE_MAJOR_VERSION >= 10 - v8::Local context = isolate->GetCurrentContext(); - v8::Local function = - v8::Function::New(context, imp::FunctionCallbackWrapper, obj) - .ToLocalChecked(); -#else - v8::Local function = - v8::Function::New(isolate, imp::FunctionCallbackWrapper, obj); -#endif - - return scope.Escape(function); -} - -//=== Function Template ======================================================== - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data - , v8::Local signature) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - if (callback) { - v8::EscapableHandleScope scope(isolate); - v8::Local tpl = v8::ObjectTemplate::New(isolate); - tpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(tpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , v8::External::New(isolate, reinterpret_cast(callback))); - v8::Local val = v8::Local::New(isolate, data); - - if (!val.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, val); - } - - return scope.Escape(v8::FunctionTemplate::New( isolate - , imp::FunctionCallbackWrapper - , obj - , signature)); - } else { - return v8::FunctionTemplate::New(isolate, 0, data, signature); - } -} - -//=== Number =================================================================== - -Factory::return_t -Factory::New(double value) { - return v8::Number::New(v8::Isolate::GetCurrent(), value); -} - -//=== Number Object ============================================================ - -Factory::return_t -Factory::New(double value) { - return v8::NumberObject::New( v8::Isolate::GetCurrent() - , value).As(); -} - -//=== Integer, Int32 and Uint32 ================================================ - -template -typename IntegerFactory::return_t -IntegerFactory::New(int32_t value) { - return To(T::New(v8::Isolate::GetCurrent(), value)); -} - -template -typename IntegerFactory::return_t -IntegerFactory::New(uint32_t value) { - return To(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); -} - -Factory::return_t -Factory::New(int32_t value) { - return To( - v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); -} - -Factory::return_t -Factory::New(uint32_t value) { - return To( - v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); -} - -//=== Object =================================================================== - -Factory::return_t -Factory::New() { - return v8::Object::New(v8::Isolate::GetCurrent()); -} - -//=== Object Template ========================================================== - -Factory::return_t -Factory::New() { - return v8::ObjectTemplate::New(v8::Isolate::GetCurrent()); -} - -//=== RegExp =================================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New( - v8::Local pattern - , v8::RegExp::Flags flags) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - v8::RegExp::New(isolate->GetCurrentContext(), pattern, flags) - .FromMaybe(v8::Local())); -} -#else -Factory::return_t -Factory::New( - v8::Local pattern - , v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); -} -#endif - -//=== Script =================================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New( v8::Local source) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source src(source); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) - .FromMaybe(v8::Local())); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source src(source, origin); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) - .FromMaybe(v8::Local())); -} -#else -Factory::return_t -Factory::New( v8::Local source) { - v8::ScriptCompiler::Source src(source); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::ScriptCompiler::Source src(source, origin); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); -} -#endif - -//=== Signature ================================================================ - -Factory::return_t -Factory::New(Factory::FTH receiver) { - return v8::Signature::New(v8::Isolate::GetCurrent(), receiver); -} - -//=== String =================================================================== - -Factory::return_t -Factory::New() { - return v8::String::Empty(v8::Isolate::GetCurrent()); -} - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New(const char * value, int length) { - return v8::String::NewFromUtf8( - v8::Isolate::GetCurrent(), value, v8::NewStringType::kNormal, length); -} - -Factory::return_t -Factory::New(std::string const& value) { - assert(value.size() <= INT_MAX && "string too long"); - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), - value.data(), v8::NewStringType::kNormal, static_cast(value.size())); -} - -Factory::return_t -Factory::New(const uint16_t * value, int length) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, - v8::NewStringType::kNormal, length); -} - -Factory::return_t -Factory::New(v8::String::ExternalStringResource * value) { - return v8::String::NewExternalTwoByte(v8::Isolate::GetCurrent(), value); -} - -Factory::return_t -Factory::New(ExternalOneByteStringResource * value) { - return v8::String::NewExternalOneByte(v8::Isolate::GetCurrent(), value); -} -#else -Factory::return_t -Factory::New(const char * value, int length) { - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value, - v8::String::kNormalString, length); -} - -Factory::return_t -Factory::New( - std::string const& value) /* NOLINT(build/include_what_you_use) */ { - assert(value.size() <= INT_MAX && "string too long"); - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value.data(), - v8::String::kNormalString, - static_cast(value.size())); -} - -Factory::return_t -Factory::New(const uint16_t * value, int length) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, - v8::String::kNormalString, length); -} - -Factory::return_t -Factory::New(v8::String::ExternalStringResource * value) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); -} - -Factory::return_t -Factory::New(ExternalOneByteStringResource * value) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); -} -#endif - -//=== String Object ============================================================ - -// See https://github.com/nodejs/nan/pull/811#discussion_r224594980. -// Disable the warning as there is no way around it. -// TODO(bnoordhuis) Use isolate-based version in Node.js v12. -Factory::return_t -Factory::New(v8::Local value) { -// V8 > 7.0 -#if V8_MAJOR_VERSION > 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION > 0) - return v8::StringObject::New(v8::Isolate::GetCurrent(), value) - .As(); -#else -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4996) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - return v8::StringObject::New(value).As(); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#endif -} - -//=== Unbound Script =========================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New(v8::Local source) { - v8::ScriptCompiler::Source src(source); - return v8::ScriptCompiler::CompileUnboundScript( - v8::Isolate::GetCurrent(), &src); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::ScriptCompiler::Source src(source, origin); - return v8::ScriptCompiler::CompileUnboundScript( - v8::Isolate::GetCurrent(), &src); -} -#else -Factory::return_t -Factory::New(v8::Local source) { - v8::ScriptCompiler::Source src(source); - return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::ScriptCompiler::Source src(source, origin); - return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); -} -#endif - -} // end of namespace imp - -//=== Presistents and Handles ================================================== - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION -template -inline v8::Local New(v8::Handle h) { - return v8::Local::New(v8::Isolate::GetCurrent(), h); -} -#endif - -template -inline v8::Local New(v8::Persistent const& p) { - return v8::Local::New(v8::Isolate::GetCurrent(), p); -} - -template -inline v8::Local New(Persistent const& p) { - return v8::Local::New(v8::Isolate::GetCurrent(), p); -} - -template -inline v8::Local New(Global const& p) { - return v8::Local::New(v8::Isolate::GetCurrent(), p); -} - -#endif // NAN_IMPLEMENTATION_12_INL_H_ diff --git a/node_modules/nan/nan_implementation_pre_12_inl.h b/node_modules/nan/nan_implementation_pre_12_inl.h deleted file mode 100644 index 1472421..0000000 --- a/node_modules/nan/nan_implementation_pre_12_inl.h +++ /dev/null @@ -1,263 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_ -#define NAN_IMPLEMENTATION_PRE_12_INL_H_ - -//============================================================================== -// node v0.10 implementation -//============================================================================== - -namespace imp { - -//=== Array ==================================================================== - -Factory::return_t -Factory::New() { - return v8::Array::New(); -} - -Factory::return_t -Factory::New(int length) { - return v8::Array::New(length); -} - -//=== Boolean ================================================================== - -Factory::return_t -Factory::New(bool value) { - return v8::Boolean::New(value)->ToBoolean(); -} - -//=== Boolean Object =========================================================== - -Factory::return_t -Factory::New(bool value) { - return v8::BooleanObject::New(value).As(); -} - -//=== Context ================================================================== - -Factory::return_t -Factory::New( v8::ExtensionConfiguration* extensions - , v8::Local tmpl - , v8::Local obj) { - v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); - v8::Local lctx = v8::Local::New(ctx); - ctx.Dispose(); - return lctx; -} - -//=== Date ===================================================================== - -Factory::return_t -Factory::New(double value) { - return v8::Date::New(value).As(); -} - -//=== External ================================================================= - -Factory::return_t -Factory::New(void * value) { - return v8::External::New(value); -} - -//=== Function ================================================================= - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data) { - v8::HandleScope scope; - - return scope.Close(Factory::New( - callback, data, v8::Local()) - ->GetFunction()); -} - - -//=== FunctionTemplate ========================================================= - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data - , v8::Local signature) { - if (callback) { - v8::HandleScope scope; - - v8::Local tpl = v8::ObjectTemplate::New(); - tpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = tpl->NewInstance(); - - obj->SetInternalField( - imp::kFunctionIndex - , v8::External::New(reinterpret_cast(callback))); - - v8::Local val = v8::Local::New(data); - - if (!val.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, val); - } - - // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find - // a way. Have at it though... - return scope.Close( - v8::FunctionTemplate::New(imp::FunctionCallbackWrapper - , obj - , signature)); - } else { - return v8::FunctionTemplate::New(0, data, signature); - } -} - -//=== Number =================================================================== - -Factory::return_t -Factory::New(double value) { - return v8::Number::New(value); -} - -//=== Number Object ============================================================ - -Factory::return_t -Factory::New(double value) { - return v8::NumberObject::New(value).As(); -} - -//=== Integer, Int32 and Uint32 ================================================ - -template -typename IntegerFactory::return_t -IntegerFactory::New(int32_t value) { - return To(T::New(value)); -} - -template -typename IntegerFactory::return_t -IntegerFactory::New(uint32_t value) { - return To(T::NewFromUnsigned(value)); -} - -Factory::return_t -Factory::New(int32_t value) { - return To(v8::Uint32::NewFromUnsigned(value)); -} - -Factory::return_t -Factory::New(uint32_t value) { - return To(v8::Uint32::NewFromUnsigned(value)); -} - - -//=== Object =================================================================== - -Factory::return_t -Factory::New() { - return v8::Object::New(); -} - -//=== Object Template ========================================================== - -Factory::return_t -Factory::New() { - return v8::ObjectTemplate::New(); -} - -//=== RegExp =================================================================== - -Factory::return_t -Factory::New( - v8::Local pattern - , v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); -} - -//=== Script =================================================================== - -Factory::return_t -Factory::New( v8::Local source) { - return v8::Script::New(source); -} -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - return v8::Script::New(source, const_cast(&origin)); -} - -//=== Signature ================================================================ - -Factory::return_t -Factory::New(Factory::FTH receiver) { - return v8::Signature::New(receiver); -} - -//=== String =================================================================== - -Factory::return_t -Factory::New() { - return v8::String::Empty(); -} - -Factory::return_t -Factory::New(const char * value, int length) { - return v8::String::New(value, length); -} - -Factory::return_t -Factory::New( - std::string const& value) /* NOLINT(build/include_what_you_use) */ { - assert(value.size() <= INT_MAX && "string too long"); - return v8::String::New(value.data(), static_cast(value.size())); -} - -Factory::return_t -Factory::New(const uint16_t * value, int length) { - return v8::String::New(value, length); -} - -Factory::return_t -Factory::New(v8::String::ExternalStringResource * value) { - return v8::String::NewExternal(value); -} - -Factory::return_t -Factory::New(v8::String::ExternalAsciiStringResource * value) { - return v8::String::NewExternal(value); -} - -//=== String Object ============================================================ - -Factory::return_t -Factory::New(v8::Local value) { - return v8::StringObject::New(value).As(); -} - -} // end of namespace imp - -//=== Presistents and Handles ================================================== - -template -inline v8::Local New(v8::Handle h) { - return v8::Local::New(h); -} - -template -inline v8::Local New(v8::Persistent const& p) { - return v8::Local::New(p); -} - -template -inline v8::Local New(Persistent const& p) { - return v8::Local::New(p.persistent); -} - -template -inline v8::Local New(Global const& p) { - return v8::Local::New(p.persistent); -} - -#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_ diff --git a/node_modules/nan/nan_json.h b/node_modules/nan/nan_json.h deleted file mode 100644 index 33ac8ba..0000000 --- a/node_modules/nan/nan_json.h +++ /dev/null @@ -1,166 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_JSON_H_ -#define NAN_JSON_H_ - -#if NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION -#define NAN_JSON_H_NEED_PARSE 1 -#else -#define NAN_JSON_H_NEED_PARSE 0 -#endif // NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION - -#if NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION -#define NAN_JSON_H_NEED_STRINGIFY 0 -#else -#define NAN_JSON_H_NEED_STRINGIFY 1 -#endif // NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION - -class JSON { - public: - JSON() { -#if NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY - Nan::HandleScope scope; - - Nan::MaybeLocal maybe_global_json = Nan::Get( - Nan::GetCurrentContext()->Global(), - Nan::New("JSON").ToLocalChecked() - ); - - assert(!maybe_global_json.IsEmpty() && "global JSON is empty"); - v8::Local val_global_json = maybe_global_json.ToLocalChecked(); - - assert(val_global_json->IsObject() && "global JSON is not an object"); - Nan::MaybeLocal maybe_obj_global_json = - Nan::To(val_global_json); - - assert(!maybe_obj_global_json.IsEmpty() && "global JSON object is empty"); - v8::Local global_json = maybe_obj_global_json.ToLocalChecked(); - -#if NAN_JSON_H_NEED_PARSE - Nan::MaybeLocal maybe_parse_method = Nan::Get( - global_json, Nan::New("parse").ToLocalChecked() - ); - - assert(!maybe_parse_method.IsEmpty() && "JSON.parse is empty"); - v8::Local parse_method = maybe_parse_method.ToLocalChecked(); - - assert(parse_method->IsFunction() && "JSON.parse is not a function"); - parse_cb_.Reset(parse_method.As()); -#endif // NAN_JSON_H_NEED_PARSE - -#if NAN_JSON_H_NEED_STRINGIFY - Nan::MaybeLocal maybe_stringify_method = Nan::Get( - global_json, Nan::New("stringify").ToLocalChecked() - ); - - assert(!maybe_stringify_method.IsEmpty() && "JSON.stringify is empty"); - v8::Local stringify_method = - maybe_stringify_method.ToLocalChecked(); - - assert( - stringify_method->IsFunction() && "JSON.stringify is not a function" - ); - stringify_cb_.Reset(stringify_method.As()); -#endif // NAN_JSON_H_NEED_STRINGIFY -#endif // NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY - } - - inline - Nan::MaybeLocal Parse(v8::Local json_string) { - Nan::EscapableHandleScope scope; -#if NAN_JSON_H_NEED_PARSE - return scope.Escape(parse(json_string)); -#else - Nan::MaybeLocal result; -#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && \ - NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION - result = v8::JSON::Parse(json_string); -#else -#if NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION - v8::Local context_or_isolate = Nan::GetCurrentContext(); -#else - v8::Isolate* context_or_isolate = v8::Isolate::GetCurrent(); -#endif // NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION - result = v8::JSON::Parse(context_or_isolate, json_string); -#endif // NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && - // NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION - if (result.IsEmpty()) return v8::Local(); - return scope.Escape(result.ToLocalChecked()); -#endif // NAN_JSON_H_NEED_PARSE - } - - inline - Nan::MaybeLocal Stringify(v8::Local json_object) { - Nan::EscapableHandleScope scope; - Nan::MaybeLocal result = -#if NAN_JSON_H_NEED_STRINGIFY - Nan::To(stringify(json_object)); -#else - v8::JSON::Stringify(Nan::GetCurrentContext(), json_object); -#endif // NAN_JSON_H_NEED_STRINGIFY - if (result.IsEmpty()) return v8::Local(); - return scope.Escape(result.ToLocalChecked()); - } - - inline - Nan::MaybeLocal Stringify(v8::Local json_object, - v8::Local gap) { - Nan::EscapableHandleScope scope; - Nan::MaybeLocal result = -#if NAN_JSON_H_NEED_STRINGIFY - Nan::To(stringify(json_object, gap)); -#else - v8::JSON::Stringify(Nan::GetCurrentContext(), json_object, gap); -#endif // NAN_JSON_H_NEED_STRINGIFY - if (result.IsEmpty()) return v8::Local(); - return scope.Escape(result.ToLocalChecked()); - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(JSON) -#if NAN_JSON_H_NEED_PARSE - Nan::Callback parse_cb_; -#endif // NAN_JSON_H_NEED_PARSE -#if NAN_JSON_H_NEED_STRINGIFY - Nan::Callback stringify_cb_; -#endif // NAN_JSON_H_NEED_STRINGIFY - -#if NAN_JSON_H_NEED_PARSE - inline v8::Local parse(v8::Local arg) { - assert(!parse_cb_.IsEmpty() && "parse_cb_ is empty"); - AsyncResource resource("nan:JSON.parse"); - return parse_cb_.Call(1, &arg, &resource).FromMaybe(v8::Local()); - } -#endif // NAN_JSON_H_NEED_PARSE - -#if NAN_JSON_H_NEED_STRINGIFY - inline v8::Local stringify(v8::Local arg) { - assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); - AsyncResource resource("nan:JSON.stringify"); - return stringify_cb_.Call(1, &arg, &resource) - .FromMaybe(v8::Local()); - } - - inline v8::Local stringify(v8::Local arg, - v8::Local gap) { - assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); - - v8::Local argv[] = { - arg, - Nan::Null(), - gap - }; - AsyncResource resource("nan:JSON.stringify"); - return stringify_cb_.Call(3, argv, &resource) - .FromMaybe(v8::Local()); - } -#endif // NAN_JSON_H_NEED_STRINGIFY -}; - -#endif // NAN_JSON_H_ diff --git a/node_modules/nan/nan_maybe_43_inl.h b/node_modules/nan/nan_maybe_43_inl.h deleted file mode 100644 index c04ce30..0000000 --- a/node_modules/nan/nan_maybe_43_inl.h +++ /dev/null @@ -1,356 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_MAYBE_43_INL_H_ -#define NAN_MAYBE_43_INL_H_ - -template -using MaybeLocal = v8::MaybeLocal; - -inline -MaybeLocal ToDetailString(v8::Local val) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(val->ToDetailString(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal ToArrayIndex(v8::Local val) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(val->ToArrayIndex(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -Maybe Equals(v8::Local a, v8::Local(b)) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return a->Equals(isolate->GetCurrentContext(), b); -} - -inline -MaybeLocal NewInstance(v8::Local h) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal NewInstance( - v8::Local h - , int argc - , v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(h->NewInstance(isolate->GetCurrentContext(), argc, argv) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal NewInstance(v8::Local h) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - - -inline MaybeLocal GetFunction( - v8::Local t) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(t->GetFunction(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe Set( - v8::Local obj - , v8::Local key - , v8::Local value) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Set(isolate->GetCurrentContext(), key, value); -} - -inline Maybe Set( - v8::Local obj - , uint32_t index - , v8::Local value) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Set(isolate->GetCurrentContext(), index, value); -} - -#if NODE_MODULE_VERSION < NODE_4_0_MODULE_VERSION -#include "nan_define_own_property_helper.h" // NOLINT(build/include) -#endif - -inline Maybe DefineOwnProperty( - v8::Local obj - , v8::Local key - , v8::Local value - , v8::PropertyAttribute attribs = v8::None) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); -#if NODE_MODULE_VERSION >= NODE_4_0_MODULE_VERSION - return obj->DefineOwnProperty(isolate->GetCurrentContext(), key, value, - attribs); -#else - Maybe maybeCurrent = - obj->GetPropertyAttributes(isolate->GetCurrentContext(), key); - if (maybeCurrent.IsNothing()) { - return Nothing(); - } - v8::PropertyAttribute current = maybeCurrent.FromJust(); - return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); -#endif -} - -NAN_DEPRECATED inline Maybe ForceSet( - v8::Local obj - , v8::Local key - , v8::Local value - , v8::PropertyAttribute attribs = v8::None) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - return key->IsName() - ? obj->DefineOwnProperty(isolate->GetCurrentContext(), - key.As(), value, attribs) - : Nothing(); -#else - return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs); -#endif -} - -inline MaybeLocal Get( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->Get(isolate->GetCurrentContext(), key) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal Get(v8::Local obj, uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->Get(isolate->GetCurrentContext(), index) - .FromMaybe(v8::Local())); -} - -inline v8::PropertyAttribute GetPropertyAttributes( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->GetPropertyAttributes(isolate->GetCurrentContext(), key) - .FromJust(); -} - -inline Maybe Has( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Has(isolate->GetCurrentContext(), key); -} - -inline Maybe Has(v8::Local obj, uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Has(isolate->GetCurrentContext(), index); -} - -inline Maybe Delete( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Delete(isolate->GetCurrentContext(), key); -} - -inline -Maybe Delete(v8::Local obj, uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Delete(isolate->GetCurrentContext(), index); -} - -inline -MaybeLocal GetPropertyNames(v8::Local obj) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->GetPropertyNames(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal GetOwnPropertyNames(v8::Local obj) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->GetOwnPropertyNames(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe SetPrototype( - v8::Local obj - , v8::Local prototype) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->SetPrototype(isolate->GetCurrentContext(), prototype); -} - -inline MaybeLocal ObjectProtoToString( - v8::Local obj) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->ObjectProtoToString(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe HasOwnProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasOwnProperty(isolate->GetCurrentContext(), key); -} - -inline Maybe HasRealNamedProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasRealNamedProperty(isolate->GetCurrentContext(), key); -} - -inline Maybe HasRealIndexedProperty( - v8::Local obj - , uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasRealIndexedProperty(isolate->GetCurrentContext(), index); -} - -inline Maybe HasRealNamedCallbackProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasRealNamedCallbackProperty(isolate->GetCurrentContext(), key); -} - -inline MaybeLocal GetRealNamedPropertyInPrototypeChain( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->GetRealNamedPropertyInPrototypeChain( - isolate->GetCurrentContext(), key) - .FromMaybe(v8::Local())); -} - -inline MaybeLocal GetRealNamedProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - obj->GetRealNamedProperty(isolate->GetCurrentContext(), key) - .FromMaybe(v8::Local())); -} - -inline MaybeLocal CallAsFunction( - v8::Local obj - , v8::Local recv - , int argc - , v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - obj->CallAsFunction(isolate->GetCurrentContext(), recv, argc, argv) - .FromMaybe(v8::Local())); -} - -inline MaybeLocal CallAsConstructor( - v8::Local obj - , int argc, v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - obj->CallAsConstructor(isolate->GetCurrentContext(), argc, argv) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal GetSourceLine(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(msg->GetSourceLine(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe GetLineNumber(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return msg->GetLineNumber(isolate->GetCurrentContext()); -} - -inline Maybe GetStartColumn(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return msg->GetStartColumn(isolate->GetCurrentContext()); -} - -inline Maybe GetEndColumn(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return msg->GetEndColumn(isolate->GetCurrentContext()); -} - -inline MaybeLocal CloneElementAt( - v8::Local array - , uint32_t index) { -#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::Local context = isolate->GetCurrentContext(); - v8::Local elem; - v8::Local obj; - if (!array->Get(context, index).ToLocal(&elem)) { - return scope.Escape(obj); - } - if (!elem->ToObject(context).ToLocal(&obj)) { - return scope.Escape(v8::Local()); - } - return scope.Escape(obj->Clone()); -#else - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(array->CloneElementAt(isolate->GetCurrentContext(), index) - .FromMaybe(v8::Local())); -#endif -} - -inline MaybeLocal Call( - v8::Local fun - , v8::Local recv - , int argc - , v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(fun->Call(isolate->GetCurrentContext(), recv, argc, argv) - .FromMaybe(v8::Local())); -} - -#endif // NAN_MAYBE_43_INL_H_ diff --git a/node_modules/nan/nan_maybe_pre_43_inl.h b/node_modules/nan/nan_maybe_pre_43_inl.h deleted file mode 100644 index 83325ae..0000000 --- a/node_modules/nan/nan_maybe_pre_43_inl.h +++ /dev/null @@ -1,268 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_MAYBE_PRE_43_INL_H_ -#define NAN_MAYBE_PRE_43_INL_H_ - -template -class MaybeLocal { - public: - inline MaybeLocal() : val_(v8::Local()) {} - - template -# if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION - inline - MaybeLocal(v8::Local that) : val_(that) {} // NOLINT(runtime/explicit) -# else - inline - MaybeLocal(v8::Local that) : // NOLINT(runtime/explicit) - val_(*reinterpret_cast*>(&that)) {} -# endif - - inline bool IsEmpty() const { return val_.IsEmpty(); } - - template - inline bool ToLocal(v8::Local *out) const { - *out = val_; - return !IsEmpty(); - } - - inline v8::Local ToLocalChecked() const { -#if defined(V8_ENABLE_CHECKS) - assert(!IsEmpty() && "ToLocalChecked is Empty"); -#endif // V8_ENABLE_CHECKS - return val_; - } - - template - inline v8::Local FromMaybe(v8::Local default_value) const { - return IsEmpty() ? default_value : v8::Local(val_); - } - - private: - v8::Local val_; -}; - -inline -MaybeLocal ToDetailString(v8::Handle val) { - return MaybeLocal(val->ToDetailString()); -} - -inline -MaybeLocal ToArrayIndex(v8::Handle val) { - return MaybeLocal(val->ToArrayIndex()); -} - -inline -Maybe Equals(v8::Handle a, v8::Handle(b)) { - return Just(a->Equals(b)); -} - -inline -MaybeLocal NewInstance(v8::Handle h) { - return MaybeLocal(h->NewInstance()); -} - -inline -MaybeLocal NewInstance( - v8::Local h - , int argc - , v8::Local argv[]) { - return MaybeLocal(h->NewInstance(argc, argv)); -} - -inline -MaybeLocal NewInstance(v8::Handle h) { - return MaybeLocal(h->NewInstance()); -} - -inline -MaybeLocal GetFunction(v8::Handle t) { - return MaybeLocal(t->GetFunction()); -} - -inline Maybe Set( - v8::Handle obj - , v8::Handle key - , v8::Handle value) { - return Just(obj->Set(key, value)); -} - -inline Maybe Set( - v8::Handle obj - , uint32_t index - , v8::Handle value) { - return Just(obj->Set(index, value)); -} - -#include "nan_define_own_property_helper.h" // NOLINT(build/include) - -inline Maybe DefineOwnProperty( - v8::Handle obj - , v8::Handle key - , v8::Handle value - , v8::PropertyAttribute attribs = v8::None) { - v8::PropertyAttribute current = obj->GetPropertyAttributes(key); - return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); -} - -NAN_DEPRECATED inline Maybe ForceSet( - v8::Handle obj - , v8::Handle key - , v8::Handle value - , v8::PropertyAttribute attribs = v8::None) { - return Just(obj->ForceSet(key, value, attribs)); -} - -inline MaybeLocal Get( - v8::Handle obj - , v8::Handle key) { - return MaybeLocal(obj->Get(key)); -} - -inline MaybeLocal Get( - v8::Handle obj - , uint32_t index) { - return MaybeLocal(obj->Get(index)); -} - -inline Maybe GetPropertyAttributes( - v8::Handle obj - , v8::Handle key) { - return Just(obj->GetPropertyAttributes(key)); -} - -inline Maybe Has( - v8::Handle obj - , v8::Handle key) { - return Just(obj->Has(key)); -} - -inline Maybe Has( - v8::Handle obj - , uint32_t index) { - return Just(obj->Has(index)); -} - -inline Maybe Delete( - v8::Handle obj - , v8::Handle key) { - return Just(obj->Delete(key)); -} - -inline Maybe Delete( - v8::Handle obj - , uint32_t index) { - return Just(obj->Delete(index)); -} - -inline -MaybeLocal GetPropertyNames(v8::Handle obj) { - return MaybeLocal(obj->GetPropertyNames()); -} - -inline -MaybeLocal GetOwnPropertyNames(v8::Handle obj) { - return MaybeLocal(obj->GetOwnPropertyNames()); -} - -inline Maybe SetPrototype( - v8::Handle obj - , v8::Handle prototype) { - return Just(obj->SetPrototype(prototype)); -} - -inline MaybeLocal ObjectProtoToString( - v8::Handle obj) { - return MaybeLocal(obj->ObjectProtoToString()); -} - -inline Maybe HasOwnProperty( - v8::Handle obj - , v8::Handle key) { - return Just(obj->HasOwnProperty(key)); -} - -inline Maybe HasRealNamedProperty( - v8::Handle obj - , v8::Handle key) { - return Just(obj->HasRealNamedProperty(key)); -} - -inline Maybe HasRealIndexedProperty( - v8::Handle obj - , uint32_t index) { - return Just(obj->HasRealIndexedProperty(index)); -} - -inline Maybe HasRealNamedCallbackProperty( - v8::Handle obj - , v8::Handle key) { - return Just(obj->HasRealNamedCallbackProperty(key)); -} - -inline MaybeLocal GetRealNamedPropertyInPrototypeChain( - v8::Handle obj - , v8::Handle key) { - return MaybeLocal( - obj->GetRealNamedPropertyInPrototypeChain(key)); -} - -inline MaybeLocal GetRealNamedProperty( - v8::Handle obj - , v8::Handle key) { - return MaybeLocal(obj->GetRealNamedProperty(key)); -} - -inline MaybeLocal CallAsFunction( - v8::Handle obj - , v8::Handle recv - , int argc - , v8::Handle argv[]) { - return MaybeLocal(obj->CallAsFunction(recv, argc, argv)); -} - -inline MaybeLocal CallAsConstructor( - v8::Handle obj - , int argc - , v8::Local argv[]) { - return MaybeLocal(obj->CallAsConstructor(argc, argv)); -} - -inline -MaybeLocal GetSourceLine(v8::Handle msg) { - return MaybeLocal(msg->GetSourceLine()); -} - -inline Maybe GetLineNumber(v8::Handle msg) { - return Just(msg->GetLineNumber()); -} - -inline Maybe GetStartColumn(v8::Handle msg) { - return Just(msg->GetStartColumn()); -} - -inline Maybe GetEndColumn(v8::Handle msg) { - return Just(msg->GetEndColumn()); -} - -inline MaybeLocal CloneElementAt( - v8::Handle array - , uint32_t index) { - return MaybeLocal(array->CloneElementAt(index)); -} - -inline MaybeLocal Call( - v8::Local fun - , v8::Local recv - , int argc - , v8::Local argv[]) { - return MaybeLocal(fun->Call(recv, argc, argv)); -} - -#endif // NAN_MAYBE_PRE_43_INL_H_ diff --git a/node_modules/nan/nan_new.h b/node_modules/nan/nan_new.h deleted file mode 100644 index cdf8bbe..0000000 --- a/node_modules/nan/nan_new.h +++ /dev/null @@ -1,340 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_NEW_H_ -#define NAN_NEW_H_ - -namespace imp { // scnr - -// TODO(agnat): Generalize -template v8::Local To(v8::Local i); - -template <> -inline -v8::Local -To(v8::Local i) { - return Nan::To(i).ToLocalChecked(); -} - -template <> -inline -v8::Local -To(v8::Local i) { - return Nan::To(i).ToLocalChecked(); -} - -template <> -inline -v8::Local -To(v8::Local i) { - return Nan::To(i).ToLocalChecked(); -} - -template struct FactoryBase { - typedef v8::Local return_t; -}; - -template struct MaybeFactoryBase { - typedef MaybeLocal return_t; -}; - -template struct Factory; - -template <> -struct Factory : FactoryBase { - static inline return_t New(); - static inline return_t New(int length); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(bool value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(bool value); -}; - -template <> -struct Factory : FactoryBase { - static inline - return_t - New( v8::ExtensionConfiguration* extensions = NULL - , v8::Local tmpl = v8::Local() - , v8::Local obj = v8::Local()); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New(double value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(void *value); -}; - -template <> -struct Factory : FactoryBase { - static inline - return_t - New( FunctionCallback callback - , v8::Local data = v8::Local()); -}; - -template <> -struct Factory : FactoryBase { - static inline - return_t - New( FunctionCallback callback = NULL - , v8::Local data = v8::Local() - , v8::Local signature = v8::Local()); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(double value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(double value); -}; - -template -struct IntegerFactory : FactoryBase { - typedef typename FactoryBase::return_t return_t; - static inline return_t New(int32_t value); - static inline return_t New(uint32_t value); -}; - -template <> -struct Factory : IntegerFactory {}; - -template <> -struct Factory : IntegerFactory {}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(int32_t value); - static inline return_t New(uint32_t value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New( - v8::Local pattern, v8::RegExp::Flags flags); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New( v8::Local source); - static inline return_t New( v8::Local source - , v8::ScriptOrigin const& origin); -}; - -template <> -struct Factory : FactoryBase { - typedef v8::Local FTH; - static inline return_t New(FTH receiver = FTH()); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New(); - static inline return_t New(const char *value, int length = -1); - static inline return_t New(const uint16_t *value, int length = -1); - static inline return_t New(std::string const& value); - - static inline return_t New(v8::String::ExternalStringResource * value); - static inline return_t New(ExternalOneByteStringResource * value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(v8::Local value); -}; - -} // end of namespace imp - -#if (NODE_MODULE_VERSION >= 12) - -namespace imp { - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New( v8::Local source); - static inline return_t New( v8::Local source - , v8::ScriptOrigin const& origin); -}; - -} // end of namespace imp - -# include "nan_implementation_12_inl.h" - -#else // NODE_MODULE_VERSION >= 12 - -# include "nan_implementation_pre_12_inl.h" - -#endif - -//=== API ====================================================================== - -template -typename imp::Factory::return_t -New() { - return imp::Factory::New(); -} - -template -typename imp::Factory::return_t -New(A0 arg0) { - return imp::Factory::New(arg0); -} - -template -typename imp::Factory::return_t -New(A0 arg0, A1 arg1) { - return imp::Factory::New(arg0, arg1); -} - -template -typename imp::Factory::return_t -New(A0 arg0, A1 arg1, A2 arg2) { - return imp::Factory::New(arg0, arg1, arg2); -} - -template -typename imp::Factory::return_t -New(A0 arg0, A1 arg1, A2 arg2, A3 arg3) { - return imp::Factory::New(arg0, arg1, arg2, arg3); -} - -// Note(agnat): When passing overloaded function pointers to template functions -// as generic arguments the compiler needs help in picking the right overload. -// These two functions handle New and New with -// all argument variations. - -// v8::Function and v8::FunctionTemplate with one or two arguments -template -typename imp::Factory::return_t -New( FunctionCallback callback - , v8::Local data = v8::Local()) { - return imp::Factory::New(callback, data); -} - -// v8::Function and v8::FunctionTemplate with three arguments -template -typename imp::Factory::return_t -New( FunctionCallback callback - , v8::Local data = v8::Local() - , A2 a2 = A2()) { - return imp::Factory::New(callback, data, a2); -} - -// Convenience - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION -template inline v8::Local New(v8::Handle h); -#endif - -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -template - inline v8::Local New(v8::Persistent const& p); -#else -template inline v8::Local New(v8::Persistent const& p); -#endif -template -inline v8::Local New(Persistent const& p); -template -inline v8::Local New(Global const& p); - -inline -imp::Factory::return_t -New(bool value) { - return New(value); -} - -inline -imp::Factory::return_t -New(int32_t value) { - return New(value); -} - -inline -imp::Factory::return_t -New(uint32_t value) { - return New(value); -} - -inline -imp::Factory::return_t -New(double value) { - return New(value); -} - -inline -imp::Factory::return_t -New(std::string const& value) { // NOLINT(build/include_what_you_use) - return New(value); -} - -inline -imp::Factory::return_t -New(const char * value, int length) { - return New(value, length); -} - -inline -imp::Factory::return_t -New(const uint16_t * value, int length) { - return New(value, length); -} - -inline -imp::Factory::return_t -New(const char * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(const uint16_t * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(v8::String::ExternalStringResource * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(ExternalOneByteStringResource * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(v8::Local pattern, v8::RegExp::Flags flags) { - return New(pattern, flags); -} - -#endif // NAN_NEW_H_ diff --git a/node_modules/nan/nan_object_wrap.h b/node_modules/nan/nan_object_wrap.h deleted file mode 100644 index 78712f9..0000000 --- a/node_modules/nan/nan_object_wrap.h +++ /dev/null @@ -1,156 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_OBJECT_WRAP_H_ -#define NAN_OBJECT_WRAP_H_ - -class ObjectWrap { - public: - ObjectWrap() { - refs_ = 0; - } - - - virtual ~ObjectWrap() { - if (persistent().IsEmpty()) { - return; - } - - persistent().ClearWeak(); - persistent().Reset(); - } - - - template - static inline T* Unwrap(v8::Local object) { - assert(!object.IsEmpty()); - assert(object->InternalFieldCount() > 0); - // Cast to ObjectWrap before casting to T. A direct cast from void - // to T won't work right when T has more than one base class. - void* ptr = GetInternalFieldPointer(object, 0); - ObjectWrap* wrap = static_cast(ptr); - return static_cast(wrap); - } - - - inline v8::Local handle() const { - return New(handle_); - } - - - inline Persistent& persistent() { - return handle_; - } - - - protected: - inline void Wrap(v8::Local object) { - assert(persistent().IsEmpty()); - assert(object->InternalFieldCount() > 0); - SetInternalFieldPointer(object, 0, this); - persistent().Reset(object); - MakeWeak(); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - - inline void MakeWeak() { - persistent().v8::PersistentBase::SetWeak( - this, WeakCallback, v8::WeakCallbackType::kParameter); -#if NODE_MAJOR_VERSION < 10 - // FIXME(bnoordhuis) Probably superfluous in older Node.js versions too. - persistent().MarkIndependent(); -#endif - } - -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - - inline void MakeWeak() { - persistent().v8::PersistentBase::SetWeak(this, WeakCallback); - persistent().MarkIndependent(); - } - -#else - - inline void MakeWeak() { - persistent().persistent.MakeWeak(this, WeakCallback); - persistent().MarkIndependent(); - } - -#endif - - /* Ref() marks the object as being attached to an event loop. - * Refed objects will not be garbage collected, even if - * all references are lost. - */ - virtual void Ref() { - assert(!persistent().IsEmpty()); - persistent().ClearWeak(); - refs_++; - } - - /* Unref() marks an object as detached from the event loop. This is its - * default state. When an object with a "weak" reference changes from - * attached to detached state it will be freed. Be careful not to access - * the object after making this call as it might be gone! - * (A "weak reference" means an object that only has a - * persistent handle.) - * - * DO NOT CALL THIS FROM DESTRUCTOR - */ - virtual void Unref() { - assert(!persistent().IsEmpty()); - assert(!persistent().IsWeak()); - assert(refs_ > 0); - if (--refs_ == 0) - MakeWeak(); - } - - int refs_; // ro - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap) -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - - static void - WeakCallback(v8::WeakCallbackInfo const& info) { - ObjectWrap* wrap = info.GetParameter(); - assert(wrap->refs_ == 0); - wrap->handle_.Reset(); - delete wrap; - } - -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - - static void - WeakCallback(v8::WeakCallbackData const& data) { - ObjectWrap* wrap = data.GetParameter(); - assert(wrap->refs_ == 0); - assert(wrap->handle_.IsNearDeath()); - wrap->handle_.Reset(); - delete wrap; - } - -#else - - static void WeakCallback(v8::Persistent value, void *data) { - ObjectWrap *wrap = static_cast(data); - assert(wrap->refs_ == 0); - assert(wrap->handle_.IsNearDeath()); - wrap->handle_.Reset(); - delete wrap; - } - -#endif - Persistent handle_; -}; - - -#endif // NAN_OBJECT_WRAP_H_ diff --git a/node_modules/nan/nan_persistent_12_inl.h b/node_modules/nan/nan_persistent_12_inl.h deleted file mode 100644 index d9649e8..0000000 --- a/node_modules/nan/nan_persistent_12_inl.h +++ /dev/null @@ -1,132 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_PERSISTENT_12_INL_H_ -#define NAN_PERSISTENT_12_INL_H_ - -template class Persistent : - public v8::Persistent { - public: - inline Persistent() : v8::Persistent() {} - - template inline Persistent(v8::Local that) : - v8::Persistent(v8::Isolate::GetCurrent(), that) {} - - template - inline - Persistent(const v8::Persistent &that) : // NOLINT(runtime/explicit) - v8::Persistent(v8::Isolate::GetCurrent(), that) {} - - inline void Reset() { v8::PersistentBase::Reset(); } - - template - inline void Reset(const v8::Local &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void Reset(const v8::PersistentBase &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type); - - private: - inline T *operator*() const { return *PersistentBase::persistent; } - - template - inline void Copy(const Persistent &that) { - TYPE_CHECK(T, S); - - this->Reset(); - - if (!that.IsEmpty()) { - this->Reset(that); - M::Copy(that, this); - } - } -}; - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -template -class Global : public v8::Global { - public: - inline Global() : v8::Global() {} - - template inline Global(v8::Local that) : - v8::Global(v8::Isolate::GetCurrent(), that) {} - - template - inline - Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) - v8::Global(v8::Isolate::GetCurrent(), that) {} - - inline void Reset() { v8::PersistentBase::Reset(); } - - template - inline void Reset(const v8::Local &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void Reset(const v8::PersistentBase &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - reinterpret_cast*>(this)->SetWeak( - parameter, callback, type); - } -}; -#else -template -class Global : public v8::UniquePersistent { - public: - inline Global() : v8::UniquePersistent() {} - - template inline Global(v8::Local that) : - v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} - - template - inline - Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) - v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} - - inline void Reset() { v8::PersistentBase::Reset(); } - - template - inline void Reset(const v8::Local &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void Reset(const v8::PersistentBase &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - reinterpret_cast*>(this)->SetWeak( - parameter, callback, type); - } -}; -#endif - -#endif // NAN_PERSISTENT_12_INL_H_ diff --git a/node_modules/nan/nan_persistent_pre_12_inl.h b/node_modules/nan/nan_persistent_pre_12_inl.h deleted file mode 100644 index 4c9c59d..0000000 --- a/node_modules/nan/nan_persistent_pre_12_inl.h +++ /dev/null @@ -1,242 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_PERSISTENT_PRE_12_INL_H_ -#define NAN_PERSISTENT_PRE_12_INL_H_ - -template -class PersistentBase { - v8::Persistent persistent; - template - friend v8::Local New(const PersistentBase &p); - template - friend v8::Local New(const Persistent &p); - template - friend v8::Local New(const Global &p); - template friend class ReturnValue; - - public: - inline PersistentBase() : - persistent() {} - - inline void Reset() { - persistent.Dispose(); - persistent.Clear(); - } - - template - inline void Reset(const v8::Local &other) { - TYPE_CHECK(T, S); - - if (!persistent.IsEmpty()) { - persistent.Dispose(); - } - - if (other.IsEmpty()) { - persistent.Clear(); - } else { - persistent = v8::Persistent::New(other); - } - } - - template - inline void Reset(const PersistentBase &other) { - TYPE_CHECK(T, S); - - if (!persistent.IsEmpty()) { - persistent.Dispose(); - } - - if (other.IsEmpty()) { - persistent.Clear(); - } else { - persistent = v8::Persistent::New(other.persistent); - } - } - - inline bool IsEmpty() const { return persistent.IsEmpty(); } - - inline void Empty() { persistent.Clear(); } - - template - inline bool operator==(const PersistentBase &that) const { - return this->persistent == that.persistent; - } - - template - inline bool operator==(const v8::Local &that) const { - return this->persistent == that; - } - - template - inline bool operator!=(const PersistentBase &that) const { - return !operator==(that); - } - - template - inline bool operator!=(const v8::Local &that) const { - return !operator==(that); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type); - - inline void ClearWeak() { persistent.ClearWeak(); } - - inline void MarkIndependent() { persistent.MarkIndependent(); } - - inline bool IsIndependent() const { return persistent.IsIndependent(); } - - inline bool IsNearDeath() const { return persistent.IsNearDeath(); } - - inline bool IsWeak() const { return persistent.IsWeak(); } - - private: - inline explicit PersistentBase(v8::Persistent that) : - persistent(that) { } - inline explicit PersistentBase(T *val) : persistent(val) {} - template friend class Persistent; - template friend class Global; - friend class ObjectWrap; -}; - -template -class NonCopyablePersistentTraits { - public: - typedef Persistent > - NonCopyablePersistent; - static const bool kResetInDestructor = false; - template - inline static void Copy(const Persistent &source, - NonCopyablePersistent *dest) { - Uncompilable(); - } - - template inline static void Uncompilable() { - TYPE_CHECK(O, v8::Primitive); - } -}; - -template -struct CopyablePersistentTraits { - typedef Persistent > CopyablePersistent; - static const bool kResetInDestructor = true; - template - static inline void Copy(const Persistent &source, - CopyablePersistent *dest) {} -}; - -template class Persistent : - public PersistentBase { - public: - inline Persistent() {} - - template inline Persistent(v8::Handle that) - : PersistentBase(v8::Persistent::New(that)) { - TYPE_CHECK(T, S); - } - - inline Persistent(const Persistent &that) : PersistentBase() { - Copy(that); - } - - template - inline Persistent(const Persistent &that) : - PersistentBase() { - Copy(that); - } - - inline Persistent &operator=(const Persistent &that) { - Copy(that); - return *this; - } - - template - inline Persistent &operator=(const Persistent &that) { - Copy(that); - return *this; - } - - inline ~Persistent() { - if (M::kResetInDestructor) this->Reset(); - } - - private: - inline T *operator*() const { return *PersistentBase::persistent; } - - template - inline void Copy(const Persistent &that) { - TYPE_CHECK(T, S); - - this->Reset(); - - if (!that.IsEmpty()) { - this->persistent = v8::Persistent::New(that.persistent); - M::Copy(that, this); - } - } -}; - -template -class Global : public PersistentBase { - struct RValue { - inline explicit RValue(Global* obj) : object(obj) {} - Global* object; - }; - - public: - inline Global() : PersistentBase(0) { } - - template - inline Global(v8::Local that) // NOLINT(runtime/explicit) - : PersistentBase(v8::Persistent::New(that)) { - TYPE_CHECK(T, S); - } - - template - inline Global(const PersistentBase &that) // NOLINT(runtime/explicit) - : PersistentBase(that) { - TYPE_CHECK(T, S); - } - /** - * Move constructor. - */ - inline Global(RValue rvalue) // NOLINT(runtime/explicit) - : PersistentBase(rvalue.object->persistent) { - rvalue.object->Reset(); - } - inline ~Global() { this->Reset(); } - /** - * Move via assignment. - */ - template - inline Global &operator=(Global rhs) { - TYPE_CHECK(T, S); - this->Reset(rhs.persistent); - rhs.Reset(); - return *this; - } - /** - * Cast operator for moves. - */ - inline operator RValue() { return RValue(this); } - /** - * Pass allows returning uniques from functions, etc. - */ - Global Pass() { return Global(RValue(this)); } - - private: - Global(Global &); - void operator=(Global &); - template friend class ReturnValue; -}; - -#endif // NAN_PERSISTENT_PRE_12_INL_H_ diff --git a/node_modules/nan/nan_private.h b/node_modules/nan/nan_private.h deleted file mode 100644 index 15f44cc..0000000 --- a/node_modules/nan/nan_private.h +++ /dev/null @@ -1,73 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_PRIVATE_H_ -#define NAN_PRIVATE_H_ - -inline Maybe -HasPrivate(v8::Local object, v8::Local key) { - HandleScope scope; -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::Local context = isolate->GetCurrentContext(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - return object->HasPrivate(context, private_key); -#else - return Just(!object->GetHiddenValue(key).IsEmpty()); -#endif -} - -inline MaybeLocal -GetPrivate(v8::Local object, v8::Local key) { -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::Local context = isolate->GetCurrentContext(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - v8::MaybeLocal v = object->GetPrivate(context, private_key); - return scope.Escape(v.ToLocalChecked()); -#else - EscapableHandleScope scope; - v8::Local v = object->GetHiddenValue(key); - if (v.IsEmpty()) { - v = Undefined(); - } - return scope.Escape(v); -#endif -} - -inline Maybe SetPrivate( - v8::Local object, - v8::Local key, - v8::Local value) { -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - HandleScope scope; - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::Local context = isolate->GetCurrentContext(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - return object->SetPrivate(context, private_key, value); -#else - return Just(object->SetHiddenValue(key, value)); -#endif -} - -inline Maybe DeletePrivate( - v8::Local object, - v8::Local key) { -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - HandleScope scope; - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - return object->DeletePrivate(isolate->GetCurrentContext(), private_key); -#else - return Just(object->DeleteHiddenValue(key)); -#endif -} - -#endif // NAN_PRIVATE_H_ - diff --git a/node_modules/nan/nan_string_bytes.h b/node_modules/nan/nan_string_bytes.h deleted file mode 100644 index a2e6437..0000000 --- a/node_modules/nan/nan_string_bytes.h +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef NAN_STRING_BYTES_H_ -#define NAN_STRING_BYTES_H_ - -// Decodes a v8::Local or Buffer to a raw char* - -namespace imp { - -using v8::Local; -using v8::Object; -using v8::String; -using v8::Value; - - -//// Base 64 //// - -#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) - - - -//// HEX //// - -static bool contains_non_ascii_slow(const char* buf, size_t len) { - for (size_t i = 0; i < len; ++i) { - if (buf[i] & 0x80) return true; - } - return false; -} - - -static bool contains_non_ascii(const char* src, size_t len) { - if (len < 16) { - return contains_non_ascii_slow(src, len); - } - - const unsigned bytes_per_word = sizeof(void*); - const unsigned align_mask = bytes_per_word - 1; - const unsigned unaligned = reinterpret_cast(src) & align_mask; - - if (unaligned > 0) { - const unsigned n = bytes_per_word - unaligned; - if (contains_non_ascii_slow(src, n)) return true; - src += n; - len -= n; - } - - -#if defined(__x86_64__) || defined(_WIN64) - const uintptr_t mask = 0x8080808080808080ll; -#else - const uintptr_t mask = 0x80808080l; -#endif - - const uintptr_t* srcw = reinterpret_cast(src); - - for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { - if (srcw[i] & mask) return true; - } - - const unsigned remainder = len & align_mask; - if (remainder > 0) { - const size_t offset = len - remainder; - if (contains_non_ascii_slow(src + offset, remainder)) return true; - } - - return false; -} - - -static void force_ascii_slow(const char* src, char* dst, size_t len) { - for (size_t i = 0; i < len; ++i) { - dst[i] = src[i] & 0x7f; - } -} - - -static void force_ascii(const char* src, char* dst, size_t len) { - if (len < 16) { - force_ascii_slow(src, dst, len); - return; - } - - const unsigned bytes_per_word = sizeof(void*); - const unsigned align_mask = bytes_per_word - 1; - const unsigned src_unalign = reinterpret_cast(src) & align_mask; - const unsigned dst_unalign = reinterpret_cast(dst) & align_mask; - - if (src_unalign > 0) { - if (src_unalign == dst_unalign) { - const unsigned unalign = bytes_per_word - src_unalign; - force_ascii_slow(src, dst, unalign); - src += unalign; - dst += unalign; - len -= src_unalign; - } else { - force_ascii_slow(src, dst, len); - return; - } - } - -#if defined(__x86_64__) || defined(_WIN64) - const uintptr_t mask = ~0x8080808080808080ll; -#else - const uintptr_t mask = ~0x80808080l; -#endif - - const uintptr_t* srcw = reinterpret_cast(src); - uintptr_t* dstw = reinterpret_cast(dst); - - for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { - dstw[i] = srcw[i] & mask; - } - - const unsigned remainder = len & align_mask; - if (remainder > 0) { - const size_t offset = len - remainder; - force_ascii_slow(src + offset, dst + offset, remainder); - } -} - - -static size_t base64_encode(const char* src, - size_t slen, - char* dst, - size_t dlen) { - // We know how much we'll write, just make sure that there's space. - assert(dlen >= base64_encoded_size(slen) && - "not enough space provided for base64 encode"); - - dlen = base64_encoded_size(slen); - - unsigned a; - unsigned b; - unsigned c; - unsigned i; - unsigned k; - unsigned n; - - static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - - i = 0; - k = 0; - n = slen / 3 * 3; - - while (i < n) { - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - c = src[i + 2] & 0xff; - - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; - dst[k + 3] = table[c & 0x3f]; - - i += 3; - k += 4; - } - - if (n != slen) { - switch (slen - n) { - case 1: - a = src[i + 0] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[(a & 3) << 4]; - dst[k + 2] = '='; - dst[k + 3] = '='; - break; - - case 2: - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[(b & 0x0f) << 2]; - dst[k + 3] = '='; - break; - } - } - - return dlen; -} - - -static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) { - // We know how much we'll write, just make sure that there's space. - assert(dlen >= slen * 2 && - "not enough space provided for hex encode"); - - dlen = slen * 2; - for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { - static const char hex[] = "0123456789abcdef"; - uint8_t val = static_cast(src[i]); - dst[k + 0] = hex[val >> 4]; - dst[k + 1] = hex[val & 15]; - } - - return dlen; -} - - - -static Local Encode(const char* buf, - size_t buflen, - enum Encoding encoding) { - assert(buflen <= node::Buffer::kMaxLength); - if (!buflen && encoding != BUFFER) - return New("").ToLocalChecked(); - - Local val; - switch (encoding) { - case BUFFER: - return CopyBuffer(buf, buflen).ToLocalChecked(); - - case ASCII: - if (contains_non_ascii(buf, buflen)) { - char* out = new char[buflen]; - force_ascii(buf, out, buflen); - val = New(out, buflen).ToLocalChecked(); - delete[] out; - } else { - val = New(buf, buflen).ToLocalChecked(); - } - break; - - case UTF8: - val = New(buf, buflen).ToLocalChecked(); - break; - - case BINARY: { - // TODO(isaacs) use ExternalTwoByteString? - const unsigned char *cbuf = reinterpret_cast(buf); - uint16_t * twobytebuf = new uint16_t[buflen]; - for (size_t i = 0; i < buflen; i++) { - // XXX is the following line platform independent? - twobytebuf[i] = cbuf[i]; - } - val = New(twobytebuf, buflen).ToLocalChecked(); - delete[] twobytebuf; - break; - } - - case BASE64: { - size_t dlen = base64_encoded_size(buflen); - char* dst = new char[dlen]; - - size_t written = base64_encode(buf, buflen, dst, dlen); - assert(written == dlen); - - val = New(dst, dlen).ToLocalChecked(); - delete[] dst; - break; - } - - case UCS2: { - const uint16_t* data = reinterpret_cast(buf); - val = New(data, buflen / 2).ToLocalChecked(); - break; - } - - case HEX: { - size_t dlen = buflen * 2; - char* dst = new char[dlen]; - size_t written = hex_encode(buf, buflen, dst, dlen); - assert(written == dlen); - - val = New(dst, dlen).ToLocalChecked(); - delete[] dst; - break; - } - - default: - assert(0 && "unknown encoding"); - break; - } - - return val; -} - -#undef base64_encoded_size - -} // end of namespace imp - -#endif // NAN_STRING_BYTES_H_ diff --git a/node_modules/nan/nan_typedarray_contents.h b/node_modules/nan/nan_typedarray_contents.h deleted file mode 100644 index c6ac8a4..0000000 --- a/node_modules/nan/nan_typedarray_contents.h +++ /dev/null @@ -1,96 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_TYPEDARRAY_CONTENTS_H_ -#define NAN_TYPEDARRAY_CONTENTS_H_ - -template -class TypedArrayContents { - public: - inline explicit TypedArrayContents(v8::Local from) : - length_(0), data_(NULL) { - HandleScope scope; - - size_t length = 0; - void* data = NULL; - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - - if (from->IsArrayBufferView()) { - v8::Local array = - v8::Local::Cast(from); - - const size_t byte_length = array->ByteLength(); - const ptrdiff_t byte_offset = array->ByteOffset(); - v8::Local buffer = array->Buffer(); - - length = byte_length / sizeof(T); -// Actually it's 7.9 here but this would lead to ABI issues with Node.js 13 -// using 7.8 till 13.2.0. -#if (V8_MAJOR_VERSION >= 8) - data = static_cast(buffer->GetBackingStore()->Data()) + byte_offset; -#else - data = static_cast(buffer->GetContents().Data()) + byte_offset; -#endif - } - -#else - - if (from->IsObject() && !from->IsNull()) { - v8::Local array = v8::Local::Cast(from); - - MaybeLocal buffer = Get(array, - New("buffer").ToLocalChecked()); - MaybeLocal byte_length = Get(array, - New("byteLength").ToLocalChecked()); - MaybeLocal byte_offset = Get(array, - New("byteOffset").ToLocalChecked()); - - if (!buffer.IsEmpty() && - !byte_length.IsEmpty() && byte_length.ToLocalChecked()->IsUint32() && - !byte_offset.IsEmpty() && byte_offset.ToLocalChecked()->IsUint32()) { - data = array->GetIndexedPropertiesExternalArrayData(); - if(data) { - length = byte_length.ToLocalChecked()->Uint32Value() / sizeof(T); - } - } - } - -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1900 || __cplusplus >= 201103L - assert(reinterpret_cast(data) % alignof (T) == 0); -#elif defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__GNUC__) - assert(reinterpret_cast(data) % __alignof(T) == 0); -#else - assert(reinterpret_cast(data) % sizeof (T) == 0); -#endif - - length_ = length; - data_ = static_cast(data); - } - - inline size_t length() const { return length_; } - inline T* operator*() { return data_; } - inline const T* operator*() const { return data_; } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(TypedArrayContents) - - //Disable heap allocation - void *operator new(size_t size); - void operator delete(void *, size_t) { - abort(); - } - - size_t length_; - T* data_; -}; - -#endif // NAN_TYPEDARRAY_CONTENTS_H_ diff --git a/node_modules/nan/nan_weak.h b/node_modules/nan/nan_weak.h deleted file mode 100644 index 7e7ab07..0000000 --- a/node_modules/nan/nan_weak.h +++ /dev/null @@ -1,437 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_WEAK_H_ -#define NAN_WEAK_H_ - -static const int kInternalFieldsInWeakCallback = 2; -static const int kNoInternalFieldIndex = -1; - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ - v8::WeakCallbackInfo > const& -# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION -# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ - v8::PhantomCallbackData > const& -# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ - v8::PhantomCallbackData > const& -# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ - v8::InternalFieldsCallbackData, void> const& -# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -# define NAN_WEAK_CALLBACK_DATA_TYPE_ \ - v8::WeakCallbackData > const& -# define NAN_WEAK_CALLBACK_SIG_ NAN_WEAK_CALLBACK_DATA_TYPE_ -#else -# define NAN_WEAK_CALLBACK_DATA_TYPE_ void * -# define NAN_WEAK_CALLBACK_SIG_ \ - v8::Persistent, NAN_WEAK_CALLBACK_DATA_TYPE_ -#endif - -template -class WeakCallbackInfo { - public: - typedef void (*Callback)(const WeakCallbackInfo& data); - WeakCallbackInfo( - Persistent *persistent - , Callback callback - , void *parameter - , void *field1 = 0 - , void *field2 = 0) : - callback_(callback), isolate_(0), parameter_(parameter) { - std::memcpy(&persistent_, persistent, sizeof (v8::Persistent)); - internal_fields_[0] = field1; - internal_fields_[1] = field2; - } - inline v8::Isolate *GetIsolate() const { return isolate_; } - inline T *GetParameter() const { return static_cast(parameter_); } - inline void *GetInternalField(int index) const { - assert((index == 0 || index == 1) && "internal field index out of bounds"); - if (index == 0) { - return internal_fields_[0]; - } else { - return internal_fields_[1]; - } - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(WeakCallbackInfo) - Callback callback_; - v8::Isolate *isolate_; - void *parameter_; - void *internal_fields_[kInternalFieldsInWeakCallback]; - v8::Persistent persistent_; - template friend class Persistent; - template friend class PersistentBase; -#if NODE_MODULE_VERSION <= NODE_0_12_MODULE_VERSION -# if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - template - static void invoke(NAN_WEAK_CALLBACK_SIG_ data); - template - static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); -# else - static void invoke(NAN_WEAK_CALLBACK_SIG_ data); - static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); -# endif -#else -# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - template - static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); - template - static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); -# else - static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); - static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); -# endif - static WeakCallbackInfo *unwrapparameter( - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data); - static WeakCallbackInfo *unwraptwofield( - NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data); -#endif -}; - - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - -template -template -void -WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrapparameter(data); - if (isFirstPass) { - cbinfo->persistent_.Reset(); - data.SetSecondPassCallback(invokeparameter); - } else { - cbinfo->callback_(*cbinfo); - delete cbinfo; - } -} - -template -template -void -WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwraptwofield(data); - if (isFirstPass) { - cbinfo->persistent_.Reset(); - data.SetSecondPassCallback(invoketwofield); - } else { - cbinfo->callback_(*cbinfo); - delete cbinfo; - } -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetParameter()); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( - NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetInternalField(0)); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ -#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -# elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - -template -void -WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrapparameter(data); - cbinfo->persistent_.Reset(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -void -WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwraptwofield(data); - cbinfo->persistent_.Reset(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetParameter()); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( - NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetInternalField1()); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ -#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - -template -template -void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrap(data); - cbinfo->persistent_.Reset(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -template -WeakCallbackInfo *WeakCallbackInfo::unwrap( - NAN_WEAK_CALLBACK_DATA_TYPE_ data) { - void *parameter = data.GetParameter(); - WeakCallbackInfo *cbinfo = - static_cast*>(parameter); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -#undef NAN_WEAK_CALLBACK_SIG_ -#undef NAN_WEAK_CALLBACK_DATA_TYPE_ -#else - -template -void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrap(data); - cbinfo->persistent_.Dispose(); - cbinfo->persistent_.Clear(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwrap( - NAN_WEAK_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data); - cbinfo->isolate_ = v8::Isolate::GetCurrent(); - return cbinfo; -} - -#undef NAN_WEAK_CALLBACK_SIG_ -#undef NAN_WEAK_CALLBACK_DATA_TYPE_ -#endif - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetWeak( - wcbd - , WeakCallbackInfo

::template invokeparameter - , type); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - self->SetAlignedPointerInInternalField(0, wcbd); - v8::PersistentBase::SetWeak( - static_cast*>(0) - , WeakCallbackInfo

::template invoketwofield - , type); - } -} -#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetPhantom( - wcbd - , WeakCallbackInfo

::invokeparameter); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - self->SetAlignedPointerInInternalField(0, wcbd); - v8::PersistentBase::SetPhantom( - static_cast*>(0) - , WeakCallbackInfo

::invoketwofield - , 0 - , count > 1 ? 1 : kNoInternalFieldIndex); - } -} -#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetPhantom( - wcbd - , WeakCallbackInfo

::invokeparameter); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - self->SetAlignedPointerInInternalField(0, wcbd); - v8::PersistentBase::SetPhantom( - WeakCallbackInfo

::invoketwofield - , 0 - , count > 1 ? 1 : kNoInternalFieldIndex); - } -} -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); - } -} -#else -template -template -inline void PersistentBase::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); - } -} -#endif - -#endif // NAN_WEAK_H_ diff --git a/node_modules/nan/package.json b/node_modules/nan/package.json deleted file mode 100644 index a994b0f..0000000 --- a/node_modules/nan/package.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "_from": "nan@^2.14.0", - "_id": "nan@2.14.1", - "_inBundle": false, - "_integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", - "_location": "/nan", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "nan@^2.14.0", - "name": "nan", - "escapedName": "nan", - "rawSpec": "^2.14.0", - "saveSpec": null, - "fetchSpec": "^2.14.0" - }, - "_requiredBy": [ - "/canvas" - ], - "_resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", - "_shasum": "d7be34dfa3105b91494c3147089315eff8874b01", - "_spec": "nan@^2.14.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/canvas", - "bugs": { - "url": "https://github.com/nodejs/nan/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Rod Vagg", - "email": "r@va.gg", - "url": "https://github.com/rvagg" - }, - { - "name": "Benjamin Byholm", - "email": "bbyholm@abo.fi", - "url": "https://github.com/kkoopa/" - }, - { - "name": "Trevor Norris", - "email": "trev.norris@gmail.com", - "url": "https://github.com/trevnorris" - }, - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "https://github.com/TooTallNate" - }, - { - "name": "Brett Lawson", - "email": "brett19@gmail.com", - "url": "https://github.com/brett19" - }, - { - "name": "Ben Noordhuis", - "email": "info@bnoordhuis.nl", - "url": "https://github.com/bnoordhuis" - }, - { - "name": "David Siegel", - "email": "david@artcom.de", - "url": "https://github.com/agnat" - }, - { - "name": "Michael Ira Krufky", - "email": "mkrufky@gmail.com", - "url": "https://github.com/mkrufky" - } - ], - "deprecated": false, - "description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 14 compatibility", - "devDependencies": { - "bindings": "~1.2.1", - "commander": "^2.8.1", - "glob": "^5.0.14", - "node-gyp": "~3.6.2", - "readable-stream": "^2.1.4", - "request": "=2.81.0", - "tap": "~0.7.1", - "xtend": "~4.0.0" - }, - "homepage": "https://github.com/nodejs/nan#readme", - "license": "MIT", - "main": "include_dirs.js", - "name": "nan", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/nan.git" - }, - "scripts": { - "docs": "doc/.build.sh", - "rebuild-tests": "node-gyp rebuild --msvs_version=2015 --directory test", - "test": "tap --gc --stderr test/js/*-test.js", - "test:worker": "node --experimental-worker test/tap-as-worker.js --gc --stderr test/js/*-test.js" - }, - "version": "2.14.1" -} diff --git a/node_modules/nan/tools/1to2.js b/node_modules/nan/tools/1to2.js deleted file mode 100755 index 6af2505..0000000 --- a/node_modules/nan/tools/1to2.js +++ /dev/null @@ -1,412 +0,0 @@ -#!/usr/bin/env node -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -var commander = require('commander'), - fs = require('fs'), - glob = require('glob'), - groups = [], - total = 0, - warning1 = '/* ERROR: Rewrite using Buffer */\n', - warning2 = '\\/\\* ERROR\\: Rewrite using Buffer \\*\\/\\n', - length, - i; - -fs.readFile(__dirname + '/package.json', 'utf8', function (err, data) { - if (err) { - throw err; - } - - commander - .version(JSON.parse(data).version) - .usage('[options] ') - .parse(process.argv); - - if (!process.argv.slice(2).length) { - commander.outputHelp(); - } -}); - -/* construct strings representing regular expressions - each expression contains a unique group allowing for identification of the match - the index of this key group, relative to the regular expression in question, - is indicated by the first array member */ - -/* simple substistutions, key group is the entire match, 0 */ -groups.push([0, [ - '_NAN_', - 'NODE_SET_METHOD', - 'NODE_SET_PROTOTYPE_METHOD', - 'NanAsciiString', - 'NanEscapeScope', - 'NanReturnValue', - 'NanUcs2String'].join('|')]); - -/* substitutions of parameterless macros, key group is 1 */ -groups.push([1, ['(', [ - 'NanEscapableScope', - 'NanReturnNull', - 'NanReturnUndefined', - 'NanScope'].join('|'), ')\\(\\)'].join('')]); - -/* replace TryCatch with NanTryCatch once, gobbling possible namespace, key group 2 */ -groups.push([2, '(?:(?:v8\\:\\:)?|(Nan)?)(TryCatch)']); - -/* NanNew("string") will likely not fail a ToLocalChecked(), key group 1 */ -groups.push([1, ['(NanNew)', '(\\("[^\\"]*"[^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); - -/* Removed v8 APIs, warn that the code needs rewriting using node::Buffer, key group 2 */ -groups.push([2, ['(', warning2, ')?', '^.*?(', [ - 'GetIndexedPropertiesExternalArrayDataLength', - 'GetIndexedPropertiesExternalArrayData', - 'GetIndexedPropertiesExternalArrayDataType', - 'GetIndexedPropertiesPixelData', - 'GetIndexedPropertiesPixelDataLength', - 'HasIndexedPropertiesInExternalArrayData', - 'HasIndexedPropertiesInPixelData', - 'SetIndexedPropertiesToExternalArrayData', - 'SetIndexedPropertiesToPixelData'].join('|'), ')'].join('')]); - -/* No need for NanScope in V8-exposed methods, key group 2 */ -groups.push([2, ['((', [ - 'NAN_METHOD', - 'NAN_GETTER', - 'NAN_SETTER', - 'NAN_PROPERTY_GETTER', - 'NAN_PROPERTY_SETTER', - 'NAN_PROPERTY_ENUMERATOR', - 'NAN_PROPERTY_DELETER', - 'NAN_PROPERTY_QUERY', - 'NAN_INDEX_GETTER', - 'NAN_INDEX_SETTER', - 'NAN_INDEX_ENUMERATOR', - 'NAN_INDEX_DELETER', - 'NAN_INDEX_QUERY'].join('|'), ')\\([^\\)]*\\)\\s*\\{)\\s*NanScope\\(\\)\\s*;'].join('')]); - -/* v8::Value::ToXXXXXXX returns v8::MaybeLocal, key group 3 */ -groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->(', [ - 'Boolean', - 'Number', - 'String', - 'Object', - 'Integer', - 'Uint32', - 'Int32'].join('|'), ')\\('].join('')]); - -/* v8::Value::XXXXXXXValue returns v8::Maybe, key group 3 */ -groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->((?:', [ - 'Boolean', - 'Number', - 'Integer', - 'Uint32', - 'Int32'].join('|'), ')Value)\\('].join('')]); - -/* NAN_WEAK_CALLBACK macro was removed, write out callback definition, key group 1 */ -groups.push([1, '(NAN_WEAK_CALLBACK)\\(([^\\s\\)]+)\\)']); - -/* node::ObjectWrap and v8::Persistent have been replaced with Nan implementations, key group 1 */ -groups.push([1, ['(', [ - 'NanDisposePersistent', - 'NanObjectWrapHandle'].join('|'), ')\\s*\\(\\s*([^\\s\\)]+)'].join('')]); - -/* Since NanPersistent there is no need for NanMakeWeakPersistent, key group 1 */ -groups.push([1, '(NanMakeWeakPersistent)\\s*\\(\\s*([^\\s,]+)\\s*,\\s*']); - -/* Many methods of v8::Object and others now return v8::MaybeLocal, key group 3 */ -groups.push([3, ['([\\s])([^\\s]+)->(', [ - 'GetEndColumn', - 'GetFunction', - 'GetLineNumber', - 'NewInstance', - 'GetPropertyNames', - 'GetOwnPropertyNames', - 'GetSourceLine', - 'GetStartColumn', - 'ObjectProtoToString', - 'ToArrayIndex', - 'ToDetailString', - 'CallAsConstructor', - 'CallAsFunction', - 'CloneElementAt', - 'Delete', - 'ForceSet', - 'Get', - 'GetPropertyAttributes', - 'GetRealNamedProperty', - 'GetRealNamedPropertyInPrototypeChain', - 'Has', - 'HasOwnProperty', - 'HasRealIndexedProperty', - 'HasRealNamedCallbackProperty', - 'HasRealNamedProperty', - 'Set', - 'SetAccessor', - 'SetIndexedPropertyHandler', - 'SetNamedPropertyHandler', - 'SetPrototype'].join('|'), ')\\('].join('')]); - -/* You should get an error if any of these fail anyways, - or handle the error better, it is indicated either way, key group 2 */ -groups.push([2, ['NanNew(<(?:v8\\:\\:)?(', ['Date', 'String', 'RegExp'].join('|'), ')>)(\\([^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); - -/* v8::Value::Equals now returns a v8::Maybe, key group 3 */ -groups.push([3, '([\\s\\(\\)])([^\\s\\(\\)]+)->(Equals)\\(([^\\s\\)]+)']); - -/* NanPersistent makes this unnecessary, key group 1 */ -groups.push([1, '(NanAssignPersistent)(?:]+>)?\\(([^,]+),\\s*']); - -/* args has been renamed to info, key group 2 */ -groups.push([2, '(\\W)(args)(\\W)']) - -/* node::ObjectWrap was replaced with NanObjectWrap, key group 2 */ -groups.push([2, '(\\W)(?:node\\:\\:)?(ObjectWrap)(\\W)']); - -/* v8::Persistent was replaced with NanPersistent, key group 2 */ -groups.push([2, '(\\W)(?:v8\\:\\:)?(Persistent)(\\W)']); - -/* counts the number of capturing groups in a well-formed regular expression, - ignoring non-capturing groups and escaped parentheses */ -function groupcount(s) { - var positive = s.match(/\((?!\?)/g), - negative = s.match(/\\\(/g); - return (positive ? positive.length : 0) - (negative ? negative.length : 0); -} - -/* compute the absolute position of each key group in the joined master RegExp */ -for (i = 1, length = groups.length; i < length; i++) { - total += groupcount(groups[i - 1][1]); - groups[i][0] += total; -} - -/* create the master RegExp, whis is the union of all the groups' expressions */ -master = new RegExp(groups.map(function (a) { return a[1]; }).join('|'), 'gm'); - -/* replacement function for String.replace, receives 21 arguments */ -function replace() { - /* simple expressions */ - switch (arguments[groups[0][0]]) { - case '_NAN_': - return 'NAN_'; - case 'NODE_SET_METHOD': - return 'NanSetMethod'; - case 'NODE_SET_PROTOTYPE_METHOD': - return 'NanSetPrototypeMethod'; - case 'NanAsciiString': - return 'NanUtf8String'; - case 'NanEscapeScope': - return 'scope.Escape'; - case 'NanReturnNull': - return 'info.GetReturnValue().SetNull'; - case 'NanReturnValue': - return 'info.GetReturnValue().Set'; - case 'NanUcs2String': - return 'v8::String::Value'; - default: - } - - /* macros without arguments */ - switch (arguments[groups[1][0]]) { - case 'NanEscapableScope': - return 'NanEscapableScope scope' - case 'NanReturnUndefined': - return 'return'; - case 'NanScope': - return 'NanScope scope'; - default: - } - - /* TryCatch, emulate negative backref */ - if (arguments[groups[2][0]] === 'TryCatch') { - return arguments[groups[2][0] - 1] ? arguments[0] : 'NanTryCatch'; - } - - /* NanNew("foo") --> NanNew("foo").ToLocalChecked() */ - if (arguments[groups[3][0]] === 'NanNew') { - return [arguments[0], '.ToLocalChecked()'].join(''); - } - - /* insert warning for removed functions as comment on new line above */ - switch (arguments[groups[4][0]]) { - case 'GetIndexedPropertiesExternalArrayData': - case 'GetIndexedPropertiesExternalArrayDataLength': - case 'GetIndexedPropertiesExternalArrayDataType': - case 'GetIndexedPropertiesPixelData': - case 'GetIndexedPropertiesPixelDataLength': - case 'HasIndexedPropertiesInExternalArrayData': - case 'HasIndexedPropertiesInPixelData': - case 'SetIndexedPropertiesToExternalArrayData': - case 'SetIndexedPropertiesToPixelData': - return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join(''); - default: - } - - /* remove unnecessary NanScope() */ - switch (arguments[groups[5][0]]) { - case 'NAN_GETTER': - case 'NAN_METHOD': - case 'NAN_SETTER': - case 'NAN_INDEX_DELETER': - case 'NAN_INDEX_ENUMERATOR': - case 'NAN_INDEX_GETTER': - case 'NAN_INDEX_QUERY': - case 'NAN_INDEX_SETTER': - case 'NAN_PROPERTY_DELETER': - case 'NAN_PROPERTY_ENUMERATOR': - case 'NAN_PROPERTY_GETTER': - case 'NAN_PROPERTY_QUERY': - case 'NAN_PROPERTY_SETTER': - return arguments[groups[5][0] - 1]; - default: - } - - /* Value conversion */ - switch (arguments[groups[6][0]]) { - case 'Boolean': - case 'Int32': - case 'Integer': - case 'Number': - case 'Object': - case 'String': - case 'Uint32': - return [arguments[groups[6][0] - 2], 'NanTo(', arguments[groups[6][0] - 1]].join(''); - default: - } - - /* other value conversion */ - switch (arguments[groups[7][0]]) { - case 'BooleanValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Int32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'IntegerValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Uint32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - default: - } - - /* NAN_WEAK_CALLBACK */ - if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') { - return ['template\nvoid ', - arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo &data)'].join(''); - } - - /* use methods on NAN classes instead */ - switch (arguments[groups[9][0]]) { - case 'NanDisposePersistent': - return [arguments[groups[9][0] + 1], '.Reset('].join(''); - case 'NanObjectWrapHandle': - return [arguments[groups[9][0] + 1], '->handle('].join(''); - default: - } - - /* use method on NanPersistent instead */ - if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') { - return arguments[groups[10][0] + 1] + '.SetWeak('; - } - - /* These return Maybes, the upper ones take no arguments */ - switch (arguments[groups[11][0]]) { - case 'GetEndColumn': - case 'GetFunction': - case 'GetLineNumber': - case 'GetOwnPropertyNames': - case 'GetPropertyNames': - case 'GetSourceLine': - case 'GetStartColumn': - case 'NewInstance': - case 'ObjectProtoToString': - case 'ToArrayIndex': - case 'ToDetailString': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join(''); - case 'CallAsConstructor': - case 'CallAsFunction': - case 'CloneElementAt': - case 'Delete': - case 'ForceSet': - case 'Get': - case 'GetPropertyAttributes': - case 'GetRealNamedProperty': - case 'GetRealNamedPropertyInPrototypeChain': - case 'Has': - case 'HasOwnProperty': - case 'HasRealIndexedProperty': - case 'HasRealNamedCallbackProperty': - case 'HasRealNamedProperty': - case 'Set': - case 'SetAccessor': - case 'SetIndexedPropertyHandler': - case 'SetNamedPropertyHandler': - case 'SetPrototype': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join(''); - default: - } - - /* Automatic ToLocalChecked(), take it or leave it */ - switch (arguments[groups[12][0]]) { - case 'Date': - case 'String': - case 'RegExp': - return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join(''); - default: - } - - /* NanEquals is now required for uniformity */ - if (arguments[groups[13][0]] === 'Equals') { - return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join(''); - } - - /* use method on replacement class instead */ - if (arguments[groups[14][0]] === 'NanAssignPersistent') { - return [arguments[groups[14][0] + 1], '.Reset('].join(''); - } - - /* args --> info */ - if (arguments[groups[15][0]] === 'args') { - return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join(''); - } - - /* ObjectWrap --> NanObjectWrap */ - if (arguments[groups[16][0]] === 'ObjectWrap') { - return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join(''); - } - - /* Persistent --> NanPersistent */ - if (arguments[groups[17][0]] === 'Persistent') { - return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join(''); - } - - /* This should not happen. A switch is probably missing a case if it does. */ - throw 'Unhandled match: ' + arguments[0]; -} - -/* reads a file, runs replacement and writes it back */ -function processFile(file) { - fs.readFile(file, {encoding: 'utf8'}, function (err, data) { - if (err) { - throw err; - } - - /* run replacement twice, might need more runs */ - fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) { - if (err) { - throw err; - } - }); - }); -} - -/* process file names from command line and process the identified files */ -for (i = 2, length = process.argv.length; i < length; i++) { - glob(process.argv[i], function (err, matches) { - if (err) { - throw err; - } - matches.forEach(processFile); - }); -} diff --git a/node_modules/nan/tools/README.md b/node_modules/nan/tools/README.md deleted file mode 100644 index 7f07e4b..0000000 --- a/node_modules/nan/tools/README.md +++ /dev/null @@ -1,14 +0,0 @@ -1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, -false positives and missed opportunities. The input files are rewritten in place. Make sure that -you have backups. You will have to manually review the changes afterwards and do some touchups. - -```sh -$ tools/1to2.js - - Usage: 1to2 [options] - - Options: - - -h, --help output usage information - -V, --version output the version number -``` diff --git a/node_modules/nan/tools/package.json b/node_modules/nan/tools/package.json deleted file mode 100644 index 2dcdd78..0000000 --- a/node_modules/nan/tools/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "1to2", - "version": "1.0.0", - "description": "NAN 1 -> 2 Migration Script", - "main": "1to2.js", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/nan.git" - }, - "contributors": [ - "Benjamin Byholm (https://github.com/kkoopa/)", - "Mathias Küsel (https://github.com/mathiask88/)" - ], - "dependencies": { - "glob": "~5.0.10", - "commander": "~2.8.1" - }, - "license": "MIT" -} diff --git a/node_modules/needle/.github/workflows/nodejs.yml b/node_modules/needle/.github/workflows/nodejs.yml deleted file mode 100644 index e6f3b75..0000000 --- a/node_modules/needle/.github/workflows/nodejs.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Node CI -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [0.10.0, 4.x, 6.x, 8.x, 10.x, 12.x] - - steps: - - uses: actions/checkout@v1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: npm install, build, and test - run: | - npm install - mkdir -p test/keys - openssl genrsa -out test/keys/ssl.key 2048 - openssl req -new -key test/keys/ssl.key -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -x509 -days 999 -out test/keys/ssl.cert - npm run build --if-present - npm test - env: - CI: true diff --git a/node_modules/needle/README.md b/node_modules/needle/README.md deleted file mode 100644 index 6700685..0000000 --- a/node_modules/needle/README.md +++ /dev/null @@ -1,596 +0,0 @@ -Needle -====== - -[![NPM](https://nodei.co/npm/needle.png)](https://nodei.co/npm/needle/) - -The leanest and most handsome HTTP client in the Nodelands. - -```js -var needle = require('needle'); - -needle.get('http://www.google.com', function(error, response) { - if (!error && response.statusCode == 200) - console.log(response.body); -}); -``` - -Callbacks not floating your boat? Needle got your back. - -``` js -var data = { - file: '/home/johnlennon/walrus.png', - content_type: 'image/png' -}; - -// the callback is optional, and needle returns a `readableStream` object -// that triggers a 'done' event when the request/response process is complete. -needle - .post('https://my.server.com/foo', data, { multipart: true }) - .on('readable', function() { /* eat your chunks */ }) - .on('done', function(err, resp) { - console.log('Ready-o!'); - }) -``` - -From version 2.0.x up, Promises are also supported. Just call `needle()` directly and you'll get a native Promise object. - -```js -needle('put', 'https://hacking.the.gibson/login', { password: 'god' }, { json: true }) - .then(function(response) { - return doSomethingWith(response) - }) - .catch(function(err) { - console.log('Call the locksmith!') - }) -``` - -With only two real dependencies, Needle supports: - - - HTTP/HTTPS requests, with the usual verbs you would expect - - All of Node's native TLS options, such as 'rejectUnauthorized' (see below) - - Basic & Digest authentication with auto-detection - - Multipart form-data (e.g. file uploads) - - HTTP Proxy forwarding, optionally with authentication - - Streaming gzip, deflate, and brotli decompression - - Automatic XML & JSON parsing - - 301/302/303 redirect following, with fine-grained tuning, and - - Streaming non-UTF-8 charset decoding, via `iconv-lite` - -And yes, Mr. Wayne, it does come in black. - -This makes Needle an ideal alternative for performing quick HTTP requests in Node, either for API interaction, downloading or uploading streams of data, and so on. If you need OAuth, AWS support or anything fancier, you should check out mikeal's request module. - -Install -------- - -``` -$ npm install needle -``` - -Usage ------ - -```js -// using promises -needle('get', 'https://server.com/posts/12') - .then(function(resp) { - // ... - }) - .catch(function(err) { - // ... - }); - -// with callback -needle.get('ifconfig.me/all.json', function(error, response, body) { - if (error) throw error; - - // body is an alias for `response.body`, - // that in this case holds a JSON-decoded object. - console.log(body.ip_addr); -}); - -// no callback, using streams -var out = fs.createWriteStream('logo.png'); -needle.get('https://google.com/images/logo.png').pipe(out).on('done', function() { - console.log('Pipe finished!'); -}); -``` - -As you can see, you can use Needle with Promises or without them. When using Promises or when a callback is passed, the response's body will be buffered and written to `response.body`, and the callback will be fired when all of the data has been collected and processed (e.g. decompressed, decoded and/or parsed). - -When no callback is passed, however, the buffering logic will be skipped but the response stream will still go through Needle's processing pipeline, so you get all the benefits of post-processing while keeping the streamishness we all love from Node. - -Response pipeline ------------------ - -Depending on the response's Content-Type, Needle will either attempt to parse JSON or XML streams, or, if a text response was received, will ensure that the final encoding you get is UTF-8. - -You can also request a gzip/deflated/brotli response, which, if sent by the server, will be processed before parsing or decoding is performed. (Note: brotli is only supported on Node 10.16.0 or above, and will not be requested or processed on earlier versions.) - -```js -needle.get('http://stackoverflow.com/feeds', { compressed: true }, function(err, resp) { - console.log(resp.body); // this little guy won't be a Gzipped binary blob - // but a nice object containing all the latest entries -}); -``` - -Or in anti-callback mode, using a few other options: - -```js -var options = { - compressed : true, // sets 'Accept-Encoding' to 'gzip, deflate, br' - follow_max : 5, // follow up to five redirects - rejectUnauthorized : true // verify SSL certificate -} - -var stream = needle.get('https://backend.server.com/everything.html', options); - -// read the chunks from the 'readable' event, so the stream gets consumed. -stream.on('readable', function() { - while (data = this.read()) { - console.log(data.toString()); - } -}) - -stream.on('done', function(err) { - // if our request had an error, our 'done' event will tell us. - if (!err) console.log('Great success!'); -}) -``` - -API ---- - -### needle(method, url[, data][, options][, callback]) `(> 2.0.x)` - -Calling `needle()` directly returns a Promise. Besides `method` and `url`, all parameters are optional, although when sending a `post`, `put` or `patch` request you will get an error if `data` is not present. - -```js -needle('get', 'http://some.url.com') - .then(function(resp) { console.log(resp.body) }) - .catch(function(err) { console.error(err) }) -}) -``` - -Except from the above, all of Needle's request methods return a Readable stream, and both `options` and `callback` are optional. If passed, the callback will return three arguments: `error`, `response` and `body`, which is basically an alias for `response.body`. - -### needle.head(url[, options][, callback]) - -```js -needle.head('https://my.backend.server.com', { - open_timeout: 5000 // if we're not able to open a connection in 5 seconds, boom. -}, function(err, resp) { - if (err) - console.log('Shoot! Something is wrong: ' + err.message) - else - console.log('Yup, still alive.') -}) -``` - -### needle.get(url[, options][, callback]) - -```js -needle.get('google.com/search?q=syd+barrett', function(err, resp) { - // if no http:// is found, Needle will automagically prepend it. -}); -``` - -### needle.post(url, data[, options][, callback]) - -```js -var options = { - headers: { 'X-Custom-Header': 'Bumbaway atuna' } -} - -needle.post('https://my.app.com/endpoint', 'foo=bar', options, function(err, resp) { - // you can pass params as a string or as an object. -}); -``` - -### needle.put(url, data[, options][, callback]) - -```js -var nested = { - params: { - are: { - also: 'supported' - } - } -} - -needle.put('https://api.app.com/v2', nested, function(err, resp) { - console.log('Got ' + resp.bytes + ' bytes.') // another nice treat from this handsome fella. -}); -``` - -### needle.patch(url, data[, options][, callback]) - -Same behaviour as PUT. - -### needle.delete(url, data[, options][, callback]) - -```js -var options = { - username: 'fidelio', - password: 'x' -} - -needle.delete('https://api.app.com/messages/123', null, options, function(err, resp) { - // in this case, data may be null, but you need to explicity pass it. -}); -``` - -### needle.request(method, url, data[, options][, callback]) - -Generic request. This not only allows for flexibility, but also lets you perform a GET request with data, in which case will be appended to the request as a query string, unless you pass a `json: true` option (read below). - -```js -var params = { - q : 'a very smart query', - page : 2 -} - -needle.request('get', 'forum.com/search', params, function(err, resp) { - if (!err && resp.statusCode == 200) - console.log(resp.body); // here you go, mister. -}); -``` - -Now, if you set pass `json: true` among the options, Needle won't set your params as a querystring but instead send a JSON representation of your data through the request's body, as well as set the `Content-Type` and `Accept` headers to `application/json`. - -```js -needle.request('get', 'forum.com/search', params, { json: true }, function(err, resp) { - if (resp.statusCode == 200) console.log('It worked!'); -}); -``` - -Events ------- - -The [Readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable) object returned by the above request methods emits the following events, in addition to the regular ones (e.g. `end`, `close`, `data`, `pipe`, `readable`). - -### Event: `'response'` - - - `response ` - -Emitted when the underlying [http.ClientRequest](https://nodejs.org/api/http.html#http_class_http_clientrequest) emits a response event. This is after the connection is established and the header received, but before any of it is processed (e.g. authorization required or redirect to be followed). No data has been consumed at this point. - -### Event: `'redirect'` - - - `location ` - -Indicates that the a redirect is being followed. This means that the response code was a redirect (`301`, `302`, `303`, `307`) and the given [redirect options](#redirect-options) allowed following the URL received in the `Location` header. - -### Event: `'header'` - - - `statusCode ` - - `headers ` - -Triggered after the header has been processed, and just before the data is to be consumed. This implies that no redirect was followed and/or authentication header was received. In other words, we got a "valid" response. - -### Event: `'done'` (previously 'end') - - - `exception ` (optional) - -Emitted when the request/response process has finished, either because all data was consumed or an error ocurred somewhere in between. Unlike a regular stream's `end` event, Needle's `done` will be fired either on success or on failure, which is why the first argument may be an Error object. In other words: - -```js -var resp = needle.get('something.worthy/of/being/streamed/by/needle'); -resp.pipe(someWritableStream); - -resp.on('done', function(err) { - if (err) console.log('An error ocurred: ' + err.message); - else console.log('Great success!'); -}) -``` - -### Event: `'err'` - - - `exception ` - -Emitted when an error ocurrs. This should only happen once in the lifecycle of a Needle request. - -### Event: `'timeout'` - - - `type ` - -Emitted when an timeout error occurs. Type can be either 'open', 'response', or 'read'. This will called right before aborting the request, which will also trigger an `err` event, a described above, with an `ECONNRESET` (Socket hang up) exception. - -Request options ---------------- - -For information about options that've changed, there's always [the changelog](https://github.com/tomas/needle/releases). - - - `agent` : Uses an [http.Agent](https://nodejs.org/api/http.html#http_class_http_agent) of your choice, instead of the global, default one. Useful for tweaking the behaviour at the connection level, such as when doing tunneling (see below for an example). - - `json` : When `true`, sets content type to `application/json` and sends request body as JSON string, instead of a query string. - - `open_timeout`: (or `timeout`) Returns error if connection takes longer than X milisecs to establish. Defaults to `10000` (10 secs). `0` means no timeout. - - `response_timeout`: Returns error if no response headers are received in X milisecs, counting from when the connection is opened. Defaults to `0` (no response timeout). - - `read_timeout`: Returns error if data transfer takes longer than X milisecs, once response headers are received. Defaults to `0` (no timeout). - - `follow_max` : (or `follow`) Number of redirects to follow. Defaults to `0`. See below for more redirect options. - - `multipart` : Enables multipart/form-data encoding. Defaults to `false`. Use it when uploading files. - - `proxy` : Forwards request through HTTP(s) proxy. Eg. `proxy: 'http://user:pass@proxy.server.com:3128'`. For more advanced proxying/tunneling use a custom `agent`, as described below. - - `headers` : Object containing custom HTTP headers for request. Overrides defaults described below. - - `auth` : Determines what to do with provided username/password. Options are `auto`, `digest` or `basic` (default). `auto` will detect the type of authentication depending on the response headers. - - `stream_length`: When sending streams, this lets you manually set the Content-Length header --if the stream's bytecount is known beforehand--, preventing ECONNRESET (socket hang up) errors on some servers that misbehave when receiving payloads of unknown size. Set it to `0` and Needle will get and set the stream's length for you, or leave unset for the default behaviour, which is no Content-Length header for stream payloads. - - `localAddress`: , IP address. Passed to http/https request. Local interface from witch the request should be emitted. - - `uri_modifier`: Anonymous function taking request (or redirect location if following redirects) URI as an argument and modifying it given logic. It has to return a valid URI string for successful request. - -Response options ----------------- - - - `decode_response` : (or `decode`) Whether to decode the text responses to UTF-8, if Content-Type header shows a different charset. Defaults to `true`. - - `parse_response` : (or `parse`) Whether to parse XML or JSON response bodies automagically. Defaults to `true`. You can also set this to 'xml' or 'json' in which case Needle will *only* parse the response if the content type matches. - - `output` : Dump response output to file. This occurs after parsing and charset decoding is done. - - `parse_cookies` : Whether to parse response’s `Set-Cookie` header. Defaults to `true`. If parsed, response cookies will be available at `resp.cookies`. - -HTTP Header options -------------------- - -These are basically shortcuts to the `headers` option described above. - - - `cookies` : Builds and sets a Cookie header from a `{ key: 'value' }` object. - - `compressed`: If `true`, sets 'Accept-Encoding' header to 'gzip,deflate', and inflates content if zipped. Defaults to `false`. - - `username` : For HTTP basic auth. - - `password` : For HTTP basic auth. Requires username to be passed, but is optional. - - `accept` : Sets 'Accept' HTTP header. Defaults to `*/*`. - - `connection`: Sets 'Connection' HTTP header. Not set by default, unless running Node < 0.11.4 in which case it defaults to `close`. More info about this below. - - `user_agent`: Sets the 'User-Agent' HTTP header. Defaults to `Needle/{version} (Node.js {node_version})`. - - `content_type`: Sets the 'Content-Type' header. Unset by default, unless you're sending data in which case it's set accordingly to whatever is being sent (`application/x-www-form-urlencoded`, `application/json` or `multipart/form-data`). That is, of course, unless the option is passed, either here or through `options.headers`. You're the boss. - -Node.js TLS Options -------------------- - -These options are passed directly to `https.request` if present. Taken from the [original documentation](http://nodejs.org/docs/latest/api/https.html): - - - `pfx` : Certificate, Private key and CA certificates to use for SSL. - - `key` : Private key to use for SSL. - - `passphrase` : A string of passphrase for the private key or pfx. - - `cert` : Public x509 certificate to use. - - `ca` : An authority certificate or array of authority certificates to check the remote host against. - - `ciphers` : A string describing the ciphers to use or exclude. - - `rejectUnauthorized` : If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. - - `secureProtocol` : The SSL method to use, e.g. SSLv3_method to force SSL version 3. - - `family` : IP address family to use when resolving host and hostname. Valid values are 4 or 6. When unspecified, both IP v4 and v6 will be used. - -Redirect options ----------------- - -These options only apply if the `follow_max` (or `follow`) option is higher than 0. - - - `follow_set_cookies` : Sends the cookies received in the `set-cookie` header as part of the following request. `false` by default. - - `follow_set_referer` : Sets the 'Referer' header to the requested URI when following a redirect. `false` by default. - - `follow_keep_method` : If enabled, resends the request using the original verb instead of being rewritten to `get` with no data. `false` by default. - - `follow_if_same_host` : When true, Needle will only follow redirects that point to the same host as the original request. `false` by default. - - `follow_if_same_protocol` : When true, Needle will only follow redirects that point to the same protocol as the original request. `false` by default. - - `follow_if_same_location` : Unless true, Needle will not follow redirects that point to same location (as set in the response header) as the original request URL. `false` by default. - -Overriding Defaults -------------------- - -Yes sir, we have it. Needle includes a `defaults()` method, that lets you override some of the defaults for all future requests. Like this: - -```js -needle.defaults({ - open_timeout: 60000, - user_agent: 'MyApp/1.2.3', - parse_response: false }); -``` - -This will override Needle's default user agent and 10-second timeout, and disable response parsing, so you don't need to pass those options in every other request. - -More advanced Proxy support ---------------------------- - -Since you can pass a custom HTTPAgent to Needle you can do all sorts of neat stuff. For example, if you want to use the [`tunnel`](https://github.com/koichik/node-tunnel) module for HTTPS proxying, you can do this: - -```js -var tunnel = require('tunnel'); -var myAgent = tunnel.httpOverHttp({ - proxy: { host: 'localhost' } -}); - -needle.get('foobar.com', { agent: myAgent }); -``` - -Regarding the 'Connection' header ---------------------------------- - -Unless you're running an old version of Node (< 0.11.4), by default Needle won't set the Connection header on requests, yielding Node's default behaviour of keeping the connection alive with the target server. This speeds up immensely the process of sending several requests to the same host. - -On older versions, however, this has the unwanted behaviour of preventing the runtime from exiting, either because of a bug or 'feature' that was changed on 0.11.4. To overcome this Needle does set the 'Connection' header to 'close' on those versions, however this also means that making new requests to the same host doesn't benefit from Keep-Alive. - -So if you're stuck on 0.10 or even lower and want full speed, you can simply set the Connection header to 'Keep-Alive' by using `{ connection: 'Keep-Alive' }`. Please note, though, that an event loop handler will prevent the runtime from exiting so you'll need to manually call `process.exit()` or the universe will collapse. - -Examples Galore ---------------- - -### HTTPS GET with Basic Auth - -```js -needle.get('https://api.server.com', { username: 'you', password: 'secret' }, - function(err, resp) { - // used HTTP auth -}); -``` - -Or use [RFC-1738](http://tools.ietf.org/html/rfc1738#section-3.1) basic auth URL syntax: - -```js -needle.get('https://username:password@api.server.com', function(err, resp) { - // used HTTP auth from URL -}); -``` - -### Digest Auth - -```js -needle.get('other.server.com', { username: 'you', password: 'secret', auth: 'digest' }, - function(err, resp, body) { - // needle prepends 'http://' to your URL, if missing -}); -``` - -### Custom Accept header, deflate - -```js -var options = { - compressed : true, - follow : 10, - accept : 'application/vnd.github.full+json' -} - -needle.get('api.github.com/users/tomas', options, function(err, resp, body) { - // body will contain a JSON.parse(d) object - // if parsing fails, you'll simply get the original body -}); -``` - -### GET XML object - -```js -needle.get('https://news.ycombinator.com/rss', function(err, resp, body) { - // you'll get a nice object containing the nodes in the RSS -}); -``` - -### GET binary, output to file - -```js -needle.get('http://upload.server.com/tux.png', { output: '/tmp/tux.png' }, function(err, resp, body) { - // you can dump any response to a file, not only binaries. -}); -``` - -### GET through proxy - -```js -needle.get('http://search.npmjs.org', { proxy: 'http://localhost:1234' }, function(err, resp, body) { - // request passed through proxy -}); -``` - -### GET a very large document in a stream (from 0.7+) - -```js -var stream = needle.get('http://www.as35662.net/100.log'); - -stream.on('readable', function() { - var chunk; - while (chunk = this.read()) { - console.log('got data: ', chunk); - } -}); -``` - -### GET JSON object in a stream (from 0.7+) - -```js -var stream = needle.get('http://jsonplaceholder.typicode.com/db', { parse: true }); - -stream.on('readable', function() { - var node; - - // our stream will only emit a single JSON root node. - while (node = this.read()) { - console.log('got data: ', node); - } -}); -``` - -### GET JSONStream flexible parser with search query (from 0.7+) - -```js - - // The 'data' element of this stream will be the string representation - // of the titles of all posts. - -needle.get('http://jsonplaceholder.typicode.com/db', { parse: true }) - .pipe(new JSONStream.parse('posts.*.title')); - .on('data', function (obj) { - console.log('got post title: %s', obj); - }); -``` - -### File upload using multipart, passing file path - -```js -var data = { - foo: 'bar', - image: { file: '/home/tomas/linux.png', content_type: 'image/png' } -} - -needle.post('http://my.other.app.com', data, { multipart: true }, function(err, resp, body) { - // needle will read the file and include it in the form-data as binary -}); -``` - -### Stream upload, PUT or POST - -``` js -needle.put('https://api.app.com/v2', fs.createReadStream('myfile.txt'), function(err, resp, body) { - // stream content is uploaded verbatim -}); -``` - -### Multipart POST, passing data buffer - -```js -var buffer = fs.readFileSync('/path/to/package.zip'); - -var data = { - zip_file: { - buffer : buffer, - filename : 'mypackage.zip', - content_type : 'application/octet-stream' - } -} - -needle.post('http://somewhere.com/over/the/rainbow', data, { multipart: true }, function(err, resp, body) { - // if you see, when using buffers we need to pass the filename for the multipart body. - // you can also pass a filename when using the file path method, in case you want to override - // the default filename to be received on the other end. -}); -``` - -### Multipart with custom Content-Type - -```js -var data = { - token: 'verysecret', - payload: { - value: JSON.stringify({ title: 'test', version: 1 }), - content_type: 'application/json' - } -} - -needle.post('http://test.com/', data, { timeout: 5000, multipart: true }, function(err, resp, body) { - // in this case, if the request takes more than 5 seconds - // the callback will return a [Socket closed] error -}); -``` - -For even more examples, check out the examples directory in the repo. - -### Testing - -To run tests, you need to generate a self-signed SSL certificate in the `test` directory. After cloning the repository, run the following commands: - - $ mkdir -p test/keys - $ openssl genrsa -out test/keys/ssl.key 2048 - $ openssl req -new -key test/keys/ssl.key -x509 -days 999 -out test/keys/ssl.cert - -Then you should be able to run `npm test` once you have the dependencies in place. - -> Note: Tests currently only work on linux-based environments that have `/proc/self/fd`. They *do not* work on MacOS environments. -> You can use Docker to run tests by creating a container and mounting the needle project directory on `/app` -> `docker create --name Needle -v /app -w /app -v /app/node_modules -i node:argon` - -Credits -------- - -Written by Tomás Pollak, with the help of contributors. - -Copyright ---------- - -(c) Fork Ltd. Licensed under the MIT license. diff --git a/node_modules/needle/bin/needle b/node_modules/needle/bin/needle deleted file mode 100755 index baaa79b..0000000 --- a/node_modules/needle/bin/needle +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env node -var needle = require('./../lib/needle'); - -function exit(code, str) { - console.log(str) || process.exit(code); -} - -function usage() { - var out = ['Usage: needle [get|head|post|put|delete] url [query]']; - out.push('Examples: \n needle get google.com\n needle post server.com/api foo=bar'); - exit(1, out.join('\n')) -} - -if (process.argv[2] == '-v' || process.argv[2] == '--version') - exit(0, needle.version); -else if (process.argv[2] == null) - usage(); - -var method = process.argv[2], - url = process.argv[3], - options = { compressed: true, parse_response: true, follow_max: 5, timeout: 10000 }; - -if (!needle[method]) { - url = method; - method = 'get'; -} - -var callback = function(err, resp) { - if (err) return exit(1, "Error: " + err.message); - - if (process.argv.indexOf('-i') != -1) - console.log(resp.headers) || console.log(''); - - console.log(resp.body.toString()); -}; - -if (method == 'post' || method == 'put') - needle[method](url, process.argv[4], options, callback); -else - needle[method](url, options, callback); diff --git a/node_modules/needle/examples/deflated-stream.js b/node_modules/needle/examples/deflated-stream.js deleted file mode 100644 index 4e771b7..0000000 --- a/node_modules/needle/examples/deflated-stream.js +++ /dev/null @@ -1,22 +0,0 @@ -var fs = require('fs'), - stream = require('stream'), - needle = require('./../'); - -var url = 'http://ibl.gamechaser.net/f/tagqfxtteucbuldhezkz/bt_level1.gz'; - -var resp = needle.get(url, { compressed: true, follow_max: 10 }); -console.log('Downloading...'); - -resp.on('readable', function() { - - while (data = this.read()) { - var lines = data.toString().split('\n'); - console.log('Got ' + lines.length + ' items.'); - // console.log(lines); - } - -}) - -resp.on('done', function(data) { - console.log('Done'); -}) diff --git a/node_modules/needle/examples/digest-auth.js b/node_modules/needle/examples/digest-auth.js deleted file mode 100644 index 5b8e5d5..0000000 --- a/node_modules/needle/examples/digest-auth.js +++ /dev/null @@ -1,16 +0,0 @@ -var needle = require('./..'); - -var opts = { - username: 'user3', - password: 'user3', - auth: 'digest' -} - -needle.get('http://test.webdav.org/auth-digest/', opts, function(err, resp, body) { - console.log(resp.headers); - - if (resp.statusCode == 401) - console.log('\nIt failed.') - else - console.log('\nIt worked!') -}); diff --git a/node_modules/needle/examples/download-to-file.js b/node_modules/needle/examples/download-to-file.js deleted file mode 100644 index 39d5af9..0000000 --- a/node_modules/needle/examples/download-to-file.js +++ /dev/null @@ -1,18 +0,0 @@ -var fs = require('fs'), - needle = require('./..'), - path = require('path'); - -var url = process.argv[2] || 'https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png'; -var file = path.basename(url); - -console.log('Downloading ' + file); - -needle.get(url, { output: file, follow: 3 }, function(err, resp, data){ - console.log('File saved: ' + process.cwd() + '/' + file); - - var size = fs.statSync(file).size; - if (size == resp.bytes) - console.log(resp.bytes + ' bytes written to file.'); - else - throw new Error('File size mismatch: ' + size + ' != ' + resp.bytes); -}); diff --git a/node_modules/needle/examples/multipart-stream.js b/node_modules/needle/examples/multipart-stream.js deleted file mode 100644 index df1ada6..0000000 --- a/node_modules/needle/examples/multipart-stream.js +++ /dev/null @@ -1,25 +0,0 @@ -var needle = require('./../'); - -var url = 'http://posttestserver.com/post.php?dir=needle'; - -var black_pixel = Buffer.from("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", 'base64'); - -var data = { - foo: 'bar', - nested: { - test: 123 - }, - image: { buffer: black_pixel, content_type: 'image/gif' } -} - -var resp = needle.post(url, data, { multipart: true }); - -resp.on('readable', function() { - while (data = this.read()) { - console.log(data.toString()); - } -}) - -resp.on('done', function(data) { - console.log('Done.'); -}) diff --git a/node_modules/needle/examples/parsed-stream.js b/node_modules/needle/examples/parsed-stream.js deleted file mode 100644 index 89c22c6..0000000 --- a/node_modules/needle/examples/parsed-stream.js +++ /dev/null @@ -1,23 +0,0 @@ -////////////////////////////////////////// -// This example demonstrates what happends -// when you use the built-in JSON parser. -////////////////////////////////////////// - -var fs = require('fs'), - stream = require('stream'), - needle = require('./../'); - -var url = 'http://ip.jsontest.com/', - resp = needle.get(url, { parse: true }); - -resp.on('readable', function(obj) { - var chunk; - - while (chunk = this.read()) { - console.log('root = ', chunk); - } -}); - -resp.on('done', function() { - console.log('Done.'); -}); diff --git a/node_modules/needle/examples/parsed-stream2.js b/node_modules/needle/examples/parsed-stream2.js deleted file mode 100644 index f325ec1..0000000 --- a/node_modules/needle/examples/parsed-stream2.js +++ /dev/null @@ -1,21 +0,0 @@ -////////////////////////////////////////// -// This example illustrates a more complex -// example of parsing a JSON stream. -////////////////////////////////////////// - -var needle = require('./../'), - JSONStream = require('JSONStream'); - -var url = 'http://jsonplaceholder.typicode.com/db'; - -// Initialize our GET request with our default (JSON) -// parsers disabled. - -var json = new needle.get(url, {parse: false}) - // And now interpret the stream as JSON, returning only the - // title of all the posts. - .pipe(new JSONStream.parse('posts.*.title')); - -json.on('data', function (obj) { - console.log('got title: \'' + obj + '\''); -}) diff --git a/node_modules/needle/examples/stream-events.js b/node_modules/needle/examples/stream-events.js deleted file mode 100644 index 6230993..0000000 --- a/node_modules/needle/examples/stream-events.js +++ /dev/null @@ -1,23 +0,0 @@ -var needle = require('./..'); - -var resp = needle.get('google.com', { follow_max: 10, timeout: 5000 }); - -resp.on('readable', function() { - var chunk; - while (chunk = this.read()) { - console.log('Got ' + chunk.length + ' bytes'); - } -}) - -resp.on('headers', function(headers) { - console.log('Got headers', headers); -}) - -resp.on('redirect', function(url) { - console.log('Redirected to url ' + url); -}) - -resp.on('done', function(err) { - console.log('Finished. No more data to receive.'); - if (err) console.log('With error', err) -}) diff --git a/node_modules/needle/examples/stream-to-file.js b/node_modules/needle/examples/stream-to-file.js deleted file mode 100644 index d261bee..0000000 --- a/node_modules/needle/examples/stream-to-file.js +++ /dev/null @@ -1,14 +0,0 @@ -var fs = require('fs'), - needle = require('./..'), - path = require('path'); - -var url = process.argv[2] || 'http://www.google.com/images/errors/robot.png'; -var file = path.basename(url); - -console.log('Downloading ' + file + '...'); -needle - .get(url) - .pipe(fs.createWriteStream(file)) - .on('done', function() { - console.log('Done!') - }) diff --git a/node_modules/needle/examples/upload-image.js b/node_modules/needle/examples/upload-image.js deleted file mode 100644 index 090e3e3..0000000 --- a/node_modules/needle/examples/upload-image.js +++ /dev/null @@ -1,51 +0,0 @@ -var needle = require('../'), - path = require('path'); - -var image = 'https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png'; - -function upload(obj, cb) { - console.log('Uploading image...'); - - var url = 'http://deviantsart.com'; - - var opts = { - timeout: 10000, - follow: 3, - multipart: true - }; - - var params = { - file: obj - } - - needle.post(url, params, opts, function(err, resp) { - if (err || !resp.body.match('url')) - return cb(err || new Error('No image URL found.')) - - cb(null, JSON.parse(resp.body).url) - }) -} - -function download(url, cb) { - console.log('Getting ' + url); - needle.get(url, function(err, resp) { - if (err) throw err; - - cb(null, resp.body); - }) -} - -//////////////////////////////////////// -// ok, now go. - -download(image, function(err, buffer) { - if (err) throw err; - - var obj = { buffer: buffer, content_type: 'image/png' }; - - upload(obj, function(err, url) { - if (err) throw err; - - console.log('Image uploaded to ' + url); - }) -}) diff --git a/node_modules/needle/lib/auth.js b/node_modules/needle/lib/auth.js deleted file mode 100644 index ff15610..0000000 --- a/node_modules/needle/lib/auth.js +++ /dev/null @@ -1,112 +0,0 @@ -var createHash = require('crypto').createHash; - -function get_header(header, credentials, opts) { - var type = header.split(' ')[0], - user = credentials[0], - pass = credentials[1]; - - if (type == 'Digest') { - return digest.generate(header, user, pass, opts.method, opts.path); - } else if (type == 'Basic') { - return basic(user, pass); - } -} - -//////////////////// -// basic - -function md5(string) { - return createHash('md5').update(string).digest('hex'); -} - -function basic(user, pass) { - var str = typeof pass == 'undefined' ? user : [user, pass].join(':'); - return 'Basic ' + Buffer.from(str).toString('base64'); -} - -//////////////////// -// digest -// logic inspired from https://github.com/simme/node-http-digest-client - -var digest = {}; - -digest.parse_header = function(header) { - var challenge = {}, - matches = header.match(/([a-z0-9_-]+)="?([a-z0-9=\/\.@\s-]+)"?/gi); - - for (var i = 0, l = matches.length; i < l; i++) { - var parts = matches[i].split('='), - key = parts.shift(), - val = parts.join('=').replace(/^"/, '').replace(/"$/, ''); - - challenge[key] = val; - } - - return challenge; -} - -digest.update_nc = function(nc) { - var max = 99999999; - nc++; - - if (nc > max) - nc = 1; - - var padding = new Array(8).join('0') + ''; - nc = nc + ''; - return padding.substr(0, 8 - nc.length) + nc; -} - -digest.generate = function(header, user, pass, method, path) { - - var nc = 1, - cnonce = null, - challenge = digest.parse_header(header); - - var ha1 = md5(user + ':' + challenge.realm + ':' + pass), - ha2 = md5(method.toUpperCase() + ':' + path), - resp = [ha1, challenge.nonce]; - - if (typeof challenge.qop === 'string') { - cnonce = md5(Math.random().toString(36)).substr(0, 8); - nc = digest.update_nc(nc); - resp = resp.concat(nc, cnonce); - resp = resp.concat(challenge.qop, ha2); - } else { - resp = resp.concat(ha2); - } - - - var params = { - uri : path, - realm : challenge.realm, - nonce : challenge.nonce, - username : user, - response : md5(resp.join(':')) - } - - if (challenge.qop) { - params.qop = challenge.qop; - } - - if (challenge.opaque) { - params.opaque = challenge.opaque; - } - - if (cnonce) { - params.nc = nc; - params.cnonce = cnonce; - } - - header = [] - for (var k in params) - header.push(k + '="' + params[k] + '"') - - return 'Digest ' + header.join(', '); -} - -module.exports = { - header : get_header, - basic : basic, - digest : digest.generate -} diff --git a/node_modules/needle/lib/cookies.js b/node_modules/needle/lib/cookies.js deleted file mode 100644 index 0f48afc..0000000 --- a/node_modules/needle/lib/cookies.js +++ /dev/null @@ -1,79 +0,0 @@ - -// Simple cookie handling implementation based on the standard RFC 6265. -// -// This module just has two functionalities: -// - Parse a set-cookie-header as a key value object -// - Write a cookie-string from a key value object -// -// All cookie attributes are ignored. - -var unescape = require('querystring').unescape; - -var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/; -var EXCLUDED_CHARS = /[\x00-\x1F\x7F\x3B\x3B\s\"\,\\"%]/g; -var TRAILING_SEMICOLON = /\x3B+$/; -var SEP_SEMICOLON = /\s*\x3B\s*/; - -// i know these should be 'const', but I'd like to keep -// supporting earlier node.js versions as long as I can. :) - -var KEY_INDEX = 1; // index of key from COOKIE_PAIR match -var VALUE_INDEX = 3; // index of value from COOKIE_PAIR match - -// Returns a copy str trimmed and without trainling semicolon. -function cleanCookieString(str) { - return str.trim().replace(/\x3B+$/, ''); -} - -function getFirstPair(str) { - var index = str.indexOf('\x3B'); - return index === -1 ? str : str.substr(0, index); -} - -// Returns a encoded copy of str based on RFC6265 S4.1.1. -function encodeCookieComponent(str) { - return str.toString().replace(EXCLUDED_CHARS, encodeURIComponent); -} - -// Parses a set-cookie-string based on the standard defined in RFC6265 S4.1.1. -function parseSetCookieString(str) { - str = cleanCookieString(str); - str = getFirstPair(str); - - var res = COOKIE_PAIR.exec(str); - if (!res || !res[VALUE_INDEX]) return null; - - return { - name : unescape(res[KEY_INDEX]), - value : unescape(res[VALUE_INDEX]) - }; -} - -// Parses a set-cookie-header and returns a key/value object. -// Each key represents the name of a cookie. -function parseSetCookieHeader(header) { - if (!header) return {}; - header = Array.isArray(header) ? header : [header]; - - return header.reduce(function(res, str) { - var cookie = parseSetCookieString(str); - if (cookie) res[cookie.name] = cookie.value; - return res; - }, {}); -} - -// Writes a set-cookie-string based on the standard definded in RFC6265 S4.1.1. -function writeCookieString(obj) { - return Object.keys(obj).reduce(function(str, name) { - var encodedName = encodeCookieComponent(name); - var encodedValue = encodeCookieComponent(obj[name]); - str += (str ? '; ' : '') + encodedName + '=' + encodedValue; - return str; - }, ''); -} - -// returns a key/val object from an array of cookie strings -exports.read = parseSetCookieHeader; - -// writes a cookie string header -exports.write = writeCookieString; diff --git a/node_modules/needle/lib/decoder.js b/node_modules/needle/lib/decoder.js deleted file mode 100644 index 4ff6198..0000000 --- a/node_modules/needle/lib/decoder.js +++ /dev/null @@ -1,53 +0,0 @@ -var iconv, - inherits = require('util').inherits, - stream = require('stream'); - -var regex = /(?:charset|encoding)\s*=\s*['"]? *([\w\-]+)/i; - -inherits(StreamDecoder, stream.Transform); - -function StreamDecoder(charset) { - if (!(this instanceof StreamDecoder)) - return new StreamDecoder(charset); - - stream.Transform.call(this, charset); - this.charset = charset; - this.parsed_chunk = false; -} - -StreamDecoder.prototype._transform = function(chunk, encoding, done) { - var res, found; - - // try get charset from chunk, just once - if (this.charset == 'utf8' && !this.parsed_chunk) { - this.parsed_chunk = true; - - var matches = regex.exec(chunk.toString()); - if (matches) { - found = matches[1].toLowerCase(); - this.charset = found == 'utf-8' ? 'utf8' : found; - } - } - - try { - res = iconv.decode(chunk, this.charset); - } catch(e) { // something went wrong, just return original chunk - res = chunk; - } - - this.push(res); - done(); -} - -module.exports = function(charset) { - try { - if (!iconv) iconv = require('iconv-lite'); - } catch(e) { - /* iconv not found */ - } - - if (iconv) - return new StreamDecoder(charset); - else - return new stream.PassThrough; -} diff --git a/node_modules/needle/lib/multipart.js b/node_modules/needle/lib/multipart.js deleted file mode 100644 index d1e6e18..0000000 --- a/node_modules/needle/lib/multipart.js +++ /dev/null @@ -1,98 +0,0 @@ -var readFile = require('fs').readFile, - basename = require('path').basename; - -exports.build = function(data, boundary, callback) { - - if (typeof data != 'object' || typeof data.pipe == 'function') - return callback(new Error('Multipart builder expects data as key/val object.')); - - var body = '', - object = flatten(data), - count = Object.keys(object).length; - - if (count === 0) - return callback(new Error('Empty multipart body. Invalid data.')) - - function done(err, section) { - if (err) return callback(err); - if (section) body += section; - --count || callback(null, body + '--' + boundary + '--'); - }; - - for (var key in object) { - var value = object[key]; - if (value === null || typeof value == 'undefined') { - done(); - } else if (Buffer.isBuffer(value)) { - var part = { buffer: value, content_type: 'application/octet-stream' }; - generate_part(key, part, boundary, done); - } else { - var part = (value.buffer || value.file || value.content_type) ? value : { value: value }; - generate_part(key, part, boundary, done); - } - } - -} - -function generate_part(name, part, boundary, callback) { - - var return_part = '--' + boundary + '\r\n'; - return_part += 'Content-Disposition: form-data; name="' + name + '"'; - - function append(data, filename) { - - if (data) { - var binary = part.content_type.indexOf('text') == -1; - return_part += '; filename="' + encodeURIComponent(filename) + '"\r\n'; - if (binary) return_part += 'Content-Transfer-Encoding: binary\r\n'; - return_part += 'Content-Type: ' + part.content_type + '\r\n\r\n'; - return_part += binary ? data.toString('binary') : data.toString('utf8'); - } - - callback(null, return_part + '\r\n'); - }; - - if ((part.file || part.buffer) && part.content_type) { - - var filename = part.filename ? part.filename : part.file ? basename(part.file) : name; - if (part.buffer) return append(part.buffer, filename); - - readFile(part.file, function(err, data) { - if (err) return callback(err); - append(data, filename); - }); - - } else { - - if (typeof part.value == 'object') - return callback(new Error('Object received for ' + name + ', expected string.')) - - if (part.content_type) { - return_part += '\r\n'; - return_part += 'Content-Type: ' + part.content_type; - } - - return_part += '\r\n\r\n'; - return_part += Buffer.from(String(part.value), 'utf8').toString('binary'); - append(); - - } - -} - -// flattens nested objects for multipart body -function flatten(object, into, prefix) { - into = into || {}; - - for(var key in object) { - var prefix_key = prefix ? prefix + '[' + key + ']' : key; - var prop = object[key]; - - if (prop && typeof prop === 'object' && !(prop.buffer || prop.file || prop.content_type)) - flatten(prop, into, prefix_key) - else - into[prefix_key] = prop; - } - - return into; -} diff --git a/node_modules/needle/lib/needle.js b/node_modules/needle/lib/needle.js deleted file mode 100644 index 987533a..0000000 --- a/node_modules/needle/lib/needle.js +++ /dev/null @@ -1,821 +0,0 @@ -////////////////////////////////////////// -// Needle -- HTTP Client for Node.js -// Written by Tomás Pollak -// (c) 2012-2020 - Fork Ltd. -// MIT Licensed -////////////////////////////////////////// - -var fs = require('fs'), - http = require('http'), - https = require('https'), - url = require('url'), - stream = require('stream'), - debug = require('debug')('needle'), - stringify = require('./querystring').build, - multipart = require('./multipart'), - auth = require('./auth'), - cookies = require('./cookies'), - parsers = require('./parsers'), - decoder = require('./decoder'); - -////////////////////////////////////////// -// variabilia - -var version = require('../package.json').version; - -var user_agent = 'Needle/' + version; -user_agent += ' (Node.js ' + process.version + '; ' + process.platform + ' ' + process.arch + ')'; - -var tls_options = 'agent pfx key passphrase cert ca ciphers rejectUnauthorized secureProtocol checkServerIdentity family'; - -// older versions of node (< 0.11.4) prevent the runtime from exiting -// because of connections in keep-alive state. so if this is the case -// we'll default new requests to set a Connection: close header. -var close_by_default = !http.Agent || http.Agent.defaultMaxSockets != Infinity; - -// see if we have Object.assign. otherwise fall back to util._extend -var extend = Object.assign ? Object.assign : require('util')._extend; - -// these are the status codes that Needle interprets as redirects. -var redirect_codes = [301, 302, 303, 307, 308]; - -////////////////////////////////////////// -// decompressors for gzip/deflate/br bodies - -var decompressors = {}; -var brotli_supported = false; - -try { - - var zlib = require('zlib'); - brotli_supported = typeof zlib.BrotliDecompress === 'function'; - decompressors['x-deflate'] = zlib.Inflate; - decompressors['deflate'] = zlib.Inflate; - decompressors['x-gzip'] = zlib.Gunzip; - decompressors['gzip'] = zlib.Gunzip; - if (brotli_supported) { - decompressors['br'] = zlib.BrotliDecompress; - } - - // Enable Z_SYNC_FLUSH to avoid Z_BUF_ERROR errors (Node PR #2595) - var zlib_options = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - } - -} catch(e) { /* zlib not available */ } - -////////////////////////////////////////// -// options and aliases - -var defaults = { - // data - boundary : '--------------------NODENEEDLEHTTPCLIENT', - encoding : 'utf8', - parse_response : 'all', // same as true. valid options: 'json', 'xml' or false/null - proxy : null, - - // headers - headers : {}, - accept : '*/*', - user_agent : user_agent, - - // numbers - open_timeout : 10000, - response_timeout : 0, - read_timeout : 0, - follow_max : 0, - stream_length : -1, - - // booleans - compressed : false, - decode_response : true, - parse_cookies : true, - follow_set_cookies : false, - follow_set_referer : false, - follow_keep_method : false, - follow_if_same_host : false, - follow_if_same_protocol : false, - follow_if_same_location : false -} - -var aliased = { - options: { - decode : 'decode_response', - parse : 'parse_response', - timeout : 'open_timeout', - follow : 'follow_max' - }, - inverted: {} -} - -// only once, invert aliased keys so we can get passed options. -Object.keys(aliased.options).map(function(k) { - var value = aliased.options[k]; - aliased.inverted[value] = k; -}); - -////////////////////////////////////////// -// helpers - -function keys_by_type(type) { - return Object.keys(defaults).map(function(el) { - if (defaults[el] !== null && defaults[el].constructor == type) - return el; - }).filter(function(el) { return el }) -} - -function parse_content_type(header) { - if (!header || header === '') return {}; - - var found, charset = 'utf8', arr = header.split(';'); - - if (arr.length > 1 && (found = arr[1].match(/charset=(.+)/))) - charset = found[1]; - - return { type: arr[0], charset: charset }; -} - -function is_stream(obj) { - return typeof obj.pipe === 'function'; -} - -function get_stream_length(stream, given_length, cb) { - if (given_length > 0) - return cb(given_length); - - if (stream.end !== void 0 && stream.end !== Infinity && stream.start !== void 0) - return cb((stream.end + 1) - (stream.start || 0)); - - fs.stat(stream.path, function(err, stat) { - cb(stat ? stat.size - (stream.start || 0) : null); - }); -} - -////////////////////////////////////////// -// the main act - -function Needle(method, uri, data, options, callback) { - // if (!(this instanceof Needle)) { - // return new Needle(method, uri, data, options, callback); - // } - - if (typeof uri !== 'string') - throw new TypeError('URL must be a string, not ' + uri); - - this.method = method; - this.uri = uri; - this.data = data; - - if (typeof options == 'function') { - this.callback = options; - this.options = {}; - } else { - this.callback = callback; - this.options = options; - } - -} - -Needle.prototype.setup = function(uri, options) { - - function get_option(key, fallback) { - // if original is in options, return that value - if (typeof options[key] != 'undefined') return options[key]; - - // otherwise, return value from alias or fallback/undefined - return typeof options[aliased.inverted[key]] != 'undefined' - ? options[aliased.inverted[key]] : fallback; - } - - function check_value(expected, key) { - var value = get_option(key), - type = typeof value; - - if (type != 'undefined' && type != expected) - throw new TypeError(type + ' received for ' + key + ', but expected a ' + expected); - - return (type == expected) ? value : defaults[key]; - } - - ////////////////////////////////////////////////// - // the basics - - var config = { - http_opts : { - localAddress: get_option('localAddress', undefined) - }, // passed later to http.request() directly - headers : {}, - output : options.output, - proxy : get_option('proxy', defaults.proxy), - parser : get_option('parse_response', defaults.parse_response), - encoding : options.encoding || (options.multipart ? 'binary' : defaults.encoding) - } - - keys_by_type(Boolean).forEach(function(key) { - config[key] = check_value('boolean', key); - }) - - keys_by_type(Number).forEach(function(key) { - config[key] = check_value('number', key); - }) - - // populate http_opts with given TLS options - tls_options.split(' ').forEach(function(key) { - if (typeof options[key] != 'undefined') { - config.http_opts[key] = options[key]; - if (typeof options.agent == 'undefined') - config.http_opts.agent = false; // otherwise tls options are skipped - } - }); - - ////////////////////////////////////////////////// - // headers, cookies - - for (var key in defaults.headers) - config.headers[key] = defaults.headers[key]; - - config.headers['accept'] = options.accept || defaults.accept; - config.headers['user-agent'] = options.user_agent || defaults.user_agent; - - if (options.content_type) - config.headers['content-type'] = options.content_type; - - // set connection header if opts.connection was passed, or if node < 0.11.4 (close) - if (options.connection || close_by_default) - config.headers['connection'] = options.connection || 'close'; - - if ((options.compressed || defaults.compressed) && typeof zlib != 'undefined') - config.headers['accept-encoding'] = brotli_supported ? 'gzip, deflate, br' : 'gzip, deflate'; - - if (options.cookies) - config.headers['cookie'] = cookies.write(options.cookies); - - ////////////////////////////////////////////////// - // basic/digest auth - - if (uri.match(/[^\/]@/)) { // url contains user:pass@host, so parse it. - var parts = (url.parse(uri).auth || '').split(':'); - options.username = parts[0]; - options.password = parts[1]; - } - - if (options.username) { - if (options.auth && (options.auth == 'auto' || options.auth == 'digest')) { - config.credentials = [options.username, options.password]; - } else { - config.headers['authorization'] = auth.basic(options.username, options.password); - } - } - - // if proxy is present, set auth header from either url or proxy_user option. - if (config.proxy) { - if (config.proxy.indexOf('http') === -1) - config.proxy = 'http://' + config.proxy; - - if (config.proxy.indexOf('@') !== -1) { - var proxy = (url.parse(config.proxy).auth || '').split(':'); - options.proxy_user = proxy[0]; - options.proxy_pass = proxy[1]; - } - - if (options.proxy_user) - config.headers['proxy-authorization'] = auth.basic(options.proxy_user, options.proxy_pass); - } - - // now that all our headers are set, overwrite them if instructed. - for (var h in options.headers) - config.headers[h.toLowerCase()] = options.headers[h]; - - config.uri_modifier = get_option('uri_modifier', null); - - return config; -} - -Needle.prototype.start = function() { - - var out = new stream.PassThrough({ objectMode: false }), - uri = this.uri, - data = this.data, - method = this.method, - callback = (typeof this.options == 'function') ? this.options : this.callback, - options = this.options || {}; - - // if no 'http' is found on URL, prepend it. - if (uri.indexOf('http') === -1) - uri = uri.replace(/^(\/\/)?/, 'http://'); - - var self = this, body, waiting = false, config = this.setup(uri, options); - - // unless options.json was set to false, assume boss also wants JSON if content-type matches. - var json = options.json || (options.json !== false && config.headers['content-type'] == 'application/json'); - - if (data) { - - if (options.multipart) { // boss says we do multipart. so we do it. - var boundary = options.boundary || defaults.boundary; - - waiting = true; - multipart.build(data, boundary, function(err, parts) { - if (err) throw(err); - - config.headers['content-type'] = 'multipart/form-data; boundary=' + boundary; - next(parts); - }); - - } else if (is_stream(data)) { - - if (method.toUpperCase() == 'GET') - throw new Error('Refusing to pipe() a stream via GET. Did you mean .post?'); - - if (config.stream_length > 0 || (config.stream_length === 0 && data.path)) { - // ok, let's get the stream's length and set it as the content-length header. - // this prevents some servers from cutting us off before all the data is sent. - waiting = true; - get_stream_length(data, config.stream_length, function(length) { - data.length = length; - next(data); - }) - - } else { - // if the boss doesn't want us to get the stream's length, or if it doesn't - // have a file descriptor for that purpose, then just head on. - body = data; - } - - } else if (Buffer.isBuffer(data)) { - - body = data; // use the raw buffer as request body. - - } else if (method.toUpperCase() == 'GET' && !json) { - - // append the data to the URI as a querystring. - uri = uri.replace(/\?.*|$/, '?' + stringify(data)); - - } else { // string or object data, no multipart. - - // if string, leave it as it is, otherwise, stringify. - body = (typeof(data) === 'string') ? data - : json ? JSON.stringify(data) : stringify(data); - - // ensure we have a buffer so bytecount is correct. - body = Buffer.from(body, config.encoding); - } - - } - - function next(body) { - if (body) { - if (body.length) config.headers['content-length'] = body.length; - - // if no content-type was passed, determine if json or not. - if (!config.headers['content-type']) { - config.headers['content-type'] = json - ? 'application/json; charset=utf-8' - : 'application/x-www-form-urlencoded'; // no charset says W3 spec. - } - } - - // unless a specific accept header was set, assume json: true wants JSON back. - if (options.json && (!options.accept && !(options.headers || {}).accept)) - config.headers['accept'] = 'application/json'; - - self.send_request(1, method, uri, config, body, out, callback); - } - - if (!waiting) next(body); - return out; -} - -Needle.prototype.get_request_opts = function(method, uri, config) { - var opts = config.http_opts, - proxy = config.proxy, - remote = proxy ? url.parse(proxy) : url.parse(uri); - - opts.protocol = remote.protocol; - opts.host = remote.hostname; - opts.port = remote.port || (remote.protocol == 'https:' ? 443 : 80); - opts.path = proxy ? uri : remote.pathname + (remote.search || ''); - opts.method = method; - opts.headers = config.headers; - - if (!opts.headers['host']) { - // if using proxy, make sure the host header shows the final destination - var target = proxy ? url.parse(uri) : remote; - opts.headers['host'] = target.hostname; - - // and if a non standard port was passed, append it to the port header - if (target.port && [80, 443].indexOf(target.port) === -1) { - opts.headers['host'] += ':' + target.port; - } - } - - return opts; -} - -Needle.prototype.should_follow = function(location, config, original) { - if (!location) return false; - - // returns true if location contains matching property (host or protocol) - function matches(property) { - var property = original[property]; - return location.indexOf(property) !== -1; - } - - // first, check whether the requested location is actually different from the original - if (!config.follow_if_same_location && location === original) - return false; - - if (config.follow_if_same_host && !matches('host')) - return false; // host does not match, so not following - - if (config.follow_if_same_protocol && !matches('protocol')) - return false; // procotol does not match, so not following - - return true; -} - -Needle.prototype.send_request = function(count, method, uri, config, post_data, out, callback) { - - if (typeof config.uri_modifier === 'function') { - var modified_uri = config.uri_modifier(uri); - debug('Modifying request URI', uri + ' => ' + modified_uri); - uri = modified_uri; - } - - var timer, - returned = 0, - self = this, - request_opts = this.get_request_opts(method, uri, config), - protocol = request_opts.protocol == 'https:' ? https : http; - - function done(err, resp) { - if (returned++ > 0) - return debug('Already finished, stopping here.'); - - if (timer) clearTimeout(timer); - request.removeListener('error', had_error); - - if (callback) - return callback(err, resp, resp ? resp.body : undefined); - - // NOTE: this event used to be called 'end', but the behaviour was confusing - // when errors ocurred, because the stream would still emit an 'end' event. - out.emit('done', err); - } - - function had_error(err) { - debug('Request error', err); - out.emit('err', err); - done(err || new Error('Unknown error when making request.')); - } - - function set_timeout(type, milisecs) { - if (timer) clearTimeout(timer); - if (milisecs <= 0) return; - - timer = setTimeout(function() { - out.emit('timeout', type); - request.abort(); - // also invoke done() to terminate job on read_timeout - if (type == 'read') done(new Error(type + ' timeout')); - }, milisecs); - } - - // handle errors on the underlying socket, that may be closed while writing - // for an example case, see test/long_string_spec.js. we make sure this - // scenario ocurred by verifying the socket's writable & destroyed states. - function on_socket_end() { - if (returned && !this.writable && this.destroyed === false) { - this.destroy(); - had_error(new Error('Remote end closed socket abruptly.')) - } - } - - debug('Making request #' + count, request_opts); - var request = protocol.request(request_opts, function(resp) { - - var headers = resp.headers; - debug('Got response', resp.statusCode, headers); - out.emit('response', resp); - - set_timeout('read', config.read_timeout); - - // if we got cookies, parse them unless we were instructed not to. make sure to include any - // cookies that might have been set on previous redirects. - if (config.parse_cookies && (headers['set-cookie'] || config.previous_resp_cookies)) { - resp.cookies = extend(config.previous_resp_cookies || {}, cookies.read(headers['set-cookie'])); - debug('Got cookies', resp.cookies); - } - - // if redirect code is found, determine if we should follow it according to the given options. - if (redirect_codes.indexOf(resp.statusCode) !== -1 && self.should_follow(headers.location, config, uri)) { - // clear timer before following redirects to prevent unexpected setTimeout consequence - clearTimeout(timer); - - if (count <= config.follow_max) { - out.emit('redirect', headers.location); - - // unless 'follow_keep_method' is true, rewrite the request to GET before continuing. - if (!config.follow_keep_method) { - method = 'GET'; - post_data = null; - delete config.headers['content-length']; // in case the original was a multipart POST request. - } - - // if follow_set_cookies is true, insert cookies in the next request's headers. - // we set both the original request cookies plus any response cookies we might have received. - if (config.follow_set_cookies) { - var request_cookies = cookies.read(config.headers['cookie']); - config.previous_resp_cookies = resp.cookies; - if (Object.keys(request_cookies).length || Object.keys(resp.cookies || {}).length) { - config.headers['cookie'] = cookies.write(extend(request_cookies, resp.cookies)); - } - } else if (config.headers['cookie']) { - debug('Clearing original request cookie', config.headers['cookie']); - delete config.headers['cookie']; - } - - if (config.follow_set_referer) - config.headers['referer'] = encodeURI(uri); // the original, not the destination URL. - - config.headers['host'] = null; // clear previous Host header to avoid conflicts. - - debug('Redirecting to ' + url.resolve(uri, headers.location)); - return self.send_request(++count, method, url.resolve(uri, headers.location), config, post_data, out, callback); - } else if (config.follow_max > 0) { - return done(new Error('Max redirects reached. Possible loop in: ' + headers.location)); - } - } - - // if auth is requested and credentials were not passed, resend request, provided we have user/pass. - if (resp.statusCode == 401 && headers['www-authenticate'] && config.credentials) { - if (!config.headers['authorization']) { // only if authentication hasn't been sent - var auth_header = auth.header(headers['www-authenticate'], config.credentials, request_opts); - - if (auth_header) { - config.headers['authorization'] = auth_header; - return self.send_request(count, method, uri, config, post_data, out, callback); - } - } - } - - // ok, so we got a valid (non-redirect & authorized) response. let's notify the stream guys. - out.emit('header', resp.statusCode, headers); - out.emit('headers', headers); - - var pipeline = [], - mime = parse_content_type(headers['content-type']), - text_response = mime.type && mime.type.indexOf('text/') != -1; - - // To start, if our body is compressed and we're able to inflate it, do it. - if (headers['content-encoding'] && decompressors[headers['content-encoding']]) { - - var decompressor = decompressors[headers['content-encoding']](zlib_options); - - // make sure we catch errors triggered by the decompressor. - decompressor.on('error', had_error); - pipeline.push(decompressor); - } - - // If parse is enabled and we have a parser for it, then go for it. - if (config.parser && parsers[mime.type]) { - - // If a specific parser was requested, make sure we don't parse other types. - var parser_name = config.parser.toString().toLowerCase(); - if (['xml', 'json'].indexOf(parser_name) == -1 || parsers[mime.type].name == parser_name) { - - // OK, so either we're parsing all content types or the one requested matches. - out.parser = parsers[mime.type].name; - pipeline.push(parsers[mime.type].fn()); - - // Set objectMode on out stream to improve performance. - out._writableState.objectMode = true; - out._readableState.objectMode = true; - } - - // If we're not parsing, and unless decoding was disabled, we'll try - // decoding non UTF-8 bodies to UTF-8, using the iconv-lite library. - } else if (text_response && config.decode_response - && mime.charset) { - pipeline.push(decoder(mime.charset)); - } - // And `out` is the stream we finally push the decoded/parsed output to. - pipeline.push(out); - - // Now, release the kraken! - var tmp = resp; - while (pipeline.length) { - tmp = tmp.pipe(pipeline.shift()); - } - - // If the user has requested and output file, pipe the output stream to it. - // In stream mode, we will still get the response stream to play with. - if (config.output && resp.statusCode == 200) { - - // for some reason, simply piping resp to the writable stream doesn't - // work all the time (stream gets cut in the middle with no warning). - // so we'll manually need to do the readable/write(chunk) trick. - var file = fs.createWriteStream(config.output); - file.on('error', had_error); - - out.on('end', function() { - if (file.writable) file.end(); - }); - - file.on('close', function() { - delete out.file; - }) - - out.on('readable', function() { - var chunk; - while ((chunk = this.read()) !== null) { - if (file.writable) file.write(chunk); - - // if callback was requested, also push it to resp.body - if (resp.body) resp.body.push(chunk); - } - }) - - out.file = file; - } - - // Only aggregate the full body if a callback was requested. - if (callback) { - resp.raw = []; - resp.body = []; - resp.bytes = 0; - - // Gather and count the amount of (raw) bytes using a PassThrough stream. - var clean_pipe = new stream.PassThrough(); - resp.pipe(clean_pipe); - - clean_pipe.on('readable', function() { - var chunk; - while ((chunk = this.read()) != null) { - resp.bytes += chunk.length; - resp.raw.push(chunk); - } - }) - - // Listen on the 'readable' event to aggregate the chunks, but only if - // file output wasn't requested. Otherwise we'd have two stream readers. - if (!config.output || resp.statusCode != 200) { - out.on('readable', function() { - var chunk; - while ((chunk = this.read()) !== null) { - // We're either pushing buffers or objects, never strings. - if (typeof chunk == 'string') chunk = Buffer.from(chunk); - - // Push all chunks to resp.body. We'll bind them in resp.end(). - resp.body.push(chunk); - } - }) - } - } - - // And set the .body property once all data is in. - out.on('end', function() { - if (resp.body) { // callback mode - - // we want to be able to access to the raw data later, so keep a reference. - resp.raw = Buffer.concat(resp.raw); - - // if parse was successful, we should have an array with one object - if (resp.body[0] !== undefined && !Buffer.isBuffer(resp.body[0])) { - - // that's our body right there. - resp.body = resp.body[0]; - - // set the parser property on our response. we may want to check. - if (out.parser) resp.parser = out.parser; - - } else { // we got one or several buffers. string or binary. - resp.body = Buffer.concat(resp.body); - - // if we're here and parsed is true, it means we tried to but it didn't work. - // so given that we got a text response, let's stringify it. - if (text_response || out.parser) { - resp.body = resp.body.toString(); - } - } - } - - // if an output file is being written to, make sure the callback - // is triggered after all data has been written to it. - if (out.file) { - out.file.on('close', function() { - done(null, resp, resp.body); - }) - } else { // elvis has left the building. - done(null, resp, resp.body); - } - - }); - - }); // end request call - - // unless open_timeout was disabled, set a timeout to abort the request. - set_timeout('open', config.open_timeout); - - // handle errors on the request object. things might get bumpy. - request.on('error', had_error); - - // make sure timer is cleared if request is aborted (issue #257) - request.once('abort', function() { - if (timer) clearTimeout(timer); - }) - - // handle socket 'end' event to ensure we don't get delayed EPIPE errors. - request.once('socket', function(socket) { - if (socket.connecting) { - socket.once('connect', function() { - set_timeout('response', config.response_timeout); - }) - } else { - set_timeout('response', config.response_timeout); - } - - // console.log(socket); - if (!socket.on_socket_end) { - socket.on_socket_end = on_socket_end; - socket.once('end', function() { process.nextTick(on_socket_end.bind(socket)) }); - } - }) - - if (post_data) { - if (is_stream(post_data)) { - post_data.pipe(request); - } else { - request.write(post_data, config.encoding); - request.end(); - } - } else { - request.end(); - } - - out.request = request; - return out; -} - -////////////////////////////////////////// -// exports - -if (typeof Promise !== 'undefined') { - module.exports = function() { - var verb, args = [].slice.call(arguments); - - if (args[0].match(/\.|\//)) // first argument looks like a URL - verb = (args.length > 2) ? 'post' : 'get'; - else - verb = args.shift(); - - if (verb.match(/get|head/) && args.length == 2) - args.splice(1, 0, null); // assume no data if head/get with two args (url, options) - - return new Promise(function(resolve, reject) { - module.exports.request(verb, args[0], args[1], args[2], function(err, resp) { - return err ? reject(err) : resolve(resp); - }); - }) - } -} - -module.exports.version = version; - -module.exports.defaults = function(obj) { - for (var key in obj) { - var target_key = aliased.options[key] || key; - - if (defaults.hasOwnProperty(target_key) && typeof obj[key] != 'undefined') { - if (target_key != 'parse_response' && target_key != 'proxy') { - // ensure type matches the original, except for proxy/parse_response that can be null/bool or string - var valid_type = defaults[target_key].constructor.name; - - if (obj[key].constructor.name != valid_type) - throw new TypeError('Invalid type for ' + key + ', should be ' + valid_type); - } - defaults[target_key] = obj[key]; - } else { - throw new Error('Invalid property for defaults:' + target_key); - } - } - - return defaults; -} - -'head get'.split(' ').forEach(function(method) { - module.exports[method] = function(uri, options, callback) { - return new Needle(method, uri, null, options, callback).start(); - } -}) - -'post put patch delete'.split(' ').forEach(function(method) { - module.exports[method] = function(uri, data, options, callback) { - return new Needle(method, uri, data, options, callback).start(); - } -}) - -module.exports.request = function(method, uri, data, opts, callback) { - return new Needle(method, uri, data, opts, callback).start(); -}; diff --git a/node_modules/needle/lib/parsers.js b/node_modules/needle/lib/parsers.js deleted file mode 100644 index 57f33ec..0000000 --- a/node_modules/needle/lib/parsers.js +++ /dev/null @@ -1,120 +0,0 @@ -////////////////////////////////////////// -// Defines mappings between content-type -// and the appropriate parsers. -////////////////////////////////////////// - -var Transform = require('stream').Transform; -var sax = require('sax'); - -function parseXML(str, cb) { - var obj, current, parser = sax.parser(true, { trim: true, lowercase: true }) - parser.onerror = parser.onend = done; - - function done(err) { - parser.onerror = parser.onend = function() { } - cb(err, obj) - } - - function newElement(name, attributes) { - return { - name: name || '', - value: '', - attributes: attributes || {}, - children: [] - } - } - - parser.oncdata = parser.ontext = function(t) { - if (current) current.value += t - } - - parser.onopentag = function(node) { - var element = newElement(node.name, node.attributes) - if (current) { - element.parent = current - current.children.push(element) - } else { // root object - obj = element - } - - current = element - }; - - parser.onclosetag = function() { - if (typeof current.parent !== 'undefined') { - var just_closed = current - current = current.parent - delete just_closed.parent - } - } - - parser.write(str).close() -} - -function parserFactory(name, fn) { - - function parser() { - var chunks = [], - stream = new Transform({ objectMode: true }); - - // Buffer all our data - stream._transform = function(chunk, encoding, done) { - chunks.push(chunk); - done(); - } - - // And call the parser when all is there. - stream._flush = function(done) { - var self = this, - data = Buffer.concat(chunks); - - try { - fn(data, function(err, result) { - if (err) throw err; - self.push(result); - }); - } catch (err) { - self.push(data); // just pass the original data - } finally { - done(); - } - } - - return stream; - } - - return { fn: parser, name: name }; -} - -var parsers = {} - -function buildParser(name, types, fn) { - var parser = parserFactory(name, fn); - types.forEach(function(type) { - parsers[type] = parser; - }) -} - -buildParser('json', [ - 'application/json', - 'text/javascript' -], function(buffer, cb) { - var err, data; - try { data = JSON.parse(buffer); } catch (e) { err = e; } - cb(err, data); -}); - -buildParser('xml', [ - 'text/xml', - 'application/xml', - 'application/rdf+xml', - 'application/rss+xml', - 'application/atom+xml' -], function(buffer, cb) { - parseXML(buffer.toString(), function(err, obj) { - cb(err, obj) - }) -}); - -module.exports = parsers; -module.exports.use = buildParser; diff --git a/node_modules/needle/lib/querystring.js b/node_modules/needle/lib/querystring.js deleted file mode 100644 index e58cc42..0000000 --- a/node_modules/needle/lib/querystring.js +++ /dev/null @@ -1,49 +0,0 @@ -// based on the qs module, but handles null objects as expected -// fixes by Tomas Pollak. - -var toString = Object.prototype.toString; - -function stringify(obj, prefix) { - if (prefix && (obj === null || typeof obj == 'undefined')) { - return prefix + '='; - } else if (toString.call(obj) == '[object Array]') { - return stringifyArray(obj, prefix); - } else if (toString.call(obj) == '[object Object]') { - return stringifyObject(obj, prefix); - } else if (toString.call(obj) == '[object Date]') { - return obj.toISOString(); - } else if (prefix) { // string inside array or hash - return prefix + '=' + encodeURIComponent(String(obj)); - } else if (String(obj).indexOf('=') !== -1) { // string with equal sign - return String(obj); - } else { - throw new TypeError('Cannot build a querystring out of: ' + obj); - } -}; - -function stringifyArray(arr, prefix) { - var ret = []; - - for (var i = 0, len = arr.length; i < len; i++) { - if (prefix) - ret.push(stringify(arr[i], prefix + '[]')); - else - ret.push(stringify(arr[i])); - } - - return ret.join('&'); -} - -function stringifyObject(obj, prefix) { - var ret = []; - - Object.keys(obj).forEach(function(key) { - ret.push(stringify(obj[key], prefix - ? prefix + '[' + encodeURIComponent(key) + ']' - : encodeURIComponent(key))); - }) - - return ret.join('&'); -} - -exports.build = stringify; diff --git a/node_modules/needle/license.txt b/node_modules/needle/license.txt deleted file mode 100644 index fb245f3..0000000 --- a/node_modules/needle/license.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) Fork, Ltd. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/needle/package.json b/node_modules/needle/package.json deleted file mode 100644 index 463a18b..0000000 --- a/node_modules/needle/package.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "_from": "needle@^2.2.1", - "_id": "needle@2.5.0", - "_inBundle": false, - "_integrity": "sha512-o/qITSDR0JCyCKEQ1/1bnUXMmznxabbwi/Y4WwJElf+evwJNFNwIDMCCt5IigFVxgeGBJESLohGtIS9gEzo1fA==", - "_location": "/needle", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "needle@^2.2.1", - "name": "needle", - "escapedName": "needle", - "rawSpec": "^2.2.1", - "saveSpec": null, - "fetchSpec": "^2.2.1" - }, - "_requiredBy": [ - "/node-pre-gyp" - ], - "_resolved": "https://registry.npmjs.org/needle/-/needle-2.5.0.tgz", - "_shasum": "e6fc4b3cc6c25caed7554bd613a5cf0bac8c31c0", - "_spec": "needle@^2.2.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/node-pre-gyp", - "author": { - "name": "Tomás Pollak", - "email": "tomas@forkhq.com" - }, - "bin": { - "needle": "bin/needle" - }, - "bugs": { - "url": "https://github.com/tomas/needle/issues" - }, - "bundleDependencies": false, - "dependencies": { - "debug": "^3.2.6", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - }, - "deprecated": false, - "description": "The leanest and most handsome HTTP client in the Nodelands.", - "devDependencies": { - "JSONStream": "^1.3.5", - "jschardet": "^1.6.0", - "mocha": "^5.2.0", - "q": "^1.5.1", - "should": "^13.2.3", - "sinon": "^2.3.0", - "xml2js": "^0.4.19" - }, - "directories": { - "lib": "./lib" - }, - "engines": { - "node": ">= 4.4.x" - }, - "homepage": "https://github.com/tomas/needle#readme", - "keywords": [ - "http", - "https", - "simple", - "request", - "client", - "multipart", - "upload", - "proxy", - "deflate", - "timeout", - "charset", - "iconv", - "cookie", - "redirect" - ], - "license": "MIT", - "main": "./lib/needle", - "name": "needle", - "repository": { - "type": "git", - "url": "git+https://github.com/tomas/needle.git" - }, - "scripts": { - "test": "mocha test" - }, - "tags": [ - "http", - "https", - "simple", - "request", - "client", - "multipart", - "upload", - "proxy", - "deflate", - "timeout", - "charset", - "iconv", - "cookie", - "redirect" - ], - "version": "2.5.0" -} diff --git a/node_modules/needle/test/auth_digest_spec.js b/node_modules/needle/test/auth_digest_spec.js deleted file mode 100644 index a96b852..0000000 --- a/node_modules/needle/test/auth_digest_spec.js +++ /dev/null @@ -1,116 +0,0 @@ -var needle = require('../'), - auth = require('../lib/auth'), - sinon = require('sinon'), - should = require('should'), - http = require('http'), - helpers = require('./helpers'); - -var createHash = require('crypto').createHash; - -function md5(string) { - return createHash('md5').update(string).digest('hex'); -} - -function parse_header(header) { - var challenge = {}, - matches = header.match(/([a-z0-9_-]+)="?([a-z0-9=\/\.@\s-]+)"?/gi); - - for (var i = 0, l = matches.length; i < l; i++) { - var parts = matches[i].split('='), - key = parts.shift(), - val = parts.join('=').replace(/^"/, '').replace(/"$/, ''); - - challenge[key] = val; - } - - return challenge; -} - -describe('auth_digest', function() { - describe('With qop (RFC 2617)', function() { - it('should generate a proper header', function() { - // from https://tools.ietf.org/html/rfc2617 - var performDigest = function() { - var header = 'Digest realm="testrealm@host.com", qop="auth,auth-int", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", opaque="5ccc069c403ebaf9f0171e9517f40e41"'; - var user = 'Mufasa'; - var pass = 'Circle Of Life'; - var method = 'get'; - var path = '/dir/index.html'; - - var updatedHeader = auth.digest(header, user, pass, method, path); - var parsedUpdatedHeader = parse_header(updatedHeader); - - var ha1 = md5(user + ':' + parsedUpdatedHeader.realm + ':' + pass); - var ha2 = md5(method.toUpperCase() + ':' + path); - var expectedResponse = md5([ - ha1, - parsedUpdatedHeader.nonce, - parsedUpdatedHeader.nc, - parsedUpdatedHeader.cnonce, - parsedUpdatedHeader.qop, - ha2 - ].join(':')); - - return { - header: updatedHeader, - parsed: parsedUpdatedHeader, - expectedResponse: expectedResponse, - } - } - - const result = performDigest(); - - (result.header).should - .match(/qop="auth"/) - .match(/uri="\/dir\/index.html"/) - .match(/opaque="5ccc069c403ebaf9f0171e9517f40e41"/) - .match(/realm="testrealm@host\.com"/) - .match(/response=/) - .match(/nc=/) - .match(/nonce=/) - .match(/cnonce=/); - - (result.parsed.response).should.be.eql(result.expectedResponse); - }); - }); - - describe('Without qop (RFC 2617)', function() { - it('should generate a proper header', function() { - // from https://tools.ietf.org/html/rfc2069 - var performDigest = function() { - var header = 'Digest realm="testrealm@host.com", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", opaque="5ccc069c403ebaf9f0171e9517f40e41"'; - var user = 'Mufasa'; - var pass = 'Circle Of Life'; - var method = 'get'; - var path = '/dir/index.html'; - - var updatedHeader = auth.digest(header, user, pass, method, path); - var parsedUpdatedHeader = parse_header(updatedHeader); - - var ha1 = md5(user + ':' + parsedUpdatedHeader.realm + ':' + pass); - var ha2 = md5(method.toUpperCase() + ':' + path); - var expectedResponse = md5([ha1, parsedUpdatedHeader.nonce, ha2].join(':')); - - return { - header: updatedHeader, - parsed: parsedUpdatedHeader, - expectedResponse: expectedResponse, - } - } - - const result = performDigest(); - - (result.header).should - .not.match(/qop=/) - .match(/uri="\/dir\/index.html"/) - .match(/opaque="5ccc069c403ebaf9f0171e9517f40e41"/) - .match(/realm="testrealm@host\.com"/) - .match(/response=/) - .not.match(/nc=/) - .match(/nonce=/) - .not.match(/cnonce=/); - - (result.parsed.response).should.be.eql(result.expectedResponse); - }); - }); -}) diff --git a/node_modules/needle/test/basic_auth_spec.js b/node_modules/needle/test/basic_auth_spec.js deleted file mode 100644 index 343f1db..0000000 --- a/node_modules/needle/test/basic_auth_spec.js +++ /dev/null @@ -1,196 +0,0 @@ -var helpers = require('./helpers'), - should = require('should'), - needle = require('./../'), - server; - -var port = 7707; - -describe('Basic Auth', function() { - - before(function(done) { - server = helpers.server({ port: port }, done); - }) - - after(function(done) { - server.close(done); - }) - - ///////////////// helpers - - var get_auth = function(header) { - var token = header.split(/\s+/).pop(); - return token && Buffer.from(token, 'base64').toString().split(':'); - } - - describe('when neither username or password are passed', function() { - - it('doesnt send any Authorization headers', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, resp) { - var sent_headers = resp.body.headers; - Object.keys(sent_headers).should.not.containEql('authorization'); - done(); - }) - }) - - }) - - describe('when username is an empty string, and password is a valid string', function() { - - var opts = { username: '', password: 'foobar', parse: true }; - - it('doesnt send any Authorization headers', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, resp) { - var sent_headers = resp.body.headers; - Object.keys(sent_headers).should.not.containEql('authorization'); - done(); - }) - }) - - }); - - describe('when username is a valid string, but no username is passed', function() { - - var opts = { username: 'foobar', parse: true }; - - it('sends Authorization header', function(done) { - needle.get('localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - Object.keys(sent_headers).should.containEql('authorization'); - done(); - }) - }) - - it('Basic Auth only includes username, without colon', function(done) { - needle.get('localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - var auth = get_auth(sent_headers['authorization']); - auth[0].should.equal('foobar'); - auth.should.have.lengthOf(1); - done(); - }) - }) - - }) - - describe('when username is a valid string, and password is null', function() { - - var opts = { username: 'foobar', password: null, parse: true }; - - it('sends Authorization header', function(done) { - needle.get('localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - Object.keys(sent_headers).should.containEql('authorization'); - done(); - }) - }) - - it('Basic Auth only includes both username and password', function(done) { - needle.get('localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - var auth = get_auth(sent_headers['authorization']); - auth[0].should.equal('foobar'); - auth[1].should.equal(''); - done(); - }) - }) - - }) - - describe('when username is a valid string, and password is an empty string', function() { - - var opts = { username: 'foobar', password: '', parse: true }; - - it('sends Authorization header', function(done) { - needle.get('localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - Object.keys(sent_headers).should.containEql('authorization'); - done(); - }) - }) - - it('Basic Auth only includes both username and password', function(done) { - needle.get('localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - var auth = get_auth(sent_headers['authorization']); - auth[0].should.equal('foobar'); - auth[1].should.equal(''); - auth.should.have.lengthOf(2); - done(); - }) - }) - - }) - - describe('when username AND password are non empty strings', function() { - - var opts = { username: 'foobar', password: 'jakub', parse: true }; - - it('sends Authorization header', function(done) { - needle.get('localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - Object.keys(sent_headers).should.containEql('authorization'); - done(); - }) - }) - - it('Basic Auth only includes both user and password', function(done) { - needle.get('localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - var auth = get_auth(sent_headers['authorization']); - auth[0].should.equal('foobar'); - auth[1].should.equal('jakub'); - auth.should.have.lengthOf(2); - done(); - }) - }) - - }) - - describe('URL with @ but not username/pass', function() { - it('doesnt send Authorization header', function(done) { - var url = 'localhost:' + port + '/abc/@def/xyz.zip'; - - needle.get(url, {}, function(err, resp) { - var sent_headers = resp.body.headers; - Object.keys(sent_headers).should.not.containEql('authorization'); - done(); - }) - }) - - it('sends user:pass headers if passed via options', function(done) { - var url = 'localhost:' + port + '/abc/@def/xyz.zip'; - - needle.get(url, { username: 'foo' }, function(err, resp) { - var sent_headers = resp.body.headers; - Object.keys(sent_headers).should.containEql('authorization'); - sent_headers['authorization'].should.eql('Basic Zm9v') - done(); - }) - }) - }) - - describe('when username/password are included in URL', function() { - var opts = { parse: true }; - - it('sends Authorization header', function(done) { - needle.get('foobar:jakub@localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - Object.keys(sent_headers).should.containEql('authorization'); - done(); - }) - }) - - it('Basic Auth only includes both user and password', function(done) { - needle.get('foobar:jakub@localhost:' + port, opts, function(err, resp) { - var sent_headers = resp.body.headers; - var auth = get_auth(sent_headers['authorization']); - auth[0].should.equal('foobar'); - auth[1].should.equal('jakub'); - auth.should.have.lengthOf(2); - done(); - }) - }) - - }) - -}) diff --git a/node_modules/needle/test/compression_spec.js b/node_modules/needle/test/compression_spec.js deleted file mode 100644 index 80988be..0000000 --- a/node_modules/needle/test/compression_spec.js +++ /dev/null @@ -1,112 +0,0 @@ -var should = require('should'), - needle = require('./../'), - http = require('http'), - zlib = require('zlib'), - stream = require('stream'), - port = 11123, - server; - -describe('compression', function(){ - - require.bind(null, 'zlib').should.not.throw() - - var jsonData = '{"foo":"bar"}'; - - describe('when server supports compression', function(){ - - before(function(){ - server = http.createServer(function(req, res) { - var raw = new stream.PassThrough(); - - var acceptEncoding = req.headers['accept-encoding']; - if (!acceptEncoding) { - acceptEncoding = ''; - } - - if (acceptEncoding.match(/\bdeflate\b/)) { - res.setHeader('Content-Encoding', 'deflate'); - raw.pipe(zlib.createDeflate()).pipe(res); - } else if (acceptEncoding.match(/\bgzip\b/)) { - res.setHeader('Content-Encoding', 'gzip'); - raw.pipe(zlib.createGzip()).pipe(res); - } else if (acceptEncoding.match(/\bbr\b/)) { - res.setHeader('Content-Encoding', 'br'); - raw.pipe(zlib.createBrotliCompress()).pipe(res); - } else { - raw.pipe(res); - } - - res.setHeader('Content-Type', 'application/json') - if (req.headers['with-bad']) { - res.end('foo'); // end, no deflate data - } else { - raw.end(jsonData) - } - - }) - - server.listen(port); - }); - - after(function(done){ - server.close(done); - }) - - describe('and client requests no compression', function() { - it('should have the body decompressed', function(done){ - needle.get('localhost:' + port, function(err, response, body){ - should.ifError(err); - body.should.have.property('foo', 'bar'); - response.bytes.should.equal(jsonData.length); - done(); - }) - }) - }) - - describe('and client requests gzip compression', function() { - it('should have the body decompressed', function(done){ - needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'gzip'}}, function(err, response, body){ - should.ifError(err); - body.should.have.property('foo', 'bar'); - response.bytes.should.not.equal(jsonData.length); - done(); - }) - }) - }) - - describe('and client requests deflate compression', function() { - it('should have the body decompressed', function(done){ - needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'deflate'}}, function(err, response, body){ - should.ifError(err); - body.should.have.property('foo', 'bar'); - response.bytes.should.not.equal(jsonData.length); - done(); - }) - }) - - it('should rethrow errors from decompressors', function(done){ - needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'deflate', 'With-Bad': 'true'}}, function(err, response, body) { - should.exist(err); - err.message.should.equal("incorrect header check"); - err.code.should.equal("Z_DATA_ERROR") - done(); - }) - }) - }) - - describe('and client requests brotli compression', function() { - it('should have the body decompressed', function(done){ - // Skip this test if Brotli is not supported - if (typeof zlib.BrotliDecompress !== 'function') { - return done(); - } - needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'br'}}, function(err, response, body){ - should.ifError(err); - body.should.have.property('foo', 'bar'); - response.bytes.should.not.equal(jsonData.length); - done(); - }) - }) - }) - }) -}) diff --git a/node_modules/needle/test/cookies_spec.js b/node_modules/needle/test/cookies_spec.js deleted file mode 100644 index 745f4c7..0000000 --- a/node_modules/needle/test/cookies_spec.js +++ /dev/null @@ -1,396 +0,0 @@ -var needle = require('../'), - cookies = require('../lib/cookies'), - sinon = require('sinon'), - http = require('http'), - should = require('should'); - -var WEIRD_COOKIE_NAME = 'wc', - BASE64_COOKIE_NAME = 'bc', - FORBIDDEN_COOKIE_NAME = 'fc', - NUMBER_COOKIE_NAME = 'nc'; - -var WEIRD_COOKIE_VALUE = '!\'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~', - BASE64_COOKIE_VALUE = 'Y29va2llCg==', - FORBIDDEN_COOKIE_VALUE = ' ;"\\,', - NUMBER_COOKIE_VALUE = 12354342; - -var NO_COOKIES_TEST_PORT = 11112, - ALL_COOKIES_TEST_PORT = 11113; - -describe('cookies', function() { - - var setCookieHeader, headers, server, opts; - - function decode(str) { - return decodeURIComponent(str); - } - - function encode(str) { - str = str.toString().replace(/[\x00-\x1F\x7F]/g, encodeURIComponent); - return str.replace(/[\s\"\,;\\%]/g, encodeURIComponent); - } - - before(function() { - setCookieHeader = [ - WEIRD_COOKIE_NAME + '=' + encode(WEIRD_COOKIE_VALUE) + ';', - BASE64_COOKIE_NAME + '=' + encode(BASE64_COOKIE_VALUE) + ';', - FORBIDDEN_COOKIE_NAME + '=' + encode(FORBIDDEN_COOKIE_VALUE) + ';', - NUMBER_COOKIE_NAME + '=' + encode(NUMBER_COOKIE_VALUE) + ';' - ]; - }); - - before(function(done) { - serverAllCookies = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'text/html'); - res.setHeader('Set-Cookie', setCookieHeader); - res.end('200'); - }).listen(ALL_COOKIES_TEST_PORT, done); - }); - - after(function(done) { - serverAllCookies.close(done); - }); - - describe('with default options', function() { - it('no cookie header is set on request', function(done) { - needle.get( - 'localhost:' + ALL_COOKIES_TEST_PORT, function(err, response) { - should.not.exist(response.req._headers.cookie); - done(); - }); - }); - }); - - describe('if response does not contain cookies', function() { - before(function(done) { - serverNoCookies = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'text/html'); - res.end('200'); - }).listen(NO_COOKIES_TEST_PORT, done); - }); - - it('response.cookies is undefined', function(done) { - needle.get( - 'localhost:' + NO_COOKIES_TEST_PORT, function(error, response) { - should.not.exist(response.cookies); - done(); - }); - }); - - after(function(done) { - serverNoCookies.close(done); - }); - }); - - describe('if response contains cookies', function() { - - it('puts them on resp.cookies', function(done) { - needle.get( - 'localhost:' + ALL_COOKIES_TEST_PORT, function(error, response) { - response.should.have.property('cookies'); - done(); - }); - }); - - it('parses them as a object', function(done) { - needle.get( - 'localhost:' + ALL_COOKIES_TEST_PORT, function(error, response) { - response.cookies.should.be.an.instanceOf(Object) - .and.have.property(WEIRD_COOKIE_NAME); - response.cookies.should.have.property(BASE64_COOKIE_NAME); - response.cookies.should.have.property(FORBIDDEN_COOKIE_NAME); - response.cookies.should.have.property(NUMBER_COOKIE_NAME); - done(); - }); - }); - - it('must decode it', function(done) { - needle.get( - 'localhost:' + ALL_COOKIES_TEST_PORT, function(error, response) { - response.cookies.wc.should.be.eql(WEIRD_COOKIE_VALUE); - response.cookies.bc.should.be.eql(BASE64_COOKIE_VALUE); - response.cookies.fc.should.be.eql(FORBIDDEN_COOKIE_VALUE); - response.cookies.nc.should.be.eql(NUMBER_COOKIE_VALUE.toString()); - done(); - }); - }); - - describe('when a cookie value is invalid', function() { - - before(function() { - setCookieHeader = [ - 'geo_city=%D1%E0%ED%EA%F2-%CF%E5%F2%E5%F0%E1%F3%F0%E3' - ]; - }) - - it('doesnt blow up', function(done) { - needle.get('localhost:' + ALL_COOKIES_TEST_PORT, function(error, response) { - should.not.exist(error) - var whatever = 'efbfbdefbfbdefbfbdefbfbdefbfbd2defbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbd'; - Buffer.from(response.cookies.geo_city).toString('hex').should.eql(whatever) - done(); - }); - }) - - }) - - describe('and response is a redirect', function() { - - var redirectServer, testPort = 22222; - var requestCookies = []; - - var responseCookies = [ - [ // first req - WEIRD_COOKIE_NAME + '=' + encode(WEIRD_COOKIE_VALUE) + ';', - BASE64_COOKIE_NAME + '=' + encode(BASE64_COOKIE_VALUE) + ';', - 'FOO=123;' - ], [ // second req - FORBIDDEN_COOKIE_NAME + '=' + encode(FORBIDDEN_COOKIE_VALUE) + ';', - NUMBER_COOKIE_NAME + '=' + encode(NUMBER_COOKIE_VALUE) + ';' - ], [ // third red - 'FOO=BAR;' - ] - ] - - before(function(done) { - redirectServer = http.createServer(function(req, res) { - var number = parseInt(req.url.replace('/', '')); - var nextUrl = 'http://' + 'localhost:' + testPort + '/' + (number + 1); - - if (number == 0) requestCookies = []; // reset - requestCookies.push(req.headers['cookie']); - - if (responseCookies[number]) { // we should send cookies for this request - res.statusCode = 302; - res.setHeader('Set-Cookie', responseCookies[number]); - res.setHeader('Location', nextUrl); - } else if (number == 3) { - res.statusCode = 302; // redirect but without cookies - res.setHeader('Location', nextUrl); - } - - res.end('OK'); - }).listen(22222, done); - }); - - after(function(done) { - redirectServer.close(done); - }) - - describe('and follow_set_cookies is false', function() { - - describe('with original request cookie', function() { - - var opts = { - follow_set_cookies: false, - follow_max: 4, - cookies: { 'xxx': 123 } - }; - - it('request cookie is not passed to redirects', function(done) { - needle.get('localhost:' + testPort + '/0', opts, function(err, resp) { - requestCookies.should.eql(["xxx=123", undefined, undefined, undefined, undefined]) - done(); - }); - }); - - it('response cookies are not passed either', function(done) { - needle.get('localhost:' + testPort + '/0', opts, function(err, resp) { - should.not.exist(resp.cookies); - done(); - }); - }); - - }) - - describe('without original request cookie', function() { - - var opts = { - follow_set_cookies: false, - follow_max: 4, - }; - - it('no request cookies are sent', function(done) { - needle.get('localhost:' + testPort + '/0', opts, function(err, resp) { - requestCookies.should.eql([undefined, undefined, undefined, undefined, undefined]) - done(); - }); - }); - - it('response cookies are not passed either', function(done) { - needle.get('localhost:' + testPort + '/0', opts, function(err, resp) { - should.not.exist(resp.cookies); - done(); - }); - }); - - }) - - }); - - describe('and follow_set_cookies is true', function() { - - describe('with original request cookie', function() { - - var opts = { - follow_set_cookies: true, - follow_max: 4, - cookies: { 'xxx': 123 } - }; - - it('request cookie is passed passed to redirects, and response cookies are added too', function(done) { - needle.get('localhost:' + testPort + '/0', opts, function(err, resp) { - requestCookies.should.eql([ - "xxx=123", - "xxx=123; wc=!'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~; bc=Y29va2llCg==; FOO=123", - "xxx=123; wc=!\'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~; bc=Y29va2llCg==; FOO=123; fc=%20%3B%22%5C%2C; nc=12354342", - "xxx=123; wc=!\'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~; bc=Y29va2llCg==; FOO=BAR; fc=%20%3B%22%5C%2C; nc=12354342", - "xxx=123; wc=!\'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~; bc=Y29va2llCg==; FOO=BAR; fc=%20%3B%22%5C%2C; nc=12354342" - ]) - done(); - }); - }); - - it('response cookies are passed as well', function(done) { - needle.get('localhost:' + testPort + '/0', opts, function(err, resp) { - resp.cookies.should.have.property(WEIRD_COOKIE_NAME); - resp.cookies.should.have.property(BASE64_COOKIE_NAME); - resp.cookies.should.have.property(FORBIDDEN_COOKIE_NAME); - resp.cookies.should.have.property(NUMBER_COOKIE_NAME); - resp.cookies.should.have.property('FOO'); - resp.cookies.FOO.should.eql('BAR'); // should overwrite previous one - done(); - }); - }); - - }) - - describe('without original request cookie', function() { - - var opts = { - follow_set_cookies: true, - follow_max: 4, - }; - - it('response cookies are passed to redirects', function(done) { - needle.get('localhost:' + testPort + '/0', opts, function(err, resp) { - requestCookies.should.eql([ - undefined, - "wc=!'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~; bc=Y29va2llCg==; FOO=123", - "wc=!\'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~; bc=Y29va2llCg==; FOO=123; fc=%20%3B%22%5C%2C; nc=12354342", - "wc=!\'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~; bc=Y29va2llCg==; FOO=BAR; fc=%20%3B%22%5C%2C; nc=12354342", - "wc=!\'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~; bc=Y29va2llCg==; FOO=BAR; fc=%20%3B%22%5C%2C; nc=12354342" - ]) - done(); - }); - }); - - it('response cookies are passed as well', function(done) { - needle.get('localhost:' + testPort + '/0', opts, function(err, resp) { - // resp.cookies.should.have.property(WEIRD_COOKIE_NAME); - // resp.cookies.should.have.property(BASE64_COOKIE_NAME); - // resp.cookies.should.have.property(FORBIDDEN_COOKIE_NAME); - // resp.cookies.should.have.property(NUMBER_COOKIE_NAME); - // resp.cookies.should.have.property('FOO'); - // resp.cookies.FOO.should.eql('BAR'); // should overwrite previous one - done(); - }); - }); - - }) - - }); - }); - - describe('with parse_cookies = false', function() { - it('does not parse them', function(done) { - needle.get( - 'localhost:' + ALL_COOKIES_TEST_PORT, { parse_cookies: false }, function(error, response) { - should.not.exist(response.cookies); - done(); - }); - }); - }); - }); - - describe('if request contains cookie header', function() { - var opts = { - cookies: {} - }; - - before(function() { - opts.cookies[WEIRD_COOKIE_NAME] = WEIRD_COOKIE_VALUE; - opts.cookies[BASE64_COOKIE_NAME] = BASE64_COOKIE_VALUE; - opts.cookies[FORBIDDEN_COOKIE_NAME] = FORBIDDEN_COOKIE_VALUE; - opts.cookies[NUMBER_COOKIE_NAME] = NUMBER_COOKIE_VALUE; - }); - - it('must be a valid cookie string', function(done) { - var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/; - - var full_header = [ - WEIRD_COOKIE_NAME + '=' + WEIRD_COOKIE_VALUE, - BASE64_COOKIE_NAME + '=' + BASE64_COOKIE_VALUE, - FORBIDDEN_COOKIE_NAME + '=' + encode(FORBIDDEN_COOKIE_VALUE), - NUMBER_COOKIE_NAME + '=' + NUMBER_COOKIE_VALUE - ].join('; ') - - needle.get('localhost:' + ALL_COOKIES_TEST_PORT, opts, function(error, response) { - var cookieString = response.req._headers.cookie; - cookieString.should.be.type('string'); - - cookieString.split(/\s*;\s*/).forEach(function(pair) { - COOKIE_PAIR.test(pair).should.be.exactly(true); - }); - - cookieString.should.be.exactly(full_header); - done(); - }); - }); - - it('dont have to encode allowed characters', function(done) { - var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/, - KEY_INDEX = 1, - VALUE_INEX = 3; - - needle.get('localhost:' + ALL_COOKIES_TEST_PORT, opts, function(error, response) { - var cookieObj = {}, - cookieString = response.req._headers.cookie; - - cookieString.split(/\s*;\s*/).forEach(function(str) { - var pair = COOKIE_PAIR.exec(str); - cookieObj[pair[KEY_INDEX]] = pair[VALUE_INEX]; - }); - - cookieObj[WEIRD_COOKIE_NAME].should.be.exactly(WEIRD_COOKIE_VALUE); - cookieObj[BASE64_COOKIE_NAME].should.be.exactly(BASE64_COOKIE_VALUE); - done(); - }); - }); - - it('must encode forbidden characters', function(done) { - var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/, - KEY_INDEX = 1, - VALUE_INEX = 3; - - needle.get('localhost:' + ALL_COOKIES_TEST_PORT, opts, function(error, response) { - var cookieObj = {}, - cookieString = response.req._headers.cookie; - - cookieString.split(/\s*;\s*/).forEach(function(str) { - var pair = COOKIE_PAIR.exec(str); - cookieObj[pair[KEY_INDEX]] = pair[VALUE_INEX]; - }); - - cookieObj[FORBIDDEN_COOKIE_NAME].should.not.be.eql( - FORBIDDEN_COOKIE_VALUE); - cookieObj[FORBIDDEN_COOKIE_NAME].should.be.exactly( - encode(FORBIDDEN_COOKIE_VALUE)); - cookieObj[FORBIDDEN_COOKIE_NAME].should.be.exactly( - encodeURIComponent(FORBIDDEN_COOKIE_VALUE)); - done(); - }); - }); - }); - -}); diff --git a/node_modules/needle/test/decoder_spec.js b/node_modules/needle/test/decoder_spec.js deleted file mode 100644 index db38821..0000000 --- a/node_modules/needle/test/decoder_spec.js +++ /dev/null @@ -1,121 +0,0 @@ -var should = require('should'), - needle = require('./../'), - Q = require('q'), - chardet = require('jschardet'), - helpers = require('./helpers'); - -describe('character encoding', function() { - - var url; - this.timeout(5000); - - describe('Given content-type: "text/html; charset=EUC-JP"', function() { - - before(function() { - url = 'http://www.nina.jp/server/slackware/webapp/tomcat_charset.html'; - }) - - describe('with decode = false', function() { - - it('does not decode', function(done) { - - needle.get(url, { decode: false }, function(err, resp) { - resp.body.should.be.a.String; - chardet.detect(resp.body).encoding.should.eql('windows-1252'); - resp.body.indexOf('EUCを使う').should.eql(-1); - done(); - }) - - }) - - }) - - describe('with decode = true', function() { - - it('decodes', function(done) { - - needle.get(url, { decode: true }, function(err, resp) { - resp.body.should.be.a.String; - chardet.detect(resp.body).encoding.should.eql('ascii'); - resp.body.indexOf('EUCを使う').should.not.eql(-1); - done(); - }) - - }) - - }) - - }) - - describe('Given content-type: "text/html but file is charset: gb2312', function() { - - it('encodes to UTF-8', function(done) { - - // Our Needle wrapper that requests a chinese website. - var task = Q.nbind(needle.get, needle, 'http://www.chinesetop100.com/'); - - // Different instantiations of this task - var tasks = [Q.fcall(task, {decode: true}), - Q.fcall(task, {decode: false})]; - - var results = tasks.map(function(task) { - return task.then(function(obj) { - return obj[0].body; - }); - }); - - // Execute all requests concurrently - Q.all(results).done(function(bodies) { - - var charsets = [ - chardet.detect(bodies[0]).encoding, - chardet.detect(bodies[1]).encoding, - ] - - // We wanted to decode our first stream as specified by options - charsets[0].should.equal('ascii'); - bodies[0].indexOf('全球中文网站前二十强').should.not.equal(-1); - - // But not our second stream - charsets[1].should.equal('windows-1252'); - bodies[1].indexOf('全球中文网站前二十强').should.equal(-1); - - done(); - }); - }) - }) - - describe('Given content-type: "text/html"', function () { - - var server, - port = 54321, - text = 'Magyarországi Fióktelepe' - - before(function(done) { - server = helpers.server({ - port: port, - response: text, - headers: { 'Content-Type': 'text/html' } - }, done); - }) - - after(function(done) { - server.close(done) - }) - - describe('with decode = false', function () { - it('decodes by default to utf-8', function (done) { - - needle.get('http://localhost:' + port, { decode: false }, function (err, resp) { - resp.body.should.be.a.String; - chardet.detect(resp.body).encoding.should.eql('ISO-8859-2'); - resp.body.should.eql('Magyarországi Fióktelepe') - done(); - }) - - }) - - }) - - }) -}) diff --git a/node_modules/needle/test/errors_spec.js b/node_modules/needle/test/errors_spec.js deleted file mode 100644 index 2f488f5..0000000 --- a/node_modules/needle/test/errors_spec.js +++ /dev/null @@ -1,286 +0,0 @@ -var needle = require('../'), - sinon = require('sinon'), - should = require('should'), - http = require('http'), - Emitter = require('events').EventEmitter, - helpers = require('./helpers'); - -var get_catch = function(url, opts) { - var err; - try { - needle.get(url, opts); - } catch(e) { - err = e; - } - return err; -} - -describe('errors', function() { - - after(function(done) { - setTimeout(done, 100) - }) - - describe('when host does not exist', function() { - - var url = 'http://unexistinghost/foo'; - - describe('with callback', function() { - - it('does not throw', function() { - var ex = get_catch(url); - should.not.exist(ex); - }) - - it('callbacks an error', function(done) { - needle.get(url, function(err) { - err.should.be.a.Error; - done(); - }) - }) - - it('error should be ENOTFOUND or EADDRINFO or EAI_AGAIN', function(done) { - needle.get(url, function(err) { - err.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/) - done(); - }) - }) - - it('does not callback a response', function(done) { - needle.get(url, function(err, resp) { - should.not.exist(resp); - done(); - }) - }) - - it('does not emit an error event', function(done) { - var emitted = false; - var req = needle.get(url, function(err, resp) { }) - - req.on('error', function() { - emitted = true; - }) - - setTimeout(function() { - emitted.should.eql(false); - done(); - }, 100); - }) - - }) - - describe('without callback', function() { - - it('does not throw', function() { - var ex = get_catch(url); - should.not.exist(ex); - }) - - it('emits end event once, with error', function(done) { - var callcount = 0, - stream = needle.get(url); - - stream.on('done', function(err) { - callcount++; - }) - - setTimeout(function() { - callcount.should.equal(1); - done(); - }, 200) - }) - - it('error should be ENOTFOUND or EADDRINFO or EAI_AGAIN', function(done) { - var errorific, - stream = needle.get(url); - - stream.on('done', function(err) { - errorific = err; - }) - - setTimeout(function() { - should.exist(errorific); - errorific.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/) - done(); - }, 200) - }) - - it('does not emit a readable event', function(done) { - var called = false, - stream = needle.get(url); - - stream.on('readable', function() { - called = true; - }) - - setTimeout(function() { - called.should.be.false; - done(); - }, 50) - }) - - it('does not emit an error event', function(done) { - var emitted = false, - req = needle.get(url); - - req.on('error', function() { - emitted = true; - }) - - setTimeout(function() { - emitted.should.eql(false); - done(); - }, 100); - }) - - }) - - }) - - describe('when request times out waiting for response', function() { - - var server, - url = 'http://localhost:3333/foo'; - - var send_request = function(cb) { - return needle.get(url, { response_timeout: 200 }, cb); - } - - before(function() { - server = helpers.server({ port: 3333, wait: 1000 }); - }) - - after(function() { - server.close(); - }) - - describe('with callback', function() { - - it('aborts the request', function(done) { - - var time = new Date(); - - send_request(function(err) { - var timediff = (new Date() - time); - timediff.should.be.within(200, 300); - done(); - }) - - }) - - it('callbacks an error', function(done) { - send_request(function(err) { - err.should.be.a.Error; - done(); - }) - }) - - it('error should be ECONNRESET', function(done) { - send_request(function(err) { - err.code.should.equal('ECONNRESET') - done(); - }) - }) - - it('does not callback a response', function(done) { - send_request(function(err, resp) { - should.not.exist(resp); - done(); - }) - }) - - it('does not emit an error event', function(done) { - var emitted = false; - - var req = send_request(function(err, resp) { - should.not.exist(resp); - }) - - req.on('error', function() { - emitted = true; - }) - - setTimeout(function() { - emitted.should.eql(false); - done(); - }, 350); - }) - - }) - - describe('without callback', function() { - - it('emits done event once, with error', function(done) { - var called = 0, - stream = send_request(); - - stream.on('done', function(err) { - called++; - }) - - setTimeout(function() { - called.should.equal(1); - done(); - }, 250) - }) - - it('aborts the request', function(done) { - - var time = new Date(); - var stream = send_request(); - - stream.on('done', function(err) { - var timediff = (new Date() - time); - timediff.should.be.within(200, 300); - done(); - }) - - }) - - it('error should be ECONNRESET', function(done) { - var error, - stream = send_request(); - - stream.on('done', function(err) { - error = err; - }) - - setTimeout(function() { - error.code.should.equal('ECONNRESET') - done(); - }, 250) - }) - - it('does not emit a readable event', function(done) { - var called = false, - stream = send_request(); - - stream.on('readable', function() { - called = true; - }) - - setTimeout(function() { - called.should.be.false; - done(); - }, 250) - }) - - it('does not emit an error event', function(done) { - var emitted = false; - var req = send_request(); - - req.on('error', function() { - emitted = true; - }) - - setTimeout(function() { - emitted.should.eql(false); - done(); - }, 100); - }) - - }) - - }) - -}) diff --git a/node_modules/needle/test/headers_spec.js b/node_modules/needle/test/headers_spec.js deleted file mode 100644 index a5c17e6..0000000 --- a/node_modules/needle/test/headers_spec.js +++ /dev/null @@ -1,203 +0,0 @@ -var http = require('http'), - helpers = require('./helpers'), - should = require('should'); - -var port = 54321; - -describe('request headers', function() { - - var needle, - server, - existing_sockets, - original_defaultMaxSockets; - - before(function(done) { - setTimeout(function() { - existing_sockets = get_active_sockets().length; - server = helpers.server({ port: port }, done); - }, 100); - }) - - after(function(done) { - server.close(done); - }) - - function send_request(opts, cb) { - needle.get('http://localhost:' + port, opts, cb); - } - - function get_active_sockets() { - var handles = process._getActiveHandles(); - - return handles.filter(function(el) { - if (el.constructor.name.toString() == 'Socket') { - return el.destroyed !== true; - } - }) - } - - describe('old node versions (<0.11.4) with persistent keep-alive connections', function() { - - before(function() { - delete require.cache[require.resolve('..')] // in case it was already loaded - original_defaultMaxSockets = http.Agent.defaultMaxSockets; - http.Agent.defaultMaxSockets = 5; - needle = require('..'); - }) - - after(function() { - http.Agent.defaultMaxSockets = original_defaultMaxSockets; - delete require.cache[require.resolve('..')] - }) - - describe('default options', function() { - - it('sends a Connection: close header', function(done) { - send_request({}, function(err, resp) { - resp.body.headers['connection'].should.eql('close'); - done(); - }) - }) - - it('no open sockets remain after request', function(done) { - send_request({}, function(err, resp) { - setTimeout(function() { - get_active_sockets().length.should.eql(existing_sockets); - done(); - }, 10) - }); - }) - - }) - - describe('passing connection: close', function() { - - it('sends a Connection: close header', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - resp.body.headers['connection'].should.eql('close'); - done(); - }) - }) - - it('no open sockets remain after request', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - setTimeout(function() { - get_active_sockets().length.should.eql(existing_sockets); - done(); - }, 10) - }); - }) - - }) - - describe('passing connection: keep-alive', function() { - - it('sends a Connection: keep-alive header (using options.headers.connection)', function(done) { - send_request({ headers: { connection: 'keep-alive' }}, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('sends a Connection: keep-alive header (using options.connection)', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('one open socket remain after request', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - get_active_sockets().length.should.eql(existing_sockets + 1); - done(); - }); - }) - - }) - - }) - - describe('new node versions with smarter connection disposing', function() { - - before(function() { - delete require.cache[require.resolve('..')] - original_defaultMaxSockets = http.Agent.defaultMaxSockets; - http.Agent.defaultMaxSockets = Infinity; - needle = require('..'); - }) - - after(function() { - http.Agent.defaultMaxSockets = original_defaultMaxSockets; - delete require.cache[require.resolve('..')] - }) - - describe('default options', function() { - - // TODO: - // this is weird. by default, new node versions set a 'close' header - // while older versions set a keep-alive header - - it.skip('sets a Connection header', function(done) { - send_request({}, function(err, resp) { - // should.not.exist(resp.body.headers['connection']); - // done(); - }) - }) - - it.skip('one open sockets remain after request', function(done) { - send_request({}, function(err, resp) { - // get_active_sockets().length.should.eql(1); - // done(); - }); - }) - - }) - - describe('passing connection: close', function() { - - it('sends a Connection: close header', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - resp.body.headers['connection'].should.eql('close'); - done(); - }) - }) - - it('no open sockets remain after request', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - setTimeout(function() { - get_active_sockets().length.should.eql(existing_sockets); - done(); - }, 10); - }); - }) - - }) - - describe('passing connection: keep-alive', function() { - - it('sends a Connection: keep-alive header (using options.headers.connection)', function(done) { - send_request({ headers: { connection: 'keep-alive' }}, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('sends a Connection: keep-alive header (using options.connection)', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('one open socket remain after request', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - get_active_sockets().length.should.eql(existing_sockets + 1); - done(); - }); - }) - - }) - - }) - -}) diff --git a/node_modules/needle/test/helpers.js b/node_modules/needle/test/helpers.js deleted file mode 100644 index a85f548..0000000 --- a/node_modules/needle/test/helpers.js +++ /dev/null @@ -1,72 +0,0 @@ -var fs = require('fs'); - -var protocols = { - http : require('http'), - https : require('https') -} - -var keys = { - cert : fs.readFileSync(__dirname + '/keys/ssl.cert'), - key : fs.readFileSync(__dirname + '/keys/ssl.key') -} - -var helpers = {}; - -helpers.server = function(opts, cb) { - - var defaults = { - code : 200, - headers : {'Content-Type': 'application/json'} - } - - var mirror_response = function(req) { - return JSON.stringify({ - headers: req.headers, - body: req.body - }) - } - - var get = function(what) { - if (!opts[what]) - return defaults[what]; - - if (typeof opts[what] == 'function') - return opts[what](); // set them at runtime - else - return opts[what]; - } - - var finish = function(req, res) { - res.writeHead(get('code'), get('headers')); - res.end(opts.response || mirror_response(req)); - } - - var handler = function(req, res) { - - req.setEncoding('utf8'); // get as string - req.body = ''; - req.on('data', function(str) { req.body += str }) - req.socket.on('error', function(e) { - // res.writeHead(500, {'Content-Type': 'text/plain'}); - // res.end('Error: ' + e.message); - }) - - setTimeout(function(){ - finish(req, res); - }, opts.wait || 0); - - }; - - var protocol = opts.protocol || 'http'; - var server; - - if (protocol == 'https') - server = protocols[protocol].createServer(keys, handler); - else - server = protocols[protocol].createServer(handler); - - server.listen(opts.port, cb); - return server; -} - -module.exports = helpers; \ No newline at end of file diff --git a/node_modules/needle/test/long_string_spec.js b/node_modules/needle/test/long_string_spec.js deleted file mode 100644 index 4baa4fa..0000000 --- a/node_modules/needle/test/long_string_spec.js +++ /dev/null @@ -1,34 +0,0 @@ -var needle = require('../'), - should = require('should'); - -describe('when posting a very long string', function() { - - this.timeout(20000); - - function get_string(length) { - var str = ''; - for (var i = 0; i < length; i++) { - str += 'x'; - } - return str; - } - - it("shouldn't throw an EPIPE error out of nowhere", function(done) { - var error; - - function finished() { - setTimeout(function() { - should.not.exist(error); - done(); - }, 300); - } - - try { - needle.post('https://google.com', { data: get_string(Math.pow(2, 20)) }, finished) - } catch(e) { - error = e; - } - - }) - -}) diff --git a/node_modules/needle/test/output_spec.js b/node_modules/needle/test/output_spec.js deleted file mode 100644 index 14fc5bb..0000000 --- a/node_modules/needle/test/output_spec.js +++ /dev/null @@ -1,254 +0,0 @@ -var should = require('should'), - needle = require('./../'), - http = require('http'), - sinon = require('sinon'), - stream = require('stream'), - fs = require('fs'), - port = 11111, - server; - -describe('with output option', function() { - - var server, handler, file = '/tmp/foobar.out'; - - function send_request_cb(where, cb) { - var url = 'http://localhost:' + port + '/whatever.file'; - return needle.get(url, { output: where }, cb); - } - - function send_request_stream(where, cb) { - var url = 'http://localhost:' + port + '/whatever.file'; - var stream = needle.get(url, { output: where }); - stream.on('end', cb); - } - - // this will only work in UNICES - function get_open_file_descriptors() { - var list = fs.readdirSync('/proc/self/fd'); - return list.length; - } - - var send_request = send_request_cb; - - before(function(){ - server = http.createServer(function(req, res) { - handler(req, res); - }).listen(port); - }); - - after(function() { - server.close(); - }) - - beforeEach(function() { - try { fs.unlinkSync(file) } catch(e) { }; - }) - - describe('and a 404 response', function() { - - before(function() { - handler = function(req, res) { - res.writeHead(404, {'Content-Type': 'text/plain' }); - res.end(); - } - }) - - it('doesnt attempt to write a file', function(done) { - var spy = sinon.spy(fs, 'createWriteStream'); - send_request(file, function(err, resp) { - resp.statusCode.should.eql(404); - spy.called.should.eql(false); - spy.restore(); - done(); - }) - }) - - it('doesnt actually write a file', function(done) { - send_request(file, function(err, resp) { - resp.statusCode.should.eql(404); - fs.existsSync(file).should.eql(false); - done(); - }) - }) - - }) - - describe('and a 200 response', function() { - - describe('for an empty response', function() { - - before(function() { - handler = function(req, res) { - res.writeHead(200, { 'Content-Type': 'text/plain' }); - res.end(); - } - }) - - it('uses a writableStream', function(done) { - var spy = sinon.spy(fs, 'createWriteStream'); - send_request(file, function(err, resp) { - resp.statusCode.should.eql(200); - spy.called.should.eql(true); - spy.restore(); - done(); - }) - }) - - it('writes a file', function(done) { - fs.existsSync(file).should.eql(false); - send_request(file, function(err, resp) { - fs.existsSync(file).should.eql(true); - done(); - }) - }) - - it('file is zero bytes in length', function(done) { - send_request(file, function(err, resp) { - fs.statSync(file).size.should.equal(0); - done(); - }) - }) - - if (process.platform != 'win32') { - it('closes the file descriptor', function(done) { - var open_descriptors = get_open_file_descriptors(); - send_request(file + Math.random(), function(err, resp) { - var current_descriptors = get_open_file_descriptors(); - open_descriptors.should.eql(current_descriptors); - done() - }) - }) - } - - }) - - describe('for a JSON response', function() { - - before(function() { - handler = function(req, res) { - res.writeHead(200, { 'Content-Type': 'application/javascript' }); - res.end(JSON.stringify({foo: 'bar'})); - } - }) - - it('uses a writableStream', function(done) { - var spy = sinon.spy(fs, 'createWriteStream'); - send_request(file, function(err, resp) { - resp.statusCode.should.eql(200); - spy.called.should.eql(true); - spy.restore(); - done(); - }) - }) - - it('writes a file', function(done) { - fs.existsSync(file).should.eql(false); - send_request(file, function(err, resp) { - fs.existsSync(file).should.eql(true); - done(); - }) - }) - - it('file size equals response length', function(done) { - send_request(file, function(err, resp) { - fs.statSync(file).size.should.equal(resp.bytes); - done(); - }) - }) - - it('response pipeline is honoured (JSON is decoded by default)', function(done) { - send_request_stream(file, function(err, resp) { - // we need to wait a bit since writing to config.output - // happens independently of needle's callback logic. - setTimeout(function() { - fs.readFileSync(file).toString().should.eql('{\"foo\":\"bar\"}'); - done(); - }, 20); - }) - }) - - it('closes the file descriptor', function(done) { - var open_descriptors = get_open_file_descriptors(); - send_request(file + Math.random(), function(err, resp) { - var current_descriptors = get_open_file_descriptors(); - open_descriptors.should.eql(current_descriptors); - done() - }) - }) - - }) - - describe('for a binary file', function() { - - var pixel = Buffer.from("base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs", "base64"); - - before(function() { - handler = function(req, res) { - res.writeHead(200, { 'Content-Type': 'application/octet-stream', 'Transfer-Encoding': 'chunked' }); - res.write(pixel.slice(0, 10)); - res.write(pixel.slice(10, 20)); - res.write(pixel.slice(20, 30)); - res.write(pixel.slice(30)); - res.end(); - } - }) - - it('uses a writableStream', function(done) { - var spy = sinon.spy(fs, 'createWriteStream'); - send_request(file, function(err, resp) { - resp.statusCode.should.eql(200); - spy.called.should.eql(true); - spy.restore(); - done(); - }) - }) - - it('writes a file', function(done) { - fs.existsSync(file).should.eql(false); - send_request(file, function(err, resp) { - fs.existsSync(file).should.eql(true); - done(); - }) - }) - - it('file size equals response length', function(done) { - send_request(file, function(err, resp) { - fs.statSync(file).size.should.equal(resp.bytes); - done(); - }) - }) - - it('file is equal to original buffer', function(done) { - send_request(file, function(err, resp) { - // we need to wait a bit since writing to config.output - // happens independently of needle's callback logic. - setTimeout(function() { - fs.readFileSync(file).should.eql(pixel); - done(); - }, 20); - }) - }) - - it('returns the data in resp.body too', function(done) { - send_request(file, function(err, resp) { - resp.body.should.eql(pixel); - done(); - }) - }) - - if (process.platform != 'win32') { - it('closes the file descriptor', function(done) { - var open_descriptors = get_open_file_descriptors(); - send_request(file + Math.random(), function(err, resp) { - var current_descriptors = get_open_file_descriptors(); - open_descriptors.should.eql(current_descriptors); - done() - }) - }) - } - - }) - - }) - -}) diff --git a/node_modules/needle/test/parsing_spec.js b/node_modules/needle/test/parsing_spec.js deleted file mode 100644 index 1e117dc..0000000 --- a/node_modules/needle/test/parsing_spec.js +++ /dev/null @@ -1,494 +0,0 @@ -var should = require('should'), - needle = require('./../'), - http = require('http'), - port = 11111, - server; - -describe('parsing', function(){ - - describe('when response is an JSON string', function(){ - - var json_string = '{"foo":"bar"}'; - - before(function(done){ - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/json'); - res.end(json_string); - }).listen(port, done); - }); - - after(function(done){ - server.close(done); - }) - - describe('and parse option is not passed', function() { - - describe('with default parse_response', function() { - - before(function() { - needle.defaults().parse_response.should.eql('all') - }) - - it('should return object', function(done){ - needle.get('localhost:' + port, function(err, response, body){ - should.ifError(err); - body.should.have.property('foo', 'bar'); - done(); - }) - }) - - }) - - describe('and default parse_response is set to false', function() { - - it('does NOT return object when disabled using .defaults', function(done){ - needle.defaults({ parse_response: false }) - - needle.get('localhost:' + port, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(Buffer) - body.toString().should.eql('{"foo":"bar"}'); - - needle.defaults({ parse_response: 'all' }); - done(); - }) - }) - - - }) - - }) - - describe('and parse option is true', function() { - - describe('and JSON is valid', function() { - - it('should return object', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, response, body){ - should.not.exist(err); - body.should.have.property('foo', 'bar') - done(); - }) - }) - - it('should have a .parser = json property', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, resp) { - should.not.exist(err); - resp.parser.should.eql('json'); - done(); - }) - }) - - }); - - describe('and response is empty', function() { - - var old_json_string; - - before(function() { - old_json_string = json_string; - json_string = ""; - }); - - after(function() { - json_string = old_json_string; - }); - - it('should return an empty string', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, resp) { - should.not.exist(err); - resp.body.should.equal(''); - done(); - }) - }) - - }) - - describe('and JSON is invalid', function() { - - var old_json_string; - - before(function() { - old_json_string = json_string; - json_string = "this is not going to work"; - }); - - after(function() { - json_string = old_json_string; - }); - - it('does not throw', function(done) { - (function(){ - needle.get('localhost:' + port, { parse: true }, done); - }).should.not.throw(); - }); - - it('does NOT return object', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, response, body) { - should.not.exist(err); - body.should.be.a.String; - body.toString().should.eql('this is not going to work'); - done(); - }) - }) - - }); - - }) - - describe('and parse option is false', function() { - - it('does NOT return object', function(done){ - needle.get('localhost:' + port, { parse: false }, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(Buffer) - body.toString().should.eql('{"foo":"bar"}'); - done(); - }) - }) - - it('should NOT have a .parser = json property', function(done) { - needle.get('localhost:' + port, { parse: false }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser); - done(); - }) - }) - - }) - - describe('and parse option is "xml"', function() { - - it('does NOT return object', function(done){ - needle.get('localhost:' + port, { parse: 'xml' }, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(Buffer) - body.toString().should.eql('{"foo":"bar"}'); - done(); - }) - }) - - it('should NOT have a .parser = json property', function(done) { - needle.get('localhost:' + port, { parse: 'xml' }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser); - done(); - }) - }) - - }) - - }); - - describe('when response is JSON \'false\'', function(){ - - var json_string = 'false'; - - before(function(done){ - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/json'); - res.end(json_string); - }).listen(port, done); - }); - - after(function(done){ - server.close(done); - }) - - describe('and parse option is not passed', function() { - - it('should return object', function(done){ - needle.get('localhost:' + port, function(err, response, body){ - should.ifError(err); - body.should.equal(false); - done(); - }) - }) - - }) - - describe('and parse option is true', function() { - - describe('and JSON is valid', function() { - - it('should return object', function(done){ - needle.get('localhost:' + port, { parse: true }, function(err, response, body){ - should.not.exist(err); - body.should.equal(false) - done(); - }) - }) - - }); - - describe('and response is empty', function() { - - var old_json_string; - - before(function() { - old_json_string = json_string; - json_string = ""; - }); - - after(function() { - json_string = old_json_string; - }); - - it('should return an empty string', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, resp) { - should.not.exist(err); - resp.body.should.equal(''); - done(); - }) - }) - - }) - - describe('and JSON is invalid', function() { - - var old_json_string; - - before(function() { - old_json_string = json_string; - json_string = "this is not going to work"; - }); - - after(function() { - json_string = old_json_string; - }); - - it('does not throw', function(done) { - (function(){ - needle.get('localhost:' + port, { parse: true }, done); - }).should.not.throw(); - }); - - it('does NOT return object', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, response, body) { - should.not.exist(err); - body.should.be.a.String; - body.toString().should.eql('this is not going to work'); - done(); - }) - }) - - }); - - }) - - describe('and parse option is false', function() { - - it('does NOT return object', function(done){ - needle.get('localhost:' + port, { parse: false }, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(Buffer) - body.toString().should.eql('false'); - done(); - }) - }) - - }) - - describe('and parse option is "xml"', function() { - - it('does NOT return object', function(done){ - needle.get('localhost:' + port, { parse: 'xml' }, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(Buffer) - body.toString().should.eql('false'); - done(); - }) - }) - - }) - - - }); - - describe('when response is an invalid XML string', function(){ - - before(function(done){ - server = http.createServer(function(req, res) { - res.writeHeader(200, {'Content-Type': 'application/xml'}) - res.end("") - }).listen(port, done); - }); - - after(function(done){ - server.close(done); - }) - - describe('and parse_response is true', function(){ - - it('should return original string', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) { - should.not.exist(err); - body.should.eql('') - should.not.exist(body.name); - done(); - }) - }) - - it('should not have a .parser = xml property', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser); - done(); - }) - }) - - }) - - describe('and parse response is false', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){ - should.not.exist(err); - body.toString().should.eql('') - done(); - }) - }) - - it('should not have a .parser property', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser) - done(); - }) - }) - - }) - - }) - - describe('when response is a valid XML string', function(){ - - before(function(done) { - server = http.createServer(function(req, res) { - res.writeHeader(200, {'Content-Type': 'application/xml'}) - res.end("

hello

") - }).listen(port, done); - }); - - after(function(done) { - server.close(done); - }) - - describe('and parse_response is true', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) { - should.not.exist(err); - body.name.should.eql('post') - body.children[0].name.should.eql('p') - body.children[0].value.should.eql('hello') - - body.children[1].name.should.eql('p') - body.children[1].value.should.eql('world') - done(); - }) - }) - - it('should have a .parser = xml property', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, resp) { - should.not.exist(err); - resp.parser.should.eql('xml'); - done(); - }) - }) - - }) - - describe('and parse response is false', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){ - should.not.exist(err); - body.toString().should.eql('

hello

') - done(); - }) - }) - - it('should not have a .parser property', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser) - done(); - }) - }) - - }) - - }) - - - describe('valid XML, using xml2js', function() { - - var parsers, origParser; - - before(function(done) { - var xml2js = require('xml2js') - parsers = require('../lib/parsers'); - origParser = parsers['application/xml']; - - var customParser = require('xml2js').parseString; - parsers.use('xml2js', ['application/xml'], function(buff, cb) { - var opts = { explicitRoot: true, explicitArray: false }; - customParser(buff, opts, cb); - }) - - server = http.createServer(function(req, res) { - res.writeHeader(200, {'Content-Type': 'application/xml'}) - res.end("

hello

world

") - }).listen(port, done); - }); - - after(function(done) { - parsers['application/xml'] = origParser; - server.close(done); - }) - - describe('and parse_response is true', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) { - should.not.exist(err); - body.should.eql({ post: { p: ['hello', 'world' ]}}) - done(); - }) - }) - - it('should have a .parser = xml property', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, resp) { - should.not.exist(err); - resp.parser.should.eql('xml2js'); - done(); - }) - }) - - }) - - describe('and parse response is false', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){ - should.not.exist(err); - body.toString().should.eql('

hello

world

') - done(); - }) - }) - - it('should not have a .parser property', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser) - done(); - }) - }) - - }) - - }) - - -}) diff --git a/node_modules/needle/test/post_data_spec.js b/node_modules/needle/test/post_data_spec.js deleted file mode 100644 index d9a28c6..0000000 --- a/node_modules/needle/test/post_data_spec.js +++ /dev/null @@ -1,1021 +0,0 @@ -var needle = require('..'), - http = require('http'), - should = require('should'), - sinon = require('sinon'), - stream = require('stream'), - helpers = require('./helpers'); - -var multiparts = ['----------------------NODENEEDLEHTTPCLIENT']; -multiparts.push(['Content-Disposition: form-data; name=\"foo\"']) -multiparts.push(['\r\nbar\r\n----------------------NODENEEDLEHTTPCLIENT--']) -// multiparts.push(['Content-Disposition: form-data; name=\"test\"']) -// multiparts.push(['\r\næµè¯\r\n----------------------NODENEEDLEHTTPCLIENT--']) -// multiparts.push(['\r\n' + Buffer.from('测试').toString() + '\r\n----------------------NODENEEDLEHTTPCLIENT--']) - - -describe('post data (e.g. request body)', function() { - - var stub, spy, server; - - before(function(done) { - server = helpers.server({ port: 4321 }, done); - }) - - after(function(done) { - server.close(done); - }) - - afterEach(function() { - if (stub) stub.restore(); - if (spy) spy.restore(); - }) - - function get(data, opts, cb) { - return needle.request('get', 'http://localhost:' + 4321, data, opts, cb) - } - - function post(data, opts, cb) { - return needle.request('post', 'http://localhost:' + 4321, data, opts, cb) - } - - function spystub_request() { - var http_req = http.request; - stub = sinon.stub(http, 'request', function(opts, cb) { - var req = http_req(opts, cb); - spy = sinon.spy(req, 'write'); - return req; - }) - } - - function check_request(method) { - stub.calledOnce.should.be.true; - stub.args[0][0]['headers']['host'].should.equal('localhost:4321'); - stub.args[0][0]['method'].should.equal(method); - } - - describe('with multipart: true', function() { - - describe('when null', function() { - - it('sends request (non multipart)', function(done) { - spystub_request(); - - post(null, { multipart: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('doesnt set Content-Type header', function(done) { - post(null, { multipart: true }, function(err, resp) { - should.not.exist(resp.body.headers['content-type']); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post(null, { multipart: true }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - spystub_request(); - - post(null, { multipart: true }, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - describe('when string', function() { - - it('explodes', function() { - (function() { - post('foobar', { multipart: true }) - }).should.throw() - }) - - }) - - describe('when object', function() { - - describe('get request', function() { - - it('sends request', function(done) { - spystub_request(); - - get({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - check_request('get'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('multipart/form-data; boundary=--------------------NODENEEDLEHTTPCLIENT'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes string as buffer', function(done) { - spystub_request(); - - get({ foo: 'bar' }, { multipart: true }, function(err, resp) { - spy.called.should.be.true; - - spy.args[0][0].should.be.an.instanceof(String); - spy.args[0][0].toString().should.equal(multiparts.join('\r\n')); - resp.body.body.should.eql(multiparts.join('\r\n')); - done(); - }) - }) - - it('writes japanese chars correctly as binary', function(done) { - spystub_request(); - - get({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - spy.called.should.be.true; - - spy.args[0][0].should.be.an.instanceof(String); - Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d') - done(); - }) - }) - - - }) - - describe('post request', function() { - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('writes string as buffer', function(done) { - spystub_request(); - - post({ foo: 'bar' }, { multipart: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(String); - spy.args[0][0].toString().should.equal(multiparts.join('\r\n')); - resp.body.body.should.eql(multiparts.join('\r\n')); - done(); - }) - }) - - it('writes japanese chars correctly as binary', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(String); - Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d') - done(); - }) - }) - - }) - - }) - - describe('when stream', function() { - - var stream_for_multipart; - - before(function() { - stream_for_multipart = new stream.Readable(); - stream_for_multipart._read = function() { - this.push('foobar'); - this.push(null); - } - }) - - it('explodes', function() { - (function() { - post(stream_for_multipart, { multipart: true }) - }).should.throw() - }) - - }) - - }) - - describe('non multipart', function() { - - describe('when null', function() { - - describe('get request', function() { - - it('sends request', function(done) { - spystub_request(); - - get(null, {}, function(err, resp) { - check_request('get'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - spystub_request(); - - get(null, {}, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - describe('post request', function() { - - it('sends request', function(done) { - spystub_request(); - - post(null, {}, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - spystub_request(); - - post(null, {}, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - }) - - describe('when string with no equal sign', function() { - - describe('get request', function() { - - it('explodes', function() { - (function() { - get('foobar', {}) - }).should.throw() - }) - - }) - - describe('post request', function() { - - it('sends request', function(done) { - spystub_request(); - - post('foobar', {}, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('writes string as buffer', function(done) { - spystub_request(); - - post('foobar', {}, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foobar'); - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - }) - - describe('when string WITH equal sign', function() { - - describe('get request', function() { - - describe('with json: false (default)', function() { - - it('sends request, adding data as querystring', function(done) { - spystub_request(); - - get('foo=bar', { json: false }, function(err, resp) { - check_request('get'); - stub.args[0][0]['path'].should.equal('/?foo=bar') - done(); - }) - }) - - it('doesnt set Content-Type header', function(done) { - get('foo=bar', { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - should.not.exist(resp.body.headers['content-type']); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - get('foo=bar', { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - get('foo=bar', { json: false }, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request, without setting a querystring', function(done) { - spystub_request(); - - get('foo=bar', { json: true }, function(err, resp) { - check_request('get'); - stub.args[0][0]['path'].should.equal('/') - done(); - }) - }) - - it('sets Content-Type header', function(done) { - get('foo=bar', { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - get('foo=bar', { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes raw string (assuming it already is JSON, so no JSON.stringify)', function(done) { - get('foo=bar', { json: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].toString().should.eql('foo=bar') - resp.body.body.should.eql('foo=bar'); - done(); - }) - }) - - }) - - }) - - describe('post request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - post('foo=bar', { json: false }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to www-form-urlencoded', function(done) { - post('foo=bar', { json: false }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post('foo=bar', { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post('foo=bar', { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foo=bar'); - resp.body.body.should.eql('foo=bar'); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request', function(done) { - spystub_request(); - - post('foo=bar', { json: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post('foo=bar', { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - post('foo=bar', { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes raw string (assuming it already is JSON, so no JSON.stringify)', function(done) { - post('foo=bar', { json: true }, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify('foo=bar'); - spy.args[0][0].toString().should.eql('foo=bar') - resp.body.body.should.eql('foo=bar'); - done(); - }) - }) - - }) - - }) - - }) - - describe('when object', function() { - - describe('get request', function() { - - describe('with json: false (default)', function() { - - it('sends request, adding data as querystring', function(done) { - spystub_request(); - - get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - check_request('get'); - stub.args[0][0]['path'].should.equal('/?foo=bar&test=%E6%B5%8B%E8%AF%95') - done(); - }) - }) - - it('doesnt set Content-Type header', function(done) { - get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - should.not.exist(resp.body.headers['content-type']); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request, without setting a querystring', function(done) { - spystub_request(); - - get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - check_request('get'); - stub.args[0][0]['path'].should.equal('/') - done(); - }) - }) - - it('sets Content-Type header', function(done) { - get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes JSON.stringify version of object', function(done) { - get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify({ foo: 'bar', test: '测试' }) - spy.args[0][0].toString().should.eql(json) - resp.body.body.should.eql(json); - done(); - }) - }) - - }) - - }) - - describe('post request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to www-form-urlencoded', function(done) { - post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foo=bar&test=%E6%B5%8B%E8%AF%95'); - resp.body.body.should.eql('foo=bar&test=%E6%B5%8B%E8%AF%95'); - done(); - }) - }) - - }) - - describe('with json: false and content_type = "application/json"', function() { - - var opts = { json: false, content_type: 'application/json' }; - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to application/json', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].constructor.name.should.eql('Buffer'); - spy.args[0][0].toString().should.equal('foo=bar&test=%E6%B5%8B%E8%AF%95'); - resp.body.body.should.eql('foo=bar&test=%E6%B5%8B%E8%AF%95'); - done(); - }) - }) - - }) - - describe('with json: undefined but content-type = application/json', function() { - - var opts = { headers: { 'content-type': 'application/json' } }; - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('doesnt change Content-Type header', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json'); - done(); - }) - }) - - it('leaves default Accept header', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes JSON.stringified object', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify({ foo: 'bar', test: '测试' }) - spy.args[0][0].toString().should.eql(json) - resp.body.body.should.eql(json); - done(); - }) - }) - }) - - describe('with json: true', function() { - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes JSON.stringified object', function(done) { - post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify({ foo: 'bar', test: '测试' }) - spy.args[0][0].toString().should.eql(json) - resp.body.body.should.eql(json); - done(); - }) - }) - - }) - - - describe('with json: true and content_type: */* (passed, not default)', function() { - - var opts = { json: true, accept: '*/*' }; - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to application/json', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('respects Accept header set by user', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes JSON.stringified object', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify({ foo: 'bar', test: '测试' }) - spy.args[0][0].toString().should.eql(json) - resp.body.body.should.eql(json); - done(); - }) - }) - - }) - - }) - - }) - - describe('when buffer', function() { - - describe('get request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - get(Buffer.from('foobar'), { json: false }, function(err, resp) { - check_request('get'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - get(Buffer.from('foobar'), { json: false }, function(err, resp) { - // should.not.exist(resp.body.headers['content-type']); - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - get(Buffer.from('foobar'), { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - get(Buffer.from('foobar'), { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foobar'); - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request, without setting a querystring', function(done) { - spystub_request(); - - get(Buffer.from('foobar'), { json: true }, function(err, resp) { - check_request('get'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - get(Buffer.from('foobar'), { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - get(Buffer.from('foobar'), { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes JSON.stringify version of object', function(done) { - get(Buffer.from('foobar'), { json: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].toString().should.eql('foobar') - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - }) - - describe('post request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - post(Buffer.from('foobar'), { json: false }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to www-form-urlencoded', function(done) { - post(Buffer.from('foobar'), { json: false }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post(Buffer.from('foobar'), { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post(Buffer.from('foobar'), { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foobar'); - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request', function(done) { - spystub_request(); - - post(Buffer.from('foobar'), { json: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post(Buffer.from('foobar'), { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - post(Buffer.from('foobar'), { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('passes raw buffer (assuming its a JSON string beneath)', function(done) { - post(Buffer.from('foobar'), { json: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].toString().should.eql('foobar') - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - }) - - }) - - describe('when stream', function() { - - var input_stream; - - beforeEach(function() { - input_stream = new stream.Readable(); - input_stream._read = function() { - this.push('foobar'); - this.push(null); - } - }) - - describe('get request', function() { - - it('explodes', function() { - (function() { - get(input_stream, {}) - }).should.throw() - }) - - }); - - describe('post request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - post(input_stream, { json: false }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to www-form-urlencoded', function(done) { - post(input_stream, { json: false }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post(input_stream, { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post(input_stream, { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foobar'); - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request', function(done) { - spystub_request(); - - post(input_stream, { json: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post(input_stream, { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - post(input_stream, { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes JSON.stringified object', function(done) { - post(input_stream, { json: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].toString().should.eql('foobar') - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - }) - - }) - - }) - -}) diff --git a/node_modules/needle/test/proxy_spec.js b/node_modules/needle/test/proxy_spec.js deleted file mode 100644 index 9526e7f..0000000 --- a/node_modules/needle/test/proxy_spec.js +++ /dev/null @@ -1,202 +0,0 @@ -var helpers = require('./helpers'), - should = require('should'), - sinon = require('sinon'), - http = require('http'), - needle = require('./../'); - -var port = 7707; -var url = 'localhost:' + port; -var nonexisting_host = 'awepfokawepofawe.com'; - -describe('proxy option', function() { - - var spy, opts; - - function send_request(opts, done) { - if (spy) spy.restore(); - spy = sinon.spy(http, 'request'); - needle.get(url, opts, done); - } - - ////////////////////// - // proxy opts helpers - - function not_proxied(done) { - return function(err, resp) { - var path = spy.args[0][0].path; - path.should.eql('/'); // not the full original URI - spy.restore(); - done(); - } - } - - function proxied(host, port, done) { - return function(err, resp) { - var path = spy.args[0][0].path; - path.should.eql('http://' + url); // the full original URI - - var http_host = spy.args[0][0].host; - if (http_host) http_host.should.eql(host); - - var http_port = spy.args[0][0].port; - if (http_port) http_port.should.eql(port); - - spy.restore(); - done(); - } - } - - ////////////////////// - // auth helpers - - function get_auth(header) { - var token = header.split(/\s+/).pop(); - return token && Buffer.from(token, 'base64').toString().split(':'); - } - - function no_proxy_auth(done) { - return function(err, resp) { - var headers = spy.args[0][0].headers; - Object.keys(headers).should.not.containEql('proxy-authorization'); - done(); - } - } - - function header_set(name, user, pass, done) { - return function(err, resp) { - var headers = spy.args[0][0].headers; - var auth = get_auth(headers[name]); - auth[0].should.eql(user); - auth[1].should.eql(pass); - done(); - } - } - - function proxy_auth_set(user, pass, done) { - return header_set('proxy-authorization', user, pass, done); - } - - function basic_auth_set(user, pass, done) { - return header_set('authorization', user, pass, done); - } - - after(function() { - spy.restore(); - }) - - describe('when null proxy is passed', function() { - - it('does not proxy', function(done) { - send_request({ proxy: null }, not_proxied(done)) - }) - - describe('but defaults has been set', function() { - - before(function() { - needle.defaults({ proxy: 'foobar' }); - }) - - after(function() { - needle.defaults({ proxy: null }); - }) - - it('tries to proxy anyway', function(done) { - send_request({}, proxied('foobar', 80, done)) - }) - - }) - - }) - - describe('when weird string is passed', function() { - - it('tries to proxy anyway', function(done) { - send_request({ proxy: 'alfalfa' }, proxied('alfalfa', 80, done)) - }) - }) - - describe('when valid url is passed', function() { - - it('proxies request', function(done) { - send_request({ proxy: nonexisting_host + ':123/done' }, proxied(nonexisting_host, '123', done)) - }) - - it('does not set a Proxy-Authorization header', function(done) { - send_request({ proxy: nonexisting_host + ':123/done' }, no_proxy_auth(done)); - }) - - describe('and proxy url contains user:pass', function() { - - before(function() { - opts = { - proxy: 'http://mj:x@' + nonexisting_host + ':123/done' - } - }) - - it('proxies request', function(done) { - send_request(opts, proxied(nonexisting_host, '123', done)) - }) - - it('sets Proxy-Authorization header', function(done) { - send_request(opts, proxy_auth_set('mj', 'x', done)); - }) - - }) - - describe('and a proxy_user is passed', function() { - - before(function() { - opts = { - proxy: nonexisting_host + ':123', - proxy_user: 'someone', - proxy_pass: 'else' - } - }) - - it('proxies request', function(done) { - send_request(opts, proxied(nonexisting_host, '123', done)) - }) - - it('sets Proxy-Authorization header', function(done) { - send_request(opts, proxy_auth_set('someone', 'else', done)); - }) - - describe('and url also contains user:pass', function() { - - it('url user:pass wins', function(done) { - var opts = { - proxy: 'http://xxx:yyy@' + nonexisting_host + ':123', - proxy_user: 'someone', - proxy_pass: 'else' - } - - send_request(opts, proxy_auth_set('xxx', 'yyy', done)); - }) - - }) - - describe('and options.username is also present', function() { - - before(function() { - opts = { proxy_user: 'foobar', username: 'someone' }; - }) - - it('a separate Authorization header is set', function(done) { - var opts = { - proxy: nonexisting_host + ':123', - proxy_user: 'someone', - proxy_pass: 'else', - username: 'test', - password: 'X' - } - - send_request(opts, basic_auth_set('test', 'X', done)); - }) - - }) - - }) - - }) - -}) diff --git a/node_modules/needle/test/querystring_spec.js b/node_modules/needle/test/querystring_spec.js deleted file mode 100644 index 34c1748..0000000 --- a/node_modules/needle/test/querystring_spec.js +++ /dev/null @@ -1,128 +0,0 @@ -var should = require('should'), - stringify = require('../lib/querystring').build; - -describe('stringify', function() { - - describe('with null', function() { - - it('throws', function() { - (function() { - var res = stringify(null); - }).should.throw(); - }) - - }) - - describe('with a number', function() { - - it('throws', function() { - (function() { - var res = stringify(100); - }).should.throw(); - }) - - }) - - describe('with a string', function() { - - describe('that is empty', function() { - - it('throws', function() { - (function() { - var res = stringify(''); - }).should.throw(); - }) - - }) - - describe('that doesnt contain an equal sign', function() { - - it('throws', function() { - (function() { - var res = stringify('boomshagalaga'); - }).should.throw(); - }) - - }) - - describe('that contains an equal sign', function() { - - it('works', function() { - var res = stringify('hello=123'); - res.should.eql('hello=123'); - }) - - }) - - }) - - describe('with an array', function() { - - describe('with key val objects', function() { - - it('works', function() { - var res = stringify([ {foo: 'bar'} ]); - res.should.eql('foo=bar'); - }) - - }) - - describe('where all elements are strings with an equal sign', function() { - - it('works', function() { - var res = stringify([ 'bar=123', 'quux=' ]); - res.should.eql('bar=123&quux='); - }) - - }) - - describe('with random words', function() { - - it('throws', function() { - (function() { - var res = stringify(['hello', 'there']); - }).should.throw(); - }) - - }) - - describe('with integers', function() { - - it('throws', function() { - (function() { - var res = stringify([123, 432]); - }).should.throw(); - }) - - }) - - }) - - describe('with an object', function() { - - it('works', function() { - var res = stringify({ test: 100 }); - res.should.eql('test=100'); - }) - - describe('with object where val is an array', function() { - - it('works', function() { - var res = stringify({ foo: ['bar', 'baz'] }); - res.should.eql('foo[]=bar&foo[]=baz'); - }) - - }) - - describe('with object where val is an array of key val objects', function() { - - it('works', function() { - var res = stringify({ foo: [{'1': 'bar'}, {'2': 'baz'}] }); - res.should.eql('foo[][1]=bar&foo[][2]=baz'); - }) - - }) - - }) - -}) diff --git a/node_modules/needle/test/redirect_spec.js b/node_modules/needle/test/redirect_spec.js deleted file mode 100644 index c3942e2..0000000 --- a/node_modules/needle/test/redirect_spec.js +++ /dev/null @@ -1,394 +0,0 @@ -var helpers = require('./helpers'), - should = require('should'), - sinon = require('sinon'), - needle = require('./../'); - -var ports = { - http : 8888, - https : 9999 -} - -var protocols = { - http : require('http'), - https : require('https') -} - -var code = 301; -var location; // var to set the response location - -function response_code() { - return code; -} - -function response_headers() { - return { 'Content-Type': 'text/plain', 'Location': location } -} - -describe('redirects', function() { - - var spies = {}, - servers = {}; - - var current_protocol; - var hostname = require('os').hostname(); - - // open two servers, one that responds to a redirect - before(function(done) { - - var conf = { - port : ports.http, - code : response_code, - headers : response_headers - } - - servers.http = helpers.server(conf, function() { - conf.port = ports.https; - conf.protocol = 'https'; - servers.https = helpers.server(conf, done); - }); - }) - - after(function(done) { - servers.http.close(function() { - servers.https.close(done); - }); - }) - - var prots = {'http': 'https'}; - Object.keys(prots).forEach(function(protocol) { - - current_protocol = protocol; - var other_protocol = protocol == 'http' ? 'https' : 'http'; - - var opts, // each test will modify this - host = '127.0.0.1', - url = protocol + '://' + host + ':' + ports[protocol] + '/hello'; - - function send_request(opts, cb) { - opts.rejectUnauthorized = false; - // console.log(' -- sending request ' + url + ' -- redirect to ' + location); - needle.post(url, { foo: 'bar' }, opts, cb); - } - - function not_followed(done) { - send_request(opts, function(err, resp) { - resp.statusCode.should.eql(301); - if (current_protocol == 'http') { - spies.http.callCount.should.eql(1); // only original request - spies.https.callCount.should.eql(0); - } else { - spies.http.callCount.should.eql(0); - spies.https.callCount.should.eql(1); // only original request - } - done(); - }) - } - - function followed_same_protocol(done) { - send_request(opts, function(err, resp) { - // the original request plus the redirect one - spies[current_protocol].callCount.should.eql(2); - done(); - }) - - } - - function followed_other_protocol(done) { - send_request(opts, function(err, resp) { - // on new-ish node versions, https.request calls http.request internally, - // so we need to amount for that additional call. - // update: this doesn't happen on node > 10.x - - var node_major_ver = process.version.split('.')[0].replace('v', ''); - var http_calls = protocols.http.Agent.defaultMaxSockets == Infinity && parseInt(node_major_ver) < 10 ? 2 : 1; - - spies.http.callCount.should.eql(http_calls); // the one(s) from http.request - spies.https.callCount.should.eql(1); // the one from https.request (redirect) - done(); - }) - } - - // set a spy on [protocol].request - // so we can see how many times a request was made - before(function() { - spies.http = sinon.spy(protocols.http, 'request'); - spies.https = sinon.spy(protocols.https, 'request'); - }) - - // and make sure it is restored after each test - afterEach(function() { - spies.http.reset(); - spies.https.reset(); - }) - - after(function() { - spies.http.restore(); - spies.https.restore(); - }) - - describe('when overriding defaults', function() { - - before(function() { - needle.defaults({ follow_max: 10 }); - opts = {}; - }) - - after(function() { - // reset values to previous - needle.defaults({ follow_max: 0 }); - }) - - describe('and redirected to the same path on same host and protocol', function() { - before(function() { - location = url; - }) - it('does not follow redirect', not_followed); - }) - - describe('and redirected to the same path on same host and different protocol', function() { - before(function() { - location = url.replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - - it('follows redirect', followed_other_protocol); - }) - - describe('and redirected to a different path on same host, same protocol', function() { - before(function() { - location = url.replace('/hello', '/goodbye'); - }) - it('follows redirect', followed_same_protocol); - }) - - describe('and redirected to a different path on same host, different protocol', function() { - before(function() { - location = url.replace('/hello', '/goodbye').replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - it('follows redirect', followed_other_protocol); - }) - - describe('and redirected to same path on another host, same protocol', function() { - before(function() { - location = url.replace(host, hostname); - }) - it('follows redirect', followed_same_protocol); - }) - - describe('and redirected to same path on another host, different protocol', function() { - before(function() { - location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - it('follows redirect', followed_other_protocol); - }) - - }) - - // false and null have the same result - var values = [false, null]; - values.forEach(function(value) { - - describe('when follow is ' + value, function() { - - before(function() { - opts = { follow: value }; - }) - - - - describe('and redirected to the same path on same host and protocol', function() { - before(function() { - location = url; - }) - - it('throws an error', function() { - (function() { - send_request(opts, function() { }); - }).should.throw; - }) - - }) - - }) - - }) - - describe('when follow is true', function() { - - before(function() { - opts = { follow: true }; - }) - - describe('and redirected to the same path on same host and protocol', function() { - before(function() { location = url }) - - it('throws an error', function() { - (function() { - send_request(opts, function() { }); - }).should.throw; - }) - - }) - - }) - - describe('when follow is > 0', function() { - - before(function() { - needle.defaults({ follow: 10 }); - }) - - after(function() { - needle.defaults({ follow: 0 }); - }) - - describe('when keep_method is false', function() { - - before(function() { - opts = { follow_keep_method: false }; - }) - - // defaults to follow host and protocol - describe('and redirected to the same path on same host and different protocol', function() { - - before(function() { - location = url.replace(protocol, other_protocol); - }) - - it('follows redirect', followed_other_protocol); - - it('sends a GET request with no data', function(done) { - send_request(opts, function(err, resp) { - spies.http.args[0][0].method.should.eql('GET'); - // spy.args[0][3].should.eql(null); - done(); - }) - }) - - }) - - }) - - describe('and set_referer is true', function() { - - before(function() { - opts = { follow_set_referer: true }; - }) - - // defaults to follow host and protocol - describe('and redirected to the same path on same host and different protocol', function() { - - before(function() { - location = url.replace(protocol, other_protocol); - }) - - it('follows redirect', followed_other_protocol); - - it('sets Referer header when following redirect', function(done) { - send_request(opts, function(err, resp) { - spies.http.args[0][0].headers['referer'].should.eql("http://" + host + ":8888/hello"); - // spies.http.args[0][3].should.eql({ foo: 'bar'}); - done(); - }) - }) - - }) - - }) - - describe('and keep_method is true', function() { - - before(function() { - opts = { follow_keep_method: true }; - }) - - // defaults to follow host and protocol - describe('and redirected to the same path on same host and different protocol', function() { - - before(function() { - location = url.replace(protocol, other_protocol); - }) - - it('follows redirect', followed_other_protocol); - - it('sends a POST request with the original data', function(done) { - send_request(opts, function(err, resp) { - spies.http.args[0][0].method.should.eql('post'); - // spies.http.args[0][3].should.eql({ foo: 'bar'}); - done(); - }) - }) - - }) - - }) - - describe('and if_same_host is false', function() { - - before(function() { - opts = { follow_if_same_host: false }; - }) - - // by default it will follow other protocols - describe('and redirected to same path on another domain, same protocol', function() { - before(function() { - location = url.replace(host, hostname); - }) - it('follows redirect', followed_same_protocol); - }) - - }) - - describe('and if_same_host is true', function() { - - before(function() { - opts = { follow_if_same_host: true }; - }) - - // by default it will follow other protocols - describe('and redirected to same path on another domain, same protocol', function() { - before(function() { - location = url.replace(host, hostname); - }) - - it('does not follow redirect', not_followed); - }) - - }) - - describe('and if_same_protocol is false', function() { - - before(function() { - opts = { follow_if_same_protocol: false }; - }) - - // by default it will follow other hosts - describe('and redirected to same path on another domain, different protocol', function() { - before(function() { - location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - it('follows redirect', followed_other_protocol); - }) - - }) - - describe('and if_same_protocol is true', function() { - - before(function() { - opts = { follow_if_same_protocol: true }; - }) - - // by default it will follow other hosts - describe('and redirected to same path on another domain, different protocol', function() { - before(function() { - location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - it('does not follow redirect', not_followed); - }) - - }) - - }) - - }) - -}); diff --git a/node_modules/needle/test/redirect_with_timeout.js b/node_modules/needle/test/redirect_with_timeout.js deleted file mode 100644 index 7e8e02e..0000000 --- a/node_modules/needle/test/redirect_with_timeout.js +++ /dev/null @@ -1,45 +0,0 @@ -var should = require('should') -var needle = require('./../') - -describe('follow redirects when read_timeout is set', function () { - - it('clear timeout before following redirect', function (done) { - var opts = { - open_timeout: 1000, - read_timeout: 3000, - follow: 5, - user_agent: 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36' - } - - var timedOut = 0 - var redirects = 0 - - var timer = setTimeout(function () { - var hasRedirects = redirects > 0 - hasRedirects.should.equal(true) - done() - }, opts.read_timeout || 3000) - - var resp = needle.get('http://google.com/', opts, function (err, resp, body) { - var noErr = err === null - var hasBody = body.length > 0 - noErr.should.equal(true); - hasBody.should.equal(true); - }); - - resp.on('redirect', function (location) { - redirects++ - // console.info(' Redirected to ', location) - }) - - resp.on('timeout', function (type) { - timedOut++ - timedOut.should.equal(0) - // console.error(' ', type, 'timeout') - clearTimeout(timer) - done() - }) - - }).timeout(30000) - -}) \ No newline at end of file diff --git a/node_modules/needle/test/request_stream_spec.js b/node_modules/needle/test/request_stream_spec.js deleted file mode 100644 index bfd2d50..0000000 --- a/node_modules/needle/test/request_stream_spec.js +++ /dev/null @@ -1,236 +0,0 @@ -var fs = require('fs'), - needle = require('..'), - stream = require('stream'), - http = require('http'), - should = require('should'), - sinon = require('sinon'); - -var port = 2233; - -var node_major_ver = parseInt(process.version.split('.')[0].replace('v', '')); - -describe('request stream length', function() { - - var server, writable; - - function createServer() { - return http.createServer(function(req, res) { - - req.on('data', function(chunk) { - // console.log(chunk.length); - }) - - req.on('end', function() { - res.writeHeader(200, { 'Content-Type': 'application/json'}) - res.end(JSON.stringify({ headers: req.headers })) - }) - - }) - } - - before(function(done) { - server = createServer(); - server.listen(port, done) - }) - - beforeEach(function() { - writable = new stream.Readable(); - writable._read = function() { - this.push('hello world'); - this.push(null); - } - }) - - after(function(done) { - server.close(done) - }) - - function send_request(opts, cb) { - needle.post('http://localhost:' + port, writable, opts, function(err, resp) { - cb(err, resp) - }) - } - - describe('no stream_length set', function() { - - it('doesnt set Content-Length header', function(done) { - send_request({}, function(err, resp) { - should.not.exist(resp.body.headers['content-length']); - done() - }) - }) - - if (node_major_ver >= 10) { - it('returns 400 if Transfer-Encoding is set to a blank string', function(done) { - send_request({ headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(400); - done() - }) - }) - } else { - it('doesnt work if Transfer-Encoding is set to a blank string', function(done) { - send_request({ headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - err.code.should.eql('ECONNRESET'); - done() - }) - }) - } - - it('works if Transfer-Encoding is not set', function(done) { - send_request({}, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - - }) - - describe('stream_length set to invalid value', function() { - - if (node_major_ver >= 10) { - - it('returns 400 if Transfer-Encoding is set to a blank string', function(done) { - send_request({ stream_length: 5, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(400); - done() - }) - }) - - it('returns 400 if Transfer-Encoding is not set', function(done) { - send_request({ stream_length: 5 }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(400); - done() - }) - }) - - } else { - - it('doesnt work if Transfer-Encoding is set to a blank string', function(done) { - send_request({ stream_length: 5, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - err.code.should.eql('ECONNRESET'); - done() - }) - }) - it('doesnt work if Transfer-Encoding is not set', function(done) { - send_request({ stream_length: 5 }, function(err, resp) { - err.code.should.eql('ECONNRESET'); - done() - }) - }) - - } - - }) - - describe('stream_length is set to valid value', function() { - - it('sets Content-Length header to that value', function(done) { - send_request({ stream_length: 11 }, function(err, resp) { - resp.body.headers['content-length'].should.eql('11'); - done() - }) - }) - - it('works if Transfer-Encoding is set to a blank string', function(done) { - send_request({ stream_length: 11, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - - it('works if Transfer-Encoding is not set', function(done) { - send_request({ stream_length: 11 }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - - }) - - - describe('stream_length set to 0', function() { - - describe('stream with path', function() { - - var stub; - - beforeEach(function() { - writable.path = '/foo/bar'; - stub = sinon.stub(fs, 'stat', function(path, cb) { - cb(null, { size: 11 }) - }) - }) - - afterEach(function() { - stub.restore(); - }) - - it('sets Content-Length header to streams length', function(done) { - send_request({ stream_length: 0 }, function(err, resp) { - resp.body.headers['content-length'].should.eql('11'); - done() - }) - }) - - it('works if Transfer-Encoding is set to a blank string', function(done) { - send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - - it('works if Transfer-Encoding is not set', function(done) { - send_request({ stream_length: 0 }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - - }) - - describe('stream without path', function() { - - it('does not set Content-Length header', function(done) { - send_request({ stream_length: 0 }, function(err, resp) { - should.not.exist(resp.body.headers['content-length']); - done() - }) - }) - - if (node_major_ver >= 10) { - it('returns 400 if Transfer-Encoding is set to a blank string', function(done) { - send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(400); - done() - }) - }) - } else { - it('throws ECONNRESET if Transfer-Encoding is set to a blank string', function(done) { - send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - err.code.should.eql('ECONNRESET'); - done() - }) - }) - } - - it('works if Transfer-Encoding is not set', function(done) { - send_request({ stream_length: 0 }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - }) - - }) - -}) diff --git a/node_modules/needle/test/response_stream_spec.js b/node_modules/needle/test/response_stream_spec.js deleted file mode 100644 index a0ccef8..0000000 --- a/node_modules/needle/test/response_stream_spec.js +++ /dev/null @@ -1,138 +0,0 @@ -var should = require('should'), - needle = require('./../'), - http = require('http'), - stream = require('stream'), - fs = require('fs'), - port = 11111, - server; - -describe('response streams', function() { - - describe('when the server sends back json', function(){ - - before(function(done) { - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/json') - res.end('{"foo":"bar"}') - }).listen(port, done); - }); - - after(function(done) { - server.close(done); - }) - - describe('and the client uses streams', function(){ - - it('creates a proper streams2 stream', function(done) { - var stream = needle.get('localhost:' + port) - - // newer node versions set this to null instead of false - var bool = !!stream._readableState.flowing; - should.equal(false, bool); - - var readableCalled = false; - stream.on('readable', function() { - readableCalled = true; - }) - - stream.on('finish', function() { - readableCalled.should.be.true; - done(); - }); - - stream.resume(); - }) - - it('emits a single data item which is our JSON object', function(done) { - var stream = needle.get('localhost:' + port) - - var chunks = []; - stream.on('readable', function () { - while (chunk = this.read()) { - chunk.should.be.an.Object; - chunks.push(chunk); - } - }) - - stream.on('done', function () { - chunks.should.have.length(1) - chunks[0].should.have.property('foo', 'bar'); - done(); - }); - }) - - it('emits a raw buffer if we do not want to parse JSON', function(done) { - var stream = needle.get('localhost:' + port, { parse: false }) - - var chunks = []; - stream.on('readable', function () { - while (chunk = this.read()) { - Buffer.isBuffer(chunk).should.be.true; - chunks.push(chunk); - } - }) - - stream.on('done', function() { - var body = Buffer.concat(chunks).toString(); - body.should.equal('{"foo":"bar"}') - done(); - }); - }) - - }) - }) - - describe('when the server sends back what was posted to it', function () { - var file = 'asdf.txt'; - - before(function(done){ - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/octet') - req.pipe(res); - }).listen(port); - - fs.writeFile(file, 'contents of stream', done); - }); - - after(function(done){ - server.close(); - fs.unlink(file, done); - }) - - it('can PUT a stream', function (done) { - var stream = needle.put('localhost:' + port, fs.createReadStream(file), { stream: true }); - - var chunks = []; - stream.on('readable', function () { - while (chunk = this.read()) { - Buffer.isBuffer(chunk).should.be.true; - chunks.push(chunk); - } - }) - - stream.on('end', function () { - var body = Buffer.concat(chunks).toString(); - body.should.equal('contents of stream') - done(); - }); - }); - - it('can PATCH a stream', function (done) { - var stream = needle.patch('localhost:' + port, fs.createReadStream(file), { stream: true }); - - var chunks = []; - stream.on('readable', function () { - while (chunk = this.read()) { - Buffer.isBuffer(chunk).should.be.true; - chunks.push(chunk); - } - }) - - stream.on('end', function () { - var body = Buffer.concat(chunks).toString(); - body.should.equal('contents of stream') - done(); - }); - }); - }) -}) diff --git a/node_modules/needle/test/socket_pool_spec.js b/node_modules/needle/test/socket_pool_spec.js deleted file mode 100644 index 75080bd..0000000 --- a/node_modules/needle/test/socket_pool_spec.js +++ /dev/null @@ -1,67 +0,0 @@ -var needle = require('../'), - should = require('should'), - http = require('http'); - -var server, port = 11112; - -describe('socket reuse', function() { - - var httpAgent = new http.Agent({ - keepAlive : true, - maxSockets : 1 - }); - - before(function(done) { - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/json'); - setTimeout(function() { - res.end('{"foo":"bar"}'); - }, 50); - }).listen(port, done); - }); - - after(function(done) { - httpAgent.destroy(); - server.close(done); - }); - - describe('when sockets are reused', function() { - - it('does not duplicate listeners on .end', function(done) { - - var last_error; - var count = 10; - - function completed(err) { - --count || done(last_error); - } - - function send() { - needle.get('localhost:' + port, { agent: httpAgent }, function(err, resp) { - if (err) - throw new Error("Unexpected error: " + err); - - // lets go through all sockets and inspect all socket objects - for (hostTarget in httpAgent.sockets) { - httpAgent.sockets[hostTarget].forEach(function(socket) { - // normally, there are 2 internal listeners and 1 needle sets up, - // but to be sure the test does not fail even if newer node versions - // introduce additional listeners, we use a higher limit. - try { - socket.listeners('end').length.should.be.below(5, "too many listeners on the socket object's end event"); - } catch (e) { - last_error = e; - } - }); - } - - completed(); - }); - } - - for (var i = 0; i < count; i++) { - send(); - } - }); - }); -}); diff --git a/node_modules/needle/test/uri_modifier_spec.js b/node_modules/needle/test/uri_modifier_spec.js deleted file mode 100644 index 1a12a36..0000000 --- a/node_modules/needle/test/uri_modifier_spec.js +++ /dev/null @@ -1,46 +0,0 @@ -var needle = require('../'), - sinon = require('sinon'), - should = require('should'), - http = require('http'), - helpers = require('./helpers'); - -var port = 3456; - -describe('uri_modifier config parameter function', function() { - - var server, uri; - - function send_request(mw, cb) { - needle.get(uri, { uri_modifier: mw }, cb); - } - - before(function(done){ - server = helpers.server({ port: port }, done); - }) - - after(function(done) { - server.close(done); - }) - - describe('modifies uri', function() { - - var path = '/foo/replace'; - - before(function() { - uri = 'localhost:' + port + path - }); - - it('should modify path', function(done) { - send_request(function(uri) { - return uri.replace('/replace', ''); - }, function(err, res) { - should.not.exist(err); - should(res.req.path).be.exactly('/foo'); - done(); - }); - - }); - - }) - -}) diff --git a/node_modules/needle/test/url_spec.js b/node_modules/needle/test/url_spec.js deleted file mode 100644 index 5154d58..0000000 --- a/node_modules/needle/test/url_spec.js +++ /dev/null @@ -1,155 +0,0 @@ -var needle = require('../'), - sinon = require('sinon'), - should = require('should'), - http = require('http'), - helpers = require('./helpers'); - -var port = 3456; - -describe('urls', function() { - - var server, url; - - function send_request(cb) { - return needle.get(url, cb); - } - - before(function(done){ - server = helpers.server({ port: port }, done); - }) - - after(function(done) { - server.close(done); - }) - - describe('null URL', function(){ - - it('throws', function(){ - (function() { - send_request() - }).should.throw(); - }) - - }) - - describe('invalid protocol', function(){ - - before(function() { - url = 'foo://google.com/what' - }) - - it('does not throw', function(done) { - (function() { - send_request(function(err) { - done(); - }) - }).should.not.throw() - }) - - it('returns an error', function(done) { - send_request(function(err) { - err.should.be.an.Error; - err.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/) - done(); - }) - }) - - }) - - describe('invalid host', function(){ - - before(function() { - url = 'http://s1\\\u0002.com/' - }) - - it('fails', function(done) { - (function() { - send_request(function(){ }) - }.should.throw(TypeError)) - done() - }) - - }) - -/* - describe('invalid path', function(){ - - before(function() { - url = 'http://www.google.com\\\/x\\\ %^&*() /x2.com/' - }) - - it('fails', function(done) { - send_request(function(err) { - err.should.be.an.Error; - done(); - }) - }) - - }) -*/ - - describe('valid protocol and path', function() { - - before(function() { - url = 'http://localhost:' + port + '/foo'; - }) - - it('works', function(done) { - send_request(function(err){ - should.not.exist(err); - done(); - }) - }) - - }) - - describe('no protocol but with slashes and valid path', function() { - - before(function() { - url = '//localhost:' + port + '/foo'; - }) - - it('works', function(done) { - send_request(function(err){ - should.not.exist(err); - done(); - }) - }) - - }) - - describe('no protocol nor slashes and valid path', function() { - - before(function() { - url = 'localhost:' + port + '/foo'; - }) - - it('works', function(done) { - send_request(function(err){ - should.not.exist(err); - done(); - }) - }) - - }) - - describe('double encoding', function() { - - var path = '/foo?email=' + encodeURIComponent('what-ever@Example.Com'); - - before(function() { - url = 'localhost:' + port + path - }); - - it('should not occur', function(done) { - send_request(function(err, res) { - should.not.exist(err); - should(res.req.path).be.exactly(path); - done(); - }); - - }); - - }) - -}) diff --git a/node_modules/needle/test/utils/formidable.js b/node_modules/needle/test/utils/formidable.js deleted file mode 100644 index ba1d983..0000000 --- a/node_modules/needle/test/utils/formidable.js +++ /dev/null @@ -1,17 +0,0 @@ -var formidable = require('formidable'), - http = require('http'), - util = require('util'); - -var port = process.argv[2] || 8888; - -http.createServer(function(req, res) { - var form = new formidable.IncomingForm(); - form.parse(req, function(err, fields, files) { - res.writeHead(200, {'content-type': 'text/plain'}); - res.write('received upload:\n\n'); - console.log(util.inspect({fields: fields, files: files})) - res.end(util.inspect({fields: fields, files: files})); - }); -}).listen(port); - -console.log('HTTP server listening on port ' + port); \ No newline at end of file diff --git a/node_modules/needle/test/utils/proxy.js b/node_modules/needle/test/utils/proxy.js deleted file mode 100644 index 531bf49..0000000 --- a/node_modules/needle/test/utils/proxy.js +++ /dev/null @@ -1,62 +0,0 @@ -var http = require('http'), - https = require('https'), - url = require('url'); - -var port = 1234, - log = true, - request_auth = false; - -http.createServer(function(request, response) { - - console.log(request.headers); - console.log("Got request: " + request.url); - console.log("Forwarding request to " + request.headers['host']); - - if (request_auth) { - if (!request.headers['proxy-authorization']) { - response.writeHead(407, {'Proxy-Authenticate': 'Basic realm="proxy.com"'}) - return response.end('Hello.'); - } - } - - var remote = url.parse(request.url); - var protocol = remote.protocol == 'https:' ? https : http; - - var opts = { - host: request.headers['host'], - port: remote.port || (remote.protocol == 'https:' ? 443 : 80), - method: request.method, - path: remote.pathname, - headers: request.headers - } - - var proxy_request = protocol.request(opts, function(proxy_response){ - - proxy_response.on('data', function(chunk) { - if (log) console.log(chunk.toString()); - response.write(chunk, 'binary'); - }); - proxy_response.on('end', function() { - response.end(); - }); - - response.writeHead(proxy_response.statusCode, proxy_response.headers); - }); - - request.on('data', function(chunk) { - if (log) console.log(chunk.toString()); - proxy_request.write(chunk, 'binary'); - }); - - request.on('end', function() { - proxy_request.end(); - }); - -}).listen(port); - -process.on('uncaughtException', function(err){ - console.log('Uncaught exception!'); - console.log(err); -}); - -console.log("Proxy server listening on port " + port); diff --git a/node_modules/needle/test/utils/test.js b/node_modules/needle/test/utils/test.js deleted file mode 100644 index 8d58d70..0000000 --- a/node_modules/needle/test/utils/test.js +++ /dev/null @@ -1,104 +0,0 @@ -// TODO: write specs. :) - -var fs = require('fs'), - client = require('./../../'); - -process.env.DEBUG = true; - -var response_callback = function(err, resp, body){ - console.log(err); - if(resp) console.log("Got status code " + resp.statusCode) - console.log(body); -} - -function simple_head(){ - client.head('http://www.amazon.com', response_callback); -} - -function simple_get(){ - client.get('http://www.nodejs.org', response_callback); -} - -function proxy_get(){ - client.get('https://www.google.com/search?q=nodejs', {proxy: 'http://localhost:1234'}, response_callback); -} - -function auth_get(){ - client.get('https://www.twitter.com', {username: 'asd', password: '123'}, response_callback); -} - -function simple_post(url){ - - var data = { - foo: 'bar', - baz: { - nested: 'attribute' - } - } - - client.post(url, data, response_callback); - -} - -function multipart_post(url){ - - var filename = 'test_file.txt'; - var data = 'Plain text data.\nLorem ipsum dolor sit amet.\nBla bla bla.\n'; - fs.writeFileSync(filename, data); - - var black_pixel = Buffer.from("data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=".replace(/^data:image\/\w+;base64,/, ""), "base64"); - - var data = { - foo: 'bar', - bar: 'baz', - nested: { - my_document: { file: filename, content_type: 'text/plain' }, - even: { - more: 'nesting' - } - }, - pixel: { filename: 'black_pixel.gif', buffer: black_pixel, content_type: 'image/gif' }, - field2: {value: JSON.stringify({"json":[ {"one":1}, {"two":2} ]}), content_type: 'application/json' } - } - - client.post(url, data, {multipart: true}, function(err, resp, body){ - - console.log(err); - console.log("Got status code " + resp.statusCode) - console.log(body); - fs.unlink(filename); - - }); - -} - -switch(process.argv[2]){ - case 'head': - simple_head(); - break; - case 'get': - simple_get(); - break; - case 'auth': - auth_get(); - break; - case 'proxy': - proxy_get(); - break; - case 'post': - simple_post(process.argv[3] || 'http://posttestserver.com/post.php'); - break; - case 'multipart': - multipart_post(process.argv[3] || 'http://posttestserver.com/post.php?dir=example'); - break; - case 'all': - simple_head(); - simple_get(); - auth_get(); - proxy_get(); - simple_post(process.argv[3] || 'http://posttestserver.com/post.php'); - multipart_post(process.argv[3] || 'http://posttestserver.com/post.php?dir=example'); - break; - default: - console.log("Usage: ./test.js [head|get|auth|proxy|multipart]") -} diff --git a/node_modules/node-fetch/CHANGELOG.md b/node_modules/node-fetch/CHANGELOG.md deleted file mode 100644 index 188fcd3..0000000 --- a/node_modules/node-fetch/CHANGELOG.md +++ /dev/null @@ -1,266 +0,0 @@ - -Changelog -========= - - -# 2.x release - -## v2.6.0 - -- Enhance: `options.agent`, it now accepts a function that returns custom http(s).Agent instance based on current URL, see readme for more information. -- Fix: incorrect `Content-Length` was returned for stream body in 2.5.0 release; note that `node-fetch` doesn't calculate content length for stream body. -- Fix: `Response.url` should return empty string instead of `null` by default. - -## v2.5.0 - -- Enhance: `Response` object now includes `redirected` property. -- Enhance: `fetch()` now accepts third-party `Blob` implementation as body. -- Other: disable `package-lock.json` generation as we never commit them. -- Other: dev dependency update. -- Other: readme update. - -## v2.4.1 - -- Fix: `Blob` import rule for node < 10, as `Readable` isn't a named export. - -## v2.4.0 - -- Enhance: added `Brotli` compression support (using node's zlib). -- Enhance: updated `Blob` implementation per spec. -- Fix: set content type automatically for `URLSearchParams`. -- Fix: `Headers` now reject empty header names. -- Fix: test cases, as node 12+ no longer accepts invalid header response. - -## v2.3.0 - -- Enhance: added `AbortSignal` support, with README example. -- Enhance: handle invalid `Location` header during redirect by rejecting them explicitly with `FetchError`. -- Fix: update `browser.js` to support react-native environment, where `self` isn't available globally. - -## v2.2.1 - -- Fix: `compress` flag shouldn't overwrite existing `Accept-Encoding` header. -- Fix: multiple `import` rules, where `PassThrough` etc. doesn't have a named export when using node <10 and `--exerimental-modules` flag. -- Other: Better README. - -## v2.2.0 - -- Enhance: Support all `ArrayBuffer` view types -- Enhance: Support Web Workers -- Enhance: Support Node.js' `--experimental-modules` mode; deprecate `.es.js` file -- Fix: Add `__esModule` property to the exports object -- Other: Better example in README for writing response to a file -- Other: More tests for Agent - -## v2.1.2 - -- Fix: allow `Body` methods to work on `ArrayBuffer`-backed `Body` objects -- Fix: reject promise returned by `Body` methods when the accumulated `Buffer` exceeds the maximum size -- Fix: support custom `Host` headers with any casing -- Fix: support importing `fetch()` from TypeScript in `browser.js` -- Fix: handle the redirect response body properly - -## v2.1.1 - -Fix packaging errors in v2.1.0. - -## v2.1.0 - -- Enhance: allow using ArrayBuffer as the `body` of a `fetch()` or `Request` -- Fix: store HTTP headers of a `Headers` object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner -- Fix: silently ignore invalid HTTP headers -- Fix: handle HTTP redirect responses without a `Location` header just like non-redirect responses -- Fix: include bodies when following a redirection when appropriate - -## v2.0.0 - -This is a major release. Check [our upgrade guide](https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md) for an overview on some key differences between v1 and v2. - -### General changes - -- Major: Node.js 0.10.x and 0.12.x support is dropped -- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports -- Enhance: start testing on Node.js v4.x, v6.x, v8.x LTS, as well as v9.x stable -- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup) -- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings -- Other: rewrite in ES2015 using Babel -- Other: use Codecov for code coverage tracking -- Other: update package.json script for npm 5 -- Other: `encoding` module is now optional (alpha.7) -- Other: expose browser.js through package.json, avoid bundling mishaps (alpha.9) -- Other: allow TypeScript to `import` node-fetch by exposing default (alpha.9) - -### HTTP requests - -- Major: overwrite user's `Content-Length` if we can be sure our information is correct (per spec) -- Fix: errors in a response are caught before the body is accessed -- Fix: support WHATWG URL objects, created by `whatwg-url` package or `require('url').URL` in Node.js 7+ - -### Response and Request classes - -- Major: `response.text()` no longer attempts to detect encoding, instead always opting for UTF-8 (per spec); use `response.textConverted()` for the v1 behavior -- Major: make `response.json()` throw error instead of returning an empty object on 204 no-content respose (per spec; reverts behavior changed in v1.6.2) -- Major: internal methods are no longer exposed -- Major: throw error when a `GET` or `HEAD` Request is constructed with a non-null body (per spec) -- Enhance: add `response.arrayBuffer()` (also applies to Requests) -- Enhance: add experimental `response.blob()` (also applies to Requests) -- Enhance: `URLSearchParams` is now accepted as a body -- Enhance: wrap `response.json()` json parsing error as `FetchError` -- Fix: fix Request and Response with `null` body - -### Headers class - -- Major: remove `headers.getAll()`; make `get()` return all headers delimited by commas (per spec) -- Enhance: make Headers iterable -- Enhance: make Headers constructor accept an array of tuples -- Enhance: make sure header names and values are valid in HTTP -- Fix: coerce Headers prototype function parameters to strings, where applicable - -### Documentation - -- Enhance: more comprehensive API docs -- Enhance: add a list of default headers in README - - -# 1.x release - -## backport releases (v1.7.0 and beyond) - -See [changelog on 1.x branch](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) for details. - -## v1.6.3 - -- Enhance: error handling document to explain `FetchError` design -- Fix: support `form-data` 2.x releases (requires `form-data` >= 2.1.0) - -## v1.6.2 - -- Enhance: minor document update -- Fix: response.json() returns empty object on 204 no-content response instead of throwing a syntax error - -## v1.6.1 - -- Fix: if `res.body` is a non-stream non-formdata object, we will call `body.toString` and send it as a string -- Fix: `counter` value is incorrectly set to `follow` value when wrapping Request instance -- Fix: documentation update - -## v1.6.0 - -- Enhance: added `res.buffer()` api for convenience, it returns body as a Node.js buffer -- Enhance: better old server support by handling raw deflate response -- Enhance: skip encoding detection for non-HTML/XML response -- Enhance: minor document update -- Fix: HEAD request doesn't need decompression, as body is empty -- Fix: `req.body` now accepts a Node.js buffer - -## v1.5.3 - -- Fix: handle 204 and 304 responses when body is empty but content-encoding is gzip/deflate -- Fix: allow resolving response and cloned response in any order -- Fix: avoid setting `content-length` when `form-data` body use streams -- Fix: send DELETE request with content-length when body is present -- Fix: allow any url when calling new Request, but still reject non-http(s) url in fetch - -## v1.5.2 - -- Fix: allow node.js core to handle keep-alive connection pool when passing a custom agent - -## v1.5.1 - -- Fix: redirect mode `manual` should work even when there is no redirection or broken redirection - -## v1.5.0 - -- Enhance: rejected promise now use custom `Error` (thx to @pekeler) -- Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler) -- Enhance: basic support for redirect mode `manual` and `error`, allows for location header extraction (thx to @jimmywarting for the initial PR) - -## v1.4.1 - -- Fix: wrapping Request instance with FormData body again should preserve the body as-is - -## v1.4.0 - -- Enhance: Request and Response now have `clone` method (thx to @kirill-konshin for the initial PR) -- Enhance: Request and Response now have proper string and buffer body support (thx to @kirill-konshin) -- Enhance: Body constructor has been refactored out (thx to @kirill-konshin) -- Enhance: Headers now has `forEach` method (thx to @tricoder42) -- Enhance: back to 100% code coverage -- Fix: better form-data support (thx to @item4) -- Fix: better character encoding detection under chunked encoding (thx to @dsuket for the initial PR) - -## v1.3.3 - -- Fix: make sure `Content-Length` header is set when body is string for POST/PUT/PATCH requests -- Fix: handle body stream error, for cases such as incorrect `Content-Encoding` header -- Fix: when following certain redirects, use `GET` on subsequent request per Fetch Spec -- Fix: `Request` and `Response` constructors now parse headers input using `Headers` - -## v1.3.2 - -- Enhance: allow auto detect of form-data input (no `FormData` spec on node.js, this is form-data specific feature) - -## v1.3.1 - -- Enhance: allow custom host header to be set (server-side only feature, as it's a forbidden header on client-side) - -## v1.3.0 - -- Enhance: now `fetch.Request` is exposed as well - -## v1.2.1 - -- Enhance: `Headers` now normalized `Number` value to `String`, prevent common mistakes - -## v1.2.0 - -- Enhance: now fetch.Headers and fetch.Response are exposed, making testing easier - -## v1.1.2 - -- Fix: `Headers` should only support `String` and `Array` properties, and ignore others - -## v1.1.1 - -- Enhance: now req.headers accept both plain object and `Headers` instance - -## v1.1.0 - -- Enhance: timeout now also applies to response body (in case of slow response) -- Fix: timeout is now cleared properly when fetch is done/has failed - -## v1.0.6 - -- Fix: less greedy content-type charset matching - -## v1.0.5 - -- Fix: when `follow = 0`, fetch should not follow redirect -- Enhance: update tests for better coverage -- Enhance: code formatting -- Enhance: clean up doc - -## v1.0.4 - -- Enhance: test iojs support -- Enhance: timeout attached to socket event only fire once per redirect - -## v1.0.3 - -- Fix: response size limit should reject large chunk -- Enhance: added character encoding detection for xml, such as rss/atom feed (encoding in DTD) - -## v1.0.2 - -- Fix: added res.ok per spec change - -## v1.0.0 - -- Enhance: better test coverage and doc - - -# 0.x release - -## v0.1 - -- Major: initial public release diff --git a/node_modules/node-fetch/LICENSE.md b/node_modules/node-fetch/LICENSE.md deleted file mode 100644 index 660ffec..0000000 --- a/node_modules/node-fetch/LICENSE.md +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 David Frank - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/node_modules/node-fetch/README.md b/node_modules/node-fetch/README.md deleted file mode 100644 index cb19901..0000000 --- a/node_modules/node-fetch/README.md +++ /dev/null @@ -1,583 +0,0 @@ -node-fetch -========== - -[![npm version][npm-image]][npm-url] -[![build status][travis-image]][travis-url] -[![coverage status][codecov-image]][codecov-url] -[![install size][install-size-image]][install-size-url] - -A light-weight module that brings `window.fetch` to Node.js - -(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567)) - - - -- [Motivation](#motivation) -- [Features](#features) -- [Difference from client-side fetch](#difference-from-client-side-fetch) -- [Installation](#installation) -- [Loading and configuring the module](#loading-and-configuring-the-module) -- [Common Usage](#common-usage) - - [Plain text or HTML](#plain-text-or-html) - - [JSON](#json) - - [Simple Post](#simple-post) - - [Post with JSON](#post-with-json) - - [Post with form parameters](#post-with-form-parameters) - - [Handling exceptions](#handling-exceptions) - - [Handling client and server errors](#handling-client-and-server-errors) -- [Advanced Usage](#advanced-usage) - - [Streams](#streams) - - [Buffer](#buffer) - - [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data) - - [Extract Set-Cookie Header](#extract-set-cookie-header) - - [Post data using a file stream](#post-data-using-a-file-stream) - - [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart) - - [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal) -- [API](#api) - - [fetch(url[, options])](#fetchurl-options) - - [Options](#options) - - [Class: Request](#class-request) - - [Class: Response](#class-response) - - [Class: Headers](#class-headers) - - [Interface: Body](#interface-body) - - [Class: FetchError](#class-fetcherror) -- [License](#license) -- [Acknowledgement](#acknowledgement) - - - -## Motivation - -Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime. - -See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side). - -## Features - -- Stay consistent with `window.fetch` API. -- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences. -- Use native promise, but allow substituting it with [insert your favorite promise library]. -- Use native Node streams for body, on both request and response. -- Decode content encoding (gzip/deflate) properly, and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically. -- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting. - -## Difference from client-side fetch - -- See [Known Differences](LIMITS.md) for details. -- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue. -- Pull requests are welcomed too! - -## Installation - -Current stable release (`2.x`) - -```sh -$ npm install node-fetch --save -``` - -## Loading and configuring the module -We suggest you load the module via `require`, pending the stabalizing of es modules in node: -```js -const fetch = require('node-fetch'); -``` - -If you are using a Promise library other than native, set it through fetch.Promise: -```js -const Bluebird = require('bluebird'); - -fetch.Promise = Bluebird; -``` - -## Common Usage - -NOTE: The documentation below is up-to-date with `2.x` releases, [see `1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences. - -#### Plain text or HTML -```js -fetch('https://github.com/') - .then(res => res.text()) - .then(body => console.log(body)); -``` - -#### JSON - -```js - -fetch('https://api.github.com/users/github') - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Simple Post -```js -fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' }) - .then(res => res.json()) // expecting a json response - .then(json => console.log(json)); -``` - -#### Post with JSON - -```js -const body = { a: 1 }; - -fetch('https://httpbin.org/post', { - method: 'post', - body: JSON.stringify(body), - headers: { 'Content-Type': 'application/json' }, - }) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Post with form parameters -`URLSearchParams` is available in Node.js as of v7.5.0. See [official documentation](https://nodejs.org/api/url.html#url_class_urlsearchparams) for more usage methods. - -NOTE: The `Content-Type` header is only set automatically to `x-www-form-urlencoded` when an instance of `URLSearchParams` is given as such: - -```js -const { URLSearchParams } = require('url'); - -const params = new URLSearchParams(); -params.append('a', 1); - -fetch('https://httpbin.org/post', { method: 'POST', body: params }) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Handling exceptions -NOTE: 3xx-5xx responses are *NOT* exceptions, and should be handled in `then()`, see the next section. - -Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, like network errors, and operational errors which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details. - -```js -fetch('https://domain.invalid/') - .catch(err => console.error(err)); -``` - -#### Handling client and server errors -It is common to create a helper function to check that the response contains no client (4xx) or server (5xx) error responses: - -```js -function checkStatus(res) { - if (res.ok) { // res.status >= 200 && res.status < 300 - return res; - } else { - throw MyCustomError(res.statusText); - } -} - -fetch('https://httpbin.org/status/400') - .then(checkStatus) - .then(res => console.log('will not get here...')) -``` - -## Advanced Usage - -#### Streams -The "Node.js way" is to use streams when possible: - -```js -fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') - .then(res => { - const dest = fs.createWriteStream('./octocat.png'); - res.body.pipe(dest); - }); -``` - -#### Buffer -If you prefer to cache binary data in full, use buffer(). (NOTE: buffer() is a `node-fetch` only API) - -```js -const fileType = require('file-type'); - -fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') - .then(res => res.buffer()) - .then(buffer => fileType(buffer)) - .then(type => { /* ... */ }); -``` - -#### Accessing Headers and other Meta data -```js -fetch('https://github.com/') - .then(res => { - console.log(res.ok); - console.log(res.status); - console.log(res.statusText); - console.log(res.headers.raw()); - console.log(res.headers.get('content-type')); - }); -``` - -#### Extract Set-Cookie Header - -Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`, this is a `node-fetch` only API. - -```js -fetch(url).then(res => { - // returns an array of values, instead of a string of comma-separated values - console.log(res.headers.raw()['set-cookie']); -}); -``` - -#### Post data using a file stream - -```js -const { createReadStream } = require('fs'); - -const stream = createReadStream('input.txt'); - -fetch('https://httpbin.org/post', { method: 'POST', body: stream }) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Post with form-data (detect multipart) - -```js -const FormData = require('form-data'); - -const form = new FormData(); -form.append('a', 1); - -fetch('https://httpbin.org/post', { method: 'POST', body: form }) - .then(res => res.json()) - .then(json => console.log(json)); - -// OR, using custom headers -// NOTE: getHeaders() is non-standard API - -const form = new FormData(); -form.append('a', 1); - -const options = { - method: 'POST', - body: form, - headers: form.getHeaders() -} - -fetch('https://httpbin.org/post', options) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Request cancellation with AbortSignal - -> NOTE: You may only cancel streamed requests on Node >= v8.0.0 - -You may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller). - -An example of timing out a request after 150ms could be achieved as follows: - -```js -import AbortController from 'abort-controller'; - -const controller = new AbortController(); -const timeout = setTimeout( - () => { controller.abort(); }, - 150, -); - -fetch(url, { signal: controller.signal }) - .then(res => res.json()) - .then( - data => { - useData(data) - }, - err => { - if (err.name === 'AbortError') { - // request was aborted - } - }, - ) - .finally(() => { - clearTimeout(timeout); - }); -``` - -See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples. - - -## API - -### fetch(url[, options]) - -- `url` A string representing the URL for fetching -- `options` [Options](#fetch-options) for the HTTP(S) request -- Returns: Promise<[Response](#class-response)> - -Perform an HTTP(S) fetch. - -`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected promise. - - -### Options - -The default values are shown after each option key. - -```js -{ - // These properties are part of the Fetch Standard - method: 'GET', - headers: {}, // request headers. format is the identical to that accepted by the Headers constructor (see below) - body: null, // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream - redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect - signal: null, // pass an instance of AbortSignal to optionally abort requests - - // The following properties are node-fetch extensions - follow: 20, // maximum redirect count. 0 to not follow redirect - timeout: 0, // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead. - compress: true, // support gzip/deflate content encoding. false to disable - size: 0, // maximum response body size in bytes. 0 to disable - agent: null // http(s).Agent instance or function that returns an instance (see below) -} -``` - -##### Default Headers - -If no values are set, the following request headers will be sent automatically: - -Header | Value -------------------- | -------------------------------------------------------- -`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_ -`Accept` | `*/*` -`Connection` | `close` _(when no `options.agent` is present)_ -`Content-Length` | _(automatically calculated, if possible)_ -`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_ -`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)` - -Note: when `body` is a `Stream`, `Content-Length` is not set automatically. - -##### Custom Agent - -The `agent` option allows you to specify networking related options that's out of the scope of Fetch. Including and not limit to: - -- Support self-signed certificate -- Use only IPv4 or IPv6 -- Custom DNS Lookup - -See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information. - -In addition, `agent` option accepts a function that returns http(s).Agent instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol. - -```js -const httpAgent = new http.Agent({ - keepAlive: true -}); -const httpsAgent = new https.Agent({ - keepAlive: true -}); - -const options = { - agent: function (_parsedURL) { - if (_parsedURL.protocol == 'http:') { - return httpAgent; - } else { - return httpsAgent; - } - } -} -``` - - -### Class: Request - -An HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface. - -Due to the nature of Node.js, the following properties are not implemented at this moment: - -- `type` -- `destination` -- `referrer` -- `referrerPolicy` -- `mode` -- `credentials` -- `cache` -- `integrity` -- `keepalive` - -The following node-fetch extension properties are provided: - -- `follow` -- `compress` -- `counter` -- `agent` - -See [options](#fetch-options) for exact meaning of these extensions. - -#### new Request(input[, options]) - -*(spec-compliant)* - -- `input` A string representing a URL, or another `Request` (which will be cloned) -- `options` [Options][#fetch-options] for the HTTP(S) request - -Constructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). - -In most cases, directly `fetch(url, options)` is simpler than creating a `Request` object. - - -### Class: Response - -An HTTP(S) response. This class implements the [Body](#iface-body) interface. - -The following properties are not implemented in node-fetch at this moment: - -- `Response.error()` -- `Response.redirect()` -- `type` -- `trailer` - -#### new Response([body[, options]]) - -*(spec-compliant)* - -- `body` A string or [Readable stream][node-readable] -- `options` A [`ResponseInit`][response-init] options dictionary - -Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response). - -Because Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly. - -#### response.ok - -*(spec-compliant)* - -Convenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300. - -#### response.redirected - -*(spec-compliant)* - -Convenience property representing if the request has been redirected at least once. Will evaluate to true if the internal redirect counter is greater than 0. - - -### Class: Headers - -This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented. - -#### new Headers([init]) - -*(spec-compliant)* - -- `init` Optional argument to pre-fill the `Headers` object - -Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object, or any iterable object. - -```js -// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class - -const meta = { - 'Content-Type': 'text/xml', - 'Breaking-Bad': '<3' -}; -const headers = new Headers(meta); - -// The above is equivalent to -const meta = [ - [ 'Content-Type', 'text/xml' ], - [ 'Breaking-Bad', '<3' ] -]; -const headers = new Headers(meta); - -// You can in fact use any iterable objects, like a Map or even another Headers -const meta = new Map(); -meta.set('Content-Type', 'text/xml'); -meta.set('Breaking-Bad', '<3'); -const headers = new Headers(meta); -const copyOfHeaders = new Headers(headers); -``` - - -### Interface: Body - -`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes. - -The following methods are not yet implemented in node-fetch at this moment: - -- `formData()` - -#### body.body - -*(deviation from spec)* - -* Node.js [`Readable` stream][node-readable] - -The data encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable]. - -#### body.bodyUsed - -*(spec-compliant)* - -* `Boolean` - -A boolean property for if this body has been consumed. Per spec, a consumed body cannot be used again. - -#### body.arrayBuffer() -#### body.blob() -#### body.json() -#### body.text() - -*(spec-compliant)* - -* Returns: Promise - -Consume the body and return a promise that will resolve to one of these formats. - -#### body.buffer() - -*(node-fetch extension)* - -* Returns: Promise<Buffer> - -Consume the body and return a promise that will resolve to a Buffer. - -#### body.textConverted() - -*(node-fetch extension)* - -* Returns: Promise<String> - -Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8, if possible. - -(This API requires an optional dependency on npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.) - - -### Class: FetchError - -*(node-fetch extension)* - -An operational error in the fetching process. See [ERROR-HANDLING.md][] for more info. - - -### Class: AbortError - -*(node-fetch extension)* - -An Error thrown when the request is aborted in response to an `AbortSignal`'s `abort` event. It has a `name` property of `AbortError`. See [ERROR-HANDLING.MD][] for more info. - -## Acknowledgement - -Thanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference. - -`node-fetch` v1 was maintained by [@bitinn](https://github.com/bitinn); v2 was maintained by [@TimothyGu](https://github.com/timothygu), [@bitinn](https://github.com/bitinn) and [@jimmywarting](https://github.com/jimmywarting); v2 readme is written by [@jkantr](https://github.com/jkantr). - -## License - -MIT - -[npm-image]: https://flat.badgen.net/npm/v/node-fetch -[npm-url]: https://www.npmjs.com/package/node-fetch -[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch -[travis-url]: https://travis-ci.org/bitinn/node-fetch -[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master -[codecov-url]: https://codecov.io/gh/bitinn/node-fetch -[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch -[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch -[whatwg-fetch]: https://fetch.spec.whatwg.org/ -[response-init]: https://fetch.spec.whatwg.org/#responseinit -[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams -[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers -[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md -[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md -[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md diff --git a/node_modules/node-fetch/browser.js b/node_modules/node-fetch/browser.js deleted file mode 100644 index 0ad5de0..0000000 --- a/node_modules/node-fetch/browser.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -// ref: https://github.com/tc39/proposal-global -var getGlobal = function () { - // the only reliable means to get the global object is - // `Function('return this')()` - // However, this causes CSP violations in Chrome apps. - if (typeof self !== 'undefined') { return self; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - throw new Error('unable to locate global object'); -} - -var global = getGlobal(); - -module.exports = exports = global.fetch; - -// Needed for TypeScript and Webpack. -exports.default = global.fetch.bind(global); - -exports.Headers = global.Headers; -exports.Request = global.Request; -exports.Response = global.Response; \ No newline at end of file diff --git a/node_modules/node-fetch/lib/index.es.js b/node_modules/node-fetch/lib/index.es.js deleted file mode 100644 index 37d022c..0000000 --- a/node_modules/node-fetch/lib/index.es.js +++ /dev/null @@ -1,1633 +0,0 @@ -process.emitWarning("The .es.js file is deprecated. Use .mjs instead."); - -import Stream from 'stream'; -import http from 'http'; -import Url from 'url'; -import https from 'https'; -import zlib from 'zlib'; - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; - - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } - - this[BUFFER] = Buffer.concat(buffers); - - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } - } - get size() { - return this[BUFFER].length; - } - get type() { - return this[TYPE]; - } - text() { - return Promise.resolve(this[BUFFER].toString()); - } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); - } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; - } - toString() { - return '[object Blob]'; - } - slice() { - const size = this.size; - - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); - - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; - } -} - -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); - -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * fetch-error.js - * - * FetchError interface for operational errors - */ - -/** - * Create FetchError instance - * - * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError - */ -function FetchError(message, type, systemError) { - Error.call(this, message); - - this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; - -let convert; -try { - convert = require('encoding').convert; -} catch (e) {} - -const INTERNALS = Symbol('Body internals'); - -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; - -/** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -function Body(body) { - var _this = this; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; - - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; - - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, - - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, - - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; - - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); - } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, - - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, - - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; - - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; - -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); - -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); - } - } -}; - -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; - - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } - - this[INTERNALS].disturbed = true; - - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } - - let body = this.body; - - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is blob - if (isBlob(body)) { - body = body.stream(); - } - - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } - - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; - - return new Body.Promise(function (resolve, reject) { - let resTimeout; - - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } - - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } - - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); - return; - } - - accumBytes += chunk.length; - accum.push(chunk); - }); - - body.on('end', function () { - if (abort) { - return; - } - - clearTimeout(resTimeout); - - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - }); -} - -/** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding - * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String - */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } - - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; - - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } - - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - - // html5 - if (!res && str) { - res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - this[MAP] = Object.create(null); - - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); - - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } - - return; - } - - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } - - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } - - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } - - return this[MAP][key].join(', '); - } - - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; - - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; - - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } - - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } - - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } - - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } - - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } - - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } - - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } - - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } - - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); - -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; - - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} - -const INTERNAL = Symbol('internal'); - -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; -} - -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } - - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; - - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } - - this[INTERNAL].index = index + 1; - - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); - -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); - - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } - - return obj; -} - -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} - -const INTERNALS$1 = Symbol('Response internals'); - -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; - -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - Body.call(this, body, opts); - - const status = opts.status || 200; - const headers = new Headers(opts.headers); - - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } - - get url() { - return this[INTERNALS$1].url || ''; - } - - get status() { - return this[INTERNALS$1].status; - } - - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } - - get redirected() { - return this[INTERNALS$1].counter > 0; - } - - get statusText() { - return this[INTERNALS$1].statusText; - } - - get headers() { - return this[INTERNALS$1].headers; - } - - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} - -Body.mixIn(Response.prototype); - -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); - -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); - -const INTERNALS$2 = Symbol('Request internals'); - -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; - -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; - -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} - -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} - -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - let parsedURL; - - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parse_url(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parse_url(`${input}`); - } - input = {}; - } else { - parsedURL = parse_url(input.url); - } - - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); - - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } - - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; - - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); - - const headers = new Headers(init.headers || input.headers || {}); - - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; - - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } - - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; - - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } - - get method() { - return this[INTERNALS$2].method; - } - - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } - - get headers() { - return this[INTERNALS$2].headers; - } - - get redirect() { - return this[INTERNALS$2].redirect; - } - - get signal() { - return this[INTERNALS$2].signal; - } - - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); - -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); - -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); - - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } - - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } - - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } - - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } - - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } - - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } - - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } - - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } - - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } - - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js - - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} - -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ - -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); - - this.type = 'aborted'; - this.message = message; - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; - -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; -const resolve_url = Url.resolve; - -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); - - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; - - let response = null; - - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - - if (signal && signal.aborted) { - abort(); - return; - } - - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; - - // send request - const req = send(options); - let reqTimeout; - - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } - - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } - - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); - - req.on('response', function (res) { - clearTimeout(reqTimeout); - - const headers = createHeadersLenient(res.headers); - - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); - - // HTTP fetch step 5.3 - const locationURL = location === null ? null : resolve_url(request.url, location); - - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } - - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout - }; - - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } - - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); - - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; -}; - -// expose Promise -fetch.Promise = global.Promise; - -export default fetch; -export { Headers, Request, Response, FetchError }; diff --git a/node_modules/node-fetch/lib/index.js b/node_modules/node-fetch/lib/index.js deleted file mode 100644 index daa44bc..0000000 --- a/node_modules/node-fetch/lib/index.js +++ /dev/null @@ -1,1642 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var Stream = _interopDefault(require('stream')); -var http = _interopDefault(require('http')); -var Url = _interopDefault(require('url')); -var https = _interopDefault(require('https')); -var zlib = _interopDefault(require('zlib')); - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; - - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } - - this[BUFFER] = Buffer.concat(buffers); - - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } - } - get size() { - return this[BUFFER].length; - } - get type() { - return this[TYPE]; - } - text() { - return Promise.resolve(this[BUFFER].toString()); - } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); - } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; - } - toString() { - return '[object Blob]'; - } - slice() { - const size = this.size; - - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); - - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; - } -} - -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); - -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * fetch-error.js - * - * FetchError interface for operational errors - */ - -/** - * Create FetchError instance - * - * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError - */ -function FetchError(message, type, systemError) { - Error.call(this, message); - - this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; - -let convert; -try { - convert = require('encoding').convert; -} catch (e) {} - -const INTERNALS = Symbol('Body internals'); - -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; - -/** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -function Body(body) { - var _this = this; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; - - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; - - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, - - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, - - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; - - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); - } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, - - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, - - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; - - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; - -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); - -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); - } - } -}; - -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; - - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } - - this[INTERNALS].disturbed = true; - - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } - - let body = this.body; - - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is blob - if (isBlob(body)) { - body = body.stream(); - } - - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } - - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; - - return new Body.Promise(function (resolve, reject) { - let resTimeout; - - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } - - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } - - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); - return; - } - - accumBytes += chunk.length; - accum.push(chunk); - }); - - body.on('end', function () { - if (abort) { - return; - } - - clearTimeout(resTimeout); - - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - }); -} - -/** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding - * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String - */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } - - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; - - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } - - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - - // html5 - if (!res && str) { - res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - this[MAP] = Object.create(null); - - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); - - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } - - return; - } - - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } - - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } - - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } - - return this[MAP][key].join(', '); - } - - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; - - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; - - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } - - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } - - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } - - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } - - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } - - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } - - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } - - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } - - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); - -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; - - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} - -const INTERNAL = Symbol('internal'); - -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; -} - -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } - - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; - - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } - - this[INTERNAL].index = index + 1; - - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); - -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); - - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } - - return obj; -} - -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} - -const INTERNALS$1 = Symbol('Response internals'); - -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; - -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - Body.call(this, body, opts); - - const status = opts.status || 200; - const headers = new Headers(opts.headers); - - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } - - get url() { - return this[INTERNALS$1].url || ''; - } - - get status() { - return this[INTERNALS$1].status; - } - - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } - - get redirected() { - return this[INTERNALS$1].counter > 0; - } - - get statusText() { - return this[INTERNALS$1].statusText; - } - - get headers() { - return this[INTERNALS$1].headers; - } - - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} - -Body.mixIn(Response.prototype); - -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); - -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); - -const INTERNALS$2 = Symbol('Request internals'); - -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; - -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; - -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} - -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} - -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - let parsedURL; - - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parse_url(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parse_url(`${input}`); - } - input = {}; - } else { - parsedURL = parse_url(input.url); - } - - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); - - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } - - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; - - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); - - const headers = new Headers(init.headers || input.headers || {}); - - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; - - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } - - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; - - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } - - get method() { - return this[INTERNALS$2].method; - } - - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } - - get headers() { - return this[INTERNALS$2].headers; - } - - get redirect() { - return this[INTERNALS$2].redirect; - } - - get signal() { - return this[INTERNALS$2].signal; - } - - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); - -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); - -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); - - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } - - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } - - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } - - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } - - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } - - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } - - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } - - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } - - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } - - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js - - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} - -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ - -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); - - this.type = 'aborted'; - this.message = message; - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; - -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; -const resolve_url = Url.resolve; - -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); - - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; - - let response = null; - - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - - if (signal && signal.aborted) { - abort(); - return; - } - - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; - - // send request - const req = send(options); - let reqTimeout; - - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } - - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } - - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); - - req.on('response', function (res) { - clearTimeout(reqTimeout); - - const headers = createHeadersLenient(res.headers); - - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); - - // HTTP fetch step 5.3 - const locationURL = location === null ? null : resolve_url(request.url, location); - - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } - - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout - }; - - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } - - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); - - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; -}; - -// expose Promise -fetch.Promise = global.Promise; - -module.exports = exports = fetch; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = exports; -exports.Headers = Headers; -exports.Request = Request; -exports.Response = Response; -exports.FetchError = FetchError; diff --git a/node_modules/node-fetch/lib/index.mjs b/node_modules/node-fetch/lib/index.mjs deleted file mode 100644 index e571ea6..0000000 --- a/node_modules/node-fetch/lib/index.mjs +++ /dev/null @@ -1,1631 +0,0 @@ -import Stream from 'stream'; -import http from 'http'; -import Url from 'url'; -import https from 'https'; -import zlib from 'zlib'; - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; - - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } - - this[BUFFER] = Buffer.concat(buffers); - - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } - } - get size() { - return this[BUFFER].length; - } - get type() { - return this[TYPE]; - } - text() { - return Promise.resolve(this[BUFFER].toString()); - } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); - } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; - } - toString() { - return '[object Blob]'; - } - slice() { - const size = this.size; - - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); - - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; - } -} - -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); - -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * fetch-error.js - * - * FetchError interface for operational errors - */ - -/** - * Create FetchError instance - * - * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError - */ -function FetchError(message, type, systemError) { - Error.call(this, message); - - this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; - -let convert; -try { - convert = require('encoding').convert; -} catch (e) {} - -const INTERNALS = Symbol('Body internals'); - -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; - -/** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -function Body(body) { - var _this = this; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; - - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; - - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, - - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, - - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; - - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); - } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, - - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, - - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; - - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; - -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); - -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); - } - } -}; - -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; - - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } - - this[INTERNALS].disturbed = true; - - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } - - let body = this.body; - - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is blob - if (isBlob(body)) { - body = body.stream(); - } - - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } - - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; - - return new Body.Promise(function (resolve, reject) { - let resTimeout; - - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } - - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } - - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); - return; - } - - accumBytes += chunk.length; - accum.push(chunk); - }); - - body.on('end', function () { - if (abort) { - return; - } - - clearTimeout(resTimeout); - - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - }); -} - -/** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding - * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String - */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } - - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; - - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } - - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - - // html5 - if (!res && str) { - res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - this[MAP] = Object.create(null); - - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); - - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } - - return; - } - - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } - - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } - - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } - - return this[MAP][key].join(', '); - } - - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; - - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; - - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } - - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } - - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } - - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } - - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } - - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } - - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } - - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } - - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); - -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; - - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} - -const INTERNAL = Symbol('internal'); - -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; -} - -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } - - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; - - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } - - this[INTERNAL].index = index + 1; - - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); - -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); - - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } - - return obj; -} - -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} - -const INTERNALS$1 = Symbol('Response internals'); - -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; - -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - Body.call(this, body, opts); - - const status = opts.status || 200; - const headers = new Headers(opts.headers); - - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } - - get url() { - return this[INTERNALS$1].url || ''; - } - - get status() { - return this[INTERNALS$1].status; - } - - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } - - get redirected() { - return this[INTERNALS$1].counter > 0; - } - - get statusText() { - return this[INTERNALS$1].statusText; - } - - get headers() { - return this[INTERNALS$1].headers; - } - - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} - -Body.mixIn(Response.prototype); - -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); - -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); - -const INTERNALS$2 = Symbol('Request internals'); - -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; - -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; - -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} - -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} - -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - let parsedURL; - - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parse_url(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parse_url(`${input}`); - } - input = {}; - } else { - parsedURL = parse_url(input.url); - } - - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); - - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } - - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; - - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); - - const headers = new Headers(init.headers || input.headers || {}); - - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; - - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } - - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; - - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } - - get method() { - return this[INTERNALS$2].method; - } - - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } - - get headers() { - return this[INTERNALS$2].headers; - } - - get redirect() { - return this[INTERNALS$2].redirect; - } - - get signal() { - return this[INTERNALS$2].signal; - } - - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); - -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); - -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); - - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } - - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } - - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } - - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } - - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } - - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } - - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } - - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } - - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } - - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js - - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} - -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ - -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); - - this.type = 'aborted'; - this.message = message; - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; - -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; -const resolve_url = Url.resolve; - -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); - - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; - - let response = null; - - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - - if (signal && signal.aborted) { - abort(); - return; - } - - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; - - // send request - const req = send(options); - let reqTimeout; - - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } - - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } - - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); - - req.on('response', function (res) { - clearTimeout(reqTimeout); - - const headers = createHeadersLenient(res.headers); - - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); - - // HTTP fetch step 5.3 - const locationURL = location === null ? null : resolve_url(request.url, location); - - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } - - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout - }; - - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } - - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); - - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; -}; - -// expose Promise -fetch.Promise = global.Promise; - -export default fetch; -export { Headers, Request, Response, FetchError }; diff --git a/node_modules/node-fetch/package.json b/node_modules/node-fetch/package.json deleted file mode 100644 index 635054e..0000000 --- a/node_modules/node-fetch/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "_from": "node-fetch@^2.6.0", - "_id": "node-fetch@2.6.0", - "_inBundle": false, - "_integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", - "_location": "/node-fetch", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "node-fetch@^2.6.0", - "name": "node-fetch", - "escapedName": "node-fetch", - "rawSpec": "^2.6.0", - "saveSpec": null, - "fetchSpec": "^2.6.0" - }, - "_requiredBy": [ - "/vega-loader" - ], - "_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "_shasum": "e633456386d4aa55863f676a7ab0daa8fdecb0fd", - "_spec": "node-fetch@^2.6.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-loader", - "author": { - "name": "David Frank" - }, - "browser": "./browser.js", - "bugs": { - "url": "https://github.com/bitinn/node-fetch/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "A light-weight module that brings window.fetch to node.js", - "devDependencies": { - "@ungap/url-search-params": "^0.1.2", - "abort-controller": "^1.1.0", - "abortcontroller-polyfill": "^1.3.0", - "babel-core": "^6.26.3", - "babel-plugin-istanbul": "^4.1.6", - "babel-preset-env": "^1.6.1", - "babel-register": "^6.16.3", - "chai": "^3.5.0", - "chai-as-promised": "^7.1.1", - "chai-iterator": "^1.1.1", - "chai-string": "~1.3.0", - "codecov": "^3.3.0", - "cross-env": "^5.2.0", - "form-data": "^2.3.3", - "is-builtin-module": "^1.0.0", - "mocha": "^5.0.0", - "nyc": "11.9.0", - "parted": "^0.1.1", - "promise": "^8.0.3", - "resumer": "0.0.0", - "rollup": "^0.63.4", - "rollup-plugin-babel": "^3.0.7", - "string-to-arraybuffer": "^1.0.2", - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "files": [ - "lib/index.js", - "lib/index.mjs", - "lib/index.es.js", - "browser.js" - ], - "homepage": "https://github.com/bitinn/node-fetch", - "keywords": [ - "fetch", - "http", - "promise" - ], - "license": "MIT", - "main": "lib/index", - "module": "lib/index.mjs", - "name": "node-fetch", - "repository": { - "type": "git", - "url": "git+https://github.com/bitinn/node-fetch.git" - }, - "scripts": { - "build": "cross-env BABEL_ENV=rollup rollup -c", - "coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json", - "prepare": "npm run build", - "report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js", - "test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js" - }, - "version": "2.6.0" -} diff --git a/node_modules/node-pre-gyp/CHANGELOG.md b/node_modules/node-pre-gyp/CHANGELOG.md deleted file mode 100644 index 1b8aa0e..0000000 --- a/node_modules/node-pre-gyp/CHANGELOG.md +++ /dev/null @@ -1,427 +0,0 @@ -# node-pre-gyp changelog - -## 0.11.0 - -- Fixed double-install problem with node v10 -- Significant N-API improvements (https://github.com/mapbox/node-pre-gyp/pull/405) - -## 0.10.3 - -- Now will use `request` over `needle` if request is installed. By default `needle` is used for `https`. This should unbreak proxy support that regressed in v0.9.0 - -## 0.10.2 - -- Fixed rc/deep-extent security vulnerability -- Fixed broken reinstall script do to incorrectly named get_best_napi_version - -## 0.10.1 - -- Fix needle error event (@medns) - -## 0.10.0 - -- Allow for a single-level module path when packing @allenluce (https://github.com/mapbox/node-pre-gyp/pull/371) -- Log warnings instead of errors when falling back @xzyfer (https://github.com/mapbox/node-pre-gyp/pull/366) -- Add Node.js v10 support to tests (https://github.com/mapbox/node-pre-gyp/pull/372) -- Remove retire.js from CI (https://github.com/mapbox/node-pre-gyp/pull/372) -- Remove support for Node.js v4 due to [EOL on April 30th, 2018](https://github.com/nodejs/Release/blob/7dd52354049cae99eed0e9fe01345b0722a86fde/schedule.json#L14) -- Update appveyor tests to install default NPM version instead of NPM v2.x for all Windows builds (https://github.com/mapbox/node-pre-gyp/pull/375) - -## 0.9.1 - -- Fixed regression (in v0.9.0) with support for http redirects @allenluce (https://github.com/mapbox/node-pre-gyp/pull/361) - -## 0.9.0 - -- Switched from using `request` to `needle` to reduce size of module deps (https://github.com/mapbox/node-pre-gyp/pull/350) - -## 0.8.0 - -- N-API support (@inspiredware) - -## 0.7.1 - -- Upgraded to tar v4.x - -## 0.7.0 - - - Updated request and hawk (#347) - - Dropped node v0.10.x support - -## 0.6.40 - - - Improved error reporting if an install fails - -## 0.6.39 - - - Support for node v9 - - Support for versioning on `{libc}` to allow binaries to work on non-glic linux systems like alpine linux - - -## 0.6.38 - - - Maintaining compatibility (for v0.6.x series) with node v0.10.x - -## 0.6.37 - - - Solved one part of #276: now now deduce the node ABI from the major version for node >= 2 even when not stored in the abi_crosswalk.json - - Fixed docs to avoid mentioning the deprecated and dangerous `prepublish` in package.json (#291) - - Add new node versions to crosswalk - - Ported tests to use tape instead of mocha - - Got appveyor tests passing by downgrading npm and node-gyp - -## 0.6.36 - - - Removed the running of `testbinary` during install. Because this was regressed for so long, it is too dangerous to re-enable by default. Developers needing validation can call `node-pre-gyp testbinary` directory. - - Fixed regression in v0.6.35 for electron installs (now skipping binary validation which is not yet supported for electron) - -## 0.6.35 - - - No longer recommending `npm ls` in `prepublish` (#291) - - Fixed testbinary command (#283) @szdavid92 - -## 0.6.34 - - - Added new node versions to crosswalk, including v8 - - Upgraded deps to latest versions, started using `^` instead of `~` for all deps. - -## 0.6.33 - - - Improved support for yarn - -## 0.6.32 - - - Honor npm configuration for CA bundles (@heikkipora) - - Add node-pre-gyp and npm versions to user agent (@addaleax) - - Updated various deps - - Add known node version for v7.x - -## 0.6.31 - - - Updated various deps - -## 0.6.30 - - - Update to npmlog@4.x and semver@5.3.x - - Add known node version for v6.5.0 - -## 0.6.29 - - - Add known node versions for v0.10.45, v0.12.14, v4.4.4, v5.11.1, and v6.1.0 - -## 0.6.28 - - - Now more verbose when remote binaries are not available. This is needed since npm is increasingly more quiet by default - and users need to know why builds are falling back to source compiles that might then error out. - -## 0.6.27 - - - Add known node version for node v6 - - Stopped bundling dependencies - - Documented method for module authors to avoid bundling node-pre-gyp - - See https://github.com/mapbox/node-pre-gyp/tree/master#configuring for details - -## 0.6.26 - - - Skip validation for nw runtime (https://github.com/mapbox/node-pre-gyp/pull/181) via @fleg - -## 0.6.25 - - - Improved support for auto-detection of electron runtime in `node-pre-gyp.find()` - - Pull request from @enlight - https://github.com/mapbox/node-pre-gyp/pull/187 - - Add known node version for 4.4.1 and 5.9.1 - -## 0.6.24 - - - Add known node version for 5.8.0, 5.9.0, and 4.4.0. - -## 0.6.23 - - - Add known node version for 0.10.43, 0.12.11, 4.3.2, and 5.7.1. - -## 0.6.22 - - - Add known node version for 4.3.1, and 5.7.0. - -## 0.6.21 - - - Add known node version for 0.10.42, 0.12.10, 4.3.0, and 5.6.0. - -## 0.6.20 - - - Add known node version for 4.2.5, 4.2.6, 5.4.0, 5.4.1,and 5.5.0. - -## 0.6.19 - - - Add known node version for 4.2.4 - -## 0.6.18 - - - Add new known node versions for 0.10.x, 0.12.x, 4.x, and 5.x - -## 0.6.17 - - - Re-tagged to fix packaging problem of `Error: Cannot find module 'isarray'` - -## 0.6.16 - - - Added known version in crosswalk for 5.1.0. - -## 0.6.15 - - - Upgraded tar-pack (https://github.com/mapbox/node-pre-gyp/issues/182) - - Support custom binary hosting mirror (https://github.com/mapbox/node-pre-gyp/pull/170) - - Added known version in crosswalk for 4.2.2. - -## 0.6.14 - - - Added node 5.x version - -## 0.6.13 - - - Added more known node 4.x versions - -## 0.6.12 - - - Added support for [Electron](http://electron.atom.io/). Just pass the `--runtime=electron` flag when building/installing. Thanks @zcbenz - -## 0.6.11 - - - Added known node and io.js versions including more 3.x and 4.x versions - -## 0.6.10 - - - Added known node and io.js versions including 3.x and 4.x versions - - Upgraded `tar` dep - -## 0.6.9 - - - Upgraded `rc` dep - - Updated known io.js version: v2.4.0 - -## 0.6.8 - - - Upgraded `semver` and `rimraf` deps - - Updated known node and io.js versions - -## 0.6.7 - - - Fixed `node_abi` versions for io.js 1.1.x -> 1.8.x (should be 43, but was stored as 42) (refs https://github.com/iojs/build/issues/94) - -## 0.6.6 - - - Updated with known io.js 2.0.0 version - -## 0.6.5 - - - Now respecting `npm_config_node_gyp` (https://github.com/npm/npm/pull/4887) - - Updated to semver@4.3.2 - - Updated known node v0.12.x versions and io.js 1.x versions. - -## 0.6.4 - - - Improved support for `io.js` (@fengmk2) - - Test coverage improvements (@mikemorris) - - Fixed support for `--dist-url` that regressed in 0.6.3 - -## 0.6.3 - - - Added support for passing raw options to node-gyp using `--` separator. Flags passed after - the `--` to `node-pre-gyp configure` will be passed directly to gyp while flags passed - after the `--` will be passed directly to make/visual studio. - - Added `node-pre-gyp configure` command to be able to call `node-gyp configure` directly - - Fix issue with require validation not working on windows 7 (@edgarsilva) - -## 0.6.2 - - - Support for io.js >= v1.0.2 - - Deferred require of `request` and `tar` to help speed up command line usage of `node-pre-gyp`. - -## 0.6.1 - - - Fixed bundled `tar` version - -## 0.6.0 - - - BREAKING: node odd releases like v0.11.x now use `major.minor.patch` for `{node_abi}` instead of `NODE_MODULE_VERSION` (#124) - - Added support for `toolset` option in versioning. By default is an empty string but `--toolset` can be passed to publish or install to select alternative binaries that target a custom toolset like C++11. For example to target Visual Studio 2014 modules like node-sqlite3 use `--toolset=v140`. - - Added support for `--no-rollback` option to request that a failed binary test does not remove the binary module leaves it in place. - - Added support for `--update-binary` option to request an existing binary be re-installed and the check for a valid local module be skipped. - - Added support for passing build options from `npm` through `node-pre-gyp` to `node-gyp`: `--nodedir`, `--disturl`, `--python`, and `--msvs_version` - -## 0.5.31 - - - Added support for deducing node_abi for node.js runtime from previous release if the series is even - - Added support for --target=0.10.33 - -## 0.5.30 - - - Repackaged with latest bundled deps - -## 0.5.29 - - - Added support for semver `build`. - - Fixed support for downloading from urls that include `+`. - -## 0.5.28 - - - Now reporting unix style paths only in reveal command - -## 0.5.27 - - - Fixed support for auto-detecting s3 bucket name when it contains `.` - @taavo - - Fixed support for installing when path contains a `'` - @halfdan - - Ported tests to mocha - -## 0.5.26 - - - Fix node-webkit support when `--target` option is not provided - -## 0.5.25 - - - Fix bundling of deps - -## 0.5.24 - - - Updated ABI crosswalk to incldue node v0.10.30 and v0.10.31 - -## 0.5.23 - - - Added `reveal` command. Pass no options to get all versioning data as json. Pass a second arg to grab a single versioned property value - - Added support for `--silent` (shortcut for `--loglevel=silent`) - -## 0.5.22 - - - Fixed node-webkit versioning name (NOTE: node-webkit support still experimental) - -## 0.5.21 - - - New package to fix `shasum check failed` error with v0.5.20 - -## 0.5.20 - - - Now versioning node-webkit binaries based on major.minor.patch - assuming no compatible ABI across versions (#90) - -## 0.5.19 - - - Updated to know about more node-webkit releases - -## 0.5.18 - - - Updated to know about more node-webkit releases - -## 0.5.17 - - - Updated to know about node v0.10.29 release - -## 0.5.16 - - - Now supporting all aws-sdk configuration parameters (http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html) (#86) - -## 0.5.15 - - - Fixed installation of windows packages sub directories on unix systems (#84) - -## 0.5.14 - - - Finished support for cross building using `--target_platform` option (#82) - - Now skipping binary validation on install if target arch/platform do not match the host. - - Removed multi-arch validing for OS X since it required a FAT node.js binary - -## 0.5.13 - - - Fix problem in 0.5.12 whereby the wrong versions of mkdirp and semver where bundled. - -## 0.5.12 - - - Improved support for node-webkit (@Mithgol) - -## 0.5.11 - - - Updated target versions listing - -## 0.5.10 - - - Fixed handling of `-debug` flag passed directory to node-pre-gyp (#72) - - Added optional second arg to `node_pre_gyp.find` to customize the default versioning options used to locate the runtime binary - - Failed install due to `testbinary` check failure no longer leaves behind binary (#70) - -## 0.5.9 - - - Fixed regression in `testbinary` command causing installs to fail on windows with 0.5.7 (#60) - -## 0.5.8 - - - Started bundling deps - -## 0.5.7 - - - Fixed the `testbinary` check, which is used to determine whether to re-download or source compile, to work even in complex dependency situations (#63) - - Exposed the internal `testbinary` command in node-pre-gyp command line tool - - Fixed minor bug so that `fallback_to_build` option is always respected - -## 0.5.6 - - - Added support for versioning on the `name` value in `package.json` (#57). - - Moved to using streams for reading tarball when publishing (#52) - -## 0.5.5 - - - Improved binary validation that also now works with node-webkit (@Mithgol) - - Upgraded test apps to work with node v0.11.x - - Improved test coverage - -## 0.5.4 - - - No longer depends on external install of node-gyp for compiling builds. - -## 0.5.3 - - - Reverted fix for debian/nodejs since it broke windows (#45) - -## 0.5.2 - - - Support for debian systems where the node binary is named `nodejs` (#45) - - Added `bin/node-pre-gyp.cmd` to be able to run command on windows locally (npm creates an .npm automatically when globally installed) - - Updated abi-crosswalk with node v0.10.26 entry. - -## 0.5.1 - - - Various minor bug fixes, several improving windows support for publishing. - -## 0.5.0 - - - Changed property names in `binary` object: now required are `module_name`, `module_path`, and `host`. - - Now `module_path` supports versioning, which allows developers to opt-in to using a versioned install path (#18). - - Added `remote_path` which also supports versioning. - - Changed `remote_uri` to `host`. - -## 0.4.2 - - - Added support for `--target` flag to request cross-compile against a specific node/node-webkit version. - - Added preliminary support for node-webkit - - Fixed support for `--target_arch` option being respected in all cases. - -## 0.4.1 - - - Fixed exception when only stderr is available in binary test (@bendi / #31) - -## 0.4.0 - - - Enforce only `https:` based remote publishing access. - - Added `node-pre-gyp info` command to display listing of published binaries - - Added support for changing the directory node-pre-gyp should build in with the `-C/--directory` option. - - Added support for S3 prefixes. - -## 0.3.1 - - - Added `unpublish` command. - - Fixed module path construction in tests. - - Added ability to disable falling back to build behavior via `npm install --fallback-to-build=false` which overrides setting in a depedencies package.json `install` target. - -## 0.3.0 - - - Support for packaging all files in `module_path` directory - see `app4` for example - - Added `testpackage` command. - - Changed `clean` command to only delete `.node` not entire `build` directory since node-gyp will handle that. - - `.node` modules must be in a folder of there own since tar-pack will remove everything when it unpacks. diff --git a/node_modules/node-pre-gyp/LICENSE b/node_modules/node-pre-gyp/LICENSE deleted file mode 100644 index 8f5fce9..0000000 --- a/node_modules/node-pre-gyp/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c), Mapbox - -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. - * Neither the name of node-pre-gyp nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR -CONTRIBUTORS 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. diff --git a/node_modules/node-pre-gyp/README.md b/node_modules/node-pre-gyp/README.md deleted file mode 100644 index 088f2af..0000000 --- a/node_modules/node-pre-gyp/README.md +++ /dev/null @@ -1,693 +0,0 @@ -# node-pre-gyp - -#### node-pre-gyp makes it easy to publish and install Node.js C++ addons from binaries - -[![NPM](https://nodei.co/npm/node-pre-gyp.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-pre-gyp/) - -[![Build Status](https://api.travis-ci.org/mapbox/node-pre-gyp.svg)](https://travis-ci.org/mapbox/node-pre-gyp) -[![Build status](https://ci.appveyor.com/api/projects/status/3nxewb425y83c0gv)](https://ci.appveyor.com/project/Mapbox/node-pre-gyp) -[![Dependencies](https://david-dm.org/mapbox/node-pre-gyp.svg)](https://david-dm.org/mapbox/node-pre-gyp) - -`node-pre-gyp` stands between [npm](https://github.com/npm/npm) and [node-gyp](https://github.com/Tootallnate/node-gyp) and offers a cross-platform method of binary deployment. - -### Features - - - A command line tool called `node-pre-gyp` that can install your package's C++ module from a binary. - - A variety of developer targeted commands for packaging, testing, and publishing binaries. - - A JavaScript module that can dynamically require your installed binary: `require('node-pre-gyp').find` - -For a hello world example of a module packaged with `node-pre-gyp` see and [the wiki ](https://github.com/mapbox/node-pre-gyp/wiki/Modules-using-node-pre-gyp) for real world examples. - -## Credits - - - The module is modeled after [node-gyp](https://github.com/Tootallnate/node-gyp) by [@Tootallnate](https://github.com/Tootallnate) - - Motivation for initial development came from [@ErisDS](https://github.com/ErisDS) and the [Ghost Project](https://github.com/TryGhost/Ghost). - - Development is sponsored by [Mapbox](https://www.mapbox.com/) - -## FAQ - -See the [Frequently Ask Questions](https://github.com/mapbox/node-pre-gyp/wiki/FAQ). - -## Depends - - - Node.js >= node v6.x - -## Install - -`node-pre-gyp` is designed to be installed as a local dependency of your Node.js C++ addon and accessed like: - - ./node_modules/.bin/node-pre-gyp --help - -But you can also install it globally: - - npm install node-pre-gyp -g - -## Usage - -### Commands - -View all possible commands: - - node-pre-gyp --help - -- clean - Remove the entire folder containing the compiled .node module -- install - Install pre-built binary for module -- reinstall - Run "clean" and "install" at once -- build - Compile the module by dispatching to node-gyp or nw-gyp -- rebuild - Run "clean" and "build" at once -- package - Pack binary into tarball -- testpackage - Test that the staged package is valid -- publish - Publish pre-built binary -- unpublish - Unpublish pre-built binary -- info - Fetch info on published binaries - -You can also chain commands: - - node-pre-gyp clean build unpublish publish info - -### Options - -Options include: - - - `-C/--directory`: run the command in this directory - - `--build-from-source`: build from source instead of using pre-built binary - - `--update-binary`: reinstall by replacing previously installed local binary with remote binary - - `--runtime=node-webkit`: customize the runtime: `node`, `electron` and `node-webkit` are the valid options - - `--fallback-to-build`: fallback to building from source if pre-built binary is not available - - `--target=0.4.0`: Pass the target node or node-webkit version to compile against - - `--target_arch=ia32`: Pass the target arch and override the host `arch`. Valid values are 'ia32','x64', or `arm`. - - `--target_platform=win32`: Pass the target platform and override the host `platform`. Valid values are `linux`, `darwin`, `win32`, `sunos`, `freebsd`, `openbsd`, and `aix`. - -Both `--build-from-source` and `--fallback-to-build` can be passed alone or they can provide values. You can pass `--fallback-to-build=false` to override the option as declared in package.json. In addition to being able to pass `--build-from-source` you can also pass `--build-from-source=myapp` where `myapp` is the name of your module. - -For example: `npm install --build-from-source=myapp`. This is useful if: - - - `myapp` is referenced in the package.json of a larger app and therefore `myapp` is being installed as a dependency with `npm install`. - - The larger app also depends on other modules installed with `node-pre-gyp` - - You only want to trigger a source compile for `myapp` and the other modules. - -### Configuring - -This is a guide to configuring your module to use node-pre-gyp. - -#### 1) Add new entries to your `package.json` - - - Add `node-pre-gyp` to `dependencies` - - Add `aws-sdk` as a `devDependency` - - Add a custom `install` script - - Declare a `binary` object - -This looks like: - -```js - "dependencies" : { - "node-pre-gyp": "0.6.x" - }, - "devDependencies": { - "aws-sdk": "2.x" - } - "scripts": { - "install": "node-pre-gyp install --fallback-to-build" - }, - "binary": { - "module_name": "your_module", - "module_path": "./lib/binding/", - "host": "https://your_module.s3-us-west-1.amazonaws.com" - } -``` - -For a full example see [node-addon-examples's package.json](https://github.com/springmeyer/node-addon-example/blob/master/package.json). - -Let's break this down: - - - Dependencies need to list `node-pre-gyp` - - Your devDependencies should list `aws-sdk` so that you can run `node-pre-gyp publish` locally or a CI system. We recommend using `devDependencies` only since `aws-sdk` is large and not needed for `node-pre-gyp install` since it only uses http to fetch binaries - - Your `scripts` section should override the `install` target with `"install": "node-pre-gyp install --fallback-to-build"`. This allows node-pre-gyp to be used instead of the default npm behavior of always source compiling with `node-gyp` directly. - - Your package.json should contain a `binary` section describing key properties you provide to allow node-pre-gyp to package optimally. They are detailed below. - -Note: in the past we recommended putting `node-pre-gyp` in the `bundledDependencies`, but we no longer recommend this. In the past there were npm bugs (with node versions 0.10.x) that could lead to node-pre-gyp not being available at the right time during install (unless we bundled). This should no longer be the case. Also, for a time we recommended using `"preinstall": "npm install node-pre-gyp"` as an alternative method to avoid needing to bundle. But this did not behave predictably across all npm versions - see https://github.com/mapbox/node-pre-gyp/issues/260 for the details. So we do not recommend using `preinstall` to install `node-pre-gyp`. More history on this at https://github.com/strongloop/fsevents/issues/157#issuecomment-265545908. - -##### The `binary` object has three required properties - -###### module_name - -The name of your native node module. This value must: - - - Match the name passed to [the NODE_MODULE macro](http://nodejs.org/api/addons.html#addons_hello_world) - - Must be a valid C variable name (e.g. it cannot contain `-`) - - Should not include the `.node` extension. - -###### module_path - -The location your native module is placed after a build. This should be an empty directory without other Javascript files. This entire directory will be packaged in the binary tarball. When installing from a remote package this directory will be overwritten with the contents of the tarball. - -Note: This property supports variables based on [Versioning](#versioning). - -###### host - -A url to the remote location where you've published tarball binaries (must be `https` not `http`). - -It is highly recommended that you use Amazon S3. The reasons are: - - - Various node-pre-gyp commands like `publish` and `info` only work with an S3 host. - - S3 is a very solid hosting platform for distributing large files. - - We provide detail documentation for using [S3 hosting](#s3-hosting) with node-pre-gyp. - -Why then not require S3? Because while some applications using node-pre-gyp need to distribute binaries as large as 20-30 MB, others might have very small binaries and might wish to store them in a GitHub repo. This is not recommended, but if an author really wants to host in a non-S3 location then it should be possible. - -It should also be mentioned that there is an optional and entirely separate npm module called [node-pre-gyp-github](https://github.com/bchr02/node-pre-gyp-github) which is intended to complement node-pre-gyp and be installed along with it. It provides the ability to store and publish your binaries within your repositories GitHub Releases if you would rather not use S3 directly. Installation and usage instructions can be found [here](https://github.com/bchr02/node-pre-gyp-github), but the basic premise is that instead of using the ```node-pre-gyp publish``` command you would use ```node-pre-gyp-github publish```. - -##### The `binary` object has two optional properties - -###### remote_path - -It **is recommended** that you customize this property. This is an extra path to use for publishing and finding remote tarballs. The default value for `remote_path` is `""` meaning that if you do not provide it then all packages will be published at the base of the `host`. It is recommended to provide a value like `./{name}/v{version}` to help organize remote packages in the case that you choose to publish multiple node addons to the same `host`. - -Note: This property supports variables based on [Versioning](#versioning). - -###### package_name - -It is **not recommended** to override this property unless you are also overriding the `remote_path`. This is the versioned name of the remote tarball containing the binary `.node` module and any supporting files you've placed inside the `module_path` directory. Unless you specify `package_name` in your `package.json` then it defaults to `{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz` which allows your binary to work across node versions, platforms, and architectures. If you are using `remote_path` that is also versioned by `./{module_name}/v{version}` then you could remove these variables from the `package_name` and just use: `{node_abi}-{platform}-{arch}.tar.gz`. Then your remote tarball will be looked up at, for example, `https://example.com/your-module/v0.1.0/node-v11-linux-x64.tar.gz`. - -Avoiding the version of your module in the `package_name` and instead only embedding in a directory name can be useful when you want to make a quick tag of your module that does not change any C++ code. In this case you can just copy binaries to the new version behind the scenes like: - -```sh -aws s3 sync --acl public-read s3://mapbox-node-binary/sqlite3/v3.0.3/ s3://mapbox-node-binary/sqlite3/v3.0.4/ -``` - -Note: This property supports variables based on [Versioning](#versioning). - -#### 2) Add a new target to binding.gyp - -`node-pre-gyp` calls out to `node-gyp` to compile the module and passes variables along like [module_name](#module_name) and [module_path](#module_path). - -A new target must be added to `binding.gyp` that moves the compiled `.node` module from `./build/Release/module_name.node` into the directory specified by `module_path`. - -Add a target like this at the end of your `targets` list: - -```js - { - "target_name": "action_after_build", - "type": "none", - "dependencies": [ "<(module_name)" ], - "copies": [ - { - "files": [ "<(PRODUCT_DIR)/<(module_name).node" ], - "destination": "<(module_path)" - } - ] - } -``` - -For a full example see [node-addon-example's binding.gyp](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/binding.gyp). - -#### 3) Dynamically require your `.node` - -Inside the main js file that requires your addon module you are likely currently doing: - -```js -var binding = require('../build/Release/binding.node'); -``` - -or: - -```js -var bindings = require('./bindings') -``` - -Change those lines to: - -```js -var binary = require('node-pre-gyp'); -var path = require('path'); -var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json'))); -var binding = require(binding_path); -``` - -For a full example see [node-addon-example's index.js](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/index.js#L1-L4) - -#### 4) Build and package your app - -Now build your module from source: - - npm install --build-from-source - -The `--build-from-source` tells `node-pre-gyp` to not look for a remote package and instead dispatch to node-gyp to build. - -Now `node-pre-gyp` should now also be installed as a local dependency so the command line tool it offers can be found at `./node_modules/.bin/node-pre-gyp`. - -#### 5) Test - -Now `npm test` should work just as it did before. - -#### 6) Publish the tarball - -Then package your app: - - ./node_modules/.bin/node-pre-gyp package - -Once packaged, now you can publish: - - ./node_modules/.bin/node-pre-gyp publish - -Currently the `publish` command pushes your binary to S3. This requires: - - - You have installed `aws-sdk` with `npm install aws-sdk` - - You have created a bucket already. - - The `host` points to an S3 http or https endpoint. - - You have configured node-pre-gyp to read your S3 credentials (see [S3 hosting](#s3-hosting) for details). - -You can also host your binaries elsewhere. To do this requires: - - - You manually publish the binary created by the `package` command to an `https` endpoint - - Ensure that the `host` value points to your custom `https` endpoint. - -#### 7) Automate builds - -Now you need to publish builds for all the platforms and node versions you wish to support. This is best automated. - - - See [Appveyor Automation](#appveyor-automation) for how to auto-publish builds on Windows. - - See [Travis Automation](#travis-automation) for how to auto-publish builds on OS X and Linux. - -#### 8) You're done! - -Now publish your module to the npm registry. Users will now be able to install your module from a binary. - -What will happen is this: - -1. `npm install ` will pull from the npm registry -2. npm will run the `install` script which will call out to `node-pre-gyp` -3. `node-pre-gyp` will fetch the binary `.node` module and unpack in the right place -4. Assuming that all worked, you are done - -If a a binary was not available for a given platform and `--fallback-to-build` was used then `node-gyp rebuild` will be called to try to source compile the module. - -## N-API Considerations - -[N-API](https://nodejs.org/api/n-api.html#n_api_n_api) is an ABI-stable alternative to previous technologies such as [nan](https://github.com/nodejs/nan) which are tied to a specific Node runtime engine. N-API is Node runtime engine agnostic and guarantees modules created today will continue to run, without changes, into the future. - -Using `node-pre-gyp` with N-API projects requires a handful of additional configuration values and imposes some additional requirements. - -The most significant difference is that an N-API module can be coded to target multiple N-API versions. Therefore, an N-API module must declare in its `package.json` file which N-API versions the module is designed to run against. In addition, since multiple builds may be required for a single module, path and file names must be specified in way that avoids naming conflicts. - -### The `napi_versions` array property - -An N-API modules must declare in its `package.json` file, the N-API versions the module is intended to support. This is accomplished by including an `napi-versions` array property in the `binary` object. For example: - -```js -"binary": { - "module_name": "your_module", - "module_path": "your_module_path", - "host": "https://your_bucket.s3-us-west-1.amazonaws.com", - "napi_versions": [1,3] - } -``` - -If the `napi_versions` array property is *not* present, `node-pre-gyp` operates as it always has. Including the `napi_versions` array property instructs `node-pre-gyp` that this is a N-API module build. - -When the `napi_versions` array property is present, `node-pre-gyp` fires off multiple operations, one for each of the N-API versions in the array. In the example above, two operations are initiated, one for N-API version 1 and second for N-API version 3. How this version number is communicated is described next. - -### The `napi_build_version` value - -For each of the N-API module operations `node-pre-gyp` initiates, it ensures that the `napi_build_version` is set appropriately. - -This value is of importance in two areas: - -1. The C/C++ code which needs to know against which N-API version it should compile. -2. `node-pre-gyp` itself which must assign appropriate path and file names to avoid collisions. - -### Defining `NAPI_VERSION` for the C/C++ code - -The `napi_build_version` value is communicated to the C/C++ code by adding this code to the `binding.gyp` file: - -``` -"defines": [ - "NAPI_VERSION=<(napi_build_version)", -] -``` - -This ensures that `NAPI_VERSION`, an integer value, is declared appropriately to the C/C++ code for each build. - -> Note that earlier versions of this document recommended defining the symbol `NAPI_BUILD_VERSION`. `NAPI_VERSION` is prefered because it used by the N-API C/C++ headers to configure the specific N-API veriosn being requested. - -### Path and file naming requirements in `package.json` - -Since `node-pre-gyp` fires off multiple operations for each request, it is essential that path and file names be created in such a way as to avoid collisions. This is accomplished by imposing additional path and file naming requirements. - -Specifically, when performing N-API builds, the `{napi_build_version}` text configuration value *must* be present in the `module_path` property. In addition, the `{napi_build_version}` text configuration value *must* be present in either the `remote_path` or `package_name` property. (No problem if it's in both.) - -Here's an example: - -```js -"binary": { - "module_name": "your_module", - "module_path": "./lib/binding/napi-v{napi_build_version}", - "remote_path": "./{module_name}/v{version}/{configuration}/", - "package_name": "{platform}-{arch}-napi-v{napi_build_version}.tar.gz", - "host": "https://your_bucket.s3-us-west-1.amazonaws.com", - "napi_versions": [1,3] - } -``` - -## Supporting both N-API and NAN builds - -You may have a legacy native add-on that you wish to continue supporting for those versions of Node that do not support N-API, as you add N-API support for later Node versions. This can be accomplished by specifying the `node_napi_label` configuration value in the package.json `binary.package_name` property. - -Placing the configuration value `node_napi_label` in the package.json `binary.package_name` property instructs `node-pre-gyp` to build all viable N-API binaries supported by the current Node instance. If the current Node instance does not support N-API, `node-pre-gyp` will request a traditional, non-N-API build. - -The configuration value `node_napi_label` is set by `node-pre-gyp` to the type of build created, `napi` or `node`, and the version number. For N-API builds, the string contains the N-API version nad has values like `napi-v3`. For traditional, non-N-API builds, the string contains the ABI version with values like `node-v46`. - -Here's how the `binary` configuration above might be changed to support both N-API and NAN builds: - -```js -"binary": { - "module_name": "your_module", - "module_path": "./lib/binding/{node_napi_label}", - "remote_path": "./{module_name}/v{version}/{configuration}/", - "package_name": "{platform}-{arch}-{node_napi_label}.tar.gz", - "host": "https://your_bucket.s3-us-west-1.amazonaws.com", - "napi_versions": [1,3] - } -``` - -The C/C++ symbol `NAPI_VERSION` can be used to distinguish N-API and non-N-API builds. The value of `NAPI_VERSION` is set to the integer N-API version for N-API builds and is set to `0` for non-N-API builds. - -For example: - -```C -#if NAPI_VERSION -// N-API code goes here -#else -// NAN code goes here -#endif -``` - -### Two additional configuration values - -The following two configuration values, which were implemented in previous versions of `node-pre-gyp`, continue to exist, but have been replaced by the `node_napi_label` configuration value described above. - -1. `napi_version` If N-API is supported by the currently executing Node instance, this value is the N-API version number supported by Node. If N-API is not supported, this value is an empty string. - -2. `node_abi_napi` If the value returned for `napi_version` is non empty, this value is `'napi'`. If the value returned for `napi_version` is empty, this value is the value returned for `node_abi`. - -These values are present for use in the `binding.gyp` file and may be used as `{napi_version}` and `{node_abi_napi}` for text substituion in the `binary` properties of the `package.json` file. - -## S3 Hosting - -You can host wherever you choose but S3 is cheap, `node-pre-gyp publish` expects it, and S3 can be integrated well with [Travis.ci](http://travis-ci.org) to automate builds for OS X and Ubuntu, and with [Appveyor](http://appveyor.com) to automate builds for Windows. Here is an approach to do this: - -First, get setup locally and test the workflow: - -#### 1) Create an S3 bucket - -And have your **key** and **secret key** ready for writing to the bucket. - -It is recommended to create a IAM user with a policy that only gives permissions to the specific bucket you plan to publish to. This can be done in the [IAM console](https://console.aws.amazon.com/iam/) by: 1) adding a new user, 2) choosing `Attach User Policy`, 3) Using the `Policy Generator`, 4) selecting `Amazon S3` for the service, 5) adding the actions: `DeleteObject`, `GetObject`, `GetObjectAcl`, `ListBucket`, `PutObject`, `PutObjectAcl`, 6) adding an ARN of `arn:aws:s3:::bucket/*` (replacing `bucket` with your bucket name), and finally 7) clicking `Add Statement` and saving the policy. It should generate a policy like: - -```js -{ - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "Stmt1394587197000", - "Effect": "Allow", - "Action": [ - "s3:DeleteObject", - "s3:GetObject", - "s3:GetObjectAcl", - "s3:ListBucket", - "s3:PutObject", - "s3:PutObjectAcl" - ], - "Resource": [ - "arn:aws:s3:::node-pre-gyp-tests/*" - ] - } - ] -} -``` - -#### 2) Install node-pre-gyp - -Either install it globally: - - npm install node-pre-gyp -g - -Or put the local version on your PATH - - export PATH=`pwd`/node_modules/.bin/:$PATH - -#### 3) Configure AWS credentials - -There are several ways to do this. - -You can use any of the methods described at http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html. - -Or you can create a `~/.node_pre_gyprc` - -Or pass options in any way supported by [RC](https://github.com/dominictarr/rc#standards) - -A `~/.node_pre_gyprc` looks like: - -```js -{ - "accessKeyId": "xxx", - "secretAccessKey": "xxx" -} -``` - -Another way is to use your environment: - - export node_pre_gyp_accessKeyId=xxx - export node_pre_gyp_secretAccessKey=xxx - -You may also need to specify the `region` if it is not explicit in the `host` value you use. The `bucket` can also be specified but it is optional because `node-pre-gyp` will detect it from the `host` value. - -#### 4) Package and publish your build - -Install the `aws-sdk`: - - npm install aws-sdk - -Then publish: - - node-pre-gyp package publish - -Note: if you hit an error like `Hostname/IP doesn't match certificate's altnames` it may mean that you need to provide the `region` option in your config. - -## Appveyor Automation - -[Appveyor](http://www.appveyor.com/) can build binaries and publish the results per commit and supports: - - - Windows Visual Studio 2013 and related compilers - - Both 64 bit (x64) and 32 bit (x86) build configurations - - Multiple Node.js versions - -For an example of doing this see [node-sqlite3's appveyor.yml](https://github.com/mapbox/node-sqlite3/blob/master/appveyor.yml). - -Below is a guide to getting set up: - -#### 1) Create a free Appveyor account - -Go to https://ci.appveyor.com/signup/free and sign in with your GitHub account. - -#### 2) Create a new project - -Go to https://ci.appveyor.com/projects/new and select the GitHub repo for your module - -#### 3) Add appveyor.yml and push it - -Once you have committed an `appveyor.yml` ([appveyor.yml reference](http://www.appveyor.com/docs/appveyor-yml)) to your GitHub repo and pushed it AppVeyor should automatically start building your project. - -#### 4) Create secure variables - -Encrypt your S3 AWS keys by going to and hitting the `encrypt` button. - -Then paste the result into your `appveyor.yml` - -```yml -environment: - node_pre_gyp_accessKeyId: - secure: Dn9HKdLNYvDgPdQOzRq/DqZ/MPhjknRHB1o+/lVU8MA= - node_pre_gyp_secretAccessKey: - secure: W1rwNoSnOku1r+28gnoufO8UA8iWADmL1LiiwH9IOkIVhDTNGdGPJqAlLjNqwLnL -``` - -NOTE: keys are per account but not per repo (this is difference than Travis where keys are per repo but not related to the account used to encrypt them). - -#### 5) Hook up publishing - -Just put `node-pre-gyp package publish` in your `appveyor.yml` after `npm install`. - -#### 6) Publish when you want - -You might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`: - - SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE% - if not "%CM%" == "%CM:[publish binary]=%" node-pre-gyp --msvs_version=2013 publish - -If your commit message contains special characters (e.g. `&`) this method might fail. An alternative is to use PowerShell, which gives you additional possibilities, like ignoring case by using `ToLower()`: - - ps: if($env:APPVEYOR_REPO_COMMIT_MESSAGE.ToLower().Contains('[publish binary]')) { node-pre-gyp --msvs_version=2013 publish } - -Remember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package. - -## Travis Automation - -[Travis](https://travis-ci.org/) can push to S3 after a successful build and supports both: - - - Ubuntu Precise and OS X (64 bit) - - Multiple Node.js versions - -For an example of doing this see [node-add-example's .travis.yml](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/.travis.yml). - -Note: if you need 32 bit binaries, this can be done from a 64 bit Travis machine. See [the node-sqlite3 scripts for an example of doing this](https://github.com/mapbox/node-sqlite3/blob/bae122aa6a2b8a45f6b717fab24e207740e32b5d/scripts/build_against_node.sh#L54-L74). - -Below is a guide to getting set up: - -#### 1) Install the Travis gem - - gem install travis - -#### 2) Create secure variables - -Make sure you run this command from within the directory of your module. - -Use `travis-encrypt` like: - - travis encrypt node_pre_gyp_accessKeyId=${node_pre_gyp_accessKeyId} - travis encrypt node_pre_gyp_secretAccessKey=${node_pre_gyp_secretAccessKey} - -Then put those values in your `.travis.yml` like: - -```yaml -env: - global: - - secure: F+sEL/v56CzHqmCSSES4pEyC9NeQlkoR0Gs/ZuZxX1ytrj8SKtp3MKqBj7zhIclSdXBz4Ev966Da5ctmcTd410p0b240MV6BVOkLUtkjZJyErMBOkeb8n8yVfSoeMx8RiIhBmIvEn+rlQq+bSFis61/JkE9rxsjkGRZi14hHr4M= - - secure: o2nkUQIiABD139XS6L8pxq3XO5gch27hvm/gOdV+dzNKc/s2KomVPWcOyXNxtJGhtecAkABzaW8KHDDi5QL1kNEFx6BxFVMLO8rjFPsMVaBG9Ks6JiDQkkmrGNcnVdxI/6EKTLHTH5WLsz8+J7caDBzvKbEfTux5EamEhxIWgrI= -``` - -More details on Travis encryption at http://about.travis-ci.org/docs/user/encryption-keys/. - -#### 3) Hook up publishing - -Just put `node-pre-gyp package publish` in your `.travis.yml` after `npm install`. - -##### OS X publishing - -If you want binaries for OS X in addition to linux you can enable [multi-os for Travis](http://docs.travis-ci.com/user/multi-os/#Setting-.travis.yml) - -Use a configuration like: - -```yml - -language: cpp - -os: -- linux -- osx - -env: - matrix: - - NODE_VERSION="4" - - NODE_VERSION="6" - -before_install: -- rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm -- source ~/.nvm/nvm.sh -- nvm install $NODE_VERSION -- nvm use $NODE_VERSION -``` - -See [Travis OS X Gotchas](#travis-os-x-gotchas) for why we replace `language: node_js` and `node_js:` sections with `language: cpp` and a custom matrix. - -Also create platform specific sections for any deps that need install. For example if you need libpng: - -```yml -- if [ $(uname -s) == 'Linux' ]; then apt-get install libpng-dev; fi; -- if [ $(uname -s) == 'Darwin' ]; then brew install libpng; fi; -``` - -For detailed multi-OS examples see [node-mapnik](https://github.com/mapnik/node-mapnik/blob/master/.travis.yml) and [node-sqlite3](https://github.com/mapbox/node-sqlite3/blob/master/.travis.yml). - -##### Travis OS X Gotchas - -First, unlike the Travis Linux machines, the OS X machines do not put `node-pre-gyp` on PATH by default. To do so you will need to: - -```sh -export PATH=$(pwd)/node_modules/.bin:${PATH} -``` - -Second, the OS X machines do not support using a matrix for installing different Node.js versions. So you need to bootstrap the installation of Node.js in a cross platform way. - -By doing: - -```yml -env: - matrix: - - NODE_VERSION="4" - - NODE_VERSION="6" - -before_install: - - rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm - - source ~/.nvm/nvm.sh - - nvm install $NODE_VERSION - - nvm use $NODE_VERSION -``` - -You can easily recreate the previous behavior of this matrix: - -```yml -node_js: - - "4" - - "6" -``` - -#### 4) Publish when you want - -You might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`: - - COMMIT_MESSAGE=$(git log --format=%B --no-merges -n 1 | tr -d '\n') - if [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]]; then node-pre-gyp publish; fi; - -Then you can trigger new binaries to be built like: - - git commit -a -m "[publish binary]" - -Or, if you don't have any changes to make simply run: - - git commit --allow-empty -m "[publish binary]" - -WARNING: if you are working in a pull request and publishing binaries from there then you will want to avoid double publishing when Travis CI builds both the `push` and `pr`. You only want to run the publish on the `push` commit. See https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/is_pr_merge.sh which is called from https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/publish.sh for an example of how to do this. - -Remember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package. To automate the publishing of your entire package to npm on Travis see http://about.travis-ci.org/docs/user/deployment/npm/ - -# Versioning - -The `binary` properties of `module_path`, `remote_path`, and `package_name` support variable substitution. The strings are evaluated by `node-pre-gyp` depending on your system and any custom build flags you passed. - - - `node_abi`: The node C++ `ABI` number. This value is available in Javascript as `process.versions.modules` as of [`>= v0.10.4 >= v0.11.7`](https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e) and in C++ as the `NODE_MODULE_VERSION` define much earlier. For versions of Node before this was available we fallback to the V8 major and minor version. - - `platform` matches node's `process.platform` like `linux`, `darwin`, and `win32` unless the user passed the `--target_platform` option to override. - - `arch` matches node's `process.arch` like `x64` or `ia32` unless the user passes the `--target_arch` option to override. - - `libc` matches `require('detect-libc').family` like `glibc` or `musl` unless the user passes the `--target_libc` option to override. - - `configuration` - Either 'Release' or 'Debug' depending on if `--debug` is passed during the build. - - `module_name` - the `binary.module_name` attribute from `package.json`. - - `version` - the semver `version` value for your module from `package.json` (NOTE: ignores the `semver.build` property). - - `major`, `minor`, `patch`, and `prelease` match the individual semver values for your module's `version` - - `build` - the sevmer `build` value. For example it would be `this.that` if your package.json `version` was `v1.0.0+this.that` - - `prerelease` - the semver `prerelease` value. For example it would be `alpha.beta` if your package.json `version` was `v1.0.0-alpha.beta` - - -The options are visible in the code at - -# Download binary files from a mirror - -S3 is broken in China for the well known reason. - -Using the `npm` config argument: `--{module_name}_binary_host_mirror` can download binary files through a mirror. - -e.g.: Install [v8-profiler](https://www.npmjs.com/package/v8-profiler) from `npm`. - -```bash -$ npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/ -``` diff --git a/node_modules/node-pre-gyp/appveyor.yml b/node_modules/node-pre-gyp/appveyor.yml deleted file mode 100644 index 2e74dbc..0000000 --- a/node_modules/node-pre-gyp/appveyor.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: Visual Studio 2015 - -environment: - matrix: - - nodejs_version: 6 - - nodejs_version: 10 - -platform: - - x64 - - x86 - -shallow_clone: true - -install: - - ps: Install-Product node $env:nodejs_version $env:Platform - - ps: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force - - npm config get - - node --version - - npm --version - - node -e "console.log(process.arch);" - - IF /I "%PLATFORM%" == "x64" set PATH=C:\Python27-x64;%PATH% - - IF /I "%PLATFORM%" == "x86" SET PATH=C:\python27;%PATH% - - IF /I "%PLATFORM%" == "x64" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 - - IF /I "%PLATFORM%" == "x86" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 - - npm install - - npm test - -build: off -test: off -deploy: off diff --git a/node_modules/node-pre-gyp/bin/node-pre-gyp b/node_modules/node-pre-gyp/bin/node-pre-gyp deleted file mode 100755 index 737b002..0000000 --- a/node_modules/node-pre-gyp/bin/node-pre-gyp +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env node - -"use strict"; - -/** - * Set the title. - */ - -process.title = 'node-pre-gyp'; - -/** - * Module dependencies. - */ - -var node_pre_gyp = require('../'); -var log = require('npmlog'); - -/** - * Process and execute the selected commands. - */ - -var prog = new node_pre_gyp.Run(); -var completed = false; -prog.parseArgv(process.argv); - -if (prog.todo.length === 0) { - if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) { - console.log('v%s', prog.version); - return process.exit(0); - } else if (~process.argv.indexOf('-h') || ~process.argv.indexOf('--help')) { - console.log('%s', prog.usage()); - return process.exit(0); - } - console.log('%s', prog.usage()); - return process.exit(1); -} - -// if --no-color is passed -if (prog.opts && prog.opts.hasOwnProperty('color') && !prog.opts.color) { - log.disableColor(); -} - -log.info('it worked if it ends with', 'ok'); -log.verbose('cli', process.argv); -log.info('using', process.title + '@%s', prog.version); -log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch); - - -/** - * Change dir if -C/--directory was passed. - */ - -var dir = prog.opts.directory; -if (dir) { - var fs = require('fs'); - try { - var stat = fs.statSync(dir); - if (stat.isDirectory()) { - log.info('chdir', dir); - process.chdir(dir); - } else { - log.warn('chdir', dir + ' is not a directory'); - } - } catch (e) { - if (e.code === 'ENOENT') { - log.warn('chdir', dir + ' is not a directory'); - } else { - log.warn('chdir', 'error during chdir() "%s"', e.message); - } - } -} - -function run () { - var command = prog.todo.shift(); - if (!command) { - // done! - completed = true; - log.info('ok'); - return; - } - - prog.commands[command.name](command.args, function (err) { - if (err) { - log.error(command.name + ' error'); - log.error('stack', err.stack); - errorMessage(); - log.error('not ok'); - console.log(err.message); - return process.exit(1); - } - var args_array = [].slice.call(arguments, 1); - if (args_array.length) { - console.log.apply(console, args_array); - } - // now run the next command in the queue - process.nextTick(run); - }); -} - -process.on('exit', function (code) { - if (!completed && !code) { - log.error('Completion callback never invoked!'); - issueMessage(); - process.exit(6); - } -}); - -process.on('uncaughtException', function (err) { - log.error('UNCAUGHT EXCEPTION'); - log.error('stack', err.stack); - issueMessage(); - process.exit(7); -}); - -function errorMessage () { - // copied from npm's lib/util/error-handler.js - var os = require('os'); - log.error('System', os.type() + ' ' + os.release()); - log.error('command', process.argv.map(JSON.stringify).join(' ')); - log.error('cwd', process.cwd()); - log.error('node -v', process.version); - log.error(process.title+' -v', 'v' + prog.package.version); -} - -function issueMessage () { - errorMessage(); - log.error('', [ 'This is a bug in `'+process.title+'`.', - 'Try to update '+process.title+' and file an issue if it does not help:', - ' ', - ].join('\n')); -} - -// start running the given commands! -run(); diff --git a/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd b/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd deleted file mode 100644 index 46e14b5..0000000 --- a/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -node "%~dp0\node-pre-gyp" %* diff --git a/node_modules/node-pre-gyp/contributing.md b/node_modules/node-pre-gyp/contributing.md deleted file mode 100644 index 4038fa6..0000000 --- a/node_modules/node-pre-gyp/contributing.md +++ /dev/null @@ -1,10 +0,0 @@ -# Contributing - - -### Releasing a new version: - -- Ensure tests are passing on travis and appveyor -- Run `node scripts/abi_crosswalk.js` and commit any changes -- Update the changelog -- Tag a new release like: `git tag -a v0.6.34 -m "tagging v0.6.34" && git push --tags` -- Run `npm publish` diff --git a/node_modules/node-pre-gyp/lib/build.js b/node_modules/node-pre-gyp/lib/build.js deleted file mode 100644 index 43c137e..0000000 --- a/node_modules/node-pre-gyp/lib/build.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; - -module.exports = exports = build; - -exports.usage = 'Attempts to compile the module by dispatching to node-gyp or nw-gyp'; - -var napi = require('./util/napi.js'); -var compile = require('./util/compile.js'); -var handle_gyp_opts = require('./util/handle_gyp_opts.js'); -var configure = require('./configure.js'); - -function do_build(gyp,argv,callback) { - handle_gyp_opts(gyp,argv,function(err,result) { - var final_args = ['build'].concat(result.gyp).concat(result.pre); - if (result.unparsed.length > 0) { - final_args = final_args. - concat(['--']). - concat(result.unparsed); - } - if (!err && result.opts.napi_build_version) { - napi.swap_build_dir_in(result.opts.napi_build_version); - } - compile.run_gyp(final_args,result.opts,function(err) { - if (result.opts.napi_build_version) { - napi.swap_build_dir_out(result.opts.napi_build_version); - } - return callback(err); - }); - }); -} - -function build(gyp, argv, callback) { - - // Form up commands to pass to node-gyp: - // We map `node-pre-gyp build` to `node-gyp configure build` so that we do not - // trigger a clean and therefore do not pay the penalty of a full recompile - if (argv.length && (argv.indexOf('rebuild') > -1)) { - argv.shift(); // remove `rebuild` - // here we map `node-pre-gyp rebuild` to `node-gyp rebuild` which internally means - // "clean + configure + build" and triggers a full recompile - compile.run_gyp(['clean'],{},function(err) { - if (err) return callback(err); - configure(gyp,argv,function(err) { - if (err) return callback(err); - return do_build(gyp,argv,callback); - }); - }); - } else { - return do_build(gyp,argv,callback); - } -} diff --git a/node_modules/node-pre-gyp/lib/clean.js b/node_modules/node-pre-gyp/lib/clean.js deleted file mode 100644 index e2da17b..0000000 --- a/node_modules/node-pre-gyp/lib/clean.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -module.exports = exports = clean; - -exports.usage = 'Removes the entire folder containing the compiled .node module'; - -var fs = require('fs'); -var rm = require('rimraf'); -var exists = require('fs').exists || require('path').exists; -var versioning = require('./util/versioning.js'); -var napi = require('./util/napi.js'); -var path = require('path'); - -function clean (gyp, argv, callback) { - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var napi_build_version = napi.get_napi_build_version_from_command_args(argv); - var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); - var to_delete = opts.module_path; - if (!to_delete) { - return callback(new Error("module_path is empty, refusing to delete")); - } else if (path.normalize(to_delete) == path.normalize(process.cwd())) { - return callback(new Error("module_path is not set, refusing to delete")); - } else { - exists(to_delete, function(found) { - if (found) { - if (!gyp.opts.silent_clean) console.log('['+package_json.name+'] Removing "%s"', to_delete); - return rm(to_delete, callback); - } - return callback(); - }); - } -} diff --git a/node_modules/node-pre-gyp/lib/configure.js b/node_modules/node-pre-gyp/lib/configure.js deleted file mode 100644 index a6e3438..0000000 --- a/node_modules/node-pre-gyp/lib/configure.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -module.exports = exports = configure; - -exports.usage = 'Attempts to configure node-gyp or nw-gyp build'; - -var napi = require('./util/napi.js'); -var compile = require('./util/compile.js'); -var handle_gyp_opts = require('./util/handle_gyp_opts.js'); - -function configure(gyp, argv, callback) { - handle_gyp_opts(gyp,argv,function(err,result) { - var final_args = result.gyp.concat(result.pre); - // pull select node-gyp configure options out of the npm environ - var known_gyp_args = ['dist-url','python','nodedir','msvs_version']; - known_gyp_args.forEach(function(key) { - var val = gyp.opts[key] || gyp.opts[key.replace('-','_')]; - if (val) { - final_args.push('--'+key+'='+val); - } - }); - // --ensure=false tell node-gyp to re-install node development headers - // but it is only respected by node-gyp install, so we have to call install - // as a separate step if the user passes it - if (gyp.opts.ensure === false) { - var install_args = final_args.concat(['install','--ensure=false']); - compile.run_gyp(install_args,result.opts,function(err) { - if (err) return callback(err); - if (result.unparsed.length > 0) { - final_args = final_args. - concat(['--']). - concat(result.unparsed); - } - compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) { - return callback(err); - }); - }); - } else { - if (result.unparsed.length > 0) { - final_args = final_args. - concat(['--']). - concat(result.unparsed); - } - compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) { - if (!err && result.opts.napi_build_version) { - napi.swap_build_dir_out(result.opts.napi_build_version); - } - return callback(err); - }); - } - }); -} diff --git a/node_modules/node-pre-gyp/lib/info.js b/node_modules/node-pre-gyp/lib/info.js deleted file mode 100644 index aff9bf8..0000000 --- a/node_modules/node-pre-gyp/lib/info.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -module.exports = exports = unpublish; - -exports.usage = 'Lists all published binaries (requires aws-sdk)'; - -var fs = require('fs'); -var log = require('npmlog'); -var versioning = require('./util/versioning.js'); -var s3_setup = require('./util/s3_setup.js'); -var config = require('rc')("node_pre_gyp",{acl:"public-read"}); - -function unpublish(gyp, argv, callback) { - var AWS = require("aws-sdk"); - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var opts = versioning.evaluate(package_json, gyp.opts); - s3_setup.detect(opts.hosted_path,config); - AWS.config.update(config); - var s3 = new AWS.S3(); - var s3_opts = { Bucket: config.bucket, - Prefix: config.prefix - }; - s3.listObjects(s3_opts, function(err, meta){ - if (err && err.code == 'NotFound') { - return callback(new Error('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix)); - } else if(err) { - return callback(err); - } else { - log.verbose(JSON.stringify(meta,null,1)); - if (meta && meta.Contents) { - meta.Contents.forEach(function(obj) { - console.log(obj.Key); - }); - } else { - console.error('['+package_json.name+'] No objects found at https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix ); - } - return callback(); - } - }); -} diff --git a/node_modules/node-pre-gyp/lib/install.js b/node_modules/node-pre-gyp/lib/install.js deleted file mode 100644 index e854918..0000000 --- a/node_modules/node-pre-gyp/lib/install.js +++ /dev/null @@ -1,245 +0,0 @@ -"use strict"; - -module.exports = exports = install; - -exports.usage = 'Attempts to install pre-built binary for module'; - -var fs = require('fs'); -var path = require('path'); -var log = require('npmlog'); -var existsAsync = fs.exists || path.exists; -var versioning = require('./util/versioning.js'); -var napi = require('./util/napi.js'); -var mkdirp = require('mkdirp'); - -var npgVersion = 'unknown'; -try { - // Read own package.json to get the current node-pre-pyp version. - var ownPackageJSON = fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'); - npgVersion = JSON.parse(ownPackageJSON).version; -} catch (e) {} - -var http_get = { - impl: undefined, - type: undefined -}; - -try { - http_get.impl = require('request'); - http_get.type = 'request'; - log.warn("Using request for node-pre-gyp https download"); -} catch (e) { - http_get.impl = require('needle'); - http_get.type = 'needle'; - log.warn("Using needle for node-pre-gyp https download"); -} - -function download(uri,opts,callback) { - log.http('GET', uri); - - var req = null; - - // Try getting version info from the currently running npm. - var envVersionInfo = process.env.npm_config_user_agent || - 'node ' + process.version; - - var requestOpts = { - uri: uri.replace('+','%2B'), - headers: { - 'User-Agent': 'node-pre-gyp (v' + npgVersion + ', ' + envVersionInfo + ')' - }, - follow_max: 10, - }; - - if (opts.cafile) { - try { - requestOpts.ca = fs.readFileSync(opts.cafile); - } catch (e) { - return callback(e); - } - } else if (opts.ca) { - requestOpts.ca = opts.ca; - } - - var proxyUrl = opts.proxy || - process.env.http_proxy || - process.env.HTTP_PROXY || - process.env.npm_config_proxy; - if (proxyUrl) { - if (/^https?:\/\//i.test(proxyUrl)) { - log.verbose('download', 'using proxy url: "%s"', proxyUrl); - requestOpts.proxy = proxyUrl; - } else { - log.warn('download', 'ignoring invalid "proxy" config setting: "%s"', proxyUrl); - } - } - try { - req = http_get.impl.get(requestOpts.uri, requestOpts); - } catch (e) { - return callback(e); - } - if (req) { - req.on('response', function (res) { - log.http(res.statusCode, uri); - }); - } - return callback(null,req); -} - -function place_binary(from,to,opts,callback) { - download(from,opts,function(err,req) { - if (err) return callback(err); - if (!req) return callback(new Error("empty req")); - var badDownload = false; - var extractCount = 0; - var hasResponse = false; - var tar = require('tar'); - - function afterTarball(err) { - if (err) return callback(err); - if (badDownload) return callback(new Error("bad download")); - if (extractCount === 0) { - return callback(new Error('There was a fatal problem while downloading/extracting the tarball')); - } - log.info('tarball', 'done parsing tarball'); - callback(); - } - - function filter_func(entry) { - log.info('install','unpacking ' + entry.path); - extractCount++; - } - - // for request compatibility - req.on('error', function(err) { - badDownload = true; - return callback(err); - }); - - // for needle compatibility - req.on('err', function(err) { - badDownload = true; - return callback(err); - }); - - req.on('close', function () { - if (!hasResponse) { - return callback(new Error('Connection closed while downloading tarball file')); - } - }); - - req.on('response', function(res) { - // ignore redirects, needle handles these automatically. - if (http_get.type === 'needle' && res.headers.hasOwnProperty('location') && res.headers.location !== '') { - return; - } - hasResponse = true; - if (res.statusCode !== 200) { - badDownload = true; - var err = new Error(res.statusCode + ' status code downloading tarball ' + from); - err.statusCode = res.statusCode; - return callback(err); - } - // start unzipping and untaring - req.pipe(tar.extract({ - cwd: to, - strip: 1, - onentry: filter_func - }).on('close', afterTarball).on('error', callback)); - }); - }); -} - -function do_build(gyp,argv,callback) { - var args = ['rebuild'].concat(argv); - gyp.todo.push( { name: 'build', args: args } ); - process.nextTick(callback); -} - -function print_fallback_error(err,opts,package_json) { - var fallback_message = ' (falling back to source compile with node-gyp)'; - var full_message = ''; - if (err.statusCode !== undefined) { - // If we got a network response it but failed to download - // it means remote binaries are not available, so let's try to help - // the user/developer with the info to debug why - full_message = "Pre-built binaries not found for " + package_json.name + "@" + package_json.version; - full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")"; - full_message += fallback_message; - log.warn("Tried to download(" + err.statusCode + "): " + opts.hosted_tarball); - log.warn(full_message); - log.http(err.message); - } else { - // If we do not have a statusCode that means an unexpected error - // happened and prevented an http response, so we output the exact error - full_message = "Pre-built binaries not installable for " + package_json.name + "@" + package_json.version; - full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")"; - full_message += fallback_message; - log.warn(full_message); - log.warn("Hit error " + err.message); - } -} - -function install(gyp, argv, callback) { - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var napi_build_version = napi.get_napi_build_version_from_command_args(argv); - var source_build = gyp.opts['build-from-source'] || gyp.opts.build_from_source; - var update_binary = gyp.opts['update-binary'] || gyp.opts.update_binary; - var should_do_source_build = source_build === package_json.name || (source_build === true || source_build === 'true'); - if (should_do_source_build) { - log.info('build','requesting source compile'); - return do_build(gyp,argv,callback); - } else { - var fallback_to_build = gyp.opts['fallback-to-build'] || gyp.opts.fallback_to_build; - var should_do_fallback_build = fallback_to_build === package_json.name || (fallback_to_build === true || fallback_to_build === 'true'); - // but allow override from npm - if (process.env.npm_config_argv) { - var cooked = JSON.parse(process.env.npm_config_argv).cooked; - var match = cooked.indexOf("--fallback-to-build"); - if (match > -1 && cooked.length > match && cooked[match+1] == "false") { - should_do_fallback_build = false; - log.info('install','Build fallback disabled via npm flag: --fallback-to-build=false'); - } - } - var opts; - try { - opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); - } catch (err) { - return callback(err); - } - - opts.ca = gyp.opts.ca; - opts.cafile = gyp.opts.cafile; - - var from = opts.hosted_tarball; - var to = opts.module_path; - var binary_module = path.join(to,opts.module_name + '.node'); - existsAsync(binary_module,function(found) { - if (found && !update_binary) { - console.log('['+package_json.name+'] Success: "' + binary_module + '" already installed'); - console.log('Pass --update-binary to reinstall or --build-from-source to recompile'); - return callback(); - } else { - if (!update_binary) log.info('check','checked for "' + binary_module + '" (not found)'); - mkdirp(to,function(err) { - if (err) { - after_place(err); - } else { - place_binary(from,to,opts,after_place); - } - }); - } - function after_place(err) { - if (err && should_do_fallback_build) { - print_fallback_error(err,opts,package_json); - return do_build(gyp,argv,callback); - } else if (err) { - return callback(err); - } else { - console.log('['+package_json.name+'] Success: "' + binary_module + '" is installed via remote'); - return callback(); - } - } - }); - } -} diff --git a/node_modules/node-pre-gyp/lib/node-pre-gyp.js b/node_modules/node-pre-gyp/lib/node-pre-gyp.js deleted file mode 100644 index 7d09b5f..0000000 --- a/node_modules/node-pre-gyp/lib/node-pre-gyp.js +++ /dev/null @@ -1,203 +0,0 @@ -"use strict"; - -/** - * Module exports. - */ - -module.exports = exports; - -/** - * Module dependencies. - */ - -var fs = require('fs'); -var path = require('path'); -var nopt = require('nopt'); -var log = require('npmlog'); -log.disableProgress(); -var napi = require('./util/napi.js'); - -var EE = require('events').EventEmitter; -var inherits = require('util').inherits; -var commands = [ - 'clean', - 'install', - 'reinstall', - 'build', - 'rebuild', - 'package', - 'testpackage', - 'publish', - 'unpublish', - 'info', - 'testbinary', - 'reveal', - 'configure' - ]; -var aliases = {}; - -// differentiate node-pre-gyp's logs from npm's -log.heading = 'node-pre-gyp'; - -exports.find = require('./pre-binding').find; - -function Run() { - var self = this; - - this.commands = {}; - - commands.forEach(function (command) { - self.commands[command] = function (argv, callback) { - log.verbose('command', command, argv); - return require('./' + command)(self, argv, callback); - }; - }); -} -inherits(Run, EE); -exports.Run = Run; -var proto = Run.prototype; - -/** - * Export the contents of the package.json. - */ - -proto.package = require('../package.json'); - -/** - * nopt configuration definitions - */ - -proto.configDefs = { - help: Boolean, // everywhere - arch: String, // 'configure' - debug: Boolean, // 'build' - directory: String, // bin - proxy: String, // 'install' - loglevel: String, // everywhere -}; - -/** - * nopt shorthands - */ - -proto.shorthands = { - release: '--no-debug', - C: '--directory', - debug: '--debug', - j: '--jobs', - silent: '--loglevel=silent', - silly: '--loglevel=silly', - verbose: '--loglevel=verbose', -}; - -/** - * expose the command aliases for the bin file to use. - */ - -proto.aliases = aliases; - -/** - * Parses the given argv array and sets the 'opts', - * 'argv' and 'command' properties. - */ - -proto.parseArgv = function parseOpts (argv) { - this.opts = nopt(this.configDefs, this.shorthands, argv); - this.argv = this.opts.argv.remain.slice(); - var commands = this.todo = []; - - // create a copy of the argv array with aliases mapped - argv = this.argv.map(function (arg) { - // is this an alias? - if (arg in this.aliases) { - arg = this.aliases[arg]; - } - return arg; - }, this); - - // process the mapped args into "command" objects ("name" and "args" props) - argv.slice().forEach(function (arg) { - if (arg in this.commands) { - var args = argv.splice(0, argv.indexOf(arg)); - argv.shift(); - if (commands.length > 0) { - commands[commands.length - 1].args = args; - } - commands.push({ name: arg, args: [] }); - } - }, this); - if (commands.length > 0) { - commands[commands.length - 1].args = argv.splice(0); - } - - // expand commands entries for multiple napi builds - var dir = this.opts.directory; - if (dir == null) dir = process.cwd(); - var package_json = JSON.parse(fs.readFileSync(path.join(dir,'package.json'))); - - this.todo = napi.expand_commands (package_json, this.opts, commands); - - // support for inheriting config env variables from npm - var npm_config_prefix = 'npm_config_'; - Object.keys(process.env).forEach(function (name) { - if (name.indexOf(npm_config_prefix) !== 0) return; - var val = process.env[name]; - if (name === npm_config_prefix + 'loglevel') { - log.level = val; - } else { - // add the user-defined options to the config - name = name.substring(npm_config_prefix.length); - // avoid npm argv clobber already present args - // which avoids problem of 'npm test' calling - // script that runs unique npm install commands - if (name === 'argv') { - if (this.opts.argv && - this.opts.argv.remain && - this.opts.argv.remain.length) { - // do nothing - } else { - this.opts[name] = val; - } - } else { - this.opts[name] = val; - } - } - }, this); - - if (this.opts.loglevel) { - log.level = this.opts.loglevel; - } - log.resume(); -}; - -/** - * Returns the usage instructions for node-pre-gyp. - */ - -proto.usage = function usage () { - var str = [ - '', - ' Usage: node-pre-gyp [options]', - '', - ' where is one of:', - commands.map(function (c) { - return ' - ' + c + ' - ' + require('./' + c).usage; - }).join('\n'), - '', - 'node-pre-gyp@' + this.version + ' ' + path.resolve(__dirname, '..'), - 'node@' + process.versions.node - ].join('\n'); - return str; -}; - -/** - * Version number getter. - */ - -Object.defineProperty(proto, 'version', { - get: function () { - return this.package.version; - }, - enumerable: true -}); - diff --git a/node_modules/node-pre-gyp/lib/package.js b/node_modules/node-pre-gyp/lib/package.js deleted file mode 100644 index 4959265..0000000 --- a/node_modules/node-pre-gyp/lib/package.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; - -module.exports = exports = _package; - -exports.usage = 'Packs binary (and enclosing directory) into locally staged tarball'; - -var fs = require('fs'); -var path = require('path'); -var log = require('npmlog'); -var versioning = require('./util/versioning.js'); -var napi = require('./util/napi.js'); -var write = require('fs').createWriteStream; -var existsAsync = fs.exists || path.exists; -var mkdirp = require('mkdirp'); -var tar = require('tar'); - -function _package(gyp, argv, callback) { - var packlist = require('npm-packlist'); - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var napi_build_version = napi.get_napi_build_version_from_command_args(argv); - var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); - var from = opts.module_path; - var binary_module = path.join(from,opts.module_name + '.node'); - existsAsync(binary_module,function(found) { - if (!found) { - return callback(new Error("Cannot package because " + binary_module + " missing: run `node-pre-gyp rebuild` first")); - } - var tarball = opts.staged_tarball; - var filter_func = function(entry) { - // ensure directories are +x - // https://github.com/mapnik/node-mapnik/issues/262 - log.info('package','packing ' + entry.path); - return true; - }; - mkdirp(path.dirname(tarball),function(err) { - if (err) return callback(err); - packlist({ path: from }).then(function(files) { - var base = path.basename(from); - files = files.map(function(file) { - return path.join(base, file); - }); - tar.create({ - portable: true, - gzip: true, - onentry: filter_func, - file: tarball, - cwd: path.dirname(from) - }, files, function(err) { - if (err) console.error('['+package_json.name+'] ' + err.message); - else log.info('package','Binary staged at "' + tarball + '"'); - return callback(err); - }); - }, callback); - }); - }); -} diff --git a/node_modules/node-pre-gyp/lib/pre-binding.js b/node_modules/node-pre-gyp/lib/pre-binding.js deleted file mode 100644 index 09e076d..0000000 --- a/node_modules/node-pre-gyp/lib/pre-binding.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -var versioning = require('../lib/util/versioning.js'); -var napi = require('../lib/util/napi.js'); -var existsSync = require('fs').existsSync || require('path').existsSync; -var path = require('path'); - -module.exports = exports; - -exports.usage = 'Finds the require path for the node-pre-gyp installed module'; - -exports.validate = function(package_json,opts) { - versioning.validate_config(package_json,opts); -}; - -exports.find = function(package_json_path,opts) { - if (!existsSync(package_json_path)) { - throw new Error("package.json does not exist at " + package_json_path); - } - var package_json = require(package_json_path); - versioning.validate_config(package_json,opts); - var napi_build_version; - if (napi.get_napi_build_versions (package_json, opts)) { - napi_build_version = napi.get_best_napi_build_version(package_json, opts); - } - opts = opts || {}; - if (!opts.module_root) opts.module_root = path.dirname(package_json_path); - var meta = versioning.evaluate(package_json,opts,napi_build_version); - return meta.module; -}; diff --git a/node_modules/node-pre-gyp/lib/publish.js b/node_modules/node-pre-gyp/lib/publish.js deleted file mode 100644 index 376e398..0000000 --- a/node_modules/node-pre-gyp/lib/publish.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; - -module.exports = exports = publish; - -exports.usage = 'Publishes pre-built binary (requires aws-sdk)'; - -var fs = require('fs'); -var path = require('path'); -var log = require('npmlog'); -var versioning = require('./util/versioning.js'); -var napi = require('./util/napi.js'); -var s3_setup = require('./util/s3_setup.js'); -var existsAsync = fs.exists || path.exists; -var url = require('url'); -var config = require('rc')("node_pre_gyp",{acl:"public-read"}); - -function publish(gyp, argv, callback) { - var AWS = require("aws-sdk"); - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var napi_build_version = napi.get_napi_build_version_from_command_args(argv); - var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); - var tarball = opts.staged_tarball; - existsAsync(tarball,function(found) { - if (!found) { - return callback(new Error("Cannot publish because " + tarball + " missing: run `node-pre-gyp package` first")); - } - log.info('publish', 'Detecting s3 credentials'); - s3_setup.detect(opts.hosted_path,config); - var key_name = url.resolve(config.prefix,opts.package_name); - log.info('publish', 'Authenticating with s3'); - AWS.config.update(config); - var s3 = new AWS.S3(); - var s3_opts = { Bucket: config.bucket, - Key: key_name - }; - var remote_package = 'https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key; - log.info('publish', 'Checking for existing binary at ' + remote_package); - s3.headObject(s3_opts, function(err, meta){ - if (meta) log.info('publish', JSON.stringify(meta)); - if (err && err.code == 'NotFound') { - // we are safe to publish because - // the object does not already exist - log.info('publish', 'Preparing to put object'); - var s3_put = new AWS.S3(); - var s3_put_opts = { ACL: config.acl, - Body: fs.createReadStream(tarball), - Bucket: config.bucket, - Key: key_name - }; - log.info('publish', 'Putting object'); - try { - s3_put.putObject(s3_put_opts, function(err, resp){ - log.info('publish', 'returned from putting object'); - if(err) { - log.info('publish', 's3 putObject error: "' + err + '"'); - return callback(err); - } - if (resp) log.info('publish', 's3 putObject response: "' + JSON.stringify(resp) + '"'); - log.info('publish', 'successfully put object'); - console.log('['+package_json.name+'] published to ' + remote_package); - return callback(); - }); - } catch (err) { - log.info('publish', 's3 putObject error: "' + err + '"'); - return callback(err); - } - } else if (err) { - log.info('publish', 's3 headObject error: "' + err + '"'); - return callback(err); - } else { - log.error('publish','Cannot publish over existing version'); - log.error('publish',"Update the 'version' field in package.json and try again"); - log.error('publish','If the previous version was published in error see:'); - log.error('publish','\t node-pre-gyp unpublish'); - return callback(new Error('Failed publishing to ' + remote_package)); - } - }); - }); -} diff --git a/node_modules/node-pre-gyp/lib/rebuild.js b/node_modules/node-pre-gyp/lib/rebuild.js deleted file mode 100644 index 615a524..0000000 --- a/node_modules/node-pre-gyp/lib/rebuild.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -module.exports = exports = rebuild; - -exports.usage = 'Runs "clean" and "build" at once'; - -var fs = require('fs'); -var napi = require('./util/napi.js'); - -function rebuild (gyp, argv, callback) { - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var commands = [ - { name: 'clean', args: [] }, - { name: 'build', args: ['rebuild'] } - ]; - commands = napi.expand_commands(package_json, gyp.opts, commands); - for (var i = commands.length; i !== 0; i--) { - gyp.todo.unshift(commands[i-1]); - } - process.nextTick(callback); -} diff --git a/node_modules/node-pre-gyp/lib/reinstall.js b/node_modules/node-pre-gyp/lib/reinstall.js deleted file mode 100644 index 10e85fc..0000000 --- a/node_modules/node-pre-gyp/lib/reinstall.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -module.exports = exports = rebuild; - -exports.usage = 'Runs "clean" and "install" at once'; - -var fs = require('fs'); -var napi = require('./util/napi.js'); - -function rebuild (gyp, argv, callback) { - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var installArgs = []; - var napi_build_version = napi.get_best_napi_build_version(package_json, gyp.opts); - if (napi_build_version != null) installArgs = [ napi.get_command_arg (napi_build_version) ]; - gyp.todo.unshift( - { name: 'clean', args: [] }, - { name: 'install', args: installArgs } - ); - process.nextTick(callback); -} diff --git a/node_modules/node-pre-gyp/lib/reveal.js b/node_modules/node-pre-gyp/lib/reveal.js deleted file mode 100644 index 13d2f72..0000000 --- a/node_modules/node-pre-gyp/lib/reveal.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -module.exports = exports = reveal; - -exports.usage = 'Reveals data on the versioned binary'; - -var fs = require('fs'); -var versioning = require('./util/versioning.js'); -var napi = require('./util/napi.js'); - -function unix_paths(key, val) { - return val && val.replace ? val.replace(/\\/g, '/') : val; -} - -function reveal(gyp, argv, callback) { - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var napi_build_version = napi.get_napi_build_version_from_command_args(argv); - var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); - var hit = false; - // if a second arg is passed look to see - // if it is a known option - //console.log(JSON.stringify(gyp.opts,null,1)) - var remain = gyp.opts.argv.remain[gyp.opts.argv.remain.length-1]; - if (remain && opts.hasOwnProperty(remain)) { - console.log(opts[remain].replace(/\\/g, '/')); - hit = true; - } - // otherwise return all options as json - if (!hit) { - console.log(JSON.stringify(opts,unix_paths,2)); - } - return callback(); -} diff --git a/node_modules/node-pre-gyp/lib/testbinary.js b/node_modules/node-pre-gyp/lib/testbinary.js deleted file mode 100644 index 453987c..0000000 --- a/node_modules/node-pre-gyp/lib/testbinary.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; - -module.exports = exports = testbinary; - -exports.usage = 'Tests that the binary.node can be required'; - -var fs = require('fs'); -var path = require('path'); -var log = require('npmlog'); -var cp = require('child_process'); -var versioning = require('./util/versioning.js'); -var napi = require('./util/napi.js'); -var path = require('path'); - -function testbinary(gyp, argv, callback) { - var args = []; - var options = {}; - var shell_cmd = process.execPath; - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var napi_build_version = napi.get_napi_build_version_from_command_args(argv); - var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); - // skip validation for runtimes we don't explicitly support (like electron) - if (opts.runtime && - opts.runtime !== 'node-webkit' && - opts.runtime !== 'node') { - return callback(); - } - var nw = (opts.runtime && opts.runtime === 'node-webkit'); - // ensure on windows that / are used for require path - var binary_module = opts.module.replace(/\\/g, '/'); - if ((process.arch != opts.target_arch) || - (process.platform != opts.target_platform)) { - var msg = "skipping validation since host platform/arch ("; - msg += process.platform+'/'+process.arch+")"; - msg += " does not match target ("; - msg += opts.target_platform+'/'+opts.target_arch+")"; - log.info('validate', msg); - return callback(); - } - if (nw) { - options.timeout = 5000; - if (process.platform === 'darwin') { - shell_cmd = 'node-webkit'; - } else if (process.platform === 'win32') { - shell_cmd = 'nw.exe'; - } else { - shell_cmd = 'nw'; - } - var modulePath = path.resolve(binary_module); - var appDir = path.join(__dirname, 'util', 'nw-pre-gyp'); - args.push(appDir); - args.push(modulePath); - log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'"); - cp.execFile(shell_cmd, args, options, function(err, stdout, stderr) { - // check for normal timeout for node-webkit - if (err) { - if (err.killed === true && err.signal && err.signal.indexOf('SIG') > -1) { - return callback(); - } - var stderrLog = stderr.toString(); - log.info('stderr', stderrLog); - if( /^\s*Xlib:\s*extension\s*"RANDR"\s*missing\s*on\s*display\s*":\d+\.\d+"\.\s*$/.test(stderrLog) ){ - log.info('RANDR', 'stderr contains only RANDR error, ignored'); - return callback(); - } - return callback(err); - } - return callback(); - }); - return; - } - args.push('--eval'); - args.push("require('" + binary_module.replace(/'/g, '\'') +"')"); - log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'"); - cp.execFile(shell_cmd, args, options, function(err, stdout, stderr) { - if (err) { - return callback(err, { stdout:stdout, stderr:stderr}); - } - return callback(); - }); -} diff --git a/node_modules/node-pre-gyp/lib/testpackage.js b/node_modules/node-pre-gyp/lib/testpackage.js deleted file mode 100644 index 9091bc3..0000000 --- a/node_modules/node-pre-gyp/lib/testpackage.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -module.exports = exports = testpackage; - -exports.usage = 'Tests that the staged package is valid'; - -var fs = require('fs'); -var path = require('path'); -var log = require('npmlog'); -var existsAsync = fs.exists || path.exists; -var versioning = require('./util/versioning.js'); -var napi = require('./util/napi.js'); -var testbinary = require('./testbinary.js'); -var tar = require('tar'); -var mkdirp = require('mkdirp'); - -function testpackage(gyp, argv, callback) { - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var napi_build_version = napi.get_napi_build_version_from_command_args(argv); - var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); - var tarball = opts.staged_tarball; - existsAsync(tarball, function(found) { - if (!found) { - return callback(new Error("Cannot test package because " + tarball + " missing: run `node-pre-gyp package` first")); - } - var to = opts.module_path; - function filter_func(entry) { - log.info('install','unpacking [' + entry.path + ']'); - } - - mkdirp(to, function(err) { - if (err) { - return callback(err); - } else { - tar.extract({ - file: tarball, - cwd: to, - strip: 1, - onentry: filter_func - }).then(after_extract, callback); - } - }); - - function after_extract() { - testbinary(gyp,argv,function(err) { - if (err) { - return callback(err); - } else { - console.log('['+package_json.name+'] Package appears valid'); - return callback(); - } - }); - } - }); -} diff --git a/node_modules/node-pre-gyp/lib/unpublish.js b/node_modules/node-pre-gyp/lib/unpublish.js deleted file mode 100644 index 94c93dd..0000000 --- a/node_modules/node-pre-gyp/lib/unpublish.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -module.exports = exports = unpublish; - -exports.usage = 'Unpublishes pre-built binary (requires aws-sdk)'; - -var fs = require('fs'); -var log = require('npmlog'); -var versioning = require('./util/versioning.js'); -var napi = require('./util/napi.js'); -var s3_setup = require('./util/s3_setup.js'); -var url = require('url'); -var config = require('rc')("node_pre_gyp",{acl:"public-read"}); - -function unpublish(gyp, argv, callback) { - var AWS = require("aws-sdk"); - var package_json = JSON.parse(fs.readFileSync('./package.json')); - var napi_build_version = napi.get_napi_build_version_from_command_args(argv); - var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); - s3_setup.detect(opts.hosted_path,config); - AWS.config.update(config); - var key_name = url.resolve(config.prefix,opts.package_name); - var s3 = new AWS.S3(); - var s3_opts = { Bucket: config.bucket, - Key: key_name - }; - s3.headObject(s3_opts, function(err, meta) { - if (err && err.code == 'NotFound') { - console.log('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key); - return callback(); - } else if(err) { - return callback(err); - } else { - log.info('unpublish', JSON.stringify(meta)); - s3.deleteObject(s3_opts, function(err, resp) { - if (err) return callback(err); - log.info(JSON.stringify(resp)); - console.log('['+package_json.name+'] Success: removed https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key); - return callback(); - }); - } - }); -} diff --git a/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json b/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json deleted file mode 100644 index a9f2ea4..0000000 --- a/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +++ /dev/null @@ -1,1790 +0,0 @@ -{ - "0.1.14": { - "node_abi": null, - "v8": "1.3" - }, - "0.1.15": { - "node_abi": null, - "v8": "1.3" - }, - "0.1.16": { - "node_abi": null, - "v8": "1.3" - }, - "0.1.17": { - "node_abi": null, - "v8": "1.3" - }, - "0.1.18": { - "node_abi": null, - "v8": "1.3" - }, - "0.1.19": { - "node_abi": null, - "v8": "2.0" - }, - "0.1.20": { - "node_abi": null, - "v8": "2.0" - }, - "0.1.21": { - "node_abi": null, - "v8": "2.0" - }, - "0.1.22": { - "node_abi": null, - "v8": "2.0" - }, - "0.1.23": { - "node_abi": null, - "v8": "2.0" - }, - "0.1.24": { - "node_abi": null, - "v8": "2.0" - }, - "0.1.25": { - "node_abi": null, - "v8": "2.0" - }, - "0.1.26": { - "node_abi": null, - "v8": "2.0" - }, - "0.1.27": { - "node_abi": null, - "v8": "2.1" - }, - "0.1.28": { - "node_abi": null, - "v8": "2.1" - }, - "0.1.29": { - "node_abi": null, - "v8": "2.1" - }, - "0.1.30": { - "node_abi": null, - "v8": "2.1" - }, - "0.1.31": { - "node_abi": null, - "v8": "2.1" - }, - "0.1.32": { - "node_abi": null, - "v8": "2.1" - }, - "0.1.33": { - "node_abi": null, - "v8": "2.1" - }, - "0.1.90": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.91": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.92": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.93": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.94": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.95": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.96": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.97": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.98": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.99": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.100": { - "node_abi": null, - "v8": "2.2" - }, - "0.1.101": { - "node_abi": null, - "v8": "2.3" - }, - "0.1.102": { - "node_abi": null, - "v8": "2.3" - }, - "0.1.103": { - "node_abi": null, - "v8": "2.3" - }, - "0.1.104": { - "node_abi": null, - "v8": "2.3" - }, - "0.2.0": { - "node_abi": 1, - "v8": "2.3" - }, - "0.2.1": { - "node_abi": 1, - "v8": "2.3" - }, - "0.2.2": { - "node_abi": 1, - "v8": "2.3" - }, - "0.2.3": { - "node_abi": 1, - "v8": "2.3" - }, - "0.2.4": { - "node_abi": 1, - "v8": "2.3" - }, - "0.2.5": { - "node_abi": 1, - "v8": "2.3" - }, - "0.2.6": { - "node_abi": 1, - "v8": "2.3" - }, - "0.3.0": { - "node_abi": 1, - "v8": "2.5" - }, - "0.3.1": { - "node_abi": 1, - "v8": "2.5" - }, - "0.3.2": { - "node_abi": 1, - "v8": "3.0" - }, - "0.3.3": { - "node_abi": 1, - "v8": "3.0" - }, - "0.3.4": { - "node_abi": 1, - "v8": "3.0" - }, - "0.3.5": { - "node_abi": 1, - "v8": "3.0" - }, - "0.3.6": { - "node_abi": 1, - "v8": "3.0" - }, - "0.3.7": { - "node_abi": 1, - "v8": "3.0" - }, - "0.3.8": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.0": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.1": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.2": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.3": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.4": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.5": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.6": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.7": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.8": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.9": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.10": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.11": { - "node_abi": 1, - "v8": "3.1" - }, - "0.4.12": { - "node_abi": 1, - "v8": "3.1" - }, - "0.5.0": { - "node_abi": 1, - "v8": "3.1" - }, - "0.5.1": { - "node_abi": 1, - "v8": "3.4" - }, - "0.5.2": { - "node_abi": 1, - "v8": "3.4" - }, - "0.5.3": { - "node_abi": 1, - "v8": "3.4" - }, - "0.5.4": { - "node_abi": 1, - "v8": "3.5" - }, - "0.5.5": { - "node_abi": 1, - "v8": "3.5" - }, - "0.5.6": { - "node_abi": 1, - "v8": "3.6" - }, - "0.5.7": { - "node_abi": 1, - "v8": "3.6" - }, - "0.5.8": { - "node_abi": 1, - "v8": "3.6" - }, - "0.5.9": { - "node_abi": 1, - "v8": "3.6" - }, - "0.5.10": { - "node_abi": 1, - "v8": "3.7" - }, - "0.6.0": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.1": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.2": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.3": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.4": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.5": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.6": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.7": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.8": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.9": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.10": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.11": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.12": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.13": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.14": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.15": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.16": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.17": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.18": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.19": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.20": { - "node_abi": 1, - "v8": "3.6" - }, - "0.6.21": { - "node_abi": 1, - "v8": "3.6" - }, - "0.7.0": { - "node_abi": 1, - "v8": "3.8" - }, - "0.7.1": { - "node_abi": 1, - "v8": "3.8" - }, - "0.7.2": { - "node_abi": 1, - "v8": "3.8" - }, - "0.7.3": { - "node_abi": 1, - "v8": "3.9" - }, - "0.7.4": { - "node_abi": 1, - "v8": "3.9" - }, - "0.7.5": { - "node_abi": 1, - "v8": "3.9" - }, - "0.7.6": { - "node_abi": 1, - "v8": "3.9" - }, - "0.7.7": { - "node_abi": 1, - "v8": "3.9" - }, - "0.7.8": { - "node_abi": 1, - "v8": "3.9" - }, - "0.7.9": { - "node_abi": 1, - "v8": "3.11" - }, - "0.7.10": { - "node_abi": 1, - "v8": "3.9" - }, - "0.7.11": { - "node_abi": 1, - "v8": "3.11" - }, - "0.7.12": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.0": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.1": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.2": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.3": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.4": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.5": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.6": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.7": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.8": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.9": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.10": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.11": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.12": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.13": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.14": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.15": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.16": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.17": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.18": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.19": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.20": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.21": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.22": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.23": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.24": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.25": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.26": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.27": { - "node_abi": 1, - "v8": "3.11" - }, - "0.8.28": { - "node_abi": 1, - "v8": "3.11" - }, - "0.9.0": { - "node_abi": 1, - "v8": "3.11" - }, - "0.9.1": { - "node_abi": 10, - "v8": "3.11" - }, - "0.9.2": { - "node_abi": 10, - "v8": "3.11" - }, - "0.9.3": { - "node_abi": 10, - "v8": "3.13" - }, - "0.9.4": { - "node_abi": 10, - "v8": "3.13" - }, - "0.9.5": { - "node_abi": 10, - "v8": "3.13" - }, - "0.9.6": { - "node_abi": 10, - "v8": "3.15" - }, - "0.9.7": { - "node_abi": 10, - "v8": "3.15" - }, - "0.9.8": { - "node_abi": 10, - "v8": "3.15" - }, - "0.9.9": { - "node_abi": 11, - "v8": "3.15" - }, - "0.9.10": { - "node_abi": 11, - "v8": "3.15" - }, - "0.9.11": { - "node_abi": 11, - "v8": "3.14" - }, - "0.9.12": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.0": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.1": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.2": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.3": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.4": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.5": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.6": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.7": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.8": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.9": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.10": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.11": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.12": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.13": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.14": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.15": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.16": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.17": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.18": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.19": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.20": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.21": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.22": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.23": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.24": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.25": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.26": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.27": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.28": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.29": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.30": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.31": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.32": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.33": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.34": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.35": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.36": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.37": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.38": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.39": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.40": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.41": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.42": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.43": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.44": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.45": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.46": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.47": { - "node_abi": 11, - "v8": "3.14" - }, - "0.10.48": { - "node_abi": 11, - "v8": "3.14" - }, - "0.11.0": { - "node_abi": 12, - "v8": "3.17" - }, - "0.11.1": { - "node_abi": 12, - "v8": "3.18" - }, - "0.11.2": { - "node_abi": 12, - "v8": "3.19" - }, - "0.11.3": { - "node_abi": 12, - "v8": "3.19" - }, - "0.11.4": { - "node_abi": 12, - "v8": "3.20" - }, - "0.11.5": { - "node_abi": 12, - "v8": "3.20" - }, - "0.11.6": { - "node_abi": 12, - "v8": "3.20" - }, - "0.11.7": { - "node_abi": 12, - "v8": "3.20" - }, - "0.11.8": { - "node_abi": 13, - "v8": "3.21" - }, - "0.11.9": { - "node_abi": 13, - "v8": "3.22" - }, - "0.11.10": { - "node_abi": 13, - "v8": "3.22" - }, - "0.11.11": { - "node_abi": 14, - "v8": "3.22" - }, - "0.11.12": { - "node_abi": 14, - "v8": "3.22" - }, - "0.11.13": { - "node_abi": 14, - "v8": "3.25" - }, - "0.11.14": { - "node_abi": 14, - "v8": "3.26" - }, - "0.11.15": { - "node_abi": 14, - "v8": "3.28" - }, - "0.11.16": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.0": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.1": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.2": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.3": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.4": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.5": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.6": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.7": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.8": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.9": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.10": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.11": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.12": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.13": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.14": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.15": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.16": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.17": { - "node_abi": 14, - "v8": "3.28" - }, - "0.12.18": { - "node_abi": 14, - "v8": "3.28" - }, - "1.0.0": { - "node_abi": 42, - "v8": "3.31" - }, - "1.0.1": { - "node_abi": 42, - "v8": "3.31" - }, - "1.0.2": { - "node_abi": 42, - "v8": "3.31" - }, - "1.0.3": { - "node_abi": 42, - "v8": "4.1" - }, - "1.0.4": { - "node_abi": 42, - "v8": "4.1" - }, - "1.1.0": { - "node_abi": 43, - "v8": "4.1" - }, - "1.2.0": { - "node_abi": 43, - "v8": "4.1" - }, - "1.3.0": { - "node_abi": 43, - "v8": "4.1" - }, - "1.4.1": { - "node_abi": 43, - "v8": "4.1" - }, - "1.4.2": { - "node_abi": 43, - "v8": "4.1" - }, - "1.4.3": { - "node_abi": 43, - "v8": "4.1" - }, - "1.5.0": { - "node_abi": 43, - "v8": "4.1" - }, - "1.5.1": { - "node_abi": 43, - "v8": "4.1" - }, - "1.6.0": { - "node_abi": 43, - "v8": "4.1" - }, - "1.6.1": { - "node_abi": 43, - "v8": "4.1" - }, - "1.6.2": { - "node_abi": 43, - "v8": "4.1" - }, - "1.6.3": { - "node_abi": 43, - "v8": "4.1" - }, - "1.6.4": { - "node_abi": 43, - "v8": "4.1" - }, - "1.7.1": { - "node_abi": 43, - "v8": "4.1" - }, - "1.8.1": { - "node_abi": 43, - "v8": "4.1" - }, - "1.8.2": { - "node_abi": 43, - "v8": "4.1" - }, - "1.8.3": { - "node_abi": 43, - "v8": "4.1" - }, - "1.8.4": { - "node_abi": 43, - "v8": "4.1" - }, - "2.0.0": { - "node_abi": 44, - "v8": "4.2" - }, - "2.0.1": { - "node_abi": 44, - "v8": "4.2" - }, - "2.0.2": { - "node_abi": 44, - "v8": "4.2" - }, - "2.1.0": { - "node_abi": 44, - "v8": "4.2" - }, - "2.2.0": { - "node_abi": 44, - "v8": "4.2" - }, - "2.2.1": { - "node_abi": 44, - "v8": "4.2" - }, - "2.3.0": { - "node_abi": 44, - "v8": "4.2" - }, - "2.3.1": { - "node_abi": 44, - "v8": "4.2" - }, - "2.3.2": { - "node_abi": 44, - "v8": "4.2" - }, - "2.3.3": { - "node_abi": 44, - "v8": "4.2" - }, - "2.3.4": { - "node_abi": 44, - "v8": "4.2" - }, - "2.4.0": { - "node_abi": 44, - "v8": "4.2" - }, - "2.5.0": { - "node_abi": 44, - "v8": "4.2" - }, - "3.0.0": { - "node_abi": 45, - "v8": "4.4" - }, - "3.1.0": { - "node_abi": 45, - "v8": "4.4" - }, - "3.2.0": { - "node_abi": 45, - "v8": "4.4" - }, - "3.3.0": { - "node_abi": 45, - "v8": "4.4" - }, - "3.3.1": { - "node_abi": 45, - "v8": "4.4" - }, - "4.0.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.1.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.1.1": { - "node_abi": 46, - "v8": "4.5" - }, - "4.1.2": { - "node_abi": 46, - "v8": "4.5" - }, - "4.2.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.2.1": { - "node_abi": 46, - "v8": "4.5" - }, - "4.2.2": { - "node_abi": 46, - "v8": "4.5" - }, - "4.2.3": { - "node_abi": 46, - "v8": "4.5" - }, - "4.2.4": { - "node_abi": 46, - "v8": "4.5" - }, - "4.2.5": { - "node_abi": 46, - "v8": "4.5" - }, - "4.2.6": { - "node_abi": 46, - "v8": "4.5" - }, - "4.3.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.3.1": { - "node_abi": 46, - "v8": "4.5" - }, - "4.3.2": { - "node_abi": 46, - "v8": "4.5" - }, - "4.4.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.4.1": { - "node_abi": 46, - "v8": "4.5" - }, - "4.4.2": { - "node_abi": 46, - "v8": "4.5" - }, - "4.4.3": { - "node_abi": 46, - "v8": "4.5" - }, - "4.4.4": { - "node_abi": 46, - "v8": "4.5" - }, - "4.4.5": { - "node_abi": 46, - "v8": "4.5" - }, - "4.4.6": { - "node_abi": 46, - "v8": "4.5" - }, - "4.4.7": { - "node_abi": 46, - "v8": "4.5" - }, - "4.5.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.6.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.6.1": { - "node_abi": 46, - "v8": "4.5" - }, - "4.6.2": { - "node_abi": 46, - "v8": "4.5" - }, - "4.7.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.7.1": { - "node_abi": 46, - "v8": "4.5" - }, - "4.7.2": { - "node_abi": 46, - "v8": "4.5" - }, - "4.7.3": { - "node_abi": 46, - "v8": "4.5" - }, - "4.8.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.8.1": { - "node_abi": 46, - "v8": "4.5" - }, - "4.8.2": { - "node_abi": 46, - "v8": "4.5" - }, - "4.8.3": { - "node_abi": 46, - "v8": "4.5" - }, - "4.8.4": { - "node_abi": 46, - "v8": "4.5" - }, - "4.8.5": { - "node_abi": 46, - "v8": "4.5" - }, - "4.8.6": { - "node_abi": 46, - "v8": "4.5" - }, - "4.8.7": { - "node_abi": 46, - "v8": "4.5" - }, - "4.9.0": { - "node_abi": 46, - "v8": "4.5" - }, - "4.9.1": { - "node_abi": 46, - "v8": "4.5" - }, - "5.0.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.1.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.1.1": { - "node_abi": 47, - "v8": "4.6" - }, - "5.2.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.3.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.4.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.4.1": { - "node_abi": 47, - "v8": "4.6" - }, - "5.5.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.6.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.7.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.7.1": { - "node_abi": 47, - "v8": "4.6" - }, - "5.8.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.9.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.9.1": { - "node_abi": 47, - "v8": "4.6" - }, - "5.10.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.10.1": { - "node_abi": 47, - "v8": "4.6" - }, - "5.11.0": { - "node_abi": 47, - "v8": "4.6" - }, - "5.11.1": { - "node_abi": 47, - "v8": "4.6" - }, - "5.12.0": { - "node_abi": 47, - "v8": "4.6" - }, - "6.0.0": { - "node_abi": 48, - "v8": "5.0" - }, - "6.1.0": { - "node_abi": 48, - "v8": "5.0" - }, - "6.2.0": { - "node_abi": 48, - "v8": "5.0" - }, - "6.2.1": { - "node_abi": 48, - "v8": "5.0" - }, - "6.2.2": { - "node_abi": 48, - "v8": "5.0" - }, - "6.3.0": { - "node_abi": 48, - "v8": "5.0" - }, - "6.3.1": { - "node_abi": 48, - "v8": "5.0" - }, - "6.4.0": { - "node_abi": 48, - "v8": "5.0" - }, - "6.5.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.6.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.7.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.8.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.8.1": { - "node_abi": 48, - "v8": "5.1" - }, - "6.9.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.9.1": { - "node_abi": 48, - "v8": "5.1" - }, - "6.9.2": { - "node_abi": 48, - "v8": "5.1" - }, - "6.9.3": { - "node_abi": 48, - "v8": "5.1" - }, - "6.9.4": { - "node_abi": 48, - "v8": "5.1" - }, - "6.9.5": { - "node_abi": 48, - "v8": "5.1" - }, - "6.10.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.10.1": { - "node_abi": 48, - "v8": "5.1" - }, - "6.10.2": { - "node_abi": 48, - "v8": "5.1" - }, - "6.10.3": { - "node_abi": 48, - "v8": "5.1" - }, - "6.11.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.11.1": { - "node_abi": 48, - "v8": "5.1" - }, - "6.11.2": { - "node_abi": 48, - "v8": "5.1" - }, - "6.11.3": { - "node_abi": 48, - "v8": "5.1" - }, - "6.11.4": { - "node_abi": 48, - "v8": "5.1" - }, - "6.11.5": { - "node_abi": 48, - "v8": "5.1" - }, - "6.12.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.12.1": { - "node_abi": 48, - "v8": "5.1" - }, - "6.12.2": { - "node_abi": 48, - "v8": "5.1" - }, - "6.12.3": { - "node_abi": 48, - "v8": "5.1" - }, - "6.13.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.13.1": { - "node_abi": 48, - "v8": "5.1" - }, - "6.14.0": { - "node_abi": 48, - "v8": "5.1" - }, - "6.14.1": { - "node_abi": 48, - "v8": "5.1" - }, - "6.14.2": { - "node_abi": 48, - "v8": "5.1" - }, - "6.14.3": { - "node_abi": 48, - "v8": "5.1" - }, - "7.0.0": { - "node_abi": 51, - "v8": "5.4" - }, - "7.1.0": { - "node_abi": 51, - "v8": "5.4" - }, - "7.2.0": { - "node_abi": 51, - "v8": "5.4" - }, - "7.2.1": { - "node_abi": 51, - "v8": "5.4" - }, - "7.3.0": { - "node_abi": 51, - "v8": "5.4" - }, - "7.4.0": { - "node_abi": 51, - "v8": "5.4" - }, - "7.5.0": { - "node_abi": 51, - "v8": "5.4" - }, - "7.6.0": { - "node_abi": 51, - "v8": "5.5" - }, - "7.7.0": { - "node_abi": 51, - "v8": "5.5" - }, - "7.7.1": { - "node_abi": 51, - "v8": "5.5" - }, - "7.7.2": { - "node_abi": 51, - "v8": "5.5" - }, - "7.7.3": { - "node_abi": 51, - "v8": "5.5" - }, - "7.7.4": { - "node_abi": 51, - "v8": "5.5" - }, - "7.8.0": { - "node_abi": 51, - "v8": "5.5" - }, - "7.9.0": { - "node_abi": 51, - "v8": "5.5" - }, - "7.10.0": { - "node_abi": 51, - "v8": "5.5" - }, - "7.10.1": { - "node_abi": 51, - "v8": "5.5" - }, - "8.0.0": { - "node_abi": 57, - "v8": "5.8" - }, - "8.1.0": { - "node_abi": 57, - "v8": "5.8" - }, - "8.1.1": { - "node_abi": 57, - "v8": "5.8" - }, - "8.1.2": { - "node_abi": 57, - "v8": "5.8" - }, - "8.1.3": { - "node_abi": 57, - "v8": "5.8" - }, - "8.1.4": { - "node_abi": 57, - "v8": "5.8" - }, - "8.2.0": { - "node_abi": 57, - "v8": "5.8" - }, - "8.2.1": { - "node_abi": 57, - "v8": "5.8" - }, - "8.3.0": { - "node_abi": 57, - "v8": "6.0" - }, - "8.4.0": { - "node_abi": 57, - "v8": "6.0" - }, - "8.5.0": { - "node_abi": 57, - "v8": "6.0" - }, - "8.6.0": { - "node_abi": 57, - "v8": "6.0" - }, - "8.7.0": { - "node_abi": 57, - "v8": "6.1" - }, - "8.8.0": { - "node_abi": 57, - "v8": "6.1" - }, - "8.8.1": { - "node_abi": 57, - "v8": "6.1" - }, - "8.9.0": { - "node_abi": 57, - "v8": "6.1" - }, - "8.9.1": { - "node_abi": 57, - "v8": "6.1" - }, - "8.9.2": { - "node_abi": 57, - "v8": "6.1" - }, - "8.9.3": { - "node_abi": 57, - "v8": "6.1" - }, - "8.9.4": { - "node_abi": 57, - "v8": "6.1" - }, - "8.10.0": { - "node_abi": 57, - "v8": "6.2" - }, - "8.11.0": { - "node_abi": 57, - "v8": "6.2" - }, - "8.11.1": { - "node_abi": 57, - "v8": "6.2" - }, - "8.11.2": { - "node_abi": 57, - "v8": "6.2" - }, - "8.11.3": { - "node_abi": 57, - "v8": "6.2" - }, - "9.0.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.1.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.2.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.2.1": { - "node_abi": 59, - "v8": "6.2" - }, - "9.3.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.4.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.5.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.6.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.6.1": { - "node_abi": 59, - "v8": "6.2" - }, - "9.7.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.7.1": { - "node_abi": 59, - "v8": "6.2" - }, - "9.8.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.9.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.10.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.10.1": { - "node_abi": 59, - "v8": "6.2" - }, - "9.11.0": { - "node_abi": 59, - "v8": "6.2" - }, - "9.11.1": { - "node_abi": 59, - "v8": "6.2" - }, - "9.11.2": { - "node_abi": 59, - "v8": "6.2" - }, - "10.0.0": { - "node_abi": 64, - "v8": "6.6" - }, - "10.1.0": { - "node_abi": 64, - "v8": "6.6" - }, - "10.2.0": { - "node_abi": 64, - "v8": "6.6" - }, - "10.2.1": { - "node_abi": 64, - "v8": "6.6" - }, - "10.3.0": { - "node_abi": 64, - "v8": "6.6" - }, - "10.4.0": { - "node_abi": 64, - "v8": "6.7" - }, - "10.4.1": { - "node_abi": 64, - "v8": "6.7" - }, - "10.5.0": { - "node_abi": 64, - "v8": "6.7" - }, - "10.6.0": { - "node_abi": 64, - "v8": "6.7" - }, - "10.7.0": { - "node_abi": 64, - "v8": "6.7" - }, - "10.8.0": { - "node_abi": 64, - "v8": "6.7" - } -} \ No newline at end of file diff --git a/node_modules/node-pre-gyp/lib/util/compile.js b/node_modules/node-pre-gyp/lib/util/compile.js deleted file mode 100644 index 0dc460c..0000000 --- a/node_modules/node-pre-gyp/lib/util/compile.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; - -module.exports = exports; - -var fs = require('fs'); -var path = require('path'); -var win = process.platform == 'win32'; -var existsSync = fs.existsSync || path.existsSync; -var cp = require('child_process'); - -// try to build up the complete path to node-gyp -/* priority: - - node-gyp on ENV:npm_config_node_gyp (https://github.com/npm/npm/pull/4887) - - node-gyp on NODE_PATH - - node-gyp inside npm on NODE_PATH (ignore on iojs) - - node-gyp inside npm beside node exe -*/ -function which_node_gyp() { - var node_gyp_bin; - if (process.env.npm_config_node_gyp) { - try { - node_gyp_bin = process.env.npm_config_node_gyp; - if (existsSync(node_gyp_bin)) { - return node_gyp_bin; - } - } catch (err) { } - } - try { - var node_gyp_main = require.resolve('node-gyp'); - node_gyp_bin = path.join(path.dirname( - path.dirname(node_gyp_main)), - 'bin/node-gyp.js'); - if (existsSync(node_gyp_bin)) { - return node_gyp_bin; - } - } catch (err) { } - if (process.execPath.indexOf('iojs') === -1) { - try { - var npm_main = require.resolve('npm'); - node_gyp_bin = path.join(path.dirname( - path.dirname(npm_main)), - 'node_modules/node-gyp/bin/node-gyp.js'); - if (existsSync(node_gyp_bin)) { - return node_gyp_bin; - } - } catch (err) { } - } - var npm_base = path.join(path.dirname( - path.dirname(process.execPath)), - 'lib/node_modules/npm/'); - node_gyp_bin = path.join(npm_base, 'node_modules/node-gyp/bin/node-gyp.js'); - if (existsSync(node_gyp_bin)) { - return node_gyp_bin; - } -} - -module.exports.run_gyp = function(args,opts,callback) { - var shell_cmd = ''; - var cmd_args = []; - if (opts.runtime && opts.runtime == 'node-webkit') { - shell_cmd = 'nw-gyp'; - if (win) shell_cmd += '.cmd'; - } else { - var node_gyp_path = which_node_gyp(); - if (node_gyp_path) { - shell_cmd = process.execPath; - cmd_args.push(node_gyp_path); - } else { - shell_cmd = 'node-gyp'; - if (win) shell_cmd += '.cmd'; - } - } - var final_args = cmd_args.concat(args); - var cmd = cp.spawn(shell_cmd, final_args, {cwd: undefined, env: process.env, stdio: [ 0, 1, 2]}); - cmd.on('error', function (err) { - if (err) { - return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + err + ")")); - } - callback(null,opts); - }); - cmd.on('close', function (code) { - if (code && code !== 0) { - return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + code + ")")); - } - callback(null,opts); - }); -}; diff --git a/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js b/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js deleted file mode 100644 index 9f76ea3..0000000 --- a/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js +++ /dev/null @@ -1,103 +0,0 @@ -"use strict"; - -module.exports = exports = handle_gyp_opts; - -var fs = require('fs'); -var versioning = require('./versioning.js'); -var napi = require('./napi.js'); - -/* - -Here we gather node-pre-gyp generated options (from versioning) and pass them along to node-gyp. - -We massage the args and options slightly to account for differences in what commands mean between -node-pre-gyp and node-gyp (e.g. see the difference between "build" and "rebuild" below) - -Keep in mind: the values inside `argv` and `gyp.opts` below are different depending on whether -node-pre-gyp is called directory, or if it is called in a `run-script` phase of npm. - -We also try to preserve any command line options that might have been passed to npm or node-pre-gyp. -But this is fairly difficult without passing way to much through. For example `gyp.opts` contains all -the process.env and npm pushes a lot of variables into process.env which node-pre-gyp inherits. So we have -to be very selective about what we pass through. - -For example: - -`npm install --build-from-source` will give: - -argv == [ 'rebuild' ] -gyp.opts.argv == { remain: [ 'install' ], - cooked: [ 'install', '--fallback-to-build' ], - original: [ 'install', '--fallback-to-build' ] } - -`./bin/node-pre-gyp build` will give: - -argv == [] -gyp.opts.argv == { remain: [ 'build' ], - cooked: [ 'build' ], - original: [ '-C', 'test/app1', 'build' ] } - -*/ - -// select set of node-pre-gyp versioning info -// to share with node-gyp -var share_with_node_gyp = [ - 'module', - 'module_name', - 'module_path', - 'napi_version', - 'node_abi_napi', - 'napi_build_version', - 'node_napi_label' -]; - -function handle_gyp_opts(gyp, argv, callback) { - - // Collect node-pre-gyp specific variables to pass to node-gyp - var node_pre_gyp_options = []; - // generate custom node-pre-gyp versioning info - var napi_build_version = napi.get_napi_build_version_from_command_args(argv); - var opts = versioning.evaluate(JSON.parse(fs.readFileSync('./package.json')), gyp.opts, napi_build_version); - share_with_node_gyp.forEach(function(key) { - var val = opts[key]; - if (val) { - node_pre_gyp_options.push('--' + key + '=' + val); - } else if (key === 'napi_build_version') { - node_pre_gyp_options.push('--' + key + '=0'); - } else { - if (key !== 'napi_version' && key !== 'node_abi_napi') - return callback(new Error("Option " + key + " required but not found by node-pre-gyp")); - } - }); - - // Collect options that follow the special -- which disables nopt parsing - var unparsed_options = []; - var double_hyphen_found = false; - gyp.opts.argv.original.forEach(function(opt) { - if (double_hyphen_found) { - unparsed_options.push(opt); - } - if (opt == '--') { - double_hyphen_found = true; - } - }); - - // We try respect and pass through remaining command - // line options (like --foo=bar) to node-gyp - var cooked = gyp.opts.argv.cooked; - var node_gyp_options = []; - cooked.forEach(function(value) { - if (value.length > 2 && value.slice(0,2) == '--') { - var key = value.slice(2); - var val = cooked[cooked.indexOf(value)+1]; - if (val && val.indexOf('--') === -1) { // handle '--foo=bar' or ['--foo','bar'] - node_gyp_options.push('--' + key + '=' + val); - } else { // pass through --foo - node_gyp_options.push(value); - } - } - }); - - var result = {'opts':opts,'gyp':node_gyp_options,'pre':node_pre_gyp_options,'unparsed':unparsed_options}; - return callback(null,result); -} diff --git a/node_modules/node-pre-gyp/lib/util/napi.js b/node_modules/node-pre-gyp/lib/util/napi.js deleted file mode 100644 index 1e45ca0..0000000 --- a/node_modules/node-pre-gyp/lib/util/napi.js +++ /dev/null @@ -1,204 +0,0 @@ -"use strict"; - -var fs = require('fs'); -var rm = require('rimraf'); -var log = require('npmlog'); - -module.exports = exports; - -var versionArray = process.version - .substr(1) - .replace(/-.*$/, '') - .split('.') - .map(function(item) { - return +item; - }); - -var napi_multiple_commands = [ - 'build', - 'clean', - 'configure', - 'package', - 'publish', - 'reveal', - 'testbinary', - 'testpackage', - 'unpublish' -]; - -var napi_build_version_tag = 'napi_build_version='; - -module.exports.get_napi_version = function(target) { // target may be undefined - // returns the non-zero numeric napi version or undefined if napi is not supported. - // correctly supporting target requires an updated cross-walk - var version = process.versions.napi; // can be undefined - if (!version) { // this code should never need to be updated - if (versionArray[0] === 9 && versionArray[1] >= 3) version = 2; // 9.3.0+ - else if (versionArray[0] === 8) version = 1; // 8.0.0+ - } - return version; -}; - -module.exports.get_napi_version_as_string = function(target) { - // returns the napi version as a string or an empty string if napi is not supported. - var version = module.exports.get_napi_version(target); - return version ? ''+version : ''; -}; - -module.exports.validate_package_json = function(package_json, opts) { // throws Error - - var binary = package_json.binary; - var module_path_ok = pathOK(binary.module_path); - var remote_path_ok = pathOK(binary.remote_path); - var package_name_ok = pathOK(binary.package_name); - var napi_build_versions = module.exports.get_napi_build_versions(package_json,opts,true); - var napi_build_versions_raw = module.exports.get_napi_build_versions_raw(package_json); - - if (napi_build_versions) { - napi_build_versions.forEach(function(napi_build_version){ - if (!(parseInt(napi_build_version,10) === napi_build_version && napi_build_version > 0)) { - throw new Error("All values specified in napi_versions must be positive integers."); - } - }); - } - - if (napi_build_versions && (!module_path_ok || (!remote_path_ok && !package_name_ok))) { - throw new Error("When napi_versions is specified; module_path and either remote_path or " + - "package_name must contain the substitution string '{napi_build_version}`."); - } - - if ((module_path_ok || remote_path_ok || package_name_ok) && !napi_build_versions_raw) { - throw new Error("When the substitution string '{napi_build_version}` is specified in " + - "module_path, remote_path, or package_name; napi_versions must also be specified."); - } - - if (napi_build_versions && !module.exports.get_best_napi_build_version(package_json, opts) && - module.exports.build_napi_only(package_json)) { - throw new Error( - 'The N-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' + - 'This module supports N-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' + - 'This Node instance cannot run this module.'); - } - - if (napi_build_versions_raw && !napi_build_versions && module.exports.build_napi_only(package_json)) { - throw new Error( - 'The N-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' + - 'This module supports N-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' + - 'This Node instance cannot run this module.'); - } - -}; - -function pathOK (path) { - return path && (path.indexOf('{napi_build_version}') !== -1 || path.indexOf('{node_napi_label}') !== -1); -} - -module.exports.expand_commands = function(package_json, opts, commands) { - var expanded_commands = []; - var napi_build_versions = module.exports.get_napi_build_versions(package_json, opts); - commands.forEach(function(command){ - if (napi_build_versions && command.name === 'install') { - var napi_build_version = module.exports.get_best_napi_build_version(package_json, opts); - var args = napi_build_version ? [ napi_build_version_tag+napi_build_version ] : [ ]; - expanded_commands.push ({ name: command.name, args: args }); - } else if (napi_build_versions && napi_multiple_commands.indexOf(command.name) !== -1) { - napi_build_versions.forEach(function(napi_build_version){ - var args = command.args.slice(); - args.push (napi_build_version_tag+napi_build_version); - expanded_commands.push ({ name: command.name, args: args }); - }); - } else { - expanded_commands.push (command); - } - }); - return expanded_commands; -}; - -module.exports.get_napi_build_versions = function(package_json, opts, warnings) { // opts may be undefined - var napi_build_versions = []; - var supported_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined); - // remove duplicates, verify each napi version can actaully be built - if (package_json.binary && package_json.binary.napi_versions) { - package_json.binary.napi_versions.forEach(function(napi_version) { - var duplicated = napi_build_versions.indexOf(napi_version) !== -1; - if (!duplicated && supported_napi_version && napi_version <= supported_napi_version) { - napi_build_versions.push(napi_version); - } else if (warnings && !duplicated && supported_napi_version) { - log.info('This Node instance does not support builds for N-API version', napi_version); - } - }); - } - if (opts && opts["build-latest-napi-version-only"]) { - var latest_version = 0; - napi_build_versions.forEach(function(napi_version) { - if (napi_version > latest_version) latest_version = napi_version; - }); - napi_build_versions = latest_version ? [ latest_version ] : []; - } - return napi_build_versions.length ? napi_build_versions : undefined; -}; - -module.exports.get_napi_build_versions_raw = function(package_json) { - var napi_build_versions = []; - // remove duplicates - if (package_json.binary && package_json.binary.napi_versions) { - package_json.binary.napi_versions.forEach(function(napi_version) { - if (napi_build_versions.indexOf(napi_version) === -1) { - napi_build_versions.push(napi_version); - } - }); - } - return napi_build_versions.length ? napi_build_versions : undefined; -}; - -module.exports.get_command_arg = function(napi_build_version) { - return napi_build_version_tag + napi_build_version; -}; - -module.exports.get_napi_build_version_from_command_args = function(command_args) { - for (var i = 0; i < command_args.length; i++) { - var arg = command_args[i]; - if (arg.indexOf(napi_build_version_tag) === 0) { - return parseInt(arg.substr(napi_build_version_tag.length),10); - } - } - return undefined; -}; - -module.exports.swap_build_dir_out = function(napi_build_version) { - if (napi_build_version) { - rm.sync(module.exports.get_build_dir(napi_build_version)); - fs.renameSync('build', module.exports.get_build_dir(napi_build_version)); - } -}; - -module.exports.swap_build_dir_in = function(napi_build_version) { - if (napi_build_version) { - rm.sync('build'); - fs.renameSync(module.exports.get_build_dir(napi_build_version), 'build'); - } -}; - -module.exports.get_build_dir = function(napi_build_version) { - return 'build-tmp-napi-v'+napi_build_version; -}; - -module.exports.get_best_napi_build_version = function(package_json, opts) { - var best_napi_build_version = 0; - var napi_build_versions = module.exports.get_napi_build_versions (package_json, opts); - if (napi_build_versions) { - var our_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined); - napi_build_versions.forEach(function(napi_build_version){ - if (napi_build_version > best_napi_build_version && - napi_build_version <= our_napi_version) { - best_napi_build_version = napi_build_version; - } - }); - } - return best_napi_build_version === 0 ? undefined : best_napi_build_version; -}; - -module.exports.build_napi_only = function(package_json) { - return package_json.binary && package_json.binary.package_name && - package_json.binary.package_name.indexOf('{node_napi_label}') === -1; -}; \ No newline at end of file diff --git a/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html b/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html deleted file mode 100644 index 244466c..0000000 --- a/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - -Node-webkit-based module test - - - -

Node-webkit-based module test

- - diff --git a/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json b/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json deleted file mode 100644 index 71d03f8..0000000 --- a/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ -"main": "index.html", -"name": "nw-pre-gyp-module-test", -"description": "Node-webkit-based module test.", -"version": "0.0.1", -"window": { - "show": false -} -} diff --git a/node_modules/node-pre-gyp/lib/util/s3_setup.js b/node_modules/node-pre-gyp/lib/util/s3_setup.js deleted file mode 100644 index 5bc42e9..0000000 --- a/node_modules/node-pre-gyp/lib/util/s3_setup.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -module.exports = exports; - -var url = require('url'); - -var URI_REGEX="^(.*)\.(s3(?:-.*)?)\.amazonaws\.com$"; - -module.exports.detect = function(to,config) { - var uri = url.parse(to); - var hostname_matches = uri.hostname.match(URI_REGEX); - config.prefix = (!uri.pathname || uri.pathname == '/') ? '' : uri.pathname.replace('/',''); - if(!hostname_matches) { - return; - } - if (!config.bucket) { - config.bucket = hostname_matches[1]; - } - if (!config.region) { - var s3_domain = hostname_matches[2]; - if (s3_domain.slice(0,3) == 's3-' && - s3_domain.length >= 3) { - // it appears the region is explicit in the url - config.region = s3_domain.replace('s3-',''); - } - } -}; diff --git a/node_modules/node-pre-gyp/lib/util/versioning.js b/node_modules/node-pre-gyp/lib/util/versioning.js deleted file mode 100644 index fafb0da..0000000 --- a/node_modules/node-pre-gyp/lib/util/versioning.js +++ /dev/null @@ -1,331 +0,0 @@ -"use strict"; - -module.exports = exports; - -var path = require('path'); -var semver = require('semver'); -var url = require('url'); -var detect_libc = require('detect-libc'); -var napi = require('./napi.js'); - -var abi_crosswalk; - -// This is used for unit testing to provide a fake -// ABI crosswalk that emulates one that is not updated -// for the current version -if (process.env.NODE_PRE_GYP_ABI_CROSSWALK) { - abi_crosswalk = require(process.env.NODE_PRE_GYP_ABI_CROSSWALK); -} else { - abi_crosswalk = require('./abi_crosswalk.json'); -} - -var major_versions = {}; -Object.keys(abi_crosswalk).forEach(function(v) { - var major = v.split('.')[0]; - if (!major_versions[major]) { - major_versions[major] = v; - } -}); - -function get_electron_abi(runtime, target_version) { - if (!runtime) { - throw new Error("get_electron_abi requires valid runtime arg"); - } - if (typeof target_version === 'undefined') { - // erroneous CLI call - throw new Error("Empty target version is not supported if electron is the target."); - } - // Electron guarantees that patch version update won't break native modules. - var sem_ver = semver.parse(target_version); - return runtime + '-v' + sem_ver.major + '.' + sem_ver.minor; -} -module.exports.get_electron_abi = get_electron_abi; - -function get_node_webkit_abi(runtime, target_version) { - if (!runtime) { - throw new Error("get_node_webkit_abi requires valid runtime arg"); - } - if (typeof target_version === 'undefined') { - // erroneous CLI call - throw new Error("Empty target version is not supported if node-webkit is the target."); - } - return runtime + '-v' + target_version; -} -module.exports.get_node_webkit_abi = get_node_webkit_abi; - -function get_node_abi(runtime, versions) { - if (!runtime) { - throw new Error("get_node_abi requires valid runtime arg"); - } - if (!versions) { - throw new Error("get_node_abi requires valid process.versions object"); - } - var sem_ver = semver.parse(versions.node); - if (sem_ver.major === 0 && sem_ver.minor % 2) { // odd series - // https://github.com/mapbox/node-pre-gyp/issues/124 - return runtime+'-v'+versions.node; - } else { - // process.versions.modules added in >= v0.10.4 and v0.11.7 - // https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e - return versions.modules ? runtime+'-v' + (+versions.modules) : - 'v8-' + versions.v8.split('.').slice(0,2).join('.'); - } -} -module.exports.get_node_abi = get_node_abi; - -function get_runtime_abi(runtime, target_version) { - if (!runtime) { - throw new Error("get_runtime_abi requires valid runtime arg"); - } - if (runtime === 'node-webkit') { - return get_node_webkit_abi(runtime, target_version || process.versions['node-webkit']); - } else if (runtime === 'electron') { - return get_electron_abi(runtime, target_version || process.versions.electron); - } else { - if (runtime != 'node') { - throw new Error("Unknown Runtime: '" + runtime + "'"); - } - if (!target_version) { - return get_node_abi(runtime,process.versions); - } else { - var cross_obj; - // abi_crosswalk generated with ./scripts/abi_crosswalk.js - if (abi_crosswalk[target_version]) { - cross_obj = abi_crosswalk[target_version]; - } else { - var target_parts = target_version.split('.').map(function(i) { return +i; }); - if (target_parts.length != 3) { // parse failed - throw new Error("Unknown target version: " + target_version); - } - /* - The below code tries to infer the last known ABI compatible version - that we have recorded in the abi_crosswalk.json when an exact match - is not possible. The reasons for this to exist are complicated: - - - We support passing --target to be able to allow developers to package binaries for versions of node - that are not the same one as they are running. This might also be used in combination with the - --target_arch or --target_platform flags to also package binaries for alternative platforms - - When --target is passed we can't therefore determine the ABI (process.versions.modules) from the node - version that is running in memory - - So, therefore node-pre-gyp keeps an "ABI crosswalk" (lib/util/abi_crosswalk.json) to be able to look - this info up for all versions - - But we cannot easily predict what the future ABI will be for released versions - - And node-pre-gyp needs to be a `bundledDependency` in apps that depend on it in order to work correctly - by being fully available at install time. - - So, the speed of node releases and the bundled nature of node-pre-gyp mean that a new node-pre-gyp release - need to happen for every node.js/io.js/node-webkit/nw.js/atom-shell/etc release that might come online if - you want the `--target` flag to keep working for the latest version - - Which is impractical ^^ - - Hence the below code guesses about future ABI to make the need to update node-pre-gyp less demanding. - - In practice then you can have a dependency of your app like `node-sqlite3` that bundles a `node-pre-gyp` that - only knows about node v0.10.33 in the `abi_crosswalk.json` but target node v0.10.34 (which is assumed to be - ABI compatible with v0.10.33). - - TODO: use semver module instead of custom version parsing - */ - var major = target_parts[0]; - var minor = target_parts[1]; - var patch = target_parts[2]; - // io.js: yeah if node.js ever releases 1.x this will break - // but that is unlikely to happen: https://github.com/iojs/io.js/pull/253#issuecomment-69432616 - if (major === 1) { - // look for last release that is the same major version - // e.g. we assume io.js 1.x is ABI compatible with >= 1.0.0 - while (true) { - if (minor > 0) --minor; - if (patch > 0) --patch; - var new_iojs_target = '' + major + '.' + minor + '.' + patch; - if (abi_crosswalk[new_iojs_target]) { - cross_obj = abi_crosswalk[new_iojs_target]; - console.log('Warning: node-pre-gyp could not find exact match for ' + target_version); - console.log('Warning: but node-pre-gyp successfully choose ' + new_iojs_target + ' as ABI compatible target'); - break; - } - if (minor === 0 && patch === 0) { - break; - } - } - } else if (major >= 2) { - // look for last release that is the same major version - if (major_versions[major]) { - cross_obj = abi_crosswalk[major_versions[major]]; - console.log('Warning: node-pre-gyp could not find exact match for ' + target_version); - console.log('Warning: but node-pre-gyp successfully choose ' + major_versions[major] + ' as ABI compatible target'); - } - } else if (major === 0) { // node.js - if (target_parts[1] % 2 === 0) { // for stable/even node.js series - // look for the last release that is the same minor release - // e.g. we assume node 0.10.x is ABI compatible with >= 0.10.0 - while (--patch > 0) { - var new_node_target = '' + major + '.' + minor + '.' + patch; - if (abi_crosswalk[new_node_target]) { - cross_obj = abi_crosswalk[new_node_target]; - console.log('Warning: node-pre-gyp could not find exact match for ' + target_version); - console.log('Warning: but node-pre-gyp successfully choose ' + new_node_target + ' as ABI compatible target'); - break; - } - } - } - } - } - if (!cross_obj) { - throw new Error("Unsupported target version: " + target_version); - } - // emulate process.versions - var versions_obj = { - node: target_version, - v8: cross_obj.v8+'.0', - // abi_crosswalk uses 1 for node versions lacking process.versions.modules - // process.versions.modules added in >= v0.10.4 and v0.11.7 - modules: cross_obj.node_abi > 1 ? cross_obj.node_abi : undefined - }; - return get_node_abi(runtime, versions_obj); - } - } -} -module.exports.get_runtime_abi = get_runtime_abi; - -var required_parameters = [ - 'module_name', - 'module_path', - 'host' -]; - -function validate_config(package_json,opts) { - var msg = package_json.name + ' package.json is not node-pre-gyp ready:\n'; - var missing = []; - if (!package_json.main) { - missing.push('main'); - } - if (!package_json.version) { - missing.push('version'); - } - if (!package_json.name) { - missing.push('name'); - } - if (!package_json.binary) { - missing.push('binary'); - } - var o = package_json.binary; - required_parameters.forEach(function(p) { - if (missing.indexOf('binary') > -1) { - missing.pop('binary'); - } - if (!o || o[p] === undefined || o[p] === "") { - missing.push('binary.' + p); - } - }); - if (missing.length >= 1) { - throw new Error(msg+"package.json must declare these properties: \n" + missing.join('\n')); - } - if (o) { - // enforce https over http - var protocol = url.parse(o.host).protocol; - if (protocol === 'http:') { - throw new Error("'host' protocol ("+protocol+") is invalid - only 'https:' is accepted"); - } - } - napi.validate_package_json(package_json,opts); -} - -module.exports.validate_config = validate_config; - -function eval_template(template,opts) { - Object.keys(opts).forEach(function(key) { - var pattern = '{'+key+'}'; - while (template.indexOf(pattern) > -1) { - template = template.replace(pattern,opts[key]); - } - }); - return template; -} - -// url.resolve needs single trailing slash -// to behave correctly, otherwise a double slash -// may end up in the url which breaks requests -// and a lacking slash may not lead to proper joining -function fix_slashes(pathname) { - if (pathname.slice(-1) != '/') { - return pathname + '/'; - } - return pathname; -} - -// remove double slashes -// note: path.normalize will not work because -// it will convert forward to back slashes -function drop_double_slashes(pathname) { - return pathname.replace(/\/\//g,'/'); -} - -function get_process_runtime(versions) { - var runtime = 'node'; - if (versions['node-webkit']) { - runtime = 'node-webkit'; - } else if (versions.electron) { - runtime = 'electron'; - } - return runtime; -} - -module.exports.get_process_runtime = get_process_runtime; - -var default_package_name = '{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz'; -var default_remote_path = ''; - -module.exports.evaluate = function(package_json,options,napi_build_version) { - options = options || {}; - validate_config(package_json,options); // options is a suitable substitute for opts in this case - var v = package_json.version; - var module_version = semver.parse(v); - var runtime = options.runtime || get_process_runtime(process.versions); - var opts = { - name: package_json.name, - configuration: Boolean(options.debug) ? 'Debug' : 'Release', - debug: options.debug, - module_name: package_json.binary.module_name, - version: module_version.version, - prerelease: module_version.prerelease.length ? module_version.prerelease.join('.') : '', - build: module_version.build.length ? module_version.build.join('.') : '', - major: module_version.major, - minor: module_version.minor, - patch: module_version.patch, - runtime: runtime, - node_abi: get_runtime_abi(runtime,options.target), - node_abi_napi: napi.get_napi_version(options.target) ? 'napi' : get_runtime_abi(runtime,options.target), - napi_version: napi.get_napi_version(options.target), // non-zero numeric, undefined if unsupported - napi_build_version: napi_build_version || '', - node_napi_label: napi_build_version ? 'napi-v' + napi_build_version : get_runtime_abi(runtime,options.target), - target: options.target || '', - platform: options.target_platform || process.platform, - target_platform: options.target_platform || process.platform, - arch: options.target_arch || process.arch, - target_arch: options.target_arch || process.arch, - libc: options.target_libc || detect_libc.family || 'unknown', - module_main: package_json.main, - toolset : options.toolset || '' // address https://github.com/mapbox/node-pre-gyp/issues/119 - }; - // support host mirror with npm config `--{module_name}_binary_host_mirror` - // e.g.: https://github.com/node-inspector/v8-profiler/blob/master/package.json#L25 - // > npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/ - var host = process.env['npm_config_' + opts.module_name + '_binary_host_mirror'] || package_json.binary.host; - opts.host = fix_slashes(eval_template(host,opts)); - opts.module_path = eval_template(package_json.binary.module_path,opts); - // now we resolve the module_path to ensure it is absolute so that binding.gyp variables work predictably - if (options.module_root) { - // resolve relative to known module root: works for pre-binding require - opts.module_path = path.join(options.module_root,opts.module_path); - } else { - // resolve relative to current working directory: works for node-pre-gyp commands - opts.module_path = path.resolve(opts.module_path); - } - opts.module = path.join(opts.module_path,opts.module_name + '.node'); - opts.remote_path = package_json.binary.remote_path ? drop_double_slashes(fix_slashes(eval_template(package_json.binary.remote_path,opts))) : default_remote_path; - var package_name = package_json.binary.package_name ? package_json.binary.package_name : default_package_name; - opts.package_name = eval_template(package_name,opts); - opts.staged_tarball = path.join('build/stage',opts.remote_path,opts.package_name); - opts.hosted_path = url.resolve(opts.host,opts.remote_path); - opts.hosted_tarball = url.resolve(opts.hosted_path,opts.package_name); - return opts; -}; diff --git a/node_modules/node-pre-gyp/package.json b/node_modules/node-pre-gyp/package.json deleted file mode 100644 index 6aa4abc..0000000 --- a/node_modules/node-pre-gyp/package.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "_from": "node-pre-gyp@^0.11.0", - "_id": "node-pre-gyp@0.11.0", - "_inBundle": false, - "_integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==", - "_location": "/node-pre-gyp", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "node-pre-gyp@^0.11.0", - "name": "node-pre-gyp", - "escapedName": "node-pre-gyp", - "rawSpec": "^0.11.0", - "saveSpec": null, - "fetchSpec": "^0.11.0" - }, - "_requiredBy": [ - "/canvas" - ], - "_resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz", - "_shasum": "db1f33215272f692cd38f03238e3e9b47c5dd054", - "_spec": "node-pre-gyp@^0.11.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/canvas", - "author": { - "name": "Dane Springmeyer", - "email": "dane@mapbox.com" - }, - "bin": { - "node-pre-gyp": "bin/node-pre-gyp" - }, - "bugs": { - "url": "https://github.com/mapbox/node-pre-gyp/issues" - }, - "bundleDependencies": false, - "dependencies": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - }, - "deprecated": false, - "description": "Node.js native addon binary install tool", - "devDependencies": { - "aws-sdk": "^2.28.0", - "jshint": "^2.9.5", - "nock": "^9.2.3", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/mapbox/node-pre-gyp#readme", - "jshintConfig": { - "node": true, - "globalstrict": true, - "undef": true, - "unused": false, - "noarg": true - }, - "keywords": [ - "native", - "addon", - "module", - "c", - "c++", - "bindings", - "binary" - ], - "license": "BSD-3-Clause", - "main": "./lib/node-pre-gyp.js", - "name": "node-pre-gyp", - "repository": { - "type": "git", - "url": "git://github.com/mapbox/node-pre-gyp.git" - }, - "scripts": { - "pretest": "jshint test/build.test.js test/s3_setup.test.js test/versioning.test.js test/fetch.test.js lib lib/util scripts bin/node-pre-gyp", - "test": "jshint lib lib/util scripts bin/node-pre-gyp && tape test/*test.js", - "update-crosswalk": "node scripts/abi_crosswalk.js" - }, - "version": "0.11.0" -} diff --git a/node_modules/nopt/CHANGELOG.md b/node_modules/nopt/CHANGELOG.md deleted file mode 100644 index 82a09fb..0000000 --- a/node_modules/nopt/CHANGELOG.md +++ /dev/null @@ -1,58 +0,0 @@ -### v4.0.1 (2016-12-14) - -#### WHOOPS - -* [`fb9b1ce`](https://github.com/npm/nopt/commit/fb9b1ce57b3c69b4f7819015be87719204f77ef6) - Merged so many patches at once that the code fencing - ([@adius](https://github.com/adius)) added got broken. Sorry, - ([@adius](https://github.com/adius))! - ([@othiym23](https://github.com/othiym23)) - -### v4.0.0 (2016-12-13) - -#### BREAKING CHANGES - -* [`651d447`](https://github.com/npm/nopt/commit/651d4473946096d341a480bbe56793de3fc706aa) - When parsing String-typed arguments, if the next value is `""`, don't simply - swallow it. ([@samjonester](https://github.com/samjonester)) - -#### PERFORMANCE TWEAKS - -* [`3370ce8`](https://github.com/npm/nopt/commit/3370ce87a7618ba228883861db84ddbcdff252a9) - Simplify initialization. ([@elidoran](https://github.com/elidoran)) -* [`356e58e`](https://github.com/npm/nopt/commit/356e58e3b3b431a4b1af7fd7bdee44c2c0526a09) - Store `Array.isArray(types[arg])` for reuse. - ([@elidoran](https://github.com/elidoran)) -* [`0d95e90`](https://github.com/npm/nopt/commit/0d95e90515844f266015b56d2c80b94e5d14a07e) - Interpret single-item type arrays as a single type. - ([@samjonester](https://github.com/samjonester)) -* [`07c69d3`](https://github.com/npm/nopt/commit/07c69d38b5186450941fbb505550becb78a0e925) - Simplify key-value extraction. ([@elidoran](https://github.com/elidoran)) -* [`39b6e5c`](https://github.com/npm/nopt/commit/39b6e5c65ac47f60cd43a1fbeece5cd4c834c254) - Only call `Date.parse(val)` once. ([@elidoran](https://github.com/elidoran)) -* [`934943d`](https://github.com/npm/nopt/commit/934943dffecb55123a2b15959fe2a359319a5dbd) - Use `osenv.home()` to find a user's home directory instead of assuming it's - always `$HOME`. ([@othiym23](https://github.com/othiym23)) - -#### TEST & CI IMPROVEMENTS - -* [`326ffff`](https://github.com/npm/nopt/commit/326ffff7f78a00bcd316adecf69075f8a8093619) - Fix `/tmp` test to work on Windows. - ([@elidoran](https://github.com/elidoran)) -* [`c89d31a`](https://github.com/npm/nopt/commit/c89d31a49d14f2238bc6672db08da697bbc57f1b) - Only run Windows tests on Windows, only run Unix tests on a Unix. - ([@elidoran](https://github.com/elidoran)) -* [`affd3d1`](https://github.com/npm/nopt/commit/affd3d1d0addffa93006397b2013b18447339366) - Refresh Travis to run the tests against the currently-supported batch of npm - versions. ([@helio](https://github.com/helio)-frota) -* [`55f9449`](https://github.com/npm/nopt/commit/55f94497d163ed4d16dd55fd6c4fb95cc440e66d) - `tap@8.0.1` ([@othiym23](https://github.com/othiym23)) - -#### DOC TWEAKS - -* [`5271229`](https://github.com/npm/nopt/commit/5271229ee7c810217dd51616c086f5d9ab224581) - Use JavaScript code block for syntax highlighting. - ([@adius](https://github.com/adius)) -* [`c0d156f`](https://github.com/npm/nopt/commit/c0d156f229f9994c5dfcec4a8886eceff7a07682) - The code sample in the README had `many2: [ oneThing ]`, and now it has - `many2: [ two, things ]`. ([@silkentrance](https://github.com/silkentrance)) diff --git a/node_modules/nopt/LICENSE b/node_modules/nopt/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/nopt/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/nopt/README.md b/node_modules/nopt/README.md deleted file mode 100644 index a99531c..0000000 --- a/node_modules/nopt/README.md +++ /dev/null @@ -1,213 +0,0 @@ -If you want to write an option parser, and have it be good, there are -two ways to do it. The Right Way, and the Wrong Way. - -The Wrong Way is to sit down and write an option parser. We've all done -that. - -The Right Way is to write some complex configurable program with so many -options that you hit the limit of your frustration just trying to -manage them all, and defer it with duct-tape solutions until you see -exactly to the core of the problem, and finally snap and write an -awesome option parser. - -If you want to write an option parser, don't write an option parser. -Write a package manager, or a source control system, or a service -restarter, or an operating system. You probably won't end up with a -good one of those, but if you don't give up, and you are relentless and -diligent enough in your procrastination, you may just end up with a very -nice option parser. - -## USAGE - -```javascript -// my-program.js -var nopt = require("nopt") - , Stream = require("stream").Stream - , path = require("path") - , knownOpts = { "foo" : [String, null] - , "bar" : [Stream, Number] - , "baz" : path - , "bloo" : [ "big", "medium", "small" ] - , "flag" : Boolean - , "pick" : Boolean - , "many1" : [String, Array] - , "many2" : [path, Array] - } - , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] - , "b7" : ["--bar", "7"] - , "m" : ["--bloo", "medium"] - , "p" : ["--pick"] - , "f" : ["--flag"] - } - // everything is optional. - // knownOpts and shorthands default to {} - // arg list defaults to process.argv - // slice defaults to 2 - , parsed = nopt(knownOpts, shortHands, process.argv, 2) -console.log(parsed) -``` - -This would give you support for any of the following: - -```console -$ node my-program.js --foo "blerp" --no-flag -{ "foo" : "blerp", "flag" : false } - -$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag -{ bar: 7, foo: "Mr. Hand", flag: true } - -$ node my-program.js --foo "blerp" -f -----p -{ foo: "blerp", flag: true, pick: true } - -$ node my-program.js -fp --foofoo -{ foo: "Mr. Foo", flag: true, pick: true } - -$ node my-program.js --foofoo -- -fp # -- stops the flag parsing. -{ foo: "Mr. Foo", argv: { remain: ["-fp"] } } - -$ node my-program.js --blatzk -fp # unknown opts are ok. -{ blatzk: true, flag: true, pick: true } - -$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value -{ blatzk: 1000, flag: true, pick: true } - -$ node my-program.js --no-blatzk -fp # unless they start with "no-" -{ blatzk: false, flag: true, pick: true } - -$ node my-program.js --baz b/a/z # known paths are resolved. -{ baz: "/Users/isaacs/b/a/z" } - -# if Array is one of the types, then it can take many -# values, and will always be an array. The other types provided -# specify what types are allowed in the list. - -$ node my-program.js --many1 5 --many1 null --many1 foo -{ many1: ["5", "null", "foo"] } - -$ node my-program.js --many2 foo --many2 bar -{ many2: ["/path/to/foo", "path/to/bar"] } -``` - -Read the tests at the bottom of `lib/nopt.js` for more examples of -what this puppy can do. - -## Types - -The following types are supported, and defined on `nopt.typeDefs` - -* String: A normal string. No parsing is done. -* path: A file system path. Gets resolved against cwd if not absolute. -* url: A url. If it doesn't parse, it isn't accepted. -* Number: Must be numeric. -* Date: Must parse as a date. If it does, and `Date` is one of the options, - then it will return a Date object, not a string. -* Boolean: Must be either `true` or `false`. If an option is a boolean, - then it does not need a value, and its presence will imply `true` as - the value. To negate boolean flags, do `--no-whatever` or `--whatever - false` -* NaN: Means that the option is strictly not allowed. Any value will - fail. -* Stream: An object matching the "Stream" class in node. Valuable - for use when validating programmatically. (npm uses this to let you - supply any WriteStream on the `outfd` and `logfd` config options.) -* Array: If `Array` is specified as one of the types, then the value - will be parsed as a list of options. This means that multiple values - can be specified, and that the value will always be an array. - -If a type is an array of values not on this list, then those are -considered valid values. For instance, in the example above, the -`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`, -and any other value will be rejected. - -When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be -interpreted as their JavaScript equivalents. - -You can also mix types and values, or multiple types, in a list. For -instance `{ blah: [Number, null] }` would allow a value to be set to -either a Number or null. When types are ordered, this implies a -preference, and the first type that can be used to properly interpret -the value will be used. - -To define a new type, add it to `nopt.typeDefs`. Each item in that -hash is an object with a `type` member and a `validate` method. The -`type` member is an object that matches what goes in the type list. The -`validate` method is a function that gets called with `validate(data, -key, val)`. Validate methods should assign `data[key]` to the valid -value of `val` if it can be handled properly, or return boolean -`false` if it cannot. - -You can also call `nopt.clean(data, types, typeDefs)` to clean up a -config object and remove its invalid properties. - -## Error Handling - -By default, nopt outputs a warning to standard error when invalid values for -known options are found. You can change this behavior by assigning a method -to `nopt.invalidHandler`. This method will be called with -the offending `nopt.invalidHandler(key, val, types)`. - -If no `nopt.invalidHandler` is assigned, then it will console.error -its whining. If it is assigned to boolean `false` then the warning is -suppressed. - -## Abbreviations - -Yes, they are supported. If you define options like this: - -```javascript -{ "foolhardyelephants" : Boolean -, "pileofmonkeys" : Boolean } -``` - -Then this will work: - -```bash -node program.js --foolhar --pil -node program.js --no-f --pileofmon -# etc. -``` - -## Shorthands - -Shorthands are a hash of shorter option names to a snippet of args that -they expand to. - -If multiple one-character shorthands are all combined, and the -combination does not unambiguously match any other option or shorthand, -then they will be broken up into their constituent parts. For example: - -```json -{ "s" : ["--loglevel", "silent"] -, "g" : "--global" -, "f" : "--force" -, "p" : "--parseable" -, "l" : "--long" -} -``` - -```bash -npm ls -sgflp -# just like doing this: -npm ls --loglevel silent --global --force --long --parseable -``` - -## The Rest of the args - -The config object returned by nopt is given a special member called -`argv`, which is an object with the following fields: - -* `remain`: The remaining args after all the parsing has occurred. -* `original`: The args as they originally appeared. -* `cooked`: The args after flags and shorthands are expanded. - -## Slicing - -Node programs are called with more or less the exact argv as it appears -in C land, after the v8 and node-specific options have been plucked off. -As such, `argv[0]` is always `node` and `argv[1]` is always the -JavaScript program being run. - -That's usually not very useful to you. So they're sliced off by -default. If you want them, then you can pass in `0` as the last -argument, or any other number that you'd like to slice off the start of -the list. diff --git a/node_modules/nopt/bin/nopt.js b/node_modules/nopt/bin/nopt.js deleted file mode 100755 index 3232d4c..0000000 --- a/node_modules/nopt/bin/nopt.js +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env node -var nopt = require("../lib/nopt") - , path = require("path") - , types = { num: Number - , bool: Boolean - , help: Boolean - , list: Array - , "num-list": [Number, Array] - , "str-list": [String, Array] - , "bool-list": [Boolean, Array] - , str: String - , clear: Boolean - , config: Boolean - , length: Number - , file: path - } - , shorthands = { s: [ "--str", "astring" ] - , b: [ "--bool" ] - , nb: [ "--no-bool" ] - , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ] - , "?": ["--help"] - , h: ["--help"] - , H: ["--help"] - , n: [ "--num", "125" ] - , c: ["--config"] - , l: ["--length"] - , f: ["--file"] - } - , parsed = nopt( types - , shorthands - , process.argv - , 2 ) - -console.log("parsed", parsed) - -if (parsed.help) { - console.log("") - console.log("nopt cli tester") - console.log("") - console.log("types") - console.log(Object.keys(types).map(function M (t) { - var type = types[t] - if (Array.isArray(type)) { - return [t, type.map(function (type) { return type.name })] - } - return [t, type && type.name] - }).reduce(function (s, i) { - s[i[0]] = i[1] - return s - }, {})) - console.log("") - console.log("shorthands") - console.log(shorthands) -} diff --git a/node_modules/nopt/lib/nopt.js b/node_modules/nopt/lib/nopt.js deleted file mode 100644 index 0ec5753..0000000 --- a/node_modules/nopt/lib/nopt.js +++ /dev/null @@ -1,441 +0,0 @@ -// info about each config option. - -var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG - ? function () { console.error.apply(console, arguments) } - : function () {} - -var url = require("url") - , path = require("path") - , Stream = require("stream").Stream - , abbrev = require("abbrev") - , osenv = require("osenv") - -module.exports = exports = nopt -exports.clean = clean - -exports.typeDefs = - { String : { type: String, validate: validateString } - , Boolean : { type: Boolean, validate: validateBoolean } - , url : { type: url, validate: validateUrl } - , Number : { type: Number, validate: validateNumber } - , path : { type: path, validate: validatePath } - , Stream : { type: Stream, validate: validateStream } - , Date : { type: Date, validate: validateDate } - } - -function nopt (types, shorthands, args, slice) { - args = args || process.argv - types = types || {} - shorthands = shorthands || {} - if (typeof slice !== "number") slice = 2 - - debug(types, shorthands, args, slice) - - args = args.slice(slice) - var data = {} - , key - , argv = { - remain: [], - cooked: args, - original: args.slice(0) - } - - parse(args, data, argv.remain, types, shorthands) - // now data is full - clean(data, types, exports.typeDefs) - data.argv = argv - Object.defineProperty(data.argv, 'toString', { value: function () { - return this.original.map(JSON.stringify).join(" ") - }, enumerable: false }) - return data -} - -function clean (data, types, typeDefs) { - typeDefs = typeDefs || exports.typeDefs - var remove = {} - , typeDefault = [false, true, null, String, Array] - - Object.keys(data).forEach(function (k) { - if (k === "argv") return - var val = data[k] - , isArray = Array.isArray(val) - , type = types[k] - if (!isArray) val = [val] - if (!type) type = typeDefault - if (type === Array) type = typeDefault.concat(Array) - if (!Array.isArray(type)) type = [type] - - debug("val=%j", val) - debug("types=", type) - val = val.map(function (val) { - // if it's an unknown value, then parse false/true/null/numbers/dates - if (typeof val === "string") { - debug("string %j", val) - val = val.trim() - if ((val === "null" && ~type.indexOf(null)) - || (val === "true" && - (~type.indexOf(true) || ~type.indexOf(Boolean))) - || (val === "false" && - (~type.indexOf(false) || ~type.indexOf(Boolean)))) { - val = JSON.parse(val) - debug("jsonable %j", val) - } else if (~type.indexOf(Number) && !isNaN(val)) { - debug("convert to number", val) - val = +val - } else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) { - debug("convert to date", val) - val = new Date(val) - } - } - - if (!types.hasOwnProperty(k)) { - return val - } - - // allow `--no-blah` to set 'blah' to null if null is allowed - if (val === false && ~type.indexOf(null) && - !(~type.indexOf(false) || ~type.indexOf(Boolean))) { - val = null - } - - var d = {} - d[k] = val - debug("prevalidated val", d, val, types[k]) - if (!validate(d, k, val, types[k], typeDefs)) { - if (exports.invalidHandler) { - exports.invalidHandler(k, val, types[k], data) - } else if (exports.invalidHandler !== false) { - debug("invalid: "+k+"="+val, types[k]) - } - return remove - } - debug("validated val", d, val, types[k]) - return d[k] - }).filter(function (val) { return val !== remove }) - - // if we allow Array specifically, then an empty array is how we - // express 'no value here', not null. Allow it. - if (!val.length && type.indexOf(Array) === -1) { - debug('VAL HAS NO LENGTH, DELETE IT', val, k, type.indexOf(Array)) - delete data[k] - } - else if (isArray) { - debug(isArray, data[k], val) - data[k] = val - } else data[k] = val[0] - - debug("k=%s val=%j", k, val, data[k]) - }) -} - -function validateString (data, k, val) { - data[k] = String(val) -} - -function validatePath (data, k, val) { - if (val === true) return false - if (val === null) return true - - val = String(val) - - var isWin = process.platform === 'win32' - , homePattern = isWin ? /^~(\/|\\)/ : /^~\// - , home = osenv.home() - - if (home && val.match(homePattern)) { - data[k] = path.resolve(home, val.substr(2)) - } else { - data[k] = path.resolve(val) - } - return true -} - -function validateNumber (data, k, val) { - debug("validate Number %j %j %j", k, val, isNaN(val)) - if (isNaN(val)) return false - data[k] = +val -} - -function validateDate (data, k, val) { - var s = Date.parse(val) - debug("validate Date %j %j %j", k, val, s) - if (isNaN(s)) return false - data[k] = new Date(val) -} - -function validateBoolean (data, k, val) { - if (val instanceof Boolean) val = val.valueOf() - else if (typeof val === "string") { - if (!isNaN(val)) val = !!(+val) - else if (val === "null" || val === "false") val = false - else val = true - } else val = !!val - data[k] = val -} - -function validateUrl (data, k, val) { - val = url.parse(String(val)) - if (!val.host) return false - data[k] = val.href -} - -function validateStream (data, k, val) { - if (!(val instanceof Stream)) return false - data[k] = val -} - -function validate (data, k, val, type, typeDefs) { - // arrays are lists of types. - if (Array.isArray(type)) { - for (var i = 0, l = type.length; i < l; i ++) { - if (type[i] === Array) continue - if (validate(data, k, val, type[i], typeDefs)) return true - } - delete data[k] - return false - } - - // an array of anything? - if (type === Array) return true - - // NaN is poisonous. Means that something is not allowed. - if (type !== type) { - debug("Poison NaN", k, val, type) - delete data[k] - return false - } - - // explicit list of values - if (val === type) { - debug("Explicitly allowed %j", val) - // if (isArray) (data[k] = data[k] || []).push(val) - // else data[k] = val - data[k] = val - return true - } - - // now go through the list of typeDefs, validate against each one. - var ok = false - , types = Object.keys(typeDefs) - for (var i = 0, l = types.length; i < l; i ++) { - debug("test type %j %j %j", k, val, types[i]) - var t = typeDefs[types[i]] - if (t && - ((type && type.name && t.type && t.type.name) ? (type.name === t.type.name) : (type === t.type))) { - var d = {} - ok = false !== t.validate(d, k, val) - val = d[k] - if (ok) { - // if (isArray) (data[k] = data[k] || []).push(val) - // else data[k] = val - data[k] = val - break - } - } - } - debug("OK? %j (%j %j %j)", ok, k, val, types[i]) - - if (!ok) delete data[k] - return ok -} - -function parse (args, data, remain, types, shorthands) { - debug("parse", args, data, remain) - - var key = null - , abbrevs = abbrev(Object.keys(types)) - , shortAbbr = abbrev(Object.keys(shorthands)) - - for (var i = 0; i < args.length; i ++) { - var arg = args[i] - debug("arg", arg) - - if (arg.match(/^-{2,}$/)) { - // done with keys. - // the rest are args. - remain.push.apply(remain, args.slice(i + 1)) - args[i] = "--" - break - } - var hadEq = false - if (arg.charAt(0) === "-" && arg.length > 1) { - var at = arg.indexOf('=') - if (at > -1) { - hadEq = true - var v = arg.substr(at + 1) - arg = arg.substr(0, at) - args.splice(i, 1, arg, v) - } - - // see if it's a shorthand - // if so, splice and back up to re-parse it. - var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs) - debug("arg=%j shRes=%j", arg, shRes) - if (shRes) { - debug(arg, shRes) - args.splice.apply(args, [i, 1].concat(shRes)) - if (arg !== shRes[0]) { - i -- - continue - } - } - arg = arg.replace(/^-+/, "") - var no = null - while (arg.toLowerCase().indexOf("no-") === 0) { - no = !no - arg = arg.substr(3) - } - - if (abbrevs[arg]) arg = abbrevs[arg] - - var argType = types[arg] - var isTypeArray = Array.isArray(argType) - if (isTypeArray && argType.length === 1) { - isTypeArray = false - argType = argType[0] - } - - var isArray = argType === Array || - isTypeArray && argType.indexOf(Array) !== -1 - - // allow unknown things to be arrays if specified multiple times. - if (!types.hasOwnProperty(arg) && data.hasOwnProperty(arg)) { - if (!Array.isArray(data[arg])) - data[arg] = [data[arg]] - isArray = true - } - - var val - , la = args[i + 1] - - var isBool = typeof no === 'boolean' || - argType === Boolean || - isTypeArray && argType.indexOf(Boolean) !== -1 || - (typeof argType === 'undefined' && !hadEq) || - (la === "false" && - (argType === null || - isTypeArray && ~argType.indexOf(null))) - - if (isBool) { - // just set and move along - val = !no - // however, also support --bool true or --bool false - if (la === "true" || la === "false") { - val = JSON.parse(la) - la = null - if (no) val = !val - i ++ - } - - // also support "foo":[Boolean, "bar"] and "--foo bar" - if (isTypeArray && la) { - if (~argType.indexOf(la)) { - // an explicit type - val = la - i ++ - } else if ( la === "null" && ~argType.indexOf(null) ) { - // null allowed - val = null - i ++ - } else if ( !la.match(/^-{2,}[^-]/) && - !isNaN(la) && - ~argType.indexOf(Number) ) { - // number - val = +la - i ++ - } else if ( !la.match(/^-[^-]/) && ~argType.indexOf(String) ) { - // string - val = la - i ++ - } - } - - if (isArray) (data[arg] = data[arg] || []).push(val) - else data[arg] = val - - continue - } - - if (argType === String) { - if (la === undefined) { - la = "" - } else if (la.match(/^-{1,2}[^-]+/)) { - la = "" - i -- - } - } - - if (la && la.match(/^-{2,}$/)) { - la = undefined - i -- - } - - val = la === undefined ? true : la - if (isArray) (data[arg] = data[arg] || []).push(val) - else data[arg] = val - - i ++ - continue - } - remain.push(arg) - } -} - -function resolveShort (arg, shorthands, shortAbbr, abbrevs) { - // handle single-char shorthands glommed together, like - // npm ls -glp, but only if there is one dash, and only if - // all of the chars are single-char shorthands, and it's - // not a match to some other abbrev. - arg = arg.replace(/^-+/, '') - - // if it's an exact known option, then don't go any further - if (abbrevs[arg] === arg) - return null - - // if it's an exact known shortopt, same deal - if (shorthands[arg]) { - // make it an array, if it's a list of words - if (shorthands[arg] && !Array.isArray(shorthands[arg])) - shorthands[arg] = shorthands[arg].split(/\s+/) - - return shorthands[arg] - } - - // first check to see if this arg is a set of single-char shorthands - var singles = shorthands.___singles - if (!singles) { - singles = Object.keys(shorthands).filter(function (s) { - return s.length === 1 - }).reduce(function (l,r) { - l[r] = true - return l - }, {}) - shorthands.___singles = singles - debug('shorthand singles', singles) - } - - var chrs = arg.split("").filter(function (c) { - return singles[c] - }) - - if (chrs.join("") === arg) return chrs.map(function (c) { - return shorthands[c] - }).reduce(function (l, r) { - return l.concat(r) - }, []) - - - // if it's an arg abbrev, and not a literal shorthand, then prefer the arg - if (abbrevs[arg] && !shorthands[arg]) - return null - - // if it's an abbr for a shorthand, then use that - if (shortAbbr[arg]) - arg = shortAbbr[arg] - - // make it an array, if it's a list of words - if (shorthands[arg] && !Array.isArray(shorthands[arg])) - shorthands[arg] = shorthands[arg].split(/\s+/) - - return shorthands[arg] -} diff --git a/node_modules/nopt/package.json b/node_modules/nopt/package.json deleted file mode 100644 index 06cc34b..0000000 --- a/node_modules/nopt/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_from": "nopt@^4.0.1", - "_id": "nopt@4.0.3", - "_inBundle": false, - "_integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", - "_location": "/nopt", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "nopt@^4.0.1", - "name": "nopt", - "escapedName": "nopt", - "rawSpec": "^4.0.1", - "saveSpec": null, - "fetchSpec": "^4.0.1" - }, - "_requiredBy": [ - "/node-pre-gyp" - ], - "_resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", - "_shasum": "a375cad9d02fd921278d954c2254d5aa57e15e48", - "_spec": "nopt@^4.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/node-pre-gyp", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "bugs": { - "url": "https://github.com/npm/nopt/issues" - }, - "bundleDependencies": false, - "dependencies": { - "abbrev": "1", - "osenv": "^0.1.4" - }, - "deprecated": false, - "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", - "devDependencies": { - "tap": "^14.10.6" - }, - "files": [ - "bin", - "lib" - ], - "homepage": "https://github.com/npm/nopt#readme", - "license": "ISC", - "main": "lib/nopt.js", - "name": "nopt", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/nopt.git" - }, - "scripts": { - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "preversion": "npm test", - "test": "tap test/*.js" - }, - "version": "4.0.3" -} diff --git a/node_modules/npm-bundled/LICENSE b/node_modules/npm-bundled/LICENSE deleted file mode 100644 index 20a4762..0000000 --- a/node_modules/npm-bundled/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) npm, Inc. and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/npm-bundled/README.md b/node_modules/npm-bundled/README.md deleted file mode 100644 index fcfb232..0000000 --- a/node_modules/npm-bundled/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# npm-bundled - -Run this in a node package, and it'll tell you which things in -node_modules are bundledDependencies, or transitive dependencies of -bundled dependencies. - -[![Build Status](https://travis-ci.org/npm/npm-bundled.svg?branch=master)](https://travis-ci.org/npm/npm-bundled) - -## USAGE - -To get the list of deps at the top level that are bundled (or -transitive deps of a bundled dep) run this: - -```js -const bundled = require('npm-bundled') - -// async version -bundled({ path: '/path/to/pkg/defaults/to/cwd'}, (er, list) => { - // er means it had an error, which is _hella_ weird - // list is a list of package names, like `fooblz` or `@corp/blerg` - // the might not all be deps of the top level, because transitives -}) - -// async promise version -bundled({ path: '/path/to/pkg/defaults/to/cwd'}).then(list => { - // so promisey! - // actually the callback version returns a promise, too, it just - // attaches the supplied callback to the promise -}) - -// sync version, throws if there's an error -const list = bundled({ path: '/path/to/pkg/defaults/to/cwd'}) -``` - -That's basically all you need to know. If you care to dig into it, -you can also use the `bundled.Walker` and `bundled.WalkerSync` -classes to get fancy. - -This library does not write anything to the filesystem, but it _may_ -have undefined behavior if the structure of `node_modules` changes -while it's reading deps. - -All symlinks are followed. This means that it can lead to surprising -results if a symlinked bundled dependency has a missing dependency -that is satisfied at the top level. Since package creation resolves -symlinks as well, this is an edge case where package creation and -development environment are not going to be aligned, and is best -avoided. diff --git a/node_modules/npm-bundled/index.js b/node_modules/npm-bundled/index.js deleted file mode 100644 index 197a1bc..0000000 --- a/node_modules/npm-bundled/index.js +++ /dev/null @@ -1,249 +0,0 @@ -'use strict' - -// walk the tree of deps starting from the top level list of bundled deps -// Any deps at the top level that are depended on by a bundled dep that -// does not have that dep in its own node_modules folder are considered -// bundled deps as well. This list of names can be passed to npm-packlist -// as the "bundled" argument. Additionally, packageJsonCache is shared so -// packlist doesn't have to re-read files already consumed in this pass - -const fs = require('fs') -const path = require('path') -const EE = require('events').EventEmitter -// we don't care about the package bins, but we share a pj cache -// with other modules that DO care about it, so keep it nice. -const normalizePackageBin = require('npm-normalize-package-bin') - -class BundleWalker extends EE { - constructor (opt) { - opt = opt || {} - super(opt) - this.path = path.resolve(opt.path || process.cwd()) - - this.parent = opt.parent || null - if (this.parent) { - this.result = this.parent.result - // only collect results in node_modules folders at the top level - // since the node_modules in a bundled dep is included always - if (!this.parent.parent) { - const base = path.basename(this.path) - const scope = path.basename(path.dirname(this.path)) - this.result.add(/^@/.test(scope) ? scope + '/' + base : base) - } - this.root = this.parent.root - this.packageJsonCache = this.parent.packageJsonCache - } else { - this.result = new Set() - this.root = this.path - this.packageJsonCache = opt.packageJsonCache || new Map() - } - - this.seen = new Set() - this.didDone = false - this.children = 0 - this.node_modules = [] - this.package = null - this.bundle = null - } - - addListener (ev, fn) { - return this.on(ev, fn) - } - - on (ev, fn) { - const ret = super.on(ev, fn) - if (ev === 'done' && this.didDone) { - this.emit('done', this.result) - } - return ret - } - - done () { - if (!this.didDone) { - this.didDone = true - if (!this.parent) { - const res = Array.from(this.result) - this.result = res - this.emit('done', res) - } else { - this.emit('done') - } - } - } - - start () { - const pj = path.resolve(this.path, 'package.json') - if (this.packageJsonCache.has(pj)) - this.onPackage(this.packageJsonCache.get(pj)) - else - this.readPackageJson(pj) - return this - } - - readPackageJson (pj) { - fs.readFile(pj, (er, data) => - er ? this.done() : this.onPackageJson(pj, data)) - } - - onPackageJson (pj, data) { - try { - this.package = normalizePackageBin(JSON.parse(data + '')) - } catch (er) { - return this.done() - } - this.packageJsonCache.set(pj, this.package) - this.onPackage(this.package) - } - - allDepsBundled (pkg) { - return Object.keys(pkg.dependencies || {}).concat( - Object.keys(pkg.optionalDependencies || {})) - } - - onPackage (pkg) { - // all deps are bundled if we got here as a child. - // otherwise, only bundle bundledDeps - // Get a unique-ified array with a short-lived Set - const bdRaw = this.parent ? this.allDepsBundled(pkg) - : pkg.bundleDependencies || pkg.bundledDependencies || [] - - const bd = Array.from(new Set( - Array.isArray(bdRaw) ? bdRaw - : bdRaw === true ? this.allDepsBundled(pkg) - : Object.keys(bdRaw))) - - if (!bd.length) - return this.done() - - this.bundle = bd - const nm = this.path + '/node_modules' - this.readModules() - } - - readModules () { - readdirNodeModules(this.path + '/node_modules', (er, nm) => - er ? this.onReaddir([]) : this.onReaddir(nm)) - } - - onReaddir (nm) { - // keep track of what we have, in case children need it - this.node_modules = nm - - this.bundle.forEach(dep => this.childDep(dep)) - if (this.children === 0) - this.done() - } - - childDep (dep) { - if (this.node_modules.indexOf(dep) !== -1 && !this.seen.has(dep)) { - this.seen.add(dep) - this.child(dep) - } else if (this.parent) { - this.parent.childDep(dep) - } - } - - child (dep) { - const p = this.path + '/node_modules/' + dep - this.children += 1 - const child = new BundleWalker({ - path: p, - parent: this - }) - child.on('done', _ => { - if (--this.children === 0) - this.done() - }) - child.start() - } -} - -class BundleWalkerSync extends BundleWalker { - constructor (opt) { - super(opt) - } - - start () { - super.start() - this.done() - return this - } - - readPackageJson (pj) { - try { - this.onPackageJson(pj, fs.readFileSync(pj)) - } catch (er) {} - return this - } - - readModules () { - try { - this.onReaddir(readdirNodeModulesSync(this.path + '/node_modules')) - } catch (er) { - this.onReaddir([]) - } - } - - child (dep) { - new BundleWalkerSync({ - path: this.path + '/node_modules/' + dep, - parent: this - }).start() - } -} - -const readdirNodeModules = (nm, cb) => { - fs.readdir(nm, (er, set) => { - if (er) - cb(er) - else { - const scopes = set.filter(f => /^@/.test(f)) - if (!scopes.length) - cb(null, set) - else { - const unscoped = set.filter(f => !/^@/.test(f)) - let count = scopes.length - scopes.forEach(scope => { - fs.readdir(nm + '/' + scope, (er, pkgs) => { - if (er || !pkgs.length) - unscoped.push(scope) - else - unscoped.push.apply(unscoped, pkgs.map(p => scope + '/' + p)) - if (--count === 0) - cb(null, unscoped) - }) - }) - } - } - }) -} - -const readdirNodeModulesSync = nm => { - const set = fs.readdirSync(nm) - const unscoped = set.filter(f => !/^@/.test(f)) - const scopes = set.filter(f => /^@/.test(f)).map(scope => { - try { - const pkgs = fs.readdirSync(nm + '/' + scope) - return pkgs.length ? pkgs.map(p => scope + '/' + p) : [scope] - } catch (er) { - return [scope] - } - }).reduce((a, b) => a.concat(b), []) - return unscoped.concat(scopes) -} - -const walk = (options, callback) => { - const p = new Promise((resolve, reject) => { - new BundleWalker(options).on('done', resolve).on('error', reject).start() - }) - return callback ? p.then(res => callback(null, res), callback) : p -} - -const walkSync = options => { - return new BundleWalkerSync(options).start().result -} - -module.exports = walk -walk.sync = walkSync -walk.BundleWalker = BundleWalker -walk.BundleWalkerSync = BundleWalkerSync diff --git a/node_modules/npm-bundled/package.json b/node_modules/npm-bundled/package.json deleted file mode 100644 index e99d82f..0000000 --- a/node_modules/npm-bundled/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "_from": "npm-bundled@^1.0.1", - "_id": "npm-bundled@1.1.1", - "_inBundle": false, - "_integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", - "_location": "/npm-bundled", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "npm-bundled@^1.0.1", - "name": "npm-bundled", - "escapedName": "npm-bundled", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "/npm-packlist" - ], - "_resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", - "_shasum": "1edd570865a94cdb1bc8220775e29466c9fb234b", - "_spec": "npm-bundled@^1.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/npm-packlist", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/npm/npm-bundled/issues" - }, - "bundleDependencies": false, - "dependencies": { - "npm-normalize-package-bin": "^1.0.1" - }, - "deprecated": false, - "description": "list things in node_modules that are bundledDependencies, or transitive dependencies thereof", - "devDependencies": { - "mkdirp": "^0.5.1", - "mutate-fs": "^1.1.0", - "rimraf": "^2.6.1", - "tap": "^12.0.1" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/npm/npm-bundled#readme", - "license": "ISC", - "main": "index.js", - "name": "npm-bundled", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/npm-bundled.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js -J --100" - }, - "version": "1.1.1" -} diff --git a/node_modules/npm-normalize-package-bin/.github/settings.yml b/node_modules/npm-normalize-package-bin/.github/settings.yml deleted file mode 100644 index 4aaa0dd..0000000 --- a/node_modules/npm-normalize-package-bin/.github/settings.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -_extends: 'open-source-project-boilerplate' diff --git a/node_modules/npm-normalize-package-bin/.npmignore b/node_modules/npm-normalize-package-bin/.npmignore deleted file mode 100644 index 3870bd5..0000000 --- a/node_modules/npm-normalize-package-bin/.npmignore +++ /dev/null @@ -1,24 +0,0 @@ -# ignore most things, include some others -/* -/.* - -!bin/ -!lib/ -!docs/ -!package.json -!package-lock.json -!README.md -!CONTRIBUTING.md -!LICENSE -!CHANGELOG.md -!example/ -!scripts/ -!tap-snapshots/ -!test/ -!.github/ -!.travis.yml -!.gitignore -!.gitattributes -!coverage-map.js -!map.js -!index.js diff --git a/node_modules/npm-normalize-package-bin/LICENSE b/node_modules/npm-normalize-package-bin/LICENSE deleted file mode 100644 index 19cec97..0000000 --- a/node_modules/npm-normalize-package-bin/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) npm, Inc. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/npm-normalize-package-bin/README.md b/node_modules/npm-normalize-package-bin/README.md deleted file mode 100644 index 65ba316..0000000 --- a/node_modules/npm-normalize-package-bin/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# npm-normalize-package-bin - -Turn any flavor of allowable package.json bin into a normalized object. - -## API - -```js -const normalize = require('npm-normalize-package-bin') -const pkg = {name: 'foo', bin: 'bar'} -console.log(normalize(pkg)) // {name:'foo', bin:{foo: 'bar'}} -``` - -Also strips out weird dots and slashes to prevent accidental and/or -malicious bad behavior when the package is installed. diff --git a/node_modules/npm-normalize-package-bin/index.js b/node_modules/npm-normalize-package-bin/index.js deleted file mode 100644 index 5a738ff..0000000 --- a/node_modules/npm-normalize-package-bin/index.js +++ /dev/null @@ -1,60 +0,0 @@ -// pass in a manifest with a 'bin' field here, and it'll turn it -// into a properly santized bin object -const {join, basename} = require('path') - -const normalize = pkg => - !pkg.bin ? removeBin(pkg) - : typeof pkg.bin === 'string' ? normalizeString(pkg) - : Array.isArray(pkg.bin) ? normalizeArray(pkg) - : typeof pkg.bin === 'object' ? normalizeObject(pkg) - : removeBin(pkg) - -const normalizeString = pkg => { - if (!pkg.name) - return removeBin(pkg) - pkg.bin = { [pkg.name]: pkg.bin } - return normalizeObject(pkg) -} - -const normalizeArray = pkg => { - pkg.bin = pkg.bin.reduce((acc, k) => { - acc[basename(k)] = k - return acc - }, {}) - return normalizeObject(pkg) -} - -const removeBin = pkg => { - delete pkg.bin - return pkg -} - -const normalizeObject = pkg => { - const orig = pkg.bin - const clean = {} - let hasBins = false - Object.keys(orig).forEach(binKey => { - const base = join('/', basename(binKey.replace(/\\|:/g, '/'))).substr(1) - - if (typeof orig[binKey] !== 'string' || !base) - return - - const binTarget = join('/', orig[binKey]) - .replace(/\\/g, '/').substr(1) - - if (!binTarget) - return - - clean[base] = binTarget - hasBins = true - }) - - if (hasBins) - pkg.bin = clean - else - delete pkg.bin - - return pkg -} - -module.exports = normalize diff --git a/node_modules/npm-normalize-package-bin/package-lock.json b/node_modules/npm-normalize-package-bin/package-lock.json deleted file mode 100644 index 0d3390d..0000000 --- a/node_modules/npm-normalize-package-bin/package-lock.json +++ /dev/null @@ -1,3529 +0,0 @@ -{ - "name": "npm-normalize-package-bin", - "version": "1.0.1", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@babel/code-frame": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", - "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", - "dev": true, - "requires": { - "@babel/highlight": "^7.0.0" - } - }, - "@babel/generator": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.4.tgz", - "integrity": "sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg==", - "dev": true, - "requires": { - "@babel/types": "^7.7.4", - "jsesc": "^2.5.1", - "lodash": "^4.17.13", - "source-map": "^0.5.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "@babel/helper-function-name": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", - "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.7.4", - "@babel/template": "^7.7.4", - "@babel/types": "^7.7.4" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", - "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", - "dev": true, - "requires": { - "@babel/types": "^7.7.4" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", - "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", - "dev": true, - "requires": { - "@babel/types": "^7.7.4" - } - }, - "@babel/highlight": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", - "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", - "dev": true, - "requires": { - "chalk": "^2.0.0", - "esutils": "^2.0.2", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.7.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.5.tgz", - "integrity": "sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig==", - "dev": true - }, - "@babel/runtime": { - "version": "7.7.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.7.6.tgz", - "integrity": "sha512-BWAJxpNVa0QlE5gZdWjSxXtemZyZ9RmrmVozxt3NUXeZhVIJ5ANyqmMc0JDrivBZyxUuQvFxlvH4OWWOogGfUw==", - "dev": true, - "requires": { - "regenerator-runtime": "^0.13.2" - } - }, - "@babel/template": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", - "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.7.4", - "@babel/types": "^7.7.4" - } - }, - "@babel/traverse": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.4.tgz", - "integrity": "sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.7.4", - "@babel/helper-function-name": "^7.7.4", - "@babel/helper-split-export-declaration": "^7.7.4", - "@babel/parser": "^7.7.4", - "@babel/types": "^7.7.4", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.13" - } - }, - "@babel/types": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", - "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.13", - "to-fast-properties": "^2.0.0" - } - }, - "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "append-transform": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-1.0.0.tgz", - "integrity": "sha512-P009oYkeHyU742iSZJzZZywj4QRJdnTWffaKuJQLablCZ1uz6/cW4yaRgcDaoQ+uwOxxnt0gRUcwfsNP2ri0gw==", - "dev": true, - "requires": { - "default-require-extensions": "^2.0.0" - } - }, - "archy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", - "dev": true - }, - "arg": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.2.tgz", - "integrity": "sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg==", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, - "async-hook-domain": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/async-hook-domain/-/async-hook-domain-1.1.3.tgz", - "integrity": "sha512-ZovMxSbADV3+biB7oR1GL5lGyptI24alp0LWHlmz1OFc5oL47pz3EiIF6nXOkDW7yLqih4NtsiYduzdDW0i+Wg==", - "dev": true, - "requires": { - "source-map-support": "^0.5.11" - } - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.0.tgz", - "integrity": "sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dev": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "binary-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", - "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", - "dev": true - }, - "bind-obj-methods": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/bind-obj-methods/-/bind-obj-methods-2.0.0.tgz", - "integrity": "sha512-3/qRXczDi2Cdbz6jE+W3IflJOutRVica8frpBn14de1mBOkzDo+6tY33kNhvkw54Kn3PzRRD2VnGbGPcTAk4sw==", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, - "caching-transform": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-3.0.2.tgz", - "integrity": "sha512-Mtgcv3lh3U0zRii/6qVgQODdPA4G3zhG+jtbCWj39RXuUFTMzH0vcdMtaJS1jPowd+It2Pqr6y3NJMQqOqCE2w==", - "dev": true, - "requires": { - "hasha": "^3.0.0", - "make-dir": "^2.0.0", - "package-hash": "^3.0.0", - "write-file-atomic": "^2.4.2" - }, - "dependencies": { - "write-file-atomic": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", - "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - } - } - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", - "dev": true, - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.1.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" - } - }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true, - "optional": true - }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "convert-source-map": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "coveralls": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.9.tgz", - "integrity": "sha512-nNBg3B1+4iDox5A5zqHKzUTiwl2ey4k2o0NEcVZYvl+GOSJdKBj4AJGKLv6h3SvWch7tABHePAQOSZWM9E2hMg==", - "dev": true, - "requires": { - "js-yaml": "^3.13.1", - "lcov-parse": "^1.0.0", - "log-driver": "^1.2.7", - "minimist": "^1.2.0", - "request": "^2.88.0" - } - }, - "cp-file": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-6.2.0.tgz", - "integrity": "sha512-fmvV4caBnofhPe8kOcitBwSn2f39QLjnAnGq3gO9dfd75mUytzKNZB1hde6QHunW2Rt+OwuBOMc3i1tNElbszA==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "make-dir": "^2.0.0", - "nested-error-stacks": "^2.0.0", - "pify": "^4.0.1", - "safe-buffer": "^5.0.1" - } - }, - "cross-spawn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", - "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "default-require-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-2.0.0.tgz", - "integrity": "sha1-9fj7sYp9bVCyH2QfZJ67Uiz+JPc=", - "dev": true, - "requires": { - "strip-bom": "^3.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "diff": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", - "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", - "dev": true - }, - "diff-frag": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/diff-frag/-/diff-frag-1.0.1.tgz", - "integrity": "sha512-6/v2PC/6UTGcWPPetb9acL8foberUg/CtPdALeJUdD1B/weHNvzftoo00gYznqHGRhHEbykUGzqfG9RWOSr5yw==", - "dev": true - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dev": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es6-error": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", - "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "esm": { - "version": "3.2.25", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", - "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", - "dev": true - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "events-to-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/events-to-array/-/events-to-array-1.1.2.tgz", - "integrity": "sha1-LUH1Y+H+QA7Uli/hpNXGp1Od9/Y=", - "dev": true - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-cache-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", - "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" - } - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "findit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/findit/-/findit-2.0.0.tgz", - "integrity": "sha1-ZQnwEmr0wXhVHPqZOU4DLhOk1W4=", - "dev": true - }, - "flow-parser": { - "version": "0.113.0", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.113.0.tgz", - "integrity": "sha512-+hRyEB1sVLNMTMniDdM1JIS8BJ3HUL7IFIJaxX+t/JUy0GNYdI0Tg1QLx8DJmOF8HeoCrUDcREpnDAc/pPta3w==", - "dev": true - }, - "flow-remove-types": { - "version": "2.113.0", - "resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-2.113.0.tgz", - "integrity": "sha512-Rp4hN/JlGmUjNxXuBXr6Or+MgDH9xKc+ZiUSRzl/fbpiH9RaCPAQKsgVEYNPcIE26q6RpAuMQfvzR0jQfuwUZQ==", - "dev": true, - "requires": { - "flow-parser": "^0.113.0", - "pirates": "^3.0.2", - "vlq": "^0.2.1" - } - }, - "foreground-child": { - "version": "1.5.6", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", - "integrity": "sha1-T9ca0t/elnibmApcCilZN8svXOk=", - "dev": true, - "requires": { - "cross-spawn": "^4", - "signal-exit": "^3.0.0" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "fs-exists-cached": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-exists-cached/-/fs-exists-cached-1.0.0.tgz", - "integrity": "sha1-zyVVTKBQ3EmuZla0HeQiWJidy84=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "dev": true, - "optional": true - }, - "function-loop": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/function-loop/-/function-loop-1.0.2.tgz", - "integrity": "sha512-Iw4MzMfS3udk/rqxTiDDCllhGwlOrsr50zViTOO/W6lS/9y6B1J0BD2VZzrnWUYBJsl3aeqjgR5v7bWWhZSYbA==", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", - "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "handlebars": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz", - "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==", - "dev": true, - "requires": { - "neo-async": "^2.6.0", - "optimist": "^0.6.1", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", - "dev": true, - "requires": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "hasha": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-3.0.0.tgz", - "integrity": "sha1-UqMvq4Vp1BymmmH/GiFPjrfIvTk=", - "dev": true, - "requires": { - "is-stream": "^1.0.1" - } - }, - "hosted-git-info": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", - "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==", - "dev": true - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true, - "optional": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, - "istanbul-lib-coverage": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", - "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", - "dev": true - }, - "istanbul-lib-hook": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-2.0.7.tgz", - "integrity": "sha512-vrRztU9VRRFDyC+aklfLoeXyNdTfga2EI3udDGn4cZ6fpSXpHLV9X6CHvfoMCPtggg8zvDDmC4b9xfu0z6/llA==", - "dev": true, - "requires": { - "append-transform": "^1.0.0" - } - }, - "istanbul-lib-instrument": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", - "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", - "dev": true, - "requires": { - "@babel/generator": "^7.4.0", - "@babel/parser": "^7.4.3", - "@babel/template": "^7.4.0", - "@babel/traverse": "^7.4.3", - "@babel/types": "^7.4.0", - "istanbul-lib-coverage": "^2.0.5", - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "istanbul-lib-processinfo": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-1.0.0.tgz", - "integrity": "sha512-FY0cPmWa4WoQNlvB8VOcafiRoB5nB+l2Pz2xGuXHRSy1KM8QFOYfz/rN+bGMCAeejrY3mrpF5oJHcN0s/garCg==", - "dev": true, - "requires": { - "archy": "^1.0.0", - "cross-spawn": "^6.0.5", - "istanbul-lib-coverage": "^2.0.3", - "rimraf": "^2.6.3", - "uuid": "^3.3.2" - }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "istanbul-lib-report": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", - "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "supports-color": "^6.1.0" - }, - "dependencies": { - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", - "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "rimraf": "^2.6.3", - "source-map": "^0.6.1" - } - }, - "istanbul-reports": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.6.tgz", - "integrity": "sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA==", - "dev": true, - "requires": { - "handlebars": "^4.1.2" - } - }, - "jackspeak": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-1.4.0.tgz", - "integrity": "sha512-VDcSunT+wcccoG46FtzuBAyQKlzhHjli4q31e1fIHGOsRspqNUFjVzGb+7eIFDlTvqLygxapDHPHS0ouT2o/tw==", - "dev": true, - "requires": { - "cliui": "^4.1.0" - } - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "lcov-parse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-1.0.0.tgz", - "integrity": "sha1-6w1GtUER68VhrLTECO+TY73I9+A=", - "dev": true - }, - "load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - }, - "lodash.flattendeep": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", - "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", - "dev": true - }, - "log-driver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", - "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", - "dev": true - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - } - }, - "make-error": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", - "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", - "dev": true - }, - "merge-source-map": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz", - "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", - "dev": true, - "requires": { - "source-map": "^0.6.1" - } - }, - "mime-db": { - "version": "1.42.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz", - "integrity": "sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==", - "dev": true - }, - "mime-types": { - "version": "2.1.25", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.25.tgz", - "integrity": "sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg==", - "dev": true, - "requires": { - "mime-db": "1.42.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "minipass": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.1.tgz", - "integrity": "sha512-UFqVihv6PQgwj8/yTGvl9kPz7xIAY+R5z6XYjRInD3Gk3qx6QGSD6zEcpeG4Dy/lQnv1J6zv8ejV90hyYIKf3w==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - }, - "dependencies": { - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "neo-async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", - "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", - "dev": true - }, - "nested-error-stacks": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz", - "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==", - "dev": true - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "node-modules-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", - "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", - "dev": true - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "nyc": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-14.1.1.tgz", - "integrity": "sha512-OI0vm6ZGUnoGZv/tLdZ2esSVzDwUC88SNs+6JoSOMVxA+gKMB8Tk7jBwgemLx4O40lhhvZCVw1C+OYLOBOPXWw==", - "dev": true, - "requires": { - "archy": "^1.0.0", - "caching-transform": "^3.0.2", - "convert-source-map": "^1.6.0", - "cp-file": "^6.2.0", - "find-cache-dir": "^2.1.0", - "find-up": "^3.0.0", - "foreground-child": "^1.5.6", - "glob": "^7.1.3", - "istanbul-lib-coverage": "^2.0.5", - "istanbul-lib-hook": "^2.0.7", - "istanbul-lib-instrument": "^3.3.0", - "istanbul-lib-report": "^2.0.8", - "istanbul-lib-source-maps": "^3.0.6", - "istanbul-reports": "^2.2.4", - "js-yaml": "^3.13.1", - "make-dir": "^2.1.0", - "merge-source-map": "^1.1.0", - "resolve-from": "^4.0.0", - "rimraf": "^2.6.3", - "signal-exit": "^3.0.2", - "spawn-wrap": "^1.4.2", - "test-exclude": "^5.2.3", - "uuid": "^3.3.2", - "yargs": "^13.2.2", - "yargs-parser": "^13.0.0" - } - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "opener": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.1.tgz", - "integrity": "sha512-goYSy5c2UXE4Ra1xixabeVh1guIX/ZV/YokJksb6q2lubWu6UbvPQ20p542/sFIll1nl8JnCyK9oBaOcCWXwvA==", - "dev": true - }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - }, - "dependencies": { - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", - "dev": true - } - } - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "own-or": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/own-or/-/own-or-1.0.0.tgz", - "integrity": "sha1-Tod/vtqaLsgAD7wLyuOWRe6L+Nw=", - "dev": true - }, - "own-or-env": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/own-or-env/-/own-or-env-1.0.1.tgz", - "integrity": "sha512-y8qULRbRAlL6x2+M0vIe7jJbJx/kmUTzYonRAa2ayesR2qWLswninkVyeJe4x3IEXhdgoNodzjQRKAoEs6Fmrw==", - "dev": true, - "requires": { - "own-or": "^1.0.0" - } - }, - "p-limit": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", - "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "package-hash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-3.0.0.tgz", - "integrity": "sha512-lOtmukMDVvtkL84rJHI7dpTYq+0rli8N2wlnqUcBuDWCfVhRUfOmnR9SsoHFMLpACvEV60dX7rd0rFaYDZI+FA==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.15", - "hasha": "^3.0.0", - "lodash.flattendeep": "^4.4.0", - "release-zalgo": "^1.0.0" - } - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "requires": { - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } - } - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, - "picomatch": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.1.tgz", - "integrity": "sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA==", - "dev": true - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - }, - "pirates": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-3.0.2.tgz", - "integrity": "sha512-c5CgUJq6H2k6MJz72Ak1F5sN9n9wlSlJyEnwvpm9/y3WB4E3pHBDT2c6PEiS1vyJvq2bUxUAIu0EGf8Cx4Ic7Q==", - "dev": true, - "requires": { - "node-modules-regexp": "^1.0.0" - } - }, - "pkg-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", - "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", - "dev": true, - "requires": { - "find-up": "^3.0.0" - } - }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true, - "optional": true - }, - "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "dev": true, - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "psl": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.6.0.tgz", - "integrity": "sha512-SYKKmVel98NCOYXpkwUqZqh0ahZeeKfmisiLIcEZdsb+WbLv02g/dI5BUmZnIyOe7RzZtLax81nnb2HbvC2tzA==", - "dev": true - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true - }, - "react": { - "version": "16.12.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.12.0.tgz", - "integrity": "sha512-fglqy3k5E+81pA8s+7K0/T3DBCF0ZDOher1elBFzF7O6arXJgzyu/FW+COxFvAWXJoJN9KIZbT2LXlukwphYTA==", - "dev": true, - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2" - } - }, - "react-is": { - "version": "16.12.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.12.0.tgz", - "integrity": "sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==", - "dev": true - }, - "read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", - "dev": true, - "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - } - }, - "read-pkg-up": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", - "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", - "dev": true, - "requires": { - "find-up": "^3.0.0", - "read-pkg": "^3.0.0" - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true - } - } - }, - "readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", - "dev": true, - "requires": { - "picomatch": "^2.0.4" - } - }, - "regenerator-runtime": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", - "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==", - "dev": true - }, - "release-zalgo": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", - "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", - "dev": true, - "requires": { - "es6-error": "^4.0.1" - } - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "resolve": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.13.1.tgz", - "integrity": "sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "source-map-support": { - "version": "0.5.16", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", - "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "spawn-wrap": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.4.3.tgz", - "integrity": "sha512-IgB8md0QW/+tWqcavuFgKYR/qIRvJkRLPJDFaoXtLLUaVcCDK0+HeFTkmQHj3eprcYhc+gOl0aEA1w7qZlYezw==", - "dev": true, - "requires": { - "foreground-child": "^1.5.6", - "mkdirp": "^0.5.0", - "os-homedir": "^1.0.1", - "rimraf": "^2.6.2", - "signal-exit": "^3.0.2", - "which": "^1.3.0" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "spdx-correct": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", - "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", - "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", - "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "stack-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", - "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true - } - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "tap": { - "version": "14.10.2", - "resolved": "https://registry.npmjs.org/tap/-/tap-14.10.2.tgz", - "integrity": "sha512-JeUDsVrMFmR6b3p9hO9yIT/jibrK6LI7nFza5cqDGsxJyCp7yU3enRgS5nekuoAOzewbrU7P+9QDRDT01urROA==", - "dev": true, - "requires": { - "async-hook-domain": "^1.1.3", - "bind-obj-methods": "^2.0.0", - "browser-process-hrtime": "^1.0.0", - "chokidar": "^3.3.0", - "color-support": "^1.1.0", - "coveralls": "^3.0.8", - "diff": "^4.0.1", - "esm": "^3.2.25", - "findit": "^2.0.0", - "flow-remove-types": "^2.112.0", - "foreground-child": "^1.3.3", - "fs-exists-cached": "^1.0.0", - "function-loop": "^1.0.2", - "glob": "^7.1.6", - "import-jsx": "^3.0.0", - "ink": "^2.5.0", - "isexe": "^2.0.0", - "istanbul-lib-processinfo": "^1.0.0", - "jackspeak": "^1.4.0", - "minipass": "^3.1.1", - "mkdirp": "^0.5.1", - "nyc": "^14.1.1", - "opener": "^1.5.1", - "own-or": "^1.0.0", - "own-or-env": "^1.0.1", - "react": "^16.12.0", - "rimraf": "^2.7.1", - "signal-exit": "^3.0.0", - "source-map-support": "^0.5.16", - "stack-utils": "^1.0.2", - "tap-mocha-reporter": "^5.0.0", - "tap-parser": "^10.0.1", - "tap-yaml": "^1.0.0", - "tcompare": "^3.0.0", - "treport": "^1.0.0", - "trivial-deferred": "^1.0.1", - "ts-node": "^8.5.2", - "typescript": "^3.7.2", - "which": "^2.0.2", - "write-file-atomic": "^3.0.1", - "yaml": "^1.7.2", - "yapool": "^1.0.0" - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.5.5", - "bundled": true, - "requires": { - "@babel/highlight": "^7.0.0" - } - }, - "@babel/core": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.7.4", - "@babel/helpers": "^7.7.4", - "@babel/parser": "^7.7.4", - "@babel/template": "^7.7.4", - "@babel/traverse": "^7.7.4", - "@babel/types": "^7.7.4", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "json5": "^2.1.0", - "lodash": "^4.17.13", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "@babel/generator": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/types": "^7.7.4", - "jsesc": "^2.5.1", - "lodash": "^4.17.13", - "source-map": "^0.5.0" - } - }, - "@babel/helper-function-name": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.7.4", - "@babel/template": "^7.7.4", - "@babel/types": "^7.7.4" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/types": "^7.7.4" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/types": "^7.7.4" - } - }, - "@babel/parser": { - "version": "7.7.4", - "bundled": true, - "dev": true - }, - "@babel/template": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.7.4", - "@babel/types": "^7.7.4" - } - }, - "@babel/traverse": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.7.4", - "@babel/helper-function-name": "^7.7.4", - "@babel/helper-split-export-declaration": "^7.7.4", - "@babel/parser": "^7.7.4", - "@babel/types": "^7.7.4", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.13" - } - }, - "@babel/types": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.13", - "to-fast-properties": "^2.0.0" - } - }, - "convert-source-map": { - "version": "1.7.0", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "debug": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "bundled": true, - "dev": true - }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true, - "dev": true - }, - "source-map": { - "version": "0.5.7", - "bundled": true, - "dev": true - } - } - }, - "@babel/generator": { - "version": "7.7.2", - "bundled": true, - "requires": { - "@babel/types": "^7.7.2", - "jsesc": "^2.5.1", - "lodash": "^4.17.13", - "source-map": "^0.5.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "bundled": true - } - } - }, - "@babel/helper-builder-react-jsx": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/types": "^7.7.4", - "esutils": "^2.0.0" - }, - "dependencies": { - "@babel/types": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.13", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-plugin-utils": { - "version": "7.0.0", - "bundled": true, - "dev": true - }, - "@babel/helpers": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/template": "^7.7.4", - "@babel/traverse": "^7.7.4", - "@babel/types": "^7.7.4" - }, - "dependencies": { - "@babel/generator": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/types": "^7.7.4", - "jsesc": "^2.5.1", - "lodash": "^4.17.13", - "source-map": "^0.5.0" - } - }, - "@babel/helper-function-name": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.7.4", - "@babel/template": "^7.7.4", - "@babel/types": "^7.7.4" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/types": "^7.7.4" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/types": "^7.7.4" - } - }, - "@babel/parser": { - "version": "7.7.4", - "bundled": true, - "dev": true - }, - "@babel/template": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.7.4", - "@babel/types": "^7.7.4" - } - }, - "@babel/traverse": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.7.4", - "@babel/helper-function-name": "^7.7.4", - "@babel/helper-split-export-declaration": "^7.7.4", - "@babel/parser": "^7.7.4", - "@babel/types": "^7.7.4", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.13" - } - }, - "@babel/types": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.13", - "to-fast-properties": "^2.0.0" - } - }, - "debug": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "bundled": true, - "dev": true - }, - "source-map": { - "version": "0.5.7", - "bundled": true, - "dev": true - } - } - }, - "@babel/highlight": { - "version": "7.5.0", - "bundled": true, - "requires": { - "chalk": "^2.0.0", - "esutils": "^2.0.2", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "js-tokens": { - "version": "4.0.0", - "bundled": true - } - } - }, - "@babel/parser": { - "version": "7.7.3", - "bundled": true - }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.7.4" - } - }, - "@babel/plugin-syntax-jsx": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0" - } - }, - "@babel/plugin-transform-destructuring": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0" - } - }, - "@babel/plugin-transform-react-jsx": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "@babel/helper-builder-react-jsx": "^7.7.4", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.7.4" - } - }, - "@babel/runtime": { - "version": "7.7.4", - "bundled": true, - "dev": true, - "requires": { - "regenerator-runtime": "^0.13.2" - } - }, - "@babel/template": { - "version": "7.7.0", - "bundled": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.7.0", - "@babel/types": "^7.7.0" - } - }, - "@babel/types": { - "version": "7.7.2", - "bundled": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.13", - "to-fast-properties": "^2.0.0" - } - }, - "@types/color-name": { - "version": "1.1.1", - "bundled": true, - "dev": true - }, - "@types/prop-types": { - "version": "15.7.3", - "bundled": true, - "dev": true - }, - "@types/react": { - "version": "16.9.13", - "bundled": true, - "dev": true, - "requires": { - "@types/prop-types": "*", - "csstype": "^2.2.0" - } - }, - "ansi-escapes": { - "version": "4.3.0", - "bundled": true, - "dev": true, - "requires": { - "type-fest": "^0.8.1" - } - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true - }, - "ansi-styles": { - "version": "3.2.1", - "bundled": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "ansicolors": { - "version": "0.3.2", - "bundled": true, - "dev": true - }, - "arrify": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "astral-regex": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "auto-bind": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "requires": { - "@types/react": "^16.8.12" - } - }, - "caller-callsite": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "callsites": "^2.0.0" - } - }, - "caller-path": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "caller-callsite": "^2.0.0" - } - }, - "callsites": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "cardinal": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "requires": { - "ansicolors": "~0.3.2", - "redeyed": "~2.1.0" - } - }, - "chalk": { - "version": "2.4.2", - "bundled": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "ci-info": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "cli-cursor": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "cli-truncate": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "slice-ansi": "^1.0.0", - "string-width": "^2.0.0" - } - }, - "color-convert": { - "version": "1.9.3", - "bundled": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "bundled": true - }, - "csstype": { - "version": "2.6.7", - "bundled": true, - "dev": true - }, - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "emoji-regex": { - "version": "7.0.3", - "bundled": true, - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "bundled": true - }, - "esprima": { - "version": "4.0.1", - "bundled": true, - "dev": true - }, - "esutils": { - "version": "2.0.3", - "bundled": true - }, - "events-to-array": { - "version": "1.1.2", - "bundled": true, - "dev": true - }, - "globals": { - "version": "11.12.0", - "bundled": true, - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "bundled": true - }, - "import-jsx": { - "version": "3.0.0", - "bundled": true, - "dev": true, - "requires": { - "@babel/core": "^7.5.5", - "@babel/plugin-proposal-object-rest-spread": "^7.5.5", - "@babel/plugin-transform-destructuring": "^7.5.0", - "@babel/plugin-transform-react-jsx": "^7.3.0", - "caller-path": "^2.0.0", - "resolve-from": "^3.0.0" - } - }, - "ink": { - "version": "2.5.0", - "bundled": true, - "dev": true, - "requires": { - "@types/react": "^16.8.6", - "ansi-escapes": "^4.2.1", - "arrify": "^1.0.1", - "auto-bind": "^2.0.0", - "chalk": "^2.4.1", - "cli-cursor": "^2.1.0", - "cli-truncate": "^1.1.0", - "is-ci": "^2.0.0", - "lodash.throttle": "^4.1.1", - "log-update": "^3.0.0", - "prop-types": "^15.6.2", - "react-reconciler": "^0.21.0", - "scheduler": "^0.15.0", - "signal-exit": "^3.0.2", - "slice-ansi": "^1.0.0", - "string-length": "^2.0.0", - "widest-line": "^2.0.0", - "wrap-ansi": "^5.0.0", - "yoga-layout-prebuilt": "^1.9.3" - } - }, - "is-ci": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "js-tokens": { - "version": "3.0.2", - "bundled": true, - "dev": true - }, - "jsesc": { - "version": "2.5.2", - "bundled": true - }, - "json5": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - }, - "lodash": { - "version": "4.17.15", - "bundled": true - }, - "lodash.throttle": { - "version": "4.1.1", - "bundled": true, - "dev": true - }, - "log-update": { - "version": "3.3.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-escapes": "^3.2.0", - "cli-cursor": "^2.1.0", - "wrap-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-escapes": { - "version": "3.2.0", - "bundled": true, - "dev": true - } - } - }, - "loose-envify": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "mimic-fn": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "minipass": { - "version": "3.1.1", - "bundled": true, - "dev": true, - "requires": { - "yallist": "^4.0.0" - }, - "dependencies": { - "yallist": { - "version": "4.0.0", - "bundled": true, - "dev": true - } - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true - }, - "onetime": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "path-parse": { - "version": "1.0.6", - "bundled": true, - "dev": true - }, - "prop-types": { - "version": "15.7.2", - "bundled": true, - "dev": true, - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } - }, - "punycode": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "react-is": { - "version": "16.10.2", - "bundled": true, - "dev": true - }, - "react-reconciler": { - "version": "0.21.0", - "bundled": true, - "dev": true, - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.15.0" - } - }, - "redeyed": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "requires": { - "esprima": "~4.0.0" - } - }, - "regenerator-runtime": { - "version": "0.13.3", - "bundled": true, - "dev": true - }, - "resolve": { - "version": "1.12.0", - "bundled": true, - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "resolve-from": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "restore-cursor": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "scheduler": { - "version": "0.15.0", - "bundled": true, - "dev": true, - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - }, - "semver": { - "version": "5.7.1", - "bundled": true, - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true - }, - "slice-ansi": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0" - } - }, - "source-map": { - "version": "0.6.1", - "bundled": true - }, - "string-length": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "astral-regex": "^1.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "string-width": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "5.5.0", - "bundled": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "tap-parser": { - "version": "10.0.1", - "bundled": true, - "dev": true, - "requires": { - "events-to-array": "^1.0.1", - "minipass": "^3.0.0", - "tap-yaml": "^1.0.0" - } - }, - "tap-yaml": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "yaml": "^1.5.0" - } - }, - "to-fast-properties": { - "version": "2.0.0", - "bundled": true - }, - "treport": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "cardinal": "^2.1.1", - "chalk": "^3.0.0", - "import-jsx": "^3.0.0", - "ink": "^2.5.0", - "ms": "^2.1.2", - "string-length": "^3.1.0", - "tap-parser": "^10.0.1", - "unicode-length": "^2.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "bundled": true, - "dev": true - }, - "ansi-styles": { - "version": "4.2.0", - "bundled": true, - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "bundled": true, - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "bundled": true, - "dev": true - }, - "ms": { - "version": "2.1.2", - "bundled": true, - "dev": true - }, - "string-length": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "astral-regex": "^1.0.0", - "strip-ansi": "^5.2.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "supports-color": { - "version": "7.1.0", - "bundled": true, - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "unicode-length": { - "version": "2.0.2", - "bundled": true, - "dev": true, - "requires": { - "punycode": "^2.0.0", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - } - } - }, - "type-fest": { - "version": "0.8.1", - "bundled": true, - "dev": true - }, - "widest-line": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "string-width": "^2.1.1" - } - }, - "wrap-ansi": { - "version": "5.1.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "bundled": true, - "dev": true - }, - "string-width": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "yaml": { - "version": "1.7.2", - "bundled": true, - "dev": true, - "requires": { - "@babel/runtime": "^7.6.3" - } - }, - "yoga-layout-prebuilt": { - "version": "1.9.3", - "bundled": true, - "dev": true - } - } - }, - "tap-mocha-reporter": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/tap-mocha-reporter/-/tap-mocha-reporter-5.0.0.tgz", - "integrity": "sha512-8HlAtdmYGlDZuW83QbF/dc46L7cN+AGhLZcanX3I9ILvxUAl+G2/mtucNPSXecTlG/4iP1hv6oMo0tMhkn3Tsw==", - "dev": true, - "requires": { - "color-support": "^1.1.0", - "debug": "^2.1.3", - "diff": "^1.3.2", - "escape-string-regexp": "^1.0.3", - "glob": "^7.0.5", - "readable-stream": "^2.1.5", - "tap-parser": "^10.0.0", - "tap-yaml": "^1.0.0", - "unicode-length": "^1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "diff": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-1.4.0.tgz", - "integrity": "sha1-fyjS657nsVqX79ic5j3P2qPMur8=", - "dev": true - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "tap-parser": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-10.0.1.tgz", - "integrity": "sha512-qdT15H0DoJIi7zOqVXDn9X0gSM68JjNy1w3VemwTJlDnETjbi6SutnqmBfjDJAwkFS79NJ97gZKqie00ZCGmzg==", - "dev": true, - "requires": { - "events-to-array": "^1.0.1", - "minipass": "^3.0.0", - "tap-yaml": "^1.0.0" - } - }, - "tap-yaml": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/tap-yaml/-/tap-yaml-1.0.0.tgz", - "integrity": "sha512-Rxbx4EnrWkYk0/ztcm5u3/VznbyFJpyXO12dDBHKWiDVxy7O2Qw6MRrwO5H6Ww0U5YhRY/4C/VzWmFPhBQc4qQ==", - "dev": true, - "requires": { - "yaml": "^1.5.0" - } - }, - "tcompare": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/tcompare/-/tcompare-3.0.4.tgz", - "integrity": "sha512-Q3TitMVK59NyKgQyFh+857wTAUE329IzLDehuPgU4nF5e8g+EUQ+yUbjUy1/6ugiNnXztphT+NnqlCXolv9P3A==", - "dev": true, - "requires": { - "diff-frag": "^1.0.1" - } - }, - "test-exclude": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", - "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", - "dev": true, - "requires": { - "glob": "^7.1.3", - "minimatch": "^3.0.4", - "read-pkg-up": "^4.0.0", - "require-main-filename": "^2.0.0" - } - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "dev": true, - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - } - } - }, - "trivial-deferred": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trivial-deferred/-/trivial-deferred-1.0.1.tgz", - "integrity": "sha1-N21NKdlR1jaKb3oK6FwvTV4GWPM=", - "dev": true - }, - "ts-node": { - "version": "8.5.4", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.5.4.tgz", - "integrity": "sha512-izbVCRV68EasEPQ8MSIGBNK9dc/4sYJJKYA+IarMQct1RtEot6Xp0bXuClsbUSnKpg50ho+aOAx8en5c+y4OFw==", - "dev": true, - "requires": { - "arg": "^4.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "source-map-support": "^0.5.6", - "yn": "^3.0.0" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true - }, - "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "requires": { - "is-typedarray": "^1.0.0" - } - }, - "typescript": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz", - "integrity": "sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==", - "dev": true - }, - "uglify-js": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.2.tgz", - "integrity": "sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA==", - "dev": true, - "optional": true, - "requires": { - "commander": "~2.20.3", - "source-map": "~0.6.1" - } - }, - "unicode-length": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/unicode-length/-/unicode-length-1.0.3.tgz", - "integrity": "sha1-Wtp6f+1RhBpBijKM8UlHisg1irs=", - "dev": true, - "requires": { - "punycode": "^1.3.2", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true, - "optional": true - }, - "uuid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", - "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "vlq": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", - "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==", - "dev": true - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "write-file-atomic": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.1.tgz", - "integrity": "sha512-JPStrIyyVJ6oCSz/691fAjFtefZ6q+fP6tm+OS4Qw6o+TGQxNp1ziY2PgS+X/m0V8OWhZiO/m4xSj+Pr4RrZvw==", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - }, - "yaml": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.7.2.tgz", - "integrity": "sha512-qXROVp90sb83XtAoqE8bP9RwAkTTZbugRUTm5YeFCBfNRPEp2YzTeqWiz7m5OORHzEvrA/qcGS8hp/E+MMROYw==", - "dev": true, - "requires": { - "@babel/runtime": "^7.6.3" - } - }, - "yapool": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yapool/-/yapool-1.0.0.tgz", - "integrity": "sha1-9pPymjFbUNmp2iZGp6ZkXJaYW2o=", - "dev": true - }, - "yargs": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", - "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.1" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - } - } - }, - "yargs-parser": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", - "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true - } - } -} diff --git a/node_modules/npm-normalize-package-bin/package.json b/node_modules/npm-normalize-package-bin/package.json deleted file mode 100644 index 0ff3b60..0000000 --- a/node_modules/npm-normalize-package-bin/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "_from": "npm-normalize-package-bin@^1.0.1", - "_id": "npm-normalize-package-bin@1.0.1", - "_inBundle": false, - "_integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", - "_location": "/npm-normalize-package-bin", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "npm-normalize-package-bin@^1.0.1", - "name": "npm-normalize-package-bin", - "escapedName": "npm-normalize-package-bin", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "/npm-bundled", - "/npm-packlist" - ], - "_resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", - "_shasum": "6e79a41f23fd235c0623218228da7d9c23b8f6e2", - "_spec": "npm-normalize-package-bin@^1.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/npm-packlist", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "https://izs.me" - }, - "bugs": { - "url": "https://github.com/npm/npm-normalize-package-bin/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Turn any flavor of allowable package.json bin into a normalized object", - "devDependencies": { - "tap": "^14.10.2" - }, - "homepage": "https://github.com/npm/npm-normalize-package-bin#readme", - "license": "ISC", - "name": "npm-normalize-package-bin", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/npm-normalize-package-bin.git" - }, - "scripts": { - "postpublish": "git push origin --follow-tags", - "postversion": "npm publish", - "preversion": "npm test", - "snap": "tap", - "test": "tap" - }, - "tap": { - "check-coverage": true - }, - "version": "1.0.1" -} diff --git a/node_modules/npm-normalize-package-bin/test/array.js b/node_modules/npm-normalize-package-bin/test/array.js deleted file mode 100644 index 63dafa8..0000000 --- a/node_modules/npm-normalize-package-bin/test/array.js +++ /dev/null @@ -1,37 +0,0 @@ -const normalize = require('../') -const t = require('tap') - -t.test('benign array', async t => { - const pkg = { name: 'hello', version: 'world', bin: ['./x/y', 'y/z', './a'] } - const expect = { name: 'hello', version: 'world', bin: { - y: 'x/y', - z: 'y/z', - a: 'a', - } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('conflicting array', async t => { - const pkg = { name: 'hello', version: 'world', bin: ['./x/y', 'z/y', './a'] } - const expect = { name: 'hello', version: 'world', bin: { - y: 'z/y', - a: 'a', - } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('slashy array', async t => { - const pkg = { name: 'hello', version: 'world', bin: [ '/etc/passwd' ] } - const expect = { name: 'hello', version: 'world', bin: { passwd: 'etc/passwd' } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('dotty array', async t => { - const pkg = { name: 'hello', version: 'world', bin: ['../../../../etc/passwd'] } - const expect = { name: 'hello', version: 'world', bin: { passwd: 'etc/passwd' } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) diff --git a/node_modules/npm-normalize-package-bin/test/nobin.js b/node_modules/npm-normalize-package-bin/test/nobin.js deleted file mode 100644 index 536d7eb..0000000 --- a/node_modules/npm-normalize-package-bin/test/nobin.js +++ /dev/null @@ -1,35 +0,0 @@ -const normalize = require('../') -const t = require('tap') - -// all of these just delete the bins, so expect the same value -const expect = { name: 'hello', version: 'world' } - -t.test('no bin in object', async t => { - const pkg = { name: 'hello', version: 'world' } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('empty string bin in object', async t => { - const pkg = { name: 'hello', version: 'world', bin: '' } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('false bin in object', async t => { - const pkg = { name: 'hello', version: 'world', bin: false } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('null bin in object', async t => { - const pkg = { name: 'hello', version: 'world', bin: null } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('number bin', async t => { - const pkg = { name: 'hello', version: 'world', bin: 42069 } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) diff --git a/node_modules/npm-normalize-package-bin/test/object.js b/node_modules/npm-normalize-package-bin/test/object.js deleted file mode 100644 index 00d2368..0000000 --- a/node_modules/npm-normalize-package-bin/test/object.js +++ /dev/null @@ -1,141 +0,0 @@ -const normalize = require('../') -const t = require('tap') - -t.test('benign object', async t => { - // just clean up the ./ in the targets and remove anything weird - const pkg = { name: 'hello', version: 'world', bin: { - y: './x/y', - z: './y/z', - a: './a', - } } - const expect = { name: 'hello', version: 'world', bin: { - y: 'x/y', - z: 'y/z', - a: 'a', - } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('empty and non-string targets', async t => { - // just clean up the ./ in the targets and remove anything weird - const pkg = { name: 'hello', version: 'world', bin: { - z: './././', - y: '', - './x': 'x.js', - re: /asdf/, - foo: { bar: 'baz' }, - false: false, - null: null, - array: [1,2,3], - func: function () {}, - } } - const expect = { name: 'hello', version: 'world', bin: { - x: 'x.js', - } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('slashy object', async t => { - const pkg = { name: 'hello', version: 'world', bin: { - '/path/foo': '/etc/passwd', - 'bar': '/etc/passwd', - '/etc/glorb/baz': '/etc/passwd', - '/etc/passwd:/bin/usr/exec': '/etc/passwd', - } } - const expect = { - name: 'hello', - version: 'world', - bin: { - foo: 'etc/passwd', - bar: 'etc/passwd', - baz: 'etc/passwd', - exec: 'etc/passwd', - } - } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('dotty object', async t => { - const pkg = { - name: 'hello', - version: 'world', - bin: { - 'nodots': '../../../../etc/passwd', - '../../../../../../dots': '../../../../etc/passwd', - '.././../\\./..//C:\\./': 'this is removed', - '.././../\\./..//C:\\/': 'super safe programming language', - '.././../\\./..//C:\\x\\y\\z/': 'xyz', - } } - const expect = { name: 'hello', version: 'world', bin: { - nodots: 'etc/passwd', - dots: 'etc/passwd', - C: 'super safe programming language', - z: 'xyz', - } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('weird object', async t => { - const pkg = { name: 'hello', version: 'world', bin: /asdf/ } - const expect = { name: 'hello', version: 'world' } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('oddball keys', async t => { - const pkg = { - bin: { - '~': 'target', - '£': 'target', - 'ζ': 'target', - 'ぎ': 'target', - '操': 'target', - '🎱': 'target', - '💎': 'target', - '💸': 'target', - '🦉': 'target', - 'сheck-dom': 'target', - 'Ωpm': 'target', - 'ζλ': 'target', - 'мга': 'target', - 'пше': 'target', - 'тзч': 'target', - 'тзь': 'target', - 'нфкт': 'target', - 'ссср': 'target', - '君の名は': 'target', - '君の名は': 'target', - } - } - - const expect = { - bin: { - '~': 'target', - '£': 'target', - 'ζ': 'target', - 'ぎ': 'target', - '操': 'target', - '🎱': 'target', - '💎': 'target', - '💸': 'target', - '🦉': 'target', - 'сheck-dom': 'target', - 'Ωpm': 'target', - 'ζλ': 'target', - 'мга': 'target', - 'пше': 'target', - 'тзч': 'target', - 'тзь': 'target', - 'нфкт': 'target', - 'ссср': 'target', - '君の名は': 'target', - }, - } - - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) diff --git a/node_modules/npm-normalize-package-bin/test/string.js b/node_modules/npm-normalize-package-bin/test/string.js deleted file mode 100644 index b6de8f8..0000000 --- a/node_modules/npm-normalize-package-bin/test/string.js +++ /dev/null @@ -1,37 +0,0 @@ -const normalize = require('../') -const t = require('tap') - -t.test('benign string', async t => { - const pkg = { name: 'hello', version: 'world', bin: 'hello.js' } - const expect = { name: 'hello', version: 'world', bin: { hello: 'hello.js' } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('slashy string', async t => { - const pkg = { name: 'hello', version: 'world', bin: '/etc/passwd' } - const expect = { name: 'hello', version: 'world', bin: { hello: 'etc/passwd' } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('dotty string', async t => { - const pkg = { name: 'hello', version: 'world', bin: '../../../../etc/passwd' } - const expect = { name: 'hello', version: 'world', bin: { hello: 'etc/passwd' } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('double path', async t => { - const pkg = { name: 'hello', version: 'world', bin: '/etc/passwd:/bin/usr/exec' } - const expect = { name: 'hello', version: 'world', bin: { hello: 'etc/passwd:/bin/usr/exec' } } - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) - -t.test('string with no name', async t => { - const pkg = { bin: 'foobar.js' } - const expect = {} - t.strictSame(normalize(pkg), expect) - t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') -}) diff --git a/node_modules/npm-packlist/LICENSE b/node_modules/npm-packlist/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/npm-packlist/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/npm-packlist/README.md b/node_modules/npm-packlist/README.md deleted file mode 100644 index ead5821..0000000 --- a/node_modules/npm-packlist/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# npm-packlist - -[![Build Status](https://travis-ci.com/npm/npm-packlist.svg?token=hHeDp9pQmz9kvsgRNVHy&branch=master)](https://travis-ci.com/npm/npm-packlist) - -Get a list of the files to add from a folder into an npm package - -These can be handed to [tar](http://npm.im/tar) like so to make an npm -package tarball: - -```js -const packlist = require('npm-packlist') -const tar = require('tar') -const packageDir = '/path/to/package' -const packageTarball = '/path/to/package.tgz' - -packlist({ path: packageDir }) - .then(files => tar.create({ - prefix: 'package/', - cwd: packageDir, - file: packageTarball, - gzip: true - }, files)) - .then(_ => { - // tarball has been created, continue with your day - }) -``` - -This uses the following rules: - -1. If a `package.json` file is found, and it has a `files` list, - then ignore everything that isn't in `files`. Always include the - readme, license, notice, changes, changelog, and history files, if - they exist, and the package.json file itself. -2. If there's no `package.json` file (or it has no `files` list), and - there is a `.npmignore` file, then ignore all the files in the - `.npmignore` file. -3. If there's no `package.json` with a `files` list, and there's no - `.npmignore` file, but there is a `.gitignore` file, then ignore - all the files in the `.gitignore` file. -4. Everything in the root `node_modules` is ignored, unless it's a - bundled dependency. If it IS a bundled dependency, and it's a - symbolic link, then the target of the link is included, not the - symlink itself. -4. Unless they're explicitly included (by being in a `files` list, or - a `!negated` rule in a relevant `.npmignore` or `.gitignore`), - always ignore certain common cruft files: - - 1. .npmignore and .gitignore files (their effect is in the package - already, there's no need to include them in the package) - 2. editor junk like `.*.swp`, `._*` and `.*.orig` files - 3. `.npmrc` files (these may contain private configs) - 4. The `node_modules/.bin` folder - 5. Waf and gyp cruft like `/build/config.gypi` and `.lock-wscript` - 6. Darwin's `.DS_Store` files because wtf are those even - 7. `npm-debug.log` files at the root of a project - - You can explicitly re-include any of these with a `files` list in - `package.json` or a negated ignore file rule. - -## API - -Same API as [ignore-walk](http://npm.im/ignore-walk), just hard-coded -file list and rule sets. - -The `Walker` and `WalkerSync` classes take a `bundled` argument, which -is a list of package names to include from node_modules. When calling -the top-level `packlist()` and `packlist.sync()` functions, this -module calls into `npm-bundled` directly. diff --git a/node_modules/npm-packlist/index.js b/node_modules/npm-packlist/index.js deleted file mode 100644 index eaf14b8..0000000 --- a/node_modules/npm-packlist/index.js +++ /dev/null @@ -1,289 +0,0 @@ -'use strict' - -// Do a two-pass walk, first to get the list of packages that need to be -// bundled, then again to get the actual files and folders. -// Keep a cache of node_modules content and package.json data, so that the -// second walk doesn't have to re-do all the same work. - -const bundleWalk = require('npm-bundled') -const BundleWalker = bundleWalk.BundleWalker -const BundleWalkerSync = bundleWalk.BundleWalkerSync - -const ignoreWalk = require('ignore-walk') -const IgnoreWalker = ignoreWalk.Walker -const IgnoreWalkerSync = ignoreWalk.WalkerSync - -const rootBuiltinRules = Symbol('root-builtin-rules') -const packageNecessaryRules = Symbol('package-necessary-rules') -const path = require('path') - -const normalizePackageBin = require('npm-normalize-package-bin') - -const defaultRules = [ - '.npmignore', - '.gitignore', - '**/.git', - '**/.svn', - '**/.hg', - '**/CVS', - '**/.git/**', - '**/.svn/**', - '**/.hg/**', - '**/CVS/**', - '/.lock-wscript', - '/.wafpickle-*', - '/build/config.gypi', - 'npm-debug.log', - '**/.npmrc', - '.*.swp', - '.DS_Store', - '**/.DS_Store/**', - '._*', - '**/._*/**', - '*.orig', - '/package-lock.json', - '/yarn.lock', - 'archived-packages/**', - 'core', - '!core/', - '!**/core/', - '*.core', - '*.vgcore', - 'vgcore.*', - 'core.+([0-9])', -] - -// There may be others, but :?|<> are handled by node-tar -const nameIsBadForWindows = file => /\*/.test(file) - -// a decorator that applies our custom rules to an ignore walker -const npmWalker = Class => class Walker extends Class { - constructor (opt) { - opt = opt || {} - - // the order in which rules are applied. - opt.ignoreFiles = [ - rootBuiltinRules, - 'package.json', - '.npmignore', - '.gitignore', - packageNecessaryRules - ] - - opt.includeEmpty = false - opt.path = opt.path || process.cwd() - const dirName = path.basename(opt.path) - const parentName = path.basename(path.dirname(opt.path)) - opt.follow = - dirName === 'node_modules' || - (parentName === 'node_modules' && /^@/.test(dirName)) - super(opt) - - // ignore a bunch of things by default at the root level. - // also ignore anything in node_modules, except bundled dependencies - if (!this.parent) { - this.bundled = opt.bundled || [] - this.bundledScopes = Array.from(new Set( - this.bundled.filter(f => /^@/.test(f)) - .map(f => f.split('/')[0]))) - const rules = defaultRules.join('\n') + '\n' - this.packageJsonCache = opt.packageJsonCache || new Map() - super.onReadIgnoreFile(rootBuiltinRules, rules, _=>_) - } else { - this.bundled = [] - this.bundledScopes = [] - this.packageJsonCache = this.parent.packageJsonCache - } - } - - onReaddir (entries) { - if (!this.parent) { - entries = entries.filter(e => - e !== '.git' && - !(e === 'node_modules' && this.bundled.length === 0) - ) - } - return super.onReaddir(entries) - } - - filterEntry (entry, partial) { - // get the partial path from the root of the walk - const p = this.path.substr(this.root.length + 1) - const pkgre = /^node_modules\/(@[^\/]+\/?[^\/]+|[^\/]+)(\/.*)?$/ - const isRoot = !this.parent - const pkg = isRoot && pkgre.test(entry) ? - entry.replace(pkgre, '$1') : null - const rootNM = isRoot && entry === 'node_modules' - const rootPJ = isRoot && entry === 'package.json' - - return ( - // if we're in a bundled package, check with the parent. - /^node_modules($|\/)/i.test(p) ? this.parent.filterEntry( - this.basename + '/' + entry, partial) - - // if package is bundled, all files included - // also include @scope dirs for bundled scoped deps - // they'll be ignored if no files end up in them. - // However, this only matters if we're in the root. - // node_modules folders elsewhere, like lib/node_modules, - // should be included normally unless ignored. - : pkg ? -1 !== this.bundled.indexOf(pkg) || - -1 !== this.bundledScopes.indexOf(pkg) - - // only walk top node_modules if we want to bundle something - : rootNM ? !!this.bundled.length - - // always include package.json at the root. - : rootPJ ? true - - // otherwise, follow ignore-walk's logic - : super.filterEntry(entry, partial) - ) - } - - filterEntries () { - if (this.ignoreRules['package.json']) - this.ignoreRules['.gitignore'] = this.ignoreRules['.npmignore'] = null - else if (this.ignoreRules['.npmignore']) - this.ignoreRules['.gitignore'] = null - this.filterEntries = super.filterEntries - super.filterEntries() - } - - addIgnoreFile (file, then) { - const ig = path.resolve(this.path, file) - if (this.packageJsonCache.has(ig)) - this.onPackageJson(ig, this.packageJsonCache.get(ig), then) - else - super.addIgnoreFile(file, then) - } - - onPackageJson (ig, pkg, then) { - this.packageJsonCache.set(ig, pkg) - - // if there's a bin, browser or main, make sure we don't ignore it - // also, don't ignore the package.json itself! - // - // Weird side-effect of this: a readme (etc) file will be included - // if it exists anywhere within a folder with a package.json file. - // The original intent was only to include these files in the root, - // but now users in the wild are dependent on that behavior for - // localized documentation and other use cases. Adding a `/` to - // these rules, while tempting and arguably more "correct", is a - // breaking change. - const rules = [ - pkg.browser ? '!' + pkg.browser : '', - pkg.main ? '!' + pkg.main : '', - '!package.json', - '!npm-shrinkwrap.json', - '!@(readme|copying|license|licence|notice|changes|changelog|history){,.*[^~$]}' - ] - if (pkg.bin) { - // always an object, because normalized already - for (const key in pkg.bin) - rules.push('!' + pkg.bin[key]) - } - - const data = rules.filter(f => f).join('\n') + '\n' - super.onReadIgnoreFile(packageNecessaryRules, data, _=>_) - - if (Array.isArray(pkg.files)) - super.onReadIgnoreFile('package.json', '*\n' + pkg.files.map( - f => '!' + f + '\n!' + f.replace(/\/+$/, '') + '/**' - ).join('\n') + '\n', then) - else - then() - } - - // override parent stat function to completely skip any filenames - // that will break windows entirely. - // XXX(isaacs) Next major version should make this an error instead. - stat (entry, file, dir, then) { - if (nameIsBadForWindows(entry)) - then() - else - super.stat(entry, file, dir, then) - } - - // override parent onstat function to nix all symlinks - onstat (st, entry, file, dir, then) { - if (st.isSymbolicLink()) - then() - else - super.onstat(st, entry, file, dir, then) - } - - onReadIgnoreFile (file, data, then) { - if (file === 'package.json') - try { - const ig = path.resolve(this.path, file) - this.onPackageJson(ig, normalizePackageBin(JSON.parse(data)), then) - } catch (er) { - // ignore package.json files that are not json - then() - } - else - super.onReadIgnoreFile(file, data, then) - } - - sort (a, b) { - return sort(a, b) - } -} - -class Walker extends npmWalker(IgnoreWalker) { - walker (entry, then) { - new Walker(this.walkerOpt(entry)).on('done', then).start() - } -} - -class WalkerSync extends npmWalker(IgnoreWalkerSync) { - walker (entry, then) { - new WalkerSync(this.walkerOpt(entry)).start() - then() - } -} - -const walk = (options, callback) => { - options = options || {} - const p = new Promise((resolve, reject) => { - const bw = new BundleWalker(options) - bw.on('done', bundled => { - options.bundled = bundled - options.packageJsonCache = bw.packageJsonCache - new Walker(options).on('done', resolve).on('error', reject).start() - }) - bw.start() - }) - return callback ? p.then(res => callback(null, res), callback) : p -} - -const walkSync = options => { - options = options || {} - const bw = new BundleWalkerSync(options).start() - options.bundled = bw.result - options.packageJsonCache = bw.packageJsonCache - const walker = new WalkerSync(options) - walker.start() - return walker.result -} - -// optimize for compressibility -// extname, then basename, then locale alphabetically -// https://twitter.com/isntitvacant/status/1131094910923231232 -const sort = (a, b) => { - const exta = path.extname(a).toLowerCase() - const extb = path.extname(b).toLowerCase() - const basea = path.basename(a).toLowerCase() - const baseb = path.basename(b).toLowerCase() - - return exta.localeCompare(extb) || - basea.localeCompare(baseb) || - a.localeCompare(b) -} - - -module.exports = walk -walk.sync = walkSync -walk.Walker = Walker -walk.WalkerSync = WalkerSync diff --git a/node_modules/npm-packlist/package.json b/node_modules/npm-packlist/package.json deleted file mode 100644 index dd7c911..0000000 --- a/node_modules/npm-packlist/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "npm-packlist@^1.1.6", - "_id": "npm-packlist@1.4.8", - "_inBundle": false, - "_integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", - "_location": "/npm-packlist", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "npm-packlist@^1.1.6", - "name": "npm-packlist", - "escapedName": "npm-packlist", - "rawSpec": "^1.1.6", - "saveSpec": null, - "fetchSpec": "^1.1.6" - }, - "_requiredBy": [ - "/node-pre-gyp" - ], - "_resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", - "_shasum": "56ee6cc135b9f98ad3d51c1c95da22bbb9b2ef3e", - "_spec": "npm-packlist@^1.1.6", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/node-pre-gyp", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/npm/npm-packlist/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1", - "npm-normalize-package-bin": "^1.0.1" - }, - "deprecated": false, - "description": "Get a list of the files to add from a folder into an npm package", - "devDependencies": { - "mkdirp": "^0.5.1", - "rimraf": "^2.6.1", - "tap": "^14.6.9" - }, - "directories": { - "test": "test" - }, - "files": [ - "index.js" - ], - "homepage": "https://www.npmjs.com/package/npm-packlist", - "license": "ISC", - "main": "index.js", - "name": "npm-packlist", - "publishConfig": { - "tag": "legacy-v1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/npm/npm-packlist.git" - }, - "scripts": { - "postpublish": "git push origin --follow-tags", - "postversion": "npm publish", - "preversion": "npm test", - "snap": "tap", - "test": "tap" - }, - "tap": { - "jobs": 1 - }, - "version": "1.4.8" -} diff --git a/node_modules/npmlog/CHANGELOG.md b/node_modules/npmlog/CHANGELOG.md deleted file mode 100644 index 51e4abc..0000000 --- a/node_modules/npmlog/CHANGELOG.md +++ /dev/null @@ -1,49 +0,0 @@ -### v4.0.2 - -* Added installation instructions. - -### v4.0.1 - -* Fix bugs where `log.progressEnabled` got out of sync with how `gauge` kept - track of these things resulting in a progressbar that couldn't be disabled. - -### v4.0.0 - -* Allow creating log levels that are an empty string or 0. - -### v3.1.2 - -* Update to `gauge@1.6.0` adding support for default values for template - items. - -### v3.1.1 - -* Update to `gauge@1.5.3` to fix to `1.x` compatibility when it comes to - when a progress bar is enabled. In `1.x` if you didn't have a TTY the - progress bar was never shown. In `2.x` it merely defaults to disabled, - but you can enable it explicitly if you still want progress updates. - -### v3.1.0 - -* Update to `gauge@2.5.2`: - * Updates the `signal-exit` dependency which fixes an incompatibility with - the node profiler. - * Uses externalizes its ansi code generation in `console-control-strings` -* Make the default progress bar include the last line printed, colored as it - would be when printing to a tty. - -### v3.0.0 - -* Switch to `gauge@2.0.0`, for better performance, better look. -* Set stderr/stdout blocking if they're tty's, so that we can hide a - progress bar going to stderr and then safely print to stdout. Without - this the two can end up overlapping producing confusing and sometimes - corrupted output. - -### v2.0.0 - -* Make the `error` event non-fatal so that folks can use it as a prefix. - -### v1.0.0 - -* Add progress bar with `gauge@1.1.0` diff --git a/node_modules/npmlog/LICENSE b/node_modules/npmlog/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/npmlog/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/npmlog/README.md b/node_modules/npmlog/README.md deleted file mode 100644 index 268a4af..0000000 --- a/node_modules/npmlog/README.md +++ /dev/null @@ -1,216 +0,0 @@ -# npmlog - -The logger util that npm uses. - -This logger is very basic. It does the logging for npm. It supports -custom levels and colored output. - -By default, logs are written to stderr. If you want to send log messages -to outputs other than streams, then you can change the `log.stream` -member, or you can just listen to the events that it emits, and do -whatever you want with them. - -# Installation - -```console -npm install npmlog --save -``` - -# Basic Usage - -```javascript -var log = require('npmlog') - -// additional stuff ---------------------------+ -// message ----------+ | -// prefix ----+ | | -// level -+ | | | -// v v v v - log.info('fyi', 'I have a kitty cat: %j', myKittyCat) -``` - -## log.level - -* {String} - -The level to display logs at. Any logs at or above this level will be -displayed. The special level `silent` will prevent anything from being -displayed ever. - -## log.record - -* {Array} - -An array of all the log messages that have been entered. - -## log.maxRecordSize - -* {Number} - -The maximum number of records to keep. If log.record gets bigger than -10% over this value, then it is sliced down to 90% of this value. - -The reason for the 10% window is so that it doesn't have to resize a -large array on every log entry. - -## log.prefixStyle - -* {Object} - -A style object that specifies how prefixes are styled. (See below) - -## log.headingStyle - -* {Object} - -A style object that specifies how the heading is styled. (See below) - -## log.heading - -* {String} Default: "" - -If set, a heading that is printed at the start of every line. - -## log.stream - -* {Stream} Default: `process.stderr` - -The stream where output is written. - -## log.enableColor() - -Force colors to be used on all messages, regardless of the output -stream. - -## log.disableColor() - -Disable colors on all messages. - -## log.enableProgress() - -Enable the display of log activity spinner and progress bar - -## log.disableProgress() - -Disable the display of a progress bar - -## log.enableUnicode() - -Force the unicode theme to be used for the progress bar. - -## log.disableUnicode() - -Disable the use of unicode in the progress bar. - -## log.setGaugeTemplate(template) - -Set a template for outputting the progress bar. See the [gauge documentation] for details. - -[gauge documentation]: https://npmjs.com/package/gauge - -## log.setGaugeThemeset(themes) - -Select a themeset to pick themes from for the progress bar. See the [gauge documentation] for details. - -## log.pause() - -Stop emitting messages to the stream, but do not drop them. - -## log.resume() - -Emit all buffered messages that were written while paused. - -## log.log(level, prefix, message, ...) - -* `level` {String} The level to emit the message at -* `prefix` {String} A string prefix. Set to "" to skip. -* `message...` Arguments to `util.format` - -Emit a log message at the specified level. - -## log\[level](prefix, message, ...) - -For example, - -* log.silly(prefix, message, ...) -* log.verbose(prefix, message, ...) -* log.info(prefix, message, ...) -* log.http(prefix, message, ...) -* log.warn(prefix, message, ...) -* log.error(prefix, message, ...) - -Like `log.log(level, prefix, message, ...)`. In this way, each level is -given a shorthand, so you can do `log.info(prefix, message)`. - -## log.addLevel(level, n, style, disp) - -* `level` {String} Level indicator -* `n` {Number} The numeric level -* `style` {Object} Object with fg, bg, inverse, etc. -* `disp` {String} Optional replacement for `level` in the output. - -Sets up a new level with a shorthand function and so forth. - -Note that if the number is `Infinity`, then setting the level to that -will cause all log messages to be suppressed. If the number is -`-Infinity`, then the only way to show it is to enable all log messages. - -## log.newItem(name, todo, weight) - -* `name` {String} Optional; progress item name. -* `todo` {Number} Optional; total amount of work to be done. Default 0. -* `weight` {Number} Optional; the weight of this item relative to others. Default 1. - -This adds a new `are-we-there-yet` item tracker to the progress tracker. The -object returned has the `log[level]` methods but is otherwise an -`are-we-there-yet` `Tracker` object. - -## log.newStream(name, todo, weight) - -This adds a new `are-we-there-yet` stream tracker to the progress tracker. The -object returned has the `log[level]` methods but is otherwise an -`are-we-there-yet` `TrackerStream` object. - -## log.newGroup(name, weight) - -This adds a new `are-we-there-yet` tracker group to the progress tracker. The -object returned has the `log[level]` methods but is otherwise an -`are-we-there-yet` `TrackerGroup` object. - -# Events - -Events are all emitted with the message object. - -* `log` Emitted for all messages -* `log.` Emitted for all messages with the `` level. -* `` Messages with prefixes also emit their prefix as an event. - -# Style Objects - -Style objects can have the following fields: - -* `fg` {String} Color for the foreground text -* `bg` {String} Color for the background -* `bold`, `inverse`, `underline` {Boolean} Set the associated property -* `bell` {Boolean} Make a noise (This is pretty annoying, probably.) - -# Message Objects - -Every log event is emitted with a message object, and the `log.record` -list contains all of them that have been created. They have the -following fields: - -* `id` {Number} -* `level` {String} -* `prefix` {String} -* `message` {String} Result of `util.format()` -* `messageRaw` {Array} Arguments to `util.format()` - -# Blocking TTYs - -We use [`set-blocking`](https://npmjs.com/package/set-blocking) to set -stderr and stdout blocking if they are tty's and have the setBlocking call. -This is a work around for an issue in early versions of Node.js 6.x, which -made stderr and stdout non-blocking on OSX. (They are always blocking -Windows and were never blocking on Linux.) `npmlog` needs them to be blocking -so that it can allow output to stdout and stderr to be interlaced. diff --git a/node_modules/npmlog/log.js b/node_modules/npmlog/log.js deleted file mode 100644 index 341f331..0000000 --- a/node_modules/npmlog/log.js +++ /dev/null @@ -1,309 +0,0 @@ -'use strict' -var Progress = require('are-we-there-yet') -var Gauge = require('gauge') -var EE = require('events').EventEmitter -var log = exports = module.exports = new EE() -var util = require('util') - -var setBlocking = require('set-blocking') -var consoleControl = require('console-control-strings') - -setBlocking(true) -var stream = process.stderr -Object.defineProperty(log, 'stream', { - set: function (newStream) { - stream = newStream - if (this.gauge) this.gauge.setWriteTo(stream, stream) - }, - get: function () { - return stream - } -}) - -// by default, decide based on tty-ness. -var colorEnabled -log.useColor = function () { - return colorEnabled != null ? colorEnabled : stream.isTTY -} - -log.enableColor = function () { - colorEnabled = true - this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) -} -log.disableColor = function () { - colorEnabled = false - this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) -} - -// default level -log.level = 'info' - -log.gauge = new Gauge(stream, { - enabled: false, // no progress bars unless asked - theme: {hasColor: log.useColor()}, - template: [ - {type: 'progressbar', length: 20}, - {type: 'activityIndicator', kerning: 1, length: 1}, - {type: 'section', default: ''}, - ':', - {type: 'logline', kerning: 1, default: ''} - ] -}) - -log.tracker = new Progress.TrackerGroup() - -// we track this separately as we may need to temporarily disable the -// display of the status bar for our own loggy purposes. -log.progressEnabled = log.gauge.isEnabled() - -var unicodeEnabled - -log.enableUnicode = function () { - unicodeEnabled = true - this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled}) -} - -log.disableUnicode = function () { - unicodeEnabled = false - this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled}) -} - -log.setGaugeThemeset = function (themes) { - this.gauge.setThemeset(themes) -} - -log.setGaugeTemplate = function (template) { - this.gauge.setTemplate(template) -} - -log.enableProgress = function () { - if (this.progressEnabled) return - this.progressEnabled = true - this.tracker.on('change', this.showProgress) - if (this._pause) return - this.gauge.enable() -} - -log.disableProgress = function () { - if (!this.progressEnabled) return - this.progressEnabled = false - this.tracker.removeListener('change', this.showProgress) - this.gauge.disable() -} - -var trackerConstructors = ['newGroup', 'newItem', 'newStream'] - -var mixinLog = function (tracker) { - // mixin the public methods from log into the tracker - // (except: conflicts and one's we handle specially) - Object.keys(log).forEach(function (P) { - if (P[0] === '_') return - if (trackerConstructors.filter(function (C) { return C === P }).length) return - if (tracker[P]) return - if (typeof log[P] !== 'function') return - var func = log[P] - tracker[P] = function () { - return func.apply(log, arguments) - } - }) - // if the new tracker is a group, make sure any subtrackers get - // mixed in too - if (tracker instanceof Progress.TrackerGroup) { - trackerConstructors.forEach(function (C) { - var func = tracker[C] - tracker[C] = function () { return mixinLog(func.apply(tracker, arguments)) } - }) - } - return tracker -} - -// Add tracker constructors to the top level log object -trackerConstructors.forEach(function (C) { - log[C] = function () { return mixinLog(this.tracker[C].apply(this.tracker, arguments)) } -}) - -log.clearProgress = function (cb) { - if (!this.progressEnabled) return cb && process.nextTick(cb) - this.gauge.hide(cb) -} - -log.showProgress = function (name, completed) { - if (!this.progressEnabled) return - var values = {} - if (name) values.section = name - var last = log.record[log.record.length - 1] - if (last) { - values.subsection = last.prefix - var disp = log.disp[last.level] || last.level - var logline = this._format(disp, log.style[last.level]) - if (last.prefix) logline += ' ' + this._format(last.prefix, this.prefixStyle) - logline += ' ' + last.message.split(/\r?\n/)[0] - values.logline = logline - } - values.completed = completed || this.tracker.completed() - this.gauge.show(values) -}.bind(log) // bind for use in tracker's on-change listener - -// temporarily stop emitting, but don't drop -log.pause = function () { - this._paused = true - if (this.progressEnabled) this.gauge.disable() -} - -log.resume = function () { - if (!this._paused) return - this._paused = false - - var b = this._buffer - this._buffer = [] - b.forEach(function (m) { - this.emitLog(m) - }, this) - if (this.progressEnabled) this.gauge.enable() -} - -log._buffer = [] - -var id = 0 -log.record = [] -log.maxRecordSize = 10000 -log.log = function (lvl, prefix, message) { - var l = this.levels[lvl] - if (l === undefined) { - return this.emit('error', new Error(util.format( - 'Undefined log level: %j', lvl))) - } - - var a = new Array(arguments.length - 2) - var stack = null - for (var i = 2; i < arguments.length; i++) { - var arg = a[i - 2] = arguments[i] - - // resolve stack traces to a plain string. - if (typeof arg === 'object' && arg && - (arg instanceof Error) && arg.stack) { - - Object.defineProperty(arg, 'stack', { - value: stack = arg.stack + '', - enumerable: true, - writable: true - }) - } - } - if (stack) a.unshift(stack + '\n') - message = util.format.apply(util, a) - - var m = { id: id++, - level: lvl, - prefix: String(prefix || ''), - message: message, - messageRaw: a } - - this.emit('log', m) - this.emit('log.' + lvl, m) - if (m.prefix) this.emit(m.prefix, m) - - this.record.push(m) - var mrs = this.maxRecordSize - var n = this.record.length - mrs - if (n > mrs / 10) { - var newSize = Math.floor(mrs * 0.9) - this.record = this.record.slice(-1 * newSize) - } - - this.emitLog(m) -}.bind(log) - -log.emitLog = function (m) { - if (this._paused) { - this._buffer.push(m) - return - } - if (this.progressEnabled) this.gauge.pulse(m.prefix) - var l = this.levels[m.level] - if (l === undefined) return - if (l < this.levels[this.level]) return - if (l > 0 && !isFinite(l)) return - - // If 'disp' is null or undefined, use the lvl as a default - // Allows: '', 0 as valid disp - var disp = log.disp[m.level] != null ? log.disp[m.level] : m.level - this.clearProgress() - m.message.split(/\r?\n/).forEach(function (line) { - if (this.heading) { - this.write(this.heading, this.headingStyle) - this.write(' ') - } - this.write(disp, log.style[m.level]) - var p = m.prefix || '' - if (p) this.write(' ') - this.write(p, this.prefixStyle) - this.write(' ' + line + '\n') - }, this) - this.showProgress() -} - -log._format = function (msg, style) { - if (!stream) return - - var output = '' - if (this.useColor()) { - style = style || {} - var settings = [] - if (style.fg) settings.push(style.fg) - if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1)) - if (style.bold) settings.push('bold') - if (style.underline) settings.push('underline') - if (style.inverse) settings.push('inverse') - if (settings.length) output += consoleControl.color(settings) - if (style.beep) output += consoleControl.beep() - } - output += msg - if (this.useColor()) { - output += consoleControl.color('reset') - } - return output -} - -log.write = function (msg, style) { - if (!stream) return - - stream.write(this._format(msg, style)) -} - -log.addLevel = function (lvl, n, style, disp) { - // If 'disp' is null or undefined, use the lvl as a default - if (disp == null) disp = lvl - this.levels[lvl] = n - this.style[lvl] = style - if (!this[lvl]) { - this[lvl] = function () { - var a = new Array(arguments.length + 1) - a[0] = lvl - for (var i = 0; i < arguments.length; i++) { - a[i + 1] = arguments[i] - } - return this.log.apply(this, a) - }.bind(this) - } - this.disp[lvl] = disp -} - -log.prefixStyle = { fg: 'magenta' } -log.headingStyle = { fg: 'white', bg: 'black' } - -log.style = {} -log.levels = {} -log.disp = {} -log.addLevel('silly', -Infinity, { inverse: true }, 'sill') -log.addLevel('verbose', 1000, { fg: 'blue', bg: 'black' }, 'verb') -log.addLevel('info', 2000, { fg: 'green' }) -log.addLevel('timing', 2500, { fg: 'green', bg: 'black' }) -log.addLevel('http', 3000, { fg: 'green', bg: 'black' }) -log.addLevel('notice', 3500, { fg: 'blue', bg: 'black' }) -log.addLevel('warn', 4000, { fg: 'black', bg: 'yellow' }, 'WARN') -log.addLevel('error', 5000, { fg: 'red', bg: 'black' }, 'ERR!') -log.addLevel('silent', Infinity) - -// allow 'error' prefix -log.on('error', function () {}) diff --git a/node_modules/npmlog/package.json b/node_modules/npmlog/package.json deleted file mode 100644 index 76a3c35..0000000 --- a/node_modules/npmlog/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "_from": "npmlog@^4.0.2", - "_id": "npmlog@4.1.2", - "_inBundle": false, - "_integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "_location": "/npmlog", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "npmlog@^4.0.2", - "name": "npmlog", - "escapedName": "npmlog", - "rawSpec": "^4.0.2", - "saveSpec": null, - "fetchSpec": "^4.0.2" - }, - "_requiredBy": [ - "/node-pre-gyp" - ], - "_resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "_shasum": "08a7f2a8bf734604779a9efa4ad5cc717abb954b", - "_spec": "npmlog@^4.0.2", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/node-pre-gyp", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/npm/npmlog/issues" - }, - "bundleDependencies": false, - "dependencies": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - }, - "deprecated": false, - "description": "logger for npm", - "devDependencies": { - "standard": "~7.1.2", - "tap": "~5.7.3" - }, - "files": [ - "log.js" - ], - "homepage": "https://github.com/npm/npmlog#readme", - "license": "ISC", - "main": "log.js", - "name": "npmlog", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/npmlog.git" - }, - "scripts": { - "test": "standard && tap test/*.js" - }, - "version": "4.1.2" -} diff --git a/node_modules/number-is-nan/index.js b/node_modules/number-is-nan/index.js deleted file mode 100644 index 79be4b9..0000000 --- a/node_modules/number-is-nan/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -module.exports = Number.isNaN || function (x) { - return x !== x; -}; diff --git a/node_modules/number-is-nan/license b/node_modules/number-is-nan/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/number-is-nan/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/number-is-nan/package.json b/node_modules/number-is-nan/package.json deleted file mode 100644 index 0ec8ad6..0000000 --- a/node_modules/number-is-nan/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_from": "number-is-nan@^1.0.0", - "_id": "number-is-nan@1.0.1", - "_inBundle": false, - "_integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "_location": "/number-is-nan", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "number-is-nan@^1.0.0", - "name": "number-is-nan", - "escapedName": "number-is-nan", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/is-fullwidth-code-point" - ], - "_resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "_shasum": "097b602b53422a522c1afb8790318336941a011d", - "_spec": "number-is-nan@^1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/is-fullwidth-code-point", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/number-is-nan/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "ES2015 Number.isNaN() ponyfill", - "devDependencies": { - "ava": "*" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/number-is-nan#readme", - "keywords": [ - "es2015", - "ecmascript", - "ponyfill", - "polyfill", - "shim", - "number", - "is", - "nan", - "not" - ], - "license": "MIT", - "name": "number-is-nan", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/number-is-nan.git" - }, - "scripts": { - "test": "ava" - }, - "version": "1.0.1" -} diff --git a/node_modules/number-is-nan/readme.md b/node_modules/number-is-nan/readme.md deleted file mode 100644 index 2463508..0000000 --- a/node_modules/number-is-nan/readme.md +++ /dev/null @@ -1,28 +0,0 @@ -# number-is-nan [![Build Status](https://travis-ci.org/sindresorhus/number-is-nan.svg?branch=master)](https://travis-ci.org/sindresorhus/number-is-nan) - -> ES2015 [`Number.isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) [ponyfill](https://ponyfill.com) - - -## Install - -``` -$ npm install --save number-is-nan -``` - - -## Usage - -```js -var numberIsNan = require('number-is-nan'); - -numberIsNan(NaN); -//=> true - -numberIsNan('unicorn'); -//=> false -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/object-assign/index.js b/node_modules/object-assign/index.js deleted file mode 100644 index 0930cf8..0000000 --- a/node_modules/object-assign/index.js +++ /dev/null @@ -1,90 +0,0 @@ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; diff --git a/node_modules/object-assign/license b/node_modules/object-assign/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/object-assign/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/object-assign/package.json b/node_modules/object-assign/package.json deleted file mode 100644 index e3c06a9..0000000 --- a/node_modules/object-assign/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "object-assign@^4.1.0", - "_id": "object-assign@4.1.1", - "_inBundle": false, - "_integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "_location": "/object-assign", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "object-assign@^4.1.0", - "name": "object-assign", - "escapedName": "object-assign", - "rawSpec": "^4.1.0", - "saveSpec": null, - "fetchSpec": "^4.1.0" - }, - "_requiredBy": [ - "/gauge" - ], - "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "_shasum": "2109adc7965887cfc05cbbd442cac8bfbb360863", - "_spec": "object-assign@^4.1.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/gauge", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/object-assign/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "ES2015 `Object.assign()` ponyfill", - "devDependencies": { - "ava": "^0.16.0", - "lodash": "^4.16.4", - "matcha": "^0.7.0", - "xo": "^0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/object-assign#readme", - "keywords": [ - "object", - "assign", - "extend", - "properties", - "es2015", - "ecmascript", - "harmony", - "ponyfill", - "prollyfill", - "polyfill", - "shim", - "browser" - ], - "license": "MIT", - "name": "object-assign", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/object-assign.git" - }, - "scripts": { - "bench": "matcha bench.js", - "test": "xo && ava" - }, - "version": "4.1.1" -} diff --git a/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md deleted file mode 100644 index 1be09d3..0000000 --- a/node_modules/object-assign/readme.md +++ /dev/null @@ -1,61 +0,0 @@ -# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) - -> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) - - -## Use the built-in - -Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), -support `Object.assign()` :tada:. If you target only those environments, then by all -means, use `Object.assign()` instead of this package. - - -## Install - -``` -$ npm install --save object-assign -``` - - -## Usage - -```js -const objectAssign = require('object-assign'); - -objectAssign({foo: 0}, {bar: 1}); -//=> {foo: 0, bar: 1} - -// multiple sources -objectAssign({foo: 0}, {bar: 1}, {baz: 2}); -//=> {foo: 0, bar: 1, baz: 2} - -// overwrites equal keys -objectAssign({foo: 0}, {foo: 1}, {foo: 2}); -//=> {foo: 2} - -// ignores null and undefined sources -objectAssign({foo: 0}, null, {bar: 1}, undefined); -//=> {foo: 0, bar: 1} -``` - - -## API - -### objectAssign(target, [source, ...]) - -Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. - - -## Resources - -- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) - - -## Related - -- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/once/LICENSE b/node_modules/once/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/once/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/once/README.md b/node_modules/once/README.md deleted file mode 100644 index 1f1ffca..0000000 --- a/node_modules/once/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# once - -Only call a function once. - -## usage - -```javascript -var once = require('once') - -function load (file, cb) { - cb = once(cb) - loader.load('file') - loader.once('load', cb) - loader.once('error', cb) -} -``` - -Or add to the Function.prototype in a responsible way: - -```javascript -// only has to be done once -require('once').proto() - -function load (file, cb) { - cb = cb.once() - loader.load('file') - loader.once('load', cb) - loader.once('error', cb) -} -``` - -Ironically, the prototype feature makes this module twice as -complicated as necessary. - -To check whether you function has been called, use `fn.called`. Once the -function is called for the first time the return value of the original -function is saved in `fn.value` and subsequent calls will continue to -return this value. - -```javascript -var once = require('once') - -function load (cb) { - cb = once(cb) - var stream = createStream() - stream.once('data', cb) - stream.once('end', function () { - if (!cb.called) cb(new Error('not found')) - }) -} -``` - -## `once.strict(func)` - -Throw an error if the function is called twice. - -Some functions are expected to be called only once. Using `once` for them would -potentially hide logical errors. - -In the example below, the `greet` function has to call the callback only once: - -```javascript -function greet (name, cb) { - // return is missing from the if statement - // when no name is passed, the callback is called twice - if (!name) cb('Hello anonymous') - cb('Hello ' + name) -} - -function log (msg) { - console.log(msg) -} - -// this will print 'Hello anonymous' but the logical error will be missed -greet(null, once(msg)) - -// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time -greet(null, once.strict(msg)) -``` diff --git a/node_modules/once/once.js b/node_modules/once/once.js deleted file mode 100644 index 2354067..0000000 --- a/node_modules/once/once.js +++ /dev/null @@ -1,42 +0,0 @@ -var wrappy = require('wrappy') -module.exports = wrappy(once) -module.exports.strict = wrappy(onceStrict) - -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) - - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this) - }, - configurable: true - }) -}) - -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) - } - f.called = false - return f -} - -function onceStrict (fn) { - var f = function () { - if (f.called) - throw new Error(f.onceError) - f.called = true - return f.value = fn.apply(this, arguments) - } - var name = fn.name || 'Function wrapped with `once`' - f.onceError = name + " shouldn't be called more than once" - f.called = false - return f -} diff --git a/node_modules/once/package.json b/node_modules/once/package.json deleted file mode 100644 index b508f2f..0000000 --- a/node_modules/once/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "_from": "once@^1.3.0", - "_id": "once@1.4.0", - "_inBundle": false, - "_integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "_location": "/once", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "once@^1.3.0", - "name": "once", - "escapedName": "once", - "rawSpec": "^1.3.0", - "saveSpec": null, - "fetchSpec": "^1.3.0" - }, - "_requiredBy": [ - "/glob", - "/inflight", - "/simple-get" - ], - "_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1", - "_spec": "once@^1.3.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/glob", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/once/issues" - }, - "bundleDependencies": false, - "dependencies": { - "wrappy": "1" - }, - "deprecated": false, - "description": "Run a function exactly one time", - "devDependencies": { - "tap": "^7.0.1" - }, - "directories": { - "test": "test" - }, - "files": [ - "once.js" - ], - "homepage": "https://github.com/isaacs/once#readme", - "keywords": [ - "once", - "function", - "one", - "single" - ], - "license": "ISC", - "main": "once.js", - "name": "once", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/once.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "1.4.0" -} diff --git a/node_modules/os-homedir/index.js b/node_modules/os-homedir/index.js deleted file mode 100644 index 3306616..0000000 --- a/node_modules/os-homedir/index.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; -var os = require('os'); - -function homedir() { - var env = process.env; - var home = env.HOME; - var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME; - - if (process.platform === 'win32') { - return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null; - } - - if (process.platform === 'darwin') { - return home || (user ? '/Users/' + user : null); - } - - if (process.platform === 'linux') { - return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); - } - - return home || null; -} - -module.exports = typeof os.homedir === 'function' ? os.homedir : homedir; diff --git a/node_modules/os-homedir/license b/node_modules/os-homedir/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/os-homedir/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/os-homedir/package.json b/node_modules/os-homedir/package.json deleted file mode 100644 index 772e5e1..0000000 --- a/node_modules/os-homedir/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_from": "os-homedir@^1.0.0", - "_id": "os-homedir@1.0.2", - "_inBundle": false, - "_integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "_location": "/os-homedir", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "os-homedir@^1.0.0", - "name": "os-homedir", - "escapedName": "os-homedir", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/osenv" - ], - "_resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "_shasum": "ffbc4988336e0e833de0c168c7ef152121aa7fb3", - "_spec": "os-homedir@^1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/osenv", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/os-homedir/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Node.js 4 `os.homedir()` ponyfill", - "devDependencies": { - "ava": "*", - "path-exists": "^2.0.0", - "xo": "^0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/os-homedir#readme", - "keywords": [ - "builtin", - "core", - "ponyfill", - "polyfill", - "shim", - "os", - "homedir", - "home", - "dir", - "directory", - "folder", - "user", - "path" - ], - "license": "MIT", - "name": "os-homedir", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/os-homedir.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "1.0.2" -} diff --git a/node_modules/os-homedir/readme.md b/node_modules/os-homedir/readme.md deleted file mode 100644 index 856ae61..0000000 --- a/node_modules/os-homedir/readme.md +++ /dev/null @@ -1,31 +0,0 @@ -# os-homedir [![Build Status](https://travis-ci.org/sindresorhus/os-homedir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-homedir) - -> Node.js 4 [`os.homedir()`](https://nodejs.org/api/os.html#os_os_homedir) [ponyfill](https://ponyfill.com) - - -## Install - -``` -$ npm install --save os-homedir -``` - - -## Usage - -```js -const osHomedir = require('os-homedir'); - -console.log(osHomedir()); -//=> '/Users/sindresorhus' -``` - - -## Related - -- [user-home](https://github.com/sindresorhus/user-home) - Same as this module but caches the result -- [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) - Get the user home directory with fallback to the system temp directory - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/os-tmpdir/index.js b/node_modules/os-tmpdir/index.js deleted file mode 100644 index 2077b1c..0000000 --- a/node_modules/os-tmpdir/index.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; -var isWindows = process.platform === 'win32'; -var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/; - -// https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43 -module.exports = function () { - var path; - - if (isWindows) { - path = process.env.TEMP || - process.env.TMP || - (process.env.SystemRoot || process.env.windir) + '\\temp'; - } else { - path = process.env.TMPDIR || - process.env.TMP || - process.env.TEMP || - '/tmp'; - } - - if (trailingSlashRe.test(path)) { - path = path.slice(0, -1); - } - - return path; -}; diff --git a/node_modules/os-tmpdir/license b/node_modules/os-tmpdir/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/os-tmpdir/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/os-tmpdir/package.json b/node_modules/os-tmpdir/package.json deleted file mode 100644 index ad83835..0000000 --- a/node_modules/os-tmpdir/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_from": "os-tmpdir@^1.0.0", - "_id": "os-tmpdir@1.0.2", - "_inBundle": false, - "_integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "_location": "/os-tmpdir", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "os-tmpdir@^1.0.0", - "name": "os-tmpdir", - "escapedName": "os-tmpdir", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/osenv" - ], - "_resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "_shasum": "bbe67406c79aa85c5cfec766fe5734555dfa1274", - "_spec": "os-tmpdir@^1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/osenv", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/os-tmpdir/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Node.js os.tmpdir() ponyfill", - "devDependencies": { - "ava": "*", - "xo": "^0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/os-tmpdir#readme", - "keywords": [ - "built-in", - "core", - "ponyfill", - "polyfill", - "shim", - "os", - "tmpdir", - "tempdir", - "tmp", - "temp", - "dir", - "directory", - "env", - "environment" - ], - "license": "MIT", - "name": "os-tmpdir", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/os-tmpdir.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "1.0.2" -} diff --git a/node_modules/os-tmpdir/readme.md b/node_modules/os-tmpdir/readme.md deleted file mode 100644 index c09f7ed..0000000 --- a/node_modules/os-tmpdir/readme.md +++ /dev/null @@ -1,32 +0,0 @@ -# os-tmpdir [![Build Status](https://travis-ci.org/sindresorhus/os-tmpdir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-tmpdir) - -> Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) [ponyfill](https://ponyfill.com) - -Use this instead of `require('os').tmpdir()` to get a consistent behavior on different Node.js versions (even 0.8). - - -## Install - -``` -$ npm install --save os-tmpdir -``` - - -## Usage - -```js -const osTmpdir = require('os-tmpdir'); - -osTmpdir(); -//=> '/var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T' -``` - - -## API - -See the [`os.tmpdir()` docs](https://nodejs.org/api/os.html#os_os_tmpdir). - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/osenv/LICENSE b/node_modules/osenv/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/osenv/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/osenv/README.md b/node_modules/osenv/README.md deleted file mode 100644 index 08fd900..0000000 --- a/node_modules/osenv/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# osenv - -Look up environment settings specific to different operating systems. - -## Usage - -```javascript -var osenv = require('osenv') -var path = osenv.path() -var user = osenv.user() -// etc. - -// Some things are not reliably in the env, and have a fallback command: -var h = osenv.hostname(function (er, hostname) { - h = hostname -}) -// This will still cause it to be memoized, so calling osenv.hostname() -// is now an immediate operation. - -// You can always send a cb, which will get called in the nextTick -// if it's been memoized, or wait for the fallback data if it wasn't -// found in the environment. -osenv.hostname(function (er, hostname) { - if (er) console.error('error looking up hostname') - else console.log('this machine calls itself %s', hostname) -}) -``` - -## osenv.hostname() - -The machine name. Calls `hostname` if not found. - -## osenv.user() - -The currently logged-in user. Calls `whoami` if not found. - -## osenv.prompt() - -Either PS1 on unix, or PROMPT on Windows. - -## osenv.tmpdir() - -The place where temporary files should be created. - -## osenv.home() - -No place like it. - -## osenv.path() - -An array of the places that the operating system will search for -executables. - -## osenv.editor() - -Return the executable name of the editor program. This uses the EDITOR -and VISUAL environment variables, and falls back to `vi` on Unix, or -`notepad.exe` on Windows. - -## osenv.shell() - -The SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash' -or 'cmd'. diff --git a/node_modules/osenv/osenv.js b/node_modules/osenv/osenv.js deleted file mode 100644 index 702a95b..0000000 --- a/node_modules/osenv/osenv.js +++ /dev/null @@ -1,72 +0,0 @@ -var isWindows = process.platform === 'win32' -var path = require('path') -var exec = require('child_process').exec -var osTmpdir = require('os-tmpdir') -var osHomedir = require('os-homedir') - -// looking up envs is a bit costly. -// Also, sometimes we want to have a fallback -// Pass in a callback to wait for the fallback on failures -// After the first lookup, always returns the same thing. -function memo (key, lookup, fallback) { - var fell = false - var falling = false - exports[key] = function (cb) { - var val = lookup() - if (!val && !fell && !falling && fallback) { - fell = true - falling = true - exec(fallback, function (er, output, stderr) { - falling = false - if (er) return // oh well, we tried - val = output.trim() - }) - } - exports[key] = function (cb) { - if (cb) process.nextTick(cb.bind(null, null, val)) - return val - } - if (cb && !falling) process.nextTick(cb.bind(null, null, val)) - return val - } -} - -memo('user', function () { - return ( isWindows - ? process.env.USERDOMAIN + '\\' + process.env.USERNAME - : process.env.USER - ) -}, 'whoami') - -memo('prompt', function () { - return isWindows ? process.env.PROMPT : process.env.PS1 -}) - -memo('hostname', function () { - return isWindows ? process.env.COMPUTERNAME : process.env.HOSTNAME -}, 'hostname') - -memo('tmpdir', function () { - return osTmpdir() -}) - -memo('home', function () { - return osHomedir() -}) - -memo('path', function () { - return (process.env.PATH || - process.env.Path || - process.env.path).split(isWindows ? ';' : ':') -}) - -memo('editor', function () { - return process.env.EDITOR || - process.env.VISUAL || - (isWindows ? 'notepad.exe' : 'vi') -}) - -memo('shell', function () { - return isWindows ? process.env.ComSpec || 'cmd' - : process.env.SHELL || 'bash' -}) diff --git a/node_modules/osenv/package.json b/node_modules/osenv/package.json deleted file mode 100644 index 7bca131..0000000 --- a/node_modules/osenv/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_from": "osenv@^0.1.4", - "_id": "osenv@0.1.5", - "_inBundle": false, - "_integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "_location": "/osenv", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "osenv@^0.1.4", - "name": "osenv", - "escapedName": "osenv", - "rawSpec": "^0.1.4", - "saveSpec": null, - "fetchSpec": "^0.1.4" - }, - "_requiredBy": [ - "/nopt" - ], - "_resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "_shasum": "85cdfafaeb28e8677f416e287592b5f3f49ea410", - "_spec": "osenv@^0.1.4", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/nopt", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/npm/osenv/issues" - }, - "bundleDependencies": false, - "dependencies": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - }, - "deprecated": false, - "description": "Look up environment settings specific to different operating systems", - "devDependencies": { - "tap": "^11.1.0" - }, - "directories": { - "test": "test" - }, - "files": [ - "osenv.js" - ], - "homepage": "https://github.com/npm/osenv#readme", - "keywords": [ - "environment", - "variable", - "home", - "tmpdir", - "path", - "prompt", - "ps1" - ], - "license": "ISC", - "main": "osenv.js", - "name": "osenv", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/osenv.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js" - }, - "version": "0.1.5" -} diff --git a/node_modules/p-limit/index.d.ts b/node_modules/p-limit/index.d.ts deleted file mode 100644 index 6bbfad4..0000000 --- a/node_modules/p-limit/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -export interface Limit { - /** - @param fn - Promise-returning/async function. - @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. - @returns The promise returned by calling `fn(...arguments)`. - */ - ( - fn: (...arguments: Arguments) => PromiseLike | ReturnType, - ...arguments: Arguments - ): Promise; - - /** - The number of promises that are currently running. - */ - readonly activeCount: number; - - /** - The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - */ - readonly pendingCount: number; - - /** - Discard pending promises that are waiting to run. - - This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. - - Note: This does not cancel promises that are already running. - */ - clearQueue(): void; -} - -/** -Run multiple promise-returning & async functions with limited concurrency. - -@param concurrency - Concurrency limit. Minimum: `1`. -@returns A `limit` function. -*/ -export default function pLimit(concurrency: number): Limit; diff --git a/node_modules/p-limit/index.js b/node_modules/p-limit/index.js deleted file mode 100644 index 6a72a4c..0000000 --- a/node_modules/p-limit/index.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; -const pTry = require('p-try'); - -const pLimit = concurrency => { - if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) { - return Promise.reject(new TypeError('Expected `concurrency` to be a number from 1 and up')); - } - - const queue = []; - let activeCount = 0; - - const next = () => { - activeCount--; - - if (queue.length > 0) { - queue.shift()(); - } - }; - - const run = (fn, resolve, ...args) => { - activeCount++; - - const result = pTry(fn, ...args); - - resolve(result); - - result.then(next, next); - }; - - const enqueue = (fn, resolve, ...args) => { - if (activeCount < concurrency) { - run(fn, resolve, ...args); - } else { - queue.push(run.bind(null, fn, resolve, ...args)); - } - }; - - const generator = (fn, ...args) => new Promise(resolve => enqueue(fn, resolve, ...args)); - Object.defineProperties(generator, { - activeCount: { - get: () => activeCount - }, - pendingCount: { - get: () => queue.length - }, - clearQueue: { - value: () => { - queue.length = 0; - } - } - }); - - return generator; -}; - -module.exports = pLimit; -module.exports.default = pLimit; diff --git a/node_modules/p-limit/license b/node_modules/p-limit/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/p-limit/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/p-limit/package.json b/node_modules/p-limit/package.json deleted file mode 100644 index 70fe0ea..0000000 --- a/node_modules/p-limit/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "_from": "p-limit@^2.2.0", - "_id": "p-limit@2.3.0", - "_inBundle": false, - "_integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "_location": "/p-limit", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "p-limit@^2.2.0", - "name": "p-limit", - "escapedName": "p-limit", - "rawSpec": "^2.2.0", - "saveSpec": null, - "fetchSpec": "^2.2.0" - }, - "_requiredBy": [ - "/p-locate" - ], - "_resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "_shasum": "3dd33c647a214fdfffd835933eb086da0dc21db1", - "_spec": "p-limit@^2.2.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/p-locate", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/p-limit/issues" - }, - "bundleDependencies": false, - "dependencies": { - "p-try": "^2.0.0" - }, - "deprecated": false, - "description": "Run multiple promise-returning & async functions with limited concurrency", - "devDependencies": { - "ava": "^1.2.1", - "delay": "^4.1.0", - "in-range": "^1.0.0", - "random-int": "^1.0.0", - "time-span": "^2.0.0", - "tsd-check": "^0.3.0", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "funding": "https://github.com/sponsors/sindresorhus", - "homepage": "https://github.com/sindresorhus/p-limit#readme", - "keywords": [ - "promise", - "limit", - "limited", - "concurrency", - "throttle", - "throat", - "rate", - "batch", - "ratelimit", - "task", - "queue", - "async", - "await", - "promises", - "bluebird" - ], - "license": "MIT", - "name": "p-limit", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/p-limit.git" - }, - "scripts": { - "test": "xo && ava && tsd-check" - }, - "version": "2.3.0" -} diff --git a/node_modules/p-limit/readme.md b/node_modules/p-limit/readme.md deleted file mode 100644 index 64aa476..0000000 --- a/node_modules/p-limit/readme.md +++ /dev/null @@ -1,101 +0,0 @@ -# p-limit [![Build Status](https://travis-ci.org/sindresorhus/p-limit.svg?branch=master)](https://travis-ci.org/sindresorhus/p-limit) - -> Run multiple promise-returning & async functions with limited concurrency - -## Install - -``` -$ npm install p-limit -``` - -## Usage - -```js -const pLimit = require('p-limit'); - -const limit = pLimit(1); - -const input = [ - limit(() => fetchSomething('foo')), - limit(() => fetchSomething('bar')), - limit(() => doSomething()) -]; - -(async () => { - // Only one promise is run at once - const result = await Promise.all(input); - console.log(result); -})(); -``` - -## API - -### pLimit(concurrency) - -Returns a `limit` function. - -#### concurrency - -Type: `number`\ -Minimum: `1`\ -Default: `Infinity` - -Concurrency limit. - -### limit(fn, ...args) - -Returns the promise returned by calling `fn(...args)`. - -#### fn - -Type: `Function` - -Promise-returning/async function. - -#### args - -Any arguments to pass through to `fn`. - -Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions. - -### limit.activeCount - -The number of promises that are currently running. - -### limit.pendingCount - -The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - -### limit.clearQueue() - -Discard pending promises that are waiting to run. - -This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. - -Note: This does not cancel promises that are already running. - -## FAQ - -### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package? - -This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue. - -## Related - -- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control -- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions -- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions -- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency -- [More…](https://github.com/sindresorhus/promise-fun) - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/p-locate/index.d.ts b/node_modules/p-locate/index.d.ts deleted file mode 100644 index 14115e1..0000000 --- a/node_modules/p-locate/index.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -declare namespace pLocate { - interface Options { - /** - Number of concurrently pending promises returned by `tester`. Minimum: `1`. - - @default Infinity - */ - readonly concurrency?: number; - - /** - Preserve `input` order when searching. - - Disable this to improve performance if you don't care about the order. - - @default true - */ - readonly preserveOrder?: boolean; - } -} - -declare const pLocate: { - /** - Get the first fulfilled promise that satisfies the provided testing function. - - @param input - An iterable of promises/values to test. - @param tester - This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. - @returns A `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. - - @example - ``` - import pathExists = require('path-exists'); - import pLocate = require('p-locate'); - - const files = [ - 'unicorn.png', - 'rainbow.png', // Only this one actually exists on disk - 'pony.png' - ]; - - (async () => { - const foundPath = await pLocate(files, file => pathExists(file)); - - console.log(foundPath); - //=> 'rainbow' - })(); - ``` - */ - ( - input: Iterable | ValueType>, - tester: (element: ValueType) => PromiseLike | boolean, - options?: pLocate.Options - ): Promise; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function pLocate( - // input: Iterable | ValueType>, - // tester: (element: ValueType) => PromiseLike | boolean, - // options?: pLocate.Options - // ): Promise; - // export = pLocate; - default: typeof pLocate; -}; - -export = pLocate; diff --git a/node_modules/p-locate/index.js b/node_modules/p-locate/index.js deleted file mode 100644 index e13ce15..0000000 --- a/node_modules/p-locate/index.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; -const pLimit = require('p-limit'); - -class EndError extends Error { - constructor(value) { - super(); - this.value = value; - } -} - -// The input can also be a promise, so we await it -const testElement = async (element, tester) => tester(await element); - -// The input can also be a promise, so we `Promise.all()` them both -const finder = async element => { - const values = await Promise.all(element); - if (values[1] === true) { - throw new EndError(values[0]); - } - - return false; -}; - -const pLocate = async (iterable, tester, options) => { - options = { - concurrency: Infinity, - preserveOrder: true, - ...options - }; - - const limit = pLimit(options.concurrency); - - // Start all the promises concurrently with optional limit - const items = [...iterable].map(element => [element, limit(testElement, element, tester)]); - - // Check the promises either serially or concurrently - const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity); - - try { - await Promise.all(items.map(element => checkLimit(finder, element))); - } catch (error) { - if (error instanceof EndError) { - return error.value; - } - - throw error; - } -}; - -module.exports = pLocate; -// TODO: Remove this for the next major release -module.exports.default = pLocate; diff --git a/node_modules/p-locate/license b/node_modules/p-locate/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/p-locate/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/p-locate/package.json b/node_modules/p-locate/package.json deleted file mode 100644 index e5f5bec..0000000 --- a/node_modules/p-locate/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "_from": "p-locate@^4.1.0", - "_id": "p-locate@4.1.0", - "_inBundle": false, - "_integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "_location": "/p-locate", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "p-locate@^4.1.0", - "name": "p-locate", - "escapedName": "p-locate", - "rawSpec": "^4.1.0", - "saveSpec": null, - "fetchSpec": "^4.1.0" - }, - "_requiredBy": [ - "/locate-path" - ], - "_resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "_shasum": "a3428bb7088b3a60292f66919278b7c297ad4f07", - "_spec": "p-locate@^4.1.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/locate-path", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/p-locate/issues" - }, - "bundleDependencies": false, - "dependencies": { - "p-limit": "^2.2.0" - }, - "deprecated": false, - "description": "Get the first fulfilled promise that satisfies the provided testing function", - "devDependencies": { - "ava": "^1.4.1", - "delay": "^4.1.0", - "in-range": "^1.0.0", - "time-span": "^3.0.0", - "tsd": "^0.7.2", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/p-locate#readme", - "keywords": [ - "promise", - "locate", - "find", - "finder", - "search", - "searcher", - "test", - "array", - "collection", - "iterable", - "iterator", - "race", - "fulfilled", - "fastest", - "async", - "await", - "promises", - "bluebird" - ], - "license": "MIT", - "name": "p-locate", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/p-locate.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "4.1.0" -} diff --git a/node_modules/p-locate/readme.md b/node_modules/p-locate/readme.md deleted file mode 100644 index f8e2c2e..0000000 --- a/node_modules/p-locate/readme.md +++ /dev/null @@ -1,90 +0,0 @@ -# p-locate [![Build Status](https://travis-ci.org/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.org/sindresorhus/p-locate) - -> Get the first fulfilled promise that satisfies the provided testing function - -Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find). - - -## Install - -``` -$ npm install p-locate -``` - - -## Usage - -Here we find the first file that exists on disk, in array order. - -```js -const pathExists = require('path-exists'); -const pLocate = require('p-locate'); - -const files = [ - 'unicorn.png', - 'rainbow.png', // Only this one actually exists on disk - 'pony.png' -]; - -(async () => { - const foundPath = await pLocate(files, file => pathExists(file)); - - console.log(foundPath); - //=> 'rainbow' -})(); -``` - -*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.* - - -## API - -### pLocate(input, tester, [options]) - -Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. - -#### input - -Type: `Iterable` - -An iterable of promises/values to test. - -#### tester(element) - -Type: `Function` - -This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. - -#### options - -Type: `Object` - -##### concurrency - -Type: `number`
-Default: `Infinity`
-Minimum: `1` - -Number of concurrently pending promises returned by `tester`. - -##### preserveOrder - -Type: `boolean`
-Default: `true` - -Preserve `input` order when searching. - -Disable this to improve performance if you don't care about the order. - - -## Related - -- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently -- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently -- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled -- [More…](https://github.com/sindresorhus/promise-fun) - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/p-try/index.d.ts b/node_modules/p-try/index.d.ts deleted file mode 100644 index 2a7319e..0000000 --- a/node_modules/p-try/index.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -declare const pTry: { - /** - Start a promise chain. - - @param fn - The function to run to start the promise chain. - @param arguments - Arguments to pass to `fn`. - @returns The value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error. - - @example - ``` - import pTry = require('p-try'); - - (async () => { - try { - const value = await pTry(() => { - return synchronousFunctionThatMightThrow(); - }); - console.log(value); - } catch (error) { - console.error(error); - } - })(); - ``` - */ - ( - fn: (...arguments: ArgumentsType) => PromiseLike | ValueType, - ...arguments: ArgumentsType - ): Promise; - - // TODO: remove this in the next major version, refactor the whole definition to: - // declare function pTry( - // fn: (...arguments: ArgumentsType) => PromiseLike | ValueType, - // ...arguments: ArgumentsType - // ): Promise; - // export = pTry; - default: typeof pTry; -}; - -export = pTry; diff --git a/node_modules/p-try/index.js b/node_modules/p-try/index.js deleted file mode 100644 index db858da..0000000 --- a/node_modules/p-try/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -const pTry = (fn, ...arguments_) => new Promise(resolve => { - resolve(fn(...arguments_)); -}); - -module.exports = pTry; -// TODO: remove this in the next major version -module.exports.default = pTry; diff --git a/node_modules/p-try/license b/node_modules/p-try/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/p-try/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/p-try/package.json b/node_modules/p-try/package.json deleted file mode 100644 index bf65f68..0000000 --- a/node_modules/p-try/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "p-try@^2.0.0", - "_id": "p-try@2.2.0", - "_inBundle": false, - "_integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "_location": "/p-try", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "p-try@^2.0.0", - "name": "p-try", - "escapedName": "p-try", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/p-limit" - ], - "_resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "_shasum": "cb2868540e313d61de58fafbe35ce9004d5540e6", - "_spec": "p-try@^2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/p-limit", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/p-try/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "`Start a promise chain", - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/p-try#readme", - "keywords": [ - "promise", - "try", - "resolve", - "function", - "catch", - "async", - "await", - "promises", - "settled", - "ponyfill", - "polyfill", - "shim", - "bluebird" - ], - "license": "MIT", - "name": "p-try", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/p-try.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "2.2.0" -} diff --git a/node_modules/p-try/readme.md b/node_modules/p-try/readme.md deleted file mode 100644 index 4d7bd64..0000000 --- a/node_modules/p-try/readme.md +++ /dev/null @@ -1,58 +0,0 @@ -# p-try [![Build Status](https://travis-ci.org/sindresorhus/p-try.svg?branch=master)](https://travis-ci.org/sindresorhus/p-try) - -> Start a promise chain - -[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/) - - -## Install - -``` -$ npm install p-try -``` - - -## Usage - -```js -const pTry = require('p-try'); - -(async () => { - try { - const value = await pTry(() => { - return synchronousFunctionThatMightThrow(); - }); - console.log(value); - } catch (error) { - console.error(error); - } -})(); -``` - - -## API - -### pTry(fn, ...arguments) - -Returns a `Promise` resolved with the value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error. - -Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions. - -#### fn - -The function to run to start the promise chain. - -#### arguments - -Arguments to pass to `fn`. - - -## Related - -- [p-finally](https://github.com/sindresorhus/p-finally) - `Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome -- [More…](https://github.com/sindresorhus/promise-fun) - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-exists/index.d.ts b/node_modules/path-exists/index.d.ts deleted file mode 100644 index 54b7ab8..0000000 --- a/node_modules/path-exists/index.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -declare const pathExists: { - /** - Check if a path exists. - - @returns Whether the path exists. - - @example - ``` - // foo.ts - import pathExists = require('path-exists'); - - (async () => { - console.log(await pathExists('foo.ts')); - //=> true - })(); - ``` - */ - (path: string): Promise; - - /** - Synchronously check if a path exists. - - @returns Whether the path exists. - */ - sync(path: string): boolean; -}; - -export = pathExists; diff --git a/node_modules/path-exists/index.js b/node_modules/path-exists/index.js deleted file mode 100644 index 1943921..0000000 --- a/node_modules/path-exists/index.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; -const fs = require('fs'); -const {promisify} = require('util'); - -const pAccess = promisify(fs.access); - -module.exports = async path => { - try { - await pAccess(path); - return true; - } catch (_) { - return false; - } -}; - -module.exports.sync = path => { - try { - fs.accessSync(path); - return true; - } catch (_) { - return false; - } -}; diff --git a/node_modules/path-exists/license b/node_modules/path-exists/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/path-exists/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/path-exists/package.json b/node_modules/path-exists/package.json deleted file mode 100644 index 893238d..0000000 --- a/node_modules/path-exists/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "_from": "path-exists@^4.0.0", - "_id": "path-exists@4.0.0", - "_inBundle": false, - "_integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "_location": "/path-exists", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "path-exists@^4.0.0", - "name": "path-exists", - "escapedName": "path-exists", - "rawSpec": "^4.0.0", - "saveSpec": null, - "fetchSpec": "^4.0.0" - }, - "_requiredBy": [ - "/find-up" - ], - "_resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "_shasum": "513bdbe2d3b95d7762e8c1137efa195c6c61b5b3", - "_spec": "path-exists@^4.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/find-up", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/path-exists/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Check if a path exists", - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/path-exists#readme", - "keywords": [ - "path", - "exists", - "exist", - "file", - "filepath", - "fs", - "filesystem", - "file-system", - "access", - "stat" - ], - "license": "MIT", - "name": "path-exists", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/path-exists.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "4.0.0" -} diff --git a/node_modules/path-exists/readme.md b/node_modules/path-exists/readme.md deleted file mode 100644 index 81f9845..0000000 --- a/node_modules/path-exists/readme.md +++ /dev/null @@ -1,52 +0,0 @@ -# path-exists [![Build Status](https://travis-ci.org/sindresorhus/path-exists.svg?branch=master)](https://travis-ci.org/sindresorhus/path-exists) - -> Check if a path exists - -NOTE: `fs.existsSync` has been un-deprecated in Node.js since 6.8.0. If you only need to check synchronously, this module is not needed. - -While [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), there's still a genuine use-case of being able to check if a path exists for other purposes than doing IO with it. - -Never use this before handling a file though: - -> In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there. - - -## Install - -``` -$ npm install path-exists -``` - - -## Usage - -```js -// foo.js -const pathExists = require('path-exists'); - -(async () => { - console.log(await pathExists('foo.js')); - //=> true -})(); -``` - - -## API - -### pathExists(path) - -Returns a `Promise` of whether the path exists. - -### pathExists.sync(path) - -Returns a `boolean` of whether the path exists. - - -## Related - -- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-is-absolute/index.js b/node_modules/path-is-absolute/index.js deleted file mode 100644 index 22aa6c3..0000000 --- a/node_modules/path-is-absolute/index.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -function posix(path) { - return path.charAt(0) === '/'; -} - -function win32(path) { - // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 - var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; - var result = splitDeviceRe.exec(path); - var device = result[1] || ''; - var isUnc = Boolean(device && device.charAt(1) !== ':'); - - // UNC paths are always absolute - return Boolean(result[2] || isUnc); -} - -module.exports = process.platform === 'win32' ? win32 : posix; -module.exports.posix = posix; -module.exports.win32 = win32; diff --git a/node_modules/path-is-absolute/license b/node_modules/path-is-absolute/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/path-is-absolute/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/path-is-absolute/package.json b/node_modules/path-is-absolute/package.json deleted file mode 100644 index 6960c77..0000000 --- a/node_modules/path-is-absolute/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "path-is-absolute@^1.0.0", - "_id": "path-is-absolute@1.0.1", - "_inBundle": false, - "_integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "_location": "/path-is-absolute", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "path-is-absolute@^1.0.0", - "name": "path-is-absolute", - "escapedName": "path-is-absolute", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/glob" - ], - "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f", - "_spec": "path-is-absolute@^1.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/glob", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/path-is-absolute/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Node.js 0.12 path.isAbsolute() ponyfill", - "devDependencies": { - "xo": "^0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/path-is-absolute#readme", - "keywords": [ - "path", - "paths", - "file", - "dir", - "absolute", - "isabsolute", - "is-absolute", - "built-in", - "util", - "utils", - "core", - "ponyfill", - "polyfill", - "shim", - "is", - "detect", - "check" - ], - "license": "MIT", - "name": "path-is-absolute", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/path-is-absolute.git" - }, - "scripts": { - "test": "xo && node test.js" - }, - "version": "1.0.1" -} diff --git a/node_modules/path-is-absolute/readme.md b/node_modules/path-is-absolute/readme.md deleted file mode 100644 index 8dbdf5f..0000000 --- a/node_modules/path-is-absolute/readme.md +++ /dev/null @@ -1,59 +0,0 @@ -# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) - -> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) - - -## Install - -``` -$ npm install --save path-is-absolute -``` - - -## Usage - -```js -const pathIsAbsolute = require('path-is-absolute'); - -// Running on Linux -pathIsAbsolute('/home/foo'); -//=> true -pathIsAbsolute('C:/Users/foo'); -//=> false - -// Running on Windows -pathIsAbsolute('C:/Users/foo'); -//=> true -pathIsAbsolute('/home/foo'); -//=> false - -// Running on any OS -pathIsAbsolute.posix('/home/foo'); -//=> true -pathIsAbsolute.posix('C:/Users/foo'); -//=> false -pathIsAbsolute.win32('C:/Users/foo'); -//=> true -pathIsAbsolute.win32('/home/foo'); -//=> false -``` - - -## API - -See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). - -### pathIsAbsolute(path) - -### pathIsAbsolute.posix(path) - -POSIX specific version. - -### pathIsAbsolute.win32(path) - -Windows specific version. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-parse/.travis.yml b/node_modules/path-parse/.travis.yml deleted file mode 100644 index dae31da..0000000 --- a/node_modules/path-parse/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -node_js: - - "0.12" - - "0.11" - - "0.10" - - "0.10.12" - - "0.8" - - "0.6" - - "iojs" diff --git a/node_modules/path-parse/LICENSE b/node_modules/path-parse/LICENSE deleted file mode 100644 index 810f3db..0000000 --- a/node_modules/path-parse/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Javier Blanco - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/path-parse/README.md b/node_modules/path-parse/README.md deleted file mode 100644 index 05097f8..0000000 --- a/node_modules/path-parse/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# path-parse [![Build Status](https://travis-ci.org/jbgutierrez/path-parse.svg?branch=master)](https://travis-ci.org/jbgutierrez/path-parse) - -> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) [ponyfill](https://ponyfill.com). - -## Install - -``` -$ npm install --save path-parse -``` - -## Usage - -```js -var pathParse = require('path-parse'); - -pathParse('/home/user/dir/file.txt'); -//=> { -// root : "/", -// dir : "/home/user/dir", -// base : "file.txt", -// ext : ".txt", -// name : "file" -// } -``` - -## API - -See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs. - -### pathParse(path) - -### pathParse.posix(path) - -The Posix specific version. - -### pathParse.win32(path) - -The Windows specific version. - -## License - -MIT © [Javier Blanco](http://jbgutierrez.info) diff --git a/node_modules/path-parse/index.js b/node_modules/path-parse/index.js deleted file mode 100644 index 3b7601f..0000000 --- a/node_modules/path-parse/index.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -var isWindows = process.platform === 'win32'; - -// Regex to split a windows path into three parts: [*, device, slash, -// tail] windows-only -var splitDeviceRe = - /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; - -// Regex to split the tail part of the above into [*, dir, basename, ext] -var splitTailRe = - /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/; - -var win32 = {}; - -// Function to split a filename into [root, dir, basename, ext] -function win32SplitPath(filename) { - // Separate device+slash from tail - var result = splitDeviceRe.exec(filename), - device = (result[1] || '') + (result[2] || ''), - tail = result[3] || ''; - // Split the tail into dir, basename and extension - var result2 = splitTailRe.exec(tail), - dir = result2[1], - basename = result2[2], - ext = result2[3]; - return [device, dir, basename, ext]; -} - -win32.parse = function(pathString) { - if (typeof pathString !== 'string') { - throw new TypeError( - "Parameter 'pathString' must be a string, not " + typeof pathString - ); - } - var allParts = win32SplitPath(pathString); - if (!allParts || allParts.length !== 4) { - throw new TypeError("Invalid path '" + pathString + "'"); - } - return { - root: allParts[0], - dir: allParts[0] + allParts[1].slice(0, -1), - base: allParts[2], - ext: allParts[3], - name: allParts[2].slice(0, allParts[2].length - allParts[3].length) - }; -}; - - - -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var posix = {}; - - -function posixSplitPath(filename) { - return splitPathRe.exec(filename).slice(1); -} - - -posix.parse = function(pathString) { - if (typeof pathString !== 'string') { - throw new TypeError( - "Parameter 'pathString' must be a string, not " + typeof pathString - ); - } - var allParts = posixSplitPath(pathString); - if (!allParts || allParts.length !== 4) { - throw new TypeError("Invalid path '" + pathString + "'"); - } - allParts[1] = allParts[1] || ''; - allParts[2] = allParts[2] || ''; - allParts[3] = allParts[3] || ''; - - return { - root: allParts[0], - dir: allParts[0] + allParts[1].slice(0, -1), - base: allParts[2], - ext: allParts[3], - name: allParts[2].slice(0, allParts[2].length - allParts[3].length) - }; -}; - - -if (isWindows) - module.exports = win32.parse; -else /* posix */ - module.exports = posix.parse; - -module.exports.posix = posix.parse; -module.exports.win32 = win32.parse; diff --git a/node_modules/path-parse/package.json b/node_modules/path-parse/package.json deleted file mode 100644 index f17b1c2..0000000 --- a/node_modules/path-parse/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "_from": "path-parse@^1.0.6", - "_id": "path-parse@1.0.6", - "_inBundle": false, - "_integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "_location": "/path-parse", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "path-parse@^1.0.6", - "name": "path-parse", - "escapedName": "path-parse", - "rawSpec": "^1.0.6", - "saveSpec": null, - "fetchSpec": "^1.0.6" - }, - "_requiredBy": [ - "/resolve" - ], - "_resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "_shasum": "d62dbb5679405d72c4737ec58600e9ddcf06d24c", - "_spec": "path-parse@^1.0.6", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/resolve", - "author": { - "name": "Javier Blanco", - "email": "http://jbgutierrez.info" - }, - "bugs": { - "url": "https://github.com/jbgutierrez/path-parse/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Node.js path.parse() ponyfill", - "homepage": "https://github.com/jbgutierrez/path-parse#readme", - "keywords": [ - "path", - "paths", - "file", - "dir", - "parse", - "built-in", - "util", - "utils", - "core", - "ponyfill", - "polyfill", - "shim" - ], - "license": "MIT", - "main": "index.js", - "name": "path-parse", - "repository": { - "type": "git", - "url": "git+https://github.com/jbgutierrez/path-parse.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "1.0.6" -} diff --git a/node_modules/path-parse/test.js b/node_modules/path-parse/test.js deleted file mode 100644 index 0b30c12..0000000 --- a/node_modules/path-parse/test.js +++ /dev/null @@ -1,77 +0,0 @@ -var assert = require('assert'); -var pathParse = require('./index'); - -var winParseTests = [ - [{ root: 'C:\\', dir: 'C:\\path\\dir', base: 'index.html', ext: '.html', name: 'index' }, 'C:\\path\\dir\\index.html'], - [{ root: 'C:\\', dir: 'C:\\another_path\\DIR\\1\\2\\33', base: 'index', ext: '', name: 'index' }, 'C:\\another_path\\DIR\\1\\2\\33\\index'], - [{ root: '', dir: 'another_path\\DIR with spaces\\1\\2\\33', base: 'index', ext: '', name: 'index' }, 'another_path\\DIR with spaces\\1\\2\\33\\index'], - [{ root: '\\', dir: '\\foo', base: 'C:', ext: '', name: 'C:' }, '\\foo\\C:'], - [{ root: '', dir: '', base: 'file', ext: '', name: 'file' }, 'file'], - [{ root: '', dir: '.', base: 'file', ext: '', name: 'file' }, '.\\file'], - - // unc - [{ root: '\\\\server\\share\\', dir: '\\\\server\\share\\', base: 'file_path', ext: '', name: 'file_path' }, '\\\\server\\share\\file_path'], - [{ root: '\\\\server two\\shared folder\\', dir: '\\\\server two\\shared folder\\', base: 'file path.zip', ext: '.zip', name: 'file path' }, '\\\\server two\\shared folder\\file path.zip'], - [{ root: '\\\\teela\\admin$\\', dir: '\\\\teela\\admin$\\', base: 'system32', ext: '', name: 'system32' }, '\\\\teela\\admin$\\system32'], - [{ root: '\\\\?\\UNC\\', dir: '\\\\?\\UNC\\server', base: 'share', ext: '', name: 'share' }, '\\\\?\\UNC\\server\\share'] -]; - -var winSpecialCaseFormatTests = [ - [{dir: 'some\\dir'}, 'some\\dir\\'], - [{base: 'index.html'}, 'index.html'], - [{}, ''] -]; - -var unixParseTests = [ - [{ root: '/', dir: '/home/user/dir', base: 'file.txt', ext: '.txt', name: 'file' }, '/home/user/dir/file.txt'], - [{ root: '/', dir: '/home/user/a dir', base: 'another File.zip', ext: '.zip', name: 'another File' }, '/home/user/a dir/another File.zip'], - [{ root: '/', dir: '/home/user/a dir/', base: 'another&File.', ext: '.', name: 'another&File' }, '/home/user/a dir//another&File.'], - [{ root: '/', dir: '/home/user/a$$$dir/', base: 'another File.zip', ext: '.zip', name: 'another File' }, '/home/user/a$$$dir//another File.zip'], - [{ root: '', dir: 'user/dir', base: 'another File.zip', ext: '.zip', name: 'another File' }, 'user/dir/another File.zip'], - [{ root: '', dir: '', base: 'file', ext: '', name: 'file' }, 'file'], - [{ root: '', dir: '', base: '.\\file', ext: '', name: '.\\file' }, '.\\file'], - [{ root: '', dir: '.', base: 'file', ext: '', name: 'file' }, './file'], - [{ root: '', dir: '', base: 'C:\\foo', ext: '', name: 'C:\\foo' }, 'C:\\foo'] -]; - -var unixSpecialCaseFormatTests = [ - [{dir: 'some/dir'}, 'some/dir/'], - [{base: 'index.html'}, 'index.html'], - [{}, ''] -]; - -var errors = [ - {input: null, message: /Parameter 'pathString' must be a string, not/}, - {input: {}, message: /Parameter 'pathString' must be a string, not object/}, - {input: true, message: /Parameter 'pathString' must be a string, not boolean/}, - {input: 1, message: /Parameter 'pathString' must be a string, not number/}, - {input: undefined, message: /Parameter 'pathString' must be a string, not undefined/}, -]; - -checkParseFormat(pathParse.win32, winParseTests); -checkParseFormat(pathParse.posix, unixParseTests); -checkErrors(pathParse.win32); -checkErrors(pathParse.posix); - -function checkErrors(parse) { - errors.forEach(function(errorCase) { - try { - parse(errorCase.input); - } catch(err) { - assert.ok(err instanceof TypeError); - assert.ok( - errorCase.message.test(err.message), - 'expected ' + errorCase.message + ' to match ' + err.message - ); - return; - } - - assert.fail('should have thrown'); - }); -} - -function checkParseFormat(parse, testCases) { - testCases.forEach(function(testCase) { - assert.deepEqual(parse(testCase[1]), testCase[0]); - }); -} diff --git a/node_modules/process-nextick-args/index.js b/node_modules/process-nextick-args/index.js deleted file mode 100644 index 3eecf11..0000000 --- a/node_modules/process-nextick-args/index.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -if (typeof process === 'undefined' || - !process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = { nextTick: nextTick }; -} else { - module.exports = process -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; - } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } -} - diff --git a/node_modules/process-nextick-args/license.md b/node_modules/process-nextick-args/license.md deleted file mode 100644 index c67e353..0000000 --- a/node_modules/process-nextick-args/license.md +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2015 Calvin Metcalf - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE.** diff --git a/node_modules/process-nextick-args/package.json b/node_modules/process-nextick-args/package.json deleted file mode 100644 index bf4194b..0000000 --- a/node_modules/process-nextick-args/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "_from": "process-nextick-args@~2.0.0", - "_id": "process-nextick-args@2.0.1", - "_inBundle": false, - "_integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "_location": "/process-nextick-args", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "process-nextick-args@~2.0.0", - "name": "process-nextick-args", - "escapedName": "process-nextick-args", - "rawSpec": "~2.0.0", - "saveSpec": null, - "fetchSpec": "~2.0.0" - }, - "_requiredBy": [ - "/readable-stream" - ], - "_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "_shasum": "7820d9b16120cc55ca9ae7792680ae7dba6d7fe2", - "_spec": "process-nextick-args@~2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/readable-stream", - "author": "", - "bugs": { - "url": "https://github.com/calvinmetcalf/process-nextick-args/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "process.nextTick but always with args", - "devDependencies": { - "tap": "~0.2.6" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/calvinmetcalf/process-nextick-args", - "license": "MIT", - "main": "index.js", - "name": "process-nextick-args", - "repository": { - "type": "git", - "url": "git+https://github.com/calvinmetcalf/process-nextick-args.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "2.0.1" -} diff --git a/node_modules/process-nextick-args/readme.md b/node_modules/process-nextick-args/readme.md deleted file mode 100644 index ecb432c..0000000 --- a/node_modules/process-nextick-args/readme.md +++ /dev/null @@ -1,18 +0,0 @@ -process-nextick-args -===== - -[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args) - -```bash -npm install --save process-nextick-args -``` - -Always be able to pass arguments to process.nextTick, no matter the platform - -```js -var pna = require('process-nextick-args'); - -pna.nextTick(function (a, b, c) { - console.log(a, b, c); -}, 'step', 3, 'profit'); -``` diff --git a/node_modules/rc/LICENSE.APACHE2 b/node_modules/rc/LICENSE.APACHE2 deleted file mode 100644 index 6366c04..0000000 --- a/node_modules/rc/LICENSE.APACHE2 +++ /dev/null @@ -1,15 +0,0 @@ -Apache License, Version 2.0 - -Copyright (c) 2011 Dominic Tarr - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/node_modules/rc/LICENSE.BSD b/node_modules/rc/LICENSE.BSD deleted file mode 100644 index 96bb796..0000000 --- a/node_modules/rc/LICENSE.BSD +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2013, Dominic Tarr -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. 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. - -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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. - -The views and conclusions contained in the software and documentation are those -of the authors and should not be interpreted as representing official policies, -either expressed or implied, of the FreeBSD Project. diff --git a/node_modules/rc/LICENSE.MIT b/node_modules/rc/LICENSE.MIT deleted file mode 100644 index 6eafbd7..0000000 --- a/node_modules/rc/LICENSE.MIT +++ /dev/null @@ -1,24 +0,0 @@ -The MIT License - -Copyright (c) 2011 Dominic Tarr - -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software and -associated documentation files (the "Software"), to -deal in the Software without restriction, including -without limitation the rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom -the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/rc/README.md b/node_modules/rc/README.md deleted file mode 100644 index e6522e2..0000000 --- a/node_modules/rc/README.md +++ /dev/null @@ -1,227 +0,0 @@ -# rc - -The non-configurable configuration loader for lazy people. - -## Usage - -The only option is to pass rc the name of your app, and your default configuration. - -```javascript -var conf = require('rc')(appname, { - //defaults go here. - port: 2468, - - //defaults which are objects will be merged, not replaced - views: { - engine: 'jade' - } -}); -``` - -`rc` will return your configuration options merged with the defaults you specify. -If you pass in a predefined defaults object, it will be mutated: - -```javascript -var conf = {}; -require('rc')(appname, conf); -``` - -If `rc` finds any config files for your app, the returned config object will have -a `configs` array containing their paths: - -```javascript -var appCfg = require('rc')(appname, conf); -appCfg.configs[0] // /etc/appnamerc -appCfg.configs[1] // /home/dominictarr/.config/appname -appCfg.config // same as appCfg.configs[appCfg.configs.length - 1] -``` - -## Standards - -Given your application name (`appname`), rc will look in all the obvious places for configuration. - - * command line arguments, parsed by minimist _(e.g. `--foo baz`, also nested: `--foo.bar=baz`)_ - * environment variables prefixed with `${appname}_` - * or use "\_\_" to indicate nested properties
_(e.g. `appname_foo__bar__baz` => `foo.bar.baz`)_ - * if you passed an option `--config file` then from that file - * a local `.${appname}rc` or the first found looking in `./ ../ ../../ ../../../` etc. - * `$HOME/.${appname}rc` - * `$HOME/.${appname}/config` - * `$HOME/.config/${appname}` - * `$HOME/.config/${appname}/config` - * `/etc/${appname}rc` - * `/etc/${appname}/config` - * the defaults object you passed in. - -All configuration sources that were found will be flattened into one object, -so that sources **earlier** in this list override later ones. - - -## Configuration File Formats - -Configuration files (e.g. `.appnamerc`) may be in either [json](http://json.org/example) or [ini](http://en.wikipedia.org/wiki/INI_file) format. **No** file extension (`.json` or `.ini`) should be used. The example configurations below are equivalent: - - -#### Formatted as `ini` - -``` -; You can include comments in `ini` format if you want. - -dependsOn=0.10.0 - - -; `rc` has built-in support for ini sections, see? - -[commands] - www = ./commands/www - console = ./commands/repl - - -; You can even do nested sections - -[generators.options] - engine = ejs - -[generators.modules] - new = generate-new - engine = generate-backend - -``` - -#### Formatted as `json` - -```javascript -{ - // You can even comment your JSON, if you want - "dependsOn": "0.10.0", - "commands": { - "www": "./commands/www", - "console": "./commands/repl" - }, - "generators": { - "options": { - "engine": "ejs" - }, - "modules": { - "new": "generate-new", - "backend": "generate-backend" - } - } -} -``` - -Comments are stripped from JSON config via [strip-json-comments](https://github.com/sindresorhus/strip-json-comments). - -> Since ini, and env variables do not have a standard for types, your application needs be prepared for strings. - -To ensure that string representations of booleans and numbers are always converted into their proper types (especially useful if you intend to do strict `===` comparisons), consider using a module such as [parse-strings-in-object](https://github.com/anselanza/parse-strings-in-object) to wrap the config object returned from rc. - - -## Simple example demonstrating precedence -Assume you have an application like this (notice the hard-coded defaults passed to rc): -``` -const conf = require('rc')('myapp', { - port: 12345, - mode: 'test' -}); - -console.log(JSON.stringify(conf, null, 2)); -``` -You also have a file `config.json`, with these contents: -``` -{ - "port": 9000, - "foo": "from config json", - "something": "else" -} -``` -And a file `.myapprc` in the same folder, with these contents: -``` -{ - "port": "3001", - "foo": "bar" -} -``` -Here is the expected output from various commands: - -`node .` -``` -{ - "port": "3001", - "mode": "test", - "foo": "bar", - "_": [], - "configs": [ - "/Users/stephen/repos/conftest/.myapprc" - ], - "config": "/Users/stephen/repos/conftest/.myapprc" -} -``` -*Default `mode` from hard-coded object is retained, but port is overridden by `.myapprc` file (automatically found based on appname match), and `foo` is added.* - - -`node . --foo baz` -``` -{ - "port": "3001", - "mode": "test", - "foo": "baz", - "_": [], - "configs": [ - "/Users/stephen/repos/conftest/.myapprc" - ], - "config": "/Users/stephen/repos/conftest/.myapprc" -} -``` -*Same result as above but `foo` is overridden because command-line arguments take precedence over `.myapprc` file.* - -`node . --foo barbar --config config.json` -``` -{ - "port": 9000, - "mode": "test", - "foo": "barbar", - "something": "else", - "_": [], - "config": "config.json", - "configs": [ - "/Users/stephen/repos/conftest/.myapprc", - "config.json" - ] -} -``` -*Now the `port` comes from the `config.json` file specified (overriding the value from `.myapprc`), and `foo` value is overriden by command-line despite also being specified in the `config.json` file.* - - - -## Advanced Usage - -#### Pass in your own `argv` - -You may pass in your own `argv` as the third argument to `rc`. This is in case you want to [use your own command-line opts parser](https://github.com/dominictarr/rc/pull/12). - -```javascript -require('rc')(appname, defaults, customArgvParser); -``` - -## Pass in your own parser - -If you have a special need to use a non-standard parser, -you can do so by passing in the parser as the 4th argument. -(leave the 3rd as null to get the default args parser) - -```javascript -require('rc')(appname, defaults, null, parser); -``` - -This may also be used to force a more strict format, -such as strict, valid JSON only. - -## Note on Performance - -`rc` is running `fs.statSync`-- so make sure you don't use it in a hot code path (e.g. a request handler) - - -## License - -Multi-licensed under the two-clause BSD License, MIT License, or Apache License, version 2.0 diff --git a/node_modules/rc/browser.js b/node_modules/rc/browser.js deleted file mode 100644 index 8c230c5..0000000 --- a/node_modules/rc/browser.js +++ /dev/null @@ -1,7 +0,0 @@ - -// when this is loaded into the browser, -// just use the defaults... - -module.exports = function (name, defaults) { - return defaults -} diff --git a/node_modules/rc/cli.js b/node_modules/rc/cli.js deleted file mode 100755 index ab05b60..0000000 --- a/node_modules/rc/cli.js +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env node -var rc = require('./index') - -console.log(JSON.stringify(rc(process.argv[2]), false, 2)) diff --git a/node_modules/rc/index.js b/node_modules/rc/index.js deleted file mode 100755 index 65eb47a..0000000 --- a/node_modules/rc/index.js +++ /dev/null @@ -1,53 +0,0 @@ -var cc = require('./lib/utils') -var join = require('path').join -var deepExtend = require('deep-extend') -var etc = '/etc' -var win = process.platform === "win32" -var home = win - ? process.env.USERPROFILE - : process.env.HOME - -module.exports = function (name, defaults, argv, parse) { - if('string' !== typeof name) - throw new Error('rc(name): name *must* be string') - if(!argv) - argv = require('minimist')(process.argv.slice(2)) - defaults = ( - 'string' === typeof defaults - ? cc.json(defaults) : defaults - ) || {} - - parse = parse || cc.parse - - var env = cc.env(name + '_') - - var configs = [defaults] - var configFiles = [] - function addConfigFile (file) { - if (configFiles.indexOf(file) >= 0) return - var fileConfig = cc.file(file) - if (fileConfig) { - configs.push(parse(fileConfig)) - configFiles.push(file) - } - } - - // which files do we look at? - if (!win) - [join(etc, name, 'config'), - join(etc, name + 'rc')].forEach(addConfigFile) - if (home) - [join(home, '.config', name, 'config'), - join(home, '.config', name), - join(home, '.' + name, 'config'), - join(home, '.' + name + 'rc')].forEach(addConfigFile) - addConfigFile(cc.find('.'+name+'rc')) - if (env.config) addConfigFile(env.config) - if (argv.config) addConfigFile(argv.config) - - return deepExtend.apply(null, configs.concat([ - env, - argv, - configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined, - ])) -} diff --git a/node_modules/rc/lib/utils.js b/node_modules/rc/lib/utils.js deleted file mode 100644 index 8b3beff..0000000 --- a/node_modules/rc/lib/utils.js +++ /dev/null @@ -1,104 +0,0 @@ -'use strict'; -var fs = require('fs') -var ini = require('ini') -var path = require('path') -var stripJsonComments = require('strip-json-comments') - -var parse = exports.parse = function (content) { - - //if it ends in .json or starts with { then it must be json. - //must be done this way, because ini accepts everything. - //can't just try and parse it and let it throw if it's not ini. - //everything is ini. even json with a syntax error. - - if(/^\s*{/.test(content)) - return JSON.parse(stripJsonComments(content)) - return ini.parse(content) - -} - -var file = exports.file = function () { - var args = [].slice.call(arguments).filter(function (arg) { return arg != null }) - - //path.join breaks if it's a not a string, so just skip this. - for(var i in args) - if('string' !== typeof args[i]) - return - - var file = path.join.apply(null, args) - var content - try { - return fs.readFileSync(file,'utf-8') - } catch (err) { - return - } -} - -var json = exports.json = function () { - var content = file.apply(null, arguments) - return content ? parse(content) : null -} - -var env = exports.env = function (prefix, env) { - env = env || process.env - var obj = {} - var l = prefix.length - for(var k in env) { - if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) { - - var keypath = k.substring(l).split('__') - - // Trim empty strings from keypath array - var _emptyStringIndex - while ((_emptyStringIndex=keypath.indexOf('')) > -1) { - keypath.splice(_emptyStringIndex, 1) - } - - var cursor = obj - keypath.forEach(function _buildSubObj(_subkey,i){ - - // (check for _subkey first so we ignore empty strings) - // (check for cursor to avoid assignment to primitive objects) - if (!_subkey || typeof cursor !== 'object') - return - - // If this is the last key, just stuff the value in there - // Assigns actual value from env variable to final key - // (unless it's just an empty string- in that case use the last valid key) - if (i === keypath.length-1) - cursor[_subkey] = env[k] - - - // Build sub-object if nothing already exists at the keypath - if (cursor[_subkey] === undefined) - cursor[_subkey] = {} - - // Increment cursor used to track the object at the current depth - cursor = cursor[_subkey] - - }) - - } - - } - - return obj -} - -var find = exports.find = function () { - var rel = path.join.apply(null, [].slice.call(arguments)) - - function find(start, rel) { - var file = path.join(start, rel) - try { - fs.statSync(file) - return file - } catch (err) { - if(path.dirname(start) !== start) // root - return find(path.dirname(start), rel) - } - } - return find(process.cwd(), rel) -} - - diff --git a/node_modules/rc/package.json b/node_modules/rc/package.json deleted file mode 100644 index 6667ad2..0000000 --- a/node_modules/rc/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "_from": "rc@^1.2.7", - "_id": "rc@1.2.8", - "_inBundle": false, - "_integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "_location": "/rc", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "rc@^1.2.7", - "name": "rc", - "escapedName": "rc", - "rawSpec": "^1.2.7", - "saveSpec": null, - "fetchSpec": "^1.2.7" - }, - "_requiredBy": [ - "/node-pre-gyp" - ], - "_resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "_shasum": "cd924bf5200a075b83c188cd6b9e211b7fc0d3ed", - "_spec": "rc@^1.2.7", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/node-pre-gyp", - "author": { - "name": "Dominic Tarr", - "email": "dominic.tarr@gmail.com", - "url": "dominictarr.com" - }, - "bin": { - "rc": "cli.js" - }, - "browser": "browser.js", - "bugs": { - "url": "https://github.com/dominictarr/rc/issues" - }, - "bundleDependencies": false, - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "deprecated": false, - "description": "hardwired configuration loader", - "homepage": "https://github.com/dominictarr/rc#readme", - "keywords": [ - "config", - "rc", - "unix", - "defaults" - ], - "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", - "main": "index.js", - "name": "rc", - "repository": { - "type": "git", - "url": "git+https://github.com/dominictarr/rc.git" - }, - "scripts": { - "test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js" - }, - "version": "1.2.8" -} diff --git a/node_modules/rc/test/ini.js b/node_modules/rc/test/ini.js deleted file mode 100644 index e6857f8..0000000 --- a/node_modules/rc/test/ini.js +++ /dev/null @@ -1,16 +0,0 @@ -var cc =require('../lib/utils') -var INI = require('ini') -var assert = require('assert') - -function test(obj) { - - var _json, _ini - var json = cc.parse (_json = JSON.stringify(obj)) - var ini = cc.parse (_ini = INI.stringify(obj)) - console.log(_ini, _json) - assert.deepEqual(json, ini) -} - - -test({hello: true}) - diff --git a/node_modules/rc/test/nested-env-vars.js b/node_modules/rc/test/nested-env-vars.js deleted file mode 100644 index 0ecd176..0000000 --- a/node_modules/rc/test/nested-env-vars.js +++ /dev/null @@ -1,50 +0,0 @@ - -var seed = Math.random(); -var n = 'rc'+ seed; -var N = 'RC'+ seed; -var assert = require('assert') - - -// Basic usage -process.env[n+'_someOpt__a'] = 42 -process.env[n+'_someOpt__x__'] = 99 -process.env[n+'_someOpt__a__b'] = 186 -process.env[n+'_someOpt__a__b__c'] = 243 -process.env[n+'_someOpt__x__y'] = 1862 -process.env[n+'_someOpt__z'] = 186577 - -// Should ignore empty strings from orphaned '__' -process.env[n+'_someOpt__z__x__'] = 18629 -process.env[n+'_someOpt__w__w__'] = 18629 - -// Leading '__' should ignore everything up to 'z' -process.env[n+'___z__i__'] = 9999 - -// should ignore case for config name section. -process.env[N+'_test_upperCase'] = 187 - -function testPrefix(prefix) { - var config = require('../')(prefix, { - option: true - }) - - console.log('\n\n------ nested-env-vars ------\n',{prefix: prefix}, '\n', config); - - assert.equal(config.option, true) - assert.equal(config.someOpt.a, 42) - assert.equal(config.someOpt.x, 99) - // Should not override `a` once it's been set - assert.equal(config.someOpt.a/*.b*/, 42) - // Should not override `x` once it's been set - assert.equal(config.someOpt.x/*.y*/, 99) - assert.equal(config.someOpt.z, 186577) - // Should not override `z` once it's been set - assert.equal(config.someOpt.z/*.x*/, 186577) - assert.equal(config.someOpt.w.w, 18629) - assert.equal(config.z.i, 9999) - - assert.equal(config.test_upperCase, 187) -} - -testPrefix(n); -testPrefix(N); diff --git a/node_modules/rc/test/test.js b/node_modules/rc/test/test.js deleted file mode 100644 index 4f63351..0000000 --- a/node_modules/rc/test/test.js +++ /dev/null @@ -1,59 +0,0 @@ - -var n = 'rc'+Math.random() -var assert = require('assert') - -process.env[n+'_envOption'] = 42 - -var config = require('../')(n, { - option: true -}) - -console.log(config) - -assert.equal(config.option, true) -assert.equal(config.envOption, 42) - -var customArgv = require('../')(n, { - option: true -}, { // nopt-like argv - option: false, - envOption: 24, - argv: { - remain: [], - cooked: ['--no-option', '--envOption', '24'], - original: ['--no-option', '--envOption=24'] - } -}) - -console.log(customArgv) - -assert.equal(customArgv.option, false) -assert.equal(customArgv.envOption, 24) - -var fs = require('fs') -var path = require('path') -var jsonrc = path.resolve('.' + n + 'rc'); - -fs.writeFileSync(jsonrc, [ - '{', - '// json overrides default', - '"option": false,', - '/* env overrides json */', - '"envOption": 24', - '}' -].join('\n')); - -var commentedJSON = require('../')(n, { - option: true -}) - -fs.unlinkSync(jsonrc); - -console.log(commentedJSON) - -assert.equal(commentedJSON.option, false) -assert.equal(commentedJSON.envOption, 42) - -assert.equal(commentedJSON.config, jsonrc) -assert.equal(commentedJSON.configs.length, 1) -assert.equal(commentedJSON.configs[0], jsonrc) diff --git a/node_modules/readable-stream/.travis.yml b/node_modules/readable-stream/.travis.yml deleted file mode 100644 index f62cdac..0000000 --- a/node_modules/readable-stream/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -sudo: false -language: node_js -before_install: - - (test $NPM_LEGACY && npm install -g npm@2 && npm install -g npm@3) || true -notifications: - email: false -matrix: - fast_finish: true - include: - - node_js: '0.8' - env: NPM_LEGACY=true - - node_js: '0.10' - env: NPM_LEGACY=true - - node_js: '0.11' - env: NPM_LEGACY=true - - node_js: '0.12' - env: NPM_LEGACY=true - - node_js: 1 - env: NPM_LEGACY=true - - node_js: 2 - env: NPM_LEGACY=true - - node_js: 3 - env: NPM_LEGACY=true - - node_js: 4 - - node_js: 5 - - node_js: 6 - - node_js: 7 - - node_js: 8 - - node_js: 9 -script: "npm run test" -env: - global: - - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc= - - secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI= diff --git a/node_modules/readable-stream/CONTRIBUTING.md b/node_modules/readable-stream/CONTRIBUTING.md deleted file mode 100644 index f478d58..0000000 --- a/node_modules/readable-stream/CONTRIBUTING.md +++ /dev/null @@ -1,38 +0,0 @@ -# Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -* (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -* (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -* (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -* (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - -## Moderation Policy - -The [Node.js Moderation Policy] applies to this WG. - -## Code of Conduct - -The [Node.js Code of Conduct][] applies to this WG. - -[Node.js Code of Conduct]: -https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md -[Node.js Moderation Policy]: -https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md diff --git a/node_modules/readable-stream/GOVERNANCE.md b/node_modules/readable-stream/GOVERNANCE.md deleted file mode 100644 index 16ffb93..0000000 --- a/node_modules/readable-stream/GOVERNANCE.md +++ /dev/null @@ -1,136 +0,0 @@ -### Streams Working Group - -The Node.js Streams is jointly governed by a Working Group -(WG) -that is responsible for high-level guidance of the project. - -The WG has final authority over this project including: - -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Conduct guidelines -* Maintaining the list of additional Collaborators - -For the current list of WG members, see the project -[README.md](./README.md#current-project-team-members). - -### Collaborators - -The readable-stream GitHub repository is -maintained by the WG and additional Collaborators who are added by the -WG on an ongoing basis. - -Individuals making significant and valuable contributions are made -Collaborators and given commit-access to the project. These -individuals are identified by the WG and their addition as -Collaborators is discussed during the WG meeting. - -_Note:_ If you make a significant contribution and are not considered -for commit-access log an issue or contact a WG member directly and it -will be brought up in the next WG meeting. - -Modifications of the contents of the readable-stream repository are -made on -a collaborative basis. Anybody with a GitHub account may propose a -modification via pull request and it will be considered by the project -Collaborators. All pull requests must be reviewed and accepted by a -Collaborator with sufficient expertise who is able to take full -responsibility for the change. In the case of pull requests proposed -by an existing Collaborator, an additional Collaborator is required -for sign-off. Consensus should be sought if additional Collaborators -participate and there is disagreement around a particular -modification. See _Consensus Seeking Process_ below for further detail -on the consensus model used for governance. - -Collaborators may opt to elevate significant or controversial -modifications, or modifications that have not found consensus to the -WG for discussion by assigning the ***WG-agenda*** tag to a pull -request or issue. The WG should serve as the final arbiter where -required. - -For the current list of Collaborators, see the project -[README.md](./README.md#members). - -### WG Membership - -WG seats are not time-limited. There is no fixed size of the WG. -However, the expected target is between 6 and 12, to ensure adequate -coverage of important areas of expertise, balanced with the ability to -make decisions efficiently. - -There is no specific set of requirements or qualifications for WG -membership beyond these rules. - -The WG may add additional members to the WG by unanimous consensus. - -A WG member may be removed from the WG by voluntary resignation, or by -unanimous consensus of all other WG members. - -Changes to WG membership should be posted in the agenda, and may be -suggested as any other agenda item (see "WG Meetings" below). - -If an addition or removal is proposed during a meeting, and the full -WG is not in attendance to participate, then the addition or removal -is added to the agenda for the subsequent meeting. This is to ensure -that all members are given the opportunity to participate in all -membership decisions. If a WG member is unable to attend a meeting -where a planned membership decision is being made, then their consent -is assumed. - -No more than 1/3 of the WG members may be affiliated with the same -employer. If removal or resignation of a WG member, or a change of -employment by a WG member, creates a situation where more than 1/3 of -the WG membership shares an employer, then the situation must be -immediately remedied by the resignation or removal of one or more WG -members affiliated with the over-represented employer(s). - -### WG Meetings - -The WG meets occasionally on a Google Hangout On Air. A designated moderator -approved by the WG runs the meeting. Each meeting should be -published to YouTube. - -Items are added to the WG agenda that are considered contentious or -are modifications of governance, contribution policy, WG membership, -or release process. - -The intention of the agenda is not to approve or review all patches; -that should happen continuously on GitHub and be handled by the larger -group of Collaborators. - -Any community member or contributor can ask that something be added to -the next meeting's agenda by logging a GitHub Issue. Any Collaborator, -WG member or the moderator can add the item to the agenda by adding -the ***WG-agenda*** tag to the issue. - -Prior to each WG meeting the moderator will share the Agenda with -members of the WG. WG members can add any items they like to the -agenda at the beginning of each meeting. The moderator and the WG -cannot veto or remove items. - -The WG may invite persons or representatives from certain projects to -participate in a non-voting capacity. - -The moderator is responsible for summarizing the discussion of each -agenda item and sends it as a pull request after the meeting. - -### Consensus Seeking Process - -The WG follows a -[Consensus -Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) -decision-making model. - -When an agenda item has appeared to reach a consensus the moderator -will ask "Does anyone object?" as a final call for dissent from the -consensus. - -If an agenda item cannot reach a consensus a WG member can call for -either a closing vote or a vote to table the issue to the next -meeting. The call for a vote must be seconded by a majority of the WG -or else the discussion will continue. Simple majority wins. - -Note that changes to WG membership require a majority consensus. See -"WG Membership" above. diff --git a/node_modules/readable-stream/LICENSE b/node_modules/readable-stream/LICENSE deleted file mode 100644 index 2873b3b..0000000 --- a/node_modules/readable-stream/LICENSE +++ /dev/null @@ -1,47 +0,0 @@ -Node.js is licensed for use as follows: - -""" -Copyright Node.js contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. -""" - -This license applies to parts of Node.js originating from the -https://github.com/joyent/node repository: - -""" -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. -""" diff --git a/node_modules/readable-stream/README.md b/node_modules/readable-stream/README.md deleted file mode 100644 index 23fe3f3..0000000 --- a/node_modules/readable-stream/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# readable-stream - -***Node-core v8.11.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream) - - -[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) -[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) - - -[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream) - -```bash -npm install --save readable-stream -``` - -***Node-core streams for userland*** - -This package is a mirror of the Streams2 and Streams3 implementations in -Node-core. - -Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/docs/api/stream.html). - -If you want to guarantee a stable streams base, regardless of what version of -Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html). - -As of version 2.0.0 **readable-stream** uses semantic versioning. - -# Streams Working Group - -`readable-stream` is maintained by the Streams Working Group, which -oversees the development and maintenance of the Streams API within -Node.js. The responsibilities of the Streams Working Group include: - -* Addressing stream issues on the Node.js issue tracker. -* Authoring and editing stream documentation within the Node.js project. -* Reviewing changes to stream subclasses within the Node.js project. -* Redirecting changes to streams from the Node.js project to this - project. -* Assisting in the implementation of stream providers within Node.js. -* Recommending versions of `readable-stream` to be included in Node.js. -* Messaging about the future of streams to give the community advance - notice of changes. - - -## Team Members - -* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com> - - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B -* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> - - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 -* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org> - - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D -* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com> -* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> -* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me> -* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com> - - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E -* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com> diff --git a/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md deleted file mode 100644 index 83275f1..0000000 --- a/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +++ /dev/null @@ -1,60 +0,0 @@ -# streams WG Meeting 2015-01-30 - -## Links - -* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg -* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106 -* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/ - -## Agenda - -Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting. - -* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105) -* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101) -* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102) -* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99) - -## Minutes - -### adopt a charter - -* group: +1's all around - -### What versioning scheme should be adopted? -* group: +1’s 3.0.0 -* domenic+group: pulling in patches from other sources where appropriate -* mikeal: version independently, suggesting versions for io.js -* mikeal+domenic: work with TC to notify in advance of changes -simpler stream creation - -### streamline creation of streams -* sam: streamline creation of streams -* domenic: nice simple solution posted - but, we lose the opportunity to change the model - may not be backwards incompatible (double check keys) - - **action item:** domenic will check - -### remove implicit flowing of streams on(‘data’) -* add isFlowing / isPaused -* mikeal: worrying that we’re documenting polyfill methods – confuses users -* domenic: more reflective API is probably good, with warning labels for users -* new section for mad scientists (reflective stream access) -* calvin: name the “third state” -* mikeal: maybe borrow the name from whatwg? -* domenic: we’re missing the “third state” -* consensus: kind of difficult to name the third state -* mikeal: figure out differences in states / compat -* mathias: always flow on data – eliminates third state - * explore what it breaks - -**action items:** -* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream) -* ask rod/build for infrastructure -* **chris**: explore the “flow on data” approach -* add isPaused/isFlowing -* add new docs section -* move isPaused to that section - - diff --git a/node_modules/readable-stream/duplex-browser.js b/node_modules/readable-stream/duplex-browser.js deleted file mode 100644 index f8b2db8..0000000 --- a/node_modules/readable-stream/duplex-browser.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/_stream_duplex.js'); diff --git a/node_modules/readable-stream/duplex.js b/node_modules/readable-stream/duplex.js deleted file mode 100644 index 46924cb..0000000 --- a/node_modules/readable-stream/duplex.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./readable').Duplex diff --git a/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/readable-stream/lib/_stream_duplex.js deleted file mode 100644 index 57003c3..0000000 --- a/node_modules/readable-stream/lib/_stream_duplex.js +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; -}; -/**/ - -module.exports = Duplex; - -/**/ -var util = Object.create(require('core-util-is')); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -{ - // avoid scope creep, the keys array can then be collected - var keys = objectKeys(Writable.prototype); - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } -} - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) this.readable = false; - - if (options && options.writable === false) this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; - - this.once('end', onend); -} - -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._writableState.highWaterMark; - } -}); - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - - // no more data can be written. - // But allow more writes to happen in this tick. - pna.nextTick(onEndNT, this); -} - -function onEndNT(self) { - self.end(); -} - -Object.defineProperty(Duplex.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined || this._writableState === undefined) { - return false; - } - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } -}); - -Duplex.prototype._destroy = function (err, cb) { - this.push(null); - this.end(); - - pna.nextTick(cb, err); -}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/readable-stream/lib/_stream_passthrough.js deleted file mode 100644 index 612edb4..0000000 --- a/node_modules/readable-stream/lib/_stream_passthrough.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -'use strict'; - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -/**/ -var util = Object.create(require('core-util-is')); -util.inherits = require('inherits'); -/**/ - -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/readable-stream/lib/_stream_readable.js deleted file mode 100644 index 0f80764..0000000 --- a/node_modules/readable-stream/lib/_stream_readable.js +++ /dev/null @@ -1,1019 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -module.exports = Readable; - -/**/ -var isArray = require('isarray'); -/**/ - -/**/ -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; - -/**/ -var EE = require('events').EventEmitter; - -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -/**/ - -var Buffer = require('safe-buffer').Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -/**/ -var util = Object.create(require('core-util-is')); -util.inherits = require('inherits'); -/**/ - -/**/ -var debugUtil = require('util'); -var debug = void 0; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - -var BufferList = require('./internal/streams/BufferList'); -var destroyImpl = require('./internal/streams/destroy'); -var StringDecoder; - -util.inherits(Readable, Stream); - -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; - -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); - - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} - -function ReadableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var readableHwm = options.readableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; - - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - - // has it been destroyed - this.destroyed = false; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - if (!(this instanceof Readable)) return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - if (options) { - if (typeof options.read === 'function') this._read = options.read; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } - - Stream.call(this); -} - -Object.defineProperty(Readable.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined) { - return false; - } - return this._readableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - } -}); - -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; -Readable.prototype._destroy = function (err, cb) { - this.push(null); - cb(err); -}; - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; - -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (addToFront) { - if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); - } else if (state.ended) { - stream.emit('error', new Error('stream.push() after EOF')); - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - } - } - - return needMoreData(state); -} - -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - - if (state.needReadable) emitReadable(stream); - } - maybeReadMore(stream, state); -} - -function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); -} - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; - -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} - -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - - if (n !== 0) state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); - } - - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; - } - - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); - } - - if (ret !== null) this.emit('data', ret); - - return ret; -}; - -function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); - } -} - -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - pna.nextTick(maybeReadMore_, stream, state); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - this.emit('error', new Error('_read() is not implemented')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - - cleanedUp = true; - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - increasedAwaitDrain = false; - var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - increasedAwaitDrain = true; - } - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function () { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { hasUnpiped: false }; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - - if (!dest) dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, unpipeInfo); - }return this; - } - - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - - dest.emit('unpipe', this, unpipeInfo); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - if (ev === 'data') { - // Start flowing on next tick if stream isn't explicitly paused - if (this._readableState.flowing !== false) this.resume(); - } else if (ev === 'readable') { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (!state.reading) { - pna.nextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - pna.nextTick(resume_, stream, state); - } -} - -function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } - - state.resumeScheduled = false; - state.awaitDrain = 0; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} - -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while (state.flowing && stream.read() !== null) {} -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var _this = this; - - var state = this._readableState; - var paused = false; - - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - - _this.push(null); - }); - - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - - // proxy certain important events. - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - this._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return this; -}; - -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._readableState.highWaterMark; - } -}); - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); - } - - return ret; -} - -// Extracts only enough buffered data to satisfy the amount requested. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else if (n === list.head.data.length) { - // first chunk is a perfect match - ret = list.shift(); - } else { - // result spans more than one buffer - ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); - } - return ret; -} - -// Copies a specified amount of characters from the list of buffered data -// chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -// Copies a specified amount of bytes from the list of buffered data chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBuffer(n, list) { - var ret = Buffer.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - pna.nextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/readable-stream/lib/_stream_transform.js deleted file mode 100644 index fcfc105..0000000 --- a/node_modules/readable-stream/lib/_stream_transform.js +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -'use strict'; - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = Object.create(require('core-util-is')); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) { - return this.emit('error', new Error('write callback called multiple times')); - } - - ts.writechunk = null; - ts.writecb = null; - - if (data != null) // single equals check for both `null` and `undefined` - this.push(data); - - cb(er); - - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - - Duplex.call(this, options); - - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - - if (typeof options.flush === 'function') this._flush = options.flush; - } - - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); -} - -function prefinish() { - var _this = this; - - if (typeof this._flush === 'function') { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -Transform.prototype._destroy = function (err, cb) { - var _this2 = this; - - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - _this2.emit('close'); - }); -}; - -function done(stream, er, data) { - if (er) return stream.emit('error', er); - - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); - - if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); - - return stream.push(null); -} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/readable-stream/lib/_stream_writable.js deleted file mode 100644 index b0b0220..0000000 --- a/node_modules/readable-stream/lib/_stream_writable.js +++ /dev/null @@ -1,687 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -module.exports = Writable; - -/* */ -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} - -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - this.finish = function () { - onCorkedFinish(_this, state); - }; -} -/* */ - -/**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; -/**/ - -/**/ -var Duplex; -/**/ - -Writable.WritableState = WritableState; - -/**/ -var util = Object.create(require('core-util-is')); -util.inherits = require('inherits'); -/**/ - -/**/ -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -/**/ - -var Buffer = require('safe-buffer').Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -var destroyImpl = require('./internal/streams/destroy'); - -util.inherits(Writable, Stream); - -function nop() {} - -function WritableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var writableHwm = options.writableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; - - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - - // if _final has been called - this.finalCalled = false; - - // drain event flag. - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // has it been destroyed - this.destroyed = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.bufferedRequest = null; - this.lastBufferedRequest = null; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - - // count buffered requests - this.bufferedRequestCount = 0; - - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function () { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } catch (_) {} -})(); - -// Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. -var realHasInstance; -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function (object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - - return object && object._writableState instanceof WritableState; - } - }); -} else { - realHasInstance = function (object) { - return object instanceof this; - }; -} - -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { - return new Writable(options); - } - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - if (options) { - if (typeof options.write === 'function') this._write = options.write; - - if (typeof options.writev === 'function') this._writev = options.writev; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - - if (typeof options.final === 'function') this._final = options.final; - } - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe, not readable')); -}; - -function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - pna.nextTick(cb, er); -} - -// Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. -function validChunk(stream, state, chunk, cb) { - var valid = true; - var er = false; - - if (chunk === null) { - er = new TypeError('May not write null values to stream'); - } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - if (er) { - stream.emit('error', er); - pna.nextTick(cb, er); - valid = false; - } - return valid; -} - -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - - if (typeof cb !== 'function') cb = nop; - - if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - - return ret; -}; - -Writable.prototype.cork = function () { - var state = this._writableState; - - state.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - return chunk; -} - -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._writableState.highWaterMark; - } -}); - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; - - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - pna.nextTick(cb, er); - // this can emit finish, and it will always happen - // after error - pna.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - // this can emit finish, but finish must - // always follow error - finishMaybe(stream, state); - } -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - - if (sync) { - /**/ - asyncWrite(afterWrite, stream, state, finished, cb); - /**/ - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - - var count = 0; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - - // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - break; - } - } - - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new Error('_write() is not implemented')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); -}; - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - if (err) { - stream.emit('error', err); - } - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function') { - state.pendingcb++; - state.finalCalled = true; - pna.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - } - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; -} - -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = corkReq; - } else { - state.corkedRequestsFree = corkReq; - } -} - -Object.defineProperty(Writable.prototype, 'destroyed', { - get: function () { - if (this._writableState === undefined) { - return false; - } - return this._writableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._writableState.destroyed = value; - } -}); - -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; -Writable.prototype._destroy = function (err, cb) { - this.end(); - cb(err); -}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/BufferList.js b/node_modules/readable-stream/lib/internal/streams/BufferList.js deleted file mode 100644 index aefc68b..0000000 --- a/node_modules/readable-stream/lib/internal/streams/BufferList.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict'; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Buffer = require('safe-buffer').Buffer; -var util = require('util'); - -function copyBuffer(src, target, offset) { - src.copy(target, offset); -} - -module.exports = function () { - function BufferList() { - _classCallCheck(this, BufferList); - - this.head = null; - this.tail = null; - this.length = 0; - } - - BufferList.prototype.push = function push(v) { - var entry = { data: v, next: null }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - }; - - BufferList.prototype.unshift = function unshift(v) { - var entry = { data: v, next: this.head }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - }; - - BufferList.prototype.shift = function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - }; - - BufferList.prototype.clear = function clear() { - this.head = this.tail = null; - this.length = 0; - }; - - BufferList.prototype.join = function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) { - ret += s + p.data; - }return ret; - }; - - BufferList.prototype.concat = function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - if (this.length === 1) return this.head.data; - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - }; - - return BufferList; -}(); - -if (util && util.inspect && util.inspect.custom) { - module.exports.prototype[util.inspect.custom] = function () { - var obj = util.inspect({ length: this.length }); - return this.constructor.name + ' ' + obj; - }; -} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/destroy.js b/node_modules/readable-stream/lib/internal/streams/destroy.js deleted file mode 100644 index 5a0a0d8..0000000 --- a/node_modules/readable-stream/lib/internal/streams/destroy.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -// undocumented cb() API, needed for core, not for public API -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { - pna.nextTick(emitErrorNT, this, err); - } - return this; - } - - // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - if (this._readableState) { - this._readableState.destroyed = true; - } - - // if this is a duplex stream mark the writable part as destroyed as well - if (this._writableState) { - this._writableState.destroyed = true; - } - - this._destroy(err || null, function (err) { - if (!cb && err) { - pna.nextTick(emitErrorNT, _this, err); - if (_this._writableState) { - _this._writableState.errorEmitted = true; - } - } else if (cb) { - cb(err); - } - }); - - return this; -} - -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } -} - -function emitErrorNT(self, err) { - self.emit('error', err); -} - -module.exports = { - destroy: destroy, - undestroy: undestroy -}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/node_modules/readable-stream/lib/internal/streams/stream-browser.js deleted file mode 100644 index 9332a3f..0000000 --- a/node_modules/readable-stream/lib/internal/streams/stream-browser.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('events').EventEmitter; diff --git a/node_modules/readable-stream/lib/internal/streams/stream.js b/node_modules/readable-stream/lib/internal/streams/stream.js deleted file mode 100644 index ce2ad5b..0000000 --- a/node_modules/readable-stream/lib/internal/streams/stream.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('stream'); diff --git a/node_modules/readable-stream/package.json b/node_modules/readable-stream/package.json deleted file mode 100644 index d8d7be8..0000000 --- a/node_modules/readable-stream/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "_from": "readable-stream@^2.0.6", - "_id": "readable-stream@2.3.7", - "_inBundle": false, - "_integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "_location": "/readable-stream", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "readable-stream@^2.0.6", - "name": "readable-stream", - "escapedName": "readable-stream", - "rawSpec": "^2.0.6", - "saveSpec": null, - "fetchSpec": "^2.0.6" - }, - "_requiredBy": [ - "/are-we-there-yet" - ], - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "_shasum": "1eca1cf711aef814c04f62252a36a62f6cb23b57", - "_spec": "readable-stream@^2.0.6", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/are-we-there-yet", - "browser": { - "util": false, - "./readable.js": "./readable-browser.js", - "./writable.js": "./writable-browser.js", - "./duplex.js": "./duplex-browser.js", - "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" - }, - "bugs": { - "url": "https://github.com/nodejs/readable-stream/issues" - }, - "bundleDependencies": false, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "deprecated": false, - "description": "Streams3, a user-land copy of the stream library from Node.js", - "devDependencies": { - "assert": "^1.4.0", - "babel-polyfill": "^6.9.1", - "buffer": "^4.9.0", - "lolex": "^2.3.2", - "nyc": "^6.4.0", - "tap": "^0.7.0", - "tape": "^4.8.0" - }, - "homepage": "https://github.com/nodejs/readable-stream#readme", - "keywords": [ - "readable", - "stream", - "pipe" - ], - "license": "MIT", - "main": "readable.js", - "name": "readable-stream", - "nyc": { - "include": [ - "lib/**.js" - ] - }, - "repository": { - "type": "git", - "url": "git://github.com/nodejs/readable-stream.git" - }, - "scripts": { - "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js", - "cover": "nyc npm test", - "report": "nyc report --reporter=lcov", - "test": "tap test/parallel/*.js test/ours/*.js && node test/verify-dependencies.js" - }, - "version": "2.3.7" -} diff --git a/node_modules/readable-stream/passthrough.js b/node_modules/readable-stream/passthrough.js deleted file mode 100644 index ffd791d..0000000 --- a/node_modules/readable-stream/passthrough.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./readable').PassThrough diff --git a/node_modules/readable-stream/readable-browser.js b/node_modules/readable-stream/readable-browser.js deleted file mode 100644 index e503725..0000000 --- a/node_modules/readable-stream/readable-browser.js +++ /dev/null @@ -1,7 +0,0 @@ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); diff --git a/node_modules/readable-stream/readable.js b/node_modules/readable-stream/readable.js deleted file mode 100644 index ec89ec5..0000000 --- a/node_modules/readable-stream/readable.js +++ /dev/null @@ -1,19 +0,0 @@ -var Stream = require('stream'); -if (process.env.READABLE_STREAM === 'disable' && Stream) { - module.exports = Stream; - exports = module.exports = Stream.Readable; - exports.Readable = Stream.Readable; - exports.Writable = Stream.Writable; - exports.Duplex = Stream.Duplex; - exports.Transform = Stream.Transform; - exports.PassThrough = Stream.PassThrough; - exports.Stream = Stream; -} else { - exports = module.exports = require('./lib/_stream_readable.js'); - exports.Stream = Stream || exports; - exports.Readable = exports; - exports.Writable = require('./lib/_stream_writable.js'); - exports.Duplex = require('./lib/_stream_duplex.js'); - exports.Transform = require('./lib/_stream_transform.js'); - exports.PassThrough = require('./lib/_stream_passthrough.js'); -} diff --git a/node_modules/readable-stream/transform.js b/node_modules/readable-stream/transform.js deleted file mode 100644 index b1baba2..0000000 --- a/node_modules/readable-stream/transform.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./readable').Transform diff --git a/node_modules/readable-stream/writable-browser.js b/node_modules/readable-stream/writable-browser.js deleted file mode 100644 index ebdde6a..0000000 --- a/node_modules/readable-stream/writable-browser.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/_stream_writable.js'); diff --git a/node_modules/readable-stream/writable.js b/node_modules/readable-stream/writable.js deleted file mode 100644 index 3211a6f..0000000 --- a/node_modules/readable-stream/writable.js +++ /dev/null @@ -1,8 +0,0 @@ -var Stream = require("stream") -var Writable = require("./lib/_stream_writable.js") - -if (process.env.READABLE_STREAM === 'disable') { - module.exports = Stream && Stream.Writable || Writable -} else { - module.exports = Writable -} diff --git a/node_modules/require-directory/.jshintrc b/node_modules/require-directory/.jshintrc deleted file mode 100644 index e14e4dc..0000000 --- a/node_modules/require-directory/.jshintrc +++ /dev/null @@ -1,67 +0,0 @@ -{ - "maxerr" : 50, - "bitwise" : true, - "camelcase" : true, - "curly" : true, - "eqeqeq" : true, - "forin" : true, - "immed" : true, - "indent" : 2, - "latedef" : true, - "newcap" : true, - "noarg" : true, - "noempty" : true, - "nonew" : true, - "plusplus" : true, - "quotmark" : true, - "undef" : true, - "unused" : true, - "strict" : true, - "trailing" : true, - "maxparams" : false, - "maxdepth" : false, - "maxstatements" : false, - "maxcomplexity" : false, - "maxlen" : false, - "asi" : false, - "boss" : false, - "debug" : false, - "eqnull" : true, - "es5" : false, - "esnext" : false, - "moz" : false, - "evil" : false, - "expr" : true, - "funcscope" : true, - "globalstrict" : true, - "iterator" : true, - "lastsemic" : false, - "laxbreak" : false, - "laxcomma" : false, - "loopfunc" : false, - "multistr" : false, - "proto" : false, - "scripturl" : false, - "smarttabs" : false, - "shadow" : false, - "sub" : false, - "supernew" : false, - "validthis" : false, - "browser" : true, - "couch" : false, - "devel" : true, - "dojo" : false, - "jquery" : false, - "mootools" : false, - "node" : true, - "nonstandard" : false, - "prototypejs" : false, - "rhino" : false, - "worker" : false, - "wsh" : false, - "yui" : false, - "nomen" : true, - "onevar" : true, - "passfail" : false, - "white" : true -} diff --git a/node_modules/require-directory/.npmignore b/node_modules/require-directory/.npmignore deleted file mode 100644 index 47cf365..0000000 --- a/node_modules/require-directory/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test/** diff --git a/node_modules/require-directory/.travis.yml b/node_modules/require-directory/.travis.yml deleted file mode 100644 index 20fd86b..0000000 --- a/node_modules/require-directory/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - 0.10 diff --git a/node_modules/require-directory/LICENSE b/node_modules/require-directory/LICENSE deleted file mode 100644 index a70f253..0000000 --- a/node_modules/require-directory/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2011 Troy Goode - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/require-directory/README.markdown b/node_modules/require-directory/README.markdown deleted file mode 100644 index 926a063..0000000 --- a/node_modules/require-directory/README.markdown +++ /dev/null @@ -1,184 +0,0 @@ -# require-directory - -Recursively iterates over specified directory, `require()`'ing each file, and returning a nested hash structure containing those modules. - -**[Follow me (@troygoode) on Twitter!](https://twitter.com/intent/user?screen_name=troygoode)** - -[![NPM](https://nodei.co/npm/require-directory.png?downloads=true&stars=true)](https://nodei.co/npm/require-directory/) - -[![build status](https://secure.travis-ci.org/troygoode/node-require-directory.png)](http://travis-ci.org/troygoode/node-require-directory) - -## How To Use - -### Installation (via [npm](https://npmjs.org/package/require-directory)) - -```bash -$ npm install require-directory -``` - -### Usage - -A common pattern in node.js is to include an index file which creates a hash of the files in its current directory. Given a directory structure like so: - -* app.js -* routes/ - * index.js - * home.js - * auth/ - * login.js - * logout.js - * register.js - -`routes/index.js` uses `require-directory` to build the hash (rather than doing so manually) like so: - -```javascript -var requireDirectory = require('require-directory'); -module.exports = requireDirectory(module); -``` - -`app.js` references `routes/index.js` like any other module, but it now has a hash/tree of the exports from the `./routes/` directory: - -```javascript -var routes = require('./routes'); - -// snip - -app.get('/', routes.home); -app.get('/register', routes.auth.register); -app.get('/login', routes.auth.login); -app.get('/logout', routes.auth.logout); -``` - -The `routes` variable above is the equivalent of this: - -```javascript -var routes = { - home: require('routes/home.js'), - auth: { - login: require('routes/auth/login.js'), - logout: require('routes/auth/logout.js'), - register: require('routes/auth/register.js') - } -}; -``` - -*Note that `routes.index` will be `undefined` as you would hope.* - -### Specifying Another Directory - -You can specify which directory you want to build a tree of (if it isn't the current directory for whatever reason) by passing it as the second parameter. Not specifying the path (`requireDirectory(module)`) is the equivelant of `requireDirectory(module, __dirname)`: - -```javascript -var requireDirectory = require('require-directory'); -module.exports = requireDirectory(module, './some/subdirectory'); -``` - -For example, in the [example in the Usage section](#usage) we could have avoided creating `routes/index.js` and instead changed the first lines of `app.js` to: - -```javascript -var requireDirectory = require('require-directory'); -var routes = requireDirectory(module, './routes'); -``` - -## Options - -You can pass an options hash to `require-directory` as the 2nd parameter (or 3rd if you're passing the path to another directory as the 2nd parameter already). Here are the available options: - -### Whitelisting - -Whitelisting (either via RegExp or function) allows you to specify that only certain files be loaded. - -```javascript -var requireDirectory = require('require-directory'), - whitelist = /onlyinclude.js$/, - hash = requireDirectory(module, {include: whitelist}); -``` - -```javascript -var requireDirectory = require('require-directory'), - check = function(path){ - if(/onlyinclude.js$/.test(path)){ - return true; // don't include - }else{ - return false; // go ahead and include - } - }, - hash = requireDirectory(module, {include: check}); -``` - -### Blacklisting - -Blacklisting (either via RegExp or function) allows you to specify that all but certain files should be loaded. - -```javascript -var requireDirectory = require('require-directory'), - blacklist = /dontinclude\.js$/, - hash = requireDirectory(module, {exclude: blacklist}); -``` - -```javascript -var requireDirectory = require('require-directory'), - check = function(path){ - if(/dontinclude\.js$/.test(path)){ - return false; // don't include - }else{ - return true; // go ahead and include - } - }, - hash = requireDirectory(module, {exclude: check}); -``` - -### Visiting Objects As They're Loaded - -`require-directory` takes a function as the `visit` option that will be called for each module that is added to module.exports. - -```javascript -var requireDirectory = require('require-directory'), - visitor = function(obj) { - console.log(obj); // will be called for every module that is loaded - }, - hash = requireDirectory(module, {visit: visitor}); -``` - -The visitor can also transform the objects by returning a value: - -```javascript -var requireDirectory = require('require-directory'), - visitor = function(obj) { - return obj(new Date()); - }, - hash = requireDirectory(module, {visit: visitor}); -``` - -### Renaming Keys - -```javascript -var requireDirectory = require('require-directory'), - renamer = function(name) { - return name.toUpperCase(); - }, - hash = requireDirectory(module, {rename: renamer}); -``` - -### No Recursion - -```javascript -var requireDirectory = require('require-directory'), - hash = requireDirectory(module, {recurse: false}); -``` - -## Run Unit Tests - -```bash -$ npm run lint -$ npm test -``` - -## License - -[MIT License](http://www.opensource.org/licenses/mit-license.php) - -## Author - -[Troy Goode](https://github.com/TroyGoode) ([troygoode@gmail.com](mailto:troygoode@gmail.com)) - diff --git a/node_modules/require-directory/index.js b/node_modules/require-directory/index.js deleted file mode 100644 index cd37da7..0000000 --- a/node_modules/require-directory/index.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict'; - -var fs = require('fs'), - join = require('path').join, - resolve = require('path').resolve, - dirname = require('path').dirname, - defaultOptions = { - extensions: ['js', 'json', 'coffee'], - recurse: true, - rename: function (name) { - return name; - }, - visit: function (obj) { - return obj; - } - }; - -function checkFileInclusion(path, filename, options) { - return ( - // verify file has valid extension - (new RegExp('\\.(' + options.extensions.join('|') + ')$', 'i').test(filename)) && - - // if options.include is a RegExp, evaluate it and make sure the path passes - !(options.include && options.include instanceof RegExp && !options.include.test(path)) && - - // if options.include is a function, evaluate it and make sure the path passes - !(options.include && typeof options.include === 'function' && !options.include(path, filename)) && - - // if options.exclude is a RegExp, evaluate it and make sure the path doesn't pass - !(options.exclude && options.exclude instanceof RegExp && options.exclude.test(path)) && - - // if options.exclude is a function, evaluate it and make sure the path doesn't pass - !(options.exclude && typeof options.exclude === 'function' && options.exclude(path, filename)) - ); -} - -function requireDirectory(m, path, options) { - var retval = {}; - - // path is optional - if (path && !options && typeof path !== 'string') { - options = path; - path = null; - } - - // default options - options = options || {}; - for (var prop in defaultOptions) { - if (typeof options[prop] === 'undefined') { - options[prop] = defaultOptions[prop]; - } - } - - // if no path was passed in, assume the equivelant of __dirname from caller - // otherwise, resolve path relative to the equivalent of __dirname - path = !path ? dirname(m.filename) : resolve(dirname(m.filename), path); - - // get the path of each file in specified directory, append to current tree node, recurse - fs.readdirSync(path).forEach(function (filename) { - var joined = join(path, filename), - files, - key, - obj; - - if (fs.statSync(joined).isDirectory() && options.recurse) { - // this node is a directory; recurse - files = requireDirectory(m, joined, options); - // exclude empty directories - if (Object.keys(files).length) { - retval[options.rename(filename, joined, filename)] = files; - } - } else { - if (joined !== m.filename && checkFileInclusion(joined, filename, options)) { - // hash node key shouldn't include file extension - key = filename.substring(0, filename.lastIndexOf('.')); - obj = m.require(joined); - retval[options.rename(key, joined, filename)] = options.visit(obj, joined, filename) || obj; - } - } - }); - - return retval; -} - -module.exports = requireDirectory; -module.exports.defaults = defaultOptions; diff --git a/node_modules/require-directory/package.json b/node_modules/require-directory/package.json deleted file mode 100644 index bbf1f1b..0000000 --- a/node_modules/require-directory/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_from": "require-directory@^2.1.1", - "_id": "require-directory@2.1.1", - "_inBundle": false, - "_integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "_location": "/require-directory", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "require-directory@^2.1.1", - "name": "require-directory", - "escapedName": "require-directory", - "rawSpec": "^2.1.1", - "saveSpec": null, - "fetchSpec": "^2.1.1" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "_shasum": "8c64ad5fd30dab1c976e2344ffe7f792a6a6df42", - "_spec": "require-directory@^2.1.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "Troy Goode", - "email": "troygoode@gmail.com", - "url": "http://github.com/troygoode/" - }, - "bugs": { - "url": "http://github.com/troygoode/node-require-directory/issues/" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Troy Goode", - "email": "troygoode@gmail.com", - "url": "http://github.com/troygoode/" - } - ], - "deprecated": false, - "description": "Recursively iterates over specified directory, require()'ing each file, and returning a nested hash structure containing those modules.", - "devDependencies": { - "jshint": "^2.6.0", - "mocha": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "homepage": "https://github.com/troygoode/node-require-directory/", - "keywords": [ - "require", - "directory", - "library", - "recursive" - ], - "license": "MIT", - "main": "index.js", - "name": "require-directory", - "repository": { - "type": "git", - "url": "git://github.com/troygoode/node-require-directory.git" - }, - "scripts": { - "lint": "jshint index.js test/test.js", - "test": "mocha" - }, - "version": "2.1.1" -} diff --git a/node_modules/require-main-filename/CHANGELOG.md b/node_modules/require-main-filename/CHANGELOG.md deleted file mode 100644 index 717d59e..0000000 --- a/node_modules/require-main-filename/CHANGELOG.md +++ /dev/null @@ -1,26 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - - -# [2.0.0](https://github.com/yargs/require-main-filename/compare/v1.0.2...v2.0.0) (2019-01-28) - - -### Chores - -* drop support for Node 0.10 ([#11](https://github.com/yargs/require-main-filename/issues/11)) ([87f4e13](https://github.com/yargs/require-main-filename/commit/87f4e13)) - - -### BREAKING CHANGES - -* drop support for Node 0.10/0.12 - - - - -## [1.0.2](https://github.com/yargs/require-main-filename/compare/v1.0.1...v1.0.2) (2017-06-16) - - -### Bug Fixes - -* add files to package.json ([#4](https://github.com/yargs/require-main-filename/issues/4)) ([fa29988](https://github.com/yargs/require-main-filename/commit/fa29988)) diff --git a/node_modules/require-main-filename/LICENSE.txt b/node_modules/require-main-filename/LICENSE.txt deleted file mode 100644 index 836440b..0000000 --- a/node_modules/require-main-filename/LICENSE.txt +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2016, Contributors - -Permission to use, copy, modify, and/or distribute this software -for any purpose with or without fee is hereby granted, provided -that the above copyright notice and this permission notice -appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE -LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/require-main-filename/README.md b/node_modules/require-main-filename/README.md deleted file mode 100644 index 820d9f5..0000000 --- a/node_modules/require-main-filename/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# require-main-filename - -[![Build Status](https://travis-ci.org/yargs/require-main-filename.png)](https://travis-ci.org/yargs/require-main-filename) -[![Coverage Status](https://coveralls.io/repos/yargs/require-main-filename/badge.svg?branch=master)](https://coveralls.io/r/yargs/require-main-filename?branch=master) -[![NPM version](https://img.shields.io/npm/v/require-main-filename.svg)](https://www.npmjs.com/package/require-main-filename) - -`require.main.filename` is great for figuring out the entry -point for the current application. This can be combined with a module like -[pkg-conf](https://www.npmjs.com/package/pkg-conf) to, _as if by magic_, load -top-level configuration. - -Unfortunately, `require.main.filename` sometimes fails when an application is -executed with an alternative process manager, e.g., [iisnode](https://github.com/tjanczuk/iisnode). - -`require-main-filename` is a shim that addresses this problem. - -## Usage - -```js -var main = require('require-main-filename')() -// use main as an alternative to require.main.filename. -``` - -## License - -ISC diff --git a/node_modules/require-main-filename/index.js b/node_modules/require-main-filename/index.js deleted file mode 100644 index dca7f0c..0000000 --- a/node_modules/require-main-filename/index.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = function (_require) { - _require = _require || require - var main = _require.main - if (main && isIISNode(main)) return handleIISNode(main) - else return main ? main.filename : process.cwd() -} - -function isIISNode (main) { - return /\\iisnode\\/.test(main.filename) -} - -function handleIISNode (main) { - if (!main.children.length) { - return main.filename - } else { - return main.children[0].filename - } -} diff --git a/node_modules/require-main-filename/package.json b/node_modules/require-main-filename/package.json deleted file mode 100644 index 7a647f3..0000000 --- a/node_modules/require-main-filename/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "_from": "require-main-filename@^2.0.0", - "_id": "require-main-filename@2.0.0", - "_inBundle": false, - "_integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "_location": "/require-main-filename", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "require-main-filename@^2.0.0", - "name": "require-main-filename", - "escapedName": "require-main-filename", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "_shasum": "d0b329ecc7cc0f61649f62215be69af54aa8989b", - "_spec": "require-main-filename@^2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "Ben Coe", - "email": "ben@npmjs.com" - }, - "bugs": { - "url": "https://github.com/yargs/require-main-filename/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "shim for require.main.filename() that works in as many environments as possible", - "devDependencies": { - "chai": "^4.0.0", - "standard": "^10.0.3", - "standard-version": "^4.0.0", - "tap": "^11.0.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/yargs/require-main-filename#readme", - "keywords": [ - "require", - "shim", - "iisnode" - ], - "license": "ISC", - "main": "index.js", - "name": "require-main-filename", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/yargs/require-main-filename.git" - }, - "scripts": { - "pretest": "standard", - "release": "standard-version", - "test": "tap --coverage test.js" - }, - "version": "2.0.0" -} diff --git a/node_modules/resolve/.editorconfig b/node_modules/resolve/.editorconfig deleted file mode 100644 index bc228f8..0000000 --- a/node_modules/resolve/.editorconfig +++ /dev/null @@ -1,20 +0,0 @@ -root = true - -[*] -indent_style = tab -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -max_line_length = 150 - -[CHANGELOG.md] -indent_style = space -indent_size = 2 - -[*.json] -max_line_length = off - -[Makefile] -max_line_length = off diff --git a/node_modules/resolve/.eslintignore b/node_modules/resolve/.eslintignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/resolve/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/resolve/.eslintrc b/node_modules/resolve/.eslintrc deleted file mode 100644 index a22863c..0000000 --- a/node_modules/resolve/.eslintrc +++ /dev/null @@ -1,39 +0,0 @@ -{ - "extends": "@ljharb", - "root": true, - "rules": { - "array-bracket-newline": 0, - "array-element-newline": 0, - "indent": [2, 4], - "strict": 0, - "complexity": 0, - "consistent-return": 0, - "curly": 0, - "dot-notation": [2, { "allowKeywords": true }], - "func-name-matching": 0, - "func-style": 0, - "global-require": 0, - "id-length": [2, { "min": 1, "max": 30 }], - "max-lines-per-function": 0, - "max-nested-callbacks": 0, - "max-params": 0, - "max-statements-per-line": [2, { "max": 2 }], - "max-statements": 0, - "no-magic-numbers": 0, - "no-console": 0, - "no-shadow": 0, - "no-unused-vars": [2, { "vars": "all", "args": "none" }], - "no-use-before-define": 0, - "object-curly-newline": 0, - "operator-linebreak": [2, "before"], - "sort-keys": 0, - }, - "overrides": [ - { - "files": "test/resolver/nested_symlinks/mylib/*.js", - "rules": { - "no-throw-literal": 0, - }, - }, - ], -} diff --git a/node_modules/resolve/.travis.yml b/node_modules/resolve/.travis.yml deleted file mode 100644 index 5ed0fa5..0000000 --- a/node_modules/resolve/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: ~> 1.0 -language: node_js -os: - - linux -import: - - ljharb/travis-ci:node/all.yml - - ljharb/travis-ci:node/pretest.yml - - ljharb/travis-ci:node/posttest.yml diff --git a/node_modules/resolve/LICENSE b/node_modules/resolve/LICENSE deleted file mode 100644 index ff4fce2..0000000 --- a/node_modules/resolve/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2012 James Halliday - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/resolve/appveyor.yml b/node_modules/resolve/appveyor.yml deleted file mode 100644 index 9458fb8..0000000 --- a/node_modules/resolve/appveyor.yml +++ /dev/null @@ -1,54 +0,0 @@ -version: 1.0.{build} -skip_branch_with_pr: true -build: off - -environment: - matrix: - - nodejs_version: "12" - - nodejs_version: "11" - - nodejs_version: "10" - - nodejs_version: "9" - - nodejs_version: "8" - - nodejs_version: "7" - - nodejs_version: "6" - - nodejs_version: "5" - - nodejs_version: "4" - - nodejs_version: "3" - - nodejs_version: "2" - - nodejs_version: "1" - - nodejs_version: "0.12" - - nodejs_version: "0.10" - - nodejs_version: "0.8" - - nodejs_version: "0.6" -matrix: - # fast_finish: true - allow_failures: - - nodejs_version: "5" # due to windows npm bug, registry-side - - nodejs_version: "0.8" - - nodejs_version: "0.6" - -platform: - - x86 - - x64 - -# Install scripts. (runs after repo cloning) -install: - # Fix symlinks in working copy (see https://github.com/appveyor/ci/issues/650#issuecomment-186592582) / https://github.com/charleskorn/batect/commit/d08986802ec43086902958c4ee7e57ff3e71dbef - - git config core.symlinks true - - git reset --hard - # Get the latest stable version of Node.js or io.js - - ps: Install-Product node $env:nodejs_version $env:platform - - IF %nodejs_version% EQU 0.6 npm config set strict-ssl false && npm -g install npm@1.3 - - IF %nodejs_version% EQU 0.8 npm config set strict-ssl false && npm -g install npm@1.4.28 && npm install -g npm@4.5 - - set PATH=%APPDATA%\npm;%PATH% - #- IF %nodejs_version% NEQ 0.6 AND %nodejs_version% NEQ 0.8 npm -g install npm - # install modules - - npm install - -# Post-install test scripts. -test_script: - # Output useful info for debugging. - - node --version - - npm --version - # run tests - - npm run tests-only diff --git a/node_modules/resolve/example/async.js b/node_modules/resolve/example/async.js deleted file mode 100644 index 20e65dc..0000000 --- a/node_modules/resolve/example/async.js +++ /dev/null @@ -1,5 +0,0 @@ -var resolve = require('../'); -resolve('tap', { basedir: __dirname }, function (err, res) { - if (err) console.error(err); - else console.log(res); -}); diff --git a/node_modules/resolve/example/sync.js b/node_modules/resolve/example/sync.js deleted file mode 100644 index 54b2cc1..0000000 --- a/node_modules/resolve/example/sync.js +++ /dev/null @@ -1,3 +0,0 @@ -var resolve = require('../'); -var res = resolve.sync('tap', { basedir: __dirname }); -console.log(res); diff --git a/node_modules/resolve/index.js b/node_modules/resolve/index.js deleted file mode 100644 index 125d814..0000000 --- a/node_modules/resolve/index.js +++ /dev/null @@ -1,6 +0,0 @@ -var async = require('./lib/async'); -async.core = require('./lib/core'); -async.isCore = require('./lib/is-core'); -async.sync = require('./lib/sync'); - -module.exports = async; diff --git a/node_modules/resolve/lib/async.js b/node_modules/resolve/lib/async.js deleted file mode 100644 index 06aa458..0000000 --- a/node_modules/resolve/lib/async.js +++ /dev/null @@ -1,298 +0,0 @@ -var fs = require('fs'); -var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); -var normalizeOptions = require('./normalize-options.js'); -var isCore = require('./is-core'); - -var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; - -var defaultIsFile = function isFile(file, cb) { - fs.stat(file, function (err, stat) { - if (!err) { - return cb(null, stat.isFile() || stat.isFIFO()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); -}; - -var defaultIsDir = function isDirectory(dir, cb) { - fs.stat(dir, function (err, stat) { - if (!err) { - return cb(null, stat.isDirectory()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); -}; - -var defaultRealpath = function realpath(x, cb) { - realpathFS(x, function (realpathErr, realPath) { - if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); - else cb(null, realpathErr ? x : realPath); - }); -}; - -var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { - if (opts && opts.preserveSymlinks === false) { - realpath(x, cb); - } else { - cb(null, x); - } -}; - -var getPackageCandidates = function getPackageCandidates(x, start, opts) { - var dirs = nodeModulesPaths(start, opts, x); - for (var i = 0; i < dirs.length; i++) { - dirs[i] = path.join(dirs[i], x); - } - return dirs; -}; - -module.exports = function resolve(x, options, callback) { - var cb = callback; - var opts = options; - if (typeof options === 'function') { - cb = opts; - opts = {}; - } - if (typeof x !== 'string') { - var err = new TypeError('Path must be a string.'); - return process.nextTick(function () { - cb(err); - }); - } - - opts = normalizeOptions(x, opts); - - var isFile = opts.isFile || defaultIsFile; - var isDirectory = opts.isDirectory || defaultIsDir; - var readFile = opts.readFile || fs.readFile; - var realpath = opts.realpath || defaultRealpath; - var packageIterator = opts.packageIterator; - - var extensions = opts.extensions || ['.js']; - var basedir = opts.basedir || path.dirname(caller()); - var parent = opts.filename || basedir; - - opts.paths = opts.paths || []; - - // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory - var absoluteStart = path.resolve(basedir); - - maybeRealpath( - realpath, - absoluteStart, - opts, - function (err, realStart) { - if (err) cb(err); - else init(realStart); - } - ); - - var res; - function init(basedir) { - if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { - res = path.resolve(basedir, x); - if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; - if ((/\/$/).test(x) && res === basedir) { - loadAsDirectory(res, opts.package, onfile); - } else loadAsFile(res, opts.package, onfile); - } else if (isCore(x)) { - return cb(null, x); - } else loadNodeModules(x, basedir, function (err, n, pkg) { - if (err) cb(err); - else if (n) { - return maybeRealpath(realpath, n, opts, function (err, realN) { - if (err) { - cb(err); - } else { - cb(null, realN, pkg); - } - }); - } else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - moduleError.code = 'MODULE_NOT_FOUND'; - cb(moduleError); - } - }); - } - - function onfile(err, m, pkg) { - if (err) cb(err); - else if (m) cb(null, m, pkg); - else loadAsDirectory(res, function (err, d, pkg) { - if (err) cb(err); - else if (d) { - maybeRealpath(realpath, d, opts, function (err, realD) { - if (err) { - cb(err); - } else { - cb(null, realD, pkg); - } - }); - } else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - moduleError.code = 'MODULE_NOT_FOUND'; - cb(moduleError); - } - }); - } - - function loadAsFile(x, thePackage, callback) { - var loadAsFilePackage = thePackage; - var cb = callback; - if (typeof loadAsFilePackage === 'function') { - cb = loadAsFilePackage; - loadAsFilePackage = undefined; - } - - var exts = [''].concat(extensions); - load(exts, x, loadAsFilePackage); - - function load(exts, x, loadPackage) { - if (exts.length === 0) return cb(null, undefined, loadPackage); - var file = x + exts[0]; - - var pkg = loadPackage; - if (pkg) onpkg(null, pkg); - else loadpkg(path.dirname(file), onpkg); - - function onpkg(err, pkg_, dir) { - pkg = pkg_; - if (err) return cb(err); - if (dir && pkg && opts.pathFilter) { - var rfile = path.relative(dir, file); - var rel = rfile.slice(0, rfile.length - exts[0].length); - var r = opts.pathFilter(pkg, x, rel); - if (r) return load( - [''].concat(extensions.slice()), - path.resolve(dir, r), - pkg - ); - } - isFile(file, onex); - } - function onex(err, ex) { - if (err) return cb(err); - if (ex) return cb(null, file, pkg); - load(exts.slice(1), x, pkg); - } - } - } - - function loadpkg(dir, cb) { - if (dir === '' || dir === '/') return cb(null); - if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { - return cb(null); - } - if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); - - maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { - if (unwrapErr) return loadpkg(path.dirname(dir), cb); - var pkgfile = path.join(pkgdir, 'package.json'); - isFile(pkgfile, function (err, ex) { - // on err, ex is false - if (!ex) return loadpkg(path.dirname(dir), cb); - - readFile(pkgfile, function (err, body) { - if (err) cb(err); - try { var pkg = JSON.parse(body); } catch (jsonErr) {} - - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } - cb(null, pkg, dir); - }); - }); - }); - } - - function loadAsDirectory(x, loadAsDirectoryPackage, callback) { - var cb = callback; - var fpkg = loadAsDirectoryPackage; - if (typeof fpkg === 'function') { - cb = fpkg; - fpkg = opts.package; - } - - maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { - if (unwrapErr) return cb(unwrapErr); - var pkgfile = path.join(pkgdir, 'package.json'); - isFile(pkgfile, function (err, ex) { - if (err) return cb(err); - if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); - - readFile(pkgfile, function (err, body) { - if (err) return cb(err); - try { - var pkg = JSON.parse(body); - } catch (jsonErr) {} - - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } - - if (pkg && pkg.main) { - if (typeof pkg.main !== 'string') { - var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); - mainError.code = 'INVALID_PACKAGE_MAIN'; - return cb(mainError); - } - if (pkg.main === '.' || pkg.main === './') { - pkg.main = 'index'; - } - loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); - - var dir = path.resolve(x, pkg.main); - loadAsDirectory(dir, pkg, function (err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - loadAsFile(path.join(x, 'index'), pkg, cb); - }); - }); - return; - } - - loadAsFile(path.join(x, '/index'), pkg, cb); - }); - }); - }); - } - - function processDirs(cb, dirs) { - if (dirs.length === 0) return cb(null, undefined); - var dir = dirs[0]; - - isDirectory(path.dirname(dir), isdir); - - function isdir(err, isdir) { - if (err) return cb(err); - if (!isdir) return processDirs(cb, dirs.slice(1)); - loadAsFile(dir, opts.package, onfile); - } - - function onfile(err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - loadAsDirectory(dir, opts.package, ondir); - } - - function ondir(err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - processDirs(cb, dirs.slice(1)); - } - } - function loadNodeModules(x, start, cb) { - var thunk = function () { return getPackageCandidates(x, start, opts); }; - processDirs( - cb, - packageIterator ? packageIterator(x, start, thunk, opts) : thunk() - ); - } -}; diff --git a/node_modules/resolve/lib/caller.js b/node_modules/resolve/lib/caller.js deleted file mode 100644 index b14a280..0000000 --- a/node_modules/resolve/lib/caller.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = function () { - // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - var origPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = function (_, stack) { return stack; }; - var stack = (new Error()).stack; - Error.prepareStackTrace = origPrepareStackTrace; - return stack[2].getFileName(); -}; diff --git a/node_modules/resolve/lib/core.js b/node_modules/resolve/lib/core.js deleted file mode 100644 index 0877650..0000000 --- a/node_modules/resolve/lib/core.js +++ /dev/null @@ -1,53 +0,0 @@ -var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; - -function specifierIncluded(specifier) { - var parts = specifier.split(' '); - var op = parts.length > 1 ? parts[0] : '='; - var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); - - for (var i = 0; i < 3; ++i) { - var cur = Number(current[i] || 0); - var ver = Number(versionParts[i] || 0); - if (cur === ver) { - continue; // eslint-disable-line no-restricted-syntax, no-continue - } - if (op === '<') { - return cur < ver; - } else if (op === '>=') { - return cur >= ver; - } else { - return false; - } - } - return op === '>='; -} - -function matchesRange(range) { - var specifiers = range.split(/ ?&& ?/); - if (specifiers.length === 0) { return false; } - for (var i = 0; i < specifiers.length; ++i) { - if (!specifierIncluded(specifiers[i])) { return false; } - } - return true; -} - -function versionIncluded(specifierValue) { - if (typeof specifierValue === 'boolean') { return specifierValue; } - if (specifierValue && typeof specifierValue === 'object') { - for (var i = 0; i < specifierValue.length; ++i) { - if (matchesRange(specifierValue[i])) { return true; } - } - return false; - } - return matchesRange(specifierValue); -} - -var data = require('./core.json'); - -var core = {}; -for (var mod in data) { // eslint-disable-line no-restricted-syntax - if (Object.prototype.hasOwnProperty.call(data, mod)) { - core[mod] = versionIncluded(data[mod]); - } -} -module.exports = core; diff --git a/node_modules/resolve/lib/core.json b/node_modules/resolve/lib/core.json deleted file mode 100644 index d51b70b..0000000 --- a/node_modules/resolve/lib/core.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "assert": true, - "async_hooks": ">= 8", - "buffer_ieee754": "< 0.9.7", - "buffer": true, - "child_process": true, - "cluster": true, - "console": true, - "constants": true, - "crypto": true, - "_debug_agent": ">= 1 && < 8", - "_debugger": "< 8", - "dgram": true, - "dns": true, - "domain": true, - "events": true, - "freelist": "< 6", - "fs": true, - "fs/promises": [">= 10 && < 10.1", ">= 14"], - "_http_agent": ">= 0.11.1", - "_http_client": ">= 0.11.1", - "_http_common": ">= 0.11.1", - "_http_incoming": ">= 0.11.1", - "_http_outgoing": ">= 0.11.1", - "_http_server": ">= 0.11.1", - "http": true, - "http2": ">= 8.8", - "https": true, - "inspector": ">= 8.0.0", - "_linklist": "< 8", - "module": true, - "net": true, - "node-inspect/lib/_inspect": ">= 7.6.0 && < 12", - "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12", - "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12", - "os": true, - "path": true, - "perf_hooks": ">= 8.5", - "process": ">= 1", - "punycode": true, - "querystring": true, - "readline": true, - "repl": true, - "smalloc": ">= 0.11.5 && < 3", - "_stream_duplex": ">= 0.9.4", - "_stream_transform": ">= 0.9.4", - "_stream_wrap": ">= 1.4.1", - "_stream_passthrough": ">= 0.9.4", - "_stream_readable": ">= 0.9.4", - "_stream_writable": ">= 0.9.4", - "stream": true, - "string_decoder": true, - "sys": true, - "timers": true, - "_tls_common": ">= 0.11.13", - "_tls_legacy": ">= 0.11.3 && < 10", - "_tls_wrap": ">= 0.11.3", - "tls": true, - "trace_events": ">= 10", - "tty": true, - "url": true, - "util": true, - "v8/tools/arguments": ">= 10 && < 12", - "v8/tools/codemap": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/consarray": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/csvparser": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/logreader": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/profile_view": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8": ">= 1", - "vm": true, - "wasi": ">= 13.4 && < 13.5", - "worker_threads": ">= 11.7", - "zlib": true -} diff --git a/node_modules/resolve/lib/is-core.js b/node_modules/resolve/lib/is-core.js deleted file mode 100644 index 48bc96c..0000000 --- a/node_modules/resolve/lib/is-core.js +++ /dev/null @@ -1,5 +0,0 @@ -var core = require('./core'); - -module.exports = function isCore(x) { - return Object.prototype.hasOwnProperty.call(core, x); -}; diff --git a/node_modules/resolve/lib/node-modules-paths.js b/node_modules/resolve/lib/node-modules-paths.js deleted file mode 100644 index 2b43813..0000000 --- a/node_modules/resolve/lib/node-modules-paths.js +++ /dev/null @@ -1,42 +0,0 @@ -var path = require('path'); -var parse = path.parse || require('path-parse'); - -var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { - var prefix = '/'; - if ((/^([A-Za-z]:)/).test(absoluteStart)) { - prefix = ''; - } else if ((/^\\\\/).test(absoluteStart)) { - prefix = '\\\\'; - } - - var paths = [absoluteStart]; - var parsed = parse(absoluteStart); - while (parsed.dir !== paths[paths.length - 1]) { - paths.push(parsed.dir); - parsed = parse(parsed.dir); - } - - return paths.reduce(function (dirs, aPath) { - return dirs.concat(modules.map(function (moduleDir) { - return path.resolve(prefix, aPath, moduleDir); - })); - }, []); -}; - -module.exports = function nodeModulesPaths(start, opts, request) { - var modules = opts && opts.moduleDirectory - ? [].concat(opts.moduleDirectory) - : ['node_modules']; - - if (opts && typeof opts.paths === 'function') { - return opts.paths( - request, - start, - function () { return getNodeModulesDirs(start, modules); }, - opts - ); - } - - var dirs = getNodeModulesDirs(start, modules); - return opts && opts.paths ? dirs.concat(opts.paths) : dirs; -}; diff --git a/node_modules/resolve/lib/normalize-options.js b/node_modules/resolve/lib/normalize-options.js deleted file mode 100644 index 4b56904..0000000 --- a/node_modules/resolve/lib/normalize-options.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = function (x, opts) { - /** - * This file is purposefully a passthrough. It's expected that third-party - * environments will override it at runtime in order to inject special logic - * into `resolve` (by manipulating the options). One such example is the PnP - * code path in Yarn. - */ - - return opts || {}; -}; diff --git a/node_modules/resolve/lib/sync.js b/node_modules/resolve/lib/sync.js deleted file mode 100644 index da74e19..0000000 --- a/node_modules/resolve/lib/sync.js +++ /dev/null @@ -1,191 +0,0 @@ -var isCore = require('./is-core'); -var fs = require('fs'); -var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); -var normalizeOptions = require('./normalize-options.js'); - -var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; - -var defaultIsFile = function isFile(file) { - try { - var stat = fs.statSync(file); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isFile() || stat.isFIFO(); -}; - -var defaultIsDir = function isDirectory(dir) { - try { - var stat = fs.statSync(dir); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isDirectory(); -}; - -var defaultRealpathSync = function realpathSync(x) { - try { - return realpathFS(x); - } catch (realpathErr) { - if (realpathErr.code !== 'ENOENT') { - throw realpathErr; - } - } - return x; -}; - -var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { - if (opts && opts.preserveSymlinks === false) { - return realpathSync(x); - } - return x; -}; - -var getPackageCandidates = function getPackageCandidates(x, start, opts) { - var dirs = nodeModulesPaths(start, opts, x); - for (var i = 0; i < dirs.length; i++) { - dirs[i] = path.join(dirs[i], x); - } - return dirs; -}; - -module.exports = function resolveSync(x, options) { - if (typeof x !== 'string') { - throw new TypeError('Path must be a string.'); - } - var opts = normalizeOptions(x, options); - - var isFile = opts.isFile || defaultIsFile; - var readFileSync = opts.readFileSync || fs.readFileSync; - var isDirectory = opts.isDirectory || defaultIsDir; - var realpathSync = opts.realpathSync || defaultRealpathSync; - var packageIterator = opts.packageIterator; - - var extensions = opts.extensions || ['.js']; - var basedir = opts.basedir || path.dirname(caller()); - var parent = opts.filename || basedir; - - opts.paths = opts.paths || []; - - // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory - var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); - - if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { - var res = path.resolve(absoluteStart, x); - if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; - var m = loadAsFileSync(res) || loadAsDirectorySync(res); - if (m) return maybeRealpathSync(realpathSync, m, opts); - } else if (isCore(x)) { - return x; - } else { - var n = loadNodeModulesSync(x, absoluteStart); - if (n) return maybeRealpathSync(realpathSync, n, opts); - } - - var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - - function loadAsFileSync(x) { - var pkg = loadpkg(path.dirname(x)); - - if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { - var rfile = path.relative(pkg.dir, x); - var r = opts.pathFilter(pkg.pkg, x, rfile); - if (r) { - x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign - } - } - - if (isFile(x)) { - return x; - } - - for (var i = 0; i < extensions.length; i++) { - var file = x + extensions[i]; - if (isFile(file)) { - return file; - } - } - } - - function loadpkg(dir) { - if (dir === '' || dir === '/') return; - if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { - return; - } - if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; - - var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); - - if (!isFile(pkgfile)) { - return loadpkg(path.dirname(dir)); - } - - var body = readFileSync(pkgfile); - - try { - var pkg = JSON.parse(body); - } catch (jsonErr) {} - - if (pkg && opts.packageFilter) { - // v2 will pass pkgfile - pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment - } - - return { pkg: pkg, dir: dir }; - } - - function loadAsDirectorySync(x) { - var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); - if (isFile(pkgfile)) { - try { - var body = readFileSync(pkgfile, 'UTF8'); - var pkg = JSON.parse(body); - } catch (e) {} - - if (pkg && opts.packageFilter) { - // v2 will pass pkgfile - pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment - } - - if (pkg && pkg.main) { - if (typeof pkg.main !== 'string') { - var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); - mainError.code = 'INVALID_PACKAGE_MAIN'; - throw mainError; - } - if (pkg.main === '.' || pkg.main === './') { - pkg.main = 'index'; - } - try { - var m = loadAsFileSync(path.resolve(x, pkg.main)); - if (m) return m; - var n = loadAsDirectorySync(path.resolve(x, pkg.main)); - if (n) return n; - } catch (e) {} - } - } - - return loadAsFileSync(path.join(x, '/index')); - } - - function loadNodeModulesSync(x, start) { - var thunk = function () { return getPackageCandidates(x, start, opts); }; - var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); - - for (var i = 0; i < dirs.length; i++) { - var dir = dirs[i]; - if (isDirectory(path.dirname(dir))) { - var m = loadAsFileSync(dir); - if (m) return m; - var n = loadAsDirectorySync(dir); - if (n) return n; - } - } - } -}; diff --git a/node_modules/resolve/package.json b/node_modules/resolve/package.json deleted file mode 100644 index e5aab4f..0000000 --- a/node_modules/resolve/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "_from": "resolve@^1.1.10", - "_id": "resolve@1.17.0", - "_inBundle": false, - "_integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "_location": "/resolve", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "resolve@^1.1.10", - "name": "resolve", - "escapedName": "resolve", - "rawSpec": "^1.1.10", - "saveSpec": null, - "fetchSpec": "^1.1.10" - }, - "_requiredBy": [ - "/d3-geo-projection" - ], - "_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "_shasum": "b25941b54968231cc2d1bb76a79cb7f2c0bf8444", - "_spec": "resolve@^1.1.10", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/d3-geo-projection", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "bugs": { - "url": "https://github.com/browserify/resolve/issues" - }, - "bundleDependencies": false, - "dependencies": { - "path-parse": "^1.0.6" - }, - "deprecated": false, - "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", - "devDependencies": { - "@ljharb/eslint-config": "^16.0.0", - "array.prototype.map": "^1.0.2", - "eslint": "^6.8.0", - "object-keys": "^1.1.1", - "safe-publish-latest": "^1.1.4", - "tap": "0.4.13", - "tape": "^5.0.0-next.5" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "homepage": "https://github.com/browserify/resolve#readme", - "keywords": [ - "resolve", - "require", - "node", - "module" - ], - "license": "MIT", - "main": "index.js", - "name": "resolve", - "repository": { - "type": "git", - "url": "git://github.com/browserify/resolve.git" - }, - "scripts": { - "lint": "eslint .", - "posttest": "npm run test:multirepo", - "prepublish": "safe-publish-latest", - "pretest": "npm run lint", - "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", - "test": "npm run --silent tests-only", - "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test", - "tests-only": "tape test/*.js" - }, - "version": "1.17.0" -} diff --git a/node_modules/resolve/readme.markdown b/node_modules/resolve/readme.markdown deleted file mode 100644 index 5e1aea3..0000000 --- a/node_modules/resolve/readme.markdown +++ /dev/null @@ -1,242 +0,0 @@ -# resolve - -implements the [node `require.resolve()` -algorithm](https://nodejs.org/api/modules.html#modules_all_together) -such that you can `require.resolve()` on behalf of a file asynchronously and -synchronously - -[![build status](https://secure.travis-ci.org/browserify/resolve.png)](http://travis-ci.org/browserify/resolve) - -# example - -asynchronously resolve: - -```js -var resolve = require('resolve'); -resolve('tap', { basedir: __dirname }, function (err, res) { - if (err) console.error(err); - else console.log(res); -}); -``` - -``` -$ node example/async.js -/home/substack/projects/node-resolve/node_modules/tap/lib/main.js -``` - -synchronously resolve: - -```js -var resolve = require('resolve'); -var res = resolve.sync('tap', { basedir: __dirname }); -console.log(res); -``` - -``` -$ node example/sync.js -/home/substack/projects/node-resolve/node_modules/tap/lib/main.js -``` - -# methods - -```js -var resolve = require('resolve'); -``` - -## resolve(id, opts={}, cb) - -Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. - -options are: - -* opts.basedir - directory to begin resolving from - -* opts.package - `package.json` data applicable to the module being loaded - -* opts.extensions - array of file extensions to search in order - -* opts.readFile - how to read files asynchronously - -* opts.isFile - function to asynchronously test whether a file exists - -* opts.isDirectory - function to asynchronously test whether a directory exists - -* opts.realpath - function to asynchronously resolve a potential symlink to its real path - -* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field - * pkg - package data - * pkgfile - path to package.json - * dir - directory for package.json - -* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package - * pkg - package data - * path - the path being resolved - * relativePath - the path relative from the package.json location - * returns - a relative path that will be joined from the package.json location - -* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) - - For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function - * request - the import specifier being resolved - * start - lookup path - * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution - * opts - the resolution options - -* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) - * request - the import specifier being resolved - * start - lookup path - * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution - * opts - the resolution options - -* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` - -* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. -This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. -**Note:** this property is currently `true` by default but it will be changed to -`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. - -default `opts` values: - -```js -{ - paths: [], - basedir: __dirname, - extensions: ['.js'], - readFile: fs.readFile, - isFile: function isFile(file, cb) { - fs.stat(file, function (err, stat) { - if (!err) { - return cb(null, stat.isFile() || stat.isFIFO()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); - }, - isDirectory: function isDirectory(dir, cb) { - fs.stat(dir, function (err, stat) { - if (!err) { - return cb(null, stat.isDirectory()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); - }, - realpath: function realpath(file, cb) { - var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; - realpath(file, function (realPathErr, realPath) { - if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); - else cb(null, realPathErr ? file : realPath); - }); - }, - moduleDirectory: 'node_modules', - preserveSymlinks: true -} -``` - -## resolve.sync(id, opts) - -Synchronously resolve the module path string `id`, returning the result and -throwing an error when `id` can't be resolved. - -options are: - -* opts.basedir - directory to begin resolving from - -* opts.extensions - array of file extensions to search in order - -* opts.readFile - how to read files synchronously - -* opts.isFile - function to synchronously test whether a file exists - -* opts.isDirectory - function to synchronously test whether a directory exists - -* opts.realpathSync - function to synchronously resolve a potential symlink to its real path - -* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field - * pkg - package data - * dir - directory for package.json (Note: the second argument will change to "pkgfile" in v2) - -* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package - * pkg - package data - * path - the path being resolved - * relativePath - the path relative from the package.json location - * returns - a relative path that will be joined from the package.json location - -* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) - - For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function - * request - the import specifier being resolved - * start - lookup path - * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution - * opts - the resolution options - -* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) - * request - the import specifier being resolved - * start - lookup path - * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution - * opts - the resolution options - -* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` - -* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. -This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. -**Note:** this property is currently `true` by default but it will be changed to -`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. - -default `opts` values: - -```js -{ - paths: [], - basedir: __dirname, - extensions: ['.js'], - readFileSync: fs.readFileSync, - isFile: function isFile(file) { - try { - var stat = fs.statSync(file); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isFile() || stat.isFIFO(); - }, - isDirectory: function isDirectory(dir) { - try { - var stat = fs.statSync(dir); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isDirectory(); - }, - realpathSync: function realpathSync(file) { - try { - var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; - return realpath(file); - } catch (realPathErr) { - if (realPathErr.code !== 'ENOENT') { - throw realPathErr; - } - } - return file; - }, - moduleDirectory: 'node_modules', - preserveSymlinks: true -} -``` - -## resolve.isCore(pkg) - -Return whether a package is in core. - -# install - -With [npm](https://npmjs.org) do: - -```sh -npm install resolve -``` - -# license - -MIT diff --git a/node_modules/resolve/test/.eslintrc b/node_modules/resolve/test/.eslintrc deleted file mode 100644 index ddd262d..0000000 --- a/node_modules/resolve/test/.eslintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "max-lines": 0 - } -} diff --git a/node_modules/resolve/test/core.js b/node_modules/resolve/test/core.js deleted file mode 100644 index 4c111e1..0000000 --- a/node_modules/resolve/test/core.js +++ /dev/null @@ -1,85 +0,0 @@ -var test = require('tape'); -var keys = require('object-keys'); -var resolve = require('../'); - -test('core modules', function (t) { - t.test('isCore()', function (st) { - st.ok(resolve.isCore('fs')); - st.ok(resolve.isCore('net')); - st.ok(resolve.isCore('http')); - - st.ok(!resolve.isCore('seq')); - st.ok(!resolve.isCore('../')); - - st.ok(!resolve.isCore('toString')); - - st.end(); - }); - - t.test('core list', function (st) { - var cores = keys(resolve.core); - st.plan(cores.length); - - for (var i = 0; i < cores.length; ++i) { - var mod = cores[i]; - if (resolve.core[mod]) { - st.doesNotThrow( - function () { require(mod); }, // eslint-disable-line no-loop-func - mod + ' supported; requiring does not throw' - ); - } else { - st.throws( - function () { require(mod); }, // eslint-disable-line no-loop-func - mod + ' not supported; requiring throws' - ); - } - } - - st.end(); - }); - - t.test('core via repl module', { skip: !resolve.core.repl }, function (st) { - var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle - if (!libs) { - st.skip('module.builtinModules does not exist'); - return st.end(); - } - for (var i = 0; i < libs.length; ++i) { - var mod = libs[i]; - st.ok(resolve.core[mod], mod + ' is a core module'); - st.doesNotThrow( - function () { require(mod); }, // eslint-disable-line no-loop-func - 'requiring ' + mod + ' does not throw' - ); - } - st.end(); - }); - - t.test('core via builtinModules list', { skip: !resolve.core.module }, function (st) { - var libs = require('module').builtinModules; - if (!libs) { - st.skip('module.builtinModules does not exist'); - return st.end(); - } - var blacklist = [ - '_debug_agent', - 'v8/tools/tickprocessor-driver', - 'v8/tools/SourceMap', - 'v8/tools/tickprocessor', - 'v8/tools/profile' - ]; - for (var i = 0; i < libs.length; ++i) { - var mod = libs[i]; - if (blacklist.indexOf(mod) === -1) { - st.ok(resolve.core[mod], mod + ' is a core module'); - st.doesNotThrow( - function () { require(mod); }, // eslint-disable-line no-loop-func - 'requiring ' + mod + ' does not throw' - ); - } - } - st.end(); - }); - - t.end(); -}); diff --git a/node_modules/resolve/test/dotdot.js b/node_modules/resolve/test/dotdot.js deleted file mode 100644 index 3080665..0000000 --- a/node_modules/resolve/test/dotdot.js +++ /dev/null @@ -1,29 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('dotdot', function (t) { - t.plan(4); - var dir = path.join(__dirname, '/dotdot/abc'); - - resolve('..', { basedir: dir }, function (err, res, pkg) { - t.ifError(err); - t.equal(res, path.join(__dirname, 'dotdot/index.js')); - }); - - resolve('.', { basedir: dir }, function (err, res, pkg) { - t.ifError(err); - t.equal(res, path.join(dir, 'index.js')); - }); -}); - -test('dotdot sync', function (t) { - t.plan(2); - var dir = path.join(__dirname, '/dotdot/abc'); - - var a = resolve.sync('..', { basedir: dir }); - t.equal(a, path.join(__dirname, 'dotdot/index.js')); - - var b = resolve.sync('.', { basedir: dir }); - t.equal(b, path.join(dir, 'index.js')); -}); diff --git a/node_modules/resolve/test/dotdot/abc/index.js b/node_modules/resolve/test/dotdot/abc/index.js deleted file mode 100644 index 67f2534..0000000 --- a/node_modules/resolve/test/dotdot/abc/index.js +++ /dev/null @@ -1,2 +0,0 @@ -var x = require('..'); -console.log(x); diff --git a/node_modules/resolve/test/dotdot/index.js b/node_modules/resolve/test/dotdot/index.js deleted file mode 100644 index 643f9fc..0000000 --- a/node_modules/resolve/test/dotdot/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'whatever'; diff --git a/node_modules/resolve/test/faulty_basedir.js b/node_modules/resolve/test/faulty_basedir.js deleted file mode 100644 index 5f2141a..0000000 --- a/node_modules/resolve/test/faulty_basedir.js +++ /dev/null @@ -1,29 +0,0 @@ -var test = require('tape'); -var path = require('path'); -var resolve = require('../'); - -test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) { - t.plan(1); - - var resolverDir = 'C:\\a\\b\\c\\d'; - - resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) { - t.equal(!!err, true); - }); -}); - -test('non-existent basedir should not throw when preserveSymlinks is false', function (t) { - t.plan(2); - - var opts = { - basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'), - preserveSymlinks: false - }; - - var module = './dotdot/abc'; - - resolve(module, opts, function (err, res) { - t.equal(err.code, 'MODULE_NOT_FOUND'); - t.equal(res, undefined); - }); -}); diff --git a/node_modules/resolve/test/filter.js b/node_modules/resolve/test/filter.js deleted file mode 100644 index 8f8cccd..0000000 --- a/node_modules/resolve/test/filter.js +++ /dev/null @@ -1,34 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('filter', function (t) { - t.plan(4); - var dir = path.join(__dirname, 'resolver'); - var packageFilterArgs; - resolve('./baz', { - basedir: dir, - packageFilter: function (pkg, pkgfile) { - pkg.main = 'doom'; // eslint-disable-line no-param-reassign - packageFilterArgs = [pkg, pkgfile]; - return pkg; - } - }, function (err, res, pkg) { - if (err) t.fail(err); - - t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); - - var packageData = packageFilterArgs[0]; - t.equal(pkg, packageData, 'first packageFilter argument is "pkg"'); - t.equal(packageData.main, 'doom', 'package "main" was altered'); - - var packageFile = packageFilterArgs[1]; - t.equal( - packageFile, - path.join(dir, 'baz/package.json'), - 'second packageFilter argument is "pkgfile"' - ); - - t.end(); - }); -}); diff --git a/node_modules/resolve/test/filter_sync.js b/node_modules/resolve/test/filter_sync.js deleted file mode 100644 index 8a43b98..0000000 --- a/node_modules/resolve/test/filter_sync.js +++ /dev/null @@ -1,33 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('filter', function (t) { - var dir = path.join(__dirname, 'resolver'); - var packageFilterArgs; - var res = resolve.sync('./baz', { - basedir: dir, - // NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility - packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment - pkg.main = 'doom'; // eslint-disable-line no-param-reassign - packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef - return pkg; - } - }); - - t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); - - var packageData = packageFilterArgs[0]; - t.equal(packageData.main, 'doom', 'package "main" was altered'); - - if (!'is 1.x') { // eslint-disable-line no-constant-condition - var packageFile = packageFilterArgs[1]; - t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct'); - } - - var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition - // eslint-disable-next-line no-constant-condition - t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"'); - - t.end(); -}); diff --git a/node_modules/resolve/test/mock.js b/node_modules/resolve/test/mock.js deleted file mode 100644 index b9f17fe..0000000 --- a/node_modules/resolve/test/mock.js +++ /dev/null @@ -1,239 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('mock', function (t) { - t.plan(8); - - var files = {}; - files[path.resolve('/foo/bar/baz.js')] = 'beep'; - - var dirs = {}; - dirs[path.resolve('/foo/bar')] = true; - - function opts(basedir) { - return { - basedir: path.resolve(basedir), - isFile: function (file, cb) { - cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); - }, - isDirectory: function (dir, cb) { - cb(null, !!dirs[path.resolve(dir)]); - }, - readFile: function (file, cb) { - cb(null, files[path.resolve(file)]); - }, - realpath: function (file, cb) { - cb(null, file); - } - }; - } - - resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { - if (err) return t.fail(err); - t.equal(res, path.resolve('/foo/bar/baz.js')); - t.equal(pkg, undefined); - }); - - resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { - if (err) return t.fail(err); - t.equal(res, path.resolve('/foo/bar/baz.js')); - t.equal(pkg, undefined); - }); - - resolve('baz', opts('/foo/bar'), function (err, res) { - t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); - t.equal(err.code, 'MODULE_NOT_FOUND'); - }); - - resolve('../baz', opts('/foo/bar'), function (err, res) { - t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); - t.equal(err.code, 'MODULE_NOT_FOUND'); - }); -}); - -test('mock from package', function (t) { - t.plan(8); - - var files = {}; - files[path.resolve('/foo/bar/baz.js')] = 'beep'; - - var dirs = {}; - dirs[path.resolve('/foo/bar')] = true; - - function opts(basedir) { - return { - basedir: path.resolve(basedir), - isFile: function (file, cb) { - cb(null, Object.prototype.hasOwnProperty.call(files, file)); - }, - isDirectory: function (dir, cb) { - cb(null, !!dirs[path.resolve(dir)]); - }, - 'package': { main: 'bar' }, - readFile: function (file, cb) { - cb(null, files[file]); - }, - realpath: function (file, cb) { - cb(null, file); - } - }; - } - - resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { - if (err) return t.fail(err); - t.equal(res, path.resolve('/foo/bar/baz.js')); - t.equal(pkg && pkg.main, 'bar'); - }); - - resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { - if (err) return t.fail(err); - t.equal(res, path.resolve('/foo/bar/baz.js')); - t.equal(pkg && pkg.main, 'bar'); - }); - - resolve('baz', opts('/foo/bar'), function (err, res) { - t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); - t.equal(err.code, 'MODULE_NOT_FOUND'); - }); - - resolve('../baz', opts('/foo/bar'), function (err, res) { - t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); - t.equal(err.code, 'MODULE_NOT_FOUND'); - }); -}); - -test('mock package', function (t) { - t.plan(2); - - var files = {}; - files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; - files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ - main: './baz.js' - }); - - var dirs = {}; - dirs[path.resolve('/foo')] = true; - dirs[path.resolve('/foo/node_modules')] = true; - - function opts(basedir) { - return { - basedir: path.resolve(basedir), - isFile: function (file, cb) { - cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); - }, - isDirectory: function (dir, cb) { - cb(null, !!dirs[path.resolve(dir)]); - }, - readFile: function (file, cb) { - cb(null, files[path.resolve(file)]); - }, - realpath: function (file, cb) { - cb(null, file); - } - }; - } - - resolve('bar', opts('/foo'), function (err, res, pkg) { - if (err) return t.fail(err); - t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); - t.equal(pkg && pkg.main, './baz.js'); - }); -}); - -test('mock package from package', function (t) { - t.plan(2); - - var files = {}; - files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; - files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ - main: './baz.js' - }); - - var dirs = {}; - dirs[path.resolve('/foo')] = true; - dirs[path.resolve('/foo/node_modules')] = true; - - function opts(basedir) { - return { - basedir: path.resolve(basedir), - isFile: function (file, cb) { - cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); - }, - isDirectory: function (dir, cb) { - cb(null, !!dirs[path.resolve(dir)]); - }, - 'package': { main: 'bar' }, - readFile: function (file, cb) { - cb(null, files[path.resolve(file)]); - }, - realpath: function (file, cb) { - cb(null, file); - } - }; - } - - resolve('bar', opts('/foo'), function (err, res, pkg) { - if (err) return t.fail(err); - t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); - t.equal(pkg && pkg.main, './baz.js'); - }); -}); - -test('symlinked', function (t) { - t.plan(4); - - var files = {}; - files[path.resolve('/foo/bar/baz.js')] = 'beep'; - files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; - - var dirs = {}; - dirs[path.resolve('/foo/bar')] = true; - dirs[path.resolve('/foo/bar/symlinked')] = true; - - function opts(basedir) { - return { - preserveSymlinks: false, - basedir: path.resolve(basedir), - isFile: function (file, cb) { - cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); - }, - isDirectory: function (dir, cb) { - cb(null, !!dirs[path.resolve(dir)]); - }, - readFile: function (file, cb) { - cb(null, files[path.resolve(file)]); - }, - realpath: function (file, cb) { - var resolved = path.resolve(file); - - if (resolved.indexOf('symlinked') >= 0) { - cb(null, resolved); - return; - } - - var ext = path.extname(resolved); - - if (ext) { - var dir = path.dirname(resolved); - var base = path.basename(resolved); - cb(null, path.join(dir, 'symlinked', base)); - } else { - cb(null, path.join(resolved, 'symlinked')); - } - } - }; - } - - resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { - if (err) return t.fail(err); - t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); - t.equal(pkg, undefined); - }); - - resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { - if (err) return t.fail(err); - t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); - t.equal(pkg, undefined); - }); -}); diff --git a/node_modules/resolve/test/mock_sync.js b/node_modules/resolve/test/mock_sync.js deleted file mode 100644 index fcf8114..0000000 --- a/node_modules/resolve/test/mock_sync.js +++ /dev/null @@ -1,141 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('mock', function (t) { - t.plan(4); - - var files = {}; - files[path.resolve('/foo/bar/baz.js')] = 'beep'; - - var dirs = {}; - dirs[path.resolve('/foo/bar')] = true; - - function opts(basedir) { - return { - basedir: path.resolve(basedir), - isFile: function (file) { - return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); - }, - isDirectory: function (dir) { - return !!dirs[path.resolve(dir)]; - }, - readFileSync: function (file) { - return files[path.resolve(file)]; - }, - realpathSync: function (file) { - return file; - } - }; - } - - t.equal( - resolve.sync('./baz', opts('/foo/bar')), - path.resolve('/foo/bar/baz.js') - ); - - t.equal( - resolve.sync('./baz.js', opts('/foo/bar')), - path.resolve('/foo/bar/baz.js') - ); - - t.throws(function () { - resolve.sync('baz', opts('/foo/bar')); - }); - - t.throws(function () { - resolve.sync('../baz', opts('/foo/bar')); - }); -}); - -test('mock package', function (t) { - t.plan(1); - - var files = {}; - files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; - files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ - main: './baz.js' - }); - - var dirs = {}; - dirs[path.resolve('/foo')] = true; - dirs[path.resolve('/foo/node_modules')] = true; - - function opts(basedir) { - return { - basedir: path.resolve(basedir), - isFile: function (file) { - return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); - }, - isDirectory: function (dir) { - return !!dirs[path.resolve(dir)]; - }, - readFileSync: function (file) { - return files[path.resolve(file)]; - }, - realpathSync: function (file) { - return file; - } - }; - } - - t.equal( - resolve.sync('bar', opts('/foo')), - path.resolve('/foo/node_modules/bar/baz.js') - ); -}); - -test('symlinked', function (t) { - t.plan(2); - - var files = {}; - files[path.resolve('/foo/bar/baz.js')] = 'beep'; - files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; - - var dirs = {}; - dirs[path.resolve('/foo/bar')] = true; - dirs[path.resolve('/foo/bar/symlinked')] = true; - - function opts(basedir) { - return { - preserveSymlinks: false, - basedir: path.resolve(basedir), - isFile: function (file) { - return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); - }, - isDirectory: function (dir) { - return !!dirs[path.resolve(dir)]; - }, - readFileSync: function (file) { - return files[path.resolve(file)]; - }, - realpathSync: function (file) { - var resolved = path.resolve(file); - - if (resolved.indexOf('symlinked') >= 0) { - return resolved; - } - - var ext = path.extname(resolved); - - if (ext) { - var dir = path.dirname(resolved); - var base = path.basename(resolved); - return path.join(dir, 'symlinked', base); - } else { - return path.join(resolved, 'symlinked'); - } - } - }; - } - - t.equal( - resolve.sync('./baz', opts('/foo/bar')), - path.resolve('/foo/bar/symlinked/baz.js') - ); - - t.equal( - resolve.sync('./baz.js', opts('/foo/bar')), - path.resolve('/foo/bar/symlinked/baz.js') - ); -}); diff --git a/node_modules/resolve/test/module_dir.js b/node_modules/resolve/test/module_dir.js deleted file mode 100644 index b50e5bb..0000000 --- a/node_modules/resolve/test/module_dir.js +++ /dev/null @@ -1,56 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('moduleDirectory strings', function (t) { - t.plan(4); - var dir = path.join(__dirname, 'module_dir'); - var xopts = { - basedir: dir, - moduleDirectory: 'xmodules' - }; - resolve('aaa', xopts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); - }); - - var yopts = { - basedir: dir, - moduleDirectory: 'ymodules' - }; - resolve('aaa', yopts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); - }); -}); - -test('moduleDirectory array', function (t) { - t.plan(6); - var dir = path.join(__dirname, 'module_dir'); - var aopts = { - basedir: dir, - moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] - }; - resolve('aaa', aopts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); - }); - - var bopts = { - basedir: dir, - moduleDirectory: ['zmodules', 'ymodules', 'xmodules'] - }; - resolve('aaa', bopts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); - }); - - var copts = { - basedir: dir, - moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] - }; - resolve('bbb', copts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, path.join(dir, '/zmodules/bbb/main.js')); - }); -}); diff --git a/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/node_modules/resolve/test/module_dir/xmodules/aaa/index.js deleted file mode 100644 index dd7cf7b..0000000 --- a/node_modules/resolve/test/module_dir/xmodules/aaa/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = function (x) { return x * 100; }; diff --git a/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/node_modules/resolve/test/module_dir/ymodules/aaa/index.js deleted file mode 100644 index ef2d4d4..0000000 --- a/node_modules/resolve/test/module_dir/ymodules/aaa/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = function (x) { return x + 100; }; diff --git a/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/node_modules/resolve/test/module_dir/zmodules/bbb/main.js deleted file mode 100644 index e8ba629..0000000 --- a/node_modules/resolve/test/module_dir/zmodules/bbb/main.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = function (n) { return n * 111; }; diff --git a/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/node_modules/resolve/test/module_dir/zmodules/bbb/package.json deleted file mode 100644 index c13b8cf..0000000 --- a/node_modules/resolve/test/module_dir/zmodules/bbb/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "main.js" -} diff --git a/node_modules/resolve/test/node-modules-paths.js b/node_modules/resolve/test/node-modules-paths.js deleted file mode 100644 index 675441d..0000000 --- a/node_modules/resolve/test/node-modules-paths.js +++ /dev/null @@ -1,143 +0,0 @@ -var test = require('tape'); -var path = require('path'); -var parse = path.parse || require('path-parse'); -var keys = require('object-keys'); - -var nodeModulesPaths = require('../lib/node-modules-paths'); - -var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) { - var moduleDirs = [].concat(moduleDirectories || 'node_modules'); - if (paths) { - for (var k = 0; k < paths.length; ++k) { - moduleDirs.push(path.basename(paths[k])); - } - } - - var foundModuleDirs = {}; - var uniqueDirs = {}; - var parsedDirs = {}; - for (var i = 0; i < dirs.length; ++i) { - var parsed = parse(dirs[i]); - if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; } - foundModuleDirs[parsed.base] += 1; - parsedDirs[parsed.dir] = true; - uniqueDirs[dirs[i]] = true; - } - t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has'); - var foundModuleDirNames = keys(foundModuleDirs); - t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found'); - t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique'); - - var counts = {}; - for (var j = 0; j < foundModuleDirNames.length; ++j) { - counts[foundModuleDirs[j]] = true; - } - t.equal(keys(counts).length, 1, 'all found module directories had the same count'); -}; - -test('node-modules-paths', function (t) { - t.test('no options', function (t) { - var start = path.join(__dirname, 'resolver'); - var dirs = nodeModulesPaths(start); - - verifyDirs(t, start, dirs); - - t.end(); - }); - - t.test('empty options', function (t) { - var start = path.join(__dirname, 'resolver'); - var dirs = nodeModulesPaths(start, {}); - - verifyDirs(t, start, dirs); - - t.end(); - }); - - t.test('with paths=array option', function (t) { - var start = path.join(__dirname, 'resolver'); - var paths = ['a', 'b']; - var dirs = nodeModulesPaths(start, { paths: paths }); - - verifyDirs(t, start, dirs, null, paths); - - t.end(); - }); - - t.test('with paths=function option', function (t) { - var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { - return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request)); - }; - - var start = path.join(__dirname, 'resolver'); - var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg'); - - verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]); - - t.end(); - }); - - t.test('with paths=function skipping node modules resolution', function (t) { - var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { - return []; - }; - var start = path.join(__dirname, 'resolver'); - var dirs = nodeModulesPaths(start, { paths: paths }); - t.deepEqual(dirs, [], 'no node_modules was computed'); - t.end(); - }); - - t.test('with moduleDirectory option', function (t) { - var start = path.join(__dirname, 'resolver'); - var moduleDirectory = 'not node modules'; - var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory }); - - verifyDirs(t, start, dirs, moduleDirectory); - - t.end(); - }); - - t.test('with 1 moduleDirectory and paths options', function (t) { - var start = path.join(__dirname, 'resolver'); - var paths = ['a', 'b']; - var moduleDirectory = 'not node modules'; - var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory }); - - verifyDirs(t, start, dirs, moduleDirectory, paths); - - t.end(); - }); - - t.test('with 1+ moduleDirectory and paths options', function (t) { - var start = path.join(__dirname, 'resolver'); - var paths = ['a', 'b']; - var moduleDirectories = ['not node modules', 'other modules']; - var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); - - verifyDirs(t, start, dirs, moduleDirectories, paths); - - t.end(); - }); - - t.test('combine paths correctly on Windows', function (t) { - var start = 'C:\\Users\\username\\myProject\\src'; - var paths = []; - var moduleDirectories = ['node_modules', start]; - var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); - - t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); - - t.end(); - }); - - t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) { - var start = '/Users/username/git/myProject/src'; - var paths = []; - var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src']; - var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); - - t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); - - t.end(); - }); -}); diff --git a/node_modules/resolve/test/node_path.js b/node_modules/resolve/test/node_path.js deleted file mode 100644 index d06aa4e..0000000 --- a/node_modules/resolve/test/node_path.js +++ /dev/null @@ -1,70 +0,0 @@ -var fs = require('fs'); -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('$NODE_PATH', function (t) { - t.plan(8); - - var isDir = function (dir, cb) { - if (dir === '/node_path' || dir === 'node_path/x') { - return cb(null, true); - } - fs.stat(dir, function (err, stat) { - if (!err) { - return cb(null, stat.isDirectory()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); - }; - - resolve('aaa', { - paths: [ - path.join(__dirname, '/node_path/x'), - path.join(__dirname, '/node_path/y') - ], - basedir: __dirname, - isDirectory: isDir - }, function (err, res) { - t.error(err); - t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves'); - }); - - resolve('bbb', { - paths: [ - path.join(__dirname, '/node_path/x'), - path.join(__dirname, '/node_path/y') - ], - basedir: __dirname, - isDirectory: isDir - }, function (err, res) { - t.error(err); - t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves'); - }); - - resolve('ccc', { - paths: [ - path.join(__dirname, '/node_path/x'), - path.join(__dirname, '/node_path/y') - ], - basedir: __dirname, - isDirectory: isDir - }, function (err, res) { - t.error(err); - t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves'); - }); - - // ensure that relative paths still resolve against the regular `node_modules` correctly - resolve('tap', { - paths: [ - 'node_path' - ], - basedir: path.join(__dirname, 'node_path/x'), - isDirectory: isDir - }, function (err, res) { - var root = require('tap/package.json').main; - t.error(err); - t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves'); - }); -}); diff --git a/node_modules/resolve/test/node_path/x/aaa/index.js b/node_modules/resolve/test/node_path/x/aaa/index.js deleted file mode 100644 index ad70d0b..0000000 --- a/node_modules/resolve/test/node_path/x/aaa/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'A'; diff --git a/node_modules/resolve/test/node_path/x/ccc/index.js b/node_modules/resolve/test/node_path/x/ccc/index.js deleted file mode 100644 index a64132e..0000000 --- a/node_modules/resolve/test/node_path/x/ccc/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'C'; diff --git a/node_modules/resolve/test/node_path/y/bbb/index.js b/node_modules/resolve/test/node_path/y/bbb/index.js deleted file mode 100644 index 4d0f32e..0000000 --- a/node_modules/resolve/test/node_path/y/bbb/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'B'; diff --git a/node_modules/resolve/test/node_path/y/ccc/index.js b/node_modules/resolve/test/node_path/y/ccc/index.js deleted file mode 100644 index 793315e..0000000 --- a/node_modules/resolve/test/node_path/y/ccc/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'CY'; diff --git a/node_modules/resolve/test/nonstring.js b/node_modules/resolve/test/nonstring.js deleted file mode 100644 index ef63c40..0000000 --- a/node_modules/resolve/test/nonstring.js +++ /dev/null @@ -1,9 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); - -test('nonstring', function (t) { - t.plan(1); - resolve(555, function (err, res, pkg) { - t.ok(err); - }); -}); diff --git a/node_modules/resolve/test/pathfilter.js b/node_modules/resolve/test/pathfilter.js deleted file mode 100644 index 16519ae..0000000 --- a/node_modules/resolve/test/pathfilter.js +++ /dev/null @@ -1,75 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -var resolverDir = path.join(__dirname, '/pathfilter/deep_ref'); - -var pathFilterFactory = function (t) { - return function (pkg, x, remainder) { - t.equal(pkg.version, '1.2.3'); - t.equal(x, path.join(resolverDir, 'node_modules/deep/ref')); - t.equal(remainder, 'ref'); - return 'alt'; - }; -}; - -test('#62: deep module references and the pathFilter', function (t) { - t.test('deep/ref.js', function (st) { - st.plan(3); - - resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) { - if (err) st.fail(err); - - st.equal(pkg.version, '1.2.3'); - st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); - }); - - var res = resolve.sync('deep/ref', { basedir: resolverDir }); - st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); - }); - - t.test('deep/deeper/ref', function (st) { - st.plan(4); - - resolve( - 'deep/deeper/ref', - { basedir: resolverDir }, - function (err, res, pkg) { - if (err) t.fail(err); - st.notEqual(pkg, undefined); - st.equal(pkg.version, '1.2.3'); - st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); - } - ); - - var res = resolve.sync( - 'deep/deeper/ref', - { basedir: resolverDir } - ); - st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); - }); - - t.test('deep/ref alt', function (st) { - st.plan(8); - - var pathFilter = pathFilterFactory(st); - - var res = resolve.sync( - 'deep/ref', - { basedir: resolverDir, pathFilter: pathFilter } - ); - st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); - - resolve( - 'deep/ref', - { basedir: resolverDir, pathFilter: pathFilter }, - function (err, res, pkg) { - if (err) st.fail(err); - st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); - st.end(); - } - ); - }); - - t.end(); -}); diff --git a/node_modules/resolve/test/pathfilter/deep_ref/main.js b/node_modules/resolve/test/pathfilter/deep_ref/main.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/precedence.js b/node_modules/resolve/test/precedence.js deleted file mode 100644 index 2febb59..0000000 --- a/node_modules/resolve/test/precedence.js +++ /dev/null @@ -1,23 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('precedence', function (t) { - t.plan(3); - var dir = path.join(__dirname, 'precedence/aaa'); - - resolve('./', { basedir: dir }, function (err, res, pkg) { - t.ifError(err); - t.equal(res, path.join(dir, 'index.js')); - t.equal(pkg.name, 'resolve'); - }); -}); - -test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string - t.plan(1); - var dir = path.join(__dirname, 'precedence/bbb'); - - resolve('./', { basedir: dir }, function (err, res, pkg) { - t.ok(err); - }); -}); diff --git a/node_modules/resolve/test/precedence/aaa.js b/node_modules/resolve/test/precedence/aaa.js deleted file mode 100644 index b83a3e7..0000000 --- a/node_modules/resolve/test/precedence/aaa.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'wtf'; diff --git a/node_modules/resolve/test/precedence/aaa/index.js b/node_modules/resolve/test/precedence/aaa/index.js deleted file mode 100644 index e0f8f6a..0000000 --- a/node_modules/resolve/test/precedence/aaa/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'okok'; diff --git a/node_modules/resolve/test/precedence/aaa/main.js b/node_modules/resolve/test/precedence/aaa/main.js deleted file mode 100644 index 93542a9..0000000 --- a/node_modules/resolve/test/precedence/aaa/main.js +++ /dev/null @@ -1 +0,0 @@ -console.log(require('./')); diff --git a/node_modules/resolve/test/precedence/bbb.js b/node_modules/resolve/test/precedence/bbb.js deleted file mode 100644 index 2298f47..0000000 --- a/node_modules/resolve/test/precedence/bbb.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = '>_<'; diff --git a/node_modules/resolve/test/precedence/bbb/main.js b/node_modules/resolve/test/precedence/bbb/main.js deleted file mode 100644 index 716b81d..0000000 --- a/node_modules/resolve/test/precedence/bbb/main.js +++ /dev/null @@ -1 +0,0 @@ -console.log(require('./')); // should throw diff --git a/node_modules/resolve/test/resolver.js b/node_modules/resolve/test/resolver.js deleted file mode 100644 index aa36ee1..0000000 --- a/node_modules/resolve/test/resolver.js +++ /dev/null @@ -1,450 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('async foo', function (t) { - t.plan(12); - var dir = path.join(__dirname, 'resolver'); - - resolve('./foo', { basedir: dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'foo.js')); - t.equal(pkg && pkg.name, 'resolve'); - }); - - resolve('./foo.js', { basedir: dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'foo.js')); - t.equal(pkg && pkg.name, 'resolve'); - }); - - resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'foo.js')); - t.equal(pkg && pkg.main, 'resolver'); - }); - - resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'foo.js')); - t.equal(pkg.main, 'resolver'); - }); - - resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'foo.js')); - }); - - resolve('foo', { basedir: dir }, function (err) { - t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); - t.equal(err.code, 'MODULE_NOT_FOUND'); - }); - - // Test that filename is reported as the "from" value when passed. - resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) { - t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'"); - }); -}); - -test('bar', function (t) { - t.plan(6); - var dir = path.join(__dirname, 'resolver'); - - resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); - t.equal(pkg, undefined); - }); - - resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); - t.equal(pkg, undefined); - }); - - resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); - t.equal(pkg.main, 'bar'); - }); -}); - -test('baz', function (t) { - t.plan(4); - var dir = path.join(__dirname, 'resolver'); - - resolve('./baz', { basedir: dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'baz/quux.js')); - t.equal(pkg.main, 'quux.js'); - }); - - resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'baz/quux.js')); - t.equal(pkg.main, 'quux.js'); - }); -}); - -test('biz', function (t) { - t.plan(24); - var dir = path.join(__dirname, 'resolver/biz/node_modules'); - - resolve('./grux', { basedir: dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'grux/index.js')); - t.equal(pkg, undefined); - }); - - resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'grux/index.js')); - t.equal(pkg.main, 'biz'); - }); - - resolve('./garply', { basedir: dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'garply/lib/index.js')); - t.equal(pkg.main, './lib'); - }); - - resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'garply/lib/index.js')); - t.equal(pkg.main, './lib'); - }); - - resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'tiv/index.js')); - t.equal(pkg, undefined); - }); - - resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'tiv/index.js')); - t.equal(pkg.main, 'grux'); - }); - - resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'tiv/index.js')); - t.equal(pkg, undefined); - }); - - resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'tiv/index.js')); - t.equal(pkg.main, './lib'); - }); - - resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'grux/index.js')); - t.equal(pkg, undefined); - }); - - resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'grux/index.js')); - t.equal(pkg.main, 'tiv'); - }); - - resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'garply/lib/index.js')); - t.equal(pkg.main, './lib'); - }); - - resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'garply/lib/index.js')); - t.equal(pkg.main, './lib'); - }); -}); - -test('quux', function (t) { - t.plan(2); - var dir = path.join(__dirname, 'resolver/quux'); - - resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'foo/index.js')); - t.equal(pkg.main, 'quux'); - }); -}); - -test('normalize', function (t) { - t.plan(2); - var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); - - resolve('../grux', { basedir: dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'index.js')); - t.equal(pkg, undefined); - }); -}); - -test('cup', function (t) { - t.plan(5); - var dir = path.join(__dirname, 'resolver'); - - resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'cup.coffee')); - }); - - resolve('./cup.coffee', { basedir: dir }, function (err, res) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'cup.coffee')); - }); - - resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) { - t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); - t.equal(err.code, 'MODULE_NOT_FOUND'); - }); - - // Test that filename is reported as the "from" value when passed. - resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) { - t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'"); - }); -}); - -test('mug', function (t) { - t.plan(3); - var dir = path.join(__dirname, 'resolver'); - - resolve('./mug', { basedir: dir }, function (err, res) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'mug.js')); - }); - - resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) { - if (err) t.fail(err); - t.equal(res, path.join(dir, '/mug.coffee')); - }); - - resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { - t.equal(res, path.join(dir, '/mug.js')); - }); -}); - -test('other path', function (t) { - t.plan(6); - var resolverDir = path.join(__dirname, 'resolver'); - var dir = path.join(resolverDir, 'bar'); - var otherDir = path.join(resolverDir, 'other_path'); - - resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) { - if (err) t.fail(err); - t.equal(res, path.join(resolverDir, 'other_path/root.js')); - }); - - resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) { - if (err) t.fail(err); - t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js')); - }); - - resolve('root', { basedir: dir }, function (err, res) { - t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); - t.equal(err.code, 'MODULE_NOT_FOUND'); - }); - - resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) { - t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); - t.equal(err.code, 'MODULE_NOT_FOUND'); - }); -}); - -test('path iterator', function (t) { - t.plan(2); - - var resolverDir = path.join(__dirname, 'resolver'); - - var exactIterator = function (x, start, getPackageCandidates, opts) { - return [path.join(resolverDir, x)]; - }; - - resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(resolverDir, 'baz/quux.js')); - t.equal(pkg && pkg.name, 'baz'); - }); -}); - -test('incorrect main', function (t) { - t.plan(1); - - var resolverDir = path.join(__dirname, 'resolver'); - var dir = path.join(resolverDir, 'incorrect_main'); - - resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'index.js')); - }); -}); - -test('without basedir', function (t) { - t.plan(1); - - var dir = path.join(__dirname, 'resolver/without_basedir'); - var tester = require(path.join(dir, 'main.js')); - - tester(t, function (err, res, pkg) { - if (err) { - t.fail(err); - } else { - t.equal(res, path.join(dir, 'node_modules/mymodule.js')); - } - }); -}); - -test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { - t.plan(2); - - var dir = path.join(__dirname, 'resolver'); - - resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'same_names/foo.js')); - }); - - resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'same_names/foo/index.js')); - }); -}); - -test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { - t.plan(2); - - var dir = path.join(__dirname, 'resolver'); - - resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'same_names/foo/index.js')); - }); - - resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'same_names/foo/index.js')); - }); -}); - -test('async: #121 - treating an existing file as a dir when no basedir', function (t) { - var testFile = path.basename(__filename); - - t.test('sanity check', function (st) { - st.plan(1); - resolve('./' + testFile, function (err, res, pkg) { - if (err) t.fail(err); - st.equal(res, __filename, 'sanity check'); - }); - }); - - t.test('with a fake directory', function (st) { - st.plan(4); - - resolve('./' + testFile + '/blah', function (err, res, pkg) { - st.ok(err, 'there is an error'); - st.notOk(res, 'no result'); - - st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); - st.equal( - err && err.message, - 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', - 'can not find nonexistent module' - ); - st.end(); - }); - }); - - t.end(); -}); - -test('async dot main', function (t) { - var start = new Date(); - t.plan(3); - resolve('./resolver/dot_main', function (err, ret) { - t.notOk(err); - t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js')); - t.ok(new Date() - start < 50, 'resolve.sync timedout'); - t.end(); - }); -}); - -test('async dot slash main', function (t) { - var start = new Date(); - t.plan(3); - resolve('./resolver/dot_slash_main', function (err, ret) { - t.notOk(err); - t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js')); - t.ok(new Date() - start < 50, 'resolve.sync timedout'); - t.end(); - }); -}); - -test('not a directory', function (t) { - t.plan(6); - var path = './foo'; - resolve(path, { basedir: __filename }, function (err, res, pkg) { - t.ok(err, 'a non-directory errors'); - t.equal(arguments.length, 1); - t.equal(res, undefined); - t.equal(pkg, undefined); - - t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\''); - t.equal(err && err.code, 'MODULE_NOT_FOUND'); - }); -}); - -test('non-string "main" field in package.json', function (t) { - t.plan(5); - - var dir = path.join(__dirname, 'resolver'); - resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { - t.ok(err, 'errors on non-string main'); - t.equal(err.message, 'package “invalid main” `main` must be a string'); - t.equal(err.code, 'INVALID_PACKAGE_MAIN'); - t.equal(res, undefined, 'res is undefined'); - t.equal(pkg, undefined, 'pkg is undefined'); - }); -}); - -test('non-string "main" field in package.json', function (t) { - t.plan(5); - - var dir = path.join(__dirname, 'resolver'); - resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { - t.ok(err, 'errors on non-string main'); - t.equal(err.message, 'package “invalid main” `main` must be a string'); - t.equal(err.code, 'INVALID_PACKAGE_MAIN'); - t.equal(res, undefined, 'res is undefined'); - t.equal(pkg, undefined, 'pkg is undefined'); - }); -}); - -test('browser field in package.json', function (t) { - t.plan(3); - - var dir = path.join(__dirname, 'resolver'); - resolve( - './browser_field', - { - basedir: dir, - packageFilter: function packageFilter(pkg) { - if (pkg.browser) { - pkg.main = pkg.browser; // eslint-disable-line no-param-reassign - delete pkg.browser; // eslint-disable-line no-param-reassign - } - return pkg; - } - }, - function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, path.join(dir, 'browser_field', 'b.js')); - t.equal(pkg && pkg.main, 'b'); - t.equal(pkg && pkg.browser, undefined); - } - ); -}); diff --git a/node_modules/resolve/test/resolver/baz/doom.js b/node_modules/resolve/test/resolver/baz/doom.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/baz/package.json b/node_modules/resolve/test/resolver/baz/package.json deleted file mode 100644 index 2f77720..0000000 --- a/node_modules/resolve/test/resolver/baz/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "baz", - "main": "quux.js" -} diff --git a/node_modules/resolve/test/resolver/baz/quux.js b/node_modules/resolve/test/resolver/baz/quux.js deleted file mode 100644 index bd816ea..0000000 --- a/node_modules/resolve/test/resolver/baz/quux.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/node_modules/resolve/test/resolver/browser_field/a.js b/node_modules/resolve/test/resolver/browser_field/a.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/browser_field/b.js b/node_modules/resolve/test/resolver/browser_field/b.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/browser_field/package.json b/node_modules/resolve/test/resolver/browser_field/package.json deleted file mode 100644 index bf406f0..0000000 --- a/node_modules/resolve/test/resolver/browser_field/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "browser_field", - "main": "a", - "browser": "b" -} diff --git a/node_modules/resolve/test/resolver/cup.coffee b/node_modules/resolve/test/resolver/cup.coffee deleted file mode 100644 index 8b13789..0000000 --- a/node_modules/resolve/test/resolver/cup.coffee +++ /dev/null @@ -1 +0,0 @@ - diff --git a/node_modules/resolve/test/resolver/dot_main/index.js b/node_modules/resolve/test/resolver/dot_main/index.js deleted file mode 100644 index bd816ea..0000000 --- a/node_modules/resolve/test/resolver/dot_main/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/node_modules/resolve/test/resolver/dot_main/package.json b/node_modules/resolve/test/resolver/dot_main/package.json deleted file mode 100644 index d7f4fc8..0000000 --- a/node_modules/resolve/test/resolver/dot_main/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "." -} diff --git a/node_modules/resolve/test/resolver/dot_slash_main/index.js b/node_modules/resolve/test/resolver/dot_slash_main/index.js deleted file mode 100644 index bd816ea..0000000 --- a/node_modules/resolve/test/resolver/dot_slash_main/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/node_modules/resolve/test/resolver/dot_slash_main/package.json b/node_modules/resolve/test/resolver/dot_slash_main/package.json deleted file mode 100644 index f51287b..0000000 --- a/node_modules/resolve/test/resolver/dot_slash_main/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "./" -} diff --git a/node_modules/resolve/test/resolver/foo.js b/node_modules/resolve/test/resolver/foo.js deleted file mode 100644 index bd816ea..0000000 --- a/node_modules/resolve/test/resolver/foo.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/node_modules/resolve/test/resolver/incorrect_main/index.js b/node_modules/resolve/test/resolver/incorrect_main/index.js deleted file mode 100644 index bc1fb0a..0000000 --- a/node_modules/resolve/test/resolver/incorrect_main/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate -module.exports = 1; diff --git a/node_modules/resolve/test/resolver/incorrect_main/package.json b/node_modules/resolve/test/resolver/incorrect_main/package.json deleted file mode 100644 index b718804..0000000 --- a/node_modules/resolve/test/resolver/incorrect_main/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "wrong.js" -} diff --git a/node_modules/resolve/test/resolver/invalid_main/package.json b/node_modules/resolve/test/resolver/invalid_main/package.json deleted file mode 100644 index 0cf8279..0000000 --- a/node_modules/resolve/test/resolver/invalid_main/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "invalid main", - "main": [ - "why is this a thing", - "srsly omg wtf" - ] -} diff --git a/node_modules/resolve/test/resolver/mug.coffee b/node_modules/resolve/test/resolver/mug.coffee deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/mug.js b/node_modules/resolve/test/resolver/mug.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/multirepo/lerna.json b/node_modules/resolve/test/resolver/multirepo/lerna.json deleted file mode 100644 index d6707ca..0000000 --- a/node_modules/resolve/test/resolver/multirepo/lerna.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "packages": [ - "packages/*" - ], - "version": "0.0.0" -} diff --git a/node_modules/resolve/test/resolver/multirepo/package.json b/node_modules/resolve/test/resolver/multirepo/package.json deleted file mode 100644 index 8508f9d..0000000 --- a/node_modules/resolve/test/resolver/multirepo/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "monorepo-symlink-test", - "private": true, - "version": "0.0.0", - "description": "", - "main": "index.js", - "scripts": { - "postinstall": "lerna bootstrap", - "test": "node packages/package-a" - }, - "author": "", - "license": "MIT", - "dependencies": { - "jquery": "^3.3.1", - "resolve": "../../../" - }, - "devDependencies": { - "lerna": "^3.4.3" - } -} diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js b/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js deleted file mode 100644 index 8875a32..0000000 --- a/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -var assert = require('assert'); -var path = require('path'); -var resolve = require('resolve'); - -var basedir = __dirname + '/node_modules/@my-scope/package-b'; - -var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js'); - -/* - * preserveSymlinks === false - * will search NPM package from - * - packages/package-b/node_modules - * - packages/node_modules - * - node_modules - */ -assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected); -assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected); - -/* - * preserveSymlinks === true - * will search NPM package from - * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules - * - packages/package-a/node_modules/@my-scope/packages/node_modules - * - packages/package-a/node_modules/@my-scope/node_modules - * - packages/package-a/node_modules/node_modules - * - packages/package-a/node_modules - * - packages/node_modules - * - node_modules - */ -assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected); -assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected); - -console.log(' * all monorepo paths successfully resolved through symlinks'); diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json b/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json deleted file mode 100644 index 204de51..0000000 --- a/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "@my-scope/package-a", - "version": "0.0.0", - "private": true, - "description": "", - "license": "MIT", - "main": "index.js", - "scripts": { - "test": "echo \"Error: run tests from root\" && exit 1" - }, - "dependencies": { - "@my-scope/package-b": "^0.0.0" - } -} diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js b/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json b/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json deleted file mode 100644 index f57c3b5..0000000 --- a/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "@my-scope/package-b", - "private": true, - "version": "0.0.0", - "description": "", - "license": "MIT", - "main": "index.js", - "scripts": { - "test": "echo \"Error: run tests from root\" && exit 1" - }, - "dependencies": { - "@my-scope/package-a": "^0.0.0" - } -} diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js b/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js deleted file mode 100644 index 9b4846a..0000000 --- a/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js +++ /dev/null @@ -1,26 +0,0 @@ -var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); -var b; -var c; - -var test = function test() { - console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); - console.log(b, ': preserveSymlinks true'); - console.log(c, ': preserveSymlinks false'); - - if (a !== b && a !== c) { - throw 'async: no match'; - } - console.log('async: success! a matched either b or c\n'); -}; - -require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) { - if (err) { throw err; } - b = result.replace(process.cwd(), '$CWD'); - if (b && c) { test(); } -}); -require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) { - if (err) { throw err; } - c = result.replace(process.cwd(), '$CWD'); - if (b && c) { test(); } -}); - diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json b/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json deleted file mode 100644 index acfe9e9..0000000 --- a/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "mylib", - "version": "0.0.0", - "description": "", - "private": true, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "buffer": "*" - } -} diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js b/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js deleted file mode 100644 index 3283efc..0000000 --- a/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js +++ /dev/null @@ -1,12 +0,0 @@ -var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); -var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD'); -var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD'); - -console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); -console.log(b, ': preserveSymlinks true'); -console.log(c, ': preserveSymlinks false'); - -if (a !== b && a !== c) { - throw 'sync: no match'; -} -console.log('sync: success! a matched either b or c\n'); diff --git a/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/node_modules/resolve/test/resolver/other_path/lib/other-lib.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/other_path/root.js b/node_modules/resolve/test/resolver/other_path/root.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/quux/foo/index.js b/node_modules/resolve/test/resolver/quux/foo/index.js deleted file mode 100644 index bd816ea..0000000 --- a/node_modules/resolve/test/resolver/quux/foo/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/node_modules/resolve/test/resolver/same_names/foo.js b/node_modules/resolve/test/resolver/same_names/foo.js deleted file mode 100644 index 888cae3..0000000 --- a/node_modules/resolve/test/resolver/same_names/foo.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 42; diff --git a/node_modules/resolve/test/resolver/same_names/foo/index.js b/node_modules/resolve/test/resolver/same_names/foo/index.js deleted file mode 100644 index bd816ea..0000000 --- a/node_modules/resolve/test/resolver/same_names/foo/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js b/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/resolver/symlinked/package/bar.js b/node_modules/resolve/test/resolver/symlinked/package/bar.js deleted file mode 100644 index cb1c2c0..0000000 --- a/node_modules/resolve/test/resolver/symlinked/package/bar.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'bar'; diff --git a/node_modules/resolve/test/resolver/symlinked/package/package.json b/node_modules/resolve/test/resolver/symlinked/package/package.json deleted file mode 100644 index 8e1b585..0000000 --- a/node_modules/resolve/test/resolver/symlinked/package/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "bar.js" -} \ No newline at end of file diff --git a/node_modules/resolve/test/resolver/without_basedir/main.js b/node_modules/resolve/test/resolver/without_basedir/main.js deleted file mode 100644 index 5b31975..0000000 --- a/node_modules/resolve/test/resolver/without_basedir/main.js +++ /dev/null @@ -1,5 +0,0 @@ -var resolve = require('../../../'); - -module.exports = function (t, cb) { - resolve('mymodule', null, cb); -}; diff --git a/node_modules/resolve/test/resolver_sync.js b/node_modules/resolve/test/resolver_sync.js deleted file mode 100644 index 3082c96..0000000 --- a/node_modules/resolve/test/resolver_sync.js +++ /dev/null @@ -1,358 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('foo', function (t) { - var dir = path.join(__dirname, 'resolver'); - - t.equal( - resolve.sync('./foo', { basedir: dir }), - path.join(dir, 'foo.js') - ); - - t.equal( - resolve.sync('./foo.js', { basedir: dir }), - path.join(dir, 'foo.js') - ); - - t.equal( - resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }), - path.join(dir, 'foo.js') - ); - - t.throws(function () { - resolve.sync('foo', { basedir: dir }); - }); - - // Test that filename is reported as the "from" value when passed. - t.throws( - function () { - resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') }); - }, - { - name: 'Error', - message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'" - } - ); - - t.end(); -}); - -test('bar', function (t) { - var dir = path.join(__dirname, 'resolver'); - - t.equal( - resolve.sync('foo', { basedir: path.join(dir, 'bar') }), - path.join(dir, 'bar/node_modules/foo/index.js') - ); - t.end(); -}); - -test('baz', function (t) { - var dir = path.join(__dirname, 'resolver'); - - t.equal( - resolve.sync('./baz', { basedir: dir }), - path.join(dir, 'baz/quux.js') - ); - t.end(); -}); - -test('biz', function (t) { - var dir = path.join(__dirname, 'resolver/biz/node_modules'); - t.equal( - resolve.sync('./grux', { basedir: dir }), - path.join(dir, 'grux/index.js') - ); - - t.equal( - resolve.sync('tiv', { basedir: path.join(dir, 'grux') }), - path.join(dir, 'tiv/index.js') - ); - - t.equal( - resolve.sync('grux', { basedir: path.join(dir, 'tiv') }), - path.join(dir, 'grux/index.js') - ); - t.end(); -}); - -test('normalize', function (t) { - var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); - t.equal( - resolve.sync('../grux', { basedir: dir }), - path.join(dir, 'index.js') - ); - t.end(); -}); - -test('cup', function (t) { - var dir = path.join(__dirname, 'resolver'); - t.equal( - resolve.sync('./cup', { - basedir: dir, - extensions: ['.js', '.coffee'] - }), - path.join(dir, 'cup.coffee') - ); - - t.equal( - resolve.sync('./cup.coffee', { basedir: dir }), - path.join(dir, 'cup.coffee') - ); - - t.throws(function () { - resolve.sync('./cup', { - basedir: dir, - extensions: ['.js'] - }); - }); - - t.end(); -}); - -test('mug', function (t) { - var dir = path.join(__dirname, 'resolver'); - t.equal( - resolve.sync('./mug', { basedir: dir }), - path.join(dir, 'mug.js') - ); - - t.equal( - resolve.sync('./mug', { - basedir: dir, - extensions: ['.coffee', '.js'] - }), - path.join(dir, 'mug.coffee') - ); - - t.equal( - resolve.sync('./mug', { - basedir: dir, - extensions: ['.js', '.coffee'] - }), - path.join(dir, 'mug.js') - ); - - t.end(); -}); - -test('other path', function (t) { - var resolverDir = path.join(__dirname, 'resolver'); - var dir = path.join(resolverDir, 'bar'); - var otherDir = path.join(resolverDir, 'other_path'); - - t.equal( - resolve.sync('root', { - basedir: dir, - paths: [otherDir] - }), - path.join(resolverDir, 'other_path/root.js') - ); - - t.equal( - resolve.sync('lib/other-lib', { - basedir: dir, - paths: [otherDir] - }), - path.join(resolverDir, 'other_path/lib/other-lib.js') - ); - - t.throws(function () { - resolve.sync('root', { basedir: dir }); - }); - - t.throws(function () { - resolve.sync('zzz', { - basedir: dir, - paths: [otherDir] - }); - }); - - t.end(); -}); - -test('path iterator', function (t) { - var resolverDir = path.join(__dirname, 'resolver'); - - var exactIterator = function (x, start, getPackageCandidates, opts) { - return [path.join(resolverDir, x)]; - }; - - t.equal( - resolve.sync('baz', { packageIterator: exactIterator }), - path.join(resolverDir, 'baz/quux.js') - ); - - t.end(); -}); - -test('incorrect main', function (t) { - var resolverDir = path.join(__dirname, 'resolver'); - var dir = path.join(resolverDir, 'incorrect_main'); - - t.equal( - resolve.sync('./incorrect_main', { basedir: resolverDir }), - path.join(dir, 'index.js') - ); - - t.end(); -}); - -var stubStatSync = function stubStatSync(fn) { - var fs = require('fs'); - var statSync = fs.statSync; - try { - fs.statSync = function () { - throw new EvalError('Unknown Error'); - }; - return fn(); - } finally { - fs.statSync = statSync; - } -}; - -test('#79 - re-throw non ENOENT errors from stat', function (t) { - var dir = path.join(__dirname, 'resolver'); - - stubStatSync(function () { - t.throws(function () { - resolve.sync('foo', { basedir: dir }); - }, /Unknown Error/); - }); - - t.end(); -}); - -test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { - var dir = path.join(__dirname, 'resolver'); - - t.equal( - resolve.sync('./foo', { basedir: path.join(dir, 'same_names') }), - path.join(dir, 'same_names/foo.js') - ); - t.equal( - resolve.sync('./foo/', { basedir: path.join(dir, 'same_names') }), - path.join(dir, 'same_names/foo/index.js') - ); - t.end(); -}); - -test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { - var dir = path.join(__dirname, 'resolver'); - - t.equal( - resolve.sync('./', { basedir: path.join(dir, 'same_names/foo') }), - path.join(dir, 'same_names/foo/index.js') - ); - t.equal( - resolve.sync('.', { basedir: path.join(dir, 'same_names/foo') }), - path.join(dir, 'same_names/foo/index.js') - ); - t.end(); -}); - -test('sync: #121 - treating an existing file as a dir when no basedir', function (t) { - var testFile = path.basename(__filename); - - t.test('sanity check', function (st) { - st.equal( - resolve.sync('./' + testFile), - __filename, - 'sanity check' - ); - st.end(); - }); - - t.test('with a fake directory', function (st) { - function run() { return resolve.sync('./' + testFile + '/blah'); } - - st.throws(run, 'throws an error'); - - try { - run(); - } catch (e) { - st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); - st.equal( - e.message, - 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', - 'can not find nonexistent module' - ); - } - - st.end(); - }); - - t.end(); -}); - -test('sync dot main', function (t) { - var start = new Date(); - t.equal(resolve.sync('./resolver/dot_main'), path.join(__dirname, 'resolver/dot_main/index.js')); - t.ok(new Date() - start < 50, 'resolve.sync timedout'); - t.end(); -}); - -test('sync dot slash main', function (t) { - var start = new Date(); - t.equal(resolve.sync('./resolver/dot_slash_main'), path.join(__dirname, 'resolver/dot_slash_main/index.js')); - t.ok(new Date() - start < 50, 'resolve.sync timedout'); - t.end(); -}); - -test('not a directory', function (t) { - var path = './foo'; - try { - resolve.sync(path, { basedir: __filename }); - t.fail(); - } catch (err) { - t.ok(err, 'a non-directory errors'); - t.equal(err && err.message, 'Cannot find module \'' + path + "' from '" + __filename + "'"); - t.equal(err && err.code, 'MODULE_NOT_FOUND'); - } - t.end(); -}); - -test('non-string "main" field in package.json', function (t) { - var dir = path.join(__dirname, 'resolver'); - try { - var result = resolve.sync('./invalid_main', { basedir: dir }); - t.equal(result, undefined, 'result should not exist'); - t.fail('should not get here'); - } catch (err) { - t.ok(err, 'errors on non-string main'); - t.equal(err.message, 'package “invalid main” `main` must be a string'); - t.equal(err.code, 'INVALID_PACKAGE_MAIN'); - } - t.end(); -}); - -test('non-string "main" field in package.json', function (t) { - var dir = path.join(__dirname, 'resolver'); - try { - var result = resolve.sync('./invalid_main', { basedir: dir }); - t.equal(result, undefined, 'result should not exist'); - t.fail('should not get here'); - } catch (err) { - t.ok(err, 'errors on non-string main'); - t.equal(err.message, 'package “invalid main” `main` must be a string'); - t.equal(err.code, 'INVALID_PACKAGE_MAIN'); - } - t.end(); -}); - -test('browser field in package.json', function (t) { - var dir = path.join(__dirname, 'resolver'); - var res = resolve.sync('./browser_field', { - basedir: dir, - packageFilter: function packageFilter(pkg) { - if (pkg.browser) { - pkg.main = pkg.browser; // eslint-disable-line no-param-reassign - delete pkg.browser; // eslint-disable-line no-param-reassign - } - return pkg; - } - }); - t.equal(res, path.join(dir, 'browser_field', 'b.js')); - t.end(); -}); diff --git a/node_modules/resolve/test/shadowed_core.js b/node_modules/resolve/test/shadowed_core.js deleted file mode 100644 index 98c52a7..0000000 --- a/node_modules/resolve/test/shadowed_core.js +++ /dev/null @@ -1,38 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); -var path = require('path'); - -test('shadowed core modules still return core module', function (t) { - t.plan(2); - - resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { - t.ifError(err); - t.equal(res, 'util'); - }); -}); - -test('shadowed core modules still return core module [sync]', function (t) { - t.plan(1); - - var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') }); - - t.equal(res, 'util'); -}); - -test('shadowed core modules return shadow when appending `/`', function (t) { - t.plan(2); - - resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { - t.ifError(err); - t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); - }); -}); - -test('shadowed core modules return shadow when appending `/` [sync]', function (t) { - t.plan(1); - - var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') }); - - t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); -}); - diff --git a/node_modules/resolve/test/shadowed_core/node_modules/util/index.js b/node_modules/resolve/test/shadowed_core/node_modules/util/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resolve/test/subdirs.js b/node_modules/resolve/test/subdirs.js deleted file mode 100644 index b7b8450..0000000 --- a/node_modules/resolve/test/subdirs.js +++ /dev/null @@ -1,13 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); -var path = require('path'); - -test('subdirs', function (t) { - t.plan(2); - - var dir = path.join(__dirname, '/subdirs'); - resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { - t.ifError(err); - t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); - }); -}); diff --git a/node_modules/resolve/test/symlinks.js b/node_modules/resolve/test/symlinks.js deleted file mode 100644 index 152d14e..0000000 --- a/node_modules/resolve/test/symlinks.js +++ /dev/null @@ -1,173 +0,0 @@ -var path = require('path'); -var fs = require('fs'); -var test = require('tape'); -var map = require('array.prototype.map'); -var resolve = require('../'); - -var symlinkDir = path.join(__dirname, 'resolver', 'symlinked', 'symlink'); -var packageDir = path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'package'); -var modADir = path.join(__dirname, 'symlinks', 'source', 'node_modules', 'mod-a'); -var symlinkModADir = path.join(__dirname, 'symlinks', 'dest', 'node_modules', 'mod-a'); -try { - fs.unlinkSync(symlinkDir); -} catch (err) {} -try { - fs.unlinkSync(packageDir); -} catch (err) {} -try { - fs.unlinkSync(modADir); -} catch (err) {} -try { - fs.unlinkSync(symlinkModADir); -} catch (err) {} - -try { - fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir'); -} catch (err) { - // if fails then it is probably on Windows and lets try to create a junction - fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction'); -} -try { - fs.symlinkSync('../../package', packageDir, 'dir'); -} catch (err) { - // if fails then it is probably on Windows and lets try to create a junction - fs.symlinkSync(path.join(__dirname, '..', '..', 'package') + '\\', packageDir, 'junction'); -} -try { - fs.symlinkSync('../../source/node_modules/mod-a', symlinkModADir, 'dir'); -} catch (err) { - // if fails then it is probably on Windows and lets try to create a junction - fs.symlinkSync(path.join(__dirname, '..', '..', 'source', 'node_modules', 'mod-a') + '\\', symlinkModADir, 'junction'); -} - -test('symlink', function (t) { - t.plan(2); - - resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) { - t.error(err); - t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); - }); -}); - -test('sync symlink when preserveSymlinks = true', function (t) { - t.plan(4); - - resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) { - t.ok(err, 'there is an error'); - t.notOk(res, 'no result'); - - t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); - t.equal( - err && err.message, - 'Cannot find module \'foo\' from \'' + symlinkDir + '\'', - 'can not find nonexistent module' - ); - }); -}); - -test('sync symlink', function (t) { - var start = new Date(); - t.doesNotThrow(function () { - t.equal(resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); - }); - t.ok(new Date() - start < 50, 'resolve.sync timedout'); - t.end(); -}); - -test('sync symlink when preserveSymlinks = true', function (t) { - t.throws(function () { - resolve.sync('foo', { basedir: symlinkDir }); - }, /Cannot find module 'foo'/); - t.end(); -}); - -test('sync symlink from node_modules to other dir when preserveSymlinks = false', function (t) { - var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); - var fn = resolve.sync('package', { basedir: basedir, preserveSymlinks: false }); - - t.equal(fn, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); - t.end(); -}); - -test('async symlink from node_modules to other dir when preserveSymlinks = false', function (t) { - t.plan(2); - var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); - resolve('package', { basedir: basedir, preserveSymlinks: false }, function (err, result) { - t.notOk(err, 'no error'); - t.equal(result, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); - }); -}); - -test('packageFilter', function (t) { - function relative(x) { - return path.relative(__dirname, x); - } - - function testPackageFilter(preserveSymlinks) { - return function (st) { - st.plan('is 1.x' ? 3 : 5); // eslint-disable-line no-constant-condition - - var destMain = 'symlinks/dest/node_modules/mod-a/index.js'; - var destPkg = 'symlinks/dest/node_modules/mod-a/package.json'; - var sourceMain = 'symlinks/source/node_modules/mod-a/index.js'; - var sourcePkg = 'symlinks/source/node_modules/mod-a/package.json'; - var destDir = path.join(__dirname, 'symlinks', 'dest'); - - /* eslint multiline-comment-style: 0 */ - /* v2.x will restore these tests - var packageFilterPath = []; - var actualPath = resolve.sync('mod-a', { - basedir: destDir, - preserveSymlinks: preserveSymlinks, - packageFilter: function (pkg, pkgfile, dir) { - packageFilterPath.push(pkgfile); - } - }); - st.equal( - relative(actualPath), - path.normalize(preserveSymlinks ? destMain : sourceMain), - 'sync: actual path is correct' - ); - st.deepEqual( - map(packageFilterPath, relative), - map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize), - 'sync: packageFilter pkgfile arg is correct' - ); - */ - - var asyncPackageFilterPath = []; - resolve( - 'mod-a', - { - basedir: destDir, - preserveSymlinks: preserveSymlinks, - packageFilter: function (pkg, pkgfile) { - asyncPackageFilterPath.push(pkgfile); - } - }, - function (err, actualPath) { - st.error(err, 'no error'); - st.equal( - relative(actualPath), - path.normalize(preserveSymlinks ? destMain : sourceMain), - 'async: actual path is correct' - ); - st.deepEqual( - map(asyncPackageFilterPath, relative), - map( - preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg], - path.normalize - ), - 'async: packageFilter pkgfile arg is correct' - ); - } - ); - }; - } - - t.test('preserveSymlinks: false', testPackageFilter(false)); - - t.test('preserveSymlinks: true', testPackageFilter(true)); - - t.end(); -}); diff --git a/node_modules/rimraf/LICENSE b/node_modules/rimraf/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/rimraf/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/rimraf/README.md b/node_modules/rimraf/README.md deleted file mode 100644 index 423b8cf..0000000 --- a/node_modules/rimraf/README.md +++ /dev/null @@ -1,101 +0,0 @@ -[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies) - -The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node. - -Install with `npm install rimraf`, or just drop rimraf.js somewhere. - -## API - -`rimraf(f, [opts], callback)` - -The first parameter will be interpreted as a globbing pattern for files. If you -want to disable globbing you can do so with `opts.disableGlob` (defaults to -`false`). This might be handy, for instance, if you have filenames that contain -globbing wildcard characters. - -The callback will be called with an error if there is one. Certain -errors are handled for you: - -* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of - `opts.maxBusyTries` times before giving up, adding 100ms of wait - between each attempt. The default `maxBusyTries` is 3. -* `ENOENT` - If the file doesn't exist, rimraf will return - successfully, since your desired outcome is already the case. -* `EMFILE` - Since `readdir` requires opening a file descriptor, it's - possible to hit `EMFILE` if too many file descriptors are in use. - In the sync case, there's nothing to be done for this. But in the - async case, rimraf will gradually back off with timeouts up to - `opts.emfileWait` ms, which defaults to 1000. - -## options - -* unlink, chmod, stat, lstat, rmdir, readdir, - unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync - - In order to use a custom file system library, you can override - specific fs functions on the options object. - - If any of these functions are present on the options object, then - the supplied function will be used instead of the default fs - method. - - Sync methods are only relevant for `rimraf.sync()`, of course. - - For example: - - ```javascript - var myCustomFS = require('some-custom-fs') - - rimraf('some-thing', myCustomFS, callback) - ``` - -* maxBusyTries - - If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered - on Windows systems, then rimraf will retry with a linear backoff - wait of 100ms longer on each try. The default maxBusyTries is 3. - - Only relevant for async usage. - -* emfileWait - - If an `EMFILE` error is encountered, then rimraf will retry - repeatedly with a linear backoff of 1ms longer on each try, until - the timeout counter hits this max. The default limit is 1000. - - If you repeatedly encounter `EMFILE` errors, then consider using - [graceful-fs](http://npm.im/graceful-fs) in your program. - - Only relevant for async usage. - -* glob - - Set to `false` to disable [glob](http://npm.im/glob) pattern - matching. - - Set to an object to pass options to the glob module. The default - glob options are `{ nosort: true, silent: true }`. - - Glob version 6 is used in this module. - - Relevant for both sync and async usage. - -* disableGlob - - Set to any non-falsey value to disable globbing entirely. - (Equivalent to setting `glob: false`.) - -## rimraf.sync - -It can remove stuff synchronously, too. But that's not so good. Use -the async API. It's better. - -## CLI - -If installed with `npm install rimraf -g` it can be used as a global -command `rimraf [ ...]` which is useful for cross platform support. - -## mkdirp - -If you need to create a directory recursively, check out -[mkdirp](https://github.com/substack/node-mkdirp). diff --git a/node_modules/rimraf/bin.js b/node_modules/rimraf/bin.js deleted file mode 100755 index 0d1e17b..0000000 --- a/node_modules/rimraf/bin.js +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env node - -var rimraf = require('./') - -var help = false -var dashdash = false -var noglob = false -var args = process.argv.slice(2).filter(function(arg) { - if (dashdash) - return !!arg - else if (arg === '--') - dashdash = true - else if (arg === '--no-glob' || arg === '-G') - noglob = true - else if (arg === '--glob' || arg === '-g') - noglob = false - else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) - help = true - else - return !!arg -}) - -if (help || args.length === 0) { - // If they didn't ask for help, then this is not a "success" - var log = help ? console.log : console.error - log('Usage: rimraf [ ...]') - log('') - log(' Deletes all files and folders at "path" recursively.') - log('') - log('Options:') - log('') - log(' -h, --help Display this usage info') - log(' -G, --no-glob Do not expand glob patterns in arguments') - log(' -g, --glob Expand glob patterns in arguments (default)') - process.exit(help ? 0 : 1) -} else - go(0) - -function go (n) { - if (n >= args.length) - return - var options = {} - if (noglob) - options = { glob: false } - rimraf(args[n], options, function (er) { - if (er) - throw er - go(n+1) - }) -} diff --git a/node_modules/rimraf/package.json b/node_modules/rimraf/package.json deleted file mode 100644 index f227d2b..0000000 --- a/node_modules/rimraf/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_from": "rimraf@^2.6.1", - "_id": "rimraf@2.7.1", - "_inBundle": false, - "_integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "_location": "/rimraf", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "rimraf@^2.6.1", - "name": "rimraf", - "escapedName": "rimraf", - "rawSpec": "^2.6.1", - "saveSpec": null, - "fetchSpec": "^2.6.1" - }, - "_requiredBy": [ - "/node-pre-gyp" - ], - "_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "_shasum": "35797f13a7fdadc566142c29d4f07ccad483e3ec", - "_spec": "rimraf@^2.6.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/node-pre-gyp", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bin": { - "rimraf": "bin.js" - }, - "bugs": { - "url": "https://github.com/isaacs/rimraf/issues" - }, - "bundleDependencies": false, - "dependencies": { - "glob": "^7.1.3" - }, - "deprecated": false, - "description": "A deep deletion module for node (like `rm -rf`)", - "devDependencies": { - "mkdirp": "^0.5.1", - "tap": "^12.1.1" - }, - "files": [ - "LICENSE", - "README.md", - "bin.js", - "rimraf.js" - ], - "homepage": "https://github.com/isaacs/rimraf#readme", - "license": "ISC", - "main": "rimraf.js", - "name": "rimraf", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/rimraf.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js" - }, - "version": "2.7.1" -} diff --git a/node_modules/rimraf/rimraf.js b/node_modules/rimraf/rimraf.js deleted file mode 100644 index a90ad02..0000000 --- a/node_modules/rimraf/rimraf.js +++ /dev/null @@ -1,372 +0,0 @@ -module.exports = rimraf -rimraf.sync = rimrafSync - -var assert = require("assert") -var path = require("path") -var fs = require("fs") -var glob = undefined -try { - glob = require("glob") -} catch (_err) { - // treat glob as optional. -} -var _0666 = parseInt('666', 8) - -var defaultGlobOpts = { - nosort: true, - silent: true -} - -// for EMFILE handling -var timeout = 0 - -var isWindows = (process.platform === "win32") - -function defaults (options) { - var methods = [ - 'unlink', - 'chmod', - 'stat', - 'lstat', - 'rmdir', - 'readdir' - ] - methods.forEach(function(m) { - options[m] = options[m] || fs[m] - m = m + 'Sync' - options[m] = options[m] || fs[m] - }) - - options.maxBusyTries = options.maxBusyTries || 3 - options.emfileWait = options.emfileWait || 1000 - if (options.glob === false) { - options.disableGlob = true - } - if (options.disableGlob !== true && glob === undefined) { - throw Error('glob dependency not found, set `options.disableGlob = true` if intentional') - } - options.disableGlob = options.disableGlob || false - options.glob = options.glob || defaultGlobOpts -} - -function rimraf (p, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } - - assert(p, 'rimraf: missing path') - assert.equal(typeof p, 'string', 'rimraf: path should be a string') - assert.equal(typeof cb, 'function', 'rimraf: callback function required') - assert(options, 'rimraf: invalid options argument provided') - assert.equal(typeof options, 'object', 'rimraf: options should be object') - - defaults(options) - - var busyTries = 0 - var errState = null - var n = 0 - - if (options.disableGlob || !glob.hasMagic(p)) - return afterGlob(null, [p]) - - options.lstat(p, function (er, stat) { - if (!er) - return afterGlob(null, [p]) - - glob(p, options.glob, afterGlob) - }) - - function next (er) { - errState = errState || er - if (--n === 0) - cb(errState) - } - - function afterGlob (er, results) { - if (er) - return cb(er) - - n = results.length - if (n === 0) - return cb() - - results.forEach(function (p) { - rimraf_(p, options, function CB (er) { - if (er) { - if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && - busyTries < options.maxBusyTries) { - busyTries ++ - var time = busyTries * 100 - // try again, with the same exact callback as this one. - return setTimeout(function () { - rimraf_(p, options, CB) - }, time) - } - - // this one won't happen if graceful-fs is used. - if (er.code === "EMFILE" && timeout < options.emfileWait) { - return setTimeout(function () { - rimraf_(p, options, CB) - }, timeout ++) - } - - // already gone - if (er.code === "ENOENT") er = null - } - - timeout = 0 - next(er) - }) - }) - } -} - -// Two possible strategies. -// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR -// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR -// -// Both result in an extra syscall when you guess wrong. However, there -// are likely far more normal files in the world than directories. This -// is based on the assumption that a the average number of files per -// directory is >= 1. -// -// If anyone ever complains about this, then I guess the strategy could -// be made configurable somehow. But until then, YAGNI. -function rimraf_ (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - - // sunos lets the root user unlink directories, which is... weird. - // so we have to lstat here and make sure it's not a dir. - options.lstat(p, function (er, st) { - if (er && er.code === "ENOENT") - return cb(null) - - // Windows can EPERM on stat. Life is suffering. - if (er && er.code === "EPERM" && isWindows) - fixWinEPERM(p, options, er, cb) - - if (st && st.isDirectory()) - return rmdir(p, options, er, cb) - - options.unlink(p, function (er) { - if (er) { - if (er.code === "ENOENT") - return cb(null) - if (er.code === "EPERM") - return (isWindows) - ? fixWinEPERM(p, options, er, cb) - : rmdir(p, options, er, cb) - if (er.code === "EISDIR") - return rmdir(p, options, er, cb) - } - return cb(er) - }) - }) -} - -function fixWinEPERM (p, options, er, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - if (er) - assert(er instanceof Error) - - options.chmod(p, _0666, function (er2) { - if (er2) - cb(er2.code === "ENOENT" ? null : er) - else - options.stat(p, function(er3, stats) { - if (er3) - cb(er3.code === "ENOENT" ? null : er) - else if (stats.isDirectory()) - rmdir(p, options, er, cb) - else - options.unlink(p, cb) - }) - }) -} - -function fixWinEPERMSync (p, options, er) { - assert(p) - assert(options) - if (er) - assert(er instanceof Error) - - try { - options.chmodSync(p, _0666) - } catch (er2) { - if (er2.code === "ENOENT") - return - else - throw er - } - - try { - var stats = options.statSync(p) - } catch (er3) { - if (er3.code === "ENOENT") - return - else - throw er - } - - if (stats.isDirectory()) - rmdirSync(p, options, er) - else - options.unlinkSync(p) -} - -function rmdir (p, options, originalEr, cb) { - assert(p) - assert(options) - if (originalEr) - assert(originalEr instanceof Error) - assert(typeof cb === 'function') - - // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) - // if we guessed wrong, and it's not a directory, then - // raise the original error. - options.rmdir(p, function (er) { - if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) - rmkids(p, options, cb) - else if (er && er.code === "ENOTDIR") - cb(originalEr) - else - cb(er) - }) -} - -function rmkids(p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - - options.readdir(p, function (er, files) { - if (er) - return cb(er) - var n = files.length - if (n === 0) - return options.rmdir(p, cb) - var errState - files.forEach(function (f) { - rimraf(path.join(p, f), options, function (er) { - if (errState) - return - if (er) - return cb(errState = er) - if (--n === 0) - options.rmdir(p, cb) - }) - }) - }) -} - -// this looks simpler, and is strictly *faster*, but will -// tie up the JavaScript thread and fail on excessively -// deep directory trees. -function rimrafSync (p, options) { - options = options || {} - defaults(options) - - assert(p, 'rimraf: missing path') - assert.equal(typeof p, 'string', 'rimraf: path should be a string') - assert(options, 'rimraf: missing options') - assert.equal(typeof options, 'object', 'rimraf: options should be object') - - var results - - if (options.disableGlob || !glob.hasMagic(p)) { - results = [p] - } else { - try { - options.lstatSync(p) - results = [p] - } catch (er) { - results = glob.sync(p, options.glob) - } - } - - if (!results.length) - return - - for (var i = 0; i < results.length; i++) { - var p = results[i] - - try { - var st = options.lstatSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - - // Windows can EPERM on stat. Life is suffering. - if (er.code === "EPERM" && isWindows) - fixWinEPERMSync(p, options, er) - } - - try { - // sunos lets the root user unlink directories, which is... weird. - if (st && st.isDirectory()) - rmdirSync(p, options, null) - else - options.unlinkSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - if (er.code === "EPERM") - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) - if (er.code !== "EISDIR") - throw er - - rmdirSync(p, options, er) - } - } -} - -function rmdirSync (p, options, originalEr) { - assert(p) - assert(options) - if (originalEr) - assert(originalEr instanceof Error) - - try { - options.rmdirSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - if (er.code === "ENOTDIR") - throw originalEr - if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") - rmkidsSync(p, options) - } -} - -function rmkidsSync (p, options) { - assert(p) - assert(options) - options.readdirSync(p).forEach(function (f) { - rimrafSync(path.join(p, f), options) - }) - - // We only end up here once we got ENOTEMPTY at least once, and - // at this point, we are guaranteed to have removed all the kids. - // So, we know that it won't be ENOENT or ENOTDIR or anything else. - // try really hard to delete stuff on windows, because it has a - // PROFOUNDLY annoying habit of not closing handles promptly when - // files are deleted, resulting in spurious ENOTEMPTY errors. - var retries = isWindows ? 100 : 1 - var i = 0 - do { - var threw = true - try { - var ret = options.rmdirSync(p, options) - threw = false - return ret - } finally { - if (++i < retries && threw) - continue - } - } while (true) -} diff --git a/node_modules/rw/.eslintrc b/node_modules/rw/.eslintrc deleted file mode 100644 index bbad380..0000000 --- a/node_modules/rw/.eslintrc +++ /dev/null @@ -1,5 +0,0 @@ -env: - node: true - -extends: - "eslint:recommended" diff --git a/node_modules/rw/.npmignore b/node_modules/rw/.npmignore deleted file mode 100644 index e5c7a3b..0000000 --- a/node_modules/rw/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -.DS_Store -node_modules -test/input.txt diff --git a/node_modules/rw/LICENSE b/node_modules/rw/LICENSE deleted file mode 100644 index da8230d..0000000 --- a/node_modules/rw/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2014-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. diff --git a/node_modules/rw/README.md b/node_modules/rw/README.md deleted file mode 100644 index b3c2f71..0000000 --- a/node_modules/rw/README.md +++ /dev/null @@ -1,120 +0,0 @@ -# rw - Now stdin and stdout are files. - -How do you read a file from stdin? If you thought, - -```js -var contents = fs.readFileSync("/dev/stdin", "utf8"); -``` - -you’d be wrong, because Node only reads up to the size of the file reported by fs.stat rather than reading until it receives an EOF. So, if you redirect a file to your program (`cat file | program`), you’ll only read the first 65,536 bytes of your file. Oops. - -What about writing a file to stdout? If you thought, - -```js -fs.writeFileSync("/dev/stdout", contents, "utf8"); -``` - -you’d also be wrong, because this tries to close stdout, so you get this error: - -``` -Error: UNKNOWN, unknown error - at Object.fs.writeSync (fs.js:528:18) - at Object.fs.writeFileSync (fs.js:975:21) -``` - -(Also, this doesn’t work on Windows, because Windows doesn’t support /dev/stdout, /dev/stdin and /dev/stderr!) - -Shucks. So what should you do? - -You could use a different pattern for reading from stdin: - -```js -var chunks = []; - -process.stdin - .on("data", function(chunk) { chunks.push(chunk); }) - .on("end", function() { console.log(chunks.join("").length); }) - .setEncoding("utf8"); -``` - -But that’s a pain, since now your code has two different code paths for reading inputs depending on whether you’re reading a real file or stdin. And the code gets even more complex if you want to [read that file synchronously](https://github.com/mbostock/rw/blob/master/lib/rw/read-file-sync.js). - -You could also try a different pattern for writing to stdout: - -```js -process.stdout.write(contents); -``` - -Or even: - -```js -console.log(contents); -``` - -But if you try to pipe your output to `head`, you’ll get this error: - -``` -Error: write EPIPE - at errnoException (net.js:904:11) - at Object.afterWrite (net.js:720:19) -``` - -Huh. - -The **rw** module fixes these problems. It provides an interface just like readFile, readFileSync, writeFile and writeFileSync, but with implementations that work the way you expect on stdin and stdout. If you use these methods on files other than /dev/stdin or /dev/stdout, they simply delegate to the fs methods, so you can trust that they behave identically to the methods you’re used to. - -For example, now you can read stdin synchronously like so: - -```js -var contents = rw.readFileSync("/dev/stdin", "utf8"); -``` - -Or to write to stdout: - -```js -rw.writeFileSync("/dev/stdout", contents, "utf8"); -``` - -And rw automatically squashes EPIPE errors, so you can pipe the output of your program to `head` and you won’t get a spurious stack trace. - -To install, `npm install rw`. - -### Note - -If you want to read synchronously from stdin using [readFileSync](#readFileSync), you cannot also use process.stdin in the same program. Likewise, if you want to write synchronously to stdout or stderr using [writeFileSync](#writeFileSync), you cannot use process.stdout or process.stderr, respectively. (This includes using console.log and the like!) Failure to heed this warning may result in error: EAGAIN, resource temporarily unavailable. Unfortunately, it does not appear possible for this library to fix this issue automatically, so please use caution. - -Only the asynchronous methods [readFile](#readFile) and [writeFile](#writeFile) are supported on Windows. Node has no synchronous API for reading from process.[stdin](https://nodejs.org/api/process.html#process_process_stdin) or writing to process.[stdout](https://nodejs.org/api/process.html#process_process_stdout) or process.[stderr](https://nodejs.org/api/process.html#process_process_stderr), so you’re out of luck! - -## API Reference - -# rw.readFile(path[, options], callback) - -Reads the file at the specified *path* completely into memory, invoking the specified *callback* once the data is available and the file is closed. The *callback* is invoked with two arguments: the *error* that occurred during read (hopefully null), and the read data. If *options* is a string, it specifies the encoding to use, in which case the read data will be a string; otherwise *options* is an object, and may specify encoding and flag properties. This method is a drop-in replacement for [fs.readFile](https://nodejs.org/api/fs.html#fs_fs_readfile_file_options_callback) and fixes the behavior of special files such as /dev/stdin. - -# rw.readFileSync(path[, options]) - -Reads the file at the specified *path* completely into memory, synchronously, returning the data. If an error occurred during read, this function throws an error instead. If *options* is a string, it specifies the encoding to use, in which case the read data will be a string; otherwise *options* is an object, and may specify encoding and flag properties. This method is a drop-in replacement for [fs.readFileSync](https://nodejs.org/api/fs.html#fs_fs_readfilesync_file_options) and fixes the behavior of special files such as /dev/stdin. - -# rw.writeFile(path, data[, options], callback) - -Writes the specified *data* (completely in memory) to a file at the specified *path*, invoking the specified *callback* once the data is completely written and the file is closed. The *callback* is invoked with a single argument: the *error* that occurred during write (hopefully null). If *options* is a string, it specifies the encoding to use, in which case the *data* must be a string; otherwise *options* is an object, and may specify encoding, mode and flag properties. This method is a drop-in replacement for [fs.writeFile](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) and fixes the behavior of special files such as /dev/stdout. - -# rw.writeFileSync(path, data[, options]) - -Writes the specified *data* (completely in memory) to a file at the specified *path*, synchronously, returning once the data is completely written and the file is closed. Throws an *error* if one occurs during write. If *options* is a string, it specifies the encoding to use, in which case the *data* must be a string; otherwise *options* is an object, and may specify encoding, mode and flag properties. This method is a drop-in replacement for [fs.writeFileSync](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options) and fixes the behavior of special files such as /dev/stdout. - -# rw.dash.readFile(path[, options], callback) - -Equivalent to [rw.readFile](#readFile), except treats a *path* of `-` as `/dev/stdin`. Useful for command-line arguments. - -# rw.dash.readFileSync(path[, options]) - -Equivalent to [rw.readFileSync](#readFileSync), except treats a *path* of `-` as `/dev/stdin`. Useful for command-line arguments. - -# rw.dash.writeFile(path, data[, options], callback) - -Equivalent to [rw.writeFile](#writeFile), except treats a *path* of `-` as `/dev/stdout`. Useful for command-line arguments. - -# rw.dash.writeFileSync(path, data[, options]) - -Equivalent to [rw.writeFileSync](#writeFileSync), except treats a *path* of `-` as `/dev/stdout`. Useful for command-line arguments. diff --git a/node_modules/rw/index.js b/node_modules/rw/index.js deleted file mode 100644 index b0c9dc6..0000000 --- a/node_modules/rw/index.js +++ /dev/null @@ -1,5 +0,0 @@ -exports.dash = require("./lib/rw/dash"); -exports.readFile = require("./lib/rw/read-file"); -exports.readFileSync = require("./lib/rw/read-file-sync"); -exports.writeFile = require("./lib/rw/write-file"); -exports.writeFileSync = require("./lib/rw/write-file-sync"); diff --git a/node_modules/rw/lib/rw/dash.js b/node_modules/rw/lib/rw/dash.js deleted file mode 100644 index 0c005f1..0000000 --- a/node_modules/rw/lib/rw/dash.js +++ /dev/null @@ -1,14 +0,0 @@ -var slice = Array.prototype.slice; - -function dashify(method, file) { - return function(path) { - var argv = arguments; - if (path == "-") (argv = slice.call(argv)).splice(0, 1, file); - return method.apply(null, argv); - }; -} - -exports.readFile = dashify(require("./read-file"), "/dev/stdin"); -exports.readFileSync = dashify(require("./read-file-sync"), "/dev/stdin"); -exports.writeFile = dashify(require("./write-file"), "/dev/stdout"); -exports.writeFileSync = dashify(require("./write-file-sync"), "/dev/stdout"); diff --git a/node_modules/rw/lib/rw/decode.js b/node_modules/rw/lib/rw/decode.js deleted file mode 100644 index 008779b..0000000 --- a/node_modules/rw/lib/rw/decode.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = function(options) { - if (options) { - if (typeof options === "string") return encoding(options); - if (options.encoding !== null) return encoding(options.encoding); - } - return identity(); -}; - -function identity() { - var chunks = []; - return { - push: function(chunk) { chunks.push(chunk); }, - value: function() { return Buffer.concat(chunks); } - }; -} - -function encoding(encoding) { - var chunks = []; - return { - push: function(chunk) { chunks.push(chunk); }, - value: function() { return Buffer.concat(chunks).toString(encoding); } - }; -} diff --git a/node_modules/rw/lib/rw/encode.js b/node_modules/rw/lib/rw/encode.js deleted file mode 100644 index 4a3926e..0000000 --- a/node_modules/rw/lib/rw/encode.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = function(data, options) { - return typeof data === "string" - ? new Buffer(data, typeof options === "string" ? options - : options && options.encoding !== null ? options.encoding - : "utf8") - : data; -}; diff --git a/node_modules/rw/lib/rw/read-file-sync.js b/node_modules/rw/lib/rw/read-file-sync.js deleted file mode 100644 index 374c2a0..0000000 --- a/node_modules/rw/lib/rw/read-file-sync.js +++ /dev/null @@ -1,29 +0,0 @@ -var fs = require("fs"), - decode = require("./decode"); - -module.exports = function(filename, options) { - if (fs.statSync(filename).isFile()) { - return fs.readFileSync(filename, options); - } else { - var fd = fs.openSync(filename, options && options.flag || "r"), - decoder = decode(options); - - while (true) { // eslint-disable-line no-constant-condition - try { - var buffer = new Buffer(bufferSize), - bytesRead = fs.readSync(fd, buffer, 0, bufferSize); - } catch (e) { - if (e.code === "EOF") break; - fs.closeSync(fd); - throw e; - } - if (bytesRead === 0) break; - decoder.push(buffer.slice(0, bytesRead)); - } - - fs.closeSync(fd); - return decoder.value(); - } -}; - -var bufferSize = 1 << 16; diff --git a/node_modules/rw/lib/rw/read-file.js b/node_modules/rw/lib/rw/read-file.js deleted file mode 100644 index 02aa122..0000000 --- a/node_modules/rw/lib/rw/read-file.js +++ /dev/null @@ -1,23 +0,0 @@ -var fs = require("fs"), - decode = require("./decode"); - -module.exports = function(path, options, callback) { - if (arguments.length < 3) callback = options, options = null; - - switch (path) { - case "/dev/stdin": return readStream(process.stdin, options, callback); - } - - fs.stat(path, function(error, stat) { - if (error) return callback(error); - if (stat.isFile()) return fs.readFile(path, options, callback); - readStream(fs.createReadStream(path, options ? {flags: options.flag || "r"} : {}), options, callback); // N.B. flag / flags - }); -}; - -function readStream(stream, options, callback) { - var decoder = decode(options); - stream.on("error", callback); - stream.on("data", function(d) { decoder.push(d); }); - stream.on("end", function() { callback(null, decoder.value()); }); -} diff --git a/node_modules/rw/lib/rw/write-file-sync.js b/node_modules/rw/lib/rw/write-file-sync.js deleted file mode 100644 index 0b04a2a..0000000 --- a/node_modules/rw/lib/rw/write-file-sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var fs = require("fs"), - encode = require("./encode"); - -module.exports = function(filename, data, options) { - var stat; - - try { - stat = fs.statSync(filename); - } catch (error) { - if (error.code !== "ENOENT") throw error; - } - - if (!stat || stat.isFile()) { - fs.writeFileSync(filename, data, options); - } else { - var fd = fs.openSync(filename, options && options.flag || "w"), - bytesWritten = 0, - bytesTotal = (data = encode(data, options)).length; - - while (bytesWritten < bytesTotal) { - try { - bytesWritten += fs.writeSync(fd, data, bytesWritten, bytesTotal - bytesWritten, null); - } catch (error) { - if (error.code === "EPIPE") break; // ignore broken pipe, e.g., | head - fs.closeSync(fd); - throw error; - } - } - - fs.closeSync(fd); - } -}; diff --git a/node_modules/rw/lib/rw/write-file.js b/node_modules/rw/lib/rw/write-file.js deleted file mode 100644 index 2e2c0b2..0000000 --- a/node_modules/rw/lib/rw/write-file.js +++ /dev/null @@ -1,22 +0,0 @@ -var fs = require("fs"), - encode = require("./encode"); - -module.exports = function(path, data, options, callback) { - if (arguments.length < 4) callback = options, options = null; - - switch (path) { - case "/dev/stdout": return writeStream(process.stdout, "write", data, options, callback); - case "/dev/stderr": return writeStream(process.stderr, "write", data, options, callback); - } - - fs.stat(path, function(error, stat) { - if (error && error.code !== "ENOENT") return callback(error); - if (stat && stat.isFile()) return fs.writeFile(path, data, options, callback); - writeStream(fs.createWriteStream(path, options ? {flags: options.flag || "w"} : {}), "end", data, options, callback); // N.B. flag / flags - }); -}; - -function writeStream(stream, send, data, options, callback) { - stream.on("error", function(error) { callback(error.code === "EPIPE" ? null : error); }); // ignore broken pipe, e.g., | head - stream[send](encode(data, options), function(error) { callback(error && error.code === "EPIPE" ? null : error); }); -} diff --git a/node_modules/rw/package.json b/node_modules/rw/package.json deleted file mode 100644 index 23667ca..0000000 --- a/node_modules/rw/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "_from": "rw@1", - "_id": "rw@1.3.3", - "_inBundle": false, - "_integrity": "sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=", - "_location": "/rw", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "rw@1", - "name": "rw", - "escapedName": "rw", - "rawSpec": "1", - "saveSpec": null, - "fetchSpec": "1" - }, - "_requiredBy": [ - "/d3-dsv" - ], - "_resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", - "_shasum": "3f862dfa91ab766b14885ef4d01124bfda074fb4", - "_spec": "rw@1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/d3-dsv", - "author": { - "name": "Mike Bostock", - "url": "http://bost.ocks.org/mike" - }, - "bugs": { - "url": "https://github.com/mbostock/rw/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Now stdin and stdout are files.", - "devDependencies": { - "d3-queue": "3", - "eslint": "3" - }, - "homepage": "https://github.com/mbostock/rw", - "keywords": [ - "fs", - "readFile", - "writeFile", - "stdin", - "stdout" - ], - "license": "BSD-3-Clause", - "main": "index.js", - "name": "rw", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/mbostock/rw.git" - }, - "scripts": { - "postpublish": "git push && git push --tags", - "prepublish": "npm test", - "test": "test/run-tests && eslint index.js lib" - }, - "version": "1.3.3" -} diff --git a/node_modules/rw/test/cat-async b/node_modules/rw/test/cat-async deleted file mode 100755 index f229958..0000000 --- a/node_modules/rw/test/cat-async +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -rw.readFile(process.argv[2] || "-", "utf8", function(error, contents) { - if (error) throw error; - rw.writeFile("-", contents, "utf8", function(error) { - if (error) throw error; - }); -}); diff --git a/node_modules/rw/test/cat-sync b/node_modules/rw/test/cat-sync deleted file mode 100755 index 9ef307f..0000000 --- a/node_modules/rw/test/cat-sync +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -rw.writeFileSync("-", rw.readFileSync(process.argv[2] || "-", "utf8"), "utf8"); diff --git a/node_modules/rw/test/encode-object-async b/node_modules/rw/test/encode-object-async deleted file mode 100755 index 0351d63..0000000 --- a/node_modules/rw/test/encode-object-async +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -rw.writeFile(process.argv[2] || "-", "gréén\n", {encoding: process.argv[3]}, function(error) { - if (error) throw error; -}); diff --git a/node_modules/rw/test/encode-object-sync b/node_modules/rw/test/encode-object-sync deleted file mode 100755 index 60c641c..0000000 --- a/node_modules/rw/test/encode-object-sync +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -rw.writeFileSync(process.argv[2] || "-", "gréén\n", {encoding: process.argv[3]}); diff --git a/node_modules/rw/test/encode-string-async b/node_modules/rw/test/encode-string-async deleted file mode 100755 index 348e00c..0000000 --- a/node_modules/rw/test/encode-string-async +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -rw.writeFile(process.argv[2] || "-", "gréén\n", process.argv[3], function(error) { - if (error) throw error; -}); diff --git a/node_modules/rw/test/encode-string-sync b/node_modules/rw/test/encode-string-sync deleted file mode 100755 index 5fdc4c3..0000000 --- a/node_modules/rw/test/encode-string-sync +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -rw.writeFileSync(process.argv[2] || "-", "gréén\n", process.argv[3]); diff --git a/node_modules/rw/test/encoding-async b/node_modules/rw/test/encoding-async deleted file mode 100755 index 9782c92..0000000 --- a/node_modules/rw/test/encoding-async +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env node - -var fs = require("fs"), - queue = require("d3-queue").queue, - rw = require("../"); - -var code = 0; - -queue(1) - .defer(testRead, "utf8", "gréén\n") - .defer(testRead, {encoding: "utf8"}, "gréén\n") - .defer(testRead, "ascii", "grC)C)n\n") - .defer(testRead, {encoding: "ascii"}, "grC)C)n\n") - .defer(testWrite, "utf8", "gréén\n") - .defer(testWrite, {encoding: "utf8"}, "gréén\n") - .defer(testWrite, "ascii", "gr��n\n") - .defer(testWrite, {encoding: "ascii"}, "gr��n\n") - .await(done); - -function testRead(options, expected, callback) { - rw.readFile("test/utf8.txt", options, function(error, actual) { - if (error) return void callback(error); - if (actual !== expected) console.warn(actual + " !== " + expected), code = 1; - callback(null); - }); -} - -function testWrite(options, expected, callback) { - rw.writeFile("test/encoding-async.out", "gréén\n", options, function(error) { - if (error) return void callback(error); - fs.readFile("test/encoding-async.out", "utf8", function(error, actual) { - if (error) return void callback(error); - if (actual !== expected) console.warn(actual + " !== " + expected), code = 1; - callback(null); - }); - }); -} - -function done(error) { - if (error) throw error; - process.exit(code); -} diff --git a/node_modules/rw/test/encoding-sync b/node_modules/rw/test/encoding-sync deleted file mode 100755 index 80f7e4e..0000000 --- a/node_modules/rw/test/encoding-sync +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env node - -var fs = require("fs"), - rw = require("../"); - -var code = 0, - actual, - expected; - -if ((actual = rw.readFileSync("test/utf8.txt", "utf8")) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected); -if ((actual = rw.readFileSync("test/utf8.txt", {encoding: "utf8"})) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected); -if ((actual = rw.readFileSync("test/utf8.txt", "ascii")) !== (expected = "grC)C)n\n")) code = 1, console.warn(actual + " !== " + expected); -if ((actual = rw.readFileSync("test/utf8.txt", {encoding: "ascii"})) !== (expected = "grC)C)n\n")) code = 1, console.warn(actual + " !== " + expected); - -rw.writeFileSync("test/encoding-sync.out", "gréén\n", "utf8"); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected); -rw.writeFileSync("test/encoding-sync.out", "gréén\n", {encoding: "utf8"}); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected); -rw.writeFileSync("test/encoding-sync.out", "gréén\n", "ascii"); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gr��n\n")) code = 1, console.warn(actual + " !== " + expected); -rw.writeFileSync("test/encoding-sync.out", "gréén\n", {encoding: "ascii"}); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gr��n\n")) code = 1, console.warn(actual + " !== " + expected); - -process.exit(code); diff --git a/node_modules/rw/test/run-tests b/node_modules/rw/test/run-tests deleted file mode 100755 index 5b3272f..0000000 --- a/node_modules/rw/test/run-tests +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -FILE=test/input.txt - -rm -f -- $FILE -for i in {1..10000}; do printf '%09X\n' $RANDOM >> $FILE; done - -function test() -{ - if [[ $1 -eq 0 ]] - then - echo -e "\x1B[1;32m✓ $2\x1B[0m" - else - echo -e "\x1B[1;31m✗ $2\x1B[0m" - fi -} - -test/encoding-sync; test $? "encoding-sync applies the specified encodings" -test/encoding-async; test $? "encoding-async applies the specified encodings" -[ "$(test/wc-async $FILE)" = "100000" ]; test $? "wc-async reads an entire file" -[ "$(test/wc-sync $FILE)" = "100000" ]; test $? "wc-sync reads an entire file" -[ "$(test/wc-async < $FILE)" = "100000" ]; test $? "wc-async reads an entire file from stdin" -[ "$(test/wc-sync < $FILE)" = "100000" ]; test $? "wc-sync reads an entire file from stdin" -[ "$(cat $FILE | test/wc-async)" = "100000" ]; test $? "wc-async reads an entire file from a pipe" -[ "$(cat $FILE | test/wc-sync)" = "100000" ]; test $? "wc-sync reads an entire file from a pipe" -[ "$(test/cat-async $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-async reads an entire file and writes it to a pipe" -[ "$(test/cat-sync $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-sync reads an entire file and writes it to a pipe" -[ "$(test/cat-async $FILE | test/wc-async)" = "100000" ]; test $? "cat-async reads an entire file and writes it to a pipe to wc-async " -[ "$(test/cat-async $FILE | test/wc-sync)" = "100000" ]; test $? "cat-async reads an entire file and writes it to a pipe to wc-sync " -[ "$(test/cat-sync $FILE | test/wc-async)" = "100000" ]; test $? "cat-sync reads an entire file and writes it to a pipe to wc-async " -[ "$(test/cat-sync $FILE | test/wc-sync)" = "100000" ]; test $? "cat-sync reads an entire file and writes it to a pipe to wc-sync " -[ "$(test/cat-async < $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-async reads an entire file from stdin and writes it to a pipe" -[ "$(test/cat-sync < $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-sync reads an entire file from stdin and writes it to a pipe" -[ "$(test/cat-async < $FILE | test/wc-async)" = "100000" ]; test $? "cat-async reads an entire file from stdin and writes it to a pipe to wc-async" -[ "$(test/cat-async < $FILE | test/wc-sync)" = "100000" ]; test $? "cat-async reads an entire file from stdin and writes it to a pipe to wc-sync" -[ "$(test/cat-sync < $FILE | test/wc-async)" = "100000" ]; test $? "cat-sync reads an entire file from stdin and writes it to a pipe to wc-async" -[ "$(test/cat-sync < $FILE | test/wc-sync)" = "100000" ]; test $? "cat-sync reads an entire file from stdin and writes it to a pipe to wc-sync" -[ "$(cat $FILE | test/cat-async | test/wc-async)" = "100000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to wc-async" -[ "$(cat $FILE | test/cat-async | test/wc-sync)" = "100000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to wc-sync" -[ "$(cat $FILE | test/cat-sync | test/wc-async)" = "100000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to wc-async" -[ "$(cat $FILE | test/cat-sync | test/wc-sync)" = "100000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to wc-sync" -[ "$(cat $FILE | test/cat-async | head -n 100 | test/wc-async)" = "1000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to head to wc-async" -[ "$(cat $FILE | test/cat-async | head -n 100 | test/wc-sync)" = "1000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to head to wc-sync" -[ "$(cat $FILE | test/cat-sync | head -n 100 | test/wc-async)" = "1000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to head to wc-async" -[ "$(cat $FILE | test/cat-sync | head -n 100 | test/wc-sync)" = "1000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to head to wc-sync" -[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-async | test/wc-async)" = "1000" ]; test $? "cat-async reads the head of a file from a pipe and writes it to wc-async" -[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-async | test/wc-sync)" = "1000" ]; test $? "cat-async reads the head of a file from a pipe and writes it to wc-sync" -[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-sync | test/wc-async)" = "1000" ]; test $? "cat-sync reads the head of a file from a pipe and writes it to wc-async" -[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-sync | test/wc-sync)" = "1000" ]; test $? "cat-sync reads the head of a file from a pipe and writes it to wc-sync" -[ "$(test/write-async test/write.out && cat test/write.out)" = "Hello, world!" ]; test $? "write-async writes an entire file" -[ "$(test/write-sync test/write.out && cat test/write.out)" = "Hello, world!" ]; test $? "write-sync writes an entire file" - -rm -f -- $FILE test/write.out test/encoding-sync.out test/encoding-async.out diff --git a/node_modules/rw/test/utf8.txt b/node_modules/rw/test/utf8.txt deleted file mode 100644 index 23bfe76..0000000 --- a/node_modules/rw/test/utf8.txt +++ /dev/null @@ -1 +0,0 @@ -gréén diff --git a/node_modules/rw/test/wc-async b/node_modules/rw/test/wc-async deleted file mode 100755 index 0810271..0000000 --- a/node_modules/rw/test/wc-async +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -rw.readFile(process.argv[2] || "-", function(error, contents) { - if (error) throw error; - console.log(contents.length); -}); diff --git a/node_modules/rw/test/wc-sync b/node_modules/rw/test/wc-sync deleted file mode 100755 index 6a8d1d7..0000000 --- a/node_modules/rw/test/wc-sync +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -console.log(rw.readFileSync(process.argv[2] || "-", "utf8").length); diff --git a/node_modules/rw/test/write-async b/node_modules/rw/test/write-async deleted file mode 100755 index 2444ad0..0000000 --- a/node_modules/rw/test/write-async +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -rw.writeFile(process.argv[2] || "-", "Hello, world!", "utf8", function(error) { - if (error) throw error; -}); diff --git a/node_modules/rw/test/write-sync b/node_modules/rw/test/write-sync deleted file mode 100755 index ef8d0d8..0000000 --- a/node_modules/rw/test/write-sync +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node - -var rw = require("../").dash; - -rw.writeFileSync(process.argv[2] || "-", "Hello, world!", "utf8"); diff --git a/node_modules/safe-buffer/LICENSE b/node_modules/safe-buffer/LICENSE deleted file mode 100644 index 0c068ce..0000000 --- a/node_modules/safe-buffer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Feross Aboukhadijeh - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/safe-buffer/README.md b/node_modules/safe-buffer/README.md deleted file mode 100644 index e9a81af..0000000 --- a/node_modules/safe-buffer/README.md +++ /dev/null @@ -1,584 +0,0 @@ -# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] - -[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg -[travis-url]: https://travis-ci.org/feross/safe-buffer -[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg -[npm-url]: https://npmjs.org/package/safe-buffer -[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg -[downloads-url]: https://npmjs.org/package/safe-buffer -[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg -[standard-url]: https://standardjs.com - -#### Safer Node.js Buffer API - -**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, -`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** - -**Uses the built-in implementation when available.** - -## install - -``` -npm install safe-buffer -``` - -## usage - -The goal of this package is to provide a safe replacement for the node.js `Buffer`. - -It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to -the top of your node.js modules: - -```js -var Buffer = require('safe-buffer').Buffer - -// Existing buffer code will continue to work without issues: - -new Buffer('hey', 'utf8') -new Buffer([1, 2, 3], 'utf8') -new Buffer(obj) -new Buffer(16) // create an uninitialized buffer (potentially unsafe) - -// But you can use these new explicit APIs to make clear what you want: - -Buffer.from('hey', 'utf8') // convert from many types to a Buffer -Buffer.alloc(16) // create a zero-filled buffer (safe) -Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) -``` - -## api - -### Class Method: Buffer.from(array) - - -* `array` {Array} - -Allocates a new `Buffer` using an `array` of octets. - -```js -const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); - // creates a new Buffer containing ASCII bytes - // ['b','u','f','f','e','r'] -``` - -A `TypeError` will be thrown if `array` is not an `Array`. - -### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) - - -* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or - a `new ArrayBuffer()` -* `byteOffset` {Number} Default: `0` -* `length` {Number} Default: `arrayBuffer.length - byteOffset` - -When passed a reference to the `.buffer` property of a `TypedArray` instance, -the newly created `Buffer` will share the same allocated memory as the -TypedArray. - -```js -const arr = new Uint16Array(2); -arr[0] = 5000; -arr[1] = 4000; - -const buf = Buffer.from(arr.buffer); // shares the memory with arr; - -console.log(buf); - // Prints: - -// changing the TypedArray changes the Buffer also -arr[1] = 6000; - -console.log(buf); - // Prints: -``` - -The optional `byteOffset` and `length` arguments specify a memory range within -the `arrayBuffer` that will be shared by the `Buffer`. - -```js -const ab = new ArrayBuffer(10); -const buf = Buffer.from(ab, 0, 2); -console.log(buf.length); - // Prints: 2 -``` - -A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. - -### Class Method: Buffer.from(buffer) - - -* `buffer` {Buffer} - -Copies the passed `buffer` data onto a new `Buffer` instance. - -```js -const buf1 = Buffer.from('buffer'); -const buf2 = Buffer.from(buf1); - -buf1[0] = 0x61; -console.log(buf1.toString()); - // 'auffer' -console.log(buf2.toString()); - // 'buffer' (copy is not changed) -``` - -A `TypeError` will be thrown if `buffer` is not a `Buffer`. - -### Class Method: Buffer.from(str[, encoding]) - - -* `str` {String} String to encode. -* `encoding` {String} Encoding to use, Default: `'utf8'` - -Creates a new `Buffer` containing the given JavaScript string `str`. If -provided, the `encoding` parameter identifies the character encoding. -If not provided, `encoding` defaults to `'utf8'`. - -```js -const buf1 = Buffer.from('this is a tést'); -console.log(buf1.toString()); - // prints: this is a tést -console.log(buf1.toString('ascii')); - // prints: this is a tC)st - -const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); -console.log(buf2.toString()); - // prints: this is a tést -``` - -A `TypeError` will be thrown if `str` is not a string. - -### Class Method: Buffer.alloc(size[, fill[, encoding]]) - - -* `size` {Number} -* `fill` {Value} Default: `undefined` -* `encoding` {String} Default: `utf8` - -Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the -`Buffer` will be *zero-filled*. - -```js -const buf = Buffer.alloc(5); -console.log(buf); - // -``` - -The `size` must be less than or equal to the value of -`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is -`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will -be created if a `size` less than or equal to 0 is specified. - -If `fill` is specified, the allocated `Buffer` will be initialized by calling -`buf.fill(fill)`. See [`buf.fill()`][] for more information. - -```js -const buf = Buffer.alloc(5, 'a'); -console.log(buf); - // -``` - -If both `fill` and `encoding` are specified, the allocated `Buffer` will be -initialized by calling `buf.fill(fill, encoding)`. For example: - -```js -const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); -console.log(buf); - // -``` - -Calling `Buffer.alloc(size)` can be significantly slower than the alternative -`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance -contents will *never contain sensitive data*. - -A `TypeError` will be thrown if `size` is not a number. - -### Class Method: Buffer.allocUnsafe(size) - - -* `size` {Number} - -Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must -be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit -architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is -thrown. A zero-length Buffer will be created if a `size` less than or equal to -0 is specified. - -The underlying memory for `Buffer` instances created in this way is *not -initialized*. The contents of the newly created `Buffer` are unknown and -*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such -`Buffer` instances to zeroes. - -```js -const buf = Buffer.allocUnsafe(5); -console.log(buf); - // - // (octets will be different, every time) -buf.fill(0); -console.log(buf); - // -``` - -A `TypeError` will be thrown if `size` is not a number. - -Note that the `Buffer` module pre-allocates an internal `Buffer` instance of -size `Buffer.poolSize` that is used as a pool for the fast allocation of new -`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated -`new Buffer(size)` constructor) only when `size` is less than or equal to -`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default -value of `Buffer.poolSize` is `8192` but can be modified. - -Use of this pre-allocated internal memory pool is a key difference between -calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. -Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer -pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal -Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The -difference is subtle but can be important when an application requires the -additional performance that `Buffer.allocUnsafe(size)` provides. - -### Class Method: Buffer.allocUnsafeSlow(size) - - -* `size` {Number} - -Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The -`size` must be less than or equal to the value of -`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is -`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will -be created if a `size` less than or equal to 0 is specified. - -The underlying memory for `Buffer` instances created in this way is *not -initialized*. The contents of the newly created `Buffer` are unknown and -*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such -`Buffer` instances to zeroes. - -When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, -allocations under 4KB are, by default, sliced from a single pre-allocated -`Buffer`. This allows applications to avoid the garbage collection overhead of -creating many individually allocated Buffers. This approach improves both -performance and memory usage by eliminating the need to track and cleanup as -many `Persistent` objects. - -However, in the case where a developer may need to retain a small chunk of -memory from a pool for an indeterminate amount of time, it may be appropriate -to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then -copy out the relevant bits. - -```js -// need to keep around a few small chunks of memory -const store = []; - -socket.on('readable', () => { - const data = socket.read(); - // allocate for retained data - const sb = Buffer.allocUnsafeSlow(10); - // copy the data into the new allocation - data.copy(sb, 0, 0, 10); - store.push(sb); -}); -``` - -Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* -a developer has observed undue memory retention in their applications. - -A `TypeError` will be thrown if `size` is not a number. - -### All the Rest - -The rest of the `Buffer` API is exactly the same as in node.js. -[See the docs](https://nodejs.org/api/buffer.html). - - -## Related links - -- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) -- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) - -## Why is `Buffer` unsafe? - -Today, the node.js `Buffer` constructor is overloaded to handle many different argument -types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), -`ArrayBuffer`, and also `Number`. - -The API is optimized for convenience: you can throw any type at it, and it will try to do -what you want. - -Because the Buffer constructor is so powerful, you often see code like this: - -```js -// Convert UTF-8 strings to hex -function toHex (str) { - return new Buffer(str).toString('hex') -} -``` - -***But what happens if `toHex` is called with a `Number` argument?*** - -### Remote Memory Disclosure - -If an attacker can make your program call the `Buffer` constructor with a `Number` -argument, then they can make it allocate uninitialized memory from the node.js process. -This could potentially disclose TLS private keys, user data, or database passwords. - -When the `Buffer` constructor is passed a `Number` argument, it returns an -**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like -this, you **MUST** overwrite the contents before returning it to the user. - -From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): - -> `new Buffer(size)` -> -> - `size` Number -> -> The underlying memory for `Buffer` instances created in this way is not initialized. -> **The contents of a newly created `Buffer` are unknown and could contain sensitive -> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. - -(Emphasis our own.) - -Whenever the programmer intended to create an uninitialized `Buffer` you often see code -like this: - -```js -var buf = new Buffer(16) - -// Immediately overwrite the uninitialized buffer with data from another buffer -for (var i = 0; i < buf.length; i++) { - buf[i] = otherBuf[i] -} -``` - - -### Would this ever be a problem in real code? - -Yes. It's surprisingly common to forget to check the type of your variables in a -dynamically-typed language like JavaScript. - -Usually the consequences of assuming the wrong type is that your program crashes with an -uncaught exception. But the failure mode for forgetting to check the type of arguments to -the `Buffer` constructor is more catastrophic. - -Here's an example of a vulnerable service that takes a JSON payload and converts it to -hex: - -```js -// Take a JSON payload {str: "some string"} and convert it to hex -var server = http.createServer(function (req, res) { - var data = '' - req.setEncoding('utf8') - req.on('data', function (chunk) { - data += chunk - }) - req.on('end', function () { - var body = JSON.parse(data) - res.end(new Buffer(body.str).toString('hex')) - }) -}) - -server.listen(8080) -``` - -In this example, an http client just has to send: - -```json -{ - "str": 1000 -} -``` - -and it will get back 1,000 bytes of uninitialized memory from the server. - -This is a very serious bug. It's similar in severity to the -[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process -memory by remote attackers. - - -### Which real-world packages were vulnerable? - -#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) - -[Mathias Buus](https://github.com/mafintosh) and I -([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, -[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow -anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get -them to reveal 20 bytes at a time of uninitialized memory from the node.js process. - -Here's -[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) -that fixed it. We released a new fixed version, created a -[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all -vulnerable versions on npm so users will get a warning to upgrade to a newer version. - -#### [`ws`](https://www.npmjs.com/package/ws) - -That got us wondering if there were other vulnerable packages. Sure enough, within a short -period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the -most popular WebSocket implementation in node.js. - -If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as -expected, then uninitialized server memory would be disclosed to the remote peer. - -These were the vulnerable methods: - -```js -socket.send(number) -socket.ping(number) -socket.pong(number) -``` - -Here's a vulnerable socket server with some echo functionality: - -```js -server.on('connection', function (socket) { - socket.on('message', function (message) { - message = JSON.parse(message) - if (message.type === 'echo') { - socket.send(message.data) // send back the user's message - } - }) -}) -``` - -`socket.send(number)` called on the server, will disclose server memory. - -Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue -was fixed, with a more detailed explanation. Props to -[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the -[Node Security Project disclosure](https://nodesecurity.io/advisories/67). - - -### What's the solution? - -It's important that node.js offers a fast way to get memory otherwise performance-critical -applications would needlessly get a lot slower. - -But we need a better way to *signal our intent* as programmers. **When we want -uninitialized memory, we should request it explicitly.** - -Sensitive functionality should not be packed into a developer-friendly API that loosely -accepts many different types. This type of API encourages the lazy practice of passing -variables in without checking the type very carefully. - -#### A new API: `Buffer.allocUnsafe(number)` - -The functionality of creating buffers with uninitialized memory should be part of another -API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that -frequently gets user input of all sorts of different types passed into it. - -```js -var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! - -// Immediately overwrite the uninitialized buffer with data from another buffer -for (var i = 0; i < buf.length; i++) { - buf[i] = otherBuf[i] -} -``` - - -### How do we fix node.js core? - -We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as -`semver-major`) which defends against one case: - -```js -var str = 16 -new Buffer(str, 'utf8') -``` - -In this situation, it's implied that the programmer intended the first argument to be a -string, since they passed an encoding as a second argument. Today, node.js will allocate -uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not -what the programmer intended. - -But this is only a partial solution, since if the programmer does `new Buffer(variable)` -(without an `encoding` parameter) there's no way to know what they intended. If `variable` -is sometimes a number, then uninitialized memory will sometimes be returned. - -### What's the real long-term fix? - -We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when -we need uninitialized memory. But that would break 1000s of packages. - -~~We believe the best solution is to:~~ - -~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ - -~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ - -#### Update - -We now support adding three new APIs: - -- `Buffer.from(value)` - convert from any type to a buffer -- `Buffer.alloc(size)` - create a zero-filled buffer -- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size - -This solves the core problem that affected `ws` and `bittorrent-dht` which is -`Buffer(variable)` getting tricked into taking a number argument. - -This way, existing code continues working and the impact on the npm ecosystem will be -minimal. Over time, npm maintainers can migrate performance-critical code to use -`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. - - -### Conclusion - -We think there's a serious design issue with the `Buffer` API as it exists today. It -promotes insecure software by putting high-risk functionality into a convenient API -with friendly "developer ergonomics". - -This wasn't merely a theoretical exercise because we found the issue in some of the -most popular npm packages. - -Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of -`buffer`. - -```js -var Buffer = require('safe-buffer').Buffer -``` - -Eventually, we hope that node.js core can switch to this new, safer behavior. We believe -the impact on the ecosystem would be minimal since it's not a breaking change. -Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while -older, insecure packages would magically become safe from this attack vector. - - -## links - -- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) -- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) -- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) - - -## credit - -The original issues in `bittorrent-dht` -([disclosure](https://nodesecurity.io/advisories/68)) and -`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by -[Mathias Buus](https://github.com/mafintosh) and -[Feross Aboukhadijeh](http://feross.org/). - -Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues -and for his work running the [Node Security Project](https://nodesecurity.io/). - -Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and -auditing the code. - - -## license - -MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) diff --git a/node_modules/safe-buffer/index.d.ts b/node_modules/safe-buffer/index.d.ts deleted file mode 100644 index e9fed80..0000000 --- a/node_modules/safe-buffer/index.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -declare module "safe-buffer" { - export class Buffer { - length: number - write(string: string, offset?: number, length?: number, encoding?: string): number; - toString(encoding?: string, start?: number, end?: number): string; - toJSON(): { type: 'Buffer', data: any[] }; - equals(otherBuffer: Buffer): boolean; - compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; - copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - slice(start?: number, end?: number): Buffer; - writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readUInt8(offset: number, noAssert?: boolean): number; - readUInt16LE(offset: number, noAssert?: boolean): number; - readUInt16BE(offset: number, noAssert?: boolean): number; - readUInt32LE(offset: number, noAssert?: boolean): number; - readUInt32BE(offset: number, noAssert?: boolean): number; - readInt8(offset: number, noAssert?: boolean): number; - readInt16LE(offset: number, noAssert?: boolean): number; - readInt16BE(offset: number, noAssert?: boolean): number; - readInt32LE(offset: number, noAssert?: boolean): number; - readInt32BE(offset: number, noAssert?: boolean): number; - readFloatLE(offset: number, noAssert?: boolean): number; - readFloatBE(offset: number, noAssert?: boolean): number; - readDoubleLE(offset: number, noAssert?: boolean): number; - readDoubleBE(offset: number, noAssert?: boolean): number; - swap16(): Buffer; - swap32(): Buffer; - swap64(): Buffer; - writeUInt8(value: number, offset: number, noAssert?: boolean): number; - writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeInt8(value: number, offset: number, noAssert?: boolean): number; - writeInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeFloatLE(value: number, offset: number, noAssert?: boolean): number; - writeFloatBE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; - fill(value: any, offset?: number, end?: number): this; - indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; - lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; - includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; - - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - */ - constructor (str: string, encoding?: string); - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - */ - constructor (size: number); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - constructor (array: Uint8Array); - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}. - * - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - */ - constructor (arrayBuffer: ArrayBuffer); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - constructor (array: any[]); - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - */ - constructor (buffer: Buffer); - prototype: Buffer; - /** - * Allocates a new Buffer using an {array} of octets. - * - * @param array - */ - static from(array: any[]): Buffer; - /** - * When passed a reference to the .buffer property of a TypedArray instance, - * the newly created Buffer will share the same allocated memory as the TypedArray. - * The optional {byteOffset} and {length} arguments specify a memory range - * within the {arrayBuffer} that will be shared by the Buffer. - * - * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() - * @param byteOffset - * @param length - */ - static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; - /** - * Copies the passed {buffer} data onto a new Buffer instance. - * - * @param buffer - */ - static from(buffer: Buffer): Buffer; - /** - * Creates a new Buffer containing the given JavaScript string {str}. - * If provided, the {encoding} parameter identifies the character encoding. - * If not provided, {encoding} defaults to 'utf8'. - * - * @param str - */ - static from(str: string, encoding?: string): Buffer; - /** - * Returns true if {obj} is a Buffer - * - * @param obj object to test. - */ - static isBuffer(obj: any): obj is Buffer; - /** - * Returns true if {encoding} is a valid encoding argument. - * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - * - * @param encoding string to test. - */ - static isEncoding(encoding: string): boolean; - /** - * Gives the actual byte length of a string. encoding defaults to 'utf8'. - * This is not the same as String.prototype.length since that returns the number of characters in a string. - * - * @param string string to test. - * @param encoding encoding used to evaluate (defaults to 'utf8') - */ - static byteLength(string: string, encoding?: string): number; - /** - * Returns a buffer which is the result of concatenating all the buffers in the list together. - * - * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. - * If the list has exactly one item, then the first item of the list is returned. - * If the list has more than one item, then a new Buffer is created. - * - * @param list An array of Buffer objects to concatenate - * @param totalLength Total length of the buffers when concatenated. - * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. - */ - static concat(list: Buffer[], totalLength?: number): Buffer; - /** - * The same as buf1.compare(buf2). - */ - static compare(buf1: Buffer, buf2: Buffer): number; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @param fill if specified, buffer will be initialized by calling buf.fill(fill). - * If parameter is omitted, buffer will be filled with zeros. - * @param encoding encoding used for call to buf.fill while initalizing - */ - static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; - /** - * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafe(size: number): Buffer; - /** - * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafeSlow(size: number): Buffer; - } -} \ No newline at end of file diff --git a/node_modules/safe-buffer/index.js b/node_modules/safe-buffer/index.js deleted file mode 100644 index 22438da..0000000 --- a/node_modules/safe-buffer/index.js +++ /dev/null @@ -1,62 +0,0 @@ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} diff --git a/node_modules/safe-buffer/package.json b/node_modules/safe-buffer/package.json deleted file mode 100644 index 5e77262..0000000 --- a/node_modules/safe-buffer/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_from": "safe-buffer@~5.1.1", - "_id": "safe-buffer@5.1.2", - "_inBundle": false, - "_integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "_location": "/safe-buffer", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "safe-buffer@~5.1.1", - "name": "safe-buffer", - "escapedName": "safe-buffer", - "rawSpec": "~5.1.1", - "saveSpec": null, - "fetchSpec": "~5.1.1" - }, - "_requiredBy": [ - "/minipass", - "/readable-stream", - "/string_decoder", - "/tar" - ], - "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "_shasum": "991ec69d296e0313747d59bdfd2b745c35f8828d", - "_spec": "safe-buffer@~5.1.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/readable-stream", - "author": { - "name": "Feross Aboukhadijeh", - "email": "feross@feross.org", - "url": "http://feross.org" - }, - "bugs": { - "url": "https://github.com/feross/safe-buffer/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Safer Node.js Buffer API", - "devDependencies": { - "standard": "*", - "tape": "^4.0.0" - }, - "homepage": "https://github.com/feross/safe-buffer", - "keywords": [ - "buffer", - "buffer allocate", - "node security", - "safe", - "safe-buffer", - "security", - "uninitialized" - ], - "license": "MIT", - "main": "index.js", - "name": "safe-buffer", - "repository": { - "type": "git", - "url": "git://github.com/feross/safe-buffer.git" - }, - "scripts": { - "test": "standard && tape test/*.js" - }, - "types": "index.d.ts", - "version": "5.1.2" -} diff --git a/node_modules/safer-buffer/LICENSE b/node_modules/safer-buffer/LICENSE deleted file mode 100644 index 4fe9e6f..0000000 --- a/node_modules/safer-buffer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 Nikita Skovoroda - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/safer-buffer/Porting-Buffer.md b/node_modules/safer-buffer/Porting-Buffer.md deleted file mode 100644 index 68d86ba..0000000 --- a/node_modules/safer-buffer/Porting-Buffer.md +++ /dev/null @@ -1,268 +0,0 @@ -# Porting to the Buffer.from/Buffer.alloc API - - -## Overview - -- [Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.](#variant-1) (*recommended*) -- [Variant 2: Use a polyfill](#variant-2) -- [Variant 3: manual detection, with safeguards](#variant-3) - -### Finding problematic bits of code using grep - -Just run `grep -nrE '[^a-zA-Z](Slow)?Buffer\s*\(' --exclude-dir node_modules`. - -It will find all the potentially unsafe places in your own code (with some considerably unlikely -exceptions). - -### Finding problematic bits of code using Node.js 8 - -If you’re using Node.js ≥ 8.0.0 (which is recommended), Node.js exposes multiple options that help with finding the relevant pieces of code: - -- `--trace-warnings` will make Node.js show a stack trace for this warning and other warnings that are printed by Node.js. -- `--trace-deprecation` does the same thing, but only for deprecation warnings. -- `--pending-deprecation` will show more types of deprecation warnings. In particular, it will show the `Buffer()` deprecation warning, even on Node.js 8. - -You can set these flags using an environment variable: - -```console -$ export NODE_OPTIONS='--trace-warnings --pending-deprecation' -$ cat example.js -'use strict'; -const foo = new Buffer('foo'); -$ node example.js -(node:7147) [DEP0005] DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Please use the new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods instead. - at showFlaggedDeprecation (buffer.js:127:13) - at new Buffer (buffer.js:148:3) - at Object. (/path/to/example.js:2:13) - [... more stack trace lines ...] -``` - -### Finding problematic bits of code using linters - -Eslint rules [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) -or -[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) -also find calls to deprecated `Buffer()` API. Those rules are included in some pre-sets. - -There is a drawback, though, that it doesn't always -[work correctly](https://github.com/chalker/safer-buffer#why-not-safe-buffer) when `Buffer` is -overriden e.g. with a polyfill, so recommended is a combination of this and some other method -described above. - - -## Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x. - -This is the recommended solution nowadays that would imply only minimal overhead. - -The Node.js 5.x release line has been unsupported since July 2016, and the Node.js 4.x release line reaches its End of Life in April 2018 (→ [Schedule](https://github.com/nodejs/Release#release-schedule)). This means that these versions of Node.js will *not* receive any updates, even in case of security issues, so using these release lines should be avoided, if at all possible. - -What you would do in this case is to convert all `new Buffer()` or `Buffer()` calls to use `Buffer.alloc()` or `Buffer.from()`, in the following way: - -- For `new Buffer(number)`, replace it with `Buffer.alloc(number)`. -- For `new Buffer(string)` (or `new Buffer(string, encoding)`), replace it with `Buffer.from(string)` (or `Buffer.from(string, encoding)`). -- For all other combinations of arguments (these are much rarer), also replace `new Buffer(...arguments)` with `Buffer.from(...arguments)`. - -Note that `Buffer.alloc()` is also _faster_ on the current Node.js versions than -`new Buffer(size).fill(0)`, which is what you would otherwise need to ensure zero-filling. - -Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) -or -[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) -is recommended to avoid accidential unsafe Buffer API usage. - -There is also a [JSCodeshift codemod](https://github.com/joyeecheung/node-dep-codemod#dep005) -for automatically migrating Buffer constructors to `Buffer.alloc()` or `Buffer.from()`. -Note that it currently only works with cases where the arguments are literals or where the -constructor is invoked with two arguments. - -_If you currently support those older Node.js versions and dropping them would be a semver-major change -for you, or if you support older branches of your packages, consider using [Variant 2](#variant-2) -or [Variant 3](#variant-3) on older branches, so people using those older branches will also receive -the fix. That way, you will eradicate potential issues caused by unguarded Buffer API usage and -your users will not observe a runtime deprecation warning when running your code on Node.js 10._ - - -## Variant 2: Use a polyfill - -Utilize [safer-buffer](https://www.npmjs.com/package/safer-buffer) as a polyfill to support older -Node.js versions. - -You would take exacly the same steps as in [Variant 1](#variant-1), but with a polyfill -`const Buffer = require('safer-buffer').Buffer` in all files where you use the new `Buffer` api. - -Make sure that you do not use old `new Buffer` API — in any files where the line above is added, -using old `new Buffer()` API will _throw_. It will be easy to notice that in CI, though. - -Alternatively, you could use [buffer-from](https://www.npmjs.com/package/buffer-from) and/or -[buffer-alloc](https://www.npmjs.com/package/buffer-alloc) [ponyfills](https://ponyfill.com/) — -those are great, the only downsides being 4 deps in the tree and slightly more code changes to -migrate off them (as you would be using e.g. `Buffer.from` under a different name). If you need only -`Buffer.from` polyfilled — `buffer-from` alone which comes with no extra dependencies. - -_Alternatively, you could use [safe-buffer](https://www.npmjs.com/package/safe-buffer) — it also -provides a polyfill, but takes a different approach which has -[it's drawbacks](https://github.com/chalker/safer-buffer#why-not-safe-buffer). It will allow you -to also use the older `new Buffer()` API in your code, though — but that's arguably a benefit, as -it is problematic, can cause issues in your code, and will start emitting runtime deprecation -warnings starting with Node.js 10._ - -Note that in either case, it is important that you also remove all calls to the old Buffer -API manually — just throwing in `safe-buffer` doesn't fix the problem by itself, it just provides -a polyfill for the new API. I have seen people doing that mistake. - -Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) -or -[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) -is recommended. - -_Don't forget to drop the polyfill usage once you drop support for Node.js < 4.5.0._ - - -## Variant 3 — manual detection, with safeguards - -This is useful if you create Buffer instances in only a few places (e.g. one), or you have your own -wrapper around them. - -### Buffer(0) - -This special case for creating empty buffers can be safely replaced with `Buffer.concat([])`, which -returns the same result all the way down to Node.js 0.8.x. - -### Buffer(notNumber) - -Before: - -```js -var buf = new Buffer(notNumber, encoding); -``` - -After: - -```js -var buf; -if (Buffer.from && Buffer.from !== Uint8Array.from) { - buf = Buffer.from(notNumber, encoding); -} else { - if (typeof notNumber === 'number') - throw new Error('The "size" argument must be of type number.'); - buf = new Buffer(notNumber, encoding); -} -``` - -`encoding` is optional. - -Note that the `typeof notNumber` before `new Buffer` is required (for cases when `notNumber` argument is not -hard-coded) and _is not caused by the deprecation of Buffer constructor_ — it's exactly _why_ the -Buffer constructor is deprecated. Ecosystem packages lacking this type-check caused numereous -security issues — situations when unsanitized user input could end up in the `Buffer(arg)` create -problems ranging from DoS to leaking sensitive information to the attacker from the process memory. - -When `notNumber` argument is hardcoded (e.g. literal `"abc"` or `[0,1,2]`), the `typeof` check can -be omitted. - -Also note that using TypeScript does not fix this problem for you — when libs written in -`TypeScript` are used from JS, or when user input ends up there — it behaves exactly as pure JS, as -all type checks are translation-time only and are not present in the actual JS code which TS -compiles to. - -### Buffer(number) - -For Node.js 0.10.x (and below) support: - -```js -var buf; -if (Buffer.alloc) { - buf = Buffer.alloc(number); -} else { - buf = new Buffer(number); - buf.fill(0); -} -``` - -Otherwise (Node.js ≥ 0.12.x): - -```js -const buf = Buffer.alloc ? Buffer.alloc(number) : new Buffer(number).fill(0); -``` - -## Regarding Buffer.allocUnsafe - -Be extra cautious when using `Buffer.allocUnsafe`: - * Don't use it if you don't have a good reason to - * e.g. you probably won't ever see a performance difference for small buffers, in fact, those - might be even faster with `Buffer.alloc()`, - * if your code is not in the hot code path — you also probably won't notice a difference, - * keep in mind that zero-filling minimizes the potential risks. - * If you use it, make sure that you never return the buffer in a partially-filled state, - * if you are writing to it sequentially — always truncate it to the actuall written length - -Errors in handling buffers allocated with `Buffer.allocUnsafe` could result in various issues, -ranged from undefined behaviour of your code to sensitive data (user input, passwords, certs) -leaking to the remote attacker. - -_Note that the same applies to `new Buffer` usage without zero-filling, depending on the Node.js -version (and lacking type checks also adds DoS to the list of potential problems)._ - - -## FAQ - - -### What is wrong with the `Buffer` constructor? - -The `Buffer` constructor could be used to create a buffer in many different ways: - -- `new Buffer(42)` creates a `Buffer` of 42 bytes. Before Node.js 8, this buffer contained - *arbitrary memory* for performance reasons, which could include anything ranging from - program source code to passwords and encryption keys. -- `new Buffer('abc')` creates a `Buffer` that contains the UTF-8-encoded version of - the string `'abc'`. A second argument could specify another encoding: For example, - `new Buffer(string, 'base64')` could be used to convert a Base64 string into the original - sequence of bytes that it represents. -- There are several other combinations of arguments. - -This meant that, in code like `var buffer = new Buffer(foo);`, *it is not possible to tell -what exactly the contents of the generated buffer are* without knowing the type of `foo`. - -Sometimes, the value of `foo` comes from an external source. For example, this function -could be exposed as a service on a web server, converting a UTF-8 string into its Base64 form: - -``` -function stringToBase64(req, res) { - // The request body should have the format of `{ string: 'foobar' }` - const rawBytes = new Buffer(req.body.string) - const encoded = rawBytes.toString('base64') - res.end({ encoded: encoded }) -} -``` - -Note that this code does *not* validate the type of `req.body.string`: - -- `req.body.string` is expected to be a string. If this is the case, all goes well. -- `req.body.string` is controlled by the client that sends the request. -- If `req.body.string` is the *number* `50`, the `rawBytes` would be 50 bytes: - - Before Node.js 8, the content would be uninitialized - - After Node.js 8, the content would be `50` bytes with the value `0` - -Because of the missing type check, an attacker could intentionally send a number -as part of the request. Using this, they can either: - -- Read uninitialized memory. This **will** leak passwords, encryption keys and other - kinds of sensitive information. (Information leak) -- Force the program to allocate a large amount of memory. For example, when specifying - `500000000` as the input value, each request will allocate 500MB of memory. - This can be used to either exhaust the memory available of a program completely - and make it crash, or slow it down significantly. (Denial of Service) - -Both of these scenarios are considered serious security issues in a real-world -web server context. - -when using `Buffer.from(req.body.string)` instead, passing a number will always -throw an exception instead, giving a controlled behaviour that can always be -handled by the program. - - -### The `Buffer()` constructor has been deprecated for a while. Is this really an issue? - -Surveys of code in the `npm` ecosystem have shown that the `Buffer()` constructor is still -widely used. This includes new code, and overall usage of such code has actually been -*increasing*. diff --git a/node_modules/safer-buffer/Readme.md b/node_modules/safer-buffer/Readme.md deleted file mode 100644 index 14b0822..0000000 --- a/node_modules/safer-buffer/Readme.md +++ /dev/null @@ -1,156 +0,0 @@ -# safer-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![javascript style guide][standard-image]][standard-url] [![Security Responsible Disclosure][secuirty-image]][secuirty-url] - -[travis-image]: https://travis-ci.org/ChALkeR/safer-buffer.svg?branch=master -[travis-url]: https://travis-ci.org/ChALkeR/safer-buffer -[npm-image]: https://img.shields.io/npm/v/safer-buffer.svg -[npm-url]: https://npmjs.org/package/safer-buffer -[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg -[standard-url]: https://standardjs.com -[secuirty-image]: https://img.shields.io/badge/Security-Responsible%20Disclosure-green.svg -[secuirty-url]: https://github.com/nodejs/security-wg/blob/master/processes/responsible_disclosure_template.md - -Modern Buffer API polyfill without footguns, working on Node.js from 0.8 to current. - -## How to use? - -First, port all `Buffer()` and `new Buffer()` calls to `Buffer.alloc()` and `Buffer.from()` API. - -Then, to achieve compatibility with outdated Node.js versions (`<4.5.0` and 5.x `<5.9.0`), use -`const Buffer = require('safer-buffer').Buffer` in all files where you make calls to the new -Buffer API. _Use `var` instead of `const` if you need that for your Node.js version range support._ - -Also, see the -[porting Buffer](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) guide. - -## Do I need it? - -Hopefully, not — dropping support for outdated Node.js versions should be fine nowdays, and that -is the recommended path forward. You _do_ need to port to the `Buffer.alloc()` and `Buffer.from()` -though. - -See the [porting guide](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) -for a better description. - -## Why not [safe-buffer](https://npmjs.com/safe-buffer)? - -_In short: while `safe-buffer` serves as a polyfill for the new API, it allows old API usage and -itself contains footguns._ - -`safe-buffer` could be used safely to get the new API while still keeping support for older -Node.js versions (like this module), but while analyzing ecosystem usage of the old Buffer API -I found out that `safe-buffer` is itself causing problems in some cases. - -For example, consider the following snippet: - -```console -$ cat example.unsafe.js -console.log(Buffer(20)) -$ ./node-v6.13.0-linux-x64/bin/node example.unsafe.js - -$ standard example.unsafe.js -standard: Use JavaScript Standard Style (https://standardjs.com) - /home/chalker/repo/safer-buffer/example.unsafe.js:2:13: 'Buffer()' was deprecated since v6. Use 'Buffer.alloc()' or 'Buffer.from()' (use 'https://www.npmjs.com/package/safe-buffer' for '<4.5.0') instead. -``` - -This is allocates and writes to console an uninitialized chunk of memory. -[standard](https://www.npmjs.com/package/standard) linter (among others) catch that and warn people -to avoid using unsafe API. - -Let's now throw in `safe-buffer`! - -```console -$ cat example.safe-buffer.js -const Buffer = require('safe-buffer').Buffer -console.log(Buffer(20)) -$ standard example.safe-buffer.js -$ ./node-v6.13.0-linux-x64/bin/node example.safe-buffer.js - -``` - -See the problem? Adding in `safe-buffer` _magically removes the lint warning_, but the behavior -remains identiсal to what we had before, and when launched on Node.js 6.x LTS — this dumps out -chunks of uninitialized memory. -_And this code will still emit runtime warnings on Node.js 10.x and above._ - -That was done by design. I first considered changing `safe-buffer`, prohibiting old API usage or -emitting warnings on it, but that significantly diverges from `safe-buffer` design. After some -discussion, it was decided to move my approach into a separate package, and _this is that separate -package_. - -This footgun is not imaginary — I observed top-downloaded packages doing that kind of thing, -«fixing» the lint warning by blindly including `safe-buffer` without any actual changes. - -Also in some cases, even if the API _was_ migrated to use of safe Buffer API — a random pull request -can bring unsafe Buffer API usage back to the codebase by adding new calls — and that could go -unnoticed even if you have a linter prohibiting that (becase of the reason stated above), and even -pass CI. _I also observed that being done in popular packages._ - -Some examples: - * [webdriverio](https://github.com/webdriverio/webdriverio/commit/05cbd3167c12e4930f09ef7cf93b127ba4effae4#diff-124380949022817b90b622871837d56cR31) - (a module with 548 759 downloads/month), - * [websocket-stream](https://github.com/maxogden/websocket-stream/commit/c9312bd24d08271687d76da0fe3c83493871cf61) - (218 288 d/m, fix in [maxogden/websocket-stream#142](https://github.com/maxogden/websocket-stream/pull/142)), - * [node-serialport](https://github.com/node-serialport/node-serialport/commit/e8d9d2b16c664224920ce1c895199b1ce2def48c) - (113 138 d/m, fix in [node-serialport/node-serialport#1510](https://github.com/node-serialport/node-serialport/pull/1510)), - * [karma](https://github.com/karma-runner/karma/commit/3d94b8cf18c695104ca195334dc75ff054c74eec) - (3 973 193 d/m, fix in [karma-runner/karma#2947](https://github.com/karma-runner/karma/pull/2947)), - * [spdy-transport](https://github.com/spdy-http2/spdy-transport/commit/5375ac33f4a62a4f65bcfc2827447d42a5dbe8b1) - (5 970 727 d/m, fix in [spdy-http2/spdy-transport#53](https://github.com/spdy-http2/spdy-transport/pull/53)). - * And there are a lot more over the ecosystem. - -I filed a PR at -[mysticatea/eslint-plugin-node#110](https://github.com/mysticatea/eslint-plugin-node/pull/110) to -partially fix that (for cases when that lint rule is used), but it is a semver-major change for -linter rules and presets, so it would take significant time for that to reach actual setups. -_It also hasn't been released yet (2018-03-20)._ - -Also, `safer-buffer` discourages the usage of `.allocUnsafe()`, which is often done by a mistake. -It still supports it with an explicit concern barier, by placing it under -`require('safer-buffer/dangereous')`. - -## But isn't throwing bad? - -Not really. It's an error that could be noticed and fixed early, instead of causing havoc later like -unguarded `new Buffer()` calls that end up receiving user input can do. - -This package affects only the files where `var Buffer = require('safer-buffer').Buffer` was done, so -it is really simple to keep track of things and make sure that you don't mix old API usage with that. -Also, CI should hint anything that you might have missed. - -New commits, if tested, won't land new usage of unsafe Buffer API this way. -_Node.js 10.x also deals with that by printing a runtime depecation warning._ - -### Would it affect third-party modules? - -No, unless you explicitly do an awful thing like monkey-patching or overriding the built-in `Buffer`. -Don't do that. - -### But I don't want throwing… - -That is also fine! - -Also, it could be better in some cases when you don't comprehensive enough test coverage. - -In that case — just don't override `Buffer` and use -`var SaferBuffer = require('safer-buffer').Buffer` instead. - -That way, everything using `Buffer` natively would still work, but there would be two drawbacks: - -* `Buffer.from`/`Buffer.alloc` won't be polyfilled — use `SaferBuffer.from` and - `SaferBuffer.alloc` instead. -* You are still open to accidentally using the insecure deprecated API — use a linter to catch that. - -Note that using a linter to catch accidential `Buffer` constructor usage in this case is strongly -recommended. `Buffer` is not overriden in this usecase, so linters won't get confused. - -## «Without footguns»? - -Well, it is still possible to do _some_ things with `Buffer` API, e.g. accessing `.buffer` property -on older versions and duping things from there. You shouldn't do that in your code, probabably. - -The intention is to remove the most significant footguns that affect lots of packages in the -ecosystem, and to do it in the proper way. - -Also, this package doesn't protect against security issues affecting some Node.js versions, so for -usage in your own production code, it is still recommended to update to a Node.js version -[supported by upstream](https://github.com/nodejs/release#release-schedule). diff --git a/node_modules/safer-buffer/dangerous.js b/node_modules/safer-buffer/dangerous.js deleted file mode 100644 index ca41fdc..0000000 --- a/node_modules/safer-buffer/dangerous.js +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable node/no-deprecated-api */ - -'use strict' - -var buffer = require('buffer') -var Buffer = buffer.Buffer -var safer = require('./safer.js') -var Safer = safer.Buffer - -var dangerous = {} - -var key - -for (key in safer) { - if (!safer.hasOwnProperty(key)) continue - dangerous[key] = safer[key] -} - -var Dangereous = dangerous.Buffer = {} - -// Copy Safer API -for (key in Safer) { - if (!Safer.hasOwnProperty(key)) continue - Dangereous[key] = Safer[key] -} - -// Copy those missing unsafe methods, if they are present -for (key in Buffer) { - if (!Buffer.hasOwnProperty(key)) continue - if (Dangereous.hasOwnProperty(key)) continue - Dangereous[key] = Buffer[key] -} - -if (!Dangereous.allocUnsafe) { - Dangereous.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) - } - if (size < 0 || size >= 2 * (1 << 30)) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } - return Buffer(size) - } -} - -if (!Dangereous.allocUnsafeSlow) { - Dangereous.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) - } - if (size < 0 || size >= 2 * (1 << 30)) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } - return buffer.SlowBuffer(size) - } -} - -module.exports = dangerous diff --git a/node_modules/safer-buffer/package.json b/node_modules/safer-buffer/package.json deleted file mode 100644 index 5960384..0000000 --- a/node_modules/safer-buffer/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "_from": "safer-buffer@>= 2.1.2 < 3", - "_id": "safer-buffer@2.1.2", - "_inBundle": false, - "_integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "_location": "/safer-buffer", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "safer-buffer@>= 2.1.2 < 3", - "name": "safer-buffer", - "escapedName": "safer-buffer", - "rawSpec": ">= 2.1.2 < 3", - "saveSpec": null, - "fetchSpec": ">= 2.1.2 < 3" - }, - "_requiredBy": [ - "/iconv-lite" - ], - "_resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "_shasum": "44fa161b0187b9549dd84bb91802f9bd8385cd6a", - "_spec": "safer-buffer@>= 2.1.2 < 3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/iconv-lite", - "author": { - "name": "Nikita Skovoroda", - "email": "chalkerx@gmail.com", - "url": "https://github.com/ChALkeR" - }, - "bugs": { - "url": "https://github.com/ChALkeR/safer-buffer/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Modern Buffer API polyfill without footguns", - "devDependencies": { - "standard": "^11.0.1", - "tape": "^4.9.0" - }, - "files": [ - "Porting-Buffer.md", - "Readme.md", - "tests.js", - "dangerous.js", - "safer.js" - ], - "homepage": "https://github.com/ChALkeR/safer-buffer#readme", - "license": "MIT", - "main": "safer.js", - "name": "safer-buffer", - "repository": { - "type": "git", - "url": "git+https://github.com/ChALkeR/safer-buffer.git" - }, - "scripts": { - "browserify-test": "browserify --external tape tests.js > browserify-tests.js && tape browserify-tests.js", - "test": "standard && tape tests.js" - }, - "version": "2.1.2" -} diff --git a/node_modules/safer-buffer/safer.js b/node_modules/safer-buffer/safer.js deleted file mode 100644 index 37c7e1a..0000000 --- a/node_modules/safer-buffer/safer.js +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable node/no-deprecated-api */ - -'use strict' - -var buffer = require('buffer') -var Buffer = buffer.Buffer - -var safer = {} - -var key - -for (key in buffer) { - if (!buffer.hasOwnProperty(key)) continue - if (key === 'SlowBuffer' || key === 'Buffer') continue - safer[key] = buffer[key] -} - -var Safer = safer.Buffer = {} -for (key in Buffer) { - if (!Buffer.hasOwnProperty(key)) continue - if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue - Safer[key] = Buffer[key] -} - -safer.Buffer.prototype = Buffer.prototype - -if (!Safer.from || Safer.from === Uint8Array.from) { - Safer.from = function (value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) - } - if (value && typeof value.length === 'undefined') { - throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) - } - return Buffer(value, encodingOrOffset, length) - } -} - -if (!Safer.alloc) { - Safer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) - } - if (size < 0 || size >= 2 * (1 << 30)) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } - var buf = Buffer(size) - if (!fill || fill.length === 0) { - buf.fill(0) - } else if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - return buf - } -} - -if (!safer.kStringMaxLength) { - try { - safer.kStringMaxLength = process.binding('buffer').kStringMaxLength - } catch (e) { - // we can't determine kStringMaxLength in environments where process.binding - // is unsupported, so let's not set it - } -} - -if (!safer.constants) { - safer.constants = { - MAX_LENGTH: safer.kMaxLength - } - if (safer.kStringMaxLength) { - safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength - } -} - -module.exports = safer diff --git a/node_modules/safer-buffer/tests.js b/node_modules/safer-buffer/tests.js deleted file mode 100644 index 7ed2777..0000000 --- a/node_modules/safer-buffer/tests.js +++ /dev/null @@ -1,406 +0,0 @@ -/* eslint-disable node/no-deprecated-api */ - -'use strict' - -var test = require('tape') - -var buffer = require('buffer') - -var index = require('./') -var safer = require('./safer') -var dangerous = require('./dangerous') - -/* Inheritance tests */ - -test('Default is Safer', function (t) { - t.equal(index, safer) - t.notEqual(safer, dangerous) - t.notEqual(index, dangerous) - t.end() -}) - -test('Is not a function', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(typeof impl, 'object') - t.equal(typeof impl.Buffer, 'object') - }); - [buffer].forEach(function (impl) { - t.equal(typeof impl, 'object') - t.equal(typeof impl.Buffer, 'function') - }) - t.end() -}) - -test('Constructor throws', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.throws(function () { impl.Buffer() }) - t.throws(function () { impl.Buffer(0) }) - t.throws(function () { impl.Buffer('a') }) - t.throws(function () { impl.Buffer('a', 'utf-8') }) - t.throws(function () { return new impl.Buffer() }) - t.throws(function () { return new impl.Buffer(0) }) - t.throws(function () { return new impl.Buffer('a') }) - t.throws(function () { return new impl.Buffer('a', 'utf-8') }) - }) - t.end() -}) - -test('Safe methods exist', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(typeof impl.Buffer.alloc, 'function', 'alloc') - t.equal(typeof impl.Buffer.from, 'function', 'from') - }) - t.end() -}) - -test('Unsafe methods exist only in Dangerous', function (t) { - [index, safer].forEach(function (impl) { - t.equal(typeof impl.Buffer.allocUnsafe, 'undefined') - t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined') - }); - [dangerous].forEach(function (impl) { - t.equal(typeof impl.Buffer.allocUnsafe, 'function') - t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function') - }) - t.end() -}) - -test('Generic methods/properties are defined and equal', function (t) { - ['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer[method], buffer.Buffer[method], method) - t.notEqual(typeof impl.Buffer[method], 'undefined', method) - }) - }) - t.end() -}) - -test('Built-in buffer static methods/properties are inherited', function (t) { - Object.keys(buffer).forEach(function (method) { - if (method === 'SlowBuffer' || method === 'Buffer') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl[method], buffer[method], method) - t.notEqual(typeof impl[method], 'undefined', method) - }) - }) - t.end() -}) - -test('Built-in Buffer static methods/properties are inherited', function (t) { - Object.keys(buffer.Buffer).forEach(function (method) { - if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer[method], buffer.Buffer[method], method) - t.notEqual(typeof impl.Buffer[method], 'undefined', method) - }) - }) - t.end() -}) - -test('.prototype property of Buffer is inherited', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype') - t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype') - }) - t.end() -}) - -test('All Safer methods are present in Dangerous', function (t) { - Object.keys(safer).forEach(function (method) { - if (method === 'Buffer') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl[method], safer[method], method) - if (method !== 'kStringMaxLength') { - t.notEqual(typeof impl[method], 'undefined', method) - } - }) - }) - Object.keys(safer.Buffer).forEach(function (method) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer[method], safer.Buffer[method], method) - t.notEqual(typeof impl.Buffer[method], 'undefined', method) - }) - }) - t.end() -}) - -test('Safe methods from Dangerous methods are present in Safer', function (t) { - Object.keys(dangerous).forEach(function (method) { - if (method === 'Buffer') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl[method], dangerous[method], method) - if (method !== 'kStringMaxLength') { - t.notEqual(typeof impl[method], 'undefined', method) - } - }) - }) - Object.keys(dangerous.Buffer).forEach(function (method) { - if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer[method], dangerous.Buffer[method], method) - t.notEqual(typeof impl.Buffer[method], 'undefined', method) - }) - }) - t.end() -}) - -/* Behaviour tests */ - -test('Methods return Buffers', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(''))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3]))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3])))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([]))) - }); - ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { - t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0))) - t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10))) - }) - t.end() -}) - -test('Constructor is buffer.Buffer', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer) - t.equal(impl.Buffer.from('').constructor, buffer.Buffer) - t.equal(impl.Buffer.from('string').constructor, buffer.Buffer) - t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer) - t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer) - t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer) - t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer) - t.equal(impl.Buffer.from([]).constructor, buffer.Buffer) - }); - [0, 10, 100].forEach(function (arg) { - t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer) - t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor) - }) - t.end() -}) - -test('Invalid calls throw', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.throws(function () { impl.Buffer.from(0) }) - t.throws(function () { impl.Buffer.from(10) }) - t.throws(function () { impl.Buffer.from(10, 'utf-8') }) - t.throws(function () { impl.Buffer.from('string', 'invalid encoding') }) - t.throws(function () { impl.Buffer.from(-10) }) - t.throws(function () { impl.Buffer.from(1e90) }) - t.throws(function () { impl.Buffer.from(Infinity) }) - t.throws(function () { impl.Buffer.from(-Infinity) }) - t.throws(function () { impl.Buffer.from(NaN) }) - t.throws(function () { impl.Buffer.from(null) }) - t.throws(function () { impl.Buffer.from(undefined) }) - t.throws(function () { impl.Buffer.from() }) - t.throws(function () { impl.Buffer.from({}) }) - t.throws(function () { impl.Buffer.alloc('') }) - t.throws(function () { impl.Buffer.alloc('string') }) - t.throws(function () { impl.Buffer.alloc('string', 'utf-8') }) - t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') }) - t.throws(function () { impl.Buffer.alloc(-10) }) - t.throws(function () { impl.Buffer.alloc(1e90) }) - t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) }) - t.throws(function () { impl.Buffer.alloc(Infinity) }) - t.throws(function () { impl.Buffer.alloc(-Infinity) }) - t.throws(function () { impl.Buffer.alloc(null) }) - t.throws(function () { impl.Buffer.alloc(undefined) }) - t.throws(function () { impl.Buffer.alloc() }) - t.throws(function () { impl.Buffer.alloc([]) }) - t.throws(function () { impl.Buffer.alloc([0, 42, 3]) }) - t.throws(function () { impl.Buffer.alloc({}) }) - }); - ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { - t.throws(function () { dangerous.Buffer[method]('') }) - t.throws(function () { dangerous.Buffer[method]('string') }) - t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') }) - t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) }) - t.throws(function () { dangerous.Buffer[method](Infinity) }) - if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) { - t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0') - } else { - t.throws(function () { dangerous.Buffer[method](-10) }) - t.throws(function () { dangerous.Buffer[method](-1e90) }) - t.throws(function () { dangerous.Buffer[method](-Infinity) }) - } - t.throws(function () { dangerous.Buffer[method](null) }) - t.throws(function () { dangerous.Buffer[method](undefined) }) - t.throws(function () { dangerous.Buffer[method]() }) - t.throws(function () { dangerous.Buffer[method]([]) }) - t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) }) - t.throws(function () { dangerous.Buffer[method]({}) }) - }) - t.end() -}) - -test('Buffers have appropriate lengths', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer.alloc(0).length, 0) - t.equal(impl.Buffer.alloc(10).length, 10) - t.equal(impl.Buffer.from('').length, 0) - t.equal(impl.Buffer.from('string').length, 6) - t.equal(impl.Buffer.from('string', 'utf-8').length, 6) - t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11) - t.equal(impl.Buffer.from([0, 42, 3]).length, 3) - t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3) - t.equal(impl.Buffer.from([]).length, 0) - }); - ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { - t.equal(dangerous.Buffer[method](0).length, 0) - t.equal(dangerous.Buffer[method](10).length, 10) - }) - t.end() -}) - -test('Buffers have appropriate lengths (2)', function (t) { - t.equal(index.Buffer.alloc, safer.Buffer.alloc) - t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) - var ok = true; - [ safer.Buffer.alloc, - dangerous.Buffer.allocUnsafe, - dangerous.Buffer.allocUnsafeSlow - ].forEach(function (method) { - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 1e5) - var buf = method(length) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - } - }) - t.ok(ok) - t.end() -}) - -test('.alloc(size) is zero-filled and has correct length', function (t) { - t.equal(index.Buffer.alloc, safer.Buffer.alloc) - t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) - var ok = true - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 2e6) - var buf = index.Buffer.alloc(length) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - var j - for (j = 0; j < length; j++) { - if (buf[j] !== 0) ok = false - } - buf.fill(1) - for (j = 0; j < length; j++) { - if (buf[j] !== 1) ok = false - } - } - t.ok(ok) - t.end() -}) - -test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) { - ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { - var ok = true - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 2e6) - var buf = dangerous.Buffer[method](length) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - buf.fill(0, 0, length) - var j - for (j = 0; j < length; j++) { - if (buf[j] !== 0) ok = false - } - buf.fill(1, 0, length) - for (j = 0; j < length; j++) { - if (buf[j] !== 1) ok = false - } - } - t.ok(ok, method) - }) - t.end() -}) - -test('.alloc(size, fill) is `fill`-filled', function (t) { - t.equal(index.Buffer.alloc, safer.Buffer.alloc) - t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) - var ok = true - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 2e6) - var fill = Math.round(Math.random() * 255) - var buf = index.Buffer.alloc(length, fill) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - for (var j = 0; j < length; j++) { - if (buf[j] !== fill) ok = false - } - } - t.ok(ok) - t.end() -}) - -test('.alloc(size, fill) is `fill`-filled', function (t) { - t.equal(index.Buffer.alloc, safer.Buffer.alloc) - t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) - var ok = true - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 2e6) - var fill = Math.round(Math.random() * 255) - var buf = index.Buffer.alloc(length, fill) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - for (var j = 0; j < length; j++) { - if (buf[j] !== fill) ok = false - } - } - t.ok(ok) - t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97)) - t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98)) - - var tmp = new buffer.Buffer(2) - tmp.fill('ok') - if (tmp[1] === tmp[0]) { - // Outdated Node.js - t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo')) - } else { - t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko')) - } - t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok')) - - t.end() -}) - -test('safer.Buffer.from returns results same as Buffer constructor', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.deepEqual(impl.Buffer.from(''), new buffer.Buffer('')) - t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string')) - t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8')) - t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64')) - t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3])) - t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3]))) - t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([])) - }) - t.end() -}) - -test('safer.Buffer.from returns consistent results', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0)) - t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0)) - t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0)) - t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string')) - t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103])) - t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string'))) - t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree')) - t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree')) - }) - t.end() -}) diff --git a/node_modules/sax/LICENSE b/node_modules/sax/LICENSE deleted file mode 100644 index ccffa08..0000000 --- a/node_modules/sax/LICENSE +++ /dev/null @@ -1,41 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -==== - -`String.fromCodePoint` by Mathias Bynens used according to terms of MIT -License, as follows: - - Copyright Mathias Bynens - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/sax/README.md b/node_modules/sax/README.md deleted file mode 100644 index afcd3f3..0000000 --- a/node_modules/sax/README.md +++ /dev/null @@ -1,225 +0,0 @@ -# sax js - -A sax-style parser for XML and HTML. - -Designed with [node](http://nodejs.org/) in mind, but should work fine in -the browser or other CommonJS implementations. - -## What This Is - -* A very simple tool to parse through an XML string. -* A stepping stone to a streaming HTML parser. -* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML - docs. - -## What This Is (probably) Not - -* An HTML Parser - That's a fine goal, but this isn't it. It's just - XML. -* A DOM Builder - You can use it to build an object model out of XML, - but it doesn't do that out of the box. -* XSLT - No DOM = no querying. -* 100% Compliant with (some other SAX implementation) - Most SAX - implementations are in Java and do a lot more than this does. -* An XML Validator - It does a little validation when in strict mode, but - not much. -* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic - masochism. -* A DTD-aware Thing - Fetching DTDs is a much bigger job. - -## Regarding `Hello, world!').close(); - -// stream usage -// takes the same options as the parser -var saxStream = require("sax").createStream(strict, options) -saxStream.on("error", function (e) { - // unhandled errors will throw, since this is a proper node - // event emitter. - console.error("error!", e) - // clear the error - this._parser.error = null - this._parser.resume() -}) -saxStream.on("opentag", function (node) { - // same object as above -}) -// pipe is supported, and it's readable/writable -// same chunks coming in also go out. -fs.createReadStream("file.xml") - .pipe(saxStream) - .pipe(fs.createWriteStream("file-copy.xml")) -``` - - -## Arguments - -Pass the following arguments to the parser function. All are optional. - -`strict` - Boolean. Whether or not to be a jerk. Default: `false`. - -`opt` - Object bag of settings regarding string formatting. All default to `false`. - -Settings supported: - -* `trim` - Boolean. Whether or not to trim text and comment nodes. -* `normalize` - Boolean. If true, then turn any whitespace into a single - space. -* `lowercase` - Boolean. If true, then lowercase tag names and attribute names - in loose mode, rather than uppercasing them. -* `xmlns` - Boolean. If true, then namespaces are supported. -* `position` - Boolean. If false, then don't track line/col/position. -* `strictEntities` - Boolean. If true, only parse [predefined XML - entities](http://www.w3.org/TR/REC-xml/#sec-predefined-ent) - (`&`, `'`, `>`, `<`, and `"`) - -## Methods - -`write` - Write bytes onto the stream. You don't have to do this all at -once. You can keep writing as much as you want. - -`close` - Close the stream. Once closed, no more data may be written until -it is done processing the buffer, which is signaled by the `end` event. - -`resume` - To gracefully handle errors, assign a listener to the `error` -event. Then, when the error is taken care of, you can call `resume` to -continue parsing. Otherwise, the parser will not continue while in an error -state. - -## Members - -At all times, the parser object will have the following members: - -`line`, `column`, `position` - Indications of the position in the XML -document where the parser currently is looking. - -`startTagPosition` - Indicates the position where the current tag starts. - -`closed` - Boolean indicating whether or not the parser can be written to. -If it's `true`, then wait for the `ready` event to write again. - -`strict` - Boolean indicating whether or not the parser is a jerk. - -`opt` - Any options passed into the constructor. - -`tag` - The current tag being dealt with. - -And a bunch of other stuff that you probably shouldn't touch. - -## Events - -All events emit with a single argument. To listen to an event, assign a -function to `on`. Functions get executed in the this-context of -the parser object. The list of supported events are also in the exported -`EVENTS` array. - -When using the stream interface, assign handlers using the EventEmitter -`on` function in the normal fashion. - -`error` - Indication that something bad happened. The error will be hanging -out on `parser.error`, and must be deleted before parsing can continue. By -listening to this event, you can keep an eye on that kind of stuff. Note: -this happens *much* more in strict mode. Argument: instance of `Error`. - -`text` - Text node. Argument: string of text. - -`doctype` - The ``. Argument: -object with `name` and `body` members. Attributes are not parsed, as -processing instructions have implementation dependent semantics. - -`sgmldeclaration` - Random SGML declarations. Stuff like `` -would trigger this kind of event. This is a weird thing to support, so it -might go away at some point. SAX isn't intended to be used to parse SGML, -after all. - -`opentagstart` - Emitted immediately when the tag name is available, -but before any attributes are encountered. Argument: object with a -`name` field and an empty `attributes` set. Note that this is the -same object that will later be emitted in the `opentag` event. - -`opentag` - An opening tag. Argument: object with `name` and `attributes`. -In non-strict mode, tag names are uppercased, unless the `lowercase` -option is set. If the `xmlns` option is set, then it will contain -namespace binding information on the `ns` member, and will have a -`local`, `prefix`, and `uri` member. - -`closetag` - A closing tag. In loose mode, tags are auto-closed if their -parent closes. In strict mode, well-formedness is enforced. Note that -self-closing tags will have `closeTag` emitted immediately after `openTag`. -Argument: tag name. - -`attribute` - An attribute node. Argument: object with `name` and `value`. -In non-strict mode, attribute names are uppercased, unless the `lowercase` -option is set. If the `xmlns` option is set, it will also contains namespace -information. - -`comment` - A comment node. Argument: the string of the comment. - -`opencdata` - The opening tag of a ``) of a `` tags trigger a `"script"` -event, and their contents are not checked for special xml characters. -If you pass `noscript: true`, then this behavior is suppressed. - -## Reporting Problems - -It's best to write a failing test if you find an issue. I will always -accept pull requests with failing tests if they demonstrate intended -behavior, but it is very hard to figure out what issue you're describing -without a test. Writing a test is also the best way for you yourself -to figure out if you really understand the issue you think you have with -sax-js. diff --git a/node_modules/sax/lib/sax.js b/node_modules/sax/lib/sax.js deleted file mode 100644 index 795d607..0000000 --- a/node_modules/sax/lib/sax.js +++ /dev/null @@ -1,1565 +0,0 @@ -;(function (sax) { // wrapper for non-node envs - sax.parser = function (strict, opt) { return new SAXParser(strict, opt) } - sax.SAXParser = SAXParser - sax.SAXStream = SAXStream - sax.createStream = createStream - - // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns. - // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)), - // since that's the earliest that a buffer overrun could occur. This way, checks are - // as rare as required, but as often as necessary to ensure never crossing this bound. - // Furthermore, buffers are only tested at most once per write(), so passing a very - // large string into write() might have undesirable effects, but this is manageable by - // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme - // edge case, result in creating at most one complete copy of the string passed in. - // Set to Infinity to have unlimited buffers. - sax.MAX_BUFFER_LENGTH = 64 * 1024 - - var buffers = [ - 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype', - 'procInstName', 'procInstBody', 'entity', 'attribName', - 'attribValue', 'cdata', 'script' - ] - - sax.EVENTS = [ - 'text', - 'processinginstruction', - 'sgmldeclaration', - 'doctype', - 'comment', - 'opentagstart', - 'attribute', - 'opentag', - 'closetag', - 'opencdata', - 'cdata', - 'closecdata', - 'error', - 'end', - 'ready', - 'script', - 'opennamespace', - 'closenamespace' - ] - - function SAXParser (strict, opt) { - if (!(this instanceof SAXParser)) { - return new SAXParser(strict, opt) - } - - var parser = this - clearBuffers(parser) - parser.q = parser.c = '' - parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH - parser.opt = opt || {} - parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags - parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase' - parser.tags = [] - parser.closed = parser.closedRoot = parser.sawRoot = false - parser.tag = parser.error = null - parser.strict = !!strict - parser.noscript = !!(strict || parser.opt.noscript) - parser.state = S.BEGIN - parser.strictEntities = parser.opt.strictEntities - parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES) - parser.attribList = [] - - // namespaces form a prototype chain. - // it always points at the current tag, - // which protos to its parent tag. - if (parser.opt.xmlns) { - parser.ns = Object.create(rootNS) - } - - // mostly just for error reporting - parser.trackPosition = parser.opt.position !== false - if (parser.trackPosition) { - parser.position = parser.line = parser.column = 0 - } - emit(parser, 'onready') - } - - if (!Object.create) { - Object.create = function (o) { - function F () {} - F.prototype = o - var newf = new F() - return newf - } - } - - if (!Object.keys) { - Object.keys = function (o) { - var a = [] - for (var i in o) if (o.hasOwnProperty(i)) a.push(i) - return a - } - } - - function checkBufferLength (parser) { - var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10) - var maxActual = 0 - for (var i = 0, l = buffers.length; i < l; i++) { - var len = parser[buffers[i]].length - if (len > maxAllowed) { - // Text/cdata nodes can get big, and since they're buffered, - // we can get here under normal conditions. - // Avoid issues by emitting the text node now, - // so at least it won't get any bigger. - switch (buffers[i]) { - case 'textNode': - closeText(parser) - break - - case 'cdata': - emitNode(parser, 'oncdata', parser.cdata) - parser.cdata = '' - break - - case 'script': - emitNode(parser, 'onscript', parser.script) - parser.script = '' - break - - default: - error(parser, 'Max buffer length exceeded: ' + buffers[i]) - } - } - maxActual = Math.max(maxActual, len) - } - // schedule the next check for the earliest possible buffer overrun. - var m = sax.MAX_BUFFER_LENGTH - maxActual - parser.bufferCheckPosition = m + parser.position - } - - function clearBuffers (parser) { - for (var i = 0, l = buffers.length; i < l; i++) { - parser[buffers[i]] = '' - } - } - - function flushBuffers (parser) { - closeText(parser) - if (parser.cdata !== '') { - emitNode(parser, 'oncdata', parser.cdata) - parser.cdata = '' - } - if (parser.script !== '') { - emitNode(parser, 'onscript', parser.script) - parser.script = '' - } - } - - SAXParser.prototype = { - end: function () { end(this) }, - write: write, - resume: function () { this.error = null; return this }, - close: function () { return this.write(null) }, - flush: function () { flushBuffers(this) } - } - - var Stream - try { - Stream = require('stream').Stream - } catch (ex) { - Stream = function () {} - } - - var streamWraps = sax.EVENTS.filter(function (ev) { - return ev !== 'error' && ev !== 'end' - }) - - function createStream (strict, opt) { - return new SAXStream(strict, opt) - } - - function SAXStream (strict, opt) { - if (!(this instanceof SAXStream)) { - return new SAXStream(strict, opt) - } - - Stream.apply(this) - - this._parser = new SAXParser(strict, opt) - this.writable = true - this.readable = true - - var me = this - - this._parser.onend = function () { - me.emit('end') - } - - this._parser.onerror = function (er) { - me.emit('error', er) - - // if didn't throw, then means error was handled. - // go ahead and clear error, so we can write again. - me._parser.error = null - } - - this._decoder = null - - streamWraps.forEach(function (ev) { - Object.defineProperty(me, 'on' + ev, { - get: function () { - return me._parser['on' + ev] - }, - set: function (h) { - if (!h) { - me.removeAllListeners(ev) - me._parser['on' + ev] = h - return h - } - me.on(ev, h) - }, - enumerable: true, - configurable: false - }) - }) - } - - SAXStream.prototype = Object.create(Stream.prototype, { - constructor: { - value: SAXStream - } - }) - - SAXStream.prototype.write = function (data) { - if (typeof Buffer === 'function' && - typeof Buffer.isBuffer === 'function' && - Buffer.isBuffer(data)) { - if (!this._decoder) { - var SD = require('string_decoder').StringDecoder - this._decoder = new SD('utf8') - } - data = this._decoder.write(data) - } - - this._parser.write(data.toString()) - this.emit('data', data) - return true - } - - SAXStream.prototype.end = function (chunk) { - if (chunk && chunk.length) { - this.write(chunk) - } - this._parser.end() - return true - } - - SAXStream.prototype.on = function (ev, handler) { - var me = this - if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) { - me._parser['on' + ev] = function () { - var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments) - args.splice(0, 0, ev) - me.emit.apply(me, args) - } - } - - return Stream.prototype.on.call(me, ev, handler) - } - - // this really needs to be replaced with character classes. - // XML allows all manner of ridiculous numbers and digits. - var CDATA = '[CDATA[' - var DOCTYPE = 'DOCTYPE' - var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace' - var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/' - var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE } - - // http://www.w3.org/TR/REC-xml/#NT-NameStartChar - // This implementation works on strings, a single character at a time - // as such, it cannot ever support astral-plane characters (10000-EFFFF) - // without a significant breaking change to either this parser, or the - // JavaScript language. Implementation of an emoji-capable xml parser - // is left as an exercise for the reader. - var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ - - var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/ - - var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ - var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/ - - function isWhitespace (c) { - return c === ' ' || c === '\n' || c === '\r' || c === '\t' - } - - function isQuote (c) { - return c === '"' || c === '\'' - } - - function isAttribEnd (c) { - return c === '>' || isWhitespace(c) - } - - function isMatch (regex, c) { - return regex.test(c) - } - - function notMatch (regex, c) { - return !isMatch(regex, c) - } - - var S = 0 - sax.STATE = { - BEGIN: S++, // leading byte order mark or whitespace - BEGIN_WHITESPACE: S++, // leading whitespace - TEXT: S++, // general stuff - TEXT_ENTITY: S++, // & and such. - OPEN_WAKA: S++, // < - SGML_DECL: S++, // - SCRIPT: S++, // - - -``` - -## Installing - -If you use NPM, `npm install topojson-client`. Otherwise, download the [latest release](https://github.com/topojson/topojson-client/releases/latest). You can also load directly from [UNPKG](https://unpkg.com) as a [standalone library](https://unpkg.com/topojson-client@3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `topojson` global is exported: - -```html - - -``` - -The TopoJSON client API is implemented using ES2015 modules. In compatible environments, you can import the library as a namespace, like so: - -```js -import * as topojson from "topojson-client"; -``` - -[Try topojson-client in your browser.](https://runkit.com/npm/topojson-client) - -# API Reference - -# topojson.feature(topology, object) [<>](https://github.com/topojson/topojson-client/blob/master/src/feature.js "Source") - -Returns the GeoJSON Feature or FeatureCollection for the specified *object* in the given *topology*. If the specified object is a string, it is treated as *topology*.objects[*object*]. Then, if the object is a GeometryCollection, a FeatureCollection is returned, and each geometry in the collection is mapped to a Feature. Otherwise, a Feature is returned. The returned feature is a shallow copy of the source *object*: they may share identifiers, bounding boxes, properties and coordinates. - -Some examples: - -* A point is mapped to a feature with a geometry object of type “Point”. -* Likewise for line strings, polygons, and other simple geometries. -* A null geometry object (of type null in TopoJSON) is mapped to a feature with a null geometry object. -* A geometry collection of points is mapped to a feature collection of features, each with a point geometry. -* A geometry collection of geometry collections is mapped to a feature collection of features, each with a geometry collection. - -See [feature-test.js](https://github.com/topojson/topojson-client/blob/master/test/feature-test.js) for more examples. - -# topojson.merge(topology, objects) [<>](https://github.com/topojson/topojson-client/blob/master/src/merge.js#L5 "Source") - -Returns the GeoJSON MultiPolygon geometry object representing the union for the specified array of Polygon and MultiPolygon *objects* in the given *topology*. Interior borders shared by adjacent polygons are removed. See [Merging States](https://bl.ocks.org/mbostock/5416405) for an example. The returned geometry is a shallow copy of the source *object*: they may share coordinates. - -# topojson.mergeArcs(topology, objects) [<>](https://github.com/topojson/topojson-client/blob/master/src/merge.js#L9 "Source") - -Equivalent to [topojson.merge](#merge), but returns TopoJSON rather than GeoJSON. The returned geometry is a shallow copy of the source *object*: they may share coordinates. - -# topojson.mesh(topology[, object[, filter]]) [<>](https://github.com/topojson/topojson-client/blob/master/src/mesh.js#L4 "Source") - -Returns the GeoJSON MultiLineString geometry object representing the mesh for the specified *object* in the given *topology*. This is useful for rendering strokes in complicated objects efficiently, as edges that are shared by multiple features are only stroked once. If *object* is not specified, a mesh of the entire topology is returned. The returned geometry is a shallow copy of the source *object*: they may share coordinates. - -An optional *filter* function may be specified to prune arcs from the returned mesh using the topology. The filter function is called once for each candidate arc and takes two arguments, *a* and *b*, two geometry objects that share that arc. Each arc is only included in the resulting mesh if the filter function returns true. For typical map topologies the geometries *a* and *b* are adjacent polygons and the candidate arc is their boundary. If an arc is only used by a single geometry then *a* and *b* are identical. This property is useful for separating interior and exterior boundaries; an easy way to produce a mesh of interior boundaries is: - -```js -var interiors = topojson.mesh(topology, object, function(a, b) { return a !== b; }); -``` - -See this [county choropleth](https://bl.ocks.org/mbostock/4060606) for example. Note: the *a* and *b* objects are TopoJSON objects (pulled directly from the topology), and not automatically converted to GeoJSON features as by [topojson.feature](#feature). - -# topojson.meshArcs(topology[, object[, filter]]) [<>](https://github.com/topojson/topojson-client/blob/master/src/mesh.js#L8 "Source") - -Equivalent to [topojson.mesh](#mesh), but returns TopoJSON rather than GeoJSON. The returned geometry is a shallow copy of the source *object*: they may share coordinates. - -# topojson.neighbors(objects) [<>](https://github.com/topojson/topojson-client/blob/master/src/neighbors.js "Source") - -Returns an array representing the set of neighboring objects for each object in the specified *objects* array. The returned array has the same number of elements as the input array; each element *i* in the returned array is the array of indexes for neighbors of object *i* in the input array. For example, if the specified objects array contains the features *foo* and *bar*, and these features are neighbors, the returned array will be \[\[1\], \[0\]\], indicating that *foo* is a neighbor of *bar* and *vice versa*. Each array of neighbor indexes for each object is guaranteed to be sorted in ascending order. - -For a practical example, see the [world map](https://bl.ocks.org/mbostock/4180634) with topological coloring. - -### Transforms - -# topojson.bbox(topology) [<>](https://github.com/topojson/topojson-client/blob/master/src/bbox.js "Source") - -Returns the computed [bounding box](https://github.com/topojson/topojson-specification#3-bounding-boxes) of the specified *topology* [*x*₀, *y*₀, *x*₁, *y*₁] where *x*₀ is the minimum *x*-value, *y*₀ is the minimum *y*-value, *x*₁ is the maximum *x*-value, and *y*₁ is the maximum *y*-value. If the *topology* has no points and no arcs, the returned bounding box is [∞, ∞, -∞, -∞]. (This method ignores the existing *topology*.bbox, if any.) - -# topojson.quantize(topology, transform) [<>](https://github.com/topojson/topojson-client/blob/master/src/quantize.js "Source") - -Returns a shallow copy of the specified *topology* with [quantized and delta-encoded](https://github.com/topojson/topojson-specification#213-arcs) arcs according to the specified [*transform* object](https://github.com/topojson/topojson-specification/blob/master/README.md#212-transforms). If the *topology* is already quantized, an error is thrown. See also [topoquantize](#topoquantize). - -If a quantization number *n* is specified instead of a *transform* object, the corresponding transform object is first computed using the bounding box of the topology. In this case, the quantization number *n* must be a positive integer greater than one which determines the maximum number of expressible values per dimension in the resulting quantized coordinates; typically, a power of ten is chosen such as 1e4, 1e5 or 1e6. If the *topology* does not already have a *topology*.bbox, one is computed using [topojson.bbox](#bbox). - -# topojson.transform(transform) [<>](https://github.com/topojson/topojson-client/blob/master/src/transform.js "Source") - -If the specified [*transform* object](https://github.com/topojson/topojson-specification/blob/master/README.md#212-transforms) is non-null, returns a [point *transform* function](#_transform) to remove delta-encoding and apply the transform. If the *transform* is null, returns the identity function. - -# topojson.untransform(transform) [<>](https://github.com/topojson/topojson-client/blob/master/src/untransform.js "Source") - -If the specified [*transform* object](https://github.com/topojson/topojson-specification/blob/master/README.md#212-transforms) is non-null, returns a [point *transform* function](#_transform) to apply quantized delta-encoding and remove the transform. If the *transform* is null, returns the identity function. See also [topojson.quantize](#quantize). - -# transform(point[, index]) - -Applies this transform function to the specified *point*, returning a new point with the transformed coordinates. If the specified *index* is truthy, the input *point* is treated as relative to the previous point passed to this transform, as is the case with delta-encoded arcs. - -## Command Line Reference - -### topo2geo - -# topo2geo [options…] <name=file>… [<>](https://github.com/topojson/topojson-client/blob/master/bin/topo2geo "Source") - -Converts one or more TopoJSON objects from an input topology to one or more GeoJSON features. For example, to convert the “states” TopoJSON GeometryCollection object in us.json to a GeoJSON feature collection in us-states.json: - -``` -topo2geo states=us-states.json < us.json -``` - -For convenience, you can omit the object name and specify only the file *name*; the object name will be the basename of the file, with the directory and extension removed. For example, to convert the “states” TopoJSON GeometryCollection object in us.json to a GeoJSON feature collection in states.json: - -``` -topo2geo states.json < us.json -``` - -See also [geo2topo](https://github.com/topojson/topojson/blob/master/README.md#geo2topo). - -To list the available object names, use [--list](#topo2geo_list). - -# topo2geo -h -
# topo2geo --help - -Output usage information. - -# topo2geo -V -
# topo2geo --version - -Output the version number. - -# topo2geo -n -
# topo2geo --newline-delimited - -Output [newline-delimited JSON](http://ndjson.org/), with one feature per line. - -# topo2geo -i file -
# topo2geo --in file - -Specify the input TopoJSON file name. Defaults to “-” for stdin. - -# topo2geo -l -
# topo2geo --list - -List the names of the objects in the input topology, and then exit. For example, this: - -``` -topo2geo -l < us.json -``` - -Will output this: - -``` -counties -states -nation -``` - -### topomerge - -# topomerge [options…] <target=source> [file] [<>](https://github.com/topojson/topojson-client/blob/master/bin/topomerge "Source") - -Merges polygons (or meshes lines) from the specified *source* TopoJSON geometry collection object, assigning to the *target* object. - -See also [topojson.mergeArcs](#mergeArcs) and [topojson.meshArcs](#meshArcs). - -# topomerge -h -
# topomerge --help - -Output usage information. - -# topomerge -V -
# topomerge --version - -Output the version number. - -# topomerge -o file -
# topomerge --out file - -Specify the output TopoJSON file name. Defaults to “-” for stdout. - -# topomerge -k expression -
# topomerge --key expression - -Specify a JavaScript *expression*, given a TopoJSON geometry object *d* and its zero-based index *i* in its parent collection, that determines how geometry objects are grouped before merging; each group is merged separately. For example, given a topology of U.S. *counties*, where the *id* of each county is it’s five-digit FIPS code, the county boundaries can be merged into state boundaries by using the first two digits of the county FIPS code, which represents the state FIPS code: - -``` -topomerge states=counties -k 'd.id.slice(0, 2)' < us-counties.json > us-states.json -``` - -If a key is not specified, all input geometry objects will be merged together. For example, this can be used to merge the state boundaries into a single nation boundary: - -``` -topomerge nation=states < us-states.json > us.json -``` - -# topomerge -f expression -
# topomerge --filter expression - -Specify a JavaScript *expression* that filters the input geometries before merging or meshing. In conjunction with [--mesh](#topomerge_mesh), the *expression* is given two TopoJSON geometry objects *a* and *b* that represent the adjacent features for a given arc segment; if the *expression* evaluates truthily, the associated arc segment is retained in mesh. Otherwise, the *expression* is given an input TopoJSON geometry object *d* and its zero-based index *i* in its parent collection; if the *expression* evaluates truthily, the geometry object is retained in the merged polygon. - -# topomerge --mesh - -Use [topojson.meshArcs](#meshArcs) instead of [topojson.mergeArcs](#mergeArcs), generating a geometry collection of lines rather than polygons. - -### topoquantize - -# topoquantize [options…] <n> [file] [<>](https://github.com/topojson/topojson-client/blob/master/bin/topoquantize "Source") - -Quantizes the coordinates of the input TopoJSON topology and [delta-encodes](https://github.com/topojson/topojson-specification#213-arcs) the topology’s arcs. The quantization parameter *n* must be a positive integer greater than one, and determines the maximum expressible number of unique values per dimension in the resulting quantized coordinates; typically, a power of ten is chosen such as 1e4, 1e5 or 1e6. If the *topology* does not already have a [bbox](#bbox), one is computed and assigned. If the *topology* is already quantized, an error is thrown. See also [topojson.quantize](#quantize). - -# topoquantize -h -
# topoquantize --help - -Output usage information. - -# topoquantize -V -
# topoquantize --version - -Output the version number. - -# topoquantize -o file -
# topoquantize --out file - -Specify the output TopoJSON file name. Defaults to “-” for stdout. diff --git a/node_modules/topojson-client/bin/topo2geo b/node_modules/topojson-client/bin/topo2geo deleted file mode 100755 index 4406905..0000000 --- a/node_modules/topojson-client/bin/topo2geo +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env node - -var fs = require("fs"), - path = require("path"), - commander = require("commander"), - topojson = require("../"); - -commander - .version(require("../package.json").version) - .usage("[options] …") - .description("Converts TopoJSON objects to GeoJSON features.") - .option("-i, --in ", "input topology file name; defaults to “-” for stdin", "-") - .option("-l, --list", "list the object names on the input topology") - .option("-n, --newline-delimited", "output newline-delimited JSON") - .parse(process.argv); - -if (!commander.list === commander.args.length < 1) { - console.error(); - console.error(" error: " + (commander.list ? "--list does not take arguments" : "no arguments specified")); - console.error(); - process.exit(1); -} - -read(commander.in).then(write).catch(abort); - -function read(file) { - return new Promise(function(resolve, reject) { - var data = []; - readStream(file) - .on("data", function(d) { data.push(d); }) - .on("end", function() { resolve(JSON.parse(Buffer.concat(data))); }) - .on("error", reject); - }); -} - -function readStream(file) { - return file === "-" ? process.stdin : fs.createReadStream(file); -} - -function write(topology) { - var write, writer = commander.newlineDelimited ? writeNewlineDelimitedFeature : writeFeature, name; - if (commander.list) { - for (name in topology.objects) { - console.log(name); - } - return; - } - write = Promise.resolve(); - commander.args.forEach(function(specifier) { - var i = specifier.indexOf("="), - file = i >= 0 ? specifier.slice(i + 1) : specifier, - name = i >= 0 ? specifier.slice(0, i) : path.basename(specifier, path.extname(specifier)); - if (!(name in topology.objects)) { - console.error(); - console.error(" error: object “" + name + "” not found"); - console.error(); - process.exit(1); - } - write = write.then(writer(file, topojson.feature(topology, topology.objects[name]))); - }); - return write; -} - -function writeStream(file) { - return (file === "-" ? process.stdout : fs.createWriteStream(file)).on("error", handleEpipe); -} - -function writeFeature(file, feature) { - return new Promise(function(resolve, reject) { - writeStream(file).on("error", reject)[file === "-" ? "write" : "end"](JSON.stringify(feature) + "\n", function(error) { - if (error) reject(error); - else resolve(); - }); - }); -} - -function writeNewlineDelimitedFeature(file, feature) { - return feature == null || feature.type != "FeatureCollection" ? writeFeature(file, feature) : new Promise(function(resolve, reject) { - var stream = writeStream(file).on("error", reject), i = -1, n = feature.features.length; - - (function writeNext(error) { - if (error) return void reject(error); - if (++i >= n) { - if (file !== "-") stream.end(writeEnd); - else writeEnd(); - } else { - stream.write(JSON.stringify(feature.features[i]) + "\n", writeNext); - } - })(null); - - function writeEnd(error) { - if (error) return void reject(error); - resolve(); - } - }); -} - -function handleEpipe(error) { - if (error.code === "EPIPE" || error.errno === "EPIPE") { - process.exit(0); - } -} - -function abort(error) { - console.error(error.stack); -} diff --git a/node_modules/topojson-client/bin/topomerge b/node_modules/topojson-client/bin/topomerge deleted file mode 100755 index be790ed..0000000 --- a/node_modules/topojson-client/bin/topomerge +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env node - -var fs = require("fs"), - vm = require("vm"), - commander = require("commander"), - topojson = require("../"); - -commander - .version(require("../package.json").version) - .usage("[options] [file]") - .description("Merges the source TopoJSON geometry collection, assigning to the target.") - .option("-o, --out ", "output topology file name; defaults to “-” for stdout", "-") - .option("-k, --key ", "group geometries by key") - .option("-f, --filter ", "filter merged geometries or meshed lines") - .option("--mesh", "mesh lines instead of merging polygons") - .parse(process.argv); - -if (commander.args.length < 1) { - console.error(); - console.error(" error: missing source and target names"); - console.error(); - process.exit(1); -} else if (commander.args.length > 2) { - console.error(); - console.error(" error: multiple input files"); - console.error(); - process.exit(1); -} else if (commander.args.length === 1) { - commander.args.push("-"); -} - -var keyFunction = function() {}, - postfilterFunction = function() { return true; }, - prefilterFunction = function() { return true; }; - -if (commander.key != null) { - var keySandbox = {d: undefined, i: -1}, - keyContext = new vm.createContext(keySandbox), - keyScript = new vm.Script("(" + commander.key + ")"); - keyFunction = function(d, i) { - keySandbox.d = d; - keySandbox.i = i; - return keyScript.runInContext(keyContext); - }; -} - -if (commander.filter != null) { - if (commander.mesh) { - var filterSandbox = {a: undefined, b: undefined}, - filterContext = new vm.createContext(filterSandbox), - filterScript = new vm.Script("(" + commander.filter + ")"); - postfilterFunction = function(a, b) { - filterSandbox.a = a; - filterSandbox.b = b; - return filterScript.runInContext(filterContext); - }; - } else { - var filterSandbox = {d: undefined, i: -1}, - filterContext = new vm.createContext(filterSandbox), - filterScript = new vm.Script("(" + commander.filter + ")"); - prefilterFunction = function(d, i) { - filterSandbox.d = d; - filterSandbox.i = i; - return filterScript.runInContext(filterContext); - }; - } -} - -read(commander.args[1]).then(merge).then(write(commander.out)).catch(abort); - -function read(file) { - return new Promise(function(resolve, reject) { - var data = [], stream = file === "-" ? process.stdin : fs.createReadStream(file); - stream - .on("data", function(d) { data.push(d); }) - .on("end", function() { resolve(JSON.parse(Buffer.concat(data))); }) - .on("error", reject); - }); -} - -function merge(topology) { - var name = commander.args[0], i = name.indexOf("="), - sourceName = i >= 0 ? name.slice(i + 1) : name, - targetName = i >= 0 ? name.slice(0, i) : name, - source = topology.objects[sourceName], - target = topology.objects[targetName] = {type: "GeometryCollection", geometries: []}, - geometries = target.geometries, - geometriesByKey = {}, - k; - - if (!source) { - console.error(); - console.error(" error: source object “" + name + "” not found"); - console.error(); - process.exit(1); - } - - if (source.type !== "GeometryCollection") { - console.error(); - console.error(" error: expected GeometryCollection, not " + source.type); - console.error(); - process.exit(1); - } - - source.geometries.forEach(function(geometry, i) { - if (!prefilterFunction(geometry, i)) return; - var k = stringify(keyFunction(geometry, i)), v; - if (v = geometriesByKey[k]) v.push(geometry); - else geometriesByKey[k] = v = [geometry]; - }); - - if (commander.mesh) { - for (k in geometriesByKey) { - var v = geometriesByKey[k], - o = topojson.meshArcs(topology, {type: "GeometryCollection", geometries: v}, postfilterFunction); - o.id = k.length > 1 ? k.slice(1) : undefined; - o.properties = properties(v); - geometries.push(o); - } - } else { - for (k in geometriesByKey) { - var v = geometriesByKey[k], - o = topojson.mergeArcs(topology, v); - o.id = k.length > 1 ? k.slice(1) : undefined; - o.properties = properties(v); - geometries.push(o); - } - } - - return topology; -} - -function stringify(key) { - return key == null ? "$" : "$" + key; -} - -function properties(objects) { - var properties = undefined, hasProperties; - - objects.forEach(function(object) { - var newProperties = object.properties, key; - - // If no properties have yet been merged, - // then we need to initialize the merged properties object. - if (properties === undefined) { - - // If the first set of properties is null, undefined or empty, - // then the result of the merge will be the empty set. - // Otherwise, the new properties can copied into the merged object. - if (newProperties != null) for (key in newProperties) { - properties = {}; - for (key in newProperties) properties[key] = newProperties[key]; - return; - } - - properties = null; - return; - } - - // If any of the new properties are null or undefined, - // then the result of the merge will be the empty set. - if (newProperties == null) properties = null; - if (properties === null) return; - - // Now mark as inconsistent any of the properties - // that differ from previously-merged values. - for (key in newProperties) { - if ((key in properties) && !is(properties[key], newProperties[key])) { - properties[key] = undefined; - } - } - - // And mark as inconsistent any of the properties - // that are missing from this new set of merged values. - for (key in properties) { - if (!(key in newProperties)) { - properties[key] = undefined; - } - } - - return object; - }); - - // Return undefined if there are no properties. - for (var key in properties) { - if (properties[key] !== undefined) { - return properties; - } - } -}; - -function write(file) { - var stream = (file === "-" ? process.stdout : fs.createWriteStream(file)).on("error", handleEpipe); - return function(topology) { - return new Promise(function(resolve, reject) { - stream.on("error", reject)[stream === process.stdout ? "write" : "end"](JSON.stringify(topology) + "\n", function(error) { - if (error) reject(error); - else resolve(); - }); - }); - }; -} - -function handleEpipe(error) { - if (error.code === "EPIPE" || error.errno === "EPIPE") { - process.exit(0); - } -} - -function abort(error) { - console.error(error.stack); -} - -function is(x, y) { - return x === y ? x !== 0 || 1 / x === 1 / y : x !== x && y !== y; -} diff --git a/node_modules/topojson-client/bin/topoquantize b/node_modules/topojson-client/bin/topoquantize deleted file mode 100755 index aac6b79..0000000 --- a/node_modules/topojson-client/bin/topoquantize +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env node - -var fs = require("fs"), - commander = require("commander"), - topojson = require("../"); - -commander - .version(require("../package.json").version) - .usage("[options] [file]") - .description("Quantizes TopoJSON.") - .option("-o, --out ", "output topology file name; defaults to “-” for stdout", "-") - .parse(process.argv); - -if (commander.args.length < 1) { - console.error(); - console.error(" error: missing quantization parameter n"); - console.error(); - process.exit(1); -} else if (commander.args.length > 2) { - console.error(); - console.error(" error: multiple input files"); - console.error(); - process.exit(1); -} else if (commander.args.length === 1) { - commander.args.push("-"); -} - -if (!(Math.floor(commander.args[0]) >= 2)) { - console.error(); - console.error(" error: invalid quantization parameter " + commander.args[0]); - console.error(); - process.exit(1); -} - -read(commander.args[1]).then(quantize).then(write(commander.out)).catch(abort); - -function read(file) { - return new Promise(function(resolve, reject) { - var data = [], stream = file === "-" ? process.stdin : fs.createReadStream(file); - stream - .on("data", function(d) { data.push(d); }) - .on("end", function() { resolve(JSON.parse(Buffer.concat(data))); }) - .on("error", reject); - }); -} - -function quantize(topology) { - return topojson.quantize(topology, +commander.args[0]); -} - -function write(file) { - var stream = (file === "-" ? process.stdout : fs.createWriteStream(file)).on("error", handleEpipe); - return function(topology) { - return new Promise(function(resolve, reject) { - stream.on("error", reject)[stream === process.stdout ? "write" : "end"](JSON.stringify(topology) + "\n", function(error) { - if (error) reject(error); - else resolve(); - }); - }); - }; -} - -function handleEpipe(error) { - if (error.code === "EPIPE" || error.errno === "EPIPE") { - process.exit(0); - } -} - -function abort(error) { - console.error(); - console.error(" error: " + error.message); - console.error(); - process.exit(1); -} diff --git a/node_modules/topojson-client/dist/topojson-client.js b/node_modules/topojson-client/dist/topojson-client.js deleted file mode 100644 index 7921400..0000000 --- a/node_modules/topojson-client/dist/topojson-client.js +++ /dev/null @@ -1,508 +0,0 @@ -// https://github.com/topojson/topojson-client v3.1.0 Copyright 2019 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(global = global || self, factory(global.topojson = global.topojson || {})); -}(this, function (exports) { 'use strict'; - -function identity(x) { - return x; -} - -function transform(transform) { - if (transform == null) return identity; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n); - output[0] = (x0 += input[0]) * kx + dx; - output[1] = (y0 += input[1]) * ky + dy; - while (j < n) output[j] = input[j], ++j; - return output; - }; -} - -function bbox(topology) { - var t = transform(topology.transform), key, - x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0; - - function bboxPoint(p) { - p = t(p); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - - function bboxGeometry(o) { - switch (o.type) { - case "GeometryCollection": o.geometries.forEach(bboxGeometry); break; - case "Point": bboxPoint(o.coordinates); break; - case "MultiPoint": o.coordinates.forEach(bboxPoint); break; - } - } - - topology.arcs.forEach(function(arc) { - var i = -1, n = arc.length, p; - while (++i < n) { - p = t(arc[i], i); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - }); - - for (key in topology.objects) { - bboxGeometry(topology.objects[key]); - } - - return [x0, y0, x1, y1]; -} - -function reverse(array, n) { - var t, j = array.length, i = j - n; - while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; -} - -function feature(topology, o) { - if (typeof o === "string") o = topology.objects[o]; - return o.type === "GeometryCollection" - ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature$1(topology, o); })} - : feature$1(topology, o); -} - -function feature$1(topology, o) { - var id = o.id, - bbox = o.bbox, - properties = o.properties == null ? {} : o.properties, - geometry = object(topology, o); - return id == null && bbox == null ? {type: "Feature", properties: properties, geometry: geometry} - : bbox == null ? {type: "Feature", id: id, properties: properties, geometry: geometry} - : {type: "Feature", id: id, bbox: bbox, properties: properties, geometry: geometry}; -} - -function object(topology, o) { - var transformPoint = transform(topology.transform), - arcs = topology.arcs; - - function arc(i, points) { - if (points.length) points.pop(); - for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) { - points.push(transformPoint(a[k], k)); - } - if (i < 0) reverse(points, n); - } - - function point(p) { - return transformPoint(p); - } - - function line(arcs) { - var points = []; - for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points); - if (points.length < 2) points.push(points[0]); // This should never happen per the specification. - return points; - } - - function ring(arcs) { - var points = line(arcs); - while (points.length < 4) points.push(points[0]); // This may happen if an arc has only two points. - return points; - } - - function polygon(arcs) { - return arcs.map(ring); - } - - function geometry(o) { - var type = o.type, coordinates; - switch (type) { - case "GeometryCollection": return {type: type, geometries: o.geometries.map(geometry)}; - case "Point": coordinates = point(o.coordinates); break; - case "MultiPoint": coordinates = o.coordinates.map(point); break; - case "LineString": coordinates = line(o.arcs); break; - case "MultiLineString": coordinates = o.arcs.map(line); break; - case "Polygon": coordinates = polygon(o.arcs); break; - case "MultiPolygon": coordinates = o.arcs.map(polygon); break; - default: return null; - } - return {type: type, coordinates: coordinates}; - } - - return geometry(o); -} - -function stitch(topology, arcs) { - var stitchedArcs = {}, - fragmentByStart = {}, - fragmentByEnd = {}, - fragments = [], - emptyIndex = -1; - - // Stitch empty arcs first, since they may be subsumed by other arcs. - arcs.forEach(function(i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], t; - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) { - t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - } - }); - - arcs.forEach(function(i) { - var e = ends(i), - start = e[0], - end = e[1], - f, g; - - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else { - f = [i]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1; - if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; }); - else p1 = arc[arc.length - 1]; - return i < 0 ? [p1, p0] : [p0, p1]; - } - - function flush(fragmentByEnd, fragmentByStart) { - for (var k in fragmentByEnd) { - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; }); - fragments.push(f); - } - } - - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); }); - - return fragments; -} - -function mesh(topology) { - return object(topology, meshArcs.apply(this, arguments)); -} - -function meshArcs(topology, object, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object, filter); - else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; - return {type: "MultiLineString", arcs: stitch(topology, arcs)}; -} - -function extractArcs(topology, object, filter) { - var arcs = [], - geomsByArc = [], - geom; - - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom}); - } - - function extract1(arcs) { - arcs.forEach(extract0); - } - - function extract2(arcs) { - arcs.forEach(extract1); - } - - function extract3(arcs) { - arcs.forEach(extract2); - } - - function geometry(o) { - switch (geom = o, o.type) { - case "GeometryCollection": o.geometries.forEach(geometry); break; - case "LineString": extract1(o.arcs); break; - case "MultiLineString": case "Polygon": extract2(o.arcs); break; - case "MultiPolygon": extract3(o.arcs); break; - } - } - - geometry(object); - - geomsByArc.forEach(filter == null - ? function(geoms) { arcs.push(geoms[0].i); } - : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - - return arcs; -} - -function planarRingArea(ring) { - var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; - while (++i < n) a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; - return Math.abs(area); // Note: doubled area! -} - -function merge(topology) { - return object(topology, mergeArcs.apply(this, arguments)); -} - -function mergeArcs(topology, objects) { - var polygonsByArc = {}, - polygons = [], - groups = []; - - objects.forEach(geometry); - - function geometry(o) { - switch (o.type) { - case "GeometryCollection": o.geometries.forEach(geometry); break; - case "Polygon": extract(o.arcs); break; - case "MultiPolygon": o.arcs.forEach(extract); break; - } - } - - function extract(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); - }); - }); - polygons.push(polygon); - } - - function area(ring) { - return planarRingArea(object(topology, {type: "Polygon", arcs: [ring]}).coordinates[0]); - } - - polygons.forEach(function(polygon) { - if (!polygon._) { - var group = [], - neighbors = [polygon]; - polygon._ = 1; - groups.push(group); - while (polygon = neighbors.pop()) { - group.push(polygon); - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { - if (!polygon._) { - polygon._ = 1; - neighbors.push(polygon); - } - }); - }); - }); - } - } - }); - - polygons.forEach(function(polygon) { - delete polygon._; - }); - - return { - type: "MultiPolygon", - arcs: groups.map(function(polygons) { - var arcs = [], n; - - // Extract the exterior (unique) arcs. - polygons.forEach(function(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) { - arcs.push(arc); - } - }); - }); - }); - - // Stitch the arcs into one or more rings. - arcs = stitch(topology, arcs); - - // If more than one ring is returned, - // at most one of these rings can be the exterior; - // choose the one with the greatest absolute area. - if ((n = arcs.length) > 1) { - for (var i = 1, k = area(arcs[0]), ki, t; i < n; ++i) { - if ((ki = area(arcs[i])) > k) { - t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki; - } - } - } - - return arcs; - }).filter(function(arcs) { - return arcs.length > 0; - }) - }; -} - -function bisect(a, x) { - var lo = 0, hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; - } - return lo; -} - -function neighbors(objects) { - var indexesByArc = {}, // arc index -> array of object indexes - neighbors = objects.map(function() { return []; }); - - function line(arcs, i) { - arcs.forEach(function(a) { - if (a < 0) a = ~a; - var o = indexesByArc[a]; - if (o) o.push(i); - else indexesByArc[a] = [i]; - }); - } - - function polygon(arcs, i) { - arcs.forEach(function(arc) { line(arc, i); }); - } - - function geometry(o, i) { - if (o.type === "GeometryCollection") o.geometries.forEach(function(o) { geometry(o, i); }); - else if (o.type in geometryType) geometryType[o.type](o.arcs, i); - } - - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); } - }; - - objects.forEach(geometry); - - for (var i in indexesByArc) { - for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) { - for (var k = j + 1; k < m; ++k) { - var ij = indexes[j], ik = indexes[k], n; - if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik); - if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij); - } - } - } - - return neighbors; -} - -function untransform(transform) { - if (transform == null) return identity; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, - n = input.length, - output = new Array(n), - x1 = Math.round((input[0] - dx) / kx), - y1 = Math.round((input[1] - dy) / ky); - output[0] = x1 - x0, x0 = x1; - output[1] = y1 - y0, y0 = y1; - while (j < n) output[j] = input[j], ++j; - return output; - }; -} - -function quantize(topology, transform) { - if (topology.transform) throw new Error("already quantized"); - - if (!transform || !transform.scale) { - if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be ≥2"); - box = topology.bbox || bbox(topology); - var x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3], n; - transform = {scale: [x1 - x0 ? (x1 - x0) / (n - 1) : 1, y1 - y0 ? (y1 - y0) / (n - 1) : 1], translate: [x0, y0]}; - } else { - box = topology.bbox; - } - - var t = untransform(transform), box, key, inputs = topology.objects, outputs = {}; - - function quantizePoint(point) { - return t(point); - } - - function quantizeGeometry(input) { - var output; - switch (input.type) { - case "GeometryCollection": output = {type: "GeometryCollection", geometries: input.geometries.map(quantizeGeometry)}; break; - case "Point": output = {type: "Point", coordinates: quantizePoint(input.coordinates)}; break; - case "MultiPoint": output = {type: "MultiPoint", coordinates: input.coordinates.map(quantizePoint)}; break; - default: return input; - } - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - if (input.properties != null) output.properties = input.properties; - return output; - } - - function quantizeArc(input) { - var i = 0, j = 1, n = input.length, p, output = new Array(n); // pessimistic - output[0] = t(input[0], 0); - while (++i < n) if ((p = t(input[i], i))[0] || p[1]) output[j++] = p; // non-coincident points - if (j === 1) output[j++] = [0, 0]; // an arc must have at least two points - output.length = j; - return output; - } - - for (key in inputs) outputs[key] = quantizeGeometry(inputs[key]); - - return { - type: "Topology", - bbox: box, - transform: transform, - objects: outputs, - arcs: topology.arcs.map(quantizeArc) - }; -} - -exports.bbox = bbox; -exports.feature = feature; -exports.merge = merge; -exports.mergeArcs = mergeArcs; -exports.mesh = mesh; -exports.meshArcs = meshArcs; -exports.neighbors = neighbors; -exports.quantize = quantize; -exports.transform = transform; -exports.untransform = untransform; - -Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/topojson-client/dist/topojson-client.min.js b/node_modules/topojson-client/dist/topojson-client.min.js deleted file mode 100644 index 41433fa..0000000 --- a/node_modules/topojson-client/dist/topojson-client.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://github.com/topojson/topojson-client v3.1.0 Copyright 2019 Mike Bostock -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).topojson=e.topojson||{})}(this,function(e){"use strict";function t(e){return e}function r(e){if(null==e)return t;var r,n,o=e.scale[0],a=e.scale[1],i=e.translate[0],c=e.translate[1];return function(e,t){t||(r=n=0);var u=2,f=e.length,s=new Array(f);for(s[0]=(r+=e[0])*o+i,s[1]=(n+=e[1])*a+c;ui&&(i=e[0]),e[1]c&&(c=e[1])}function f(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(f);break;case"Point":u(e.coordinates);break;case"MultiPoint":e.coordinates.forEach(u)}}for(t in e.arcs.forEach(function(e){for(var t,r=-1,u=e.length;++ri&&(i=t[0]),t[1]c&&(c=t[1])}),e.objects)f(e.objects[t]);return[o,a,i,c]}function o(e,t){var r=t.id,n=t.bbox,o=null==t.properties?{}:t.properties,i=a(e,t);return null==r&&null==n?{type:"Feature",properties:o,geometry:i}:null==n?{type:"Feature",id:r,properties:o,geometry:i}:{type:"Feature",id:r,bbox:n,properties:o,geometry:i}}function a(e,t){var n=r(e.transform),o=e.arcs;function a(e,t){t.length&&t.pop();for(var r=o[e<0?~e:e],a=0,i=r.length;a1)n=function(e,t,r){var n,o=[],a=[];function i(e){var t=e<0?~e:e;(a[t]||(a[t]=[])).push({i:e,g:n})}function c(e){e.forEach(i)}function u(e){e.forEach(c)}return function e(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":c(t.arcs);break;case"MultiLineString":case"Polygon":u(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(u)}(t.arcs)}}(t),a.forEach(null==r?function(e){o.push(e[0].i)}:function(e){r(e[0].g,e[e.length-1].g)&&o.push(e[0].i)}),o}(0,t,r);else for(o=0,n=new Array(a=e.arcs.length);o1)for(var a,c,f=1,s=u(o[0]);fs&&(c=o[0],o[0]=o[f],o[f]=c,s=a);return o}).filter(function(e){return e.length>0})}}function f(e,t){for(var r=0,n=e.length;r>>1;e[o]=2))throw new Error("n must be ≥2");var r,o=(u=e.bbox||n(e))[0],a=u[1],i=u[2],c=u[3];t={scale:[i-o?(i-o)/(r-1):1,c-a?(c-a)/(r-1):1],translate:[o,a]}}var u,f,l=s(t),h=e.objects,p={};function g(e){return l(e)}function y(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(y)};break;case"Point":t={type:"Point",coordinates:g(e.coordinates)};break;case"MultiPoint":t={type:"MultiPoint",coordinates:e.coordinates.map(g)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}for(f in h)p[f]=y(h[f]);return{type:"Topology",bbox:u,transform:t,objects:p,arcs:e.arcs.map(function(e){var t,r=0,n=1,o=e.length,a=new Array(o);for(a[0]=l(e[0],0);++r x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - - function bboxGeometry(o) { - switch (o.type) { - case "GeometryCollection": o.geometries.forEach(bboxGeometry); break; - case "Point": bboxPoint(o.coordinates); break; - case "MultiPoint": o.coordinates.forEach(bboxPoint); break; - } - } - - topology.arcs.forEach(function(arc) { - var i = -1, n = arc.length, p; - while (++i < n) { - p = t(arc[i], i); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - }); - - for (key in topology.objects) { - bboxGeometry(topology.objects[key]); - } - - return [x0, y0, x1, y1]; -} diff --git a/node_modules/topojson-client/src/bisect.js b/node_modules/topojson-client/src/bisect.js deleted file mode 100644 index ebd4b57..0000000 --- a/node_modules/topojson-client/src/bisect.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function(a, x) { - var lo = 0, hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; - } - return lo; -} diff --git a/node_modules/topojson-client/src/feature.js b/node_modules/topojson-client/src/feature.js deleted file mode 100644 index 6bf73f0..0000000 --- a/node_modules/topojson-client/src/feature.js +++ /dev/null @@ -1,70 +0,0 @@ -import reverse from "./reverse.js"; -import transform from "./transform.js"; - -export default function(topology, o) { - if (typeof o === "string") o = topology.objects[o]; - return o.type === "GeometryCollection" - ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature(topology, o); })} - : feature(topology, o); -} - -function feature(topology, o) { - var id = o.id, - bbox = o.bbox, - properties = o.properties == null ? {} : o.properties, - geometry = object(topology, o); - return id == null && bbox == null ? {type: "Feature", properties: properties, geometry: geometry} - : bbox == null ? {type: "Feature", id: id, properties: properties, geometry: geometry} - : {type: "Feature", id: id, bbox: bbox, properties: properties, geometry: geometry}; -} - -export function object(topology, o) { - var transformPoint = transform(topology.transform), - arcs = topology.arcs; - - function arc(i, points) { - if (points.length) points.pop(); - for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) { - points.push(transformPoint(a[k], k)); - } - if (i < 0) reverse(points, n); - } - - function point(p) { - return transformPoint(p); - } - - function line(arcs) { - var points = []; - for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points); - if (points.length < 2) points.push(points[0]); // This should never happen per the specification. - return points; - } - - function ring(arcs) { - var points = line(arcs); - while (points.length < 4) points.push(points[0]); // This may happen if an arc has only two points. - return points; - } - - function polygon(arcs) { - return arcs.map(ring); - } - - function geometry(o) { - var type = o.type, coordinates; - switch (type) { - case "GeometryCollection": return {type: type, geometries: o.geometries.map(geometry)}; - case "Point": coordinates = point(o.coordinates); break; - case "MultiPoint": coordinates = o.coordinates.map(point); break; - case "LineString": coordinates = line(o.arcs); break; - case "MultiLineString": coordinates = o.arcs.map(line); break; - case "Polygon": coordinates = polygon(o.arcs); break; - case "MultiPolygon": coordinates = o.arcs.map(polygon); break; - default: return null; - } - return {type: type, coordinates: coordinates}; - } - - return geometry(o); -} diff --git a/node_modules/topojson-client/src/identity.js b/node_modules/topojson-client/src/identity.js deleted file mode 100644 index b2f94b2..0000000 --- a/node_modules/topojson-client/src/identity.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(x) { - return x; -} diff --git a/node_modules/topojson-client/src/index.js b/node_modules/topojson-client/src/index.js deleted file mode 100644 index 08ee657..0000000 --- a/node_modules/topojson-client/src/index.js +++ /dev/null @@ -1,8 +0,0 @@ -export {default as bbox} from "./bbox.js"; -export {default as feature} from "./feature.js"; -export {default as mesh, meshArcs} from "./mesh.js"; -export {default as merge, mergeArcs} from "./merge.js"; -export {default as neighbors} from "./neighbors.js"; -export {default as quantize} from "./quantize.js"; -export {default as transform} from "./transform.js"; -export {default as untransform} from "./untransform.js"; diff --git a/node_modules/topojson-client/src/merge.js b/node_modules/topojson-client/src/merge.js deleted file mode 100644 index 4dcd342..0000000 --- a/node_modules/topojson-client/src/merge.js +++ /dev/null @@ -1,103 +0,0 @@ -import {object} from "./feature.js"; -import stitch from "./stitch.js"; - -function planarRingArea(ring) { - var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; - while (++i < n) a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; - return Math.abs(area); // Note: doubled area! -} - -export default function(topology) { - return object(topology, mergeArcs.apply(this, arguments)); -} - -export function mergeArcs(topology, objects) { - var polygonsByArc = {}, - polygons = [], - groups = []; - - objects.forEach(geometry); - - function geometry(o) { - switch (o.type) { - case "GeometryCollection": o.geometries.forEach(geometry); break; - case "Polygon": extract(o.arcs); break; - case "MultiPolygon": o.arcs.forEach(extract); break; - } - } - - function extract(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); - }); - }); - polygons.push(polygon); - } - - function area(ring) { - return planarRingArea(object(topology, {type: "Polygon", arcs: [ring]}).coordinates[0]); - } - - polygons.forEach(function(polygon) { - if (!polygon._) { - var group = [], - neighbors = [polygon]; - polygon._ = 1; - groups.push(group); - while (polygon = neighbors.pop()) { - group.push(polygon); - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { - if (!polygon._) { - polygon._ = 1; - neighbors.push(polygon); - } - }); - }); - }); - } - } - }); - - polygons.forEach(function(polygon) { - delete polygon._; - }); - - return { - type: "MultiPolygon", - arcs: groups.map(function(polygons) { - var arcs = [], n; - - // Extract the exterior (unique) arcs. - polygons.forEach(function(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) { - arcs.push(arc); - } - }); - }); - }); - - // Stitch the arcs into one or more rings. - arcs = stitch(topology, arcs); - - // If more than one ring is returned, - // at most one of these rings can be the exterior; - // choose the one with the greatest absolute area. - if ((n = arcs.length) > 1) { - for (var i = 1, k = area(arcs[0]), ki, t; i < n; ++i) { - if ((ki = area(arcs[i])) > k) { - t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki; - } - } - } - - return arcs; - }).filter(function(arcs) { - return arcs.length > 0; - }) - }; -} diff --git a/node_modules/topojson-client/src/mesh.js b/node_modules/topojson-client/src/mesh.js deleted file mode 100644 index e0b7097..0000000 --- a/node_modules/topojson-client/src/mesh.js +++ /dev/null @@ -1,53 +0,0 @@ -import {object} from "./feature.js"; -import stitch from "./stitch.js"; - -export default function(topology) { - return object(topology, meshArcs.apply(this, arguments)); -} - -export function meshArcs(topology, object, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object, filter); - else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; - return {type: "MultiLineString", arcs: stitch(topology, arcs)}; -} - -function extractArcs(topology, object, filter) { - var arcs = [], - geomsByArc = [], - geom; - - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom}); - } - - function extract1(arcs) { - arcs.forEach(extract0); - } - - function extract2(arcs) { - arcs.forEach(extract1); - } - - function extract3(arcs) { - arcs.forEach(extract2); - } - - function geometry(o) { - switch (geom = o, o.type) { - case "GeometryCollection": o.geometries.forEach(geometry); break; - case "LineString": extract1(o.arcs); break; - case "MultiLineString": case "Polygon": extract2(o.arcs); break; - case "MultiPolygon": extract3(o.arcs); break; - } - } - - geometry(object); - - geomsByArc.forEach(filter == null - ? function(geoms) { arcs.push(geoms[0].i); } - : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - - return arcs; -} diff --git a/node_modules/topojson-client/src/neighbors.js b/node_modules/topojson-client/src/neighbors.js deleted file mode 100644 index 70db593..0000000 --- a/node_modules/topojson-client/src/neighbors.js +++ /dev/null @@ -1,45 +0,0 @@ -import bisect from "./bisect.js"; - -export default function(objects) { - var indexesByArc = {}, // arc index -> array of object indexes - neighbors = objects.map(function() { return []; }); - - function line(arcs, i) { - arcs.forEach(function(a) { - if (a < 0) a = ~a; - var o = indexesByArc[a]; - if (o) o.push(i); - else indexesByArc[a] = [i]; - }); - } - - function polygon(arcs, i) { - arcs.forEach(function(arc) { line(arc, i); }); - } - - function geometry(o, i) { - if (o.type === "GeometryCollection") o.geometries.forEach(function(o) { geometry(o, i); }); - else if (o.type in geometryType) geometryType[o.type](o.arcs, i); - } - - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); } - }; - - objects.forEach(geometry); - - for (var i in indexesByArc) { - for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) { - for (var k = j + 1; k < m; ++k) { - var ij = indexes[j], ik = indexes[k], n; - if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik); - if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij); - } - } - } - - return neighbors; -} diff --git a/node_modules/topojson-client/src/quantize.js b/node_modules/topojson-client/src/quantize.js deleted file mode 100644 index 64d060f..0000000 --- a/node_modules/topojson-client/src/quantize.js +++ /dev/null @@ -1,54 +0,0 @@ -import bbox from "./bbox.js"; -import untransform from "./untransform.js"; - -export default function(topology, transform) { - if (topology.transform) throw new Error("already quantized"); - - if (!transform || !transform.scale) { - if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be ≥2"); - box = topology.bbox || bbox(topology); - var x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3], n; - transform = {scale: [x1 - x0 ? (x1 - x0) / (n - 1) : 1, y1 - y0 ? (y1 - y0) / (n - 1) : 1], translate: [x0, y0]}; - } else { - box = topology.bbox; - } - - var t = untransform(transform), box, key, inputs = topology.objects, outputs = {}; - - function quantizePoint(point) { - return t(point); - } - - function quantizeGeometry(input) { - var output; - switch (input.type) { - case "GeometryCollection": output = {type: "GeometryCollection", geometries: input.geometries.map(quantizeGeometry)}; break; - case "Point": output = {type: "Point", coordinates: quantizePoint(input.coordinates)}; break; - case "MultiPoint": output = {type: "MultiPoint", coordinates: input.coordinates.map(quantizePoint)}; break; - default: return input; - } - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - if (input.properties != null) output.properties = input.properties; - return output; - } - - function quantizeArc(input) { - var i = 0, j = 1, n = input.length, p, output = new Array(n); // pessimistic - output[0] = t(input[0], 0); - while (++i < n) if ((p = t(input[i], i))[0] || p[1]) output[j++] = p; // non-coincident points - if (j === 1) output[j++] = [0, 0]; // an arc must have at least two points - output.length = j; - return output; - } - - for (key in inputs) outputs[key] = quantizeGeometry(inputs[key]); - - return { - type: "Topology", - bbox: box, - transform: transform, - objects: outputs, - arcs: topology.arcs.map(quantizeArc) - }; -} diff --git a/node_modules/topojson-client/src/reverse.js b/node_modules/topojson-client/src/reverse.js deleted file mode 100644 index 4bc7c31..0000000 --- a/node_modules/topojson-client/src/reverse.js +++ /dev/null @@ -1,4 +0,0 @@ -export default function(array, n) { - var t, j = array.length, i = j - n; - while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; -} diff --git a/node_modules/topojson-client/src/stitch.js b/node_modules/topojson-client/src/stitch.js deleted file mode 100644 index 0163e04..0000000 --- a/node_modules/topojson-client/src/stitch.js +++ /dev/null @@ -1,73 +0,0 @@ -export default function(topology, arcs) { - var stitchedArcs = {}, - fragmentByStart = {}, - fragmentByEnd = {}, - fragments = [], - emptyIndex = -1; - - // Stitch empty arcs first, since they may be subsumed by other arcs. - arcs.forEach(function(i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], t; - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) { - t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - } - }); - - arcs.forEach(function(i) { - var e = ends(i), - start = e[0], - end = e[1], - f, g; - - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else { - f = [i]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1; - if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; }); - else p1 = arc[arc.length - 1]; - return i < 0 ? [p1, p0] : [p0, p1]; - } - - function flush(fragmentByEnd, fragmentByStart) { - for (var k in fragmentByEnd) { - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; }); - fragments.push(f); - } - } - - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); }); - - return fragments; -} diff --git a/node_modules/topojson-client/src/transform.js b/node_modules/topojson-client/src/transform.js deleted file mode 100644 index 91efb48..0000000 --- a/node_modules/topojson-client/src/transform.js +++ /dev/null @@ -1,19 +0,0 @@ -import identity from "./identity.js"; - -export default function(transform) { - if (transform == null) return identity; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n); - output[0] = (x0 += input[0]) * kx + dx; - output[1] = (y0 += input[1]) * ky + dy; - while (j < n) output[j] = input[j], ++j; - return output; - }; -} diff --git a/node_modules/topojson-client/src/untransform.js b/node_modules/topojson-client/src/untransform.js deleted file mode 100644 index 6a4636d..0000000 --- a/node_modules/topojson-client/src/untransform.js +++ /dev/null @@ -1,23 +0,0 @@ -import identity from "./identity.js"; - -export default function(transform) { - if (transform == null) return identity; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, - n = input.length, - output = new Array(n), - x1 = Math.round((input[0] - dx) / kx), - y1 = Math.round((input[1] - dy) / ky); - output[0] = x1 - x0, x0 = x1; - output[1] = y1 - y0, y0 = y1; - while (j < n) output[j] = input[j], ++j; - return output; - }; -} diff --git a/node_modules/tslib/CopyrightNotice.txt b/node_modules/tslib/CopyrightNotice.txt deleted file mode 100644 index 2e4a05c..0000000 --- a/node_modules/tslib/CopyrightNotice.txt +++ /dev/null @@ -1,15 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ - diff --git a/node_modules/tslib/LICENSE.txt b/node_modules/tslib/LICENSE.txt deleted file mode 100644 index fa7d1bd..0000000 --- a/node_modules/tslib/LICENSE.txt +++ /dev/null @@ -1,12 +0,0 @@ -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/node_modules/tslib/README.md b/node_modules/tslib/README.md deleted file mode 100644 index 9c0a9c7..0000000 --- a/node_modules/tslib/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# tslib - -This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions. - -This library is primarily used by the `--importHelpers` flag in TypeScript. -When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: - -```ts -var __assign = (this && this.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; -}; -exports.x = {}; -exports.y = __assign({}, exports.x); - -``` - -will instead be emitted as something like the following: - -```ts -var tslib_1 = require("tslib"); -exports.x = {}; -exports.y = tslib_1.__assign({}, exports.x); -``` - -Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. -For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. - -# Installing - -For the latest stable version, run: - -## npm - -```sh -# TypeScript 2.3.3 or later -npm install --save tslib - -# TypeScript 2.3.2 or earlier -npm install --save tslib@1.6.1 -``` - -## yarn - -```sh -# TypeScript 2.3.3 or later -yarn add tslib - -# TypeScript 2.3.2 or earlier -yarn add tslib@1.6.1 -``` - -## bower - -```sh -# TypeScript 2.3.3 or later -bower install tslib - -# TypeScript 2.3.2 or earlier -bower install tslib@1.6.1 -``` - -## JSPM - -```sh -# TypeScript 2.3.3 or later -jspm install tslib - -# TypeScript 2.3.2 or earlier -jspm install tslib@1.6.1 -``` - -# Usage - -Set the `importHelpers` compiler option on the command line: - -``` -tsc --importHelpers file.ts -``` - -or in your tsconfig.json: - -```json -{ - "compilerOptions": { - "importHelpers": true - } -} -``` - -#### For bower and JSPM users - -You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: - -```json -{ - "compilerOptions": { - "module": "amd", - "importHelpers": true, - "baseUrl": "./", - "paths": { - "tslib" : ["bower_components/tslib/tslib.d.ts"] - } - } -} -``` - -For JSPM users: - -```json -{ - "compilerOptions": { - "module": "system", - "importHelpers": true, - "baseUrl": "./", - "paths": { - "tslib" : ["jspm_packages/npm/tslib@2.0.0/tslib.d.ts"] - } - } -} -``` - - -# Contribute - -There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. - -* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. -* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). -* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). -* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. -* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). - -# Documentation - -* [Quick tutorial](http://www.typescriptlang.org/Tutorial) -* [Programming handbook](http://www.typescriptlang.org/Handbook) -* [Homepage](http://www.typescriptlang.org/) diff --git a/node_modules/tslib/package.json b/node_modules/tslib/package.json deleted file mode 100644 index e2dc084..0000000 --- a/node_modules/tslib/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_from": "tslib@~2.0.0", - "_id": "tslib@2.0.0", - "_inBundle": false, - "_integrity": "sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==", - "_location": "/tslib", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "tslib@~2.0.0", - "name": "tslib", - "escapedName": "tslib", - "rawSpec": "~2.0.0", - "saveSpec": null, - "fetchSpec": "~2.0.0" - }, - "_requiredBy": [ - "/vega-lite" - ], - "_resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.0.tgz", - "_shasum": "18d13fc2dce04051e20f074cc8387fd8089ce4f3", - "_spec": "tslib@~2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-lite", - "author": { - "name": "Microsoft Corp." - }, - "bugs": { - "url": "https://github.com/Microsoft/TypeScript/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Runtime library for TypeScript helper functions", - "homepage": "https://www.typescriptlang.org/", - "jsnext:main": "tslib.es6.js", - "keywords": [ - "TypeScript", - "Microsoft", - "compiler", - "language", - "javascript", - "tslib", - "runtime" - ], - "license": "0BSD", - "main": "tslib.js", - "module": "tslib.es6.js", - "name": "tslib", - "repository": { - "type": "git", - "url": "git+https://github.com/Microsoft/tslib.git" - }, - "sideEffects": false, - "typings": "tslib.d.ts", - "version": "2.0.0" -} diff --git a/node_modules/tslib/tslib.d.ts b/node_modules/tslib/tslib.d.ts deleted file mode 100644 index 2efae1a..0000000 --- a/node_modules/tslib/tslib.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -export declare function __extends(d: Function, b: Function): void; -export declare function __assign(t: any, ...sources: any[]): any; -export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; -export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; -export declare function __param(paramIndex: number, decorator: Function): Function; -export declare function __metadata(metadataKey: any, metadataValue: any): Function; -export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; -export declare function __generator(thisArg: any, body: Function): any; -export declare function __exportStar(m: any, exports: any): void; -export declare function __values(o: any): any; -export declare function __read(o: any, n?: number): any[]; -export declare function __spread(...args: any[][]): any[]; -export declare function __spreadArrays(...args: any[][]): any[]; -export declare function __await(v: any): any; -export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; -export declare function __asyncDelegator(o: any): any; -export declare function __asyncValues(o: any): any; -export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; -export declare function __importStar(mod: T): T; -export declare function __importDefault(mod: T): T | { default: T }; -export declare function __classPrivateFieldGet(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V; -export declare function __classPrivateFieldSet(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V; -export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; diff --git a/node_modules/tslib/tslib.es6.html b/node_modules/tslib/tslib.es6.html deleted file mode 100644 index b122e41..0000000 --- a/node_modules/tslib/tslib.es6.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/node_modules/tslib/tslib.es6.js b/node_modules/tslib/tslib.es6.js deleted file mode 100644 index a2b56aa..0000000 --- a/node_modules/tslib/tslib.es6.js +++ /dev/null @@ -1,227 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export var __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); - -export function __exportStar(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} - -export function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -export function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -export function __classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -} - -export function __classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -} diff --git a/node_modules/tslib/tslib.html b/node_modules/tslib/tslib.html deleted file mode 100644 index 44c9ba5..0000000 --- a/node_modules/tslib/tslib.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/node_modules/tslib/tslib.js b/node_modules/tslib/tslib.js deleted file mode 100644 index 56f4608..0000000 --- a/node_modules/tslib/tslib.js +++ /dev/null @@ -1,292 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - - __extends = function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -}); diff --git a/node_modules/util-deprecate/History.md b/node_modules/util-deprecate/History.md deleted file mode 100644 index acc8675..0000000 --- a/node_modules/util-deprecate/History.md +++ /dev/null @@ -1,16 +0,0 @@ - -1.0.2 / 2015-10-07 -================== - - * use try/catch when checking `localStorage` (#3, @kumavis) - -1.0.1 / 2014-11-25 -================== - - * browser: use `console.warn()` for deprecation calls - * browser: more jsdocs - -1.0.0 / 2014-04-30 -================== - - * initial commit diff --git a/node_modules/util-deprecate/LICENSE b/node_modules/util-deprecate/LICENSE deleted file mode 100644 index 6a60e8c..0000000 --- a/node_modules/util-deprecate/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Nathan Rajlich - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/util-deprecate/README.md b/node_modules/util-deprecate/README.md deleted file mode 100644 index 75622fa..0000000 --- a/node_modules/util-deprecate/README.md +++ /dev/null @@ -1,53 +0,0 @@ -util-deprecate -============== -### The Node.js `util.deprecate()` function with browser support - -In Node.js, this module simply re-exports the `util.deprecate()` function. - -In the web browser (i.e. via browserify), a browser-specific implementation -of the `util.deprecate()` function is used. - - -## API - -A `deprecate()` function is the only thing exposed by this module. - -``` javascript -// setup: -exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); - - -// users see: -foo(); -// foo() is deprecated, use bar() instead -foo(); -foo(); -``` - - -## License - -(The MIT License) - -Copyright (c) 2014 Nathan Rajlich - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/util-deprecate/browser.js b/node_modules/util-deprecate/browser.js deleted file mode 100644 index 549ae2f..0000000 --- a/node_modules/util-deprecate/browser.js +++ /dev/null @@ -1,67 +0,0 @@ - -/** - * Module exports. - */ - -module.exports = deprecate; - -/** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. - * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. - * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public - */ - -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -} - -/** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */ - -function config (name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!global.localStorage) return false; - } catch (_) { - return false; - } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; -} diff --git a/node_modules/util-deprecate/node.js b/node_modules/util-deprecate/node.js deleted file mode 100644 index 5e6fcff..0000000 --- a/node_modules/util-deprecate/node.js +++ /dev/null @@ -1,6 +0,0 @@ - -/** - * For Node.js, simply re-export the core `util.deprecate` function. - */ - -module.exports = require('util').deprecate; diff --git a/node_modules/util-deprecate/package.json b/node_modules/util-deprecate/package.json deleted file mode 100644 index d323b64..0000000 --- a/node_modules/util-deprecate/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_from": "util-deprecate@~1.0.1", - "_id": "util-deprecate@1.0.2", - "_inBundle": false, - "_integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "_location": "/util-deprecate", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "util-deprecate@~1.0.1", - "name": "util-deprecate", - "escapedName": "util-deprecate", - "rawSpec": "~1.0.1", - "saveSpec": null, - "fetchSpec": "~1.0.1" - }, - "_requiredBy": [ - "/readable-stream" - ], - "_resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "_shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf", - "_spec": "util-deprecate@~1.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/readable-stream", - "author": { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io/" - }, - "browser": "browser.js", - "bugs": { - "url": "https://github.com/TooTallNate/util-deprecate/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "The Node.js `util.deprecate()` function with browser support", - "homepage": "https://github.com/TooTallNate/util-deprecate", - "keywords": [ - "util", - "deprecate", - "browserify", - "browser", - "node" - ], - "license": "MIT", - "main": "node.js", - "name": "util-deprecate", - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/util-deprecate.git" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "1.0.2" -} diff --git a/node_modules/vega-canvas/LICENSE b/node_modules/vega-canvas/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-canvas/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-canvas/README.md b/node_modules/vega-canvas/README.md deleted file mode 100644 index d2eee0a..0000000 --- a/node_modules/vega-canvas/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# vega-canvas - -[Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) and [Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) object instantiation utilities. Creates an [HTML5 Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API), using either the web browser DOM or a [node-canvas](https://github.com/Automattic/node-canvas) library. - -This package attempts three forms of canvas creation, in this order: - -- If in a browser environment, use DOM methods to create a new canvas. -- If the [node-canvas](https://github.com/Automattic/node-canvas) library is present, use that. -- Otherwise, return `null`. - -To ensure error-free build processes for client-side code, this module does not include any direct or optional dependencies on the [node-canvas](https://github.com/Automattic/node-canvas) library. Projects that use this pacakge and require canvas support for server-side (node.js) operations *must include a canvas dependency in their own `package.json` file*. - -## API Reference - -# -vega.canvas([width, height, type]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-canvas/index.js "Source") - -Creates a new [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) instance, with an optional *width* and *height* (in pixels). If *width* and *height* are omitted, creates a _0 x 0_ canvas. The optional *type* parameter is a [node-canvas type parameter](https://github.com/Automattic/node-canvas#createcanvas) to enable PDF or SVG output modes; this parameter is applied only if node-canvas is used. This method first attempts to create a canvas using the DOM `document.createElement` method. If that fails, the method then attempts to instantiate a canvas using the [node-canvas](https://github.com/Automattic/node-canvas) library. If that also fails, returns `null`. - -# -vega.domCanvas([width, height]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-canvas/src/domCanvas.js "Source") - -Creates a new [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) instance, with an optional *width* and *height* (in pixels). If *width* and *height* are omitted, creates a _0 x 0_ canvas. This method first attempts to create a canvas using the DOM `document.createElement` method. If that fails, returns `null`. - -# -vega.nodeCanvas([width, height, type]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-canvas/src/nodeCanvas.js "Source") - -Creates a new [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) instance, with an optional *width* and *height* (in pixels). If *width* and *height* are omitted, creates a _0 x 0_ canvas. The optional *type* parameter is a [node-canvas type parameter](https://github.com/Automattic/node-canvas#createcanvas) to enable PDF or SVG output modes. This method attempts to instantiate a canvas using using the [node-canvas](https://github.com/Automattic/node-canvas) library. If that fails, returns `null`. This method is not exported in browser-only builds. - -# -vega.image() -[<>](https://github.com/vega/vega/blob/master/packages/vega-canvas/index.js "Source") - -Returns a reference to the [Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) constructor. In a web browser environment, simply returns the built-in `Image` object. Otherwise, attempts to return the `Image` instance exported by a node canvas library. If all attempts to find a canvas library fail, returns `null`. diff --git a/node_modules/vega-canvas/build/vega-canvas.js b/node_modules/vega-canvas/build/vega-canvas.js deleted file mode 100644 index 4da6e97..0000000 --- a/node_modules/vega-canvas/build/vega-canvas.js +++ /dev/null @@ -1,29 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.vega = {})); -}(this, (function (exports) { 'use strict'; - - function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - var c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } - } - return null; - } - - function domImage() { - return typeof Image !== 'undefined' ? Image : null; - } - - exports.canvas = domCanvas; - exports.domCanvas = domCanvas; - exports.image = domImage; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-canvas/build/vega-canvas.node.js b/node_modules/vega-canvas/build/vega-canvas.node.js deleted file mode 100644 index a633994..0000000 --- a/node_modules/vega-canvas/build/vega-canvas.node.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - var c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } - } - return null; -} - -function domImage() { - return typeof Image !== 'undefined' ? Image : null; -} - -var NodeCanvas; - -try { - NodeCanvas = require('canvas'); - if (!(NodeCanvas && NodeCanvas.createCanvas)) { - NodeCanvas = null; - } -} catch (error) { - // do nothing -} - -function nodeCanvas(w, h, type) { - if (NodeCanvas) { - try { - return new NodeCanvas.Canvas(w, h, type); - } catch (e) { - // do nothing, return null on error - } - } - return null; -} - -function nodeImage() { - return (NodeCanvas && NodeCanvas.Image) || null; -} - -function canvas(w, h, type) { - return domCanvas(w, h) || nodeCanvas(w, h, type) || null; -} - -function image() { - return domImage() || nodeImage() || null; -} - -exports.canvas = canvas; -exports.domCanvas = domCanvas; -exports.image = image; -exports.nodeCanvas = nodeCanvas; diff --git a/node_modules/vega-canvas/index.browser.js b/node_modules/vega-canvas/index.browser.js deleted file mode 100644 index 910bba8..0000000 --- a/node_modules/vega-canvas/index.browser.js +++ /dev/null @@ -1,5 +0,0 @@ -export { - domCanvas as domCanvas, - domCanvas as canvas, - domImage as image -} from './src/domCanvas'; diff --git a/node_modules/vega-canvas/index.js b/node_modules/vega-canvas/index.js deleted file mode 100644 index 2bfda33..0000000 --- a/node_modules/vega-canvas/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import {domCanvas, domImage} from './src/domCanvas'; -import {nodeCanvas, nodeImage} from './src/nodeCanvas'; - -export {domCanvas} from './src/domCanvas'; -export {nodeCanvas} from './src/nodeCanvas'; - -export function canvas(w, h, type) { - return domCanvas(w, h) || nodeCanvas(w, h, type) || null; -} - -export function image() { - return domImage() || nodeImage() || null; -} diff --git a/node_modules/vega-canvas/package.json b/node_modules/vega-canvas/package.json deleted file mode 100644 index 4874072..0000000 --- a/node_modules/vega-canvas/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "_from": "vega-canvas@^1.2.2", - "_id": "vega-canvas@1.2.2", - "_inBundle": false, - "_integrity": "sha512-39h8/fZp4kDwSeDGIEoyEiIgtP3mgY3D08InD1Ldm0FntePpSe1tXzC1zcvoLe/+f7Qprl6Jfwux/ksOXvpj2w==", - "_location": "/vega-canvas", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-canvas@^1.2.2", - "name": "vega-canvas", - "escapedName": "vega-canvas", - "rawSpec": "^1.2.2", - "saveSpec": null, - "fetchSpec": "^1.2.2" - }, - "_requiredBy": [ - "/vega-geo", - "/vega-scenegraph", - "/vega-wordcloud" - ], - "_resolved": "https://registry.npmjs.org/vega-canvas/-/vega-canvas-1.2.2.tgz", - "_shasum": "f31aae9ac1e1ed01bb7817a1e53099279e2d3d43", - "_spec": "vega-canvas@^1.2.2", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-scenegraph", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "browser": { - "./build/vega-canvas.node.js": "./build/vega-canvas.js", - "./index.js": "./index.browser.js" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Canvas and Image utilities.", - "gitHead": "35e31c5c6b54db9dc3a577b5adad8d15ec274d32", - "homepage": "https://github.com/vega/vega#readme", - "jsdelivr": "build/vega-canvas.js", - "keywords": [ - "vega", - "canvas", - "image" - ], - "license": "BSD-3-Clause", - "main": "build/vega-canvas.node.js", - "module": "index", - "name": "vega-canvas", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -f cjs -n vega -o build/vega-canvas.node.js -- index.js && rollup -f umd -n vega -o build/vega-canvas.js -- index.browser.js", - "test": "tape 'test/**/*-test.js'" - }, - "unpkg": "build/vega-canvas.js", - "version": "1.2.2" -} diff --git a/node_modules/vega-canvas/src/domCanvas.js b/node_modules/vega-canvas/src/domCanvas.js deleted file mode 100644 index 924f9e2..0000000 --- a/node_modules/vega-canvas/src/domCanvas.js +++ /dev/null @@ -1,15 +0,0 @@ -export function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - var c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } - } - return null; -} - -export function domImage() { - return typeof Image !== 'undefined' ? Image : null; -} diff --git a/node_modules/vega-canvas/src/nodeCanvas.js b/node_modules/vega-canvas/src/nodeCanvas.js deleted file mode 100644 index 6536cb5..0000000 --- a/node_modules/vega-canvas/src/nodeCanvas.js +++ /dev/null @@ -1,25 +0,0 @@ -var NodeCanvas; - -try { - NodeCanvas = require('canvas'); - if (!(NodeCanvas && NodeCanvas.createCanvas)) { - NodeCanvas = null; - } -} catch (error) { - // do nothing -} - -export function nodeCanvas(w, h, type) { - if (NodeCanvas) { - try { - return new NodeCanvas.Canvas(w, h, type); - } catch (e) { - // do nothing, return null on error - } - } - return null; -} - -export function nodeImage() { - return (NodeCanvas && NodeCanvas.Image) || null; -} diff --git a/node_modules/vega-cli/LICENSE b/node_modules/vega-cli/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-cli/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-cli/README.md b/node_modules/vega-cli/README.md deleted file mode 100644 index 7ca2586..0000000 --- a/node_modules/vega-cli/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# vega-cli - -Command line tools for running server-side Vega. - -This package provides `vg2pdf`, `vg2png`, and `vg2svg` command line utilities for parsing a Vega specification and generating an output PDF, PNG, or SVG image file. See the Vega website for [command line utility documentation](https://vega.github.io/vega/usage/#cli). diff --git a/node_modules/vega-cli/bin/vg2pdf b/node_modules/vega-cli/bin/vg2pdf deleted file mode 100755 index 138a44c..0000000 --- a/node_modules/vega-cli/bin/vg2pdf +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env node -// Render a Vega specification to PDF, using node canvas -const {createWriteStream} = require('fs'), - render = require('../src/render'); - -render('pdf', function(canvas, arg) { - const file = arg._[1] || null, - config = arg.test ? {creationDate: new Date(2012, 0, 1)} : undefined, - out = file ? createWriteStream(file) : process.stdout, - stream = canvas.createPDFStream(config); - stream.on('data', chunk => { out.write(chunk); }); -}, {type: 'pdf', context: {textDrawingMode: 'glyph'}}); \ No newline at end of file diff --git a/node_modules/vega-cli/bin/vg2png b/node_modules/vega-cli/bin/vg2png deleted file mode 100755 index fadf189..0000000 --- a/node_modules/vega-cli/bin/vg2png +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env node -// Render a Vega specification to PNG, using node canvas -const {createWriteStream} = require('fs'), - render = require('../src/render'); - -render('png', function(canvas, arg) { - const file = arg._[1] || null, - out = file ? createWriteStream(file) : process.stdout, - stream = canvas.createPNGStream(); - stream.on('data', chunk => { out.write(chunk); }); -}); \ No newline at end of file diff --git a/node_modules/vega-cli/bin/vg2svg b/node_modules/vega-cli/bin/vg2svg deleted file mode 100755 index 0c826f0..0000000 --- a/node_modules/vega-cli/bin/vg2svg +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env node -// Render a Vega specification to SVG -const {writeFile} = require('fs'), - render = require('../src/render'); - -const svgHeader = - '\n' + - '\n'; - -render('svg', function(body, arg) { - const svg = (arg.h ? svgHeader : '') + body, - file = arg._[1] || null; - - if (file) { - // write to file - writeFile(file, svg, err => { if (err) throw err; }); - } else { - // write to stdout - process.stdout.write(svg); - } -}); \ No newline at end of file diff --git a/node_modules/vega-cli/index.js b/node_modules/vega-cli/index.js deleted file mode 100644 index 61bc140..0000000 --- a/node_modules/vega-cli/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('vega'); diff --git a/node_modules/vega-cli/package.json b/node_modules/vega-cli/package.json deleted file mode 100644 index 9990336..0000000 --- a/node_modules/vega-cli/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_from": "vega-cli", - "_id": "vega-cli@5.13.0", - "_inBundle": false, - "_integrity": "sha512-5gfN6JmZ4HqNr8gYdu2g+Nkh9MAcsUHJ6Bp1y67vxn9bs8LEWNk1t8vCGlt3BH2CjlyI7jLaF4NRw8bb2IhH8g==", - "_location": "/vega-cli", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "vega-cli", - "name": "vega-cli", - "escapedName": "vega-cli", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/vega-cli/-/vega-cli-5.13.0.tgz", - "_shasum": "9d7a34be8f5ccce149d773f83953d2ba1b54848e", - "_spec": "vega-cli", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bin": { - "vg2pdf": "bin/vg2pdf", - "vg2png": "bin/vg2png", - "vg2svg": "bin/vg2svg" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "canvas": "^2.6.1", - "vega": "5.13.0", - "yargs": "15" - }, - "deprecated": false, - "description": "Command line utilities for server-side Vega.", - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "command line", - "server" - ], - "license": "BSD-3-Clause", - "main": "index.js", - "name": "vega-cli", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "postpublish": "git push && git push --tags", - "test": "tape 'test/**/*-test.js'" - }, - "version": "5.13.0" -} diff --git a/node_modules/vega-cli/src/args.js b/node_modules/vega-cli/src/args.js deleted file mode 100644 index 70b3a6b..0000000 --- a/node_modules/vega-cli/src/args.js +++ /dev/null @@ -1,56 +0,0 @@ -module.exports = function(type) { - const helpText = `Render a Vega specification to ${type.toUpperCase()}. -Usage: vg2${type} [vega_json_spec_file] [output_${type}_file] - If no arguments are provided, reads from stdin. - If output_${type}_file is not provided, writes to stdout. - For errors and log messages, writes to stderr. - -To load data, you may need to set a base directory: - For web retrieval, use '-b http://host/data/'. - For files, use '-b file:///dir/data/' (absolute) or '-b data/' (relative).`; - - const args = require('yargs') - .usage(helpText) - .demand(0); - - args.string('b') - .alias('b', 'base') - .describe('b', 'Base directory for data loading. Defaults to the directory of the input spec.'); - - args.string('l') - .alias('l', 'loglevel') - .describe('l', 'Level of log messages written to stderr. One of "error", "warn" (default), "info", or "debug".'); - - args.string('c') - .alias('c', 'config') - .describe('c', 'Vega config object. Either a JSON file or a .js file that exports the config object.'); - - args.string('f') - .alias('f', 'format') - .describe('f', 'Number format locale descriptor. Either a JSON file or a .js file that exports the locale object.'); - - args.string('t') - .alias('t', 'timeFormat') - .describe('t', 'Date/time format locale descriptor. Either a JSON file or a .js file that exports the locale object.'); - - if (type === 'svg') { - args.boolean('h') - .alias('h', 'header') - .describe('h', 'Include XML header and SVG doctype.'); - } - - args.number('s') - .alias('s', 'scale') - .default('s', 1) - .describe('s', 'Output resolution scale factor.'); - - args.number('seed') - .describe('seed', 'Seed for random number generation.'); - - if (type === 'pdf') { - args.boolean('test') - .describe('test', 'Disable default PDF metadata for test suites.'); - } - - return args.help().version().argv; -}; \ No newline at end of file diff --git a/node_modules/vega-cli/src/read.js b/node_modules/vega-cli/src/read.js deleted file mode 100644 index b96c74f..0000000 --- a/node_modules/vega-cli/src/read.js +++ /dev/null @@ -1,13 +0,0 @@ -const fs = require('fs'); - -module.exports = (file) => { - return new Promise((resolve, reject) => { - const input = file ? fs.createReadStream(file) : process.stdin; - let text = ''; - - input.setEncoding('utf8'); - input.on('error', err => { reject(err); }); - input.on('data', chunk => { text += chunk; }); - input.on('end', () => { resolve(text); }); - }); -}; diff --git a/node_modules/vega-cli/src/render.js b/node_modules/vega-cli/src/render.js deleted file mode 100644 index ed3db87..0000000 --- a/node_modules/vega-cli/src/render.js +++ /dev/null @@ -1,64 +0,0 @@ -const vega = require('vega'), - path = require('path'), - args = require('./args'), - read = require('./read'); - -function load(file) { - return require(path.resolve(file)); -} - -const Levels = { - error: vega.Error, - warn: vega.Warn, - info: vega.Info, - debug: vega.Debug -}; - -module.exports = function(type, callback, opt) { - // parse command line arguments - const arg = args(type); - - // set baseURL, if specified. default to input spec directory - const base = arg.base || (arg._[0] ? path.dirname(arg._[0]) : null); - - // set log level, defaults to logging warning messages - const loglevel = Levels[String(arg.loglevel).toLowerCase()] || vega.Warn; - - // load config file, if specified - const config = arg.config ? load(arg.config) : null; - - // set output image scale factor - const scale = arg.scale || undefined; - - // use a seeded random number generator, if specified - if (typeof arg.seed !== 'undefined') { - if (Number.isNaN(arg.seed)) throw 'Illegal seed value: must be a valid number.'; - vega.setRandom(vega.randomLCG(arg.seed)); - } - - // locale options, load custom number/time formats if specified - const locale = { - number: arg.format ? load(arg.format) : null, - time: arg.timeFormat ? load(arg.timeFormat) : null - }; - - // instantiate view and invoke headless render method - function render(spec) { - const view = new vega.View(vega.parse(spec, config), { - locale: locale, // set locale options - loader: vega.loader({baseURL: base}), // load files from base path - logger: vega.logger(loglevel, 'error'), // route all logging to stderr - renderer: 'none' // no primary renderer needed - }).finalize(); // clear any timers, etc - - return (type === 'svg' - ? view.toSVG(scale) - : view.toCanvas(scale, opt) - ).then(_ => callback(_, arg)); - } - - // read input from file or stdin - read(arg._[0] || null) - .then(text => render(JSON.parse(text))) - .catch(err => console.error(err)); // eslint-disable-line no-console -}; diff --git a/node_modules/vega-crossfilter/LICENSE b/node_modules/vega-crossfilter/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-crossfilter/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-crossfilter/README.md b/node_modules/vega-crossfilter/README.md deleted file mode 100644 index 9a92094..0000000 --- a/node_modules/vega-crossfilter/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# vega-crossfilter - -Indexed cross-filtering for Vega dataflows. - -This package provides the following Vega data transforms: - -- [**CrossFilter**](https://vega.github.io/vega/docs/transforms/crossfilter/) [<>](https://github.com/vega/vega/blob/master/packages/vega-crossfilter/src/CrossFilter.js "Source") -- [**ResolveFilter**](https://vega.github.io/vega/docs/transforms/resolvefilter/) [<>](https://github.com/vega/vega/blob/master/packages/vega-crossfilter/src/ResolveFilter.js "Source") diff --git a/node_modules/vega-crossfilter/build/vega-crossfilter.js b/node_modules/vega-crossfilter/build/vega-crossfilter.js deleted file mode 100644 index 9d6cbb2..0000000 --- a/node_modules/vega-crossfilter/build/vega-crossfilter.js +++ /dev/null @@ -1,717 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('vega-dataflow'), require('vega-util')) : - typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'vega-dataflow', 'vega-util'], factory) : - (global = global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.d3, global.vega, global.vega)); -}(this, (function (exports, d3Array, vegaDataflow, vegaUtil) { 'use strict'; - - function array8(n) { return new Uint8Array(n); } - - function array16(n) { return new Uint16Array(n); } - - function array32(n) { return new Uint32Array(n); } - - /** - * Maintains CrossFilter state. - */ - function Bitmaps() { - - var width = 8, - data = [], - seen = array32(0), - curr = array(0, width), - prev = array(0, width); - - return { - - data: function() { return data; }, - - seen: function() { - return (seen = lengthen(seen, data.length)); - }, - - add: function(array) { - for (var i=0, j=data.length, n=array.length, t; i boolean (true => remove) - var n = data.length, - copy = Array(n - num), - reindex = data, // reuse old data array for index map - t, i, j; - - // seek forward to first removal - for (i=0; !map[i] && i k || m > width) { - width = Math.max(m, width); - curr = array(n, width, curr); - prev = array(n, width); - } - } - }; - } - - function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; - } - - function array(n, m, array) { - var copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; - } - - function Dimension(index, i, query) { - var bit = (1 << i); - - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - - onAdd: function(added, curr) { - var dim = this, - range = dim.bisect(dim.range, added.value), - idx = added.index, - lo = range[0], - hi = range[1], - n1 = idx.length, i; - - for (i=0; i 0) for (i=0; i remove - var n = size, - idx, i, j; - - // seek forward to first removal - for (i=0; !map[index[i]] && i y ? 1 : 0; - }); - return d3Array.permute(values, index); - } - - function merge(base, value0, index0, n0, value1, index1, n1, value, index) { - var i0 = 0, i1 = 0, i; - - for (i=0; i0 < n0 && i1 < n1; ++i) { - if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - } - - for (; i0 < n0; ++i0, ++i) { - value[i] = value0[i0]; - index[i] = index0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } - } - - /** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ - function CrossFilter(params) { - vegaDataflow.Transform.call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; - } - - CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'query', 'type': 'array', 'array': true, 'required': true, - 'content': {'type': 'number', 'array': true, 'length': 2} } - ] - }; - - var prototype = vegaUtil.inherits(CrossFilter, vegaDataflow.Transform); - - prototype.transform = function(_, pulse) { - if (!this._dims) { - return this.init(_, pulse); - } else { - var init = _.modified('fields') - || _.fields.some(function(f) { return pulse.modified(f.fields); }); - - return init - ? this.reinit(_, pulse) - : this.eval(_, pulse); - } - }; - - prototype.init = function(_, pulse) { - var fields = _.fields, - query = _.query, - indices = this._indices = {}, - dims = this._dims = [], - m = query.length, - i = 0, key, index; - - // instantiate indices and dimensions - for (; i lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - dim.range = query.slice(); - }; - - prototype.incrementOne = function(dim, query, add, rem) { - var bits = this.value, - curr = bits.curr(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, j, k; - - // Fast incremental update based on previous lo index. - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - dim.range = query.slice(); - }; - - /** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ - function ResolveFilter(params) { - vegaDataflow.Transform.call(this, null, params); - } - - ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [ - { 'name': 'ignore', 'type': 'number', 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' }, - { 'name': 'filter', 'type': 'object', 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' } - ] - }; - - var prototype$1 = vegaUtil.inherits(ResolveFilter, vegaDataflow.Transform); - - prototype$1.transform = function(_, pulse) { - var ignore = ~(_.ignore || 0), // bit mask where zeros -> dims to ignore - bitmap = _.filter, - mask = bitmap.mask; - - // exit early if no relevant filter changes - if ((mask & ignore) === 0) return pulse.StopPropagation; - - var output = pulse.fork(pulse.ALL), - data = bitmap.data(), - curr = bitmap.curr(), - prev = bitmap.prev(), - pass = function(k) { - return !(curr[k] & ignore) ? data[k] : null; - }; - - // propagate all mod tuples that pass the filter - output.filter(output.MOD, pass); - - // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - - if (!(mask & (mask-1))) { // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, function(k) { - return (curr[k] & ignore) === mask ? data[k] : null; - }); - - } else { // multiple filters changed - output.filter(output.ADD, function(k) { - var c = curr[k] & ignore, - f = !c && (c ^ (prev[k] & ignore)); - return f ? data[k] : null; - }); - output.filter(output.REM, function(k) { - var c = curr[k] & ignore, - f = c && !(c ^ (c ^ (prev[k] & ignore))); - return f ? data[k] : null; - }); - } - - // add filter to source data in case of reflow... - return output.filter(output.SOURCE, function(t) { return pass(t._index); }); - }; - - exports.crossfilter = CrossFilter; - exports.resolvefilter = ResolveFilter; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-crossfilter/build/vega-crossfilter.min.js b/node_modules/vega-crossfilter/build/vega-crossfilter.min.js deleted file mode 100644 index be98308..0000000 --- a/node_modules/vega-crossfilter/build/vega-crossfilter.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("d3-array"),require("vega-dataflow"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","d3-array","vega-dataflow","vega-util"],r):r(((e=e||self).vega=e.vega||{},e.vega.transforms={}),e.d3,e.vega,e.vega)}(this,(function(e,r,n,i){"use strict";function t(e){return new Uint8Array(e)}function a(e){return new Uint16Array(e)}function o(e){return new Uint32Array(e)}function f(e,r,n){var i=(r<257?t:r<65537?a:o)(e);return n&&i.set(n),i}function u(e,r,n){var i=1<t?1:0})),r.permute(e,n)}(h,m),d)u=n,s=e,n=Array(d+c),e=o(d+c),function(e,r,n,i,t,a,o,f,u){var s,l=0,d=0;for(s=0;l0)for(l=0;l=r?e:((n=n||new e.constructor(r)).set(e),n)}(t,i.length)},add:function(e){for(var r,n=0,t=i.length,a=e.length;na.length||n>r)&&(r=Math.max(n,r),a=f(e,r,a),u=f(e,r))}}),e),this._indices=null,this._dims=null}l.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]};var d=i.inherits(l,n.Transform);function c(e){n.Transform.call(this,null,e)}d.transform=function(e,r){return this._dims?e.modified("fields")||e.fields.some((function(e){return r.modified(e.fields)}))?this.reinit(e,r):this.eval(e,r):this.init(e,r)},d.init=function(e,r){for(var n,i,t=e.fields,a=e.query,o=this._indices={},f=this._dims=[],l=a.length,d=0;dg)for(t=g,a=Math.min(m,p);tp)for(t=Math.max(m,p),a=v;th)for(t=h,a=Math.min(d,m);tm)for(t=Math.max(d,m),a=c;t boolean (true => remove) - var n = data.length, - copy = Array(n - num), - reindex = data, // reuse old data array for index map - t, i, j; - - // seek forward to first removal - for (i=0; !map[i] && i k || m > width) { - width = Math.max(m, width); - curr = array(n, width, curr); - prev = array(n, width); - } - } - }; -} - -function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; -} - -function array(n, m, array) { - var copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; -} diff --git a/node_modules/vega-crossfilter/src/CrossFilter.js b/node_modules/vega-crossfilter/src/CrossFilter.js deleted file mode 100644 index 112fc01..0000000 --- a/node_modules/vega-crossfilter/src/CrossFilter.js +++ /dev/null @@ -1,384 +0,0 @@ -import Bitmaps from './Bitmaps'; -import Dimension from './Dimension'; -import SortedIndex from './SortedIndex'; -import {Transform} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ -export default function CrossFilter(params) { - Transform.call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; -} - -CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'query', 'type': 'array', 'array': true, 'required': true, - 'content': {'type': 'number', 'array': true, 'length': 2} } - ] -}; - -var prototype = inherits(CrossFilter, Transform); - -prototype.transform = function(_, pulse) { - if (!this._dims) { - return this.init(_, pulse); - } else { - var init = _.modified('fields') - || _.fields.some(function(f) { return pulse.modified(f.fields); }); - - return init - ? this.reinit(_, pulse) - : this.eval(_, pulse); - } -}; - -prototype.init = function(_, pulse) { - var fields = _.fields, - query = _.query, - indices = this._indices = {}, - dims = this._dims = [], - m = query.length, - i = 0, key, index; - - // instantiate indices and dimensions - for (; i lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - dim.range = query.slice(); -}; - -prototype.incrementOne = function(dim, query, add, rem) { - var bits = this.value, - curr = bits.curr(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, j, k; - - // Fast incremental update based on previous lo index. - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - dim.range = query.slice(); -}; diff --git a/node_modules/vega-crossfilter/src/Dimension.js b/node_modules/vega-crossfilter/src/Dimension.js deleted file mode 100644 index ce54389..0000000 --- a/node_modules/vega-crossfilter/src/Dimension.js +++ /dev/null @@ -1,25 +0,0 @@ -export default function(index, i, query) { - var bit = (1 << i); - - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - - onAdd: function(added, curr) { - var dim = this, - range = dim.bisect(dim.range, added.value), - idx = added.index, - lo = range[0], - hi = range[1], - n1 = idx.length, i; - - for (i=0; i dims to ignore - bitmap = _.filter, - mask = bitmap.mask; - - // exit early if no relevant filter changes - if ((mask & ignore) === 0) return pulse.StopPropagation; - - var output = pulse.fork(pulse.ALL), - data = bitmap.data(), - curr = bitmap.curr(), - prev = bitmap.prev(), - pass = function(k) { - return !(curr[k] & ignore) ? data[k] : null; - }; - - // propagate all mod tuples that pass the filter - output.filter(output.MOD, pass); - - // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - - if (!(mask & (mask-1))) { // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, function(k) { - return (curr[k] & ignore) === mask ? data[k] : null; - }); - - } else { // multiple filters changed - output.filter(output.ADD, function(k) { - var c = curr[k] & ignore, - f = !c && (c ^ (prev[k] & ignore)); - return f ? data[k] : null; - }); - output.filter(output.REM, function(k) { - var c = curr[k] & ignore, - f = c && !(c ^ (c ^ (prev[k] & ignore))); - return f ? data[k] : null; - }); - } - - // add filter to source data in case of reflow... - return output.filter(output.SOURCE, function(t) { return pass(t._index); }); -}; diff --git a/node_modules/vega-crossfilter/src/SortedIndex.js b/node_modules/vega-crossfilter/src/SortedIndex.js deleted file mode 100644 index 04426d0..0000000 --- a/node_modules/vega-crossfilter/src/SortedIndex.js +++ /dev/null @@ -1,126 +0,0 @@ -import {array32} from './arrays'; -import {bisectLeft, bisectRight, permute} from 'd3-array'; - -/** - * Maintains a list of values, sorted by key. - */ -export default function SortedIndex() { - var index = array32(0), - value = [], - size = 0; - - function insert(key, data, base) { - if (!data.length) return []; - - var n0 = size, - n1 = data.length, - addv = Array(n1), - addi = array32(n1), - oldv, oldi, i; - - for (i=0; i 0) for (i=0; i remove - var n = size, - idx, i, j; - - // seek forward to first removal - for (i=0; !map[index[i]] && i y ? 1 : 0; - }); - return permute(values, index); -} - -function merge(base, value0, index0, n0, value1, index1, n1, value, index) { - var i0 = 0, i1 = 0, i; - - for (i=0; i0 < n0 && i1 < n1; ++i) { - if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - } - - for (; i0 < n0; ++i0, ++i) { - value[i] = value0[i0]; - index[i] = index0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } -} diff --git a/node_modules/vega-crossfilter/src/arrays.js b/node_modules/vega-crossfilter/src/arrays.js deleted file mode 100644 index cacb268..0000000 --- a/node_modules/vega-crossfilter/src/arrays.js +++ /dev/null @@ -1,5 +0,0 @@ -export function array8(n) { return new Uint8Array(n); } - -export function array16(n) { return new Uint16Array(n); } - -export function array32(n) { return new Uint32Array(n); } diff --git a/node_modules/vega-dataflow/LICENSE b/node_modules/vega-dataflow/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-dataflow/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-dataflow/README.md b/node_modules/vega-dataflow/README.md deleted file mode 100644 index cddc143..0000000 --- a/node_modules/vega-dataflow/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# vega-dataflow - -Reactive dataflow processing. - -Defines a reactive dataflow graph that can process both scalar values and streaming relational data. A central `Dataflow` instance manages and schedules a collection of `Operator` instances, each of which is a node in a dataflow graph. Each operator maintains a local state *value*, and may also process streaming data objects (or *tuples*) passing through. Operators may depend on a set of named `Parameters`, which can either be fixed values or live references to other operator values. - -Upon modifications to operator parameters or input data, changes are propagated through the graph in topological order. `Pulse` objects propagate from operators to their dependencies, and carry queues of added, removed and/or modified tuples. - -This module contains only the core reactive dataflow processing engine. Other modules provide a library of `Operator` types for data stream query processing, including data generation, sampling, filtering, binning, aggregation, cross-stream lookup, visual encoding, and spatial layout. - -For more information about data stream transforms, see the [Vega transform documentation](https://vega.github.io/vega/docs/transforms/). diff --git a/node_modules/vega-dataflow/build/vega-dataflow.js b/node_modules/vega-dataflow/build/vega-dataflow.js deleted file mode 100644 index a212679..0000000 --- a/node_modules/vega-dataflow/build/vega-dataflow.js +++ /dev/null @@ -1,2229 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('vega-loader'), require('vega-format')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'vega-loader', 'vega-format'], factory) : - (global = global || self, factory(global.vega = {}, global.vega, global.vega, global.vega)); -}(this, (function (exports, vegaUtil, vegaLoader, vegaFormat) { 'use strict'; - - function UniqueList(idFunc) { - var $ = idFunc || vegaUtil.identity, - list = [], - ids = {}; - - list.add = function(_) { - var id = $(_); - if (!ids[id]) { - ids[id] = 1; - list.push(_); - } - return list; - }; - - list.remove = function(_) { - var id = $(_), idx; - if (ids[id]) { - ids[id] = 0; - if ((idx = list.indexOf(_)) >= 0) { - list.splice(idx, 1); - } - } - return list; - }; - - return list; - } - - /** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ - async function asyncCallback(df, callback) { - try { await callback(df); } catch (err) { df.error(err); } - } - - var TUPLE_ID_KEY = Symbol('vega_id'), - TUPLE_ID = 1; - - /** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ - function isTuple(t) { - return !!(t && tupleid(t)); - } - - /** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ - function tupleid(t) { - return t[TUPLE_ID_KEY]; - } - - /** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ - function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; - } - - /** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ - function ingest(datum) { - var t = (datum === Object(datum)) ? datum : {data: datum}; - return tupleid(t) ? t : setid(t, TUPLE_ID++); - } - - /** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ - function derive(t) { - return rederive(t, ingest({})); - } - - /** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ - function rederive(t, d) { - for (var k in t) d[k] = t[k]; - return d; - } - - /** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ - function replace(t, d) { - return setid(d, tupleid(t)); - } - - /** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ - function stableCompare(cmp, f) { - return !cmp ? null - : f ? (a, b) => cmp(a, b) || (tupleid(f(a)) - tupleid(f(b))) - : (a, b) => cmp(a, b) || (tupleid(a) - tupleid(b)); - } - - function isChangeSet(v) { - return v && v.constructor === changeset; - } - - function changeset() { - var add = [], // insert tuples - rem = [], // remove tuples - mod = [], // modify tuples - remp = [], // remove by predicate - modp = [], // modify by predicate - clean = null, - reflow = false; - - return { - constructor: changeset, - insert: function(t) { - var d = vegaUtil.array(t), i = 0, n = d.length; - for (; i 0) { - modify(t, f, m.value); - pulse.modifies(f); - } - } - - // process predicate-based modifications - for (i=0, n=modp.length; i 0) { - modify(t, m.field, m.value); - } - }); - pulse.modifies(m.field); - } - - // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - if (reflow) { - pulse.mod = rem.length || remp.length - ? tuples.filter(function(t) { return cur[tupleid(t)] > 0; }) - : tuples.slice(); - } else { - for (id in out) pulse.mod.push(out[id]); - } - - // set pulse garbage collection request - if (clean || clean == null && (rem.length || remp.length)) { - pulse.clean(true); - } - - return pulse; - } - }; - } - - var CACHE = '_:mod:_'; - - /** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ - function Parameters() { - Object.defineProperty(this, CACHE, {writable: true, value: {}}); - } - - var prototype = Parameters.prototype; - - /** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ - prototype.set = function(name, index, value, force) { - var o = this, - v = o[name], - mod = o[CACHE]; - - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = vegaUtil.isArray(value) ? 1 + value.length : -1; - } - - return o; - }; - - /** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ - prototype.modified = function(name, index) { - var mod = this[CACHE], k; - if (!arguments.length) { - for (k in mod) { if (mod[k]) return true; } - return false; - } else if (vegaUtil.isArray(name)) { - for (k=0; k= 0) - ? (index + 1 < mod[name] || !!mod[index + ':' + name]) - : !!mod[name]; - }; - - /** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ - prototype.clear = function() { - this[CACHE] = {}; - return this; - }; - - var OP_ID = 0; - var PULSE = 'pulse'; - var NO_PARAMS = new Parameters(); - - // Boolean Flags - var SKIP = 1, - MODIFIED = 2; - - /** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ - function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - - if (update) { - this._update = update; - } - if (params) this.parameters(params, react); - } - - var prototype$1 = Operator.prototype; - - /** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ - prototype$1.targets = function() { - return this._targets || (this._targets = UniqueList(vegaUtil.id)); - }; - - /** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ - prototype$1.set = function(value) { - if (this.value !== value) { - this.value = value; - return 1; - } else { - return 0; - } - }; - - function flag(bit) { - return function(state) { - var f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? (f | bit) : (f & ~bit); - return this; - }; - } - - /** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ - prototype$1.skip = flag(SKIP); - - /** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ - prototype$1.modified = flag(MODIFIED); - - /** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initiatal evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ - prototype$1.parameters = function(params, react, initonly) { - react = react !== false; - var self = this, - argval = (self._argval = self._argval || new Parameters()), - argops = (self._argops = self._argops || []), - deps = [], - name, value, n, i; - - function add(name, index, value) { - if (value instanceof Operator) { - if (value !== self) { - if (react) value.targets().add(self); - deps.push(value); - } - argops.push({op:value, name:name, index:index}); - } else { - argval.set(name, index, value); - } - } - - for (name in params) { - value = params[name]; - - if (name === PULSE) { - vegaUtil.array(value).forEach(function(op) { - if (!(op instanceof Operator)) { - vegaUtil.error('Pulse parameters must be operator instances.'); - } else if (op !== self) { - op.targets().add(self); - deps.push(op); - } - }); - self.source = value; - } else if (vegaUtil.isArray(value)) { - argval.set(name, -1, Array(n = value.length)); - for (i=0; i} - The source operators that should propagate - * to the target operator. - */ - function connect(target, sources) { - var targetRank = target.rank, i, n; - - for (i=0, n=sources.length; i pause) { - t = now; - return 1; - } else { - return 0; - } - }); - }; - - prototype$2.debounce = function(delay) { - var s = stream(); - - this.targets().add(stream(null, null, - vegaUtil.debounce(delay, function(e) { - var df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }) - )); - - return s; - }; - - prototype$2.between = function(a, b) { - var active = false; - a.targets().add(stream(null, null, function() { active = true; })); - b.targets().add(stream(null, null, function() { active = false; })); - return this.filter(function() { return active; }); - }; - - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ - function events(source, type, filter, apply) { - var df = this, - s = stream(filter, apply), - send = function(e) { - e.dataflow = df; - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally { - df.run(); - } - }, - sources; - - if (typeof source === 'string' && typeof document !== 'undefined') { - sources = document.querySelectorAll(source); - } else { - sources = vegaUtil.array(source); - } - - for (var i=0, n=sources.length; i df.touch(target(e)); - } else if (vegaUtil.isFunction(update)) { - op = new Operator(null, update, params, false); - func = e => { - op.evaluate(e); - const t = target(e), v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else { - func = e => df.update(target(e), update, opt); - } - - stream.apply(func); - } - - function onOperator(df, source, target, update, params, options) { - if (update === undefined) { - source.targets().add(target); - } else { - const opt = options || {}, - op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - source.targets().add(op); // add dependency - - if (target) { - op.skip(true); // skip first invocation - op.value = target.value; // initialize value - op.targets().add(target); // chain dependencies - df.connect(target, [op]); // rerank as needed, #1672 - } - } - } - - function updater(target, update) { - update = vegaUtil.isFunction(update) ? update : vegaUtil.constant(update); - return target - ? function(_, pulse) { - const value = update(_, pulse); - if (!target.skip()) { - target.skip(value !== this.value).value = value; - } - return value; - } - : update; - } - - /** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ - function rank(op) { - op.rank = ++this._rank; - } - - /** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ - function rerank(op) { - var queue = [op], - cur, list, i; - - while (queue.length) { - this.rank(cur = queue.pop()); - if (list = cur._targets) { - for (i=list.length; --i >= 0;) { - queue.push(cur = list[i]); - if (cur === op) vegaUtil.error('Cycle detected in dataflow graph.'); - } - } - } - } - - /** - * Sentinel value indicating pulse propagation should stop. - */ - const StopPropagation = {}; - - // Pulse visit type flags - const ADD = (1 << 0), - REM = (1 << 1), - MOD = (1 << 2), - ADD_REM = ADD | REM, - ADD_MOD = ADD | MOD, - ALL = ADD | REM | MOD, - REFLOW = (1 << 3), - SOURCE = (1 << 4), - NO_SOURCE = (1 << 5), - NO_FIELDS = (1 << 6); - - /** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ - function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; - } - - const prototype$3 = Pulse.prototype; - - /** - * Sentinel value indicating pulse propagation should stop. - */ - prototype$3.StopPropagation = StopPropagation; - - /** - * Boolean flag indicating ADD (added) tuples. - */ - prototype$3.ADD = ADD; - - /** - * Boolean flag indicating REM (removed) tuples. - */ - prototype$3.REM = REM; - - /** - * Boolean flag indicating MOD (modified) tuples. - */ - prototype$3.MOD = MOD; - - /** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ - prototype$3.ADD_REM = ADD_REM; - - /** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ - prototype$3.ADD_MOD = ADD_MOD; - - /** - * Boolean flag indicating ADD, REM and MOD tuples. - */ - prototype$3.ALL = ALL; - - /** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ - prototype$3.REFLOW = REFLOW; - - /** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ - prototype$3.SOURCE = SOURCE; - - /** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ - prototype$3.NO_SOURCE = NO_SOURCE; - - /** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ - prototype$3.NO_FIELDS = NO_FIELDS; - - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ - prototype$3.fork = function(flags) { - return new Pulse(this.dataflow).init(this, flags); - }; - - /** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ - prototype$3.clone = function() { - const p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); - }; - - /** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ - prototype$3.addAll = function() { - let p = this; - if (!p.source || p.source.length === p.add.length) { - return p; - } else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - return p; - } - }; - - /** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ - prototype$3.init = function(src, flags) { - const p = this; - p.stamp = src.stamp; - p.encode = src.encode; - - if (src.fields && !(flags & NO_FIELDS)) { - p.fields = src.fields; - } - - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - - return p; - }; - - /** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ - prototype$3.runAfter = function(func) { - this.dataflow.runAfter(func); - }; - - /** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ - prototype$3.changed = function(flags) { - var f = flags || ALL; - return ((f & ADD) && this.add.length) - || ((f & REM) && this.rem.length) - || ((f & MOD) && this.mod.length); - }; - - /** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ - prototype$3.reflow = function(fork) { - if (fork) return this.fork(ALL).reflow(); - - var len = this.add.length, - src = this.source && this.source.length; - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); - } - return this; - }; - - /** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ - prototype$3.clean = function(value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else { - return this.cleans; - } - }; - - /** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ - prototype$3.modifies = function(_) { - var hash = this.fields || (this.fields = {}); - if (vegaUtil.isArray(_)) { - _.forEach(f => hash[f] = true); - } else { - hash[_] = true; - } - return this; - }; - - /** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ - prototype$3.modified = function(_, nomod) { - var fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false - : !arguments.length ? !!fields - : vegaUtil.isArray(_) ? _.some(f => fields[f]) - : fields[_]; - }; - - /** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ - prototype$3.filter = function(flags, filter) { - var p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; - }; - - function addFilter(a, b) { - return a - ? (t, i) => a(t, i) && b(t, i) - : b; - } - - /** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ - prototype$3.materialize = function(flags) { - flags = flags || ALL; - var p = this; - if ((flags & ADD) && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - if ((flags & REM) && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - if ((flags & MOD) && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - if ((flags & SOURCE) && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - return p; - }; - - function materialize(data, filter) { - var out = []; - vegaUtil.visitArray(data, filter, _ => out.push(_)); - return out; - } - - function filter(pulse, flags) { - var map = {}; - pulse.visit(flags, function(t) { map[tupleid(t)] = 1; }); - return t => map[tupleid(t)] ? null : t; - } - - /** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ - prototype$3.visit = function(flags, visitor) { - var p = this, v = visitor, src, sum; - - if (flags & SOURCE) { - vegaUtil.visitArray(p.source, p.srcF, v); - return p; - } - - if (flags & ADD) vegaUtil.visitArray(p.add, p.addF, v); - if (flags & REM) vegaUtil.visitArray(p.rem, p.remF, v); - if (flags & MOD) vegaUtil.visitArray(p.mod, p.modF, v); - - if ((flags & REFLOW) && (src = p.source)) { - sum = p.add.length + p.mod.length; - if (sum === src.length) ; else if (sum) { - vegaUtil.visitArray(src, filter(p, ADD_MOD), v); - } else { - // if no add/rem/mod tuples, visit source - vegaUtil.visitArray(src, p.srcF, v); - } - } - - return p; - }; - - /** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array} pulses - The sub-pulses for this multi-pulse. - */ - function MultiPulse(dataflow, stamp, pulses, encode) { - var p = this, - c = 0, - pulse, hash, i, n, f; - - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - - for (i=0, n=pulses.length; i df._enqueue(op, true)); - df._touched = UniqueList(vegaUtil.id); - - let count = 0, op, next, error; - - try { - while (df._heap.size() > 0) { - // dequeue operator with highest priority - op = df._heap.pop(); - - // re-queue if rank changed - if (op.rank !== op.qrank) { - df._enqueue(op, true); - continue; - } - - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - - if (next.then) { - // await if operator returns a promise directly - next = await next; - } else if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach(op => df._enqueue(op)); - } - - // increment visit counter - ++count; - } - } catch (err) { - df._heap.clear(); - error = err; - } - - // reset pulse map - df._input = {}; - df._pulse = null; - - df.debug(`Pulse ${stamp}: ${count} operators`); - - if (error) { - df._postrun = []; - df.error(error); - } - - // invoke callbacks queued via runAfter - if (df._postrun.length) { - const pr = df._postrun.sort((a, b) => b.priority - a.priority); - df._postrun = []; - for (let i=0; i df.runAsync(null, () => { - cb.forEach(f => { try { f(df); } catch (err) { df.error(err); } }); - })); - } - - return df; - } - - /** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ - async function runAsync(encode, prerun, postrun) { - // await previously queued functions - while (this._running) await this._running; - - // run dataflow, manage running promise - const clear = () => this._running = null; - (this._running = this.evaluate(encode, prerun, postrun)) - .then(clear, clear); - - return this._running; - } - - /** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ - function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) - : (this.evaluate(encode, prerun, postrun), this); - } - - /** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ - function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) { - // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - } else { - // pulse propagation already complete, invoke immediately - try { callback(this); } catch (err) { this.error(err); } - } - } - - /** - * Raise an error for re-entrant dataflow evaluation. - */ - function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; - } - - /** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ - function enqueue(op, force) { - var q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - if (q || force) { - op.qrank = op.rank; - this._heap.push(op); - } - } - - /** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ - function getPulse(op, encode) { - var s = op.source, - stamp = this._clock; - - return s && vegaUtil.isArray(s) - ? new MultiPulse(this, stamp, s.map(_ => _.pulse), encode) - : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); - } - - function singlePulse(p, s) { - if (s && s.stamp === p.stamp) { - return s; - } - - p = p.fork(); - if (s && s !== StopPropagation) { - p.source = s.source; - } - return p; - } - - var NO_OPT = {skip: false, force: false}; - - /** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - function touch(op, options) { - var opt = options || NO_OPT; - if (this._pulse) { - // if in midst of propagation, add to priority queue - this._enqueue(op); - } else { - // otherwise, queue for next propagation - this._touched.add(op); - } - if (opt.skip) op.skip(true); - return this; - } - - /** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - function update(op, value, options) { - var opt = options || NO_OPT; - if (op.set(value) || opt.force) { - this.touch(op, opt); - } - return this; - } - - /** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - - var p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), - t = op.pulse && op.pulse.source || []; - - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - - return this; - } - - function Heap(cmp) { - var nodes = []; - return { - clear: () => nodes = [], - size: () => nodes.length, - peek: () => nodes[0], - push: x => { - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: () => { - var last = nodes.pop(), item; - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else { - item = last; - } - return item; - } - }; - } - - function siftdown(array, start, idx, cmp) { - var item, parent, pidx; - - item = array[idx]; - while (idx > start) { - pidx = (idx - 1) >> 1; - parent = array[pidx]; - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - break; - } - return (array[idx] = item); - } - - function siftup(array, idx, cmp) { - var start = idx, - end = array.length, - item = array[idx], - cidx = (idx << 1) + 1, ridx; - - while (cidx < end) { - ridx = cidx + 1; - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) { - cidx = ridx; - } - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - array[idx] = item; - return siftdown(array, start, idx, cmp); - } - - /** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ - function Dataflow() { - this.logger(vegaUtil.logger()); - this.logLevel(vegaUtil.Error); - - this._clock = 0; - this._rank = 0; - this._locale = vegaFormat.defaultLocale(); - try { - this._loader = vegaLoader.loader(); - } catch (e) { - // do nothing if loader module is unavailable - } - - this._touched = UniqueList(vegaUtil.id); - this._input = {}; - this._pulse = null; - - this._heap = Heap((a, b) => a.qrank - b.qrank); - this._postrun = []; - } - - var prototype$5 = Dataflow.prototype; - - /** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ - prototype$5.stamp = function() { - return this._clock; - }; - - /** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ - prototype$5.loader = function(_) { - if (arguments.length) { - this._loader = _; - return this; - } else { - return this._loader; - } - }; - - /** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ - prototype$5.locale = function(_) { - if (arguments.length) { - this._locale = _; - return this; - } else { - return this._locale; - } - }; - - /** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ - prototype$5.cleanThreshold = 1e4; - - // OPERATOR REGISTRATION - prototype$5.add = add; - prototype$5.connect = connect; - prototype$5.rank = rank; - prototype$5.rerank = rerank; - - // OPERATOR UPDATES - prototype$5.pulse = pulse; - prototype$5.touch = touch; - prototype$5.update = update; - prototype$5.changeset = changeset; - - // DATA LOADING - prototype$5.ingest = ingest$1; - prototype$5.parse = parse; - prototype$5.preload = preload; - prototype$5.request = request; - - // EVENT HANDLING - prototype$5.events = events; - prototype$5.on = on; - - // PULSE PROPAGATION - prototype$5.evaluate = evaluate; - prototype$5.run = run; - prototype$5.runAsync = runAsync; - prototype$5.runAfter = runAfter; - prototype$5._enqueue = enqueue; - prototype$5._getPulse = getPulse; - - // LOGGING AND ERROR HANDLING - - function logMethod(method) { - return function() { - return this._log[method].apply(this, arguments); - }; - } - - /** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ - prototype$5.logger = function(logger) { - if (arguments.length) { - this._log = logger; - return this; - } else { - return this._log; - } - }; - - /** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ - prototype$5.error = logMethod('error'); - - /** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ - prototype$5.warn = logMethod('warn'); - - /** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ - prototype$5.info = logMethod('info'); - - /** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ - prototype$5.debug = logMethod('debug'); - - /** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ - prototype$5.logLevel = logMethod('level'); - - /** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ - function Transform(init, params) { - Operator.call(this, init, null, params); - } - - var prototype$6 = vegaUtil.inherits(Transform, Operator); - - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ - prototype$6.run = function(pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - - var rv; - if (this.skip()) { - this.skip(false); - } else { - rv = this.evaluate(pulse); - } - rv = rv || pulse; - - if (rv.then) { - rv = rv.then(_ => this.pulse =_); - } else if (rv !== pulse.StopPropagation) { - this.pulse = rv; - } - - return rv; - }; - - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ - prototype$6.evaluate = function(pulse) { - var params = this.marshall(pulse.stamp), - out = this.transform(params, pulse); - params.clear(); - return out; - }; - - /** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ - prototype$6.transform = function() {}; - - var transforms = {}; - - function definition(type) { - var t = transform(type); - return t && t.Definition || null; - } - - function transform(type) { - type = type && type.toLowerCase(); - return vegaUtil.hasOwnProperty(transforms, type) ? transforms[type] : null; - } - - exports.Dataflow = Dataflow; - exports.EventStream = EventStream; - exports.MultiPulse = MultiPulse; - exports.Operator = Operator; - exports.Parameters = Parameters; - exports.Pulse = Pulse; - exports.Transform = Transform; - exports.UniqueList = UniqueList; - exports.asyncCallback = asyncCallback; - exports.changeset = changeset; - exports.definition = definition; - exports.derive = derive; - exports.ingest = ingest; - exports.isChangeSet = isChangeSet; - exports.isTuple = isTuple; - exports.rederive = rederive; - exports.replace = replace; - exports.stableCompare = stableCompare; - exports.transform = transform; - exports.transforms = transforms; - exports.tupleid = tupleid; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-dataflow/build/vega-dataflow.min.js b/node_modules/vega-dataflow/build/vega-dataflow.min.js deleted file mode 100644 index 029d08d..0000000 --- a/node_modules/vega-dataflow/build/vega-dataflow.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-util"),require("vega-loader"),require("vega-format")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-loader","vega-format"],n):n((t=t||self).vega={},t.vega,t.vega,t.vega)}(this,(function(t,n,e,r){"use strict";function i(t){var e=t||n.identity,r=[],i={};return r.add=function(t){var n=e(t);return i[n]||(i[n]=1,r.push(t)),r},r.remove=function(t){var n,s=e(t);return i[s]&&(i[s]=0,(n=r.indexOf(t))>=0&&r.splice(n,1)),r},r}async function s(t,n){try{await n(t)}catch(n){t.error(n)}}var a=Symbol("vega_id"),u=1;function o(t){return t[a]}function l(t,n){return t[a]=n,t}function c(t){var n=t===Object(t)?t:{data:t};return o(n)?n:l(n,u++)}function h(t,n){for(var e in t)n[e]=t[e];return n}function f(t){return t&&t.constructor===d}function d(){var t=[],e=[],r=[],i=[],s=[],a=null,u=!1;return{constructor:d,insert:function(e){for(var r=n.array(e),i=0,s=r.length;i0&&(y(g,p,d.value),n.modifies(p));for(h=0,f=s.length;h0&&y(t,d.field,d.value)})),n.modifies(d.field);if(u)n.mod=e.length||i.length?l.filter((function(t){return m[o(t)]>0})):l.slice();else for(v in _)n.mod.push(_[v]);return(a||null==a&&(e.length||i.length))&&n.clean(!0),n}}}var p="_:mod:_";function g(){Object.defineProperty(this,p,{writable:!0,value:{}})}var v=g.prototype;v.set=function(t,e,r,i){var s=this,a=s[t],u=s[p];return null!=e&&e>=0?(a[e]!==r||i)&&(a[e]=r,u[e+":"+t]=-1,u[t]=-1):(a!==r||i)&&(s[t]=r,u[t]=n.isArray(r)?1+r.length:-1),s},v.modified=function(t,e){var r,i=this[p];if(!arguments.length){for(r in i)if(i[r])return!0;return!1}if(n.isArray(t)){for(r=0;r=0?e+1t?(n=e,1):0}))},E.debounce=function(t){var e=D();return this.targets().add(D(null,null,n.debounce(t,(function(t){var n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},E.between=function(t,n){var e=!1;return t.targets().add(D(null,null,(function(){e=!0}))),n.targets().add(D(null,null,(function(){e=!1}))),this.filter((function(){return e}))};var P={skip:!0};function q(t,e,r,i,s,a){var u,o,l=n.extend({},a,P);n.isFunction(r)||(r=n.constant(r)),void 0===i?u=n=>t.touch(r(n)):n.isFunction(i)?(o=new y(null,i,s,!1),u=n=>{o.evaluate(n);const e=r(n),i=o.value;f(i)?t.pulse(e,i,a):t.update(e,i,l)}):u=n=>t.update(r(n),i,l),e.apply(u)}function O(t,e,r,i,s,a){if(void 0===i)e.targets().add(r);else{const u=a||{},o=new y(null,function(t,e){return e=n.isFunction(e)?e:n.constant(e),t?function(n,r){const i=e(n,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:e}(r,i),s,!1);o.modified(u.force),o.rank=e.rank,e.targets().add(o),r&&(o.skip(!0),o.value=r.value,o.targets().add(r),t.connect(r,[o]))}}const b={};function M(t,n,e){this.dataflow=t,this.stamp=null==n?-1:n,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=e||null}const S=M.prototype;function L(t,n){return t?(e,r)=>t(e,r)&&n(e,r):n}function R(t,e){var r=[];return n.visitArray(t,e,t=>r.push(t)),r}function x(t,n){var e={};return t.visit(n,(function(t){e[o(t)]=1})),t=>e[o(t)]?null:t}function C(t,n,e,r){var i,s,a,u,o,l=this,c=0;for(this.dataflow=t,this.stamp=n,this.fields=null,this.encode=r||null,this.pulses=e,a=0,u=e.length;ae[t]=!0):e[t]=!0,this},S.modified=function(t,e){var r=this.fields;return!(!e&&!this.mod.length||!r)&&(arguments.length?n.isArray(t)?t.some(t=>r[t]):r[t]:!!r)},S.filter=function(t,n){var e=this;return 1&t&&(e.addF=L(e.addF,n)),2&t&&(e.remF=L(e.remF,n)),4&t&&(e.modF=L(e.modF,n)),16&t&&(e.srcF=L(e.srcF,n)),e},S.materialize=function(t){var n=this;return 1&(t=t||7)&&n.addF&&(n.add=R(n.add,n.addF),n.addF=null),2&t&&n.remF&&(n.rem=R(n.rem,n.remF),n.remF=null),4&t&&n.modF&&(n.mod=R(n.mod,n.modF),n.modF=null),16&t&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},S.visit=function(t,e){var r,i,s=this,a=e;return 16&t?(n.visitArray(s.source,s.srcF,a),s):(1&t&&n.visitArray(s.add,s.addF,a),2&t&&n.visitArray(s.rem,s.remF,a),4&t&&n.visitArray(s.mod,s.modF,a),8&t&&(r=s.source)&&((i=s.add.length+s.mod.length)===r.length||(i?n.visitArray(r,x(s,5),a):n.visitArray(r,s.srcF,a))),s)};var z=n.inherits(C,M);function U(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}z.fork=function(t){var n=new M(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&n.ADD&&this.visit(n.ADD,(function(t){return n.add.push(t)})),t&n.REM&&this.visit(n.REM,(function(t){return n.rem.push(t)})),t&n.MOD&&this.visit(n.MOD,(function(t){return n.mod.push(t)}))),n},z.changed=function(t){return this.changes&t},z.modified=function(t){var e=this,r=e.fields;return r&&e.changes&e.MOD?n.isArray(t)?t.some((function(t){return r[t]})):r[t]:0},z.filter=function(){n.error("MultiPulse does not support filtering.")},z.materialize=function(){n.error("MultiPulse does not support materialization.")},z.visit=function(t,n){var e=this,r=e.pulses,i=r.length,s=0;if(t&e.SOURCE)for(;sn=[],size:()=>n.length,peek:()=>n[0],push:e=>(n.push(e),N(n,0,n.length-1,t)),pop:()=>{var e,r=n.pop();return n.length?(e=n[0],n[0]=r,function(t,n,e){var r,i=n,s=t.length,a=t[n],u=1+(n<<1);for(;u=0&&(u=r),t[n]=t[u],u=1+((n=u)<<1);t[n]=a,N(t,i,n,e)}(n,0,t)):e=r,e}}}function N(t,n,e,r){var i,s,a;for(i=t[e];e>n&&r(i,s=t[a=e-1>>1])<0;)t[e]=s,e=a;return t[e]=i}function I(){this.logger(n.logger()),this.logLevel(n.Error),this._clock=0,this._rank=0,this._locale=r.defaultLocale();try{this._loader=e.loader()}catch(t){}this._touched=i(n.id),this._input={},this._pulse=null,this._heap=T((t,n)=>t.qrank-n.qrank),this._postrun=[]}var $=I.prototype;function W(t){return function(){return this._log[t].apply(this,arguments)}}function B(t,n){y.call(this,t,null,n)}$.stamp=function(){return this._clock},$.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},$.locale=function(t){return arguments.length?(this._locale=t,this):this._locale},$.cleanThreshold=1e4,$.add=function(t,e,r,i){var s,a=1;return t instanceof y?s=t:t&&t.prototype instanceof y?s=new t:n.isFunction(t)?s=new y(null,t):(a=0,s=new y(t,e)),this.rank(s),a&&(i=r,r=e),r&&this.connect(s,s.parameters(r,i)),this.touch(s),s},$.connect=function(t,n){var e,r,i=t.rank;for(e=0,r=n.length;e=0;)s.push(e=r[i]),e===t&&n.error("Cycle detected in dataflow graph.")},$.pulse=function(t,n,e){this.touch(t,e||j);var r=new M(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=n.pulse(r,i),this},$.touch=function(t,n){var e=n||j;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},$.update=function(t,n,e){var r=e||j;return(t.set(n)||r.force)&&this.touch(t,r),this},$.changeset=d,$.ingest=function(t,n,e){return n=this.parse(n,e),this.pulse(t,this.changeset().insert(n))},$.parse=function(t,n){const r=this.locale();return e.read(t,n,r.timeParse,r.utcParse)},$.preload=async function(t,e,r){const i=this,s=i._pending||function(t){var n,e=new Promise((function(t){n=t}));return e.requests=0,e.done=function(){0==--e.requests&&(t._pending=null,n(t))},t._pending=e}(i);s.requests+=1;const a=await i.request(e,r);return i.pulse(t,i.changeset().remove(n.truthy).insert(a.data||[])),s.done(),a},$.request=async function(t,n){const r=this;let i,s=0;try{i=await r.loader().load(t,{context:"dataflow",response:e.responseType(n&&n.type)});try{i=r.parse(i,n)}catch(n){s=-2,r.warn("Data ingestion failed",t,n)}}catch(n){s=-1,r.warn("Loading failed",t,n)}return{data:i,status:s}},$.events=function(t,e,r,i){for(var s,a=this,u=D(r,i),o=function(t){t.dataflow=a;try{u.receive(t)}catch(t){a.error(t)}finally{a.run()}},l=0,c=(s="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):n.array(t)).length;la._enqueue(t,!0)),a._touched=i(n.id);let l,c,h,f=0;try{for(;a._heap.size()>0;)l=a._heap.pop(),l.rank===l.qrank?(c=l.run(a._getPulse(l,t)),c.then?c=await c:c.async&&(u.push(c.async),c=b),c!==b&&l._targets&&l._targets.forEach(t=>a._enqueue(t)),++f):a._enqueue(l,!0)}catch(t){a._heap.clear(),h=t}if(a._input={},a._pulse=null,a.debug(`Pulse ${o}: ${f} operators`),h&&(a._postrun=[],a.error(h)),a._postrun.length){const t=a._postrun.sort((t,n)=>n.priority-t.priority);a._postrun=[];for(let n=0;na.runAsync(null,()=>{t.forEach(t=>{try{t(a)}catch(t){a.error(t)}})})),a},$.run=function(t,n,e){return this._pulse?U(this):(this.evaluate(t,n,e),this)},$.runAsync=async function(t,n,e){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,n,e)).then(r,r),this._running},$.runAfter=function(t,n,e){if(this._pulse||n)this._postrun.push({priority:e||0,callback:t});else try{t(this)}catch(t){this.error(t)}},$._enqueue=function(t,n){var e=t.stampt.pulse),e):this._input[t.id]||function(t,n){if(n&&n.stamp===t.stamp)return n;t=t.fork(),n&&n!==b&&(t.source=n.source);return t}(this._pulse,r&&r.pulse)},$.logger=function(t){return arguments.length?(this._log=t,this):this._log},$.error=W("error"),$.warn=W("warn"),$.info=W("info"),$.debug=W("debug"),$.logLevel=W("level");var G=n.inherits(B,y);G.run=function(t){return t.stampthis.pulse=t):n!==t.StopPropagation&&(this.pulse=n),n);var n},G.evaluate=function(t){var n=this.marshall(t.stamp),e=this.transform(n,t);return n.clear(),e},G.transform=function(){};var H={};function J(t){return t=t&&t.toLowerCase(),n.hasOwnProperty(H,t)?H[t]:null}t.Dataflow=I,t.EventStream=A,t.MultiPulse=C,t.Operator=y,t.Parameters=g,t.Pulse=M,t.Transform=B,t.UniqueList=i,t.asyncCallback=s,t.changeset=d,t.definition=function(t){var n=J(t);return n&&n.Definition||null},t.derive=function(t){return h(t,c({}))},t.ingest=c,t.isChangeSet=f,t.isTuple=function(t){return!(!t||!o(t))},t.rederive=h,t.replace=function(t,n){return l(n,o(t))},t.stableCompare=function(t,n){return t?n?(e,r)=>t(e,r)||o(n(e))-o(n(r)):(n,e)=>t(n,e)||o(n)-o(e):null},t.transform=J,t.transforms=H,t.tupleid=o,Object.defineProperty(t,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-dataflow/index.js b/node_modules/vega-dataflow/index.js deleted file mode 100644 index e79a766..0000000 --- a/node_modules/vega-dataflow/index.js +++ /dev/null @@ -1,31 +0,0 @@ -// Utilities -export {default as UniqueList} from './src/util/UniqueList'; -export {default as asyncCallback} from './src/util/asyncCallback'; - -// Core Runtime -export {default as changeset, isChangeSet} from './src/ChangeSet'; -export {default as Dataflow} from './src/dataflow/Dataflow'; -export {default as EventStream} from './src/EventStream'; -export {default as Parameters} from './src/Parameters'; -export {default as Pulse} from './src/Pulse'; -export {default as MultiPulse} from './src/MultiPulse'; -export {default as Operator} from './src/Operator'; -export {default as Transform} from './src/Transform'; - -// Tuple Methods -export { - derive, - ingest, - isTuple, - rederive, - replace, - stableCompare, - tupleid -} from './src/Tuple'; - -// Transform Registry -export { - definition, - transform, - transforms -} from './src/register'; diff --git a/node_modules/vega-dataflow/package.json b/node_modules/vega-dataflow/package.json deleted file mode 100644 index 930ab92..0000000 --- a/node_modules/vega-dataflow/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "_from": "vega-dataflow@~5.7.0", - "_id": "vega-dataflow@5.7.0", - "_inBundle": false, - "_integrity": "sha512-W8Q6NBCmk3TCDjTiy/I2PA4JTQljqp3XF6227CiCvZfhmCZCeHchuZKrgwJUBVZ2CoqT+UL2JpCi1SFzrPObIQ==", - "_location": "/vega-dataflow", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-dataflow@~5.7.0", - "name": "vega-dataflow", - "escapedName": "vega-dataflow", - "rawSpec": "~5.7.0", - "saveSpec": null, - "fetchSpec": "~5.7.0" - }, - "_requiredBy": [ - "/vega", - "/vega-crossfilter", - "/vega-encode", - "/vega-force", - "/vega-functions", - "/vega-geo", - "/vega-hierarchy", - "/vega-parser", - "/vega-regression", - "/vega-runtime", - "/vega-transforms", - "/vega-view", - "/vega-view-transforms", - "/vega-voronoi", - "/vega-wordcloud" - ], - "_resolved": "https://registry.npmjs.org/vega-dataflow/-/vega-dataflow-5.7.0.tgz", - "_shasum": "811381d946e044cafe093c7c7f8111d366cfbc11", - "_spec": "vega-dataflow@~5.7.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "vega-format": "^1.0.0", - "vega-loader": "^4.3.0", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "Reactive dataflow processing.", - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "dataflow", - "reactive", - "streaming", - "data" - ], - "license": "BSD-3-Clause", - "main": "build/vega-dataflow.js", - "module": "index", - "name": "vega-dataflow", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-dataflow.js -c -m -o build/vega-dataflow.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g vega-format:vega,vega-loader:vega,vega-util:vega -f umd -n vega -o build/vega-dataflow.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "5.7.0" -} diff --git a/node_modules/vega-dataflow/src/ChangeSet.js b/node_modules/vega-dataflow/src/ChangeSet.js deleted file mode 100644 index 23c9d83..0000000 --- a/node_modules/vega-dataflow/src/ChangeSet.js +++ /dev/null @@ -1,148 +0,0 @@ -import {ingest, tupleid} from './Tuple'; -import {array, constant, isFunction} from 'vega-util'; - -export function isChangeSet(v) { - return v && v.constructor === changeset; -} - -export default function changeset() { - var add = [], // insert tuples - rem = [], // remove tuples - mod = [], // modify tuples - remp = [], // remove by predicate - modp = [], // modify by predicate - clean = null, - reflow = false; - - return { - constructor: changeset, - insert: function(t) { - var d = array(t), i = 0, n = d.length; - for (; i 0) { - modify(t, f, m.value); - pulse.modifies(f); - } - } - - // process predicate-based modifications - for (i=0, n=modp.length; i 0) { - modify(t, m.field, m.value); - } - }); - pulse.modifies(m.field); - } - - // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - if (reflow) { - pulse.mod = rem.length || remp.length - ? tuples.filter(function(t) { return cur[tupleid(t)] > 0; }) - : tuples.slice(); - } else { - for (id in out) pulse.mod.push(out[id]); - } - - // set pulse garbage collection request - if (clean || clean == null && (rem.length || remp.length)) { - pulse.clean(true); - } - - return pulse; - } - }; -} diff --git a/node_modules/vega-dataflow/src/EventStream.js b/node_modules/vega-dataflow/src/EventStream.js deleted file mode 100644 index 21bda2d..0000000 --- a/node_modules/vega-dataflow/src/EventStream.js +++ /dev/null @@ -1,124 +0,0 @@ -import UniqueList from './util/UniqueList'; -import {debounce, id, identity, truthy} from 'vega-util'; - -var STREAM_ID = 0; - -/** - * Models an event stream. - * @constructor - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @param {function(Object)} [receive] - Event callback function to invoke - * upon receipt of a new event. Use to override standard event processing. - */ -export default function EventStream(filter, apply, receive) { - this.id = ++STREAM_ID; - this.value = null; - if (receive) this.receive = receive; - if (filter) this._filter = filter; - if (apply) this._apply = apply; -} - -/** - * Creates a new event stream instance with the provided - * (optional) filter, apply and receive functions. - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @see EventStream - */ -export function stream(filter, apply, receive) { - return new EventStream(filter, apply, receive); -} - -var prototype = EventStream.prototype; - -prototype._filter = truthy; - -prototype._apply = identity; - -prototype.targets = function() { - return this._targets || (this._targets = UniqueList(id)); -}; - -prototype.consume = function(_) { - if (!arguments.length) return !!this._consume; - this._consume = !!_; - return this; -}; - -prototype.receive = function(evt) { - if (this._filter(evt)) { - var val = (this.value = this._apply(evt)), - trg = this._targets, - n = trg ? trg.length : 0, - i = 0; - - for (; i pause) { - t = now; - return 1; - } else { - return 0; - } - }); -}; - -prototype.debounce = function(delay) { - var s = stream(); - - this.targets().add(stream(null, null, - debounce(delay, function(e) { - var df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }) - )); - - return s; -}; - -prototype.between = function(a, b) { - var active = false; - a.targets().add(stream(null, null, function() { active = true; })); - b.targets().add(stream(null, null, function() { active = false; })); - return this.filter(function() { return active; }); -}; diff --git a/node_modules/vega-dataflow/src/MultiPulse.js b/node_modules/vega-dataflow/src/MultiPulse.js deleted file mode 100644 index fada42e..0000000 --- a/node_modules/vega-dataflow/src/MultiPulse.js +++ /dev/null @@ -1,105 +0,0 @@ -import Pulse from './Pulse'; -import {error, inherits, isArray} from 'vega-util'; - -/** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array} pulses - The sub-pulses for this multi-pulse. - */ -export default function MultiPulse(dataflow, stamp, pulses, encode) { - var p = this, - c = 0, - pulse, hash, i, n, f; - - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - - for (i=0, n=pulses.length; i= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = isArray(value) ? 1 + value.length : -1; - } - - return o; -}; - -/** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ -prototype.modified = function(name, index) { - var mod = this[CACHE], k; - if (!arguments.length) { - for (k in mod) { if (mod[k]) return true; } - return false; - } else if (isArray(name)) { - for (k=0; k= 0) - ? (index + 1 < mod[name] || !!mod[index + ':' + name]) - : !!mod[name]; -}; - -/** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ -prototype.clear = function() { - this[CACHE] = {}; - return this; -}; diff --git a/node_modules/vega-dataflow/src/Pulse.js b/node_modules/vega-dataflow/src/Pulse.js deleted file mode 100644 index ed20b73..0000000 --- a/node_modules/vega-dataflow/src/Pulse.js +++ /dev/null @@ -1,416 +0,0 @@ -import {tupleid} from './Tuple'; -import {isArray, visitArray} from 'vega-util'; - -/** - * Sentinel value indicating pulse propagation should stop. - */ -export const StopPropagation = {}; - -// Pulse visit type flags -const ADD = (1 << 0), - REM = (1 << 1), - MOD = (1 << 2), - ADD_REM = ADD | REM, - ADD_MOD = ADD | MOD, - ALL = ADD | REM | MOD, - REFLOW = (1 << 3), - SOURCE = (1 << 4), - NO_SOURCE = (1 << 5), - NO_FIELDS = (1 << 6); - -/** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ -export default function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; -} - -const prototype = Pulse.prototype; - -/** - * Sentinel value indicating pulse propagation should stop. - */ -prototype.StopPropagation = StopPropagation; - -/** - * Boolean flag indicating ADD (added) tuples. - */ -prototype.ADD = ADD; - -/** - * Boolean flag indicating REM (removed) tuples. - */ -prototype.REM = REM; - -/** - * Boolean flag indicating MOD (modified) tuples. - */ -prototype.MOD = MOD; - -/** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ -prototype.ADD_REM = ADD_REM; - -/** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ -prototype.ADD_MOD = ADD_MOD; - -/** - * Boolean flag indicating ADD, REM and MOD tuples. - */ -prototype.ALL = ALL; - -/** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ -prototype.REFLOW = REFLOW; - -/** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ -prototype.SOURCE = SOURCE; - -/** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ -prototype.NO_SOURCE = NO_SOURCE; - -/** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ -prototype.NO_FIELDS = NO_FIELDS; - -/** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ -prototype.fork = function(flags) { - return new Pulse(this.dataflow).init(this, flags); -}; - -/** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ -prototype.clone = function() { - const p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); -}; - -/** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ -prototype.addAll = function() { - let p = this; - if (!p.source || p.source.length === p.add.length) { - return p; - } else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - return p; - } -}; - -/** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ -prototype.init = function(src, flags) { - const p = this; - p.stamp = src.stamp; - p.encode = src.encode; - - if (src.fields && !(flags & NO_FIELDS)) { - p.fields = src.fields; - } - - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - - return p; -}; - -/** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ -prototype.runAfter = function(func) { - this.dataflow.runAfter(func); -}; - -/** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ -prototype.changed = function(flags) { - var f = flags || ALL; - return ((f & ADD) && this.add.length) - || ((f & REM) && this.rem.length) - || ((f & MOD) && this.mod.length); -}; - -/** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ -prototype.reflow = function(fork) { - if (fork) return this.fork(ALL).reflow(); - - var len = this.add.length, - src = this.source && this.source.length; - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); - } - return this; -}; - -/** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ -prototype.clean = function(value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else { - return this.cleans; - } -}; - -/** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ -prototype.modifies = function(_) { - var hash = this.fields || (this.fields = {}); - if (isArray(_)) { - _.forEach(f => hash[f] = true); - } else { - hash[_] = true; - } - return this; -}; - -/** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ -prototype.modified = function(_, nomod) { - var fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false - : !arguments.length ? !!fields - : isArray(_) ? _.some(f => fields[f]) - : fields[_]; -}; - -/** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ -prototype.filter = function(flags, filter) { - var p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; -}; - -function addFilter(a, b) { - return a - ? (t, i) => a(t, i) && b(t, i) - : b; -} - -/** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ -prototype.materialize = function(flags) { - flags = flags || ALL; - var p = this; - if ((flags & ADD) && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - if ((flags & REM) && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - if ((flags & MOD) && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - if ((flags & SOURCE) && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - return p; -}; - -function materialize(data, filter) { - var out = []; - visitArray(data, filter, _ => out.push(_)); - return out; -} - -function filter(pulse, flags) { - var map = {}; - pulse.visit(flags, function(t) { map[tupleid(t)] = 1; }); - return t => map[tupleid(t)] ? null : t; -} - -/** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ -prototype.visit = function(flags, visitor) { - var p = this, v = visitor, src, sum; - - if (flags & SOURCE) { - visitArray(p.source, p.srcF, v); - return p; - } - - if (flags & ADD) visitArray(p.add, p.addF, v); - if (flags & REM) visitArray(p.rem, p.remF, v); - if (flags & MOD) visitArray(p.mod, p.modF, v); - - if ((flags & REFLOW) && (src = p.source)) { - sum = p.add.length + p.mod.length; - if (sum === src.length) { - // do nothing - } else if (sum) { - visitArray(src, filter(p, ADD_MOD), v); - } else { - // if no add/rem/mod tuples, visit source - visitArray(src, p.srcF, v); - } - } - - return p; -}; diff --git a/node_modules/vega-dataflow/src/Transform.js b/node_modules/vega-dataflow/src/Transform.js deleted file mode 100644 index 526f79a..0000000 --- a/node_modules/vega-dataflow/src/Transform.js +++ /dev/null @@ -1,68 +0,0 @@ -import Operator from './Operator'; -import {inherits} from 'vega-util'; - -/** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ -export default function Transform(init, params) { - Operator.call(this, init, null, params); -} - -var prototype = inherits(Transform, Operator); - -/** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ -prototype.run = function(pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - - var rv; - if (this.skip()) { - this.skip(false); - } else { - rv = this.evaluate(pulse); - } - rv = rv || pulse; - - if (rv.then) { - rv = rv.then(_ => this.pulse =_); - } else if (rv !== pulse.StopPropagation) { - this.pulse = rv; - } - - return rv; -}; - -/** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ -prototype.evaluate = function(pulse) { - var params = this.marshall(pulse.stamp), - out = this.transform(params, pulse); - params.clear(); - return out; -}; - -/** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ -prototype.transform = function() {}; diff --git a/node_modules/vega-dataflow/src/Tuple.js b/node_modules/vega-dataflow/src/Tuple.js deleted file mode 100644 index c7836fc..0000000 --- a/node_modules/vega-dataflow/src/Tuple.js +++ /dev/null @@ -1,95 +0,0 @@ -var TUPLE_ID_KEY = Symbol('vega_id'), - TUPLE_ID = 1; - -/** - * Resets the internal tuple id counter to one. - */ -export function reset() { - TUPLE_ID = 1; -} - -/** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ -export function isTuple(t) { - return !!(t && tupleid(t)); -} - -/** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ -export function tupleid(t) { - return t[TUPLE_ID_KEY]; -} - -/** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ -function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; -} - -/** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ -export function ingest(datum) { - var t = (datum === Object(datum)) ? datum : {data: datum}; - return tupleid(t) ? t : setid(t, TUPLE_ID++); -} - -/** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ -export function derive(t) { - return rederive(t, ingest({})); -} - -/** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ -export function rederive(t, d) { - for (var k in t) d[k] = t[k]; - return d; -} - -/** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ -export function replace(t, d) { - return setid(d, tupleid(t)); -} - -/** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ -export function stableCompare(cmp, f) { - return !cmp ? null - : f ? (a, b) => cmp(a, b) || (tupleid(f(a)) - tupleid(f(b))) - : (a, b) => cmp(a, b) || (tupleid(a) - tupleid(b)); -} diff --git a/node_modules/vega-dataflow/src/dataflow/Dataflow.js b/node_modules/vega-dataflow/src/dataflow/Dataflow.js deleted file mode 100644 index af6f6da..0000000 --- a/node_modules/vega-dataflow/src/dataflow/Dataflow.js +++ /dev/null @@ -1,189 +0,0 @@ -import add from './add'; -import connect from './connect'; -import events from './events'; -import {ingest, parse, preload, request} from './load'; -import on from './on'; -import {rank, rerank} from './rank'; -import {enqueue, evaluate, getPulse, run, runAfter, runAsync} from './run'; -import {pulse, touch, update} from './update'; -import changeset from '../ChangeSet'; -import Heap from '../util/Heap'; -import UniqueList from '../util/UniqueList'; -import {defaultLocale} from 'vega-format'; -import {loader} from 'vega-loader'; -import {Error, id, logger} from 'vega-util'; - -/** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ -export default function Dataflow() { - this.logger(logger()); - this.logLevel(Error); - - this._clock = 0; - this._rank = 0; - this._locale = defaultLocale(); - try { - this._loader = loader(); - } catch (e) { - // do nothing if loader module is unavailable - } - - this._touched = UniqueList(id); - this._input = {}; - this._pulse = null; - - this._heap = Heap((a, b) => a.qrank - b.qrank); - this._postrun = []; -} - -var prototype = Dataflow.prototype; - -/** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ -prototype.stamp = function() { - return this._clock; -}; - -/** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ -prototype.loader = function(_) { - if (arguments.length) { - this._loader = _; - return this; - } else { - return this._loader; - } -}; - -/** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ -prototype.locale = function(_) { - if (arguments.length) { - this._locale = _; - return this; - } else { - return this._locale; - } -}; - -/** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ -prototype.cleanThreshold = 1e4; - -// OPERATOR REGISTRATION -prototype.add = add; -prototype.connect = connect; -prototype.rank = rank; -prototype.rerank = rerank; - -// OPERATOR UPDATES -prototype.pulse = pulse; -prototype.touch = touch; -prototype.update = update; -prototype.changeset = changeset; - -// DATA LOADING -prototype.ingest = ingest; -prototype.parse = parse; -prototype.preload = preload; -prototype.request = request; - -// EVENT HANDLING -prototype.events = events; -prototype.on = on; - -// PULSE PROPAGATION -prototype.evaluate = evaluate; -prototype.run = run; -prototype.runAsync = runAsync; -prototype.runAfter = runAfter; -prototype._enqueue = enqueue; -prototype._getPulse = getPulse; - -// LOGGING AND ERROR HANDLING - -function logMethod(method) { - return function() { - return this._log[method].apply(this, arguments); - }; -} - -/** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ -prototype.logger = function(logger) { - if (arguments.length) { - this._log = logger; - return this; - } else { - return this._log; - } -}; - -/** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ -prototype.error = logMethod('error'); - -/** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ -prototype.warn = logMethod('warn'); - -/** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ -prototype.info = logMethod('info'); - -/** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ -prototype.debug = logMethod('debug'); - -/** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ -prototype.logLevel = logMethod('level'); diff --git a/node_modules/vega-dataflow/src/dataflow/add.js b/node_modules/vega-dataflow/src/dataflow/add.js deleted file mode 100644 index c93a4ec..0000000 --- a/node_modules/vega-dataflow/src/dataflow/add.js +++ /dev/null @@ -1,44 +0,0 @@ -import Operator from '../Operator'; -import {isFunction} from 'vega-util'; - -/** - * Add an operator to the dataflow graph. This function accepts a - * variety of input argument types. The basic signature supports an - * initial value, update function and parameters. If the first parameter - * is an Operator instance, it will be added directly. If it is a - * constructor for an Operator subclass, a new instance will be instantiated. - * Otherwise, if the first parameter is a function instance, it will be used - * as the update function and a null initial value is assumed. - * @param {*} init - One of: the operator to add, the initial value of - * the operator, an operator class to instantiate, or an update function. - * @param {function} [update] - The operator update function. - * @param {object} [params] - The operator parameters. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @return {Operator} - The added operator. - */ -export default function(init, update, params, react) { - var shift = 1, - op; - - if (init instanceof Operator) { - op = init; - } else if (init && init.prototype instanceof Operator) { - op = new init(); - } else if (isFunction(init)) { - op = new Operator(null, init); - } else { - shift = 0; - op = new Operator(init, update); - } - - this.rank(op); - if (shift) { - react = params; - params = update; - } - if (params) this.connect(op, op.parameters(params, react)); - this.touch(op); - - return op; -} diff --git a/node_modules/vega-dataflow/src/dataflow/connect.js b/node_modules/vega-dataflow/src/dataflow/connect.js deleted file mode 100644 index fb45ef5..0000000 --- a/node_modules/vega-dataflow/src/dataflow/connect.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Connect a target operator as a dependent of source operators. - * If necessary, this method will rerank the target operator and its - * dependents to ensure propagation proceeds in a topologically sorted order. - * @param {Operator} target - The target operator. - * @param {Array} - The source operators that should propagate - * to the target operator. - */ -export default function(target, sources) { - var targetRank = target.rank, i, n; - - for (i=0, n=sources.length; i df.touch(target(e)); - } else if (isFunction(update)) { - op = new Operator(null, update, params, false); - func = e => { - op.evaluate(e); - const t = target(e), v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else { - func = e => df.update(target(e), update, opt); - } - - stream.apply(func); -} - -function onOperator(df, source, target, update, params, options) { - if (update === undefined) { - source.targets().add(target); - } else { - const opt = options || {}, - op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - source.targets().add(op); // add dependency - - if (target) { - op.skip(true); // skip first invocation - op.value = target.value; // initialize value - op.targets().add(target); // chain dependencies - df.connect(target, [op]); // rerank as needed, #1672 - } - } -} - -function updater(target, update) { - update = isFunction(update) ? update : constant(update); - return target - ? function(_, pulse) { - const value = update(_, pulse); - if (!target.skip()) { - target.skip(value !== this.value).value = value; - } - return value; - } - : update; -} diff --git a/node_modules/vega-dataflow/src/dataflow/rank.js b/node_modules/vega-dataflow/src/dataflow/rank.js deleted file mode 100644 index 41b0f89..0000000 --- a/node_modules/vega-dataflow/src/dataflow/rank.js +++ /dev/null @@ -1,31 +0,0 @@ -import {error} from 'vega-util'; - -/** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ -export function rank(op) { - op.rank = ++this._rank; -} - -/** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ -export function rerank(op) { - var queue = [op], - cur, list, i; - - while (queue.length) { - this.rank(cur = queue.pop()); - if (list = cur._targets) { - for (i=list.length; --i >= 0;) { - queue.push(cur = list[i]); - if (cur === op) error('Cycle detected in dataflow graph.'); - } - } - } -} diff --git a/node_modules/vega-dataflow/src/dataflow/run.js b/node_modules/vega-dataflow/src/dataflow/run.js deleted file mode 100644 index 3885146..0000000 --- a/node_modules/vega-dataflow/src/dataflow/run.js +++ /dev/null @@ -1,276 +0,0 @@ -/* eslint-disable require-atomic-updates */ -import {default as Pulse, StopPropagation} from '../Pulse'; -import MultiPulse from '../MultiPulse'; -import asyncCallback from '../util/asyncCallback'; -import UniqueList from '../util/UniqueList'; -import {id, isArray} from 'vega-util'; - -/** - * Evaluates the dataflow and returns a Promise that resolves when pulse - * propagation completes. This method will increment the current timestamp - * and process all updated, pulsed and touched operators. When invoked for - * the first time, all registered operators will be processed. This method - * should not be invoked by third-party clients, use {@link runAsync} or - * {@link run} instead. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ -export async function evaluate(encode, prerun, postrun) { - const df = this, - async = []; - - // if the pulse value is set, this is a re-entrant call - if (df._pulse) return reentrant(df); - - // wait for pending datasets to load - if (df._pending) await df._pending; - - // invoke prerun function, if provided - if (prerun) await asyncCallback(df, prerun); - - // exit early if there are no updates - if (!df._touched.length) { - df.debug('Dataflow invoked, but nothing to do.'); - return df; - } - - // increment timestamp clock - const stamp = ++df._clock; - - // set the current pulse - df._pulse = new Pulse(df, stamp, encode); - - // initialize priority queue, reset touched operators - df._touched.forEach(op => df._enqueue(op, true)); - df._touched = UniqueList(id); - - let count = 0, op, next, error; - - try { - while (df._heap.size() > 0) { - // dequeue operator with highest priority - op = df._heap.pop(); - - // re-queue if rank changed - if (op.rank !== op.qrank) { - df._enqueue(op, true); - continue; - } - - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - - if (next.then) { - // await if operator returns a promise directly - next = await next; - } else if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach(op => df._enqueue(op)); - } - - // increment visit counter - ++count; - } - } catch (err) { - df._heap.clear(); - error = err; - } - - // reset pulse map - df._input = {}; - df._pulse = null; - - df.debug(`Pulse ${stamp}: ${count} operators`); - - if (error) { - df._postrun = []; - df.error(error); - } - - // invoke callbacks queued via runAfter - if (df._postrun.length) { - const pr = df._postrun.sort((a, b) => b.priority - a.priority); - df._postrun = []; - for (let i=0; i df.runAsync(null, () => { - cb.forEach(f => { try { f(df); } catch (err) { df.error(err); } }); - })); - } - - return df; -} - -/** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ -export async function runAsync(encode, prerun, postrun) { - // await previously queued functions - while (this._running) await this._running; - - // run dataflow, manage running promise - const clear = () => this._running = null; - (this._running = this.evaluate(encode, prerun, postrun)) - .then(clear, clear); - - return this._running; -} - -/** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ -export function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) - : (this.evaluate(encode, prerun, postrun), this); -} - -/** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ -export function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) { - // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - } else { - // pulse propagation already complete, invoke immediately - try { callback(this); } catch (err) { this.error(err); } - } -} - -/** - * Raise an error for re-entrant dataflow evaluation. - */ -function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; -} - -/** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ -export function enqueue(op, force) { - var q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - if (q || force) { - op.qrank = op.rank; - this._heap.push(op); - } -} - -/** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ -export function getPulse(op, encode) { - var s = op.source, - stamp = this._clock; - - return s && isArray(s) - ? new MultiPulse(this, stamp, s.map(_ => _.pulse), encode) - : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); -} - -function singlePulse(p, s) { - if (s && s.stamp === p.stamp) { - return s; - } - - p = p.fork(); - if (s && s !== StopPropagation) { - p.source = s.source; - } - return p; -} diff --git a/node_modules/vega-dataflow/src/dataflow/update.js b/node_modules/vega-dataflow/src/dataflow/update.js deleted file mode 100644 index ab74ce5..0000000 --- a/node_modules/vega-dataflow/src/dataflow/update.js +++ /dev/null @@ -1,73 +0,0 @@ -import Pulse from '../Pulse'; - -var NO_OPT = {skip: false, force: false}; - -/** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ -export function touch(op, options) { - var opt = options || NO_OPT; - if (this._pulse) { - // if in midst of propagation, add to priority queue - this._enqueue(op); - } else { - // otherwise, queue for next propagation - this._touched.add(op); - } - if (opt.skip) op.skip(true); - return this; -} - -/** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ -export function update(op, value, options) { - var opt = options || NO_OPT; - if (op.set(value) || opt.force) { - this.touch(op, opt); - } - return this; -} - -/** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ -export function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - - var p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), - t = op.pulse && op.pulse.source || []; - - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - - return this; -} diff --git a/node_modules/vega-dataflow/src/register.js b/node_modules/vega-dataflow/src/register.js deleted file mode 100644 index 13660ca..0000000 --- a/node_modules/vega-dataflow/src/register.js +++ /dev/null @@ -1,13 +0,0 @@ -import {hasOwnProperty} from 'vega-util'; - -export var transforms = {}; - -export function definition(type) { - var t = transform(type); - return t && t.Definition || null; -} - -export function transform(type) { - type = type && type.toLowerCase(); - return hasOwnProperty(transforms, type) ? transforms[type] : null; -} diff --git a/node_modules/vega-dataflow/src/util/Heap.js b/node_modules/vega-dataflow/src/util/Heap.js deleted file mode 100644 index a26a182..0000000 --- a/node_modules/vega-dataflow/src/util/Heap.js +++ /dev/null @@ -1,59 +0,0 @@ -export default function Heap(cmp) { - var nodes = []; - return { - clear: () => nodes = [], - size: () => nodes.length, - peek: () => nodes[0], - push: x => { - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: () => { - var last = nodes.pop(), item; - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else { - item = last; - } - return item; - } - }; -} - -function siftdown(array, start, idx, cmp) { - var item, parent, pidx; - - item = array[idx]; - while (idx > start) { - pidx = (idx - 1) >> 1; - parent = array[pidx]; - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - break; - } - return (array[idx] = item); -} - -function siftup(array, idx, cmp) { - var start = idx, - end = array.length, - item = array[idx], - cidx = (idx << 1) + 1, ridx; - - while (cidx < end) { - ridx = cidx + 1; - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) { - cidx = ridx; - } - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - array[idx] = item; - return siftdown(array, start, idx, cmp); -} diff --git a/node_modules/vega-dataflow/src/util/UniqueList.js b/node_modules/vega-dataflow/src/util/UniqueList.js deleted file mode 100644 index 477786f..0000000 --- a/node_modules/vega-dataflow/src/util/UniqueList.js +++ /dev/null @@ -1,29 +0,0 @@ -import {identity} from 'vega-util'; - -export default function UniqueList(idFunc) { - var $ = idFunc || identity, - list = [], - ids = {}; - - list.add = function(_) { - var id = $(_); - if (!ids[id]) { - ids[id] = 1; - list.push(_); - } - return list; - }; - - list.remove = function(_) { - var id = $(_), idx; - if (ids[id]) { - ids[id] = 0; - if ((idx = list.indexOf(_)) >= 0) { - list.splice(idx, 1); - } - } - return list; - }; - - return list; -} diff --git a/node_modules/vega-dataflow/src/util/asyncCallback.js b/node_modules/vega-dataflow/src/util/asyncCallback.js deleted file mode 100644 index 537cbf8..0000000 --- a/node_modules/vega-dataflow/src/util/asyncCallback.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ -export default async function(df, callback) { - try { await callback(df); } catch (err) { df.error(err); } -} diff --git a/node_modules/vega-encode/LICENSE b/node_modules/vega-encode/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-encode/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-encode/README.md b/node_modules/vega-encode/README.md deleted file mode 100644 index 6ae4af8..0000000 --- a/node_modules/vega-encode/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# vega-encode - -Visual encoding transforms for Vega dataflows. - -This package provides the following Vega data transforms: - -- [**LinkPath**](https://vega.github.io/vega/docs/transforms/linkpath/) [<>](https://github.com/vega/vega/blob/master/packages/vega-encode/src/LinkPath.js "Source") -- [**Pie**](https://vega.github.io/vega/docs/transforms/pie/) [<>](https://github.com/vega/vega/blob/master/packages/vega-encode/src/Pie.js "Source") -- [**Stack**](https://vega.github.io/vega/docs/transforms/stack/) [<>](https://github.com/vega/vega/blob/master/packages/vega-encode/src/Stack.js "Source") - -And provides the following internal transforms: - -- **AxisTicks** [<>](https://github.com/vega/vega/blob/master/packages/vega-encode/src/AxisTicks.js "Source") -- **DataJoin** [<>](https://github.com/vega/vega/blob/master/packages/vega-encode/src/DataJoin.js "Source") -- **Encode** [<>](https://github.com/vega/vega/blob/master/packages/vega-encode/src/Encode.js "Source") -- **LegendEntries** [<>](https://github.com/vega/vega/blob/master/packages/vega-encode/src/LegendEntries.js "Source") -- **Scale** [<>](https://github.com/vega/vega/blob/master/packages/vega-encode/src/Scale.js "Source") diff --git a/node_modules/vega-encode/build/vega-encode.js b/node_modules/vega-encode/build/vega-encode.js deleted file mode 100644 index fd07c52..0000000 --- a/node_modules/vega-encode/build/vega-encode.js +++ /dev/null @@ -1,1075 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-dataflow'), require('vega-scale'), require('vega-util'), require('d3-array'), require('d3-interpolate')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-dataflow', 'vega-scale', 'vega-util', 'd3-array', 'd3-interpolate'], factory) : - (global = global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.vega, global.vega, global.vega, global.d3, global.d3)); -}(this, (function (exports, vegaDataflow, vegaScale, vegaUtil, d3Array, d3Interpolate) { 'use strict'; - - /** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - function AxisTicks(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype = vegaUtil.inherits(AxisTicks, vegaDataflow.Transform); - - prototype.transform = function(_, pulse) { - if (this.value && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - ticks = this.value, - scale = _.scale, - tally = _.count == null ? (_.values ? _.values.length : 10) : _.count, - count = vegaScale.tickCount(scale, tally, _.minstep), - format = _.format || vegaScale.tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), - values = _.values ? vegaScale.validTicks(scale, _.values, count) : vegaScale.tickValues(scale, count); - - if (ticks) out.rem = ticks; - - ticks = values.map(function(value, i) { - return vegaDataflow.ingest({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - }); - }); - - if (_.extra && ticks.length) { - // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push(vegaDataflow.ingest({ - index: -1, - extra: {value: ticks[0].value}, - label: '' - })); - } - - out.source = ticks; - out.add = ticks; - this.value = ticks; - - return out; - }; - - /** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ - function DataJoin(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype$1 = vegaUtil.inherits(DataJoin, vegaDataflow.Transform); - - function defaultItemCreate() { - return vegaDataflow.ingest({}); - } - - function newMap(key) { - const map = vegaUtil.fastmap().test(t => t.exit); - map.lookup = t => map.get(key(t)); - return map; - } - - prototype$1.transform = function(_, pulse) { - var df = pulse.dataflow, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - item = _.item || defaultItemCreate, - key = _.key || vegaDataflow.tupleid, - map = this.value; - - // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - if (vegaUtil.isArray(out.encode)) { - out.encode = null; - } - - if (map && (_.modified('key') || pulse.modified(key))) { - vegaUtil.error('DataJoin does not support modified key function or fields.'); - } - - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - - pulse.visit(pulse.ADD, t => { - const k = key(t); - let x = map.get(k); - - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else { - out.mod.push(x); - } - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - - x.datum = t; - x.exit = false; - }); - - pulse.visit(pulse.MOD, t => { - const k = key(t), - x = map.get(k); - - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - - pulse.visit(pulse.REM, t => { - const k = key(t), - x = map.get(k); - - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) { - df.runAfter(map.clean); - } - - return out; - }; - - /** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ - function Encode(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype$2 = vegaUtil.inherits(Encode, vegaDataflow.Transform); - - prototype$2.transform = function(_, pulse) { - var out = pulse.fork(pulse.ADD_REM), - fmod = _.mod || false, - encoders = _.encoders, - encode = pulse.encode; - - // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - if (vegaUtil.isArray(encode)) { - if (out.changed() || encode.every(function(e) { return encoders[e]; })) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else { - return pulse.StopPropagation; - } - } - - // marshall encoder functions - var reenter = encode === 'enter', - update = encoders.update || vegaUtil.falsy, - enter = encoders.enter || vegaUtil.falsy, - exit = encoders.exit || vegaUtil.falsy, - set = (encode && !reenter ? encoders[encode] : update) || vegaUtil.falsy; - - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, function(t) { enter(t, _); update(t, _); }); - out.modifies(enter.output); - out.modifies(update.output); - if (set !== vegaUtil.falsy && set !== update) { - pulse.visit(pulse.ADD, function(t) { set(t, _); }); - out.modifies(set.output); - } - } - - if (pulse.changed(pulse.REM) && exit !== vegaUtil.falsy) { - pulse.visit(pulse.REM, function(t) { exit(t, _); }); - out.modifies(exit.output); - } - - if (reenter || set !== vegaUtil.falsy) { - var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - if (reenter) { - pulse.visit(flag, function(t) { - var mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else { - pulse.visit(flag, function(t) { - if (set(t, _) || fmod) out.mod.push(t); - }); - } - if (out.mod.length) out.modifies(set.output); - } - - return out.changed() ? out : pulse.StopPropagation; - }; - - /** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - function LegendEntries(params) { - vegaDataflow.Transform.call(this, [], params); - } - - var prototype$3 = vegaUtil.inherits(LegendEntries, vegaDataflow.Transform); - - prototype$3.transform = function(_, pulse) { - if (this.value != null && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - items = this.value, - type = _.type || vegaScale.SymbolLegend, - scale = _.scale, - limit = +_.limit, - count = vegaScale.tickCount(scale, _.count == null ? 5 : _.count, _.minstep), - lskip = !!_.values || type === vegaScale.SymbolLegend, - format = _.format || vegaScale.labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), - values = _.values || vegaScale.labelValues(scale, count), - domain, fraction, size, offset, ellipsis; - - if (items) out.rem = items; - - if (type === vegaScale.SymbolLegend) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else { - items = values; - } - - if (vegaUtil.isFunction(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) { - items = items.slice(1); - } - // compute size offset for legend entries - offset = items.reduce(function(max, value) { - return Math.max(max, size(value, _)); - }, 0); - } else { - size = vegaUtil.constant(offset = size || 8); - } - - items = items.map(function(value, index) { - return vegaDataflow.ingest({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - }); - }); - - if (ellipsis) { - ellipsis = values[items.length]; - items.push(vegaDataflow.ingest({ - index: items.length, - label: `\u2026${values.length-items.length} entries`, - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } - - else if (type === vegaScale.GradientLegend) { - domain = scale.domain(), - fraction = vegaScale.scaleFraction(scale, domain[0], vegaUtil.peek(domain)); - - // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - if (values.length < 3 && !_.values && domain[0] !== vegaUtil.peek(domain)) { - values = [domain[0], vegaUtil.peek(domain)]; - } - - items = values.map(function(value, index) { - return vegaDataflow.ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - }); - }); - } - - else { - size = values.length - 1; - fraction = vegaScale.labelFraction(scale); - - items = values.map(function(value, index) { - return vegaDataflow.ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index+1]) - }); - }); - } - - out.source = items; - out.add = items; - this.value = items; - - return out; - }; - - var Paths = vegaUtil.fastmap({ - 'line': line, - 'line-radial': lineR, - 'arc': arc, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR - }); - - function sourceX(t) { return t.source.x; } - function sourceY(t) { return t.source.y; } - function targetX(t) { return t.target.x; } - function targetY(t) { return t.target.y; } - - /** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ - function LinkPath(params) { - vegaDataflow.Transform.call(this, {}, params); - } - - LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sourceX', 'type': 'field', 'default': 'source.x' }, - { 'name': 'sourceY', 'type': 'field', 'default': 'source.y' }, - { 'name': 'targetX', 'type': 'field', 'default': 'target.x' }, - { 'name': 'targetY', 'type': 'field', 'default': 'target.y' }, - { 'name': 'orient', 'type': 'enum', 'default': 'vertical', - 'values': ['horizontal', 'vertical', 'radial'] }, - { 'name': 'shape', 'type': 'enum', 'default': 'line', - 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal'] }, - { 'name': 'require', 'type': 'signal' }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] - }; - - var prototype$4 = vegaUtil.inherits(LinkPath, vegaDataflow.Transform); - - prototype$4.transform = function(_, pulse) { - var sx = _.sourceX || sourceX, - sy = _.sourceY || sourceY, - tx = _.targetX || targetX, - ty = _.targetY || targetY, - as = _.as || 'path', - orient = _.orient || 'vertical', - shape = _.shape || 'line', - path = Paths.get(shape + '-' + orient) || Paths.get(shape); - - if (!path) { - vegaUtil.error('LinkPath unsupported type: ' + _.shape - + (_.orient ? '-' + _.orient : '')); - } - - pulse.visit(pulse.SOURCE, function(t) { - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - - return pulse.reflow(_.modified()).modifies(as); - }; - - // -- Link Path Generation Methods ----- - - function line(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'L' + tx + ',' + ty; - } - - function lineR(sa, sr, ta, tr) { - return line( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); - } - - function arc(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - rr = Math.sqrt(dx * dx + dy * dy) / 2, - ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + - 'A' + rr + ',' + rr + - ' ' + ra + ' 0 1' + - ' ' + tx + ',' + ty; - } - - function arcR(sa, sr, ta, tr) { - return arc( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); - } - - function curve(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - ix = 0.2 * (dx + dy), - iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + - 'C' + (sx+ix) + ',' + (sy+iy) + - ' ' + (tx+iy) + ',' + (ty-ix) + - ' ' + tx + ',' + ty; - } - - function curveR(sa, sr, ta, tr) { - return curve( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); - } - - function orthoX(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'V' + ty + 'H' + tx; - } - - function orthoY(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'H' + tx + 'V' + ty; - } - - function orthoR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'A' + sr + ',' + sr + ' 0 0,' + (sf?1:0) + - ' ' + (sr*tc) + ',' + (sr*ts) + - 'L' + (tr*tc) + ',' + (tr*ts); - } - - function diagonalX(sx, sy, tx, ty) { - var m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + - 'C' + m + ',' + sy + - ' ' + m + ',' + ty + - ' ' + tx + ',' + ty; - } - - function diagonalY(sx, sy, tx, ty) { - var m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + - 'C' + sx + ',' + m + - ' ' + tx + ',' + m + - ' ' + tx + ',' + ty; - } - - function diagonalR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - mr = (sr + tr) / 2; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'C' + (mr*sc) + ',' + (mr*ss) + - ' ' + (mr*tc) + ',' + (mr*ts) + - ' ' + (tr*tc) + ',' + (tr*ts); - } - - /** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ - function Pie(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Pie.Definition = { - 'type': 'Pie', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'startAngle', 'type': 'number', 'default': 0 }, - { 'name': 'endAngle', 'type': 'number', 'default': 6.283185307179586 }, - { 'name': 'sort', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['startAngle', 'endAngle'] } - ] - }; - - var prototype$5 = vegaUtil.inherits(Pie, vegaDataflow.Transform); - - prototype$5.transform = function(_, pulse) { - var as = _.as || ['startAngle', 'endAngle'], - startAngle = as[0], - endAngle = as[1], - field = _.field || vegaUtil.one, - start = _.startAngle || 0, - stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, - data = pulse.source, - values = data.map(field), - n = values.length, - a = start, - k = (stop - start) / d3Array.sum(values), - index = d3Array.range(n), - i, t, v; - - if (_.sort) { - index.sort(function(a, b) { - return values[a] - values[b]; - }); - } - - for (i=0; i -1) return raw; - - var domain = _.domain, - type = scale.type, - zero = _.zero || (_.zero === undefined && includeZero(scale)), - n, mid; - - if (!domain) return 0; - - // adjust continuous domain for minimum pixel padding - if (includePad(type) && _.padding && domain[0] !== vegaUtil.peek(domain)) { - domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - } - - // adjust domain based on zero, min, max settings - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = ((domain = domain.slice()).length - 1) || 1; - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - - if (_.domainMid != null) { - mid = _.domainMid; - const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } - - // set the scale domain - scale.domain(domainCheck(type, domain, df)); - - // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - if (type === vegaScale.Ordinal) { - scale.unknown(_.domainImplicit ? vegaScale.scaleImplicit : undefined); - } - - // perform 'nice' adjustment as requested - if (_.nice && scale.nice) { - scale.nice((_.nice !== true && vegaScale.tickCount(scale, _.nice)) || null); - } - - // return the cardinality of the domain - return domain.length; - } - - function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else { - return -1; - } - } - - function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs(vegaUtil.peek(range) - range[0]), - frac = span / (span - 2 * pad), - d = type === vegaScale.Log ? vegaUtil.zoomLog(domain, null, frac) - : type === vegaScale.Sqrt ? vegaUtil.zoomPow(domain, null, frac, 0.5) - : type === vegaScale.Pow ? vegaUtil.zoomPow(domain, null, frac, exponent || 1) - : type === vegaScale.Symlog ? vegaUtil.zoomSymlog(domain, null, frac, constant || 1) - : vegaUtil.zoomLinear(domain, null, frac); - - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length-1] = d[1]; - return domain; - } - - function domainCheck(type, domain, df) { - if (vegaScale.isLogarithmic(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce(function(s, v) { - return s + (v < 0 ? -1 : v > 0 ? 1 : 0); - }, 0)); - - if (s !== domain.length) { - df.warn('Log scale domain includes zero: ' + vegaUtil.stringValue(domain)); - } - } - return domain; - } - - function configureBins(scale, _, count) { - let bins = _.bins; - - if (bins && !vegaUtil.isArray(bins)) { - // generate bin boundary array - let domain = scale.domain(), - lo = domain[0], - hi = vegaUtil.peek(domain), - start = bins.start == null ? lo : bins.start, - stop = bins.stop == null ? hi : bins.stop, - step = bins.step; - - if (!step) vegaUtil.error('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (stop > hi) stop = step * Math.floor(hi / step); - bins = d3Array.range(start, stop + step / 2, step); - } - - if (bins) { - // assign bin boundaries to scale instance - scale.bins = bins; - } else if (scale.bins) { - // no current bins, remove bins if previously set - delete scale.bins; - } - - // special handling for bin-ordinal scales - if (scale.type === vegaScale.BinOrdinal) { - if (!bins) { - // the domain specifies the bins - scale.bins = scale.domain(); - } else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } - - // return domain cardinality - return count; - } - - function configureRange(scale, _, count) { - var type = scale.type, - round = _.round || false, - range = _.range; - - // if range step specified, calculate full range extent - if (_.rangeStep != null) { - range = configureRangeStep(type, _, count); - } - - // else if a range scheme is defined, use that - else if (_.scheme) { - range = configureScheme(type, _, count); - if (vegaUtil.isFunction(range)) { - if (scale.interpolator) { - return scale.interpolator(range); - } else { - vegaUtil.error(`Scale type ${type} does not support interpolating color schemes.`); - } - } - } - - // given a range array for an interpolating scale, convert to interpolator - if (range && vegaScale.isInterpolating(type)) { - return scale.interpolator( - vegaScale.interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma) - ); - } - - // configure rounding / interpolation - if (range && _.interpolate && scale.interpolate) { - scale.interpolate(vegaScale.interpolate(_.interpolate, _.interpolateGamma)); - } else if (vegaUtil.isFunction(scale.round)) { - scale.round(round); - } else if (vegaUtil.isFunction(scale.rangeRound)) { - scale.interpolate(round ? d3Interpolate.interpolateRound : d3Interpolate.interpolate); - } - - if (range) scale.range(flip(range, _.reverse)); - } - - function configureRangeStep(type, _, count) { - if (type !== vegaScale.Band && type !== vegaScale.Point) { - vegaUtil.error('Only band and point scales support rangeStep.'); - } - - // calculate full range based on requested step size and padding - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, - inner = type === vegaScale.Point ? 1 - : ((_.paddingInner != null ? _.paddingInner : _.padding) || 0); - return [0, _.rangeStep * vegaScale.bandSpace(count, inner, outer)]; - } - - function configureScheme(type, _, count) { - var extent = _.schemeExtent, - name, scheme; - - if (vegaUtil.isArray(_.scheme)) { - scheme = vegaScale.interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); - } else { - name = _.scheme.toLowerCase(); - scheme = vegaScale.scheme(name); - if (!scheme) vegaUtil.error(`Unrecognized scheme name: ${_.scheme}`); - } - - // determine size for potential discrete range - count = (type === vegaScale.Threshold) ? count + 1 - : (type === vegaScale.BinOrdinal) ? count - 1 - : (type === vegaScale.Quantile || type === vegaScale.Quantize) ? (+_.schemeCount || DEFAULT_COUNT) - : count; - - // adjust and/or quantize scheme as appropriate - return vegaScale.isInterpolating(type) ? adjustScheme(scheme, extent, _.reverse) - : vegaUtil.isFunction(scheme) ? vegaScale.quantizeInterpolator(adjustScheme(scheme, extent), count) - : type === vegaScale.Ordinal ? scheme : scheme.slice(0, count); - } - - function adjustScheme(scheme, extent, reverse) { - return (vegaUtil.isFunction(scheme) && (extent || reverse)) - ? vegaScale.interpolateRange(scheme, flip(extent || [0, 1], reverse)) - : scheme; - } - - function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; - } - - /** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ - function SortItems(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype$7 = vegaUtil.inherits(SortItems, vegaDataflow.Transform); - - prototype$7.transform = function(_, pulse) { - var mod = _.modified('sort') - || pulse.changed(pulse.ADD) - || pulse.modified(_.sort.fields) - || pulse.modified('datum'); - - if (mod) pulse.source.sort(vegaDataflow.stableCompare(_.sort)); - - this.modified(mod); - return pulse; - }; - - var Zero = 'zero', - Center = 'center', - Normalize = 'normalize', - DefOutput = ['y0', 'y1']; - - /** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ - function Stack(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Stack.Definition = { - 'type': 'Stack', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'offset', 'type': 'enum', 'default': Zero, 'values': [Zero, Center, Normalize] }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': DefOutput } - ] - }; - - var prototype$8 = vegaUtil.inherits(Stack, vegaDataflow.Transform); - - prototype$8.transform = function(_, pulse) { - var as = _.as || DefOutput, - y0 = as[0], - y1 = as[1], - sort = vegaDataflow.stableCompare(_.sort), - field = _.field || vegaUtil.one, - stack = _.offset === Center ? stackCenter - : _.offset === Normalize ? stackNormalize - : stackZero, - groups, i, n, max; - - // partition, sum, and sort the stack groups - groups = partition(pulse.source, _.groupby, sort, field); - - // compute stack layouts per group - for (i=0, n=groups.length, max=groups.max; i max) max = s; - if (sort) g.sort(sort); - } - groups.max = max; - - return groups; - } - - exports.axisticks = AxisTicks; - exports.datajoin = DataJoin; - exports.encode = Encode; - exports.legendentries = LegendEntries; - exports.linkpath = LinkPath; - exports.pie = Pie; - exports.scale = Scale; - exports.sortitems = SortItems; - exports.stack = Stack; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-encode/build/vega-encode.min.js b/node_modules/vega-encode/build/vega-encode.min.js deleted file mode 100644 index 8ae4bbc..0000000 --- a/node_modules/vega-encode/build/vega-encode.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-dataflow"),require("vega-scale"),require("vega-util"),require("d3-array"),require("d3-interpolate")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-scale","vega-util","d3-array","d3-interpolate"],n):n(((e=e||self).vega=e.vega||{},e.vega.transforms={}),e.vega,e.vega,e.vega,e.d3,e.d3)}(this,(function(e,n,t,a,i,r){"use strict";function o(e){n.Transform.call(this,null,e)}function l(e){n.Transform.call(this,null,e)}function s(){return n.ingest({})}function u(e){n.Transform.call(this,null,e)}function d(e){n.Transform.call(this,[],e)}a.inherits(o,n.Transform).transform=function(e,a){if(this.value&&!e.modified())return a.StopPropagation;var i=a.dataflow.locale(),r=a.fork(a.NO_SOURCE|a.NO_FIELDS),o=this.value,l=e.scale,s=null==e.count?e.values?e.values.length:10:e.count,u=t.tickCount(l,s,e.minstep),d=e.format||t.tickFormat(i,l,u,e.formatSpecifier,e.formatType,!!e.values),f=e.values?t.validTicks(l,e.values,u):t.tickValues(l,u);return o&&(r.rem=o),o=f.map((function(e,t){return n.ingest({index:t/(f.length-1||1),value:e,label:d(e)})})),e.extra&&o.length&&o.push(n.ingest({index:-1,extra:{value:o[0].value},label:""})),r.source=o,r.add=o,this.value=o,r},a.inherits(l,n.Transform).transform=function(e,t){var i=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),o=e.item||s,l=e.key||n.tupleid,u=this.value;return a.isArray(r.encode)&&(r.encode=null),u&&(e.modified("key")||t.modified(l))&&a.error("DataJoin does not support modified key function or fields."),u||(t=t.addAll(),this.value=u=function(e){const n=a.fastmap().test(e=>e.exit);return n.lookup=t=>n.get(e(t)),n}(l)),t.visit(t.ADD,e=>{const n=l(e);let t=u.get(n);t?t.exit?(u.empty--,r.add.push(t)):r.mod.push(t):(t=o(e),u.set(n,t),r.add.push(t)),t.datum=e,t.exit=!1}),t.visit(t.MOD,e=>{const n=l(e),t=u.get(n);t&&(t.datum=e,r.mod.push(t))}),t.visit(t.REM,e=>{const n=l(e),t=u.get(n);e!==t.datum||t.exit||(r.rem.push(t),t.exit=!0,++u.empty)}),t.changed(t.ADD_MOD)&&r.modifies("datum"),(t.clean()||e.clean&&u.empty>i.cleanThreshold)&&i.runAfter(u.clean),r},a.inherits(u,n.Transform).transform=function(e,n){var t=n.fork(n.ADD_REM),i=e.mod||!1,r=e.encoders,o=n.encode;if(a.isArray(o)){if(!t.changed()&&!o.every((function(e){return r[e]})))return n.StopPropagation;o=o[0],t.encode=null}var l="enter"===o,s=r.update||a.falsy,u=r.enter||a.falsy,d=r.exit||a.falsy,f=(o&&!l?r[o]:s)||a.falsy;if(n.changed(n.ADD)&&(n.visit(n.ADD,(function(n){u(n,e),s(n,e)})),t.modifies(u.output),t.modifies(s.output),f!==a.falsy&&f!==s&&(n.visit(n.ADD,(function(n){f(n,e)})),t.modifies(f.output))),n.changed(n.REM)&&d!==a.falsy&&(n.visit(n.REM,(function(n){d(n,e)})),t.modifies(d.output)),l||f!==a.falsy){var c=n.MOD|(e.modified()?n.REFLOW:0);l?(n.visit(c,(function(n){var a=u(n,e)||i;(f(n,e)||a)&&t.mod.push(n)})),t.mod.length&&t.modifies(u.output)):n.visit(c,(function(n){(f(n,e)||i)&&t.mod.push(n)})),t.mod.length&&t.modifies(f.output)}return t.changed()?t:n.StopPropagation},a.inherits(d,n.Transform).transform=function(e,i){if(null!=this.value&&!e.modified())return i.StopPropagation;var r,o,l,s,u,d=i.dataflow.locale(),f=i.fork(i.NO_SOURCE|i.NO_FIELDS),c=this.value,m=e.type||t.SymbolLegend,p=e.scale,h=+e.limit,g=t.tickCount(p,null==e.count?5:e.count,e.minstep),v=!!e.values||m===t.SymbolLegend,y=e.format||t.labelFormat(d,p,g,m,e.formatSpecifier,e.formatType,v),M=e.values||t.labelValues(p,g);return c&&(f.rem=c),m===t.SymbolLegend?(h&&M.length>h?(i.dataflow.warn("Symbol legend count exceeds limit, filtering items."),c=M.slice(0,h-1),u=!0):c=M,a.isFunction(l=e.size)?(e.values||0!==p(c[0])||(c=c.slice(1)),s=c.reduce((function(n,t){return Math.max(n,l(t,e))}),0)):l=a.constant(s=l||8),c=c.map((function(t,a){return n.ingest({index:a,label:y(t,a,c),value:t,offset:s,size:l(t,e)})})),u&&(u=M[c.length],c.push(n.ingest({index:c.length,label:`…${M.length-c.length} entries`,value:u,offset:s,size:l(u,e)})))):m===t.GradientLegend?(r=p.domain(),o=t.scaleFraction(p,r[0],a.peek(r)),M.length<3&&!e.values&&r[0]!==a.peek(r)&&(M=[r[0],a.peek(r)]),c=M.map((function(e,t){return n.ingest({index:t,label:y(e,t,M),value:e,perc:o(e)})}))):(l=M.length-1,o=t.labelFraction(p),c=M.map((function(e,t){return n.ingest({index:t,label:y(e,t,M),value:e,perc:t?o(e):0,perc2:t===l?1:o(M[t+1])})}))),f.source=c,f.add=c,this.value=c,f};var f=a.fastmap({line:v,"line-radial":function(e,n,t,a){return v(n*Math.cos(e),n*Math.sin(e),a*Math.cos(t),a*Math.sin(t))},arc:y,"arc-radial":function(e,n,t,a){return y(n*Math.cos(e),n*Math.sin(e),a*Math.cos(t),a*Math.sin(t))},curve:M,"curve-radial":function(e,n,t,a){return M(n*Math.cos(e),n*Math.sin(e),a*Math.cos(t),a*Math.sin(t))},"orthogonal-horizontal":function(e,n,t,a){return"M"+e+","+n+"V"+a+"H"+t},"orthogonal-vertical":function(e,n,t,a){return"M"+e+","+n+"H"+t+"V"+a},"orthogonal-radial":function(e,n,t,a){var i=Math.cos(e),r=Math.sin(e),o=Math.cos(t),l=Math.sin(t),s=Math.abs(t-e)>Math.PI?t<=e:t>e;return"M"+n*i+","+n*r+"A"+n+","+n+" 0 0,"+(s?1:0)+" "+n*o+","+n*l+"L"+a*o+","+a*l},"diagonal-horizontal":function(e,n,t,a){var i=(e+t)/2;return"M"+e+","+n+"C"+i+","+n+" "+i+","+a+" "+t+","+a},"diagonal-vertical":function(e,n,t,a){var i=(n+a)/2;return"M"+e+","+n+"C"+e+","+i+" "+t+","+i+" "+t+","+a},"diagonal-radial":function(e,n,t,a){var i=Math.cos(e),r=Math.sin(e),o=Math.cos(t),l=Math.sin(t),s=(n+a)/2;return"M"+n*i+","+n*r+"C"+s*i+","+s*r+" "+s*o+","+s*l+" "+a*o+","+a*l}});function c(e){return e.source.x}function m(e){return e.source.y}function p(e){return e.target.x}function h(e){return e.target.y}function g(e){n.Transform.call(this,{},e)}function v(e,n,t,a){return"M"+e+","+n+"L"+t+","+a}function y(e,n,t,a){var i=t-e,r=a-n,o=Math.sqrt(i*i+r*r)/2;return"M"+e+","+n+"A"+o+","+o+" "+180*Math.atan2(r,i)/Math.PI+" 0 1 "+t+","+a}function M(e,n,t,a){var i=t-e,r=a-n,o=.2*(i+r),l=.2*(r-i);return"M"+e+","+n+"C"+(e+o)+","+(n+l)+" "+(t+l)+","+(a-o)+" "+t+","+a}function b(e){n.Transform.call(this,null,e)}g.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},a.inherits(g,n.Transform).transform=function(e,n){var t=e.sourceX||c,i=e.sourceY||m,r=e.targetX||p,o=e.targetY||h,l=e.as||"path",s=e.orient||"vertical",u=e.shape||"line",d=f.get(u+"-"+s)||f.get(u);return d||a.error("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),n.visit(n.SOURCE,(function(e){e[l]=d(t(e),i(e),r(e),o(e))})),n.reflow(e.modified()).modifies(l)},b.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},a.inherits(b,n.Transform).transform=function(e,n){var t,r,o,l=e.as||["startAngle","endAngle"],s=l[0],u=l[1],d=e.field||a.one,f=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,m=n.source,p=m.map(d),h=p.length,g=f,v=(c-f)/i.sum(p),y=i.range(h);for(e.sort&&y.sort((function(e,n){return p[e]-p[n]})),t=0;t0?1:0)}),0))!==n.length&&i.warn("Log scale domain includes zero: "+a.stringValue(n)));return n}function w(e,n,i){return a.isFunction(e)&&(n||i)?t.interpolateRange(e,O(n||[0,1],i)):e}function O(e,n){return n?e.slice().reverse():e}function T(e){n.Transform.call(this,null,e)}a.inherits(k,n.Transform).transform=function(e,n){var o=n.dataflow,l=this.value,s=function(e){var n,i=e.type,r="";if(i===t.Sequential)return t.Sequential+"-"+t.Linear;(function(e){const n=e.type;return t.isContinuous(n)&&n!==t.Time&&n!==t.UTC&&(e.scheme||e.range&&e.range.length&&e.range.every(a.isString))})(e)&&(n=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0,r=2===n?t.Sequential+"-":3===n?t.Diverging+"-":"");return(r+i||t.Linear).toLowerCase()}(e);for(s in l&&s===l.type||(this.value=l=t.scale(s)()),e)if(!x[s]){if("padding"===s&&S(l.type))continue;a.isFunction(l[s])?l[s](e[s]):o.warn("Unsupported scale property: "+s)}return function(e,n,i){var o=e.type,l=n.round||!1,s=n.range;if(null!=n.rangeStep)s=function(e,n,i){e!==t.Band&&e!==t.Point&&a.error("Only band and point scales support rangeStep.");var r=(null!=n.paddingOuter?n.paddingOuter:n.padding)||0,o=e===t.Point?1:(null!=n.paddingInner?n.paddingInner:n.padding)||0;return[0,n.rangeStep*t.bandSpace(i,o,r)]}(o,n,i);else if(n.scheme&&(s=function(e,n,i){var r,o,l=n.schemeExtent;a.isArray(n.scheme)?o=t.interpolateColors(n.scheme,n.interpolate,n.interpolateGamma):(r=n.scheme.toLowerCase(),(o=t.scheme(r))||a.error("Unrecognized scheme name: "+n.scheme));return i=e===t.Threshold?i+1:e===t.BinOrdinal?i-1:e===t.Quantile||e===t.Quantize?+n.schemeCount||5:i,t.isInterpolating(e)?w(o,l,n.reverse):a.isFunction(o)?t.quantizeInterpolator(w(o,l),i):e===t.Ordinal?o:o.slice(0,i)}(o,n,i),a.isFunction(s))){if(e.interpolator)return e.interpolator(s);a.error(`Scale type ${o} does not support interpolating color schemes.`)}if(s&&t.isInterpolating(o))return e.interpolator(t.interpolateColors(O(s,n.reverse),n.interpolate,n.interpolateGamma));s&&n.interpolate&&e.interpolate?e.interpolate(t.interpolate(n.interpolate,n.interpolateGamma)):a.isFunction(e.round)?e.round(l):a.isFunction(e.rangeRound)&&e.interpolate(l?r.interpolateRound:r.interpolate);s&&e.range(O(s,n.reverse))}(l,e,function(e,n,r){let o=n.bins;if(o&&!a.isArray(o)){let n=e.domain(),t=n[0],r=a.peek(n),l=null==o.start?t:o.start,s=null==o.stop?r:o.stop,u=o.step;u||a.error("Scale bins parameter missing step property."),lr&&(s=u*Math.floor(r/u)),o=i.range(l,s+u/2,u)}o?e.bins=o:e.bins&&delete e.bins;e.type===t.BinOrdinal&&(o?n.domain||n.domainRaw||(e.domain(o),r=o.length):e.bins=e.domain());return r}(l,e,function(e,n,i){var r=function(e,n,t){return n?(e.domain(D(e.type,n,t)),n.length):-1}(e,n.domainRaw,i);if(r>-1)return r;var o,l,s=n.domain,u=e.type,d=n.zero||void 0===n.zero&&function(e){const n=e.type;return!e.bins&&(n===t.Linear||n===t.Pow||n===t.Sqrt)}(e);if(!s)return 0;S(u)&&n.padding&&s[0]!==a.peek(s)&&(s=function(e,n,i,r,o,l){var s=Math.abs(a.peek(i)-i[0]),u=s/(s-2*r),d=e===t.Log?a.zoomLog(n,null,u):e===t.Sqrt?a.zoomPow(n,null,u,.5):e===t.Pow?a.zoomPow(n,null,u,o||1):e===t.Symlog?a.zoomSymlog(n,null,u,l||1):a.zoomLinear(n,null,u);return(n=n.slice())[0]=d[0],n[n.length-1]=d[1],n}(u,s,n.range,n.padding,n.exponent,n.constant));if((d||null!=n.domainMin||null!=n.domainMax||null!=n.domainMid)&&(o=(s=s.slice()).length-1||1,d&&(s[0]>0&&(s[0]=0),s[o]<0&&(s[o]=0)),null!=n.domainMin&&(s[0]=n.domainMin),null!=n.domainMax&&(s[o]=n.domainMax),null!=n.domainMid)){const e=(l=n.domainMid)>s[o]?o+1:lc&&(c=f),t&&d.sort(t)}return m.max=c,m}(t.source,e.groupby,f,c),r=0,o=i.length,l=i.max;r} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ -export default function AxisTicks(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(AxisTicks, Transform); - -prototype.transform = function(_, pulse) { - if (this.value && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - ticks = this.value, - scale = _.scale, - tally = _.count == null ? (_.values ? _.values.length : 10) : _.count, - count = tickCount(scale, tally, _.minstep), - format = _.format || tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), - values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count); - - if (ticks) out.rem = ticks; - - ticks = values.map(function(value, i) { - return ingest({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - }); - }); - - if (_.extra && ticks.length) { - // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push(ingest({ - index: -1, - extra: {value: ticks[0].value}, - label: '' - })); - } - - out.source = ticks; - out.add = ticks; - this.value = ticks; - - return out; -}; diff --git a/node_modules/vega-encode/src/DataJoin.js b/node_modules/vega-encode/src/DataJoin.js deleted file mode 100644 index 2989944..0000000 --- a/node_modules/vega-encode/src/DataJoin.js +++ /dev/null @@ -1,98 +0,0 @@ -import {Transform, ingest, tupleid} from 'vega-dataflow'; -import {error, fastmap, inherits, isArray} from 'vega-util'; - -/** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ -export default function DataJoin(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(DataJoin, Transform); - -function defaultItemCreate() { - return ingest({}); -} - -function newMap(key) { - const map = fastmap().test(t => t.exit); - map.lookup = t => map.get(key(t)); - return map; -} - -prototype.transform = function(_, pulse) { - var df = pulse.dataflow, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - item = _.item || defaultItemCreate, - key = _.key || tupleid, - map = this.value; - - // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - if (isArray(out.encode)) { - out.encode = null; - } - - if (map && (_.modified('key') || pulse.modified(key))) { - error('DataJoin does not support modified key function or fields.'); - } - - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - - pulse.visit(pulse.ADD, t => { - const k = key(t); - let x = map.get(k); - - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else { - out.mod.push(x); - } - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - - x.datum = t; - x.exit = false; - }); - - pulse.visit(pulse.MOD, t => { - const k = key(t), - x = map.get(k); - - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - - pulse.visit(pulse.REM, t => { - const k = key(t), - x = map.get(k); - - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) { - df.runAfter(map.clean); - } - - return out; -}; diff --git a/node_modules/vega-encode/src/Encode.js b/node_modules/vega-encode/src/Encode.js deleted file mode 100644 index 6bd839d..0000000 --- a/node_modules/vega-encode/src/Encode.js +++ /dev/null @@ -1,79 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {falsy, inherits, isArray} from 'vega-util'; - -/** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ -export default function Encode(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(Encode, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.ADD_REM), - fmod = _.mod || false, - encoders = _.encoders, - encode = pulse.encode; - - // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - if (isArray(encode)) { - if (out.changed() || encode.every(function(e) { return encoders[e]; })) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else { - return pulse.StopPropagation; - } - } - - // marshall encoder functions - var reenter = encode === 'enter', - update = encoders.update || falsy, - enter = encoders.enter || falsy, - exit = encoders.exit || falsy, - set = (encode && !reenter ? encoders[encode] : update) || falsy; - - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, function(t) { enter(t, _); update(t, _); }); - out.modifies(enter.output); - out.modifies(update.output); - if (set !== falsy && set !== update) { - pulse.visit(pulse.ADD, function(t) { set(t, _); }); - out.modifies(set.output); - } - } - - if (pulse.changed(pulse.REM) && exit !== falsy) { - pulse.visit(pulse.REM, function(t) { exit(t, _); }); - out.modifies(exit.output); - } - - if (reenter || set !== falsy) { - var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - if (reenter) { - pulse.visit(flag, function(t) { - var mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else { - pulse.visit(flag, function(t) { - if (set(t, _) || fmod) out.mod.push(t); - }); - } - if (out.mod.length) out.modifies(set.output); - } - - return out.changed() ? out : pulse.StopPropagation; -}; diff --git a/node_modules/vega-encode/src/LegendEntries.js b/node_modules/vega-encode/src/LegendEntries.js deleted file mode 100644 index f5db07f..0000000 --- a/node_modules/vega-encode/src/LegendEntries.js +++ /dev/null @@ -1,136 +0,0 @@ -import {Transform, ingest} from 'vega-dataflow'; -import { - GradientLegend, SymbolLegend, - labelFormat, labelFraction, labelValues, - scaleFraction, tickCount -} from 'vega-scale'; -import {constant, inherits, isFunction, peek} from 'vega-util'; - -/** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ -export default function LegendEntries(params) { - Transform.call(this, [], params); -} - -var prototype = inherits(LegendEntries, Transform); - -prototype.transform = function(_, pulse) { - if (this.value != null && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - items = this.value, - type = _.type || SymbolLegend, - scale = _.scale, - limit = +_.limit, - count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep), - lskip = !!_.values || type === SymbolLegend, - format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), - values = _.values || labelValues(scale, count), - domain, fraction, size, offset, ellipsis; - - if (items) out.rem = items; - - if (type === SymbolLegend) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else { - items = values; - } - - if (isFunction(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) { - items = items.slice(1); - } - // compute size offset for legend entries - offset = items.reduce(function(max, value) { - return Math.max(max, size(value, _)); - }, 0); - } else { - size = constant(offset = size || 8); - } - - items = items.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - }); - }); - - if (ellipsis) { - ellipsis = values[items.length]; - items.push(ingest({ - index: items.length, - label: `\u2026${values.length-items.length} entries`, - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } - - else if (type === GradientLegend) { - domain = scale.domain(), - fraction = scaleFraction(scale, domain[0], peek(domain)); - - // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - if (values.length < 3 && !_.values && domain[0] !== peek(domain)) { - values = [domain[0], peek(domain)]; - } - - items = values.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - }); - }); - } - - else { - size = values.length - 1; - fraction = labelFraction(scale); - - items = values.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index+1]) - }); - }); - } - - out.source = items; - out.add = items; - this.value = items; - - return out; -}; diff --git a/node_modules/vega-encode/src/LinkPath.js b/node_modules/vega-encode/src/LinkPath.js deleted file mode 100644 index 72e5f96..0000000 --- a/node_modules/vega-encode/src/LinkPath.js +++ /dev/null @@ -1,172 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {error, fastmap, inherits} from 'vega-util'; - -var Paths = fastmap({ - 'line': line, - 'line-radial': lineR, - 'arc': arc, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR -}); - -function sourceX(t) { return t.source.x; } -function sourceY(t) { return t.source.y; } -function targetX(t) { return t.target.x; } -function targetY(t) { return t.target.y; } - - /** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ -export default function LinkPath(params) { - Transform.call(this, {}, params); -} - -LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sourceX', 'type': 'field', 'default': 'source.x' }, - { 'name': 'sourceY', 'type': 'field', 'default': 'source.y' }, - { 'name': 'targetX', 'type': 'field', 'default': 'target.x' }, - { 'name': 'targetY', 'type': 'field', 'default': 'target.y' }, - { 'name': 'orient', 'type': 'enum', 'default': 'vertical', - 'values': ['horizontal', 'vertical', 'radial'] }, - { 'name': 'shape', 'type': 'enum', 'default': 'line', - 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal'] }, - { 'name': 'require', 'type': 'signal' }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] -}; - -var prototype = inherits(LinkPath, Transform); - -prototype.transform = function(_, pulse) { - var sx = _.sourceX || sourceX, - sy = _.sourceY || sourceY, - tx = _.targetX || targetX, - ty = _.targetY || targetY, - as = _.as || 'path', - orient = _.orient || 'vertical', - shape = _.shape || 'line', - path = Paths.get(shape + '-' + orient) || Paths.get(shape); - - if (!path) { - error('LinkPath unsupported type: ' + _.shape - + (_.orient ? '-' + _.orient : '')); - } - - pulse.visit(pulse.SOURCE, function(t) { - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - - return pulse.reflow(_.modified()).modifies(as); -}; - -// -- Link Path Generation Methods ----- - -function line(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'L' + tx + ',' + ty; -} - -function lineR(sa, sr, ta, tr) { - return line( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); -} - -function arc(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - rr = Math.sqrt(dx * dx + dy * dy) / 2, - ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + - 'A' + rr + ',' + rr + - ' ' + ra + ' 0 1' + - ' ' + tx + ',' + ty; -} - -function arcR(sa, sr, ta, tr) { - return arc( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); -} - -function curve(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - ix = 0.2 * (dx + dy), - iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + - 'C' + (sx+ix) + ',' + (sy+iy) + - ' ' + (tx+iy) + ',' + (ty-ix) + - ' ' + tx + ',' + ty; -} - -function curveR(sa, sr, ta, tr) { - return curve( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); -} - -function orthoX(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'V' + ty + 'H' + tx; -} - -function orthoY(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'H' + tx + 'V' + ty; -} - -function orthoR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'A' + sr + ',' + sr + ' 0 0,' + (sf?1:0) + - ' ' + (sr*tc) + ',' + (sr*ts) + - 'L' + (tr*tc) + ',' + (tr*ts); -} - -function diagonalX(sx, sy, tx, ty) { - var m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + - 'C' + m + ',' + sy + - ' ' + m + ',' + ty + - ' ' + tx + ',' + ty; -} - -function diagonalY(sx, sy, tx, ty) { - var m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + - 'C' + sx + ',' + m + - ' ' + tx + ',' + m + - ' ' + tx + ',' + ty; -} - -function diagonalR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - mr = (sr + tr) / 2; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'C' + (mr*sc) + ',' + (mr*ss) + - ' ' + (mr*tc) + ',' + (mr*ts) + - ' ' + (tr*tc) + ',' + (tr*ts); -} diff --git a/node_modules/vega-encode/src/Pie.js b/node_modules/vega-encode/src/Pie.js deleted file mode 100644 index 9b5d7fa..0000000 --- a/node_modules/vega-encode/src/Pie.js +++ /dev/null @@ -1,62 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {inherits, one} from 'vega-util'; -import {range, sum} from 'd3-array'; - -/** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ -export default function Pie(params) { - Transform.call(this, null, params); -} - -Pie.Definition = { - 'type': 'Pie', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'startAngle', 'type': 'number', 'default': 0 }, - { 'name': 'endAngle', 'type': 'number', 'default': 6.283185307179586 }, - { 'name': 'sort', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['startAngle', 'endAngle'] } - ] -}; - -var prototype = inherits(Pie, Transform); - -prototype.transform = function(_, pulse) { - var as = _.as || ['startAngle', 'endAngle'], - startAngle = as[0], - endAngle = as[1], - field = _.field || one, - start = _.startAngle || 0, - stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, - data = pulse.source, - values = data.map(field), - n = values.length, - a = start, - k = (stop - start) / sum(values), - index = range(n), - i, t, v; - - if (_.sort) { - index.sort(function(a, b) { - return values[a] - values[b]; - }); - } - - for (i=0; i -1) return raw; - - var domain = _.domain, - type = scale.type, - zero = _.zero || (_.zero === undefined && includeZero(scale)), - n, mid; - - if (!domain) return 0; - - // adjust continuous domain for minimum pixel padding - if (includePad(type) && _.padding && domain[0] !== peek(domain)) { - domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - } - - // adjust domain based on zero, min, max settings - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = ((domain = domain.slice()).length - 1) || 1; - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - - if (_.domainMid != null) { - mid = _.domainMid; - const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } - - // set the scale domain - scale.domain(domainCheck(type, domain, df)); - - // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - if (type === Ordinal) { - scale.unknown(_.domainImplicit ? scaleImplicit : undefined); - } - - // perform 'nice' adjustment as requested - if (_.nice && scale.nice) { - scale.nice((_.nice !== true && tickCount(scale, _.nice)) || null); - } - - // return the cardinality of the domain - return domain.length; -} - -function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else { - return -1; - } -} - -function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs(peek(range) - range[0]), - frac = span / (span - 2 * pad), - d = type === Log ? zoomLog(domain, null, frac) - : type === Sqrt ? zoomPow(domain, null, frac, 0.5) - : type === Pow ? zoomPow(domain, null, frac, exponent || 1) - : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) - : zoomLinear(domain, null, frac); - - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length-1] = d[1]; - return domain; -} - -function domainCheck(type, domain, df) { - if (isLogarithmic(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce(function(s, v) { - return s + (v < 0 ? -1 : v > 0 ? 1 : 0); - }, 0)); - - if (s !== domain.length) { - df.warn('Log scale domain includes zero: ' + stringValue(domain)); - } - } - return domain; -} - -function configureBins(scale, _, count) { - let bins = _.bins; - - if (bins && !isArray(bins)) { - // generate bin boundary array - let domain = scale.domain(), - lo = domain[0], - hi = peek(domain), - start = bins.start == null ? lo : bins.start, - stop = bins.stop == null ? hi : bins.stop, - step = bins.step; - - if (!step) error('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (stop > hi) stop = step * Math.floor(hi / step); - bins = sequence(start, stop + step / 2, step); - } - - if (bins) { - // assign bin boundaries to scale instance - scale.bins = bins; - } else if (scale.bins) { - // no current bins, remove bins if previously set - delete scale.bins; - } - - // special handling for bin-ordinal scales - if (scale.type === BinOrdinal) { - if (!bins) { - // the domain specifies the bins - scale.bins = scale.domain(); - } else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } - - // return domain cardinality - return count; -} - -function configureRange(scale, _, count) { - var type = scale.type, - round = _.round || false, - range = _.range; - - // if range step specified, calculate full range extent - if (_.rangeStep != null) { - range = configureRangeStep(type, _, count); - } - - // else if a range scheme is defined, use that - else if (_.scheme) { - range = configureScheme(type, _, count); - if (isFunction(range)) { - if (scale.interpolator) { - return scale.interpolator(range); - } else { - error(`Scale type ${type} does not support interpolating color schemes.`); - } - } - } - - // given a range array for an interpolating scale, convert to interpolator - if (range && isInterpolating(type)) { - return scale.interpolator( - interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma) - ); - } - - // configure rounding / interpolation - if (range && _.interpolate && scale.interpolate) { - scale.interpolate(getInterpolate(_.interpolate, _.interpolateGamma)); - } else if (isFunction(scale.round)) { - scale.round(round); - } else if (isFunction(scale.rangeRound)) { - scale.interpolate(round ? interpolateRound : interpolate); - } - - if (range) scale.range(flip(range, _.reverse)); -} - -function configureRangeStep(type, _, count) { - if (type !== Band && type !== Point) { - error('Only band and point scales support rangeStep.'); - } - - // calculate full range based on requested step size and padding - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, - inner = type === Point ? 1 - : ((_.paddingInner != null ? _.paddingInner : _.padding) || 0); - return [0, _.rangeStep * bandSpace(count, inner, outer)]; -} - -function configureScheme(type, _, count) { - var extent = _.schemeExtent, - name, scheme; - - if (isArray(_.scheme)) { - scheme = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); - } else { - name = _.scheme.toLowerCase(); - scheme = getScheme(name); - if (!scheme) error(`Unrecognized scheme name: ${_.scheme}`); - } - - // determine size for potential discrete range - count = (type === Threshold) ? count + 1 - : (type === BinOrdinal) ? count - 1 - : (type === Quantile || type === Quantize) ? (+_.schemeCount || DEFAULT_COUNT) - : count; - - // adjust and/or quantize scheme as appropriate - return isInterpolating(type) ? adjustScheme(scheme, extent, _.reverse) - : isFunction(scheme) ? quantizeInterpolator(adjustScheme(scheme, extent), count) - : type === Ordinal ? scheme : scheme.slice(0, count); -} - -function adjustScheme(scheme, extent, reverse) { - return (isFunction(scheme) && (extent || reverse)) - ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) - : scheme; -} - -function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; -} - diff --git a/node_modules/vega-encode/src/SortItems.js b/node_modules/vega-encode/src/SortItems.js deleted file mode 100644 index 61b52aa..0000000 --- a/node_modules/vega-encode/src/SortItems.js +++ /dev/null @@ -1,27 +0,0 @@ -import {Transform, stableCompare} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ -export default function SortItems(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(SortItems, Transform); - -prototype.transform = function(_, pulse) { - var mod = _.modified('sort') - || pulse.changed(pulse.ADD) - || pulse.modified(_.sort.fields) - || pulse.modified('datum'); - - if (mod) pulse.source.sort(stableCompare(_.sort)); - - this.modified(mod); - return pulse; -}; diff --git a/node_modules/vega-encode/src/Stack.js b/node_modules/vega-encode/src/Stack.js deleted file mode 100644 index 4d26e7d..0000000 --- a/node_modules/vega-encode/src/Stack.js +++ /dev/null @@ -1,136 +0,0 @@ -import {Transform, stableCompare} from 'vega-dataflow'; -import {inherits, one} from 'vega-util'; - -var Zero = 'zero', - Center = 'center', - Normalize = 'normalize', - DefOutput = ['y0', 'y1']; - -/** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ -export default function Stack(params) { - Transform.call(this, null, params); -} - -Stack.Definition = { - 'type': 'Stack', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'offset', 'type': 'enum', 'default': Zero, 'values': [Zero, Center, Normalize] }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': DefOutput } - ] -}; - -var prototype = inherits(Stack, Transform); - -prototype.transform = function(_, pulse) { - var as = _.as || DefOutput, - y0 = as[0], - y1 = as[1], - sort = stableCompare(_.sort), - field = _.field || one, - stack = _.offset === Center ? stackCenter - : _.offset === Normalize ? stackNormalize - : stackZero, - groups, i, n, max; - - // partition, sum, and sort the stack groups - groups = partition(pulse.source, _.groupby, sort, field); - - // compute stack layouts per group - for (i=0, n=groups.length, max=groups.max; i max) max = s; - if (sort) g.sort(sort); - } - groups.max = max; - - return groups; -} diff --git a/node_modules/vega-event-selector/LICENSE b/node_modules/vega-event-selector/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-event-selector/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-event-selector/README.md b/node_modules/vega-event-selector/README.md deleted file mode 100644 index 571aca0..0000000 --- a/node_modules/vega-event-selector/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# vega-event-selector - -A CSS-inspired language to select, sequence, and compose DOM events into event streams. - -Exports the following method: - -# -vega.selector(selector[, source, marks]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-event-selector/src/event-selector.js "Source") - -Takes an [event _selector_ string](https://vega.github.io/vega/docs/event-streams/#selector) as input and returns a parsed [event stream object](https://vega.github.io/vega/docs/event-streams/#object) definition. The optional _source_ argument takes a string indicating the source value to use by default (normally `"view"`). The optional _marks_ argument takes an object whose keys will be treated as the legal mark types, so long as the corresponding values are truthy. For more, see the [Vega Event Stream documentation](https://vega.github.io/vega/docs/event-streams). diff --git a/node_modules/vega-event-selector/build/vega-event-selector.js b/node_modules/vega-event-selector/build/vega-event-selector.js deleted file mode 100644 index d39f1b8..0000000 --- a/node_modules/vega-event-selector/build/vega-event-selector.js +++ /dev/null @@ -1,220 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.vega = {})); -}(this, (function (exports) { 'use strict'; - - /** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ - function eventSelector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); - } - - var VIEW = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - - function isMarkType(type) { - return MARKS[type]; - } - - function find(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - for (; i= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - return i; - } - - function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - return output; - } - - function parseSelector(s) { - return s[0] === '[' - ? parseBetween(s) - : parseStream(s); - } - - function parseBetween(s) { - var n = s.length, - i = 1, - b, stream; - - i = find(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector); - - stream = parseSelector(s.slice(1).trim()); - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; - } - - function parseStream(s) { - var stream = {source: DEFAULT_SOURCE}, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, j, - filter; - - // extract throttle from end - if (s[n-1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i+1, n-1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - - if (!n) throw s; - - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - - // extract first part of multi-part stream selector - j = find(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } - - // extract remaining part of stream selector - i = find(s, i, LBRACK); - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - - // extract filters - while (i < n) { - i = find(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n-1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - - // marshall event stream specification - if (!(n = source.length) || ILLEGAL.test(source[n-1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - - return stream; - } - - function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function(_) { - var x = +_; - if (x !== x) throw s; - return x; - }); - } - - exports.selector = eventSelector; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-event-selector/build/vega-event-selector.min.js b/node_modules/vega-event-selector/build/vega-event-selector.min.js deleted file mode 100644 index ed5f1b6..0000000 --- a/node_modules/vega-event-selector/build/vega-event-selector.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).vega={})}(this,(function(e){"use strict";var t,r,n="view",i=/[[\]{}]/,o={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function s(e,t,r,n,i){for(var o,s=0,f=e.length;t=0?--s:n&&n.indexOf(o)>=0&&++s}return t}function f(e){for(var t=[],r=0,n=e.length,i=0;i"!==(e=e.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+e;if(t=t.map(u),(r=u(e.slice(1).trim())).between)return{between:t,stream:r};r.between=t;return r}(e):function(e){var n,o,f={source:t},u=[],c=[0,0],l=0,a=0,h=e.length,p=0;if("}"===e[h-1]){if(!((p=e.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+e;try{c=function(e){var t=e.split(",");if(!e.length||t.length>2)throw e;return t.map((function(t){var r=+t;if(r!=r)throw e;return r}))}(e.substring(p+1,h-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,p).trim(),h=e.length,p=0}if(!h)throw e;"@"===e[0]&&(l=++p);(n=s(e,p,":"))1?(f.type=u[1],l?f.markname=u[0].slice(1):(m=u[0],r[m]?f.marktype=u[0]:f.source=u[0])):f.type=u[0];var m;"!"===f.type.slice(-1)&&(f.consume=!0,f.type=f.type.slice(0,-1));null!=o&&(f.filter=o);c[0]&&(f.throttle=c[0]);c[1]&&(f.debounce=c[1]);return f}(e)}e.selector=function(e,i,s){return t=i||n,r=s||o,f(e.trim()).map(u)},Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-event-selector/index.d.ts b/node_modules/vega-event-selector/index.d.ts deleted file mode 100644 index 4199c19..0000000 --- a/node_modules/vega-event-selector/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export function selector(selectorName: string, source: string): any[]; diff --git a/node_modules/vega-event-selector/index.js b/node_modules/vega-event-selector/index.js deleted file mode 100644 index 89f258f..0000000 --- a/node_modules/vega-event-selector/index.js +++ /dev/null @@ -1 +0,0 @@ -export {default as selector} from './src/event-selector'; diff --git a/node_modules/vega-event-selector/package.json b/node_modules/vega-event-selector/package.json deleted file mode 100644 index 2906010..0000000 --- a/node_modules/vega-event-selector/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "_from": "vega-event-selector@~2.0.3", - "_id": "vega-event-selector@2.0.3", - "_inBundle": false, - "_integrity": "sha512-rUnAvBSy5tkk+0MELY7qICTgjMNjH/DDNIH603q3GRi+bBRCd4MlJxWrPYBhwZIYpmr6XCe130lZ90/F5SgVfA==", - "_location": "/vega-event-selector", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-event-selector@~2.0.3", - "name": "vega-event-selector", - "escapedName": "vega-event-selector", - "rawSpec": "~2.0.3", - "saveSpec": null, - "fetchSpec": "~2.0.3" - }, - "_requiredBy": [ - "/vega", - "/vega-lite", - "/vega-parser" - ], - "_resolved": "https://registry.npmjs.org/vega-event-selector/-/vega-event-selector-2.0.3.tgz", - "_shasum": "760c61af7ab5c325d3274fd3ab284d067ff16f8c", - "_spec": "vega-event-selector@~2.0.3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Arvind Satyanarayan", - "url": "http://arvindsatya.com" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A CSS-inspired language to select, sequence, and compose DOM events.", - "gitHead": "35e31c5c6b54db9dc3a577b5adad8d15ec274d32", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "event", - "selector" - ], - "license": "BSD-3-Clause", - "main": "build/vega-event-selector.js", - "module": "index", - "name": "vega-event-selector", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-event-selector.js -c -m -o build/vega-event-selector.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -f umd -n vega -o build/vega-event-selector.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "types": "index.d.ts", - "version": "2.0.3" -} diff --git a/node_modules/vega-event-selector/src/event-selector.js b/node_modules/vega-event-selector/src/event-selector.js deleted file mode 100644 index 86a7941..0000000 --- a/node_modules/vega-event-selector/src/event-selector.js +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ -export default function(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); -} - -var VIEW = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - -function isMarkType(type) { - return MARKS[type]; -} - -function find(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - for (; i= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - return i; -} - -function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - return output; -} - -function parseSelector(s) { - return s[0] === '[' - ? parseBetween(s) - : parseStream(s); -} - -function parseBetween(s) { - var n = s.length, - i = 1, - b, stream; - - i = find(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector); - - stream = parseSelector(s.slice(1).trim()); - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; -} - -function parseStream(s) { - var stream = {source: DEFAULT_SOURCE}, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, j, - filter; - - // extract throttle from end - if (s[n-1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i+1, n-1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - - if (!n) throw s; - - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - - // extract first part of multi-part stream selector - j = find(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } - - // extract remaining part of stream selector - i = find(s, i, LBRACK); - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - - // extract filters - while (i < n) { - i = find(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n-1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - - // marshall event stream specification - if (!(n = source.length) || ILLEGAL.test(source[n-1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - - return stream; -} - -function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function(_) { - var x = +_; - if (x !== x) throw s; - return x; - }); -} diff --git a/node_modules/vega-expression/LICENSE b/node_modules/vega-expression/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-expression/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-expression/README.md b/node_modules/vega-expression/README.md deleted file mode 100644 index e1245fb..0000000 --- a/node_modules/vega-expression/README.md +++ /dev/null @@ -1,146 +0,0 @@ -# vega-expression - -[Vega](https://github.com/vega/vega) expression parser and code generator. - -Parses a limited subset of JavaScript expressions into an abstract syntax tree, and provides code generation utilities for generating `eval`'able output code. The parser recognizes basic JavaScript expressions, but does not allow assignment operators, `new` expressions, or control flow statements (`for`, `while`, `switch`, etc). The configurable code generator further limits the set of allowable function invocations and variable names. The goal is to provide simple, expressive, and security-conscious expression evaluation. - -See the [Vega expression language documentation](https://vega.github.io/vega/docs/expressions/) for more details about supported JavaScript expressions, and see below for the constants and functions provided by this package. All other functions are provided by the [vega-functions](https://github.com/vega/vega/blob/master/packages/vega-functions/) package. - -## API Reference - -# -parse(expression) -[<>](https://github.com/vega/vega/blob/master/packages/vega-expression/src/parser.js "Source") - -Parse the JavaScript *expression* string and return the resulting abstract syntax tree in the [ESTree format](https://github.com/estree/estree). The parser is a stripped-down version of the [Esprima](http://esprima.org/) parser. - -# -codegen(options) -[<>](https://github.com/vega/vega/blob/master/packages/vega-expression/src/codegen.js "Source") - -Create a new output code generator configured according to the provided options. The resulting generator function accepts a parsed AST as input and returns `eval`'able JavaScript code as output. The output is an object hash with the properties `code` (the generated code as a string), `fields` (a hash of all properties referenced within the _fieldvar_ scope), and `globals` (a hash of all properties referenced outside a provided whitelist). - -The supported _options_ include: - -- *constants*: A hash of allowed top-level constant values. This object maps from constant names to constant values. The constant values are strings that will be injected as-is into generated code. If this option is not specified, the [constants](#constants) object is used by default. - -- *functions*: A function that is given an AST visitor instance as input and returns an object of allowed functions. The resulting object maps from -function names to function values. The values may either be strings (which will be injected as-is into generated code and subsequently appended with arguments) or functions (which take an array of argument AST nodes as input and return generated code to inject). If this option is not specified, the [functions](#functions) method is used by default. - -- *blacklist*: An array of variable names that may **not** be referenced within the expression scope. These may correspond to disallowed global variables. - -- *whitelist*: An array of variable names that may be referenced within the expression scope. These typically correspond to function parameter names for the expression. Variable names not included in the white list will be collected as global variables (see *globalvar* below). - -- *fieldvar*: The name of the primary data input argument within the generated expression function. For example, in the function `function(d) { return d.x * d.y; }`, the variable `d` serves as the field variable, and `x` and `y` are it's accessed properties. All properties accessed under the scope of _fieldvar_ will be tracked by the code generator and returned as part of the output. This is necessary to perform dependency tracking of referenced data fields. - -- *globalvar*: (Required) The name of the variable upon which to lookup global variables. This variable name will be included in the generated code as the scope for any global variable references. Alternatively, this property can be a function that maps from variable names in the source input to generated code to write to the output. - -# -constants(codegen) -[<>](https://github.com/vega/vega/blob/master/packages/vega-expression/src/constants.js "Source") - -An object defining default constant values for the Vega expression language. The object maps from constant identifiers to JavaScript code to defining the constant value (for example, `'PI'` maps to `'Math.PI`'). - -# -functions(codegen) -[<>](https://github.com/vega/vega/blob/master/packages/vega-expression/src/functions.js "Source") - -Given a *codegen* instance (generated by the [codegen](#codegen) method) as input, returns an object defining all valid function names for use within an expression. The resulting object maps from function names to function values. The values may either be strings (which will be injected as-is into generated code and subsequently appended with arguments) or functions (which take an array of argument AST nodes as input and return generated code to inject). - -# -ASTNode(type) -[<>](https://github.com/vega/vega/blob/master/packages/vega-expression/src/ast.js "Source") - -Constructor for a node in an expression abstract syntax tree (AST). Accepts a *type* string as input, which then become the `type` property of the resulting node. AST nodes also support a `visit` method which takes a visitor function as input in order to traverse the AST for static analysis. - -## Provided Constants and Functions - -This package provides the following constants and functions: - -**Constants** - -- [`NaN`](https://vega.github.io/vega/docs/expressions/#NaN) -- [`E`](https://vega.github.io/vega/docs/expressions/#E) -- [`LN2`](https://vega.github.io/vega/docs/expressions/#LN2) -- [`LN10`](https://vega.github.io/vega/docs/expressions/#LN10) -- [`LOG2E`](https://vega.github.io/vega/docs/expressions/#LOG2E) -- [`LOG10E`](https://vega.github.io/vega/docs/expressions/#LOG10E) -- [`PI`](https://vega.github.io/vega/docs/expressions/#PI) -- [`SQRT1_2`](https://vega.github.io/vega/docs/expressions/#SQRT1_2) -- [`SQRT2`](https://vega.github.io/vega/docs/expressions/#SQRT2) -- [`MIN_VALUE`](https://vega.github.io/vega/docs/expressions/#MIN_VALUE) -- [`MAX_VALUE`](https://vega.github.io/vega/docs/expressions/#MAX_VALUE) - -**Math Functions** - -- [`isNaN`](https://vega.github.io/vega/docs/expressions/#isNaN) -- [`isFinite`](https://vega.github.io/vega/docs/expressions/#isFinite) -- [`abs`](https://vega.github.io/vega/docs/expressions/#abs) -- [`acos`](https://vega.github.io/vega/docs/expressions/#acos) -- [`asin`](https://vega.github.io/vega/docs/expressions/#asin) -- [`atan`](https://vega.github.io/vega/docs/expressions/#atan) -- [`atan2`](https://vega.github.io/vega/docs/expressions/#atan2) -- [`ceil`](https://vega.github.io/vega/docs/expressions/#ceil) -- [`cos`](https://vega.github.io/vega/docs/expressions/#cos) -- [`exp`](https://vega.github.io/vega/docs/expressions/#exp) -- [`floor`](https://vega.github.io/vega/docs/expressions/#floor) -- [`log`](https://vega.github.io/vega/docs/expressions/#log) -- [`max`](https://vega.github.io/vega/docs/expressions/#max) -- [`min`](https://vega.github.io/vega/docs/expressions/#min) -- [`pow`](https://vega.github.io/vega/docs/expressions/#pow) -- [`random`](https://vega.github.io/vega/docs/expressions/#random) -- [`round`](https://vega.github.io/vega/docs/expressions/#round) -- [`sin`](https://vega.github.io/vega/docs/expressions/#sin) -- [`sqrt`](https://vega.github.io/vega/docs/expressions/#sqrt) -- [`tan`](https://vega.github.io/vega/docs/expressions/#tan) -- [`clamp`](https://vega.github.io/vega/docs/expressions/#clamp) - -**Date/Time Functions** - -- [`now`](https://vega.github.io/vega/docs/expressions/#now) -- [`utc`](https://vega.github.io/vega/docs/expressions/#utc) -- [`datetime`](https://vega.github.io/vega/docs/expressions/#datetime) -- [`date`](https://vega.github.io/vega/docs/expressions/#date) -- [`day`](https://vega.github.io/vega/docs/expressions/#day) -- [`year`](https://vega.github.io/vega/docs/expressions/#year) -- [`month`](https://vega.github.io/vega/docs/expressions/#month) -- [`hours`](https://vega.github.io/vega/docs/expressions/#hours) -- [`minutes`](https://vega.github.io/vega/docs/expressions/#minutes) -- [`seconds`](https://vega.github.io/vega/docs/expressions/#seconds) -- [`milliseconds`](https://vega.github.io/vega/docs/expressions/#milliseconds) -- [`time`](https://vega.github.io/vega/docs/expressions/#time) -- [`timezoneoffset`](https://vega.github.io/vega/docs/expressions/#timezoneoffset) -- [`utcdate`](https://vega.github.io/vega/docs/expressions/#utcdate) -- [`utcday`](https://vega.github.io/vega/docs/expressions/#utcday) -- [`utcyear`](https://vega.github.io/vega/docs/expressions/#utcyear) -- [`utcmonth`](https://vega.github.io/vega/docs/expressions/#utcmonth) -- [`utchours`](https://vega.github.io/vega/docs/expressions/#utchours) -- [`utcminutes`](https://vega.github.io/vega/docs/expressions/#utcminutes) -- [`utcseconds`](https://vega.github.io/vega/docs/expressions/#utcseconds) -- [`utcmilliseconds`](https://vega.github.io/vega/docs/expressions/#utcmilliseconds) - -**Sequence (Array or String) Functions** - -- [`length`](https://vega.github.io/vega/docs/expressions/#length) -- [`join`](https://vega.github.io/vega/docs/expressions/#join) -- [`indexof`](https://vega.github.io/vega/docs/expressions/#indexof) -- [`lastindexof`](https://vega.github.io/vega/docs/expressions/#lastindexof) -- [`reverse`](https://vega.github.io/vega/docs/expressions/#reverse) -- [`slice`](https://vega.github.io/vega/docs/expressions/#slice) - -**String Functions** - -- [`parseFloat`](https://vega.github.io/vega/docs/expressions/#parseFloat) -- [`parseInt`](https://vega.github.io/vega/docs/expressions/#parseInt) -- [`upper`](https://vega.github.io/vega/docs/expressions/#upper) -- [`lower`](https://vega.github.io/vega/docs/expressions/#lower) -- [`replace`](https://vega.github.io/vega/docs/expressions/#replace) -- [`split`](https://vega.github.io/vega/docs/expressions/#split) -- [`substring`](https://vega.github.io/vega/docs/expressions/#substring) -- [`trim`](https://vega.github.io/vega/docs/expressions/#trim) - -**RegExp Functions** - -- [`regexp`](https://vega.github.io/vega/docs/expressions/#regexp) -- [`test`](https://vega.github.io/vega/docs/expressions/#test) - diff --git a/node_modules/vega-expression/build/vega-expression.js b/node_modules/vega-expression/build/vega-expression.js deleted file mode 100644 index 67989d0..0000000 --- a/node_modules/vega-expression/build/vega-expression.js +++ /dev/null @@ -1,1837 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util'], factory) : - (global = global || self, factory(global.vega = {}, global.vega)); -}(this, (function (exports, vegaUtil) { 'use strict'; - - var RawCode = 'RawCode'; - var Literal = 'Literal'; - var Property = 'Property'; - var Identifier = 'Identifier'; - - var ArrayExpression = 'ArrayExpression'; - var BinaryExpression = 'BinaryExpression'; - var CallExpression = 'CallExpression'; - var ConditionalExpression = 'ConditionalExpression'; - var LogicalExpression = 'LogicalExpression'; - var MemberExpression = 'MemberExpression'; - var ObjectExpression = 'ObjectExpression'; - var UnaryExpression = 'UnaryExpression'; - - function ASTNode(type) { - this.type = type; - } - - ASTNode.prototype.visit = function(visitor) { - var node = this, c, i, n; - - if (visitor(node)) return 1; - - for (c=children(node), i=0, n=c.length; i - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - - 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. - - 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 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. - */ - - var TokenName, - source, - index, - length, - lookahead; - - var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; - - TokenName = {}; - TokenName[TokenBooleanLiteral] = 'Boolean'; - TokenName[TokenEOF] = ''; - TokenName[TokenIdentifier] = 'Identifier'; - TokenName[TokenKeyword] = 'Keyword'; - TokenName[TokenNullLiteral] = 'Null'; - TokenName[TokenNumericLiteral] = 'Numeric'; - TokenName[TokenPunctuator] = 'Punctuator'; - TokenName[TokenStringLiteral] = 'String'; - TokenName[TokenRegularExpression] = 'RegularExpression'; - - var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; - - // Error messages should be identical to V8. - var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; - - var ILLEGAL = 'ILLEGAL', - DISABLED = 'Disabled.'; - - // See also tools/generate-unicode-regex.py. - var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), - // eslint-disable-next-line no-misleading-character-class - RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\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0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); - - // Ensure the condition is true, otherwise throw an error. - // This is only to have a better contract semantic, i.e. another safety net - // to catch a logic error. The condition shall be fulfilled in normal case. - // Do NOT use this to enforce a certain condition on any user input. - - function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - - function isDecimalDigit(ch) { - return (ch >= 0x30 && ch <= 0x39); // 0..9 - } - - function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; - } - - function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; - } - - // 7.2 White Space - - function isWhiteSpace(ch) { - return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || - (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); - } - - // 7.3 Line Terminators - - function isLineTerminator(ch) { - return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); - } - - // 7.6 Identifier Names and Identifiers - - function isIdentifierStart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch))); - } - - function isIdentifierPart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch >= 0x30 && ch <= 0x39) || // 0..9 - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch))); - } - - // 7.6.1.1 Keywords - - var keywords = { - 'if':1, 'in':1, 'do':1, - 'var':1, 'for':1, 'new':1, 'try':1, 'let':1, - 'this':1, 'else':1, 'case':1, 'void':1, 'with':1, 'enum':1, - 'while':1, 'break':1, 'catch':1, 'throw':1, 'const':1, 'yield':1, 'class':1, 'super':1, - 'return':1, 'typeof':1, 'delete':1, 'switch':1, 'export':1, 'import':1, 'public':1, 'static':1, - 'default':1, 'finally':1, 'extends':1, 'package':1, 'private':1, - 'function':1, 'continue':1, 'debugger':1, - 'interface':1, 'protected':1, - 'instanceof':1, 'implements':1 - }; - - function skipComment() { - var ch; - - while (index < length) { - ch = source.charCodeAt(index); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index; - } else { - break; - } - } - } - - function scanHexEscape(prefix) { - var i, len, ch, code = 0; - - len = (prefix === 'u') ? 4 : 2; - for (i = 0; i < len; ++i) { - if (index < length && isHexDigit(source[index])) { - ch = source[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - return String.fromCharCode(code); - } - - function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - - ch = source[index]; - code = 0; - - // At least, one hex digit is required. - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - while (index < length) { - ch = source[index++]; - if (!isHexDigit(ch)) { - break; - } - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - // UTF-16 Encoding - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - cu1 = ((code - 0x10000) >> 10) + 0xD800; - cu2 = ((code - 0x10000) & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); - } - - function getEscapedIdentifier() { - var ch, id; - - ch = source.charCodeAt(index++); - id = String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id = ch; - } - - while (index < length) { - ch = source.charCodeAt(index); - if (!isIdentifierPart(ch)) { - break; - } - ++index; - id += String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id += ch; - } - } - - return id; - } - - function getIdentifier() { - var start, ch; - - start = index++; - while (index < length) { - ch = source.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); - } - if (isIdentifierPart(ch)) { - ++index; - } else { - break; - } - } - - return source.slice(start, index); - } - - function scanIdentifier() { - var start, id, type; - - start = index; - - // Backslash (U+005C) starts an escaped character. - id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); - - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index - }; - } - - // 7.7 Punctuators - - function scanPunctuator() { - var start = index, - code = source.charCodeAt(index), - code2, - ch1 = source[index], - ch2, - ch3, - ch4; - - switch (code) { - - // Check for most common single-character punctuators. - case 0x2E: // . dot - case 0x28: // ( open bracket - case 0x29: // ) close bracket - case 0x3B: // ; semicolon - case 0x2C: // , comma - case 0x7B: // { open curly brace - case 0x7D: // } close curly brace - case 0x5B: // [ - case 0x5D: // ] - case 0x3A: // : - case 0x3F: // ? - case 0x7E: // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - - default: - code2 = source.charCodeAt(index + 1); - - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - case 0x2D: // - - case 0x2F: // / - case 0x3C: // < - case 0x3E: // > - case 0x5E: // ^ - case 0x7C: // | - case 0x25: // % - case 0x26: // & - case 0x2A: // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - - case 0x21: // ! - case 0x3D: // = - index += 2; - - // !== and === - if (source.charCodeAt(index) === 0x3D) { - ++index; - } - return { - type: TokenPunctuator, - value: source.slice(start, index), - start: start, - end: index - }; - } - } - } - - // 4-character punctuator: >>>= - - ch4 = source.substr(index, 4); - - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } - - // 3-character punctuators: === !== >>> <<= >>= - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } - - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - - if ((ch1 === ch2[1] && ('+-<>&|'.indexOf(ch1) >= 0)) || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } - - // 1-character punctuators: < > = ! + - * % & | ^ / - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - // 7.8.3 Numeric Literals - - function scanHexLiteral(start) { - var number = ''; - - while (index < length) { - if (!isHexDigit(source[index])) { - break; - } - number += source[index++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index - }; - } - - function scanOctalLiteral(start) { - var number = '0' + source[index++]; - while (index < length) { - if (!isOctalDigit(source[index])) { - break; - } - number += source[index++]; - } - - if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; - } - - function scanNumericLiteral() { - var number, start, ch; - - ch = source[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), - 'Numeric literal must start with a decimal digit or a decimal point'); - - start = index; - number = ''; - if (ch !== '.') { - number = source[index++]; - ch = source[index]; - - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } - - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - ch = source[index]; - } - - if (ch === '.') { - number += source[index++]; - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - ch = source[index]; - } - - if (ch === 'e' || ch === 'E') { - number += source[index++]; - - ch = source[index]; - if (ch === '+' || ch === '-') { - number += source[index++]; - } - if (isDecimalDigit(source.charCodeAt(index))) { - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; - } - - // 7.8.4 String Literals - - function scanStringLiteral() { - var str = '', - quote, start, ch, code, octal = false; - - quote = source[index]; - assert((quote === '\'' || quote === '"'), - 'String literal must starts with a quote'); - - start = index; - ++index; - - while (index < length) { - ch = source[index++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - - // \0 is not octal escape sequence - if (code !== 0) { - octal = true; - } - - if (index < length && isOctalDigit(source[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source[index++]); - - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.indexOf(ch) >= 0 && - index < length && - isOctalDigit(source[index])) { - code = code * 8 + '01234567'.indexOf(source[index++]); - } - } - str += String.fromCharCode(code); - } else { - str += ch; - } - break; - } - } else { - if (ch === '\r' && source[index] === '\n') { - ++index; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index - }; - } - - function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp - .replace(/\\u\{([0-9a-fA-F]+)\}/g, function($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - throwError({}, MessageInvalidRegExp); - }) - .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } - - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } - - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } - } - - function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - - ch = source[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source[index++]; - - classMarker = false; - terminated = false; - while (index < length) { - ch = source[index++]; - str += ch; - if (ch === '\\') { - ch = source[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } - - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; - } - - function scanRegExpFlags() { - var ch, str, flags; - - str = ''; - flags = ''; - while (index < length) { - ch = source[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index; - if (ch === '\\' && index < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; - } - - function scanRegExp() { - var start, body, flags, value; - - lookahead = null; - skipComment(); - start = index; - - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index - }; - } - - function isIdentifierName(token) { - return token.type === TokenIdentifier || - token.type === TokenKeyword || - token.type === TokenBooleanLiteral || - token.type === TokenNullLiteral; - } - - function advance() { - var ch; - - skipComment(); - - if (index >= length) { - return { - type: TokenEOF, - start: index, - end: index - }; - } - - ch = source.charCodeAt(index); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } - - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } - - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } - - - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source.charCodeAt(index + 1))) { - return scanNumericLiteral(); - } - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - function lex() { - var token; - - token = lookahead; - index = token.end; - - lookahead = advance(); - - index = token.end; - - return token; - } - - function peek() { - var pos; - - pos = index; - - lookahead = advance(); - index = pos; - } - - function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; - } - - function finishBinaryExpression(operator, left, right) { - var node = new ASTNode((operator === '||' || operator === '&&') ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; - } - - function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; - } - - function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; - } - - function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; - } - - function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - node.regex = token.regex; - } - return node; - } - - function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; - } - - function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; - } - - function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; - } - - function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; - } - - // Throw an exception - - function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace( - /%(\d)/g, - function(whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - } - ); - - - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; - } - - // Throw an exception because of the token. - - function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } - - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); - } - - // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - - function expect(value) { - var token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } - } - - // Return true if the next token matches the specified punctuator. - - function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; - } - - // Return true if the next token matches the specified keyword - - function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; - } - - // 11.1.4 Array Initialiser - - function parseArrayInitialiser() { - var elements = []; - - index = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - - return finishArrayExpression(elements); - } - - // 11.1.5 Object Initialiser - - function parseObjectPropertyKey() { - var token; - - index = lookahead.start; - token = lex(); - - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - return finishLiteral(token); - } - - return finishIdentifier(token.value); - } - - function parseObjectProperty() { - var token, key, id, value; - - index = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } - } - - function parseObjectInitialiser() { - var properties = [], - property, name, key, map = {}, - toString = String; - - index = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - - return finishObjectExpression(properties); - } - - // 11.1.6 The Grouping Operator - - function parseGroupExpression() { - var expr; - - expect('('); - - expr = parseExpression(); - - expect(')'); - - return expr; - } - - - // 11.1 Primary Expressions - - var legalKeywords = { - 'if': 1 - }; - - function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index = lookahead.start; - - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = (token.value === 'true'); - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek(); - } else { - throwUnexpected(lex()); - } - - return expr; - } - - // 11.2 Left-Hand-Side Expressions - - function parseArguments() { - var args = []; - - expect('('); - - if (!match(')')) { - while (index < length) { - args.push(parseConditionalExpression()); - if (match(')')) { - break; - } - expect(','); - } - } - - expect(')'); - - return args; - } - - function parseNonComputedProperty() { - var token; - index = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); - } - - function parseNonComputedMember() { - expect('.'); - - return parseNonComputedProperty(); - } - - function parseComputedMember() { - var expr; - - expect('['); - - expr = parseExpression(); - - expect(']'); - - return expr; - } - - function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; - } - - // 11.3 Postfix Expressions - - function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if ((match('++') || match('--'))) { - throw new Error(DISABLED); - } - } - - return expr; - } - - // 11.4 Unary Operators - - function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; - } - - function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - } - - return prec; - } - - // 11.5 Multiplicative Operators - // 11.6 Additive Operators - // 11.7 Bitwise Shift Operators - // 11.8 Relational Operators - // 11.9 Equality Operators - // 11.10 Binary Bitwise Operators - // 11.11 Binary Logical Operators - - function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - - marker = lookahead; - left = parseUnaryExpression(); - - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) { - return left; - } - token.prec = prec; - lex(); - - markers = [marker, lookahead]; - right = parseUnaryExpression(); - - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - - // Reduce: make a binary expression from the three topmost entries. - while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; - } - - // 11.12 Conditional Operator - - function parseConditionalExpression() { - var expr, consequent, alternate; - - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; - } - - // 11.14 Comma Operator - - function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; - } - - function parser(code) { - source = code; - index = 0; - length = source.length; - lookahead = null; - - peek(); - - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - return expr; - } - - var Constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' - }; - - function Functions(codegen) { - - function fncall(name, args, cast, type) { - var obj = codegen(args[0]); - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - return obj + '.' + name + (type < 0 ? '' : type === 0 ? - '()' : - '(' + args.slice(1).map(codegen).join(',') + ')'); - } - - function fn(name, cast, type) { - return function(args) { - return fncall(name, args, cast, type); - }; - } - - var DATE = 'new Date', - STRING = 'String', - REGEXP = 'RegExp'; - - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - - clamp: function(args) { - if (args.length < 3) vegaUtil.error('Missing arguments to clamp function.'); - if (args.length > 3) vegaUtil.error('Too many arguments to clamp function.'); - var a = args.map(codegen); - return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))'; - }, - - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - - // sequence functions - length: fn('length', null, -1), - join: fn('join', null), - indexof: fn('indexOf', null), - lastindexof: fn('lastIndexOf', null), - slice: fn('slice', null), - - reverse: function(args) { - return '('+codegen(args[0])+').slice().reverse()'; - }, - - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - replace: fn('replace', STRING), - trim: fn('trim', STRING, 0), - - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - - // Control Flow functions - if: function(args) { - if (args.length < 3) vegaUtil.error('Missing arguments to if function.'); - if (args.length > 3) vegaUtil.error('Too many arguments to if function.'); - var a = args.map(codegen); - return '('+a[0]+'?'+a[1]+':'+a[2]+')'; - } - }; - } - - function stripQuotes(s) { - var n = s && s.length - 1; - return n && ( - (s[0]==='"' && s[n]==='"') || - (s[0]==='\'' && s[n]==='\'') - ) ? s.slice(1, -1) : s; - } - - function codegen(opt) { - opt = opt || {}; - - var whitelist = opt.whitelist ? vegaUtil.toSet(opt.whitelist) : {}, - blacklist = opt.blacklist ? vegaUtil.toSet(opt.blacklist) : {}, - constants = opt.constants || Constants, - functions = (opt.functions || Functions)(visit), - globalvar = opt.globalvar, - fieldvar = opt.fieldvar, - globals = {}, - fields = {}, - memberDepth = 0; - - var outputGlobal = vegaUtil.isFunction(globalvar) - ? globalvar - : function (id) { return globalvar + '["' + id + '"]'; }; - - function visit(ast) { - if (vegaUtil.isString(ast)) return ast; - var generator = Generators[ast.type]; - if (generator == null) vegaUtil.error('Unsupported type: ' + ast.type); - return generator(ast); - } - - var Generators = { - Literal: function(n) { - return n.raw; - }, - - Identifier: function(n) { - var id = n.name; - if (memberDepth > 0) { - return id; - } else if (vegaUtil.hasOwnProperty(blacklist, id)) { - return vegaUtil.error('Illegal identifier: ' + id); - } else if (vegaUtil.hasOwnProperty(constants, id)) { - return constants[id]; - } else if (vegaUtil.hasOwnProperty(whitelist, id)) { - return id; - } else { - globals[id] = 1; - return outputGlobal(id); - } - }, - - MemberExpression: function(n) { - var d = !n.computed; - var o = visit(n.object); - if (d) memberDepth += 1; - var p = visit(n.property); - if (o === fieldvar) { - // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - } - if (d) memberDepth -= 1; - return o + (d ? '.'+p : '['+p+']'); - }, - - CallExpression: function(n) { - if (n.callee.type !== 'Identifier') { - vegaUtil.error('Illegal callee type: ' + n.callee.type); - } - var callee = n.callee.name; - var args = n.arguments; - var fn = vegaUtil.hasOwnProperty(functions, callee) && functions[callee]; - if (!fn) vegaUtil.error('Unrecognized function: ' + callee); - return vegaUtil.isFunction(fn) - ? fn(args) - : fn + '(' + args.map(visit).join(',') + ')'; - }, - - ArrayExpression: function(n) { - return '[' + n.elements.map(visit).join(',') + ']'; - }, - - BinaryExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - UnaryExpression: function(n) { - return '(' + n.operator + visit(n.argument) + ')'; - }, - - ConditionalExpression: function(n) { - return '(' + visit(n.test) + - '?' + visit(n.consequent) + - ':' + visit(n.alternate) + - ')'; - }, - - LogicalExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - ObjectExpression: function(n) { - return '{' + n.properties.map(visit).join(',') + '}'; - }, - - Property: function(n) { - memberDepth += 1; - var k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - - function codegen(ast) { - var result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; - } - - codegen.functions = functions; - codegen.constants = constants; - - return codegen; - } - - exports.ASTNode = ASTNode; - exports.ArrayExpression = ArrayExpression; - exports.BinaryExpression = BinaryExpression; - exports.CallExpression = CallExpression; - exports.ConditionalExpression = ConditionalExpression; - exports.Identifier = Identifier; - exports.Literal = Literal; - exports.LogicalExpression = LogicalExpression; - exports.MemberExpression = MemberExpression; - exports.ObjectExpression = ObjectExpression; - exports.Property = Property; - exports.RawCode = RawCode; - exports.UnaryExpression = UnaryExpression; - exports.codegen = codegen; - exports.constants = Constants; - exports.functions = Functions; - exports.parse = parser; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-expression/build/vega-expression.min.js b/node_modules/vega-expression/build/vega-expression.min.js deleted file mode 100644 index d2e762c..0000000 --- a/node_modules/vega-expression/build/vega-expression.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(u,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-util"],e):e((u=u||self).vega={},u.vega)}(this,(function(u,e){"use strict";var r,t,n,A,a;function i(u){this.type=u}i.prototype.visit=function(u){var e,r,t;if(u(this))return 1;for(r=0,t=(e=function(u){switch(u.type){case"ArrayExpression":return u.elements;case"BinaryExpression":case"LogicalExpression":return[u.left,u.right];case"CallExpression":var e=u.arguments.slice();return e.unshift(u.callee),e;case"ConditionalExpression":return[u.test,u.consequent,u.alternate];case"MemberExpression":return[u.object,u.property];case"ObjectExpression":return u.properties;case"Property":return[u.key,u.value];case"UnaryExpression":return[u.argument];case"Identifier":case"Literal":case"RawCode":default:return[]}}(this)).length;r",r[3]="Identifier",r[4]="Keyword",r[5]="Null",r[6]="Numeric",r[7]="Punctuator",r[8]="String",r[9]="RegularExpression";var o="ILLEGAL",F=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\u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u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\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u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function C(u,e){if(!u)throw new Error("ASSERT: "+e)}function D(u){return u>=48&&u<=57}function B(u){return"0123456789abcdefABCDEF".indexOf(u)>=0}function c(u){return"01234567".indexOf(u)>=0}function E(u){return 32===u||9===u||11===u||12===u||160===u||u>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(u)>=0}function l(u){return 10===u||13===u||8232===u||8233===u}function f(u){return 36===u||95===u||u>=65&&u<=90||u>=97&&u<=122||92===u||u>=128&&F.test(String.fromCharCode(u))}function p(u){return 36===u||95===u||u>=65&&u<=90||u>=97&&u<=122||u>=48&&u<=57||92===u||u>=128&&s.test(String.fromCharCode(u))}var d={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function h(){for(var u;n1114111||"}"!==u)&&T({},"Unexpected token %0",o),e<=65535?String.fromCharCode(e):(r=55296+(e-65536>>10),a=56320+(e-65536&1023),String.fromCharCode(r,a))}function g(){var u,e;for(u=t.charCodeAt(n++),e=String.fromCharCode(u),92===u&&(117!==t.charCodeAt(n)&&T({},"Unexpected token %0",o),++n,(u=v("u"))&&"\\"!==u&&f(u.charCodeAt(0))||T({},"Unexpected token %0",o),e=u);n>>="===(A=t.substr(n,4))?{type:7,value:A,start:a,end:n+=4}:">>>"===(r=A.substr(0,3))||"<<="===r||">>="===r?{type:7,value:r,start:a,end:n+=3}:F===(e=r.substr(0,2))[1]&&"+-<>&|".indexOf(F)>=0||"=>"===e?{type:7,value:e,start:a,end:n+=2}:"<>=!+-*%&|^/".indexOf(F)>=0?{type:7,value:F,start:a,end:++n}:void T({},"Unexpected token %0",o)}function b(){var u,e,r;if(C(D((r=t[n]).charCodeAt(0))||"."===r,"Numeric literal must start with a decimal digit or a decimal point"),e=n,u="","."!==r){if(u=t[n++],r=t[n],"0"===u){if("x"===r||"X"===r)return++n,function(u){for(var e="";n=0&&T({},"Invalid regular expression",r),{value:r,literal:e}}(),i=function(u,e){var r=u;e.indexOf("u")>=0&&(r=r.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(u,e){if(parseInt(e,16)<=1114111)return"x";T({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(r)}catch(u){T({},"Invalid regular expression")}try{return new RegExp(u,e)}catch(u){return null}}(e.value,r.value),{literal:e.literal+r.literal,value:i,regex:{pattern:e.value,flags:r.value},start:u,end:n}}function k(){var u;return h(),n>=A?{type:2,start:n,end:n}:f(u=t.charCodeAt(n))?y():40===u||41===u||59===u?m():39===u||34===u?function(){var u,e,r,a,i="",F=!1;for(C("'"===(u=t[n])||'"'===u,"String literal must starts with a quote"),e=n,++n;n=0&&n":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function uu(){var u,e;return u=function(){var u,e,r,t,n,A,i,o,F,s;if(u=a,F=W(),0===(n=Z(t=a)))return F;for(t.prec=n,M(),e=[u,a],A=[F,t,i=W()];(n=Z(a))>0;){for(;A.length>2&&n<=A[A.length-2].prec;)i=A.pop(),o=A.pop().value,F=A.pop(),e.pop(),r=O(o,F,i),A.push(r);(t=M()).prec=n,A.push(t),e.push(a),r=W(),A.push(r)}for(r=A[s=A.length-1],e.pop();s>1;)e.pop(),r=O(A[s-1].value,A[s-2],r),s-=2;return r}(),_("?")&&(M(),e=uu(),P(":"),u=function(u,e,r){var t=new i("ConditionalExpression");return t.test=u,t.consequent=e,t.alternate=r,t}(u,e,uu())),u}function eu(){var u=uu();if(_(","))throw new Error("Disabled.");return u}var ru={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function tu(u){function r(e,r,t){return function(n){return function(e,r,t,n){var A=u(r[0]);return t&&(A=t+"("+A+")",0===t.lastIndexOf("new ",0)&&(A="("+A+")")),A+"."+e+(n<0?"":0===n?"()":"("+r.slice(1).map(u).join(",")+")")}(e,n,r,t)}}var t="new Date";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(r){r.length<3&&e.error("Missing arguments to clamp function."),r.length>3&&e.error("Too many arguments to clamp function.");var t=r.map(u);return"Math.max("+t[1]+", Math.min("+t[2]+","+t[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:t,date:r("getDate",t,0),day:r("getDay",t,0),year:r("getFullYear",t,0),month:r("getMonth",t,0),hours:r("getHours",t,0),minutes:r("getMinutes",t,0),seconds:r("getSeconds",t,0),milliseconds:r("getMilliseconds",t,0),time:r("getTime",t,0),timezoneoffset:r("getTimezoneOffset",t,0),utcdate:r("getUTCDate",t,0),utcday:r("getUTCDay",t,0),utcyear:r("getUTCFullYear",t,0),utcmonth:r("getUTCMonth",t,0),utchours:r("getUTCHours",t,0),utcminutes:r("getUTCMinutes",t,0),utcseconds:r("getUTCSeconds",t,0),utcmilliseconds:r("getUTCMilliseconds",t,0),length:r("length",null,-1),join:r("join",null),indexof:r("indexOf",null),lastindexof:r("lastIndexOf",null),slice:r("slice",null),reverse:function(e){return"("+u(e[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:r("toUpperCase","String",0),lower:r("toLowerCase","String",0),substring:r("substring","String"),split:r("split","String"),replace:r("replace","String"),trim:r("trim","String",0),regexp:"RegExp",test:r("test","RegExp"),if:function(r){r.length<3&&e.error("Missing arguments to if function."),r.length>3&&e.error("Too many arguments to if function.");var t=r.map(u);return"("+t[0]+"?"+t[1]+":"+t[2]+")"}}}u.ASTNode=i,u.ArrayExpression="ArrayExpression",u.BinaryExpression="BinaryExpression",u.CallExpression="CallExpression",u.ConditionalExpression="ConditionalExpression",u.Identifier="Identifier",u.Literal="Literal",u.LogicalExpression="LogicalExpression",u.MemberExpression="MemberExpression",u.ObjectExpression="ObjectExpression",u.Property="Property",u.RawCode="RawCode",u.UnaryExpression="UnaryExpression",u.codegen=function(u){var r=(u=u||{}).whitelist?e.toSet(u.whitelist):{},t=u.blacklist?e.toSet(u.blacklist):{},n=u.constants||ru,A=(u.functions||tu)(D),a=u.globalvar,i=u.fieldvar,o={},F={},s=0,C=e.isFunction(a)?a:function(u){return a+'["'+u+'"]'};function D(u){if(e.isString(u))return u;var r=B[u.type];return null==r&&e.error("Unsupported type: "+u.type),r(u)}var B={Literal:function(u){return u.raw},Identifier:function(u){var A=u.name;return s>0?A:e.hasOwnProperty(t,A)?e.error("Illegal identifier: "+A):e.hasOwnProperty(n,A)?n[A]:e.hasOwnProperty(r,A)?A:(o[A]=1,C(A))},MemberExpression:function(u){var e=!u.computed,r=D(u.object);e&&(s+=1);var t=D(u.property);return r===i&&(F[function(u){var e=u&&u.length-1;return e&&('"'===u[0]&&'"'===u[e]||"'"===u[0]&&"'"===u[e])?u.slice(1,-1):u}(t)]=1),e&&(s-=1),r+(e?"."+t:"["+t+"]")},CallExpression:function(u){"Identifier"!==u.callee.type&&e.error("Illegal callee type: "+u.callee.type);var r=u.callee.name,t=u.arguments,n=e.hasOwnProperty(A,r)&&A[r];return n||e.error("Unrecognized function: "+r),e.isFunction(n)?n(t):n+"("+t.map(D).join(",")+")"},ArrayExpression:function(u){return"["+u.elements.map(D).join(",")+"]"},BinaryExpression:function(u){return"("+D(u.left)+u.operator+D(u.right)+")"},UnaryExpression:function(u){return"("+u.operator+D(u.argument)+")"},ConditionalExpression:function(u){return"("+D(u.test)+"?"+D(u.consequent)+":"+D(u.alternate)+")"},LogicalExpression:function(u){return"("+D(u.left)+u.operator+D(u.right)+")"},ObjectExpression:function(u){return"{"+u.properties.map(D).join(",")+"}"},Property:function(u){s+=1;var e=D(u.key);return s-=1,e+":"+D(u.value)}};function c(u){var e={code:D(u),globals:Object.keys(o),fields:Object.keys(F)};return o={},F={},e}return c.functions=A,c.constants=n,c},u.constants=ru,u.functions=tu,u.parse=function(u){n=0,A=(t=u).length,a=null,U();var e=eu();if(2!==a.type)throw new Error("Unexpect token after expression.");return e},Object.defineProperty(u,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-expression/index.d.ts b/node_modules/vega-expression/index.d.ts deleted file mode 100644 index 3dcddf8..0000000 --- a/node_modules/vega-expression/index.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: add missing types - -export function parse(expression: string): any; - -export function codegen(params: { - constants?: object; - functions?: { [fn: string]: Function }; - blacklist?: string[]; - whitelist?: string[]; - fieldvar?: string; - globalvar: string; -}): ( - ast: any -) => { - /** The generated code as a string. */ - code: string; - /** A hash of all properties referenced within the fieldvar scope. */ - fields: string[]; - /** A hash of all properties referenced outside a provided whitelist */ - globals: string[]; -}; diff --git a/node_modules/vega-expression/index.js b/node_modules/vega-expression/index.js deleted file mode 100644 index e97ffe1..0000000 --- a/node_modules/vega-expression/index.js +++ /dev/null @@ -1,20 +0,0 @@ -export { - RawCode, - Literal, - Property, - Identifier, - ArrayExpression, - BinaryExpression, - CallExpression, - ConditionalExpression, - LogicalExpression, - MemberExpression, - ObjectExpression, - UnaryExpression, - default as ASTNode -} from './src/ast'; - -export { default as parse} from './src/parser'; -export { default as codegen } from './src/codegen'; -export { default as functions } from './src/functions'; -export { default as constants } from './src/constants'; diff --git a/node_modules/vega-expression/package.json b/node_modules/vega-expression/package.json deleted file mode 100644 index af943f9..0000000 --- a/node_modules/vega-expression/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_from": "vega-expression@~2.6.5", - "_id": "vega-expression@2.6.5", - "_inBundle": false, - "_integrity": "sha512-3hJts0gKomu3ePXYeIb+VAw7yNKoHJ6VqSKsHHFPyoEGNdwmlgI5d9IBblelPCiMCHK4sMt7h1OTWB33cfxZGA==", - "_location": "/vega-expression", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-expression@~2.6.5", - "name": "vega-expression", - "escapedName": "vega-expression", - "rawSpec": "~2.6.5", - "saveSpec": null, - "fetchSpec": "~2.6.5" - }, - "_requiredBy": [ - "/vega", - "/vega-functions", - "/vega-lite", - "/vega-selections" - ], - "_resolved": "https://registry.npmjs.org/vega-expression/-/vega-expression-2.6.5.tgz", - "_shasum": "7bda7524b9223cbbf9034071695c7c2a9bd81971", - "_spec": "vega-expression@~2.6.5", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "Vega expression parser and code generator.", - "gitHead": "48c85218f2202242171aa569f2dca0f53cf2b51f", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "expression", - "parser", - "codegen" - ], - "license": "BSD-3-Clause", - "main": "build/vega-expression.js", - "module": "index", - "name": "vega-expression", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-expression.js -c -m -o build/vega-expression.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -f umd -g vega-util:vega -n vega -o build/vega-expression.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "types": "index.d.ts", - "version": "2.6.5" -} diff --git a/node_modules/vega-expression/src/ast.js b/node_modules/vega-expression/src/ast.js deleted file mode 100644 index 7e5b36c..0000000 --- a/node_modules/vega-expression/src/ast.js +++ /dev/null @@ -1,56 +0,0 @@ -export var RawCode = 'RawCode'; -export var Literal = 'Literal'; -export var Property = 'Property'; -export var Identifier = 'Identifier'; - -export var ArrayExpression = 'ArrayExpression'; -export var BinaryExpression = 'BinaryExpression'; -export var CallExpression = 'CallExpression'; -export var ConditionalExpression = 'ConditionalExpression'; -export var LogicalExpression = 'LogicalExpression'; -export var MemberExpression = 'MemberExpression'; -export var ObjectExpression = 'ObjectExpression'; -export var UnaryExpression = 'UnaryExpression'; - -export default function ASTNode(type) { - this.type = type; -} - -ASTNode.prototype.visit = function(visitor) { - var node = this, c, i, n; - - if (visitor(node)) return 1; - - for (c=children(node), i=0, n=c.length; i 0) { - return id; - } else if (hasOwnProperty(blacklist, id)) { - return error('Illegal identifier: ' + id); - } else if (hasOwnProperty(constants, id)) { - return constants[id]; - } else if (hasOwnProperty(whitelist, id)) { - return id; - } else { - globals[id] = 1; - return outputGlobal(id); - } - }, - - MemberExpression: function(n) { - var d = !n.computed; - var o = visit(n.object); - if (d) memberDepth += 1; - var p = visit(n.property); - if (o === fieldvar) { - // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - } - if (d) memberDepth -= 1; - return o + (d ? '.'+p : '['+p+']'); - }, - - CallExpression: function(n) { - if (n.callee.type !== 'Identifier') { - error('Illegal callee type: ' + n.callee.type); - } - var callee = n.callee.name; - var args = n.arguments; - var fn = hasOwnProperty(functions, callee) && functions[callee]; - if (!fn) error('Unrecognized function: ' + callee); - return isFunction(fn) - ? fn(args) - : fn + '(' + args.map(visit).join(',') + ')'; - }, - - ArrayExpression: function(n) { - return '[' + n.elements.map(visit).join(',') + ']'; - }, - - BinaryExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - UnaryExpression: function(n) { - return '(' + n.operator + visit(n.argument) + ')'; - }, - - ConditionalExpression: function(n) { - return '(' + visit(n.test) + - '?' + visit(n.consequent) + - ':' + visit(n.alternate) + - ')'; - }, - - LogicalExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - ObjectExpression: function(n) { - return '{' + n.properties.map(visit).join(',') + '}'; - }, - - Property: function(n) { - memberDepth += 1; - var k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - - function codegen(ast) { - var result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; - } - - codegen.functions = functions; - codegen.constants = constants; - - return codegen; -} diff --git a/node_modules/vega-expression/src/constants.js b/node_modules/vega-expression/src/constants.js deleted file mode 100644 index cb2472e..0000000 --- a/node_modules/vega-expression/src/constants.js +++ /dev/null @@ -1,13 +0,0 @@ -export default { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' -}; diff --git a/node_modules/vega-expression/src/functions.js b/node_modules/vega-expression/src/functions.js deleted file mode 100644 index 1557dea..0000000 --- a/node_modules/vega-expression/src/functions.js +++ /dev/null @@ -1,112 +0,0 @@ -import {error} from 'vega-util'; - -export default function(codegen) { - - function fncall(name, args, cast, type) { - var obj = codegen(args[0]); - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - return obj + '.' + name + (type < 0 ? '' : type === 0 ? - '()' : - '(' + args.slice(1).map(codegen).join(',') + ')'); - } - - function fn(name, cast, type) { - return function(args) { - return fncall(name, args, cast, type); - }; - } - - var DATE = 'new Date', - STRING = 'String', - REGEXP = 'RegExp'; - - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - - clamp: function(args) { - if (args.length < 3) error('Missing arguments to clamp function.'); - if (args.length > 3) error('Too many arguments to clamp function.'); - var a = args.map(codegen); - return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))'; - }, - - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - - // sequence functions - length: fn('length', null, -1), - join: fn('join', null), - indexof: fn('indexOf', null), - lastindexof: fn('lastIndexOf', null), - slice: fn('slice', null), - - reverse: function(args) { - return '('+codegen(args[0])+').slice().reverse()'; - }, - - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - replace: fn('replace', STRING), - trim: fn('trim', STRING, 0), - - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - - // Control Flow functions - if: function(args) { - if (args.length < 3) error('Missing arguments to if function.'); - if (args.length > 3) error('Too many arguments to if function.'); - var a = args.map(codegen); - return '('+a[0]+'?'+a[1]+':'+a[2]+')'; - } - }; -} diff --git a/node_modules/vega-expression/src/parser.js b/node_modules/vega-expression/src/parser.js deleted file mode 100644 index f17c70d..0000000 --- a/node_modules/vega-expression/src/parser.js +++ /dev/null @@ -1,1500 +0,0 @@ -/* - The following expression parser is based on Esprima (http://esprima.org/). - Original header comment and license for Esprima is included here: - - Copyright (C) 2013 Ariya Hidayat - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - - 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. - - 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 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. -*/ -import ASTNode from './ast'; - -var TokenName, - source, - index, - length, - lookahead; - -var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; - -TokenName = {}; -TokenName[TokenBooleanLiteral] = 'Boolean'; -TokenName[TokenEOF] = ''; -TokenName[TokenIdentifier] = 'Identifier'; -TokenName[TokenKeyword] = 'Keyword'; -TokenName[TokenNullLiteral] = 'Null'; -TokenName[TokenNumericLiteral] = 'Numeric'; -TokenName[TokenPunctuator] = 'Punctuator'; -TokenName[TokenStringLiteral] = 'String'; -TokenName[TokenRegularExpression] = 'RegularExpression'; - -var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; - -// Error messages should be identical to V8. -var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; - -var ILLEGAL = 'ILLEGAL', - DISABLED = 'Disabled.'; - -// See also tools/generate-unicode-regex.py. -var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\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124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), - // eslint-disable-next-line no-misleading-character-class - RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B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BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); - -// Ensure the condition is true, otherwise throw an error. -// This is only to have a better contract semantic, i.e. another safety net -// to catch a logic error. The condition shall be fulfilled in normal case. -// Do NOT use this to enforce a certain condition on any user input. - -function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } -} - -function isDecimalDigit(ch) { - return (ch >= 0x30 && ch <= 0x39); // 0..9 -} - -function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; -} - -function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; -} - -// 7.2 White Space - -function isWhiteSpace(ch) { - return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || - (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); -} - -// 7.3 Line Terminators - -function isLineTerminator(ch) { - return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); -} - -// 7.6 Identifier Names and Identifiers - -function isIdentifierStart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch))); -} - -function isIdentifierPart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch >= 0x30 && ch <= 0x39) || // 0..9 - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch))); -} - -// 7.6.1.1 Keywords - -var keywords = { - 'if':1, 'in':1, 'do':1, - 'var':1, 'for':1, 'new':1, 'try':1, 'let':1, - 'this':1, 'else':1, 'case':1, 'void':1, 'with':1, 'enum':1, - 'while':1, 'break':1, 'catch':1, 'throw':1, 'const':1, 'yield':1, 'class':1, 'super':1, - 'return':1, 'typeof':1, 'delete':1, 'switch':1, 'export':1, 'import':1, 'public':1, 'static':1, - 'default':1, 'finally':1, 'extends':1, 'package':1, 'private':1, - 'function':1, 'continue':1, 'debugger':1, - 'interface':1, 'protected':1, - 'instanceof':1, 'implements':1 -}; - -function skipComment() { - var ch; - - while (index < length) { - ch = source.charCodeAt(index); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index; - } else { - break; - } - } -} - -function scanHexEscape(prefix) { - var i, len, ch, code = 0; - - len = (prefix === 'u') ? 4 : 2; - for (i = 0; i < len; ++i) { - if (index < length && isHexDigit(source[index])) { - ch = source[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - return String.fromCharCode(code); -} - -function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - - ch = source[index]; - code = 0; - - // At least, one hex digit is required. - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - while (index < length) { - ch = source[index++]; - if (!isHexDigit(ch)) { - break; - } - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - // UTF-16 Encoding - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - cu1 = ((code - 0x10000) >> 10) + 0xD800; - cu2 = ((code - 0x10000) & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); -} - -function getEscapedIdentifier() { - var ch, id; - - ch = source.charCodeAt(index++); - id = String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id = ch; - } - - while (index < length) { - ch = source.charCodeAt(index); - if (!isIdentifierPart(ch)) { - break; - } - ++index; - id += String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id += ch; - } - } - - return id; -} - -function getIdentifier() { - var start, ch; - - start = index++; - while (index < length) { - ch = source.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); - } - if (isIdentifierPart(ch)) { - ++index; - } else { - break; - } - } - - return source.slice(start, index); -} - -function scanIdentifier() { - var start, id, type; - - start = index; - - // Backslash (U+005C) starts an escaped character. - id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); - - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index - }; -} - -// 7.7 Punctuators - -function scanPunctuator() { - var start = index, - code = source.charCodeAt(index), - code2, - ch1 = source[index], - ch2, - ch3, - ch4; - - switch (code) { - - // Check for most common single-character punctuators. - case 0x2E: // . dot - case 0x28: // ( open bracket - case 0x29: // ) close bracket - case 0x3B: // ; semicolon - case 0x2C: // , comma - case 0x7B: // { open curly brace - case 0x7D: // } close curly brace - case 0x5B: // [ - case 0x5D: // ] - case 0x3A: // : - case 0x3F: // ? - case 0x7E: // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - - default: - code2 = source.charCodeAt(index + 1); - - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - case 0x2D: // - - case 0x2F: // / - case 0x3C: // < - case 0x3E: // > - case 0x5E: // ^ - case 0x7C: // | - case 0x25: // % - case 0x26: // & - case 0x2A: // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - - case 0x21: // ! - case 0x3D: // = - index += 2; - - // !== and === - if (source.charCodeAt(index) === 0x3D) { - ++index; - } - return { - type: TokenPunctuator, - value: source.slice(start, index), - start: start, - end: index - }; - } - } - } - - // 4-character punctuator: >>>= - - ch4 = source.substr(index, 4); - - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } - - // 3-character punctuators: === !== >>> <<= >>= - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } - - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - - if ((ch1 === ch2[1] && ('+-<>&|'.indexOf(ch1) >= 0)) || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } - - // 1-character punctuators: < > = ! + - * % & | ^ / - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL); -} - -// 7.8.3 Numeric Literals - -function scanHexLiteral(start) { - var number = ''; - - while (index < length) { - if (!isHexDigit(source[index])) { - break; - } - number += source[index++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index - }; -} - -function scanOctalLiteral(start) { - var number = '0' + source[index++]; - while (index < length) { - if (!isOctalDigit(source[index])) { - break; - } - number += source[index++]; - } - - if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; -} - -function scanNumericLiteral() { - var number, start, ch; - - ch = source[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), - 'Numeric literal must start with a decimal digit or a decimal point'); - - start = index; - number = ''; - if (ch !== '.') { - number = source[index++]; - ch = source[index]; - - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } - - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - ch = source[index]; - } - - if (ch === '.') { - number += source[index++]; - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - ch = source[index]; - } - - if (ch === 'e' || ch === 'E') { - number += source[index++]; - - ch = source[index]; - if (ch === '+' || ch === '-') { - number += source[index++]; - } - if (isDecimalDigit(source.charCodeAt(index))) { - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; -} - -// 7.8.4 String Literals - -function scanStringLiteral() { - var str = '', - quote, start, ch, code, octal = false; - - quote = source[index]; - assert((quote === '\'' || quote === '"'), - 'String literal must starts with a quote'); - - start = index; - ++index; - - while (index < length) { - ch = source[index++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - - // \0 is not octal escape sequence - if (code !== 0) { - octal = true; - } - - if (index < length && isOctalDigit(source[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source[index++]); - - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.indexOf(ch) >= 0 && - index < length && - isOctalDigit(source[index])) { - code = code * 8 + '01234567'.indexOf(source[index++]); - } - } - str += String.fromCharCode(code); - } else { - str += ch; - } - break; - } - } else { - if (ch === '\r' && source[index] === '\n') { - ++index; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index - }; -} - -function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp - .replace(/\\u\{([0-9a-fA-F]+)\}/g, function($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - throwError({}, MessageInvalidRegExp); - }) - .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } - - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } - - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } -} - -function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - - ch = source[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source[index++]; - - classMarker = false; - terminated = false; - while (index < length) { - ch = source[index++]; - str += ch; - if (ch === '\\') { - ch = source[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } - - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; -} - -function scanRegExpFlags() { - var ch, str, flags; - - str = ''; - flags = ''; - while (index < length) { - ch = source[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index; - if (ch === '\\' && index < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; -} - -function scanRegExp() { - var start, body, flags, value; - - lookahead = null; - skipComment(); - start = index; - - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index - }; -} - -function isIdentifierName(token) { - return token.type === TokenIdentifier || - token.type === TokenKeyword || - token.type === TokenBooleanLiteral || - token.type === TokenNullLiteral; -} - -function advance() { - var ch; - - skipComment(); - - if (index >= length) { - return { - type: TokenEOF, - start: index, - end: index - }; - } - - ch = source.charCodeAt(index); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } - - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } - - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } - - - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source.charCodeAt(index + 1))) { - return scanNumericLiteral(); - } - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); -} - -function lex() { - var token; - - token = lookahead; - index = token.end; - - lookahead = advance(); - - index = token.end; - - return token; -} - -function peek() { - var pos; - - pos = index; - - lookahead = advance(); - index = pos; -} - -function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; -} - -function finishBinaryExpression(operator, left, right) { - var node = new ASTNode((operator === '||' || operator === '&&') ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; -} - -function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; -} - -function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; -} - -function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; -} - -function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - node.regex = token.regex; - } - return node; -} - -function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; -} - -function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; -} - -function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; -} - -function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; -} - -// Throw an exception - -function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace( - /%(\d)/g, - function(whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - } - ); - - - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; -} - -// Throw an exception because of the token. - -function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } - - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); -} - -// Expect the next token to match the specified punctuator. -// If not, an exception will be thrown. - -function expect(value) { - var token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } -} - -// Return true if the next token matches the specified punctuator. - -function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; -} - -// Return true if the next token matches the specified keyword - -function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; -} - -// 11.1.4 Array Initialiser - -function parseArrayInitialiser() { - var elements = []; - - index = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - - return finishArrayExpression(elements); -} - -// 11.1.5 Object Initialiser - -function parseObjectPropertyKey() { - var token; - - index = lookahead.start; - token = lex(); - - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - return finishLiteral(token); - } - - return finishIdentifier(token.value); -} - -function parseObjectProperty() { - var token, key, id, value; - - index = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } -} - -function parseObjectInitialiser() { - var properties = [], - property, name, key, map = {}, - toString = String; - - index = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - - return finishObjectExpression(properties); -} - -// 11.1.6 The Grouping Operator - -function parseGroupExpression() { - var expr; - - expect('('); - - expr = parseExpression(); - - expect(')'); - - return expr; -} - - -// 11.1 Primary Expressions - -var legalKeywords = { - 'if': 1 -}; - -function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index = lookahead.start; - - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = (token.value === 'true'); - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek(); - } else { - throwUnexpected(lex()); - } - - return expr; -} - -// 11.2 Left-Hand-Side Expressions - -function parseArguments() { - var args = []; - - expect('('); - - if (!match(')')) { - while (index < length) { - args.push(parseConditionalExpression()); - if (match(')')) { - break; - } - expect(','); - } - } - - expect(')'); - - return args; -} - -function parseNonComputedProperty() { - var token; - index = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); -} - -function parseNonComputedMember() { - expect('.'); - - return parseNonComputedProperty(); -} - -function parseComputedMember() { - var expr; - - expect('['); - - expr = parseExpression(); - - expect(']'); - - return expr; -} - -function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; -} - -// 11.3 Postfix Expressions - -function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if ((match('++') || match('--'))) { - throw new Error(DISABLED); - } - } - - return expr; -} - -// 11.4 Unary Operators - -function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; -} - -function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - - default: - break; - } - - return prec; -} - -// 11.5 Multiplicative Operators -// 11.6 Additive Operators -// 11.7 Bitwise Shift Operators -// 11.8 Relational Operators -// 11.9 Equality Operators -// 11.10 Binary Bitwise Operators -// 11.11 Binary Logical Operators - -function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - - marker = lookahead; - left = parseUnaryExpression(); - - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) { - return left; - } - token.prec = prec; - lex(); - - markers = [marker, lookahead]; - right = parseUnaryExpression(); - - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - - // Reduce: make a binary expression from the three topmost entries. - while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; -} - -// 11.12 Conditional Operator - -function parseConditionalExpression() { - var expr, consequent, alternate; - - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; -} - -// 11.14 Comma Operator - -function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; -} - -export default function(code) { - source = code; - index = 0; - length = source.length; - lookahead = null; - - peek(); - - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - return expr; -} diff --git a/node_modules/vega-force/LICENSE b/node_modules/vega-force/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-force/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-force/README.md b/node_modules/vega-force/README.md deleted file mode 100644 index b2a9289..0000000 --- a/node_modules/vega-force/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# vega-force - -Force simulation transform for Vega dataflows. - -This package provides the following Vega data transform: - -- [**Force**](https://vega.github.io/vega/docs/transforms/force/) [<>](https://github.com/vega/vega/blob/master/packages/vega-force/src/Force.js "Source") diff --git a/node_modules/vega-force/build/vega-force.js b/node_modules/vega-force/build/vega-force.js deleted file mode 100644 index 2358713..0000000 --- a/node_modules/vega-force/build/vega-force.js +++ /dev/null @@ -1,250 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-dataflow'), require('vega-util'), require('d3-force')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-dataflow', 'vega-util', 'd3-force'], factory) : - (global = global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.vega, global.vega, global.d3)); -}(this, (function (exports, vegaDataflow, vegaUtil, d3Force) { 'use strict'; - - var ForceMap = { - center: d3Force.forceCenter, - collide: d3Force.forceCollide, - nbody: d3Force.forceManyBody, - link: d3Force.forceLink, - x: d3Force.forceX, - y: d3Force.forceY - }; - - var Forces = 'forces', - ForceParams = [ - 'alpha', 'alphaMin', 'alphaTarget', - 'velocityDecay', 'forces' - ], - ForceConfig = ['static', 'iterations'], - ForceOutput = ['x', 'y', 'vx', 'vy']; - - /** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.forces - The forces to apply. - */ - function Force(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Force.Definition = { - 'type': 'Force', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'static', 'type': 'boolean', 'default': false }, - { 'name': 'restart', 'type': 'boolean', 'default': false }, - { 'name': 'iterations', 'type': 'number', 'default': 300 }, - { 'name': 'alpha', 'type': 'number', 'default': 1 }, - { 'name': 'alphaMin', 'type': 'number', 'default': 0.001 }, - { 'name': 'alphaTarget', 'type': 'number', 'default': 0 }, - { 'name': 'velocityDecay', 'type': 'number', 'default': 0.4 }, - { 'name': 'forces', 'type': 'param', 'array': true, - 'params': [ - { - 'key': {'force': 'center'}, - 'params': [ - { 'name': 'x', 'type': 'number', 'default': 0 }, - { 'name': 'y', 'type': 'number', 'default': 0 } - ] - }, - { - 'key': {'force': 'collide'}, - 'params': [ - { 'name': 'radius', 'type': 'number', 'expr': true }, - { 'name': 'strength', 'type': 'number', 'default': 0.7 }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'nbody'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': -30 }, - { 'name': 'theta', 'type': 'number', 'default': 0.9 }, - { 'name': 'distanceMin', 'type': 'number', 'default': 1 }, - { 'name': 'distanceMax', 'type': 'number' } - ] - }, - { - 'key': {'force': 'link'}, - 'params': [ - { 'name': 'links', 'type': 'data' }, - { 'name': 'id', 'type': 'field' }, - { 'name': 'distance', 'type': 'number', 'default': 30, 'expr': true }, - { 'name': 'strength', 'type': 'number', 'expr': true }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'x'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'x', 'type': 'field' } - ] - }, - { - 'key': {'force': 'y'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'y', 'type': 'field' } - ] - } - ] }, - { - 'name': 'as', 'type': 'string', 'array': true, 'modify': false, - 'default': ForceOutput - } - ] - }; - - var prototype = vegaUtil.inherits(Force, vegaDataflow.Transform); - - prototype.transform = function(_, pulse) { - var sim = this.value, - change = pulse.changed(pulse.ADD_REM), - params = _.modified(ForceParams), - iters = _.iterations || 300; - - // configure simulation - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - pulse.modifies('index'); - } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - if (params || pulse.changed(pulse.MOD)) { - setup(sim, _, 0, pulse); - } - } - - // run simulation - if (params || change || _.modified(ForceConfig) - || (pulse.changed() && _.restart)) - { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)) - .alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - - if (_.static) { - for (sim.stop(); --iters >= 0;) sim.tick(); - } else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } - } - - return this.finish(_, pulse); - }; - - prototype.finish = function(_, pulse) { - var dataflow = pulse.dataflow; - - // inspect dependencies, touch link source data - for (var args=this._argops, j=0, m=args.length, arg; j=0;)f.tick();else if(f.stopped()&&f.restart(),!u)return t.StopPropagation;return this.finish(e,t)},s.finish=function(e,t){for(var a,r=t.dataflow,n=this._argops,o=0,i=n.length;o} params.forces - The forces to apply. - */ -export default function Force(params) { - Transform.call(this, null, params); -} - -Force.Definition = { - 'type': 'Force', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'static', 'type': 'boolean', 'default': false }, - { 'name': 'restart', 'type': 'boolean', 'default': false }, - { 'name': 'iterations', 'type': 'number', 'default': 300 }, - { 'name': 'alpha', 'type': 'number', 'default': 1 }, - { 'name': 'alphaMin', 'type': 'number', 'default': 0.001 }, - { 'name': 'alphaTarget', 'type': 'number', 'default': 0 }, - { 'name': 'velocityDecay', 'type': 'number', 'default': 0.4 }, - { 'name': 'forces', 'type': 'param', 'array': true, - 'params': [ - { - 'key': {'force': 'center'}, - 'params': [ - { 'name': 'x', 'type': 'number', 'default': 0 }, - { 'name': 'y', 'type': 'number', 'default': 0 } - ] - }, - { - 'key': {'force': 'collide'}, - 'params': [ - { 'name': 'radius', 'type': 'number', 'expr': true }, - { 'name': 'strength', 'type': 'number', 'default': 0.7 }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'nbody'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': -30 }, - { 'name': 'theta', 'type': 'number', 'default': 0.9 }, - { 'name': 'distanceMin', 'type': 'number', 'default': 1 }, - { 'name': 'distanceMax', 'type': 'number' } - ] - }, - { - 'key': {'force': 'link'}, - 'params': [ - { 'name': 'links', 'type': 'data' }, - { 'name': 'id', 'type': 'field' }, - { 'name': 'distance', 'type': 'number', 'default': 30, 'expr': true }, - { 'name': 'strength', 'type': 'number', 'expr': true }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'x'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'x', 'type': 'field' } - ] - }, - { - 'key': {'force': 'y'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'y', 'type': 'field' } - ] - } - ] }, - { - 'name': 'as', 'type': 'string', 'array': true, 'modify': false, - 'default': ForceOutput - } - ] -}; - -var prototype = inherits(Force, Transform); - -prototype.transform = function(_, pulse) { - var sim = this.value, - change = pulse.changed(pulse.ADD_REM), - params = _.modified(ForceParams), - iters = _.iterations || 300; - - // configure simulation - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - pulse.modifies('index'); - } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - if (params || pulse.changed(pulse.MOD)) { - setup(sim, _, 0, pulse); - } - } - - // run simulation - if (params || change || _.modified(ForceConfig) - || (pulse.changed() && _.restart)) - { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)) - .alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - - if (_.static) { - for (sim.stop(); --iters >= 0;) sim.tick(); - } else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } - } - - return this.finish(_, pulse); -}; - -prototype.finish = function(_, pulse) { - var dataflow = pulse.dataflow; - - // inspect dependencies, touch link source data - for (var args=this._argops, j=0, m=args.length, arg; j# -vega.numberFormatLocale(definition) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source") - -Returns a locale object with methods for number formatting, based on the provided *definition*. The *definition* argument must match the format expected by [d3-format](https://github.com/d3/d3-format#formatLocale). For examples of definition files for a variety of languages, see the [d3-format locale collection](https://github.com/d3/d3-format/tree/master/locale). - -# -locale.format([specifier]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source") - -Returns a function that takes a number as input and returns a formatted string. If a string-valued format _specifier_ is provided, it must follow the [d3-format](https://github.com/d3/d3-format/#locale_format) syntax. The returned function is akin to d3-format's [format](https://github.com/d3/d3-format/#format) method. - -# -locale.formatPrefix(specifier, value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source") - -Returns a function that takes a number as input and returns a formatted string, with a fixed SI prefix anchored at the provided value. The string-valued format _specifier_ must follow the [d3-format](https://github.com/d3/d3-format/#locale_format) syntax. The returned function is akin to d3-format's [formatPrefix](https://github.com/d3/d3-format/#formatPrefix) method. - -# -locale.formatFloat([specifier]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source") - -Returns a function that takes a number as input and returns a formatted string. This method is similar to the [format](#format) method, except that if the specifier does not provide a precision, the returned formatter will use a variable (floating) precision depending on the number of significant digits. Vega uses this method to provide improved formatting for values plotted on a logarithmic scale. - -# -locale.formatSpan(start, stop, count[, specifier]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source") - -Returns a function that takes a number as input and returns a formatted string appropriate for a specified span of numbers defined by *start* and *stop* values and a *count* of values in the range. Based on these values, the method will attempt to find an appropriate precision. For example, to format 20 numbers on the range [0, 10], a precision of 0.1 (`'0.1f'`) will be used. An optional *specifier* can be used to further customize the format; if the *specifier* includes a numeric precision that value will override the span-based precision. - -# -vega.numberFormatDefaultLocale([definition]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source") - -Get or set the default locale for number formatting. If no arguments are provided, returns the current default locale. Otherwise, sets the default locale based on the provided *definition*, and returns the resulting locale object. The input definitions should be of the same type accepted by the [numberFormatLocale](#numberFormatLocale) method. - -# -vega.resetNumberFormatDefaultLocale() -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source") - -Resets the default locale for number formatting and returns the resulting locale object. The new default number locale for Vega will match the current default locale for the underlying d3-format library. - -### Time Format Locale - -# -vega.timeFormatLocale(definition) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source") - -Returns a locale object with methods for time formatting, based on the provided *definition*. The *definition* argument must match the format expected by [d3-time-format](https://github.com/d3/d3-time-format#timeFormatLocale). For examples of definition files for a variety of languages, see the [d3-time-format locale collection](https://github.com/d3/d3-time-format/tree/master/locale). - -# -locale.timeFormat([specifier]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source") - -Returns a function that takes a date or timestamp as input and returns a formatted string in the local timezone. If a string-valued format _specifier_ is provided, it must follow the [d3-time-format](https://github.com/d3/d3-time-format/#locale_format) syntax. The returned function is akin to d3-time-format's [timeFormat](https://github.com/d3/d3-time-format/#timeFormat) method. - -If an object-valued _specifier_ is provided, a multi-format function will be generated, which selects among different format specifiers based on the granularity of the input date value (that is, values residing on a year, month, date, _etc._, boundary can all be formatted differently). The input object should use proper time unit strings for keys. If no time format _specifier_ is provided, a default multi-format function is returned, equivalent to using the following _specifier_: - -```json -{ - "year": "%Y", - "quarter": "%B", - "month": "%B", - "week": "%b %d", - "date": "%a %d", - "hours": "%I %p", - "minutes": "%I:%M", - "seconds": ":%S", - "milliseconds": ".%L" -} -``` - -If an input _specifier_ object omits any of these key values, a default value will be used. Note that for this method the `"date"` and `"day"` units are interchangeable; if both are defined the `"date"` entry take precedence. - -# -locale.utcFormat([specifier]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source") - -Returns a function that takes a date or timestamp as input and returns a formatted string in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC). If a string-valued format _specifier_ is provided, it must follow the [d3-time-format](https://github.com/d3/d3-time-format/#locale_format) syntax. The returned function is akin to d3-time-format's [utcFormat](https://github.com/d3/d3-time-format/#utcFormat) method. - -This method also accepts object-valued _specifiers_ for creating multi-format functions. If no argumennts are provided, a defualt multi-format function will be returned. For more details, see the [timeFormat](#timeFormat) method documentation. - -# -locale.timeParse(specifier) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source") - -Returns a function that takes a string as input and returns a date. The string-valued format _specifier_ must follow the [d3-time-format](https://github.com/d3/d3-time-format/#locale_format) syntax. The returned function is akin to d3-time-format's [timeParse](https://github.com/d3/d3-time-format/#timeParse) method. - -# -locale.utcParse(specifier) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source") - -Returns a function that takes a string as input and returns a date in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC). The string-valued format _specifier_ must follow the [d3-time-format](https://github.com/d3/d3-time-format/#locale_format) syntax. The returned function is akin to d3-time-format's [utcParse](https://github.com/d3/d3-time-format/#utcParse) method. - -# -vega.timeFormatDefaultLocale([definition]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source") - -Get or set the default locale for time formatting. If no arguments are provided, returns the current default locale. Otherwise, sets the default locale based on the provided *definition*, and returns the resulting locale object. The input definitions should be of the same type accepted by the [timeFormatLocale](#timeFormatLocale) method. - -# -vega.resetTimeFormatDefaultLocale() -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source") - -Resets the default locale for time formatting and returns the resulting locale object. The new default time locale for Vega will match the current default locale for the underlying d3-time-format library. - -### Combined Locale - -Combined locale objects provide a convenient abstraction for both number and time formatting methods defined on a single object. A combined locale object contains the methods of both a number format locale object and a time format locale object. - -# -vega.locale(numberDefinition, timeDefinition) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/locale.js "Source") - -Returns a combined locale object with methods for both number and time formatting, based on the provided *numberDefinition* and *timeDefinition*. The definition arguments must match the format expected by [d3-format](https://github.com/d3/d3-format#formatLocale) and [d3-time-format](https://github.com/d3/d3-time-format#timeFormatLocale). If either argument is null or unspecified, the corresponding default locale is used instead. For examples of definition files for a variety of languages, see the [d3-format locale collection](https://github.com/d3/d3-format/tree/master/locale) and [d3-time-format locale collection](https://github.com/d3/d3-time-format/tree/master/locale). - -# -vega.defaultLocale([numberDefinition, timeDefinition]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/locale.js "Source") - -Get or set the default locale for both number and time formatting. If no arguments are provided, returns the current default locale. Otherwise, sets the default locales based on the provided *numberDefinition* and *timeDefinition*, and returns the resulting combined locale object. The input definitions should be of the same type accepted by the [locale](#locale) method. - -# -vega.resetDefaultLocale() -[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/locale.js "Source") - -Resets the default locale for both number and time formatting and returns the resulting comgined locale object. The new default locales for Vega will match the current default locales for the underlying d3-format and d3-time-format libraries. diff --git a/node_modules/vega-format/build/vega-format.js b/node_modules/vega-format/build/vega-format.js deleted file mode 100644 index 49dd347..0000000 --- a/node_modules/vega-format/build/vega-format.js +++ /dev/null @@ -1,239 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-format'), require('vega-time'), require('vega-util'), require('d3-time-format')) : - typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-format', 'vega-time', 'vega-util', 'd3-time-format'], factory) : - (global = global || self, factory(global.vega = {}, global.d3, global.d3, global.vega, global.vega, global.d3)); -}(this, (function (exports, d3Array, d3Format, vegaTime, vegaUtil, d3TimeFormat) { 'use strict'; - - function memoize(method) { - const cache = {}; - return spec => cache[spec] || (cache[spec] = method(spec)); - } - - function trimZeroes(numberFormat, decimalChar) { - return x => { - var str = numberFormat(x), - dec = str.indexOf(decimalChar), - idx, end; - - if (dec < 0) return str; - - idx = rightmostDigit(str, dec); - end = idx < str.length ? str.slice(idx) : ''; - while (--idx > dec) if (str[idx] !== '0') { ++idx; break; } - - return str.slice(0, idx) + end; - }; - } - - function rightmostDigit(str, dec) { - var i = str.lastIndexOf('e'), c; - if (i > 0) return i; - for (i=str.length; --i > dec;) { - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit - } - } - - function numberLocale(locale) { - const format = memoize(locale.format), - formatPrefix = locale.formatPrefix; - - return { - format, - formatPrefix, - formatFloat(spec) { - var s = d3Format.formatSpecifier(spec || ','); - if (s.precision == null) { - s.precision = 12; - switch (s.type) { - case '%': s.precision -= 2; break; - case 'e': s.precision -= 1; break; - } - return trimZeroes( - format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else { - return format(s); - } - }, - formatSpan(start, stop, count, specifier) { - specifier = d3Format.formatSpecifier(specifier == null ? ',f' : specifier); - const step = d3Array.tickStep(start, stop, count), - value = Math.max(Math.abs(start), Math.abs(stop)); - let precision; - - if (specifier.precision == null) { - switch (specifier.type) { - case 's': { - if (!isNaN(precision = d3Format.precisionPrefix(step, value))) { - specifier.precision = precision; - } - return formatPrefix(specifier, value); - } - case '': - case 'e': - case 'g': - case 'p': - case 'r': { - if (!isNaN(precision = d3Format.precisionRound(step, value))) { - specifier.precision = precision - (specifier.type === 'e'); - } - break; - } - case 'f': - case '%': { - if (!isNaN(precision = d3Format.precisionFixed(step))) { - specifier.precision = precision - (specifier.type === '%') * 2; - } - break; - } - } - } - return format(specifier); - } - }; - } - - let defaultNumberLocale; - resetNumberFormatDefaultLocale(); - - function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: d3Format.format, - formatPrefix: d3Format.formatPrefix - }); - } - - function numberFormatLocale(definition) { - return numberLocale(d3Format.formatLocale(definition)); - } - - function numberFormatDefaultLocale(definition) { - return arguments.length - ? (defaultNumberLocale = numberFormatLocale(definition)) - : defaultNumberLocale; - } - - function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - if (!vegaUtil.isObject(spec)) { - vegaUtil.error(`Invalid time multi-format specifier: ${spec}`); - } - - const second = interval(vegaTime.SECONDS), - minute = interval(vegaTime.MINUTES), - hour = interval(vegaTime.HOURS), - day = interval(vegaTime.DATE), - week = interval(vegaTime.WEEK), - month = interval(vegaTime.MONTH), - quarter = interval(vegaTime.QUARTER), - year = interval(vegaTime.YEAR), - L = format(spec[vegaTime.MILLISECONDS] || '.%L'), - S = format(spec[vegaTime.SECONDS] || ':%S'), - M = format(spec[vegaTime.MINUTES] || '%I:%M'), - H = format(spec[vegaTime.HOURS] || '%I %p'), - d = format(spec[vegaTime.DATE] || spec[vegaTime.DAY] || '%a %d'), - w = format(spec[vegaTime.WEEK] || '%b %d'), - m = format(spec[vegaTime.MONTH] || '%B'), - q = format(spec[vegaTime.QUARTER] || '%B'), - y = format(spec[vegaTime.YEAR] || '%Y'); - - return date => ( - second(date) < date ? L : - minute(date) < date ? S : - hour(date) < date ? M : - day(date) < date ? H : - month(date) < date ? (week(date) < date ? d : w) : - year(date) < date ? (quarter(date) < date ? m : q) : - y)(date); - } - - function timeLocale(locale) { - const timeFormat = memoize(locale.format), - utcFormat = memoize(locale.utcFormat); - - return { - timeFormat: spec => vegaUtil.isString(spec) - ? timeFormat(spec) - : timeMultiFormat(timeFormat, vegaTime.timeInterval, spec), - utcFormat: spec => vegaUtil.isString(spec) - ? utcFormat(spec) - : timeMultiFormat(utcFormat, vegaTime.utcInterval, spec), - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; - } - - let defaultTimeLocale; - resetTimeFormatDefaultLocale(); - - function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: d3TimeFormat.timeFormat, - parse: d3TimeFormat.timeParse, - utcFormat: d3TimeFormat.utcFormat, - utcParse: d3TimeFormat.utcParse - }); - } - - function timeFormatLocale(definition) { - return timeLocale(d3TimeFormat.timeFormatLocale(definition)); - } - - function timeFormatDefaultLocale(definition) { - return arguments.length - ? (defaultTimeLocale = timeFormatLocale(definition)) - : defaultTimeLocale; - } - - const createLocale = (number, time) => vegaUtil.extend({}, number, time); - - function locale(numberSpec, timeSpec) { - const number = numberSpec - ? numberFormatLocale(numberSpec) - : numberFormatDefaultLocale(); - - const time = timeSpec - ? timeFormatLocale(timeSpec) - : timeFormatDefaultLocale(); - - return createLocale(number, time); - } - - function defaultLocale(numberSpec, timeSpec) { - const args = arguments.length; - if (args && args !== 2) { - vegaUtil.error('defaultLocale expects either zero or two arguments.'); - } - - return args - ? createLocale( - numberFormatDefaultLocale(numberSpec), - timeFormatDefaultLocale(timeSpec) - ) - : createLocale( - numberFormatDefaultLocale(), - timeFormatDefaultLocale() - ); - } - - function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); - } - - exports.defaultLocale = defaultLocale; - exports.locale = locale; - exports.numberFormatDefaultLocale = numberFormatDefaultLocale; - exports.numberFormatLocale = numberFormatLocale; - exports.resetDefaultLocale = resetDefaultLocale; - exports.resetNumberFormatDefaultLocale = resetNumberFormatDefaultLocale; - exports.resetTimeFormatDefaultLocale = resetTimeFormatDefaultLocale; - exports.timeFormatDefaultLocale = timeFormatDefaultLocale; - exports.timeFormatLocale = timeFormatLocale; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-format/build/vega-format.min.js b/node_modules/vega-format/build/vega-format.min.js deleted file mode 100644 index 3521479..0000000 --- a/node_modules/vega-format/build/vega-format.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-format"),require("vega-time"),require("vega-util"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-format","vega-time","vega-util","d3-time-format"],t):t((e=e||self).vega={},e.d3,e.d3,e.vega,e.vega,e.d3)}(this,(function(e,t,r,a,i,n){"use strict";function o(e){const t={};return r=>t[r]||(t[r]=e(r))}function c(e){const a=o(e.format),i=e.formatPrefix;return{format:a,formatPrefix:i,formatFloat(e){var t,i,n=r.formatSpecifier(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return t=a(n),i=a(".1f")(1)[1],e=>{var r,a,n=t(e),o=n.indexOf(i);if(o<0)return n;for(a=(r=function(e,t){var r,a=e.lastIndexOf("e");if(a>0)return a;for(a=e.length;--a>t;)if((r=e.charCodeAt(a))>=48&&r<=57)return a+1}(n,o))o;)if("0"!==n[r]){++r;break}return n.slice(0,r)+a}}return a(n)},formatSpan(e,n,o,c){c=r.formatSpecifier(null==c?",f":c);const u=t.tickStep(e,n,o),f=Math.max(Math.abs(e),Math.abs(n));let s;if(null==c.precision)switch(c.type){case"s":return isNaN(s=r.precisionPrefix(u,f))||(c.precision=s),i(c,f);case"":case"e":case"g":case"p":case"r":isNaN(s=r.precisionRound(u,f))||(c.precision=s-("e"===c.type));break;case"f":case"%":isNaN(s=r.precisionFixed(u))||(c.precision=s-2*("%"===c.type))}return a(c)}}}let u,f;function s(){return u=c({format:r.format,formatPrefix:r.formatPrefix})}function m(e){return c(r.formatLocale(e))}function l(e){return arguments.length?u=m(e):u}function p(e,t,r){r=r||{},i.isObject(r)||i.error("Invalid time multi-format specifier: "+r);const n=t(a.SECONDS),o=t(a.MINUTES),c=t(a.HOURS),u=t(a.DATE),f=t(a.WEEK),s=t(a.MONTH),m=t(a.QUARTER),l=t(a.YEAR),p=e(r[a.MILLISECONDS]||".%L"),d=e(r[a.SECONDS]||":%S"),S=e(r[a.MINUTES]||"%I:%M"),g=e(r[a.HOURS]||"%I %p"),E=e(r[a.DATE]||r[a.DAY]||"%a %d"),F=e(r[a.WEEK]||"%b %d"),v=e(r[a.MONTH]||"%B"),x=e(r[a.QUARTER]||"%B"),L=e(r[a.YEAR]||"%Y");return e=>(n(e)i.isString(e)?t(e):p(t,a.timeInterval,e),utcFormat:e=>i.isString(e)?r(e):p(r,a.utcInterval,e),timeParse:o(e.parse),utcParse:o(e.utcParse)}}function S(){return f=d({format:n.timeFormat,parse:n.timeParse,utcFormat:n.utcFormat,utcParse:n.utcParse})}function g(e){return d(n.timeFormatLocale(e))}function E(e){return arguments.length?f=g(e):f}s(),S();const F=(e,t)=>i.extend({},e,t);function v(e,t){const r=arguments.length;return r&&2!==r&&i.error("defaultLocale expects either zero or two arguments."),r?F(l(e),E(t)):F(l(),E())}e.defaultLocale=v,e.locale=function(e,t){const r=e?m(e):l(),a=t?g(t):E();return F(r,a)},e.numberFormatDefaultLocale=l,e.numberFormatLocale=m,e.resetDefaultLocale=function(){return s(),S(),v()},e.resetNumberFormatDefaultLocale=s,e.resetTimeFormatDefaultLocale=S,e.timeFormatDefaultLocale=E,e.timeFormatLocale=g,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-format/index.js b/node_modules/vega-format/index.js deleted file mode 100644 index cfa4561..0000000 --- a/node_modules/vega-format/index.js +++ /dev/null @@ -1,17 +0,0 @@ -export { - numberFormatDefaultLocale, - numberFormatLocale, - resetNumberFormatDefaultLocale -} from './src/number'; - -export { - timeFormatDefaultLocale, - timeFormatLocale, - resetTimeFormatDefaultLocale -} from './src/time'; - -export { - locale, - defaultLocale, - resetDefaultLocale -} from './src/locale'; diff --git a/node_modules/vega-format/package.json b/node_modules/vega-format/package.json deleted file mode 100644 index 122923c..0000000 --- a/node_modules/vega-format/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_from": "vega-format@~1.0.1", - "_id": "vega-format@1.0.1", - "_inBundle": false, - "_integrity": "sha512-f9IZ+SDHVFFneDDc+d8RfeJhXXvUgquAuM+1MZ2Rjf4xqpg+E8FSNQkh8wjeo82mc6G3KVa9hynSdfN/a0AktQ==", - "_location": "/vega-format", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-format@~1.0.1", - "name": "vega-format", - "escapedName": "vega-format", - "rawSpec": "~1.0.1", - "saveSpec": null, - "fetchSpec": "~1.0.1" - }, - "_requiredBy": [ - "/vega", - "/vega-dataflow", - "/vega-loader", - "/vega-view" - ], - "_resolved": "https://registry.npmjs.org/vega-format/-/vega-format-1.0.1.tgz", - "_shasum": "94b5be9eb3d6a8b315fcf3d523ed6a1bb2ea4d71", - "_spec": "vega-format@~1.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "^2.4.0", - "d3-format": "^1.4.4", - "d3-time-format": "^2.2.3", - "vega-time": "^2.0.0", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "JavaScript string formatting utilities for Vega.", - "gitHead": "8fe8d36961c128df8300e6bc4fe6aac1e537bbe0", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "format", - "number", - "date", - "time" - ], - "license": "BSD-3-Clause", - "main": "build/vega-format.js", - "module": "index", - "name": "vega-format", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-format.js -c -m -o build/vega-format.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g d3-array:d3,d3-format:d3,d3-time-format:d3,vega-time:vega,vega-util:vega -f umd -n vega -o build/vega-format.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "1.0.1" -} diff --git a/node_modules/vega-format/src/locale.js b/node_modules/vega-format/src/locale.js deleted file mode 100644 index b23dfdb..0000000 --- a/node_modules/vega-format/src/locale.js +++ /dev/null @@ -1,50 +0,0 @@ -import { - numberFormatDefaultLocale, - numberFormatLocale, - resetNumberFormatDefaultLocale -} from './number'; - -import { - resetTimeFormatDefaultLocale, - timeFormatDefaultLocale, - timeFormatLocale -} from './time'; - -import {error, extend} from 'vega-util'; - -const createLocale = (number, time) => extend({}, number, time); - -export function locale(numberSpec, timeSpec) { - const number = numberSpec - ? numberFormatLocale(numberSpec) - : numberFormatDefaultLocale(); - - const time = timeSpec - ? timeFormatLocale(timeSpec) - : timeFormatDefaultLocale(); - - return createLocale(number, time); -} - -export function defaultLocale(numberSpec, timeSpec) { - const args = arguments.length; - if (args && args !== 2) { - error('defaultLocale expects either zero or two arguments.'); - } - - return args - ? createLocale( - numberFormatDefaultLocale(numberSpec), - timeFormatDefaultLocale(timeSpec) - ) - : createLocale( - numberFormatDefaultLocale(), - timeFormatDefaultLocale() - ); -} - -export function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); -} diff --git a/node_modules/vega-format/src/memoize.js b/node_modules/vega-format/src/memoize.js deleted file mode 100644 index f7019f3..0000000 --- a/node_modules/vega-format/src/memoize.js +++ /dev/null @@ -1,4 +0,0 @@ -export default function(method) { - const cache = {}; - return spec => cache[spec] || (cache[spec] = method(spec)); -} diff --git a/node_modules/vega-format/src/number.js b/node_modules/vega-format/src/number.js deleted file mode 100644 index ae09926..0000000 --- a/node_modules/vega-format/src/number.js +++ /dev/null @@ -1,117 +0,0 @@ -import memoize from './memoize'; -import {tickStep} from 'd3-array'; -import { - format as d3_format, - formatLocale as d3_formatLocale, - formatPrefix as d3_formatPrefix, - formatSpecifier, - precisionFixed, - precisionPrefix, - precisionRound -} from 'd3-format'; - -function trimZeroes(numberFormat, decimalChar) { - return x => { - var str = numberFormat(x), - dec = str.indexOf(decimalChar), - idx, end; - - if (dec < 0) return str; - - idx = rightmostDigit(str, dec); - end = idx < str.length ? str.slice(idx) : ''; - while (--idx > dec) if (str[idx] !== '0') { ++idx; break; } - - return str.slice(0, idx) + end; - }; -} - -function rightmostDigit(str, dec) { - var i = str.lastIndexOf('e'), c; - if (i > 0) return i; - for (i=str.length; --i > dec;) { - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit - } -} - -function numberLocale(locale) { - const format = memoize(locale.format), - formatPrefix = locale.formatPrefix; - - return { - format, - formatPrefix, - formatFloat(spec) { - var s = formatSpecifier(spec || ','); - if (s.precision == null) { - s.precision = 12; - switch (s.type) { - case '%': s.precision -= 2; break; - case 'e': s.precision -= 1; break; - } - return trimZeroes( - format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else { - return format(s); - } - }, - formatSpan(start, stop, count, specifier) { - specifier = formatSpecifier(specifier == null ? ',f' : specifier); - const step = tickStep(start, stop, count), - value = Math.max(Math.abs(start), Math.abs(stop)); - let precision; - - if (specifier.precision == null) { - switch (specifier.type) { - case 's': { - if (!isNaN(precision = precisionPrefix(step, value))) { - specifier.precision = precision; - } - return formatPrefix(specifier, value); - } - case '': - case 'e': - case 'g': - case 'p': - case 'r': { - if (!isNaN(precision = precisionRound(step, value))) { - specifier.precision = precision - (specifier.type === 'e'); - } - break; - } - case 'f': - case '%': { - if (!isNaN(precision = precisionFixed(step))) { - specifier.precision = precision - (specifier.type === '%') * 2; - } - break; - } - } - } - return format(specifier); - } - }; -} - -let defaultNumberLocale; -resetNumberFormatDefaultLocale(); - -export function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: d3_format, - formatPrefix: d3_formatPrefix - }); -} - -export function numberFormatLocale(definition) { - return numberLocale(d3_formatLocale(definition)); -} - -export function numberFormatDefaultLocale(definition) { - return arguments.length - ? (defaultNumberLocale = numberFormatLocale(definition)) - : defaultNumberLocale; -} diff --git a/node_modules/vega-format/src/time.js b/node_modules/vega-format/src/time.js deleted file mode 100644 index e17bbcd..0000000 --- a/node_modules/vega-format/src/time.js +++ /dev/null @@ -1,86 +0,0 @@ -import memoize from './memoize'; -import { - DATE, DAY, HOURS, MILLISECONDS, MINUTES, MONTH, QUARTER, - SECONDS, WEEK, YEAR, timeInterval, utcInterval -} from 'vega-time'; -import {error, isObject, isString} from 'vega-util'; - -import { - timeFormat as d3_timeFormat, - timeFormatLocale as d3_timeFormatLocale, - timeParse as d3_timeParse, - utcFormat as d3_utcFormat, - utcParse as d3_utcParse -} from 'd3-time-format'; - -function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - if (!isObject(spec)) { - error(`Invalid time multi-format specifier: ${spec}`); - } - - const second = interval(SECONDS), - minute = interval(MINUTES), - hour = interval(HOURS), - day = interval(DATE), - week = interval(WEEK), - month = interval(MONTH), - quarter = interval(QUARTER), - year = interval(YEAR), - L = format(spec[MILLISECONDS] || '.%L'), - S = format(spec[SECONDS] || ':%S'), - M = format(spec[MINUTES] || '%I:%M'), - H = format(spec[HOURS] || '%I %p'), - d = format(spec[DATE] || spec[DAY] || '%a %d'), - w = format(spec[WEEK] || '%b %d'), - m = format(spec[MONTH] || '%B'), - q = format(spec[QUARTER] || '%B'), - y = format(spec[YEAR] || '%Y'); - - return date => ( - second(date) < date ? L : - minute(date) < date ? S : - hour(date) < date ? M : - day(date) < date ? H : - month(date) < date ? (week(date) < date ? d : w) : - year(date) < date ? (quarter(date) < date ? m : q) : - y)(date); -} - -function timeLocale(locale) { - const timeFormat = memoize(locale.format), - utcFormat = memoize(locale.utcFormat); - - return { - timeFormat: spec => isString(spec) - ? timeFormat(spec) - : timeMultiFormat(timeFormat, timeInterval, spec), - utcFormat: spec => isString(spec) - ? utcFormat(spec) - : timeMultiFormat(utcFormat, utcInterval, spec), - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; -} - -let defaultTimeLocale; -resetTimeFormatDefaultLocale(); - -export function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: d3_timeFormat, - parse: d3_timeParse, - utcFormat: d3_utcFormat, - utcParse: d3_utcParse - }); -} - -export function timeFormatLocale(definition) { - return timeLocale(d3_timeFormatLocale(definition)); -} - -export function timeFormatDefaultLocale(definition) { - return arguments.length - ? (defaultTimeLocale = timeFormatLocale(definition)) - : defaultTimeLocale; -} diff --git a/node_modules/vega-functions/LICENSE b/node_modules/vega-functions/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-functions/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-functions/README.md b/node_modules/vega-functions/README.md deleted file mode 100644 index 7dbd00b..0000000 --- a/node_modules/vega-functions/README.md +++ /dev/null @@ -1,137 +0,0 @@ -# vega-functions - -Function implementations for the [Vega expression language](https://vega.github.io/vega/docs/expressions/). Unlike the basic utility functions included in the [vega-expression](https://github.com/vega/vega/tree/master/packages/vega-expression) package, this package includes custom expression functions, many of which are specific to Vega dataflows. - -## Provided Functions - -This package provides the following expression functions. All other constants and functions are provided by the base [vega-expression](https://github.com/vega/vega/tree/master/packages/vega-expression) package. - -**Type Checking Functions** - -- [isArray](https://vega.github.io/vega/docs/expressions/#isArray) -- [isBoolean](https://vega.github.io/vega/docs/expressions/#isBoolean) -- [isDate](https://vega.github.io/vega/docs/expressions/#isDate) -- [isNumber](https://vega.github.io/vega/docs/expressions/#isNumber) -- [isObject](https://vega.github.io/vega/docs/expressions/#isObject) -- [isRegExp](https://vega.github.io/vega/docs/expressions/#isRegExp) -- [isString](https://vega.github.io/vega/docs/expressions/#isString) -- [isTuple](https://vega.github.io/vega/docs/expressions/#isTuple) - -**Type Coercion Functions** - -- [toBoolean](https://vega.github.io/vega/docs/expressions/#toBoolean) -- [toDate](https://vega.github.io/vega/docs/expressions/#toDate) -- [toNumber](https://vega.github.io/vega/docs/expressions/#toNumber) -- [toString](https://vega.github.io/vega/docs/expressions/#toString) - -**Math Functions** - -- [random](https://vega.github.io/vega/docs/expressions/#random) - -**Date/Time Functions** - -- [quarter](https://vega.github.io/vega/docs/expressions/#quarter) -- [utcquarter](https://vega.github.io/vega/docs/expressions/#utcquarter) - -**Array Functions** - -- [clampRange](https://vega.github.io/vega/docs/expressions/#clampRange) -- [extent](https://vega.github.io/vega/docs/expressions/#extent) -- [inrange](https://vega.github.io/vega/docs/expressions/#inrange) -- [lerp](https://vega.github.io/vega/docs/expressions/#lerp) -- [peek](https://vega.github.io/vega/docs/expressions/#peek) -- [sequence](https://vega.github.io/vega/docs/expressions/#sequence) -- [span](https://vega.github.io/vega/docs/expressions/#span) - -**String Functions** - -- [pad](https://vega.github.io/vega/docs/expressions/#pad) -- [truncate](https://vega.github.io/vega/docs/expressions/#truncate) - -**Object Functions** - -- [merge](https://vega.github.io/vega/docs/expressions/#merge) - -**Formatting Functions** - -- [format](https://vega.github.io/vega/docs/expressions/#format) -- [utcFormat](https://vega.github.io/vega/docs/expressions/#utcFormat) -- [utcParse](https://vega.github.io/vega/docs/expressions/#utcParse) -- [timeFormat](https://vega.github.io/vega/docs/expressions/#timeFormat) -- [timeParse](https://vega.github.io/vega/docs/expressions/#timeParse) -- [monthFormat](https://vega.github.io/vega/docs/expressions/#monthFormat) -- [monthAbbrevFormat](https://vega.github.io/vega/docs/expressions/#monthAbbrevFormat) -- [dayFormat](https://vega.github.io/vega/docs/expressions/#dayFormat) -- [dayAbbrevFormat](https://vega.github.io/vega/docs/expressions/#dayAbbrevFormat) - -**Color Functions** - -- [rgb](https://vega.github.io/vega/docs/expressions/#rgb) -- [lab](https://vega.github.io/vega/docs/expressions/#lab) -- [hcl](https://vega.github.io/vega/docs/expressions/#hcl) -- [hsl](https://vega.github.io/vega/docs/expressions/#hsl) - -**Event Functions** - -- [pinchDistance](https://vega.github.io/vega/docs/expressions/#pinchDistance) -- [pinchAngle](https://vega.github.io/vega/docs/expressions/#pinchAngle) -- [inScope](https://vega.github.io/vega/docs/expressions/#inScope) - -**Scale and Projection Functions** - -- [bandspace](https://vega.github.io/vega/docs/expressions/#bandspace) -- [bandwidth](https://vega.github.io/vega/docs/expressions/#bandwidth) -- [copy](https://vega.github.io/vega/docs/expressions/#copy) -- [domain](https://vega.github.io/vega/docs/expressions/#domain) -- [gradient](https://vega.github.io/vega/docs/expressions/#gradient) -- [invert](https://vega.github.io/vega/docs/expressions/#invert) -- [range](https://vega.github.io/vega/docs/expressions/#range) -- [scale](https://vega.github.io/vega/docs/expressions/#scale) -- [panLinear](https://vega.github.io/vega/docs/expressions/#panLinear) -- [panLog](https://vega.github.io/vega/docs/expressions/#panLog) -- [panPow](https://vega.github.io/vega/docs/expressions/#panPow) -- [panSymlog](https://vega.github.io/vega/docs/expressions/#panSymlog) -- [zoomLinear](https://vega.github.io/vega/docs/expressions/#zoomLinear) -- [zoomLog](https://vega.github.io/vega/docs/expressions/#zoomLog) -- [zoomPow](https://vega.github.io/vega/docs/expressions/#zoomPow) -- [zoomSymlog](https://vega.github.io/vega/docs/expressions/#zoomSymlog) -- flush (used internally for axis and legend label layout) - -**Geographic Functions** - -- [geoArea](https://vega.github.io/vega/docs/expressions/#geoArea) -- [geoBounds](https://vega.github.io/vega/docs/expressions/#geoBounds) -- [geoCentroid](https://vega.github.io/vega/docs/expressions/#geoCentroid) - -**Shape Functions** - -- geoShape (used internally for mark clipping) -- pathShape (used internally for mark clipping) - -**Data Functions** - -- [indata](https://vega.github.io/vega/docs/expressions/#indata) -- [data](https://vega.github.io/vega/docs/expressions/#data) -- setdata (used internally for scale domain data) -- modify (used internally for trigger updates) - -**Dataflow Functions** - -- encode (used internally for signal updates) - -**Tree (Hierarchy) Functions** - -- [treePath](https://vega.github.io/vega/docs/expressions/#treePath) -- [treeAncestors](https://vega.github.io/vega/docs/expressions/#treeAncestors) - -**Browser Functions** - -- [screen](https://vega.github.io/vega/docs/expressions/#screen) -- [containerSize](https://vega.github.io/vega/docs/expressions/#containerSize) -- [windowSize](https://vega.github.io/vega/docs/expressions/#windowSize) - -**Logging Functions** - -- [warn](https://vega.github.io/vega/docs/expressions/#warn) -- [info](https://vega.github.io/vega/docs/expressions/#info) -- [debug](https://vega.github.io/vega/docs/expressions/#debug) diff --git a/node_modules/vega-functions/build/vega-functions.js b/node_modules/vega-functions/build/vega-functions.js deleted file mode 100644 index 859bf52..0000000 --- a/node_modules/vega-functions/build/vega-functions.js +++ /dev/null @@ -1,735 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('vega-expression'), require('d3-geo'), require('d3-color'), require('vega-dataflow'), require('vega-scale'), require('vega-scenegraph'), require('vega-selections'), require('vega-statistics'), require('vega-time'), require('d3-array')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'vega-expression', 'd3-geo', 'd3-color', 'vega-dataflow', 'vega-scale', 'vega-scenegraph', 'vega-selections', 'vega-statistics', 'vega-time', 'd3-array'], factory) : - (global = global || self, factory(global.vega = {}, global.vega, global.vega, global.d3, global.d3, global.vega, global.vega, global.vega, global.vega, global.vega, global.vega, global.d3)); -}(this, (function (exports, vegaUtil, vegaExpression, d3Geo, d3Color, vegaDataflow, vegaScale, vegaScenegraph, vegaSelections, vegaStatistics, vegaTime, d3Array) { 'use strict'; - - function data(name) { - const data = this.context.data[name]; - return data ? data.values.value : []; - } - - function indata(name, field, value) { - const index = this.context.data[name]['index:' + field], - entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; - } - - function setdata(name, tuples) { - const df = this.context.dataflow, - data = this.context.data[name], - input = data.input; - - df.pulse(input, df.changeset().remove(vegaUtil.truthy).insert(tuples)); - return 1; - } - - function encode(item, name, retval) { - if (item) { - const df = this.context.dataflow, - target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - return retval !== undefined ? retval : item; - } - - const wrap = method => function(value, spec) { - const locale = this.context.dataflow.locale(); - return locale[method](spec)(value); - }; - - const format = wrap('format'); - const timeFormat = wrap('timeFormat'); - const utcFormat = wrap('utcFormat'); - const timeParse = wrap('timeParse'); - const utcParse = wrap('utcParse'); - - var dateObj = new Date(2000, 0, 1); - - function time(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); - dateObj.setMonth(month); - dateObj.setDate(day); - return timeFormat.call(this, dateObj, specifier); - } - - function monthFormat(month) { - return time.call(this, month, 1, '%B'); - } - - function monthAbbrevFormat(month) { - return time.call(this, month, 1, '%b'); - } - - function dayFormat(day) { - return time.call(this, 0, 2 + day, '%A'); - } - - function dayAbbrevFormat(day) { - return time.call(this, 0, 2 + day, '%a'); - } - - const DataPrefix = ':'; - const IndexPrefix = '@'; - const ScalePrefix = '%'; - const SignalPrefix = '$'; - - function dataVisitor(name, args, scope, params) { - if (args[0].type !== vegaExpression.Literal) { - vegaUtil.error('First argument to data functions must be a string literal.'); - } - - const data = args[0].value, - dataName = DataPrefix + data; - - if (!vegaUtil.hasOwnProperty(dataName, params)) { - try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) { - // if data set does not exist, there's nothing to track - } - } - } - - function indataVisitor(name, args, scope, params) { - if (args[0].type !== vegaExpression.Literal) vegaUtil.error('First argument to indata must be a string literal.'); - if (args[1].type !== vegaExpression.Literal) vegaUtil.error('Second argument to indata must be a string literal.'); - - const data = args[0].value, - field = args[1].value, - indexName = IndexPrefix + field; - - if (!vegaUtil.hasOwnProperty(indexName, params)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - } - - function scaleVisitor(name, args, scope, params) { - if (args[0].type === vegaExpression.Literal) { - // add scale dependency - addScaleDependency(scope, params, args[0].value); - } else { - // indirect scale lookup; add all scales as parameters - for (name in scope.scales) { - addScaleDependency(scope, params, name); - } - } - } - - function addScaleDependency(scope, params, name) { - const scaleName = ScalePrefix + name; - if (!vegaUtil.hasOwnProperty(params, scaleName)) { - try { - params[scaleName] = scope.scaleRef(name); - } catch (err) { - // TODO: error handling? warning? - } - } - } - - function getScale(name, ctx) { - let s; - return vegaUtil.isFunction(name) ? name - : vegaUtil.isString(name) ? (s = ctx.scales[name]) && s.value - : undefined; - } - - function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = s => s && s.bandwidth ? s.bandwidth() : 0; - - // register AST visitors for internal scale functions - visitors._bandwidth = scaleVisitor; - visitors._range = scaleVisitor; - visitors._scale = scaleVisitor; - - // resolve scale reference directly to the signal hash argument - const ref = arg => '_[' + ( - arg.type === vegaExpression.Literal - ? vegaUtil.stringValue(ScalePrefix + arg.value) - : vegaUtil.stringValue(ScalePrefix) + '+' + codegen(arg) - ) + ']'; - - // define and return internal scale function code generators - // these internal functions are called by mark encoders - return { - _bandwidth: args => `this.__bandwidth(${ref(args[0])})`, - _range: args => `${ref(args[0])}.range()`, - _scale: args => `${ref(args[0])}(${codegen(args[1])})` - }; - } - - function geoMethod(methodName, globalMethod) { - return function(projection, geojson, group) { - if (projection) { - // projection defined, use it - const p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else { - // projection undefined, use global method - return globalMethod(geojson); - } - }; - } - - const geoArea = geoMethod('area', d3Geo.geoArea); - const geoBounds = geoMethod('bounds', d3Geo.geoBounds); - const geoCentroid = geoMethod('centroid', d3Geo.geoCentroid); - - function inScope(item) { - let group = this.context.group, - value = false; - - if (group) while (item) { - if (item === group) { value = true; break; } - item = item.mark.group; - } - return value; - } - - function log(df, method, args) { - try { - df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args))); - } catch (err) { - df.warn(err); - } - return args[args.length-1]; - } - - function warn() { - return log(this.context.dataflow, 'warn', arguments); - } - - function info() { - return log(this.context.dataflow, 'info', arguments); - } - - function debug() { - return log(this.context.dataflow, 'debug', arguments); - } - - // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - function channel_luminance_value(channelValue) { - const val = channelValue / 255; - if (val <= 0.03928) { - return val / 12.92; - } - return Math.pow((val + 0.055) / 1.055, 2.4); - } - - function luminance(color) { - const c = d3Color.rgb(color), - r = channel_luminance_value(c.r), - g = channel_luminance_value(c.g), - b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; - } - - // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef - function contrast(color1, color2) { - const lum1 = luminance(color1), - lum2 = luminance(color2), - lumL = Math.max(lum1, lum2), - lumD = Math.min(lum1, lum2); - return (lumL + 0.05) / (lumD + 0.05); - } - - function merge() { - var args = [].slice.call(arguments); - args.unshift({}); - return vegaUtil.extend.apply(null, args); - } - - function equal(a, b) { - return a === b || a !== a && b !== b ? true - : vegaUtil.isArray(a) ? ( - vegaUtil.isArray(b) && a.length === b.length ? equalArray(a, b) : false - ) - : vegaUtil.isObject(a) && vegaUtil.isObject(b) ? equalObject(a, b) - : false; - } - - function equalArray(a, b) { - for (let i=0, n=a.length; i equalObject(props, _); - } - - function modify(name, insert, remove, toggle, modify, values) { - let df = this.context.dataflow, - data = this.context.data[name], - input = data.input, - changes = data.changes, - stamp = df.stamp(), - predicate, key; - - if (df._trigger === false || !(input.value.length || insert || toggle)) { - // nothing to do! - return 0; - } - - if (!changes || changes.stamp < stamp) { - data.changes = (changes = df.changeset()); - changes.stamp = stamp; - df.runAfter(function() { - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - - if (remove) { - predicate = remove === true ? vegaUtil.truthy - : (vegaUtil.isArray(remove) || vegaDataflow.isTuple(remove)) ? remove - : removePredicate(remove); - changes.remove(predicate); - } - - if (insert) { - changes.insert(insert); - } - - if (toggle) { - predicate = removePredicate(toggle); - if (input.value.some(predicate)) { - changes.remove(predicate); - } else { - changes.insert(toggle); - } - } - - if (modify) { - for (key in values) { - changes.modify(modify, key, values[key]); - } - } - - return 1; - } - - function pinchDistance(event) { - const t = event.touches, - dx = t[0].clientX - t[1].clientX, - dy = t[0].clientY - t[1].clientY; - return Math.sqrt(dx * dx + dy * dy); - } - - function pinchAngle(event) { - const t = event.touches; - return Math.atan2( - t[0].clientY - t[1].clientY, - t[0].clientX - t[1].clientX - ); - } - - function bandspace(count, paddingInner, paddingOuter) { - return vegaScale.bandSpace(count || 0, paddingInner || 0, paddingOuter || 0); - } - - function bandwidth(name, group) { - const s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; - } - - function copy(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; - } - - function domain(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.domain() : []; - } - - function invert(name, range, group) { - const s = getScale(name, (group || this).context); - return !s ? undefined - : vegaUtil.isArray(range) ? (s.invertRange || s.invert)(range) - : (s.invert || s.invertExtent)(range); - } - - function range(name, group) { - const s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; - } - - function scale(name, value, group) { - const s = getScale(name, (group || this).context); - return s ? s(value) : undefined; - } - - function scaleGradient(scale, p0, p1, count, group) { - scale = getScale(scale, (group || this).context); - - const gradient = vegaScenegraph.Gradient(p0, p1); - - let stops = scale.domain(), - min = stops[0], - max = vegaUtil.peek(stops), - fraction = vegaUtil.identity; - - if (!(max - min)) { - // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator - ? vegaScale.scale('sequential')().interpolator(scale.interpolator()) - : vegaScale.scale('linear')().interpolate(scale.interpolate()).range(scale.range()) - ).domain([min=0, max=1]); - } else { - fraction = vegaScale.scaleFraction(scale, min, max); - } - - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== vegaUtil.peek(stops)) stops.push(max); - } - - stops.forEach(_ => gradient.stop(fraction(_), scale(_))); - - return gradient; - } - - function geoShape(projection, geojson, group) { - const p = getScale(projection, (group || this).context); - return function(context) { - return p ? p.path.context(context)(geojson) : ''; - }; - } - - function pathShape(path) { - let p = null; - return function(context) { - return context - ? vegaScenegraph.pathRender(context, (p = p || vegaScenegraph.pathParse(path))) - : path; - }; - } - - const datum = d => d.data; - - function treeNodes(name, context) { - const tree = data.call(context, name); - return tree.root && tree.root.lookup || {}; - } - - function treePath(name, source, target) { - const nodes = treeNodes(name, this), - s = nodes[source], - t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; - } - - function treeAncestors(name, node) { - const n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; - } - - const _window = () => (typeof window !== 'undefined' && window) || null; - - function screen() { - const w = _window(); - return w ? w.screen : {}; - } - - function windowSize() { - const w = _window(); - return w - ? [w.innerWidth, w.innerHeight] - : [undefined, undefined]; - } - - function containerSize() { - const view = this.context.dataflow, - el = view.container && view.container(); - return el - ? [el.clientWidth, el.clientHeight] - : [undefined, undefined]; - } - - function intersect(b, opt, group) { - if (!b) return []; - - const [u, v] = b, - box = new vegaScenegraph.Bounds().set(u[0], u[1], v[0], v[1]), - scene = group || this.context.dataflow.scenegraph().root; - - return vegaScenegraph.intersect(scene, box, filter(opt)); - } - - function filter(opt) { - let p = null; - - if (opt) { - const types = vegaUtil.array(opt.marktype), - names = vegaUtil.array(opt.markname); - p = _ => (!types.length || types.some(t => _.marktype === t)) - && (!names.length || names.some(s => _.name === s)); - } - - return p; - } - - // Expression function context object - const functionContext = { - random: function() { return vegaStatistics.random(); }, // override default - cumulativeNormal: vegaStatistics.cumulativeNormal, - cumulativeLogNormal: vegaStatistics.cumulativeLogNormal, - cumulativeUniform: vegaStatistics.cumulativeUniform, - densityNormal: vegaStatistics.densityNormal, - densityLogNormal: vegaStatistics.densityLogNormal, - densityUniform: vegaStatistics.densityUniform, - quantileNormal: vegaStatistics.quantileNormal, - quantileLogNormal: vegaStatistics.quantileLogNormal, - quantileUniform: vegaStatistics.quantileUniform, - sampleNormal: vegaStatistics.sampleNormal, - sampleLogNormal: vegaStatistics.sampleLogNormal, - sampleUniform: vegaStatistics.sampleUniform, - isArray: vegaUtil.isArray, - isBoolean: vegaUtil.isBoolean, - isDate: vegaUtil.isDate, - isDefined: function(_) { return _ !== undefined; }, - isNumber: vegaUtil.isNumber, - isObject: vegaUtil.isObject, - isRegExp: vegaUtil.isRegExp, - isString: vegaUtil.isString, - isTuple: vegaDataflow.isTuple, - isValid: function(_) { return _ != null && _ === _; }, - toBoolean: vegaUtil.toBoolean, - toDate: vegaUtil.toDate, - toNumber: vegaUtil.toNumber, - toString: vegaUtil.toString, - flush: vegaUtil.flush, - lerp: vegaUtil.lerp, - merge, - pad: vegaUtil.pad, - peek: vegaUtil.peek, - span: vegaUtil.span, - inrange: vegaUtil.inrange, - truncate: vegaUtil.truncate, - rgb: d3Color.rgb, - lab: d3Color.lab, - hcl: d3Color.hcl, - hsl: d3Color.hsl, - luminance, - contrast, - sequence: d3Array.range, - format, - utcFormat, - utcParse, - utcOffset: vegaTime.utcOffset, - utcSequence: vegaTime.utcSequence, - timeFormat, - timeParse, - timeOffset: vegaTime.timeOffset, - timeSequence: vegaTime.timeSequence, - timeUnitSpecifier: vegaTime.timeUnitSpecifier, - monthFormat, - monthAbbrevFormat, - dayFormat, - dayAbbrevFormat, - quarter: vegaUtil.quarter, - utcquarter: vegaUtil.utcquarter, - week: vegaTime.week, - utcweek: vegaTime.utcweek, - dayofyear: vegaTime.dayofyear, - utcdayofyear: vegaTime.utcdayofyear, - warn, - info, - debug, - extent: vegaUtil.extent, - inScope, - intersect, - clampRange: vegaUtil.clampRange, - pinchDistance, - pinchAngle, - screen, - containerSize, - windowSize, - bandspace, - setdata, - pathShape, - panLinear: vegaUtil.panLinear, - panLog: vegaUtil.panLog, - panPow: vegaUtil.panPow, - panSymlog: vegaUtil.panSymlog, - zoomLinear: vegaUtil.zoomLinear, - zoomLog: vegaUtil.zoomLog, - zoomPow: vegaUtil.zoomPow, - zoomSymlog: vegaUtil.zoomSymlog, - encode, - modify - }; - - const eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'], // event functions - eventPrefix = 'event.vega.', // event function prefix - thisPrefix = 'this.', // function context prefix - astVisitors = {}; // AST visitors for dependency analysis - - // Build expression function registry - function buildFunctions(codegen) { - const fn = vegaExpression.functions(codegen); - eventFunctions.forEach(name => fn[name] = eventPrefix + name); - for (let name in functionContext) { fn[name] = thisPrefix + name; } - vegaUtil.extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; - } - - // Register an expression function - function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) { - return functionContext[name]; - } - - // register with the functionContext - functionContext[name] = fn; - - // if there is an astVisitor register that, too - if (visitor) astVisitors[name] = visitor; - - // if the code generator has already been initialized, - // we need to also register the function with it - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; - } - - // register expression functions with ast visitors - expressionFunction('bandwidth', bandwidth, scaleVisitor); - expressionFunction('copy', copy, scaleVisitor); - expressionFunction('domain', domain, scaleVisitor); - expressionFunction('range', range, scaleVisitor); - expressionFunction('invert', invert, scaleVisitor); - expressionFunction('scale', scale, scaleVisitor); - expressionFunction('gradient', scaleGradient, scaleVisitor); - expressionFunction('geoArea', geoArea, scaleVisitor); - expressionFunction('geoBounds', geoBounds, scaleVisitor); - expressionFunction('geoCentroid', geoCentroid, scaleVisitor); - expressionFunction('geoShape', geoShape, scaleVisitor); - expressionFunction('indata', indata, indataVisitor); - expressionFunction('data', data, dataVisitor); - expressionFunction('treePath', treePath, dataVisitor); - expressionFunction('treeAncestors', treeAncestors, dataVisitor); - - // register Vega-Lite selection functions - expressionFunction('vlSelectionTest', vegaSelections.selectionTest, vegaSelections.selectionVisitor); - expressionFunction('vlSelectionResolve', vegaSelections.selectionResolve, vegaSelections.selectionVisitor); - - // Export code generator and parameters - const codegenParams = { - blacklist: ['_'], - whitelist: ['datum', 'event', 'item'], - fieldvar: 'datum', - globalvar: id => '_[' + vegaUtil.stringValue(SignalPrefix + id) + ']', - functions: buildFunctions, - constants: vegaExpression.constants, - visitors: astVisitors - }; - - var codeGenerator = vegaExpression.codegen(codegenParams); - - function parser(expr, scope) { - var params = {}, ast, gen; - - // parse the expression to an abstract syntax tree (ast) - try { - expr = vegaUtil.isString(expr) ? expr : (vegaUtil.stringValue(expr) + ''); - ast = vegaExpression.parse(expr); - } catch (err) { - vegaUtil.error('Expression parse error: ' + expr); - } - - // analyze ast function calls for dependencies - ast.visit(node => { - if (node.type !== vegaExpression.CallExpression) return; - var name = node.callee.name, - visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); - }); - - // perform code generation - gen = codeGenerator(ast); - - // collect signal dependencies - gen.globals.forEach(name => { - var signalName = SignalPrefix + name; - if (!vegaUtil.hasOwnProperty(params, signalName) && scope.getSignal(name)) { - params[signalName] = scope.signalRef(name); - } - }); - - // return generated expression code and dependencies - return { - $expr: vegaUtil.extend({code: gen.code}, scope.options.ast ? {ast} : null), - $fields: gen.fields, - $params: params - }; - } - - exports.DataPrefix = DataPrefix; - exports.IndexPrefix = IndexPrefix; - exports.ScalePrefix = ScalePrefix; - exports.SignalPrefix = SignalPrefix; - exports.bandspace = bandspace; - exports.bandwidth = bandwidth; - exports.codeGenerator = codeGenerator; - exports.codegenParams = codegenParams; - exports.containerSize = containerSize; - exports.contrast = contrast; - exports.copy = copy; - exports.data = data; - exports.dataVisitor = dataVisitor; - exports.dayAbbrevFormat = dayAbbrevFormat; - exports.dayFormat = dayFormat; - exports.debug = debug; - exports.domain = domain; - exports.encode = encode; - exports.expressionFunction = expressionFunction; - exports.format = format; - exports.functionContext = functionContext; - exports.geoArea = geoArea; - exports.geoBounds = geoBounds; - exports.geoCentroid = geoCentroid; - exports.geoShape = geoShape; - exports.inScope = inScope; - exports.indata = indata; - exports.indataVisitor = indataVisitor; - exports.info = info; - exports.invert = invert; - exports.luminance = luminance; - exports.merge = merge; - exports.modify = modify; - exports.monthAbbrevFormat = monthAbbrevFormat; - exports.monthFormat = monthFormat; - exports.parseExpression = parser; - exports.pathShape = pathShape; - exports.pinchAngle = pinchAngle; - exports.pinchDistance = pinchDistance; - exports.range = range; - exports.scale = scale; - exports.scaleGradient = scaleGradient; - exports.scaleVisitor = scaleVisitor; - exports.screen = screen; - exports.setdata = setdata; - exports.timeFormat = timeFormat; - exports.timeParse = timeParse; - exports.treeAncestors = treeAncestors; - exports.treePath = treePath; - exports.utcFormat = utcFormat; - exports.utcParse = utcParse; - exports.warn = warn; - exports.windowSize = windowSize; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-functions/build/vega-functions.min.js b/node_modules/vega-functions/build/vega-functions.min.js deleted file mode 100644 index 94ae9a2..0000000 --- a/node_modules/vega-functions/build/vega-functions.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util"),require("vega-expression"),require("d3-geo"),require("d3-color"),require("vega-dataflow"),require("vega-scale"),require("vega-scenegraph"),require("vega-selections"),require("vega-statistics"),require("vega-time"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","d3-geo","d3-color","vega-dataflow","vega-scale","vega-scenegraph","vega-selections","vega-statistics","vega-time","d3-array"],e):e((t=t||self).vega={},t.vega,t.vega,t.d3,t.d3,t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.d3)}(this,(function(t,e,n,r,a,o,i,s,c,u,l,f){"use strict";function d(t){const e=this.context.data[t];return e?e.values.value:[]}function m(t,e,n){const r=this.context.data[t]["index:"+e],a=r?r.value.get(n):void 0;return a?a.count:a}function g(t,n){const r=this.context.dataflow,a=this.context.data[t].input;return r.pulse(a,r.changeset().remove(e.truthy).insert(n)),1}function p(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t}const h=t=>function(e,n){return this.context.dataflow.locale()[t](n)(e)},v=h("format"),y=h("timeFormat"),x=h("utcFormat"),b=h("timeParse"),w=h("utcParse");var S=new Date(2e3,0,1);function q(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(S.setYear(2e3),S.setMonth(t),S.setDate(e),y.call(this,S,n)):""}function P(t){return q.call(this,t,1,"%B")}function N(t){return q.call(this,t,1,"%b")}function L(t){return q.call(this,0,2+t,"%A")}function A(t){return q.call(this,0,2+t,"%a")}function F(t,r,a,o){r[0].type!==n.Literal&&e.error("First argument to data functions must be a string literal.");const i=r[0].value,s=":"+i;if(!e.hasOwnProperty(s,o))try{o[s]=a.getData(i).tuplesRef()}catch(t){}}function k(t,r,a,o){r[0].type!==n.Literal&&e.error("First argument to indata must be a string literal."),r[1].type!==n.Literal&&e.error("Second argument to indata must be a string literal.");const i=r[0].value,s=r[1].value,c="@"+s;e.hasOwnProperty(c,o)||(o[c]=a.getData(i).indataRef(a,s))}function _(t,e,r,a){if(e[0].type===n.Literal)O(r,a,e[0].value);else for(t in r.scales)O(r,a,t)}function O(t,n,r){const a="%"+r;if(!e.hasOwnProperty(n,a))try{n[a]=t.scaleRef(r)}catch(t){}}function R(t,n){let r;return e.isFunction(t)?t:e.isString(t)?(r=n.scales[t])&&r.value:void 0}function z(t,e){return function(n,r,a){if(n){const e=R(n,(a||this).context);return e&&e.path[t](r)}return e(r)}}const D=z("area",r.geoArea),E=z("bounds",r.geoBounds),U=z("centroid",r.geoCentroid);function V(t){let e=this.context.group,n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n}function B(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}function $(){return B(this.context.dataflow,"warn",arguments)}function M(){return B(this.context.dataflow,"info",arguments)}function j(){return B(this.context.dataflow,"debug",arguments)}function C(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function T(t){const e=a.rgb(t);return.2126*C(e.r)+.7152*C(e.g)+.0722*C(e.b)}function X(t,e){const n=T(t),r=T(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Y(){var t=[].slice.call(arguments);return t.unshift({}),e.extend.apply(null,t)}function I(t,n){return t===n||t!=t&&n!=n||(e.isArray(t)?!(!e.isArray(n)||t.length!==n.length)&&function(t,e){for(let n=0,r=t.length;nG(t,e)}function W(t,n,r,a,i,s){let c,u,l=this.context.dataflow,f=this.context.data[t],d=f.input,m=f.changes,g=l.stamp();if(!1===l._trigger||!(d.value.length||n||a))return 0;if((!m||m.stampc.stop(d(e),t(e))),c}function it(t,e,n){const r=R(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}function st(t){let e=null;return function(n){return n?s.pathRender(n,e=e||s.pathParse(t)):t}}const ct=t=>t.data;function ut(t,e){const n=d.call(e,t);return n.root&&n.root.lookup||{}}function lt(t,e,n){const r=ut(t,this),a=r[e],o=r[n];return a&&o?a.path(o).map(ct):void 0}function ft(t,e){const n=ut(t,this)[e];return n?n.ancestors().map(ct):void 0}const dt=()=>"undefined"!=typeof window&&window||null;function mt(){const t=dt();return t?t.screen:{}}function gt(){const t=dt();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]}function pt(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]}const ht={random:function(){return u.random()},cumulativeNormal:u.cumulativeNormal,cumulativeLogNormal:u.cumulativeLogNormal,cumulativeUniform:u.cumulativeUniform,densityNormal:u.densityNormal,densityLogNormal:u.densityLogNormal,densityUniform:u.densityUniform,quantileNormal:u.quantileNormal,quantileLogNormal:u.quantileLogNormal,quantileUniform:u.quantileUniform,sampleNormal:u.sampleNormal,sampleLogNormal:u.sampleLogNormal,sampleUniform:u.sampleUniform,isArray:e.isArray,isBoolean:e.isBoolean,isDate:e.isDate,isDefined:function(t){return void 0!==t},isNumber:e.isNumber,isObject:e.isObject,isRegExp:e.isRegExp,isString:e.isString,isTuple:o.isTuple,isValid:function(t){return null!=t&&t==t},toBoolean:e.toBoolean,toDate:e.toDate,toNumber:e.toNumber,toString:e.toString,flush:e.flush,lerp:e.lerp,merge:Y,pad:e.pad,peek:e.peek,span:e.span,inrange:e.inrange,truncate:e.truncate,rgb:a.rgb,lab:a.lab,hcl:a.hcl,hsl:a.hsl,luminance:T,contrast:X,sequence:f.range,format:v,utcFormat:x,utcParse:w,utcOffset:l.utcOffset,utcSequence:l.utcSequence,timeFormat:y,timeParse:b,timeOffset:l.timeOffset,timeSequence:l.timeSequence,timeUnitSpecifier:l.timeUnitSpecifier,monthFormat:P,monthAbbrevFormat:N,dayFormat:L,dayAbbrevFormat:A,quarter:e.quarter,utcquarter:e.utcquarter,week:l.week,utcweek:l.utcweek,dayofyear:l.dayofyear,utcdayofyear:l.utcdayofyear,warn:$,info:M,debug:j,extent:e.extent,inScope:V,intersect:function(t,n,r){if(!t)return[];const[a,o]=t,i=(new s.Bounds).set(a[0],a[1],o[0],o[1]),c=r||this.context.dataflow.scenegraph().root;return s.intersect(c,i,function(t){let n=null;if(t){const r=e.array(t.marktype),a=e.array(t.markname);n=t=>(!r.length||r.some(e=>t.marktype===e))&&(!a.length||a.some(e=>t.name===e))}return n}(n))},clampRange:e.clampRange,pinchDistance:J,pinchAngle:K,screen:mt,containerSize:pt,windowSize:gt,bandspace:Q,setdata:g,pathShape:st,panLinear:e.panLinear,panLog:e.panLog,panPow:e.panPow,panSymlog:e.panSymlog,zoomLinear:e.zoomLinear,zoomLog:e.zoomLog,zoomPow:e.zoomPow,zoomSymlog:e.zoomSymlog,encode:p,modify:W},vt=["view","item","group","xy","x","y"],yt={};function xt(t,e,n){return 1===arguments.length?ht[t]:(ht[t]=e,n&&(yt[t]=n),wt&&(wt.functions[t]="this."+t),this)}xt("bandwidth",Z,_),xt("copy",tt,_),xt("domain",et,_),xt("range",rt,_),xt("invert",nt,_),xt("scale",at,_),xt("gradient",ot,_),xt("geoArea",D,_),xt("geoBounds",E,_),xt("geoCentroid",U,_),xt("geoShape",it,_),xt("indata",m,k),xt("data",d,F),xt("treePath",lt,F),xt("treeAncestors",ft,F),xt("vlSelectionTest",c.selectionTest,c.selectionVisitor),xt("vlSelectionResolve",c.selectionResolve,c.selectionVisitor);const bt={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:t=>"_["+e.stringValue("$"+t)+"]",functions:function(t){const r=n.functions(t);vt.forEach(t=>r[t]="event.vega."+t);for(let t in ht)r[t]="this."+t;return e.extend(r,function(t,r,a){r.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,a._bandwidth=_,a._range=_,a._scale=_;const o=r=>"_["+(r.type===n.Literal?e.stringValue("%"+r.value):e.stringValue("%")+"+"+t(r))+"]";return{_bandwidth:t=>`this.__bandwidth(${o(t[0])})`,_range:t=>o(t[0])+".range()",_scale:e=>`${o(e[0])}(${t(e[1])})`}}(t,ht,yt)),r},constants:n.constants,visitors:yt};var wt=n.codegen(bt);t.DataPrefix=":",t.IndexPrefix="@",t.ScalePrefix="%",t.SignalPrefix="$",t.bandspace=Q,t.bandwidth=Z,t.codeGenerator=wt,t.codegenParams=bt,t.containerSize=pt,t.contrast=X,t.copy=tt,t.data=d,t.dataVisitor=F,t.dayAbbrevFormat=A,t.dayFormat=L,t.debug=j,t.domain=et,t.encode=p,t.expressionFunction=xt,t.format=v,t.functionContext=ht,t.geoArea=D,t.geoBounds=E,t.geoCentroid=U,t.geoShape=it,t.inScope=V,t.indata=m,t.indataVisitor=k,t.info=M,t.invert=nt,t.luminance=T,t.merge=Y,t.modify=W,t.monthAbbrevFormat=N,t.monthFormat=P,t.parseExpression=function(t,r){var a,o,i={};try{t=e.isString(t)?t:e.stringValue(t)+"",a=n.parse(t)}catch(n){e.error("Expression parse error: "+t)}return a.visit(t=>{if(t.type===n.CallExpression){var e=t.callee.name,a=bt.visitors[e];a&&a(e,t.arguments,r,i)}}),(o=wt(a)).globals.forEach(t=>{var n="$"+t;!e.hasOwnProperty(i,n)&&r.getSignal(t)&&(i[n]=r.signalRef(t))}),{$expr:e.extend({code:o.code},r.options.ast?{ast:a}:null),$fields:o.fields,$params:i}},t.pathShape=st,t.pinchAngle=K,t.pinchDistance=J,t.range=rt,t.scale=at,t.scaleGradient=ot,t.scaleVisitor=_,t.screen=mt,t.setdata=g,t.timeFormat=y,t.timeParse=b,t.treeAncestors=ft,t.treePath=lt,t.utcFormat=x,t.utcParse=w,t.warn=$,t.windowSize=gt,Object.defineProperty(t,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-functions/index.js b/node_modules/vega-functions/index.js deleted file mode 100644 index 97255cb..0000000 --- a/node_modules/vega-functions/index.js +++ /dev/null @@ -1,109 +0,0 @@ -export { - data, - indata, - setdata -} from './src/functions/data'; - -export { - default as encode -} from './src/functions/encode'; - -export { - format, - utcFormat, - timeFormat, - utcParse, - timeParse, - monthFormat, - monthAbbrevFormat, - dayFormat, - dayAbbrevFormat -} from './src/functions/format'; - -export { - geoArea, - geoBounds, - geoCentroid -} from './src/functions/geo'; - -export { - default as inScope -} from './src/functions/inscope'; - -export { - warn, - info, - debug -} from './src/functions/log'; - -export { - luminance, - contrast -} from './src/functions/luminance'; - -export { - default as merge -} from './src/functions/merge'; - -export { - default as modify -} from './src/functions/modify'; - -export { - pinchDistance, - pinchAngle -} from './src/functions/pinch'; - -export { - range, - domain, - bandwidth, - bandspace, - copy, - scale, - invert -} from './src/functions/scale'; - -export { - default as scaleGradient -} from './src/functions/scale-gradient'; - -export { - geoShape, - pathShape -} from './src/functions/shape'; - -export { - treePath, - treeAncestors -} from './src/functions/tree'; - -export { - containerSize, - screen, - windowSize -} from './src/functions/window'; - -export { - codegenParams, - codeGenerator, - expressionFunction, - functionContext -} from './src/codegen'; - -export { - DataPrefix, - IndexPrefix, - ScalePrefix, - SignalPrefix -} from './src/constants.js'; - -export { - default as parseExpression -} from './src/parser'; - -export { - dataVisitor, - indataVisitor, - scaleVisitor -} from './src/visitors'; diff --git a/node_modules/vega-functions/package.json b/node_modules/vega-functions/package.json deleted file mode 100644 index c873543..0000000 --- a/node_modules/vega-functions/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "_from": "vega-functions@~5.7.1", - "_id": "vega-functions@5.7.1", - "_inBundle": false, - "_integrity": "sha512-PQUcRkLAJwiRK+Y2o8MZdHJOHZwGcIYKvnYZnes2IY5433lhKYL7b1DmwQhUqyHyKCudqlz/pRnoLpmuL8sAgg==", - "_location": "/vega-functions", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-functions@~5.7.1", - "name": "vega-functions", - "escapedName": "vega-functions", - "rawSpec": "~5.7.1", - "saveSpec": null, - "fetchSpec": "~5.7.1" - }, - "_requiredBy": [ - "/vega", - "/vega-parser", - "/vega-view" - ], - "_resolved": "https://registry.npmjs.org/vega-functions/-/vega-functions-5.7.1.tgz", - "_shasum": "4231f013c7a8a6cdcefaa6ee08c96f361c0c9ef5", - "_spec": "vega-functions@~5.7.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "^2.4.0", - "d3-color": "^1.4.1", - "d3-geo": "^1.12.1", - "vega-dataflow": "^5.7.0", - "vega-expression": "^2.6.5", - "vega-scale": "^7.0.0", - "vega-scenegraph": "^4.8.0", - "vega-selections": "^5.1.1", - "vega-statistics": "^1.7.5", - "vega-time": "^2.0.1", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "Custom functions for the Vega expression language.", - "devDependencies": { - "vega-format": "^1.0.0" - }, - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "expression", - "functions" - ], - "license": "BSD-3-Clause", - "main": "build/vega-functions.js", - "module": "index.js", - "name": "vega-functions", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-functions.js -c -m -o build/vega-functions.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g d3-array:d3,d3-color:d3,d3-geo:d3,vega-dataflow:vega,vega-expression:vega,vega-scale:vega,vega-scenegraph:vega,vega-selections:vega,vega-statistics:vega,vega-time:vega,vega-util:vega -f umd -n vega -o build/vega-functions.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "5.7.1" -} diff --git a/node_modules/vega-functions/src/codegen.js b/node_modules/vega-functions/src/codegen.js deleted file mode 100644 index b0db0ee..0000000 --- a/node_modules/vega-functions/src/codegen.js +++ /dev/null @@ -1,338 +0,0 @@ -import { - codegen, - constants, - functions -} from 'vega-expression'; - -import { - isTuple -} from 'vega-dataflow'; - -import { - selectionResolve, - selectionTest, - selectionVisitor -} from 'vega-selections'; - -import { - cumulativeLogNormal, - cumulativeNormal, - cumulativeUniform, - densityLogNormal, - densityNormal, - densityUniform, - quantileLogNormal, - quantileNormal, - quantileUniform, - random, - sampleLogNormal, - sampleNormal, - sampleUniform -} from 'vega-statistics'; - -import { - dayofyear, - timeOffset, - timeSequence, - timeUnitSpecifier, - utcOffset, - utcSequence, - utcdayofyear, - utcweek, - week -} from 'vega-time'; - -import { - clampRange, - extend, - extent, - flush, - inrange, - isArray, - isBoolean, - isDate, - isNumber, - isObject, - isRegExp, - isString, - lerp, - pad, - panLinear, - panLog, - panPow, - panSymlog, - peek, - quarter, - span, - stringValue, - toBoolean, - toDate, - toNumber, - toString, - truncate, - utcquarter, - zoomLinear, - zoomLog, - zoomPow, - zoomSymlog -} from 'vega-util'; - -import { - range as sequence -} from 'd3-array'; - -import { - hcl, - hsl, - lab, - rgb -} from 'd3-color'; - -import { - contrast, - luminance -} from './functions/luminance'; - -import { - data, - indata, - setdata -} from './functions/data'; - -import encode from './functions/encode'; - -import { - dayAbbrevFormat, - dayFormat, - format, - monthAbbrevFormat, - monthFormat, - timeFormat, - timeParse, - utcFormat, - utcParse -} from './functions/format'; - -import { - geoArea, - geoBounds, - geoCentroid -} from './functions/geo'; - -import inScope from './functions/inscope'; - -import intersect from './functions/intersect'; - -import { - debug, - info, - warn -} from './functions/log'; - -import merge from './functions/merge'; - -import modify from './functions/modify'; - -import { - pinchAngle, - pinchDistance -} from './functions/pinch'; - -import { - bandspace, - bandwidth, - copy, - domain, - invert, - range, - scale -} from './functions/scale'; - -import scaleGradient from './functions/scale-gradient'; - -import { - geoShape, - pathShape -} from './functions/shape'; - -import { - treeAncestors, - treePath -} from './functions/tree'; - -import { - containerSize, - screen, - windowSize -} from './functions/window'; - -import { - SignalPrefix -} from './constants'; - -import { - internalScaleFunctions -} from './scales'; - -import { - dataVisitor, - indataVisitor, - scaleVisitor -} from './visitors'; - -// Expression function context object -export const functionContext = { - random: function() { return random(); }, // override default - cumulativeNormal, - cumulativeLogNormal, - cumulativeUniform, - densityNormal, - densityLogNormal, - densityUniform, - quantileNormal, - quantileLogNormal, - quantileUniform, - sampleNormal, - sampleLogNormal, - sampleUniform, - isArray, - isBoolean, - isDate, - isDefined: function(_) { return _ !== undefined; }, - isNumber, - isObject, - isRegExp, - isString, - isTuple, - isValid: function(_) { return _ != null && _ === _; }, - toBoolean, - toDate, - toNumber, - toString, - flush, - lerp, - merge, - pad, - peek, - span, - inrange, - truncate, - rgb, - lab, - hcl, - hsl, - luminance, - contrast, - sequence, - format, - utcFormat, - utcParse, - utcOffset, - utcSequence, - timeFormat, - timeParse, - timeOffset, - timeSequence, - timeUnitSpecifier, - monthFormat, - monthAbbrevFormat, - dayFormat, - dayAbbrevFormat, - quarter, - utcquarter, - week, - utcweek, - dayofyear, - utcdayofyear, - warn, - info, - debug, - extent, - inScope, - intersect, - clampRange, - pinchDistance, - pinchAngle, - screen, - containerSize, - windowSize, - bandspace, - setdata, - pathShape, - panLinear, - panLog, - panPow, - panSymlog, - zoomLinear, - zoomLog, - zoomPow, - zoomSymlog, - encode, - modify -}; - -const eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'], // event functions - eventPrefix = 'event.vega.', // event function prefix - thisPrefix = 'this.', // function context prefix - astVisitors = {}; // AST visitors for dependency analysis - -// Build expression function registry -function buildFunctions(codegen) { - const fn = functions(codegen); - eventFunctions.forEach(name => fn[name] = eventPrefix + name); - for (let name in functionContext) { fn[name] = thisPrefix + name; } - extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; -} - -// Register an expression function -export function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) { - return functionContext[name]; - } - - // register with the functionContext - functionContext[name] = fn; - - // if there is an astVisitor register that, too - if (visitor) astVisitors[name] = visitor; - - // if the code generator has already been initialized, - // we need to also register the function with it - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; -} - -// register expression functions with ast visitors -expressionFunction('bandwidth', bandwidth, scaleVisitor); -expressionFunction('copy', copy, scaleVisitor); -expressionFunction('domain', domain, scaleVisitor); -expressionFunction('range', range, scaleVisitor); -expressionFunction('invert', invert, scaleVisitor); -expressionFunction('scale', scale, scaleVisitor); -expressionFunction('gradient', scaleGradient, scaleVisitor); -expressionFunction('geoArea', geoArea, scaleVisitor); -expressionFunction('geoBounds', geoBounds, scaleVisitor); -expressionFunction('geoCentroid', geoCentroid, scaleVisitor); -expressionFunction('geoShape', geoShape, scaleVisitor); -expressionFunction('indata', indata, indataVisitor); -expressionFunction('data', data, dataVisitor); -expressionFunction('treePath', treePath, dataVisitor); -expressionFunction('treeAncestors', treeAncestors, dataVisitor); - -// register Vega-Lite selection functions -expressionFunction('vlSelectionTest', selectionTest, selectionVisitor); -expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor); - -// Export code generator and parameters -export const codegenParams = { - blacklist: ['_'], - whitelist: ['datum', 'event', 'item'], - fieldvar: 'datum', - globalvar: id => '_[' + stringValue(SignalPrefix + id) + ']', - functions: buildFunctions, - constants: constants, - visitors: astVisitors -}; - -export var codeGenerator = codegen(codegenParams); diff --git a/node_modules/vega-functions/src/constants.js b/node_modules/vega-functions/src/constants.js deleted file mode 100644 index e330c7e..0000000 --- a/node_modules/vega-functions/src/constants.js +++ /dev/null @@ -1,4 +0,0 @@ -export const DataPrefix = ':'; -export const IndexPrefix = '@'; -export const ScalePrefix = '%'; -export const SignalPrefix = '$'; diff --git a/node_modules/vega-functions/src/functions/data.js b/node_modules/vega-functions/src/functions/data.js deleted file mode 100644 index c61df2c..0000000 --- a/node_modules/vega-functions/src/functions/data.js +++ /dev/null @@ -1,21 +0,0 @@ -import {truthy} from 'vega-util'; - -export function data(name) { - const data = this.context.data[name]; - return data ? data.values.value : []; -} - -export function indata(name, field, value) { - const index = this.context.data[name]['index:' + field], - entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; -} - -export function setdata(name, tuples) { - const df = this.context.dataflow, - data = this.context.data[name], - input = data.input; - - df.pulse(input, df.changeset().remove(truthy).insert(tuples)); - return 1; -} diff --git a/node_modules/vega-functions/src/functions/encode.js b/node_modules/vega-functions/src/functions/encode.js deleted file mode 100644 index 77fabb3..0000000 --- a/node_modules/vega-functions/src/functions/encode.js +++ /dev/null @@ -1,8 +0,0 @@ -export default function(item, name, retval) { - if (item) { - const df = this.context.dataflow, - target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - return retval !== undefined ? retval : item; -} diff --git a/node_modules/vega-functions/src/functions/format.js b/node_modules/vega-functions/src/functions/format.js deleted file mode 100644 index 0ad4eb5..0000000 --- a/node_modules/vega-functions/src/functions/format.js +++ /dev/null @@ -1,36 +0,0 @@ -const wrap = method => function(value, spec) { - const locale = this.context.dataflow.locale(); - return locale[method](spec)(value); -}; - -export const format = wrap('format'); -export const timeFormat = wrap('timeFormat'); -export const utcFormat = wrap('utcFormat'); -export const timeParse = wrap('timeParse'); -export const utcParse = wrap('utcParse'); - -var dateObj = new Date(2000, 0, 1); - -function time(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); - dateObj.setMonth(month); - dateObj.setDate(day); - return timeFormat.call(this, dateObj, specifier); -} - -export function monthFormat(month) { - return time.call(this, month, 1, '%B'); -} - -export function monthAbbrevFormat(month) { - return time.call(this, month, 1, '%b'); -} - -export function dayFormat(day) { - return time.call(this, 0, 2 + day, '%A'); -} - -export function dayAbbrevFormat(day) { - return time.call(this, 0, 2 + day, '%a'); -} diff --git a/node_modules/vega-functions/src/functions/geo.js b/node_modules/vega-functions/src/functions/geo.js deleted file mode 100644 index ffe7049..0000000 --- a/node_modules/vega-functions/src/functions/geo.js +++ /dev/null @@ -1,23 +0,0 @@ -import {getScale} from '../scales'; -import { - geoArea as area, - geoBounds as bounds, - geoCentroid as centroid -} from 'd3-geo'; - -function geoMethod(methodName, globalMethod) { - return function(projection, geojson, group) { - if (projection) { - // projection defined, use it - const p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else { - // projection undefined, use global method - return globalMethod(geojson); - } - }; -} - -export const geoArea = geoMethod('area', area); -export const geoBounds = geoMethod('bounds', bounds); -export const geoCentroid = geoMethod('centroid', centroid); diff --git a/node_modules/vega-functions/src/functions/inscope.js b/node_modules/vega-functions/src/functions/inscope.js deleted file mode 100644 index 355d7a7..0000000 --- a/node_modules/vega-functions/src/functions/inscope.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function(item) { - let group = this.context.group, - value = false; - - if (group) while (item) { - if (item === group) { value = true; break; } - item = item.mark.group; - } - return value; -} diff --git a/node_modules/vega-functions/src/functions/intersect.js b/node_modules/vega-functions/src/functions/intersect.js deleted file mode 100644 index 17509d1..0000000 --- a/node_modules/vega-functions/src/functions/intersect.js +++ /dev/null @@ -1,25 +0,0 @@ -import {Bounds, intersect} from 'vega-scenegraph'; -import {array} from 'vega-util'; - -export default function(b, opt, group) { - if (!b) return []; - - const [u, v] = b, - box = new Bounds().set(u[0], u[1], v[0], v[1]), - scene = group || this.context.dataflow.scenegraph().root; - - return intersect(scene, box, filter(opt)); -} - -function filter(opt) { - let p = null; - - if (opt) { - const types = array(opt.marktype), - names = array(opt.markname); - p = _ => (!types.length || types.some(t => _.marktype === t)) - && (!names.length || names.some(s => _.name === s)); - } - - return p; -} \ No newline at end of file diff --git a/node_modules/vega-functions/src/functions/log.js b/node_modules/vega-functions/src/functions/log.js deleted file mode 100644 index ae3819e..0000000 --- a/node_modules/vega-functions/src/functions/log.js +++ /dev/null @@ -1,20 +0,0 @@ -function log(df, method, args) { - try { - df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args))); - } catch (err) { - df.warn(err); - } - return args[args.length-1]; -} - -export function warn() { - return log(this.context.dataflow, 'warn', arguments); -} - -export function info() { - return log(this.context.dataflow, 'info', arguments); -} - -export function debug() { - return log(this.context.dataflow, 'debug', arguments); -} diff --git a/node_modules/vega-functions/src/functions/luminance.js b/node_modules/vega-functions/src/functions/luminance.js deleted file mode 100644 index f1ece2b..0000000 --- a/node_modules/vega-functions/src/functions/luminance.js +++ /dev/null @@ -1,27 +0,0 @@ -import {rgb} from 'd3-color'; - -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef -function channel_luminance_value(channelValue) { - const val = channelValue / 255; - if (val <= 0.03928) { - return val / 12.92; - } - return Math.pow((val + 0.055) / 1.055, 2.4); -} - -export function luminance(color) { - const c = rgb(color), - r = channel_luminance_value(c.r), - g = channel_luminance_value(c.g), - b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; -} - -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef -export function contrast(color1, color2) { - const lum1 = luminance(color1), - lum2 = luminance(color2), - lumL = Math.max(lum1, lum2), - lumD = Math.min(lum1, lum2); - return (lumL + 0.05) / (lumD + 0.05); -} diff --git a/node_modules/vega-functions/src/functions/merge.js b/node_modules/vega-functions/src/functions/merge.js deleted file mode 100644 index 5a257df..0000000 --- a/node_modules/vega-functions/src/functions/merge.js +++ /dev/null @@ -1,7 +0,0 @@ -import {extend} from 'vega-util'; - -export default function() { - var args = [].slice.call(arguments); - args.unshift({}); - return extend.apply(null, args); -} diff --git a/node_modules/vega-functions/src/functions/modify.js b/node_modules/vega-functions/src/functions/modify.js deleted file mode 100644 index a3a5d45..0000000 --- a/node_modules/vega-functions/src/functions/modify.js +++ /dev/null @@ -1,80 +0,0 @@ -import {isTuple} from 'vega-dataflow'; -import {isArray, isObject, truthy} from 'vega-util'; - -function equal(a, b) { - return a === b || a !== a && b !== b ? true - : isArray(a) ? ( - isArray(b) && a.length === b.length ? equalArray(a, b) : false - ) - : isObject(a) && isObject(b) ? equalObject(a, b) - : false; -} - -function equalArray(a, b) { - for (let i=0, n=a.length; i equalObject(props, _); -} - -export default function(name, insert, remove, toggle, modify, values) { - let df = this.context.dataflow, - data = this.context.data[name], - input = data.input, - changes = data.changes, - stamp = df.stamp(), - predicate, key; - - if (df._trigger === false || !(input.value.length || insert || toggle)) { - // nothing to do! - return 0; - } - - if (!changes || changes.stamp < stamp) { - data.changes = (changes = df.changeset()); - changes.stamp = stamp; - df.runAfter(function() { - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - - if (remove) { - predicate = remove === true ? truthy - : (isArray(remove) || isTuple(remove)) ? remove - : removePredicate(remove); - changes.remove(predicate); - } - - if (insert) { - changes.insert(insert); - } - - if (toggle) { - predicate = removePredicate(toggle); - if (input.value.some(predicate)) { - changes.remove(predicate); - } else { - changes.insert(toggle); - } - } - - if (modify) { - for (key in values) { - changes.modify(modify, key, values[key]); - } - } - - return 1; -} diff --git a/node_modules/vega-functions/src/functions/pinch.js b/node_modules/vega-functions/src/functions/pinch.js deleted file mode 100644 index 67f7686..0000000 --- a/node_modules/vega-functions/src/functions/pinch.js +++ /dev/null @@ -1,14 +0,0 @@ -export function pinchDistance(event) { - const t = event.touches, - dx = t[0].clientX - t[1].clientX, - dy = t[0].clientY - t[1].clientY; - return Math.sqrt(dx * dx + dy * dy); -} - -export function pinchAngle(event) { - const t = event.touches; - return Math.atan2( - t[0].clientY - t[1].clientY, - t[0].clientX - t[1].clientX - ); -} diff --git a/node_modules/vega-functions/src/functions/scale-gradient.js b/node_modules/vega-functions/src/functions/scale-gradient.js deleted file mode 100644 index 023ace6..0000000 --- a/node_modules/vega-functions/src/functions/scale-gradient.js +++ /dev/null @@ -1,35 +0,0 @@ -import {getScale} from '../scales'; -import {scale as get, scaleFraction} from 'vega-scale'; -import {Gradient} from 'vega-scenegraph'; -import {identity, peek} from 'vega-util'; - -export default function(scale, p0, p1, count, group) { - scale = getScale(scale, (group || this).context); - - const gradient = Gradient(p0, p1); - - let stops = scale.domain(), - min = stops[0], - max = peek(stops), - fraction = identity; - - if (!(max - min)) { - // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator - ? get('sequential')().interpolator(scale.interpolator()) - : get('linear')().interpolate(scale.interpolate()).range(scale.range()) - ).domain([min=0, max=1]); - } else { - fraction = scaleFraction(scale, min, max); - } - - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== peek(stops)) stops.push(max); - } - - stops.forEach(_ => gradient.stop(fraction(_), scale(_))); - - return gradient; -} diff --git a/node_modules/vega-functions/src/functions/scale.js b/node_modules/vega-functions/src/functions/scale.js deleted file mode 100644 index 7c6da34..0000000 --- a/node_modules/vega-functions/src/functions/scale.js +++ /dev/null @@ -1,39 +0,0 @@ -import {getScale} from '../scales'; -import {bandSpace} from 'vega-scale'; -import {isArray} from 'vega-util'; - -export function bandspace(count, paddingInner, paddingOuter) { - return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0); -} - -export function bandwidth(name, group) { - const s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; -} - -export function copy(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; -} - -export function domain(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.domain() : []; -} - -export function invert(name, range, group) { - const s = getScale(name, (group || this).context); - return !s ? undefined - : isArray(range) ? (s.invertRange || s.invert)(range) - : (s.invert || s.invertExtent)(range); -} - -export function range(name, group) { - const s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; -} - -export function scale(name, value, group) { - const s = getScale(name, (group || this).context); - return s ? s(value) : undefined; -} diff --git a/node_modules/vega-functions/src/functions/shape.js b/node_modules/vega-functions/src/functions/shape.js deleted file mode 100644 index 8d03619..0000000 --- a/node_modules/vega-functions/src/functions/shape.js +++ /dev/null @@ -1,18 +0,0 @@ -import {getScale} from '../scales'; -import {pathParse, pathRender} from 'vega-scenegraph'; - -export function geoShape(projection, geojson, group) { - const p = getScale(projection, (group || this).context); - return function(context) { - return p ? p.path.context(context)(geojson) : ''; - }; -} - -export function pathShape(path) { - let p = null; - return function(context) { - return context - ? pathRender(context, (p = p || pathParse(path))) - : path; - }; -} diff --git a/node_modules/vega-functions/src/functions/tree.js b/node_modules/vega-functions/src/functions/tree.js deleted file mode 100644 index c302ea3..0000000 --- a/node_modules/vega-functions/src/functions/tree.js +++ /dev/null @@ -1,20 +0,0 @@ -import {data} from './data'; - -const datum = d => d.data; - -function treeNodes(name, context) { - const tree = data.call(context, name); - return tree.root && tree.root.lookup || {}; -} - -export function treePath(name, source, target) { - const nodes = treeNodes(name, this), - s = nodes[source], - t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; -} - -export function treeAncestors(name, node) { - const n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; -} diff --git a/node_modules/vega-functions/src/functions/window.js b/node_modules/vega-functions/src/functions/window.js deleted file mode 100644 index ad3e06b..0000000 --- a/node_modules/vega-functions/src/functions/window.js +++ /dev/null @@ -1,21 +0,0 @@ -const _window = () => (typeof window !== 'undefined' && window) || null; - -export function screen() { - const w = _window(); - return w ? w.screen : {}; -} - -export function windowSize() { - const w = _window(); - return w - ? [w.innerWidth, w.innerHeight] - : [undefined, undefined]; -} - -export function containerSize() { - const view = this.context.dataflow, - el = view.container && view.container(); - return el - ? [el.clientWidth, el.clientHeight] - : [undefined, undefined]; -} diff --git a/node_modules/vega-functions/src/parser.js b/node_modules/vega-functions/src/parser.js deleted file mode 100644 index 29822dc..0000000 --- a/node_modules/vega-functions/src/parser.js +++ /dev/null @@ -1,42 +0,0 @@ -import {codeGenerator, codegenParams} from './codegen'; -import {SignalPrefix} from './constants'; -import {CallExpression, parse} from 'vega-expression'; -import {error, extend, hasOwnProperty, isString, stringValue} from 'vega-util'; - -export default function(expr, scope) { - var params = {}, ast, gen; - - // parse the expression to an abstract syntax tree (ast) - try { - expr = isString(expr) ? expr : (stringValue(expr) + ''); - ast = parse(expr); - } catch (err) { - error('Expression parse error: ' + expr); - } - - // analyze ast function calls for dependencies - ast.visit(node => { - if (node.type !== CallExpression) return; - var name = node.callee.name, - visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); - }); - - // perform code generation - gen = codeGenerator(ast); - - // collect signal dependencies - gen.globals.forEach(name => { - var signalName = SignalPrefix + name; - if (!hasOwnProperty(params, signalName) && scope.getSignal(name)) { - params[signalName] = scope.signalRef(name); - } - }); - - // return generated expression code and dependencies - return { - $expr: extend({code: gen.code}, scope.options.ast ? {ast} : null), - $fields: gen.fields, - $params: params - }; -} diff --git a/node_modules/vega-functions/src/scales.js b/node_modules/vega-functions/src/scales.js deleted file mode 100644 index e0fbbab..0000000 --- a/node_modules/vega-functions/src/scales.js +++ /dev/null @@ -1,36 +0,0 @@ -import {ScalePrefix} from './constants'; -import {scaleVisitor} from './visitors'; -import {Literal} from 'vega-expression'; -import {isFunction, isString, stringValue} from 'vega-util'; - -export function getScale(name, ctx) { - let s; - return isFunction(name) ? name - : isString(name) ? (s = ctx.scales[name]) && s.value - : undefined; -} - -export function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = s => s && s.bandwidth ? s.bandwidth() : 0; - - // register AST visitors for internal scale functions - visitors._bandwidth = scaleVisitor; - visitors._range = scaleVisitor; - visitors._scale = scaleVisitor; - - // resolve scale reference directly to the signal hash argument - const ref = arg => '_[' + ( - arg.type === Literal - ? stringValue(ScalePrefix + arg.value) - : stringValue(ScalePrefix) + '+' + codegen(arg) - ) + ']'; - - // define and return internal scale function code generators - // these internal functions are called by mark encoders - return { - _bandwidth: args => `this.__bandwidth(${ref(args[0])})`, - _range: args => `${ref(args[0])}.range()`, - _scale: args => `${ref(args[0])}(${codegen(args[1])})` - }; -} diff --git a/node_modules/vega-functions/src/visitors.js b/node_modules/vega-functions/src/visitors.js deleted file mode 100644 index ba09225..0000000 --- a/node_modules/vega-functions/src/visitors.js +++ /dev/null @@ -1,56 +0,0 @@ -import {DataPrefix, IndexPrefix, ScalePrefix} from './constants'; -import {Literal} from 'vega-expression'; -import {error, hasOwnProperty} from 'vega-util'; - -export function dataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) { - error('First argument to data functions must be a string literal.'); - } - - const data = args[0].value, - dataName = DataPrefix + data; - - if (!hasOwnProperty(dataName, params)) { - try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) { - // if data set does not exist, there's nothing to track - } - } -} - -export function indataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to indata must be a string literal.'); - if (args[1].type !== Literal) error('Second argument to indata must be a string literal.'); - - const data = args[0].value, - field = args[1].value, - indexName = IndexPrefix + field; - - if (!hasOwnProperty(indexName, params)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } -} - -export function scaleVisitor(name, args, scope, params) { - if (args[0].type === Literal) { - // add scale dependency - addScaleDependency(scope, params, args[0].value); - } else { - // indirect scale lookup; add all scales as parameters - for (name in scope.scales) { - addScaleDependency(scope, params, name); - } - } -} - -function addScaleDependency(scope, params, name) { - const scaleName = ScalePrefix + name; - if (!hasOwnProperty(params, scaleName)) { - try { - params[scaleName] = scope.scaleRef(name); - } catch (err) { - // TODO: error handling? warning? - } - } -} diff --git a/node_modules/vega-geo/LICENSE b/node_modules/vega-geo/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-geo/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-geo/README.md b/node_modules/vega-geo/README.md deleted file mode 100644 index 67f2046..0000000 --- a/node_modules/vega-geo/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# vega-geo - -Geographic data transforms for Vega dataflows. - -This package provides the following Vega data transforms: - -- [**Contour**](https://vega.github.io/vega/docs/transforms/contour/) [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/Contour.js "Source") _deprecated!_ -- [**GeoJSON**](https://vega.github.io/vega/docs/transforms/geojson/) [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/GeoJSON.js "Source") -- [**GeoPath**](https://vega.github.io/vega/docs/transforms/geopath/) [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/GeoPath.js "Source") -- [**GeoPoint**](https://vega.github.io/vega/docs/transforms/geopoint/) [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/GeoPoint.js "Source") -- [**GeoShape**](https://vega.github.io/vega/docs/transforms/geoshape/) [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/GeoShape.js "Source") -- [**Graticule**](https://vega.github.io/vega/docs/transforms/graticule/) [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/Graticule.js "Source") -- [**Heatmap**](https://vega.github.io/vega/docs/transforms/heatmap/) [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/Heatmap.js "Source") -- [**Isocontour**](https://vega.github.io/vega/docs/transforms/isocontour/) [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/Isocontour.js "Source") -- [**KDE2D**](https://vega.github.io/vega/docs/transforms/kde2d/) [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/KDE2D.js "Source") - -And provides the following internal transform: - -- **Projection** [<>](https://github.com/vega/vega/blob/master/packages/vega-geo/src/Projection.js "Source") - -For more information about cartographic projections, see the [Vega Projections documentation](https://vega.github.io/vega/docs/projections/). diff --git a/node_modules/vega-geo/build/vega-geo.js b/node_modules/vega-geo/build/vega-geo.js deleted file mode 100644 index e152deb..0000000 --- a/node_modules/vega-geo/build/vega-geo.js +++ /dev/null @@ -1,1245 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-dataflow'), require('vega-util'), require('d3-array'), require('vega-statistics'), require('vega-projection'), require('d3-geo'), require('d3-color'), require('vega-canvas')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-dataflow', 'vega-util', 'd3-array', 'vega-statistics', 'vega-projection', 'd3-geo', 'd3-color', 'vega-canvas'], factory) : - (global = global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.vega, global.vega, global.d3, global.vega, global.vega, global.d3, global.d3, global.vega)); -}(this, (function (exports, vegaDataflow, vegaUtil, d3Array, vegaStatistics, vegaProjection, d3Geo, d3Color, vegaCanvas) { 'use strict'; - - function noop() {} - - const cases = [ - [], - [[[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]]], - [] - ]; - - // Implementation adapted from d3/d3-contour. Thanks! - function contours() { - var dx = 1, - dy = 1, - smooth = smoothLinear; - - function contours(values, tz) { - return tz.map(value => 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.js - function contour(values, value) { - var polygons = [], - holes = []; - - 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 = 0, n = polygons.length, polygon; i < n; ++i) { - if (contains((polygon = polygons[i])[0], hole) !== -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/stitch.js - function isorings(values, value, callback) { - var fragmentByStart = new Array, - fragmentByEnd = new Array, - x, y, t0, t1, t2, t3; - - // Special case for the first row (y = -1, t2 = t3 = 0). - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - - // General case for the intermediate rows. - while (++y < dy - 1) { - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - - // Special case for the last row (y = dy - 1, t0 = t1 = 0). - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - - function stitch(line) { - var start = [line[0][0] + x, line[0][1] + y], - end = [line[1][0] + x, line[1][1] + y], - startIndex = index(start), - endIndex = index(end), - f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[f.start] = fragmentByEnd[g.end] = {start: f.start, end: g.end, ring: f.ring.concat(g.ring)}; - } - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[g.start] = fragmentByEnd[f.end] = {start: g.start, end: f.end, ring: g.ring.concat(f.ring)}; - } - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else { - fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {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 = point[0], - y = point[1], - xt = x | 0, - yt = y | 0, - v0, - v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); - } - - contours.contour = contour; - - contours.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) vegaUtil.error('invalid size'); - return dx = _0, dy = _1, contours; - }; - - contours.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop, contours) : smooth === smoothLinear; - }; - - return contours; - } - - function area(ring) { - var i = 0, - n = ring.length, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area; - } - - function contains(ring, hole) { - var i = -1, n = hole.length, c; - while (++i < n) if (c = ringContains(ring, hole[i])) return c; - return 0; - } - - function ringContains(ring, point) { - var x = point[0], y = point[1], contains = -1; - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) contains = -contains; - } - return contains; - } - - function segmentContains(a, b, c) { - var i; return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); - } - - function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); - } - - function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; - } - - function quantize(k, nice, zero) { - return function(values) { - var ex = vegaUtil.extent(values), - start = zero ? Math.min(ex[0], 0) : ex[0], - stop = ex[1], - span = stop - start, - step = nice ? d3Array.tickStep(start, stop, k) : (span / (k + 1)); - return d3Array.range(step, stop, step); - }; - } - - /** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ - function Isocontour(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'levels', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'zero', 'type': 'boolean', 'default': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true }, - { 'name': 'scale', 'type': 'number', 'expr': true }, - { 'name': 'translate', 'type': 'number', 'array': true, 'expr': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'default': 'contour' } - ] - }; - - var prototype = vegaUtil.inherits(Isocontour, vegaDataflow.Transform); - - prototype.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - field = _.field || vegaUtil.identity, - contour = contours().smooth(_.smooth !== false), - tz = _.thresholds || levels(source, field, _), - as = _.as === null ? null : _.as || 'contour', - values = []; - - source.forEach(t => { - const grid = field(t); - - // generate contour paths in GeoJSON format - const paths = contour.size([grid.width, grid.height])( - grid.values, vegaUtil.isArray(tz) ? tz : tz(grid.values) - ); - - // adjust contour path coordinates as needed - transformPaths(paths, grid, t, _); - - // ingest; copy source data properties to output - paths.forEach(p => { - values.push(vegaDataflow.rederive(t, vegaDataflow.ingest(as != null ? {[as]: p} : p))); - }); - }); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; - }; - - function levels(values, f, _) { - const q = quantize(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' - ? q - : q(values.map(t => d3Array.max(f(t).values))); - } - - function transformPaths(paths, grid, datum, _) { - let s = _.scale || grid.scale, - t = _.translate || grid.translate; - if (vegaUtil.isFunction(s)) s = s(datum, _); - if (vegaUtil.isFunction(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - - const sx = (vegaUtil.isNumber(s) ? s : s[0]) || 1, - sy = (vegaUtil.isNumber(s) ? s : s[1]) || 1, - tx = t && t[0] || 0, - ty = t && t[1] || 0; - - paths.forEach(transform(grid, sx, sy, tx, ty)); - } - - function transform(grid, sx, sy, tx, ty) { - const x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - flip = sx * sy < 0; - - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); - } - - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - coordinates.forEach(transformPoint); - } - - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; - } - - return function(geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; - }; - } - - function radius(bw, data, f) { - const v = bw >= 0 ? bw : vegaStatistics.bandwidthNRD(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); - } - - function number(_) { - return vegaUtil.isFunction(_) ? _ : vegaUtil.constant(+_); - } - - // Implementation adapted from d3/d3-contour. Thanks! - function density2D() { - var x = d => d[0], - y = d => d[1], - weight = vegaUtil.one, - bandwidth = [-1, -1], - dx = 960, - dy = 500, - k = 2; // log2(cellSize) - - function density(data, counts) { - const rx = radius(bandwidth[0], data, x) >> k, // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, // blur y-radius - ox = rx ? rx + 2 : 0, // x-offset padding for blur - oy = ry ? ry + 2 : 0, // y-offset padding for blur - n = 2 * ox + (dx >> k), // grid width - m = 2 * oy + (dy >> k), // grid height - values0 = new Float32Array(n * m), - values1 = new Float32Array(n * m); - - let values = values0; - - data.forEach(d => { - const xi = ox + (+x(d) >> k), - yi = oy + (+y(d) >> k); - - if (xi >= 0 && xi < n && yi >= 0 && yi < m) { - values0[xi + yi * n] += +weight(d); - } - }); - - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } - - // scale density estimates - // density in points per square pixel or probability density - let s = counts ? Math.pow(2, -2 * k) : 1 / d3Array.sum(values); - for (let i=0, sz=n*m; i> k), - y2: oy + (dy >> k) - }; - } - - density.x = function(_) { - return arguments.length ? (x = number(_), density) : x; - }; - - density.y = function(_) { - return arguments.length ? (y = number(_), density) : y; - }; - - density.weight = function(_) { - return arguments.length ? (weight = number(_), density) : weight; - }; - - density.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) vegaUtil.error('invalid size'); - return dx = _0, dy = _1, density; - }; - - density.cellSize = function(_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) vegaUtil.error('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - - density.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - _ = vegaUtil.array(_); - if (_.length === 1) _ = [+_[0], +_[0]]; - if (_.length !== 2) vegaUtil.error('invalid bandwidth'); - return bandwidth = _, density; - }; - - return density; - } - - function blurX(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let j = 0; j < m; ++j) { - for (let i = 0, sr = 0; i < n + r; ++i) { - if (i < n) { - sr += source[i + j * n]; - } - if (i >= r) { - if (i >= w) { - sr -= source[i - w + j * n]; - } - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } - } - } - - function blurY(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let i = 0; i < n; ++i) { - for (let j = 0, sr = 0; j < m + r; ++j) { - if (j < m) { - sr += source[i + j * n]; - } - if (j >= r) { - if (j >= w) { - sr -= source[i + (j - w) * n]; - } - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } - } - } - - /** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ - function KDE2D(params) { - vegaDataflow.Transform.call(this, null, params); - } - - KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': 'grid'} - ] - }; - - var prototype$1 = vegaUtil.inherits(KDE2D, vegaDataflow.Transform); - - const PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth']; - - function params(obj, _) { - PARAMS.forEach(param => _[param] != null ? obj[param](_[param]) : 0); - return obj; - } - - prototype$1.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) - return pulse.StopPropagation; - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby), - names = (_.groupby || []).map(vegaUtil.accessorName), - kde = params(density2D(), _), - as = _.as || 'grid', - values = []; - - function set(t, vals) { - for (let i=0; i vegaDataflow.ingest( - set({[as]: kde(g, _.counts)}, g.dims) - )); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; - }; - - function partition(data, groupby) { - var groups = [], - get = f => f(t), - map, i, n, t, k, g; - - // partition data points into groups - if (groupby == null) { - groups.push(data); - } else { - for (map={}, i=0, n=data.length; i} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ - function Contour(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Contour.Definition = { - 'type': 'Contour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'values', 'type': 'number', 'array': true }, - { 'name': 'x', 'type': 'field' }, - { 'name': 'y', 'type': 'field' }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number' }, - { 'name': 'count', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true } - ] - }; - - var prototype$2 = vegaUtil.inherits(Contour, vegaDataflow.Transform); - - prototype$2.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - contour = contours().smooth(_.smooth !== false), - values = _.values, - thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values), - size = _.size, grid, post; - - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [grid.width, grid.height]; - values = grid.values; - } - - thresh = vegaUtil.isArray(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map(vegaDataflow.ingest); - - return out; - }; - - var Feature = 'Feature'; - var FeatureCollection = 'FeatureCollection'; - var MultiPoint = 'MultiPoint'; - - /** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ - function GeoJSON(params) { - vegaDataflow.Transform.call(this, null, params); - } - - GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'length': 2 }, - { 'name': 'geojson', 'type': 'field' } - ] - }; - - var prototype$3 = vegaUtil.inherits(GeoJSON, vegaDataflow.Transform); - - prototype$3.transform = function(_, pulse) { - var features = this._features, - points = this._points, - fields = _.fields, - lon = fields && fields[0], - lat = fields && fields[1], - geojson = _.geojson || (!fields && vegaUtil.identity), - flag = pulse.ADD, - mod; - - mod = _.modified() - || pulse.changed(pulse.REM) - || pulse.modified(vegaUtil.accessorFields(geojson)) - || (lon && (pulse.modified(vegaUtil.accessorFields(lon)))) - || (lat && (pulse.modified(vegaUtil.accessorFields(lat)))); - - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = (features = []); - this._points = (points = []); - } - - if (geojson) { - pulse.visit(flag, function(t) { - features.push(geojson(t)); - }); - } - - if (lon && lat) { - pulse.visit(flag, function(t) { - var x = lon(t), - y = lat(t); - if (x != null && y != null && (x = +x) === x && (y = +y) === y) { - points.push([x, y]); - } - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - - this.value = { - type: FeatureCollection, - features: features - }; - }; - - /** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ - function GeoPath(params) { - vegaDataflow.Transform.call(this, null, params); - } - - GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] - }; - - var prototype$4 = vegaUtil.inherits(GeoPath, vegaDataflow.Transform); - - prototype$4.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - path = this.value, - field = _.field || vegaUtil.identity, - as = _.as || 'path', - flag = out.SOURCE; - - function set(t) { t[as] = path(field(t)); } - - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = vegaProjection.getProjectionPath(_.projection); - out.materialize().reflow(); - } else { - flag = field === vegaUtil.identity || pulse.modified(field.fields) - ? out.ADD_MOD - : out.ADD; - } - - var prev = initPath(path, _.pointRadius); - out.visit(flag, set); - path.pointRadius(prev); - - return out.modifies(as); - }; - - function initPath(path, pointRadius) { - var prev = path.pointRadius(); - path.context(null); - if (pointRadius != null) { - path.pointRadius(pointRadius); - } - return prev; - } - - /** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ - function GeoPoint(params) { - vegaDataflow.Transform.call(this, null, params); - } - - GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection', 'required': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true, 'length': 2 }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['x', 'y'] } - ] - }; - - var prototype$5 = vegaUtil.inherits(GeoPoint, vegaDataflow.Transform); - - prototype$5.transform = function(_, pulse) { - var proj = _.projection, - lon = _.fields[0], - lat = _.fields[1], - as = _.as || ['x', 'y'], - x = as[0], - y = as[1], - mod; - - function set(t) { - var xy = proj([lon(t), lat(t)]); - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - - if (_.modified()) { - // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - } else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - - return pulse.modifies(as); - }; - - /** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ - function GeoShape(params) { - vegaDataflow.Transform.call(this, null, params); - } - - GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': {'modifies': true, 'nomod': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field', 'default': 'datum' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'shape' } - ] - }; - - var prototype$6 = vegaUtil.inherits(GeoShape, vegaDataflow.Transform); - - prototype$6.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - shape = this.value, - as = _.as || 'shape', - flag = out.ADD; - - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator( - vegaProjection.getProjectionPath(_.projection), - _.field || vegaUtil.field('datum'), - _.pointRadius - ); - out.materialize().reflow(); - flag = out.SOURCE; - } - - out.visit(flag, function(t) { t[as] = shape; }); - - return out.modifies(as); - }; - - function shapeGenerator(path, field, pointRadius) { - var shape = pointRadius == null - ? function(_) { return path(field(_)); } - : function(_) { - var prev = path.pointRadius(), - value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - shape.context = function(_) { - path.context(_); - return shape; - }; - - return shape; - } - - /** - * GeoJSON feature generator for creating graticules. - * @constructor - */ - function Graticule(params) { - vegaDataflow.Transform.call(this, [], params); - this.generator = d3Geo.geoGraticule(); - } - - Graticule.Definition = { - 'type': 'Graticule', - 'metadata': {'changes': true, 'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMajor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMinor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'step', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'stepMajor', 'type': 'number', 'array': true, 'length': 2, 'default': [90, 360] }, - { 'name': 'stepMinor', 'type': 'number', 'array': true, 'length': 2, 'default': [10, 10] }, - { 'name': 'precision', 'type': 'number', 'default': 2.5 } - ] - }; - - var prototype$7 = vegaUtil.inherits(Graticule, vegaDataflow.Transform); - - prototype$7.transform = function(_, pulse) { - var src = this.value, - gen = this.generator, t; - - if (!src.length || _.modified()) { - for (var prop in _) { - if (vegaUtil.isFunction(gen[prop])) { - gen[prop](_[prop]); - } - } - } - - t = gen(); - if (src.length) { - pulse.mod.push(vegaDataflow.replace(src[0], t)); - } else { - pulse.add.push(vegaDataflow.ingest(t)); - } - src[0] = t; - - return pulse; - }; - - /** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ - function Heatmap(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'color', 'type': 'string', 'expr': true}, - { 'name': 'opacity', 'type': 'number', 'expr': true}, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'as', 'type': 'string', 'default': 'image' } - ] - }; - - var prototype$8 = vegaUtil.inherits(Heatmap, vegaDataflow.Transform); - - prototype$8.transform = function(_, pulse) { - if (!pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var source = pulse.materialize(pulse.SOURCE).source, - shared = _.resolve === 'shared', - field = _.field || vegaUtil.identity, - opacity = opacity_(_.opacity, _), - color = color_(_.color, _), - as = _.as || 'image', - obj = { - $x: 0, $y: 0, $value: 0, - $max: shared ? d3Array.max(source.map(t => d3Array.max(field(t).values))) : 0 - }; - - source.forEach(t => { - const v = field(t); - - // build proxy data object - const o = vegaUtil.extend({}, t, obj); - // set maximum value if not globally shared - if (!shared) o.$max = d3Array.max(v.values || []); - - // generate canvas image - // optimize color/opacity if not pixel-dependent - t[as] = toCanvas(v, o, - color.dep ? color : vegaUtil.constant(color(o)), - opacity.dep ? opacity : vegaUtil.constant(opacity(o)) - ); - }); - - return pulse.reflow(true).modifies(as); - }; - - // get image color function - function color_(color, _) { - let f; - if (vegaUtil.isFunction(color)) { - f = obj => d3Color.rgb(color(obj, _)); - f.dep = dependency(color); - } else { - // default to mid-grey - f = vegaUtil.constant(d3Color.rgb(color || '#888')); - } - return f; - } - - // get image opacity function - function opacity_(opacity, _) { - let f; - if (vegaUtil.isFunction(opacity)) { - f = obj => opacity(obj, _); - f.dep = dependency(opacity); - } else if (opacity) { - f = vegaUtil.constant(opacity); - } else { - // default to [0, max] opacity gradient - f = obj => (obj.$value / obj.$max) || 0; - f.dep = true; - } - return f; - } - - // check if function depends on individual pixel data - function dependency(f) { - if (!vegaUtil.isFunction(f)) return false; - const set = vegaUtil.toSet(vegaUtil.accessorFields(f)); - return set.$x || set.$y || set.$value || set.$max; - } - - // render raster grid to canvas - function toCanvas(grid, obj, color, opacity) { - const n = grid.width, - m = grid.height, - x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - x2 = grid.x2 || n, - y2 = grid.y2 || m, - val = grid.values, - value = val ? i => val[i] : vegaUtil.zero, - can = vegaCanvas.canvas(x2 - x1, y2 - y1), - ctx = can.getContext('2d'), - img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), - pix = img.data; - - for (let j=y1, k=0; j a.concat(featurize(f)), []) - }; - } - - function featurize(f) { - return f.type === FeatureCollection - ? f.features - : vegaUtil.array(f).filter(d => d != null).map( - d => d.type === Feature ? d : {type: Feature, geometry: d} - ); - } - - exports.contour = Contour; - exports.geojson = GeoJSON; - exports.geopath = GeoPath; - exports.geopoint = GeoPoint; - exports.geoshape = GeoShape; - exports.graticule = Graticule; - exports.heatmap = Heatmap; - exports.isocontour = Isocontour; - exports.kde2d = KDE2D; - exports.projection = Projection; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-geo/build/vega-geo.min.js b/node_modules/vega-geo/build/vega-geo.min.js deleted file mode 100644 index a829e84..0000000 --- a/node_modules/vega-geo/build/vega-geo.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-array"),require("vega-statistics"),require("vega-projection"),require("d3-geo"),require("d3-color"),require("vega-canvas")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-array","vega-statistics","vega-projection","d3-geo","d3-color","vega-canvas"],t):t(((e=e||self).vega=e.vega||{},e.vega.transforms={}),e.vega,e.vega,e.d3,e.vega,e.vega,e.d3,e.d3,e.vega)}(this,(function(e,t,n,r,a,i,o,u,s){"use strict";function l(){}const f=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function c(){var e=1,t=1,r=u;function a(e,t){return t.map(t=>i(e,t))}function i(n,a){var i=[],u=[];return function(n,r,a){var i,u,s,l,c,d,m=new Array,p=new Array;i=u=-1,l=n[0]>=r,f[l<<1].forEach(h);for(;++i=r,f[s|l<<1].forEach(h);f[l<<0].forEach(h);for(;++u=r,c=n[u*e]>=r,f[l<<1|c<<2].forEach(h);++i=r,d=c,c=n[u*e+i+1]>=r,f[s|l<<1|c<<2|d<<3].forEach(h);f[l|c<<3].forEach(h)}i=-1,c=n[u*e]>=r,f[c<<2].forEach(h);for(;++i=r,f[c<<2|d<<3].forEach(h);function h(e){var t,n,r=[e[0][0]+i,e[0][1]+u],s=[e[1][0]+i,e[1][1]+u],l=o(r),f=o(s);(t=p[l])?(n=m[f])?(delete p[t.end],delete m[n.start],t===n?(t.ring.push(s),a(t.ring)):m[t.start]=p[n.end]={start:t.start,end:n.end,ring:t.ring.concat(n.ring)}):(delete p[t.end],t.ring.push(s),p[t.end=f]=t):(t=m[f])?(n=p[l])?(delete m[t.start],delete p[n.end],t===n?(t.ring.push(s),a(t.ring)):m[n.start]=p[t.end]={start:n.start,end:t.end,ring:n.ring.concat(t.ring)}):(delete m[t.start],t.ring.unshift(r),m[t.start=l]=t):m[l]=p[f]={start:l,end:f,ring:[r,s]}}f[c<<3].forEach(h)}(n,a,(function(e){r(e,n,a),function(e){var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];for(;++t0?i.push([e]):u.push(e)})),u.forEach((function(e){for(var t,n=0,r=i.length;n0&&o0&&u=0&&o>=0||n.error("invalid size"),e=i,t=o,a},a.smooth=function(e){return arguments.length?(r=e?u:l,a):r===u},a}function d(e,t){for(var n,r=-1,a=t.length;++rr!=m>r&&n<(d-l)*(r-f)/(m-f)+l&&(a=-a)}return a}function p(e,t,n){var r,a,i,o;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])==(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&(a=e[r=+(e[0]===t[0])],i=n[r],o=t[r],a<=i&&i<=o||o<=i&&i<=a)}function h(e,t,a){return function(i){var o=n.extent(i),u=a?Math.min(o[0],0):o[0],s=o[1],l=s-u,f=t?r.tickStep(u,s,e):l/(e+1);return r.range(f,s,f)}}function y(e){t.Transform.call(this,null,e)}function g(e,t,n,r,a){const i=e.x1||0,o=e.y1||0,u=t*n<0;function s(e){e.forEach(l)}function l(e){u&&e.reverse(),e.forEach(f)}function f(e){e[0]=(e[0]-i)*t+r,e[1]=(e[1]-o)*n+a}return function(e){return e.coordinates.forEach(s),e}}function v(e,t,n){const r=e>=0?e:a.bandwidthNRD(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function b(e){return n.isFunction(e)?e:n.constant(+e)}function x(){var e=e=>e[0],t=e=>e[1],a=n.one,i=[-1,-1],o=960,u=500,s=2;function l(n,l){const f=v(i[0],n,e)>>s,c=v(i[1],n,t)>>s,d=f?f+2:0,m=c?c+2:0,p=2*d+(o>>s),h=2*m+(u>>s),y=new Float32Array(p*h),g=new Float32Array(p*h);let b=y;n.forEach(n=>{const r=d+(+e(n)>>s),i=m+(+t(n)>>s);r>=0&&r=0&&i0&&c>0?(E(p,h,y,g,f),D(p,h,g,y,c),E(p,h,y,g,f),D(p,h,g,y,c),E(p,h,y,g,f),D(p,h,g,y,c)):f>0?(E(p,h,y,g,f),E(p,h,g,y,f),E(p,h,y,g,f),b=g):c>0&&(D(p,h,y,g,c),D(p,h,g,y,c),D(p,h,y,g,c),b=g);let x=l?Math.pow(2,-2*s):1/r.sum(b);for(let e=0,t=p*h;e>s),y2:m+(u>>s)}}return l.x=function(t){return arguments.length?(e=b(t),l):e},l.y=function(e){return arguments.length?(t=b(e),l):t},l.weight=function(e){return arguments.length?(a=b(e),l):a},l.size=function(e){if(!arguments.length)return[o,u];var t=+e[0],r=+e[1];return t>=0&&r>=0||n.error("invalid size"),o=t,u=r,l},l.cellSize=function(e){return arguments.length?((e=+e)>=1||n.error("invalid cell size"),s=Math.floor(Math.log(e)/Math.LN2),l):1<=a&&(t>=i&&(u-=n[t-i+o*e]),r[t-a+o*e]=u/Math.min(t+1,e-1+i-t,i))}function D(e,t,n,r,a){const i=1+(a<<1);for(let o=0;o=a&&(u>=i&&(s-=n[o+(u-i)*e]),r[o+(u-a)*e]=s/Math.min(u+1,t-1+i-u,i))}function z(e){t.Transform.call(this,null,e)}y.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},n.inherits(y,t.Transform).transform=function(e,a){if(this.value&&!a.changed()&&!e.modified())return a.StopPropagation;var i=a.fork(a.NO_SOURCE|a.NO_FIELDS),o=a.materialize(a.SOURCE).source,u=e.field||n.identity,s=c().smooth(!1!==e.smooth),l=e.thresholds||function(e,t,n){const a=h(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?a:a(e.map(e=>r.max(t(e).values)))}(o,u,e),f=null===e.as?null:e.as||"contour",d=[];return o.forEach(r=>{const a=u(r),i=s.size([a.width,a.height])(a.values,n.isArray(l)?l:l(a.values));!function(e,t,r,a){let i=a.scale||t.scale,o=a.translate||t.translate;n.isFunction(i)&&(i=i(r,a));n.isFunction(o)&&(o=o(r,a));if((1===i||null==i)&&!o)return;const u=(n.isNumber(i)?i:i[0])||1,s=(n.isNumber(i)?i:i[1])||1,l=o&&o[0]||0,f=o&&o[1]||0;e.forEach(g(t,u,s,l,f))}(i,a,r,e),i.forEach(e=>{d.push(t.rederive(r,t.ingest(null!=f?{[f]:e}:e)))})}),this.value&&(i.rem=this.value),this.value=i.source=i.add=d,i},z.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};var S=n.inherits(z,t.Transform);const R=["x","y","weight","size","cellSize","bandwidth"];function w(e,t){return R.forEach(n=>null!=t[n]?e[n](t[n]):0),e}function j(e){t.Transform.call(this,null,e)}S.transform=function(e,r){if(this.value&&!r.changed()&&!e.modified())return r.StopPropagation;var a,i=r.fork(r.NO_SOURCE|r.NO_FIELDS),o=function(e,t){var n,r,a,i,o,u,s=[],l=e=>e(i);if(null==t)s.push(e);else for(n={},r=0,a=e.length;rt.ingest(function(e,t){for(let n=0;ne(n,t),r.dep=q(e)):e?r=n.constant(e):(r=e=>e.$value/e.$max||0,r.dep=!0);return r}(e.opacity,e),f=function(e,t){let r;n.isFunction(e)?(r=n=>u.rgb(e(n,t)),r.dep=q(e)):r=n.constant(u.rgb(e||"#888"));return r}(e.color,e),c=e.as||"image",d={$x:0,$y:0,$value:0,$max:i?r.max(a.map(e=>r.max(o(e).values))):0};return a.forEach(e=>{const t=o(e),a=n.extend({},e,d);i||(a.$max=r.max(t.values||[])),e[c]=function(e,t,r,a){const i=e.width,o=e.height,u=e.x1||0,l=e.y1||0,f=e.x2||i,c=e.y2||o,d=e.values,m=d?e=>d[e]:n.zero,p=s.canvas(f-u,c-l),h=p.getContext("2d"),y=h.getImageData(0,0,f-u,c-l),g=y.data;for(let e=l,n=0;ee.concat(function(e){return"FeatureCollection"===e.type?e.features:n.array(e).filter(e=>null!=e).map(e=>"Feature"===e.type?e:{type:"Feature",geometry:e})}(t)),[])}}(t.fit);t.extent?e.fitExtent(t.extent,r):t.size&&e.fitSize(t.size,r)}(r,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)},e.contour=j,e.geojson=F,e.geopath=O,e.geopoint=M,e.geoshape=T,e.graticule=C,e.heatmap=_,e.isocontour=y,e.kde2d=z,e.projection=P,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-geo/index.js b/node_modules/vega-geo/index.js deleted file mode 100644 index 41461ba..0000000 --- a/node_modules/vega-geo/index.js +++ /dev/null @@ -1,10 +0,0 @@ -export {default as contour} from './src/Contour'; -export {default as geojson} from './src/GeoJSON'; -export {default as geopath} from './src/GeoPath'; -export {default as geopoint} from './src/GeoPoint'; -export {default as geoshape} from './src/GeoShape'; -export {default as graticule} from './src/Graticule'; -export {default as heatmap} from './src/Heatmap'; -export {default as isocontour} from './src/Isocontour'; -export {default as kde2d} from './src/KDE2D'; -export {default as projection} from './src/Projection'; diff --git a/node_modules/vega-geo/package.json b/node_modules/vega-geo/package.json deleted file mode 100644 index 4b07156..0000000 --- a/node_modules/vega-geo/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "vega-geo@~4.3.4", - "_id": "vega-geo@4.3.4", - "_inBundle": false, - "_integrity": "sha512-sfMK1XGCLzMnfmy7fBJ2D+h8NG5WDwnSiPvcsjgwwAyonlUgCZWKdrNouAyLaRODy5ICZUEj/GDILSBdlIfUCg==", - "_location": "/vega-geo", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-geo@~4.3.4", - "name": "vega-geo", - "escapedName": "vega-geo", - "rawSpec": "~4.3.4", - "saveSpec": null, - "fetchSpec": "~4.3.4" - }, - "_requiredBy": [ - "/vega" - ], - "_resolved": "https://registry.npmjs.org/vega-geo/-/vega-geo-4.3.4.tgz", - "_shasum": "1bd26e438a304ff2596d51f57acee0e119e81313", - "_spec": "vega-geo@~4.3.4", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "^2.4.0", - "d3-color": "^1.4.1", - "d3-geo": "^1.12.1", - "vega-canvas": "^1.2.2", - "vega-dataflow": "^5.6.0", - "vega-projection": "^1.4.2", - "vega-statistics": "^1.7.5", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "Geographic data transforms for Vega dataflows.", - "devDependencies": { - "vega-transforms": "*" - }, - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "geo", - "projection", - "graticule" - ], - "license": "BSD-3-Clause", - "main": "build/vega-geo.js", - "module": "index", - "name": "vega-geo", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-geo.js -c -m -o build/vega-geo.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g d3-array:d3,d3-color:d3,d3-geo:d3,vega-canvas:vega,vega-dataflow:vega,vega-projection:vega,vega-statistics:vega,vega-util:vega -f umd -n vega.transforms -o build/vega-geo.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "4.3.4" -} diff --git a/node_modules/vega-geo/src/Contour.js b/node_modules/vega-geo/src/Contour.js deleted file mode 100644 index 36e234c..0000000 --- a/node_modules/vega-geo/src/Contour.js +++ /dev/null @@ -1,87 +0,0 @@ -import {Transform, ingest} from 'vega-dataflow'; -import {inherits, isArray} from 'vega-util'; -import {transform} from './Isocontour'; -import {params} from './KDE2D'; -import contours from './util/contours'; -import density2D from './util/density2D'; -import quantize from './util/quantize'; - -/** - * Generate contours based on kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ -export default function Contour(params) { - Transform.call(this, null, params); -} - -Contour.Definition = { - 'type': 'Contour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'values', 'type': 'number', 'array': true }, - { 'name': 'x', 'type': 'field' }, - { 'name': 'y', 'type': 'field' }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number' }, - { 'name': 'count', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true } - ] -}; - -var prototype = inherits(Contour, Transform); - -prototype.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - contour = contours().smooth(_.smooth !== false), - values = _.values, - thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values), - size = _.size, grid, post; - - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [grid.width, grid.height]; - values = grid.values; - } - - thresh = isArray(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map(ingest); - - return out; -}; diff --git a/node_modules/vega-geo/src/GeoJSON.js b/node_modules/vega-geo/src/GeoJSON.js deleted file mode 100644 index b3ca7c0..0000000 --- a/node_modules/vega-geo/src/GeoJSON.js +++ /dev/null @@ -1,81 +0,0 @@ -import {Feature, FeatureCollection, MultiPoint} from './constants'; -import {Transform} from 'vega-dataflow'; -import {accessorFields, identity, inherits} from 'vega-util'; - -/** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ -export default function GeoJSON(params) { - Transform.call(this, null, params); -} - -GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'length': 2 }, - { 'name': 'geojson', 'type': 'field' } - ] -}; - -var prototype = inherits(GeoJSON, Transform); - -prototype.transform = function(_, pulse) { - var features = this._features, - points = this._points, - fields = _.fields, - lon = fields && fields[0], - lat = fields && fields[1], - geojson = _.geojson || (!fields && identity), - flag = pulse.ADD, - mod; - - mod = _.modified() - || pulse.changed(pulse.REM) - || pulse.modified(accessorFields(geojson)) - || (lon && (pulse.modified(accessorFields(lon)))) - || (lat && (pulse.modified(accessorFields(lat)))); - - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = (features = []); - this._points = (points = []); - } - - if (geojson) { - pulse.visit(flag, function(t) { - features.push(geojson(t)); - }); - } - - if (lon && lat) { - pulse.visit(flag, function(t) { - var x = lon(t), - y = lat(t); - if (x != null && y != null && (x = +x) === x && (y = +y) === y) { - points.push([x, y]); - } - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - - this.value = { - type: FeatureCollection, - features: features - }; -}; diff --git a/node_modules/vega-geo/src/GeoPath.js b/node_modules/vega-geo/src/GeoPath.js deleted file mode 100644 index 9454515..0000000 --- a/node_modules/vega-geo/src/GeoPath.js +++ /dev/null @@ -1,66 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {getProjectionPath} from 'vega-projection'; -import {identity, inherits} from 'vega-util'; - -/** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ -export default function GeoPath(params) { - Transform.call(this, null, params); -} - -GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] -}; - -var prototype = inherits(GeoPath, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - path = this.value, - field = _.field || identity, - as = _.as || 'path', - flag = out.SOURCE; - - function set(t) { t[as] = path(field(t)); } - - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = getProjectionPath(_.projection); - out.materialize().reflow(); - } else { - flag = field === identity || pulse.modified(field.fields) - ? out.ADD_MOD - : out.ADD; - } - - var prev = initPath(path, _.pointRadius); - out.visit(flag, set); - path.pointRadius(prev); - - return out.modifies(as); -}; - -function initPath(path, pointRadius) { - var prev = path.pointRadius(); - path.context(null); - if (pointRadius != null) { - path.pointRadius(pointRadius); - } - return prev; -} diff --git a/node_modules/vega-geo/src/GeoPoint.js b/node_modules/vega-geo/src/GeoPoint.js deleted file mode 100644 index d9350eb..0000000 --- a/node_modules/vega-geo/src/GeoPoint.js +++ /dev/null @@ -1,60 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ -export default function GeoPoint(params) { - Transform.call(this, null, params); -} - -GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection', 'required': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true, 'length': 2 }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['x', 'y'] } - ] -}; - -var prototype = inherits(GeoPoint, Transform); - -prototype.transform = function(_, pulse) { - var proj = _.projection, - lon = _.fields[0], - lat = _.fields[1], - as = _.as || ['x', 'y'], - x = as[0], - y = as[1], - mod; - - function set(t) { - var xy = proj([lon(t), lat(t)]); - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - - if (_.modified()) { - // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - } else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - - return pulse.modifies(as); -}; diff --git a/node_modules/vega-geo/src/GeoShape.js b/node_modules/vega-geo/src/GeoShape.js deleted file mode 100644 index 32d4455..0000000 --- a/node_modules/vega-geo/src/GeoShape.js +++ /dev/null @@ -1,70 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {getProjectionPath} from 'vega-projection'; -import {field, inherits} from 'vega-util'; - -/** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ -export default function GeoShape(params) { - Transform.call(this, null, params); -} - -GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': {'modifies': true, 'nomod': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field', 'default': 'datum' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'shape' } - ] -}; - -var prototype = inherits(GeoShape, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - shape = this.value, - as = _.as || 'shape', - flag = out.ADD; - - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator( - getProjectionPath(_.projection), - _.field || field('datum'), - _.pointRadius - ); - out.materialize().reflow(); - flag = out.SOURCE; - } - - out.visit(flag, function(t) { t[as] = shape; }); - - return out.modifies(as); -}; - -function shapeGenerator(path, field, pointRadius) { - var shape = pointRadius == null - ? function(_) { return path(field(_)); } - : function(_) { - var prev = path.pointRadius(), - value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - shape.context = function(_) { - path.context(_); - return shape; - }; - - return shape; -} diff --git a/node_modules/vega-geo/src/Graticule.js b/node_modules/vega-geo/src/Graticule.js deleted file mode 100644 index 942fbdf..0000000 --- a/node_modules/vega-geo/src/Graticule.js +++ /dev/null @@ -1,54 +0,0 @@ -import {Transform, ingest, replace} from 'vega-dataflow'; -import {inherits, isFunction} from 'vega-util'; -import {geoGraticule} from 'd3-geo'; - -/** - * GeoJSON feature generator for creating graticules. - * @constructor - */ -export default function Graticule(params) { - Transform.call(this, [], params); - this.generator = geoGraticule(); -} - -Graticule.Definition = { - 'type': 'Graticule', - 'metadata': {'changes': true, 'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMajor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMinor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'step', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'stepMajor', 'type': 'number', 'array': true, 'length': 2, 'default': [90, 360] }, - { 'name': 'stepMinor', 'type': 'number', 'array': true, 'length': 2, 'default': [10, 10] }, - { 'name': 'precision', 'type': 'number', 'default': 2.5 } - ] -}; - -var prototype = inherits(Graticule, Transform); - -prototype.transform = function(_, pulse) { - var src = this.value, - gen = this.generator, t; - - if (!src.length || _.modified()) { - for (var prop in _) { - if (isFunction(gen[prop])) { - gen[prop](_[prop]); - } - } - } - - t = gen(); - if (src.length) { - pulse.mod.push(replace(src[0], t)); - } else { - pulse.add.push(ingest(t)); - } - src[0] = t; - - return pulse; -}; diff --git a/node_modules/vega-geo/src/Heatmap.js b/node_modules/vega-geo/src/Heatmap.js deleted file mode 100644 index 079a3fb..0000000 --- a/node_modules/vega-geo/src/Heatmap.js +++ /dev/null @@ -1,149 +0,0 @@ -import {max} from 'd3-array'; -import {rgb} from 'd3-color'; -import {canvas} from 'vega-canvas'; -import {Transform} from 'vega-dataflow'; -import { - accessorFields, constant, extend, identity, - inherits, isFunction, toSet, zero -} from 'vega-util'; - -/** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ -export default function Heatmap(params) { - Transform.call(this, null, params); -} - -Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'color', 'type': 'string', 'expr': true}, - { 'name': 'opacity', 'type': 'number', 'expr': true}, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'as', 'type': 'string', 'default': 'image' } - ] -}; - -var prototype = inherits(Heatmap, Transform); - -prototype.transform = function(_, pulse) { - if (!pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var source = pulse.materialize(pulse.SOURCE).source, - shared = _.resolve === 'shared', - field = _.field || identity, - opacity = opacity_(_.opacity, _), - color = color_(_.color, _), - as = _.as || 'image', - obj = { - $x: 0, $y: 0, $value: 0, - $max: shared ? max(source.map(t => max(field(t).values))) : 0 - }; - - source.forEach(t => { - const v = field(t); - - // build proxy data object - const o = extend({}, t, obj); - // set maximum value if not globally shared - if (!shared) o.$max = max(v.values || []); - - // generate canvas image - // optimize color/opacity if not pixel-dependent - t[as] = toCanvas(v, o, - color.dep ? color : constant(color(o)), - opacity.dep ? opacity : constant(opacity(o)) - ); - }); - - return pulse.reflow(true).modifies(as); -}; - -// get image color function -function color_(color, _) { - let f; - if (isFunction(color)) { - f = obj => rgb(color(obj, _)); - f.dep = dependency(color); - } else { - // default to mid-grey - f = constant(rgb(color || '#888')); - } - return f; -} - -// get image opacity function -function opacity_(opacity, _) { - let f; - if (isFunction(opacity)) { - f = obj => opacity(obj, _); - f.dep = dependency(opacity); - } else if (opacity) { - f = constant(opacity); - } else { - // default to [0, max] opacity gradient - f = obj => (obj.$value / obj.$max) || 0; - f.dep = true; - } - return f; -} - -// check if function depends on individual pixel data -function dependency(f) { - if (!isFunction(f)) return false; - const set = toSet(accessorFields(f)); - return set.$x || set.$y || set.$value || set.$max; -} - -// render raster grid to canvas -function toCanvas(grid, obj, color, opacity) { - const n = grid.width, - m = grid.height, - x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - x2 = grid.x2 || n, - y2 = grid.y2 || m, - val = grid.values, - value = val ? i => val[i] : zero, - can = canvas(x2 - x1, y2 - y1), - ctx = can.getContext('2d'), - img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), - pix = img.data; - - for (let j=y1, k=0; j} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ -export default function Isocontour(params) { - Transform.call(this, null, params); -} - -Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'levels', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'zero', 'type': 'boolean', 'default': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true }, - { 'name': 'scale', 'type': 'number', 'expr': true }, - { 'name': 'translate', 'type': 'number', 'array': true, 'expr': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'default': 'contour' } - ] -}; - -var prototype = inherits(Isocontour, Transform); - -prototype.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - field = _.field || identity, - contour = contours().smooth(_.smooth !== false), - tz = _.thresholds || levels(source, field, _), - as = _.as === null ? null : _.as || 'contour', - values = []; - - source.forEach(t => { - const grid = field(t); - - // generate contour paths in GeoJSON format - const paths = contour.size([grid.width, grid.height])( - grid.values, isArray(tz) ? tz : tz(grid.values) - ); - - // adjust contour path coordinates as needed - transformPaths(paths, grid, t, _); - - // ingest; copy source data properties to output - paths.forEach(p => { - values.push(rederive(t, ingest(as != null ? {[as]: p} : p))); - }); - }); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; -}; - -function levels(values, f, _) { - const q = quantize(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' - ? q - : q(values.map(t => max(f(t).values))); -} - -function transformPaths(paths, grid, datum, _) { - let s = _.scale || grid.scale, - t = _.translate || grid.translate; - if (isFunction(s)) s = s(datum, _); - if (isFunction(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - - const sx = (isNumber(s) ? s : s[0]) || 1, - sy = (isNumber(s) ? s : s[1]) || 1, - tx = t && t[0] || 0, - ty = t && t[1] || 0; - - paths.forEach(transform(grid, sx, sy, tx, ty)); -} - -export function transform(grid, sx, sy, tx, ty) { - const x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - flip = sx * sy < 0; - - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); - } - - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - coordinates.forEach(transformPoint); - } - - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; - } - - return function(geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; - }; -} diff --git a/node_modules/vega-geo/src/KDE2D.js b/node_modules/vega-geo/src/KDE2D.js deleted file mode 100644 index 83542a0..0000000 --- a/node_modules/vega-geo/src/KDE2D.js +++ /dev/null @@ -1,112 +0,0 @@ -import density2D from './util/density2D'; -import {Transform, ingest} from 'vega-dataflow'; -import {accessorName, inherits} from 'vega-util'; - -/** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ -export default function KDE2D(params) { - Transform.call(this, null, params); -} - -KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': 'grid'} - ] -}; - -var prototype = inherits(KDE2D, Transform); - -const PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth']; - -export function params(obj, _) { - PARAMS.forEach(param => _[param] != null ? obj[param](_[param]) : 0); - return obj; -} - -prototype.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) - return pulse.StopPropagation; - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby), - names = (_.groupby || []).map(accessorName), - kde = params(density2D(), _), - as = _.as || 'grid', - values = []; - - function set(t, vals) { - for (let i=0; i ingest( - set({[as]: kde(g, _.counts)}, g.dims) - )); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; -}; - -export function partition(data, groupby) { - var groups = [], - get = f => f(t), - map, i, n, t, k, g; - - // partition data points into groups - if (groupby == null) { - groups.push(data); - } else { - for (map={}, i=0, n=data.length; i a.concat(featurize(f)), []) - }; -} - -function featurize(f) { - return f.type === FeatureCollection - ? f.features - : array(f).filter(d => d != null).map( - d => d.type === Feature ? d : {type: Feature, geometry: d} - ); -} diff --git a/node_modules/vega-geo/src/constants.js b/node_modules/vega-geo/src/constants.js deleted file mode 100644 index ef9b095..0000000 --- a/node_modules/vega-geo/src/constants.js +++ /dev/null @@ -1,3 +0,0 @@ -export var Feature = 'Feature'; -export var FeatureCollection = 'FeatureCollection'; -export var MultiPoint = 'MultiPoint'; diff --git a/node_modules/vega-geo/src/util/contours.js b/node_modules/vega-geo/src/util/contours.js deleted file mode 100644 index e3f01b1..0000000 --- a/node_modules/vega-geo/src/util/contours.js +++ /dev/null @@ -1,218 +0,0 @@ -import {error} from 'vega-util'; - -function noop() {} - -const cases = [ - [], - [[[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]]], - [] -]; - -// Implementation adapted from d3/d3-contour. Thanks! -export default function() { - var dx = 1, - dy = 1, - smooth = smoothLinear; - - function contours(values, tz) { - return tz.map(value => 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.js - function contour(values, value) { - var polygons = [], - holes = []; - - 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 = 0, n = polygons.length, polygon; i < n; ++i) { - if (contains((polygon = polygons[i])[0], hole) !== -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/stitch.js - function isorings(values, value, callback) { - var fragmentByStart = new Array, - fragmentByEnd = new Array, - x, y, t0, t1, t2, t3; - - // Special case for the first row (y = -1, t2 = t3 = 0). - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - - // General case for the intermediate rows. - while (++y < dy - 1) { - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - - // Special case for the last row (y = dy - 1, t0 = t1 = 0). - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - - function stitch(line) { - var start = [line[0][0] + x, line[0][1] + y], - end = [line[1][0] + x, line[1][1] + y], - startIndex = index(start), - endIndex = index(end), - f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[f.start] = fragmentByEnd[g.end] = {start: f.start, end: g.end, ring: f.ring.concat(g.ring)}; - } - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[g.start] = fragmentByEnd[f.end] = {start: g.start, end: f.end, ring: g.ring.concat(f.ring)}; - } - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else { - fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {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 = point[0], - y = point[1], - xt = x | 0, - yt = y | 0, - v0, - v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); - } - - contours.contour = contour; - - contours.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, contours; - }; - - contours.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop, contours) : smooth === smoothLinear; - }; - - return contours; -} - -function area(ring) { - var i = 0, - n = ring.length, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area; -} - -function contains(ring, hole) { - var i = -1, n = hole.length, c; - while (++i < n) if (c = ringContains(ring, hole[i])) return c; - return 0; -} - -function ringContains(ring, point) { - var x = point[0], y = point[1], contains = -1; - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) contains = -contains; - } - return contains; -} - -function segmentContains(a, b, c) { - var i; return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); -} - -function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); -} - -function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; -} diff --git a/node_modules/vega-geo/src/util/density2D.js b/node_modules/vega-geo/src/util/density2D.js deleted file mode 100644 index 326d34e..0000000 --- a/node_modules/vega-geo/src/util/density2D.js +++ /dev/null @@ -1,150 +0,0 @@ -import {bandwidthNRD} from 'vega-statistics'; -import {array, constant, error, isFunction, one} from 'vega-util'; -import {sum} from 'd3-array'; - -function radius(bw, data, f) { - const v = bw >= 0 ? bw : bandwidthNRD(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); -} - -function number(_) { - return isFunction(_) ? _ : constant(+_); -} - -// Implementation adapted from d3/d3-contour. Thanks! -export default function() { - var x = d => d[0], - y = d => d[1], - weight = one, - bandwidth = [-1, -1], - dx = 960, - dy = 500, - k = 2; // log2(cellSize) - - function density(data, counts) { - const rx = radius(bandwidth[0], data, x) >> k, // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, // blur y-radius - ox = rx ? rx + 2 : 0, // x-offset padding for blur - oy = ry ? ry + 2 : 0, // y-offset padding for blur - n = 2 * ox + (dx >> k), // grid width - m = 2 * oy + (dy >> k), // grid height - values0 = new Float32Array(n * m), - values1 = new Float32Array(n * m); - - let values = values0; - - data.forEach(d => { - const xi = ox + (+x(d) >> k), - yi = oy + (+y(d) >> k); - - if (xi >= 0 && xi < n && yi >= 0 && yi < m) { - values0[xi + yi * n] += +weight(d); - } - }); - - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } - - // scale density estimates - // density in points per square pixel or probability density - let s = counts ? Math.pow(2, -2 * k) : 1 / sum(values); - for (let i=0, sz=n*m; i> k), - y2: oy + (dy >> k) - }; - } - - density.x = function(_) { - return arguments.length ? (x = number(_), density) : x; - }; - - density.y = function(_) { - return arguments.length ? (y = number(_), density) : y; - }; - - density.weight = function(_) { - return arguments.length ? (weight = number(_), density) : weight; - }; - - density.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, density; - }; - - density.cellSize = function(_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) error('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - - density.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - _ = array(_); - if (_.length === 1) _ = [+_[0], +_[0]]; - if (_.length !== 2) error('invalid bandwidth'); - return bandwidth = _, density; - }; - - return density; -} - -function blurX(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let j = 0; j < m; ++j) { - for (let i = 0, sr = 0; i < n + r; ++i) { - if (i < n) { - sr += source[i + j * n]; - } - if (i >= r) { - if (i >= w) { - sr -= source[i - w + j * n]; - } - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } - } -} - -function blurY(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let i = 0; i < n; ++i) { - for (let j = 0, sr = 0; j < m + r; ++j) { - if (j < m) { - sr += source[i + j * n]; - } - if (j >= r) { - if (j >= w) { - sr -= source[i + (j - w) * n]; - } - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } - } -} diff --git a/node_modules/vega-geo/src/util/quantize.js b/node_modules/vega-geo/src/util/quantize.js deleted file mode 100644 index cd51263..0000000 --- a/node_modules/vega-geo/src/util/quantize.js +++ /dev/null @@ -1,13 +0,0 @@ -import {range, tickStep} from 'd3-array'; -import {extent} from 'vega-util'; - -export default function(k, nice, zero) { - return function(values) { - var ex = extent(values), - start = zero ? Math.min(ex[0], 0) : ex[0], - stop = ex[1], - span = stop - start, - step = nice ? tickStep(start, stop, k) : (span / (k + 1)); - return range(step, stop, step); - }; -} diff --git a/node_modules/vega-hierarchy/LICENSE b/node_modules/vega-hierarchy/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-hierarchy/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-hierarchy/README.md b/node_modules/vega-hierarchy/README.md deleted file mode 100644 index 0783df1..0000000 --- a/node_modules/vega-hierarchy/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# vega-hierarchy - -Hierarchical layout transforms for Vega dataflows. - -This pacakge provides the following Vega data transforms: - -- [**Nest**](https://vega.github.io/vega/docs/transforms/nest/) [<>](https://github.com/vega/vega/blob/master/packages/vega-hierarchy/src/Nest.js "Source") -- [**Pack**](https://vega.github.io/vega/docs/transforms/pack/) [<>](https://github.com/vega/vega/blob/master/packages/vega-hierarchy/src/Pack.js "Source") -- [**Partition**](https://vega.github.io/vega/docs/transforms/partition/) [<>](https://github.com/vega/vega/blob/master/packages/vega-hierarchy/src/Partition.js "Source") -- [**Stratify**](https://vega.github.io/vega/docs/transforms/stratify/) [<>](https://github.com/vega/vega/blob/master/packages/vega-hierarchy/src/Stratify.js "Source") -- [**Tree**](https://vega.github.io/vega/docs/transforms/tree/) [<>](https://github.com/vega/vega/blob/master/packages/vega-hierarchy/src/Tree.js "Source") -- [**Treemap**](https://vega.github.io/vega/docs/transforms/treemap/) [<>](https://github.com/vega/vega/blob/master/packages/vega-hierarchy/src/Treemap.js "Source") -- [**TreeLinks**](https://vega.github.io/vega/docs/transforms/treelinks/) [<>](https://github.com/vega/vega/blob/master/packages/vega-hierarchy/src/TreeLinks.js "Source") diff --git a/node_modules/vega-hierarchy/build/vega-hierarchy.js b/node_modules/vega-hierarchy/build/vega-hierarchy.js deleted file mode 100644 index 785307f..0000000 --- a/node_modules/vega-hierarchy/build/vega-hierarchy.js +++ /dev/null @@ -1,507 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-dataflow'), require('vega-util'), require('d3-hierarchy')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-dataflow', 'vega-util', 'd3-hierarchy'], factory) : - (global = global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.vega, global.vega, global.d3)); -}(this, (function (exports, vegaDataflow, vegaUtil, d3Hierarchy) { 'use strict'; - - // Build lookup table mapping tuple keys to tree node instances - function lookup(tree, key, filter) { - var map = {}; - tree.each(function(node) { - var t = node.data; - if (filter(t)) map[key(t)] = node; - }); - tree.lookup = map; - return tree; - } - - /** - * Nest tuples into a tree structure, grouped by key values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ - function Nest(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Nest.Definition = { - 'type': 'Nest', - 'metadata': {'treesource': true, 'changes': true}, - 'params': [ - { 'name': 'keys', 'type': 'field', 'array': true }, - { 'name': 'generate', 'type': 'boolean' } - ] - }; - - var prototype = vegaUtil.inherits(Nest, vegaDataflow.Transform); - - function children(n) { - return n.values; - } - - prototype.transform = function(_, pulse) { - if (!pulse.source) { - vegaUtil.error('Nest transform requires an upstream data source.'); - } - - var gen = _.generate, - mod = _.modified(), - out = pulse.clone(), - tree = this.value; - - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) { - tree.each(node => { - if (node.children && vegaDataflow.isTuple(node.data)) { - out.rem.push(node.data); - } - }); - } - - // generate new tree structure - this.value = tree = d3Hierarchy.hierarchy({ - values: vegaUtil.array(_.keys) - .reduce((n, k) => { n.key(k); return n; }, nest()) - .entries(out.source) - }, children); - - // collect nodes to add - if (gen) { - tree.each(node => { - if (node.children) { - node = vegaDataflow.ingest(node.data); - out.add.push(node); - out.source.push(node); - } - }); - } - - // build lookup table - lookup(tree, vegaDataflow.tupleid, vegaDataflow.tupleid); - } - - out.source.root = tree; - return out; - }; - - function nest() { - var keys = [], - nest; - - function apply(array, depth) { - if (depth >= keys.length) { - return array; - } - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - value, - valuesByKey = {}, - values, - result = {}; - - while (++i < n) { - keyValue = key(value = array[i]) + ''; - if (values = valuesByKey[keyValue]) { - values.push(value); - } else { - valuesByKey[keyValue] = [value]; - } - } - - for (keyValue in valuesByKey) { - result[keyValue] = apply(valuesByKey[keyValue], depth); - } - - return result; - } - - function entries(map, depth) { - if (++depth > keys.length) return map; - var array = [], k; - for (k in map) { - array.push({key: k, values: entries(map[k], depth)}); - } - return array; - } - - return nest = { - entries: array => entries(apply(array, 0), 0), - key: d => { keys.push(d); return nest; } - }; - } - - /** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ - function HierarchyLayout(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype$1 = vegaUtil.inherits(HierarchyLayout, vegaDataflow.Transform); - - prototype$1.transform = function(_, pulse) { - if (!pulse.source || !pulse.source.root) { - vegaUtil.error(this.constructor.name - + ' transform requires a backing tree data source.'); - } - - var layout = this.layout(_.method), - fields = this.fields, - root = pulse.source.root, - as = _.as || fields; - - if (_.field) root.sum(_.field); else root.count(); - if (_.sort) root.sort(vegaDataflow.stableCompare(_.sort, d => d.data)); - - setParams(layout, this.params, _); - if (layout.separation) { - layout.separation(_.separation !== false ? defaultSeparation : vegaUtil.one); - } - - try { - this.value = layout(root); - } catch (err) { - vegaUtil.error(err); - } - root.each(function(node) { setFields(node, fields, as); }); - - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); - }; - - function setParams(layout, params, _) { - for (var p, i=0, n=params.length; ifunction e(a,r){if(++r>t.length)return a;var n,i=[];for(n in a)i.push({key:n,values:e(a[n],r)});return i}(function e(a,r){if(r>=t.length)return a;for(var n,i,o,s=-1,u=a.length,d=t[r++],l={},f={};++s(t.push(a),e)}}function u(e){t.Transform.call(this,null,e)}function d(e,t){return e.parent===t.parent?1:2}i.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},a.inherits(i,t.Transform).transform=function(e,i){i.source||a.error("Nest transform requires an upstream data source.");var u=e.generate,d=e.modified(),l=i.clone(),f=this.value;return(!f||d||i.changed())&&(f&&f.each(e=>{e.children&&t.isTuple(e.data)&&l.rem.push(e.data)}),this.value=f=r.hierarchy({values:a.array(e.keys).reduce((e,t)=>(e.key(t),e),s()).entries(l.source)},o),u&&f.each(e=>{e.children&&(e=t.ingest(e.data),l.add.push(e),l.source.push(e))}),n(f,t.tupleid,t.tupleid)),l.source.root=f,l},a.inherits(u,t.Transform).transform=function(e,r){r.source&&r.source.root||a.error(this.constructor.name+" transform requires a backing tree data source.");var n=this.layout(e.method),i=this.fields,o=r.source.root,s=e.as||i;e.field?o.sum(e.field):o.count(),e.sort&&o.sort(t.stableCompare(e.sort,e=>e.data)),function(e,t,a){for(var r,n=0,i=t.length;n d.data)); - - setParams(layout, this.params, _); - if (layout.separation) { - layout.separation(_.separation !== false ? defaultSeparation : one); - } - - try { - this.value = layout(root); - } catch (err) { - error(err); - } - root.each(function(node) { setFields(node, fields, as); }); - - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); -}; - -function setParams(layout, params, _) { - for (var p, i=0, n=params.length; i} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ -export default function Nest(params) { - Transform.call(this, null, params); -} - -Nest.Definition = { - 'type': 'Nest', - 'metadata': {'treesource': true, 'changes': true}, - 'params': [ - { 'name': 'keys', 'type': 'field', 'array': true }, - { 'name': 'generate', 'type': 'boolean' } - ] -}; - -var prototype = inherits(Nest, Transform); - -function children(n) { - return n.values; -} - -prototype.transform = function(_, pulse) { - if (!pulse.source) { - error('Nest transform requires an upstream data source.'); - } - - var gen = _.generate, - mod = _.modified(), - out = pulse.clone(), - tree = this.value; - - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) { - tree.each(node => { - if (node.children && isTuple(node.data)) { - out.rem.push(node.data); - } - }); - } - - // generate new tree structure - this.value = tree = hierarchy({ - values: array(_.keys) - .reduce((n, k) => { n.key(k); return n; }, nest()) - .entries(out.source) - }, children); - - // collect nodes to add - if (gen) { - tree.each(node => { - if (node.children) { - node = ingest(node.data); - out.add.push(node); - out.source.push(node); - } - }); - } - - // build lookup table - lookup(tree, tupleid, tupleid); - } - - out.source.root = tree; - return out; -}; - -function nest() { - var keys = [], - nest; - - function apply(array, depth) { - if (depth >= keys.length) { - return array; - } - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - value, - valuesByKey = {}, - values, - result = {}; - - while (++i < n) { - keyValue = key(value = array[i]) + ''; - if (values = valuesByKey[keyValue]) { - values.push(value); - } else { - valuesByKey[keyValue] = [value]; - } - } - - for (keyValue in valuesByKey) { - result[keyValue] = apply(valuesByKey[keyValue], depth); - } - - return result; - } - - function entries(map, depth) { - if (++depth > keys.length) return map; - var array = [], k; - for (k in map) { - array.push({key: k, values: entries(map[k], depth)}); - } - return array; - } - - return nest = { - entries: array => entries(apply(array, 0), 0), - key: d => { keys.push(d); return nest; } - }; -} diff --git a/node_modules/vega-hierarchy/src/Pack.js b/node_modules/vega-hierarchy/src/Pack.js deleted file mode 100644 index fcda59e..0000000 --- a/node_modules/vega-hierarchy/src/Pack.js +++ /dev/null @@ -1,36 +0,0 @@ -import HierarchyLayout from './HierarchyLayout'; -import {inherits} from 'vega-util'; -import {pack} from 'd3-hierarchy'; - -var Output = ['x', 'y', 'r', 'depth', 'children']; - -/** - * Packed circle tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ -export default function Pack(params) { - HierarchyLayout.call(this, params); -} - -Pack.Definition = { - 'type': 'Pack', - 'metadata': {'tree': true, 'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'padding', 'type': 'number', 'default': 0 }, - { 'name': 'radius', 'type': 'field', 'default': null }, - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': Output.length, 'default': Output } - ] -}; - -var prototype = inherits(Pack, HierarchyLayout); - -prototype.layout = pack; - -prototype.params = ['radius', 'size', 'padding']; - -prototype.fields = Output; diff --git a/node_modules/vega-hierarchy/src/Partition.js b/node_modules/vega-hierarchy/src/Partition.js deleted file mode 100644 index c017ee3..0000000 --- a/node_modules/vega-hierarchy/src/Partition.js +++ /dev/null @@ -1,36 +0,0 @@ -import HierarchyLayout from './HierarchyLayout'; -import {inherits} from 'vega-util'; -import {partition} from 'd3-hierarchy'; - -var Output = ['x0', 'y0', 'x1', 'y1', 'depth', 'children']; - -/** - * Partition tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ -export default function Partition(params) { - HierarchyLayout.call(this, params); -} - -Partition.Definition = { - 'type': 'Partition', - 'metadata': {'tree': true, 'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'padding', 'type': 'number', 'default': 0 }, - { 'name': 'round', 'type': 'boolean', 'default': false }, - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': Output.length, 'default': Output } - ] -}; - -var prototype = inherits(Partition, HierarchyLayout); - -prototype.layout = partition; - -prototype.params = ['size', 'round', 'padding']; - -prototype.fields = Output; diff --git a/node_modules/vega-hierarchy/src/Stratify.js b/node_modules/vega-hierarchy/src/Stratify.js deleted file mode 100644 index 54ca8b1..0000000 --- a/node_modules/vega-hierarchy/src/Stratify.js +++ /dev/null @@ -1,58 +0,0 @@ -import lookup from './lookup'; -import {Transform} from 'vega-dataflow'; -import {error, inherits, truthy} from 'vega-util'; -import {stratify} from 'd3-hierarchy'; - - /** - * Stratify a collection of tuples into a tree structure based on - * id and parent id fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.key - Unique key field for each tuple. - * @param {function(object): *} params.parentKey - Field with key for parent tuple. - */ -export default function Stratify(params) { - Transform.call(this, null, params); -} - -Stratify.Definition = { - 'type': 'Stratify', - 'metadata': {'treesource': true}, - 'params': [ - { 'name': 'key', 'type': 'field', 'required': true }, - { 'name': 'parentKey', 'type': 'field', 'required': true } - ] -}; - -var prototype = inherits(Stratify, Transform); - -prototype.transform = function(_, pulse) { - if (!pulse.source) { - error('Stratify transform requires an upstream data source.'); - } - - var tree = this.value, - mod = _.modified(), - out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE), - run = !this.value - || mod - || pulse.changed(pulse.ADD_REM) - || pulse.modified(_.key.fields) - || pulse.modified(_.parentKey.fields); - - // prevent upstream source pollution - out.source = out.source.slice(); - - if (run) { - if (out.source.length) { - tree = lookup( - stratify().id(_.key).parentId(_.parentKey)(out.source) - , _.key, truthy); - } else { - tree = lookup(stratify()([{}]), _.key, _.key); - } - } - - out.source.root = this.value = tree; - return out; -}; diff --git a/node_modules/vega-hierarchy/src/Tree.js b/node_modules/vega-hierarchy/src/Tree.js deleted file mode 100644 index a474f48..0000000 --- a/node_modules/vega-hierarchy/src/Tree.js +++ /dev/null @@ -1,49 +0,0 @@ -import HierarchyLayout from './HierarchyLayout'; -import {error, hasOwnProperty, inherits} from 'vega-util'; -import {cluster, tree} from 'd3-hierarchy'; - -var Layouts = { - tidy: tree, - cluster: cluster -}; - -var Output = ['x', 'y', 'depth', 'children']; - -/** - * Tree layout. Depending on the method parameter, performs either - * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ -export default function Tree(params) { - HierarchyLayout.call(this, params); -} - -Tree.Definition = { - 'type': 'Tree', - 'metadata': {'tree': true, 'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'method', 'type': 'enum', 'default': 'tidy', 'values': ['tidy', 'cluster'] }, - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'nodeSize', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'separation', 'type': 'boolean', 'default': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': Output.length, 'default': Output } - ] -}; - -var prototype = inherits(Tree, HierarchyLayout); - -/** - * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. - */ -prototype.layout = function(method) { - var m = method || 'tidy'; - if (hasOwnProperty(Layouts, m)) return Layouts[m](); - else error('Unrecognized Tree layout method: ' + m); -}; - -prototype.params = ['size', 'nodeSize']; - -prototype.fields = Output; diff --git a/node_modules/vega-hierarchy/src/TreeLinks.js b/node_modules/vega-hierarchy/src/TreeLinks.js deleted file mode 100644 index fae00a3..0000000 --- a/node_modules/vega-hierarchy/src/TreeLinks.js +++ /dev/null @@ -1,62 +0,0 @@ -import {Transform, ingest, tupleid} from 'vega-dataflow'; -import {error, inherits} from 'vega-util'; - - /** - * Generate tuples representing links between tree nodes. - * The resulting tuples will contain 'source' and 'target' fields, - * which point to parent and child node tuples, respectively. - * @constructor - * @param {object} params - The parameters for this operator. - */ -export default function TreeLinks(params) { - Transform.call(this, [], params); -} - -TreeLinks.Definition = { - 'type': 'TreeLinks', - 'metadata': {'tree': true, 'generates': true, 'changes': true}, - 'params': [] -}; - -var prototype = inherits(TreeLinks, Transform); - -prototype.transform = function(_, pulse) { - var links = this.value, - tree = pulse.source && pulse.source.root, - out = pulse.fork(pulse.NO_SOURCE), - lut = {}; - - if (!tree) error('TreeLinks transform requires a tree data source.'); - - if (pulse.changed(pulse.ADD_REM)) { - // remove previous links - out.rem = links; - - // build lookup table of valid tuples - pulse.visit(pulse.SOURCE, function(t) { lut[tupleid(t)] = 1; }); - - // generate links for all edges incident on valid tuples - tree.each(function(node) { - var t = node.data, - p = node.parent && node.parent.data; - if (p && lut[tupleid(t)] && lut[tupleid(p)]) { - out.add.push(ingest({source: p, target: t})); - } - }); - this.value = out.add; - } - - else if (pulse.changed(pulse.MOD)) { - // build lookup table of modified tuples - pulse.visit(pulse.MOD, function(t) { lut[tupleid(t)] = 1; }); - - // gather links incident on modified tuples - links.forEach(function(link) { - if (lut[tupleid(link.source)] || lut[tupleid(link.target)]) { - out.mod.push(link); - } - }); - } - - return out; -}; diff --git a/node_modules/vega-hierarchy/src/Treemap.js b/node_modules/vega-hierarchy/src/Treemap.js deleted file mode 100644 index 0f123f3..0000000 --- a/node_modules/vega-hierarchy/src/Treemap.js +++ /dev/null @@ -1,81 +0,0 @@ -import HierarchyLayout from './HierarchyLayout'; -import {error, hasOwnProperty, inherits} from 'vega-util'; -import { - treemap, - treemapBinary, - treemapDice, - treemapResquarify, - treemapSlice, - treemapSliceDice, - treemapSquarify -} from 'd3-hierarchy'; - -var Tiles = { - binary: treemapBinary, - dice: treemapDice, - slice: treemapSlice, - slicedice: treemapSliceDice, - squarify: treemapSquarify, - resquarify: treemapResquarify -}; - -var Output = ['x0', 'y0', 'x1', 'y1', 'depth', 'children']; - -/** - * Treemap layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ -export default function Treemap(params) { - HierarchyLayout.call(this, params); -} - -Treemap.Definition = { - 'type': 'Treemap', - 'metadata': {'tree': true, 'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'method', 'type': 'enum', 'default': 'squarify', - 'values': ['squarify', 'resquarify', 'binary', 'dice', 'slice', 'slicedice'] }, - { 'name': 'padding', 'type': 'number', 'default': 0 }, - { 'name': 'paddingInner', 'type': 'number', 'default': 0 }, - { 'name': 'paddingOuter', 'type': 'number', 'default': 0 }, - { 'name': 'paddingTop', 'type': 'number', 'default': 0 }, - { 'name': 'paddingRight', 'type': 'number', 'default': 0 }, - { 'name': 'paddingBottom', 'type': 'number', 'default': 0 }, - { 'name': 'paddingLeft', 'type': 'number', 'default': 0 }, - { 'name': 'ratio', 'type': 'number', 'default': 1.618033988749895 }, - { 'name': 'round', 'type': 'boolean', 'default': false }, - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': Output.length, 'default': Output } - ] -}; - -var prototype = inherits(Treemap, HierarchyLayout); - -/** - * Treemap layout generator. Adds 'method' and 'ratio' parameters - * to configure the underlying tile method. - */ -prototype.layout = function() { - var x = treemap(); - x.ratio = function(_) { - var t = x.tile(); - if (t.ratio) x.tile(t.ratio(_)); - }; - x.method = function(_) { - if (hasOwnProperty(Tiles, _)) x.tile(Tiles[_]); - else error('Unrecognized Treemap layout method: ' + _); - }; - return x; -}; - -prototype.params = [ - 'method', 'ratio', 'size', 'round', - 'padding', 'paddingInner', 'paddingOuter', - 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft' -]; - -prototype.fields = Output; diff --git a/node_modules/vega-hierarchy/src/lookup.js b/node_modules/vega-hierarchy/src/lookup.js deleted file mode 100644 index d731581..0000000 --- a/node_modules/vega-hierarchy/src/lookup.js +++ /dev/null @@ -1,10 +0,0 @@ -// Build lookup table mapping tuple keys to tree node instances -export default function(tree, key, filter) { - var map = {}; - tree.each(function(node) { - var t = node.data; - if (filter(t)) map[key(t)] = node; - }); - tree.lookup = map; - return tree; -} diff --git a/node_modules/vega-lite/LICENSE b/node_modules/vega-lite/LICENSE deleted file mode 100644 index 80f70a4..0000000 --- a/node_modules/vega-lite/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015, University of Washington Interactive Data Lab. -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. - -* Neither the name of the University of Washington Interactive Data Lab - nor the names of its contributors may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-lite/README.md b/node_modules/vega-lite/README.md deleted file mode 100644 index 0209a12..0000000 --- a/node_modules/vega-lite/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Vega-Lite - -[![npm version](https://img.shields.io/npm/v/vega-lite.svg)](https://www.npmjs.com/package/vega-lite) [![Build Status](https://github.com/vega/vega-lite/workflows/Test/badge.svg)](https://github.com/vega/vega-lite/actions) [![codecov](https://codecov.io/gh/vega/vega-lite/branch/master/graph/badge.svg)](https://codecov.io/gh/vega/vega-lite) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=rounded)](https://github.com/prettier/prettier) [![JSDevlivr](https://data.jsdelivr.com/v1/package/npm/vega-lite/badge?style=rounded)](https://www.jsdelivr.com/package/npm/vega-lite) - -![Teaser](site/static/teaser.png) - -[Vega-Lite](https://vega.github.io/vega-lite/) provides a higher-level grammar for visual analysis that generates complete [Vega](https://vega.github.io/) specifications. - -You can find more details, [documentation](https://vega.github.io/vega-lite/docs/), [examples](https://vega.github.io/vega-lite/examples/), [usage instructions](https://vega.github.io/vega-lite/usage/embed.html), and [tutorials](https://vega.github.io/vega-lite/tutorials/getting_started.html) on the [Vega-Lite website](https://vega.github.io/vega-lite/). - -Try using Vega-Lite in the online [Vega Editor](https://vega.github.io/editor/#/custom/vega-lite). - -Contributions are also welcome. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for contribution and development guidelines and our [Code of Conduct](https://vega.github.io/vega/about/code-of-conduct/). - -Read about future plans in [our roadmap](https://docs.google.com/document/d/1fscSxSJtfkd1m027r1ONCc7O8RdZp1oGABwca2pgV_E). - -## Team - -The development of Vega-Lite is led by the alumni and members of the [University of Washington Interactive Data Lab](https://idl.cs.washington.edu) (UW IDL), including [Kanit "Ham" Wongsuphasawat](https://twitter.com/kanitw) (now at Apple), [Dominik Moritz](https://twitter.com/domoritz) (now at Apple), [Arvind Satyanarayan](https://twitter.com/arvindsatya1) (now at MIT), and [Jeffrey Heer](https://twitter.com/jeffrey_heer) (UW IDL). - -Vega-Lite gets significant contributions from its community--in particular [Will Strimling](https://willium.com), [Yuhan (Zoe) Lu](https://github.com/YuhanLu), [Souvik Sen](https://github.com/invokesus), [Chanwut Kittivorawong](https://github.com/chanwutk), [Matthew Chun](https://github.com/mattwchun), [Akshat Shrivastava](https://github.com/AkshatSh), [Saba Noorassa](https://github.com/Saba9), [Sira Horradarn](https://github.com/sirahd), [Donghao Ren](https://github.com/donghaoren), and [Halden Lin](https://github.com/haldenl). Please see the [contributors page](https://github.com/vega/vega-lite/graphs/contributors) for the full list of contributors. - -## Citing Vega-Lite - -```bib -@article{2017-vega-lite, - doi = {10.1109/tvcg.2016.2599030}, - year = {2017}, - author = {Arvind Satyanarayan and Dominik Moritz and Kanit Wongsuphasawat and Jeffrey Heer}, - title = {Vega-Lite: A Grammar of Interactive Graphics}, - journal = {{IEEE} Transactions on Visualization \& Computer Graphics (Proc. InfoVis)}, - url = {http://idl.cs.washington.edu/papers/vega-lite}, -} -``` diff --git a/node_modules/vega-lite/babel.config.js b/node_modules/vega-lite/babel.config.js deleted file mode 100644 index 15fa52f..0000000 --- a/node_modules/vega-lite/babel.config.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - presets: [ - [ - '@babel/preset-env', - { - targets: { - ie: '11' - } - } - ] - ], - compact: false -}; diff --git a/node_modules/vega-lite/bin/vl2pdf b/node_modules/vega-lite/bin/vl2pdf deleted file mode 100755 index db71f44..0000000 --- a/node_modules/vega-lite/bin/vl2pdf +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Expects the path to a Vega-Lite specification as the first argument. -# Passes remaining arguments to vg2pdf using npx. - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# only passes the first argument to vl2vg -$DIR/vl2vg $1 | npx -p vega vg2pdf '' ${@:2} diff --git a/node_modules/vega-lite/bin/vl2png b/node_modules/vega-lite/bin/vl2png deleted file mode 100755 index 41cbb64..0000000 --- a/node_modules/vega-lite/bin/vl2png +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Expects the path to a Vega-Lite specification as the first argument. -# Passes remaining arguments to vg2png using npx. - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# only passes the first argument to vl2vg -$DIR/vl2vg $1 | npx -p vega vg2png '' ${@:2} diff --git a/node_modules/vega-lite/bin/vl2svg b/node_modules/vega-lite/bin/vl2svg deleted file mode 100755 index 39e805e..0000000 --- a/node_modules/vega-lite/bin/vl2svg +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Expects the path to a Vega-Lite specification as the first argument. -# Passes remaining arguments to vg2svg using npx. - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# only passes the first argument to vl2vg -$DIR/vl2vg $1 | npx -p vega vg2svg '' ${@:2} diff --git a/node_modules/vega-lite/bin/vl2vg b/node_modules/vega-lite/bin/vl2vg deleted file mode 100755 index e9dfca0..0000000 --- a/node_modules/vega-lite/bin/vl2vg +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env node -// Compile a Vega-Lite spec to Vega - -//@ts-check -'use strict'; - -const helpText = `Compile a Vega-Lite spec to Vega. - -Usage: vl2vg [vega_lite_json_file] [output_vega_json_file] [-p] - If no arguments are provided, reads from stdin. - If output_vega_json_file is not provided, writes to stdout. - Passing -p formats the generated Vega spec.`; - -// import required libraries -const {createReadStream, createWriteStream} = require('fs'); -const vegaLite = require('../build/vega-lite'); -const compactStringify = require('json-stringify-pretty-compact'); - -// arguments -const args = require('yargs') - .usage(helpText) - .demand(0); - -args - .boolean('p') - .alias('p', 'pretty') - .describe('p', 'Output human readable/pretty spec.'); - -const argv = args.help().version().argv; - -/** - * Read a file. - * - * @param file {string} File path - */ -function read(file) { - return new Promise((resolve, reject) => { - const input = file ? createReadStream(file) : process.stdin; - let text = ''; - - input.setEncoding('utf8'); - input.on('error', err => reject(err)); - input.on('data', chunk => (text += chunk)); - input.on('end', () => resolve(text)); - }); -} - -// load spec, compile vg spec -read(argv._[0]).then(text => compile(JSON.parse(text))); - -/** - * Compile the Vega-Lite spec to Vega. - * - * @param vlSpec {import("../src").TopLevelSpec} The Vega-Lite spec. - */ -function compile(vlSpec) { - // @ts-ignore - const vgSpec = vegaLite.compile(vlSpec).spec; - - const file = argv._[1] || null; - const out = file ? createWriteStream(file) : process.stdout; - if (argv.p) { - out.write(compactStringify(vgSpec) + '\n'); - } else { - out.write(JSON.stringify(vgSpec) + '\n'); - } -} diff --git a/node_modules/vega-lite/build-es5/vega-lite.js b/node_modules/vega-lite/build-es5/vega-lite.js deleted file mode 100644 index 0bceb85..0000000 --- a/node_modules/vega-lite/build-es5/vega-lite.js +++ /dev/null @@ -1,28305 +0,0 @@ -"use strict"; - -function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } - -function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } - -function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -(function (global, factory) { - (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.vegaLite = {})); -})(void 0, function (exports) { - 'use strict'; - - var version = "4.14.0"; - - function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; - } - - function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); - } - - var get1 = function get1(field) { - return function (obj) { - return obj[field]; - }; - }; - - var getN = function getN(path) { - var len = path.length; - return function (obj) { - for (var i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - - return obj; - }; - }; - - function error(message) { - throw Error(message); - } - - function splitAccessPath(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, - j, - c; - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i = j = 0; j < n; ++j) { - c = p[j]; - - if (c === '\\') { - s += p.substring(i, j); - s += p.substring(++j, ++j); - i = j; - } else if (c === q) { - push(); - q = null; - b = -1; - } else if (q) { - continue; - } else if (i === b && c === '"') { - i = j + 1; - q = c; - } else if (i === b && c === "'") { - i = j + 1; - q = c; - } else if (c === '.' && !b) { - if (j > i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; - } - - function field(field, name, opt) { - var path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor((opt && opt.get || getter)(path), [field], name || field); - } - - var empty = []; - var id = field('id'); - var identity = accessor(function (_) { - return _; - }, empty, 'identity'); - var zero = accessor(function () { - return 0; - }, empty, 'zero'); - var one = accessor(function () { - return 1; - }, empty, 'one'); - var truthy = accessor(function () { - return true; - }, empty, 'true'); - var falsy = accessor(function () { - return false; - }, empty, 'false'); - - function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console - } - - var None = 0; - var Error$1 = 1; - var Warn = 2; - var Info = 3; - var Debug = 4; - - function logger(_, method) { - var _level = _ || None; - - return { - level: function level(_) { - if (arguments.length) { - _level = +_; - return this; - } else { - return _level; - } - }, - error: function error() { - if (_level >= Error$1) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function warn() { - if (_level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function info() { - if (_level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function debug() { - if (_level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; - } - - var isArray = Array.isArray; - - function isObject(_) { - return _ === Object(_); - } - - var isLegalKey = function isLegalKey(key) { - return key !== '__proto__'; - }; - - function mergeConfig() { - for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) { - configs[_key] = arguments[_key]; - } - - return configs.reduce(function (out, source) { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? { - layout: 1 - } : key === 'style' ? true : null; - writeConfig(out, key, source[key], r); - } - } - - return out; - }, {}); - } - - function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - var k, o; - - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : output[key] = {}; - - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } - } - - function mergeNamed(a, b) { - if (a == null) return b; - var map = {}, - out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; - } - - function array(_) { - return _ != null ? isArray(_) ? _ : [_] : []; - } - - function isFunction(_) { - return typeof _ === 'function'; - } - - var hop = Object.prototype.hasOwnProperty; - - function hasOwnProperty(object, property) { - return hop.call(object, property); - } - - function isBoolean(_) { - return typeof _ === 'boolean'; - } - - function isNumber(_) { - return typeof _ === 'number'; - } - - function isString(_) { - return typeof _ === 'string'; - } - - function $(x) { - return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace("\u2028", "\\u2028").replace("\u2029", "\\u2029") : x; - } - - function toSet(_) { - for (var s = {}, i = 0, n = _.length; i < n; ++i) { - s[_[i]] = true; - } - - return s; - } - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - - function __rest(s, e) { - var t = {}; - - for (var p in s) { - if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - } - - if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - } - - Array.prototype.flat || Object.defineProperty(Array.prototype, "flat", { - configurable: !0, - value: function r() { - var t = isNaN(arguments[0]) ? 1 : Number(arguments[0]); - return t ? Array.prototype.reduce.call(this, function (a, e) { - return Array.isArray(e) ? a.push.apply(a, r.call(e, t - 1)) : a.push(e), a; - }, []) : Array.prototype.slice.call(this); - }, - writable: !0 - }), Array.prototype.flatMap || Object.defineProperty(Array.prototype, "flatMap", { - configurable: !0, - value: function value(r) { - return Array.prototype.map.apply(this, arguments).flat(); - }, - writable: !0 - }); - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function require(path, base) { - return commonjsRequire(path, base === undefined || base === null ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire() { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var clone_1 = createCommonjsModule(function (module) { - var clone = function () { - function _instanceof(obj, type) { - return type != null && obj instanceof type; - } - - var nativeMap; - - try { - nativeMap = Map; - } catch (_) { - // maybe a reference error because no `Map`. Give it a dummy value that no - // value will ever be an instanceof. - nativeMap = function nativeMap() {}; - } - - var nativeSet; - - try { - nativeSet = Set; - } catch (_) { - nativeSet = function nativeSet() {}; - } - - var nativePromise; - - try { - nativePromise = Promise; - } catch (_) { - nativePromise = function nativePromise() {}; - } - /** - * Clones (copies) an Object using deep copying. - * - * This function supports circular references by default, but if you are certain - * there are no circular references in your object, you can save some CPU time - * by calling clone(obj, false). - * - * Caution: if `circular` is false and `parent` contains circular references, - * your program may enter an infinite loop and crash. - * - * @param `parent` - the object to be cloned - * @param `circular` - set to true if the object to be cloned may contain - * circular references. (optional - true by default) - * @param `depth` - set to a number if the object is only to be cloned to - * a particular depth. (optional - defaults to Infinity) - * @param `prototype` - sets the prototype to be used when cloning an object. - * (optional - defaults to parent prototype). - * @param `includeNonEnumerable` - set to true if the non-enumerable properties - * should be cloned as well. Non-enumerable properties on the prototype - * chain will be ignored. (optional - false by default) - */ - - - function clone(parent, circular, depth, prototype, includeNonEnumerable) { - if (_typeof(circular) === 'object') { - depth = circular.depth; - prototype = circular.prototype; - includeNonEnumerable = circular.includeNonEnumerable; - circular = circular.circular; - } // maintain two arrays for circular references, where corresponding parents - // and children have the same index - - - var allParents = []; - var allChildren = []; - var useBuffer = typeof Buffer != 'undefined'; - if (typeof circular == 'undefined') circular = true; - if (typeof depth == 'undefined') depth = Infinity; // recurse this function so we don't reset allParents and allChildren - - function _clone(parent, depth) { - // cloning null always returns null - if (parent === null) return null; - if (depth === 0) return parent; - var child; - var proto; - - if (_typeof(parent) != 'object') { - return parent; - } - - if (_instanceof(parent, nativeMap)) { - child = new nativeMap(); - } else if (_instanceof(parent, nativeSet)) { - child = new nativeSet(); - } else if (_instanceof(parent, nativePromise)) { - child = new nativePromise(function (resolve, reject) { - parent.then(function (value) { - resolve(_clone(value, depth - 1)); - }, function (err) { - reject(_clone(err, depth - 1)); - }); - }); - } else if (clone.__isArray(parent)) { - child = []; - } else if (clone.__isRegExp(parent)) { - child = new RegExp(parent.source, __getRegExpFlags(parent)); - if (parent.lastIndex) child.lastIndex = parent.lastIndex; - } else if (clone.__isDate(parent)) { - child = new Date(parent.getTime()); - } else if (useBuffer && Buffer.isBuffer(parent)) { - if (Buffer.allocUnsafe) { - // Node.js >= 4.5.0 - child = Buffer.allocUnsafe(parent.length); - } else { - // Older Node.js versions - child = new Buffer(parent.length); - } - - parent.copy(child); - return child; - } else if (_instanceof(parent, Error)) { - child = Object.create(parent); - } else { - if (typeof prototype == 'undefined') { - proto = Object.getPrototypeOf(parent); - child = Object.create(proto); - } else { - child = Object.create(prototype); - proto = prototype; - } - } - - if (circular) { - var index = allParents.indexOf(parent); - - if (index != -1) { - return allChildren[index]; - } - - allParents.push(parent); - allChildren.push(child); - } - - if (_instanceof(parent, nativeMap)) { - parent.forEach(function (value, key) { - var keyChild = _clone(key, depth - 1); - - var valueChild = _clone(value, depth - 1); - - child.set(keyChild, valueChild); - }); - } - - if (_instanceof(parent, nativeSet)) { - parent.forEach(function (value) { - var entryChild = _clone(value, depth - 1); - - child.add(entryChild); - }); - } - - for (var i in parent) { - var attrs; - - if (proto) { - attrs = Object.getOwnPropertyDescriptor(proto, i); - } - - if (attrs && attrs.set == null) { - continue; - } - - child[i] = _clone(parent[i], depth - 1); - } - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(parent); - - for (var i = 0; i < symbols.length; i++) { - // Don't need to worry about cloning a symbol because it is a primitive, - // like a number or string. - var symbol = symbols[i]; - var descriptor = Object.getOwnPropertyDescriptor(parent, symbol); - - if (descriptor && !descriptor.enumerable && !includeNonEnumerable) { - continue; - } - - child[symbol] = _clone(parent[symbol], depth - 1); - - if (!descriptor.enumerable) { - Object.defineProperty(child, symbol, { - enumerable: false - }); - } - } - } - - if (includeNonEnumerable) { - var allPropertyNames = Object.getOwnPropertyNames(parent); - - for (var i = 0; i < allPropertyNames.length; i++) { - var propertyName = allPropertyNames[i]; - var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName); - - if (descriptor && descriptor.enumerable) { - continue; - } - - child[propertyName] = _clone(parent[propertyName], depth - 1); - Object.defineProperty(child, propertyName, { - enumerable: false - }); - } - } - - return child; - } - - return _clone(parent, depth); - } - /** - * Simple flat clone using prototype, accepts only objects, usefull for property - * override on FLAT configuration object (no nested props). - * - * USE WITH CAUTION! This may not behave as you wish if you do not know how this - * works. - */ - - - clone.clonePrototype = function clonePrototype(parent) { - if (parent === null) return null; - - var c = function c() {}; - - c.prototype = parent; - return new c(); - }; // private utility functions - - - function __objToStr(o) { - return Object.prototype.toString.call(o); - } - - clone.__objToStr = __objToStr; - - function __isDate(o) { - return _typeof(o) === 'object' && __objToStr(o) === '[object Date]'; - } - - clone.__isDate = __isDate; - - function __isArray(o) { - return _typeof(o) === 'object' && __objToStr(o) === '[object Array]'; - } - - clone.__isArray = __isArray; - - function __isRegExp(o) { - return _typeof(o) === 'object' && __objToStr(o) === '[object RegExp]'; - } - - clone.__isRegExp = __isRegExp; - - function __getRegExpFlags(re) { - var flags = ''; - if (re.global) flags += 'g'; - if (re.ignoreCase) flags += 'i'; - if (re.multiline) flags += 'm'; - return flags; - } - - clone.__getRegExpFlags = __getRegExpFlags; - return clone; - }(); - - if (module.exports) { - module.exports = clone; - } - }); // do not edit .js files directly - edit src/index.jst - - var fastDeepEqual = function equal(a, b) { - if (a === b) return true; - - if (a && b && _typeof(a) == 'object' && _typeof(b) == 'object') { - if (a.constructor !== b.constructor) return false; - var length, i, keys; - - if (Array.isArray(a)) { - length = a.length; - if (length != b.length) return false; - - for (i = length; i-- !== 0;) { - if (!equal(a[i], b[i])) return false; - } - - return true; - } - - if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; - if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); - if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); - keys = Object.keys(a); - length = keys.length; - if (length !== Object.keys(b).length) return false; - - for (i = length; i-- !== 0;) { - if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; - } - - for (i = length; i-- !== 0;) { - var key = keys[i]; - if (!equal(a[key], b[key])) return false; - } - - return true; - } // true if both NaN, false otherwise - - - return a !== a && b !== b; - }; - - var fastJsonStableStringify = function fastJsonStableStringify(data, opts) { - if (!opts) opts = {}; - if (typeof opts === 'function') opts = { - cmp: opts - }; - var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false; - - var cmp = opts.cmp && function (f) { - return function (node) { - return function (a, b) { - var aobj = { - key: a, - value: node[a] - }; - var bobj = { - key: b, - value: node[b] - }; - return f(aobj, bobj); - }; - }; - }(opts.cmp); - - var seen = []; - return function stringify(node) { - if (node && node.toJSON && typeof node.toJSON === 'function') { - node = node.toJSON(); - } - - if (node === undefined) return; - if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; - if (_typeof(node) !== 'object') return JSON.stringify(node); - var i, out; - - if (Array.isArray(node)) { - out = '['; - - for (i = 0; i < node.length; i++) { - if (i) out += ','; - out += stringify(node[i]) || 'null'; - } - - return out + ']'; - } - - if (node === null) return 'null'; - - if (seen.indexOf(node) !== -1) { - if (cycles) return JSON.stringify('__cycle__'); - throw new TypeError('Converting circular structure to JSON'); - } - - var seenIndex = seen.push(node) - 1; - var keys = Object.keys(node).sort(cmp && cmp(node)); - out = ''; - - for (i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = stringify(node[key]); - if (!value) continue; - if (out) out += ','; - out += JSON.stringify(key) + ':' + value; - } - - seen.splice(seenIndex, 1); - return '{' + out + '}'; - }(data); - }; - - function isLogicalOr(op) { - return !!op.or; - } - - function isLogicalAnd(op) { - return !!op.and; - } - - function isLogicalNot(op) { - return !!op.not; - } - - function forEachLeaf(op, fn) { - if (isLogicalNot(op)) { - forEachLeaf(op.not, fn); - } else if (isLogicalAnd(op)) { - var _iterator = _createForOfIteratorHelper(op.and), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var subop = _step.value; - forEachLeaf(subop, fn); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } else if (isLogicalOr(op)) { - var _iterator2 = _createForOfIteratorHelper(op.or), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var _subop = _step2.value; - forEachLeaf(_subop, fn); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } else { - fn(op); - } - } - - function normalizeLogicalComposition(op, normalizer) { - if (isLogicalNot(op)) { - return { - not: normalizeLogicalComposition(op.not, normalizer) - }; - } else if (isLogicalAnd(op)) { - return { - and: op.and.map(function (o) { - return normalizeLogicalComposition(o, normalizer); - }) - }; - } else if (isLogicalOr(op)) { - return { - or: op.or.map(function (o) { - return normalizeLogicalComposition(o, normalizer); - }) - }; - } else { - return normalizer(op); - } - } - - var deepEqual = fastDeepEqual; - var duplicate = clone_1; - /** - * Creates an object composed of the picked object properties. - * - * var object = {'a': 1, 'b': '2', 'c': 3}; - * pick(object, ['a', 'c']); - * // → {'a': 1, 'c': 3} - */ - // eslint-disable-next-line @typescript-eslint/ban-types - - function pick(obj, props) { - var copy = {}; - - var _iterator3 = _createForOfIteratorHelper(props), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var prop = _step3.value; - - if (hasOwnProperty(obj, prop)) { - copy[prop] = obj[prop]; - } - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - - return copy; - } - /** - * The opposite of _.pick; this method creates an object composed of the own - * and inherited enumerable string keyed properties of object that are not omitted. - */ - // eslint-disable-next-line @typescript-eslint/ban-types - - - function omit(obj, props) { - var copy = Object.assign({}, obj); - - var _iterator4 = _createForOfIteratorHelper(props), - _step4; - - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { - var prop = _step4.value; - delete copy[prop]; - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - - return copy; - } - /** - * Monkey patch Set so that `stringify` produces a string representation of sets. - */ - - - Set.prototype['toJSON'] = function () { - return "Set(".concat(_toConsumableArray(this).map(function (x) { - return fastJsonStableStringify(x); - }).join(','), ")"); - }; - /** - * Converts any object to a string representation that can be consumed by humans. - */ - - - var stringify = fastJsonStableStringify; - /** - * Converts any object to a string of limited size, or a number. - */ - - function _hash(a) { - if (isNumber(a)) { - return a; - } - - var str = isString(a) ? a : fastJsonStableStringify(a); // short strings can be used as hash directly, longer strings are hashed to reduce memory usage - - if (str.length < 250) { - return str; - } // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ - - - var h = 0; - - for (var i = 0; i < str.length; i++) { - var char = str.charCodeAt(i); - h = (h << 5) - h + char; - h = h & h; // Convert to 32bit integer - } - - return h; - } - - function isNullOrFalse(x) { - return x === false || x === null; - } - - function contains(array, item) { - return array.indexOf(item) > -1; - } - /** - * Returns true if any item returns true. - */ - - - function some(arr, f) { - var i = 0; - - var _iterator5 = _createForOfIteratorHelper(arr.entries()), - _step5; - - try { - for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { - var _step5$value = _slicedToArray(_step5.value, 2), - k = _step5$value[0], - a = _step5$value[1]; - - if (f(a, k, i++)) { - return true; - } - } - } catch (err) { - _iterator5.e(err); - } finally { - _iterator5.f(); - } - - return false; - } - /** - * Returns true if all items return true. - */ - - - function every(arr, f) { - var i = 0; - - var _iterator6 = _createForOfIteratorHelper(arr.entries()), - _step6; - - try { - for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { - var _step6$value = _slicedToArray(_step6.value, 2), - k = _step6$value[0], - a = _step6$value[1]; - - if (!f(a, k, i++)) { - return false; - } - } - } catch (err) { - _iterator6.e(err); - } finally { - _iterator6.f(); - } - - return true; - } - /** - * recursively merges src into dest - */ - - - function mergeDeep(dest) { - for (var _len2 = arguments.length, src = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - src[_key2 - 1] = arguments[_key2]; - } - - for (var _i2 = 0, _src = src; _i2 < _src.length; _i2++) { - var s = _src[_i2]; - deepMerge_(dest, s !== null && s !== void 0 ? s : {}); - } - - return dest; - } - - function deepMerge_(dest, src) { - var _iterator7 = _createForOfIteratorHelper(keys(src)), - _step7; - - try { - for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { - var property = _step7.value; - writeConfig(dest, property, src[property], true); - } - } catch (err) { - _iterator7.e(err); - } finally { - _iterator7.f(); - } - } - - function unique(values, f) { - var results = []; - var u = {}; - var v; - - var _iterator8 = _createForOfIteratorHelper(values), - _step8; - - try { - for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { - var val = _step8.value; - v = f(val); - - if (v in u) { - continue; - } - - u[v] = 1; - results.push(val); - } - } catch (err) { - _iterator8.e(err); - } finally { - _iterator8.f(); - } - - return results; - } - - function setEqual(a, b) { - if (a.size !== b.size) { - return false; - } - - var _iterator9 = _createForOfIteratorHelper(a), - _step9; - - try { - for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { - var e = _step9.value; - - if (!b.has(e)) { - return false; - } - } - } catch (err) { - _iterator9.e(err); - } finally { - _iterator9.f(); - } - - return true; - } - - function hasIntersection(a, b) { - var _iterator10 = _createForOfIteratorHelper(a), - _step10; - - try { - for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { - var key = _step10.value; - - if (b.has(key)) { - return true; - } - } - } catch (err) { - _iterator10.e(err); - } finally { - _iterator10.f(); - } - - return false; - } - - function prefixGenerator(a) { - var prefixes = new Set(); - - var _iterator11 = _createForOfIteratorHelper(a), - _step11; - - try { - var _loop = function _loop() { - var x = _step11.value; - var splitField = splitAccessPath(x); // Wrap every element other than the first in `[]` - - var wrappedWithAccessors = splitField.map(function (y, i) { - return i === 0 ? y : "[".concat(y, "]"); - }); - var computedPrefixes = wrappedWithAccessors.map(function (_, i) { - return wrappedWithAccessors.slice(0, i + 1).join(''); - }); - - var _iterator12 = _createForOfIteratorHelper(computedPrefixes), - _step12; - - try { - for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) { - var y = _step12.value; - prefixes.add(y); - } - } catch (err) { - _iterator12.e(err); - } finally { - _iterator12.f(); - } - }; - - for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { - _loop(); - } - } catch (err) { - _iterator11.e(err); - } finally { - _iterator11.f(); - } - - return prefixes; - } - /** - * Returns true if a and b have an intersection. Also return true if a or b are undefined - * since this means we don't know what fields a node produces or depends on. - */ - - - function fieldIntersection(a, b) { - if (a === undefined || b === undefined) { - return true; - } - - return hasIntersection(prefixGenerator(a), prefixGenerator(b)); - } // eslint-disable-next-line @typescript-eslint/ban-types - - - function isEmpty(obj) { - return keys(obj).length === 0; - } // This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 - - - var keys = Object.keys; - var vals = Object.values; - - function entries(x) { - var _entries = []; - - for (var k in x) { - if (hasOwnProperty(x, k)) { - _entries.push({ - key: k, - value: x[k] - }); - } - } - - return _entries; - } - - function isBoolean$1(b) { - return b === true || b === false; - } - /** - * Convert a string into a valid variable name - */ - - - function varName(s) { - // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _ - var alphanumericS = s.replace(/\W/g, '_'); // Add _ if the string has leading numbers. - - return (s.match(/^\d+/) ? '_' : '') + alphanumericS; - } - - function logicalExpr(op, cb) { - if (isLogicalNot(op)) { - return '!(' + logicalExpr(op.not, cb) + ')'; - } else if (isLogicalAnd(op)) { - return '(' + op.and.map(function (and) { - return logicalExpr(and, cb); - }).join(') && (') + ')'; - } else if (isLogicalOr(op)) { - return '(' + op.or.map(function (or) { - return logicalExpr(or, cb); - }).join(') || (') + ')'; - } else { - return cb(op); - } - } - /** - * Delete nested property of an object, and delete the ancestors of the property if they become empty. - */ - - - function deleteNestedProperty(obj, orderedProps) { - if (orderedProps.length === 0) { - return true; - } - - var prop = orderedProps.shift(); // eslint-disable-line @typescript-eslint/no-non-null-assertion - - if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) { - delete obj[prop]; - } - - return isEmpty(obj); - } - - function titleCase(s) { - return s.charAt(0).toUpperCase() + s.substr(1); - } - /** - * Converts a path to an access path with datum. - * @param path The field name. - * @param datum The string to use for `datum`. - */ - - - function accessPathWithDatum(path) { - var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'datum'; - var pieces = splitAccessPath(path); - var prefixes = []; - - for (var i = 1; i <= pieces.length; i++) { - var prefix = "[".concat(pieces.slice(0, i).map($).join(']['), "]"); - prefixes.push("".concat(datum).concat(prefix)); - } - - return prefixes.join(' && '); - } - /** - * Return access with datum to the flattened field. - * - * @param path The field name. - * @param datum The string to use for `datum`. - */ - - - function flatAccessWithDatum(path) { - var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'datum'; - return "".concat(datum, "[").concat($(splitAccessPath(path).join('.')), "]"); - } - - function escapePathAccess(string) { - return string.replace(/(\[|\]|\.|'|")/g, '\\$1'); - } - /** - * Replaces path accesses with access to non-nested field. - * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`. - */ - - - function replacePathInField(path) { - return "".concat(splitAccessPath(path).map(escapePathAccess).join('\\.')); - } - /** - * Replace all occurrences of a string with another string. - * - * @param string the string to replace in - * @param find the string to replace - * @param replacement the replacement - */ - - - function replaceAll(string, find, replacement) { - return string.replace(new RegExp(find.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replacement); - } - /** - * Remove path accesses with access from field. - * For example, `foo["bar"].baz` becomes `foo.bar.baz`. - */ - - - function removePathFromField(path) { - return "".concat(splitAccessPath(path).join('.')); - } - /** - * Count the depth of the path. Returns 1 for fields that are not nested. - */ - - - function accessPathDepth(path) { - if (!path) { - return 0; - } - - return splitAccessPath(path).length; - } - /** - * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included. - */ - - - function getFirstDefined() { - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - for (var _i3 = 0, _args = args; _i3 < _args.length; _i3++) { - var arg = _args[_i3]; - - if (arg !== undefined) { - return arg; - } - } - - return undefined; - } // variable used to generate id - - - var idCounter = 42; - /** - * Returns a new random id every time it gets called. - * - * Has side effect! - */ - - function uniqueId(prefix) { - var id = ++idCounter; - return prefix ? String(prefix) + id : id; - } - - function internalField(name) { - return isInternalField(name) ? name : "__".concat(name); - } - - function isInternalField(name) { - return name.indexOf('__') === 0; - } - /** - * Normalize angle to be within [0,360). - */ - - - function normalizeAngle(angle) { - if (angle === undefined) { - return undefined; - } - - return (angle % 360 + 360) % 360; - } - /** - * Returns whether the passed in value is a valid number. - */ - - - function isNumeric(value) { - if (isNumber(value)) { - return true; - } - - return !isNaN(value) && !isNaN(parseFloat(value)); - } - - var CONDITIONAL_AXIS_PROP_INDEX = { - domainColor: { - part: 'domain', - vgProp: 'stroke' - }, - labelAlign: { - part: 'labels', - vgProp: 'align' - }, - labelBaseline: { - part: 'labels', - vgProp: 'baseline' - }, - labelColor: { - part: 'labels', - vgProp: 'fill' - }, - labelFont: { - part: 'labels', - vgProp: 'font' - }, - labelFontSize: { - part: 'labels', - vgProp: 'fontSize' - }, - labelFontStyle: { - part: 'labels', - vgProp: 'fontStyle' - }, - labelFontWeight: { - part: 'labels', - vgProp: 'fontWeight' - }, - labelOpacity: { - part: 'labels', - vgProp: 'opacity' - }, - labelOffset: null, - labelPadding: null, - gridColor: { - part: 'grid', - vgProp: 'stroke' - }, - gridDash: { - part: 'grid', - vgProp: 'strokeDash' - }, - gridDashOffset: { - part: 'grid', - vgProp: 'strokeDashOffset' - }, - gridOpacity: { - part: 'grid', - vgProp: 'opacity' - }, - gridWidth: { - part: 'grid', - vgProp: 'strokeWidth' - }, - tickColor: { - part: 'ticks', - vgProp: 'stroke' - }, - tickDash: { - part: 'ticks', - vgProp: 'strokeDash' - }, - tickDashOffset: { - part: 'ticks', - vgProp: 'strokeDashOffset' - }, - tickOpacity: { - part: 'ticks', - vgProp: 'opacity' - }, - tickSize: null, - tickWidth: { - part: 'ticks', - vgProp: 'strokeWidth' - }, - titleColor: { - part: 'title', - vgProp: 'fill' - }, - title: null // title supports signal, let's use it. - - }; - - function isConditionalAxisValue(v) { - return v && v['condition']; - } - - var AXIS_PARTS = ['domain', 'grid', 'labels', 'ticks', 'title']; - /** - * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes. - */ - - var AXIS_PROPERTY_TYPE = { - grid: 'grid', - gridCap: 'grid', - gridColor: 'grid', - gridDash: 'grid', - gridDashOffset: 'grid', - gridOpacity: 'grid', - gridScale: 'grid', - gridWidth: 'grid', - orient: 'main', - bandPosition: 'both', - aria: 'main', - description: 'main', - domain: 'main', - domainCap: 'main', - domainColor: 'main', - domainDash: 'main', - domainDashOffset: 'main', - domainOpacity: 'main', - domainWidth: 'main', - format: 'main', - formatType: 'main', - labelAlign: 'main', - labelAngle: 'main', - labelBaseline: 'main', - labelBound: 'main', - labelColor: 'main', - labelFlush: 'main', - labelFlushOffset: 'main', - labelFont: 'main', - labelFontSize: 'main', - labelFontStyle: 'main', - labelFontWeight: 'main', - labelLimit: 'main', - labelLineHeight: 'main', - labelOffset: 'main', - labelOpacity: 'main', - labelOverlap: 'main', - labelPadding: 'main', - labels: 'main', - labelSeparation: 'main', - maxExtent: 'main', - minExtent: 'main', - offset: 'both', - position: 'main', - tickCap: 'main', - tickColor: 'main', - tickDash: 'main', - tickDashOffset: 'main', - tickMinStep: 'main', - tickOffset: 'both', - tickOpacity: 'main', - tickRound: 'both', - ticks: 'main', - tickSize: 'main', - tickWidth: 'both', - title: 'main', - titleAlign: 'main', - titleAnchor: 'main', - titleAngle: 'main', - titleBaseline: 'main', - titleColor: 'main', - titleFont: 'main', - titleFontSize: 'main', - titleFontStyle: 'main', - titleFontWeight: 'main', - titleLimit: 'main', - titleLineHeight: 'main', - titleOpacity: 'main', - titlePadding: 'main', - titleX: 'main', - titleY: 'main', - encode: 'both', - scale: 'both', - tickBand: 'both', - tickCount: 'both', - tickExtra: 'both', - translate: 'both', - values: 'both', - zindex: 'both' // this is actually set afterward, so it doesn't matter - - }; - var COMMON_AXIS_PROPERTIES_INDEX = { - orient: 1, - aria: 1, - bandPosition: 1, - description: 1, - domain: 1, - domainCap: 1, - domainColor: 1, - domainDash: 1, - domainDashOffset: 1, - domainOpacity: 1, - domainWidth: 1, - format: 1, - formatType: 1, - grid: 1, - gridCap: 1, - gridColor: 1, - gridDash: 1, - gridDashOffset: 1, - gridOpacity: 1, - gridWidth: 1, - labelAlign: 1, - labelAngle: 1, - labelBaseline: 1, - labelBound: 1, - labelColor: 1, - labelFlush: 1, - labelFlushOffset: 1, - labelFont: 1, - labelFontSize: 1, - labelFontStyle: 1, - labelFontWeight: 1, - labelLimit: 1, - labelLineHeight: 1, - labelOffset: 1, - labelOpacity: 1, - labelOverlap: 1, - labelPadding: 1, - labels: 1, - labelSeparation: 1, - maxExtent: 1, - minExtent: 1, - offset: 1, - position: 1, - tickBand: 1, - tickCap: 1, - tickColor: 1, - tickCount: 1, - tickDash: 1, - tickDashOffset: 1, - tickExtra: 1, - tickMinStep: 1, - tickOffset: 1, - tickOpacity: 1, - tickRound: 1, - ticks: 1, - tickSize: 1, - tickWidth: 1, - title: 1, - titleAlign: 1, - titleAnchor: 1, - titleAngle: 1, - titleBaseline: 1, - titleColor: 1, - titleFont: 1, - titleFontSize: 1, - titleFontStyle: 1, - titleFontWeight: 1, - titleLimit: 1, - titleLineHeight: 1, - titleOpacity: 1, - titlePadding: 1, - titleX: 1, - titleY: 1, - translate: 1, - values: 1, - zindex: 1 - }; - var AXIS_PROPERTIES_INDEX = Object.assign(Object.assign({}, COMMON_AXIS_PROPERTIES_INDEX), { - style: 1, - labelExpr: 1, - encoding: 1 - }); - - function isAxisProperty(prop) { - return !!AXIS_PROPERTIES_INDEX[prop]; - } - /** - * All types of primitive marks. - */ - - - var Mark = { - arc: 'arc', - area: 'area', - bar: 'bar', - image: 'image', - line: 'line', - point: 'point', - rect: 'rect', - rule: 'rule', - text: 'text', - tick: 'tick', - trail: 'trail', - circle: 'circle', - square: 'square', - geoshape: 'geoshape' - }; - var ARC = Mark.arc; - var AREA = Mark.area; - var BAR = Mark.bar; - var IMAGE = Mark.image; - var LINE = Mark.line; - var POINT = Mark.point; - var RECT = Mark.rect; - var RULE = Mark.rule; - var TEXT = Mark.text; - var TICK = Mark.tick; - var TRAIL = Mark.trail; - var CIRCLE = Mark.circle; - var SQUARE = Mark.square; - var GEOSHAPE = Mark.geoshape; - - function isPathMark(m) { - return contains(['line', 'area', 'trail'], m); - } - - function isRectBasedMark(m) { - return contains(['rect', 'bar', 'image', 'arc' - /* arc is rect/interval in polar coordinate */ - ], m); - } - - var PRIMITIVE_MARKS = keys(Mark); - - function isMarkDef(mark) { - return mark['type']; - } - - var PRIMITIVE_MARK_INDEX = toSet(PRIMITIVE_MARKS); - var STROKE_CONFIG = ['stroke', 'strokeWidth', 'strokeDash', 'strokeDashOffset', 'strokeOpacity', 'strokeJoin', 'strokeMiterLimit']; - var FILL_CONFIG = ['fill', 'fillOpacity']; - var FILL_STROKE_CONFIG = [].concat(STROKE_CONFIG, FILL_CONFIG); - var VL_ONLY_MARK_CONFIG_INDEX = { - color: 1, - filled: 1, - invalid: 1, - order: 1, - radius2: 1, - theta2: 1, - timeUnitBand: 1, - timeUnitBandPosition: 1 - }; - var VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX); - var VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = { - area: ['line', 'point'], - bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize'], - rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize'], - line: ['point'], - tick: ['bandSize', 'thickness'] - }; - var defaultMarkConfig = { - color: '#4c78a8', - invalid: 'filter', - timeUnitBand: 1 - }; - var BAR_CORNER_RADIUS_INDEX = { - horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'], - vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight'] - }; - var DEFAULT_RECT_BAND_SIZE = 5; - var defaultBarConfig = { - binSpacing: 1, - continuousBandSize: DEFAULT_RECT_BAND_SIZE, - timeUnitBandPosition: 0.5 - }; - var defaultRectConfig = { - binSpacing: 0, - continuousBandSize: DEFAULT_RECT_BAND_SIZE, - timeUnitBandPosition: 0.5 - }; - var defaultTickConfig = { - thickness: 1 - }; - - function getMarkType(m) { - return isMarkDef(m) ? m.type : m; - } - - function isUnitSpec(spec) { - return 'mark' in spec; - } - - var CompositeMarkNormalizer = /*#__PURE__*/function () { - function CompositeMarkNormalizer(name, run) { - _classCallCheck(this, CompositeMarkNormalizer); - - this.name = name; - this.run = run; - } - - _createClass(CompositeMarkNormalizer, [{ - key: "hasMatchingType", - value: function hasMatchingType(spec) { - if (isUnitSpec(spec)) { - return getMarkType(spec.mark) === this.name; - } - - return false; - } - }]); - - return CompositeMarkNormalizer; - }(); - - var AGGREGATE_OP_INDEX = { - argmax: 1, - argmin: 1, - average: 1, - count: 1, - distinct: 1, - product: 1, - max: 1, - mean: 1, - median: 1, - min: 1, - missing: 1, - q1: 1, - q3: 1, - ci0: 1, - ci1: 1, - stderr: 1, - stdev: 1, - stdevp: 1, - sum: 1, - valid: 1, - values: 1, - variance: 1, - variancep: 1 - }; - var MULTIDOMAIN_SORT_OP_INDEX = { - count: 1, - min: 1, - max: 1 - }; - - function isArgminDef(a) { - return !!a && !!a['argmin']; - } - - function isArgmaxDef(a) { - return !!a && !!a['argmax']; - } - - function isAggregateOp(a) { - return isString(a) && !!AGGREGATE_OP_INDEX[a]; - } - - var COUNTING_OPS = ['count', 'valid', 'missing', 'distinct']; - - function isCountingAggregateOp(aggregate) { - return isString(aggregate) && contains(COUNTING_OPS, aggregate); - } - - function isMinMaxOp(aggregate) { - return isString(aggregate) && contains(['min', 'max'], aggregate); - } - /** Additive-based aggregation operations. These can be applied to stack. */ - - - var SUM_OPS = ['count', 'sum', 'distinct', 'valid', 'missing']; - /** - * Aggregation operators that always produce values within the range [domainMin, domainMax]. - */ - - var SHARED_DOMAIN_OPS = ['mean', 'average', 'median', 'q1', 'q3', 'min', 'max']; - var SHARED_DOMAIN_OP_INDEX = toSet(SHARED_DOMAIN_OPS); - /* - * Constants and utilities for encoding channels (Visual variables) - * such as 'x', 'y', 'color'. - */ - // Facet - - var ROW = 'row'; - var COLUMN = 'column'; - var FACET = 'facet'; // Position - - var X = 'x'; - var Y = 'y'; - var X2 = 'x2'; - var Y2 = 'y2'; // Arc-Position - - var RADIUS = 'radius'; - var RADIUS2 = 'radius2'; - var THETA = 'theta'; - var THETA2 = 'theta2'; // Geo Position - - var LATITUDE = 'latitude'; - var LONGITUDE = 'longitude'; - var LATITUDE2 = 'latitude2'; - var LONGITUDE2 = 'longitude2'; // Mark property with scale - - var COLOR = 'color'; - var FILL = 'fill'; - var STROKE = 'stroke'; - var SHAPE = 'shape'; - var SIZE = 'size'; - var ANGLE = 'angle'; - var OPACITY = 'opacity'; - var FILLOPACITY = 'fillOpacity'; - var STROKEOPACITY = 'strokeOpacity'; - var STROKEWIDTH = 'strokeWidth'; - var STROKEDASH = 'strokeDash'; // Non-scale channel - - var TEXT$1 = 'text'; - var ORDER = 'order'; - var DETAIL = 'detail'; - var KEY = 'key'; - var TOOLTIP = 'tooltip'; - var HREF = 'href'; - var URL = 'url'; - var DESCRIPTION = 'description'; - var POSITION_CHANNEL_INDEX = { - x: 1, - y: 1, - x2: 1, - y2: 1 - }; - var POLAR_POSITION_CHANNEL_INDEX = { - theta: 1, - theta2: 1, - radius: 1, - radius2: 1 - }; - - function isPolarPositionChannel(c) { - return c in POLAR_POSITION_CHANNEL_INDEX; - } - - var GEO_POSIITON_CHANNEL_INDEX = { - longitude: 1, - longitude2: 1, - latitude: 1, - latitude2: 1 - }; - - function getPositionChannelFromLatLong(channel) { - switch (channel) { - case LATITUDE: - return 'y'; - - case LATITUDE2: - return 'y2'; - - case LONGITUDE: - return 'x'; - - case LONGITUDE2: - return 'x2'; - } - } - - function isGeoPositionChannel(c) { - return c in GEO_POSIITON_CHANNEL_INDEX; - } - - var GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX); - var UNIT_CHANNEL_INDEX = Object.assign(Object.assign(Object.assign(Object.assign({}, POSITION_CHANNEL_INDEX), POLAR_POSITION_CHANNEL_INDEX), GEO_POSIITON_CHANNEL_INDEX), { - // color - color: 1, - fill: 1, - stroke: 1, - // other non-position with scale - opacity: 1, - fillOpacity: 1, - strokeOpacity: 1, - strokeWidth: 1, - strokeDash: 1, - size: 1, - angle: 1, - shape: 1, - // channels without scales - order: 1, - text: 1, - detail: 1, - key: 1, - tooltip: 1, - href: 1, - url: 1, - description: 1 - }); - - function isColorChannel(channel) { - return channel === COLOR || channel === FILL || channel === STROKE; - } - - var FACET_CHANNEL_INDEX = { - row: 1, - column: 1, - facet: 1 - }; - var FACET_CHANNELS = keys(FACET_CHANNEL_INDEX); - var CHANNEL_INDEX = Object.assign(Object.assign({}, UNIT_CHANNEL_INDEX), FACET_CHANNEL_INDEX); - var CHANNELS = keys(CHANNEL_INDEX); - - var SINGLE_DEF_CHANNEL_INDEX = __rest(CHANNEL_INDEX, ["order", "detail", "tooltip"]); - - var SINGLE_DEF_UNIT_CHANNEL_INDEX = __rest(SINGLE_DEF_CHANNEL_INDEX, ["row", "column", "facet"]); - - function isSingleDefUnitChannel(str) { - return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str]; - } - - function isChannel(str) { - return !!CHANNEL_INDEX[str]; - } - - var SECONDARY_RANGE_CHANNEL = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2]; - - function isSecondaryRangeChannel(c) { - var main = getMainRangeChannel(c); - return main !== c; - } - /** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ - - - function getMainRangeChannel(channel) { - switch (channel) { - case X2: - return X; - - case Y2: - return Y; - - case LATITUDE2: - return LATITUDE; - - case LONGITUDE2: - return LONGITUDE; - - case THETA2: - return THETA; - - case RADIUS2: - return RADIUS; - } - - return channel; - } - - function getVgPositionChannel(channel) { - if (isPolarPositionChannel(channel)) { - switch (channel) { - case THETA: - return 'startAngle'; - - case THETA2: - return 'endAngle'; - - case RADIUS: - return 'outerRadius'; - - case RADIUS2: - return 'innerRadius'; - } - } - - return channel; - } - /** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ - - - function getSecondaryRangeChannel(channel) { - switch (channel) { - case X: - return X2; - - case Y: - return Y2; - - case LATITUDE: - return LATITUDE2; - - case LONGITUDE: - return LONGITUDE2; - - case THETA: - return THETA2; - - case RADIUS: - return RADIUS2; - } - - return undefined; - } - - function getSizeChannel(channel) { - switch (channel) { - case X: - case X2: - return 'width'; - - case Y: - case Y2: - return 'height'; - } - - return undefined; - } - /** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ - - - function getOffsetChannel(channel) { - switch (channel) { - case X: - return 'xOffset'; - - case Y: - return 'yOffset'; - - case X2: - return 'x2Offset'; - - case Y2: - return 'y2Offset'; - - case THETA: - return 'thetaOffset'; - - case RADIUS: - return 'radiusOffset'; - - case THETA2: - return 'theta2Offset'; - - case RADIUS2: - return 'radius2Offset'; - } - - return undefined; - } // NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2; - - - var // The rest of unit channels then have scale - NONPOSITION_CHANNEL_INDEX = __rest(UNIT_CHANNEL_INDEX, ["x", "y", "x2", "y2", "latitude", "longitude", "latitude2", "longitude2", "theta", "theta2", "radius", "radius2"]); - - var NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX); - var POSITION_SCALE_CHANNEL_INDEX = { - x: 1, - y: 1 - }; - var POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX); - - function isXorY(channel) { - return channel in POSITION_SCALE_CHANNEL_INDEX; - } - - var POLAR_POSITION_SCALE_CHANNEL_INDEX = { - theta: 1, - radius: 1 - }; - var POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX); - - function getPositionScaleChannel(sizeType) { - return sizeType === 'width' ? X : Y; - } // NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without X, Y - - - var NONPOSITION_SCALE_CHANNEL_INDEX = __rest(NONPOSITION_CHANNEL_INDEX, ["text", "tooltip", "href", "url", "description", "detail", "key", "order"]); - - var NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX); - - function isNonPositionScaleChannel(channel) { - return !!NONPOSITION_CHANNEL_INDEX[channel]; - } - /** - * @returns whether Vega supports legends for a particular channel - */ - - - function supportLegend(channel) { - switch (channel) { - case COLOR: - case FILL: - case STROKE: - case SIZE: - case SHAPE: - case OPACITY: - case STROKEWIDTH: - case STROKEDASH: - return true; - - case FILLOPACITY: - case STROKEOPACITY: - case ANGLE: - return false; - } - } // Declare SCALE_CHANNEL_INDEX - - - var SCALE_CHANNEL_INDEX = Object.assign(Object.assign(Object.assign({}, POSITION_SCALE_CHANNEL_INDEX), POLAR_POSITION_SCALE_CHANNEL_INDEX), NONPOSITION_SCALE_CHANNEL_INDEX); - /** List of channels with scales */ - - var SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX); - - function isScaleChannel(channel) { - return !!SCALE_CHANNEL_INDEX[channel]; - } - /** - * Return whether a channel supports a particular mark type. - * @param channel channel name - * @param mark the mark type - * @return whether the mark supports the channel - */ - - - function supportMark(channel, mark) { - return getSupportedMark(channel)[mark]; - } - - var ALL_MARKS = { - // all marks - arc: 'always', - area: 'always', - bar: 'always', - circle: 'always', - geoshape: 'always', - image: 'always', - line: 'always', - rule: 'always', - point: 'always', - rect: 'always', - square: 'always', - trail: 'always', - text: 'always', - tick: 'always' - }; - - var ALL_MARKS_EXCEPT_GEOSHAPE = __rest(ALL_MARKS, ["geoshape"]); - /** - * Return a dictionary showing whether a channel supports mark type. - * @param channel - * @return A dictionary mapping mark types to 'always', 'binned', or undefined - */ - - - function getSupportedMark(channel) { - switch (channel) { - case COLOR: - case FILL: - case STROKE: // falls through - - case DESCRIPTION: - case DETAIL: - case KEY: - case TOOLTIP: - case HREF: - case ORDER: // TODO: revise (order might not support rect, which is not stackable?) - - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEWIDTH: // falls through - - case FACET: - case ROW: // falls through - - case COLUMN: - return ALL_MARKS; - - case X: - case Y: - case LATITUDE: - case LONGITUDE: - // all marks except geoshape. geoshape does not use X, Y -- it uses a projection - return ALL_MARKS_EXCEPT_GEOSHAPE; - - case X2: - case Y2: - case LATITUDE2: - case LONGITUDE2: - return { - area: 'always', - bar: 'always', - image: 'always', - rect: 'always', - rule: 'always', - circle: 'binned', - point: 'binned', - square: 'binned', - tick: 'binned', - line: 'binned', - trail: 'binned' - }; - - case SIZE: - return { - point: 'always', - tick: 'always', - rule: 'always', - circle: 'always', - square: 'always', - bar: 'always', - text: 'always', - line: 'always', - trail: 'always' - }; - - case STROKEDASH: - return { - line: 'always', - point: 'always', - tick: 'always', - rule: 'always', - circle: 'always', - square: 'always', - bar: 'always', - geoshape: 'always' - }; - - case SHAPE: - return { - point: 'always', - geoshape: 'always' - }; - - case TEXT$1: - return { - text: 'always' - }; - - case ANGLE: - return { - point: 'always', - square: 'always', - text: 'always' - }; - - case URL: - return { - image: 'always' - }; - - case THETA: - return { - text: 'always', - arc: 'always' - }; - - case RADIUS: - return { - text: 'always', - arc: 'always' - }; - - case THETA2: - case RADIUS2: - return { - arc: 'always' - }; - } - } - - function rangeType(channel) { - switch (channel) { - case X: - case Y: - case THETA: - case RADIUS: - case SIZE: - case ANGLE: - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through] - - case X2: - case Y2: - case THETA2: - case RADIUS2: - return undefined; - - case FACET: - case ROW: - case COLUMN: - case SHAPE: - case STROKEDASH: // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through] - - case TEXT$1: - case TOOLTIP: - case HREF: - case URL: - case DESCRIPTION: - return 'discrete'; - // Color can be either continuous or discrete, depending on scale type. - - case COLOR: - case FILL: - case STROKE: - return 'flexible'; - // No scale, no range type. - - case LATITUDE: - case LONGITUDE: - case LATITUDE2: - case LONGITUDE2: - case DETAIL: - case KEY: - case ORDER: - return undefined; - } - } - /** - * Create a key for the bin configuration. Not for prebinned bin. - */ - - - function binToString(bin) { - if (isBoolean(bin)) { - bin = normalizeBin(bin, undefined); - } - - return 'bin' + keys(bin).map(function (p) { - return isSelectionExtent(bin[p]) ? varName("_".concat(p, "_").concat(Object.entries(bin[p]))) : varName("_".concat(p, "_").concat(bin[p])); - }).join(''); - } - /** - * Vega-Lite should bin the data. - */ - - - function isBinning(bin) { - return bin === true || isBinParams(bin) && !bin.binned; - } - /** - * The data is already binned and so Vega-Lite should not bin it again. - */ - - - function isBinned(bin) { - return bin === 'binned' || isBinParams(bin) && bin.binned === true; - } - - function isBinParams(bin) { - return isObject(bin); - } - - function isSelectionExtent(extent) { - return extent === null || extent === void 0 ? void 0 : extent['selection']; - } - - function autoMaxBins(channel) { - switch (channel) { - case ROW: - case COLUMN: - case SIZE: - case COLOR: - case FILL: - case STROKE: - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: // Facets and Size shouldn't have too many bins - // We choose 6 like shape to simplify the rule [falls through] - - case SHAPE: - return 6; - // Vega's "shape" has 6 distinct values - - case STROKEDASH: - return 4; - // We only provide 5 different stroke dash values (but 4 is more effective) - - default: - return 10; - } - } - - function invalidSpec(spec) { - return "Invalid specification ".concat(JSON.stringify(spec), ". Make sure the specification includes at least one of the following properties: \"mark\", \"layer\", \"facet\", \"hconcat\", \"vconcat\", \"concat\", or \"repeat\"."); - } // FIT - - - var FIT_NON_SINGLE = 'Autosize "fit" only works for single views and layered views.'; - - function containerSizeNonSingle(name) { - var uName = name == 'width' ? 'Width' : 'Height'; - return "".concat(uName, " \"container\" only works for single views and layered views."); - } - - function containerSizeNotCompatibleWithAutosize(name) { - var uName = name == 'width' ? 'Width' : 'Height'; - var fitDirection = name == 'width' ? 'x' : 'y'; - return "".concat(uName, " \"container\" only works well with autosize \"fit\" or \"fit-").concat(fitDirection, "\"."); - } - - function droppingFit(channel) { - return channel ? "Dropping \"fit-".concat(channel, "\" because spec has discrete ").concat(getSizeChannel(channel), ".") : "Dropping \"fit\" because spec has discrete size."; - } // VIEW SIZE - - - function unknownField(channel) { - return "Unknown field for ".concat(channel, ". Cannot calculate view size."); - } // SELECTION - - - function cannotProjectOnChannelWithoutField(channel) { - return "Cannot project a selection on encoding channel \"".concat(channel, "\", which has no field."); - } - - function cannotProjectAggregate(channel, aggregate) { - return "Cannot project a selection on encoding channel \"".concat(channel, "\" as it uses an aggregate function (\"").concat(aggregate, "\")."); - } - - function nearestNotSupportForContinuous(mark) { - return "The \"nearest\" transform is not supported for ".concat(mark, " marks."); - } - - function selectionNotSupported(mark) { - return "Selection not supported for ".concat(mark, " yet."); - } - - function selectionNotFound(name) { - return "Cannot find a selection named \"".concat(name, "\"."); - } - - var SCALE_BINDINGS_CONTINUOUS = 'Scale bindings are currently only supported for scales with unbinned, continuous domains.'; - var LEGEND_BINDINGS_MUST_HAVE_PROJECTION = 'Legend bindings are only supported for selections over an individual field or encoding channel.'; - - function noSameUnitLookup(name) { - return "Cannot define and lookup the \"".concat(name, "\" selection in the same view. ") + "Try moving the lookup into a second, layered view?"; - } - - var NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.'; - var INTERVAL_INITIALIZED_WITH_X_Y = 'Interval selections should be initialized using "x" and/or "y" keys.'; // REPEAT - - function noSuchRepeatedValue(field) { - return "Unknown repeated value \"".concat(field, "\"."); - } - - function columnsNotSupportByRowCol(type) { - return "The \"columns\" property cannot be used when \"".concat(type, "\" has nested row/column."); - } // CONCAT / REPEAT - - - var CONCAT_CANNOT_SHARE_AXIS = 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).'; // DATA - - function unrecognizedParse(p) { - return "Unrecognized parse \"".concat(p, "\"."); - } - - function differentParse(field, local, ancestor) { - return "An ancestor parsed field \"".concat(field, "\" as ").concat(ancestor, " but a child wants to parse the field as ").concat(local, "."); - } - - var ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.'; // TRANSFORMS - - function invalidTransformIgnored(transform) { - return "Ignoring an invalid transform: ".concat(stringify(transform), "."); - } - - var NO_FIELDS_NEEDS_AS = 'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'; // ENCODING & FACET - - function customFormatTypeNotAllowed(channel) { - return "Config.customFormatTypes is not true, thus custom format type and format for channel ".concat(channel, " are dropped."); - } - - function projectionOverridden(opt) { - var parentProjection = opt.parentProjection, - projection = opt.projection; - return "Layer's shared projection ".concat(stringify(parentProjection), " is overridden by a child projection ").concat(stringify(projection), "."); - } - - var REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.'; - - function primitiveChannelDef(channel, type, value) { - return "Channel ".concat(channel, " is a ").concat(type, ". Converted to {value: ").concat(stringify(value), "}."); - } - - function invalidFieldType(type) { - return "Invalid field type \"".concat(type, "\"."); - } - - function invalidFieldTypeForCountAggregate(type, aggregate) { - return "Invalid field type \"".concat(type, "\" for aggregate: \"").concat(aggregate, "\", using \"quantitative\" instead."); - } - - function invalidAggregate(aggregate) { - return "Invalid aggregation operator \"".concat(aggregate, "\"."); - } - - function droppingColor(type, opt) { - var fill = opt.fill, - stroke = opt.stroke; - return "Dropping color ".concat(type, " as the plot also has ").concat(fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke', "."); - } - - function emptyFieldDef(fieldDef, channel) { - return "Dropping ".concat(stringify(fieldDef), " from channel \"").concat(channel, "\" since it does not contain any data field, datum, value, or signal."); - } - - var LINE_WITH_VARYING_SIZE = 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.'; - - function incompatibleChannel(channel, markOrFacet, when) { - return "".concat(channel, " dropped as it is incompatible with \"").concat(markOrFacet, "\"").concat(when ? " when ".concat(when) : '', "."); - } - - function invalidEncodingChannel(channel) { - return "".concat(channel, "-encoding is dropped as ").concat(channel, " is not a valid encoding channel."); - } - - function facetChannelShouldBeDiscrete(channel) { - return "".concat(channel, " encoding should be discrete (ordinal / nominal / binned)."); - } - - function facetChannelDropped(channels) { - return "Facet encoding dropped as ".concat(channels.join(' and '), " ").concat(channels.length > 1 ? 'are' : 'is', " also specified."); - } - - function discreteChannelCannotEncode(channel, type) { - return "Using discrete channel \"".concat(channel, "\" to encode \"").concat(type, "\" field can be misleading as it does not encode ").concat(type === 'ordinal' ? 'order' : 'magnitude', "."); - } // MARK - - - function lineWithRange(hasX2, hasY2) { - var channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2'; - return "Line mark is for continuous lines and thus cannot be used with ".concat(channels, ". We will use the rule mark (line segments) instead."); - } - - function orientOverridden(original, actual) { - return "Specified orient \"".concat(original, "\" overridden with \"").concat(actual, "\"."); - } - - var RANGE_STEP_DEPRECATED = "Scale's \"rangeStep\" is deprecated and will be removed in Vega-Lite 5.0. Please use \"width\"/\"height\": {\"step\": ...} instead. See https://vega.github.io/vega-lite/docs/size.html."; - - function cannotUseScalePropertyWithNonColor(prop) { - return "Cannot use the scale property \"".concat(prop, "\" with non-color channel."); - } - - function unaggregateDomainHasNoEffectForRawField(fieldDef) { - return "Using unaggregated domain with raw field has no effect (".concat(stringify(fieldDef), ")."); - } - - function unaggregateDomainWithNonSharedDomainOp(aggregate) { - return "Unaggregated domain not applicable for \"".concat(aggregate, "\" since it produces values outside the origin domain of the source data."); - } - - function unaggregatedDomainWithLogScale(fieldDef) { - return "Unaggregated domain is currently unsupported for log scale (".concat(stringify(fieldDef), ")."); - } - - function cannotApplySizeToNonOrientedMark(mark) { - return "Cannot apply size to non-oriented mark \"".concat(mark, "\"."); - } - - function scaleTypeNotWorkWithChannel(channel, scaleType, defaultScaleType) { - return "Channel \"".concat(channel, "\" does not work with \"").concat(scaleType, "\" scale. We are using \"").concat(defaultScaleType, "\" scale instead."); - } - - function scaleTypeNotWorkWithFieldDef(scaleType, defaultScaleType) { - return "FieldDef does not work with \"".concat(scaleType, "\" scale. We are using \"").concat(defaultScaleType, "\" scale instead."); - } - - function scalePropertyNotWorkWithScaleType(scaleType, propName, channel) { - return "".concat(channel, "-scale's \"").concat(propName, "\" is dropped as it does not work with ").concat(scaleType, " scale."); - } - - function stepDropped(channel) { - return "The step for \"".concat(channel, "\" is dropped because the ").concat(channel === 'width' ? 'x' : 'y', " is continuous."); - } - - function mergeConflictingProperty(property, propertyOf, v1, v2) { - return "Conflicting ".concat(propertyOf.toString(), " property \"").concat(property.toString(), "\" (").concat(stringify(v1), " and ").concat(stringify(v2), "). Using ").concat(stringify(v1), "."); - } - - function mergeConflictingDomainProperty(property, propertyOf, v1, v2) { - return "Conflicting ".concat(propertyOf.toString(), " property \"").concat(property.toString(), "\" (").concat(stringify(v1), " and ").concat(stringify(v2), "). Using the union of the two domains."); - } - - function independentScaleMeansIndependentGuide(channel) { - return "Setting the scale to be independent for \"".concat(channel, "\" means we also have to set the guide (axis or legend) to be independent."); - } - - function domainSortDropped(sort) { - return "Dropping sort property ".concat(stringify(sort), " as unioned domains only support boolean or op \"count\", \"min\", and \"max\"."); - } - - var MORE_THAN_ONE_SORT = 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.'; - var FACETED_INDEPENDENT_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.'; - var FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.'; - var FACETED_INDEPENDENT_SAME_SOURCE = 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.'; // STACK - - function cannotStackRangedMark(channel) { - return "Cannot stack \"".concat(channel, "\" if there is already \"").concat(channel, "2\"."); - } - - function cannotStackNonLinearScale(scaleType) { - return "Cannot stack non-linear scale (".concat(scaleType, ")."); - } - - function stackNonSummativeAggregate(aggregate) { - return "Stacking is applied even though the aggregate function is non-summative (\"".concat(aggregate, "\")."); - } // TIMEUNIT - - - function invalidTimeUnit(unitName, value) { - return "Invalid ".concat(unitName, ": ").concat(stringify(value), "."); - } - - function droppedDay(d) { - return "Dropping day from datetime ".concat(stringify(d), " as day cannot be combined with other units."); - } - - function errorBarCenterAndExtentAreNotNeeded(center, extent) { - return "".concat(extent ? 'extent ' : '').concat(extent && center ? 'and ' : '').concat(center ? 'center ' : '').concat(extent && center ? 'are ' : 'is ', "not needed when data are aggregated."); - } - - function errorBarCenterIsUsedWithWrongExtent(center, extent, mark) { - return "".concat(center, " is not usually used with ").concat(extent, " for ").concat(mark, "."); - } - - function errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark) { - return "Continuous axis should not have customized aggregation function ".concat(aggregate, "; ").concat(compositeMark, " already agregates the axis."); - } - - function errorBand1DNotSupport(property) { - return "1D error band does not support ".concat(property, "."); - } // CHANNEL - - - function channelRequiredForBinned(channel) { - return "Channel ".concat(channel, " is required for \"binned\" bin."); - } - - function channelShouldNotBeUsedForBinned(channel) { - return "Channel ".concat(channel, " should not be used with \"binned\" bin."); - } - - function domainRequiredForThresholdScale(channel) { - return "Domain for ".concat(channel, " is required for threshold scale."); - } - /** - * Vega-Lite's singleton logger utility. - */ - - - var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - - privateMap.set(receiver, value); - return value; - }; - - var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - - return privateMap.get(receiver); - }; - /** - * Main (default) Vega Logger instance for Vega-Lite. - */ - - - var main = logger(Warn); - var current = main; - /** - * Set the singleton logger to be a custom logger. - */ - - function set(newLogger) { - current = newLogger; - return current; - } - /** - * Reset the main logger to use the default Vega Logger. - */ - - - function reset() { - current = main; - return current; - } - - function warn() { - var _current; - - (_current = current).warn.apply(_current, arguments); - } - - function debug() { - var _current2; - - (_current2 = current).debug.apply(_current2, arguments); - } // DateTime definition object - - - function isDateTime(o) { - if (o && isObject(o)) { - var _iterator13 = _createForOfIteratorHelper(TIMEUNIT_PARTS), - _step13; - - try { - for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) { - var part = _step13.value; - - if (part in o) { - return true; - } - } - } catch (err) { - _iterator13.e(err); - } finally { - _iterator13.f(); - } - } - - return false; - } - - var MONTHS = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; - var SHORT_MONTHS = MONTHS.map(function (m) { - return m.substr(0, 3); - }); - var DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; - var SHORT_DAYS = DAYS.map(function (d) { - return d.substr(0, 3); - }); - - function normalizeQuarter(q) { - if (isNumeric(q)) { - q = +q; - } - - if (isNumber(q)) { - if (q > 4) { - warn(invalidTimeUnit('quarter', q)); - } // We accept 1-based quarter, so need to readjust to 0-based quarter - - - return q - 1; - } else { - // Invalid quarter - throw new Error(invalidTimeUnit('quarter', q)); - } - } - - function normalizeMonth(m) { - if (isNumeric(m)) { - m = +m; - } - - if (isNumber(m)) { - // We accept 1-based month, so need to readjust to 0-based month - return m - 1; - } else { - var lowerM = m.toLowerCase(); - var monthIndex = MONTHS.indexOf(lowerM); - - if (monthIndex !== -1) { - return monthIndex; // 0 for january, ... - } - - var shortM = lowerM.substr(0, 3); - var shortMonthIndex = SHORT_MONTHS.indexOf(shortM); - - if (shortMonthIndex !== -1) { - return shortMonthIndex; - } // Invalid month - - - throw new Error(invalidTimeUnit('month', m)); - } - } - - function normalizeDay(d) { - if (isNumeric(d)) { - d = +d; - } - - if (isNumber(d)) { - // mod so that this can be both 0-based where 0 = sunday - // and 1-based where 7=sunday - return d % 7; - } else { - var lowerD = d.toLowerCase(); - var dayIndex = DAYS.indexOf(lowerD); - - if (dayIndex !== -1) { - return dayIndex; // 0 for january, ... - } - - var shortD = lowerD.substr(0, 3); - var shortDayIndex = SHORT_DAYS.indexOf(shortD); - - if (shortDayIndex !== -1) { - return shortDayIndex; - } // Invalid day - - - throw new Error(invalidTimeUnit('day', d)); - } - } - /** - * @param d the date. - * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime. - * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds] - */ - - - function dateTimeParts(d, normalize) { - var parts = []; - - if (normalize && d.day !== undefined) { - if (keys(d).length > 1) { - warn(droppedDay(d)); - d = duplicate(d); - delete d.day; - } - } - - if (d.year !== undefined) { - parts.push(d.year); - } else { - // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega - // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year). - parts.push(2012); - } - - if (d.month !== undefined) { - var month = normalize ? normalizeMonth(d.month) : d.month; - parts.push(month); - } else if (d.quarter !== undefined) { - var quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter; - parts.push(isNumber(quarter) ? quarter * 3 : quarter + '*3'); - } else { - parts.push(0); // months start at zero in JS - } - - if (d.date !== undefined) { - parts.push(d.date); - } else if (d.day !== undefined) { - // HACK: Day only works as a standalone unit - // This is only correct because we always set year to 2006 for day - var day = normalize ? normalizeDay(d.day) : d.day; - parts.push(isNumber(day) ? day + 1 : day + '+1'); - } else { - parts.push(1); // Date starts at 1 in JS - } // Note: can't use TimeUnit enum here as importing it will create - // circular dependency problem! - - - for (var _i4 = 0, _arr2 = ['hours', 'minutes', 'seconds', 'milliseconds']; _i4 < _arr2.length; _i4++) { - var timeUnit = _arr2[_i4]; - var unit = d[timeUnit]; - parts.push(typeof unit === 'undefined' ? 0 : unit); - } - - return parts; - } - /** - * Return Vega expression for a date time. - * - * @param d the date time. - * @returns the Vega expression. - */ - - - function dateTimeToExpr(d) { - var parts = dateTimeParts(d, true); - var string = parts.join(', '); - - if (d.utc) { - return "utc(".concat(string, ")"); - } else { - return "datetime(".concat(string, ")"); - } - } - /** - * Return Vega expression for a date time expression. - * - * @param d the internal date time object with expression. - * @returns the Vega expression. - */ - - - function dateTimeExprToExpr(d) { - var parts = dateTimeParts(d, false); - var string = parts.join(', '); - - if (d.utc) { - return "utc(".concat(string, ")"); - } else { - return "datetime(".concat(string, ")"); - } - } - /** - * @param d the date time. - * @returns the timestamp. - */ - - - function dateTimeToTimestamp(d) { - var parts = dateTimeParts(d, true); - - if (d.utc) { - return +new Date(Date.UTC.apply(Date, _toConsumableArray(parts))); - } else { - return +_construct(Date, _toConsumableArray(parts)); - } - } - /** Time Unit that only corresponds to only one part of Date objects. */ - - - var LOCAL_SINGLE_TIMEUNIT_INDEX = { - year: 1, - quarter: 1, - month: 1, - week: 1, - day: 1, - dayofyear: 1, - date: 1, - hours: 1, - minutes: 1, - seconds: 1, - milliseconds: 1 - }; - var TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX); - - function isLocalSingleTimeUnit(timeUnit) { - return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit]; - } - - function isUTCTimeUnit(t) { - return t.startsWith('utc'); - } - - function getLocalTimeUnit(t) { - return t.substr(3); - } // In order of increasing specificity - - - var VEGALITE_TIMEFORMAT = { - 'year-month': '%b %Y ', - 'year-month-date': '%b %d, %Y ' - }; - - function getTimeUnitParts(timeUnit) { - var parts = []; - - var _iterator14 = _createForOfIteratorHelper(TIMEUNIT_PARTS), - _step14; - - try { - for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) { - var part = _step14.value; - - if (containsTimeUnit(timeUnit, part)) { - parts.push(part); - } - } - } catch (err) { - _iterator14.e(err); - } finally { - _iterator14.f(); - } - - return parts; - } - /** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */ - - - function containsTimeUnit(fullTimeUnit, timeUnit) { - var index = fullTimeUnit.indexOf(timeUnit); - - if (index < 0) { - return false; - } // exclude milliseconds - - - if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') { - return false; - } // exclude dayofyear - - - if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') { - return false; - } - - if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') { - return false; - } - - return true; - } - /** - * Returns Vega expression for a given timeUnit and fieldRef - */ - - - function fieldExpr(fullTimeUnit, field) { - var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { - end: false - }, - end = _ref.end; - - var fieldRef = accessPathWithDatum(field); - var utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : ''; - - function func(timeUnit) { - if (timeUnit === 'quarter') { - // quarter starting at 0 (0,3,6,9). - return "(".concat(utc, "quarter(").concat(fieldRef, ")-1)"); - } else { - return "".concat(utc).concat(timeUnit, "(").concat(fieldRef, ")"); - } - } - - var lastTimeUnit; - var dateExpr = {}; - - var _iterator15 = _createForOfIteratorHelper(TIMEUNIT_PARTS), - _step15; - - try { - for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) { - var part = _step15.value; - - if (containsTimeUnit(fullTimeUnit, part)) { - dateExpr[part] = func(part); - lastTimeUnit = part; - } - } - } catch (err) { - _iterator15.e(err); - } finally { - _iterator15.f(); - } - - if (end) { - dateExpr[lastTimeUnit] += '+1'; - } - - return dateTimeExprToExpr(dateExpr); - } - - function timeUnitSpecifierExpression(timeUnit) { - if (!timeUnit) { - return undefined; - } - - var timeUnitParts = getTimeUnitParts(timeUnit); - return "timeUnitSpecifier(".concat(fastJsonStableStringify(timeUnitParts), ", ").concat(fastJsonStableStringify(VEGALITE_TIMEFORMAT), ")"); - } - /** - * Returns the signal expression used for axis labels for a time unit. - */ - - - function formatExpression(timeUnit, field, isUTCScale) { - if (!timeUnit) { - return undefined; - } - - var expr = timeUnitSpecifierExpression(timeUnit); // We only use utcFormat for utc scale - // For utc time units, the data is already converted as a part of timeUnit transform. - // Thus, utc time units should use timeFormat to avoid shifting the time twice. - - var utc = isUTCScale || isUTCTimeUnit(timeUnit); - return "".concat(utc ? 'utc' : 'time', "Format(").concat(field, ", ").concat(expr, ")"); - } - - function normalizeTimeUnit(timeUnit) { - if (!timeUnit) { - return undefined; - } - - var params; - - if (isString(timeUnit)) { - params = { - unit: timeUnit - }; - } else if (isObject(timeUnit)) { - params = Object.assign(Object.assign({}, timeUnit), timeUnit.unit ? { - unit: timeUnit.unit - } : {}); - } - - if (isUTCTimeUnit(params.unit)) { - params.utc = true; - params.unit = getLocalTimeUnit(params.unit); - } - - return params; - } - - function timeUnitToString(tu) { - var _a = normalizeTimeUnit(tu), - utc = _a.utc, - rest = __rest(_a, ["utc"]); - - if (rest.unit) { - return (utc ? 'utc' : '') + keys(rest).map(function (p) { - return varName("".concat(p === 'unit' ? '' : "_".concat(p, "_")).concat(rest[p])); - }).join(''); - } else { - // when maxbins is specified instead of units - return (utc ? 'utc' : '') + 'timeunit' + keys(rest).map(function (p) { - return varName("_".concat(p, "_").concat(rest[p])); - }).join(''); - } - } - - function isSignalRef(o) { - return o && !!o['signal']; - } - - function isVgRangeStep(range) { - return !!range['step']; - } - - function isDataRefUnionedDomain(domain) { - if (!isArray(domain)) { - return 'fields' in domain && !('data' in domain); - } - - return false; - } - - function isFieldRefUnionDomain(domain) { - if (!isArray(domain)) { - return 'fields' in domain && 'data' in domain; - } - - return false; - } - - function isDataRefDomain(domain) { - if (!isArray(domain)) { - return 'field' in domain && 'data' in domain; - } - - return false; - } - - var VG_MARK_CONFIG_INDEX = { - aria: 1, - description: 1, - ariaRole: 1, - ariaRoleDescription: 1, - blend: 1, - opacity: 1, - fill: 1, - fillOpacity: 1, - stroke: 1, - strokeCap: 1, - strokeWidth: 1, - strokeOpacity: 1, - strokeDash: 1, - strokeDashOffset: 1, - strokeJoin: 1, - strokeOffset: 1, - strokeMiterLimit: 1, - startAngle: 1, - endAngle: 1, - padAngle: 1, - innerRadius: 1, - outerRadius: 1, - size: 1, - shape: 1, - interpolate: 1, - tension: 1, - orient: 1, - align: 1, - baseline: 1, - text: 1, - dir: 1, - dx: 1, - dy: 1, - ellipsis: 1, - limit: 1, - radius: 1, - theta: 1, - angle: 1, - font: 1, - fontSize: 1, - fontWeight: 1, - fontStyle: 1, - lineBreak: 1, - lineHeight: 1, - cursor: 1, - href: 1, - tooltip: 1, - cornerRadius: 1, - cornerRadiusTopLeft: 1, - cornerRadiusTopRight: 1, - cornerRadiusBottomLeft: 1, - cornerRadiusBottomRight: 1, - aspect: 1, - width: 1, - height: 1 // commented below are vg channel that do not have mark config. - // x: 1, - // y: 1, - // x2: 1, - // y2: 1, - // xc'|'yc' - // clip: 1, - // path: 1, - // url: 1, - - }; - var VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX); - var VG_MARK_INDEX = { - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; // Vega's cornerRadius channels. - - var VG_CORNERRADIUS_CHANNELS = ['cornerRadius', 'cornerRadiusTopLeft', 'cornerRadiusTopRight', 'cornerRadiusBottomLeft', 'cornerRadiusBottomRight']; - - function isSelectionPredicate(predicate) { - return predicate === null || predicate === void 0 ? void 0 : predicate['selection']; - } - - function isFieldEqualPredicate(predicate) { - return predicate && !!predicate.field && predicate.equal !== undefined; - } - - function isFieldLTPredicate(predicate) { - return predicate && !!predicate.field && predicate.lt !== undefined; - } - - function isFieldLTEPredicate(predicate) { - return predicate && !!predicate.field && predicate.lte !== undefined; - } - - function isFieldGTPredicate(predicate) { - return predicate && !!predicate.field && predicate.gt !== undefined; - } - - function isFieldGTEPredicate(predicate) { - return predicate && !!predicate.field && predicate.gte !== undefined; - } - - function isFieldRangePredicate(predicate) { - if (predicate && predicate.field) { - if (isArray(predicate.range) && predicate.range.length === 2) { - return true; - } else if (isSignalRef(predicate.range)) { - return true; - } - } - - return false; - } - - function isFieldOneOfPredicate(predicate) { - return predicate && !!predicate.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility - ; - } - - function isFieldValidPredicate(predicate) { - return predicate && !!predicate.field && predicate.valid !== undefined; - } - - function isFieldPredicate(predicate) { - return isFieldOneOfPredicate(predicate) || isFieldEqualPredicate(predicate) || isFieldRangePredicate(predicate) || isFieldLTPredicate(predicate) || isFieldGTPredicate(predicate) || isFieldLTEPredicate(predicate) || isFieldGTEPredicate(predicate); - } - - function predicateValueExpr(v, timeUnit) { - return valueExpr(v, { - timeUnit: timeUnit, - wrapTime: true - }); - } - - function predicateValuesExpr(vals, timeUnit) { - return vals.map(function (v) { - return predicateValueExpr(v, timeUnit); - }); - } // This method is used by Voyager. Do not change its behavior without changing Voyager. - - - function fieldFilterExpression(predicate) { - var useInRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - var _a; - - var field = predicate.field; - var timeUnit = (_a = normalizeTimeUnit(predicate.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit; - var fieldExpr$1 = timeUnit ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly. - // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline - // TODO: support utc - 'time(' + fieldExpr(timeUnit, field) + ')' : _vgField(predicate, { - expr: 'datum' - }); - - if (isFieldEqualPredicate(predicate)) { - return fieldExpr$1 + '===' + predicateValueExpr(predicate.equal, timeUnit); - } else if (isFieldLTPredicate(predicate)) { - var upper = predicate.lt; - return "".concat(fieldExpr$1, "<").concat(predicateValueExpr(upper, timeUnit)); - } else if (isFieldGTPredicate(predicate)) { - var lower = predicate.gt; - return "".concat(fieldExpr$1, ">").concat(predicateValueExpr(lower, timeUnit)); - } else if (isFieldLTEPredicate(predicate)) { - var _upper = predicate.lte; - return "".concat(fieldExpr$1, "<=").concat(predicateValueExpr(_upper, timeUnit)); - } else if (isFieldGTEPredicate(predicate)) { - var _lower = predicate.gte; - return "".concat(fieldExpr$1, ">=").concat(predicateValueExpr(_lower, timeUnit)); - } else if (isFieldOneOfPredicate(predicate)) { - return "indexof([".concat(predicateValuesExpr(predicate.oneOf, timeUnit).join(','), "], ").concat(fieldExpr$1, ") !== -1"); - } else if (isFieldValidPredicate(predicate)) { - return fieldValidPredicate(fieldExpr$1, predicate.valid); - } else if (isFieldRangePredicate(predicate)) { - var range = predicate.range; - - var _lower2 = isSignalRef(range) ? { - signal: "".concat(range.signal, "[0]") - } : range[0]; - - var _upper2 = isSignalRef(range) ? { - signal: "".concat(range.signal, "[1]") - } : range[1]; - - if (_lower2 !== null && _upper2 !== null && useInRange) { - return 'inrange(' + fieldExpr$1 + ', [' + predicateValueExpr(_lower2, timeUnit) + ', ' + predicateValueExpr(_upper2, timeUnit) + '])'; - } - - var exprs = []; - - if (_lower2 !== null) { - exprs.push("".concat(fieldExpr$1, " >= ").concat(predicateValueExpr(_lower2, timeUnit))); - } - - if (_upper2 !== null) { - exprs.push("".concat(fieldExpr$1, " <= ").concat(predicateValueExpr(_upper2, timeUnit))); - } - - return exprs.length > 0 ? exprs.join(' && ') : 'true'; - } - /* istanbul ignore next: it should never reach here */ - - - throw new Error("Invalid field predicate: ".concat(JSON.stringify(predicate))); - } - - function fieldValidPredicate(fieldExpr) { - var valid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - if (valid) { - return "isValid(".concat(fieldExpr, ") && isFinite(+").concat(fieldExpr, ")"); - } else { - return "!isValid(".concat(fieldExpr, ") || !isFinite(+").concat(fieldExpr, ")"); - } - } - - function normalizePredicate(f) { - var _a; - - if (isFieldPredicate(f) && f.timeUnit) { - return Object.assign(Object.assign({}, f), { - timeUnit: (_a = normalizeTimeUnit(f.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit - }); - } - - return f; - } - /** - * Data type based on level of measurement - */ - - - var Type = { - quantitative: 'quantitative', - ordinal: 'ordinal', - temporal: 'temporal', - nominal: 'nominal', - geojson: 'geojson' - }; - var QUANTITATIVE = Type.quantitative; - var ORDINAL = Type.ordinal; - var TEMPORAL = Type.temporal; - var NOMINAL = Type.nominal; - var GEOJSON = Type.geojson; - /** - * Get full, lowercase type name for a given type. - * @param type - * @return Full type name. - */ - - function getFullName(type) { - if (type) { - type = type.toLowerCase(); - - switch (type) { - case 'q': - case QUANTITATIVE: - return 'quantitative'; - - case 't': - case TEMPORAL: - return 'temporal'; - - case 'o': - case ORDINAL: - return 'ordinal'; - - case 'n': - case NOMINAL: - return 'nominal'; - - case GEOJSON: - return 'geojson'; - } - } // If we get invalid input, return undefined type. - - - return undefined; - } - - var ScaleType = { - // Continuous - Quantitative - LINEAR: 'linear', - LOG: 'log', - POW: 'pow', - SQRT: 'sqrt', - SYMLOG: 'symlog', - IDENTITY: 'identity', - SEQUENTIAL: 'sequential', - // Continuous - Time - TIME: 'time', - UTC: 'utc', - // Discretizing scales - QUANTILE: 'quantile', - QUANTIZE: 'quantize', - THRESHOLD: 'threshold', - BIN_ORDINAL: 'bin-ordinal', - // Discrete scales - ORDINAL: 'ordinal', - POINT: 'point', - BAND: 'band' - }; - /** - * Index for scale categories -- only scale of the same categories can be merged together. - * Current implementation is trying to be conservative and avoid merging scale type that might not work together - */ - - var SCALE_CATEGORY_INDEX = { - linear: 'numeric', - log: 'numeric', - pow: 'numeric', - sqrt: 'numeric', - symlog: 'numeric', - identity: 'numeric', - sequential: 'numeric', - time: 'time', - utc: 'time', - ordinal: 'ordinal', - 'bin-ordinal': 'bin-ordinal', - point: 'ordinal-position', - band: 'ordinal-position', - quantile: 'discretizing', - quantize: 'discretizing', - threshold: 'discretizing' - }; - /** - * Whether the two given scale types can be merged together. - */ - - function scaleCompatible(scaleType1, scaleType2) { - var scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1]; - var scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2]; - return scaleCategory1 === scaleCategory2 || scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time' || scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time'; - } - /** - * Index for scale precedence -- high score = higher priority for merging. - */ - - - var SCALE_PRECEDENCE_INDEX = { - // numeric - linear: 0, - log: 1, - pow: 1, - sqrt: 1, - symlog: 1, - identity: 1, - sequential: 1, - // time - time: 0, - utc: 0, - // ordinal-position -- these have higher precedence than continuous scales as they support more types of data - point: 10, - band: 11, - // non grouped types - ordinal: 0, - 'bin-ordinal': 0, - quantile: 0, - quantize: 0, - threshold: 0 - }; - /** - * Return scale categories -- only scale of the same categories can be merged together. - */ - - function scaleTypePrecedence(scaleType) { - return SCALE_PRECEDENCE_INDEX[scaleType]; - } - - var CONTINUOUS_TO_CONTINUOUS_SCALES = ['linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc']; - var CONTINUOUS_TO_CONTINUOUS_INDEX = toSet(CONTINUOUS_TO_CONTINUOUS_SCALES); - var QUANTITATIVE_SCALES = ['linear', 'log', 'pow', 'sqrt', 'symlog']; - var QUANTITATIVE_SCALES_INDEX = toSet(QUANTITATIVE_SCALES); - - function isQuantitative(type) { - return type in QUANTITATIVE_SCALES_INDEX; - } - - var CONTINUOUS_TO_DISCRETE_SCALES = ['quantile', 'quantize', 'threshold']; - var CONTINUOUS_TO_DISCRETE_INDEX = toSet(CONTINUOUS_TO_DISCRETE_SCALES); - var CONTINUOUS_DOMAIN_SCALES = CONTINUOUS_TO_CONTINUOUS_SCALES.concat(['quantile', 'quantize', 'threshold', 'sequential', 'identity']); - var CONTINUOUS_DOMAIN_INDEX = toSet(CONTINUOUS_DOMAIN_SCALES); - var DISCRETE_DOMAIN_SCALES = ['ordinal', 'bin-ordinal', 'point', 'band']; - var DISCRETE_DOMAIN_INDEX = toSet(DISCRETE_DOMAIN_SCALES); - - function hasDiscreteDomain(type) { - return type in DISCRETE_DOMAIN_INDEX; - } - - function hasContinuousDomain(type) { - return type in CONTINUOUS_DOMAIN_INDEX; - } - - function isContinuousToContinuous(type) { - return type in CONTINUOUS_TO_CONTINUOUS_INDEX; - } - - function isContinuousToDiscrete(type) { - return type in CONTINUOUS_TO_DISCRETE_INDEX; - } - - var defaultScaleConfig = { - pointPadding: 0.5, - barBandPaddingInner: 0.1, - rectBandPaddingInner: 0, - minBandSize: 2, - minFontSize: 8, - maxFontSize: 40, - minOpacity: 0.3, - maxOpacity: 0.8, - // FIXME: revise if these *can* become ratios of width/height step - minSize: 9, - minStrokeWidth: 1, - maxStrokeWidth: 4, - quantileCount: 4, - quantizeCount: 4 - }; - - function isExtendedScheme(scheme) { - return !isString(scheme) && !!scheme['name']; - } - - function isSelectionDomain(domain) { - return domain === null || domain === void 0 ? void 0 : domain['selection']; - } - - function isDomainUnionWith(domain) { - return domain && domain['unionWith']; - } - - var SCALE_PROPERTY_INDEX = { - type: 1, - domain: 1, - domainMax: 1, - domainMin: 1, - domainMid: 1, - align: 1, - range: 1, - rangeMax: 1, - rangeMin: 1, - scheme: 1, - bins: 1, - // Other properties - reverse: 1, - round: 1, - // quantitative / time - clamp: 1, - nice: 1, - // quantitative - base: 1, - exponent: 1, - constant: 1, - interpolate: 1, - zero: 1, - // band/point - padding: 1, - paddingInner: 1, - paddingOuter: 1 - }; - - var NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX = __rest(SCALE_PROPERTY_INDEX, ["type", "domain", "range", "rangeMax", "rangeMin", "scheme"]); - - var NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX); - - function scaleTypeSupportProperty(scaleType, propName) { - switch (propName) { - case 'type': - case 'domain': - case 'reverse': - case 'range': - return true; - - case 'scheme': - case 'interpolate': - return !contains(['point', 'band', 'identity'], scaleType); - - case 'bins': - return !contains(['point', 'band', 'identity', 'ordinal'], scaleType); - - case 'round': - return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point'; - - case 'padding': - case 'rangeMin': - case 'rangeMax': - return isContinuousToContinuous(scaleType) || contains(['point', 'band'], scaleType); - - case 'paddingOuter': - case 'align': - return contains(['point', 'band'], scaleType); - - case 'paddingInner': - return scaleType === 'band'; - - case 'domainMax': - case 'domainMid': - case 'domainMin': - case 'clamp': - return isContinuousToContinuous(scaleType); - - case 'nice': - return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold'; - - case 'exponent': - return scaleType === 'pow'; - - case 'base': - return scaleType === 'log'; - - case 'constant': - return scaleType === 'symlog'; - - case 'zero': - return hasContinuousDomain(scaleType) && !contains(['log', 'time', 'utc', 'threshold', 'quantile' // quantile depends on distribution so zero does not matter - ], scaleType); - } - } - /** - * Returns undefined if the input channel supports the input scale property name - */ - - - function channelScalePropertyIncompatability(channel, propName) { - switch (propName) { - case 'interpolate': - case 'scheme': - case 'domainMid': - if (!isColorChannel(channel)) { - return cannotUseScalePropertyWithNonColor(channel); - } - - return undefined; - - case 'align': - case 'type': - case 'bins': - case 'domain': - case 'domainMax': - case 'domainMin': - case 'range': - case 'base': - case 'exponent': - case 'constant': - case 'nice': - case 'padding': - case 'paddingInner': - case 'paddingOuter': - case 'rangeMax': - case 'rangeMin': - case 'reverse': - case 'round': - case 'clamp': - case 'zero': - return undefined; - // GOOD! - } - } - - function scaleTypeSupportDataType(specifiedType, fieldDefType) { - if (contains([ORDINAL, NOMINAL], fieldDefType)) { - return specifiedType === undefined || hasDiscreteDomain(specifiedType); - } else if (fieldDefType === TEMPORAL) { - return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType); - } else if (fieldDefType === QUANTITATIVE) { - return contains([ScaleType.LOG, ScaleType.POW, ScaleType.SQRT, ScaleType.SYMLOG, ScaleType.QUANTILE, ScaleType.QUANTIZE, ScaleType.THRESHOLD, ScaleType.LINEAR, undefined], specifiedType); - } - - return true; - } - - function channelSupportScaleType(channel, scaleType) { - if (!isScaleChannel(channel)) { - return false; - } - - switch (channel) { - case X: - case Y: - case THETA: - case RADIUS: - return isContinuousToContinuous(scaleType) || contains(['band', 'point'], scaleType); - - case SIZE: // TODO: size and opacity can support ordinal with more modification - - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case ANGLE: - // Although it generally doesn't make sense to use band with size and opacity, - // it can also work since we use band: 0.5 to get midpoint. - return isContinuousToContinuous(scaleType) || isContinuousToDiscrete(scaleType) || contains(['band', 'point', 'ordinal'], scaleType); - - case COLOR: - case FILL: - case STROKE: - return scaleType !== 'band'; - // band does not make sense with color - - case STROKEDASH: - return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType); - - case SHAPE: - return scaleType === 'ordinal'; - // shape = lookup only - } - } - - function midPointRefWithPositionInvalidTest(params) { - var channel = params.channel, - channelDef = params.channelDef, - markDef = params.markDef, - scale = params.scale, - config = params.config; - var ref = midPoint(params); // Wrap to check if the positional value is invalid, if so, plot the point on the min value - - if ( // Only this for field def without counting aggregate (as count wouldn't be null) - isFieldDef(channelDef) && !isCountingAggregateOp(channelDef.aggregate) && // and only for continuous scale without zero (otherwise, null / invalid will be interpreted as zero, which doesn't cause layout problem) - scale && isContinuousToContinuous(scale.get('type')) && scale.get('zero') === false) { - return wrapPositionInvalidTest({ - fieldDef: channelDef, - channel: channel, - markDef: markDef, - ref: ref, - config: config - }); - } - - return ref; - } - - function wrapPositionInvalidTest(_ref2) { - var fieldDef = _ref2.fieldDef, - channel = _ref2.channel, - markDef = _ref2.markDef, - ref = _ref2.ref, - config = _ref2.config; - - if (isPathMark(markDef.type)) { - // path mark already use defined to skip points, no need to do it here. - return ref; - } - - var invalid = getMarkPropOrConfig('invalid', markDef, config); - - if (invalid === null) { - // if there is no invalid filter, don't do the invalid test - return ref; - } - - return [fieldInvalidTestValueRef(fieldDef, channel), ref]; - } - - function fieldInvalidTestValueRef(fieldDef, channel) { - var test = fieldInvalidPredicate(fieldDef, true); - var mainChannel = getMainRangeChannel(channel); // we can cast here as the output can't be other things. - - var zeroValueRef = mainChannel === 'y' ? { - field: { - group: 'height' - } - } : // x / angle / radius can all use 0 - { - value: 0 - }; - return Object.assign({ - test: test - }, zeroValueRef); - } - - function fieldInvalidPredicate(field) { - var invalid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - return fieldValidPredicate(isString(field) ? field : _vgField(field, { - expr: 'datum' - }), !invalid); - } - - function datumDefToExpr(datumDef) { - var datum = datumDef.datum; - - if (isDateTime(datum)) { - return dateTimeToExpr(datum); - } - - return "".concat(JSON.stringify(datum)); - } - - function valueRefForFieldOrDatumDef(fieldDef, scaleName, opt, encode) { - var ref = {}; - - if (scaleName) { - ref.scale = scaleName; - } - - if (isDatumDef(fieldDef)) { - var datum = fieldDef.datum; - - if (isDateTime(datum)) { - ref.signal = dateTimeToExpr(datum); - } else if (isSignalRef(datum)) { - ref.signal = datum.signal; - } else { - ref.value = datum; - } - } else { - ref.field = _vgField(fieldDef, opt); - } - - if (encode) { - var offset = encode.offset, - band = encode.band; - - if (offset) { - ref.offset = offset; - } - - if (band) { - ref.band = band; - } - } - - return ref; - } - /** - * Signal that returns the middle of a bin from start and end field. Should only be used with x and y. - */ - - - function interpolatedSignalRef(_ref3) { - var scaleName = _ref3.scaleName, - fieldOrDatumDef = _ref3.fieldOrDatumDef, - fieldOrDatumDef2 = _ref3.fieldOrDatumDef2, - offset = _ref3.offset, - startSuffix = _ref3.startSuffix, - _ref3$band = _ref3.band, - band = _ref3$band === void 0 ? 0.5 : _ref3$band; - var expr = 0 < band && band < 1 ? 'datum' : undefined; - - var start = _vgField(fieldOrDatumDef, { - expr: expr, - suffix: startSuffix - }); - - var end = fieldOrDatumDef2 !== undefined ? _vgField(fieldOrDatumDef2, { - expr: expr - }) : _vgField(fieldOrDatumDef, { - suffix: 'end', - expr: expr - }); - var ref = {}; - - if (band === 0 || band === 1) { - ref.scale = scaleName; - var val = band === 0 ? start : end; - ref.field = val; - } else { - var datum = "".concat(band, " * ").concat(start, " + ").concat(1 - band, " * ").concat(end); - ref.signal = "scale(\"".concat(scaleName, "\", ").concat(datum, ")"); - } - - if (offset) { - ref.offset = offset; - } - - return ref; - } - /** - * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels. - */ - - - function midPoint(_ref4) { - var channel = _ref4.channel, - channelDef = _ref4.channelDef, - channel2Def = _ref4.channel2Def, - markDef = _ref4.markDef, - config = _ref4.config, - scaleName = _ref4.scaleName, - scale = _ref4.scale, - stack = _ref4.stack, - offset = _ref4.offset, - defaultRef = _ref4.defaultRef, - band = _ref4.band; - - var _a; // TODO: datum support - - - if (channelDef) { - /* istanbul ignore else */ - if (isFieldOrDatumDef(channelDef)) { - if (isTypedFieldDef(channelDef)) { - band = band !== null && band !== void 0 ? band : getBand({ - channel: channel, - fieldDef: channelDef, - fieldDef2: channel2Def, - markDef: markDef, - stack: stack, - config: config, - isMidPoint: true - }); - var bin = channelDef.bin, - timeUnit = channelDef.timeUnit, - type = channelDef.type; - - if (isBinning(bin) || band && timeUnit && type === TEMPORAL) { - // Use middle only for x an y to place marks in the center between start and end of the bin range. - // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match. - if (stack && stack.impute) { - // For stack, we computed bin_mid so we can impute. - return valueRefForFieldOrDatumDef(channelDef, scaleName, { - binSuffix: 'mid' - }, { - offset: offset - }); - } - - if (band) { - // if band = 0, no need to call interpolation - // For non-stack, we can just calculate bin mid on the fly using signal. - return interpolatedSignalRef({ - scaleName: scaleName, - fieldOrDatumDef: channelDef, - band: band, - offset: offset - }); - } - - return valueRefForFieldOrDatumDef(channelDef, scaleName, binRequiresRange(channelDef, channel) ? { - binSuffix: 'range' - } : {}, { - offset: offset - }); - } else if (isBinned(bin)) { - if (isFieldDef(channel2Def)) { - return interpolatedSignalRef({ - scaleName: scaleName, - fieldOrDatumDef: channelDef, - fieldOrDatumDef2: channel2Def, - band: band, - offset: offset - }); - } else { - var channel2 = channel === X ? X2 : Y2; - warn(channelRequiredForBinned(channel2)); - } - } - } - - var _scaleType = scale === null || scale === void 0 ? void 0 : scale.get('type'); - - return valueRefForFieldOrDatumDef(channelDef, scaleName, hasDiscreteDomain(_scaleType) ? { - binSuffix: 'range' - } : {}, // no need for bin suffix if there is no scale - { - offset: offset, - // For band, to get mid point, need to offset by half of the band - band: _scaleType === 'band' ? (_a = band !== null && band !== void 0 ? band : channelDef.band) !== null && _a !== void 0 ? _a : 0.5 : undefined - }); - } else if (isValueDef(channelDef)) { - var value = channelDef.value; - var offsetMixins = offset ? { - offset: offset - } : {}; - return Object.assign(Object.assign({}, widthHeightValueOrSignalRef(channel, value)), offsetMixins); - } // If channelDef is neither field def or value def, it's a condition-only def. - // In such case, we will use default ref. - - } - - if (isFunction(defaultRef)) { - defaultRef = defaultRef(); - } - - if (defaultRef) { - // for non-position, ref could be undefined. - return Object.assign(Object.assign({}, defaultRef), offset ? { - offset: offset - } : {}); - } - - return defaultRef; - } - /** - * Convert special "width" and "height" values in Vega-Lite into Vega value ref. - */ - - - function widthHeightValueOrSignalRef(channel, value) { - if (contains(['x', 'x2'], channel) && value === 'width') { - return { - field: { - group: 'width' - } - }; - } else if (contains(['y', 'y2'], channel) && value === 'height') { - return { - field: { - group: 'height' - } - }; - } - - return signalOrValueRef(value); - } - - function isCustomFormatType(formatType) { - return formatType && formatType !== 'number' && formatType !== 'time'; - } - - function customFormatExpr(formatType, field, format) { - return "".concat(formatType, "(").concat(field).concat(format ? ", ".concat(JSON.stringify(format)) : '', ")"); - } - - var BIN_RANGE_DELIMITER = " \u2013 "; - - function formatSignalRef(_ref5) { - var fieldOrDatumDef = _ref5.fieldOrDatumDef, - format = _ref5.format, - formatType = _ref5.formatType, - expr = _ref5.expr, - normalizeStack = _ref5.normalizeStack, - config = _ref5.config; - - var _a, _b; - - if (isCustomFormatType(formatType)) { - return formatCustomType({ - fieldOrDatumDef: fieldOrDatumDef, - format: format, - formatType: formatType, - expr: expr, - config: config - }); - } - - var field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack); - - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { - var signal = timeFormatExpression(field, isFieldDef(fieldOrDatumDef) ? (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit : undefined, format, config.timeFormat, isScaleFieldDef(fieldOrDatumDef) && ((_b = fieldOrDatumDef.scale) === null || _b === void 0 ? void 0 : _b.type) === ScaleType.UTC); - return signal ? { - signal: signal - } : undefined; - } - - format = numberFormat(channelDefType(fieldOrDatumDef), format, config); - - if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { - var endField = _vgField(fieldOrDatumDef, { - expr: expr, - binSuffix: 'end' - }); - - return { - signal: binFormatExpression(field, endField, format, formatType, config) - }; - } else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') { - return { - signal: "".concat(formatExpr(field, format)) - }; - } else { - return { - signal: "isValid(".concat(field, ") ? ").concat(field, " : \"\"+").concat(field) - }; - } - } - - function fieldToFormat(fieldOrDatumDef, expr, normalizeStack) { - if (isFieldDef(fieldOrDatumDef)) { - if (normalizeStack) { - return "".concat(_vgField(fieldOrDatumDef, { - expr: expr, - suffix: 'end' - }), "-").concat(_vgField(fieldOrDatumDef, { - expr: expr, - suffix: 'start' - })); - } else { - return _vgField(fieldOrDatumDef, { - expr: expr - }); - } - } else { - return datumDefToExpr(fieldOrDatumDef); - } - } - - function formatCustomType(_ref6) { - var fieldOrDatumDef = _ref6.fieldOrDatumDef, - format = _ref6.format, - formatType = _ref6.formatType, - expr = _ref6.expr, - normalizeStack = _ref6.normalizeStack, - config = _ref6.config, - field = _ref6.field; - field = field !== null && field !== void 0 ? field : fieldToFormat(fieldOrDatumDef, expr, normalizeStack); - - if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { - var endField = _vgField(fieldOrDatumDef, { - expr: expr, - binSuffix: 'end' - }); - - return { - signal: binFormatExpression(field, endField, format, formatType, config) - }; - } - - return { - signal: customFormatExpr(formatType, field, format) - }; - } - - function guideFormat(fieldOrDatumDef, type, format, formatType, config, omitTimeFormatConfig // axis doesn't use config.timeFormat - ) { - var _a; - - if (isCustomFormatType(formatType)) { - return undefined; // handled in encode block - } - - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { - var timeUnit = isFieldDef(fieldOrDatumDef) ? (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit : undefined; - return timeFormat(format, timeUnit, config, omitTimeFormatConfig); - } - - return numberFormat(type, format, config); - } - - function guideFormatType(formatType, fieldOrDatumDef, scaleType) { - if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) { - return formatType; - } - - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') { - return 'time'; - } - - return undefined; - } - /** - * Returns number format for a fieldDef. - */ - - - function numberFormat(type, specifiedFormat, config) { - // Specified format in axis/legend has higher precedence than fieldDef.format - if (isString(specifiedFormat)) { - return specifiedFormat; - } - - if (type === QUANTITATIVE) { - // we only apply the default if the field is quantitative - return config.numberFormat; - } - - return undefined; - } - /** - * Returns time format for a fieldDef for use in guides. - */ - - - function timeFormat(specifiedFormat, timeUnit, config, omitTimeFormatConfig) { - if (specifiedFormat) { - return specifiedFormat; - } - - if (timeUnit) { - return { - signal: timeUnitSpecifierExpression(timeUnit) - }; - } - - return omitTimeFormatConfig ? undefined : config.timeFormat; - } - - function formatExpr(field, format) { - return "format(".concat(field, ", \"").concat(format || '', "\")"); - } - - function binNumberFormatExpr(field, format, formatType, config) { - var _a; - - if (isCustomFormatType(formatType)) { - return customFormatExpr(formatType, field, format); - } - - return formatExpr(field, (_a = isString(format) ? format : undefined) !== null && _a !== void 0 ? _a : config.numberFormat); - } - - function binFormatExpression(startField, endField, format, formatType, config) { - var start = binNumberFormatExpr(startField, format, formatType, config); - var end = binNumberFormatExpr(endField, format, formatType, config); - return "".concat(fieldValidPredicate(startField, false), " ? \"null\" : ").concat(start, " + \"").concat(BIN_RANGE_DELIMITER, "\" + ").concat(end); - } - /** - * Returns the time expression used for axis/legend labels or text mark for a temporal field - */ - - - function timeFormatExpression(field, timeUnit, format, rawTimeFormat, // should be provided only for actual text and headers, not axis/legend labels - isUTCScale) { - if (!timeUnit || format) { - // If there is no time unit, or if user explicitly specifies format for axis/legend/text. - format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit. - - return "".concat(isUTCScale ? 'utc' : 'time', "Format(").concat(field, ", '").concat(format, "')"); - } else { - return formatExpression(timeUnit, field, isUTCScale); - } - } - - var DEFAULT_SORT_OP = 'min'; - var SORT_BY_CHANNEL_INDEX = { - x: 1, - y: 1, - color: 1, - fill: 1, - stroke: 1, - strokeWidth: 1, - size: 1, - shape: 1, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - text: 1 - }; - - function isSortByChannel(c) { - return c in SORT_BY_CHANNEL_INDEX; - } - - function isSortByEncoding(sort) { - return !!sort && !!sort['encoding']; - } - - function isSortField(sort) { - return !!sort && (sort['op'] === 'count' || !!sort['field']); - } - - function isSortArray(sort) { - return !!sort && isArray(sort); - } - - function isFacetMapping(f) { - return 'row' in f || 'column' in f; - } - - function isFacetFieldDef(channelDef) { - return !!channelDef && 'header' in channelDef; - } - - function isFacetSpec(spec) { - return 'facet' in spec; - } - - function isConditionalSelection(c) { - return c['selection']; - } - - function isRepeatRef(field) { - return field && !isString(field) && 'repeat' in field; - } - - function toFieldDefBase(fieldDef) { - var field = fieldDef.field, - timeUnit = fieldDef.timeUnit, - bin = fieldDef.bin, - aggregate = fieldDef.aggregate; - return Object.assign(Object.assign(Object.assign(Object.assign({}, timeUnit ? { - timeUnit: timeUnit - } : {}), bin ? { - bin: bin - } : {}), aggregate ? { - aggregate: aggregate - } : {}), { - field: field - }); - } - - function isSortableFieldDef(fieldDef) { - return 'sort' in fieldDef; - } - - function getBand(_ref7) { - var channel = _ref7.channel, - fieldDef = _ref7.fieldDef, - fieldDef2 = _ref7.fieldDef2, - mark = _ref7.markDef, - stack = _ref7.stack, - config = _ref7.config, - isMidPoint = _ref7.isMidPoint; - - if (isFieldOrDatumDef(fieldDef) && fieldDef.band !== undefined) { - return fieldDef.band; - } - - if (isFieldDef(fieldDef)) { - var timeUnit = fieldDef.timeUnit, - bin = fieldDef.bin; - - if (timeUnit && !fieldDef2) { - if (isMidPoint) { - return getMarkConfig('timeUnitBandPosition', mark, config); - } else { - return isRectBasedMark(mark.type) ? getMarkConfig('timeUnitBand', mark, config) : 0; - } - } else if (isBinning(bin)) { - return isRectBasedMark(mark.type) && !isMidPoint ? 1 : 0.5; - } - } - - if ((stack === null || stack === void 0 ? void 0 : stack.fieldChannel) === channel && isMidPoint) { - return 0.5; - } - - return undefined; - } - - function hasBand(channel, fieldDef, fieldDef2, stack, markDef, config) { - if (isBinning(fieldDef.bin) || fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal') { - return !!getBand({ - channel: channel, - fieldDef: fieldDef, - fieldDef2: fieldDef2, - stack: stack, - markDef: markDef, - config: config - }); - } - - return false; - } - - function isConditionalDef(channelDef) { - return !!channelDef && 'condition' in channelDef; - } - /** - * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef - */ - - - function hasConditionalFieldDef(channelDef) { - var condition = channelDef && channelDef['condition']; - return !!condition && !isArray(condition) && isFieldDef(condition); - } - - function hasConditionalFieldOrDatumDef(channelDef) { - var condition = channelDef && channelDef['condition']; - return !!condition && !isArray(condition) && isFieldOrDatumDef(condition); - } - - function hasConditionalValueDef(channelDef) { - var condition = channelDef && channelDef['condition']; - return !!condition && (isArray(condition) || isValueDef(condition)); - } - - function isFieldDef(channelDef) { - // TODO: we can't use field in channelDef here as it's somehow failing runtime test - return !!channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count'); - } - - function channelDefType(channelDef) { - return channelDef && channelDef['type']; - } - - function isDatumDef(channelDef) { - return !!channelDef && 'datum' in channelDef; - } - - function isContinuousFieldOrDatumDef(cd) { - // TODO: make datum support DateTime object - return isTypedFieldDef(cd) && isContinuous(cd) || isNumericDataDef(cd); - } - - function isNumericDataDef(cd) { - return isDatumDef(cd) && isNumber(cd.datum); - } - - function isFieldOrDatumDef(channelDef) { - return isFieldDef(channelDef) || isDatumDef(channelDef); - } - - function isTypedFieldDef(channelDef) { - return !!channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef; - } - - function isValueDef(channelDef) { - return channelDef && 'value' in channelDef && 'value' in channelDef; - } - - function isScaleFieldDef(channelDef) { - return !!channelDef && ('scale' in channelDef || 'sort' in channelDef); - } - - function isPositionFieldOrDatumDef(channelDef) { - return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef); - } - - function isMarkPropFieldOrDatumDef(channelDef) { - return !!channelDef && 'legend' in channelDef; - } - - function isStringFieldOrDatumDef(channelDef) { - return !!channelDef && ('format' in channelDef || 'formatType' in channelDef); - } - - function toStringFieldDef(fieldDef) { - // omit properties that don't exist in string field defs - return omit(fieldDef, ['legend', 'axis', 'header', 'scale']); - } - - function isOpFieldDef(fieldDef) { - return 'op' in fieldDef; - } - /** - * Get a Vega field reference from a Vega-Lite field def. - */ - - - function _vgField(fieldDef) { - var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var _a, _b, _c; - - var field = fieldDef.field; - var prefix = opt.prefix; - var suffix = opt.suffix; - var argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped - - if (isCount(fieldDef)) { - field = internalField('count'); - } else { - var fn; - - if (!opt.nofn) { - if (isOpFieldDef(fieldDef)) { - fn = fieldDef.op; - } else { - var bin = fieldDef.bin, - aggregate = fieldDef.aggregate, - timeUnit = fieldDef.timeUnit; - - if (isBinning(bin)) { - fn = binToString(bin); - suffix = ((_a = opt.binSuffix) !== null && _a !== void 0 ? _a : '') + ((_b = opt.suffix) !== null && _b !== void 0 ? _b : ''); - } else if (aggregate) { - if (isArgmaxDef(aggregate)) { - argAccessor = "[\"".concat(field, "\"]"); - field = "argmax_".concat(aggregate.argmax); - } else if (isArgminDef(aggregate)) { - argAccessor = "[\"".concat(field, "\"]"); - field = "argmin_".concat(aggregate.argmin); - } else { - fn = String(aggregate); - } - } else if (timeUnit) { - fn = timeUnitToString(timeUnit); - suffix = (!contains(['range', 'mid'], opt.binSuffix) && opt.binSuffix || '') + ((_c = opt.suffix) !== null && _c !== void 0 ? _c : ''); - } - } - } - - if (fn) { - field = field ? "".concat(fn, "_").concat(field) : fn; - } - } - - if (suffix) { - field = "".concat(field, "_").concat(suffix); - } - - if (prefix) { - field = "".concat(prefix, "_").concat(field); - } - - if (opt.forAs) { - return removePathFromField(field); - } else if (opt.expr) { - // Expression to access flattened field. No need to escape dots. - return flatAccessWithDatum(field, opt.expr) + argAccessor; - } else { - // We flattened all fields so paths should have become dot. - return replacePathInField(field) + argAccessor; - } - } - - function isDiscrete(def) { - switch (def.type) { - case 'nominal': - case 'ordinal': - case 'geojson': - return true; - - case 'quantitative': - return isFieldDef(def) && !!def.bin; - - case 'temporal': - return false; - } - - throw new Error(invalidFieldType(def.type)); - } - - function isContinuous(fieldDef) { - return !isDiscrete(fieldDef); - } - - function isCount(fieldDef) { - return fieldDef.aggregate === 'count'; - } - - function verbalTitleFormatter(fieldDef, config) { - var _a; - - var field = fieldDef.field, - bin = fieldDef.bin, - timeUnit = fieldDef.timeUnit, - aggregate = fieldDef.aggregate; - - if (aggregate === 'count') { - return config.countTitle; - } else if (isBinning(bin)) { - return "".concat(field, " (binned)"); - } else if (timeUnit) { - var unit = (_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit; - - if (unit) { - return "".concat(field, " (").concat(getTimeUnitParts(unit).join('-'), ")"); - } - } else if (aggregate) { - if (isArgmaxDef(aggregate)) { - return "".concat(field, " for max ").concat(aggregate.argmax); - } else if (isArgminDef(aggregate)) { - return "".concat(field, " for min ").concat(aggregate.argmin); - } else { - return "".concat(titleCase(aggregate), " of ").concat(field); - } - } - - return field; - } - - function functionalTitleFormatter(fieldDef) { - var aggregate = fieldDef.aggregate, - bin = fieldDef.bin, - timeUnit = fieldDef.timeUnit, - field = fieldDef.field; - - if (isArgmaxDef(aggregate)) { - return "".concat(field, " for argmax(").concat(aggregate.argmax, ")"); - } else if (isArgminDef(aggregate)) { - return "".concat(field, " for argmin(").concat(aggregate.argmin, ")"); - } - - var timeUnitParams = normalizeTimeUnit(timeUnit); - var fn = aggregate || (timeUnitParams === null || timeUnitParams === void 0 ? void 0 : timeUnitParams.unit) || (timeUnitParams === null || timeUnitParams === void 0 ? void 0 : timeUnitParams.maxbins) && 'timeunit' || isBinning(bin) && 'bin'; - - if (fn) { - return fn.toUpperCase() + '(' + field + ')'; - } else { - return field; - } - } - - var defaultTitleFormatter = function defaultTitleFormatter(fieldDef, config) { - switch (config.fieldTitle) { - case 'plain': - return fieldDef.field; - - case 'functional': - return functionalTitleFormatter(fieldDef); - - default: - return verbalTitleFormatter(fieldDef, config); - } - }; - - var titleFormatter = defaultTitleFormatter; - - function setTitleFormatter(formatter) { - titleFormatter = formatter; - } - - function resetTitleFormatter() { - setTitleFormatter(defaultTitleFormatter); - } - - function _title3(fieldOrDatumDef, config, _ref8) { - var allowDisabling = _ref8.allowDisabling, - _ref8$includeDefault = _ref8.includeDefault, - includeDefault = _ref8$includeDefault === void 0 ? true : _ref8$includeDefault; - - var _a, _b; - - var guideTitle = (_a = getGuide(fieldOrDatumDef)) === null || _a === void 0 ? void 0 : _a.title; - - if (!isFieldDef(fieldOrDatumDef)) { - return guideTitle; - } - - var fieldDef = fieldOrDatumDef; - var def = includeDefault ? defaultTitle(fieldDef, config) : undefined; - - if (allowDisabling) { - return getFirstDefined(guideTitle, fieldDef.title, def); - } else { - return (_b = guideTitle !== null && guideTitle !== void 0 ? guideTitle : fieldDef.title) !== null && _b !== void 0 ? _b : def; - } - } - - function getGuide(fieldDef) { - if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) { - return fieldDef.axis; - } else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) { - return fieldDef.legend; - } else if (isFacetFieldDef(fieldDef) && fieldDef.header) { - return fieldDef.header; - } - - return undefined; - } - - function defaultTitle(fieldDef, config) { - return titleFormatter(fieldDef, config); - } - - function getFormatMixins(fieldDef) { - var _a; - - if (isStringFieldOrDatumDef(fieldDef)) { - var format = fieldDef.format, - formatType = fieldDef.formatType; - return { - format: format, - formatType: formatType - }; - } else { - var guide = (_a = getGuide(fieldDef)) !== null && _a !== void 0 ? _a : {}; - var _format = guide.format, - _formatType = guide.formatType; - return { - format: _format, - formatType: _formatType - }; - } - } - - function defaultType(fieldDef, channel) { - var _a; - - switch (channel) { - case 'latitude': - case 'longitude': - return 'quantitative'; - - case 'row': - case 'column': - case 'facet': - case 'shape': - case 'strokeDash': - return 'nominal'; - } - - if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) { - return 'ordinal'; - } - - var aggregate = fieldDef.aggregate, - bin = fieldDef.bin, - timeUnit = fieldDef.timeUnit; - - if (timeUnit) { - return 'temporal'; - } - - if (bin || aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) { - return 'quantitative'; - } - - if (isScaleFieldDef(fieldDef) && ((_a = fieldDef.scale) === null || _a === void 0 ? void 0 : _a.type)) { - switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) { - case 'numeric': - case 'discretizing': - return 'quantitative'; - - case 'time': - return 'temporal'; - } - } - - return 'nominal'; - } - /** - * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef. - * @param channelDef - */ - - - function getFieldDef(channelDef) { - if (isFieldDef(channelDef)) { - return channelDef; - } else if (hasConditionalFieldDef(channelDef)) { - return channelDef.condition; - } - - return undefined; - } - - function getFieldOrDatumDef(channelDef) { - if (isFieldOrDatumDef(channelDef)) { - return channelDef; - } else if (hasConditionalFieldOrDatumDef(channelDef)) { - return channelDef.condition; - } - - return undefined; - } - /** - * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. - */ - - - function initChannelDef(channelDef, channel, config) { - var opt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - - if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) { - var primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean'; - warn(primitiveChannelDef(channel, primitiveType, channelDef)); - return { - value: channelDef - }; - } // If a fieldDef contains a field, we need type. - - - if (isFieldOrDatumDef(channelDef)) { - return initFieldOrDatumDef(channelDef, channel, config, opt); - } else if (hasConditionalFieldOrDatumDef(channelDef)) { - return Object.assign(Object.assign({}, channelDef), { - // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition - condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) - }); - } - - return channelDef; - } - - function initFieldOrDatumDef(fd, channel, config, opt) { - if (isStringFieldOrDatumDef(fd)) { - var format = fd.format, - formatType = fd.formatType, - rest = __rest(fd, ["format", "formatType"]); - - if (isCustomFormatType(formatType) && !config.customFormatTypes) { - warn(customFormatTypeNotAllowed(channel)); - return initFieldOrDatumDef(rest, channel, config, opt); - } - } else { - var guideType = isPositionFieldOrDatumDef(fd) ? 'axis' : isMarkPropFieldOrDatumDef(fd) ? 'legend' : isFacetFieldDef(fd) ? 'header' : null; - - if (guideType && fd[guideType]) { - var _a = fd[guideType], - _format2 = _a.format, - _formatType2 = _a.formatType, - newGuide = __rest(_a, ["format", "formatType"]); - - if (isCustomFormatType(_formatType2) && !config.customFormatTypes) { - warn(customFormatTypeNotAllowed(channel)); - return initFieldOrDatumDef(Object.assign(Object.assign({}, fd), _defineProperty({}, guideType, newGuide)), channel, config, opt); - } - } - } - - if (isFieldDef(fd)) { - return initFieldDef(fd, channel, opt); - } - - return initDatumDef(fd); - } - - function initDatumDef(datumDef) { - var type = datumDef['type']; - - if (type) { - return datumDef; - } - - var datum = datumDef.datum; - type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined; - return Object.assign(Object.assign({}, datumDef), { - type: type - }); - } - - function initFieldDef(fd, channel) { - var _ref9 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, - _ref9$compositeMark = _ref9.compositeMark, - compositeMark = _ref9$compositeMark === void 0 ? false : _ref9$compositeMark; - - var aggregate = fd.aggregate, - timeUnit = fd.timeUnit, - bin = fd.bin, - field = fd.field; - var fieldDef = Object.assign({}, fd); // Drop invalid aggregate - - if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) { - warn(invalidAggregate(aggregate)); - delete fieldDef.aggregate; - } // Normalize Time Unit - - - if (timeUnit) { - fieldDef.timeUnit = normalizeTimeUnit(timeUnit); - } - - if (field) { - fieldDef.field = "".concat(field); - } // Normalize bin - - - if (isBinning(bin)) { - fieldDef.bin = normalizeBin(bin, channel); - } - - if (isBinned(bin) && !isXorY(channel)) { - warn(channelShouldNotBeUsedForBinned(channel)); - } // Normalize Type - - - if (isTypedFieldDef(fieldDef)) { - var type = fieldDef.type; - var fullType = getFullName(type); - - if (type !== fullType) { - // convert short type to full type - fieldDef.type = fullType; - } - - if (type !== 'quantitative') { - if (isCountingAggregateOp(aggregate)) { - warn(invalidFieldTypeForCountAggregate(type, aggregate)); - fieldDef.type = 'quantitative'; - } - } - } else if (!isSecondaryRangeChannel(channel)) { - // If type is empty / invalid, then augment with default type - var newType = defaultType(fieldDef, channel); - fieldDef['type'] = newType; - } - - if (isTypedFieldDef(fieldDef)) { - var _ref10 = channelCompatibility(fieldDef, channel) || {}, - compatible = _ref10.compatible, - warning = _ref10.warning; - - if (compatible === false) { - warn(warning); - } - } - - if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) { - var sort = fieldDef.sort; - - if (isSortByChannel(sort)) { - return Object.assign(Object.assign({}, fieldDef), { - sort: { - encoding: sort - } - }); - } - - var sub = sort.substr(1); - - if (sort.charAt(0) === '-' && isSortByChannel(sub)) { - return Object.assign(Object.assign({}, fieldDef), { - sort: { - encoding: sub, - order: 'descending' - } - }); - } - } - - if (isFacetFieldDef(fieldDef)) { - var header = fieldDef.header; - - var _orient = header.orient, - rest = __rest(header, ["orient"]); - - if (_orient) { - return Object.assign(Object.assign({}, fieldDef), { - header: Object.assign(Object.assign({}, rest), { - labelOrient: header.labelOrient || _orient, - titleOrient: header.titleOrient || _orient - }) - }); - } - } - - return fieldDef; - } - - function normalizeBin(bin, channel) { - if (isBoolean(bin)) { - return { - maxbins: autoMaxBins(channel) - }; - } else if (bin === 'binned') { - return { - binned: true - }; - } else if (!bin.maxbins && !bin.step) { - return Object.assign(Object.assign({}, bin), { - maxbins: autoMaxBins(channel) - }); - } else { - return bin; - } - } - - var COMPATIBLE = { - compatible: true - }; - - function channelCompatibility(fieldDef, channel) { - var type = fieldDef.type; - - if (type === 'geojson' && channel !== 'shape') { - return { - compatible: false, - warning: "Channel ".concat(channel, " should not be used with a geojson data.") - }; - } - - switch (channel) { - case ROW: - case COLUMN: - case FACET: - if (isContinuous(fieldDef)) { - return { - compatible: false, - warning: facetChannelShouldBeDiscrete(channel) - }; - } - - return COMPATIBLE; - - case X: - case Y: - case COLOR: - case FILL: - case STROKE: - case TEXT$1: - case DETAIL: - case KEY: - case TOOLTIP: - case HREF: - case URL: - case ANGLE: - case THETA: - case RADIUS: - case DESCRIPTION: - return COMPATIBLE; - - case LONGITUDE: - case LONGITUDE2: - case LATITUDE: - case LATITUDE2: - if (type !== QUANTITATIVE) { - return { - compatible: false, - warning: "Channel ".concat(channel, " should be used with a quantitative field only, not ").concat(fieldDef.type, " field.") - }; - } - - return COMPATIBLE; - - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEWIDTH: - case SIZE: - case THETA2: - case RADIUS2: - case X2: - case Y2: - if (type === 'nominal' && !fieldDef['sort']) { - return { - compatible: false, - warning: "Channel ".concat(channel, " should not be used with an unsorted discrete field.") - }; - } - - return COMPATIBLE; - - case STROKEDASH: - if (!contains(['ordinal', 'nominal'], fieldDef.type)) { - return { - compatible: false, - warning: 'StrokeDash channel should be used with only discrete data.' - }; - } - - return COMPATIBLE; - - case SHAPE: - if (!contains(['ordinal', 'nominal', 'geojson'], fieldDef.type)) { - return { - compatible: false, - warning: 'Shape channel should be used with only either discrete or geojson data.' - }; - } - - return COMPATIBLE; - - case ORDER: - if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) { - return { - compatible: false, - warning: "Channel order is inappropriate for nominal field, which has no inherent order." - }; - } - - return COMPATIBLE; - } - } - /** - * Check if the field def uses a time format or does not use any format but is temporal - * (this does not cover field defs that are temporal but use a number format). - */ - - - function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) { - var _getFormatMixins = getFormatMixins(fieldOrDatumDef), - formatType = _getFormatMixins.formatType; - - return formatType === 'time' || !formatType && isTimeFieldDef(fieldOrDatumDef); - } - /** - * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`. - */ - - - function isTimeFieldDef(def) { - return def && (def['type'] === 'temporal' || isFieldDef(def) && !!def.timeUnit); - } - /** - * Getting a value associated with a fielddef. - * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit) - */ - - - function valueExpr(v, _ref11) { - var timeUnit = _ref11.timeUnit, - type = _ref11.type, - wrapTime = _ref11.wrapTime, - undefinedIfExprNotRequired = _ref11.undefinedIfExprNotRequired; - - var _a; - - var unit = timeUnit && ((_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit); - var isTime = unit || type === 'temporal'; - var expr; - - if (isSignalRef(v)) { - expr = v.signal; - } else if (isDateTime(v)) { - isTime = true; - expr = dateTimeToExpr(v); - } else if (isString(v) || isNumber(v)) { - if (isTime) { - expr = "datetime(".concat(JSON.stringify(v), ")"); - - if (isLocalSingleTimeUnit(unit)) { - // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit - if (isNumber(v) && v < 10000 || isString(v) && isNaN(Date.parse(v))) { - expr = dateTimeToExpr(_defineProperty({}, unit, v)); - } - } - } - } - - if (expr) { - return wrapTime && isTime ? "time(".concat(expr, ")") : expr; - } // number or boolean or normal string - - - return undefinedIfExprNotRequired ? undefined : JSON.stringify(v); - } - /** - * Standardize value array -- convert each value to Vega expression if applicable - */ - - - function valueArray(fieldOrDatumDef, values) { - var type = fieldOrDatumDef.type; - return values.map(function (v) { - var expr = valueExpr(v, { - timeUnit: isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.timeUnit : undefined, - type: type, - undefinedIfExprNotRequired: true - }); // return signal for the expression if we need an expression - - if (expr !== undefined) { - return { - signal: expr - }; - } // otherwise just return the original value - - - return v; - }); - } - /** - * Checks whether a fieldDef for a particular channel requires a computed bin range. - */ - - - function binRequiresRange(fieldDef, channel) { - if (!isBinning(fieldDef.bin)) { - console.warn('Only call this method for binned field defs.'); - return false; - } // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels. - // We could check whether the axis or legend exists (not disabled) but that seems overkill. - - - return isScaleChannel(channel) && contains(['ordinal', 'nominal'], fieldDef.type); - } - - function extractTitleConfig(titleConfig) { - var anchor = titleConfig.anchor, - frame = titleConfig.frame, - offset = titleConfig.offset, - orient = titleConfig.orient, - color = titleConfig.color, - subtitleColor = titleConfig.subtitleColor, - subtitleFont = titleConfig.subtitleFont, - subtitleFontSize = titleConfig.subtitleFontSize, - subtitleFontStyle = titleConfig.subtitleFontStyle, - subtitleFontWeight = titleConfig.subtitleFontWeight, - subtitleLineHeight = titleConfig.subtitleLineHeight, - subtitlePadding = titleConfig.subtitlePadding, - rest = __rest(titleConfig, ["anchor", "frame", "offset", "orient", "color", "subtitleColor", "subtitleFont", "subtitleFontSize", "subtitleFontStyle", "subtitleFontWeight", "subtitleLineHeight", "subtitlePadding"]); - - var titleMarkConfig = Object.assign(Object.assign({}, rest), color ? { - fill: color - } : {}); // These are non-mark title config that need to be hardcoded - - var nonMark = Object.assign(Object.assign(Object.assign(Object.assign({}, anchor ? { - anchor: anchor - } : {}), frame ? { - frame: frame - } : {}), offset ? { - offset: offset - } : {}), orient ? { - orient: orient - } : {}); // subtitle part can stay in config.title since header titles do not use subtitle - - var subtitle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, subtitleColor ? { - subtitleColor: subtitleColor - } : {}), subtitleFont ? { - subtitleFont: subtitleFont - } : {}), subtitleFontSize ? { - subtitleFontSize: subtitleFontSize - } : {}), subtitleFontStyle ? { - subtitleFontStyle: subtitleFontStyle - } : {}), subtitleFontWeight ? { - subtitleFontWeight: subtitleFontWeight - } : {}), subtitleLineHeight ? { - subtitleLineHeight: subtitleLineHeight - } : {}), subtitlePadding ? { - subtitlePadding: subtitlePadding - } : {}); - var subtitleMarkConfig = pick(titleMarkConfig, ['align', 'baseline', 'dx', 'dy', 'limit']); - return { - titleMarkConfig: titleMarkConfig, - subtitleMarkConfig: subtitleMarkConfig, - nonMark: nonMark, - subtitle: subtitle - }; - } - - function isText(v) { - return isString(v) || isArray(v) && isString(v[0]); - } - - function signalOrValueRef(value) { - if (isSignalRef(value)) { - return value; - } - - return value !== undefined ? { - value: value - } : undefined; - } - - function exprFromValueOrSignalRef(ref) { - if (isSignalRef(ref)) { - return ref.signal; - } - - return $(ref.value); - } - - function signalOrStringValue(v) { - if (isSignalRef(v)) { - return v.signal; - } - - return v == null ? null : $(v); - } - - function applyMarkConfig(e, model, propsList) { - var _iterator16 = _createForOfIteratorHelper(propsList), - _step16; - - try { - for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) { - var property = _step16.value; - var value = getMarkConfig(property, model.markDef, model.config); - - if (value !== undefined) { - e[property] = signalOrValueRef(value); - } - } - } catch (err) { - _iterator16.e(err); - } finally { - _iterator16.f(); - } - - return e; - } - - function getStyles(mark) { - var _a; - - return [].concat(mark.type, (_a = mark.style) !== null && _a !== void 0 ? _a : []); - } - - function getMarkPropOrConfig(channel, mark, config) { - var opt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var vgChannel = opt.vgChannel, - ignoreVgConfig = opt.ignoreVgConfig; - - if (vgChannel && mark[vgChannel] !== undefined) { - return mark[vgChannel]; - } else if (mark[channel] !== undefined) { - return mark[channel]; - } else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) { - return undefined; - } - - return getMarkConfig(channel, mark, config, opt); - } - /** - * Return property value from style or mark specific config property if exists. - * Otherwise, return general mark specific config. - */ - - - function getMarkConfig(channel, mark, config) { - var _ref12 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, - vgChannel = _ref12.vgChannel; - - return getFirstDefined( // style config has highest precedence - vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined, getMarkStyleConfig(channel, mark, config.style), // then mark-specific config - vgChannel ? config[mark.type][vgChannel] : undefined, config[mark.type][channel], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine - // If there is vgChannel, skip vl channel. - // For example, vl size for text is vg fontSize, but config.mark.size is only for point size. - vgChannel ? config.mark[vgChannel] : config.mark[channel] // Need to cast for the same reason as above - ); - } - - function getMarkStyleConfig(prop, mark, styleConfigIndex) { - return getStyleConfig(prop, getStyles(mark), styleConfigIndex); - } - - function getStyleConfig(p, styles, styleConfigIndex) { - styles = array(styles); - var value; - - var _iterator17 = _createForOfIteratorHelper(styles), - _step17; - - try { - for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) { - var style = _step17.value; - var styleConfig = styleConfigIndex[style]; - - if (styleConfig && styleConfig[p] !== undefined) { - value = styleConfig[p]; - } - } - } catch (err) { - _iterator17.e(err); - } finally { - _iterator17.f(); - } - - return value; - } - /** - * Return Vega sort parameters (tuple of field and order). - */ - - - function sortParams(orderDef, fieldRefOption) { - return array(orderDef).reduce(function (s, orderChannelDef) { - var _a; - - s.field.push(_vgField(orderChannelDef, fieldRefOption)); - s.order.push((_a = orderChannelDef.sort) !== null && _a !== void 0 ? _a : 'ascending'); - return s; - }, { - field: [], - order: [] - }); - } - - function mergeTitleFieldDefs(f1, f2) { - var merged = _toConsumableArray(f1); - - f2.forEach(function (fdToMerge) { - var _iterator18 = _createForOfIteratorHelper(merged), - _step18; - - try { - for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) { - var fieldDef1 = _step18.value; - - // If already exists, no need to append to merged array - if (deepEqual(fieldDef1, fdToMerge)) { - return; - } - } - } catch (err) { - _iterator18.e(err); - } finally { - _iterator18.f(); - } - - merged.push(fdToMerge); - }); - return merged; - } - - function mergeTitle(title1, title2) { - if (deepEqual(title1, title2) || !title2) { - // if titles are the same or title2 is falsy - return title1; - } else if (!title1) { - // if title1 is falsy - return title2; - } else { - return [].concat(_toConsumableArray(array(title1)), _toConsumableArray(array(title2))).join(', '); - } - } - - function mergeTitleComponent(v1, v2) { - var v1Val = v1.value; - var v2Val = v2.value; - - if (v1Val == null || v2Val === null) { - return { - explicit: v1.explicit, - value: null - }; - } else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) { - return { - explicit: v1.explicit, - value: mergeTitle(v1Val, v2Val) - }; - } else if (isText(v1Val) || isSignalRef(v1Val)) { - return { - explicit: v1.explicit, - value: v1Val - }; - } else if (isText(v2Val) || isSignalRef(v2Val)) { - return { - explicit: v1.explicit, - value: v2Val - }; - } else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) { - return { - explicit: v1.explicit, - value: mergeTitleFieldDefs(v1Val, v2Val) - }; - } - /* istanbul ignore next: Condition should not happen -- only for warning in development. */ - - - throw new Error('It should never reach here'); - } - - function _channelHasField(encoding, channel) { - var channelDef = encoding && encoding[channel]; - - if (channelDef) { - if (isArray(channelDef)) { - return some(channelDef, function (fieldDef) { - return !!fieldDef.field; - }); - } else { - return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef); - } - } - - return false; - } - - function isAggregate(encoding) { - return some(CHANNELS, function (channel) { - if (_channelHasField(encoding, channel)) { - var channelDef = encoding[channel]; - - if (isArray(channelDef)) { - return some(channelDef, function (fieldDef) { - return !!fieldDef.aggregate; - }); - } else { - var fieldDef = getFieldDef(channelDef); - return fieldDef && !!fieldDef.aggregate; - } - } - - return false; - }); - } - - function extractTransformsFromEncoding(oldEncoding, config) { - var groupby = []; - var bins = []; - var timeUnits = []; - var aggregate = []; - var encoding = {}; - forEach(oldEncoding, function (channelDef, channel) { - // Extract potential embedded transformations along with remaining properties - if (isFieldDef(channelDef)) { - var _field2 = channelDef.field, - aggOp = channelDef.aggregate, - bin = channelDef.bin, - timeUnit = channelDef.timeUnit, - remaining = __rest(channelDef, ["field", "aggregate", "bin", "timeUnit"]); - - if (aggOp || timeUnit || bin) { - var guide = getGuide(channelDef); - var isTitleDefined = guide && guide.title; - - var newField = _vgField(channelDef, { - forAs: true - }); - - var newFieldDef = Object.assign(Object.assign(Object.assign({}, isTitleDefined ? [] : { - title: _title3(channelDef, config, { - allowDisabling: true - }) - }), remaining), { - // Always overwrite field - field: newField - }); - - if (aggOp) { - var op; - - if (isArgmaxDef(aggOp)) { - op = 'argmax'; - newField = _vgField({ - op: 'argmax', - field: aggOp.argmax - }, { - forAs: true - }); - newFieldDef.field = "".concat(newField, ".").concat(_field2); - } else if (isArgminDef(aggOp)) { - op = 'argmin'; - newField = _vgField({ - op: 'argmin', - field: aggOp.argmin - }, { - forAs: true - }); - newFieldDef.field = "".concat(newField, ".").concat(_field2); - } else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') { - op = aggOp; - } - - if (op) { - var aggregateEntry = { - op: op, - as: newField - }; - - if (_field2) { - aggregateEntry.field = _field2; - } - - aggregate.push(aggregateEntry); - } - } else { - groupby.push(newField); - - if (isTypedFieldDef(channelDef) && isBinning(bin)) { - bins.push({ - bin: bin, - field: _field2, - as: newField - }); // Add additional groupbys for range and end of bins - - groupby.push(_vgField(channelDef, { - binSuffix: 'end' - })); - - if (binRequiresRange(channelDef, channel)) { - groupby.push(_vgField(channelDef, { - binSuffix: 'range' - })); - } // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively - - - if (isXorY(channel)) { - var secondaryChannel = { - field: newField + '_end' - }; - encoding[channel + '2'] = secondaryChannel; - } - - newFieldDef.bin = 'binned'; - - if (!isSecondaryRangeChannel(channel)) { - newFieldDef['type'] = QUANTITATIVE; - } - } else if (timeUnit) { - timeUnits.push({ - timeUnit: timeUnit, - field: _field2, - as: newField - }); // define the format type for later compilation - - var formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time'; - - if (formatType) { - if (channel === TEXT$1 || channel === TOOLTIP) { - newFieldDef['formatType'] = formatType; - } else if (isNonPositionScaleChannel(channel)) { - newFieldDef['legend'] = Object.assign({ - formatType: formatType - }, newFieldDef['legend']); - } else if (isXorY(channel)) { - newFieldDef['axis'] = Object.assign({ - formatType: formatType - }, newFieldDef['axis']); - } - } - } - } // now the field should refer to post-transformed field instead - - - encoding[channel] = newFieldDef; - } else { - groupby.push(_field2); - encoding[channel] = oldEncoding[channel]; - } - } else { - // For value def / signal ref / datum def, just copy - encoding[channel] = oldEncoding[channel]; - } - }); - return { - bins: bins, - timeUnits: timeUnits, - aggregate: aggregate, - groupby: groupby, - encoding: encoding - }; - } - - function markChannelCompatible(encoding, channel, mark) { - var markSupported = supportMark(channel, mark); - - if (!markSupported) { - return false; - } else if (markSupported === 'binned') { - var primaryFieldDef = encoding[channel === X2 ? X : Y]; // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef - // has "binned" data and thus need x2/y2 to specify the bin-end field. - - if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) { - return true; - } else { - return false; - } - } - - return true; - } - - function initEncoding(encoding, mark, filled, config) { - return keys(encoding).reduce(function (normalizedEncoding, channel) { - if (!isChannel(channel)) { - // Drop invalid channel - warn(invalidEncodingChannel(channel)); - return normalizedEncoding; - } - - var channelDef = encoding[channel]; - - if (channel === 'angle' && mark === 'arc' && !encoding.theta) { - warn(REPLACE_ANGLE_WITH_THETA); - channel = THETA; - } - - if (!markChannelCompatible(encoding, channel, mark)) { - // Drop unsupported channel - warn(incompatibleChannel(channel, mark)); - return normalizedEncoding; - } // Drop line's size if the field is aggregated. - - - if (channel === SIZE && mark === 'line') { - var fieldDef = getFieldDef(encoding[channel]); - - if (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.aggregate) { - warn(LINE_WITH_VARYING_SIZE); - return normalizedEncoding; - } - } // Drop color if either fill or stroke is specified - - - if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) { - warn(droppingColor('encoding', { - fill: 'fill' in encoding, - stroke: 'stroke' in encoding - })); - return normalizedEncoding; - } - - if (channel === DETAIL || channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef) || channel === TOOLTIP && isArray(channelDef)) { - if (channelDef) { - // Array of fieldDefs for detail channel (or production rule) - normalizedEncoding[channel] = array(channelDef).reduce(function (defs, fieldDef) { - if (!isFieldDef(fieldDef)) { - warn(emptyFieldDef(fieldDef, channel)); - } else { - defs.push(initFieldDef(fieldDef, channel)); - } - - return defs; - }, []); - } - } else { - if (channel === TOOLTIP && channelDef === null) { - // Preserve null so we can use it to disable tooltip - normalizedEncoding[channel] = null; - } else if (!isFieldDef(channelDef) && !isDatumDef(channelDef) && !isValueDef(channelDef) && !isConditionalDef(channelDef) && !isSignalRef(channelDef)) { - warn(emptyFieldDef(channelDef, channel)); - return normalizedEncoding; - } - - normalizedEncoding[channel] = initChannelDef(channelDef, channel, config); - } - - return normalizedEncoding; - }, {}); - } - /** - * For composite marks, we have to call initChannelDef during init so we can infer types earlier. - */ - - - function normalizeEncoding(encoding, config) { - return keys(encoding).reduce(function (normalizedEncoding, channel) { - var newChannelDef = initChannelDef(encoding[channel], channel, config, { - compositeMark: true - }); - normalizedEncoding[channel] = newChannelDef; - return normalizedEncoding; - }, {}); - } - - function fieldDefs(encoding) { - var arr = []; - - var _iterator19 = _createForOfIteratorHelper(keys(encoding)), - _step19; - - try { - for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) { - var channel = _step19.value; - - if (_channelHasField(encoding, channel)) { - var channelDef = encoding[channel]; - var channelDefArray = array(channelDef); - - var _iterator20 = _createForOfIteratorHelper(channelDefArray), - _step20; - - try { - for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) { - var def = _step20.value; - - if (isFieldDef(def)) { - arr.push(def); - } else if (hasConditionalFieldDef(def)) { - arr.push(def.condition); - } - } - } catch (err) { - _iterator20.e(err); - } finally { - _iterator20.f(); - } - } - } - } catch (err) { - _iterator19.e(err); - } finally { - _iterator19.f(); - } - - return arr; - } - - function forEach(mapping, f, thisArg) { - if (!mapping) { - return; - } - - var _iterator21 = _createForOfIteratorHelper(keys(mapping)), - _step21; - - try { - for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) { - var channel = _step21.value; - var el = mapping[channel]; - - if (isArray(el)) { - var _iterator22 = _createForOfIteratorHelper(el), - _step22; - - try { - for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) { - var channelDef = _step22.value; - f.call(thisArg, channelDef, channel); - } - } catch (err) { - _iterator22.e(err); - } finally { - _iterator22.f(); - } - } else { - f.call(thisArg, el, channel); - } - } - } catch (err) { - _iterator21.e(err); - } finally { - _iterator21.f(); - } - } - - function reduce(mapping, f, init, thisArg) { - if (!mapping) { - return init; - } - - return keys(mapping).reduce(function (r, channel) { - var map = mapping[channel]; - - if (isArray(map)) { - return map.reduce(function (r1, channelDef) { - return f.call(thisArg, r1, channelDef, channel); - }, r); - } else { - return f.call(thisArg, r, map, channel); - } - }, init); - } - /** - * Returns list of path grouping fields for the given encoding - */ - - - function pathGroupingFields(mark, encoding) { - return keys(encoding).reduce(function (details, channel) { - switch (channel) { - // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group - case X: - case Y: - case HREF: - case DESCRIPTION: - case URL: - case X2: - case Y2: - case THETA: - case THETA2: - case RADIUS: - case RADIUS2: // falls through - - case LATITUDE: - case LONGITUDE: - case LATITUDE2: - case LONGITUDE2: // TODO: case 'cursor': - // text, shape, shouldn't be a part of line/trail/area [falls through] - - case TEXT$1: - case SHAPE: - case ANGLE: // falls through - // tooltip fields should not be added to group by [falls through] - - case TOOLTIP: - return details; - - case ORDER: - // order should not group line / trail - if (mark === 'line' || mark === 'trail') { - return details; - } - - // but order should group area for stacking (falls through) - - case DETAIL: - case KEY: - { - var channelDef = encoding[channel]; - - if (isArray(channelDef) || isFieldDef(channelDef)) { - var _iterator23 = _createForOfIteratorHelper(array(channelDef)), - _step23; - - try { - for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) { - var fieldDef = _step23.value; - - if (!fieldDef.aggregate) { - details.push(_vgField(fieldDef, {})); - } - } - } catch (err) { - _iterator23.e(err); - } finally { - _iterator23.f(); - } - } - - return details; - } - - case SIZE: - if (mark === 'trail') { - // For trail, size should not group trail lines. - return details; - } - - // For line, size should group lines. - // falls through - - case COLOR: - case FILL: - case STROKE: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEDASH: - case STROKEWIDTH: - { - // TODO strokeDashOffset: - // falls through - var _fieldDef = getFieldDef(encoding[channel]); - - if (_fieldDef && !_fieldDef.aggregate) { - details.push(_vgField(_fieldDef, {})); - } - - return details; - } - } - }, []); - } - - function filterTooltipWithAggregatedField(oldEncoding) { - var tooltip = oldEncoding.tooltip, - filteredEncoding = __rest(oldEncoding, ["tooltip"]); - - if (!tooltip) { - return { - filteredEncoding: filteredEncoding - }; - } - - var customTooltipWithAggregatedField; - var customTooltipWithoutAggregatedField; - - if (isArray(tooltip)) { - var _iterator24 = _createForOfIteratorHelper(tooltip), - _step24; - - try { - for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) { - var t = _step24.value; - - if (t.aggregate) { - if (!customTooltipWithAggregatedField) { - customTooltipWithAggregatedField = []; - } - - customTooltipWithAggregatedField.push(t); - } else { - if (!customTooltipWithoutAggregatedField) { - customTooltipWithoutAggregatedField = []; - } - - customTooltipWithoutAggregatedField.push(t); - } - } - } catch (err) { - _iterator24.e(err); - } finally { - _iterator24.f(); - } - - if (customTooltipWithAggregatedField) { - filteredEncoding.tooltip = customTooltipWithAggregatedField; - } - } else { - if (tooltip['aggregate']) { - filteredEncoding.tooltip = tooltip; - } else { - customTooltipWithoutAggregatedField = tooltip; - } - } - - if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) { - customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0]; - } - - return { - customTooltipWithoutAggregatedField: customTooltipWithoutAggregatedField, - filteredEncoding: filteredEncoding - }; - } - - function getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis) { - var withFieldName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; - - if ('tooltip' in encodingWithoutContinuousAxis) { - return { - tooltip: encodingWithoutContinuousAxis.tooltip - }; - } - - var fiveSummaryTooltip = tooltipSummary.map(function (_ref13) { - var fieldPrefix = _ref13.fieldPrefix, - titlePrefix = _ref13.titlePrefix; - var mainTitle = withFieldName ? " of ".concat(getTitle(continuousAxisChannelDef)) : ''; - return { - field: fieldPrefix + continuousAxisChannelDef.field, - type: continuousAxisChannelDef.type, - title: isSignalRef(titlePrefix) ? { - signal: titlePrefix + "\"".concat(escape(mainTitle), "\"") - } : titlePrefix + mainTitle - }; - }); - var tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef); - return { - tooltip: [].concat(_toConsumableArray(fiveSummaryTooltip), _toConsumableArray(unique(tooltipFieldDefs, _hash))) - }; - } - - function getTitle(continuousAxisChannelDef) { - var title = continuousAxisChannelDef.title, - field = continuousAxisChannelDef.field; - return getFirstDefined(title, field); - } - - function makeCompositeAggregatePartFactory(compositeMarkDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, compositeMarkConfig) { - var scale = continuousAxisChannelDef.scale, - axis = continuousAxisChannelDef.axis; - return function (_ref14) { - var partName = _ref14.partName, - mark = _ref14.mark, - positionPrefix = _ref14.positionPrefix, - _ref14$endPositionPre = _ref14.endPositionPrefix, - endPositionPrefix = _ref14$endPositionPre === void 0 ? undefined : _ref14$endPositionPre, - _ref14$extraEncoding = _ref14.extraEncoding, - extraEncoding = _ref14$extraEncoding === void 0 ? {} : _ref14$extraEncoding; - var title = getTitle(continuousAxisChannelDef); - return partLayerMixins(compositeMarkDef, partName, compositeMarkConfig, { - mark: mark, - encoding: Object.assign(Object.assign(Object.assign(_defineProperty({}, continuousAxis, Object.assign(Object.assign(Object.assign({ - field: positionPrefix + '_' + continuousAxisChannelDef.field, - type: continuousAxisChannelDef.type - }, title !== undefined ? { - title: title - } : {}), scale !== undefined ? { - scale: scale - } : {}), axis !== undefined ? { - axis: axis - } : {})), isString(endPositionPrefix) ? _defineProperty({}, continuousAxis + '2', { - field: endPositionPrefix + '_' + continuousAxisChannelDef.field - }) : {}), sharedEncoding), extraEncoding) - }); - }; - } - - function partLayerMixins(markDef, part, compositeMarkConfig, partBaseSpec) { - var clip = markDef.clip, - color = markDef.color, - opacity = markDef.opacity; - var mark = markDef.type; - - if (markDef[part] || markDef[part] === undefined && compositeMarkConfig[part]) { - return [Object.assign(Object.assign({}, partBaseSpec), { - mark: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, compositeMarkConfig[part]), clip ? { - clip: clip - } : {}), color ? { - color: color - } : {}), opacity ? { - opacity: opacity - } : {}), isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : { - type: partBaseSpec.mark - }), { - style: "".concat(mark, "-").concat(part) - }), isBoolean(markDef[part]) ? {} : markDef[part]) - })]; - } - - return []; - } - - function compositeMarkContinuousAxis(spec, orient, compositeMark) { - var encoding = spec.encoding; - var continuousAxis = orient === 'vertical' ? 'y' : 'x'; - var continuousAxisChannelDef = encoding[continuousAxis]; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal. - - var continuousAxisChannelDef2 = encoding[continuousAxis + '2']; - var continuousAxisChannelDefError = encoding[continuousAxis + 'Error']; - var continuousAxisChannelDefError2 = encoding[continuousAxis + 'Error2']; - return { - continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark), - continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark), - continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark), - continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark), - continuousAxis: continuousAxis - }; - } - - function filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark) { - if (continuousAxisChannelDef && continuousAxisChannelDef.aggregate) { - var aggregate = continuousAxisChannelDef.aggregate, - continuousAxisWithoutAggregate = __rest(continuousAxisChannelDef, ["aggregate"]); - - if (aggregate !== compositeMark) { - warn(errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark)); - } - - return continuousAxisWithoutAggregate; - } else { - return continuousAxisChannelDef; - } - } - - function compositeMarkOrient(spec, compositeMark) { - var mark = spec.mark, - encoding = spec.encoding; - var x = encoding.x, - y = encoding.y; - - if (isMarkDef(mark) && mark.orient) { - return mark.orient; - } - - if (isContinuousFieldOrDatumDef(x)) { - // x is continuous - if (isContinuousFieldOrDatumDef(y)) { - // both x and y are continuous - var xAggregate = isFieldDef(x) && x.aggregate; - var yAggregate = isFieldDef(y) && y.aggregate; - - if (!xAggregate && yAggregate === compositeMark) { - return 'vertical'; - } else if (!yAggregate && xAggregate === compositeMark) { - return 'horizontal'; - } else if (xAggregate === compositeMark && yAggregate === compositeMark) { - throw new Error('Both x and y cannot have aggregate'); - } else { - if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) { - // y is temporal but x is not - return 'horizontal'; - } // default orientation for two continuous - - - return 'vertical'; - } - } - - return 'horizontal'; - } else if (isContinuousFieldOrDatumDef(y)) { - // y is continuous but x is not - return 'vertical'; - } else { - // Neither x nor y is continuous. - throw new Error("Need a valid continuous axis for ".concat(compositeMark, "s")); - } - } - - var BOXPLOT = 'boxplot'; - var BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks']; - var boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot); - - function getBoxPlotType(extent) { - if (isNumber(extent)) { - return 'tukey'; - } // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now. - - - return extent; - } - - function normalizeBoxPlot(spec, _ref16) { - var config = _ref16.config; - - var _a, _b; // Need to initEncoding first so we can infer type - - - spec = Object.assign(Object.assign({}, spec), { - encoding: normalizeEncoding(spec.encoding, config) - }); - - var _spec = spec, - mark = _spec.mark, - _encoding = _spec.encoding, - selection = _spec.selection, - _p = _spec.projection, - outerSpec = __rest(spec, ["mark", "encoding", "selection", "projection"]); - - var markDef = isMarkDef(mark) ? mark : { - type: mark - }; // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - - if (selection) { - warn(selectionNotSupported('boxplot')); - } - - var extent = (_a = markDef.extent) !== null && _a !== void 0 ? _a : config.boxplot.extent; - var sizeValue = getMarkPropOrConfig('size', markDef, // TODO: https://github.com/vega/vega-lite/issues/6245 - config); - var boxPlotType = getBoxPlotType(extent); - - var _boxParams = boxParams(spec, extent, config), - transform = _boxParams.transform, - continuousAxisChannelDef = _boxParams.continuousAxisChannelDef, - continuousAxis = _boxParams.continuousAxis, - groupby = _boxParams.groupby, - aggregate = _boxParams.aggregate, - encodingWithoutContinuousAxis = _boxParams.encodingWithoutContinuousAxis, - ticksOrient = _boxParams.ticksOrient, - boxOrient = _boxParams.boxOrient, - customTooltipWithoutAggregatedField = _boxParams.customTooltipWithoutAggregatedField; - - var color = encodingWithoutContinuousAxis.color, - size = encodingWithoutContinuousAxis.size, - encodingWithoutSizeColorAndContinuousAxis = __rest(encodingWithoutContinuousAxis, ["color", "size"]); - - var makeBoxPlotPart = function makeBoxPlotPart(sharedEncoding) { - return makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, config.boxplot); - }; - - var makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis); - var makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis); - var makeBoxPlotMidTick = makeBoxPlotPart(Object.assign(Object.assign({}, encodingWithoutSizeColorAndContinuousAxis), size ? { - size: size - } : {})); - var fiveSummaryTooltipEncoding = getCompositeMarkTooltip([{ - fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', - titlePrefix: 'Max' - }, { - fieldPrefix: 'upper_box_', - titlePrefix: 'Q3' - }, { - fieldPrefix: 'mid_box_', - titlePrefix: 'Median' - }, { - fieldPrefix: 'lower_box_', - titlePrefix: 'Q1' - }, { - fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', - titlePrefix: 'Min' - }], continuousAxisChannelDef, encodingWithoutContinuousAxis); // ## Whisker Layers - - var endTick = { - type: 'tick', - color: 'black', - opacity: 1, - orient: ticksOrient, - invalid: null, - aria: false - }; - var whiskerTooltipEncoding = boxPlotType === 'min-max' ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker - : // for tukey / k-IQR, just show upper/lower-whisker - getCompositeMarkTooltip([{ - fieldPrefix: 'upper_whisker_', - titlePrefix: 'Upper Whisker' - }, { - fieldPrefix: 'lower_whisker_', - titlePrefix: 'Lower Whisker' - }], continuousAxisChannelDef, encodingWithoutContinuousAxis); - var whiskerLayers = [].concat(_toConsumableArray(makeBoxPlotExtent({ - partName: 'rule', - mark: { - type: 'rule', - invalid: null, - aria: false - }, - positionPrefix: 'lower_whisker', - endPositionPrefix: 'lower_box', - extraEncoding: whiskerTooltipEncoding - })), _toConsumableArray(makeBoxPlotExtent({ - partName: 'rule', - mark: { - type: 'rule', - invalid: null, - aria: false - }, - positionPrefix: 'upper_box', - endPositionPrefix: 'upper_whisker', - extraEncoding: whiskerTooltipEncoding - })), _toConsumableArray(makeBoxPlotExtent({ - partName: 'ticks', - mark: endTick, - positionPrefix: 'lower_whisker', - extraEncoding: whiskerTooltipEncoding - })), _toConsumableArray(makeBoxPlotExtent({ - partName: 'ticks', - mark: endTick, - positionPrefix: 'upper_whisker', - extraEncoding: whiskerTooltipEncoding - }))); // ## Box Layers - // TODO: support hiding certain mark parts - - var boxLayers = [].concat(_toConsumableArray(boxPlotType !== 'tukey' ? whiskerLayers : []), _toConsumableArray(makeBoxPlotBox({ - partName: 'box', - mark: Object.assign(Object.assign({ - type: 'bar' - }, sizeValue ? { - size: sizeValue - } : {}), { - orient: boxOrient, - invalid: null, - ariaRoleDescription: 'box' - }), - positionPrefix: 'lower_box', - endPositionPrefix: 'upper_box', - extraEncoding: fiveSummaryTooltipEncoding - })), _toConsumableArray(makeBoxPlotMidTick({ - partName: 'median', - mark: Object.assign(Object.assign(Object.assign({ - type: 'tick', - invalid: null - }, isObject(config.boxplot.median) && config.boxplot.median.color ? { - color: config.boxplot.median.color - } : {}), sizeValue ? { - size: sizeValue - } : {}), { - orient: ticksOrient, - aria: false - }), - positionPrefix: 'mid_box', - extraEncoding: fiveSummaryTooltipEncoding - }))); // ## Filtered Layers - - var filteredLayersMixins; - - if (boxPlotType !== 'min-max') { - var lowerBoxExpr = "datum[\"lower_box_".concat(continuousAxisChannelDef.field, "\"]"); - var upperBoxExpr = "datum[\"upper_box_".concat(continuousAxisChannelDef.field, "\"]"); - var iqrExpr = "(".concat(upperBoxExpr, " - ").concat(lowerBoxExpr, ")"); - var lowerWhiskerExpr = "".concat(lowerBoxExpr, " - ").concat(extent, " * ").concat(iqrExpr); - var upperWhiskerExpr = "".concat(upperBoxExpr, " + ").concat(extent, " * ").concat(iqrExpr); - - var _fieldExpr = "datum[\"".concat(continuousAxisChannelDef.field, "\"]"); - - var joinaggregateTransform = { - joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field), - groupby: groupby - }; - var filteredWhiskerSpec = undefined; - - if (boxPlotType === 'tukey') { - filteredWhiskerSpec = { - transform: [{ - filter: "(".concat(lowerWhiskerExpr, " <= ").concat(_fieldExpr, ") && (").concat(_fieldExpr, " <= ").concat(upperWhiskerExpr, ")") - }, { - aggregate: [{ - op: 'min', - field: continuousAxisChannelDef.field, - as: 'lower_whisker_' + continuousAxisChannelDef.field - }, { - op: 'max', - field: continuousAxisChannelDef.field, - as: 'upper_whisker_' + continuousAxisChannelDef.field - }, // preserve lower_box / upper_box - { - op: 'min', - field: 'lower_box_' + continuousAxisChannelDef.field, - as: 'lower_box_' + continuousAxisChannelDef.field - }, { - op: 'max', - field: 'upper_box_' + continuousAxisChannelDef.field, - as: 'upper_box_' + continuousAxisChannelDef.field - }].concat(_toConsumableArray(aggregate)), - groupby: groupby - }], - layer: whiskerLayers - }; - } - - var encodingWithoutSizeColorContinuousAxisAndTooltip = __rest(encodingWithoutSizeColorAndContinuousAxis, ["tooltip"]); - - var scale = continuousAxisChannelDef.scale, - axis = continuousAxisChannelDef.axis; - - var _title = getTitle(continuousAxisChannelDef); - - var axisWithoutTitle = omit(axis, ['title']); - var outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, { - transform: [{ - filter: "(".concat(_fieldExpr, " < ").concat(lowerWhiskerExpr, ") || (").concat(_fieldExpr, " > ").concat(upperWhiskerExpr, ")") - }], - mark: 'point', - encoding: Object.assign(Object.assign(_defineProperty({}, continuousAxis, Object.assign(Object.assign(Object.assign({ - field: continuousAxisChannelDef.field, - type: continuousAxisChannelDef.type - }, _title !== undefined ? { - title: _title - } : {}), scale !== undefined ? { - scale: scale - } : {}), isEmpty(axisWithoutTitle) ? {} : { - axis: axisWithoutTitle - })), encodingWithoutSizeColorContinuousAxisAndTooltip), customTooltipWithoutAggregatedField ? { - tooltip: customTooltipWithoutAggregatedField - } : {}) - })[0]; - - if (outlierLayersMixins && filteredWhiskerSpec) { - filteredLayersMixins = { - transform: [joinaggregateTransform], - layer: [outlierLayersMixins, filteredWhiskerSpec] - }; - } else if (outlierLayersMixins) { - filteredLayersMixins = outlierLayersMixins; - filteredLayersMixins.transform.unshift(joinaggregateTransform); - } else if (filteredWhiskerSpec) { - filteredLayersMixins = filteredWhiskerSpec; - filteredLayersMixins.transform.unshift(joinaggregateTransform); - } - } - - if (filteredLayersMixins) { - // tukey box plot with outliers included - return Object.assign(Object.assign({}, outerSpec), { - layer: [filteredLayersMixins, { - // boxplot - transform: transform, - layer: boxLayers - }] - }); - } - - return Object.assign(Object.assign({}, outerSpec), { - transform: ((_b = outerSpec.transform) !== null && _b !== void 0 ? _b : []).concat(transform), - layer: boxLayers - }); - } - - function boxParamsQuartiles(continousAxisField) { - return [{ - op: 'q1', - field: continousAxisField, - as: 'lower_box_' + continousAxisField - }, { - op: 'q3', - field: continousAxisField, - as: 'upper_box_' + continousAxisField - }]; - } - - function boxParams(spec, extent, config) { - var orient = compositeMarkOrient(spec, BOXPLOT); - - var _compositeMarkContinu = compositeMarkContinuousAxis(spec, orient, BOXPLOT), - continuousAxisChannelDef = _compositeMarkContinu.continuousAxisChannelDef, - continuousAxis = _compositeMarkContinu.continuousAxis; - - var continuousFieldName = continuousAxisChannelDef.field; - var boxPlotType = getBoxPlotType(extent); - var boxplotSpecificAggregate = [].concat(_toConsumableArray(boxParamsQuartiles(continuousFieldName)), [{ - op: 'median', - field: continuousFieldName, - as: 'mid_box_' + continuousFieldName - }, { - op: 'min', - field: continuousFieldName, - as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName - }, { - op: 'max', - field: continuousFieldName, - as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName - }]); - var postAggregateCalculates = boxPlotType === 'min-max' || boxPlotType === 'tukey' ? [] : [// This is for the original k-IQR, which we do not expose - { - calculate: "datum[\"upper_box_".concat(continuousFieldName, "\"] - datum[\"lower_box_").concat(continuousFieldName, "\"]"), - as: 'iqr_' + continuousFieldName - }, { - calculate: "min(datum[\"upper_box_".concat(continuousFieldName, "\"] + datum[\"iqr_").concat(continuousFieldName, "\"] * ").concat(extent, ", datum[\"max_").concat(continuousFieldName, "\"])"), - as: 'upper_whisker_' + continuousFieldName - }, { - calculate: "max(datum[\"lower_box_".concat(continuousFieldName, "\"] - datum[\"iqr_").concat(continuousFieldName, "\"] * ").concat(extent, ", datum[\"min_").concat(continuousFieldName, "\"])"), - as: 'lower_whisker_' + continuousFieldName - }]; - - var _a = spec.encoding, - _b = continuousAxis, - oldContinuousAxisChannelDef = _a[_b], - oldEncodingWithoutContinuousAxis = __rest(_a, [_typeof(_b) === "symbol" ? _b : _b + ""]); - - var _filterTooltipWithAgg = filterTooltipWithAggregatedField(oldEncodingWithoutContinuousAxis), - customTooltipWithoutAggregatedField = _filterTooltipWithAgg.customTooltipWithoutAggregatedField, - filteredEncoding = _filterTooltipWithAgg.filteredEncoding; - - var _extractTransformsFro = extractTransformsFromEncoding(filteredEncoding, config), - bins = _extractTransformsFro.bins, - timeUnits = _extractTransformsFro.timeUnits, - aggregate = _extractTransformsFro.aggregate, - groupby = _extractTransformsFro.groupby, - encodingWithoutContinuousAxis = _extractTransformsFro.encoding; - - var ticksOrient = orient === 'vertical' ? 'horizontal' : 'vertical'; - var boxOrient = orient; - var transform = [].concat(_toConsumableArray(bins), _toConsumableArray(timeUnits), [{ - aggregate: [].concat(_toConsumableArray(aggregate), _toConsumableArray(boxplotSpecificAggregate)), - groupby: groupby - }], postAggregateCalculates); - return { - transform: transform, - groupby: groupby, - aggregate: aggregate, - continuousAxisChannelDef: continuousAxisChannelDef, - continuousAxis: continuousAxis, - encodingWithoutContinuousAxis: encodingWithoutContinuousAxis, - ticksOrient: ticksOrient, - boxOrient: boxOrient, - customTooltipWithoutAggregatedField: customTooltipWithoutAggregatedField - }; - } - - var ERRORBAR = 'errorbar'; - var ERRORBAR_PARTS = ['ticks', 'rule']; - var errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar); - - function normalizeErrorBar(spec, _ref17) { - var config = _ref17.config; - // Need to initEncoding first so we can infer type - spec = Object.assign(Object.assign({}, spec), { - encoding: normalizeEncoding(spec.encoding, config) - }); - - var _errorBarParams = errorBarParams(spec, ERRORBAR, config), - transform = _errorBarParams.transform, - continuousAxisChannelDef = _errorBarParams.continuousAxisChannelDef, - continuousAxis = _errorBarParams.continuousAxis, - encodingWithoutContinuousAxis = _errorBarParams.encodingWithoutContinuousAxis, - ticksOrient = _errorBarParams.ticksOrient, - markDef = _errorBarParams.markDef, - outerSpec = _errorBarParams.outerSpec, - tooltipEncoding = _errorBarParams.tooltipEncoding; - - var makeErrorBarPart = makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorbar); - var tick = { - type: 'tick', - orient: ticksOrient, - aria: false - }; - var layer = [].concat(_toConsumableArray(makeErrorBarPart({ - partName: 'ticks', - mark: tick, - positionPrefix: 'lower', - extraEncoding: tooltipEncoding - })), _toConsumableArray(makeErrorBarPart({ - partName: 'ticks', - mark: tick, - positionPrefix: 'upper', - extraEncoding: tooltipEncoding - })), _toConsumableArray(makeErrorBarPart({ - partName: 'rule', - mark: { - type: 'rule', - ariaRoleDescription: 'errorbar' - }, - positionPrefix: 'lower', - endPositionPrefix: 'upper', - extraEncoding: tooltipEncoding - }))); - return Object.assign(Object.assign(Object.assign({}, outerSpec), { - transform: transform - }), layer.length > 1 ? { - layer: layer - } : Object.assign({}, layer[0])); - } - - function errorBarOrientAndInputType(spec, compositeMark) { - var encoding = spec.encoding; - - if (errorBarIsInputTypeRaw(encoding)) { - return { - orient: compositeMarkOrient(spec, compositeMark), - inputType: 'raw' - }; - } - - var isTypeAggregatedUpperLower = errorBarIsInputTypeAggregatedUpperLower(encoding); - var isTypeAggregatedError = errorBarIsInputTypeAggregatedError(encoding); - var x = encoding.x; - var y = encoding.y; - - if (isTypeAggregatedUpperLower) { - // type is aggregated-upper-lower - if (isTypeAggregatedError) { - throw new Error("".concat(compositeMark, " cannot be both type aggregated-upper-lower and aggregated-error")); - } - - var x2 = encoding.x2; - var y2 = encoding.y2; - - if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) { - // having both x, x2 and y, y2 - throw new Error("".concat(compositeMark, " cannot have both x2 and y2")); - } else if (isFieldOrDatumDef(x2)) { - if (isContinuousFieldOrDatumDef(x)) { - // having x, x2 quantitative and field y, y2 are not specified - return { - orient: 'horizontal', - inputType: 'aggregated-upper-lower' - }; - } else { - // having x, x2 that are not both quantitative - throw new Error("Both x and x2 have to be quantitative in ".concat(compositeMark)); - } - } else if (isFieldOrDatumDef(y2)) { - // y2 is a FieldDef - if (isContinuousFieldOrDatumDef(y)) { - // having y, y2 quantitative and field x, x2 are not specified - return { - orient: 'vertical', - inputType: 'aggregated-upper-lower' - }; - } else { - // having y, y2 that are not both quantitative - throw new Error("Both y and y2 have to be quantitative in ".concat(compositeMark)); - } - } - - throw new Error('No ranged axis'); - } else { - // type is aggregated-error - var xError = encoding.xError; - var xError2 = encoding.xError2; - var yError = encoding.yError; - var yError2 = encoding.yError2; - - if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) { - // having xError2 without xError - throw new Error("".concat(compositeMark, " cannot have xError2 without xError")); - } - - if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) { - // having yError2 without yError - throw new Error("".concat(compositeMark, " cannot have yError2 without yError")); - } - - if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) { - // having both xError and yError - throw new Error("".concat(compositeMark, " cannot have both xError and yError with both are quantiative")); - } else if (isFieldOrDatumDef(xError)) { - if (isContinuousFieldOrDatumDef(x)) { - // having x and xError that are all quantitative - return { - orient: 'horizontal', - inputType: 'aggregated-error' - }; - } else { - // having x, xError, and xError2 that are not all quantitative - throw new Error('All x, xError, and xError2 (if exist) have to be quantitative'); - } - } else if (isFieldOrDatumDef(yError)) { - if (isContinuousFieldOrDatumDef(y)) { - // having y and yError that are all quantitative - return { - orient: 'vertical', - inputType: 'aggregated-error' - }; - } else { - // having y, yError, and yError2 that are not all quantitative - throw new Error('All y, yError, and yError2 (if exist) have to be quantitative'); - } - } - - throw new Error('No ranged axis'); - } - } - - function errorBarIsInputTypeRaw(encoding) { - return (isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) && !isFieldOrDatumDef(encoding.x2) && !isFieldOrDatumDef(encoding.y2) && !isFieldOrDatumDef(encoding.xError) && !isFieldOrDatumDef(encoding.xError2) && !isFieldOrDatumDef(encoding.yError) && !isFieldOrDatumDef(encoding.yError2); - } - - function errorBarIsInputTypeAggregatedUpperLower(encoding) { - return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2); - } - - function errorBarIsInputTypeAggregatedError(encoding) { - return isFieldOrDatumDef(encoding.xError) || isFieldOrDatumDef(encoding.xError2) || isFieldOrDatumDef(encoding.yError) || isFieldOrDatumDef(encoding.yError2); - } - - function errorBarParams(spec, compositeMark, config) { - var _a; // TODO: use selection - - - var mark = spec.mark, - encoding = spec.encoding, - selection = spec.selection, - _p = spec.projection, - outerSpec = __rest(spec, ["mark", "encoding", "selection", "projection"]); - - var markDef = isMarkDef(mark) ? mark : { - type: mark - }; // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - - if (selection) { - warn(selectionNotSupported(compositeMark)); - } - - var _errorBarOrientAndInp = errorBarOrientAndInputType(spec, compositeMark), - orient = _errorBarOrientAndInp.orient, - inputType = _errorBarOrientAndInp.inputType; - - var _compositeMarkContinu2 = compositeMarkContinuousAxis(spec, orient, compositeMark), - continuousAxisChannelDef = _compositeMarkContinu2.continuousAxisChannelDef, - continuousAxisChannelDef2 = _compositeMarkContinu2.continuousAxisChannelDef2, - continuousAxisChannelDefError = _compositeMarkContinu2.continuousAxisChannelDefError, - continuousAxisChannelDefError2 = _compositeMarkContinu2.continuousAxisChannelDefError2, - continuousAxis = _compositeMarkContinu2.continuousAxis; - - var _errorBarAggregationA = errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config), - errorBarSpecificAggregate = _errorBarAggregationA.errorBarSpecificAggregate, - postAggregateCalculates = _errorBarAggregationA.postAggregateCalculates, - tooltipSummary = _errorBarAggregationA.tooltipSummary, - tooltipTitleWithFieldName = _errorBarAggregationA.tooltipTitleWithFieldName; - - var _b = encoding, - _c = continuousAxis, - oldContinuousAxisChannelDef = _b[_c], - _d = continuousAxis === 'x' ? 'x2' : 'y2', - oldContinuousAxisChannelDef2 = _b[_d], - _e = continuousAxis === 'x' ? 'xError' : 'yError', - oldContinuousAxisChannelDefError = _b[_e], - _f = continuousAxis === 'x' ? 'xError2' : 'yError2', - oldContinuousAxisChannelDefError2 = _b[_f], - oldEncodingWithoutContinuousAxis = __rest(_b, [_typeof(_c) === "symbol" ? _c : _c + "", _typeof(_d) === "symbol" ? _d : _d + "", _typeof(_e) === "symbol" ? _e : _e + "", _typeof(_f) === "symbol" ? _f : _f + ""]); - - var _extractTransformsFro2 = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config), - bins = _extractTransformsFro2.bins, - timeUnits = _extractTransformsFro2.timeUnits, - oldAggregate = _extractTransformsFro2.aggregate, - oldGroupBy = _extractTransformsFro2.groupby, - encodingWithoutContinuousAxis = _extractTransformsFro2.encoding; - - var aggregate = [].concat(_toConsumableArray(oldAggregate), _toConsumableArray(errorBarSpecificAggregate)); - var groupby = inputType !== 'raw' ? [] : oldGroupBy; - var tooltipEncoding = getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, tooltipTitleWithFieldName); - return { - transform: [].concat(_toConsumableArray((_a = outerSpec.transform) !== null && _a !== void 0 ? _a : []), _toConsumableArray(bins), _toConsumableArray(timeUnits), _toConsumableArray(aggregate.length === 0 ? [] : [{ - aggregate: aggregate, - groupby: groupby - }]), _toConsumableArray(postAggregateCalculates)), - groupby: groupby, - continuousAxisChannelDef: continuousAxisChannelDef, - continuousAxis: continuousAxis, - encodingWithoutContinuousAxis: encodingWithoutContinuousAxis, - ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical', - markDef: markDef, - outerSpec: outerSpec, - tooltipEncoding: tooltipEncoding - }; - } - - function errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config) { - var errorBarSpecificAggregate = []; - var postAggregateCalculates = []; - var continuousFieldName = continuousAxisChannelDef.field; - var tooltipSummary; - var tooltipTitleWithFieldName = false; - - if (inputType === 'raw') { - var center = markDef.center ? markDef.center : markDef.extent ? markDef.extent === 'iqr' ? 'median' : 'mean' : config.errorbar.center; - var extent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr'; - - if (center === 'median' !== (extent === 'iqr')) { - warn(errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark)); - } - - if (extent === 'stderr' || extent === 'stdev') { - errorBarSpecificAggregate = [{ - op: extent, - field: continuousFieldName, - as: 'extent_' + continuousFieldName - }, { - op: center, - field: continuousFieldName, - as: 'center_' + continuousFieldName - }]; - postAggregateCalculates = [{ - calculate: "datum[\"center_".concat(continuousFieldName, "\"] + datum[\"extent_").concat(continuousFieldName, "\"]"), - as: 'upper_' + continuousFieldName - }, { - calculate: "datum[\"center_".concat(continuousFieldName, "\"] - datum[\"extent_").concat(continuousFieldName, "\"]"), - as: 'lower_' + continuousFieldName - }]; - tooltipSummary = [{ - fieldPrefix: 'center_', - titlePrefix: titleCase(center) - }, { - fieldPrefix: 'upper_', - titlePrefix: getTitlePrefix(center, extent, '+') - }, { - fieldPrefix: 'lower_', - titlePrefix: getTitlePrefix(center, extent, '-') - }]; - tooltipTitleWithFieldName = true; - } else { - var centerOp; - var lowerExtentOp; - var upperExtentOp; - - if (extent === 'ci') { - centerOp = 'mean'; - lowerExtentOp = 'ci0'; - upperExtentOp = 'ci1'; - } else { - centerOp = 'median'; - lowerExtentOp = 'q1'; - upperExtentOp = 'q3'; - } - - errorBarSpecificAggregate = [{ - op: lowerExtentOp, - field: continuousFieldName, - as: 'lower_' + continuousFieldName - }, { - op: upperExtentOp, - field: continuousFieldName, - as: 'upper_' + continuousFieldName - }, { - op: centerOp, - field: continuousFieldName, - as: 'center_' + continuousFieldName - }]; - tooltipSummary = [{ - fieldPrefix: 'upper_', - titlePrefix: _title3({ - field: continuousFieldName, - aggregate: upperExtentOp, - type: 'quantitative' - }, config, { - allowDisabling: false - }) - }, { - fieldPrefix: 'lower_', - titlePrefix: _title3({ - field: continuousFieldName, - aggregate: lowerExtentOp, - type: 'quantitative' - }, config, { - allowDisabling: false - }) - }, { - fieldPrefix: 'center_', - titlePrefix: _title3({ - field: continuousFieldName, - aggregate: centerOp, - type: 'quantitative' - }, config, { - allowDisabling: false - }) - }]; - } - } else { - if (markDef.center || markDef.extent) { - warn(errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent)); - } - - if (inputType === 'aggregated-upper-lower') { - tooltipSummary = []; - postAggregateCalculates = [{ - calculate: "datum[\"".concat(continuousAxisChannelDef2.field, "\"]"), - as: 'upper_' + continuousFieldName - }, { - calculate: "datum[\"".concat(continuousFieldName, "\"]"), - as: 'lower_' + continuousFieldName - }]; - } else if (inputType === 'aggregated-error') { - tooltipSummary = [{ - fieldPrefix: '', - titlePrefix: continuousFieldName - }]; - postAggregateCalculates = [{ - calculate: "datum[\"".concat(continuousFieldName, "\"] + datum[\"").concat(continuousAxisChannelDefError.field, "\"]"), - as: 'upper_' + continuousFieldName - }]; - - if (continuousAxisChannelDefError2) { - postAggregateCalculates.push({ - calculate: "datum[\"".concat(continuousFieldName, "\"] + datum[\"").concat(continuousAxisChannelDefError2.field, "\"]"), - as: 'lower_' + continuousFieldName - }); - } else { - postAggregateCalculates.push({ - calculate: "datum[\"".concat(continuousFieldName, "\"] - datum[\"").concat(continuousAxisChannelDefError.field, "\"]"), - as: 'lower_' + continuousFieldName - }); - } - } - - var _iterator25 = _createForOfIteratorHelper(postAggregateCalculates), - _step25; - - try { - for (_iterator25.s(); !(_step25 = _iterator25.n()).done;) { - var postAggregateCalculate = _step25.value; - tooltipSummary.push({ - fieldPrefix: postAggregateCalculate.as.substring(0, 6), - titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum["', ''), '"]', '') - }); - } - } catch (err) { - _iterator25.e(err); - } finally { - _iterator25.f(); - } - } - - return { - postAggregateCalculates: postAggregateCalculates, - errorBarSpecificAggregate: errorBarSpecificAggregate, - tooltipSummary: tooltipSummary, - tooltipTitleWithFieldName: tooltipTitleWithFieldName - }; - } - - function getTitlePrefix(center, extent, operation) { - return titleCase(center) + ' ' + operation + ' ' + extent; - } - - var ERRORBAND = 'errorband'; - var ERRORBAND_PARTS = ['band', 'borders']; - var errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand); - - function normalizeErrorBand(spec, _ref18) { - var config = _ref18.config; - // Need to initEncoding first so we can infer type - spec = Object.assign(Object.assign({}, spec), { - encoding: normalizeEncoding(spec.encoding, config) - }); - - var _errorBarParams2 = errorBarParams(spec, ERRORBAND, config), - transform = _errorBarParams2.transform, - continuousAxisChannelDef = _errorBarParams2.continuousAxisChannelDef, - continuousAxis = _errorBarParams2.continuousAxis, - encodingWithoutContinuousAxis = _errorBarParams2.encodingWithoutContinuousAxis, - markDef = _errorBarParams2.markDef, - outerSpec = _errorBarParams2.outerSpec, - tooltipEncoding = _errorBarParams2.tooltipEncoding; - - var errorBandDef = markDef; - var makeErrorBandPart = makeCompositeAggregatePartFactory(errorBandDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorband); - var is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined; - var bandMark = { - type: is2D ? 'area' : 'rect' - }; - var bordersMark = { - type: is2D ? 'line' : 'rule' - }; - var interpolate = Object.assign(Object.assign({}, errorBandDef.interpolate ? { - interpolate: errorBandDef.interpolate - } : {}), errorBandDef.tension && errorBandDef.interpolate ? { - tension: errorBandDef.tension - } : {}); - - if (is2D) { - bandMark = Object.assign(Object.assign(Object.assign({}, bandMark), interpolate), { - ariaRoleDescription: 'errorband' - }); - bordersMark = Object.assign(Object.assign(Object.assign({}, bordersMark), interpolate), { - aria: false - }); - } else if (errorBandDef.interpolate) { - warn(errorBand1DNotSupport('interpolate')); - } else if (errorBandDef.tension) { - warn(errorBand1DNotSupport('tension')); - } - - return Object.assign(Object.assign({}, outerSpec), { - transform: transform, - layer: [].concat(_toConsumableArray(makeErrorBandPart({ - partName: 'band', - mark: bandMark, - positionPrefix: 'lower', - endPositionPrefix: 'upper', - extraEncoding: tooltipEncoding - })), _toConsumableArray(makeErrorBandPart({ - partName: 'borders', - mark: bordersMark, - positionPrefix: 'lower', - extraEncoding: tooltipEncoding - })), _toConsumableArray(makeErrorBandPart({ - partName: 'borders', - mark: bordersMark, - positionPrefix: 'upper', - extraEncoding: tooltipEncoding - }))) - }); - } - /** - * Registry index for all composite mark's normalizer - */ - - - var compositeMarkRegistry = {}; - - function add(mark, run, parts) { - var normalizer = new CompositeMarkNormalizer(mark, run); - compositeMarkRegistry[mark] = { - normalizer: normalizer, - parts: parts - }; - } - - function getAllCompositeMarks() { - return keys(compositeMarkRegistry); - } - - add(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS); - add(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS); - add(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS); - var VL_ONLY_LEGEND_CONFIG = ['gradientHorizontalMaxLength', 'gradientHorizontalMinLength', 'gradientVerticalMaxLength', 'gradientVerticalMinLength', 'unselectedOpacity']; - var LEGEND_SCALE_CHANNELS = ['size', 'shape', 'fill', 'stroke', 'strokeDash', 'strokeWidth', 'opacity']; - var SIGNAL_LEGEND_PROP_INDEX = { - fillColor: { - part: 'legend', - vgProp: 'fill' - }, - gradientStrokeColor: { - part: 'gradient', - vgProp: 'stroke' - }, - labelColor: { - part: 'labels', - vgProp: 'fill' - }, - strokeColor: { - part: 'legend', - vgProp: 'stroke' - }, - symbolFillColor: { - part: 'symbols', - vgProp: 'fill' - }, - symbolStrokeColor: { - part: 'symbols', - vgProp: 'stroke' - }, - titleColor: { - part: 'title', - vgProp: 'fill' - } - }; - var defaultLegendConfig = { - gradientHorizontalMaxLength: 200, - gradientHorizontalMinLength: 100, - gradientVerticalMaxLength: 200, - gradientVerticalMinLength: 64, - unselectedOpacity: 0.35 - }; - var COMMON_LEGEND_PROPERTY_INDEX = { - aria: 1, - clipHeight: 1, - columnPadding: 1, - columns: 1, - cornerRadius: 1, - description: 1, - direction: 1, - fillColor: 1, - format: 1, - formatType: 1, - gradientLength: 1, - gradientOpacity: 1, - gradientStrokeColor: 1, - gradientStrokeWidth: 1, - gradientThickness: 1, - gridAlign: 1, - labelAlign: 1, - labelBaseline: 1, - labelColor: 1, - labelFont: 1, - labelFontSize: 1, - labelFontStyle: 1, - labelFontWeight: 1, - labelLimit: 1, - labelOffset: 1, - labelOpacity: 1, - labelOverlap: 1, - labelPadding: 1, - labelSeparation: 1, - legendX: 1, - legendY: 1, - offset: 1, - orient: 1, - padding: 1, - rowPadding: 1, - strokeColor: 1, - symbolDash: 1, - symbolDashOffset: 1, - symbolFillColor: 1, - symbolLimit: 1, - symbolOffset: 1, - symbolOpacity: 1, - symbolSize: 1, - symbolStrokeColor: 1, - symbolStrokeWidth: 1, - symbolType: 1, - tickCount: 1, - tickMinStep: 1, - title: 1, - titleAlign: 1, - titleAnchor: 1, - titleBaseline: 1, - titleColor: 1, - titleFont: 1, - titleFontSize: 1, - titleFontStyle: 1, - titleFontWeight: 1, - titleLimit: 1, - titleLineHeight: 1, - titleOpacity: 1, - titleOrient: 1, - titlePadding: 1, - type: 1, - values: 1, - zindex: 1 - }; - var SELECTION_ID = '_vgsid_'; - var defaultConfig = { - single: { - on: 'click', - fields: [SELECTION_ID], - resolve: 'global', - empty: 'all', - clear: 'dblclick' - }, - multi: { - on: 'click', - fields: [SELECTION_ID], - toggle: 'event.shiftKey', - resolve: 'global', - empty: 'all', - clear: 'dblclick' - }, - interval: { - on: '[mousedown, window:mouseup] > window:mousemove!', - encodings: ['x', 'y'], - translate: '[mousedown, window:mouseup] > window:mousemove!', - zoom: 'wheel!', - mark: { - fill: '#333', - fillOpacity: 0.125, - stroke: 'white' - }, - resolve: 'global', - clear: 'dblclick' - } - }; - - function isLegendBinding(bind) { - return !!bind && (bind === 'legend' || !!bind.legend); - } - - function isLegendStreamBinding(bind) { - return isLegendBinding(bind) && isObject(bind); - } - - function isAnyConcatSpec(spec) { - return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec); - } - - function isConcatSpec(spec) { - return 'concat' in spec; - } - - function isVConcatSpec(spec) { - return 'vconcat' in spec; - } - - function isHConcatSpec(spec) { - return 'hconcat' in spec; - } - - function isStep(size) { - return isObject(size) && size['step'] !== undefined; - } - - function isFrameMixins(o) { - return o['view'] || o['width'] || o['height']; - } - - var DEFAULT_SPACING = 20; - var COMPOSITION_LAYOUT_INDEX = { - align: 1, - bounds: 1, - center: 1, - columns: 1, - spacing: 1 - }; - var COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX); - - function extractCompositionLayout(spec, specType, config) { - var _a, _b; - - var compositionConfig = config[specType]; - var layout = {}; // Apply config first - - var spacingConfig = compositionConfig.spacing, - columns = compositionConfig.columns; - - if (spacingConfig !== undefined) { - layout.spacing = spacingConfig; - } - - if (columns !== undefined) { - if (isFacetSpec(spec) && !isFacetMapping(spec.facet) || isConcatSpec(spec)) { - layout.columns = columns; - } - } - - if (isVConcatSpec(spec)) { - layout.columns = 1; - } // Then copy properties from the spec - - - var _iterator26 = _createForOfIteratorHelper(COMPOSITION_LAYOUT_PROPERTIES), - _step26; - - try { - for (_iterator26.s(); !(_step26 = _iterator26.n()).done;) { - var prop = _step26.value; - - if (spec[prop] !== undefined) { - if (prop === 'spacing') { - var spacing = spec[prop]; - layout[prop] = isNumber(spacing) ? spacing : { - row: (_a = spacing.row) !== null && _a !== void 0 ? _a : spacingConfig, - column: (_b = spacing.column) !== null && _b !== void 0 ? _b : spacingConfig - }; - } else { - layout[prop] = spec[prop]; - } - } - } - } catch (err) { - _iterator26.e(err); - } finally { - _iterator26.f(); - } - - return layout; - } - - function getViewConfigContinuousSize(viewConfig, channel) { - var _a; - - return (_a = viewConfig[channel]) !== null && _a !== void 0 ? _a : viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility - } - - function getViewConfigDiscreteStep(viewConfig, channel) { - var size = getViewConfigDiscreteSize(viewConfig, channel); - return isStep(size) ? size.step : DEFAULT_STEP; - } - - function getViewConfigDiscreteSize(viewConfig, channel) { - var _a; - - var size = (_a = viewConfig[channel]) !== null && _a !== void 0 ? _a : viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility - - return getFirstDefined(size, { - step: viewConfig.step - }); - } - - var DEFAULT_STEP = 20; - var defaultViewConfig = { - continuousWidth: 200, - continuousHeight: 200, - step: DEFAULT_STEP - }; - var defaultConfig$1 = { - background: 'white', - padding: 5, - timeFormat: '%b %d, %Y', - countTitle: 'Count of Records', - view: defaultViewConfig, - mark: defaultMarkConfig, - arc: {}, - area: {}, - bar: defaultBarConfig, - circle: {}, - geoshape: {}, - image: {}, - line: {}, - point: {}, - rect: defaultRectConfig, - rule: { - color: 'black' - }, - square: {}, - text: { - color: 'black' - }, - tick: defaultTickConfig, - trail: {}, - boxplot: { - size: 14, - extent: 1.5, - box: {}, - median: { - color: 'white' - }, - outliers: {}, - rule: {}, - ticks: null - }, - errorbar: { - center: 'mean', - rule: true, - ticks: false - }, - errorband: { - band: { - opacity: 0.3 - }, - borders: false - }, - scale: defaultScaleConfig, - projection: {}, - legend: defaultLegendConfig, - header: { - titlePadding: 10, - labelPadding: 10 - }, - headerColumn: {}, - headerRow: {}, - headerFacet: {}, - selection: defaultConfig, - style: {}, - title: {}, - facet: { - spacing: DEFAULT_SPACING - }, - concat: { - spacing: DEFAULT_SPACING - } - }; // Tableau10 color palette, copied from `vegaScale.scheme('tableau10')` - - var tab10 = ['#4c78a8', '#f58518', '#e45756', '#72b7b2', '#54a24b', '#eeca3b', '#b279a2', '#ff9da6', '#9d755d', '#bab0ac']; - var DEFAULT_FONT_SIZE = { - text: 11, - guideLabel: 10, - guideTitle: 11, - groupTitle: 13, - groupSubtitle: 12 - }; - var DEFAULT_COLOR = { - blue: tab10[0], - orange: tab10[1], - red: tab10[2], - teal: tab10[3], - green: tab10[4], - yellow: tab10[5], - purple: tab10[6], - pink: tab10[7], - brown: tab10[8], - gray0: '#000', - gray1: '#111', - gray2: '#222', - gray3: '#333', - gray4: '#444', - gray5: '#555', - gray6: '#666', - gray7: '#777', - gray8: '#888', - gray9: '#999', - gray10: '#aaa', - gray11: '#bbb', - gray12: '#ccc', - gray13: '#ddd', - gray14: '#eee', - gray15: '#fff' - }; - - function colorSignalConfig() { - var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - return { - signals: [{ - name: 'color', - value: isObject(color) ? Object.assign(Object.assign({}, DEFAULT_COLOR), color) : DEFAULT_COLOR - }], - mark: { - color: { - signal: 'color.blue' - } - }, - rule: { - color: { - signal: 'color.gray0' - } - }, - text: { - color: { - signal: 'color.gray0' - } - }, - style: { - 'guide-label': { - fill: { - signal: 'color.gray0' - } - }, - 'guide-title': { - fill: { - signal: 'color.gray0' - } - }, - 'group-title': { - fill: { - signal: 'color.gray0' - } - }, - 'group-subtitle': { - fill: { - signal: 'color.gray0' - } - }, - cell: { - stroke: { - signal: 'color.gray8' - } - } - }, - axis: { - domainColor: { - signal: 'color.gray13' - }, - gridColor: { - signal: 'color.gray8' - }, - tickColor: { - signal: 'color.gray13' - } - }, - range: { - category: [{ - signal: 'color.blue' - }, { - signal: 'color.orange' - }, { - signal: 'color.red' - }, { - signal: 'color.teal' - }, { - signal: 'color.green' - }, { - signal: 'color.yellow' - }, { - signal: 'color.purple' - }, { - signal: 'color.pink' - }, { - signal: 'color.brown' - }, { - signal: 'color.grey8' - }] - } - }; - } - - function fontSizeSignalConfig(fontSize) { - return { - signals: [{ - name: 'fontSize', - value: isObject(fontSize) ? Object.assign(Object.assign({}, DEFAULT_FONT_SIZE), fontSize) : DEFAULT_FONT_SIZE - }], - text: { - fontSize: { - signal: 'fontSize.text' - } - }, - style: { - 'guide-label': { - fontSize: { - signal: 'fontSize.guideLabel' - } - }, - 'guide-title': { - fontSize: { - signal: 'fontSize.guideTitle' - } - }, - 'group-title': { - fontSize: { - signal: 'fontSize.groupTitle' - } - }, - 'group-subtitle': { - fontSize: { - signal: 'fontSize.groupSubtitle' - } - } - } - }; - } - - function fontConfig(font) { - return { - text: { - font: font - }, - style: { - 'guide-label': { - font: font - }, - 'guide-title': { - font: font - }, - 'group-title': { - font: font - }, - 'group-subtitle': { - font: font - } - } - }; - } - - function initConfig() { - var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - var color = config.color, - font = config.font, - fontSize = config.fontSize, - restConfig = __rest(config, ["color", "font", "fontSize"]); - - return mergeConfig({}, defaultConfig$1, font ? fontConfig(font) : {}, color ? colorSignalConfig(color) : {}, fontSize ? fontSizeSignalConfig(fontSize) : {}, restConfig || {}); - } - - var MARK_STYLES = ['view'].concat(_toConsumableArray(PRIMITIVE_MARKS)); - var VL_ONLY_CONFIG_PROPERTIES = ['color', 'fontSize', 'background', 'padding', 'facet', 'concat', 'numberFormat', 'timeFormat', 'countTitle', 'header', 'axisQuantitative', 'axisTemporal', 'axisDiscrete', 'axisPoint', 'axisXBand', 'axisXPoint', 'axisXDiscrete', 'axisXQuantitative', 'axisXTemporal', 'axisYBand', 'axisYPoint', 'axisYDiscrete', 'axisYQuantitative', 'axisYTemporal', 'scale', 'selection', 'overlay' // FIXME: Redesign and unhide this - ]; - var VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = Object.assign({ - view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'] - }, VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX); - - function stripAndRedirectConfig(config) { - config = duplicate(config); - - var _iterator27 = _createForOfIteratorHelper(VL_ONLY_CONFIG_PROPERTIES), - _step27; - - try { - for (_iterator27.s(); !(_step27 = _iterator27.n()).done;) { - var _prop4 = _step27.value; - delete config[_prop4]; - } - } catch (err) { - _iterator27.e(err); - } finally { - _iterator27.f(); - } - - if (config.axis) { - // delete condition axis config - for (var prop in config.axis) { - if (isConditionalAxisValue(config.axis[prop])) { - delete config.axis[prop]; - } - } - } - - if (config.legend) { - var _iterator28 = _createForOfIteratorHelper(VL_ONLY_LEGEND_CONFIG), - _step28; - - try { - for (_iterator28.s(); !(_step28 = _iterator28.n()).done;) { - var _prop = _step28.value; - delete config.legend[_prop]; - } - } catch (err) { - _iterator28.e(err); - } finally { - _iterator28.f(); - } - } // Remove Vega-Lite only generic mark config - - - if (config.mark) { - var _iterator29 = _createForOfIteratorHelper(VL_ONLY_MARK_CONFIG_PROPERTIES), - _step29; - - try { - for (_iterator29.s(); !(_step29 = _iterator29.n()).done;) { - var _prop2 = _step29.value; - delete config.mark[_prop2]; - } - } catch (err) { - _iterator29.e(err); - } finally { - _iterator29.f(); - } - - if (config.mark.tooltip && isObject(config.mark.tooltip)) { - delete config.mark.tooltip; - } - } - - var _iterator30 = _createForOfIteratorHelper(MARK_STYLES), - _step30; - - try { - for (_iterator30.s(); !(_step30 = _iterator30.n()).done;) { - var markType = _step30.value; - - // Remove Vega-Lite-only mark config - var _iterator32 = _createForOfIteratorHelper(VL_ONLY_MARK_CONFIG_PROPERTIES), - _step32; - - try { - for (_iterator32.s(); !(_step32 = _iterator32.n()).done;) { - var _prop6 = _step32.value; - delete config[markType][_prop6]; - } // Remove Vega-Lite only mark-specific config - - } catch (err) { - _iterator32.e(err); - } finally { - _iterator32.f(); - } - - var vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType]; - - if (vlOnlyMarkSpecificConfigs) { - var _iterator33 = _createForOfIteratorHelper(vlOnlyMarkSpecificConfigs), - _step33; - - try { - for (_iterator33.s(); !(_step33 = _iterator33.n()).done;) { - var _prop5 = _step33.value; - delete config[markType][_prop5]; - } - } catch (err) { - _iterator33.e(err); - } finally { - _iterator33.f(); - } - } // Redirect mark config to config.style so that mark config only affect its own mark type - // without affecting other marks that share the same underlying Vega marks. - // For example, config.rect should not affect bar marks. - - - redirectConfigToStyleConfig(config, markType); - } - } catch (err) { - _iterator30.e(err); - } finally { - _iterator30.f(); - } - - var _iterator31 = _createForOfIteratorHelper(getAllCompositeMarks()), - _step31; - - try { - for (_iterator31.s(); !(_step31 = _iterator31.n()).done;) { - var m = _step31.value; - // Clean up the composite mark config as we don't need them in the output specs anymore - delete config[m]; - } - } catch (err) { - _iterator31.e(err); - } finally { - _iterator31.f(); - } - - redirectTitleConfig(config); // Remove empty config objects. - - for (var _prop3 in config) { - if (isObject(config[_prop3]) && isEmpty(config[_prop3])) { - delete config[_prop3]; - } - } - - return isEmpty(config) ? undefined : config; - } - /** - * - * Redirect config.title -- so that title config do not affect header labels, - * which also uses `title` directive to implement. - * - * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles. - */ - - - function redirectTitleConfig(config) { - var _extractTitleConfig = extractTitleConfig(config.title), - titleMarkConfig = _extractTitleConfig.titleMarkConfig, - subtitleMarkConfig = _extractTitleConfig.subtitleMarkConfig, - subtitle = _extractTitleConfig.subtitle; // set config.style if title/subtitleMarkConfig is not an empty object - - - if (!isEmpty(titleMarkConfig)) { - config.style['group-title'] = Object.assign(Object.assign({}, config.style['group-title']), titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega - ); - } - - if (!isEmpty(subtitleMarkConfig)) { - config.style['group-subtitle'] = Object.assign(Object.assign({}, config.style['group-subtitle']), subtitleMarkConfig); - } // subtitle part can stay in config.title since header titles do not use subtitle - - - if (!isEmpty(subtitle)) { - config.title = subtitle; - } else { - delete config.title; - } - } - - function redirectConfigToStyleConfig(config, prop, // string = composite mark - toProp, compositeMarkPart) { - var propConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop]; - - if (prop === 'view') { - toProp = 'cell'; // View's default style is "cell" - } - - var style = Object.assign(Object.assign({}, propConfig), config.style[toProp !== null && toProp !== void 0 ? toProp : prop]); // set config.style if it is not an empty object - - if (!isEmpty(style)) { - config.style[toProp !== null && toProp !== void 0 ? toProp : prop] = style; - } - - if (!compositeMarkPart) { - // For composite mark, so don't delete the whole config yet as we have to do multiple redirections. - delete config[prop]; - } - } - - function isLayerSpec(spec) { - return 'layer' in spec; - } - - function isRepeatSpec(spec) { - return 'repeat' in spec; - } - - function isLayerRepeatSpec(spec) { - return !isArray(spec.repeat) && spec.repeat['layer']; - } - - var SpecMapper = /*#__PURE__*/function () { - function SpecMapper() { - _classCallCheck(this, SpecMapper); - } - - _createClass(SpecMapper, [{ - key: "map", - value: function map(spec, params) { - if (isFacetSpec(spec)) { - return this.mapFacet(spec, params); - } else if (isRepeatSpec(spec)) { - return this.mapRepeat(spec, params); - } else if (isHConcatSpec(spec)) { - return this.mapHConcat(spec, params); - } else if (isVConcatSpec(spec)) { - return this.mapVConcat(spec, params); - } else if (isConcatSpec(spec)) { - return this.mapConcat(spec, params); - } else { - return this.mapLayerOrUnit(spec, params); - } - } - }, { - key: "mapLayerOrUnit", - value: function mapLayerOrUnit(spec, params) { - if (isLayerSpec(spec)) { - return this.mapLayer(spec, params); - } else if (isUnitSpec(spec)) { - return this.mapUnit(spec, params); - } - - throw new Error(invalidSpec(spec)); - } - }, { - key: "mapLayer", - value: function mapLayer(spec, params) { - var _this = this; - - return Object.assign(Object.assign({}, spec), { - layer: spec.layer.map(function (subspec) { - return _this.mapLayerOrUnit(subspec, params); - }) - }); - } - }, { - key: "mapHConcat", - value: function mapHConcat(spec, params) { - var _this2 = this; - - return Object.assign(Object.assign({}, spec), { - hconcat: spec.hconcat.map(function (subspec) { - return _this2.map(subspec, params); - }) - }); - } - }, { - key: "mapVConcat", - value: function mapVConcat(spec, params) { - var _this3 = this; - - return Object.assign(Object.assign({}, spec), { - vconcat: spec.vconcat.map(function (subspec) { - return _this3.map(subspec, params); - }) - }); - } - }, { - key: "mapConcat", - value: function mapConcat(spec, params) { - var _this4 = this; - - var concat = spec.concat, - rest = __rest(spec, ["concat"]); - - return Object.assign(Object.assign({}, rest), { - concat: concat.map(function (subspec) { - return _this4.map(subspec, params); - }) - }); - } - }, { - key: "mapFacet", - value: function mapFacet(spec, params) { - return Object.assign(Object.assign({}, spec), { - // TODO: remove "any" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760 - spec: this.map(spec.spec, params) - }); - } - }, { - key: "mapRepeat", - value: function mapRepeat(spec, params) { - return Object.assign(Object.assign({}, spec), { - // as any is required here since TS cannot infer that the output type satisfies the input type - spec: this.map(spec.spec, params) - }); - } - }]); - - return SpecMapper; - }(); - - var STACK_OFFSET_INDEX = { - zero: 1, - center: 1, - normalize: 1 - }; - - function isStackOffset(s) { - return s in STACK_OFFSET_INDEX; - } - - var STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]); - var STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]); - - function potentialStackedChannel(encoding, x) { - var _a, _b; - - var y = x === 'x' ? 'y' : 'radius'; - var xDef = encoding[x]; - var yDef = encoding[y]; - - if (isFieldDef(xDef) && isFieldDef(yDef)) { - if (channelDefType(xDef) === 'quantitative' && channelDefType(yDef) === 'quantitative') { - if (xDef.stack) { - return x; - } else if (yDef.stack) { - return y; - } - - var xAggregate = isFieldDef(xDef) && !!xDef.aggregate; - var yAggregate = isFieldDef(yDef) && !!yDef.aggregate; // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y - - if (xAggregate !== yAggregate) { - return xAggregate ? x : y; - } else { - var xScale = (_a = xDef.scale) === null || _a === void 0 ? void 0 : _a.type; - var yScale = (_b = yDef.scale) === null || _b === void 0 ? void 0 : _b.type; - - if (xScale && xScale !== 'linear') { - return y; - } else if (yScale && yScale !== 'linear') { - return x; - } - } - } else if (channelDefType(xDef) === 'quantitative') { - return x; - } else if (channelDefType(yDef) === 'quantitative') { - return y; - } - } else if (channelDefType(xDef) === 'quantitative') { - return x; - } else if (channelDefType(yDef) === 'quantitative') { - return y; - } - - return undefined; - } - - function getDimensionChannel(channel) { - switch (channel) { - case 'x': - return 'y'; - - case 'y': - return 'x'; - - case 'theta': - return 'radius'; - - case 'radius': - return 'theta'; - } - } // Note: CompassQL uses this method and only pass in required properties of each argument object. - // If required properties change, make sure to update CompassQL. - - - function stack(m, encoding) { - var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var mark = isMarkDef(m) ? m.type : m; // Should have stackable mark - - if (!STACKABLE_MARKS.has(mark)) { - return null; - } // Run potential stacked twice, one for Cartesian and another for Polar, - // so text marks can be stacked in any of the coordinates. - // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking. - // However, since we probably never want to do that, let's just note the limitation here. - - - var fieldChannel = potentialStackedChannel(encoding, 'x') || potentialStackedChannel(encoding, 'theta'); - - if (!fieldChannel) { - return null; - } - - var stackedFieldDef = encoding[fieldChannel]; - var stackedField = isFieldDef(stackedFieldDef) ? _vgField(stackedFieldDef, {}) : undefined; - var dimensionChannel = getDimensionChannel(fieldChannel); - var dimensionDef = encoding[dimensionChannel]; - var dimensionField = isFieldDef(dimensionDef) ? _vgField(dimensionDef, {}) : undefined; // avoid grouping by the stacked field - - if (dimensionField === stackedField) { - dimensionField = undefined; - dimensionDef = undefined; - dimensionChannel = undefined; - } // Should have grouping level of detail that is different from the dimension field - - - var stackBy = NONPOSITION_CHANNELS.reduce(function (sc, channel) { - // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001) - if (channel !== 'tooltip' && _channelHasField(encoding, channel)) { - var channelDef = encoding[channel]; - - var _iterator34 = _createForOfIteratorHelper(array(channelDef)), - _step34; - - try { - for (_iterator34.s(); !(_step34 = _iterator34.n()).done;) { - var cDef = _step34.value; - var fieldDef = getFieldDef(cDef); - - if (fieldDef.aggregate) { - continue; - } // Check whether the channel's field is identical to x/y's field or if the channel is a repeat - - - var f = _vgField(fieldDef, {}); - - if ( // if fielddef is a repeat, just include it in the stack by - !f || // otherwise, the field must be different from x and y fields. - f !== dimensionField) { - sc.push({ - channel: channel, - fieldDef: fieldDef - }); - } - } - } catch (err) { - _iterator34.e(err); - } finally { - _iterator34.f(); - } - } - - return sc; - }, []); // Automatically determine offset - - var offset; - - if (stackedFieldDef.stack !== undefined) { - if (isBoolean(stackedFieldDef.stack)) { - offset = stackedFieldDef.stack ? 'zero' : null; - } else { - offset = stackedFieldDef.stack; - } - } else if (stackBy.length > 0 && STACK_BY_DEFAULT_MARKS.has(mark)) { - // Bar and Area with sum ops are automatically stacked by default - offset = 'zero'; - } - - if (!offset || !isStackOffset(offset)) { - return null; - } - - if (isAggregate(encoding) && stackBy.length === 0) { - return null; - } // warn when stacking non-linear - - - if (stackedFieldDef.scale && stackedFieldDef.scale.type && stackedFieldDef.scale.type !== ScaleType.LINEAR) { - if (opt.disallowNonLinearStack) { - return null; - } else { - warn(cannotStackNonLinearScale(stackedFieldDef.scale.type)); - } - } // Check if it is a ranged mark - - - if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) { - if (stackedFieldDef.stack !== undefined) { - warn(cannotStackRangedMark(fieldChannel)); - } - - return null; - } // Warn if stacking non-summative aggregate - - - if (isFieldDef(stackedFieldDef) && stackedFieldDef.aggregate && !contains(SUM_OPS, stackedFieldDef.aggregate)) { - warn(stackNonSummativeAggregate(stackedFieldDef.aggregate)); - } - - return { - groupbyChannel: dimensionDef ? dimensionChannel : undefined, - groupbyField: dimensionField, - fieldChannel: fieldChannel, - impute: stackedFieldDef.impute === null ? false : isPathMark(mark), - stackBy: stackBy, - offset: offset - }; - } - - function dropLineAndPoint(markDef) { - var mark = __rest(markDef, ["point", "line"]); - - return keys(mark).length > 1 ? mark : mark.type; - } - - function dropLineAndPointFromConfig(config) { - for (var _i5 = 0, _arr3 = ['line', 'area', 'rule', 'trail']; _i5 < _arr3.length; _i5++) { - var mark = _arr3[_i5]; - - if (config[mark]) { - config = Object.assign(Object.assign({}, config), _defineProperty({}, mark, omit(config[mark], ['point', 'line']))); - } - } - - return config; - } - - function getPointOverlay(markDef) { - var markConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var encoding = arguments.length > 2 ? arguments[2] : undefined; - - if (markDef.point === 'transparent') { - return { - opacity: 0 - }; - } else if (markDef.point) { - // truthy : true or object - return isObject(markDef.point) ? markDef.point : {}; - } else if (markDef.point !== undefined) { - // false or null - return null; - } else { - // undefined (not disabled) - if (markConfig.point || encoding.shape) { - // enable point overlay if config[mark].point is truthy or if encoding.shape is provided - return isObject(markConfig.point) ? markConfig.point : {}; - } // markDef.point is defined as falsy - - - return undefined; - } - } - - function getLineOverlay(markDef) { - var markConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - if (markDef.line) { - // true or object - return markDef.line === true ? {} : markDef.line; - } else if (markDef.line !== undefined) { - // false or null - return null; - } else { - // undefined (not disabled) - if (markConfig.line) { - // enable line overlay if config[mark].line is truthy - return markConfig.line === true ? {} : markConfig.line; - } // markDef.point is defined as falsy - - - return undefined; - } - } - - var PathOverlayNormalizer = /*#__PURE__*/function () { - function PathOverlayNormalizer() { - _classCallCheck(this, PathOverlayNormalizer); - - this.name = 'path-overlay'; - } - - _createClass(PathOverlayNormalizer, [{ - key: "hasMatchingType", - value: function hasMatchingType(spec, config) { - if (isUnitSpec(spec)) { - var mark = spec.mark, - encoding = spec.encoding; - var markDef = isMarkDef(mark) ? mark : { - type: mark - }; - - switch (markDef.type) { - case 'line': - case 'rule': - case 'trail': - return !!getPointOverlay(markDef, config[markDef.type], encoding); - - case 'area': - return (// false / null are also included as we want to remove the properties - !!getPointOverlay(markDef, config[markDef.type], encoding) || !!getLineOverlay(markDef, config[markDef.type]) - ); - } - } - - return false; - } - }, { - key: "run", - value: function run(spec, params, normalize) { - var config = params.config; - - var selection = spec.selection, - projection = spec.projection, - mark = spec.mark, - e = spec.encoding, - outerSpec = __rest(spec, ["selection", "projection", "mark", "encoding"]); // Need to call normalizeEncoding because we need the inferred types to correctly determine stack - - - var encoding = normalizeEncoding(e, config); - var markDef = isMarkDef(mark) ? mark : { - type: mark - }; - var pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding); - var lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]); - var layer = [Object.assign(Object.assign({}, selection ? { - selection: selection - } : {}), { - mark: dropLineAndPoint(Object.assign(Object.assign({}, markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined ? { - opacity: 0.7 - } : {}), markDef)), - // drop shape from encoding as this might be used to trigger point overlay - encoding: omit(encoding, ['shape']) - })]; // FIXME: determine rules for applying selections. - // Need to copy stack config to overlayed layer - - var stackProps = stack(markDef, encoding); - var overlayEncoding = encoding; - - if (stackProps) { - var stackFieldChannel = stackProps.fieldChannel, - offset = stackProps.offset; - overlayEncoding = Object.assign(Object.assign({}, encoding), _defineProperty({}, stackFieldChannel, Object.assign(Object.assign({}, encoding[stackFieldChannel]), offset ? { - stack: offset - } : {}))); - } - - if (lineOverlay) { - layer.push(Object.assign(Object.assign({}, projection ? { - projection: projection - } : {}), { - mark: Object.assign(Object.assign({ - type: 'line' - }, pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip'])), lineOverlay), - encoding: overlayEncoding - })); - } - - if (pointOverlay) { - layer.push(Object.assign(Object.assign({}, projection ? { - projection: projection - } : {}), { - mark: Object.assign(Object.assign({ - type: 'point', - opacity: 1, - filled: true - }, pick(markDef, ['clip', 'tooltip'])), pointOverlay), - encoding: overlayEncoding - })); - } - - return normalize(Object.assign(Object.assign({}, outerSpec), { - layer: layer - }), Object.assign(Object.assign({}, params), { - config: dropLineAndPointFromConfig(config) - })); - } - }]); - - return PathOverlayNormalizer; - }(); - - var RangeStepNormalizer = /*#__PURE__*/function () { - function RangeStepNormalizer() { - _classCallCheck(this, RangeStepNormalizer); - - this.name = 'RangeStep'; - } - - _createClass(RangeStepNormalizer, [{ - key: "hasMatchingType", - value: function hasMatchingType(spec) { - var _a; - - if (isUnitSpec(spec) && spec.encoding) { - var _iterator35 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS), - _step35; - - try { - for (_iterator35.s(); !(_step35 = _iterator35.n()).done;) { - var channel = _step35.value; - var def = spec.encoding[channel]; - - if (def && isFieldOrDatumDef(def)) { - if ((_a = def === null || def === void 0 ? void 0 : def.scale) === null || _a === void 0 ? void 0 : _a['rangeStep']) { - return true; - } - } - } - } catch (err) { - _iterator35.e(err); - } finally { - _iterator35.f(); - } - } - - return false; - } - }, { - key: "run", - value: function run(spec) { - var _a; - - var sizeMixins = {}; - var encoding = Object.assign({}, spec.encoding); - - var _iterator36 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS), - _step36; - - try { - for (_iterator36.s(); !(_step36 = _iterator36.n()).done;) { - var channel = _step36.value; - var sizeType = getSizeChannel(channel); - var def = encoding[channel]; - - if (def && isFieldOrDatumDef(def)) { - if ((_a = def === null || def === void 0 ? void 0 : def.scale) === null || _a === void 0 ? void 0 : _a['rangeStep']) { - var scale = def.scale, - defWithoutScale = __rest(def, ["scale"]); - - var _b = scale, - scaleWithoutRangeStep = __rest(_b, ["rangeStep"]); - - sizeMixins[sizeType] = { - step: scale['rangeStep'] - }; - warn(RANGE_STEP_DEPRECATED); - encoding = Object.assign(Object.assign({}, encoding), _defineProperty({}, channel, Object.assign(Object.assign({}, defWithoutScale), isEmpty(scaleWithoutRangeStep) ? {} : { - scale: scaleWithoutRangeStep - }))); - } - } - } - } catch (err) { - _iterator36.e(err); - } finally { - _iterator36.f(); - } - - return Object.assign(Object.assign(Object.assign({}, sizeMixins), spec), { - encoding: encoding - }); - } - }]); - - return RangeStepNormalizer; - }(); - - function replaceRepeaterInFacet(facet, repeater) { - if (!repeater) { - return facet; - } - - if (isFacetMapping(facet)) { - return replaceRepeaterInMapping(facet, repeater); - } - - return replaceRepeaterInFieldDef(facet, repeater); - } - - function replaceRepeaterInEncoding(encoding, repeater) { - if (!repeater) { - return encoding; - } - - return replaceRepeaterInMapping(encoding, repeater); - } - /** - * Replaces repeated value and returns if the repeated value is valid. - */ - - - function replaceRepeatInProp(prop, o, repeater) { - var val = o[prop]; - - if (isRepeatRef(val)) { - if (val.repeat in repeater) { - return Object.assign(Object.assign({}, o), _defineProperty({}, prop, repeater[val.repeat])); - } else { - warn(noSuchRepeatedValue(val.repeat)); - return undefined; - } - } - - return o; - } - /** - * Replace repeater values in a field def with the concrete field name. - */ - - - function replaceRepeaterInFieldDef(fieldDef, repeater) { - fieldDef = replaceRepeatInProp('field', fieldDef, repeater); - - if (fieldDef === undefined) { - // the field def should be ignored - return undefined; - } else if (fieldDef === null) { - return null; - } - - if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) { - var sort = replaceRepeatInProp('field', fieldDef.sort, repeater); - fieldDef = Object.assign(Object.assign({}, fieldDef), sort ? { - sort: sort - } : {}); - } - - return fieldDef; - } - - function replaceRepeaterInFieldOrDatumDef(def, repeater) { - if (isFieldDef(def)) { - return replaceRepeaterInFieldDef(def, repeater); - } else { - var datumDef = replaceRepeatInProp('datum', def, repeater); - - if (datumDef !== def && !datumDef.type) { - datumDef.type = 'nominal'; - } - - return datumDef; - } - } - - function replaceRepeaterInChannelDef(channelDef, repeater) { - if (isFieldOrDatumDef(channelDef)) { - var fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater); - - if (fd) { - return fd; - } else if (isConditionalDef(channelDef)) { - return { - condition: channelDef.condition - }; - } - } else { - if (hasConditionalFieldOrDatumDef(channelDef)) { - var _fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater); - - if (_fd) { - return Object.assign(Object.assign({}, channelDef), { - condition: _fd - }); - } else { - var channelDefWithoutCondition = __rest(channelDef, ["condition"]); - - return channelDefWithoutCondition; - } - } - - return channelDef; - } - - return undefined; - } - - function replaceRepeaterInMapping(mapping, repeater) { - var out = {}; - - for (var channel in mapping) { - if (hasOwnProperty(mapping, channel)) { - var channelDef = mapping[channel]; - - if (isArray(channelDef)) { - // array cannot have condition - out[channel] = channelDef // somehow we need to cast it here - .map(function (cd) { - return replaceRepeaterInChannelDef(cd, repeater); - }).filter(function (cd) { - return cd; - }); - } else { - var cd = replaceRepeaterInChannelDef(channelDef, repeater); - - if (cd !== undefined) { - out[channel] = cd; - } - } - } - } - - return out; - } - - var RuleForRangedLineNormalizer = /*#__PURE__*/function () { - function RuleForRangedLineNormalizer() { - _classCallCheck(this, RuleForRangedLineNormalizer); - - this.name = 'RuleForRangedLine'; - } - - _createClass(RuleForRangedLineNormalizer, [{ - key: "hasMatchingType", - value: function hasMatchingType(spec) { - if (isUnitSpec(spec)) { - var encoding = spec.encoding, - mark = spec.mark; - - if (mark === 'line') { - var _iterator37 = _createForOfIteratorHelper(SECONDARY_RANGE_CHANNEL), - _step37; - - try { - for (_iterator37.s(); !(_step37 = _iterator37.n()).done;) { - var channel = _step37.value; - var mainChannel = getMainRangeChannel(channel); - var mainChannelDef = encoding[mainChannel]; - - if (encoding[channel]) { - if (isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin) || isDatumDef(mainChannelDef)) { - return true; - } - } - } - } catch (err) { - _iterator37.e(err); - } finally { - _iterator37.f(); - } - } - } - - return false; - } - }, { - key: "run", - value: function run(spec, params, normalize) { - var encoding = spec.encoding; - warn(lineWithRange(!!encoding.x2, !!encoding.y2)); - return normalize(Object.assign(Object.assign({}, spec), { - mark: 'rule' - }), params); - } - }]); - - return RuleForRangedLineNormalizer; - }(); - - var CoreNormalizer = /*#__PURE__*/function (_SpecMapper) { - _inherits(CoreNormalizer, _SpecMapper); - - var _super = _createSuper(CoreNormalizer); - - function CoreNormalizer() { - var _this5; - - _classCallCheck(this, CoreNormalizer); - - _this5 = _super.apply(this, arguments); - _this5.nonFacetUnitNormalizers = [boxPlotNormalizer, errorBarNormalizer, errorBandNormalizer, new PathOverlayNormalizer(), new RuleForRangedLineNormalizer(), new RangeStepNormalizer()]; - return _this5; - } - - _createClass(CoreNormalizer, [{ - key: "map", - value: function map(spec, params) { - // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec. - if (isUnitSpec(spec)) { - var hasRow = _channelHasField(spec.encoding, ROW); - - var hasColumn = _channelHasField(spec.encoding, COLUMN); - - var hasFacet = _channelHasField(spec.encoding, FACET); - - if (hasRow || hasColumn || hasFacet) { - return this.mapFacetedUnit(spec, params); - } - } - - return _get(_getPrototypeOf(CoreNormalizer.prototype), "map", this).call(this, spec, params); - } // This is for normalizing non-facet unit - - }, { - key: "mapUnit", - value: function mapUnit(spec, params) { - var parentEncoding = params.parentEncoding, - parentProjection = params.parentProjection; - var encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater); - var specWithReplacedEncoding = Object.assign(Object.assign({}, spec), encoding ? { - encoding: encoding - } : {}); - - if (parentEncoding || parentProjection) { - return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params); - } - - var normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this); - - var _iterator38 = _createForOfIteratorHelper(this.nonFacetUnitNormalizers), - _step38; - - try { - for (_iterator38.s(); !(_step38 = _iterator38.n()).done;) { - var unitNormalizer = _step38.value; - - if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) { - return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit); - } - } - } catch (err) { - _iterator38.e(err); - } finally { - _iterator38.f(); - } - - return specWithReplacedEncoding; - } - }, { - key: "mapRepeat", - value: function mapRepeat(spec, params) { - if (isLayerRepeatSpec(spec)) { - return this.mapLayerRepeat(spec, params); - } else { - return this.mapNonLayerRepeat(spec, params); - } - } - }, { - key: "mapLayerRepeat", - value: function mapLayerRepeat(spec, params) { - var _this6 = this; - - var repeat = spec.repeat, - childSpec = spec.spec, - rest = __rest(spec, ["repeat", "spec"]); - - var row = repeat.row, - column = repeat.column, - layer = repeat.layer; - var _params$repeater = params.repeater, - repeater = _params$repeater === void 0 ? {} : _params$repeater, - _params$repeaterPrefi = params.repeaterPrefix, - repeaterPrefix = _params$repeaterPrefi === void 0 ? '' : _params$repeaterPrefi; - - if (row || column) { - return this.mapRepeat(Object.assign(Object.assign({}, spec), { - repeat: Object.assign(Object.assign({}, row ? { - row: row - } : {}), column ? { - column: column - } : {}), - spec: { - repeat: { - layer: layer - }, - spec: childSpec - } - }), params); - } else { - return Object.assign(Object.assign({}, rest), { - layer: layer.map(function (layerValue) { - var childRepeater = Object.assign(Object.assign({}, repeater), { - layer: layerValue - }); - var childName = (childSpec.name || '') + repeaterPrefix + "child__layer_".concat(varName(layerValue)); - - var child = _this6.mapLayerOrUnit(childSpec, Object.assign(Object.assign({}, params), { - repeater: childRepeater, - repeaterPrefix: childName - })); - - child.name = childName; - return child; - }) - }); - } - } - }, { - key: "mapNonLayerRepeat", - value: function mapNonLayerRepeat(spec, params) { - var _a; - - var _spec2 = spec, - repeat = _spec2.repeat, - childSpec = _spec2.spec, - data = _spec2.data, - remainingProperties = __rest(spec, ["repeat", "spec", "data"]); - - if (!isArray(repeat) && spec.columns) { - // is repeat with row/column - spec = omit(spec, ['columns']); - warn(columnsNotSupportByRowCol('repeat')); - } - - var concat = []; - var _params$repeater2 = params.repeater, - repeater = _params$repeater2 === void 0 ? {} : _params$repeater2, - _params$repeaterPrefi2 = params.repeaterPrefix, - repeaterPrefix = _params$repeaterPrefi2 === void 0 ? '' : _params$repeaterPrefi2; - var row = !isArray(repeat) && repeat.row || [repeater ? repeater.row : null]; - var column = !isArray(repeat) && repeat.column || [repeater ? repeater.column : null]; - var repeatValues = isArray(repeat) && repeat || [repeater ? repeater.repeat : null]; // cross product - - var _iterator39 = _createForOfIteratorHelper(repeatValues), - _step39; - - try { - for (_iterator39.s(); !(_step39 = _iterator39.n()).done;) { - var repeatValue = _step39.value; - - var _iterator40 = _createForOfIteratorHelper(row), - _step40; - - try { - for (_iterator40.s(); !(_step40 = _iterator40.n()).done;) { - var rowValue = _step40.value; - - var _iterator41 = _createForOfIteratorHelper(column), - _step41; - - try { - for (_iterator41.s(); !(_step41 = _iterator41.n()).done;) { - var columnValue = _step41.value; - var childRepeater = { - repeat: repeatValue, - row: rowValue, - column: columnValue, - layer: repeater.layer - }; - var childName = (childSpec.name || '') + repeaterPrefix + 'child__' + (isArray(repeat) ? "".concat(varName(repeatValue)) : (repeat.row ? "row_".concat(varName(rowValue)) : '') + (repeat.column ? "column_".concat(varName(columnValue)) : '')); - var child = this.map(childSpec, Object.assign(Object.assign({}, params), { - repeater: childRepeater, - repeaterPrefix: childName - })); - child.name = childName; // we move data up - - concat.push(omit(child, ['data'])); - } - } catch (err) { - _iterator41.e(err); - } finally { - _iterator41.f(); - } - } - } catch (err) { - _iterator40.e(err); - } finally { - _iterator40.f(); - } - } - } catch (err) { - _iterator39.e(err); - } finally { - _iterator39.f(); - } - - var columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1; - return Object.assign(Object.assign({ - data: (_a = childSpec.data) !== null && _a !== void 0 ? _a : data, - align: 'all' - }, remainingProperties), { - columns: columns, - concat: concat - }); - } - }, { - key: "mapFacet", - value: function mapFacet(spec, params) { - var _spec3 = spec, - facet = _spec3.facet; - - if (isFacetMapping(facet) && spec.columns) { - // is facet with row/column - spec = omit(spec, ['columns']); - warn(columnsNotSupportByRowCol('facet')); - } - - return _get(_getPrototypeOf(CoreNormalizer.prototype), "mapFacet", this).call(this, spec, params); - } - }, { - key: "mapUnitWithParentEncodingOrProjection", - value: function mapUnitWithParentEncodingOrProjection(spec, params) { - var encoding = spec.encoding, - projection = spec.projection; - var parentEncoding = params.parentEncoding, - parentProjection = params.parentProjection, - config = params.config; - var mergedProjection = mergeProjection({ - parentProjection: parentProjection, - projection: projection - }); - var mergedEncoding = mergeEncoding({ - parentEncoding: parentEncoding, - encoding: replaceRepeaterInEncoding(encoding, params.repeater) - }); - return this.mapUnit(Object.assign(Object.assign(Object.assign({}, spec), mergedProjection ? { - projection: mergedProjection - } : {}), mergedEncoding ? { - encoding: mergedEncoding - } : {}), { - config: config - }); - } - }, { - key: "mapFacetedUnit", - value: function mapFacetedUnit(spec, params) { - // New encoding in the inside spec should not contain row / column - // as row/column should be moved to facet - var _a = spec.encoding, - row = _a.row, - column = _a.column, - facet = _a.facet, - encoding = __rest(_a, ["row", "column", "facet"]); // Mark and encoding should be moved into the inner spec - - - var mark = spec.mark, - width = spec.width, - projection = spec.projection, - height = spec.height, - view = spec.view, - selection = spec.selection, - _ = spec.encoding, - outerSpec = __rest(spec, ["mark", "width", "projection", "height", "view", "selection", "encoding"]); - - var _this$getFacetMapping = this.getFacetMappingAndLayout({ - row: row, - column: column, - facet: facet - }, params), - facetMapping = _this$getFacetMapping.facetMapping, - layout = _this$getFacetMapping.layout; - - var newEncoding = replaceRepeaterInEncoding(encoding, params.repeater); - return this.mapFacet(Object.assign(Object.assign(Object.assign({}, outerSpec), layout), { - // row / column has higher precedence than facet - facet: facetMapping, - spec: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, width ? { - width: width - } : {}), height ? { - height: height - } : {}), view ? { - view: view - } : {}), projection ? { - projection: projection - } : {}), { - mark: mark, - encoding: newEncoding - }), selection ? { - selection: selection - } : {}) - }), params); - } - }, { - key: "getFacetMappingAndLayout", - value: function getFacetMappingAndLayout(facets, params) { - var _a; - - var row = facets.row, - column = facets.column, - facet = facets.facet; - - if (row || column) { - if (facet) { - warn(facetChannelDropped([].concat(_toConsumableArray(row ? [ROW] : []), _toConsumableArray(column ? [COLUMN] : [])))); - } - - var facetMapping = {}; - var layout = {}; - - for (var _i6 = 0, _arr4 = [ROW, COLUMN]; _i6 < _arr4.length; _i6++) { - var channel = _arr4[_i6]; - var def = facets[channel]; - - if (def) { - var defWithoutLayout = __rest(def, ["align", "center", "spacing", "columns"]); - - facetMapping[channel] = defWithoutLayout; - - for (var _i7 = 0, _arr5 = ['align', 'center', 'spacing']; _i7 < _arr5.length; _i7++) { - var prop = _arr5[_i7]; - - if (def[prop] !== undefined) { - layout[prop] = (_a = layout[prop]) !== null && _a !== void 0 ? _a : {}; - layout[prop][channel] = def[prop]; - } - } - } - } - - return { - facetMapping: facetMapping, - layout: layout - }; - } else { - var _align = facet.align, - center = facet.center, - spacing = facet.spacing, - columns = facet.columns, - _facetMapping = __rest(facet, ["align", "center", "spacing", "columns"]); - - return { - facetMapping: replaceRepeaterInFacet(_facetMapping, params.repeater), - layout: Object.assign(Object.assign(Object.assign(Object.assign({}, _align ? { - align: _align - } : {}), center ? { - center: center - } : {}), spacing ? { - spacing: spacing - } : {}), columns ? { - columns: columns - } : {}) - }; - } - } - }, { - key: "mapLayer", - value: function mapLayer(spec, _a) { - // Special handling for extended layer spec - var parentEncoding = _a.parentEncoding, - parentProjection = _a.parentProjection, - otherParams = __rest(_a, ["parentEncoding", "parentProjection"]); - - var encoding = spec.encoding, - projection = spec.projection, - rest = __rest(spec, ["encoding", "projection"]); - - var params = Object.assign(Object.assign({}, otherParams), { - parentEncoding: mergeEncoding({ - parentEncoding: parentEncoding, - encoding: encoding, - layer: true - }), - parentProjection: mergeProjection({ - parentProjection: parentProjection, - projection: projection - }) - }); - return _get(_getPrototypeOf(CoreNormalizer.prototype), "mapLayer", this).call(this, rest, params); - } - }]); - - return CoreNormalizer; - }(SpecMapper); - - function mergeEncoding(_ref19) { - var parentEncoding = _ref19.parentEncoding, - _ref19$encoding = _ref19.encoding, - encoding = _ref19$encoding === void 0 ? {} : _ref19$encoding, - layer = _ref19.layer; - var merged = {}; - - if (parentEncoding) { - var channels = new Set([].concat(_toConsumableArray(keys(parentEncoding)), _toConsumableArray(keys(encoding)))); - - var _iterator42 = _createForOfIteratorHelper(channels), - _step42; - - try { - for (_iterator42.s(); !(_step42 = _iterator42.n()).done;) { - var channel = _step42.value; - var channelDef = encoding[channel]; - var parentChannelDef = parentEncoding[channel]; - - if (isFieldOrDatumDef(channelDef)) { - // Field/Datum Def can inherit properties from its parent - // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one. - var mergedChannelDef = Object.assign(Object.assign({}, parentChannelDef), channelDef); - merged[channel] = mergedChannelDef; - } else if (hasConditionalFieldOrDatumDef(channelDef)) { - merged[channel] = Object.assign(Object.assign({}, channelDef), { - condition: Object.assign(Object.assign({}, parentChannelDef), channelDef.condition) - }); - } else if (channelDef) { - merged[channel] = channelDef; - } else if (layer || isValueDef(parentChannelDef) || isSignalRef(parentChannelDef) || isFieldOrDatumDef(parentChannelDef) || isArray(parentChannelDef)) { - merged[channel] = parentChannelDef; - } - } - } catch (err) { - _iterator42.e(err); - } finally { - _iterator42.f(); - } - } else { - merged = encoding; - } - - return !merged || isEmpty(merged) ? undefined : merged; - } - - function mergeProjection(opt) { - var parentProjection = opt.parentProjection, - projection = opt.projection; - - if (parentProjection && projection) { - warn(projectionOverridden({ - parentProjection: parentProjection, - projection: projection - })); - } - - return projection !== null && projection !== void 0 ? projection : parentProjection; - } - - function normalize(spec, config) { - if (config === undefined) { - config = initConfig(spec.config); - } - - var normalizedSpec = normalizeGenericSpec(spec, config); - var width = spec.width, - height = spec.height; - var autosize = normalizeAutoSize(normalizedSpec, { - width: width, - height: height, - autosize: spec.autosize - }, config); - return Object.assign(Object.assign({}, normalizedSpec), autosize ? { - autosize: autosize - } : {}); - } - - var normalizer = new CoreNormalizer(); - /** - * Decompose extended unit specs into composition of pure unit specs. - */ - - function normalizeGenericSpec(spec) { - var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - return normalizer.map(spec, { - config: config - }); - } - - function _normalizeAutoSize(autosize) { - return isString(autosize) ? { - type: autosize - } : autosize !== null && autosize !== void 0 ? autosize : {}; - } - /** - * Normalize autosize and deal with width or height == "container". - */ - - - function normalizeAutoSize(spec, sizeInfo, config) { - var width = sizeInfo.width, - height = sizeInfo.height; - var isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec); - var autosizeDefault = {}; - - if (!isFitCompatible) { - // If spec is not compatible with autosize == "fit", discard width/height == container - if (width == 'container') { - warn(containerSizeNonSingle('width')); - width = undefined; - } - - if (height == 'container') { - warn(containerSizeNonSingle('height')); - height = undefined; - } - } else { - // Default autosize parameters to fit when width/height is "container" - if (width == 'container' && height == 'container') { - autosizeDefault.type = 'fit'; - autosizeDefault.contains = 'padding'; - } else if (width == 'container') { - autosizeDefault.type = 'fit-x'; - autosizeDefault.contains = 'padding'; - } else if (height == 'container') { - autosizeDefault.type = 'fit-y'; - autosizeDefault.contains = 'padding'; - } - } - - var autosize = Object.assign(Object.assign(Object.assign({ - type: 'pad' - }, autosizeDefault), config ? _normalizeAutoSize(config.autosize) : {}), _normalizeAutoSize(spec.autosize)); - - if (autosize.type === 'fit' && !isFitCompatible) { - warn(FIT_NON_SINGLE); - autosize.type = 'pad'; - } - - if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) { - warn(containerSizeNotCompatibleWithAutosize('width')); - } - - if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) { - warn(containerSizeNotCompatibleWithAutosize('height')); - } // Delete autosize property if it's Vega's default - - - if (deepEqual(autosize, { - type: 'pad' - })) { - return undefined; - } - - return autosize; - } - - function isFitType(autoSizeType) { - return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y'; - } - - function getFitType(sizeType) { - return sizeType ? "fit-".concat(getPositionScaleChannel(sizeType)) : 'fit'; - } - - var TOP_LEVEL_PROPERTIES = ['background', 'padding' // We do not include "autosize" here as it is supported by only unit and layer specs and thus need to be normalized - ]; - - function extractTopLevelProperties(t) { - return TOP_LEVEL_PROPERTIES.reduce(function (o, p) { - if (t && t[p] !== undefined) { - o[p] = t[p]; - } - - return o; - }, {}); - } - /** - * Generic class for storing properties that are explicitly specified - * and implicitly determined by the compiler. - * This is important for scale/axis/legend merging as - * we want to prioritize properties that users explicitly specified. - */ - // eslint-disable-next-line @typescript-eslint/ban-types - - - var Split = /*#__PURE__*/function () { - function Split() { - var explicit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var implicit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - _classCallCheck(this, Split); - - this.explicit = explicit; - this.implicit = implicit; - } - - _createClass(Split, [{ - key: "clone", - value: function clone() { - return new Split(duplicate(this.explicit), duplicate(this.implicit)); - } - }, { - key: "combine", - value: function combine() { - // FIXME remove "as any". - // Add "as any" to avoid an error "Spread types may only be created from object types". - return Object.assign(Object.assign({}, this.explicit), this.implicit); - } - }, { - key: "get", - value: function get(key) { - // Explicit has higher precedence - return getFirstDefined(this.explicit[key], this.implicit[key]); - } - }, { - key: "getWithExplicit", - value: function getWithExplicit(key) { - // Explicit has higher precedence - if (this.explicit[key] !== undefined) { - return { - explicit: true, - value: this.explicit[key] - }; - } else if (this.implicit[key] !== undefined) { - return { - explicit: false, - value: this.implicit[key] - }; - } - - return { - explicit: false, - value: undefined - }; - } - }, { - key: "setWithExplicit", - value: function setWithExplicit(key, value) { - if (value.value !== undefined) { - this.set(key, value.value, value.explicit); - } - } - }, { - key: "set", - value: function set(key, value, explicit) { - delete this[explicit ? 'implicit' : 'explicit'][key]; - this[explicit ? 'explicit' : 'implicit'][key] = value; - return this; - } - }, { - key: "copyKeyFromSplit", - value: function copyKeyFromSplit(key, s) { - // Explicit has higher precedence - if (s.explicit[key] !== undefined) { - this.set(key, s.explicit[key], true); - } else if (s.implicit[key] !== undefined) { - this.set(key, s.implicit[key], false); - } - } - }, { - key: "copyKeyFromObject", - value: function copyKeyFromObject(key, s) { - // Explicit has higher precedence - if (s[key] !== undefined) { - this.set(key, s[key], true); - } - } - /** - * Merge split object into this split object. Properties from the other split - * overwrite properties from this split. - */ - - }, { - key: "copyAll", - value: function copyAll(other) { - var _iterator43 = _createForOfIteratorHelper(keys(other.combine())), - _step43; - - try { - for (_iterator43.s(); !(_step43 = _iterator43.n()).done;) { - var key = _step43.value; - var val = other.getWithExplicit(key); - this.setWithExplicit(key, val); - } - } catch (err) { - _iterator43.e(err); - } finally { - _iterator43.f(); - } - } - }]); - - return Split; - }(); - - function makeExplicit(value) { - return { - explicit: true, - value: value - }; - } - - function makeImplicit(value) { - return { - explicit: false, - value: value - }; - } - - function tieBreakByComparing(compare) { - return function (v1, v2, property, propertyOf) { - var diff = compare(v1.value, v2.value); - - if (diff > 0) { - return v1; - } else if (diff < 0) { - return v2; - } - - return defaultTieBreaker(v1, v2, property, propertyOf); - }; - } - - function defaultTieBreaker(v1, v2, property, propertyOf) { - if (v1.explicit && v2.explicit) { - warn(mergeConflictingProperty(property, propertyOf, v1.value, v2.value)); - } // If equal score, prefer v1. - - - return v1; - } - - function mergeValuesWithExplicit(v1, v2, property, propertyOf) { - var tieBreaker = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : defaultTieBreaker; - - if (v1 === undefined || v1.value === undefined) { - // For first run - return v2; - } - - if (v1.explicit && !v2.explicit) { - return v1; - } else if (v2.explicit && !v1.explicit) { - return v2; - } else if (deepEqual(v1.value, v2.value)) { - return v1; - } else { - return tieBreaker(v1, v2, property, propertyOf); - } - } - /** - * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf) - * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the - * same field again (or differently). - */ - - - var AncestorParse = /*#__PURE__*/function (_Split) { - _inherits(AncestorParse, _Split); - - var _super2 = _createSuper(AncestorParse); - - function AncestorParse() { - var _this7; - - var explicit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var implicit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var parseNothing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - _classCallCheck(this, AncestorParse); - - _this7 = _super2.call(this, explicit, implicit); - _this7.explicit = explicit; - _this7.implicit = implicit; - _this7.parseNothing = parseNothing; - return _this7; - } - - _createClass(AncestorParse, [{ - key: "clone", - value: function clone() { - var clone = _get(_getPrototypeOf(AncestorParse.prototype), "clone", this).call(this); - - clone.parseNothing = this.parseNothing; - return clone; - } - }]); - - return AncestorParse; - }(Split); - - function isUrlData(data) { - return 'url' in data; - } - - function isInlineData(data) { - return 'values' in data; - } - - function isNamedData(data) { - return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data); - } - - function isGenerator(data) { - return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data)); - } - - function isSequenceGenerator(data) { - return 'sequence' in data; - } - - function isSphereGenerator(data) { - return 'sphere' in data; - } - - function isGraticuleGenerator(data) { - return 'graticule' in data; - } - - var DataSourceType; - - (function (DataSourceType) { - DataSourceType[DataSourceType["Raw"] = 0] = "Raw"; - DataSourceType[DataSourceType["Main"] = 1] = "Main"; - DataSourceType[DataSourceType["Row"] = 2] = "Row"; - DataSourceType[DataSourceType["Column"] = 3] = "Column"; - DataSourceType[DataSourceType["Lookup"] = 4] = "Lookup"; - })(DataSourceType || (DataSourceType = {})); - - function isFilter(t) { - return 'filter' in t; - } - - function isImputeSequence(t) { - return (t === null || t === void 0 ? void 0 : t['stop']) !== undefined; - } - - function isLookup(t) { - return 'lookup' in t; - } - - function isLookupData(from) { - return 'data' in from; - } - - function isLookupSelection(from) { - return 'selection' in from; - } - - function isPivot(t) { - return 'pivot' in t; - } - - function isDensity(t) { - return 'density' in t; - } - - function isQuantile(t) { - return 'quantile' in t; - } - - function isRegression(t) { - return 'regression' in t; - } - - function isLoess(t) { - return 'loess' in t; - } - - function isSample(t) { - return 'sample' in t; - } - - function isWindow(t) { - return 'window' in t; - } - - function isJoinAggregate(t) { - return 'joinaggregate' in t; - } - - function isFlatten(t) { - return 'flatten' in t; - } - - function isCalculate(t) { - return 'calculate' in t; - } - - function isBin(t) { - return 'bin' in t; - } - - function isImpute(t) { - return 'impute' in t; - } - - function isTimeUnit(t) { - return 'timeUnit' in t; - } - - function isAggregate$1(t) { - return 'aggregate' in t; - } - - function isStack(t) { - return 'stack' in t; - } - - function isFold(t) { - return 'fold' in t; - } - - function normalizeTransform(transform) { - return transform.map(function (t) { - if (isFilter(t)) { - return { - filter: normalizeLogicalComposition(t.filter, normalizePredicate) - }; - } - - return t; - }); - } - /** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ - - - function parseSelector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector$1); - } - - var VIEW = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - - function isMarkType(type) { - return MARKS[type]; - } - - function find(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - - for (; i < n; ++i) { - c = s[i]; - if (!count && c === endChar) return i;else if (popChar && popChar.indexOf(c) >= 0) --count;else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - - return i; - } - - function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - - return output; - } - - function parseSelector$1(s) { - return s[0] === '[' ? parseBetween(s) : parseStream(s); - } - - function parseBetween(s) { - var n = s.length, - i = 1, - b, - stream; - i = find(s, i, RBRACK, LBRACK, RBRACK); - - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector$1); - stream = parseSelector$1(s.slice(1).trim()); - - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; - } - - function parseStream(s) { - var stream = { - source: DEFAULT_SOURCE - }, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, - j, - filter; // extract throttle from end - - if (s[n - 1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i + 1, n - 1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - - i = 0; - } - - if (!n) throw s; // set name flag based on first char - - if (s[0] === NAME) markname = ++i; // extract first part of multi-part stream selector - - j = find(s, i, COLON); - - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } // extract remaining part of stream selector - - - i = find(s, i, LBRACK); - - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } // extract filters - - - while (i < n) { - i = find(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } // marshall event stream specification - - - if (!(n = source.length) || ILLEGAL.test(source[n - 1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - return stream; - } - - function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function (_) { - var x = +_; - if (x !== x) throw s; - return x; - }); - } - /** - * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition - * or a simple mixin if channel def has no condition. - */ - - - function wrapCondition(model, channelDef, vgChannel, refFn) { - var condition = isConditionalDef(channelDef) && channelDef.condition; - var valueRef = refFn(channelDef); - - if (condition) { - var conditions = array(condition); - var vgConditions = conditions.map(function (c) { - var conditionValueRef = refFn(c); - var test = isConditionalSelection(c) ? parseSelectionPredicate(model, c.selection) // FIXME: remove casting once TS is no longer dumb about it - : expression(model, c.test); // FIXME: remove casting once TS is no longer dumb about it - - return Object.assign({ - test: test - }, conditionValueRef); - }); - return _defineProperty({}, vgChannel, [].concat(_toConsumableArray(vgConditions), _toConsumableArray(valueRef !== undefined ? [valueRef] : []))); - } else { - return valueRef !== undefined ? _defineProperty({}, vgChannel, valueRef) : {}; - } - } - - function text(model) { - var channel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text'; - var channelDef = model.encoding[channel]; - return wrapCondition(model, channelDef, channel, function (cDef) { - return textRef(cDef, model.config); - }); - } - - function textRef(channelDef, config) { - var expr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'datum'; - - // text - if (channelDef) { - if (isValueDef(channelDef)) { - return signalOrValueRef(channelDef.value); - } - - if (isFieldOrDatumDef(channelDef)) { - var _getFormatMixins2 = getFormatMixins(channelDef), - format = _getFormatMixins2.format, - formatType = _getFormatMixins2.formatType; - - return formatSignalRef({ - fieldOrDatumDef: channelDef, - format: format, - formatType: formatType, - expr: expr, - config: config - }); - } - } - - return undefined; - } - - function tooltip(model) { - var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var encoding = model.encoding, - markDef = model.markDef, - config = model.config, - stack = model.stack; - var channelDef = encoding.tooltip; - - if (isArray(channelDef)) { - return { - tooltip: tooltipRefForEncoding({ - tooltip: channelDef - }, stack, config, opt) - }; - } else { - var datum = opt.reactiveGeom ? 'datum.datum' : 'datum'; - return wrapCondition(model, channelDef, 'tooltip', function (cDef) { - // use valueRef based on channelDef first - var tooltipRefFromChannelDef = textRef(cDef, config, datum); - - if (tooltipRefFromChannelDef) { - return tooltipRefFromChannelDef; - } - - if (cDef === null) { - // Allow using encoding.tooltip = null to disable tooltip - return undefined; - } - - var markTooltip = getMarkPropOrConfig('tooltip', markDef, config); - - if (markTooltip === true) { - markTooltip = { - content: 'encoding' - }; - } - - if (isString(markTooltip)) { - return { - value: markTooltip - }; - } else if (isObject(markTooltip)) { - // `tooltip` is `{fields: 'encodings' | 'fields'}` - if (isSignalRef(markTooltip)) { - return markTooltip; - } else if (markTooltip.content === 'encoding') { - return tooltipRefForEncoding(encoding, stack, config, opt); - } else { - return { - signal: datum - }; - } - } - - return undefined; - }); - } - } - - function tooltipData(encoding, stack, config) { - var _ref22 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, - reactiveGeom = _ref22.reactiveGeom; - - var toSkip = {}; - var expr = reactiveGeom ? 'datum.datum' : 'datum'; - var tuples = []; - - function add(fDef, channel) { - var mainChannel = getMainRangeChannel(channel); - var fieldDef = isTypedFieldDef(fDef) ? fDef : Object.assign(Object.assign({}, fDef), { - type: encoding[mainChannel].type // for secondary field def, copy type from main channel - - }); - var title = fieldDef.title || defaultTitle(fieldDef, config); - var key = array(title).join(', '); - var value; - - if (isXorY(channel)) { - var channel2 = channel === 'x' ? 'x2' : 'y2'; - var fieldDef2 = getFieldDef(encoding[channel2]); - - if (isBinned(fieldDef.bin) && fieldDef2) { - var startField = _vgField(fieldDef, { - expr: expr - }); - - var endField = _vgField(fieldDef2, { - expr: expr - }); - - var _getFormatMixins3 = getFormatMixins(fieldDef), - format = _getFormatMixins3.format, - formatType = _getFormatMixins3.formatType; - - value = binFormatExpression(startField, endField, format, formatType, config); - toSkip[channel2] = true; - } else if (stack && stack.fieldChannel === channel && stack.offset === 'normalize') { - var _getFormatMixins4 = getFormatMixins(fieldDef), - _format3 = _getFormatMixins4.format, - _formatType3 = _getFormatMixins4.formatType; - - value = formatSignalRef({ - fieldOrDatumDef: fieldDef, - format: _format3, - formatType: _formatType3, - expr: expr, - config: config, - normalizeStack: true - }).signal; - } - } - - value = value !== null && value !== void 0 ? value : textRef(fieldDef, config, expr).signal; - tuples.push({ - channel: channel, - key: key, - value: value - }); - } - - forEach(encoding, function (channelDef, channel) { - if (isFieldDef(channelDef)) { - add(channelDef, channel); - } else if (hasConditionalFieldDef(channelDef)) { - add(channelDef.condition, channel); - } - }); - var out = {}; - - for (var _i8 = 0, _tuples = tuples; _i8 < _tuples.length; _i8++) { - var _tuples$_i = _tuples[_i8], - channel = _tuples$_i.channel, - key = _tuples$_i.key, - value = _tuples$_i.value; - - if (!toSkip[channel] && !out[key]) { - out[key] = value; - } - } - - return out; - } - - function tooltipRefForEncoding(encoding, stack, config) { - var _ref23 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, - reactiveGeom = _ref23.reactiveGeom; - - var data = tooltipData(encoding, stack, config, { - reactiveGeom: reactiveGeom - }); - var keyValues = entries(data).map(function (_ref24) { - var key = _ref24.key, - value = _ref24.value; - return "\"".concat(key, "\": ").concat(value); - }); - return keyValues.length > 0 ? { - signal: "{".concat(keyValues.join(', '), "}") - } : undefined; - } - - function aria(model) { - var markDef = model.markDef, - config = model.config; - var enableAria = getMarkPropOrConfig('aria', markDef, config); // We can ignore other aria properties if ariaHidden is true. - - if (enableAria === false) { - // getMarkGroups sets aria to false already so we don't have to set it in the encode block - return {}; - } - - return Object.assign(Object.assign(Object.assign({}, enableAria ? { - aria: enableAria - } : {}), ariaRoleDescription(model)), description(model)); - } - - function ariaRoleDescription(model) { - var mark = model.mark, - markDef = model.markDef, - config = model.config; - - if (config.aria === false) { - return {}; - } - - var ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config); - - if (ariaRoleDesc != null) { - return { - ariaRoleDescription: { - value: ariaRoleDesc - } - }; - } - - return mark in VG_MARK_INDEX ? {} : { - ariaRoleDescription: { - value: mark - } - }; - } - - function description(model) { - var encoding = model.encoding, - markDef = model.markDef, - config = model.config, - stack = model.stack; - var channelDef = encoding.description; - - if (channelDef) { - return wrapCondition(model, channelDef, 'description', function (cDef) { - return textRef(cDef, model.config); - }); - } // Use default from mark def or config if defined. - // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here. - - - var descriptionValue = getMarkPropOrConfig('description', markDef, config); - - if (descriptionValue != null) { - return { - description: signalOrValueRef(descriptionValue) - }; - } - - if (config.aria === false) { - return {}; - } - - var data = tooltipData(encoding, stack, config); - - if (isEmpty(data)) { - return undefined; - } - - return { - description: { - signal: entries(data).map(function (_ref25, index) { - var key = _ref25.key, - value = _ref25.value; - return "\"".concat(index > 0 ? '; ' : '').concat(key, ": \" + (").concat(value, ")"); - }).join(' + ') - } - }; - } - /** - * Return encode for non-positional channels with scales. (Text doesn't have scale.) - */ - - - function nonPosition(channel, model) { - var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var markDef = model.markDef, - encoding = model.encoding, - config = model.config; - var vgChannel = opt.vgChannel; - var defaultRef = opt.defaultRef, - defaultValue = opt.defaultValue; - - if (defaultRef === undefined) { - // prettier-ignore - defaultValue = defaultValue !== null && defaultValue !== void 0 ? defaultValue : getMarkPropOrConfig(channel, markDef, config, { - vgChannel: vgChannel, - ignoreVgConfig: true - }); - - if (defaultValue !== undefined) { - defaultRef = signalOrValueRef(defaultValue); - } - } - - var channelDef = encoding[channel]; - return wrapCondition(model, channelDef, vgChannel !== null && vgChannel !== void 0 ? vgChannel : channel, function (cDef) { - return midPoint({ - channel: channel, - channelDef: cDef, - markDef: markDef, - config: config, - scaleName: model.scaleName(channel), - scale: model.getScaleComponent(channel), - stack: null, - defaultRef: defaultRef - }); - }); - } - - function color(model) { - var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { - filled: undefined - }; - - var _a, _b, _c, _d; - - var markDef = model.markDef, - encoding = model.encoding, - config = model.config; - var markType = markDef.type; // Allow filled to be overridden (for trail's "filled") - - var filled = (_a = opt.filled) !== null && _a !== void 0 ? _a : getMarkPropOrConfig('filled', markDef, config); - var transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType) ? 'transparent' : undefined; - var defaultFill = (_c = (_b = getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, { - vgChannel: 'fill' - })) !== null && _b !== void 0 ? _b : // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified - config.mark[filled === true && 'color']) !== null && _c !== void 0 ? _c : // If there is no fill, always fill symbols, bar, geoshape - // with transparent fills https://github.com/vega/vega-lite/issues/1316 - transparentIfNeeded; - var defaultStroke = (_d = getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, { - vgChannel: 'stroke' - })) !== null && _d !== void 0 ? _d : // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified - config.mark[filled === false && 'color']; - var colorVgChannel = filled ? 'fill' : 'stroke'; - var fillStrokeMarkDefAndConfig = Object.assign(Object.assign({}, defaultFill ? { - fill: signalOrValueRef(defaultFill) - } : {}), defaultStroke ? { - stroke: signalOrValueRef(defaultStroke) - } : {}); - - if (markDef.color && (filled ? markDef.fill : markDef.stroke)) { - warn(droppingColor('property', { - fill: 'fill' in markDef, - stroke: 'stroke' in markDef - })); - } - - return Object.assign(Object.assign(Object.assign(Object.assign({}, fillStrokeMarkDefAndConfig), nonPosition('color', model, { - vgChannel: colorVgChannel, - defaultValue: filled ? defaultFill : defaultStroke - })), nonPosition('fill', model, { - // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding - defaultValue: encoding.fill ? defaultFill : undefined - })), nonPosition('stroke', model, { - // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding - defaultValue: encoding.stroke ? defaultStroke : undefined - })); - } - - function zindex(model) { - var encoding = model.encoding, - mark = model.mark; - var order = encoding.order; - - if (!isPathMark(mark) && isValueDef(order)) { - return wrapCondition(model, order, 'zindex', function (cd) { - return cd; - }); - } - - return {}; - } - - function getOffset(channel, markDef) { - var offsetChannel = getOffsetChannel(channel); // TODO: in the future read from encoding channel too - - var markDefOffsetValue = markDef[offsetChannel]; - - if (markDefOffsetValue) { - return markDefOffsetValue; - } - - return undefined; - } - /** - * Return encode for point (non-band) position channels. - */ - - - function pointPosition(channel, model, _ref26) { - var defaultPos = _ref26.defaultPos, - vgChannel = _ref26.vgChannel, - isMidPoint = _ref26.isMidPoint; - var encoding = model.encoding, - markDef = model.markDef, - config = model.config, - stack = model.stack; - var channelDef = encoding[channel]; - var channel2Def = encoding[getSecondaryRangeChannel(channel)]; - var scaleName = model.scaleName(channel); - var scale = model.getScaleComponent(channel); - var offset = getOffset(channel, markDef); // Get default position or position from mark def - - var defaultRef = pointPositionDefaultRef({ - model: model, - defaultPos: defaultPos, - channel: channel, - scaleName: scaleName, - scale: scale - }); - var valueRef = !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude) ? // use geopoint output if there are lat/long and there is no point position overriding lat/long. - { - field: model.getName(channel) - } : positionRef({ - channel: channel, - channelDef: channelDef, - channel2Def: channel2Def, - markDef: markDef, - config: config, - isMidPoint: isMidPoint, - scaleName: scaleName, - scale: scale, - stack: stack, - offset: offset, - defaultRef: defaultRef - }); - return valueRef ? _defineProperty({}, vgChannel || channel, valueRef) : undefined; - } // TODO: we need to find a way to refactor these so that scaleName is a part of scale - // but that's complicated. For now, this is a huge step moving forward. - - /** - * @return Vega ValueRef for normal x- or y-position without projection - */ - - - function positionRef(params) { - var channel = params.channel, - channelDef = params.channelDef, - isMidPoint = params.isMidPoint, - scaleName = params.scaleName, - stack = params.stack, - offset = params.offset, - markDef = params.markDef, - config = params.config; // This isn't a part of midPoint because we use midPoint for non-position too - - if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) { - if (isFieldDef(channelDef)) { - var band = getBand({ - channel: channel, - fieldDef: channelDef, - isMidPoint: isMidPoint, - markDef: markDef, - stack: stack, - config: config - }); - - if (band !== undefined) { - return interpolatedSignalRef({ - scaleName: scaleName, - fieldOrDatumDef: channelDef, - startSuffix: 'start', - band: band, - offset: offset - }); - } - } // x or y use stack_end so that stacked line's point mark use stack_end too. - - - return valueRefForFieldOrDatumDef(channelDef, scaleName, { - suffix: 'end' - }, { - offset: offset - }); - } - - return midPointRefWithPositionInvalidTest(params); - } - - function pointPositionDefaultRef(_ref28) { - var model = _ref28.model, - defaultPos = _ref28.defaultPos, - channel = _ref28.channel, - scaleName = _ref28.scaleName, - scale = _ref28.scale; - var markDef = model.markDef, - config = model.config; - return function () { - var mainChannel = getMainRangeChannel(channel); - var vgChannel = getVgPositionChannel(channel); - var definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, { - vgChannel: vgChannel - }); - - if (definedValueOrConfig !== undefined) { - return widthHeightValueOrSignalRef(channel, definedValueOrConfig); - } - - switch (defaultPos) { - case 'zeroOrMin': - case 'zeroOrMax': - if (scaleName) { - var _scaleType2 = scale.get('type'); - - if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], _scaleType2)) ;else { - if (scale.domainDefinitelyIncludesZero()) { - return { - scale: scaleName, - value: 0 - }; - } - } - } - - if (defaultPos === 'zeroOrMin') { - return mainChannel === 'y' ? { - field: { - group: 'height' - } - } : { - value: 0 - }; - } else { - // zeroOrMax - switch (mainChannel) { - case 'radius': - // max of radius is min(width, height) / 2 - return { - signal: "min(".concat(model.width.signal, ",").concat(model.height.signal, ")/2") - }; - - case 'theta': - return { - signal: '2*PI' - }; - - case 'x': - return { - field: { - group: 'width' - } - }; - - case 'y': - return { - value: 0 - }; - } - } - - break; - - case 'mid': - { - var sizeRef = model[getSizeChannel(channel)]; - return Object.assign(Object.assign({}, sizeRef), { - mult: 0.5 - }); - } - } // defaultPos === null - - - return undefined; - }; - } - - var ALIGNED_X_CHANNEL = { - left: 'x', - center: 'xc', - right: 'x2' - }; - var BASELINED_Y_CHANNEL = { - top: 'y', - middle: 'yc', - bottom: 'y2' - }; - - function vgAlignedPositionChannel(channel, markDef, config) { - var defaultAlign = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'middle'; - - if (channel === 'radius' || channel === 'theta') { - return getVgPositionChannel(channel); - } - - var alignChannel = channel === 'x' ? 'align' : 'baseline'; - var align = getMarkPropOrConfig(alignChannel, markDef, config); - - if (channel === 'x') { - return ALIGNED_X_CHANNEL[align || (defaultAlign === 'top' ? 'left' : 'center')]; - } else { - return BASELINED_Y_CHANNEL[align || defaultAlign]; - } - } - /** - * Utility for area/rule position, which can be either point or range. (One of the axes should be point and the other should be range.) - */ - - - function pointOrRangePosition(channel, model, _ref29) { - var defaultPos = _ref29.defaultPos, - defaultPos2 = _ref29.defaultPos2, - range = _ref29.range; - - if (range) { - return rangePosition(channel, model, { - defaultPos: defaultPos, - defaultPos2: defaultPos2 - }); - } - - return pointPosition(channel, model, { - defaultPos: defaultPos - }); - } - - function rangePosition(channel, model, _ref30) { - var defaultPos = _ref30.defaultPos, - defaultPos2 = _ref30.defaultPos2; - var markDef = model.markDef, - config = model.config; - var channel2 = getSecondaryRangeChannel(channel); - var sizeChannel = getSizeChannel(channel); - var pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2); - var vgChannel = pos2Mixins[sizeChannel] ? // If there is width/height, we need to position the marks based on the alignment. - vgAlignedPositionChannel(channel, markDef, config) : // Otherwise, make sure to apply to the right Vg Channel (for arc mark) - getVgPositionChannel(channel); - return Object.assign(Object.assign({}, pointPosition(channel, model, { - defaultPos: defaultPos, - vgChannel: vgChannel - })), pos2Mixins); - } - /** - * Return encode for x2, y2. - * If channel is not specified, return one channel based on orientation. - */ - - - function pointPosition2OrSize(model, defaultPos, channel) { - var _position2orSize; - - var encoding = model.encoding, - mark = model.mark, - markDef = model.markDef, - stack = model.stack, - config = model.config; - var baseChannel = getMainRangeChannel(channel); - var sizeChannel = getSizeChannel(channel); - var vgChannel = getVgPositionChannel(channel); - var channelDef = encoding[baseChannel]; - var scaleName = model.scaleName(baseChannel); - var scale = model.getScaleComponent(baseChannel); - var offset = channel in encoding || channel in markDef ? getOffset(channel, model.markDef) : getOffset(baseChannel, model.markDef); - - if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) { - // use geopoint output if there are lat2/long2 and there is no point position2 overriding lat2/long2. - return _defineProperty({}, vgChannel, { - field: model.getName(channel) - }); - } - - var valueRef = position2Ref({ - channel: channel, - channelDef: channelDef, - channel2Def: encoding[channel], - markDef: markDef, - config: config, - scaleName: scaleName, - scale: scale, - stack: stack, - offset: offset, - defaultRef: undefined - }); - - if (valueRef !== undefined) { - return _defineProperty({}, vgChannel, valueRef); - } // TODO: check width/height encoding here once we add them - // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence: - // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark) - - - return position2orSize(channel, markDef) || position2orSize(channel, (_position2orSize = {}, _defineProperty(_position2orSize, channel, getMarkStyleConfig(channel, markDef, config.style)), _defineProperty(_position2orSize, sizeChannel, getMarkStyleConfig(sizeChannel, markDef, config.style)), _position2orSize)) || position2orSize(channel, config[mark]) || position2orSize(channel, config.mark) || _defineProperty({}, vgChannel, pointPositionDefaultRef({ - model: model, - defaultPos: defaultPos, - channel: channel, - scaleName: scaleName, - scale: scale - })()); - } - - function position2Ref(_ref34) { - var channel = _ref34.channel, - channelDef = _ref34.channelDef, - channel2Def = _ref34.channel2Def, - markDef = _ref34.markDef, - config = _ref34.config, - scaleName = _ref34.scaleName, - scale = _ref34.scale, - stack = _ref34.stack, - offset = _ref34.offset, - defaultRef = _ref34.defaultRef; - - if (isFieldOrDatumDef(channelDef) && stack && // If fieldChannel is X and channel is X2 (or Y and Y2) - channel.charAt(0) === stack.fieldChannel.charAt(0)) { - return valueRefForFieldOrDatumDef(channelDef, scaleName, { - suffix: 'start' - }, { - offset: offset - }); - } - - return midPointRefWithPositionInvalidTest({ - channel: channel, - channelDef: channel2Def, - scaleName: scaleName, - scale: scale, - stack: stack, - markDef: markDef, - config: config, - offset: offset, - defaultRef: defaultRef - }); - } - - function position2orSize(channel, markDef) { - var sizeChannel = getSizeChannel(channel); - var vgChannel = getVgPositionChannel(channel); - - if (markDef[vgChannel] !== undefined) { - return _defineProperty({}, vgChannel, widthHeightValueOrSignalRef(channel, markDef[vgChannel])); - } else if (markDef[channel] !== undefined) { - return _defineProperty({}, vgChannel, widthHeightValueOrSignalRef(channel, markDef[channel])); - } else if (markDef[sizeChannel]) { - return _defineProperty({}, sizeChannel, widthHeightValueOrSignalRef(channel, markDef[sizeChannel])); - } - - return undefined; - } - - function rectPosition(model, channel, mark) { - var _a, _b, _c, _d; - - var config = model.config, - encoding = model.encoding, - markDef = model.markDef, - stack = model.stack; - var channel2 = getSecondaryRangeChannel(channel); - var sizeChannel = getSizeChannel(channel); - var channelDef = encoding[channel]; - var channelDef2 = encoding[channel2]; - var scale = model.getScaleComponent(channel); - var scaleType = scale ? scale.get('type') : undefined; - var scaleName = model.scaleName(channel); - var orient = markDef.orient; - var hasSizeDef = (_b = (_a = encoding[sizeChannel]) !== null && _a !== void 0 ? _a : encoding.size) !== null && _b !== void 0 ? _b : getMarkPropOrConfig('size', markDef, config, { - vgChannel: sizeChannel - }); - var isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal'); // x, x2, and width -- we must specify two of these in all conditions - - if (isFieldDef(channelDef) && (isBinning(channelDef.bin) || isBinned(channelDef.bin) || channelDef.timeUnit && !channelDef2) && !hasSizeDef && !hasDiscreteDomain(scaleType)) { - var band = getBand({ - channel: channel, - fieldDef: channelDef, - stack: stack, - markDef: markDef, - config: config - }); - var axis = (_c = model.component.axes[channel]) === null || _c === void 0 ? void 0 : _c[0]; - var axisTranslate = (_d = axis === null || axis === void 0 ? void 0 : axis.get('translate')) !== null && _d !== void 0 ? _d : 0.5; // vega default is 0.5 - - return rectBinPosition({ - fieldDef: channelDef, - fieldDef2: channelDef2, - channel: channel, - markDef: markDef, - scaleName: scaleName, - band: band, - axisTranslate: axisTranslate, - spacing: isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) : undefined, - reverse: scale.get('reverse'), - config: config - }); - } else if ((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType) || isBarBand) && !channelDef2) { - return positionAndSize(mark, channelDef, channel, model); - } else { - return rangePosition(channel, model, { - defaultPos: 'zeroOrMax', - defaultPos2: 'zeroOrMin' - }); - } - } - - function defaultSizeRef(mark, sizeChannel, scaleName, scale, config, band) { - if (scale) { - var _scaleType3 = scale.get('type'); - - if (_scaleType3 === 'point' || _scaleType3 === 'band') { - if (config[mark].discreteBandSize !== undefined) { - return { - value: config[mark].discreteBandSize - }; - } - - if (_scaleType3 === ScaleType.POINT) { - var scaleRange = scale.get('range'); - - if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { - return { - value: scaleRange.step - 2 - }; - } - - return { - value: DEFAULT_STEP - 2 - }; - } else { - // BAND - return { - scale: scaleName, - band: band - }; - } - } else { - // continuous scale - return { - value: config[mark].continuousBandSize - }; - } - } // No Scale - - - var step = getViewConfigDiscreteStep(config.view, sizeChannel); - var value = getFirstDefined( // No scale is like discrete bar (with one item) - config[mark].discreteBandSize, step - 2); - return value !== undefined ? { - value: value - } : undefined; - } - /** - * Output position encoding and its size encoding for continuous, point, and band scales. - */ - - - function positionAndSize(mark, fieldDef, channel, model) { - var _a; - - var markDef = model.markDef, - encoding = model.encoding, - config = model.config, - stack = model.stack; - var orient = markDef.orient; - var scaleName = model.scaleName(channel); - var scale = model.getScaleComponent(channel); - var vgSizeChannel = getSizeChannel(channel); - var channel2 = getSecondaryRangeChannel(channel); // use "size" channel for bars, if there is orient and the channel matches the right orientation - - var useVlSizeChannel = orient === 'horizontal' && channel === 'y' || orient === 'vertical' && channel === 'x'; - var sizeFromMarkOrConfig = getMarkPropOrConfig(useVlSizeChannel ? 'size' : vgSizeChannel, markDef, config, { - vgChannel: vgSizeChannel - }); // Use size encoding / mark property / config if it exists - - var sizeMixins; - - if (encoding.size || sizeFromMarkOrConfig !== undefined) { - if (useVlSizeChannel) { - sizeMixins = nonPosition('size', model, { - vgChannel: vgSizeChannel, - defaultValue: sizeFromMarkOrConfig - }); - } else { - warn(cannotApplySizeToNonOrientedMark(markDef.type)); - } - } // Otherwise, apply default value - - - var band = (_a = isFieldOrDatumDef(fieldDef) ? getBand({ - channel: channel, - fieldDef: fieldDef, - markDef: markDef, - stack: stack, - config: config - }) : undefined) !== null && _a !== void 0 ? _a : 1; - sizeMixins = sizeMixins || _defineProperty({}, vgSizeChannel, defaultSizeRef(mark, vgSizeChannel, scaleName, scale, config, band)); - /* - Band scales with size value and all point scales, use xc/yc + band=0.5 - Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2. - In this case, size_band is the band specified in the x/y-encoding. - By default band is 1, so `(1 - band) / 2` = 0. - If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2 - */ - - var center = (scale === null || scale === void 0 ? void 0 : scale.get('type')) !== 'band' || !('band' in sizeMixins[vgSizeChannel]); - var vgChannel = vgAlignedPositionChannel(channel, markDef, config, center ? 'middle' : 'top'); - var offset = getOffset(channel, markDef); - var posRef = midPointRefWithPositionInvalidTest({ - channel: channel, - channelDef: fieldDef, - markDef: markDef, - config: config, - scaleName: scaleName, - scale: scale, - stack: stack, - offset: offset, - defaultRef: pointPositionDefaultRef({ - model: model, - defaultPos: 'mid', - channel: channel, - scaleName: scaleName, - scale: scale - }), - band: center ? 0.5 : (1 - band) / 2 - }); - - if (vgSizeChannel) { - return Object.assign(_defineProperty({}, vgChannel, posRef), sizeMixins); - } else { - var _ref39; - - // otherwise, we must simulate size by setting position2 = position + size - // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth) - var vgChannel2 = getVgPositionChannel(channel2); - var sizeRef = sizeMixins[vgSizeChannel]; - var sizeOffset = offset ? Object.assign(Object.assign({}, sizeRef), { - offset: offset - }) : sizeRef; - return _ref39 = {}, _defineProperty(_ref39, vgChannel, posRef), _defineProperty(_ref39, vgChannel2, isArray(posRef) ? [posRef[0], Object.assign(Object.assign({}, posRef[1]), { - offset: sizeOffset - })] : Object.assign(Object.assign({}, posRef), { - offset: sizeOffset - })), _ref39; - } - } - - function getBinSpacing(channel, spacing, reverse, translate, offset) { - if (isPolarPositionChannel(channel)) { - return 0; - } - - var spacingOffset = channel === 'x' || channel === 'y2' ? -spacing / 2 : spacing / 2; - - if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(translate)) { - var reverseExpr = signalOrStringValue(reverse); - var offsetExpr = signalOrStringValue(offset); - var translateExpr = signalOrStringValue(translate); - var t = translateExpr ? "".concat(translateExpr, " + ") : ''; - var r = reverseExpr ? "(".concat(reverseExpr, " ? -1 : 1) * ") : ''; - var o = offsetExpr ? "(".concat(offsetExpr, " + ").concat(spacingOffset, ")") : spacingOffset; - return { - signal: t + r + o - }; - } else { - offset = offset || 0; - return translate + (reverse ? -offset - spacingOffset : +offset + spacingOffset); - } - } - - function rectBinPosition(_ref40) { - var fieldDef = _ref40.fieldDef, - fieldDef2 = _ref40.fieldDef2, - channel = _ref40.channel, - band = _ref40.band, - scaleName = _ref40.scaleName, - markDef = _ref40.markDef, - _ref40$spacing = _ref40.spacing, - spacing = _ref40$spacing === void 0 ? 0 : _ref40$spacing, - axisTranslate = _ref40.axisTranslate, - reverse = _ref40.reverse, - config = _ref40.config; - var channel2 = getSecondaryRangeChannel(channel); - var vgChannel = getVgPositionChannel(channel); - var vgChannel2 = getVgPositionChannel(channel2); - var offset = getOffset(channel, markDef); - - if (isBinning(fieldDef.bin) || fieldDef.timeUnit) { - var _ref41; - - return _ref41 = {}, _defineProperty(_ref41, vgChannel2, rectBinRef({ - channel: channel, - fieldDef: fieldDef, - scaleName: scaleName, - markDef: markDef, - band: (1 - band) / 2, - offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset), - config: config - })), _defineProperty(_ref41, vgChannel, rectBinRef({ - channel: channel, - fieldDef: fieldDef, - scaleName: scaleName, - markDef: markDef, - band: 1 - (1 - band) / 2, - offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset), - config: config - })), _ref41; - } else if (isBinned(fieldDef.bin)) { - var startRef = valueRefForFieldOrDatumDef(fieldDef, scaleName, {}, { - offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset) - }); - - if (isFieldDef(fieldDef2)) { - var _ref42; - - return _ref42 = {}, _defineProperty(_ref42, vgChannel2, startRef), _defineProperty(_ref42, vgChannel, valueRefForFieldOrDatumDef(fieldDef2, scaleName, {}, { - offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset) - })), _ref42; - } else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) { - var _ref43; - - return _ref43 = {}, _defineProperty(_ref43, vgChannel2, startRef), _defineProperty(_ref43, vgChannel, { - signal: "scale(\"".concat(scaleName, "\", ").concat(_vgField(fieldDef, { - expr: 'datum' - }), " + ").concat(fieldDef.bin.step, ")"), - offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset) - }), _ref43; - } - } - - warn(channelRequiredForBinned(channel2)); - return undefined; - } - /** - * Value Ref for binned fields - */ - - - function rectBinRef(_ref44) { - var channel = _ref44.channel, - fieldDef = _ref44.fieldDef, - scaleName = _ref44.scaleName, - markDef = _ref44.markDef, - band = _ref44.band, - offset = _ref44.offset, - config = _ref44.config; - var r = interpolatedSignalRef({ - scaleName: scaleName, - fieldOrDatumDef: fieldDef, - band: band, - offset: offset - }); - return wrapPositionInvalidTest({ - fieldDef: fieldDef, - channel: channel, - markDef: markDef, - ref: r, - config: config - }); - } - - var ALWAYS_IGNORE = new Set(['aria']); - - function baseEncodeEntry(model, ignore) { - var _ref45 = ignore.color === 'include' ? color(model) : {}, - _ref45$fill = _ref45.fill, - fill = _ref45$fill === void 0 ? undefined : _ref45$fill, - _ref45$stroke = _ref45.stroke, - stroke = _ref45$stroke === void 0 ? undefined : _ref45$stroke; - - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, markDefProperties(model.markDef, ignore)), wrapAllFieldsInvalid(model, 'fill', fill)), wrapAllFieldsInvalid(model, 'stroke', stroke)), nonPosition('opacity', model)), nonPosition('fillOpacity', model)), nonPosition('strokeOpacity', model)), nonPosition('strokeWidth', model)), nonPosition('strokeDash', model)), zindex(model)), tooltip(model)), text(model, 'href')), aria(model)); - } // TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987 - - - function wrapAllFieldsInvalid(model, channel, valueRef) { - var config = model.config, - mark = model.mark, - markDef = model.markDef; - var invalid = getMarkPropOrConfig('invalid', markDef, config); - - if (invalid === 'hide' && valueRef && !isPathMark(mark)) { - // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains. - // For path marks, we will use "defined" property and skip these values instead. - var test = allFieldsInvalidPredicate(model, { - invalid: true, - channels: SCALE_CHANNELS - }); - - if (test) { - return _defineProperty({}, channel, [// prepend the invalid case - // TODO: support custom value - { - test: test, - value: null - }].concat(_toConsumableArray(array(valueRef)))); - } - } - - return valueRef ? _defineProperty({}, channel, valueRef) : {}; - } - - function markDefProperties(mark, ignore) { - return VG_MARK_CONFIGS.reduce(function (m, prop) { - if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') { - m[prop] = signalOrValueRef(mark[prop]); - } - - return m; - }, {}); - } - - function allFieldsInvalidPredicate(model, _ref48) { - var _ref48$invalid = _ref48.invalid, - invalid = _ref48$invalid === void 0 ? false : _ref48$invalid, - channels = _ref48.channels; - var filterIndex = channels.reduce(function (aggregator, channel) { - var scaleComponent = model.getScaleComponent(channel); - - if (scaleComponent) { - var _scaleType4 = scaleComponent.get('type'); - - var _field3 = model.vgField(channel, { - expr: 'datum' - }); // While discrete domain scales can handle invalid values, continuous scales can't. - - - if (_field3 && hasContinuousDomain(_scaleType4)) { - aggregator[_field3] = true; - } - } - - return aggregator; - }, {}); - var fields = keys(filterIndex); - - if (fields.length > 0) { - var op = invalid ? '||' : '&&'; - return fields.map(function (field) { - return fieldInvalidPredicate(field, invalid); - }).join(" ".concat(op, " ")); - } - - return undefined; - } - - function defined(model) { - var config = model.config, - markDef = model.markDef; - var invalid = getMarkPropOrConfig('invalid', markDef, config); - - if (invalid) { - var signal = allFieldsInvalidPredicate$1(model, { - channels: POSITION_SCALE_CHANNELS - }); - - if (signal) { - return { - defined: { - signal: signal - } - }; - } - } - - return {}; - } - - function allFieldsInvalidPredicate$1(model, _ref49) { - var _ref49$invalid = _ref49.invalid, - invalid = _ref49$invalid === void 0 ? false : _ref49$invalid, - channels = _ref49.channels; - var filterIndex = channels.reduce(function (aggregator, channel) { - var scaleComponent = model.getScaleComponent(channel); - - if (scaleComponent) { - var _scaleType5 = scaleComponent.get('type'); - - var _field4 = model.vgField(channel, { - expr: 'datum' - }); // While discrete domain scales can handle invalid values, continuous scales can't. - - - if (_field4 && hasContinuousDomain(_scaleType5)) { - aggregator[_field4] = true; - } - } - - return aggregator; - }, {}); - var fields = keys(filterIndex); - - if (fields.length > 0) { - var op = invalid ? '||' : '&&'; - return fields.map(function (field) { - return fieldInvalidPredicate(field, invalid); - }).join(" ".concat(op, " ")); - } - - return undefined; - } - - function valueIfDefined(prop, value) { - if (value !== undefined) { - return _defineProperty({}, prop, signalOrValueRef(value)); - } - - return undefined; - } - - var VORONOI = 'voronoi'; - var nearest = { - has: function has(selCmpt) { - return selCmpt.type !== 'interval' && selCmpt.nearest; - }, - parse: function parse(model, selCmpt) { - // Scope selection events to the voronoi mark to prevent capturing - // events that occur on the group mark (https://github.com/vega/vega/issues/2112). - if (selCmpt.events) { - var _iterator44 = _createForOfIteratorHelper(selCmpt.events), - _step44; - - try { - for (_iterator44.s(); !(_step44 = _iterator44.n()).done;) { - var s = _step44.value; - s.markname = model.getName(VORONOI); - } - } catch (err) { - _iterator44.e(err); - } finally { - _iterator44.f(); - } - } - }, - marks: function marks(model, selCmpt, _marks) { - var _selCmpt$project$hasC = selCmpt.project.hasChannel, - x = _selCmpt$project$hasC.x, - y = _selCmpt$project$hasC.y; - var markType = model.mark; - - if (isPathMark(markType)) { - warn(nearestNotSupportForContinuous(markType)); - return _marks; - } - - var cellDef = { - name: model.getName(VORONOI), - type: 'path', - interactive: true, - from: { - data: model.getName('marks') - }, - encode: { - update: Object.assign({ - fill: { - value: 'transparent' - }, - strokeWidth: { - value: 0.35 - }, - stroke: { - value: 'transparent' - }, - isVoronoi: { - value: true - } - }, tooltip(model, { - reactiveGeom: true - })) - }, - transform: [{ - type: 'voronoi', - x: { - expr: x || !y ? 'datum.datum.x || 0' : '0' - }, - y: { - expr: y || !x ? 'datum.datum.y || 0' : '0' - }, - size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] - }] - }; - var index = 0; - var exists = false; - - _marks.forEach(function (mark, i) { - var _a; - - var name = (_a = mark.name) !== null && _a !== void 0 ? _a : ''; - - if (name === model.component.mark[0].name) { - index = i; - } else if (name.indexOf(VORONOI) >= 0) { - exists = true; - } - }); - - if (!exists) { - _marks.splice(index + 1, 0, cellDef); - } - - return _marks; - } - }; - /** - * A node in the dataflow tree. - */ - - var DataFlowNode = /*#__PURE__*/function () { - function DataFlowNode(parent, debugName) { - _classCallCheck(this, DataFlowNode); - - this.debugName = debugName; - this._children = []; - this._parent = null; - - if (parent) { - this.parent = parent; - } - } - /** - * Clone this node with a deep copy but don't clone links to children or parents. - */ - - - _createClass(DataFlowNode, [{ - key: "clone", - value: function clone() { - throw new Error('Cannot clone node'); - } - }, { - key: "numChildren", - value: function numChildren() { - return this._children.length; - } - }, { - key: "addChild", - value: function addChild(child, loc) { - // do not add the same child twice - if (this._children.indexOf(child) > -1) { - warn(ADD_SAME_CHILD_TWICE); - return; - } - - if (loc !== undefined) { - this._children.splice(loc, 0, child); - } else { - this._children.push(child); - } - } - }, { - key: "removeChild", - value: function removeChild(oldChild) { - var loc = this._children.indexOf(oldChild); - - this._children.splice(loc, 1); - - return loc; - } - /** - * Remove node from the dataflow. - */ - - }, { - key: "remove", - value: function remove() { - var loc = this._parent.removeChild(this); - - var _iterator45 = _createForOfIteratorHelper(this._children), - _step45; - - try { - for (_iterator45.s(); !(_step45 = _iterator45.n()).done;) { - var child = _step45.value; - // do not use the set method because we want to insert at a particular location - child._parent = this._parent; - - this._parent.addChild(child, loc++); - } - } catch (err) { - _iterator45.e(err); - } finally { - _iterator45.f(); - } - } - /** - * Insert another node as a parent of this node. - */ - - }, { - key: "insertAsParentOf", - value: function insertAsParentOf(other) { - var parent = other.parent; - parent.removeChild(this); - this.parent = parent; - other.parent = this; - } - }, { - key: "swapWithParent", - value: function swapWithParent() { - var parent = this._parent; - var newParent = parent.parent; // reconnect the children - - var _iterator46 = _createForOfIteratorHelper(this._children), - _step46; - - try { - for (_iterator46.s(); !(_step46 = _iterator46.n()).done;) { - var child = _step46.value; - child.parent = parent; - } // remove old links - - } catch (err) { - _iterator46.e(err); - } finally { - _iterator46.f(); - } - - this._children = []; // equivalent to removing every child link one by one - - parent.removeChild(this); - parent.parent.removeChild(parent); // swap two nodes - - this.parent = newParent; - parent.parent = this; - } - }, { - key: "parent", - get: function get() { - return this._parent; - } - /** - * Set the parent of the node and also add this node to the parent's children. - */ - , - set: function set(parent) { - this._parent = parent; - - if (parent) { - parent.addChild(this); - } - } - }, { - key: "children", - get: function get() { - return this._children; - } - }]); - - return DataFlowNode; - }(); - - var OutputNode = /*#__PURE__*/function (_DataFlowNode) { - _inherits(OutputNode, _DataFlowNode); - - var _super3 = _createSuper(OutputNode); - - /** - * @param source The name of the source. Will change in assemble. - * @param type The type of the output node. - * @param refCounts A global ref counter map. - */ - function OutputNode(parent, source, type, refCounts) { - var _this8; - - _classCallCheck(this, OutputNode); - - _this8 = _super3.call(this, parent, source); - _this8.type = type; - _this8.refCounts = refCounts; - _this8._source = _this8._name = source; - - if (_this8.refCounts && !(_this8._name in _this8.refCounts)) { - _this8.refCounts[_this8._name] = 0; - } - - return _this8; - } - - _createClass(OutputNode, [{ - key: "clone", - value: function clone() { - var cloneObj = new this.constructor(); - cloneObj.debugName = 'clone_' + this.debugName; - cloneObj._source = this._source; - cloneObj._name = 'clone_' + this._name; - cloneObj.type = this.type; - cloneObj.refCounts = this.refCounts; - cloneObj.refCounts[cloneObj._name] = 0; - return cloneObj; - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(); - } - }, { - key: "hash", - value: function hash() { - if (this._hash === undefined) { - this._hash = "Output ".concat(uniqueId()); - } - - return this._hash; - } - /** - * Request the datasource name and increase the ref counter. - * - * During the parsing phase, this will return the simple name such as 'main' or 'raw'. - * It is crucial to request the name from an output node to mark it as a required node. - * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase. - * - * In the assemble phase, this will return the correct name. - */ - - }, { - key: "getSource", - value: function getSource() { - this.refCounts[this._name]++; - return this._source; - } - }, { - key: "isRequired", - value: function isRequired() { - return !!this.refCounts[this._name]; - } - }, { - key: "setSource", - value: function setSource(source) { - this._source = source; - } - }]); - - return OutputNode; - }(DataFlowNode); - - var TimeUnitNode = /*#__PURE__*/function (_DataFlowNode2) { - _inherits(TimeUnitNode, _DataFlowNode2); - - var _super4 = _createSuper(TimeUnitNode); - - function TimeUnitNode(parent, formula) { - var _this9; - - _classCallCheck(this, TimeUnitNode); - - _this9 = _super4.call(this, parent); - _this9.formula = formula; - return _this9; - } - - _createClass(TimeUnitNode, [{ - key: "clone", - value: function clone() { - return new TimeUnitNode(null, duplicate(this.formula)); - } - }, { - key: "merge", - - /** - * Merge together TimeUnitNodes assigning the children of `other` to `this` - * and removing `other`. - */ - value: function merge(other) { - this.formula = Object.assign({}, this.formula); // if the same hash happen twice, merge "band" - - for (var key in other.formula) { - if (!this.formula[key] || other.formula[key].band) { - // copy if it's not a duplicate or if we need to include copy band over - this.formula[key] = other.formula[key]; - } - } - - var _iterator47 = _createForOfIteratorHelper(other.children), - _step47; - - try { - for (_iterator47.s(); !(_step47 = _iterator47.n()).done;) { - var child = _step47.value; - other.removeChild(child); - child.parent = this; - } - } catch (err) { - _iterator47.e(err); - } finally { - _iterator47.f(); - } - - other.remove(); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(vals(this.formula).map(function (f) { - return f.as; - })); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(vals(this.formula).map(function (f) { - return f.field; - })); - } - }, { - key: "hash", - value: function hash() { - return "TimeUnit ".concat(_hash(this.formula)); - } - }, { - key: "assemble", - value: function assemble() { - var transforms = []; - - var _iterator48 = _createForOfIteratorHelper(vals(this.formula)), - _step48; - - try { - for (_iterator48.s(); !(_step48 = _iterator48.n()).done;) { - var f = _step48.value; - var _field5 = f.field, - as = f.as, - timeUnit = f.timeUnit; - - var _a = normalizeTimeUnit(timeUnit), - unit = _a.unit, - utc = _a.utc, - params = __rest(_a, ["unit", "utc"]); - - transforms.push(Object.assign(Object.assign(Object.assign(Object.assign({ - field: replacePathInField(_field5), - type: 'timeunit' - }, unit ? { - units: getTimeUnitParts(unit) - } : {}), utc ? { - timezone: 'utc' - } : {}), params), { - as: [as, "".concat(as, "_end")] - })); - } - } catch (err) { - _iterator48.e(err); - } finally { - _iterator48.f(); - } - - return transforms; - } - }], [{ - key: "makeFromEncoding", - value: function makeFromEncoding(parent, model) { - var formula = model.reduceFieldDef(function (timeUnitComponent, fieldDef, channel) { - var field = fieldDef.field, - timeUnit = fieldDef.timeUnit; - var channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; - var band = isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config); - - if (timeUnit) { - var as = _vgField(fieldDef, { - forAs: true - }); - - timeUnitComponent[_hash({ - as: as, - field: field, - timeUnit: timeUnit - })] = Object.assign({ - as: as, - field: field, - timeUnit: timeUnit - }, band ? { - band: true - } : {}); - } - - return timeUnitComponent; - }, {}); - - if (isEmpty(formula)) { - return null; - } - - return new TimeUnitNode(parent, formula); - } - }, { - key: "makeFromTransform", - value: function makeFromTransform(parent, t) { - var _a = Object.assign({}, t), - timeUnit = _a.timeUnit, - other = __rest(_a, ["timeUnit"]); - - var normalizedTimeUnit = normalizeTimeUnit(timeUnit); - var component = Object.assign(Object.assign({}, other), { - timeUnit: normalizedTimeUnit - }); - return new TimeUnitNode(parent, _defineProperty({}, _hash(component), component)); - } - }]); - - return TimeUnitNode; - }(DataFlowNode); - - var TUPLE_FIELDS = '_tuple_fields'; - - var SelectionProjectionComponent = function SelectionProjectionComponent() { - _classCallCheck(this, SelectionProjectionComponent); - - for (var _len4 = arguments.length, items = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - items[_key4] = arguments[_key4]; - } - - this.items = items; - this.hasChannel = {}; - this.hasField = {}; - }; - - var project = { - has: function has() { - return true; // This transform handles its own defaults, so always run parse. - }, - parse: function parse(model, selCmpt, selDef) { - var _a, _b, _c; - - var name = selCmpt.name; - var proj = (_a = selCmpt.project) !== null && _a !== void 0 ? _a : selCmpt.project = new SelectionProjectionComponent(); - var parsed = {}; - var timeUnits = {}; - var signals = new Set(); - - var signalName = function signalName(p, range) { - var suffix = range === 'visual' ? p.channel : p.field; - var sg = varName("".concat(name, "_").concat(suffix)); - - for (var counter = 1; signals.has(sg); counter++) { - sg = varName("".concat(name, "_").concat(suffix, "_").concat(counter)); - } - - signals.add(sg); - return _defineProperty({}, range, sg); - }; // If no explicit projection (either fields or encodings) is specified, set some defaults. - // If an initial value is set, try to infer projections. - // Otherwise, use the default configuration. - - - if (!selDef.fields && !selDef.encodings) { - var cfg = model.config.selection[selDef.type]; - - if (selDef.init) { - var _iterator49 = _createForOfIteratorHelper(array(selDef.init)), - _step49; - - try { - for (_iterator49.s(); !(_step49 = _iterator49.n()).done;) { - var init = _step49.value; - - var _iterator50 = _createForOfIteratorHelper(keys(init)), - _step50; - - try { - for (_iterator50.s(); !(_step50 = _iterator50.n()).done;) { - var key = _step50.value; - - if (isSingleDefUnitChannel(key)) { - (selDef.encodings || (selDef.encodings = [])).push(key); - } else { - if (selDef.type === 'interval') { - warn(INTERVAL_INITIALIZED_WITH_X_Y); - selDef.encodings = cfg.encodings; - } else { - (selDef.fields || (selDef.fields = [])).push(key); - } - } - } - } catch (err) { - _iterator50.e(err); - } finally { - _iterator50.f(); - } - } - } catch (err) { - _iterator49.e(err); - } finally { - _iterator49.f(); - } - } else { - selDef.encodings = cfg.encodings; - selDef.fields = cfg.fields; - } - } // TODO: find a possible channel mapping for these fields. - - - var _iterator51 = _createForOfIteratorHelper((_b = selDef.fields) !== null && _b !== void 0 ? _b : []), - _step51; - - try { - for (_iterator51.s(); !(_step51 = _iterator51.n()).done;) { - var _field6 = _step51.value; - var p = { - type: 'E', - field: _field6 - }; - p.signals = Object.assign({}, signalName(p, 'data')); - proj.items.push(p); - proj.hasField[_field6] = p; - } - } catch (err) { - _iterator51.e(err); - } finally { - _iterator51.f(); - } - - var _iterator52 = _createForOfIteratorHelper((_c = selDef.encodings) !== null && _c !== void 0 ? _c : []), - _step52; - - try { - for (_iterator52.s(); !(_step52 = _iterator52.n()).done;) { - var channel = _step52.value; - var fieldDef = model.fieldDef(channel); - - if (fieldDef) { - var _field7 = fieldDef.field; - - if (fieldDef.aggregate) { - warn(cannotProjectAggregate(channel, fieldDef.aggregate)); - continue; - } else if (!_field7) { - warn(cannotProjectOnChannelWithoutField(channel)); - continue; - } - - if (fieldDef.timeUnit) { - _field7 = model.vgField(channel); // Construct TimeUnitComponents which will be combined into a - // TimeUnitNode. This node may need to be inserted into the - // dataflow if the selection is used across views that do not - // have these time units defined. - - var component = { - timeUnit: fieldDef.timeUnit, - as: _field7, - field: fieldDef.field - }; - timeUnits[_hash(component)] = component; - } // Prevent duplicate projections on the same field. - // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag). - - - if (!parsed[_field7]) { - // Determine whether the tuple will store enumerated or ranged values. - // Interval selections store ranges for continuous scales, and enumerations otherwise. - // Single/multi selections store ranges for binned fields, and enumerations otherwise. - var type = 'E'; - - if (selCmpt.type === 'interval') { - var _scaleType6 = model.getScaleComponent(channel).get('type'); - - if (hasContinuousDomain(_scaleType6)) { - type = 'R'; - } - } else if (fieldDef.bin) { - type = 'R-RE'; - } - - var _p2 = { - field: _field7, - channel: channel, - type: type - }; - _p2.signals = Object.assign(Object.assign({}, signalName(_p2, 'data')), signalName(_p2, 'visual')); - proj.items.push(parsed[_field7] = _p2); - proj.hasField[_field7] = proj.hasChannel[channel] = parsed[_field7]; - } - } else { - warn(cannotProjectOnChannelWithoutField(channel)); - } - } - } catch (err) { - _iterator52.e(err); - } finally { - _iterator52.f(); - } - - if (selDef.init) { - var parseInit = function parseInit(i) { - return proj.items.map(function (p) { - return i[p.channel] !== undefined ? i[p.channel] : i[p.field]; - }); - }; - - if (selDef.type === 'interval') { - selCmpt.init = parseInit(selDef.init); - } else { - var _init = array(selDef.init); - - selCmpt.init = _init.map(parseInit); - } - } - - if (!isEmpty(timeUnits)) { - proj.timeUnit = new TimeUnitNode(null, timeUnits); - } - }, - signals: function signals(model, selCmpt, allSignals) { - var name = selCmpt.name + TUPLE_FIELDS; - var hasSignal = allSignals.filter(function (s) { - return s.name === name; - }); - return hasSignal.length > 0 ? allSignals : allSignals.concat({ - name: name, - value: selCmpt.project.items.map(function (proj) { - var rest = __rest(proj, ["signals", "hasLegend"]); - - rest.field = replacePathInField(rest.field); - return rest; - }) - }); - } - }; - var inputBindings = { - has: function has(selCmpt) { - return selCmpt.type === 'single' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind !== 'scales' && !isLegendBinding(selCmpt.bind); - }, - parse: function parse(model, selCmpt, selDef, origDef) { - // Binding a selection to input widgets disables default direct manipulation interaction. - // A user can choose to re-enable it by explicitly specifying triggering input events. - if (!origDef.on) delete selCmpt.events; - if (!origDef.clear) delete selCmpt.clear; - }, - topLevelSignals: function topLevelSignals(model, selCmpt, signals) { - var name = selCmpt.name; - var proj = selCmpt.project; - var bind = selCmpt.bind; - var init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value). - - var datum = nearest.has(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum'; - proj.items.forEach(function (p, i) { - var _a, _b; - - var sgname = varName("".concat(name, "_").concat(p.field)); - var hasSignal = signals.filter(function (s) { - return s.name === sgname; - }); - - if (!hasSignal.length) { - signals.unshift(Object.assign(Object.assign({ - name: sgname - }, init ? { - init: assembleInit(init[i]) - } : { - value: null - }), { - on: selCmpt.events ? [{ - events: selCmpt.events, - update: "datum && item().mark.marktype !== 'group' ? ".concat(datum, "[").concat($(p.field), "] : null") - }] : [], - bind: (_b = (_a = bind[p.field]) !== null && _a !== void 0 ? _a : bind[p.channel]) !== null && _b !== void 0 ? _b : bind - })); - } - }); - return signals; - }, - signals: function signals(model, selCmpt, _signals) { - var name = selCmpt.name; - var proj = selCmpt.project; - - var signal = _signals.filter(function (s) { - return s.name === name + TUPLE; - })[0]; - - var fields = name + TUPLE_FIELDS; - var values = proj.items.map(function (p) { - return varName("".concat(name, "_").concat(p.field)); - }); - var valid = values.map(function (v) { - return "".concat(v, " !== null"); - }).join(' && '); - - if (values.length) { - signal.update = "".concat(valid, " ? {fields: ").concat(fields, ", values: [").concat(values.join(', '), "]} : null"); - } - - delete signal.value; - delete signal.on; - return _signals; - } - }; - var TOGGLE = '_toggle'; - var toggle = { - has: function has(selCmpt) { - return selCmpt.type === 'multi' && !!selCmpt.toggle; - }, - signals: function signals(model, selCmpt, _signals2) { - return _signals2.concat({ - name: selCmpt.name + TOGGLE, - value: false, - on: [{ - events: selCmpt.events, - update: selCmpt.toggle - }] - }); - }, - modifyExpr: function modifyExpr(model, selCmpt) { - var tpl = selCmpt.name + TUPLE; - var signal = selCmpt.name + TOGGLE; - return "".concat(signal, " ? null : ").concat(tpl, ", ") + (selCmpt.resolve === 'global' ? "".concat(signal, " ? null : true, ") : "".concat(signal, " ? null : {unit: ").concat(unitName(model), "}, ")) + "".concat(signal, " ? ").concat(tpl, " : null"); - } - }; - var clear = { - has: function has(selCmpt) { - return selCmpt.clear !== undefined && selCmpt.clear !== false; - }, - parse: function parse(model, selCmpt, selDef) { - if (selDef.clear) { - selCmpt.clear = isString(selDef.clear) ? parseSelector(selDef.clear, 'scope') : selDef.clear; - } - }, - topLevelSignals: function topLevelSignals(model, selCmpt, signals) { - if (inputBindings.has(selCmpt)) { - var _iterator53 = _createForOfIteratorHelper(selCmpt.project.items), - _step53; - - try { - var _loop2 = function _loop2() { - var proj = _step53.value; - var idx = signals.findIndex(function (n) { - return n.name === varName("".concat(selCmpt.name, "_").concat(proj.field)); - }); - - if (idx !== -1) { - signals[idx].on.push({ - events: selCmpt.clear, - update: 'null' - }); - } - }; - - for (_iterator53.s(); !(_step53 = _iterator53.n()).done;) { - _loop2(); - } - } catch (err) { - _iterator53.e(err); - } finally { - _iterator53.f(); - } - } - - return signals; - }, - signals: function signals(model, selCmpt, _signals3) { - function addClear(idx, update) { - if (idx !== -1 && _signals3[idx].on) { - _signals3[idx].on.push({ - events: selCmpt.clear, - update: update - }); - } - } // Be as minimalist as possible when adding clear triggers to minimize dataflow execution. - - - if (selCmpt.type === 'interval') { - var _iterator54 = _createForOfIteratorHelper(selCmpt.project.items), - _step54; - - try { - var _loop3 = function _loop3() { - var proj = _step54.value; - - var vIdx = _signals3.findIndex(function (n) { - return n.name === proj.signals.visual; - }); - - addClear(vIdx, '[0, 0]'); - - if (vIdx === -1) { - var dIdx = _signals3.findIndex(function (n) { - return n.name === proj.signals.data; - }); - - addClear(dIdx, 'null'); - } - }; - - for (_iterator54.s(); !(_step54 = _iterator54.n()).done;) { - _loop3(); - } - } catch (err) { - _iterator54.e(err); - } finally { - _iterator54.f(); - } - } else { - var tIdx = _signals3.findIndex(function (n) { - return n.name === selCmpt.name + TUPLE; - }); - - addClear(tIdx, 'null'); - - if (toggle.has(selCmpt)) { - tIdx = _signals3.findIndex(function (n) { - return n.name === selCmpt.name + TOGGLE; - }); - addClear(tIdx, 'false'); - } - } - - return _signals3; - } - }; - var scaleBindings = { - has: function has(selCmpt) { - return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales'; - }, - parse: function parse(model, selCmpt) { - var bound = selCmpt.scales = []; - - var _iterator55 = _createForOfIteratorHelper(selCmpt.project.items), - _step55; - - try { - for (_iterator55.s(); !(_step55 = _iterator55.n()).done;) { - var proj = _step55.value; - var channel = proj.channel; - - if (!isScaleChannel(channel)) { - continue; - } - - var scale = model.getScaleComponent(channel); - - var _scaleType7 = scale ? scale.get('type') : undefined; - - if (!scale || !hasContinuousDomain(_scaleType7)) { - warn(SCALE_BINDINGS_CONTINUOUS); - continue; - } - - var extent = { - selection: selCmpt.name, - field: proj.field - }; - scale.set('selectionExtent', extent, true); - bound.push(proj); - } - } catch (err) { - _iterator55.e(err); - } finally { - _iterator55.f(); - } - }, - topLevelSignals: function topLevelSignals(model, selCmpt, signals) { - var bound = selCmpt.scales.filter(function (proj) { - return signals.filter(function (s) { - return s.name === proj.signals.data; - }).length === 0; - }); // Top-level signals are only needed for multiview displays and if this - // view's top-level signals haven't already been generated. - - if (!model.parent || isTopLevelLayer(model) || bound.length === 0) { - return signals; - } // vlSelectionResolve does not account for the behavior of bound scales in - // multiview displays. Each unit view adds a tuple to the store, but the - // state of the selection is the unit selection most recently updated. This - // state is captured by the top-level signals that we insert and "push - // outer" to from within the units. We need to reassemble this state into - // the top-level named signal, except no single selCmpt has a global view. - - - var namedSg = signals.filter(function (s) { - return s.name === selCmpt.name; - })[0]; - var update = namedSg.update; - - if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) { - namedSg.update = "{".concat(bound.map(function (proj) { - return "".concat($(proj.field), ": ").concat(proj.signals.data); - }).join(', '), "}"); - } else { - var _iterator56 = _createForOfIteratorHelper(bound), - _step56; - - try { - for (_iterator56.s(); !(_step56 = _iterator56.n()).done;) { - var proj = _step56.value; - var mapping = "".concat($(proj.field), ": ").concat(proj.signals.data); - - if (update.indexOf(mapping) < 0) { - update = "".concat(update.substring(0, update.length - 1), ", ").concat(mapping, "}"); - } - } - } catch (err) { - _iterator56.e(err); - } finally { - _iterator56.f(); - } - - namedSg.update = update; - } - - return signals.concat(bound.map(function (proj) { - return { - name: proj.signals.data - }; - })); - }, - signals: function signals(model, selCmpt, _signals4) { - // Nested signals need only push to top-level signals with multiview displays. - if (model.parent && !isTopLevelLayer(model)) { - var _iterator57 = _createForOfIteratorHelper(selCmpt.scales), - _step57; - - try { - var _loop4 = function _loop4() { - var proj = _step57.value; - - var signal = _signals4.filter(function (s) { - return s.name === proj.signals.data; - })[0]; - - signal.push = 'outer'; - delete signal.value; - delete signal.update; - }; - - for (_iterator57.s(); !(_step57 = _iterator57.n()).done;) { - _loop4(); - } - } catch (err) { - _iterator57.e(err); - } finally { - _iterator57.f(); - } - } - - return _signals4; - } - }; - - function domain(model, channel) { - var scale = $(model.scaleName(channel)); - return "domain(".concat(scale, ")"); - } - - function isTopLevelLayer(model) { - var _a; - - return model.parent && isLayerModel(model.parent) && ((_a = !model.parent.parent) !== null && _a !== void 0 ? _a : isTopLevelLayer(model.parent.parent)); - } - - var legendBindings = { - has: function has(selCmpt) { - var spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind); - var projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID; - - if (spec && !projLen) { - warn(LEGEND_BINDINGS_MUST_HAVE_PROJECTION); - } - - return spec && projLen; - }, - parse: function parse(model, selCmpt, selDef, origDef) { - var _a; // Binding a selection to a legend disables default direct manipulation interaction. - // A user can choose to re-enable it by explicitly specifying triggering input events. - - - if (!origDef.on) delete selCmpt.events; - if (!origDef.clear) delete selCmpt.clear; - - if (origDef.on || origDef.clear) { - var legendFilter = 'event.item && indexof(event.item.mark.role, "legend") < 0'; - - var _iterator58 = _createForOfIteratorHelper(selCmpt.events), - _step58; - - try { - for (_iterator58.s(); !(_step58 = _iterator58.n()).done;) { - var _evt = _step58.value; - _evt.filter = array((_a = _evt.filter) !== null && _a !== void 0 ? _a : []); - - if (_evt.filter.indexOf(legendFilter) < 0) { - _evt.filter.push(legendFilter); - } - } - } catch (err) { - _iterator58.e(err); - } finally { - _iterator58.f(); - } - } - - var evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click'; - var stream = isString(evt) ? parseSelector(evt, 'view') : array(evt); - selCmpt.bind = { - legend: { - merge: stream - } - }; - }, - topLevelSignals: function topLevelSignals(model, selCmpt, signals) { - var selName = selCmpt.name; - var stream = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; - - var markName = function markName(name) { - return function (s) { - var ds = duplicate(s); - ds.markname = name; - return ds; - }; - }; - - var _iterator59 = _createForOfIteratorHelper(selCmpt.project.items), - _step59; - - try { - var _loop5 = function _loop5() { - var proj = _step59.value; - if (!proj.hasLegend) return "continue"; - var prefix = "".concat(varName(proj.field), "_legend"); - var sgName = "".concat(selName, "_").concat(prefix); - var hasSignal = signals.filter(function (s) { - return s.name === sgName; - }); - - if (hasSignal.length === 0) { - var _events = stream.merge.map(markName("".concat(prefix, "_symbols"))).concat(stream.merge.map(markName("".concat(prefix, "_labels")))).concat(stream.merge.map(markName("".concat(prefix, "_entries")))); - - signals.unshift(Object.assign(Object.assign({ - name: sgName - }, !selCmpt.init ? { - value: null - } : {}), { - on: [// Legend entries do not store values, so we need to walk the scenegraph to the symbol datum. - { - events: _events, - update: 'datum.value || item().items[0].items[0].datum.value', - force: true - }, { - events: stream.merge, - update: "!event.item || !datum ? null : ".concat(sgName), - force: true - }] - })); - } - }; - - for (_iterator59.s(); !(_step59 = _iterator59.n()).done;) { - var _ret = _loop5(); - - if (_ret === "continue") continue; - } - } catch (err) { - _iterator59.e(err); - } finally { - _iterator59.f(); - } - - return signals; - }, - signals: function signals(model, selCmpt, _signals5) { - var name = selCmpt.name; - var proj = selCmpt.project; - - var tuple = _signals5.find(function (s) { - return s.name === name + TUPLE; - }); - - var fields = name + TUPLE_FIELDS; - var values = proj.items.filter(function (p) { - return p.hasLegend; - }).map(function (p) { - return varName("".concat(name, "_").concat(varName(p.field), "_legend")); - }); - var valid = values.map(function (v) { - return "".concat(v, " !== null"); - }).join(' && '); - var update = "".concat(valid, " ? {fields: ").concat(fields, ", values: [").concat(values.join(', '), "]} : null"); - - if (selCmpt.events && values.length > 0) { - tuple.on.push({ - events: values.map(function (signal) { - return { - signal: signal - }; - }), - update: update - }); - } else if (values.length > 0) { - tuple.update = update; - delete tuple.value; - delete tuple.on; - } - - var toggle = _signals5.find(function (s) { - return s.name === name + TOGGLE; - }); - - var events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; - - if (toggle) { - if (!selCmpt.events) toggle.on[0].events = events;else toggle.on.push(Object.assign(Object.assign({}, toggle.on[0]), { - events: events - })); - } - - return _signals5; - } - }; - - function parseInteractiveLegend(model, channel, legendCmpt) { - var _a; - - var field = (_a = model.fieldDef(channel)) === null || _a === void 0 ? void 0 : _a.field; - forEachSelection(model, function (selCmpt) { - var _a, _b; - - var proj = (_a = selCmpt.project.hasField[field]) !== null && _a !== void 0 ? _a : selCmpt.project.hasChannel[channel]; - - if (proj && legendBindings.has(selCmpt)) { - var legendSelections = (_b = legendCmpt.get('selections')) !== null && _b !== void 0 ? _b : []; - legendSelections.push(selCmpt.name); - legendCmpt.set('selections', legendSelections, false); - proj.hasLegend = true; - } - }); - } - - var ANCHOR = '_translate_anchor'; - var DELTA = '_translate_delta'; - var translate = { - has: function has(selCmpt) { - return selCmpt.type === 'interval' && selCmpt.translate; - }, - signals: function signals(model, selCmpt, _signals6) { - var name = selCmpt.name; - var hasScales = scaleBindings.has(selCmpt); - var anchor = name + ANCHOR; - var _selCmpt$project$hasC2 = selCmpt.project.hasChannel, - x = _selCmpt$project$hasC2.x, - y = _selCmpt$project$hasC2.y; - var events = parseSelector(selCmpt.translate, 'scope'); - - if (!hasScales) { - events = events.map(function (e) { - return e.between[0].markname = name + BRUSH, e; - }); - } - - _signals6.push({ - name: anchor, - value: {}, - on: [{ - events: events.map(function (e) { - return e.between[0]; - }), - update: '{x: x(unit), y: y(unit)' + (x !== undefined ? ', extent_x: ' + (hasScales ? domain(model, X) : "slice(".concat(x.signals.visual, ")")) : '') + (y !== undefined ? ', extent_y: ' + (hasScales ? domain(model, Y) : "slice(".concat(y.signals.visual, ")")) : '') + '}' - }] - }, { - name: name + DELTA, - value: {}, - on: [{ - events: events, - update: "{x: ".concat(anchor, ".x - x(unit), y: ").concat(anchor, ".y - y(unit)}") - }] - }); - - if (x !== undefined) { - onDelta(model, selCmpt, x, 'width', _signals6); - } - - if (y !== undefined) { - onDelta(model, selCmpt, y, 'height', _signals6); - } - - return _signals6; - } - }; - - function onDelta(model, selCmpt, proj, size, signals) { - var _a; - - var name = selCmpt.name; - var anchor = name + ANCHOR; - var delta = name + DELTA; - var channel = proj.channel; - var hasScales = scaleBindings.has(selCmpt); - var signal = signals.filter(function (s) { - return s.name === proj.signals[hasScales ? 'data' : 'visual']; - })[0]; - var sizeSg = model.getSizeSignalRef(size).signal; - var scaleCmpt = model.getScaleComponent(channel); - var scaleType = scaleCmpt.get('type'); - var sign = hasScales && channel === X ? '-' : ''; // Invert delta when panning x-scales. - - var extent = "".concat(anchor, ".extent_").concat(channel); - var offset = "".concat(sign).concat(delta, ".").concat(channel, " / ") + (hasScales ? "".concat(sizeSg) : "span(".concat(extent, ")")); - var panFn = !hasScales ? 'panLinear' : scaleType === 'log' ? 'panLog' : scaleType === 'pow' ? 'panPow' : 'panLinear'; - var update = "".concat(panFn, "(").concat(extent, ", ").concat(offset) + (hasScales && scaleType === 'pow' ? ", ".concat((_a = scaleCmpt.get('exponent')) !== null && _a !== void 0 ? _a : 1) : '') + ')'; - signal.on.push({ - events: { - signal: delta - }, - update: hasScales ? update : "clampRange(".concat(update, ", 0, ").concat(sizeSg, ")") - }); - } - - var ANCHOR$1 = '_zoom_anchor'; - var DELTA$1 = '_zoom_delta'; - var zoom = { - has: function has(selCmpt) { - return selCmpt.type === 'interval' && selCmpt.zoom; - }, - signals: function signals(model, selCmpt, _signals7) { - var name = selCmpt.name; - var hasScales = scaleBindings.has(selCmpt); - var delta = name + DELTA$1; - var _selCmpt$project$hasC3 = selCmpt.project.hasChannel, - x = _selCmpt$project$hasC3.x, - y = _selCmpt$project$hasC3.y; - var sx = $(model.scaleName(X)); - var sy = $(model.scaleName(Y)); - var events = parseSelector(selCmpt.zoom, 'scope'); - - if (!hasScales) { - events = events.map(function (e) { - return e.markname = name + BRUSH, e; - }); - } - - _signals7.push({ - name: name + ANCHOR$1, - on: [{ - events: events, - update: !hasScales ? "{x: x(unit), y: y(unit)}" : '{' + [sx ? "x: invert(".concat(sx, ", x(unit))") : '', sy ? "y: invert(".concat(sy, ", y(unit))") : ''].filter(function (expr) { - return !!expr; - }).join(', ') + '}' - }] - }, { - name: delta, - on: [{ - events: events, - force: true, - update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))' - }] - }); - - if (x !== undefined) { - onDelta$1(model, selCmpt, x, 'width', _signals7); - } - - if (y !== undefined) { - onDelta$1(model, selCmpt, y, 'height', _signals7); - } - - return _signals7; - } - }; - - function onDelta$1(model, selCmpt, proj, size, signals) { - var _a; - - var name = selCmpt.name; - var channel = proj.channel; - var hasScales = scaleBindings.has(selCmpt); - var signal = signals.filter(function (s) { - return s.name === proj.signals[hasScales ? 'data' : 'visual']; - })[0]; - var sizeSg = model.getSizeSignalRef(size).signal; - var scaleCmpt = model.getScaleComponent(channel); - var scaleType = scaleCmpt.get('type'); - var base = hasScales ? domain(model, channel) : signal.name; - var delta = name + DELTA$1; - var anchor = "".concat(name).concat(ANCHOR$1, ".").concat(channel); - var zoomFn = !hasScales ? 'zoomLinear' : scaleType === 'log' ? 'zoomLog' : scaleType === 'pow' ? 'zoomPow' : 'zoomLinear'; - var update = "".concat(zoomFn, "(").concat(base, ", ").concat(anchor, ", ").concat(delta) + (hasScales && scaleType === 'pow' ? ", ".concat((_a = scaleCmpt.get('exponent')) !== null && _a !== void 0 ? _a : 1) : '') + ')'; - signal.on.push({ - events: { - signal: delta - }, - update: hasScales ? update : "clampRange(".concat(update, ", 0, ").concat(sizeSg, ")") - }); - } - - var compilers = [project, toggle, scaleBindings, legendBindings, translate, zoom, inputBindings, nearest, clear]; - - function forEachTransform(selCmpt, cb) { - var _iterator60 = _createForOfIteratorHelper(compilers), - _step60; - - try { - for (_iterator60.s(); !(_step60 = _iterator60.n()).done;) { - var t = _step60.value; - - if (t.has(selCmpt)) { - cb(t); - } - } - } catch (err) { - _iterator60.e(err); - } finally { - _iterator60.f(); - } - } - - function assembleInit(init) { - var isExpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - var wrap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : identity; - - if (isArray(init)) { - var assembled = init.map(function (v) { - return assembleInit(v, isExpr, wrap); - }); - return isExpr ? "[".concat(assembled.join(', '), "]") : assembled; - } else if (isDateTime(init)) { - if (isExpr) { - return wrap(dateTimeToExpr(init)); - } else { - return wrap(dateTimeToTimestamp(init)); - } - } - - return isExpr ? wrap(JSON.stringify(init)) : init; - } - - function assembleUnitSelectionSignals(model, signals) { - forEachSelection(model, function (selCmpt, selCompiler) { - var _signals8; - - var name = selCmpt.name; - var modifyExpr = selCompiler.modifyExpr(model, selCmpt); - - (_signals8 = signals).push.apply(_signals8, _toConsumableArray(selCompiler.signals(model, selCmpt))); - - forEachTransform(selCmpt, function (txCompiler) { - if (txCompiler.signals) { - signals = txCompiler.signals(model, selCmpt, signals); - } - - if (txCompiler.modifyExpr) { - modifyExpr = txCompiler.modifyExpr(model, selCmpt, modifyExpr); - } - }); - signals.push({ - name: name + MODIFY, - on: [{ - events: { - signal: selCmpt.name + TUPLE - }, - update: "modify(".concat($(selCmpt.name + STORE), ", ").concat(modifyExpr, ")") - }] - }); - }); - return cleanupEmptyOnArray(signals); - } - - function assembleFacetSignals(model, signals) { - if (model.component.selection && keys(model.component.selection).length) { - var name = $(model.getName('cell')); - signals.unshift({ - name: 'facet', - value: {}, - on: [{ - events: parseSelector('mousemove', 'scope'), - update: "isTuple(facet) ? facet : group(".concat(name, ").datum") - }] - }); - } - - return cleanupEmptyOnArray(signals); - } - - function assembleTopLevelSignals(model, signals) { - var hasSelections = false; - forEachSelection(model, function (selCmpt, selCompiler) { - var name = selCmpt.name; - var store = $(name + STORE); - var hasSg = signals.filter(function (s) { - return s.name === name; - }); - - if (hasSg.length === 0) { - var resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve; - var isMulti = selCmpt.type === 'multi' ? ', true)' : ')'; - signals.push({ - name: selCmpt.name, - update: "".concat(VL_SELECTION_RESOLVE, "(").concat(store, ", ").concat($(resolve)).concat(isMulti) - }); - } - - hasSelections = true; - - if (selCompiler.topLevelSignals) { - signals = selCompiler.topLevelSignals(model, selCmpt, signals); - } - - forEachTransform(selCmpt, function (txCompiler) { - if (txCompiler.topLevelSignals) { - signals = txCompiler.topLevelSignals(model, selCmpt, signals); - } - }); - }); - - if (hasSelections) { - var hasUnit = signals.filter(function (s) { - return s.name === 'unit'; - }); - - if (hasUnit.length === 0) { - signals.unshift({ - name: 'unit', - value: {}, - on: [{ - events: 'mousemove', - update: 'isTuple(group()) ? group() : unit' - }] - }); - } - } - - return cleanupEmptyOnArray(signals); - } - - function assembleUnitSelectionData(model, data) { - var dataCopy = _toConsumableArray(data); - - forEachSelection(model, function (selCmpt) { - var init = { - name: selCmpt.name + STORE - }; - - if (selCmpt.init) { - var fields = selCmpt.project.items.map(function (proj) { - var rest = __rest(proj, ["signals"]); - - return rest; - }); - var insert = selCmpt.init.map(function (i) { - return assembleInit(i, false); - }); - init.values = selCmpt.type === 'interval' ? [{ - unit: unitName(model, { - escape: false - }), - fields: fields, - values: insert - }] : insert.map(function (i) { - return { - unit: unitName(model, { - escape: false - }), - fields: fields, - values: i - }; - }); - } - - var contains = dataCopy.filter(function (d) { - return d.name === selCmpt.name + STORE; - }); - - if (!contains.length) { - dataCopy.push(init); - } - }); - return dataCopy; - } - - function assembleUnitSelectionMarks(model, marks) { - forEachSelection(model, function (selCmpt, selCompiler) { - marks = selCompiler.marks ? selCompiler.marks(model, selCmpt, marks) : marks; - forEachTransform(selCmpt, function (txCompiler) { - if (txCompiler.marks) { - marks = txCompiler.marks(model, selCmpt, marks); - } - }); - }); - return marks; - } - - function assembleLayerSelectionMarks(model, marks) { - var _iterator61 = _createForOfIteratorHelper(model.children), - _step61; - - try { - for (_iterator61.s(); !(_step61 = _iterator61.n()).done;) { - var child = _step61.value; - - if (isUnitModel(child)) { - marks = assembleUnitSelectionMarks(child, marks); - } - } - } catch (err) { - _iterator61.e(err); - } finally { - _iterator61.f(); - } - - return marks; - } - - function assembleSelectionScaleDomain(model, extent) { - var name = extent.selection; - var selCmpt = model.getSelectionComponent(name, varName(name)); - return { - signal: parseSelectionBinExtent(selCmpt, extent) - }; - } - - function cleanupEmptyOnArray(signals) { - return signals.map(function (s) { - if (s.on && !s.on.length) delete s.on; - return s; - }); - } - - var BRUSH = '_brush'; - var SCALE_TRIGGER = '_scale_trigger'; - var interval = { - signals: function signals(model, selCmpt) { - var name = selCmpt.name; - var fieldsSg = name + TUPLE_FIELDS; - var hasScales = scaleBindings.has(selCmpt); - var signals = []; - var dataSignals = []; - var scaleTriggers = []; - - if (selCmpt.translate && !hasScales) { - var filterExpr = "!event.item || event.item.mark.name !== ".concat($(name + BRUSH)); - events(selCmpt, function (on, evt) { - var _a; - - var filters = array((_a = evt.between[0].filter) !== null && _a !== void 0 ? _a : evt.between[0].filter = []); - - if (filters.indexOf(filterExpr) < 0) { - filters.push(filterExpr); - } - - return on; - }); - } - - selCmpt.project.items.forEach(function (proj, i) { - var channel = proj.channel; - - if (channel !== X && channel !== Y) { - warn('Interval selections only support x and y encoding channels.'); - return; - } - - var init = selCmpt.init ? selCmpt.init[i] : null; - var cs = channelSignals(model, selCmpt, proj, init); - var dname = proj.signals.data; - var vname = proj.signals.visual; - var scaleName = $(model.scaleName(channel)); - var scaleType = model.getScaleComponent(channel).get('type'); - var toNum = hasContinuousDomain(scaleType) ? '+' : ''; - signals.push.apply(signals, _toConsumableArray(cs)); - dataSignals.push(dname); - scaleTriggers.push({ - scaleName: model.scaleName(channel), - expr: "(!isArray(".concat(dname, ") || ") + "(".concat(toNum, "invert(").concat(scaleName, ", ").concat(vname, ")[0] === ").concat(toNum).concat(dname, "[0] && ") + "".concat(toNum, "invert(").concat(scaleName, ", ").concat(vname, ")[1] === ").concat(toNum).concat(dname, "[1]))") - }); - }); // Proxy scale reactions to ensure that an infinite loop doesn't occur - // when an interval selection filter touches the scale. - - if (!hasScales) { - signals.push({ - name: name + SCALE_TRIGGER, - value: {}, - on: [{ - events: scaleTriggers.map(function (t) { - return { - scale: t.scaleName - }; - }), - update: scaleTriggers.map(function (t) { - return t.expr; - }).join(' && ') + " ? ".concat(name + SCALE_TRIGGER, " : {}") - }] - }); - } // Only add an interval to the store if it has valid data extents. Data extents - // are set to null if pixel extents are equal to account for intervals over - // ordinal/nominal domains which, when inverted, will still produce a valid datum. - - - var init = selCmpt.init; - var update = "unit: ".concat(unitName(model), ", fields: ").concat(fieldsSg, ", values"); - return signals.concat(Object.assign(Object.assign({ - name: name + TUPLE - }, init ? { - init: "{".concat(update, ": ").concat(assembleInit(init), "}") - } : {}), { - on: [{ - events: [{ - signal: dataSignals.join(' || ') - }], - update: dataSignals.join(' && ') + " ? {".concat(update, ": [").concat(dataSignals, "]} : null") - }] - })); - }, - modifyExpr: function modifyExpr(model, selCmpt) { - var tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : "{unit: ".concat(unitName(model), "}")); - }, - marks: function marks(model, selCmpt, _marks2) { - var name = selCmpt.name; - var _selCmpt$project$hasC4 = selCmpt.project.hasChannel, - x = _selCmpt$project$hasC4.x, - y = _selCmpt$project$hasC4.y; - var xvname = x && x.signals.visual; - var yvname = y && y.signals.visual; - var store = "data(".concat($(selCmpt.name + STORE), ")"); // Do not add a brush if we're binding to scales. - - if (scaleBindings.has(selCmpt)) { - return _marks2; - } - - var update = { - x: x !== undefined ? { - signal: "".concat(xvname, "[0]") - } : { - value: 0 - }, - y: y !== undefined ? { - signal: "".concat(yvname, "[0]") - } : { - value: 0 - }, - x2: x !== undefined ? { - signal: "".concat(xvname, "[1]") - } : { - field: { - group: 'width' - } - }, - y2: y !== undefined ? { - signal: "".concat(yvname, "[1]") - } : { - field: { - group: 'height' - } - } - }; // If the selection is resolved to global, only a single interval is in - // the store. Wrap brush mark's encodings with a production rule to test - // this based on the `unit` property. Hide the brush mark if it corresponds - // to a unit different from the one in the store. - - if (selCmpt.resolve === 'global') { - var _iterator62 = _createForOfIteratorHelper(keys(update)), - _step62; - - try { - for (_iterator62.s(); !(_step62 = _iterator62.n()).done;) { - var key = _step62.value; - update[key] = [Object.assign({ - test: "".concat(store, ".length && ").concat(store, "[0].unit === ").concat(unitName(model)) - }, update[key]), { - value: 0 - }]; - } - } catch (err) { - _iterator62.e(err); - } finally { - _iterator62.f(); - } - } // Two brush marks ensure that fill colors and other aesthetic choices do - // not interefere with the core marks, but that the brushed region can still - // be interacted with (e.g., dragging it around). - - - var _a = selCmpt.mark, - fill = _a.fill, - fillOpacity = _a.fillOpacity, - cursor = _a.cursor, - stroke = __rest(_a, ["fill", "fillOpacity", "cursor"]); - - var vgStroke = keys(stroke).reduce(function (def, k) { - def[k] = [{ - test: [x !== undefined && "".concat(xvname, "[0] !== ").concat(xvname, "[1]"), y !== undefined && "".concat(yvname, "[0] !== ").concat(yvname, "[1]")].filter(function (t) { - return t; - }).join(' && '), - value: stroke[k] - }, { - value: null - }]; - return def; - }, {}); - return [{ - name: name + BRUSH + '_bg', - type: 'rect', - clip: true, - encode: { - enter: { - fill: { - value: fill - }, - fillOpacity: { - value: fillOpacity - } - }, - update: update - } - }].concat(_toConsumableArray(_marks2), [{ - name: name + BRUSH, - type: 'rect', - clip: true, - encode: { - enter: Object.assign(Object.assign({}, cursor ? { - cursor: { - value: cursor - } - } : {}), { - fill: { - value: 'transparent' - } - }), - update: Object.assign(Object.assign({}, update), vgStroke) - } - }]); - } - }; - /** - * Returns the visual and data signals for an interval selection. - */ - - function channelSignals(model, selCmpt, proj, init) { - var channel = proj.channel; - var vname = proj.signals.visual; - var dname = proj.signals.data; - var hasScales = scaleBindings.has(selCmpt); - var scaleName = $(model.scaleName(channel)); - var scale = model.getScaleComponent(channel); - var scaleType = scale ? scale.get('type') : undefined; - - var scaled = function scaled(str) { - return "scale(".concat(scaleName, ", ").concat(str, ")"); - }; - - var size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal; - var coord = "".concat(channel, "(unit)"); - var on = events(selCmpt, function (def, evt) { - return [].concat(_toConsumableArray(def), [{ - events: evt.between[0], - update: "[".concat(coord, ", ").concat(coord, "]") - }, { - events: evt, - update: "[".concat(vname, "[0], clamp(").concat(coord, ", 0, ").concat(size, ")]") - } // Brush End - ]); - }); // React to pan/zooms of continuous scales. Non-continuous scales - // (band, point) cannot be pan/zoomed and any other changes - // to their domains (e.g., filtering) should clear the brushes. - - on.push({ - events: { - signal: selCmpt.name + SCALE_TRIGGER - }, - update: hasContinuousDomain(scaleType) ? "[".concat(scaled("".concat(dname, "[0]")), ", ").concat(scaled("".concat(dname, "[1]")), "]") : "[0, 0]" - }); - return hasScales ? [{ - name: dname, - on: [] - }] : [Object.assign(Object.assign({ - name: vname - }, init ? { - init: assembleInit(init, true, scaled) - } : { - value: [] - }), { - on: on - }), Object.assign(Object.assign({ - name: dname - }, init ? { - init: assembleInit(init) - } : {}), { - on: [{ - events: { - signal: vname - }, - update: "".concat(vname, "[0] === ").concat(vname, "[1] ? null : invert(").concat(scaleName, ", ").concat(vname, ")") - }] - })]; - } - - function events(selCmpt, cb) { - return selCmpt.events.reduce(function (on, evt) { - if (!evt.between) { - warn("".concat(evt, " is not an ordered event stream for interval selections.")); - return on; - } - - return cb(on, evt); - }, []); - } - - function singleOrMultiSignals(model, selCmpt) { - var name = selCmpt.name; - var fieldsSg = name + TUPLE_FIELDS; - var project = selCmpt.project; - var datum = '(item().isVoronoi ? datum.datum : datum)'; - var values = project.items.map(function (p) { - var fieldDef = model.fieldDef(p.channel); // Binned fields should capture extents, for a range test against the raw field. - - return fieldDef && fieldDef.bin ? "[".concat(datum, "[").concat($(model.vgField(p.channel, {})), "], ") + "".concat(datum, "[").concat($(model.vgField(p.channel, { - binSuffix: 'end' - })), "]]") : "".concat(datum, "[").concat($(p.field), "]"); - }).join(', '); // Only add a discrete selection to the store if a datum is present _and_ - // the interaction isn't occurring on a group mark. This guards against - // polluting interactive state with invalid values in faceted displays - // as the group marks are also data-driven. We force the update to account - // for constant null states but varying toggles (e.g., shift-click in - // whitespace followed by a click in whitespace; the store should only - // be cleared on the second click). - - var update = "unit: ".concat(unitName(model), ", fields: ").concat(fieldsSg, ", values"); - var events = selCmpt.events; - return [{ - name: name + TUPLE, - on: events ? [{ - events: events, - update: "datum && item().mark.marktype !== 'group' ? {".concat(update, ": [").concat(values, "]} : null"), - force: true - }] : [] - }]; - } - - var multi = { - signals: singleOrMultiSignals, - modifyExpr: function modifyExpr(model, selCmpt) { - var tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'null' : "{unit: ".concat(unitName(model), "}")); - } - }; - var single = { - signals: singleOrMultiSignals, - modifyExpr: function modifyExpr(model, selCmpt) { - var tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : "{unit: ".concat(unitName(model), "}")); - } - }; - var STORE = '_store'; - var TUPLE = '_tuple'; - var MODIFY = '_modify'; - var VL_SELECTION_RESOLVE = 'vlSelectionResolve'; - var compilers$1 = { - single: single, - multi: multi, - interval: interval - }; - - function forEachSelection(model, cb) { - var selections = model.component.selection; - - if (selections) { - var _iterator63 = _createForOfIteratorHelper(vals(selections)), - _step63; - - try { - for (_iterator63.s(); !(_step63 = _iterator63.n()).done;) { - var sel = _step63.value; - var success = cb(sel, compilers$1[sel.type]); - if (success === true) break; - } - } catch (err) { - _iterator63.e(err); - } finally { - _iterator63.f(); - } - } - } - - function getFacetModel(model) { - var parent = model.parent; - - while (parent) { - if (isFacetModel(parent)) { - break; - } - - parent = parent.parent; - } - - return parent; - } - - function unitName(model) { - var _ref52 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { - escape: true - }, - escape = _ref52.escape; - - var name = escape ? $(model.name) : model.name; - var facetModel = getFacetModel(model); - - if (facetModel) { - var facet = facetModel.facet; - - var _iterator64 = _createForOfIteratorHelper(FACET_CHANNELS), - _step64; - - try { - for (_iterator64.s(); !(_step64 = _iterator64.n()).done;) { - var channel = _step64.value; - - if (facet[channel]) { - name += " + '__facet_".concat(channel, "_' + (facet[").concat($(facetModel.vgField(channel)), "])"); - } - } - } catch (err) { - _iterator64.e(err); - } finally { - _iterator64.f(); - } - } - - return name; - } - - function requiresSelectionId(model) { - var identifier = false; - forEachSelection(model, function (selCmpt) { - identifier = identifier || selCmpt.project.items.some(function (proj) { - return proj.field === SELECTION_ID; - }); - }); - return identifier; - } - - var RawCode = 'RawCode'; - var Literal = 'Literal'; - var Property = 'Property'; - var Identifier = 'Identifier'; - var ArrayExpression = 'ArrayExpression'; - var BinaryExpression = 'BinaryExpression'; - var CallExpression = 'CallExpression'; - var ConditionalExpression = 'ConditionalExpression'; - var LogicalExpression = 'LogicalExpression'; - var MemberExpression = 'MemberExpression'; - var ObjectExpression = 'ObjectExpression'; - var UnaryExpression = 'UnaryExpression'; - - function ASTNode(type) { - this.type = type; - } - - ASTNode.prototype.visit = function (visitor) { - var node = this, - c, - i, - n; - if (visitor(node)) return 1; - - for (c = children(node), i = 0, n = c.length; i < n; ++i) { - if (c[i].visit(visitor)) return 1; - } - }; - - function children(node) { - switch (node.type) { - case ArrayExpression: - return node.elements; - - case BinaryExpression: - case LogicalExpression: - return [node.left, node.right]; - - case CallExpression: - var args = node.arguments.slice(); - args.unshift(node.callee); - return args; - - case ConditionalExpression: - return [node.test, node.consequent, node.alternate]; - - case MemberExpression: - return [node.object, node.property]; - - case ObjectExpression: - return node.properties; - - case Property: - return [node.key, node.value]; - - case UnaryExpression: - return [node.argument]; - - case Identifier: - case Literal: - case RawCode: - default: - return []; - } - } - /* - The following expression parser is based on Esprima (http://esprima.org/). - Original header comment and license for Esprima is included here: - Copyright (C) 2013 Ariya Hidayat - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - 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. - 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 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. - */ - - - var TokenName, source, index, length, lookahead; - var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; - TokenName = {}; - TokenName[TokenBooleanLiteral] = 'Boolean'; - TokenName[TokenEOF] = ''; - TokenName[TokenIdentifier] = 'Identifier'; - TokenName[TokenKeyword] = 'Keyword'; - TokenName[TokenNullLiteral] = 'Null'; - TokenName[TokenNumericLiteral] = 'Numeric'; - TokenName[TokenPunctuator] = 'Punctuator'; - TokenName[TokenStringLiteral] = 'String'; - TokenName[TokenRegularExpression] = 'RegularExpression'; - var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; // Error messages should be identical to V8. - - var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; - var ILLEGAL$1 = 'ILLEGAL', - DISABLED = 'Disabled.'; // See also tools/generate-unicode-regex.py. - - var RegexNonAsciiIdentifierStart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), - // eslint-disable-next-line no-misleading-character-class - RegexNonAsciiIdentifierPart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E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\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"); // Ensure the condition is true, otherwise throw an error. - // This is only to have a better contract semantic, i.e. another safety net - // to catch a logic error. The condition shall be fulfilled in normal case. - // Do NOT use this to enforce a certain condition on any user input. - - function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - - function isDecimalDigit(ch) { - return ch >= 0x30 && ch <= 0x39; // 0..9 - } - - function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; - } - - function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; - } // 7.2 White Space - - - function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0; - } // 7.3 Line Terminators - - - function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; - } // 7.6 Identifier Names and Identifiers - - - function isIdentifierStart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)); - } - - function isIdentifierPart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)); - } // 7.6.1.1 Keywords - - - var keywords = { - 'if': 1, - 'in': 1, - 'do': 1, - 'var': 1, - 'for': 1, - 'new': 1, - 'try': 1, - 'let': 1, - 'this': 1, - 'else': 1, - 'case': 1, - 'void': 1, - 'with': 1, - 'enum': 1, - 'while': 1, - 'break': 1, - 'catch': 1, - 'throw': 1, - 'const': 1, - 'yield': 1, - 'class': 1, - 'super': 1, - 'return': 1, - 'typeof': 1, - 'delete': 1, - 'switch': 1, - 'export': 1, - 'import': 1, - 'public': 1, - 'static': 1, - 'default': 1, - 'finally': 1, - 'extends': 1, - 'package': 1, - 'private': 1, - 'function': 1, - 'continue': 1, - 'debugger': 1, - 'interface': 1, - 'protected': 1, - 'instanceof': 1, - 'implements': 1 - }; - - function skipComment() { - var ch; - - while (index < length) { - ch = source.charCodeAt(index); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index; - } else { - break; - } - } - } - - function scanHexEscape(prefix) { - var i, - len, - ch, - code = 0; - len = prefix === 'u' ? 4 : 2; - - for (i = 0; i < len; ++i) { - if (index < length && isHexDigit(source[index])) { - ch = source[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - } - - return String.fromCharCode(code); - } - - function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - ch = source[index]; - code = 0; // At least, one hex digit is required. - - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - while (index < length) { - ch = source[index++]; - - if (!isHexDigit(ch)) { - break; - } - - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } // UTF-16 Encoding - - - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - - cu1 = (code - 0x10000 >> 10) + 0xD800; - cu2 = (code - 0x10000 & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); - } - - function getEscapedIdentifier() { - var ch, id; - ch = source.charCodeAt(index++); - id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character. - - if (ch === 0x5C) { - if (source.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - ++index; - ch = scanHexEscape('u'); - - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - id = ch; - } - - while (index < length) { - ch = source.charCodeAt(index); - - if (!isIdentifierPart(ch)) { - break; - } - - ++index; - id += String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character. - - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - - if (source.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - ++index; - ch = scanHexEscape('u'); - - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - id += ch; - } - } - - return id; - } - - function getIdentifier() { - var start, ch; - start = index++; - - while (index < length) { - ch = source.charCodeAt(index); - - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); - } - - if (isIdentifierPart(ch)) { - ++index; - } else { - break; - } - } - - return source.slice(start, index); - } - - function scanIdentifier() { - var start, id, type; - start = index; // Backslash (U+005C) starts an escaped character. - - id = source.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { - // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index - }; - } // 7.7 Punctuators - - - function scanPunctuator() { - var start = index, - code = source.charCodeAt(index), - code2, - ch1 = source[index], - ch2, - ch3, - ch4; - - switch (code) { - // Check for most common single-character punctuators. - case 0x2E: // . dot - - case 0x28: // ( open bracket - - case 0x29: // ) close bracket - - case 0x3B: // ; semicolon - - case 0x2C: // , comma - - case 0x7B: // { open curly brace - - case 0x7D: // } close curly brace - - case 0x5B: // [ - - case 0x5D: // ] - - case 0x3A: // : - - case 0x3F: // ? - - case 0x7E: - // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - - default: - code2 = source.charCodeAt(index + 1); // '=' (U+003D) marks an assignment or comparison operator. - - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - - case 0x2D: // - - - case 0x2F: // / - - case 0x3C: // < - - case 0x3E: // > - - case 0x5E: // ^ - - case 0x7C: // | - - case 0x25: // % - - case 0x26: // & - - case 0x2A: - // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - - case 0x21: // ! - - case 0x3D: - // = - index += 2; // !== and === - - if (source.charCodeAt(index) === 0x3D) { - ++index; - } - - return { - type: TokenPunctuator, - value: source.slice(start, index), - start: start, - end: index - }; - } - } - - } // 4-character punctuator: >>>= - - - ch4 = source.substr(index, 4); - - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } // 3-character punctuators: === !== >>> <<= >>= - - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } // Other 2-character punctuators: ++ -- << >> && || - - - ch2 = ch3.substr(0, 2); - - if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } // 1-character punctuators: < > = ! + - * % & | ^ / - - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } // 7.8.3 Numeric Literals - - - function scanHexLiteral(start) { - var number = ''; - - while (index < length) { - if (!isHexDigit(source[index])) { - break; - } - - number += source[index++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index - }; - } - - function scanOctalLiteral(start) { - var number = '0' + source[index++]; - - while (index < length) { - if (!isOctalDigit(source[index])) { - break; - } - - number += source[index++]; - } - - if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; - } - - function scanNumericLiteral() { - var number, start, ch; - ch = source[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point'); - start = index; - number = ''; - - if (ch !== '.') { - number = source[index++]; - ch = source[index]; // Hex number starts with '0x'. - // Octal number starts with '0'. - - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } // decimal number starts with '0' such as '09' is illegal. - - - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - } - - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - - ch = source[index]; - } - - if (ch === '.') { - number += source[index++]; - - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - - ch = source[index]; - } - - if (ch === 'e' || ch === 'E') { - number += source[index++]; - ch = source[index]; - - if (ch === '+' || ch === '-') { - number += source[index++]; - } - - if (isDecimalDigit(source.charCodeAt(index))) { - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; - } // 7.8.4 String Literals - - - function scanStringLiteral() { - var str = '', - quote, - start, - ch, - code, - octal = false; - quote = source[index]; - assert(quote === '\'' || quote === '"', 'String literal must starts with a quote'); - start = index; - ++index; - - while (index < length) { - ch = source[index++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source[index++]; - - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - - break; - - case 'n': - str += '\n'; - break; - - case 'r': - str += '\r'; - break; - - case 't': - str += '\t'; - break; - - case 'b': - str += '\b'; - break; - - case 'f': - str += '\f'; - break; - - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); // \0 is not octal escape sequence - - if (code !== 0) { - octal = true; - } - - if (index < length && isOctalDigit(source[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source[index++]); // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - - if ('0123'.indexOf(ch) >= 0 && index < length && isOctalDigit(source[index])) { - code = code * 8 + '01234567'.indexOf(source[index++]); - } - } - - str += String.fromCharCode(code); - } else { - str += ch; - } - - break; - } - } else { - if (ch === '\r' && source[index] === '\n') { - ++index; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index - }; - } - - function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - - throwError({}, MessageInvalidRegExp); - }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } // First, detect invalid regular expressions. - - - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - - - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } - } - - function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - ch = source[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source[index++]; - classMarker = false; - terminated = false; - - while (index < length) { - ch = source[index++]; - str += ch; - - if (ch === '\\') { - ch = source[index++]; // ECMA-262 7.8.5 - - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } // Exclude leading and trailing slash. - - - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; - } - - function scanRegExpFlags() { - var ch, str, flags; - str = ''; - flags = ''; - - while (index < length) { - ch = source[index]; - - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index; - - if (ch === '\\' && index < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; - } - - function scanRegExp() { - var start, body, flags, value; - lookahead = null; - skipComment(); - start = index; - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index - }; - } - - function isIdentifierName(token) { - return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; - } - - function advance() { - var ch; - skipComment(); - - if (index >= length) { - return { - type: TokenEOF, - start: index, - end: index - }; - } - - ch = source.charCodeAt(index); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } // Very common: ( and ) and ; - - - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } // String literal starts with single quote (U+0027) or double quote (U+0022). - - - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - - - if (ch === 0x2E) { - if (isDecimalDigit(source.charCodeAt(index + 1))) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - function lex() { - var token; - token = lookahead; - index = token.end; - lookahead = advance(); - index = token.end; - return token; - } - - function peek() { - var pos; - pos = index; - lookahead = advance(); - index = pos; - } - - function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; - } - - function finishBinaryExpression(operator, left, right) { - var node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; - } - - function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; - } - - function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; - } - - function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; - } - - function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source.slice(token.start, token.end); - - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - - node.regex = token.regex; - } - - return node; - } - - function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; - } - - function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; - } - - function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; - } - - function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; - } // Throw an exception - - - function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace(/%(\d)/g, function (whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - }); - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; - } // Throw an exception because of the token. - - - function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } // BooleanLiteral, NullLiteral, or Punctuator. - - - throwError(token, MessageUnexpectedToken, token.value); - } // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - - - function expect(value) { - var token = lex(); - - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } - } // Return true if the next token matches the specified punctuator. - - - function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; - } // Return true if the next token matches the specified keyword - - - function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; - } // 11.1.4 Array Initialiser - - - function parseArrayInitialiser() { - var elements = []; - index = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - return finishArrayExpression(elements); - } // 11.1.5 Object Initialiser - - - function parseObjectPropertyKey() { - var token; - index = lookahead.start; - token = lex(); // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - - return finishLiteral(token); - } - - return finishIdentifier(token.value); - } - - function parseObjectProperty() { - var token, key, id, value; - index = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } - } - - function parseObjectInitialiser() { - var properties = [], - property, - name, - key, - map = {}, - toString = String; - index = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - return finishObjectExpression(properties); - } // 11.1.6 The Grouping Operator - - - function parseGroupExpression() { - var expr; - expect('('); - expr = parseExpression(); - expect(')'); - return expr; - } // 11.1 Primary Expressions - - - var legalKeywords = { - 'if': 1 - }; - - function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index = lookahead.start; - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = token.value === 'true'; - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek(); - } else { - throwUnexpected(lex()); - } - - return expr; - } // 11.2 Left-Hand-Side Expressions - - - function parseArguments() { - var args = []; - expect('('); - - if (!match(')')) { - while (index < length) { - args.push(parseConditionalExpression()); - - if (match(')')) { - break; - } - - expect(','); - } - } - - expect(')'); - return args; - } - - function parseNonComputedProperty() { - var token; - index = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); - } - - function parseNonComputedMember() { - expect('.'); - return parseNonComputedProperty(); - } - - function parseComputedMember() { - var expr; - expect('['); - expr = parseExpression(); - expect(']'); - return expr; - } - - function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; - } // 11.3 Postfix Expressions - - - function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if (match('++') || match('--')) { - throw new Error(DISABLED); - } - } - - return expr; - } // 11.4 Unary Operators - - - function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; - } - - function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - } - - return prec; - } // 11.5 Multiplicative Operators - // 11.6 Additive Operators - // 11.7 Bitwise Shift Operators - // 11.8 Relational Operators - // 11.9 Equality Operators - // 11.10 Binary Bitwise Operators - // 11.11 Binary Logical Operators - - - function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - marker = lookahead; - left = parseUnaryExpression(); - token = lookahead; - prec = binaryPrecedence(token); - - if (prec === 0) { - return left; - } - - token.prec = prec; - lex(); - markers = [marker, lookahead]; - right = parseUnaryExpression(); - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - // Reduce: make a binary expression from the three topmost entries. - while (stack.length > 2 && prec <= stack[stack.length - 2].prec) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } // Shift. - - - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } // Final reduce to clean-up the stack. - - - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; - } // 11.12 Conditional Operator - - - function parseConditionalExpression() { - var expr, consequent, alternate; - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; - } // 11.14 Comma Operator - - - function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; - } - - function parse(code) { - source = code; - index = 0; - length = source.length; - lookahead = null; - peek(); - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - - return expr; - } - - function getName(node) { - var name = []; - - if (node.type === 'Identifier') { - return [node.name]; - } - - if (node.type === 'Literal') { - return [node.value]; - } - - if (node.type === 'MemberExpression') { - name.push.apply(name, _toConsumableArray(getName(node.object))); - name.push.apply(name, _toConsumableArray(getName(node.property))); - } - - return name; - } - - function startsWithDatum(node) { - if (node.object.type === 'MemberExpression') { - return startsWithDatum(node.object); - } - - return node.object.name === 'datum'; - } - - function getDependentFields(expression) { - var ast = parse(expression); - var dependents = new Set(); - ast.visit(function (node) { - if (node.type === 'MemberExpression' && startsWithDatum(node)) { - dependents.add(getName(node).slice(1).join('.')); - } - }); - return dependents; - } - - var FilterNode = /*#__PURE__*/function (_DataFlowNode3) { - _inherits(FilterNode, _DataFlowNode3); - - var _super5 = _createSuper(FilterNode); - - function FilterNode(parent, model, filter) { - var _this10; - - _classCallCheck(this, FilterNode); - - _this10 = _super5.call(this, parent); - _this10.model = model; - _this10.filter = filter; // TODO: refactor this to not take a node and - // then add a static function makeFromOperand and make the constructor take only an expression - - _this10.expr = expression(_this10.model, _this10.filter, _assertThisInitialized(_this10)); - _this10._dependentFields = getDependentFields(_this10.expr); - return _this10; - } - - _createClass(FilterNode, [{ - key: "clone", - value: function clone() { - return new FilterNode(null, this.model, duplicate(this.filter)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return this._dependentFields; - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(); // filter does not produce any new fields - } - }, { - key: "assemble", - value: function assemble() { - return { - type: 'filter', - expr: this.expr - }; - } - }, { - key: "hash", - value: function hash() { - return "Filter ".concat(this.expr); - } - }]); - - return FilterNode; - }(DataFlowNode); - - function parseUnitSelection(model, selDefs) { - var _a; - - var selCmpts = {}; - var selectionConfig = model.config.selection; - - var _iterator65 = _createForOfIteratorHelper(keys(selDefs !== null && selDefs !== void 0 ? selDefs : {})), - _step65; - - try { - var _loop6 = function _loop6() { - var name = _step65.value; - var selDef = duplicate(selDefs[name]); - - var _b = selectionConfig[selDef.type], - cfg = __rest(_b, ["fields", "encodings"]); // Project transform applies its defaults. - // Set default values from config if a property hasn't been specified, - // or if it is true. E.g., "translate": true should use the default - // event handlers for translate. However, true may be a valid value for - // a property (e.g., "nearest": true). - - - for (var key in cfg) { - // A selection should contain either `encodings` or `fields`, only use - // default values for these two values if neither of them is specified. - if (key === 'encodings' && selDef.fields || key === 'fields' && selDef.encodings) { - continue; - } - - if (key === 'mark') { - selDef[key] = Object.assign(Object.assign({}, cfg[key]), selDef[key]); - } - - if (selDef[key] === undefined || selDef[key] === true) { - selDef[key] = (_a = cfg[key]) !== null && _a !== void 0 ? _a : selDef[key]; - } - } - - var safeName = varName(name); - var selCmpt = selCmpts[safeName] = Object.assign(Object.assign({}, selDef), { - name: safeName, - events: isString(selDef.on) ? parseSelector(selDef.on, 'scope') : duplicate(selDef.on) - }); - forEachTransform(selCmpt, function (txCompiler) { - if (txCompiler.has(selCmpt) && txCompiler.parse) { - txCompiler.parse(model, selCmpt, selDef, selDefs[name]); - } - }); - }; - - for (_iterator65.s(); !(_step65 = _iterator65.n()).done;) { - _loop6(); - } - } catch (err) { - _iterator65.e(err); - } finally { - _iterator65.f(); - } - - return selCmpts; - } - - function parseSelectionPredicate(model, selections, dfnode) { - var datum = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'datum'; - var stores = []; - - function expr(name) { - var vname = varName(name); - var selCmpt = model.getSelectionComponent(vname, name); - var store = $(vname + STORE); - - if (selCmpt.project.timeUnit) { - var child = dfnode !== null && dfnode !== void 0 ? dfnode : model.component.data.raw; - var tunode = selCmpt.project.timeUnit.clone(); - - if (child.parent) { - tunode.insertAsParentOf(child); - } else { - child.parent = tunode; - } - } - - if (selCmpt.empty !== 'none') { - stores.push(store); - } - - return "vlSelectionTest(".concat(store, ", ").concat(datum) + (selCmpt.resolve === 'global' ? ')' : ", ".concat($(selCmpt.resolve), ")")); - } - - var predicateStr = logicalExpr(selections, expr); - return (stores.length ? '!(' + stores.map(function (s) { - return "length(data(".concat(s, "))"); - }).join(' || ') + ') || ' : '') + "(".concat(predicateStr, ")"); - } - - function parseSelectionBinExtent(selCmpt, extent) { - var encoding = extent['encoding']; - var field = extent['field']; - - if (!encoding && !field) { - field = selCmpt.project.items[0].field; - - if (selCmpt.project.items.length > 1) { - warn('A "field" or "encoding" must be specified when using a selection as a scale domain. ' + "Using \"field\": ".concat($(field), ".")); - } - } else if (encoding && !field) { - var encodings = selCmpt.project.items.filter(function (p) { - return p.channel === encoding; - }); - - if (!encodings.length || encodings.length > 1) { - field = selCmpt.project.items[0].field; - warn((!encodings.length ? 'No ' : 'Multiple ') + "matching ".concat($(encoding), " encoding found for selection ").concat($(extent.selection), ". ") + "Using \"field\": ".concat($(field), ".")); - } else { - field = encodings[0].field; - } - } - - return "".concat(selCmpt.name, "[").concat($(field), "]"); - } - - function materializeSelections(model, main) { - forEachSelection(model, function (selCmpt) { - var selection = selCmpt.name; - var lookupName = model.getName("lookup_".concat(selection)); - model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(new FilterNode(main, model, { - selection: selection - }), lookupName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); - }); - } - /** - * Converts a predicate into an expression. - */ - // model is only used for selection filters. - - - function expression(model, filterOp, node) { - return logicalExpr(filterOp, function (predicate) { - if (isString(predicate)) { - return predicate; - } else if (isSelectionPredicate(predicate)) { - return parseSelectionPredicate(model, predicate.selection, node); - } else { - // Filter Object - return fieldFilterExpression(predicate); - } - }); - } - - function assembleTitle(title, config) { - if (!title) { - return undefined; - } - - if (isArray(title) && !isText(title)) { - return title.map(function (fieldDef) { - return defaultTitle(fieldDef, config); - }).join(', '); - } - - return title; - } - - function setAxisEncode(axis, part, vgProp, vgRef) { - var _a, _b, _c; - - axis.encode = (_a = axis.encode) !== null && _a !== void 0 ? _a : {}; - axis.encode[part] = (_b = axis.encode[part]) !== null && _b !== void 0 ? _b : {}; - axis.encode[part].update = (_c = axis.encode[part].update) !== null && _c !== void 0 ? _c : {}; // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 - - axis.encode[part].update[vgProp] = vgRef; - } - - function assembleAxis(axisCmpt, kind, config) { - var opt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : { - header: false - }; - - var _a, _b; - - var _c = axisCmpt.combine(), - disable = _c.disable, - orient = _c.orient, - scale = _c.scale, - labelExpr = _c.labelExpr, - title = _c.title, - zindex = _c.zindex, - axis = __rest(_c, ["disable", "orient", "scale", "labelExpr", "title", "zindex"]); - - if (disable) { - return undefined; - } - - for (var prop in axis) { - var propType = AXIS_PROPERTY_TYPE[prop]; - var propValue = axis[prop]; - - if (propType && propType !== kind && propType !== 'both') { - // Remove properties that are not valid for this kind of axis - delete axis[prop]; - } else if (isConditionalAxisValue(propValue)) { - // deal with conditional axis value - var condition = propValue.condition, - valueOrSignalRef = __rest(propValue, ["condition"]); - - var conditions = array(condition); - var propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; - - if (propIndex) { - var vgProp = propIndex.vgProp, - part = propIndex.part; // If there is a corresponding Vega property for the channel, - // use Vega's custom axis encoding and delete the original axis property to avoid conflicts - - var vgRef = [].concat(_toConsumableArray(conditions.map(function (c) { - var test = c.test, - valueOrSignalCRef = __rest(c, ["test"]); - - return Object.assign({ - test: expression(null, test) - }, valueOrSignalCRef); - })), [valueOrSignalRef]); - setAxisEncode(axis, part, vgProp, vgRef); - delete axis[prop]; - } else if (propIndex === null) { - // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead. - var signalRef = { - signal: conditions.map(function (c) { - var test = c.test, - valueOrSignalCRef = __rest(c, ["test"]); - - return "".concat(expression(null, test), " ? ").concat(exprFromValueOrSignalRef(valueOrSignalCRef), " : "); - }).join('') + exprFromValueOrSignalRef(valueOrSignalRef) - }; - axis[prop] = signalRef; - } - } else if (isSignalRef(propValue)) { - var _propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; - - if (_propIndex) { - var _vgProp = _propIndex.vgProp, - _part = _propIndex.part; - setAxisEncode(axis, _part, _vgProp, propValue); - delete axis[prop]; - } // else do nothing since the property already supports signal - - } - } - - if (kind === 'grid') { - if (!axis.grid) { - return undefined; - } // Remove unnecessary encode block - - - if (axis.encode) { - // Only need to keep encode block for grid - var grid = axis.encode.grid; - axis.encode = Object.assign({}, grid ? { - grid: grid - } : {}); - - if (isEmpty(axis.encode)) { - delete axis.encode; - } - } - - return Object.assign(Object.assign({ - scale: scale, - orient: orient - }, axis), { - domain: false, - labels: false, - aria: false, - // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent` - // would not affect gridAxis - maxExtent: 0, - minExtent: 0, - ticks: false, - zindex: getFirstDefined(zindex, 0) // put grid behind marks by default - - }); - } else { - // kind === 'main' - if (!opt.header && axisCmpt.mainExtracted) { - // if mainExtracted has been extracted to a separate facet - return undefined; - } - - if (labelExpr !== undefined) { - var expr = labelExpr; - - if (((_b = (_a = axis.encode) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.update) && isSignalRef(axis.encode.labels.update.text)) { - expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal); - } - - setAxisEncode(axis, 'labels', 'text', { - signal: expr - }); - } - - if (axis.labelAlign === null) { - delete axis.labelAlign; - } // Remove unnecessary encode block - - - if (axis.encode) { - var _iterator66 = _createForOfIteratorHelper(AXIS_PARTS), - _step66; - - try { - for (_iterator66.s(); !(_step66 = _iterator66.n()).done;) { - var _part2 = _step66.value; - - if (!axisCmpt.hasAxisPart(_part2)) { - delete axis.encode[_part2]; - } - } - } catch (err) { - _iterator66.e(err); - } finally { - _iterator66.f(); - } - - if (isEmpty(axis.encode)) { - delete axis.encode; - } - } - - var titleString = assembleTitle(title, config); - return Object.assign(Object.assign(Object.assign(Object.assign({ - scale: scale, - orient: orient, - grid: false - }, titleString ? { - title: titleString - } : {}), axis), config.aria === false ? { - aria: false - } : {}), { - zindex: getFirstDefined(zindex, 0) // put axis line above marks by default - - }); - } - } - /** - * Add axis signals so grid line works correctly - * (Fix https://github.com/vega/vega-lite/issues/4226) - */ - - - function assembleAxisSignals(model) { - var axes = model.component.axes; - var signals = []; - - var _iterator67 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS), - _step67; - - try { - for (_iterator67.s(); !(_step67 = _iterator67.n()).done;) { - var channel = _step67.value; - - if (axes[channel]) { - var _iterator68 = _createForOfIteratorHelper(axes[channel]), - _step68; - - try { - for (_iterator68.s(); !(_step68 = _iterator68.n()).done;) { - var axis = _step68.value; - - if (!axis.get('disable') && !axis.get('gridScale')) { - // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width. - var sizeType = channel === 'x' ? 'height' : 'width'; - var update = model.getSizeSignalRef(sizeType).signal; - - if (sizeType !== update) { - signals.push({ - name: sizeType, - update: update - }); - } - } - } - } catch (err) { - _iterator68.e(err); - } finally { - _iterator68.f(); - } - } - } - } catch (err) { - _iterator67.e(err); - } finally { - _iterator67.f(); - } - - return signals; - } - - function _assembleAxes(axisComponents, config) { - var _axisComponents$x = axisComponents.x, - x = _axisComponents$x === void 0 ? [] : _axisComponents$x, - _axisComponents$y = axisComponents.y, - y = _axisComponents$y === void 0 ? [] : _axisComponents$y; - return [].concat(_toConsumableArray(x.map(function (a) { - return assembleAxis(a, 'grid', config); - })), _toConsumableArray(y.map(function (a) { - return assembleAxis(a, 'grid', config); - })), _toConsumableArray(x.map(function (a) { - return assembleAxis(a, 'main', config); - })), _toConsumableArray(y.map(function (a) { - return assembleAxis(a, 'main', config); - }))).filter(function (a) { - return a; - }); // filter undefined - } - - var HEADER_TITLE_PROPERTIES_MAP = { - titleAlign: 'align', - titleAnchor: 'anchor', - titleAngle: 'angle', - titleBaseline: 'baseline', - titleColor: 'color', - titleFont: 'font', - titleFontSize: 'fontSize', - titleFontStyle: 'fontStyle', - titleFontWeight: 'fontWeight', - titleLimit: 'limit', - titleLineHeight: 'lineHeight', - titleOrient: 'orient', - titlePadding: 'offset' - }; - var HEADER_LABEL_PROPERTIES_MAP = { - labelAlign: 'align', - labelAnchor: 'anchor', - labelAngle: 'angle', - labelBaseline: 'baseline', - labelColor: 'color', - labelFont: 'font', - labelFontSize: 'fontSize', - labelFontStyle: 'fontStyle', - labelFontWeight: 'fontWeight', - labelLimit: 'limit', - labelLineHeight: 'lineHeight', - labelOrient: 'orient', - labelPadding: 'offset' - }; - var HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP); - var HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP); - - function getAxisConfigFromConfigTypes(configTypes, config, channel, orient) { - // TODO: add special casing to add conditional value based on orient signal - return Object.assign.apply(null, [{}].concat(_toConsumableArray(configTypes.map(function (configType) { - if (configType === 'axisOrient') { - var orient1 = channel === 'x' ? 'bottom' : 'left'; - var orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {}; - var orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {}; - var props = new Set([].concat(_toConsumableArray(keys(orientConfig1)), _toConsumableArray(keys(orientConfig2)))); - var conditionalOrientAxisConfig = {}; - - var _iterator69 = _createForOfIteratorHelper(props.values()), - _step69; - - try { - for (_iterator69.s(); !(_step69 = _iterator69.n()).done;) { - var prop = _step69.value; - conditionalOrientAxisConfig[prop] = { - // orient is surely signal in this case - signal: "".concat(orient['signal'], " === \"").concat(orient1, "\" ? ").concat(signalOrStringValue(orientConfig1[prop]), " : ").concat(signalOrStringValue(orientConfig2[prop])) - }; - } - } catch (err) { - _iterator69.e(err); - } finally { - _iterator69.f(); - } - - return conditionalOrientAxisConfig; - } - - return config[configType]; - })))); - } - - function getAxisConfigs(channel, scaleType, orient, config) { - var typeBasedConfigTypes = scaleType === 'band' ? ['axisDiscrete', 'axisBand'] : scaleType === 'point' ? ['axisDiscrete', 'axisPoint'] : isQuantitative(scaleType) ? ['axisQuantitative'] : scaleType === 'time' || scaleType === 'utc' ? ['axisTemporal'] : []; - var axisChannel = channel === 'x' ? 'axisX' : 'axisY'; - var axisOrient = isSignalRef(orient) ? 'axisOrient' : 'axis' + titleCase(orient); // axisTop, axisBottom, ... - - var vlOnlyConfigTypes = [].concat(typeBasedConfigTypes, _toConsumableArray(typeBasedConfigTypes.map(function (c) { - return axisChannel + c.substr(4); - }))); - var vgConfigTypes = ['axis', axisOrient, axisChannel]; - return { - vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient), - vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient), - axisConfigStyle: getAxisConfigStyle([].concat(vgConfigTypes, _toConsumableArray(vlOnlyConfigTypes)), config) - }; - } - - function getAxisConfigStyle(axisConfigTypes, config) { - var _a; - - var toMerge = [{}]; - - var _iterator70 = _createForOfIteratorHelper(axisConfigTypes), - _step70; - - try { - for (_iterator70.s(); !(_step70 = _iterator70.n()).done;) { - var configType = _step70.value; - // TODO: add special casing to add conditional value based on orient signal - var style = (_a = config[configType]) === null || _a === void 0 ? void 0 : _a.style; - - if (style) { - style = array(style); - - var _iterator71 = _createForOfIteratorHelper(style), - _step71; - - try { - for (_iterator71.s(); !(_step71 = _iterator71.n()).done;) { - var s = _step71.value; - toMerge.push(config.style[s]); - } - } catch (err) { - _iterator71.e(err); - } finally { - _iterator71.f(); - } - } - } - } catch (err) { - _iterator70.e(err); - } finally { - _iterator70.f(); - } - - return Object.assign.apply(null, toMerge); - } - - function getAxisConfig(property, styleConfigIndex, style) { - var axisConfigs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - - var _a; - - var styleConfig = getStyleConfig(property, style, styleConfigIndex); - - if (styleConfig !== undefined) { - return { - configFrom: 'style', - configValue: styleConfig - }; - } - - for (var _i9 = 0, _arr6 = ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']; _i9 < _arr6.length; _i9++) { - var configFrom = _arr6[_i9]; - - if (((_a = axisConfigs[configFrom]) === null || _a === void 0 ? void 0 : _a[property]) !== undefined) { - return { - configFrom: configFrom, - configValue: axisConfigs[configFrom][property] - }; - } - } - - return {}; - } - - var axisRules = { - scale: function scale(_ref53) { - var model = _ref53.model, - channel = _ref53.channel; - return model.scaleName(channel); - }, - format: function format(_ref54) { - var fieldOrDatumDef = _ref54.fieldOrDatumDef, - config = _ref54.config, - axis = _ref54.axis; - var format = axis.format, - formatType = axis.formatType; - return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, true); - }, - formatType: function formatType(_ref55) { - var axis = _ref55.axis, - fieldOrDatumDef = _ref55.fieldOrDatumDef, - scaleType = _ref55.scaleType; - var formatType = axis.formatType; - return guideFormatType(formatType, fieldOrDatumDef, scaleType); - }, - grid: function grid(_ref56) { - var fieldOrDatumDef = _ref56.fieldOrDatumDef, - axis = _ref56.axis, - scaleType = _ref56.scaleType; - - var _a; - - if (isFieldDef(fieldOrDatumDef) && isBinned(fieldOrDatumDef.bin)) { - return false; - } else { - return (_a = axis.grid) !== null && _a !== void 0 ? _a : defaultGrid(scaleType, fieldOrDatumDef); - } - }, - gridScale: function gridScale(_ref57) { - var model = _ref57.model, - channel = _ref57.channel; - return _gridScale(model, channel); - }, - labelAlign: function labelAlign(_ref58) { - var axis = _ref58.axis, - labelAngle = _ref58.labelAngle, - orient = _ref58.orient, - channel = _ref58.channel; - return axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel); - }, - labelAngle: function labelAngle(_ref59) { - var _labelAngle = _ref59.labelAngle; - return _labelAngle; - }, - labelBaseline: function labelBaseline(_ref60) { - var axis = _ref60.axis, - labelAngle = _ref60.labelAngle, - orient = _ref60.orient, - channel = _ref60.channel; - return axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel); - }, - labelFlush: function labelFlush(_ref61) { - var axis = _ref61.axis, - fieldOrDatumDef = _ref61.fieldOrDatumDef, - channel = _ref61.channel; - - var _a; - - return (_a = axis.labelFlush) !== null && _a !== void 0 ? _a : defaultLabelFlush(fieldOrDatumDef.type, channel); - }, - labelOverlap: function labelOverlap(_ref62) { - var axis = _ref62.axis, - fieldOrDatumDef = _ref62.fieldOrDatumDef, - scaleType = _ref62.scaleType; - - var _a; - - return (_a = axis.labelOverlap) !== null && _a !== void 0 ? _a : defaultLabelOverlap(fieldOrDatumDef.type, scaleType, isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit, isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined); - }, - // we already calculate orient in parse - orient: function orient(_ref63) { - var _orient2 = _ref63.orient; - return _orient2; - }, - tickCount: function tickCount(_ref64) { - var channel = _ref64.channel, - model = _ref64.model, - axis = _ref64.axis, - fieldOrDatumDef = _ref64.fieldOrDatumDef, - scaleType = _ref64.scaleType; - - var _a; - - var sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; - var size = sizeType ? model.getSizeSignalRef(sizeType) : undefined; - return (_a = axis.tickCount) !== null && _a !== void 0 ? _a : defaultTickCount({ - fieldOrDatumDef: fieldOrDatumDef, - scaleType: scaleType, - size: size, - values: axis.values - }); - }, - title: function title(_ref65) { - var axis = _ref65.axis, - model = _ref65.model, - channel = _ref65.channel; - - if (axis.title !== undefined) { - return axis.title; - } - - var fieldDefTitle = getFieldDefTitle(model, channel); - - if (fieldDefTitle !== undefined) { - return fieldDefTitle; - } - - var fieldDef = model.typedFieldDef(channel); - var channel2 = channel === 'x' ? 'x2' : 'y2'; - var fieldDef2 = model.fieldDef(channel2); // If title not specified, store base parts of fieldDef (and fieldDef2 if exists) - - return mergeTitleFieldDefs(fieldDef ? [toFieldDefBase(fieldDef)] : [], isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []); - }, - values: function values(_ref66) { - var axis = _ref66.axis, - fieldOrDatumDef = _ref66.fieldOrDatumDef; - return _values(axis, fieldOrDatumDef); - }, - zindex: function zindex(_ref67) { - var axis = _ref67.axis, - fieldOrDatumDef = _ref67.fieldOrDatumDef, - mark = _ref67.mark; - - var _a; - - return (_a = axis.zindex) !== null && _a !== void 0 ? _a : defaultZindex(mark, fieldOrDatumDef); - } - }; // TODO: we need to refactor this method after we take care of config refactoring - - /** - * Default rules for whether to show a grid should be shown for a channel. - * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned - */ - - function defaultGrid(scaleType, fieldDef) { - return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.bin); - } - - function _gridScale(model, channel) { - var gridChannel = channel === 'x' ? 'y' : 'x'; - - if (model.getScaleComponent(gridChannel)) { - return model.scaleName(gridChannel); - } - - return undefined; - } - - function getLabelAngle(fieldOrDatumDef, axis, channel, styleConfig, axisConfigs) { - var labelAngle = axis === null || axis === void 0 ? void 0 : axis.labelAngle; // try axis value - - if (labelAngle !== undefined) { - return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle); - } else { - // try axis config value - var _getAxisConfig = getAxisConfig('labelAngle', styleConfig, axis === null || axis === void 0 ? void 0 : axis.style, axisConfigs), - angle = _getAxisConfig.configValue; - - if (angle !== undefined) { - return normalizeAngle(angle); - } else { - // get default value - if (channel === X && contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) && !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)) { - return 270; - } // no default - - - return undefined; - } - } - } - - function normalizeAngleExpr(angle) { - return "(((".concat(angle.signal, " % 360) + 360) % 360)"); - } - - function defaultLabelBaseline(angle, orient, channel, alwaysIncludeMiddle) { - if (angle !== undefined) { - if (channel === 'x') { - if (isSignalRef(angle)) { - var a = normalizeAngleExpr(angle); - var orientIsTop = isSignalRef(orient) ? "(".concat(orient.signal, " === \"top\")") : orient === 'top'; - return { - signal: "(45 < ".concat(a, " && ").concat(a, " < 135) || (225 < ").concat(a, " && ").concat(a, " < 315) ? \"middle\" :") + "(".concat(a, " <= 45 || 315 <= ").concat(a, ") === ").concat(orientIsTop, " ? \"bottom\" : \"top\"") - }; - } - - if (45 < angle && angle < 135 || 225 < angle && angle < 315) { - return 'middle'; - } - - if (isSignalRef(orient)) { - var op = angle <= 45 || 315 <= angle ? '===' : '!=='; - return { - signal: "".concat(orient.signal, " ").concat(op, " \"top\" ? \"bottom\" : \"top\"") - }; - } - - return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top'; - } else { - if (isSignalRef(angle)) { - var _a2 = normalizeAngleExpr(angle); - - var orientIsLeft = isSignalRef(orient) ? "(".concat(orient.signal, " === \"left\")") : orient === 'left'; - var middle = alwaysIncludeMiddle ? '"middle"' : 'null'; - return { - signal: "".concat(_a2, " <= 45 || 315 <= ").concat(_a2, " || (135 <= ").concat(_a2, " && ").concat(_a2, " <= 225) ? ").concat(middle, " : (45 <= ").concat(_a2, " && ").concat(_a2, " <= 135) === ").concat(orientIsLeft, " ? \"top\" : \"bottom\"") - }; - } - - if (angle <= 45 || 315 <= angle || 135 <= angle && angle <= 225) { - return alwaysIncludeMiddle ? 'middle' : null; - } - - if (isSignalRef(orient)) { - var _op = 45 <= angle && angle <= 135 ? '===' : '!=='; - - return { - signal: "".concat(orient.signal, " ").concat(_op, " \"left\" ? \"top\" : \"bottom\"") - }; - } - - return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom'; - } - } - - return undefined; - } - - function defaultLabelAlign(angle, orient, channel) { - if (angle === undefined) { - return undefined; - } - - var isX = channel === 'x'; - var startAngle = isX ? 0 : 90; - var mainOrient = isX ? 'bottom' : 'left'; - - if (isSignalRef(angle)) { - var a = normalizeAngleExpr(angle); - var orientIsMain = isSignalRef(orient) ? "(".concat(orient.signal, " === \"").concat(mainOrient, "\")") : orient === mainOrient; - return { - signal: "(".concat(startAngle ? '(' + a + ' + 90)' : a, " % 180 === 0) ? ").concat(isX ? null : '"center"', " :") + "(".concat(startAngle, " < ").concat(a, " && ").concat(a, " < ").concat(180 + startAngle, ") === ").concat(orientIsMain, " ? \"left\" : \"right\"") - }; - } - - if ((angle + startAngle) % 180 === 0) { - // For bottom, use default label align so label flush still works - return isX ? null : 'center'; - } - - if (isSignalRef(orient)) { - var op = startAngle < angle && angle < 180 + startAngle ? '===' : '!=='; - - var _orientIsMain = "".concat(orient.signal, " ").concat(op, " \"").concat(mainOrient, "\""); - - return { - signal: "".concat(_orientIsMain, " ? \"left\" : \"right\"") - }; - } - - if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) { - return 'left'; - } - - return 'right'; - } - - function defaultLabelFlush(type, channel) { - if (channel === 'x' && contains(['quantitative', 'temporal'], type)) { - return true; - } - - return undefined; - } - - function defaultLabelOverlap(type, scaleType, hasTimeUnit, sort) { - // do not prevent overlap for nominal data because there is no way to infer what the missing labels are - if (hasTimeUnit && !isObject(sort) || type !== 'nominal' && type !== 'ordinal') { - if (scaleType === 'log') { - return 'greedy'; - } - - return true; - } - - return undefined; - } - - function defaultOrient(channel) { - return channel === 'x' ? 'bottom' : 'left'; - } - - function defaultTickCount(_ref68) { - var fieldOrDatumDef = _ref68.fieldOrDatumDef, - scaleType = _ref68.scaleType, - size = _ref68.size, - vals = _ref68.values; - - var _a; - - if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') { - if (isFieldDef(fieldOrDatumDef)) { - if (isBinning(fieldOrDatumDef.bin)) { - // for binned data, we don't want more ticks than maxbins - return { - signal: "ceil(".concat(size.signal, "/10)") - }; - } - - if (fieldOrDatumDef.timeUnit && contains(['month', 'hours', 'day', 'quarter'], (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit)) { - return undefined; - } - } - - return { - signal: "ceil(".concat(size.signal, "/40)") - }; - } - - return undefined; - } - - function getFieldDefTitle(model, channel) { - var channel2 = channel === 'x' ? 'x2' : 'y2'; - var fieldDef = model.fieldDef(channel); - var fieldDef2 = model.fieldDef(channel2); - var title1 = fieldDef ? fieldDef.title : undefined; - var title2 = fieldDef2 ? fieldDef2.title : undefined; - - if (title1 && title2) { - return mergeTitle(title1, title2); - } else if (title1) { - return title1; - } else if (title2) { - return title2; - } else if (title1 !== undefined) { - // falsy value to disable config - return title1; - } else if (title2 !== undefined) { - // falsy value to disable config - return title2; - } - - return undefined; - } - - function _values(axis, fieldOrDatumDef) { - var vals = axis.values; - - if (isArray(vals)) { - return valueArray(fieldOrDatumDef, vals); - } else if (isSignalRef(vals)) { - return vals; - } - - return undefined; - } - - function defaultZindex(mark, fieldDef) { - if (mark === 'rect' && isDiscrete(fieldDef)) { - return 1; - } - - return 0; - } - - var CalculateNode = /*#__PURE__*/function (_DataFlowNode4) { - _inherits(CalculateNode, _DataFlowNode4); - - var _super6 = _createSuper(CalculateNode); - - function CalculateNode(parent, transform) { - var _this11; - - _classCallCheck(this, CalculateNode); - - _this11 = _super6.call(this, parent); - _this11.transform = transform; - _this11._dependentFields = getDependentFields(_this11.transform.calculate); - return _this11; - } - - _createClass(CalculateNode, [{ - key: "clone", - value: function clone() { - return new CalculateNode(null, duplicate(this.transform)); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set([this.transform.as]); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return this._dependentFields; - } - }, { - key: "assemble", - value: function assemble() { - return { - type: 'formula', - expr: this.transform.calculate, - as: this.transform.as - }; - } - }, { - key: "hash", - value: function hash() { - return "Calculate ".concat(_hash(this.transform)); - } - }], [{ - key: "parseAllForSortIndex", - value: function parseAllForSortIndex(parent, model) { - // get all the encoding with sort fields from model - model.forEachFieldDef(function (fieldDef, channel) { - if (!isScaleFieldDef(fieldDef)) { - return; - } - - if (isSortArray(fieldDef.sort)) { - var _field8 = fieldDef.field, - timeUnit = fieldDef.timeUnit; - var sort = fieldDef.sort; // generate `datum["a"] === val0 ? 0 : datum["a"] === val1 ? 1 : ... : n` via FieldEqualPredicate - - var calculate = sort.map(function (sortValue, i) { - return "".concat(fieldFilterExpression({ - field: _field8, - timeUnit: timeUnit, - equal: sortValue - }), " ? ").concat(i, " : "); - }).join('') + sort.length; - parent = new CalculateNode(parent, { - calculate: calculate, - as: sortArrayIndexField(fieldDef, channel, { - forAs: true - }) - }); - } - }); - return parent; - } - }]); - - return CalculateNode; - }(DataFlowNode); - - function sortArrayIndexField(fieldDef, channel, opt) { - return _vgField(fieldDef, Object.assign({ - prefix: channel, - suffix: 'sort_index' - }, opt !== null && opt !== void 0 ? opt : {})); - } - /** - * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet. - */ - - - function getHeaderChannel(channel, orient) { - if (contains(['top', 'bottom'], orient)) { - return 'column'; - } else if (contains(['left', 'right'], orient)) { - return 'row'; - } - - return channel === 'row' ? 'row' : 'column'; - } - - function getHeaderProperty(prop, facetFieldDef, config, channel) { - var headerSpecificConfig = channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet; - return getFirstDefined(((facetFieldDef === null || facetFieldDef === void 0 ? void 0 : facetFieldDef.header) || {})[prop], headerSpecificConfig[prop], config.header[prop]); - } - - function getHeaderProperties(properties, facetFieldDef, config, channel) { - var props = {}; - - var _iterator72 = _createForOfIteratorHelper(properties), - _step72; - - try { - for (_iterator72.s(); !(_step72 = _iterator72.n()).done;) { - var prop = _step72.value; - var value = getHeaderProperty(prop, facetFieldDef, config, channel); - - if (value !== undefined) { - props[prop] = value; - } - } - } catch (err) { - _iterator72.e(err); - } finally { - _iterator72.f(); - } - - return props; - } - - var HEADER_CHANNELS = ['row', 'column']; - var HEADER_TYPES = ['header', 'footer']; - /** - * Utility for generating row / column headers - */ - // TODO: rename to assembleHeaderTitleGroup - - function assembleTitleGroup(model, channel) { - var title = model.component.layoutHeaders[channel].title; - var config = model.config ? model.config : undefined; - var facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef ? model.component.layoutHeaders[channel].facetFieldDef : undefined; - - var _getHeaderProperties = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef, config, channel), - titleAnchor = _getHeaderProperties.titleAnchor, - ta = _getHeaderProperties.titleAngle, - titleOrient = _getHeaderProperties.titleOrient; - - var headerChannel = getHeaderChannel(channel, titleOrient); - var titleAngle = normalizeAngle(ta); - return { - name: "".concat(channel, "-title"), - type: 'group', - role: "".concat(headerChannel, "-title"), - title: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ - text: title - }, channel === 'row' ? { - orient: 'left' - } : {}), { - style: 'guide-title' - }), defaultHeaderGuideBaseline(titleAngle, headerChannel)), defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor)), assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)) - }; - } - - function defaultHeaderGuideAlign(headerChannel, angle) { - var anchor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'middle'; - - switch (anchor) { - case 'start': - return { - align: 'left' - }; - - case 'end': - return { - align: 'right' - }; - } - - var align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x'); - return align ? { - align: align - } : {}; - } - - function defaultHeaderGuideBaseline(angle, channel) { - var baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true); - return baseline ? { - baseline: baseline - } : {}; - } - - function assembleHeaderGroups(model, channel) { - var layoutHeader = model.component.layoutHeaders[channel]; - var groups = []; - - var _iterator73 = _createForOfIteratorHelper(HEADER_TYPES), - _step73; - - try { - for (_iterator73.s(); !(_step73 = _iterator73.n()).done;) { - var headerType = _step73.value; - - if (layoutHeader[headerType]) { - var _iterator74 = _createForOfIteratorHelper(layoutHeader[headerType]), - _step74; - - try { - for (_iterator74.s(); !(_step74 = _iterator74.n()).done;) { - var headerComponent = _step74.value; - var group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent); - - if (group != null) { - groups.push(group); - } - } - } catch (err) { - _iterator74.e(err); - } finally { - _iterator74.f(); - } - } - } - } catch (err) { - _iterator73.e(err); - } finally { - _iterator73.f(); - } - - return groups; - } - - function getSort(facetFieldDef, channel) { - var _a; - - var sort = facetFieldDef.sort; - - if (isSortField(sort)) { - return { - field: _vgField(sort, { - expr: 'datum' - }), - order: (_a = sort.order) !== null && _a !== void 0 ? _a : 'ascending' - }; - } else if (isArray(sort)) { - return { - field: sortArrayIndexField(facetFieldDef, channel, { - expr: 'datum' - }), - order: 'ascending' - }; - } else { - return { - field: _vgField(facetFieldDef, { - expr: 'datum' - }), - order: sort !== null && sort !== void 0 ? sort : 'ascending' - }; - } - } - - function _assembleLabelTitle(facetFieldDef, channel, config) { - var _getHeaderProperties2 = getHeaderProperties(['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], facetFieldDef, config, channel), - format = _getHeaderProperties2.format, - formatType = _getHeaderProperties2.formatType, - labelAngle = _getHeaderProperties2.labelAngle, - labelAnchor = _getHeaderProperties2.labelAnchor, - labelOrient = _getHeaderProperties2.labelOrient, - labelExpr = _getHeaderProperties2.labelExpr; - - var titleTextExpr = formatSignalRef({ - fieldOrDatumDef: facetFieldDef, - format: format, - formatType: formatType, - expr: 'parent', - config: config - }).signal; - var headerChannel = getHeaderChannel(channel, labelOrient); - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ - text: { - signal: labelExpr ? replaceAll(replaceAll(labelExpr, 'datum.label', titleTextExpr), 'datum.value', _vgField(facetFieldDef, { - expr: 'parent' - })) : titleTextExpr - } - }, channel === 'row' ? { - orient: 'left' - } : {}), { - style: 'guide-label', - frame: 'group' - }), defaultHeaderGuideBaseline(labelAngle, headerChannel)), defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor)), assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)); - } - - function assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent) { - if (headerComponent) { - var _title2 = null; - var facetFieldDef = layoutHeader.facetFieldDef; - var config = model.config ? model.config : undefined; - - if (facetFieldDef && headerComponent.labels) { - var _getHeaderProperties3 = getHeaderProperties(['labelOrient'], facetFieldDef, config, channel), - labelOrient = _getHeaderProperties3.labelOrient; // Include label title in the header if orient aligns with the channel - - - if (channel === 'row' && !contains(['top', 'bottom'], labelOrient) || channel === 'column' && !contains(['left', 'right'], labelOrient)) { - _title2 = _assembleLabelTitle(facetFieldDef, channel, config); - } - } - - var isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet); - var axes = headerComponent.axes; - var hasAxes = (axes === null || axes === void 0 ? void 0 : axes.length) > 0; - - if (_title2 || hasAxes) { - var sizeChannel = channel === 'row' ? 'height' : 'width'; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ - name: model.getName("".concat(channel, "_").concat(headerType)), - type: 'group', - role: "".concat(channel, "-").concat(headerType) - }, layoutHeader.facetFieldDef ? { - from: { - data: model.getName(channel + '_domain') - }, - sort: getSort(facetFieldDef, channel) - } : {}), hasAxes && isFacetWithoutRowCol ? { - from: { - data: model.getName("facet_domain_".concat(channel)) - } - } : {}), _title2 ? { - title: _title2 - } : {}), headerComponent.sizeSignal ? { - encode: { - update: _defineProperty({}, sizeChannel, headerComponent.sizeSignal) - } - } : {}), hasAxes ? { - axes: axes - } : {}); - } - } - - return null; - } - - var LAYOUT_TITLE_BAND = { - column: { - start: 0, - end: 1 - }, - row: { - start: 1, - end: 0 - } - }; - - function getLayoutTitleBand(titleAnchor, headerChannel) { - return LAYOUT_TITLE_BAND[headerChannel][titleAnchor]; - } - - function assembleLayoutTitleBand(headerComponentIndex, config) { - var titleBand = {}; - - var _iterator75 = _createForOfIteratorHelper(FACET_CHANNELS), - _step75; - - try { - for (_iterator75.s(); !(_step75 = _iterator75.n()).done;) { - var channel = _step75.value; - var headerComponent = headerComponentIndex[channel]; - - if (headerComponent === null || headerComponent === void 0 ? void 0 : headerComponent.facetFieldDef) { - var _getHeaderProperties4 = getHeaderProperties(['titleAnchor', 'titleOrient'], headerComponent.facetFieldDef, config, channel), - titleAnchor = _getHeaderProperties4.titleAnchor, - titleOrient = _getHeaderProperties4.titleOrient; - - var headerChannel = getHeaderChannel(channel, titleOrient); - var band = getLayoutTitleBand(titleAnchor, headerChannel); - - if (band !== undefined) { - titleBand[headerChannel] = band; - } - } - } - } catch (err) { - _iterator75.e(err); - } finally { - _iterator75.f(); - } - - return isEmpty(titleBand) ? undefined : titleBand; - } - - function assembleHeaderProperties(config, facetFieldDef, channel, properties, propertiesMap) { - var props = {}; - - var _iterator76 = _createForOfIteratorHelper(properties), - _step76; - - try { - for (_iterator76.s(); !(_step76 = _iterator76.n()).done;) { - var prop = _step76.value; - - if (!propertiesMap[prop]) { - continue; - } - - var value = getHeaderProperty(prop, facetFieldDef, config, channel); - - if (value !== undefined) { - props[propertiesMap[prop]] = value; - } - } - } catch (err) { - _iterator76.e(err); - } finally { - _iterator76.f(); - } - - return props; - } - - function _assembleLayoutSignals(model) { - return [].concat(_toConsumableArray(sizeSignals(model, 'width')), _toConsumableArray(sizeSignals(model, 'height')), _toConsumableArray(sizeSignals(model, 'childWidth')), _toConsumableArray(sizeSignals(model, 'childHeight'))); - } - - function sizeSignals(model, sizeType) { - var channel = sizeType === 'width' ? 'x' : 'y'; - var size = model.component.layoutSize.get(sizeType); - - if (!size || size === 'merged') { - return []; - } // Read size signal name from name map, just in case it is the top-level size signal that got renamed. - - - var name = model.getSizeSignalRef(sizeType).signal; - - if (size === 'step') { - var scaleComponent = model.getScaleComponent(channel); - - if (scaleComponent) { - var type = scaleComponent.get('type'); - var range = scaleComponent.get('range'); - - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - var scaleName = model.scaleName(channel); - - if (isFacetModel(model.parent)) { - // If parent is facet and this is an independent scale, return only signal signal - // as the width/height will be calculated using the cardinality from - // facet's aggregate rather than reading from scale domain - var parentResolve = model.parent.component.resolve; - - if (parentResolve.scale[channel] === 'independent') { - return [stepSignal(scaleName, range)]; - } - } - - return [stepSignal(scaleName, range), { - name: name, - update: sizeExpr(scaleName, scaleComponent, "domain('".concat(scaleName, "').length")) - }]; - } - } - /* istanbul ignore next: Condition should not happen -- only for warning in development. */ - - - throw new Error('layout size is step although width/height is not step.'); - } else if (size == 'container') { - var isWidth = name.endsWith('width'); - var expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]'; - var defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height'); - var safeExpr = "isFinite(".concat(expr, ") ? ").concat(expr, " : ").concat(defaultValue); - return [{ - name: name, - init: safeExpr, - on: [{ - update: safeExpr, - events: 'window:resize' - }] - }]; - } else { - return [{ - name: name, - value: size - }]; - } - } - - function stepSignal(scaleName, range) { - return { - name: scaleName + '_step', - value: range.step - }; - } - - function sizeExpr(scaleName, scaleComponent, cardinality) { - var type = scaleComponent.get('type'); - var padding = scaleComponent.get('padding'); - var paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding); - var paddingInner = scaleComponent.get('paddingInner'); - paddingInner = type === 'band' ? // only band has real paddingInner - paddingInner !== undefined ? paddingInner : padding : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128, - // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points. - 1; - return "bandspace(".concat(cardinality, ", ").concat(paddingInner, ", ").concat(paddingOuter, ") * ").concat(scaleName, "_step"); - } - - function getSizeTypeFromLayoutSizeType(layoutSizeType) { - return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType; - } - - function guideEncodeEntry(encoding, model) { - return keys(encoding).reduce(function (encode, channel) { - var valueDef = encoding[channel]; - return Object.assign(Object.assign({}, encode), wrapCondition(model, valueDef, channel, function (x) { - return isSignalRef(x) ? x : { - value: x.value - }; - })); - }, {}); - } - - function defaultScaleResolve(channel, model) { - if (isLayerModel(model) || isFacetModel(model)) { - return 'shared'; - } else if (isConcatModel(model)) { - return isXorY(channel) ? 'independent' : 'shared'; - } - /* istanbul ignore next: should never reach here. */ - - - throw new Error('invalid model type for resolve'); - } - - function parseGuideResolve(resolve, channel) { - var channelScaleResolve = resolve.scale[channel]; - var guide = isXorY(channel) ? 'axis' : 'legend'; - - if (channelScaleResolve === 'independent') { - if (resolve[guide][channel] === 'shared') { - warn(independentScaleMeansIndependentGuide(channel)); - } - - return 'independent'; - } - - return resolve[guide][channel] || 'shared'; - } - - var LEGEND_COMPONENT_PROPERTY_INDEX = Object.assign(Object.assign({}, COMMON_LEGEND_PROPERTY_INDEX), { - disable: 1, - labelExpr: 1, - selections: 1, - // channel scales - opacity: 1, - shape: 1, - stroke: 1, - fill: 1, - size: 1, - strokeWidth: 1, - strokeDash: 1, - // encode - encode: 1 - }); - var LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX); - - var LegendComponent = /*#__PURE__*/function (_Split2) { - _inherits(LegendComponent, _Split2); - - var _super7 = _createSuper(LegendComponent); - - function LegendComponent() { - _classCallCheck(this, LegendComponent); - - return _super7.apply(this, arguments); - } - - return LegendComponent; - }(Split); - - var legendEncodeRules = { - symbols: symbols, - gradient: gradient, - labels: labels, - entries: entries$1 - }; - - function symbols(symbolsSpec, _ref69) { - var fieldOrDatumDef = _ref69.fieldOrDatumDef, - model = _ref69.model, - channel = _ref69.channel, - legendCmpt = _ref69.legendCmpt, - legendType = _ref69.legendType; - - var _a, _b, _c, _d, _e, _f, _g, _h; - - if (legendType !== 'symbol') { - return undefined; - } - - var markDef = model.markDef, - encoding = model.encoding, - config = model.config, - mark = model.mark; - var filled = markDef.filled && mark !== 'trail'; - var out = Object.assign(Object.assign({}, applyMarkConfig({}, model, FILL_STROKE_CONFIG)), color(model, { - filled: filled - })); // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry - - var symbolOpacity = (_a = legendCmpt.get('symbolOpacity')) !== null && _a !== void 0 ? _a : config.legend.symbolOpacity; - var symbolFillColor = (_b = legendCmpt.get('symbolFillColor')) !== null && _b !== void 0 ? _b : config.legend.symbolFillColor; - var symbolStrokeColor = (_c = legendCmpt.get('symbolStrokeColor')) !== null && _c !== void 0 ? _c : config.legend.symbolStrokeColor; - var opacity = symbolOpacity === undefined ? (_d = getMaxValue(encoding.opacity)) !== null && _d !== void 0 ? _d : markDef.opacity : undefined; - - if (out.fill) { - // for fill legend, we don't want any fill in symbol - if (channel === 'fill' || filled && channel === COLOR) { - delete out.fill; - } else { - if (out.fill['field']) { - // For others, set fill to some opaque value (or nothing if a color is already set) - if (symbolFillColor) { - delete out.fill; - } else { - out.fill = signalOrValueRef((_e = config.legend.symbolBaseFillColor) !== null && _e !== void 0 ? _e : 'black'); - out.fillOpacity = signalOrValueRef(opacity !== null && opacity !== void 0 ? opacity : 1); - } - } else if (isArray(out.fill)) { - var fill = (_h = (_g = getFirstConditionValue((_f = encoding.fill) !== null && _f !== void 0 ? _f : encoding.color)) !== null && _g !== void 0 ? _g : markDef.fill) !== null && _h !== void 0 ? _h : filled && markDef.color; - - if (fill) { - out.fill = signalOrValueRef(fill); - } - } - } - } - - if (out.stroke) { - if (channel === 'stroke' || !filled && channel === COLOR) { - delete out.stroke; - } else { - if (out.stroke['field'] || symbolStrokeColor) { - // For others, remove stroke field - delete out.stroke; - } else if (isArray(out.stroke)) { - var stroke = getFirstDefined(getFirstConditionValue(encoding.stroke || encoding.color), markDef.stroke, filled ? markDef.color : undefined); - - if (stroke) { - out.stroke = { - value: stroke - }; - } - } - } - } - - if (channel !== OPACITY) { - var condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef); - - if (condition) { - out.opacity = [Object.assign({ - test: condition - }, signalOrValueRef(opacity !== null && opacity !== void 0 ? opacity : 1)), signalOrValueRef(config.legend.unselectedOpacity)]; - } else if (opacity) { - out.opacity = signalOrValueRef(opacity); - } - } - - out = Object.assign(Object.assign({}, out), symbolsSpec); - return isEmpty(out) ? undefined : out; - } - - function gradient(gradientSpec, _ref70) { - var model = _ref70.model, - legendType = _ref70.legendType, - legendCmpt = _ref70.legendCmpt; - - var _a; - - if (legendType !== 'gradient') { - return undefined; - } - - var config = model.config, - markDef = model.markDef, - encoding = model.encoding; - var out = {}; - var gradientOpacity = (_a = legendCmpt.get('gradientOpacity')) !== null && _a !== void 0 ? _a : config.legend.gradientOpacity; - var opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined; - - if (opacity) { - // only apply opacity if it is neither zero or undefined - out.opacity = signalOrValueRef(opacity); - } - - out = Object.assign(Object.assign({}, out), gradientSpec); - return isEmpty(out) ? undefined : out; - } - - function labels(specifiedlabelsSpec, _ref71) { - var fieldOrDatumDef = _ref71.fieldOrDatumDef, - model = _ref71.model, - channel = _ref71.channel, - legendCmpt = _ref71.legendCmpt; - var legend = model.legend(channel) || {}; - var config = model.config; - var condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined; - var opacity = condition ? [{ - test: condition, - value: 1 - }, { - value: config.legend.unselectedOpacity - }] : undefined; - var format = legend.format, - formatType = legend.formatType; - var text = isCustomFormatType(formatType) ? formatCustomType({ - fieldOrDatumDef: fieldOrDatumDef, - field: 'datum.value', - format: format, - formatType: formatType, - config: config - }) : undefined; - var labelsSpec = Object.assign(Object.assign(Object.assign({}, opacity ? { - opacity: opacity - } : {}), text ? { - text: text - } : {}), specifiedlabelsSpec); - return isEmpty(labelsSpec) ? undefined : labelsSpec; - } - - function entries$1(entriesSpec, _ref72) { - var legendCmpt = _ref72.legendCmpt; - var selections = legendCmpt.get('selections'); - return (selections === null || selections === void 0 ? void 0 : selections.length) ? Object.assign(Object.assign({}, entriesSpec), { - fill: { - value: 'transparent' - } - }) : entriesSpec; - } - - function getMaxValue(channelDef) { - return getConditionValue(channelDef, function (v, conditionalDef) { - return Math.max(v, conditionalDef.value); - }); - } - - function getFirstConditionValue(channelDef) { - return getConditionValue(channelDef, function (v, conditionalDef) { - return getFirstDefined(v, conditionalDef.value); - }); - } - - function getConditionValue(channelDef, reducer) { - if (hasConditionalValueDef(channelDef)) { - return array(channelDef.condition).reduce(reducer, channelDef.value); - } else if (isValueDef(channelDef)) { - return channelDef.value; - } - - return undefined; - } - - function selectedCondition(model, legendCmpt, fieldDef) { - var selections = legendCmpt.get('selections'); - if (!(selections === null || selections === void 0 ? void 0 : selections.length)) return undefined; - var field = $(fieldDef.field); - return selections.map(function (name) { - var store = $(varName(name) + STORE); - return "(!length(data(".concat(store, ")) || (").concat(name, "[").concat(field, "] && indexof(").concat(name, "[").concat(field, "], datum.value) >= 0))"); - }).join(' || '); - } - - var legendRules = { - direction: function direction(_ref73) { - var _direction = _ref73.direction; - return _direction; - }, - format: function format(_ref74) { - var fieldOrDatumDef = _ref74.fieldOrDatumDef, - legend = _ref74.legend, - config = _ref74.config; - var format = legend.format, - formatType = legend.formatType; - return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false); - }, - formatType: function formatType(_ref75) { - var legend = _ref75.legend, - fieldOrDatumDef = _ref75.fieldOrDatumDef, - scaleType = _ref75.scaleType; - var formatType = legend.formatType; - return guideFormatType(formatType, fieldOrDatumDef, scaleType); - }, - gradientLength: function gradientLength(params) { - var _a, _b; - - var legend = params.legend, - legendConfig = params.legendConfig; - return (_b = (_a = legend.gradientLength) !== null && _a !== void 0 ? _a : legendConfig.gradientLength) !== null && _b !== void 0 ? _b : defaultGradientLength(params); - }, - labelOverlap: function labelOverlap(_ref76) { - var legend = _ref76.legend, - legendConfig = _ref76.legendConfig, - scaleType = _ref76.scaleType; - - var _a, _b; - - return (_b = (_a = legend.labelOverlap) !== null && _a !== void 0 ? _a : legendConfig.labelOverlap) !== null && _b !== void 0 ? _b : defaultLabelOverlap$1(scaleType); - }, - symbolType: function symbolType(_ref77) { - var legend = _ref77.legend, - markDef = _ref77.markDef, - channel = _ref77.channel, - encoding = _ref77.encoding; - - var _a; - - return (_a = legend.symbolType) !== null && _a !== void 0 ? _a : defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape); - }, - title: function title(_ref78) { - var fieldOrDatumDef = _ref78.fieldOrDatumDef, - config = _ref78.config; - return _title3(fieldOrDatumDef, config, { - allowDisabling: true - }); - }, - type: function type(_ref79) { - var legendType = _ref79.legendType, - scaleType = _ref79.scaleType, - channel = _ref79.channel; - - if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) { - if (legendType === 'gradient') { - return undefined; - } - } else if (legendType === 'symbol') { - return undefined; - } - - return legendType; - }, - values: function values(_ref80) { - var fieldOrDatumDef = _ref80.fieldOrDatumDef, - legend = _ref80.legend; - return values$1(legend, fieldOrDatumDef); - } - }; - - function values$1(legend, fieldOrDatumDef) { - var vals = legend.values; - - if (isArray(vals)) { - return valueArray(fieldOrDatumDef, vals); - } else if (isSignalRef(vals)) { - return vals; - } - - return undefined; - } - - function defaultSymbolType(mark, channel, shapeChannelDef, markShape) { - var _a; - - if (channel !== 'shape') { - // use the value from the shape encoding or the mark config if they exist - var shape = (_a = getFirstConditionValue(shapeChannelDef)) !== null && _a !== void 0 ? _a : markShape; - - if (shape) { - return shape; - } - } - - switch (mark) { - case 'bar': - case 'rect': - case 'image': - case 'square': - return 'square'; - - case 'line': - case 'trail': - case 'rule': - return 'stroke'; - - case 'arc': - case 'point': - case 'circle': - case 'tick': - case 'geoshape': - case 'area': - case 'text': - return 'circle'; - } - } - - function getLegendType(params) { - var legend = params.legend; - return getFirstDefined(legend.type, defaultType$1(params)); - } - - function defaultType$1(_ref81) { - var channel = _ref81.channel, - timeUnit = _ref81.timeUnit, - scaleType = _ref81.scaleType; - - // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js - if (isColorChannel(channel)) { - if (contains(['quarter', 'month', 'day'], timeUnit)) { - return 'symbol'; - } - - if (isContinuousToContinuous(scaleType)) { - return 'gradient'; - } - } - - return 'symbol'; - } - - function getDirection(_ref82) { - var legendConfig = _ref82.legendConfig, - legendType = _ref82.legendType, - orient = _ref82.orient, - legend = _ref82.legend; - - var _a, _b; - - return (_b = (_a = legend.direction) !== null && _a !== void 0 ? _a : legendConfig[legendType ? 'gradientDirection' : 'symbolDirection']) !== null && _b !== void 0 ? _b : defaultDirection(orient, legendType); - } - - function defaultDirection(orient, legendType) { - switch (orient) { - case 'top': - case 'bottom': - return 'horizontal'; - - case 'left': - case 'right': - case 'none': - case undefined: - // undefined = "right" in Vega - return undefined; - // vertical is Vega's default - - default: - // top-left / ... - // For inner legend, uses compact layout like Tableau - return legendType === 'gradient' ? 'horizontal' : undefined; - } - } - - function defaultGradientLength(_ref83) { - var legendConfig = _ref83.legendConfig, - model = _ref83.model, - direction = _ref83.direction, - orient = _ref83.orient, - scaleType = _ref83.scaleType; - var gradientHorizontalMaxLength = legendConfig.gradientHorizontalMaxLength, - gradientHorizontalMinLength = legendConfig.gradientHorizontalMinLength, - gradientVerticalMaxLength = legendConfig.gradientVerticalMaxLength, - gradientVerticalMinLength = legendConfig.gradientVerticalMinLength; - - if (isContinuousToContinuous(scaleType)) { - if (direction === 'horizontal') { - if (orient === 'top' || orient === 'bottom') { - return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength); - } else { - return gradientHorizontalMinLength; - } - } else { - // vertical / undefined (Vega uses vertical by default) - return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength); - } - } - - return undefined; - } - - function gradientLengthSignal(model, sizeType, min, max) { - var sizeSignal = model.getSizeSignalRef(sizeType).signal; - return { - signal: "clamp(".concat(sizeSignal, ", ").concat(min, ", ").concat(max, ")") - }; - } - - function defaultLabelOverlap$1(scaleType) { - if (contains(['quantile', 'threshold', 'log'], scaleType)) { - return 'greedy'; - } - - return undefined; - } - - function parseLegend(model) { - var legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model); - model.component.legends = legendComponent; - return legendComponent; - } - - function parseUnitLegend(model) { - var encoding = model.encoding; - var legendComponent = {}; - - for (var _i10 = 0, _arr7 = [COLOR].concat(LEGEND_SCALE_CHANNELS); _i10 < _arr7.length; _i10++) { - var channel = _arr7[_i10]; - var def = getFieldOrDatumDef(encoding[channel]); - - if (!def || !model.getScaleComponent(channel)) { - continue; - } - - if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) { - continue; - } - - legendComponent[channel] = parseLegendForChannel(model, channel); - } - - return legendComponent; - } - - function getLegendDefWithScale(model, channel) { - var scale = model.scaleName(channel); - - if (model.mark === 'trail') { - if (channel === 'color') { - // trail is a filled mark, but its default symbolType ("stroke") should use "stroke" - return { - stroke: scale - }; - } else if (channel === 'size') { - return { - strokeWidth: scale - }; - } - } - - if (channel === 'color') { - return model.markDef.filled ? { - fill: scale - } : { - stroke: scale - }; - } - - return _defineProperty({}, channel, scale); - } // eslint-disable-next-line @typescript-eslint/ban-types - - - function isExplicit(value, property, legend, fieldDef) { - switch (property) { - case 'disable': - return legend !== undefined; - // if axis is specified or null/false, then it's enable/disable state is explicit - - case 'values': - // specified legend.values is already respected, but may get transformed. - return !!(legend === null || legend === void 0 ? void 0 : legend.values); - - case 'title': - // title can be explicit if fieldDef.title is set - if (property === 'title' && value === (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.title)) { - return true; - } - - } // Otherwise, things are explicit if the returned value matches the specified property - - - return value === (legend || {})[property]; - } - - function parseLegendForChannel(model, channel) { - var _a, _b, _c; - - var legend = model.legend(channel); - var markDef = model.markDef, - encoding = model.encoding, - config = model.config; - var legendConfig = config.legend; - var legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel)); - parseInteractiveLegend(model, channel, legendCmpt); - var disable = legend !== undefined ? !legend : legendConfig.disable; - legendCmpt.set('disable', disable, legend !== undefined); - - if (disable) { - return legendCmpt; - } - - legend = legend || {}; - var scaleType = model.getScaleComponent(channel).get('type'); - var fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - var timeUnit = isFieldDef(fieldOrDatumDef) ? (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit : undefined; - var orient = legend.orient || config.legend.orient || 'right'; - var legendType = getLegendType({ - legend: legend, - channel: channel, - timeUnit: timeUnit, - scaleType: scaleType - }); - var direction = getDirection({ - legend: legend, - legendType: legendType, - orient: orient, - legendConfig: legendConfig - }); - var ruleParams = { - legend: legend, - channel: channel, - model: model, - markDef: markDef, - encoding: encoding, - fieldOrDatumDef: fieldOrDatumDef, - legendConfig: legendConfig, - config: config, - scaleType: scaleType, - orient: orient, - legendType: legendType, - direction: direction - }; - - var _iterator77 = _createForOfIteratorHelper(LEGEND_COMPONENT_PROPERTIES), - _step77; - - try { - for (_iterator77.s(); !(_step77 = _iterator77.n()).done;) { - var property = _step77.value; - - if (legendType === 'gradient' && property.startsWith('symbol') || legendType === 'symbol' && property.startsWith('gradient')) { - continue; - } - - var _value = property in legendRules ? legendRules[property](ruleParams) : legend[property]; - - if (_value !== undefined) { - var explicit = isExplicit(_value, property, legend, model.fieldDef(channel)); - - if (explicit || config.legend[property] === undefined) { - legendCmpt.set(property, _value, explicit); - } - } - } - } catch (err) { - _iterator77.e(err); - } finally { - _iterator77.f(); - } - - var legendEncoding = (_b = legend === null || legend === void 0 ? void 0 : legend.encoding) !== null && _b !== void 0 ? _b : {}; - var selections = legendCmpt.get('selections'); - var legendEncode = {}; - var legendEncodeParams = { - fieldOrDatumDef: fieldOrDatumDef, - model: model, - channel: channel, - legendCmpt: legendCmpt, - legendType: legendType - }; - - for (var _i11 = 0, _arr8 = ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']; _i11 < _arr8.length; _i11++) { - var part = _arr8[_i11]; - var legendEncodingPart = guideEncodeEntry((_c = legendEncoding[part]) !== null && _c !== void 0 ? _c : {}, model); - var value = part in legendEncodeRules ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule - : legendEncodingPart; // no rule -- just default values - - if (value !== undefined && !isEmpty(value)) { - legendEncode[part] = Object.assign(Object.assign(Object.assign({}, (selections === null || selections === void 0 ? void 0 : selections.length) && isFieldDef(fieldOrDatumDef) ? { - name: "".concat(varName(fieldOrDatumDef.field), "_legend_").concat(part) - } : {}), (selections === null || selections === void 0 ? void 0 : selections.length) ? { - interactive: !!selections - } : {}), { - update: value - }); - } - } - - if (!isEmpty(legendEncode)) { - legendCmpt.set('encode', legendEncode, !!(legend === null || legend === void 0 ? void 0 : legend.encoding)); - } - - return legendCmpt; - } - - function parseNonUnitLegend(model) { - var _model$component = model.component, - legends = _model$component.legends, - resolve = _model$component.resolve; - - var _iterator78 = _createForOfIteratorHelper(model.children), - _step78; - - try { - for (_iterator78.s(); !(_step78 = _iterator78.n()).done;) { - var child = _step78.value; - parseLegend(child); - - var _iterator80 = _createForOfIteratorHelper(keys(child.component.legends)), - _step80; - - try { - for (_iterator80.s(); !(_step80 = _iterator80.n()).done;) { - var channel = _step80.value; - resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel); - - if (resolve.legend[channel] === 'shared') { - // If the resolve says shared (and has not been overridden) - // We will try to merge and see if there is a conflict - legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]); - - if (!legends[channel]) { - // If merge returns nothing, there is a conflict so we cannot make the legend shared. - // Thus, mark legend as independent and remove the legend component. - resolve.legend[channel] = 'independent'; - delete legends[channel]; - } - } - } - } catch (err) { - _iterator80.e(err); - } finally { - _iterator80.f(); - } - } - } catch (err) { - _iterator78.e(err); - } finally { - _iterator78.f(); - } - - var _iterator79 = _createForOfIteratorHelper(keys(legends)), - _step79; - - try { - for (_iterator79.s(); !(_step79 = _iterator79.n()).done;) { - var _channel = _step79.value; - - var _iterator81 = _createForOfIteratorHelper(model.children), - _step81; - - try { - for (_iterator81.s(); !(_step81 = _iterator81.n()).done;) { - var _child = _step81.value; - - if (!_child.component.legends[_channel]) { - // skip if the child does not have a particular legend - continue; - } - - if (resolve.legend[_channel] === 'shared') { - // After merging shared legend, make sure to remove legend from child - delete _child.component.legends[_channel]; - } - } - } catch (err) { - _iterator81.e(err); - } finally { - _iterator81.f(); - } - } - } catch (err) { - _iterator79.e(err); - } finally { - _iterator79.f(); - } - - return legends; - } - - function mergeLegendComponent(mergedLegend, childLegend) { - var _a, _b, _c, _d; - - if (!mergedLegend) { - return childLegend.clone(); - } - - var mergedOrient = mergedLegend.getWithExplicit('orient'); - var childOrient = childLegend.getWithExplicit('orient'); - - if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { - // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) - // Cannot merge due to inconsistent orient - return undefined; - } - - var typeMerged = false; // Otherwise, let's merge - - var _iterator82 = _createForOfIteratorHelper(LEGEND_COMPONENT_PROPERTIES), - _step82; - - try { - var _loop7 = function _loop7() { - var prop = _step82.value; - var mergedValueWithExplicit = mergeValuesWithExplicit(mergedLegend.getWithExplicit(prop), childLegend.getWithExplicit(prop), prop, 'legend', // Tie breaker function - function (v1, v2) { - switch (prop) { - case 'symbolType': - return mergeSymbolType(v1, v2); - - case 'title': - return mergeTitleComponent(v1, v2); - - case 'type': - // There are only two types. If we have different types, then prefer symbol over gradient. - typeMerged = true; - return makeImplicit('symbol'); - } - - return defaultTieBreaker(v1, v2, prop, 'legend'); - }); - mergedLegend.setWithExplicit(prop, mergedValueWithExplicit); - }; - - for (_iterator82.s(); !(_step82 = _iterator82.n()).done;) { - _loop7(); - } - } catch (err) { - _iterator82.e(err); - } finally { - _iterator82.f(); - } - - if (typeMerged) { - if ((_b = (_a = mergedLegend.implicit) === null || _a === void 0 ? void 0 : _a.encode) === null || _b === void 0 ? void 0 : _b.gradient) { - deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']); - } - - if ((_d = (_c = mergedLegend.explicit) === null || _c === void 0 ? void 0 : _c.encode) === null || _d === void 0 ? void 0 : _d.gradient) { - deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']); - } - } - - return mergedLegend; - } - - function mergeSymbolType(st1, st2) { - if (st2.value === 'circle') { - // prefer "circle" over "stroke" - return st2; - } - - return st1; - } - - function setLegendEncode(legend, part, vgProp, vgRef) { - var _a, _b, _c; - - legend.encode = (_a = legend.encode) !== null && _a !== void 0 ? _a : {}; - legend.encode[part] = (_b = legend.encode[part]) !== null && _b !== void 0 ? _b : {}; - legend.encode[part].update = (_c = legend.encode[part].update) !== null && _c !== void 0 ? _c : {}; // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 - - legend.encode[part].update[vgProp] = vgRef; - } - - function _assembleLegends(model) { - var legendComponentIndex = model.component.legends; - var legendByDomain = {}; - - var _iterator83 = _createForOfIteratorHelper(keys(legendComponentIndex)), - _step83; - - try { - for (_iterator83.s(); !(_step83 = _iterator83.n()).done;) { - var channel = _step83.value; - var scaleComponent = model.getScaleComponent(channel); - var domainHash = stringify(scaleComponent.get('domains')); - - if (legendByDomain[domainHash]) { - var _iterator84 = _createForOfIteratorHelper(legendByDomain[domainHash]), - _step84; - - try { - for (_iterator84.s(); !(_step84 = _iterator84.n()).done;) { - var mergedLegendComponent = _step84.value; - var merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]); - - if (!merged) { - // If cannot merge, need to add this legend separately - legendByDomain[domainHash].push(legendComponentIndex[channel]); - } - } - } catch (err) { - _iterator84.e(err); - } finally { - _iterator84.f(); - } - } else { - legendByDomain[domainHash] = [legendComponentIndex[channel].clone()]; - } - } - } catch (err) { - _iterator83.e(err); - } finally { - _iterator83.f(); - } - - var legends = vals(legendByDomain).flat().map(function (l) { - return assembleLegend(l, model.config); - }).filter(function (l) { - return l !== undefined; - }); - return legends; - } - - function assembleLegend(legendCmpt, config) { - var _a, _b, _c; - - var _d = legendCmpt.combine(), - disable = _d.disable, - labelExpr = _d.labelExpr, - selections = _d.selections, - legend = __rest(_d, ["disable", "labelExpr", "selections"]); - - if (disable) { - return undefined; - } - - if (config.aria === false && legend.aria == undefined) { - legend.aria = false; - } - - if ((_a = legend.encode) === null || _a === void 0 ? void 0 : _a.symbols) { - var out = legend.encode.symbols.update; - - if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) { - // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used. - out.stroke = { - value: 'transparent' - }; - } // Remove properties that the legend is encoding. - - - var _iterator85 = _createForOfIteratorHelper(LEGEND_SCALE_CHANNELS), - _step85; - - try { - for (_iterator85.s(); !(_step85 = _iterator85.n()).done;) { - var property = _step85.value; - - if (legend[property]) { - delete out[property]; - } - } - } catch (err) { - _iterator85.e(err); - } finally { - _iterator85.f(); - } - } - - if (!legend.title) { - // title schema doesn't include null, '' - delete legend.title; - } - - if (labelExpr !== undefined) { - var expr = labelExpr; - - if (((_c = (_b = legend.encode) === null || _b === void 0 ? void 0 : _b.labels) === null || _c === void 0 ? void 0 : _c.update) && isSignalRef(legend.encode.labels.update.text)) { - expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal); - } - - setLegendEncode(legend, 'labels', 'text', { - signal: expr - }); - } - - for (var prop in legend) { - var propValue = legend[prop]; - - if (isSignalRef(propValue)) { - var propIndex = SIGNAL_LEGEND_PROP_INDEX[prop]; - - if (propIndex) { - var vgProp = propIndex.vgProp, - part = propIndex.part; - setLegendEncode(legend, part, vgProp, propValue); - delete legend[prop]; - } - } - } - - return legend; - } - - function _assembleProjections(model) { - if (isLayerModel(model) || isConcatModel(model)) { - return assembleProjectionsForModelAndChildren(model); - } else { - return assembleProjectionForModel(model); - } - } - - function assembleProjectionsForModelAndChildren(model) { - return model.children.reduce(function (projections, child) { - return projections.concat(child.assembleProjections()); - }, assembleProjectionForModel(model)); - } - - function assembleProjectionForModel(model) { - var component = model.component.projection; - - if (!component || component.merged) { - return []; - } - - var projection = component.combine(); - var name = projection.name; // we need to extract name so that it is always present in the output and pass TS type validation - - if (!component.data) { - // generate custom projection, no automatic fitting - return [Object.assign(Object.assign({ - name: name - }, { - translate: { - signal: '[width / 2, height / 2]' - } - }), projection)]; - } else { - // generate projection that uses extent fitting - var size = { - signal: "[".concat(component.size.map(function (ref) { - return ref.signal; - }).join(', '), "]") - }; - var fits = component.data.reduce(function (sources, data) { - var source = isSignalRef(data) ? data.signal : "data('".concat(model.lookupDataSource(data), "')"); - - if (!contains(sources, source)) { - // build a unique list of sources - sources.push(source); - } - - return sources; - }, []); - - if (fits.length <= 0) { - throw new Error("Projection's fit didn't find any data sources"); - } - - return [Object.assign({ - name: name, - size: size, - fit: { - signal: fits.length > 1 ? "[".concat(fits.join(', '), "]") : fits[0] - } - }, projection)]; - } - } - - var PROJECTION_PROPERTIES = ['type', 'clipAngle', 'clipExtent', 'center', 'rotate', 'precision', 'reflectX', 'reflectY', 'coefficient', 'distance', 'fraction', 'lobes', 'parallel', 'radius', 'ratio', 'spacing', 'tilt']; - - var ProjectionComponent = /*#__PURE__*/function (_Split3) { - _inherits(ProjectionComponent, _Split3); - - var _super8 = _createSuper(ProjectionComponent); - - function ProjectionComponent(name, specifiedProjection, size, data) { - var _this12; - - _classCallCheck(this, ProjectionComponent); - - _this12 = _super8.call(this, Object.assign({}, specifiedProjection), // all explicit properties of projection - { - name: name - } // name as initial implicit property - ); - _this12.specifiedProjection = specifiedProjection; - _this12.size = size; - _this12.data = data; - _this12.merged = false; - return _this12; - } - /** - * Whether the projection parameters should fit provided data. - */ - - - _createClass(ProjectionComponent, [{ - key: "isFit", - get: function get() { - return !!this.data; - } - }]); - - return ProjectionComponent; - }(Split); - - function _parseProjection(model) { - model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model); - } - - function parseUnitProjection(model) { - var _a; - - if (model.hasProjection) { - var proj = model.specifiedProjection; - var fit = !(proj && (proj.scale != null || proj.translate != null)); - var size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined; - var data = fit ? gatherFitData(model) : undefined; - return new ProjectionComponent(model.projectionName(true), Object.assign(Object.assign({}, (_a = model.config.projection) !== null && _a !== void 0 ? _a : {}), proj !== null && proj !== void 0 ? proj : {}), size, data); - } - - return undefined; - } - - function gatherFitData(model) { - var data = []; - var encoding = model.encoding; - - for (var _i12 = 0, _arr9 = [[LONGITUDE, LATITUDE], [LONGITUDE2, LATITUDE2]]; _i12 < _arr9.length; _i12++) { - var posssiblePair = _arr9[_i12]; - - if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) { - data.push({ - signal: model.getName("geojson_".concat(data.length)) - }); - } - } - - if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) { - data.push({ - signal: model.getName("geojson_".concat(data.length)) - }); - } - - if (data.length === 0) { - // main source is geojson, so we can just use that - data.push(model.requestDataName(DataSourceType.Main)); - } - - return data; - } - - function mergeIfNoConflict(first, second) { - var allPropertiesShared = every(PROJECTION_PROPERTIES, function (prop) { - // neither has the property - if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) { - return true; - } // both have property and an equal value for property - - - if (hasOwnProperty(first.explicit, prop) && hasOwnProperty(second.explicit, prop) && // some properties might be signals or objects and require hashing for comparison - stringify(first.get(prop)) === stringify(second.get(prop))) { - return true; - } - - return false; - }); - var size = stringify(first.size) === stringify(second.size); - - if (size) { - if (allPropertiesShared) { - return first; - } else if (stringify(first.explicit) === stringify({})) { - return second; - } else if (stringify(second.explicit) === stringify({})) { - return first; - } - } // if all properties don't match, let each unit spec have its own projection - - - return null; - } - - function parseNonUnitProjections(model) { - if (model.children.length === 0) { - return undefined; - } - - var nonUnitProjection; // parse all children first - - var _iterator86 = _createForOfIteratorHelper(model.children), - _step86; - - try { - for (_iterator86.s(); !(_step86 = _iterator86.n()).done;) { - var _child2 = _step86.value; - - _parseProjection(_child2); - } // analyze parsed projections, attempt to merge - - } catch (err) { - _iterator86.e(err); - } finally { - _iterator86.f(); - } - - var mergable = every(model.children, function (child) { - var projection = child.component.projection; - - if (!projection) { - // child layer does not use a projection - return true; - } else if (!nonUnitProjection) { - // cached 'projection' is null, cache this one - nonUnitProjection = projection; - return true; - } else { - var merge = mergeIfNoConflict(nonUnitProjection, projection); - - if (merge) { - nonUnitProjection = merge; - } - - return !!merge; - } - }); // if cached one and all other children share the same projection, - - if (nonUnitProjection && mergable) { - // so we can elevate it to the layer level - var name = model.projectionName(true); - var modelProjection = new ProjectionComponent(name, nonUnitProjection.specifiedProjection, nonUnitProjection.size, duplicate(nonUnitProjection.data)); // rename and assign all others as merged - - var _iterator87 = _createForOfIteratorHelper(model.children), - _step87; - - try { - for (_iterator87.s(); !(_step87 = _iterator87.n()).done;) { - var child = _step87.value; - var projection = child.component.projection; - - if (projection) { - if (projection.isFit) { - var _modelProjection$data; - - (_modelProjection$data = modelProjection.data).push.apply(_modelProjection$data, _toConsumableArray(child.component.projection.data)); - } - - child.renameProjection(projection.get('name'), name); - projection.merged = true; - } - } - } catch (err) { - _iterator87.e(err); - } finally { - _iterator87.f(); - } - - return modelProjection; - } - - return undefined; - } - - function rangeFormula(model, fieldDef, channel, config) { - var _a, _b; - - if (binRequiresRange(fieldDef, channel)) { - // read format from axis or legend, if there is no format then use config.numberFormat - var guide = isUnitModel(model) ? (_b = (_a = model.axis(channel)) !== null && _a !== void 0 ? _a : model.legend(channel)) !== null && _b !== void 0 ? _b : {} : {}; - - var startField = _vgField(fieldDef, { - expr: 'datum' - }); - - var endField = _vgField(fieldDef, { - expr: 'datum', - binSuffix: 'end' - }); - - return { - formulaAs: _vgField(fieldDef, { - binSuffix: 'range', - forAs: true - }), - formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config) - }; - } - - return {}; - } - - function binKey(bin, field) { - return "".concat(binToString(bin), "_").concat(field); - } - - function getSignalsFromModel(model, key) { - return { - signal: model.getName("".concat(key, "_bins")), - extentSignal: model.getName("".concat(key, "_extent")) - }; - } - - function getBinSignalName(model, field, bin) { - var _a; - - var normalizedBin = (_a = normalizeBin(bin, undefined)) !== null && _a !== void 0 ? _a : {}; - var key = binKey(normalizedBin, field); - return model.getName("".concat(key, "_bins")); - } - - function isBinTransform(t) { - return 'as' in t; - } - - function createBinComponent(t, bin, model) { - var as; - var span; - - if (isBinTransform(t)) { - as = isString(t.as) ? [t.as, "".concat(t.as, "_end")] : [t.as[0], t.as[1]]; - } else { - as = [_vgField(t, { - forAs: true - }), _vgField(t, { - binSuffix: 'end', - forAs: true - })]; - } - - var normalizedBin = Object.assign({}, normalizeBin(bin, undefined)); - var key = binKey(normalizedBin, t.field); - - var _getSignalsFromModel = getSignalsFromModel(model, key), - signal = _getSignalsFromModel.signal, - extentSignal = _getSignalsFromModel.extentSignal; - - if (isSelectionExtent(normalizedBin.extent)) { - var ext = normalizedBin.extent; - var selName = ext.selection; - span = parseSelectionBinExtent(model.getSelectionComponent(varName(selName), selName), ext); - delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property. - } - - var binComponent = Object.assign(Object.assign(Object.assign({ - bin: normalizedBin, - field: t.field, - as: [as] - }, signal ? { - signal: signal - } : {}), extentSignal ? { - extentSignal: extentSignal - } : {}), span ? { - span: span - } : {}); - return { - key: key, - binComponent: binComponent - }; - } - - var BinNode = /*#__PURE__*/function (_DataFlowNode5) { - _inherits(BinNode, _DataFlowNode5); - - var _super9 = _createSuper(BinNode); - - function BinNode(parent, bins) { - var _this13; - - _classCallCheck(this, BinNode); - - _this13 = _super9.call(this, parent); - _this13.bins = bins; - return _this13; - } - - _createClass(BinNode, [{ - key: "clone", - value: function clone() { - return new BinNode(null, duplicate(this.bins)); - } - }, { - key: "merge", - - /** - * Merge bin nodes. This method either integrates the bin config from the other node - * or if this node already has a bin config, renames the corresponding signal in the model. - */ - value: function merge(other, renameSignal) { - var _iterator88 = _createForOfIteratorHelper(keys(other.bins)), - _step88; - - try { - for (_iterator88.s(); !(_step88 = _iterator88.n()).done;) { - var key = _step88.value; - - if (key in this.bins) { - renameSignal(other.bins[key].signal, this.bins[key].signal); // Ensure that we don't have duplicate names for signal pairs - - this.bins[key].as = unique([].concat(_toConsumableArray(this.bins[key].as), _toConsumableArray(other.bins[key].as)), _hash); - } else { - this.bins[key] = other.bins[key]; - } - } - } catch (err) { - _iterator88.e(err); - } finally { - _iterator88.f(); - } - - var _iterator89 = _createForOfIteratorHelper(other.children), - _step89; - - try { - for (_iterator89.s(); !(_step89 = _iterator89.n()).done;) { - var child = _step89.value; - other.removeChild(child); - child.parent = this; - } - } catch (err) { - _iterator89.e(err); - } finally { - _iterator89.f(); - } - - other.remove(); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(vals(this.bins).map(function (c) { - return c.as; - }).flat(2)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(vals(this.bins).map(function (c) { - return c.field; - })); - } - }, { - key: "hash", - value: function hash() { - return "Bin ".concat(_hash(this.bins)); - } - }, { - key: "assemble", - value: function assemble() { - return vals(this.bins).flatMap(function (bin) { - var transform = []; - - var _bin$as = _toArray(bin.as), - binAs = _bin$as[0], - remainingAs = _bin$as.slice(1); - - var _a = bin.bin, - extent = _a.extent, - params = __rest(_a, ["extent"]); - - var binTrans = Object.assign(Object.assign(Object.assign({ - type: 'bin', - field: replacePathInField(bin.field), - as: binAs, - signal: bin.signal - }, !isSelectionExtent(extent) ? { - extent: extent - } : { - extent: null - }), bin.span ? { - span: { - signal: "span(".concat(bin.span, ")") - } - } : {}), params); - - if (!extent && bin.extentSignal) { - transform.push({ - type: 'extent', - field: replacePathInField(bin.field), - signal: bin.extentSignal - }); - binTrans.extent = { - signal: bin.extentSignal - }; - } - - transform.push(binTrans); - - var _iterator90 = _createForOfIteratorHelper(remainingAs), - _step90; - - try { - for (_iterator90.s(); !(_step90 = _iterator90.n()).done;) { - var as = _step90.value; - - for (var i = 0; i < 2; i++) { - transform.push({ - type: 'formula', - expr: _vgField({ - field: binAs[i] - }, { - expr: 'datum' - }), - as: as[i] - }); - } - } - } catch (err) { - _iterator90.e(err); - } finally { - _iterator90.f(); - } - - if (bin.formula) { - transform.push({ - type: 'formula', - expr: bin.formula, - as: bin.formulaAs - }); - } - - return transform; - }); - } - }], [{ - key: "makeFromEncoding", - value: function makeFromEncoding(parent, model) { - var bins = model.reduceFieldDef(function (binComponentIndex, fieldDef, channel) { - if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) { - var _createBinComponent = createBinComponent(fieldDef, fieldDef.bin, model), - key = _createBinComponent.key, - binComponent = _createBinComponent.binComponent; - - binComponentIndex[key] = Object.assign(Object.assign(Object.assign({}, binComponent), binComponentIndex[key]), rangeFormula(model, fieldDef, channel, model.config)); - } - - return binComponentIndex; - }, {}); - - if (isEmpty(bins)) { - return null; - } - - return new BinNode(parent, bins); - } - /** - * Creates a bin node from BinTransform. - * The optional parameter should provide - */ - - }, { - key: "makeFromTransform", - value: function makeFromTransform(parent, t, model) { - var _createBinComponent2 = createBinComponent(t, t.bin, model), - key = _createBinComponent2.key, - binComponent = _createBinComponent2.binComponent; - - return new BinNode(parent, _defineProperty({}, key, binComponent)); - } - }]); - - return BinNode; - }(DataFlowNode); - - var SourceNode = /*#__PURE__*/function (_DataFlowNode6) { - _inherits(SourceNode, _DataFlowNode6); - - var _super10 = _createSuper(SourceNode); - - function SourceNode(data) { - var _this14; - - _classCallCheck(this, SourceNode); - - _this14 = _super10.call(this, null); // source cannot have parent - - data = data !== null && data !== void 0 ? data : { - name: 'source' - }; - var format; - - if (!isGenerator(data)) { - format = data.format ? Object.assign({}, omit(data.format, ['parse'])) : {}; - } - - if (isInlineData(data)) { - _this14._data = { - values: data.values - }; - } else if (isUrlData(data)) { - _this14._data = { - url: data.url - }; - - if (!format.type) { - // Extract extension from URL using snippet from - // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript - var defaultExtension = /(?:\.([^.]+))?$/.exec(data.url)[1]; - - if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) { - defaultExtension = 'json'; - } // defaultExtension has type string but we ensure that it is DataFormatType above - - - format.type = defaultExtension; - } - } else if (isSphereGenerator(data)) { - // hardwire GeoJSON sphere data into output specification - _this14._data = { - values: [{ - type: 'Sphere' - }] - }; - } else if (isNamedData(data) || isGenerator(data)) { - _this14._data = {}; - } // set flag to check if generator - - - _this14._generator = isGenerator(data); // any dataset can be named - - if (data.name) { - _this14._name = data.name; - } - - if (format && !isEmpty(format)) { - _this14._data.format = format; - } - - return _this14; - } - - _createClass(SourceNode, [{ - key: "dependentFields", - value: function dependentFields() { - return new Set(); - } - }, { - key: "producedFields", - value: function producedFields() { - return undefined; // we don't know what this source produces - } - }, { - key: "hasName", - value: function hasName() { - return !!this._name; - } - }, { - key: "remove", - value: function remove() { - throw new Error('Source nodes are roots and cannot be removed.'); - } - }, { - key: "hash", - value: function hash() { - throw new Error('Cannot hash sources'); - } - }, { - key: "assemble", - value: function assemble() { - return Object.assign(Object.assign({ - name: this._name - }, this._data), { - transform: [] - }); - } - }, { - key: "data", - get: function get() { - return this._data; - } - }, { - key: "isGenerator", - get: function get() { - return this._generator; - } - }, { - key: "dataName", - get: function get() { - return this._name; - }, - set: function set(name) { - this._name = name; - } - }, { - key: "parent", - set: function set(parent) { - throw new Error('Source nodes have to be roots.'); - } - }]); - - return SourceNode; - }(DataFlowNode); - - var GraticuleNode = /*#__PURE__*/function (_DataFlowNode7) { - _inherits(GraticuleNode, _DataFlowNode7); - - var _super11 = _createSuper(GraticuleNode); - - function GraticuleNode(parent, params) { - var _this15; - - _classCallCheck(this, GraticuleNode); - - _this15 = _super11.call(this, parent); - _this15.params = params; - return _this15; - } - - _createClass(GraticuleNode, [{ - key: "clone", - value: function clone() { - return new GraticuleNode(null, this.params); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(); - } - }, { - key: "producedFields", - value: function producedFields() { - return undefined; // there should never be a node before graticule - } - }, { - key: "hash", - value: function hash() { - return "Graticule ".concat(_hash(this.params)); - } - }, { - key: "assemble", - value: function assemble() { - return Object.assign({ - type: 'graticule' - }, this.params === true ? {} : this.params); - } - }]); - - return GraticuleNode; - }(DataFlowNode); - - var SequenceNode = /*#__PURE__*/function (_DataFlowNode8) { - _inherits(SequenceNode, _DataFlowNode8); - - var _super12 = _createSuper(SequenceNode); - - function SequenceNode(parent, params) { - var _this16; - - _classCallCheck(this, SequenceNode); - - _this16 = _super12.call(this, parent); - _this16.params = params; - return _this16; - } - - _createClass(SequenceNode, [{ - key: "clone", - value: function clone() { - return new SequenceNode(null, this.params); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(); - } - }, { - key: "producedFields", - value: function producedFields() { - var _a; - - return new Set([(_a = this.params.as) !== null && _a !== void 0 ? _a : 'data']); - } - }, { - key: "hash", - value: function hash() { - return "Hash ".concat(_hash(this.params)); - } - }, { - key: "assemble", - value: function assemble() { - return Object.assign({ - type: 'sequence' - }, this.params); - } - }]); - - return SequenceNode; - }(DataFlowNode); - /** - * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator. - */ - - - function isDataSourceNode(node) { - return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode; - } - /** - * Abstract base class for BottomUpOptimizer and TopDownOptimizer. - * Contains only mutation handling logic. Subclasses need to implement iteration logic. - */ - - - var OptimizerBase = /*#__PURE__*/function () { - function OptimizerBase() { - _classCallCheck(this, OptimizerBase); - - this._mutated = false; - } // Once true, _mutated is never set to false - - - _createClass(OptimizerBase, [{ - key: "setMutated", - value: function setMutated() { - this._mutated = true; - } - }, { - key: "mutatedFlag", - get: function get() { - return this._mutated; - } - }]); - - return OptimizerBase; - }(); - /** - * Starts from a node and runs the optimization function(the "run" method) upwards to the root, - * depending on the continueFlag and mutatedFlag values returned by the optimization function. - */ - - - var BottomUpOptimizer = /*#__PURE__*/function (_OptimizerBase) { - _inherits(BottomUpOptimizer, _OptimizerBase); - - var _super13 = _createSuper(BottomUpOptimizer); - - function BottomUpOptimizer() { - var _this17; - - _classCallCheck(this, BottomUpOptimizer); - - _this17 = _super13.call(this); - _this17._continue = false; - return _this17; - } - - _createClass(BottomUpOptimizer, [{ - key: "setContinue", - value: function setContinue() { - this._continue = true; - } - }, { - key: "reset", - - /** - * Reset the state of the optimizer after it has completed a run from the bottom of the tree to the top. - */ - value: function reset() {// do nothing - } - }, { - key: "optimizeNextFromLeaves", - value: function optimizeNextFromLeaves(node) { - if (isDataSourceNode(node)) { - return false; - } - - var next = node.parent; - - var _this$run = this.run(node), - continueFlag = _this$run.continueFlag; - - if (continueFlag) { - this.optimizeNextFromLeaves(next); - } - - return this.mutatedFlag; - } - }, { - key: "continueFlag", - get: function get() { - return this._continue; - } - }, { - key: "flags", - get: function get() { - return { - continueFlag: this.continueFlag, - mutatedFlag: this.mutatedFlag - }; - }, - set: function set(_ref85) { - var continueFlag = _ref85.continueFlag, - mutatedFlag = _ref85.mutatedFlag; - - if (continueFlag) { - this.setContinue(); - } - - if (mutatedFlag) { - this.setMutated(); - } - } - }]); - - return BottomUpOptimizer; - }(OptimizerBase); - /** - * The optimizer function( the "run" method), is invoked on the given node and then continues recursively. - */ - - - var TopDownOptimizer = /*#__PURE__*/function (_OptimizerBase2) { - _inherits(TopDownOptimizer, _OptimizerBase2); - - var _super14 = _createSuper(TopDownOptimizer); - - function TopDownOptimizer() { - _classCallCheck(this, TopDownOptimizer); - - return _super14.apply(this, arguments); - } - - return TopDownOptimizer; - }(OptimizerBase); - - function addDimension(dims, channel, fieldDef, model) { - var channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; - - if (isTypedFieldDef(fieldDef) && isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config)) { - dims.add(_vgField(fieldDef, {})); - dims.add(_vgField(fieldDef, { - suffix: 'end' - })); - - if (fieldDef.bin && binRequiresRange(fieldDef, channel)) { - dims.add(_vgField(fieldDef, { - binSuffix: 'range' - })); - } - } else if (isGeoPositionChannel(channel)) { - var posChannel = getPositionChannelFromLatLong(channel); - dims.add(model.getName(posChannel)); - } else { - dims.add(_vgField(fieldDef)); - } - - return dims; - } - - function mergeMeasures(parentMeasures, childMeasures) { - var _a; - - var _iterator91 = _createForOfIteratorHelper(keys(childMeasures)), - _step91; - - try { - for (_iterator91.s(); !(_step91 = _iterator91.n()).done;) { - var _field9 = _step91.value; - // when we merge a measure, we either have to add an aggregation operator or even a new field - var ops = childMeasures[_field9]; - - var _iterator92 = _createForOfIteratorHelper(keys(ops)), - _step92; - - try { - for (_iterator92.s(); !(_step92 = _iterator92.n()).done;) { - var op = _step92.value; - - if (_field9 in parentMeasures) { - // add operator to existing measure field - parentMeasures[_field9][op] = new Set([].concat(_toConsumableArray((_a = parentMeasures[_field9][op]) !== null && _a !== void 0 ? _a : []), _toConsumableArray(ops[op]))); - } else { - parentMeasures[_field9] = _defineProperty({}, op, ops[op]); - } - } - } catch (err) { - _iterator92.e(err); - } finally { - _iterator92.f(); - } - } - } catch (err) { - _iterator91.e(err); - } finally { - _iterator91.f(); - } - } - - var AggregateNode = /*#__PURE__*/function (_DataFlowNode9) { - _inherits(AggregateNode, _DataFlowNode9); - - var _super15 = _createSuper(AggregateNode); - - /** - * @param dimensions string set for dimensions - * @param measures dictionary mapping field name => dict of aggregation functions and names to use - */ - function AggregateNode(parent, dimensions, measures) { - var _this18; - - _classCallCheck(this, AggregateNode); - - _this18 = _super15.call(this, parent); - _this18.dimensions = dimensions; - _this18.measures = measures; - return _this18; - } - - _createClass(AggregateNode, [{ - key: "clone", - value: function clone() { - return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures)); - } - }, { - key: "merge", - value: function merge(other) { - if (setEqual(this.dimensions, other.dimensions)) { - mergeMeasures(this.measures, other.measures); - return true; - } else { - debug('different dimensions, cannot merge'); - return false; - } - } - }, { - key: "addDimensions", - value: function addDimensions(fields) { - fields.forEach(this.dimensions.add, this.dimensions); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set([].concat(_toConsumableArray(this.dimensions), _toConsumableArray(keys(this.measures)))); - } - }, { - key: "producedFields", - value: function producedFields() { - var out = new Set(); - - var _iterator93 = _createForOfIteratorHelper(keys(this.measures)), - _step93; - - try { - for (_iterator93.s(); !(_step93 = _iterator93.n()).done;) { - var _field10 = _step93.value; - - var _iterator94 = _createForOfIteratorHelper(keys(this.measures[_field10])), - _step94; - - try { - for (_iterator94.s(); !(_step94 = _iterator94.n()).done;) { - var op = _step94.value; - var m = this.measures[_field10][op]; - - if (m.size === 0) { - out.add("".concat(op, "_").concat(_field10)); - } else { - m.forEach(out.add, out); - } - } - } catch (err) { - _iterator94.e(err); - } finally { - _iterator94.f(); - } - } - } catch (err) { - _iterator93.e(err); - } finally { - _iterator93.f(); - } - - return out; - } - }, { - key: "hash", - value: function hash() { - return "Aggregate ".concat(_hash({ - dimensions: this.dimensions, - measures: this.measures - })); - } - }, { - key: "assemble", - value: function assemble() { - var ops = []; - var fields = []; - var as = []; - - var _iterator95 = _createForOfIteratorHelper(keys(this.measures)), - _step95; - - try { - for (_iterator95.s(); !(_step95 = _iterator95.n()).done;) { - var _field11 = _step95.value; - - var _iterator96 = _createForOfIteratorHelper(keys(this.measures[_field11])), - _step96; - - try { - for (_iterator96.s(); !(_step96 = _iterator96.n()).done;) { - var op = _step96.value; - - var _iterator97 = _createForOfIteratorHelper(this.measures[_field11][op]), - _step97; - - try { - for (_iterator97.s(); !(_step97 = _iterator97.n()).done;) { - var alias = _step97.value; - as.push(alias); - ops.push(op); - fields.push(_field11 === '*' ? null : replacePathInField(_field11)); - } - } catch (err) { - _iterator97.e(err); - } finally { - _iterator97.f(); - } - } - } catch (err) { - _iterator96.e(err); - } finally { - _iterator96.f(); - } - } - } catch (err) { - _iterator95.e(err); - } finally { - _iterator95.f(); - } - - var result = { - type: 'aggregate', - groupby: _toConsumableArray(this.dimensions).map(replacePathInField), - ops: ops, - fields: fields, - as: as - }; - return result; - } - }, { - key: "groupBy", - get: function get() { - return this.dimensions; - } - }], [{ - key: "makeFromEncoding", - value: function makeFromEncoding(parent, model) { - var isAggregate = false; - model.forEachFieldDef(function (fd) { - if (fd.aggregate) { - isAggregate = true; - } - }); - var meas = {}; - var dims = new Set(); - - if (!isAggregate) { - // no need to create this node if the model has no aggregation - return null; - } - - model.forEachFieldDef(function (fieldDef, channel) { - var _a, _b, _c, _d; - - var aggregate = fieldDef.aggregate, - field = fieldDef.field; - - if (aggregate) { - if (aggregate === 'count') { - meas['*'] = (_a = meas['*']) !== null && _a !== void 0 ? _a : {}; - meas['*']['count'] = new Set([_vgField(fieldDef, { - forAs: true - })]); - } else { - if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { - var op = isArgminDef(aggregate) ? 'argmin' : 'argmax'; - var argField = aggregate[op]; - meas[argField] = (_b = meas[argField]) !== null && _b !== void 0 ? _b : {}; - meas[argField][op] = new Set([_vgField({ - op: op, - field: argField - }, { - forAs: true - })]); - } else { - meas[field] = (_c = meas[field]) !== null && _c !== void 0 ? _c : {}; - meas[field][aggregate] = new Set([_vgField(fieldDef, { - forAs: true - })]); - } // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain - - - if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') { - meas[field] = (_d = meas[field]) !== null && _d !== void 0 ? _d : {}; - meas[field]['min'] = new Set([_vgField({ - field: field, - aggregate: 'min' - }, { - forAs: true - })]); - meas[field]['max'] = new Set([_vgField({ - field: field, - aggregate: 'max' - }, { - forAs: true - })]); - } - } - } else { - addDimension(dims, channel, fieldDef, model); - } - }); - - if (dims.size + keys(meas).length === 0) { - return null; - } - - return new AggregateNode(parent, dims, meas); - } - }, { - key: "makeFromTransform", - value: function makeFromTransform(parent, t) { - var _a, _b, _c; - - var dims = new Set(); - var meas = {}; - - var _iterator98 = _createForOfIteratorHelper(t.aggregate), - _step98; - - try { - for (_iterator98.s(); !(_step98 = _iterator98.n()).done;) { - var s = _step98.value; - var op = s.op, - _field12 = s.field, - as = s.as; - - if (op) { - if (op === 'count') { - meas['*'] = (_a = meas['*']) !== null && _a !== void 0 ? _a : {}; - meas['*']['count'] = new Set([as ? as : _vgField(s, { - forAs: true - })]); - } else { - meas[_field12] = (_b = meas[_field12]) !== null && _b !== void 0 ? _b : {}; - meas[_field12][op] = new Set([as ? as : _vgField(s, { - forAs: true - })]); - } - } - } - } catch (err) { - _iterator98.e(err); - } finally { - _iterator98.f(); - } - - var _iterator99 = _createForOfIteratorHelper((_c = t.groupby) !== null && _c !== void 0 ? _c : []), - _step99; - - try { - for (_iterator99.s(); !(_step99 = _iterator99.n()).done;) { - var _s2 = _step99.value; - dims.add(_s2); - } - } catch (err) { - _iterator99.e(err); - } finally { - _iterator99.f(); - } - - if (dims.size + keys(meas).length === 0) { - return null; - } - - return new AggregateNode(parent, dims, meas); - } - }]); - - return AggregateNode; - }(DataFlowNode); - /** - * A node that helps us track what fields we are faceting by. - */ - - - var FacetNode = /*#__PURE__*/function (_DataFlowNode10) { - _inherits(FacetNode, _DataFlowNode10); - - var _super16 = _createSuper(FacetNode); - - /** - * @param model The facet model. - * @param name The name that this facet source will have. - * @param data The source data for this facet data. - */ - function FacetNode(parent, model, name, data) { - var _this19; - - _classCallCheck(this, FacetNode); - - _this19 = _super16.call(this, parent); - _this19.model = model; - _this19.name = name; - _this19.data = data; - - var _iterator100 = _createForOfIteratorHelper(FACET_CHANNELS), - _step100; - - try { - for (_iterator100.s(); !(_step100 = _iterator100.n()).done;) { - var channel = _step100.value; - var fieldDef = model.facet[channel]; - - if (fieldDef) { - var bin = fieldDef.bin, - sort = fieldDef.sort; - _this19[channel] = Object.assign({ - name: model.getName("".concat(channel, "_domain")), - fields: [_vgField(fieldDef)].concat(_toConsumableArray(isBinning(bin) ? [_vgField(fieldDef, { - binSuffix: 'end' - })] : [])) - }, isSortField(sort) ? { - sortField: sort - } : isArray(sort) ? { - sortIndexField: sortArrayIndexField(fieldDef, channel) - } : {}); - } - } - } catch (err) { - _iterator100.e(err); - } finally { - _iterator100.f(); - } - - _this19.childModel = model.child; - return _this19; - } - - _createClass(FacetNode, [{ - key: "hash", - value: function hash() { - var out = "Facet"; - - var _iterator101 = _createForOfIteratorHelper(FACET_CHANNELS), - _step101; - - try { - for (_iterator101.s(); !(_step101 = _iterator101.n()).done;) { - var channel = _step101.value; - - if (this[channel]) { - out += " ".concat(channel.charAt(0), ":").concat(_hash(this[channel])); - } - } - } catch (err) { - _iterator101.e(err); - } finally { - _iterator101.f(); - } - - return out; - } - }, { - key: "dependentFields", - value: function dependentFields() { - var depFields = new Set(this.fields); - - var _iterator102 = _createForOfIteratorHelper(FACET_CHANNELS), - _step102; - - try { - for (_iterator102.s(); !(_step102 = _iterator102.n()).done;) { - var channel = _step102.value; - - if (this[channel]) { - if (this[channel].sortField) { - depFields.add(this[channel].sortField.field); - } - - if (this[channel].sortIndexField) { - depFields.add(this[channel].sortIndexField); - } - } - } - } catch (err) { - _iterator102.e(err); - } finally { - _iterator102.f(); - } - - return depFields; - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(); // facet does not produce any new fields - } - /** - * The name to reference this source is its name. - */ - - }, { - key: "getSource", - value: function getSource() { - return this.name; - } - }, { - key: "getChildIndependentFieldsWithStep", - value: function getChildIndependentFieldsWithStep() { - var childIndependentFieldsWithStep = {}; - - var _iterator103 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS), - _step103; - - try { - for (_iterator103.s(); !(_step103 = _iterator103.n()).done;) { - var channel = _step103.value; - var childScaleComponent = this.childModel.component.scales[channel]; - - if (childScaleComponent && !childScaleComponent.merged) { - // independent scale - var type = childScaleComponent.get('type'); - var range = childScaleComponent.get('range'); - - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - var _domain = assembleDomain(this.childModel, channel); - - var _field13 = getFieldFromDomain(_domain); - - if (_field13) { - childIndependentFieldsWithStep[channel] = _field13; - } else { - warn(unknownField(channel)); - } - } - } - } - } catch (err) { - _iterator103.e(err); - } finally { - _iterator103.f(); - } - - return childIndependentFieldsWithStep; - } - }, { - key: "assembleRowColumnHeaderData", - value: function assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep) { - var childChannel = { - row: 'y', - column: 'x' - }[channel]; - var fields = []; - var ops = []; - var as = []; - - if (childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) { - if (crossedDataName) { - // If there is a crossed data, calculate max - fields.push("distinct_".concat(childIndependentFieldsWithStep[childChannel])); - ops.push('max'); - } else { - // If there is no crossed data, just calculate distinct - fields.push(childIndependentFieldsWithStep[childChannel]); - ops.push('distinct'); - } // Although it is technically a max, just name it distinct so it's easier to refer to it - - - as.push("distinct_".concat(childIndependentFieldsWithStep[childChannel])); - } - - var _this$channel = this[channel], - sortField = _this$channel.sortField, - sortIndexField = _this$channel.sortIndexField; - - if (sortField) { - var _sortField$op = sortField.op, - op = _sortField$op === void 0 ? DEFAULT_SORT_OP : _sortField$op, - _field14 = sortField.field; - fields.push(_field14); - ops.push(op); - as.push(_vgField(sortField, { - forAs: true - })); - } else if (sortIndexField) { - fields.push(sortIndexField); - ops.push('max'); - as.push(sortIndexField); - } - - return { - name: this[channel].name, - // Use data from the crossed one if it exist - source: crossedDataName !== null && crossedDataName !== void 0 ? crossedDataName : this.data, - transform: [Object.assign({ - type: 'aggregate', - groupby: this[channel].fields - }, fields.length ? { - fields: fields, - ops: ops, - as: as - } : {})] - }; - } - }, { - key: "assembleFacetHeaderData", - value: function assembleFacetHeaderData(childIndependentFieldsWithStep) { - var _a, _b; - - var columns = this.model.layout.columns; - var layoutHeaders = this.model.component.layoutHeaders; - var data = []; - var hasSharedAxis = {}; - - var _iterator104 = _createForOfIteratorHelper(HEADER_CHANNELS), - _step104; - - try { - for (_iterator104.s(); !(_step104 = _iterator104.n()).done;) { - var headerChannel = _step104.value; - - var _iterator105 = _createForOfIteratorHelper(HEADER_TYPES), - _step105; - - try { - for (_iterator105.s(); !(_step105 = _iterator105.n()).done;) { - var headerType = _step105.value; - var headers = (_a = layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) !== null && _a !== void 0 ? _a : []; - - var _iterator106 = _createForOfIteratorHelper(headers), - _step106; - - try { - for (_iterator106.s(); !(_step106 = _iterator106.n()).done;) { - var header = _step106.value; - - if (((_b = header.axes) === null || _b === void 0 ? void 0 : _b.length) > 0) { - hasSharedAxis[headerChannel] = true; - break; - } - } - } catch (err) { - _iterator106.e(err); - } finally { - _iterator106.f(); - } - } - } catch (err) { - _iterator105.e(err); - } finally { - _iterator105.f(); - } - - if (hasSharedAxis[headerChannel]) { - var cardinality = "length(data(\"".concat(this.facet.name, "\"))"); - var stop = headerChannel === 'row' ? columns ? { - signal: "ceil(".concat(cardinality, " / ").concat(columns, ")") - } : 1 : columns ? { - signal: "min(".concat(cardinality, ", ").concat(columns, ")") - } : { - signal: cardinality - }; - data.push({ - name: "".concat(this.facet.name, "_").concat(headerChannel), - transform: [{ - type: 'sequence', - start: 0, - stop: stop - }] - }); - } - } - } catch (err) { - _iterator104.e(err); - } finally { - _iterator104.f(); - } - - var row = hasSharedAxis.row, - column = hasSharedAxis.column; - - if (row || column) { - data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep)); - } - - return data; - } - }, { - key: "assemble", - value: function assemble() { - var _a, _b; - - var data = []; - var crossedDataName = null; - var childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep(); - var column = this.column, - row = this.row, - facet = this.facet; - - if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) { - // Need to create a cross dataset to correctly calculate cardinality - crossedDataName = "cross_".concat(this.column.name, "_").concat(this.row.name); - var fields = [].concat((_a = childIndependentFieldsWithStep.x) !== null && _a !== void 0 ? _a : [], (_b = childIndependentFieldsWithStep.y) !== null && _b !== void 0 ? _b : []); - var ops = fields.map(function () { - return 'distinct'; - }); - data.push({ - name: crossedDataName, - source: this.data, - transform: [{ - type: 'aggregate', - groupby: this.fields, - fields: fields, - ops: ops - }] - }); - } - - for (var _i13 = 0, _arr10 = [COLUMN, ROW]; _i13 < _arr10.length; _i13++) { - var channel = _arr10[_i13]; - - if (this[channel]) { - data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep)); - } - } - - if (facet) { - var facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep); - - if (facetData) { - data.push.apply(data, _toConsumableArray(facetData)); - } - } - - return data; - } - }, { - key: "fields", - get: function get() { - var _a; - - var f = []; - - var _iterator107 = _createForOfIteratorHelper(FACET_CHANNELS), - _step107; - - try { - for (_iterator107.s(); !(_step107 = _iterator107.n()).done;) { - var channel = _step107.value; - - if ((_a = this[channel]) === null || _a === void 0 ? void 0 : _a.fields) { - f.push.apply(f, _toConsumableArray(this[channel].fields)); - } - } - } catch (err) { - _iterator107.e(err); - } finally { - _iterator107.f(); - } - - return f; - } - }]); - - return FacetNode; - }(DataFlowNode); - /** - * Remove quotes from a string. - */ - - - function unquote(pattern) { - if (pattern[0] === "'" && pattern[pattern.length - 1] === "'" || pattern[0] === '"' && pattern[pattern.length - 1] === '"') { - return pattern.slice(1, -1); - } - - return pattern; - } - /** - * @param field The field. - * @param parse What to parse the field as. - */ - - - function parseExpression$1(field, parse) { - var f = accessPathWithDatum(field); - - if (parse === 'number') { - return "toNumber(".concat(f, ")"); - } else if (parse === 'boolean') { - return "toBoolean(".concat(f, ")"); - } else if (parse === 'string') { - return "toString(".concat(f, ")"); - } else if (parse === 'date') { - return "toDate(".concat(f, ")"); - } else if (parse === 'flatten') { - return f; - } else if (parse.indexOf('date:') === 0) { - var specifier = unquote(parse.slice(5, parse.length)); - return "timeParse(".concat(f, ",'").concat(specifier, "')"); - } else if (parse.indexOf('utc:') === 0) { - var _specifier = unquote(parse.slice(4, parse.length)); - - return "utcParse(".concat(f, ",'").concat(_specifier, "')"); - } else { - warn(unrecognizedParse(parse)); - return null; - } - } - - function getImplicitFromFilterTransform(transform) { - var implicit = {}; - forEachLeaf(transform.filter, function (filter) { - var _a; - - if (isFieldPredicate(filter)) { - // Automatically add a parse node for filters with filter objects - var val = null; // For EqualFilter, just use the equal property. - // For RangeFilter and OneOfFilter, all array members should have - // the same type, so we only use the first one. - - if (isFieldEqualPredicate(filter)) { - val = filter.equal; - } else if (isFieldRangePredicate(filter)) { - val = filter.range[0]; - } else if (isFieldOneOfPredicate(filter)) { - val = ((_a = filter.oneOf) !== null && _a !== void 0 ? _a : filter['in'])[0]; - } // else -- for filter expression, we can't infer anything - - - if (val) { - if (isDateTime(val)) { - implicit[filter.field] = 'date'; - } else if (isNumber(val)) { - implicit[filter.field] = 'number'; - } else if (isString(val)) { - implicit[filter.field] = 'string'; - } - } - - if (filter.timeUnit) { - implicit[filter.field] = 'date'; - } - } - }); - return implicit; - } - /** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ - - - function getImplicitFromEncoding(model) { - var implicit = {}; - - function add(fieldDef) { - if (isFieldOrDatumDefForTimeFormat(fieldDef)) { - implicit[fieldDef.field] = 'date'; - } else if (fieldDef.type === 'quantitative' && isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max - ) { - implicit[fieldDef.field] = 'number'; - } else if (accessPathDepth(fieldDef.field) > 1) { - // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field. - // (Parsing numbers / dates already flattens numeric and temporal fields.) - if (!(fieldDef.field in implicit)) { - implicit[fieldDef.field] = 'flatten'; - } - } else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) { - // Flatten fields that we sort by but that are not otherwise flattened. - if (!(fieldDef.sort.field in implicit)) { - implicit[fieldDef.sort.field] = 'flatten'; - } - } - } - - if (isUnitModel(model) || isFacetModel(model)) { - // Parse encoded fields - model.forEachFieldDef(function (fieldDef, channel) { - if (isTypedFieldDef(fieldDef)) { - add(fieldDef); - } else { - var mainChannel = getMainRangeChannel(channel); - var mainFieldDef = model.fieldDef(mainChannel); - add(Object.assign(Object.assign({}, fieldDef), { - type: mainFieldDef.type - })); - } - }); - } // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly. - - - if (isUnitModel(model)) { - var mark = model.mark, - markDef = model.markDef, - encoding = model.encoding; - - if (isPathMark(mark) && // No need to sort by dimension if we have a connected scatterplot (order channel is present) - !model.encoding.order) { - var dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; - var dimensionChannelDef = encoding[dimensionChannel]; - - if (isFieldDef(dimensionChannelDef) && dimensionChannelDef.type === 'quantitative' && !(dimensionChannelDef.field in implicit)) { - implicit[dimensionChannelDef.field] = 'number'; - } - } - } - - return implicit; - } - /** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ - - - function getImplicitFromSelection(model) { - var implicit = {}; - - if (isUnitModel(model) && model.component.selection) { - var _iterator108 = _createForOfIteratorHelper(keys(model.component.selection)), - _step108; - - try { - for (_iterator108.s(); !(_step108 = _iterator108.n()).done;) { - var name = _step108.value; - var selCmpt = model.component.selection[name]; - - var _iterator109 = _createForOfIteratorHelper(selCmpt.project.items), - _step109; - - try { - for (_iterator109.s(); !(_step109 = _iterator109.n()).done;) { - var proj = _step109.value; - - if (!proj.channel && accessPathDepth(proj.field) > 1) { - implicit[proj.field] = 'flatten'; - } - } - } catch (err) { - _iterator109.e(err); - } finally { - _iterator109.f(); - } - } - } catch (err) { - _iterator108.e(err); - } finally { - _iterator108.f(); - } - } - - return implicit; - } - - var ParseNode = /*#__PURE__*/function (_DataFlowNode11) { - _inherits(ParseNode, _DataFlowNode11); - - var _super17 = _createSuper(ParseNode); - - function ParseNode(parent, parse) { - var _this20; - - _classCallCheck(this, ParseNode); - - _this20 = _super17.call(this, parent); - _this20._parse = parse; - return _this20; - } - - _createClass(ParseNode, [{ - key: "clone", - value: function clone() { - return new ParseNode(null, duplicate(this._parse)); - } - }, { - key: "hash", - value: function hash() { - return "Parse ".concat(_hash(this._parse)); - } - /** - * Creates a parse node from a data.format.parse and updates ancestorParse. - */ - - }, { - key: "merge", - value: function merge(other) { - this._parse = Object.assign(Object.assign({}, this._parse), other.parse); - other.remove(); - } - /** - * Assemble an object for Vega's format.parse property. - */ - - }, { - key: "assembleFormatParse", - value: function assembleFormatParse() { - var formatParse = {}; - - var _iterator110 = _createForOfIteratorHelper(keys(this._parse)), - _step110; - - try { - for (_iterator110.s(); !(_step110 = _iterator110.n()).done;) { - var _field15 = _step110.value; - var p = this._parse[_field15]; - - if (accessPathDepth(_field15) === 1) { - formatParse[_field15] = p; - } - } - } catch (err) { - _iterator110.e(err); - } finally { - _iterator110.f(); - } - - return formatParse; - } // format parse depends and produces all fields in its parse - - }, { - key: "producedFields", - value: function producedFields() { - return new Set(keys(this._parse)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(keys(this._parse)); - } - }, { - key: "assembleTransforms", - value: function assembleTransforms() { - var _this21 = this; - - var onlyNested = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - return keys(this._parse).filter(function (field) { - return onlyNested ? accessPathDepth(field) > 1 : true; - }).map(function (field) { - var expr = parseExpression$1(field, _this21._parse[field]); - - if (!expr) { - return null; - } - - var formula = { - type: 'formula', - expr: expr, - as: removePathFromField(field) // Vega output is always flattened - - }; - return formula; - }).filter(function (t) { - return t !== null; - }); - } - }, { - key: "parse", - get: function get() { - return this._parse; - } - }], [{ - key: "makeExplicit", - value: function makeExplicit(parent, model, ancestorParse) { - // Custom parse - var explicit = {}; - var data = model.data; - - if (!isGenerator(data) && data && data.format && data.format.parse) { - explicit = data.format.parse; - } - - return this.makeWithAncestors(parent, explicit, {}, ancestorParse); - } - /** - * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse. - */ - - }, { - key: "makeWithAncestors", - value: function makeWithAncestors(parent, explicit, implicit, ancestorParse) { - // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as "derived"). We also don't need to flatten a field that has already been parsed. - var _iterator111 = _createForOfIteratorHelper(keys(implicit)), - _step111; - - try { - for (_iterator111.s(); !(_step111 = _iterator111.n()).done;) { - var _field16 = _step111.value; - var parsedAs = ancestorParse.getWithExplicit(_field16); - - if (parsedAs.value !== undefined) { - // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types. - if (parsedAs.explicit || parsedAs.value === implicit[_field16] || parsedAs.value === 'derived' || implicit[_field16] === 'flatten') { - delete implicit[_field16]; - } else { - warn(differentParse(_field16, implicit[_field16], parsedAs.value)); - } - } - } - } catch (err) { - _iterator111.e(err); - } finally { - _iterator111.f(); - } - - var _iterator112 = _createForOfIteratorHelper(keys(explicit)), - _step112; - - try { - for (_iterator112.s(); !(_step112 = _iterator112.n()).done;) { - var _field17 = _step112.value; - - var _parsedAs = ancestorParse.get(_field17); - - if (_parsedAs !== undefined) { - // Don't parse a field again if it has been parsed with the same type already. - if (_parsedAs === explicit[_field17]) { - delete explicit[_field17]; - } else { - warn(differentParse(_field17, explicit[_field17], _parsedAs)); - } - } - } - } catch (err) { - _iterator112.e(err); - } finally { - _iterator112.f(); - } - - var parse = new Split(explicit, implicit); // add the format parse from this model so that children don't parse the same field again - - ancestorParse.copyAll(parse); // copy only non-null parses - - var p = {}; - - var _iterator113 = _createForOfIteratorHelper(keys(parse.combine())), - _step113; - - try { - for (_iterator113.s(); !(_step113 = _iterator113.n()).done;) { - var key = _step113.value; - var val = parse.get(key); - - if (val !== null) { - p[key] = val; - } - } - } catch (err) { - _iterator113.e(err); - } finally { - _iterator113.f(); - } - - if (keys(p).length === 0 || ancestorParse.parseNothing) { - return null; - } - - return new ParseNode(parent, p); - } - }]); - - return ParseNode; - }(DataFlowNode); - - var IdentifierNode = /*#__PURE__*/function (_DataFlowNode12) { - _inherits(IdentifierNode, _DataFlowNode12); - - var _super18 = _createSuper(IdentifierNode); - - _createClass(IdentifierNode, [{ - key: "clone", - value: function clone() { - return new IdentifierNode(null); - } - }]); - - function IdentifierNode(parent) { - _classCallCheck(this, IdentifierNode); - - return _super18.call(this, parent); - } - - _createClass(IdentifierNode, [{ - key: "dependentFields", - value: function dependentFields() { - return new Set(); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set([SELECTION_ID]); - } - }, { - key: "hash", - value: function hash() { - return 'Identifier'; - } - }, { - key: "assemble", - value: function assemble() { - return { - type: 'identifier', - as: SELECTION_ID - }; - } - }]); - - return IdentifierNode; - }(DataFlowNode); - /** - * A class for the join aggregate transform nodes. - */ - - - var JoinAggregateTransformNode = /*#__PURE__*/function (_DataFlowNode13) { - _inherits(JoinAggregateTransformNode, _DataFlowNode13); - - var _super19 = _createSuper(JoinAggregateTransformNode); - - function JoinAggregateTransformNode(parent, transform) { - var _this22; - - _classCallCheck(this, JoinAggregateTransformNode); - - _this22 = _super19.call(this, parent); - _this22.transform = transform; - return _this22; - } - - _createClass(JoinAggregateTransformNode, [{ - key: "clone", - value: function clone() { - return new JoinAggregateTransformNode(null, duplicate(this.transform)); - } - }, { - key: "addDimensions", - value: function addDimensions(fields) { - this.transform.groupby = unique(this.transform.groupby.concat(fields), function (d) { - return d; - }); - } - }, { - key: "dependentFields", - value: function dependentFields() { - var out = new Set(); - - if (this.transform.groupby) { - this.transform.groupby.forEach(out.add, out); - } - - this.transform.joinaggregate.map(function (w) { - return w.field; - }).filter(function (f) { - return f !== undefined; - }).forEach(out.add, out); - return out; - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.transform.joinaggregate.map(this.getDefaultName)); - } - }, { - key: "getDefaultName", - value: function getDefaultName(joinAggregateFieldDef) { - var _a; - - return (_a = joinAggregateFieldDef.as) !== null && _a !== void 0 ? _a : _vgField(joinAggregateFieldDef); - } - }, { - key: "hash", - value: function hash() { - return "JoinAggregateTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var fields = []; - var ops = []; - var as = []; - - var _iterator114 = _createForOfIteratorHelper(this.transform.joinaggregate), - _step114; - - try { - for (_iterator114.s(); !(_step114 = _iterator114.n()).done;) { - var joinaggregate = _step114.value; - ops.push(joinaggregate.op); - as.push(this.getDefaultName(joinaggregate)); - fields.push(joinaggregate.field === undefined ? null : joinaggregate.field); - } - } catch (err) { - _iterator114.e(err); - } finally { - _iterator114.f(); - } - - var groupby = this.transform.groupby; - return Object.assign({ - type: 'joinaggregate', - as: as, - ops: ops, - fields: fields - }, groupby !== undefined ? { - groupby: groupby - } : {}); - } - }]); - - return JoinAggregateTransformNode; - }(DataFlowNode); - - function getStackByFields(model) { - return model.stack.stackBy.reduce(function (fields, by) { - var fieldDef = by.fieldDef; - - var _field = _vgField(fieldDef); - - if (_field) { - fields.push(_field); - } - - return fields; - }, []); - } - - function isValidAsArray(as) { - return isArray(as) && as.every(function (s) { - return isString(s); - }) && as.length > 1; - } - - var StackNode = /*#__PURE__*/function (_DataFlowNode14) { - _inherits(StackNode, _DataFlowNode14); - - var _super20 = _createSuper(StackNode); - - function StackNode(parent, stack) { - var _this23; - - _classCallCheck(this, StackNode); - - _this23 = _super20.call(this, parent); - _this23._stack = stack; - return _this23; - } - - _createClass(StackNode, [{ - key: "clone", - value: function clone() { - return new StackNode(null, duplicate(this._stack)); - } - }, { - key: "addDimensions", - value: function addDimensions(fields) { - var _this$_stack$facetby; - - (_this$_stack$facetby = this._stack.facetby).push.apply(_this$_stack$facetby, _toConsumableArray(fields)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - var out = new Set(); - out.add(this._stack.stackField); - this.getGroupbyFields().forEach(out.add, out); - - this._stack.facetby.forEach(out.add, out); - - this._stack.sort.field.forEach(out.add, out); - - return out; - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this._stack.as); - } - }, { - key: "hash", - value: function hash() { - return "Stack ".concat(_hash(this._stack)); - } - }, { - key: "getGroupbyFields", - value: function getGroupbyFields() { - var _this$_stack = this._stack, - dimensionFieldDef = _this$_stack.dimensionFieldDef, - impute = _this$_stack.impute, - groupby = _this$_stack.groupby; - - if (dimensionFieldDef) { - if (dimensionFieldDef.bin) { - if (impute) { - // For binned group by field with impute, we calculate bin_mid - // as we cannot impute two fields simultaneously - return [_vgField(dimensionFieldDef, { - binSuffix: 'mid' - })]; - } - - return [// For binned group by field without impute, we need both bin (start) and bin_end - _vgField(dimensionFieldDef, {}), _vgField(dimensionFieldDef, { - binSuffix: 'end' - })]; - } - - return [_vgField(dimensionFieldDef)]; - } - - return groupby !== null && groupby !== void 0 ? groupby : []; - } - }, { - key: "assemble", - value: function assemble() { - var transform = []; - var _this$_stack2 = this._stack, - facetby = _this$_stack2.facetby, - dimensionFieldDef = _this$_stack2.dimensionFieldDef, - field = _this$_stack2.stackField, - stackby = _this$_stack2.stackby, - sort = _this$_stack2.sort, - offset = _this$_stack2.offset, - impute = _this$_stack2.impute, - as = _this$_stack2.as; // Impute - - if (impute && dimensionFieldDef) { - var _dimensionFieldDef$ba = dimensionFieldDef.band, - band = _dimensionFieldDef$ba === void 0 ? 0.5 : _dimensionFieldDef$ba, - bin = dimensionFieldDef.bin; - - if (bin) { - // As we can only impute one field at a time, we need to calculate - // mid point for a binned field - transform.push({ - type: 'formula', - expr: "".concat(band, "*") + _vgField(dimensionFieldDef, { - expr: 'datum' - }) + "+".concat(1 - band, "*") + _vgField(dimensionFieldDef, { - expr: 'datum', - binSuffix: 'end' - }), - as: _vgField(dimensionFieldDef, { - binSuffix: 'mid', - forAs: true - }) - }); - } - - transform.push({ - type: 'impute', - field: field, - groupby: [].concat(_toConsumableArray(stackby), _toConsumableArray(facetby)), - key: _vgField(dimensionFieldDef, { - binSuffix: 'mid' - }), - method: 'value', - value: 0 - }); - } // Stack - - - transform.push({ - type: 'stack', - groupby: [].concat(_toConsumableArray(this.getGroupbyFields()), _toConsumableArray(facetby)), - field: field, - sort: sort, - as: as, - offset: offset - }); - return transform; - } - }, { - key: "stack", - get: function get() { - return this._stack; - } - }], [{ - key: "makeFromTransform", - value: function makeFromTransform(parent, stackTransform) { - var stack = stackTransform.stack, - groupby = stackTransform.groupby, - as = stackTransform.as, - _stackTransform$offse = stackTransform.offset, - offset = _stackTransform$offse === void 0 ? 'zero' : _stackTransform$offse; - var sortFields = []; - var sortOrder = []; - - if (stackTransform.sort !== undefined) { - var _iterator115 = _createForOfIteratorHelper(stackTransform.sort), - _step115; - - try { - for (_iterator115.s(); !(_step115 = _iterator115.n()).done;) { - var sortField = _step115.value; - sortFields.push(sortField.field); - sortOrder.push(getFirstDefined(sortField.order, 'ascending')); - } - } catch (err) { - _iterator115.e(err); - } finally { - _iterator115.f(); - } - } - - var sort = { - field: sortFields, - order: sortOrder - }; - var normalizedAs; - - if (isValidAsArray(as)) { - normalizedAs = as; - } else if (isString(as)) { - normalizedAs = [as, as + '_end']; - } else { - normalizedAs = [stackTransform.stack + '_start', stackTransform.stack + '_end']; - } - - return new StackNode(parent, { - stackField: stack, - groupby: groupby, - offset: offset, - sort: sort, - facetby: [], - as: normalizedAs - }); - } - }, { - key: "makeFromEncoding", - value: function makeFromEncoding(parent, model) { - var stackProperties = model.stack; - var encoding = model.encoding; - - if (!stackProperties) { - return null; - } - - var groupbyChannel = stackProperties.groupbyChannel, - fieldChannel = stackProperties.fieldChannel, - offset = stackProperties.offset, - impute = stackProperties.impute; - var dimensionFieldDef; - - if (groupbyChannel) { - var cDef = encoding[groupbyChannel]; - dimensionFieldDef = getFieldDef(cDef); // Fair to cast as groupByChannel is always either x or y - } - - var stackby = getStackByFields(model); - var orderDef = model.encoding.order; - var sort; - - if (isArray(orderDef) || isFieldDef(orderDef)) { - sort = sortParams(orderDef); - } else { - // default = descending by stackFields - // FIXME is the default here correct for binned fields? - sort = stackby.reduce(function (s, field) { - s.field.push(field); - s.order.push(fieldChannel === 'y' ? 'descending' : 'ascending'); - return s; - }, { - field: [], - order: [] - }); - } - - return new StackNode(parent, { - dimensionFieldDef: dimensionFieldDef, - stackField: model.vgField(fieldChannel), - facetby: [], - stackby: stackby, - sort: sort, - offset: offset, - impute: impute, - as: [model.vgField(fieldChannel, { - suffix: 'start', - forAs: true - }), model.vgField(fieldChannel, { - suffix: 'end', - forAs: true - })] - }); - } - }]); - - return StackNode; - }(DataFlowNode); - /** - * A class for the window transform nodes - */ - - - var WindowTransformNode = /*#__PURE__*/function (_DataFlowNode15) { - _inherits(WindowTransformNode, _DataFlowNode15); - - var _super21 = _createSuper(WindowTransformNode); - - function WindowTransformNode(parent, transform) { - var _this24; - - _classCallCheck(this, WindowTransformNode); - - _this24 = _super21.call(this, parent); - _this24.transform = transform; - return _this24; - } - - _createClass(WindowTransformNode, [{ - key: "clone", - value: function clone() { - return new WindowTransformNode(null, duplicate(this.transform)); - } - }, { - key: "addDimensions", - value: function addDimensions(fields) { - this.transform.groupby = unique(this.transform.groupby.concat(fields), function (d) { - return d; - }); - } - }, { - key: "dependentFields", - value: function dependentFields() { - var _a, _b; - - var out = new Set(); - ((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []).forEach(out.add, out); - ((_b = this.transform.sort) !== null && _b !== void 0 ? _b : []).forEach(function (m) { - return out.add(m.field); - }); - this.transform.window.map(function (w) { - return w.field; - }).filter(function (f) { - return f !== undefined; - }).forEach(out.add, out); - return out; - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.transform.window.map(this.getDefaultName)); - } - }, { - key: "getDefaultName", - value: function getDefaultName(windowFieldDef) { - var _a; - - return (_a = windowFieldDef.as) !== null && _a !== void 0 ? _a : _vgField(windowFieldDef); - } - }, { - key: "hash", - value: function hash() { - return "WindowTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var _a; - - var fields = []; - var ops = []; - var as = []; - var params = []; - - var _iterator116 = _createForOfIteratorHelper(this.transform.window), - _step116; - - try { - for (_iterator116.s(); !(_step116 = _iterator116.n()).done;) { - var window = _step116.value; - ops.push(window.op); - as.push(this.getDefaultName(window)); - params.push(window.param === undefined ? null : window.param); - fields.push(window.field === undefined ? null : window.field); - } - } catch (err) { - _iterator116.e(err); - } finally { - _iterator116.f(); - } - - var frame = this.transform.frame; - var groupby = this.transform.groupby; - - if (frame && frame[0] === null && frame[1] === null && ops.every(function (o) { - return isAggregateOp(o); - })) { - // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate - return Object.assign({ - type: 'joinaggregate', - as: as, - ops: ops, - fields: fields - }, groupby !== undefined ? { - groupby: groupby - } : {}); - } - - var sortFields = []; - var sortOrder = []; - - if (this.transform.sort !== undefined) { - var _iterator117 = _createForOfIteratorHelper(this.transform.sort), - _step117; - - try { - for (_iterator117.s(); !(_step117 = _iterator117.n()).done;) { - var sortField = _step117.value; - sortFields.push(sortField.field); - sortOrder.push((_a = sortField.order) !== null && _a !== void 0 ? _a : 'ascending'); - } - } catch (err) { - _iterator117.e(err); - } finally { - _iterator117.f(); - } - } - - var sort = { - field: sortFields, - order: sortOrder - }; - var ignorePeers = this.transform.ignorePeers; - return Object.assign(Object.assign(Object.assign({ - type: 'window', - params: params, - as: as, - ops: ops, - fields: fields, - sort: sort - }, ignorePeers !== undefined ? { - ignorePeers: ignorePeers - } : {}), groupby !== undefined ? { - groupby: groupby - } : {}), frame !== undefined ? { - frame: frame - } : {}); - } - }]); - - return WindowTransformNode; - }(DataFlowNode); - /** - * Move parse nodes up to forks. - */ - - - var MoveParseUp = /*#__PURE__*/function (_BottomUpOptimizer) { - _inherits(MoveParseUp, _BottomUpOptimizer); - - var _super22 = _createSuper(MoveParseUp); - - function MoveParseUp() { - _classCallCheck(this, MoveParseUp); - - return _super22.apply(this, arguments); - } - - _createClass(MoveParseUp, [{ - key: "run", - value: function run(node) { - var parent = node.parent; // Move parse up by merging or swapping. - - if (node instanceof ParseNode) { - if (isDataSourceNode(parent)) { - return this.flags; - } - - if (parent.numChildren() > 1) { - // Don't move parse further up but continue with parent. - this.setContinue(); - return this.flags; - } - - if (parent instanceof ParseNode) { - this.setMutated(); - parent.merge(node); - } else { - // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup). - if (fieldIntersection(parent.producedFields(), node.dependentFields())) { - this.setContinue(); - return this.flags; - } - - this.setMutated(); - node.swapWithParent(); - } - } - - this.setContinue(); - return this.flags; - } - }]); - - return MoveParseUp; - }(BottomUpOptimizer); - /** - * Merge identical nodes at forks by comparing hashes. - * - * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler. - */ - - - var MergeIdenticalNodes = /*#__PURE__*/function (_TopDownOptimizer) { - _inherits(MergeIdenticalNodes, _TopDownOptimizer); - - var _super23 = _createSuper(MergeIdenticalNodes); - - function MergeIdenticalNodes() { - _classCallCheck(this, MergeIdenticalNodes); - - return _super23.apply(this, arguments); - } - - _createClass(MergeIdenticalNodes, [{ - key: "mergeNodes", - value: function mergeNodes(parent, nodes) { - var mergedNode = nodes.shift(); - - var _iterator118 = _createForOfIteratorHelper(nodes), - _step118; - - try { - for (_iterator118.s(); !(_step118 = _iterator118.n()).done;) { - var node = _step118.value; - parent.removeChild(node); - node.parent = mergedNode; - node.remove(); - } - } catch (err) { - _iterator118.e(err); - } finally { - _iterator118.f(); - } - } - }, { - key: "run", - value: function run(node) { - var hashes = node.children.map(function (x) { - return x.hash(); - }); - var buckets = {}; - - for (var i = 0; i < hashes.length; i++) { - if (buckets[hashes[i]] === undefined) { - buckets[hashes[i]] = [node.children[i]]; - } else { - buckets[hashes[i]].push(node.children[i]); - } - } - - var _iterator119 = _createForOfIteratorHelper(keys(buckets)), - _step119; - - try { - for (_iterator119.s(); !(_step119 = _iterator119.n()).done;) { - var k = _step119.value; - - if (buckets[k].length > 1) { - this.setMutated(); - this.mergeNodes(node, buckets[k]); - } - } - } catch (err) { - _iterator119.e(err); - } finally { - _iterator119.f(); - } - - var _iterator120 = _createForOfIteratorHelper(node.children), - _step120; - - try { - for (_iterator120.s(); !(_step120 = _iterator120.n()).done;) { - var child = _step120.value; - this.run(child); - } - } catch (err) { - _iterator120.e(err); - } finally { - _iterator120.f(); - } - - return this.mutatedFlag; - } - }]); - - return MergeIdenticalNodes; - }(TopDownOptimizer); - /** - * Repeatedly remove leaf nodes that are not output or facet nodes. - * The reason is that we don't need subtrees that don't have any output nodes. - * Facet nodes are needed for the row or column domains. - */ - - - var RemoveUnusedSubtrees = /*#__PURE__*/function (_BottomUpOptimizer2) { - _inherits(RemoveUnusedSubtrees, _BottomUpOptimizer2); - - var _super24 = _createSuper(RemoveUnusedSubtrees); - - function RemoveUnusedSubtrees() { - _classCallCheck(this, RemoveUnusedSubtrees); - - return _super24.apply(this, arguments); - } - - _createClass(RemoveUnusedSubtrees, [{ - key: "run", - value: function run(node) { - if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) { - // no need to continue with parent because it is output node or will have children (there was a fork) - return this.flags; - } else { - this.setMutated(); - node.remove(); - } - - return this.flags; - } - }]); - - return RemoveUnusedSubtrees; - }(BottomUpOptimizer); - /** - * Removes duplicate time unit nodes (as determined by the name of the - * output field) that may be generated due to selections projected over - * time units. - * - * TODO: Try to make this a top down optimizer that keeps only the first - * insance of a time unit node. - * TODO: Try to make a generic version of this that only keeps one node per hash. - */ - - - var RemoveDuplicateTimeUnits = /*#__PURE__*/function (_BottomUpOptimizer3) { - _inherits(RemoveDuplicateTimeUnits, _BottomUpOptimizer3); - - var _super25 = _createSuper(RemoveDuplicateTimeUnits); - - function RemoveDuplicateTimeUnits() { - var _this25; - - _classCallCheck(this, RemoveDuplicateTimeUnits); - - _this25 = _super25.apply(this, arguments); - _this25.fields = new Set(); - _this25.prev = null; - return _this25; - } - - _createClass(RemoveDuplicateTimeUnits, [{ - key: "run", - value: function run(node) { - this.setContinue(); - - if (node instanceof TimeUnitNode) { - var pfields = node.producedFields(); - - if (hasIntersection(pfields, this.fields)) { - this.setMutated(); - this.prev.remove(); - } else { - this.fields = new Set([].concat(_toConsumableArray(this.fields), _toConsumableArray(pfields))); - } - - this.prev = node; - } - - return this.flags; - } - }, { - key: "reset", - value: function reset() { - this.fields.clear(); - } - }]); - - return RemoveDuplicateTimeUnits; - }(BottomUpOptimizer); - /** - * Merge adjacent time unit nodes. - */ - - - var MergeTimeUnits = /*#__PURE__*/function (_BottomUpOptimizer4) { - _inherits(MergeTimeUnits, _BottomUpOptimizer4); - - var _super26 = _createSuper(MergeTimeUnits); - - function MergeTimeUnits() { - _classCallCheck(this, MergeTimeUnits); - - return _super26.apply(this, arguments); - } - - _createClass(MergeTimeUnits, [{ - key: "run", - value: function run(node) { - this.setContinue(); - var parent = node.parent; - var timeUnitChildren = parent.children.filter(function (x) { - return x instanceof TimeUnitNode; - }); - var combination = timeUnitChildren.pop(); - - var _iterator121 = _createForOfIteratorHelper(timeUnitChildren), - _step121; - - try { - for (_iterator121.s(); !(_step121 = _iterator121.n()).done;) { - var timeUnit = _step121.value; - this.setMutated(); - combination.merge(timeUnit); - } - } catch (err) { - _iterator121.e(err); - } finally { - _iterator121.f(); - } - - return this.flags; - } - }]); - - return MergeTimeUnits; - }(BottomUpOptimizer); - /** - * Clones the subtree and ignores output nodes except for the leaves, which are renamed. - */ - - - function cloneSubtree(facet) { - function clone(node) { - if (!(node instanceof FacetNode)) { - var copy = node.clone(); - - if (copy instanceof OutputNode) { - var newName = FACET_SCALE_PREFIX + copy.getSource(); - copy.setSource(newName); - facet.model.component.data.outputNodes[newName] = copy; - } else if (copy instanceof AggregateNode || copy instanceof StackNode || copy instanceof WindowTransformNode || copy instanceof JoinAggregateTransformNode) { - copy.addDimensions(facet.fields); - } - - var _iterator122 = _createForOfIteratorHelper(node.children.flatMap(clone)), - _step122; - - try { - for (_iterator122.s(); !(_step122 = _iterator122.n()).done;) { - var n = _step122.value; - n.parent = copy; - } - } catch (err) { - _iterator122.e(err); - } finally { - _iterator122.f(); - } - - return [copy]; - } - - return node.children.flatMap(clone); - } - - return clone; - } - /** - * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node. - * After moving down the facet node, make a copy of the subtree and make it a child of the main output. - */ - - - function moveFacetDown(node) { - if (node instanceof FacetNode) { - if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) { - // move down until we hit a fork or output node - var child = node.children[0]; - - if (child instanceof AggregateNode || child instanceof StackNode || child instanceof WindowTransformNode || child instanceof JoinAggregateTransformNode) { - child.addDimensions(node.fields); - } - - child.swapWithParent(); - moveFacetDown(node); - } else { - // move main to facet - var facetMain = node.model.component.data.main; - moveMainDownToFacet(facetMain); // replicate the subtree and place it before the facet's main node - - var cloner = cloneSubtree(node); - var copy = node.children.map(cloner).flat(); - - var _iterator123 = _createForOfIteratorHelper(copy), - _step123; - - try { - for (_iterator123.s(); !(_step123 = _iterator123.n()).done;) { - var c = _step123.value; - c.parent = facetMain; - } - } catch (err) { - _iterator123.e(err); - } finally { - _iterator123.f(); - } - } - } else { - node.children.map(moveFacetDown); - } - } - - function moveMainDownToFacet(node) { - if (node instanceof OutputNode && node.type === DataSourceType.Main) { - if (node.numChildren() === 1) { - var child = node.children[0]; - - if (!(child instanceof FacetNode)) { - child.swapWithParent(); - moveMainDownToFacet(node); - } - } - } - } - /** - * Remove output nodes that are not required. Starting from a root. - */ - - - var RemoveUnnecessaryOutputNodes = /*#__PURE__*/function (_TopDownOptimizer2) { - _inherits(RemoveUnnecessaryOutputNodes, _TopDownOptimizer2); - - var _super27 = _createSuper(RemoveUnnecessaryOutputNodes); - - function RemoveUnnecessaryOutputNodes() { - _classCallCheck(this, RemoveUnnecessaryOutputNodes); - - return _super27.call(this); - } - - _createClass(RemoveUnnecessaryOutputNodes, [{ - key: "run", - value: function run(node) { - if (node instanceof OutputNode && !node.isRequired()) { - this.setMutated(); - node.remove(); - } - - var _iterator124 = _createForOfIteratorHelper(node.children), - _step124; - - try { - for (_iterator124.s(); !(_step124 = _iterator124.n()).done;) { - var child = _step124.value; - this.run(child); - } - } catch (err) { - _iterator124.e(err); - } finally { - _iterator124.f(); - } - - return this.mutatedFlag; - } - }]); - - return RemoveUnnecessaryOutputNodes; - }(TopDownOptimizer); - - var RemoveUnnecessaryIdentifierNodes = /*#__PURE__*/function (_TopDownOptimizer3) { - _inherits(RemoveUnnecessaryIdentifierNodes, _TopDownOptimizer3); - - var _super28 = _createSuper(RemoveUnnecessaryIdentifierNodes); - - function RemoveUnnecessaryIdentifierNodes(model) { - var _this26; - - _classCallCheck(this, RemoveUnnecessaryIdentifierNodes); - - _this26 = _super28.call(this); - _this26.requiresSelectionId = model && requiresSelectionId(model); - return _this26; - } - - _createClass(RemoveUnnecessaryIdentifierNodes, [{ - key: "run", - value: function run(node) { - if (node instanceof IdentifierNode) { - // Only preserve IdentifierNodes if we have default discrete selections - // in our model tree, and if the nodes come after tuple producing nodes. - if (!(this.requiresSelectionId && (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode))) { - this.setMutated(); - node.remove(); - } - } - - var _iterator125 = _createForOfIteratorHelper(node.children), - _step125; - - try { - for (_iterator125.s(); !(_step125 = _iterator125.n()).done;) { - var child = _step125.value; - this.run(child); - } - } catch (err) { - _iterator125.e(err); - } finally { - _iterator125.f(); - } - - return this.mutatedFlag; - } - }]); - - return RemoveUnnecessaryIdentifierNodes; - }(TopDownOptimizer); - /** - * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes. - * - * We assume that dependent paths that do not have a parse node can be just merged. - */ - - - var MergeParse = /*#__PURE__*/function (_BottomUpOptimizer5) { - _inherits(MergeParse, _BottomUpOptimizer5); - - var _super29 = _createSuper(MergeParse); - - function MergeParse() { - _classCallCheck(this, MergeParse); - - return _super29.apply(this, arguments); - } - - _createClass(MergeParse, [{ - key: "run", - value: function run(node) { - var parent = node.parent; - - var originalChildren = _toConsumableArray(parent.children); - - var parseChildren = parent.children.filter(function (child) { - return child instanceof ParseNode; - }); - - if (parent.numChildren() > 1 && parseChildren.length >= 1) { - var commonParse = {}; - var conflictingParse = new Set(); - - var _iterator126 = _createForOfIteratorHelper(parseChildren), - _step126; - - try { - for (_iterator126.s(); !(_step126 = _iterator126.n()).done;) { - var parseNode = _step126.value; - var _parse = parseNode.parse; - - var _iterator130 = _createForOfIteratorHelper(keys(_parse)), - _step130; - - try { - for (_iterator130.s(); !(_step130 = _iterator130.n()).done;) { - var k = _step130.value; - - if (!(k in commonParse)) { - commonParse[k] = _parse[k]; - } else if (commonParse[k] !== _parse[k]) { - conflictingParse.add(k); - } - } - } catch (err) { - _iterator130.e(err); - } finally { - _iterator130.f(); - } - } - } catch (err) { - _iterator126.e(err); - } finally { - _iterator126.f(); - } - - var _iterator127 = _createForOfIteratorHelper(conflictingParse), - _step127; - - try { - for (_iterator127.s(); !(_step127 = _iterator127.n()).done;) { - var _field18 = _step127.value; - delete commonParse[_field18]; - } - } catch (err) { - _iterator127.e(err); - } finally { - _iterator127.f(); - } - - if (!isEmpty(commonParse)) { - this.setMutated(); - var mergedParseNode = new ParseNode(parent, commonParse); - - var _iterator128 = _createForOfIteratorHelper(originalChildren), - _step128; - - try { - for (_iterator128.s(); !(_step128 = _iterator128.n()).done;) { - var childNode = _step128.value; - - if (childNode instanceof ParseNode) { - var _iterator129 = _createForOfIteratorHelper(keys(commonParse)), - _step129; - - try { - for (_iterator129.s(); !(_step129 = _iterator129.n()).done;) { - var key = _step129.value; - delete childNode.parse[key]; - } - } catch (err) { - _iterator129.e(err); - } finally { - _iterator129.f(); - } - } - - parent.removeChild(childNode); - childNode.parent = mergedParseNode; // remove empty parse nodes - - if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) { - childNode.remove(); - } - } - } catch (err) { - _iterator128.e(err); - } finally { - _iterator128.f(); - } - } - } - - this.setContinue(); - return this.flags; - } - }]); - - return MergeParse; - }(BottomUpOptimizer); - - var MergeAggregates = /*#__PURE__*/function (_BottomUpOptimizer6) { - _inherits(MergeAggregates, _BottomUpOptimizer6); - - var _super30 = _createSuper(MergeAggregates); - - function MergeAggregates() { - _classCallCheck(this, MergeAggregates); - - return _super30.apply(this, arguments); - } - - _createClass(MergeAggregates, [{ - key: "run", - value: function run(node) { - var parent = node.parent; - var aggChildren = parent.children.filter(function (child) { - return child instanceof AggregateNode; - }); // Object which we'll use to map the fields which an aggregate is grouped by to - // the set of aggregates with that grouping. This is useful as only aggregates - // with the same group by can be merged - - var groupedAggregates = {}; // Build groupedAggregates - - var _iterator131 = _createForOfIteratorHelper(aggChildren), - _step131; - - try { - for (_iterator131.s(); !(_step131 = _iterator131.n()).done;) { - var agg = _step131.value; - - var groupBys = _hash(agg.groupBy); - - if (!(groupBys in groupedAggregates)) { - groupedAggregates[groupBys] = []; - } - - groupedAggregates[groupBys].push(agg); - } // Merge aggregateNodes with same key in groupedAggregates - - } catch (err) { - _iterator131.e(err); - } finally { - _iterator131.f(); - } - - var _iterator132 = _createForOfIteratorHelper(keys(groupedAggregates)), - _step132; - - try { - for (_iterator132.s(); !(_step132 = _iterator132.n()).done;) { - var group = _step132.value; - var mergeableAggs = groupedAggregates[group]; - - if (mergeableAggs.length > 1) { - var mergedAggs = mergeableAggs.pop(); - - var _iterator133 = _createForOfIteratorHelper(mergeableAggs), - _step133; - - try { - for (_iterator133.s(); !(_step133 = _iterator133.n()).done;) { - var _agg = _step133.value; - - if (mergedAggs.merge(_agg)) { - parent.removeChild(_agg); - _agg.parent = mergedAggs; - - _agg.remove(); - - this.setMutated(); - } - } - } catch (err) { - _iterator133.e(err); - } finally { - _iterator133.f(); - } - } - } - } catch (err) { - _iterator132.e(err); - } finally { - _iterator132.f(); - } - - this.setContinue(); - return this.flags; - } - }]); - - return MergeAggregates; - }(BottomUpOptimizer); - /** - * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node. - */ - - - var MergeBins = /*#__PURE__*/function (_BottomUpOptimizer7) { - _inherits(MergeBins, _BottomUpOptimizer7); - - var _super31 = _createSuper(MergeBins); - - function MergeBins(model) { - var _this27; - - _classCallCheck(this, MergeBins); - - _this27 = _super31.call(this); - _this27.model = model; - return _this27; - } - - _createClass(MergeBins, [{ - key: "run", - value: function run(node) { - var parent = node.parent; - var moveBinsUp = !(isDataSourceNode(parent) || parent instanceof FilterNode || parent instanceof ParseNode || parent instanceof IdentifierNode); - var promotableBins = []; - var remainingBins = []; - - var _iterator134 = _createForOfIteratorHelper(parent.children), - _step134; - - try { - for (_iterator134.s(); !(_step134 = _iterator134.n()).done;) { - var child = _step134.value; - - if (child instanceof BinNode) { - if (moveBinsUp && !fieldIntersection(parent.producedFields(), child.dependentFields())) { - promotableBins.push(child); - } else { - remainingBins.push(child); - } - } - } - } catch (err) { - _iterator134.e(err); - } finally { - _iterator134.f(); - } - - if (promotableBins.length > 0) { - var promotedBin = promotableBins.pop(); - - var _iterator135 = _createForOfIteratorHelper(promotableBins), - _step135; - - try { - for (_iterator135.s(); !(_step135 = _iterator135.n()).done;) { - var bin = _step135.value; - promotedBin.merge(bin, this.model.renameSignal.bind(this.model)); - } - } catch (err) { - _iterator135.e(err); - } finally { - _iterator135.f(); - } - - this.setMutated(); - - if (parent instanceof BinNode) { - parent.merge(promotedBin, this.model.renameSignal.bind(this.model)); - } else { - promotedBin.swapWithParent(); - } - } - - if (remainingBins.length > 1) { - var remainingBin = remainingBins.pop(); - - var _iterator136 = _createForOfIteratorHelper(remainingBins), - _step136; - - try { - for (_iterator136.s(); !(_step136 = _iterator136.n()).done;) { - var _bin = _step136.value; - remainingBin.merge(_bin, this.model.renameSignal.bind(this.model)); - } - } catch (err) { - _iterator136.e(err); - } finally { - _iterator136.f(); - } - - this.setMutated(); - } - - this.setContinue(); - return this.flags; - } - }]); - - return MergeBins; - }(BottomUpOptimizer); - /** - * This optimizer takes output nodes that are at a fork and moves them before the fork. - * - * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes. - * It then moves all output nodes before that main output node. All other children (and the children of the output nodes) - * are inserted after the main output node. - */ - - - var MergeOutputs = /*#__PURE__*/function (_BottomUpOptimizer8) { - _inherits(MergeOutputs, _BottomUpOptimizer8); - - var _super32 = _createSuper(MergeOutputs); - - function MergeOutputs() { - _classCallCheck(this, MergeOutputs); - - return _super32.apply(this, arguments); - } - - _createClass(MergeOutputs, [{ - key: "run", - value: function run(node) { - var parent = node.parent; - - var children = _toConsumableArray(parent.children); - - var hasOutputChild = some(children, function (child) { - return child instanceof OutputNode; - }); - - if (!hasOutputChild || parent.numChildren() <= 1) { - this.setContinue(); - return this.flags; - } - - var otherChildren = []; // The output node we will connect all other nodes to. - // Output nodes will be added before the new node, other nodes after. - - var mainOutput; - - var _iterator137 = _createForOfIteratorHelper(children), - _step137; - - try { - for (_iterator137.s(); !(_step137 = _iterator137.n()).done;) { - var _child3 = _step137.value; - - if (_child3 instanceof OutputNode) { - var lastOutput = _child3; - - while (lastOutput.numChildren() === 1) { - var _lastOutput$children = _slicedToArray(lastOutput.children, 1), - theChild = _lastOutput$children[0]; - - if (theChild instanceof OutputNode) { - lastOutput = theChild; - } else { - break; - } - } - - otherChildren.push.apply(otherChildren, _toConsumableArray(lastOutput.children)); - - if (mainOutput) { - // Move the output nodes before the mainOutput. We do this by setting - // the parent of the first not to the parent of the main output and - // the main output's parent to the last output. - // note: the child is the first output - parent.removeChild(_child3); - _child3.parent = mainOutput.parent; - mainOutput.parent.removeChild(mainOutput); - mainOutput.parent = lastOutput; - this.setMutated(); - } else { - mainOutput = lastOutput; - } - } else { - otherChildren.push(_child3); - } - } - } catch (err) { - _iterator137.e(err); - } finally { - _iterator137.f(); - } - - if (otherChildren.length) { - this.setMutated(); - - var _iterator138 = _createForOfIteratorHelper(otherChildren), - _step138; - - try { - for (_iterator138.s(); !(_step138 = _iterator138.n()).done;) { - var child = _step138.value; - child.parent.removeChild(child); - child.parent = mainOutput; - } - } catch (err) { - _iterator138.e(err); - } finally { - _iterator138.f(); - } - } - - this.setContinue(); - return this.flags; - } - }]); - - return MergeOutputs; - }(BottomUpOptimizer); - - var FACET_SCALE_PREFIX = 'scale_'; - var MAX_OPTIMIZATION_RUNS = 5; - /** - * Iterates over a dataflow graph and checks whether all links are consistent. - */ - - function checkLinks(nodes) { - var _iterator139 = _createForOfIteratorHelper(nodes), - _step139; - - try { - for (_iterator139.s(); !(_step139 = _iterator139.n()).done;) { - var node = _step139.value; - - var _iterator140 = _createForOfIteratorHelper(node.children), - _step140; - - try { - for (_iterator140.s(); !(_step140 = _iterator140.n()).done;) { - var child = _step140.value; - - if (child.parent !== node) { - // log.error('Dataflow graph is inconsistent.', node, child); - return false; - } - } - } catch (err) { - _iterator140.e(err); - } finally { - _iterator140.f(); - } - - if (!checkLinks(node.children)) { - return false; - } - } - } catch (err) { - _iterator139.e(err); - } finally { - _iterator139.f(); - } - - return true; - } - /** - * Return all leaf nodes. - */ - - - function getLeaves(roots) { - var leaves = []; - - function append(node) { - if (node.numChildren() === 0) { - leaves.push(node); - } else { - var _iterator141 = _createForOfIteratorHelper(node.children), - _step141; - - try { - for (_iterator141.s(); !(_step141 = _iterator141.n()).done;) { - var child = _step141.value; - append(child); - } - } catch (err) { - _iterator141.e(err); - } finally { - _iterator141.f(); - } - } - } - - var _iterator142 = _createForOfIteratorHelper(roots), - _step142; - - try { - for (_iterator142.s(); !(_step142 = _iterator142.n()).done;) { - var child = _step142.value; - append(child); - } - } catch (err) { - _iterator142.e(err); - } finally { - _iterator142.f(); - } - - return leaves; - } - - function isTrue(x) { - return x; - } - /** - * Run the specified optimizer on the provided nodes. - * - * @param optimizer The optimizer instance to run. - * @param nodes A set of nodes to optimize. - * @param flag Flag that will be or'ed with return valued from optimization calls to the nodes. - */ - - - function runOptimizer(optimizer, nodes) { - var flags = nodes.map(function (node) { - if (optimizer instanceof BottomUpOptimizer) { - var runFlags = optimizer.optimizeNextFromLeaves(node); - optimizer.reset(); - return runFlags; - } else { - return optimizer.run(node); - } - }); - return flags.some(isTrue); - } - - function optimizationDataflowHelper(dataComponent, model, firstPass) { - var roots = dataComponent.sources; - var mutatedFlags = new Set(); - mutatedFlags.add(runOptimizer(new RemoveUnnecessaryOutputNodes(), roots)); - mutatedFlags.add(runOptimizer(new RemoveUnnecessaryIdentifierNodes(model), roots)); // remove source nodes that don't have any children because they also don't have output nodes - - roots = roots.filter(function (r) { - return r.numChildren() > 0; - }); - mutatedFlags.add(runOptimizer(new RemoveUnusedSubtrees(), getLeaves(roots))); - roots = roots.filter(function (r) { - return r.numChildren() > 0; - }); - - if (!firstPass) { - // Only run these optimizations after the optimizer has moved down the facet node. - // With this change, we can be more aggressive in the optimizations. - mutatedFlags.add(runOptimizer(new MoveParseUp(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeBins(model), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new RemoveDuplicateTimeUnits(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeParse(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeAggregates(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeTimeUnits(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeIdenticalNodes(), roots)); - mutatedFlags.add(runOptimizer(new MergeOutputs(), getLeaves(roots))); - } - - dataComponent.sources = roots; - return mutatedFlags.has(true); - } - /** - * Optimizes the dataflow of the passed in data component. - */ - - - function optimizeDataflow(data, model) { - // check before optimizations - checkLinks(data.sources); - var firstPassCounter = 0; - var secondPassCounter = 0; - - for (var i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { - if (!optimizationDataflowHelper(data, model, true)) { - break; - } - - firstPassCounter++; - } // move facets down and make a copy of the subtree so that we can have scales at the top level - - - data.sources.map(moveFacetDown); - - for (var _i14 = 0; _i14 < MAX_OPTIMIZATION_RUNS; _i14++) { - if (!optimizationDataflowHelper(data, model, false)) { - break; - } - - secondPassCounter++; - } // check after optimizations - - - checkLinks(data.sources); - - if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) { - warn("Maximum optimization runs(".concat(MAX_OPTIMIZATION_RUNS, ") reached.")); - } - } - /** - * A class that behaves like a SignalRef but lazily generates the signal. - * The provided generator function should use `Model.getSignalName` to use the correct signal name. - */ - - - var SignalRefWrapper = /*#__PURE__*/function () { - function SignalRefWrapper(exprGenerator) { - _classCallCheck(this, SignalRefWrapper); - - Object.defineProperty(this, 'signal', { - enumerable: true, - get: exprGenerator - }); - } - - _createClass(SignalRefWrapper, null, [{ - key: "fromName", - value: function fromName(rename, signalName) { - return new SignalRefWrapper(function () { - return rename(signalName); - }); - } - }]); - - return SignalRefWrapper; - }(); - - function parseScaleDomain(model) { - if (isUnitModel(model)) { - parseUnitScaleDomain(model); - } else { - parseNonUnitScaleDomain(model); - } - } - - function parseUnitScaleDomain(model) { - var localScaleComponents = model.component.scales; - - var _iterator143 = _createForOfIteratorHelper(keys(localScaleComponents)), - _step143; - - try { - for (_iterator143.s(); !(_step143 = _iterator143.n()).done;) { - var channel = _step143.value; - var domains = parseDomainForChannel(model, channel); - var localScaleCmpt = localScaleComponents[channel]; - localScaleCmpt.setWithExplicit('domains', domains); - parseSelectionDomain(model, channel); - - if (model.component.data.isFaceted) { - // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not - var facetParent = model; - - while (!isFacetModel(facetParent) && facetParent.parent) { - facetParent = facetParent.parent; - } - - var resolve = facetParent.component.resolve.scale[channel]; - - if (resolve === 'shared') { - var _iterator144 = _createForOfIteratorHelper(domains.value), - _step144; - - try { - for (_iterator144.s(); !(_step144 = _iterator144.n()).done;) { - var _domain2 = _step144.value; - - // Replace the scale domain with data output from a cloned subtree after the facet. - if (isDataRefDomain(_domain2)) { - // use data from cloned subtree (which is the same as data but with a prefix added once) - _domain2.data = FACET_SCALE_PREFIX + _domain2.data.replace(FACET_SCALE_PREFIX, ''); - } - } - } catch (err) { - _iterator144.e(err); - } finally { - _iterator144.f(); - } - } - } - } - } catch (err) { - _iterator143.e(err); - } finally { - _iterator143.f(); - } - } - - function parseNonUnitScaleDomain(model) { - var _iterator145 = _createForOfIteratorHelper(model.children), - _step145; - - try { - for (_iterator145.s(); !(_step145 = _iterator145.n()).done;) { - var child = _step145.value; - parseScaleDomain(child); - } - } catch (err) { - _iterator145.e(err); - } finally { - _iterator145.f(); - } - - var localScaleComponents = model.component.scales; - - var _iterator146 = _createForOfIteratorHelper(keys(localScaleComponents)), - _step146; - - try { - for (_iterator146.s(); !(_step146 = _iterator146.n()).done;) { - var channel = _step146.value; - var domains = void 0; - var selectionExtent = null; - - var _iterator147 = _createForOfIteratorHelper(model.children), - _step147; - - try { - for (_iterator147.s(); !(_step147 = _iterator147.n()).done;) { - var _child4 = _step147.value; - var childComponent = _child4.component.scales[channel]; - - if (childComponent) { - if (domains === undefined) { - domains = childComponent.getWithExplicit('domains'); - } else { - domains = mergeValuesWithExplicit(domains, childComponent.getWithExplicit('domains'), 'domains', 'scale', domainsTieBreaker); - } - - var se = childComponent.get('selectionExtent'); - - if (selectionExtent && se && selectionExtent.selection !== se.selection) { - warn(NEEDS_SAME_SELECTION); - } - - selectionExtent = se; - } - } - } catch (err) { - _iterator147.e(err); - } finally { - _iterator147.f(); - } - - localScaleComponents[channel].setWithExplicit('domains', domains); - - if (selectionExtent) { - localScaleComponents[channel].set('selectionExtent', selectionExtent, true); - } - } - } catch (err) { - _iterator146.e(err); - } finally { - _iterator146.f(); - } - } - /** - * Remove unaggregated domain if it is not applicable - * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true. - */ - - - function normalizeUnaggregatedDomain(domain, fieldDef, scaleType, scaleConfig) { - if (domain === 'unaggregated') { - var _canUseUnaggregatedDo = canUseUnaggregatedDomain(fieldDef, scaleType), - valid = _canUseUnaggregatedDo.valid, - reason = _canUseUnaggregatedDo.reason; - - if (!valid) { - warn(reason); - return undefined; - } - } else if (domain === undefined && scaleConfig.useUnaggregatedDomain) { - // Apply config if domain is not specified. - var _canUseUnaggregatedDo2 = canUseUnaggregatedDomain(fieldDef, scaleType), - _valid = _canUseUnaggregatedDo2.valid; - - if (_valid) { - return 'unaggregated'; - } - } - - return domain; - } - - function parseDomainForChannel(model, channel) { - var scaleType = model.getScaleComponent(channel).get('type'); - var encoding = model.encoding; - var domain = normalizeUnaggregatedDomain(model.scaleDomain(channel), model.typedFieldDef(channel), scaleType, model.config.scale); - - if (domain !== model.scaleDomain(channel)) { - model.specifiedScales[channel] = Object.assign(Object.assign({}, model.specifiedScales[channel]), { - domain: domain - }); - } // If channel is either X or Y then union them with X2 & Y2 if they exist - - - if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) { - if (getFieldOrDatumDef(encoding.x)) { - return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'x'), parseSingleChannelDomain(scaleType, domain, model, 'x2'), 'domain', 'scale', domainsTieBreaker); - } else { - return parseSingleChannelDomain(scaleType, domain, model, 'x2'); - } - } else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) { - if (getFieldOrDatumDef(encoding.y)) { - return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'y'), parseSingleChannelDomain(scaleType, domain, model, 'y2'), 'domain', 'scale', domainsTieBreaker); - } else { - return parseSingleChannelDomain(scaleType, domain, model, 'y2'); - } - } - - return parseSingleChannelDomain(scaleType, domain, model, channel); - } - - function mapDomainToDataSignal(domain, type, timeUnit) { - return domain.map(function (v) { - var data = valueExpr(v, { - timeUnit: timeUnit, - type: type - }); - return { - signal: "{data: ".concat(data, "}") - }; - }); - } - - function convertDomainIfItIsDateTime(domain, type, timeUnit) { - var _a; // explicit value - - - var normalizedTimeUnit = (_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit; - - if (type === 'temporal' || normalizedTimeUnit) { - return mapDomainToDataSignal(domain, type, normalizedTimeUnit); - } - - return [domain]; // Date time won't make sense - } - - function parseSingleChannelDomain(scaleType, domain, model, channel) { - var encoding = model.encoding; - var fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - var type = fieldOrDatumDef.type; - var timeUnit = fieldOrDatumDef['timeUnit']; - - if (isDomainUnionWith(domain)) { - var defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel); - var unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit); - return makeExplicit([].concat(_toConsumableArray(defaultDomain.value), _toConsumableArray(unionWith))); - } else if (isSignalRef(domain)) { - return makeExplicit([domain]); - } else if (domain && domain !== 'unaggregated' && !isSelectionDomain(domain)) { - return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit)); - } - - var stack = model.stack; - - if (stack && channel === stack.fieldChannel) { - if (stack.offset === 'normalize') { - return makeImplicit([[0, 1]]); - } - - var data = model.requestDataName(DataSourceType.Main); - return makeImplicit([{ - data: data, - field: model.vgField(channel, { - suffix: 'start' - }) - }, { - data: data, - field: model.vgField(channel, { - suffix: 'end' - }) - }]); - } - - var sort = isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined; - - if (isDatumDef(fieldOrDatumDef)) { - var d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit); - return makeImplicit(d); - } - - var fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef - - if (domain === 'unaggregated') { - var _data = model.requestDataName(DataSourceType.Main); - - var _field19 = fieldOrDatumDef.field; - return makeImplicit([{ - data: _data, - field: _vgField({ - field: _field19, - aggregate: 'min' - }) - }, { - data: _data, - field: _vgField({ - field: _field19, - aggregate: 'max' - }) - }]); - } else if (isBinning(fieldDef.bin)) { - if (hasDiscreteDomain(scaleType)) { - if (scaleType === 'bin-ordinal') { - // we can omit the domain as it is inferred from the `bins` property - return makeImplicit([]); - } // ordinal bin scale takes domain from bin_range, ordered by bin start - // This is useful for both axis-based scale (x/y) and legend-based scale (other channels). - - - return makeImplicit([{ - // If sort by aggregation of a specified sort field, we need to use RAW table, - // so we can aggregate values for the scale independently from the main aggregation. - data: isBoolean$1(sort) ? model.requestDataName(DataSourceType.Main) : model.requestDataName(DataSourceType.Raw), - // Use range if we added it and the scale does not support computing a range as a signal. - field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? { - binSuffix: 'range' - } : {}), - // we have to use a sort object if sort = true to make the sort correct by bin start - sort: sort === true || !isObject(sort) ? { - field: model.vgField(channel, {}), - op: 'min' // min or max doesn't matter since we sort by the start of the bin range - - } : sort - }]); - } else { - // continuous scales - var bin = fieldDef.bin; - - if (isBinning(bin)) { - var binSignal = getBinSignalName(model, fieldDef.field, bin); - return makeImplicit([new SignalRefWrapper(function () { - var signal = model.getSignalName(binSignal); - return "[".concat(signal, ".start, ").concat(signal, ".stop]"); - })]); - } else { - return makeImplicit([{ - data: model.requestDataName(DataSourceType.Main), - field: model.vgField(channel, {}) - }]); - } - } - } else if (fieldDef.timeUnit && contains(['time', 'utc'], scaleType) && hasBand(channel, fieldDef, isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined, model.stack, model.markDef, model.config)) { - var _data2 = model.requestDataName(DataSourceType.Main); - - return makeImplicit([{ - data: _data2, - field: model.vgField(channel) - }, { - data: _data2, - field: model.vgField(channel, { - suffix: 'end' - }) - }]); - } else if (sort) { - return makeImplicit([{ - // If sort by aggregation of a specified sort field, we need to use RAW table, - // so we can aggregate values for the scale independently from the main aggregation. - data: isBoolean$1(sort) ? model.requestDataName(DataSourceType.Main) : model.requestDataName(DataSourceType.Raw), - field: model.vgField(channel), - sort: sort - }]); - } else { - return makeImplicit([{ - data: model.requestDataName(DataSourceType.Main), - field: model.vgField(channel) - }]); - } - } - - function normalizeSortField(sort, isStackedMeasure) { - var op = sort.op, - field = sort.field, - order = sort.order; - return Object.assign(Object.assign({ - // Apply default op - op: op !== null && op !== void 0 ? op : isStackedMeasure ? 'sum' : DEFAULT_SORT_OP - }, field ? { - field: replacePathInField(field) - } : {}), order ? { - order: order - } : {}); - } - - function parseSelectionDomain(model, channel) { - var _a; - - var scale = model.component.scales[channel]; - var spec = model.specifiedScales[channel].domain; - var bin = (_a = model.fieldDef(channel)) === null || _a === void 0 ? void 0 : _a.bin; - var domain = isSelectionDomain(spec) && spec; - var extent = isBinParams(bin) && isSelectionExtent(bin.extent) && bin.extent; - - if (domain || extent) { - // As scale parsing occurs before selection parsing, we cannot set - // domainRaw directly. So instead, we store the selectionExtent on - // the scale component, and then add domainRaw during scale assembly. - scale.set('selectionExtent', domain !== null && domain !== void 0 ? domain : extent, true); - } - } - - function domainSort(model, channel, scaleType) { - if (!hasDiscreteDomain(scaleType)) { - return undefined; - } // save to cast as the only exception is the geojson type for shape, which would not generate a scale - - - var fieldDef = model.fieldDef(channel); - var sort = fieldDef.sort; // if the sort is specified with array, use the derived sort index field - - if (isSortArray(sort)) { - return { - op: 'min', - field: sortArrayIndexField(fieldDef, channel), - order: 'ascending' - }; - } - - var stack = model.stack; - var stackDimensions = stack ? [].concat(_toConsumableArray(stack.groupbyField ? [stack.groupbyField] : []), _toConsumableArray(stack.stackBy.map(function (s) { - return s.fieldDef.field; - }))) : undefined; // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale) - - if (isSortField(sort)) { - var isStackedMeasure = stack && !contains(stackDimensions, sort.field); - return normalizeSortField(sort, isStackedMeasure); - } else if (isSortByEncoding(sort)) { - var encoding = sort.encoding, - order = sort.order; - var fieldDefToSortBy = model.fieldDef(encoding); - var aggregate = fieldDefToSortBy.aggregate, - _field20 = fieldDefToSortBy.field; - - var _isStackedMeasure = stack && !contains(stackDimensions, _field20); - - if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { - return normalizeSortField({ - field: _vgField(fieldDefToSortBy), - order: order - }, _isStackedMeasure); - } else if (isAggregateOp(aggregate) || !aggregate) { - return normalizeSortField({ - op: aggregate, - field: _field20, - order: order - }, _isStackedMeasure); - } - } else if (sort === 'descending') { - return { - op: 'min', - field: model.vgField(channel), - order: 'descending' - }; - } else if (contains(['ascending', undefined - /* default =ascending*/ - ], sort)) { - return true; - } // sort == null - - - return undefined; - } - /** - * Determine if a scale can use unaggregated domain. - * @return {Boolean} Returns true if all of the following conditions apply: - * 1. `scale.domain` is `unaggregated` - * 2. Aggregation function is not `count` or `sum` - * 3. The scale is quantitative or time scale. - */ - - - function canUseUnaggregatedDomain(fieldDef, scaleType) { - var aggregate = fieldDef.aggregate, - type = fieldDef.type; - - if (!aggregate) { - return { - valid: false, - reason: unaggregateDomainHasNoEffectForRawField(fieldDef) - }; - } - - if (isString(aggregate) && !SHARED_DOMAIN_OP_INDEX[aggregate]) { - return { - valid: false, - reason: unaggregateDomainWithNonSharedDomainOp(aggregate) - }; - } - - if (type === 'quantitative') { - if (scaleType === 'log') { - return { - valid: false, - reason: unaggregatedDomainWithLogScale(fieldDef) - }; - } - } - - return { - valid: true - }; - } - /** - * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values. - */ - - - function domainsTieBreaker(v1, v2, property, propertyOf) { - if (v1.explicit && v2.explicit) { - warn(mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value)); - } // If equal score, concat the domains so that we union them later. - - - return { - explicit: v1.explicit, - value: [].concat(_toConsumableArray(v1.value), _toConsumableArray(v2.value)) - }; - } - /** - * Converts an array of domains to a single Vega scale domain. - */ - - - function mergeDomains(domains) { - var uniqueDomains = unique(domains.map(function (domain) { - // ignore sort property when computing the unique domains - if (isDataRefDomain(domain)) { - var domainWithoutSort = __rest(domain, ["sort"]); - - return domainWithoutSort; - } - - return domain; - }), _hash); - var sorts = unique(domains.map(function (d) { - if (isDataRefDomain(d)) { - var s = d.sort; - - if (s !== undefined && !isBoolean$1(s)) { - if ('op' in s && s.op === 'count') { - // let's make sure that if op is count, we don't use a field - delete s.field; - } - - if (s.order === 'ascending') { - // drop order: ascending as it is the default - delete s.order; - } - } - - return s; - } - - return undefined; - }).filter(function (s) { - return s !== undefined; - }), _hash); - - if (uniqueDomains.length === 0) { - return undefined; - } else if (uniqueDomains.length === 1) { - var _domain3 = domains[0]; - - if (isDataRefDomain(_domain3) && sorts.length > 0) { - var _sort = sorts[0]; - - if (sorts.length > 1) { - warn(MORE_THAN_ONE_SORT); - _sort = true; - } else { - // Simplify domain sort by removing field and op when the field is the same as the domain field. - if (isObject(_sort) && 'field' in _sort) { - var sortField = _sort.field; - - if (_domain3.field === sortField) { - _sort = _sort.order ? { - order: _sort.order - } : true; - } - } - } - - return Object.assign(Object.assign({}, _domain3), { - sort: _sort - }); - } - - return _domain3; - } // only keep sort properties that work with unioned domains - - - var unionDomainSorts = unique(sorts.map(function (s) { - if (isBoolean$1(s) || !('op' in s) || s.op in MULTIDOMAIN_SORT_OP_INDEX) { - return s; - } - - warn(domainSortDropped(s)); - return true; - }), _hash); - var sort; - - if (unionDomainSorts.length === 1) { - sort = unionDomainSorts[0]; - } else if (unionDomainSorts.length > 1) { - warn(MORE_THAN_ONE_SORT); - sort = true; - } - - var allData = unique(domains.map(function (d) { - if (isDataRefDomain(d)) { - return d.data; - } - - return null; - }), function (x) { - return x; - }); - - if (allData.length === 1 && allData[0] !== null) { - // create a union domain of different fields with a single data source - var _domain4 = Object.assign({ - data: allData[0], - fields: uniqueDomains.map(function (d) { - return d.field; - }) - }, sort ? { - sort: sort - } : {}); - - return _domain4; - } - - return Object.assign({ - fields: uniqueDomains - }, sort ? { - sort: sort - } : {}); - } - /** - * Return a field if a scale uses a single field. - * Return `undefined` otherwise. - */ - - - function getFieldFromDomain(domain) { - if (isDataRefDomain(domain) && isString(domain.field)) { - return domain.field; - } else if (isDataRefUnionedDomain(domain)) { - var _field21; - - var _iterator148 = _createForOfIteratorHelper(domain.fields), - _step148; - - try { - for (_iterator148.s(); !(_step148 = _iterator148.n()).done;) { - var nonUnionDomain = _step148.value; - - if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) { - if (!_field21) { - _field21 = nonUnionDomain.field; - } else if (_field21 !== nonUnionDomain.field) { - warn(FACETED_INDEPENDENT_DIFFERENT_SOURCES); - return _field21; - } - } - } - } catch (err) { - _iterator148.e(err); - } finally { - _iterator148.f(); - } - - warn(FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES); - return _field21; - } else if (isFieldRefUnionDomain(domain)) { - warn(FACETED_INDEPENDENT_SAME_SOURCE); - var _field22 = domain.fields[0]; - return isString(_field22) ? _field22 : undefined; - } - - return undefined; - } - - function assembleDomain(model, channel) { - var scaleComponent = model.component.scales[channel]; - var domains = scaleComponent.get('domains').map(function (domain) { - // Correct references to data as the original domain's data was determined - // in parseScale, which happens before parseData. Thus the original data - // reference can be incorrect. - if (isDataRefDomain(domain)) { - domain.data = model.lookupDataSource(domain.data); - } - - return domain; - }); // domains is an array that has to be merged into a single vega domain - - return mergeDomains(domains); - } - - function assembleScales(model) { - if (isLayerModel(model) || isConcatModel(model)) { - // For concat and layer, include scales of children too - return model.children.reduce(function (scales, child) { - return scales.concat(assembleScales(child)); - }, assembleScalesForModel(model)); - } else { - // For facet, child scales would not be included in the parent's scope. - // For unit, there is no child. - return assembleScalesForModel(model); - } - } - - function assembleScalesForModel(model) { - return keys(model.component.scales).reduce(function (scales, channel) { - var scaleComponent = model.component.scales[channel]; - - if (scaleComponent.merged) { - // Skipped merged scales - return scales; - } - - var scale = scaleComponent.combine(); - - var name = scale.name, - type = scale.type, - selectionExtent = scale.selectionExtent, - _d = scale.domains, - _r = scale.range, - reverse = scale.reverse, - otherScaleProps = __rest(scale, ["name", "type", "selectionExtent", "domains", "range", "reverse"]); - - var range = assembleScaleRange(scale.range, name, channel, model); - var domainRaw; - - if (selectionExtent) { - domainRaw = assembleSelectionScaleDomain(model, selectionExtent); - } - - var domain = assembleDomain(model, channel); - scales.push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ - name: name, - type: type - }, domain ? { - domain: domain - } : {}), domainRaw ? { - domainRaw: domainRaw - } : {}), { - range: range - }), reverse !== undefined ? { - reverse: reverse - } : {}), otherScaleProps)); - return scales; - }, []); - } - - function assembleScaleRange(scaleRange, scaleName, channel, model) { - // add signals to x/y range - if (isXorY(channel)) { - if (isVgRangeStep(scaleRange)) { - // For width/height step, use a signal created in layout assemble instead of a constant step. - return { - step: { - signal: scaleName + '_step' - } - }; - } - } else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) { - return Object.assign(Object.assign({}, scaleRange), { - data: model.lookupDataSource(scaleRange.data) - }); - } - - return scaleRange; - } - - var ScaleComponent = /*#__PURE__*/function (_Split4) { - _inherits(ScaleComponent, _Split4); - - var _super33 = _createSuper(ScaleComponent); - - function ScaleComponent(name, typeWithExplicit) { - var _this28; - - _classCallCheck(this, ScaleComponent); - - _this28 = _super33.call(this, {}, // no initial explicit property - { - name: name - } // name as initial implicit property - ); - _this28.merged = false; - - _this28.setWithExplicit('type', typeWithExplicit); - - return _this28; - } - /** - * Whether the scale definitely includes zero in the domain - */ - - - _createClass(ScaleComponent, [{ - key: "domainDefinitelyIncludesZero", - value: function domainDefinitelyIncludesZero() { - if (this.get('zero') !== false) { - return true; - } - - return some(this.get('domains'), function (d) { - return isArray(d) && d.length === 2 && d[0] <= 0 && d[1] >= 0; - }); - } - }]); - - return ScaleComponent; - }(Split); - - var RANGE_PROPERTIES = ['range', 'scheme']; - - function getSizeChannel$1(channel) { - return channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; - } - - function parseUnitScaleRange(model) { - var localScaleComponents = model.component.scales; // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first! - - var _iterator149 = _createForOfIteratorHelper(SCALE_CHANNELS), - _step149; - - try { - for (_iterator149.s(); !(_step149 = _iterator149.n()).done;) { - var channel = _step149.value; - var localScaleCmpt = localScaleComponents[channel]; - - if (!localScaleCmpt) { - continue; - } - - var rangeWithExplicit = parseRangeForChannel(channel, model); - localScaleCmpt.setWithExplicit('range', rangeWithExplicit); - } - } catch (err) { - _iterator149.e(err); - } finally { - _iterator149.f(); - } - } - - function getBinStepSignal(model, channel) { - var fieldDef = model.fieldDef(channel); - - if (fieldDef && fieldDef.bin && isBinning(fieldDef.bin)) { - var binSignal = getBinSignalName(model, fieldDef.field, fieldDef.bin); // TODO: extract this to be range step signal - - var sizeType = getSizeChannel$1(channel); - var sizeSignal = model.getName(sizeType); - return new SignalRefWrapper(function () { - var updatedName = model.getSignalName(binSignal); - var binCount = "(".concat(updatedName, ".stop - ").concat(updatedName, ".start) / ").concat(updatedName, ".step"); - return "".concat(model.getSignalName(sizeSignal), " / (").concat(binCount, ")"); - }); - } - - return undefined; - } - /** - * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme). - */ - - - function parseRangeForChannel(channel, model) { - var specifiedScale = model.specifiedScales[channel]; - var size = model.size; - var mergedScaleCmpt = model.getScaleComponent(channel); - var scaleType = mergedScaleCmpt.get('type'); // Check if any of the range properties is specified. - // If so, check if it is compatible and make sure that we only output one of the properties - - var _iterator150 = _createForOfIteratorHelper(RANGE_PROPERTIES), - _step150; - - try { - for (_iterator150.s(); !(_step150 = _iterator150.n()).done;) { - var property = _step150.value; - - if (specifiedScale[property] !== undefined) { - var supportedByScaleType = scaleTypeSupportProperty(scaleType, property); - var channelIncompatability = channelScalePropertyIncompatability(channel, property); - - if (!supportedByScaleType) { - warn(scalePropertyNotWorkWithScaleType(scaleType, property, channel)); - } else if (channelIncompatability) { - // channel - warn(channelIncompatability); - } else { - switch (property) { - case 'range': - { - var range = specifiedScale.range; - - if (isArray(range)) { - if (isXorY(channel)) { - return makeExplicit(range.map(function (v) { - if (v === 'width' || v === 'height') { - // get signal for width/height - // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames. - var sizeSignal = model.getName(v); - var getSignalName = model.getSignalName.bind(model); - return SignalRefWrapper.fromName(getSignalName, sizeSignal); - } - - return v; - })); - } - } else if (isObject(range)) { - return makeExplicit({ - data: model.requestDataName(DataSourceType.Main), - field: range.field, - sort: { - op: 'min', - field: model.vgField(channel) - } - }); - } - - return makeExplicit(range); - } - - case 'scheme': - return makeExplicit(parseScheme(specifiedScale[property])); - } - } - } - } - } catch (err) { - _iterator150.e(err); - } finally { - _iterator150.f(); - } - - if (channel === X || channel === Y) { - var sizeChannel = channel === X ? 'width' : 'height'; - var sizeValue = size[sizeChannel]; - - if (isStep(sizeValue)) { - if (hasDiscreteDomain(scaleType)) { - return makeExplicit({ - step: sizeValue.step - }); - } else { - warn(stepDropped(sizeChannel)); - } - } - } - - var rangeMin = specifiedScale.rangeMin, - rangeMax = specifiedScale.rangeMax; - var d = defaultRange(channel, model); - - if ((rangeMin !== undefined || rangeMax !== undefined) && // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same - scaleTypeSupportProperty(scaleType, 'rangeMin') && isArray(d) && d.length === 2) { - return makeExplicit([rangeMin !== null && rangeMin !== void 0 ? rangeMin : d[0], rangeMax !== null && rangeMax !== void 0 ? rangeMax : d[1]]); - } - - return makeImplicit(d); - } - - function parseScheme(scheme) { - if (isExtendedScheme(scheme)) { - return Object.assign({ - scheme: scheme.name - }, omit(scheme, ['name'])); - } - - return { - scheme: scheme - }; - } - - function defaultRange(channel, model) { - var size = model.size, - config = model.config, - mark = model.mark, - encoding = model.encoding; - var getSignalName = model.getSignalName.bind(model); - - var _getFieldOrDatumDef = getFieldOrDatumDef(encoding[channel]), - type = _getFieldOrDatumDef.type; - - var mergedScaleCmpt = model.getScaleComponent(channel); - var scaleType = mergedScaleCmpt.get('type'); - var _model$specifiedScale = model.specifiedScales[channel], - domain = _model$specifiedScale.domain, - domainMid = _model$specifiedScale.domainMid; - - switch (channel) { - case X: - case Y: - { - // If there is no explicit width/height for discrete x/y scales - if (contains(['point', 'band'], scaleType)) { - if (channel === X && !size.width) { - var w = getViewConfigDiscreteSize(config.view, 'width'); - - if (isStep(w)) { - return w; - } - } else if (channel === Y && !size.height) { - var h = getViewConfigDiscreteSize(config.view, 'height'); - - if (isStep(h)) { - return h; - } - } - } // If step is null, use zero to width or height. - // Note that we use SignalRefWrapper to account for potential merges and renames. - - - var sizeType = getSizeChannel$1(channel); - var sizeSignal = model.getName(sizeType); - - if (channel === Y && hasContinuousDomain(scaleType)) { - // For y continuous scale, we have to start from the height as the bottom part has the max value. - return [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0]; - } else { - return [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)]; - } - } - - case SIZE: - { - // TODO: support custom rangeMin, rangeMax - var _zero = model.component.scales[channel].get('zero'); - - var rangeMin = sizeRangeMin(mark, _zero, config); - var rangeMax = sizeRangeMax(mark, size, model, config); - - if (isContinuousToDiscrete(scaleType)) { - return interpolateRange(rangeMin, rangeMax, defaultContinuousToDiscreteCount(scaleType, config, domain, channel)); - } else { - return [rangeMin, rangeMax]; - } - } - - case THETA: - return [0, Math.PI * 2]; - - case ANGLE: - // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks. - // (It's weird to add just config.scale.min/maxAngleDegree for now) - return [0, 360]; - - case RADIUS: - { - // max radius = half od min(width,height) - return [0, new SignalRefWrapper(function () { - var w = model.getSignalName('width'); - var h = model.getSignalName('height'); - return "min(".concat(w, ",").concat(h, ")/2"); - })]; - } - - case STROKEWIDTH: - // TODO: support custom rangeMin, rangeMax - return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth]; - - case STROKEDASH: - return [// TODO: add this to Vega's config.range? - [1, 0], [4, 2], [2, 1], [1, 1], [1, 2, 4, 2]]; - - case SHAPE: - return 'symbol'; - - case COLOR: - case FILL: - case STROKE: - if (scaleType === 'ordinal') { - // Only nominal data uses ordinal scale by default - return type === 'nominal' ? 'category' : 'ordinal'; - } else { - if (domainMid !== undefined) { - return 'diverging'; - } else { - return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp'; - } - } - - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - // TODO: support custom rangeMin, rangeMax - return [config.scale.minOpacity, config.scale.maxOpacity]; - } - /* istanbul ignore next: should never reach here */ - - - throw new Error("Scale range undefined for channel ".concat(channel)); - } - - function defaultContinuousToDiscreteCount(scaleType, config, domain, channel) { - switch (scaleType) { - case 'quantile': - return config.scale.quantileCount; - - case 'quantize': - return config.scale.quantizeCount; - - case 'threshold': - if (domain !== undefined && isArray(domain)) { - return domain.length + 1; - } else { - warn(domainRequiredForThresholdScale(channel)); // default threshold boundaries for threshold scale since domain has cardinality of 2 - - return 3; - } - - } - } - /** - * Returns the linear interpolation of the range according to the cardinality - * - * @param rangeMin start of the range - * @param rangeMax end of the range - * @param cardinality number of values in the output range - */ - - - function interpolateRange(rangeMin, rangeMax, cardinality) { - // always return a signal since it's better to compute the sequence in Vega later - var f = function f() { - var rMax = signalOrStringValue(rangeMax); - var rMin = signalOrStringValue(rangeMin); - var step = "(".concat(rMax, " - ").concat(rMin, ") / (").concat(cardinality, " - 1)"); - return "sequence(".concat(rMin, ", ").concat(rMax, " + ").concat(step, ", ").concat(step, ")"); - }; - - if (isSignalRef(rangeMax)) { - return new SignalRefWrapper(f); - } else { - return { - signal: f() - }; - } - } - - function sizeRangeMin(mark, zero, config) { - if (zero) { - if (isSignalRef(zero)) { - return { - signal: "".concat(zero.signal, " ? 0 : ").concat(sizeRangeMin(mark, false, config)) - }; - } else { - return 0; - } - } - - switch (mark) { - case 'bar': - case 'tick': - return config.scale.minBandSize; - - case 'line': - case 'trail': - case 'rule': - return config.scale.minStrokeWidth; - - case 'text': - return config.scale.minFontSize; - - case 'point': - case 'square': - case 'circle': - return config.scale.minSize; - } - /* istanbul ignore next: should never reach here */ - // sizeRangeMin not implemented for the mark - - - throw new Error(incompatibleChannel('size', mark)); - } - - var MAX_SIZE_RANGE_STEP_RATIO = 0.95; - - function sizeRangeMax(mark, size, model, config) { - var xyStepSignals = { - x: getBinStepSignal(model, 'x'), - y: getBinStepSignal(model, 'y') - }; - - switch (mark) { - case 'bar': - case 'tick': - { - if (config.scale.maxBandSize !== undefined) { - return config.scale.maxBandSize; - } - - var min = minXYStep(size, xyStepSignals, config.view); - - if (isNumber(min)) { - return min - 1; - } else { - return new SignalRefWrapper(function () { - return "".concat(min.signal, " - 1"); - }); - } - } - - case 'line': - case 'trail': - case 'rule': - return config.scale.maxStrokeWidth; - - case 'text': - return config.scale.maxFontSize; - - case 'point': - case 'square': - case 'circle': - { - if (config.scale.maxSize) { - return config.scale.maxSize; - } - - var pointStep = minXYStep(size, xyStepSignals, config.view); - - if (isNumber(pointStep)) { - return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2); - } else { - return new SignalRefWrapper(function () { - return "pow(".concat(MAX_SIZE_RANGE_STEP_RATIO, " * ").concat(pointStep.signal, ", 2)"); - }); - } - } - } - /* istanbul ignore next: should never reach here */ - // sizeRangeMax not implemented for the mark - - - throw new Error(incompatibleChannel('size', mark)); - } - /** - * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale. - */ - - - function minXYStep(size, xyStepSignals, viewConfig) { - var widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width'); - var heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height'); - - if (xyStepSignals.x || xyStepSignals.y) { - return new SignalRefWrapper(function () { - var exprs = [xyStepSignals.x ? xyStepSignals.x.signal : widthStep, xyStepSignals.y ? xyStepSignals.y.signal : heightStep]; - return "min(".concat(exprs.join(', '), ")"); - }); - } - - return Math.min(widthStep, heightStep); - } - - function parseScaleProperty(model, property) { - if (isUnitModel(model)) { - parseUnitScaleProperty(model, property); - } else { - parseNonUnitScaleProperty(model, property); - } - } - - function parseUnitScaleProperty(model, property) { - var localScaleComponents = model.component.scales; - var config = model.config, - encoding = model.encoding, - markDef = model.markDef, - specifiedScales = model.specifiedScales; - - var _iterator151 = _createForOfIteratorHelper(keys(localScaleComponents)), - _step151; - - try { - for (_iterator151.s(); !(_step151 = _iterator151.n()).done;) { - var channel = _step151.value; - var specifiedScale = specifiedScales[channel]; - var localScaleCmpt = localScaleComponents[channel]; - var mergedScaleCmpt = model.getScaleComponent(channel); - var fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - var specifiedValue = specifiedScale[property]; - - var _scaleType8 = mergedScaleCmpt.get('type'); - - var scalePadding = mergedScaleCmpt.get('padding'); - var scalePaddingInner = mergedScaleCmpt.get('paddingInner'); - var supportedByScaleType = scaleTypeSupportProperty(_scaleType8, property); - var channelIncompatability = channelScalePropertyIncompatability(channel, property); - - if (specifiedValue !== undefined) { - // If there is a specified value, check if it is compatible with scale type and channel - if (!supportedByScaleType) { - warn(scalePropertyNotWorkWithScaleType(_scaleType8, property, channel)); - } else if (channelIncompatability) { - // channel - warn(channelIncompatability); - } - } - - if (supportedByScaleType && channelIncompatability === undefined) { - if (specifiedValue !== undefined) { - var timeUnit = fieldOrDatumDef['timeUnit']; - var type = fieldOrDatumDef.type; - - switch (property) { - // domainMax/Min to signal if the value is a datetime object - case 'domainMax': - case 'domainMin': - if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) { - localScaleCmpt.set(property, { - signal: valueExpr(specifiedScale[property], { - type: type, - timeUnit: timeUnit - }) - }, true); - } else { - localScaleCmpt.set(property, specifiedScale[property], true); - } - - break; - - default: - localScaleCmpt.copyKeyFromObject(property, specifiedScale); - } - } else { - var value = property in scaleRules ? scaleRules[property]({ - model: model, - channel: channel, - fieldOrDatumDef: fieldOrDatumDef, - scaleType: _scaleType8, - scalePadding: scalePadding, - scalePaddingInner: scalePaddingInner, - domain: specifiedScale.domain, - markDef: markDef, - config: config - }) : config.scale[property]; - - if (value !== undefined) { - localScaleCmpt.set(property, value, false); - } - } - } - } - } catch (err) { - _iterator151.e(err); - } finally { - _iterator151.f(); - } - } - - var scaleRules = { - bins: function bins(_ref86) { - var model = _ref86.model, - fieldOrDatumDef = _ref86.fieldOrDatumDef; - return isFieldDef(fieldOrDatumDef) ? _bins(model, fieldOrDatumDef) : undefined; - }, - interpolate: function interpolate(_ref87) { - var channel = _ref87.channel, - fieldOrDatumDef = _ref87.fieldOrDatumDef; - return _interpolate(channel, fieldOrDatumDef.type); - }, - nice: function nice(_ref88) { - var scaleType = _ref88.scaleType, - channel = _ref88.channel, - fieldOrDatumDef = _ref88.fieldOrDatumDef; - return _nice(scaleType, channel, fieldOrDatumDef); - }, - padding: function padding(_ref89) { - var channel = _ref89.channel, - scaleType = _ref89.scaleType, - fieldOrDatumDef = _ref89.fieldOrDatumDef, - markDef = _ref89.markDef, - config = _ref89.config; - return _padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar); - }, - paddingInner: function paddingInner(_ref90) { - var scalePadding = _ref90.scalePadding, - channel = _ref90.channel, - markDef = _ref90.markDef, - config = _ref90.config; - return _paddingInner(scalePadding, channel, markDef.type, config.scale); - }, - paddingOuter: function paddingOuter(_ref91) { - var scalePadding = _ref91.scalePadding, - channel = _ref91.channel, - scaleType = _ref91.scaleType, - markDef = _ref91.markDef, - scalePaddingInner = _ref91.scalePaddingInner, - config = _ref91.config; - return _paddingOuter(scalePadding, channel, scaleType, markDef.type, scalePaddingInner, config.scale); - }, - reverse: function reverse(_ref92) { - var fieldOrDatumDef = _ref92.fieldOrDatumDef, - scaleType = _ref92.scaleType, - channel = _ref92.channel, - config = _ref92.config; - var sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined; - return _reverse(scaleType, sort, channel, config.scale); - }, - zero: function zero(_ref93) { - var channel = _ref93.channel, - fieldOrDatumDef = _ref93.fieldOrDatumDef, - domain = _ref93.domain, - markDef = _ref93.markDef, - scaleType = _ref93.scaleType; - return zero$1(channel, fieldOrDatumDef, domain, markDef, scaleType); - } - }; // This method is here rather than in range.ts to avoid circular dependency. - - function parseScaleRange(model) { - if (isUnitModel(model)) { - parseUnitScaleRange(model); - } else { - parseNonUnitScaleProperty(model, 'range'); - } - } - - function parseNonUnitScaleProperty(model, property) { - var localScaleComponents = model.component.scales; - - var _iterator152 = _createForOfIteratorHelper(model.children), - _step152; - - try { - for (_iterator152.s(); !(_step152 = _iterator152.n()).done;) { - var child = _step152.value; - - if (property === 'range') { - parseScaleRange(child); - } else { - parseScaleProperty(child, property); - } - } - } catch (err) { - _iterator152.e(err); - } finally { - _iterator152.f(); - } - - var _iterator153 = _createForOfIteratorHelper(keys(localScaleComponents)), - _step153; - - try { - for (_iterator153.s(); !(_step153 = _iterator153.n()).done;) { - var channel = _step153.value; - var valueWithExplicit = void 0; - - var _iterator154 = _createForOfIteratorHelper(model.children), - _step154; - - try { - for (_iterator154.s(); !(_step154 = _iterator154.n()).done;) { - var _child5 = _step154.value; - var childComponent = _child5.component.scales[channel]; - - if (childComponent) { - var childValueWithExplicit = childComponent.getWithExplicit(property); - valueWithExplicit = mergeValuesWithExplicit(valueWithExplicit, childValueWithExplicit, property, 'scale', tieBreakByComparing(function (v1, v2) { - switch (property) { - case 'range': - // For step, prefer larger step - if (v1.step && v2.step) { - return v1.step - v2.step; - } - - return 0; - // TODO: precedence rule for other properties - } - - return 0; - })); - } - } - } catch (err) { - _iterator154.e(err); - } finally { - _iterator154.f(); - } - - localScaleComponents[channel].setWithExplicit(property, valueWithExplicit); - } - } catch (err) { - _iterator153.e(err); - } finally { - _iterator153.f(); - } - } - - function _bins(model, fieldDef) { - var bin = fieldDef.bin; - - if (isBinning(bin)) { - var binSignal = getBinSignalName(model, fieldDef.field, bin); - return new SignalRefWrapper(function () { - return model.getSignalName(binSignal); - }); - } else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) { - // start and stop will be determined from the scale domain - return { - step: bin.step - }; - } - - return undefined; - } - - function _interpolate(channel, type) { - if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') { - return 'hcl'; - } - - return undefined; - } - - function _nice(scaleType, channel, fieldOrDatumDef) { - var _a; - - if (((_a = getFieldDef(fieldOrDatumDef)) === null || _a === void 0 ? void 0 : _a.bin) || contains([ScaleType.TIME, ScaleType.UTC], scaleType)) { - return undefined; - } - - return channel in POSITION_SCALE_CHANNEL_INDEX ? true : undefined; - } - - function _padding(channel, scaleType, scaleConfig, fieldOrDatumDef, markDef, barConfig) { - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - if (isContinuousToContinuous(scaleType)) { - if (scaleConfig.continuousPadding !== undefined) { - return scaleConfig.continuousPadding; - } - - var type = markDef.type, - _orient3 = markDef.orient; - - if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) { - if (_orient3 === 'vertical' && channel === 'x' || _orient3 === 'horizontal' && channel === 'y') { - return barConfig.continuousBandSize; - } - } - } - - if (scaleType === ScaleType.POINT) { - return scaleConfig.pointPadding; - } - } - - return undefined; - } - - function _paddingInner(paddingValue, channel, mark, scaleConfig) { - if (paddingValue !== undefined) { - // If user has already manually specified "padding", no need to add default paddingInner. - return undefined; - } - - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - // Padding is only set for X and Y by default. - // Basically it doesn't make sense to add padding for color and size. - // paddingOuter would only be called if it's a band scale, just return the default for bandScale. - var bandPaddingInner = scaleConfig.bandPaddingInner, - barBandPaddingInner = scaleConfig.barBandPaddingInner, - rectBandPaddingInner = scaleConfig.rectBandPaddingInner; - return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); - } - - return undefined; - } - - function _paddingOuter(paddingValue, channel, scaleType, mark, paddingInnerValue, scaleConfig) { - if (paddingValue !== undefined) { - // If user has already manually specified "padding", no need to add default paddingOuter. - return undefined; - } - - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - // Padding is only set for X and Y by default. - // Basically it doesn't make sense to add padding for color and size. - if (scaleType === ScaleType.BAND) { - var bandPaddingOuter = scaleConfig.bandPaddingOuter; - return getFirstDefined(bandPaddingOuter, - /* By default, paddingOuter is paddingInner / 2. The reason is that - size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter). - and we want the width/height to be integer by default. - Note that step (by default) and cardinality are integers.) */ - isSignalRef(paddingInnerValue) ? { - signal: "".concat(paddingInnerValue.signal, "/2") - } : paddingInnerValue / 2); - } - } - - return undefined; - } - - function _reverse(scaleType, sort, channel, scaleConfig) { - if (channel === 'x' && scaleConfig.xReverse !== undefined) { - if (hasContinuousDomain(scaleType) && sort === 'descending') { - if (isSignalRef(scaleConfig.xReverse)) { - return { - signal: "!".concat(scaleConfig.xReverse.signal) - }; - } else { - return !scaleConfig.xReverse; - } - } - - return scaleConfig.xReverse; - } - - if (hasContinuousDomain(scaleType) && sort === 'descending') { - // For continuous domain scales, Vega does not support domain sort. - // Thus, we reverse range instead if sort is descending - return true; - } - - return undefined; - } - - function zero$1(channel, fieldDef, specifiedDomain, markDef, scaleType) { - // If users explicitly provide a domain range, we should not augment zero as that will be unexpected. - var hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated'; - - if (hasCustomDomain) { - if (hasContinuousDomain(scaleType)) { - if (isArray(specifiedDomain)) { - var first = specifiedDomain[0]; - var last = specifiedDomain[specifiedDomain.length - 1]; - - if (first <= 0 && last >= 0) { - // if the domain includes zero, make zero remains true - return true; - } - } - - return false; - } - } // If there is no custom domain, return true only for the following cases: - // 1) using quantitative field with size - // While this can be either ratio or interval fields, our assumption is that - // ratio are more common. However, if the scaleType is discretizing scale, we want to return - // false so that range doesn't start at zero - - - if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) { - return true; - } // 2) non-binned, quantitative x-scale or y-scale - // (For binning, we should not include zero by default because binning are calculated without zero.) - - - if (!(isFieldDef(fieldDef) && fieldDef.bin) && contains([].concat(_toConsumableArray(POSITION_SCALE_CHANNELS), _toConsumableArray(POLAR_POSITION_SCALE_CHANNELS)), channel)) { - var _orient4 = markDef.orient, - type = markDef.type; - - if (contains(['bar', 'area', 'line', 'trail'], type)) { - if (_orient4 === 'horizontal' && channel === 'y' || _orient4 === 'vertical' && channel === 'x') { - return false; - } - } - - return true; - } - - return false; - } - /** - * Determine if there is a specified scale type and if it is appropriate, - * or determine default type if type is unspecified or inappropriate. - */ - // NOTE: CompassQL uses this method. - - - function scaleType(specifiedScale, channel, fieldDef, mark) { - var defaultScaleType = defaultType$2(channel, fieldDef, mark); - var type = specifiedScale.type; - - if (!isScaleChannel(channel)) { - // There is no scale for these channels - return null; - } - - if (type !== undefined) { - // Check if explicitly specified scale type is supported by the channel - if (!channelSupportScaleType(channel, type)) { - warn(scaleTypeNotWorkWithChannel(channel, type, defaultScaleType)); - return defaultScaleType; - } // Check if explicitly specified scale type is supported by the data type - - - if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) { - warn(scaleTypeNotWorkWithFieldDef(type, defaultScaleType)); - return defaultScaleType; - } - - return type; - } - - return defaultScaleType; - } - /** - * Determine appropriate default scale type. - */ - // NOTE: Voyager uses this method. - - - function defaultType$2(channel, fieldDef, mark) { - var _a; - - switch (fieldDef.type) { - case 'nominal': - case 'ordinal': - if (isColorChannel(channel) || rangeType(channel) === 'discrete') { - if (channel === 'shape' && fieldDef.type === 'ordinal') { - warn(discreteChannelCannotEncode(channel, 'ordinal')); - } - - return 'ordinal'; - } - - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - if (contains(['rect', 'bar', 'image', 'rule'], mark)) { - // The rect/bar mark should fit into a band. - // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429 - return 'band'; - } - } else if (mark === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) { - return 'band'; - } - - if (fieldDef.band !== undefined || isPositionFieldOrDatumDef(fieldDef) && ((_a = fieldDef.axis) === null || _a === void 0 ? void 0 : _a.tickBand)) { - return 'band'; - } // Otherwise, use ordinal point scale so we can easily get center positions of the marks. - - - return 'point'; - - case 'temporal': - if (isColorChannel(channel)) { - return 'time'; - } else if (rangeType(channel) === 'discrete') { - warn(discreteChannelCannotEncode(channel, 'temporal')); // TODO: consider using quantize (equivalent to binning) once we have it - - return 'ordinal'; - } else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) { - return 'utc'; - } - - return 'time'; - - case 'quantitative': - if (isColorChannel(channel)) { - if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) { - return 'bin-ordinal'; - } - - return 'linear'; - } else if (rangeType(channel) === 'discrete') { - warn(discreteChannelCannotEncode(channel, 'quantitative')); // TODO: consider using quantize (equivalent to binning) once we have it - - return 'ordinal'; - } - - return 'linear'; - - case 'geojson': - return undefined; - } - /* istanbul ignore next: should never reach this */ - - - throw new Error(invalidFieldType(fieldDef.type)); - } - - function parseScales(model) { - var _ref94 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - ignoreRange = _ref94.ignoreRange; - - parseScaleCore(model); - parseScaleDomain(model); - - var _iterator155 = _createForOfIteratorHelper(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES), - _step155; - - try { - for (_iterator155.s(); !(_step155 = _iterator155.n()).done;) { - var prop = _step155.value; - parseScaleProperty(model, prop); - } - } catch (err) { - _iterator155.e(err); - } finally { - _iterator155.f(); - } - - if (!ignoreRange) { - // range depends on zero - parseScaleRange(model); - } - } - - function parseScaleCore(model) { - if (isUnitModel(model)) { - model.component.scales = parseUnitScaleCore(model); - } else { - model.component.scales = parseNonUnitScaleCore(model); - } - } - /** - * Parse scales for all channels of a model. - */ - - - function parseUnitScaleCore(model) { - var encoding = model.encoding, - mark = model.mark; - return SCALE_CHANNELS.reduce(function (scaleComponents, channel) { - var fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); // must be typed def to have scale - // Don't generate scale for shape of geoshape - - if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) { - return scaleComponents; - } - - var specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale']; - - if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) { - specifiedScale = specifiedScale !== null && specifiedScale !== void 0 ? specifiedScale : {}; - var sType = scaleType(specifiedScale, channel, fieldOrDatumDef, mark); - scaleComponents[channel] = new ScaleComponent(model.scaleName(channel + '', true), { - value: sType, - explicit: specifiedScale.type === sType - }); - } - - return scaleComponents; - }, {}); - } - - var scaleTypeTieBreaker = tieBreakByComparing(function (st1, st2) { - return scaleTypePrecedence(st1) - scaleTypePrecedence(st2); - }); - - function parseNonUnitScaleCore(model) { - var _a; - - var scaleComponents = model.component.scales = {}; - var scaleTypeWithExplicitIndex = {}; - var resolve = model.component.resolve; // Parse each child scale and determine if a particular channel can be merged. - - var _iterator156 = _createForOfIteratorHelper(model.children), - _step156; - - try { - for (_iterator156.s(); !(_step156 = _iterator156.n()).done;) { - var child = _step156.value; - parseScaleCore(child); // Instead of always merging right away -- check if it is compatible to merge first! - - var _iterator158 = _createForOfIteratorHelper(keys(child.component.scales)), - _step158; - - try { - for (_iterator158.s(); !(_step158 = _iterator158.n()).done;) { - var channel = _step158.value; - // if resolve is undefined, set default first - resolve.scale[channel] = (_a = resolve.scale[channel]) !== null && _a !== void 0 ? _a : defaultScaleResolve(channel, model); - - if (resolve.scale[channel] === 'shared') { - var explicitScaleType = scaleTypeWithExplicitIndex[channel]; - var childScaleType = child.component.scales[channel].getWithExplicit('type'); - - if (explicitScaleType) { - if (scaleCompatible(explicitScaleType.value, childScaleType.value)) { - // merge scale component if type are compatible - scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(explicitScaleType, childScaleType, 'type', 'scale', scaleTypeTieBreaker); - } else { - // Otherwise, update conflicting channel to be independent - resolve.scale[channel] = 'independent'; // Remove from the index so they don't get merged - - delete scaleTypeWithExplicitIndex[channel]; - } - } else { - scaleTypeWithExplicitIndex[channel] = childScaleType; - } - } - } - } catch (err) { - _iterator158.e(err); - } finally { - _iterator158.f(); - } - } // Merge each channel listed in the index - - } catch (err) { - _iterator156.e(err); - } finally { - _iterator156.f(); - } - - var _iterator157 = _createForOfIteratorHelper(keys(scaleTypeWithExplicitIndex)), - _step157; - - try { - for (_iterator157.s(); !(_step157 = _iterator157.n()).done;) { - var _channel2 = _step157.value; - // Create new merged scale component - var name = model.scaleName(_channel2, true); - var typeWithExplicit = scaleTypeWithExplicitIndex[_channel2]; - scaleComponents[_channel2] = new ScaleComponent(name, typeWithExplicit); // rename each child and mark them as merged - - var _iterator159 = _createForOfIteratorHelper(model.children), - _step159; - - try { - for (_iterator159.s(); !(_step159 = _iterator159.n()).done;) { - var _child6 = _step159.value; - var childScale = _child6.component.scales[_channel2]; - - if (childScale) { - _child6.renameScale(childScale.get('name'), name); - - childScale.merged = true; - } - } - } catch (err) { - _iterator159.e(err); - } finally { - _iterator159.f(); - } - } - } catch (err) { - _iterator157.e(err); - } finally { - _iterator157.f(); - } - - return scaleComponents; - } - - var NameMap = /*#__PURE__*/function () { - function NameMap() { - _classCallCheck(this, NameMap); - - this.nameMap = {}; - } - - _createClass(NameMap, [{ - key: "rename", - value: function rename(oldName, newName) { - this.nameMap[oldName] = newName; - } - }, { - key: "has", - value: function has(name) { - return this.nameMap[name] !== undefined; - } - }, { - key: "get", - value: function get(name) { - // If the name appears in the _nameMap, we need to read its new name. - // We have to loop over the dict just in case the new name also gets renamed. - while (this.nameMap[name] && name !== this.nameMap[name]) { - name = this.nameMap[name]; - } - - return name; - } - }]); - - return NameMap; - }(); - /* - We use type guards instead of `instanceof` as `instanceof` makes - different parts of the compiler depend on the actual implementation of - the model classes, which in turn depend on different parts of the compiler. - Thus, `instanceof` leads to circular dependency problems. - On the other hand, type guards only make different parts of the compiler - depend on the type of the model classes, but not the actual implementation. - */ - - - function isUnitModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'unit'; - } - - function isFacetModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'facet'; - } - - function isConcatModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'concat'; - } - - function isLayerModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'layer'; - } - - var Model = /*#__PURE__*/function () { - function Model(spec, type, parent, parentGivenName, config, resolve, view) { - var _this29 = this; - - _classCallCheck(this, Model); - - var _a, _b; - - this.type = type; - this.parent = parent; - this.config = config; - this.view = view; - this.children = []; - /** - * Corrects the data references in marks after assemble. - */ - - this.correctDataNames = function (mark) { - // TODO: make this correct - // for normal data references - if (mark.from && mark.from.data) { - mark.from.data = _this29.lookupDataSource(mark.from.data); - } // for access to facet data - - - if (mark.from && mark.from.facet && mark.from.facet.data) { - mark.from.facet.data = _this29.lookupDataSource(mark.from.facet.data); - } - - return mark; - }; - - this.parent = parent; - this.config = config; // If name is not provided, always use parent's givenName to avoid name conflicts. - - this.name = (_a = spec.name) !== null && _a !== void 0 ? _a : parentGivenName; - this.title = isText(spec.title) ? { - text: spec.title - } : spec.title; // Shared name maps - - this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap(); - this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap(); - this.signalNameMap = parent ? parent.signalNameMap : new NameMap(); - this.data = spec.data; - this.description = spec.description; - this.transforms = normalizeTransform((_b = spec.transform) !== null && _b !== void 0 ? _b : []); - this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config); - this.component = { - data: { - sources: parent ? parent.component.data.sources : [], - outputNodes: parent ? parent.component.data.outputNodes : {}, - outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {}, - // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined - isFaceted: isFacetSpec(spec) || parent && parent.component.data.isFaceted && spec.data === undefined - }, - layoutSize: new Split(), - layoutHeaders: { - row: {}, - column: {}, - facet: {} - }, - mark: null, - resolve: Object.assign({ - scale: {}, - axis: {}, - legend: {} - }, resolve ? duplicate(resolve) : {}), - selection: null, - scales: null, - projection: null, - axes: {}, - legends: {} - }; - } - - _createClass(Model, [{ - key: "parse", - value: function parse() { - this.parseScale(); - this.parseLayoutSize(); // depends on scale - - this.renameTopLevelLayoutSizeSignal(); - this.parseSelections(); - this.parseProjection(); - this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name. - - this.parseAxesAndHeaders(); // depends on scale and layout size - - this.parseLegends(); // depends on scale, markDef - - this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark. - } - }, { - key: "parseScale", - value: function parseScale() { - parseScales(this); - } - }, { - key: "parseProjection", - value: function parseProjection() { - _parseProjection(this); - } - /** - * Rename top-level spec's size to be just width / height, ignoring model name. - * This essentially merges the top-level spec's width/height signals with the width/height signals - * to help us reduce redundant signals declaration. - */ - - }, { - key: "renameTopLevelLayoutSizeSignal", - value: function renameTopLevelLayoutSizeSignal() { - if (this.getName('width') !== 'width') { - this.renameSignal(this.getName('width'), 'width'); - } - - if (this.getName('height') !== 'height') { - this.renameSignal(this.getName('height'), 'height'); - } - } - }, { - key: "parseLegends", - value: function parseLegends() { - parseLegend(this); - } - }, { - key: "assembleGroupStyle", - value: function assembleGroupStyle() { - var _a, _b; - - if (this.type === 'unit' || this.type === 'layer') { - return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : 'cell'; - } - - return undefined; - } - }, { - key: "assembleEncodeFromView", - value: function assembleEncodeFromView(view) { - // Exclude "style" - var baseView = __rest(view, ["style"]); - - var e = {}; - - var _iterator160 = _createForOfIteratorHelper(keys(baseView)), - _step160; - - try { - for (_iterator160.s(); !(_step160 = _iterator160.n()).done;) { - var property = _step160.value; - var value = baseView[property]; - - if (value !== undefined) { - e[property] = signalOrValueRef(value); - } - } - } catch (err) { - _iterator160.e(err); - } finally { - _iterator160.f(); - } - - return e; - } - }, { - key: "assembleGroupEncodeEntry", - value: function assembleGroupEncodeEntry(isTopLevel) { - var encodeEntry = {}; - - if (this.view) { - encodeEntry = this.assembleEncodeFromView(this.view); - } - - if (!isTopLevel) { - // Descriptions are already added to the top-level description so we only need to add them to the inner views. - if (this.description) { - encodeEntry['description'] = signalOrValueRef(this.description); - } // For top-level spec, we can set the global width and height signal to adjust the group size. - // For other child specs, we have to manually set width and height in the encode entry. - - - if (this.type === 'unit' || this.type === 'layer') { - return Object.assign({ - width: this.getSizeSignalRef('width'), - height: this.getSizeSignalRef('height') - }, encodeEntry !== null && encodeEntry !== void 0 ? encodeEntry : {}); - } - } - - return isEmpty(encodeEntry) ? undefined : encodeEntry; - } - }, { - key: "assembleLayout", - value: function assembleLayout() { - if (!this.layout) { - return undefined; - } - - var _a = this.layout, - spacing = _a.spacing, - layout = __rest(_a, ["spacing"]); - - var component = this.component, - config = this.config; - var titleBand = assembleLayoutTitleBand(component.layoutHeaders, config); - return Object.assign(Object.assign(Object.assign({ - padding: spacing - }, this.assembleDefaultLayout()), layout), titleBand ? { - titleBand: titleBand - } : {}); - } - }, { - key: "assembleDefaultLayout", - value: function assembleDefaultLayout() { - return {}; - } - }, { - key: "assembleHeaderMarks", - value: function assembleHeaderMarks() { - var layoutHeaders = this.component.layoutHeaders; - var headerMarks = []; - - var _iterator161 = _createForOfIteratorHelper(FACET_CHANNELS), - _step161; - - try { - for (_iterator161.s(); !(_step161 = _iterator161.n()).done;) { - var channel = _step161.value; - - if (layoutHeaders[channel].title) { - headerMarks.push(assembleTitleGroup(this, channel)); - } - } - } catch (err) { - _iterator161.e(err); - } finally { - _iterator161.f(); - } - - var _iterator162 = _createForOfIteratorHelper(HEADER_CHANNELS), - _step162; - - try { - for (_iterator162.s(); !(_step162 = _iterator162.n()).done;) { - var _channel3 = _step162.value; - headerMarks = headerMarks.concat(assembleHeaderGroups(this, _channel3)); - } - } catch (err) { - _iterator162.e(err); - } finally { - _iterator162.f(); - } - - return headerMarks; - } - }, { - key: "assembleAxes", - value: function assembleAxes() { - return _assembleAxes(this.component.axes, this.config); - } - }, { - key: "assembleLegends", - value: function assembleLegends() { - return _assembleLegends(this); - } - }, { - key: "assembleProjections", - value: function assembleProjections() { - return _assembleProjections(this); - } - }, { - key: "assembleTitle", - value: function assembleTitle() { - var _a, _b, _c; - - var _d = (_a = this.title) !== null && _a !== void 0 ? _a : {}, - encoding = _d.encoding, - titleNoEncoding = __rest(_d, ["encoding"]); - - var title = Object.assign(Object.assign(Object.assign({}, extractTitleConfig(this.config.title).nonMark), titleNoEncoding), encoding ? { - encode: { - update: encoding - } - } : {}); - - if (title.text) { - if (contains(['unit', 'layer'], this.type)) { - // Unit/Layer - if (contains(['middle', undefined], title.anchor)) { - title.frame = (_b = title.frame) !== null && _b !== void 0 ? _b : 'group'; - } - } else { - // composition with Vega layout - // Set title = "start" by default for composition as "middle" does not look nice - // https://github.com/vega/vega/issues/960#issuecomment-471360328 - title.anchor = (_c = title.anchor) !== null && _c !== void 0 ? _c : 'start'; - } - - return isEmpty(title) ? undefined : title; - } - - return undefined; - } - /** - * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals. - */ - - }, { - key: "assembleGroup", - value: function assembleGroup() { - var signals = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var group = {}; - signals = signals.concat(this.assembleSignals()); - - if (signals.length > 0) { - group.signals = signals; - } - - var layout = this.assembleLayout(); - - if (layout) { - group.layout = layout; - } - - group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks()); // Only include scales if this spec is top-level or if parent is facet. - // (Otherwise, it will be merged with upper-level's scope.) - - var scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : []; - - if (scales.length > 0) { - group.scales = scales; - } - - var axes = this.assembleAxes(); - - if (axes.length > 0) { - group.axes = axes; - } - - var legends = this.assembleLegends(); - - if (legends.length > 0) { - group.legends = legends; - } - - return group; - } - }, { - key: "getName", - value: function getName(text) { - return varName((this.name ? this.name + '_' : '') + text); - } - }, { - key: "getDataName", - value: function getDataName(type) { - return this.getName(DataSourceType[type].toLowerCase()); - } - /** - * Request a data source name for the given data source type and mark that data source as required. - * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData(). - * You can lookup the correct dataset name in assemble with `lookupDataSource`. - */ - - }, { - key: "requestDataName", - value: function requestDataName(name) { - var fullName = this.getDataName(name); // Increase ref count. This is critical because otherwise we won't create a data source. - // We also increase the ref counts on OutputNode.getSource() calls. - - var refCounts = this.component.data.outputNodeRefCounts; - refCounts[fullName] = (refCounts[fullName] || 0) + 1; - return fullName; - } - }, { - key: "getSizeSignalRef", - value: function getSizeSignalRef(layoutSizeType) { - if (isFacetModel(this.parent)) { - var sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); - var channel = getPositionScaleChannel(sizeType); - var scaleComponent = this.component.scales[channel]; - - if (scaleComponent && !scaleComponent.merged) { - // independent scale - var type = scaleComponent.get('type'); - var range = scaleComponent.get('range'); - - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - var scaleName = scaleComponent.get('name'); - - var _domain5 = assembleDomain(this, channel); - - var _field23 = getFieldFromDomain(_domain5); - - if (_field23) { - var fieldRef = _vgField({ - aggregate: 'distinct', - field: _field23 - }, { - expr: 'datum' - }); - - return { - signal: sizeExpr(scaleName, scaleComponent, fieldRef) - }; - } else { - warn(unknownField(channel)); - return null; - } - } - } - } - - return { - signal: this.signalNameMap.get(this.getName(layoutSizeType)) - }; - } - /** - * Lookup the name of the datasource for an output node. You probably want to call this in assemble. - */ - - }, { - key: "lookupDataSource", - value: function lookupDataSource(name) { - var node = this.component.data.outputNodes[name]; - - if (!node) { - // Name not found in map so let's just return what we got. - // This can happen if we already have the correct name. - return name; - } - - return node.getSource(); - } - }, { - key: "getSignalName", - value: function getSignalName(oldSignalName) { - return this.signalNameMap.get(oldSignalName); - } - }, { - key: "renameSignal", - value: function renameSignal(oldName, newName) { - this.signalNameMap.rename(oldName, newName); - } - }, { - key: "renameScale", - value: function renameScale(oldName, newName) { - this.scaleNameMap.rename(oldName, newName); - } - }, { - key: "renameProjection", - value: function renameProjection(oldName, newName) { - this.projectionNameMap.rename(oldName, newName); - } - /** - * @return scale name for a given channel after the scale has been parsed and named. - */ - - }, { - key: "scaleName", - value: function scaleName(originalScaleName, parse) { - if (parse) { - // During the parse phase always return a value - // No need to refer to rename map because a scale can't be renamed - // before it has the original name. - return this.getName(originalScaleName); - } // If there is a scale for the channel, it should either - // be in the scale component or exist in the name map - - - if ( // If there is a scale for the channel, there should be a local scale component for it - isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName] || // in the scale name map (the scale get merged by its parent) - this.scaleNameMap.has(this.getName(originalScaleName))) { - return this.scaleNameMap.get(this.getName(originalScaleName)); - } - - return undefined; - } - /** - * @return projection name after the projection has been parsed and named. - */ - - }, { - key: "projectionName", - value: function projectionName(parse) { - if (parse) { - // During the parse phase always return a value - // No need to refer to rename map because a projection can't be renamed - // before it has the original name. - return this.getName('projection'); - } - - if (this.component.projection && !this.component.projection.merged || this.projectionNameMap.has(this.getName('projection'))) { - return this.projectionNameMap.get(this.getName('projection')); - } - - return undefined; - } - /** - * Traverse a model's hierarchy to get the scale component for a particular channel. - */ - - }, { - key: "getScaleComponent", - value: function getScaleComponent(channel) { - /* istanbul ignore next: This is warning for debugging test */ - if (!this.component.scales) { - throw new Error('getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().'); - } - - var localScaleComponent = this.component.scales[channel]; - - if (localScaleComponent && !localScaleComponent.merged) { - return localScaleComponent; - } - - return this.parent ? this.parent.getScaleComponent(channel) : undefined; - } - /** - * Traverse a model's hierarchy to get a particular selection component. - */ - - }, { - key: "getSelectionComponent", - value: function getSelectionComponent(variableName, origName) { - var sel = this.component.selection[variableName]; - - if (!sel && this.parent) { - sel = this.parent.getSelectionComponent(variableName, origName); - } - - if (!sel) { - throw new Error(selectionNotFound(origName)); - } - - return sel; - } - /** - * Returns true if the model has a signalRef for an axis orient. - */ - - }, { - key: "hasAxisOrientSignalRef", - value: function hasAxisOrientSignalRef() { - var _a, _b; - - return ((_a = this.component.axes.x) === null || _a === void 0 ? void 0 : _a.some(function (a) { - return a.hasOrientSignalRef(); - })) || ((_b = this.component.axes.y) === null || _b === void 0 ? void 0 : _b.some(function (a) { - return a.hasOrientSignalRef(); - })); - } - }, { - key: "width", - get: function get() { - return this.getSizeSignalRef('width'); - } - }, { - key: "height", - get: function get() { - return this.getSizeSignalRef('height'); - } - }]); - - return Model; - }(); - /** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */ - - - var ModelWithField = /*#__PURE__*/function (_Model) { - _inherits(ModelWithField, _Model); - - var _super34 = _createSuper(ModelWithField); - - function ModelWithField() { - _classCallCheck(this, ModelWithField); - - return _super34.apply(this, arguments); - } - - _createClass(ModelWithField, [{ - key: "vgField", - - /** Get "field" reference for Vega */ - value: function vgField(channel) { - var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var fieldDef = this.fieldDef(channel); - - if (!fieldDef) { - return undefined; - } - - return _vgField(fieldDef, opt); - } - }, { - key: "reduceFieldDef", - value: function reduceFieldDef(f, init) { - return reduce(this.getMapping(), function (acc, cd, c) { - var fieldDef = getFieldDef(cd); - - if (fieldDef) { - return f(acc, fieldDef, c); - } - - return acc; - }, init); - } - }, { - key: "forEachFieldDef", - value: function forEachFieldDef(f, t) { - forEach(this.getMapping(), function (cd, c) { - var fieldDef = getFieldDef(cd); - - if (fieldDef) { - f(fieldDef, c); - } - }, t); - } - }]); - - return ModelWithField; - }(Model); - /** - * A class for density transform nodes - */ - - - var DensityTransformNode = /*#__PURE__*/function (_DataFlowNode16) { - _inherits(DensityTransformNode, _DataFlowNode16); - - var _super35 = _createSuper(DensityTransformNode); - - function DensityTransformNode(parent, transform) { - var _this30; - - _classCallCheck(this, DensityTransformNode); - - var _a, _b, _c; - - _this30 = _super35.call(this, parent); - _this30.transform = transform; - _this30.transform = duplicate(transform); // duplicate to prevent side effects - - var specifiedAs = (_a = _this30.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - _this30.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'value', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'density']; - return _this30; - } - - _createClass(DensityTransformNode, [{ - key: "clone", - value: function clone() { - return new DensityTransformNode(null, duplicate(this.transform)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - var _a; - - return new Set([this.transform.density].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []))); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.transform.as); - } - }, { - key: "hash", - value: function hash() { - return "DensityTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var _a = this.transform, - density = _a.density, - rest = __rest(_a, ["density"]); - - var result = Object.assign({ - type: 'kde', - field: density - }, rest); - return result; - } - }]); - - return DensityTransformNode; - }(DataFlowNode); - - var FilterInvalidNode = /*#__PURE__*/function (_DataFlowNode17) { - _inherits(FilterInvalidNode, _DataFlowNode17); - - var _super36 = _createSuper(FilterInvalidNode); - - function FilterInvalidNode(parent, filter) { - var _this31; - - _classCallCheck(this, FilterInvalidNode); - - _this31 = _super36.call(this, parent); - _this31.filter = filter; - return _this31; - } - - _createClass(FilterInvalidNode, [{ - key: "clone", - value: function clone() { - return new FilterInvalidNode(null, Object.assign({}, this.filter)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(keys(this.filter)); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(); // filter does not produce any new fields - } - }, { - key: "hash", - value: function hash() { - return "FilterInvalid ".concat(_hash(this.filter)); - } - /** - * Create the VgTransforms for each of the filtered fields. - */ - - }, { - key: "assemble", - value: function assemble() { - var _this32 = this; - - var filters = keys(this.filter).reduce(function (vegaFilters, field) { - var fieldDef = _this32.filter[field]; - - var ref = _vgField(fieldDef, { - expr: 'datum' - }); - - if (fieldDef !== null) { - if (fieldDef.type === 'temporal') { - vegaFilters.push("(isDate(".concat(ref, ") || (isValid(").concat(ref, ") && isFinite(+").concat(ref, ")))")); - } else if (fieldDef.type === 'quantitative') { - vegaFilters.push("isValid(".concat(ref, ")")); - vegaFilters.push("isFinite(+".concat(ref, ")")); - } - } - - return vegaFilters; - }, []); - return filters.length > 0 ? { - type: 'filter', - expr: filters.join(' && ') - } : null; - } - }], [{ - key: "make", - value: function make(parent, model) { - var config = model.config, - mark = model.mark, - markDef = model.markDef; - var invalid = getMarkPropOrConfig('invalid', markDef, config); - - if (invalid !== 'filter') { - return null; - } - - var filter = model.reduceFieldDef(function (aggregator, fieldDef, channel) { - var scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); - - if (scaleComponent) { - var _scaleType9 = scaleComponent.get('type'); // While discrete domain scales can handle invalid values, continuous scales can't. - // Thus, for non-path marks, we have to filter null for scales with continuous domains. - // (For path marks, we will use "defined" property and skip these values instead.) - - - if (hasContinuousDomain(_scaleType9) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { - aggregator[fieldDef.field] = fieldDef; // we know that the fieldDef is a typed field def - } - } - - return aggregator; - }, {}); - - if (!keys(filter).length) { - return null; - } - - return new FilterInvalidNode(parent, filter); - } - }]); - - return FilterInvalidNode; - }(DataFlowNode); - /** - * A class for flatten transform nodes - */ - - - var FlattenTransformNode = /*#__PURE__*/function (_DataFlowNode18) { - _inherits(FlattenTransformNode, _DataFlowNode18); - - var _super37 = _createSuper(FlattenTransformNode); - - function FlattenTransformNode(parent, transform) { - var _this33; - - _classCallCheck(this, FlattenTransformNode); - - _this33 = _super37.call(this, parent); - _this33.transform = transform; - _this33.transform = duplicate(transform); // duplicate to prevent side effects - - var _this33$transform = _this33.transform, - flatten = _this33$transform.flatten, - _this33$transform$as = _this33$transform.as, - as = _this33$transform$as === void 0 ? [] : _this33$transform$as; - _this33.transform.as = flatten.map(function (f, i) { - var _a; - - return (_a = as[i]) !== null && _a !== void 0 ? _a : f; - }); - return _this33; - } - - _createClass(FlattenTransformNode, [{ - key: "clone", - value: function clone() { - return new FlattenTransformNode(this.parent, duplicate(this.transform)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(this.transform.flatten); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.transform.as); - } - }, { - key: "hash", - value: function hash() { - return "FlattenTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var _this$transform = this.transform, - fields = _this$transform.flatten, - as = _this$transform.as; - var result = { - type: 'flatten', - fields: fields, - as: as - }; - return result; - } - }]); - - return FlattenTransformNode; - }(DataFlowNode); - /** - * A class for flatten transform nodes - */ - - - var FoldTransformNode = /*#__PURE__*/function (_DataFlowNode19) { - _inherits(FoldTransformNode, _DataFlowNode19); - - var _super38 = _createSuper(FoldTransformNode); - - function FoldTransformNode(parent, transform) { - var _this34; - - _classCallCheck(this, FoldTransformNode); - - var _a, _b, _c; - - _this34 = _super38.call(this, parent); - _this34.transform = transform; - _this34.transform = duplicate(transform); // duplicate to prevent side effects - - var specifiedAs = (_a = _this34.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - _this34.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'key', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'value']; - return _this34; - } - - _createClass(FoldTransformNode, [{ - key: "clone", - value: function clone() { - return new FoldTransformNode(null, duplicate(this.transform)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(this.transform.fold); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.transform.as); - } - }, { - key: "hash", - value: function hash() { - return "FoldTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var _this$transform2 = this.transform, - fold = _this$transform2.fold, - as = _this$transform2.as; - var result = { - type: 'fold', - fields: fold, - as: as - }; - return result; - } - }]); - - return FoldTransformNode; - }(DataFlowNode); - - var GeoJSONNode = /*#__PURE__*/function (_DataFlowNode20) { - _inherits(GeoJSONNode, _DataFlowNode20); - - var _super39 = _createSuper(GeoJSONNode); - - function GeoJSONNode(parent, fields, geojson, signal) { - var _this35; - - _classCallCheck(this, GeoJSONNode); - - _this35 = _super39.call(this, parent); - _this35.fields = fields; - _this35.geojson = geojson; - _this35.signal = signal; - return _this35; - } - - _createClass(GeoJSONNode, [{ - key: "clone", - value: function clone() { - return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal); - } - }, { - key: "dependentFields", - value: function dependentFields() { - var _a; - - var fields = ((_a = this.fields) !== null && _a !== void 0 ? _a : []).filter(isString); - return new Set([].concat(_toConsumableArray(this.geojson ? [this.geojson] : []), _toConsumableArray(fields))); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(); - } - }, { - key: "hash", - value: function hash() { - return "GeoJSON ".concat(this.geojson, " ").concat(this.signal, " ").concat(_hash(this.fields)); - } - }, { - key: "assemble", - value: function assemble() { - return Object.assign(Object.assign(Object.assign({ - type: 'geojson' - }, this.fields ? { - fields: this.fields - } : {}), this.geojson ? { - geojson: this.geojson - } : {}), { - signal: this.signal - }); - } - }], [{ - key: "parseAll", - value: function parseAll(parent, model) { - if (model.component.projection && !model.component.projection.isFit) { - return parent; - } - - var geoJsonCounter = 0; - - for (var _i15 = 0, _arr11 = [[LONGITUDE, LATITUDE], [LONGITUDE2, LATITUDE2]]; _i15 < _arr11.length; _i15++) { - var coordinates = _arr11[_i15]; - var pair = coordinates.map(function (channel) { - var def = getFieldOrDatumDef(model.encoding[channel]); - return isFieldDef(def) ? def.field : isDatumDef(def) ? { - expr: "".concat(def.datum) - } : isValueDef(def) ? { - expr: "".concat(def['value']) - } : undefined; - }); - - if (pair[0] || pair[1]) { - parent = new GeoJSONNode(parent, pair, null, model.getName("geojson_".concat(geoJsonCounter++))); - } - } - - if (model.channelHasField(SHAPE)) { - var fieldDef = model.typedFieldDef(SHAPE); - - if (fieldDef.type === GEOJSON) { - parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName("geojson_".concat(geoJsonCounter++))); - } - } - - return parent; - } - }]); - - return GeoJSONNode; - }(DataFlowNode); - - var GeoPointNode = /*#__PURE__*/function (_DataFlowNode21) { - _inherits(GeoPointNode, _DataFlowNode21); - - var _super40 = _createSuper(GeoPointNode); - - function GeoPointNode(parent, projection, fields, as) { - var _this36; - - _classCallCheck(this, GeoPointNode); - - _this36 = _super40.call(this, parent); - _this36.projection = projection; - _this36.fields = fields; - _this36.as = as; - return _this36; - } - - _createClass(GeoPointNode, [{ - key: "clone", - value: function clone() { - return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(this.fields.filter(isString)); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.as); - } - }, { - key: "hash", - value: function hash() { - return "Geopoint ".concat(this.projection, " ").concat(_hash(this.fields), " ").concat(_hash(this.as)); - } - }, { - key: "assemble", - value: function assemble() { - return { - type: 'geopoint', - projection: this.projection, - fields: this.fields, - as: this.as - }; - } - }], [{ - key: "parseAll", - value: function parseAll(parent, model) { - if (!model.projectionName()) { - return parent; - } - - for (var _i16 = 0, _arr12 = [[LONGITUDE, LATITUDE], [LONGITUDE2, LATITUDE2]]; _i16 < _arr12.length; _i16++) { - var coordinates = _arr12[_i16]; - var pair = coordinates.map(function (channel) { - var def = getFieldOrDatumDef(model.encoding[channel]); - return isFieldDef(def) ? def.field : isDatumDef(def) ? { - expr: "".concat(def.datum) - } : isValueDef(def) ? { - expr: "".concat(def['value']) - } : undefined; - }); - var suffix = coordinates[0] === LONGITUDE2 ? '2' : ''; - - if (pair[0] || pair[1]) { - parent = new GeoPointNode(parent, model.projectionName(), pair, [model.getName('x' + suffix), model.getName('y' + suffix)]); - } - } - - return parent; - } - }]); - - return GeoPointNode; - }(DataFlowNode); - - var ImputeNode = /*#__PURE__*/function (_DataFlowNode22) { - _inherits(ImputeNode, _DataFlowNode22); - - var _super41 = _createSuper(ImputeNode); - - function ImputeNode(parent, transform) { - var _this37; - - _classCallCheck(this, ImputeNode); - - _this37 = _super41.call(this, parent); - _this37.transform = transform; - return _this37; - } - - _createClass(ImputeNode, [{ - key: "clone", - value: function clone() { - return new ImputeNode(null, duplicate(this.transform)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - var _a; - - return new Set([this.transform.impute, this.transform.key].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []))); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set([this.transform.impute]); - } - }, { - key: "processSequence", - value: function processSequence(keyvals) { - var _keyvals$start = keyvals.start, - start = _keyvals$start === void 0 ? 0 : _keyvals$start, - stop = keyvals.stop, - step = keyvals.step; - var result = [start, stop].concat(_toConsumableArray(step ? [step] : [])).join(','); - return { - signal: "sequence(".concat(result, ")") - }; - } - }, { - key: "hash", - value: function hash() { - return "Impute ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var _this$transform3 = this.transform, - impute = _this$transform3.impute, - key = _this$transform3.key, - keyvals = _this$transform3.keyvals, - method = _this$transform3.method, - groupby = _this$transform3.groupby, - value = _this$transform3.value, - _this$transform3$fram = _this$transform3.frame, - frame = _this$transform3$fram === void 0 ? [null, null] : _this$transform3$fram; - var imputeTransform = Object.assign(Object.assign(Object.assign(Object.assign({ - type: 'impute', - field: impute, - key: key - }, keyvals ? { - keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals - } : {}), { - method: 'value' - }), groupby ? { - groupby: groupby - } : {}), { - value: !method || method === 'value' ? value : null - }); - - if (method && method !== 'value') { - var deriveNewField = Object.assign({ - type: 'window', - as: ["imputed_".concat(impute, "_value")], - ops: [method], - fields: [impute], - frame: frame, - ignorePeers: false - }, groupby ? { - groupby: groupby - } : {}); - var replaceOriginal = { - type: 'formula', - expr: "datum.".concat(impute, " === null ? datum.imputed_").concat(impute, "_value : datum.").concat(impute), - as: impute - }; - return [imputeTransform, deriveNewField, replaceOriginal]; - } else { - return [imputeTransform]; - } - } - }], [{ - key: "makeFromTransform", - value: function makeFromTransform(parent, imputeTransform) { - return new ImputeNode(parent, imputeTransform); - } - }, { - key: "makeFromEncoding", - value: function makeFromEncoding(parent, model) { - var encoding = model.encoding; - var xDef = encoding.x; - var yDef = encoding.y; - - if (isFieldDef(xDef) && isFieldDef(yDef)) { - var imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined; - - if (imputedChannel === undefined) { - return undefined; - } - - var keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined; - var _imputedChannel$imput = imputedChannel.impute, - method = _imputedChannel$imput.method, - value = _imputedChannel$imput.value, - frame = _imputedChannel$imput.frame, - keyvals = _imputedChannel$imput.keyvals; - var groupbyFields = pathGroupingFields(model.mark, encoding); - return new ImputeNode(parent, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ - impute: imputedChannel.field, - key: keyChannel.field - }, method ? { - method: method - } : {}), value !== undefined ? { - value: value - } : {}), frame ? { - frame: frame - } : {}), keyvals !== undefined ? { - keyvals: keyvals - } : {}), groupbyFields.length ? { - groupby: groupbyFields - } : {})); - } - - return null; - } - }]); - - return ImputeNode; - }(DataFlowNode); - /** - * A class for loess transform nodes - */ - - - var LoessTransformNode = /*#__PURE__*/function (_DataFlowNode23) { - _inherits(LoessTransformNode, _DataFlowNode23); - - var _super42 = _createSuper(LoessTransformNode); - - function LoessTransformNode(parent, transform) { - var _this38; - - _classCallCheck(this, LoessTransformNode); - - var _a, _b, _c; - - _this38 = _super42.call(this, parent); - _this38.transform = transform; - _this38.transform = duplicate(transform); // duplicate to prevent side effects - - var specifiedAs = (_a = _this38.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - _this38.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : transform.on, (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : transform.loess]; - return _this38; - } - - _createClass(LoessTransformNode, [{ - key: "clone", - value: function clone() { - return new LoessTransformNode(null, duplicate(this.transform)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - var _a; - - return new Set([this.transform.loess, this.transform.on].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []))); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.transform.as); - } - }, { - key: "hash", - value: function hash() { - return "LoessTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var _a = this.transform, - loess = _a.loess, - on = _a.on, - rest = __rest(_a, ["loess", "on"]); - - var result = Object.assign({ - type: 'loess', - x: on, - y: loess - }, rest); - return result; - } - }]); - - return LoessTransformNode; - }(DataFlowNode); - - var LookupNode = /*#__PURE__*/function (_DataFlowNode24) { - _inherits(LookupNode, _DataFlowNode24); - - var _super43 = _createSuper(LookupNode); - - function LookupNode(parent, transform, secondary) { - var _this39; - - _classCallCheck(this, LookupNode); - - _this39 = _super43.call(this, parent); - _this39.transform = transform; - _this39.secondary = secondary; - return _this39; - } - - _createClass(LookupNode, [{ - key: "clone", - value: function clone() { - return new LookupNode(null, duplicate(this.transform), this.secondary); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set([this.transform.lookup]); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields); - } - }, { - key: "hash", - value: function hash() { - return "Lookup ".concat(_hash({ - transform: this.transform, - secondary: this.secondary - })); - } - }, { - key: "assemble", - value: function assemble() { - var foreign; - - if (this.transform.from.fields) { - // lookup a few fields and add create a flat output - foreign = Object.assign({ - values: this.transform.from.fields - }, this.transform.as ? { - as: array(this.transform.as) - } : {}); - } else { - // lookup full record and nest it - var asName = this.transform.as; - - if (!isString(asName)) { - warn(NO_FIELDS_NEEDS_AS); - asName = '_lookup'; - } - - foreign = { - as: [asName] - }; - } - - return Object.assign(Object.assign({ - type: 'lookup', - from: this.secondary, - key: this.transform.from.key, - fields: [this.transform.lookup] - }, foreign), this.transform.default ? { - default: this.transform.default - } : {}); - } - }], [{ - key: "make", - value: function make(parent, model, transform, counter) { - var sources = model.component.data.sources; - var _transform = transform, - from = _transform.from; - var fromOutputNode = null; - - if (isLookupData(from)) { - var fromSource = findSource(from.data, sources); - - if (!fromSource) { - fromSource = new SourceNode(from.data); - sources.push(fromSource); - } - - var fromOutputName = model.getName("lookup_".concat(counter)); - fromOutputNode = new OutputNode(fromSource, fromOutputName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); - model.component.data.outputNodes[fromOutputName] = fromOutputNode; - } else if (isLookupSelection(from)) { - var selName = from.selection; - transform = Object.assign({ - as: selName - }, transform); - fromOutputNode = model.getSelectionComponent(varName(selName), selName).materialized; - - if (!fromOutputNode) { - throw new Error(noSameUnitLookup(selName)); - } - } - - return new LookupNode(parent, transform, fromOutputNode.getSource()); - } - }]); - - return LookupNode; - }(DataFlowNode); - /** - * A class for quantile transform nodes - */ - - - var QuantileTransformNode = /*#__PURE__*/function (_DataFlowNode25) { - _inherits(QuantileTransformNode, _DataFlowNode25); - - var _super44 = _createSuper(QuantileTransformNode); - - function QuantileTransformNode(parent, transform) { - var _this40; - - _classCallCheck(this, QuantileTransformNode); - - var _a, _b, _c; - - _this40 = _super44.call(this, parent); - _this40.transform = transform; - _this40.transform = duplicate(transform); // duplicate to prevent side effects - - var specifiedAs = (_a = _this40.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - _this40.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'prob', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'value']; - return _this40; - } - - _createClass(QuantileTransformNode, [{ - key: "clone", - value: function clone() { - return new QuantileTransformNode(null, duplicate(this.transform)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - var _a; - - return new Set([this.transform.quantile].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []))); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.transform.as); - } - }, { - key: "hash", - value: function hash() { - return "QuantileTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var _a = this.transform, - quantile = _a.quantile, - rest = __rest(_a, ["quantile"]); - - var result = Object.assign({ - type: 'quantile', - field: quantile - }, rest); - return result; - } - }]); - - return QuantileTransformNode; - }(DataFlowNode); - /** - * A class for regression transform nodes - */ - - - var RegressionTransformNode = /*#__PURE__*/function (_DataFlowNode26) { - _inherits(RegressionTransformNode, _DataFlowNode26); - - var _super45 = _createSuper(RegressionTransformNode); - - function RegressionTransformNode(parent, transform) { - var _this41; - - _classCallCheck(this, RegressionTransformNode); - - var _a, _b, _c; - - _this41 = _super45.call(this, parent); - _this41.transform = transform; - _this41.transform = duplicate(transform); // duplicate to prevent side effects - - var specifiedAs = (_a = _this41.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - _this41.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : transform.on, (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : transform.regression]; - return _this41; - } - - _createClass(RegressionTransformNode, [{ - key: "clone", - value: function clone() { - return new RegressionTransformNode(null, duplicate(this.transform)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - var _a; - - return new Set([this.transform.regression, this.transform.on].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []))); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(this.transform.as); - } - }, { - key: "hash", - value: function hash() { - return "RegressionTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var _a = this.transform, - regression = _a.regression, - on = _a.on, - rest = __rest(_a, ["regression", "on"]); - - var result = Object.assign({ - type: 'regression', - x: on, - y: regression - }, rest); - return result; - } - }]); - - return RegressionTransformNode; - }(DataFlowNode); - /** - * A class for pivot transform nodes. - */ - - - var PivotTransformNode = /*#__PURE__*/function (_DataFlowNode27) { - _inherits(PivotTransformNode, _DataFlowNode27); - - var _super46 = _createSuper(PivotTransformNode); - - function PivotTransformNode(parent, transform) { - var _this42; - - _classCallCheck(this, PivotTransformNode); - - _this42 = _super46.call(this, parent); - _this42.transform = transform; - return _this42; - } - - _createClass(PivotTransformNode, [{ - key: "clone", - value: function clone() { - return new PivotTransformNode(null, duplicate(this.transform)); - } - }, { - key: "addDimensions", - value: function addDimensions(fields) { - var _a; - - this.transform.groupby = unique(((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []).concat(fields), function (d) { - return d; - }); - } - }, { - key: "producedFields", - value: function producedFields() { - return undefined; // return undefined so that potentially everything can depend on the pivot - } - }, { - key: "dependentFields", - value: function dependentFields() { - var _a; - - return new Set([this.transform.pivot, this.transform.value].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []))); - } - }, { - key: "hash", - value: function hash() { - return "PivotTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - var _this$transform4 = this.transform, - pivot = _this$transform4.pivot, - value = _this$transform4.value, - groupby = _this$transform4.groupby, - limit = _this$transform4.limit, - op = _this$transform4.op; - return Object.assign(Object.assign(Object.assign({ - type: 'pivot', - field: pivot, - value: value - }, limit !== undefined ? { - limit: limit - } : {}), op !== undefined ? { - op: op - } : {}), groupby !== undefined ? { - groupby: groupby - } : {}); - } - }]); - - return PivotTransformNode; - }(DataFlowNode); - /** - * A class for the sample transform nodes - */ - - - var SampleTransformNode = /*#__PURE__*/function (_DataFlowNode28) { - _inherits(SampleTransformNode, _DataFlowNode28); - - var _super47 = _createSuper(SampleTransformNode); - - function SampleTransformNode(parent, transform) { - var _this43; - - _classCallCheck(this, SampleTransformNode); - - _this43 = _super47.call(this, parent); - _this43.transform = transform; - return _this43; - } - - _createClass(SampleTransformNode, [{ - key: "clone", - value: function clone() { - return new SampleTransformNode(null, duplicate(this.transform)); - } - }, { - key: "dependentFields", - value: function dependentFields() { - return new Set(); - } - }, { - key: "producedFields", - value: function producedFields() { - return new Set(); - } - }, { - key: "hash", - value: function hash() { - return "SampleTransform ".concat(_hash(this.transform)); - } - }, { - key: "assemble", - value: function assemble() { - return { - type: 'sample', - size: this.transform.sample - }; - } - }]); - - return SampleTransformNode; - }(DataFlowNode); - - function makeWalkTree(data) { - // to name datasources - var datasetIndex = 0; - /** - * Recursively walk down the tree. - */ - - function walkTree(node, dataSource) { - var _a; - - if (node instanceof SourceNode) { - // If the source is a named data source or a data source with values, we need - // to put it in a different data source. Otherwise, Vega may override the data. - if (!node.isGenerator && !isUrlData(node.data)) { - data.push(dataSource); - var newData = { - name: null, - source: dataSource.name, - transform: [] - }; - dataSource = newData; - } - } - - if (node instanceof ParseNode) { - if (node.parent instanceof SourceNode && !dataSource.source) { - var _dataSource$transform; - - // If node's parent is a root source and the data source does not refer to another data source, use normal format parse - dataSource.format = Object.assign(Object.assign({}, (_a = dataSource.format) !== null && _a !== void 0 ? _a : {}), { - parse: node.assembleFormatParse() - }); // add calculates for all nested fields - - (_dataSource$transform = dataSource.transform).push.apply(_dataSource$transform, _toConsumableArray(node.assembleTransforms(true))); - } else { - var _dataSource$transform2; - - // Otherwise use Vega expression to parse - (_dataSource$transform2 = dataSource.transform).push.apply(_dataSource$transform2, _toConsumableArray(node.assembleTransforms())); - } - } - - if (node instanceof FacetNode) { - if (!dataSource.name) { - dataSource.name = "data_".concat(datasetIndex++); - } - - if (!dataSource.source || dataSource.transform.length > 0) { - data.push(dataSource); - node.data = dataSource.name; - } else { - node.data = dataSource.source; - } - - var _iterator163 = _createForOfIteratorHelper(node.assemble()), - _step163; - - try { - for (_iterator163.s(); !(_step163 = _iterator163.n()).done;) { - var d = _step163.value; - data.push(d); - } // break here because the rest of the tree has to be taken care of by the facet. - - } catch (err) { - _iterator163.e(err); - } finally { - _iterator163.f(); - } - - return; - } - - if (node instanceof GraticuleNode || node instanceof SequenceNode || node instanceof FilterInvalidNode || node instanceof FilterNode || node instanceof CalculateNode || node instanceof GeoPointNode || node instanceof GeoJSONNode || node instanceof AggregateNode || node instanceof LookupNode || node instanceof WindowTransformNode || node instanceof JoinAggregateTransformNode || node instanceof FoldTransformNode || node instanceof FlattenTransformNode || node instanceof DensityTransformNode || node instanceof LoessTransformNode || node instanceof QuantileTransformNode || node instanceof RegressionTransformNode || node instanceof IdentifierNode || node instanceof SampleTransformNode || node instanceof PivotTransformNode) { - dataSource.transform.push(node.assemble()); - } - - if (node instanceof BinNode || node instanceof TimeUnitNode || node instanceof ImputeNode || node instanceof StackNode) { - var _dataSource$transform3; - - (_dataSource$transform3 = dataSource.transform).push.apply(_dataSource$transform3, _toConsumableArray(node.assemble())); - } - - if (node instanceof OutputNode) { - if (dataSource.source && dataSource.transform.length === 0) { - node.setSource(dataSource.source); - } else if (node.parent instanceof OutputNode) { - // Note that an output node may be required but we still do not assemble a - // separate data source for it. - node.setSource(dataSource.name); - } else { - if (!dataSource.name) { - dataSource.name = "data_".concat(datasetIndex++); - } // Here we set the name of the datasource we generated. From now on - // other assemblers can use it. - - - node.setSource(dataSource.name); // if this node has more than one child, we will add a datasource automatically - - if (node.numChildren() === 1) { - data.push(dataSource); - var _newData = { - name: null, - source: dataSource.name, - transform: [] - }; - dataSource = _newData; - } - } - } - - switch (node.numChildren()) { - case 0: - // done - if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) { - // do not push empty datasources that are simply references - data.push(dataSource); - } - - break; - - case 1: - walkTree(node.children[0], dataSource); - break; - - default: - { - if (!dataSource.name) { - dataSource.name = "data_".concat(datasetIndex++); - } - - var _source = dataSource.name; - - if (!dataSource.source || dataSource.transform.length > 0) { - data.push(dataSource); - } else { - _source = dataSource.source; - } - - var _iterator164 = _createForOfIteratorHelper(node.children), - _step164; - - try { - for (_iterator164.s(); !(_step164 = _iterator164.n()).done;) { - var child = _step164.value; - var _newData2 = { - name: null, - source: _source, - transform: [] - }; - walkTree(child, _newData2); - } - } catch (err) { - _iterator164.e(err); - } finally { - _iterator164.f(); - } - - break; - } - } - } - - return walkTree; - } - /** - * Assemble data sources that are derived from faceted data. - */ - - - function assembleFacetData(root) { - var data = []; - var walkTree = makeWalkTree(data); - - var _iterator165 = _createForOfIteratorHelper(root.children), - _step165; - - try { - for (_iterator165.s(); !(_step165 = _iterator165.n()).done;) { - var child = _step165.value; - walkTree(child, { - source: root.name, - name: null, - transform: [] - }); - } - } catch (err) { - _iterator165.e(err); - } finally { - _iterator165.f(); - } - - return data; - } - /** - * Create Vega data array from a given compiled model and append all of them to the given array - * - * @param model - * @param data array - * @return modified data array - */ - - - function assembleRootData(dataComponent, datasets) { - var _a, _b; - - var data = []; // dataComponent.sources.forEach(debug); - // draw(dataComponent.sources); - - var walkTree = makeWalkTree(data); - var sourceIndex = 0; - - var _iterator166 = _createForOfIteratorHelper(dataComponent.sources), - _step166; - - try { - for (_iterator166.s(); !(_step166 = _iterator166.n()).done;) { - var root = _step166.value; - - // assign a name if the source does not have a name yet - if (!root.hasName()) { - root.dataName = "source_".concat(sourceIndex++); - } - - var newData = root.assemble(); - walkTree(root, newData); - } // remove empty transform arrays for cleaner output - - } catch (err) { - _iterator166.e(err); - } finally { - _iterator166.f(); - } - - for (var _i17 = 0, _data3 = data; _i17 < _data3.length; _i17++) { - var d = _data3[_i17]; - - if (d.transform.length === 0) { - delete d.transform; - } - } // move sources without transforms (the ones that are potentially used in lookups) to the beginning - - - var whereTo = 0; - - var _iterator167 = _createForOfIteratorHelper(data.entries()), - _step167; - - try { - for (_iterator167.s(); !(_step167 = _iterator167.n()).done;) { - var _step167$value = _slicedToArray(_step167.value, 2), - i = _step167$value[0], - _d4 = _step167$value[1]; - - if (((_a = _d4.transform) !== null && _a !== void 0 ? _a : []).length === 0 && !_d4.source) { - data.splice(whereTo++, 0, data.splice(i, 1)[0]); - } - } // now fix the from references in lookup transforms - - } catch (err) { - _iterator167.e(err); - } finally { - _iterator167.f(); - } - - for (var _i18 = 0, _data4 = data; _i18 < _data4.length; _i18++) { - var _d2 = _data4[_i18]; - - var _iterator168 = _createForOfIteratorHelper((_b = _d2.transform) !== null && _b !== void 0 ? _b : []), - _step168; - - try { - for (_iterator168.s(); !(_step168 = _iterator168.n()).done;) { - var t = _step168.value; - - if (t.type === 'lookup') { - t.from = dataComponent.outputNodes[t.from].getSource(); - } - } - } catch (err) { - _iterator168.e(err); - } finally { - _iterator168.f(); - } - } // inline values for datasets that are in the datastore - - - for (var _i19 = 0, _data5 = data; _i19 < _data5.length; _i19++) { - var _d3 = _data5[_i19]; - - if (_d3.name in datasets) { - _d3.values = datasets[_d3.name]; - } - } - - return data; - } - - function getHeaderType(orient) { - if (orient === 'top' || orient === 'left' || isSignalRef(orient)) { - // we always use header for orient signal since we can't dynamically make header becomes footer - return 'header'; - } - - return 'footer'; - } - - function parseFacetHeaders(model) { - var _iterator169 = _createForOfIteratorHelper(FACET_CHANNELS), - _step169; - - try { - for (_iterator169.s(); !(_step169 = _iterator169.n()).done;) { - var channel = _step169.value; - parseFacetHeader(model, channel); - } - } catch (err) { - _iterator169.e(err); - } finally { - _iterator169.f(); - } - - mergeChildAxis(model, 'x'); - mergeChildAxis(model, 'y'); - } - - function parseFacetHeader(model, channel) { - var _a; - - var facet = model.facet, - config = model.config, - child = model.child, - component = model.component; - - if (model.channelHasField(channel)) { - var fieldDef = facet[channel]; - var titleConfig = getHeaderProperty('title', null, config, channel); - - var title$1 = _title3(fieldDef, config, { - allowDisabling: true, - includeDefault: titleConfig === undefined || !!titleConfig - }); - - if (child.component.layoutHeaders[channel].title) { - // TODO: better handle multiline titles - title$1 = isArray(title$1) ? title$1.join(', ') : title$1; // merge title with child to produce "Title / Subtitle / Sub-subtitle" - - title$1 += ' / ' + child.component.layoutHeaders[channel].title; - child.component.layoutHeaders[channel].title = null; - } - - var labelOrient = getHeaderProperty('labelOrient', fieldDef, config, channel); - var header = (_a = fieldDef.header) !== null && _a !== void 0 ? _a : {}; - - var _labels = getFirstDefined(header.labels, config.header.labels, true); - - var headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header'; - component.layoutHeaders[channel] = _defineProperty({ - title: title$1, - facetFieldDef: fieldDef - }, headerType, channel === 'facet' ? [] : [makeHeaderComponent(model, channel, _labels)]); - } - } - - function makeHeaderComponent(model, channel, labels) { - var sizeType = channel === 'row' ? 'height' : 'width'; - return { - labels: labels, - sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined, - axes: [] - }; - } - - function mergeChildAxis(model, channel) { - var _a; - - var child = model.child; - - if (child.component.axes[channel]) { - var _model$component2 = model.component, - layoutHeaders = _model$component2.layoutHeaders, - resolve = _model$component2.resolve; - resolve.axis[channel] = parseGuideResolve(resolve, channel); - - if (resolve.axis[channel] === 'shared') { - // For shared axis, move the axes to facet's header or footer - var headerChannel = channel === 'x' ? 'column' : 'row'; - var layoutHeader = layoutHeaders[headerChannel]; - - var _iterator170 = _createForOfIteratorHelper(child.component.axes[channel]), - _step170; - - try { - for (_iterator170.s(); !(_step170 = _iterator170.n()).done;) { - var axisComponent = _step170.value; - var headerType = getHeaderType(axisComponent.get('orient')); - layoutHeader[headerType] = (_a = layoutHeader[headerType]) !== null && _a !== void 0 ? _a : [makeHeaderComponent(model, headerChannel, false)]; // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes - - var mainAxis = assembleAxis(axisComponent, 'main', model.config, { - header: true - }); - - if (mainAxis) { - // LayoutHeader no longer keep track of property precedence, thus let's combine. - layoutHeader[headerType][0].axes.push(mainAxis); - } - - axisComponent.mainExtracted = true; - } - } catch (err) { - _iterator170.e(err); - } finally { - _iterator170.f(); - } - } - } - } - - function parseLayerLayoutSize(model) { - parseChildrenLayoutSize(model); - parseNonUnitLayoutSizeForChannel(model, 'width'); - parseNonUnitLayoutSizeForChannel(model, 'height'); - } - - function parseConcatLayoutSize(model) { - parseChildrenLayoutSize(model); // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth. - - var widthType = model.layout.columns === 1 ? 'width' : 'childWidth'; // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight. - - var heightType = model.layout.columns === undefined ? 'height' : 'childHeight'; - parseNonUnitLayoutSizeForChannel(model, widthType); - parseNonUnitLayoutSizeForChannel(model, heightType); - } - - function parseChildrenLayoutSize(model) { - var _iterator171 = _createForOfIteratorHelper(model.children), - _step171; - - try { - for (_iterator171.s(); !(_step171 = _iterator171.n()).done;) { - var child = _step171.value; - child.parseLayoutSize(); - } - } catch (err) { - _iterator171.e(err); - } finally { - _iterator171.f(); - } - } - /** - * Merge child layout size (width or height). - */ - - - function parseNonUnitLayoutSizeForChannel(model, layoutSizeType) { - /* - * For concat, the parent width or height might not be the same as the children's shared height. - * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width. - * - * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height) - * while the sizeType represents the properties of the child. - */ - var sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); - var channel = getPositionScaleChannel(sizeType); - var resolve = model.component.resolve; - var layoutSizeCmpt = model.component.layoutSize; - var mergedSize; // Try to merge layout size - - var _iterator172 = _createForOfIteratorHelper(model.children), - _step172; - - try { - for (_iterator172.s(); !(_step172 = _iterator172.n()).done;) { - var _child7 = _step172.value; - - var childSize = _child7.component.layoutSize.getWithExplicit(sizeType); - - var scaleResolve = resolve.scale[channel]; - - if (scaleResolve === 'independent' && childSize.value === 'step') { - // Do not merge independent scales with range-step as their size depends - // on the scale domains, which can be different between scales. - mergedSize = undefined; - break; - } - - if (mergedSize) { - if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) { - // For independent scale, only merge if all the sizes are the same. - // If the values are different, abandon the merge! - mergedSize = undefined; - break; - } - - mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, ''); - } else { - mergedSize = childSize; - } - } - } catch (err) { - _iterator172.e(err); - } finally { - _iterator172.f(); - } - - if (mergedSize) { - // If merged, rename size and set size of all children. - var _iterator173 = _createForOfIteratorHelper(model.children), - _step173; - - try { - for (_iterator173.s(); !(_step173 = _iterator173.n()).done;) { - var child = _step173.value; - model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType)); - child.component.layoutSize.set(sizeType, 'merged', false); - } - } catch (err) { - _iterator173.e(err); - } finally { - _iterator173.f(); - } - - layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize); - } else { - layoutSizeCmpt.setWithExplicit(layoutSizeType, { - explicit: false, - value: undefined - }); - } - } - - function parseUnitLayoutSize(model) { - var size = model.size, - component = model.component; - - var _iterator174 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS), - _step174; - - try { - for (_iterator174.s(); !(_step174 = _iterator174.n()).done;) { - var channel = _step174.value; - var sizeType = getSizeChannel(channel); - - if (size[sizeType]) { - var specifiedSize = size[sizeType]; - component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true); - } else { - var _defaultSize = defaultUnitSize(model, sizeType); - - component.layoutSize.set(sizeType, _defaultSize, false); - } - } - } catch (err) { - _iterator174.e(err); - } finally { - _iterator174.f(); - } - } - - function defaultUnitSize(model, sizeType) { - var channel = sizeType === 'width' ? 'x' : 'y'; - var config = model.config; - var scaleComponent = model.getScaleComponent(channel); - - if (scaleComponent) { - var _scaleType10 = scaleComponent.get('type'); - - var range = scaleComponent.get('range'); - - if (hasDiscreteDomain(_scaleType10)) { - var size = getViewConfigDiscreteSize(config.view, sizeType); - - if (isVgRangeStep(range) || isStep(size)) { - // For discrete domain with range.step, use dynamic width/height - return 'step'; - } else { - return size; - } - } else { - return getViewConfigContinuousSize(config.view, sizeType); - } - } else if (model.hasProjection || model.mark === 'arc') { - // arc should use continuous size by default otherwise the pie is extremely small - return getViewConfigContinuousSize(config.view, sizeType); - } else { - var _size = getViewConfigDiscreteSize(config.view, sizeType); - - return isStep(_size) ? _size.step : _size; - } - } - - function facetSortFieldName(fieldDef, sort, opt) { - return _vgField(sort, Object.assign({ - suffix: "by_".concat(_vgField(fieldDef)) - }, opt !== null && opt !== void 0 ? opt : {})); - } - - var FacetModel = /*#__PURE__*/function (_ModelWithField) { - _inherits(FacetModel, _ModelWithField); - - var _super48 = _createSuper(FacetModel); - - function FacetModel(spec, parent, parentGivenName, config) { - var _this44; - - _classCallCheck(this, FacetModel); - - _this44 = _super48.call(this, spec, 'facet', parent, parentGivenName, config, spec.resolve); - _this44.child = buildModel(spec.spec, _assertThisInitialized(_this44), _this44.getName('child'), undefined, config); - _this44.children = [_this44.child]; - _this44.facet = _this44.initFacet(spec.facet, config); - return _this44; - } - - _createClass(FacetModel, [{ - key: "initFacet", - value: function initFacet(facet, config) { - // clone to prevent side effect to the original spec - if (!isFacetMapping(facet)) { - return { - facet: initChannelDef(facet, 'facet', config) - }; - } - - return reduce(facet, function (normalizedFacet, fieldDef, channel) { - if (!contains([ROW, COLUMN], channel)) { - // Drop unsupported channel - warn(incompatibleChannel(channel, 'facet')); - return normalizedFacet; - } - - if (fieldDef.field === undefined) { - warn(emptyFieldDef(fieldDef, channel)); - return normalizedFacet; - } // Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. - - - normalizedFacet[channel] = initChannelDef(fieldDef, channel, config); - return normalizedFacet; - }, {}); - } - }, { - key: "channelHasField", - value: function channelHasField(channel) { - return !!this.facet[channel]; - } - }, { - key: "fieldDef", - value: function fieldDef(channel) { - return this.facet[channel]; - } - }, { - key: "parseData", - value: function parseData() { - this.component.data = _parseData(this); - this.child.parseData(); - } - }, { - key: "parseLayoutSize", - value: function parseLayoutSize() { - parseChildrenLayoutSize(this); - } - }, { - key: "parseSelections", - value: function parseSelections() { - // As a facet has a single child, the selection components are the same. - // The child maintains its selections to assemble signals, which remain - // within its unit. - this.child.parseSelections(); - this.component.selection = this.child.component.selection; - } - }, { - key: "parseMarkGroup", - value: function parseMarkGroup() { - this.child.parseMarkGroup(); - } - }, { - key: "parseAxesAndHeaders", - value: function parseAxesAndHeaders() { - this.child.parseAxesAndHeaders(); - parseFacetHeaders(this); - } - }, { - key: "assembleSelectionTopLevelSignals", - value: function assembleSelectionTopLevelSignals(signals) { - return this.child.assembleSelectionTopLevelSignals(signals); - } - }, { - key: "assembleSignals", - value: function assembleSignals() { - this.child.assembleSignals(); - return []; - } - }, { - key: "assembleSelectionData", - value: function assembleSelectionData(data) { - return this.child.assembleSelectionData(data); - } - }, { - key: "getHeaderLayoutMixins", - value: function getHeaderLayoutMixins() { - var _a, _b, _c; - - var layoutMixins = {}; - - var _iterator175 = _createForOfIteratorHelper(FACET_CHANNELS), - _step175; - - try { - for (_iterator175.s(); !(_step175 = _iterator175.n()).done;) { - var channel = _step175.value; - - var _iterator176 = _createForOfIteratorHelper(HEADER_TYPES), - _step176; - - try { - for (_iterator176.s(); !(_step176 = _iterator176.n()).done;) { - var headerType = _step176.value; - var layoutHeaderComponent = this.component.layoutHeaders[channel]; - var headerComponent = layoutHeaderComponent[headerType]; - var facetFieldDef = layoutHeaderComponent.facetFieldDef; - - if (facetFieldDef) { - var titleOrient = getHeaderProperty('titleOrient', facetFieldDef, this.config, channel); - - if (contains(['right', 'bottom'], titleOrient)) { - var headerChannel = getHeaderChannel(channel, titleOrient); - layoutMixins.titleAnchor = (_a = layoutMixins.titleAnchor) !== null && _a !== void 0 ? _a : {}; - layoutMixins.titleAnchor[headerChannel] = 'end'; - } - } - - if (headerComponent === null || headerComponent === void 0 ? void 0 : headerComponent[0]) { - // set header/footerBand - var sizeType = channel === 'row' ? 'height' : 'width'; - var bandType = headerType === 'header' ? 'headerBand' : 'footerBand'; - - if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) { - // If facet child does not have size signal, then apply headerBand - layoutMixins[bandType] = (_b = layoutMixins[bandType]) !== null && _b !== void 0 ? _b : {}; - layoutMixins[bandType][channel] = 0.5; - } - - if (layoutHeaderComponent.title) { - layoutMixins.offset = (_c = layoutMixins.offset) !== null && _c !== void 0 ? _c : {}; - layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10; - } - } - } - } catch (err) { - _iterator176.e(err); - } finally { - _iterator176.f(); - } - } - } catch (err) { - _iterator175.e(err); - } finally { - _iterator175.f(); - } - - return layoutMixins; - } - }, { - key: "assembleDefaultLayout", - value: function assembleDefaultLayout() { - var _this$facet = this.facet, - column = _this$facet.column, - row = _this$facet.row; - var columns = column ? this.columnDistinctSignal() : row ? 1 : undefined; - var align = 'all'; // Do not align the cells if the scale corresponding to the direction is indepent. - // We always align when we facet into both row and column. - - if (!row && this.component.resolve.scale.x === 'independent') { - align = 'none'; - } else if (!column && this.component.resolve.scale.y === 'independent') { - align = 'none'; - } - - return Object.assign(Object.assign(Object.assign({}, this.getHeaderLayoutMixins()), columns ? { - columns: columns - } : {}), { - bounds: 'full', - align: align - }); - } - }, { - key: "assembleLayoutSignals", - value: function assembleLayoutSignals() { - // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales. - return this.child.assembleLayoutSignals(); - } - }, { - key: "columnDistinctSignal", - value: function columnDistinctSignal() { - if (this.parent && this.parent instanceof FacetModel) { - // For nested facet, we will add columns to group mark instead - // See discussion in https://github.com/vega/vega/issues/952 - // and https://github.com/vega/vega-view/releases/tag/v1.2.6 - return undefined; - } else { - // In facetNode.assemble(), the name is always this.getName('column') + '_layout'. - var facetLayoutDataName = this.getName('column_domain'); - return { - signal: "length(data('".concat(facetLayoutDataName, "'))") - }; - } - } - }, { - key: "assembleGroup", - value: function assembleGroup(signals) { - if (this.parent && this.parent instanceof FacetModel) { - // Provide number of columns for layout. - // See discussion in https://github.com/vega/vega/issues/952 - // and https://github.com/vega/vega-view/releases/tag/v1.2.6 - return Object.assign(Object.assign({}, this.channelHasField('column') ? { - encode: { - update: { - // TODO(https://github.com/vega/vega-lite/issues/2759): - // Correct the signal for facet of concat of facet_column - columns: { - field: _vgField(this.facet.column, { - prefix: 'distinct' - }) - } - } - } - } : {}), _get(_getPrototypeOf(FacetModel.prototype), "assembleGroup", this).call(this, signals)); - } - - return _get(_getPrototypeOf(FacetModel.prototype), "assembleGroup", this).call(this, signals); - } - /** - * Aggregate cardinality for calculating size - */ - - }, { - key: "getCardinalityAggregateForChild", - value: function getCardinalityAggregateForChild() { - var fields = []; - var ops = []; - var as = []; - - if (this.child instanceof FacetModel) { - if (this.child.channelHasField('column')) { - var _field24 = _vgField(this.child.facet.column); - - fields.push(_field24); - ops.push('distinct'); - as.push("distinct_".concat(_field24)); - } - } else { - var _iterator177 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS), - _step177; - - try { - for (_iterator177.s(); !(_step177 = _iterator177.n()).done;) { - var channel = _step177.value; - var childScaleComponent = this.child.component.scales[channel]; - - if (childScaleComponent && !childScaleComponent.merged) { - var type = childScaleComponent.get('type'); - var range = childScaleComponent.get('range'); - - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - var _domain6 = assembleDomain(this.child, channel); - - var _field25 = getFieldFromDomain(_domain6); - - if (_field25) { - fields.push(_field25); - ops.push('distinct'); - as.push("distinct_".concat(_field25)); - } else { - warn(unknownField(channel)); - } - } - } - } - } catch (err) { - _iterator177.e(err); - } finally { - _iterator177.f(); - } - } - - return { - fields: fields, - ops: ops, - as: as - }; - } - }, { - key: "assembleFacet", - value: function assembleFacet() { - var _this$component$data$ = this.component.data.facetRoot, - name = _this$component$data$.name, - data = _this$component$data$.data; - var _this$facet2 = this.facet, - row = _this$facet2.row, - column = _this$facet2.column; - - var _this$getCardinalityA = this.getCardinalityAggregateForChild(), - fields = _this$getCardinalityA.fields, - ops = _this$getCardinalityA.ops, - as = _this$getCardinalityA.as; - - var groupby = []; - - var _iterator178 = _createForOfIteratorHelper(FACET_CHANNELS), - _step178; - - try { - for (_iterator178.s(); !(_step178 = _iterator178.n()).done;) { - var channel = _step178.value; - var fieldDef = this.facet[channel]; - - if (fieldDef) { - groupby.push(_vgField(fieldDef)); - var bin = fieldDef.bin, - sort = fieldDef.sort; - - if (isBinning(bin)) { - groupby.push(_vgField(fieldDef, { - binSuffix: 'end' - })); - } - - if (isSortField(sort)) { - var _field26 = sort.field, - _sort$op = sort.op, - op = _sort$op === void 0 ? DEFAULT_SORT_OP : _sort$op; - var outputName = facetSortFieldName(fieldDef, sort); - - if (row && column) { - // For crossed facet, use pre-calculate field as it requires a different groupby - // For each calculated field, apply max and assign them to the same name as - // all values of the same group should be the same anyway. - fields.push(outputName); - ops.push('max'); - as.push(outputName); - } else { - fields.push(_field26); - ops.push(op); - as.push(outputName); - } - } else if (isArray(sort)) { - var _outputName = sortArrayIndexField(fieldDef, channel); - - fields.push(_outputName); - ops.push('max'); - as.push(_outputName); - } - } - } - } catch (err) { - _iterator178.e(err); - } finally { - _iterator178.f(); - } - - var cross = !!row && !!column; - return Object.assign({ - name: name, - data: data, - groupby: groupby - }, cross || fields.length > 0 ? { - aggregate: Object.assign(Object.assign({}, cross ? { - cross: cross - } : {}), fields.length ? { - fields: fields, - ops: ops, - as: as - } : {}) - } : {}); - } - }, { - key: "facetSortFields", - value: function facetSortFields(channel) { - var facet = this.facet; - var fieldDef = facet[channel]; - - if (fieldDef) { - if (isSortField(fieldDef.sort)) { - return [facetSortFieldName(fieldDef, fieldDef.sort, { - expr: 'datum' - })]; - } else if (isArray(fieldDef.sort)) { - return [sortArrayIndexField(fieldDef, channel, { - expr: 'datum' - })]; - } - - return [_vgField(fieldDef, { - expr: 'datum' - })]; - } - - return []; - } - }, { - key: "facetSortOrder", - value: function facetSortOrder(channel) { - var facet = this.facet; - var fieldDef = facet[channel]; - - if (fieldDef) { - var sort = fieldDef.sort; - var order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending'; - return [order]; - } - - return []; - } - }, { - key: "assembleLabelTitle", - value: function assembleLabelTitle() { - var facet = this.facet, - config = this.config; - - if (facet.facet) { - // Facet always uses title to display labels - return _assembleLabelTitle(facet.facet, 'facet', config); - } - - var ORTHOGONAL_ORIENT = { - row: ['top', 'bottom'], - column: ['left', 'right'] - }; - - var _iterator179 = _createForOfIteratorHelper(HEADER_CHANNELS), - _step179; - - try { - for (_iterator179.s(); !(_step179 = _iterator179.n()).done;) { - var channel = _step179.value; - - if (facet[channel]) { - var labelOrient = getHeaderProperty('labelOrient', facet[channel], config, channel); - - if (contains(ORTHOGONAL_ORIENT[channel], labelOrient)) { - // Row/Column with orthogonal labelOrient must use title to display labels - return _assembleLabelTitle(facet[channel], channel, config); - } - } - } - } catch (err) { - _iterator179.e(err); - } finally { - _iterator179.f(); - } - - return undefined; - } - }, { - key: "assembleMarks", - value: function assembleMarks() { - var _this45 = this; - - var child = this.child; // If we facet by two dimensions, we need to add a cross operator to the aggregation - // so that we create all groups - - var facetRoot = this.component.data.facetRoot; - var data = assembleFacetData(facetRoot); - var encodeEntry = child.assembleGroupEncodeEntry(false); - var title = this.assembleLabelTitle() || child.assembleTitle(); - var style = child.assembleGroupStyle(); - var markGroup = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ - name: this.getName('cell'), - type: 'group' - }, title ? { - title: title - } : {}), style ? { - style: style - } : {}), { - from: { - facet: this.assembleFacet() - }, - // TODO: move this to after data - sort: { - field: FACET_CHANNELS.map(function (c) { - return _this45.facetSortFields(c); - }).flat(), - order: FACET_CHANNELS.map(function (c) { - return _this45.facetSortOrder(c); - }).flat() - } - }), data.length > 0 ? { - data: data - } : {}), encodeEntry ? { - encode: { - update: encodeEntry - } - } : {}), child.assembleGroup(assembleFacetSignals(this, []))); - return [markGroup]; - } - }, { - key: "getMapping", - value: function getMapping() { - return this.facet; - } - }]); - - return FacetModel; - }(ModelWithField); - - function makeJoinAggregateFromFacet(parent, facet) { - var row = facet.row, - column = facet.column; - - if (row && column) { - var newParent = null; // only need to make one for crossed facet - - for (var _i20 = 0, _arr13 = [row, column]; _i20 < _arr13.length; _i20++) { - var fieldDef = _arr13[_i20]; - - if (isSortField(fieldDef.sort)) { - var _fieldDef$sort = fieldDef.sort, - _field27 = _fieldDef$sort.field, - _fieldDef$sort$op = _fieldDef$sort.op, - op = _fieldDef$sort$op === void 0 ? DEFAULT_SORT_OP : _fieldDef$sort$op; - parent = newParent = new JoinAggregateTransformNode(parent, { - joinaggregate: [{ - op: op, - field: _field27, - as: facetSortFieldName(fieldDef, fieldDef.sort, { - forAs: true - }) - }], - groupby: [_vgField(fieldDef)] - }); - } - } - - return newParent; - } - - return null; - } - - function findSource(data, sources) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - - var _iterator180 = _createForOfIteratorHelper(sources), - _step180; - - try { - for (_iterator180.s(); !(_step180 = _iterator180.n()).done;) { - var other = _step180.value; - var otherData = other.data; // if both datasets have a name defined, we cannot merge - - if (data.name && other.hasName() && data.name !== other.dataName) { - continue; - } // feature and mesh are mutually exclusive - - - if (((_a = data['format']) === null || _a === void 0 ? void 0 : _a.mesh) && ((_b = otherData.format) === null || _b === void 0 ? void 0 : _b.feature)) { - continue; - } // we have to extract the same feature or mesh - - - if ((((_c = data['format']) === null || _c === void 0 ? void 0 : _c.feature) || ((_d = otherData.format) === null || _d === void 0 ? void 0 : _d.feature)) && ((_e = data['format']) === null || _e === void 0 ? void 0 : _e.feature) !== ((_f = otherData.format) === null || _f === void 0 ? void 0 : _f.feature)) { - continue; - } - - if ((((_g = data['format']) === null || _g === void 0 ? void 0 : _g.mesh) || ((_h = otherData.format) === null || _h === void 0 ? void 0 : _h.mesh)) && ((_j = data['format']) === null || _j === void 0 ? void 0 : _j.mesh) !== ((_k = otherData.format) === null || _k === void 0 ? void 0 : _k.mesh)) { - continue; - } - - if (isInlineData(data) && isInlineData(otherData)) { - if (deepEqual(data.values, otherData.values)) { - return other; - } - } else if (isUrlData(data) && isUrlData(otherData)) { - if (data.url === otherData.url) { - return other; - } - } else if (isNamedData(data)) { - if (data.name === other.dataName) { - return other; - } - } - } - } catch (err) { - _iterator180.e(err); - } finally { - _iterator180.f(); - } - - return null; - } - - function parseRoot(model, sources) { - if (model.data || !model.parent) { - // if the model defines a data source or is the root, create a source node - if (model.data === null) { - // data: null means we should ignore the parent's data so we just create a new data source - var _source2 = new SourceNode({ - values: [] - }); - - sources.push(_source2); - return _source2; - } - - var existingSource = findSource(model.data, sources); - - if (existingSource) { - if (!isGenerator(model.data)) { - existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format); - } // if the new source has a name but the existing one does not, we can set it - - - if (!existingSource.hasName() && model.data.name) { - existingSource.dataName = model.data.name; - } - - return existingSource; - } else { - var _source3 = new SourceNode(model.data); - - sources.push(_source3); - return _source3; - } - } else { - // If we don't have a source defined (overriding parent's data), use the parent's facet root or main. - return model.parent.component.data.facetRoot ? model.parent.component.data.facetRoot : model.parent.component.data.main; - } - } - /** - * Parses a transform array into a chain of connected dataflow nodes. - */ - - - function parseTransformArray(head, model, ancestorParse) { - var _a, _b; - - var lookupCounter = 0; - - var _iterator181 = _createForOfIteratorHelper(model.transforms), - _step181; - - try { - for (_iterator181.s(); !(_step181 = _iterator181.n()).done;) { - var t = _step181.value; - var derivedType = undefined; - var transformNode = void 0; - - if (isCalculate(t)) { - transformNode = head = new CalculateNode(head, t); - derivedType = 'derived'; - } else if (isFilter(t)) { - var implicit = getImplicitFromFilterTransform(t); - transformNode = head = (_a = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse)) !== null && _a !== void 0 ? _a : head; - head = new FilterNode(head, model, t.filter); - } else if (isBin(t)) { - transformNode = head = BinNode.makeFromTransform(head, t, model); - derivedType = 'number'; - } else if (isTimeUnit(t)) { - derivedType = 'date'; - var parsedAs = ancestorParse.getWithExplicit(t.field); // Create parse node because the input to time unit is always date. - - if (parsedAs.value === undefined) { - head = new ParseNode(head, _defineProperty({}, t.field, derivedType)); - ancestorParse.set(t.field, derivedType, false); - } - - transformNode = head = TimeUnitNode.makeFromTransform(head, t); - } else if (isAggregate$1(t)) { - transformNode = head = AggregateNode.makeFromTransform(head, t); - derivedType = 'number'; - - if (requiresSelectionId(model)) { - head = new IdentifierNode(head); - } - } else if (isLookup(t)) { - transformNode = head = LookupNode.make(head, model, t, lookupCounter++); - derivedType = 'derived'; - } else if (isWindow(t)) { - transformNode = head = new WindowTransformNode(head, t); - derivedType = 'number'; - } else if (isJoinAggregate(t)) { - transformNode = head = new JoinAggregateTransformNode(head, t); - derivedType = 'number'; - } else if (isStack(t)) { - transformNode = head = StackNode.makeFromTransform(head, t); - derivedType = 'derived'; - } else if (isFold(t)) { - transformNode = head = new FoldTransformNode(head, t); - derivedType = 'derived'; - } else if (isFlatten(t)) { - transformNode = head = new FlattenTransformNode(head, t); - derivedType = 'derived'; - } else if (isPivot(t)) { - transformNode = head = new PivotTransformNode(head, t); - derivedType = 'derived'; - } else if (isSample(t)) { - head = new SampleTransformNode(head, t); - } else if (isImpute(t)) { - transformNode = head = ImputeNode.makeFromTransform(head, t); - derivedType = 'derived'; - } else if (isDensity(t)) { - transformNode = head = new DensityTransformNode(head, t); - derivedType = 'derived'; - } else if (isQuantile(t)) { - transformNode = head = new QuantileTransformNode(head, t); - derivedType = 'derived'; - } else if (isRegression(t)) { - transformNode = head = new RegressionTransformNode(head, t); - derivedType = 'derived'; - } else if (isLoess(t)) { - transformNode = head = new LoessTransformNode(head, t); - derivedType = 'derived'; - } else { - warn(invalidTransformIgnored(t)); - continue; - } - - if (transformNode && derivedType !== undefined) { - var _iterator182 = _createForOfIteratorHelper((_b = transformNode.producedFields()) !== null && _b !== void 0 ? _b : []), - _step182; - - try { - for (_iterator182.s(); !(_step182 = _iterator182.n()).done;) { - var _field28 = _step182.value; - ancestorParse.set(_field28, derivedType, false); - } - } catch (err) { - _iterator182.e(err); - } finally { - _iterator182.f(); - } - } - } - } catch (err) { - _iterator181.e(err); - } finally { - _iterator181.f(); - } - - return head; - } - /* - Description of the dataflow (http://asciiflow.com/): - +--------+ - | Source | - +---+----+ - | - v - FormatParse - (explicit) - | - v - Transforms - (Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...) - | - v - FormatParse - (implicit) - | - v - Binning (in `encoding`) - | - v - Timeunit (in `encoding`) - | - v - Formula From Sort Array - | - v - +--+--+ - | Raw | - +-----+ - | - v - Aggregate (in `encoding`) - | - v - Stack (in `encoding`) - | - v - Invalid Filter - | - v - +----------+ - | Main | - +----------+ - | - v - +-------+ - | Facet |----> "column", "column-layout", and "row" - +-------+ - | - v - ...Child data... - */ - - - function _parseData(model) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - - var head = parseRoot(model, model.component.data.sources); - var _model$component$data = model.component.data, - outputNodes = _model$component$data.outputNodes, - outputNodeRefCounts = _model$component$data.outputNodeRefCounts; - var ancestorParse = model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse(); - var data = model.data; - - if (isGenerator(data)) { - // insert generator transform - if (isSequenceGenerator(data)) { - head = new SequenceNode(head, data.sequence); - } else if (isGraticuleGenerator(data)) { - head = new GraticuleNode(head, data.graticule); - } // no parsing necessary for generator - - - ancestorParse.parseNothing = true; - } else if (((_a = data === null || data === void 0 ? void 0 : data.format) === null || _a === void 0 ? void 0 : _a.parse) === null) { - // format.parse: null means disable parsing - ancestorParse.parseNothing = true; - } - - head = (_b = ParseNode.makeExplicit(head, model, ancestorParse)) !== null && _b !== void 0 ? _b : head; // Default discrete selections require an identifer transform to - // uniquely identify data points. Add this transform at the head of - // the pipeline such that the identifier field is available for all - // subsequent datasets. During optimization, we will remove this - // transform if it proves to be unnecessary. Additional identifier - // transforms will be necessary when new tuples are constructed - // (e.g., post-aggregation). - - head = new IdentifierNode(head); // HACK: This is equivalent for merging bin extent for union scale. - // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale - - var parentIsLayer = model.parent && isLayerModel(model.parent); - - if (isUnitModel(model) || isFacetModel(model)) { - if (parentIsLayer) { - head = (_c = BinNode.makeFromEncoding(head, model)) !== null && _c !== void 0 ? _c : head; - } - } - - if (model.transforms.length > 0) { - head = parseTransformArray(head, model, ancestorParse); - } // create parse nodes for fields that need to be parsed (or flattened) implicitly - - - var implicitSelection = getImplicitFromSelection(model); - var implicitEncoding = getImplicitFromEncoding(model); - head = (_d = ParseNode.makeWithAncestors(head, {}, Object.assign(Object.assign({}, implicitSelection), implicitEncoding), ancestorParse)) !== null && _d !== void 0 ? _d : head; - - if (isUnitModel(model)) { - head = GeoJSONNode.parseAll(head, model); - head = GeoPointNode.parseAll(head, model); - } - - if (isUnitModel(model) || isFacetModel(model)) { - if (!parentIsLayer) { - head = (_e = BinNode.makeFromEncoding(head, model)) !== null && _e !== void 0 ? _e : head; - } - - head = (_f = TimeUnitNode.makeFromEncoding(head, model)) !== null && _f !== void 0 ? _f : head; - head = CalculateNode.parseAllForSortIndex(head, model); - } // add an output node pre aggregation - - - var rawName = model.getDataName(DataSourceType.Raw); - var raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts); - outputNodes[rawName] = raw; - head = raw; - - if (isUnitModel(model)) { - var agg = AggregateNode.makeFromEncoding(head, model); - - if (agg) { - head = agg; - - if (requiresSelectionId(model)) { - head = new IdentifierNode(head); - } - } - - head = (_g = ImputeNode.makeFromEncoding(head, model)) !== null && _g !== void 0 ? _g : head; - head = (_h = StackNode.makeFromEncoding(head, model)) !== null && _h !== void 0 ? _h : head; - } - - if (isUnitModel(model)) { - head = (_j = FilterInvalidNode.make(head, model)) !== null && _j !== void 0 ? _j : head; - } // output node for marks - - - var mainName = model.getDataName(DataSourceType.Main); - var main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts); - outputNodes[mainName] = main; - head = main; - - if (isUnitModel(model)) { - materializeSelections(model, main); - } // add facet marker - - - var facetRoot = null; - - if (isFacetModel(model)) { - var facetName = model.getName('facet'); // Derive new aggregate for facet's sort field - // augment data source with new fields for crossed facet - - head = (_k = makeJoinAggregateFromFacet(head, model.facet)) !== null && _k !== void 0 ? _k : head; - facetRoot = new FacetNode(head, model, facetName, main.getSource()); - outputNodes[facetName] = facetRoot; - } - - return Object.assign(Object.assign({}, model.component.data), { - outputNodes: outputNodes, - outputNodeRefCounts: outputNodeRefCounts, - raw: raw, - main: main, - facetRoot: facetRoot, - ancestorParse: ancestorParse - }); - } - - var ConcatModel = /*#__PURE__*/function (_Model2) { - _inherits(ConcatModel, _Model2); - - var _super49 = _createSuper(ConcatModel); - - function ConcatModel(spec, parent, parentGivenName, config) { - var _this46; - - _classCallCheck(this, ConcatModel); - - var _a, _b, _c, _d; - - _this46 = _super49.call(this, spec, 'concat', parent, parentGivenName, config, spec.resolve); - - if (((_b = (_a = spec.resolve) === null || _a === void 0 ? void 0 : _a.axis) === null || _b === void 0 ? void 0 : _b.x) === 'shared' || ((_d = (_c = spec.resolve) === null || _c === void 0 ? void 0 : _c.axis) === null || _d === void 0 ? void 0 : _d.y) === 'shared') { - warn(CONCAT_CANNOT_SHARE_AXIS); - } - - _this46.children = _this46.getChildren(spec).map(function (child, i) { - return buildModel(child, _assertThisInitialized(_this46), _this46.getName('concat_' + i), undefined, config); - }); - return _this46; - } - - _createClass(ConcatModel, [{ - key: "parseData", - value: function parseData() { - this.component.data = _parseData(this); - - var _iterator183 = _createForOfIteratorHelper(this.children), - _step183; - - try { - for (_iterator183.s(); !(_step183 = _iterator183.n()).done;) { - var child = _step183.value; - child.parseData(); - } - } catch (err) { - _iterator183.e(err); - } finally { - _iterator183.f(); - } - } - }, { - key: "parseSelections", - value: function parseSelections() { - // Merge selections up the hierarchy so that they may be referenced - // across unit specs. Persist their definitions within each child - // to assemble signals which remain within output Vega unit groups. - this.component.selection = {}; - - var _iterator184 = _createForOfIteratorHelper(this.children), - _step184; - - try { - for (_iterator184.s(); !(_step184 = _iterator184.n()).done;) { - var child = _step184.value; - child.parseSelections(); - - var _iterator185 = _createForOfIteratorHelper(keys(child.component.selection)), - _step185; - - try { - for (_iterator185.s(); !(_step185 = _iterator185.n()).done;) { - var key = _step185.value; - this.component.selection[key] = child.component.selection[key]; - } - } catch (err) { - _iterator185.e(err); - } finally { - _iterator185.f(); - } - } - } catch (err) { - _iterator184.e(err); - } finally { - _iterator184.f(); - } - } - }, { - key: "parseMarkGroup", - value: function parseMarkGroup() { - var _iterator186 = _createForOfIteratorHelper(this.children), - _step186; - - try { - for (_iterator186.s(); !(_step186 = _iterator186.n()).done;) { - var child = _step186.value; - child.parseMarkGroup(); - } - } catch (err) { - _iterator186.e(err); - } finally { - _iterator186.f(); - } - } - }, { - key: "parseAxesAndHeaders", - value: function parseAxesAndHeaders() { - var _iterator187 = _createForOfIteratorHelper(this.children), - _step187; - - try { - for (_iterator187.s(); !(_step187 = _iterator187.n()).done;) { - var child = _step187.value; - child.parseAxesAndHeaders(); - } // TODO(#2415): support shared axes - - } catch (err) { - _iterator187.e(err); - } finally { - _iterator187.f(); - } - } - }, { - key: "getChildren", - value: function getChildren(spec) { - if (isVConcatSpec(spec)) { - return spec.vconcat; - } else if (isHConcatSpec(spec)) { - return spec.hconcat; - } - - return spec.concat; - } - }, { - key: "parseLayoutSize", - value: function parseLayoutSize() { - parseConcatLayoutSize(this); - } - }, { - key: "parseAxisGroup", - value: function parseAxisGroup() { - return null; - } - }, { - key: "assembleSelectionTopLevelSignals", - value: function assembleSelectionTopLevelSignals(signals) { - return this.children.reduce(function (sg, child) { - return child.assembleSelectionTopLevelSignals(sg); - }, signals); - } - }, { - key: "assembleSignals", - value: function assembleSignals() { - this.children.forEach(function (child) { - return child.assembleSignals(); - }); - return []; - } - }, { - key: "assembleLayoutSignals", - value: function assembleLayoutSignals() { - var layoutSignals = _assembleLayoutSignals(this); - - var _iterator188 = _createForOfIteratorHelper(this.children), - _step188; - - try { - for (_iterator188.s(); !(_step188 = _iterator188.n()).done;) { - var child = _step188.value; - layoutSignals.push.apply(layoutSignals, _toConsumableArray(child.assembleLayoutSignals())); - } - } catch (err) { - _iterator188.e(err); - } finally { - _iterator188.f(); - } - - return layoutSignals; - } - }, { - key: "assembleSelectionData", - value: function assembleSelectionData(data) { - return this.children.reduce(function (db, child) { - return child.assembleSelectionData(db); - }, data); - } - }, { - key: "assembleMarks", - value: function assembleMarks() { - // only children have marks - return this.children.map(function (child) { - var title = child.assembleTitle(); - var style = child.assembleGroupStyle(); - var encodeEntry = child.assembleGroupEncodeEntry(false); - return Object.assign(Object.assign(Object.assign(Object.assign({ - type: 'group', - name: child.getName('group') - }, title ? { - title: title - } : {}), style ? { - style: style - } : {}), encodeEntry ? { - encode: { - update: encodeEntry - } - } : {}), child.assembleGroup()); - }); - } - }, { - key: "assembleDefaultLayout", - value: function assembleDefaultLayout() { - var columns = this.layout.columns; - return Object.assign(Object.assign({}, columns != null ? { - columns: columns - } : {}), { - bounds: 'full', - // Use align each so it can work with multiple plots with different size - align: 'each' - }); - } - }]); - - return ConcatModel; - }(Model); - - function isFalseOrNull(v) { - return v === false || v === null; - } - - var AXIS_COMPONENT_PROPERTIES_INDEX = Object.assign(Object.assign({ - disable: 1, - gridScale: 1, - scale: 1 - }, COMMON_AXIS_PROPERTIES_INDEX), { - labelExpr: 1, - encode: 1 - }); - var AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX); - - var AxisComponent = /*#__PURE__*/function (_Split5) { - _inherits(AxisComponent, _Split5); - - var _super50 = _createSuper(AxisComponent); - - function AxisComponent() { - var _this47; - - var explicit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var implicit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var mainExtracted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - _classCallCheck(this, AxisComponent); - - _this47 = _super50.call(this); - _this47.explicit = explicit; - _this47.implicit = implicit; - _this47.mainExtracted = mainExtracted; - return _this47; - } - - _createClass(AxisComponent, [{ - key: "clone", - value: function clone() { - return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted); - } - }, { - key: "hasAxisPart", - value: function hasAxisPart(part) { - // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme. - if (part === 'axis') { - // always has the axis container part - return true; - } - - if (part === 'grid' || part === 'title') { - return !!this.get(part); - } // Other parts are enabled by default, so they should not be false or null. - - - return !isFalseOrNull(this.get(part)); - } - }, { - key: "hasOrientSignalRef", - value: function hasOrientSignalRef() { - return isSignalRef(this.explicit.orient); - } - }]); - - return AxisComponent; - }(Split); - - function labels$1(model, channel, specifiedLabelsSpec) { - var _a; - - var encoding = model.encoding, - config = model.config; - var fieldOrDatumDef = (_a = getFieldOrDatumDef(encoding[channel])) !== null && _a !== void 0 ? _a : getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]); - var axis = model.axis(channel) || {}; - var format = axis.format, - formatType = axis.formatType; - - if (isCustomFormatType(formatType)) { - return Object.assign({ - text: formatCustomType({ - fieldOrDatumDef: fieldOrDatumDef, - field: 'datum.value', - format: format, - formatType: formatType, - config: config - }) - }, specifiedLabelsSpec); - } - - return specifiedLabelsSpec; - } - - function parseUnitAxes(model) { - return POSITION_SCALE_CHANNELS.reduce(function (axis, channel) { - if (model.component.scales[channel]) { - axis[channel] = [parseAxis(channel, model)]; - } - - return axis; - }, {}); - } - - var OPPOSITE_ORIENT = { - bottom: 'top', - top: 'bottom', - left: 'right', - right: 'left' - }; - - function parseLayerAxes(model) { - var _a; - - var _model$component3 = model.component, - axes = _model$component3.axes, - resolve = _model$component3.resolve; - var axisCount = { - top: 0, - bottom: 0, - right: 0, - left: 0 - }; - - var _iterator189 = _createForOfIteratorHelper(model.children), - _step189; - - try { - for (_iterator189.s(); !(_step189 = _iterator189.n()).done;) { - var child = _step189.value; - child.parseAxesAndHeaders(); - - var _iterator191 = _createForOfIteratorHelper(keys(child.component.axes)), - _step191; - - try { - for (_iterator191.s(); !(_step191 = _iterator191.n()).done;) { - var channel = _step191.value; - resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel); - - if (resolve.axis[channel] === 'shared') { - // If the resolve says shared (and has not been overridden) - // We will try to merge and see if there is a conflict - axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]); - - if (!axes[channel]) { - // If merge returns nothing, there is a conflict so we cannot make the axis shared. - // Thus, mark axis as independent and remove the axis component. - resolve.axis[channel] = 'independent'; - delete axes[channel]; - } - } - } - } catch (err) { - _iterator191.e(err); - } finally { - _iterator191.f(); - } - } // Move axes to layer's axis component and merge shared axes - - } catch (err) { - _iterator189.e(err); - } finally { - _iterator189.f(); - } - - var _iterator190 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS), - _step190; - - try { - for (_iterator190.s(); !(_step190 = _iterator190.n()).done;) { - var _channel4 = _step190.value; - - var _iterator192 = _createForOfIteratorHelper(model.children), - _step192; - - try { - for (_iterator192.s(); !(_step192 = _iterator192.n()).done;) { - var _child8 = _step192.value; - - if (!_child8.component.axes[_channel4]) { - // skip if the child does not have a particular axis - continue; - } - - if (resolve.axis[_channel4] === 'independent') { - // If axes are independent, concat the axisComponent array. - axes[_channel4] = ((_a = axes[_channel4]) !== null && _a !== void 0 ? _a : []).concat(_child8.component.axes[_channel4]); // Automatically adjust orient - - var _iterator194 = _createForOfIteratorHelper(_child8.component.axes[_channel4]), - _step194; - - try { - for (_iterator194.s(); !(_step194 = _iterator194.n()).done;) { - var axisComponent = _step194.value; - - var _axisComponent$getWit = axisComponent.getWithExplicit('orient'), - _orient5 = _axisComponent$getWit.value, - explicit = _axisComponent$getWit.explicit; - - if (isSignalRef(_orient5)) { - continue; - } - - if (axisCount[_orient5] > 0 && !explicit) { - // Change axis orient if the number do not match - var oppositeOrient = OPPOSITE_ORIENT[_orient5]; - - if (axisCount[_orient5] > axisCount[oppositeOrient]) { - axisComponent.set('orient', oppositeOrient, false); - } - } - - axisCount[_orient5]++; // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset? - } - } catch (err) { - _iterator194.e(err); - } finally { - _iterator194.f(); - } - } // After merging, make sure to remove axes from child - - - delete _child8.component.axes[_channel4]; - } // Suppress grid lines for dual axis charts (https://github.com/vega/vega-lite/issues/4676) - - } catch (err) { - _iterator192.e(err); - } finally { - _iterator192.f(); - } - - if (resolve.axis[_channel4] === 'independent' && axes[_channel4] && axes[_channel4].length > 1) { - var _iterator193 = _createForOfIteratorHelper(axes[_channel4]), - _step193; - - try { - for (_iterator193.s(); !(_step193 = _iterator193.n()).done;) { - var axisCmpt = _step193.value; - - if (!!axisCmpt.get('grid') && !axisCmpt.explicit.grid) { - axisCmpt.implicit.grid = false; - } - } - } catch (err) { - _iterator193.e(err); - } finally { - _iterator193.f(); - } - } - } - } catch (err) { - _iterator190.e(err); - } finally { - _iterator190.f(); - } - } - - function mergeAxisComponents(mergedAxisCmpts, childAxisCmpts) { - if (mergedAxisCmpts) { - // FIXME: this is a bit wrong once we support multiple axes - if (mergedAxisCmpts.length !== childAxisCmpts.length) { - return undefined; // Cannot merge axis component with different number of axes. - } - - var _length = mergedAxisCmpts.length; - - for (var i = 0; i < _length; i++) { - var merged = mergedAxisCmpts[i]; - var child = childAxisCmpts[i]; - - if (!!merged !== !!child) { - return undefined; - } else if (merged && child) { - var mergedOrient = merged.getWithExplicit('orient'); - var childOrient = child.getWithExplicit('orient'); - - if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { - // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) - // Cannot merge due to inconsistent orient - return undefined; - } else { - mergedAxisCmpts[i] = mergeAxisComponent(merged, child); - } - } - } - } else { - // For first one, return a copy of the child - return childAxisCmpts.map(function (axisComponent) { - return axisComponent.clone(); - }); - } - - return mergedAxisCmpts; - } - - function mergeAxisComponent(merged, child) { - var _iterator195 = _createForOfIteratorHelper(AXIS_COMPONENT_PROPERTIES), - _step195; - - try { - var _loop8 = function _loop8() { - var prop = _step195.value; - var mergedValueWithExplicit = mergeValuesWithExplicit(merged.getWithExplicit(prop), child.getWithExplicit(prop), prop, 'axis', // Tie breaker function - function (v1, v2) { - switch (prop) { - case 'title': - return mergeTitleComponent(v1, v2); - - case 'gridScale': - return { - explicit: v1.explicit, - value: getFirstDefined(v1.value, v2.value) - }; - } - - return defaultTieBreaker(v1, v2, prop, 'axis'); - }); - merged.setWithExplicit(prop, mergedValueWithExplicit); - }; - - for (_iterator195.s(); !(_step195 = _iterator195.n()).done;) { - _loop8(); - } - } catch (err) { - _iterator195.e(err); - } finally { - _iterator195.f(); - } - - return merged; - } // eslint-disable-next-line @typescript-eslint/ban-types - - - function isExplicit$1(value, property, axis, model, channel) { - if (property === 'disable') { - return axis !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit - } - - axis = axis || {}; - - switch (property) { - case 'titleAngle': - case 'labelAngle': - return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle)); - - case 'values': - return !!axis.values; - // specified axis.values is already respected, but may get transformed. - - case 'encode': - // both VL axis.encoding and axis.labelAngle affect VG axis.encode - return !!axis.encoding || !!axis.labelAngle; - - case 'title': - // title can be explicit if fieldDef.title is set - if (value === getFieldDefTitle(model, channel)) { - return true; - } - - } // Otherwise, things are explicit if the returned value matches the specified property - - - return value === axis[property]; - } - /** - * Properties to always include values from config - */ - - - var propsToAlwaysIncludeConfig = new Set(['grid', 'translate', // the rest are not axis configs in Vega, but are in VL, so we need to set too. - 'format', 'formatType', 'orient', 'labelExpr', 'tickCount', 'position', 'tickMinStep']); - - function parseAxis(channel, model) { - var _a, _b, _c; - - var axis = model.axis(channel); - var axisComponent = new AxisComponent(); - var fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]); - var mark = model.mark, - config = model.config; - var orient = (axis === null || axis === void 0 ? void 0 : axis.orient) || ((_a = config[channel === 'x' ? 'axisX' : 'axisY']) === null || _a === void 0 ? void 0 : _a.orient) || ((_b = config.axis) === null || _b === void 0 ? void 0 : _b.orient) || defaultOrient(channel); - var scaleType = model.getScaleComponent(channel).get('type'); - var axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config); - var disable = axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis === null || axis === void 0 ? void 0 : axis.style, axisConfigs).configValue; - axisComponent.set('disable', disable, axis !== undefined); - - if (disable) { - return axisComponent; - } - - axis = axis || {}; - var labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs); - var ruleParams = { - fieldOrDatumDef: fieldOrDatumDef, - axis: axis, - channel: channel, - model: model, - scaleType: scaleType, - orient: orient, - labelAngle: labelAngle, - mark: mark, - config: config - }; // 1.2. Add properties - - var _iterator196 = _createForOfIteratorHelper(AXIS_COMPONENT_PROPERTIES), - _step196; - - try { - for (_iterator196.s(); !(_step196 = _iterator196.n()).done;) { - var property = _step196.value; - var value = property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined; - var hasValue = value !== undefined; - var explicit = isExplicit$1(value, property, axis, model, channel); - - if (hasValue && explicit) { - axisComponent.set(property, value, explicit); - } else { - var _ref95 = isAxisProperty(property) && property !== 'values' ? getAxisConfig(property, config.style, axis.style, axisConfigs) : {}, - _ref95$configValue = _ref95.configValue, - configValue = _ref95$configValue === void 0 ? undefined : _ref95$configValue, - _ref95$configFrom = _ref95.configFrom, - configFrom = _ref95$configFrom === void 0 ? undefined : _ref95$configFrom; - - var hasConfigValue = configValue !== undefined; - - if (hasValue && !hasConfigValue) { - // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config) - axisComponent.set(property, value, explicit); - } else if ( // Cases need implicit values - // 1. Axis config that aren't available in Vega - !(configFrom === 'vgAxisConfig') || // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details) - propsToAlwaysIncludeConfig.has(property) && hasConfigValue || // 3. Conditional axis values and signals - isConditionalAxisValue(configValue) || isSignalRef(configValue)) { - // If a config is specified and is conditional, copy conditional value from axis config - axisComponent.set(property, configValue, false); - } - } - } // 2) Add guide encode definition groups - - } catch (err) { - _iterator196.e(err); - } finally { - _iterator196.f(); - } - - var axisEncoding = (_c = axis.encoding) !== null && _c !== void 0 ? _c : {}; - var axisEncode = AXIS_PARTS.reduce(function (e, part) { - var _a; - - if (!axisComponent.hasAxisPart(part)) { - // No need to create encode for a disabled part. - return e; - } - - var axisEncodingPart = guideEncodeEntry((_a = axisEncoding[part]) !== null && _a !== void 0 ? _a : {}, model); - var value = part === 'labels' ? labels$1(model, channel, axisEncodingPart) : axisEncodingPart; - - if (value !== undefined && !isEmpty(value)) { - e[part] = { - update: value - }; - } - - return e; - }, {}); // FIXME: By having encode as one property, we won't have fine grained encode merging. - - if (!isEmpty(axisEncode)) { - axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined); - } - - return axisComponent; - } - - function initLayoutSize(_ref96) { - var encoding = _ref96.encoding, - size = _ref96.size; - - var _iterator197 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS), - _step197; - - try { - for (_iterator197.s(); !(_step197 = _iterator197.n()).done;) { - var channel = _step197.value; - var sizeType = getSizeChannel(channel); - - if (isStep(size[sizeType])) { - if (isContinuousFieldOrDatumDef(encoding[channel])) { - delete size[sizeType]; - warn(stepDropped(sizeType)); - } - } - } - } catch (err) { - _iterator197.e(err); - } finally { - _iterator197.f(); - } - - return size; - } - - function initMarkdef(markDef, encoding, config) { - // set orient, which can be overridden by rules as sometimes the specified orient is invalid. - var specifiedOrient = getMarkPropOrConfig('orient', markDef, config); - markDef.orient = orient(markDef.type, encoding, specifiedOrient); - - if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) { - warn(orientOverridden(markDef.orient, specifiedOrient)); - } - - if (markDef.type === 'bar' && markDef.orient) { - var cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config); - - if (cornerRadiusEnd !== undefined) { - var newProps = markDef.orient === 'horizontal' && encoding.x2 || markDef.orient === 'vertical' && encoding.y2 ? ['cornerRadius'] : BAR_CORNER_RADIUS_INDEX[markDef.orient]; - - var _iterator198 = _createForOfIteratorHelper(newProps), - _step198; - - try { - for (_iterator198.s(); !(_step198 = _iterator198.n()).done;) { - var newProp = _step198.value; - markDef[newProp] = cornerRadiusEnd; - } - } catch (err) { - _iterator198.e(err); - } finally { - _iterator198.f(); - } - - if (markDef.cornerRadiusEnd !== undefined) { - delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius - } - } - } // set opacity and filled if not specified in mark config - - - var specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config); - - if (specifiedOpacity === undefined) { - markDef.opacity = opacity(markDef.type, encoding); - } // set cursor, which should be pointer if href channel is present unless otherwise specified - - - var specifiedCursor = getMarkPropOrConfig('cursor', markDef, config); - - if (specifiedCursor === undefined) { - markDef.cursor = cursor(markDef, encoding, config); - } - - return markDef; - } - - function cursor(markDef, encoding, config) { - if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) { - return 'pointer'; - } - - return markDef.cursor; - } - - function opacity(mark, encoding) { - if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) { - // point-based marks - if (!isAggregate(encoding)) { - return 0.7; - } - } - - return undefined; - } - - function defaultFilled(markDef, config, _ref97) { - var graticule = _ref97.graticule; - - if (graticule) { - return false; - } - - var filledConfig = getMarkConfig('filled', markDef, config); - var mark = markDef.type; - return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE); - } - - function orient(mark, encoding, specifiedOrient) { - switch (mark) { - case POINT: - case CIRCLE: - case SQUARE: - case TEXT: - case RECT: - case IMAGE: - // orient is meaningless for these marks. - return undefined; - } - - var x = encoding.x, - y = encoding.y, - x2 = encoding.x2, - y2 = encoding.y2; - - switch (mark) { - case BAR: - if (isFieldDef(x) && (isBinned(x.bin) || isFieldDef(y) && y.aggregate && !x.aggregate)) { - return 'vertical'; - } - - if (isFieldDef(y) && (isBinned(y.bin) || isFieldDef(x) && x.aggregate && !y.aggregate)) { - return 'horizontal'; - } - - if (y2 || x2) { - // Ranged bar does not always have clear orientation, so we allow overriding - if (specifiedOrient) { - return specifiedOrient; - } // If y is range and x is non-range, non-bin Q, y is likely a prebinned field - - - if (!x2) { - if (isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin) || isNumericDataDef(x)) { - return 'horizontal'; - } - } // If x is range and y is non-range, non-bin Q, x is likely a prebinned field - - - if (!y2) { - if (isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin) || isNumericDataDef(y)) { - return 'vertical'; - } - } - } - - // falls through - - case RULE: - // return undefined for line segment rule and bar with both axis ranged - // we have to ignore the case that the data are already binned - if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) { - return undefined; - } - - // falls through - - case AREA: - // If there are range for both x and y, y (vertical) has higher precedence. - if (y2) { - if (isFieldDef(y) && isBinned(y.bin)) { - return 'horizontal'; - } else { - return 'vertical'; - } - } else if (x2) { - if (isFieldDef(x) && isBinned(x.bin)) { - return 'vertical'; - } else { - return 'horizontal'; - } - } else if (mark === RULE) { - if (x && !y) { - return 'vertical'; - } else if (y && !x) { - return 'horizontal'; - } - } - - // falls through - - case LINE: - case TICK: - { - // Tick is opposite to bar, line, area and never have ranged mark. - var xIsContinuous = isContinuousFieldOrDatumDef(x); - var yIsContinuous = isContinuousFieldOrDatumDef(y); - - if (xIsContinuous && !yIsContinuous) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } else if (!xIsContinuous && yIsContinuous) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } else if (xIsContinuous && yIsContinuous) { - var xDef = x; // we can cast here since they are surely fieldDef - - var yDef = y; - var xIsTemporal = xDef.type === TEMPORAL; - var yIsTemporal = yDef.type === TEMPORAL; // temporal without timeUnit is considered continuous, but better serves as dimension - - if (xIsTemporal && !yIsTemporal) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } else if (!xIsTemporal && yIsTemporal) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - - if (!xDef.aggregate && yDef.aggregate) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } else if (xDef.aggregate && !yDef.aggregate) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - - if (specifiedOrient) { - // When ambiguous, use user specified one. - return specifiedOrient; - } - - return 'vertical'; - } else { - // Discrete x Discrete case - if (specifiedOrient) { - // When ambiguous, use user specified one. - return specifiedOrient; - } - - return undefined; - } - } - } - - return 'vertical'; - } - - var arc = { - vgMark: 'arc', - encodeEntry: function encodeEntry(model) { - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { - defaultPos: 'mid' - })), pointPosition('y', model, { - defaultPos: 'mid' - })), rectPosition(model, 'radius', 'arc')), rectPosition(model, 'theta', 'arc')); - } - }; - var area = { - vgMark: 'area', - encodeEntry: function encodeEntry(model) { - return Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'include', - size: 'ignore', - theta: 'ignore' - })), pointOrRangePosition('x', model, { - defaultPos: 'zeroOrMin', - defaultPos2: 'zeroOrMin', - range: model.markDef.orient === 'horizontal' - })), pointOrRangePosition('y', model, { - defaultPos: 'zeroOrMin', - defaultPos2: 'zeroOrMin', - range: model.markDef.orient === 'vertical' - })), defined(model)); - } - }; - var bar = { - vgMark: 'rect', - encodeEntry: function encodeEntry(model) { - return Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), rectPosition(model, 'x', 'bar')), rectPosition(model, 'y', 'bar')); - } - }; - var geoshape = { - vgMark: 'shape', - encodeEntry: function encodeEntry(model) { - return Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - })); - }, - postEncodingTransform: function postEncodingTransform(model) { - var encoding = model.encoding; - var shapeDef = encoding.shape; - var transform = Object.assign({ - type: 'geoshape', - projection: model.projectionName() - }, shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON ? { - field: _vgField(shapeDef, { - expr: 'datum' - }) - } : {}); - return [transform]; - } - }; - var image = { - vgMark: 'image', - encodeEntry: function encodeEntry(model) { - return Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'ignore', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), rectPosition(model, 'x', 'image')), rectPosition(model, 'y', 'image')), text(model, 'url')); - } - }; - var line = { - vgMark: 'line', - encodeEntry: function encodeEntry(model) { - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { - defaultPos: 'mid' - })), pointPosition('y', model, { - defaultPos: 'mid' - })), nonPosition('size', model, { - vgChannel: 'strokeWidth' // VL's line size is strokeWidth - - })), defined(model)); - } - }; - var trail = { - vgMark: 'trail', - encodeEntry: function encodeEntry(model) { - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'include', - orient: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { - defaultPos: 'mid' - })), pointPosition('y', model, { - defaultPos: 'mid' - })), nonPosition('size', model)), defined(model)); - } - }; - - function _encodeEntry(model, fixedShape) { - var config = model.config; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'include', - orient: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { - defaultPos: 'mid' - })), pointPosition('y', model, { - defaultPos: 'mid' - })), nonPosition('size', model)), nonPosition('angle', model)), shapeMixins(model, config, fixedShape)); - } - - function shapeMixins(model, config, fixedShape) { - if (fixedShape) { - return { - shape: { - value: fixedShape - } - }; - } - - return nonPosition('shape', model); - } - - var point = { - vgMark: 'symbol', - encodeEntry: function encodeEntry(model) { - return _encodeEntry(model); - } - }; - var circle = { - vgMark: 'symbol', - encodeEntry: function encodeEntry(model) { - return _encodeEntry(model, 'circle'); - } - }; - var square = { - vgMark: 'symbol', - encodeEntry: function encodeEntry(model) { - return _encodeEntry(model, 'square'); - } - }; - var rect = { - vgMark: 'rect', - encodeEntry: function encodeEntry(model) { - return Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), rectPosition(model, 'x', 'rect')), rectPosition(model, 'y', 'rect')); - } - }; - var rule = { - vgMark: 'rule', - encodeEntry: function encodeEntry(model) { - var markDef = model.markDef; - var orient = markDef.orient; - - if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) { - // Show nothing if we have none of x, y, lat, and long. - return {}; - } - - return Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), pointOrRangePosition('x', model, { - defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid', - defaultPos2: 'zeroOrMin', - range: orient !== 'vertical' // include x2 for horizontal or line segment rule - - })), pointOrRangePosition('y', model, { - defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid', - defaultPos2: 'zeroOrMin', - range: orient !== 'horizontal' // include y2 for vertical or line segment rule - - })), nonPosition('size', model, { - vgChannel: 'strokeWidth' // VL's rule size is strokeWidth - - })); - } - }; - var text$1 = { - vgMark: 'text', - encodeEntry: function encodeEntry(model) { - var config = model.config, - encoding = model.encoding; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'include', - baseline: 'include', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'include' - })), pointPosition('x', model, { - defaultPos: 'mid' - })), pointPosition('y', model, { - defaultPos: 'mid' - })), text(model)), nonPosition('size', model, { - vgChannel: 'fontSize' // VL's text size is fontSize - - })), nonPosition('angle', model)), valueIfDefined('align', align(model.markDef, encoding, config))), valueIfDefined('baseline', baseline(model.markDef, encoding, config))), pointPosition('radius', model, { - defaultPos: null, - isMidPoint: true - })), pointPosition('theta', model, { - defaultPos: null, - isMidPoint: true - })); - } - }; - - function align(markDef, encoding, config) { - var a = getMarkPropOrConfig('align', markDef, config); - - if (a === undefined) { - return 'center'; - } // If there is a config, Vega-parser will process this already. - - - return undefined; - } - - function baseline(markDef, encoding, config) { - var b = getMarkPropOrConfig('baseline', markDef, config); - - if (b === undefined) { - return 'middle'; - } // If there is a config, Vega-parser will process this already. - - - return undefined; - } - - var tick = { - vgMark: 'rect', - encodeEntry: function encodeEntry(model) { - var config = model.config, - markDef = model.markDef; - var orient = markDef.orient; - var vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; - var vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width'; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { - defaultPos: 'mid', - vgChannel: 'xc' - })), pointPosition('y', model, { - defaultPos: 'mid', - vgChannel: 'yc' - })), nonPosition('size', model, { - defaultValue: defaultSize(model), - vgChannel: vgSizeChannel - })), _defineProperty({}, vgThicknessChannel, signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config)))); - } - }; - - function defaultSize(model) { - var _a; - - var config = model.config, - markDef = model.markDef; - var orient = markDef.orient; - var vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; - var scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y'); - var markPropOrConfig = (_a = getMarkPropOrConfig('size', markDef, config, { - vgChannel: vgSizeChannel - })) !== null && _a !== void 0 ? _a : config.tick.bandSize; - - if (markPropOrConfig !== undefined) { - return markPropOrConfig; - } else { - var scaleRange = scale ? scale.get('range') : undefined; - - if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { - return scaleRange.step * 3 / 4; - } - - var defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel); - return defaultViewStep * 3 / 4; - } - } - - var markCompiler = { - arc: arc, - area: area, - bar: bar, - circle: circle, - geoshape: geoshape, - image: image, - line: line, - point: point, - rect: rect, - rule: rule, - square: square, - text: text$1, - tick: tick, - trail: trail - }; - - function parseMarkGroups(model) { - if (contains([LINE, AREA, TRAIL], model.mark)) { - var details = pathGroupingFields(model.mark, model.encoding); - - if (details.length > 0) { - return getPathGroups(model, details); - } // otherwise use standard mark groups - - } else if (contains([BAR], model.mark)) { - var hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(function (prop) { - return getMarkPropOrConfig(prop, model.markDef, model.config); - }); - - if (model.stack && !model.fieldDef('size') && hasCornerRadius) { - return getGroupsForStackedBarWithCornerRadius(model); - } - } - - return getMarkGroup(model); - } - - var FACETED_PATH_PREFIX = 'faceted_path_'; - - function getPathGroups(model, details) { - // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?) - return [{ - name: model.getName('pathgroup'), - type: 'group', - from: { - facet: { - name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main), - data: model.requestDataName(DataSourceType.Main), - groupby: details - } - }, - encode: { - update: { - width: { - field: { - group: 'width' - } - }, - height: { - field: { - group: 'height' - } - } - } - }, - // With subfacet for line/area group, need to use faceted data from above. - marks: getMarkGroup(model, { - fromPrefix: FACETED_PATH_PREFIX - }) - }]; - } - - var STACK_GROUP_PREFIX = 'stack_group_'; - /** - * We need to put stacked bars into groups in order to enable cornerRadius for stacks. - * If stack is used and the model doesn't have size encoding, we put the mark into groups, - * and apply cornerRadius properties at the group. - */ - - function getGroupsForStackedBarWithCornerRadius(model) { - // Generate the mark - var _getMarkGroup = getMarkGroup(model, { - fromPrefix: STACK_GROUP_PREFIX - }), - _getMarkGroup2 = _slicedToArray(_getMarkGroup, 1), - mark = _getMarkGroup2[0]; // Get the scale for the stacked field - - - var fieldScale = model.scaleName(model.stack.fieldChannel); - - var stackField = function stackField() { - var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - return model.vgField(model.stack.fieldChannel, opt); - }; // Find the min/max of the pixel value on the stacked direction - - - var stackFieldGroup = function stackFieldGroup(func, expr) { - var vgFieldMinMax = [stackField({ - prefix: 'min', - suffix: 'start', - expr: expr - }), stackField({ - prefix: 'max', - suffix: 'start', - expr: expr - }), stackField({ - prefix: 'min', - suffix: 'end', - expr: expr - }), stackField({ - prefix: 'max', - suffix: 'end', - expr: expr - })]; - return "".concat(func, "(").concat(vgFieldMinMax.map(function (field) { - return "scale('".concat(fieldScale, "',").concat(field, ")"); - }).join(','), ")"); - }; - - var groupUpdate; - var innerGroupUpdate; // Build the encoding for group and an inner group - - if (model.stack.fieldChannel === 'x') { - // Move cornerRadius, y/yc/y2/height properties to group - // Group x/x2 should be the min/max of the marks within - groupUpdate = Object.assign(Object.assign({}, pick(mark.encode.update, ['y', 'yc', 'y2', 'height'].concat(VG_CORNERRADIUS_CHANNELS))), { - x: { - signal: stackFieldGroup('min', 'datum') - }, - x2: { - signal: stackFieldGroup('max', 'datum') - }, - clip: { - value: true - } - }); // Inner group should revert the x translation, and pass height through - - innerGroupUpdate = { - x: { - field: { - group: 'x' - }, - mult: -1 - }, - height: { - field: { - group: 'height' - } - } - }; // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group) - // This is why size encoding is not supported yet - - mark.encode.update = Object.assign(Object.assign({}, omit(mark.encode.update, ['y', 'yc', 'y2'])), { - height: { - field: { - group: 'height' - } - } - }); - } else { - groupUpdate = Object.assign(Object.assign({}, pick(mark.encode.update, ['x', 'xc', 'x2', 'width'])), { - y: { - signal: stackFieldGroup('min', 'datum') - }, - y2: { - signal: stackFieldGroup('max', 'datum') - }, - clip: { - value: true - } - }); - innerGroupUpdate = { - y: { - field: { - group: 'y' - }, - mult: -1 - }, - width: { - field: { - group: 'width' - } - } - }; - mark.encode.update = Object.assign(Object.assign({}, omit(mark.encode.update, ['x', 'xc', 'x2'])), { - width: { - field: { - group: 'width' - } - } - }); - } // Deal with cornerRadius properties - - - var _iterator199 = _createForOfIteratorHelper(VG_CORNERRADIUS_CHANNELS), - _step199; - - try { - for (_iterator199.s(); !(_step199 = _iterator199.n()).done;) { - var key = _step199.value; - var configValue = getMarkConfig(key, model.markDef, model.config); // Move from mark to group - - if (mark.encode.update[key]) { - groupUpdate[key] = mark.encode.update[key]; - delete mark.encode.update[key]; - } else if (configValue) { - groupUpdate[key] = signalOrValueRef(configValue); - } // Overwrite any cornerRadius on mark set by config --- they are already moved to the group - - - if (configValue) { - mark.encode.update[key] = { - value: 0 - }; - } - } // For bin and time unit, we have to add bin/timeunit -end channels. - - } catch (err) { - _iterator199.e(err); - } finally { - _iterator199.f(); - } - - var groupByField = model.fieldDef(model.stack.groupbyChannel); - var groupby = _vgField(groupByField) ? [_vgField(groupByField)] : []; - - if ((groupByField === null || groupByField === void 0 ? void 0 : groupByField.bin) || (groupByField === null || groupByField === void 0 ? void 0 : groupByField.timeUnit)) { - groupby.push(_vgField(groupByField, { - binSuffix: 'end' - })); - } - - var strokeProperties = ['stroke', 'strokeWidth', 'strokeJoin', 'strokeCap', 'strokeDash', 'strokeDashOffset', 'strokeMiterLimit', 'strokeOpacity']; // Generate stroke properties for the group - - groupUpdate = strokeProperties.reduce(function (encode, prop) { - if (mark.encode.update[prop]) { - return Object.assign(Object.assign({}, encode), _defineProperty({}, prop, mark.encode.update[prop])); - } else { - var configValue = getMarkConfig(prop, model.markDef, model.config); - - if (configValue !== undefined) { - return Object.assign(Object.assign({}, encode), _defineProperty({}, prop, signalOrValueRef(configValue))); - } else { - return encode; - } - } - }, groupUpdate); // Apply strokeForeground and strokeOffset if stroke is used - - if (groupUpdate.stroke) { - groupUpdate.strokeForeground = { - value: true - }; - groupUpdate.strokeOffset = { - value: 0 - }; - } - - return [{ - type: 'group', - from: { - facet: { - data: model.requestDataName(DataSourceType.Main), - name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main), - groupby: groupby, - aggregate: { - fields: [stackField({ - suffix: 'start' - }), stackField({ - suffix: 'start' - }), stackField({ - suffix: 'end' - }), stackField({ - suffix: 'end' - })], - ops: ['min', 'max', 'min', 'max'] - } - } - }, - encode: { - update: groupUpdate - }, - marks: [{ - type: 'group', - encode: { - update: innerGroupUpdate - }, - marks: [mark] - }] - }]; - } - - function getSort$1(model) { - var encoding = model.encoding, - stack = model.stack, - mark = model.mark, - markDef = model.markDef, - config = model.config; - var order = encoding.order; - - if (!isArray(order) && isValueDef(order) && isNullOrFalse(order.value) || !order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config))) { - return undefined; - } else if ((isArray(order) || isFieldDef(order)) && !stack) { - // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.) - return sortParams(order, { - expr: 'datum' - }); - } else if (isPathMark(mark)) { - // For both line and area, we sort values based on dimension by default - var dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; - var dimensionChannelDef = encoding[dimensionChannel]; - - if (isFieldDef(dimensionChannelDef)) { - var s = dimensionChannelDef.sort; - - if (isArray(s)) { - return { - field: _vgField(dimensionChannelDef, { - prefix: dimensionChannel, - suffix: 'sort_index', - expr: 'datum' - }) - }; - } else if (isSortField(s)) { - return { - field: _vgField({ - // FIXME: this op might not already exist? - // FIXME: what if dimensionChannel (x or y) contains custom domain? - aggregate: isAggregate(model.encoding) ? s.op : undefined, - field: s.field - }, { - expr: 'datum' - }) - }; - } else if (isSortByEncoding(s)) { - var fieldDefToSort = model.fieldDef(s.encoding); - return { - field: _vgField(fieldDefToSort, { - expr: 'datum' - }), - order: s.order - }; - } else if (s === null) { - return undefined; - } else { - return { - field: _vgField(dimensionChannelDef, { - // For stack with imputation, we only have bin_mid - binSuffix: model.stack && model.stack.impute ? 'mid' : undefined, - expr: 'datum' - }) - }; - } - } - - return undefined; - } - - return undefined; - } - - function getMarkGroup(model) { - var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { - fromPrefix: '' - }; - var mark = model.mark, - markDef = model.markDef, - encoding = model.encoding, - config = model.config; - var clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model)); - var style = getStyles(markDef); - var key = encoding.key; - var sort = getSort$1(model); - var interactive = interactiveFlag(model); - var aria = getMarkPropOrConfig('aria', markDef, config); - var postEncodingTransform = markCompiler[mark].postEncodingTransform ? markCompiler[mark].postEncodingTransform(model) : null; - return [Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ - name: model.getName('marks'), - type: markCompiler[mark].vgMark - }, clip ? { - clip: true - } : {}), style ? { - style: style - } : {}), key ? { - key: key.field - } : {}), sort ? { - sort: sort - } : {}), interactive ? interactive : {}), aria === false ? { - aria: aria - } : {}), { - from: { - data: opt.fromPrefix + model.requestDataName(DataSourceType.Main) - }, - encode: { - update: markCompiler[mark].encodeEntry(model) - } - }), postEncodingTransform ? { - transform: postEncodingTransform - } : {})]; - } - /** - * If scales are bound to interval selections, we want to automatically clip - * marks to account for panning/zooming interactions. We identify bound scales - * by the selectionExtent property, which gets added during scale parsing. - */ - - - function scaleClip(model) { - var xScale = model.getScaleComponent('x'); - var yScale = model.getScaleComponent('y'); - return xScale && xScale.get('selectionExtent') || yScale && yScale.get('selectionExtent') ? true : undefined; - } - /** - * If we use a custom projection with auto-fitting to the geodata extent, - * we need to clip to ensure the chart size doesn't explode. - */ - - - function projectionClip(model) { - var projection = model.component.projection; - return projection && !projection.isFit ? true : undefined; - } - /** - * Only output interactive flags if we have selections defined somewhere in our model hierarchy. - */ - - - function interactiveFlag(model) { - if (!model.component.selection) return null; - var unitCount = keys(model.component.selection).length; - var parentCount = unitCount; - var parent = model.parent; - - while (parent && parentCount === 0) { - parentCount = keys(parent.component.selection).length; - parent = parent.parent; - } - - return parentCount ? { - interactive: unitCount > 0 - } : null; - } - /** - * Internal model of Vega-Lite specification for the compiler. - */ - - - var UnitModel = /*#__PURE__*/function (_ModelWithField2) { - _inherits(UnitModel, _ModelWithField2); - - var _super51 = _createSuper(UnitModel); - - function UnitModel(spec, parent, parentGivenName) { - var _this48; - - var parentGivenSize = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var config = arguments.length > 4 ? arguments[4] : undefined; - - _classCallCheck(this, UnitModel); - - _this48 = _super51.call(this, spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined); - _this48.specifiedScales = {}; - _this48.specifiedAxes = {}; - _this48.specifiedLegends = {}; - _this48.specifiedProjection = {}; - _this48.selection = {}; - _this48.children = []; - var markDef = isMarkDef(spec.mark) ? Object.assign({}, spec.mark) : { - type: spec.mark - }; - var mark = markDef.type; // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding - - if (markDef.filled === undefined) { - markDef.filled = defaultFilled(markDef, config, { - graticule: spec.data && isGraticuleGenerator(spec.data) - }); - } - - var encoding = _this48.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config); - _this48.markDef = initMarkdef(markDef, encoding, config); - _this48.size = initLayoutSize({ - encoding: encoding, - size: isFrameMixins(spec) ? Object.assign(Object.assign(Object.assign({}, parentGivenSize), spec.width ? { - width: spec.width - } : {}), spec.height ? { - height: spec.height - } : {}) : parentGivenSize - }); // calculate stack properties - - _this48.stack = stack(mark, encoding); - _this48.specifiedScales = _this48.initScales(mark, encoding); - _this48.specifiedAxes = _this48.initAxes(encoding); - _this48.specifiedLegends = _this48.initLegend(encoding); - _this48.specifiedProjection = spec.projection; // Selections will be initialized upon parse. - - _this48.selection = spec.selection; - return _this48; - } - - _createClass(UnitModel, [{ - key: "scaleDomain", - - /** - * Return specified Vega-Lite scale domain for a particular channel - * @param channel - */ - value: function scaleDomain(channel) { - var scale = this.specifiedScales[channel]; - return scale ? scale.domain : undefined; - } - }, { - key: "axis", - value: function axis(channel) { - return this.specifiedAxes[channel]; - } - }, { - key: "legend", - value: function legend(channel) { - return this.specifiedLegends[channel]; - } - }, { - key: "initScales", - value: function initScales(mark, encoding) { - return SCALE_CHANNELS.reduce(function (scales, channel) { - var _a; - - var fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - - if (fieldOrDatumDef) { - scales[channel] = (_a = fieldOrDatumDef.scale) !== null && _a !== void 0 ? _a : {}; - } - - return scales; - }, {}); - } - }, { - key: "initAxes", - value: function initAxes(encoding) { - return POSITION_SCALE_CHANNELS.reduce(function (_axis, channel) { - // Position Axis - // TODO: handle ConditionFieldDef - var channelDef = encoding[channel]; - - if (isFieldOrDatumDef(channelDef) || channel === X && isFieldOrDatumDef(encoding.x2) || channel === Y && isFieldOrDatumDef(encoding.y2)) { - var axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined; - _axis[channel] = axisSpec ? Object.assign({}, axisSpec) : axisSpec; // convert truthy value to object - } - - return _axis; - }, {}); - } - }, { - key: "initLegend", - value: function initLegend(encoding) { - return NONPOSITION_SCALE_CHANNELS.reduce(function (_legend, channel) { - var fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - - if (fieldOrDatumDef && supportLegend(channel)) { - var legend = fieldOrDatumDef.legend; - _legend[channel] = legend ? Object.assign({}, legend) : legend; // convert truthy value to object - } - - return _legend; - }, {}); - } - }, { - key: "parseData", - value: function parseData() { - this.component.data = _parseData(this); - } - }, { - key: "parseLayoutSize", - value: function parseLayoutSize() { - parseUnitLayoutSize(this); - } - }, { - key: "parseSelections", - value: function parseSelections() { - this.component.selection = parseUnitSelection(this, this.selection); - } - }, { - key: "parseMarkGroup", - value: function parseMarkGroup() { - this.component.mark = parseMarkGroups(this); - } - }, { - key: "parseAxesAndHeaders", - value: function parseAxesAndHeaders() { - this.component.axes = parseUnitAxes(this); - } - }, { - key: "assembleSelectionTopLevelSignals", - value: function assembleSelectionTopLevelSignals(signals) { - return assembleTopLevelSignals(this, signals); - } - }, { - key: "assembleSignals", - value: function assembleSignals() { - return [].concat(_toConsumableArray(assembleAxisSignals(this)), _toConsumableArray(assembleUnitSelectionSignals(this, []))); - } - }, { - key: "assembleSelectionData", - value: function assembleSelectionData(data) { - return assembleUnitSelectionData(this, data); - } - }, { - key: "assembleLayout", - value: function assembleLayout() { - return null; - } - }, { - key: "assembleLayoutSignals", - value: function assembleLayoutSignals() { - return _assembleLayoutSignals(this); - } - }, { - key: "assembleMarks", - value: function assembleMarks() { - var _a; - - var marks = (_a = this.component.mark) !== null && _a !== void 0 ? _a : []; // If this unit is part of a layer, selections should augment - // all in concert rather than each unit individually. This - // ensures correct interleaving of clipping and brushed marks. - - if (!this.parent || !isLayerModel(this.parent)) { - marks = assembleUnitSelectionMarks(this, marks); - } - - return marks.map(this.correctDataNames); - } - }, { - key: "getMapping", - value: function getMapping() { - return this.encoding; - } - }, { - key: "channelHasField", - value: function channelHasField(channel) { - return _channelHasField(this.encoding, channel); - } - }, { - key: "fieldDef", - value: function fieldDef(channel) { - var channelDef = this.encoding[channel]; - return getFieldDef(channelDef); - } - }, { - key: "typedFieldDef", - value: function typedFieldDef(channel) { - var fieldDef = this.fieldDef(channel); - - if (isTypedFieldDef(fieldDef)) { - return fieldDef; - } - - return null; - } - }, { - key: "hasProjection", - get: function get() { - var encoding = this.encoding; - var isGeoShapeMark = this.mark === GEOSHAPE; - var hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(function (channel) { - return isFieldOrDatumDef(encoding[channel]); - }); - return isGeoShapeMark || hasGeoPosition; - } - }, { - key: "mark", - get: function get() { - return this.markDef.type; - } - }]); - - return UnitModel; - }(ModelWithField); - - var LayerModel = /*#__PURE__*/function (_Model3) { - _inherits(LayerModel, _Model3); - - var _super52 = _createSuper(LayerModel); - - function LayerModel(spec, parent, parentGivenName, parentGivenSize, config) { - var _this49; - - _classCallCheck(this, LayerModel); - - _this49 = _super52.call(this, spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view); - var layoutSize = Object.assign(Object.assign(Object.assign({}, parentGivenSize), spec.width ? { - width: spec.width - } : {}), spec.height ? { - height: spec.height - } : {}); - _this49.children = spec.layer.map(function (layer, i) { - if (isLayerSpec(layer)) { - return new LayerModel(layer, _assertThisInitialized(_this49), _this49.getName('layer_' + i), layoutSize, config); - } else if (isUnitSpec(layer)) { - return new UnitModel(layer, _assertThisInitialized(_this49), _this49.getName('layer_' + i), layoutSize, config); - } - - throw new Error(invalidSpec(layer)); - }); - return _this49; - } - - _createClass(LayerModel, [{ - key: "parseData", - value: function parseData() { - this.component.data = _parseData(this); - - var _iterator200 = _createForOfIteratorHelper(this.children), - _step200; - - try { - for (_iterator200.s(); !(_step200 = _iterator200.n()).done;) { - var child = _step200.value; - child.parseData(); - } - } catch (err) { - _iterator200.e(err); - } finally { - _iterator200.f(); - } - } - }, { - key: "parseLayoutSize", - value: function parseLayoutSize() { - parseLayerLayoutSize(this); - } - }, { - key: "parseSelections", - value: function parseSelections() { - // Merge selections up the hierarchy so that they may be referenced - // across unit specs. Persist their definitions within each child - // to assemble signals which remain within output Vega unit groups. - this.component.selection = {}; - - var _iterator201 = _createForOfIteratorHelper(this.children), - _step201; - - try { - for (_iterator201.s(); !(_step201 = _iterator201.n()).done;) { - var child = _step201.value; - child.parseSelections(); - - var _iterator202 = _createForOfIteratorHelper(keys(child.component.selection)), - _step202; - - try { - for (_iterator202.s(); !(_step202 = _iterator202.n()).done;) { - var key = _step202.value; - this.component.selection[key] = child.component.selection[key]; - } - } catch (err) { - _iterator202.e(err); - } finally { - _iterator202.f(); - } - } - } catch (err) { - _iterator201.e(err); - } finally { - _iterator201.f(); - } - } - }, { - key: "parseMarkGroup", - value: function parseMarkGroup() { - var _iterator203 = _createForOfIteratorHelper(this.children), - _step203; - - try { - for (_iterator203.s(); !(_step203 = _iterator203.n()).done;) { - var child = _step203.value; - child.parseMarkGroup(); - } - } catch (err) { - _iterator203.e(err); - } finally { - _iterator203.f(); - } - } - }, { - key: "parseAxesAndHeaders", - value: function parseAxesAndHeaders() { - parseLayerAxes(this); - } - }, { - key: "assembleSelectionTopLevelSignals", - value: function assembleSelectionTopLevelSignals(signals) { - return this.children.reduce(function (sg, child) { - return child.assembleSelectionTopLevelSignals(sg); - }, signals); - } // TODO: Support same named selections across children. - - }, { - key: "assembleSignals", - value: function assembleSignals() { - return this.children.reduce(function (signals, child) { - return signals.concat(child.assembleSignals()); - }, assembleAxisSignals(this)); - } - }, { - key: "assembleLayoutSignals", - value: function assembleLayoutSignals() { - return this.children.reduce(function (signals, child) { - return signals.concat(child.assembleLayoutSignals()); - }, _assembleLayoutSignals(this)); - } - }, { - key: "assembleSelectionData", - value: function assembleSelectionData(data) { - return this.children.reduce(function (db, child) { - return child.assembleSelectionData(db); - }, data); - } - }, { - key: "assembleTitle", - value: function assembleTitle() { - var title = _get(_getPrototypeOf(LayerModel.prototype), "assembleTitle", this).call(this); - - if (title) { - return title; - } // If title does not provide layer, look into children - - - var _iterator204 = _createForOfIteratorHelper(this.children), - _step204; - - try { - for (_iterator204.s(); !(_step204 = _iterator204.n()).done;) { - var child = _step204.value; - title = child.assembleTitle(); - - if (title) { - return title; - } - } - } catch (err) { - _iterator204.e(err); - } finally { - _iterator204.f(); - } - - return undefined; - } - }, { - key: "assembleLayout", - value: function assembleLayout() { - return null; - } - }, { - key: "assembleMarks", - value: function assembleMarks() { - return assembleLayerSelectionMarks(this, this.children.flatMap(function (child) { - return child.assembleMarks(); - })); - } - }, { - key: "assembleLegends", - value: function assembleLegends() { - return this.children.reduce(function (legends, child) { - return legends.concat(child.assembleLegends()); - }, _assembleLegends(this)); - } - }]); - - return LayerModel; - }(Model); - - function buildModel(spec, parent, parentGivenName, unitSize, config) { - if (isFacetSpec(spec)) { - return new FacetModel(spec, parent, parentGivenName, config); - } else if (isLayerSpec(spec)) { - return new LayerModel(spec, parent, parentGivenName, unitSize, config); - } else if (isUnitSpec(spec)) { - return new UnitModel(spec, parent, parentGivenName, unitSize, config); - } else if (isAnyConcatSpec(spec)) { - return new ConcatModel(spec, parent, parentGivenName, config); - } - - throw new Error(invalidSpec(spec)); - } - /** - * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec. - * - * At a high-level, we make the following transformations in different phases: - * - * Input spec - * | - * | (Normalization) - * v - * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.) - * | - * | (Build Model) - * v - * A model tree of the spec - * | - * | (Parse) - * v - * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged) - * | - * | (Optimize) - * v - * A model tree with parsed components with the data component optimized - * | - * | (Assemble) - * v - * Vega spec - * - * @param inputSpec The Vega-Lite specification. - * @param opt Optional arguments passed to the Vega-Lite compiler. - * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec. - */ - - - function compile(inputSpec) { - var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - // 0. Augment opt with default opts - if (opt.logger) { - // set the singleton logger to the provided logger - set(opt.logger); - } - - if (opt.fieldTitle) { - // set the singleton field title formatter - setTitleFormatter(opt.fieldTitle); - } - - try { - // 1. Initialize config by deep merging default config with the config provided via option and the input spec. - var config = initConfig(mergeConfig(opt.config, inputSpec.config)); // 2. Normalize: Convert input spec -> normalized spec - // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec. - // - Normalize autosize and width or height spec - - var spec = normalize(inputSpec, config); // 3. Build Model: normalized spec -> Model (a tree structure) - // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors. - // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models. - - var model = buildModel(spec, null, '', undefined, config); // 4 Parse: Model --> Model with components - // Note that components = intermediate representations that are equivalent to Vega specs. - // We need these intermediate representation because we need to merge many visualization "components" like projections, scales, axes, and legends. - // We will later convert these components into actual Vega specs in the assemble phase. - // In this phase, we do a bottom-up traversal over the whole tree to - // parse for each type of components once (e.g., data, layout, mark, scale). - // By doing bottom-up traversal, we start parsing components of unit specs and - // then merge child components of parent composite specs. - // - // Please see inside model.parse() for order of different components parsed. - - model.parse(); // drawDataflow(model.component.data.sources); - // 5. Optimize the dataflow. This will modify the data component of the model. - - optimizeDataflow(model.component.data, model); // drawDataflow(model.component.data.sources); - // 6. Assemble: convert model components --> Vega Spec. - - var vgSpec = assembleTopLevelModel(model, getTopLevelProperties(inputSpec, spec.autosize, config, model), inputSpec.datasets, inputSpec.usermeta); - return { - spec: vgSpec, - normalized: spec - }; - } finally { - // Reset the singleton logger if a logger is provided - if (opt.logger) { - reset(); - } // Reset the singleton field title formatter if provided - - - if (opt.fieldTitle) { - resetTitleFormatter(); - } - } - } - - function getTopLevelProperties(inputSpec, autosize, config, model) { - var width = model.component.layoutSize.get('width'); - var height = model.component.layoutSize.get('height'); - - if (autosize === undefined) { - autosize = { - type: 'pad' - }; - - if (model.hasAxisOrientSignalRef()) { - autosize.resize = true; - } - } else if (isString(autosize)) { - autosize = { - type: autosize - }; - } - - if (width && height && isFitType(autosize.type)) { - if (width === 'step' && height === 'step') { - warn(droppingFit()); - autosize.type = 'pad'; - } else if (width === 'step' || height === 'step') { - // effectively XOR, because else if - // get step dimension - var sizeType = width === 'step' ? 'width' : 'height'; // log that we're dropping fit for respective channel - - warn(droppingFit(getPositionScaleChannel(sizeType))); // setting type to inverse fit (so if we dropped fit-x, type is now fit-y) - - var inverseSizeType = sizeType === 'width' ? 'height' : 'width'; - autosize.type = getFitType(inverseSizeType); - } - } - - return Object.assign(Object.assign(Object.assign({}, keys(autosize).length === 1 && autosize.type ? autosize.type === 'pad' ? {} : { - autosize: autosize.type - } : { - autosize: autosize - }), extractTopLevelProperties(config)), extractTopLevelProperties(inputSpec)); - } - /* - * Assemble the top-level model to a Vega spec. - * - * Note: this couldn't be `model.assemble()` since the top-level model - * needs some special treatment to generate top-level properties. - */ - - - function assembleTopLevelModel(model, topLevelProperties) { - var datasets = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var usermeta = arguments.length > 3 ? arguments[3] : undefined; - // Config with Vega-Lite only config removed. - var vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined; - var data = [].concat(model.assembleSelectionData([]), // only assemble data in the root - assembleRootData(model.component.data, datasets)); - var projections = model.assembleProjections(); - var title = model.assembleTitle(); - var style = model.assembleGroupStyle(); - var encodeEntry = model.assembleGroupEncodeEntry(true); - var layoutSignals = model.assembleLayoutSignals(); // move width and height signals with values to top level - - layoutSignals = layoutSignals.filter(function (signal) { - if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) { - topLevelProperties[signal.name] = +signal.value; - return false; - } - - return true; - }); - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ - $schema: 'https://vega.github.io/schema/vega/v5.json' - }, model.description ? { - description: model.description - } : {}), topLevelProperties), title ? { - title: title - } : {}), style ? { - style: style - } : {}), encodeEntry ? { - encode: { - update: encodeEntry - } - } : {}), { - data: data - }), projections.length > 0 ? { - projections: projections - } : {}), model.assembleGroup([].concat(_toConsumableArray(layoutSignals), _toConsumableArray(model.assembleSelectionTopLevelSignals([]))))), vgConfig ? { - config: vgConfig - } : {}), usermeta ? { - usermeta: usermeta - } : {}); - } - - exports.compile = compile; - exports.normalize = normalize; - exports.version = version; - Object.defineProperty(exports, '__esModule', { - value: true - }); -}); \ No newline at end of file diff --git a/node_modules/vega-lite/build/package.json b/node_modules/vega-lite/build/package.json deleted file mode 100644 index 833180b..0000000 --- a/node_modules/vega-lite/build/package.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "name": "vega-lite", - "author": "Dominik Moritz, Kanit \"Ham\" Wongsuphasawat, Arvind Satyanarayan, Jeffrey Heer", - "version": "4.14.0", - "collaborators": [ - "Kanit Wongsuphasawat (http://kanitw.yellowpigz.com)", - "Dominik Moritz (https://www.domoritz.de)", - "Arvind Satyanarayan (https://arvindsatya.com)", - "Jeffrey Heer (https://jheer.org)" - ], - "homepage": "https://vega.github.io/vega-lite/", - "description": "Vega-Lite is a concise high-level language for interactive visualization.", - "main": "build/vega-lite.js", - "unpkg": "build/vega-lite.min.js", - "jsdelivr": "build/vega-lite.min.js", - "module": "build/src/index", - "types": "build/src/index.d.ts", - "bin": { - "vl2png": "./bin/vl2png", - "vl2svg": "./bin/vl2svg", - "vl2pdf": "./bin/vl2pdf", - "vl2vg": "./bin/vl2vg" - }, - "directories": { - "test": "test" - }, - "scripts": { - "changelog": "conventional-changelog -p angular -r 2", - "build": "yarn build:only", - "build:only": "yarn tsc:src && rollup -c", - "postbuild": "terser build/vega-lite.js -cm --source-map content=build/vega-lite.js.map,filename=build/vega-lite.min.js.map -o build/vega-lite.min.js && yarn schema && babel build/vega-lite.js --out-dir build-es5 --config-file ./babel.config.js", - "prebuild:examples": "yarn build:only", - "build:examples": "yarn data && TZ=America/Los_Angeles scripts/build-examples.sh", - "prebuild:examples-full": "yarn build:only", - "build:examples-full": "TZ=America/Los_Angeles scripts/build-examples.sh 1", - "build:example": "TZ=America/Los_Angeles scripts/build-example.sh", - "build:toc": "yarn build:jekyll && scripts/generate-toc", - "build:site": "yarn tsc:site && rollup -c site/rollup.config.js", - "build:jekyll": "pushd site && bundle exec jekyll build -q && popd", - "build:versions": "scripts/update-version.sh", - "clean": "find build ! -name 'vega-lite-schema.json' -type f -delete && rm -rf site/data/* && rm -f examples/compiled/*.png && find site/examples ! -name 'index.md' ! -name 'data' -type f -delete", - "predeploy:site": "yarn presite", - "deploy:site": "gh-pages -d site", - "data": "rsync -r node_modules/vega-datasets/data/* site/data", - "schema": "mkdir -p build && ts-json-schema-generator -f tsconfig.json -p src/index.ts -t TopLevelSpec --no-type-check --no-ref-encode > build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/", - "renameschema": "scripts/rename-schema.sh", - "presite": "yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh", - "site": "pushd site && bundle exec jekyll serve -I -l && popd", - "tsc:src": "tsc -b src/tsconfig.src.json", - "tsc:site": "tsc -b site/tsconfig.site.json", - "prettierbase": "prettier '**/*.{md,css,yml}'", - "eslintbase": "eslint .", - "format": "yarn eslintbase --fix && yarn prettierbase --write", - "lint": "yarn eslintbase && yarn prettierbase --check", - "test": "jest test/ && yarn lint && yarn schema && jest examples/ && yarn test:runtime", - "test:inspect": "node --inspect-brk ./node_modules/.bin/jest --runInBand test", - "test:runtime": "TZ=America/Los_Angeles jest test-runtime/", - "test:runtime:generate": "yarn build:only && rm -Rf test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime", - "watch:build": "yarn build:only && concurrently --kill-others -n Typescript,Rollup 'yarn tsc:src -w' 'rollup -c -w'", - "watch:site": "concurrently --kill-others -n Typescript,Rollup 'yarn tsc:site -w' 'rollup -c site/rollup.config.js -w'", - "watch:test": "jest --watch" - }, - "repository": { - "type": "git", - "url": "https://github.com/vega/vega-lite.git" - }, - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/vega/vega-lite/issues" - }, - "devDependencies": { - "@babel/cli": "^7.10.4", - "@babel/core": "^7.10.4", - "@babel/preset-env": "^7.10.4", - "@rollup/plugin-commonjs": "14.0.0", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^8.4.0", - "@types/chai": "^4.2.11", - "@types/d3": "^5.7.2", - "@types/jest": "^26.0.4", - "@types/mkdirp": "^1.0.1", - "@types/pako": "^1.0.1", - "@types/puppeteer": "^3.0.1", - "@typescript-eslint/eslint-plugin": "^3.6.1", - "@typescript-eslint/parser": "^3.6.1", - "ajv": "^6.12.3", - "chai": "^4.2.0", - "cheerio": "^1.0.0-rc.3", - "codecov": "^3.7.0", - "concurrently": "^5.2.0", - "conventional-changelog-cli": "^2.0.34", - "d3": "^5.16.0", - "eslint": "^7.4.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-jest": "^23.18.0", - "eslint-plugin-prettier": "^3.1.4", - "gh-pages": "^3.1.0", - "highlight.js": "^10.1.1", - "jest": "^26.1.0", - "jest-puppeteer": "^4.4.0", - "mkdirp": "^1.0.4", - "pako": "^1.0.11", - "prettier": "^2.0.5", - "puppeteer": "^5.2.0", - "rollup": "^2.21.0", - "rollup-plugin-sourcemaps": "^0.6.2", - "rollup-plugin-terser": "^6.1.0", - "serve": "^11.3.2", - "svg2png-many": "^0.0.7", - "terser": "^4.8.0", - "ts-jest": "^26.1.2", - "ts-json-schema-generator": "^0.70.2", - "typescript": "~3.9.6", - "vega-cli": "^5.13.0", - "vega-datasets": "2.1.0", - "vega-embed": "^6.10.0", - "vega-tooltip": "^0.23.2", - "vega-typings": "^0.18.0", - "yaml-front-matter": "^4.1.0" - }, - "dependencies": { - "@types/clone": "~0.1.30", - "@types/fast-json-stable-stringify": "^2.0.0", - "array-flat-polyfill": "^1.0.1", - "clone": "~2.1.2", - "fast-deep-equal": "~3.1.3", - "fast-json-stable-stringify": "~2.1.0", - "json-stringify-pretty-compact": "~2.0.0", - "tslib": "~2.0.0", - "vega-event-selector": "~2.0.3", - "vega-expression": "~2.6.5", - "vega-util": "~1.14.1", - "yargs": "~15.4.1" - }, - "peerDependencies": { - "vega": "^5.13.0" - }, - "jest": { - "preset": "jest-puppeteer", - "transform": { - "^.+\\.tsx?$": "ts-jest" - }, - "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "jsx", - "json", - "node" - ], - "testPathIgnorePatterns": [ - "/node_modules", - "/build", - "/_site", - "/src" - ], - "coverageDirectory": "./coverage/", - "collectCoverage": false, - "setupFiles": [ - "./test/jest.overrides.ts" - ] - } -} diff --git a/node_modules/vega-lite/build/src/aggregate.d.ts b/node_modules/vega-lite/build/src/aggregate.d.ts deleted file mode 100644 index ce90c8f..0000000 --- a/node_modules/vega-lite/build/src/aggregate.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { AggregateOp } from 'vega'; -export declare const MULTIDOMAIN_SORT_OP_INDEX: { - count: number; - min: number; - max: number; -}; -export interface ArgminDef { - argmin: string; -} -export interface ArgmaxDef { - argmax: string; -} -export declare type NonArgAggregateOp = Exclude; -export declare type Aggregate = NonArgAggregateOp | ArgmaxDef | ArgminDef; -export declare function isArgminDef(a: Aggregate | string): a is ArgminDef; -export declare function isArgmaxDef(a: Aggregate | string): a is ArgmaxDef; -export declare const AGGREGATE_OPS: AggregateOp[]; -export declare function isAggregateOp(a: string | ArgminDef | ArgmaxDef): a is AggregateOp; -export declare const COUNTING_OPS: NonArgAggregateOp[]; -export declare function isCountingAggregateOp(aggregate?: string | Aggregate): boolean; -export declare function isMinMaxOp(aggregate?: Aggregate | string): boolean; -/** Additive-based aggregation operations. These can be applied to stack. */ -export declare const SUM_OPS: NonArgAggregateOp[]; -/** - * Aggregation operators that always produce values within the range [domainMin, domainMax]. - */ -export declare const SHARED_DOMAIN_OPS: AggregateOp[]; -export declare const SHARED_DOMAIN_OP_INDEX: { - [T: string]: true; -}; -//# sourceMappingURL=aggregate.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/aggregate.d.ts.map b/node_modules/vega-lite/build/src/aggregate.d.ts.map deleted file mode 100644 index 6fd88f0..0000000 --- a/node_modules/vega-lite/build/src/aggregate.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AA8BjC,eAAO,MAAM,yBAAyB;;;;CAIrC,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,oBAAY,iBAAiB,GAAG,OAAO,CAAC,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC;AAE1E,oBAAY,SAAS,GAAG,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;AAElE,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,CAAC,IAAI,SAAS,CAEjE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,CAAC,IAAI,SAAS,CAEjE;AAED,eAAO,MAAM,aAAa,eAA2B,CAAC;AAEtD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,CAAC,IAAI,WAAW,CAEjF;AAED,eAAO,MAAM,YAAY,EAAE,iBAAiB,EAA8C,CAAC;AAE3F,wBAAgB,qBAAqB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE7E;AAED,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAElE;AAED,4EAA4E;AAC5E,eAAO,MAAM,OAAO,EAAE,iBAAiB,EAAqD,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,EAA4D,CAAC;AAExG,eAAO,MAAM,sBAAsB;;CAA2B,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/aggregate.js b/node_modules/vega-lite/build/src/aggregate.js deleted file mode 100644 index bf0fee7..0000000 --- a/node_modules/vega-lite/build/src/aggregate.js +++ /dev/null @@ -1,57 +0,0 @@ -import { isString, toSet } from 'vega-util'; -import { contains, keys } from './util'; -const AGGREGATE_OP_INDEX = { - argmax: 1, - argmin: 1, - average: 1, - count: 1, - distinct: 1, - product: 1, - max: 1, - mean: 1, - median: 1, - min: 1, - missing: 1, - q1: 1, - q3: 1, - ci0: 1, - ci1: 1, - stderr: 1, - stdev: 1, - stdevp: 1, - sum: 1, - valid: 1, - values: 1, - variance: 1, - variancep: 1 -}; -export const MULTIDOMAIN_SORT_OP_INDEX = { - count: 1, - min: 1, - max: 1 -}; -export function isArgminDef(a) { - return !!a && !!a['argmin']; -} -export function isArgmaxDef(a) { - return !!a && !!a['argmax']; -} -export const AGGREGATE_OPS = keys(AGGREGATE_OP_INDEX); -export function isAggregateOp(a) { - return isString(a) && !!AGGREGATE_OP_INDEX[a]; -} -export const COUNTING_OPS = ['count', 'valid', 'missing', 'distinct']; -export function isCountingAggregateOp(aggregate) { - return isString(aggregate) && contains(COUNTING_OPS, aggregate); -} -export function isMinMaxOp(aggregate) { - return isString(aggregate) && contains(['min', 'max'], aggregate); -} -/** Additive-based aggregation operations. These can be applied to stack. */ -export const SUM_OPS = ['count', 'sum', 'distinct', 'valid', 'missing']; -/** - * Aggregation operators that always produce values within the range [domainMin, domainMax]. - */ -export const SHARED_DOMAIN_OPS = ['mean', 'average', 'median', 'q1', 'q3', 'min', 'max']; -export const SHARED_DOMAIN_OP_INDEX = toSet(SHARED_DOMAIN_OPS); -//# sourceMappingURL=aggregate.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/aggregate.js.map b/node_modules/vega-lite/build/src/aggregate.js.map deleted file mode 100644 index 9bfc322..0000000 --- a/node_modules/vega-lite/build/src/aggregate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../src/aggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAQ,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5C,MAAM,kBAAkB,GAAsB;IAC5C,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;IACV,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;IACN,OAAO,EAAE,CAAC;IACV,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;CACP,CAAC;AAcF,MAAM,UAAU,WAAW,CAAC,CAAqB;IAC/C,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAqB;IAC/C,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC;AAEtD,MAAM,UAAU,aAAa,CAAC,CAAiC;IAC7D,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAE3F,MAAM,UAAU,qBAAqB,CAAC,SAA8B;IAClE,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,SAA8B;IACvD,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;AACpE,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,OAAO,GAAwB,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AAE7F;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAExG,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/axis.d.ts b/node_modules/vega-lite/build/src/axis.d.ts deleted file mode 100644 index 638c441..0000000 --- a/node_modules/vega-lite/build/src/axis.d.ts +++ /dev/null @@ -1,276 +0,0 @@ -import { Align, Axis as VgAxis, AxisEncode, AxisOrient, BaseAxis, Color, FontStyle, FontWeight, LabelOverlap, SignalRef, TextBaseline, TimeInterval, TimeIntervalStep } from 'vega'; -import { ConditionalPredicate, Value, ValueDef } from './channeldef'; -import { DateTime } from './datetime'; -import { Guide, GuideEncodingEntry, TitleMixins, VlOnlyGuideConfig } from './guide'; -import { Flag } from './util'; -import { ExcludeMappedValueRefButKeepSignal, VgEncodeChannel } from './vega.schema'; -export declare type BaseAxisNoValueRefs = AxisOverrideMixins & VLOnlyAxisMixins & ExcludeMappedValueRefButKeepSignal; -interface AxisOverrideMixins { - /** - * The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate. - * - * __Default value__: `0` - */ - position?: number | SignalRef; - /** - * The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value. - */ - tickMinStep?: number | SignalRef; - /** - * A boolean flag indicating if grid lines should be included as part of the axis - * - * __Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`. - */ - grid?: boolean; - /** - * Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks. - * - * __Default value:__ `true` for axis of a continuous x-scale. Otherwise, `false`. - */ - labelFlush?: boolean | number; - /** - * The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `"parity"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `"greedy"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes). - * - * __Default value:__ `true` for non-nominal fields with non-log scales; `"greedy"` for log scales; otherwise `false`. - */ - labelOverlap?: LabelOverlap; - /** - * The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle. - * - * __Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default) - */ - offset?: number; - /** - * The orientation of the axis. One of `"top"`, `"bottom"`, `"left"` or `"right"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart). - * - * __Default value:__ `"bottom"` for x-axes and `"left"` for y-axes. - */ - orient?: AxisOrient | SignalRef; - /** - * A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are "nice" (multiples of 2, 5, 10) and lie within the underlying scale's range. - * - * For scales of type `"time"` or `"utc"`, the tick count can instead be a time interval specifier. Legal string values are `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and "year". Alternatively, an object-valued interval specifier of the form `{"interval": "month", "step": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary. - * - * __Default value__: Determine using a formula `ceil(width/40)` for x and `ceil(height/40)` for y. - * - * @minimum 0 - */ - tickCount?: number | TimeInterval | TimeIntervalStep | SignalRef; - /** - * Explicitly set the visible axis tick values. - */ - values?: number[] | string[] | boolean[] | DateTime[] | SignalRef; - /** - * A non-negative integer indicating the z-index of the axis. - * If zindex is 0, axes should be drawn behind all chart elements. - * To put them in front, set `zindex` to `1` or more. - * - * __Default value:__ `0` (behind the marks). - * - * @TJS-type integer - * @minimum 0 - */ - zindex?: number; -} -interface VLOnlyAxisMixins { - /** - * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels. - * - * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object. - */ - labelExpr?: string; - /** - * A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. - * - * __Default value:__ (none) - * __Note:__ Any specified style will augment the default style. For example, an x-axis mark with `"style": "foo"` will use `config.axisX` and `config.style.foo` (the specified style `"foo"` has higher precedence). - */ - style?: string | string[]; -} -export declare type SignalAxisProp = 'domainColor' | 'labelAlign' | 'labelColor' | 'gridColor' | 'tickColor' | 'titleColor' | 'title'; -export declare type ConditionalAxisProp = 'labelAlign' | 'labelBaseline' | 'labelColor' | 'labelFont' | 'labelFontSize' | 'labelFontStyle' | 'labelFontWeight' | 'labelOpacity' | 'labelOffset' | 'labelPadding' | 'gridColor' | 'gridDash' | 'gridDashOffset' | 'gridOpacity' | 'gridWidth' | 'tickColor' | 'tickDash' | 'tickDashOffset' | 'tickOpacity' | 'tickSize' | 'tickWidth'; -export declare const CONDITIONAL_AXIS_PROP_INDEX: Record; -export declare type ConditionalAxisProperty = (ValueDef | SignalRef) & { - condition: ConditionalPredicate | SignalRef> | ConditionalPredicate | SignalRef>[]; -}; -export declare function isConditionalAxisValue(v: any): v is ConditionalAxisProperty; -export declare type ConditionalAxisNumber = ConditionalAxisProperty; -export declare type ConditionalAxisLabelAlign = ConditionalAxisProperty; -export declare type ConditionalAxisLabelBaseline = ConditionalAxisProperty; -export declare type ConditionalAxisColor = ConditionalAxisProperty; -export declare type ConditionalAxisString = ConditionalAxisProperty; -export declare type ConditionalAxisLabelFontStyle = ConditionalAxisProperty; -export declare type ConditionalAxisLabelFontWeight = ConditionalAxisProperty; -export declare type ConditionalAxisNumberArray = ConditionalAxisProperty; -export declare type AxisConfigBaseWithConditionalAndSignal = Omit & AxisPropsWithConditionAndSignal; -export interface AxisPropsWithConditionAndSignal { - domainColor?: BaseAxisNoValueRefs['domainColor'] | SignalRef; - labelAlign?: BaseAxisNoValueRefs['labelAlign'] | ConditionalAxisLabelAlign; - labelBaseline?: BaseAxisNoValueRefs['labelBaseline'] | ConditionalAxisLabelBaseline; - labelColor?: BaseAxisNoValueRefs['labelColor'] | ConditionalAxisColor | SignalRef; - labelFont?: BaseAxisNoValueRefs['labelFont'] | ConditionalAxisString; - labelFontSize?: BaseAxisNoValueRefs['labelFontSize'] | ConditionalAxisNumber; - labelFontStyle?: BaseAxisNoValueRefs['labelFontStyle'] | ConditionalAxisLabelFontStyle; - labelFontWeight?: BaseAxisNoValueRefs['labelFontWeight'] | ConditionalAxisLabelFontWeight; - labelLineHeight?: BaseAxisNoValueRefs['labelLineHeight'] | ConditionalAxisNumber | SignalRef; - labelOpacity?: BaseAxisNoValueRefs['labelOpacity'] | ConditionalAxisNumber; - labelOffset?: BaseAxisNoValueRefs['labelOffset'] | ConditionalAxisNumber | SignalRef; - labelPadding?: BaseAxisNoValueRefs['labelPadding'] | ConditionalAxisNumber; - gridColor?: BaseAxisNoValueRefs['gridColor'] | ConditionalAxisColor | SignalRef; - gridDash?: BaseAxisNoValueRefs['gridDash'] | ConditionalAxisNumberArray; - gridDashOffset?: BaseAxisNoValueRefs['gridDashOffset'] | ConditionalAxisNumber; - gridOpacity?: BaseAxisNoValueRefs['gridOpacity'] | ConditionalAxisNumber; - gridWidth?: BaseAxisNoValueRefs['gridWidth'] | ConditionalAxisNumber; - tickColor?: BaseAxisNoValueRefs['tickColor'] | ConditionalAxisColor | SignalRef; - tickDash?: BaseAxisNoValueRefs['tickDash'] | ConditionalAxisNumberArray; - tickDashOffset?: BaseAxisNoValueRefs['tickDashOffset'] | ConditionalAxisNumber; - tickOpacity?: BaseAxisNoValueRefs['tickOpacity'] | ConditionalAxisNumber; - tickSize?: BaseAxisNoValueRefs['tickSize'] | ConditionalAxisNumber; - tickWidth?: BaseAxisNoValueRefs['tickWidth'] | ConditionalAxisNumber; - titleColor?: BaseAxisNoValueRefs['titleColor'] | SignalRef; - title?: TitleMixins['title']; -} -export declare type AxisConfig = Guide & VlOnlyGuideConfig & AxisConfigBaseWithConditionalAndSignal & { - /** - * Disable axis by default. - */ - disable?: boolean; -}; -export interface Axis extends AxisConfigBaseWithConditionalAndSignal, Guide { - /** - * Mark definitions for custom axis encoding. - * - * @hidden - */ - encoding?: AxisEncoding; -} -export declare type AxisPart = keyof AxisEncoding; -export declare const AXIS_PARTS: AxisPart[]; -/** - * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes. - */ -export declare const AXIS_PROPERTY_TYPE: Record; -export interface AxisEncoding { - /** - * Custom encoding for the axis container. - */ - axis?: GuideEncodingEntry; - /** - * Custom encoding for the axis domain rule mark. - */ - domain?: GuideEncodingEntry; - /** - * Custom encoding for axis gridline rule marks. - */ - grid?: GuideEncodingEntry; - /** - * Custom encoding for axis label text marks. - */ - labels?: GuideEncodingEntry; - /** - * Custom encoding for axis tick rule marks. - */ - ticks?: GuideEncodingEntry; - /** - * Custom encoding for the axis title text mark. - */ - title?: GuideEncodingEntry; -} -export declare const COMMON_AXIS_PROPERTIES_INDEX: Flag; -export declare function isAxisProperty(prop: string): prop is keyof Axis; -export declare const AXIS_PROPERTIES: ("orient" | "tickCount" | "aria" | "description" | "offset" | "titleAlign" | "titleAnchor" | "titleBaseline" | "titleColor" | "titleFont" | "titleFontSize" | "titleFontStyle" | "titleFontWeight" | "titleLimit" | "titleLineHeight" | "titleOpacity" | "titlePadding" | "labelAlign" | "labelBaseline" | "labelColor" | "labelFont" | "labelFontSize" | "labelFontStyle" | "labelFontWeight" | "labelLimit" | "labelOpacity" | "labelPadding" | "labelOffset" | "labelOverlap" | "labelSeparation" | "zindex" | "values" | "encoding" | "domain" | "title" | "labels" | "format" | "formatType" | "tickMinStep" | "labelExpr" | "titleAngle" | "labelAngle" | "labelLineHeight" | "translate" | "ticks" | "gridColor" | "gridDash" | "gridDashOffset" | "gridOpacity" | "gridWidth" | "tickColor" | "tickDash" | "tickDashOffset" | "tickOpacity" | "tickSize" | "tickWidth" | "domainColor" | "minExtent" | "maxExtent" | "bandPosition" | "titleX" | "titleY" | "domainCap" | "domainDash" | "domainDashOffset" | "domainOpacity" | "domainWidth" | "tickBand" | "tickCap" | "tickExtra" | "tickOffset" | "tickRound" | "grid" | "gridCap" | "labelBound" | "labelFlush" | "labelFlushOffset" | "position" | "style")[]; -export interface AxisConfigMixins { - /** - * Axis configuration, which determines default properties for all `x` and `y` [axes](https://vega.github.io/vega-lite/docs/axis.html). For a full list of axis configuration options, please see the [corresponding section of the axis documentation](https://vega.github.io/vega-lite/docs/axis.html#config). - */ - axis?: AxisConfig; - /** - * X-axis specific config. - */ - axisX?: AxisConfig; - /** - * Y-axis specific config. - */ - axisY?: AxisConfig; - /** - * Config for y-axis along the left edge of the chart. - */ - axisLeft?: AxisConfig; - /** - * Config for y-axis along the right edge of the chart. - */ - axisRight?: AxisConfig; - /** - * Config for x-axis along the top edge of the chart. - */ - axisTop?: AxisConfig; - /** - * Config for x-axis along the bottom edge of the chart. - */ - axisBottom?: AxisConfig; - /** - * Config for axes with "band" scales. - */ - axisBand?: AxisConfig; - /** - * Config for axes with "point" scales. - */ - axisPoint?: AxisConfig; - /** - * Config for axes with "point" or "band" scales. - */ - axisDiscrete?: AxisConfig; - /** - * Config for quantitative axes. - */ - axisQuantitative?: AxisConfig; - /** - * Config for temporal axes. - */ - axisTemporal?: AxisConfig; - /** - * Config for x-axes with "band" scales. - */ - axisXBand?: AxisConfig; - /** - * Config for x-axes with "point" scales. - */ - axisXPoint?: AxisConfig; - /** - * Config for x-axes with "point" or "band" scales. - */ - axisXDiscrete?: AxisConfig; - /** - * Config for x-quantitative axes. - */ - axisXQuantitative?: AxisConfig; - /** - * Config for x-temporal axes. - */ - axisXTemporal?: AxisConfig; - /** - * Config for y-axes with "band" scales. - */ - axisYBand?: AxisConfig; - /** - * Config for y-axes with "point" scales. - */ - axisYPoint?: AxisConfig; - /** - * Config for y-axes with "point" or "band" scales. - */ - axisYDiscrete?: AxisConfig; - /** - * Config for y-quantitative axes. - */ - axisYQuantitative?: AxisConfig; - /** - * Config for y-temporal axes. - */ - axisYTemporal?: AxisConfig; -} -export {}; -//# sourceMappingURL=axis.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/axis.d.ts.map b/node_modules/vega-lite/build/src/axis.d.ts.map deleted file mode 100644 index 957f61e..0000000 --- a/node_modules/vega-lite/build/src/axis.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../src/axis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,IAAI,IAAI,MAAM,EACd,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,EACjB,MAAM,MAAM,CAAC;AACd,OAAO,EAAC,oBAAoB,EAAE,KAAK,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AACnE,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAClF,OAAO,EAAC,IAAI,EAAO,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAC,kCAAkC,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAElF,oBAAY,mBAAmB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,kCAAkC,CAAC,QAAQ,CAAC,CAAC;AAEvH,UAAU,kBAAkB;IAG1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAGjC;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAE9B;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAEhC;;;;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deleted file mode 100644 index 87fb3ed..0000000 --- a/node_modules/vega-lite/build/src/axis.js +++ /dev/null @@ -1,260 +0,0 @@ -import { keys } from './util'; -export const CONDITIONAL_AXIS_PROP_INDEX = { - domainColor: { - part: 'domain', - vgProp: 'stroke' - }, - labelAlign: { - part: 'labels', - vgProp: 'align' - }, - labelBaseline: { - part: 'labels', - vgProp: 'baseline' - }, - labelColor: { - part: 'labels', - vgProp: 'fill' - }, - labelFont: { - part: 'labels', - vgProp: 'font' - }, - labelFontSize: { - part: 'labels', - vgProp: 'fontSize' - }, - labelFontStyle: { - part: 'labels', - vgProp: 'fontStyle' - }, - labelFontWeight: { - part: 'labels', - vgProp: 'fontWeight' - }, - labelOpacity: { - part: 'labels', - vgProp: 'opacity' - }, - labelOffset: null, - labelPadding: null, - gridColor: { - part: 'grid', - vgProp: 'stroke' - }, - gridDash: { - part: 'grid', - vgProp: 'strokeDash' - }, - gridDashOffset: { - part: 'grid', - vgProp: 'strokeDashOffset' - }, - gridOpacity: { - part: 'grid', - vgProp: 'opacity' - }, - gridWidth: { - part: 'grid', - vgProp: 'strokeWidth' - }, - tickColor: { - part: 'ticks', - vgProp: 'stroke' - }, - tickDash: { - part: 'ticks', - vgProp: 'strokeDash' - }, - tickDashOffset: { - part: 'ticks', - vgProp: 'strokeDashOffset' - }, - tickOpacity: { - part: 'ticks', - vgProp: 'opacity' - }, - tickSize: null, - tickWidth: { - part: 'ticks', - vgProp: 'strokeWidth' - }, - titleColor: { - part: 'title', - vgProp: 'fill' - }, - title: null // title supports signal, let's use it. -}; -export function isConditionalAxisValue(v) { - return v && v['condition']; -} -export const AXIS_PARTS = ['domain', 'grid', 'labels', 'ticks', 'title']; -/** - * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes. - */ -export const AXIS_PROPERTY_TYPE = { - grid: 'grid', - gridCap: 'grid', - gridColor: 'grid', - gridDash: 'grid', - gridDashOffset: 'grid', - gridOpacity: 'grid', - gridScale: 'grid', - gridWidth: 'grid', - orient: 'main', - bandPosition: 'both', - aria: 'main', - description: 'main', - domain: 'main', - domainCap: 'main', - domainColor: 'main', - domainDash: 'main', - domainDashOffset: 'main', - domainOpacity: 'main', - domainWidth: 'main', - format: 'main', - formatType: 'main', - labelAlign: 'main', - labelAngle: 'main', - labelBaseline: 'main', - labelBound: 'main', - labelColor: 'main', - labelFlush: 'main', - labelFlushOffset: 'main', - labelFont: 'main', - labelFontSize: 'main', - labelFontStyle: 'main', - labelFontWeight: 'main', - labelLimit: 'main', - labelLineHeight: 'main', - labelOffset: 'main', - labelOpacity: 'main', - labelOverlap: 'main', - labelPadding: 'main', - labels: 'main', - labelSeparation: 'main', - maxExtent: 'main', - minExtent: 'main', - offset: 'both', - position: 'main', - tickCap: 'main', - tickColor: 'main', - tickDash: 'main', - tickDashOffset: 'main', - tickMinStep: 'main', - tickOffset: 'both', - tickOpacity: 'main', - tickRound: 'both', - ticks: 'main', - tickSize: 'main', - tickWidth: 'both', - title: 'main', - titleAlign: 'main', - titleAnchor: 'main', - titleAngle: 'main', - titleBaseline: 'main', - titleColor: 'main', - titleFont: 'main', - titleFontSize: 'main', - titleFontStyle: 'main', - titleFontWeight: 'main', - titleLimit: 'main', - titleLineHeight: 'main', - titleOpacity: 'main', - titlePadding: 'main', - titleX: 'main', - titleY: 'main', - encode: 'both', - scale: 'both', - tickBand: 'both', - tickCount: 'both', - tickExtra: 'both', - translate: 'both', - values: 'both', - zindex: 'both' // this is actually set afterward, so it doesn't matter -}; -export const COMMON_AXIS_PROPERTIES_INDEX = { - orient: 1, - aria: 1, - bandPosition: 1, - description: 1, - domain: 1, - domainCap: 1, - domainColor: 1, - domainDash: 1, - domainDashOffset: 1, - domainOpacity: 1, - domainWidth: 1, - format: 1, - formatType: 1, - grid: 1, - gridCap: 1, - gridColor: 1, - gridDash: 1, - gridDashOffset: 1, - gridOpacity: 1, - gridWidth: 1, - labelAlign: 1, - labelAngle: 1, - labelBaseline: 1, - labelBound: 1, - labelColor: 1, - labelFlush: 1, - labelFlushOffset: 1, - labelFont: 1, - labelFontSize: 1, - labelFontStyle: 1, - labelFontWeight: 1, - labelLimit: 1, - labelLineHeight: 1, - labelOffset: 1, - labelOpacity: 1, - labelOverlap: 1, - labelPadding: 1, - labels: 1, - labelSeparation: 1, - maxExtent: 1, - minExtent: 1, - offset: 1, - position: 1, - tickBand: 1, - tickCap: 1, - tickColor: 1, - tickCount: 1, - tickDash: 1, - tickDashOffset: 1, - tickExtra: 1, - tickMinStep: 1, - tickOffset: 1, - tickOpacity: 1, - tickRound: 1, - ticks: 1, - tickSize: 1, - tickWidth: 1, - title: 1, - titleAlign: 1, - titleAnchor: 1, - titleAngle: 1, - titleBaseline: 1, - titleColor: 1, - titleFont: 1, - titleFontSize: 1, - titleFontStyle: 1, - titleFontWeight: 1, - titleLimit: 1, - titleLineHeight: 1, - titleOpacity: 1, - titlePadding: 1, - titleX: 1, - titleY: 1, - translate: 1, - values: 1, - zindex: 1 -}; -const AXIS_PROPERTIES_INDEX = Object.assign(Object.assign({}, COMMON_AXIS_PROPERTIES_INDEX), { style: 1, labelExpr: 1, encoding: 1 }); -export function isAxisProperty(prop) { - return !!AXIS_PROPERTIES_INDEX[prop]; -} -// Export for dependent projects -export const AXIS_PROPERTIES = keys(AXIS_PROPERTIES_INDEX); -//# sourceMappingURL=axis.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/axis.js.map b/node_modules/vega-lite/build/src/axis.js.map deleted file mode 100644 index 1eae13e..0000000 --- a/node_modules/vega-lite/build/src/axis.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"axis.js","sourceRoot":"","sources":["../../src/axis.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAO,IAAI,EAAC,MAAM,QAAQ,CAAC;AAsIlC,MAAM,CAAC,MAAM,2BAA2B,GAMpC;IACF,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,QAAQ;KACjB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,QA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AK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAChB,cAAc,EAAE,CAAC;IACjB,eAAe,EAAE,CAAC;IAClB,UAAU,EAAE,CAAC;IACb,eAAe,EAAE,CAAC;IAClB,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,CAAC;IACf,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,CAAC;IACZ,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,qBAAqB,mCACtB,4BAA4B,KAC/B,KAAK,EAAE,CAAC,EACR,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,GACZ,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,gCAAgC;AAChC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,qBAAqB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/bin.d.ts b/node_modules/vega-lite/build/src/bin.d.ts deleted file mode 100644 index 5585c4a..0000000 --- a/node_modules/vega-lite/build/src/bin.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { ExtendedChannel } from './channel'; -import { SelectionExtent } from './selection'; -export interface BaseBin { - /** - * The number base to use for automatic bin determination (default is base 10). - * - * __Default value:__ `10` - * - */ - base?: number; - /** - * An exact step size to use between bins. - * - * __Note:__ If provided, options such as maxbins will be ignored. - */ - step?: number; - /** - * An array of allowable step sizes to choose from. - * @minItems 1 - */ - steps?: number[]; - /** - * A minimum allowable step size (particularly useful for integer values). - */ - minstep?: number; - /** - * Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints. - * - * __Default value:__ `[5, 2]` - * - * @minItems 1 - */ - divide?: [number, number]; - /** - * Maximum number of bins. - * - * __Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels - * - * @minimum 2 - */ - maxbins?: number; - /** - * A value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value. - * - * __Default value:__ the minimum bin extent value - */ - anchor?: number; - /** - * If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten. - * - * __Default value:__ `true` - */ - nice?: boolean; -} -/** - * Binning properties or boolean flag for determining whether to bin data or not. - */ -export interface BinParams extends BaseBin { - /** - * A two-element (`[min, max]`) array indicating the range of desired bin values. - */ - extent?: BinExtent; - /** - * When set to `true`, Vega-Lite treats the input data as already binned. - */ - binned?: boolean; -} -export declare type Bin = boolean | BinParams | 'binned' | null; -export declare type BinExtent = [number, number] | SelectionExtent; -/** - * Create a key for the bin configuration. Not for prebinned bin. - */ -export declare function binToString(bin: BinParams | true): string; -/** - * Vega-Lite should bin the data. - */ -export declare function isBinning(bin: BinParams | boolean | 'binned'): bin is BinParams | true; -/** - * The data is already binned and so Vega-Lite should not bin it again. - */ -export declare function isBinned(bin: BinParams | boolean | 'binned'): bin is 'binned' | BinParams; -export declare function isBinParams(bin: BinParams | boolean | 'binned'): bin is BinParams; -export declare function isSelectionExtent(extent: BinExtent): extent is SelectionExtent; -export declare function autoMaxBins(channel?: ExtendedChannel): number; -//# sourceMappingURL=bin.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/bin.d.ts.map b/node_modules/vega-lite/build/src/bin.d.ts.map deleted file mode 100644 index 34c1a3a..0000000 --- a/node_modules/vega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GAAG,OAAO,GAAG,QAAQ,GAAG,GAAG,IAAI,QAAQ,GAAG,SAAS,CAEzF;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,GAAG,IAAI,SAAS,CAEjF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,IAAI,eAAe,CAE9E;AAED,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,MAAM,CAqB7D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/bin.js b/node_modules/vega-lite/build/src/bin.js deleted file mode 100644 index 6908d8c..0000000 --- a/node_modules/vega-lite/build/src/bin.js +++ /dev/null @@ -1,57 +0,0 @@ -import { isBoolean, isObject } from 'vega-util'; -import { COLOR, COLUMN, FILL, FILLOPACITY, OPACITY, ROW, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH } from './channel'; -import { normalizeBin } from './channeldef'; -import { keys, varName } from './util'; -/** - * Create a key for the bin configuration. Not for prebinned bin. - */ -export function binToString(bin) { - if (isBoolean(bin)) { - bin = normalizeBin(bin, undefined); - } - return ('bin' + - keys(bin) - .map(p => (isSelectionExtent(bin[p]) ? varName(`_${p}_${Object.entries(bin[p])}`) : varName(`_${p}_${bin[p]}`))) - .join('')); -} -/** - * Vega-Lite should bin the data. - */ -export function isBinning(bin) { - return bin === true || (isBinParams(bin) && !bin.binned); -} -/** - * The data is already binned and so Vega-Lite should not bin it again. - */ -export function isBinned(bin) { - return bin === 'binned' || (isBinParams(bin) && bin.binned === true); -} -export function isBinParams(bin) { - return isObject(bin); -} -export function isSelectionExtent(extent) { - return extent === null || extent === void 0 ? void 0 : extent['selection']; -} -export function autoMaxBins(channel) { - switch (channel) { - case ROW: - case COLUMN: - case SIZE: - case COLOR: - case FILL: - case STROKE: - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - // Facets and Size shouldn't have too many bins - // We choose 6 like shape to simplify the rule [falls through] - case SHAPE: - return 6; // Vega's "shape" has 6 distinct values - case STROKEDASH: - return 4; // We only provide 5 different stroke dash values (but 4 is more effective) - default: - return 10; - } -} -//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/bin.js.map b/node_modules/vega-lite/build/src/bin.js.map deleted file mode 100644 index 5751cc0..0000000 --- a/node_modules/vega-lite/build/src/bin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,KAAK,EACL,MAAM,EAEN,IAAI,EACJ,WAAW,EACX,OAAO,EACP,GAAG,EACH,KAAK,EACL,IAAI,EACJ,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AA0ErC;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAqB;IAC/C,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE;QAClB,GAAG,GAAG,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;KACpC;IACD,OAAO,CACL,KAAK;QACL,IAAI,CAAC,GAAG,CAAC;aACN,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aAC/G,IAAI,CAAC,EAAE,CAAC,CACZ,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,GAAmC;IAC3D,OAAO,GAAG,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAmC;IAC1D,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAmC;IAC7D,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,OAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,WAAW,EAAE;AAC/B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAyB;IACnD,QAAQ,OAAO,EAAE;QACf,KAAK,GAAG,CAAC;QACT,KAAK,MAAM,CAAC;QACZ,KAAK,IAAI,CAAC;QACV,KAAK,KAAK,CAAC;QACX,KAAK,IAAI,CAAC;QACV,KAAK,MAAM,CAAC;QACZ,KAAK,WAAW,CAAC;QACjB,KAAK,OAAO,CAAC;QACb,KAAK,WAAW,CAAC;QACjB,KAAK,aAAa,CAAC;QACnB,+CAA+C;QAC/C,8DAA8D;QAC9D,KAAK,KAAK;YACR,OAAO,CAAC,CAAC,CAAC,uCAAuC;QACnD,KAAK,UAAU;YACb,OAAO,CAAC,CAAC,CAAC,2EAA2E;QACvF;YACE,OAAO,EAAE,CAAC;KACb;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/channel.d.ts b/node_modules/vega-lite/build/src/channel.d.ts deleted file mode 100644 index e28a410..0000000 --- a/node_modules/vega-lite/build/src/channel.d.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { RangeType } from './compile/scale/type'; -import { Encoding } from './encoding'; -import { Mark } from './mark'; -import { EncodingFacetMapping } from './spec/facet'; -export declare type Channel = keyof Encoding; -export declare type ExtendedChannel = Channel | FacetChannel; -export declare const ROW: "row"; -export declare const COLUMN: "column"; -export declare const FACET: "facet"; -export declare const X: "x"; -export declare const Y: "y"; -export declare const X2: "x2"; -export declare const Y2: "y2"; -export declare const RADIUS: "radius"; -export declare const RADIUS2: "radius2"; -export declare const THETA: "theta"; -export declare const THETA2: "theta2"; -export declare const LATITUDE: "latitude"; -export declare const LONGITUDE: "longitude"; -export declare const LATITUDE2: "latitude2"; -export declare const LONGITUDE2: "longitude2"; -export declare const COLOR: "color"; -export declare const FILL: "fill"; -export declare const STROKE: "stroke"; -export declare const SHAPE: "shape"; -export declare const SIZE: "size"; -export declare const ANGLE: "angle"; -export declare const OPACITY: "opacity"; -export declare const FILLOPACITY: "fillOpacity"; -export declare const STROKEOPACITY: "strokeOpacity"; -export declare const STROKEWIDTH: "strokeWidth"; -export declare const STROKEDASH: "strokeDash"; -export declare const TEXT: "text"; -export declare const ORDER: "order"; -export declare const DETAIL: "detail"; -export declare const KEY: "key"; -export declare const TOOLTIP: "tooltip"; -export declare const HREF: "href"; -export declare const URL: "url"; -export declare const DESCRIPTION: "description"; -declare const POSITION_CHANNEL_INDEX: { - readonly x: 1; - readonly y: 1; - readonly x2: 1; - readonly y2: 1; -}; -export declare type PositionChannel = keyof typeof POSITION_CHANNEL_INDEX; -declare const POLAR_POSITION_CHANNEL_INDEX: { - readonly theta: 1; - readonly theta2: 1; - readonly radius: 1; - readonly radius2: 1; -}; -export declare type PolarPositionChannel = keyof typeof POLAR_POSITION_CHANNEL_INDEX; -export declare function isPolarPositionChannel(c: Channel): c is PolarPositionChannel; -declare const GEO_POSIITON_CHANNEL_INDEX: { - readonly longitude: 1; - readonly longitude2: 1; - readonly latitude: 1; - readonly latitude2: 1; -}; -export declare type GeoPositionChannel = keyof typeof GEO_POSIITON_CHANNEL_INDEX; -export declare function getPositionChannelFromLatLong(channel: GeoPositionChannel): PositionChannel; -export declare function isGeoPositionChannel(c: Channel): c is GeoPositionChannel; -export declare const GEOPOSITION_CHANNELS: ("longitude" | "latitude" | "longitude2" | "latitude2")[]; -export declare type ColorChannel = 'color' | 'fill' | 'stroke'; -export declare function isColorChannel(channel: Channel): channel is ColorChannel; -export declare type FacetChannel = keyof EncodingFacetMapping; -export declare const FACET_CHANNELS: ("facet" | "row" | "column")[]; -export declare const CHANNELS: ExtendedChannel[]; -/** - * Channels that cannot have an array of channelDef. - * model.fieldDef, getFieldDef only work for these channels. - * - * (The only two channels that can have an array of channelDefs are "detail" and "order". - * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef - * are not applicable for them. Similarly, selection projection won't work with "detail" and "order".) - */ -export declare const SINGLE_DEF_CHANNELS: ("stroke" | "color" | "text" | "shape" | "description" | "x" | "y" | "x2" | "y2" | "longitude" | "latitude" | "longitude2" | "latitude2" | "theta" | "theta2" | "radius" | "radius2" | "fill" | "opacity" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "strokeDash" | "size" | "angle" | "key" | "href" | "url" | "facet" | "row" | "column")[]; -export declare type SingleDefChannel = typeof SINGLE_DEF_CHANNELS[number]; -export declare const SINGLE_DEF_UNIT_CHANNELS: ("stroke" | "color" | "text" | "shape" | "description" | "x" | "y" | "x2" | "y2" | "longitude" | "latitude" | "longitude2" | "latitude2" | "theta" | "theta2" | "radius" | "radius2" | "fill" | "opacity" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "strokeDash" | "size" | "angle" | "key" | "href" | "url")[]; -export declare type SingleDefUnitChannel = typeof SINGLE_DEF_UNIT_CHANNELS[number]; -export declare function isSingleDefUnitChannel(str: string): str is SingleDefUnitChannel; -export declare function isChannel(str: string): str is Channel; -export declare type SecondaryRangeChannel = 'x2' | 'y2' | 'latitude2' | 'longitude2' | 'theta2' | 'radius2'; -export declare const SECONDARY_RANGE_CHANNEL: SecondaryRangeChannel[]; -export declare function isSecondaryRangeChannel(c: ExtendedChannel): c is SecondaryRangeChannel; -export declare type MainChannelOf = C extends 'x2' ? 'x' : C extends 'y2' ? 'y' : C extends 'latitude2' ? 'latitude' : C extends 'longitude2' ? 'longitude' : C extends 'theta2' ? 'theta' : C extends 'radius2' ? 'radius' : C; -/** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ -export declare function getMainRangeChannel(channel: C): MainChannelOf; -export declare type SecondaryChannelOf = C extends 'x' ? 'x2' : C extends 'y' ? 'y2' : C extends 'latitude' ? 'latitude2' : C extends 'longitude' ? 'longitude2' : C extends 'theta' ? 'theta2' : C extends 'radius' ? 'radius2' : undefined; -export declare function getVgPositionChannel(channel: PolarPositionChannel | PositionChannel): "x" | "y" | "x2" | "y2" | "innerRadius" | "outerRadius" | "startAngle" | "endAngle"; -/** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ -export declare function getSecondaryRangeChannel(channel: C): SecondaryChannelOf | undefined; -export declare function getSizeChannel(channel: PositionChannel): 'width' | 'height'; -export declare function getSizeChannel(channel: Channel): 'width' | 'height' | undefined; -/** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ -export declare function getOffsetChannel(channel: Channel): "xOffset" | "yOffset" | "x2Offset" | "y2Offset" | "thetaOffset" | "radiusOffset" | "theta2Offset" | "radius2Offset"; -export declare const UNIT_CHANNELS: ("stroke" | "color" | "text" | "shape" | "description" | "x" | "y" | "x2" | "y2" | "longitude" | "latitude" | "longitude2" | "latitude2" | "theta" | "theta2" | "radius" | "radius2" | "fill" | "opacity" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "strokeDash" | "size" | "angle" | "detail" | "key" | "tooltip" | "href" | "url" | "order")[]; -export declare const NONPOSITION_CHANNELS: ("stroke" | "color" | "text" | "shape" | "description" | "fill" | "opacity" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "strokeDash" | "size" | "angle" | "detail" | "key" | "tooltip" | "href" | "url" | "order")[]; -export declare type NonPositionChannel = typeof NONPOSITION_CHANNELS[number]; -export declare const POSITION_SCALE_CHANNEL_INDEX: { - readonly x: 1; - readonly y: 1; -}; -export declare const POSITION_SCALE_CHANNELS: ("x" | "y")[]; -export declare type PositionScaleChannel = keyof typeof POSITION_SCALE_CHANNEL_INDEX; -export declare function isXorY(channel: ExtendedChannel): channel is PositionScaleChannel; -export declare const POLAR_POSITION_SCALE_CHANNEL_INDEX: { - readonly theta: 1; - readonly radius: 1; -}; -export declare const POLAR_POSITION_SCALE_CHANNELS: ("theta" | "radius")[]; -export declare type PolarPositionScaleChannel = keyof typeof POLAR_POSITION_SCALE_CHANNEL_INDEX; -export declare function getPositionScaleChannel(sizeType: 'width' | 'height'): PositionScaleChannel; -export declare const NONPOSITION_SCALE_CHANNELS: ("stroke" | "color" | "shape" | "fill" | "opacity" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "strokeDash" | "size" | "angle")[]; -export declare type NonPositionScaleChannel = typeof NONPOSITION_SCALE_CHANNELS[number]; -export declare function isNonPositionScaleChannel(channel: Channel): channel is NonPositionScaleChannel; -/** - * @returns whether Vega supports legends for a particular channel - */ -export declare function supportLegend(channel: NonPositionScaleChannel): boolean; -/** List of channels with scales */ -export declare const SCALE_CHANNELS: ("stroke" | "color" | "shape" | "x" | "y" | "theta" | "radius" | "fill" | "opacity" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "strokeDash" | "size" | "angle")[]; -export declare type ScaleChannel = typeof SCALE_CHANNELS[number]; -export declare function isScaleChannel(channel: Channel): channel is ScaleChannel; -export declare type SupportedMark = Partial>; -/** - * Return whether a channel supports a particular mark type. - * @param channel channel name - * @param mark the mark type - * @return whether the mark supports the channel - */ -export declare function supportMark(channel: Channel, mark: Mark): "binned" | "always"; -export declare function rangeType(channel: ExtendedChannel): RangeType; -export {}; -//# sourceMappingURL=channel.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/channel.d.ts.map b/node_modules/vega-lite/build/src/channel.d.ts.map deleted file mode 100644 index 6275b2a..0000000 --- a/node_modules/vega-lite/build/src/channel.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/channel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAGlD,oBAAY,OAAO,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC1C,oBAAY,eAAe,GAAG,OAAO,GAAG,YAAY,CAAC;AAGrD,eAAO,MAAM,GAAG,OAAiB,CAAC;AAClC,eAAO,MAAM,MAAM,UAAoB,CAAC;AAExC,eAAO,MAAM,KAAK,SAAmB,CAAC;AAGtC,eAAO,MAAM,CAAC,KAAe,CAAC;AAC9B,eAAO,MAAM,CAAC,KAAe,CAAC;AAC9B,eAAO,MAAM,EAAE,MAAgB,CAAC;AAChC,eAAO,MAAM,EAAE,MAAgB,CAAC;AAGhC,eAAO,MAAM,MAAM,UAAoB,CAAC;AACxC,eAAO,MAAM,OAAO,WAAqB,CAAC;AAC1C,eAAO,MAAM,KAAK,SAAmB,CAAC;AACtC,eAAO,MAAM,MAAM,UAAoB,CAAC;AAGxC,eAAO,MAAM,QAAQ,YAAsB,CAAC;AAC5C,eAAO,MAAM,SAAS,aAAuB,CAAC;AAC9C,eAAO,MAAM,SAAS,aAAuB,CAAC;AAC9C,eAAO,MAAM,UAAU,cAAwB,CAAC;AAGhD,eAAO,MAAM,KAAK,SAAmB,CAAC;AAEtC,eAAO,MAAM,IAAI,QAAkB,CAAC;AAEpC,eAAO,MAAM,MAAM,UAAoB,CAAC;AAExC,eAAO,MAAM,KAAK,SAAmB,CAAC;AACtC,eAAO,MAAM,IAAI,QAAkB,CAAC;A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AkBD,eAAO,MAAM,0BAA0B,2IAAwC,CAAC;AAChF,oBAAY,uBAAuB,GAAG,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAEhF,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,uBAAuB,CAE9F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,uBAAuB,WAgB7D;AASD,mCAAmC;AACnC,eAAO,MAAM,cAAc,4KAA4B,CAAC;AACxD,oBAAY,YAAY,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAEzD,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,YAAY,CAExE;AAED,oBAAY,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,uBAEvD;AAmHD,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,CAkD7D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/channel.js b/node_modules/vega-lite/build/src/channel.js deleted file mode 100644 index 31c74f0..0000000 --- a/node_modules/vega-lite/build/src/channel.js +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Constants and utilities for encoding channels (Visual variables) - * such as 'x', 'y', 'color'. - */ -import { __rest } from "tslib"; -import { keys } from './util'; -// Facet -export const ROW = 'row'; -export const COLUMN = 'column'; -export const FACET = 'facet'; -// Position -export const X = 'x'; -export const Y = 'y'; -export const X2 = 'x2'; -export const Y2 = 'y2'; -// Arc-Position -export const RADIUS = 'radius'; -export const RADIUS2 = 'radius2'; -export const THETA = 'theta'; -export const THETA2 = 'theta2'; -// Geo Position -export const LATITUDE = 'latitude'; -export const LONGITUDE = 'longitude'; -export const LATITUDE2 = 'latitude2'; -export const LONGITUDE2 = 'longitude2'; -// Mark property with scale -export const COLOR = 'color'; -export const FILL = 'fill'; -export const STROKE = 'stroke'; -export const SHAPE = 'shape'; -export const SIZE = 'size'; -export const ANGLE = 'angle'; -export const OPACITY = 'opacity'; -export const FILLOPACITY = 'fillOpacity'; -export const STROKEOPACITY = 'strokeOpacity'; -export const STROKEWIDTH = 'strokeWidth'; -export const STROKEDASH = 'strokeDash'; -// Non-scale channel -export const TEXT = 'text'; -export const ORDER = 'order'; -export const DETAIL = 'detail'; -export const KEY = 'key'; -export const TOOLTIP = 'tooltip'; -export const HREF = 'href'; -export const URL = 'url'; -export const DESCRIPTION = 'description'; -const POSITION_CHANNEL_INDEX = { - x: 1, - y: 1, - x2: 1, - y2: 1 -}; -const POLAR_POSITION_CHANNEL_INDEX = { - theta: 1, - theta2: 1, - radius: 1, - radius2: 1 -}; -export function isPolarPositionChannel(c) { - return c in POLAR_POSITION_CHANNEL_INDEX; -} -const GEO_POSIITON_CHANNEL_INDEX = { - longitude: 1, - longitude2: 1, - latitude: 1, - latitude2: 1 -}; -export function getPositionChannelFromLatLong(channel) { - switch (channel) { - case LATITUDE: - return 'y'; - case LATITUDE2: - return 'y2'; - case LONGITUDE: - return 'x'; - case LONGITUDE2: - return 'x2'; - } -} -export function isGeoPositionChannel(c) { - return c in GEO_POSIITON_CHANNEL_INDEX; -} -export const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX); -const UNIT_CHANNEL_INDEX = Object.assign(Object.assign(Object.assign(Object.assign({}, POSITION_CHANNEL_INDEX), POLAR_POSITION_CHANNEL_INDEX), GEO_POSIITON_CHANNEL_INDEX), { - // color - color: 1, fill: 1, stroke: 1, - // other non-position with scale - opacity: 1, fillOpacity: 1, strokeOpacity: 1, strokeWidth: 1, strokeDash: 1, size: 1, angle: 1, shape: 1, - // channels without scales - order: 1, text: 1, detail: 1, key: 1, tooltip: 1, href: 1, url: 1, description: 1 }); -export function isColorChannel(channel) { - return channel === COLOR || channel === FILL || channel === STROKE; -} -const FACET_CHANNEL_INDEX = { - row: 1, - column: 1, - facet: 1 -}; -export const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX); -const CHANNEL_INDEX = Object.assign(Object.assign({}, UNIT_CHANNEL_INDEX), FACET_CHANNEL_INDEX); -export const CHANNELS = keys(CHANNEL_INDEX); -const { order: _o, detail: _d, tooltip: _tt1 } = CHANNEL_INDEX, SINGLE_DEF_CHANNEL_INDEX = __rest(CHANNEL_INDEX, ["order", "detail", "tooltip"]); -const { row: _r, column: _c, facet: _f } = SINGLE_DEF_CHANNEL_INDEX, SINGLE_DEF_UNIT_CHANNEL_INDEX = __rest(SINGLE_DEF_CHANNEL_INDEX, ["row", "column", "facet"]); -/** - * Channels that cannot have an array of channelDef. - * model.fieldDef, getFieldDef only work for these channels. - * - * (The only two channels that can have an array of channelDefs are "detail" and "order". - * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef - * are not applicable for them. Similarly, selection projection won't work with "detail" and "order".) - */ -export const SINGLE_DEF_CHANNELS = keys(SINGLE_DEF_CHANNEL_INDEX); -export const SINGLE_DEF_UNIT_CHANNELS = keys(SINGLE_DEF_UNIT_CHANNEL_INDEX); -export function isSingleDefUnitChannel(str) { - return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str]; -} -export function isChannel(str) { - return !!CHANNEL_INDEX[str]; -} -export const SECONDARY_RANGE_CHANNEL = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2]; -export function isSecondaryRangeChannel(c) { - const main = getMainRangeChannel(c); - return main !== c; -} -/** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ -export function getMainRangeChannel(channel) { - switch (channel) { - case X2: - return X; - case Y2: - return Y; - case LATITUDE2: - return LATITUDE; - case LONGITUDE2: - return LONGITUDE; - case THETA2: - return THETA; - case RADIUS2: - return RADIUS; - } - return channel; -} -export function getVgPositionChannel(channel) { - if (isPolarPositionChannel(channel)) { - switch (channel) { - case THETA: - return 'startAngle'; - case THETA2: - return 'endAngle'; - case RADIUS: - return 'outerRadius'; - case RADIUS2: - return 'innerRadius'; - } - } - return channel; -} -/** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ -export function getSecondaryRangeChannel(channel) { - switch (channel) { - case X: - return X2; - case Y: - return Y2; - case LATITUDE: - return LATITUDE2; - case LONGITUDE: - return LONGITUDE2; - case THETA: - return THETA2; - case RADIUS: - return RADIUS2; - } - return undefined; -} -export function getSizeChannel(channel) { - switch (channel) { - case X: - case X2: - return 'width'; - case Y: - case Y2: - return 'height'; - } - return undefined; -} -/** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ -export function getOffsetChannel(channel) { - switch (channel) { - case X: - return 'xOffset'; - case Y: - return 'yOffset'; - case X2: - return 'x2Offset'; - case Y2: - return 'y2Offset'; - case THETA: - return 'thetaOffset'; - case RADIUS: - return 'radiusOffset'; - case THETA2: - return 'theta2Offset'; - case RADIUS2: - return 'radius2Offset'; - } - return undefined; -} -// CHANNELS without COLUMN, ROW -export const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX); -// NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2; -const { x: _x, y: _y, -// x2 and y2 share the same scale as x and y -x2: _x2, y2: _y2, latitude: _latitude, longitude: _longitude, latitude2: _latitude2, longitude2: _longitude2, theta: _theta, theta2: _theta2, radius: _radius, radius2: _radius2 } = UNIT_CHANNEL_INDEX, -// The rest of unit channels then have scale -NONPOSITION_CHANNEL_INDEX = __rest(UNIT_CHANNEL_INDEX, ["x", "y", "x2", "y2", "latitude", "longitude", "latitude2", "longitude2", "theta", "theta2", "radius", "radius2"]); -export const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX); -export const POSITION_SCALE_CHANNEL_INDEX = { - x: 1, - y: 1 -}; -export const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX); -export function isXorY(channel) { - return channel in POSITION_SCALE_CHANNEL_INDEX; -} -export const POLAR_POSITION_SCALE_CHANNEL_INDEX = { - theta: 1, - radius: 1 -}; -export const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX); -export function getPositionScaleChannel(sizeType) { - return sizeType === 'width' ? X : Y; -} -// NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without X, Y -const { -// x2 and y2 share the same scale as x and y -// text and tooltip have format instead of scale, -// href has neither format, nor scale -text: _t, tooltip: _tt, href: _hr, url: _u, description: _al, -// detail and order have no scale -detail: _dd, key: _k, order: _oo } = NONPOSITION_CHANNEL_INDEX, NONPOSITION_SCALE_CHANNEL_INDEX = __rest(NONPOSITION_CHANNEL_INDEX, ["text", "tooltip", "href", "url", "description", "detail", "key", "order"]); -export const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX); -export function isNonPositionScaleChannel(channel) { - return !!NONPOSITION_CHANNEL_INDEX[channel]; -} -/** - * @returns whether Vega supports legends for a particular channel - */ -export function supportLegend(channel) { - switch (channel) { - case COLOR: - case FILL: - case STROKE: - case SIZE: - case SHAPE: - case OPACITY: - case STROKEWIDTH: - case STROKEDASH: - return true; - case FILLOPACITY: - case STROKEOPACITY: - case ANGLE: - return false; - } -} -// Declare SCALE_CHANNEL_INDEX -const SCALE_CHANNEL_INDEX = Object.assign(Object.assign(Object.assign({}, POSITION_SCALE_CHANNEL_INDEX), POLAR_POSITION_SCALE_CHANNEL_INDEX), NONPOSITION_SCALE_CHANNEL_INDEX); -/** List of channels with scales */ -export const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX); -export function isScaleChannel(channel) { - return !!SCALE_CHANNEL_INDEX[channel]; -} -/** - * Return whether a channel supports a particular mark type. - * @param channel channel name - * @param mark the mark type - * @return whether the mark supports the channel - */ -export function supportMark(channel, mark) { - return getSupportedMark(channel)[mark]; -} -const ALL_MARKS = { - // all marks - arc: 'always', - area: 'always', - bar: 'always', - circle: 'always', - geoshape: 'always', - image: 'always', - line: 'always', - rule: 'always', - point: 'always', - rect: 'always', - square: 'always', - trail: 'always', - text: 'always', - tick: 'always' -}; -const { geoshape: _g } = ALL_MARKS, ALL_MARKS_EXCEPT_GEOSHAPE = __rest(ALL_MARKS, ["geoshape"]); -/** - * Return a dictionary showing whether a channel supports mark type. - * @param channel - * @return A dictionary mapping mark types to 'always', 'binned', or undefined - */ -function getSupportedMark(channel) { - switch (channel) { - case COLOR: - case FILL: - case STROKE: - // falls through - case DESCRIPTION: - case DETAIL: - case KEY: - case TOOLTIP: - case HREF: - case ORDER: // TODO: revise (order might not support rect, which is not stackable?) - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEWIDTH: - // falls through - case FACET: - case ROW: // falls through - case COLUMN: - return ALL_MARKS; - case X: - case Y: - case LATITUDE: - case LONGITUDE: - // all marks except geoshape. geoshape does not use X, Y -- it uses a projection - return ALL_MARKS_EXCEPT_GEOSHAPE; - case X2: - case Y2: - case LATITUDE2: - case LONGITUDE2: - return { - area: 'always', - bar: 'always', - image: 'always', - rect: 'always', - rule: 'always', - circle: 'binned', - point: 'binned', - square: 'binned', - tick: 'binned', - line: 'binned', - trail: 'binned' - }; - case SIZE: - return { - point: 'always', - tick: 'always', - rule: 'always', - circle: 'always', - square: 'always', - bar: 'always', - text: 'always', - line: 'always', - trail: 'always' - }; - case STROKEDASH: - return { - line: 'always', - point: 'always', - tick: 'always', - rule: 'always', - circle: 'always', - square: 'always', - bar: 'always', - geoshape: 'always' - }; - case SHAPE: - return { point: 'always', geoshape: 'always' }; - case TEXT: - return { text: 'always' }; - case ANGLE: - return { point: 'always', square: 'always', text: 'always' }; - case URL: - return { image: 'always' }; - case THETA: - return { text: 'always', arc: 'always' }; - case RADIUS: - return { text: 'always', arc: 'always' }; - case THETA2: - case RADIUS2: - return { arc: 'always' }; - } -} -export function rangeType(channel) { - switch (channel) { - case X: - case Y: - case THETA: - case RADIUS: - case SIZE: - case ANGLE: - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through] - case X2: - case Y2: - case THETA2: - case RADIUS2: - return undefined; - case FACET: - case ROW: - case COLUMN: - case SHAPE: - case STROKEDASH: - // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through] - case TEXT: - case TOOLTIP: - case HREF: - case URL: - case DESCRIPTION: - return 'discrete'; - // Color can be either continuous or discrete, depending on scale type. - case COLOR: - case FILL: - case STROKE: - return 'flexible'; - // No scale, no range type. - case LATITUDE: - case LONGITUDE: - case LATITUDE2: - case LONGITUDE2: - case DETAIL: - case KEY: - case ORDER: - return undefined; - } -} -//# sourceMappingURL=channel.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/channel.js.map b/node_modules/vega-lite/build/src/channel.js.map deleted file mode 100644 index f78757d..0000000 --- a/node_modules/vega-lite/build/src/channel.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/channel.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAMH,OAAO,EAAO,IAAI,EAAC,MAAM,QAAQ,CAAC;AAKlC,QAAQ;AACR,MAAM,CAAC,MAAM,GAAG,GAAG,KAAc,CAAC;AAClC,MAAM,CAAC,MAAM,MAAM,GAAG,QAAiB,CAAC;AAExC,MAAM,CAAC,MAAM,KAAK,GAAG,OAAgB,CAAC;AAEtC,WAAW;AACX,MAAM,CAAC,MAAM,CAAC,GAAG,GAAY,CAAC;AAC9B,MAAM,CAAC,MAAM,CAAC,GAAG,GAAY,CAAC;AAC9B,MAAM,CAAC,MAAM,EAAE,GAAG,IAAa,CAAC;AAChC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAa,CAAC;AAEhC,eAAe;AACf,MAAM,CAAC,MAAM,MAAM,GAAG,QAAiB,CAAC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,SAAkB,CAAC;AAC1C,MAAM,CAAC,MAAM,KAAK,GAAG,OAAgB,CAAC;AACtC,MAAM,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QACP,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,IAAI,CAAC;QACV,KAAK,KAAK,CAAC;QACX,KAAK,WAAW,CAAC;QACjB,KAAK,OAAO,CAAC;QACb,KAAK,WAAW,CAAC;QACjB,KAAK,aAAa,CAAC;QAEnB,yFAAyF;QACzF,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,SAAS,CAAC;QAEnB,KAAK,KAAK,CAAC;QACX,KAAK,GAAG,CAAC;QACT,KAAK,MAAM,CAAC;QACZ,KAAK,KAAK,CAAC;QACX,KAAK,UAAU,CAAC;QAChB,sFAAsF;QACtF,KAAK,IAAI,CAAC;QACV,KAAK,OAAO,CAAC;QACb,KAAK,IAAI,CAAC;QACV,KAAK,GAAG,CAAC;QACT,KAAK,WAAW;YACd,OAAO,UAAU,CAAC;QAEpB,uEAAuE;QACvE,KAAK,KAAK,CAAC;QACX,KAAK,IAAI,CAAC;QACV,KAAK,MAAM;YACT,OAAO,UAAU,CAAC;QAEpB,2BAA2B;QAE3B,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS,CAAC;QACf,KAAK,SAAS,CAAC;QACf,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM,CAAC;QACZ,KAAK,GAAG,CAAC;QACT,KAAK,KAAK;YACR,OAAO,SAAS,CAAC;KACpB;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/channeldef.d.ts b/node_modules/vega-lite/build/src/channeldef.d.ts deleted file mode 100644 index b8a3943..0000000 --- a/node_modules/vega-lite/build/src/channeldef.d.ts +++ /dev/null @@ -1,901 +0,0 @@ -import { Gradient, SignalRef, Text } from 'vega'; -import { Aggregate } from './aggregate'; -import { Axis } from './axis'; -import { Bin, BinParams } from './bin'; -import { Channel, ExtendedChannel } from './channel'; -import { CompositeAggregate } from './compositemark'; -import { Config } from './config'; -import { DateTime } from './datetime'; -import { Encoding } from './encoding'; -import { FormatMixins, Guide, GuideEncodingConditionalValueDef, TitleMixins } from './guide'; -import { ImputeParams } from './impute'; -import { Legend } from './legend'; -import { LogicalComposition } from './logical'; -import { MarkDef } from './mark'; -import { Predicate } from './predicate'; -import { Scale } from './scale'; -import { Sort, SortOrder } from './sort'; -import { StackOffset, StackProperties } from './stack'; -import { TimeUnit, TimeUnitParams } from './timeunit'; -import { AggregatedFieldDef, WindowFieldDef } from './transform'; -import { StandardType, Type } from './type'; -export declare type PrimitiveValue = number | string | boolean | null; -export declare type Value = PrimitiveValue | number[] | Gradient | Text | SignalRef; -/** - * Definition object for a constant value (primitive value or gradient definition) of an encoding channel. - */ -export interface ValueDef { - /** - * A constant value in visual domain (e.g., `"red"` / `"#0099ff"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity). - */ - value: V; -} -export declare type PositionValueDef = ValueDef; -export declare type NumericValueDef = ValueDef; -/** - * A ValueDef with Condition where either the condition or the value are optional. - * { - * condition: {field: ...} | {value: ...}, - * value: ..., - * } - */ -/** - * @minProperties 1 - */ -export declare type ValueDefWithCondition | DatumDef, V extends Value = Value> = Partial> & { - /** - * A field definition or one or more value definition(s) with a selection predicate. - */ - condition?: Conditional | Conditional> | Conditional>[]; -}; -export declare type StringValueDefWithCondition = ValueDefWithCondition, string | null>; -export declare type TypeForShape = 'nominal' | 'ordinal' | 'geojson'; -export declare type Conditional | DatumDef | ValueDef | SignalRef> = ConditionalPredicate | ConditionalSelection; -export declare type ConditionalPredicate | DatumDef | ValueDef | SignalRef> = { - /** - * Predicate for triggering the condition - */ - test: LogicalComposition; -} & CD; -export declare type ConditionalSelection | DatumDef | ValueDef | SignalRef> = { - /** - * A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose). - */ - selection: LogicalComposition; -} & CD; -export declare function isConditionalSelection(c: Conditional): c is ConditionalSelection; -export interface ConditionValueDefMixins { - /** - * One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html). - * - * __Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value) - * since Vega-Lite only allows at most one encoded field per encoding channel. - */ - condition?: Conditional> | Conditional>[]; -} -/** - * A FieldDef with Condition - * { - * condition: {value: ...}, - * field: ..., - * ... - * } - */ -export declare type FieldOrDatumDefWithCondition | DatumDef, V extends Value = Value> = F & ConditionValueDefMixins; -export declare type MarkPropDef = FieldOrDatumDefWithCondition, V> | FieldOrDatumDefWithCondition, V> | ValueDefWithCondition, V>; -export declare type ColorDef = MarkPropDef; -export declare type NumericMarkPropDef = MarkPropDef; -export declare type NumericArrayMarkPropDef = MarkPropDef; -export declare type ShapeDef = MarkPropDef; -export declare type StringFieldDefWithCondition = FieldOrDatumDefWithCondition, string>; -export declare type TextDef = FieldOrDatumDefWithCondition, Text> | FieldOrDatumDefWithCondition, Text> | ValueDefWithCondition, Text>; -/** - * A ValueDef with optional Condition - * { - * condition: {field: ...} | {value: ...}, - * value: ..., - * } - */ -/** - * Reference to a repeated value. - */ -export interface RepeatRef { - repeat: 'row' | 'column' | 'repeat' | 'layer'; -} -export declare type FieldName = string; -export declare type Field = FieldName | RepeatRef; -export declare function isRepeatRef(field: Field | any): field is RepeatRef; -/** @@hidden */ -export declare type HiddenCompositeAggregate = CompositeAggregate; -export interface FieldDefBase extends BandMixins { - /** - * __Required.__ A string defining the name of the field from which to pull a data value - * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. - * - * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. - * - * __Notes:__ - * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). - * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). - * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). - * 2) `field` is not required if `aggregate` is `count`. - */ - field?: F; - /** - * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. - * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. - */ - timeUnit?: TimeUnit | TimeUnitParams; - /** - * Aggregation function for the field - * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. - */ - aggregate?: Aggregate | HiddenCompositeAggregate; - /** - * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). - * - * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied. - * - * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. - * - * __Default value:__ `false` - * - * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. - */ - bin?: B; -} -export declare function toFieldDefBase(fieldDef: FieldDef): FieldDefBase; -export interface TypeMixins { - /** - * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). - * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). - * - * Since Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: - * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` - * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. - * - * __Default value:__ - * - * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: - * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). - * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale - * - `ordinal""` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale. - * - * 2) For a constant value in data domain (`datum`): - * - `"quantitative"` if the datum is a number - * - `"nominal"` if the datum is a string - * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) - * - * __Note:__ - * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. - * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). - * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. - * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). - * - * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. - */ - type?: T; -} -/** - * Definition object for a data field, its type and transformation of an encoding channel. - */ -export declare type TypedFieldDef = FieldDefBase & TitleMixins & TypeMixins; -export interface SortableFieldDef extends TypedFieldDef { - /** - * Sort order for the encoded field. - * - * For continuous fields (quantitative or temporal), `sort` can be either `"ascending"` or `"descending"`. - * - * For discrete fields, `sort` can be one of the following: - * - `"ascending"` or `"descending"` -- for sorting by the values' natural order in JavaScript. - * - [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `"x"` or `"y"`) with an optional minus prefix for descending sort (e.g., `"-x"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `"sort": "-x"` is equivalent to `"sort": {"encoding": "x", "order": "descending"}`. - * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field. - * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `"month"` and `"day"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `"Mon"`, `"Tue"`). - * - `null` indicating no sort. - * - * __Default value:__ `"ascending"` - * - * __Note:__ `null` and sorting by another channel is not supported for `row` and `column`. - * - * __See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation. - */ - sort?: Sort; -} -export declare function isSortableFieldDef(fieldDef: FieldDef): fieldDef is SortableFieldDef; -export declare type ScaleFieldDef = SortableFieldDef & ScaleMixins; -export interface ScaleMixins { - /** - * An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels. - * - * If `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable). - * - * __Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied. - * - * __See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation. - */ - scale?: Scale | null; -} -export interface DatumDef extends Partial>, BandMixins { - /** - * A constant value in data domain. - */ - datum?: F extends RepeatRef ? V | RepeatRef : V; -} -export declare type StringDatumDef = DatumDef & FormatMixins; -export declare type ScaleDatumDef = ScaleMixins & DatumDef; -/** - * A field definition of a secondary channel that shares a scale with another primary channel. For example, `x2`, `xError` and `xError2` share the same scale with `x`. - */ -export declare type SecondaryFieldDef = FieldDefBase & TitleMixins; -export declare type Position2Def = SecondaryFieldDef | DatumDef | PositionValueDef; -export declare type SecondaryChannelDef = Encoding['x2' | 'y2']; -/** - * Field Def without scale (and without bin: "binned" support). - */ -export declare type FieldDefWithoutScale = TypedFieldDef; -export declare type LatLongFieldDef = FieldDefBase & TitleMixins & Partial>; -export declare type LatLongDef = LatLongFieldDef | DatumDef | NumericValueDef; -export declare type PositionFieldDefBase = ScaleFieldDef & PositionBaseMixins; -export declare type PositionDatumDefBase = ScaleDatumDef & PositionBaseMixins; -export interface PositionBaseMixins { - /** - * Type of stacking offset if the field should be stacked. - * `stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains. - * For example, `stack` of `y` can be used to customize stacking for a vertical bar chart. - * - * `stack` can be one of the following values: - * - `"zero"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart). - * - `"normalize"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
- * -`"center"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)). - * - `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart. - * - * __Default value:__ `zero` for plots with all of the following conditions are true: - * (1) the mark is `bar`, `area`, or `arc`; - * (2) the stacked measure channel (x or y) has a linear scale; - * (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default. - * - * __See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation. - */ - stack?: StackOffset | null | boolean; -} -export interface BandMixins { - /** - * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval. - * - * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band. - * - * @minimum 0 - * @maximum 1 - */ - band?: number; -} -export declare type PositionFieldDef = PositionFieldDefBase & PositionMixins; -export declare type PositionDatumDef = PositionDatumDefBase & PositionMixins; -export declare type PositionDef = PositionFieldDef | PositionDatumDef | PositionValueDef; -export interface PositionMixins { - /** - * An object defining properties of axis's gridlines, ticks and labels. - * If `null`, the axis for the encoding channel will be removed. - * - * __Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied. - * - * __See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation. - */ - axis?: Axis | null; - /** - * An object defining the properties of the Impute Operation to be applied. - * The field value of the other positional channel is taken as `key` of the `Impute` Operation. - * The field of the `color` channel if specified is used as `groupby` of the `Impute` Operation. - * - * __See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation. - */ - impute?: ImputeParams | null; -} -export declare type PolarDef = PositionFieldDefBase | PositionDatumDefBase | PositionValueDef; -export declare function getBand({ channel, fieldDef, fieldDef2, markDef: mark, stack, config, isMidPoint }: { - isMidPoint?: boolean; - channel: Channel; - fieldDef: FieldDef | DatumDef; - fieldDef2?: SecondaryChannelDef; - stack: StackProperties; - markDef: MarkDef; - config: Config; -}): number; -export declare function hasBand(channel: Channel, fieldDef: FieldDef, fieldDef2: SecondaryChannelDef, stack: StackProperties, markDef: MarkDef, config: Config): boolean; -/** - * Field definition of a mark property, which can contain a legend. - */ -export declare type MarkPropFieldDef = ScaleFieldDef & LegendMixins; -export declare type MarkPropDatumDef = LegendMixins & ScaleDatumDef; -export declare type MarkPropFieldOrDatumDef = MarkPropFieldDef | MarkPropDatumDef; -export interface LegendMixins { - /** - * An object defining properties of the legend. - * If `null`, the legend for the encoding channel will be removed. - * - * __Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied. - * - * __See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation. - */ - legend?: Legend | null; -} -export interface OrderFieldDef extends FieldDefWithoutScale { - /** - * The sort order. One of `"ascending"` (default) or `"descending"`. - */ - sort?: SortOrder; -} -export declare type OrderValueDef = ConditionValueDefMixins & NumericValueDef; -export interface StringFieldDef extends FieldDefWithoutScale, FormatMixins { -} -export declare type FieldDef = SecondaryFieldDef | TypedFieldDef; -export declare type ChannelDef = Encoding[keyof Encoding]; -export declare function isConditionalDef | GuideEncodingConditionalValueDef | SignalRef>(channelDef: CD): channelDef is CD & { - condition: Conditional; -}; -/** - * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef - */ -export declare function hasConditionalFieldDef(channelDef: Partial>): channelDef is { - condition: Conditional>; -}; -export declare function hasConditionalFieldOrDatumDef(channelDef: ChannelDef): channelDef is { - condition: Conditional>; -}; -export declare function hasConditionalValueDef(channelDef: ChannelDef): channelDef is ValueDef & { - condition: Conditional> | Conditional>[]; -}; -export declare function isFieldDef(channelDef: Partial> | FieldDefBase | DatumDef): channelDef is FieldDefBase | TypedFieldDef | SecondaryFieldDef; -export declare function channelDefType(channelDef: ChannelDef): Type | undefined; -export declare function isDatumDef(channelDef: Partial> | FieldDefBase | DatumDef): channelDef is DatumDef; -export declare function isContinuousFieldOrDatumDef(cd: ChannelDef): cd is TypedFieldDef | DatumDef; -export declare function isQuantitativeFieldOrDatumDef(cd: ChannelDef): boolean; -export declare function isNumericDataDef(cd: ChannelDef): cd is DatumDef; -export declare function isFieldOrDatumDef(channelDef: Partial>): channelDef is FieldDef | DatumDef; -export declare function isTypedFieldDef(channelDef: ChannelDef): channelDef is TypedFieldDef; -export declare function isValueDef(channelDef: Partial>): channelDef is ValueDef; -export declare function isScaleFieldDef(channelDef: ChannelDef): channelDef is ScaleFieldDef; -export declare function isPositionFieldOrDatumDef(channelDef: ChannelDef): channelDef is PositionFieldDef | PositionDatumDef; -export declare function isMarkPropFieldOrDatumDef(channelDef: ChannelDef): channelDef is MarkPropFieldDef | MarkPropDatumDef; -export declare function isStringFieldOrDatumDef(channelDef: ChannelDef): channelDef is StringFieldDef | StringDatumDef; -export declare function toStringFieldDef(fieldDef: FieldDef): StringFieldDef; -export interface FieldRefOption { - /** Exclude bin, aggregate, timeUnit */ - nofn?: boolean; - /** Wrap the field with datum, parent, or datum.datum (e.g., datum['...'] for Vega Expression */ - expr?: 'datum' | 'parent' | 'datum.datum'; - /** Prepend fn with custom function prefix */ - prefix?: string; - /** Append suffix to the field ref for bin (default='start') */ - binSuffix?: 'end' | 'range' | 'mid'; - /** Append suffix to the field ref (general) */ - suffix?: string; - /** - * Use the field name for `as` in a transform. - * We will not escape nested accesses because Vega transform outputs cannot be nested. - */ - forAs?: boolean; -} -/** - * Get a Vega field reference from a Vega-Lite field def. - */ -export declare function vgField(fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef, opt?: FieldRefOption): string; -export declare function isDiscrete(def: TypedFieldDef | DatumDef): boolean; -export declare function isContinuous(fieldDef: TypedFieldDef): boolean; -export declare function isCount(fieldDef: FieldDefBase): boolean; -export declare type FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => string; -export declare function verbalTitleFormatter(fieldDef: FieldDefBase, config: Config): string; -export declare function functionalTitleFormatter(fieldDef: FieldDefBase): string; -export declare const defaultTitleFormatter: FieldTitleFormatter; -export declare function setTitleFormatter(formatter: FieldTitleFormatter): void; -export declare function resetTitleFormatter(): void; -export declare function title(fieldOrDatumDef: TypedFieldDef | SecondaryFieldDef | DatumDef, config: Config, { allowDisabling, includeDefault }: { - allowDisabling: boolean; - includeDefault?: boolean; -}): string | string[] | SignalRef; -export declare function getGuide(fieldDef: TypedFieldDef | SecondaryFieldDef | DatumDef): Guide; -export declare function defaultTitle(fieldDef: FieldDefBase, config: Config): string; -export declare function getFormatMixins(fieldDef: TypedFieldDef | DatumDef): { - format: string | Record; - formatType: string; -}; -export declare function defaultType>(fieldDef: T, channel: ExtendedChannel): Type; -/** - * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef. - * @param channelDef - */ -export declare function getFieldDef(channelDef: ChannelDef): FieldDef; -export declare function getFieldOrDatumDef = ChannelDef>(channelDef: CD): FieldDef | DatumDef; -/** - * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. - */ -export declare function initChannelDef(channelDef: ChannelDef, channel: ExtendedChannel, config: Config, opt?: { - compositeMark?: boolean; -}): ChannelDef; -export declare function initFieldOrDatumDef(fd: FieldDef | DatumDef, channel: ExtendedChannel, config: Config, opt: { - compositeMark?: boolean; -}): FieldDef | DatumDef; -export declare function initFieldDef(fd: FieldDef, channel: ExtendedChannel, { compositeMark }?: { - compositeMark?: boolean; -}): { - /** - * __Required.__ A string defining the name of the field from which to pull a data value - * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. - * - * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. - * - * __Notes:__ - * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). - * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). - * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). - * 2) `field` is not required if `aggregate` is `count`. - */ - field?: string; - /** - * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. - * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. - */ - timeUnit?: "day" | "week" | "month" | "year" | "date" | "quarter" | "dayofyear" | "hours" | "minutes" | "seconds" | "milliseconds" | "utcyear" | "utcquarter" | "utcmonth" | "utcweek" | "utcday" | "utcdayofyear" | "utcdate" | "utchours" | "utcminutes" | "utcseconds" | "utcmilliseconds" | "yearquarter" | "yearquartermonth" | "yearmonth" | "yearmonthdate" | "yearmonthdatehours" | "yearmonthdatehoursminutes" | "yearmonthdatehoursminutesseconds" | "yearweek" | "yearweekday" | "yearweekdayhours" | "yearweekdayhoursminutes" | "yearweekdayhoursminutesseconds" | "yeardayofyear" | "quartermonth" | "monthdate" | "monthdatehours" | "monthdatehoursminutes" | "monthdatehoursminutesseconds" | "weekday" | "weeksdayhours" | "weekdayhoursminutes" | "weekdayhoursminutesseconds" | "dayhours" | "dayhoursminutes" | "dayhoursminutesseconds" | "hoursminutes" | "hoursminutesseconds" | "minutesseconds" | "secondsmilliseconds" | "utcyearquarter" | "utcyearquartermonth" | "utcyearmonth" | "utcyearmonthdate" | "utcyearmonthdatehours" | "utcyearmonthdatehoursminutes" | "utcyearmonthdatehoursminutesseconds" | "utcyearweek" | "utcyearweekday" | "utcyearweekdayhours" | "utcyearweekdayhoursminutes" | "utcyearweekdayhoursminutesseconds" | "utcyeardayofyear" | "utcquartermonth" | "utcmonthdate" | "utcmonthdatehours" | "utcmonthdatehoursminutes" | "utcmonthdatehoursminutesseconds" | "utcweekday" | "utcweeksdayhours" | "utcweekdayhoursminutes" | "utcweekdayhoursminutesseconds" | "utcdayhours" | "utcdayhoursminutes" | "utcdayhoursminutesseconds" | "utchoursminutes" | "utchoursminutesseconds" | "utcminutesseconds" | "utcsecondsmilliseconds" | TimeUnitParams; - /** - * Aggregation function for the field - * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. - */ - aggregate?: "count" | "min" | "max" | "average" | "distinct" | "mean" | "median" | "missing" | "product" | "q1" | "q3" | "ci0" | "ci1" | "stderr" | "stdev" | "stdevp" | "sum" | "valid" | "values" | "variance" | "variancep" | import("./aggregate").ArgminDef | import("./aggregate").ArgmaxDef | "boxplot" | "errorbar" | "errorband"; - /** - * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). - * - * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied. - * - * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. - * - * __Default value:__ `false` - * - * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. - */ - bin?: null; - /** - * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval. - * - * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band. - * - * @minimum 0 - * @maximum 1 - */ - band?: number; - title?: string | string[] | SignalRef; -} | { - /** - * __Required.__ A string defining the name of the field from which to pull a data value - * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. - * - * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. - * - * __Notes:__ - * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). - * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). - * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). - * 2) `field` is not required if `aggregate` is `count`. - */ - field?: string; - /** - * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. - * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. - */ - timeUnit?: "day" | "week" | "month" | "year" | "date" | "quarter" | "dayofyear" | "hours" | "minutes" | "seconds" | "milliseconds" | "utcyear" | "utcquarter" | "utcmonth" | "utcweek" | "utcday" | "utcdayofyear" | "utcdate" | "utchours" | "utcminutes" | "utcseconds" | "utcmilliseconds" | "yearquarter" | "yearquartermonth" | "yearmonth" | "yearmonthdate" | "yearmonthdatehours" | "yearmonthdatehoursminutes" | "yearmonthdatehoursminutesseconds" | "yearweek" | "yearweekday" | "yearweekdayhours" | "yearweekdayhoursminutes" | "yearweekdayhoursminutesseconds" | "yeardayofyear" | "quartermonth" | "monthdate" | "monthdatehours" | "monthdatehoursminutes" | "monthdatehoursminutesseconds" | "weekday" | "weeksdayhours" | "weekdayhoursminutes" | "weekdayhoursminutesseconds" | "dayhours" | "dayhoursminutes" | "dayhoursminutesseconds" | "hoursminutes" | "hoursminutesseconds" | "minutesseconds" | "secondsmilliseconds" | "utcyearquarter" | "utcyearquartermonth" | "utcyearmonth" | "utcyearmonthdate" | "utcyearmonthdatehours" | "utcyearmonthdatehoursminutes" | "utcyearmonthdatehoursminutesseconds" | "utcyearweek" | "utcyearweekday" | "utcyearweekdayhours" | "utcyearweekdayhoursminutes" | "utcyearweekdayhoursminutesseconds" | "utcyeardayofyear" | "utcquartermonth" | "utcmonthdate" | "utcmonthdatehours" | "utcmonthdatehoursminutes" | "utcmonthdatehoursminutesseconds" | "utcweekday" | "utcweeksdayhours" | "utcweekdayhoursminutes" | "utcweekdayhoursminutesseconds" | "utcdayhours" | "utcdayhoursminutes" | "utcdayhoursminutesseconds" | "utchoursminutes" | "utchoursminutesseconds" | "utcminutesseconds" | "utcsecondsmilliseconds" | TimeUnitParams; - /** - * Aggregation function for the field - * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. - */ - aggregate?: "count" | "min" | "max" | "average" | "distinct" | "mean" | "median" | "missing" | "product" | "q1" | "q3" | "ci0" | "ci1" | "stderr" | "stdev" | "stdevp" | "sum" | "valid" | "values" | "variance" | "variancep" | import("./aggregate").ArgminDef | import("./aggregate").ArgmaxDef | "boxplot" | "errorbar" | "errorband"; - /** - * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). - * - * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied. - * - * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. - * - * __Default value:__ `false` - * - * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. - */ - bin?: boolean | BinParams | "binned"; - /** - * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval. - * - * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band. - * - * @minimum 0 - * @maximum 1 - */ - band?: number; - title?: string | string[] | SignalRef; - /** - * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). - * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). - * - * Since Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: - * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` - * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. - * - * __Default value:__ - * - * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: - * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). - * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale - * - `ordinal""` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale. - * - * 2) For a constant value in data domain (`datum`): - * - `"quantitative"` if the datum is a number - * - `"nominal"` if the datum is a string - * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) - * - * __Note:__ - * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. - * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). - * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. - * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). - * - * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. - */ - type?: any; -} | { - sort: { - encoding: "stroke" | "color" | "text" | "shape" | "x" | "y" | "fill" | "opacity" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "size"; - order?: undefined; - }; - /** - * __Required.__ A string defining the name of the field from which to pull a data value - * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. - * - * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. - * - * __Notes:__ - * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). - * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). - * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). - * 2) `field` is not required if `aggregate` is `count`. - */ - field?: string; - /** - * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. - * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. - */ - timeUnit?: "day" | "week" | "month" | "year" | "date" | "quarter" | "dayofyear" | "hours" | "minutes" | "seconds" | "milliseconds" | "utcyear" | "utcquarter" | "utcmonth" | "utcweek" | "utcday" | "utcdayofyear" | "utcdate" | "utchours" | "utcminutes" | "utcseconds" | "utcmilliseconds" | "yearquarter" | "yearquartermonth" | "yearmonth" | "yearmonthdate" | "yearmonthdatehours" | "yearmonthdatehoursminutes" | "yearmonthdatehoursminutesseconds" | "yearweek" | "yearweekday" | "yearweekdayhours" | "yearweekdayhoursminutes" | "yearweekdayhoursminutesseconds" | "yeardayofyear" | "quartermonth" | "monthdate" | "monthdatehours" | "monthdatehoursminutes" | "monthdatehoursminutesseconds" | "weekday" | "weeksdayhours" | "weekdayhoursminutes" | "weekdayhoursminutesseconds" | "dayhours" | "dayhoursminutes" | "dayhoursminutesseconds" | "hoursminutes" | "hoursminutesseconds" | "minutesseconds" | "secondsmilliseconds" | "utcyearquarter" | "utcyearquartermonth" | "utcyearmonth" | "utcyearmonthdate" | "utcyearmonthdatehours" | "utcyearmonthdatehoursminutes" | "utcyearmonthdatehoursminutesseconds" | "utcyearweek" | "utcyearweekday" | "utcyearweekdayhours" | "utcyearweekdayhoursminutes" | "utcyearweekdayhoursminutesseconds" | "utcyeardayofyear" | "utcquartermonth" | "utcmonthdate" | "utcmonthdatehours" | "utcmonthdatehoursminutes" | "utcmonthdatehoursminutesseconds" | "utcweekday" | "utcweeksdayhours" | "utcweekdayhoursminutes" | "utcweekdayhoursminutesseconds" | "utcdayhours" | "utcdayhoursminutes" | "utcdayhoursminutesseconds" | "utchoursminutes" | "utchoursminutesseconds" | "utcminutesseconds" | "utcsecondsmilliseconds" | TimeUnitParams; - /** - * Aggregation function for the field - * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. - */ - aggregate?: "count" | "min" | "max" | "average" | "distinct" | "mean" | "median" | "missing" | "product" | "q1" | "q3" | "ci0" | "ci1" | "stderr" | "stdev" | "stdevp" | "sum" | "valid" | "values" | "variance" | "variancep" | import("./aggregate").ArgminDef | import("./aggregate").ArgmaxDef | "boxplot" | "errorbar" | "errorband"; - /** - * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). - * - * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied. - * - * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. - * - * __Default value:__ `false` - * - * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. - */ - bin?: boolean | BinParams; - /** - * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval. - * - * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band. - * - * @minimum 0 - * @maximum 1 - */ - band?: number; - title?: string | string[] | SignalRef; - /** - * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). - * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). - * - * Since Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: - * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` - * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. - * - * __Default value:__ - * - * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: - * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). - * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale - * - `ordinal""` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale. - * - * 2) For a constant value in data domain (`datum`): - * - `"quantitative"` if the datum is a number - * - `"nominal"` if the datum is a string - * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) - * - * __Note:__ - * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. - * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). - * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. - * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). - * - * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. - */ - type?: StandardType; -} | { - sort: { - encoding: "stroke" | "color" | "text" | "shape" | "x" | "y" | "fill" | "opacity" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "size"; - order: string; - }; - /** - * __Required.__ A string defining the name of the field from which to pull a data value - * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. - * - * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. - * - * __Notes:__ - * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). - * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). - * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). - * 2) `field` is not required if `aggregate` is `count`. - */ - field?: string; - /** - * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. - * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. - */ - timeUnit?: "day" | "week" | "month" | "year" | "date" | "quarter" | "dayofyear" | "hours" | "minutes" | "seconds" | "milliseconds" | "utcyear" | "utcquarter" | "utcmonth" | "utcweek" | "utcday" | "utcdayofyear" | "utcdate" | "utchours" | "utcminutes" | "utcseconds" | "utcmilliseconds" | "yearquarter" | "yearquartermonth" | "yearmonth" | "yearmonthdate" | "yearmonthdatehours" | "yearmonthdatehoursminutes" | "yearmonthdatehoursminutesseconds" | "yearweek" | "yearweekday" | "yearweekdayhours" | "yearweekdayhoursminutes" | "yearweekdayhoursminutesseconds" | "yeardayofyear" | "quartermonth" | "monthdate" | "monthdatehours" | "monthdatehoursminutes" | "monthdatehoursminutesseconds" | "weekday" | "weeksdayhours" | "weekdayhoursminutes" | "weekdayhoursminutesseconds" | "dayhours" | "dayhoursminutes" | "dayhoursminutesseconds" | "hoursminutes" | "hoursminutesseconds" | "minutesseconds" | "secondsmilliseconds" | "utcyearquarter" | "utcyearquartermonth" | "utcyearmonth" | "utcyearmonthdate" | "utcyearmonthdatehours" | "utcyearmonthdatehoursminutes" | "utcyearmonthdatehoursminutesseconds" | "utcyearweek" | "utcyearweekday" | "utcyearweekdayhours" | "utcyearweekdayhoursminutes" | "utcyearweekdayhoursminutesseconds" | "utcyeardayofyear" | "utcquartermonth" | "utcmonthdate" | "utcmonthdatehours" | "utcmonthdatehoursminutes" | "utcmonthdatehoursminutesseconds" | "utcweekday" | "utcweeksdayhours" | "utcweekdayhoursminutes" | "utcweekdayhoursminutesseconds" | "utcdayhours" | "utcdayhoursminutes" | "utcdayhoursminutesseconds" | "utchoursminutes" | "utchoursminutesseconds" | "utcminutesseconds" | "utcsecondsmilliseconds" | TimeUnitParams; - /** - * Aggregation function for the field - * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. - */ - aggregate?: "count" | "min" | "max" | "average" | "distinct" | "mean" | "median" | "missing" | "product" | "q1" | "q3" | "ci0" | "ci1" | "stderr" | "stdev" | "stdevp" | "sum" | "valid" | "values" | "variance" | "variancep" | import("./aggregate").ArgminDef | import("./aggregate").ArgmaxDef | "boxplot" | "errorbar" | "errorband"; - /** - * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). - * - * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied. - * - * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. - * - * __Default value:__ `false` - * - * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. - */ - bin?: boolean | BinParams; - /** - * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval. - * - * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band. - * - * @minimum 0 - * @maximum 1 - */ - band?: number; - title?: string | string[] | SignalRef; - /** - * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). - * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). - * - * Since Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: - * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` - * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. - * - * __Default value:__ - * - * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: - * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). - * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale - * - `ordinal""` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale. - * - * 2) For a constant value in data domain (`datum`): - * - `"quantitative"` if the datum is a number - * - `"nominal"` if the datum is a string - * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) - * - * __Note:__ - * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. - * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). - * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. - * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). - * - * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. - */ - type?: StandardType; -} | { - header: { - labelOrient: import("vega").Orient; - titleOrient: import("vega").Orient; - titleAnchor?: import("vega").TitleAnchor; - titleAlign?: SignalRef | "left" | "center" | "right"; - titleAngle?: number; - titleBaseline?: SignalRef | "alphabetic" | "top" | "middle" | "bottom" | "line-top" | "line-bottom"; - titleColor?: import("vega").ScaleField; - titleFont?: import("vega").ScaleField; - titleFontSize?: number | SignalRef; - titleFontStyle?: import("vega").ScaleField; - titleFontWeight?: SignalRef | "normal" | "bold" | "lighter" | "bolder" | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900; - titleLimit?: number | SignalRef; - titleLineHeight?: number | SignalRef; - titlePadding?: number | SignalRef; - labels?: boolean; - labelAlign?: SignalRef | "left" | "center" | "right"; - labelBaseline?: SignalRef | "alphabetic" | "top" | "middle" | "bottom" | "line-top" | "line-bottom"; - labelAnchor?: import("vega").TitleAnchor; - labelExpr?: string; - labelAngle?: number; - labelColor?: import("vega").ScaleField; - labelFont?: import("vega").ScaleField; - labelFontSize?: number | SignalRef; - labelFontStyle?: import("vega").ScaleField; - labelFontWeight?: SignalRef | "normal" | "bold" | "lighter" | "bolder" | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900; - labelLimit?: number | SignalRef; - labelLineHeight?: number | SignalRef; - labelPadding?: number | SignalRef; - format?: string | Record; - formatType?: string; - title?: string | string[] | SignalRef; - }; - sort?: string[] | number[] | "ascending" | "descending" | boolean[] | DateTime[] | import("./sort").EncodingSortField; - /** - * __Required.__ A string defining the name of the field from which to pull a data value - * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. - * - * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. - * - * __Notes:__ - * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). - * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). - * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). - * 2) `field` is not required if `aggregate` is `count`. - */ - field?: string; - /** - * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. - * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. - */ - timeUnit?: "day" | "week" | "month" | "year" | "date" | "quarter" | "dayofyear" | "hours" | "minutes" | "seconds" | "milliseconds" | "utcyear" | "utcquarter" | "utcmonth" | "utcweek" | "utcday" | "utcdayofyear" | "utcdate" | "utchours" | "utcminutes" | "utcseconds" | "utcmilliseconds" | "yearquarter" | "yearquartermonth" | "yearmonth" | "yearmonthdate" | "yearmonthdatehours" | "yearmonthdatehoursminutes" | "yearmonthdatehoursminutesseconds" | "yearweek" | "yearweekday" | "yearweekdayhours" | "yearweekdayhoursminutes" | "yearweekdayhoursminutesseconds" | "yeardayofyear" | "quartermonth" | "monthdate" | "monthdatehours" | "monthdatehoursminutes" | "monthdatehoursminutesseconds" | "weekday" | "weeksdayhours" | "weekdayhoursminutes" | "weekdayhoursminutesseconds" | "dayhours" | "dayhoursminutes" | "dayhoursminutesseconds" | "hoursminutes" | "hoursminutesseconds" | "minutesseconds" | "secondsmilliseconds" | "utcyearquarter" | "utcyearquartermonth" | "utcyearmonth" | "utcyearmonthdate" | "utcyearmonthdatehours" | "utcyearmonthdatehoursminutes" | "utcyearmonthdatehoursminutesseconds" | "utcyearweek" | "utcyearweekday" | "utcyearweekdayhours" | "utcyearweekdayhoursminutes" | "utcyearweekdayhoursminutesseconds" | "utcyeardayofyear" | "utcquartermonth" | "utcmonthdate" | "utcmonthdatehours" | "utcmonthdatehoursminutes" | "utcmonthdatehoursminutesseconds" | "utcweekday" | "utcweeksdayhours" | "utcweekdayhoursminutes" | "utcweekdayhoursminutesseconds" | "utcdayhours" | "utcdayhoursminutes" | "utcdayhoursminutesseconds" | "utchoursminutes" | "utchoursminutesseconds" | "utcminutesseconds" | "utcsecondsmilliseconds" | TimeUnitParams; - /** - * Aggregation function for the field - * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. - */ - aggregate?: "count" | "min" | "max" | "average" | "distinct" | "mean" | "median" | "missing" | "product" | "q1" | "q3" | "ci0" | "ci1" | "stderr" | "stdev" | "stdevp" | "sum" | "valid" | "values" | "variance" | "variancep" | import("./aggregate").ArgminDef | import("./aggregate").ArgmaxDef | "boxplot" | "errorbar" | "errorband"; - /** - * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). - * - * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied. - * - * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. - * - * __Default value:__ `false` - * - * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. - */ - bin?: boolean | BinParams; - /** - * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval. - * - * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band. - * - * @minimum 0 - * @maximum 1 - */ - band?: number; - title?: string | string[] | SignalRef; - /** - * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). - * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). - * - * Since Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: - * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` - * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. - * - * __Default value:__ - * - * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: - * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). - * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale - * - `ordinal""` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale. - * - * 2) For a constant value in data domain (`datum`): - * - `"quantitative"` if the datum is a number - * - `"nominal"` if the datum is a string - * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) - * - * __Note:__ - * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. - * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). - * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. - * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). - * - * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. - */ - type?: StandardType; -}; -export declare function normalizeBin(bin: BinParams | boolean | 'binned', channel?: ExtendedChannel): BinParams; -export declare function channelCompatibility(fieldDef: TypedFieldDef, channel: ExtendedChannel): { - compatible: boolean; - warning?: string; -}; -/** - * Check if the field def uses a time format or does not use any format but is temporal - * (this does not cover field defs that are temporal but use a number format). - */ -export declare function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef: FieldDef | DatumDef): boolean; -/** - * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`. - */ -export declare function isTimeFieldDef(def: FieldDef | DatumDef): boolean; -/** - * Getting a value associated with a fielddef. - * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit) - */ -export declare function valueExpr(v: number | string | boolean | DateTime | SignalRef | number[], { timeUnit, type, wrapTime, undefinedIfExprNotRequired }: { - timeUnit: TimeUnit | TimeUnitParams; - type?: Type; - wrapTime?: boolean; - undefinedIfExprNotRequired?: boolean; -}): string; -/** - * Standardize value array -- convert each value to Vega expression if applicable - */ -export declare function valueArray(fieldOrDatumDef: TypedFieldDef | DatumDef, values: (number | string | boolean | DateTime)[]): (string | number | boolean | DateTime | { - signal: string; -})[]; -/** - * Checks whether a fieldDef for a particular channel requires a computed bin range. - */ -export declare function binRequiresRange(fieldDef: FieldDef, channel: Channel): boolean; -//# sourceMappingURL=channeldef.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/channeldef.d.ts.map b/node_modules/vega-lite/build/src/channeldef.d.ts.map deleted file mode 100644 index e04ae92..0000000 --- a/node_modules/vega-lite/build/src/channeldef.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"channeldef.d.ts","sourceRoot":"","sources":["../../src/channeldef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAE/C,OAAO,EAAC,SAAS,EAAiE,MAAM,aAAa,CAAC;AACtG,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAc,GAAG,EAAE,SAAS,EAAmC,MAAM,OAAO,CAAC;AACpF,OAAO,EAEL,OAAO,EAqCP,eAAe,EAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,QAAQ,EAA6B,MAAM,YAAY,CAAC;AAChE,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,YAAY,EAAE,KAAK,EAAE,gCAAgC,EAAE,WAAW,EAAC,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAkB,OAAO,EAAC,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,KAAK,EAAuB,MAAM,SAAS,CAAC;AACpD,OAAO,EAAkB,IAAI,EAAE,SAAS,EAAC,MAAM,QAAQ,CAAC;AAExD,OAAO,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,SA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,GAAG,OAAO,CAErE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,EAAE,EAC9D,EACE,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,0BAA0B,EAC3B,EAAE;IACD,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAAC;IACpC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,GACA,MAAM,CA2BR;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,EACjD,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,EAAE;;KAgBjD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAStF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/channeldef.js b/node_modules/vega-lite/build/src/channeldef.js deleted file mode 100644 index 471ca77..0000000 --- a/node_modules/vega-lite/build/src/channeldef.js +++ /dev/null @@ -1,679 +0,0 @@ -import { __rest } from "tslib"; -import { isArray, isBoolean, isNumber, isString } from 'vega-util'; -import { isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp } from './aggregate'; -import { autoMaxBins, binToString, isBinned, isBinning } from './bin'; -import { ANGLE, COLOR, COLUMN, DESCRIPTION, DETAIL, FACET, FILL, FILLOPACITY, HREF, isScaleChannel, isSecondaryRangeChannel, isXorY, KEY, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, OPACITY, ORDER, RADIUS, RADIUS2, ROW, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, TEXT, THETA, THETA2, TOOLTIP, URL, X, X2, Y, Y2 } from './channel'; -import { getMarkConfig } from './compile/common'; -import { isCustomFormatType } from './compile/format'; -import { dateTimeToExpr, isDateTime } from './datetime'; -import * as log from './log'; -import { isRectBasedMark } from './mark'; -import { SCALE_CATEGORY_INDEX } from './scale'; -import { isSortByChannel } from './sort'; -import { isFacetFieldDef } from './spec/facet'; -import { getTimeUnitParts, isLocalSingleTimeUnit, normalizeTimeUnit, timeUnitToString } from './timeunit'; -import { getFullName, QUANTITATIVE } from './type'; -import { contains, flatAccessWithDatum, getFirstDefined, internalField, omit, removePathFromField, replacePathInField, titleCase } from './util'; -import { isSignalRef } from './vega.schema'; -export function isConditionalSelection(c) { - return c['selection']; -} -export function isRepeatRef(field) { - return field && !isString(field) && 'repeat' in field; -} -export function toFieldDefBase(fieldDef) { - const { field, timeUnit, bin, aggregate } = fieldDef; - return Object.assign(Object.assign(Object.assign(Object.assign({}, (timeUnit ? { timeUnit } : {})), (bin ? { bin } : {})), (aggregate ? { aggregate } : {})), { field }); -} -export function isSortableFieldDef(fieldDef) { - return 'sort' in fieldDef; -} -export function getBand({ channel, fieldDef, fieldDef2, markDef: mark, stack, config, isMidPoint }) { - if (isFieldOrDatumDef(fieldDef) && fieldDef.band !== undefined) { - return fieldDef.band; - } - if (isFieldDef(fieldDef)) { - const { timeUnit, bin } = fieldDef; - if (timeUnit && !fieldDef2) { - if (isMidPoint) { - return getMarkConfig('timeUnitBandPosition', mark, config); - } - else { - return isRectBasedMark(mark.type) ? getMarkConfig('timeUnitBand', mark, config) : 0; - } - } - else if (isBinning(bin)) { - return isRectBasedMark(mark.type) && !isMidPoint ? 1 : 0.5; - } - } - if ((stack === null || stack === void 0 ? void 0 : stack.fieldChannel) === channel && isMidPoint) { - return 0.5; - } - return undefined; -} -export function hasBand(channel, fieldDef, fieldDef2, stack, markDef, config) { - if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) { - return !!getBand({ channel, fieldDef, fieldDef2, stack, markDef, config }); - } - return false; -} -export function isConditionalDef(channelDef) { - return !!channelDef && 'condition' in channelDef; -} -/** - * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef - */ -export function hasConditionalFieldDef(channelDef) { - const condition = channelDef && channelDef['condition']; - return !!condition && !isArray(condition) && isFieldDef(condition); -} -export function hasConditionalFieldOrDatumDef(channelDef) { - const condition = channelDef && channelDef['condition']; - return !!condition && !isArray(condition) && isFieldOrDatumDef(condition); -} -export function hasConditionalValueDef(channelDef) { - const condition = channelDef && channelDef['condition']; - return !!condition && (isArray(condition) || isValueDef(condition)); -} -export function isFieldDef(channelDef) { - // TODO: we can't use field in channelDef here as it's somehow failing runtime test - return !!channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count'); -} -export function channelDefType(channelDef) { - return channelDef && channelDef['type']; -} -export function isDatumDef(channelDef) { - return !!channelDef && 'datum' in channelDef; -} -export function isContinuousFieldOrDatumDef(cd) { - // TODO: make datum support DateTime object - return (isTypedFieldDef(cd) && isContinuous(cd)) || isNumericDataDef(cd); -} -export function isQuantitativeFieldOrDatumDef(cd) { - // TODO: make datum support DateTime object - return channelDefType(cd) === 'quantitative' || isNumericDataDef(cd); -} -export function isNumericDataDef(cd) { - return isDatumDef(cd) && isNumber(cd.datum); -} -export function isFieldOrDatumDef(channelDef) { - return isFieldDef(channelDef) || isDatumDef(channelDef); -} -export function isTypedFieldDef(channelDef) { - return !!channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef; -} -export function isValueDef(channelDef) { - return channelDef && 'value' in channelDef && 'value' in channelDef; -} -export function isScaleFieldDef(channelDef) { - return !!channelDef && ('scale' in channelDef || 'sort' in channelDef); -} -export function isPositionFieldOrDatumDef(channelDef) { - return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef); -} -export function isMarkPropFieldOrDatumDef(channelDef) { - return !!channelDef && 'legend' in channelDef; -} -export function isStringFieldOrDatumDef(channelDef) { - return !!channelDef && ('format' in channelDef || 'formatType' in channelDef); -} -export function toStringFieldDef(fieldDef) { - // omit properties that don't exist in string field defs - return omit(fieldDef, ['legend', 'axis', 'header', 'scale']); -} -function isOpFieldDef(fieldDef) { - return 'op' in fieldDef; -} -/** - * Get a Vega field reference from a Vega-Lite field def. - */ -export function vgField(fieldDef, opt = {}) { - var _a, _b, _c; - let field = fieldDef.field; - const prefix = opt.prefix; - let suffix = opt.suffix; - let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped - if (isCount(fieldDef)) { - field = internalField('count'); - } - else { - let fn; - if (!opt.nofn) { - if (isOpFieldDef(fieldDef)) { - fn = fieldDef.op; - } - else { - const { bin, aggregate, timeUnit } = fieldDef; - if (isBinning(bin)) { - fn = binToString(bin); - suffix = ((_a = opt.binSuffix) !== null && _a !== void 0 ? _a : '') + ((_b = opt.suffix) !== null && _b !== void 0 ? _b : ''); - } - else if (aggregate) { - if (isArgmaxDef(aggregate)) { - argAccessor = `["${field}"]`; - field = `argmax_${aggregate.argmax}`; - } - else if (isArgminDef(aggregate)) { - argAccessor = `["${field}"]`; - field = `argmin_${aggregate.argmin}`; - } - else { - fn = String(aggregate); - } - } - else if (timeUnit) { - fn = timeUnitToString(timeUnit); - suffix = ((!contains(['range', 'mid'], opt.binSuffix) && opt.binSuffix) || '') + ((_c = opt.suffix) !== null && _c !== void 0 ? _c : ''); - } - } - } - if (fn) { - field = field ? `${fn}_${field}` : fn; - } - } - if (suffix) { - field = `${field}_${suffix}`; - } - if (prefix) { - field = `${prefix}_${field}`; - } - if (opt.forAs) { - return removePathFromField(field); - } - else if (opt.expr) { - // Expression to access flattened field. No need to escape dots. - return flatAccessWithDatum(field, opt.expr) + argAccessor; - } - else { - // We flattened all fields so paths should have become dot. - return replacePathInField(field) + argAccessor; - } -} -export function isDiscrete(def) { - switch (def.type) { - case 'nominal': - case 'ordinal': - case 'geojson': - return true; - case 'quantitative': - return isFieldDef(def) && !!def.bin; - case 'temporal': - return false; - } - throw new Error(log.message.invalidFieldType(def.type)); -} -export function isContinuous(fieldDef) { - return !isDiscrete(fieldDef); -} -export function isCount(fieldDef) { - return fieldDef.aggregate === 'count'; -} -export function verbalTitleFormatter(fieldDef, config) { - var _a; - const { field, bin, timeUnit, aggregate } = fieldDef; - if (aggregate === 'count') { - return config.countTitle; - } - else if (isBinning(bin)) { - return `${field} (binned)`; - } - else if (timeUnit) { - const unit = (_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit; - if (unit) { - return `${field} (${getTimeUnitParts(unit).join('-')})`; - } - } - else if (aggregate) { - if (isArgmaxDef(aggregate)) { - return `${field} for max ${aggregate.argmax}`; - } - else if (isArgminDef(aggregate)) { - return `${field} for min ${aggregate.argmin}`; - } - else { - return `${titleCase(aggregate)} of ${field}`; - } - } - return field; -} -export function functionalTitleFormatter(fieldDef) { - const { aggregate, bin, timeUnit, field } = fieldDef; - if (isArgmaxDef(aggregate)) { - return `${field} for argmax(${aggregate.argmax})`; - } - else if (isArgminDef(aggregate)) { - return `${field} for argmin(${aggregate.argmin})`; - } - const timeUnitParams = normalizeTimeUnit(timeUnit); - const fn = aggregate || (timeUnitParams === null || timeUnitParams === void 0 ? void 0 : timeUnitParams.unit) || ((timeUnitParams === null || timeUnitParams === void 0 ? void 0 : timeUnitParams.maxbins) && 'timeunit') || (isBinning(bin) && 'bin'); - if (fn) { - return fn.toUpperCase() + '(' + field + ')'; - } - else { - return field; - } -} -export const defaultTitleFormatter = (fieldDef, config) => { - switch (config.fieldTitle) { - case 'plain': - return fieldDef.field; - case 'functional': - return functionalTitleFormatter(fieldDef); - default: - return verbalTitleFormatter(fieldDef, config); - } -}; -let titleFormatter = defaultTitleFormatter; -export function setTitleFormatter(formatter) { - titleFormatter = formatter; -} -export function resetTitleFormatter() { - setTitleFormatter(defaultTitleFormatter); -} -export function title(fieldOrDatumDef, config, { allowDisabling, includeDefault = true }) { - var _a, _b; - const guideTitle = (_a = getGuide(fieldOrDatumDef)) === null || _a === void 0 ? void 0 : _a.title; - if (!isFieldDef(fieldOrDatumDef)) { - return guideTitle; - } - const fieldDef = fieldOrDatumDef; - const def = includeDefault ? defaultTitle(fieldDef, config) : undefined; - if (allowDisabling) { - return getFirstDefined(guideTitle, fieldDef.title, def); - } - else { - return (_b = guideTitle !== null && guideTitle !== void 0 ? guideTitle : fieldDef.title) !== null && _b !== void 0 ? _b : def; - } -} -export function getGuide(fieldDef) { - if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) { - return fieldDef.axis; - } - else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) { - return fieldDef.legend; - } - else if (isFacetFieldDef(fieldDef) && fieldDef.header) { - return fieldDef.header; - } - return undefined; -} -export function defaultTitle(fieldDef, config) { - return titleFormatter(fieldDef, config); -} -export function getFormatMixins(fieldDef) { - var _a; - if (isStringFieldOrDatumDef(fieldDef)) { - const { format, formatType } = fieldDef; - return { format, formatType }; - } - else { - const guide = (_a = getGuide(fieldDef)) !== null && _a !== void 0 ? _a : {}; - const { format, formatType } = guide; - return { format, formatType }; - } -} -export function defaultType(fieldDef, channel) { - var _a; - switch (channel) { - case 'latitude': - case 'longitude': - return 'quantitative'; - case 'row': - case 'column': - case 'facet': - case 'shape': - case 'strokeDash': - return 'nominal'; - } - if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) { - return 'ordinal'; - } - const { aggregate, bin, timeUnit } = fieldDef; - if (timeUnit) { - return 'temporal'; - } - if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) { - return 'quantitative'; - } - if (isScaleFieldDef(fieldDef) && ((_a = fieldDef.scale) === null || _a === void 0 ? void 0 : _a.type)) { - switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) { - case 'numeric': - case 'discretizing': - return 'quantitative'; - case 'time': - return 'temporal'; - } - } - return 'nominal'; -} -/** - * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef. - * @param channelDef - */ -export function getFieldDef(channelDef) { - if (isFieldDef(channelDef)) { - return channelDef; - } - else if (hasConditionalFieldDef(channelDef)) { - return channelDef.condition; - } - return undefined; -} -export function getFieldOrDatumDef(channelDef) { - if (isFieldOrDatumDef(channelDef)) { - return channelDef; - } - else if (hasConditionalFieldOrDatumDef(channelDef)) { - return channelDef.condition; - } - return undefined; -} -/** - * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. - */ -export function initChannelDef(channelDef, channel, config, opt = {}) { - if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) { - const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean'; - log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef)); - return { value: channelDef }; - } - // If a fieldDef contains a field, we need type. - if (isFieldOrDatumDef(channelDef)) { - return initFieldOrDatumDef(channelDef, channel, config, opt); - } - else if (hasConditionalFieldOrDatumDef(channelDef)) { - return Object.assign(Object.assign({}, channelDef), { - // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition - condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) }); - } - return channelDef; -} -export function initFieldOrDatumDef(fd, channel, config, opt) { - if (isStringFieldOrDatumDef(fd)) { - const { format, formatType } = fd, rest = __rest(fd, ["format", "formatType"]); - if (isCustomFormatType(formatType) && !config.customFormatTypes) { - log.warn(log.message.customFormatTypeNotAllowed(channel)); - return initFieldOrDatumDef(rest, channel, config, opt); - } - } - else { - const guideType = isPositionFieldOrDatumDef(fd) - ? 'axis' - : isMarkPropFieldOrDatumDef(fd) - ? 'legend' - : isFacetFieldDef(fd) - ? 'header' - : null; - if (guideType && fd[guideType]) { - const _a = fd[guideType], { format, formatType } = _a, newGuide = __rest(_a, ["format", "formatType"]); - if (isCustomFormatType(formatType) && !config.customFormatTypes) { - log.warn(log.message.customFormatTypeNotAllowed(channel)); - return initFieldOrDatumDef(Object.assign(Object.assign({}, fd), { [guideType]: newGuide }), channel, config, opt); - } - } - } - if (isFieldDef(fd)) { - return initFieldDef(fd, channel, opt); - } - return initDatumDef(fd); -} -function initDatumDef(datumDef) { - let type = datumDef['type']; - if (type) { - return datumDef; - } - const { datum } = datumDef; - type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined; - return Object.assign(Object.assign({}, datumDef), { type }); -} -export function initFieldDef(fd, channel, { compositeMark = false } = {}) { - const { aggregate, timeUnit, bin, field } = fd; - const fieldDef = Object.assign({}, fd); - // Drop invalid aggregate - if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) { - log.warn(log.message.invalidAggregate(aggregate)); - delete fieldDef.aggregate; - } - // Normalize Time Unit - if (timeUnit) { - fieldDef.timeUnit = normalizeTimeUnit(timeUnit); - } - if (field) { - fieldDef.field = `${field}`; - } - // Normalize bin - if (isBinning(bin)) { - fieldDef.bin = normalizeBin(bin, channel); - } - if (isBinned(bin) && !isXorY(channel)) { - log.warn(log.message.channelShouldNotBeUsedForBinned(channel)); - } - // Normalize Type - if (isTypedFieldDef(fieldDef)) { - const { type } = fieldDef; - const fullType = getFullName(type); - if (type !== fullType) { - // convert short type to full type - fieldDef.type = fullType; - } - if (type !== 'quantitative') { - if (isCountingAggregateOp(aggregate)) { - log.warn(log.message.invalidFieldTypeForCountAggregate(type, aggregate)); - fieldDef.type = 'quantitative'; - } - } - } - else if (!isSecondaryRangeChannel(channel)) { - // If type is empty / invalid, then augment with default type - const newType = defaultType(fieldDef, channel); - fieldDef['type'] = newType; - } - if (isTypedFieldDef(fieldDef)) { - const { compatible, warning } = channelCompatibility(fieldDef, channel) || {}; - if (compatible === false) { - log.warn(warning); - } - } - if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) { - const { sort } = fieldDef; - if (isSortByChannel(sort)) { - return Object.assign(Object.assign({}, fieldDef), { sort: { encoding: sort } }); - } - const sub = sort.substr(1); - if (sort.charAt(0) === '-' && isSortByChannel(sub)) { - return Object.assign(Object.assign({}, fieldDef), { sort: { encoding: sub, order: 'descending' } }); - } - } - if (isFacetFieldDef(fieldDef)) { - const { header } = fieldDef; - const { orient } = header, rest = __rest(header, ["orient"]); - if (orient) { - return Object.assign(Object.assign({}, fieldDef), { header: Object.assign(Object.assign({}, rest), { labelOrient: header.labelOrient || orient, titleOrient: header.titleOrient || orient }) }); - } - } - return fieldDef; -} -export function normalizeBin(bin, channel) { - if (isBoolean(bin)) { - return { maxbins: autoMaxBins(channel) }; - } - else if (bin === 'binned') { - return { - binned: true - }; - } - else if (!bin.maxbins && !bin.step) { - return Object.assign(Object.assign({}, bin), { maxbins: autoMaxBins(channel) }); - } - else { - return bin; - } -} -const COMPATIBLE = { compatible: true }; -export function channelCompatibility(fieldDef, channel) { - const type = fieldDef.type; - if (type === 'geojson' && channel !== 'shape') { - return { - compatible: false, - warning: `Channel ${channel} should not be used with a geojson data.` - }; - } - switch (channel) { - case ROW: - case COLUMN: - case FACET: - if (isContinuous(fieldDef)) { - return { - compatible: false, - warning: log.message.facetChannelShouldBeDiscrete(channel) - }; - } - return COMPATIBLE; - case X: - case Y: - case COLOR: - case FILL: - case STROKE: - case TEXT: - case DETAIL: - case KEY: - case TOOLTIP: - case HREF: - case URL: - case ANGLE: - case THETA: - case RADIUS: - case DESCRIPTION: - return COMPATIBLE; - case LONGITUDE: - case LONGITUDE2: - case LATITUDE: - case LATITUDE2: - if (type !== QUANTITATIVE) { - return { - compatible: false, - warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.` - }; - } - return COMPATIBLE; - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEWIDTH: - case SIZE: - case THETA2: - case RADIUS2: - case X2: - case Y2: - if (type === 'nominal' && !fieldDef['sort']) { - return { - compatible: false, - warning: `Channel ${channel} should not be used with an unsorted discrete field.` - }; - } - return COMPATIBLE; - case STROKEDASH: - if (!contains(['ordinal', 'nominal'], fieldDef.type)) { - return { - compatible: false, - warning: 'StrokeDash channel should be used with only discrete data.' - }; - } - return COMPATIBLE; - case SHAPE: - if (!contains(['ordinal', 'nominal', 'geojson'], fieldDef.type)) { - return { - compatible: false, - warning: 'Shape channel should be used with only either discrete or geojson data.' - }; - } - return COMPATIBLE; - case ORDER: - if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) { - return { - compatible: false, - warning: `Channel order is inappropriate for nominal field, which has no inherent order.` - }; - } - return COMPATIBLE; - } -} -/** - * Check if the field def uses a time format or does not use any format but is temporal - * (this does not cover field defs that are temporal but use a number format). - */ -export function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) { - const { formatType } = getFormatMixins(fieldOrDatumDef); - return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef)); -} -/** - * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`. - */ -export function isTimeFieldDef(def) { - return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit)); -} -/** - * Getting a value associated with a fielddef. - * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit) - */ -export function valueExpr(v, { timeUnit, type, wrapTime, undefinedIfExprNotRequired }) { - var _a; - const unit = timeUnit && ((_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit); - let isTime = unit || type === 'temporal'; - let expr; - if (isSignalRef(v)) { - expr = v.signal; - } - else if (isDateTime(v)) { - isTime = true; - expr = dateTimeToExpr(v); - } - else if (isString(v) || isNumber(v)) { - if (isTime) { - expr = `datetime(${JSON.stringify(v)})`; - if (isLocalSingleTimeUnit(unit)) { - // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit - if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) { - expr = dateTimeToExpr({ [unit]: v }); - } - } - } - } - if (expr) { - return wrapTime && isTime ? `time(${expr})` : expr; - } - // number or boolean or normal string - return undefinedIfExprNotRequired ? undefined : JSON.stringify(v); -} -/** - * Standardize value array -- convert each value to Vega expression if applicable - */ -export function valueArray(fieldOrDatumDef, values) { - const { type } = fieldOrDatumDef; - return values.map(v => { - const expr = valueExpr(v, { - timeUnit: isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.timeUnit : undefined, - type, - undefinedIfExprNotRequired: true - }); - // return signal for the expression if we need an expression - if (expr !== undefined) { - return { signal: expr }; - } - // otherwise just return the original value - return v; - }); -} -/** - * Checks whether a fieldDef for a particular channel requires a computed bin range. - */ -export function binRequiresRange(fieldDef, channel) { - if (!isBinning(fieldDef.bin)) { - console.warn('Only call this method for binned field defs.'); - return false; - } - // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels. - // We could check whether the axis or legend exists (not disabled) but that seems overkill. - return isScaleChannel(channel) && contains(['ordinal', 'nominal'], fieldDef.type); -} -//# sourceMappingURL=channeldef.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/channeldef.js.map b/node_modules/vega-lite/build/src/channeldef.js.map deleted file mode 100644 index db4f94f..0000000 --- a/node_modules/vega-lite/build/src/channeldef.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"channeldef.js","sourceRoot":"","sources":["../../src/channeldef.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AACjE,OAAO,EAAY,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,qBAAqB,EAAC,MAAM,aAAa,CAAC;AAEtG,OAAO,EAAC,WAAW,EAAkB,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AACpF,OAAO,EACL,KAAK,EAEL,KAAK,EACL,MAAM,EACN,WAAW,EACX,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,cAAc,EACd,uBAAuB,EACvB,MAAM,EACN,GAAG,EACH,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,KAAK,E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,4DAA4D;QAC5D,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;SACvB;QACD,2CAA2C;QAC3C,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAA0B,EAAE,OAAgB;IAC3E,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC5B,OAAO,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QAC7D,OAAO,KAAK,CAAC;KACd;IAED,6JAA6J;IAC7J,2FAA2F;IAC3F,OAAO,cAAc,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAG,QAAkC,CAAC,IAAI,CAAC,CAAC;AAC/G,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/assemble.d.ts b/node_modules/vega-lite/build/src/compile/axis/assemble.d.ts deleted file mode 100644 index 340d989..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/assemble.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Axis as VgAxis, NewSignal } from 'vega'; -import { Config } from '../../config'; -import { Model } from '../model'; -import { AxisComponent, AxisComponentIndex } from './component'; -export declare function assembleAxis(axisCmpt: AxisComponent, kind: 'main' | 'grid', config: Config, opt?: { - header: boolean; -}): VgAxis; -/** - * Add axis signals so grid line works correctly - * (Fix https://github.com/vega/vega-lite/issues/4226) - */ -export declare function assembleAxisSignals(model: Model): NewSignal[]; -export declare function assembleAxes(axisComponents: AxisComponentIndex, config: Config): VgAxis[]; -//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/assemble.d.ts.map b/node_modules/vega-lite/build/src/compile/axis/assemble.d.ts.map deleted file mode 100644 index 55f7c82..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/assemble.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,MAAM,EAAc,SAAS,EAAkB,MAAM,MAAM,CAAC;AAK5E,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAKpC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAyB9D,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,GAAG,GAAE;IACH,MAAM,EAAE,OAAO,CAAC;CACC,GAClB,MAAM,CA0IR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,CAwB7D;AAED,wBAAgB,YAAY,CAAC,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAQzF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/assemble.js b/node_modules/vega-lite/build/src/compile/axis/assemble.js deleted file mode 100644 index 46c2685..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/assemble.js +++ /dev/null @@ -1,170 +0,0 @@ -import { __rest } from "tslib"; -import { array, isArray } from 'vega-util'; -import { AXIS_PARTS, AXIS_PROPERTY_TYPE, CONDITIONAL_AXIS_PROP_INDEX, isConditionalAxisValue } from '../../axis'; -import { POSITION_SCALE_CHANNELS } from '../../channel'; -import { defaultTitle } from '../../channeldef'; -import { isText } from '../../title'; -import { getFirstDefined, isEmpty, replaceAll } from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { exprFromValueOrSignalRef } from '../common'; -import { expression } from '../predicate'; -function assembleTitle(title, config) { - if (!title) { - return undefined; - } - if (isArray(title) && !isText(title)) { - return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', '); - } - return title; -} -function setAxisEncode(axis, part, vgProp, vgRef) { - var _a, _b, _c; - axis.encode = (_a = axis.encode) !== null && _a !== void 0 ? _a : {}; - axis.encode[part] = (_b = axis.encode[part]) !== null && _b !== void 0 ? _b : {}; - axis.encode[part].update = (_c = axis.encode[part].update) !== null && _c !== void 0 ? _c : {}; - // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 - axis.encode[part].update[vgProp] = vgRef; -} -export function assembleAxis(axisCmpt, kind, config, opt = { header: false }) { - var _a, _b; - const _c = axisCmpt.combine(), { disable, orient, scale, labelExpr, title, zindex } = _c, axis = __rest(_c, ["disable", "orient", "scale", "labelExpr", "title", "zindex"]); - if (disable) { - return undefined; - } - for (const prop in axis) { - const propType = AXIS_PROPERTY_TYPE[prop]; - const propValue = axis[prop]; - if (propType && propType !== kind && propType !== 'both') { - // Remove properties that are not valid for this kind of axis - delete axis[prop]; - } - else if (isConditionalAxisValue(propValue)) { - // deal with conditional axis value - const { condition } = propValue, valueOrSignalRef = __rest(propValue, ["condition"]); - const conditions = array(condition); - const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; - if (propIndex) { - const { vgProp, part } = propIndex; - // If there is a corresponding Vega property for the channel, - // use Vega's custom axis encoding and delete the original axis property to avoid conflicts - const vgRef = [ - ...conditions.map(c => { - const { test } = c, valueOrSignalCRef = __rest(c, ["test"]); - return Object.assign({ test: expression(null, test) }, valueOrSignalCRef); - }), - valueOrSignalRef - ]; - setAxisEncode(axis, part, vgProp, vgRef); - delete axis[prop]; - } - else if (propIndex === null) { - // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead. - const signalRef = { - signal: conditions - .map(c => { - const { test } = c, valueOrSignalCRef = __rest(c, ["test"]); - return `${expression(null, test)} ? ${exprFromValueOrSignalRef(valueOrSignalCRef)} : `; - }) - .join('') + exprFromValueOrSignalRef(valueOrSignalRef) - }; - axis[prop] = signalRef; - } - } - else if (isSignalRef(propValue)) { - const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; - if (propIndex) { - const { vgProp, part } = propIndex; - setAxisEncode(axis, part, vgProp, propValue); - delete axis[prop]; - } // else do nothing since the property already supports signal - } - } - if (kind === 'grid') { - if (!axis.grid) { - return undefined; - } - // Remove unnecessary encode block - if (axis.encode) { - // Only need to keep encode block for grid - const { grid } = axis.encode; - axis.encode = Object.assign({}, (grid ? { grid } : {})); - if (isEmpty(axis.encode)) { - delete axis.encode; - } - } - return Object.assign(Object.assign({ scale, - orient }, axis), { domain: false, labels: false, aria: false, - // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent` - // would not affect gridAxis - maxExtent: 0, minExtent: 0, ticks: false, zindex: getFirstDefined(zindex, 0) // put grid behind marks by default - }); - } - else { - // kind === 'main' - if (!opt.header && axisCmpt.mainExtracted) { - // if mainExtracted has been extracted to a separate facet - return undefined; - } - if (labelExpr !== undefined) { - let expr = labelExpr; - if (((_b = (_a = axis.encode) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.update) && isSignalRef(axis.encode.labels.update.text)) { - expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal); - } - setAxisEncode(axis, 'labels', 'text', { signal: expr }); - } - if (axis.labelAlign === null) { - delete axis.labelAlign; - } - // Remove unnecessary encode block - if (axis.encode) { - for (const part of AXIS_PARTS) { - if (!axisCmpt.hasAxisPart(part)) { - delete axis.encode[part]; - } - } - if (isEmpty(axis.encode)) { - delete axis.encode; - } - } - const titleString = assembleTitle(title, config); - return Object.assign(Object.assign(Object.assign(Object.assign({ scale, - orient, grid: false }, (titleString ? { title: titleString } : {})), axis), (config.aria === false ? { aria: false } : {})), { zindex: getFirstDefined(zindex, 0) // put axis line above marks by default - }); - } -} -/** - * Add axis signals so grid line works correctly - * (Fix https://github.com/vega/vega-lite/issues/4226) - */ -export function assembleAxisSignals(model) { - const { axes } = model.component; - const signals = []; - for (const channel of POSITION_SCALE_CHANNELS) { - if (axes[channel]) { - for (const axis of axes[channel]) { - if (!axis.get('disable') && !axis.get('gridScale')) { - // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width. - const sizeType = channel === 'x' ? 'height' : 'width'; - const update = model.getSizeSignalRef(sizeType).signal; - if (sizeType !== update) { - signals.push({ - name: sizeType, - update: update - }); - } - } - } - } - } - return signals; -} -export function assembleAxes(axisComponents, config) { - const { x = [], y = [] } = axisComponents; - return [ - ...x.map(a => assembleAxis(a, 'grid', config)), - ...y.map(a => assembleAxis(a, 'grid', config)), - ...x.map(a => assembleAxis(a, 'main', config)), - ...y.map(a => assembleAxis(a, 'main', config)) - ].filter(a => a); // filter undefined -} -//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/assemble.js.map b/node_modules/vega-lite/build/src/compile/axis/assemble.js.map deleted file mode 100644 index 25e347d..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/assemble.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/axis/assemble.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACzC,OAAO,EAAC,UAAU,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAC/G,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,YAAY,EAAe,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,eAAe,EAAE,OAAO,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AAChE,OAAO,EAAC,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAC,wBAAwB,EAAC,MAAM,WAAW,CAAC;AAEnD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AAM,UAAU,YAAY,CAAC,cAAkC,EAAE,MAAc;IAC7E,MAAM,EAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,EAAC,GAAG,cAAc,CAAC;IACxC,OAAO;QACL,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/C,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB;AACvC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/component.d.ts b/node_modules/vega-lite/build/src/compile/axis/component.d.ts deleted file mode 100644 index 39513e5..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/component.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Axis as VgAxis, SignalRef, Text } from 'vega'; -import { Axis, AxisPart, AxisPropsWithConditionAndSignal, ConditionalAxisProp, SignalAxisProp } from '../../axis'; -import { FieldDefBase } from '../../channeldef'; -import { Split } from '../split'; -export declare type AxisComponentProps = Omit & Omit & { - title: Text | FieldDefBase[] | SignalRef; - labelExpr: string; - disable: boolean; -}; -export declare const AXIS_COMPONENT_PROPERTIES: ("orient" | "tickCount" | "aria" | "description" | "offset" | "titleAlign" | "titleAnchor" | "titleBaseline" | "titleColor" | "titleFont" | "titleFontSize" | "titleFontStyle" | "titleFontWeight" | "titleLimit" | "titleLineHeight" | "titleOpacity" | "titlePadding" | "labelAlign" | "labelBaseline" | "labelColor" | "labelFont" | "labelFontSize" | "labelFontStyle" | "labelFontWeight" | "labelLimit" | "labelOpacity" | "labelPadding" | "labelOffset" | "labelOverlap" | "labelSeparation" | "zindex" | "values" | "domain" | "title" | "labels" | "format" | "formatType" | "tickMinStep" | "encode" | "labelExpr" | "disable" | "titleAngle" | "labelAngle" | "labelLineHeight" | "scale" | "translate" | "ticks" | "gridColor" | "gridDash" | "gridDashOffset" | "gridOpacity" | "gridWidth" | "tickColor" | "tickDash" | "tickDashOffset" | "tickOpacity" | "tickSize" | "tickWidth" | "domainColor" | "minExtent" | "maxExtent" | "bandPosition" | "titleX" | "titleY" | "domainCap" | "domainDash" | "domainDashOffset" | "domainOpacity" | "domainWidth" | "tickBand" | "tickCap" | "tickExtra" | "tickOffset" | "tickRound" | "grid" | "gridCap" | "labelBound" | "labelFlush" | "labelFlushOffset" | "position" | "gridScale")[]; -export declare class AxisComponent extends Split { - readonly explicit: Partial; - readonly implicit: Partial; - mainExtracted: boolean; - constructor(explicit?: Partial, implicit?: Partial, mainExtracted?: boolean); - clone(): AxisComponent; - hasAxisPart(part: AxisPart): boolean; - hasOrientSignalRef(): boolean; -} -export interface AxisComponentIndex { - x?: AxisComponent[]; - y?: AxisComponent[]; -} -export interface AxisIndex { - x?: Axis; - y?: Axis; -} -//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/component.d.ts.map b/node_modules/vega-lite/build/src/compile/axis/component.d.ts.map deleted file mode 100644 index 5d30947..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/component.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACrD,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,+BAA+B,EAE/B,mBAAmB,EACnB,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAO/B,oBAAY,kBAAkB,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB,GAAG,cAAc,CAAC,GAC3F,IAAI,CAAC,+BAA+B,EAAE,OAAO,CAAC,GAAG;IAC/C,KAAK,EAAE,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAWJ,eAAO,MAAM,yBAAyB,qrCAAwC,CAAC;AAE/E,qBAAa,aAAc,SAAQ,KAAK,CAAC,kBAAkB,CAAC;aAExC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC;aACrC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAC9C,aAAa;gBAFJ,QAAQ,GAAE,OAAO,CAAC,kBAAkB,CAAM,EAC1C,QAAQ,GAAE,OAAO,CAAC,kBAAkB,CAAM,EACnD,aAAa,UAAQ;IAKvB,KAAK;IAIL,WAAW,CAAC,IAAI,EAAE,QAAQ;IAe1B,kBAAkB;CAG1B;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;IACpB,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,CAAC,EAAE,IAAI,CAAC;IACT,CAAC,CAAC,EAAE,IAAI,CAAC;CACV"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/component.js b/node_modules/vega-lite/build/src/compile/axis/component.js deleted file mode 100644 index 5099db1..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/component.js +++ /dev/null @@ -1,36 +0,0 @@ -import { COMMON_AXIS_PROPERTIES_INDEX } from '../../axis'; -import { duplicate, keys } from '../../util'; -import { Split } from '../split'; -import { isSignalRef } from '../../vega.schema'; -function isFalseOrNull(v) { - return v === false || v === null; -} -const AXIS_COMPONENT_PROPERTIES_INDEX = Object.assign(Object.assign({ disable: 1, gridScale: 1, scale: 1 }, COMMON_AXIS_PROPERTIES_INDEX), { labelExpr: 1, encode: 1 }); -export const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX); -export class AxisComponent extends Split { - constructor(explicit = {}, implicit = {}, mainExtracted = false) { - super(); - this.explicit = explicit; - this.implicit = implicit; - this.mainExtracted = mainExtracted; - } - clone() { - return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted); - } - hasAxisPart(part) { - // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme. - if (part === 'axis') { - // always has the axis container part - return true; - } - if (part === 'grid' || part === 'title') { - return !!this.get(part); - } - // Other parts are enabled by default, so they should not be false or null. - return !isFalseOrNull(this.get(part)); - } - hasOrientSignalRef() { - return isSignalRef(this.explicit.orient); - } -} -//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/component.js.map b/node_modules/vega-lite/build/src/compile/axis/component.js.map deleted file mode 100644 index c0ae17e..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/component.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/axis/component.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,4BAA4B,EAG7B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAC,SAAS,EAAQ,IAAI,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE9C,SA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-lite/build/src/compile/axis/config.d.ts b/node_modules/vega-lite/build/src/compile/axis/config.d.ts deleted file mode 100644 index 3e16b81..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/config.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ScaleType, SignalRef } from 'vega'; -import { AxisConfig } from '../../axis'; -import { PositionScaleChannel } from '../../channel'; -import { Config, StyleConfigIndex } from '../../config'; -export declare type AxisConfigs = ReturnType; -export declare function getAxisConfigs(channel: PositionScaleChannel, scaleType: ScaleType, orient: string | SignalRef, config: Config): { - vlOnlyAxisConfig: any; - vgAxisConfig: any; - axisConfigStyle: any; -}; -export declare function getAxisConfigStyle(axisConfigTypes: string[], config: Config): any; -export declare function getAxisConfig(property: keyof AxisConfig, styleConfigIndex: StyleConfigIndex, style: string | string[], axisConfigs?: Partial): { - configFrom?: string; - configValue?: any; -}; -//# sourceMappingURL=config.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/config.d.ts.map b/node_modules/vega-lite/build/src/compile/axis/config.d.ts.map deleted file mode 100644 index 469a8a4..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/config.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAyCtD,oBAAY,WAAW,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,MAAM;;;;EA8Bf;AAED,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,OAa3E;AACD,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,UAAU,EAC1B,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,WAAW,GAAE,OAAO,CAAC,WAAW,CAAM,GACrC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,GAAG,CAAA;CAAC,CAgB1C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/config.js b/node_modules/vega-lite/build/src/compile/axis/config.js deleted file mode 100644 index 1541ca7..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/config.js +++ /dev/null @@ -1,85 +0,0 @@ -import { array } from 'vega-util'; -import { isQuantitative } from '../../scale'; -import { keys, titleCase } from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { getStyleConfig, signalOrStringValue } from '../common'; -function getAxisConfigFromConfigTypes(configTypes, config, channel, orient) { - // TODO: add special casing to add conditional value based on orient signal - return Object.assign.apply(null, [ - {}, - ...configTypes.map(configType => { - if (configType === 'axisOrient') { - const orient1 = channel === 'x' ? 'bottom' : 'left'; - const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {}; - const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {}; - const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]); - const conditionalOrientAxisConfig = {}; - for (const prop of props.values()) { - conditionalOrientAxisConfig[prop] = { - // orient is surely signal in this case - signal: `${orient['signal']} === "${orient1}" ? ${signalOrStringValue(orientConfig1[prop])} : ${signalOrStringValue(orientConfig2[prop])}` - }; - } - return conditionalOrientAxisConfig; - } - return config[configType]; - }) - ]); -} -export function getAxisConfigs(channel, scaleType, orient, config) { - const typeBasedConfigTypes = scaleType === 'band' - ? ['axisDiscrete', 'axisBand'] - : scaleType === 'point' - ? ['axisDiscrete', 'axisPoint'] - : isQuantitative(scaleType) - ? ['axisQuantitative'] - : scaleType === 'time' || scaleType === 'utc' - ? ['axisTemporal'] - : []; - const axisChannel = channel === 'x' ? 'axisX' : 'axisY'; - const axisOrient = isSignalRef(orient) ? 'axisOrient' : 'axis' + titleCase(orient); // axisTop, axisBottom, ... - const vlOnlyConfigTypes = [ - // technically Vega does have axisBand, but if we make another separation here, - // it will further introduce complexity in the code - ...typeBasedConfigTypes, - ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4)) - ]; - const vgConfigTypes = ['axis', axisOrient, axisChannel]; - return { - vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient), - vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient), - axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config) - }; -} -export function getAxisConfigStyle(axisConfigTypes, config) { - var _a; - const toMerge = [{}]; - for (const configType of axisConfigTypes) { - // TODO: add special casing to add conditional value based on orient signal - let style = (_a = config[configType]) === null || _a === void 0 ? void 0 : _a.style; - if (style) { - style = array(style); - for (const s of style) { - toMerge.push(config.style[s]); - } - } - } - return Object.assign.apply(null, toMerge); -} -export function getAxisConfig(property, styleConfigIndex, style, axisConfigs = {}) { - var _a; - const styleConfig = getStyleConfig(property, style, styleConfigIndex); - if (styleConfig !== undefined) { - return { - configFrom: 'style', - configValue: styleConfig - }; - } - for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) { - if (((_a = axisConfigs[configFrom]) === null || _a === void 0 ? void 0 : _a[property]) !== undefined) { - return { configFrom, configValue: axisConfigs[configFrom][property] }; - } - } - return {}; -} -//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/config.js.map b/node_modules/vega-lite/build/src/compile/axis/config.js.map deleted file mode 100644 index a9de116..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/config.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/compile/axis/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAIhC,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAC,IAAI,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAE9D,SAAS,4BAA4B,CACnC,WAAqB,EACrB,MAAc,EACd,OAAkB,EAClB,MAA0B;IAE1B,2EAA2E;IAC3E,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;QAC/B,EAAE;QACF,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC9B,IAAI,UAAU,KAAK,YAAY,EAAE;gBAC/B,MAAM,OAAO,GAAG,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;gBACpD,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;gBAChF,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;gBAE9E,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;gBAExE,MAAM,2BAA2B,GAAG,EAAE,CAAC;gBACvC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;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;IAED,KAAK,MAAM,UAAU,IAAI,CAAC,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,CAAC,EAAE;QAChF,IAAI,OAAA,WAAW,CAAC,UAAU,CAAC,0CAAG,QAAQ,OAAM,SAAS,EAAE;YACrD,OAAO,EAAC,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,EAAC,CAAC;SACrE;KACF;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/encode.d.ts b/node_modules/vega-lite/build/src/compile/axis/encode.d.ts deleted file mode 100644 index 3af137c..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/encode.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { PositionScaleChannel } from '../../channel'; -import { UnitModel } from '../unit'; -export declare function labels(model: UnitModel, channel: PositionScaleChannel, specifiedLabelsSpec: any): any; -//# sourceMappingURL=encode.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/encode.d.ts.map b/node_modules/vega-lite/build/src/compile/axis/encode.d.ts.map deleted file mode 100644 index e4ba84f..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/encode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAG7E,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,OAsB/F"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/encode.js b/node_modules/vega-lite/build/src/compile/axis/encode.js deleted file mode 100644 index 87fd7ce..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/encode.js +++ /dev/null @@ -1,21 +0,0 @@ -import { getSecondaryRangeChannel } from '../../channel'; -import { getFieldOrDatumDef } from '../../channeldef'; -import { formatCustomType, isCustomFormatType } from '../format'; -export function labels(model, channel, specifiedLabelsSpec) { - var _a; - const { encoding, config } = model; - const fieldOrDatumDef = (_a = getFieldOrDatumDef(encoding[channel])) !== null && _a !== void 0 ? _a : getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]); - const axis = model.axis(channel) || {}; - const { format, formatType } = axis; - if (isCustomFormatType(formatType)) { - return Object.assign({ text: formatCustomType({ - fieldOrDatumDef, - field: 'datum.value', - format, - formatType, - config - }) }, specifiedLabelsSpec); - } - return specifiedLabelsSpec; -} -//# sourceMappingURL=encode.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/encode.js.map b/node_modules/vega-lite/build/src/compile/axis/encode.js.map deleted file mode 100644 index fe440db..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/encode.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../../../src/compile/axis/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAuB,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAG/D,MAAM,UAAU,MAAM,CAAC,KAAgB,EAAE,OAA6B,EAAE,mBAAwB;;IAC9F,MAAM,EAAC,QAAQ,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAEjC,MAAM,eAAe,SACnB,kBAAkB,CAAS,QAAQ,CAAC,OAAO,CAAC,CAAC,mCAAI,kBAAkB,CAAC,QAAQ,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACnH,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACvC,MAAM,EAAC,MAAM,EAAE,UAAU,EAAC,GAAG,IAAI,CAAC;IAElC,IAAI,kBAAkB,CAAC,UAAU,CAAC,EAAE;QAClC,uBACE,IAAI,EAAE,gBAAgB,CAAC;gBACrB,eAAe;gBACf,KAAK,EAAE,aAAa;gBACpB,MAAM;gBACN,UAAU;gBACV,MAAM;aACP,CAAC,IACC,mBAAmB,EACtB;KACH;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/parse.d.ts b/node_modules/vega-lite/build/src/compile/axis/parse.d.ts deleted file mode 100644 index 03b12ba..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/parse.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { LayerModel } from '../layer'; -import { UnitModel } from '../unit'; -import { AxisComponentIndex } from './component'; -export declare function parseUnitAxes(model: UnitModel): AxisComponentIndex; -export declare function parseLayerAxes(model: LayerModel): void; -//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/parse.d.ts.map b/node_modules/vega-lite/build/src/compile/axis/parse.d.ts.map deleted file mode 100644 index 2b90bf6..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/parse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/parse.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAgB,kBAAkB,EAAgD,MAAM,aAAa,CAAC;AAK7G,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,kBAAkB,CAOlE;AASD,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,QAsE/C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/parse.js b/node_modules/vega-lite/build/src/compile/axis/parse.js deleted file mode 100644 index 84ae0bd..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/parse.js +++ /dev/null @@ -1,262 +0,0 @@ -import { AXIS_PARTS, isAxisProperty, isConditionalAxisValue } from '../../axis'; -import { POSITION_SCALE_CHANNELS } from '../../channel'; -import { getFieldOrDatumDef } from '../../channeldef'; -import { getFirstDefined, isEmpty, keys, normalizeAngle } from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { mergeTitleComponent } from '../common'; -import { guideEncodeEntry } from '../guide'; -import { parseGuideResolve } from '../resolve'; -import { defaultTieBreaker, mergeValuesWithExplicit } from '../split'; -import { AxisComponent, AXIS_COMPONENT_PROPERTIES } from './component'; -import { getAxisConfig, getAxisConfigs } from './config'; -import * as encode from './encode'; -import { axisRules, defaultOrient, getFieldDefTitle, getLabelAngle } from './properties'; -export function parseUnitAxes(model) { - return POSITION_SCALE_CHANNELS.reduce((axis, channel) => { - if (model.component.scales[channel]) { - axis[channel] = [parseAxis(channel, model)]; - } - return axis; - }, {}); -} -const OPPOSITE_ORIENT = { - bottom: 'top', - top: 'bottom', - left: 'right', - right: 'left' -}; -export function parseLayerAxes(model) { - var _a; - const { axes, resolve } = model.component; - const axisCount = { top: 0, bottom: 0, right: 0, left: 0 }; - for (const child of model.children) { - child.parseAxesAndHeaders(); - for (const channel of keys(child.component.axes)) { - resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel); - if (resolve.axis[channel] === 'shared') { - // If the resolve says shared (and has not been overridden) - // We will try to merge and see if there is a conflict - axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]); - if (!axes[channel]) { - // If merge returns nothing, there is a conflict so we cannot make the axis shared. - // Thus, mark axis as independent and remove the axis component. - resolve.axis[channel] = 'independent'; - delete axes[channel]; - } - } - } - } - // Move axes to layer's axis component and merge shared axes - for (const channel of POSITION_SCALE_CHANNELS) { - for (const child of model.children) { - if (!child.component.axes[channel]) { - // skip if the child does not have a particular axis - continue; - } - if (resolve.axis[channel] === 'independent') { - // If axes are independent, concat the axisComponent array. - axes[channel] = ((_a = axes[channel]) !== null && _a !== void 0 ? _a : []).concat(child.component.axes[channel]); - // Automatically adjust orient - for (const axisComponent of child.component.axes[channel]) { - const { value: orient, explicit } = axisComponent.getWithExplicit('orient'); - if (isSignalRef(orient)) { - continue; - } - if (axisCount[orient] > 0 && !explicit) { - // Change axis orient if the number do not match - const oppositeOrient = OPPOSITE_ORIENT[orient]; - if (axisCount[orient] > axisCount[oppositeOrient]) { - axisComponent.set('orient', oppositeOrient, false); - } - } - axisCount[orient]++; - // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset? - } - } - // After merging, make sure to remove axes from child - delete child.component.axes[channel]; - } - // Suppress grid lines for dual axis charts (https://github.com/vega/vega-lite/issues/4676) - if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) { - for (const axisCmpt of axes[channel]) { - if (!!axisCmpt.get('grid') && !axisCmpt.explicit.grid) { - axisCmpt.implicit.grid = false; - } - } - } - } -} -function mergeAxisComponents(mergedAxisCmpts, childAxisCmpts) { - if (mergedAxisCmpts) { - // FIXME: this is a bit wrong once we support multiple axes - if (mergedAxisCmpts.length !== childAxisCmpts.length) { - return undefined; // Cannot merge axis component with different number of axes. - } - const length = mergedAxisCmpts.length; - for (let i = 0; i < length; i++) { - const merged = mergedAxisCmpts[i]; - const child = childAxisCmpts[i]; - if (!!merged !== !!child) { - return undefined; - } - else if (merged && child) { - const mergedOrient = merged.getWithExplicit('orient'); - const childOrient = child.getWithExplicit('orient'); - if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { - // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) - // Cannot merge due to inconsistent orient - return undefined; - } - else { - mergedAxisCmpts[i] = mergeAxisComponent(merged, child); - } - } - } - } - else { - // For first one, return a copy of the child - return childAxisCmpts.map(axisComponent => axisComponent.clone()); - } - return mergedAxisCmpts; -} -function mergeAxisComponent(merged, child) { - for (const prop of AXIS_COMPONENT_PROPERTIES) { - const mergedValueWithExplicit = mergeValuesWithExplicit(merged.getWithExplicit(prop), child.getWithExplicit(prop), prop, 'axis', - // Tie breaker function - (v1, v2) => { - switch (prop) { - case 'title': - return mergeTitleComponent(v1, v2); - case 'gridScale': - return { - explicit: v1.explicit, - value: getFirstDefined(v1.value, v2.value) - }; - } - return defaultTieBreaker(v1, v2, prop, 'axis'); - }); - merged.setWithExplicit(prop, mergedValueWithExplicit); - } - return merged; -} -// eslint-disable-next-line @typescript-eslint/ban-types -function isExplicit(value, property, axis, model, channel) { - if (property === 'disable') { - return axis !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit - } - axis = axis || {}; - switch (property) { - case 'titleAngle': - case 'labelAngle': - return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle)); - case 'values': - return !!axis.values; - // specified axis.values is already respected, but may get transformed. - case 'encode': - // both VL axis.encoding and axis.labelAngle affect VG axis.encode - return !!axis.encoding || !!axis.labelAngle; - case 'title': - // title can be explicit if fieldDef.title is set - if (value === getFieldDefTitle(model, channel)) { - return true; - } - } - // Otherwise, things are explicit if the returned value matches the specified property - return value === axis[property]; -} -/** - * Properties to always include values from config - */ -const propsToAlwaysIncludeConfig = new Set([ - 'grid', - 'translate', - // the rest are not axis configs in Vega, but are in VL, so we need to set too. - 'format', - 'formatType', - 'orient', - 'labelExpr', - 'tickCount', - 'position', - 'tickMinStep' -]); -function parseAxis(channel, model) { - var _a, _b, _c; - let axis = model.axis(channel); - const axisComponent = new AxisComponent(); - const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]); - const { mark, config } = model; - const orient = (axis === null || axis === void 0 ? void 0 : axis.orient) || ((_a = config[channel === 'x' ? 'axisX' : 'axisY']) === null || _a === void 0 ? void 0 : _a.orient) || ((_b = config.axis) === null || _b === void 0 ? void 0 : _b.orient) || - defaultOrient(channel); - const scaleType = model.getScaleComponent(channel).get('type'); - const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config); - const disable = axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis === null || axis === void 0 ? void 0 : axis.style, axisConfigs).configValue; - axisComponent.set('disable', disable, axis !== undefined); - if (disable) { - return axisComponent; - } - axis = axis || {}; - const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs); - const ruleParams = { - fieldOrDatumDef, - axis, - channel, - model, - scaleType, - orient, - labelAngle, - mark, - config - }; - // 1.2. Add properties - for (const property of AXIS_COMPONENT_PROPERTIES) { - const value = property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined; - const hasValue = value !== undefined; - const explicit = isExplicit(value, property, axis, model, channel); - if (hasValue && explicit) { - axisComponent.set(property, value, explicit); - } - else { - const { configValue = undefined, configFrom = undefined } = isAxisProperty(property) && property !== 'values' - ? getAxisConfig(property, config.style, axis.style, axisConfigs) - : {}; - const hasConfigValue = configValue !== undefined; - if (hasValue && !hasConfigValue) { - // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config) - axisComponent.set(property, value, explicit); - } - else if ( - // Cases need implicit values - // 1. Axis config that aren't available in Vega - !(configFrom === 'vgAxisConfig') || - // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details) - (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) || - // 3. Conditional axis values and signals - isConditionalAxisValue(configValue) || - isSignalRef(configValue)) { - // If a config is specified and is conditional, copy conditional value from axis config - axisComponent.set(property, configValue, false); - } - } - } - // 2) Add guide encode definition groups - const axisEncoding = (_c = axis.encoding) !== null && _c !== void 0 ? _c : {}; - const axisEncode = AXIS_PARTS.reduce((e, part) => { - var _a; - if (!axisComponent.hasAxisPart(part)) { - // No need to create encode for a disabled part. - return e; - } - const axisEncodingPart = guideEncodeEntry((_a = axisEncoding[part]) !== null && _a !== void 0 ? _a : {}, model); - const value = part === 'labels' ? encode.labels(model, channel, axisEncodingPart) : axisEncodingPart; - if (value !== undefined && !isEmpty(value)) { - e[part] = { update: value }; - } - return e; - }, {}); - // FIXME: By having encode as one property, we won't have fine grained encode merging. - if (!isEmpty(axisEncode)) { - axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined); - } - return axisComponent; -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/parse.js.map b/node_modules/vega-lite/build/src/compile/axis/parse.js.map deleted file mode 100644 index 66dbbb6..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/axis/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,UAAU,EAAE,cAAc,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AACpF,OAAO,EAAuB,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAC,kBAAkB,EAAqC,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAC,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAY,uBAAuB,EAAC,MAAM,UAAU,CAAC;AAE9E,OAAO,EAAC,aAAa,EAA0C,yBAAyB,EAAC,MAAM,aAAa,CAAC;AAC7G,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAiB,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAEvG,MAAM,UAAU,aAAa,CAAC,KA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newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/properties.d.ts b/node_modules/vega-lite/build/src/compile/axis/properties.d.ts deleted file mode 100644 index 2577dc2..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/properties.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Align, AxisOrient, Orient, SignalRef } from 'vega'; -import { Axis } from '../../axis'; -import { PositionScaleChannel } from '../../channel'; -import { DatumDef, PositionDatumDef, PositionFieldDef, TypedFieldDef } from '../../channeldef'; -import { Config, StyleConfigIndex } from '../../config'; -import { Mark } from '../../mark'; -import { Sort } from '../../sort'; -import { Type } from '../../type'; -import { UnitModel } from '../unit'; -import { ScaleType } from './../../scale'; -import { AxisComponentProps } from './component'; -import { AxisConfigs } from './config'; -export interface AxisRuleParams { - fieldOrDatumDef: PositionFieldDef | PositionDatumDef; - axis: Axis; - channel: PositionScaleChannel; - model: UnitModel; - mark: Mark; - scaleType: ScaleType; - orient: Orient | SignalRef; - labelAngle: number | SignalRef; - config: Config; -} -export declare const axisRules: { - [k in keyof AxisComponentProps]?: (params: AxisRuleParams) => AxisComponentProps[k]; -}; -/** - * Default rules for whether to show a grid should be shown for a channel. - * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned - */ -export declare function defaultGrid(scaleType: ScaleType, fieldDef: TypedFieldDef | DatumDef): boolean; -export declare function gridScale(model: UnitModel, channel: PositionScaleChannel): string; -export declare function getLabelAngle(fieldOrDatumDef: PositionFieldDef | PositionDatumDef, axis: Axis, channel: PositionScaleChannel, styleConfig: StyleConfigIndex, axisConfigs?: AxisConfigs): number | SignalRef; -export declare function normalizeAngleExpr(angle: SignalRef): string; -export declare function defaultLabelBaseline(angle: number | SignalRef, orient: AxisOrient | SignalRef, channel: 'x' | 'y', alwaysIncludeMiddle?: boolean): "top" | "middle" | "bottom" | { - signal: string; -}; -export declare function defaultLabelAlign(angle: number | SignalRef, orient: AxisOrient | SignalRef, channel: 'x' | 'y'): Align | SignalRef; -export declare function defaultLabelFlush(type: Type, channel: PositionScaleChannel): boolean; -export declare function defaultLabelOverlap(type: Type, scaleType: ScaleType, hasTimeUnit: boolean, sort?: Sort): true | "greedy"; -export declare function defaultOrient(channel: PositionScaleChannel): "left" | "bottom"; -export declare function defaultTickCount({ fieldOrDatumDef, scaleType, size, values: vals }: { - fieldOrDatumDef: TypedFieldDef | DatumDef; - scaleType: ScaleType; - size?: SignalRef; - values?: Axis['values']; -}): { - signal: string; -}; -export declare function getFieldDefTitle(model: UnitModel, channel: 'x' | 'y'): string | string[] | SignalRef; -export declare function values(axis: Axis, fieldOrDatumDef: TypedFieldDef | DatumDef): SignalRef | (string | number | boolean | import("../../datetime").DateTime | { - signal: string; -})[]; -export declare function defaultZindex(mark: Mark, fieldDef: TypedFieldDef | DatumDef): 1 | 0; -//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/properties.d.ts.map b/node_modules/vega-lite/build/src/compile/axis/properties.d.ts.map deleted file mode 100644 index dd8e6a7..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/properties.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAE1D,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhC,OAAO,EAAC,oBAAoB,EAAI,MAAM,eAAe,CAAC;AACtD,OAAO,EACL,QAAQ,EAGR,gBAAgB,EAChB,gBAAgB,EAEhB,aAAa,EAEd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACtD,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhC,OAAO,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newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/properties.js b/node_modules/vega-lite/build/src/compile/axis/properties.js deleted file mode 100644 index 6b73b26..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/properties.js +++ /dev/null @@ -1,254 +0,0 @@ -import { isArray, isObject } from 'vega-util'; -import { isBinned, isBinning } from '../../bin'; -import { X } from '../../channel'; -import { isDiscrete, isFieldDef, toFieldDefBase, valueArray } from '../../channeldef'; -import { hasDiscreteDomain } from '../../scale'; -import { normalizeTimeUnit } from '../../timeunit'; -import { NOMINAL, ORDINAL } from '../../type'; -import { contains, normalizeAngle } from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { mergeTitle, mergeTitleFieldDefs } from '../common'; -import { guideFormat, guideFormatType } from '../format'; -import { getAxisConfig } from './config'; -export const axisRules = { - scale: ({ model, channel }) => model.scaleName(channel), - format: ({ fieldOrDatumDef, config, axis }) => { - const { format, formatType } = axis; - return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, true); - }, - formatType: ({ axis, fieldOrDatumDef, scaleType }) => { - const { formatType } = axis; - return guideFormatType(formatType, fieldOrDatumDef, scaleType); - }, - grid: ({ fieldOrDatumDef, axis, scaleType }) => { - var _a; - if (isFieldDef(fieldOrDatumDef) && isBinned(fieldOrDatumDef.bin)) { - return false; - } - else { - return (_a = axis.grid) !== null && _a !== void 0 ? _a : defaultGrid(scaleType, fieldOrDatumDef); - } - }, - gridScale: ({ model, channel }) => gridScale(model, channel), - labelAlign: ({ axis, labelAngle, orient, channel }) => axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel), - labelAngle: ({ labelAngle }) => labelAngle, - labelBaseline: ({ axis, labelAngle, orient, channel }) => axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel), - labelFlush: ({ axis, fieldOrDatumDef, channel }) => { var _a; return (_a = axis.labelFlush) !== null && _a !== void 0 ? _a : defaultLabelFlush(fieldOrDatumDef.type, channel); }, - labelOverlap: ({ axis, fieldOrDatumDef, scaleType }) => { var _a; return (_a = axis.labelOverlap) !== null && _a !== void 0 ? _a : defaultLabelOverlap(fieldOrDatumDef.type, scaleType, isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit, isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined); }, - // we already calculate orient in parse - orient: ({ orient }) => orient, - tickCount: ({ channel, model, axis, fieldOrDatumDef, scaleType }) => { - var _a; - const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; - const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined; - return (_a = axis.tickCount) !== null && _a !== void 0 ? _a : defaultTickCount({ fieldOrDatumDef, scaleType, size, values: axis.values }); - }, - title: ({ axis, model, channel }) => { - if (axis.title !== undefined) { - return axis.title; - } - const fieldDefTitle = getFieldDefTitle(model, channel); - if (fieldDefTitle !== undefined) { - return fieldDefTitle; - } - const fieldDef = model.typedFieldDef(channel); - const channel2 = channel === 'x' ? 'x2' : 'y2'; - const fieldDef2 = model.fieldDef(channel2); - // If title not specified, store base parts of fieldDef (and fieldDef2 if exists) - return mergeTitleFieldDefs(fieldDef ? [toFieldDefBase(fieldDef)] : [], isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []); - }, - values: ({ axis, fieldOrDatumDef }) => values(axis, fieldOrDatumDef), - zindex: ({ axis, fieldOrDatumDef, mark }) => { var _a; return (_a = axis.zindex) !== null && _a !== void 0 ? _a : defaultZindex(mark, fieldOrDatumDef); } -}; -// TODO: we need to refactor this method after we take care of config refactoring -/** - * Default rules for whether to show a grid should be shown for a channel. - * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned - */ -export function defaultGrid(scaleType, fieldDef) { - return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.bin); -} -export function gridScale(model, channel) { - const gridChannel = channel === 'x' ? 'y' : 'x'; - if (model.getScaleComponent(gridChannel)) { - return model.scaleName(gridChannel); - } - return undefined; -} -export function getLabelAngle(fieldOrDatumDef, axis, channel, styleConfig, axisConfigs) { - const labelAngle = axis === null || axis === void 0 ? void 0 : axis.labelAngle; - // try axis value - if (labelAngle !== undefined) { - return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle); - } - else { - // try axis config value - const { configValue: angle } = getAxisConfig('labelAngle', styleConfig, axis === null || axis === void 0 ? void 0 : axis.style, axisConfigs); - if (angle !== undefined) { - return normalizeAngle(angle); - } - else { - // get default value - if (channel === X && - contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) && - !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)) { - return 270; - } - // no default - return undefined; - } - } -} -export function normalizeAngleExpr(angle) { - return `(((${angle.signal} % 360) + 360) % 360)`; -} -export function defaultLabelBaseline(angle, orient, channel, alwaysIncludeMiddle) { - if (angle !== undefined) { - if (channel === 'x') { - if (isSignalRef(angle)) { - const a = normalizeAngleExpr(angle); - const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === "top")` : orient === 'top'; - return { - signal: `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? "middle" :` + - `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? "bottom" : "top"` - }; - } - if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) { - return 'middle'; - } - if (isSignalRef(orient)) { - const op = angle <= 45 || 315 <= angle ? '===' : '!=='; - return { signal: `${orient.signal} ${op} "top" ? "bottom" : "top"` }; - } - return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top'; - } - else { - if (isSignalRef(angle)) { - const a = normalizeAngleExpr(angle); - const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === "left")` : orient === 'left'; - const middle = alwaysIncludeMiddle ? '"middle"' : 'null'; - return { - signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? "top" : "bottom"` - }; - } - if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) { - return alwaysIncludeMiddle ? 'middle' : null; - } - if (isSignalRef(orient)) { - const op = 45 <= angle && angle <= 135 ? '===' : '!=='; - return { signal: `${orient.signal} ${op} "left" ? "top" : "bottom"` }; - } - return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom'; - } - } - return undefined; -} -export function defaultLabelAlign(angle, orient, channel) { - if (angle === undefined) { - return undefined; - } - const isX = channel === 'x'; - const startAngle = isX ? 0 : 90; - const mainOrient = isX ? 'bottom' : 'left'; - if (isSignalRef(angle)) { - const a = normalizeAngleExpr(angle); - const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === "${mainOrient}")` : orient === mainOrient; - return { - signal: `(${startAngle ? '(' + a + ' + 90)' : a} % 180 === 0) ? ${isX ? null : '"center"'} :` + - `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? "left" : "right"` - }; - } - if ((angle + startAngle) % 180 === 0) { - // For bottom, use default label align so label flush still works - return isX ? null : 'center'; - } - if (isSignalRef(orient)) { - const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!=='; - const orientIsMain = `${orient.signal} ${op} "${mainOrient}"`; - return { - signal: `${orientIsMain} ? "left" : "right"` - }; - } - if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) { - return 'left'; - } - return 'right'; -} -export function defaultLabelFlush(type, channel) { - if (channel === 'x' && contains(['quantitative', 'temporal'], type)) { - return true; - } - return undefined; -} -export function defaultLabelOverlap(type, scaleType, hasTimeUnit, sort) { - // do not prevent overlap for nominal data because there is no way to infer what the missing labels are - if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) { - if (scaleType === 'log') { - return 'greedy'; - } - return true; - } - return undefined; -} -export function defaultOrient(channel) { - return channel === 'x' ? 'bottom' : 'left'; -} -export function defaultTickCount({ fieldOrDatumDef, scaleType, size, values: vals }) { - var _a; - if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') { - if (isFieldDef(fieldOrDatumDef)) { - if (isBinning(fieldOrDatumDef.bin)) { - // for binned data, we don't want more ticks than maxbins - return { signal: `ceil(${size.signal}/10)` }; - } - if (fieldOrDatumDef.timeUnit && - contains(['month', 'hours', 'day', 'quarter'], (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit)) { - return undefined; - } - } - return { signal: `ceil(${size.signal}/40)` }; - } - return undefined; -} -export function getFieldDefTitle(model, channel) { - const channel2 = channel === 'x' ? 'x2' : 'y2'; - const fieldDef = model.fieldDef(channel); - const fieldDef2 = model.fieldDef(channel2); - const title1 = fieldDef ? fieldDef.title : undefined; - const title2 = fieldDef2 ? fieldDef2.title : undefined; - if (title1 && title2) { - return mergeTitle(title1, title2); - } - else if (title1) { - return title1; - } - else if (title2) { - return title2; - } - else if (title1 !== undefined) { - // falsy value to disable config - return title1; - } - else if (title2 !== undefined) { - // falsy value to disable config - return title2; - } - return undefined; -} -export function values(axis, fieldOrDatumDef) { - const vals = axis.values; - if (isArray(vals)) { - return valueArray(fieldOrDatumDef, vals); - } - else if (isSignalRef(vals)) { - return vals; - } - return undefined; -} -export function defaultZindex(mark, fieldDef) { - if (mark === 'rect' && isDiscrete(fieldDef)) { - return 1; - } - return 0; -} -//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/axis/properties.js.map b/node_modules/vega-lite/build/src/compile/axis/properties.js.map deleted file mode 100644 index 4df8e61..0000000 --- a/node_modules/vega-lite/build/src/compile/axis/properties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../../src/compile/axis/properties.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,E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AO,CAAC,CAAC;KACV;IACD,OAAO,CAAC,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/buildmodel.d.ts b/node_modules/vega-lite/build/src/compile/buildmodel.d.ts deleted file mode 100644 index 31062b5..0000000 --- a/node_modules/vega-lite/build/src/compile/buildmodel.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Config } from '../config'; -import { LayoutSizeMixins, NormalizedSpec } from '../spec'; -import { Model } from './model'; -export declare function buildModel(spec: NormalizedSpec, parent: Model, parentGivenName: string, unitSize: LayoutSizeMixins, config: Config): Model; -//# sourceMappingURL=buildmodel.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/buildmodel.d.ts.map b/node_modules/vega-lite/build/src/compile/buildmodel.d.ts.map deleted file mode 100644 index 45bd868..0000000 --- a/node_modules/vega-lite/build/src/compile/buildmodel.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"buildmodel.d.ts","sourceRoot":"","sources":["../../../src/compile/buildmodel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAwD,gBAAgB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AAIhH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAG9B,wBAAgB,UAAU,CACxB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,KAAK,EACb,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,GACb,KAAK,CAWP"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/buildmodel.js b/node_modules/vega-lite/build/src/compile/buildmodel.js deleted file mode 100644 index eb18905..0000000 --- a/node_modules/vega-lite/build/src/compile/buildmodel.js +++ /dev/null @@ -1,22 +0,0 @@ -import * as log from '../log'; -import { isAnyConcatSpec, isFacetSpec, isLayerSpec, isUnitSpec } from '../spec'; -import { ConcatModel } from './concat'; -import { FacetModel } from './facet'; -import { LayerModel } from './layer'; -import { UnitModel } from './unit'; -export function buildModel(spec, parent, parentGivenName, unitSize, config) { - if (isFacetSpec(spec)) { - return new FacetModel(spec, parent, parentGivenName, config); - } - else if (isLayerSpec(spec)) { - return new LayerModel(spec, parent, parentGivenName, unitSize, config); - } - else if (isUnitSpec(spec)) { - return new UnitModel(spec, parent, parentGivenName, unitSize, config); - } - else if (isAnyConcatSpec(spec)) { - return new ConcatModel(spec, parent, parentGivenName, config); - } - throw new Error(log.message.invalidSpec(spec)); -} -//# sourceMappingURL=buildmodel.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/buildmodel.js.map b/node_modules/vega-lite/build/src/compile/buildmodel.js.map deleted file mode 100644 index 5c997ff..0000000 --- a/node_modules/vega-lite/build/src/compile/buildmodel.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"buildmodel.js","sourceRoot":"","sources":["../../../src/compile/buildmodel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAmC,MAAM,SAAS,CAAC;AAChH,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEjC,MAAM,UAAU,UAAU,CACxB,IAAoB,EACpB,MAAa,EACb,eAAuB,EACvB,QAA0B,EAC1B,MAAc;IAEd,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;QACrB,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;KAC9D;SAAM,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KACxE;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;QAC3B,OAAO,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KACvE;SAAM,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;QAChC,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;KAC/D;IACD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/common.d.ts b/node_modules/vega-lite/build/src/compile/common.d.ts deleted file mode 100644 index 4e5d8bd..0000000 --- a/node_modules/vega-lite/build/src/compile/common.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { SignalRef, Text } from 'vega'; -import { AxisConfig } from '../axis'; -import { FieldDefBase, FieldRefOption, OrderFieldDef } from '../channeldef'; -import { Config, StyleConfigIndex } from '../config'; -import { MarkConfig, MarkDef } from '../mark'; -import { SortFields } from '../sort'; -import { VgEncodeChannel, VgEncodeEntry, VgValueRef } from '../vega.schema'; -import { AxisComponentProps } from './axis/component'; -import { Explicit } from './split'; -import { UnitModel } from './unit'; -export declare const BIN_RANGE_DELIMITER = " \u2013 "; -export declare function signalOrValueRef(value: T | SignalRef): { - value: T; -} | SignalRef; -export declare function exprFromValueOrSignalRef(ref: VgValueRef | SignalRef): string; -export declare function signalOrStringValue(v: SignalRef | any): string; -export declare function applyMarkConfig(e: VgEncodeEntry, model: UnitModel, propsList: (keyof MarkConfig)[]): Partial>; -export declare function getStyles(mark: MarkDef): string[]; -export declare function getMarkPropOrConfig

(channel: P, mark: MarkDef, config: Config, opt?: { - vgChannel?: VgEncodeChannel; - ignoreVgConfig?: boolean; -}): MarkDef[P]; -/** - * Return property value from style or mark specific config property if exists. - * Otherwise, return general mark specific config. - */ -export declare function getMarkConfig

(channel: P, mark: MarkDef, config: Config, { vgChannel }?: { - vgChannel?: VgEncodeChannel; -}): MarkDef[P]; -export declare function getMarkStyleConfig

(prop: P, mark: MarkDef, styleConfigIndex: StyleConfigIndex): any; -export declare function getStyleConfig

(p: P, styles: string | string[], styleConfigIndex: StyleConfigIndex): any; -/** - * Return Vega sort parameters (tuple of field and order). - */ -export declare function sortParams(orderDef: OrderFieldDef | OrderFieldDef[], fieldRefOption?: FieldRefOption): SortFields; -export declare type AxisTitleComponent = AxisComponentProps['title']; -export declare function mergeTitleFieldDefs(f1: readonly FieldDefBase[], f2: readonly FieldDefBase[]): FieldDefBase[]; -export declare function mergeTitle(title1: Text | SignalRef, title2: Text | SignalRef): string | string[] | SignalRef; -export declare function mergeTitleComponent(v1: Explicit, v2: Explicit): { - explicit: boolean; - value: string | string[] | SignalRef; -} | { - explicit: boolean; - value: FieldDefBase[]; -}; -//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/common.d.ts.map b/node_modules/vega-lite/build/src/compile/common.d.ts.map deleted file mode 100644 index 8528066..0000000 --- a/node_modules/vega-lite/build/src/compile/common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/compile/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAErC,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAU,MAAM,eAAe,CAAC;AACnF,OAAO,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,WAAW,CAAC;AACnD,OAAO,EAAC,UAAU,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAC5C,OAAO,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C,OAAO,CAAC,CAAC,CAAC,CAcZ;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,OAAO,EACxD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,OAAO,EACb,gBAAgB,EAAE,gBAAgB,OAGnC;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,OAAO,GAAG,MAAM,UAAU,EACvE,CAAC,EAAE,CAAC,EACJ,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EACzB,gBAAgB,EAAE,gBAAgB,OAYnC;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,EAAE,EACzD,cAAc,CAAC,EAAE,cAAc,GAC9B,UAAU,CASZ;AAED,oBAAY,kBAAkB,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;AAE7D,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,2EAa3G;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,IAAI,GAAG,SAAS,EAAE,MAAM,EAAE,IAAI,GAAG,SAAS,iCAU5E;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC;;;;;;EAgCrG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/common.js b/node_modules/vega-lite/build/src/compile/common.js deleted file mode 100644 index 3f3acd2..0000000 --- a/node_modules/vega-lite/build/src/compile/common.js +++ /dev/null @@ -1,153 +0,0 @@ -import { array, stringValue } from 'vega-util'; -import { vgField } from '../channeldef'; -import { isText } from '../title'; -import { deepEqual, getFirstDefined } from '../util'; -import { isSignalRef } from '../vega.schema'; -export const BIN_RANGE_DELIMITER = ' \u2013 '; -export function signalOrValueRef(value) { - if (isSignalRef(value)) { - return value; - } - return value !== undefined ? { value } : undefined; -} -export function exprFromValueOrSignalRef(ref) { - if (isSignalRef(ref)) { - return ref.signal; - } - return stringValue(ref.value); -} -export function signalOrStringValue(v) { - if (isSignalRef(v)) { - return v.signal; - } - return v == null ? null : stringValue(v); -} -export function applyMarkConfig(e, model, propsList) { - for (const property of propsList) { - const value = getMarkConfig(property, model.markDef, model.config); - if (value !== undefined) { - e[property] = signalOrValueRef(value); - } - } - return e; -} -export function getStyles(mark) { - var _a; - return [].concat(mark.type, (_a = mark.style) !== null && _a !== void 0 ? _a : []); -} -export function getMarkPropOrConfig(channel, mark, config, opt = {}) { - const { vgChannel, ignoreVgConfig } = opt; - if (vgChannel && mark[vgChannel] !== undefined) { - return mark[vgChannel]; - } - else if (mark[channel] !== undefined) { - return mark[channel]; - } - else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) { - return undefined; - } - return getMarkConfig(channel, mark, config, opt); -} -/** - * Return property value from style or mark specific config property if exists. - * Otherwise, return general mark specific config. - */ -export function getMarkConfig(channel, mark, config, { vgChannel } = {}) { - return getFirstDefined( - // style config has highest precedence - vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined, getMarkStyleConfig(channel, mark, config.style), - // then mark-specific config - vgChannel ? config[mark.type][vgChannel] : undefined, config[mark.type][channel], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine - // If there is vgChannel, skip vl channel. - // For example, vl size for text is vg fontSize, but config.mark.size is only for point size. - vgChannel ? config.mark[vgChannel] : config.mark[channel] // Need to cast for the same reason as above - ); -} -export function getMarkStyleConfig(prop, mark, styleConfigIndex) { - return getStyleConfig(prop, getStyles(mark), styleConfigIndex); -} -export function getStyleConfig(p, styles, styleConfigIndex) { - styles = array(styles); - let value; - for (const style of styles) { - const styleConfig = styleConfigIndex[style]; - if (styleConfig && styleConfig[p] !== undefined) { - value = styleConfig[p]; - } - } - return value; -} -/** - * Return Vega sort parameters (tuple of field and order). - */ -export function sortParams(orderDef, fieldRefOption) { - return array(orderDef).reduce((s, orderChannelDef) => { - var _a; - s.field.push(vgField(orderChannelDef, fieldRefOption)); - s.order.push((_a = orderChannelDef.sort) !== null && _a !== void 0 ? _a : 'ascending'); - return s; - }, { field: [], order: [] }); -} -export function mergeTitleFieldDefs(f1, f2) { - const merged = [...f1]; - f2.forEach(fdToMerge => { - for (const fieldDef1 of merged) { - // If already exists, no need to append to merged array - if (deepEqual(fieldDef1, fdToMerge)) { - return; - } - } - merged.push(fdToMerge); - }); - return merged; -} -export function mergeTitle(title1, title2) { - if (deepEqual(title1, title2) || !title2) { - // if titles are the same or title2 is falsy - return title1; - } - else if (!title1) { - // if title1 is falsy - return title2; - } - else { - return [...array(title1), ...array(title2)].join(', '); - } -} -export function mergeTitleComponent(v1, v2) { - const v1Val = v1.value; - const v2Val = v2.value; - if (v1Val == null || v2Val === null) { - return { - explicit: v1.explicit, - value: null - }; - } - else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) { - return { - explicit: v1.explicit, - value: mergeTitle(v1Val, v2Val) - }; - } - else if (isText(v1Val) || isSignalRef(v1Val)) { - return { - explicit: v1.explicit, - value: v1Val - }; - } - else if (isText(v2Val) || isSignalRef(v2Val)) { - return { - explicit: v1.explicit, - value: v2Val - }; - } - else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) { - return { - explicit: v1.explicit, - value: mergeTitleFieldDefs(v1Val, v2Val) - }; - } - /* istanbul ignore next: Condition should not happen -- only for warning in development. */ - throw new Error('It should never reach here'); -} -//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/common.js.map b/node_modules/vega-lite/build/src/compile/common.js.map deleted file mode 100644 index c99e4aa..0000000 --- a/node_modules/vega-lite/build/src/compile/common.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.js","sourceRoot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,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE;QACzF,OAAO;YACL,QAAQ,EAAE,EAAE,CAAC,QAAQ;YACrB,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC;SAChC,CAAC;KACH;SAAM,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;QAC9C,OAAO;YACL,QAAQ,EAAE,EAAE,CAAC,QAAQ;YACrB,KAAK,EAAE,KAAK;SACb,CAAC;KACH;SAAM,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;QAC9C,OAAO;YACL,QAAQ,EAAE,EAAE,CAAC,QAAQ;YACrB,KAAK,EAAE,KAAK;SACb,CAAC;KACH;SAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;QACzF,OAAO;YACL,QAAQ,EAAE,EAAE,CAAC,QAAQ;YACrB,KAAK,EAAE,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC;SACzC,CAAC;KACH;IACD,2FAA2F;IAC3F,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/compile.d.ts b/node_modules/vega-lite/build/src/compile/compile.d.ts deleted file mode 100644 index 5fbff57..0000000 --- a/node_modules/vega-lite/build/src/compile/compile.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { LoggerInterface, Spec as VgSpec } from 'vega'; -import * as vlFieldDef from '../channeldef'; -import { Config } from '../config'; -import { LayoutSizeMixins, TopLevelSpec } from '../spec'; -import { TopLevelProperties } from '../spec/toplevel'; -export interface CompileOptions { - /** - * Sets a Vega-Lite configuration. - */ - config?: Config; - /** - * Sets a custom logger. - */ - logger?: LoggerInterface; - /** - * Sets a field title formatter. - */ - fieldTitle?: vlFieldDef.FieldTitleFormatter; -} -/** - * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec. - * - * At a high-level, we make the following transformations in different phases: - * - * Input spec - * | - * | (Normalization) - * v - * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.) - * | - * | (Build Model) - * v - * A model tree of the spec - * | - * | (Parse) - * v - * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged) - * | - * | (Optimize) - * v - * A model tree with parsed components with the data component optimized - * | - * | (Assemble) - * v - * Vega spec - * - * @param inputSpec The Vega-Lite specification. - * @param opt Optional arguments passed to the Vega-Lite compiler. - * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec. - */ -export declare function compile(inputSpec: TopLevelSpec, opt?: CompileOptions): { - spec: VgSpec; - normalized: (import("../spec").NormalizedUnitSpec & TopLevelProperties & { - $schema?: string; /** - * Sets a Vega-Lite configuration. - */ - config?: Config; - datasets?: Record; - usermeta?: Record; - } & LayoutSizeMixins) | (import("../spec").NormalizedLayerSpec & TopLevelProperties & { - $schema?: string; /** - * Sets a Vega-Lite configuration. - */ - config?: Config; - datasets?: Record; - usermeta?: Record; - } & LayoutSizeMixins) | (import("../spec").GenericFacetSpec & TopLevelProperties & { - $schema?: string; /** - * Sets a Vega-Lite configuration. - */ - config?: Config; - datasets?: Record; - usermeta?: Record; - } & LayoutSizeMixins) | (import("../spec/concat").GenericConcatSpec> & TopLevelProperties & { - $schema?: string; /** - * Sets a Vega-Lite configuration. - */ - config?: Config; - datasets?: Record; - usermeta?: Record; - } & LayoutSizeMixins) | (import("../spec").GenericVConcatSpec> & TopLevelProperties & { - $schema?: string; /** - * Sets a Vega-Lite configuration. - */ - config?: Config; - datasets?: Record; - usermeta?: Record; - } & LayoutSizeMixins) | (import("../spec").GenericHConcatSpec> & TopLevelProperties & { - $schema?: string; /** - * Sets a Vega-Lite configuration. - */ - config?: Config; - datasets?: Record; - usermeta?: Record; - } & LayoutSizeMixins); -}; -//# sourceMappingURL=compile.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/compile.d.ts.map b/node_modules/vega-lite/build/src/compile/compile.d.ts.map deleted file mode 100644 index 7a58638..0000000 --- a/node_modules/vega-lite/build/src/compile/compile.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compile/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,eAAe,EAAE,IAAI,IAAI,MAAM,EAAC,MAAM,MAAM,CAAC;AAGnE,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,MAAM,EAAqC,MAAM,WAAW,CAAC;AAGrE,OAAO,EAAC,gBAAgB,EAAY,YAAY,EAAC,MAAM,SAAS,CAAC;AACjE,OAAO,EAML,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAO1B,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,mBAAmB,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,GAAE,cAAmB;;;0BA/CvE;;WAEG;;;;;0BAFH;;WAEG;;;;;0BAFH;;WAEG;;;;;0BAFH;;WAEG;;;;;0BAFH;;WAEG;;;;;0BAFH;;WAEG;;;;;EAoHJ"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/compile.js b/node_modules/vega-lite/build/src/compile/compile.js deleted file mode 100644 index 32096ab..0000000 --- a/node_modules/vega-lite/build/src/compile/compile.js +++ /dev/null @@ -1,158 +0,0 @@ -import { isString, mergeConfig } from 'vega-util'; -import { getPositionScaleChannel } from '../channel'; -import * as vlFieldDef from '../channeldef'; -import { initConfig, stripAndRedirectConfig } from '../config'; -import * as log from '../log'; -import { normalize } from '../normalize'; -import { extractTopLevelProperties, getFitType, isFitType } from '../spec/toplevel'; -import { keys } from '../util'; -import { buildModel } from './buildmodel'; -import { assembleRootData } from './data/assemble'; -import { optimizeDataflow } from './data/optimize'; -/** - * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec. - * - * At a high-level, we make the following transformations in different phases: - * - * Input spec - * | - * | (Normalization) - * v - * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.) - * | - * | (Build Model) - * v - * A model tree of the spec - * | - * | (Parse) - * v - * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged) - * | - * | (Optimize) - * v - * A model tree with parsed components with the data component optimized - * | - * | (Assemble) - * v - * Vega spec - * - * @param inputSpec The Vega-Lite specification. - * @param opt Optional arguments passed to the Vega-Lite compiler. - * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec. - */ -export function compile(inputSpec, opt = {}) { - // 0. Augment opt with default opts - if (opt.logger) { - // set the singleton logger to the provided logger - log.set(opt.logger); - } - if (opt.fieldTitle) { - // set the singleton field title formatter - vlFieldDef.setTitleFormatter(opt.fieldTitle); - } - try { - // 1. Initialize config by deep merging default config with the config provided via option and the input spec. - const config = initConfig(mergeConfig(opt.config, inputSpec.config)); - // 2. Normalize: Convert input spec -> normalized spec - // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec. - // - Normalize autosize and width or height spec - const spec = normalize(inputSpec, config); - // 3. Build Model: normalized spec -> Model (a tree structure) - // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors. - // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models. - const model = buildModel(spec, null, '', undefined, config); - // 4 Parse: Model --> Model with components - // Note that components = intermediate representations that are equivalent to Vega specs. - // We need these intermediate representation because we need to merge many visualization "components" like projections, scales, axes, and legends. - // We will later convert these components into actual Vega specs in the assemble phase. - // In this phase, we do a bottom-up traversal over the whole tree to - // parse for each type of components once (e.g., data, layout, mark, scale). - // By doing bottom-up traversal, we start parsing components of unit specs and - // then merge child components of parent composite specs. - // - // Please see inside model.parse() for order of different components parsed. - model.parse(); - // drawDataflow(model.component.data.sources); - // 5. Optimize the dataflow. This will modify the data component of the model. - optimizeDataflow(model.component.data, model); - // drawDataflow(model.component.data.sources); - // 6. Assemble: convert model components --> Vega Spec. - const vgSpec = assembleTopLevelModel(model, getTopLevelProperties(inputSpec, spec.autosize, config, model), inputSpec.datasets, inputSpec.usermeta); - return { - spec: vgSpec, - normalized: spec - }; - } - finally { - // Reset the singleton logger if a logger is provided - if (opt.logger) { - log.reset(); - } - // Reset the singleton field title formatter if provided - if (opt.fieldTitle) { - vlFieldDef.resetTitleFormatter(); - } - } -} -function getTopLevelProperties(inputSpec, autosize, config, model) { - const width = model.component.layoutSize.get('width'); - const height = model.component.layoutSize.get('height'); - if (autosize === undefined) { - autosize = { type: 'pad' }; - if (model.hasAxisOrientSignalRef()) { - autosize.resize = true; - } - } - else if (isString(autosize)) { - autosize = { type: autosize }; - } - if (width && height && isFitType(autosize.type)) { - if (width === 'step' && height === 'step') { - log.warn(log.message.droppingFit()); - autosize.type = 'pad'; - } - else if (width === 'step' || height === 'step') { - // effectively XOR, because else if - // get step dimension - const sizeType = width === 'step' ? 'width' : 'height'; - // log that we're dropping fit for respective channel - log.warn(log.message.droppingFit(getPositionScaleChannel(sizeType))); - // setting type to inverse fit (so if we dropped fit-x, type is now fit-y) - const inverseSizeType = sizeType === 'width' ? 'height' : 'width'; - autosize.type = getFitType(inverseSizeType); - } - } - return Object.assign(Object.assign(Object.assign({}, (keys(autosize).length === 1 && autosize.type - ? autosize.type === 'pad' - ? {} - : { autosize: autosize.type } - : { autosize })), extractTopLevelProperties(config)), extractTopLevelProperties(inputSpec)); -} -/* - * Assemble the top-level model to a Vega spec. - * - * Note: this couldn't be `model.assemble()` since the top-level model - * needs some special treatment to generate top-level properties. - */ -function assembleTopLevelModel(model, topLevelProperties, datasets = {}, usermeta) { - // Config with Vega-Lite only config removed. - const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined; - const data = [].concat(model.assembleSelectionData([]), - // only assemble data in the root - assembleRootData(model.component.data, datasets)); - const projections = model.assembleProjections(); - const title = model.assembleTitle(); - const style = model.assembleGroupStyle(); - const encodeEntry = model.assembleGroupEncodeEntry(true); - let layoutSignals = model.assembleLayoutSignals(); - // move width and height signals with values to top level - layoutSignals = layoutSignals.filter(signal => { - if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) { - topLevelProperties[signal.name] = +signal.value; - return false; - } - return true; - }); - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ $schema: 'https://vega.github.io/schema/vega/v5.json' }, (model.description ? { description: model.description } : {})), topLevelProperties), (title ? { title } : {})), (style ? { style } : {})), (encodeEntry ? { encode: { update: encodeEntry } } : {})), { data }), (projections.length > 0 ? { projections: projections } : {})), model.assembleGroup([...layoutSignals, ...model.assembleSelectionTopLevelSignals([])])), (vgConfig ? { config: vgConfig } : {})), (usermeta ? { usermeta } : {})); -} -//# sourceMappingURL=compile.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/compile.js.map b/node_modules/vega-lite/build/src/compile/compile.js.map deleted file mode 100644 index 2b1b43d..0000000 --- a/node_modules/vega-lite/build/src/compile/compile.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/compile/compile.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAC;AACnD,OA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AAC,GAC3D,kBAAkB,GAClB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACtB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACtB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,EAAC,MAAM,EAAE,WAAW,EAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KACvD,IAAI,KACD,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAC,WAAW,EAAE,WAAW,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAC1D,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,aAAa,EAAE,GAAG,KAAK,CAAC,gCAAgC,CAAC,EAAE,CAAC,CAAC,CAAC,GACtF,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACpC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/B;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/concat.d.ts b/node_modules/vega-lite/build/src/compile/concat.d.ts deleted file mode 100644 index 1377780..0000000 --- a/node_modules/vega-lite/build/src/compile/concat.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { NewSignal } from 'vega'; -import { Config } from '../config'; -import { NormalizedConcatSpec } from '../spec'; -import { VgLayout } from '../vega.schema'; -import { VgData } from '../vega.schema'; -import { Model } from './model'; -export declare class ConcatModel extends Model { - readonly children: Model[]; - constructor(spec: NormalizedConcatSpec, parent: Model, parentGivenName: string, config: Config); - parseData(): void; - parseSelections(): void; - parseMarkGroup(): void; - parseAxesAndHeaders(): void; - private getChildren; - parseLayoutSize(): void; - parseAxisGroup(): void; - assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[]; - assembleSignals(): NewSignal[]; - assembleLayoutSignals(): NewSignal[]; - assembleSelectionData(data: readonly VgData[]): readonly VgData[]; - assembleMarks(): any[]; - protected assembleDefaultLayout(): VgLayout; -} -//# sourceMappingURL=concat.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/concat.d.ts.map b/node_modules/vega-lite/build/src/compile/concat.d.ts.map deleted file mode 100644 index 82e5c8f..0000000 --- a/node_modules/vega-lite/build/src/compile/concat.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../src/compile/concat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,EAA+B,oBAAoB,EAAiB,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAKtC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,qBAAa,WAAY,SAAQ,KAAK;IACpC,SAAgB,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAEtB,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAYvF,SAAS;IAOT,eAAe;IAaf,cAAc;IAMd,mBAAmB;IAQ1B,OAAO,CAAC,WAAW;IASZ,eAAe;IAIf,cAAc,IAAI,IAAI;IAItB,gCAAgC,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE;IAInE,eAAe,IAAI,SAAS,EAAE;IAK9B,qBAAqB,IAAI,SAAS,EAAE;IAUpC,qBAAqB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAIjE,aAAa,IAAI,GAAG,EAAE;IAkB7B,SAAS,CAAC,qBAAqB,IAAI,QAAQ;CAS5C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/concat.js b/node_modules/vega-lite/build/src/compile/concat.js deleted file mode 100644 index 1ed5e18..0000000 --- a/node_modules/vega-lite/build/src/compile/concat.js +++ /dev/null @@ -1,97 +0,0 @@ -import * as log from '../log'; -import { isHConcatSpec, isVConcatSpec } from '../spec'; -import { keys } from '../util'; -import { buildModel } from './buildmodel'; -import { parseData } from './data/parse'; -import { assembleLayoutSignals } from './layoutsize/assemble'; -import { parseConcatLayoutSize } from './layoutsize/parse'; -import { Model } from './model'; -export class ConcatModel extends Model { - constructor(spec, parent, parentGivenName, config) { - var _a, _b, _c, _d; - super(spec, 'concat', parent, parentGivenName, config, spec.resolve); - if (((_b = (_a = spec.resolve) === null || _a === void 0 ? void 0 : _a.axis) === null || _b === void 0 ? void 0 : _b.x) === 'shared' || ((_d = (_c = spec.resolve) === null || _c === void 0 ? void 0 : _c.axis) === null || _d === void 0 ? void 0 : _d.y) === 'shared') { - log.warn(log.message.CONCAT_CANNOT_SHARE_AXIS); - } - this.children = this.getChildren(spec).map((child, i) => { - return buildModel(child, this, this.getName('concat_' + i), undefined, config); - }); - } - parseData() { - this.component.data = parseData(this); - for (const child of this.children) { - child.parseData(); - } - } - parseSelections() { - // Merge selections up the hierarchy so that they may be referenced - // across unit specs. Persist their definitions within each child - // to assemble signals which remain within output Vega unit groups. - this.component.selection = {}; - for (const child of this.children) { - child.parseSelections(); - for (const key of keys(child.component.selection)) { - this.component.selection[key] = child.component.selection[key]; - } - } - } - parseMarkGroup() { - for (const child of this.children) { - child.parseMarkGroup(); - } - } - parseAxesAndHeaders() { - for (const child of this.children) { - child.parseAxesAndHeaders(); - } - // TODO(#2415): support shared axes - } - getChildren(spec) { - if (isVConcatSpec(spec)) { - return spec.vconcat; - } - else if (isHConcatSpec(spec)) { - return spec.hconcat; - } - return spec.concat; - } - parseLayoutSize() { - parseConcatLayoutSize(this); - } - parseAxisGroup() { - return null; - } - assembleSelectionTopLevelSignals(signals) { - return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); - } - assembleSignals() { - this.children.forEach(child => child.assembleSignals()); - return []; - } - assembleLayoutSignals() { - const layoutSignals = assembleLayoutSignals(this); - for (const child of this.children) { - layoutSignals.push(...child.assembleLayoutSignals()); - } - return layoutSignals; - } - assembleSelectionData(data) { - return this.children.reduce((db, child) => child.assembleSelectionData(db), data); - } - assembleMarks() { - // only children have marks - return this.children.map(child => { - const title = child.assembleTitle(); - const style = child.assembleGroupStyle(); - const encodeEntry = child.assembleGroupEncodeEntry(false); - return Object.assign(Object.assign(Object.assign(Object.assign({ type: 'group', name: child.getName('group') }, (title ? { title } : {})), (style ? { style } : {})), (encodeEntry ? { encode: { update: encodeEntry } } : {})), child.assembleGroup()); - }); - } - assembleDefaultLayout() { - const columns = this.layout.columns; - return Object.assign(Object.assign({}, (columns != null ? { columns: columns } : {})), { bounds: 'full', - // Use align each so it can work with multiple plots with different size - align: 'each' }); - } -} -//# sourceMappingURL=concat.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/concat.js.map b/node_modules/vega-lite/build/src/compile/concat.js.map deleted file mode 100644 index 77e23c4..0000000 --- a/node_modules/vega-lite/build/src/compile/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/compile/concat.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAE,aAAa,EAAuC,MAAM,SAAS,CAAC;AAE3F,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,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C,EAAC,OAAO,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAC9C,MAAM,EAAE,MAAM;YACd,wEAAwE;YACxE,KAAK,EAAE,MAAM,IACb;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/aggregate.d.ts b/node_modules/vega-lite/build/src/compile/data/aggregate.d.ts deleted file mode 100644 index 5fb7dfa..0000000 --- a/node_modules/vega-lite/build/src/compile/data/aggregate.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { AggregateOp, AggregateTransform as VgAggregateTransform } from 'vega'; -import { AggregateTransform } from '../../transform'; -import { Dict } from '../../util'; -import { UnitModel } from '../unit'; -import { DataFlowNode } from './dataflow'; -declare type Measures = Dict>>>; -export declare class AggregateNode extends DataFlowNode { - private dimensions; - private measures; - clone(): AggregateNode; - /** - * @param dimensions string set for dimensions - * @param measures dictionary mapping field name => dict of aggregation functions and names to use - */ - constructor(parent: DataFlowNode, dimensions: Set, measures: Measures); - get groupBy(): Set; - static makeFromEncoding(parent: DataFlowNode, model: UnitModel): AggregateNode; - static makeFromTransform(parent: DataFlowNode, t: AggregateTransform): AggregateNode; - merge(other: AggregateNode): boolean; - addDimensions(fields: readonly string[]): void; - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgAggregateTransform; -} -export {}; -//# sourceMappingURL=aggregate.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/aggregate.d.ts.map b/node_modules/vega-lite/build/src/compile/data/aggregate.d.ts.map deleted file mode 100644 index 5581e5e..0000000 --- a/node_modules/vega-lite/build/src/compile/data/aggregate.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,kBAAkB,IAAI,oBAAoB,EAAC,MAAM,MAAM,CAAC;AAW7E,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAC,IAAI,EAAsD,MAAM,YAAY,CAAC;AAErF,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,aAAK,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAwChE,qBAAa,aAAc,SAAQ,YAAY;IASX,OAAO,CAAC,UAAU;IAAe,OAAO,CAAC,QAAQ;IAR5E,KAAK;IAIZ;;;OAGG;gBACS,MAAM,EAAE,YAAY,EAAU,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EAAU,QAAQ,EAAE,QAAQ;IAI7F,IAAI,OAAO,gBAEV;WAEa,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,aAAa;WAoDvE,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,kBAAkB,GAAG,aAAa;IA4BpF,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAUpC,aAAa,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE;IAIvC,eAAe;IAIf,cAAc;IAiBd,IAAI;IAIJ,QAAQ,IAAI,oBAAoB;CAyBxC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/aggregate.js b/node_modules/vega-lite/build/src/compile/data/aggregate.js deleted file mode 100644 index ac3091a..0000000 --- a/node_modules/vega-lite/build/src/compile/data/aggregate.js +++ /dev/null @@ -1,191 +0,0 @@ -import { isArgmaxDef, isArgminDef } from '../../aggregate'; -import { getPositionChannelFromLatLong, getSecondaryRangeChannel, isGeoPositionChannel, isScaleChannel } from '../../channel'; -import { binRequiresRange, hasBand, isTypedFieldDef, vgField } from '../../channeldef'; -import * as log from '../../log'; -import { duplicate, hash, keys, replacePathInField, setEqual } from '../../util'; -import { isUnitModel } from '../model'; -import { DataFlowNode } from './dataflow'; -function addDimension(dims, channel, fieldDef, model) { - const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; - if (isTypedFieldDef(fieldDef) && - isUnitModel(model) && - hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config)) { - dims.add(vgField(fieldDef, {})); - dims.add(vgField(fieldDef, { suffix: 'end' })); - if (fieldDef.bin && binRequiresRange(fieldDef, channel)) { - dims.add(vgField(fieldDef, { binSuffix: 'range' })); - } - } - else if (isGeoPositionChannel(channel)) { - const posChannel = getPositionChannelFromLatLong(channel); - dims.add(model.getName(posChannel)); - } - else { - dims.add(vgField(fieldDef)); - } - return dims; -} -function mergeMeasures(parentMeasures, childMeasures) { - var _a; - for (const field of keys(childMeasures)) { - // when we merge a measure, we either have to add an aggregation operator or even a new field - const ops = childMeasures[field]; - for (const op of keys(ops)) { - if (field in parentMeasures) { - // add operator to existing measure field - parentMeasures[field][op] = new Set([...((_a = parentMeasures[field][op]) !== null && _a !== void 0 ? _a : []), ...ops[op]]); - } - else { - parentMeasures[field] = { [op]: ops[op] }; - } - } - } -} -export class AggregateNode extends DataFlowNode { - /** - * @param dimensions string set for dimensions - * @param measures dictionary mapping field name => dict of aggregation functions and names to use - */ - constructor(parent, dimensions, measures) { - super(parent); - this.dimensions = dimensions; - this.measures = measures; - } - clone() { - return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures)); - } - get groupBy() { - return this.dimensions; - } - static makeFromEncoding(parent, model) { - let isAggregate = false; - model.forEachFieldDef(fd => { - if (fd.aggregate) { - isAggregate = true; - } - }); - const meas = {}; - const dims = new Set(); - if (!isAggregate) { - // no need to create this node if the model has no aggregation - return null; - } - model.forEachFieldDef((fieldDef, channel) => { - var _a, _b, _c, _d; - const { aggregate, field } = fieldDef; - if (aggregate) { - if (aggregate === 'count') { - meas['*'] = (_a = meas['*']) !== null && _a !== void 0 ? _a : {}; - meas['*']['count'] = new Set([vgField(fieldDef, { forAs: true })]); - } - else { - if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { - const op = isArgminDef(aggregate) ? 'argmin' : 'argmax'; - const argField = aggregate[op]; - meas[argField] = (_b = meas[argField]) !== null && _b !== void 0 ? _b : {}; - meas[argField][op] = new Set([vgField({ op, field: argField }, { forAs: true })]); - } - else { - meas[field] = (_c = meas[field]) !== null && _c !== void 0 ? _c : {}; - meas[field][aggregate] = new Set([vgField(fieldDef, { forAs: true })]); - } - // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain - if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') { - meas[field] = (_d = meas[field]) !== null && _d !== void 0 ? _d : {}; - meas[field]['min'] = new Set([vgField({ field, aggregate: 'min' }, { forAs: true })]); - meas[field]['max'] = new Set([vgField({ field, aggregate: 'max' }, { forAs: true })]); - } - } - } - else { - addDimension(dims, channel, fieldDef, model); - } - }); - if (dims.size + keys(meas).length === 0) { - return null; - } - return new AggregateNode(parent, dims, meas); - } - static makeFromTransform(parent, t) { - var _a, _b, _c; - const dims = new Set(); - const meas = {}; - for (const s of t.aggregate) { - const { op, field, as } = s; - if (op) { - if (op === 'count') { - meas['*'] = (_a = meas['*']) !== null && _a !== void 0 ? _a : {}; - meas['*']['count'] = new Set([as ? as : vgField(s, { forAs: true })]); - } - else { - meas[field] = (_b = meas[field]) !== null && _b !== void 0 ? _b : {}; - meas[field][op] = new Set([as ? as : vgField(s, { forAs: true })]); - } - } - } - for (const s of (_c = t.groupby) !== null && _c !== void 0 ? _c : []) { - dims.add(s); - } - if (dims.size + keys(meas).length === 0) { - return null; - } - return new AggregateNode(parent, dims, meas); - } - merge(other) { - if (setEqual(this.dimensions, other.dimensions)) { - mergeMeasures(this.measures, other.measures); - return true; - } - else { - log.debug('different dimensions, cannot merge'); - return false; - } - } - addDimensions(fields) { - fields.forEach(this.dimensions.add, this.dimensions); - } - dependentFields() { - return new Set([...this.dimensions, ...keys(this.measures)]); - } - producedFields() { - const out = new Set(); - for (const field of keys(this.measures)) { - for (const op of keys(this.measures[field])) { - const m = this.measures[field][op]; - if (m.size === 0) { - out.add(`${op}_${field}`); - } - else { - m.forEach(out.add, out); - } - } - } - return out; - } - hash() { - return `Aggregate ${hash({ dimensions: this.dimensions, measures: this.measures })}`; - } - assemble() { - const ops = []; - const fields = []; - const as = []; - for (const field of keys(this.measures)) { - for (const op of keys(this.measures[field])) { - for (const alias of this.measures[field][op]) { - as.push(alias); - ops.push(op); - fields.push(field === '*' ? null : replacePathInField(field)); - } - } - } - const result = { - type: 'aggregate', - groupby: [...this.dimensions].map(replacePathInField), - ops, - fields, - as - }; - return result; - } -} -//# sourceMappingURL=aggregate.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/aggregate.js.map b/node_modules/vega-lite/build/src/compile/data/aggregate.js.map deleted file mode 100644 index 70237fd..0000000 --- a/node_modules/vega-lite/build/src/compile/data/aggregate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../../../src/compile/data/aggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAEL,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,gBAAgB,EAAY,OAAO,EAAE,eAAe,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAC/F,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAO,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AACrF,OAAO,EAAC,WAAW,EAAiB,MAAM,UAAU,CAAC;AAErD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAIxC,SAAS,YAAY,CAAC,IAAiB,EAAE,OAAgB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,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACvC,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC3C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE;oBAC5C,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBACf,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBACb,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;iBAC/D;aACF;SACF;QAED,MAAM,MAAM,GAAyB;YACnC,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC;YACrD,GAAG;YACH,MAAM;YACN,EAAE;SACH,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/assemble.d.ts b/node_modules/vega-lite/build/src/compile/data/assemble.d.ts deleted file mode 100644 index ddb5955..0000000 --- a/node_modules/vega-lite/build/src/compile/data/assemble.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { InlineDataset } from '../../data'; -import { Dict } from '../../util'; -import { VgData } from '../../vega.schema'; -import { DataComponent } from './'; -import { FacetNode } from './facet'; -/** - * Assemble data sources that are derived from faceted data. - */ -export declare function assembleFacetData(root: FacetNode): VgData[]; -/** - * Create Vega data array from a given compiled model and append all of them to the given array - * - * @param model - * @param data array - * @return modified data array - */ -export declare function assembleRootData(dataComponent: DataComponent, datasets: Dict): VgData[]; -//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/assemble.d.ts.map b/node_modules/vega-lite/build/src/compile/data/assemble.d.ts.map deleted file mode 100644 index 33c9884..0000000 --- a/node_modules/vega-lite/build/src/compile/data/assemble.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAY,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,IAAI,CAAC;AAMjC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAwLlC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,CAa3D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAqDtG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/assemble.js b/node_modules/vega-lite/build/src/compile/data/assemble.js deleted file mode 100644 index c990e09..0000000 --- a/node_modules/vega-lite/build/src/compile/data/assemble.js +++ /dev/null @@ -1,238 +0,0 @@ -import { isUrlData } from '../../data'; -import { AggregateNode } from './aggregate'; -import { BinNode } from './bin'; -import { CalculateNode } from './calculate'; -import { OutputNode } from './dataflow'; -import { DensityTransformNode } from './density'; -import { FacetNode } from './facet'; -import { FilterNode } from './filter'; -import { FilterInvalidNode } from './filterinvalid'; -import { FlattenTransformNode } from './flatten'; -import { FoldTransformNode } from './fold'; -import { ParseNode } from './formatparse'; -import { GeoJSONNode } from './geojson'; -import { GeoPointNode } from './geopoint'; -import { GraticuleNode } from './graticule'; -import { IdentifierNode } from './identifier'; -import { ImputeNode } from './impute'; -import { JoinAggregateTransformNode } from './joinaggregate'; -import { LoessTransformNode } from './loess'; -import { LookupNode } from './lookup'; -import { QuantileTransformNode } from './quantile'; -import { RegressionTransformNode } from './regression'; -import { PivotTransformNode } from './pivot'; -import { SampleTransformNode } from './sample'; -import { SequenceNode } from './sequence'; -import { SourceNode } from './source'; -import { StackNode } from './stack'; -import { TimeUnitNode } from './timeunit'; -import { WindowTransformNode } from './window'; -function makeWalkTree(data) { - // to name datasources - let datasetIndex = 0; - /** - * Recursively walk down the tree. - */ - function walkTree(node, dataSource) { - var _a; - if (node instanceof SourceNode) { - // If the source is a named data source or a data source with values, we need - // to put it in a different data source. Otherwise, Vega may override the data. - if (!node.isGenerator && !isUrlData(node.data)) { - data.push(dataSource); - const newData = { - name: null, - source: dataSource.name, - transform: [] - }; - dataSource = newData; - } - } - if (node instanceof ParseNode) { - if (node.parent instanceof SourceNode && !dataSource.source) { - // If node's parent is a root source and the data source does not refer to another data source, use normal format parse - dataSource.format = Object.assign(Object.assign({}, ((_a = dataSource.format) !== null && _a !== void 0 ? _a : {})), { parse: node.assembleFormatParse() }); - // add calculates for all nested fields - dataSource.transform.push(...node.assembleTransforms(true)); - } - else { - // Otherwise use Vega expression to parse - dataSource.transform.push(...node.assembleTransforms()); - } - } - if (node instanceof FacetNode) { - if (!dataSource.name) { - dataSource.name = `data_${datasetIndex++}`; - } - if (!dataSource.source || dataSource.transform.length > 0) { - data.push(dataSource); - node.data = dataSource.name; - } - else { - node.data = dataSource.source; - } - for (const d of node.assemble()) { - data.push(d); - } - // break here because the rest of the tree has to be taken care of by the facet. - return; - } - if (node instanceof GraticuleNode || - node instanceof SequenceNode || - node instanceof FilterInvalidNode || - node instanceof FilterNode || - node instanceof CalculateNode || - node instanceof GeoPointNode || - node instanceof GeoJSONNode || - node instanceof AggregateNode || - node instanceof LookupNode || - node instanceof WindowTransformNode || - node instanceof JoinAggregateTransformNode || - node instanceof FoldTransformNode || - node instanceof FlattenTransformNode || - node instanceof DensityTransformNode || - node instanceof LoessTransformNode || - node instanceof QuantileTransformNode || - node instanceof RegressionTransformNode || - node instanceof IdentifierNode || - node instanceof SampleTransformNode || - node instanceof PivotTransformNode) { - dataSource.transform.push(node.assemble()); - } - if (node instanceof BinNode || - node instanceof TimeUnitNode || - node instanceof ImputeNode || - node instanceof StackNode) { - dataSource.transform.push(...node.assemble()); - } - if (node instanceof OutputNode) { - if (dataSource.source && dataSource.transform.length === 0) { - node.setSource(dataSource.source); - } - else if (node.parent instanceof OutputNode) { - // Note that an output node may be required but we still do not assemble a - // separate data source for it. - node.setSource(dataSource.name); - } - else { - if (!dataSource.name) { - dataSource.name = `data_${datasetIndex++}`; - } - // Here we set the name of the datasource we generated. From now on - // other assemblers can use it. - node.setSource(dataSource.name); - // if this node has more than one child, we will add a datasource automatically - if (node.numChildren() === 1) { - data.push(dataSource); - const newData = { - name: null, - source: dataSource.name, - transform: [] - }; - dataSource = newData; - } - } - } - switch (node.numChildren()) { - case 0: - // done - if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) { - // do not push empty datasources that are simply references - data.push(dataSource); - } - break; - case 1: - walkTree(node.children[0], dataSource); - break; - default: { - if (!dataSource.name) { - dataSource.name = `data_${datasetIndex++}`; - } - let source = dataSource.name; - if (!dataSource.source || dataSource.transform.length > 0) { - data.push(dataSource); - } - else { - source = dataSource.source; - } - for (const child of node.children) { - const newData = { - name: null, - source: source, - transform: [] - }; - walkTree(child, newData); - } - break; - } - } - } - return walkTree; -} -/** - * Assemble data sources that are derived from faceted data. - */ -export function assembleFacetData(root) { - const data = []; - const walkTree = makeWalkTree(data); - for (const child of root.children) { - walkTree(child, { - source: root.name, - name: null, - transform: [] - }); - } - return data; -} -/** - * Create Vega data array from a given compiled model and append all of them to the given array - * - * @param model - * @param data array - * @return modified data array - */ -export function assembleRootData(dataComponent, datasets) { - var _a, _b; - const data = []; - // dataComponent.sources.forEach(debug); - // draw(dataComponent.sources); - const walkTree = makeWalkTree(data); - let sourceIndex = 0; - for (const root of dataComponent.sources) { - // assign a name if the source does not have a name yet - if (!root.hasName()) { - root.dataName = `source_${sourceIndex++}`; - } - const newData = root.assemble(); - walkTree(root, newData); - } - // remove empty transform arrays for cleaner output - for (const d of data) { - if (d.transform.length === 0) { - delete d.transform; - } - } - // move sources without transforms (the ones that are potentially used in lookups) to the beginning - let whereTo = 0; - for (const [i, d] of data.entries()) { - if (((_a = d.transform) !== null && _a !== void 0 ? _a : []).length === 0 && !d.source) { - data.splice(whereTo++, 0, data.splice(i, 1)[0]); - } - } - // now fix the from references in lookup transforms - for (const d of data) { - for (const t of (_b = d.transform) !== null && _b !== void 0 ? _b : []) { - if (t.type === 'lookup') { - t.from = dataComponent.outputNodes[t.from].getSource(); - } - } - } - // inline values for datasets that are in the datastore - for (const d of data) { - if (d.name in datasets) { - d.values = datasets[d.name]; - } - } - return data; -} -//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/assemble.js.map b/node_modules/vega-lite/build/src/compile/data/assemble.js.map deleted file mode 100644 index c7f6484..0000000 --- a/node_modules/vega-lite/build/src/compile/data/assemble.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/data/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAC,MAAM,YAAY,CAAC;AAIpD,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAe,UAAU,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,oBA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AAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACzB;IAED,mDAAmD;IACnD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;QACpB,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,OAAO,CAAC,CAAC,SAAS,CAAC;SACpB;KACF;IAED,mGAAmG;IACnG,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;QACnC,IAAI,OAAC,CAAC,CAAC,SAAS,mCAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE;YACjD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACjD;KACF;IAED,mDAAmD;IACnD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;QACpB,KAAK,MAAM,CAAC,UAAI,CAAC,CAAC,SAAS,mCAAI,EAAE,EAAE;YACjC,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACvB,CAAC,CAAC,IAAI,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;aACxD;SACF;KACF;IAED,uDAAuD;IACvD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;QACpB,IAAI,CAAC,CAAC,IAAI,IAAI,QAAQ,EAAE;YACtB,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SAC7B;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/bin.d.ts b/node_modules/vega-lite/build/src/compile/data/bin.d.ts deleted file mode 100644 index cc030ad..0000000 --- a/node_modules/vega-lite/build/src/compile/data/bin.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Transforms as VgTransform } from 'vega'; -import { BinParams } from '../../bin'; -import { FieldName } from '../../channeldef'; -import { BinTransform } from '../../transform'; -import { Dict } from '../../util'; -import { Model, ModelWithField } from '../model'; -import { DataFlowNode } from './dataflow'; -export declare function getBinSignalName(model: Model, field: string, bin: boolean | BinParams): string; -export interface BinComponent { - bin: BinParams; - field: FieldName; - extentSignal?: string; - signal?: string; - span?: string; - /** Pairs of strings of the names of start and end signals */ - as: [string, string][]; - formula?: string; - formulaAs?: string; -} -export declare class BinNode extends DataFlowNode { - private bins; - clone(): BinNode; - constructor(parent: DataFlowNode, bins: Dict); - static makeFromEncoding(parent: DataFlowNode, model: ModelWithField): BinNode; - /** - * Creates a bin node from BinTransform. - * The optional parameter should provide - */ - static makeFromTransform(parent: DataFlowNode, t: BinTransform, model: Model): BinNode; - /** - * Merge bin nodes. This method either integrates the bin config from the other node - * or if this node already has a bin config, renames the corresponding signal in the model. - */ - merge(other: BinNode, renameSignal: (s1: string, s2: string) => void): void; - producedFields(): Set; - dependentFields(): Set; - hash(): string; - assemble(): VgTransform[]; -} -//# sourceMappingURL=bin.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/bin.d.ts.map b/node_modules/vega-lite/build/src/compile/data/bin.d.ts.map deleted file mode 100644 index 786cc59..0000000 --- a/node_modules/vega-lite/build/src/compile/data/bin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,UAAU,IAAI,WAAW,EAAC,MAAM,MAAM,CAAC;AAE/E,OAAO,EAAC,SAAS,EAA4C,MAAM,WAAW,CAAC;AAE/E,OAAO,EAAmB,SAAS,EAAwD,MAAM,kBAAkB,CAAC;AAEpH,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,IAAI,EAA4E,MAAM,YAAY,CAAC;AAE3G,OAAO,EAAc,KAAK,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAG5D,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAgCxC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,SAAS,UAIrF;AAuCD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6DAA6D;IAC7D,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAIvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,OAAQ,SAAQ,YAAY;IAKL,OAAO,CAAC,IAAI;IAJvC,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC;WAIpD,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc;IAoB1E;;;OAGG;WACW,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK;IAOnF;;;OAGG;IACI,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI;IAkBpE,cAAc;IAQd,eAAe;IAIf,IAAI;IAIJ,QAAQ,IAAI,WAAW,EAAE;CA+CjC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/bin.js b/node_modules/vega-lite/build/src/compile/data/bin.js deleted file mode 100644 index bfaea1c..0000000 --- a/node_modules/vega-lite/build/src/compile/data/bin.js +++ /dev/null @@ -1,162 +0,0 @@ -import { __rest } from "tslib"; -import { isString } from 'vega-util'; -import { binToString, isBinning, isSelectionExtent } from '../../bin'; -import { binRequiresRange, isTypedFieldDef, normalizeBin, vgField } from '../../channeldef'; -import { duplicate, hash, isEmpty, keys, replacePathInField, unique, vals, varName } from '../../util'; -import { binFormatExpression } from '../format'; -import { isUnitModel } from '../model'; -import { parseSelectionBinExtent } from '../selection/parse'; -import { DataFlowNode } from './dataflow'; -function rangeFormula(model, fieldDef, channel, config) { - var _a, _b; - if (binRequiresRange(fieldDef, channel)) { - // read format from axis or legend, if there is no format then use config.numberFormat - const guide = isUnitModel(model) - ? (_b = (_a = model.axis(channel)) !== null && _a !== void 0 ? _a : model.legend(channel)) !== null && _b !== void 0 ? _b : {} : {}; - const startField = vgField(fieldDef, { expr: 'datum' }); - const endField = vgField(fieldDef, { expr: 'datum', binSuffix: 'end' }); - return { - formulaAs: vgField(fieldDef, { binSuffix: 'range', forAs: true }), - formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config) - }; - } - return {}; -} -function binKey(bin, field) { - return `${binToString(bin)}_${field}`; -} -function getSignalsFromModel(model, key) { - return { - signal: model.getName(`${key}_bins`), - extentSignal: model.getName(`${key}_extent`) - }; -} -export function getBinSignalName(model, field, bin) { - var _a; - const normalizedBin = (_a = normalizeBin(bin, undefined)) !== null && _a !== void 0 ? _a : {}; - const key = binKey(normalizedBin, field); - return model.getName(`${key}_bins`); -} -function isBinTransform(t) { - return 'as' in t; -} -function createBinComponent(t, bin, model) { - let as; - let span; - if (isBinTransform(t)) { - as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]]; - } - else { - as = [vgField(t, { forAs: true }), vgField(t, { binSuffix: 'end', forAs: true })]; - } - const normalizedBin = Object.assign({}, normalizeBin(bin, undefined)); - const key = binKey(normalizedBin, t.field); - const { signal, extentSignal } = getSignalsFromModel(model, key); - if (isSelectionExtent(normalizedBin.extent)) { - const ext = normalizedBin.extent; - const selName = ext.selection; - span = parseSelectionBinExtent(model.getSelectionComponent(varName(selName), selName), ext); - delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property. - } - const binComponent = Object.assign(Object.assign(Object.assign({ bin: normalizedBin, field: t.field, as: [as] }, (signal ? { signal } : {})), (extentSignal ? { extentSignal } : {})), (span ? { span } : {})); - return { key, binComponent }; -} -export class BinNode extends DataFlowNode { - constructor(parent, bins) { - super(parent); - this.bins = bins; - } - clone() { - return new BinNode(null, duplicate(this.bins)); - } - static makeFromEncoding(parent, model) { - const bins = model.reduceFieldDef((binComponentIndex, fieldDef, channel) => { - if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) { - const { key, binComponent } = createBinComponent(fieldDef, fieldDef.bin, model); - binComponentIndex[key] = Object.assign(Object.assign(Object.assign({}, binComponent), binComponentIndex[key]), rangeFormula(model, fieldDef, channel, model.config)); - } - return binComponentIndex; - }, {}); - if (isEmpty(bins)) { - return null; - } - return new BinNode(parent, bins); - } - /** - * Creates a bin node from BinTransform. - * The optional parameter should provide - */ - static makeFromTransform(parent, t, model) { - const { key, binComponent } = createBinComponent(t, t.bin, model); - return new BinNode(parent, { - [key]: binComponent - }); - } - /** - * Merge bin nodes. This method either integrates the bin config from the other node - * or if this node already has a bin config, renames the corresponding signal in the model. - */ - merge(other, renameSignal) { - for (const key of keys(other.bins)) { - if (key in this.bins) { - renameSignal(other.bins[key].signal, this.bins[key].signal); - // Ensure that we don't have duplicate names for signal pairs - this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash); - } - else { - this.bins[key] = other.bins[key]; - } - } - for (const child of other.children) { - other.removeChild(child); - child.parent = this; - } - other.remove(); - } - producedFields() { - return new Set(vals(this.bins) - .map(c => c.as) - .flat(2)); - } - dependentFields() { - return new Set(vals(this.bins).map(c => c.field)); - } - hash() { - return `Bin ${hash(this.bins)}`; - } - assemble() { - return vals(this.bins).flatMap(bin => { - const transform = []; - const [binAs, ...remainingAs] = bin.as; - const _a = bin.bin, { extent } = _a, params = __rest(_a, ["extent"]); - const binTrans = Object.assign(Object.assign(Object.assign({ type: 'bin', field: replacePathInField(bin.field), as: binAs, signal: bin.signal }, (!isSelectionExtent(extent) ? { extent } : { extent: null })), (bin.span ? { span: { signal: `span(${bin.span})` } } : {})), params); - if (!extent && bin.extentSignal) { - transform.push({ - type: 'extent', - field: replacePathInField(bin.field), - signal: bin.extentSignal - }); - binTrans.extent = { signal: bin.extentSignal }; - } - transform.push(binTrans); - for (const as of remainingAs) { - for (let i = 0; i < 2; i++) { - transform.push({ - type: 'formula', - expr: vgField({ field: binAs[i] }, { expr: 'datum' }), - as: as[i] - }); - } - } - if (bin.formula) { - transform.push({ - type: 'formula', - expr: bin.formula, - as: bin.formulaAs - }); - } - return transform; - }); - } -} -//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/bin.js.map b/node_modules/vega-lite/build/src/compile/data/bin.js.map deleted file mode 100644 index 4352d43..0000000 --- a/node_modules/vega-lite/build/src/compile/data/bin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../../src/compile/data/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAY,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAC,MAAM,WAAW,CAAC;AAE/E,OAAO,EAAC,gBAAgB,EAAa,eAAe,EAAE,YAAY,EAAiB,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAGpH,OAAO,EAAO,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AAC3G,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAwB,MA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AAC,CAAC;qBACV,CAAC,CAAC;iBACJ;aACF;YAED,IAAI,GAAG,CAAC,OAAO,EAAE;gBACf,SAAS,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,GAAG,CAAC,OAAO;oBACjB,EAAE,EAAE,GAAG,CAAC,SAAS;iBAClB,CAAC,CAAC;aACJ;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/calculate.d.ts b/node_modules/vega-lite/build/src/compile/data/calculate.d.ts deleted file mode 100644 index 7d5cea1..0000000 --- a/node_modules/vega-lite/build/src/compile/data/calculate.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { FormulaTransform as VgFormulaTransform } from 'vega'; -import { SingleDefChannel } from '../../channel'; -import { FieldRefOption, TypedFieldDef } from '../../channeldef'; -import { CalculateTransform } from '../../transform'; -import { ModelWithField } from '../model'; -import { DataFlowNode } from './dataflow'; -export declare class CalculateNode extends DataFlowNode { - private readonly transform; - private _dependentFields; - clone(): CalculateNode; - constructor(parent: DataFlowNode, transform: CalculateTransform); - static parseAllForSortIndex(parent: DataFlowNode, model: ModelWithField): DataFlowNode; - producedFields(): Set; - dependentFields(): Set; - assemble(): VgFormulaTransform; - hash(): string; -} -export declare function sortArrayIndexField(fieldDef: TypedFieldDef, channel: SingleDefChannel, opt?: FieldRefOption): string; -//# sourceMappingURL=calculate.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/calculate.d.ts.map b/node_modules/vega-lite/build/src/compile/data/calculate.d.ts.map deleted file mode 100644 index f491144..0000000 --- a/node_modules/vega-lite/build/src/compile/data/calculate.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"calculate.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/calculate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,IAAI,kBAAkB,EAAC,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,cAAc,EAAmB,aAAa,EAAU,MAAM,kBAAkB,CAAC;AAIzF,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAGxC,qBAAa,aAAc,SAAQ,YAAY;IAOX,OAAO,CAAC,QAAQ,CAAC,SAAS;IAN5D,OAAO,CAAC,gBAAgB,CAAc;IAE/B,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAmB,SAAS,EAAE,kBAAkB;WAMlE,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc;IA0BvE,cAAc;IAId,eAAe;IAIf,QAAQ,IAAI,kBAAkB;IAQ9B,IAAI;CAGZ;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,CAAC,EAAE,cAAc,UAEnH"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/calculate.js b/node_modules/vega-lite/build/src/compile/data/calculate.js deleted file mode 100644 index 6a8b17c..0000000 --- a/node_modules/vega-lite/build/src/compile/data/calculate.js +++ /dev/null @@ -1,59 +0,0 @@ -import { isScaleFieldDef, vgField } from '../../channeldef'; -import { fieldFilterExpression } from '../../predicate'; -import { isSortArray } from '../../sort'; -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -import { getDependentFields } from './expressions'; -export class CalculateNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - this._dependentFields = getDependentFields(this.transform.calculate); - } - clone() { - return new CalculateNode(null, duplicate(this.transform)); - } - static parseAllForSortIndex(parent, model) { - // get all the encoding with sort fields from model - model.forEachFieldDef((fieldDef, channel) => { - if (!isScaleFieldDef(fieldDef)) { - return; - } - if (isSortArray(fieldDef.sort)) { - const { field, timeUnit } = fieldDef; - const sort = fieldDef.sort; - // generate `datum["a"] === val0 ? 0 : datum["a"] === val1 ? 1 : ... : n` via FieldEqualPredicate - const calculate = sort - .map((sortValue, i) => { - return `${fieldFilterExpression({ field, timeUnit, equal: sortValue })} ? ${i} : `; - }) - .join('') + sort.length; - parent = new CalculateNode(parent, { - calculate, - as: sortArrayIndexField(fieldDef, channel, { forAs: true }) - }); - } - }); - return parent; - } - producedFields() { - return new Set([this.transform.as]); - } - dependentFields() { - return this._dependentFields; - } - assemble() { - return { - type: 'formula', - expr: this.transform.calculate, - as: this.transform.as - }; - } - hash() { - return `Calculate ${hash(this.transform)}`; - } -} -export function sortArrayIndexField(fieldDef, channel, opt) { - return vgField(fieldDef, Object.assign({ prefix: channel, suffix: 'sort_index' }, (opt !== null && opt !== void 0 ? opt : {}))); -} -//# sourceMappingURL=calculate.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/calculate.js.map b/node_modules/vega-lite/build/src/compile/data/calculate.js.map deleted file mode 100644 index 631c607..0000000 --- a/node_modules/vega-lite/build/src/compile/data/calculate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"calculate.js","sourceRoot":"","sources":["../../../../src/compile/data/calculate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAiB,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzF,OAAO,EAAC,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEjD,MAAM,OAAO,aAAc,SAAQ,YAAY;IAO7C,YAAY,MAA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ACnB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS;YAC9B,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE;SACtB,CAAC;IACJ,CAAC;IAEM,IAAI;QACT,OAAO,aAAa,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,QAA+B,EAAE,OAAyB,EAAE,GAAoB;IAClH,OAAO,OAAO,CAAC,QAAQ,kBAAG,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,IAAK,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAAC,EAAE,CAAC;AACpF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/dataflow.d.ts b/node_modules/vega-lite/build/src/compile/data/dataflow.d.ts deleted file mode 100644 index 4807268..0000000 --- a/node_modules/vega-lite/build/src/compile/data/dataflow.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { DataSourceType } from '../../data'; -import { Dict } from '../../util'; -/** - * A node in the dataflow tree. - */ -export declare abstract class DataFlowNode { - readonly debugName?: string; - private _children; - private _parent; - protected _hash: string | number; - constructor(parent: DataFlowNode, debugName?: string); - /** - * Clone this node with a deep copy but don't clone links to children or parents. - */ - clone(): DataFlowNode; - /** - * Return a hash of the node. - */ - abstract hash(): string | number; - /** - * Set of fields that this node depends on. - */ - abstract dependentFields(): Set; - /** - * Set of fields that are being created by this node. - */ - abstract producedFields(): Set; - get parent(): DataFlowNode; - /** - * Set the parent of the node and also add this node to the parent's children. - */ - set parent(parent: DataFlowNode); - get children(): DataFlowNode[]; - numChildren(): number; - addChild(child: DataFlowNode, loc?: number): void; - removeChild(oldChild: DataFlowNode): number; - /** - * Remove node from the dataflow. - */ - remove(): void; - /** - * Insert another node as a parent of this node. - */ - insertAsParentOf(other: DataFlowNode): void; - swapWithParent(): void; -} -export declare class OutputNode extends DataFlowNode { - readonly type: DataSourceType; - private readonly refCounts; - private _source; - private _name; - clone(): this; - /** - * @param source The name of the source. Will change in assemble. - * @param type The type of the output node. - * @param refCounts A global ref counter map. - */ - constructor(parent: DataFlowNode, source: string, type: DataSourceType, refCounts: Dict); - dependentFields(): Set; - producedFields(): Set; - hash(): string | number; - /** - * Request the datasource name and increase the ref counter. - * - * During the parsing phase, this will return the simple name such as 'main' or 'raw'. - * It is crucial to request the name from an output node to mark it as a required node. - * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase. - * - * In the assemble phase, this will return the correct name. - */ - getSource(): string; - isRequired(): boolean; - setSource(source: string): void; -} -//# sourceMappingURL=dataflow.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/dataflow.d.ts.map b/node_modules/vega-lite/build/src/compile/data/dataflow.d.ts.map deleted file mode 100644 index 2d80473..0000000 --- a/node_modules/vega-lite/build/src/compile/data/dataflow.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/dataflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,IAAI,EAAW,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,8BAAsB,YAAY;aAOkB,SAAS,CAAC,EAAE,MAAM;IANpE,OAAO,CAAC,SAAS,CAAsB;IAEvC,OAAO,CAAC,OAAO,CAAsB;IAErC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;gBAErB,MAAM,EAAE,YAAY,EAAkB,SAAS,CAAC,EAAE,MAAM;IAMpE;;OAEG;IACI,KAAK,IAAI,YAAY;IAI5B;;OAEG;aACa,IAAI,IAAI,MAAM,GAAG,MAAM;IAEvC;;OAEG;aACa,eAAe,IAAI,GAAG,CAAC,MAAM,CAAC;IAE9C;;OAEG;aACa,cAAc,IAAI,GAAG,CAAC,MAAM,CAAC;IAE7C,IAAI,MAAM,IAOS,YAAY,CAL9B;IAED;;OAEG;IACH,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,EAK9B;IAED,IAAI,QAAQ,mBAEX;IAEM,WAAW;IAIX,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,MAAM;IAc1C,WAAW,CAAC,QAAQ,EAAE,YAAY;IAMzC;;OAEG;IACI,MAAM;IASb;;OAEG;IACI,gBAAgB,CAAC,KAAK,EAAE,YAAY;IAOpC,cAAc;CAkBtB;AAED,qBAAa,UAAW,SAAQ,YAAY;aAwBxB,IAAI,EAAE,cAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAxB5B,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,KAAK,CAAS;IAEf,KAAK,IAAI,IAAI;IAWpB;;;;OAIG;gBAED,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACE,IAAI,EAAE,cAAc,EACnB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC;IAWnC,eAAe;IAIf,cAAc;IAId,IAAI;IAOX;;;;;;;;OAQG;IACI,SAAS;IAKT,UAAU,IAAI,OAAO;IAIrB,SAAS,CAAC,MAAM,EAAE,MAAM;CAGhC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/dataflow.js b/node_modules/vega-lite/build/src/compile/data/dataflow.js deleted file mode 100644 index 2f96b75..0000000 --- a/node_modules/vega-lite/build/src/compile/data/dataflow.js +++ /dev/null @@ -1,150 +0,0 @@ -import * as log from '../../log'; -import { uniqueId } from '../../util'; -/** - * A node in the dataflow tree. - */ -export class DataFlowNode { - constructor(parent, debugName) { - this.debugName = debugName; - this._children = []; - this._parent = null; - if (parent) { - this.parent = parent; - } - } - /** - * Clone this node with a deep copy but don't clone links to children or parents. - */ - clone() { - throw new Error('Cannot clone node'); - } - get parent() { - return this._parent; - } - /** - * Set the parent of the node and also add this node to the parent's children. - */ - set parent(parent) { - this._parent = parent; - if (parent) { - parent.addChild(this); - } - } - get children() { - return this._children; - } - numChildren() { - return this._children.length; - } - addChild(child, loc) { - // do not add the same child twice - if (this._children.indexOf(child) > -1) { - log.warn(log.message.ADD_SAME_CHILD_TWICE); - return; - } - if (loc !== undefined) { - this._children.splice(loc, 0, child); - } - else { - this._children.push(child); - } - } - removeChild(oldChild) { - const loc = this._children.indexOf(oldChild); - this._children.splice(loc, 1); - return loc; - } - /** - * Remove node from the dataflow. - */ - remove() { - let loc = this._parent.removeChild(this); - for (const child of this._children) { - // do not use the set method because we want to insert at a particular location - child._parent = this._parent; - this._parent.addChild(child, loc++); - } - } - /** - * Insert another node as a parent of this node. - */ - insertAsParentOf(other) { - const parent = other.parent; - parent.removeChild(this); - this.parent = parent; - other.parent = this; - } - swapWithParent() { - const parent = this._parent; - const newParent = parent.parent; - // reconnect the children - for (const child of this._children) { - child.parent = parent; - } - // remove old links - this._children = []; // equivalent to removing every child link one by one - parent.removeChild(this); - parent.parent.removeChild(parent); - // swap two nodes - this.parent = newParent; - parent.parent = this; - } -} -export class OutputNode extends DataFlowNode { - /** - * @param source The name of the source. Will change in assemble. - * @param type The type of the output node. - * @param refCounts A global ref counter map. - */ - constructor(parent, source, type, refCounts) { - super(parent, source); - this.type = type; - this.refCounts = refCounts; - this._source = this._name = source; - if (this.refCounts && !(this._name in this.refCounts)) { - this.refCounts[this._name] = 0; - } - } - clone() { - const cloneObj = new this.constructor(); - cloneObj.debugName = 'clone_' + this.debugName; - cloneObj._source = this._source; - cloneObj._name = 'clone_' + this._name; - cloneObj.type = this.type; - cloneObj.refCounts = this.refCounts; - cloneObj.refCounts[cloneObj._name] = 0; - return cloneObj; - } - dependentFields() { - return new Set(); - } - producedFields() { - return new Set(); - } - hash() { - if (this._hash === undefined) { - this._hash = `Output ${uniqueId()}`; - } - return this._hash; - } - /** - * Request the datasource name and increase the ref counter. - * - * During the parsing phase, this will return the simple name such as 'main' or 'raw'. - * It is crucial to request the name from an output node to mark it as a required node. - * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase. - * - * In the assemble phase, this will return the correct name. - */ - getSource() { - this.refCounts[this._name]++; - return this._source; - } - isRequired() { - return !!this.refCounts[this._name]; - } - setSource(source) { - this._source = source; - } -} -//# sourceMappingURL=dataflow.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/dataflow.js.map b/node_modules/vega-lite/build/src/compile/data/dataflow.js.map deleted file mode 100644 index 79511cd..0000000 --- a/node_modules/vega-lite/build/src/compile/data/dataflow.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dataflow.js","sourceRoot":"","sources":["../../../../src/compile/data/dataflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAO,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAgB,YAAY;IAOhC,YAAY,MAAoB,EAAkB,SAAkB;QAAlB,cAAS,GAAT,SAAS,CAAS;QAN5D,cAAS,GAAmB,EAAE,CAAC;QAE/B,YAAO,GAAiB,IAAI,CAAC;QAKnC,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;IACH,CAAC;IAED;;OAEG;IACI,KAAK;QACV,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAiBD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM,CAAC,MAAoB;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,MAAM,EAAE;YACV,MAAM,CAAC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CAAC;QACjD,QAAQ,CAAC,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAC/C,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAChC,QAAQ,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;QACvC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACpC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAsBM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,IAAI;QACT,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC5B,IAAI,CAAC,KAAK,GAAG,UAAU,QAAQ,EAAE,EAAE,CAAC;SACrC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;;;;OAQG;IACI,SAAS;QACd,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,UAAU;QACf,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAEM,SAAS,CAAC,MAAc;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/debug.d.ts b/node_modules/vega-lite/build/src/compile/data/debug.d.ts deleted file mode 100644 index 1cc9aad..0000000 --- a/node_modules/vega-lite/build/src/compile/data/debug.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { DataFlowNode } from './dataflow'; -/** - * Print debug information for dataflow tree. - */ -export declare function printDebugDataflow(node: DataFlowNode): void; -/** - * Show the dataflow graph as an image (rendered by https://kroki.io/) on the command line. - */ -export declare function drawDataflow(roots: readonly DataFlowNode[], size?: number): void; -/** - * Print the dataflow tree as graphviz. - * - * Render the output in e.g. http://viz-js.com/. - */ -export declare function dotString(roots: readonly DataFlowNode[]): string; -//# sourceMappingURL=debug.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/debug.d.ts.map b/node_modules/vega-lite/build/src/compile/data/debug.d.ts.map deleted file mode 100644 index 59b8e3c..0000000 --- a/node_modules/vega-lite/build/src/compile/data/debug.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/debug.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAa,MAAM,YAAY,CAAC;AAKpD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,QAQpD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,EAAE,IAAI,SAAM,QAOtE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,UA8EvD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/debug.js b/node_modules/vega-lite/build/src/compile/data/debug.js deleted file mode 100644 index b53c7c2..0000000 --- a/node_modules/vega-lite/build/src/compile/data/debug.js +++ /dev/null @@ -1,100 +0,0 @@ -import { entries, uniqueId } from '../../util'; -import { OutputNode } from './dataflow'; -import { SourceNode } from './source'; -import pako from 'pako'; -import { checkLinks } from './optimize'; -/** - * Print debug information for dataflow tree. - */ -export function printDebugDataflow(node) { - console.log(`${node.constructor.name}${node.debugName ? `(${node.debugName})` : ''} -> ${node.children.map(c => { - return `${c.constructor.name}${c.debugName ? ` (${c.debugName})` : ''}`; - })}`); - console.log(node); - node.children.forEach(printDebugDataflow); -} -/** - * Show the dataflow graph as an image (rendered by https://kroki.io/) on the command line. - */ -export function drawDataflow(roots, size = 500) { - const dot = dotString(roots); - const text = new TextEncoder().encode(dot); - const compressed = pako.deflate(text, { level: 9, to: 'string' }); - const result = btoa(compressed).replace(/\+/g, '-').replace(/\//g, '_'); - const imageURL = `https://kroki.io/plantuml/png/${result}`; - console.log('%c ', `font-size:${size}px; background:url(${imageURL}) no-repeat; background-size:contain`); -} -/** - * Print the dataflow tree as graphviz. - * - * Render the output in e.g. http://viz-js.com/. - */ -export function dotString(roots) { - // check the graph before printing it since the logic below assumes a consistent graph - checkLinks(roots); - const nodes = {}; - const edges = []; - function getId(node) { - let id = node['__uniqueid']; - if (id === undefined) { - id = uniqueId(); - node['__uniqueid'] = id; - } - return id; - } - function getLabel(node) { - var _a; - const out = [node.constructor.name.slice(0, -4)]; - if (node.debugName) { - out.push(`${node.debugName}`); - } - else if (node instanceof SourceNode) { - if (node.data.name || node.data.url) { - out.push(`${(_a = node.data.name) !== null && _a !== void 0 ? _a : node.data.url}`); - } - } - const dep = node.dependentFields(); - if (dep === null || dep === void 0 ? void 0 : dep.size) { - out.push(`IN: ${[...node.dependentFields()].join(', ')}`); - } - const prod = node.producedFields(); - if (prod === null || prod === void 0 ? void 0 : prod.size) { - out.push(`OUT: ${[...node.producedFields()].join(', ')}`); - } - if (node instanceof OutputNode) { - out.push(`required: ${node.isRequired()}`); - } - return out.join('
'); - } - function collector(node) { - var _a, _b; - const id = getId(node); - nodes[id] = { - id: id, - label: getLabel(node), - hash: node instanceof SourceNode - ? (_b = (_a = node.data.url) !== null && _a !== void 0 ? _a : node.data.name) !== null && _b !== void 0 ? _b : node.debugName : String(node.hash()).replace(/"/g, '') - }; - for (const child of node.children) { - edges.push([id, getId(child)]); - collector(child); - } - } - for (const n of roots) { - collector(n); - } - const dot = `digraph DataFlow { - rankdir = TB; - node [shape=record] - ${entries(nodes) - .map(({ key, value }) => ` "${key}" [ - label = <${value.label}>; - tooltip = "[${value.id}] ${value.hash}" - ]`) - .join('\n')} - - ${edges.map(([source, target]) => `"${source}" -> "${target}"`).join(' ')} -}`; - return dot; -} -//# sourceMappingURL=debug.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/debug.js.map b/node_modules/vega-lite/build/src/compile/data/debug.js.map deleted file mode 100644 index 5cffa39..0000000 --- a/node_modules/vega-lite/build/src/compile/data/debug.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../../src/compile/data/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAe,UAAU,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAkB;IACnD,OAAO,CAAC,GAAG,CACT,GAAI,IAAI,CAAC,WAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QAC1G,OAAO,GAAI,CAAC,CAAC,WAAmB,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACnF,CAAC,CAAC,EAAE,CACL,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC5C,CAAC;AAED;;GA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ACF,IAAI,YAAY,UAAU;gBACxB,CAAC,aAAC,IAAI,CAAC,IAAI,CAAC,GAAG,mCAAI,IAAI,CAAC,IAAI,CAAC,IAAI,mCAAI,IAAI,CAAC,SAAS,CACnD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;SAC5C,CAAC;QAEF,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/B,SAAS,CAAC,KAAK,CAAC,CAAC;SAClB;IACH,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;QACrB,SAAS,CAAC,CAAC,CAAC,CAAC;KACd;IAED,MAAM,GAAG,GAAG;;;IAGV,OAAO,CAAC,KAAK,CAAC;SACb,GAAG,CACF,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,EAAE,EAAE,CAAC,MAAM,GAAG;eAClB,KAAK,CAAC,KAAK;kBACR,KAAK,CAAC,EAAE,UAAU,KAAK,CAAC,IAAI;IAC1C,CACC;SACA,IAAI,CAAC,IAAI,CAAC;;IAEX,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,MAAM,SAAS,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACzE,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/density.d.ts b/node_modules/vega-lite/build/src/compile/data/density.d.ts deleted file mode 100644 index d534b5e..0000000 --- a/node_modules/vega-lite/build/src/compile/data/density.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { KDETransform as VgKDETransform } from 'vega'; -import { DensityTransform } from '../../transform'; -import { DataFlowNode } from './dataflow'; -/** - * A class for density transform nodes - */ -export declare class DensityTransformNode extends DataFlowNode { - private transform; - clone(): DensityTransformNode; - constructor(parent: DataFlowNode, transform: DensityTransform); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgKDETransform; -} -//# sourceMappingURL=density.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/density.d.ts.map b/node_modules/vega-lite/build/src/compile/data/density.d.ts.map deleted file mode 100644 index a53f51f..0000000 --- a/node_modules/vega-lite/build/src/compile/data/density.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"density.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/density.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,IAAI,cAAc,EAAC,MAAM,MAAM,CAAC;AACpD,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;IAKlB,OAAO,CAAC,SAAS;IAJ5C,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,SAAS,EAAE,gBAAgB;IAO9D,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,cAAc;CASlC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/density.js b/node_modules/vega-lite/build/src/compile/data/density.js deleted file mode 100644 index 14156b3..0000000 --- a/node_modules/vega-lite/build/src/compile/data/density.js +++ /dev/null @@ -1,35 +0,0 @@ -import { __rest } from "tslib"; -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for density transform nodes - */ -export class DensityTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'value', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'density']; - } - clone() { - return new DensityTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.density, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `DensityTransform ${hash(this.transform)}`; - } - assemble() { - const _a = this.transform, { density } = _a, rest = __rest(_a, ["density"]); - const result = Object.assign({ type: 'kde', field: density }, rest); - return result; - } -} -//# sourceMappingURL=density.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/density.js.map b/node_modules/vega-lite/build/src/compile/data/density.js.map deleted file mode 100644 index 9aff87c..0000000 --- a/node_modules/vega-lite/build/src/compile/data/density.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"density.js","sourceRoot":"","sources":["../../../../src/compile/data/density.ts"],"names":[],"mappings":";AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAKpD,YAAY,MAAoB,EAAU,SAA2B;;QACnE,KAAK,CAAC,MAAM,CAAC,CAAC;QAD0B,cAAS,GAAT,SAAS,CAAkB;QAEnE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,WAAW,SAAG,IAAI,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,OAAC,WAAW,CAAC,CAAC,CAAC,mCAAI,OAAO,QAAE,WAAW,CAAC,CAAC,CAAC,mCAAI,SAAS,CAAC,CAAC;IAC/E,CAAC;IATM,KAAK;QACV,OAAO,IAAI,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACnE,CAAC;IASM,eAAe;;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,OAAC,IAAI,CAAC,SAAS,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,oBAAoB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACpD,CAAC;IAEM,QAAQ;QACb,MAAM,KAAqB,IAAI,CAAC,SAAS,EAAnC,EAAC,OAAO,OAA2B,EAAtB,IAAI,cAAjB,WAAkB,CAAiB,CAAC;QAC1C,MAAM,MAAM,mBACV,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,OAAO,IACX,IAAI,CACR,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/expressions.d.ts b/node_modules/vega-lite/build/src/compile/data/expressions.d.ts deleted file mode 100644 index b01f6e8..0000000 --- a/node_modules/vega-lite/build/src/compile/data/expressions.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function getDependentFields(expression: string): Set; -//# sourceMappingURL=expressions.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/expressions.d.ts.map b/node_modules/vega-lite/build/src/compile/data/expressions.d.ts.map deleted file mode 100644 index 2f27dab..0000000 --- a/node_modules/vega-lite/build/src/compile/data/expressions.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"expressions.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/expressions.ts"],"names":[],"mappings":"AA4BA,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,eAUpD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/expressions.js b/node_modules/vega-lite/build/src/compile/data/expressions.js deleted file mode 100644 index 3827401..0000000 --- a/node_modules/vega-lite/build/src/compile/data/expressions.js +++ /dev/null @@ -1,32 +0,0 @@ -import { parse } from 'vega-expression'; -function getName(node) { - const name = []; - if (node.type === 'Identifier') { - return [node.name]; - } - if (node.type === 'Literal') { - return [node.value]; - } - if (node.type === 'MemberExpression') { - name.push(...getName(node.object)); - name.push(...getName(node.property)); - } - return name; -} -function startsWithDatum(node) { - if (node.object.type === 'MemberExpression') { - return startsWithDatum(node.object); - } - return node.object.name === 'datum'; -} -export function getDependentFields(expression) { - const ast = parse(expression); - const dependents = new Set(); - ast.visit((node) => { - if (node.type === 'MemberExpression' && startsWithDatum(node)) { - dependents.add(getName(node).slice(1).join('.')); - } - }); - return dependents; -} -//# sourceMappingURL=expressions.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/expressions.js.map b/node_modules/vega-lite/build/src/compile/data/expressions.js.map deleted file mode 100644 index 5728012..0000000 --- a/node_modules/vega-lite/build/src/compile/data/expressions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"expressions.js","sourceRoot":"","sources":["../../../../src/compile/data/expressions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAEtC,SAAS,OAAO,CAAC,IAAS;IACxB,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE;QAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE;QAC3B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACrB;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,EAAE;QACpC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;KACtC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CAAC,IAAS;IAChC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB,EAAE;QAC3C,OAAO,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACrC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IAC9B,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAS,EAAE,EAAE;QACtB,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;YAC7D,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAClD;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/facet.d.ts b/node_modules/vega-lite/build/src/compile/data/facet.d.ts deleted file mode 100644 index 08c652d..0000000 --- a/node_modules/vega-lite/build/src/compile/data/facet.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { VgData } from '../../vega.schema'; -import { FacetModel } from '../facet'; -import { DataFlowNode } from './dataflow'; -/** - * A node that helps us track what fields we are faceting by. - */ -export declare class FacetNode extends DataFlowNode { - readonly model: FacetModel; - readonly name: string; - data: string; - private readonly column; - private readonly row; - private readonly facet; - private readonly childModel; - /** - * @param model The facet model. - * @param name The name that this facet source will have. - * @param data The source data for this facet data. - */ - constructor(parent: DataFlowNode, model: FacetModel, name: string, data: string); - hash(): string; - get fields(): string[]; - dependentFields(): Set; - producedFields(): Set; - /** - * The name to reference this source is its name. - */ - getSource(): string; - private getChildIndependentFieldsWithStep; - private assembleRowColumnHeaderData; - private assembleFacetHeaderData; - assemble(): VgData[]; -} -//# sourceMappingURL=facet.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/facet.d.ts.map b/node_modules/vega-lite/build/src/compile/data/facet.d.ts.map deleted file mode 100644 index 4b87e0c..0000000 --- a/node_modules/vega-lite/build/src/compile/data/facet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facet.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/facet.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAKpC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAexC;;GAEG;AACH,qBAAa,SAAU,SAAQ,YAAY;aAgBvB,KAAK,EAAE,UAAU;aACjB,IAAI,EAAE,MAAM;IACrB,IAAI,EAAE,MAAM;IAjBrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAE1C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAmB;IAEvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IAEzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IAEnC;;;;OAIG;gBAED,MAAM,EAAE,YAAY,EACJ,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM;IAsBd,IAAI;IAYX,IAAI,MAAM,aAST;IAEM,eAAe;IAiBf,cAAc;IAIrB;;OAEG;IACI,SAAS;IAIhB,OAAO,CAAC,iCAAiC;IAyBzC,OAAO,CAAC,2BAA2B;IA0DnC,OAAO,CAAC,uBAAuB;IAmDxB,QAAQ;CA8ChB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/facet.js b/node_modules/vega-lite/build/src/compile/data/facet.js deleted file mode 100644 index 1f5b120..0000000 --- a/node_modules/vega-lite/build/src/compile/data/facet.js +++ /dev/null @@ -1,232 +0,0 @@ -import { isArray } from 'vega-util'; -import { isBinning } from '../../bin'; -import { COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW } from '../../channel'; -import { vgField } from '../../channeldef'; -import * as log from '../../log'; -import { hasDiscreteDomain } from '../../scale'; -import { DEFAULT_SORT_OP, isSortField } from '../../sort'; -import { hash } from '../../util'; -import { isVgRangeStep } from '../../vega.schema'; -import { HEADER_CHANNELS, HEADER_TYPES } from '../header/component'; -import { assembleDomain, getFieldFromDomain } from '../scale/domain'; -import { sortArrayIndexField } from './calculate'; -import { DataFlowNode } from './dataflow'; -/** - * A node that helps us track what fields we are faceting by. - */ -export class FacetNode extends DataFlowNode { - /** - * @param model The facet model. - * @param name The name that this facet source will have. - * @param data The source data for this facet data. - */ - constructor(parent, model, name, data) { - super(parent); - this.model = model; - this.name = name; - this.data = data; - for (const channel of FACET_CHANNELS) { - const fieldDef = model.facet[channel]; - if (fieldDef) { - const { bin, sort } = fieldDef; - this[channel] = Object.assign({ name: model.getName(`${channel}_domain`), fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, { binSuffix: 'end' })] : [])] }, (isSortField(sort) - ? { sortField: sort } - : isArray(sort) - ? { sortIndexField: sortArrayIndexField(fieldDef, channel) } - : {})); - } - } - this.childModel = model.child; - } - hash() { - let out = `Facet`; - for (const channel of FACET_CHANNELS) { - if (this[channel]) { - out += ` ${channel.charAt(0)}:${hash(this[channel])}`; - } - } - return out; - } - get fields() { - var _a; - const f = []; - for (const channel of FACET_CHANNELS) { - if ((_a = this[channel]) === null || _a === void 0 ? void 0 : _a.fields) { - f.push(...this[channel].fields); - } - } - return f; - } - dependentFields() { - const depFields = new Set(this.fields); - for (const channel of FACET_CHANNELS) { - if (this[channel]) { - if (this[channel].sortField) { - depFields.add(this[channel].sortField.field); - } - if (this[channel].sortIndexField) { - depFields.add(this[channel].sortIndexField); - } - } - } - return depFields; - } - producedFields() { - return new Set(); // facet does not produce any new fields - } - /** - * The name to reference this source is its name. - */ - getSource() { - return this.name; - } - getChildIndependentFieldsWithStep() { - const childIndependentFieldsWithStep = {}; - for (const channel of POSITION_SCALE_CHANNELS) { - const childScaleComponent = this.childModel.component.scales[channel]; - if (childScaleComponent && !childScaleComponent.merged) { - // independent scale - const type = childScaleComponent.get('type'); - const range = childScaleComponent.get('range'); - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const domain = assembleDomain(this.childModel, channel); - const field = getFieldFromDomain(domain); - if (field) { - childIndependentFieldsWithStep[channel] = field; - } - else { - log.warn(log.message.unknownField(channel)); - } - } - } - } - return childIndependentFieldsWithStep; - } - assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep) { - const childChannel = { row: 'y', column: 'x' }[channel]; - const fields = []; - const ops = []; - const as = []; - if (childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) { - if (crossedDataName) { - // If there is a crossed data, calculate max - fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); - ops.push('max'); - } - else { - // If there is no crossed data, just calculate distinct - fields.push(childIndependentFieldsWithStep[childChannel]); - ops.push('distinct'); - } - // Although it is technically a max, just name it distinct so it's easier to refer to it - as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); - } - const { sortField, sortIndexField } = this[channel]; - if (sortField) { - const { op = DEFAULT_SORT_OP, field } = sortField; - fields.push(field); - ops.push(op); - as.push(vgField(sortField, { forAs: true })); - } - else if (sortIndexField) { - fields.push(sortIndexField); - ops.push('max'); - as.push(sortIndexField); - } - return { - name: this[channel].name, - // Use data from the crossed one if it exist - source: crossedDataName !== null && crossedDataName !== void 0 ? crossedDataName : this.data, - transform: [ - Object.assign({ type: 'aggregate', groupby: this[channel].fields }, (fields.length - ? { - fields, - ops, - as - } - : {})) - ] - }; - } - assembleFacetHeaderData(childIndependentFieldsWithStep) { - var _a, _b; - const { columns } = this.model.layout; - const { layoutHeaders } = this.model.component; - const data = []; - const hasSharedAxis = {}; - for (const headerChannel of HEADER_CHANNELS) { - for (const headerType of HEADER_TYPES) { - const headers = (_a = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType])) !== null && _a !== void 0 ? _a : []; - for (const header of headers) { - if (((_b = header.axes) === null || _b === void 0 ? void 0 : _b.length) > 0) { - hasSharedAxis[headerChannel] = true; - break; - } - } - } - if (hasSharedAxis[headerChannel]) { - const cardinality = `length(data("${this.facet.name}"))`; - const stop = headerChannel === 'row' - ? columns - ? { signal: `ceil(${cardinality} / ${columns})` } - : 1 - : columns - ? { signal: `min(${cardinality}, ${columns})` } - : { signal: cardinality }; - data.push({ - name: `${this.facet.name}_${headerChannel}`, - transform: [ - { - type: 'sequence', - start: 0, - stop - } - ] - }); - } - } - const { row, column } = hasSharedAxis; - if (row || column) { - data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep)); - } - return data; - } - assemble() { - var _a, _b; - const data = []; - let crossedDataName = null; - const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep(); - const { column, row, facet } = this; - if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) { - // Need to create a cross dataset to correctly calculate cardinality - crossedDataName = `cross_${this.column.name}_${this.row.name}`; - const fields = [].concat((_a = childIndependentFieldsWithStep.x) !== null && _a !== void 0 ? _a : [], (_b = childIndependentFieldsWithStep.y) !== null && _b !== void 0 ? _b : []); - const ops = fields.map(() => 'distinct'); - data.push({ - name: crossedDataName, - source: this.data, - transform: [ - { - type: 'aggregate', - groupby: this.fields, - fields, - ops - } - ] - }); - } - for (const channel of [COLUMN, ROW]) { - if (this[channel]) { - data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep)); - } - } - if (facet) { - const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep); - if (facetData) { - data.push(...facetData); - } - } - return data; - } -} -//# sourceMappingURL=facet.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/facet.js.map b/node_modules/vega-lite/build/src/compile/data/facet.js.map deleted file mode 100644 index 534c778..0000000 --- a/node_modules/vega-lite/build/src/compile/data/facet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facet.js","sourceRoot":"","sources":["../../../../src/compile/data/facet.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EAAC,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAqB,WAAW,EAAC,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,aAAa,EAAS,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAC,eAAe,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAexC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,YAAY;IASzC;;;;OAIG;IACH,YACE,MAAoB,EACJ,KAAiB,EACjB,IAAY,EACrB,IAAY;QAEnB,KAAK,CAAC,MAAM,CAAC,CAAC;QAJE,UAAK,GAAL,KAAK,C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B,CAAC,CAAC,CAAC;aACvG;SACF;QAED,IAAI,KAAK,EAAE;YACT,MAAM,SAAS,GAAG,IAAI,CAAC,uBAAuB,CAAC,8BAA8B,CAAC,CAAC;YAC/E,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;aACzB;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/filter.d.ts b/node_modules/vega-lite/build/src/compile/data/filter.d.ts deleted file mode 100644 index e68432c..0000000 --- a/node_modules/vega-lite/build/src/compile/data/filter.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { FilterTransform as VgFilterTransform } from 'vega'; -import { LogicalComposition } from '../../logical'; -import { Predicate } from '../../predicate'; -import { Model } from '../model'; -import { DataFlowNode } from './dataflow'; -export declare class FilterNode extends DataFlowNode { - private readonly model; - private readonly filter; - private expr; - private _dependentFields; - clone(): FilterNode; - constructor(parent: DataFlowNode, model: Model, filter: LogicalComposition); - dependentFields(): Set; - producedFields(): Set; - assemble(): VgFilterTransform; - hash(): string; -} -//# sourceMappingURL=filter.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/filter.d.ts.map b/node_modules/vega-lite/build/src/compile/data/filter.d.ts.map deleted file mode 100644 index 93bf568..0000000 --- a/node_modules/vega-lite/build/src/compile/data/filter.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAGxC,qBAAa,UAAW,SAAQ,YAAY;IASxC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IATzB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,gBAAgB,CAAc;IAC/B,KAAK;gBAKV,MAAM,EAAE,YAAY,EACH,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,kBAAkB,CAAC,SAAS,CAAC;IAWjD,eAAe;IAIf,cAAc;IAId,QAAQ,IAAI,iBAAiB;IAO7B,IAAI;CAGZ"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/filter.js b/node_modules/vega-lite/build/src/compile/data/filter.js deleted file mode 100644 index 55e96f8..0000000 --- a/node_modules/vega-lite/build/src/compile/data/filter.js +++ /dev/null @@ -1,34 +0,0 @@ -import { duplicate } from '../../util'; -import { expression } from '../predicate'; -import { DataFlowNode } from './dataflow'; -import { getDependentFields } from './expressions'; -export class FilterNode extends DataFlowNode { - constructor(parent, model, filter) { - super(parent); - this.model = model; - this.filter = filter; - // TODO: refactor this to not take a node and - // then add a static function makeFromOperand and make the constructor take only an expression - this.expr = expression(this.model, this.filter, this); - this._dependentFields = getDependentFields(this.expr); - } - clone() { - return new FilterNode(null, this.model, duplicate(this.filter)); - } - dependentFields() { - return this._dependentFields; - } - producedFields() { - return new Set(); // filter does not produce any new fields - } - assemble() { - return { - type: 'filter', - expr: this.expr - }; - } - hash() { - return `Filter ${this.expr}`; - } -} -//# sourceMappingURL=filter.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/filter.js.map b/node_modules/vega-lite/build/src/compile/data/filter.js.map deleted file mode 100644 index 23dc988..0000000 --- a/node_modules/vega-lite/build/src/compile/data/filter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../../src/compile/data/filter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEjD,MAAM,OAAO,UAAW,SAAQ,YAAY;IAO1C,YACE,MAAoB,EACH,KAAY,EACZ,MAAqC;QAEtD,KAAK,CAAC,MAAM,CAAC,CAAC;QAHG,UAAK,GAAL,KAAK,CAAO;QACZ,WAAM,GAAN,MAAM,CAA+B;QAItD,6CAA6C;QAC7C,8FAA8F;QAC9F,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAEtD,IAAI,CAAC,gBAAgB,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAhBM,KAAK;QACV,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,CAAC;IAgBM,eAAe;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,EAAU,CAAC,CAAC,yCAAyC;IACrE,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;IAEM,IAAI;QACT,OAAO,UAAU,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/filterinvalid.d.ts b/node_modules/vega-lite/build/src/compile/data/filterinvalid.d.ts deleted file mode 100644 index 0a05aad..0000000 --- a/node_modules/vega-lite/build/src/compile/data/filterinvalid.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { FilterTransform as VgFilterTransform } from 'vega'; -import { TypedFieldDef } from '../../channeldef'; -import { Dict } from '../../util'; -import { UnitModel } from '../unit'; -import { DataFlowNode } from './dataflow'; -export declare class FilterInvalidNode extends DataFlowNode { - readonly filter: Dict>; - clone(): FilterInvalidNode; - constructor(parent: DataFlowNode, filter: Dict>); - static make(parent: DataFlowNode, model: UnitModel): FilterInvalidNode; - dependentFields(): Set; - producedFields(): Set; - hash(): string; - /** - * Create the VgTransforms for each of the filtered fields. - */ - assemble(): VgFilterTransform; -} -//# sourceMappingURL=filterinvalid.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/filterinvalid.d.ts.map b/node_modules/vega-lite/build/src/compile/data/filterinvalid.d.ts.map deleted file mode 100644 index 1dfb171..0000000 --- a/node_modules/vega-lite/build/src/compile/data/filterinvalid.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterinvalid.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/filterinvalid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAE1D,OAAO,EAAC,aAAa,EAAsB,MAAM,kBAAkB,CAAC;AAGpE,OAAO,EAAC,IAAI,EAAa,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,iBAAkB,SAAQ,YAAY;aAKC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAJ9E,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAkB,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;WAIvE,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,iBAAiB;IA8BtE,eAAe;IAIf,cAAc;IAId,IAAI;IAIX;;OAEG;IACI,QAAQ,IAAI,iBAAiB;CAyBrC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/filterinvalid.js b/node_modules/vega-lite/build/src/compile/data/filterinvalid.js deleted file mode 100644 index ed10455..0000000 --- a/node_modules/vega-lite/build/src/compile/data/filterinvalid.js +++ /dev/null @@ -1,78 +0,0 @@ -import { isScaleChannel } from '../../channel'; -import { vgField as fieldRef } from '../../channeldef'; -import { isPathMark } from '../../mark'; -import { hasContinuousDomain } from '../../scale'; -import { hash, keys } from '../../util'; -import { getMarkPropOrConfig } from '../common'; -import { DataFlowNode } from './dataflow'; -export class FilterInvalidNode extends DataFlowNode { - constructor(parent, filter) { - super(parent); - this.filter = filter; - } - clone() { - return new FilterInvalidNode(null, Object.assign({}, this.filter)); - } - static make(parent, model) { - const { config, mark, markDef } = model; - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid !== 'filter') { - return null; - } - const filter = model.reduceFieldDef((aggregator, fieldDef, channel) => { - const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - // While discrete domain scales can handle invalid values, continuous scales can't. - // Thus, for non-path marks, we have to filter null for scales with continuous domains. - // (For path marks, we will use "defined" property and skip these values instead.) - if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { - aggregator[fieldDef.field] = fieldDef; // we know that the fieldDef is a typed field def - } - } - return aggregator; - }, {}); - if (!keys(filter).length) { - return null; - } - return new FilterInvalidNode(parent, filter); - } - dependentFields() { - return new Set(keys(this.filter)); - } - producedFields() { - return new Set(); // filter does not produce any new fields - } - hash() { - return `FilterInvalid ${hash(this.filter)}`; - } - /** - * Create the VgTransforms for each of the filtered fields. - */ - assemble() { - const filters = keys(this.filter).reduce((vegaFilters, field) => { - const fieldDef = this.filter[field]; - const ref = fieldRef(fieldDef, { expr: 'datum' }); - if (fieldDef !== null) { - if (fieldDef.type === 'temporal') { - vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`); - } - else if (fieldDef.type === 'quantitative') { - vegaFilters.push(`isValid(${ref})`); - vegaFilters.push(`isFinite(+${ref})`); - } - else { - // should never get here - } - } - return vegaFilters; - }, []); - return filters.length > 0 - ? { - type: 'filter', - expr: filters.join(' && ') - } - : null; - } -} -//# sourceMappingURL=filterinvalid.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/filterinvalid.js.map b/node_modules/vega-lite/build/src/compile/data/filterinvalid.js.map deleted file mode 100644 index 82c796e..0000000 --- a/node_modules/vega-lite/build/src/compile/data/filterinvalid.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterinvalid.js","sourceRoot":"","sources":["../../../../src/compile/data/filterinvalid.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAgB,OAAO,IAAI,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAO,IAAI,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAKjD,YAAY,MAAoB,EAAkB,MAAmC;QACnF,KAAK,CAAC,MAAM,CAAC,CAAC;QADkC,WAAM,GAAN,MAAM,CAA6B;IAErF,CAAC;IANM,KAAK;QACV,OAAO,IAAI,iBAAiB,CAAC,IAAI,oBAAM,IAAI,CAAC,MAAM,EAAE,CAAC;IACvD,CAAC;IAMM,MAAM,CAAC,IAAI,CAAC,MAAoB,EAAE,KAAgB;QACvD,MAAM,EAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAC,GAAG,K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OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;YAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;YAEhD,IAAI,QAAQ,KAAK,IAAI,EAAE;gBACrB,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU,EAAE;oBAChC,WAAW,CAAC,IAAI,CAAC,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,KAAK,CAAC,CAAC;iBAChF;qBAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,cAAc,EAAE;oBAC3C,WAAW,CAAC,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC;oBACpC,WAAW,CAAC,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,CAAC;iBACvC;qBAAM;oBACL,wBAAwB;iBACzB;aACF;YACD,OAAO,WAAW,CAAC;QACrB,CAAC,EAAE,EAAc,CAAC,CAAC;QAEnB,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;YACvB,CAAC,CAAC;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;aAC3B;YACH,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/flatten.d.ts b/node_modules/vega-lite/build/src/compile/data/flatten.d.ts deleted file mode 100644 index 621bcf5..0000000 --- a/node_modules/vega-lite/build/src/compile/data/flatten.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { FlattenTransform as VgFlattenTransform } from 'vega'; -import { FlattenTransform } from '../../transform'; -import { DataFlowNode } from './dataflow'; -/** - * A class for flatten transform nodes - */ -export declare class FlattenTransformNode extends DataFlowNode { - private transform; - clone(): FlattenTransformNode; - constructor(parent: DataFlowNode, transform: FlattenTransform); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgFlattenTransform; -} -//# sourceMappingURL=flatten.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/flatten.d.ts.map b/node_modules/vega-lite/build/src/compile/data/flatten.d.ts.map deleted file mode 100644 index 3f7aacf..0000000 --- a/node_modules/vega-lite/build/src/compile/data/flatten.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/flatten.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,IAAI,kBAAkB,EAAC,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;IAKlB,OAAO,CAAC,SAAS;IAJ5C,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,SAAS,EAAE,gBAAgB;IAO9D,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,kBAAkB;CAUtC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/flatten.js b/node_modules/vega-lite/build/src/compile/data/flatten.js deleted file mode 100644 index 99e6e1e..0000000 --- a/node_modules/vega-lite/build/src/compile/data/flatten.js +++ /dev/null @@ -1,36 +0,0 @@ -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for flatten transform nodes - */ -export class FlattenTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const { flatten, as = [] } = this.transform; - this.transform.as = flatten.map((f, i) => { var _a; return (_a = as[i]) !== null && _a !== void 0 ? _a : f; }); - } - clone() { - return new FlattenTransformNode(this.parent, duplicate(this.transform)); - } - dependentFields() { - return new Set(this.transform.flatten); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `FlattenTransform ${hash(this.transform)}`; - } - assemble() { - const { flatten: fields, as } = this.transform; - const result = { - type: 'flatten', - fields, - as - }; - return result; - } -} -//# sourceMappingURL=flatten.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/flatten.js.map b/node_modules/vega-lite/build/src/compile/data/flatten.js.map deleted file mode 100644 index d65cafb..0000000 --- a/node_modules/vega-lite/build/src/compile/data/flatten.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flatten.js","sourceRoot":"","sources":["../../../../src/compile/data/flatten.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAKpD,YAAY,MAAoB,EAAU,SAA2B;QACnE,KAAK,CAAC,MAAM,CAAC,CAAC;QAD0B,cAAS,GAAT,SAAS,CAAkB;QAEnE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,EAAC,OAAO,EAAE,EAAE,GAAG,EAAE,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1C,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,wBAAC,EAAE,CAAC,CAAC,CAAC,mCAAI,CAAC,GAAA,CAAC,CAAC;IACxD,CAAC;IATM,KAAK;QACV,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1E,CAAC;IASM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,oBAAoB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACpD,CAAC;IAEM,QAAQ;QACb,MAAM,EAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAE7C,MAAM,MAAM,GAAuB;YACjC,IAAI,EAAE,SAAS;YACf,MAAM;YACN,EAAE;SACH,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/fold.d.ts b/node_modules/vega-lite/build/src/compile/data/fold.d.ts deleted file mode 100644 index 0e70c40..0000000 --- a/node_modules/vega-lite/build/src/compile/data/fold.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { FoldTransform as VgFoldTransform } from 'vega'; -import { FoldTransform } from '../../transform'; -import { DataFlowNode } from './dataflow'; -/** - * A class for flatten transform nodes - */ -export declare class FoldTransformNode extends DataFlowNode { - private transform; - clone(): FoldTransformNode; - constructor(parent: DataFlowNode, transform: FoldTransform); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgFoldTransform; -} -//# sourceMappingURL=fold.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/fold.d.ts.map b/node_modules/vega-lite/build/src/compile/data/fold.d.ts.map deleted file mode 100644 index d374673..0000000 --- a/node_modules/vega-lite/build/src/compile/data/fold.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/fold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,IAAI,eAAe,EAAC,MAAM,MAAM,CAAC;AACtD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IAKf,OAAO,CAAC,SAAS;IAJ5C,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,SAAS,EAAE,aAAa;IAO3D,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,eAAe;CASnC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/fold.js b/node_modules/vega-lite/build/src/compile/data/fold.js deleted file mode 100644 index 4889cf5..0000000 --- a/node_modules/vega-lite/build/src/compile/data/fold.js +++ /dev/null @@ -1,37 +0,0 @@ -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for flatten transform nodes - */ -export class FoldTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'key', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'value']; - } - clone() { - return new FoldTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - return new Set(this.transform.fold); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `FoldTransform ${hash(this.transform)}`; - } - assemble() { - const { fold, as } = this.transform; - const result = { - type: 'fold', - fields: fold, - as - }; - return result; - } -} -//# sourceMappingURL=fold.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/fold.js.map b/node_modules/vega-lite/build/src/compile/data/fold.js.map deleted file mode 100644 index 27bc9f9..0000000 --- a/node_modules/vega-lite/build/src/compile/data/fold.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fold.js","sourceRoot":"","sources":["../../../../src/compile/data/fold.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,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/data/formatparse.d.ts b/node_modules/vega-lite/build/src/compile/data/formatparse.d.ts deleted file mode 100644 index 0c76f20..0000000 --- a/node_modules/vega-lite/build/src/compile/data/formatparse.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { FormulaTransform as VgFormulaTransform } from 'vega'; -import { AncestorParse } from '.'; -import { Parse } from '../../data'; -import { FilterTransform } from '../../transform'; -import { Model } from '../model'; -import { DataFlowNode } from './dataflow'; -export declare function getImplicitFromFilterTransform(transform: FilterTransform): Record; -/** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ -export declare function getImplicitFromEncoding(model: Model): Record; -/** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ -export declare function getImplicitFromSelection(model: Model): Record; -export declare class ParseNode extends DataFlowNode { - private _parse; - clone(): ParseNode; - constructor(parent: DataFlowNode, parse: Parse); - hash(): string; - /** - * Creates a parse node from a data.format.parse and updates ancestorParse. - */ - static makeExplicit(parent: DataFlowNode, model: Model, ancestorParse: AncestorParse): ParseNode; - /** - * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse. - */ - static makeWithAncestors(parent: DataFlowNode, explicit: Parse, implicit: Parse, ancestorParse: AncestorParse): ParseNode; - get parse(): Parse; - merge(other: ParseNode): void; - /** - * Assemble an object for Vega's format.parse property. - */ - assembleFormatParse(): Record; - producedFields(): Set; - dependentFields(): Set; - assembleTransforms(onlyNested?: boolean): VgFormulaTransform[]; -} -//# sourceMappingURL=formatparse.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/formatparse.d.ts.map b/node_modules/vega-lite/build/src/compile/data/formatparse.d.ts.map deleted file mode 100644 index ec9e1aa..0000000 --- a/node_modules/vega-lite/build/src/compile/data/formatparse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"formatparse.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/formatparse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,IAAI,kBAAkB,EAAY,MAAM,MAAM,CAAC;AAEvE,OAAO,EAAC,aAAa,EAAC,MAAM,GAAG,CAAC;AAUhC,OAAO,EAAc,KAAK,EAAC,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAA4B,KAAK,EAAC,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AA2CxC,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,eAAe,0BAkCxE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,0BA8DnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,0BAepD;AAED,qBAAa,SAAU,SAAQ,YAAY;IACzC,OAAO,CAAC,MAAM,CAAQ;IAEf,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK;IAMvC,IAAI;IAIX;;OAEG;WACW,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa;IAW3F;;OAEG;WACW,iBAAiB,CAC7B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,KAAK,EACf,QAAQ,EAAE,KAAK,EACf,aAAa,EAAE,aAAa;IAqD9B,IAAW,KAAK,UAEf;IAEM,KAAK,CAAC,KAAK,EAAE,SAAS;IAK7B;;OAEG;IACI,mBAAmB;IAYnB,cAAc;IAId,eAAe;IAIf,kBAAkB,CAAC,UAAU,UAAQ,GAAG,kBAAkB,EAAE;CAkBpE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/formatparse.js b/node_modules/vega-lite/build/src/compile/data/formatparse.js deleted file mode 100644 index 969a807..0000000 --- a/node_modules/vega-lite/build/src/compile/data/formatparse.js +++ /dev/null @@ -1,288 +0,0 @@ -import { isNumber, isString } from 'vega-util'; -import { isMinMaxOp } from '../../aggregate'; -import { getMainRangeChannel } from '../../channel'; -import { isFieldDef, isFieldOrDatumDefForTimeFormat, isScaleFieldDef, isTypedFieldDef } from '../../channeldef'; -import { isGenerator } from '../../data'; -import { isDateTime } from '../../datetime'; -import * as log from '../../log'; -import { forEachLeaf } from '../../logical'; -import { isPathMark } from '../../mark'; -import { isFieldEqualPredicate, isFieldOneOfPredicate, isFieldPredicate, isFieldRangePredicate } from '../../predicate'; -import { isSortField } from '../../sort'; -import { accessPathDepth, accessPathWithDatum, duplicate, hash, keys, removePathFromField } from '../../util'; -import { isFacetModel, isUnitModel } from '../model'; -import { Split } from '../split'; -import { DataFlowNode } from './dataflow'; -/** - * Remove quotes from a string. - */ -function unquote(pattern) { - if ((pattern[0] === "'" && pattern[pattern.length - 1] === "'") || - (pattern[0] === '"' && pattern[pattern.length - 1] === '"')) { - return pattern.slice(1, -1); - } - return pattern; -} -/** - * @param field The field. - * @param parse What to parse the field as. - */ -function parseExpression(field, parse) { - const f = accessPathWithDatum(field); - if (parse === 'number') { - return `toNumber(${f})`; - } - else if (parse === 'boolean') { - return `toBoolean(${f})`; - } - else if (parse === 'string') { - return `toString(${f})`; - } - else if (parse === 'date') { - return `toDate(${f})`; - } - else if (parse === 'flatten') { - return f; - } - else if (parse.indexOf('date:') === 0) { - const specifier = unquote(parse.slice(5, parse.length)); - return `timeParse(${f},'${specifier}')`; - } - else if (parse.indexOf('utc:') === 0) { - const specifier = unquote(parse.slice(4, parse.length)); - return `utcParse(${f},'${specifier}')`; - } - else { - log.warn(log.message.unrecognizedParse(parse)); - return null; - } -} -export function getImplicitFromFilterTransform(transform) { - const implicit = {}; - forEachLeaf(transform.filter, filter => { - var _a; - if (isFieldPredicate(filter)) { - // Automatically add a parse node for filters with filter objects - let val = null; - // For EqualFilter, just use the equal property. - // For RangeFilter and OneOfFilter, all array members should have - // the same type, so we only use the first one. - if (isFieldEqualPredicate(filter)) { - val = filter.equal; - } - else if (isFieldRangePredicate(filter)) { - val = filter.range[0]; - } - else if (isFieldOneOfPredicate(filter)) { - val = ((_a = filter.oneOf) !== null && _a !== void 0 ? _a : filter['in'])[0]; - } // else -- for filter expression, we can't infer anything - if (val) { - if (isDateTime(val)) { - implicit[filter.field] = 'date'; - } - else if (isNumber(val)) { - implicit[filter.field] = 'number'; - } - else if (isString(val)) { - implicit[filter.field] = 'string'; - } - } - if (filter.timeUnit) { - implicit[filter.field] = 'date'; - } - } - }); - return implicit; -} -/** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ -export function getImplicitFromEncoding(model) { - const implicit = {}; - function add(fieldDef) { - if (isFieldOrDatumDefForTimeFormat(fieldDef)) { - implicit[fieldDef.field] = 'date'; - } - else if (fieldDef.type === 'quantitative' && - isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max - ) { - implicit[fieldDef.field] = 'number'; - } - else if (accessPathDepth(fieldDef.field) > 1) { - // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field. - // (Parsing numbers / dates already flattens numeric and temporal fields.) - if (!(fieldDef.field in implicit)) { - implicit[fieldDef.field] = 'flatten'; - } - } - else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) { - // Flatten fields that we sort by but that are not otherwise flattened. - if (!(fieldDef.sort.field in implicit)) { - implicit[fieldDef.sort.field] = 'flatten'; - } - } - } - if (isUnitModel(model) || isFacetModel(model)) { - // Parse encoded fields - model.forEachFieldDef((fieldDef, channel) => { - if (isTypedFieldDef(fieldDef)) { - add(fieldDef); - } - else { - const mainChannel = getMainRangeChannel(channel); - const mainFieldDef = model.fieldDef(mainChannel); - add(Object.assign(Object.assign({}, fieldDef), { type: mainFieldDef.type })); - } - }); - } - // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly. - if (isUnitModel(model)) { - const { mark, markDef, encoding } = model; - if (isPathMark(mark) && - // No need to sort by dimension if we have a connected scatterplot (order channel is present) - !model.encoding.order) { - const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; - const dimensionChannelDef = encoding[dimensionChannel]; - if (isFieldDef(dimensionChannelDef) && - dimensionChannelDef.type === 'quantitative' && - !(dimensionChannelDef.field in implicit)) { - implicit[dimensionChannelDef.field] = 'number'; - } - } - } - return implicit; -} -/** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ -export function getImplicitFromSelection(model) { - const implicit = {}; - if (isUnitModel(model) && model.component.selection) { - for (const name of keys(model.component.selection)) { - const selCmpt = model.component.selection[name]; - for (const proj of selCmpt.project.items) { - if (!proj.channel && accessPathDepth(proj.field) > 1) { - implicit[proj.field] = 'flatten'; - } - } - } - } - return implicit; -} -export class ParseNode extends DataFlowNode { - constructor(parent, parse) { - super(parent); - this._parse = parse; - } - clone() { - return new ParseNode(null, duplicate(this._parse)); - } - hash() { - return `Parse ${hash(this._parse)}`; - } - /** - * Creates a parse node from a data.format.parse and updates ancestorParse. - */ - static makeExplicit(parent, model, ancestorParse) { - // Custom parse - let explicit = {}; - const data = model.data; - if (!isGenerator(data) && data && data.format && data.format.parse) { - explicit = data.format.parse; - } - return this.makeWithAncestors(parent, explicit, {}, ancestorParse); - } - /** - * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse. - */ - static makeWithAncestors(parent, explicit, implicit, ancestorParse) { - // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as "derived"). We also don't need to flatten a field that has already been parsed. - for (const field of keys(implicit)) { - const parsedAs = ancestorParse.getWithExplicit(field); - if (parsedAs.value !== undefined) { - // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types. - if (parsedAs.explicit || - parsedAs.value === implicit[field] || - parsedAs.value === 'derived' || - implicit[field] === 'flatten') { - delete implicit[field]; - } - else { - log.warn(log.message.differentParse(field, implicit[field], parsedAs.value)); - } - } - } - for (const field of keys(explicit)) { - const parsedAs = ancestorParse.get(field); - if (parsedAs !== undefined) { - // Don't parse a field again if it has been parsed with the same type already. - if (parsedAs === explicit[field]) { - delete explicit[field]; - } - else { - log.warn(log.message.differentParse(field, explicit[field], parsedAs)); - } - } - } - const parse = new Split(explicit, implicit); - // add the format parse from this model so that children don't parse the same field again - ancestorParse.copyAll(parse); - // copy only non-null parses - const p = {}; - for (const key of keys(parse.combine())) { - const val = parse.get(key); - if (val !== null) { - p[key] = val; - } - } - if (keys(p).length === 0 || ancestorParse.parseNothing) { - return null; - } - return new ParseNode(parent, p); - } - get parse() { - return this._parse; - } - merge(other) { - this._parse = Object.assign(Object.assign({}, this._parse), other.parse); - other.remove(); - } - /** - * Assemble an object for Vega's format.parse property. - */ - assembleFormatParse() { - const formatParse = {}; - for (const field of keys(this._parse)) { - const p = this._parse[field]; - if (accessPathDepth(field) === 1) { - formatParse[field] = p; - } - } - return formatParse; - } - // format parse depends and produces all fields in its parse - producedFields() { - return new Set(keys(this._parse)); - } - dependentFields() { - return new Set(keys(this._parse)); - } - assembleTransforms(onlyNested = false) { - return keys(this._parse) - .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true)) - .map(field => { - const expr = parseExpression(field, this._parse[field]); - if (!expr) { - return null; - } - const formula = { - type: 'formula', - expr, - as: removePathFromField(field) // Vega output is always flattened - }; - return formula; - }) - .filter(t => t !== null); - } -} -//# sourceMappingURL=formatparse.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/formatparse.js.map b/node_modules/vega-lite/build/src/compile/data/formatparse.js.map deleted file mode 100644 index 8f7b32e..0000000 --- a/node_modules/vega-lite/build/src/compile/data/formatparse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"formatparse.js","sourceRoot":"","sources":["../../../../src/compile/data/formatparse.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,mBAAmB,EAAmB,MAAM,eAAe,CAAC;AACpE,OAAO,EACL,UAAU,EACV,8BAA8B,EAC9B,eAAe,EACf,e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K,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACxD,IAAI,CAAC,IAAI,EAAE;gBACT,OAAO,IAAI,CAAC;aACb;YAED,MAAM,OAAO,GAAuB;gBAClC,IAAI,EAAE,SAAS;gBACf,IAAI;gBACJ,EAAE,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC,kCAAkC;aAClE,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/geojson.d.ts b/node_modules/vega-lite/build/src/compile/data/geojson.d.ts deleted file mode 100644 index 54b97b0..0000000 --- a/node_modules/vega-lite/build/src/compile/data/geojson.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { GeoJSONTransform as VgGeoJSONTransform, Vector2 } from 'vega'; -import { VgExprRef } from '../../vega.schema'; -import { UnitModel } from '../unit'; -import { DataFlowNode } from './dataflow'; -export declare class GeoJSONNode extends DataFlowNode { - private fields?; - private geojson?; - private signal?; - clone(): GeoJSONNode; - static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode; - constructor(parent: DataFlowNode, fields?: Vector2, geojson?: string, signal?: string); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgGeoJSONTransform; -} -//# sourceMappingURL=geojson.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/geojson.d.ts.map b/node_modules/vega-lite/build/src/compile/data/geojson.d.ts.map deleted file mode 100644 index 10f2692..0000000 --- a/node_modules/vega-lite/build/src/compile/data/geojson.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geojson.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/geojson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,IAAI,kBAAkB,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AAMrE,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,WAAY,SAAQ,YAAY;IA4CzC,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,OAAO,CAAC;IAChB,OAAO,CAAC,MAAM,CAAC;IA7CV,KAAK;WAIE,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY;gBAsC1E,MAAM,EAAE,YAAY,EACZ,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM;IAKlB,eAAe;IAKf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,kBAAkB;CAQtC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/geojson.js b/node_modules/vega-lite/build/src/compile/data/geojson.js deleted file mode 100644 index 89dadff..0000000 --- a/node_modules/vega-lite/build/src/compile/data/geojson.js +++ /dev/null @@ -1,63 +0,0 @@ -import { isString } from 'vega-util'; -import { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE } from '../../channel'; -import { getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef } from '../../channeldef'; -import { GEOJSON } from '../../type'; -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -export class GeoJSONNode extends DataFlowNode { - constructor(parent, fields, geojson, signal) { - super(parent); - this.fields = fields; - this.geojson = geojson; - this.signal = signal; - } - clone() { - return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal); - } - static parseAll(parent, model) { - if (model.component.projection && !model.component.projection.isFit) { - return parent; - } - let geoJsonCounter = 0; - for (const coordinates of [ - [LONGITUDE, LATITUDE], - [LONGITUDE2, LATITUDE2] - ]) { - const pair = coordinates.map(channel => { - const def = getFieldOrDatumDef(model.encoding[channel]); - return isFieldDef(def) - ? def.field - : isDatumDef(def) - ? { expr: `${def.datum}` } - : isValueDef(def) - ? { expr: `${def['value']}` } - : undefined; - }); - if (pair[0] || pair[1]) { - parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`)); - } - } - if (model.channelHasField(SHAPE)) { - const fieldDef = model.typedFieldDef(SHAPE); - if (fieldDef.type === GEOJSON) { - parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`)); - } - } - return parent; - } - dependentFields() { - var _a; - const fields = ((_a = this.fields) !== null && _a !== void 0 ? _a : []).filter(isString); - return new Set([...(this.geojson ? [this.geojson] : []), ...fields]); - } - producedFields() { - return new Set(); - } - hash() { - return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`; - } - assemble() { - return Object.assign(Object.assign(Object.assign({ type: 'geojson' }, (this.fields ? { fields: this.fields } : {})), (this.geojson ? { geojson: this.geojson } : {})), { signal: this.signal }); - } -} -//# sourceMappingURL=geojson.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/geojson.js.map b/node_modules/vega-lite/build/src/compile/data/geojson.js.map deleted file mode 100644 index 2fe2426..0000000 --- a/node_modules/vega-lite/build/src/compile/data/geojson.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geojson.js","sourceRoot":"","sources":["../../../../src/compile/data/geojson.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAqB,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AACpG,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,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AAC;IAEM,QAAQ;QACb,mDACE,IAAI,EAAE,SAAS,IACZ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAC1C,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAChD,MAAM,EAAE,IAAI,CAAC,MAAM,IACnB;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/geopoint.d.ts b/node_modules/vega-lite/build/src/compile/data/geopoint.d.ts deleted file mode 100644 index 02409c1..0000000 --- a/node_modules/vega-lite/build/src/compile/data/geopoint.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { GeoPointTransform as VgGeoPointTransform } from 'vega'; -import { VgExprRef } from '../../vega.schema'; -import { UnitModel } from '../unit'; -import { DataFlowNode } from './dataflow'; -export declare class GeoPointNode extends DataFlowNode { - private projection; - private fields; - private as; - clone(): GeoPointNode; - constructor(parent: DataFlowNode, projection: string, fields: [string | VgExprRef, string | VgExprRef], as: [string, string]); - static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode; - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgGeoPointTransform; -} -//# sourceMappingURL=geopoint.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/geopoint.d.ts.map b/node_modules/vega-lite/build/src/compile/data/geopoint.d.ts.map deleted file mode 100644 index 3ba3350..0000000 --- a/node_modules/vega-lite/build/src/compile/data/geopoint.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geopoint.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/geopoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,IAAI,mBAAmB,EAAU,MAAM,MAAM,CAAC;AAKvE,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,YAAa,SAAQ,YAAY;IAO1C,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,EAAE;IARL,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,EAChD,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;WAKhB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY;IAiCrE,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,mBAAmB;CAQvC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/geopoint.js b/node_modules/vega-lite/build/src/compile/data/geopoint.js deleted file mode 100644 index a04e649..0000000 --- a/node_modules/vega-lite/build/src/compile/data/geopoint.js +++ /dev/null @@ -1,62 +0,0 @@ -import { isString } from 'vega-util'; -import { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2 } from '../../channel'; -import { getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef } from '../../channeldef'; -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -export class GeoPointNode extends DataFlowNode { - constructor(parent, projection, fields, as) { - super(parent); - this.projection = projection; - this.fields = fields; - this.as = as; - } - clone() { - return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as)); - } - static parseAll(parent, model) { - if (!model.projectionName()) { - return parent; - } - for (const coordinates of [ - [LONGITUDE, LATITUDE], - [LONGITUDE2, LATITUDE2] - ]) { - const pair = coordinates.map(channel => { - const def = getFieldOrDatumDef(model.encoding[channel]); - return isFieldDef(def) - ? def.field - : isDatumDef(def) - ? { expr: `${def.datum}` } - : isValueDef(def) - ? { expr: `${def['value']}` } - : undefined; - }); - const suffix = coordinates[0] === LONGITUDE2 ? '2' : ''; - if (pair[0] || pair[1]) { - parent = new GeoPointNode(parent, model.projectionName(), pair, [ - model.getName('x' + suffix), - model.getName('y' + suffix) - ]); - } - } - return parent; - } - dependentFields() { - return new Set(this.fields.filter(isString)); - } - producedFields() { - return new Set(this.as); - } - hash() { - return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`; - } - assemble() { - return { - type: 'geopoint', - projection: this.projection, - fields: this.fields, - as: this.as - }; - } -} -//# sourceMappingURL=geopoint.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/geopoint.js.map b/node_modules/vega-lite/build/src/compile/data/geopoint.js.map deleted file mode 100644 index d39610f..0000000 --- a/node_modules/vega-lite/build/src/compile/data/geopoint.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geopoint.js","sourceRoot":"","sources":["../../../../src/compile/data/geopoint.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAqB,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAK5C,YACE,MAAoB,EACZ,UAAkB,EAClB,MAAgD,EAChD,EAAoB;QAE5B,KAAK,CAAC,MAAM,CAAC,CAAC;QAJN,eAAU,GAAV,UAAU,CAAQ;QAClB,WAAM,GAAN,MAAM,CAA0C;QAChD,OAAE,GAAF,EAAE,CAAkB;IAG9B,CAAC;IAXM,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KAAK,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC;oBAC3B,KAAK,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC;iBAC5B,CAAC,CAAC;aACJ;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAEM,IAAI;QACT,OAAO,YAAY,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IAC7E,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,EAAE,EAAE,IAAI,CAAC,EAAE;SACZ,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/graticule.d.ts b/node_modules/vega-lite/build/src/compile/data/graticule.d.ts deleted file mode 100644 index 148dfef..0000000 --- a/node_modules/vega-lite/build/src/compile/data/graticule.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { GraticuleTransform as VgGraticuleTransform } from 'vega'; -import { GraticuleParams } from '../../data'; -import { DataFlowNode } from './dataflow'; -export declare class GraticuleNode extends DataFlowNode { - private params; - clone(): GraticuleNode; - constructor(parent: DataFlowNode, params: true | GraticuleParams); - dependentFields(): Set; - producedFields(): undefined; - hash(): string; - assemble(): VgGraticuleTransform; -} -//# sourceMappingURL=graticule.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/graticule.d.ts.map b/node_modules/vega-lite/build/src/compile/data/graticule.d.ts.map deleted file mode 100644 index 7c6f3c5..0000000 --- a/node_modules/vega-lite/build/src/compile/data/graticule.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"graticule.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/graticule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,IAAI,oBAAoB,EAAC,MAAM,MAAM,CAAC;AAChE,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,aAAc,SAAQ,YAAY;IAKX,OAAO,CAAC,MAAM;IAJzC,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,MAAM,EAAE,IAAI,GAAG,eAAe;IAIjE,eAAe;IAIf,cAAc,IAAI,SAAS;IAI3B,IAAI;IAIJ,QAAQ,IAAI,oBAAoB;CAMxC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/graticule.js b/node_modules/vega-lite/build/src/compile/data/graticule.js deleted file mode 100644 index e16e319..0000000 --- a/node_modules/vega-lite/build/src/compile/data/graticule.js +++ /dev/null @@ -1,24 +0,0 @@ -import { hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -export class GraticuleNode extends DataFlowNode { - constructor(parent, params) { - super(parent); - this.params = params; - } - clone() { - return new GraticuleNode(null, this.params); - } - dependentFields() { - return new Set(); - } - producedFields() { - return undefined; // there should never be a node before graticule - } - hash() { - return `Graticule ${hash(this.params)}`; - } - assemble() { - return Object.assign({ type: 'graticule' }, (this.params === true ? {} : this.params)); - } -} -//# sourceMappingURL=graticule.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/graticule.js.map b/node_modules/vega-lite/build/src/compile/data/graticule.js.map deleted file mode 100644 index f58193b..0000000 --- a/node_modules/vega-lite/build/src/compile/data/graticule.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"graticule.js","sourceRoot":"","sources":["../../../../src/compile/data/graticule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,aAAc,SAAQ,YAAY;IAK7C,YAAY,MAAoB,EAAU,MAA8B;QACtE,KAAK,CAAC,MAAM,CAAC,CAAC;QAD0B,WAAM,GAAN,MAAM,CAAwB;IAExE,CAAC;IANM,KAAK;QACV,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAMM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;QACnB,OAAO,SAAS,CAAC,CAAC,gDAAgD;IACpE,CAAC;IAEM,IAAI;QACT,OAAO,aAAa,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1C,CAAC;IAEM,QAAQ;QACb,uBACE,IAAI,EAAE,WAAW,IACd,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAC5C;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/identifier.d.ts b/node_modules/vega-lite/build/src/compile/data/identifier.d.ts deleted file mode 100644 index 779357c..0000000 --- a/node_modules/vega-lite/build/src/compile/data/identifier.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { IdentifierTransform as VgIdentifierTransform } from 'vega'; -import { DataFlowNode } from './dataflow'; -export declare class IdentifierNode extends DataFlowNode { - clone(): IdentifierNode; - constructor(parent: DataFlowNode); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgIdentifierTransform; -} -//# sourceMappingURL=identifier.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/identifier.d.ts.map b/node_modules/vega-lite/build/src/compile/data/identifier.d.ts.map deleted file mode 100644 index 702f80d..0000000 --- a/node_modules/vega-lite/build/src/compile/data/identifier.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/identifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,IAAI,qBAAqB,EAAC,MAAM,MAAM,CAAC;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,cAAe,SAAQ,YAAY;IACvC,KAAK;gBAIA,MAAM,EAAE,YAAY;IAIzB,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,qBAAqB;CAGzC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/identifier.js b/node_modules/vega-lite/build/src/compile/data/identifier.js deleted file mode 100644 index 4eee644..0000000 --- a/node_modules/vega-lite/build/src/compile/data/identifier.js +++ /dev/null @@ -1,23 +0,0 @@ -import { SELECTION_ID } from '../../selection'; -import { DataFlowNode } from './dataflow'; -export class IdentifierNode extends DataFlowNode { - clone() { - return new IdentifierNode(null); - } - constructor(parent) { - super(parent); - } - dependentFields() { - return new Set(); - } - producedFields() { - return new Set([SELECTION_ID]); - } - hash() { - return 'Identifier'; - } - assemble() { - return { type: 'identifier', as: SELECTION_ID }; - } -} -//# sourceMappingURL=identifier.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/identifier.js.map b/node_modules/vega-lite/build/src/compile/data/identifier.js.map deleted file mode 100644 index 25df3a5..0000000 --- a/node_modules/vega-lite/build/src/compile/data/identifier.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../../../src/compile/data/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,cAAe,SAAQ,YAAY;IACvC,KAAK;QACV,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IACjC,CAAC;IAEM,IAAI;QACT,OAAO,YAAY,CAAC;IACtB,CAAC;IAEM,QAAQ;QACb,OAAO,EAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAC,CAAC;IAChD,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/impute.d.ts b/node_modules/vega-lite/build/src/compile/data/impute.d.ts deleted file mode 100644 index be131c7..0000000 --- a/node_modules/vega-lite/build/src/compile/data/impute.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { FormulaTransform as VgFormulaTransform, ImputeTransform as VgImputeTransform, WindowTransform as VgWindowTransform } from 'vega'; -import { ImputeTransform } from '../../transform'; -import { UnitModel } from '../unit'; -import { DataFlowNode } from './dataflow'; -export declare class ImputeNode extends DataFlowNode { - private readonly transform; - clone(): ImputeNode; - constructor(parent: DataFlowNode, transform: ImputeTransform); - dependentFields(): Set; - producedFields(): Set; - private processSequence; - static makeFromTransform(parent: DataFlowNode, imputeTransform: ImputeTransform): ImputeNode; - static makeFromEncoding(parent: DataFlowNode, model: UnitModel): ImputeNode; - hash(): string; - assemble(): (VgFormulaTransform | VgImputeTransform | VgWindowTransform)[]; -} -//# sourceMappingURL=impute.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/impute.d.ts.map b/node_modules/vega-lite/build/src/compile/data/impute.d.ts.map deleted file mode 100644 index 308f8a3..0000000 --- a/node_modules/vega-lite/build/src/compile/data/impute.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"impute.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/impute.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,IAAI,kBAAkB,EACtC,eAAe,IAAI,iBAAiB,EAEpC,eAAe,IAAI,iBAAiB,EACrC,MAAM,MAAM,CAAC;AAGd,OAAO,EAAiB,eAAe,EAAmB,MAAM,iBAAiB,CAAC;AAElF,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,UAAW,SAAQ,YAAY;IAKR,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJrD,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAmB,SAAS,EAAE,eAAe;IAItE,eAAe;IAIf,cAAc;IAIrB,OAAO,CAAC,eAAe;WAOT,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,GAAG,UAAU;WAIrF,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS;IA2B9D,IAAI;IAIJ,QAAQ;CAiChB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/impute.js b/node_modules/vega-lite/build/src/compile/data/impute.js deleted file mode 100644 index f27abac..0000000 --- a/node_modules/vega-lite/build/src/compile/data/impute.js +++ /dev/null @@ -1,65 +0,0 @@ -import { isFieldDef } from '../../channeldef'; -import { pathGroupingFields } from '../../encoding'; -import { isImputeSequence } from '../../transform'; -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -export class ImputeNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new ImputeNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.impute, this.transform.key, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set([this.transform.impute]); - } - processSequence(keyvals) { - const { start = 0, stop, step } = keyvals; - const result = [start, stop, ...(step ? [step] : [])].join(','); - return { signal: `sequence(${result})` }; - } - static makeFromTransform(parent, imputeTransform) { - return new ImputeNode(parent, imputeTransform); - } - static makeFromEncoding(parent, model) { - const encoding = model.encoding; - const xDef = encoding.x; - const yDef = encoding.y; - if (isFieldDef(xDef) && isFieldDef(yDef)) { - const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined; - if (imputedChannel === undefined) { - return undefined; - } - const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined; - const { method, value, frame, keyvals } = imputedChannel.impute; - const groupbyFields = pathGroupingFields(model.mark, encoding); - return new ImputeNode(parent, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ impute: imputedChannel.field, key: keyChannel.field }, (method ? { method } : {})), (value !== undefined ? { value } : {})), (frame ? { frame } : {})), (keyvals !== undefined ? { keyvals } : {})), (groupbyFields.length ? { groupby: groupbyFields } : {}))); - } - return null; - } - hash() { - return `Impute ${hash(this.transform)}`; - } - assemble() { - const { impute, key, keyvals, method, groupby, value, frame = [null, null] } = this.transform; - const imputeTransform = Object.assign(Object.assign(Object.assign(Object.assign({ type: 'impute', field: impute, key }, (keyvals ? { keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals } : {})), { method: 'value' }), (groupby ? { groupby } : {})), { value: !method || method === 'value' ? value : null }); - if (method && method !== 'value') { - const deriveNewField = Object.assign({ type: 'window', as: [`imputed_${impute}_value`], ops: [method], fields: [impute], frame, ignorePeers: false }, (groupby ? { groupby } : {})); - const replaceOriginal = { - type: 'formula', - expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`, - as: impute - }; - return [imputeTransform, deriveNewField, replaceOriginal]; - } - else { - return [imputeTransform]; - } - } -} -//# sourceMappingURL=impute.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/impute.js.map b/node_modules/vega-lite/build/src/compile/data/impute.js.map deleted file mode 100644 index 5ef31f6..0000000 --- a/node_modules/vega-lite/build/src/compile/data/impute.js.map +++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AI,MAAM,KAAK,OAAO,EAAE;YAChC,MAAM,cAAc,mBAClB,IAAI,EAAE,QAAQ,EACd,EAAE,EAAE,CAAC,WAAW,MAAM,QAAQ,CAAC,EAC/B,GAAG,EAAE,CAAC,MAAM,CAAC,EACb,MAAM,EAAE,CAAC,MAAM,CAAC,EAChB,KAAK,EACL,WAAW,EAAE,KAAK,IACf,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAC9B,CAAC;YACF,MAAM,eAAe,GAAuB;gBAC1C,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS,MAAM,6BAA6B,MAAM,kBAAkB,MAAM,EAAE;gBAClF,EAAE,EAAE,MAAM;aACX,CAAC;YACF,OAAO,CAAC,eAAe,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;SAC3D;aAAM;YACL,OAAO,CAAC,eAAe,CAAC,CAAC;SAC1B;IACH,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/index.d.ts b/node_modules/vega-lite/build/src/compile/data/index.d.ts deleted file mode 100644 index 35f95dd..0000000 --- a/node_modules/vega-lite/build/src/compile/data/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Parse } from '../../data'; -import { Dict } from '../../util'; -import { Split } from '../split'; -import { OutputNode } from './dataflow'; -import { FacetNode } from './facet'; -import { SourceNode } from './source'; -export interface DataComponent { - /** - * A list of unique sources. - */ - sources: SourceNode[]; - /** - * Registry of output nodes. - */ - outputNodes: Dict; - /** - * How often is an output node used. If it is not used, we don't need to - * instantiate it in the assemble step. - */ - outputNodeRefCounts: Dict; - /** - * The output node before aggregation. - */ - raw?: OutputNode; - /** - * The main output node. - */ - main?: OutputNode; - /** - * For facets, we store the reference to the root node. - */ - facetRoot?: FacetNode; - /** - * True if the data for this model is faceted. - * A dataset is faceted if a parent model is a facet and no new dataset is - * defined (which would make the data unfaceted again). - */ - isFaceted: boolean; - /** - * Parse properties passed down from ancestors. Helps us to keep track of what has been parsed or is derived. - */ - ancestorParse?: AncestorParse; -} -/** - * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf) - * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the - * same field again (or differently). - */ -export declare class AncestorParse extends Split { - readonly explicit: Partial; - readonly implicit: Partial; - parseNothing: boolean; - constructor(explicit?: Partial, implicit?: Partial, parseNothing?: boolean); - clone(): AncestorParse; -} -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/index.d.ts.map b/node_modules/vega-lite/build/src/compile/data/index.d.ts.map deleted file mode 100644 index 449f4f5..0000000 --- a/node_modules/vega-lite/build/src/compile/data/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,EAAE,UAAU,EAAE,CAAC;IAEtB;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAE1C;;;OAGG;IACH,mBAAmB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAElC;;OAEG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,KAAK,CAAC;aAE3B,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC;aACxB,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC;IACjC,YAAY;gBAFH,QAAQ,GAAE,OAAO,CAAC,KAAK,CAAM,EAC7B,QAAQ,GAAE,OAAO,CAAC,KAAK,CAAM,EACtC,YAAY,UAAQ;IAKtB,KAAK,IAAI,aAAa;CAK9B"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/index.js b/node_modules/vega-lite/build/src/compile/data/index.js deleted file mode 100644 index 136bb34..0000000 --- a/node_modules/vega-lite/build/src/compile/data/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Split } from '../split'; -/** - * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf) - * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the - * same field again (or differently). - */ -export class AncestorParse extends Split { - constructor(explicit = {}, implicit = {}, parseNothing = false) { - super(explicit, implicit); - this.explicit = explicit; - this.implicit = implicit; - this.parseNothing = parseNothing; - } - clone() { - const clone = super.clone(); - clone.parseNothing = this.parseNothing; - return clone; - } -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/index.js.map b/node_modules/vega-lite/build/src/compile/data/index.js.map deleted file mode 100644 index 477217a..0000000 --- a/node_modules/vega-lite/build/src/compile/data/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/compile/data/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAkD/B;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAY;IAC7C,YACkB,WAA2B,EAAE,EAC7B,WAA2B,EAAE,EACtC,eAAe,KAAK;QAE3B,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAJV,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,aAAQ,GAAR,QAAQ,CAAqB;QACtC,iBAAY,GAAZ,YAAY,CAAQ;IAG7B,CAAC;IAEM,KAAK;QACV,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAmB,CAAC;QAC7C,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/joinaggregate.d.ts b/node_modules/vega-lite/build/src/compile/data/joinaggregate.d.ts deleted file mode 100644 index f116dc8..0000000 --- a/node_modules/vega-lite/build/src/compile/data/joinaggregate.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { JoinAggregateTransform } from '../../transform'; -import { VgJoinAggregateTransform } from '../../vega.schema'; -import { DataFlowNode } from './dataflow'; -/** - * A class for the join aggregate transform nodes. - */ -export declare class JoinAggregateTransformNode extends DataFlowNode { - private readonly transform; - clone(): JoinAggregateTransformNode; - constructor(parent: DataFlowNode, transform: JoinAggregateTransform); - addDimensions(fields: string[]): void; - dependentFields(): Set; - producedFields(): Set; - private getDefaultName; - hash(): string; - assemble(): VgJoinAggregateTransform; -} -//# sourceMappingURL=joinaggregate.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/joinaggregate.d.ts.map b/node_modules/vega-lite/build/src/compile/data/joinaggregate.d.ts.map deleted file mode 100644 index 9609036..0000000 --- a/node_modules/vega-lite/build/src/compile/data/joinaggregate.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"joinaggregate.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/joinaggregate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAG3D,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,YAAY;IAKxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJrD,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAmB,SAAS,EAAE,sBAAsB;IAI7E,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE;IAI9B,eAAe;IAcf,cAAc;IAIrB,OAAO,CAAC,cAAc;IAIf,IAAI;IAIJ,QAAQ,IAAI,wBAAwB;CAoB5C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/joinaggregate.js b/node_modules/vega-lite/build/src/compile/data/joinaggregate.js deleted file mode 100644 index a3f1f3c..0000000 --- a/node_modules/vega-lite/build/src/compile/data/joinaggregate.js +++ /dev/null @@ -1,55 +0,0 @@ -import { vgField } from '../../channeldef'; -import { duplicate, hash } from '../../util'; -import { unique } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for the join aggregate transform nodes. - */ -export class JoinAggregateTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new JoinAggregateTransformNode(null, duplicate(this.transform)); - } - addDimensions(fields) { - this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); - } - dependentFields() { - const out = new Set(); - if (this.transform.groupby) { - this.transform.groupby.forEach(out.add, out); - } - this.transform.joinaggregate - .map(w => w.field) - .filter(f => f !== undefined) - .forEach(out.add, out); - return out; - } - producedFields() { - return new Set(this.transform.joinaggregate.map(this.getDefaultName)); - } - getDefaultName(joinAggregateFieldDef) { - var _a; - return (_a = joinAggregateFieldDef.as) !== null && _a !== void 0 ? _a : vgField(joinAggregateFieldDef); - } - hash() { - return `JoinAggregateTransform ${hash(this.transform)}`; - } - assemble() { - const fields = []; - const ops = []; - const as = []; - for (const joinaggregate of this.transform.joinaggregate) { - ops.push(joinaggregate.op); - as.push(this.getDefaultName(joinaggregate)); - fields.push(joinaggregate.field === undefined ? null : joinaggregate.field); - } - const groupby = this.transform.groupby; - return Object.assign({ type: 'joinaggregate', as, - ops, - fields }, (groupby !== undefined ? { groupby } : {})); - } -} -//# sourceMappingURL=joinaggregate.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/joinaggregate.js.map b/node_modules/vega-lite/build/src/compile/data/joinaggregate.js.map deleted file mode 100644 index b8b4d1d..0000000 --- a/node_modules/vega-lite/build/src/compile/data/joinaggregate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"joinaggregate.js","sourceRoot":"","sources":["../../../../src/compile/data/joinaggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,YAAY;IAK1D,YAAY,MAAoB,EAAmB,SAAiC;QAClF,KAAK,CAAC,MAAM,CAAC,CAAC;QADmC,cAAS,GAAT,SAAS,CAAwB;IAEpF,CAAC;IANM,KAAK;QACV,OAAO,IAAI,0BAA0B,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzE,CAAC;IAMM,aAAa,CAAC,MAAgB;QACnC,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IAEM,eAAe;QACpB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;QAE9B,IAAI,IAAI,CAAC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AAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAEvC,uBACE,IAAI,EAAE,eAAe,EACrB,EAAE;YACF,GAAG;YACH,MAAM,IACH,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC3C;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.d.ts b/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.d.ts deleted file mode 100644 index 43d63e1..0000000 --- a/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { FacetMapping } from '../../spec/facet'; -import { DataFlowNode } from './dataflow'; -import { JoinAggregateTransformNode } from './joinaggregate'; -export declare function makeJoinAggregateFromFacet(parent: DataFlowNode, facet: FacetMapping): JoinAggregateTransformNode; -//# sourceMappingURL=joinaggregatefacet.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.d.ts.map b/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.d.ts.map deleted file mode 100644 index 484073a..0000000 --- a/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"joinaggregatefacet.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/joinaggregatefacet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,0BAA0B,EAAC,MAAM,iBAAiB,CAAC;AAE3D,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,GAC1B,0BAA0B,CAuB5B"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.js b/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.js deleted file mode 100644 index 17795ee..0000000 --- a/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.js +++ /dev/null @@ -1,29 +0,0 @@ -import { vgField } from '../../channeldef'; -import { DEFAULT_SORT_OP, isSortField } from '../../sort'; -import { facetSortFieldName } from '../facet'; -import { JoinAggregateTransformNode } from './joinaggregate'; -export function makeJoinAggregateFromFacet(parent, facet) { - const { row, column } = facet; - if (row && column) { - let newParent = null; - // only need to make one for crossed facet - for (const fieldDef of [row, column]) { - if (isSortField(fieldDef.sort)) { - const { field, op = DEFAULT_SORT_OP } = fieldDef.sort; - parent = newParent = new JoinAggregateTransformNode(parent, { - joinaggregate: [ - { - op, - field, - as: facetSortFieldName(fieldDef, fieldDef.sort, { forAs: true }) - } - ], - groupby: [vgField(fieldDef)] - }); - } - } - return newParent; - } - return null; -} -//# sourceMappingURL=joinaggregatefacet.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.js.map b/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.js.map deleted file mode 100644 index dd0bb92..0000000 --- a/node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"joinaggregatefacet.js","sourceRoot":"","sources":["../../../../src/compile/data/joinaggregatefacet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAExD,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAC,0BAA0B,EAAC,MAAM,iBAAiB,CAAC;AAE3D,MAAM,UAAU,0BAA0B,CACxC,MAAoB,EACpB,KAA2B;IAE3B,MAAM,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAC5B,IAAI,GAAG,IAAI,MAAM,EAAE;QACjB,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,0CAA0C;QAC1C,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;YACpC,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBAC9B,MAAM,EAAC,KAAK,EAAE,EAAE,GAAG,eAAe,EAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;gBACpD,MAAM,GAAG,SAAS,GAAG,IAAI,0BAA0B,CAAC,MAAM,EAAE;oBAC1D,aAAa,EAAE;wBACb;4BACE,EAAE;4BACF,KAAK;4BACL,EAAE,EAAE,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC;yBAC/D;qBACF;oBACD,OAAO,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;iBAC7B,CAAC,CAAC;aACJ;SACF;QACD,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/loess.d.ts b/node_modules/vega-lite/build/src/compile/data/loess.d.ts deleted file mode 100644 index a19771d..0000000 --- a/node_modules/vega-lite/build/src/compile/data/loess.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { LoessTransform as VgLoessTransform } from 'vega'; -import { LoessTransform } from '../../transform'; -import { DataFlowNode } from './dataflow'; -/** - * A class for loess transform nodes - */ -export declare class LoessTransformNode extends DataFlowNode { - private transform; - clone(): LoessTransformNode; - constructor(parent: DataFlowNode, transform: LoessTransform); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgLoessTransform; -} -//# sourceMappingURL=loess.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/loess.d.ts.map b/node_modules/vega-lite/build/src/compile/data/loess.d.ts.map deleted file mode 100644 index e07c50f..0000000 --- a/node_modules/vega-lite/build/src/compile/data/loess.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"loess.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/loess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,IAAI,gBAAgB,EAAC,MAAM,MAAM,CAAC;AACxD,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAKhB,OAAO,CAAC,SAAS;IAJ5C,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,SAAS,EAAE,cAAc;IAO5D,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,gBAAgB;CAUpC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/loess.js b/node_modules/vega-lite/build/src/compile/data/loess.js deleted file mode 100644 index 1e52d3e..0000000 --- a/node_modules/vega-lite/build/src/compile/data/loess.js +++ /dev/null @@ -1,35 +0,0 @@ -import { __rest } from "tslib"; -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for loess transform nodes - */ -export class LoessTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : transform.on, (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : transform.loess]; - } - clone() { - return new LoessTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.loess, this.transform.on, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `LoessTransform ${hash(this.transform)}`; - } - assemble() { - const _a = this.transform, { loess, on } = _a, rest = __rest(_a, ["loess", "on"]); - const result = Object.assign({ type: 'loess', x: on, y: loess }, rest); - return result; - } -} -//# sourceMappingURL=loess.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/loess.js.map b/node_modules/vega-lite/build/src/compile/data/loess.js.map deleted file mode 100644 index 76b40af..0000000 --- a/node_modules/vega-lite/build/src/compile/data/loess.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"loess.js","sourceRoot":"","sources":["../../../../src/compile/data/loess.ts"],"names":[],"mappings":";AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAKlD,YAAY,MAAoB,EAAU,SAAyB;;QACjE,KAAK,CAAC,MAAM,CAAC,CAAC;QAD0B,cAAS,GAAT,SAAS,CAAgB;QAEjE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,WAAW,SAAG,IAAI,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,OAAC,WAAW,CAAC,CAAC,CAAC,mCAAI,SAAS,CAAC,EAAE,QAAE,WAAW,CAAC,CAAC,CAAC,mCAAI,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1F,CAAC;IATM,KAAK;QACV,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACjE,CAAC;IASM,eAAe;;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,OAAC,IAAI,CAAC,SAAS,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/F,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,kBAAkB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IAClD,CAAC;IAEM,QAAQ;QACb,MAAM,KAAuB,IAAI,CAAC,SAAS,EAArC,EAAC,KAAK,EAAE,EAAE,OAA2B,EAAtB,IAAI,cAAnB,eAAoB,CAAiB,CAAC;QAC5C,MAAM,MAAM,mBACV,IAAI,EAAE,OAAO,EACb,CAAC,EAAE,EAAE,EACL,CAAC,EAAE,KAAK,IACL,IAAI,CACR,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/lookup.d.ts b/node_modules/vega-lite/build/src/compile/data/lookup.d.ts deleted file mode 100644 index 28fadd3..0000000 --- a/node_modules/vega-lite/build/src/compile/data/lookup.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { LookupTransform as VgLookupTransform } from 'vega'; -import { LookupTransform } from '../../transform'; -import { Model } from '../model'; -import { DataFlowNode } from './dataflow'; -export declare class LookupNode extends DataFlowNode { - readonly transform: LookupTransform; - readonly secondary: string; - clone(): LookupNode; - constructor(parent: DataFlowNode, transform: LookupTransform, secondary: string); - static make(parent: DataFlowNode, model: Model, transform: LookupTransform, counter: number): LookupNode; - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgLookupTransform; -} -//# sourceMappingURL=lookup.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/lookup.d.ts.map b/node_modules/vega-lite/build/src/compile/data/lookup.d.ts.map deleted file mode 100644 index 10dbfbb..0000000 --- a/node_modules/vega-lite/build/src/compile/data/lookup.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/lookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAG1D,OAAO,EAAkC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEjF,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,YAAY,EAAa,MAAM,YAAY,CAAC;AAKpD,qBAAa,UAAW,SAAQ,YAAY;aAKQ,SAAS,EAAE,eAAe;aAAkB,SAAS,EAAE,MAAM;IAJxG,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAkB,SAAS,EAAE,eAAe,EAAkB,SAAS,EAAE,MAAM;WAIjG,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;IAiC3F,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,iBAAiB;CA+BrC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/lookup.js b/node_modules/vega-lite/build/src/compile/data/lookup.js deleted file mode 100644 index 1e44e71..0000000 --- a/node_modules/vega-lite/build/src/compile/data/lookup.js +++ /dev/null @@ -1,71 +0,0 @@ -import { array, isString } from 'vega-util'; -import * as log from '../../log'; -import { isLookupData, isLookupSelection } from '../../transform'; -import { duplicate, hash, varName } from '../../util'; -import { DataFlowNode, OutputNode } from './dataflow'; -import { findSource } from './parse'; -import { SourceNode } from './source'; -import { DataSourceType } from '../../data'; -export class LookupNode extends DataFlowNode { - constructor(parent, transform, secondary) { - super(parent); - this.transform = transform; - this.secondary = secondary; - } - clone() { - return new LookupNode(null, duplicate(this.transform), this.secondary); - } - static make(parent, model, transform, counter) { - const sources = model.component.data.sources; - const { from } = transform; - let fromOutputNode = null; - if (isLookupData(from)) { - let fromSource = findSource(from.data, sources); - if (!fromSource) { - fromSource = new SourceNode(from.data); - sources.push(fromSource); - } - const fromOutputName = model.getName(`lookup_${counter}`); - fromOutputNode = new OutputNode(fromSource, fromOutputName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); - model.component.data.outputNodes[fromOutputName] = fromOutputNode; - } - else if (isLookupSelection(from)) { - const selName = from.selection; - transform = Object.assign({ as: selName }, transform); - fromOutputNode = model.getSelectionComponent(varName(selName), selName).materialized; - if (!fromOutputNode) { - throw new Error(log.message.noSameUnitLookup(selName)); - } - } - return new LookupNode(parent, transform, fromOutputNode.getSource()); - } - dependentFields() { - return new Set([this.transform.lookup]); - } - producedFields() { - return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields); - } - hash() { - return `Lookup ${hash({ transform: this.transform, secondary: this.secondary })}`; - } - assemble() { - let foreign; - if (this.transform.from.fields) { - // lookup a few fields and add create a flat output - foreign = Object.assign({ values: this.transform.from.fields }, (this.transform.as ? { as: array(this.transform.as) } : {})); - } - else { - // lookup full record and nest it - let asName = this.transform.as; - if (!isString(asName)) { - log.warn(log.message.NO_FIELDS_NEEDS_AS); - asName = '_lookup'; - } - foreign = { - as: [asName] - }; - } - return Object.assign(Object.assign({ type: 'lookup', from: this.secondary, key: this.transform.from.key, fields: [this.transform.lookup] }, foreign), (this.transform.default ? { default: this.transform.default } : {})); - } -} -//# sourceMappingURL=lookup.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/lookup.js.map b/node_modules/vega-lite/build/src/compile/data/lookup.js.map deleted file mode 100644 index 0927dd6..0000000 --- a/node_modules/vega-lite/build/src/compile/data/lookup.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../../src/compile/data/lookup.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAkB,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAC,SAAS,EAAE,IAAI,EAA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E;YAC9B,mDAAmD;YACnD,OAAO,mBACL,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,IAC/B,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAC7D,CAAC;SACH;aAAM;YACL,iCAAiC;YACjC,IAAI,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;gBACrB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;gBACzC,MAAM,GAAG,SAAS,CAAC;aACpB;YAED,OAAO,GAAG;gBACR,EAAE,EAAE,CAAC,MAAM,CAAC;aACb,CAAC;SACH;QAED,qCACE,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAC5B,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAC5B,OAAO,GACP,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EACpE;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimize.d.ts b/node_modules/vega-lite/build/src/compile/data/optimize.d.ts deleted file mode 100644 index 50d86e6..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimize.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { DataComponent } from '.'; -import { Model } from '../model'; -import { DataFlowNode } from './dataflow'; -export declare const FACET_SCALE_PREFIX = "scale_"; -export declare const MAX_OPTIMIZATION_RUNS = 5; -/** - * Iterates over a dataflow graph and checks whether all links are consistent. - */ -export declare function checkLinks(nodes: readonly DataFlowNode[]): boolean; -export declare function isTrue(x: boolean): boolean; -/** - * Optimizes the dataflow of the passed in data component. - */ -export declare function optimizeDataflow(data: DataComponent, model: Model): void; -//# sourceMappingURL=optimize.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimize.d.ts.map b/node_modules/vega-lite/build/src/compile/data/optimize.d.ts.map deleted file mode 100644 index 587f0e4..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimize.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"optimize.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/optimize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,GAAG,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAIxC,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAelE;AAuBD,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,WAEhC;AAsDD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,QA8BjE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimize.js b/node_modules/vega-lite/build/src/compile/data/optimize.js deleted file mode 100644 index 0fabe97..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimize.js +++ /dev/null @@ -1,118 +0,0 @@ -import * as log from '../../log'; -import { BottomUpOptimizer } from './optimizer'; -import * as optimizers from './optimizers'; -export const FACET_SCALE_PREFIX = 'scale_'; -export const MAX_OPTIMIZATION_RUNS = 5; -/** - * Iterates over a dataflow graph and checks whether all links are consistent. - */ -export function checkLinks(nodes) { - for (const node of nodes) { - for (const child of node.children) { - if (child.parent !== node) { - // log.error('Dataflow graph is inconsistent.', node, child); - return false; - } - } - if (!checkLinks(node.children)) { - return false; - } - } - return true; -} -/** - * Return all leaf nodes. - */ -function getLeaves(roots) { - const leaves = []; - function append(node) { - if (node.numChildren() === 0) { - leaves.push(node); - } - else { - for (const child of node.children) { - append(child); - } - } - } - for (const child of roots) { - append(child); - } - return leaves; -} -export function isTrue(x) { - return x; -} -/** - * Run the specified optimizer on the provided nodes. - * - * @param optimizer The optimizer instance to run. - * @param nodes A set of nodes to optimize. - * @param flag Flag that will be or'ed with return valued from optimization calls to the nodes. - */ -function runOptimizer(optimizer, nodes) { - const flags = nodes.map(node => { - if (optimizer instanceof BottomUpOptimizer) { - const runFlags = optimizer.optimizeNextFromLeaves(node); - optimizer.reset(); - return runFlags; - } - else { - return optimizer.run(node); - } - }); - return flags.some(isTrue); -} -function optimizationDataflowHelper(dataComponent, model, firstPass) { - let roots = dataComponent.sources; - const mutatedFlags = new Set(); - mutatedFlags.add(runOptimizer(new optimizers.RemoveUnnecessaryOutputNodes(), roots)); - mutatedFlags.add(runOptimizer(new optimizers.RemoveUnnecessaryIdentifierNodes(model), roots)); - // remove source nodes that don't have any children because they also don't have output nodes - roots = roots.filter(r => r.numChildren() > 0); - mutatedFlags.add(runOptimizer(new optimizers.RemoveUnusedSubtrees(), getLeaves(roots))); - roots = roots.filter(r => r.numChildren() > 0); - if (!firstPass) { - // Only run these optimizations after the optimizer has moved down the facet node. - // With this change, we can be more aggressive in the optimizations. - mutatedFlags.add(runOptimizer(new optimizers.MoveParseUp(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeBins(model), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.RemoveDuplicateTimeUnits(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeParse(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeAggregates(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeTimeUnits(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeIdenticalNodes(), roots)); - mutatedFlags.add(runOptimizer(new optimizers.MergeOutputs(), getLeaves(roots))); - } - dataComponent.sources = roots; - return mutatedFlags.has(true); -} -/** - * Optimizes the dataflow of the passed in data component. - */ -export function optimizeDataflow(data, model) { - // check before optimizations - checkLinks(data.sources); - let firstPassCounter = 0; - let secondPassCounter = 0; - for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { - if (!optimizationDataflowHelper(data, model, true)) { - break; - } - firstPassCounter++; - } - // move facets down and make a copy of the subtree so that we can have scales at the top level - data.sources.map(optimizers.moveFacetDown); - for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { - if (!optimizationDataflowHelper(data, model, false)) { - break; - } - secondPassCounter++; - } - // check after optimizations - checkLinks(data.sources); - if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) { - log.warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`); - } -} -//# sourceMappingURL=optimize.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimize.js.map b/node_modules/vega-lite/build/src/compile/data/optimize.js.map deleted file mode 100644 index bdc6a5f..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimize.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"optimize.js","sourceRoot":"","sources":["../../../../src/compile/data/optimize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAC,iBAAiB,EAAmB,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAC3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;G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AAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,qBAAqB,EAAE,CAAC,EAAE,EAAE;QAC9C,IAAI,CAAC,0BAA0B,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE;YACnD,MAAM;SACP;QACD,iBAAiB,EAAE,CAAC;KACrB;IAED,4BAA4B;IAC5B,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEzB,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,KAAK,qBAAqB,EAAE;QAC3E,GAAG,CAAC,IAAI,CAAC,6BAA6B,qBAAqB,YAAY,CAAC,CAAC;KAC1E;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimizer.d.ts b/node_modules/vega-lite/build/src/compile/data/optimizer.d.ts deleted file mode 100644 index 020977f..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimizer.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { DataFlowNode } from './dataflow'; -import { OptimizerFlags } from './optimizers'; -/** - * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator. - */ -export declare function isDataSourceNode(node: DataFlowNode): boolean; -/** - * Abstract base class for BottomUpOptimizer and TopDownOptimizer. - * Contains only mutation handling logic. Subclasses need to implement iteration logic. - */ -declare abstract class OptimizerBase { - private _mutated; - constructor(); - setMutated(): void; - get mutatedFlag(): boolean; -} -/** - * Starts from a node and runs the optimization function(the "run" method) upwards to the root, - * depending on the continueFlag and mutatedFlag values returned by the optimization function. - */ -export declare abstract class BottomUpOptimizer extends OptimizerBase { - private _continue; - constructor(); - setContinue(): void; - get continueFlag(): boolean; - get flags(): OptimizerFlags; - set flags({ continueFlag, mutatedFlag }: OptimizerFlags); - abstract run(node: DataFlowNode): OptimizerFlags; - /** - * Reset the state of the optimizer after it has completed a run from the bottom of the tree to the top. - */ - reset(): void; - optimizeNextFromLeaves(node: DataFlowNode): boolean; -} -/** - * The optimizer function( the "run" method), is invoked on the given node and then continues recursively. - */ -export declare abstract class TopDownOptimizer extends OptimizerBase { - abstract run(node: DataFlowNode): boolean; -} -export {}; -//# sourceMappingURL=optimizer.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimizer.d.ts.map b/node_modules/vega-lite/build/src/compile/data/optimizer.d.ts.map deleted file mode 100644 index 35af531..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimizer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"optimizer.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/optimizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAK5C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,WAElD;AAED;;;GAGG;AACH,uBAAe,aAAa;IAC1B,OAAO,CAAC,QAAQ,CAAU;;IAKnB,UAAU;IAIjB,IAAI,WAAW,YAEd;CACF;AAED;;;GAGG;AACH,8BAAsB,iBAAkB,SAAQ,aAAa;IAC3D,OAAO,CAAC,SAAS,CAAU;;IAOpB,WAAW;IAIlB,IAAI,YAAY,YAEf;IAED,IAAI,KAAK,IAAI,cAAc,CAE1B;IAED,IAAI,KAAK,CAAC,EAAC,YAAY,EAAE,WAAW,EAAC,EAAE,cAAc,EAOpD;aAEe,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc;IAEvD;;OAEG;IACI,KAAK,IAAI,IAAI;IAIb,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;CAW3D;AAED;;GAEG;AACH,8BAAsB,gBAAiB,SAAQ,aAAa;aAC1C,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;CACjD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimizer.js b/node_modules/vega-lite/build/src/compile/data/optimizer.js deleted file mode 100644 index ea80f48..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimizer.js +++ /dev/null @@ -1,75 +0,0 @@ -import { SourceNode } from './source'; -import { GraticuleNode } from './graticule'; -import { SequenceNode } from './sequence'; -/** - * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator. - */ -export function isDataSourceNode(node) { - return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode; -} -/** - * Abstract base class for BottomUpOptimizer and TopDownOptimizer. - * Contains only mutation handling logic. Subclasses need to implement iteration logic. - */ -class OptimizerBase { - constructor() { - this._mutated = false; - } - // Once true, _mutated is never set to false - setMutated() { - this._mutated = true; - } - get mutatedFlag() { - return this._mutated; - } -} -/** - * Starts from a node and runs the optimization function(the "run" method) upwards to the root, - * depending on the continueFlag and mutatedFlag values returned by the optimization function. - */ -export class BottomUpOptimizer extends OptimizerBase { - constructor() { - super(); - this._continue = false; - } - setContinue() { - this._continue = true; - } - get continueFlag() { - return this._continue; - } - get flags() { - return { continueFlag: this.continueFlag, mutatedFlag: this.mutatedFlag }; - } - set flags({ continueFlag, mutatedFlag }) { - if (continueFlag) { - this.setContinue(); - } - if (mutatedFlag) { - this.setMutated(); - } - } - /** - * Reset the state of the optimizer after it has completed a run from the bottom of the tree to the top. - */ - reset() { - // do nothing - } - optimizeNextFromLeaves(node) { - if (isDataSourceNode(node)) { - return false; - } - const next = node.parent; - const { continueFlag } = this.run(node); - if (continueFlag) { - this.optimizeNextFromLeaves(next); - } - return this.mutatedFlag; - } -} -/** - * The optimizer function( the "run" method), is invoked on the given node and then continues recursively. - */ -export class TopDownOptimizer extends OptimizerBase { -} -//# sourceMappingURL=optimizer.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimizer.js.map b/node_modules/vega-lite/build/src/compile/data/optimizer.js.map deleted file mode 100644 index 4c55940..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimizer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"optimizer.js","sourceRoot":"","sources":["../../../../src/compile/data/optimizer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAkB;IACjD,OAAO,IAAI,YAAY,UAAU,IAAI,IAAI,YAAY,aAAa,IAAI,IAAI,YAAY,YAAY,CAAC;AACrG,CAAC;AAED;;;GAGG;AACH,MAAe,aAAa;IAE1B;QACE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IACD,4CAA4C;IACrC,UAAU;QACf,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,aAAa;IAG3D;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,EAAC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAC,CAAC;IAC1E,CAAC;IAED,IAAI,KAAK,CAAC,EAAC,YAAY,EAAE,WAAW,EAAiB;QACnD,IAAI,YAAY,EAAE;YAChB,IAAI,CAAC,WAAW,EAAE,CAAC;SACpB;QACD,IAAI,WAAW,EAAE;YACf,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;IACH,CAAC;IAID;;OAEG;IACI,KAAK;QACV,aAAa;IACf,CAAC;IAEM,sBAAsB,CAAC,IAAkB;QAC9C,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE;YAC1B,OAAO,KAAK,CAAC;SACd;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,MAAM,EAAC,YAAY,EAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,YAAY,EAAE;YAChB,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;SACnC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,aAAa;CAE3D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimizers.d.ts b/node_modules/vega-lite/build/src/compile/data/optimizers.d.ts deleted file mode 100644 index a00803e..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimizers.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { Model } from '../model'; -import { DataFlowNode } from './dataflow'; -import { BottomUpOptimizer, TopDownOptimizer } from './optimizer'; -import * as optimizers from './optimizers'; -export interface OptimizerFlags { - /** - * If true, iteration continues. - */ - continueFlag: boolean; - /** - * If true, the tree has been mutated by the function. - */ - mutatedFlag: boolean; -} -/** - * Move parse nodes up to forks. - */ -export declare class MoveParseUp extends BottomUpOptimizer { - run(node: DataFlowNode): OptimizerFlags; -} -/** - * Merge identical nodes at forks by comparing hashes. - * - * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler. - */ -export declare class MergeIdenticalNodes extends TopDownOptimizer { - mergeNodes(parent: DataFlowNode, nodes: DataFlowNode[]): void; - run(node: DataFlowNode): boolean; -} -/** - * Repeatedly remove leaf nodes that are not output or facet nodes. - * The reason is that we don't need subtrees that don't have any output nodes. - * Facet nodes are needed for the row or column domains. - */ -export declare class RemoveUnusedSubtrees extends BottomUpOptimizer { - run(node: DataFlowNode): OptimizerFlags; -} -/** - * Removes duplicate time unit nodes (as determined by the name of the - * output field) that may be generated due to selections projected over - * time units. - * - * TODO: Try to make this a top down optimizer that keeps only the first - * insance of a time unit node. - * TODO: Try to make a generic version of this that only keeps one node per hash. - */ -export declare class RemoveDuplicateTimeUnits extends BottomUpOptimizer { - private fields; - private prev; - run(node: DataFlowNode): OptimizerFlags; - reset(): void; -} -/** - * Merge adjacent time unit nodes. - */ -export declare class MergeTimeUnits extends BottomUpOptimizer { - run(node: DataFlowNode): OptimizerFlags; -} -/** - * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node. - * After moving down the facet node, make a copy of the subtree and make it a child of the main output. - */ -export declare function moveFacetDown(node: DataFlowNode): void; -/** - * Remove output nodes that are not required. Starting from a root. - */ -export declare class RemoveUnnecessaryOutputNodes extends TopDownOptimizer { - constructor(); - run(node: DataFlowNode): boolean; -} -export declare class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer { - private requiresSelectionId; - constructor(model: Model); - run(node: DataFlowNode): boolean; -} -/** - * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes. - * - * We assume that dependent paths that do not have a parse node can be just merged. - */ -export declare class MergeParse extends BottomUpOptimizer { - run(node: DataFlowNode): optimizers.OptimizerFlags; -} -export declare class MergeAggregates extends BottomUpOptimizer { - run(node: DataFlowNode): optimizers.OptimizerFlags; -} -/** - * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node. - */ -export declare class MergeBins extends BottomUpOptimizer { - private model; - constructor(model: Model); - run(node: DataFlowNode): OptimizerFlags; -} -/** - * This optimizer takes output nodes that are at a fork and moves them before the fork. - * - * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes. - * It then moves all output nodes before that main output node. All other children (and the children of the output nodes) - * are inserted after the main output node. - */ -export declare class MergeOutputs extends BottomUpOptimizer { - run(node: DataFlowNode): optimizers.OptimizerFlags; -} -//# sourceMappingURL=optimizers.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimizers.d.ts.map b/node_modules/vega-lite/build/src/compile/data/optimizers.d.ts.map deleted file mode 100644 index 064b4fb..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimizers.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"optimizers.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/optimizers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAI/B,OAAO,EAAC,YAAY,EAAa,MAAM,YAAY,CAAC;AAOpD,OAAO,EAAC,iBAAiB,EAAoB,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAClF,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAK3C,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB;IACzC,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc;CA8B/C;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,gBAAgB;IAChD,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;IAStD,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;CAuBxC;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IAClD,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc;CAU/C;AAED;;;;;;;;GAQG;AACH,qBAAa,wBAAyB,SAAQ,iBAAiB;IAC7D,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,IAAI,CAAsB;IAC3B,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc;IAevC,KAAK,IAAI,IAAI;CAGrB;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,iBAAiB;IAC5C,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc;CAW/C;AAmCD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,QAiC/C;AAcD;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,gBAAgB;;IAKzD,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;CAYxC;AAED,qBAAa,gCAAiC,SAAQ,gBAAgB;IACpE,OAAO,CAAC,mBAAmB,CAAU;gBACzB,KAAK,EAAE,KAAK;IAKjB,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;CAqBxC;AAED;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;IACxC,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,CAAC,cAAc;CA+C1D;AAED,qBAAa,eAAgB,SAAQ,iBAAiB;IAC7C,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,CAAC,cAAc;CAsC1D;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,iBAAiB;IAClC,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,KAAK;IAGzB,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc;CA4C/C;AAED;;;;;;GAMG;AACH,qBAAa,YAAa,SAAQ,iBAAiB;IAC1C,GAAG,CAAC,IAAI,EAAE,YAAY;CA+D9B"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimizers.js b/node_modules/vega-lite/build/src/compile/data/optimizers.js deleted file mode 100644 index c40da98..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimizers.js +++ /dev/null @@ -1,464 +0,0 @@ -import { DataSourceType } from '../../data'; -import { fieldIntersection, hash, hasIntersection, isEmpty, keys, some } from '../../util'; -import { requiresSelectionId } from '../selection'; -import { AggregateNode } from './aggregate'; -import { BinNode } from './bin'; -import { OutputNode } from './dataflow'; -import { FacetNode } from './facet'; -import { FilterNode } from './filter'; -import { ParseNode } from './formatparse'; -import { IdentifierNode } from './identifier'; -import { JoinAggregateTransformNode } from './joinaggregate'; -import { FACET_SCALE_PREFIX } from './optimize'; -import { BottomUpOptimizer, isDataSourceNode, TopDownOptimizer } from './optimizer'; -import { StackNode } from './stack'; -import { TimeUnitNode } from './timeunit'; -import { WindowTransformNode } from './window'; -/** - * Move parse nodes up to forks. - */ -export class MoveParseUp extends BottomUpOptimizer { - run(node) { - const parent = node.parent; - // Move parse up by merging or swapping. - if (node instanceof ParseNode) { - if (isDataSourceNode(parent)) { - return this.flags; - } - if (parent.numChildren() > 1) { - // Don't move parse further up but continue with parent. - this.setContinue(); - return this.flags; - } - if (parent instanceof ParseNode) { - this.setMutated(); - parent.merge(node); - } - else { - // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup). - if (fieldIntersection(parent.producedFields(), node.dependentFields())) { - this.setContinue(); - return this.flags; - } - this.setMutated(); - node.swapWithParent(); - } - } - this.setContinue(); - return this.flags; - } -} -/** - * Merge identical nodes at forks by comparing hashes. - * - * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler. - */ -export class MergeIdenticalNodes extends TopDownOptimizer { - mergeNodes(parent, nodes) { - const mergedNode = nodes.shift(); - for (const node of nodes) { - parent.removeChild(node); - node.parent = mergedNode; - node.remove(); - } - } - run(node) { - const hashes = node.children.map(x => x.hash()); - const buckets = {}; - for (let i = 0; i < hashes.length; i++) { - if (buckets[hashes[i]] === undefined) { - buckets[hashes[i]] = [node.children[i]]; - } - else { - buckets[hashes[i]].push(node.children[i]); - } - } - for (const k of keys(buckets)) { - if (buckets[k].length > 1) { - this.setMutated(); - this.mergeNodes(node, buckets[k]); - } - } - for (const child of node.children) { - this.run(child); - } - return this.mutatedFlag; - } -} -/** - * Repeatedly remove leaf nodes that are not output or facet nodes. - * The reason is that we don't need subtrees that don't have any output nodes. - * Facet nodes are needed for the row or column domains. - */ -export class RemoveUnusedSubtrees extends BottomUpOptimizer { - run(node) { - if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) { - // no need to continue with parent because it is output node or will have children (there was a fork) - return this.flags; - } - else { - this.setMutated(); - node.remove(); - } - return this.flags; - } -} -/** - * Removes duplicate time unit nodes (as determined by the name of the - * output field) that may be generated due to selections projected over - * time units. - * - * TODO: Try to make this a top down optimizer that keeps only the first - * insance of a time unit node. - * TODO: Try to make a generic version of this that only keeps one node per hash. - */ -export class RemoveDuplicateTimeUnits extends BottomUpOptimizer { - constructor() { - super(...arguments); - this.fields = new Set(); - this.prev = null; - } - run(node) { - this.setContinue(); - if (node instanceof TimeUnitNode) { - const pfields = node.producedFields(); - if (hasIntersection(pfields, this.fields)) { - this.setMutated(); - this.prev.remove(); - } - else { - this.fields = new Set([...this.fields, ...pfields]); - } - this.prev = node; - } - return this.flags; - } - reset() { - this.fields.clear(); - } -} -/** - * Merge adjacent time unit nodes. - */ -export class MergeTimeUnits extends BottomUpOptimizer { - run(node) { - this.setContinue(); - const parent = node.parent; - const timeUnitChildren = parent.children.filter(x => x instanceof TimeUnitNode); - const combination = timeUnitChildren.pop(); - for (const timeUnit of timeUnitChildren) { - this.setMutated(); - combination.merge(timeUnit); - } - return this.flags; - } -} -/** - * Clones the subtree and ignores output nodes except for the leaves, which are renamed. - */ -function cloneSubtree(facet) { - function clone(node) { - if (!(node instanceof FacetNode)) { - const copy = node.clone(); - if (copy instanceof OutputNode) { - const newName = FACET_SCALE_PREFIX + copy.getSource(); - copy.setSource(newName); - facet.model.component.data.outputNodes[newName] = copy; - } - else if (copy instanceof AggregateNode || - copy instanceof StackNode || - copy instanceof WindowTransformNode || - copy instanceof JoinAggregateTransformNode) { - copy.addDimensions(facet.fields); - } - for (const n of node.children.flatMap(clone)) { - n.parent = copy; - } - return [copy]; - } - return node.children.flatMap(clone); - } - return clone; -} -/** - * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node. - * After moving down the facet node, make a copy of the subtree and make it a child of the main output. - */ -export function moveFacetDown(node) { - if (node instanceof FacetNode) { - if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) { - // move down until we hit a fork or output node - const child = node.children[0]; - if (child instanceof AggregateNode || - child instanceof StackNode || - child instanceof WindowTransformNode || - child instanceof JoinAggregateTransformNode) { - child.addDimensions(node.fields); - } - child.swapWithParent(); - moveFacetDown(node); - } - else { - // move main to facet - const facetMain = node.model.component.data.main; - moveMainDownToFacet(facetMain); - // replicate the subtree and place it before the facet's main node - const cloner = cloneSubtree(node); - const copy = node.children.map(cloner).flat(); - for (const c of copy) { - c.parent = facetMain; - } - } - } - else { - node.children.map(moveFacetDown); - } -} -function moveMainDownToFacet(node) { - if (node instanceof OutputNode && node.type === DataSourceType.Main) { - if (node.numChildren() === 1) { - const child = node.children[0]; - if (!(child instanceof FacetNode)) { - child.swapWithParent(); - moveMainDownToFacet(node); - } - } - } -} -/** - * Remove output nodes that are not required. Starting from a root. - */ -export class RemoveUnnecessaryOutputNodes extends TopDownOptimizer { - constructor() { - super(); - } - run(node) { - if (node instanceof OutputNode && !node.isRequired()) { - this.setMutated(); - node.remove(); - } - for (const child of node.children) { - this.run(child); - } - return this.mutatedFlag; - } -} -export class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer { - constructor(model) { - super(); - this.requiresSelectionId = model && requiresSelectionId(model); - } - run(node) { - if (node instanceof IdentifierNode) { - // Only preserve IdentifierNodes if we have default discrete selections - // in our model tree, and if the nodes come after tuple producing nodes. - if (!(this.requiresSelectionId && - (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode))) { - this.setMutated(); - node.remove(); - } - } - for (const child of node.children) { - this.run(child); - } - return this.mutatedFlag; - } -} -/** - * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes. - * - * We assume that dependent paths that do not have a parse node can be just merged. - */ -export class MergeParse extends BottomUpOptimizer { - run(node) { - const parent = node.parent; - const originalChildren = [...parent.children]; - const parseChildren = parent.children.filter((child) => child instanceof ParseNode); - if (parent.numChildren() > 1 && parseChildren.length >= 1) { - const commonParse = {}; - const conflictingParse = new Set(); - for (const parseNode of parseChildren) { - const parse = parseNode.parse; - for (const k of keys(parse)) { - if (!(k in commonParse)) { - commonParse[k] = parse[k]; - } - else if (commonParse[k] !== parse[k]) { - conflictingParse.add(k); - } - } - } - for (const field of conflictingParse) { - delete commonParse[field]; - } - if (!isEmpty(commonParse)) { - this.setMutated(); - const mergedParseNode = new ParseNode(parent, commonParse); - for (const childNode of originalChildren) { - if (childNode instanceof ParseNode) { - for (const key of keys(commonParse)) { - delete childNode.parse[key]; - } - } - parent.removeChild(childNode); - childNode.parent = mergedParseNode; - // remove empty parse nodes - if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) { - childNode.remove(); - } - } - } - } - this.setContinue(); - return this.flags; - } -} -export class MergeAggregates extends BottomUpOptimizer { - run(node) { - const parent = node.parent; - const aggChildren = parent.children.filter((child) => child instanceof AggregateNode); - // Object which we'll use to map the fields which an aggregate is grouped by to - // the set of aggregates with that grouping. This is useful as only aggregates - // with the same group by can be merged - const groupedAggregates = {}; - // Build groupedAggregates - for (const agg of aggChildren) { - const groupBys = hash(agg.groupBy); - if (!(groupBys in groupedAggregates)) { - groupedAggregates[groupBys] = []; - } - groupedAggregates[groupBys].push(agg); - } - // Merge aggregateNodes with same key in groupedAggregates - for (const group of keys(groupedAggregates)) { - const mergeableAggs = groupedAggregates[group]; - if (mergeableAggs.length > 1) { - const mergedAggs = mergeableAggs.pop(); - for (const agg of mergeableAggs) { - if (mergedAggs.merge(agg)) { - parent.removeChild(agg); - agg.parent = mergedAggs; - agg.remove(); - this.setMutated(); - } - } - } - } - this.setContinue(); - return this.flags; - } -} -/** - * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node. - */ -export class MergeBins extends BottomUpOptimizer { - constructor(model) { - super(); - this.model = model; - } - run(node) { - const parent = node.parent; - const moveBinsUp = !(isDataSourceNode(parent) || - parent instanceof FilterNode || - parent instanceof ParseNode || - parent instanceof IdentifierNode); - const promotableBins = []; - const remainingBins = []; - for (const child of parent.children) { - if (child instanceof BinNode) { - if (moveBinsUp && !fieldIntersection(parent.producedFields(), child.dependentFields())) { - promotableBins.push(child); - } - else { - remainingBins.push(child); - } - } - } - if (promotableBins.length > 0) { - const promotedBin = promotableBins.pop(); - for (const bin of promotableBins) { - promotedBin.merge(bin, this.model.renameSignal.bind(this.model)); - } - this.setMutated(); - if (parent instanceof BinNode) { - parent.merge(promotedBin, this.model.renameSignal.bind(this.model)); - } - else { - promotedBin.swapWithParent(); - } - } - if (remainingBins.length > 1) { - const remainingBin = remainingBins.pop(); - for (const bin of remainingBins) { - remainingBin.merge(bin, this.model.renameSignal.bind(this.model)); - } - this.setMutated(); - } - this.setContinue(); - return this.flags; - } -} -/** - * This optimizer takes output nodes that are at a fork and moves them before the fork. - * - * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes. - * It then moves all output nodes before that main output node. All other children (and the children of the output nodes) - * are inserted after the main output node. - */ -export class MergeOutputs extends BottomUpOptimizer { - run(node) { - const parent = node.parent; - const children = [...parent.children]; - const hasOutputChild = some(children, child => child instanceof OutputNode); - if (!hasOutputChild || parent.numChildren() <= 1) { - this.setContinue(); - return this.flags; - } - const otherChildren = []; - // The output node we will connect all other nodes to. - // Output nodes will be added before the new node, other nodes after. - let mainOutput; - for (const child of children) { - if (child instanceof OutputNode) { - let lastOutput = child; - while (lastOutput.numChildren() === 1) { - const [theChild] = lastOutput.children; - if (theChild instanceof OutputNode) { - lastOutput = theChild; - } - else { - break; - } - } - otherChildren.push(...lastOutput.children); - if (mainOutput) { - // Move the output nodes before the mainOutput. We do this by setting - // the parent of the first not to the parent of the main output and - // the main output's parent to the last output. - // note: the child is the first output - parent.removeChild(child); - child.parent = mainOutput.parent; - mainOutput.parent.removeChild(mainOutput); - mainOutput.parent = lastOutput; - this.setMutated(); - } - else { - mainOutput = lastOutput; - } - } - else { - otherChildren.push(child); - } - } - if (otherChildren.length) { - this.setMutated(); - for (const child of otherChildren) { - child.parent.removeChild(child); - child.parent = mainOutput; - } - } - this.setContinue(); - return this.flags; - } -} -//# sourceMappingURL=optimizers.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/optimizers.js.map b/node_modules/vega-lite/build/src/compile/data/optimizers.js.map deleted file mode 100644 index 83a7374..0000000 --- a/node_modules/vega-lite/build/src/compile/data/optimizers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"optimizers.js","sourceRoot":"","sources":["../../../../src/compile/data/optimizers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAQ,MAAM,YAAY,CAAC;AACjD,OAAO,EAAO,iBAAiB,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAE/F,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAe,UAAU,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,0BAA0B,EAAC,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAElF,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAa7C;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IACzC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F;QAED,IAAI,aAAa,CAAC,MAAM,EAAE;YACxB,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE;gBACjC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBAChC,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC;aAC3B;SACF;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/parse.d.ts b/node_modules/vega-lite/build/src/compile/data/parse.d.ts deleted file mode 100644 index 89d5ee7..0000000 --- a/node_modules/vega-lite/build/src/compile/data/parse.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { AncestorParse, DataComponent } from '.'; -import { Data } from '../../data'; -import { Model } from '../model'; -import { DataFlowNode } from './dataflow'; -import { SourceNode } from './source'; -export declare function findSource(data: Data, sources: SourceNode[]): SourceNode; -/** - * Parses a transform array into a chain of connected dataflow nodes. - */ -export declare function parseTransformArray(head: DataFlowNode, model: Model, ancestorParse: AncestorParse): DataFlowNode; -export declare function parseData(model: Model): DataComponent; -//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/parse.d.ts.map b/node_modules/vega-lite/build/src/compile/data/parse.d.ts.map deleted file mode 100644 index 4190221..0000000 --- a/node_modules/vega-lite/build/src/compile/data/parse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,GAAG,CAAC;AAC/C,OAAO,EACL,IAAI,EASL,MAAM,YAAY,CAAC;AAuBpB,OAAO,EAA0C,KAAK,EAAC,MAAM,UAAU,CAAC;AAMxE,OAAO,EAAC,YAAY,EAAa,MAAM,YAAY,CAAC;AA2BpD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAKpC,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,cAwC3D;AAuCD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,GAAG,YAAY,CAoFhH;AAyDD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAuHrD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/parse.js b/node_modules/vega-lite/build/src/compile/data/parse.js deleted file mode 100644 index 902a80b..0000000 --- a/node_modules/vega-lite/build/src/compile/data/parse.js +++ /dev/null @@ -1,365 +0,0 @@ -import { AncestorParse } from '.'; -import { isGenerator, isGraticuleGenerator, isInlineData, isNamedData, isSequenceGenerator, isUrlData, DataSourceType } from '../../data'; -import * as log from '../../log'; -import { isAggregate, isBin, isCalculate, isDensity, isFilter, isFlatten, isFold, isImpute, isJoinAggregate, isLoess, isLookup, isPivot, isQuantile, isRegression, isSample, isStack, isTimeUnit, isWindow } from '../../transform'; -import { deepEqual, mergeDeep } from '../../util'; -import { isFacetModel, isLayerModel, isUnitModel } from '../model'; -import { requiresSelectionId } from '../selection'; -import { materializeSelections } from '../selection/parse'; -import { AggregateNode } from './aggregate'; -import { BinNode } from './bin'; -import { CalculateNode } from './calculate'; -import { OutputNode } from './dataflow'; -import { DensityTransformNode } from './density'; -import { FacetNode } from './facet'; -import { FilterNode } from './filter'; -import { FilterInvalidNode } from './filterinvalid'; -import { FlattenTransformNode } from './flatten'; -import { FoldTransformNode } from './fold'; -import { getImplicitFromEncoding, getImplicitFromFilterTransform, getImplicitFromSelection, ParseNode } from './formatparse'; -import { GeoJSONNode } from './geojson'; -import { GeoPointNode } from './geopoint'; -import { GraticuleNode } from './graticule'; -import { IdentifierNode } from './identifier'; -import { ImputeNode } from './impute'; -import { JoinAggregateTransformNode } from './joinaggregate'; -import { makeJoinAggregateFromFacet } from './joinaggregatefacet'; -import { LoessTransformNode } from './loess'; -import { LookupNode } from './lookup'; -import { PivotTransformNode } from './pivot'; -import { QuantileTransformNode } from './quantile'; -import { RegressionTransformNode } from './regression'; -import { SampleTransformNode } from './sample'; -import { SequenceNode } from './sequence'; -import { SourceNode } from './source'; -import { StackNode } from './stack'; -import { TimeUnitNode } from './timeunit'; -import { WindowTransformNode } from './window'; -export function findSource(data, sources) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - for (const other of sources) { - const otherData = other.data; - // if both datasets have a name defined, we cannot merge - if (data.name && other.hasName() && data.name !== other.dataName) { - continue; - } - // feature and mesh are mutually exclusive - if (((_a = data['format']) === null || _a === void 0 ? void 0 : _a.mesh) && ((_b = otherData.format) === null || _b === void 0 ? void 0 : _b.feature)) { - continue; - } - // we have to extract the same feature or mesh - if ((((_c = data['format']) === null || _c === void 0 ? void 0 : _c.feature) || ((_d = otherData.format) === null || _d === void 0 ? void 0 : _d.feature)) && - ((_e = data['format']) === null || _e === void 0 ? void 0 : _e.feature) !== ((_f = otherData.format) === null || _f === void 0 ? void 0 : _f.feature)) { - continue; - } - if ((((_g = data['format']) === null || _g === void 0 ? void 0 : _g.mesh) || ((_h = otherData.format) === null || _h === void 0 ? void 0 : _h.mesh)) && ((_j = data['format']) === null || _j === void 0 ? void 0 : _j.mesh) !== ((_k = otherData.format) === null || _k === void 0 ? void 0 : _k.mesh)) { - continue; - } - if (isInlineData(data) && isInlineData(otherData)) { - if (deepEqual(data.values, otherData.values)) { - return other; - } - } - else if (isUrlData(data) && isUrlData(otherData)) { - if (data.url === otherData.url) { - return other; - } - } - else if (isNamedData(data)) { - if (data.name === other.dataName) { - return other; - } - } - } - return null; -} -function parseRoot(model, sources) { - if (model.data || !model.parent) { - // if the model defines a data source or is the root, create a source node - if (model.data === null) { - // data: null means we should ignore the parent's data so we just create a new data source - const source = new SourceNode({ values: [] }); - sources.push(source); - return source; - } - const existingSource = findSource(model.data, sources); - if (existingSource) { - if (!isGenerator(model.data)) { - existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format); - } - // if the new source has a name but the existing one does not, we can set it - if (!existingSource.hasName() && model.data.name) { - existingSource.dataName = model.data.name; - } - return existingSource; - } - else { - const source = new SourceNode(model.data); - sources.push(source); - return source; - } - } - else { - // If we don't have a source defined (overriding parent's data), use the parent's facet root or main. - return model.parent.component.data.facetRoot - ? model.parent.component.data.facetRoot - : model.parent.component.data.main; - } -} -/** - * Parses a transform array into a chain of connected dataflow nodes. - */ -export function parseTransformArray(head, model, ancestorParse) { - var _a, _b; - let lookupCounter = 0; - for (const t of model.transforms) { - let derivedType = undefined; - let transformNode; - if (isCalculate(t)) { - transformNode = head = new CalculateNode(head, t); - derivedType = 'derived'; - } - else if (isFilter(t)) { - const implicit = getImplicitFromFilterTransform(t); - transformNode = head = (_a = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse)) !== null && _a !== void 0 ? _a : head; - head = new FilterNode(head, model, t.filter); - } - else if (isBin(t)) { - transformNode = head = BinNode.makeFromTransform(head, t, model); - derivedType = 'number'; - } - else if (isTimeUnit(t)) { - derivedType = 'date'; - const parsedAs = ancestorParse.getWithExplicit(t.field); - // Create parse node because the input to time unit is always date. - if (parsedAs.value === undefined) { - head = new ParseNode(head, { [t.field]: derivedType }); - ancestorParse.set(t.field, derivedType, false); - } - transformNode = head = TimeUnitNode.makeFromTransform(head, t); - } - else if (isAggregate(t)) { - transformNode = head = AggregateNode.makeFromTransform(head, t); - derivedType = 'number'; - if (requiresSelectionId(model)) { - head = new IdentifierNode(head); - } - } - else if (isLookup(t)) { - transformNode = head = LookupNode.make(head, model, t, lookupCounter++); - derivedType = 'derived'; - } - else if (isWindow(t)) { - transformNode = head = new WindowTransformNode(head, t); - derivedType = 'number'; - } - else if (isJoinAggregate(t)) { - transformNode = head = new JoinAggregateTransformNode(head, t); - derivedType = 'number'; - } - else if (isStack(t)) { - transformNode = head = StackNode.makeFromTransform(head, t); - derivedType = 'derived'; - } - else if (isFold(t)) { - transformNode = head = new FoldTransformNode(head, t); - derivedType = 'derived'; - } - else if (isFlatten(t)) { - transformNode = head = new FlattenTransformNode(head, t); - derivedType = 'derived'; - } - else if (isPivot(t)) { - transformNode = head = new PivotTransformNode(head, t); - derivedType = 'derived'; - } - else if (isSample(t)) { - head = new SampleTransformNode(head, t); - } - else if (isImpute(t)) { - transformNode = head = ImputeNode.makeFromTransform(head, t); - derivedType = 'derived'; - } - else if (isDensity(t)) { - transformNode = head = new DensityTransformNode(head, t); - derivedType = 'derived'; - } - else if (isQuantile(t)) { - transformNode = head = new QuantileTransformNode(head, t); - derivedType = 'derived'; - } - else if (isRegression(t)) { - transformNode = head = new RegressionTransformNode(head, t); - derivedType = 'derived'; - } - else if (isLoess(t)) { - transformNode = head = new LoessTransformNode(head, t); - derivedType = 'derived'; - } - else { - log.warn(log.message.invalidTransformIgnored(t)); - continue; - } - if (transformNode && derivedType !== undefined) { - for (const field of (_b = transformNode.producedFields()) !== null && _b !== void 0 ? _b : []) { - ancestorParse.set(field, derivedType, false); - } - } - } - return head; -} -/* -Description of the dataflow (http://asciiflow.com/): - +--------+ - | Source | - +---+----+ - | - v - FormatParse - (explicit) - | - v - Transforms -(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...) - | - v - FormatParse - (implicit) - | - v - Binning (in `encoding`) - | - v - Timeunit (in `encoding`) - | - v -Formula From Sort Array - | - v - +--+--+ - | Raw | - +-----+ - | - v - Aggregate (in `encoding`) - | - v - Stack (in `encoding`) - | - v - Invalid Filter - | - v - +----------+ - | Main | - +----------+ - | - v - +-------+ - | Facet |----> "column", "column-layout", and "row" - +-------+ - | - v - ...Child data... -*/ -export function parseData(model) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - let head = parseRoot(model, model.component.data.sources); - const { outputNodes, outputNodeRefCounts } = model.component.data; - const ancestorParse = model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse(); - const data = model.data; - if (isGenerator(data)) { - // insert generator transform - if (isSequenceGenerator(data)) { - head = new SequenceNode(head, data.sequence); - } - else if (isGraticuleGenerator(data)) { - head = new GraticuleNode(head, data.graticule); - } - // no parsing necessary for generator - ancestorParse.parseNothing = true; - } - else if (((_a = data === null || data === void 0 ? void 0 : data.format) === null || _a === void 0 ? void 0 : _a.parse) === null) { - // format.parse: null means disable parsing - ancestorParse.parseNothing = true; - } - head = (_b = ParseNode.makeExplicit(head, model, ancestorParse)) !== null && _b !== void 0 ? _b : head; - // Default discrete selections require an identifer transform to - // uniquely identify data points. Add this transform at the head of - // the pipeline such that the identifier field is available for all - // subsequent datasets. During optimization, we will remove this - // transform if it proves to be unnecessary. Additional identifier - // transforms will be necessary when new tuples are constructed - // (e.g., post-aggregation). - head = new IdentifierNode(head); - // HACK: This is equivalent for merging bin extent for union scale. - // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale - const parentIsLayer = model.parent && isLayerModel(model.parent); - if (isUnitModel(model) || isFacetModel(model)) { - if (parentIsLayer) { - head = (_c = BinNode.makeFromEncoding(head, model)) !== null && _c !== void 0 ? _c : head; - } - } - if (model.transforms.length > 0) { - head = parseTransformArray(head, model, ancestorParse); - } - // create parse nodes for fields that need to be parsed (or flattened) implicitly - const implicitSelection = getImplicitFromSelection(model); - const implicitEncoding = getImplicitFromEncoding(model); - head = (_d = ParseNode.makeWithAncestors(head, {}, Object.assign(Object.assign({}, implicitSelection), implicitEncoding), ancestorParse)) !== null && _d !== void 0 ? _d : head; - if (isUnitModel(model)) { - head = GeoJSONNode.parseAll(head, model); - head = GeoPointNode.parseAll(head, model); - } - if (isUnitModel(model) || isFacetModel(model)) { - if (!parentIsLayer) { - head = (_e = BinNode.makeFromEncoding(head, model)) !== null && _e !== void 0 ? _e : head; - } - head = (_f = TimeUnitNode.makeFromEncoding(head, model)) !== null && _f !== void 0 ? _f : head; - head = CalculateNode.parseAllForSortIndex(head, model); - } - // add an output node pre aggregation - const rawName = model.getDataName(DataSourceType.Raw); - const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts); - outputNodes[rawName] = raw; - head = raw; - if (isUnitModel(model)) { - const agg = AggregateNode.makeFromEncoding(head, model); - if (agg) { - head = agg; - if (requiresSelectionId(model)) { - head = new IdentifierNode(head); - } - } - head = (_g = ImputeNode.makeFromEncoding(head, model)) !== null && _g !== void 0 ? _g : head; - head = (_h = StackNode.makeFromEncoding(head, model)) !== null && _h !== void 0 ? _h : head; - } - if (isUnitModel(model)) { - head = (_j = FilterInvalidNode.make(head, model)) !== null && _j !== void 0 ? _j : head; - } - // output node for marks - const mainName = model.getDataName(DataSourceType.Main); - const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts); - outputNodes[mainName] = main; - head = main; - if (isUnitModel(model)) { - materializeSelections(model, main); - } - // add facet marker - let facetRoot = null; - if (isFacetModel(model)) { - const facetName = model.getName('facet'); - // Derive new aggregate for facet's sort field - // augment data source with new fields for crossed facet - head = (_k = makeJoinAggregateFromFacet(head, model.facet)) !== null && _k !== void 0 ? _k : head; - facetRoot = new FacetNode(head, model, facetName, main.getSource()); - outputNodes[facetName] = facetRoot; - } - return Object.assign(Object.assign({}, model.component.data), { outputNodes, - outputNodeRefCounts, - raw, - main, - facetRoot, - ancestorParse }); -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/parse.js.map b/node_modules/vega-lite/build/src/compile/data/parse.js.map deleted file mode 100644 index 43fe599..0000000 --- a/node_modules/vega-lite/build/src/compile/data/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/data/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAgB,MAAM,GAAG,CAAC;AAC/C,OAAO,EAEL,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,mBAA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,CAAC,IAAI,EAAE,KAAK,CAAC,mCAAI,IAAI,CAAC;KACpD;IAED,wBAAwB;IACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACtF,WAAW,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IAC7B,IAAI,GAAG,IAAI,CAAC;IAEZ,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;QACtB,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KACpC;IAED,mBAAmB;IACnB,IAAI,SAAS,GAAG,IAAI,CAAC;IACrB,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;QACvB,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEzC,8CAA8C;QAC9C,wDAAwD;QACxD,IAAI,SAAG,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,mCAAI,IAAI,CAAC;QAE7D,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QACpE,WAAW,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;KACpC;IAED,uCACK,KAAK,CAAC,SAAS,CAAC,IAAI,KACvB,WAAW;QACX,mBAAmB;QACnB,GAAG;QACH,IAAI;QACJ,SAAS;QACT,aAAa,IACb;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/pivot.d.ts b/node_modules/vega-lite/build/src/compile/data/pivot.d.ts deleted file mode 100644 index 6605c0b..0000000 --- a/node_modules/vega-lite/build/src/compile/data/pivot.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { PivotTransform } from '../../transform'; -import { PivotTransform as VgPivotTransform } from 'vega'; -import { DataFlowNode } from './dataflow'; -/** - * A class for pivot transform nodes. - */ -export declare class PivotTransformNode extends DataFlowNode { - private transform; - clone(): PivotTransformNode; - constructor(parent: DataFlowNode, transform: PivotTransform); - addDimensions(fields: readonly string[]): void; - producedFields(): undefined; - dependentFields(): Set; - hash(): string; - assemble(): VgPivotTransform; -} -//# sourceMappingURL=pivot.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/pivot.d.ts.map b/node_modules/vega-lite/build/src/compile/data/pivot.d.ts.map deleted file mode 100644 index 9724044..0000000 --- a/node_modules/vega-lite/build/src/compile/data/pivot.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pivot.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/pivot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAC,cAAc,IAAI,gBAAgB,EAAC,MAAM,MAAM,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAKhB,OAAO,CAAC,SAAS;IAJ5C,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,SAAS,EAAE,cAAc;IAI5D,aAAa,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE;IAIvC,cAAc,IAAI,SAAS;IAI3B,eAAe;IAIf,IAAI;IAIJ,QAAQ,IAAI,gBAAgB;CAWpC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/pivot.js b/node_modules/vega-lite/build/src/compile/data/pivot.js deleted file mode 100644 index 7b1e1a7..0000000 --- a/node_modules/vega-lite/build/src/compile/data/pivot.js +++ /dev/null @@ -1,33 +0,0 @@ -import { duplicate, hash, unique } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for pivot transform nodes. - */ -export class PivotTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new PivotTransformNode(null, duplicate(this.transform)); - } - addDimensions(fields) { - var _a; - this.transform.groupby = unique(((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []).concat(fields), d => d); - } - producedFields() { - return undefined; // return undefined so that potentially everything can depend on the pivot - } - dependentFields() { - var _a; - return new Set([this.transform.pivot, this.transform.value, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - hash() { - return `PivotTransform ${hash(this.transform)}`; - } - assemble() { - const { pivot, value, groupby, limit, op } = this.transform; - return Object.assign(Object.assign(Object.assign({ type: 'pivot', field: pivot, value }, (limit !== undefined ? { limit } : {})), (op !== undefined ? { op } : {})), (groupby !== undefined ? { groupby } : {})); - } -} -//# sourceMappingURL=pivot.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/pivot.js.map b/node_modules/vega-lite/build/src/compile/data/pivot.js.map deleted file mode 100644 index 5bfc28f..0000000 --- a/node_modules/vega-lite/build/src/compile/data/pivot.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pivot.js","sourceRoot":"","sources":["../../../../src/compile/data/pivot.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAKlD,YAAY,MAAoB,EAAU,SAAyB;QACjE,KAAK,CAAC,MAAM,CAAC,CAAC;QAD0B,cAAS,GAAT,SAAS,CAAgB;IAEnE,CAAC;IANM,KAAK;QACV,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACjE,CAAC;IAMM,aAAa,CAAC,MAAyB;;QAC5C,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAC,IAAI,CAAC,SAAS,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACzF,CAAC;IAEM,cAAc;QACnB,OAAO,SAAS,CAAC,CAAC,0EAA0E;IAC9F,CAAC;IAEM,eAAe;;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,OAAC,IAAI,CAAC,SAAS,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAClG,CAAC;IAEM,IAAI;QACT,OAAO,kBAAkB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IAClD,CAAC;IAEM,QAAQ;QACb,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1D,mDACE,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,KAAK,EACZ,KAAK,IACF,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACpC,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,EAAE,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAC9B,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC3C;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/quantile.d.ts b/node_modules/vega-lite/build/src/compile/data/quantile.d.ts deleted file mode 100644 index eb9874e..0000000 --- a/node_modules/vega-lite/build/src/compile/data/quantile.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { QuantileTransform as VgQuantileTransform } from 'vega'; -import { QuantileTransform } from '../../transform'; -import { DataFlowNode } from './dataflow'; -/** - * A class for quantile transform nodes - */ -export declare class QuantileTransformNode extends DataFlowNode { - private transform; - clone(): QuantileTransformNode; - constructor(parent: DataFlowNode, transform: QuantileTransform); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgQuantileTransform; -} -//# sourceMappingURL=quantile.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/quantile.d.ts.map b/node_modules/vega-lite/build/src/compile/data/quantile.d.ts.map deleted file mode 100644 index 9692e66..0000000 --- a/node_modules/vega-lite/build/src/compile/data/quantile.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"quantile.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/quantile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,IAAI,mBAAmB,EAAC,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IAKnB,OAAO,CAAC,SAAS;IAJ5C,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,SAAS,EAAE,iBAAiB;IAO/D,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,mBAAmB;CASvC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/quantile.js b/node_modules/vega-lite/build/src/compile/data/quantile.js deleted file mode 100644 index 53926d7..0000000 --- a/node_modules/vega-lite/build/src/compile/data/quantile.js +++ /dev/null @@ -1,35 +0,0 @@ -import { __rest } from "tslib"; -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for quantile transform nodes - */ -export class QuantileTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'prob', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'value']; - } - clone() { - return new QuantileTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.quantile, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `QuantileTransform ${hash(this.transform)}`; - } - assemble() { - const _a = this.transform, { quantile } = _a, rest = __rest(_a, ["quantile"]); - const result = Object.assign({ type: 'quantile', field: quantile }, rest); - return result; - } -} -//# sourceMappingURL=quantile.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/quantile.js.map b/node_modules/vega-lite/build/src/compile/data/quantile.js.map deleted file mode 100644 index ca95a3a..0000000 --- a/node_modules/vega-lite/build/src/compile/data/quantile.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"quantile.js","sourceRoot":"","sources":["../../../../src/compile/data/quantile.ts"],"names":[],"mappings":";AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,YAAY;IAKrD,YAAY,MAAoB,EAAU,SAA4B;;QACpE,KAAK,CAAC,MAAM,CAAC,CAAC;QAD0B,cAAS,GAAT,SAAS,CAAmB;QAEpE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,WAAW,SAAG,IAAI,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,OAAC,WAAW,CAAC,CAAC,CAAC,mCAAI,MAAM,QAAE,WAAW,CAAC,CAAC,CAAC,mCAAI,OAAO,CAAC,CAAC;IAC5E,CAAC;IATM,KAAK;QACV,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IASM,eAAe;;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,OAAC,IAAI,CAAC,SAAS,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,qBAAqB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACrD,CAAC;IAEM,QAAQ;QACb,MAAM,KAAsB,IAAI,CAAC,SAAS,EAApC,EAAC,QAAQ,OAA2B,EAAtB,IAAI,cAAlB,YAAmB,CAAiB,CAAC;QAC3C,MAAM,MAAM,mBACV,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,QAAQ,IACZ,IAAI,CACR,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/regression.d.ts b/node_modules/vega-lite/build/src/compile/data/regression.d.ts deleted file mode 100644 index fa77271..0000000 --- a/node_modules/vega-lite/build/src/compile/data/regression.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { RegressionTransform as VgRegressionTransform } from 'vega'; -import { RegressionTransform } from '../../transform'; -import { DataFlowNode } from './dataflow'; -/** - * A class for regression transform nodes - */ -export declare class RegressionTransformNode extends DataFlowNode { - private transform; - clone(): RegressionTransformNode; - constructor(parent: DataFlowNode, transform: RegressionTransform); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgRegressionTransform; -} -//# sourceMappingURL=regression.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/regression.d.ts.map b/node_modules/vega-lite/build/src/compile/data/regression.d.ts.map deleted file mode 100644 index 87e7710..0000000 --- a/node_modules/vega-lite/build/src/compile/data/regression.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"regression.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/regression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,IAAI,qBAAqB,EAAC,MAAM,MAAM,CAAC;AAClE,OAAO,EAAC,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,YAAY;IAKrB,OAAO,CAAC,SAAS;IAJ5C,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,SAAS,EAAE,mBAAmB;IAOjE,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,qBAAqB;CAUzC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/regression.js b/node_modules/vega-lite/build/src/compile/data/regression.js deleted file mode 100644 index 89976cd..0000000 --- a/node_modules/vega-lite/build/src/compile/data/regression.js +++ /dev/null @@ -1,35 +0,0 @@ -import { __rest } from "tslib"; -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for regression transform nodes - */ -export class RegressionTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : transform.on, (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : transform.regression]; - } - clone() { - return new RegressionTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.regression, this.transform.on, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `RegressionTransform ${hash(this.transform)}`; - } - assemble() { - const _a = this.transform, { regression, on } = _a, rest = __rest(_a, ["regression", "on"]); - const result = Object.assign({ type: 'regression', x: on, y: regression }, rest); - return result; - } -} -//# sourceMappingURL=regression.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/regression.js.map b/node_modules/vega-lite/build/src/compile/data/regression.js.map deleted file mode 100644 index e2ce8c1..0000000 --- a/node_modules/vega-lite/build/src/compile/data/regression.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"regression.js","sourceRoot":"","sources":["../../../../src/compile/data/regression.ts"],"names":[],"mappings":";AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IAKvD,YAAY,MAAoB,EAAU,SAA8B;;QACtE,KAAK,CAAC,MAAM,CAAC,CAAC;QAD0B,cAAS,GAAT,SAAS,CAAqB;QAEtE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,WAAW,SAAG,IAAI,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,OAAC,WAAW,CAAC,CAAC,CAAC,mCAAI,SAAS,CAAC,EAAE,QAAE,WAAW,CAAC,CAAC,CAAC,mCAAI,SAAS,CAAC,UAAU,CAAC,CAAC;IAC/F,CAAC;IATM,KAAK;QACV,OAAO,IAAI,uBAAuB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACtE,CAAC;IASM,eAAe;;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,OAAC,IAAI,CAAC,SAAS,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACpG,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,uBAAuB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACvD,CAAC;IAEM,QAAQ;QACb,MAAM,KAA4B,IAAI,CAAC,SAAS,EAA1C,EAAC,UAAU,EAAE,EAAE,OAA2B,EAAtB,IAAI,cAAxB,oBAAyB,CAAiB,CAAC;QACjD,MAAM,MAAM,mBACV,IAAI,EAAE,YAAY,EAClB,CAAC,EAAE,EAAE,EACL,CAAC,EAAE,UAAU,IACV,IAAI,CACR,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/sample.d.ts b/node_modules/vega-lite/build/src/compile/data/sample.d.ts deleted file mode 100644 index 7f472f9..0000000 --- a/node_modules/vega-lite/build/src/compile/data/sample.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { SampleTransform as VgSampleTransform } from 'vega'; -import { SampleTransform } from '../../transform'; -import { DataFlowNode } from './dataflow'; -/** - * A class for the sample transform nodes - */ -export declare class SampleTransformNode extends DataFlowNode { - private transform; - clone(): SampleTransformNode; - constructor(parent: DataFlowNode, transform: SampleTransform); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgSampleTransform; -} -//# sourceMappingURL=sample.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/sample.d.ts.map b/node_modules/vega-lite/build/src/compile/data/sample.d.ts.map deleted file mode 100644 index 3da3364..0000000 --- a/node_modules/vega-lite/build/src/compile/data/sample.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/sample.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;IAKjB,OAAO,CAAC,SAAS;IAJ5C,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,SAAS,EAAE,eAAe;IAI7D,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,iBAAiB;CAMrC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/sample.js b/node_modules/vega-lite/build/src/compile/data/sample.js deleted file mode 100644 index f00471e..0000000 --- a/node_modules/vega-lite/build/src/compile/data/sample.js +++ /dev/null @@ -1,30 +0,0 @@ -import { duplicate, hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for the sample transform nodes - */ -export class SampleTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new SampleTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - return new Set(); - } - producedFields() { - return new Set(); - } - hash() { - return `SampleTransform ${hash(this.transform)}`; - } - assemble() { - return { - type: 'sample', - size: this.transform.sample - }; - } -} -//# sourceMappingURL=sample.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/sample.js.map b/node_modules/vega-lite/build/src/compile/data/sample.js.map deleted file mode 100644 index af55ba9..0000000 --- a/node_modules/vega-lite/build/src/compile/data/sample.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sample.js","sourceRoot":"","sources":["../../../../src/compile/data/sample.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAKnD,YAAY,MAAoB,EAAU,SAA0B;QAClE,KAAK,CAAC,MAAM,CAAC,CAAC;QAD0B,cAAS,GAAT,SAAS,CAAiB;IAEpE,CAAC;IANM,KAAK;QACV,OAAO,IAAI,mBAAmB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAClE,CAAC;IAMM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,IAAI;QACT,OAAO,mBAAmB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACnD,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM;SAC5B,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/sequence.d.ts b/node_modules/vega-lite/build/src/compile/data/sequence.d.ts deleted file mode 100644 index d197eaa..0000000 --- a/node_modules/vega-lite/build/src/compile/data/sequence.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { SequenceParams } from '../../data'; -import { SequenceTransform as VgSequenceTransform } from 'vega'; -import { DataFlowNode } from './dataflow'; -export declare class SequenceNode extends DataFlowNode { - private params; - clone(): SequenceNode; - constructor(parent: DataFlowNode, params: SequenceParams); - dependentFields(): Set; - producedFields(): Set; - hash(): string; - assemble(): VgSequenceTransform; -} -//# sourceMappingURL=sequence.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/sequence.d.ts.map b/node_modules/vega-lite/build/src/compile/data/sequence.d.ts.map deleted file mode 100644 index ac0f43c..0000000 --- a/node_modules/vega-lite/build/src/compile/data/sequence.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/sequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,iBAAiB,IAAI,mBAAmB,EAAC,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,YAAa,SAAQ,YAAY;IAKV,OAAO,CAAC,MAAM;IAJzC,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,MAAM,EAAE,cAAc;IAIzD,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,mBAAmB;CAMvC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/sequence.js b/node_modules/vega-lite/build/src/compile/data/sequence.js deleted file mode 100644 index 4d3c0ba..0000000 --- a/node_modules/vega-lite/build/src/compile/data/sequence.js +++ /dev/null @@ -1,25 +0,0 @@ -import { hash } from '../../util'; -import { DataFlowNode } from './dataflow'; -export class SequenceNode extends DataFlowNode { - constructor(parent, params) { - super(parent); - this.params = params; - } - clone() { - return new SequenceNode(null, this.params); - } - dependentFields() { - return new Set(); - } - producedFields() { - var _a; - return new Set([(_a = this.params.as) !== null && _a !== void 0 ? _a : 'data']); - } - hash() { - return `Hash ${hash(this.params)}`; - } - assemble() { - return Object.assign({ type: 'sequence' }, this.params); - } -} -//# sourceMappingURL=sequence.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/sequence.js.map b/node_modules/vega-lite/build/src/compile/data/sequence.js.map deleted file mode 100644 index 3f72068..0000000 --- a/node_modules/vega-lite/build/src/compile/data/sequence.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sequence.js","sourceRoot":"","sources":["../../../../src/compile/data/sequence.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAK5C,YAAY,MAAoB,EAAU,MAAsB;QAC9D,KAAK,CAAC,MAAM,CAAC,CAAC;QAD0B,WAAM,GAAN,MAAM,CAAgB;IAEhE,CAAC;IANM,KAAK;QACV,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAMM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;;QACnB,OAAO,IAAI,GAAG,CAAC,OAAC,IAAI,CAAC,MAAM,CAAC,EAAE,mCAAI,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;IAEM,IAAI;QACT,OAAO,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACrC,CAAC;IAEM,QAAQ;QACb,uBACE,IAAI,EAAE,UAAU,IACb,IAAI,CAAC,MAAM,EACd;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/source.d.ts b/node_modules/vega-lite/build/src/compile/data/source.d.ts deleted file mode 100644 index 17f987d..0000000 --- a/node_modules/vega-lite/build/src/compile/data/source.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Data } from '../../data'; -import { VgData } from '../../vega.schema'; -import { DataFlowNode } from './dataflow'; -export declare class SourceNode extends DataFlowNode { - private _data; - private _name; - private _generator; - constructor(data: Data); - dependentFields(): Set; - producedFields(): undefined; - get data(): Partial; - hasName(): boolean; - get isGenerator(): boolean; - get dataName(): string; - set dataName(name: string); - set parent(parent: DataFlowNode); - remove(): void; - hash(): string | number; - assemble(): VgData; -} -//# sourceMappingURL=source.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/source.d.ts.map b/node_modules/vega-lite/build/src/compile/data/source.d.ts.map deleted file mode 100644 index ab76253..0000000 --- a/node_modules/vega-lite/build/src/compile/data/source.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/source.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAQL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,KAAK,CAAkB;IAE/B,OAAO,CAAC,KAAK,CAAS;IAEtB,OAAO,CAAC,UAAU,CAAU;gBAEhB,IAAI,EAAE,IAAI;IA8Cf,eAAe;IAIf,cAAc,IAAI,SAAS;IAIlC,IAAI,IAAI,oBAEP;IAEM,OAAO,IAAI,OAAO;IAIzB,IAAI,WAAW,YAEd;IACD,IAAI,QAAQ,IAIO,MAAM,CAFxB;IAED,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAExB;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,EAE9B;IAEM,MAAM;IAIN,IAAI,IAAI,MAAM,GAAG,MAAM;IAIvB,QAAQ,IAAI,MAAM;CAO1B"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/source.js b/node_modules/vega-lite/build/src/compile/data/source.js deleted file mode 100644 index 0d3d89d..0000000 --- a/node_modules/vega-lite/build/src/compile/data/source.js +++ /dev/null @@ -1,79 +0,0 @@ -import { isGenerator, isInlineData, isNamedData, isSphereGenerator, isUrlData } from '../../data'; -import { contains, isEmpty, omit } from '../../util'; -import { DataFlowNode } from './dataflow'; -export class SourceNode extends DataFlowNode { - constructor(data) { - super(null); // source cannot have parent - data = data !== null && data !== void 0 ? data : { name: 'source' }; - let format; - if (!isGenerator(data)) { - format = data.format ? Object.assign({}, omit(data.format, ['parse'])) : {}; - } - if (isInlineData(data)) { - this._data = { values: data.values }; - } - else if (isUrlData(data)) { - this._data = { url: data.url }; - if (!format.type) { - // Extract extension from URL using snippet from - // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript - let defaultExtension = /(?:\.([^.]+))?$/.exec(data.url)[1]; - if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) { - defaultExtension = 'json'; - } - // defaultExtension has type string but we ensure that it is DataFormatType above - format.type = defaultExtension; - } - } - else if (isSphereGenerator(data)) { - // hardwire GeoJSON sphere data into output specification - this._data = { values: [{ type: 'Sphere' }] }; - } - else if (isNamedData(data) || isGenerator(data)) { - this._data = {}; - } - // set flag to check if generator - this._generator = isGenerator(data); - // any dataset can be named - if (data.name) { - this._name = data.name; - } - if (format && !isEmpty(format)) { - this._data.format = format; - } - } - dependentFields() { - return new Set(); - } - producedFields() { - return undefined; // we don't know what this source produces - } - get data() { - return this._data; - } - hasName() { - return !!this._name; - } - get isGenerator() { - return this._generator; - } - get dataName() { - return this._name; - } - set dataName(name) { - this._name = name; - } - set parent(parent) { - throw new Error('Source nodes have to be roots.'); - } - remove() { - throw new Error('Source nodes are roots and cannot be removed.'); - } - hash() { - throw new Error('Cannot hash sources'); - } - assemble() { - return Object.assign(Object.assign({ name: this._name }, this._data), { transform: [] }); - } -} -//# sourceMappingURL=source.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/source.js.map b/node_modules/vega-lite/build/src/compile/data/source.js.map deleted file mode 100644 index 32e4dcd..0000000 --- a/node_modules/vega-lite/build/src/compile/data/source.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../../src/compile/data/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,SAAS,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC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EAAE,IAAI,CAAC,KAAK,IACb,IAAI,CAAC,KAAK,KACb,SAAS,EAAE,EAAE,IACb;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/stack.d.ts b/node_modules/vega-lite/build/src/compile/data/stack.d.ts deleted file mode 100644 index 6e26b91..0000000 --- a/node_modules/vega-lite/build/src/compile/data/stack.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Transforms as VgTransform } from 'vega'; -import { FieldName, PositionFieldDef } from '../../channeldef'; -import { SortFields } from '../../sort'; -import { StackOffset } from '../../stack'; -import { StackTransform } from '../../transform'; -import { UnitModel } from '../unit'; -import { DataFlowNode } from './dataflow'; -export interface StackComponent { - /** - * Faceted field. - */ - facetby: string[]; - dimensionFieldDef?: PositionFieldDef; - /** - * Stack measure's field. Used in makeFromEncoding. - */ - stackField: string; - /** - * Level of detail fields for each level in the stacked charts such as color or detail. - * Used in makeFromEncoding. - */ - stackby?: string[]; - /** - * Field that determines order of levels in the stacked charts. - * Used in both but optional in transform. - */ - sort: SortFields; - /** Mode for stacking marks. - */ - offset: StackOffset; - /** - * Whether to impute the data before stacking. Used only in makeFromEncoding. - */ - impute?: boolean; - /** - * The data fields to group by. - */ - groupby?: FieldName[]; - /** - * Output field names of each stack field. - */ - as: [FieldName, FieldName]; -} -export declare class StackNode extends DataFlowNode { - private _stack; - clone(): StackNode; - constructor(parent: DataFlowNode, stack: StackComponent); - static makeFromTransform(parent: DataFlowNode, stackTransform: StackTransform): StackNode; - static makeFromEncoding(parent: DataFlowNode, model: UnitModel): StackNode; - get stack(): StackComponent; - addDimensions(fields: string[]): void; - dependentFields(): Set; - producedFields(): Set; - hash(): string; - private getGroupbyFields; - assemble(): VgTransform[]; -} -//# sourceMappingURL=stack.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/stack.d.ts.map b/node_modules/vega-lite/build/src/compile/data/stack.d.ts.map deleted file mode 100644 index 58052d6..0000000 --- a/node_modules/vega-lite/build/src/compile/data/stack.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,WAAW,EAAC,MAAM,MAAM,CAAC;AAE/C,OAAO,EAAC,SAAS,EAA2B,gBAAgB,EAAU,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAC,UAAU,EAAY,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAcxC,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE7C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;;OAGG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;OACG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB;;OAEG;IACH,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CAC5B;AAMD,qBAAa,SAAU,SAAQ,YAAY;IACzC,OAAO,CAAC,MAAM,CAAiB;IAExB,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc;WAMzC,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc;WAkCtE,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS;IAkDrE,IAAI,KAAK,IAAI,cAAc,CAE1B;IAEM,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE;IAI9B,eAAe;IAYf,cAAc;IAId,IAAI;IAIX,OAAO,CAAC,gBAAgB;IAoBjB,QAAQ,IAAI,WAAW,EAAE;CA2CjC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/stack.js b/node_modules/vega-lite/build/src/compile/data/stack.js deleted file mode 100644 index c964406..0000000 --- a/node_modules/vega-lite/build/src/compile/data/stack.js +++ /dev/null @@ -1,179 +0,0 @@ -import { isArray, isString } from 'vega-util'; -import { getFieldDef, isFieldDef, vgField } from '../../channeldef'; -import { duplicate, getFirstDefined, hash } from '../../util'; -import { sortParams } from '../common'; -import { DataFlowNode } from './dataflow'; -function getStackByFields(model) { - return model.stack.stackBy.reduce((fields, by) => { - const fieldDef = by.fieldDef; - const _field = vgField(fieldDef); - if (_field) { - fields.push(_field); - } - return fields; - }, []); -} -function isValidAsArray(as) { - return isArray(as) && as.every(s => isString(s)) && as.length > 1; -} -export class StackNode extends DataFlowNode { - constructor(parent, stack) { - super(parent); - this._stack = stack; - } - clone() { - return new StackNode(null, duplicate(this._stack)); - } - static makeFromTransform(parent, stackTransform) { - const { stack, groupby, as, offset = 'zero' } = stackTransform; - const sortFields = []; - const sortOrder = []; - if (stackTransform.sort !== undefined) { - for (const sortField of stackTransform.sort) { - sortFields.push(sortField.field); - sortOrder.push(getFirstDefined(sortField.order, 'ascending')); - } - } - const sort = { - field: sortFields, - order: sortOrder - }; - let normalizedAs; - if (isValidAsArray(as)) { - normalizedAs = as; - } - else if (isString(as)) { - normalizedAs = [as, as + '_end']; - } - else { - normalizedAs = [stackTransform.stack + '_start', stackTransform.stack + '_end']; - } - return new StackNode(parent, { - stackField: stack, - groupby, - offset, - sort, - facetby: [], - as: normalizedAs - }); - } - static makeFromEncoding(parent, model) { - const stackProperties = model.stack; - const { encoding } = model; - if (!stackProperties) { - return null; - } - const { groupbyChannel, fieldChannel, offset, impute } = stackProperties; - let dimensionFieldDef; - if (groupbyChannel) { - const cDef = encoding[groupbyChannel]; - dimensionFieldDef = getFieldDef(cDef); // Fair to cast as groupByChannel is always either x or y - } - const stackby = getStackByFields(model); - const orderDef = model.encoding.order; - let sort; - if (isArray(orderDef) || isFieldDef(orderDef)) { - sort = sortParams(orderDef); - } - else { - // default = descending by stackFields - // FIXME is the default here correct for binned fields? - sort = stackby.reduce((s, field) => { - s.field.push(field); - s.order.push(fieldChannel === 'y' ? 'descending' : 'ascending'); - return s; - }, { field: [], order: [] }); - } - return new StackNode(parent, { - dimensionFieldDef, - stackField: model.vgField(fieldChannel), - facetby: [], - stackby, - sort, - offset, - impute, - as: [ - model.vgField(fieldChannel, { suffix: 'start', forAs: true }), - model.vgField(fieldChannel, { suffix: 'end', forAs: true }) - ] - }); - } - get stack() { - return this._stack; - } - addDimensions(fields) { - this._stack.facetby.push(...fields); - } - dependentFields() { - const out = new Set(); - out.add(this._stack.stackField); - this.getGroupbyFields().forEach(out.add, out); - this._stack.facetby.forEach(out.add, out); - this._stack.sort.field.forEach(out.add, out); - return out; - } - producedFields() { - return new Set(this._stack.as); - } - hash() { - return `Stack ${hash(this._stack)}`; - } - getGroupbyFields() { - const { dimensionFieldDef, impute, groupby } = this._stack; - if (dimensionFieldDef) { - if (dimensionFieldDef.bin) { - if (impute) { - // For binned group by field with impute, we calculate bin_mid - // as we cannot impute two fields simultaneously - return [vgField(dimensionFieldDef, { binSuffix: 'mid' })]; - } - return [ - // For binned group by field without impute, we need both bin (start) and bin_end - vgField(dimensionFieldDef, {}), - vgField(dimensionFieldDef, { binSuffix: 'end' }) - ]; - } - return [vgField(dimensionFieldDef)]; - } - return groupby !== null && groupby !== void 0 ? groupby : []; - } - assemble() { - const transform = []; - const { facetby, dimensionFieldDef, stackField: field, stackby, sort, offset, impute, as } = this._stack; - // Impute - if (impute && dimensionFieldDef) { - const { band = 0.5, bin } = dimensionFieldDef; - if (bin) { - // As we can only impute one field at a time, we need to calculate - // mid point for a binned field - transform.push({ - type: 'formula', - expr: `${band}*` + - vgField(dimensionFieldDef, { expr: 'datum' }) + - `+${1 - band}*` + - vgField(dimensionFieldDef, { expr: 'datum', binSuffix: 'end' }), - as: vgField(dimensionFieldDef, { binSuffix: 'mid', forAs: true }) - }); - } - transform.push({ - type: 'impute', - field, - groupby: [...stackby, ...facetby], - key: vgField(dimensionFieldDef, { binSuffix: 'mid' }), - method: 'value', - value: 0 - }); - } - // Stack - transform.push({ - type: 'stack', - groupby: [...this.getGroupbyFields(), ...facetby], - field, - sort, - as, - offset - }); - return transform; - } -} -//# sourceMappingURL=stack.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/stack.js.map b/node_modules/vega-lite/build/src/compile/data/stack.js.map deleted file mode 100644 index d8be4d1..0000000 --- a/node_modules/vega-lite/build/src/compile/data/stack.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../../src/compile/data/stack.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAY,WAAW,EAAE,UAAU,EAAoB,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAI/F,OAAO,EAAC,SAAS,EAAE,eAAe,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAErC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,SAAS,gBAAgB,CAAC,KAAgB;IACxC,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE;QAC/C,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;QAE7B,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,IAAI,MAAM,EAAE;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AC,MAAM,CAAC;QAEvG,SAAS;QACT,IAAI,MAAM,IAAI,iBAAiB,EAAE;YAC/B,MAAM,EAAC,IAAI,GAAG,GAAG,EAAE,GAAG,EAAC,GAAG,iBAAiB,CAAC;YAC5C,IAAI,GAAG,EAAE;gBACP,kEAAkE;gBAClE,+BAA+B;gBAC/B,SAAS,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,SAAS;oBACf,IAAI,EACF,GAAG,IAAI,GAAG;wBACV,OAAO,CAAC,iBAAiB,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;wBAC3C,IAAI,CAAC,GAAG,IAAI,GAAG;wBACf,OAAO,CAAC,iBAAiB,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAC,CAAC;oBAC/D,EAAE,EAAE,OAAO,CAAC,iBAAiB,EAAE,EAAC,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;iBAChE,CAAC,CAAC;aACJ;YAED,SAAS,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,QAAQ;gBACd,KAAK;gBACL,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC;gBACjC,GAAG,EAAE,OAAO,CAAC,iBAAiB,EAAE,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC;gBACnD,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;SACJ;QAED,QAAQ;QACR,SAAS,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,gBAAgB,EAAE,EAAE,GAAG,OAAO,CAAC;YACjD,KAAK;YACL,IAAI;YACJ,EAAE;YACF,MAAM;SACP,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/timeunit.d.ts b/node_modules/vega-lite/build/src/compile/data/timeunit.d.ts deleted file mode 100644 index f2c1424..0000000 --- a/node_modules/vega-lite/build/src/compile/data/timeunit.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { TimeUnitTransform as VgTimeUnitTransform } from 'vega'; -import { TimeUnitTransform } from '../../transform'; -import { Dict } from '../../util'; -import { ModelWithField } from '../model'; -import { DataFlowNode } from './dataflow'; -export declare type TimeUnitComponent = TimeUnitTransform & { - /** whether to output time unit as a band (generate two formula including start and end) */ - band?: boolean; -}; -export declare class TimeUnitNode extends DataFlowNode { - private formula; - clone(): TimeUnitNode; - constructor(parent: DataFlowNode, formula: Dict); - static makeFromEncoding(parent: DataFlowNode, model: ModelWithField): TimeUnitNode; - static makeFromTransform(parent: DataFlowNode, t: TimeUnitTransform): TimeUnitNode; - /** - * Merge together TimeUnitNodes assigning the children of `other` to `this` - * and removing `other`. - */ - merge(other: TimeUnitNode): void; - producedFields(): Set; - dependentFields(): Set; - hash(): string; - assemble(): VgTimeUnitTransform[]; -} -//# sourceMappingURL=timeunit.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/timeunit.d.ts.map b/node_modules/vega-lite/build/src/compile/data/timeunit.d.ts.map deleted file mode 100644 index 13b38e0..0000000 --- a/node_modules/vega-lite/build/src/compile/data/timeunit.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"timeunit.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/timeunit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,IAAI,mBAAmB,EAAC,MAAM,MAAM,CAAC;AAI9D,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,IAAI,EAAqD,MAAM,YAAY,CAAC;AACpF,OAAO,EAAc,cAAc,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,oBAAY,iBAAiB,GAAG,iBAAiB,GAAG;IAClD,2FAA2F;IAC3F,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,qBAAa,YAAa,SAAQ,YAAY;IAKV,OAAO,CAAC,OAAO;IAJ1C,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAU,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC;WAI5D,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc;WAkC5D,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,iBAAiB;IAe1E;;;OAGG;IACI,KAAK,CAAC,KAAK,EAAE,YAAY;IAmBzB,cAAc;IAId,eAAe;IAIf,IAAI;IAIJ,QAAQ;CAmBhB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/timeunit.js b/node_modules/vega-lite/build/src/compile/data/timeunit.js deleted file mode 100644 index 9f2db37..0000000 --- a/node_modules/vega-lite/build/src/compile/data/timeunit.js +++ /dev/null @@ -1,84 +0,0 @@ -import { __rest } from "tslib"; -import { getSecondaryRangeChannel } from '../../channel'; -import { hasBand, vgField } from '../../channeldef'; -import { getTimeUnitParts, normalizeTimeUnit } from '../../timeunit'; -import { duplicate, hash, isEmpty, replacePathInField, vals } from '../../util'; -import { isUnitModel } from '../model'; -import { DataFlowNode } from './dataflow'; -export class TimeUnitNode extends DataFlowNode { - constructor(parent, formula) { - super(parent); - this.formula = formula; - } - clone() { - return new TimeUnitNode(null, duplicate(this.formula)); - } - static makeFromEncoding(parent, model) { - const formula = model.reduceFieldDef((timeUnitComponent, fieldDef, channel) => { - const { field, timeUnit } = fieldDef; - const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; - const band = isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config); - if (timeUnit) { - const as = vgField(fieldDef, { forAs: true }); - timeUnitComponent[hash({ - as, - field, - timeUnit - })] = Object.assign({ as, - field, - timeUnit }, (band ? { band: true } : {})); - } - return timeUnitComponent; - }, {}); - if (isEmpty(formula)) { - return null; - } - return new TimeUnitNode(parent, formula); - } - static makeFromTransform(parent, t) { - const _a = Object.assign({}, t), { timeUnit } = _a, other = __rest(_a, ["timeUnit"]); - const normalizedTimeUnit = normalizeTimeUnit(timeUnit); - const component = Object.assign(Object.assign({}, other), { timeUnit: normalizedTimeUnit }); - return new TimeUnitNode(parent, { - [hash(component)]: component - }); - } - /** - * Merge together TimeUnitNodes assigning the children of `other` to `this` - * and removing `other`. - */ - merge(other) { - this.formula = Object.assign({}, this.formula); - // if the same hash happen twice, merge "band" - for (const key in other.formula) { - if (!this.formula[key] || other.formula[key].band) { - // copy if it's not a duplicate or if we need to include copy band over - this.formula[key] = other.formula[key]; - } - } - for (const child of other.children) { - other.removeChild(child); - child.parent = this; - } - other.remove(); - } - producedFields() { - return new Set(vals(this.formula).map(f => f.as)); - } - dependentFields() { - return new Set(vals(this.formula).map(f => f.field)); - } - hash() { - return `TimeUnit ${hash(this.formula)}`; - } - assemble() { - const transforms = []; - for (const f of vals(this.formula)) { - const { field, as, timeUnit } = f; - const _a = normalizeTimeUnit(timeUnit), { unit, utc } = _a, params = __rest(_a, ["unit", "utc"]); - transforms.push(Object.assign(Object.assign(Object.assign(Object.assign({ field: replacePathInField(field), type: 'timeunit' }, (unit ? { units: getTimeUnitParts(unit) } : {})), (utc ? { timezone: 'utc' } : {})), params), { as: [as, `${as}_end`] })); - } - return transforms; - } -} -//# sourceMappingURL=timeunit.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/timeunit.js.map b/node_modules/vega-lite/build/src/compile/data/timeunit.js.map deleted file mode 100644 index 15ad71d..0000000 --- a/node_modules/vega-lite/build/src/compile/data/timeunit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"timeunit.js","sourceRoot":"","sources":["../../../../src/compile/data/timeunit.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,wBAAwB,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,OAAO,E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,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAC9B,MAAM,KACT,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,IACrB,CAAC;SACJ;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/window.d.ts b/node_modules/vega-lite/build/src/compile/data/window.d.ts deleted file mode 100644 index 4bca093..0000000 --- a/node_modules/vega-lite/build/src/compile/data/window.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { WindowTransform as VgWindowTransform } from 'vega'; -import { WindowTransform } from '../../transform'; -import { VgJoinAggregateTransform } from '../../vega.schema'; -import { DataFlowNode } from './dataflow'; -/** - * A class for the window transform nodes - */ -export declare class WindowTransformNode extends DataFlowNode { - private readonly transform; - clone(): WindowTransformNode; - constructor(parent: DataFlowNode, transform: WindowTransform); - addDimensions(fields: string[]): void; - dependentFields(): Set; - producedFields(): Set; - private getDefaultName; - hash(): string; - assemble(): VgWindowTransform | VgJoinAggregateTransform; -} -//# sourceMappingURL=window.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/window.d.ts.map b/node_modules/vega-lite/build/src/compile/data/window.d.ts.map deleted file mode 100644 index d4459c4..0000000 --- a/node_modules/vega-lite/build/src/compile/data/window.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/window.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAIvE,OAAO,EAA+B,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAe,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;IAKjB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJrD,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAmB,SAAS,EAAE,eAAe;IAItE,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE;IAI9B,eAAe;IAcf,cAAc;IAIrB,OAAO,CAAC,cAAc;IAIf,IAAI;IAIJ,QAAQ,IAAI,iBAAiB,GAAG,wBAAwB;CAqDhE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/window.js b/node_modules/vega-lite/build/src/compile/data/window.js deleted file mode 100644 index 5015749..0000000 --- a/node_modules/vega-lite/build/src/compile/data/window.js +++ /dev/null @@ -1,79 +0,0 @@ -import { isAggregateOp } from '../../aggregate'; -import { vgField } from '../../channeldef'; -import { duplicate, hash } from '../../util'; -import { unique } from '../../util'; -import { DataFlowNode } from './dataflow'; -/** - * A class for the window transform nodes - */ -export class WindowTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new WindowTransformNode(null, duplicate(this.transform)); - } - addDimensions(fields) { - this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); - } - dependentFields() { - var _a, _b; - const out = new Set(); - ((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []).forEach(out.add, out); - ((_b = this.transform.sort) !== null && _b !== void 0 ? _b : []).forEach(m => out.add(m.field)); - this.transform.window - .map(w => w.field) - .filter(f => f !== undefined) - .forEach(out.add, out); - return out; - } - producedFields() { - return new Set(this.transform.window.map(this.getDefaultName)); - } - getDefaultName(windowFieldDef) { - var _a; - return (_a = windowFieldDef.as) !== null && _a !== void 0 ? _a : vgField(windowFieldDef); - } - hash() { - return `WindowTransform ${hash(this.transform)}`; - } - assemble() { - var _a; - const fields = []; - const ops = []; - const as = []; - const params = []; - for (const window of this.transform.window) { - ops.push(window.op); - as.push(this.getDefaultName(window)); - params.push(window.param === undefined ? null : window.param); - fields.push(window.field === undefined ? null : window.field); - } - const frame = this.transform.frame; - const groupby = this.transform.groupby; - if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) { - // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate - return Object.assign({ type: 'joinaggregate', as, ops: ops, fields }, (groupby !== undefined ? { groupby } : {})); - } - const sortFields = []; - const sortOrder = []; - if (this.transform.sort !== undefined) { - for (const sortField of this.transform.sort) { - sortFields.push(sortField.field); - sortOrder.push((_a = sortField.order) !== null && _a !== void 0 ? _a : 'ascending'); - } - } - const sort = { - field: sortFields, - order: sortOrder - }; - const ignorePeers = this.transform.ignorePeers; - return Object.assign(Object.assign(Object.assign({ type: 'window', params, - as, - ops, - fields, - sort }, (ignorePeers !== undefined ? { ignorePeers } : {})), (groupby !== undefined ? { groupby } : {})), (frame !== undefined ? { frame } : {})); - } -} -//# sourceMappingURL=window.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/data/window.js.map b/node_modules/vega-lite/build/src/compile/data/window.js.map deleted file mode 100644 index da5b6e6..0000000 --- a/node_modules/vega-lite/build/src/compile/data/window.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"window.js","sourceRoot":"","sources":["../../../../src/compile/data/window.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAKnD,YAAY,MAAoB,EAAmB,SAA0B;QAC3E,KAAK,CAAC,MAAM,CAAC,CAAC;QADmC,cAAS,GAAT,SAAS,CAAiB;IAE7E,CAAC;IANM,KAAK;QACV,OAAO,IAAI,mBAAmB,CAAC,IAAI,EAAE,SAAS,CAAC,IAA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CAAC,IAAI,KAAK,SAAS,EAAE;YACrC,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;gBAC3C,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACjC,SAAS,CAAC,IAAI,OAAC,SAAS,CAAC,KAAK,mCAAI,WAAW,CAAC,CAAC;aAChD;SACF;QACD,MAAM,IAAI,GAAiB;YACzB,KAAK,EAAE,UAAU;YACjB,KAAK,EAAE,SAAS;SACjB,CAAC;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;QAE/C,OAAO,4CACL,IAAI,EAAE,QAAQ,EACd,MAAM;YACN,EAAE;YACF,GAAG;YACH,MAAM;YACN,IAAI,IACD,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAChD,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACxC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CACnB,CAAC;IACzB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/facet.d.ts b/node_modules/vega-lite/build/src/compile/facet.d.ts deleted file mode 100644 index 98c4301..0000000 --- a/node_modules/vega-lite/build/src/compile/facet.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { NewSignal } from 'vega'; -import { ExtendedChannel } from '../channel'; -import { FieldRefOption, TypedFieldDef } from '../channeldef'; -import { Config } from '../config'; -import { EncodingSortField } from '../sort'; -import { NormalizedFacetSpec } from '../spec'; -import { EncodingFacetMapping, FacetFieldDef } from '../spec/facet'; -import { VgData, VgLayout, VgMarkGroup } from '../vega.schema'; -import { Model, ModelWithField } from './model'; -export declare function facetSortFieldName(fieldDef: FacetFieldDef, sort: EncodingSortField, opt?: FieldRefOption): string; -export declare class FacetModel extends ModelWithField { - readonly facet: EncodingFacetMapping; - readonly child: Model; - readonly children: Model[]; - constructor(spec: NormalizedFacetSpec, parent: Model, parentGivenName: string, config: Config); - private initFacet; - channelHasField(channel: ExtendedChannel): boolean; - fieldDef(channel: ExtendedChannel): TypedFieldDef; - parseData(): void; - parseLayoutSize(): void; - parseSelections(): void; - parseMarkGroup(): void; - parseAxesAndHeaders(): void; - assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[]; - assembleSignals(): NewSignal[]; - assembleSelectionData(data: readonly VgData[]): readonly VgData[]; - private getHeaderLayoutMixins; - protected assembleDefaultLayout(): VgLayout; - assembleLayoutSignals(): NewSignal[]; - private columnDistinctSignal; - assembleGroup(signals: NewSignal[]): any; - /** - * Aggregate cardinality for calculating size - */ - private getCardinalityAggregateForChild; - private assembleFacet; - private facetSortFields; - private facetSortOrder; - private assembleLabelTitle; - assembleMarks(): VgMarkGroup[]; - protected getMapping(): EncodingFacetMapping; -} -//# sourceMappingURL=facet.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/facet.d.ts.map b/node_modules/vega-lite/build/src/compile/facet.d.ts.map deleted file mode 100644 index d1c0883..0000000 --- a/node_modules/vega-lite/build/src/compile/facet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facet.d.ts","sourceRoot":"","sources":["../../../src/compile/facet.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,SAAS,EAAC,MAAM,MAAM,CAAC;AAGzD,OAAO,EAAS,eAAe,EAA6D,MAAM,YAAY,CAAC;AAC/G,OAAO,EAAY,cAAc,EAAkB,aAAa,EAAU,MAAM,eAAe,CAAC;AAChG,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAkB,iBAAiB,EAAyB,MAAM,SAAS,CAAC;AACnF,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CA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C,OAAO,CAAC,aAAa;IA0DrB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,kBAAkB;IAwBnB,aAAa,IAAI,WAAW,EAAE;IAkCrC,SAAS,CAAC,UAAU;CAGrB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/facet.js b/node_modules/vega-lite/build/src/compile/facet.js deleted file mode 100644 index 489fb78..0000000 --- a/node_modules/vega-lite/build/src/compile/facet.js +++ /dev/null @@ -1,328 +0,0 @@ -import { isArray } from 'vega-util'; -import { isBinning } from '../bin'; -import { COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW } from '../channel'; -import { initChannelDef, vgField } from '../channeldef'; -import { reduce } from '../encoding'; -import * as log from '../log'; -import { hasDiscreteDomain } from '../scale'; -import { DEFAULT_SORT_OP, isSortField } from '../sort'; -import { isFacetMapping } from '../spec/facet'; -import { contains } from '../util'; -import { isVgRangeStep } from '../vega.schema'; -import { buildModel } from './buildmodel'; -import { assembleFacetData } from './data/assemble'; -import { sortArrayIndexField } from './data/calculate'; -import { parseData } from './data/parse'; -import { assembleLabelTitle } from './header/assemble'; -import { getHeaderChannel, getHeaderProperty } from './header/common'; -import { HEADER_CHANNELS, HEADER_TYPES } from './header/component'; -import { parseFacetHeaders } from './header/parse'; -import { parseChildrenLayoutSize } from './layoutsize/parse'; -import { ModelWithField } from './model'; -import { assembleDomain, getFieldFromDomain } from './scale/domain'; -import { assembleFacetSignals } from './selection/assemble'; -export function facetSortFieldName(fieldDef, sort, opt) { - return vgField(sort, Object.assign({ suffix: `by_${vgField(fieldDef)}` }, (opt !== null && opt !== void 0 ? opt : {}))); -} -export class FacetModel extends ModelWithField { - constructor(spec, parent, parentGivenName, config) { - super(spec, 'facet', parent, parentGivenName, config, spec.resolve); - this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config); - this.children = [this.child]; - this.facet = this.initFacet(spec.facet, config); - } - initFacet(facet, config) { - // clone to prevent side effect to the original spec - if (!isFacetMapping(facet)) { - return { facet: initChannelDef(facet, 'facet', config) }; - } - return reduce(facet, (normalizedFacet, fieldDef, channel) => { - if (!contains([ROW, COLUMN], channel)) { - // Drop unsupported channel - log.warn(log.message.incompatibleChannel(channel, 'facet')); - return normalizedFacet; - } - if (fieldDef.field === undefined) { - log.warn(log.message.emptyFieldDef(fieldDef, channel)); - return normalizedFacet; - } - // Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. - normalizedFacet[channel] = initChannelDef(fieldDef, channel, config); - return normalizedFacet; - }, {}); - } - channelHasField(channel) { - return !!this.facet[channel]; - } - fieldDef(channel) { - return this.facet[channel]; - } - parseData() { - this.component.data = parseData(this); - this.child.parseData(); - } - parseLayoutSize() { - parseChildrenLayoutSize(this); - } - parseSelections() { - // As a facet has a single child, the selection components are the same. - // The child maintains its selections to assemble signals, which remain - // within its unit. - this.child.parseSelections(); - this.component.selection = this.child.component.selection; - } - parseMarkGroup() { - this.child.parseMarkGroup(); - } - parseAxesAndHeaders() { - this.child.parseAxesAndHeaders(); - parseFacetHeaders(this); - } - assembleSelectionTopLevelSignals(signals) { - return this.child.assembleSelectionTopLevelSignals(signals); - } - assembleSignals() { - this.child.assembleSignals(); - return []; - } - assembleSelectionData(data) { - return this.child.assembleSelectionData(data); - } - getHeaderLayoutMixins() { - var _a, _b, _c; - const layoutMixins = {}; - for (const channel of FACET_CHANNELS) { - for (const headerType of HEADER_TYPES) { - const layoutHeaderComponent = this.component.layoutHeaders[channel]; - const headerComponent = layoutHeaderComponent[headerType]; - const { facetFieldDef } = layoutHeaderComponent; - if (facetFieldDef) { - const titleOrient = getHeaderProperty('titleOrient', facetFieldDef, this.config, channel); - if (contains(['right', 'bottom'], titleOrient)) { - const headerChannel = getHeaderChannel(channel, titleOrient); - layoutMixins.titleAnchor = (_a = layoutMixins.titleAnchor) !== null && _a !== void 0 ? _a : {}; - layoutMixins.titleAnchor[headerChannel] = 'end'; - } - } - if (headerComponent === null || headerComponent === void 0 ? void 0 : headerComponent[0]) { - // set header/footerBand - const sizeType = channel === 'row' ? 'height' : 'width'; - const bandType = headerType === 'header' ? 'headerBand' : 'footerBand'; - if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) { - // If facet child does not have size signal, then apply headerBand - layoutMixins[bandType] = (_b = layoutMixins[bandType]) !== null && _b !== void 0 ? _b : {}; - layoutMixins[bandType][channel] = 0.5; - } - if (layoutHeaderComponent.title) { - layoutMixins.offset = (_c = layoutMixins.offset) !== null && _c !== void 0 ? _c : {}; - layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10; - } - } - } - } - return layoutMixins; - } - assembleDefaultLayout() { - const { column, row } = this.facet; - const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined; - let align = 'all'; - // Do not align the cells if the scale corresponding to the direction is indepent. - // We always align when we facet into both row and column. - if (!row && this.component.resolve.scale.x === 'independent') { - align = 'none'; - } - else if (!column && this.component.resolve.scale.y === 'independent') { - align = 'none'; - } - return Object.assign(Object.assign(Object.assign({}, this.getHeaderLayoutMixins()), (columns ? { columns } : {})), { bounds: 'full', align }); - } - assembleLayoutSignals() { - // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales. - return this.child.assembleLayoutSignals(); - } - columnDistinctSignal() { - if (this.parent && this.parent instanceof FacetModel) { - // For nested facet, we will add columns to group mark instead - // See discussion in https://github.com/vega/vega/issues/952 - // and https://github.com/vega/vega-view/releases/tag/v1.2.6 - return undefined; - } - else { - // In facetNode.assemble(), the name is always this.getName('column') + '_layout'. - const facetLayoutDataName = this.getName('column_domain'); - return { signal: `length(data('${facetLayoutDataName}'))` }; - } - } - assembleGroup(signals) { - if (this.parent && this.parent instanceof FacetModel) { - // Provide number of columns for layout. - // See discussion in https://github.com/vega/vega/issues/952 - // and https://github.com/vega/vega-view/releases/tag/v1.2.6 - return Object.assign(Object.assign({}, (this.channelHasField('column') - ? { - encode: { - update: { - // TODO(https://github.com/vega/vega-lite/issues/2759): - // Correct the signal for facet of concat of facet_column - columns: { field: vgField(this.facet.column, { prefix: 'distinct' }) } - } - } - } - : {})), super.assembleGroup(signals)); - } - return super.assembleGroup(signals); - } - /** - * Aggregate cardinality for calculating size - */ - getCardinalityAggregateForChild() { - const fields = []; - const ops = []; - const as = []; - if (this.child instanceof FacetModel) { - if (this.child.channelHasField('column')) { - const field = vgField(this.child.facet.column); - fields.push(field); - ops.push('distinct'); - as.push(`distinct_${field}`); - } - } - else { - for (const channel of POSITION_SCALE_CHANNELS) { - const childScaleComponent = this.child.component.scales[channel]; - if (childScaleComponent && !childScaleComponent.merged) { - const type = childScaleComponent.get('type'); - const range = childScaleComponent.get('range'); - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const domain = assembleDomain(this.child, channel); - const field = getFieldFromDomain(domain); - if (field) { - fields.push(field); - ops.push('distinct'); - as.push(`distinct_${field}`); - } - else { - log.warn(log.message.unknownField(channel)); - } - } - } - } - } - return { fields, ops, as }; - } - assembleFacet() { - const { name, data } = this.component.data.facetRoot; - const { row, column } = this.facet; - const { fields, ops, as } = this.getCardinalityAggregateForChild(); - const groupby = []; - for (const channel of FACET_CHANNELS) { - const fieldDef = this.facet[channel]; - if (fieldDef) { - groupby.push(vgField(fieldDef)); - const { bin, sort } = fieldDef; - if (isBinning(bin)) { - groupby.push(vgField(fieldDef, { binSuffix: 'end' })); - } - if (isSortField(sort)) { - const { field, op = DEFAULT_SORT_OP } = sort; - const outputName = facetSortFieldName(fieldDef, sort); - if (row && column) { - // For crossed facet, use pre-calculate field as it requires a different groupby - // For each calculated field, apply max and assign them to the same name as - // all values of the same group should be the same anyway. - fields.push(outputName); - ops.push('max'); - as.push(outputName); - } - else { - fields.push(field); - ops.push(op); - as.push(outputName); - } - } - else if (isArray(sort)) { - const outputName = sortArrayIndexField(fieldDef, channel); - fields.push(outputName); - ops.push('max'); - as.push(outputName); - } - } - } - const cross = !!row && !!column; - return Object.assign({ name, - data, - groupby }, (cross || fields.length > 0 - ? { - aggregate: Object.assign(Object.assign({}, (cross ? { cross } : {})), (fields.length ? { fields, ops, as } : {})) - } - : {})); - } - facetSortFields(channel) { - const { facet } = this; - const fieldDef = facet[channel]; - if (fieldDef) { - if (isSortField(fieldDef.sort)) { - return [facetSortFieldName(fieldDef, fieldDef.sort, { expr: 'datum' })]; - } - else if (isArray(fieldDef.sort)) { - return [sortArrayIndexField(fieldDef, channel, { expr: 'datum' })]; - } - return [vgField(fieldDef, { expr: 'datum' })]; - } - return []; - } - facetSortOrder(channel) { - const { facet } = this; - const fieldDef = facet[channel]; - if (fieldDef) { - const { sort } = fieldDef; - const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending'; - return [order]; - } - return []; - } - assembleLabelTitle() { - const { facet, config } = this; - if (facet.facet) { - // Facet always uses title to display labels - return assembleLabelTitle(facet.facet, 'facet', config); - } - const ORTHOGONAL_ORIENT = { - row: ['top', 'bottom'], - column: ['left', 'right'] - }; - for (const channel of HEADER_CHANNELS) { - if (facet[channel]) { - const labelOrient = getHeaderProperty('labelOrient', facet[channel], config, channel); - if (contains(ORTHOGONAL_ORIENT[channel], labelOrient)) { - // Row/Column with orthogonal labelOrient must use title to display labels - return assembleLabelTitle(facet[channel], channel, config); - } - } - } - return undefined; - } - assembleMarks() { - const { child } = this; - // If we facet by two dimensions, we need to add a cross operator to the aggregation - // so that we create all groups - const facetRoot = this.component.data.facetRoot; - const data = assembleFacetData(facetRoot); - const encodeEntry = child.assembleGroupEncodeEntry(false); - const title = this.assembleLabelTitle() || child.assembleTitle(); - const style = child.assembleGroupStyle(); - const markGroup = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name: this.getName('cell'), type: 'group' }, (title ? { title } : {})), (style ? { style } : {})), { from: { - facet: this.assembleFacet() - }, - // TODO: move this to after data - sort: { - field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(), - order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat() - } }), (data.length > 0 ? { data: data } : {})), (encodeEntry ? { encode: { update: encodeEntry } } : {})), child.assembleGroup(assembleFacetSignals(this, []))); - return [markGroup]; - } - getMapping() { - return this.facet; - } -} -//# sourceMappingURL=facet.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/facet.js.map b/node_modules/vega-lite/build/src/compile/facet.js.map deleted file mode 100644 index fa279cf..0000000 --- a/node_modules/vega-lite/build/src/compile/facet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facet.js","sourceRoot":"","sources":["../../../src/compile/facet.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,MAAM,EAAiC,cAAc,EAAE,uBAAuB,EAAE,GAAG,EAAC,MAAM,YAAY,CAAC;AAC/G,OAAO,EAA4B,cAAc,EAAiB,OAAO,EAAC,MAAM,eAAe,CAAC;AAEhG,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAC,eAAe,EAAqB,WAAW,EAAY,MAAM,SAAS,CAAC;AAEnF,OAAO,EAAoD,cAAc,EAAC,MAAM,eAAe,CAAC;AAChG,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACjC,OAAO,EAAC,aAAa,EAAgC,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,g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src/compile/format.d.ts deleted file mode 100644 index 716acef..0000000 --- a/node_modules/vega-lite/build/src/compile/format.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { SignalRef } from 'vega-typings/types'; -import { DatumDef, FieldDef } from '../channeldef'; -import { Config } from '../config'; -import { ScaleType } from '../scale'; -import { Type } from '../type'; -import { Dict } from '../util'; -import { TimeUnit } from './../timeunit'; -export declare function isCustomFormatType(formatType: string): boolean; -export declare const BIN_RANGE_DELIMITER = " \u2013 "; -export declare function formatSignalRef({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config }: { - fieldOrDatumDef: FieldDef | DatumDef; - format: string | Dict; - formatType: string; - expr?: 'datum' | 'parent' | 'datum.datum'; - normalizeStack?: boolean; - config: Config; -}): { - signal: string; -}; -export declare function formatCustomType({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config, field }: { - fieldOrDatumDef: FieldDef | DatumDef; - format: string | Dict; - formatType: string; - expr?: 'datum' | 'parent' | 'datum.datum'; - normalizeStack?: boolean; - config: Config; - field?: string; -}): { - signal: string; -}; -export declare function guideFormat(fieldOrDatumDef: FieldDef | DatumDef, type: Type, format: string | Dict, formatType: string, config: Config, omitTimeFormatConfig: boolean): string | { - signal: string; -}; -export declare function guideFormatType(formatType: string | SignalRef, fieldOrDatumDef: FieldDef | DatumDef, scaleType: ScaleType): SignalRef | "time" | "number"; -/** - * Returns number format for a fieldDef. - */ -export declare function numberFormat(type: Type, specifiedFormat: string | Dict, config: Config): string; -/** - * Returns time format for a fieldDef for use in guides. - */ -export declare function timeFormat(specifiedFormat: string, timeUnit: TimeUnit, config: Config, omitTimeFormatConfig: boolean): string | { - signal: string; -}; -export declare function binFormatExpression(startField: string, endField: string, format: string | Dict, formatType: string, config: Config): string; -/** - * Returns the time expression used for axis/legend labels or text mark for a temporal field - */ -export declare function timeFormatExpression(field: string, timeUnit: TimeUnit, format: string | Dict, rawTimeFormat: string, // should be provided only for actual text and headers, not axis/legend labels -isUTCScale: boolean): string; -//# sourceMappingURL=format.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/format.d.ts.map b/node_modules/vega-lite/build/src/compile/format.d.ts.map deleted file mode 100644 index 147cd8c..0000000 --- a/node_modules/vega-lite/build/src/compile/format.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/compile/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAG7C,OAAO,EAEL,QAAQ,EACR,QAAQ,EAKT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAe,IAAI,EAAC,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAGvC,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,WAEpD;AAMD,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C,wBAAgB,eAAe,CAAC,EAC9B,eAAe,EACf,MAAM,EACN,UAAU,EACV,IAAI,EACJ,cAAc,EACd,MAAM,EACP,EAAE;IACD,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;;EAqCA;AAqBD,wBAAgB,gBAAgB,CAAC,EAC/B,eAAe,EACf,MAAM,EACN,UAAU,EACV,IAAI,EACJ,cAAc,EACd,MAAM,E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AAE,MAAM,UAKf;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAC9B,aAAa,EAAE,MAAM,EAAE,8EAA8E;AACrG,UAAU,EAAE,OAAO,GAClB,MAAM,CAQR"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/format.js b/node_modules/vega-lite/build/src/compile/format.js deleted file mode 100644 index 4f16adf..0000000 --- a/node_modules/vega-lite/build/src/compile/format.js +++ /dev/null @@ -1,153 +0,0 @@ -import { isString } from 'vega-util'; -import { isBinning } from '../bin'; -import { channelDefType, isFieldDef, isFieldOrDatumDefForTimeFormat, isScaleFieldDef, vgField } from '../channeldef'; -import { fieldValidPredicate } from '../predicate'; -import { ScaleType } from '../scale'; -import { formatExpression, normalizeTimeUnit, timeUnitSpecifierExpression } from '../timeunit'; -import { QUANTITATIVE } from '../type'; -import { isSignalRef } from '../vega.schema'; -import { datumDefToExpr } from './mark/encode/valueref'; -export function isCustomFormatType(formatType) { - return formatType && formatType !== 'number' && formatType !== 'time'; -} -function customFormatExpr(formatType, field, format) { - return `${formatType}(${field}${format ? `, ${JSON.stringify(format)}` : ''})`; -} -export const BIN_RANGE_DELIMITER = ' \u2013 '; -export function formatSignalRef({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config }) { - var _a, _b; - if (isCustomFormatType(formatType)) { - return formatCustomType({ - fieldOrDatumDef, - format, - formatType, - expr, - config - }); - } - const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack); - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { - const signal = timeFormatExpression(field, isFieldDef(fieldOrDatumDef) ? (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit : undefined, format, config.timeFormat, isScaleFieldDef(fieldOrDatumDef) && ((_b = fieldOrDatumDef.scale) === null || _b === void 0 ? void 0 : _b.type) === ScaleType.UTC); - return signal ? { signal } : undefined; - } - format = numberFormat(channelDefType(fieldOrDatumDef), format, config); - if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { - const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' }); - return { - signal: binFormatExpression(field, endField, format, formatType, config) - }; - } - else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') { - return { - signal: `${formatExpr(field, format)}` - }; - } - else { - return { signal: `isValid(${field}) ? ${field} : ""+${field}` }; - } -} -function fieldToFormat(fieldOrDatumDef, expr, normalizeStack) { - if (isFieldDef(fieldOrDatumDef)) { - if (normalizeStack) { - return `${vgField(fieldOrDatumDef, { expr, suffix: 'end' })}-${vgField(fieldOrDatumDef, { - expr, - suffix: 'start' - })}`; - } - else { - return vgField(fieldOrDatumDef, { expr }); - } - } - else { - return datumDefToExpr(fieldOrDatumDef); - } -} -export function formatCustomType({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config, field }) { - field = field !== null && field !== void 0 ? field : fieldToFormat(fieldOrDatumDef, expr, normalizeStack); - if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { - const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' }); - return { - signal: binFormatExpression(field, endField, format, formatType, config) - }; - } - return { signal: customFormatExpr(formatType, field, format) }; -} -export function guideFormat(fieldOrDatumDef, type, format, formatType, config, omitTimeFormatConfig // axis doesn't use config.timeFormat -) { - var _a; - if (isCustomFormatType(formatType)) { - return undefined; // handled in encode block - } - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { - const timeUnit = isFieldDef(fieldOrDatumDef) ? (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit : undefined; - return timeFormat(format, timeUnit, config, omitTimeFormatConfig); - } - return numberFormat(type, format, config); -} -export function guideFormatType(formatType, fieldOrDatumDef, scaleType) { - if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) { - return formatType; - } - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') { - return 'time'; - } - return undefined; -} -/** - * Returns number format for a fieldDef. - */ -export function numberFormat(type, specifiedFormat, config) { - // Specified format in axis/legend has higher precedence than fieldDef.format - if (isString(specifiedFormat)) { - return specifiedFormat; - } - if (type === QUANTITATIVE) { - // we only apply the default if the field is quantitative - return config.numberFormat; - } - return undefined; -} -/** - * Returns time format for a fieldDef for use in guides. - */ -export function timeFormat(specifiedFormat, timeUnit, config, omitTimeFormatConfig) { - if (specifiedFormat) { - return specifiedFormat; - } - if (timeUnit) { - return { - signal: timeUnitSpecifierExpression(timeUnit) - }; - } - return omitTimeFormatConfig ? undefined : config.timeFormat; -} -function formatExpr(field, format) { - return `format(${field}, "${format || ''}")`; -} -function binNumberFormatExpr(field, format, formatType, config) { - var _a; - if (isCustomFormatType(formatType)) { - return customFormatExpr(formatType, field, format); - } - return formatExpr(field, (_a = (isString(format) ? format : undefined)) !== null && _a !== void 0 ? _a : config.numberFormat); -} -export function binFormatExpression(startField, endField, format, formatType, config) { - const start = binNumberFormatExpr(startField, format, formatType, config); - const end = binNumberFormatExpr(endField, format, formatType, config); - return `${fieldValidPredicate(startField, false)} ? "null" : ${start} + "${BIN_RANGE_DELIMITER}" + ${end}`; -} -/** - * Returns the time expression used for axis/legend labels or text mark for a temporal field - */ -export function timeFormatExpression(field, timeUnit, format, rawTimeFormat, // should be provided only for actual text and headers, not axis/legend labels -isUTCScale) { - if (!timeUnit || format) { - // If there is no time unit, or if user explicitly specifies format for axis/legend/text. - format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit. - return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`; - } - else { - return formatExpression(timeUnit, field, isUTCScale); - } -} -//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/format.js.map b/node_modules/vega-lite/build/src/compile/format.js.map deleted file mode 100644 index 953254a..0000000 --- a/node_modules/vega-lite/build/src/compile/format.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/compile/format.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EACL,cAAc,EAGd,UAAU,EACV,8BAA8B,EAC9B,eAAe,EACf,OAAO,EACR,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAC,gBAAgB,EAAE,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAC,YAAY,EAAO,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAEtD,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,OAAO,UAAU,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,MAAM,CAAC;AACxE,CAAC;AAED,SAAS,gBAAgB,CAAC,UAAkB,EAAE,KAAa,EAAE,MAA8B;IACzF,OAAO,GAAG,UAAU,IAAI,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;AACjF,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;AAE9C,MAAM,UAAU,eAAe,CAAC,EAC9B,eAAe,EACf,MAAM,EACN,UAAU,EACV,IAAI,EACJ,cAAc,EACd,MAAM,EAQP;;IACC,IAAI,kBAAkB,CAAC,UAAU,CAAC,EAAE;QAClC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E,8EAA8E;AACrG,UAAmB;IAEnB,IAAI,CAAC,QAAQ,IAAI,MAAM,EAAE;QACvB,yFAAyF;QACzF,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,wDAAwD;QAC5G,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,UAAU,KAAK,MAAM,MAAM,IAAI,CAAC;KACtE;SAAM;QACL,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;KACtD;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/guide.d.ts b/node_modules/vega-lite/build/src/compile/guide.d.ts deleted file mode 100644 index 155be9c..0000000 --- a/node_modules/vega-lite/build/src/compile/guide.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { GuideEncodingEntry } from '../guide'; -import { UnitModel } from './unit'; -export declare function guideEncodeEntry(encoding: GuideEncodingEntry, model: UnitModel): {}; -//# sourceMappingURL=guide.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/guide.d.ts.map b/node_modules/vega-lite/build/src/compile/guide.d.ts.map deleted file mode 100644 index b23ef67..0000000 --- a/node_modules/vega-lite/build/src/compile/guide.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"guide.d.ts","sourceRoot":"","sources":["../../../src/compile/guide.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAI5C,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEjC,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,MAQ9E"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/guide.js b/node_modules/vega-lite/build/src/compile/guide.js deleted file mode 100644 index fd0d670..0000000 --- a/node_modules/vega-lite/build/src/compile/guide.js +++ /dev/null @@ -1,10 +0,0 @@ -import { keys } from '../util'; -import { isSignalRef } from '../vega.schema'; -import { wrapCondition } from './mark/encode'; -export function guideEncodeEntry(encoding, model) { - return keys(encoding).reduce((encode, channel) => { - const valueDef = encoding[channel]; - return Object.assign(Object.assign({}, encode), wrapCondition(model, valueDef, channel, (x) => (isSignalRef(x) ? x : { value: x.value }))); - }, {}); -} -//# sourceMappingURL=guide.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/guide.js.map b/node_modules/vega-lite/build/src/compile/guide.js.map deleted file mode 100644 index 1440c26..0000000 --- a/node_modules/vega-lite/build/src/compile/guide.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"guide.js","sourceRoot":"","sources":["../../../src/compile/guide.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,WAAW,EAAkB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAG5C,MAAM,UAAU,gBAAgB,CAAC,QAA4B,EAAE,KAAgB;IAC7E,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,OAAwB,EAAE,EAAE;QAChE,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QACnC,uCACK,MAAM,GACN,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAuB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAC,CAAC,CAAC,EAChH;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/assemble.d.ts b/node_modules/vega-lite/build/src/compile/header/assemble.d.ts deleted file mode 100644 index 35061df..0000000 --- a/node_modules/vega-lite/build/src/compile/header/assemble.d.ts +++ /dev/null @@ -1,1049 +0,0 @@ -/** - * Utility for generating row / column headers - */ -import { TitleAnchor, TitleConfig } from 'vega'; -import { FacetChannel } from '../../channel'; -import { Config } from '../../config'; -import { CoreHeader } from '../../header'; -import { FacetFieldDef } from '../../spec/facet'; -import { RowCol, VgComparator, VgMarkGroup, VgTitle } from '../../vega.schema'; -import { Model } from '../model'; -import { HeaderChannel, HeaderComponent, HeaderType, LayoutHeaderComponent, LayoutHeaderComponentIndex } from './component'; -export declare function assembleTitleGroup(model: Model, channel: FacetChannel): { - name: string; - type: string; - role: string; - title: { - text: string | string[] | import("vega").SignalRef; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame?: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").Align; - }; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame?: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame?: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align?: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame?: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").Align; - }; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame?: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame?: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align?: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - }; -}; -export declare function defaultHeaderGuideAlign(headerChannel: HeaderChannel, angle: number, anchor?: TitleAnchor): { - align: string; -} | { - align: import("vega").SignalRef | "left" | "center" | "right"; -} | { - align?: undefined; -}; -export declare function defaultHeaderGuideBaseline(angle: number, channel: FacetChannel): { - baseline: string | { - signal: string; - }; -} | { - baseline?: undefined; -}; -export declare function assembleHeaderGroups(model: Model, channel: HeaderChannel): VgMarkGroup[]; -export declare function assembleLabelTitle(facetFieldDef: FacetFieldDef, channel: FacetChannel, config: Config): { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").Align; - }; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; -} | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; -} | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align?: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; -} | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").Align; - }; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; -} | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; -} | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align?: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; -}; -export declare function assembleHeaderGroup(model: Model, channel: HeaderChannel, headerType: HeaderType, layoutHeader: LayoutHeaderComponent, headerComponent: HeaderComponent): { - axes?: import("vega").Axis[]; - encode?: { - update: { - [x: string]: { - signal: string; - }; - }; - }; - title?: { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").Align; - }; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align?: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").Align; - }; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align?: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - }; - from: { - data: string; - } | { - data: string; - }; - sort: VgComparator; - name: string; - type: string; - role: string; -} | { - axes?: import("vega").Axis[]; - encode?: { - update: { - [x: string]: { - signal: string; - }; - }; - }; - title?: { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").Align; - }; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align?: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").TextBaseline; - } | { - signal: string; - }; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align: string | import("vega").SignalRef | { - field: import("vega").Field; - } | { - scale: import("vega").Field; - value: string | number | boolean; - } | { - scale: import("vega").Field; - field: import("vega").Field; - } | { - scale: import("vega").Field; - band: number | boolean; - } | { - scale: import("vega").Field; - range: number | boolean; - } | { - value: import("vega").Align; - }; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - } | { - text: string | string[] | import("vega").SignalRef | { - signal: string; - }; - subtitle?: string | string[] | import("vega").SignalRef; - name?: string; - interactive?: boolean; - style: import("vega").Text; - encode?: import("vega").TitleEncode | Partial>; - anchor?: import("vega").AnchorValue; - frame: import("vega").StringValue; - offset?: import("vega").NumberValue; - orient?: import("vega").ScaleField; - aria?: boolean; - align?: import("vega").AlignValue; - angle?: import("vega").NumberValue; - baseline?: import("vega").TextBaselineValue; - dx?: import("vega").NumberValue; - dy?: import("vega").NumberValue; - limit?: import("vega").NumberValue; - color?: import("vega").ColorValue; - font?: import("vega").StringValue; - fontSize?: import("vega").NumberValue; - fontStyle?: import("vega").StringValue; - fontWeight?: import("vega").FontWeightValue; - lineHeight?: import("vega").NumberValue; - subtitleColor?: import("vega").ColorValue; - subtitleFont?: import("vega").StringValue; - subtitleFontSize?: import("vega").NumberValue; - subtitleFontStyle?: import("vega").StringValue; - subtitleFontWeight?: import("vega").FontWeightValue; - subtitleLineHeight?: import("vega").NumberValue; - subtitlePadding?: import("vega").NumberValue; - zindex?: number; - }; - from?: { - data: string; - }; - name: string; - type: string; - role: string; -}; -export declare function getLayoutTitleBand(titleAnchor: TitleAnchor, headerChannel: HeaderChannel): any; -export declare function assembleLayoutTitleBand(headerComponentIndex: LayoutHeaderComponentIndex, config: Config): RowCol; -export declare function assembleHeaderProperties(config: Config, facetFieldDef: FacetFieldDef, channel: FacetChannel, properties: (keyof CoreHeader)[], propertiesMap: Partial>): Partial; -//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/assemble.d.ts.map b/node_modules/vega-lite/build/src/compile/header/assemble.d.ts.map deleted file mode 100644 index 3290083..0000000 --- a/node_modules/vega-lite/build/src/compile/header/assemble.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/header/assemble.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAiB,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EACL,UAAU,EAKX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAI7E,OAAO,EAAe,KAAK,EAAC,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,EAEV,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,aAAa,CAAC;AAGrB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DjC;AAaD,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,OAExF;AAED,wBAAgB,uBAAuB,CACrC,oBAAoB,EAAE,0BAA0B,EAChD,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,CAAC,CAsBhB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,EACpC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,CAAC,MAAM,UAAU,CAAC,EAAE,EAChC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,UAAU,EAAE,MAAM,WAAW,CAAC,CAAC,GAClE,OAAO,CAAC,OAAO,CAAC,CAalB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/assemble.js b/node_modules/vega-lite/build/src/compile/header/assemble.js deleted file mode 100644 index ce93178..0000000 --- a/node_modules/vega-lite/build/src/compile/header/assemble.js +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Utility for generating row / column headers - */ -import { isArray } from 'vega-util'; -import { FACET_CHANNELS } from '../../channel'; -import { vgField } from '../../channeldef'; -import { HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP } from '../../header'; -import { isSortField } from '../../sort'; -import { isFacetMapping } from '../../spec/facet'; -import { contains, isEmpty, normalizeAngle, replaceAll } from '../../util'; -import { defaultLabelAlign, defaultLabelBaseline } from '../axis/properties'; -import { sortArrayIndexField } from '../data/calculate'; -import { formatSignalRef } from '../format'; -import { isFacetModel } from '../model'; -import { getHeaderChannel, getHeaderProperties, getHeaderProperty } from './common'; -import { HEADER_TYPES } from './component'; -// TODO: rename to assembleHeaderTitleGroup -export function assembleTitleGroup(model, channel) { - const title = model.component.layoutHeaders[channel].title; - const config = model.config ? model.config : undefined; - const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef - ? model.component.layoutHeaders[channel].facetFieldDef - : undefined; - const { titleAnchor, titleAngle: ta, titleOrient } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef, config, channel); - const headerChannel = getHeaderChannel(channel, titleOrient); - const titleAngle = normalizeAngle(ta); - return { - name: `${channel}-title`, - type: 'group', - role: `${headerChannel}-title`, - title: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ text: title }, (channel === 'row' ? { orient: 'left' } : {})), { style: 'guide-title' }), defaultHeaderGuideBaseline(titleAngle, headerChannel)), defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor)), assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)) - }; -} -export function defaultHeaderGuideAlign(headerChannel, angle, anchor = 'middle') { - switch (anchor) { - case 'start': - return { align: 'left' }; - case 'end': - return { align: 'right' }; - } - const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x'); - return align ? { align } : {}; -} -export function defaultHeaderGuideBaseline(angle, channel) { - const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true); - return baseline ? { baseline } : {}; -} -export function assembleHeaderGroups(model, channel) { - const layoutHeader = model.component.layoutHeaders[channel]; - const groups = []; - for (const headerType of HEADER_TYPES) { - if (layoutHeader[headerType]) { - for (const headerComponent of layoutHeader[headerType]) { - const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent); - if (group != null) { - groups.push(group); - } - } - } - } - return groups; -} -function getSort(facetFieldDef, channel) { - var _a; - const { sort } = facetFieldDef; - if (isSortField(sort)) { - return { - field: vgField(sort, { expr: 'datum' }), - order: (_a = sort.order) !== null && _a !== void 0 ? _a : 'ascending' - }; - } - else if (isArray(sort)) { - return { - field: sortArrayIndexField(facetFieldDef, channel, { expr: 'datum' }), - order: 'ascending' - }; - } - else { - return { - field: vgField(facetFieldDef, { expr: 'datum' }), - order: sort !== null && sort !== void 0 ? sort : 'ascending' - }; - } -} -export function assembleLabelTitle(facetFieldDef, channel, config) { - const { format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr } = getHeaderProperties(['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], facetFieldDef, config, channel); - const titleTextExpr = formatSignalRef({ fieldOrDatumDef: facetFieldDef, format, formatType, expr: 'parent', config }) - .signal; - const headerChannel = getHeaderChannel(channel, labelOrient); - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ text: { - signal: labelExpr - ? replaceAll(replaceAll(labelExpr, 'datum.label', titleTextExpr), 'datum.value', vgField(facetFieldDef, { expr: 'parent' })) - : titleTextExpr - } }, (channel === 'row' ? { orient: 'left' } : {})), { style: 'guide-label', frame: 'group' }), defaultHeaderGuideBaseline(labelAngle, headerChannel)), defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor)), assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)); -} -export function assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent) { - if (headerComponent) { - let title = null; - const { facetFieldDef } = layoutHeader; - const config = model.config ? model.config : undefined; - if (facetFieldDef && headerComponent.labels) { - const { labelOrient } = getHeaderProperties(['labelOrient'], facetFieldDef, config, channel); - // Include label title in the header if orient aligns with the channel - if ((channel === 'row' && !contains(['top', 'bottom'], labelOrient)) || - (channel === 'column' && !contains(['left', 'right'], labelOrient))) { - title = assembleLabelTitle(facetFieldDef, channel, config); - } - } - const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet); - const axes = headerComponent.axes; - const hasAxes = (axes === null || axes === void 0 ? void 0 : axes.length) > 0; - if (title || hasAxes) { - const sizeChannel = channel === 'row' ? 'height' : 'width'; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name: model.getName(`${channel}_${headerType}`), type: 'group', role: `${channel}-${headerType}` }, (layoutHeader.facetFieldDef - ? { - from: { data: model.getName(channel + '_domain') }, - sort: getSort(facetFieldDef, channel) - } - : {})), (hasAxes && isFacetWithoutRowCol - ? { - from: { data: model.getName(`facet_domain_${channel}`) } - } - : {})), (title ? { title } : {})), (headerComponent.sizeSignal - ? { - encode: { - update: { - [sizeChannel]: headerComponent.sizeSignal - } - } - } - : {})), (hasAxes ? { axes } : {})); - } - } - return null; -} -const LAYOUT_TITLE_BAND = { - column: { - start: 0, - end: 1 - }, - row: { - start: 1, - end: 0 - } -}; -export function getLayoutTitleBand(titleAnchor, headerChannel) { - return LAYOUT_TITLE_BAND[headerChannel][titleAnchor]; -} -export function assembleLayoutTitleBand(headerComponentIndex, config) { - const titleBand = {}; - for (const channel of FACET_CHANNELS) { - const headerComponent = headerComponentIndex[channel]; - if (headerComponent === null || headerComponent === void 0 ? void 0 : headerComponent.facetFieldDef) { - const { titleAnchor, titleOrient } = getHeaderProperties(['titleAnchor', 'titleOrient'], headerComponent.facetFieldDef, config, channel); - const headerChannel = getHeaderChannel(channel, titleOrient); - const band = getLayoutTitleBand(titleAnchor, headerChannel); - if (band !== undefined) { - titleBand[headerChannel] = band; - } - } - } - return isEmpty(titleBand) ? undefined : titleBand; -} -export function assembleHeaderProperties(config, facetFieldDef, channel, properties, propertiesMap) { - const props = {}; - for (const prop of properties) { - if (!propertiesMap[prop]) { - continue; - } - const value = getHeaderProperty(prop, facetFieldDef, config, channel); - if (value !== undefined) { - props[propertiesMap[prop]] = value; - } - } - return props; -} -//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/assemble.js.map b/node_modules/vega-lite/build/src/compile/header/assemble.js.map deleted file mode 100644 index ea1dfc6..0000000 --- a/node_modules/vega-lite/build/src/compile/header/assemble.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/header/assemble.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAe,cAAc,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAEL,uBAAuB,EACvB,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAgB,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAC,eAAe,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAQ,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAClF,OAAO,EAIL,YAAY,EAGb,MAAM,aAAa,CAAC;AAErB,2CAA2C;AAC3C,MAAM,UAAU,kBAAkB,CAAC,KAAY,EAAE,OAAqB;IACpE,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IAC3D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AC,aAAa,CAAC,GAAG,IAAI,CAAC;aACjC;SACF;KACF;IAED,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAAc,EACd,aAAoC,EACpC,OAAqB,EACrB,UAAgC,EAChC,aAAmE;IAEnE,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;QAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;YACxB,SAAS;SACV;QAED,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACtE,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;SACpC;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/common.d.ts b/node_modules/vega-lite/build/src/compile/header/common.d.ts deleted file mode 100644 index 1931bc4..0000000 --- a/node_modules/vega-lite/build/src/compile/header/common.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Orient } from 'vega'; -import { FacetChannel } from '../../channel'; -import { Config } from '../../config'; -import { Header } from '../../header'; -import { FacetFieldDef } from '../../spec/facet'; -import { HeaderChannel } from './component'; -/** - * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet. - */ -export declare function getHeaderChannel(channel: FacetChannel, orient: Orient): HeaderChannel; -export declare function getHeaderProperty

(prop: P, facetFieldDef: FacetFieldDef, config: Config, channel: FacetChannel): Header[P]; -export declare function getHeaderProperties(properties: (keyof Header)[], facetFieldDef: FacetFieldDef, config: Config, channel: FacetChannel): Header; -//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/common.d.ts.map b/node_modules/vega-lite/build/src/compile/header/common.d.ts.map deleted file mode 100644 index 87bc5eb..0000000 --- a/node_modules/vega-lite/build/src/compile/header/common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/compile/header/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAOrF;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,MAAM,EACtD,IAAI,EAAE,CAAC,EACP,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,GACpB,MAAM,CAAC,CAAC,CAAC,CAKX;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,CAAC,MAAM,MAAM,CAAC,EAAE,EAC5B,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,GACpB,MAAM,CASR"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/common.js b/node_modules/vega-lite/build/src/compile/header/common.js deleted file mode 100644 index 8171de2..0000000 --- a/node_modules/vega-lite/build/src/compile/header/common.js +++ /dev/null @@ -1,28 +0,0 @@ -import { contains, getFirstDefined } from '../../util'; -/** - * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet. - */ -export function getHeaderChannel(channel, orient) { - if (contains(['top', 'bottom'], orient)) { - return 'column'; - } - else if (contains(['left', 'right'], orient)) { - return 'row'; - } - return channel === 'row' ? 'row' : 'column'; -} -export function getHeaderProperty(prop, facetFieldDef, config, channel) { - const headerSpecificConfig = channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet; - return getFirstDefined(((facetFieldDef === null || facetFieldDef === void 0 ? void 0 : facetFieldDef.header) || {})[prop], headerSpecificConfig[prop], config.header[prop]); -} -export function getHeaderProperties(properties, facetFieldDef, config, channel) { - const props = {}; - for (const prop of properties) { - const value = getHeaderProperty(prop, facetFieldDef, config, channel); - if (value !== undefined) { - props[prop] = value; - } - } - return props; -} -//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/common.js.map b/node_modules/vega-lite/build/src/compile/header/common.js.map deleted file mode 100644 index b48c550..0000000 --- a/node_modules/vega-lite/build/src/compile/header/common.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/compile/header/common.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AAGrD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAqB,EAAE,MAAc;IACpE,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE;QACvC,OAAO,QAAQ,CAAC;KACjB;SAAM,IAAI,QAAQ,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE;QAC9C,OAAO,KAAK,CAAC;KACd;IACD,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,IAAO,EACP,aAAoC,EACpC,MAAc,EACd,OAAqB;IAErB,MAAM,oBAAoB,GACxB,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IAEzG,OAAO,eAAe,CAAC,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,KAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/G,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,UAA4B,EAC5B,aAAoC,EACpC,MAAc,EACd,OAAqB;IAErB,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;QAC7B,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACtE,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;SACrB;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/component.d.ts b/node_modules/vega-lite/build/src/compile/header/component.d.ts deleted file mode 100644 index 69e2b63..0000000 --- a/node_modules/vega-lite/build/src/compile/header/component.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Utility for generating row / column headers - */ -import { Axis as VgAxis, SignalRef, Text } from 'vega'; -import { FacetFieldDef } from '../../spec/facet'; -export declare type HeaderChannel = 'row' | 'column'; -export declare const HEADER_CHANNELS: HeaderChannel[]; -export declare type HeaderType = 'header' | 'footer'; -export declare const HEADER_TYPES: HeaderType[]; -export interface LayoutHeaderComponentIndex { - row?: LayoutHeaderComponent; - column?: LayoutHeaderComponent; - facet?: LayoutHeaderComponent; -} -/** - * A component that represents all header, footers and title of a Vega group with layout directive. - */ -export interface LayoutHeaderComponent { - title?: Text | SignalRef; - facetFieldDef?: FacetFieldDef; - /** - * An array of header components for headers. - * For facet, there should be only one header component, which is data-driven. - * For concat, there can be multiple header components that explicitly list different axes. - */ - header?: HeaderComponent[]; - /** - * An array of header components for footers. - * For facet, there should be only one header component, which is data-driven. - * For concat, there can be multiple header components that explicitly list different axes. - */ - footer?: HeaderComponent[]; -} -/** - * A component that represents one group of row/column-header/footer. - */ -export interface HeaderComponent { - labels: boolean; - sizeSignal: { - signal: string; - }; - axes: VgAxis[]; -} -//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/component.d.ts.map b/node_modules/vega-lite/build/src/compile/header/component.d.ts.map deleted file mode 100644 index 65f55e5..0000000 --- a/node_modules/vega-lite/build/src/compile/header/component.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/header/component.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,IAAI,IAAI,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C,oBAAY,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC;AAC7C,eAAO,MAAM,eAAe,EAAE,aAAa,EAAsB,CAAC;AAElE,oBAAY,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC7C,eAAO,MAAM,YAAY,EAAE,UAAU,EAAyB,CAAC;AAE/D,MAAM,WAAW,0BAA0B;IACzC,GAAG,CAAC,EAAE,qBAAqB,CAAC;IAC5B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAKzB,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;OAIG;IACH,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAE3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,CAAC;IAEhB,UAAU,EAAE;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAAC;IAE7B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/component.js b/node_modules/vega-lite/build/src/compile/header/component.js deleted file mode 100644 index 6133052..0000000 --- a/node_modules/vega-lite/build/src/compile/header/component.js +++ /dev/null @@ -1,3 +0,0 @@ -export const HEADER_CHANNELS = ['row', 'column']; -export const HEADER_TYPES = ['header', 'footer']; -//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/component.js.map b/node_modules/vega-lite/build/src/compile/header/component.js.map deleted file mode 100644 index 1b340c8..0000000 --- a/node_modules/vega-lite/build/src/compile/header/component.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/header/component.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,eAAe,GAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAGlE,MAAM,CAAC,MAAM,YAAY,GAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/parse.d.ts b/node_modules/vega-lite/build/src/compile/header/parse.d.ts deleted file mode 100644 index c21e2c7..0000000 --- a/node_modules/vega-lite/build/src/compile/header/parse.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { AxisOrient, SignalRef } from 'vega'; -import { FacetModel } from '../facet'; -export declare function getHeaderType(orient: AxisOrient | SignalRef): "header" | "footer"; -export declare function parseFacetHeaders(model: FacetModel): void; -//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/parse.d.ts.map b/node_modules/vega-lite/build/src/compile/header/parse.d.ts.map deleted file mode 100644 index 04076d6..0000000 --- a/node_modules/vega-lite/build/src/compile/header/parse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/header/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAO3C,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAKpC,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,uBAM3D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,QAOlD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/parse.js b/node_modules/vega-lite/build/src/compile/header/parse.js deleted file mode 100644 index 2c99024..0000000 --- a/node_modules/vega-lite/build/src/compile/header/parse.js +++ /dev/null @@ -1,86 +0,0 @@ -import { isArray } from 'vega-util'; -import { FACET_CHANNELS } from '../../channel'; -import { title as fieldDefTitle } from '../../channeldef'; -import { contains, getFirstDefined } from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { assembleAxis } from '../axis/assemble'; -import { parseGuideResolve } from '../resolve'; -import { getHeaderProperty } from './common'; -export function getHeaderType(orient) { - if (orient === 'top' || orient === 'left' || isSignalRef(orient)) { - // we always use header for orient signal since we can't dynamically make header becomes footer - return 'header'; - } - return 'footer'; -} -export function parseFacetHeaders(model) { - for (const channel of FACET_CHANNELS) { - parseFacetHeader(model, channel); - } - mergeChildAxis(model, 'x'); - mergeChildAxis(model, 'y'); -} -function parseFacetHeader(model, channel) { - var _a; - const { facet, config, child, component } = model; - if (model.channelHasField(channel)) { - const fieldDef = facet[channel]; - const titleConfig = getHeaderProperty('title', null, config, channel); - let title = fieldDefTitle(fieldDef, config, { - allowDisabling: true, - includeDefault: titleConfig === undefined || !!titleConfig - }); - if (child.component.layoutHeaders[channel].title) { - // TODO: better handle multiline titles - title = isArray(title) ? title.join(', ') : title; - // merge title with child to produce "Title / Subtitle / Sub-subtitle" - title += ' / ' + child.component.layoutHeaders[channel].title; - child.component.layoutHeaders[channel].title = null; - } - const labelOrient = getHeaderProperty('labelOrient', fieldDef, config, channel); - const header = (_a = fieldDef.header) !== null && _a !== void 0 ? _a : {}; - const labels = getFirstDefined(header.labels, config.header.labels, true); - const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header'; - component.layoutHeaders[channel] = { - title, - facetFieldDef: fieldDef, - [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)] - }; - } -} -function makeHeaderComponent(model, channel, labels) { - const sizeType = channel === 'row' ? 'height' : 'width'; - return { - labels, - sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined, - axes: [] - }; -} -function mergeChildAxis(model, channel) { - var _a; - const { child } = model; - if (child.component.axes[channel]) { - const { layoutHeaders, resolve } = model.component; - resolve.axis[channel] = parseGuideResolve(resolve, channel); - if (resolve.axis[channel] === 'shared') { - // For shared axis, move the axes to facet's header or footer - const headerChannel = channel === 'x' ? 'column' : 'row'; - const layoutHeader = layoutHeaders[headerChannel]; - for (const axisComponent of child.component.axes[channel]) { - const headerType = getHeaderType(axisComponent.get('orient')); - layoutHeader[headerType] = (_a = layoutHeader[headerType]) !== null && _a !== void 0 ? _a : [makeHeaderComponent(model, headerChannel, false)]; - // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes - const mainAxis = assembleAxis(axisComponent, 'main', model.config, { header: true }); - if (mainAxis) { - // LayoutHeader no longer keep track of property precedence, thus let's combine. - layoutHeader[headerType][0].axes.push(mainAxis); - } - axisComponent.mainExtracted = true; - } - } - else { - // Otherwise do nothing for independent axes - } - } -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/header/parse.js.map b/node_modules/vega-lite/build/src/compile/header/parse.js.map deleted file mode 100644 index ae3f34d..0000000 --- a/node_modules/vega-lite/build/src/compile/header/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/header/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAe,cAAc,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,KAAK,IAAI,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAG3C,MAAM,UAAU,aAAa,CAAC,MAA8B;IAC1D,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QAChE,+FAA+F;QAC/F,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IACjD,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE;QACpC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAClC;IAED,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3B,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAiB,EAAE,OAAqB;;IAChE,MAAM,EAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SA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,CAAC;YAClD,KAAK,MAAM,aAAa,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;gBACzD,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC9D,YAAY,CAAC,UAAU,CAAC,SAAG,YAAY,CAAC,UAAU,CAAC,mCAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;gBAE1G,+GAA+G;gBAC/G,MAAM,QAAQ,GAAG,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;gBACnF,IAAI,QAAQ,EAAE;oBACZ,gFAAgF;oBAChF,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACjD;gBACD,aAAa,CAAC,aAAa,GAAG,IAAI,CAAC;aACpC;SACF;aAAM;YACL,4CAA4C;SAC7C;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layer.d.ts b/node_modules/vega-lite/build/src/compile/layer.d.ts deleted file mode 100644 index 7294cb6..0000000 --- a/node_modules/vega-lite/build/src/compile/layer.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Legend as VgLegend, NewSignal, Title as VgTitle } from 'vega'; -import { Config } from '../config'; -import { LayoutSizeMixins, NormalizedLayerSpec } from '../spec'; -import { VgData, VgLayout } from '../vega.schema'; -import { Model } from './model'; -export declare class LayerModel extends Model { - readonly children: Model[]; - constructor(spec: NormalizedLayerSpec, parent: Model, parentGivenName: string, parentGivenSize: LayoutSizeMixins, config: Config); - parseData(): void; - parseLayoutSize(): void; - parseSelections(): void; - parseMarkGroup(): void; - parseAxesAndHeaders(): void; - assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[]; - assembleSignals(): NewSignal[]; - assembleLayoutSignals(): NewSignal[]; - assembleSelectionData(data: readonly VgData[]): readonly VgData[]; - assembleTitle(): VgTitle; - assembleLayout(): VgLayout; - assembleMarks(): any[]; - assembleLegends(): VgLegend[]; -} -//# sourceMappingURL=layer.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layer.d.ts.map b/node_modules/vega-lite/build/src/compile/layer.d.ts.map deleted file mode 100644 index fd19d34..0000000 --- a/node_modules/vega-lite/build/src/compile/layer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../src/compile/layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAE,SAAS,EAAE,KAAK,IAAI,OAAO,EAAC,MAAM,MAAM,CAAC;AACrE,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,EAA0B,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAEvF,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAOhD,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAI9B,qBAAa,UAAW,SAAQ,KAAK;IAGnC,SAAgB,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAGhC,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,KAAK,EACb,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,gBAAgB,EACjC,MAAM,EAAE,MAAM;IAqBT,SAAS;IAOT,eAAe;IAIf,eAAe;IAaf,cAAc;IAMd,mBAAmB;IAInB,gCAAgC,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE;IAKnE,eAAe,IAAI,SAAS,EAAE;IAM9B,qBAAqB,IAAI,SAAS,EAAE;IAMpC,qBAAqB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAIjE,aAAa,IAAI,OAAO;IAexB,cAAc,IAAI,QAAQ;IAI1B,aAAa,IAAI,GAAG,EAAE;IAStB,eAAe,IAAI,QAAQ,EAAE;CAKrC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layer.js b/node_modules/vega-lite/build/src/compile/layer.js deleted file mode 100644 index 532d0a4..0000000 --- a/node_modules/vega-lite/build/src/compile/layer.js +++ /dev/null @@ -1,101 +0,0 @@ -import * as log from '../log'; -import { isLayerSpec, isUnitSpec } from '../spec'; -import { keys } from '../util'; -import { assembleAxisSignals } from './axis/assemble'; -import { parseLayerAxes } from './axis/parse'; -import { parseData } from './data/parse'; -import { assembleLayoutSignals } from './layoutsize/assemble'; -import { parseLayerLayoutSize } from './layoutsize/parse'; -import { assembleLegends } from './legend/assemble'; -import { Model } from './model'; -import { assembleLayerSelectionMarks } from './selection/assemble'; -import { UnitModel } from './unit'; -export class LayerModel extends Model { - constructor(spec, parent, parentGivenName, parentGivenSize, config) { - super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view); - const layoutSize = Object.assign(Object.assign(Object.assign({}, parentGivenSize), (spec.width ? { width: spec.width } : {})), (spec.height ? { height: spec.height } : {})); - this.children = spec.layer.map((layer, i) => { - if (isLayerSpec(layer)) { - return new LayerModel(layer, this, this.getName('layer_' + i), layoutSize, config); - } - else if (isUnitSpec(layer)) { - return new UnitModel(layer, this, this.getName('layer_' + i), layoutSize, config); - } - throw new Error(log.message.invalidSpec(layer)); - }); - } - parseData() { - this.component.data = parseData(this); - for (const child of this.children) { - child.parseData(); - } - } - parseLayoutSize() { - parseLayerLayoutSize(this); - } - parseSelections() { - // Merge selections up the hierarchy so that they may be referenced - // across unit specs. Persist their definitions within each child - // to assemble signals which remain within output Vega unit groups. - this.component.selection = {}; - for (const child of this.children) { - child.parseSelections(); - for (const key of keys(child.component.selection)) { - this.component.selection[key] = child.component.selection[key]; - } - } - } - parseMarkGroup() { - for (const child of this.children) { - child.parseMarkGroup(); - } - } - parseAxesAndHeaders() { - parseLayerAxes(this); - } - assembleSelectionTopLevelSignals(signals) { - return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); - } - // TODO: Support same named selections across children. - assembleSignals() { - return this.children.reduce((signals, child) => { - return signals.concat(child.assembleSignals()); - }, assembleAxisSignals(this)); - } - assembleLayoutSignals() { - return this.children.reduce((signals, child) => { - return signals.concat(child.assembleLayoutSignals()); - }, assembleLayoutSignals(this)); - } - assembleSelectionData(data) { - return this.children.reduce((db, child) => child.assembleSelectionData(db), data); - } - assembleTitle() { - let title = super.assembleTitle(); - if (title) { - return title; - } - // If title does not provide layer, look into children - for (const child of this.children) { - title = child.assembleTitle(); - if (title) { - return title; - } - } - return undefined; - } - assembleLayout() { - return null; - } - assembleMarks() { - return assembleLayerSelectionMarks(this, this.children.flatMap(child => { - return child.assembleMarks(); - })); - } - assembleLegends() { - return this.children.reduce((legends, child) => { - return legends.concat(child.assembleLegends()); - }, assembleLegends(this)); - } -} -//# sourceMappingURL=layer.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layer.js.map b/node_modules/vega-lite/build/src/compile/layer.js.map deleted file mode 100644 index 9514eb5..0000000 --- a/node_modules/vega-lite/build/src/compile/layer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"layer.js","sourceRoot":"","sources":["../../../src/compile/layer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,WAAW,EAAE,UAAU,EAAwC,MAAM,SAAS,CAAC;AACvF,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAC,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAC;AAC5D,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IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YAC7C,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;QACjD,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5B,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/assemble.d.ts b/node_modules/vega-lite/build/src/compile/layoutsize/assemble.d.ts deleted file mode 100644 index eccde4c..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/assemble.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { InitSignal, NewSignal } from 'vega'; -import { Model } from '../model'; -import { ScaleComponent } from '../scale/component'; -import { LayoutSizeType } from './component'; -export declare function assembleLayoutSignals(model: Model): NewSignal[]; -export declare function sizeSignals(model: Model, sizeType: LayoutSizeType): (NewSignal | InitSignal)[]; -export declare function sizeExpr(scaleName: string, scaleComponent: ScaleComponent, cardinality: string): string; -//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/assemble.d.ts.map b/node_modules/vega-lite/build/src/compile/layoutsize/assemble.d.ts.map deleted file mode 100644 index 5f849d5..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/assemble.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/layoutsize/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAK3C,OAAO,EAAe,KAAK,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAE3C,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,CAO/D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC,EAAE,CAuD9F;AASD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UAgB9F"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/assemble.js b/node_modules/vega-lite/build/src/compile/layoutsize/assemble.js deleted file mode 100644 index 0c952e7..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/assemble.js +++ /dev/null @@ -1,88 +0,0 @@ -import { getViewConfigContinuousSize } from '../../config'; -import { hasDiscreteDomain } from '../../scale'; -import { getFirstDefined } from '../../util'; -import { isVgRangeStep } from '../../vega.schema'; -import { isFacetModel } from '../model'; -export function assembleLayoutSignals(model) { - return [ - ...sizeSignals(model, 'width'), - ...sizeSignals(model, 'height'), - ...sizeSignals(model, 'childWidth'), - ...sizeSignals(model, 'childHeight') - ]; -} -export function sizeSignals(model, sizeType) { - const channel = sizeType === 'width' ? 'x' : 'y'; - const size = model.component.layoutSize.get(sizeType); - if (!size || size === 'merged') { - return []; - } - // Read size signal name from name map, just in case it is the top-level size signal that got renamed. - const name = model.getSizeSignalRef(sizeType).signal; - if (size === 'step') { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const type = scaleComponent.get('type'); - const range = scaleComponent.get('range'); - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const scaleName = model.scaleName(channel); - if (isFacetModel(model.parent)) { - // If parent is facet and this is an independent scale, return only signal signal - // as the width/height will be calculated using the cardinality from - // facet's aggregate rather than reading from scale domain - const parentResolve = model.parent.component.resolve; - if (parentResolve.scale[channel] === 'independent') { - return [stepSignal(scaleName, range)]; - } - } - return [ - stepSignal(scaleName, range), - { - name, - update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`) - } - ]; - } - } - /* istanbul ignore next: Condition should not happen -- only for warning in development. */ - throw new Error('layout size is step although width/height is not step.'); - } - else if (size == 'container') { - const isWidth = name.endsWith('width'); - const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]'; - const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height'); - const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`; - return [{ name, init: safeExpr, on: [{ update: safeExpr, events: 'window:resize' }] }]; - } - else { - return [ - { - name, - value: size - } - ]; - } -} -function stepSignal(scaleName, range) { - return { - name: scaleName + '_step', - value: range.step - }; -} -export function sizeExpr(scaleName, scaleComponent, cardinality) { - const type = scaleComponent.get('type'); - const padding = scaleComponent.get('padding'); - const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding); - let paddingInner = scaleComponent.get('paddingInner'); - paddingInner = - type === 'band' - ? // only band has real paddingInner - paddingInner !== undefined - ? paddingInner - : padding - : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128, - // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points. - 1; - return `bandspace(${cardinality}, ${paddingInner}, ${paddingOuter}) * ${scaleName}_step`; -} -//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/assemble.js.map b/node_modules/vega-lite/build/src/compile/layoutsize/assemble.js.map deleted file mode 100644 index 21cc5c5..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/assemble.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/layoutsize/assemble.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,2BAA2B,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAc,MAAM,mBAAmB,CAAC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E,SAAS,GAAG,OAAO;QACzB,KAAK,EAAE,KAAK,CAAC,IAAI;KAClB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,SAAiB,EAAE,cAA8B,EAAE,WAAmB;IAC7F,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,YAAY,GAAG,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;IAElF,IAAI,YAAY,GAAG,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACtD,YAAY;QACV,IAAI,KAAK,MAAM;YACb,CAAC,CAAC,kCAAkC;gBAClC,YAAY,KAAK,SAAS;oBAC1B,CAAC,CAAC,YAAY;oBACd,CAAC,CAAC,OAAO;YACX,CAAC,CAAC,+FAA+F;gBAC/F,2FAA2F;gBAC3F,CAAC,CAAC;IACR,OAAO,aAAa,WAAW,KAAK,YAAY,KAAK,YAAY,OAAO,SAAS,OAAO,CAAC;AAC3F,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/component.d.ts b/node_modules/vega-lite/build/src/compile/layoutsize/component.d.ts deleted file mode 100644 index a7e4b03..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/component.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Split } from '../split'; -export declare type LayoutSize = number | 'container' | 'step' | 'merged'; -export interface LayoutSizeIndex { - width?: LayoutSize; - childWidth?: LayoutSize; - height?: LayoutSize; - childHeight?: LayoutSize; -} -export declare type LayoutSizeType = keyof LayoutSizeIndex; -export declare type LayoutSizeComponent = Split; -export declare function getSizeTypeFromLayoutSizeType(layoutSizeType: LayoutSizeType): 'width' | 'height'; -//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/component.d.ts.map b/node_modules/vega-lite/build/src/compile/layoutsize/component.d.ts.map deleted file mode 100644 index 7bc8517..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/component.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/layoutsize/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,oBAAY,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB,WAAW,CAAC,EAAE,UAAU,CAAC;CAC1B;AAED,oBAAY,cAAc,GAAG,MAAM,eAAe,CAAC;AAEnD,oBAAY,mBAAmB,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEzD,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,GAAG,QAAQ,CAEhG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/component.js b/node_modules/vega-lite/build/src/compile/layoutsize/component.js deleted file mode 100644 index 0ad21ea..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/component.js +++ /dev/null @@ -1,4 +0,0 @@ -export function getSizeTypeFromLayoutSizeType(layoutSizeType) { - return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType; -} -//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/component.js.map b/node_modules/vega-lite/build/src/compile/layoutsize/component.js.map deleted file mode 100644 index e3d9b1f..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/component.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/layoutsize/component.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,6BAA6B,CAAC,cAA8B;IAC1E,OAAO,cAAc,KAAK,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,KAAK,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC;AAClH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/init.d.ts b/node_modules/vega-lite/build/src/compile/layoutsize/init.d.ts deleted file mode 100644 index 5eedd54..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/init.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Encoding } from '../../encoding'; -import { LayoutSizeMixins } from '../../spec/base'; -export declare function initLayoutSize({ encoding, size }: { - encoding: Encoding; - size: LayoutSizeMixins; -}): LayoutSizeMixins; -//# sourceMappingURL=init.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/init.d.ts.map b/node_modules/vega-lite/build/src/compile/layoutsize/init.d.ts.map deleted file mode 100644 index 3197e5b..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/init.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/compile/layoutsize/init.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAS,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAEzD,wBAAgB,cAAc,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,EAAE;IAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAC,oBAYpG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/init.js b/node_modules/vega-lite/build/src/compile/layoutsize/init.js deleted file mode 100644 index 42c29ac..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/init.js +++ /dev/null @@ -1,17 +0,0 @@ -import { getSizeChannel, POSITION_SCALE_CHANNELS } from '../../channel'; -import { isContinuousFieldOrDatumDef } from '../../channeldef'; -import * as log from '../../log'; -import { isStep } from '../../spec/base'; -export function initLayoutSize({ encoding, size }) { - for (const channel of POSITION_SCALE_CHANNELS) { - const sizeType = getSizeChannel(channel); - if (isStep(size[sizeType])) { - if (isContinuousFieldOrDatumDef(encoding[channel])) { - delete size[sizeType]; - log.warn(log.message.stepDropped(sizeType)); - } - } - } - return size; -} -//# sourceMappingURL=init.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/init.js.map b/node_modules/vega-lite/build/src/compile/layoutsize/init.js.map deleted file mode 100644 index 5fac07e..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/init.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/compile/layoutsize/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,2BAA2B,EAAC,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAEzD,MAAM,UAAU,cAAc,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAuD;IACnG,KAAK,MAAM,OAAO,IAAI,uBAAuB,EAAE;QAC7C,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE;YAC1B,IAAI,2BAA2B,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;gBAClD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC7C;SACF;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/parse.d.ts b/node_modules/vega-lite/build/src/compile/layoutsize/parse.d.ts deleted file mode 100644 index 8e52580..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/parse.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ConcatModel } from '../concat'; -import { Model } from '../model'; -import { UnitModel } from '../unit'; -export declare function parseLayerLayoutSize(model: Model): void; -export declare const parseRepeatLayoutSize: typeof parseConcatLayoutSize; -export declare function parseConcatLayoutSize(model: ConcatModel): void; -export declare function parseChildrenLayoutSize(model: Model): void; -export declare function parseUnitLayoutSize(model: UnitModel): void; -//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/parse.d.ts.map b/node_modules/vega-lite/build/src/compile/layoutsize/parse.d.ts.map deleted file mode 100644 index 17de26f..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/parse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/layoutsize/parse.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGlC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,QAKhD;AAED,eAAO,MAAM,qBAAqB,8BAAwB,CAAC;AAE3D,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,QAWvD;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,QAInD;AA0DD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,QAanD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/parse.js b/node_modules/vega-lite/build/src/compile/layoutsize/parse.js deleted file mode 100644 index ae84697..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/parse.js +++ /dev/null @@ -1,126 +0,0 @@ -import { getPositionScaleChannel, getSizeChannel, POSITION_SCALE_CHANNELS } from '../../channel'; -import { getViewConfigContinuousSize, getViewConfigDiscreteSize } from '../../config'; -import { hasDiscreteDomain } from '../../scale'; -import { isStep } from '../../spec/base'; -import { isVgRangeStep } from '../../vega.schema'; -import { mergeValuesWithExplicit } from '../split'; -import { getSizeTypeFromLayoutSizeType } from './component'; -export function parseLayerLayoutSize(model) { - parseChildrenLayoutSize(model); - parseNonUnitLayoutSizeForChannel(model, 'width'); - parseNonUnitLayoutSizeForChannel(model, 'height'); -} -export const parseRepeatLayoutSize = parseConcatLayoutSize; -export function parseConcatLayoutSize(model) { - parseChildrenLayoutSize(model); - // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth. - const widthType = model.layout.columns === 1 ? 'width' : 'childWidth'; - // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight. - const heightType = model.layout.columns === undefined ? 'height' : 'childHeight'; - parseNonUnitLayoutSizeForChannel(model, widthType); - parseNonUnitLayoutSizeForChannel(model, heightType); -} -export function parseChildrenLayoutSize(model) { - for (const child of model.children) { - child.parseLayoutSize(); - } -} -/** - * Merge child layout size (width or height). - */ -function parseNonUnitLayoutSizeForChannel(model, layoutSizeType) { - /* - * For concat, the parent width or height might not be the same as the children's shared height. - * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width. - * - * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height) - * while the sizeType represents the properties of the child. - */ - const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); - const channel = getPositionScaleChannel(sizeType); - const resolve = model.component.resolve; - const layoutSizeCmpt = model.component.layoutSize; - let mergedSize; - // Try to merge layout size - for (const child of model.children) { - const childSize = child.component.layoutSize.getWithExplicit(sizeType); - const scaleResolve = resolve.scale[channel]; - if (scaleResolve === 'independent' && childSize.value === 'step') { - // Do not merge independent scales with range-step as their size depends - // on the scale domains, which can be different between scales. - mergedSize = undefined; - break; - } - if (mergedSize) { - if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) { - // For independent scale, only merge if all the sizes are the same. - // If the values are different, abandon the merge! - mergedSize = undefined; - break; - } - mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, ''); - } - else { - mergedSize = childSize; - } - } - if (mergedSize) { - // If merged, rename size and set size of all children. - for (const child of model.children) { - model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType)); - child.component.layoutSize.set(sizeType, 'merged', false); - } - layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize); - } - else { - layoutSizeCmpt.setWithExplicit(layoutSizeType, { - explicit: false, - value: undefined - }); - } -} -export function parseUnitLayoutSize(model) { - const { size, component } = model; - for (const channel of POSITION_SCALE_CHANNELS) { - const sizeType = getSizeChannel(channel); - if (size[sizeType]) { - const specifiedSize = size[sizeType]; - component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true); - } - else { - const defaultSize = defaultUnitSize(model, sizeType); - component.layoutSize.set(sizeType, defaultSize, false); - } - } -} -function defaultUnitSize(model, sizeType) { - const channel = sizeType === 'width' ? 'x' : 'y'; - const config = model.config; - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const range = scaleComponent.get('range'); - if (hasDiscreteDomain(scaleType)) { - const size = getViewConfigDiscreteSize(config.view, sizeType); - if (isVgRangeStep(range) || isStep(size)) { - // For discrete domain with range.step, use dynamic width/height - return 'step'; - } - else { - return size; - } - } - else { - return getViewConfigContinuousSize(config.view, sizeType); - } - } - else if (model.hasProjection || model.mark === 'arc') { - // arc should use continuous size by default otherwise the pie is extremely small - return getViewConfigContinuousSize(config.view, sizeType); - } - else { - const size = getViewConfigDiscreteSize(config.view, sizeType); - return isStep(size) ? size.step : size; - } -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/layoutsize/parse.js.map b/node_modules/vega-lite/build/src/compile/layoutsize/parse.js.map deleted file mode 100644 index d50283f..0000000 --- a/node_modules/vega-lite/build/src/compile/layoutsize/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/layoutsize/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAE,cAAc,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAC,2BAA2B,EAAE,yBAAyB,EAAC,MAAM,cAAc,CAAC;AACpF,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAW,uBAAuB,EAAC,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAC,6BAA6B,EAA8C,MAAM,aAAa,CAAC;AAEvG,MAAM,UAAU,oBAAoB,CAAC,KAAY;IAC/C,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAE/B,gCAAgC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjD,gCAAgC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAE3D,MAAM,UAAU,qBAAqB,CAAC,KAAkB;IACtD,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAE/B,kHAAkH;IAClH,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC;IAEtE,6HAA6H;IAC7H,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,KAA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--git a/node_modules/vega-lite/build/src/compile/legend/assemble.d.ts b/node_modules/vega-lite/build/src/compile/legend/assemble.d.ts deleted file mode 100644 index 8c600be..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/assemble.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Legend as VgLegend, LegendEncode } from 'vega'; -import { Config } from '../../config'; -import { Model } from '../model'; -import { LegendComponent } from './component'; -export declare function assembleLegends(model: Model): VgLegend[]; -export declare function assembleLegend(legendCmpt: LegendComponent, config: Config): { - size?: string; - shape?: string; - fill?: string; - stroke?: string; - strokeDash?: string; - strokeWidth?: string; - opacity?: string; - type?: import("vega").LegendType; - direction?: import("vega").Orientation; - format?: string | import("vega").SignalRef | import("vega").TimeFormatSpecifier; - formatType?: "number" | import("vega").SignalRef | "time" | "utc"; - title?: string | string[] | import("vega").SignalRef; - tickMinStep?: number | import("vega").SignalRef; - values?: any[] | import("vega").SignalRef; - encode?: LegendEncode; - orient?: "none" | import("vega").SignalRef | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right"; - symbolLimit?: import("vega").NumberValue; - tickCount?: import("vega").TickCount; - aria?: boolean; - description?: string; - cornerRadius?: import("vega").NumberValue; - fillColor?: import("vega").ColorValue; - offset?: import("vega").NumberValue; - padding?: import("vega").NumberValue; - strokeColor?: import("vega").ColorValue; - legendX?: import("vega").NumberValue; - legendY?: import("vega").NumberValue; - titleAlign?: import("vega").AlignValue; - titleAnchor?: import("vega").AnchorValue; - titleBaseline?: import("vega").TextBaselineValue; - titleColor?: import("vega").ColorValue; - titleFont?: import("vega").StringValue; - titleFontSize?: import("vega").NumberValue; - titleFontStyle?: import("vega").StringValue; - titleFontWeight?: import("vega").FontWeightValue; - titleLimit?: import("vega").NumberValue; - titleLineHeight?: import("vega").NumberValue; - titleOpacity?: import("vega").NumberValue; - titleOrient?: import("vega").OrientValue; - titlePadding?: import("vega").NumberValue; - gradientLength?: number | import("vega").SignalRef; - gradientOpacity?: import("vega").NumberValue; - gradientThickness?: number | import("vega").SignalRef; - gradientStrokeColor?: import("vega").ColorValue; - gradientStrokeWidth?: import("vega").NumberValue; - clipHeight?: number | import("vega").SignalRef; - columns?: number | import("vega").SignalRef; - columnPadding?: number | import("vega").SignalRef; - rowPadding?: number | import("vega").SignalRef; - gridAlign?: "none" | import("vega").SignalRef | "all" | "each"; - symbolDash?: import("vega").DashArrayValue; - symbolDashOffset?: import("vega").NumberValue; - symbolFillColor?: import("vega").ColorValue; - symbolOffset?: import("vega").NumberValue; - symbolOpacity?: import("vega").NumberValue; - symbolSize?: import("vega").NumberValue; - symbolStrokeColor?: import("vega").ColorValue; - symbolStrokeWidth?: import("vega").NumberValue; - symbolType?: import("vega").StringValue; - labelAlign?: import("vega").AlignValue; - labelBaseline?: import("vega").TextBaselineValue; - labelColor?: import("vega").ColorValue; - labelFont?: import("vega").StringValue; - labelFontSize?: import("vega").NumberValue; - labelFontStyle?: import("vega").StringValue; - labelFontWeight?: import("vega").FontWeightValue; - labelLimit?: import("vega").NumberValue; - labelOpacity?: import("vega").NumberValue; - labelPadding?: import("vega").NumberValue; - labelOffset?: import("vega").NumberValue; - labelOverlap?: boolean | import("vega").SignalRef | "parity" | "greedy"; - labelSeparation?: number | import("vega").SignalRef; - zindex?: number; -}; -//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/assemble.d.ts.map b/node_modules/vega-lite/build/src/compile/legend/assemble.d.ts.map deleted file mode 100644 index b160794..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/assemble.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/legend/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AACtD,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAIpC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAgB5C,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,EAAE,CA0BxD;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDzE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/assemble.js b/node_modules/vega-lite/build/src/compile/legend/assemble.js deleted file mode 100644 index dfd9691..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/assemble.js +++ /dev/null @@ -1,85 +0,0 @@ -import { __rest } from "tslib"; -import { LEGEND_SCALE_CHANNELS, SIGNAL_LEGEND_PROP_INDEX } from '../../legend'; -import { keys, replaceAll, stringify, vals } from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { mergeLegendComponent } from './parse'; -function setLegendEncode(legend, part, vgProp, vgRef) { - var _a, _b, _c; - legend.encode = (_a = legend.encode) !== null && _a !== void 0 ? _a : {}; - legend.encode[part] = (_b = legend.encode[part]) !== null && _b !== void 0 ? _b : {}; - legend.encode[part].update = (_c = legend.encode[part].update) !== null && _c !== void 0 ? _c : {}; - // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 - legend.encode[part].update[vgProp] = vgRef; -} -export function assembleLegends(model) { - const legendComponentIndex = model.component.legends; - const legendByDomain = {}; - for (const channel of keys(legendComponentIndex)) { - const scaleComponent = model.getScaleComponent(channel); - const domainHash = stringify(scaleComponent.get('domains')); - if (legendByDomain[domainHash]) { - for (const mergedLegendComponent of legendByDomain[domainHash]) { - const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]); - if (!merged) { - // If cannot merge, need to add this legend separately - legendByDomain[domainHash].push(legendComponentIndex[channel]); - } - } - } - else { - legendByDomain[domainHash] = [legendComponentIndex[channel].clone()]; - } - } - const legends = vals(legendByDomain) - .flat() - .map(l => assembleLegend(l, model.config)) - .filter(l => l !== undefined); - return legends; -} -export function assembleLegend(legendCmpt, config) { - var _a, _b, _c; - const _d = legendCmpt.combine(), { disable, labelExpr, selections } = _d, legend = __rest(_d, ["disable", "labelExpr", "selections"]); - if (disable) { - return undefined; - } - if (config.aria === false && legend.aria == undefined) { - legend.aria = false; - } - if ((_a = legend.encode) === null || _a === void 0 ? void 0 : _a.symbols) { - const out = legend.encode.symbols.update; - if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) { - // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used. - out.stroke = { value: 'transparent' }; - } - // Remove properties that the legend is encoding. - for (const property of LEGEND_SCALE_CHANNELS) { - if (legend[property]) { - delete out[property]; - } - } - } - if (!legend.title) { - // title schema doesn't include null, '' - delete legend.title; - } - if (labelExpr !== undefined) { - let expr = labelExpr; - if (((_c = (_b = legend.encode) === null || _b === void 0 ? void 0 : _b.labels) === null || _c === void 0 ? void 0 : _c.update) && isSignalRef(legend.encode.labels.update.text)) { - expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal); - } - setLegendEncode(legend, 'labels', 'text', { signal: expr }); - } - for (const prop in legend) { - const propValue = legend[prop]; - if (isSignalRef(propValue)) { - const propIndex = SIGNAL_LEGEND_PROP_INDEX[prop]; - if (propIndex) { - const { vgProp, part } = propIndex; - setLegendEncode(legend, part, vgProp, propValue); - delete legend[prop]; - } - } - } - return legend; -} -//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/assemble.js.map b/node_modules/vega-lite/build/src/compile/legend/assemble.js.map deleted file mode 100644 index 905792a..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/assemble.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/legend/assemble.ts"],"names":[],"m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SACF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/component.d.ts b/node_modules/vega-lite/build/src/compile/legend/component.d.ts deleted file mode 100644 index 346f4f4..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/component.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Legend as VgLegend } from 'vega'; -import { NonPositionScaleChannel } from '../../channel'; -import { Legend } from '../../legend'; -import { Split } from '../split'; -export declare type LegendComponentProps = VgLegend & { - labelExpr?: string; - selections?: string[]; - disable?: boolean; -}; -export declare const LEGEND_COMPONENT_PROPERTIES: ("padding" | "stroke" | "type" | "shape" | "orient" | "symbolLimit" | "tickCount" | "aria" | "description" | "cornerRadius" | "fillColor" | "offset" | "strokeColor" | "legendX" | "legendY" | "titleAlign" | "titleAnchor" | "titleBaseline" | "titleColor" | "titleFont" | "titleFontSize" | "titleFontStyle" | "titleFontWeight" | "titleLimit" | "titleLineHeight" | "titleOpacity" | "titleOrient" | "titlePadding" | "gradientLength" | "gradientOpacity" | "gradientThickness" | "gradientStrokeColor" | "gradientStrokeWidth" | "clipHeight" | "columns" | "columnPadding" | "rowPadding" | "gridAlign" | "symbolDash" | "symbolDashOffset" | "symbolFillColor" | "symbolOffset" | "symbolOpacity" | "symbolSize" | "symbolStrokeColor" | "symbolStrokeWidth" | "symbolType" | "labelAlign" | "labelBaseline" | "labelColor" | "labelFont" | "labelFontSize" | "labelFontStyle" | "labelFontWeight" | "labelLimit" | "labelOpacity" | "labelPadding" | "labelOffset" | "labelOverlap" | "labelSeparation" | "zindex" | "values" | "fill" | "opacity" | "strokeWidth" | "strokeDash" | "size" | "title" | "direction" | "format" | "formatType" | "tickMinStep" | "encode" | "labelExpr" | "disable" | "selections")[]; -export declare class LegendComponent extends Split { -} -export declare type LegendComponentIndex = Partial>; -export declare type LegendIndex = Partial>; -//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/component.d.ts.map b/node_modules/vega-lite/build/src/compile/legend/component.d.ts.map deleted file mode 100644 index 341c282..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/component.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/legend/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAC,MAAM,MAAM,CAAC;AACxC,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAA+B,MAAM,EAAC,MAAM,cAAc,CAAC;AAElE,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,oBAAY,oBAAoB,GAAG,QAAQ,GAAG;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAmBF,eAAO,MAAM,2BAA2B,+pCAAwC,CAAC;AAEjF,qBAAa,eAAgB,SAAQ,KAAK,CAAC,oBAAoB,CAAC;CAAG;AAEnE,oBAAY,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,eAAe,CAAC,CAAC,CAAC;AAE7F,oBAAY,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/component.js b/node_modules/vega-lite/build/src/compile/legend/component.js deleted file mode 100644 index 8840d16..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/component.js +++ /dev/null @@ -1,12 +0,0 @@ -import { COMMON_LEGEND_PROPERTY_INDEX } from '../../legend'; -import { keys } from '../../util'; -import { Split } from '../split'; -const LEGEND_COMPONENT_PROPERTY_INDEX = Object.assign(Object.assign({}, COMMON_LEGEND_PROPERTY_INDEX), { disable: 1, labelExpr: 1, selections: 1, - // channel scales - opacity: 1, shape: 1, stroke: 1, fill: 1, size: 1, strokeWidth: 1, strokeDash: 1, - // encode - encode: 1 }); -export const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX); -export class LegendComponent extends Split { -} -//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/component.js.map b/node_modules/vega-lite/build/src/compile/legend/component.js.map deleted file mode 100644 index 33a7b46..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/component.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/legend/component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,4BAA4B,EAAS,MAAM,cAAc,CAAC;AAClE,OAAO,EAAO,IAAI,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAQ/B,MAAM,+BAA+B,mCAChC,4BAA4B,KAC/B,OAAO,EAAE,CAAC,EACV,SAAS,EAAE,CAAC,EACZ,UAAU,EAAE,CAAC;IACb,iBAAiB;IACjB,OAAO,EAAE,CAAC,EACV,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,CAAC,EACP,WAAW,EAAE,CAAC,EACd,UAAU,EAAE,CAAC;IACb,SAAS;IACT,MAAM,EAAE,CAAC,GACV,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,+BAA+B,CAAC,CAAC;AAEjF,MAAM,OAAO,eAAgB,SAAQ,KAA2B;CAAG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/encode.d.ts b/node_modules/vega-lite/build/src/compile/legend/encode.d.ts deleted file mode 100644 index 180346e..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/encode.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { EncodeEntry, Gradient, LegendEncode, LegendType, SymbolEncodeEntry } from 'vega'; -import { NonPositionScaleChannel } from '../../channel'; -import { DatumDef, TypedFieldDef, Value } from '../../channeldef'; -import { Encoding } from '../../encoding'; -import { UnitModel } from '../unit'; -import { LegendComponent } from './component'; -export interface LegendEncodeParams { - fieldOrDatumDef: TypedFieldDef | DatumDef; - model: UnitModel; - channel: NonPositionScaleChannel; - legendCmpt: LegendComponent; - legendType: LegendType; -} -export declare const legendEncodeRules: { - [part in keyof LegendEncode]?: (spec: EncodeEntry, params: LegendEncodeParams) => EncodeEntry; -}; -export declare function symbols(symbolsSpec: any, { fieldOrDatumDef, model, channel, legendCmpt, legendType }: LegendEncodeParams): SymbolEncodeEntry; -export declare function gradient(gradientSpec: any, { model, legendType, legendCmpt }: LegendEncodeParams): SymbolEncodeEntry; -export declare function labels(specifiedlabelsSpec: any, { fieldOrDatumDef, model, channel, legendCmpt }: LegendEncodeParams): any; -export declare function entries(entriesSpec: any, { legendCmpt }: LegendEncodeParams): any; -export declare function getFirstConditionValue(channelDef: Encoding['fill' | 'stroke' | 'shape']): V; -//# sourceMappingURL=encode.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/encode.d.ts.map b/node_modules/vega-lite/build/src/compile/legend/encode.d.ts.map deleted file mode 100644 index 3e7d3d6..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/encode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../../src/compile/legend/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAa,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAElH,OAAO,EAAQ,uBAAuB,EAAU,MAAM,eAAe,CAAC;AACtE,OAAO,EAEL,QAAQ,EAIR,aAAa,EACb,KAAK,EAEN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAOxC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;IAClD,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,uBAAuB,CAAC;IACjC,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,EAAE;KAC7B,IAAI,IAAI,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,KAAK,WAAW;CAM9F,CAAC;AAEF,wBAAgB,OAAO,CACrB,WAAW,EAAE,GAAG,EAChB,EAAC,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAC,EAAE,kBAAkB,GAC5E,iBAAiB,CA8EnB;AAED,wBAAgB,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE,EAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAC,EAAE,kBAAkB,qBAkB9F;AAED,wBAAgB,MAAM,CAAC,mBAAmB,EAAE,GAAG,EAAE,EAAC,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAC,EAAE,kBAAkB,OA0BjH;AAED,wBAAgB,OAAO,CAAC,WAAW,EAAE,GAAG,EAAE,EAAC,UAAU,EAAC,EAAE,kBAAkB,OAGzE;AAMD,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,KAAK,GAAG,QAAQ,EAC/D,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,GACxD,CAAC,CAIH"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/encode.js b/node_modules/vega-lite/build/src/compile/legend/encode.js deleted file mode 100644 index c9ec70f..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/encode.js +++ /dev/null @@ -1,151 +0,0 @@ -import { array, isArray, stringValue } from 'vega-util'; -import { COLOR, OPACITY } from '../../channel'; -import { hasConditionalValueDef, isFieldDef, isValueDef } from '../../channeldef'; -import { FILL_STROKE_CONFIG } from '../../mark'; -import { getFirstDefined, isEmpty, varName } from '../../util'; -import { applyMarkConfig, signalOrValueRef } from '../common'; -import { formatCustomType, isCustomFormatType } from '../format'; -import * as mixins from '../mark/encode'; -import { STORE } from '../selection'; -export const legendEncodeRules = { - symbols, - gradient, - labels, - entries -}; -export function symbols(symbolsSpec, { fieldOrDatumDef, model, channel, legendCmpt, legendType }) { - var _a, _b, _c, _d, _e, _f, _g, _h; - if (legendType !== 'symbol') { - return undefined; - } - const { markDef, encoding, config, mark } = model; - const filled = markDef.filled && mark !== 'trail'; - let out = Object.assign(Object.assign({}, applyMarkConfig({}, model, FILL_STROKE_CONFIG)), mixins.color(model, { filled })); // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry - const symbolOpacity = (_a = legendCmpt.get('symbolOpacity')) !== null && _a !== void 0 ? _a : config.legend.symbolOpacity; - const symbolFillColor = (_b = legendCmpt.get('symbolFillColor')) !== null && _b !== void 0 ? _b : config.legend.symbolFillColor; - const symbolStrokeColor = (_c = legendCmpt.get('symbolStrokeColor')) !== null && _c !== void 0 ? _c : config.legend.symbolStrokeColor; - const opacity = symbolOpacity === undefined ? (_d = getMaxValue(encoding.opacity)) !== null && _d !== void 0 ? _d : markDef.opacity : undefined; - if (out.fill) { - // for fill legend, we don't want any fill in symbol - if (channel === 'fill' || (filled && channel === COLOR)) { - delete out.fill; - } - else { - if (out.fill['field']) { - // For others, set fill to some opaque value (or nothing if a color is already set) - if (symbolFillColor) { - delete out.fill; - } - else { - out.fill = signalOrValueRef((_e = config.legend.symbolBaseFillColor) !== null && _e !== void 0 ? _e : 'black'); - out.fillOpacity = signalOrValueRef(opacity !== null && opacity !== void 0 ? opacity : 1); - } - } - else if (isArray(out.fill)) { - const fill = (_h = (_g = getFirstConditionValue((_f = encoding.fill) !== null && _f !== void 0 ? _f : encoding.color)) !== null && _g !== void 0 ? _g : markDef.fill) !== null && _h !== void 0 ? _h : (filled && markDef.color); - if (fill) { - out.fill = signalOrValueRef(fill); - } - } - } - } - if (out.stroke) { - if (channel === 'stroke' || (!filled && channel === COLOR)) { - delete out.stroke; - } - else { - if (out.stroke['field'] || symbolStrokeColor) { - // For others, remove stroke field - delete out.stroke; - } - else if (isArray(out.stroke)) { - const stroke = getFirstDefined(getFirstConditionValue(encoding.stroke || encoding.color), markDef.stroke, filled ? markDef.color : undefined); - if (stroke) { - out.stroke = { value: stroke }; - } - } - } - } - if (channel !== OPACITY) { - const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef); - if (condition) { - out.opacity = [ - Object.assign({ test: condition }, signalOrValueRef(opacity !== null && opacity !== void 0 ? opacity : 1)), - signalOrValueRef(config.legend.unselectedOpacity) - ]; - } - else if (opacity) { - out.opacity = signalOrValueRef(opacity); - } - } - out = Object.assign(Object.assign({}, out), symbolsSpec); - return isEmpty(out) ? undefined : out; -} -export function gradient(gradientSpec, { model, legendType, legendCmpt }) { - var _a; - if (legendType !== 'gradient') { - return undefined; - } - const { config, markDef, encoding } = model; - let out = {}; - const gradientOpacity = (_a = legendCmpt.get('gradientOpacity')) !== null && _a !== void 0 ? _a : config.legend.gradientOpacity; - const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined; - if (opacity) { - // only apply opacity if it is neither zero or undefined - out.opacity = signalOrValueRef(opacity); - } - out = Object.assign(Object.assign({}, out), gradientSpec); - return isEmpty(out) ? undefined : out; -} -export function labels(specifiedlabelsSpec, { fieldOrDatumDef, model, channel, legendCmpt }) { - const legend = model.legend(channel) || {}; - const config = model.config; - const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined; - const opacity = condition ? [{ test: condition, value: 1 }, { value: config.legend.unselectedOpacity }] : undefined; - const { format, formatType } = legend; - const text = isCustomFormatType(formatType) - ? formatCustomType({ - fieldOrDatumDef, - field: 'datum.value', - format, - formatType, - config - }) - : undefined; - const labelsSpec = Object.assign(Object.assign(Object.assign({}, (opacity ? { opacity } : {})), (text ? { text } : {})), specifiedlabelsSpec); - return isEmpty(labelsSpec) ? undefined : labelsSpec; -} -export function entries(entriesSpec, { legendCmpt }) { - const selections = legendCmpt.get('selections'); - return (selections === null || selections === void 0 ? void 0 : selections.length) ? Object.assign(Object.assign({}, entriesSpec), { fill: { value: 'transparent' } }) : entriesSpec; -} -function getMaxValue(channelDef) { - return getConditionValue(channelDef, (v, conditionalDef) => Math.max(v, conditionalDef.value)); -} -export function getFirstConditionValue(channelDef) { - return getConditionValue(channelDef, (v, conditionalDef) => { - return getFirstDefined(v, conditionalDef.value); - }); -} -function getConditionValue(channelDef, reducer) { - if (hasConditionalValueDef(channelDef)) { - return array(channelDef.condition).reduce(reducer, channelDef.value); - } - else if (isValueDef(channelDef)) { - return channelDef.value; - } - return undefined; -} -function selectedCondition(model, legendCmpt, fieldDef) { - const selections = legendCmpt.get('selections'); - if (!(selections === null || selections === void 0 ? void 0 : selections.length)) - return undefined; - const field = stringValue(fieldDef.field); - return selections - .map(name => { - const store = stringValue(varName(name) + STORE); - return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`; - }) - .join(' || '); -} -//# sourceMappingURL=encode.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/encode.js.map b/node_modules/vega-lite/build/src/compile/legend/encode.js.map deleted file mode 100644 index c032534..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/encode.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../../../src/compile/legend/encode.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,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ega-lite/build/src/compile/legend/parse.d.ts deleted file mode 100644 index 2e667c1..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/parse.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { NonPositionScaleChannel } from '../../channel'; -import { Model } from '../model'; -import { UnitModel } from '../unit'; -import { LegendComponent } from './component'; -export declare function parseLegend(model: Model): Partial>; -export declare function parseLegendForChannel(model: UnitModel, channel: NonPositionScaleChannel): LegendComponent; -export declare function mergeLegendComponent(mergedLegend: LegendComponent, childLegend: LegendComponent): LegendComponent; -//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/parse.d.ts.map b/node_modules/vega-lite/build/src/compile/legend/parse.d.ts.map deleted file mode 100644 index 09348b9..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/parse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/legend/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,uBAAuB,EAAQ,MAAM,eAAe,CAAC;AAQpE,OAAO,EAAc,KAAK,EAAC,MAAM,UAAU,CAAC;AAI5C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,eAAe,EAA0E,MAAM,aAAa,CAAC;AAIrH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,2KAIvC;AAgED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,uBAAuB,GAAG,eAAe,CAuFzG;AA4CD,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,GAAG,eAAe,CAiDjH"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/parse.js b/node_modules/vega-lite/build/src/compile/legend/parse.js deleted file mode 100644 index 82a6a01..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/parse.js +++ /dev/null @@ -1,217 +0,0 @@ -import { COLOR, SHAPE } from '../../channel'; -import { getFieldOrDatumDef, isFieldDef } from '../../channeldef'; -import { LEGEND_SCALE_CHANNELS } from '../../legend'; -import { normalizeTimeUnit } from '../../timeunit'; -import { GEOJSON } from '../../type'; -import { deleteNestedProperty, isEmpty, keys, varName } from '../../util'; -import { mergeTitleComponent } from '../common'; -import { guideEncodeEntry } from '../guide'; -import { isUnitModel } from '../model'; -import { parseGuideResolve } from '../resolve'; -import { parseInteractiveLegend } from '../selection/transforms/legends'; -import { defaultTieBreaker, makeImplicit, mergeValuesWithExplicit } from '../split'; -import { LegendComponent, LEGEND_COMPONENT_PROPERTIES } from './component'; -import { legendEncodeRules } from './encode'; -import { getDirection, getLegendType, legendRules } from './properties'; -export function parseLegend(model) { - const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model); - model.component.legends = legendComponent; - return legendComponent; -} -function parseUnitLegend(model) { - const { encoding } = model; - const legendComponent = {}; - for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) { - const def = getFieldOrDatumDef(encoding[channel]); - if (!def || !model.getScaleComponent(channel)) { - continue; - } - if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) { - continue; - } - legendComponent[channel] = parseLegendForChannel(model, channel); - } - return legendComponent; -} -function getLegendDefWithScale(model, channel) { - const scale = model.scaleName(channel); - if (model.mark === 'trail') { - if (channel === 'color') { - // trail is a filled mark, but its default symbolType ("stroke") should use "stroke" - return { stroke: scale }; - } - else if (channel === 'size') { - return { strokeWidth: scale }; - } - } - if (channel === 'color') { - return model.markDef.filled ? { fill: scale } : { stroke: scale }; - } - return { [channel]: scale }; -} -// eslint-disable-next-line @typescript-eslint/ban-types -function isExplicit(value, property, legend, fieldDef) { - switch (property) { - case 'disable': - return legend !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit - case 'values': - // specified legend.values is already respected, but may get transformed. - return !!(legend === null || legend === void 0 ? void 0 : legend.values); - case 'title': - // title can be explicit if fieldDef.title is set - if (property === 'title' && value === (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.title)) { - return true; - } - } - // Otherwise, things are explicit if the returned value matches the specified property - return value === (legend || {})[property]; -} -export function parseLegendForChannel(model, channel) { - var _a, _b, _c; - let legend = model.legend(channel); - const { markDef, encoding, config } = model; - const legendConfig = config.legend; - const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel)); - parseInteractiveLegend(model, channel, legendCmpt); - const disable = legend !== undefined ? !legend : legendConfig.disable; - legendCmpt.set('disable', disable, legend !== undefined); - if (disable) { - return legendCmpt; - } - legend = legend || {}; - const scaleType = model.getScaleComponent(channel).get('type'); - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - const timeUnit = isFieldDef(fieldOrDatumDef) ? (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit : undefined; - const orient = legend.orient || config.legend.orient || 'right'; - const legendType = getLegendType({ legend, channel, timeUnit, scaleType }); - const direction = getDirection({ legend, legendType, orient, legendConfig }); - const ruleParams = { - legend, - channel, - model, - markDef, - encoding, - fieldOrDatumDef, - legendConfig, - config, - scaleType, - orient, - legendType, - direction - }; - for (const property of LEGEND_COMPONENT_PROPERTIES) { - if ((legendType === 'gradient' && property.startsWith('symbol')) || - (legendType === 'symbol' && property.startsWith('gradient'))) { - continue; - } - const value = property in legendRules ? legendRules[property](ruleParams) : legend[property]; - if (value !== undefined) { - const explicit = isExplicit(value, property, legend, model.fieldDef(channel)); - if (explicit || config.legend[property] === undefined) { - legendCmpt.set(property, value, explicit); - } - } - } - const legendEncoding = (_b = legend === null || legend === void 0 ? void 0 : legend.encoding) !== null && _b !== void 0 ? _b : {}; - const selections = legendCmpt.get('selections'); - const legendEncode = {}; - const legendEncodeParams = { fieldOrDatumDef, model, channel, legendCmpt, legendType }; - for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) { - const legendEncodingPart = guideEncodeEntry((_c = legendEncoding[part]) !== null && _c !== void 0 ? _c : {}, model); - const value = part in legendEncodeRules - ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule - : legendEncodingPart; // no rule -- just default values - if (value !== undefined && !isEmpty(value)) { - legendEncode[part] = Object.assign(Object.assign(Object.assign({}, ((selections === null || selections === void 0 ? void 0 : selections.length) && isFieldDef(fieldOrDatumDef) - ? { name: `${varName(fieldOrDatumDef.field)}_legend_${part}` } - : {})), ((selections === null || selections === void 0 ? void 0 : selections.length) ? { interactive: !!selections } : {})), { update: value }); - } - } - if (!isEmpty(legendEncode)) { - legendCmpt.set('encode', legendEncode, !!(legend === null || legend === void 0 ? void 0 : legend.encoding)); - } - return legendCmpt; -} -function parseNonUnitLegend(model) { - const { legends, resolve } = model.component; - for (const child of model.children) { - parseLegend(child); - for (const channel of keys(child.component.legends)) { - resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel); - if (resolve.legend[channel] === 'shared') { - // If the resolve says shared (and has not been overridden) - // We will try to merge and see if there is a conflict - legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]); - if (!legends[channel]) { - // If merge returns nothing, there is a conflict so we cannot make the legend shared. - // Thus, mark legend as independent and remove the legend component. - resolve.legend[channel] = 'independent'; - delete legends[channel]; - } - } - } - } - for (const channel of keys(legends)) { - for (const child of model.children) { - if (!child.component.legends[channel]) { - // skip if the child does not have a particular legend - continue; - } - if (resolve.legend[channel] === 'shared') { - // After merging shared legend, make sure to remove legend from child - delete child.component.legends[channel]; - } - } - } - return legends; -} -export function mergeLegendComponent(mergedLegend, childLegend) { - var _a, _b, _c, _d; - if (!mergedLegend) { - return childLegend.clone(); - } - const mergedOrient = mergedLegend.getWithExplicit('orient'); - const childOrient = childLegend.getWithExplicit('orient'); - if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { - // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) - // Cannot merge due to inconsistent orient - return undefined; - } - let typeMerged = false; - // Otherwise, let's merge - for (const prop of LEGEND_COMPONENT_PROPERTIES) { - const mergedValueWithExplicit = mergeValuesWithExplicit(mergedLegend.getWithExplicit(prop), childLegend.getWithExplicit(prop), prop, 'legend', - // Tie breaker function - (v1, v2) => { - switch (prop) { - case 'symbolType': - return mergeSymbolType(v1, v2); - case 'title': - return mergeTitleComponent(v1, v2); - case 'type': - // There are only two types. If we have different types, then prefer symbol over gradient. - typeMerged = true; - return makeImplicit('symbol'); - } - return defaultTieBreaker(v1, v2, prop, 'legend'); - }); - mergedLegend.setWithExplicit(prop, mergedValueWithExplicit); - } - if (typeMerged) { - if ((_b = (_a = mergedLegend.implicit) === null || _a === void 0 ? void 0 : _a.encode) === null || _b === void 0 ? void 0 : _b.gradient) { - deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']); - } - if ((_d = (_c = mergedLegend.explicit) === null || _c === void 0 ? void 0 : _c.encode) === null || _d === void 0 ? void 0 : _d.gradient) { - deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']); - } - } - return mergedLegend; -} -function mergeSymbolType(st1, st2) { - if (st2.value === 'circle') { - // prefer "circle" over "stroke" - return st2; - } - return st1; -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/parse.js.map b/node_modules/vega-lite/build/src/compile/legend/parse.js.map deleted file mode 100644 index f3914b5..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/legend/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAA2B,KAAK,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAqB,kBAAkB,EAAE,UAAU,EAAqC,MAAM,kBAAkB,CAAC;AACxH,OAAO,EAAS,qBAAqB,EAAC,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,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I,CAAC;oBAClB,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;aACjC;YACD,OAAO,iBAAiB,CAA4B,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC9E,CAAC,CACF,CAAC;QACF,YAAY,CAAC,eAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;KAC7D;IACD,IAAI,UAAU,EAAE;QACd,gBAAI,YAAY,CAAC,QAAQ,0CAAE,MAAM,0CAAE,QAAQ,EAAE;YAC3C,oBAAoB,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;SACrE;QACD,gBAAI,YAAY,CAAC,QAAQ,0CAAE,MAAM,0CAAE,QAAQ,EAAE;YAC3C,oBAAoB,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;SACrE;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,eAAe,CAAC,GAAqB,EAAE,GAAqB;IACnE,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE;QAC1B,gCAAgC;QAChC,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,GAAG,CAAC;AACb,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/properties.d.ts b/node_modules/vega-lite/build/src/compile/legend/properties.d.ts deleted file mode 100644 index e43ed50..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/properties.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { LabelOverlap, LegendOrient, LegendType, Orientation, SignalRef, SymbolShape } from 'vega'; -import { DatumDef, MarkPropFieldOrDatumDef, TypedFieldDef } from '../../channeldef'; -import { Config } from '../../config'; -import { Encoding } from '../../encoding'; -import { Legend, LegendConfig } from '../../legend'; -import { Mark, MarkDef } from '../../mark'; -import { ScaleType } from '../../scale'; -import { TimeUnit } from '../../timeunit'; -import { Model } from '../model'; -import { UnitModel } from '../unit'; -import { NonPositionScaleChannel } from './../../channel'; -import { LegendComponentProps } from './component'; -export interface LegendRuleParams { - legend: Legend; - channel: NonPositionScaleChannel; - model: UnitModel; - markDef: MarkDef; - encoding: Encoding; - fieldOrDatumDef: MarkPropFieldOrDatumDef; - legendConfig: LegendConfig; - config: Config; - scaleType: ScaleType; - orient: LegendOrient; - legendType: LegendType; - direction: Orientation; -} -export declare const legendRules: { - [k in keyof LegendComponentProps]?: (params: LegendRuleParams) => LegendComponentProps[k]; -}; -export declare function values(legend: Legend, fieldOrDatumDef: TypedFieldDef | DatumDef): SignalRef | (string | number | boolean | import("../../datetime").DateTime | { - signal: string; -})[]; -export declare function defaultSymbolType(mark: Mark, channel: NonPositionScaleChannel, shapeChannelDef: Encoding['shape'], markShape: SymbolShape | SignalRef): SymbolShape | SignalRef; -export declare function clipHeight(legendType: LegendType): number; -export declare function getLegendType(params: { - legend: Legend; - channel: NonPositionScaleChannel; - timeUnit?: TimeUnit; - scaleType: ScaleType; -}): LegendType; -export declare function defaultType({ channel, timeUnit, scaleType }: { - channel: NonPositionScaleChannel; - timeUnit?: TimeUnit; - scaleType: ScaleType; -}): LegendType; -export declare function getDirection({ legendConfig, legendType, orient, legend }: { - orient: LegendOrient; - legendConfig: LegendConfig; - legendType: LegendType; - legend: Legend; -}): Orientation; -export declare function defaultDirection(orient: LegendOrient, legendType: LegendType): 'horizontal' | undefined; -export declare function defaultGradientLength({ legendConfig, model, direction, orient, scaleType }: { - scaleType: ScaleType; - direction: Orientation; - orient: LegendOrient; - model: Model; - legendConfig: LegendConfig; -}): number | { - signal: string; -}; -export declare function defaultLabelOverlap(scaleType: ScaleType): LabelOverlap; -//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/properties.d.ts.map b/node_modules/vega-lite/build/src/compile/legend/properties.d.ts.map deleted file mode 100644 index c68df3b..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/properties.d.ts.map +++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SAAS,CAgBvG;AAED,wBAAgB,qBAAqB,CAAC,EACpC,YAAY,EACZ,KAAK,EACL,SAAS,EACT,MAAM,EACN,SAAS,EACV,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,YAAY,CAAC;CAC5B;;EAoBA;AAOD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CAKtE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/properties.js b/node_modules/vega-lite/build/src/compile/legend/properties.js deleted file mode 100644 index 48e0b70..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/properties.js +++ /dev/null @@ -1,149 +0,0 @@ -import { isArray } from 'vega-util'; -import { isColorChannel } from '../../channel'; -import { title as fieldDefTitle, valueArray } from '../../channeldef'; -import { isContinuousToContinuous } from '../../scale'; -import { contains, getFirstDefined } from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { guideFormat, guideFormatType } from '../format'; -import { getFirstConditionValue } from './encode'; -export const legendRules = { - direction: ({ direction }) => direction, - format: ({ fieldOrDatumDef, legend, config }) => { - const { format, formatType } = legend; - return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false); - }, - formatType: ({ legend, fieldOrDatumDef, scaleType }) => { - const { formatType } = legend; - return guideFormatType(formatType, fieldOrDatumDef, scaleType); - }, - gradientLength: params => { - var _a, _b; - const { legend, legendConfig } = params; - return (_b = (_a = legend.gradientLength) !== null && _a !== void 0 ? _a : legendConfig.gradientLength) !== null && _b !== void 0 ? _b : defaultGradientLength(params); - }, - labelOverlap: ({ legend, legendConfig, scaleType }) => { var _a, _b; return (_b = (_a = legend.labelOverlap) !== null && _a !== void 0 ? _a : legendConfig.labelOverlap) !== null && _b !== void 0 ? _b : defaultLabelOverlap(scaleType); }, - symbolType: ({ legend, markDef, channel, encoding }) => { var _a; return (_a = legend.symbolType) !== null && _a !== void 0 ? _a : defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape); }, - title: ({ fieldOrDatumDef, config }) => fieldDefTitle(fieldOrDatumDef, config, { allowDisabling: true }), - type: ({ legendType, scaleType, channel }) => { - if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) { - if (legendType === 'gradient') { - return undefined; - } - } - else if (legendType === 'symbol') { - return undefined; - } - return legendType; - }, - values: ({ fieldOrDatumDef, legend }) => values(legend, fieldOrDatumDef) -}; -export function values(legend, fieldOrDatumDef) { - const vals = legend.values; - if (isArray(vals)) { - return valueArray(fieldOrDatumDef, vals); - } - else if (isSignalRef(vals)) { - return vals; - } - return undefined; -} -export function defaultSymbolType(mark, channel, shapeChannelDef, markShape) { - var _a; - if (channel !== 'shape') { - // use the value from the shape encoding or the mark config if they exist - const shape = (_a = getFirstConditionValue(shapeChannelDef)) !== null && _a !== void 0 ? _a : markShape; - if (shape) { - return shape; - } - } - switch (mark) { - case 'bar': - case 'rect': - case 'image': - case 'square': - return 'square'; - case 'line': - case 'trail': - case 'rule': - return 'stroke'; - case 'arc': - case 'point': - case 'circle': - case 'tick': - case 'geoshape': - case 'area': - case 'text': - return 'circle'; - } -} -export function clipHeight(legendType) { - if (legendType === 'gradient') { - return 20; - } - return undefined; -} -export function getLegendType(params) { - const { legend } = params; - return getFirstDefined(legend.type, defaultType(params)); -} -export function defaultType({ channel, timeUnit, scaleType }) { - // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js - if (isColorChannel(channel)) { - if (contains(['quarter', 'month', 'day'], timeUnit)) { - return 'symbol'; - } - if (isContinuousToContinuous(scaleType)) { - return 'gradient'; - } - } - return 'symbol'; -} -export function getDirection({ legendConfig, legendType, orient, legend }) { - var _a, _b; - return ((_b = (_a = legend.direction) !== null && _a !== void 0 ? _a : legendConfig[legendType ? 'gradientDirection' : 'symbolDirection']) !== null && _b !== void 0 ? _b : defaultDirection(orient, legendType)); -} -export function defaultDirection(orient, legendType) { - switch (orient) { - case 'top': - case 'bottom': - return 'horizontal'; - case 'left': - case 'right': - case 'none': - case undefined: // undefined = "right" in Vega - return undefined; // vertical is Vega's default - default: - // top-left / ... - // For inner legend, uses compact layout like Tableau - return legendType === 'gradient' ? 'horizontal' : undefined; - } -} -export function defaultGradientLength({ legendConfig, model, direction, orient, scaleType }) { - const { gradientHorizontalMaxLength, gradientHorizontalMinLength, gradientVerticalMaxLength, gradientVerticalMinLength } = legendConfig; - if (isContinuousToContinuous(scaleType)) { - if (direction === 'horizontal') { - if (orient === 'top' || orient === 'bottom') { - return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength); - } - else { - return gradientHorizontalMinLength; - } - } - else { - // vertical / undefined (Vega uses vertical by default) - return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength); - } - } - return undefined; -} -function gradientLengthSignal(model, sizeType, min, max) { - const sizeSignal = model.getSizeSignalRef(sizeType).signal; - return { signal: `clamp(${sizeSignal}, ${min}, ${max})` }; -} -export function defaultLabelOverlap(scaleType) { - if (contains(['quantile', 'threshold', 'log'], scaleType)) { - return 'greedy'; - } - return undefined; -} -//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/legend/properties.js.map b/node_modules/vega-lite/build/src/compile/legend/properties.js.map deleted file mode 100644 index a35841c..0000000 --- a/node_modules/vega-lite/build/src/compile/legend/properties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../../src/compile/legend/properties.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAoC,KAAK,IAAI,aAAa,EAAiB,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAKtH,OAAO,EAAC,wBAAwB,EAAY,MAAM,aAAa,CA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EAAE,yBAAyB,CAAC,CAAC;SACpG;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAY,EAAE,QAA4B,EAAE,GAAW,EAAE,GAAW;IAChG,MAAM,UAAU,GAAG,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;IAC3D,OAAO,EAAC,MAAM,EAAE,SAAS,UAAU,KAAK,GAAG,KAAK,GAAG,GAAG,EAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,SAAoB;IACtD,IAAI,QAAQ,CAAC,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,EAAE;QACzD,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/arc.d.ts b/node_modules/vega-lite/build/src/compile/mark/arc.d.ts deleted file mode 100644 index 9ca1032..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/arc.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const arc: MarkCompiler; -//# sourceMappingURL=arc.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/arc.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/arc.d.ts.map deleted file mode 100644 index 79f0a7d..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/arc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"arc.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/arc.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,GAAG,EAAE,YAoBjB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/arc.js b/node_modules/vega-lite/build/src/compile/mark/arc.js deleted file mode 100644 index 5bc0f4c..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/arc.js +++ /dev/null @@ -1,15 +0,0 @@ -import * as encode from './encode'; -export const arc = { - vgMark: 'arc', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - })), encode.pointPosition('x', model, { defaultPos: 'mid' })), encode.pointPosition('y', model, { defaultPos: 'mid' })), encode.rectPosition(model, 'radius', 'arc')), encode.rectPosition(model, 'theta', 'arc')); - } -}; -//# sourceMappingURL=arc.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/arc.js.map b/node_modules/vega-lite/build/src/compile/mark/arc.js.map deleted file mode 100644 index 603dee1..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/arc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"arc.js","sourceRoot":"","sources":["../../../../src/compile/mark/arc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,GAAG,GAAiB;IAC/B,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,iFACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,QAAQ;SAChB,CAAC,GACC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC,GACrD,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC,GAGrD,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,GAC3C,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAC7C;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/area.d.ts b/node_modules/vega-lite/build/src/compile/mark/area.d.ts deleted file mode 100644 index ecd9da2..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/area.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const area: MarkCompiler; -//# sourceMappingURL=area.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/area.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/area.d.ts.map deleted file mode 100644 index 33f80c6..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/area.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"area.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/area.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YAyBlB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/area.js b/node_modules/vega-lite/build/src/compile/mark/area.js deleted file mode 100644 index 99bed59..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/area.js +++ /dev/null @@ -1,23 +0,0 @@ -import * as encode from './encode'; -export const area = { - vgMark: 'area', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'include', - size: 'ignore', - theta: 'ignore' - })), encode.pointOrRangePosition('x', model, { - defaultPos: 'zeroOrMin', - defaultPos2: 'zeroOrMin', - range: model.markDef.orient === 'horizontal' - })), encode.pointOrRangePosition('y', model, { - defaultPos: 'zeroOrMin', - defaultPos2: 'zeroOrMin', - range: model.markDef.orient === 'vertical' - })), encode.defined(model)); - } -}; -//# sourceMappingURL=area.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/area.js.map b/node_modules/vega-lite/build/src/compile/mark/area.js.map deleted file mode 100644 index 90e4c64..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/area.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"area.js","sourceRoot":"","sources":["../../../../src/compile/mark/area.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,mEACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,GACC,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE;YACzC,UAAU,EAAE,WAAW;YACvB,WAAW,EAAE,WAAW;YACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,YAAY;SAC7C,CAAC,GACC,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE;YACzC,UAAU,EAAE,WAAW;YACvB,WAAW,EAAE,WAAW;YACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU;SAC3C,CAAC,GACC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EACxB;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/bar.d.ts b/node_modules/vega-lite/build/src/compile/mark/bar.d.ts deleted file mode 100644 index a144874..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/bar.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const bar: MarkCompiler; -//# sourceMappingURL=bar.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/bar.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/bar.d.ts.map deleted file mode 100644 index 0365b60..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/bar.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/bar.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,GAAG,EAAE,YAgBjB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/bar.js b/node_modules/vega-lite/build/src/compile/mark/bar.js deleted file mode 100644 index 7febb5c..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/bar.js +++ /dev/null @@ -1,15 +0,0 @@ -import * as encode from './encode'; -export const bar = { - vgMark: 'rect', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), encode.rectPosition(model, 'x', 'bar')), encode.rectPosition(model, 'y', 'bar')); - } -}; -//# sourceMappingURL=bar.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/bar.js.map b/node_modules/vega-lite/build/src/compile/mark/bar.js.map deleted file mode 100644 index 110fa6b..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/bar.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bar.js","sourceRoot":"","sources":["../../../../src/compile/mark/bar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,GAAG,GAAiB;IAC/B,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,qDACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,GACC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GACtC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EACzC;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/base.d.ts b/node_modules/vega-lite/build/src/compile/mark/base.d.ts deleted file mode 100644 index a242d7a..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/base.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Mark } from 'vega'; -import { VgEncodeEntry, VgPostEncodingTransform } from '../../vega.schema'; -import { UnitModel } from '../unit'; -/** - * Abstract interface for compiling a Vega-Lite primitive mark type. - */ -export interface MarkCompiler { - /** - * Underlying Vega Mark type for the Vega-Lite mark. - */ - vgMark: Mark['type']; - encodeEntry: (model: UnitModel) => VgEncodeEntry; - /** - * Transform on a mark after render, used for layout and projections - */ - postEncodingTransform?: (model: UnitModel) => VgPostEncodingTransform[]; -} -//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/base.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/base.d.ts.map deleted file mode 100644 index 977bbda..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/base.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,aAAa,EAAE,uBAAuB,EAAC,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAErB,WAAW,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,aAAa,CAAC;IAEjD;;OAEG;IACH,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,uBAAuB,EAAE,CAAC;CACzE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/base.js b/node_modules/vega-lite/build/src/compile/mark/base.js deleted file mode 100644 index c96e397..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/base.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/base.js.map b/node_modules/vega-lite/build/src/compile/mark/base.js.map deleted file mode 100644 index 28662bb..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/base.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/compile/mark/base.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/aria.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/aria.d.ts deleted file mode 100644 index bb45442..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/aria.d.ts +++ /dev/null @@ -1,386 +0,0 @@ -import { UnitModel } from './../../unit'; -export declare function aria(model: UnitModel): { - stroke?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - text?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - width?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - height?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - path?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - shape?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - orient?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadius?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - x?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - y?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - x2?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - y2?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - theta?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - radius?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fill?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - opacity?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fillOpacity?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeOpacity?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeWidth?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeDash?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - size?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - angle?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - tooltip?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - href?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - url?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - interpolate?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - align?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - xc?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - yc?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeCap?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeJoin?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeOffset?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeForeground?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cursor?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - clip?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - innerRadius?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - outerRadius?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - startAngle?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - endAngle?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - tension?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - baseline?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - dir?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - ellipsis?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - limit?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - dx?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - dy?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - font?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fontSize?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fontWeight?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fontStyle?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - defined?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - scaleX?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - scaleY?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - ariaRoleDescription?: undefined; - aria?: true | import("vega-typings/types").SignalRef; -} | { - description: import("vega-typings/types").SignalRef | { - value: string; - }; - ariaRoleDescription?: undefined; - aria?: true | import("vega-typings/types").SignalRef; -} | { - stroke?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - text?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - width?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - height?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - path?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - shape?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - orient?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadius?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - x?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - y?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - x2?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - y2?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - theta?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - radius?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fill?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - opacity?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fillOpacity?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeOpacity?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeWidth?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeDash?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - size?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - angle?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - tooltip?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - href?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - url?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - interpolate?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - align?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - xc?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - yc?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeCap?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeJoin?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeOffset?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - strokeForeground?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cursor?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - clip?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - innerRadius?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - outerRadius?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - startAngle?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - endAngle?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - tension?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - baseline?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - dir?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - ellipsis?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - limit?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - dx?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - dy?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - font?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fontSize?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fontWeight?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - fontStyle?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - defined?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - scaleX?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - scaleY?: import("../../../vega.schema").VgValueRef | (import("../../../vega.schema").VgValueRef & { - test?: string; - })[]; - ariaRoleDescription: { - value: import("vega-typings/types").ScaleField; - }; - aria?: true | import("vega-typings/types").SignalRef; -} | { - description: import("vega-typings/types").SignalRef | { - value: string; - }; - ariaRoleDescription: { - value: import("vega-typings/types").ScaleField; - }; - aria?: true | import("vega-typings/types").SignalRef; -}; -export declare function description(model: UnitModel): Partial> | { - description: import("vega-typings/types").SignalRef | { - value: string; - }; -}; -//# sourceMappingURL=aria.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/aria.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/aria.d.ts.map deleted file mode 100644 index 4fcae3c..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/aria.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aria.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/aria.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAKvC,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBpC;AAkBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS;;;;;;EAkC3C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/aria.js b/node_modules/vega-lite/build/src/compile/mark/encode/aria.js deleted file mode 100644 index 08ddff4..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/aria.js +++ /dev/null @@ -1,57 +0,0 @@ -import { entries, isEmpty } from '../../../util'; -import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; -import { VG_MARK_INDEX } from './../../../vega.schema'; -import { wrapCondition } from './conditional'; -import { textRef } from './text'; -import { tooltipData } from './tooltip'; -export function aria(model) { - const { markDef, config } = model; - const enableAria = getMarkPropOrConfig('aria', markDef, config); - // We can ignore other aria properties if ariaHidden is true. - if (enableAria === false) { - // getMarkGroups sets aria to false already so we don't have to set it in the encode block - return {}; - } - return Object.assign(Object.assign(Object.assign({}, (enableAria ? { aria: enableAria } : {})), ariaRoleDescription(model)), description(model)); -} -function ariaRoleDescription(model) { - const { mark, markDef, config } = model; - if (config.aria === false) { - return {}; - } - const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config); - if (ariaRoleDesc != null) { - return { ariaRoleDescription: { value: ariaRoleDesc } }; - } - return mark in VG_MARK_INDEX ? {} : { ariaRoleDescription: { value: mark } }; -} -export function description(model) { - const { encoding, markDef, config, stack } = model; - const channelDef = encoding.description; - if (channelDef) { - return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config)); - } - // Use default from mark def or config if defined. - // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here. - const descriptionValue = getMarkPropOrConfig('description', markDef, config); - if (descriptionValue != null) { - return { - description: signalOrValueRef(descriptionValue) - }; - } - if (config.aria === false) { - return {}; - } - const data = tooltipData(encoding, stack, config); - if (isEmpty(data)) { - return undefined; - } - return { - description: { - signal: entries(data) - .map(({ key, value }, index) => `"${index > 0 ? '; ' : ''}${key}: " + (${value})`) - .join(' + ') - } - }; -} -//# sourceMappingURL=aria.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/aria.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/aria.js.map deleted file mode 100644 index 187ac70..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/aria.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aria.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/aria.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnE,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAEtC,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,MAAM,EAAC,OAAO,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAEhC,MAAM,UAAU,GAAG,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAEhE,6DAA6D;IAC7D,IAAI,UAAU,KAAK,KAAK,EAAE;QACxB,0FAA0F;QAC1F,OAAO,EAAE,CAAC;KACX;IAED,qDACK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC,CAAC,CAAC,EAA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K,EAAE;QACzB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAElD,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;QACjB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,WAAW,EAAE;YACX,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC;iBAClB,GAAG,CAAC,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,UAAU,KAAK,GAAG,CAAC;iBAC/E,IAAI,CAAC,KAAK,CAAC;SACf;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/base.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/base.d.ts deleted file mode 100644 index c0870d4..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/base.d.ts +++ /dev/null @@ -1,1481 +0,0 @@ -import { VgValueRef } from '../../../vega.schema'; -import { UnitModel } from '../../unit'; -export { color } from './color'; -export { wrapCondition } from './conditional'; -export { nonPosition } from './nonposition'; -export { pointPosition } from './position-point'; -export { pointOrRangePosition, rangePosition } from './position-range'; -export { rectPosition } from './position-rect'; -export { text } from './text'; -export { tooltip } from './tooltip'; -export declare type Ignore = Record<'color' | 'size' | 'orient' | 'align' | 'baseline' | 'theta', 'ignore' | 'include'>; -export declare function baseEncodeEntry(model: UnitModel, ignore: Ignore): { - stroke?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - text?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - width?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - height?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - path?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - shape?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - orient?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - theta?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - radius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fill?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - opacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fillOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeWidth?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDash?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - size?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - angle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tooltip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - href?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - url?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - interpolate?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - align?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - xc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - yc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeCap?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeJoin?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeForeground?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cursor?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - clip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - innerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - outerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - startAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - endAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tension?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - baseline?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dir?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ellipsis?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - limit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dx?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dy?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - font?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontSize?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontWeight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontStyle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - defined?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleX?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleY?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ariaRoleDescription?: undefined; - aria?: true | import("vega-typings/types").SignalRef; -} | { - description: import("vega-typings/types").SignalRef | { - value: string; - }; - ariaRoleDescription?: undefined; - aria?: true | import("vega-typings/types").SignalRef; - stroke?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - text?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - width?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - height?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - path?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - shape?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - orient?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - theta?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - radius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fill?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - opacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fillOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeWidth?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDash?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - size?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - angle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tooltip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - href?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - url?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - interpolate?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - align?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - xc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - yc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeCap?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeJoin?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeForeground?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cursor?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - clip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - innerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - outerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - startAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - endAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tension?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - baseline?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dir?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ellipsis?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - limit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dx?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dy?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - font?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontSize?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontWeight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontStyle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - defined?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleX?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleY?: VgValueRef | (VgValueRef & { - test?: string; - })[]; -} | { - stroke?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - text?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - width?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - height?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - path?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - shape?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - orient?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - theta?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - radius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fill?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - opacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fillOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeWidth?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDash?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - size?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - angle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tooltip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - href?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - url?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - interpolate?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - align?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - xc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - yc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeCap?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeJoin?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeForeground?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cursor?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - clip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - innerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - outerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - startAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - endAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tension?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - baseline?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dir?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ellipsis?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - limit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dx?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dy?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - font?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontSize?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontWeight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontStyle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - defined?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleX?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleY?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ariaRoleDescription: { - value: import("vega-typings/types").ScaleField; - }; - aria?: true | import("vega-typings/types").SignalRef; -} | { - description: import("vega-typings/types").SignalRef | { - value: string; - }; - ariaRoleDescription: { - value: import("vega-typings/types").ScaleField; - }; - aria?: true | import("vega-typings/types").SignalRef; - stroke?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - text?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - width?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - height?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - path?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - shape?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - orient?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - theta?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - radius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fill?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - opacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fillOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeWidth?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDash?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - size?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - angle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tooltip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - href?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - url?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - interpolate?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - align?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - xc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - yc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeCap?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeJoin?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeForeground?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cursor?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - clip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - innerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - outerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - startAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - endAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tension?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - baseline?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dir?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ellipsis?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - limit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dx?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dy?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - font?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontSize?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontWeight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontStyle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - defined?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleX?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleY?: VgValueRef | (VgValueRef & { - test?: string; - })[]; -} | { - stroke?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - text?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - width?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - height?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - path?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - shape?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - orient?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - theta?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - radius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fill?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - opacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fillOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeWidth?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDash?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - size?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - angle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tooltip: VgValueRef | (VgValueRef & { - test?: string; - })[] | { - signal: string; - }; - href?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - url?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - interpolate?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - align?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - xc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - yc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeCap?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeJoin?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeForeground?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cursor?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - clip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - innerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - outerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - startAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - endAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tension?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - baseline?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dir?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ellipsis?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - limit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dx?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dy?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - font?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontSize?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontWeight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontStyle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - defined?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleX?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleY?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ariaRoleDescription?: undefined; - aria?: true | import("vega-typings/types").SignalRef; -} | { - description: import("vega-typings/types").SignalRef | { - value: string; - }; - ariaRoleDescription?: undefined; - aria?: true | import("vega-typings/types").SignalRef; - stroke?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - text?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - width?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - height?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - path?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - shape?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - orient?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - theta?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - radius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fill?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - opacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fillOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeWidth?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDash?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - size?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - angle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tooltip: VgValueRef | (VgValueRef & { - test?: string; - })[] | { - signal: string; - }; - href?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - url?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - interpolate?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - align?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - xc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - yc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeCap?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeJoin?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeForeground?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cursor?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - clip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - innerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - outerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - startAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - endAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tension?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - baseline?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dir?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ellipsis?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - limit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dx?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dy?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - font?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontSize?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontWeight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontStyle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - defined?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleX?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleY?: VgValueRef | (VgValueRef & { - test?: string; - })[]; -} | { - stroke?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - text?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - width?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - height?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - path?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - shape?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - orient?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - theta?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - radius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fill?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - opacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fillOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeWidth?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDash?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - size?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - angle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tooltip: VgValueRef | (VgValueRef & { - test?: string; - })[] | { - signal: string; - }; - href?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - url?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - interpolate?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - align?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - xc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - yc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeCap?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeJoin?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeForeground?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cursor?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - clip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - innerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - outerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - startAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - endAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tension?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - baseline?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dir?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ellipsis?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - limit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dx?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dy?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - font?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontSize?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontWeight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontStyle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - defined?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleX?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleY?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ariaRoleDescription: { - value: import("vega-typings/types").ScaleField; - }; - aria?: true | import("vega-typings/types").SignalRef; -} | { - description: import("vega-typings/types").SignalRef | { - value: string; - }; - ariaRoleDescription: { - value: import("vega-typings/types").ScaleField; - }; - aria?: true | import("vega-typings/types").SignalRef; - stroke?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - text?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - width?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - height?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - path?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - shape?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - orient?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - x2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - y2?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - theta?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - radius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fill?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - opacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fillOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOpacity?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeWidth?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDash?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - size?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - angle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tooltip: VgValueRef | (VgValueRef & { - test?: string; - })[] | { - signal: string; - }; - href?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - url?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - interpolate?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - align?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - xc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - yc?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeCap?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeDashOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeMiterLimit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeJoin?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeOffset?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - strokeForeground?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cursor?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - clip?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - innerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - outerRadius?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - startAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - endAngle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - tension?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - baseline?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dir?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - ellipsis?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - limit?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dx?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - dy?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - font?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontSize?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontWeight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - fontStyle?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - defined?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusTopRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleX?: VgValueRef | (VgValueRef & { - test?: string; - })[]; - scaleY?: VgValueRef | (VgValueRef & { - test?: string; - })[]; -}; -//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/base.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/base.d.ts.map deleted file mode 100644 index 8e38ce6..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/base.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/base.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,UAAU,EAAkB,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AASrC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,oBAAoB,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,oBAAY,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;AAIhH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB/D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/base.js b/node_modules/vega-lite/build/src/compile/mark/encode/base.js deleted file mode 100644 index b242cc5..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/base.js +++ /dev/null @@ -1,77 +0,0 @@ -import { array } from 'vega-util'; -import { SCALE_CHANNELS } from '../../../channel'; -import { isPathMark } from '../../../mark'; -import { hasContinuousDomain } from '../../../scale'; -import { keys } from '../../../util'; -import { VG_MARK_CONFIGS } from '../../../vega.schema'; -import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; -import { aria } from './aria'; -import { color } from './color'; -import { nonPosition } from './nonposition'; -import { text } from './text'; -import { tooltip } from './tooltip'; -import { fieldInvalidPredicate } from './valueref'; -import { zindex } from './zindex'; -export { color } from './color'; -export { wrapCondition } from './conditional'; -export { nonPosition } from './nonposition'; -export { pointPosition } from './position-point'; -export { pointOrRangePosition, rangePosition } from './position-range'; -export { rectPosition } from './position-rect'; -export { text } from './text'; -export { tooltip } from './tooltip'; -const ALWAYS_IGNORE = new Set(['aria']); -export function baseEncodeEntry(model, ignore) { - const { fill = undefined, stroke = undefined } = ignore.color === 'include' ? color(model) : {}; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, markDefProperties(model.markDef, ignore)), wrapAllFieldsInvalid(model, 'fill', fill)), wrapAllFieldsInvalid(model, 'stroke', stroke)), nonPosition('opacity', model)), nonPosition('fillOpacity', model)), nonPosition('strokeOpacity', model)), nonPosition('strokeWidth', model)), nonPosition('strokeDash', model)), zindex(model)), tooltip(model)), text(model, 'href')), aria(model)); -} -// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987 -function wrapAllFieldsInvalid(model, channel, valueRef) { - const { config, mark, markDef } = model; - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid === 'hide' && valueRef && !isPathMark(mark)) { - // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains. - // For path marks, we will use "defined" property and skip these values instead. - const test = allFieldsInvalidPredicate(model, { invalid: true, channels: SCALE_CHANNELS }); - if (test) { - return { - [channel]: [ - // prepend the invalid case - // TODO: support custom value - { test, value: null }, - ...array(valueRef) - ] - }; - } - } - return valueRef ? { [channel]: valueRef } : {}; -} -function markDefProperties(mark, ignore) { - return VG_MARK_CONFIGS.reduce((m, prop) => { - if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') { - m[prop] = signalOrValueRef(mark[prop]); - } - return m; - }, {}); -} -function allFieldsInvalidPredicate(model, { invalid = false, channels }) { - const filterIndex = channels.reduce((aggregator, channel) => { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const field = model.vgField(channel, { expr: 'datum' }); - // While discrete domain scales can handle invalid values, continuous scales can't. - if (field && hasContinuousDomain(scaleType)) { - aggregator[field] = true; - } - } - return aggregator; - }, {}); - const fields = keys(filterIndex); - if (fields.length > 0) { - const op = invalid ? '||' : '&&'; - return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); - } - return undefined; -} -//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/base.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/base.js.map deleted file mode 100644 index 1c5be45..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/base.js.map +++ /dev/null @@ -1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,CAAC;YAEtD,mFAAmF;YACnF,IAAI,KAAK,IAAI,mBAAmB,CAAC,SAAS,CAAC,EAAE;gBAC3C,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;aAC1B;SACF;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACrB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACjC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KACnF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/color.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/color.d.ts deleted file mode 100644 index caa7df6..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/color.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { VgEncodeEntry } from '../../../vega.schema'; -import { UnitModel } from '../../unit'; -export declare function color(model: UnitModel, opt?: { - filled: boolean | undefined; -}): VgEncodeEntry; -//# sourceMappingURL=color.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/color.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/color.d.ts.map deleted file mode 100644 index 1fb3818..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/color.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/color.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,GAAE;IAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAA;CAAuB,GAAG,aAAa,CAkD/G"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/color.js b/node_modules/vega-lite/build/src/compile/mark/encode/color.js deleted file mode 100644 index f401eb7..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/color.js +++ /dev/null @@ -1,39 +0,0 @@ -import * as log from '../../../log'; -import { contains } from '../../../util'; -import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; -import { nonPosition } from './nonposition'; -export function color(model, opt = { filled: undefined }) { - var _a, _b, _c, _d; - const { markDef, encoding, config } = model; - const { type: markType } = markDef; - // Allow filled to be overridden (for trail's "filled") - const filled = (_a = opt.filled) !== null && _a !== void 0 ? _a : getMarkPropOrConfig('filled', markDef, config); - const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType) - ? 'transparent' - : undefined; - const defaultFill = (_c = (_b = getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, { vgChannel: 'fill' })) !== null && _b !== void 0 ? _b : - // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified - config.mark[filled === true && 'color']) !== null && _c !== void 0 ? _c : - // If there is no fill, always fill symbols, bar, geoshape - // with transparent fills https://github.com/vega/vega-lite/issues/1316 - transparentIfNeeded; - const defaultStroke = (_d = getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, { vgChannel: 'stroke' })) !== null && _d !== void 0 ? _d : - // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified - config.mark[filled === false && 'color']; - const colorVgChannel = filled ? 'fill' : 'stroke'; - const fillStrokeMarkDefAndConfig = Object.assign(Object.assign({}, (defaultFill ? { fill: signalOrValueRef(defaultFill) } : {})), (defaultStroke ? { stroke: signalOrValueRef(defaultStroke) } : {})); - if (markDef.color && (filled ? markDef.fill : markDef.stroke)) { - log.warn(log.message.droppingColor('property', { fill: 'fill' in markDef, stroke: 'stroke' in markDef })); - } - return Object.assign(Object.assign(Object.assign(Object.assign({}, fillStrokeMarkDefAndConfig), nonPosition('color', model, { - vgChannel: colorVgChannel, - defaultValue: filled ? defaultFill : defaultStroke - })), nonPosition('fill', model, { - // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding - defaultValue: encoding.fill ? defaultFill : undefined - })), nonPosition('stroke', model, { - // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding - defaultValue: encoding.stroke ? defaultStroke : undefined - })); -} -//# sourceMappingURL=color.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/color.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/color.js.map deleted file mode 100644 index 4a7b812..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/color.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"color.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/color.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,MAAM,UAAU,KAAK,CAAC,KAAgB,EAAE,MAAqC,EAAC,MAAM,EAAE,SAAS,EAAC;;IAC9F,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAC1C,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,OAAO,CAAC;IAEjC,uDAAuD;IACvD,MAAM,MAAM,SAAG,GAAG,CAAC,MAAM,mCAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAE5E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7D,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,EAAE,EAAC,IAAI,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,EAAE,QAAQ,IAAI,OAAO,EAAC,CAAC,CAAC,CAAC;KACzG;IAED,mEACK,0BAA0B,GAC1B,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE;QAC7B,SAAS,EAAE,cAAc;QACzB,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa;KACnD,CAAC,GACC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE;QAC5B,sGAAsG;QACtG,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;KACtD,CAAC,GACC,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE;QAC9B,0GAA0G;QAC1G,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;KAC1D,CAAC,EACF;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/conditional.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/conditional.d.ts deleted file mode 100644 index 0d5e3c5..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/conditional.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SignalRef } from 'vega'; -import { ChannelDef } from '../../../channeldef'; -import { GuideEncodingConditionalValueDef } from '../../../guide'; -import { VgEncodeEntry, VgValueRef } from '../../../vega.schema'; -import { UnitModel } from '../../unit'; -/** - * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition - * or a simple mixin if channel def has no condition. - */ -export declare function wrapCondition(model: UnitModel, channelDef: CD, vgChannel: string, refFn: (cDef: CD) => VgValueRef): VgEncodeEntry; -//# sourceMappingURL=conditional.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/conditional.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/conditional.d.ts.map deleted file mode 100644 index 142fce4..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/conditional.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"conditional.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/conditional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAE/B,OAAO,EACL,UAAU,EAKX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,gCAAgC,EAAC,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,SAAS,UAAU,GAAG,gCAAgC,GAAG,SAAS,EAChG,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,EAAE,EACd,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,UAAU,GAC9B,aAAa,CAqBf"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/conditional.js b/node_modules/vega-lite/build/src/compile/mark/encode/conditional.js deleted file mode 100644 index aa84fba..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/conditional.js +++ /dev/null @@ -1,29 +0,0 @@ -import { array } from 'vega-util'; -import { isConditionalDef, isConditionalSelection } from '../../../channeldef'; -import { expression } from '../../predicate'; -import { parseSelectionPredicate } from '../../selection/parse'; -/** - * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition - * or a simple mixin if channel def has no condition. - */ -export function wrapCondition(model, channelDef, vgChannel, refFn) { - const condition = isConditionalDef(channelDef) && channelDef.condition; - const valueRef = refFn(channelDef); - if (condition) { - const conditions = array(condition); - const vgConditions = conditions.map(c => { - const conditionValueRef = refFn(c); - const test = isConditionalSelection(c) - ? parseSelectionPredicate(model, c.selection) // FIXME: remove casting once TS is no longer dumb about it - : expression(model, c.test); // FIXME: remove casting once TS is no longer dumb about it - return Object.assign({ test }, conditionValueRef); - }); - return { - [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])] - }; - } - else { - return valueRef !== undefined ? { [vgChannel]: valueRef } : {}; - } -} -//# sourceMappingURL=conditional.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/conditional.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/conditional.js.map deleted file mode 100644 index 6f7f527..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/conditional.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"conditional.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/conditional.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAChC,OAAO,EAIL,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAC;AAG9D;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAgB,EAChB,UAAc,EACd,SAAiB,EACjB,KAA+B;IAE/B,MAAM,SAAS,GAAG,gBAAgB,CAAK,UAAU,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC;IAC3E,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IACnC,IAAI,SAAS,EAAE;QACb,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;QACpC,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACtC,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACnC,MAAM,IAAI,GAAG,sBAAsB,CAAM,CAAC,CAAC;gBACzC,CAAC,CAAC,uBAAuB,CAAC,KAAK,EAAG,CAA+B,CAAC,SAAS,CAAC,CAAC,2DAA2D;gBACxI,CAAC,CAAC,UAAU,CAAC,KAAK,EAAG,CAA+B,CAAC,IAAI,CAAC,CAAC,CAAC,2DAA2D;YACzH,uBACE,IAAI,IACD,iBAAiB,EACpB;QACJ,CAAC,CAAC,CAAC;QACH,OAAO;YACL,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAC9E,CAAC;KACH;SAAM;QACL,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9D;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/defined.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/defined.d.ts deleted file mode 100644 index 892557e..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/defined.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Value } from '../../../channeldef'; -import { VgEncodeEntry } from '../../../vega.schema'; -import { UnitModel } from '../../unit'; -export declare function defined(model: UnitModel): VgEncodeEntry; -export declare function valueIfDefined(prop: string, value: Value): VgEncodeEntry; -//# sourceMappingURL=defined.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/defined.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/defined.d.ts.map deleted file mode 100644 index 26eae51..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/defined.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"defined.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/defined.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAG1C,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,aAAa,CAYvD;AA4BD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,aAAa,CAKxE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/defined.js b/node_modules/vega-lite/build/src/compile/mark/encode/defined.js deleted file mode 100644 index 6046b35..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/defined.js +++ /dev/null @@ -1,43 +0,0 @@ -import { POSITION_SCALE_CHANNELS } from '../../../channel'; -import { hasContinuousDomain } from '../../../scale'; -import { keys } from '../../../util'; -import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; -import { fieldInvalidPredicate } from './valueref'; -export function defined(model) { - const { config, markDef } = model; - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid) { - const signal = allFieldsInvalidPredicate(model, { channels: POSITION_SCALE_CHANNELS }); - if (signal) { - return { defined: { signal } }; - } - } - return {}; -} -function allFieldsInvalidPredicate(model, { invalid = false, channels }) { - const filterIndex = channels.reduce((aggregator, channel) => { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const field = model.vgField(channel, { expr: 'datum' }); - // While discrete domain scales can handle invalid values, continuous scales can't. - if (field && hasContinuousDomain(scaleType)) { - aggregator[field] = true; - } - } - return aggregator; - }, {}); - const fields = keys(filterIndex); - if (fields.length > 0) { - const op = invalid ? '||' : '&&'; - return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); - } - return undefined; -} -export function valueIfDefined(prop, value) { - if (value !== undefined) { - return { [prop]: signalOrValueRef(value) }; - } - return undefined; -} -//# sourceMappingURL=defined.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/defined.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/defined.js.map deleted file mode 100644 index 2fdd873..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/defined.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"defined.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/defined.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAO,IAAI,EAAC,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAC,qBAAqB,EAAC,MAAM,YAAY,CAAC;AAEjD,MAAM,UAAU,OAAO,CAAC,KAAgB;IACtC,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,KAAK,CAAC;IAEhC,MAAM,OAAO,GAAG,mBAAmB,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAChE,IAAI,OAAO,EAAE;QACX,MAAM,MAAM,GAAG,yBAAyB,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,uBAAuB,EAAC,CAAC,CAAC;QAErF,IAAI,MAAM,EAAE;YACV,OAAO,EAAC,OAAO,EAAE,EAAC,MAAM,EAAC,EAAC,CAAC;SAC5B;KACF;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,yBAAyB,CAChC,KAAgB,EAChB,EAAC,OAAO,GAAG,KAAK,EAAE,QAAQ,EAAgD;IAE1E,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,UAAsB,EAAE,OAAO,EAAE,EAAE;QACtE,MAAM,cAAc,GAAG,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,cAAc,EAAE;YAClB,MAAM,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;YAEtD,mFAAmF;YACnF,IAAI,KAAK,IAAI,mBAAmB,CAAC,SAAS,CAAC,EAAE;gBAC3C,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;aAC1B;SACF;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACrB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACjC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KACnF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAY;IACvD,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,OAAO,EAAC,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAC,CAAC;KAC1C;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/index.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/index.d.ts deleted file mode 100644 index 2080755..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export { baseEncodeEntry } from './base'; -export { color } from './color'; -export { wrapCondition } from './conditional'; -export { defined, valueIfDefined } from './defined'; -export { nonPosition } from './nonposition'; -export { pointPosition } from './position-point'; -export { pointOrRangePosition, rangePosition } from './position-range'; -export { rectBinPosition, rectPosition } from './position-rect'; -export { text } from './text'; -export { tooltip, tooltipRefForEncoding } from './tooltip'; -export { aria } from './aria'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/index.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/index.d.ts.map deleted file mode 100644 index edd8d3b..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,oBAAoB,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAC,eAAe,EAAE,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAE,qBAAqB,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/index.js b/node_modules/vega-lite/build/src/compile/mark/encode/index.js deleted file mode 100644 index 8881bfc..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/index.js +++ /dev/null @@ -1,12 +0,0 @@ -export { baseEncodeEntry } from './base'; -export { color } from './color'; -export { wrapCondition } from './conditional'; -export { defined, valueIfDefined } from './defined'; -export { nonPosition } from './nonposition'; -export { pointPosition } from './position-point'; -export { pointOrRangePosition, rangePosition } from './position-range'; -export { rectBinPosition, rectPosition } from './position-rect'; -export { text } from './text'; -export { tooltip, tooltipRefForEncoding } from './tooltip'; -export { aria } from './aria'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/index.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/index.js.map deleted file mode 100644 index 6411883..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,oBAAoB,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAC,eAAe,EAAE,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAE,qBAAqB,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.d.ts deleted file mode 100644 index 61dd871..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { SignalRef } from 'vega'; -import { NonPositionScaleChannel } from '../../../channel'; -import { Value } from '../../../channeldef'; -import { VgEncodeChannel, VgEncodeEntry, VgValueRef } from '../../../vega.schema'; -import { UnitModel } from '../../unit'; -/** - * Return encode for non-positional channels with scales. (Text doesn't have scale.) - */ -export declare function nonPosition(channel: NonPositionScaleChannel, model: UnitModel, opt?: { - defaultValue?: Value | SignalRef; - vgChannel?: VgEncodeChannel; - defaultRef?: VgValueRef; -}): VgEncodeEntry; -//# sourceMappingURL=nonposition.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.d.ts.map deleted file mode 100644 index d1f4cd9..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"nonposition.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/nonposition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAC,eAAe,EAAE,aAAa,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAIrC;;GAEG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,SAAS,EAChB,GAAG,GAAE;IACH,YAAY,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IACjC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,UAAU,CAAC;CACpB,GACL,aAAa,CA4Bf"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.js b/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.js deleted file mode 100644 index 45fef3b..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.js +++ /dev/null @@ -1,32 +0,0 @@ -import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; -import { wrapCondition } from './conditional'; -import * as ref from './valueref'; -/** - * Return encode for non-positional channels with scales. (Text doesn't have scale.) - */ -export function nonPosition(channel, model, opt = {}) { - const { markDef, encoding, config } = model; - const { vgChannel } = opt; - let { defaultRef, defaultValue } = opt; - if (defaultRef === undefined) { - // prettier-ignore - defaultValue = defaultValue !== null && defaultValue !== void 0 ? defaultValue : getMarkPropOrConfig(channel, markDef, config, { vgChannel, ignoreVgConfig: true }); - if (defaultValue !== undefined) { - defaultRef = signalOrValueRef(defaultValue); - } - } - const channelDef = encoding[channel]; - return wrapCondition(model, channelDef, vgChannel !== null && vgChannel !== void 0 ? vgChannel : channel, cDef => { - return ref.midPoint({ - channel, - channelDef: cDef, - markDef, - config, - scaleName: model.scaleName(channel), - scale: model.getScaleComponent(channel), - stack: null, - defaultRef - }); - }); -} -//# sourceMappingURL=nonposition.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.js.map deleted file mode 100644 index 9104114..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/nonposition.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"nonposition.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/nonposition.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,OAAgC,EAChC,KAAgB,EAChB,MAII,EAAE;IAEN,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAC1C,MAAM,EAAC,SAAS,EAAC,GAAG,GAAG,CAAC;IACxB,IAAI,EAAC,UAAU,EAAE,YAAY,EAAC,GAAG,GAAG,CAAC;IAErC,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,kBAAkB;QAClB,YAAY,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAC,SAAS,EAAE,cAAc,EAAE,IAAI,EAAC,CAAC,CAAC;QAEhH,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,UAAU,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;SAC7C;KACF;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAErC,OAAO,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,OAAO,EAAE,IAAI,CAAC,EAAE;QACnE,OAAO,GAAG,CAAC,QAAQ,CAAC;YAClB,OAAO;YACP,UAAU,EAAE,IAAI;YAChB,OAAO;YACP,MAAM;YACN,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;YACnC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC;YACvC,KAAK,EAAE,IAAI;YACX,UAAU;SACX,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/offset.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/offset.d.ts deleted file mode 100644 index e23bddd..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/offset.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Utility files for producing Vega ValueRef for marks - */ -import { SignalRef } from 'vega-typings/types'; -import { PolarPositionChannel, PositionChannel } from '../../../channel'; -import { MarkDef } from '../../../mark'; -export declare function getOffset(channel: PositionChannel | PolarPositionChannel, markDef: MarkDef): number | SignalRef; -//# sourceMappingURL=offset.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/offset.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/offset.d.ts.map deleted file mode 100644 index 8425c25..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/offset.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"offset.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/offset.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAmB,oBAAoB,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAEtC,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,oBAAoB,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAU/G"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/offset.js b/node_modules/vega-lite/build/src/compile/mark/encode/offset.js deleted file mode 100644 index 85d8ff4..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/offset.js +++ /dev/null @@ -1,11 +0,0 @@ -import { getOffsetChannel } from '../../../channel'; -export function getOffset(channel, markDef) { - const offsetChannel = getOffsetChannel(channel); - // TODO: in the future read from encoding channel too - const markDefOffsetValue = markDef[offsetChannel]; - if (markDefOffsetValue) { - return markDefOffsetValue; - } - return undefined; -} -//# sourceMappingURL=offset.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/offset.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/offset.js.map deleted file mode 100644 index 991aa1d..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/offset.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"offset.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/offset.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,gBAAgB,EAAwC,MAAM,kBAAkB,CAAC;AAGzF,MAAM,UAAU,SAAS,CAAC,OAA+C,EAAE,OAAgB;IACzF,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEhD,qDAAqD;IACrD,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAClD,IAAI,kBAAkB,EAAE;QACtB,OAAO,kBAAkB,CAAC;KAC3B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-align.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/position-align.d.ts deleted file mode 100644 index 00ff429..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-align.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { Config } from '../../../config'; -import { MarkDef } from '../../../mark'; -export declare function vgAlignedPositionChannel(channel: 'x' | 'y' | 'radius' | 'theta', markDef: MarkDef, config: Config, defaultAlign?: 'top' | 'middle'): any; -//# sourceMappingURL=position-align.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-align.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/position-align.d.ts.map deleted file mode 100644 index 6898dff..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-align.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"position-align.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-align.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAgBtC,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,OAAO,EACvC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,GAAE,KAAK,GAAG,QAAmB,OAY1C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-align.js b/node_modules/vega-lite/build/src/compile/mark/encode/position-align.js deleted file mode 100644 index 68ce83b..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-align.js +++ /dev/null @@ -1,26 +0,0 @@ -import { getVgPositionChannel } from '../../../channel'; -import { getMarkPropOrConfig } from '../../common'; -const ALIGNED_X_CHANNEL = { - left: 'x', - center: 'xc', - right: 'x2' -}; -const BASELINED_Y_CHANNEL = { - top: 'y', - middle: 'yc', - bottom: 'y2' -}; -export function vgAlignedPositionChannel(channel, markDef, config, defaultAlign = 'middle') { - if (channel === 'radius' || channel === 'theta') { - return getVgPositionChannel(channel); - } - const alignChannel = channel === 'x' ? 'align' : 'baseline'; - const align = getMarkPropOrConfig(alignChannel, markDef, config); - if (channel === 'x') { - return ALIGNED_X_CHANNEL[align || (defaultAlign === 'top' ? 'left' : 'center')]; - } - else { - return BASELINED_Y_CHANNEL[align || defaultAlign]; - } -} -//# sourceMappingURL=position-align.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-align.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/position-align.js.map deleted file mode 100644 index 2e51ee1..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-align.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"position-align.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-align.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAItD,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAEjD,MAAM,iBAAiB,GAAmC;IACxD,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,mBAAmB,GAAG;IAC1B,GAAG,EAAE,GAAG;IACR,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,MAAM,UAAU,wBAAwB,CACtC,OAAuC,EACvC,OAAgB,EAChB,MAAc,EACd,eAAiC,QAAQ;IAEzC,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,OAAO,EAAE;QAC/C,OAAO,oBAAoB,CAAC,OAAO,CAAC,CAAC;KACtC;IACD,MAAM,YAAY,GAAG,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IAC5D,MAAM,KAAK,GAAG,mBAAmB,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACjE,IAAI,OAAO,KAAK,GAAG,EAAE;QACnB,OAAO,iBAAiB,CAAC,KAAK,IAAI,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;KACjF;SAAM;QACL,OAAO,mBAAmB,CAAC,KAAK,IAAI,YAAY,CAAC,CAAC;KACnD;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-point.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/position-point.d.ts deleted file mode 100644 index 5da94e1..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-point.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { PolarPositionChannel, PositionChannel } from '../../../channel'; -import { VgValueRef } from '../../../vega.schema'; -import { ScaleComponent } from '../../scale/component'; -import { UnitModel } from '../../unit'; -import * as ref from './valueref'; -/** - * Return encode for point (non-band) position channels. - */ -export declare function pointPosition(channel: 'x' | 'y' | 'theta' | 'radius', model: UnitModel, { defaultPos, vgChannel, isMidPoint }: { - defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null; - vgChannel?: 'x' | 'y' | 'xc' | 'yc'; - isMidPoint?: boolean; -}): { - [x: string]: VgValueRef | VgValueRef[]; -}; -/** - * @return Vega ValueRef for normal x- or y-position without projection - */ -export declare function positionRef(params: ref.MidPointParams & { - channel: 'x' | 'y' | 'radius' | 'theta'; - isMidPoint?: boolean; -}): VgValueRef | VgValueRef[]; -export declare function pointPositionDefaultRef({ model, defaultPos, channel, scaleName, scale }: { - model: UnitModel; - defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null; - channel: PositionChannel | PolarPositionChannel; - scaleName: string; - scale: ScaleComponent; -}): () => VgValueRef; -//# sourceMappingURL=position-point.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-point.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/position-point.d.ts.map deleted file mode 100644 index 6865a4c..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-point.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"position-point.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,oBAAoB,EACpB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EACvC,KAAK,EAAE,SAAS,EAChB,EACE,UAAU,EACV,SAAS,EACT,UAAU,EACX,EAAE;IACD,UAAU,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,IAAI,CAAC;IACrD,SAAS,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;;EAuCF;AAKD;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,GAAG,CAAC,cAAc,GAAG;IAC3B,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,OAAO,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GACA,UAAU,GAAG,UAAU,EAAE,CA6B3B;AAED,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,UAAU,EACV,OAAO,EACP,SAAS,EACT,KAAK,EACN,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,IAAI,CAAC;IACrD,OAAO,EAAE,eAAe,GAAG,oBAAoB,CAAC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,cAAc,CAAC;CACvB,GAAG,MAAM,UAAU,CA0DnB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-point.js b/node_modules/vega-lite/build/src/compile/mark/encode/position-point.js deleted file mode 100644 index ad29248..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-point.js +++ /dev/null @@ -1,135 +0,0 @@ -import { getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel, isXorY } from '../../../channel'; -import { getBand, isFieldDef, isFieldOrDatumDef } from '../../../channeldef'; -import { ScaleType } from '../../../scale'; -import { contains } from '../../../util'; -import { getMarkPropOrConfig } from '../../common'; -import { getOffset } from './offset'; -import * as ref from './valueref'; -/** - * Return encode for point (non-band) position channels. - */ -export function pointPosition(channel, model, { defaultPos, vgChannel, isMidPoint }) { - const { encoding, markDef, config, stack } = model; - const channelDef = encoding[channel]; - const channel2Def = encoding[getSecondaryRangeChannel(channel)]; - const scaleName = model.scaleName(channel); - const scale = model.getScaleComponent(channel); - const offset = getOffset(channel, markDef); - // Get default position or position from mark def - const defaultRef = pointPositionDefaultRef({ - model, - defaultPos, - channel, - scaleName, - scale - }); - const valueRef = !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude) - ? // use geopoint output if there are lat/long and there is no point position overriding lat/long. - { field: model.getName(channel) } - : positionRef({ - channel, - channelDef, - channel2Def, - markDef, - config, - isMidPoint, - scaleName, - scale, - stack, - offset, - defaultRef - }); - return valueRef ? { [vgChannel || channel]: valueRef } : undefined; -} -// TODO: we need to find a way to refactor these so that scaleName is a part of scale -// but that's complicated. For now, this is a huge step moving forward. -/** - * @return Vega ValueRef for normal x- or y-position without projection - */ -export function positionRef(params) { - const { channel, channelDef, isMidPoint, scaleName, stack, offset, markDef, config } = params; - // This isn't a part of midPoint because we use midPoint for non-position too - if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) { - if (isFieldDef(channelDef)) { - const band = getBand({ - channel, - fieldDef: channelDef, - isMidPoint, - markDef, - stack, - config - }); - if (band !== undefined) { - return ref.interpolatedSignalRef({ - scaleName, - fieldOrDatumDef: channelDef, - startSuffix: 'start', - band, - offset - }); - } - } - // x or y use stack_end so that stacked line's point mark use stack_end too. - return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'end' }, { offset }); - } - return ref.midPointRefWithPositionInvalidTest(params); -} -export function pointPositionDefaultRef({ model, defaultPos, channel, scaleName, scale }) { - const { markDef, config } = model; - return () => { - const mainChannel = getMainRangeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, { vgChannel }); - if (definedValueOrConfig !== undefined) { - return ref.widthHeightValueOrSignalRef(channel, definedValueOrConfig); - } - switch (defaultPos) { - case 'zeroOrMin': - case 'zeroOrMax': - if (scaleName) { - const scaleType = scale.get('type'); - if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) { - // Log scales cannot have zero. - // Zero in time scale is arbitrary, and does not affect ratio. - // (Time is an interval level of measurement, not ratio). - // See https://en.wikipedia.org/wiki/Level_of_measurement for more info. - } - else { - if (scale.domainDefinitelyIncludesZero()) { - return { - scale: scaleName, - value: 0 - }; - } - } - } - if (defaultPos === 'zeroOrMin') { - return mainChannel === 'y' ? { field: { group: 'height' } } : { value: 0 }; - } - else { - // zeroOrMax - switch (mainChannel) { - case 'radius': - // max of radius is min(width, height) / 2 - return { - signal: `min(${model.width.signal},${model.height.signal})/2` - }; - case 'theta': - return { signal: '2*PI' }; - case 'x': - return { field: { group: 'width' } }; - case 'y': - return { value: 0 }; - } - } - break; - case 'mid': { - const sizeRef = model[getSizeChannel(channel)]; - return Object.assign(Object.assign({}, sizeRef), { mult: 0.5 }); - } - } - // defaultPos === null - return undefined; - }; -} -//# sourceMappingURL=position-point.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-point.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/position-point.js.map deleted file mode 100644 index a6cbaec..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-point.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"position-point.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,MAAM,EAGP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAgB,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAuC,EACvC,KAAgB,EAChB,EACE,UAAU,EACV,SAA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AC,CAAC;gBACV,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC/C,uCAAW,OAAO,KAAE,IAAI,EAAE,GAAG,IAAE;aAChC;SACF;QACD,sBAAsB;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-range.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/position-range.d.ts deleted file mode 100644 index 349e214..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-range.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { VgEncodeEntry, VgValueRef } from '../../../vega.schema'; -import { UnitModel } from '../../unit'; -import * as ref from './valueref'; -/** - * Utility for area/rule position, which can be either point or range. (One of the axes should be point and the other should be range.) - */ -export declare function pointOrRangePosition(channel: 'x' | 'y', model: UnitModel, { defaultPos, defaultPos2, range }: { - defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid'; - defaultPos2: 'zeroOrMin' | 'zeroOrMax'; - range: boolean; -}): { - [x: string]: VgValueRef | VgValueRef[]; -}; -export declare function rangePosition(channel: 'x' | 'y' | 'theta' | 'radius', model: UnitModel, { defaultPos, defaultPos2 }: { - defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid'; - defaultPos2: 'zeroOrMin' | 'zeroOrMax'; -}): VgEncodeEntry; -export declare function position2Ref({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef }: ref.MidPointParams & { - channel: 'x2' | 'y2' | 'radius2' | 'theta2'; -}): VgValueRef | VgValueRef[]; -//# sourceMappingURL=position-range.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-range.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/position-range.d.ts.map deleted file mode 100644 index beb84d4..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-range.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"position-range.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-range.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAIrC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,GAAG,GAAG,GAAG,EAClB,KAAK,EAAE,SAAS,EAChB,EACE,UAAU,EACV,WAAW,EACX,KAAK,EACN,EAAE;IACD,UAAU,EAAE,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC;IAC9C,WAAW,EAAE,WAAW,GAAG,WAAW,CAAC;IACvC,KAAK,EAAE,OAAO,CAAC;CAChB;;EAMF;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EACvC,KAAK,EAAE,SAAS,EAChB,EACE,UAAU,EACV,WAAW,EACZ,EAAE;IACD,UAAU,EAAE,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC;IAC9C,WAAW,EAAE,WAAW,GAAG,WAAW,CAAC;CACxC,GACA,aAAa,CAiBf;AAwED,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACX,EAAE,GAAG,CAAC,cAAc,GAAG;IACtB,OAAO,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC;CAC7C,GAAG,UAAU,GAAG,UAAU,EAAE,CAoB5B"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-range.js b/node_modules/vega-lite/build/src/compile/mark/encode/position-range.js deleted file mode 100644 index e9b8ce0..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-range.js +++ /dev/null @@ -1,115 +0,0 @@ -import { getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel } from '../../../channel'; -import { isFieldOrDatumDef } from '../../../channeldef'; -import { getMarkStyleConfig } from '../../common'; -import { getOffset } from './offset'; -import { vgAlignedPositionChannel } from './position-align'; -import { pointPosition, pointPositionDefaultRef } from './position-point'; -import * as ref from './valueref'; -/** - * Utility for area/rule position, which can be either point or range. (One of the axes should be point and the other should be range.) - */ -export function pointOrRangePosition(channel, model, { defaultPos, defaultPos2, range }) { - if (range) { - return rangePosition(channel, model, { defaultPos, defaultPos2 }); - } - return pointPosition(channel, model, { defaultPos }); -} -export function rangePosition(channel, model, { defaultPos, defaultPos2 }) { - const { markDef, config } = model; - const channel2 = getSecondaryRangeChannel(channel); - const sizeChannel = getSizeChannel(channel); - const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2); - const vgChannel = pos2Mixins[sizeChannel] - ? // If there is width/height, we need to position the marks based on the alignment. - vgAlignedPositionChannel(channel, markDef, config) - : // Otherwise, make sure to apply to the right Vg Channel (for arc mark) - getVgPositionChannel(channel); - return Object.assign(Object.assign({}, pointPosition(channel, model, { defaultPos, vgChannel })), pos2Mixins); -} -/** - * Return encode for x2, y2. - * If channel is not specified, return one channel based on orientation. - */ -function pointPosition2OrSize(model, defaultPos, channel) { - const { encoding, mark, markDef, stack, config } = model; - const baseChannel = getMainRangeChannel(channel); - const sizeChannel = getSizeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - const channelDef = encoding[baseChannel]; - const scaleName = model.scaleName(baseChannel); - const scale = model.getScaleComponent(baseChannel); - const offset = channel in encoding || channel in markDef - ? getOffset(channel, model.markDef) - : getOffset(baseChannel, model.markDef); - if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) { - // use geopoint output if there are lat2/long2 and there is no point position2 overriding lat2/long2. - return { [vgChannel]: { field: model.getName(channel) } }; - } - const valueRef = position2Ref({ - channel, - channelDef, - channel2Def: encoding[channel], - markDef, - config, - scaleName, - scale, - stack, - offset, - defaultRef: undefined - }); - if (valueRef !== undefined) { - return { [vgChannel]: valueRef }; - } - // TODO: check width/height encoding here once we add them - // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence: - // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark) - return (position2orSize(channel, markDef) || - position2orSize(channel, { - [channel]: getMarkStyleConfig(channel, markDef, config.style), - [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style) - }) || - position2orSize(channel, config[mark]) || - position2orSize(channel, config.mark) || { - [vgChannel]: pointPositionDefaultRef({ - model, - defaultPos, - channel, - scaleName, - scale - })() - }); -} -export function position2Ref({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef }) { - if (isFieldOrDatumDef(channelDef) && - stack && - // If fieldChannel is X and channel is X2 (or Y and Y2) - channel.charAt(0) === stack.fieldChannel.charAt(0)) { - return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'start' }, { offset }); - } - return ref.midPointRefWithPositionInvalidTest({ - channel, - channelDef: channel2Def, - scaleName, - scale, - stack, - markDef, - config, - offset, - defaultRef - }); -} -function position2orSize(channel, markDef) { - const sizeChannel = getSizeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - if (markDef[vgChannel] !== undefined) { - return { [vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[vgChannel]) }; - } - else if (markDef[channel] !== undefined) { - return { [vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel]) }; - } - else if (markDef[sizeChannel]) { - return { [sizeChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[sizeChannel]) }; - } - return undefined; -} -//# sourceMappingURL=position-range.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-range.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/position-range.js.map deleted file mode 100644 index 09b1293..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-range.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"position-range.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAE,wBAAwB,EAAE,cAAc,EAAE,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AACrH,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAC,wBAAwB,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAE,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAkB,EAClB,KAAgB,EAChB,EACE,UAAU,EACV,WAAW,EACX,KAAK,EAKN;IAED,IAAI,KAAK,EAAE;QACT,OAAO,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,WAAW,EAAC,CAAC,CAAC;KACjE;IACD,OAAO,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,EAAC,UAAU,EAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,OAAuC,EACvC,KAAgB,EAChB,EACE,UAAU,EACV,WAAW,EAIZ;IAED,MAAM,EAAC,OAAO,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAChC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAE5C,MAAM,UAAU,GAAG,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IAEtE,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAA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AC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAClD;QACA,OAAO,GAAG,CAAC,0BAA0B,CAAC,UAAU,EAAE,SAAS,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC,EAAE,EAAC,MAAM,EAAC,CAAC,CAAC;KAC3F;IACD,OAAO,GAAG,CAAC,kCAAkC,CAAC;QAC5C,OAAO;QACP,UAAU,EAAE,WAAW;QACvB,SAAS;QACT,KAAK;QACL,KAAK;QACL,OAAO;QACP,MAAM;QACN,MAAM;QACN,UAAU;KACX,CAAC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,OAA2C,EAAE,OAAmB;IACvF,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE;QACpC,OAAO,EAAC,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,2BAA2B,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,EAAC,CAAC;KACpF;SAAM,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE;QACzC,OAAO,EAAC,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,2BAA2B,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAC,CAAC;KAClF;SAAM,IAAI,OAAO,CAAC,WAAW,CAAC,EAAE;QAC/B,OAAO,EAAC,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,2BAA2B,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,EAAC,CAAC;KACxF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.d.ts deleted file mode 100644 index a603cdf..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { SignalRef } from 'vega'; -import { PolarPositionChannel, PositionChannel } from '../../../channel'; -import { TypedFieldDef } from '../../../channeldef'; -import { Config } from '../../../config'; -import { Encoding } from '../../../encoding'; -import { Mark, MarkDef } from '../../../mark'; -import { VgEncodeEntry, VgValueRef } from '../../../vega.schema'; -import { UnitModel } from '../../unit'; -export declare function rectPosition(model: UnitModel, channel: 'x' | 'y' | 'theta' | 'radius', mark: 'bar' | 'rect' | 'image' | 'arc'): VgEncodeEntry; -export declare function rectBinPosition({ fieldDef, fieldDef2, channel, band, scaleName, markDef, spacing, axisTranslate, reverse, config }: { - fieldDef: TypedFieldDef; - fieldDef2?: Encoding['x2' | 'y2']; - channel: 'x' | 'y' | 'theta' | 'radius'; - band: number; - scaleName: string; - markDef: MarkDef; - spacing?: number; - axisTranslate: number | SignalRef; - reverse: boolean | SignalRef; - config: Config; -}): { - [x: string]: VgValueRef | VgValueRef[]; -} | { - [x: string]: VgValueRef | { - signal: string; - offset: number | { - signal: string; - }; - }; -}; -/** - * Value Ref for binned fields - */ -export declare function rectBinRef({ channel, fieldDef, scaleName, markDef, band, offset, config }: { - channel: PositionChannel | PolarPositionChannel; - fieldDef: TypedFieldDef; - scaleName: string; - markDef: MarkDef; - band: number; - offset?: number | SignalRef; - config?: Config; -}): VgValueRef | VgValueRef[]; -//# sourceMappingURL=position-rect.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.d.ts.map deleted file mode 100644 index b9fe31b..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"position-rect.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC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G;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAI,EACJ,MAAM,EACN,MAAM,EACP,EAAE;IACD,OAAO,EAAE,eAAe,GAAG,oBAAoB,CAAC;IAChD,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,6BAeA"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.js b/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.js deleted file mode 100644 index 479ab1c..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.js +++ /dev/null @@ -1,246 +0,0 @@ -import { isArray, isNumber } from 'vega-util'; -import { isBinned, isBinning, isBinParams } from '../../../bin'; -import { getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel, isPolarPositionChannel, isXorY } from '../../../channel'; -import { getBand, isFieldDef, isFieldOrDatumDef, vgField } from '../../../channeldef'; -import { DEFAULT_STEP, getViewConfigDiscreteStep } from '../../../config'; -import * as log from '../../../log'; -import { hasDiscreteDomain, ScaleType } from '../../../scale'; -import { getFirstDefined } from '../../../util'; -import { isSignalRef, isVgRangeStep } from '../../../vega.schema'; -import { getMarkPropOrConfig, signalOrStringValue } from '../../common'; -import { nonPosition } from './nonposition'; -import { getOffset } from './offset'; -import { vgAlignedPositionChannel } from './position-align'; -import { pointPositionDefaultRef } from './position-point'; -import { rangePosition } from './position-range'; -import * as ref from './valueref'; -export function rectPosition(model, channel, mark) { - var _a, _b, _c, _d; - const { config, encoding, markDef, stack } = model; - const channel2 = getSecondaryRangeChannel(channel); - const sizeChannel = getSizeChannel(channel); - const channelDef = encoding[channel]; - const channelDef2 = encoding[channel2]; - const scale = model.getScaleComponent(channel); - const scaleType = scale ? scale.get('type') : undefined; - const scaleName = model.scaleName(channel); - const orient = markDef.orient; - const hasSizeDef = (_b = (_a = encoding[sizeChannel]) !== null && _a !== void 0 ? _a : encoding.size) !== null && _b !== void 0 ? _b : getMarkPropOrConfig('size', markDef, config, { vgChannel: sizeChannel }); - const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal'); - // x, x2, and width -- we must specify two of these in all conditions - if (isFieldDef(channelDef) && - (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) && - !hasSizeDef && - !hasDiscreteDomain(scaleType)) { - const band = getBand({ channel, fieldDef: channelDef, stack, markDef, config }); - const axis = (_c = model.component.axes[channel]) === null || _c === void 0 ? void 0 : _c[0]; - const axisTranslate = (_d = axis === null || axis === void 0 ? void 0 : axis.get('translate')) !== null && _d !== void 0 ? _d : 0.5; // vega default is 0.5 - return rectBinPosition({ - fieldDef: channelDef, - fieldDef2: channelDef2, - channel, - markDef, - scaleName, - band, - axisTranslate, - spacing: isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) : undefined, - reverse: scale.get('reverse'), - config - }); - } - else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) { - return positionAndSize(mark, channelDef, channel, model); - } - else { - return rangePosition(channel, model, { defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin' }); - } -} -function defaultSizeRef(mark, sizeChannel, scaleName, scale, config, band) { - if (scale) { - const scaleType = scale.get('type'); - if (scaleType === 'point' || scaleType === 'band') { - if (config[mark].discreteBandSize !== undefined) { - return { value: config[mark].discreteBandSize }; - } - if (scaleType === ScaleType.POINT) { - const scaleRange = scale.get('range'); - if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { - return { value: scaleRange.step - 2 }; - } - return { value: DEFAULT_STEP - 2 }; - } - else { - // BAND - return { scale: scaleName, band }; - } - } - else { - // continuous scale - return { value: config[mark].continuousBandSize }; - } - } - // No Scale - const step = getViewConfigDiscreteStep(config.view, sizeChannel); - const value = getFirstDefined( - // No scale is like discrete bar (with one item) - config[mark].discreteBandSize, step - 2); - return value !== undefined ? { value } : undefined; -} -/** - * Output position encoding and its size encoding for continuous, point, and band scales. - */ -function positionAndSize(mark, fieldDef, channel, model) { - var _a; - const { markDef, encoding, config, stack } = model; - const orient = markDef.orient; - const scaleName = model.scaleName(channel); - const scale = model.getScaleComponent(channel); - const vgSizeChannel = getSizeChannel(channel); - const channel2 = getSecondaryRangeChannel(channel); - // use "size" channel for bars, if there is orient and the channel matches the right orientation - const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x'); - const sizeFromMarkOrConfig = getMarkPropOrConfig(useVlSizeChannel ? 'size' : vgSizeChannel, markDef, config, { - vgChannel: vgSizeChannel - }); - // Use size encoding / mark property / config if it exists - let sizeMixins; - if (encoding.size || sizeFromMarkOrConfig !== undefined) { - if (useVlSizeChannel) { - sizeMixins = nonPosition('size', model, { vgChannel: vgSizeChannel, defaultValue: sizeFromMarkOrConfig }); - } - else { - log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type)); - } - } - // Otherwise, apply default value - const band = (_a = (isFieldOrDatumDef(fieldDef) ? getBand({ channel, fieldDef, markDef, stack, config }) : undefined)) !== null && _a !== void 0 ? _a : 1; - sizeMixins = sizeMixins || { [vgSizeChannel]: defaultSizeRef(mark, vgSizeChannel, scaleName, scale, config, band) }; - /* - Band scales with size value and all point scales, use xc/yc + band=0.5 - - Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2. - In this case, size_band is the band specified in the x/y-encoding. - By default band is 1, so `(1 - band) / 2` = 0. - If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2 - */ - const center = (scale === null || scale === void 0 ? void 0 : scale.get('type')) !== 'band' || !('band' in sizeMixins[vgSizeChannel]); - const vgChannel = vgAlignedPositionChannel(channel, markDef, config, center ? 'middle' : 'top'); - const offset = getOffset(channel, markDef); - const posRef = ref.midPointRefWithPositionInvalidTest({ - channel, - channelDef: fieldDef, - markDef, - config, - scaleName, - scale, - stack, - offset, - defaultRef: pointPositionDefaultRef({ model, defaultPos: 'mid', channel, scaleName, scale }), - band: center ? 0.5 : (1 - band) / 2 - }); - if (vgSizeChannel) { - return Object.assign({ [vgChannel]: posRef }, sizeMixins); - } - else { - // otherwise, we must simulate size by setting position2 = position + size - // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth) - const vgChannel2 = getVgPositionChannel(channel2); - const sizeRef = sizeMixins[vgSizeChannel]; - const sizeOffset = offset ? Object.assign(Object.assign({}, sizeRef), { offset }) : sizeRef; - return { - [vgChannel]: posRef, - // posRef might be an array that wraps position invalid test - [vgChannel2]: isArray(posRef) - ? [posRef[0], Object.assign(Object.assign({}, posRef[1]), { offset: sizeOffset })] - : Object.assign(Object.assign({}, posRef), { offset: sizeOffset }) - }; - } -} -function getBinSpacing(channel, spacing, reverse, translate, offset) { - if (isPolarPositionChannel(channel)) { - return 0; - } - const spacingOffset = channel === 'x' || channel === 'y2' ? -spacing / 2 : spacing / 2; - if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(translate)) { - const reverseExpr = signalOrStringValue(reverse); - const offsetExpr = signalOrStringValue(offset); - const translateExpr = signalOrStringValue(translate); - const t = translateExpr ? `${translateExpr} + ` : ''; - const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : ''; - const o = offsetExpr ? `(${offsetExpr} + ${spacingOffset})` : spacingOffset; - return { - signal: t + r + o - }; - } - else { - offset = offset || 0; - return translate + (reverse ? -offset - spacingOffset : +offset + spacingOffset); - } -} -export function rectBinPosition({ fieldDef, fieldDef2, channel, band, scaleName, markDef, spacing = 0, axisTranslate, reverse, config }) { - const channel2 = getSecondaryRangeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - const vgChannel2 = getVgPositionChannel(channel2); - const offset = getOffset(channel, markDef); - if (isBinning(fieldDef.bin) || fieldDef.timeUnit) { - return { - [vgChannel2]: rectBinRef({ - channel, - fieldDef, - scaleName, - markDef, - band: (1 - band) / 2, - offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset), - config - }), - [vgChannel]: rectBinRef({ - channel, - fieldDef, - scaleName, - markDef, - band: 1 - (1 - band) / 2, - offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset), - config - }) - }; - } - else if (isBinned(fieldDef.bin)) { - const startRef = ref.valueRefForFieldOrDatumDef(fieldDef, scaleName, {}, { offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset) }); - if (isFieldDef(fieldDef2)) { - return { - [vgChannel2]: startRef, - [vgChannel]: ref.valueRefForFieldOrDatumDef(fieldDef2, scaleName, {}, { offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset) }) - }; - } - else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) { - return { - [vgChannel2]: startRef, - [vgChannel]: { - signal: `scale("${scaleName}", ${vgField(fieldDef, { expr: 'datum' })} + ${fieldDef.bin.step})`, - offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset) - } - }; - } - } - log.warn(log.message.channelRequiredForBinned(channel2)); - return undefined; -} -/** - * Value Ref for binned fields - */ -export function rectBinRef({ channel, fieldDef, scaleName, markDef, band, offset, config }) { - const r = ref.interpolatedSignalRef({ - scaleName, - fieldOrDatumDef: fieldDef, - band, - offset - }); - return ref.wrapPositionInvalidTest({ - fieldDef, - channel, - markDef, - ref: r, - config - }); -} -//# sourceMappingURL=position-rect.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.js.map deleted file mode 100644 index a1c68b9..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/position-rect.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"position-rect.js","sourceRoot":"","sources":["../../../../../src/compile/m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AAM,CAAC,GAAG,GAAG,CAAC,qBAAqB,CAAC;QAClC,SAAS;QACT,eAAe,EAAE,QAAQ;QACzB,IAAI;QACJ,MAAM;KACP,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,uBAAuB,CAAC;QACjC,QAAQ;QACR,OAAO;QACP,OAAO;QACP,GAAG,EAAE,CAAC;QACN,MAAM;KACP,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/text.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/text.d.ts deleted file mode 100644 index fb6a759..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/text.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Config } from '../../../config'; -import { Encoding } from '../../../encoding'; -import { VgValueRef } from '../../../vega.schema'; -import { UnitModel } from '../../unit'; -export declare function text(model: UnitModel, channel?: 'text' | 'href' | 'url' | 'description'): Partial>; -export declare function textRef(channelDef: Encoding['text' | 'tooltip'], config: Config, expr?: 'datum' | 'datum.datum'): VgValueRef; -//# sourceMappingURL=text.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/text.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/text.d.ts.map deleted file mode 100644 index 00ab876..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/text.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,aAAsB;;OAG/F;AAED,wBAAgB,OAAO,CACrB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAChD,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,OAAO,GAAG,aAAuB,GACtC,UAAU,CAYZ"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/text.js b/node_modules/vega-lite/build/src/compile/mark/encode/text.js deleted file mode 100644 index 0e8a425..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/text.js +++ /dev/null @@ -1,22 +0,0 @@ -import { getFormatMixins, isFieldOrDatumDef, isValueDef } from '../../../channeldef'; -import { signalOrValueRef } from '../../common'; -import { formatSignalRef } from '../../format'; -import { wrapCondition } from './conditional'; -export function text(model, channel = 'text') { - const channelDef = model.encoding[channel]; - return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config)); -} -export function textRef(channelDef, config, expr = 'datum') { - // text - if (channelDef) { - if (isValueDef(channelDef)) { - return signalOrValueRef(channelDef.value); - } - if (isFieldOrDatumDef(channelDef)) { - const { format, formatType } = getFormatMixins(channelDef); - return formatSignalRef({ fieldOrDatumDef: channelDef, format, formatType, expr, config }); - } - } - return undefined; -} -//# sourceMappingURL=text.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/text.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/text.js.map deleted file mode 100644 index 5c10655..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/text.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAInF,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAE5C,MAAM,UAAU,IAAI,CAAC,KAAgB,EAAE,UAAmD,MAAM;IAC9F,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,OAAO,CACrB,UAAgD,EAChD,MAAc,EACd,OAAgC,OAAO;IAEvC,OAAO;IACP,IAAI,UAAU,EAAE;QACd,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;YAC1B,OAAO,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SAC3C;QACD,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE;YACjC,MAAM,EAAC,MAAM,EAAE,UAAU,EAAC,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;YACzD,OAAO,eAAe,CAAC,EAAC,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAC;SACzF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.d.ts deleted file mode 100644 index 4358294..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Config } from '../../../config'; -import { Encoding } from '../../../encoding'; -import { StackProperties } from '../../../stack'; -import { UnitModel } from '../../unit'; -export declare function tooltip(model: UnitModel, opt?: { - reactiveGeom?: boolean; -}): Partial> | { - tooltip: { - signal: string; - }; -}; -export declare function tooltipData(encoding: Encoding, stack: StackProperties, config: Config, { reactiveGeom }?: { - reactiveGeom?: boolean; -}): {}; -export declare function tooltipRefForEncoding(encoding: Encoding, stack: StackProperties, config: Config, { reactiveGeom }?: { - reactiveGeom?: boolean; -}): { - signal: string; -}; -//# sourceMappingURL=tooltip.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.d.ts.map deleted file mode 100644 index 58a90aa..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/tooltip.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAU,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAK/C,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAIrC,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,GAAE;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAM;;;;;;EAyC3E;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC1B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,MAAM,EACd,EAAC,YAAY,EAAC,GAAE;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAM,MA2D9C;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC1B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,MAAM,EACd,EAAC,YAAY,EAAC,GAAE;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAM;;EAM9C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.js b/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.js deleted file mode 100644 index 7622827..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.js +++ /dev/null @@ -1,106 +0,0 @@ -import { array, isArray, isObject, isString } from 'vega-util'; -import { isBinned } from '../../../bin'; -import { getMainRangeChannel, isXorY } from '../../../channel'; -import { defaultTitle, getFieldDef, getFormatMixins, hasConditionalFieldDef, isFieldDef, isTypedFieldDef, vgField } from '../../../channeldef'; -import { forEach } from '../../../encoding'; -import { entries } from '../../../util'; -import { isSignalRef } from '../../../vega.schema'; -import { getMarkPropOrConfig } from '../../common'; -import { binFormatExpression, formatSignalRef } from '../../format'; -import { wrapCondition } from './conditional'; -import { textRef } from './text'; -export function tooltip(model, opt = {}) { - const { encoding, markDef, config, stack } = model; - const channelDef = encoding.tooltip; - if (isArray(channelDef)) { - return { tooltip: tooltipRefForEncoding({ tooltip: channelDef }, stack, config, opt) }; - } - else { - const datum = opt.reactiveGeom ? 'datum.datum' : 'datum'; - return wrapCondition(model, channelDef, 'tooltip', cDef => { - // use valueRef based on channelDef first - const tooltipRefFromChannelDef = textRef(cDef, config, datum); - if (tooltipRefFromChannelDef) { - return tooltipRefFromChannelDef; - } - if (cDef === null) { - // Allow using encoding.tooltip = null to disable tooltip - return undefined; - } - let markTooltip = getMarkPropOrConfig('tooltip', markDef, config); - if (markTooltip === true) { - markTooltip = { content: 'encoding' }; - } - if (isString(markTooltip)) { - return { value: markTooltip }; - } - else if (isObject(markTooltip)) { - // `tooltip` is `{fields: 'encodings' | 'fields'}` - if (isSignalRef(markTooltip)) { - return markTooltip; - } - else if (markTooltip.content === 'encoding') { - return tooltipRefForEncoding(encoding, stack, config, opt); - } - else { - return { signal: datum }; - } - } - return undefined; - }); - } -} -export function tooltipData(encoding, stack, config, { reactiveGeom } = {}) { - const toSkip = {}; - const expr = reactiveGeom ? 'datum.datum' : 'datum'; - const tuples = []; - function add(fDef, channel) { - const mainChannel = getMainRangeChannel(channel); - const fieldDef = isTypedFieldDef(fDef) - ? fDef - : Object.assign(Object.assign({}, fDef), { type: encoding[mainChannel].type // for secondary field def, copy type from main channel - }); - const title = fieldDef.title || defaultTitle(fieldDef, config); - const key = array(title).join(', '); - let value; - if (isXorY(channel)) { - const channel2 = channel === 'x' ? 'x2' : 'y2'; - const fieldDef2 = getFieldDef(encoding[channel2]); - if (isBinned(fieldDef.bin) && fieldDef2) { - const startField = vgField(fieldDef, { expr }); - const endField = vgField(fieldDef2, { expr }); - const { format, formatType } = getFormatMixins(fieldDef); - value = binFormatExpression(startField, endField, format, formatType, config); - toSkip[channel2] = true; - } - else if (stack && stack.fieldChannel === channel && stack.offset === 'normalize') { - const { format, formatType } = getFormatMixins(fieldDef); - value = formatSignalRef({ fieldOrDatumDef: fieldDef, format, formatType, expr, config, normalizeStack: true }) - .signal; - } - } - value = value !== null && value !== void 0 ? value : textRef(fieldDef, config, expr).signal; - tuples.push({ channel, key, value }); - } - forEach(encoding, (channelDef, channel) => { - if (isFieldDef(channelDef)) { - add(channelDef, channel); - } - else if (hasConditionalFieldDef(channelDef)) { - add(channelDef.condition, channel); - } - }); - const out = {}; - for (const { channel, key, value } of tuples) { - if (!toSkip[channel] && !out[key]) { - out[key] = value; - } - } - return out; -} -export function tooltipRefForEncoding(encoding, stack, config, { reactiveGeom } = {}) { - const data = tooltipData(encoding, stack, config, { reactiveGeom }); - const keyValues = entries(data).map(({ key, value }) => `"${key}": ${value}`); - return keyValues.length > 0 ? { signal: `{${keyValues.join(', ')}}` } : undefined; -} -//# sourceMappingURL=tooltip.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.js.map deleted file mode 100644 index 4258b63..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/tooltip.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/tooltip.ts"],"names":[],"mappings":"AAAA,O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AAC;IAElE,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,KAAK,EAAE,CAAC,CAAC;IAC5E,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAClF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/valueref.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/valueref.d.ts deleted file mode 100644 index 3b93af8..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/valueref.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Utility files for producing Vega ValueRef for marks - */ -import { SignalRef } from 'vega'; -import { Channel, PolarPositionChannel, PositionChannel } from '../../../channel'; -import { ChannelDef, DatumDef, FieldDef, FieldDefBase, FieldName, FieldRefOption, SecondaryChannelDef, SecondaryFieldDef, TypedFieldDef, Value } from '../../../channeldef'; -import { Config } from '../../../config'; -import { Mark, MarkDef } from '../../../mark'; -import { StackProperties } from '../../../stack'; -import { VgValueRef } from '../../../vega.schema'; -import { ScaleComponent } from '../../scale/component'; -export declare function midPointRefWithPositionInvalidTest(params: MidPointParams & { - channel: PositionChannel | PolarPositionChannel; -}): VgValueRef | VgValueRef[]; -export declare function wrapPositionInvalidTest({ fieldDef, channel, markDef, ref, config }: { - fieldDef: FieldDef; - channel: PositionChannel | PolarPositionChannel; - markDef: MarkDef; - ref: VgValueRef; - config: Config; -}): VgValueRef | VgValueRef[]; -export declare function fieldInvalidTestValueRef(fieldDef: FieldDef, channel: PositionChannel | PolarPositionChannel): { - field: { - group: string; - }; - value?: undefined; - test: string; -} | { - value: number; - field?: undefined; - test: string; -}; -export declare function fieldInvalidPredicate(field: FieldName | FieldDef, invalid?: boolean): string; -export declare function datumDefToExpr(datumDef: DatumDef): string; -export declare function valueRefForFieldOrDatumDef(fieldDef: FieldDefBase | DatumDef, scaleName: string, opt: FieldRefOption, encode: { - offset?: number | VgValueRef; - band?: number | boolean; -}): VgValueRef; -/** - * Signal that returns the middle of a bin from start and end field. Should only be used with x and y. - */ -export declare function interpolatedSignalRef({ scaleName, fieldOrDatumDef, fieldOrDatumDef2, offset, startSuffix, band }: { - scaleName: string; - fieldOrDatumDef: TypedFieldDef; - fieldOrDatumDef2?: SecondaryFieldDef; - startSuffix?: string; - offset: number | SignalRef; - band: number; -}): VgValueRef; -export interface MidPointParams { - channel: Channel; - channelDef: ChannelDef; - channel2Def?: SecondaryChannelDef; - markDef: MarkDef; - config: Config; - scaleName: string; - scale: ScaleComponent; - stack?: StackProperties; - offset?: number | SignalRef; - defaultRef: VgValueRef | (() => VgValueRef); - /** - * Allow overriding band instead of reading to field def since band is applied to size (width/height) instead of the position for x/y-position with band scales. - */ - band?: number; -} -/** - * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels. - */ -export declare function midPoint({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef, band }: MidPointParams): VgValueRef; -/** - * Convert special "width" and "height" values in Vega-Lite into Vega value ref. - */ -export declare function widthHeightValueOrSignalRef(channel: Channel, value: Value | SignalRef): SignalRef | { - value: string | number | boolean | string[] | import("vega").LinearGradient | import("vega").RadialGradient | number[]; -} | { - field: { - group: string; - }; -}; -//# sourceMappingURL=valueref.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/valueref.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/valueref.d.ts.map deleted file mode 100644 index 475dea8..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/valueref.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"valueref.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/valueref.ts"],"names":[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,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,IAAI,EACL,EAAE,cAAc,GAAG,UAAU,CA2F7B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS;;;;;;EAOrF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/valueref.js b/node_modules/vega-lite/build/src/compile/mark/encode/valueref.js deleted file mode 100644 index 00c3e4f..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/valueref.js +++ /dev/null @@ -1,212 +0,0 @@ -import { isFunction, isString } from 'vega-util'; -import { isCountingAggregateOp } from '../../../aggregate'; -import { isBinned, isBinning } from '../../../bin'; -import { getMainRangeChannel, X, X2, Y2 } from '../../../channel'; -import { binRequiresRange, getBand, isDatumDef, isFieldDef, isFieldOrDatumDef, isTypedFieldDef, isValueDef, vgField } from '../../../channeldef'; -import { dateTimeToExpr, isDateTime } from '../../../datetime'; -import * as log from '../../../log'; -import { isPathMark } from '../../../mark'; -import { fieldValidPredicate } from '../../../predicate'; -import { hasDiscreteDomain, isContinuousToContinuous } from '../../../scale'; -import { TEMPORAL } from '../../../type'; -import { contains } from '../../../util'; -import { isSignalRef } from '../../../vega.schema'; -import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; -export function midPointRefWithPositionInvalidTest(params) { - const { channel, channelDef, markDef, scale, config } = params; - const ref = midPoint(params); - // Wrap to check if the positional value is invalid, if so, plot the point on the min value - if ( - // Only this for field def without counting aggregate (as count wouldn't be null) - isFieldDef(channelDef) && - !isCountingAggregateOp(channelDef.aggregate) && - // and only for continuous scale without zero (otherwise, null / invalid will be interpreted as zero, which doesn't cause layout problem) - scale && - isContinuousToContinuous(scale.get('type')) && - scale.get('zero') === false) { - return wrapPositionInvalidTest({ - fieldDef: channelDef, - channel, - markDef, - ref, - config - }); - } - return ref; -} -export function wrapPositionInvalidTest({ fieldDef, channel, markDef, ref, config }) { - if (isPathMark(markDef.type)) { - // path mark already use defined to skip points, no need to do it here. - return ref; - } - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid === null) { - // if there is no invalid filter, don't do the invalid test - return ref; - } - return [fieldInvalidTestValueRef(fieldDef, channel), ref]; -} -export function fieldInvalidTestValueRef(fieldDef, channel) { - const test = fieldInvalidPredicate(fieldDef, true); - const mainChannel = getMainRangeChannel(channel); // we can cast here as the output can't be other things. - const zeroValueRef = mainChannel === 'y' - ? { field: { group: 'height' } } - : // x / angle / radius can all use 0 - { value: 0 }; - return Object.assign({ test }, zeroValueRef); -} -export function fieldInvalidPredicate(field, invalid = true) { - return fieldValidPredicate(isString(field) ? field : vgField(field, { expr: 'datum' }), !invalid); -} -export function datumDefToExpr(datumDef) { - const { datum } = datumDef; - if (isDateTime(datum)) { - return dateTimeToExpr(datum); - } - return `${JSON.stringify(datum)}`; -} -export function valueRefForFieldOrDatumDef(fieldDef, scaleName, opt, encode) { - const ref = {}; - if (scaleName) { - ref.scale = scaleName; - } - if (isDatumDef(fieldDef)) { - const { datum } = fieldDef; - if (isDateTime(datum)) { - ref.signal = dateTimeToExpr(datum); - } - else if (isSignalRef(datum)) { - ref.signal = datum.signal; - } - else { - ref.value = datum; - } - } - else { - ref.field = vgField(fieldDef, opt); - } - if (encode) { - const { offset, band } = encode; - if (offset) { - ref.offset = offset; - } - if (band) { - ref.band = band; - } - } - return ref; -} -/** - * Signal that returns the middle of a bin from start and end field. Should only be used with x and y. - */ -export function interpolatedSignalRef({ scaleName, fieldOrDatumDef, fieldOrDatumDef2, offset, startSuffix, band = 0.5 }) { - const expr = 0 < band && band < 1 ? 'datum' : undefined; - const start = vgField(fieldOrDatumDef, { expr, suffix: startSuffix }); - const end = fieldOrDatumDef2 !== undefined - ? vgField(fieldOrDatumDef2, { expr }) - : vgField(fieldOrDatumDef, { suffix: 'end', expr }); - const ref = {}; - if (band === 0 || band === 1) { - ref.scale = scaleName; - const val = band === 0 ? start : end; - ref.field = val; - } - else { - const datum = `${band} * ${start} + ${1 - band} * ${end}`; - ref.signal = `scale("${scaleName}", ${datum})`; - } - if (offset) { - ref.offset = offset; - } - return ref; -} -/** - * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels. - */ -export function midPoint({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef, band }) { - var _a; - // TODO: datum support - if (channelDef) { - /* istanbul ignore else */ - if (isFieldOrDatumDef(channelDef)) { - if (isTypedFieldDef(channelDef)) { - band = band !== null && band !== void 0 ? band : getBand({ - channel, - fieldDef: channelDef, - fieldDef2: channel2Def, - markDef, - stack, - config, - isMidPoint: true - }); - const { bin, timeUnit, type } = channelDef; - if (isBinning(bin) || (band && timeUnit && type === TEMPORAL)) { - // Use middle only for x an y to place marks in the center between start and end of the bin range. - // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match. - if (stack && stack.impute) { - // For stack, we computed bin_mid so we can impute. - return valueRefForFieldOrDatumDef(channelDef, scaleName, { binSuffix: 'mid' }, { offset }); - } - if (band) { - // if band = 0, no need to call interpolation - // For non-stack, we can just calculate bin mid on the fly using signal. - return interpolatedSignalRef({ scaleName, fieldOrDatumDef: channelDef, band, offset }); - } - return valueRefForFieldOrDatumDef(channelDef, scaleName, binRequiresRange(channelDef, channel) ? { binSuffix: 'range' } : {}, { - offset - }); - } - else if (isBinned(bin)) { - if (isFieldDef(channel2Def)) { - return interpolatedSignalRef({ - scaleName, - fieldOrDatumDef: channelDef, - fieldOrDatumDef2: channel2Def, - band, - offset - }); - } - else { - const channel2 = channel === X ? X2 : Y2; - log.warn(log.message.channelRequiredForBinned(channel2)); - } - } - } - const scaleType = scale === null || scale === void 0 ? void 0 : scale.get('type'); - return valueRefForFieldOrDatumDef(channelDef, scaleName, hasDiscreteDomain(scaleType) ? { binSuffix: 'range' } : {}, // no need for bin suffix if there is no scale - { - offset, - // For band, to get mid point, need to offset by half of the band - band: scaleType === 'band' ? (_a = band !== null && band !== void 0 ? band : channelDef.band) !== null && _a !== void 0 ? _a : 0.5 : undefined - }); - } - else if (isValueDef(channelDef)) { - const value = channelDef.value; - const offsetMixins = offset ? { offset } : {}; - return Object.assign(Object.assign({}, widthHeightValueOrSignalRef(channel, value)), offsetMixins); - } - // If channelDef is neither field def or value def, it's a condition-only def. - // In such case, we will use default ref. - } - if (isFunction(defaultRef)) { - defaultRef = defaultRef(); - } - if (defaultRef) { - // for non-position, ref could be undefined. - return Object.assign(Object.assign({}, defaultRef), (offset ? { offset } : {})); - } - return defaultRef; -} -/** - * Convert special "width" and "height" values in Vega-Lite into Vega value ref. - */ -export function widthHeightValueOrSignalRef(channel, value) { - if (contains(['x', 'x2'], channel) && value === 'width') { - return { field: { group: 'width' } }; - } - else if (contains(['y', 'y2'], channel) && value === 'height') { - return { field: { group: 'height' } }; - } - return signalOrValueRef(value); -} -//# sourceMappingURL=valueref.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/valueref.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/valueref.js.map deleted file mode 100644 index 68d43a9..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/valueref.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"valueref.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/valueref.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,EAAU,mBAAmB,EAAyC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAC,MAAM,kBAAkB,CAAC;AAChH,OAAO,EACL,gBAAgB,E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CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAgB,EAAE,KAAwB;IACpF,IAAI,QAAQ,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,KAAK,KAAK,OAAO,EAAE;QACvD,OAAO,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC,CAAC;KAClC;SAAM,IAAI,QAAQ,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,KAAK,KAAK,QAAQ,EAAE;QAC/D,OAAO,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,QAAQ,EAAC,EAAC,CAAC;KACnC;IACD,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/zindex.d.ts b/node_modules/vega-lite/build/src/compile/mark/encode/zindex.d.ts deleted file mode 100644 index 21178a4..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/zindex.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { UnitModel } from '../../unit'; -export declare function zindex(model: UnitModel): Partial>; -//# sourceMappingURL=zindex.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/zindex.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/encode/zindex.d.ts.map deleted file mode 100644 index 325632e..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/zindex.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"zindex.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/zindex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS;;OAQtC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/zindex.js b/node_modules/vega-lite/build/src/compile/mark/encode/zindex.js deleted file mode 100644 index 43880b3..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/zindex.js +++ /dev/null @@ -1,12 +0,0 @@ -import { isValueDef } from '../../../channeldef'; -import { isPathMark } from '../../../mark'; -import { wrapCondition } from './conditional'; -export function zindex(model) { - const { encoding, mark } = model; - const order = encoding.order; - if (!isPathMark(mark) && isValueDef(order)) { - return wrapCondition(model, order, 'zindex', cd => cd); - } - return {}; -} -//# sourceMappingURL=zindex.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/encode/zindex.js.map b/node_modules/vega-lite/build/src/compile/mark/encode/zindex.js.map deleted file mode 100644 index b6c3ce4..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/encode/zindex.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"zindex.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/zindex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAE5C,MAAM,UAAU,MAAM,CAAC,KAAgB;IACrC,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,KAAK,CAAC;IAC/B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;IAE7B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE;QAC1C,OAAO,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;KACxD;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/geoshape.d.ts b/node_modules/vega-lite/build/src/compile/mark/geoshape.d.ts deleted file mode 100644 index afc3e23..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/geoshape.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const geoshape: MarkCompiler; -//# sourceMappingURL=geoshape.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/geoshape.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/geoshape.d.ts.map deleted file mode 100644 index 89f169b..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/geoshape.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geoshape.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/geoshape.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,QAAQ,EAAE,YA4BtB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/geoshape.js b/node_modules/vega-lite/build/src/compile/mark/geoshape.js deleted file mode 100644 index 891e3db..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/geoshape.js +++ /dev/null @@ -1,25 +0,0 @@ -import { isFieldDef, vgField } from '../../channeldef'; -import { GEOJSON } from '../../type'; -import * as encode from './encode'; -export const geoshape = { - vgMark: 'shape', - encodeEntry: (model) => { - return Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - })); - }, - postEncodingTransform: (model) => { - const { encoding } = model; - const shapeDef = encoding.shape; - const transform = Object.assign({ type: 'geoshape', projection: model.projectionName() }, (shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON - ? { field: vgField(shapeDef, { expr: 'datum' }) } - : {})); - return [transform]; - } -}; -//# sourceMappingURL=geoshape.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/geoshape.js.map b/node_modules/vega-lite/build/src/compile/mark/geoshape.js.map deleted file mode 100644 index c21d58e..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/geoshape.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geoshape.js","sourceRoot":"","sources":["../../../../src/compile/mark/geoshape.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAInC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,QAAQ,GAAiB;IACpC,MAAM,EAAE,OAAO;IACf,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,yBACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,QAAQ;SAChB,CAAC,EACF;IACJ,CAAC;IACD,qBAAqB,EAAE,CAAC,KAAgB,EAA6B,EAAE;QACrE,MAAM,EAAC,QAAQ,EAAC,GAAG,KAAK,CAAC;QACzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC;QAEhC,MAAM,SAAS,mBACb,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,KAAK,CAAC,cAAc,EAAE,IAE/B,CAAC,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO;YAC/D,CAAC,CAAC,EAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,EAAC;YAC7C,CAAC,CAAC,EAAE,CAAC,CACR,CAAC;QACF,OAAO,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/image.d.ts b/node_modules/vega-lite/build/src/compile/mark/image.d.ts deleted file mode 100644 index 86aeac9..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/image.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const image: MarkCompiler; -//# sourceMappingURL=image.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/image.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/image.d.ts.map deleted file mode 100644 index c053ebd..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/image.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/image.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,KAAK,EAAE,YAiBnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/image.js b/node_modules/vega-lite/build/src/compile/mark/image.js deleted file mode 100644 index 6ee0486..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/image.js +++ /dev/null @@ -1,15 +0,0 @@ -import * as encode from './encode'; -export const image = { - vgMark: 'image', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'ignore', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), encode.rectPosition(model, 'x', 'image')), encode.rectPosition(model, 'y', 'image')), encode.text(model, 'url')); - } -}; -//# sourceMappingURL=image.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/image.js.map b/node_modules/vega-lite/build/src/compile/mark/image.js.map deleted file mode 100644 index d6b9778..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/image.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/compile/mark/image.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,MAAM,EAAE,OAAO;IACf,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,mEACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,GACC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,GACxC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,GACxC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,EAC5B;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/init.d.ts b/node_modules/vega-lite/build/src/compile/mark/init.d.ts deleted file mode 100644 index f331f0b..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/init.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Config } from '../../config'; -import { Encoding } from '../../encoding'; -import { MarkDef } from '../../mark'; -export declare function initMarkdef(markDef: MarkDef, encoding: Encoding, config: Config): MarkDef<"square" | "circle" | "text" | "point" | "arc" | "area" | "image" | "line" | "rect" | "rule" | "trail" | "geoshape" | "bar" | "tick">; -export declare function defaultFilled(markDef: MarkDef, config: Config, { graticule }: { - graticule: boolean; -}): boolean; -//# sourceMappingURL=init.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/init.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/init.d.ts.map deleted file mode 100644 index 7d6b381..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/init.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAc,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAQL,OAAO,EAOR,MAAM,YAAY,CAAC;AAKpB,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,iJAuCvF;AAmBD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAC,SAAS,EAAC,EAAE;IAAC,SAAS,EAAE,OAAO,CAAA;CAAC,WAOhG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/init.js b/node_modules/vega-lite/build/src/compile/mark/init.js deleted file mode 100644 index bf9c2e4..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/init.js +++ /dev/null @@ -1,185 +0,0 @@ -import { isBinned, isBinning } from '../../bin'; -import { isContinuousFieldOrDatumDef, isFieldDef, isNumericDataDef } from '../../channeldef'; -import { isAggregate } from '../../encoding'; -import * as log from '../../log'; -import { AREA, BAR, BAR_CORNER_RADIUS_INDEX as BAR_CORNER_RADIUS_END_INDEX, CIRCLE, IMAGE, LINE, POINT, RECT, RULE, SQUARE, TEXT, TICK } from '../../mark'; -import { QUANTITATIVE, TEMPORAL } from '../../type'; -import { contains, getFirstDefined } from '../../util'; -import { getMarkConfig, getMarkPropOrConfig } from '../common'; -export function initMarkdef(markDef, encoding, config) { - // set orient, which can be overridden by rules as sometimes the specified orient is invalid. - const specifiedOrient = getMarkPropOrConfig('orient', markDef, config); - markDef.orient = orient(markDef.type, encoding, specifiedOrient); - if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) { - log.warn(log.message.orientOverridden(markDef.orient, specifiedOrient)); - } - if (markDef.type === 'bar' && markDef.orient) { - const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config); - if (cornerRadiusEnd !== undefined) { - const newProps = (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2) - ? ['cornerRadius'] - : BAR_CORNER_RADIUS_END_INDEX[markDef.orient]; - for (const newProp of newProps) { - markDef[newProp] = cornerRadiusEnd; - } - if (markDef.cornerRadiusEnd !== undefined) { - delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius - } - } - } - // set opacity and filled if not specified in mark config - const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config); - if (specifiedOpacity === undefined) { - markDef.opacity = opacity(markDef.type, encoding); - } - // set cursor, which should be pointer if href channel is present unless otherwise specified - const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config); - if (specifiedCursor === undefined) { - markDef.cursor = cursor(markDef, encoding, config); - } - return markDef; -} -function cursor(markDef, encoding, config) { - if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) { - return 'pointer'; - } - return markDef.cursor; -} -function opacity(mark, encoding) { - if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) { - // point-based marks - if (!isAggregate(encoding)) { - return 0.7; - } - } - return undefined; -} -export function defaultFilled(markDef, config, { graticule }) { - if (graticule) { - return false; - } - const filledConfig = getMarkConfig('filled', markDef, config); - const mark = markDef.type; - return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE); -} -function orient(mark, encoding, specifiedOrient) { - switch (mark) { - case POINT: - case CIRCLE: - case SQUARE: - case TEXT: - case RECT: - case IMAGE: - // orient is meaningless for these marks. - return undefined; - } - const { x, y, x2, y2 } = encoding; - switch (mark) { - case BAR: - if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) { - return 'vertical'; - } - if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) { - return 'horizontal'; - } - if (y2 || x2) { - // Ranged bar does not always have clear orientation, so we allow overriding - if (specifiedOrient) { - return specifiedOrient; - } - // If y is range and x is non-range, non-bin Q, y is likely a prebinned field - if (!x2) { - if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) { - return 'horizontal'; - } - } - // If x is range and y is non-range, non-bin Q, x is likely a prebinned field - if (!y2) { - if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) { - return 'vertical'; - } - } - } - // falls through - case RULE: - // return undefined for line segment rule and bar with both axis ranged - // we have to ignore the case that the data are already binned - if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) { - return undefined; - } - // falls through - case AREA: - // If there are range for both x and y, y (vertical) has higher precedence. - if (y2) { - if (isFieldDef(y) && isBinned(y.bin)) { - return 'horizontal'; - } - else { - return 'vertical'; - } - } - else if (x2) { - if (isFieldDef(x) && isBinned(x.bin)) { - return 'vertical'; - } - else { - return 'horizontal'; - } - } - else if (mark === RULE) { - if (x && !y) { - return 'vertical'; - } - else if (y && !x) { - return 'horizontal'; - } - } - // falls through - case LINE: - case TICK: { - // Tick is opposite to bar, line, area and never have ranged mark. - const xIsContinuous = isContinuousFieldOrDatumDef(x); - const yIsContinuous = isContinuousFieldOrDatumDef(y); - if (xIsContinuous && !yIsContinuous) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - else if (!xIsContinuous && yIsContinuous) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } - else if (xIsContinuous && yIsContinuous) { - const xDef = x; // we can cast here since they are surely fieldDef - const yDef = y; - const xIsTemporal = xDef.type === TEMPORAL; - const yIsTemporal = yDef.type === TEMPORAL; - // temporal without timeUnit is considered continuous, but better serves as dimension - if (xIsTemporal && !yIsTemporal) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } - else if (!xIsTemporal && yIsTemporal) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - if (!xDef.aggregate && yDef.aggregate) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } - else if (xDef.aggregate && !yDef.aggregate) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - if (specifiedOrient) { - // When ambiguous, use user specified one. - return specifiedOrient; - } - return 'vertical'; - } - else { - // Discrete x Discrete case - if (specifiedOrient) { - // When ambiguous, use user specified one. - return specifiedOrient; - } - return undefined; - } - } - } - return 'vertical'; -} -//# sourceMappingURL=init.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/init.js.map b/node_modules/vega-lite/build/src/compile/mark/init.js.map deleted file mode 100644 index e7bf606..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/init.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/compile/mark/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,2BAA2B,EAAE,UAAU,EAAE,gBAAgB,EAAgB,MAAM,kBAAkB,CAAC;AAE1G,OAAO,EAAW,WAAW,EAAC,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,IAAI,EACJ,GAAG,EACH,uBAAuB,IAAI,2BAA2B,EACtD,MAAM,EACN,KAAK,EACL,IAAI,EAGJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,aAAa,EAAE,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAE7D,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,QAA0B,EAAE,MAAc;IACtF,6FAA6F;IAC7F,MAAM,eAAe,GAAG,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,OAAO,CAAC,MAAM,GAAG,MAAM,CAA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AA2B;gBAC3B,IAAI,eAAe,EAAE;oBACnB,0CAA0C;oBAC1C,OAAO,eAAe,CAAC;iBACxB;gBAED,OAAO,SAAS,CAAC;aAClB;SACF;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/line.d.ts b/node_modules/vega-lite/build/src/compile/mark/line.d.ts deleted file mode 100644 index 256ed0d..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/line.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const line: MarkCompiler; -export declare const trail: MarkCompiler; -//# sourceMappingURL=line.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/line.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/line.d.ts.map deleted file mode 100644 index b470ba6..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/line.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/line.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YAoBlB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,YAkBnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/line.js b/node_modules/vega-lite/build/src/compile/mark/line.js deleted file mode 100644 index e4ce9e9..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/line.js +++ /dev/null @@ -1,30 +0,0 @@ -import * as encode from './encode'; -export const line = { - vgMark: 'line', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - })), encode.pointPosition('x', model, { defaultPos: 'mid' })), encode.pointPosition('y', model, { defaultPos: 'mid' })), encode.nonPosition('size', model, { - vgChannel: 'strokeWidth' // VL's line size is strokeWidth - })), encode.defined(model)); - } -}; -export const trail = { - vgMark: 'trail', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'include', - orient: 'ignore', - theta: 'ignore' - })), encode.pointPosition('x', model, { defaultPos: 'mid' })), encode.pointPosition('y', model, { defaultPos: 'mid' })), encode.nonPosition('size', model)), encode.defined(model)); - } -}; -//# sourceMappingURL=line.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/line.js.map b/node_modules/vega-lite/build/src/compile/mark/line.js.map deleted file mode 100644 index a1b32b1..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/line.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../../src/compile/mark/line.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,iFACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,QAAQ;SAChB,CAAC,GACC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC,GACrD,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC,GACrD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE;YACnC,SAAS,EAAE,aAAa,CAAC,gCAAgC;SAC1D,CAAC,GACC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EACxB;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,MAAM,EAAE,OAAO;IACf,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,iFACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,QAAQ;SAChB,CAAC,GACC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC,GACrD,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC,GACrD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,GACjC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EACxB;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/mark.d.ts b/node_modules/vega-lite/build/src/compile/mark/mark.d.ts deleted file mode 100644 index 11401c5..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/mark.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { VgCompare } from '../../vega.schema'; -import { UnitModel } from '../unit'; -export declare function parseMarkGroups(model: UnitModel): any[]; -export declare function getSort(model: UnitModel): VgCompare; -//# sourceMappingURL=mark.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/mark.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/mark.d.ts.map deleted file mode 100644 index 4df73ba..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/mark.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/mark.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAA0C,MAAM,mBAAmB,CAAC;AAErF,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AA+BlC,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,EAAE,CAiBvD;AAwLD,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAuDnD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/mark.js b/node_modules/vega-lite/build/src/compile/mark/mark.js deleted file mode 100644 index 5067b1d..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/mark.js +++ /dev/null @@ -1,318 +0,0 @@ -import { isArray } from 'vega-util'; -import { isFieldDef, isValueDef, vgField } from '../../channeldef'; -import { DataSourceType } from '../../data'; -import { isAggregate, pathGroupingFields } from '../../encoding'; -import { AREA, BAR, isPathMark, LINE, TRAIL } from '../../mark'; -import { isSortByEncoding, isSortField } from '../../sort'; -import { contains, getFirstDefined, isNullOrFalse, keys, omit, pick } from '../../util'; -import { VG_CORNERRADIUS_CHANNELS } from '../../vega.schema'; -import { getMarkConfig, getMarkPropOrConfig, getStyles, signalOrValueRef, sortParams } from '../common'; -import { arc } from './arc'; -import { area } from './area'; -import { bar } from './bar'; -import { geoshape } from './geoshape'; -import { image } from './image'; -import { line, trail } from './line'; -import { circle, point, square } from './point'; -import { rect } from './rect'; -import { rule } from './rule'; -import { text } from './text'; -import { tick } from './tick'; -const markCompiler = { - arc, - area, - bar, - circle, - geoshape, - image, - line, - point, - rect, - rule, - square, - text, - tick, - trail -}; -export function parseMarkGroups(model) { - if (contains([LINE, AREA, TRAIL], model.mark)) { - const details = pathGroupingFields(model.mark, model.encoding); - if (details.length > 0) { - return getPathGroups(model, details); - } - // otherwise use standard mark groups - } - else if (contains([BAR], model.mark)) { - const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop => getMarkPropOrConfig(prop, model.markDef, model.config)); - if (model.stack && !model.fieldDef('size') && hasCornerRadius) { - return getGroupsForStackedBarWithCornerRadius(model); - } - } - return getMarkGroup(model); -} -const FACETED_PATH_PREFIX = 'faceted_path_'; -function getPathGroups(model, details) { - // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?) - return [ - { - name: model.getName('pathgroup'), - type: 'group', - from: { - facet: { - name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main), - data: model.requestDataName(DataSourceType.Main), - groupby: details - } - }, - encode: { - update: { - width: { field: { group: 'width' } }, - height: { field: { group: 'height' } } - } - }, - // With subfacet for line/area group, need to use faceted data from above. - marks: getMarkGroup(model, { fromPrefix: FACETED_PATH_PREFIX }) - } - ]; -} -const STACK_GROUP_PREFIX = 'stack_group_'; -/** - * We need to put stacked bars into groups in order to enable cornerRadius for stacks. - * If stack is used and the model doesn't have size encoding, we put the mark into groups, - * and apply cornerRadius properties at the group. - */ -function getGroupsForStackedBarWithCornerRadius(model) { - // Generate the mark - const [mark] = getMarkGroup(model, { fromPrefix: STACK_GROUP_PREFIX }); - // Get the scale for the stacked field - const fieldScale = model.scaleName(model.stack.fieldChannel); - const stackField = (opt = {}) => model.vgField(model.stack.fieldChannel, opt); - // Find the min/max of the pixel value on the stacked direction - const stackFieldGroup = (func, expr) => { - const vgFieldMinMax = [ - stackField({ prefix: 'min', suffix: 'start', expr }), - stackField({ prefix: 'max', suffix: 'start', expr }), - stackField({ prefix: 'min', suffix: 'end', expr }), - stackField({ prefix: 'max', suffix: 'end', expr }) - ]; - return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`; - }; - let groupUpdate; - let innerGroupUpdate; - // Build the encoding for group and an inner group - if (model.stack.fieldChannel === 'x') { - // Move cornerRadius, y/yc/y2/height properties to group - // Group x/x2 should be the min/max of the marks within - groupUpdate = Object.assign(Object.assign({}, pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS])), { x: { signal: stackFieldGroup('min', 'datum') }, x2: { signal: stackFieldGroup('max', 'datum') }, clip: { value: true } }); - // Inner group should revert the x translation, and pass height through - innerGroupUpdate = { - x: { field: { group: 'x' }, mult: -1 }, - height: { field: { group: 'height' } } - }; - // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group) - // This is why size encoding is not supported yet - mark.encode.update = Object.assign(Object.assign({}, omit(mark.encode.update, ['y', 'yc', 'y2'])), { height: { field: { group: 'height' } } }); - } - else { - groupUpdate = Object.assign(Object.assign({}, pick(mark.encode.update, ['x', 'xc', 'x2', 'width'])), { y: { signal: stackFieldGroup('min', 'datum') }, y2: { signal: stackFieldGroup('max', 'datum') }, clip: { value: true } }); - innerGroupUpdate = { - y: { field: { group: 'y' }, mult: -1 }, - width: { field: { group: 'width' } } - }; - mark.encode.update = Object.assign(Object.assign({}, omit(mark.encode.update, ['x', 'xc', 'x2'])), { width: { field: { group: 'width' } } }); - } - // Deal with cornerRadius properties - for (const key of VG_CORNERRADIUS_CHANNELS) { - const configValue = getMarkConfig(key, model.markDef, model.config); - // Move from mark to group - if (mark.encode.update[key]) { - groupUpdate[key] = mark.encode.update[key]; - delete mark.encode.update[key]; - } - else if (configValue) { - groupUpdate[key] = signalOrValueRef(configValue); - } - // Overwrite any cornerRadius on mark set by config --- they are already moved to the group - if (configValue) { - mark.encode.update[key] = { value: 0 }; - } - } - // For bin and time unit, we have to add bin/timeunit -end channels. - const groupByField = model.fieldDef(model.stack.groupbyChannel); - const groupby = vgField(groupByField) ? [vgField(groupByField)] : []; - if ((groupByField === null || groupByField === void 0 ? void 0 : groupByField.bin) || (groupByField === null || groupByField === void 0 ? void 0 : groupByField.timeUnit)) { - groupby.push(vgField(groupByField, { binSuffix: 'end' })); - } - const strokeProperties = [ - 'stroke', - 'strokeWidth', - 'strokeJoin', - 'strokeCap', - 'strokeDash', - 'strokeDashOffset', - 'strokeMiterLimit', - 'strokeOpacity' - ]; - // Generate stroke properties for the group - groupUpdate = strokeProperties.reduce((encode, prop) => { - if (mark.encode.update[prop]) { - return Object.assign(Object.assign({}, encode), { [prop]: mark.encode.update[prop] }); - } - else { - const configValue = getMarkConfig(prop, model.markDef, model.config); - if (configValue !== undefined) { - return Object.assign(Object.assign({}, encode), { [prop]: signalOrValueRef(configValue) }); - } - else { - return encode; - } - } - }, groupUpdate); - // Apply strokeForeground and strokeOffset if stroke is used - if (groupUpdate.stroke) { - groupUpdate.strokeForeground = { value: true }; - groupUpdate.strokeOffset = { value: 0 }; - } - return [ - { - type: 'group', - from: { - facet: { - data: model.requestDataName(DataSourceType.Main), - name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main), - groupby, - aggregate: { - fields: [ - stackField({ suffix: 'start' }), - stackField({ suffix: 'start' }), - stackField({ suffix: 'end' }), - stackField({ suffix: 'end' }) - ], - ops: ['min', 'max', 'min', 'max'] - } - } - }, - encode: { - update: groupUpdate - }, - marks: [ - { - type: 'group', - encode: { update: innerGroupUpdate }, - marks: [mark] - } - ] - } - ]; -} -export function getSort(model) { - const { encoding, stack, mark, markDef, config } = model; - const order = encoding.order; - if ((!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) || - (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config)))) { - return undefined; - } - else if ((isArray(order) || isFieldDef(order)) && !stack) { - // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.) - return sortParams(order, { expr: 'datum' }); - } - else if (isPathMark(mark)) { - // For both line and area, we sort values based on dimension by default - const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; - const dimensionChannelDef = encoding[dimensionChannel]; - if (isFieldDef(dimensionChannelDef)) { - const s = dimensionChannelDef.sort; - if (isArray(s)) { - return { - field: vgField(dimensionChannelDef, { prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum' }) - }; - } - else if (isSortField(s)) { - return { - field: vgField({ - // FIXME: this op might not already exist? - // FIXME: what if dimensionChannel (x or y) contains custom domain? - aggregate: isAggregate(model.encoding) ? s.op : undefined, - field: s.field - }, { expr: 'datum' }) - }; - } - else if (isSortByEncoding(s)) { - const fieldDefToSort = model.fieldDef(s.encoding); - return { - field: vgField(fieldDefToSort, { expr: 'datum' }), - order: s.order - }; - } - else if (s === null) { - return undefined; - } - else { - return { - field: vgField(dimensionChannelDef, { - // For stack with imputation, we only have bin_mid - binSuffix: model.stack && model.stack.impute ? 'mid' : undefined, - expr: 'datum' - }) - }; - } - } - return undefined; - } - return undefined; -} -function getMarkGroup(model, opt = { fromPrefix: '' }) { - const { mark, markDef, encoding, config } = model; - const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model)); - const style = getStyles(markDef); - const key = encoding.key; - const sort = getSort(model); - const interactive = interactiveFlag(model); - const aria = getMarkPropOrConfig('aria', markDef, config); - const postEncodingTransform = markCompiler[mark].postEncodingTransform - ? markCompiler[mark].postEncodingTransform(model) - : null; - return [ - Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name: model.getName('marks'), type: markCompiler[mark].vgMark }, (clip ? { clip: true } : {})), (style ? { style } : {})), (key ? { key: key.field } : {})), (sort ? { sort } : {})), (interactive ? interactive : {})), (aria === false ? { aria } : {})), { from: { data: opt.fromPrefix + model.requestDataName(DataSourceType.Main) }, encode: { - update: markCompiler[mark].encodeEntry(model) - } }), (postEncodingTransform - ? { - transform: postEncodingTransform - } - : {})) - ]; -} -/** - * If scales are bound to interval selections, we want to automatically clip - * marks to account for panning/zooming interactions. We identify bound scales - * by the selectionExtent property, which gets added during scale parsing. - */ -function scaleClip(model) { - const xScale = model.getScaleComponent('x'); - const yScale = model.getScaleComponent('y'); - return (xScale && xScale.get('selectionExtent')) || (yScale && yScale.get('selectionExtent')) ? true : undefined; -} -/** - * If we use a custom projection with auto-fitting to the geodata extent, - * we need to clip to ensure the chart size doesn't explode. - */ -function projectionClip(model) { - const projection = model.component.projection; - return projection && !projection.isFit ? true : undefined; -} -/** - * Only output interactive flags if we have selections defined somewhere in our model hierarchy. - */ -function interactiveFlag(model) { - if (!model.component.selection) - return null; - const unitCount = keys(model.component.selection).length; - let parentCount = unitCount; - let parent = model.parent; - while (parent && parentCount === 0) { - parentCount = keys(parent.component.selection).length; - parent = parent.parent; - } - return parentCount ? { interactive: unitCount > 0 } : null; -} -//# sourceMappingURL=mark.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/mark.js.map b/node_modules/vega-lite/build/src/compile/mark/mark.js.map deleted file mode 100644 index 20b5316..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/mark.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mark.js","sourceRoot":"","sources":["../../../../src/compile/mark/mark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAiB,UAAU,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAQ,KAAK,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,gBAAgB,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AACtF,OAAO,EAA2B,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAC,aAAa,EAAE,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAC,MAAM,WAAW,CAAC;AAEtG,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,GAAG,EAAC,MAAM,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MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC;IAC9C,OAAO,UAAU,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,KAAgB;IACvC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IACzD,IAAI,WAAW,GAAG,SAAS,CAAC;IAC5B,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC1B,OAAO,MAAM,IAAI,WAAW,KAAK,CAAC,EAAE;QAClC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QACtD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;KACxB;IACD,OAAO,WAAW,CAAC,CAAC,CAAC,EAAC,WAAW,EAAE,SAAS,GAAG,CAAC,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/point.d.ts b/node_modules/vega-lite/build/src/compile/mark/point.d.ts deleted file mode 100644 index c83fe8c..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/point.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Config } from '../../config'; -import { VgEncodeEntry } from '../../vega.schema'; -import { UnitModel } from '../unit'; -import { MarkCompiler } from './base'; -export declare function shapeMixins(model: UnitModel, config: Config, fixedShape?: 'circle' | 'square'): VgEncodeEntry; -export declare const point: MarkCompiler; -export declare const circle: MarkCompiler; -export declare const square: MarkCompiler; -//# sourceMappingURL=point.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/point.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/point.d.ts.map deleted file mode 100644 index abd47ba..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/point.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAuBpC,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAK7G;AAED,eAAO,MAAM,KAAK,EAAE,YAKnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAKpB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAKpB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/point.js b/node_modules/vega-lite/build/src/compile/mark/point.js deleted file mode 100644 index 4552b14..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/point.js +++ /dev/null @@ -1,37 +0,0 @@ -import * as encode from './encode'; -function encodeEntry(model, fixedShape) { - const { config } = model; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'include', - orient: 'ignore', - theta: 'ignore' - })), encode.pointPosition('x', model, { defaultPos: 'mid' })), encode.pointPosition('y', model, { defaultPos: 'mid' })), encode.nonPosition('size', model)), encode.nonPosition('angle', model)), shapeMixins(model, config, fixedShape)); -} -export function shapeMixins(model, config, fixedShape) { - if (fixedShape) { - return { shape: { value: fixedShape } }; - } - return encode.nonPosition('shape', model); -} -export const point = { - vgMark: 'symbol', - encodeEntry: (model) => { - return encodeEntry(model); - } -}; -export const circle = { - vgMark: 'symbol', - encodeEntry: (model) => { - return encodeEntry(model, 'circle'); - } -}; -export const square = { - vgMark: 'symbol', - encodeEntry: (model) => { - return encodeEntry(model, 'square'); - } -}; -//# sourceMappingURL=point.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/point.js.map b/node_modules/vega-lite/build/src/compile/mark/point.js.map deleted file mode 100644 index 1e51955..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/point.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"point.js","sourceRoot":"","sources":["../../../../src/compile/mark/point.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,SAAS,WAAW,CAAC,KAAgB,EAAE,UAAgC;IACrE,MAAM,EAAC,MAAM,EAAC,GAAG,KAAK,CAAC;IAEvB,+FACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;QAC/B,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,QAAQ;KAChB,CAAC,GACC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC,GACrD,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC,GACrD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,GACjC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,GAClC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EACzC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAgB,EAAE,MAAc,EAAE,UAAgC;IAC5F,IAAI,UAAU,EAAE;QACd,OAAO,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,UAAU,EAAC,EAAC,CAAC;KACrC;IACD,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/rect.d.ts b/node_modules/vega-lite/build/src/compile/mark/rect.d.ts deleted file mode 100644 index 2734b29..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/rect.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const rect: MarkCompiler; -//# sourceMappingURL=rect.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/rect.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/rect.d.ts.map deleted file mode 100644 index 08a06be..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/rect.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YAgBlB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/rect.js b/node_modules/vega-lite/build/src/compile/mark/rect.js deleted file mode 100644 index 3b6e944..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/rect.js +++ /dev/null @@ -1,15 +0,0 @@ -import * as encode from './encode'; -export const rect = { - vgMark: 'rect', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), encode.rectPosition(model, 'x', 'rect')), encode.rectPosition(model, 'y', 'rect')); - } -}; -//# sourceMappingURL=rect.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/rect.js.map b/node_modules/vega-lite/build/src/compile/mark/rect.js.map deleted file mode 100644 index a4fbb65..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/rect.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../../src/compile/mark/rect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,qDACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,GACC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,GACvC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAC1C;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/rule.d.ts b/node_modules/vega-lite/build/src/compile/mark/rule.d.ts deleted file mode 100644 index fc72b26..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/rule.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const rule: MarkCompiler; -//# sourceMappingURL=rule.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/rule.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/rule.d.ts.map deleted file mode 100644 index c455d4b..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/rule.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/rule.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YAmClB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/rule.js b/node_modules/vega-lite/build/src/compile/mark/rule.js deleted file mode 100644 index b23dc84..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/rule.js +++ /dev/null @@ -1,31 +0,0 @@ -import * as encode from './encode'; -export const rule = { - vgMark: 'rule', - encodeEntry: (model) => { - const { markDef } = model; - const orient = markDef.orient; - if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) { - // Show nothing if we have none of x, y, lat, and long. - return {}; - } - return Object.assign(Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), encode.pointOrRangePosition('x', model, { - defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid', - defaultPos2: 'zeroOrMin', - range: orient !== 'vertical' // include x2 for horizontal or line segment rule - })), encode.pointOrRangePosition('y', model, { - defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid', - defaultPos2: 'zeroOrMin', - range: orient !== 'horizontal' // include y2 for vertical or line segment rule - })), encode.nonPosition('size', model, { - vgChannel: 'strokeWidth' // VL's rule size is strokeWidth - })); - } -}; -//# sourceMappingURL=rule.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/rule.js.map b/node_modules/vega-lite/build/src/compile/mark/rule.js.map deleted file mode 100644 index 3590d73..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/rule.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../../../src/compile/mark/rule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,MAAM,EAAC,OAAO,EAAC,GAAG,KAAK,CAAC;QACxB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE9B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE;YACnG,uDAAuD;YACvD,OAAO,EAAE,CAAC;SACX;QAED,mEACK,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,GACC,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE;YACzC,UAAU,EAAE,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK;YACzD,WAAW,EAAE,WAAW;YACxB,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC,iDAAiD;SAC/E,CAAC,GACC,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE;YACzC,UAAU,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK;YACvD,WAAW,EAAE,WAAW;YACxB,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC,+CAA+C;SAC/E,CAAC,GACC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE;YACnC,SAAS,EAAE,aAAa,CAAC,gCAAgC;SAC1D,CAAC,EACF;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/text.d.ts b/node_modules/vega-lite/build/src/compile/mark/text.d.ts deleted file mode 100644 index 30da99e..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/text.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const text: MarkCompiler; -//# sourceMappingURL=text.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/text.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/text.d.ts.map deleted file mode 100644 index db24030..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/text.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/text.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YA4BlB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/text.js b/node_modules/vega-lite/build/src/compile/mark/text.js deleted file mode 100644 index ec06043..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/text.js +++ /dev/null @@ -1,35 +0,0 @@ -import { getMarkPropOrConfig } from '../common'; -import * as encode from './encode'; -export const text = { - vgMark: 'text', - encodeEntry: (model) => { - const { config, encoding } = model; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'include', - baseline: 'include', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'include' - })), encode.pointPosition('x', model, { defaultPos: 'mid' })), encode.pointPosition('y', model, { defaultPos: 'mid' })), encode.text(model)), encode.nonPosition('size', model, { - vgChannel: 'fontSize' // VL's text size is fontSize - })), encode.nonPosition('angle', model)), encode.valueIfDefined('align', align(model.markDef, encoding, config))), encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config))), encode.pointPosition('radius', model, { defaultPos: null, isMidPoint: true })), encode.pointPosition('theta', model, { defaultPos: null, isMidPoint: true })); - } -}; -function align(markDef, encoding, config) { - const a = getMarkPropOrConfig('align', markDef, config); - if (a === undefined) { - return 'center'; - } - // If there is a config, Vega-parser will process this already. - return undefined; -} -function baseline(markDef, encoding, config) { - const b = getMarkPropOrConfig('baseline', markDef, config); - if (b === undefined) { - return 'middle'; - } - // If there is a config, Vega-parser will process this already. - return undefined; -} -//# sourceMappingURL=text.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/text.js.map b/node_modules/vega-lite/build/src/compile/mark/text.js.map deleted file mode 100644 index daa204a..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/text.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../../src/compile/mark/text.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAG9C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IAEd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC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,SAAS,EAAE;QACnB,OAAO,QAAQ,CAAC;KACjB;IACD,+DAA+D;IAC/D,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,QAAQ,CAAC,OAAgB,EAAE,QAA0B,EAAE,MAAc;IAC5E,MAAM,CAAC,GAAG,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3D,IAAI,CAAC,KAAK,SAAS,EAAE;QACnB,OAAO,QAAQ,CAAC;KACjB;IACD,+DAA+D;IAC/D,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/tick.d.ts b/node_modules/vega-lite/build/src/compile/mark/tick.d.ts deleted file mode 100644 index fef4920..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/tick.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MarkCompiler } from './base'; -export declare const tick: MarkCompiler; -//# sourceMappingURL=tick.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/tick.d.ts.map b/node_modules/vega-lite/build/src/compile/mark/tick.d.ts.map deleted file mode 100644 index 3b2a514..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/tick.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tick.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/tick.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YA+BlB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/tick.js b/node_modules/vega-lite/build/src/compile/mark/tick.js deleted file mode 100644 index 32a4b60..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/tick.js +++ /dev/null @@ -1,45 +0,0 @@ -import { isNumber } from 'vega-util'; -import { getViewConfigDiscreteStep } from '../../config'; -import { isVgRangeStep } from '../../vega.schema'; -import { getMarkPropOrConfig, signalOrValueRef } from '../common'; -import * as encode from './encode'; -export const tick = { - vgMark: 'rect', - encodeEntry: (model) => { - const { config, markDef } = model; - const orient = markDef.orient; - const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; - const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width'; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), encode.pointPosition('x', model, { defaultPos: 'mid', vgChannel: 'xc' })), encode.pointPosition('y', model, { defaultPos: 'mid', vgChannel: 'yc' })), encode.nonPosition('size', model, { - defaultValue: defaultSize(model), - vgChannel: vgSizeChannel - })), { [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config)) }); - } -}; -function defaultSize(model) { - var _a; - const { config, markDef } = model; - const { orient } = markDef; - const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; - const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y'); - const markPropOrConfig = (_a = getMarkPropOrConfig('size', markDef, config, { vgChannel: vgSizeChannel })) !== null && _a !== void 0 ? _a : config.tick.bandSize; - if (markPropOrConfig !== undefined) { - return markPropOrConfig; - } - else { - const scaleRange = scale ? scale.get('range') : undefined; - if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { - return (scaleRange.step * 3) / 4; - } - const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel); - return (defaultViewStep * 3) / 4; - } -} -//# sourceMappingURL=tick.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/mark/tick.js.map b/node_modules/vega-lite/build/src/compile/mark/tick.js.map deleted file mode 100644 index 4303234..0000000 --- a/node_modules/vega-lite/build/src/compile/mark/tick.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tick.js","sourceRoot":"","sources":["../../../../src/compile/mark/tick.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,Q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/vega-lite/build/src/compile/model.d.ts deleted file mode 100644 index daaf49e..0000000 --- a/node_modules/vega-lite/build/src/compile/model.d.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { Axis as VgAxis, Legend as VgLegend, NewSignal, Projection as VgProjection, SignalRef, Title as VgTitle } from 'vega'; -import { Channel, ScaleChannel, SingleDefChannel, ExtendedChannel } from '../channel'; -import { FieldDef, FieldRefOption } from '../channeldef'; -import { Config } from '../config'; -import { Data, DataSourceType } from '../data'; -import { Resolve } from '../resolve'; -import { GenericCompositionLayoutWithColumns, LayoutSizeMixins, SpecType, ViewBackground } from '../spec/base'; -import { NormalizedSpec } from '../spec/index'; -import { TitleParams } from '../title'; -import { Transform } from '../transform'; -import { Dict } from '../util'; -import { VgData, VgEncodeEntry, VgLayout, VgMarkGroup } from '../vega.schema'; -import { AxisComponentIndex } from './axis/component'; -import { ConcatModel } from './concat'; -import { DataComponent } from './data'; -import { FacetModel } from './facet'; -import { LayoutHeaderComponent } from './header/component'; -import { LayerModel } from './layer'; -import { LayoutSizeComponent, LayoutSizeType } from './layoutsize/component'; -import { LegendComponentIndex } from './legend/component'; -import { ProjectionComponent } from './projection/component'; -import { ScaleComponent, ScaleComponentIndex } from './scale/component'; -import { SelectionComponent } from './selection'; -import { UnitModel } from './unit'; -/** - * Composable Components that are intermediate results of the parsing phase of the - * compilations. The components represents parts of the specification in a form that - * can be easily merged (during parsing for composite specs). - * In addition, these components are easily transformed into Vega specifications - * during the "assemble" phase, which is the last phase of the compilation step. - */ -export interface Component { - data: DataComponent; - layoutSize: LayoutSizeComponent; - layoutHeaders: { - row?: LayoutHeaderComponent; - column?: LayoutHeaderComponent; - facet?: LayoutHeaderComponent; - }; - mark: VgMarkGroup[]; - scales: ScaleComponentIndex; - projection: ProjectionComponent; - selection: Dict; - /** Dictionary mapping channel to VgAxis definition */ - axes: AxisComponentIndex; - /** Dictionary mapping channel to VgLegend definition */ - legends: LegendComponentIndex; - resolve: Resolve; -} -export interface NameMapInterface { - rename(oldname: string, newName: string): void; - has(name: string): boolean; - get(name: string): string; -} -export declare class NameMap implements NameMapInterface { - private nameMap; - constructor(); - rename(oldName: string, newName: string): void; - has(name: string): boolean; - get(name: string): string; -} -export declare function isUnitModel(model: Model): model is UnitModel; -export declare function isFacetModel(model: Model): model is FacetModel; -export declare function isConcatModel(model: Model): model is ConcatModel; -export declare function isLayerModel(model: Model): model is LayerModel; -export declare abstract class Model { - readonly type: SpecType; - readonly parent: Model; - readonly config: Config; - readonly view?: ViewBackground; - readonly name: string; - size: LayoutSizeMixins; - readonly title: TitleParams; - readonly description: string; - readonly data: Data | null; - readonly transforms: Transform[]; - readonly layout: GenericCompositionLayoutWithColumns; - /** Name map for scales, which can be renamed by a model's parent. */ - protected scaleNameMap: NameMapInterface; - /** Name map for projections, which can be renamed by a model's parent. */ - protected projectionNameMap: NameMapInterface; - /** Name map for signals, which can be renamed by a model's parent. */ - protected signalNameMap: NameMapInterface; - readonly component: Component; - abstract readonly children: Model[]; - constructor(spec: NormalizedSpec, type: SpecType, parent: Model, parentGivenName: string, config: Config, resolve: Resolve, view?: ViewBackground); - get width(): SignalRef; - get height(): SignalRef; - parse(): void; - abstract parseData(): void; - abstract parseSelections(): void; - parseScale(): void; - parseProjection(): void; - abstract parseLayoutSize(): void; - /** - * Rename top-level spec's size to be just width / height, ignoring model name. - * This essentially merges the top-level spec's width/height signals with the width/height signals - * to help us reduce redundant signals declaration. - */ - private renameTopLevelLayoutSizeSignal; - abstract parseMarkGroup(): void; - abstract parseAxesAndHeaders(): void; - parseLegends(): void; - abstract assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[]; - abstract assembleSignals(): NewSignal[]; - abstract assembleSelectionData(data: readonly VgData[]): readonly VgData[]; - assembleGroupStyle(): string | string[]; - private assembleEncodeFromView; - assembleGroupEncodeEntry(isTopLevel: boolean): VgEncodeEntry; - assembleLayout(): VgLayout; - protected assembleDefaultLayout(): VgLayout; - abstract assembleLayoutSignals(): NewSignal[]; - assembleHeaderMarks(): VgMarkGroup[]; - abstract assembleMarks(): VgMarkGroup[]; - assembleAxes(): VgAxis[]; - assembleLegends(): VgLegend[]; - assembleProjections(): VgProjection[]; - assembleTitle(): VgTitle; - /** - * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals. - */ - assembleGroup(signals?: NewSignal[]): any; - getName(text: string): string; - getDataName(type: DataSourceType): string; - /** - * Request a data source name for the given data source type and mark that data source as required. - * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData(). - * You can lookup the correct dataset name in assemble with `lookupDataSource`. - */ - requestDataName(name: DataSourceType): string; - getSizeSignalRef(layoutSizeType: LayoutSizeType): SignalRef; - /** - * Lookup the name of the datasource for an output node. You probably want to call this in assemble. - */ - lookupDataSource(name: string): string; - getSignalName(oldSignalName: string): string; - renameSignal(oldName: string, newName: string): void; - renameScale(oldName: string, newName: string): void; - renameProjection(oldName: string, newName: string): void; - /** - * @return scale name for a given channel after the scale has been parsed and named. - */ - scaleName(originalScaleName: ScaleChannel | string, parse?: boolean): string; - /** - * @return projection name after the projection has been parsed and named. - */ - projectionName(parse?: boolean): string; - /** - * Corrects the data references in marks after assemble. - */ - correctDataNames: (mark: VgMarkGroup) => any; - /** - * Traverse a model's hierarchy to get the scale component for a particular channel. - */ - getScaleComponent(channel: ScaleChannel): ScaleComponent; - /** - * Traverse a model's hierarchy to get a particular selection component. - */ - getSelectionComponent(variableName: string, origName: string): SelectionComponent; - /** - * Returns true if the model has a signalRef for an axis orient. - */ - hasAxisOrientSignalRef(): boolean; -} -/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */ -export declare abstract class ModelWithField extends Model { - abstract fieldDef(channel: SingleDefChannel): FieldDef; - /** Get "field" reference for Vega */ - vgField(channel: SingleDefChannel, opt?: FieldRefOption): string; - protected abstract getMapping(): Partial>; - reduceFieldDef(f: (acc: U, fd: FieldDef, c: Channel) => U, init: T): T; - forEachFieldDef(f: (fd: FieldDef, c: ExtendedChannel) => void, t?: any): void; - abstract channelHasField(channel: Channel): boolean; -} -//# sourceMappingURL=model.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/model.d.ts.map b/node_modules/vega-lite/build/src/compile/model.d.ts.map deleted file mode 100644 index 6853408..0000000 --- a/node_modules/vega-lite/build/src/compile/model.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/compile/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,IAAI,IAAI,MAAM,EACd,MAAM,IAAI,QAAQ,EAClB,SAAS,EACT,UAAU,IAAI,YAAY,EAC1B,SAAS,EACT,KAAK,IAAI,OAAO,EACjB,MAAM,MAAM,CAAC;AACd,OAAO,EACL,OAAO,EAKP,YAAY,EACZ,gBAAgB,EAChB,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAa,QAAQ,EAAE,cAAc,EAAuB,MAAM,eAAe,CAAC;AACzF,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,IAAI,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AAG7C,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAGnC,OAAO,EAEL,mCAAmC,EACnC,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAA6B,WAAW,EAAC,MAAM,UAAU,CAAC;AACjE,OAAO,EAAqB,SAAS,EAAC,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAW,IAAI,EAAoC,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAgB,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAC,WAAW,EAA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AAC,MAAM,CAAC,EAAE,CAAC,EAAE,OAAO,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC;IAcpF,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,eAAe,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG;aAarE,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;CAC3D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/model.js b/node_modules/vega-lite/build/src/compile/model.js deleted file mode 100644 index 81e89f6..0000000 --- a/node_modules/vega-lite/build/src/compile/model.js +++ /dev/null @@ -1,457 +0,0 @@ -import { __rest } from "tslib"; -import { FACET_CHANNELS, getPositionScaleChannel, isChannel, isScaleChannel } from '../channel'; -import { getFieldDef, vgField } from '../channeldef'; -import { DataSourceType } from '../data'; -import { forEach, reduce } from '../encoding'; -import * as log from '../log'; -import { hasDiscreteDomain } from '../scale'; -import { isFacetSpec } from '../spec'; -import { extractCompositionLayout } from '../spec/base'; -import { extractTitleConfig, isText } from '../title'; -import { normalizeTransform } from '../transform'; -import { contains, duplicate, keys, varName, isEmpty } from '../util'; -import { isVgRangeStep } from '../vega.schema'; -import { assembleAxes } from './axis/assemble'; -import { signalOrValueRef } from './common'; -import { assembleHeaderGroups, assembleLayoutTitleBand, assembleTitleGroup } from './header/assemble'; -import { HEADER_CHANNELS } from './header/component'; -import { sizeExpr } from './layoutsize/assemble'; -import { getSizeTypeFromLayoutSizeType } from './layoutsize/component'; -import { assembleLegends } from './legend/assemble'; -import { parseLegend } from './legend/parse'; -import { assembleProjections } from './projection/assemble'; -import { parseProjection } from './projection/parse'; -import { assembleScales } from './scale/assemble'; -import { assembleDomain, getFieldFromDomain } from './scale/domain'; -import { parseScales } from './scale/parse'; -import { Split } from './split'; -export class NameMap { - constructor() { - this.nameMap = {}; - } - rename(oldName, newName) { - this.nameMap[oldName] = newName; - } - has(name) { - return this.nameMap[name] !== undefined; - } - get(name) { - // If the name appears in the _nameMap, we need to read its new name. - // We have to loop over the dict just in case the new name also gets renamed. - while (this.nameMap[name] && name !== this.nameMap[name]) { - name = this.nameMap[name]; - } - return name; - } -} -/* - We use type guards instead of `instanceof` as `instanceof` makes - different parts of the compiler depend on the actual implementation of - the model classes, which in turn depend on different parts of the compiler. - Thus, `instanceof` leads to circular dependency problems. - - On the other hand, type guards only make different parts of the compiler - depend on the type of the model classes, but not the actual implementation. -*/ -export function isUnitModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'unit'; -} -export function isFacetModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'facet'; -} -export function isConcatModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'concat'; -} -export function isLayerModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'layer'; -} -export class Model { - constructor(spec, type, parent, parentGivenName, config, resolve, view) { - var _a, _b; - this.type = type; - this.parent = parent; - this.config = config; - this.view = view; - this.children = []; - /** - * Corrects the data references in marks after assemble. - */ - this.correctDataNames = (mark) => { - // TODO: make this correct - // for normal data references - if (mark.from && mark.from.data) { - mark.from.data = this.lookupDataSource(mark.from.data); - } - // for access to facet data - if (mark.from && mark.from.facet && mark.from.facet.data) { - mark.from.facet.data = this.lookupDataSource(mark.from.facet.data); - } - return mark; - }; - this.parent = parent; - this.config = config; - // If name is not provided, always use parent's givenName to avoid name conflicts. - this.name = (_a = spec.name) !== null && _a !== void 0 ? _a : parentGivenName; - this.title = isText(spec.title) ? { text: spec.title } : spec.title; - // Shared name maps - this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap(); - this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap(); - this.signalNameMap = parent ? parent.signalNameMap : new NameMap(); - this.data = spec.data; - this.description = spec.description; - this.transforms = normalizeTransform((_b = spec.transform) !== null && _b !== void 0 ? _b : []); - this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config); - this.component = { - data: { - sources: parent ? parent.component.data.sources : [], - outputNodes: parent ? parent.component.data.outputNodes : {}, - outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {}, - // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined - isFaceted: isFacetSpec(spec) || (parent && parent.component.data.isFaceted && spec.data === undefined) - }, - layoutSize: new Split(), - layoutHeaders: { row: {}, column: {}, facet: {} }, - mark: null, - resolve: Object.assign({ scale: {}, axis: {}, legend: {} }, (resolve ? duplicate(resolve) : {})), - selection: null, - scales: null, - projection: null, - axes: {}, - legends: {} - }; - } - get width() { - return this.getSizeSignalRef('width'); - } - get height() { - return this.getSizeSignalRef('height'); - } - parse() { - this.parseScale(); - this.parseLayoutSize(); // depends on scale - this.renameTopLevelLayoutSizeSignal(); - this.parseSelections(); - this.parseProjection(); - this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name. - this.parseAxesAndHeaders(); // depends on scale and layout size - this.parseLegends(); // depends on scale, markDef - this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark. - } - parseScale() { - parseScales(this); - } - parseProjection() { - parseProjection(this); - } - /** - * Rename top-level spec's size to be just width / height, ignoring model name. - * This essentially merges the top-level spec's width/height signals with the width/height signals - * to help us reduce redundant signals declaration. - */ - renameTopLevelLayoutSizeSignal() { - if (this.getName('width') !== 'width') { - this.renameSignal(this.getName('width'), 'width'); - } - if (this.getName('height') !== 'height') { - this.renameSignal(this.getName('height'), 'height'); - } - } - parseLegends() { - parseLegend(this); - } - assembleGroupStyle() { - var _a, _b; - if (this.type === 'unit' || this.type === 'layer') { - return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : 'cell'; - } - return undefined; - } - assembleEncodeFromView(view) { - // Exclude "style" - const { style: _ } = view, baseView = __rest(view, ["style"]); - const e = {}; - for (const property of keys(baseView)) { - const value = baseView[property]; - if (value !== undefined) { - e[property] = signalOrValueRef(value); - } - } - return e; - } - assembleGroupEncodeEntry(isTopLevel) { - let encodeEntry = {}; - if (this.view) { - encodeEntry = this.assembleEncodeFromView(this.view); - } - if (!isTopLevel) { - // Descriptions are already added to the top-level description so we only need to add them to the inner views. - if (this.description) { - encodeEntry['description'] = signalOrValueRef(this.description); - } - // For top-level spec, we can set the global width and height signal to adjust the group size. - // For other child specs, we have to manually set width and height in the encode entry. - if (this.type === 'unit' || this.type === 'layer') { - return Object.assign({ width: this.getSizeSignalRef('width'), height: this.getSizeSignalRef('height') }, (encodeEntry !== null && encodeEntry !== void 0 ? encodeEntry : {})); - } - } - return isEmpty(encodeEntry) ? undefined : encodeEntry; - } - assembleLayout() { - if (!this.layout) { - return undefined; - } - const _a = this.layout, { spacing } = _a, layout = __rest(_a, ["spacing"]); - const { component, config } = this; - const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config); - return Object.assign(Object.assign(Object.assign({ padding: spacing }, this.assembleDefaultLayout()), layout), (titleBand ? { titleBand } : {})); - } - assembleDefaultLayout() { - return {}; - } - assembleHeaderMarks() { - const { layoutHeaders } = this.component; - let headerMarks = []; - for (const channel of FACET_CHANNELS) { - if (layoutHeaders[channel].title) { - headerMarks.push(assembleTitleGroup(this, channel)); - } - } - for (const channel of HEADER_CHANNELS) { - headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel)); - } - return headerMarks; - } - assembleAxes() { - return assembleAxes(this.component.axes, this.config); - } - assembleLegends() { - return assembleLegends(this); - } - assembleProjections() { - return assembleProjections(this); - } - assembleTitle() { - var _a, _b, _c; - const _d = (_a = this.title) !== null && _a !== void 0 ? _a : {}, { encoding } = _d, titleNoEncoding = __rest(_d, ["encoding"]); - const title = Object.assign(Object.assign(Object.assign({}, extractTitleConfig(this.config.title).nonMark), titleNoEncoding), (encoding ? { encode: { update: encoding } } : {})); - if (title.text) { - if (contains(['unit', 'layer'], this.type)) { - // Unit/Layer - if (contains(['middle', undefined], title.anchor)) { - title.frame = (_b = title.frame) !== null && _b !== void 0 ? _b : 'group'; - } - } - else { - // composition with Vega layout - // Set title = "start" by default for composition as "middle" does not look nice - // https://github.com/vega/vega/issues/960#issuecomment-471360328 - title.anchor = (_c = title.anchor) !== null && _c !== void 0 ? _c : 'start'; - } - return isEmpty(title) ? undefined : title; - } - return undefined; - } - /** - * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals. - */ - assembleGroup(signals = []) { - const group = {}; - signals = signals.concat(this.assembleSignals()); - if (signals.length > 0) { - group.signals = signals; - } - const layout = this.assembleLayout(); - if (layout) { - group.layout = layout; - } - group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks()); - // Only include scales if this spec is top-level or if parent is facet. - // (Otherwise, it will be merged with upper-level's scope.) - const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : []; - if (scales.length > 0) { - group.scales = scales; - } - const axes = this.assembleAxes(); - if (axes.length > 0) { - group.axes = axes; - } - const legends = this.assembleLegends(); - if (legends.length > 0) { - group.legends = legends; - } - return group; - } - getName(text) { - return varName((this.name ? this.name + '_' : '') + text); - } - getDataName(type) { - return this.getName(DataSourceType[type].toLowerCase()); - } - /** - * Request a data source name for the given data source type and mark that data source as required. - * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData(). - * You can lookup the correct dataset name in assemble with `lookupDataSource`. - */ - requestDataName(name) { - const fullName = this.getDataName(name); - // Increase ref count. This is critical because otherwise we won't create a data source. - // We also increase the ref counts on OutputNode.getSource() calls. - const refCounts = this.component.data.outputNodeRefCounts; - refCounts[fullName] = (refCounts[fullName] || 0) + 1; - return fullName; - } - getSizeSignalRef(layoutSizeType) { - if (isFacetModel(this.parent)) { - const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); - const channel = getPositionScaleChannel(sizeType); - const scaleComponent = this.component.scales[channel]; - if (scaleComponent && !scaleComponent.merged) { - // independent scale - const type = scaleComponent.get('type'); - const range = scaleComponent.get('range'); - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const scaleName = scaleComponent.get('name'); - const domain = assembleDomain(this, channel); - const field = getFieldFromDomain(domain); - if (field) { - const fieldRef = vgField({ aggregate: 'distinct', field }, { expr: 'datum' }); - return { - signal: sizeExpr(scaleName, scaleComponent, fieldRef) - }; - } - else { - log.warn(log.message.unknownField(channel)); - return null; - } - } - } - } - return { - signal: this.signalNameMap.get(this.getName(layoutSizeType)) - }; - } - /** - * Lookup the name of the datasource for an output node. You probably want to call this in assemble. - */ - lookupDataSource(name) { - const node = this.component.data.outputNodes[name]; - if (!node) { - // Name not found in map so let's just return what we got. - // This can happen if we already have the correct name. - return name; - } - return node.getSource(); - } - getSignalName(oldSignalName) { - return this.signalNameMap.get(oldSignalName); - } - renameSignal(oldName, newName) { - this.signalNameMap.rename(oldName, newName); - } - renameScale(oldName, newName) { - this.scaleNameMap.rename(oldName, newName); - } - renameProjection(oldName, newName) { - this.projectionNameMap.rename(oldName, newName); - } - /** - * @return scale name for a given channel after the scale has been parsed and named. - */ - scaleName(originalScaleName, parse) { - if (parse) { - // During the parse phase always return a value - // No need to refer to rename map because a scale can't be renamed - // before it has the original name. - return this.getName(originalScaleName); - } - // If there is a scale for the channel, it should either - // be in the scale component or exist in the name map - if ( - // If there is a scale for the channel, there should be a local scale component for it - (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) || - // in the scale name map (the scale get merged by its parent) - this.scaleNameMap.has(this.getName(originalScaleName))) { - return this.scaleNameMap.get(this.getName(originalScaleName)); - } - return undefined; - } - /** - * @return projection name after the projection has been parsed and named. - */ - projectionName(parse) { - if (parse) { - // During the parse phase always return a value - // No need to refer to rename map because a projection can't be renamed - // before it has the original name. - return this.getName('projection'); - } - if ((this.component.projection && !this.component.projection.merged) || - this.projectionNameMap.has(this.getName('projection'))) { - return this.projectionNameMap.get(this.getName('projection')); - } - return undefined; - } - /** - * Traverse a model's hierarchy to get the scale component for a particular channel. - */ - getScaleComponent(channel) { - /* istanbul ignore next: This is warning for debugging test */ - if (!this.component.scales) { - throw new Error('getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().'); - } - const localScaleComponent = this.component.scales[channel]; - if (localScaleComponent && !localScaleComponent.merged) { - return localScaleComponent; - } - return this.parent ? this.parent.getScaleComponent(channel) : undefined; - } - /** - * Traverse a model's hierarchy to get a particular selection component. - */ - getSelectionComponent(variableName, origName) { - let sel = this.component.selection[variableName]; - if (!sel && this.parent) { - sel = this.parent.getSelectionComponent(variableName, origName); - } - if (!sel) { - throw new Error(log.message.selectionNotFound(origName)); - } - return sel; - } - /** - * Returns true if the model has a signalRef for an axis orient. - */ - hasAxisOrientSignalRef() { - var _a, _b; - return (((_a = this.component.axes.x) === null || _a === void 0 ? void 0 : _a.some(a => a.hasOrientSignalRef())) || ((_b = this.component.axes.y) === null || _b === void 0 ? void 0 : _b.some(a => a.hasOrientSignalRef()))); - } -} -/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */ -export class ModelWithField extends Model { - /** Get "field" reference for Vega */ - vgField(channel, opt = {}) { - const fieldDef = this.fieldDef(channel); - if (!fieldDef) { - return undefined; - } - return vgField(fieldDef, opt); - } - reduceFieldDef(f, init) { - return reduce(this.getMapping(), (acc, cd, c) => { - const fieldDef = getFieldDef(cd); - if (fieldDef) { - return f(acc, fieldDef, c); - } - return acc; - }, init); - } - forEachFieldDef(f, t) { - forEach(this.getMapping(), (cd, c) => { - const fieldDef = getFieldDef(cd); - if (fieldDef) { - f(fieldDef, c); - } - }, t); - } -} -//# sourceMappingURL=model.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/model.js.map b/node_modules/vega-lite/build/src/compile/model.js.map deleted file mode 100644 index fb76bd2..0000000 --- a/node_modules/vega-lite/build/src/compile/model.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/compile/model.ts"],"names":[],"mappings":";AASA,OAAO,EAEL,cAAc,EACd,uBAAu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EAAE,CAAC,EAAE,EAAE;YACR,MAAM,QAAQ,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;YACjC,IAAI,QAAQ,EAAE;gBACZ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;aAChB;QACH,CAAC,EACD,CAAC,CACF,CAAC;IACJ,CAAC;CAGF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/predicate.d.ts b/node_modules/vega-lite/build/src/compile/predicate.d.ts deleted file mode 100644 index d671685..0000000 --- a/node_modules/vega-lite/build/src/compile/predicate.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { LogicalComposition } from '../logical'; -import { Predicate } from '../predicate'; -import { DataFlowNode } from './data/dataflow'; -import { Model } from './model'; -/** - * Converts a predicate into an expression. - */ -export declare function expression(model: Model, filterOp: LogicalComposition, node?: DataFlowNode): string; -//# sourceMappingURL=predicate.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/predicate.d.ts.map b/node_modules/vega-lite/build/src/compile/predicate.d.ts.map deleted file mode 100644 index e44f547..0000000 --- a/node_modules/vega-lite/build/src/compile/predicate.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../../src/compile/predicate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAA8C,SAAS,EAAC,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAG9B;;GAEG;AAEH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM,CAW7G"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/predicate.js b/node_modules/vega-lite/build/src/compile/predicate.js deleted file mode 100644 index 20a602b..0000000 --- a/node_modules/vega-lite/build/src/compile/predicate.js +++ /dev/null @@ -1,23 +0,0 @@ -import { isString } from 'vega-util'; -import { fieldFilterExpression, isSelectionPredicate } from '../predicate'; -import { logicalExpr } from '../util'; -import { parseSelectionPredicate } from './selection/parse'; -/** - * Converts a predicate into an expression. - */ -// model is only used for selection filters. -export function expression(model, filterOp, node) { - return logicalExpr(filterOp, (predicate) => { - if (isString(predicate)) { - return predicate; - } - else if (isSelectionPredicate(predicate)) { - return parseSelectionPredicate(model, predicate.selection, node); - } - else { - // Filter Object - return fieldFilterExpression(predicate); - } - }); -} -//# sourceMappingURL=predicate.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/predicate.js.map b/node_modules/vega-lite/build/src/compile/predicate.js.map deleted file mode 100644 index 7a794ad..0000000 --- a/node_modules/vega-lite/build/src/compile/predicate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"predicate.js","sourceRoot":"","sources":["../../../src/compile/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAY,MAAM,cAAc,CAAC;AACpF,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAGpC,OAAO,EAAC,uBAAuB,EAAC,MAAM,mBAAmB,CAAC;AAE1D;;GAEG;AACH,4CAA4C;AAC5C,MAAM,UAAU,UAAU,CAAC,KAAY,EAAE,QAAuC,EAAE,IAAmB;IACnG,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC,SAAoB,EAAE,EAAE;QACpD,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE;YACvB,OAAO,SAAS,CAAC;SAClB;aAAM,IAAI,oBAAoB,CAAC,SAAS,CAAC,EAAE;YAC1C,OAAO,uBAAuB,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SAClE;aAAM;YACL,gBAAgB;YAChB,OAAO,qBAAqB,CAAC,SAAS,CAAC,CAAC;SACzC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/assemble.d.ts b/node_modules/vega-lite/build/src/compile/projection/assemble.d.ts deleted file mode 100644 index a8e6bc1..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/assemble.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Projection as VgProjection } from 'vega'; -import { Model } from '../model'; -export declare function assembleProjections(model: Model): VgProjection[]; -export declare function assembleProjectionsForModelAndChildren(model: Model): VgProjection[]; -export declare function assembleProjectionForModel(model: Model): VgProjection[]; -//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/assemble.d.ts.map b/node_modules/vega-lite/build/src/compile/projection/assemble.d.ts.map deleted file mode 100644 index a22f159..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/assemble.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/projection/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,YAAY,EAAY,MAAM,MAAM,CAAC;AAG3D,OAAO,EAA8B,KAAK,EAAC,MAAM,UAAU,CAAC;AAE5D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,EAAE,CAMhE;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,EAAE,CAInF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,EAAE,CAkDvE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/assemble.js b/node_modules/vega-lite/build/src/compile/projection/assemble.js deleted file mode 100644 index 3bfbe10..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/assemble.js +++ /dev/null @@ -1,54 +0,0 @@ -import { contains } from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { isConcatModel, isLayerModel } from '../model'; -export function assembleProjections(model) { - if (isLayerModel(model) || isConcatModel(model)) { - return assembleProjectionsForModelAndChildren(model); - } - else { - return assembleProjectionForModel(model); - } -} -export function assembleProjectionsForModelAndChildren(model) { - return model.children.reduce((projections, child) => { - return projections.concat(child.assembleProjections()); - }, assembleProjectionForModel(model)); -} -export function assembleProjectionForModel(model) { - const component = model.component.projection; - if (!component || component.merged) { - return []; - } - const projection = component.combine(); - const { name } = projection; // we need to extract name so that it is always present in the output and pass TS type validation - if (!component.data) { - // generate custom projection, no automatic fitting - return [ - Object.assign(Object.assign({ name }, { translate: { signal: '[width / 2, height / 2]' } }), projection) - ]; - } - else { - // generate projection that uses extent fitting - const size = { - signal: `[${component.size.map(ref => ref.signal).join(', ')}]` - }; - const fits = component.data.reduce((sources, data) => { - const source = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`; - if (!contains(sources, source)) { - // build a unique list of sources - sources.push(source); - } - return sources; - }, []); - if (fits.length <= 0) { - throw new Error("Projection's fit didn't find any data sources"); - } - return [ - Object.assign({ name, - size, fit: { - signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0] - } }, projection) - ]; - } -} -//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/assemble.js.map b/node_modules/vega-lite/build/src/compile/projection/assemble.js.map deleted file mode 100644 index 31790ff..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/assemble.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/projection/assemble.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAE,YAAY,EAAQ,MAAM,UAAU,CAAC;AAE5D,M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AO,EAAE,IAAI,EAAE,EAAE;YAC7D,MAAM,MAAM,GAAW,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;YACnG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;gBAC9B,iCAAiC;gBACjC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACtB;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;SAClE;QAED,OAAO;4BAEH,IAAI;gBACJ,IAAI,EACJ,GAAG,EAAE;oBACH,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;iBAC3D,IACE,UAAU;SAEhB,CAAC;KACH;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/component.d.ts b/node_modules/vega-lite/build/src/compile/projection/component.d.ts deleted file mode 100644 index e01517e..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/component.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { SignalRef } from 'vega'; -import { Projection } from '../../projection'; -import { Projection as VgProjection } from 'vega'; -import { Split } from '../split'; -export declare class ProjectionComponent extends Split { - specifiedProjection: Projection; - size: SignalRef[]; - data: (string | SignalRef)[]; - merged: boolean; - constructor(name: string, specifiedProjection: Projection, size: SignalRef[], data: (string | SignalRef)[]); - /** - * Whether the projection parameters should fit provided data. - */ - get isFit(): boolean; -} -//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/component.d.ts.map b/node_modules/vega-lite/build/src/compile/projection/component.d.ts.map deleted file mode 100644 index 8538c4b..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/component.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/projection/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,UAAU,IAAI,YAAY,EAAC,MAAM,MAAM,CAAC;AAChD,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,qBAAa,mBAAoB,SAAQ,KAAK,CAAC,YAAY,CAAC;IAKjD,mBAAmB,EAAE,UAAU;IAC/B,IAAI,EAAE,SAAS,EAAE;IACjB,IAAI,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;IAN9B,MAAM,UAAS;gBAGpB,IAAI,EAAE,MAAM,EACL,mBAAmB,EAAE,UAAU,EAC/B,IAAI,EAAE,SAAS,EAAE,EACjB,IAAI,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;IAQrC;;OAEG;IACH,IAAW,KAAK,YAEf;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/component.js b/node_modules/vega-lite/build/src/compile/projection/component.js deleted file mode 100644 index 2613e4a..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/component.js +++ /dev/null @@ -1,19 +0,0 @@ -import { Split } from '../split'; -export class ProjectionComponent extends Split { - constructor(name, specifiedProjection, size, data) { - super(Object.assign({}, specifiedProjection), // all explicit properties of projection - { name } // name as initial implicit property - ); - this.specifiedProjection = specifiedProjection; - this.size = size; - this.data = data; - this.merged = false; - } - /** - * Whether the projection parameters should fit provided data. - */ - get isFit() { - return !!this.data; - } -} -//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/component.js.map b/node_modules/vega-lite/build/src/compile/projection/component.js.map deleted file mode 100644 index 4021f91..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/component.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/projection/component.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,MAAM,OAAO,mBAAoB,SAAQ,KAAmB;IAG1D,YACE,IAAY,EACL,mBAA+B,EAC/B,IAAiB,EACjB,IAA4B;QAEnC,KAAK,mBACC,mBAAmB,GAAG,wCAAwC;QAClE,EAAC,IAAI,EAAC,CAAC,oCAAoC;SAC5C,CAAC;QAPK,wBAAmB,GAAnB,mBAAmB,CAAY;QAC/B,SAAI,GAAJ,IAAI,CAAa;QACjB,SAAI,GAAJ,IAAI,CAAwB;QAN9B,WAAM,GAAG,KAAK,CAAC;IAYtB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/parse.d.ts b/node_modules/vega-lite/build/src/compile/projection/parse.d.ts deleted file mode 100644 index 5264b8e..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/parse.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Model } from '../model'; -export declare function parseProjection(model: Model): void; -//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/parse.d.ts.map b/node_modules/vega-lite/build/src/compile/projection/parse.d.ts.map deleted file mode 100644 index bd21cc6..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/parse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/projection/parse.ts"],"names":[],"mappings":"AAQA,OAAO,EAAc,KAAK,EAAC,MAAM,UAAU,CAAC;AAI5C,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,QAE3C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/parse.js b/node_modules/vega-lite/build/src/compile/projection/parse.js deleted file mode 100644 index 253ba33..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/parse.js +++ /dev/null @@ -1,127 +0,0 @@ -import { hasOwnProperty } from 'vega-util'; -import { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE } from '../../channel'; -import { getFieldOrDatumDef } from '../../channeldef'; -import { DataSourceType } from '../../data'; -import { PROJECTION_PROPERTIES } from '../../projection'; -import { GEOJSON } from '../../type'; -import { duplicate, every, stringify } from '../../util'; -import { isUnitModel } from '../model'; -import { ProjectionComponent } from './component'; -export function parseProjection(model) { - model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model); -} -function parseUnitProjection(model) { - var _a; - if (model.hasProjection) { - const proj = model.specifiedProjection; - const fit = !(proj && (proj.scale != null || proj.translate != null)); - const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined; - const data = fit ? gatherFitData(model) : undefined; - return new ProjectionComponent(model.projectionName(true), Object.assign(Object.assign({}, ((_a = model.config.projection) !== null && _a !== void 0 ? _a : {})), (proj !== null && proj !== void 0 ? proj : {})), size, data); - } - return undefined; -} -function gatherFitData(model) { - const data = []; - const { encoding } = model; - for (const posssiblePair of [ - [LONGITUDE, LATITUDE], - [LONGITUDE2, LATITUDE2] - ]) { - if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) { - data.push({ - signal: model.getName(`geojson_${data.length}`) - }); - } - } - if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) { - data.push({ - signal: model.getName(`geojson_${data.length}`) - }); - } - if (data.length === 0) { - // main source is geojson, so we can just use that - data.push(model.requestDataName(DataSourceType.Main)); - } - return data; -} -function mergeIfNoConflict(first, second) { - const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => { - // neither has the property - if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) { - return true; - } - // both have property and an equal value for property - if (hasOwnProperty(first.explicit, prop) && - hasOwnProperty(second.explicit, prop) && - // some properties might be signals or objects and require hashing for comparison - stringify(first.get(prop)) === stringify(second.get(prop))) { - return true; - } - return false; - }); - const size = stringify(first.size) === stringify(second.size); - if (size) { - if (allPropertiesShared) { - return first; - } - else if (stringify(first.explicit) === stringify({})) { - return second; - } - else if (stringify(second.explicit) === stringify({})) { - return first; - } - } - // if all properties don't match, let each unit spec have its own projection - return null; -} -function parseNonUnitProjections(model) { - if (model.children.length === 0) { - return undefined; - } - let nonUnitProjection; - // parse all children first - for (const child of model.children) { - parseProjection(child); - } - // analyze parsed projections, attempt to merge - const mergable = every(model.children, child => { - const projection = child.component.projection; - if (!projection) { - // child layer does not use a projection - return true; - } - else if (!nonUnitProjection) { - // cached 'projection' is null, cache this one - nonUnitProjection = projection; - return true; - } - else { - const merge = mergeIfNoConflict(nonUnitProjection, projection); - if (merge) { - nonUnitProjection = merge; - } - return !!merge; - } - }); - // if cached one and all other children share the same projection, - if (nonUnitProjection && mergable) { - // so we can elevate it to the layer level - const name = model.projectionName(true); - const modelProjection = new ProjectionComponent(name, nonUnitProjection.specifiedProjection, nonUnitProjection.size, duplicate(nonUnitProjection.data)); - // rename and assign all others as merged - for (const child of model.children) { - const projection = child.component.projection; - if (projection) { - if (projection.isFit) { - modelProjection.data.push(...child.component.projection.data); - } - child.renameProjection(projection.get('name'), name); - projection.merged = true; - } - } - return modelProjection; - } - return undefined; -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/projection/parse.js.map b/node_modules/vega-lite/build/src/compile/projection/parse.js.map deleted file mode 100644 index b59e930..0000000 --- a/node_modules/vega-lite/build/src/compile/projection/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,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,IAAI,UAAU,EAAE;gBACd,IAAI,UAAU,CAAC,KAAK,EAAE;oBACpB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;iBAC/D;gBACD,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;gBACrD,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC;aAC1B;SACF;QAED,OAAO,eAAe,CAAC;KACxB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/resolve.d.ts b/node_modules/vega-lite/build/src/compile/resolve.d.ts deleted file mode 100644 index 6a2c24e..0000000 --- a/node_modules/vega-lite/build/src/compile/resolve.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ScaleChannel } from '../channel'; -import { Resolve, ResolveMode } from '../resolve'; -import { Model } from './model'; -export declare function defaultScaleResolve(channel: ScaleChannel, model: Model): ResolveMode; -export declare function parseGuideResolve(resolve: Resolve, channel: ScaleChannel): ResolveMode; -//# sourceMappingURL=resolve.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/resolve.d.ts.map b/node_modules/vega-lite/build/src/compile/resolve.d.ts.map deleted file mode 100644 index b69ddc2..0000000 --- a/node_modules/vega-lite/build/src/compile/resolve.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/compile/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,YAAY,EAAC,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAChD,OAAO,EAA4C,KAAK,EAAC,MAAM,SAAS,CAAC;AAEzE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,WAAW,CAQpF;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,GAAG,WAAW,CAYtF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/resolve.js b/node_modules/vega-lite/build/src/compile/resolve.js deleted file mode 100644 index a2f80f8..0000000 --- a/node_modules/vega-lite/build/src/compile/resolve.js +++ /dev/null @@ -1,25 +0,0 @@ -import { isXorY } from '../channel'; -import * as log from '../log'; -import { isConcatModel, isFacetModel, isLayerModel } from './model'; -export function defaultScaleResolve(channel, model) { - if (isLayerModel(model) || isFacetModel(model)) { - return 'shared'; - } - else if (isConcatModel(model)) { - return isXorY(channel) ? 'independent' : 'shared'; - } - /* istanbul ignore next: should never reach here. */ - throw new Error('invalid model type for resolve'); -} -export function parseGuideResolve(resolve, channel) { - const channelScaleResolve = resolve.scale[channel]; - const guide = isXorY(channel) ? 'axis' : 'legend'; - if (channelScaleResolve === 'independent') { - if (resolve[guide][channel] === 'shared') { - log.warn(log.message.independentScaleMeansIndependentGuide(channel)); - } - return 'independent'; - } - return resolve[guide][channel] || 'shared'; -} -//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/resolve.js.map b/node_modules/vega-lite/build/src/compile/resolve.js.map deleted file mode 100644 index d60d1ef..0000000 --- a/node_modules/vega-lite/build/src/compile/resolve.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/compile/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAe,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAC,aAAa,EAAE,YAAY,EAAE,YAAY,EAAQ,MAAM,SAAS,CAAC;AAEzE,MAAM,UAAU,mBAAmB,CAAC,OAAqB,EAAE,KAAY;IACrE,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;QAC9C,OAAO,QAAQ,CAAC;KACjB;SAAM,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;QAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;KACnD;IACD,oDAAoD;IACpD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,OAAqB;IACvE,MAAM,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IAElD,IAAI,mBAAmB,KAAK,aAAa,EAAE;QACzC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;YACxC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,qCAAqC,CAAC,OAAO,CAAC,CAAC,CAAC;SACtE;QACD,OAAO,aAAa,CAAC;KACtB;IAED,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC;AAC7C,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/assemble.d.ts b/node_modules/vega-lite/build/src/compile/scale/assemble.d.ts deleted file mode 100644 index 0bd45a0..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/assemble.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ScaleChannel } from '../../channel'; -import { VgRange, VgScale } from '../../vega.schema'; -import { Model } from '../model'; -export declare function assembleScales(model: Model): VgScale[]; -export declare function assembleScalesForModel(model: Model): VgScale[]; -export declare function assembleScaleRange(scaleRange: VgRange, scaleName: string, channel: ScaleChannel, model?: Model): VgRange; -//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/assemble.d.ts.map b/node_modules/vega-lite/build/src/compile/scale/assemble.d.ts.map deleted file mode 100644 index 8415bbd..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/assemble.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/assemble.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,YAAY,EAAC,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAiC,OAAO,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAA8B,KAAK,EAAC,MAAM,UAAU,CAAC;AAI5D,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,CAWtD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,CA+B9D;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,OAAO,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,YAAY,EACrB,KAAK,CAAC,EAAE,KAAK,GACZ,OAAO,CAgBT"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/assemble.js b/node_modules/vega-lite/build/src/compile/scale/assemble.js deleted file mode 100644 index 225a03c..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/assemble.js +++ /dev/null @@ -1,57 +0,0 @@ -import { __rest } from "tslib"; -import { isObject } from 'vega-util'; -import { isXorY } from '../../channel'; -import { keys } from '../../util'; -import { isDataRefDomain, isVgRangeStep } from '../../vega.schema'; -import { isConcatModel, isLayerModel } from '../model'; -import { assembleSelectionScaleDomain } from '../selection/assemble'; -import { assembleDomain } from './domain'; -export function assembleScales(model) { - if (isLayerModel(model) || isConcatModel(model)) { - // For concat and layer, include scales of children too - return model.children.reduce((scales, child) => { - return scales.concat(assembleScales(child)); - }, assembleScalesForModel(model)); - } - else { - // For facet, child scales would not be included in the parent's scope. - // For unit, there is no child. - return assembleScalesForModel(model); - } -} -export function assembleScalesForModel(model) { - return keys(model.component.scales).reduce((scales, channel) => { - const scaleComponent = model.component.scales[channel]; - if (scaleComponent.merged) { - // Skipped merged scales - return scales; - } - const scale = scaleComponent.combine(); - const { name, type, selectionExtent, domains: _d, range: _r, reverse } = scale, otherScaleProps = __rest(scale, ["name", "type", "selectionExtent", "domains", "range", "reverse"]); - const range = assembleScaleRange(scale.range, name, channel, model); - let domainRaw; - if (selectionExtent) { - domainRaw = assembleSelectionScaleDomain(model, selectionExtent); - } - const domain = assembleDomain(model, channel); - scales.push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name, - type }, (domain ? { domain } : {})), (domainRaw ? { domainRaw } : {})), { range }), (reverse !== undefined ? { reverse: reverse } : {})), otherScaleProps)); - return scales; - }, []); -} -export function assembleScaleRange(scaleRange, scaleName, channel, model) { - // add signals to x/y range - if (isXorY(channel)) { - if (isVgRangeStep(scaleRange)) { - // For width/height step, use a signal created in layout assemble instead of a constant step. - return { - step: { signal: scaleName + '_step' } - }; - } - } - else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) { - return Object.assign(Object.assign({}, scaleRange), { data: model.lookupDataSource(scaleRange.data) }); - } - return scaleRange; -} -//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/assemble.js.map b/node_modules/vega-lite/build/src/compile/scale/assemble.js.map deleted file mode 100644 index fb197d5..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/assemble.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/scale/assemble.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAC,MAAM,EAAe,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,eAAe,EAAE,aAAa,EAAmB,MAAM,m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E,OAAO,EAAE,KAAK,CAAC,CAAC;QAEpE,IAAI,SAAS,CAAC;QACd,IAAI,eAAe,EAAE;YACnB,SAAS,GAAG,4BAA4B,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;SAClE;QAED,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAE9C,MAAM,CAAC,IAAI,yEACT,IAAI;YACJ,IAAI,IACD,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACxB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAC,SAAS,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KACjC,KAAK,KACF,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,OAAO,EAAE,OAAc,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACxD,eAAe,EAClB,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,EAAe,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,UAAmB,EACnB,SAAiB,EACjB,OAAqB,EACrB,KAAa;IAEb,2BAA2B;IAC3B,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE;QACnB,IAAI,aAAa,CAAC,UAAU,CAAC,EAAE;YAC7B,6FAA6F;YAC7F,OAAO;gBACL,IAAI,EAAE,EAAC,MAAM,EAAE,SAAS,GAAG,OAAO,EAAC;aACpC,CAAC;SACH;KACF;SAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE;QAC9D,uCACK,UAAU,KACb,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,IAC7C;KACH;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/component.d.ts b/node_modules/vega-lite/build/src/compile/scale/component.d.ts deleted file mode 100644 index 505f750..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/component.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { SignalRef } from 'vega'; -import { ScaleChannel } from '../../channel'; -import { Scale, ScaleType } from '../../scale'; -import { SelectionExtent } from '../../selection'; -import { VgNonUnionDomain, VgScale } from '../../vega.schema'; -import { Explicit, Split } from '../split'; -/** - * All VgDomain property except domain. - * (We exclude domain as we have a special "domains" array that allow us merge them all at once in assemble.) - */ -export declare type ScaleComponentProps = Omit & { - domains: VgNonUnionDomain[]; - selectionExtent?: SelectionExtent; - reverse?: boolean | SignalRef; -}; -export declare type Range = ScaleComponentProps['range']; -export declare class ScaleComponent extends Split { - merged: boolean; - constructor(name: string, typeWithExplicit: Explicit); - /** - * Whether the scale definitely includes zero in the domain - */ - domainDefinitelyIncludesZero(): boolean; -} -export declare type ScaleComponentIndex = Partial>; -export declare type ScaleIndex = Partial>; -//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/component.d.ts.map b/node_modules/vega-lite/build/src/compile/scale/component.d.ts.map deleted file mode 100644 index 8d4c10f..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/component.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,UAAU,CAAC;AAEzC;;;GAGG;AACH,oBAAY,mBAAmB,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC,GAAG;IACpF,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,oBAAY,KAAK,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAEjD,qBAAa,cAAe,SAAQ,KAAK,CAAC,mBAAmB,CAAC;IACrD,MAAM,UAAS;gBAEV,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,CAAC,SAAS,CAAC;IAQ/D;;OAEG;IACI,4BAA4B;CAMpC;AAED,oBAAY,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;AAEhF,oBAAY,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/component.js b/node_modules/vega-lite/build/src/compile/scale/component.js deleted file mode 100644 index cc9bcaa..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/component.js +++ /dev/null @@ -1,22 +0,0 @@ -import { isArray } from 'vega-util'; -import { some } from '../../util'; -import { Split } from '../split'; -export class ScaleComponent extends Split { - constructor(name, typeWithExplicit) { - super({}, // no initial explicit property - { name } // name as initial implicit property - ); - this.merged = false; - this.setWithExplicit('type', typeWithExplicit); - } - /** - * Whether the scale definitely includes zero in the domain - */ - domainDefinitelyIncludesZero() { - if (this.get('zero') !== false) { - return true; - } - return some(this.get('domains'), d => isArray(d) && d.length === 2 && d[0] <= 0 && d[1] >= 0); - } -} -//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/component.js.map b/node_modules/vega-lite/build/src/compile/scale/component.js.map deleted file mode 100644 index fd6f03c..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/component.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/scale/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAIlC,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhC,OAAO,EAAW,KAAK,EAAC,MAAM,UAAU,CAAC;AAczC,MAAM,OAAO,cAAe,SAAQ,KAA0B;IAG5D,YAAY,IAAY,EAAE,gBAAqC;QAC7D,KAAK,CACH,EAAE,EAAE,+BAA+B;QACnC,EAAC,IAAI,EAAC,CAAC,oCAAoC;SAC5C,CAAC;QANG,WAAM,GAAG,KAAK,CAAC;QAOpB,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACI,4BAA4B;QACjC,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE;YAC9B,OAAO,IAAI,CAAC;SACb;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAChG,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/domain.d.ts b/node_modules/vega-lite/build/src/compile/scale/domain.d.ts deleted file mode 100644 index 868dbaf..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/domain.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { SignalRef } from 'vega'; -import { ScaleChannel } from '../../channel'; -import { TypedFieldDef } from '../../channeldef'; -import { ScaleType } from '../../scale'; -import { VgDomain, VgNonUnionDomain, VgSortField } from '../../vega.schema'; -import { Model } from '../model'; -import { Explicit } from '../split'; -import { UnitModel } from '../unit'; -export declare function parseScaleDomain(model: Model): void; -export declare function parseDomainForChannel(model: UnitModel, channel: ScaleChannel): Explicit; -export declare function domainSort(model: UnitModel, channel: ScaleChannel, scaleType: ScaleType): undefined | true | VgSortField; -/** - * Determine if a scale can use unaggregated domain. - * @return {Boolean} Returns true if all of the following conditions apply: - * 1. `scale.domain` is `unaggregated` - * 2. Aggregation function is not `count` or `sum` - * 3. The scale is quantitative or time scale. - */ -export declare function canUseUnaggregatedDomain(fieldDef: TypedFieldDef, scaleType: ScaleType): { - valid: boolean; - reason?: string; -}; -/** - * Converts an array of domains to a single Vega scale domain. - */ -export declare function mergeDomains(domains: VgNonUnionDomain[]): VgDomain; -/** - * Return a field if a scale uses a single field. - * Return `undefined` otherwise. - */ -export declare function getFieldFromDomain(domain: VgDomain): string; -export declare function assembleDomain(model: Model, channel: ScaleChannel): SignalRef | (import("vega").ScaleDataRef & { - sort?: VgSortField; -}) | (import("vega").ScaleMultiDataRef & { - sort?: VgSortField; -}) | (import("vega").ScaleMultiFieldsRef & { - sort?: VgSortField; -}) | (string | number | boolean | SignalRef)[]; -//# sourceMappingURL=domain.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/domain.d.ts.map b/node_modules/vega-lite/build/src/compile/scale/domain.d.ts.map deleted file mode 100644 index a03ff7f..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/domain.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAW/B,OAAO,EAA2C,YAAY,EAAC,MAAM,eAAe,CAAC;AACrF,OAAO,EAQL,aAAa,EAGd,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAA+E,SAAS,EAAC,MAAM,aAAa,CAAC;AAMpH,OAAO,EAKL,QAAQ,EAER,gBAAgB,EAEhB,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAA4B,KAAK,EAAC,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAC,QAAQ,EAAsD,MAAM,UAAU,CAAC;AACvF,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGlC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,QAM5C;AAsGD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,GAAG,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CA4C3G;AAoND,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,SAAS,GACnB,SAAS,GAAG,IAAI,GAAG,WAAW,CAgEhC;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,EAC/B,SAAS,EAAE,SAAS,GACnB;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAC,CA2BnC;AAkBD;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,QAAQ,CAyGlE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAwB3D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY;;;;;;+CAgBjE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/domain.js b/node_modules/vega-lite/build/src/compile/scale/domain.js deleted file mode 100644 index d2a64d1..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/domain.js +++ /dev/null @@ -1,531 +0,0 @@ -import { __rest } from "tslib"; -import { isObject, isString } from 'vega-util'; -import { isAggregateOp, isArgmaxDef, isArgminDef, MULTIDOMAIN_SORT_OP_INDEX as UNIONDOMAIN_SORT_OP_INDEX, SHARED_DOMAIN_OP_INDEX } from '../../aggregate'; -import { isBinning, isBinParams, isSelectionExtent } from '../../bin'; -import { getSecondaryRangeChannel, isScaleChannel } from '../../channel'; -import { binRequiresRange, getFieldOrDatumDef, hasBand, isDatumDef, isFieldDef, valueExpr, vgField } from '../../channeldef'; -import { DataSourceType } from '../../data'; -import * as log from '../../log'; -import { hasDiscreteDomain, isDomainUnionWith, isSelectionDomain } from '../../scale'; -import { DEFAULT_SORT_OP, isSortArray, isSortByEncoding, isSortField } from '../../sort'; -import { normalizeTimeUnit } from '../../timeunit'; -import * as util from '../../util'; -import { isDataRefDomain, isDataRefUnionedDomain, isFieldRefUnionDomain, isSignalRef } from '../../vega.schema'; -import { getBinSignalName } from '../data/bin'; -import { sortArrayIndexField } from '../data/calculate'; -import { FACET_SCALE_PREFIX } from '../data/optimize'; -import { isFacetModel, isUnitModel } from '../model'; -import { SignalRefWrapper } from '../signal'; -import { makeExplicit, makeImplicit, mergeValuesWithExplicit } from '../split'; -export function parseScaleDomain(model) { - if (isUnitModel(model)) { - parseUnitScaleDomain(model); - } - else { - parseNonUnitScaleDomain(model); - } -} -function parseUnitScaleDomain(model) { - const localScaleComponents = model.component.scales; - for (const channel of util.keys(localScaleComponents)) { - const domains = parseDomainForChannel(model, channel); - const localScaleCmpt = localScaleComponents[channel]; - localScaleCmpt.setWithExplicit('domains', domains); - parseSelectionDomain(model, channel); - if (model.component.data.isFaceted) { - // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not - let facetParent = model; - while (!isFacetModel(facetParent) && facetParent.parent) { - facetParent = facetParent.parent; - } - const resolve = facetParent.component.resolve.scale[channel]; - if (resolve === 'shared') { - for (const domain of domains.value) { - // Replace the scale domain with data output from a cloned subtree after the facet. - if (isDataRefDomain(domain)) { - // use data from cloned subtree (which is the same as data but with a prefix added once) - domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, ''); - } - } - } - } - } -} -function parseNonUnitScaleDomain(model) { - for (const child of model.children) { - parseScaleDomain(child); - } - const localScaleComponents = model.component.scales; - for (const channel of util.keys(localScaleComponents)) { - let domains; - let selectionExtent = null; - for (const child of model.children) { - const childComponent = child.component.scales[channel]; - if (childComponent) { - if (domains === undefined) { - domains = childComponent.getWithExplicit('domains'); - } - else { - domains = mergeValuesWithExplicit(domains, childComponent.getWithExplicit('domains'), 'domains', 'scale', domainsTieBreaker); - } - const se = childComponent.get('selectionExtent'); - if (selectionExtent && se && selectionExtent.selection !== se.selection) { - log.warn(log.message.NEEDS_SAME_SELECTION); - } - selectionExtent = se; - } - } - localScaleComponents[channel].setWithExplicit('domains', domains); - if (selectionExtent) { - localScaleComponents[channel].set('selectionExtent', selectionExtent, true); - } - } -} -/** - * Remove unaggregated domain if it is not applicable - * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true. - */ -function normalizeUnaggregatedDomain(domain, fieldDef, scaleType, scaleConfig) { - if (domain === 'unaggregated') { - const { valid, reason } = canUseUnaggregatedDomain(fieldDef, scaleType); - if (!valid) { - log.warn(reason); - return undefined; - } - } - else if (domain === undefined && scaleConfig.useUnaggregatedDomain) { - // Apply config if domain is not specified. - const { valid } = canUseUnaggregatedDomain(fieldDef, scaleType); - if (valid) { - return 'unaggregated'; - } - } - return domain; -} -export function parseDomainForChannel(model, channel) { - const scaleType = model.getScaleComponent(channel).get('type'); - const { encoding } = model; - const domain = normalizeUnaggregatedDomain(model.scaleDomain(channel), model.typedFieldDef(channel), scaleType, model.config.scale); - if (domain !== model.scaleDomain(channel)) { - model.specifiedScales[channel] = Object.assign(Object.assign({}, model.specifiedScales[channel]), { domain }); - } - // If channel is either X or Y then union them with X2 & Y2 if they exist - if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) { - if (getFieldOrDatumDef(encoding.x)) { - return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'x'), parseSingleChannelDomain(scaleType, domain, model, 'x2'), 'domain', 'scale', domainsTieBreaker); - } - else { - return parseSingleChannelDomain(scaleType, domain, model, 'x2'); - } - } - else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) { - if (getFieldOrDatumDef(encoding.y)) { - return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'y'), parseSingleChannelDomain(scaleType, domain, model, 'y2'), 'domain', 'scale', domainsTieBreaker); - } - else { - return parseSingleChannelDomain(scaleType, domain, model, 'y2'); - } - } - return parseSingleChannelDomain(scaleType, domain, model, channel); -} -function mapDomainToDataSignal(domain, type, timeUnit) { - return domain.map(v => { - const data = valueExpr(v, { timeUnit, type }); - return { signal: `{data: ${data}}` }; - }); -} -function convertDomainIfItIsDateTime(domain, type, timeUnit) { - var _a; - // explicit value - const normalizedTimeUnit = (_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit; - if (type === 'temporal' || normalizedTimeUnit) { - return mapDomainToDataSignal(domain, type, normalizedTimeUnit); - } - return [domain]; // Date time won't make sense -} -function parseSingleChannelDomain(scaleType, domain, model, channel) { - const { encoding } = model; - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - const { type } = fieldOrDatumDef; - const timeUnit = fieldOrDatumDef['timeUnit']; - if (isDomainUnionWith(domain)) { - const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel); - const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit); - return makeExplicit([...defaultDomain.value, ...unionWith]); - } - else if (isSignalRef(domain)) { - return makeExplicit([domain]); - } - else if (domain && domain !== 'unaggregated' && !isSelectionDomain(domain)) { - return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit)); - } - const stack = model.stack; - if (stack && channel === stack.fieldChannel) { - if (stack.offset === 'normalize') { - return makeImplicit([[0, 1]]); - } - const data = model.requestDataName(DataSourceType.Main); - return makeImplicit([ - { - data, - field: model.vgField(channel, { suffix: 'start' }) - }, - { - data, - field: model.vgField(channel, { suffix: 'end' }) - } - ]); - } - const sort = isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined; - if (isDatumDef(fieldOrDatumDef)) { - const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit); - return makeImplicit(d); - } - const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef - if (domain === 'unaggregated') { - const data = model.requestDataName(DataSourceType.Main); - const { field } = fieldOrDatumDef; - return makeImplicit([ - { - data, - field: vgField({ field, aggregate: 'min' }) - }, - { - data, - field: vgField({ field, aggregate: 'max' }) - } - ]); - } - else if (isBinning(fieldDef.bin)) { - if (hasDiscreteDomain(scaleType)) { - if (scaleType === 'bin-ordinal') { - // we can omit the domain as it is inferred from the `bins` property - return makeImplicit([]); - } - // ordinal bin scale takes domain from bin_range, ordered by bin start - // This is useful for both axis-based scale (x/y) and legend-based scale (other channels). - return makeImplicit([ - { - // If sort by aggregation of a specified sort field, we need to use RAW table, - // so we can aggregate values for the scale independently from the main aggregation. - data: util.isBoolean(sort) - ? model.requestDataName(DataSourceType.Main) - : model.requestDataName(DataSourceType.Raw), - // Use range if we added it and the scale does not support computing a range as a signal. - field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? { binSuffix: 'range' } : {}), - // we have to use a sort object if sort = true to make the sort correct by bin start - sort: sort === true || !isObject(sort) - ? { - field: model.vgField(channel, {}), - op: 'min' // min or max doesn't matter since we sort by the start of the bin range - } - : sort - } - ]); - } - else { - // continuous scales - const { bin } = fieldDef; - if (isBinning(bin)) { - const binSignal = getBinSignalName(model, fieldDef.field, bin); - return makeImplicit([ - new SignalRefWrapper(() => { - const signal = model.getSignalName(binSignal); - return `[${signal}.start, ${signal}.stop]`; - }) - ]); - } - else { - return makeImplicit([ - { - data: model.requestDataName(DataSourceType.Main), - field: model.vgField(channel, {}) - } - ]); - } - } - } - else if (fieldDef.timeUnit && - util.contains(['time', 'utc'], scaleType) && - hasBand(channel, fieldDef, isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined, model.stack, model.markDef, model.config)) { - const data = model.requestDataName(DataSourceType.Main); - return makeImplicit([ - { - data, - field: model.vgField(channel) - }, - { - data, - field: model.vgField(channel, { suffix: 'end' }) - } - ]); - } - else if (sort) { - return makeImplicit([ - { - // If sort by aggregation of a specified sort field, we need to use RAW table, - // so we can aggregate values for the scale independently from the main aggregation. - data: util.isBoolean(sort) - ? model.requestDataName(DataSourceType.Main) - : model.requestDataName(DataSourceType.Raw), - field: model.vgField(channel), - sort: sort - } - ]); - } - else { - return makeImplicit([ - { - data: model.requestDataName(DataSourceType.Main), - field: model.vgField(channel) - } - ]); - } -} -function normalizeSortField(sort, isStackedMeasure) { - const { op, field, order } = sort; - return Object.assign(Object.assign({ - // Apply default op - op: op !== null && op !== void 0 ? op : (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP) }, (field ? { field: util.replacePathInField(field) } : {})), (order ? { order } : {})); -} -function parseSelectionDomain(model, channel) { - var _a; - const scale = model.component.scales[channel]; - const spec = model.specifiedScales[channel].domain; - const bin = (_a = model.fieldDef(channel)) === null || _a === void 0 ? void 0 : _a.bin; - const domain = isSelectionDomain(spec) && spec; - const extent = isBinParams(bin) && isSelectionExtent(bin.extent) && bin.extent; - if (domain || extent) { - // As scale parsing occurs before selection parsing, we cannot set - // domainRaw directly. So instead, we store the selectionExtent on - // the scale component, and then add domainRaw during scale assembly. - scale.set('selectionExtent', domain !== null && domain !== void 0 ? domain : extent, true); - } -} -export function domainSort(model, channel, scaleType) { - if (!hasDiscreteDomain(scaleType)) { - return undefined; - } - // save to cast as the only exception is the geojson type for shape, which would not generate a scale - const fieldDef = model.fieldDef(channel); - const sort = fieldDef.sort; - // if the sort is specified with array, use the derived sort index field - if (isSortArray(sort)) { - return { - op: 'min', - field: sortArrayIndexField(fieldDef, channel), - order: 'ascending' - }; - } - const { stack } = model; - const stackDimensions = stack - ? [...(stack.groupbyField ? [stack.groupbyField] : []), ...stack.stackBy.map(s => s.fieldDef.field)] - : undefined; - // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale) - if (isSortField(sort)) { - const isStackedMeasure = stack && !util.contains(stackDimensions, sort.field); - return normalizeSortField(sort, isStackedMeasure); - } - else if (isSortByEncoding(sort)) { - const { encoding, order } = sort; - const fieldDefToSortBy = model.fieldDef(encoding); - const { aggregate, field } = fieldDefToSortBy; - const isStackedMeasure = stack && !util.contains(stackDimensions, field); - if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { - return normalizeSortField({ - field: vgField(fieldDefToSortBy), - order - }, isStackedMeasure); - } - else if (isAggregateOp(aggregate) || !aggregate) { - return normalizeSortField({ - op: aggregate, - field, - order - }, isStackedMeasure); - } - } - else if (sort === 'descending') { - return { - op: 'min', - field: model.vgField(channel), - order: 'descending' - }; - } - else if (util.contains(['ascending', undefined /* default =ascending*/], sort)) { - return true; - } - // sort == null - return undefined; -} -/** - * Determine if a scale can use unaggregated domain. - * @return {Boolean} Returns true if all of the following conditions apply: - * 1. `scale.domain` is `unaggregated` - * 2. Aggregation function is not `count` or `sum` - * 3. The scale is quantitative or time scale. - */ -export function canUseUnaggregatedDomain(fieldDef, scaleType) { - const { aggregate, type } = fieldDef; - if (!aggregate) { - return { - valid: false, - reason: log.message.unaggregateDomainHasNoEffectForRawField(fieldDef) - }; - } - if (isString(aggregate) && !SHARED_DOMAIN_OP_INDEX[aggregate]) { - return { - valid: false, - reason: log.message.unaggregateDomainWithNonSharedDomainOp(aggregate) - }; - } - if (type === 'quantitative') { - if (scaleType === 'log') { - return { - valid: false, - reason: log.message.unaggregatedDomainWithLogScale(fieldDef) - }; - } - } - return { valid: true }; -} -/** - * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values. - */ -function domainsTieBreaker(v1, v2, property, propertyOf) { - if (v1.explicit && v2.explicit) { - log.warn(log.message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value)); - } - // If equal score, concat the domains so that we union them later. - return { explicit: v1.explicit, value: [...v1.value, ...v2.value] }; -} -/** - * Converts an array of domains to a single Vega scale domain. - */ -export function mergeDomains(domains) { - const uniqueDomains = util.unique(domains.map(domain => { - // ignore sort property when computing the unique domains - if (isDataRefDomain(domain)) { - const { sort: _s } = domain, domainWithoutSort = __rest(domain, ["sort"]); - return domainWithoutSort; - } - return domain; - }), util.hash); - const sorts = util.unique(domains - .map(d => { - if (isDataRefDomain(d)) { - const s = d.sort; - if (s !== undefined && !util.isBoolean(s)) { - if ('op' in s && s.op === 'count') { - // let's make sure that if op is count, we don't use a field - delete s.field; - } - if (s.order === 'ascending') { - // drop order: ascending as it is the default - delete s.order; - } - } - return s; - } - return undefined; - }) - .filter(s => s !== undefined), util.hash); - if (uniqueDomains.length === 0) { - return undefined; - } - else if (uniqueDomains.length === 1) { - const domain = domains[0]; - if (isDataRefDomain(domain) && sorts.length > 0) { - let sort = sorts[0]; - if (sorts.length > 1) { - log.warn(log.message.MORE_THAN_ONE_SORT); - sort = true; - } - else { - // Simplify domain sort by removing field and op when the field is the same as the domain field. - if (isObject(sort) && 'field' in sort) { - const sortField = sort.field; - if (domain.field === sortField) { - sort = sort.order ? { order: sort.order } : true; - } - } - } - return Object.assign(Object.assign({}, domain), { sort }); - } - return domain; - } - // only keep sort properties that work with unioned domains - const unionDomainSorts = util.unique(sorts.map(s => { - if (util.isBoolean(s) || !('op' in s) || s.op in UNIONDOMAIN_SORT_OP_INDEX) { - return s; - } - log.warn(log.message.domainSortDropped(s)); - return true; - }), util.hash); - let sort; - if (unionDomainSorts.length === 1) { - sort = unionDomainSorts[0]; - } - else if (unionDomainSorts.length > 1) { - log.warn(log.message.MORE_THAN_ONE_SORT); - sort = true; - } - const allData = util.unique(domains.map(d => { - if (isDataRefDomain(d)) { - return d.data; - } - return null; - }), x => x); - if (allData.length === 1 && allData[0] !== null) { - // create a union domain of different fields with a single data source - const domain = Object.assign({ data: allData[0], fields: uniqueDomains.map(d => d.field) }, (sort ? { sort } : {})); - return domain; - } - return Object.assign({ fields: uniqueDomains }, (sort ? { sort } : {})); -} -/** - * Return a field if a scale uses a single field. - * Return `undefined` otherwise. - */ -export function getFieldFromDomain(domain) { - if (isDataRefDomain(domain) && isString(domain.field)) { - return domain.field; - } - else if (isDataRefUnionedDomain(domain)) { - let field; - for (const nonUnionDomain of domain.fields) { - if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) { - if (!field) { - field = nonUnionDomain.field; - } - else if (field !== nonUnionDomain.field) { - log.warn(log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES); - return field; - } - } - } - log.warn(log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES); - return field; - } - else if (isFieldRefUnionDomain(domain)) { - log.warn(log.message.FACETED_INDEPENDENT_SAME_SOURCE); - const field = domain.fields[0]; - return isString(field) ? field : undefined; - } - return undefined; -} -export function assembleDomain(model, channel) { - const scaleComponent = model.component.scales[channel]; - const domains = scaleComponent.get('domains').map((domain) => { - // Correct references to data as the original domain's data was determined - // in parseScale, which happens before parseData. Thus the original data - // reference can be incorrect. - if (isDataRefDomain(domain)) { - domain.data = model.lookupDataSource(domain.data); - } - return domain; - }); - // domains is an array that has to be merged into a single vega domain - return mergeDomains(domains); -} -//# sourceMappingURL=domain.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/domain.js.map b/node_modules/vega-lite/build/src/compile/scale/domain.js.map deleted file mode 100644 index 179a103..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/domain.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../../src/compile/scale/domain.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,yBAAyB,IAAI,yBAAyB,EAEtD,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAC,MAAM,WA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I,CAAC,CAAC;SACnD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,sEAAsE;IACtE,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/parse.d.ts b/node_modules/vega-lite/build/src/compile/scale/parse.d.ts deleted file mode 100644 index 7bf92f9..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/parse.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Model } from '../model'; -export declare function parseScales(model: Model, { ignoreRange }?: { - ignoreRange?: boolean; -}): void; -export declare function parseScaleCore(model: Model): void; -//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/parse.d.ts.map b/node_modules/vega-lite/build/src/compile/scale/parse.d.ts.map deleted file mode 100644 index 07d5547..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/parse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/parse.ts"],"names":[],"mappings":"AAYA,OAAO,EAAc,KAAK,EAAC,MAAM,UAAU,CAAC;AAS5C,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,EAAC,WAAW,EAAC,GAAE;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAM,QAUpF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,QAM1C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/parse.js b/node_modules/vega-lite/build/src/compile/scale/parse.js deleted file mode 100644 index 97ceba2..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/parse.js +++ /dev/null @@ -1,107 +0,0 @@ -import { SCALE_CHANNELS, SHAPE } from '../../channel'; -import { getFieldOrDatumDef } from '../../channeldef'; -import { GEOSHAPE } from '../../mark'; -import { NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES, scaleCompatible, scaleTypePrecedence } from '../../scale'; -import { GEOJSON } from '../../type'; -import { keys } from '../../util'; -import { isUnitModel } from '../model'; -import { defaultScaleResolve } from '../resolve'; -import { mergeValuesWithExplicit, tieBreakByComparing } from '../split'; -import { ScaleComponent } from './component'; -import { parseScaleDomain } from './domain'; -import { parseScaleProperty, parseScaleRange } from './properties'; -import { scaleType } from './type'; -export function parseScales(model, { ignoreRange } = {}) { - parseScaleCore(model); - parseScaleDomain(model); - for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) { - parseScaleProperty(model, prop); - } - if (!ignoreRange) { - // range depends on zero - parseScaleRange(model); - } -} -export function parseScaleCore(model) { - if (isUnitModel(model)) { - model.component.scales = parseUnitScaleCore(model); - } - else { - model.component.scales = parseNonUnitScaleCore(model); - } -} -/** - * Parse scales for all channels of a model. - */ -function parseUnitScaleCore(model) { - const { encoding, mark } = model; - return SCALE_CHANNELS.reduce((scaleComponents, channel) => { - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); // must be typed def to have scale - // Don't generate scale for shape of geoshape - if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) { - return scaleComponents; - } - let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale']; - if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) { - specifiedScale = specifiedScale !== null && specifiedScale !== void 0 ? specifiedScale : {}; - const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, mark); - scaleComponents[channel] = new ScaleComponent(model.scaleName(channel + '', true), { - value: sType, - explicit: specifiedScale.type === sType - }); - } - return scaleComponents; - }, {}); -} -const scaleTypeTieBreaker = tieBreakByComparing((st1, st2) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2)); -function parseNonUnitScaleCore(model) { - var _a; - const scaleComponents = (model.component.scales = {}); - const scaleTypeWithExplicitIndex = {}; - const resolve = model.component.resolve; - // Parse each child scale and determine if a particular channel can be merged. - for (const child of model.children) { - parseScaleCore(child); - // Instead of always merging right away -- check if it is compatible to merge first! - for (const channel of keys(child.component.scales)) { - // if resolve is undefined, set default first - resolve.scale[channel] = (_a = resolve.scale[channel]) !== null && _a !== void 0 ? _a : defaultScaleResolve(channel, model); - if (resolve.scale[channel] === 'shared') { - const explicitScaleType = scaleTypeWithExplicitIndex[channel]; - const childScaleType = child.component.scales[channel].getWithExplicit('type'); - if (explicitScaleType) { - if (scaleCompatible(explicitScaleType.value, childScaleType.value)) { - // merge scale component if type are compatible - scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(explicitScaleType, childScaleType, 'type', 'scale', scaleTypeTieBreaker); - } - else { - // Otherwise, update conflicting channel to be independent - resolve.scale[channel] = 'independent'; - // Remove from the index so they don't get merged - delete scaleTypeWithExplicitIndex[channel]; - } - } - else { - scaleTypeWithExplicitIndex[channel] = childScaleType; - } - } - } - } - // Merge each channel listed in the index - for (const channel of keys(scaleTypeWithExplicitIndex)) { - // Create new merged scale component - const name = model.scaleName(channel, true); - const typeWithExplicit = scaleTypeWithExplicitIndex[channel]; - scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit); - // rename each child and mark them as merged - for (const child of model.children) { - const childScale = child.component.scales[channel]; - if (childScale) { - child.renameScale(childScale.get('name'), name); - childScale.merged = true; - } - } - } - return scaleComponents; -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/parse.js.map b/node_modules/vega-lite/build/src/compile/scale/parse.js.map deleted file mode 100644 index 9124d0b..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/scale/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,cAAc,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAA+B,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAC,QAAQ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,OAAO,IAAI,IAAI,CAAC,0BAA0B,CAAC,EAAE;QACtD,oCAAoC;QACpC,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5C,MAAM,gBAAgB,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;QAC7D,eAAe,CAAC,OAAO,CAAC,GAAG,IAAI,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAEtE,4CAA4C;QAC5C,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE;YAClC,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACnD,IAAI,UAAU,EAAE;gBACd,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;gBAChD,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC;aAC1B;SACF;KACF;IAED,OAAO,eAAe,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/properties.d.ts b/node_modules/vega-lite/build/src/compile/scale/properties.d.ts deleted file mode 100644 index 63616a9..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/properties.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { SignalRef, TimeInterval } from 'vega'; -import { ScaleChannel } from '../../channel'; -import { ScaleDatumDef, ScaleFieldDef, TypedFieldDef } from '../../channeldef'; -import { Config } from '../../config'; -import { Mark, MarkDef, RectConfig } from '../../mark'; -import { Domain, Scale, ScaleConfig, ScaleType } from '../../scale'; -import { Sort } from '../../sort'; -import { Type } from '../../type'; -import { Model } from '../model'; -import { SignalRefWrapper } from '../signal'; -import { ScaleComponentProps } from './component'; -export declare function parseScaleProperty(model: Model, property: Exclude): void; -export interface ScaleRuleParams { - model: Model; - channel: ScaleChannel; - fieldOrDatumDef: ScaleFieldDef | ScaleDatumDef; - scaleType: ScaleType; - scalePadding: number | SignalRef; - scalePaddingInner: number | SignalRef; - domain: Scale['domain']; - markDef: MarkDef; - config: Config; -} -export declare const scaleRules: { - [k in keyof Scale]?: (params: ScaleRuleParams) => Scale[k]; -}; -export declare function parseScaleRange(model: Model): void; -export declare function parseNonUnitScaleProperty(model: Model, property: keyof (Scale | ScaleComponentProps)): void; -export declare function bins(model: Model, fieldDef: TypedFieldDef): SignalRefWrapper | { - step: number; -}; -export declare function interpolate(channel: ScaleChannel, type: Type): Scale['interpolate']; -export declare function nice(scaleType: ScaleType, channel: ScaleChannel, fieldOrDatumDef: TypedFieldDef | ScaleDatumDef): boolean | TimeInterval; -export declare function padding(channel: ScaleChannel, scaleType: ScaleType, scaleConfig: ScaleConfig, fieldOrDatumDef: TypedFieldDef | ScaleDatumDef, markDef: MarkDef, barConfig: RectConfig): number | SignalRef; -export declare function paddingInner(paddingValue: number | SignalRef, channel: ScaleChannel, mark: Mark, scaleConfig: ScaleConfig): number | SignalRef; -export declare function paddingOuter(paddingValue: number | SignalRef, channel: ScaleChannel, scaleType: ScaleType, mark: Mark, paddingInnerValue: number | SignalRef, scaleConfig: ScaleConfig): number | { - signal: string; -}; -export declare function reverse(scaleType: ScaleType, sort: Sort, channel: ScaleChannel, scaleConfig: ScaleConfig): boolean | SignalRef; -export declare function zero(channel: ScaleChannel, fieldDef: TypedFieldDef | ScaleDatumDef, specifiedDomain: Domain, markDef: MarkDef, scaleType: ScaleType): boolean; -//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/properties.d.ts.map b/node_modules/vega-lite/build/src/compile/scale/properties.d.ts.map deleted file mode 100644 index 617e105..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/properties.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAA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hH;AAED,wBAAgB,IAAI,CAClB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,aAAa,EAC/C,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,WA6CrB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/properties.js b/node_modules/vega-lite/build/src/compile/scale/properties.js deleted file mode 100644 index a98917f..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/properties.js +++ /dev/null @@ -1,282 +0,0 @@ -import { isArray } from 'vega-util'; -import { isBinned, isBinning, isBinParams } from '../../bin'; -import { COLOR, FILL, POLAR_POSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNEL_INDEX, STROKE } from '../../channel'; -import { getFieldDef, getFieldOrDatumDef, isFieldDef, valueExpr } from '../../channeldef'; -import { isDateTime } from '../../datetime'; -import * as log from '../../log'; -import { channelScalePropertyIncompatability, hasContinuousDomain, isContinuousToContinuous, isContinuousToDiscrete, ScaleType, scaleTypeSupportProperty } from '../../scale'; -import * as util from '../../util'; -import { contains, getFirstDefined, keys } from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { getBinSignalName } from '../data/bin'; -import { isUnitModel } from '../model'; -import { SignalRefWrapper } from '../signal'; -import { mergeValuesWithExplicit, tieBreakByComparing } from '../split'; -import { parseUnitScaleRange } from './range'; -export function parseScaleProperty(model, property) { - if (isUnitModel(model)) { - parseUnitScaleProperty(model, property); - } - else { - parseNonUnitScaleProperty(model, property); - } -} -function parseUnitScaleProperty(model, property) { - const localScaleComponents = model.component.scales; - const { config, encoding, markDef, specifiedScales } = model; - for (const channel of keys(localScaleComponents)) { - const specifiedScale = specifiedScales[channel]; - const localScaleCmpt = localScaleComponents[channel]; - const mergedScaleCmpt = model.getScaleComponent(channel); - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - const specifiedValue = specifiedScale[property]; - const scaleType = mergedScaleCmpt.get('type'); - const scalePadding = mergedScaleCmpt.get('padding'); - const scalePaddingInner = mergedScaleCmpt.get('paddingInner'); - const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); - const channelIncompatability = channelScalePropertyIncompatability(channel, property); - if (specifiedValue !== undefined) { - // If there is a specified value, check if it is compatible with scale type and channel - if (!supportedByScaleType) { - log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel)); - } - else if (channelIncompatability) { - // channel - log.warn(channelIncompatability); - } - } - if (supportedByScaleType && channelIncompatability === undefined) { - if (specifiedValue !== undefined) { - const timeUnit = fieldOrDatumDef['timeUnit']; - const type = fieldOrDatumDef.type; - switch (property) { - // domainMax/Min to signal if the value is a datetime object - case 'domainMax': - case 'domainMin': - if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) { - localScaleCmpt.set(property, { signal: valueExpr(specifiedScale[property], { type, timeUnit }) }, true); - } - else { - localScaleCmpt.set(property, specifiedScale[property], true); - } - break; - default: - localScaleCmpt.copyKeyFromObject(property, specifiedScale); - } - } - else { - const value = property in scaleRules - ? scaleRules[property]({ - model, - channel, - fieldOrDatumDef, - scaleType, - scalePadding, - scalePaddingInner, - domain: specifiedScale.domain, - markDef, - config - }) - : config.scale[property]; - if (value !== undefined) { - localScaleCmpt.set(property, value, false); - } - } - } - } -} -export const scaleRules = { - bins: ({ model, fieldOrDatumDef }) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined), - interpolate: ({ channel, fieldOrDatumDef }) => interpolate(channel, fieldOrDatumDef.type), - nice: ({ scaleType, channel, fieldOrDatumDef }) => nice(scaleType, channel, fieldOrDatumDef), - padding: ({ channel, scaleType, fieldOrDatumDef, markDef, config }) => padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar), - paddingInner: ({ scalePadding, channel, markDef, config }) => paddingInner(scalePadding, channel, markDef.type, config.scale), - paddingOuter: ({ scalePadding, channel, scaleType, markDef, scalePaddingInner, config }) => paddingOuter(scalePadding, channel, scaleType, markDef.type, scalePaddingInner, config.scale), - reverse: ({ fieldOrDatumDef, scaleType, channel, config }) => { - const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined; - return reverse(scaleType, sort, channel, config.scale); - }, - zero: ({ channel, fieldOrDatumDef, domain, markDef, scaleType }) => zero(channel, fieldOrDatumDef, domain, markDef, scaleType) -}; -// This method is here rather than in range.ts to avoid circular dependency. -export function parseScaleRange(model) { - if (isUnitModel(model)) { - parseUnitScaleRange(model); - } - else { - parseNonUnitScaleProperty(model, 'range'); - } -} -export function parseNonUnitScaleProperty(model, property) { - const localScaleComponents = model.component.scales; - for (const child of model.children) { - if (property === 'range') { - parseScaleRange(child); - } - else { - parseScaleProperty(child, property); - } - } - for (const channel of keys(localScaleComponents)) { - let valueWithExplicit; - for (const child of model.children) { - const childComponent = child.component.scales[channel]; - if (childComponent) { - const childValueWithExplicit = childComponent.getWithExplicit(property); - valueWithExplicit = mergeValuesWithExplicit(valueWithExplicit, childValueWithExplicit, property, 'scale', tieBreakByComparing((v1, v2) => { - switch (property) { - case 'range': - // For step, prefer larger step - if (v1.step && v2.step) { - return v1.step - v2.step; - } - return 0; - // TODO: precedence rule for other properties - } - return 0; - })); - } - } - localScaleComponents[channel].setWithExplicit(property, valueWithExplicit); - } -} -export function bins(model, fieldDef) { - const bin = fieldDef.bin; - if (isBinning(bin)) { - const binSignal = getBinSignalName(model, fieldDef.field, bin); - return new SignalRefWrapper(() => { - return model.getSignalName(binSignal); - }); - } - else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) { - // start and stop will be determined from the scale domain - return { - step: bin.step - }; - } - return undefined; -} -export function interpolate(channel, type) { - if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') { - return 'hcl'; - } - return undefined; -} -export function nice(scaleType, channel, fieldOrDatumDef) { - var _a; - if (((_a = getFieldDef(fieldOrDatumDef)) === null || _a === void 0 ? void 0 : _a.bin) || util.contains([ScaleType.TIME, ScaleType.UTC], scaleType)) { - return undefined; - } - return channel in POSITION_SCALE_CHANNEL_INDEX ? true : undefined; -} -export function padding(channel, scaleType, scaleConfig, fieldOrDatumDef, markDef, barConfig) { - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - if (isContinuousToContinuous(scaleType)) { - if (scaleConfig.continuousPadding !== undefined) { - return scaleConfig.continuousPadding; - } - const { type, orient } = markDef; - if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) { - if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) { - return barConfig.continuousBandSize; - } - } - } - if (scaleType === ScaleType.POINT) { - return scaleConfig.pointPadding; - } - } - return undefined; -} -export function paddingInner(paddingValue, channel, mark, scaleConfig) { - if (paddingValue !== undefined) { - // If user has already manually specified "padding", no need to add default paddingInner. - return undefined; - } - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - // Padding is only set for X and Y by default. - // Basically it doesn't make sense to add padding for color and size. - // paddingOuter would only be called if it's a band scale, just return the default for bandScale. - const { bandPaddingInner, barBandPaddingInner, rectBandPaddingInner } = scaleConfig; - return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); - } - return undefined; -} -export function paddingOuter(paddingValue, channel, scaleType, mark, paddingInnerValue, scaleConfig) { - if (paddingValue !== undefined) { - // If user has already manually specified "padding", no need to add default paddingOuter. - return undefined; - } - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - // Padding is only set for X and Y by default. - // Basically it doesn't make sense to add padding for color and size. - if (scaleType === ScaleType.BAND) { - const { bandPaddingOuter } = scaleConfig; - return getFirstDefined(bandPaddingOuter, - /* By default, paddingOuter is paddingInner / 2. The reason is that - size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter). - and we want the width/height to be integer by default. - Note that step (by default) and cardinality are integers.) */ - isSignalRef(paddingInnerValue) ? { signal: `${paddingInnerValue.signal}/2` } : paddingInnerValue / 2); - } - } - return undefined; -} -export function reverse(scaleType, sort, channel, scaleConfig) { - if (channel === 'x' && scaleConfig.xReverse !== undefined) { - if (hasContinuousDomain(scaleType) && sort === 'descending') { - if (isSignalRef(scaleConfig.xReverse)) { - return { signal: `!${scaleConfig.xReverse.signal}` }; - } - else { - return !scaleConfig.xReverse; - } - } - return scaleConfig.xReverse; - } - if (hasContinuousDomain(scaleType) && sort === 'descending') { - // For continuous domain scales, Vega does not support domain sort. - // Thus, we reverse range instead if sort is descending - return true; - } - return undefined; -} -export function zero(channel, fieldDef, specifiedDomain, markDef, scaleType) { - // If users explicitly provide a domain range, we should not augment zero as that will be unexpected. - const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated'; - if (hasCustomDomain) { - if (hasContinuousDomain(scaleType)) { - if (isArray(specifiedDomain)) { - const first = specifiedDomain[0]; - const last = specifiedDomain[specifiedDomain.length - 1]; - if (first <= 0 && last >= 0) { - // if the domain includes zero, make zero remains true - return true; - } - } - return false; - } - } - // If there is no custom domain, return true only for the following cases: - // 1) using quantitative field with size - // While this can be either ratio or interval fields, our assumption is that - // ratio are more common. However, if the scaleType is discretizing scale, we want to return - // false so that range doesn't start at zero - if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) { - return true; - } - // 2) non-binned, quantitative x-scale or y-scale - // (For binning, we should not include zero by default because binning are calculated without zero.) - if (!(isFieldDef(fieldDef) && fieldDef.bin) && - util.contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)) { - const { orient, type } = markDef; - if (contains(['bar', 'area', 'line', 'trail'], type)) { - if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) { - return false; - } - } - return true; - } - return false; -} -//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/properties.js.map b/node_modules/vega-lite/build/src/compile/scale/properties.js.map deleted file mode 100644 index 4eb7bba..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/properties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../../src/compile/scale/properties.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAC3D,OAAO,EACL,KAAK,EACL,IAAI,EACJ,6BAA6B,EAC7B,uBAAuB,EACvB,4BAA4B,EAE5B,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,UAAU,EAIV,SAAS,EACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,mCAAmC,EAEnC,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EAGtB,SAAS,EACT,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAC,WAAW,EAAU,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,WAAW,EAAQ,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAW,uBAAuB,EAAE,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAGhF,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAE5C,MAAM,UAAU,kBAAkB,CAAC,KAAY,EAAE,QAA+D;IAC9G,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;QACtB,sBAAsB,CAAC,KAAK,EAAE,QAA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E1E,wCAAwC;IACxC,4EAA4E;IAC5E,4FAA4F;IAC5F,4CAA4C;IAC5C,IAAI,OAAO,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,cAAc,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE;QAChG,OAAO,IAAI,CAAC;KACb;IAED,iDAAiD;IACjD,oGAAoG;IACpG,IACE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,uBAAuB,EAAE,GAAG,6BAA6B,CAAC,EAAE,OAAO,CAAC,EACtF;QACA,MAAM,EAAC,MAAM,EAAE,IAAI,EAAC,GAAG,OAAO,CAAC;QAC/B,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE;YACpD,IAAI,CAAC,MAAM,KAAK,YAAY,IAAI,OAAO,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,OAAO,KAAK,GAAG,CAAC,EAAE;gBAC9F,OAAO,KAAK,CAAC;aACd;SACF;QAED,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/range.d.ts b/node_modules/vega-lite/build/src/compile/scale/range.d.ts deleted file mode 100644 index fd5a425..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/range.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { SignalRef } from 'vega'; -import { ScaleChannel } from '../../channel'; -import { Config } from '../../config'; -import { Domain, Scale } from '../../scale'; -import { VgRange } from '../../vega.schema'; -import { Explicit } from '../split'; -import { UnitModel } from '../unit'; -export declare const RANGE_PROPERTIES: (keyof Scale)[]; -export declare function parseUnitScaleRange(model: UnitModel): void; -/** - * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme). - */ -export declare function parseRangeForChannel(channel: ScaleChannel, model: UnitModel): Explicit; -export declare function defaultContinuousToDiscreteCount(scaleType: 'quantile' | 'quantize' | 'threshold', config: Config, domain: Domain, channel: ScaleChannel): number; -/** - * Returns the linear interpolation of the range according to the cardinality - * - * @param rangeMin start of the range - * @param rangeMax end of the range - * @param cardinality number of values in the output range - */ -export declare function interpolateRange(rangeMin: number | SignalRef, rangeMax: number | SignalRef, cardinality: number): SignalRef; -export declare const MAX_SIZE_RANGE_STEP_RATIO = 0.95; -//# sourceMappingURL=range.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/range.d.ts.map b/node_modules/vega-lite/build/src/compile/scale/range.d.ts.map deleted file mode 100644 index a915015..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/range.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAC,MAAM,MAAM,CAAC;AAG5C,OAAO,EAQL,YAAY,EAWb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,MAAM,EAAmE,MAAM,cAAc,CAAC;AAItG,OAAO,EAEL,MAAM,EAKN,KAAK,EAGN,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAc,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAIvD,OAAO,EAAC,QAAQ,EAA6B,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGlC,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,KAAK,CAAC,EAAwB,CAAC;AAMrE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,QAcnD;AAoBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,CAkF/F;AAiID,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,UAAU,GAAG,UAAU,GAAG,WAAW,EAChD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,UAgBtB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,WAAW,EAAE,MAAM,GAClB,SAAS,CAaX;AA8BD,eAAO,MAAM,yBAAyB,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/range.js b/node_modules/vega-lite/build/src/compile/scale/range.js deleted file mode 100644 index d34eddc..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/range.js +++ /dev/null @@ -1,363 +0,0 @@ -import { isArray, isNumber, isObject } from 'vega-util'; -import { isBinning } from '../../bin'; -import { ANGLE, COLOR, FILL, FILLOPACITY, isXorY, OPACITY, RADIUS, SCALE_CHANNELS, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, THETA, X, Y } from '../../channel'; -import { getFieldOrDatumDef } from '../../channeldef'; -import { getViewConfigDiscreteSize, getViewConfigDiscreteStep } from '../../config'; -import { DataSourceType } from '../../data'; -import * as log from '../../log'; -import { channelScalePropertyIncompatability, hasContinuousDomain, hasDiscreteDomain, isContinuousToDiscrete, isExtendedScheme, scaleTypeSupportProperty } from '../../scale'; -import { isStep } from '../../spec/base'; -import * as util from '../../util'; -import { isSignalRef } from '../../vega.schema'; -import { signalOrStringValue } from '../common'; -import { getBinSignalName } from '../data/bin'; -import { SignalRefWrapper } from '../signal'; -import { makeExplicit, makeImplicit } from '../split'; -export const RANGE_PROPERTIES = ['range', 'scheme']; -function getSizeChannel(channel) { - return channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; -} -export function parseUnitScaleRange(model) { - const localScaleComponents = model.component.scales; - // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first! - for (const channel of SCALE_CHANNELS) { - const localScaleCmpt = localScaleComponents[channel]; - if (!localScaleCmpt) { - continue; - } - const rangeWithExplicit = parseRangeForChannel(channel, model); - localScaleCmpt.setWithExplicit('range', rangeWithExplicit); - } -} -function getBinStepSignal(model, channel) { - const fieldDef = model.fieldDef(channel); - if (fieldDef && fieldDef.bin && isBinning(fieldDef.bin)) { - const binSignal = getBinSignalName(model, fieldDef.field, fieldDef.bin); - // TODO: extract this to be range step signal - const sizeType = getSizeChannel(channel); - const sizeSignal = model.getName(sizeType); - return new SignalRefWrapper(() => { - const updatedName = model.getSignalName(binSignal); - const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`; - return `${model.getSignalName(sizeSignal)} / (${binCount})`; - }); - } - return undefined; -} -/** - * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme). - */ -export function parseRangeForChannel(channel, model) { - const specifiedScale = model.specifiedScales[channel]; - const { size } = model; - const mergedScaleCmpt = model.getScaleComponent(channel); - const scaleType = mergedScaleCmpt.get('type'); - // Check if any of the range properties is specified. - // If so, check if it is compatible and make sure that we only output one of the properties - for (const property of RANGE_PROPERTIES) { - if (specifiedScale[property] !== undefined) { - const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); - const channelIncompatability = channelScalePropertyIncompatability(channel, property); - if (!supportedByScaleType) { - log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel)); - } - else if (channelIncompatability) { - // channel - log.warn(channelIncompatability); - } - else { - switch (property) { - case 'range': { - const range = specifiedScale.range; - if (isArray(range)) { - if (isXorY(channel)) { - return makeExplicit(range.map(v => { - if (v === 'width' || v === 'height') { - // get signal for width/height - // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames. - const sizeSignal = model.getName(v); - const getSignalName = model.getSignalName.bind(model); - return SignalRefWrapper.fromName(getSignalName, sizeSignal); - } - return v; - })); - } - } - else if (isObject(range)) { - return makeExplicit({ - data: model.requestDataName(DataSourceType.Main), - field: range.field, - sort: { op: 'min', field: model.vgField(channel) } - }); - } - return makeExplicit(range); - } - case 'scheme': - return makeExplicit(parseScheme(specifiedScale[property])); - } - } - } - } - if (channel === X || channel === Y) { - const sizeChannel = channel === X ? 'width' : 'height'; - const sizeValue = size[sizeChannel]; - if (isStep(sizeValue)) { - if (hasDiscreteDomain(scaleType)) { - return makeExplicit({ step: sizeValue.step }); - } - else { - log.warn(log.message.stepDropped(sizeChannel)); - } - } - } - const { rangeMin, rangeMax } = specifiedScale; - const d = defaultRange(channel, model); - if ((rangeMin !== undefined || rangeMax !== undefined) && - // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same - scaleTypeSupportProperty(scaleType, 'rangeMin') && - isArray(d) && - d.length === 2) { - return makeExplicit([rangeMin !== null && rangeMin !== void 0 ? rangeMin : d[0], rangeMax !== null && rangeMax !== void 0 ? rangeMax : d[1]]); - } - return makeImplicit(d); -} -function parseScheme(scheme) { - if (isExtendedScheme(scheme)) { - return Object.assign({ scheme: scheme.name }, util.omit(scheme, ['name'])); - } - return { scheme: scheme }; -} -function defaultRange(channel, model) { - const { size, config, mark, encoding } = model; - const getSignalName = model.getSignalName.bind(model); - const { type } = getFieldOrDatumDef(encoding[channel]); - const mergedScaleCmpt = model.getScaleComponent(channel); - const scaleType = mergedScaleCmpt.get('type'); - const { domain, domainMid } = model.specifiedScales[channel]; - switch (channel) { - case X: - case Y: { - // If there is no explicit width/height for discrete x/y scales - if (util.contains(['point', 'band'], scaleType)) { - if (channel === X && !size.width) { - const w = getViewConfigDiscreteSize(config.view, 'width'); - if (isStep(w)) { - return w; - } - } - else if (channel === Y && !size.height) { - const h = getViewConfigDiscreteSize(config.view, 'height'); - if (isStep(h)) { - return h; - } - } - } - // If step is null, use zero to width or height. - // Note that we use SignalRefWrapper to account for potential merges and renames. - const sizeType = getSizeChannel(channel); - const sizeSignal = model.getName(sizeType); - if (channel === Y && hasContinuousDomain(scaleType)) { - // For y continuous scale, we have to start from the height as the bottom part has the max value. - return [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0]; - } - else { - return [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)]; - } - } - case SIZE: { - // TODO: support custom rangeMin, rangeMax - const zero = model.component.scales[channel].get('zero'); - const rangeMin = sizeRangeMin(mark, zero, config); - const rangeMax = sizeRangeMax(mark, size, model, config); - if (isContinuousToDiscrete(scaleType)) { - return interpolateRange(rangeMin, rangeMax, defaultContinuousToDiscreteCount(scaleType, config, domain, channel)); - } - else { - return [rangeMin, rangeMax]; - } - } - case THETA: - return [0, Math.PI * 2]; - case ANGLE: - // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks. - // (It's weird to add just config.scale.min/maxAngleDegree for now) - return [0, 360]; - case RADIUS: { - // max radius = half od min(width,height) - return [ - 0, - new SignalRefWrapper(() => { - const w = model.getSignalName('width'); - const h = model.getSignalName('height'); - return `min(${w},${h})/2`; - }) - ]; - } - case STROKEWIDTH: - // TODO: support custom rangeMin, rangeMax - return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth]; - case STROKEDASH: - return [ - // TODO: add this to Vega's config.range? - [1, 0], - [4, 2], - [2, 1], - [1, 1], - [1, 2, 4, 2] - ]; - case SHAPE: - return 'symbol'; - case COLOR: - case FILL: - case STROKE: - if (scaleType === 'ordinal') { - // Only nominal data uses ordinal scale by default - return type === 'nominal' ? 'category' : 'ordinal'; - } - else { - if (domainMid !== undefined) { - return 'diverging'; - } - else { - return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp'; - } - } - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - // TODO: support custom rangeMin, rangeMax - return [config.scale.minOpacity, config.scale.maxOpacity]; - } - /* istanbul ignore next: should never reach here */ - throw new Error(`Scale range undefined for channel ${channel}`); -} -export function defaultContinuousToDiscreteCount(scaleType, config, domain, channel) { - switch (scaleType) { - case 'quantile': - return config.scale.quantileCount; - case 'quantize': - return config.scale.quantizeCount; - case 'threshold': - if (domain !== undefined && isArray(domain)) { - return domain.length + 1; - } - else { - log.warn(log.message.domainRequiredForThresholdScale(channel)); - // default threshold boundaries for threshold scale since domain has cardinality of 2 - return 3; - } - } -} -/** - * Returns the linear interpolation of the range according to the cardinality - * - * @param rangeMin start of the range - * @param rangeMax end of the range - * @param cardinality number of values in the output range - */ -export function interpolateRange(rangeMin, rangeMax, cardinality) { - // always return a signal since it's better to compute the sequence in Vega later - const f = () => { - const rMax = signalOrStringValue(rangeMax); - const rMin = signalOrStringValue(rangeMin); - const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`; - return `sequence(${rMin}, ${rMax} + ${step}, ${step})`; - }; - if (isSignalRef(rangeMax)) { - return new SignalRefWrapper(f); - } - else { - return { signal: f() }; - } -} -function sizeRangeMin(mark, zero, config) { - if (zero) { - if (isSignalRef(zero)) { - return { signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}` }; - } - else { - return 0; - } - } - switch (mark) { - case 'bar': - case 'tick': - return config.scale.minBandSize; - case 'line': - case 'trail': - case 'rule': - return config.scale.minStrokeWidth; - case 'text': - return config.scale.minFontSize; - case 'point': - case 'square': - case 'circle': - return config.scale.minSize; - } - /* istanbul ignore next: should never reach here */ - // sizeRangeMin not implemented for the mark - throw new Error(log.message.incompatibleChannel('size', mark)); -} -export const MAX_SIZE_RANGE_STEP_RATIO = 0.95; -function sizeRangeMax(mark, size, model, config) { - const xyStepSignals = { - x: getBinStepSignal(model, 'x'), - y: getBinStepSignal(model, 'y') - }; - switch (mark) { - case 'bar': - case 'tick': { - if (config.scale.maxBandSize !== undefined) { - return config.scale.maxBandSize; - } - const min = minXYStep(size, xyStepSignals, config.view); - if (isNumber(min)) { - return min - 1; - } - else { - return new SignalRefWrapper(() => `${min.signal} - 1`); - } - } - case 'line': - case 'trail': - case 'rule': - return config.scale.maxStrokeWidth; - case 'text': - return config.scale.maxFontSize; - case 'point': - case 'square': - case 'circle': { - if (config.scale.maxSize) { - return config.scale.maxSize; - } - const pointStep = minXYStep(size, xyStepSignals, config.view); - if (isNumber(pointStep)) { - return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2); - } - else { - return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`); - } - } - } - /* istanbul ignore next: should never reach here */ - // sizeRangeMax not implemented for the mark - throw new Error(log.message.incompatibleChannel('size', mark)); -} -/** - * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale. - */ -function minXYStep(size, xyStepSignals, viewConfig) { - const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width'); - const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height'); - if (xyStepSignals.x || xyStepSignals.y) { - return new SignalRefWrapper(() => { - const exprs = [ - xyStepSignals.x ? xyStepSignals.x.signal : widthStep, - xyStepSignals.y ? xyStepSignals.y.signal : heightStep - ]; - return `min(${exprs.join(', ')})`; - }); - } - return Math.min(widthStep, heightStep); -} -//# sourceMappingURL=range.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/range.js.map b/node_modules/vega-lite/build/src/compile/scale/range.js.map deleted file mode 100644 index ba79c84..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/range.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"range.js","sourceRoot":"","sources":["../../../../src/compile/scale/range.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,WAAW,EACX,MAAM,EACN,OAAO,EACP,MAAM,EAEN,cAAc,EACd,KAAK,EACL,IAAI,EACJ,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,CAAC,EACD,CAAC,EACF,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,kBAAkB,EAA+B,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAS,yBAAyB,EAAE,yBAAyB,EAAa,MAAM,cAAc,CAAC;AACtG,OAAO,EAAC,cAAc,EAAC,MAAM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AC;KACJ;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AACzC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/type.d.ts b/node_modules/vega-lite/build/src/compile/scale/type.d.ts deleted file mode 100644 index 823d7f5..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/type.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Channel } from '../../channel'; -import { DatumDef, TypedFieldDef } from '../../channeldef'; -import { Mark } from '../../mark'; -import { Scale, ScaleType } from '../../scale'; -export declare type RangeType = 'continuous' | 'discrete' | 'flexible' | undefined; -/** - * Determine if there is a specified scale type and if it is appropriate, - * or determine default type if type is unspecified or inappropriate. - */ -export declare function scaleType(specifiedScale: Scale, channel: Channel, fieldDef: TypedFieldDef | DatumDef, mark: Mark): ScaleType; -//# sourceMappingURL=type.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/type.d.ts.map b/node_modules/vega-lite/build/src/compile/scale/type.d.ts.map deleted file mode 100644 index 780e1e9..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/type.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/type.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAA4C,MAAM,eAAe,CAAC;AACjF,OAAO,EAAC,QAAQ,EAAwD,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/G,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAA0B,KAAK,EAAE,SAAS,EAA2B,MAAM,aAAa,CAAC;AAKhG,oBAAY,SAAS,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAE3E;;;GAGG;AAEH,wBAAgB,SAAS,CACvB,cAAc,EAAE,KAAK,EACrB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,EAC1C,IAAI,EAAE,IAAI,GACT,SAAS,CAyBX"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/type.js b/node_modules/vega-lite/build/src/compile/scale/type.js deleted file mode 100644 index 20e669a..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/type.js +++ /dev/null @@ -1,98 +0,0 @@ -import { isBinning } from '../../bin'; -import { isColorChannel, isScaleChannel, rangeType } from '../../channel'; -import { isFieldDef, isPositionFieldOrDatumDef } from '../../channeldef'; -import * as log from '../../log'; -import { channelSupportScaleType, scaleTypeSupportDataType } from '../../scale'; -import { normalizeTimeUnit } from '../../timeunit'; -import * as util from '../../util'; -import { POLAR_POSITION_SCALE_CHANNEL_INDEX, POSITION_SCALE_CHANNEL_INDEX } from './../../channel'; -/** - * Determine if there is a specified scale type and if it is appropriate, - * or determine default type if type is unspecified or inappropriate. - */ -// NOTE: CompassQL uses this method. -export function scaleType(specifiedScale, channel, fieldDef, mark) { - const defaultScaleType = defaultType(channel, fieldDef, mark); - const { type } = specifiedScale; - if (!isScaleChannel(channel)) { - // There is no scale for these channels - return null; - } - if (type !== undefined) { - // Check if explicitly specified scale type is supported by the channel - if (!channelSupportScaleType(channel, type)) { - log.warn(log.message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType)); - return defaultScaleType; - } - // Check if explicitly specified scale type is supported by the data type - if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) { - log.warn(log.message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType)); - return defaultScaleType; - } - return type; - } - return defaultScaleType; -} -/** - * Determine appropriate default scale type. - */ -// NOTE: Voyager uses this method. -function defaultType(channel, fieldDef, mark) { - var _a; - switch (fieldDef.type) { - case 'nominal': - case 'ordinal': - if (isColorChannel(channel) || rangeType(channel) === 'discrete') { - if (channel === 'shape' && fieldDef.type === 'ordinal') { - log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal')); - } - return 'ordinal'; - } - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - if (util.contains(['rect', 'bar', 'image', 'rule'], mark)) { - // The rect/bar mark should fit into a band. - // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429 - return 'band'; - } - } - else if (mark === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) { - return 'band'; - } - if (fieldDef.band !== undefined || (isPositionFieldOrDatumDef(fieldDef) && ((_a = fieldDef.axis) === null || _a === void 0 ? void 0 : _a.tickBand))) { - return 'band'; - } - // Otherwise, use ordinal point scale so we can easily get center positions of the marks. - return 'point'; - case 'temporal': - if (isColorChannel(channel)) { - return 'time'; - } - else if (rangeType(channel) === 'discrete') { - log.warn(log.message.discreteChannelCannotEncode(channel, 'temporal')); - // TODO: consider using quantize (equivalent to binning) once we have it - return 'ordinal'; - } - else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) { - return 'utc'; - } - return 'time'; - case 'quantitative': - if (isColorChannel(channel)) { - if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) { - return 'bin-ordinal'; - } - return 'linear'; - } - else if (rangeType(channel) === 'discrete') { - log.warn(log.message.discreteChannelCannotEncode(channel, 'quantitative')); - // TODO: consider using quantize (equivalent to binning) once we have it - return 'ordinal'; - } - return 'linear'; - case 'geojson': - return undefined; - } - /* istanbul ignore next: should never reach this */ - throw new Error(log.message.invalidFieldType(fieldDef.type)); -} -//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/scale/type.js.map b/node_modules/vega-lite/build/src/compile/scale/type.js.map deleted file mode 100644 index 475e85c..0000000 --- a/node_modules/vega-lite/build/src/compile/scale/type.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../src/compile/scale/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EAA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,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;gBACvE,wEAAwE;gBACxE,OAAO,SAAS,CAAC;aAClB;iBAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,IAAI,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE;gBAChG,OAAO,KAAK,CAAC;aACd;YACD,OAAO,MAAM,CAAC;QAEhB,KAAK,cAAc;YACjB,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;gBAC3B,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBACnD,OAAO,aAAa,CAAC;iBACtB;gBAED,OAAO,QAAQ,CAAC;aACjB;iBAAM,IAAI,SAAS,CAAC,OAAO,CAAC,KAAK,UAAU,EAAE;gBAC5C,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;gBAC3E,wEAAwE;gBACxE,OAAO,SAAS,CAAC;aAClB;YAED,OAAO,QAAQ,CAAC;QAElB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;KACpB;IAED,mDAAmD;IACnD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/assemble.d.ts b/node_modules/vega-lite/build/src/compile/selection/assemble.d.ts deleted file mode 100644 index 7ef5fe4..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/assemble.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Signal, SignalRef } from 'vega'; -import { SelectionInit, SelectionInitInterval, SelectionExtent } from '../../selection'; -import { VgData } from '../../vega.schema'; -import { FacetModel } from '../facet'; -import { LayerModel } from '../layer'; -import { Model } from '../model'; -import { UnitModel } from '../unit'; -export declare function assembleInit(init: readonly (SelectionInit | readonly SelectionInit[] | SelectionInitInterval)[] | SelectionInit, isExpr?: boolean, wrap?: (str: string | number) => string | number): any; -export declare function assembleUnitSelectionSignals(model: UnitModel, signals: Signal[]): Signal[]; -export declare function assembleFacetSignals(model: FacetModel, signals: Signal[]): Signal[]; -export declare function assembleTopLevelSignals(model: UnitModel, signals: Signal[]): Signal[]; -export declare function assembleUnitSelectionData(model: UnitModel, data: readonly VgData[]): VgData[]; -export declare function assembleUnitSelectionMarks(model: UnitModel, marks: any[]): any[]; -export declare function assembleLayerSelectionMarks(model: LayerModel, marks: any[]): any[]; -export declare function assembleSelectionScaleDomain(model: Model, extent: SelectionExtent): SignalRef; -//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/assemble.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/assemble.d.ts.map deleted file mode 100644 index c68d288..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/assemble.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAKvC,OAAO,EAAC,aAAa,EAAE,qBAAqB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEtF,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAc,KAAK,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAIlC,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,CAAC,aAAa,GAAG,SAAS,aAAa,EAAE,GAAG,qBAAqB,CAAC,EAAE,GAAG,aAAa,EACnG,MAAM,UAAO,EACb,IAAI,GAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,GAAG,MAAiB,GACzD,GAAG,CAYL;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,YA4B/E;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,YAgBxE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,YAuC1E;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAuB7F;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAWhF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAQlF;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,GAAG,SAAS,CAI7F"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/assemble.js b/node_modules/vega-lite/build/src/compile/selection/assemble.js deleted file mode 100644 index 56784c2..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/assemble.js +++ /dev/null @@ -1,155 +0,0 @@ -import { __rest } from "tslib"; -import { selector as parseSelector } from 'vega-event-selector'; -import { identity, isArray, stringValue } from 'vega-util'; -import { forEachSelection, MODIFY, STORE, unitName, VL_SELECTION_RESOLVE, TUPLE } from '.'; -import { dateTimeToExpr, isDateTime, dateTimeToTimestamp } from '../../datetime'; -import { keys, varName } from '../../util'; -import { isUnitModel } from '../model'; -import { forEachTransform } from './transforms/transforms'; -import { parseSelectionBinExtent } from './parse'; -export function assembleInit(init, isExpr = true, wrap = identity) { - if (isArray(init)) { - const assembled = init.map(v => assembleInit(v, isExpr, wrap)); - return isExpr ? `[${assembled.join(', ')}]` : assembled; - } - else if (isDateTime(init)) { - if (isExpr) { - return wrap(dateTimeToExpr(init)); - } - else { - return wrap(dateTimeToTimestamp(init)); - } - } - return isExpr ? wrap(JSON.stringify(init)) : init; -} -export function assembleUnitSelectionSignals(model, signals) { - forEachSelection(model, (selCmpt, selCompiler) => { - const name = selCmpt.name; - let modifyExpr = selCompiler.modifyExpr(model, selCmpt); - signals.push(...selCompiler.signals(model, selCmpt)); - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.signals) { - signals = txCompiler.signals(model, selCmpt, signals); - } - if (txCompiler.modifyExpr) { - modifyExpr = txCompiler.modifyExpr(model, selCmpt, modifyExpr); - } - }); - signals.push({ - name: name + MODIFY, - on: [ - { - events: { signal: selCmpt.name + TUPLE }, - update: `modify(${stringValue(selCmpt.name + STORE)}, ${modifyExpr})` - } - ] - }); - }); - return cleanupEmptyOnArray(signals); -} -export function assembleFacetSignals(model, signals) { - if (model.component.selection && keys(model.component.selection).length) { - const name = stringValue(model.getName('cell')); - signals.unshift({ - name: 'facet', - value: {}, - on: [ - { - events: parseSelector('mousemove', 'scope'), - update: `isTuple(facet) ? facet : group(${name}).datum` - } - ] - }); - } - return cleanupEmptyOnArray(signals); -} -export function assembleTopLevelSignals(model, signals) { - let hasSelections = false; - forEachSelection(model, (selCmpt, selCompiler) => { - const name = selCmpt.name; - const store = stringValue(name + STORE); - const hasSg = signals.filter(s => s.name === name); - if (hasSg.length === 0) { - const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve; - const isMulti = selCmpt.type === 'multi' ? ', true)' : ')'; - signals.push({ - name: selCmpt.name, - update: `${VL_SELECTION_RESOLVE}(${store}, ${stringValue(resolve)}${isMulti}` - }); - } - hasSelections = true; - if (selCompiler.topLevelSignals) { - signals = selCompiler.topLevelSignals(model, selCmpt, signals); - } - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.topLevelSignals) { - signals = txCompiler.topLevelSignals(model, selCmpt, signals); - } - }); - }); - if (hasSelections) { - const hasUnit = signals.filter(s => s.name === 'unit'); - if (hasUnit.length === 0) { - signals.unshift({ - name: 'unit', - value: {}, - on: [{ events: 'mousemove', update: 'isTuple(group()) ? group() : unit' }] - }); - } - } - return cleanupEmptyOnArray(signals); -} -export function assembleUnitSelectionData(model, data) { - const dataCopy = [...data]; - forEachSelection(model, selCmpt => { - const init = { name: selCmpt.name + STORE }; - if (selCmpt.init) { - const fields = selCmpt.project.items.map(proj => { - const { signals } = proj, rest = __rest(proj, ["signals"]); - return rest; - }); - const insert = selCmpt.init.map(i => assembleInit(i, false)); - init.values = - selCmpt.type === 'interval' - ? [{ unit: unitName(model, { escape: false }), fields, values: insert }] - : insert.map(i => ({ unit: unitName(model, { escape: false }), fields, values: i })); - } - const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE); - if (!contains.length) { - dataCopy.push(init); - } - }); - return dataCopy; -} -export function assembleUnitSelectionMarks(model, marks) { - forEachSelection(model, (selCmpt, selCompiler) => { - marks = selCompiler.marks ? selCompiler.marks(model, selCmpt, marks) : marks; - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.marks) { - marks = txCompiler.marks(model, selCmpt, marks); - } - }); - }); - return marks; -} -export function assembleLayerSelectionMarks(model, marks) { - for (const child of model.children) { - if (isUnitModel(child)) { - marks = assembleUnitSelectionMarks(child, marks); - } - } - return marks; -} -export function assembleSelectionScaleDomain(model, extent) { - const name = extent.selection; - const selCmpt = model.getSelectionComponent(name, varName(name)); - return { signal: parseSelectionBinExtent(selCmpt, extent) }; -} -function cleanupEmptyOnArray(signals) { - return signals.map(s => { - if (s.on && !s.on.length) - delete s.on; - return s; - }); -} -//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/assemble.js.map b/node_modules/vega-lite/build/src/compile/selection/assemble.js.map deleted file mode 100644 index bc449f0..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/assemble.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/selection/assemble.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,QAAQ,IAAI,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,EAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,KAAK,EAAC,MAAM,GAAG,CAAC;AACzF,OAAO,EAAC,cAAc,EAAE,UAAU,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AAIzC,OAAO,EAAC,WAAW,EAAQ,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAC;AAEhD,MAAM,UAAU,YAAY,CAC1B,IAAmG,EACnG,MAAM,GAAG,IAAI,EACb,OAAkD,QAAQ;IAE1D,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;QACjB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;KACzD;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;QAC3B,IAAI,MAAM,EAAE;YACV,OAAO,IAAI,CAA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X,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/index.d.ts b/node_modules/vega-lite/build/src/compile/selection/index.d.ts deleted file mode 100644 index 3717427..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Binding, NewSignal, Stream } from 'vega'; -import { BrushConfig, LegendBinding, SelectionInit, SelectionInitInterval, SelectionResolution, SelectionType } from '../../selection'; -import { Dict } from '../../util'; -import { OutputNode } from '../data/dataflow'; -import { Model } from '../model'; -import { UnitModel } from '../unit'; -import { SelectionProjection, SelectionProjectionComponent } from './transforms/project'; -export declare const STORE = "_store"; -export declare const TUPLE = "_tuple"; -export declare const MODIFY = "_modify"; -export declare const SELECTION_DOMAIN = "_selection_domain_"; -export declare const VL_SELECTION_RESOLVE = "vlSelectionResolve"; -export interface SelectionComponent { - name: string; - type: T; - init?: (T extends 'interval' ? SelectionInitInterval : T extends 'single' ? SelectionInit : T extends 'multi' ? SelectionInit | SelectionInit[] : never)[]; - events: Stream[]; - materialized: OutputNode; - bind?: 'scales' | Binding | Dict | LegendBinding; - resolve: SelectionResolution; - empty: 'all' | 'none'; - mark?: BrushConfig; - project?: SelectionProjectionComponent; - scales?: SelectionProjection[]; - toggle?: any; - translate?: any; - zoom?: any; - nearest?: any; - clear?: any; -} -export interface SelectionCompiler { - signals: (model: UnitModel, selCmpt: SelectionComponent) => NewSignal[]; - topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: NewSignal[]) => NewSignal[]; - modifyExpr: (model: UnitModel, selCmpt: SelectionComponent) => string; - marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[]; -} -export declare function forEachSelection(model: Model, cb: (selCmpt: SelectionComponent, selCompiler: SelectionCompiler) => void | boolean): void; -export declare function unitName(model: Model, { escape }?: { - escape: boolean; -}): string; -export declare function requiresSelectionId(model: Model): boolean; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/index.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/index.d.ts.map deleted file mode 100644 index 828405c..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,MAAM,CAAC;AAGhD,OAAO,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,IAAI,EAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAe,KAAK,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAIlC,OAAO,EAAC,mBAAmB,EAAE,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAEvF,eAAO,MAAM,KAAK,WAAW,CAAC;AAC9B,eAAO,MAAM,KAAK,WAAW,CAAC;AAC9B,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AACrD,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IAER,IAAI,CAAC,EAAE,CAAC,CAAC,SAAS,UAAU,GACxB,qBAAqB,GACrB,CAAC,SAAS,QAAQ,GAClB,aAAa,GACb,CAAC,SAAS,OAAO,GACjB,aAAa,GAAG,aAAa,EAAE,GAC/B,KAAK,CAAC,EAAE,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IAC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BAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,EAAC,MAAM,EAAC;;CAAiB,UAY/D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,WAM/C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/index.js b/node_modules/vega-lite/build/src/compile/selection/index.js deleted file mode 100644 index 9804e83..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/index.js +++ /dev/null @@ -1,55 +0,0 @@ -import { stringValue } from 'vega-util'; -import { FACET_CHANNELS } from '../../channel'; -import { SELECTION_ID } from '../../selection'; -import { vals } from '../../util'; -import { isFacetModel } from '../model'; -import interval from './interval'; -import multi from './multi'; -import single from './single'; -export const STORE = '_store'; -export const TUPLE = '_tuple'; -export const MODIFY = '_modify'; -export const SELECTION_DOMAIN = '_selection_domain_'; -export const VL_SELECTION_RESOLVE = 'vlSelectionResolve'; -const compilers = { single, multi, interval }; -export function forEachSelection(model, cb) { - const selections = model.component.selection; - if (selections) { - for (const sel of vals(selections)) { - const success = cb(sel, compilers[sel.type]); - if (success === true) - break; - } - } -} -function getFacetModel(model) { - let parent = model.parent; - while (parent) { - if (isFacetModel(parent)) { - break; - } - parent = parent.parent; - } - return parent; -} -export function unitName(model, { escape } = { escape: true }) { - let name = escape ? stringValue(model.name) : model.name; - const facetModel = getFacetModel(model); - if (facetModel) { - const { facet } = facetModel; - for (const channel of FACET_CHANNELS) { - if (facet[channel]) { - name += ` + '__facet_${channel}_' + (facet[${stringValue(facetModel.vgField(channel))}])`; - } - } - } - return name; -} -export function requiresSelectionId(model) { - let identifier = false; - forEachSelection(model, selCmpt => { - identifier = identifier || selCmpt.project.items.some(proj => proj.field === SELECTION_ID); - }); - return identifier; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/index.js.map b/node_modules/vega-lite/build/src/compile/selection/index.js.map deleted file mode 100644 index c94443e..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/index.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B,OAAO,MAAM,EAAE;QACb,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;YACxB,MAAM;SACP;QACD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;KACxB;IAED,OAAO,MAAoB,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAY,EAAE,EAAC,MAAM,EAAC,GAAG,EAAC,MAAM,EAAE,IAAI,EAAC;IAC9D,IAAI,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;IACzD,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,UAAU,EAAE;QACd,MAAM,EAAC,KAAK,EAAC,GAAG,UAAU,CAAC;QAC3B,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE;YACpC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;gBAClB,IAAI,IAAI,eAAe,OAAO,eAAe,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;aAC3F;SACF;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAY;IAC9C,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;QAChC,UAAU,GAAG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;IACH,OAAO,UAAU,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/interval.d.ts b/node_modules/vega-lite/build/src/compile/selection/interval.d.ts deleted file mode 100644 index e2742e3..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/interval.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { SelectionCompiler } from '.'; -export declare const BRUSH = "_brush"; -export declare const SCALE_TRIGGER = "_scale_trigger"; -declare const interval: SelectionCompiler<'interval'>; -export default interval; -//# sourceMappingURL=interval.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/interval.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/interval.d.ts.map deleted file mode 100644 index 6ba17ef..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/interval.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interval.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/interval.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAA6C,MAAM,GAAG,CAAC;AAWhF,eAAO,MAAM,KAAK,WAAW,CAAC;AAC9B,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAuK3C,CAAC;AACF,eAAe,QAAQ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/interval.js b/node_modules/vega-lite/build/src/compile/selection/interval.js deleted file mode 100644 index 246b998..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/interval.js +++ /dev/null @@ -1,204 +0,0 @@ -import { __rest } from "tslib"; -import { array, stringValue } from 'vega-util'; -import { STORE, TUPLE, unitName } from '.'; -import { X, Y } from '../../channel'; -import { warn } from '../../log'; -import { hasContinuousDomain } from '../../scale'; -import { keys } from '../../util'; -import { assembleInit } from './assemble'; -import { TUPLE_FIELDS } from './transforms/project'; -import scales from './transforms/scales'; -export const BRUSH = '_brush'; -export const SCALE_TRIGGER = '_scale_trigger'; -const interval = { - signals: (model, selCmpt) => { - const name = selCmpt.name; - const fieldsSg = name + TUPLE_FIELDS; - const hasScales = scales.has(selCmpt); - const signals = []; - const dataSignals = []; - const scaleTriggers = []; - if (selCmpt.translate && !hasScales) { - const filterExpr = `!event.item || event.item.mark.name !== ${stringValue(name + BRUSH)}`; - events(selCmpt, (on, evt) => { - var _a; - const filters = array((_a = evt.between[0].filter) !== null && _a !== void 0 ? _a : (evt.between[0].filter = [])); - if (filters.indexOf(filterExpr) < 0) { - filters.push(filterExpr); - } - return on; - }); - } - selCmpt.project.items.forEach((proj, i) => { - const channel = proj.channel; - if (channel !== X && channel !== Y) { - warn('Interval selections only support x and y encoding channels.'); - return; - } - const init = selCmpt.init ? selCmpt.init[i] : null; - const cs = channelSignals(model, selCmpt, proj, init); - const dname = proj.signals.data; - const vname = proj.signals.visual; - const scaleName = stringValue(model.scaleName(channel)); - const scaleType = model.getScaleComponent(channel).get('type'); - const toNum = hasContinuousDomain(scaleType) ? '+' : ''; - signals.push(...cs); - dataSignals.push(dname); - scaleTriggers.push({ - scaleName: model.scaleName(channel), - expr: `(!isArray(${dname}) || ` + - `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` + - `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))` - }); - }); - // Proxy scale reactions to ensure that an infinite loop doesn't occur - // when an interval selection filter touches the scale. - if (!hasScales) { - signals.push({ - name: name + SCALE_TRIGGER, - value: {}, - on: [ - { - events: scaleTriggers.map(t => ({ scale: t.scaleName })), - update: scaleTriggers.map(t => t.expr).join(' && ') + ` ? ${name + SCALE_TRIGGER} : {}` - } - ] - }); - } - // Only add an interval to the store if it has valid data extents. Data extents - // are set to null if pixel extents are equal to account for intervals over - // ordinal/nominal domains which, when inverted, will still produce a valid datum. - const init = selCmpt.init; - const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`; - return signals.concat(Object.assign(Object.assign({ name: name + TUPLE }, (init ? { init: `{${update}: ${assembleInit(init)}}` } : {})), { on: [ - { - events: [{ signal: dataSignals.join(' || ') }], - update: dataSignals.join(' && ') + ` ? {${update}: [${dataSignals}]} : null` - } - ] })); - }, - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`); - }, - marks: (model, selCmpt, marks) => { - const name = selCmpt.name; - const { x, y } = selCmpt.project.hasChannel; - const xvname = x && x.signals.visual; - const yvname = y && y.signals.visual; - const store = `data(${stringValue(selCmpt.name + STORE)})`; - // Do not add a brush if we're binding to scales. - if (scales.has(selCmpt)) { - return marks; - } - const update = { - x: x !== undefined ? { signal: `${xvname}[0]` } : { value: 0 }, - y: y !== undefined ? { signal: `${yvname}[0]` } : { value: 0 }, - x2: x !== undefined ? { signal: `${xvname}[1]` } : { field: { group: 'width' } }, - y2: y !== undefined ? { signal: `${yvname}[1]` } : { field: { group: 'height' } } - }; - // If the selection is resolved to global, only a single interval is in - // the store. Wrap brush mark's encodings with a production rule to test - // this based on the `unit` property. Hide the brush mark if it corresponds - // to a unit different from the one in the store. - if (selCmpt.resolve === 'global') { - for (const key of keys(update)) { - update[key] = [ - Object.assign({ test: `${store}.length && ${store}[0].unit === ${unitName(model)}` }, update[key]), - { value: 0 } - ]; - } - } - // Two brush marks ensure that fill colors and other aesthetic choices do - // not interefere with the core marks, but that the brushed region can still - // be interacted with (e.g., dragging it around). - const _a = selCmpt.mark, { fill, fillOpacity, cursor } = _a, stroke = __rest(_a, ["fill", "fillOpacity", "cursor"]); - const vgStroke = keys(stroke).reduce((def, k) => { - def[k] = [ - { - test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`] - .filter(t => t) - .join(' && '), - value: stroke[k] - }, - { value: null } - ]; - return def; - }, {}); - return [ - { - name: name + BRUSH + '_bg', - type: 'rect', - clip: true, - encode: { - enter: { - fill: { value: fill }, - fillOpacity: { value: fillOpacity } - }, - update: update - } - }, - ...marks, - { - name: name + BRUSH, - type: 'rect', - clip: true, - encode: { - enter: Object.assign(Object.assign({}, (cursor ? { cursor: { value: cursor } } : {})), { fill: { value: 'transparent' } }), - update: Object.assign(Object.assign({}, update), vgStroke) - } - } - ]; - } -}; -export default interval; -/** - * Returns the visual and data signals for an interval selection. - */ -function channelSignals(model, selCmpt, proj, init) { - const channel = proj.channel; - const vname = proj.signals.visual; - const dname = proj.signals.data; - const hasScales = scales.has(selCmpt); - const scaleName = stringValue(model.scaleName(channel)); - const scale = model.getScaleComponent(channel); - const scaleType = scale ? scale.get('type') : undefined; - const scaled = (str) => `scale(${scaleName}, ${str})`; - const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal; - const coord = `${channel}(unit)`; - const on = events(selCmpt, (def, evt) => { - return [ - ...def, - { events: evt.between[0], update: `[${coord}, ${coord}]` }, - { events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]` } // Brush End - ]; - }); - // React to pan/zooms of continuous scales. Non-continuous scales - // (band, point) cannot be pan/zoomed and any other changes - // to their domains (e.g., filtering) should clear the brushes. - on.push({ - events: { signal: selCmpt.name + SCALE_TRIGGER }, - update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]` - }); - return hasScales - ? [{ name: dname, on: [] }] - : [ - Object.assign(Object.assign({ name: vname }, (init ? { init: assembleInit(init, true, scaled) } : { value: [] })), { on: on }), - Object.assign(Object.assign({ name: dname }, (init ? { init: assembleInit(init) } : {})), { on: [ - { - events: { signal: vname }, - update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})` - } - ] }) - ]; -} -function events(selCmpt, cb) { - return selCmpt.events.reduce((on, evt) => { - if (!evt.between) { - warn(`${evt} is not an ordered event stream for interval selections.`); - return on; - } - return cb(on, evt); - }, []); -} -//# sourceMappingURL=interval.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/interval.js.map b/node_modules/vega-lite/build/src/compile/selection/interval.js.map deleted file mode 100644 index 59ba751..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/interval.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interval.js","sourceRoot":"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\ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/multi.d.ts b/node_modules/vega-lite/build/src/compile/selection/multi.d.ts deleted file mode 100644 index 34e7eb3..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/multi.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Stream } from 'vega'; -import { SelectionCompiler, SelectionComponent } from '.'; -import { UnitModel } from '../unit'; -export declare function singleOrMultiSignals(model: UnitModel, selCmpt: SelectionComponent<'single' | 'multi'>): { - name: string; - on: { - events: Stream[]; - update: string; - force: boolean; - }[]; -}[]; -declare const multi: SelectionCompiler<'multi'>; -export default multi; -//# sourceMappingURL=multi.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/multi.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/multi.d.ts.map deleted file mode 100644 index abd1f3f..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/multi.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"multi.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/multi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAC,iBAAiB,EAAE,kBAAkB,EAAkB,MAAM,GAAG,CAAC;AACzE,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGlC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,CAAC,QAAQ,GAAG,OAAO,CAAC;;;;;;;IAyCrG;AAED,QAAA,MAAM,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAOrC,CAAC;AAEF,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/multi.js b/node_modules/vega-lite/build/src/compile/selection/multi.js deleted file mode 100644 index 2bf862d..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/multi.js +++ /dev/null @@ -1,51 +0,0 @@ -import { stringValue } from 'vega-util'; -import { TUPLE, unitName } from '.'; -import { TUPLE_FIELDS } from './transforms/project'; -export function singleOrMultiSignals(model, selCmpt) { - const name = selCmpt.name; - const fieldsSg = name + TUPLE_FIELDS; - const project = selCmpt.project; - const datum = '(item().isVoronoi ? datum.datum : datum)'; - const values = project.items - .map(p => { - const fieldDef = model.fieldDef(p.channel); - // Binned fields should capture extents, for a range test against the raw field. - return fieldDef && fieldDef.bin - ? `[${datum}[${stringValue(model.vgField(p.channel, {}))}], ` + - `${datum}[${stringValue(model.vgField(p.channel, { binSuffix: 'end' }))}]]` - : `${datum}[${stringValue(p.field)}]`; - }) - .join(', '); - // Only add a discrete selection to the store if a datum is present _and_ - // the interaction isn't occurring on a group mark. This guards against - // polluting interactive state with invalid values in faceted displays - // as the group marks are also data-driven. We force the update to account - // for constant null states but varying toggles (e.g., shift-click in - // whitespace followed by a click in whitespace; the store should only - // be cleared on the second click). - const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`; - const events = selCmpt.events; - return [ - { - name: name + TUPLE, - on: events - ? [ - { - events, - update: `datum && item().mark.marktype !== 'group' ? {${update}: [${values}]} : null`, - force: true - } - ] - : [] - } - ]; -} -const multi = { - signals: singleOrMultiSignals, - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'null' : `{unit: ${unitName(model)}}`); - } -}; -export default multi; -//# sourceMappingURL=multi.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/multi.js.map b/node_modules/vega-lite/build/src/compile/selection/multi.js.map deleted file mode 100644 index f041efa..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/multi.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"multi.js","sourceRoot":"","sources":["../../../../src/compile/selection/multi.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAwC,KAAK,EAAE,QAAQ,EAAC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ACR,CAAC,CAAC;oBACE;wBACE,MAAM;wBACN,MAAM,EAAE,gDAAgD,MAAM,MAAM,MAAM,WAAW;wBACrF,KAAK,EAAE,IAAI;qBACZ;iBACF;gBACH,CAAC,CAAC,EAAE;SACP;KACF,CAAC;AACJ,CAAC;AAED,MAAM,KAAK,GAA+B;IACxC,OAAO,EAAE,oBAAoB;IAE7B,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;QACjC,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7F,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/parse.d.ts b/node_modules/vega-lite/build/src/compile/selection/parse.d.ts deleted file mode 100644 index ba46d22..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/parse.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SelectionComponent } from '.'; -import { LogicalComposition } from '../../logical'; -import { SelectionDef, SelectionExtent } from '../../selection'; -import { Dict } from '../../util'; -import { DataFlowNode, OutputNode } from '../data/dataflow'; -import { Model } from '../model'; -import { UnitModel } from '../unit'; -export declare function parseUnitSelection(model: UnitModel, selDefs: Dict): Record>; -export declare function parseSelectionPredicate(model: Model, selections: LogicalComposition, dfnode?: DataFlowNode, datum?: string): string; -export declare function parseSelectionBinExtent(selCmpt: SelectionComponent, extent: SelectionExtent): string; -export declare function materializeSelections(model: UnitModel, main: OutputNode): void; -//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/parse.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/parse.d.ts.map deleted file mode 100644 index fe1988a..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/parse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/parse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,kBAAkB,EAAQ,MAAM,GAAG,CAAC;AAE9D,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAC,IAAI,EAAwC,MAAM,YAAY,CAAC;AACvE,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAIlC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,2CA2C/E;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,kBAAkB,CAAC,MAAM,CAAC,EACtC,MAAM,CAAC,EAAE,YAAY,EACrB,KAAK,SAAU,GACd,MAAM,CA8BR;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,eAAe,UA2B3F;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,QAWvE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/parse.js b/node_modules/vega-lite/build/src/compile/selection/parse.js deleted file mode 100644 index a94aeed..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/parse.js +++ /dev/null @@ -1,100 +0,0 @@ -import { __rest } from "tslib"; -import { selector as parseSelector } from 'vega-event-selector'; -import { isString, stringValue } from 'vega-util'; -import { forEachSelection, STORE } from '.'; -import { warn } from '../../log'; -import { duplicate, keys, logicalExpr, varName } from '../../util'; -import { OutputNode } from '../data/dataflow'; -import { FilterNode } from '../data/filter'; -import { forEachTransform } from './transforms/transforms'; -import { DataSourceType } from '../../data'; -export function parseUnitSelection(model, selDefs) { - var _a; - const selCmpts = {}; - const selectionConfig = model.config.selection; - for (const name of keys(selDefs !== null && selDefs !== void 0 ? selDefs : {})) { - const selDef = duplicate(selDefs[name]); - const _b = selectionConfig[selDef.type], { fields, encodings } = _b, cfg = __rest(_b, ["fields", "encodings"]); // Project transform applies its defaults. - // Set default values from config if a property hasn't been specified, - // or if it is true. E.g., "translate": true should use the default - // event handlers for translate. However, true may be a valid value for - // a property (e.g., "nearest": true). - for (const key in cfg) { - // A selection should contain either `encodings` or `fields`, only use - // default values for these two values if neither of them is specified. - if ((key === 'encodings' && selDef.fields) || (key === 'fields' && selDef.encodings)) { - continue; - } - if (key === 'mark') { - selDef[key] = Object.assign(Object.assign({}, cfg[key]), selDef[key]); - } - if (selDef[key] === undefined || selDef[key] === true) { - selDef[key] = (_a = cfg[key]) !== null && _a !== void 0 ? _a : selDef[key]; - } - } - const safeName = varName(name); - const selCmpt = (selCmpts[safeName] = Object.assign(Object.assign({}, selDef), { name: safeName, events: isString(selDef.on) ? parseSelector(selDef.on, 'scope') : duplicate(selDef.on) })); - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.has(selCmpt) && txCompiler.parse) { - txCompiler.parse(model, selCmpt, selDef, selDefs[name]); - } - }); - } - return selCmpts; -} -export function parseSelectionPredicate(model, selections, dfnode, datum = 'datum') { - const stores = []; - function expr(name) { - const vname = varName(name); - const selCmpt = model.getSelectionComponent(vname, name); - const store = stringValue(vname + STORE); - if (selCmpt.project.timeUnit) { - const child = dfnode !== null && dfnode !== void 0 ? dfnode : model.component.data.raw; - const tunode = selCmpt.project.timeUnit.clone(); - if (child.parent) { - tunode.insertAsParentOf(child); - } - else { - child.parent = tunode; - } - } - if (selCmpt.empty !== 'none') { - stores.push(store); - } - return (`vlSelectionTest(${store}, ${datum}` + (selCmpt.resolve === 'global' ? ')' : `, ${stringValue(selCmpt.resolve)})`)); - } - const predicateStr = logicalExpr(selections, expr); - return ((stores.length ? '!(' + stores.map(s => `length(data(${s}))`).join(' || ') + ') || ' : '') + `(${predicateStr})`); -} -export function parseSelectionBinExtent(selCmpt, extent) { - const encoding = extent['encoding']; - let field = extent['field']; - if (!encoding && !field) { - field = selCmpt.project.items[0].field; - if (selCmpt.project.items.length > 1) { - warn('A "field" or "encoding" must be specified when using a selection as a scale domain. ' + - `Using "field": ${stringValue(field)}.`); - } - } - else if (encoding && !field) { - const encodings = selCmpt.project.items.filter(p => p.channel === encoding); - if (!encodings.length || encodings.length > 1) { - field = selCmpt.project.items[0].field; - warn((!encodings.length ? 'No ' : 'Multiple ') + - `matching ${stringValue(encoding)} encoding found for selection ${stringValue(extent.selection)}. ` + - `Using "field": ${stringValue(field)}.`); - } - else { - field = encodings[0].field; - } - } - return `${selCmpt.name}[${stringValue(field)}]`; -} -export function materializeSelections(model, main) { - forEachSelection(model, selCmpt => { - const selection = selCmpt.name; - const lookupName = model.getName(`lookup_${selection}`); - model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(new FilterNode(main, model, { selection }), lookupName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); - }); -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/parse.js.map b/node_modules/vega-lite/build/src/compile/selection/parse.js.map deleted file mode 100644 index 8fae249..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/selection/parse.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,IAAI,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAsB,KAAK,EAAC,M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,OAAO,CAAC,UAAU,SAAS,EAAE,CAAC,CAAC;QACxD,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,UAAU,CAClF,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAC,SAAS,EAAC,CAAC,EACxC,UAAU,EACV,cAAc,CAAC,MAAM,EACrB,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,CACzC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/single.d.ts b/node_modules/vega-lite/build/src/compile/selection/single.d.ts deleted file mode 100644 index 0df7ad7..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/single.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { SelectionCompiler } from '.'; -declare const single: SelectionCompiler<'single'>; -export default single; -//# sourceMappingURL=single.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/single.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/single.d.ts.map deleted file mode 100644 index 7f6284a..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/single.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAkB,MAAM,GAAG,CAAC;AAGrD,QAAA,MAAM,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAOvC,CAAC;AAEF,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/single.js b/node_modules/vega-lite/build/src/compile/selection/single.js deleted file mode 100644 index 7882504..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/single.js +++ /dev/null @@ -1,11 +0,0 @@ -import { TUPLE, unitName } from '.'; -import { singleOrMultiSignals } from './multi'; -const single = { - signals: singleOrMultiSignals, - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`); - } -}; -export default single; -//# sourceMappingURL=single.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/single.js.map b/node_modules/vega-lite/build/src/compile/selection/single.js.map deleted file mode 100644 index f27acd9..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/single.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"single.js","sourceRoot":"","sources":["../../../../src/compile/selection/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,EAAE,QAAQ,EAAC,MAAM,GAAG,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,GAAgC;IAC1C,OAAO,EAAE,oBAAoB;IAE7B,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;QACjC,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7F,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/clear.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/clear.d.ts deleted file mode 100644 index 65227a1..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/clear.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { TransformCompiler } from './transforms'; -declare const clear: TransformCompiler; -export default clear; -//# sourceMappingURL=clear.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/clear.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/clear.d.ts.map deleted file mode 100644 index 9549603..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/clear.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/clear.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAE/C,QAAA,MAAM,KAAK,EAAE,iBAsDZ,CAAC;AAEF,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/clear.js b/node_modules/vega-lite/build/src/compile/selection/transforms/clear.js deleted file mode 100644 index 53ec4d2..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/clear.js +++ /dev/null @@ -1,56 +0,0 @@ -import { selector as parseSelector } from 'vega-event-selector'; -import { isString } from 'vega-util'; -import { TUPLE } from '..'; -import { varName } from '../../../util'; -import inputBindings from './inputs'; -import toggle, { TOGGLE } from './toggle'; -const clear = { - has: selCmpt => { - return selCmpt.clear !== undefined && selCmpt.clear !== false; - }, - parse: (model, selCmpt, selDef) => { - if (selDef.clear) { - selCmpt.clear = isString(selDef.clear) ? parseSelector(selDef.clear, 'scope') : selDef.clear; - } - }, - topLevelSignals: (model, selCmpt, signals) => { - if (inputBindings.has(selCmpt)) { - for (const proj of selCmpt.project.items) { - const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`)); - if (idx !== -1) { - signals[idx].on.push({ events: selCmpt.clear, update: 'null' }); - } - } - } - return signals; - }, - signals: (model, selCmpt, signals) => { - function addClear(idx, update) { - if (idx !== -1 && signals[idx].on) { - signals[idx].on.push({ events: selCmpt.clear, update }); - } - } - // Be as minimalist as possible when adding clear triggers to minimize dataflow execution. - if (selCmpt.type === 'interval') { - for (const proj of selCmpt.project.items) { - const vIdx = signals.findIndex(n => n.name === proj.signals.visual); - addClear(vIdx, '[0, 0]'); - if (vIdx === -1) { - const dIdx = signals.findIndex(n => n.name === proj.signals.data); - addClear(dIdx, 'null'); - } - } - } - else { - let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE); - addClear(tIdx, 'null'); - if (toggle.has(selCmpt)) { - tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE); - addClear(tIdx, 'false'); - } - } - return signals; - } -}; -export default clear; -//# sourceMappingURL=clear.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/clear.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/clear.js.map deleted file mode 100644 index 9b608ac..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/clear.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/clear.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,IAAI,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAC,KAAK,EAAC,MAAM,IAAI,CAAC;AACzB,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,MAAM,EAAE,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGxC,MAAM,KAAK,GAAsB;IAC/B,GAAG,EAAE,OAAO,CAAC,EAAE;QACb,OAAO,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC;IAChE,CAAC;IAED,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QAChC,IAAI,MAAM,CAAC,KAAK,EAAE;YAChB,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC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AAC,MAAM,CAAC,CAAC;gBACpE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAEzB,IAAI,IAAI,KAAK,CAAC,CAAC,EAAE;oBACf,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;iBACxB;aACF;SACF;aAAM;YACL,IAAI,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;YACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAEvB,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;gBACvB,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;gBAChE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aACzB;SACF;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.d.ts deleted file mode 100644 index 76d4350..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { TransformCompiler } from './transforms'; -declare const inputBindings: TransformCompiler; -export default inputBindings; -//# sourceMappingURL=inputs.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.d.ts.map deleted file mode 100644 index 08d9c2b..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/inputs.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAG/C,QAAA,MAAM,aAAa,EAAE,iBAkEpB,CAAC;AAEF,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.js b/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.js deleted file mode 100644 index cdba1b5..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.js +++ /dev/null @@ -1,63 +0,0 @@ -import { stringValue } from 'vega-util'; -import { TUPLE } from '..'; -import { varName } from '../../../util'; -import { assembleInit } from '../assemble'; -import nearest from './nearest'; -import { TUPLE_FIELDS } from './project'; -import { isLegendBinding } from '../../../selection'; -const inputBindings = { - has: selCmpt => { - return (selCmpt.type === 'single' && - selCmpt.resolve === 'global' && - selCmpt.bind && - selCmpt.bind !== 'scales' && - !isLegendBinding(selCmpt.bind)); - }, - parse: (model, selCmpt, selDef, origDef) => { - // Binding a selection to input widgets disables default direct manipulation interaction. - // A user can choose to re-enable it by explicitly specifying triggering input events. - if (!origDef.on) - delete selCmpt.events; - if (!origDef.clear) - delete selCmpt.clear; - }, - topLevelSignals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const proj = selCmpt.project; - const bind = selCmpt.bind; - const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value). - const datum = nearest.has(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum'; - proj.items.forEach((p, i) => { - var _a, _b; - const sgname = varName(`${name}_${p.field}`); - const hasSignal = signals.filter(s => s.name === sgname); - if (!hasSignal.length) { - signals.unshift(Object.assign(Object.assign({ name: sgname }, (init ? { init: assembleInit(init[i]) } : { value: null })), { on: selCmpt.events - ? [ - { - events: selCmpt.events, - update: `datum && item().mark.marktype !== 'group' ? ${datum}[${stringValue(p.field)}] : null` - } - ] - : [], bind: (_b = (_a = bind[p.field]) !== null && _a !== void 0 ? _a : bind[p.channel]) !== null && _b !== void 0 ? _b : bind })); - } - }); - return signals; - }, - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const proj = selCmpt.project; - const signal = signals.filter(s => s.name === name + TUPLE)[0]; - const fields = name + TUPLE_FIELDS; - const values = proj.items.map(p => varName(`${name}_${p.field}`)); - const valid = values.map(v => `${v} !== null`).join(' && '); - if (values.length) { - signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; - } - delete signal.value; - delete signal.on; - return signals; - } -}; -export default inputBindings; -//# sourceMappingURL=inputs.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.js.map deleted file mode 100644 index 5ef325e..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/inputs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,KAAK,EAAC,MAAM,IAAI,CAAC;AACzB,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAEnD,MAAM,aAAa,GAAsB;IACvC,GAAG,EAAE,OAAO,CAAC,EAAE;QACb,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,QAAQ;YACzB,OAAO,CAAC,OAAO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AM,EAAE;YACjB,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,eAAe,MAAM,cAAc,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;SACzF;QAED,OAAO,MAAM,CAAC,KAAK,CAAC;QACpB,OAAO,MAAM,CAAC,EAAE,CAAC;QAEjB,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC;AAEF,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/legends.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/legends.d.ts deleted file mode 100644 index 3d261a1..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/legends.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { NonPositionScaleChannel } from '../../../channel'; -import { LegendComponent } from '../../legend/component'; -import { UnitModel } from '../../unit'; -import { TransformCompiler } from './transforms'; -declare const legendBindings: TransformCompiler; -export default legendBindings; -export declare function parseInteractiveLegend(model: UnitModel, channel: NonPositionScaleChannel, legendCmpt: LegendComponent): void; -//# sourceMappingURL=legends.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/legends.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/legends.d.ts.map deleted file mode 100644 index 0e72869..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/legends.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"legends.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/legends.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AAIzD,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAE/C,QAAA,MAAM,cAAc,EAAE,iBAiGrB,CAAC;AAEF,eAAe,cAAc,CAAC;AAE9B,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,uBAAuB,EAChC,UAAU,EAAE,eAAe,QAY5B"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/legends.js b/node_modules/vega-lite/build/src/compile/selection/transforms/legends.js deleted file mode 100644 index dd5256e..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/legends.js +++ /dev/null @@ -1,112 +0,0 @@ -import { selector as parseSelector } from 'vega-event-selector'; -import { array, isString } from 'vega-util'; -import { forEachSelection, TUPLE } from '..'; -import * as log from '../../../log'; -import { isLegendBinding, isLegendStreamBinding, SELECTION_ID } from '../../../selection'; -import { duplicate, varName } from '../../../util'; -import { TUPLE_FIELDS } from './project'; -import { TOGGLE } from './toggle'; -const legendBindings = { - has: (selCmpt) => { - const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind); - const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID; - if (spec && !projLen) { - log.warn(log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION); - } - return spec && projLen; - }, - parse: (model, selCmpt, selDef, origDef) => { - var _a; - // Binding a selection to a legend disables default direct manipulation interaction. - // A user can choose to re-enable it by explicitly specifying triggering input events. - if (!origDef.on) - delete selCmpt.events; - if (!origDef.clear) - delete selCmpt.clear; - if (origDef.on || origDef.clear) { - const legendFilter = 'event.item && indexof(event.item.mark.role, "legend") < 0'; - for (const evt of selCmpt.events) { - evt.filter = array((_a = evt.filter) !== null && _a !== void 0 ? _a : []); - if (evt.filter.indexOf(legendFilter) < 0) { - evt.filter.push(legendFilter); - } - } - } - const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click'; - const stream = isString(evt) ? parseSelector(evt, 'view') : array(evt); - selCmpt.bind = { legend: { merge: stream } }; - }, - topLevelSignals: (model, selCmpt, signals) => { - const selName = selCmpt.name; - const stream = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; - const markName = (name) => (s) => { - const ds = duplicate(s); - ds.markname = name; - return ds; - }; - for (const proj of selCmpt.project.items) { - if (!proj.hasLegend) - continue; - const prefix = `${varName(proj.field)}_legend`; - const sgName = `${selName}_${prefix}`; - const hasSignal = signals.filter(s => s.name === sgName); - if (hasSignal.length === 0) { - const events = stream.merge - .map(markName(`${prefix}_symbols`)) - .concat(stream.merge.map(markName(`${prefix}_labels`))) - .concat(stream.merge.map(markName(`${prefix}_entries`))); - signals.unshift(Object.assign(Object.assign({ name: sgName }, (!selCmpt.init ? { value: null } : {})), { on: [ - // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum. - { events, update: 'datum.value || item().items[0].items[0].datum.value', force: true }, - { events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true } - ] })); - } - } - return signals; - }, - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const proj = selCmpt.project; - const tuple = signals.find(s => s.name === name + TUPLE); - const fields = name + TUPLE_FIELDS; - const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`)); - const valid = values.map(v => `${v} !== null`).join(' && '); - const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; - if (selCmpt.events && values.length > 0) { - tuple.on.push({ - events: values.map(signal => ({ signal })), - update - }); - } - else if (values.length > 0) { - tuple.update = update; - delete tuple.value; - delete tuple.on; - } - const toggle = signals.find(s => s.name === name + TOGGLE); - const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; - if (toggle) { - if (!selCmpt.events) - toggle.on[0].events = events; - else - toggle.on.push(Object.assign(Object.assign({}, toggle.on[0]), { events })); - } - return signals; - } -}; -export default legendBindings; -export function parseInteractiveLegend(model, channel, legendCmpt) { - var _a; - const field = (_a = model.fieldDef(channel)) === null || _a === void 0 ? void 0 : _a.field; - forEachSelection(model, selCmpt => { - var _a, _b; - const proj = (_a = selCmpt.project.hasField[field]) !== null && _a !== void 0 ? _a : selCmpt.project.hasChannel[channel]; - if (proj && legendBindings.has(selCmpt)) { - const legendSelections = (_b = legendCmpt.get('selections')) !== null && _b !== void 0 ? _b : []; - legendSelections.push(selCmpt.name); - legendCmpt.set('selections', legendSelections, false); - proj.hasLegend = true; - } - }); -} -//# sourceMappingURL=legends.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/legends.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/legends.js.map deleted file mode 100644 index b58dafa..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/legends.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"legends.js","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/legends.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,IAAI,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAsB,KAAK,EAAC,MAAM,IAAI,CAAC;AAE/D,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,eAAe,EAAE,qBAAqB,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,MAAM,cAAc,GAAsB;IACxC,GAAG,EAAE,CAAC,OAA+C,EAAE,EAAE;QACvD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3F,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO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OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,mCAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACpF,IAAI,IAAI,IAAI,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACvC,MAAM,gBAAgB,SAAG,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,mCAAI,EAAE,CAAC;YAC5D,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACpC,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;YACtD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACvB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.d.ts deleted file mode 100644 index 258d125..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { TransformCompiler } from './transforms'; -declare const nearest: TransformCompiler; -export default nearest; -//# sourceMappingURL=nearest.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.d.ts.map deleted file mode 100644 index d68a851..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"nearest.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/nearest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAI/C,QAAA,MAAM,OAAO,EAAE,iBAgEd,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.js b/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.js deleted file mode 100644 index b4bfe3a..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.js +++ /dev/null @@ -1,61 +0,0 @@ -import * as log from '../../../log'; -import { isPathMark } from '../../../mark'; -import { tooltip } from '../../mark/encode'; -const VORONOI = 'voronoi'; -const nearest = { - has: selCmpt => { - return selCmpt.type !== 'interval' && selCmpt.nearest; - }, - parse: (model, selCmpt) => { - // Scope selection events to the voronoi mark to prevent capturing - // events that occur on the group mark (https://github.com/vega/vega/issues/2112). - if (selCmpt.events) { - for (const s of selCmpt.events) { - s.markname = model.getName(VORONOI); - } - } - }, - marks: (model, selCmpt, marks) => { - const { x, y } = selCmpt.project.hasChannel; - const markType = model.mark; - if (isPathMark(markType)) { - log.warn(log.message.nearestNotSupportForContinuous(markType)); - return marks; - } - const cellDef = { - name: model.getName(VORONOI), - type: 'path', - interactive: true, - from: { data: model.getName('marks') }, - encode: { - update: Object.assign({ fill: { value: 'transparent' }, strokeWidth: { value: 0.35 }, stroke: { value: 'transparent' }, isVoronoi: { value: true } }, tooltip(model, { reactiveGeom: true })) - }, - transform: [ - { - type: 'voronoi', - x: { expr: x || !y ? 'datum.datum.x || 0' : '0' }, - y: { expr: y || !x ? 'datum.datum.y || 0' : '0' }, - size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] - } - ] - }; - let index = 0; - let exists = false; - marks.forEach((mark, i) => { - var _a; - const name = (_a = mark.name) !== null && _a !== void 0 ? _a : ''; - if (name === model.component.mark[0].name) { - index = i; - } - else if (name.indexOf(VORONOI) >= 0) { - exists = true; - } - }); - if (!exists) { - marks.splice(index + 1, 0, cellDef); - } - return marks; - } -}; -export default nearest; -//# sourceMappingURL=nearest.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.js.map deleted file mode 100644 index 2acc98e..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/nearest.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"nearest.js","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/nearest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAG1C,MAAM,OAAO,GAAG,SAAS,CAAC;AAE1B,MAAM,OAAO,GAAsB;IACjC,GAAG,EAAE,OAAO,CAAC,EAAE;QACb,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IACxD,CAAC;IAED,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,kEAAkE;QAClE,kFAAkF;QAClF,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC9B,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aACrC;SACF;IACH,CAAC;IAED,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QAC/B,MAAM,EAAC,CAAC,EAAE,CAAC,EAAC,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;QAC1C,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC;QAC5B,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;YACxB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,8BAA8B,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC/D,OAAO,KAAK,CAAC;SACd;QAED,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YAC5B,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,EAAC,IAAI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AEH,IAAI,CAAC,MAAM,EAAE;YACX,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;SACrC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/project.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/project.d.ts deleted file mode 100644 index 4aa3ea3..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/project.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { SingleDefUnitChannel } from '../../../channel'; -import { TimeUnitNode } from '../../data/timeunit'; -import { TransformCompiler } from './transforms'; -export declare const TUPLE_FIELDS = "_tuple_fields"; -/** - * Whether the selection tuples hold enumerated or ranged values for a field. - */ -export declare type TupleStoreType = 'E' | 'R' | 'R-RE'; -export interface SelectionProjection { - type: TupleStoreType; - field: string; - channel?: SingleDefUnitChannel; - signals?: { - data?: string; - visual?: string; - }; - hasLegend?: boolean; -} -export declare class SelectionProjectionComponent { - hasChannel: Partial>; - hasField: Record; - timeUnit?: TimeUnitNode; - items: SelectionProjection[]; - constructor(...items: SelectionProjection[]); -} -declare const project: TransformCompiler; -export default project; -//# sourceMappingURL=project.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/project.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/project.d.ts.map deleted file mode 100644 index 943c0e4..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/project.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/project.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAK5F,OAAO,EAAoB,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAE/C,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAE5C;;GAEG;AACH,oBAAY,cAAc,GAEtB,GAAG,GAEH,GAAG,GAEH,MAAM,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,OAAO,CAAC,EAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,qBAAa,4BAA4B;IAChC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACvE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC9C,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,mBAAmB,EAAE,CAAC;gBAExB,GAAG,KAAK,EAAE,mBAAmB,EAAE;CAK5C;AAED,QAAA,MAAM,OAAO,EAAE,iBA+Id,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/project.js b/node_modules/vega-lite/build/src/compile/selection/transforms/project.js deleted file mode 100644 index dc5d406..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/project.js +++ /dev/null @@ -1,154 +0,0 @@ -import { __rest } from "tslib"; -import { array } from 'vega-util'; -import { isSingleDefUnitChannel } from '../../../channel'; -import * as log from '../../../log'; -import { hasContinuousDomain } from '../../../scale'; -import { hash, keys, replacePathInField, varName, isEmpty } from '../../../util'; -import { TimeUnitNode } from '../../data/timeunit'; -export const TUPLE_FIELDS = '_tuple_fields'; -export class SelectionProjectionComponent { - constructor(...items) { - this.items = items; - this.hasChannel = {}; - this.hasField = {}; - } -} -const project = { - has: () => { - return true; // This transform handles its own defaults, so always run parse. - }, - parse: (model, selCmpt, selDef) => { - var _a, _b, _c; - const name = selCmpt.name; - const proj = (_a = selCmpt.project) !== null && _a !== void 0 ? _a : (selCmpt.project = new SelectionProjectionComponent()); - const parsed = {}; - const timeUnits = {}; - const signals = new Set(); - const signalName = (p, range) => { - const suffix = range === 'visual' ? p.channel : p.field; - let sg = varName(`${name}_${suffix}`); - for (let counter = 1; signals.has(sg); counter++) { - sg = varName(`${name}_${suffix}_${counter}`); - } - signals.add(sg); - return { [range]: sg }; - }; - // If no explicit projection (either fields or encodings) is specified, set some defaults. - // If an initial value is set, try to infer projections. - // Otherwise, use the default configuration. - if (!selDef.fields && !selDef.encodings) { - const cfg = model.config.selection[selDef.type]; - if (selDef.init) { - for (const init of array(selDef.init)) { - for (const key of keys(init)) { - if (isSingleDefUnitChannel(key)) { - (selDef.encodings || (selDef.encodings = [])).push(key); - } - else { - if (selDef.type === 'interval') { - log.warn(log.message.INTERVAL_INITIALIZED_WITH_X_Y); - selDef.encodings = cfg.encodings; - } - else { - (selDef.fields || (selDef.fields = [])).push(key); - } - } - } - } - } - else { - selDef.encodings = cfg.encodings; - selDef.fields = cfg.fields; - } - } - // TODO: find a possible channel mapping for these fields. - for (const field of (_b = selDef.fields) !== null && _b !== void 0 ? _b : []) { - const p = { type: 'E', field }; - p.signals = Object.assign({}, signalName(p, 'data')); - proj.items.push(p); - proj.hasField[field] = p; - } - for (const channel of (_c = selDef.encodings) !== null && _c !== void 0 ? _c : []) { - const fieldDef = model.fieldDef(channel); - if (fieldDef) { - let field = fieldDef.field; - if (fieldDef.aggregate) { - log.warn(log.message.cannotProjectAggregate(channel, fieldDef.aggregate)); - continue; - } - else if (!field) { - log.warn(log.message.cannotProjectOnChannelWithoutField(channel)); - continue; - } - if (fieldDef.timeUnit) { - field = model.vgField(channel); - // Construct TimeUnitComponents which will be combined into a - // TimeUnitNode. This node may need to be inserted into the - // dataflow if the selection is used across views that do not - // have these time units defined. - const component = { - timeUnit: fieldDef.timeUnit, - as: field, - field: fieldDef.field - }; - timeUnits[hash(component)] = component; - } - // Prevent duplicate projections on the same field. - // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag). - if (!parsed[field]) { - // Determine whether the tuple will store enumerated or ranged values. - // Interval selections store ranges for continuous scales, and enumerations otherwise. - // Single/multi selections store ranges for binned fields, and enumerations otherwise. - let type = 'E'; - if (selCmpt.type === 'interval') { - const scaleType = model.getScaleComponent(channel).get('type'); - if (hasContinuousDomain(scaleType)) { - type = 'R'; - } - } - else if (fieldDef.bin) { - type = 'R-RE'; - } - const p = { field, channel, type }; - p.signals = Object.assign(Object.assign({}, signalName(p, 'data')), signalName(p, 'visual')); - proj.items.push((parsed[field] = p)); - proj.hasField[field] = proj.hasChannel[channel] = parsed[field]; - } - } - else { - log.warn(log.message.cannotProjectOnChannelWithoutField(channel)); - } - } - if (selDef.init) { - const parseInit = (i) => { - return proj.items.map(p => (i[p.channel] !== undefined ? i[p.channel] : i[p.field])); - }; - if (selDef.type === 'interval') { - selCmpt.init = parseInit(selDef.init); - } - else { - const init = array(selDef.init); - selCmpt.init = init.map(parseInit); - } - } - if (!isEmpty(timeUnits)) { - proj.timeUnit = new TimeUnitNode(null, timeUnits); - } - }, - signals: (model, selCmpt, allSignals) => { - const name = selCmpt.name + TUPLE_FIELDS; - const hasSignal = allSignals.filter(s => s.name === name); - return hasSignal.length > 0 - ? allSignals - : allSignals.concat({ - name, - value: selCmpt.project.items.map(proj => { - const { signals, hasLegend } = proj, rest = __rest(proj, ["signals", "hasLegend"]); - rest.field = replacePathInField(rest.field); - return rest; - }) - }); - } -}; -export default project; -//# sourceMappingURL=project.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/project.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/project.js.map deleted file mode 100644 index 4e55544..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/project.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version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AAC,CAAC,UAAU,CAAC,MAAM,CAAC;gBAChB,IAAI;gBACJ,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;oBACtC,MAAM,EAAC,OAAO,EAAE,SAAS,KAAa,IAAI,EAAZ,IAAI,UAAI,IAAI,EAApC,wBAA6B,CAAO,CAAC;oBAC3C,IAAI,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBAC5C,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC;aACH,CAAC,CAAC;IACT,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/scales.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/scales.d.ts deleted file mode 100644 index a868b13..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/scales.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ScaleChannel } from '../../../channel'; -import { UnitModel } from '../../unit'; -import { TransformCompiler } from './transforms'; -declare const scaleBindings: TransformCompiler; -export default scaleBindings; -export declare function domain(model: UnitModel, channel: ScaleChannel): string; -//# sourceMappingURL=scales.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/scales.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/scales.d.ts.map deleted file mode 100644 index d9b50fa..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/scales.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/scales.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAI9D,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAE/C,QAAA,MAAM,aAAa,EAAE,iBA0EpB,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,UAG7D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/scales.js b/node_modules/vega-lite/build/src/compile/selection/transforms/scales.js deleted file mode 100644 index 6a7f310..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/scales.js +++ /dev/null @@ -1,80 +0,0 @@ -import { stringValue } from 'vega-util'; -import { VL_SELECTION_RESOLVE } from '..'; -import { isScaleChannel } from '../../../channel'; -import * as log from '../../../log'; -import { hasContinuousDomain } from '../../../scale'; -import { isLayerModel } from '../../model'; -const scaleBindings = { - has: selCmpt => { - return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales'; - }, - parse: (model, selCmpt) => { - const bound = (selCmpt.scales = []); - for (const proj of selCmpt.project.items) { - const channel = proj.channel; - if (!isScaleChannel(channel)) { - continue; - } - const scale = model.getScaleComponent(channel); - const scaleType = scale ? scale.get('type') : undefined; - if (!scale || !hasContinuousDomain(scaleType)) { - log.warn(log.message.SCALE_BINDINGS_CONTINUOUS); - continue; - } - const extent = { selection: selCmpt.name, field: proj.field }; - scale.set('selectionExtent', extent, true); - bound.push(proj); - } - }, - topLevelSignals: (model, selCmpt, signals) => { - const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0); - // Top-level signals are only needed for multiview displays and if this - // view's top-level signals haven't already been generated. - if (!model.parent || isTopLevelLayer(model) || bound.length === 0) { - return signals; - } - // vlSelectionResolve does not account for the behavior of bound scales in - // multiview displays. Each unit view adds a tuple to the store, but the - // state of the selection is the unit selection most recently updated. This - // state is captured by the top-level signals that we insert and "push - // outer" to from within the units. We need to reassemble this state into - // the top-level named signal, except no single selCmpt has a global view. - const namedSg = signals.filter(s => s.name === selCmpt.name)[0]; - let update = namedSg.update; - if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) { - namedSg.update = `{${bound.map(proj => `${stringValue(proj.field)}: ${proj.signals.data}`).join(', ')}}`; - } - else { - for (const proj of bound) { - const mapping = `${stringValue(proj.field)}: ${proj.signals.data}`; - if (update.indexOf(mapping) < 0) { - update = `${update.substring(0, update.length - 1)}, ${mapping}}`; - } - } - namedSg.update = update; - } - return signals.concat(bound.map(proj => ({ name: proj.signals.data }))); - }, - signals: (model, selCmpt, signals) => { - // Nested signals need only push to top-level signals with multiview displays. - if (model.parent && !isTopLevelLayer(model)) { - for (const proj of selCmpt.scales) { - const signal = signals.filter(s => s.name === proj.signals.data)[0]; - signal.push = 'outer'; - delete signal.value; - delete signal.update; - } - } - return signals; - } -}; -export default scaleBindings; -export function domain(model, channel) { - const scale = stringValue(model.scaleName(channel)); - return `domain(${scale})`; -} -function isTopLevelLayer(model) { - var _a; - return model.parent && isLayerModel(model.parent) && ((_a = !model.parent.parent) !== null && _a !== void 0 ? _a : isTopLevelLayer(model.parent.parent)); -} -//# sourceMappingURL=scales.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/scales.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/scales.js.map deleted file mode 100644 index f03a555..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/scales.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scales.js","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/scales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,IAAI,CAAC;AACxC,OAAO,EAAC,cAAc,EAAe,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAC,YAAY,EAAQ,MAAM,aAAa,CAAC;AAKhD,MAAM,aAAa,GA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AC,CAAC;AACtH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.d.ts deleted file mode 100644 index bd80204..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { TransformCompiler } from './transforms'; -export declare const TOGGLE = "_toggle"; -declare const toggle: TransformCompiler; -export default toggle; -//# sourceMappingURL=toggle.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.d.ts.map deleted file mode 100644 index c0817bf..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/toggle.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAE/C,eAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,QAAA,MAAM,MAAM,EAAE,iBAuBb,CAAC;AAEF,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.js b/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.js deleted file mode 100644 index 8cb37be..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.js +++ /dev/null @@ -1,23 +0,0 @@ -import { TUPLE, unitName } from '..'; -export const TOGGLE = '_toggle'; -const toggle = { - has: selCmpt => { - return selCmpt.type === 'multi' && !!selCmpt.toggle; - }, - signals: (model, selCmpt, signals) => { - return signals.concat({ - name: selCmpt.name + TOGGLE, - value: false, - on: [{ events: selCmpt.events, update: selCmpt.toggle }] - }); - }, - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - const signal = selCmpt.name + TOGGLE; - return (`${signal} ? null : ${tpl}, ` + - (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) + - `${signal} ? ${tpl} : null`); - } -}; -export default toggle; -//# sourceMappingURL=toggle.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.js.map deleted file mode 100644 index dcdd8e8..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/toggle.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,IAAI,CAAC;AAGnC,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAEhC,MAAM,MAAM,GAAsB;IAChC,GAAG,EAAE,OAAO,CAAC,EAAE;QACb,OAAO,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACtD,CAAC;IAED,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACnC,OAAO,OAAO,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,OAAO,CAAC,IAAI,GAAG,MAAM;YAC3B,KAAK,EAAE,KAAK;YACZ,EAAE,EAAE,CAAC,EAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAC,CAAC;SACvD,CAAC,CAAC;IACL,CAAC;IAED,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;QACjC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;QAErC,OAAO,CACL,GAAG,MAAM,aAAa,GAAG,IAAI;YAC7B,CAAC,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,kBAAkB,CAAC,CAAC,CAAC,GAAG,MAAM,oBAAoB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;YAChH,GAAG,MAAM,MAAM,GAAG,SAAS,CAC5B,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.d.ts deleted file mode 100644 index e2434b7..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NewSignal, Signal } from 'vega'; -import { SelectionComponent } from '..'; -import { SelectionDef } from '../../../selection'; -import { Model } from '../../model'; -import { UnitModel } from '../../unit'; -export interface TransformCompiler { - has: (selCmpt: SelectionComponent) => boolean; - parse?: (model: UnitModel, selCmpt: SelectionComponent, def: SelectionDef, origDef: SelectionDef) => void; - signals?: (model: UnitModel, selCmpt: SelectionComponent, signals: NewSignal[]) => Signal[]; - topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: NewSignal[]) => NewSignal[]; - modifyExpr?: (model: UnitModel, selCmpt: SelectionComponent, expr: string) => string; - marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[]; -} -export declare function forEachTransform(selCmpt: SelectionComponent, cb: (tx: TransformCompiler) => void): void; -//# sourceMappingURL=transforms.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.d.ts.map deleted file mode 100644 index 5a4c3a1..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/transforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,MAAM,CAAC;AACvC,OAAO,EAAC,kBAAkB,EAAC,MAAM,IAAI,CAAC;AACtC,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAWrC,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC;IAC9C,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC1G,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5F,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,CAAC;IACnG,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACrF,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,CAAC;CAChF;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,iBAAiB,KAAK,IAAI,QAMhG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.js b/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.js deleted file mode 100644 index fccbaf4..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.js +++ /dev/null @@ -1,18 +0,0 @@ -import clear from './clear'; -import inputs from './inputs'; -import nearest from './nearest'; -import project from './project'; -import scales from './scales'; -import legends from './legends'; -import toggle from './toggle'; -import translate from './translate'; -import zoom from './zoom'; -const compilers = [project, toggle, scales, legends, translate, zoom, inputs, nearest, clear]; -export function forEachTransform(selCmpt, cb) { - for (const t of compilers) { - if (t.has(selCmpt)) { - cb(t); - } - } -} -//# sourceMappingURL=transforms.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.js.map deleted file mode 100644 index 08a24fd..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/transforms.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transforms.js","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/transforms.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAW1B,MAAM,SAAS,GAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAEnH,MAAM,UAAU,gBAAgB,CAAC,OAA2B,EAAE,EAAmC;IAC/F,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE;QACzB,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YAClB,EAAE,CAAC,CAAC,CAAC,CAAC;SACP;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/translate.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/translate.d.ts deleted file mode 100644 index 23c0bdc..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/translate.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { TransformCompiler } from './transforms'; -declare const translate: TransformCompiler; -export default translate; -//# sourceMappingURL=translate.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/translate.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/translate.d.ts.map deleted file mode 100644 index dad216a..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/translate.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/translate.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAK/C,QAAA,MAAM,SAAS,EAAE,iBAqDhB,CAAC;AAEF,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/translate.js b/node_modules/vega-lite/build/src/compile/selection/transforms/translate.js deleted file mode 100644 index 16c1617..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/translate.js +++ /dev/null @@ -1,81 +0,0 @@ -import { selector as parseSelector } from 'vega-event-selector'; -import { X, Y } from '../../../channel'; -import { BRUSH as INTERVAL_BRUSH } from '../interval'; -import scalesCompiler, { domain } from './scales'; -const ANCHOR = '_translate_anchor'; -const DELTA = '_translate_delta'; -const translate = { - has: selCmpt => { - return selCmpt.type === 'interval' && selCmpt.translate; - }, - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const hasScales = scalesCompiler.has(selCmpt); - const anchor = name + ANCHOR; - const { x, y } = selCmpt.project.hasChannel; - let events = parseSelector(selCmpt.translate, 'scope'); - if (!hasScales) { - events = events.map(e => ((e.between[0].markname = name + INTERVAL_BRUSH), e)); - } - signals.push({ - name: anchor, - value: {}, - on: [ - { - events: events.map(e => e.between[0]), - update: '{x: x(unit), y: y(unit)' + - (x !== undefined ? ', extent_x: ' + (hasScales ? domain(model, X) : `slice(${x.signals.visual})`) : '') + - (y !== undefined ? ', extent_y: ' + (hasScales ? domain(model, Y) : `slice(${y.signals.visual})`) : '') + - '}' - } - ] - }, { - name: name + DELTA, - value: {}, - on: [ - { - events: events, - update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}` - } - ] - }); - if (x !== undefined) { - onDelta(model, selCmpt, x, 'width', signals); - } - if (y !== undefined) { - onDelta(model, selCmpt, y, 'height', signals); - } - return signals; - } -}; -export default translate; -function onDelta(model, selCmpt, proj, size, signals) { - var _a; - const name = selCmpt.name; - const anchor = name + ANCHOR; - const delta = name + DELTA; - const channel = proj.channel; - const hasScales = scalesCompiler.has(selCmpt); - const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0]; - const sizeSg = model.getSizeSignalRef(size).signal; - const scaleCmpt = model.getScaleComponent(channel); - const scaleType = scaleCmpt.get('type'); - const sign = hasScales && channel === X ? '-' : ''; // Invert delta when panning x-scales. - const extent = `${anchor}.extent_${channel}`; - const offset = `${sign}${delta}.${channel} / ` + (hasScales ? `${sizeSg}` : `span(${extent})`); - const panFn = !hasScales - ? 'panLinear' - : scaleType === 'log' - ? 'panLog' - : scaleType === 'pow' - ? 'panPow' - : 'panLinear'; - const update = `${panFn}(${extent}, ${offset}` + - (hasScales && scaleType === 'pow' ? `, ${(_a = scaleCmpt.get('exponent')) !== null && _a !== void 0 ? _a : 1}` : '') + - ')'; - signal.on.push({ - events: { signal: delta }, - update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})` - }); -} -//# sourceMappingURL=translate.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/translate.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/translate.js.map deleted file mode 100644 index 161859b..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/translate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"translate.js","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/translate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,IAAI,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAe,CAAC,EAAE,CAAC,EAAC,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAC,KAAK,IAAI,cAAc,EAAC,MAAM,aAAa,CAAC;AAEpD,OAAO,cAAc,EAAE,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhD,MAAM,MAAM,GAAG,mBAAmB,CAAC;AACnC,MAAM,KAAK,GAAG,kBAAkB,CAAC;AAEjC,MAAM,SAAS,GAAsB;IACnC,GAAG,EAAE,OAAO,CAAC,EAAE;QACb,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;IAC1D,CAAC;IAED,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACnC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,MAAM,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;QAC7B,MAAM,EAAC,CAAC,EAAE,CAAC,EAAC,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;QAC1C,IAAI,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEvD,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CA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CAAC,SAAS;QACtB,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,SAAS,KAAK,KAAK;YACrB,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,SAAS,KAAK,KAAK;gBACrB,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,WAAW,CAAC;IAChB,MAAM,MAAM,GACV,GAAG,KAAK,IAAI,MAAM,KAAK,MAAM,EAAE;QAC/B,CAAC,SAAS,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,MAAA,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,mCAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,GAAG,CAAC;IAEN,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;QACb,MAAM,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC;QACvB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,MAAM,QAAQ,MAAM,GAAG;KACnE,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.d.ts b/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.d.ts deleted file mode 100644 index 8c2836b..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { TransformCompiler } from './transforms'; -declare const zoom: TransformCompiler; -export default zoom; -//# sourceMappingURL=zoom.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.d.ts.map b/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.d.ts.map deleted file mode 100644 index 1e8c044..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"zoom.d.ts","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/zoom.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAK/C,QAAA,MAAM,IAAI,EAAE,iBAwDX,CAAC;AAEF,eAAe,IAAI,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.js b/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.js deleted file mode 100644 index cffc100..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.js +++ /dev/null @@ -1,84 +0,0 @@ -import { selector as parseSelector } from 'vega-event-selector'; -import { stringValue } from 'vega-util'; -import { X, Y } from '../../../channel'; -import { BRUSH as INTERVAL_BRUSH } from '../interval'; -import { default as scalesCompiler, domain } from './scales'; -const ANCHOR = '_zoom_anchor'; -const DELTA = '_zoom_delta'; -const zoom = { - has: selCmpt => { - return selCmpt.type === 'interval' && selCmpt.zoom; - }, - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const hasScales = scalesCompiler.has(selCmpt); - const delta = name + DELTA; - const { x, y } = selCmpt.project.hasChannel; - const sx = stringValue(model.scaleName(X)); - const sy = stringValue(model.scaleName(Y)); - let events = parseSelector(selCmpt.zoom, 'scope'); - if (!hasScales) { - events = events.map(e => ((e.markname = name + INTERVAL_BRUSH), e)); - } - signals.push({ - name: name + ANCHOR, - on: [ - { - events: events, - update: !hasScales - ? `{x: x(unit), y: y(unit)}` - : '{' + - [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : ''] - .filter(expr => !!expr) - .join(', ') + - '}' - } - ] - }, { - name: delta, - on: [ - { - events: events, - force: true, - update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))' - } - ] - }); - if (x !== undefined) { - onDelta(model, selCmpt, x, 'width', signals); - } - if (y !== undefined) { - onDelta(model, selCmpt, y, 'height', signals); - } - return signals; - } -}; -export default zoom; -function onDelta(model, selCmpt, proj, size, signals) { - var _a; - const name = selCmpt.name; - const channel = proj.channel; - const hasScales = scalesCompiler.has(selCmpt); - const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0]; - const sizeSg = model.getSizeSignalRef(size).signal; - const scaleCmpt = model.getScaleComponent(channel); - const scaleType = scaleCmpt.get('type'); - const base = hasScales ? domain(model, channel) : signal.name; - const delta = name + DELTA; - const anchor = `${name}${ANCHOR}.${channel}`; - const zoomFn = !hasScales - ? 'zoomLinear' - : scaleType === 'log' - ? 'zoomLog' - : scaleType === 'pow' - ? 'zoomPow' - : 'zoomLinear'; - const update = `${zoomFn}(${base}, ${anchor}, ${delta}` + - (hasScales && scaleType === 'pow' ? `, ${(_a = scaleCmpt.get('exponent')) !== null && _a !== void 0 ? _a : 1}` : '') + - ')'; - signal.on.push({ - events: { signal: delta }, - update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})` - }); -} -//# sourceMappingURL=zoom.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.js.map b/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.js.map deleted file mode 100644 index 4810ba3..0000000 --- a/node_modules/vega-lite/build/src/compile/selection/transforms/zoom.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"zoom.js","sourceRoot":"","sources":["../../../../../src/compile/selection/transforms/zoom.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,IAAI,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAe,CAAC,EAAE,CAAC,EAAC,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAC,KAAK,IAAI,cAAc,EAAC,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAG3D,MAAM,MAAM,GAAG,cAAc,CAAC;AAC9B,MAAM,KAAK,GAAG,aAAa,CAAC;AAE5B,MAAM,IAAI,GAAsB;IAC9B,GAAG,EAAE,OAAO,CAAC,EAAE;QACb,O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CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9D,MAAM,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;IAC3B,MAAM,MAAM,GAAG,GAAG,IAAI,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC;IAC7C,MAAM,MAAM,GAAG,CAAC,SAAS;QACvB,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,SAAS,KAAK,KAAK;YACrB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,SAAS,KAAK,KAAK;gBACrB,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,YAAY,CAAC;IACjB,MAAM,MAAM,GACV,GAAG,MAAM,IAAI,IAAI,KAAK,MAAM,KAAK,KAAK,EAAE;QACxC,CAAC,SAAS,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,MAAA,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,mCAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,GAAG,CAAC;IAEN,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;QACb,MAAM,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC;QACvB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,MAAM,QAAQ,MAAM,GAAG;KACnE,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/signal.d.ts b/node_modules/vega-lite/build/src/compile/signal.d.ts deleted file mode 100644 index 5b07342..0000000 --- a/node_modules/vega-lite/build/src/compile/signal.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SignalRef } from 'vega'; -export declare type Rename = (oldSignalName: string) => string; -/** - * A class that behaves like a SignalRef but lazily generates the signal. - * The provided generator function should use `Model.getSignalName` to use the correct signal name. - */ -export declare class SignalRefWrapper implements SignalRef { - constructor(exprGenerator: () => string); - signal: string; - static fromName(rename: Rename, signalName: string): SignalRefWrapper; -} -//# sourceMappingURL=signal.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/signal.d.ts.map b/node_modules/vega-lite/build/src/compile/signal.d.ts.map deleted file mode 100644 index adbfad7..0000000 --- a/node_modules/vega-lite/build/src/compile/signal.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../../src/compile/signal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAE/B,oBAAY,MAAM,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;AAEvD;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,SAAS;gBACpC,aAAa,EAAE,MAAM,MAAM;IAOhC,MAAM,EAAE,MAAM,CAAC;WAER,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAG1D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/signal.js b/node_modules/vega-lite/build/src/compile/signal.js deleted file mode 100644 index 0f2a3f1..0000000 --- a/node_modules/vega-lite/build/src/compile/signal.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * A class that behaves like a SignalRef but lazily generates the signal. - * The provided generator function should use `Model.getSignalName` to use the correct signal name. - */ -export class SignalRefWrapper { - constructor(exprGenerator) { - Object.defineProperty(this, 'signal', { - enumerable: true, - get: exprGenerator - }); - } - static fromName(rename, signalName) { - return new SignalRefWrapper(() => rename(signalName)); - } -} -//# sourceMappingURL=signal.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/signal.js.map b/node_modules/vega-lite/build/src/compile/signal.js.map deleted file mode 100644 index b5af5c4..0000000 --- a/node_modules/vega-lite/build/src/compile/signal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signal.js","sourceRoot":"","sources":["../../../src/compile/signal.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAC3B,YAAY,aAA2B;QACrC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE;YACpC,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,aAAa;SACnB,CAAC,CAAC;IACL,CAAC;IAIM,MAAM,CAAC,QAAQ,CAAC,MAAc,EAAE,UAAkB;QACvD,OAAO,IAAI,gBAAgB,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IACxD,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/split.d.ts b/node_modules/vega-lite/build/src/compile/split.d.ts deleted file mode 100644 index 3bcfe2d..0000000 --- a/node_modules/vega-lite/build/src/compile/split.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Generic class for storing properties that are explicitly specified - * and implicitly determined by the compiler. - * This is important for scale/axis/legend merging as - * we want to prioritize properties that users explicitly specified. - */ -export declare class Split { - readonly explicit: Partial; - readonly implicit: Partial; - constructor(explicit?: Partial, implicit?: Partial); - clone(): Split; - combine(): Partial; - get(key: K): T[K]; - getWithExplicit(key: K): Explicit; - setWithExplicit(key: K, value: Explicit): void; - set(key: K, value: T[K], explicit: boolean): this; - copyKeyFromSplit(key: keyof T, s: Split): void; - copyKeyFromObject(key: keyof T, s: Partial): void; - /** - * Merge split object into this split object. Properties from the other split - * overwrite properties from this split. - */ - copyAll(other: Split): void; -} -export interface Explicit { - explicit: boolean; - value: T; -} -export declare function makeExplicit(value: T): Explicit; -export declare function makeImplicit(value: T): Explicit; -export declare type SplitParentProperty = 'scale' | 'axis' | 'legend' | ''; -export declare function tieBreakByComparing(compare: (v1: T, v2: T) => number): (v1: Explicit, v2: Explicit, property: keyof S | never, propertyOf: SplitParentProperty) => Explicit; -export declare function defaultTieBreaker(v1: Explicit, v2: Explicit, property: keyof S, propertyOf: SplitParentProperty): Explicit; -export declare function mergeValuesWithExplicit(v1: Explicit, v2: Explicit, property: keyof S, propertyOf: SplitParentProperty, tieBreaker?: (v1: Explicit, v2: Explicit, property: keyof S, propertyOf: string) => Explicit): Explicit; -//# sourceMappingURL=split.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/split.d.ts.map b/node_modules/vega-lite/build/src/compile/split.d.ts.map deleted file mode 100644 index 73dd9b4..0000000 --- a/node_modules/vega-lite/build/src/compile/split.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../../src/compile/split.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH,qBAAa,KAAK,CAAC,CAAC,SAAS,MAAM;aACL,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;aAAuB,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;gBAA/D,QAAQ,GAAE,OAAO,CAAC,CAAC,CAAM,EAAkB,QAAQ,GAAE,OAAO,CAAC,CAAC,CAAM;IAEzF,KAAK;IAIL,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC;IASrB,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAKpC,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAU1D,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAMhE,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO;IAM7D,gBAAgB,CAAC,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,C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UAAU,EAAE,mBAAmB,EAC/B,UAAU,GAAE,CACV,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,EACf,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,EACf,QAAQ,EAAE,MAAM,CAAC,EACjB,UAAU,EAAE,MAAM,KACf,QAAQ,CAAC,CAAC,CAAqB,eAgBrC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/split.js b/node_modules/vega-lite/build/src/compile/split.js deleted file mode 100644 index 522322c..0000000 --- a/node_modules/vega-lite/build/src/compile/split.js +++ /dev/null @@ -1,122 +0,0 @@ -import * as log from '../log'; -import { deepEqual, duplicate, getFirstDefined, keys } from '../util'; -/** - * Generic class for storing properties that are explicitly specified - * and implicitly determined by the compiler. - * This is important for scale/axis/legend merging as - * we want to prioritize properties that users explicitly specified. - */ -// eslint-disable-next-line @typescript-eslint/ban-types -export class Split { - constructor(explicit = {}, implicit = {}) { - this.explicit = explicit; - this.implicit = implicit; - } - clone() { - return new Split(duplicate(this.explicit), duplicate(this.implicit)); - } - combine() { - // FIXME remove "as any". - // Add "as any" to avoid an error "Spread types may only be created from object types". - return Object.assign(Object.assign({}, this.explicit), this.implicit); - } - get(key) { - // Explicit has higher precedence - return getFirstDefined(this.explicit[key], this.implicit[key]); - } - getWithExplicit(key) { - // Explicit has higher precedence - if (this.explicit[key] !== undefined) { - return { explicit: true, value: this.explicit[key] }; - } - else if (this.implicit[key] !== undefined) { - return { explicit: false, value: this.implicit[key] }; - } - return { explicit: false, value: undefined }; - } - setWithExplicit(key, value) { - if (value.value !== undefined) { - this.set(key, value.value, value.explicit); - } - } - set(key, value, explicit) { - delete this[explicit ? 'implicit' : 'explicit'][key]; - this[explicit ? 'explicit' : 'implicit'][key] = value; - return this; - } - copyKeyFromSplit(key, s) { - // Explicit has higher precedence - if (s.explicit[key] !== undefined) { - this.set(key, s.explicit[key], true); - } - else if (s.implicit[key] !== undefined) { - this.set(key, s.implicit[key], false); - } - } - copyKeyFromObject(key, s) { - // Explicit has higher precedence - if (s[key] !== undefined) { - this.set(key, s[key], true); - } - } - /** - * Merge split object into this split object. Properties from the other split - * overwrite properties from this split. - */ - copyAll(other) { - for (const key of keys(other.combine())) { - const val = other.getWithExplicit(key); - this.setWithExplicit(key, val); - } - } -} -export function makeExplicit(value) { - return { - explicit: true, - value - }; -} -export function makeImplicit(value) { - return { - explicit: false, - value - }; -} -export function tieBreakByComparing(compare) { - return (v1, v2, property, propertyOf) => { - const diff = compare(v1.value, v2.value); - if (diff > 0) { - return v1; - } - else if (diff < 0) { - return v2; - } - return defaultTieBreaker(v1, v2, property, propertyOf); - }; -} -export function defaultTieBreaker(v1, v2, property, propertyOf) { - if (v1.explicit && v2.explicit) { - log.warn(log.message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value)); - } - // If equal score, prefer v1. - return v1; -} -export function mergeValuesWithExplicit(v1, v2, property, propertyOf, tieBreaker = defaultTieBreaker) { - if (v1 === undefined || v1.value === undefined) { - // For first run - return v2; - } - if (v1.explicit && !v2.explicit) { - return v1; - } - else if (v2.explicit && !v1.explicit) { - return v2; - } - else if (deepEqual(v1.value, v2.value)) { - return v1; - } - else { - return tieBreaker(v1, v2, property, propertyOf); - } -} -//# sourceMappingURL=split.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/split.js.map b/node_modules/vega-lite/build/src/compile/split.js.map deleted file mode 100644 index c05ef39..0000000 --- a/node_modules/vega-lite/build/src/compile/split.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/compile/split.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAC,MAAM,SAAS,CAAC;AAEpE;;;;;GAKG;AACH,wDAAwD;AACxD,MAAM,OAAO,KAAK;IAChB,YAA4B,WAAuB,EAAE,EAAkB,WAAuB,EAAE;QA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,OAAO,EAAE,CAAC;KACX;SAAM,IAAI,EAAE,CAAC,QAAQ,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE;QACtC,OAAO,EAAE,CAAC;KACX;SAAM,IAAI,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE;QACxC,OAAO,EAAE,CAAC;KACX;SAAM;QACL,OAAO,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;KACjD;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/unit.d.ts b/node_modules/vega-lite/build/src/compile/unit.d.ts deleted file mode 100644 index 4423315..0000000 --- a/node_modules/vega-lite/build/src/compile/unit.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { NewSignal } from 'vega'; -import { Axis } from '../axis'; -import { Channel, ScaleChannel, SingleDefChannel, PositionChannel, NonPositionScaleChannel } from '../channel'; -import { Config } from '../config'; -import * as vlEncoding from '../encoding'; -import { Encoding } from '../encoding'; -import { Legend } from '../legend'; -import { Mark, MarkDef } from '../mark'; -import { Projection } from '../projection'; -import { Domain } from '../scale'; -import { SelectionDef } from '../selection'; -import { LayoutSizeMixins, NormalizedUnitSpec } from '../spec'; -import { StackProperties } from '../stack'; -import { Dict } from '../util'; -import { VgData, VgLayout } from '../vega.schema'; -import { AxisIndex } from './axis/component'; -import { LegendIndex } from './legend/component'; -import { Model, ModelWithField } from './model'; -import { ScaleIndex } from './scale/component'; -/** - * Internal model of Vega-Lite specification for the compiler. - */ -export declare class UnitModel extends ModelWithField { - readonly markDef: MarkDef; - readonly encoding: Encoding; - readonly specifiedScales: ScaleIndex; - readonly stack: StackProperties; - protected specifiedAxes: AxisIndex; - protected specifiedLegends: LegendIndex; - specifiedProjection: Projection; - readonly selection: Dict; - children: Model[]; - constructor(spec: NormalizedUnitSpec, parent: Model, parentGivenName: string, parentGivenSize: LayoutSizeMixins, config: Config); - get hasProjection(): boolean; - /** - * Return specified Vega-Lite scale domain for a particular channel - * @param channel - */ - scaleDomain(channel: ScaleChannel): Domain; - axis(channel: PositionChannel): Axis; - legend(channel: NonPositionScaleChannel): Legend; - private initScales; - private initAxes; - private initLegend; - parseData(): void; - parseLayoutSize(): void; - parseSelections(): void; - parseMarkGroup(): void; - parseAxesAndHeaders(): void; - assembleSelectionTopLevelSignals(signals: any[]): NewSignal[]; - assembleSignals(): NewSignal[]; - assembleSelectionData(data: readonly VgData[]): VgData[]; - assembleLayout(): VgLayout; - assembleLayoutSignals(): NewSignal[]; - assembleMarks(): any[]; - protected getMapping(): vlEncoding.Encoding; - get mark(): Mark; - channelHasField(channel: Channel): boolean; - fieldDef(channel: SingleDefChannel): import("../channeldef").FieldDef; - typedFieldDef(channel: SingleDefChannel): import("../channeldef").TypedFieldDef; -} -//# sourceMappingURL=unit.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/unit.d.ts.map b/node_modules/vega-lite/build/src/compile/unit.d.ts.map deleted file mode 100644 index 1131683..0000000 --- a/node_modules/vega-lite/build/src/compile/unit.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../../src/compile/unit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EACL,OAAO,EAIP,YAAY,EAEZ,gBAAgB,EAIhB,eAAe,EACf,uBAAuB,EACxB,MAAM,YAAY,CAAC;AASpB,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAe,MAAM,aAAa,CAAC;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAsB,IAAI,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;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E,YAAY,GAAG,MAAM;IAK1C,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAIpC,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM;IAIvD,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,QAAQ;IAmBhB,OAAO,CAAC,UAAU;IAaX,SAAS;IAIT,eAAe;IAIf,eAAe;IAIf,cAAc;IAId,mBAAmB;IAInB,gCAAgC,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,SAAS,EAAE;IAI7D,eAAe,IAAI,SAAS,EAAE;IAI9B,qBAAqB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE;IAIxD,cAAc,IAAI,QAAQ;IAI1B,qBAAqB,IAAI,SAAS,EAAE;IAIpC,aAAa;IAapB,SAAS,CAAC,UAAU;IAIpB,IAAW,IAAI,IAAI,IAAI,CAEtB;IAEM,eAAe,CAAC,OAAO,EAAE,OAAO;IAIhC,QAAQ,CAAC,OAAO,EAAE,gBAAgB;IAKlC,aAAa,CAAC,OAAO,EAAE,gBAAgB;CAO/C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/unit.js b/node_modules/vega-lite/build/src/compile/unit.js deleted file mode 100644 index 0df0360..0000000 --- a/node_modules/vega-lite/build/src/compile/unit.js +++ /dev/null @@ -1,172 +0,0 @@ -import { GEOPOSITION_CHANNELS, NONPOSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNELS, SCALE_CHANNELS, supportLegend, X, Y } from '../channel'; -import { getFieldDef, getFieldOrDatumDef, isFieldOrDatumDef, isTypedFieldDef } from '../channeldef'; -import { isGraticuleGenerator } from '../data'; -import * as vlEncoding from '../encoding'; -import { initEncoding } from '../encoding'; -import { GEOSHAPE, isMarkDef } from '../mark'; -import { isFrameMixins } from '../spec/base'; -import { stack } from '../stack'; -import { assembleAxisSignals } from './axis/assemble'; -import { parseUnitAxes } from './axis/parse'; -import { parseData } from './data/parse'; -import { assembleLayoutSignals } from './layoutsize/assemble'; -import { initLayoutSize } from './layoutsize/init'; -import { parseUnitLayoutSize } from './layoutsize/parse'; -import { defaultFilled, initMarkdef } from './mark/init'; -import { parseMarkGroups } from './mark/mark'; -import { isLayerModel, ModelWithField } from './model'; -import { assembleTopLevelSignals, assembleUnitSelectionData, assembleUnitSelectionMarks, assembleUnitSelectionSignals } from './selection/assemble'; -import { parseUnitSelection } from './selection/parse'; -/** - * Internal model of Vega-Lite specification for the compiler. - */ -export class UnitModel extends ModelWithField { - constructor(spec, parent, parentGivenName, parentGivenSize = {}, config) { - super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined); - this.specifiedScales = {}; - this.specifiedAxes = {}; - this.specifiedLegends = {}; - this.specifiedProjection = {}; - this.selection = {}; - this.children = []; - const markDef = isMarkDef(spec.mark) ? Object.assign({}, spec.mark) : { type: spec.mark }; - const mark = markDef.type; - // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding - if (markDef.filled === undefined) { - markDef.filled = defaultFilled(markDef, config, { - graticule: spec.data && isGraticuleGenerator(spec.data) - }); - } - const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config)); - this.markDef = initMarkdef(markDef, encoding, config); - this.size = initLayoutSize({ - encoding: encoding, - size: isFrameMixins(spec) - ? Object.assign(Object.assign(Object.assign({}, parentGivenSize), (spec.width ? { width: spec.width } : {})), (spec.height ? { height: spec.height } : {})) : parentGivenSize - }); - // calculate stack properties - this.stack = stack(mark, encoding); - this.specifiedScales = this.initScales(mark, encoding); - this.specifiedAxes = this.initAxes(encoding); - this.specifiedLegends = this.initLegend(encoding); - this.specifiedProjection = spec.projection; - // Selections will be initialized upon parse. - this.selection = spec.selection; - } - get hasProjection() { - const { encoding } = this; - const isGeoShapeMark = this.mark === GEOSHAPE; - const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel])); - return isGeoShapeMark || hasGeoPosition; - } - /** - * Return specified Vega-Lite scale domain for a particular channel - * @param channel - */ - scaleDomain(channel) { - const scale = this.specifiedScales[channel]; - return scale ? scale.domain : undefined; - } - axis(channel) { - return this.specifiedAxes[channel]; - } - legend(channel) { - return this.specifiedLegends[channel]; - } - initScales(mark, encoding) { - return SCALE_CHANNELS.reduce((scales, channel) => { - var _a; - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - if (fieldOrDatumDef) { - scales[channel] = (_a = fieldOrDatumDef.scale) !== null && _a !== void 0 ? _a : {}; - } - return scales; - }, {}); - } - initAxes(encoding) { - return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => { - // Position Axis - // TODO: handle ConditionFieldDef - const channelDef = encoding[channel]; - if (isFieldOrDatumDef(channelDef) || - (channel === X && isFieldOrDatumDef(encoding.x2)) || - (channel === Y && isFieldOrDatumDef(encoding.y2))) { - const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined; - _axis[channel] = axisSpec ? Object.assign({}, axisSpec) : axisSpec; // convert truthy value to object - } - return _axis; - }, {}); - } - initLegend(encoding) { - return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => { - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - if (fieldOrDatumDef && supportLegend(channel)) { - const legend = fieldOrDatumDef.legend; - _legend[channel] = legend ? Object.assign({}, legend) : legend; // convert truthy value to object - } - return _legend; - }, {}); - } - parseData() { - this.component.data = parseData(this); - } - parseLayoutSize() { - parseUnitLayoutSize(this); - } - parseSelections() { - this.component.selection = parseUnitSelection(this, this.selection); - } - parseMarkGroup() { - this.component.mark = parseMarkGroups(this); - } - parseAxesAndHeaders() { - this.component.axes = parseUnitAxes(this); - } - assembleSelectionTopLevelSignals(signals) { - return assembleTopLevelSignals(this, signals); - } - assembleSignals() { - return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])]; - } - assembleSelectionData(data) { - return assembleUnitSelectionData(this, data); - } - assembleLayout() { - return null; - } - assembleLayoutSignals() { - return assembleLayoutSignals(this); - } - assembleMarks() { - var _a; - let marks = (_a = this.component.mark) !== null && _a !== void 0 ? _a : []; - // If this unit is part of a layer, selections should augment - // all in concert rather than each unit individually. This - // ensures correct interleaving of clipping and brushed marks. - if (!this.parent || !isLayerModel(this.parent)) { - marks = assembleUnitSelectionMarks(this, marks); - } - return marks.map(this.correctDataNames); - } - getMapping() { - return this.encoding; - } - get mark() { - return this.markDef.type; - } - channelHasField(channel) { - return vlEncoding.channelHasField(this.encoding, channel); - } - fieldDef(channel) { - const channelDef = this.encoding[channel]; - return getFieldDef(channelDef); - } - typedFieldDef(channel) { - const fieldDef = this.fieldDef(channel); - if (isTypedFieldDef(fieldDef)) { - return fieldDef; - } - return null; - } -} -//# sourceMappingURL=unit.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compile/unit.js.map b/node_modules/vega-lite/build/src/compile/unit.js.map deleted file mode 100644 index 2fca2a8..0000000 --- a/node_modules/vega-lite/build/src/compile/unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unit.js","sourceRoot":"","sources":["../../../src/compile/unit.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EAEvB,cAAc,EAEd,aAAa,EACb,CAAC,EACD,CAAC,EAGF,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EAGhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAW,YAAY,EAAC,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAgB,MAAM,SAAS,CAAC;AAK3D,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,KAAK,EAAkB,MAAM,UAAU,CAA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KAAK,GAAG,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC1C,CAAC;IAES,UAAU;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAEM,eAAe,CAAC,OAAgB;QACrC,OAAO,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACvC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,WAAW,CAAS,UAAU,CAAC,CAAC;IACzC,CAAC;IAEM,aAAa,CAAC,OAAyB;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE;YAC7B,OAAO,QAAQ,CAAC;SACjB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/base.d.ts b/node_modules/vega-lite/build/src/compositemark/base.d.ts deleted file mode 100644 index d447c57..0000000 --- a/node_modules/vega-lite/build/src/compositemark/base.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Encoding } from '../encoding'; -import { GenericMarkDef } from '../mark'; -import { NonFacetUnitNormalizer, Normalize, NormalizerParams } from '../normalize/base'; -import { GenericSpec } from '../spec'; -import { GenericLayerSpec, NormalizedLayerSpec } from '../spec/layer'; -import { GenericUnitSpec, NormalizedUnitSpec } from '../spec/unit'; -import { FieldName } from '../channeldef'; -export declare type CompositeMarkUnitSpec = GenericUnitSpec>; -export declare class CompositeMarkNormalizer implements NonFacetUnitNormalizer> { - name: string; - run: (spec: CompositeMarkUnitSpec, params: NormalizerParams, normalize: Normalize, M> | GenericLayerSpec, NormalizedLayerSpec | NormalizedUnitSpec>) => NormalizedLayerSpec | NormalizedUnitSpec; - constructor(name: string, run: (spec: CompositeMarkUnitSpec, params: NormalizerParams, normalize: Normalize, M> | GenericLayerSpec, NormalizedLayerSpec | NormalizedUnitSpec>) => NormalizedLayerSpec | NormalizedUnitSpec); - hasMatchingType(spec: GenericSpec): spec is CompositeMarkUnitSpec; -} -//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/base.d.ts.map b/node_modules/vega-lite/build/src/compositemark/base.d.ts.map deleted file mode 100644 index 066e23a..0000000 --- a/node_modules/vega-lite/build/src/compositemark/base.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/compositemark/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,cAAc,EAAc,MAAM,SAAS,CAAC;AACpD,OAAO,EAAC,sBAAsB,EAAE,SAAS,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,eAAe,EAAc,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAGxC,oBAAY,qBAAqB,CAAC,CAAC,SAAS,MAAM,IAAI,eAAe,CAAC,GAAG,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAElG,qBAAa,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAAE,YAAW,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAEvG,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,CACV,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAC9B,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,SAAS,CAElB,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAE/D,mBAAmB,GAAG,kBAAkB,CACzC,KACE,mBAAmB,GAAG,kBAAkB;gBAVtC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,CACV,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAC9B,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,SAAS,CAElB,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAE/D,mBAAmB,GAAG,kBAAkB,CACzC,KACE,mBAAmB,GAAG,kBAAkB;IAGxC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,IAAI,qBAAqB,CAAC,CAAC,CAAC;CAMhG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/base.js b/node_modules/vega-lite/build/src/compositemark/base.js deleted file mode 100644 index 6e6af8e..0000000 --- a/node_modules/vega-lite/build/src/compositemark/base.js +++ /dev/null @@ -1,15 +0,0 @@ -import { getMarkType } from '../mark'; -import { isUnitSpec } from '../spec/unit'; -export class CompositeMarkNormalizer { - constructor(name, run) { - this.name = name; - this.run = run; - } - hasMatchingType(spec) { - if (isUnitSpec(spec)) { - return getMarkType(spec.mark) === this.name; - } - return false; - } -} -//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/base.js.map b/node_modules/vega-lite/build/src/compositemark/base.js.map deleted file mode 100644 index fa50335..0000000 --- a/node_modules/vega-lite/build/src/compositemark/base.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/compositemark/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,WAAW,EAAC,MAAM,SAAS,CAAC;AAIpD,OAAO,EAAkB,UAAU,EAAqB,MAAM,cAAc,CAAC;AAM7E,MAAM,OAAO,uBAAuB;IAClC,YACS,IAAY,EACZ,GASsC;QAVtC,SAAI,GAAJ,IAAI,CAAQ;QACZ,QAAG,GAAH,GAAG,CASmC;IAC5C,CAAC;IAEG,eAAe,CAAC,IAAqC;QAC1D,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC;SAC7C;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/boxplot.d.ts b/node_modules/vega-lite/build/src/compositemark/boxplot.d.ts deleted file mode 100644 index d11d67a..0000000 --- a/node_modules/vega-lite/build/src/compositemark/boxplot.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Orientation } from 'vega'; -import { Encoding } from '../encoding'; -import { NormalizerParams } from '../normalize'; -import { GenericUnitSpec, NormalizedLayerSpec } from '../spec'; -import { CompositeMarkNormalizer } from './base'; -import { GenericCompositeMarkDef, PartsMixins } from './common'; -export declare const BOXPLOT: "boxplot"; -export declare type BoxPlot = typeof BOXPLOT; -export declare const BOXPLOT_PARTS: readonly ["box", "median", "outliers", "rule", "ticks"]; -declare type BoxPlotPart = typeof BOXPLOT_PARTS[number]; -export declare type BoxPlotPartsMixins = PartsMixins; -export interface BoxPlotConfig extends BoxPlotPartsMixins { - /** Size of the box and median tick of a box plot */ - size?: number; - /** - * The extent of the whiskers. Available options include: - * - `"min-max"`: min and max are the lower and upper whiskers respectively. - * - A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_). - * - * __Default value:__ `1.5`. - */ - extent?: 'min-max' | number; -} -export declare type BoxPlotDef = GenericCompositeMarkDef & BoxPlotConfig & { - /** - * Type of the mark. For box plots, this should always be `"boxplot"`. - * [boxplot](https://vega.github.io/vega-lite/docs/boxplot.html) - */ - type: BoxPlot; - /** - * Orientation of the box plot. This is normally automatically determined based on types of fields on x and y channels. However, an explicit `orient` be specified when the orientation is ambiguous. - * - * __Default value:__ `"vertical"`. - */ - orient?: Orientation; -}; -export interface BoxPlotConfigMixins { - /** - * Box Config - */ - boxplot?: BoxPlotConfig; -} -export declare const boxPlotNormalizer: CompositeMarkNormalizer<"boxplot">; -export declare function getBoxPlotType(extent: number | 'min-max'): "min-max" | "tukey"; -export declare function normalizeBoxPlot(spec: GenericUnitSpec, BoxPlot | BoxPlotDef>, { config }: NormalizerParams): NormalizedLayerSpec; -export {}; -//# sourceMappingURL=boxplot.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/boxplot.d.ts.map b/node_modules/vega-lite/build/src/compositemark/boxplot.d.ts.map deleted file mode 100644 index 47f6412..0000000 --- a/node_modules/vega-lite/build/src/compositemark/boxplot.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boxplot.d.ts","sourceRoot":"","sources":["../../../src/compositemark/boxplot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AAIjC,OAAO,EAAC,QAAQ,EAAmD,MAAM,aAAa,CAAC;AAGvF,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAqB,MAAM,SAAS,CAAC;AAGjF,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAIL,uBAAuB,EAKvB,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,OAAO,WAAqB,CAAC;AAC1C,oBAAY,OAAO,GAAG,OAAO,OAAO,CAAC;AAErC,eAAO,MAAM,aAAa,yDAA0D,CAAC;AAErF,aAAK,WAAW,GAAG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAEhD,oBAAY,kBAAkB,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;AAE1D,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAC7B;AAED,oBAAY,UAAU,GAAG,uBAAuB,CAAC,OAAO,CAAC,GACvD,aAAa,GAAG;IACd;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEJ,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,eAAO,MAAM,iBAAiB,oCAAyD,CAAC;AAExF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,uBAMxD;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,EAC7D,EAAC,MAAM,EAAC,EAAE,gBAAgB,GACzB,mBAAmB,CA4PrB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/boxplot.js b/node_modules/vega-lite/build/src/compositemark/boxplot.js deleted file mode 100644 index 84e1267..0000000 --- a/node_modules/vega-lite/build/src/compositemark/boxplot.js +++ /dev/null @@ -1,272 +0,0 @@ -import { __rest } from "tslib"; -import { isNumber, isObject } from 'vega-util'; -import { getMarkPropOrConfig } from '../compile/common'; -import { extractTransformsFromEncoding, normalizeEncoding } from '../encoding'; -import * as log from '../log'; -import { isMarkDef } from '../mark'; -import { isEmpty, omit } from '../util'; -import { CompositeMarkNormalizer } from './base'; -import { compositeMarkContinuousAxis, compositeMarkOrient, filterTooltipWithAggregatedField, getCompositeMarkTooltip, getTitle, makeCompositeAggregatePartFactory, partLayerMixins } from './common'; -export const BOXPLOT = 'boxplot'; -export const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks']; -export const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot); -export function getBoxPlotType(extent) { - if (isNumber(extent)) { - return 'tukey'; - } - // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now. - return extent; -} -export function normalizeBoxPlot(spec, { config }) { - var _a, _b; - // Need to initEncoding first so we can infer type - spec = Object.assign(Object.assign({}, spec), { encoding: normalizeEncoding(spec.encoding, config) }); - const { mark, encoding: _encoding, selection, projection: _p } = spec, outerSpec = __rest(spec, ["mark", "encoding", "selection", "projection"]); - const markDef = isMarkDef(mark) ? mark : { type: mark }; - // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - if (selection) { - log.warn(log.message.selectionNotSupported('boxplot')); - } - const extent = (_a = markDef.extent) !== null && _a !== void 0 ? _a : config.boxplot.extent; - const sizeValue = getMarkPropOrConfig('size', markDef, // TODO: https://github.com/vega/vega-lite/issues/6245 - config); - const boxPlotType = getBoxPlotType(extent); - const { transform, continuousAxisChannelDef, continuousAxis, groupby, aggregate, encodingWithoutContinuousAxis, ticksOrient, boxOrient, customTooltipWithoutAggregatedField } = boxParams(spec, extent, config); - const { color, size } = encodingWithoutContinuousAxis, encodingWithoutSizeColorAndContinuousAxis = __rest(encodingWithoutContinuousAxis, ["color", "size"]); - const makeBoxPlotPart = (sharedEncoding) => { - return makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, config.boxplot); - }; - const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis); - const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis); - const makeBoxPlotMidTick = makeBoxPlotPart(Object.assign(Object.assign({}, encodingWithoutSizeColorAndContinuousAxis), (size ? { size } : {}))); - const fiveSummaryTooltipEncoding = getCompositeMarkTooltip([ - { fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max' }, - { fieldPrefix: 'upper_box_', titlePrefix: 'Q3' }, - { fieldPrefix: 'mid_box_', titlePrefix: 'Median' }, - { fieldPrefix: 'lower_box_', titlePrefix: 'Q1' }, - { fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min' } - ], continuousAxisChannelDef, encodingWithoutContinuousAxis); - // ## Whisker Layers - const endTick = { type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid: null, aria: false }; - const whiskerTooltipEncoding = boxPlotType === 'min-max' - ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker - : // for tukey / k-IQR, just show upper/lower-whisker - getCompositeMarkTooltip([ - { fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker' }, - { fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker' } - ], continuousAxisChannelDef, encodingWithoutContinuousAxis); - const whiskerLayers = [ - ...makeBoxPlotExtent({ - partName: 'rule', - mark: { type: 'rule', invalid: null, aria: false }, - positionPrefix: 'lower_whisker', - endPositionPrefix: 'lower_box', - extraEncoding: whiskerTooltipEncoding - }), - ...makeBoxPlotExtent({ - partName: 'rule', - mark: { type: 'rule', invalid: null, aria: false }, - positionPrefix: 'upper_box', - endPositionPrefix: 'upper_whisker', - extraEncoding: whiskerTooltipEncoding - }), - ...makeBoxPlotExtent({ - partName: 'ticks', - mark: endTick, - positionPrefix: 'lower_whisker', - extraEncoding: whiskerTooltipEncoding - }), - ...makeBoxPlotExtent({ - partName: 'ticks', - mark: endTick, - positionPrefix: 'upper_whisker', - extraEncoding: whiskerTooltipEncoding - }) - ]; - // ## Box Layers - // TODO: support hiding certain mark parts - const boxLayers = [ - ...(boxPlotType !== 'tukey' ? whiskerLayers : []), - ...makeBoxPlotBox({ - partName: 'box', - mark: Object.assign(Object.assign({ type: 'bar' }, (sizeValue ? { size: sizeValue } : {})), { orient: boxOrient, invalid: null, ariaRoleDescription: 'box' }), - positionPrefix: 'lower_box', - endPositionPrefix: 'upper_box', - extraEncoding: fiveSummaryTooltipEncoding - }), - ...makeBoxPlotMidTick({ - partName: 'median', - mark: Object.assign(Object.assign(Object.assign({ type: 'tick', invalid: null }, (isObject(config.boxplot.median) && config.boxplot.median.color ? { color: config.boxplot.median.color } : {})), (sizeValue ? { size: sizeValue } : {})), { orient: ticksOrient, aria: false }), - positionPrefix: 'mid_box', - extraEncoding: fiveSummaryTooltipEncoding - }) - ]; - // ## Filtered Layers - let filteredLayersMixins; - if (boxPlotType !== 'min-max') { - const lowerBoxExpr = `datum["lower_box_${continuousAxisChannelDef.field}"]`; - const upperBoxExpr = `datum["upper_box_${continuousAxisChannelDef.field}"]`; - const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`; - const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`; - const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`; - const fieldExpr = `datum["${continuousAxisChannelDef.field}"]`; - const joinaggregateTransform = { - joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field), - groupby - }; - let filteredWhiskerSpec = undefined; - if (boxPlotType === 'tukey') { - filteredWhiskerSpec = { - transform: [ - { - filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})` - }, - { - aggregate: [ - { - op: 'min', - field: continuousAxisChannelDef.field, - as: 'lower_whisker_' + continuousAxisChannelDef.field - }, - { - op: 'max', - field: continuousAxisChannelDef.field, - as: 'upper_whisker_' + continuousAxisChannelDef.field - }, - // preserve lower_box / upper_box - { - op: 'min', - field: 'lower_box_' + continuousAxisChannelDef.field, - as: 'lower_box_' + continuousAxisChannelDef.field - }, - { - op: 'max', - field: 'upper_box_' + continuousAxisChannelDef.field, - as: 'upper_box_' + continuousAxisChannelDef.field - }, - ...aggregate - ], - groupby - } - ], - layer: whiskerLayers - }; - } - const { tooltip } = encodingWithoutSizeColorAndContinuousAxis, encodingWithoutSizeColorContinuousAxisAndTooltip = __rest(encodingWithoutSizeColorAndContinuousAxis, ["tooltip"]); - const { scale, axis } = continuousAxisChannelDef; - const title = getTitle(continuousAxisChannelDef); - const axisWithoutTitle = omit(axis, ['title']); - const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, { - transform: [{ filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})` }], - mark: 'point', - encoding: Object.assign(Object.assign({ [continuousAxis]: Object.assign(Object.assign(Object.assign({ field: continuousAxisChannelDef.field, type: continuousAxisChannelDef.type }, (title !== undefined ? { title } : {})), (scale !== undefined ? { scale } : {})), (isEmpty(axisWithoutTitle) ? {} : { axis: axisWithoutTitle })) }, encodingWithoutSizeColorContinuousAxisAndTooltip), (customTooltipWithoutAggregatedField ? { tooltip: customTooltipWithoutAggregatedField } : {})) - })[0]; - if (outlierLayersMixins && filteredWhiskerSpec) { - filteredLayersMixins = { - transform: [joinaggregateTransform], - layer: [outlierLayersMixins, filteredWhiskerSpec] - }; - } - else if (outlierLayersMixins) { - filteredLayersMixins = outlierLayersMixins; - filteredLayersMixins.transform.unshift(joinaggregateTransform); - } - else if (filteredWhiskerSpec) { - filteredLayersMixins = filteredWhiskerSpec; - filteredLayersMixins.transform.unshift(joinaggregateTransform); - } - } - if (filteredLayersMixins) { - // tukey box plot with outliers included - return Object.assign(Object.assign({}, outerSpec), { layer: [ - filteredLayersMixins, - { - // boxplot - transform, - layer: boxLayers - } - ] }); - } - return Object.assign(Object.assign({}, outerSpec), { transform: ((_b = outerSpec.transform) !== null && _b !== void 0 ? _b : []).concat(transform), layer: boxLayers }); -} -function boxParamsQuartiles(continousAxisField) { - return [ - { - op: 'q1', - field: continousAxisField, - as: 'lower_box_' + continousAxisField - }, - { - op: 'q3', - field: continousAxisField, - as: 'upper_box_' + continousAxisField - } - ]; -} -function boxParams(spec, extent, config) { - const orient = compositeMarkOrient(spec, BOXPLOT); - const { continuousAxisChannelDef, continuousAxis } = compositeMarkContinuousAxis(spec, orient, BOXPLOT); - const continuousFieldName = continuousAxisChannelDef.field; - const boxPlotType = getBoxPlotType(extent); - const boxplotSpecificAggregate = [ - ...boxParamsQuartiles(continuousFieldName), - { - op: 'median', - field: continuousFieldName, - as: 'mid_box_' + continuousFieldName - }, - { - op: 'min', - field: continuousFieldName, - as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName - }, - { - op: 'max', - field: continuousFieldName, - as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName - } - ]; - const postAggregateCalculates = boxPlotType === 'min-max' || boxPlotType === 'tukey' - ? [] - : [ - // This is for the original k-IQR, which we do not expose - { - calculate: `datum["upper_box_${continuousFieldName}"] - datum["lower_box_${continuousFieldName}"]`, - as: 'iqr_' + continuousFieldName - }, - { - calculate: `min(datum["upper_box_${continuousFieldName}"] + datum["iqr_${continuousFieldName}"] * ${extent}, datum["max_${continuousFieldName}"])`, - as: 'upper_whisker_' + continuousFieldName - }, - { - calculate: `max(datum["lower_box_${continuousFieldName}"] - datum["iqr_${continuousFieldName}"] * ${extent}, datum["min_${continuousFieldName}"])`, - as: 'lower_whisker_' + continuousFieldName - } - ]; - const _a = spec.encoding, _b = continuousAxis, oldContinuousAxisChannelDef = _a[_b], oldEncodingWithoutContinuousAxis = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]); - const { customTooltipWithoutAggregatedField, filteredEncoding } = filterTooltipWithAggregatedField(oldEncodingWithoutContinuousAxis); - const { bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(filteredEncoding, config); - const ticksOrient = orient === 'vertical' ? 'horizontal' : 'vertical'; - const boxOrient = orient; - const transform = [ - ...bins, - ...timeUnits, - { - aggregate: [...aggregate, ...boxplotSpecificAggregate], - groupby - }, - ...postAggregateCalculates - ]; - return { - transform, - groupby, - aggregate, - continuousAxisChannelDef, - continuousAxis, - encodingWithoutContinuousAxis, - ticksOrient, - boxOrient, - customTooltipWithoutAggregatedField - }; -} -//# sourceMappingURL=boxplot.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/boxplot.js.map b/node_modules/vega-lite/build/src/compositemark/boxplot.js.map deleted file mode 100644 index 4bb1ac6..0000000 --- a/node_modules/vega-lite/build/src/compositemark/boxplot.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boxplot.js","sourceRoot":"","sources":["../../../src/compositemark/boxplot.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAW,6BAA6B,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACvF,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,SAAS,EAAU,MAAM,SAAS,CAAC;AAI3C,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,gCAAgC,EAEhC,uBAAuB,EACvB,QAAQ,EACR,iCAAiC,EACjC,eAAe,EAEhB,MAAM,UAAU,CAAC;AAElB,MAAM,CAAC,MAAM,OAAO,GAAG,SAAkB,CAAC;AAG1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AA2C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,EAAC,GAAG,gCAAgC,CAC9F,gCAAgC,CACjC,CAAC;IAEF,MAAM,EAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,6BAA6B,EAAC,GAAG,6BAA6B,CAClH,gBAAgB,EAChB,MAAM,CACP,CAAC;IAEF,MAAM,WAAW,GAAgB,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;IACnF,MAAM,SAAS,GAAgB,MAAM,CAAC;IAEtC,MAAM,SAAS,GAAgB;QAC7B,GAAG,IAAI;QACP,GAAG,SAAS;QACZ;YACE,SAAS,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,wBAAwB,CAAC;YACtD,OAAO;SACR;QACD,GAAG,uBAAuB;KAC3B,CAAC;IAEF,OAAO;QACL,SAAS;QACT,OAAO;QACP,SAAS;QACT,wBAAwB;QACxB,cAAc;QACd,6BAA6B;QAC7B,WAAW;QACX,SAAS;QACT,mCAAmC;KACpC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/common.d.ts b/node_modules/vega-lite/build/src/compositemark/common.d.ts deleted file mode 100644 index 4882ad6..0000000 --- a/node_modules/vega-lite/build/src/compositemark/common.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Orientation, SignalRef, Text } from 'vega'; -import { CompositeMark, CompositeMarkDef } from '.'; -import { Field, PositionFieldDef, SecondaryFieldDef, StringFieldDef, StringFieldDefWithCondition, StringValueDefWithCondition } from '../channeldef'; -import { Encoding } from '../encoding'; -import { ColorMixins, GenericMarkDef, Mark, MarkConfig, MarkDef } from '../mark'; -import { GenericUnitSpec, NormalizedUnitSpec } from '../spec'; -export declare type PartsMixins

= Partial>; -export declare type GenericCompositeMarkDef = GenericMarkDef & ColorMixins & { - /** - * The opacity (value between [0,1]) of the mark. - */ - opacity?: number; - /** - * Whether a composite mark be clipped to the enclosing group’s width and height. - */ - clip?: boolean; -}; -export interface CompositeMarkTooltipSummary { - /** - * The prefix of the field to be shown in tooltip - */ - fieldPrefix: string; - /** - * The title prefix to show, corresponding to the field with field prefix `fieldPrefix` - */ - titlePrefix: Text | SignalRef; -} -export declare function filterTooltipWithAggregatedField(oldEncoding: Encoding): { - customTooltipWithoutAggregatedField?: StringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[]; - filteredEncoding: Encoding; -}; -export declare function getCompositeMarkTooltip(tooltipSummary: CompositeMarkTooltipSummary[], continuousAxisChannelDef: PositionFieldDef, encodingWithoutContinuousAxis: Encoding, withFieldName?: boolean): Encoding; -export declare function getTitle(continuousAxisChannelDef: PositionFieldDef): string | string[] | SignalRef; -export declare function makeCompositeAggregatePartFactory

>(compositeMarkDef: GenericCompositeMarkDef & P, continuousAxis: 'x' | 'y', continuousAxisChannelDef: PositionFieldDef, sharedEncoding: Encoding, compositeMarkConfig: P): ({ partName, mark, positionPrefix, endPositionPrefix, extraEncoding }: { - partName: keyof P; - mark: Mark | MarkDef; - positionPrefix: string; - endPositionPrefix?: string; - extraEncoding?: Encoding; -}) => NormalizedUnitSpec[]; -export declare function partLayerMixins

>(markDef: GenericCompositeMarkDef & P, part: keyof P, compositeMarkConfig: P, partBaseSpec: NormalizedUnitSpec): NormalizedUnitSpec[]; -export declare function compositeMarkContinuousAxis(spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>, orient: Orientation, compositeMark: M): { - continuousAxisChannelDef: PositionFieldDef; - continuousAxisChannelDef2: SecondaryFieldDef; - continuousAxisChannelDefError: SecondaryFieldDef; - continuousAxisChannelDefError2: SecondaryFieldDef; - continuousAxis: 'x' | 'y'; -}; -export declare function compositeMarkOrient(spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>, compositeMark: M): Orientation; -//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/common.d.ts.map b/node_modules/vega-lite/build/src/compositemark/common.d.ts.map deleted file mode 100644 index c8d6966..0000000 --- a/node_modules/vega-lite/build/src/compositemark/common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/compositemark/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAElD,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,GAAG,CAAC;AAClD,OAAO,EACL,KAAK,EAKL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,QAAQ,EAAY,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAC,WAAW,EAAE,cAAc,EAAa,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAK5D,oBAAY,WAAW,CAAC,CAAC,SAAS,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC;AAErF,oBAAY,uBAAuB,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,GACxD,WAAW,GAAG;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEJ,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,EAAE,IAAI,GAAG,SAAS,CAAC;CAC/B;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,KAAK,EAC9D,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,GACvB;IACD,mCAAmC,CAAC,EAChC,2BAA2B,CAAC,CAAC,CAAC,GAC9B,2BAA2B,CAAC,CAAC,CAAC,G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AAC,CAAC;IACnD,yBAAyB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACrD,6BAA6B,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACzD,8BAA8B,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1D,cAAc,EAAE,GAAG,GAAG,GAAG,CAAC;CAC3B,CAgBA;AAiBD,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,aAAa,EACzD,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,gBAAgB,CAAC,EACzE,aAAa,EAAE,CAAC,GACf,WAAW,CAwCb"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/common.js b/node_modules/vega-lite/build/src/compositemark/common.js deleted file mode 100644 index b43b79d..0000000 --- a/node_modules/vega-lite/build/src/compositemark/common.js +++ /dev/null @@ -1,168 +0,0 @@ -import { __rest } from "tslib"; -import { isArray, isBoolean, isString } from 'vega-util'; -import { isContinuousFieldOrDatumDef, isFieldDef, isFieldOrDatumDefForTimeFormat } from '../channeldef'; -import { fieldDefs } from '../encoding'; -import * as log from '../log'; -import { isMarkDef } from '../mark'; -import { getFirstDefined, hash, unique } from '../util'; -import { isSignalRef } from '../vega.schema'; -import { toStringFieldDef } from './../channeldef'; -export function filterTooltipWithAggregatedField(oldEncoding) { - const { tooltip } = oldEncoding, filteredEncoding = __rest(oldEncoding, ["tooltip"]); - if (!tooltip) { - return { filteredEncoding }; - } - let customTooltipWithAggregatedField; - let customTooltipWithoutAggregatedField; - if (isArray(tooltip)) { - for (const t of tooltip) { - if (t.aggregate) { - if (!customTooltipWithAggregatedField) { - customTooltipWithAggregatedField = []; - } - customTooltipWithAggregatedField.push(t); - } - else { - if (!customTooltipWithoutAggregatedField) { - customTooltipWithoutAggregatedField = []; - } - customTooltipWithoutAggregatedField.push(t); - } - } - if (customTooltipWithAggregatedField) { - filteredEncoding.tooltip = customTooltipWithAggregatedField; - } - } - else { - if (tooltip['aggregate']) { - filteredEncoding.tooltip = tooltip; - } - else { - customTooltipWithoutAggregatedField = tooltip; - } - } - if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) { - customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0]; - } - return { customTooltipWithoutAggregatedField, filteredEncoding }; -} -export function getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, withFieldName = true) { - if ('tooltip' in encodingWithoutContinuousAxis) { - return { tooltip: encodingWithoutContinuousAxis.tooltip }; - } - const fiveSummaryTooltip = tooltipSummary.map(({ fieldPrefix, titlePrefix }) => { - const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : ''; - return { - field: fieldPrefix + continuousAxisChannelDef.field, - type: continuousAxisChannelDef.type, - title: isSignalRef(titlePrefix) ? { signal: titlePrefix + `"${escape(mainTitle)}"` } : titlePrefix + mainTitle - }; - }); - const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef); - return { - tooltip: [ - ...fiveSummaryTooltip, - // need to cast because TextFieldDef supports fewer types of bin - ...unique(tooltipFieldDefs, hash) - ] - }; -} -export function getTitle(continuousAxisChannelDef) { - const { title, field } = continuousAxisChannelDef; - return getFirstDefined(title, field); -} -export function makeCompositeAggregatePartFactory(compositeMarkDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, compositeMarkConfig) { - const { scale, axis } = continuousAxisChannelDef; - return ({ partName, mark, positionPrefix, endPositionPrefix = undefined, extraEncoding = {} }) => { - const title = getTitle(continuousAxisChannelDef); - return partLayerMixins(compositeMarkDef, partName, compositeMarkConfig, { - mark, - encoding: Object.assign(Object.assign(Object.assign({ [continuousAxis]: Object.assign(Object.assign(Object.assign({ field: positionPrefix + '_' + continuousAxisChannelDef.field, type: continuousAxisChannelDef.type }, (title !== undefined ? { title } : {})), (scale !== undefined ? { scale } : {})), (axis !== undefined ? { axis } : {})) }, (isString(endPositionPrefix) - ? { - [continuousAxis + '2']: { - field: endPositionPrefix + '_' + continuousAxisChannelDef.field - } - } - : {})), sharedEncoding), extraEncoding) - }); - }; -} -export function partLayerMixins(markDef, part, compositeMarkConfig, partBaseSpec) { - const { clip, color, opacity } = markDef; - const mark = markDef.type; - if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) { - return [ - Object.assign(Object.assign({}, partBaseSpec), { mark: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, compositeMarkConfig[part]), (clip ? { clip } : {})), (color ? { color } : {})), (opacity ? { opacity } : {})), (isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : { type: partBaseSpec.mark })), { style: `${mark}-${part}` }), (isBoolean(markDef[part]) ? {} : markDef[part])) }) - ]; - } - return []; -} -export function compositeMarkContinuousAxis(spec, orient, compositeMark) { - const { encoding } = spec; - const continuousAxis = orient === 'vertical' ? 'y' : 'x'; - const continuousAxisChannelDef = encoding[continuousAxis]; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal. - const continuousAxisChannelDef2 = encoding[continuousAxis + '2']; - const continuousAxisChannelDefError = encoding[continuousAxis + 'Error']; - const continuousAxisChannelDefError2 = encoding[continuousAxis + 'Error2']; - return { - continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark), - continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark), - continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark), - continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark), - continuousAxis - }; -} -function filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark) { - if (continuousAxisChannelDef && continuousAxisChannelDef.aggregate) { - const { aggregate } = continuousAxisChannelDef, continuousAxisWithoutAggregate = __rest(continuousAxisChannelDef, ["aggregate"]); - if (aggregate !== compositeMark) { - log.warn(log.message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark)); - } - return continuousAxisWithoutAggregate; - } - else { - return continuousAxisChannelDef; - } -} -export function compositeMarkOrient(spec, compositeMark) { - const { mark, encoding } = spec; - const { x, y } = encoding; - if (isMarkDef(mark) && mark.orient) { - return mark.orient; - } - if (isContinuousFieldOrDatumDef(x)) { - // x is continuous - if (isContinuousFieldOrDatumDef(y)) { - // both x and y are continuous - const xAggregate = isFieldDef(x) && x.aggregate; - const yAggregate = isFieldDef(y) && y.aggregate; - if (!xAggregate && yAggregate === compositeMark) { - return 'vertical'; - } - else if (!yAggregate && xAggregate === compositeMark) { - return 'horizontal'; - } - else if (xAggregate === compositeMark && yAggregate === compositeMark) { - throw new Error('Both x and y cannot have aggregate'); - } - else { - if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) { - // y is temporal but x is not - return 'horizontal'; - } - // default orientation for two continuous - return 'vertical'; - } - } - return 'horizontal'; - } - else if (isContinuousFieldOrDatumDef(y)) { - // y is continuous but x is not - return 'vertical'; - } - else { - // Neither x nor y is continuous. - throw new Error(`Need a valid continuous axis for ${compositeMark}s`); - } -} -//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/common.js.map b/node_modules/vega-lite/build/src/compositemark/common.js.map deleted file mode 100644 index 84032f9..0000000 --- a/node_modules/vega-lite/build/src/compositemark/common.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/compositemark/common.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEvD,OAAO,EAGL,2BAA2B,EAC3B,UAAU,EACV,8BAA8B,EAM/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAW,SAAS,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAA8B,SAAS,EAA4B,MAAM,SAAS,CAA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C,CAAC,CAAC,EAAE;YAClC,8BAA8B;YAC9B,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;YAChD,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;YAEhD,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,aAAa,EAAE;gBAC/C,OAAO,UAAU,CAAC;aACnB;iBAAM,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,aAAa,EAAE;gBACtD,OAAO,YAAY,CAAC;aACrB;iBAAM,IAAI,UAAU,KAAK,aAAa,IAAI,UAAU,KAAK,aAAa,EAAE;gBACvE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;aACvD;iBAAM;gBACL,IAAI,8BAA8B,CAAC,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC,EAAE;oBAC3E,6BAA6B;oBAC7B,OAAO,YAAY,CAAC;iBACrB;gBAED,yCAAyC;gBACzC,OAAO,UAAU,CAAC;aACnB;SACF;QAED,OAAO,YAAY,CAAC;KACrB;SAAM,IAAI,2BAA2B,CAAC,CAAC,CAAC,EAAE;QACzC,+BAA+B;QAC/B,OAAO,UAAU,CAAC;KACnB;SAAM;QACL,iCAAiC;QACjC,MAAM,IAAI,KAAK,CAAC,oCAAoC,aAAa,GAAG,CAAC,CAAC;KACvE;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/errorband.d.ts b/node_modules/vega-lite/build/src/compositemark/errorband.d.ts deleted file mode 100644 index 4dc845a..0000000 --- a/node_modules/vega-lite/build/src/compositemark/errorband.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { Interpolate, Orientation } from 'vega'; -import { Field } from '../channeldef'; -import { Encoding } from '../encoding'; -import { NormalizerParams } from '../normalize'; -import { GenericUnitSpec, NormalizedLayerSpec } from '../spec'; -import { CompositeMarkNormalizer } from './base'; -import { GenericCompositeMarkDef, PartsMixins } from './common'; -import { ErrorBarCenter, ErrorBarExtent, ErrorEncoding } from './errorbar'; -export declare type ErrorBandUnitSpec = GenericUnitSpec & EE, ErrorBand | ErrorBandDef>; -export declare const ERRORBAND: "errorband"; -export declare type ErrorBand = typeof ERRORBAND; -export declare const ERRORBAND_PARTS: readonly ["band", "borders"]; -declare type ErrorBandPart = typeof ERRORBAND_PARTS[number]; -export declare type ErrorBandPartsMixins = PartsMixins; -export interface ErrorBandConfig extends ErrorBandPartsMixins { - /** - * The center of the error band. Available options include: - * - `"mean"`: the mean of the data points. - * - `"median"`: the median of the data points. - * - * __Default value:__ `"mean"`. - * @hidden - */ - center?: ErrorBarCenter; - /** - * The extent of the band. Available options include: - * - `"ci"`: Extend the band to the confidence interval of the mean. - * - `"stderr"`: The size of band are set to the value of standard error, extending from the mean. - * - `"stdev"`: The size of band are set to the value of standard deviation, extending from the mean. - * - `"iqr"`: Extend the band to the q1 and q3. - * - * __Default value:__ `"stderr"`. - */ - extent?: ErrorBarExtent; - /** - * The line interpolation method for the error band. One of the following: - * - `"linear"`: piecewise linear segments, as in a polyline. - * - `"linear-closed"`: close the linear segments to form a polygon. - * - `"step"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes at the midpoint of each pair of adjacent x-values. - * - `"step-before"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes before the x-value. - * - `"step-after"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes after the x-value. - * - `"basis"`: a B-spline, with control point duplication on the ends. - * - `"basis-open"`: an open B-spline; may not intersect the start or end. - * - `"basis-closed"`: a closed B-spline, as in a loop. - * - `"cardinal"`: a Cardinal spline, with control point duplication on the ends. - * - `"cardinal-open"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points. - * - `"cardinal-closed"`: a closed Cardinal spline, as in a loop. - * - `"bundle"`: equivalent to basis, except the tension parameter is used to straighten the spline. - * - `"monotone"`: cubic interpolation that preserves monotonicity in y. - */ - interpolate?: Interpolate; - /** - * The tension parameter for the interpolation type of the error band. - * - * @minimum 0 - * @maximum 1 - */ - tension?: number; -} -export declare type ErrorBandDef = GenericCompositeMarkDef & ErrorBandConfig & { - /** - * Orientation of the error band. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined. - */ - orient?: Orientation; -}; -export interface ErrorBandConfigMixins { - /** - * ErrorBand Config - */ - errorband?: ErrorBandConfig; -} -export declare const errorBandNormalizer: CompositeMarkNormalizer<"errorband">; -export declare function normalizeErrorBand(spec: GenericUnitSpec, ErrorBand | ErrorBandDef>, { config }: NormalizerParams): NormalizedLayerSpec; -export {}; -//# sourceMappingURL=errorband.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/errorband.d.ts.map b/node_modules/vega-lite/build/src/compositemark/errorband.d.ts.map deleted file mode 100644 index 82295f8..0000000 --- a/node_modules/vega-lite/build/src/compositemark/errorband.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorband.d.ts","sourceRoot":"","sources":["../../../src/compositemark/errorband.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAoB,MAAM,aAAa,CAAC;AAGxD,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAC,uBAAuB,EAAqC,WAAW,EAAC,MAAM,UAAU,CAAC;AACjG,OAAO,EAAC,cAAc,EAAE,cAAc,EAAkB,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzF,oBAAY,iBAAiB,CAC3B,EAAE,GAAG,SAAS,IACZ,eAAe,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,GAAG,YAAY,CAAC,CAAC;AAEzE,eAAO,MAAM,SAAS,aAAuB,CAAC;AAC9C,oBAAY,SAAS,GAAG,OAAO,SAAS,CAAC;AAEzC,eAAO,MAAM,eAAe,8BAA+B,CAAC;AAE5D,aAAK,aAAa,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAEpD,oBAAY,oBAAoB,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AAE9D,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAC3D;;;;;;;OAOG;IAGH,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,YAAY,GAAG,uBAAuB,CAAC,SAAS,CAAC,GAC3D,eAAe,GAAG;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEJ,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED,eAAO,MAAM,mBAAmB,sCAA6D,CAAC;AAE9F,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC,EACjE,EAAC,MAAM,EAAC,EAAE,gBAAgB,GACzB,mBAAmB,CA8ErB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/errorband.js b/node_modules/vega-lite/build/src/compositemark/errorband.js deleted file mode 100644 index 119e086..0000000 --- a/node_modules/vega-lite/build/src/compositemark/errorband.js +++ /dev/null @@ -1,51 +0,0 @@ -import { normalizeEncoding } from '../encoding'; -import * as log from '../log'; -import { CompositeMarkNormalizer } from './base'; -import { makeCompositeAggregatePartFactory } from './common'; -import { errorBarParams } from './errorbar'; -export const ERRORBAND = 'errorband'; -export const ERRORBAND_PARTS = ['band', 'borders']; -export const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand); -export function normalizeErrorBand(spec, { config }) { - // Need to initEncoding first so we can infer type - spec = Object.assign(Object.assign({}, spec), { encoding: normalizeEncoding(spec.encoding, config) }); - const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAND, config); - const errorBandDef = markDef; - const makeErrorBandPart = makeCompositeAggregatePartFactory(errorBandDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorband); - const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined; - let bandMark = { type: is2D ? 'area' : 'rect' }; - let bordersMark = { type: is2D ? 'line' : 'rule' }; - const interpolate = Object.assign(Object.assign({}, (errorBandDef.interpolate ? { interpolate: errorBandDef.interpolate } : {})), (errorBandDef.tension && errorBandDef.interpolate ? { tension: errorBandDef.tension } : {})); - if (is2D) { - bandMark = Object.assign(Object.assign(Object.assign({}, bandMark), interpolate), { ariaRoleDescription: 'errorband' }); - bordersMark = Object.assign(Object.assign(Object.assign({}, bordersMark), interpolate), { aria: false }); - } - else if (errorBandDef.interpolate) { - log.warn(log.message.errorBand1DNotSupport('interpolate')); - } - else if (errorBandDef.tension) { - log.warn(log.message.errorBand1DNotSupport('tension')); - } - return Object.assign(Object.assign({}, outerSpec), { transform, layer: [ - ...makeErrorBandPart({ - partName: 'band', - mark: bandMark, - positionPrefix: 'lower', - endPositionPrefix: 'upper', - extraEncoding: tooltipEncoding - }), - ...makeErrorBandPart({ - partName: 'borders', - mark: bordersMark, - positionPrefix: 'lower', - extraEncoding: tooltipEncoding - }), - ...makeErrorBandPart({ - partName: 'borders', - mark: bordersMark, - positionPrefix: 'upper', - extraEncoding: tooltipEncoding - }) - ] }); -} -//# sourceMappingURL=errorband.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/errorband.js.map b/node_modules/vega-lite/build/src/compositemark/errorband.js.map deleted file mode 100644 index c87c82b..0000000 --- a/node_modules/vega-lite/build/src/compositemark/errorband.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorband.js","sourceRoot":"","sources":["../../../src/compositemark/errorband.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAI9B,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAA0B,iCAAiC,EAAc,MAAM,UAAU,CAAC;AACjG,OAAO,EAAiC,cAAc,EAAgB,MAAM,YAAY,CAAC;AAMzF,MAAM,CAAC,MAAM,SAAS,GAAG,WAAoB,CAAC;AAG9C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,SAAS,CAAU,CAAC;AAwE5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,uBAAuB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAE9F,MAAM,UAAU,kBAAkB,CAChC,IAAiE,EACjE,EAAC,MAAM,EAAmB;IAE1B,kDAAkD;IAClD,IAAI,mCACC,IAAI,KACP,QAAQ,EAAE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,GACnD,CAAC;IAEF,MAAM,EACJ,SAAS,EACT,wBAAwB,EACxB,cAAc,EACd,6BAA6B,EAC7B,OAAO,EACP,SAAS,EACT,eAAe,EAChB,GAAG,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAiB,OAAO,CAAC;IAE3C,MAAM,iBAAiB,GAAG,iCAAiC,CACzD,YAAY,EACZ,cAAc,EACd,wBAAwB,EACxB,6BAA6B,EAC7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QAAQ;gBACd,cAAc,EAAE,OAAO;gBACvB,iBAAiB,EAAE,OAAO;gBAC1B,aAAa,EAAE,eAAe;aAC/B,CAAC;YACF,GAAG,iBAAiB,CAAC;gBACnB,QAAQ,EAAE,SAAS;gBACnB,IAAI,EAAE,WAAW;gBACjB,cAAc,EAAE,OAAO;gBAEvB,aAAa,EAAE,eAAe;aAC/B,CAAC;YACF,GAAG,iBAAiB,CAAC;gBACnB,QAAQ,EAAE,SAAS;gBACnB,IAAI,EAAE,WAAW;gBACjB,cAAc,EAAE,OAAO;gBACvB,aAAa,EAAE,eAAe;aAC/B,CAAC;SACH,IACD;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/errorbar.d.ts b/node_modules/vega-lite/build/src/compositemark/errorbar.d.ts deleted file mode 100644 index 43e3220..0000000 --- a/node_modules/vega-lite/build/src/compositemark/errorbar.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { Orientation, Text } from 'vega'; -import { PositionChannel } from '../channel'; -import { Field, PositionFieldDef, SecondaryFieldDef, ValueDef } from '../channeldef'; -import { Config } from '../config'; -import { Data } from '../data'; -import { Encoding } from '../encoding'; -import { NormalizerParams } from '../normalize'; -import { GenericUnitSpec, NormalizedLayerSpec } from '../spec'; -import { Step } from '../spec/base'; -import { NormalizedUnitSpec } from '../spec/unit'; -import { TitleParams } from '../title'; -import { Transform } from '../transform'; -import { CompositeMarkNormalizer } from './base'; -import { GenericCompositeMarkDef, PartsMixins } from './common'; -import { ErrorBand, ErrorBandDef } from './errorband'; -export declare const ERRORBAR: "errorbar"; -export declare type ErrorBar = typeof ERRORBAR; -export declare type ErrorBarExtent = 'ci' | 'iqr' | 'stderr' | 'stdev'; -export declare type ErrorBarCenter = 'mean' | 'median'; -export declare type ErrorInputType = 'raw' | 'aggregated-upper-lower' | 'aggregated-error'; -export declare const ERRORBAR_PARTS: readonly ["ticks", "rule"]; -export declare type ErrorBarPart = typeof ERRORBAR_PARTS[number]; -export interface ErrorExtraEncoding { - /** - * Error value of x coordinates for error specified `"errorbar"` and `"errorband"`. - */ - xError?: SecondaryFieldDef | ValueDef; - /** - * Secondary error value of x coordinates for error specified `"errorbar"` and `"errorband"`. - */ - xError2?: SecondaryFieldDef | ValueDef; - /** - * Error value of y coordinates for error specified `"errorbar"` and `"errorband"`. - */ - yError?: SecondaryFieldDef | ValueDef; - /** - * Secondary error value of y coordinates for error specified `"errorbar"` and `"errorband"`. - */ - yError2?: SecondaryFieldDef | ValueDef; -} -export declare type ErrorEncoding = Pick, PositionChannel | 'color' | 'detail' | 'opacity'> & ErrorExtraEncoding; -export declare type ErrorBarPartsMixins = PartsMixins; -export interface ErrorBarConfig extends ErrorBarPartsMixins { - /** - * The center of the errorbar. Available options include: - * - `"mean"`: the mean of the data points. - * - `"median"`: the median of the data points. - * - * __Default value:__ `"mean"`. - * @hidden - */ - center?: ErrorBarCenter; - /** - * The extent of the rule. Available options include: - * - `"ci"`: Extend the rule to the confidence interval of the mean. - * - `"stderr"`: The size of rule are set to the value of standard error, extending from the mean. - * - `"stdev"`: The size of rule are set to the value of standard deviation, extending from the mean. - * - `"iqr"`: Extend the rule to the q1 and q3. - * - * __Default value:__ `"stderr"`. - */ - extent?: ErrorBarExtent; -} -export declare type ErrorBarDef = GenericCompositeMarkDef & ErrorBarConfig & { - /** - * Orientation of the error bar. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined. - */ - orient?: Orientation; -}; -export interface ErrorBarConfigMixins { - /** - * ErrorBar Config - */ - errorbar?: ErrorBarConfig; -} -export declare const errorBarNormalizer: CompositeMarkNormalizer<"errorbar">; -export declare function normalizeErrorBar(spec: GenericUnitSpec, ErrorBar | ErrorBarDef>, { config }: NormalizerParams): NormalizedLayerSpec | NormalizedUnitSpec; -export declare function errorBarParams & (ErrorBarDef | ErrorBandDef)>(spec: GenericUnitSpec, M | MD>, compositeMark: M, config: Config): { - transform: Transform[]; - groupby: string[]; - continuousAxisChannelDef: PositionFieldDef; - continuousAxis: 'x' | 'y'; - encodingWithoutContinuousAxis: ErrorEncoding; - ticksOrient: Orientation; - markDef: MD; - outerSpec: { - data?: Data; - title?: Text | TitleParams; - name?: string; - description?: string; - transform?: Transform[]; - width?: number | 'container' | Step; - height?: number | 'container' | Step; - }; - tooltipEncoding: ErrorEncoding; -}; -//# sourceMappingURL=errorbar.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/errorbar.d.ts.map b/node_modules/vega-lite/build/src/compositemark/errorbar.d.ts.map deleted file mode 100644 index f1967a4..0000000 --- a/node_modules/vega-lite/build/src/compositemark/errorbar.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorbar.d.ts","sourceRoot":"","sources":["../../../src/compositemark/errorbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,WAAW,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACpD,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,KAAK,EAGL,gBAAgB,EAChB,iBAAiB,EAEjB,QAAQ,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,QAAQ,EAAmD,MAAM,aAAa,CAAC;AAGvF,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AACrC,OAAO,EAAyC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAIL,uBA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AE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;QACpC,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;KACtC,CAAC;IACF,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACxC,CA8EA"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/errorbar.js b/node_modules/vega-lite/build/src/compositemark/errorbar.js deleted file mode 100644 index 2a50de7..0000000 --- a/node_modules/vega-lite/build/src/compositemark/errorbar.js +++ /dev/null @@ -1,309 +0,0 @@ -import { __rest } from "tslib"; -import { isContinuousFieldOrDatumDef, isFieldOrDatumDef, title } from '../channeldef'; -import { extractTransformsFromEncoding, normalizeEncoding } from '../encoding'; -import * as log from '../log'; -import { isMarkDef } from '../mark'; -import { replaceAll, titleCase } from '../util'; -import { CompositeMarkNormalizer } from './base'; -import { compositeMarkContinuousAxis, compositeMarkOrient, getCompositeMarkTooltip, makeCompositeAggregatePartFactory } from './common'; -export const ERRORBAR = 'errorbar'; -export const ERRORBAR_PARTS = ['ticks', 'rule']; -export const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar); -export function normalizeErrorBar(spec, { config }) { - // Need to initEncoding first so we can infer type - spec = Object.assign(Object.assign({}, spec), { encoding: normalizeEncoding(spec.encoding, config) }); - const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, ticksOrient, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAR, config); - const makeErrorBarPart = makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorbar); - const tick = { type: 'tick', orient: ticksOrient, aria: false }; - const layer = [ - ...makeErrorBarPart({ - partName: 'ticks', - mark: tick, - positionPrefix: 'lower', - extraEncoding: tooltipEncoding - }), - ...makeErrorBarPart({ - partName: 'ticks', - mark: tick, - positionPrefix: 'upper', - extraEncoding: tooltipEncoding - }), - ...makeErrorBarPart({ - partName: 'rule', - mark: { - type: 'rule', - ariaRoleDescription: 'errorbar' - }, - positionPrefix: 'lower', - endPositionPrefix: 'upper', - extraEncoding: tooltipEncoding - }) - ]; - return Object.assign(Object.assign(Object.assign({}, outerSpec), { transform }), (layer.length > 1 ? { layer } : Object.assign({}, layer[0]))); -} -function errorBarOrientAndInputType(spec, compositeMark) { - const { encoding } = spec; - if (errorBarIsInputTypeRaw(encoding)) { - return { - orient: compositeMarkOrient(spec, compositeMark), - inputType: 'raw' - }; - } - const isTypeAggregatedUpperLower = errorBarIsInputTypeAggregatedUpperLower(encoding); - const isTypeAggregatedError = errorBarIsInputTypeAggregatedError(encoding); - const x = encoding.x; - const y = encoding.y; - if (isTypeAggregatedUpperLower) { - // type is aggregated-upper-lower - if (isTypeAggregatedError) { - throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`); - } - const x2 = encoding.x2; - const y2 = encoding.y2; - if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) { - // having both x, x2 and y, y2 - throw new Error(`${compositeMark} cannot have both x2 and y2`); - } - else if (isFieldOrDatumDef(x2)) { - if (isContinuousFieldOrDatumDef(x)) { - // having x, x2 quantitative and field y, y2 are not specified - return { orient: 'horizontal', inputType: 'aggregated-upper-lower' }; - } - else { - // having x, x2 that are not both quantitative - throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`); - } - } - else if (isFieldOrDatumDef(y2)) { - // y2 is a FieldDef - if (isContinuousFieldOrDatumDef(y)) { - // having y, y2 quantitative and field x, x2 are not specified - return { orient: 'vertical', inputType: 'aggregated-upper-lower' }; - } - else { - // having y, y2 that are not both quantitative - throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`); - } - } - throw new Error('No ranged axis'); - } - else { - // type is aggregated-error - const xError = encoding.xError; - const xError2 = encoding.xError2; - const yError = encoding.yError; - const yError2 = encoding.yError2; - if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) { - // having xError2 without xError - throw new Error(`${compositeMark} cannot have xError2 without xError`); - } - if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) { - // having yError2 without yError - throw new Error(`${compositeMark} cannot have yError2 without yError`); - } - if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) { - // having both xError and yError - throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`); - } - else if (isFieldOrDatumDef(xError)) { - if (isContinuousFieldOrDatumDef(x)) { - // having x and xError that are all quantitative - return { orient: 'horizontal', inputType: 'aggregated-error' }; - } - else { - // having x, xError, and xError2 that are not all quantitative - throw new Error('All x, xError, and xError2 (if exist) have to be quantitative'); - } - } - else if (isFieldOrDatumDef(yError)) { - if (isContinuousFieldOrDatumDef(y)) { - // having y and yError that are all quantitative - return { orient: 'vertical', inputType: 'aggregated-error' }; - } - else { - // having y, yError, and yError2 that are not all quantitative - throw new Error('All y, yError, and yError2 (if exist) have to be quantitative'); - } - } - throw new Error('No ranged axis'); - } -} -function errorBarIsInputTypeRaw(encoding) { - return ((isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) && - !isFieldOrDatumDef(encoding.x2) && - !isFieldOrDatumDef(encoding.y2) && - !isFieldOrDatumDef(encoding.xError) && - !isFieldOrDatumDef(encoding.xError2) && - !isFieldOrDatumDef(encoding.yError) && - !isFieldOrDatumDef(encoding.yError2)); -} -function errorBarIsInputTypeAggregatedUpperLower(encoding) { - return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2); -} -function errorBarIsInputTypeAggregatedError(encoding) { - return (isFieldOrDatumDef(encoding.xError) || - isFieldOrDatumDef(encoding.xError2) || - isFieldOrDatumDef(encoding.yError) || - isFieldOrDatumDef(encoding.yError2)); -} -export function errorBarParams(spec, compositeMark, config) { - var _a; - // TODO: use selection - const { mark, encoding, selection, projection: _p } = spec, outerSpec = __rest(spec, ["mark", "encoding", "selection", "projection"]); - const markDef = isMarkDef(mark) ? mark : { type: mark }; - // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - if (selection) { - log.warn(log.message.selectionNotSupported(compositeMark)); - } - const { orient, inputType } = errorBarOrientAndInputType(spec, compositeMark); - const { continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, continuousAxis } = compositeMarkContinuousAxis(spec, orient, compositeMark); - const { errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName } = errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config); - const _b = encoding, _c = continuousAxis, oldContinuousAxisChannelDef = _b[_c], _d = continuousAxis === 'x' ? 'x2' : 'y2', oldContinuousAxisChannelDef2 = _b[_d], _e = continuousAxis === 'x' ? 'xError' : 'yError', oldContinuousAxisChannelDefError = _b[_e], _f = continuousAxis === 'x' ? 'xError2' : 'yError2', oldContinuousAxisChannelDefError2 = _b[_f], oldEncodingWithoutContinuousAxis = __rest(_b, [typeof _c === "symbol" ? _c : _c + "", typeof _d === "symbol" ? _d : _d + "", typeof _e === "symbol" ? _e : _e + "", typeof _f === "symbol" ? _f : _f + ""]); - const { bins, timeUnits, aggregate: oldAggregate, groupby: oldGroupBy, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config); - const aggregate = [...oldAggregate, ...errorBarSpecificAggregate]; - const groupby = inputType !== 'raw' ? [] : oldGroupBy; - const tooltipEncoding = getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, tooltipTitleWithFieldName); - return { - transform: [ - ...((_a = outerSpec.transform) !== null && _a !== void 0 ? _a : []), - ...bins, - ...timeUnits, - ...(aggregate.length === 0 ? [] : [{ aggregate, groupby }]), - ...postAggregateCalculates - ], - groupby, - continuousAxisChannelDef, - continuousAxis, - encodingWithoutContinuousAxis, - ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical', - markDef, - outerSpec, - tooltipEncoding - }; -} -function errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config) { - let errorBarSpecificAggregate = []; - let postAggregateCalculates = []; - const continuousFieldName = continuousAxisChannelDef.field; - let tooltipSummary; - let tooltipTitleWithFieldName = false; - if (inputType === 'raw') { - const center = markDef.center - ? markDef.center - : markDef.extent - ? markDef.extent === 'iqr' - ? 'median' - : 'mean' - : config.errorbar.center; - const extent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr'; - if ((center === 'median') !== (extent === 'iqr')) { - log.warn(log.message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark)); - } - if (extent === 'stderr' || extent === 'stdev') { - errorBarSpecificAggregate = [ - { op: extent, field: continuousFieldName, as: 'extent_' + continuousFieldName }, - { op: center, field: continuousFieldName, as: 'center_' + continuousFieldName } - ]; - postAggregateCalculates = [ - { - calculate: `datum["center_${continuousFieldName}"] + datum["extent_${continuousFieldName}"]`, - as: 'upper_' + continuousFieldName - }, - { - calculate: `datum["center_${continuousFieldName}"] - datum["extent_${continuousFieldName}"]`, - as: 'lower_' + continuousFieldName - } - ]; - tooltipSummary = [ - { fieldPrefix: 'center_', titlePrefix: titleCase(center) }, - { fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+') }, - { fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-') } - ]; - tooltipTitleWithFieldName = true; - } - else { - let centerOp; - let lowerExtentOp; - let upperExtentOp; - if (extent === 'ci') { - centerOp = 'mean'; - lowerExtentOp = 'ci0'; - upperExtentOp = 'ci1'; - } - else { - centerOp = 'median'; - lowerExtentOp = 'q1'; - upperExtentOp = 'q3'; - } - errorBarSpecificAggregate = [ - { op: lowerExtentOp, field: continuousFieldName, as: 'lower_' + continuousFieldName }, - { op: upperExtentOp, field: continuousFieldName, as: 'upper_' + continuousFieldName }, - { op: centerOp, field: continuousFieldName, as: 'center_' + continuousFieldName } - ]; - tooltipSummary = [ - { - fieldPrefix: 'upper_', - titlePrefix: title({ field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative' }, config, { - allowDisabling: false - }) - }, - { - fieldPrefix: 'lower_', - titlePrefix: title({ field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative' }, config, { - allowDisabling: false - }) - }, - { - fieldPrefix: 'center_', - titlePrefix: title({ field: continuousFieldName, aggregate: centerOp, type: 'quantitative' }, config, { - allowDisabling: false - }) - } - ]; - } - } - else { - if (markDef.center || markDef.extent) { - log.warn(log.message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent)); - } - if (inputType === 'aggregated-upper-lower') { - tooltipSummary = []; - postAggregateCalculates = [ - { calculate: `datum["${continuousAxisChannelDef2.field}"]`, as: 'upper_' + continuousFieldName }, - { calculate: `datum["${continuousFieldName}"]`, as: 'lower_' + continuousFieldName } - ]; - } - else if (inputType === 'aggregated-error') { - tooltipSummary = [{ fieldPrefix: '', titlePrefix: continuousFieldName }]; - postAggregateCalculates = [ - { - calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError.field}"]`, - as: 'upper_' + continuousFieldName - } - ]; - if (continuousAxisChannelDefError2) { - postAggregateCalculates.push({ - calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError2.field}"]`, - as: 'lower_' + continuousFieldName - }); - } - else { - postAggregateCalculates.push({ - calculate: `datum["${continuousFieldName}"] - datum["${continuousAxisChannelDefError.field}"]`, - as: 'lower_' + continuousFieldName - }); - } - } - for (const postAggregateCalculate of postAggregateCalculates) { - tooltipSummary.push({ - fieldPrefix: postAggregateCalculate.as.substring(0, 6), - titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum["', ''), '"]', '') - }); - } - } - return { postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName }; -} -function getTitlePrefix(center, extent, operation) { - return titleCase(center) + ' ' + operation + ' ' + extent; -} -//# sourceMappingURL=errorbar.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/errorbar.js.map b/node_modules/vega-lite/build/src/compositemark/errorbar.js.map deleted file mode 100644 index a5ade77..0000000 --- a/node_modules/vega-lite/build/src/compositemark/errorbar.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorbar.js","sourceRoot":"","sources":["../../../src/compositemark/errorbar.ts"],"names":[],"mappings":";AAEA,OAAO,EAEL,2BAA2B,EAC3B,iBAAiB,EAGjB,KAAK,EAEN,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAW,6BAA6B,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACvF,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,SAAS,EAAU,MAAM,SAAS,CAAC;AAO3C,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EAGnB,uBAAuB,EACvB,iCAAiC,EAElC,MAAM,UAAU,CAAC;AAGlB,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAmB,CAAC;AAQ5C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,CAAU,CAAC;AAyEzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,uBAAuB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAE3F,MAAM,UAAU,iBAAiB,CAC/B,IAAoE,EACpE,EAAC,MAAM,EAAmB;IAE1B,kDAAkD;IAClD,IAAI,mCACC,IAAI,KACP,QAAQ,EAAE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,GAC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,IAAI;oBAC9F,EAAE,EAAE,QAAQ,GAAG,mBAAmB;iBACnC;aACF,CAAC;YAEF,IAAI,8BAA8B,EAAE;gBAClC,uBAAuB,CAAC,IAAI,CAAC;oBAC3B,SAAS,EAAE,UAAU,mBAAmB,eAAe,8BAA8B,CAAC,KAAK,IAAI;oBAC/F,EAAE,EAAE,QAAQ,GAAG,mBAAmB;iBACnC,CAAC,CAAC;aACJ;iBAAM;gBACL,uBAAuB,CAAC,IAAI,CAAC;oBAC3B,SAAS,EAAE,UAAU,mBAAmB,eAAe,6BAA6B,CAAC,KAAK,IAAI;oBAC9F,EAAE,EAAE,QAAQ,GAAG,mBAAmB;iBACnC,CAAC,CAAC;aACJ;SACF;QAED,KAAK,MAAM,sBAAsB,IAAI,uBAAuB,EAAE;YAC5D,cAAc,CAAC,IAAI,CAAC;gBAClB,WAAW,EAAE,sBAAsB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;gBACtD,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,sBAAsB,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;aAC/F,CAAC,CAAC;SACJ;KACF;IACD,OAAO,EAAC,uBAAuB,EAAE,yBAAyB,EAAE,cAAc,EAAE,yBAAyB,EAAC,CAAC;AACzG,CAAC;AAED,SAAS,cAAc,CAAC,MAAsB,EAAE,MAAsB,EAAE,SAAoB;IAC1F,OAAO,SAAS,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,SAAS,GAAG,GAAG,GAAG,MAAM,CAAC;AAC5D,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/index.d.ts b/node_modules/vega-lite/build/src/compositemark/index.d.ts deleted file mode 100644 index 825fc33..0000000 --- a/node_modules/vega-lite/build/src/compositemark/index.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Field } from '../channeldef'; -import { Encoding } from '../encoding'; -import { NormalizerParams } from '../normalize'; -import { GenericUnitSpec, NormalizedLayerSpec } from '../spec'; -import { EncodingFacetMapping } from '../spec/facet'; -import { NormalizedUnitSpec } from '../spec/unit'; -import { BoxPlot, BoxPlotConfigMixins, BoxPlotDef } from './boxplot'; -import { ErrorBand, ErrorBandConfigMixins, ErrorBandDef } from './errorband'; -import { ErrorBar, ErrorBarConfigMixins, ErrorBarDef, ErrorExtraEncoding } from './errorbar'; -export { BoxPlotConfig } from './boxplot'; -export { ErrorBandConfigMixins } from './errorband'; -export { ErrorBarConfigMixins } from './errorbar'; -export declare type CompositeMarkNormalizerRun = (spec: GenericUnitSpec, params: NormalizerParams) => NormalizedLayerSpec | NormalizedUnitSpec; -export declare function add(mark: string, run: CompositeMarkNormalizerRun, parts: readonly string[]): void; -export declare function remove(mark: string): void; -export declare type CompositeEncoding = Encoding & ErrorExtraEncoding; -export declare type PartialIndex> = { - [t in keyof T]?: Partial; -}; -export declare type SharedCompositeEncoding = PartialIndex, 'detail' | 'order' | 'tooltip'>> & Pick, 'detail' | 'order' | 'tooltip'>; -export declare type FacetedCompositeEncoding = Encoding & ErrorExtraEncoding & EncodingFacetMapping; -export declare type CompositeMark = BoxPlot | ErrorBar | ErrorBand; -export declare function getAllCompositeMarks(): string[]; -export declare type CompositeMarkDef = BoxPlotDef | ErrorBarDef | ErrorBandDef; -export declare type CompositeAggregate = BoxPlot | ErrorBar | ErrorBand; -export interface CompositeMarkConfigMixins extends BoxPlotConfigMixins, ErrorBarConfigMixins, ErrorBandConfigMixins { -} -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/index.d.ts.map b/node_modules/vega-lite/build/src/compositemark/index.d.ts.map deleted file mode 100644 index 22e1011..0000000 --- a/node_modules/vega-lite/build/src/compositemark/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compositemark/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KA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C,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC;AAEF,oBAAY,uBAAuB,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,IAAI,YAAY,CACzE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC,CAC3D,GACC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAEpD,oBAAY,wBAAwB,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,GACzE,kBAAkB,CAAC,CAAC,CAAC,GACrB,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAE1B,oBAAY,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3D,wBAAgB,oBAAoB,aAEnC;AAED,oBAAY,gBAAgB,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC;AAEvE,oBAAY,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB;CAAG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/index.js b/node_modules/vega-lite/build/src/compositemark/index.js deleted file mode 100644 index 950a4a1..0000000 --- a/node_modules/vega-lite/build/src/compositemark/index.js +++ /dev/null @@ -1,23 +0,0 @@ -import { keys } from '../util'; -import { CompositeMarkNormalizer } from './base'; -import { BOXPLOT, BOXPLOT_PARTS, normalizeBoxPlot } from './boxplot'; -import { ERRORBAND, ERRORBAND_PARTS, normalizeErrorBand } from './errorband'; -import { ERRORBAR, ERRORBAR_PARTS, normalizeErrorBar } from './errorbar'; -/** - * Registry index for all composite mark's normalizer - */ -const compositeMarkRegistry = {}; -export function add(mark, run, parts) { - const normalizer = new CompositeMarkNormalizer(mark, run); - compositeMarkRegistry[mark] = { normalizer, parts }; -} -export function remove(mark) { - delete compositeMarkRegistry[mark]; -} -export function getAllCompositeMarks() { - return keys(compositeMarkRegistry); -} -add(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS); -add(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS); -add(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/compositemark/index.js.map b/node_modules/vega-lite/build/src/compositemark/index.js.map deleted file mode 100644 index dd7b56a..0000000 --- a/node_modules/vega-lite/build/src/compositemark/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/compositemark/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAC,OAAO,EAA4C,aAAa,EAAE,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAC7G,OAAO,EACL,SAAS,EAIT,eAAe,EACf,kBAAkB,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,QAAQ,EAIR,cAAc,EAEd,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAWpB;;GAEG;AACH,MAAM,qBAAqB,GAKvB,EAAE,CAAC;AAEP,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,GAA+B,EAAE,KAAwB;IACzF,MAAM,UAAU,GAAG,IAAI,uBAAuB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC1D,qBAAqB,CAAC,IAAI,CAAC,GAAG,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAmBD,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACrC,CAAC;AAQD,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAC9C,GAAG,CAAC,QAAQ,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;AACjD,GAAG,CAAC,SAAS,EAAE,kBAAkB,EAAE,eAAe,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/config.d.ts b/node_modules/vega-lite/build/src/config.d.ts deleted file mode 100644 index f7294d6..0000000 --- a/node_modules/vega-lite/build/src/config.d.ts +++ /dev/null @@ -1,351 +0,0 @@ -import { Color, InitSignal, NewSignal, RangeConfig, RangeScheme, SignalRef } from 'vega'; -import { Axis, AxisConfigMixins } from './axis'; -import { CompositeMarkConfigMixins } from './compositemark'; -import { HeaderConfigMixins } from './header'; -import { LegendConfig } from './legend'; -import * as mark from './mark'; -import { AnyMarkConfig, MarkConfig, MarkConfigMixins } from './mark'; -import { ProjectionConfig } from './projection'; -import { ScaleConfig } from './scale'; -import { SelectionConfig } from './selection'; -import { BaseViewBackground, CompositionConfigMixins } from './spec/base'; -import { TopLevelProperties } from './spec/toplevel'; -import { TitleConfig } from './title'; -export interface ViewConfig extends BaseViewBackground { - /** - * Default width - * - * __Deprecated:__ Since Vega-Lite 4.0. Please use continuousWidth and discreteWidth instead. - */ - width?: number; - /** - * Default height - * - * __Deprecated:__ Since Vega-Lite 4.0. Please use continuousHeight and discreteHeight instead. - */ - height?: number; - /** - * The default width when the plot has a continuous field for x or longitude, or has arc marks. - * - * __Default value:__ `200` - */ - continuousWidth?: number; - /** - * The default width when the plot has non-arc marks and either a discrete x-field or no x-field. - * The width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. - * - * __Default value:__ a step size based on `config.view.step`. - */ - discreteWidth?: number | { - step: number; - }; - /** - * The default height when the plot has a continuous y-field for x or latitude, or has arc marks. - * - * __Default value:__ `200` - */ - continuousHeight?: number; - /** - * The default height when the plot has non arc marks and either a discrete y-field or no y-field. - * The height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. - * - * __Default value:__ a step size based on `config.view.step`. - */ - discreteHeight?: number | { - step: number; - }; - /** - * Default step size for x-/y- discrete fields. - */ - step?: number; - /** - * Whether the view should be clipped. - */ - clip?: boolean; -} -export declare function getViewConfigContinuousSize(viewConfig: ViewConfig, channel: 'width' | 'height'): number; -export declare function getViewConfigDiscreteStep(viewConfig: ViewConfig, channel: 'width' | 'height'): number; -export declare function getViewConfigDiscreteSize(viewConfig: ViewConfig, channel: 'width' | 'height'): number | { - step: number; -}; -export declare const DEFAULT_STEP = 20; -export declare const defaultViewConfig: ViewConfig; -export declare function isVgScheme(rangeScheme: string[] | RangeScheme): rangeScheme is RangeScheme; -export declare type ColorConfig = Record; -export declare type FontSizeConfig = Record; -export interface VLOnlyConfig { - /** - * Default font for all text marks, titles, and labels. - */ - font?: string; - /** - * Default color signals. - * - * @hidden - */ - color?: boolean | ColorConfig; - /** - * Default font size signals. - * - * @hidden - */ - fontSize?: boolean | FontSizeConfig; - /** - * Default axis and legend title for count fields. - * - * __Default value:__ `'Count of Records`. - * - * @type {string} - */ - countTitle?: string; - /** - * Defines how Vega-Lite generates title for fields. There are three possible styles: - * - `"verbal"` (Default) - displays function in a verbal style (e.g., "Sum of field", "Year-month of date", "field (binned)"). - * - `"function"` - displays function using parentheses and capitalized texts (e.g., "SUM(field)", "YEARMONTH(date)", "BIN(field)"). - * - `"plain"` - displays only the field name without functions (e.g., "field", "date", "field"). - */ - fieldTitle?: 'verbal' | 'functional' | 'plain'; - /** - * D3 Number format for guide labels and text marks. For example `"s"` for SI units. Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format). - */ - numberFormat?: string; - /** - * Default time format for raw time values (without time units) in text marks, legend labels and header labels. - * - * __Default value:__ `"%b %d, %Y"` - * __Note:__ Axes automatically determine the format for each label automatically so this config does not affect axes. - */ - timeFormat?: string; - /** - * Allow the `formatType` property for text marks and guides to accept a custom formatter function [registered as a Vega expression](https://vega.github.io/vega-lite/usage/compile.html#format-type). - */ - customFormatTypes?: boolean; - /** Default properties for [single view plots](https://vega.github.io/vega-lite/docs/spec.html#single). */ - view?: ViewConfig; - /** - * Scale configuration determines default properties for all [scales](https://vega.github.io/vega-lite/docs/scale.html). For a full list of scale configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config). - */ - scale?: ScaleConfig; - /** An object hash for defining default properties for each type of selections. */ - selection?: SelectionConfig; -} -export declare type StyleConfigIndex = Partial> & MarkConfigMixins & { - /** - * Default style for axis, legend, and header titles. - */ - 'guide-title'?: MarkConfig; - /** - * Default style for axis, legend, and header labels. - */ - 'guide-label'?: MarkConfig; - /** - * Default style for chart titles - */ - 'group-title'?: MarkConfig; - /** - * Default style for chart subtitles - */ - 'group-subtitle'?: MarkConfig; -}; -export interface Config extends TopLevelProperties, VLOnlyConfig, MarkConfigMixins, CompositeMarkConfigMixins, AxisConfigMixins, HeaderConfigMixins, CompositionConfigMixins { - /** - * An object hash that defines default range arrays or schemes for using with scales. - * For a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config). - */ - range?: RangeConfig; - /** - * Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config). - */ - legend?: LegendConfig; - /** - * Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config). - */ - title?: TitleConfig; - /** - * Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config). - */ - projection?: ProjectionConfig; - /** An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config). */ - style?: StyleConfigIndex; - /** - * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid. - */ - lineBreak?: string | SignalRef; - /** - * A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the `"aria-hidden"` attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks. - * - * __Default value:__ `true`. - */ - aria?: boolean; - /** - * @hidden - */ - signals?: (InitSignal | NewSignal)[]; -} -export declare const defaultConfig: Config; -export declare const DEFAULT_FONT_SIZE: { - text: number; - guideLabel: number; - guideTitle: number; - groupTitle: number; - groupSubtitle: number; -}; -export declare const DEFAULT_COLOR: { - blue: string; - orange: string; - red: string; - teal: string; - green: string; - yellow: string; - purple: string; - pink: string; - brown: string; - gray0: string; - gray1: string; - gray2: string; - gray3: string; - gray4: string; - gray5: string; - gray6: string; - gray7: string; - gray8: string; - gray9: string; - gray10: string; - gray11: string; - gray12: string; - gray13: string; - gray14: string; - gray15: string; -}; -export declare function colorSignalConfig(color?: boolean | ColorConfig): Config; -export declare function fontSizeSignalConfig(fontSize: boolean | FontSizeConfig): Config; -export declare function fontConfig(font: string): Config; -export declare function initConfig(config?: Config): { - /** - * An object hash that defines default range arrays or schemes for using with scales. - * For a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config). - */ - range?: RangeConfig; - /** - * Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config). - */ - legend?: LegendConfig; - /** - * Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config). - */ - title?: import("./title").BaseTitleNoValueRefs; - /** - * Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config). - */ - projection?: import("./projection").Projection; - /** An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config). */ - style?: StyleConfigIndex; - /** - * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid. - */ - lineBreak?: import("vega").ScaleField; - /** - * A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the `"aria-hidden"` attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks. - * - * __Default value:__ `true`. - */ - aria?: boolean; - /** - * @hidden - */ - signals?: (NewSignal | InitSignal)[]; - background?: import("vega").ScaleField; - padding?: number | SignalRef | { - top?: number; - bottom?: number; - left?: number; - right?: number; - }; - autosize?: "pad" | "fit" | "fit-x" | "fit-y" | "none" | import("./spec/toplevel").AutoSizeParams; - /** - * Default axis and legend title for count fields. - * - * __Default value:__ `'Count of Records`. - * - * @type {string} - */ - countTitle?: string; - /** - * Defines how Vega-Lite generates title for fields. There are three possible styles: - * - `"verbal"` (Default) - displays function in a verbal style (e.g., "Sum of field", "Year-month of date", "field (binned)"). - * - `"function"` - displays function using parentheses and capitalized texts (e.g., "SUM(field)", "YEARMONTH(date)", "BIN(field)"). - * - `"plain"` - displays only the field name without functions (e.g., "field", "date", "field"). - */ - fieldTitle?: "verbal" | "functional" | "plain"; - /** - * D3 Number format for guide labels and text marks. For example `"s"` for SI units. Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format). - */ - numberFormat?: string; - /** - * Default time format for raw time values (without time units) in text marks, legend labels and header labels. - * - * __Default value:__ `"%b %d, %Y"` - * __Note:__ Axes automatically determine the format for each label automatically so this config does not affect axes. - */ - timeFormat?: string; - /** - * Allow the `formatType` property for text marks and guides to accept a custom formatter function [registered as a Vega expression](https://vega.github.io/vega-lite/usage/compile.html#format-type). - */ - customFormatTypes?: boolean; - /** Default properties for [single view plots](https://vega.github.io/vega-lite/docs/spec.html#single). */ - view?: ViewConfig; - /** - * Scale configuration determines default properties for all [scales](https://vega.github.io/vega-lite/docs/scale.html). For a full list of scale configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config). - */ - scale?: ScaleConfig; - /** An object hash for defining default properties for each type of selections. */ - selection?: SelectionConfig; - mark?: mark.MarkConfig; - arc?: mark.RectConfig; - area?: mark.AreaConfig; - bar?: mark.BarConfig; - circle?: mark.MarkConfig; - image?: mark.RectConfig; - line?: mark.LineConfig; - point?: mark.MarkConfig; - rect?: mark.RectConfig; - rule?: mark.MarkConfig; - square?: mark.MarkConfig; - text?: mark.MarkConfig; - tick?: mark.TickConfig; - trail?: mark.LineConfig; - geoshape?: mark.MarkConfig; - boxplot?: import("./compositemark").BoxPlotConfig; - errorbar?: import("./compositemark/errorbar").ErrorBarConfig; - errorband?: import("./compositemark/errorband").ErrorBandConfig; - axis?: import("./axis").AxisConfig; - axisX?: import("./axis").AxisConfig; - axisY?: import("./axis").AxisConfig; - axisLeft?: import("./axis").AxisConfig; - axisRight?: import("./axis").AxisConfig; - axisTop?: import("./axis").AxisConfig; - axisBottom?: import("./axis").AxisConfig; - axisBand?: import("./axis").AxisConfig; - axisPoint?: import("./axis").AxisConfig; - axisDiscrete?: import("./axis").AxisConfig; - axisQuantitative?: import("./axis").AxisConfig; - axisTemporal?: import("./axis").AxisConfig; - axisXBand?: import("./axis").AxisConfig; - axisXPoint?: import("./axis").AxisConfig; - axisXDiscrete?: import("./axis").AxisConfig; - axisXQuantitative?: import("./axis").AxisConfig; - axisXTemporal?: import("./axis").AxisConfig; - axisYBand?: import("./axis").AxisConfig; - axisYPoint?: import("./axis").AxisConfig; - axisYDiscrete?: import("./axis").AxisConfig; - axisYQuantitative?: import("./axis").AxisConfig; - axisYTemporal?: import("./axis").AxisConfig; - header?: import("./header").HeaderConfig; - headerRow?: import("./header").HeaderConfig; - headerColumn?: import("./header").HeaderConfig; - headerFacet?: import("./header").HeaderConfig; - facet?: import("./spec/base").CompositionConfig; - concat?: import("./spec/base").CompositionConfig; -}; -export declare function stripAndRedirectConfig(config: Config): Config; -//# sourceMappingURL=config.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/config.d.ts.map b/node_modules/vega-lite/build/src/config.d.ts.map deleted file mode 100644 index 3d4dc66..0000000 --- a/node_modules/vega-lite/build/src/config.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAEvF,OAAO,EAAC,IAAI,EAAE,gBAAgB,EAAyB,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAC,yBAAyB,EAAuB,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAsB,YAAY,EAAC,MAAM,UAAU,CAAC;AAC3D,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EACL,aAAa,EAEb,UAAU,EACV,gBAAgB,EAIjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAqB,WAAW,EAAC,MAAM,SAAS,CAAC;AACxD,OAAO,EAA0C,eAAe,EAAC,MAAM,aAAa,CAAC;AACrF,OAAO,EAAC,kBAAkB,EAAE,uBAAuB,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H,KAAK,CAAC,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAE9B,kUAAkU;IAClU,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAEzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC;CACtC;AAED,eAAO,MAAM,aAAa,EAAE,MAkE3B,CAAC;AAgBF,eAAO,MAAM,iBAAiB;;;;;;CAM7B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BzB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,OAAO,GAAG,WAAgB,GAAG,MAAM,CAkD3E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,cAAc,GAAG,MAAM,CA0B/E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU/C;AAED,wBAAgB,UAAU,CAAC,MAAM,GAAE,MAAW;IA5P5C;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH,kUAAkU;;IAGlU;;OAEG;;IAGH;;;;OAIG;;IAGH;;OAEG;;;;;;;;;;IApHH;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;IAGH;;OAEG;;IAGH,0GAA0G;;IAG1G;;OAEG;;IAGH,kFAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0SnF;AA2CD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,UAoEpD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/config.js b/node_modules/vega-lite/build/src/config.js deleted file mode 100644 index 61f5f1a..0000000 --- a/node_modules/vega-lite/build/src/config.js +++ /dev/null @@ -1,359 +0,0 @@ -import { __rest } from "tslib"; -import { isObject, mergeConfig } from 'vega-util'; -import { isConditionalAxisValue } from './axis'; -import { getAllCompositeMarks } from './compositemark'; -import { VL_ONLY_LEGEND_CONFIG } from './guide'; -import { defaultLegendConfig } from './legend'; -import * as mark from './mark'; -import { PRIMITIVE_MARKS, VL_ONLY_MARK_CONFIG_PROPERTIES, VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX } from './mark'; -import { defaultScaleConfig } from './scale'; -import { defaultConfig as defaultSelectionConfig } from './selection'; -import { DEFAULT_SPACING, isStep } from './spec/base'; -import { extractTitleConfig } from './title'; -import { duplicate, getFirstDefined, isEmpty } from './util'; -export function getViewConfigContinuousSize(viewConfig, channel) { - var _a; - return (_a = viewConfig[channel]) !== null && _a !== void 0 ? _a : viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility -} -export function getViewConfigDiscreteStep(viewConfig, channel) { - const size = getViewConfigDiscreteSize(viewConfig, channel); - return isStep(size) ? size.step : DEFAULT_STEP; -} -export function getViewConfigDiscreteSize(viewConfig, channel) { - var _a; - const size = (_a = viewConfig[channel]) !== null && _a !== void 0 ? _a : viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility - return getFirstDefined(size, { step: viewConfig.step }); -} -export const DEFAULT_STEP = 20; -export const defaultViewConfig = { - continuousWidth: 200, - continuousHeight: 200, - step: DEFAULT_STEP -}; -export function isVgScheme(rangeScheme) { - return rangeScheme && !!rangeScheme['scheme']; -} -export const defaultConfig = { - background: 'white', - padding: 5, - timeFormat: '%b %d, %Y', - countTitle: 'Count of Records', - view: defaultViewConfig, - mark: mark.defaultMarkConfig, - arc: {}, - area: {}, - bar: mark.defaultBarConfig, - circle: {}, - geoshape: {}, - image: {}, - line: {}, - point: {}, - rect: mark.defaultRectConfig, - rule: { color: 'black' }, - square: {}, - text: { color: 'black' }, - tick: mark.defaultTickConfig, - trail: {}, - boxplot: { - size: 14, - extent: 1.5, - box: {}, - median: { color: 'white' }, - outliers: {}, - rule: {}, - ticks: null - }, - errorbar: { - center: 'mean', - rule: true, - ticks: false - }, - errorband: { - band: { - opacity: 0.3 - }, - borders: false - }, - scale: defaultScaleConfig, - projection: {}, - legend: defaultLegendConfig, - header: { titlePadding: 10, labelPadding: 10 }, - headerColumn: {}, - headerRow: {}, - headerFacet: {}, - selection: defaultSelectionConfig, - style: {}, - title: {}, - facet: { spacing: DEFAULT_SPACING }, - concat: { spacing: DEFAULT_SPACING } -}; -// Tableau10 color palette, copied from `vegaScale.scheme('tableau10')` -const tab10 = [ - '#4c78a8', - '#f58518', - '#e45756', - '#72b7b2', - '#54a24b', - '#eeca3b', - '#b279a2', - '#ff9da6', - '#9d755d', - '#bab0ac' -]; -export const DEFAULT_FONT_SIZE = { - text: 11, - guideLabel: 10, - guideTitle: 11, - groupTitle: 13, - groupSubtitle: 12 -}; -export const DEFAULT_COLOR = { - blue: tab10[0], - orange: tab10[1], - red: tab10[2], - teal: tab10[3], - green: tab10[4], - yellow: tab10[5], - purple: tab10[6], - pink: tab10[7], - brown: tab10[8], - gray0: '#000', - gray1: '#111', - gray2: '#222', - gray3: '#333', - gray4: '#444', - gray5: '#555', - gray6: '#666', - gray7: '#777', - gray8: '#888', - gray9: '#999', - gray10: '#aaa', - gray11: '#bbb', - gray12: '#ccc', - gray13: '#ddd', - gray14: '#eee', - gray15: '#fff' -}; -export function colorSignalConfig(color = {}) { - return { - signals: [ - { - name: 'color', - value: isObject(color) ? Object.assign(Object.assign({}, DEFAULT_COLOR), color) : DEFAULT_COLOR - } - ], - mark: { color: { signal: 'color.blue' } }, - rule: { color: { signal: 'color.gray0' } }, - text: { - color: { signal: 'color.gray0' } - }, - style: { - 'guide-label': { - fill: { signal: 'color.gray0' } - }, - 'guide-title': { - fill: { signal: 'color.gray0' } - }, - 'group-title': { - fill: { signal: 'color.gray0' } - }, - 'group-subtitle': { - fill: { signal: 'color.gray0' } - }, - cell: { - stroke: { signal: 'color.gray8' } - } - }, - axis: { - domainColor: { signal: 'color.gray13' }, - gridColor: { signal: 'color.gray8' }, - tickColor: { signal: 'color.gray13' } - }, - range: { - category: [ - { signal: 'color.blue' }, - { signal: 'color.orange' }, - { signal: 'color.red' }, - { signal: 'color.teal' }, - { signal: 'color.green' }, - { signal: 'color.yellow' }, - { signal: 'color.purple' }, - { signal: 'color.pink' }, - { signal: 'color.brown' }, - { signal: 'color.grey8' } - ] - } - }; -} -export function fontSizeSignalConfig(fontSize) { - return { - signals: [ - { - name: 'fontSize', - value: isObject(fontSize) ? Object.assign(Object.assign({}, DEFAULT_FONT_SIZE), fontSize) : DEFAULT_FONT_SIZE - } - ], - text: { - fontSize: { signal: 'fontSize.text' } - }, - style: { - 'guide-label': { - fontSize: { signal: 'fontSize.guideLabel' } - }, - 'guide-title': { - fontSize: { signal: 'fontSize.guideTitle' } - }, - 'group-title': { - fontSize: { signal: 'fontSize.groupTitle' } - }, - 'group-subtitle': { - fontSize: { signal: 'fontSize.groupSubtitle' } - } - } - }; -} -export function fontConfig(font) { - return { - text: { font }, - style: { - 'guide-label': { font }, - 'guide-title': { font }, - 'group-title': { font }, - 'group-subtitle': { font } - } - }; -} -export function initConfig(config = {}) { - const { color, font, fontSize } = config, restConfig = __rest(config, ["color", "font", "fontSize"]); - return mergeConfig({}, defaultConfig, font ? fontConfig(font) : {}, color ? colorSignalConfig(color) : {}, fontSize ? fontSizeSignalConfig(fontSize) : {}, restConfig || {}); -} -const MARK_STYLES = ['view', ...PRIMITIVE_MARKS]; -const VL_ONLY_CONFIG_PROPERTIES = [ - 'color', - 'fontSize', - 'background', - 'padding', - 'facet', - 'concat', - 'numberFormat', - 'timeFormat', - 'countTitle', - 'header', - 'axisQuantitative', - 'axisTemporal', - 'axisDiscrete', - 'axisPoint', - 'axisXBand', - 'axisXPoint', - 'axisXDiscrete', - 'axisXQuantitative', - 'axisXTemporal', - 'axisYBand', - 'axisYPoint', - 'axisYDiscrete', - 'axisYQuantitative', - 'axisYTemporal', - 'scale', - 'selection', - 'overlay' // FIXME: Redesign and unhide this -]; -const VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = Object.assign({ view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'] }, VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX); -export function stripAndRedirectConfig(config) { - config = duplicate(config); - for (const prop of VL_ONLY_CONFIG_PROPERTIES) { - delete config[prop]; - } - if (config.axis) { - // delete condition axis config - for (const prop in config.axis) { - if (isConditionalAxisValue(config.axis[prop])) { - delete config.axis[prop]; - } - } - } - if (config.legend) { - for (const prop of VL_ONLY_LEGEND_CONFIG) { - delete config.legend[prop]; - } - } - // Remove Vega-Lite only generic mark config - if (config.mark) { - for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { - delete config.mark[prop]; - } - if (config.mark.tooltip && isObject(config.mark.tooltip)) { - delete config.mark.tooltip; - } - } - for (const markType of MARK_STYLES) { - // Remove Vega-Lite-only mark config - for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { - delete config[markType][prop]; - } - // Remove Vega-Lite only mark-specific config - const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType]; - if (vlOnlyMarkSpecificConfigs) { - for (const prop of vlOnlyMarkSpecificConfigs) { - delete config[markType][prop]; - } - } - // Redirect mark config to config.style so that mark config only affect its own mark type - // without affecting other marks that share the same underlying Vega marks. - // For example, config.rect should not affect bar marks. - redirectConfigToStyleConfig(config, markType); - } - for (const m of getAllCompositeMarks()) { - // Clean up the composite mark config as we don't need them in the output specs anymore - delete config[m]; - } - redirectTitleConfig(config); - // Remove empty config objects. - for (const prop in config) { - if (isObject(config[prop]) && isEmpty(config[prop])) { - delete config[prop]; - } - } - return isEmpty(config) ? undefined : config; -} -/** - * - * Redirect config.title -- so that title config do not affect header labels, - * which also uses `title` directive to implement. - * - * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles. - */ -function redirectTitleConfig(config) { - const { titleMarkConfig, subtitleMarkConfig, subtitle } = extractTitleConfig(config.title); - // set config.style if title/subtitleMarkConfig is not an empty object - if (!isEmpty(titleMarkConfig)) { - config.style['group-title'] = Object.assign(Object.assign({}, config.style['group-title']), titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega - ); - } - if (!isEmpty(subtitleMarkConfig)) { - config.style['group-subtitle'] = Object.assign(Object.assign({}, config.style['group-subtitle']), subtitleMarkConfig); - } - // subtitle part can stay in config.title since header titles do not use subtitle - if (!isEmpty(subtitle)) { - config.title = subtitle; - } - else { - delete config.title; - } -} -function redirectConfigToStyleConfig(config, prop, // string = composite mark -toProp, compositeMarkPart) { - const propConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop]; - if (prop === 'view') { - toProp = 'cell'; // View's default style is "cell" - } - const style = Object.assign(Object.assign({}, propConfig), config.style[toProp !== null && toProp !== void 0 ? toProp : prop]); - // set config.style if it is not an empty object - if (!isEmpty(style)) { - config.style[toProp !== null && toProp !== void 0 ? toProp : prop] = style; - } - if (!compositeMarkPart) { - // For composite mark, so don't delete the whole config yet as we have to do multiple redirections. - delete config[prop]; - } -} -//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/config.js.map b/node_modules/vega-lite/build/src/config.js.map deleted file mode 100644 index 1761a05..0000000 --- a/node_modules/vega-lite/build/src/config.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,EAAyB,sBAAsB,EAAC,MAAM,QAAQ,CAAC;AACtE,OAAO,EAA4B,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAC,qBAAq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AAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAC9B,kBAAkB,CACtB,CAAC;KACH;IAED,iFAAiF;IACjF,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACtB,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAC;KACzB;SAAM;QACL,OAAO,MAAM,CAAC,KAAK,CAAC;KACrB;AACH,CAAC;AAED,SAAS,2BAA2B,CAClC,MAAc,EACd,IAA4B,EAAE,0BAA0B;AACxD,MAAe,EACf,iBAA0B;IAE1B,MAAM,UAAU,GAAe,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAElG,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,MAAM,GAAG,MAAM,CAAC,CAAC,iCAAiC;KACnD;IAED,MAAM,KAAK,mCACN,UAAU,GACT,MAAM,CAAC,KAAK,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,CAAgB,CAChD,CAAC;IAEF,gDAAgD;IAChD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACnB,MAAM,CAAC,KAAK,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,CAAC,GAAG,KAAK,CAAC;KACtC;IAED,IAAI,CAAC,iBAAiB,EAAE;QACtB,mGAAmG;QACnG,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;KACrB;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/data.d.ts b/node_modules/vega-lite/build/src/data.d.ts deleted file mode 100644 index 0e0bf94..0000000 --- a/node_modules/vega-lite/build/src/data.d.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { Vector2 } from 'vega'; -import { FieldName } from './channeldef'; -import { VgData } from './vega.schema'; -export declare type ParseValue = null | string | 'string' | 'boolean' | 'date' | 'number'; -export interface Parse { - [field: string]: ParseValue; -} -export interface DataFormatBase { - /** - * If set to `null`, disable type inference based on the spec and only use type inference based on the data. - * Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `"number"`, `"boolean"`, `"date"`, or null (do not parse the field)). - * For example, `"parse": {"modified_on": "date"}` parses the `modified_on` field in each input record a Date value. - * - * For `"date"`, we parse data based using Javascript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse). - * For Specific date formats can be provided (e.g., `{foo: "date:'%m%d%Y'"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: "utc:'%m%d%Y'"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc) - */ - parse?: Parse | null; - /** - * Type of input data: `"json"`, `"csv"`, `"tsv"`, `"dsv"`. - * - * __Default value:__ The default format type is determined by the extension of the file URL. - * If no extension is detected, `"json"` will be used by default. - */ - type?: 'csv' | 'tsv' | 'dsv' | 'json' | 'topojson'; -} -export interface CsvDataFormat extends DataFormatBase { - type?: 'csv' | 'tsv'; -} -export interface DsvDataFormat extends DataFormatBase { - type?: 'dsv'; - /** - * The delimiter between records. The delimiter must be a single character (i.e., a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not. - * - * @minLength 1 - * @maxLength 1 - */ - delimiter: string; -} -export interface JsonDataFormat extends DataFormatBase { - type?: 'json'; - /** - * The JSON property containing the desired data. - * This parameter can be used when the loaded JSON file may have surrounding structure or meta-data. - * For example `"property": "values.features"` is equivalent to retrieving `json.values.features` - * from the loaded JSON object. - */ - property?: string; -} -export interface TopoDataFormat extends DataFormatBase { - type?: 'topojson'; - /** - * The name of the TopoJSON object set to convert to a GeoJSON feature collection. - * For example, in a map of the world, there may be an object set named `"countries"`. - * Using the feature property, we can extract this set and generate a GeoJSON feature object for each country. - */ - feature?: string; - /** - * The name of the TopoJSON object set to convert to mesh. - * Similar to the `feature` option, `mesh` extracts a named TopoJSON object set. - * Unlike the `feature` option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features. - * Extracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties. - */ - mesh?: string; -} -export declare type DataFormat = CsvDataFormat | DsvDataFormat | JsonDataFormat | TopoDataFormat; -export declare type DataFormatType = 'json' | 'csv' | 'tsv' | 'dsv' | 'topojson'; -export declare type DataSource = UrlData | InlineData | NamedData; -export declare type Data = DataSource | Generator; -export declare type InlineDataset = number[] | string[] | boolean[] | object[] | string | object; -export interface DataBase { - /** - * An object that specifies the format for parsing the data. - */ - format?: DataFormat; - /** - * Provide a placeholder name and bind data at runtime. - */ - name?: string; -} -export interface UrlData extends DataBase { - /** - * An URL from which to load the data set. Use the `format.type` property - * to ensure the loaded data is correctly parsed. - */ - url: string; -} -export interface InlineData extends DataBase { - /** - * The full data set, included inline. This can be an array of objects or primitive values, an object, or a string. - * Arrays of primitive values are ingested as objects with a `data` property. Strings are parsed according to the specified format type. - */ - values: InlineDataset; -} -export interface NamedData extends DataBase { - /** - * Provide a placeholder name and bind data at runtime. - */ - name: string; -} -export declare function isUrlData(data: Partial | Partial): data is UrlData; -export declare function isInlineData(data: Partial | Partial): data is InlineData; -export declare function isNamedData(data: Partial | Partial): data is NamedData; -export declare function isGenerator(data: Partial | Partial): data is Generator; -export declare function isSequenceGenerator(data: Partial | Partial): data is SequenceGenerator; -export declare function isSphereGenerator(data: Partial | Partial): data is SphereGenerator; -export declare function isGraticuleGenerator(data: Partial | Partial): data is GraticuleGenerator; -export declare enum DataSourceType { - Raw = 0, - Main = 1, - Row = 2, - Column = 3, - Lookup = 4 -} -export declare type Generator = SequenceGenerator | SphereGenerator | GraticuleGenerator; -export interface GeneratorBase { - /** - * Provide a placeholder name and bind data at runtime. - */ - name?: string; -} -export interface SequenceGenerator extends GeneratorBase { - /** - * Generate a sequence of numbers. - */ - sequence: SequenceParams; -} -export interface SequenceParams { - /** - * The starting value of the sequence (inclusive). - */ - start: number; - /** - * The ending value of the sequence (exclusive). - */ - stop: number; - /** - * The step value between sequence entries. - * - * __Default value:__ `1` - */ - step?: number; - /** - * The name of the generated sequence field. - * - * __Default value:__ `"data"` - */ - as?: FieldName; -} -export interface SphereGenerator extends GeneratorBase { - /** - * Generate sphere GeoJSON data for the full globe. - */ - sphere: true | {}; -} -export interface GraticuleGenerator extends GeneratorBase { - /** - * Generate graticule GeoJSON data for geographic reference lines. - */ - graticule: true | GraticuleParams; -} -export interface GraticuleParams { - /** - * The major extent of the graticule as a two-element array of coordinates. - */ - extentMajor?: Vector2>; - /** - * The minor extent of the graticule as a two-element array of coordinates. - */ - extentMinor?: Vector2>; - /** - * Sets both the major and minor extents to the same values. - */ - extent?: Vector2>; - /** - * The major step angles of the graticule. - * - * - * __Default value:__ `[90, 360]` - */ - stepMajor?: Vector2; - /** - * The minor step angles of the graticule. - * - * __Default value:__ `[10, 10]` - */ - stepMinor?: Vector2; - /** - * Sets both the major and minor step angles to the same values. - */ - step?: Vector2; - /** - * The precision of the graticule in degrees. - * - * __Default value:__ `2.5` - */ - precision?: number; -} -//# sourceMappingURL=data.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/data.d.ts.map b/node_modules/vega-lite/build/src/data.d.ts.map deleted file mode 100644 index ac78df3..0000000 --- a/node_modules/vega-lite/build/src/data.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAErC,oBAAY,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElF,MAAM,WAAW,KAAK;IACpB,CAAC,KA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,CAAC;CACpB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/data.js b/node_modules/vega-lite/build/src/data.js deleted file mode 100644 index c3845b6..0000000 --- a/node_modules/vega-lite/build/src/data.js +++ /dev/null @@ -1,30 +0,0 @@ -export function isUrlData(data) { - return 'url' in data; -} -export function isInlineData(data) { - return 'values' in data; -} -export function isNamedData(data) { - return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data); -} -export function isGenerator(data) { - return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data)); -} -export function isSequenceGenerator(data) { - return 'sequence' in data; -} -export function isSphereGenerator(data) { - return 'sphere' in data; -} -export function isGraticuleGenerator(data) { - return 'graticule' in data; -} -export var DataSourceType; -(function (DataSourceType) { - DataSourceType[DataSourceType["Raw"] = 0] = "Raw"; - DataSourceType[DataSourceType["Main"] = 1] = "Main"; - DataSourceType[DataSourceType["Row"] = 2] = "Row"; - DataSourceType[DataSourceType["Column"] = 3] = "Column"; - DataSourceType[DataSourceType["Lookup"] = 4] = "Lookup"; -})(DataSourceType || (DataSourceType = {})); -//# sourceMappingURL=data.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/data.js.map b/node_modules/vega-lite/build/src/data.js.map deleted file mode 100644 index 31b9dc4..0000000 --- a/node_modules/vega-lite/build/src/data.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AA0HA,MAAM,UAAU,SAAS,CAAC,IAAqC;IAC7D,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAqC;IAChE,OAAO,QAAQ,IAAI,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAqC;IAC/D,OAAO,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AACzF,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAqC;IAC/D,OAAO,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;AACtG,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAqC;IACvE,OAAO,UAAU,IAAI,IAAI,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAqC;IACrE,OAAO,QAAQ,IAAI,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAqC;IACxE,OAAO,WAAW,IAAI,IAAI,CAAC;AAC7B,CAAC;AAED,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,iDAAG,CAAA;IACH,mDAAI,CAAA;IACJ,iDAAG,CAAA;IACH,uDAAM,CAAA;IACN,uDAAM,CAAA;AACR,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/datetime.d.ts b/node_modules/vega-lite/build/src/datetime.d.ts deleted file mode 100644 index 1e1f831..0000000 --- a/node_modules/vega-lite/build/src/datetime.d.ts +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @minimum 1 - * @maximum 12 - * @TJS-type integer - */ -export declare type Month = number; -/** - * @minimum 1 - * @maximum 7 - */ -export declare type Day = number; -/** - * Object for defining datetime in Vega-Lite Filter. - * If both month and quarter are provided, month has higher precedence. - * `day` cannot be combined with other date. - * We accept string for month and day names. - */ -export interface DateTime { - /** - * Integer value representing the year. - * @TJS-type integer - */ - year?: number; - /** - * Integer value representing the quarter of the year (from 1-4). - * @minimum 1 - * @maximum 4 - * @TJS-type integer - */ - quarter?: number; - /** - * One of: - * (1) integer value representing the month from `1`-`12`. `1` represents January; - * (2) case-insensitive month name (e.g., `"January"`); - * (3) case-insensitive, 3-character short month name (e.g., `"Jan"`). - */ - month?: Month | string; - /** - * Integer value representing the date (day of the month) from 1-31. - * @minimum 1 - * @maximum 31 - * @TJS-type integer - */ - date?: number; - /** - * Value representing the day of a week. This can be one of: - * (1) integer value -- `1` represents Monday; - * (2) case-insensitive day name (e.g., `"Monday"`); - * (3) case-insensitive, 3-character short day name (e.g., `"Mon"`). - * - * **Warning:** A DateTime definition object with `day`** should not be combined with `year`, `quarter`, `month`, or `date`. - */ - day?: Day | string; - /** - * Integer value representing the hour of a day from 0-23. - * @minimum 0 - * @maximum 24 - * @TJS-type integer - */ - hours?: number; - /** - * Integer value representing the minute segment of time from 0-59. - * @minimum 0 - * @maximum 60 - * @TJS-type integer - */ - minutes?: number; - /** - * Integer value representing the second segment (0-59) of a time value - * @minimum 0 - * @maximum 60 - * @TJS-type integer - */ - seconds?: number; - /** - * Integer value representing the millisecond segment of time. - * @minimum 0 - * @maximum 1000 - * @TJS-type integer - */ - milliseconds?: number; - /** - * A boolean flag indicating if date time is in utc time. If false, the date time is in local time - */ - utc?: boolean; -} -/** - * Internal Object for defining datetime expressions. - * This is an expression version of DateTime. - * If both month and quarter are provided, month has higher precedence. - * `day` cannot be combined with other date. - */ -export interface DateTimeExpr { - year?: string; - quarter?: string; - month?: string; - date?: string; - day?: string; - hours?: string; - minutes?: string; - seconds?: string; - milliseconds?: string; - utc?: boolean; -} -export declare function isDateTime(o: any): o is DateTime; -export declare const MONTHS: string[]; -export declare const SHORT_MONTHS: string[]; -export declare const DAYS: string[]; -export declare const SHORT_DAYS: string[]; -/** - * Return Vega expression for a date time. - * - * @param d the date time. - * @returns the Vega expression. - */ -export declare function dateTimeToExpr(d: DateTime): string; -/** - * Return Vega expression for a date time expression. - * - * @param d the internal date time object with expression. - * @returns the Vega expression. - */ -export declare function dateTimeExprToExpr(d: DateTimeExpr): string; -/** - * @param d the date time. - * @returns the timestamp. - */ -export declare function dateTimeToTimestamp(d: DateTime): number; -//# sourceMappingURL=datetime.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/datetime.d.ts.map b/node_modules/vega-lite/build/src/datetime.d.ts.map deleted file mode 100644 index f33f486..0000000 --- a/node_modules/vega-lite/build/src/datetime.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../../src/datetime.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,oBAAY,KAAK,GAAG,MAAM,CAAC;AAE3B;;;GAGG;AACH,oBAAY,GAAG,GAAG,MAAM,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,QAAQ,CAShD;AAED,eAAO,MAAM,MAAM,UAalB,CAAC;AACF,eAAO,MAAM,YAAY,UAAkC,CAAC;AAE5D,eAAO,MAAM,IAAI,UAAiF,CAAC;AACnG,eAAO,MAAM,UAAU,UAAgC,CAAC;AA4HxD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,UAUzC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,YAAY,UAUjD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,QAAQ,UAQ9C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/datetime.js b/node_modules/vega-lite/build/src/datetime.js deleted file mode 100644 index 9e9a354..0000000 --- a/node_modules/vega-lite/build/src/datetime.js +++ /dev/null @@ -1,194 +0,0 @@ -// DateTime definition object -import { isNumber, isObject } from 'vega-util'; -import * as log from './log'; -import { TIMEUNIT_PARTS } from './timeunit'; -import { duplicate, isNumeric, keys } from './util'; -export function isDateTime(o) { - if (o && isObject(o)) { - for (const part of TIMEUNIT_PARTS) { - if (part in o) { - return true; - } - } - } - return false; -} -export const MONTHS = [ - 'january', - 'february', - 'march', - 'april', - 'may', - 'june', - 'july', - 'august', - 'september', - 'october', - 'november', - 'december' -]; -export const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3)); -export const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; -export const SHORT_DAYS = DAYS.map(d => d.substr(0, 3)); -function normalizeQuarter(q) { - if (isNumeric(q)) { - q = +q; - } - if (isNumber(q)) { - if (q > 4) { - log.warn(log.message.invalidTimeUnit('quarter', q)); - } - // We accept 1-based quarter, so need to readjust to 0-based quarter - return q - 1; - } - else { - // Invalid quarter - throw new Error(log.message.invalidTimeUnit('quarter', q)); - } -} -function normalizeMonth(m) { - if (isNumeric(m)) { - m = +m; - } - if (isNumber(m)) { - // We accept 1-based month, so need to readjust to 0-based month - return m - 1; - } - else { - const lowerM = m.toLowerCase(); - const monthIndex = MONTHS.indexOf(lowerM); - if (monthIndex !== -1) { - return monthIndex; // 0 for january, ... - } - const shortM = lowerM.substr(0, 3); - const shortMonthIndex = SHORT_MONTHS.indexOf(shortM); - if (shortMonthIndex !== -1) { - return shortMonthIndex; - } - // Invalid month - throw new Error(log.message.invalidTimeUnit('month', m)); - } -} -function normalizeDay(d) { - if (isNumeric(d)) { - d = +d; - } - if (isNumber(d)) { - // mod so that this can be both 0-based where 0 = sunday - // and 1-based where 7=sunday - return d % 7; - } - else { - const lowerD = d.toLowerCase(); - const dayIndex = DAYS.indexOf(lowerD); - if (dayIndex !== -1) { - return dayIndex; // 0 for january, ... - } - const shortD = lowerD.substr(0, 3); - const shortDayIndex = SHORT_DAYS.indexOf(shortD); - if (shortDayIndex !== -1) { - return shortDayIndex; - } - // Invalid day - throw new Error(log.message.invalidTimeUnit('day', d)); - } -} -/** - * @param d the date. - * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime. - * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds] - */ -function dateTimeParts(d, normalize) { - const parts = []; - if (normalize && d.day !== undefined) { - if (keys(d).length > 1) { - log.warn(log.message.droppedDay(d)); - d = duplicate(d); - delete d.day; - } - } - if (d.year !== undefined) { - parts.push(d.year); - } - else { - // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega - // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year). - parts.push(2012); - } - if (d.month !== undefined) { - const month = normalize ? normalizeMonth(d.month) : d.month; - parts.push(month); - } - else if (d.quarter !== undefined) { - const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter; - parts.push(isNumber(quarter) ? quarter * 3 : quarter + '*3'); - } - else { - parts.push(0); // months start at zero in JS - } - if (d.date !== undefined) { - parts.push(d.date); - } - else if (d.day !== undefined) { - // HACK: Day only works as a standalone unit - // This is only correct because we always set year to 2006 for day - const day = normalize ? normalizeDay(d.day) : d.day; - parts.push(isNumber(day) ? day + 1 : day + '+1'); - } - else { - parts.push(1); // Date starts at 1 in JS - } - // Note: can't use TimeUnit enum here as importing it will create - // circular dependency problem! - for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds']) { - const unit = d[timeUnit]; - parts.push(typeof unit === 'undefined' ? 0 : unit); - } - return parts; -} -/** - * Return Vega expression for a date time. - * - * @param d the date time. - * @returns the Vega expression. - */ -export function dateTimeToExpr(d) { - const parts = dateTimeParts(d, true); - const string = parts.join(', '); - if (d.utc) { - return `utc(${string})`; - } - else { - return `datetime(${string})`; - } -} -/** - * Return Vega expression for a date time expression. - * - * @param d the internal date time object with expression. - * @returns the Vega expression. - */ -export function dateTimeExprToExpr(d) { - const parts = dateTimeParts(d, false); - const string = parts.join(', '); - if (d.utc) { - return `utc(${string})`; - } - else { - return `datetime(${string})`; - } -} -/** - * @param d the date time. - * @returns the timestamp. - */ -export function dateTimeToTimestamp(d) { - const parts = dateTimeParts(d, true); - if (d.utc) { - return +new Date(Date.UTC(...parts)); - } - else { - return +new Date(...parts); - } -} -//# sourceMappingURL=datetime.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/datetime.js.map b/node_modules/vega-lite/build/src/datetime.js.map deleted file mode 100644 index 976310f..0000000 --- a/node_modules/vega-lite/build/src/datetime.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"datetime.js","sourceRoot":"","sources":["../../src/datetime.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAE7B,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAA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-lite/build/src/encoding.d.ts deleted file mode 100644 index 53259dd..0000000 --- a/node_modules/vega-lite/build/src/encoding.d.ts +++ /dev/null @@ -1,213 +0,0 @@ -import { Channel } from './channel'; -import { ChannelDef, ColorDef, Field, FieldDef, FieldDefWithoutScale, LatLongDef, NumericArrayMarkPropDef, NumericMarkPropDef, OrderFieldDef, OrderValueDef, PolarDef, Position2Def, PositionDef, ShapeDef, StringFieldDef, StringFieldDefWithCondition, StringValueDefWithCondition, TextDef, TypedFieldDef } from './channeldef'; -import { Config } from './config'; -import { Mark } from './mark'; -import { EncodingFacetMapping } from './spec/facet'; -import { AggregatedFieldDef, BinTransform, TimeUnitTransform } from './transform'; -export interface Encoding { - /** - * X coordinates of the marks, or width of horizontal `"bar"` and `"area"` without specified `x2` or `width`. - * - * The `value` of this channel can be a number or a string `"width"` for the width of the plot. - */ - x?: PositionDef; - /** - * Y coordinates of the marks, or height of vertical `"bar"` and `"area"` without specified `y2` or `height`. - * - * The `value` of this channel can be a number or a string `"height"` for the height of the plot. - */ - y?: PositionDef; - /** - * X2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - * - * The `value` of this channel can be a number or a string `"width"` for the width of the plot. - */ - x2?: Position2Def; - /** - * Y2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - * - * The `value` of this channel can be a number or a string `"height"` for the height of the plot. - */ - y2?: Position2Def; - /** - * Longitude position of geographically projected marks. - */ - longitude?: LatLongDef; - /** - * Latitude position of geographically projected marks. - */ - latitude?: LatLongDef; - /** - * Longitude-2 position for geographically projected ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - */ - longitude2?: Position2Def; - /** - * Latitude-2 position for geographically projected ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - */ - latitude2?: Position2Def; - /** - * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.) - * - * - For text marks, polar coordinate angle in radians. - */ - theta?: PolarDef; - /** - * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise. - */ - theta2?: Position2Def; - /** - * The outer radius in pixels of arc marks. - */ - radius?: PolarDef; - /** - * The inner radius in pixels of arc marks. - */ - radius2?: Position2Def; - /** - * Color of the marks – either fill or stroke color based on the `filled` property of mark definition. - * By default, `color` represents fill color for `"area"`, `"bar"`, `"tick"`, - * `"text"`, `"trail"`, `"circle"`, and `"square"` / stroke color for `"line"` and `"point"`. - * - * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property. - * - * _Note:_ - * 1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified. - * 2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme). - */ - color?: ColorDef; - /** - * Fill color of the marks. - * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property. - * - * _Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified. - */ - fill?: ColorDef; - /** - * Stroke color of the marks. - * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property. - * - * _Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified. - */ - stroke?: ColorDef; - /** - * Opacity of the marks. - * - * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `opacity` property. - */ - opacity?: NumericMarkPropDef; - /** - * Fill opacity of the marks. - * - * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `fillOpacity` property. - */ - fillOpacity?: NumericMarkPropDef; - /** - * Stroke opacity of the marks. - * - * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeOpacity` property. - */ - strokeOpacity?: NumericMarkPropDef; - /** - * Stroke width of the marks. - * - * __Default value:__ If undefined, the default stroke width depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeWidth` property. - */ - strokeWidth?: NumericMarkPropDef; - /** - * Stroke dash of the marks. - * - * __Default value:__ `[1,0]` (No dash). - */ - strokeDash?: NumericArrayMarkPropDef; - /** - * Size of the mark. - * - For `"point"`, `"square"` and `"circle"`, – the symbol size, or pixel area of the mark. - * - For `"bar"` and `"tick"` – the bar and tick's size. - * - For `"text"` – the text's font size. - * - Size is unsupported for `"line"`, `"area"`, and `"rect"`. (Use `"trail"` instead of line with varying size) - */ - size?: NumericMarkPropDef; - /** - * Rotation angle of point and text marks. - */ - angle?: NumericMarkPropDef; - /** - * Shape of the mark. - * - * 1. For `point` marks the supported values include: - * - plotting shapes: `"circle"`, `"square"`, `"cross"`, `"diamond"`, `"triangle-up"`, `"triangle-down"`, `"triangle-right"`, or `"triangle-left"`. - * - the line symbol `"stroke"` - * - centered directional shapes `"arrow"`, `"wedge"`, or `"triangle"` - * - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.) - * - * 2. For `geoshape` marks it should be a field definition of the geojson data - * - * __Default value:__ If undefined, the default shape depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#point-config)'s `shape` property. (`"circle"` if unset.) - */ - shape?: ShapeDef; - /** - * Additional levels of detail for grouping data in aggregate views and - * in line, trail, and area marks without mapping data to a specific visual channel. - */ - detail?: FieldDefWithoutScale | FieldDefWithoutScale[]; - /** - * A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data. - */ - key?: FieldDefWithoutScale; - /** - * Text of the `text` mark. - */ - text?: TextDef; - /** - * The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def). - * - * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite. - */ - tooltip?: StringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[] | null; - /** - * A URL to load upon mouse click. - */ - href?: StringFieldDefWithCondition | StringValueDefWithCondition; - /** - * The URL of an image mark. - */ - url?: StringFieldDefWithCondition | StringValueDefWithCondition; - /** - * A text description of this mark for ARIA accessibility (SVG output only). For SVG output the `"aria-label"` attribute will be set to this description. - */ - description?: StringFieldDefWithCondition | StringValueDefWithCondition; - /** - * Order of the marks. - * - For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order). - * - For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{"value": null}` makes the line marks use the original order in the data sources. - * - Otherwise, this `order` channel encodes layer order of the marks. - * - * __Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping. - */ - order?: OrderFieldDef | OrderFieldDef[] | OrderValueDef; -} -export interface EncodingWithFacet extends Encoding, EncodingFacetMapping { -} -export declare function channelHasField(encoding: EncodingWithFacet, channel: keyof EncodingWithFacet): boolean; -export declare function isAggregate(encoding: EncodingWithFacet): boolean; -export declare function extractTransformsFromEncoding(oldEncoding: Encoding, config: Config): { - bins: BinTransform[]; - timeUnits: TimeUnitTransform[]; - aggregate: AggregatedFieldDef[]; - groupby: string[]; - encoding: Encoding; -}; -export declare function markChannelCompatible(encoding: Encoding, channel: Channel, mark: Mark): boolean; -export declare function initEncoding(encoding: Encoding, mark: Mark, filled: boolean, config: Config): Encoding; -/** - * For composite marks, we have to call initChannelDef during init so we can infer types earlier. - */ -export declare function normalizeEncoding(encoding: Encoding, config: Config): Encoding; -export declare function fieldDefs(encoding: EncodingWithFacet): FieldDef[]; -export declare function forEach>(mapping: U, f: (cd: ChannelDef, c: keyof U) => void, thisArg?: any): void; -export declare function reduce>(mapping: U, f: (acc: any, fd: TypedFieldDef, c: keyof U) => U, init: T, thisArg?: any): any; -/** - * Returns list of path grouping fields for the given encoding - */ -export declare function pathGroupingFields(mark: Mark, encoding: Encoding): string[]; -//# sourceMappingURL=encoding.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/encoding.d.ts.map b/node_modules/vega-lite/build/src/encoding.d.ts.map deleted file mode 100644 index a37d8a8..0000000 --- a/node_modules/vega-lite/build/src/encoding.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../src/encoding.ts"],"names":[],"mappings":"AAIA,OAAO,EAsCL,OAAO,EACR,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,oBAAoB,EAWpB,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,WAAW,EAEX,QAAQ,EACR,cAAc,EACd,2BAA2B,EAC3B,2BAA2B,EAC3B,OAAO,EAEP,aAAa,EAEd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAKhF,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,KAAK;IACvC;;;;OAIG;IACH,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAEnB;;;;OAIG;IACH,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAEnB;;;;OAIG;IAGH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,EAAE,GAAG,EAAE,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,EACzD,IAAI,EAAE,CAAC,EACP,OAAO,CAAC,EAAE,GAAG,OAgBd;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAgFnF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/encoding.js b/node_modules/vega-lite/build/src/encoding.js deleted file mode 100644 index f3a6796..0000000 --- a/node_modules/vega-lite/build/src/encoding.js +++ /dev/null @@ -1,362 +0,0 @@ -import { __rest } from "tslib"; -import { array, isArray } from 'vega-util'; -import { isArgmaxDef, isArgminDef } from './aggregate'; -import { isBinned, isBinning } from './bin'; -import { ANGLE, CHANNELS, COLOR, DESCRIPTION, DETAIL, FILL, FILLOPACITY, HREF, isChannel, isNonPositionScaleChannel, isSecondaryRangeChannel, isXorY, KEY, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, OPACITY, ORDER, RADIUS, RADIUS2, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, supportMark, TEXT, THETA, THETA2, TOOLTIP, URL, X, X2, Y, Y2 } from './channel'; -import { binRequiresRange, getFieldDef, getGuide, hasConditionalFieldDef, initChannelDef, initFieldDef, isConditionalDef, isDatumDef, isFieldDef, isTypedFieldDef, isValueDef, title, vgField } from './channeldef'; -import * as log from './log'; -import { QUANTITATIVE, TEMPORAL } from './type'; -import { keys, some } from './util'; -import { isSignalRef } from './vega.schema'; -export function channelHasField(encoding, channel) { - const channelDef = encoding && encoding[channel]; - if (channelDef) { - if (isArray(channelDef)) { - return some(channelDef, fieldDef => !!fieldDef.field); - } - else { - return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef); - } - } - return false; -} -export function isAggregate(encoding) { - return some(CHANNELS, channel => { - if (channelHasField(encoding, channel)) { - const channelDef = encoding[channel]; - if (isArray(channelDef)) { - return some(channelDef, fieldDef => !!fieldDef.aggregate); - } - else { - const fieldDef = getFieldDef(channelDef); - return fieldDef && !!fieldDef.aggregate; - } - } - return false; - }); -} -export function extractTransformsFromEncoding(oldEncoding, config) { - const groupby = []; - const bins = []; - const timeUnits = []; - const aggregate = []; - const encoding = {}; - forEach(oldEncoding, (channelDef, channel) => { - // Extract potential embedded transformations along with remaining properties - if (isFieldDef(channelDef)) { - const { field, aggregate: aggOp, bin, timeUnit } = channelDef, remaining = __rest(channelDef, ["field", "aggregate", "bin", "timeUnit"]); - if (aggOp || timeUnit || bin) { - const guide = getGuide(channelDef); - const isTitleDefined = guide && guide.title; - let newField = vgField(channelDef, { forAs: true }); - const newFieldDef = Object.assign(Object.assign(Object.assign({}, (isTitleDefined ? [] : { title: title(channelDef, config, { allowDisabling: true }) })), remaining), { - // Always overwrite field - field: newField }); - if (aggOp) { - let op; - if (isArgmaxDef(aggOp)) { - op = 'argmax'; - newField = vgField({ op: 'argmax', field: aggOp.argmax }, { forAs: true }); - newFieldDef.field = `${newField}.${field}`; - } - else if (isArgminDef(aggOp)) { - op = 'argmin'; - newField = vgField({ op: 'argmin', field: aggOp.argmin }, { forAs: true }); - newFieldDef.field = `${newField}.${field}`; - } - else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') { - op = aggOp; - } - if (op) { - const aggregateEntry = { - op, - as: newField - }; - if (field) { - aggregateEntry.field = field; - } - aggregate.push(aggregateEntry); - } - } - else { - groupby.push(newField); - if (isTypedFieldDef(channelDef) && isBinning(bin)) { - bins.push({ bin, field, as: newField }); - // Add additional groupbys for range and end of bins - groupby.push(vgField(channelDef, { binSuffix: 'end' })); - if (binRequiresRange(channelDef, channel)) { - groupby.push(vgField(channelDef, { binSuffix: 'range' })); - } - // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively - if (isXorY(channel)) { - const secondaryChannel = { - field: newField + '_end' - }; - encoding[channel + '2'] = secondaryChannel; - } - newFieldDef.bin = 'binned'; - if (!isSecondaryRangeChannel(channel)) { - newFieldDef['type'] = QUANTITATIVE; - } - } - else if (timeUnit) { - timeUnits.push({ - timeUnit, - field, - as: newField - }); - // define the format type for later compilation - const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time'; - if (formatType) { - if (channel === TEXT || channel === TOOLTIP) { - newFieldDef['formatType'] = formatType; - } - else if (isNonPositionScaleChannel(channel)) { - newFieldDef['legend'] = Object.assign({ formatType }, newFieldDef['legend']); - } - else if (isXorY(channel)) { - newFieldDef['axis'] = Object.assign({ formatType }, newFieldDef['axis']); - } - } - } - } - // now the field should refer to post-transformed field instead - encoding[channel] = newFieldDef; - } - else { - groupby.push(field); - encoding[channel] = oldEncoding[channel]; - } - } - else { - // For value def / signal ref / datum def, just copy - encoding[channel] = oldEncoding[channel]; - } - }); - return { - bins, - timeUnits, - aggregate, - groupby, - encoding - }; -} -export function markChannelCompatible(encoding, channel, mark) { - const markSupported = supportMark(channel, mark); - if (!markSupported) { - return false; - } - else if (markSupported === 'binned') { - const primaryFieldDef = encoding[channel === X2 ? X : Y]; - // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef - // has "binned" data and thus need x2/y2 to specify the bin-end field. - if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) { - return true; - } - else { - return false; - } - } - return true; -} -export function initEncoding(encoding, mark, filled, config) { - return keys(encoding).reduce((normalizedEncoding, channel) => { - if (!isChannel(channel)) { - // Drop invalid channel - log.warn(log.message.invalidEncodingChannel(channel)); - return normalizedEncoding; - } - const channelDef = encoding[channel]; - if (channel === 'angle' && mark === 'arc' && !encoding.theta) { - log.warn(log.message.REPLACE_ANGLE_WITH_THETA); - channel = THETA; - } - if (!markChannelCompatible(encoding, channel, mark)) { - // Drop unsupported channel - log.warn(log.message.incompatibleChannel(channel, mark)); - return normalizedEncoding; - } - // Drop line's size if the field is aggregated. - if (channel === SIZE && mark === 'line') { - const fieldDef = getFieldDef(encoding[channel]); - if (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.aggregate) { - log.warn(log.message.LINE_WITH_VARYING_SIZE); - return normalizedEncoding; - } - } - // Drop color if either fill or stroke is specified - if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) { - log.warn(log.message.droppingColor('encoding', { fill: 'fill' in encoding, stroke: 'stroke' in encoding })); - return normalizedEncoding; - } - if (channel === DETAIL || - (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) || - (channel === TOOLTIP && isArray(channelDef))) { - if (channelDef) { - // Array of fieldDefs for detail channel (or production rule) - normalizedEncoding[channel] = array(channelDef).reduce((defs, fieldDef) => { - if (!isFieldDef(fieldDef)) { - log.warn(log.message.emptyFieldDef(fieldDef, channel)); - } - else { - defs.push(initFieldDef(fieldDef, channel)); - } - return defs; - }, []); - } - } - else { - if (channel === TOOLTIP && channelDef === null) { - // Preserve null so we can use it to disable tooltip - normalizedEncoding[channel] = null; - } - else if (!isFieldDef(channelDef) && - !isDatumDef(channelDef) && - !isValueDef(channelDef) && - !isConditionalDef(channelDef) && - !isSignalRef(channelDef)) { - log.warn(log.message.emptyFieldDef(channelDef, channel)); - return normalizedEncoding; - } - normalizedEncoding[channel] = initChannelDef(channelDef, channel, config); - } - return normalizedEncoding; - }, {}); -} -/** - * For composite marks, we have to call initChannelDef during init so we can infer types earlier. - */ -export function normalizeEncoding(encoding, config) { - return keys(encoding).reduce((normalizedEncoding, channel) => { - const newChannelDef = initChannelDef(encoding[channel], channel, config, { compositeMark: true }); - normalizedEncoding[channel] = newChannelDef; - return normalizedEncoding; - }, {}); -} -export function fieldDefs(encoding) { - const arr = []; - for (const channel of keys(encoding)) { - if (channelHasField(encoding, channel)) { - const channelDef = encoding[channel]; - const channelDefArray = array(channelDef); - for (const def of channelDefArray) { - if (isFieldDef(def)) { - arr.push(def); - } - else if (hasConditionalFieldDef(def)) { - arr.push(def.condition); - } - } - } - } - return arr; -} -export function forEach(mapping, f, thisArg) { - if (!mapping) { - return; - } - for (const channel of keys(mapping)) { - const el = mapping[channel]; - if (isArray(el)) { - for (const channelDef of el) { - f.call(thisArg, channelDef, channel); - } - } - else { - f.call(thisArg, el, channel); - } - } -} -export function reduce(mapping, f, init, thisArg) { - if (!mapping) { - return init; - } - return keys(mapping).reduce((r, channel) => { - const map = mapping[channel]; - if (isArray(map)) { - return map.reduce((r1, channelDef) => { - return f.call(thisArg, r1, channelDef, channel); - }, r); - } - else { - return f.call(thisArg, r, map, channel); - } - }, init); -} -/** - * Returns list of path grouping fields for the given encoding - */ -export function pathGroupingFields(mark, encoding) { - return keys(encoding).reduce((details, channel) => { - switch (channel) { - // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group - case X: - case Y: - case HREF: - case DESCRIPTION: - case URL: - case X2: - case Y2: - case THETA: - case THETA2: - case RADIUS: - case RADIUS2: - // falls through - case LATITUDE: - case LONGITUDE: - case LATITUDE2: - case LONGITUDE2: - // TODO: case 'cursor': - // text, shape, shouldn't be a part of line/trail/area [falls through] - case TEXT: - case SHAPE: - case ANGLE: - // falls through - // tooltip fields should not be added to group by [falls through] - case TOOLTIP: - return details; - case ORDER: - // order should not group line / trail - if (mark === 'line' || mark === 'trail') { - return details; - } - // but order should group area for stacking (falls through) - case DETAIL: - case KEY: { - const channelDef = encoding[channel]; - if (isArray(channelDef) || isFieldDef(channelDef)) { - for (const fieldDef of array(channelDef)) { - if (!fieldDef.aggregate) { - details.push(vgField(fieldDef, {})); - } - } - } - return details; - } - case SIZE: - if (mark === 'trail') { - // For trail, size should not group trail lines. - return details; - } - // For line, size should group lines. - // falls through - case COLOR: - case FILL: - case STROKE: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEDASH: - case STROKEWIDTH: { - // TODO strokeDashOffset: - // falls through - const fieldDef = getFieldDef(encoding[channel]); - if (fieldDef && !fieldDef.aggregate) { - details.push(vgField(fieldDef, {})); - } - return details; - } - } - }, []); -} -//# sourceMappingURL=encoding.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/encoding.js.map b/node_modules/vega-lite/build/src/encoding.js.map deleted file mode 100644 index 1264f64..0000000 --- a/node_modules/vega-lite/build/src/encoding.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../src/encoding.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACzC,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC1C,OAAO,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,SAAS,EACT,yBAAyB,EACzB,uBAAuB,EACvB,MAAM,EACN,GAAG,EACH,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,IAAI,EACJ,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,IAAI,EACJ,KAAK,EACL,MAAM,EACN,OAAO,EACP,GAAG,EACH,CAAC,EACD,EAAE,EACF,CAAC,EACD,EAAE,EAEH,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,gBAAgB,EAMhB,WAAW,EACX,QAAQ,EACR,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EAeV,KAAK,EAEL,OAAO,EACR,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAI7B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAA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CAAC;YACnB,KAAK,UAAU,CAAC;YAChB,KAAK,WAAW,CAAC,CAAC;gBAChB,yBAAyB;gBACzB,gBAAgB;gBAEhB,MAAM,QAAQ,GAAG,WAAW,CAAS,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;gBACxD,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;oBACnC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;iBACrC;gBACD,OAAO,OAAO,CAAC;aAChB;SACF;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/guide.d.ts b/node_modules/vega-lite/build/src/guide.d.ts deleted file mode 100644 index 0a1d8fa..0000000 --- a/node_modules/vega-lite/build/src/guide.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { SignalRef, Text } from 'vega'; -import { ConditionValueDefMixins, ValueDef } from './channeldef'; -import { LegendConfig } from './legend'; -import { Dict } from './util'; -import { VgEncodeChannel } from './vega.schema'; -export interface TitleMixins { - /** - * A title for the field. If `null`, the title will be removed. - * - * __Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `"Sum of Profit"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `"Profit (binned)"`, `"Transaction Date (year-month)"`). Otherwise, the title is simply the field name. - * - * __Notes__: - * - * 1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title). - * - * 2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used. - */ - title?: Text | null | SignalRef; -} -export interface FormatMixins { - /** - * When used with the default `"number"` and `"time"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks. - * - * - If the format type is `"number"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format). - * - If the format type is `"time"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format). - * - * See the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples. - * - * When used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function. - * - * __Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format. - */ - format?: string | Dict; - /** - * The format type for labels. One of `"number"`, `"time"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type). - * - * __Default value:__ - * - `"time"` for temporal fields and ordinal and nominal fields with `timeUnit`. - * - `"number"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`. - */ - formatType?: 'number' | 'time' | string; - /** - * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text. - * - * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object. - */ - labelExpr?: string; -} -export interface Guide extends TitleMixins, FormatMixins { -} -export interface VlOnlyGuideConfig { - /** - * Set to null to disable title for the axis, legend, or header. - */ - title?: null; -} -export declare type GuideEncodingConditionalValueDef = ValueDef & ConditionValueDefMixins; -export declare type GuideEncodingEntry = Partial>; -export declare const VL_ONLY_LEGEND_CONFIG: (keyof LegendConfig)[]; -//# sourceMappingURL=guide.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/guide.d.ts.map b/node_modules/vega-lite/build/src/guide.d.ts.map deleted file mode 100644 index c02471f..0000000 --- a/node_modules/vega-lite/build/src/guide.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"guide.d.ts","sourceRoot":"","sources":["../../src/guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACrC,OAAO,EAAC,uBAAuB,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAEhC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IAExC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,KAAM,SAAQ,WAAW,EAAE,YAAY;CAAG;AAE3D,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED,oBAAY,gCAAgC,GAAG,QAAQ,GAAG,uBAAuB,CAAC;AAElF,oBAAY,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,gCAAgC,GAAG,SAAS,CAAC,CAAC,CAAC;AAEhH,eAAO,MAAM,qBAAqB,EAAE,CAAC,MAAM,YAAY,CAAC,EAMvD,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/guide.js b/node_modules/vega-lite/build/src/guide.js deleted file mode 100644 index bd1deb1..0000000 --- a/node_modules/vega-lite/build/src/guide.js +++ /dev/null @@ -1,8 +0,0 @@ -export const VL_ONLY_LEGEND_CONFIG = [ - 'gradientHorizontalMaxLength', - 'gradientHorizontalMinLength', - 'gradientVerticalMaxLength', - 'gradientVerticalMinLength', - 'unselectedOpacity' -]; -//# sourceMappingURL=guide.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/guide.js.map b/node_modules/vega-lite/build/src/guide.js.map deleted file mode 100644 index eb88e92..0000000 --- a/node_modules/vega-lite/build/src/guide.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"guide.js","sourceRoot":"","sources":["../../src/guide.ts"],"names":[],"mappings":"AAkEA,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,6BAA6B;IAC7B,6BAA6B;IAC7B,2BAA2B;IAC3B,2BAA2B;IAC3B,mBAAmB;CACpB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/header.d.ts b/node_modules/vega-lite/build/src/header.d.ts deleted file mode 100644 index de04b24..0000000 --- a/node_modules/vega-lite/build/src/header.d.ts +++ /dev/null @@ -1,190 +0,0 @@ -import { Align, Color, FontStyle, FontWeight, Orient, SignalRef, TextBaseline, TitleAnchor, TitleConfig } from 'vega'; -import { FormatMixins, Guide, VlOnlyGuideConfig } from './guide'; -export declare const HEADER_TITLE_PROPERTIES_MAP: Partial>; -export declare const HEADER_LABEL_PROPERTIES_MAP: Partial>; -export declare const HEADER_TITLE_PROPERTIES: ("orient" | "titleAlign" | "titleAnchor" | "titleBaseline" | "titleColor" | "titleFont" | "titleFontSize" | "titleFontStyle" | "titleFontWeight" | "titleLimit" | "titleLineHeight" | "titleOrient" | "titlePadding" | "labelAlign" | "labelBaseline" | "labelColor" | "labelFont" | "labelFontSize" | "labelFontStyle" | "labelFontWeight" | "labelLimit" | "labelPadding" | "labels" | "format" | "formatType" | "labelExpr" | "titleAngle" | "labelAnchor" | "labelAngle" | "labelLineHeight" | "labelOrient")[]; -export declare const HEADER_LABEL_PROPERTIES: ("orient" | "titleAlign" | "titleAnchor" | "titleBaseline" | "titleColor" | "titleFont" | "titleFontSize" | "titleFontStyle" | "titleFontWeight" | "titleLimit" | "titleLineHeight" | "titleOrient" | "titlePadding" | "labelAlign" | "labelBaseline" | "labelColor" | "labelFont" | "labelFontSize" | "labelFontStyle" | "labelFontWeight" | "labelLimit" | "labelPadding" | "labels" | "format" | "formatType" | "labelExpr" | "titleAngle" | "labelAnchor" | "labelAngle" | "labelLineHeight" | "labelOrient")[]; -export interface CoreHeader extends FormatMixins { - /** - * The anchor position for placing the title. One of `"start"`, `"middle"`, or `"end"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title. - */ - titleAnchor?: TitleAnchor; - /** - * Horizontal text alignment (to the anchor) of header titles. - */ - titleAlign?: Align | SignalRef; - /** - * The rotation angle of the header title. - * - * __Default value:__ `0`. - * - * @minimum -360 - * @maximum 360 - */ - titleAngle?: number; - /** - * The vertical text baseline for the header title. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. - * The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone. - * - * __Default value:__ `"middle"` - */ - titleBaseline?: TextBaseline | SignalRef; - /** - * Color of the header title, can be in hex color code or regular color name. - */ - titleColor?: Color | SignalRef; - /** - * Font of the header title. (e.g., `"Helvetica Neue"`). - */ - titleFont?: string | SignalRef; - /** - * Font size of the header title. - * - * @minimum 0 - */ - titleFontSize?: number | SignalRef; - /** - * The font style of the header title. - */ - titleFontStyle?: FontStyle | SignalRef; - /** - * Font weight of the header title. - * This can be either a string (e.g `"bold"`, `"normal"`) or a number (`100`, `200`, `300`, ..., `900` where `"normal"` = `400` and `"bold"` = `700`). - */ - titleFontWeight?: FontWeight | SignalRef; - /** - * The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. - * - * __Default value:__ `0`, indicating no limit - */ - titleLimit?: number | SignalRef; - /** - * Line height in pixels for multi-line header title text or title text with `"line-top"` or `"line-bottom"` baseline. - */ - titleLineHeight?: number | SignalRef; - /** - * The orientation of the header title. One of `"top"`, `"bottom"`, `"left"` or `"right"`. - */ - titleOrient?: Orient; - /** - * The padding, in pixel, between facet header's title and the label. - * - * __Default value:__ `10` - */ - titlePadding?: number | SignalRef; - /** - * A boolean flag indicating if labels should be included as part of the header. - * - * __Default value:__ `true`. - */ - labels?: boolean; - /** - * Horizontal text alignment of header labels. One of `"left"`, `"center"`, or `"right"`. - */ - labelAlign?: Align | SignalRef; - /** - * The vertical text baseline for the header labels. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. - * The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone. - * - */ - labelBaseline?: TextBaseline | SignalRef; - /** - * The anchor position for placing the labels. One of `"start"`, `"middle"`, or `"end"`. For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label. - */ - labelAnchor?: TitleAnchor; - /** - * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels. - * - * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the header's backing `datum` object. - */ - labelExpr?: string; - /** - * The rotation angle of the header labels. - * - * __Default value:__ `0` for column header, `-90` for row header. - * - * @minimum -360 - * @maximum 360 - */ - labelAngle?: number; - /** - * The color of the header label, can be in hex color code or regular color name. - */ - labelColor?: Color | SignalRef; - /** - * The font of the header label. - */ - labelFont?: string | SignalRef; - /** - * The font size of the header label, in pixels. - * - * @minimum 0 - */ - labelFontSize?: number | SignalRef; - /** - * The font style of the header label. - */ - labelFontStyle?: FontStyle | SignalRef; - /** - * The font weight of the header label. - */ - labelFontWeight?: FontWeight | SignalRef; - /** - * The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. - * - * __Default value:__ `0`, indicating no limit - */ - labelLimit?: number | SignalRef; - /** - * Line height in pixels for multi-line header labels or title text with `"line-top"` or `"line-bottom"` baseline. - */ - labelLineHeight?: number | SignalRef; - /** - * The orientation of the header label. One of `"top"`, `"bottom"`, `"left"` or `"right"`. - */ - labelOrient?: Orient; - /** - * The padding, in pixel, between facet header's label and the plot. - * - * __Default value:__ `10` - */ - labelPadding?: number | SignalRef; - /** - * Shortcut for setting both labelOrient and titleOrient. - */ - orient?: Orient; -} -export interface HeaderConfig extends CoreHeader, VlOnlyGuideConfig { -} -/** - * Headers of row / column channels for faceted plots. - */ -export interface Header extends CoreHeader, Guide { -} -export interface HeaderConfigMixins { - /** - * Header configuration, which determines default properties for all [headers](https://vega.github.io/vega-lite/docs/header.html). - * - * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). - */ - header?: HeaderConfig; - /** - * Header configuration, which determines default properties for row [headers](https://vega.github.io/vega-lite/docs/header.html). - * - * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). - */ - headerRow?: HeaderConfig; - /** - * Header configuration, which determines default properties for column [headers](https://vega.github.io/vega-lite/docs/header.html). - * - * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). - */ - headerColumn?: HeaderConfig; - /** - * Header configuration, which determines default properties for non-row/column facet [headers](https://vega.github.io/vega-lite/docs/header.html). - * - * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). - */ - headerFacet?: HeaderConfig; -} -//# sourceMappingURL=header.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/header.d.ts.map b/node_modules/vega-lite/build/src/header.d.ts.map deleted file mode 100644 index 38aabeb..0000000 --- a/node_modules/vega-lite/build/src/header.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AACpH,OAAO,EAAC,YAAY,EAAE,KAAK,EAAE,iBAAiB,EAAC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src/header.js b/node_modules/vega-lite/build/src/header.js deleted file mode 100644 index 5c2f20b..0000000 --- a/node_modules/vega-lite/build/src/header.js +++ /dev/null @@ -1,34 +0,0 @@ -import { keys } from './util'; -export const HEADER_TITLE_PROPERTIES_MAP = { - titleAlign: 'align', - titleAnchor: 'anchor', - titleAngle: 'angle', - titleBaseline: 'baseline', - titleColor: 'color', - titleFont: 'font', - titleFontSize: 'fontSize', - titleFontStyle: 'fontStyle', - titleFontWeight: 'fontWeight', - titleLimit: 'limit', - titleLineHeight: 'lineHeight', - titleOrient: 'orient', - titlePadding: 'offset' -}; -export const HEADER_LABEL_PROPERTIES_MAP = { - labelAlign: 'align', - labelAnchor: 'anchor', - labelAngle: 'angle', - labelBaseline: 'baseline', - labelColor: 'color', - labelFont: 'font', - labelFontSize: 'fontSize', - labelFontStyle: 'fontStyle', - labelFontWeight: 'fontWeight', - labelLimit: 'limit', - labelLineHeight: 'lineHeight', - labelOrient: 'orient', - labelPadding: 'offset' -}; -export const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP); -export const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP); -//# sourceMappingURL=header.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/header.js.map b/node_modules/vega-lite/build/src/header.js.map deleted file mode 100644 index 0318196..0000000 --- a/node_modules/vega-lite/build/src/header.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/header.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,2BAA2B,GAAyD;IAC/F,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,QAAQ;IACrB,UAAU,EAAE,OAAO;IACnB,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,OAAO;IACnB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,UAAU;IACzB,cAAc,EAAE,WAAW;IAC3B,eAAe,EAAE,YAAY;IAC7B,UAAU,EAAE,OAAO;IACnB,eAAe,EAAE,YAAY;IAC7B,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,QAAQ;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAyD;IAC/F,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,QAAQ;IACrB,UAAU,EAAE,OAAO;IACnB,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,OAAO;IACnB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,UAAU;IACzB,cAAc,EAAE,WAAW;IAC3B,eAAe,EAAE,YAAY;IAC7B,UAAU,EAAE,OAAO;IACnB,eAAe,EAAE,YAAY;IAC7B,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,QAAQ;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,2BAA2B,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,2BAA2B,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/impute.d.ts b/node_modules/vega-lite/build/src/impute.d.ts deleted file mode 100644 index 5931fa8..0000000 --- a/node_modules/vega-lite/build/src/impute.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ImputeSequence } from './transform'; -import { ImputeMethod } from 'vega'; -export interface ImputeParams { - /** - * The imputation method to use for the field value of imputed data objects. - * One of `"value"`, `"mean"`, `"median"`, `"max"` or `"min"`. - * - * __Default value:__ `"value"` - */ - method?: ImputeMethod; - /** - * The field value to use when the imputation `method` is `"value"`. - */ - value?: any; - /** - * Defines the key values that should be considered for imputation. - * An array of key values or an object defining a [number sequence](https://vega.github.io/vega-lite/docs/impute.html#sequence-def). - * - * If provided, this will be used in addition to the key values observed within the input data. If not provided, the values will be derived from all unique values of the `key` field. For `impute` in `encoding`, the key field is the x-field if the y-field is imputed, or vice versa. - * - * If there is no impute grouping, this property _must_ be specified. - */ - keyvals?: any[] | ImputeSequence; - /** - * A frame specification as a two-element array used to control the window over which the specified method is applied. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. For example, the value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. - * - * __Default value:__: `[null, null]` indicating that the window includes all objects. - */ - frame?: [null | number, null | number]; -} -//# sourceMappingURL=impute.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/impute.d.ts.map b/node_modules/vega-lite/build/src/impute.d.ts.map deleted file mode 100644 index 91c0917..0000000 --- a/node_modules/vega-lite/build/src/impute.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"impute.d.ts","sourceRoot":"","sources":["../../src/impute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,CAAC;IAEjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,IAAI,GAAG,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC;CACxC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/impute.js b/node_modules/vega-lite/build/src/impute.js deleted file mode 100644 index d4b1e69..0000000 --- a/node_modules/vega-lite/build/src/impute.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=impute.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/impute.js.map b/node_modules/vega-lite/build/src/impute.js.map deleted file mode 100644 index 165cdf4..0000000 --- a/node_modules/vega-lite/build/src/impute.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"impute.js","sourceRoot":"","sources":["../../src/impute.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/index.d.ts b/node_modules/vega-lite/build/src/index.d.ts deleted file mode 100644 index 5749e86..0000000 --- a/node_modules/vega-lite/build/src/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { version } from '../package.json'; -import { normalize } from './normalize'; -export { compile } from './compile/compile'; -export { Config } from './config'; -export { TopLevelSpec } from './spec'; -export { normalize, version }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/index.d.ts.map b/node_modules/vega-lite/build/src/index.d.ts.map deleted file mode 100644 index 3f26437..0000000 --- a/node_modules/vega-lite/build/src/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/index.js b/node_modules/vega-lite/build/src/index.js deleted file mode 100644 index ef0695a..0000000 --- a/node_modules/vega-lite/build/src/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import { version } from '../package.json'; -import { normalize } from './normalize'; -export { compile } from './compile/compile'; -export { normalize, version }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/index.js.map b/node_modules/vega-lite/build/src/index.js.map deleted file mode 100644 index c6581f2..0000000 --- a/node_modules/vega-lite/build/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/legend.d.ts b/node_modules/vega-lite/build/src/legend.d.ts deleted file mode 100644 index 8edbf86..0000000 --- a/node_modules/vega-lite/build/src/legend.d.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { BaseLegend, LabelOverlap, Legend as VgLegend, LegendConfig as VgLegendConfig, LegendEncode, LegendOrient, Orientation, SignalRef } from 'vega'; -import { DateTime } from './datetime'; -import { Guide, GuideEncodingEntry, VlOnlyGuideConfig } from './guide'; -import { Flag } from './util'; -import { ExcludeMappedValueRefButKeepSignal, VgEncodeChannel } from './vega.schema'; -export declare const LEGEND_SCALE_CHANNELS: readonly ["size", "shape", "fill", "stroke", "strokeDash", "strokeWidth", "opacity"]; -export declare type SignalLegendProp = 'fillColor' | 'gradientStrokeColor' | 'labelColor' | 'strokeColor' | 'symbolFillColor' | 'symbolStrokeColor' | 'titleColor'; -export declare const SIGNAL_LEGEND_PROP_INDEX: Record; -declare type BaseLegendNoValueRefs = ExcludeMappedValueRefButKeepSignal; -export interface LegendPropsWithSignal { - fillColor?: BaseLegendNoValueRefs['fillColor'] | SignalRef; - gradientStrokeColor?: BaseLegendNoValueRefs['gradientStrokeColor'] | SignalRef; - labelColor?: BaseLegendNoValueRefs['labelColor'] | SignalRef; - strokeColor?: BaseLegendNoValueRefs['strokeColor'] | SignalRef; - symbolFillColor?: BaseLegendNoValueRefs['symbolFillColor'] | SignalRef; - symbolStrokeColor?: BaseLegendNoValueRefs['symbolStrokeColor'] | SignalRef; - titleColor?: BaseLegendNoValueRefs['titleColor'] | SignalRef; -} -export declare type LegendConfig = LegendMixins & VlOnlyGuideConfig & Omit & LegendPropsWithSignal & { - /** - * Max legend length for a vertical gradient when `config.legend.gradientLength` is undefined. - * - * __Default value:__ `200` - */ - gradientVerticalMaxLength?: number; - /** - * Min legend length for a vertical gradient when `config.legend.gradientLength` is undefined. - * - * __Default value:__ `100` - */ - gradientVerticalMinLength?: number; - /** - * Max legend length for a horizontal gradient when `config.legend.gradientLength` is undefined. - * - * __Default value:__ `200` - */ - gradientHorizontalMaxLength?: number; - /** - * Min legend length for a horizontal gradient when `config.legend.gradientLength` is undefined. - * - * __Default value:__ `100` - */ - gradientHorizontalMinLength?: number; - /** - * The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient. - * - * __Default value:__ `undefined`. If `undefined`, the default gradient will be determined based on the following rules: - * - For vertical gradients, `clamp(plot_height, gradientVerticalMinLength, gradientVerticalMaxLength)` - * - For top-`orient`ed or bottom-`orient`ed horizontal gradients, `clamp(plot_width, gradientHorizontalMinLength, gradientHorizontalMaxLength)` - * - For other horizontal gradients, `gradientHorizontalMinLength` - * - * where `clamp(value, min, max)` restricts _value_ to be between the specified _min_ and _max_. - * @minimum 0 - */ - gradientLength?: number; - /** - * The opacity of unselected legend entries. - * - * __Default value:__ 0.35. - */ - unselectedOpacity?: number; - /** - * Disable legend by default - */ - disable?: boolean; -}; -/** - * Properties of a legend or boolean flag for determining whether to show it. - */ -export interface Legend extends Omit, LegendPropsWithSignal, LegendMixins, Guide { - /** - * Mark definitions for custom legend encoding. - * - * @hidden - */ - encoding?: LegendEncoding; - /** - * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels. - * - * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the legend's backing `datum` object. - */ - labelExpr?: string; - /** - * The minimum desired step between legend ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value. - * - * __Default value__: `undefined` - */ - tickMinStep?: number | SignalRef; - /** - * Explicitly set the visible legend values. - */ - values?: number[] | string[] | boolean[] | DateTime[] | SignalRef; - /** - * The type of the legend. Use `"symbol"` to create a discrete legend and `"gradient"` for a continuous color gradient. - * - * __Default value:__ `"gradient"` for non-binned quantitative fields and temporal fields; `"symbol"` otherwise. - */ - type?: 'symbol' | 'gradient'; - /** - * A non-negative integer indicating the z-index of the legend. - * If zindex is 0, legend should be drawn behind all chart elements. - * To put them in front, use zindex = 1. - * - * @TJS-type integer - * @minimum 0 - */ - zindex?: number; -} -interface LegendMixins { - /** - * The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` or `"parity"`, a strategy of removing every other label is used. If set to `"greedy"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes). - * - * __Default value:__ `"greedy"` for `log scales otherwise `true`. - */ - labelOverlap?: LabelOverlap | SignalRef; - /** - * The direction of the legend, one of `"vertical"` or `"horizontal"`. - * - * __Default value:__ - * - For top-/bottom-`orient`ed legends, `"horizontal"` - * - For left-/right-`orient`ed legends, `"vertical"` - * - For top/bottom-left/right-`orient`ed legends, `"horizontal"` for gradient legends and `"vertical"` for symbol legends. - */ - direction?: Orientation; - /** - * The orientation of the legend, which determines how the legend is positioned within the scene. One of `"left"`, `"right"`, `"top"`, `"bottom"`, `"top-left"`, `"top-right"`, `"bottom-left"`, `"bottom-right"`, `"none"`. - * - * __Default value:__ `"right"` - */ - orient?: LegendOrient; -} -export interface LegendEncoding { - /** - * Custom encoding for the legend container. - * This can be useful for creating legend with custom x, y position. - */ - legend?: GuideEncodingEntry; - /** - * Custom encoding for the legend title text mark. - */ - title?: GuideEncodingEntry; - /** - * Custom encoding for legend label text marks. - */ - labels?: GuideEncodingEntry; - /** - * Custom encoding for legend symbol marks. - */ - symbols?: GuideEncodingEntry; - /** - * Custom encoding for legend gradient filled rect marks. - */ - gradient?: GuideEncodingEntry; -} -export declare const defaultLegendConfig: LegendConfig; -export declare const COMMON_LEGEND_PROPERTY_INDEX: Flag; -export declare const LEGEND_PROPERTIES: ("padding" | "type" | "orient" | "symbolLimit" | "tickCount" | "aria" | "description" | "cornerRadius" | "fillColor" | "offset" | "strokeColor" | "legendX" | "legendY" | "titleAlign" | "titleAnchor" | "titleBaseline" | "titleColor" | "titleFont" | "titleFontSize" | "titleFontStyle" | "titleFontWeight" | "titleLimit" | "titleLineHeight" | "titleOpacity" | "titleOrient" | "titlePadding" | "gradientLength" | "gradientOpacity" | "gradientThickness" | "gradientStrokeColor" | "gradientStrokeWidth" | "clipHeight" | "columns" | "columnPadding" | "rowPadding" | "gridAlign" | "symbolDash" | "symbolDashOffset" | "symbolFillColor" | "symbolOffset" | "symbolOpacity" | "symbolSize" | "symbolStrokeColor" | "symbolStrokeWidth" | "symbolType" | "labelAlign" | "labelBaseline" | "labelColor" | "labelFont" | "labelFontSize" | "labelFontStyle" | "labelFontWeight" | "labelLimit" | "labelOpacity" | "labelPadding" | "labelOffset" | "labelOverlap" | "labelSeparation" | "zindex" | "values" | "title" | "direction" | "format" | "formatType" | "tickMinStep")[]; -export {}; -//# sourceMappingURL=legend.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/legend.d.ts.map b/node_modules/vega-lite/build/src/legend.d.ts.map deleted file mode 100644 index dbec2a3..0000000 --- a/node_modules/vega-lite/build/src/legend.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/legend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,MAAM,IAAI,QAAQ,EAClB,YAAY,IAAI,cAAc,EAC9B,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACV,MAAM,MAAM,CAAC;AACd,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAC;AACrE,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AE,kBAAkB,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB,EAAE,YAMjC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,CAkExE,CAAC;AAEF,eAAO,MAAM,iBAAiB,yhCAAqC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/legend.js b/node_modules/vega-lite/build/src/legend.js deleted file mode 100644 index 8078822..0000000 --- a/node_modules/vega-lite/build/src/legend.js +++ /dev/null @@ -1,116 +0,0 @@ -import { keys } from './util'; -export const LEGEND_SCALE_CHANNELS = [ - 'size', - 'shape', - 'fill', - 'stroke', - 'strokeDash', - 'strokeWidth', - 'opacity' -]; -export const SIGNAL_LEGEND_PROP_INDEX = { - fillColor: { - part: 'legend', - vgProp: 'fill' - }, - gradientStrokeColor: { - part: 'gradient', - vgProp: 'stroke' - }, - labelColor: { - part: 'labels', - vgProp: 'fill' - }, - strokeColor: { - part: 'legend', - vgProp: 'stroke' - }, - symbolFillColor: { - part: 'symbols', - vgProp: 'fill' - }, - symbolStrokeColor: { - part: 'symbols', - vgProp: 'stroke' - }, - titleColor: { - part: 'title', - vgProp: 'fill' - } -}; -export const defaultLegendConfig = { - gradientHorizontalMaxLength: 200, - gradientHorizontalMinLength: 100, - gradientVerticalMaxLength: 200, - gradientVerticalMinLength: 64, - unselectedOpacity: 0.35 -}; -export const COMMON_LEGEND_PROPERTY_INDEX = { - aria: 1, - clipHeight: 1, - columnPadding: 1, - columns: 1, - cornerRadius: 1, - description: 1, - direction: 1, - fillColor: 1, - format: 1, - formatType: 1, - gradientLength: 1, - gradientOpacity: 1, - gradientStrokeColor: 1, - gradientStrokeWidth: 1, - gradientThickness: 1, - gridAlign: 1, - labelAlign: 1, - labelBaseline: 1, - labelColor: 1, - labelFont: 1, - labelFontSize: 1, - labelFontStyle: 1, - labelFontWeight: 1, - labelLimit: 1, - labelOffset: 1, - labelOpacity: 1, - labelOverlap: 1, - labelPadding: 1, - labelSeparation: 1, - legendX: 1, - legendY: 1, - offset: 1, - orient: 1, - padding: 1, - rowPadding: 1, - strokeColor: 1, - symbolDash: 1, - symbolDashOffset: 1, - symbolFillColor: 1, - symbolLimit: 1, - symbolOffset: 1, - symbolOpacity: 1, - symbolSize: 1, - symbolStrokeColor: 1, - symbolStrokeWidth: 1, - symbolType: 1, - tickCount: 1, - tickMinStep: 1, - title: 1, - titleAlign: 1, - titleAnchor: 1, - titleBaseline: 1, - titleColor: 1, - titleFont: 1, - titleFontSize: 1, - titleFontStyle: 1, - titleFontWeight: 1, - titleLimit: 1, - titleLineHeight: 1, - titleOpacity: 1, - titleOrient: 1, - titlePadding: 1, - type: 1, - values: 1, - zindex: 1 -}; -export const LEGEND_PROPERTIES = keys(COMMON_LEGEND_PROPERTY_INDEX); -//# sourceMappingURL=legend.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/legend.js.map b/node_modules/vega-lite/build/src/legend.js.map deleted file mode 100644 index 9c60a11..0000000 --- a/node_modules/vega-lite/build/src/legend.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"legend.js","sourceRoot":"","sources":["../../src/legend.ts"],"names":[],"mappings":"AAYA,OAAO,EAAO,IAAI,EAAC,MAAM,QAAQ,CAAC;AAGlC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,YAAY;IACZ,aAAa;IACb,SAAS;CACD,CAAC;AAWX,MAAM,CAAC,MAAM,wBAAwB,GAMjC;IACF,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,MAAM;KACf;IACD,mBAAmB,EAAE;QACnB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,QAAQ;KACjB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,MAAM;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AAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,gBAAgB,EAAE,CAAC;IACnB,eAAe,EAAE,CAAC;IAClB,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;IACb,iBAAiB,EAAE,CAAC;IACpB,iBAAiB,EAAE,CAAC;IACpB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,CAAC;IACZ,WAAW,EAAE,CAAC;IACd,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAChB,cAAc,EAAE,CAAC;IACjB,eAAe,EAAE,CAAC;IAClB,UAAU,EAAE,CAAC;IACb,eAAe,EAAE,CAAC;IAClB,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,4BAA4B,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/log/index.d.ts b/node_modules/vega-lite/build/src/log/index.d.ts deleted file mode 100644 index a65bd97..0000000 --- a/node_modules/vega-lite/build/src/log/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Vega-Lite's singleton logger utility. - */ -import { LoggerInterface } from 'vega-util'; -export * as message from './message'; -/** - * Logger tool for checking if the code throws correct warning. - */ -export declare class LocalLogger implements LoggerInterface { - #private; - warns: any[]; - infos: any[]; - debugs: any[]; - level(): number; - level(_: number): this; - warn(...args: readonly any[]): this; - info(...args: readonly any[]): this; - debug(...args: readonly any[]): this; - error(...args: readonly any[]): this; -} -export declare function wrap(f: (logger: LocalLogger) => void): () => void; -/** - * Set the singleton logger to be a custom logger. - */ -export declare function set(newLogger: LoggerInterface): LoggerInterface; -/** - * Reset the main logger to use the default Vega Logger. - */ -export declare function reset(): LoggerInterface; -export declare function error(...args: readonly any[]): void; -export declare function warn(...args: readonly any[]): void; -export declare function info(...args: readonly any[]): void; -export declare function debug(...args: readonly any[]): void; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/log/index.d.ts.map b/node_modules/vega-lite/build/src/log/index.d.ts.map deleted file mode 100644 index 659a2e6..0000000 --- a/node_modules/vega-lite/build/src/log/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAA2C,eAAe,EAAO,MAAM,WAAW,CAAC;AAC1F,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAQrC;;GAEG;AACH,qBAAa,WAAY,YAAW,eAAe;;IAC1C,KAAK,EAAE,GAAG,EAAE,CAAM;IAClB,KAAK,EAAE,GAAG,EAAE,CAAM;IAClB,MAAM,EAAE,GAAG,EAAE,CAAM;IAInB,KAAK,IAAI,MAAM;IACf,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAStB,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE;IAK5B,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE;IAK5B,KAAK,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE;IAK7B,KAAK,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,GAAG,IAAI;CAI5C;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,cAMpD;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,SAAS,EAAE,eAAe,mBAG7C;AAED;;GAEG;AACH,wBAAgB,KAAK,oBAGpB;AAED,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,QAE5C;AAED,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,QAE3C;AAED,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,QAE3C;AAED,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,QAE5C"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/log/index.js b/node_modules/vega-lite/build/src/log/index.js deleted file mode 100644 index fc1f031..0000000 --- a/node_modules/vega-lite/build/src/log/index.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Vega-Lite's singleton logger utility. - */ -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -}; -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -}; -var _level; -import { Debug, Error as ErrorLevel, Info, logger, Warn } from 'vega-util'; -import * as message_1 from './message'; -export { message_1 as message }; -/** - * Main (default) Vega Logger instance for Vega-Lite. - */ -const main = logger(Warn); -let current = main; -/** - * Logger tool for checking if the code throws correct warning. - */ -export class LocalLogger { - constructor() { - this.warns = []; - this.infos = []; - this.debugs = []; - _level.set(this, Warn); - } - level(_) { - if (_) { - __classPrivateFieldSet(this, _level, _); - return this; - } - return __classPrivateFieldGet(this, _level); - } - warn(...args) { - if (__classPrivateFieldGet(this, _level) >= Warn) - this.warns.push(...args); - return this; - } - info(...args) { - if (__classPrivateFieldGet(this, _level) >= Info) - this.infos.push(...args); - return this; - } - debug(...args) { - if (__classPrivateFieldGet(this, _level) >= Debug) - this.debugs.push(...args); - return this; - } - error(...args) { - if (__classPrivateFieldGet(this, _level) >= ErrorLevel) - throw Error(...args); - return this; - } -} -_level = new WeakMap(); -export function wrap(f) { - return () => { - current = new LocalLogger(); - f(current); - reset(); - }; -} -/** - * Set the singleton logger to be a custom logger. - */ -export function set(newLogger) { - current = newLogger; - return current; -} -/** - * Reset the main logger to use the default Vega Logger. - */ -export function reset() { - current = main; - return current; -} -export function error(...args) { - current.error(...args); -} -export function warn(...args) { - current.warn(...args); -} -export function info(...args) { - current.info(...args); -} -export function debug(...args) { - current.debug(...args); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/log/index.js.map b/node_modules/vega-lite/build/src/log/index.js.map deleted file mode 100644 index 400ae04..0000000 --- a/node_modules/vega-lite/build/src/log/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;AAEH,OAAO,EAAC,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,IAAI,EAAE,MAAM,EAAmB,IAAI,EAAC,MAAM,WAAW,CAAC;2BACjE,WAAW;sBAAxB,OAAO;AAEnB;;GAEG;AACH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1B,IAAI,OAAO,GAAoB,IAAI,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,WAAW;IAAxB;QACS,UAAK,GAAU,EAAE,CAAC;QAClB,UAAK,GAAU,EAAE,CAAC;QAClB,WAAM,GAAU,EAAE,CAAC;QAE1B,iBAAiB,IAAI,EAAC;IA+BxB,CAAC;IA3BQ,KAAK,CAAC,CAAU;QACrB,IAAI,CAAC,EAAE;YACL,uBAAA,IAAI,UAAU,CAAC,EAAC;YAChB,OAAO,IAAI,CAAC;SACb;QACD,4CA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,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAG,IAAoB;IAC1C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,GAAG,IAAoB;IAC3C,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/log/message.d.ts b/node_modules/vega-lite/build/src/log/message.d.ts deleted file mode 100644 index 583bb51..0000000 --- a/node_modules/vega-lite/build/src/log/message.d.ts +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Collection of all Vega-Lite Error Messages - */ -import { AggregateOp } from 'vega'; -import { Aggregate } from '../aggregate'; -import { Channel, FacetChannel, GeoPositionChannel, PositionScaleChannel, ScaleChannel, ExtendedChannel } from '../channel'; -import { HiddenCompositeAggregate, TypedFieldDef, Value } from '../channeldef'; -import { SplitParentProperty } from '../compile/split'; -import { CompositeMark } from '../compositemark'; -import { ErrorBarCenter, ErrorBarExtent } from '../compositemark/errorbar'; -import { DateTime, DateTimeExpr } from '../datetime'; -import { Mark } from '../mark'; -import { Projection } from '../projection'; -import { ScaleType } from '../scale'; -import { GenericSpec } from '../spec'; -import { Type } from '../type'; -import { VgSortField } from '../vega.schema'; -export declare function invalidSpec(spec: GenericSpec): string; -export declare const FIT_NON_SINGLE = "Autosize \"fit\" only works for single views and layered views."; -export declare function containerSizeNonSingle(name: 'width' | 'height'): string; -export declare function containerSizeNotCompatibleWithAutosize(name: 'width' | 'height'): string; -export declare function droppingFit(channel?: PositionScaleChannel): string; -export declare function unknownField(channel: Channel): string; -export declare function cannotProjectOnChannelWithoutField(channel: Channel): string; -export declare function cannotProjectAggregate(channel: Channel, aggregate: Aggregate | HiddenCompositeAggregate): string; -export declare function nearestNotSupportForContinuous(mark: string): string; -export declare function selectionNotSupported(mark: CompositeMark): string; -export declare function selectionNotFound(name: string): string; -export declare const SCALE_BINDINGS_CONTINUOUS = "Scale bindings are currently only supported for scales with unbinned, continuous domains."; -export declare const LEGEND_BINDINGS_MUST_HAVE_PROJECTION = "Legend bindings are only supported for selections over an individual field or encoding channel."; -export declare function noSameUnitLookup(name: string): string; -export declare const NEEDS_SAME_SELECTION = "The same selection must be used to override scale domains in a layered view."; -export declare const INTERVAL_INITIALIZED_WITH_X_Y = "Interval selections should be initialized using \"x\" and/or \"y\" keys."; -export declare function noSuchRepeatedValue(field: string): string; -export declare function columnsNotSupportByRowCol(type: 'facet' | 'repeat'): string; -export declare const CONCAT_CANNOT_SHARE_AXIS = "Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."; -export declare function unrecognizedParse(p: string): string; -export declare function differentParse(field: string, local: string, ancestor: string): string; -export declare const ADD_SAME_CHILD_TWICE = "Attempt to add the same child twice."; -export declare function invalidTransformIgnored(transform: any): string; -export declare const NO_FIELDS_NEEDS_AS = "If \"from.fields\" is not specified, \"as\" has to be a string that specifies the key to be used for the data from the secondary source."; -export declare function customFormatTypeNotAllowed(channel: ExtendedChannel): string; -export declare function projectionOverridden(opt: { - parentProjection: Projection; - projection: Projection; -}): string; -export declare const REPLACE_ANGLE_WITH_THETA = "Arc marks uses theta channel rather than angle, replacing angle with theta."; -export declare function primitiveChannelDef(channel: ExtendedChannel, type: 'string' | 'number' | 'boolean', value: Exclude): string; -export declare function invalidFieldType(type: Type): string; -export declare function invalidFieldTypeForCountAggregate(type: Type, aggregate: Aggregate | string): string; -export declare function invalidAggregate(aggregate: AggregateOp | string): string; -export declare function missingFieldType(channel: Channel, newType: Type): string; -export declare function droppingColor(type: 'encoding' | 'property', opt: { - fill?: boolean; - stroke?: boolean; -}): string; -export declare function emptyFieldDef(fieldDef: unknown, channel: ExtendedChannel): string; -export declare function latLongDeprecated(channel: Channel, type: Type, newChannel: GeoPositionChannel): string; -export declare const LINE_WITH_VARYING_SIZE = "Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead."; -export declare function incompatibleChannel(channel: ExtendedChannel, markOrFacet: Mark | 'facet' | CompositeMark, when?: string): string; -export declare function invalidEncodingChannel(channel: ExtendedChannel): string; -export declare function facetChannelShouldBeDiscrete(channel: FacetChannel): string; -export declare function facetChannelDropped(channels: FacetChannel[]): string; -export declare function discreteChannelCannotEncode(channel: Channel, type: Type): string; -export declare function lineWithRange(hasX2: boolean, hasY2: boolean): string; -export declare function orientOverridden(original: string, actual: string): string; -export declare const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN = "Custom domain scale cannot be unioned with default field-based domain."; -export declare const RANGE_STEP_DEPRECATED = "Scale's \"rangeStep\" is deprecated and will be removed in Vega-Lite 5.0. Please use \"width\"/\"height\": {\"step\": ...} instead. See https://vega.github.io/vega-lite/docs/size.html."; -export declare function cannotUseScalePropertyWithNonColor(prop: string): string; -export declare function unaggregateDomainHasNoEffectForRawField(fieldDef: TypedFieldDef): string; -export declare function unaggregateDomainWithNonSharedDomainOp(aggregate: Aggregate | string): string; -export declare function unaggregatedDomainWithLogScale(fieldDef: TypedFieldDef): string; -export declare function cannotApplySizeToNonOrientedMark(mark: Mark): string; -export declare function scaleTypeNotWorkWithChannel(channel: Channel, scaleType: ScaleType, defaultScaleType: ScaleType): string; -export declare function scaleTypeNotWorkWithFieldDef(scaleType: ScaleType, defaultScaleType: ScaleType): string; -export declare function scalePropertyNotWorkWithScaleType(scaleType: ScaleType, propName: string, channel: Channel): string; -export declare function scaleTypeNotWorkWithMark(mark: Mark, scaleType: ScaleType): string; -export declare function stepDropped(channel: 'width' | 'height'): string; -export declare function mergeConflictingProperty(property: string | number | symbol, propertyOf: SplitParentProperty, v1: T, v2: T): string; -export declare function mergeConflictingDomainProperty(property: 'domains', propertyOf: SplitParentProperty, v1: T, v2: T): string; -export declare function independentScaleMeansIndependentGuide(channel: Channel): string; -export declare function domainSortDropped(sort: VgSortField): string; -export declare const MORE_THAN_ONE_SORT = "Domains that should be unioned has conflicting sort properties. Sort will be set to true."; -export declare const FACETED_INDEPENDENT_DIFFERENT_SOURCES = "Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."; -export declare const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = "Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."; -export declare const FACETED_INDEPENDENT_SAME_SOURCE = "Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect."; -export declare const INVALID_CHANNEL_FOR_AXIS = "Invalid channel for axis."; -export declare function cannotStackRangedMark(channel: Channel): string; -export declare function cannotStackNonLinearScale(scaleType: ScaleType): string; -export declare function stackNonSummativeAggregate(aggregate: Aggregate | string): string; -export declare function invalidTimeUnit(unitName: string, value: string | number): string; -export declare function droppedDay(d: DateTime | DateTimeExpr): string; -export declare function errorBarCenterAndExtentAreNotNeeded(center: ErrorBarCenter, extent: ErrorBarExtent): string; -export declare function errorBarCenterIsUsedWithWrongExtent(center: ErrorBarCenter, extent: ErrorBarExtent, mark: 'errorbar' | 'errorband'): string; -export declare function errorBarContinuousAxisHasCustomizedAggregate(aggregate: Aggregate | string, compositeMark: CompositeMark): string; -export declare function errorBand1DNotSupport(property: 'interpolate' | 'tension'): string; -export declare function channelRequiredForBinned(channel: Channel): string; -export declare function channelShouldNotBeUsedForBinned(channel: ExtendedChannel): string; -export declare function domainRequiredForThresholdScale(channel: ScaleChannel): string; -//# sourceMappingURL=message.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/log/message.d.ts.map b/node_modules/vega-lite/build/src/log/message.d.ts.map deleted file mode 100644 index 8d00f92..0000000 --- a/node_modules/vega-lite/build/src/log/message.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/log/message.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,WAAW,EAAC,MAAM,MA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M,kBAAkB,8FAC8D,CAAC;AAE9F,eAAO,MAAM,qCAAqC,8KAC2H,CAAC;AAE9K,eAAO,MAAM,iDAAiD,uQACwM,CAAC;AAEvQ,eAAO,MAAM,+BAA+B,4KAC+H,CAAC;AAG5K,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AAGpE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,UAErD;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,SAAS,UAE7D;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,UAEvE;AAGD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,UAEvE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,QAAQ,GAAG,YAAY,UAEpD;AAED,wBAAgB,mCAAmC,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,UAIjG;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,UAAU,GAAG,WAAW,UAG/B;AAED,wBAAgB,4CAA4C,CAC1D,SAAS,EAAE,SAAS,GAAG,MAAM,EAC7B,aAAa,EAAE,aAAa,UAG7B;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,UAExE;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,UAExD;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,eAAe,UAEvE;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,YAAY,UAEpE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/log/message.js b/node_modules/vega-lite/build/src/log/message.js deleted file mode 100644 index 928b37a..0000000 --- a/node_modules/vega-lite/build/src/log/message.js +++ /dev/null @@ -1,220 +0,0 @@ -import { getSizeChannel } from '../channel'; -import { stringify } from '../util'; -export function invalidSpec(spec) { - return `Invalid specification ${JSON.stringify(spec)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`; -} -// FIT -export const FIT_NON_SINGLE = 'Autosize "fit" only works for single views and layered views.'; -export function containerSizeNonSingle(name) { - const uName = name == 'width' ? 'Width' : 'Height'; - return `${uName} "container" only works for single views and layered views.`; -} -export function containerSizeNotCompatibleWithAutosize(name) { - const uName = name == 'width' ? 'Width' : 'Height'; - const fitDirection = name == 'width' ? 'x' : 'y'; - return `${uName} "container" only works well with autosize "fit" or "fit-${fitDirection}".`; -} -export function droppingFit(channel) { - return channel - ? `Dropping "fit-${channel}" because spec has discrete ${getSizeChannel(channel)}.` - : `Dropping "fit" because spec has discrete size.`; -} -// VIEW SIZE -export function unknownField(channel) { - return `Unknown field for ${channel}. Cannot calculate view size.`; -} -// SELECTION -export function cannotProjectOnChannelWithoutField(channel) { - return `Cannot project a selection on encoding channel "${channel}", which has no field.`; -} -export function cannotProjectAggregate(channel, aggregate) { - return `Cannot project a selection on encoding channel "${channel}" as it uses an aggregate function ("${aggregate}").`; -} -export function nearestNotSupportForContinuous(mark) { - return `The "nearest" transform is not supported for ${mark} marks.`; -} -export function selectionNotSupported(mark) { - return `Selection not supported for ${mark} yet.`; -} -export function selectionNotFound(name) { - return `Cannot find a selection named "${name}".`; -} -export const SCALE_BINDINGS_CONTINUOUS = 'Scale bindings are currently only supported for scales with unbinned, continuous domains.'; -export const LEGEND_BINDINGS_MUST_HAVE_PROJECTION = 'Legend bindings are only supported for selections over an individual field or encoding channel.'; -export function noSameUnitLookup(name) { - return (`Cannot define and lookup the "${name}" selection in the same view. ` + - `Try moving the lookup into a second, layered view?`); -} -export const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.'; -export const INTERVAL_INITIALIZED_WITH_X_Y = 'Interval selections should be initialized using "x" and/or "y" keys.'; -// REPEAT -export function noSuchRepeatedValue(field) { - return `Unknown repeated value "${field}".`; -} -export function columnsNotSupportByRowCol(type) { - return `The "columns" property cannot be used when "${type}" has nested row/column.`; -} -// CONCAT / REPEAT -export const CONCAT_CANNOT_SHARE_AXIS = 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).'; -// DATA -export function unrecognizedParse(p) { - return `Unrecognized parse "${p}".`; -} -export function differentParse(field, local, ancestor) { - return `An ancestor parsed field "${field}" as ${ancestor} but a child wants to parse the field as ${local}.`; -} -export const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.'; -// TRANSFORMS -export function invalidTransformIgnored(transform) { - return `Ignoring an invalid transform: ${stringify(transform)}.`; -} -export const NO_FIELDS_NEEDS_AS = 'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'; -// ENCODING & FACET -export function customFormatTypeNotAllowed(channel) { - return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`; -} -export function projectionOverridden(opt) { - const { parentProjection, projection } = opt; - return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(projection)}.`; -} -export const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.'; -export function primitiveChannelDef(channel, type, value) { - return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`; -} -export function invalidFieldType(type) { - return `Invalid field type "${type}".`; -} -export function invalidFieldTypeForCountAggregate(type, aggregate) { - return `Invalid field type "${type}" for aggregate: "${aggregate}", using "quantitative" instead.`; -} -export function invalidAggregate(aggregate) { - return `Invalid aggregation operator "${aggregate}".`; -} -export function missingFieldType(channel, newType) { - return `Missing type for channel "${channel}", using "${newType}" instead.`; -} -export function droppingColor(type, opt) { - const { fill, stroke } = opt; - return `Dropping color ${type} as the plot also has ${fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'}.`; -} -export function emptyFieldDef(fieldDef, channel) { - return `Dropping ${stringify(fieldDef)} from channel "${channel}" since it does not contain any data field, datum, value, or signal.`; -} -export function latLongDeprecated(channel, type, newChannel) { - return `${channel}-encoding with type ${type} is deprecated. Replacing with ${newChannel}-encoding.`; -} -export const LINE_WITH_VARYING_SIZE = 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.'; -export function incompatibleChannel(channel, markOrFacet, when) { - return `${channel} dropped as it is incompatible with "${markOrFacet}"${when ? ` when ${when}` : ''}.`; -} -export function invalidEncodingChannel(channel) { - return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`; -} -export function facetChannelShouldBeDiscrete(channel) { - return `${channel} encoding should be discrete (ordinal / nominal / binned).`; -} -export function facetChannelDropped(channels) { - return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`; -} -export function discreteChannelCannotEncode(channel, type) { - return `Using discrete channel "${channel}" to encode "${type}" field can be misleading as it does not encode ${type === 'ordinal' ? 'order' : 'magnitude'}.`; -} -// MARK -export function lineWithRange(hasX2, hasY2) { - const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2'; - return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`; -} -export function orientOverridden(original, actual) { - return `Specified orient "${original}" overridden with "${actual}".`; -} -// SCALE -export const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN = 'Custom domain scale cannot be unioned with default field-based domain.'; -export const RANGE_STEP_DEPRECATED = `Scale's "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.`; -export function cannotUseScalePropertyWithNonColor(prop) { - return `Cannot use the scale property "${prop}" with non-color channel.`; -} -export function unaggregateDomainHasNoEffectForRawField(fieldDef) { - return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`; -} -export function unaggregateDomainWithNonSharedDomainOp(aggregate) { - return `Unaggregated domain not applicable for "${aggregate}" since it produces values outside the origin domain of the source data.`; -} -export function unaggregatedDomainWithLogScale(fieldDef) { - return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`; -} -export function cannotApplySizeToNonOrientedMark(mark) { - return `Cannot apply size to non-oriented mark "${mark}".`; -} -export function scaleTypeNotWorkWithChannel(channel, scaleType, defaultScaleType) { - return `Channel "${channel}" does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; -} -export function scaleTypeNotWorkWithFieldDef(scaleType, defaultScaleType) { - return `FieldDef does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; -} -export function scalePropertyNotWorkWithScaleType(scaleType, propName, channel) { - return `${channel}-scale's "${propName}" is dropped as it does not work with ${scaleType} scale.`; -} -export function scaleTypeNotWorkWithMark(mark, scaleType) { - return `Scale type "${scaleType}" does not work with mark "${mark}".`; -} -export function stepDropped(channel) { - return `The step for "${channel}" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`; -} -export function mergeConflictingProperty(property, propertyOf, v1, v2) { - return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify(v2)}). Using ${stringify(v1)}.`; -} -export function mergeConflictingDomainProperty(property, propertyOf, v1, v2) { - return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify(v2)}). Using the union of the two domains.`; -} -export function independentScaleMeansIndependentGuide(channel) { - return `Setting the scale to be independent for "${channel}" means we also have to set the guide (axis or legend) to be independent.`; -} -export function domainSortDropped(sort) { - return `Dropping sort property ${stringify(sort)} as unioned domains only support boolean or op "count", "min", and "max".`; -} -export const MORE_THAN_ONE_SORT = 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.'; -export const FACETED_INDEPENDENT_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.'; -export const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.'; -export const FACETED_INDEPENDENT_SAME_SOURCE = 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.'; -// AXIS -export const INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.'; -// STACK -export function cannotStackRangedMark(channel) { - return `Cannot stack "${channel}" if there is already "${channel}2".`; -} -export function cannotStackNonLinearScale(scaleType) { - return `Cannot stack non-linear scale (${scaleType}).`; -} -export function stackNonSummativeAggregate(aggregate) { - return `Stacking is applied even though the aggregate function is non-summative ("${aggregate}").`; -} -// TIMEUNIT -export function invalidTimeUnit(unitName, value) { - return `Invalid ${unitName}: ${stringify(value)}.`; -} -export function droppedDay(d) { - return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`; -} -export function errorBarCenterAndExtentAreNotNeeded(center, extent) { - return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${extent && center ? 'are ' : 'is '}not needed when data are aggregated.`; -} -export function errorBarCenterIsUsedWithWrongExtent(center, extent, mark) { - return `${center} is not usually used with ${extent} for ${mark}.`; -} -export function errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark) { - return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`; -} -export function errorBand1DNotSupport(property) { - return `1D error band does not support ${property}.`; -} -// CHANNEL -export function channelRequiredForBinned(channel) { - return `Channel ${channel} is required for "binned" bin.`; -} -export function channelShouldNotBeUsedForBinned(channel) { - return `Channel ${channel} should not be used with "binned" bin.`; -} -export function domainRequiredForThresholdScale(channel) { - return `Domain for ${channel} is required for threshold scale.`; -} -//# sourceMappingURL=message.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/log/message.js.map b/node_modules/vega-lite/build/src/log/message.js.map deleted file mode 100644 index 669a46e..0000000 --- a/node_modules/vega-lite/build/src/log/message.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/log/message.ts"],"names":[],"mappings":"AAKA,OAAO,EAI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;AACrE,CAAC;AAED,MAAM,UAAU,4CAA4C,CAC1D,SAA6B,EAC7B,aAA4B;IAE5B,OAAO,mEAAmE,SAAS,KAAK,aAAa,8BAA8B,CAAC;AACtI,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAmC;IACvE,OAAO,kCAAkC,QAAQ,GAAG,CAAC;AACvD,CAAC;AAED,UAAU;AACV,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,OAAO,WAAW,OAAO,gCAAgC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,OAAwB;IACtE,OAAO,WAAW,OAAO,wCAAwC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,OAAqB;IACnE,OAAO,cAAc,OAAO,mCAAmC,CAAC;AAClE,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/logical.d.ts b/node_modules/vega-lite/build/src/logical.d.ts deleted file mode 100644 index 14324e0..0000000 --- a/node_modules/vega-lite/build/src/logical.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export declare type LogicalComposition = LogicalNot | LogicalAnd | LogicalOr | T; -export interface LogicalOr { - or: LogicalComposition[]; -} -export interface LogicalAnd { - and: LogicalComposition[]; -} -export interface LogicalNot { - not: LogicalComposition; -} -export declare function isLogicalOr(op: LogicalComposition): op is LogicalOr; -export declare function isLogicalAnd(op: LogicalComposition): op is LogicalAnd; -export declare function isLogicalNot(op: LogicalComposition): op is LogicalNot; -export declare function forEachLeaf(op: LogicalComposition, fn: (op: T) => void): void; -export declare function normalizeLogicalComposition(op: LogicalComposition, normalizer: (o: T) => T): LogicalComposition; -//# sourceMappingURL=logical.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/logical.d.ts.map b/node_modules/vega-lite/build/src/logical.d.ts.map deleted file mode 100644 index 363fa5e..0000000 --- a/node_modules/vega-lite/build/src/logical.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logical.d.ts","sourceRoot":"","sources":["../../src/logical.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErF,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAC5B;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC,CAE7E;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,CAE/E;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,CAE/E;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,QAc5E;AAED,wBAAgB,2BAA2B,CAAC,CAAC,EAC3C,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,EACzB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GACtB,kBAAkB,CAAC,CAAC,CAAC,CAUvB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/logical.js b/node_modules/vega-lite/build/src/logical.js deleted file mode 100644 index 9feef48..0000000 --- a/node_modules/vega-lite/build/src/logical.js +++ /dev/null @@ -1,42 +0,0 @@ -export function isLogicalOr(op) { - return !!op.or; -} -export function isLogicalAnd(op) { - return !!op.and; -} -export function isLogicalNot(op) { - return !!op.not; -} -export function forEachLeaf(op, fn) { - if (isLogicalNot(op)) { - forEachLeaf(op.not, fn); - } - else if (isLogicalAnd(op)) { - for (const subop of op.and) { - forEachLeaf(subop, fn); - } - } - else if (isLogicalOr(op)) { - for (const subop of op.or) { - forEachLeaf(subop, fn); - } - } - else { - fn(op); - } -} -export function normalizeLogicalComposition(op, normalizer) { - if (isLogicalNot(op)) { - return { not: normalizeLogicalComposition(op.not, normalizer) }; - } - else if (isLogicalAnd(op)) { - return { and: op.and.map(o => normalizeLogicalComposition(o, normalizer)) }; - } - else if (isLogicalOr(op)) { - return { or: op.or.map(o => normalizeLogicalComposition(o, normalizer)) }; - } - else { - return normalizer(op); - } -} -//# sourceMappingURL=logical.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/logical.js.map b/node_modules/vega-lite/build/src/logical.js.map deleted file mode 100644 index 185f604..0000000 --- a/node_modules/vega-lite/build/src/logical.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logical.js","sourceRoot":"","sources":["../../src/logical.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,WAAW,CAAC,EAA2B;IACrD,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAA2B;IACtD,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAA2B;IACtD,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,EAAyB,EAAE,EAAmB;IAC3E,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE;QACpB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;KACzB;SAAM,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE;QAC3B,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,GAAG,EAAE;YAC1B,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SACxB;KACF;SAAM,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE;QAC1B,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE;YACzB,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SACxB;KACF;SAAM;QACL,EAAE,CAAC,EAAE,CAAC,CAAC;KACR;AACH,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,EAAyB,EACzB,UAAuB;IAEvB,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE;QACpB,OAAO,EAAC,GAAG,EAAE,2BAA2B,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,EAAC,CAAC;KAC/D;SAAM,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE;QAC3B,OAAO,EAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAC,CAAC;KAC3E;SAAM,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE;QAC1B,OAAO,EAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAC,CAAC;KACzE;SAAM;QACL,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;KACvB;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/mark.d.ts b/node_modules/vega-lite/build/src/mark.d.ts deleted file mode 100644 index 53e62de..0000000 --- a/node_modules/vega-lite/build/src/mark.d.ts +++ /dev/null @@ -1,427 +0,0 @@ -import { Align, Color, Gradient, MarkConfig as VgMarkConfig, Orientation, SignalRef, TextBaseline } from 'vega'; -import { CompositeMark, CompositeMarkDef } from './compositemark'; -/** - * All types of primitive marks. - */ -export declare const Mark: { - readonly arc: "arc"; - readonly area: "area"; - readonly bar: "bar"; - readonly image: "image"; - readonly line: "line"; - readonly point: "point"; - readonly rect: "rect"; - readonly rule: "rule"; - readonly text: "text"; - readonly tick: "tick"; - readonly trail: "trail"; - readonly circle: "circle"; - readonly square: "square"; - readonly geoshape: "geoshape"; -}; -export declare const ARC: "arc"; -export declare const AREA: "area"; -export declare const BAR: "bar"; -export declare const IMAGE: "image"; -export declare const LINE: "line"; -export declare const POINT: "point"; -export declare const RECT: "rect"; -export declare const RULE: "rule"; -export declare const TEXT: "text"; -export declare const TICK: "tick"; -export declare const TRAIL: "trail"; -export declare const CIRCLE: "circle"; -export declare const SQUARE: "square"; -export declare const GEOSHAPE: "geoshape"; -export declare type Mark = keyof typeof Mark; -export declare function isMark(m: string): m is Mark; -export declare function isPathMark(m: Mark | CompositeMark): m is 'line' | 'area' | 'trail'; -export declare function isRectBasedMark(m: Mark | CompositeMark): m is 'rect' | 'bar' | 'image' | 'arc'; -export declare const PRIMITIVE_MARKS: ("square" | "circle" | "text" | "point" | "arc" | "area" | "image" | "line" | "rect" | "rule" | "trail" | "geoshape" | "bar" | "tick")[]; -export interface ColorMixins { - /** - * Default color. - * - * __Default value:__ `"#4682b4"` - * - * __Note:__ - * - This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config). - * - The `fill` and `stroke` properties have higher precedence than `color` and will override `color`. - */ - color?: Color | Gradient | SignalRef; -} -export interface TooltipContent { - content: 'encoding' | 'data'; -} -/** @hidden */ -export declare type Hide = 'hide'; -export interface VLOnlyMarkConfig extends ColorMixins { - /** - * Whether the mark's color should be used as fill color instead of stroke color. - * - * __Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`. - * - * __Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config). - * - */ - filled?: boolean; - /** - * Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`). - * - If set to `"filter"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks). - * - If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes. - */ - invalid?: 'filter' | Hide | null; - /** - * For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources. - */ - order?: null | boolean; - /** - * Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. - * If set to `0.5`, the marks will be positioned in the middle of the time unit band step. - */ - timeUnitBandPosition?: number; - /** - * Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. - * If set to `0.5`, bandwidth of the marks will be half of the time unit band step. - */ - timeUnitBand?: number; - /** - * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise. - */ - theta2?: number | SignalRef; - /** - * The secondary (inner) radius in pixels of arc marks. - * - * @minimum 0 - * __Default value:__ `0` - */ - radius2?: number | SignalRef; -} -export interface MarkConfig extends VLOnlyMarkConfig, Omit { - /** - * The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from. - * - * - If `tooltip` is `true` or `{"content": "encoding"}`, then all fields from `encoding` will be used. - * - If `tooltip` is `{"content": "data"}`, then all fields that appear in the highlighted data point will be used. - * - If set to `null` or `false`, then no tooltip will be used. - * - * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite. - * - * __Default value:__ `null` - */ - tooltip?: number | string | boolean | TooltipContent | SignalRef | null; - /** - * Default size for marks. - * - For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value. - * - For `bar`, this represents the band size of the bar, in pixels. - * - For `text`, this represents the font size, in pixels. - * - * __Default value:__ - * - `30` for point, circle, square marks; width/height's `step` - * - `2` for bar marks with discrete dimensions; - * - `5` for bar marks with continuous dimensions; - * - `11` for text marks. - * - * @minimum 0 - */ - size?: number | SignalRef; - /** - * X coordinates of the marks, or width of horizontal `"bar"` and `"area"` without specified `x2` or `width`. - * - * The `value` of this channel can be a number or a string `"width"` for the width of the plot. - */ - x?: number | 'width' | SignalRef; - /** - * Y coordinates of the marks, or height of vertical `"bar"` and `"area"` without specified `y2` or `height`. - * - * The `value` of this channel can be a number or a string `"height"` for the height of the plot. - */ - y?: number | 'height' | SignalRef; - /** - * X2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - * - * The `value` of this channel can be a number or a string `"width"` for the width of the plot. - */ - x2?: number | 'width' | SignalRef; - /** - * Y2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - * - * The `value` of this channel can be a number or a string `"height"` for the height of the plot. - */ - y2?: number | 'height' | SignalRef; - /** - * Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill. - * - * __Default value:__ (None) - * - */ - fill?: Color | Gradient | null | SignalRef; - /** - * Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke. - * - * __Default value:__ (None) - * - */ - stroke?: Color | Gradient | null | SignalRef; - /** - * The overall opacity (value between [0,1]). - * - * __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise. - * - * @minimum 0 - * @maximum 1 - */ - opacity?: number | SignalRef; - /** - * The orientation of a non-stacked bar, tick, area, and line charts. - * The value is either horizontal (default) or vertical. - * - For bar, rule and tick, this determines whether the size of the bar and tick - * should be applied to x or y dimension. - * - For area, this property determines the orient property of the Vega output. - * - For line and trail marks, this property determines the sort order of the points in the line - * if `config.sortLineBy` is not specified. - * For stacked charts, this is always determined by the orientation of the stack; - * therefore explicitly specified value will be ignored. - */ - orient?: Orientation; - /** - * The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `"left"`, `"right"`, `"center"`. - */ - align?: Align; - /** - * The vertical text baseline. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone. - */ - baseline?: TextBaseline; - /** - * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.) - * - * - For text marks, polar coordinate angle in radians. - * - * @minimum 0 - * @maximum 360 - */ - theta?: number | SignalRef; - /** - * - * For arc mark, the primary (outer) radius in pixels. - * - * For text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties. - * - * @minimum 0 - * - * __Default value:__ `min(plot_width, plot_height)/2` - */ - radius?: number | SignalRef; - /** - * The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`. - * - * @minimum 0 - * __Default value:__ `0` - */ - innerRadius?: number | SignalRef; - /** - * The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`. - * - * @minimum 0 - * __Default value:__ `0` - */ - outerRadius?: number | SignalRef; -} -export interface RectBinSpacingMixins { - /** - * Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style). - * - * __Default value:__ `1` - * - * @minimum 0 - */ - binSpacing?: number; -} -export declare type AnyMark = CompositeMark | CompositeMarkDef | Mark | MarkDef; -export declare function isMarkDef(mark: string | GenericMarkDef): mark is GenericMarkDef; -export declare function isPrimitiveMark(mark: AnyMark): mark is Mark; -export declare const STROKE_CONFIG: readonly ["stroke", "strokeWidth", "strokeDash", "strokeDashOffset", "strokeOpacity", "strokeJoin", "strokeMiterLimit"]; -export declare const FILL_CONFIG: readonly ["fill", "fillOpacity"]; -export declare const FILL_STROKE_CONFIG: ("stroke" | "fill" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "strokeDash" | "strokeDashOffset" | "strokeMiterLimit" | "strokeJoin")[]; -export declare const VL_ONLY_MARK_CONFIG_PROPERTIES: ("color" | "theta2" | "radius2" | "order" | "filled" | "invalid" | "timeUnitBandPosition" | "timeUnitBand")[]; -export declare const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: { - [k in Mark]?: (keyof Required[k])[]; -}; -export declare const defaultMarkConfig: MarkConfig; -export declare type AnyMarkConfig = MarkConfig | AreaConfig | BarConfig | RectConfig | LineConfig | TickConfig; -export interface MarkConfigMixins { - /** Mark Config */ - mark?: MarkConfig; - /** Arc-specific Config */ - arc?: RectConfig; - /** Area-Specific Config */ - area?: AreaConfig; - /** Bar-Specific Config */ - bar?: BarConfig; - /** Circle-Specific Config */ - circle?: MarkConfig; - /** Image-specific Config */ - image?: RectConfig; - /** Line-Specific Config */ - line?: LineConfig; - /** Point-Specific Config */ - point?: MarkConfig; - /** Rect-Specific Config */ - rect?: RectConfig; - /** Rule-Specific Config */ - rule?: MarkConfig; - /** Square-Specific Config */ - square?: MarkConfig; - /** Text-Specific Config */ - text?: MarkConfig; - /** Tick-Specific Config */ - tick?: TickConfig; - /** Trail-Specific Config */ - trail?: LineConfig; - /** Geoshape-Specific Config */ - geoshape?: MarkConfig; -} -export interface RectConfig extends RectBinSpacingMixins, MarkConfig { - /** - * The default size of the bars on continuous scales. - * - * __Default value:__ `5` - * - * @minimum 0 - */ - continuousBandSize?: number; - /** - * The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars. - * @minimum 0 - */ - discreteBandSize?: number; -} -export declare const BAR_CORNER_RADIUS_INDEX: Partial>; -export interface BarCornerRadiusMixins { - /** - * - For vertical bars, top-left and top-right corner radius. - * - For horizontal bars, top-right and bottom-right corner radius. - */ - cornerRadiusEnd?: number | SignalRef; -} -export declare type BarConfig = RectConfig & BarCornerRadiusMixins; -export declare type OverlayMarkDef = MarkConfig & MarkDefMixins; -export interface PointOverlayMixins { - /** - * A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points. - * - * - If this property is `"transparent"`, transparent points will be used (for enhancing tooltips and selections). - * - * - If this property is an empty object (`{}`) or `true`, filled points with default properties will be used. - * - * - If this property is `false`, no points would be automatically added to line or area marks. - * - * __Default value:__ `false`. - */ - point?: boolean | OverlayMarkDef | 'transparent'; -} -export interface LineConfig extends MarkConfig, PointOverlayMixins { -} -export interface LineOverlayMixins { - /** - * A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines. - * - * - If this value is an empty object (`{}`) or `true`, lines with default properties will be used. - * - * - If this value is `false`, no lines would be automatically added to area marks. - * - * __Default value:__ `false`. - */ - line?: boolean | OverlayMarkDef; -} -export interface AreaConfig extends MarkConfig, PointOverlayMixins, LineOverlayMixins { -} -export interface TickThicknessMixins { - /** - * Thickness of the tick mark. - * - * __Default value:__ `1` - * - * @minimum 0 - */ - thickness?: number | SignalRef; -} -export interface GenericMarkDef { - /** - * The mark type. This could a primitive mark type - * (one of `"bar"`, `"circle"`, `"square"`, `"tick"`, `"line"`, - * `"area"`, `"point"`, `"geoshape"`, `"rule"`, and `"text"`) - * or a composite mark type (`"boxplot"`, `"errorband"`, `"errorbar"`). - */ - type: M; -} -export interface MarkDefMixins { - /** - * A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](https://vega.github.io/vega-lite/docs/encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default. - * - * __Default value:__ The mark's name. For example, a bar mark will have style `"bar"` by default. - * __Note:__ Any specified style will augment the default style. For example, a bar mark with `"style": "foo"` will receive from `config.style.bar` and `config.style.foo` (the specified style `"foo"` has higher precedence). - */ - style?: string | string[]; - /** - * Whether a mark be clipped to the enclosing group’s width and height. - */ - clip?: boolean; - /** - * Offset for x-position. - */ - xOffset?: number | SignalRef; - /** - * Offset for y-position. - */ - yOffset?: number | SignalRef; - /** - * Offset for x2-position. - */ - x2Offset?: number | SignalRef; - /** - * Offset for y2-position. - */ - y2Offset?: number | SignalRef; - /** - * Offset for theta. - */ - thetaOffset?: number | SignalRef; - /** - * Offset for theta2. - */ - theta2Offset?: number | SignalRef; - /** - * Offset for radius. - */ - radiusOffset?: number | SignalRef; - /** - * Offset for radius2. - */ - radius2Offset?: number | SignalRef; -} -export interface MarkDef extends GenericMarkDef, Omit, MarkDefMixins { - /** - * @hidden - */ - startAngle?: number | SignalRef; - /** - * @hidden - */ - endAngle?: number | SignalRef; -} -export declare const defaultBarConfig: RectConfig; -export declare const defaultRectConfig: RectConfig; -export interface TickConfig extends MarkConfig, TickThicknessMixins { - /** - * The width of the ticks. - * - * __Default value:__ 3/4 of step (width step for horizontal ticks and height step for vertical ticks). - * @minimum 0 - */ - bandSize?: number; -} -export declare const defaultTickConfig: TickConfig; -export declare function getMarkType(m: string | GenericMarkDef): any; -//# sourceMappingURL=mark.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/mark.d.ts.map b/node_modules/vega-lite/build/src/mark.d.ts.map deleted file mode 100644 index 121e3f1..0000000 --- a/node_modules/vega-lite/build/src/mark.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../src/mark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,IAAI,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AAE9G,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAGhE;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;CAeP,CAAC;AAEX,eAAO,MAAM,GAAG,OAAW,CAAC;AAC5B,eAAO,MAAM,IAAI,QAAY,CAAC;AAC9B,eAAO,MAAM,GAAG,OAAW,CAAC;AAC5B,eAAO,MAAM,KAAK,SAAa,CAAC;AAChC,eAAO,MAAM,IAAI,QAAY,CAAC;AAC9B,eAAO,MAAM,KAAK,SAAa,CAAC;AAChC,eAAO,MAAM,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U,CAC1B,EACD,aAAa;IAIf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAID,eAAO,MAAM,gBAAgB,EAAE,UAI9B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,UAI/B,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,UAAU,EAAE,mBAAmB;IACjE;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,iBAAiB,EAAE,UAE/B,CAAC;AAEF,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,OAE1D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/mark.js b/node_modules/vega-lite/build/src/mark.js deleted file mode 100644 index 6c582b7..0000000 --- a/node_modules/vega-lite/build/src/mark.js +++ /dev/null @@ -1,109 +0,0 @@ -import { toSet } from 'vega-util'; -import { contains, keys } from './util'; -/** - * All types of primitive marks. - */ -export const Mark = { - arc: 'arc', - area: 'area', - bar: 'bar', - image: 'image', - line: 'line', - point: 'point', - rect: 'rect', - rule: 'rule', - text: 'text', - tick: 'tick', - trail: 'trail', - circle: 'circle', - square: 'square', - geoshape: 'geoshape' -}; -export const ARC = Mark.arc; -export const AREA = Mark.area; -export const BAR = Mark.bar; -export const IMAGE = Mark.image; -export const LINE = Mark.line; -export const POINT = Mark.point; -export const RECT = Mark.rect; -export const RULE = Mark.rule; -export const TEXT = Mark.text; -export const TICK = Mark.tick; -export const TRAIL = Mark.trail; -export const CIRCLE = Mark.circle; -export const SQUARE = Mark.square; -export const GEOSHAPE = Mark.geoshape; -export function isMark(m) { - return m in Mark; -} -export function isPathMark(m) { - return contains(['line', 'area', 'trail'], m); -} -export function isRectBasedMark(m) { - return contains(['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */], m); -} -export const PRIMITIVE_MARKS = keys(Mark); -export function isMarkDef(mark) { - return mark['type']; -} -const PRIMITIVE_MARK_INDEX = toSet(PRIMITIVE_MARKS); -export function isPrimitiveMark(mark) { - const markType = isMarkDef(mark) ? mark.type : mark; - return markType in PRIMITIVE_MARK_INDEX; -} -export const STROKE_CONFIG = [ - 'stroke', - 'strokeWidth', - 'strokeDash', - 'strokeDashOffset', - 'strokeOpacity', - 'strokeJoin', - 'strokeMiterLimit' -]; -export const FILL_CONFIG = ['fill', 'fillOpacity']; -export const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG]; -const VL_ONLY_MARK_CONFIG_INDEX = { - color: 1, - filled: 1, - invalid: 1, - order: 1, - radius2: 1, - theta2: 1, - timeUnitBand: 1, - timeUnitBandPosition: 1 -}; -export const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX); -export const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = { - area: ['line', 'point'], - bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize'], - rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize'], - line: ['point'], - tick: ['bandSize', 'thickness'] -}; -export const defaultMarkConfig = { - color: '#4c78a8', - invalid: 'filter', - timeUnitBand: 1 -}; -export const BAR_CORNER_RADIUS_INDEX = { - horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'], - vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight'] -}; -const DEFAULT_RECT_BAND_SIZE = 5; -export const defaultBarConfig = { - binSpacing: 1, - continuousBandSize: DEFAULT_RECT_BAND_SIZE, - timeUnitBandPosition: 0.5 -}; -export const defaultRectConfig = { - binSpacing: 0, - continuousBandSize: DEFAULT_RECT_BAND_SIZE, - timeUnitBandPosition: 0.5 -}; -export const defaultTickConfig = { - thickness: 1 -}; -export function getMarkType(m) { - return isMarkDef(m) ? m.type : m; -} -//# sourceMappingURL=mark.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/mark.js.map b/node_modules/vega-lite/build/src/mark.js.map deleted file mode 100644 index 7a3b432..0000000 --- a/node_modules/vega-lite/build/src/mark.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mark.js","sourceRoot":"","sources":["../../src/mark.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAC,QAAQ,EAAQ,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACZ,CAAC;AAEX,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAC5B,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AAC9B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAC5B,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AAC9B,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AAC9B,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AAC9B,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,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AC1C,oBAAoB,EAAE,GAAG;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAe;IAC3C,UAAU,EAAE,CAAC;IACb,kBAAkB,EAAE,sBAAsB;IAC1C,oBAAoB,EAAE,GAAG;CAC1B,CAAC;AAYF,MAAM,CAAC,MAAM,iBAAiB,GAAe;IAC3C,SAAS,EAAE,CAAC;CACb,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,CAA+B;IACzD,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/base.d.ts b/node_modules/vega-lite/build/src/normalize/base.d.ts deleted file mode 100644 index a134b08..0000000 --- a/node_modules/vega-lite/build/src/normalize/base.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Config } from '../config'; -import { Encoding } from '../encoding'; -import { Projection } from '../projection'; -import { GenericSpec, NormalizedSpec } from '../spec'; -import { GenericLayerSpec, NormalizedLayerSpec } from '../spec/layer'; -import { GenericUnitSpec, NormalizedUnitSpec } from '../spec/unit'; -import { FieldName } from '../channeldef'; -import { RepeaterValue } from './repeater'; -export declare type Normalize, NS extends NormalizedSpec> = (spec: S, params: NormalizerParams) => NS; -export interface ExtraNormalizer, // Input type -O extends NormalizedSpec, // Output Type -SN extends GenericSpec = S> { - name: string; - hasMatchingType: (spec: GenericSpec, config: Config) => spec is S; - run(spec: S, params: NormalizerParams, normalize: Normalize): O; -} -export declare type NonFacetUnitNormalizer> = ExtraNormalizer | GenericLayerSpec>; -export declare type NormalizeLayerOrUnit = Normalize | GenericLayerSpec, NormalizedUnitSpec | NormalizedLayerSpec>; -export interface NormalizerParams { - config: Config; - parentEncoding?: Encoding; - parentProjection?: Projection; - repeater?: RepeaterValue; - repeaterPrefix?: string; -} -//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/base.d.ts.map b/node_modules/vega-lite/build/src/normalize/base.d.ts.map deleted file mode 100644 index b2a702a..0000000 --- a/node_modules/vega-lite/build/src/normalize/base.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/normalize/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AACpD,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,oBAAY,SAAS,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,SAAS,cAAc,IAAI,CAC5F,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,gBAAgB,KACrB,EAAE,CAAC;AAER,MAAM,WAAW,eAAe,CAC9B,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,aAAa;AAC9D,CAAC,SAAS,cAAc,EAAE,cAAc;AACxC,EAAE,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC;IAEpD,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC;IAEtF,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;CACxE;AAED,oBAAY,sBAAsB,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,eAAe,CACvF,CAAC,EACD,kBAAkB,GAAG,mBAAmB,EACxC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAClD,CAAC;AAEF,oBAAY,oBAAoB,GAAG,SAAS,CAC1C,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,EACjD,kBAAkB,GAAG,mBAAmB,CACzC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IACrC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/base.js b/node_modules/vega-lite/build/src/normalize/base.js deleted file mode 100644 index c96e397..0000000 --- a/node_modules/vega-lite/build/src/normalize/base.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/base.js.map b/node_modules/vega-lite/build/src/normalize/base.js.map deleted file mode 100644 index 64c6ea7..0000000 --- a/node_modules/vega-lite/build/src/normalize/base.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/normalize/base.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/core.d.ts b/node_modules/vega-lite/build/src/normalize/core.d.ts deleted file mode 100644 index b7961c2..0000000 --- a/node_modules/vega-lite/build/src/normalize/core.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Field, FieldName } from '../channeldef'; -import { FacetedUnitSpec, GenericSpec, LayerSpec, UnitSpec } from '../spec'; -import { GenericConcatSpec } from '../spec/concat'; -import { GenericFacetSpec, NormalizedFacetSpec } from '../spec/facet'; -import { NormalizedSpec } from '../spec/index'; -import { NormalizedLayerSpec } from '../spec/layer'; -import { SpecMapper } from '../spec/map'; -import { RepeatSpec } from '../spec/repeat'; -import { NormalizedUnitSpec } from '../spec/unit'; -import { NormalizerParams } from './base'; -export declare class CoreNormalizer extends SpecMapper { - private nonFacetUnitNormalizers; - map(spec: GenericSpec, params: NormalizerParams): NormalizedUnitSpec | NormalizedFacetSpec | import("../spec").GenericLayerSpec | GenericConcatSpec, never, string>> | import("../spec").GenericVConcatSpec, never, string>> | import("../spec").GenericHConcatSpec, never, string>>; - mapUnit(spec: UnitSpec, params: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec; - protected mapRepeat(spec: RepeatSpec, params: NormalizerParams): GenericConcatSpec | NormalizedLayerSpec; - private mapLayerRepeat; - private mapNonLayerRepeat; - protected mapFacet(spec: GenericFacetSpec, params: NormalizerParams): GenericFacetSpec; - private mapUnitWithParentEncodingOrProjection; - private mapFacetedUnit; - private getFacetMappingAndLayout; - mapLayer(spec: LayerSpec, { parentEncoding, parentProjection, ...otherParams }: NormalizerParams): NormalizedLayerSpec; -} -//# sourceMappingURL=core.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/core.d.ts.map b/node_modules/vega-lite/build/src/normalize/core.d.ts.map deleted file mode 100644 index aad2357..0000000 --- a/node_modules/vega-lite/build/src/normalize/core.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/normalize/core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,K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SAAS,CAAC;IAYvE,OAAO,CAAC,qCAAqC;IAsB7C,OAAO,CAAC,cAAc;IAiCtB,OAAO,CAAC,wBAAwB;IAgDzB,QAAQ,CACb,IAAI,EAAE,SAAS,EACf,EAAC,cAAc,EAAE,gBAAgB,EAAE,GAAG,WAAW,EAAC,EAAE,gBAAgB,GACnE,mBAAmB;CAWvB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/core.js b/node_modules/vega-lite/build/src/normalize/core.js deleted file mode 100644 index e401d12..0000000 --- a/node_modules/vega-lite/build/src/normalize/core.js +++ /dev/null @@ -1,240 +0,0 @@ -import { __rest } from "tslib"; -import { isArray } from 'vega-util'; -import { COLUMN, FACET, ROW } from '../channel'; -import { hasConditionalFieldOrDatumDef, isFieldOrDatumDef, isValueDef } from '../channeldef'; -import { boxPlotNormalizer } from '../compositemark/boxplot'; -import { errorBandNormalizer } from '../compositemark/errorband'; -import { errorBarNormalizer } from '../compositemark/errorbar'; -import { channelHasField } from '../encoding'; -import * as log from '../log'; -import { isFacetMapping } from '../spec/facet'; -import { SpecMapper } from '../spec/map'; -import { isLayerRepeatSpec } from '../spec/repeat'; -import { isUnitSpec } from '../spec/unit'; -import { isEmpty, keys, omit, varName } from '../util'; -import { isSignalRef } from '../vega.schema'; -import { PathOverlayNormalizer } from './pathoverlay'; -import { RangeStepNormalizer } from './rangestep'; -import { replaceRepeaterInEncoding, replaceRepeaterInFacet } from './repeater'; -import { RuleForRangedLineNormalizer } from './ruleforrangedline'; -export class CoreNormalizer extends SpecMapper { - constructor() { - super(...arguments); - this.nonFacetUnitNormalizers = [ - boxPlotNormalizer, - errorBarNormalizer, - errorBandNormalizer, - new PathOverlayNormalizer(), - new RuleForRangedLineNormalizer(), - new RangeStepNormalizer() - ]; - } - map(spec, params) { - // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec. - if (isUnitSpec(spec)) { - const hasRow = channelHasField(spec.encoding, ROW); - const hasColumn = channelHasField(spec.encoding, COLUMN); - const hasFacet = channelHasField(spec.encoding, FACET); - if (hasRow || hasColumn || hasFacet) { - return this.mapFacetedUnit(spec, params); - } - } - return super.map(spec, params); - } - // This is for normalizing non-facet unit - mapUnit(spec, params) { - const { parentEncoding, parentProjection } = params; - const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater); - const specWithReplacedEncoding = Object.assign(Object.assign({}, spec), (encoding ? { encoding } : {})); - if (parentEncoding || parentProjection) { - return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params); - } - const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this); - for (const unitNormalizer of this.nonFacetUnitNormalizers) { - if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) { - return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit); - } - } - return specWithReplacedEncoding; - } - mapRepeat(spec, params) { - if (isLayerRepeatSpec(spec)) { - return this.mapLayerRepeat(spec, params); - } - else { - return this.mapNonLayerRepeat(spec, params); - } - } - mapLayerRepeat(spec, params) { - const { repeat, spec: childSpec } = spec, rest = __rest(spec, ["repeat", "spec"]); - const { row, column, layer } = repeat; - const { repeater = {}, repeaterPrefix = '' } = params; - if (row || column) { - return this.mapRepeat(Object.assign(Object.assign({}, spec), { repeat: Object.assign(Object.assign({}, (row ? { row } : {})), (column ? { column } : {})), spec: { - repeat: { layer }, - spec: childSpec - } }), params); - } - else { - return Object.assign(Object.assign({}, rest), { layer: layer.map(layerValue => { - const childRepeater = Object.assign(Object.assign({}, repeater), { layer: layerValue }); - const childName = (childSpec.name || '') + repeaterPrefix + `child__layer_${varName(layerValue)}`; - const child = this.mapLayerOrUnit(childSpec, Object.assign(Object.assign({}, params), { repeater: childRepeater, repeaterPrefix: childName })); - child.name = childName; - return child; - }) }); - } - } - mapNonLayerRepeat(spec, params) { - var _a; - const { repeat, spec: childSpec, data } = spec, remainingProperties = __rest(spec, ["repeat", "spec", "data"]); - if (!isArray(repeat) && spec.columns) { - // is repeat with row/column - spec = omit(spec, ['columns']); - log.warn(log.message.columnsNotSupportByRowCol('repeat')); - } - const concat = []; - const { repeater = {}, repeaterPrefix = '' } = params; - const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null]; - const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null]; - const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null]; - // cross product - for (const repeatValue of repeatValues) { - for (const rowValue of row) { - for (const columnValue of column) { - const childRepeater = { - repeat: repeatValue, - row: rowValue, - column: columnValue, - layer: repeater.layer - }; - const childName = (childSpec.name || '') + - repeaterPrefix + - 'child__' + - (isArray(repeat) - ? `${varName(repeatValue)}` - : (repeat.row ? `row_${varName(rowValue)}` : '') + - (repeat.column ? `column_${varName(columnValue)}` : '')); - const child = this.map(childSpec, Object.assign(Object.assign({}, params), { repeater: childRepeater, repeaterPrefix: childName })); - child.name = childName; - // we move data up - concat.push(omit(child, ['data'])); - } - } - } - const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1; - return Object.assign(Object.assign({ data: (_a = childSpec.data) !== null && _a !== void 0 ? _a : data, align: 'all' }, remainingProperties), { columns, - concat }); - } - mapFacet(spec, params) { - const { facet } = spec; - if (isFacetMapping(facet) && spec.columns) { - // is facet with row/column - spec = omit(spec, ['columns']); - log.warn(log.message.columnsNotSupportByRowCol('facet')); - } - return super.mapFacet(spec, params); - } - mapUnitWithParentEncodingOrProjection(spec, params) { - const { encoding, projection } = spec; - const { parentEncoding, parentProjection, config } = params; - const mergedProjection = mergeProjection({ parentProjection, projection }); - const mergedEncoding = mergeEncoding({ - parentEncoding, - encoding: replaceRepeaterInEncoding(encoding, params.repeater) - }); - return this.mapUnit(Object.assign(Object.assign(Object.assign({}, spec), (mergedProjection ? { projection: mergedProjection } : {})), (mergedEncoding ? { encoding: mergedEncoding } : {})), { config }); - } - mapFacetedUnit(spec, params) { - // New encoding in the inside spec should not contain row / column - // as row/column should be moved to facet - const _a = spec.encoding, { row, column, facet } = _a, encoding = __rest(_a, ["row", "column", "facet"]); - // Mark and encoding should be moved into the inner spec - const { mark, width, projection, height, view, selection, encoding: _ } = spec, outerSpec = __rest(spec, ["mark", "width", "projection", "height", "view", "selection", "encoding"]); - const { facetMapping, layout } = this.getFacetMappingAndLayout({ row, column, facet }, params); - const newEncoding = replaceRepeaterInEncoding(encoding, params.repeater); - return this.mapFacet(Object.assign(Object.assign(Object.assign({}, outerSpec), layout), { - // row / column has higher precedence than facet - facet: facetMapping, spec: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (width ? { width } : {})), (height ? { height } : {})), (view ? { view } : {})), (projection ? { projection } : {})), { mark, encoding: newEncoding }), (selection ? { selection } : {})) }), params); - } - getFacetMappingAndLayout(facets, params) { - var _a; - const { row, column, facet } = facets; - if (row || column) { - if (facet) { - log.warn(log.message.facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])])); - } - const facetMapping = {}; - const layout = {}; - for (const channel of [ROW, COLUMN]) { - const def = facets[channel]; - if (def) { - const { align, center, spacing, columns } = def, defWithoutLayout = __rest(def, ["align", "center", "spacing", "columns"]); - facetMapping[channel] = defWithoutLayout; - for (const prop of ['align', 'center', 'spacing']) { - if (def[prop] !== undefined) { - layout[prop] = (_a = layout[prop]) !== null && _a !== void 0 ? _a : {}; - layout[prop][channel] = def[prop]; - } - } - } - } - return { facetMapping, layout }; - } - else { - const { align, center, spacing, columns } = facet, facetMapping = __rest(facet, ["align", "center", "spacing", "columns"]); - return { - facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater), - layout: Object.assign(Object.assign(Object.assign(Object.assign({}, (align ? { align } : {})), (center ? { center } : {})), (spacing ? { spacing } : {})), (columns ? { columns } : {})) - }; - } - } - mapLayer(spec, _a) { - // Special handling for extended layer spec - var { parentEncoding, parentProjection } = _a, otherParams = __rest(_a, ["parentEncoding", "parentProjection"]); - const { encoding, projection } = spec, rest = __rest(spec, ["encoding", "projection"]); - const params = Object.assign(Object.assign({}, otherParams), { parentEncoding: mergeEncoding({ parentEncoding, encoding, layer: true }), parentProjection: mergeProjection({ parentProjection, projection }) }); - return super.mapLayer(rest, params); - } -} -function mergeEncoding({ parentEncoding, encoding = {}, layer }) { - let merged = {}; - if (parentEncoding) { - const channels = new Set([...keys(parentEncoding), ...keys(encoding)]); - for (const channel of channels) { - const channelDef = encoding[channel]; - const parentChannelDef = parentEncoding[channel]; - if (isFieldOrDatumDef(channelDef)) { - // Field/Datum Def can inherit properties from its parent - // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one. - const mergedChannelDef = Object.assign(Object.assign({}, parentChannelDef), channelDef); - merged[channel] = mergedChannelDef; - } - else if (hasConditionalFieldOrDatumDef(channelDef)) { - merged[channel] = Object.assign(Object.assign({}, channelDef), { condition: Object.assign(Object.assign({}, parentChannelDef), channelDef.condition) }); - } - else if (channelDef) { - merged[channel] = channelDef; - } - else if (layer || - isValueDef(parentChannelDef) || - isSignalRef(parentChannelDef) || - isFieldOrDatumDef(parentChannelDef) || - isArray(parentChannelDef)) { - merged[channel] = parentChannelDef; - } - } - } - else { - merged = encoding; - } - return !merged || isEmpty(merged) ? undefined : merged; -} -function mergeProjection(opt) { - const { parentProjection, projection } = opt; - if (parentProjection && projection) { - log.warn(log.message.projectionOverridden({ parentProjection, projection })); - } - return projection !== null && projection !== void 0 ? projection : parentProjection; -} -//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/core.js.map b/node_modules/vega-lite/build/src/normalize/core.js.map deleted file mode 100644 index ba6b207..0000000 --- a/node_modules/vega-lite/build/src/normalize/core.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/normalize/core.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAC,MAAM,YAAY,CAAC;AAC9C,OAA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AAC,GAA2D;IAClF,MAAM,EAAC,gBAAgB,EAAE,UAAU,EAAC,GAAG,GAAG,CAAC;IAC3C,IAAI,gBAAgB,IAAI,UAAU,EAAE;QAClC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAC,gBAAgB,EAAE,UAAU,EAAC,CAAC,CAAC,CAAC;KAC5E;IACD,OAAO,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,gBAAgB,CAAC;AACxC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/index.d.ts b/node_modules/vega-lite/build/src/normalize/index.d.ts deleted file mode 100644 index b6a5a62..0000000 --- a/node_modules/vega-lite/build/src/normalize/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Config } from '../config'; -import { LayoutSizeMixins, NormalizedSpec, TopLevelSpec } from '../spec'; -import { AutoSizeParams, AutosizeType, TopLevel } from '../spec/toplevel'; -import { NormalizerParams } from './base'; -export declare function normalize(spec: TopLevelSpec & LayoutSizeMixins, config?: Config): TopLevel & LayoutSizeMixins; -/** - * Normalize autosize and deal with width or height == "container". - */ -export declare function normalizeAutoSize(spec: TopLevel, sizeInfo: { - autosize: AutosizeType | AutoSizeParams; -} & LayoutSizeMixins, config?: Config): AutoSizeParams; -export { NormalizerParams }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/index.d.ts.map b/node_modules/vega-lite/build/src/normalize/index.d.ts.map deleted file mode 100644 index 80d8e8a..0000000 --- a/node_modules/vega-lite/build/src/normalize/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/normalize/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,MAAM,EAAa,MAAM,WAAW,CAAC;AAE7C,OAAO,EAML,gBAAgB,EAChB,cAAc,EACd,YAAY,EAGb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAC,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAGxC,wBAAgB,SAAS,CACvB,IAAI,EAAE,YAAY,GAAG,gBAAgB,EACrC,MAAM,CAAC,EAAE,MAAM,GACd,QAAQ,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAc7C;AAkBD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC9B,QAAQ,EAAE;IAAC,QAAQ,EAAE,YAAY,GAAG,cAAc,CAAA;CAAC,GAAG,gBAAgB,EACtE,MAAM,CAAC,EAAE,MAAM,kBAwDhB;AAED,OAAO,EAAC,gBAAgB,EAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/index.js b/node_modules/vega-lite/build/src/normalize/index.js deleted file mode 100644 index 3be3763..0000000 --- a/node_modules/vega-lite/build/src/normalize/index.js +++ /dev/null @@ -1,76 +0,0 @@ -import { isString } from 'vega-util'; -import { initConfig } from '../config'; -import * as log from '../log'; -import { isLayerSpec, isUnitSpec } from '../spec'; -import { deepEqual } from '../util'; -import { CoreNormalizer } from './core'; -export function normalize(spec, config) { - if (config === undefined) { - config = initConfig(spec.config); - } - const normalizedSpec = normalizeGenericSpec(spec, config); - const { width, height } = spec; - const autosize = normalizeAutoSize(normalizedSpec, { width, height, autosize: spec.autosize }, config); - return Object.assign(Object.assign({}, normalizedSpec), (autosize ? { autosize } : {})); -} -const normalizer = new CoreNormalizer(); -/** - * Decompose extended unit specs into composition of pure unit specs. - */ -function normalizeGenericSpec(spec, config = {}) { - return normalizer.map(spec, { config }); -} -function _normalizeAutoSize(autosize) { - return isString(autosize) ? { type: autosize } : autosize !== null && autosize !== void 0 ? autosize : {}; -} -/** - * Normalize autosize and deal with width or height == "container". - */ -export function normalizeAutoSize(spec, sizeInfo, config) { - let { width, height } = sizeInfo; - const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec); - const autosizeDefault = {}; - if (!isFitCompatible) { - // If spec is not compatible with autosize == "fit", discard width/height == container - if (width == 'container') { - log.warn(log.message.containerSizeNonSingle('width')); - width = undefined; - } - if (height == 'container') { - log.warn(log.message.containerSizeNonSingle('height')); - height = undefined; - } - } - else { - // Default autosize parameters to fit when width/height is "container" - if (width == 'container' && height == 'container') { - autosizeDefault.type = 'fit'; - autosizeDefault.contains = 'padding'; - } - else if (width == 'container') { - autosizeDefault.type = 'fit-x'; - autosizeDefault.contains = 'padding'; - } - else if (height == 'container') { - autosizeDefault.type = 'fit-y'; - autosizeDefault.contains = 'padding'; - } - } - const autosize = Object.assign(Object.assign(Object.assign({ type: 'pad' }, autosizeDefault), (config ? _normalizeAutoSize(config.autosize) : {})), _normalizeAutoSize(spec.autosize)); - if (autosize.type === 'fit' && !isFitCompatible) { - log.warn(log.message.FIT_NON_SINGLE); - autosize.type = 'pad'; - } - if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) { - log.warn(log.message.containerSizeNotCompatibleWithAutosize('width')); - } - if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) { - log.warn(log.message.containerSizeNotCompatibleWithAutosize('height')); - } - // Delete autosize property if it's Vega's default - if (deepEqual(autosize, { type: 'pad' })) { - return undefined; - } - return autosize; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/index.js.map b/node_modules/vega-lite/build/src/normalize/index.js.map deleted file mode 100644 index 496fa52..0000000 --- a/node_modules/vega-lite/build/src/normalize/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/normalize/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAS,UAAU,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AA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eAAe,EAAE;QAC/C,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACrC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;KACvB;IAED,IAAI,KAAK,IAAI,WAAW,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,KAAK,IAAI,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE;QACjF,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,sCAAsC,CAAC,OAAO,CAAC,CAAC,CAAC;KACvE;IACD,IAAI,MAAM,IAAI,WAAW,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,KAAK,IAAI,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE;QAClF,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,sCAAsC,CAAC,QAAQ,CAAC,CAAC,CAAC;KACxE;IAED,kDAAkD;IAClD,IAAI,SAAS,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,EAAE;QACtC,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/pathoverlay.d.ts b/node_modules/vega-lite/build/src/normalize/pathoverlay.d.ts deleted file mode 100644 index 5a9f825..0000000 --- a/node_modules/vega-lite/build/src/normalize/pathoverlay.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Config } from '../config'; -import { Encoding } from '../encoding'; -import { Mark, MarkDef } from '../mark'; -import { GenericUnitSpec, NormalizedUnitSpec } from '../spec'; -import { NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams } from './base'; -declare type UnitSpecWithPathOverlay = GenericUnitSpec, Mark | MarkDef<'line' | 'area' | 'rule' | 'trail'>>; -export declare class PathOverlayNormalizer implements NonFacetUnitNormalizer { - name: string; - hasMatchingType(spec: GenericUnitSpec, config: Config): spec is UnitSpecWithPathOverlay; - run(spec: UnitSpecWithPathOverlay, params: NormalizerParams, normalize: NormalizeLayerOrUnit): NormalizedUnitSpec | import("../spec").NormalizedLayerSpec; -} -export {}; -//# sourceMappingURL=pathoverlay.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/pathoverlay.d.ts.map b/node_modules/vega-lite/build/src/normalize/pathoverlay.d.ts.map deleted file mode 100644 index 201975c..0000000 --- a/node_modules/vega-lite/build/src/normalize/pathoverlay.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pathoverlay.d.ts","sourceRoot":"","sources":["../../../src/normalize/pathoverlay.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAoB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAoC,IAAI,EAAc,OAAO,EAAC,MAAM,SAAS,CAAC;AACrF,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAI5D,OAAO,EAAC,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAEtF,aAAK,uBAAuB,GAAG,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;AA2DrH,qBAAa,qBAAsB,YAAW,sBAAsB,CAAC,uBAAuB,CAAC;IACpF,IAAI,SAAkB;IAEtB,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,IAAI,uBAAuB;IAoB5G,GAAG,CAAC,IAAI,EAAE,uBAAuB,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,oBAAoB;CAgFpG"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/pathoverlay.js b/node_modules/vega-lite/build/src/normalize/pathoverlay.js deleted file mode 100644 index 8264eab..0000000 --- a/node_modules/vega-lite/build/src/normalize/pathoverlay.js +++ /dev/null @@ -1,117 +0,0 @@ -import { __rest } from "tslib"; -import { isObject } from 'vega-util'; -import { normalizeEncoding } from '../encoding'; -import { isMarkDef } from '../mark'; -import { isUnitSpec } from '../spec/unit'; -import { stack } from '../stack'; -import { keys, omit, pick } from '../util'; -function dropLineAndPoint(markDef) { - const { point: _point, line: _line } = markDef, mark = __rest(markDef, ["point", "line"]); - return keys(mark).length > 1 ? mark : mark.type; -} -function dropLineAndPointFromConfig(config) { - for (const mark of ['line', 'area', 'rule', 'trail']) { - if (config[mark]) { - config = Object.assign(Object.assign({}, config), { - // TODO: remove as any - [mark]: omit(config[mark], ['point', 'line']) }); - } - } - return config; -} -function getPointOverlay(markDef, markConfig = {}, encoding) { - if (markDef.point === 'transparent') { - return { opacity: 0 }; - } - else if (markDef.point) { - // truthy : true or object - return isObject(markDef.point) ? markDef.point : {}; - } - else if (markDef.point !== undefined) { - // false or null - return null; - } - else { - // undefined (not disabled) - if (markConfig.point || encoding.shape) { - // enable point overlay if config[mark].point is truthy or if encoding.shape is provided - return isObject(markConfig.point) ? markConfig.point : {}; - } - // markDef.point is defined as falsy - return undefined; - } -} -function getLineOverlay(markDef, markConfig = {}) { - if (markDef.line) { - // true or object - return markDef.line === true ? {} : markDef.line; - } - else if (markDef.line !== undefined) { - // false or null - return null; - } - else { - // undefined (not disabled) - if (markConfig.line) { - // enable line overlay if config[mark].line is truthy - return markConfig.line === true ? {} : markConfig.line; - } - // markDef.point is defined as falsy - return undefined; - } -} -export class PathOverlayNormalizer { - constructor() { - this.name = 'path-overlay'; - } - hasMatchingType(spec, config) { - if (isUnitSpec(spec)) { - const { mark, encoding } = spec; - const markDef = isMarkDef(mark) ? mark : { type: mark }; - switch (markDef.type) { - case 'line': - case 'rule': - case 'trail': - return !!getPointOverlay(markDef, config[markDef.type], encoding); - case 'area': - return ( - // false / null are also included as we want to remove the properties - !!getPointOverlay(markDef, config[markDef.type], encoding) || - !!getLineOverlay(markDef, config[markDef.type])); - } - } - return false; - } - run(spec, params, normalize) { - const { config } = params; - const { selection, projection, mark, encoding: e } = spec, outerSpec = __rest(spec, ["selection", "projection", "mark", "encoding"]); - // Need to call normalizeEncoding because we need the inferred types to correctly determine stack - const encoding = normalizeEncoding(e, config); - const markDef = isMarkDef(mark) ? mark : { type: mark }; - const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding); - const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]); - const layer = [ - Object.assign(Object.assign({}, (selection ? { selection } : {})), { mark: dropLineAndPoint(Object.assign(Object.assign({}, (markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined - ? { opacity: 0.7 } - : {})), markDef)), - // drop shape from encoding as this might be used to trigger point overlay - encoding: omit(encoding, ['shape']) }) - ]; - // FIXME: determine rules for applying selections. - // Need to copy stack config to overlayed layer - const stackProps = stack(markDef, encoding); - let overlayEncoding = encoding; - if (stackProps) { - const { fieldChannel: stackFieldChannel, offset } = stackProps; - overlayEncoding = Object.assign(Object.assign({}, encoding), { [stackFieldChannel]: Object.assign(Object.assign({}, encoding[stackFieldChannel]), (offset ? { stack: offset } : {})) }); - } - if (lineOverlay) { - layer.push(Object.assign(Object.assign({}, (projection ? { projection } : {})), { mark: Object.assign(Object.assign({ type: 'line' }, pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip'])), lineOverlay), encoding: overlayEncoding })); - } - if (pointOverlay) { - layer.push(Object.assign(Object.assign({}, (projection ? { projection } : {})), { mark: Object.assign(Object.assign({ type: 'point', opacity: 1, filled: true }, pick(markDef, ['clip', 'tooltip'])), pointOverlay), encoding: overlayEncoding })); - } - return normalize(Object.assign(Object.assign({}, outerSpec), { layer }), Object.assign(Object.assign({}, params), { config: dropLineAndPointFromConfig(config) })); - } -} -//# sourceMappingURL=pathoverlay.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/pathoverlay.js.map b/node_modules/vega-lite/build/src/normalize/pathoverlay.js.map deleted file mode 100644 index b8fabe3..0000000 --- a/node_modules/vega-lite/build/src/normalize/pathoverlay.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pathoverlay.js","sourceRoot":"","sources":["../../../src/normalize/pathoverlay.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAW,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACxD,OAAO,EAAa,SAAS,EAAwC,MAAM,SAAS,CAAC;AAErF,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,SAAS,CAAC;AAKzC,SAAS,gBAAgB,CAAC,OAAgB;IACxC,MAAM,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,KAAa,OAAO,EAAf,IAAI,UAAI,OAAO,EAA/C,iBAAqC,CAAU,CAAC;IAEtD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AAClD,CAAC;AAED,SAAS,0BAA0B,CAAC,MAAc;IAChD,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAU,EAAE;QAC7D,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE;YAChB,MAAM,mCACD,MAAM;gBACT,sBAAsB;gBACtB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAQ,CAAC,GACrD,CAAC;SACH;KACF;IACD,OAAO,MA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C;SACH;QAED,IAAI,WAAW,EAAE;YACf,KAAK,CAAC,IAAI,iCACL,CAAC,UAAU,CAAC,CAAC,CAAC,EAAC,UAAU,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KACnC,IAAI,gCACF,IAAI,EAAE,MAAM,IACT,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,GAC5D,WAAW,GAEhB,QAAQ,EAAE,eAAe,IACzB,CAAC;SACJ;QACD,IAAI,YAAY,EAAE;YAChB,KAAK,CAAC,IAAI,iCACL,CAAC,UAAU,CAAC,CAAC,CAAC,EAAC,UAAU,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KACnC,IAAI,gCACF,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,IAAI,IACT,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAClC,YAAY,GAEjB,QAAQ,EAAE,eAAe,IACzB,CAAC;SACJ;QAED,OAAO,SAAS,iCAET,SAAS,KACZ,KAAK,qCAGF,MAAM,KACT,MAAM,EAAE,0BAA0B,CAAC,MAAM,CAAC,IAE7C,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/rangestep.d.ts b/node_modules/vega-lite/build/src/normalize/rangestep.d.ts deleted file mode 100644 index 970df13..0000000 --- a/node_modules/vega-lite/build/src/normalize/rangestep.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Encoding } from '../encoding'; -import { GenericSpec } from '../spec'; -import { GenericUnitSpec, NormalizedUnitSpec } from '../spec/unit'; -import { NonFacetUnitNormalizer } from './base'; -declare type UnitSpecWithRangeStep = GenericUnitSpec, any>; -export declare class RangeStepNormalizer implements NonFacetUnitNormalizer { - name: string; - hasMatchingType(spec: GenericSpec): spec is UnitSpecWithRangeStep; - run(spec: UnitSpecWithRangeStep): NormalizedUnitSpec; -} -export {}; -//# sourceMappingURL=rangestep.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/rangestep.d.ts.map b/node_modules/vega-lite/build/src/normalize/rangestep.d.ts.map deleted file mode 100644 index 90bebd5..0000000 --- a/node_modules/vega-lite/build/src/normalize/rangestep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rangestep.d.ts","sourceRoot":"","sources":["../../../src/normalize/rangestep.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,EAAC,eAAe,EAAc,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAE7E,OAAO,EAAC,sBAAsB,EAAC,MAAM,QAAQ,CAAC;AAE9C,aAAK,qBAAqB,GAAG,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;AAEpE,qBAAa,mBAAoB,YAAW,sBAAsB,CAAC,qBAAqB,CAAC;IAChF,IAAI,SAAe;IAEnB,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,IAAI,qBAAqB;IAcrF,GAAG,CAAC,IAAI,EAAE,qBAAqB,GAAG,kBAAkB;CAgC5D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/rangestep.js b/node_modules/vega-lite/build/src/normalize/rangestep.js deleted file mode 100644 index 2d17d49..0000000 --- a/node_modules/vega-lite/build/src/normalize/rangestep.js +++ /dev/null @@ -1,45 +0,0 @@ -import { __rest } from "tslib"; -import { getSizeChannel, POSITION_SCALE_CHANNELS } from '../channel'; -import { isFieldOrDatumDef } from '../channeldef'; -import * as log from '../log'; -import { isUnitSpec } from '../spec/unit'; -import { isEmpty } from '../util'; -export class RangeStepNormalizer { - constructor() { - this.name = 'RangeStep'; - } - hasMatchingType(spec) { - var _a; - if (isUnitSpec(spec) && spec.encoding) { - for (const channel of POSITION_SCALE_CHANNELS) { - const def = spec.encoding[channel]; - if (def && isFieldOrDatumDef(def)) { - if ((_a = def === null || def === void 0 ? void 0 : def.scale) === null || _a === void 0 ? void 0 : _a['rangeStep']) { - return true; - } - } - } - } - return false; - } - run(spec) { - var _a; - const sizeMixins = {}; - let encoding = Object.assign({}, spec.encoding); - for (const channel of POSITION_SCALE_CHANNELS) { - const sizeType = getSizeChannel(channel); - const def = encoding[channel]; - if (def && isFieldOrDatumDef(def)) { - if ((_a = def === null || def === void 0 ? void 0 : def.scale) === null || _a === void 0 ? void 0 : _a['rangeStep']) { - const { scale } = def, defWithoutScale = __rest(def, ["scale"]); - const _b = scale, { rangeStep } = _b, scaleWithoutRangeStep = __rest(_b, ["rangeStep"]); - sizeMixins[sizeType] = { step: scale['rangeStep'] }; - log.warn(log.message.RANGE_STEP_DEPRECATED); - encoding = Object.assign(Object.assign({}, encoding), { [channel]: Object.assign(Object.assign({}, defWithoutScale), (isEmpty(scaleWithoutRangeStep) ? {} : { scale: scaleWithoutRangeStep })) }); - } - } - } - return Object.assign(Object.assign(Object.assign({}, sizeMixins), spec), { encoding }); - } -} -//# sourceMappingURL=rangestep.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/rangestep.js.map b/node_modules/vega-lite/build/src/normalize/rangestep.js.map deleted file mode 100644 index 8f2af81..0000000 --- a/node_modules/vega-lite/build/src/normalize/rangestep.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rangestep.js","sourceRoot":"","sources":["../../../src/normalize/rangestep.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAE,uBAAuB,EAAC,MAAM,YAAY,CAAC;AACnE,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAkB,UAAU,EAAqB,MAAM,cAAc,CAAC;A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EAAC,CAAC;oBAElD,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;oBAE5C,QAAQ,mCACH,QAAQ,KACX,CAAC,OAAO,CAAC,kCACJ,eAAe,GACf,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,qBAAqB,EAAC,CAAC,IAE5E,CAAC;iBACH;aACF;SACF;QACD,qDACK,UAAU,GACV,IAAI,KACP,QAAQ,IACR;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/repeater.d.ts b/node_modules/vega-lite/build/src/normalize/repeater.d.ts deleted file mode 100644 index 303fc8b..0000000 --- a/node_modules/vega-lite/build/src/normalize/repeater.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Field, FieldName } from '../channeldef'; -import { Encoding } from '../encoding'; -import { FacetFieldDef, FacetMapping } from '../spec/facet'; -export interface RepeaterValue { - row?: string; - column?: string; - repeat?: string; - layer?: string; -} -export declare function replaceRepeaterInFacet(facet: FacetFieldDef | FacetMapping, repeater: RepeaterValue): FacetFieldDef | FacetMapping; -export declare function replaceRepeaterInEncoding>(encoding: E, repeater: RepeaterValue): Encoding; -//# sourceMappingURL=repeater.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/repeater.d.ts.map b/node_modules/vega-lite/build/src/normalize/repeater.d.ts.map deleted file mode 100644 index df9d0d8..0000000 --- a/node_modules/vega-lite/build/src/normalize/repeater.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"repeater.d.ts","sourceRoot":"","sources":["../../../src/normalize/repeater.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,EAEL,SAAS,EASV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAC,aAAa,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,EACjD,QAAQ,EAAE,aAAa,GACtB,aAAa,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC,SAAS,CAAC,CASpD;AAED,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,QAAQ,CAAC,KAAK,CAAC,EACjE,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,aAAa,GACtB,QAAQ,CAAC,SAAS,CAAC,CAMrB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/repeater.js b/node_modules/vega-lite/build/src/normalize/repeater.js deleted file mode 100644 index c48cef0..0000000 --- a/node_modules/vega-lite/build/src/normalize/repeater.js +++ /dev/null @@ -1,114 +0,0 @@ -import { __rest } from "tslib"; -import { hasOwnProperty, isArray } from 'vega-util'; -import { hasConditionalFieldOrDatumDef, isConditionalDef, isFieldDef, isFieldOrDatumDef, isRepeatRef, isSortableFieldDef } from '../channeldef'; -import * as log from '../log'; -import { isSortField } from '../sort'; -import { isFacetMapping } from '../spec/facet'; -export function replaceRepeaterInFacet(facet, repeater) { - if (!repeater) { - return facet; - } - if (isFacetMapping(facet)) { - return replaceRepeaterInMapping(facet, repeater); - } - return replaceRepeaterInFieldDef(facet, repeater); -} -export function replaceRepeaterInEncoding(encoding, repeater) { - if (!repeater) { - return encoding; - } - return replaceRepeaterInMapping(encoding, repeater); -} -/** - * Replaces repeated value and returns if the repeated value is valid. - */ -function replaceRepeatInProp(prop, o, repeater) { - const val = o[prop]; - if (isRepeatRef(val)) { - if (val.repeat in repeater) { - return Object.assign(Object.assign({}, o), { [prop]: repeater[val.repeat] }); - } - else { - log.warn(log.message.noSuchRepeatedValue(val.repeat)); - return undefined; - } - } - return o; -} -/** - * Replace repeater values in a field def with the concrete field name. - */ -function replaceRepeaterInFieldDef(fieldDef, repeater) { - fieldDef = replaceRepeatInProp('field', fieldDef, repeater); - if (fieldDef === undefined) { - // the field def should be ignored - return undefined; - } - else if (fieldDef === null) { - return null; - } - if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) { - const sort = replaceRepeatInProp('field', fieldDef.sort, repeater); - fieldDef = Object.assign(Object.assign({}, fieldDef), (sort ? { sort } : {})); - } - return fieldDef; -} -function replaceRepeaterInFieldOrDatumDef(def, repeater) { - if (isFieldDef(def)) { - return replaceRepeaterInFieldDef(def, repeater); - } - else { - const datumDef = replaceRepeatInProp('datum', def, repeater); - if (datumDef !== def && !datumDef.type) { - datumDef.type = 'nominal'; - } - return datumDef; - } -} -function replaceRepeaterInChannelDef(channelDef, repeater) { - if (isFieldOrDatumDef(channelDef)) { - const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater); - if (fd) { - return fd; - } - else if (isConditionalDef(channelDef)) { - return { condition: channelDef.condition }; - } - } - else { - if (hasConditionalFieldOrDatumDef(channelDef)) { - const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater); - if (fd) { - return Object.assign(Object.assign({}, channelDef), { condition: fd }); - } - else { - const { condition } = channelDef, channelDefWithoutCondition = __rest(channelDef, ["condition"]); - return channelDefWithoutCondition; - } - } - return channelDef; - } - return undefined; -} -function replaceRepeaterInMapping(mapping, repeater) { - const out = {}; - for (const channel in mapping) { - if (hasOwnProperty(mapping, channel)) { - const channelDef = mapping[channel]; - if (isArray(channelDef)) { - // array cannot have condition - out[channel] = channelDef // somehow we need to cast it here - .map(cd => replaceRepeaterInChannelDef(cd, repeater)) - .filter(cd => cd); - } - else { - const cd = replaceRepeaterInChannelDef(channelDef, repeater); - if (cd !== undefined) { - out[channel] = cd; - } - } - } - } - return out; -} -//# sourceMappingURL=repeater.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/repeater.js.map b/node_modules/vega-lite/build/src/normalize/repeater.js.map deleted file mode 100644 index 140998a..0000000 --- a/node_modules/vega-lite/build/src/normalize/repeater.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"repeater.js","sourceRoot":"","sources":["../../../src/normalize/repeater.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAClD,OAAO,EAML,6BAA6B,EAC7B,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAGnB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,EAA8B,cAAc,EAAC,MAAM,eAAe,CAAC;AAW1E,MAAM,UAAU,sBAAsB,CACpC,KAAiD,EACjD,QAAuB;IAEvB,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,KAAiC,CAAC;KAC1C;IAED,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE;QACzB,OAAO,wBAAwB,CAAC,KAAK,EAAE,QAAQ,CAA4B,CAAC;KAC7E;IACD,OAAO,yBAAyB,CAAC,KAAK,EAAE,QAAQ,CAA6B,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,QAAW,EACX,QAAuB;IAEvB,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,QAA+B,CAAC;KACxC;IAED,OAAO,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,CAAwB,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAI,IAAa,EAAE,CAAI,EAAE,QAAuB;IAC1E,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;IACpB,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE;QACpB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AAC,kCAAkC;qBAClF,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,2BAA2B,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;qBACpD,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;aACrB;iBAAM;gBACL,MAAM,EAAE,GAAG,2BAA2B,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;gBAC7D,IAAI,EAAE,KAAK,SAAS,EAAE;oBACpB,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;iBACnB;aACF;SACF;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/ruleforrangedline.d.ts b/node_modules/vega-lite/build/src/normalize/ruleforrangedline.d.ts deleted file mode 100644 index ad7e8b2..0000000 --- a/node_modules/vega-lite/build/src/normalize/ruleforrangedline.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Field } from '../channeldef'; -import { Encoding } from '../encoding'; -import { GenericSpec } from '../spec'; -import { GenericUnitSpec } from '../spec/unit'; -import { NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams } from './base'; -interface EncodingX2Mixins { - x2: Encoding['x2']; -} -interface EncodingY2Mixins { - y2: Encoding['y2']; -} -declare type RangedLineSpec = GenericUnitSpec & (EncodingX2Mixins | EncodingY2Mixins), 'line'>; -export declare class RuleForRangedLineNormalizer implements NonFacetUnitNormalizer { - name: string; - hasMatchingType(spec: GenericSpec): spec is RangedLineSpec; - run(spec: RangedLineSpec, params: NormalizerParams, normalize: NormalizeLayerOrUnit): import("../spec").NormalizedUnitSpec | import("../spec").NormalizedLayerSpec; -} -export {}; -//# sourceMappingURL=ruleforrangedline.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/ruleforrangedline.d.ts.map b/node_modules/vega-lite/build/src/normalize/ruleforrangedline.d.ts.map deleted file mode 100644 index f1a0022..0000000 --- a/node_modules/vega-lite/build/src/normalize/ruleforrangedline.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ruleforrangedline.d.ts","sourceRoot":"","sources":["../../../src/normalize/ruleforrangedline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAyB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,EAAC,eAAe,EAAa,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAEtF,UAAU,gBAAgB;IACxB,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,UAAU,gBAAgB;IACxB,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,aAAK,cAAc,GAAG,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;AAEvG,qBAAa,2BAA4B,YAAW,sBAAsB,CAAC,cAAc,CAAC;IACjF,IAAI,SAAuB;IAE3B,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,IAAI,cAAc;IAmB9E,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,oBAAoB;CAY3F"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/ruleforrangedline.js b/node_modules/vega-lite/build/src/normalize/ruleforrangedline.js deleted file mode 100644 index 49b2dd1..0000000 --- a/node_modules/vega-lite/build/src/normalize/ruleforrangedline.js +++ /dev/null @@ -1,33 +0,0 @@ -import { isBinned } from '../bin'; -import { getMainRangeChannel, SECONDARY_RANGE_CHANNEL } from '../channel'; -import { isDatumDef, isFieldDef } from '../channeldef'; -import * as log from '../log'; -import { isUnitSpec } from '../spec/unit'; -export class RuleForRangedLineNormalizer { - constructor() { - this.name = 'RuleForRangedLine'; - } - hasMatchingType(spec) { - if (isUnitSpec(spec)) { - const { encoding, mark } = spec; - if (mark === 'line') { - for (const channel of SECONDARY_RANGE_CHANNEL) { - const mainChannel = getMainRangeChannel(channel); - const mainChannelDef = encoding[mainChannel]; - if (encoding[channel]) { - if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) { - return true; - } - } - } - } - } - return false; - } - run(spec, params, normalize) { - const { encoding } = spec; - log.warn(log.message.lineWithRange(!!encoding.x2, !!encoding.y2)); - return normalize(Object.assign(Object.assign({}, spec), { mark: 'rule' }), params); - } -} -//# sourceMappingURL=ruleforrangedline.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/normalize/ruleforrangedline.js.map b/node_modules/vega-lite/build/src/normalize/ruleforrangedline.js.map deleted file mode 100644 index 92019d7..0000000 --- a/node_modules/vega-lite/build/src/normalize/ruleforrangedline.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ruleforrangedline.js","sourceRoot":"","sources":["../../../src/normalize/ruleforrangedline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAC,mBAAmB,EAAE,uBAAuB,EAAC,MAAM,YAAY,CAAC;AACxE,OAAO,EAAQ,UAAU,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAE5D,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAkB,UAAU,EAAC,MAAM,cAAc,CAAC;AAazD,MAAM,OAAO,2BAA2B;IAAxC;QACS,SAAI,GAAG,mBAAmB,CAAC;IAiCpC,CAAC;IA/BQ,eAAe,CAAC,IAAqC;QAC1D,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC;YAC9B,IAAI,IAAI,KAAK,MAAM,EAAE;gBACnB,KAAK,MAAM,OAAO,IAAI,uBAAuB,EAAE;oBAC7C,MAAM,WAAW,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;oBACjD,MAAM,cAAc,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;oBAE7C,IAAI,QAAQ,CAAC,OAAO,CAAC,EAAE;wBACrB,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,cAAc,CAAC,EAAE;4BAC/F,OAAO,IAAI,CAAC;yBACb;qBACF;iBACF;aACF;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,GAAG,CAAC,IAAoB,EAAE,MAAwB,EAAE,SAA+B;QACxF,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC;QACxB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAElE,OAAO,SAAS,iCAET,IAAI,KACP,IAAI,EAAE,MAAM,KAEd,MAAM,CACP,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/predicate.d.ts b/node_modules/vega-lite/build/src/predicate.d.ts deleted file mode 100644 index 6927931..0000000 --- a/node_modules/vega-lite/build/src/predicate.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { SignalRef } from 'vega'; -import { FieldName } from './channeldef'; -import { DateTime } from './datetime'; -import { LogicalComposition } from './logical'; -import { TimeUnit, TimeUnitParams } from './timeunit'; -export declare type Predicate = FieldEqualPredicate | FieldRangePredicate | FieldOneOfPredicate | FieldLTPredicate | FieldGTPredicate | FieldLTEPredicate | FieldGTEPredicate | FieldValidPredicate | SelectionPredicate | string; -export declare type FieldPredicate = FieldEqualPredicate | FieldLTPredicate | FieldGTPredicate | FieldLTEPredicate | FieldGTEPredicate | FieldRangePredicate | FieldOneOfPredicate | FieldValidPredicate; -export interface SelectionPredicate { - /** - * Filter using a selection name or a logical composition of selection names. - */ - selection: LogicalComposition; -} -export declare function isSelectionPredicate(predicate: LogicalComposition): predicate is SelectionPredicate; -export interface FieldPredicateBase { - /** - * Time unit for the field to be tested. - */ - timeUnit?: TimeUnit | TimeUnitParams; - /** - * Field to be tested. - */ - field: FieldName; -} -export interface FieldEqualPredicate extends FieldPredicateBase { - /** - * The value that the field should be equal to. - */ - equal: string | number | boolean | DateTime | SignalRef; -} -export declare function isFieldEqualPredicate(predicate: any): predicate is FieldEqualPredicate; -export interface FieldLTPredicate extends FieldPredicateBase { - /** - * The value that the field should be less than. - */ - lt: string | number | DateTime | SignalRef; -} -export declare function isFieldLTPredicate(predicate: any): predicate is FieldLTPredicate; -export interface FieldLTEPredicate extends FieldPredicateBase { - /** - * The value that the field should be less than or equals to. - */ - lte: string | number | DateTime | SignalRef; -} -export declare function isFieldLTEPredicate(predicate: any): predicate is FieldLTEPredicate; -export interface FieldGTPredicate extends FieldPredicateBase { - /** - * The value that the field should be greater than. - */ - gt: string | number | DateTime | SignalRef; -} -export declare function isFieldGTPredicate(predicate: any): predicate is FieldGTPredicate; -export interface FieldGTEPredicate extends FieldPredicateBase { - /** - * The value that the field should be greater than or equals to. - */ - gte: string | number | DateTime | SignalRef; -} -export declare function isFieldGTEPredicate(predicate: any): predicate is FieldGTEPredicate; -export interface FieldRangePredicate extends FieldPredicateBase { - /** - * An array of inclusive minimum and maximum values - * for a field value of a data item to be included in the filtered data. - * @maxItems 2 - * @minItems 2 - */ - range: (number | DateTime | null | SignalRef)[] | SignalRef; -} -export declare function isFieldRangePredicate(predicate: any): predicate is FieldRangePredicate; -export interface FieldOneOfPredicate extends FieldPredicateBase { - /** - * A set of values that the `field`'s value should be a member of, - * for a data item included in the filtered data. - */ - oneOf: string[] | number[] | boolean[] | DateTime[]; -} -export interface FieldValidPredicate extends FieldPredicateBase { - /** - * If set to true the field's value has to be valid, meaning both not `null` and not [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN). - */ - valid: boolean; -} -export declare function isFieldOneOfPredicate(predicate: any): predicate is FieldOneOfPredicate; -export declare function isFieldValidPredicate(predicate: any): predicate is FieldValidPredicate; -export declare function isFieldPredicate(predicate: Predicate): predicate is FieldOneOfPredicate | FieldEqualPredicate | FieldRangePredicate | FieldLTPredicate | FieldGTPredicate | FieldLTEPredicate | FieldGTEPredicate; -export declare function fieldFilterExpression(predicate: FieldPredicate, useInRange?: boolean): string; -export declare function fieldValidPredicate(fieldExpr: string, valid?: boolean): string; -export declare function normalizePredicate(f: Predicate): Predicate; -//# sourceMappingURL=predicate.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/predicate.d.ts.map b/node_modules/vega-lite/build/src/predicate.d.ts.map deleted file mode 100644 index ab4b23f..0000000 --- a/node_modules/vega-lite/build/src/predicate.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../src/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAqB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAoD,QAAQ,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAGvG,oBAAY,SAAS,GAGjB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GAE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S,EAAE,MAAM,EAAE,KAAK,UAAO,UAMlE;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,CAQ1D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/predicate.js b/node_modules/vega-lite/build/src/predicate.js deleted file mode 100644 index 4bce044..0000000 --- a/node_modules/vega-lite/build/src/predicate.js +++ /dev/null @@ -1,132 +0,0 @@ -import { isArray } from 'vega-util'; -import { valueExpr, vgField } from './channeldef'; -import { fieldExpr as timeUnitFieldExpr, normalizeTimeUnit } from './timeunit'; -import { isSignalRef } from './vega.schema'; -export function isSelectionPredicate(predicate) { - return predicate === null || predicate === void 0 ? void 0 : predicate['selection']; -} -export function isFieldEqualPredicate(predicate) { - return predicate && !!predicate.field && predicate.equal !== undefined; -} -export function isFieldLTPredicate(predicate) { - return predicate && !!predicate.field && predicate.lt !== undefined; -} -export function isFieldLTEPredicate(predicate) { - return predicate && !!predicate.field && predicate.lte !== undefined; -} -export function isFieldGTPredicate(predicate) { - return predicate && !!predicate.field && predicate.gt !== undefined; -} -export function isFieldGTEPredicate(predicate) { - return predicate && !!predicate.field && predicate.gte !== undefined; -} -export function isFieldRangePredicate(predicate) { - if (predicate && predicate.field) { - if (isArray(predicate.range) && predicate.range.length === 2) { - return true; - } - else if (isSignalRef(predicate.range)) { - return true; - } - } - return false; -} -export function isFieldOneOfPredicate(predicate) { - return (predicate && !!predicate.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility - ); -} -export function isFieldValidPredicate(predicate) { - return predicate && !!predicate.field && predicate.valid !== undefined; -} -export function isFieldPredicate(predicate) { - return (isFieldOneOfPredicate(predicate) || - isFieldEqualPredicate(predicate) || - isFieldRangePredicate(predicate) || - isFieldLTPredicate(predicate) || - isFieldGTPredicate(predicate) || - isFieldLTEPredicate(predicate) || - isFieldGTEPredicate(predicate)); -} -function predicateValueExpr(v, timeUnit) { - return valueExpr(v, { timeUnit, wrapTime: true }); -} -function predicateValuesExpr(vals, timeUnit) { - return vals.map(v => predicateValueExpr(v, timeUnit)); -} -// This method is used by Voyager. Do not change its behavior without changing Voyager. -export function fieldFilterExpression(predicate, useInRange = true) { - var _a; - const { field } = predicate; - const timeUnit = (_a = normalizeTimeUnit(predicate.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit; - const fieldExpr = timeUnit - ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly. - // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline - // TODO: support utc - 'time(' + timeUnitFieldExpr(timeUnit, field) + ')' - : vgField(predicate, { expr: 'datum' }); - if (isFieldEqualPredicate(predicate)) { - return fieldExpr + '===' + predicateValueExpr(predicate.equal, timeUnit); - } - else if (isFieldLTPredicate(predicate)) { - const upper = predicate.lt; - return `${fieldExpr}<${predicateValueExpr(upper, timeUnit)}`; - } - else if (isFieldGTPredicate(predicate)) { - const lower = predicate.gt; - return `${fieldExpr}>${predicateValueExpr(lower, timeUnit)}`; - } - else if (isFieldLTEPredicate(predicate)) { - const upper = predicate.lte; - return `${fieldExpr}<=${predicateValueExpr(upper, timeUnit)}`; - } - else if (isFieldGTEPredicate(predicate)) { - const lower = predicate.gte; - return `${fieldExpr}>=${predicateValueExpr(lower, timeUnit)}`; - } - else if (isFieldOneOfPredicate(predicate)) { - return `indexof([${predicateValuesExpr(predicate.oneOf, timeUnit).join(',')}], ${fieldExpr}) !== -1`; - } - else if (isFieldValidPredicate(predicate)) { - return fieldValidPredicate(fieldExpr, predicate.valid); - } - else if (isFieldRangePredicate(predicate)) { - const { range } = predicate; - const lower = isSignalRef(range) ? { signal: `${range.signal}[0]` } : range[0]; - const upper = isSignalRef(range) ? { signal: `${range.signal}[1]` } : range[1]; - if (lower !== null && upper !== null && useInRange) { - return ('inrange(' + - fieldExpr + - ', [' + - predicateValueExpr(lower, timeUnit) + - ', ' + - predicateValueExpr(upper, timeUnit) + - '])'); - } - const exprs = []; - if (lower !== null) { - exprs.push(`${fieldExpr} >= ${predicateValueExpr(lower, timeUnit)}`); - } - if (upper !== null) { - exprs.push(`${fieldExpr} <= ${predicateValueExpr(upper, timeUnit)}`); - } - return exprs.length > 0 ? exprs.join(' && ') : 'true'; - } - /* istanbul ignore next: it should never reach here */ - throw new Error(`Invalid field predicate: ${JSON.stringify(predicate)}`); -} -export function fieldValidPredicate(fieldExpr, valid = true) { - if (valid) { - return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`; - } - else { - return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`; - } -} -export function normalizePredicate(f) { - var _a; - if (isFieldPredicate(f) && f.timeUnit) { - return Object.assign(Object.assign({}, f), { timeUnit: (_a = normalizeTimeUnit(f.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit }); - } - return f; -} -//# sourceMappingURL=predicate.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/predicate.js.map b/node_modules/vega-lite/build/src/predicate.js.map deleted file mode 100644 index 2414d44..0000000 --- a/node_modules/vega-lite/build/src/predicate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"predicate.js","sourceRoot":"","sources":["../../src/predicate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAY,SAAS,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AAG3D,OAAO,EAAC,SAAS,IAAI,iBAAiB,EAAE,iBAAiB,EAA2B,MAAM,YAAY,CAAC;AACvG,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAmC1C,MAAM,UAAU,oBAAoB,CAAC,SAAwC;IAC3E,OAAO,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,WAAW,EAAE;AAClC,CAAC;AAuBD,MAAM,UAAU,qBAAqB,CAAC,SAAc;IAClD,OAAO,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC;AACzE,CAAC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AAW,SAAS,kBAAkB,SAAS,GAAG,CAAC;KAC3D;SAAM;QACL,OAAO,YAAY,SAAS,mBAAmB,SAAS,GAAG,CAAC;KAC7D;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,CAAY;;IAC7C,IAAI,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACrC,uCACK,CAAC,KACJ,QAAQ,QAAE,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,0CAAE,IAAI,IAC7C;KACH;IACD,OAAO,CAAC,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/projection.d.ts b/node_modules/vega-lite/build/src/projection.d.ts deleted file mode 100644 index 113001e..0000000 --- a/node_modules/vega-lite/build/src/projection.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { BaseProjection, SignalRef, Vector2 } from 'vega'; -import { ProjectionType } from './vega.schema'; -export interface Projection extends BaseProjection { - /** - * The cartographic projection to use. This value is case-insensitive, for example `"albers"` and `"Albers"` indicate the same projection type. You can find all valid projection types [in the documentation](https://vega.github.io/vega-lite/docs/projection.html#projection-types). - * - * __Default value:__ `mercator` - */ - type?: ProjectionType | SignalRef; - /** - * The projection’s scale (zoom) factor, overriding automatic fitting. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections. - */ - scale?: number | SignalRef; - /** - * The projection’s translation offset as a two-element array `[tx, ty]`. - */ - translate?: Vector2 | SignalRef; -} -/** - * Any property of Projection can be in config - */ -export declare type ProjectionConfig = Projection; -export declare const PROJECTION_PROPERTIES: (keyof Projection)[]; -//# sourceMappingURL=projection.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/projection.d.ts.map b/node_modules/vega-lite/build/src/projection.d.ts.map deleted file mode 100644 index f3bf2b6..0000000 --- a/node_modules/vega-lite/build/src/projection.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,SAAS,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AACxD,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAE7C,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAElC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CACzC;AAED;;GAEG;AACH,oBAAY,gBAAgB,GAAG,UAAU,CAAC;AAE1C,eAAO,MAAM,qBAAqB,EAAE,CAAC,MAAM,UAAU,CAAC,EAkBrD,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/projection.js b/node_modules/vega-lite/build/src/projection.js deleted file mode 100644 index 7c8dd2b..0000000 --- a/node_modules/vega-lite/build/src/projection.js +++ /dev/null @@ -1,20 +0,0 @@ -export const PROJECTION_PROPERTIES = [ - 'type', - 'clipAngle', - 'clipExtent', - 'center', - 'rotate', - 'precision', - 'reflectX', - 'reflectY', - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' -]; -//# sourceMappingURL=projection.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/projection.js.map b/node_modules/vega-lite/build/src/projection.js.map deleted file mode 100644 index 46cb726..0000000 --- a/node_modules/vega-lite/build/src/projection.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../src/projection.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAC,MAAM,qBAAqB,GAAyB;IACzD,MAAM;IACN,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,UAAU;IACV,UAAU;IACV,aAAa;IACb,UAAU;IACV,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;IACR,OAAO;IACP,SAAS;IACT,MAAM;CACP,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/resolve.d.ts b/node_modules/vega-lite/build/src/resolve.d.ts deleted file mode 100644 index 6e7f7b6..0000000 --- a/node_modules/vega-lite/build/src/resolve.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NonPositionScaleChannel, PositionScaleChannel, ScaleChannel } from './channel'; -export declare type ResolveMode = 'independent' | 'shared'; -/** - * Defines how scales, axes, and legends from different specs should be combined. Resolve is a mapping from `scale`, `axis`, and `legend` to a mapping from channels to resolutions. Scales and guides can be resolved to be `"independent"` or `"shared"`. - */ -export interface Resolve { - scale?: ScaleResolveMap; - axis?: AxisResolveMap; - legend?: LegendResolveMap; -} -export declare type ScaleResolveMap = Partial>; -export declare type AxisResolveMap = Partial>; -export declare type LegendResolveMap = Partial>; -//# sourceMappingURL=resolve.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/resolve.d.ts.map b/node_modules/vega-lite/build/src/resolve.d.ts.map deleted file mode 100644 index bdcd345..0000000 --- a/node_modules/vega-lite/build/src/resolve.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAE,oBAAoB,EAAE,YAAY,EAAC,MAAM,WAAW,CAAC;AAEtF,oBAAY,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC;IAExB,IAAI,CAAC,EAAE,cAAc,CAAC;IAEtB,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED,oBAAY,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAEzE,oBAAY,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC,CAAC;AAEhF,oBAAY,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/resolve.js b/node_modules/vega-lite/build/src/resolve.js deleted file mode 100644 index 082a6f5..0000000 --- a/node_modules/vega-lite/build/src/resolve.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/resolve.js.map b/node_modules/vega-lite/build/src/resolve.js.map deleted file mode 100644 index a01bd82..0000000 --- a/node_modules/vega-lite/build/src/resolve.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/resolve.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/scale.d.ts b/node_modules/vega-lite/build/src/scale.d.ts deleted file mode 100644 index 5095721..0000000 --- a/node_modules/vega-lite/build/src/scale.d.ts +++ /dev/null @@ -1,458 +0,0 @@ -import { RangeEnum, ScaleBins, ScaleInterpolateEnum, ScaleInterpolateParams, SignalRef, TimeInterval, TimeIntervalStep } from 'vega'; -import { Channel } from './channel'; -import { DateTime } from './datetime'; -import { SelectionExtent } from './selection'; -import { Type } from './type'; -export declare const ScaleType: { - readonly LINEAR: "linear"; - readonly LOG: "log"; - readonly POW: "pow"; - readonly SQRT: "sqrt"; - readonly SYMLOG: "symlog"; - readonly IDENTITY: "identity"; - readonly SEQUENTIAL: "sequential"; - readonly TIME: "time"; - readonly UTC: "utc"; - readonly QUANTILE: "quantile"; - readonly QUANTIZE: "quantize"; - readonly THRESHOLD: "threshold"; - readonly BIN_ORDINAL: "bin-ordinal"; - readonly ORDINAL: "ordinal"; - readonly POINT: "point"; - readonly BAND: "band"; -}; -declare type ValueOf = T[keyof T]; -export declare type ScaleType = ValueOf; -/** - * Index for scale categories -- only scale of the same categories can be merged together. - * Current implementation is trying to be conservative and avoid merging scale type that might not work together - */ -export declare const SCALE_CATEGORY_INDEX: Record; -export declare const SCALE_TYPES: import("vega").ScaleType[]; -/** - * Whether the two given scale types can be merged together. - */ -export declare function scaleCompatible(scaleType1: ScaleType, scaleType2: ScaleType): boolean; -/** - * Return scale categories -- only scale of the same categories can be merged together. - */ -export declare function scaleTypePrecedence(scaleType: ScaleType): number; -export declare const CONTINUOUS_TO_CONTINUOUS_SCALES: ScaleType[]; -export declare const QUANTITATIVE_SCALES: ScaleType[]; -export declare function isQuantitative(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog'; -export declare const CONTINUOUS_TO_DISCRETE_SCALES: ScaleType[]; -export declare const CONTINUOUS_DOMAIN_SCALES: ScaleType[]; -export declare const DISCRETE_DOMAIN_SCALES: ScaleType[]; -export declare const TIME_SCALE_TYPES: ScaleType[]; -export declare function hasDiscreteDomain(type: ScaleType): type is 'ordinal' | 'bin-ordinal' | 'point' | 'band'; -export declare function hasContinuousDomain(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' | 'quantile' | 'quantize' | 'threshold'; -export declare function isContinuousToContinuous(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc'; -export declare function isContinuousToDiscrete(type: ScaleType): type is 'quantile' | 'quantize' | 'threshold'; -export interface ScaleConfig { - /** - * If true, rounds numeric output values to integers. - * This can be helpful for snapping to the pixel grid. - * (Only available for `x`, `y`, and `size` scales.) - */ - round?: boolean | SignalRef; - /** - * If true, values that exceed the data domain are clamped to either the minimum or maximum range value - */ - clamp?: boolean | SignalRef; - /** - * Default inner padding for `x` and `y` band-ordinal scales. - * - * __Default value:__ - * - `barBandPaddingInner` for bar marks (`0.1` by default) - * - `rectBandPaddingInner` for rect and other marks (`0` by default) - * - * @minimum 0 - * @maximum 1 - */ - bandPaddingInner?: number | SignalRef; - /** - * Default outer padding for `x` and `y` band-ordinal scales. - * - * __Default value:__ `paddingInner/2` (which makes _width/height = number of unique values * step_) - * - * @minimum 0 - * @maximum 1 - */ - bandPaddingOuter?: number | SignalRef; - /** - * Default inner padding for `x` and `y` band-ordinal scales of `"bar"` marks. - * - * __Default value:__ `0.1` - * - * @minimum 0 - * @maximum 1 - */ - barBandPaddingInner?: number | SignalRef; - /** - * Default inner padding for `x` and `y` band-ordinal scales of `"rect"` marks. - * - * __Default value:__ `0` - * - * @minimum 0 - * @maximum 1 - */ - rectBandPaddingInner?: number | SignalRef; - /** - * Default padding for continuous scales. - * - * __Default:__ `5` for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.; `0` otherwise. - * - * @minimum 0 - */ - continuousPadding?: number | SignalRef; - /** - * Default outer padding for `x` and `y` point-ordinal scales. - * - * __Default value:__ `0.5` (which makes _width/height = number of unique values * step_) - * - * @minimum 0 - * @maximum 1 - */ - pointPadding?: number | SignalRef; - /** - * Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis. - * - * This is equivalent to setting `domain` to `"unaggregate"` for aggregated _quantitative_ fields by default. - * - * This property only works with aggregate functions that produce values within the raw data domain (`"mean"`, `"average"`, `"median"`, `"q1"`, `"q3"`, `"min"`, `"max"`). For other aggregations that produce values outside of the raw data domain (e.g. `"count"`, `"sum"`), this property is ignored. - * - * __Default value:__ `false` - */ - useUnaggregatedDomain?: boolean; - /** - * The default max value for mapping quantitative fields to bar's size/bandSize. - * - * If undefined (default), we will use the axis's size (width or height) - 1. - * @minimum 0 - */ - maxBandSize?: number; - /** - * The default min value for mapping quantitative fields to bar and tick's size/bandSize scale with zero=false. - * - * __Default value:__ `2` - * - * @minimum 0 - */ - minBandSize?: number; - /** - * The default max value for mapping quantitative fields to text's size/fontSize. - * - * __Default value:__ `40` - * - * @minimum 0 - */ - maxFontSize?: number; - /** - * The default min value for mapping quantitative fields to tick's size/fontSize scale with zero=false - * - * __Default value:__ `8` - * - * @minimum 0 - */ - minFontSize?: number; - /** - * Default minimum opacity for mapping a field to opacity. - * - * __Default value:__ `0.3` - * - * @minimum 0 - * @maximum 1 - */ - minOpacity?: number; - /** - * Default max opacity for mapping a field to opacity. - * - * __Default value:__ `0.8` - * - * @minimum 0 - * @maximum 1 - */ - maxOpacity?: number; - /** - * Default minimum value for point size scale with zero=false. - * - * __Default value:__ `9` - * - * @minimum 0 - */ - minSize?: number; - /** - * Default max value for point size scale. - * @minimum 0 - */ - maxSize?: number; - /** - * Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks with zero=false. - * - * __Default value:__ `1` - * - * @minimum 0 - */ - minStrokeWidth?: number; - /** - * Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks. - * - * __Default value:__ `4` - * - * @minimum 0 - */ - maxStrokeWidth?: number; - /** - * Default range cardinality for [`quantile`](https://vega.github.io/vega-lite/docs/scale.html#quantile) scale. - * - * __Default value:__ `4` - * - * @minimum 0 - */ - quantileCount?: number; - /** - * Default range cardinality for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale. - * - * __Default value:__ `4` - * - * @minimum 0 - */ - quantizeCount?: number; - /** - * Reverse x-scale by default (useful for right-to-left charts). - */ - xReverse?: boolean | SignalRef; -} -export declare const defaultScaleConfig: ScaleConfig; -export interface SchemeParams { - /** - * A color scheme name for ordinal scales (e.g., `"category10"` or `"blues"`). - * - * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference. - */ - name: string | SignalRef; - /** - * The extent of the color range to use. For example `[0.2, 1]` will rescale the color scheme such that color values in the range _[0, 0.2)_ are excluded from the scheme. - */ - extent?: (number | SignalRef)[] | SignalRef; - /** - * The number of colors to use in the scheme. This can be useful for scale types such as `"quantize"`, which use the length of the scale range to determine the number of discrete bins for the scale domain. - */ - count?: number | SignalRef; -} -export declare type Domain = (null | string | number | boolean | DateTime | SignalRef)[] | 'unaggregated' | SelectionExtent | SignalRef | DomainUnionWith; -export declare type Scheme = string | SchemeParams; -export declare function isExtendedScheme(scheme: Scheme | SignalRef): scheme is SchemeParams; -export declare function isSelectionDomain(domain: Domain): domain is SelectionExtent; -export interface DomainUnionWith { - /** - * Customized domain values to be union with the field's values. - * - * 1) `domain` for _quantitative_ fields can take one of the following forms: - * - * - a two-element array with minimum and maximum values. - * - an array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). (Alternatively, the `domainMid` property can be set for a diverging scale.) - * - a string value `"unaggregated"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation. - * - * 2) `domain` for _temporal_ fields can be a two-element array minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime). - * - * 3) `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values. - */ - unionWith: number[] | string[] | boolean[] | DateTime[]; -} -export declare function isDomainUnionWith(domain: Domain): domain is DomainUnionWith; -export interface Scale { - /** - * The type of scale. Vega-Lite supports the following categories of scale types: - * - * 1) [**Continuous Scales**](https://vega.github.io/vega-lite/docs/scale.html#continuous) -- mapping continuous domains to continuous output ranges ([`"linear"`](https://vega.github.io/vega-lite/docs/scale.html#linear), [`"pow"`](https://vega.github.io/vega-lite/docs/scale.html#pow), [`"sqrt"`](https://vega.github.io/vega-lite/docs/scale.html#sqrt), [`"symlog"`](https://vega.github.io/vega-lite/docs/scale.html#symlog), [`"log"`](https://vega.github.io/vega-lite/docs/scale.html#log), [`"time"`](https://vega.github.io/vega-lite/docs/scale.html#time), [`"utc"`](https://vega.github.io/vega-lite/docs/scale.html#utc). - * - * 2) [**Discrete Scales**](https://vega.github.io/vega-lite/docs/scale.html#discrete) -- mapping discrete domains to discrete ([`"ordinal"`](https://vega.github.io/vega-lite/docs/scale.html#ordinal)) or continuous ([`"band"`](https://vega.github.io/vega-lite/docs/scale.html#band) and [`"point"`](https://vega.github.io/vega-lite/docs/scale.html#point)) output ranges. - * - * 3) [**Discretizing Scales**](https://vega.github.io/vega-lite/docs/scale.html#discretizing) -- mapping continuous domains to discrete output ranges [`"bin-ordinal"`](https://vega.github.io/vega-lite/docs/scale.html#bin-ordinal), [`"quantile"`](https://vega.github.io/vega-lite/docs/scale.html#quantile), [`"quantize"`](https://vega.github.io/vega-lite/docs/scale.html#quantize) and [`"threshold"`](https://vega.github.io/vega-lite/docs/scale.html#threshold). - * - * __Default value:__ please see the [scale type table](https://vega.github.io/vega-lite/docs/scale.html#type). - */ - type?: ScaleType; - /** - * Customized domain values in the form of constant values or dynamic values driven by a selection. - * - * 1) Constant `domain` for _quantitative_ fields can take one of the following forms: - * - * - A two-element array with minimum and maximum values. To create a diverging scale, this two-element array can be combined with the `domainMid` property. - * - An array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). - * - A string value `"unaggregated"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation. - * - * 2) Constant `domain` for _temporal_ fields can be a two-element array with minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime). - * - * 3) Constant `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values. - * - * 4) To combine (union) specified constant domain with the field's values, `domain` can be an object with a `unionWith` property that specify constant domain to be combined. For example, `domain: {unionWith: [0, 100]}` for a quantitative scale means that the scale domain always includes `[0, 100]`, but will include other values in the fields beyond `[0, 100]`. - * - * 5) Domain can also takes an object defining a field or encoding of a selection that [interactively determines](https://vega.github.io/vega-lite/docs/selection.html#scale-domains) the scale domain. - */ - domain?: (null | string | number | boolean | DateTime | SignalRef)[] | 'unaggregated' | SelectionExtent | DomainUnionWith | SignalRef; - /** - * Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint for [diverging color scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). The domainMid property is only intended for use with scales supporting continuous, piecewise domains. - */ - domainMid?: number | SignalRef; - /** - * Sets the maximum value in the scale domain, overriding the `domain` property. This property is only intended for use with scales having continuous domains. - */ - domainMax?: number | DateTime | SignalRef; - /** - * Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains. - */ - domainMin?: number | DateTime | SignalRef; - /** - * If true, reverses the order of the scale range. - * __Default value:__ `false`. - */ - reverse?: boolean | SignalRef; - /** - * The range of the scale. One of: - * - * - A string indicating a [pre-defined named scale range](https://vega.github.io/vega-lite/docs/scale.html#range-config) (e.g., example, `"symbol"`, or `"diverging"`). - * - * - For [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous), two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a [piecewise scale](https://vega.github.io/vega-lite/docs/scale.html#piecewise). - * - * - For [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) and [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales, an array of desired output values or an object with a `field` property representing the range values. For example, if a field `color` contains CSS color names, we can set `range` to `{field: "color"}`. - * - * __Notes:__ - * - * 1) For color scales you can also specify a color [`scheme`](https://vega.github.io/vega-lite/docs/scale.html#scheme) instead of `range`. - * - * 2) Any directly specified `range` for `x` and `y` channels will be ignored. Range can be customized via the view's corresponding [size](https://vega.github.io/vega-lite/docs/size.html) (`width` and `height`). - */ - range?: RangeEnum | (number | string | number[] | SignalRef)[] | { - field: string; - }; - /** - * Sets the maximum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges. - */ - rangeMax?: number | string | SignalRef; - /** - * Sets the minimum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges. - */ - rangeMin?: number | string | SignalRef; - /** - * A string indicating a color [scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme) name (e.g., `"category10"` or `"blues"`) or a [scheme parameter object](https://vega.github.io/vega-lite/docs/scale.html#scheme-params). - * - * Discrete color schemes may be used with [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) or [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales. Continuous color schemes are intended for use with color scales. - * - * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference. - */ - scheme?: string | SchemeParams | SignalRef; - /** - * The alignment of the steps within the scale range. - * - * This value must lie in the range `[0,1]`. A value of `0.5` indicates that the steps should be centered within the range. A value of `0` or `1` may be used to shift the bands to one side, say to position them adjacent to an axis. - * - * __Default value:__ `0.5` - */ - align?: number | SignalRef; - /** - * Bin boundaries can be provided to scales as either an explicit array of bin boundaries or as a bin specification object. The legal values are: - * - An [array](../types/#Array) literal of bin boundary values. For example, `[0, 5, 10, 15, 20]`. The array must include both starting and ending boundaries. The previous example uses five values to indicate a total of four bin intervals: [0-5), [5-10), [10-15), [15-20]. Array literals may include signal references as elements. - * - A [bin specification object](https://vega.github.io/vega-lite/docs/scale.html#bins) that indicates the bin _step_ size, and optionally the _start_ and _stop_ boundaries. - * - An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels. - */ - bins?: ScaleBins; - /** - * If `true`, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid. - * - * __Default value:__ `false`. - */ - round?: boolean | SignalRef; - /** - * For _[continuous](https://vega.github.io/vega-lite/docs/scale.html#continuous)_ scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the `zero`, `nice`, `domainMin`, and `domainMax` properties. - * - * For _[band](https://vega.github.io/vega-lite/docs/scale.html#band)_ scales, shortcut for setting `paddingInner` and `paddingOuter` to the same value. - * - * For _[point](https://vega.github.io/vega-lite/docs/scale.html#point)_ scales, alias for `paddingOuter`. - * - * __Default value:__ For _continuous_ scales, derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `continuousPadding`. - * For _band and point_ scales, see `paddingInner` and `paddingOuter`. By default, Vega-Lite sets padding such that _width/height = number of unique values * step_. - * - * @minimum 0 - */ - padding?: number | SignalRef; - /** - * The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1]. - * - * For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands). - * - * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingInner`. - * - * @minimum 0 - * @maximum 1 - */ - paddingInner?: number | SignalRef; - /** - * The outer padding (spacing) at the ends of the range of band and point scales, - * as a fraction of the step size. This value must lie in the range [0,1]. - * - * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingOuter` for band scales and `pointPadding` for point scales. - * By default, Vega-Lite sets outer padding such that _width/height = number of unique values * step_. - * - * @minimum 0 - * @maximum 1 - */ - paddingOuter?: number | SignalRef; - /** - * If `true`, values that exceed the data domain are clamped to either the minimum or maximum range value - * - * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/config.html#scale-config)'s `clamp` (`true` by default). - */ - clamp?: boolean | SignalRef; - /** - * Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of _[0.201479…, 0.996679…]_, a nice domain might be _[0.2, 1.0]_. - * - * For quantitative scales such as linear, `nice` can be either a boolean flag or a number. If `nice` is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain. - * - * For temporal fields with time and utc scales, the `nice` value can be a string indicating the desired time interval. Legal values are `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and `"year"`. Alternatively, `time` and `utc` scales can accept an object-valued interval specifier of the form `{"interval": "month", "step": 3}`, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries. - * - * __Default value:__ `true` for unbinned _quantitative_ fields; `false` otherwise. - * - */ - nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef; - /** - * The logarithm base of the `log` scale (default `10`). - */ - base?: number | SignalRef; - /** - * The exponent of the `pow` scale. - */ - exponent?: number | SignalRef; - /** - * A constant determining the slope of the symlog function around zero. Only used for `symlog` scales. - * - * __Default value:__ `1` - */ - constant?: number | SignalRef; - /** - * If `true`, ensures that a zero baseline value is included in the scale domain. - * - * __Default value:__ `true` for x and y channels if the quantitative field is not binned and no custom `domain` is provided; `false` otherwise. - * - * __Note:__ Log, time, and utc scales do not support `zero`. - */ - zero?: boolean | SignalRef; - /** - * The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include `rgb`, `hsl`, `hsl-long`, `lab`, `hcl`, `hcl-long`, `cubehelix` and `cubehelix-long` ('-long' variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued _type_ property and an optional numeric _gamma_ property applicable to rgb and cubehelix interpolators. For more, see the [d3-interpolate documentation](https://github.com/d3/d3-interpolate). - * - * * __Default value:__ `hcl` - */ - interpolate?: ScaleInterpolateEnum | SignalRef | ScaleInterpolateParams; -} -export declare const SCALE_PROPERTIES: ("padding" | "round" | "type" | "range" | "zero" | "base" | "nice" | "domain" | "domainMin" | "domainMax" | "domainMid" | "reverse" | "bins" | "interpolate" | "clamp" | "constant" | "exponent" | "paddingInner" | "paddingOuter" | "align" | "rangeMax" | "rangeMin" | "scheme")[]; -export declare const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES: ("padding" | "round" | "zero" | "base" | "nice" | "domainMin" | "domainMax" | "domainMid" | "reverse" | "bins" | "interpolate" | "clamp" | "constant" | "exponent" | "paddingInner" | "paddingOuter" | "align")[]; -export declare function scaleTypeSupportProperty(scaleType: ScaleType, propName: keyof Scale): boolean; -/** - * Returns undefined if the input channel supports the input scale property name - */ -export declare function channelScalePropertyIncompatability(channel: Channel, propName: keyof Scale): string; -export declare function scaleTypeSupportDataType(specifiedType: ScaleType, fieldDefType: Type): boolean; -export declare function channelSupportScaleType(channel: Channel, scaleType: ScaleType): boolean; -export {}; -//# sourceMappingURL=scale.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/scale.d.ts.map b/node_modules/vega-lite/build/src/scale.d.ts.map deleted file mode 100644 index 1cd5ad3..0000000 --- a/node_modules/vega-lite/build/src/scale.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scale.d.ts","sourceRoot":"","sources":["../../src/scale.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,gBAAgB,EACjB,MAAM,MAAM,CAAC;AAGd,OAAO,EAAC,OAAO,EAAiB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAA2C,IAAI,EAAC,MAAM,QAAQ,CAAC;AAGtE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAyBZ,CAAC;AAEX,aAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7B,oBAAY,SAAS,GAAG,OAAO,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,kBAAkB,GAAG,cAAc,CAiB/G,CAAC;AAEF,eAAO,MAAM,WAAW,4BAA4C,CAAC;AAErE;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,WAQ3E;AA4BD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAEhE;AAED,eAAO,MAAM,+BAA+B,EAAE,SAAS,EAA8D,CAAC;AAGtH,eAAO,MAAM,mBAAmB,EAAE,SAAS,EAA+C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B,GAAG,SAAS,GAAG,sBAAsB,CAAC;CACzE;AAgCD,eAAO,MAAM,gBAAgB,sRAA6B,CAAC;AAY3D,eAAO,MAAM,2CAA2C,mNAAwD,CAAC;AAEjH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,KAAK,GAAG,OAAO,CAmD7F;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,GAAG,MAAM,CA+BnG;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAuB9F;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAgCvF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/scale.js b/node_modules/vega-lite/build/src/scale.js deleted file mode 100644 index 06efb9b..0000000 --- a/node_modules/vega-lite/build/src/scale.js +++ /dev/null @@ -1,318 +0,0 @@ -import { __rest } from "tslib"; -import { isString, toSet } from 'vega-util'; -import * as CHANNEL from './channel'; -import { isColorChannel } from './channel'; -import * as log from './log'; -import { NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL } from './type'; -import { contains, keys } from './util'; -export const ScaleType = { - // Continuous - Quantitative - LINEAR: 'linear', - LOG: 'log', - POW: 'pow', - SQRT: 'sqrt', - SYMLOG: 'symlog', - IDENTITY: 'identity', - SEQUENTIAL: 'sequential', - // Continuous - Time - TIME: 'time', - UTC: 'utc', - // Discretizing scales - QUANTILE: 'quantile', - QUANTIZE: 'quantize', - THRESHOLD: 'threshold', - BIN_ORDINAL: 'bin-ordinal', - // Discrete scales - ORDINAL: 'ordinal', - POINT: 'point', - BAND: 'band' -}; -/** - * Index for scale categories -- only scale of the same categories can be merged together. - * Current implementation is trying to be conservative and avoid merging scale type that might not work together - */ -export const SCALE_CATEGORY_INDEX = { - linear: 'numeric', - log: 'numeric', - pow: 'numeric', - sqrt: 'numeric', - symlog: 'numeric', - identity: 'numeric', - sequential: 'numeric', - time: 'time', - utc: 'time', - ordinal: 'ordinal', - 'bin-ordinal': 'bin-ordinal', - point: 'ordinal-position', - band: 'ordinal-position', - quantile: 'discretizing', - quantize: 'discretizing', - threshold: 'discretizing' -}; -export const SCALE_TYPES = keys(SCALE_CATEGORY_INDEX); -/** - * Whether the two given scale types can be merged together. - */ -export function scaleCompatible(scaleType1, scaleType2) { - const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1]; - const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2]; - return (scaleCategory1 === scaleCategory2 || - (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') || - (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time')); -} -/** - * Index for scale precedence -- high score = higher priority for merging. - */ -const SCALE_PRECEDENCE_INDEX = { - // numeric - linear: 0, - log: 1, - pow: 1, - sqrt: 1, - symlog: 1, - identity: 1, - sequential: 1, - // time - time: 0, - utc: 0, - // ordinal-position -- these have higher precedence than continuous scales as they support more types of data - point: 10, - band: 11, - // non grouped types - ordinal: 0, - 'bin-ordinal': 0, - quantile: 0, - quantize: 0, - threshold: 0 -}; -/** - * Return scale categories -- only scale of the same categories can be merged together. - */ -export function scaleTypePrecedence(scaleType) { - return SCALE_PRECEDENCE_INDEX[scaleType]; -} -export const CONTINUOUS_TO_CONTINUOUS_SCALES = ['linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc']; -const CONTINUOUS_TO_CONTINUOUS_INDEX = toSet(CONTINUOUS_TO_CONTINUOUS_SCALES); -export const QUANTITATIVE_SCALES = ['linear', 'log', 'pow', 'sqrt', 'symlog']; -const QUANTITATIVE_SCALES_INDEX = toSet(QUANTITATIVE_SCALES); -export function isQuantitative(type) { - return type in QUANTITATIVE_SCALES_INDEX; -} -export const CONTINUOUS_TO_DISCRETE_SCALES = ['quantile', 'quantize', 'threshold']; -const CONTINUOUS_TO_DISCRETE_INDEX = toSet(CONTINUOUS_TO_DISCRETE_SCALES); -export const CONTINUOUS_DOMAIN_SCALES = CONTINUOUS_TO_CONTINUOUS_SCALES.concat([ - 'quantile', - 'quantize', - 'threshold', - 'sequential', - 'identity' -]); -const CONTINUOUS_DOMAIN_INDEX = toSet(CONTINUOUS_DOMAIN_SCALES); -export const DISCRETE_DOMAIN_SCALES = ['ordinal', 'bin-ordinal', 'point', 'band']; -const DISCRETE_DOMAIN_INDEX = toSet(DISCRETE_DOMAIN_SCALES); -export const TIME_SCALE_TYPES = ['time', 'utc']; -export function hasDiscreteDomain(type) { - return type in DISCRETE_DOMAIN_INDEX; -} -export function hasContinuousDomain(type) { - return type in CONTINUOUS_DOMAIN_INDEX; -} -export function isContinuousToContinuous(type) { - return type in CONTINUOUS_TO_CONTINUOUS_INDEX; -} -export function isContinuousToDiscrete(type) { - return type in CONTINUOUS_TO_DISCRETE_INDEX; -} -export const defaultScaleConfig = { - pointPadding: 0.5, - barBandPaddingInner: 0.1, - rectBandPaddingInner: 0, - minBandSize: 2, - minFontSize: 8, - maxFontSize: 40, - minOpacity: 0.3, - maxOpacity: 0.8, - // FIXME: revise if these *can* become ratios of width/height step - minSize: 9, - minStrokeWidth: 1, - maxStrokeWidth: 4, - quantileCount: 4, - quantizeCount: 4 -}; -export function isExtendedScheme(scheme) { - return !isString(scheme) && !!scheme['name']; -} -export function isSelectionDomain(domain) { - return domain === null || domain === void 0 ? void 0 : domain['selection']; -} -export function isDomainUnionWith(domain) { - return domain && domain['unionWith']; -} -const SCALE_PROPERTY_INDEX = { - type: 1, - domain: 1, - domainMax: 1, - domainMin: 1, - domainMid: 1, - align: 1, - range: 1, - rangeMax: 1, - rangeMin: 1, - scheme: 1, - bins: 1, - // Other properties - reverse: 1, - round: 1, - // quantitative / time - clamp: 1, - nice: 1, - // quantitative - base: 1, - exponent: 1, - constant: 1, - interpolate: 1, - zero: 1, - // band/point - padding: 1, - paddingInner: 1, - paddingOuter: 1 -}; -export const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX); -const { type, domain, range, rangeMax, rangeMin, scheme } = SCALE_PROPERTY_INDEX, NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX = __rest(SCALE_PROPERTY_INDEX, ["type", "domain", "range", "rangeMax", "rangeMin", "scheme"]); -export const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX); -export function scaleTypeSupportProperty(scaleType, propName) { - switch (propName) { - case 'type': - case 'domain': - case 'reverse': - case 'range': - return true; - case 'scheme': - case 'interpolate': - return !contains(['point', 'band', 'identity'], scaleType); - case 'bins': - return !contains(['point', 'band', 'identity', 'ordinal'], scaleType); - case 'round': - return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point'; - case 'padding': - case 'rangeMin': - case 'rangeMax': - return isContinuousToContinuous(scaleType) || contains(['point', 'band'], scaleType); - case 'paddingOuter': - case 'align': - return contains(['point', 'band'], scaleType); - case 'paddingInner': - return scaleType === 'band'; - case 'domainMax': - case 'domainMid': - case 'domainMin': - case 'clamp': - return isContinuousToContinuous(scaleType); - case 'nice': - return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold'; - case 'exponent': - return scaleType === 'pow'; - case 'base': - return scaleType === 'log'; - case 'constant': - return scaleType === 'symlog'; - case 'zero': - return (hasContinuousDomain(scaleType) && - !contains([ - 'log', - 'time', - 'utc', - 'threshold', - 'quantile' // quantile depends on distribution so zero does not matter - ], scaleType)); - } -} -/** - * Returns undefined if the input channel supports the input scale property name - */ -export function channelScalePropertyIncompatability(channel, propName) { - switch (propName) { - case 'interpolate': - case 'scheme': - case 'domainMid': - if (!isColorChannel(channel)) { - return log.message.cannotUseScalePropertyWithNonColor(channel); - } - return undefined; - case 'align': - case 'type': - case 'bins': - case 'domain': - case 'domainMax': - case 'domainMin': - case 'range': - case 'base': - case 'exponent': - case 'constant': - case 'nice': - case 'padding': - case 'paddingInner': - case 'paddingOuter': - case 'rangeMax': - case 'rangeMin': - case 'reverse': - case 'round': - case 'clamp': - case 'zero': - return undefined; // GOOD! - } -} -export function scaleTypeSupportDataType(specifiedType, fieldDefType) { - if (contains([ORDINAL, NOMINAL], fieldDefType)) { - return specifiedType === undefined || hasDiscreteDomain(specifiedType); - } - else if (fieldDefType === TEMPORAL) { - return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType); - } - else if (fieldDefType === QUANTITATIVE) { - return contains([ - ScaleType.LOG, - ScaleType.POW, - ScaleType.SQRT, - ScaleType.SYMLOG, - ScaleType.QUANTILE, - ScaleType.QUANTIZE, - ScaleType.THRESHOLD, - ScaleType.LINEAR, - undefined - ], specifiedType); - } - return true; -} -export function channelSupportScaleType(channel, scaleType) { - if (!CHANNEL.isScaleChannel(channel)) { - return false; - } - switch (channel) { - case CHANNEL.X: - case CHANNEL.Y: - case CHANNEL.THETA: - case CHANNEL.RADIUS: - return isContinuousToContinuous(scaleType) || contains(['band', 'point'], scaleType); - case CHANNEL.SIZE: // TODO: size and opacity can support ordinal with more modification - case CHANNEL.STROKEWIDTH: - case CHANNEL.OPACITY: - case CHANNEL.FILLOPACITY: - case CHANNEL.STROKEOPACITY: - case CHANNEL.ANGLE: - // Although it generally doesn't make sense to use band with size and opacity, - // it can also work since we use band: 0.5 to get midpoint. - return (isContinuousToContinuous(scaleType) || - isContinuousToDiscrete(scaleType) || - contains(['band', 'point', 'ordinal'], scaleType)); - case CHANNEL.COLOR: - case CHANNEL.FILL: - case CHANNEL.STROKE: - return scaleType !== 'band'; // band does not make sense with color - case CHANNEL.STROKEDASH: - return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType); - case CHANNEL.SHAPE: - return scaleType === 'ordinal'; // shape = lookup only - } -} -//# sourceMappingURL=scale.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/scale.js.map b/node_modules/vega-lite/build/src/scale.js.map deleted file mode 100644 index 1dd756f..0000000 --- a/node_modules/vega-lite/build/src/scale.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scale.js","sourceRoot":"","sources":["../../src/scale.ts"],"names":[],"mappings":";AASA,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAU,cAAc,EAAC,MAAM,WAAW,CAAC;AAElD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAO,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAC,QAAQ,EAAQ,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,4BAA4B;IAC5B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAEhB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;IAExB,oBAAoB;IACpB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IAEV,sBAAsB;IACtB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAE1B,kBAAkB;IAClB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACJ,CAAC;AAKX;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAmF;IAClH,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,MAAM;IAC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AgB,EAAE,SAAoB;IAC5E,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;QACpC,OAAO,KAAK,CAAC;KACd;IACD,QAAQ,OAAO,EAAE;QACf,KAAK,OAAO,CAAC,CAAC,CAAC;QACf,KAAK,OAAO,CAAC,CAAC,CAAC;QACf,KAAK,OAAO,CAAC,KAAK,CAAC;QACnB,KAAK,OAAO,CAAC,MAAM;YACjB,OAAO,wBAAwB,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC;QACvF,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,oEAAoE;QACvF,KAAK,OAAO,CAAC,WAAW,CAAC;QACzB,KAAK,OAAO,CAAC,OAAO,CAAC;QACrB,KAAK,OAAO,CAAC,WAAW,CAAC;QACzB,KAAK,OAAO,CAAC,aAAa,CAAC;QAC3B,KAAK,OAAO,CAAC,KAAK;YAChB,8EAA8E;YAC9E,2DAA2D;YAC3D,OAAO,CACL,wBAAwB,CAAC,SAAS,CAAC;gBACnC,sBAAsB,CAAC,SAAS,CAAC;gBACjC,QAAQ,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,CAClD,CAAC;QACJ,KAAK,OAAO,CAAC,KAAK,CAAC;QACnB,KAAK,OAAO,CAAC,IAAI,CAAC;QAClB,KAAK,OAAO,CAAC,MAAM;YACjB,OAAO,SAAS,KAAK,MAAM,CAAC,CAAC,sCAAsC;QACrE,KAAK,OAAO,CAAC,UAAU;YACrB,OAAO,SAAS,KAAK,SAAS,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;QACtE,KAAK,OAAO,CAAC,KAAK;YAChB,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,sBAAsB;KACzD;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/selection.d.ts b/node_modules/vega-lite/build/src/selection.d.ts deleted file mode 100644 index 19943b6..0000000 --- a/node_modules/vega-lite/build/src/selection.d.ts +++ /dev/null @@ -1,281 +0,0 @@ -import { Binding, Color, Cursor, Stream, Vector2 } from 'vega'; -import { SingleDefUnitChannel } from './channel'; -import { FieldName, PrimitiveValue } from './channeldef'; -import { DateTime } from './datetime'; -import { Dict } from './util'; -export declare const SELECTION_ID = "_vgsid_"; -export declare type SelectionType = 'single' | 'multi' | 'interval'; -export declare type SelectionResolution = 'global' | 'union' | 'intersect'; -export declare type SelectionInit = PrimitiveValue | DateTime; -export declare type SelectionInitInterval = Vector2 | Vector2 | Vector2 | Vector2; -export declare type SelectionInitMapping = Dict; -export declare type SelectionInitIntervalMapping = Dict; -export declare type LegendStreamBinding = { - legend: string | Stream; -}; -export declare type LegendBinding = 'legend' | LegendStreamBinding; -export interface BaseSelectionConfig { - /** - * Clears the selection, emptying it of all values. Can be a - * [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable. - * - * __Default value:__ `dblclick`. - * - * __See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation. - */ - clear?: Stream | string | boolean; - /** - * A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection. - * For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters). - */ - on?: Stream | string; - /** - * With layered and multi-view displays, a strategy that determines how - * selections' data queries are resolved when applied in a filter transform, - * conditional encoding rule, or scale domain. - * - * __See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation. - */ - resolve?: SelectionResolution; - /** - * An array of encoding channels. The corresponding data field values - * must match for a data tuple to fall within the selection. - * - * __See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation. - */ - encodings?: SingleDefUnitChannel[]; - /** - * An array of field names whose values must match for a data tuple to - * fall within the selection. - * - * __See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation. - */ - fields?: FieldName[]; - /** - * By default, `all` data values are considered to lie within an empty selection. - * When set to `none`, empty selections contain no data values. - */ - empty?: 'all' | 'none'; -} -export interface SingleSelectionConfig extends BaseSelectionConfig { - /** - * When set, a selection is populated by input elements (also known as dynamic query widgets) - * or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; - * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property. - * - * Legend bindings are restricted to selections that only specify a single field or encoding. - * - * Query widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind) - * or can be a mapping between projected field/encodings and binding definitions. - * - * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation. - */ - bind?: Binding | Record | LegendBinding; - /** - * When true, an invisible voronoi diagram is computed to accelerate discrete - * selection. The data value _nearest_ the mouse cursor is added to the selection. - * - * __See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation. - */ - nearest?: boolean; - /** - * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and initial values. - * - * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation. - */ - init?: SelectionInitMapping; -} -export interface MultiSelectionConfig extends BaseSelectionConfig { - /** - * Controls whether data values should be toggled or only ever inserted into - * multi selections. Can be `true`, `false` (for insertion only), or a - * [Vega expression](https://vega.github.io/vega/docs/expressions/). - * - * __Default value:__ `true`, which corresponds to `event.shiftKey` (i.e., - * data values are toggled when a user interacts with the shift-key pressed). - * - * Setting the value to the Vega expression `"true"` will toggle data values - * without the user pressing the shift-key. - * - * __See also:__ [`toggle`](https://vega.github.io/vega-lite/docs/toggle.html) documentation. - */ - toggle?: string | boolean; - /** - * When true, an invisible voronoi diagram is computed to accelerate discrete - * selection. The data value _nearest_ the mouse cursor is added to the selection. - * - * __See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation. - */ - nearest?: boolean; - /** - * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and an initial - * value (or array of values). - * - * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation. - */ - init?: SelectionInitMapping[]; - /** - * When set, a selection is populated by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; - * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property. - * - * Legend bindings are restricted to selections that only specify a single field or encoding. - */ - bind?: LegendBinding; -} -export interface BrushConfig { - /** - * The fill color of the interval mark. - * - * __Default value:__ `"#333333"` - * - */ - fill?: Color; - /** - * The fill opacity of the interval mark (a value between `0` and `1`). - * - * __Default value:__ `0.125` - */ - fillOpacity?: number; - /** - * The stroke color of the interval mark. - * - * __Default value:__ `"#ffffff"` - */ - stroke?: Color; - /** - * The stroke opacity of the interval mark (a value between `0` and `1`). - */ - strokeOpacity?: number; - /** - * The stroke width of the interval mark. - */ - strokeWidth?: number; - /** - * An array of alternating stroke and space lengths, for creating dashed or dotted lines. - */ - strokeDash?: number[]; - /** - * The offset (in pixels) with which to begin drawing the stroke dash array. - */ - strokeDashOffset?: number; - /** - * The mouse cursor used over the interval mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used. - */ - cursor?: Cursor; -} -export interface IntervalSelectionConfig extends BaseSelectionConfig { - /** - * When truthy, allows a user to interactively move an interval selection - * back-and-forth. Can be `true`, `false` (to disable panning), or a - * [Vega event stream definition](https://vega.github.io/vega/docs/event-streams/) - * which must include a start and end event to trigger continuous panning. - * - * __Default value:__ `true`, which corresponds to - * `[mousedown, window:mouseup] > window:mousemove!` which corresponds to - * clicks and dragging within an interval selection to reposition it. - * - * __See also:__ [`translate`](https://vega.github.io/vega-lite/docs/translate.html) documentation. - */ - translate?: string | boolean; - /** - * When truthy, allows a user to interactively resize an interval selection. - * Can be `true`, `false` (to disable zooming), or a [Vega event stream - * definition](https://vega.github.io/vega/docs/event-streams/). Currently, - * only `wheel` events are supported. - * - * __Default value:__ `true`, which corresponds to `wheel!`. - * - * __See also:__ [`zoom`](https://vega.github.io/vega-lite/docs/zoom.html) documentation. - */ - zoom?: string | boolean; - /** - * Establishes a two-way binding between the interval selection and the scales - * used within the same view. This allows a user to interactively pan and - * zoom the view. - * - * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation. - */ - bind?: 'scales'; - /** - * An interval selection also adds a rectangle mark to depict the - * extents of the interval. The `mark` property can be used to customize the - * appearance of the mark. - * - * __See also:__ [`mark`](https://vega.github.io/vega-lite/docs/selection-mark.html) documentation. - */ - mark?: BrushConfig; - /** - * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and arrays of - * initial values. - * - * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation. - */ - init?: SelectionInitIntervalMapping; -} -export interface BaseSelectionDef { - /** - * Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types: - * - * - `"single"` -- to select a single discrete data value on `click`. - * - `"multi"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`. - * - `"interval"` -- to select a continuous range of data values on `drag`. - */ - type: T; -} -export interface SingleSelection extends BaseSelectionDef<'single'>, SingleSelectionConfig { -} -export interface MultiSelection extends BaseSelectionDef<'multi'>, MultiSelectionConfig { -} -export interface IntervalSelection extends BaseSelectionDef<'interval'>, IntervalSelectionConfig { -} -export declare type SelectionDef = SingleSelection | MultiSelection | IntervalSelection; -export declare type SelectionExtent = { - /** - * The name of a selection. - */ - selection: string; - /** - * The field name to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html) - * over multiple fields or encodings. - */ - field?: FieldName; -} | { - /** - * The name of a selection. - */ - selection: string; - /** - * The encoding channel to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html) - * over multiple fields or encodings. - */ - encoding?: SingleDefUnitChannel; -}; -export interface SelectionConfig { - /** - * The default definition for a [`single`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations - * for a single selection definition (except `type`) may be specified here. - * - * For instance, setting `single` to `{"on": "dblclick"}` populates single selections on double-click by default. - */ - single?: SingleSelectionConfig; - /** - * The default definition for a [`multi`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations - * for a multi selection definition (except `type`) may be specified here. - * - * For instance, setting `multi` to `{"toggle": "event.altKey"}` adds additional values to - * multi selections when clicking with the alt-key pressed by default. - */ - multi?: MultiSelectionConfig; - /** - * The default definition for an [`interval`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations - * for an interval selection definition (except `type`) may be specified here. - * - * For instance, setting `interval` to `{"translate": false}` disables the ability to move - * interval selections by default. - */ - interval?: IntervalSelectionConfig; -} -export declare const defaultConfig: SelectionConfig; -export declare function isLegendBinding(bind: any): bind is LegendBinding; -export declare function isLegendStreamBinding(bind: any): bind is LegendStreamBinding; -//# sourceMappingURL=selection.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/selection.d.ts.map b/node_modules/vega-lite/build/src/selection.d.ts.map deleted file mode 100644 index a6b97d3..0000000 --- a/node_modules/vega-lite/build/src/selection.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../src/selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AAE7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;AACvD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5B,eAAO,MAAM,YAAY,YAAY,CAAC;AACtC,oBAAY,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAC5D,oBAAY,mBAAmB,GAAG,QAAQ,GAAG,OAAO,G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B,CAAC,OAAO,CAAC,EAAE,oBAAoB;CAAG;AAE1F,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB,CAAC,UAAU,CAAC,EAAE,uBAAuB;CAAG;AAEnG,oBAAY,YAAY,GAAG,eAAe,GAAG,cAAc,GAAG,iBAAiB,CAAC;AAEhF,oBAAY,eAAe,GACvB;IACE;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,GACD;IACE;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAEN,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,uBAAuB,CAAC;CACpC;AAED,eAAO,MAAM,aAAa,EAAE,eAyB3B,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,aAAa,CAEhE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,mBAAmB,CAE5E"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/selection.js b/node_modules/vega-lite/build/src/selection.js deleted file mode 100644 index 128460c..0000000 --- a/node_modules/vega-lite/build/src/selection.js +++ /dev/null @@ -1,35 +0,0 @@ -import { isObject } from 'vega-util'; -export const SELECTION_ID = '_vgsid_'; -export const defaultConfig = { - single: { - on: 'click', - fields: [SELECTION_ID], - resolve: 'global', - empty: 'all', - clear: 'dblclick' - }, - multi: { - on: 'click', - fields: [SELECTION_ID], - toggle: 'event.shiftKey', - resolve: 'global', - empty: 'all', - clear: 'dblclick' - }, - interval: { - on: '[mousedown, window:mouseup] > window:mousemove!', - encodings: ['x', 'y'], - translate: '[mousedown, window:mouseup] > window:mousemove!', - zoom: 'wheel!', - mark: { fill: '#333', fillOpacity: 0.125, stroke: 'white' }, - resolve: 'global', - clear: 'dblclick' - } -}; -export function isLegendBinding(bind) { - return !!bind && (bind === 'legend' || !!bind.legend); -} -export function isLegendStreamBinding(bind) { - return isLegendBinding(bind) && isObject(bind); -} -//# sourceMappingURL=selection.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/selection.js.map b/node_modules/vega-lite/build/src/selection.js.map deleted file mode 100644 index ad51159..0000000 --- a/node_modules/vega-lite/build/src/selection.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/selection.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAMnC,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AA+StC,MAAM,CAAC,MAAM,aAAa,GAAoB;IAC5C,MAAM,EAAE;QACN,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,YAAY,CAAC;QACtB,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,UAAU;KAClB;IACD,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,YAAY,CAAC;QACtB,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,UAAU;KAClB;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,iDAAiD;QACrD,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;QACrB,SAAS,EAAE,iDAAiD;QAC5D,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAC;QACzD,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,UAAU;KAClB;CACF,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,IAAS;IACvC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAS;IAC7C,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/sort.d.ts b/node_modules/vega-lite/build/src/sort.d.ts deleted file mode 100644 index a5bd429..0000000 --- a/node_modules/vega-lite/build/src/sort.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { NonArgAggregateOp } from './aggregate'; -import { FieldName } from './channeldef'; -import { DateTime } from './datetime'; -export declare type SortOrder = 'ascending' | 'descending'; -/** - * A sort definition for transform - */ -export interface SortField { - /** - * The name of the field to sort. - */ - field: FieldName; - /** - * Whether to sort the field in ascending or descending order. One of `"ascending"` (default), `"descending"`, or `null` (no not sort). - */ - order?: SortOrder | null; -} -export interface SortFields { - field: FieldName[]; - order?: SortOrder[]; -} -export declare const DEFAULT_SORT_OP = "min"; -/** - * A sort definition for sorting a discrete scale in an encoding field definition. - */ -export interface EncodingSortField { - /** - * The data [field](https://vega.github.io/vega-lite/docs/field.html) to sort by. - * - * __Default value:__ If unspecified, defaults to the field specified in the outer data reference. - */ - field?: F; - /** - * An [aggregate operation](https://vega.github.io/vega-lite/docs/aggregate.html#ops) to perform on the field prior to sorting (e.g., `"count"`, `"mean"` and `"median"`). - * An aggregation is required when there are multiple values of the sort field for each encoded data field. - * The input data objects will be aggregated, grouped by the encoded data field. - * - * For a full list of operations, please see the documentation for [aggregate](https://vega.github.io/vega-lite/docs/aggregate.html#ops). - * - * __Default value:__ `"sum"` for stacked plots. Otherwise, `"min"`. - */ - op?: NonArgAggregateOp; - /** - * The sort order. One of `"ascending"` (default), `"descending"`, or `null` (no not sort). - */ - order?: SortOrder | null; -} -export interface SortByEncoding { - /** - * The [encoding channel](https://vega.github.io/vega-lite/docs/encoding.html#channels) to sort by (e.g., `"x"`, `"y"`) - */ - encoding: SortByChannel; - /** - * The sort order. One of `"ascending"` (default), `"descending"`, or `null` (no not sort). - */ - order?: SortOrder | null; -} -export declare type SortArray = number[] | string[] | boolean[] | DateTime[]; -declare const SORT_BY_CHANNEL_INDEX: { - readonly x: 1; - readonly y: 1; - readonly color: 1; - readonly fill: 1; - readonly stroke: 1; - readonly strokeWidth: 1; - readonly size: 1; - readonly shape: 1; - readonly fillOpacity: 1; - readonly strokeOpacity: 1; - readonly opacity: 1; - readonly text: 1; -}; -export declare type SortByChannel = keyof typeof SORT_BY_CHANNEL_INDEX; -export declare function isSortByChannel(c: string): c is SortByChannel; -export declare type SortByChannelDesc = '-x' | '-y' | '-color' | '-fill' | '-stroke' | '-strokeWidth' | '-size' | '-shape' | '-fillOpacity' | '-strokeOpacity' | '-opacity' | '-text'; -export declare type AllSortString = SortOrder | SortByChannel | SortByChannelDesc; -export declare type Sort = SortArray | AllSortString | EncodingSortField | SortByEncoding | null; -export declare function isSortByEncoding(sort: Sort): sort is SortByEncoding; -export declare function isSortField(sort: Sort): sort is EncodingSortField; -export declare function isSortArray(sort: Sort): sort is SortArray; -export {}; -//# sourceMappingURL=sort.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/sort.d.ts.map b/node_modules/vega-lite/build/src/sort.d.ts.map deleted file mode 100644 index ae2c180..0000000 --- a/node_modules/vega-lite/build/src/sort.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/sort.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,oBAAY,SAAS,GAAG,WA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AG,aAAa,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,IAAI,CAAC;AAE/F,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,cAAc,CAEzE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAE1E;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,SAAS,CAE/D"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/sort.js b/node_modules/vega-lite/build/src/sort.js deleted file mode 100644 index dba2ee7..0000000 --- a/node_modules/vega-lite/build/src/sort.js +++ /dev/null @@ -1,29 +0,0 @@ -import { isArray } from 'vega-util'; -export const DEFAULT_SORT_OP = 'min'; -const SORT_BY_CHANNEL_INDEX = { - x: 1, - y: 1, - color: 1, - fill: 1, - stroke: 1, - strokeWidth: 1, - size: 1, - shape: 1, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - text: 1 -}; -export function isSortByChannel(c) { - return c in SORT_BY_CHANNEL_INDEX; -} -export function isSortByEncoding(sort) { - return !!sort && !!sort['encoding']; -} -export function isSortField(sort) { - return !!sort && (sort['op'] === 'count' || !!sort['field']); -} -export function isSortArray(sort) { - return !!sort && isArray(sort); -} -//# sourceMappingURL=sort.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/sort.js.map b/node_modules/vega-lite/build/src/sort.js.map deleted file mode 100644 index 3c09038..0000000 --- a/node_modules/vega-lite/build/src/sort.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort.js","sourceRoot":"","sources":["../../src/sort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AA2BlC,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AA4CrC,MAAM,qBAAqB,GAAG;IAC5B,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC;IACd,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;CACC,CAAC;AAIX,MAAM,UAAU,eAAe,CAAC,CAAS;IACvC,OAAO,CAAC,IAAI,qBAAqB,CAAC;AACpC,CAAC;AAoBD,MAAM,UAAU,gBAAgB,CAAI,IAAa;IAC/C,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,IAAa;IAC1C,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,IAAa;IAC1C,OAAO,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/base.d.ts b/node_modules/vega-lite/build/src/spec/base.d.ts deleted file mode 100644 index 297cb4e..0000000 --- a/node_modules/vega-lite/build/src/spec/base.d.ts +++ /dev/null @@ -1,220 +0,0 @@ -import { Color, Cursor, SignalRef, Text } from 'vega'; -import { NormalizedSpec } from '.'; -import { Data } from '../data'; -import { MarkConfig } from '../mark'; -import { Resolve } from '../resolve'; -import { TitleParams } from '../title'; -import { Transform } from '../transform'; -import { LayoutAlign, RowCol } from '../vega.schema'; -export { TopLevel } from './toplevel'; -/** - * Common properties for all types of specification - */ -export interface BaseSpec { - /** - * Title for the plot. - */ - title?: Text | TitleParams; - /** - * Name of the visualization for later reference. - */ - name?: string; - /** - * Description of this mark for commenting purpose. - */ - description?: string; - /** - * An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent. - */ - data?: Data | null; - /** - * An array of data transformations such as filter and new field calculation. - */ - transform?: Transform[]; -} -export interface DataMixins { - /** - * An object describing the data source. - */ - data: Data; -} -export interface Step { - /** - * The size (width/height) per discrete step. - */ - step: number; -} -export declare function isStep(size: number | Step | 'container' | 'merged'): size is Step; -/** - * Common properties for specifying width and height of unit and layer specifications. - */ -export interface LayoutSizeMixins { - /** - * The width of a visualization. - * - * - For a plot with a continuous x-field, width should be a number. - * - For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.) - * - To enable responsive sizing on width, it should be set to `"container"`. - * - * __Default value:__ - * Based on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise. - * - * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `"container"` option cannot be used. - * - * __See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation. - */ - width?: number | 'container' | Step; - /** - * The height of a visualization. - * - * - For a plot with a continuous y-field, height should be a number. - * - For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.) - * - To enable responsive sizing on height, it should be set to `"container"`. - * - * __Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise. - * - * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `"container"` option cannot be used. - * - * __See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation. - */ - height?: number | 'container' | Step; -} -export declare function isFrameMixins(o: any): o is FrameMixins; -export interface FrameMixins extends LayoutSizeMixins { - /** - * An object defining the view background's fill and stroke. - * - * __Default value:__ none (transparent) - */ - view?: ViewBackground; -} -export declare type DeprecatedFrameMixins = { - /** - * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec. - */ - width?: FrameMixins['width']; - /** - * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec. - */ - height?: FrameMixins['height']; - /** - * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec. - */ - view?: FrameMixins['view']; -}; -export interface ResolveMixins { - /** - * Scale, axis, and legend resolutions for view composition specifications. - */ - resolve?: Resolve; -} -export interface BaseViewBackground extends Partial> { - /** - * The fill color. - * - * __Default value:__ `undefined` - */ - fill?: Color | null | SignalRef; - /** - * The stroke color. - * - * __Default value:__ `"#ddd"` - */ - stroke?: Color | null | SignalRef; - /** - * The mouse cursor used over the view. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used. - */ - cursor?: Cursor; -} -export interface ViewBackground extends BaseViewBackground { - /** - * A string or array of strings indicating the name of custom styles to apply to the view background. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. - * - * __Default value:__ `"cell"` - * __Note:__ Any specified view background properties will augment the default style. - */ - style?: string | string[]; -} -export interface BoundsMixins { - /** - * The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`. - * - * - If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used. - * - If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. - * - * __Default value:__ `"full"` - */ - bounds?: 'full' | 'flush'; -} -/** - * Base layout for FacetSpec and RepeatSpec. - * This is named "GenericComposition" layout as ConcatLayout is a GenericCompositionLayout too - * (but _not_ vice versa). - */ -export interface GenericCompositionLayout extends BoundsMixins { - /** - * The alignment to apply to grid rows and columns. - * The supported string values are `"all"`, `"each"`, and `"none"`. - * - * - For `"none"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other. - * - For `"each"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size. - * - For `"all"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns. - * - * Alternatively, an object value of the form `{"row": string, "column": string}` can be used to supply different alignments for rows and columns. - * - * __Default value:__ `"all"`. - */ - align?: LayoutAlign | RowCol; - /** - * Boolean flag indicating if subviews should be centered relative to their respective rows or columns. - * - * An object value of the form `{"row": boolean, "column": boolean}` can be used to supply different centering values for rows and columns. - * - * __Default value:__ `false` - */ - center?: boolean | RowCol; - /** - * The spacing in pixels between sub-views of the composition operator. - * An object of the form `{"row": number, "column": number}` can be used to set - * different spacing values for rows and columns. - * - * __Default value__: Depends on `"spacing"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default) - */ - spacing?: number | RowCol; -} -export declare const DEFAULT_SPACING = 20; -export interface ColumnMixins { - /** - * The number of columns to include in the view composition layout. - * - * __Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to - * `hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`). - * - * __Note__: - * - * 1) This property is only for: - * - the general (wrappable) `concat` operator (not `hconcat`/`vconcat`) - * - the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting) - * - * 2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`). - */ - columns?: number; -} -export declare type GenericCompositionLayoutWithColumns = GenericCompositionLayout & ColumnMixins; -export declare type CompositionConfig = ColumnMixins & { - /** - * The default spacing in pixels between composed sub-views. - * - * __Default value__: `20` - */ - spacing?: number; -}; -export interface CompositionConfigMixins { - /** Default configuration for the `facet` view composition operator */ - facet?: CompositionConfig; - /** Default configuration for all concatenation and repeat view composition operators (`concat`, `hconcat`, `vconcat`, and `repeat`) */ - concat?: CompositionConfig; -} -export declare type SpecType = 'unit' | 'facet' | 'layer' | 'concat'; -export declare function extractCompositionLayout(spec: NormalizedSpec, specType: keyof CompositionConfigMixins, config: CompositionConfigMixins): GenericCompositionLayoutWithColumns; -//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/base.d.ts.map b/node_modules/vega-lite/build/src/spec/base.d.ts.map deleted file mode 100644 index d644087..0000000 --- a/node_modules/vega-lite/build/src/spec/base.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/spec/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAEpD,OAAO,EAAC,cAAc,EAAC,MAAM,GAAG,CAAC;AACjC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AACrC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAInD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAE3B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,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C,CAuCrC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/base.js b/node_modules/vega-lite/build/src/spec/base.js deleted file mode 100644 index 25dae98..0000000 --- a/node_modules/vega-lite/build/src/spec/base.js +++ /dev/null @@ -1,56 +0,0 @@ -import { isNumber, isObject } from 'vega-util'; -import { keys } from '../util'; -import { isConcatSpec, isVConcatSpec } from './concat'; -import { isFacetMapping, isFacetSpec } from './facet'; -export function isStep(size) { - return isObject(size) && size['step'] !== undefined; -} -export function isFrameMixins(o) { - return o['view'] || o['width'] || o['height']; -} -export const DEFAULT_SPACING = 20; -const COMPOSITION_LAYOUT_INDEX = { - align: 1, - bounds: 1, - center: 1, - columns: 1, - spacing: 1 -}; -const COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX); -export function extractCompositionLayout(spec, specType, config) { - var _a, _b; - const compositionConfig = config[specType]; - const layout = {}; - // Apply config first - const { spacing: spacingConfig, columns } = compositionConfig; - if (spacingConfig !== undefined) { - layout.spacing = spacingConfig; - } - if (columns !== undefined) { - if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) { - layout.columns = columns; - } - } - if (isVConcatSpec(spec)) { - layout.columns = 1; - } - // Then copy properties from the spec - for (const prop of COMPOSITION_LAYOUT_PROPERTIES) { - if (spec[prop] !== undefined) { - if (prop === 'spacing') { - const spacing = spec[prop]; - layout[prop] = isNumber(spacing) - ? spacing - : { - row: (_a = spacing.row) !== null && _a !== void 0 ? _a : spacingConfig, - column: (_b = spacing.column) !== null && _b !== void 0 ? _b : spacingConfig - }; - } - else { - layout[prop] = spec[prop]; - } - } - } - return layout; -} -//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/base.js.map b/node_modules/vega-lite/build/src/spec/base.js.map deleted file mode 100644 index b1cfe46..0000000 --- a/node_modules/vega-lite/build/src/spec/base.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base.js","sour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AC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE;YAC5E,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;SAC1B;KACF;IAED,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;QACvB,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;KACpB;IAED,qCAAqC;IACrC,KAAK,MAAM,IAAI,IAAI,6BAA6B,EAAE;QAChD,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE;YAC5B,IAAI,IAAI,KAAK,SAAS,EAAE;gBACtB,MAAM,OAAO,GAA4B,IAAI,CAAC,IAAI,CAAC,CAAC;gBAEpD,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC;oBAC9B,CAAC,CAAC,OAAO;oBACT,CAAC,CAAC;wBACE,GAAG,QAAE,OAAO,CAAC,GAAG,mCAAI,aAAa;wBACjC,MAAM,QAAE,OAAO,CAAC,MAAM,mCAAI,aAAa;qBACxC,CAAC;aACP;iBAAM;gBACJ,MAAM,CAAC,IAAI,CAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;aACpC;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/concat.d.ts b/node_modules/vega-lite/build/src/spec/concat.d.ts deleted file mode 100644 index 812012d..0000000 --- a/node_modules/vega-lite/build/src/spec/concat.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { GenericSpec, NormalizedSpec } from '.'; -import { BaseSpec, BoundsMixins, GenericCompositionLayoutWithColumns, ResolveMixins } from './base'; -/** - * Base layout mixins for V/HConcatSpec, which should not have RowCol generic fo its property. - */ -export interface OneDirectionalConcatLayout extends BoundsMixins, ResolveMixins { - /** - * Boolean flag indicating if subviews should be centered relative to their respective rows or columns. - * - * __Default value:__ `false` - */ - center?: boolean; - /** - * The spacing in pixels between sub-views of the concat operator. - * - * __Default value__: `10` - */ - spacing?: number; -} -/** - * Base interface for a generalized concatenation specification. - */ -export interface GenericConcatSpec> extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { - /** - * A list of views to be concatenated. - */ - concat: S[]; -} -/** - * Base interface for a vertical concatenation specification. - */ -export interface GenericVConcatSpec> extends BaseSpec, OneDirectionalConcatLayout { - /** - * A list of views to be concatenated and put into a column. - */ - vconcat: S[]; -} -/** - * Base interface for a horizontal concatenation specification. - */ -export interface GenericHConcatSpec> extends BaseSpec, OneDirectionalConcatLayout { - /** - * A list of views to be concatenated and put into a row. - */ - hconcat: S[]; -} -/** A concat spec without any shortcut/expansion syntax */ -export declare type NormalizedConcatSpec = GenericConcatSpec | GenericVConcatSpec | GenericHConcatSpec; -export declare function isAnyConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec | GenericHConcatSpec; -export declare function isConcatSpec(spec: BaseSpec): spec is GenericConcatSpec; -export declare function isVConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec; -export declare function isHConcatSpec(spec: BaseSpec): spec is GenericHConcatSpec; -//# sourceMappingURL=concat.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/concat.d.ts.map b/node_modules/vega-lite/build/src/spec/concat.d.ts.map deleted file mode 100644 index b69fb4e..0000000 --- a/node_modules/vega-lite/build/src/spec/concat.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../src/spec/concat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,GAAG,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAE,mCAAmC,EAAE,aAAa,EAAC,MAAM,QAAQ,CAAC;AAElG;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,YAAY,EAAE,aAAa;IAC7E;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC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AC,CAE7E"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/concat.js b/node_modules/vega-lite/build/src/spec/concat.js deleted file mode 100644 index 4a094ac..0000000 --- a/node_modules/vega-lite/build/src/spec/concat.js +++ /dev/null @@ -1,13 +0,0 @@ -export function isAnyConcatSpec(spec) { - return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec); -} -export function isConcatSpec(spec) { - return 'concat' in spec; -} -export function isVConcatSpec(spec) { - return 'vconcat' in spec; -} -export function isHConcatSpec(spec) { - return 'hconcat' in spec; -} -//# sourceMappingURL=concat.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/concat.js.map b/node_modules/vega-lite/build/src/spec/concat.js.map deleted file mode 100644 index db156b0..0000000 --- a/node_modules/vega-lite/build/src/spec/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/spec/concat.ts"],"names":[],"mappings":"AAiEA,MAAM,UAAU,eAAe,CAAC,IAAc;IAC5C,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAc;IACzC,OAAO,QAAQ,IAAI,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAc;IAC1C,OAAO,SAAS,IAAI,IAAI,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAc;IAC1C,OAAO,SAAS,IAAI,IAAI,CAAC;AAC3B,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/facet.d.ts b/node_modules/vega-lite/build/src/spec/facet.d.ts deleted file mode 100644 index b9f23bd..0000000 --- a/node_modules/vega-lite/build/src/spec/facet.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { LayoutAlign } from 'vega'; -import { BinParams } from '../bin'; -import { ChannelDef, Field, FieldName, TypedFieldDef } from '../channeldef'; -import { Header } from '../header'; -import { EncodingSortField, SortArray, SortOrder } from '../sort'; -import { StandardType } from '../type'; -import { BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins } from './base'; -import { GenericLayerSpec, NormalizedLayerSpec } from './layer'; -import { GenericUnitSpec, NormalizedUnitSpec } from './unit'; -export interface FacetFieldDef extends TypedFieldDef { - /** - * An object defining properties of a facet's header. - */ - header?: Header; - /** - * Sort order for the encoded field. - * - * For continuous fields (quantitative or temporal), `sort` can be either `"ascending"` or `"descending"`. - * - * For discrete fields, `sort` can be one of the following: - * - `"ascending"` or `"descending"` -- for sorting by the values' natural order in JavaScript. - * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field. - * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `"month"` and `"day"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `"Mon"`, `"Tue"`). - * - `null` indicating no sort. - * - * __Default value:__ `"ascending"` - * - * __Note:__ `null` is not supported for `row` and `column`. - */ - sort?: SortArray | SortOrder | EncodingSortField | null; -} -export declare type FacetEncodingFieldDef = FacetFieldDef & GenericCompositionLayoutWithColumns; -export interface RowColumnEncodingFieldDef extends FacetFieldDef { - /** - * The alignment to apply to row/column facet's subplot. - * The supported string values are `"all"`, `"each"`, and `"none"`. - * - * - For `"none"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other. - * - For `"each"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size. - * - For `"all"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns. - * - * __Default value:__ `"all"`. - */ - align?: LayoutAlign; - /** - * Boolean flag indicating if facet's subviews should be centered relative to their respective rows or columns. - * - * __Default value:__ `false` - */ - center?: boolean; - /** - * The spacing in pixels between facet's sub-views. - * - * __Default value__: Depends on `"spacing"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default) - */ - spacing?: number; -} -export interface FacetMapping = FacetFieldDef> { - /** - * A field definition for the vertical facet of trellis plots. - */ - row?: FD; - /** - * A field definition for the horizontal facet of trellis plots. - */ - column?: FD; -} -export declare function isFacetMapping(f: FacetFieldDef | FacetMapping): f is FacetMapping; -/** - * Facet mapping for encoding macro - */ -export interface EncodingFacetMapping extends FacetMapping> { - /** - * A field definition for the (flexible) facet of trellis plots. - * - * If either `row` or `column` is specified, this channel will be ignored. - */ - facet?: FacetEncodingFieldDef; -} -export declare function isFacetFieldDef(channelDef: ChannelDef): channelDef is FacetFieldDef; -/** - * Base interface for a facet specification. - */ -export interface GenericFacetSpec, L extends GenericLayerSpec, F extends Field> extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { - /** - * Definition for how to facet the data. One of: - * 1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def) - * 2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping) - */ - facet: FacetFieldDef | FacetMapping; - /** - * A specification of the view that gets faceted. - */ - spec: L | U; -} -/** - * A facet specification without any shortcut / expansion syntax - */ -export declare type NormalizedFacetSpec = GenericFacetSpec; -export declare function isFacetSpec(spec: BaseSpec): spec is GenericFacetSpec; -//# sourceMappingURL=facet.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/facet.d.ts.map b/node_modules/vega-lite/build/src/spec/facet.d.ts.map deleted file mode 100644 index 75350f3..0000000 --- a/node_modules/vega-lite/build/src/spec/facet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facet.d.ts","sourceRoot":"","sources":["../../../src/spec/facet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,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ff --git a/node_modules/vega-lite/build/src/spec/facet.js b/node_modules/vega-lite/build/src/spec/facet.js deleted file mode 100644 index 4a4ae4f..0000000 --- a/node_modules/vega-lite/build/src/spec/facet.js +++ /dev/null @@ -1,10 +0,0 @@ -export function isFacetMapping(f) { - return 'row' in f || 'column' in f; -} -export function isFacetFieldDef(channelDef) { - return !!channelDef && 'header' in channelDef; -} -export function isFacetSpec(spec) { - return 'facet' in spec; -} -//# sourceMappingURL=facet.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/facet.js.map b/node_modules/vega-lite/build/src/spec/facet.js.map deleted file mode 100644 index c579808..0000000 --- a/node_modules/vega-lite/build/src/spec/facet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facet.js","sourceRoot":"","sources":["../../../src/spec/facet.ts"],"names":[],"mappings":"AAgFA,MAAM,UAAU,cAAc,CAAkB,CAAqC;IACnF,OAAO,KAAK,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,CAAC;AACrC,CAAC;AAcD,MAAM,UAAU,eAAe,CAAkB,UAAyB;IACxE,OAAO,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,UAAU,CAAC;AAChD,CAAC;AA6BD,MAAM,UAAU,WAAW,CAAC,IAAc;IACxC,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/index.d.ts b/node_modules/vega-lite/build/src/spec/index.d.ts deleted file mode 100644 index 6b1c3de..0000000 --- a/node_modules/vega-lite/build/src/spec/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Definition for specifications in Vega-Lite. In general, there are 3 variants of specs for each type of specs: - * - Generic specs are generic versions of specs and they are parameterized differently for internal and external specs. - * - The external specs (no prefix) would allow composite marks, row/column encodings, and mark macros like point/line overlay. - * - The internal specs (with `Normalized` prefix) would only support primitive marks and support no macros/shortcuts. - */ -import { Field } from '../channeldef'; -import { FieldName } from '../channeldef'; -import { DataMixins } from './base'; -import { GenericConcatSpec, GenericHConcatSpec, GenericVConcatSpec } from './concat'; -import { GenericFacetSpec } from './facet'; -import { GenericLayerSpec, LayerSpec, NormalizedLayerSpec } from './layer'; -import { RepeatSpec } from './repeat'; -import { TopLevel } from './toplevel'; -import { FacetedUnitSpec, GenericUnitSpec, NormalizedUnitSpec, TopLevelUnitSpec, UnitSpecWithFrame } from './unit'; -export { BaseSpec, LayoutSizeMixins } from './base'; -export { GenericHConcatSpec, GenericVConcatSpec, isAnyConcatSpec, isHConcatSpec, isVConcatSpec, NormalizedConcatSpec } from './concat'; -export { GenericFacetSpec, isFacetSpec, NormalizedFacetSpec } from './facet'; -export { GenericLayerSpec, isLayerSpec, LayerSpec, NormalizedLayerSpec } from './layer'; -export { isRepeatSpec, RepeatSpec } from './repeat'; -export { TopLevel } from './toplevel'; -export { FacetedUnitSpec, GenericUnitSpec, isUnitSpec, NormalizedUnitSpec, UnitSpec } from './unit'; -/** - * Any specification in Vega-Lite. - */ -export declare type GenericSpec, L extends GenericLayerSpec, R extends RepeatSpec, F extends Field> = U | L | R | GenericFacetSpec | GenericConcatSpec> | GenericVConcatSpec> | GenericHConcatSpec>; -/** - * Specs with only primitive marks and without other macros. - */ -export declare type NormalizedSpec = GenericSpec; -export declare type TopLevelFacetSpec = TopLevel> & DataMixins; -/** - * A Vega-Lite top-level specification. - * This is the root class for all Vega-Lite specifications. - * (The json schema is generated from this type.) - */ -export declare type TopLevelSpec = TopLevelUnitSpec | TopLevelFacetSpec | TopLevel | TopLevel | TopLevel>> | TopLevel>> | TopLevel>>; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/index.d.ts.map b/node_modules/vega-lite/build/src/spec/index.d.ts.map deleted file mode 100644 index b3d3065..0000000 --- a/node_modules/vega-lite/build/src/spec/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spec/index.ts"],"names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,SAAS,gBAAgB,CAAC,GAAG,CAAC,EAC/B,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,KAAK,IAEb,CAAC,GACD,CAAC,GACD,CAAC,GACD,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GACzB,iBAAiB,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAC1C,kBAAkB,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAC3C,kBAAkB,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEhD;;GAEG;AACH,oBAAY,cAAc,GAAG,WAAW,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAEpG,oBAAY,iBAAiB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,GAAG,UAAU,CAAC;AAE7G;;;;GAIG;AACH,oBAAY,YAAY,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,QAAQ,CAAC,SAAS,CAAC,GACnB,QAAQ,CAAC,UAAU,CAAC,GACpB,QAAQ,CAAC,iBAAiB,CAAC,WAAW,CAAC,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GACvF,QAAQ,CAAC,kBAAkB,CAAC,WAAW,CAAC,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GACxF,QAAQ,CAAC,kBAAkB,CAAC,WAAW,CAAC,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/index.js b/node_modules/vega-lite/build/src/spec/index.js deleted file mode 100644 index 2f3643a..0000000 --- a/node_modules/vega-lite/build/src/spec/index.js +++ /dev/null @@ -1,6 +0,0 @@ -export { isAnyConcatSpec, isHConcatSpec, isVConcatSpec } from './concat'; -export { isFacetSpec } from './facet'; -export { isLayerSpec } from './layer'; -export { isRepeatSpec } from './repeat'; -export { isUnitSpec } from './unit'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/index.js.map b/node_modules/vega-lite/build/src/spec/index.js.map deleted file mode 100644 index bfc7a8d..0000000 --- a/node_modules/vega-lite/build/src/spec/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/spec/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,eAAe,EACf,aAAa,EACb,aAAa,EAEd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAmB,WAAW,EAAsB,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAmB,WAAW,EAAiC,MAAM,SAAS,CAAC;AACtF,OAAO,EAAC,YAAY,EAAa,MAAM,UAAU,CAAC;AAElD,OAAO,EAAmC,UAAU,EAA+B,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/layer.d.ts b/node_modules/vega-lite/build/src/spec/layer.d.ts deleted file mode 100644 index 3630d0f..0000000 --- a/node_modules/vega-lite/build/src/spec/layer.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { SharedCompositeEncoding } from '../compositemark'; -import { Projection } from '../projection'; -import { BaseSpec, FrameMixins, ResolveMixins } from './base'; -import { GenericUnitSpec, NormalizedUnitSpec, UnitSpec } from './unit'; -/** - * Base interface for a layer specification. - */ -export interface GenericLayerSpec> extends BaseSpec, FrameMixins, ResolveMixins { - /** - * Layer or single view specifications to be layered. - * - * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet. - */ - layer: (GenericLayerSpec | U)[]; -} -/** - * A full layered plot specification, which may contains `encoding` and `projection` properties that will be applied to underlying unit (single-view) specifications. - */ -export interface LayerSpec extends BaseSpec, FrameMixins, ResolveMixins { - /** - * Layer or single view specifications to be layered. - * - * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet. - */ - layer: (LayerSpec | UnitSpec)[]; - /** - * A shared key-value mapping between encoding channels and definition of fields in the underlying layers. - */ - encoding?: SharedCompositeEncoding; - /** - * An object defining properties of the geographic projection shared by underlying layers. - */ - projection?: Projection; -} -/** - * A layered specification without any shortcut/expansion syntax. - */ -export declare type NormalizedLayerSpec = GenericLayerSpec; -export declare function isLayerSpec(spec: BaseSpec): spec is GenericLayerSpec; -//# sourceMappingURL=layer.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/layer.d.ts.map b/node_modules/vega-lite/build/src/spec/layer.d.ts.map deleted file mode 100644 index d5023fd..0000000 --- a/node_modules/vega-lite/build/src/spec/layer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../src/spec/layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAC,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAE,SAAQ,QAAQ,EAAE,WAAW,EAAE,aAAa;IACjH;;;;OAIG;IACH,KAAK,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,QAAQ,EAAE,WAAW,EAAE,aAAa;IACrE;;;;OAIG;IACH,KAAK,EAAE,CAAC,SAAS,GAAG,QAAQ,CAAC,EAAE,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IAEnC;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED;;GAEG;AACH,oBAAY,mBAAmB,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAEvE,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAEzE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/layer.js b/node_modules/vega-lite/build/src/spec/layer.js deleted file mode 100644 index 9f44f31..0000000 --- a/node_modules/vega-lite/build/src/spec/layer.js +++ /dev/null @@ -1,4 +0,0 @@ -export function isLayerSpec(spec) { - return 'layer' in spec; -} -//# sourceMappingURL=layer.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/layer.js.map b/node_modules/vega-lite/build/src/spec/layer.js.map deleted file mode 100644 index a3d6d18..0000000 --- a/node_modules/vega-lite/build/src/spec/layer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"layer.js","sourceRoot":"","sources":["../../../src/spec/layer.ts"],"names":[],"mappings":"AA4CA,MAAM,UAAU,WAAW,CAAC,IAAc;IACxC,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/map.d.ts b/node_modules/vega-lite/build/src/spec/map.d.ts deleted file mode 100644 index d25b1ac..0000000 --- a/node_modules/vega-lite/build/src/spec/map.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GenericSpec } from '.'; -import { Field, FieldName } from '../channeldef'; -import { GenericConcatSpec, GenericHConcatSpec, GenericVConcatSpec } from './concat'; -import { GenericFacetSpec } from './facet'; -import { GenericLayerSpec } from './layer'; -import { RepeatSpec } from './repeat'; -import { GenericUnitSpec, NormalizedUnitSpec } from './unit'; -export declare abstract class SpecMapper, LI extends GenericLayerSpec = GenericLayerSpec, UO extends GenericUnitSpec = NormalizedUnitSpec, RO extends RepeatSpec = never, FO extends Field = FieldName> { - map(spec: GenericSpec, params: P): GenericSpec, RO, FO>; - mapLayerOrUnit(spec: UI | LI, params: P): UO | GenericLayerSpec; - abstract mapUnit(spec: UI, params: P): UO | GenericLayerSpec; - protected mapLayer(spec: LI, params: P): GenericLayerSpec; - protected mapHConcat(spec: GenericHConcatSpec>, params: P): GenericHConcatSpec, RO, FO>>; - protected mapVConcat(spec: GenericVConcatSpec>, params: P): GenericVConcatSpec, RO, FO>>; - protected mapConcat(spec: GenericConcatSpec>, params: P): GenericConcatSpec, RO, FO>>; - protected mapFacet(spec: GenericFacetSpec, params: P): GenericFacetSpec, FO>; - protected mapRepeat(spec: RepeatSpec, params: P): GenericSpec; -} -//# sourceMappingURL=map.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/map.d.ts.map b/node_modules/vega-lite/build/src/spec/map.d.ts.map deleted file mode 100644 index 45f5d7e..0000000 --- a/node_modules/vega-lite/build/src/spec/map.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/spec/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,GAAG,CAAC;AAE9B,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAInB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAC,gBAAgB,EAAc,MAAM,SAAS,CAAC;AACtD,OAAO,EAAC,gBAAgB,EAAc,MAAM,SAAS,CAAC;AACtD,OAAO,EAAe,UAAU,EAAC,MAAM,UAA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AC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,EAChE,MAAM,EAAE,CAAC,GACR,kBAAkB,CAAC,WAAW,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAOpE,SAAS,CAAC,SAAS,CACjB,IAAI,EAAE,iBAAiB,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GACR,iBAAiB,CAAC,WAAW,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IASnE,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,gBAAgB,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IASpH,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC;CAO/E"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/map.js b/node_modules/vega-lite/build/src/spec/map.js deleted file mode 100644 index 9eea9e3..0000000 --- a/node_modules/vega-lite/build/src/spec/map.js +++ /dev/null @@ -1,62 +0,0 @@ -import { __rest } from "tslib"; -import * as log from '../log'; -import { isConcatSpec, isHConcatSpec, isVConcatSpec } from './concat'; -import { isFacetSpec } from './facet'; -import { isLayerSpec } from './layer'; -import { isRepeatSpec } from './repeat'; -import { isUnitSpec } from './unit'; -export class SpecMapper { - map(spec, params) { - if (isFacetSpec(spec)) { - return this.mapFacet(spec, params); - } - else if (isRepeatSpec(spec)) { - return this.mapRepeat(spec, params); - } - else if (isHConcatSpec(spec)) { - return this.mapHConcat(spec, params); - } - else if (isVConcatSpec(spec)) { - return this.mapVConcat(spec, params); - } - else if (isConcatSpec(spec)) { - return this.mapConcat(spec, params); - } - else { - return this.mapLayerOrUnit(spec, params); - } - } - mapLayerOrUnit(spec, params) { - if (isLayerSpec(spec)) { - return this.mapLayer(spec, params); - } - else if (isUnitSpec(spec)) { - return this.mapUnit(spec, params); - } - throw new Error(log.message.invalidSpec(spec)); - } - mapLayer(spec, params) { - return Object.assign(Object.assign({}, spec), { layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params)) }); - } - mapHConcat(spec, params) { - return Object.assign(Object.assign({}, spec), { hconcat: spec.hconcat.map(subspec => this.map(subspec, params)) }); - } - mapVConcat(spec, params) { - return Object.assign(Object.assign({}, spec), { vconcat: spec.vconcat.map(subspec => this.map(subspec, params)) }); - } - mapConcat(spec, params) { - const { concat } = spec, rest = __rest(spec, ["concat"]); - return Object.assign(Object.assign({}, rest), { concat: concat.map(subspec => this.map(subspec, params)) }); - } - mapFacet(spec, params) { - return Object.assign(Object.assign({}, spec), { - // TODO: remove "any" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760 - spec: this.map(spec.spec, params) }); - } - mapRepeat(spec, params) { - return Object.assign(Object.assign({}, spec), { - // as any is required here since TS cannot infer that the output type satisfies the input type - spec: this.map(spec.spec, params) }); - } -} -//# sourceMappingURL=map.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/map.js.map b/node_modules/vega-lite/build/src/spec/map.js.map deleted file mode 100644 index 123a989..0000000 --- a/node_modules/vega-lite/build/src/spec/map.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"map.js","sourceRoot":"","sources":["../../../src/spec/map.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAIL,YAAY,EACZ,aAAa,EACb,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAmB,WAAW,EAAC,MAAM,SAAS,CA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ACxC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/repeat.d.ts b/node_modules/vega-lite/build/src/spec/repeat.d.ts deleted file mode 100644 index ac5ddf0..0000000 --- a/node_modules/vega-lite/build/src/spec/repeat.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { GenericSpec, LayerSpec } from '.'; -import { FieldName } from '../channeldef'; -import { BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins } from './base'; -import { FacetedUnitSpec, UnitSpec } from './unit'; -export interface RepeatMapping { - /** - * An array of fields to be repeated vertically. - */ - row?: string[]; - /** - * An array of fields to be repeated horizontally. - */ - column?: string[]; -} -export interface LayerRepeatMapping extends RepeatMapping { - /** - * An array of fields to be repeated as layers. - */ - layer: string[]; -} -export declare type RepeatSpec = NonLayerRepeatSpec | LayerRepeatSpec; -/** - * Base interface for a repeat specification. - */ -export interface NonLayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { - /** - * Definition for fields to be repeated. One of: - * 1) An array of fields to be repeated. If `"repeat"` is an array, the field can be referred to as `{"repeat": "repeat"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping. - * 2) An object that maps `"row"` and/or `"column"` to the listed fields to be repeated along the particular orientations. The objects `{"repeat": "row"}` and `{"repeat": "column"}` can be used to refer to the repeated field respectively. - */ - repeat: string[] | RepeatMapping; - /** - * A specification of the view that gets repeated. - */ - spec: GenericSpec; -} -export interface LayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { - /** - * Definition for fields to be repeated. One of: - * 1) An array of fields to be repeated. If `"repeat"` is an array, the field can be referred to as `{"repeat": "repeat"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping. - * 2) An object that maps `"row"` and/or `"column"` to the listed fields to be repeated along the particular orientations. The objects `{"repeat": "row"}` and `{"repeat": "column"}` can be used to refer to the repeated field respectively. - */ - repeat: LayerRepeatMapping; - /** - * A specification of the view that gets repeated. - */ - spec: LayerSpec | UnitSpec; -} -export declare function isRepeatSpec(spec: BaseSpec): spec is RepeatSpec; -export declare function isLayerRepeatSpec(spec: RepeatSpec): spec is LayerRepeatSpec; -//# sourceMappingURL=repeat.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/repeat.d.ts.map b/node_modules/vega-lite/build/src/spec/repeat.d.ts.map deleted file mode 100644 index 3a0f04f..0000000 --- a/node_modules/vega-lite/build/src/spec/repeat.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../../src/spec/repeat.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,GAAG,CAAC;AACzC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAE,mCAAmC,EAAE,aAAa,EAAC,MAAM,QAAQ,CAAC;AACpF,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,oBAAY,UAAU,GAAG,kBAAkB,GAAG,eAAe,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,QAAQ,EAAE,mCAAmC,EAAE,aAAa;IACtG;;;;OAIG;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;IAEjC;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,eAAgB,SAAQ,QAAQ,EAAE,mCAAmC,EAAE,aAAa;IACnG;;;;OAIG;IACH,MAAM,EAAE,kBAAkB,CAAC;IAE3B;;OAEG;IACH,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,UAAU,CAE/D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,IAAI,eAAe,CAE3E"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/repeat.js b/node_modules/vega-lite/build/src/spec/repeat.js deleted file mode 100644 index a02da64..0000000 --- a/node_modules/vega-lite/build/src/spec/repeat.js +++ /dev/null @@ -1,8 +0,0 @@ -import { isArray } from 'vega-util'; -export function isRepeatSpec(spec) { - return 'repeat' in spec; -} -export function isLayerRepeatSpec(spec) { - return !isArray(spec.repeat) && spec.repeat['layer']; -} -//# sourceMappingURL=repeat.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/repeat.js.map b/node_modules/vega-lite/build/src/spec/repeat.js.map deleted file mode 100644 index c89bc70..0000000 --- a/node_modules/vega-lite/build/src/spec/repeat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../../src/spec/repeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AA0DlC,MAAM,UAAU,YAAY,CAAC,IAAc;IACzC,OAAO,QAAQ,IAAI,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAgB;IAChD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/toplevel.d.ts b/node_modules/vega-lite/build/src/spec/toplevel.d.ts deleted file mode 100644 index a282788..0000000 --- a/node_modules/vega-lite/build/src/spec/toplevel.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { Color, SignalRef } from 'vega'; -import { BaseSpec } from '.'; -import { Config } from '../config'; -import { InlineDataset } from '../data'; -import { Dict } from '../util'; -/** - * @minimum 0 - */ -export declare type Padding = number | { - top?: number; - bottom?: number; - left?: number; - right?: number; -}; -export declare type Datasets = Dict; -export declare type TopLevel = S & TopLevelProperties & { - /** - * URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema. - * @format uri - */ - $schema?: string; - /** - * Vega-Lite configuration object. This property can only be defined at the top-level of a specification. - */ - config?: Config; - /** - * A global data store for named datasets. This is a mapping from names to inline datasets. - * This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property. - */ - datasets?: Datasets; - /** - * Optional metadata that will be passed to Vega. - * This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata. - */ - usermeta?: Dict; -}; -export interface TopLevelProperties { - /** - * CSS color property to use as the background of the entire view. - * - * __Default value:__ `"white"` - */ - background?: Color | SignalRef; - /** - * The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. - * If an object, the value should have the format `{"left": 5, "top": 5, "right": 5, "bottom": 5}` to specify padding for each side of the visualization. - * - * __Default value__: `5` - */ - padding?: Padding | SignalRef; - /** - * How the visualization size should be determined. If a string, should be one of `"pad"`, `"fit"` or `"none"`. - * Object values can additionally specify parameters for content sizing and automatic resizing. - * - * __Default value__: `pad` - */ - autosize?: AutosizeType | AutoSizeParams; -} -export declare type FitType = 'fit' | 'fit-x' | 'fit-y'; -export declare function isFitType(autoSizeType: AutosizeType): autoSizeType is FitType; -export declare function getFitType(sizeType?: 'width' | 'height'): FitType; -export declare type AutosizeType = 'pad' | 'none' | 'fit' | 'fit-x' | 'fit-y'; -export interface AutoSizeParams { - /** - * The sizing format type. One of `"pad"`, `"fit"`, `"fit-x"`, `"fit-y"`, or `"none"`. See the [autosize type](https://vega.github.io/vega-lite/docs/size.html#autosize) documentation for descriptions of each. - * - * __Default value__: `"pad"` - */ - type?: AutosizeType; - /** - * A boolean flag indicating if autosize layout should be re-calculated on every view update. - * - * __Default value__: `false` - */ - resize?: boolean; - /** - * Determines how size calculation should be performed, one of `"content"` or `"padding"`. The default setting (`"content"`) interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the `"padding"` setting includes the padding within the view size calculations, such that the width and height settings indicate the **total** intended size of the view. - * - * __Default value__: `"content"` - */ - contains?: 'content' | 'padding'; -} -export declare function extractTopLevelProperties(t: T): {}; -//# sourceMappingURL=toplevel.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/toplevel.d.ts.map b/node_modules/vega-lite/build/src/spec/toplevel.d.ts.map deleted file mode 100644 index e0b7687..0000000 --- a/node_modules/vega-lite/build/src/spec/toplevel.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"toplevel.d.ts","sourceRoot":"","sources":["../../../src/spec/toplevel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,GAAG,CAAC;AAE3B,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAE7B;;GAEG;AACH,oBAAY,OAAO,GAAG,MAAM,GAAG;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC;AAE9F,oBAAY,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;AAE3C,oBAAY,QAAQ,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,GAC1C,kBAAkB,GAAG;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;CAC1B,CAAC;AAEJ,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IAE/B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE9B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC;CAC1C;AAED,oBAAY,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAEhD,wBAAgB,SAAS,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,IAAI,OAAO,CAE7E;AAED,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAEjE;AAED,oBAAY,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtE,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IAEpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC;AAQD,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,kBAAkB,EAAE,CAAC,EAAE,CAAC,MAO3E"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/toplevel.js b/node_modules/vega-lite/build/src/spec/toplevel.js deleted file mode 100644 index d828cae..0000000 --- a/node_modules/vega-lite/build/src/spec/toplevel.js +++ /dev/null @@ -1,21 +0,0 @@ -import { getPositionScaleChannel } from '../channel'; -export function isFitType(autoSizeType) { - return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y'; -} -export function getFitType(sizeType) { - return sizeType ? `fit-${getPositionScaleChannel(sizeType)}` : 'fit'; -} -const TOP_LEVEL_PROPERTIES = [ - 'background', - 'padding' - // We do not include "autosize" here as it is supported by only unit and layer specs and thus need to be normalized -]; -export function extractTopLevelProperties(t) { - return TOP_LEVEL_PROPERTIES.reduce((o, p) => { - if (t && t[p] !== undefined) { - o[p] = t[p]; - } - return o; - }, {}); -} -//# sourceMappingURL=toplevel.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/toplevel.js.map b/node_modules/vega-lite/build/src/spec/toplevel.js.map deleted file mode 100644 index 189ad6a..0000000 --- a/node_modules/vega-lite/build/src/spec/toplevel.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"toplevel.js","sourceRoot":"","sources":["../../../src/spec/toplevel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAC;AAiEnD,MAAM,UAAU,SAAS,CAAC,YAA0B;IAClD,OAAO,YAAY,KAAK,KAAK,IAAI,YAAY,KAAK,OAAO,IAAI,YAAY,KAAK,OAAO,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAA6B;IACtD,OAAO,QAAQ,CAAC,CAAC,CAAE,OAAO,uBAAuB,CAAC,QAAQ,CAAC,EAAc,CAAC,CAAC,CAAC,KAAK,CAAC;AACpF,CAAC;AA2BD,MAAM,oBAAoB,GAAiC;IACzD,YAAY;IACZ,SAAS;IACT,mHAAmH;CACpH,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAA+B,CAAI;IAC1E,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;YAC3B,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACb;QACD,OAAO,CAAC,CAAC;IACX,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/unit.d.ts b/node_modules/vega-lite/build/src/spec/unit.d.ts deleted file mode 100644 index 6c7a2c6..0000000 --- a/node_modules/vega-lite/build/src/spec/unit.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { FieldName } from '../channeldef'; -import { CompositeEncoding, FacetedCompositeEncoding } from '../compositemark'; -import { Encoding } from '../encoding'; -import { AnyMark, Mark, MarkDef } from '../mark'; -import { Projection } from '../projection'; -import { SelectionDef } from '../selection'; -import { BaseSpec, DataMixins, DeprecatedFrameMixins, FrameMixins, GenericCompositionLayout, ResolveMixins } from './base'; -import { TopLevel } from './toplevel'; -/** - * Base interface for a unit (single-view) specification. - */ -export interface GenericUnitSpec, M> extends BaseSpec { - /** - * A string describing the mark type (one of `"bar"`, `"circle"`, `"square"`, `"tick"`, `"line"`, - * `"area"`, `"point"`, `"rule"`, `"geoshape"`, and `"text"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def). - */ - mark: M; - /** - * A key-value mapping between encoding channels and definition of fields. - */ - encoding?: E; - /** - * An object defining properties of geographic projection, which will be applied to `shape` path for `"geoshape"` marks - * and to `latitude` and `"longitude"` channels for other marks. - */ - projection?: Projection; - /** - * A key-value mapping between selection names and definitions. - */ - selection?: Record; -} -/** - * A unit specification without any shortcut/expansion syntax. - */ -export declare type NormalizedUnitSpec = GenericUnitSpec, Mark | MarkDef>; -/** - * A unit specification, which can contain either [primitive marks or composite marks](https://vega.github.io/vega-lite/docs/mark.html#types). - */ -export declare type UnitSpec = GenericUnitSpec & DeprecatedFrameMixins; -export declare type UnitSpecWithFrame = GenericUnitSpec & FrameMixins; -/** - * Unit spec that can have a composite mark and row or column channels (shorthand for a facet spec). - */ -export declare type FacetedUnitSpec = GenericUnitSpec & ResolveMixins & GenericCompositionLayout & FrameMixins; -export declare type TopLevelUnitSpec = TopLevel & DataMixins; -export declare function isUnitSpec(spec: BaseSpec): spec is FacetedUnitSpec | NormalizedUnitSpec; -//# sourceMappingURL=unit.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/unit.d.ts.map b/node_modules/vega-lite/build/src/spec/unit.d.ts.map deleted file mode 100644 index 558b838..0000000 --- a/node_modules/vega-lite/build/src/spec/unit.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../../src/spec/unit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,iBAAiB,EAAE,wBAAwB,EAAC,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,QAAQ,EACR,UAAU,EACV,qBAAqB,EACrB,WAAW,EACX,wBAAwB,EACxB,aAAa,EACd,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAE,SAAQ,QAAQ;IAC3E;;;OAGG;IACH,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEb;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,oBAAY,kBAAkB,GAAG,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC;AAEtF;;GAEG;AACH,oBAAY,QAAQ,GAAG,eAAe,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,qBAAqB,CAAC;AAE3F,oBAAY,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,WAAW,CAAC;AAE1F;;GAEG;AACH,oBAAY,eAAe,GAAG,eAAe,CAAC,wBAAwB,EAAE,OAAO,CAAC,GAC9E,aAAa,GACb,wBAAwB,GACxB,WAAW,CAAC;AAEd,oBAAY,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;AAEtE,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,eAAe,GAAG,kBAAkB,CAEvF"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/unit.js b/node_modules/vega-lite/build/src/spec/unit.js deleted file mode 100644 index ec360a6..0000000 --- a/node_modules/vega-lite/build/src/spec/unit.js +++ /dev/null @@ -1,4 +0,0 @@ -export function isUnitSpec(spec) { - return 'mark' in spec; -} -//# sourceMappingURL=unit.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/spec/unit.js.map b/node_modules/vega-lite/build/src/spec/unit.js.map deleted file mode 100644 index e637a11..0000000 --- a/node_modules/vega-lite/build/src/spec/unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unit.js","sourceRoot":"","sources":["../../../src/spec/unit.ts"],"names":[],"mappings":"AAiEA,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,OAAO,MAAM,IAAI,IAAI,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/stack.d.ts b/node_modules/vega-lite/build/src/stack.d.ts deleted file mode 100644 index 1830bc0..0000000 --- a/node_modules/vega-lite/build/src/stack.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { NonPositionChannel } from './channel'; -import { FieldName, TypedFieldDef } from './channeldef'; -import { Encoding } from './encoding'; -import { Mark, MarkDef } from './mark'; -declare const STACK_OFFSET_INDEX: { - readonly zero: 1; - readonly center: 1; - readonly normalize: 1; -}; -export declare type StackOffset = keyof typeof STACK_OFFSET_INDEX; -export declare function isStackOffset(s: string): s is StackOffset; -export interface StackProperties { - /** Dimension axis of the stack. */ - groupbyChannel?: 'x' | 'y' | 'theta' | 'radius'; - /** Field for groupbyChannel. */ - groupbyField?: FieldName; - /** Measure axis of the stack. */ - fieldChannel: 'x' | 'y' | 'theta' | 'radius'; - /** Stack-by fields e.g., color, detail */ - stackBy: { - fieldDef: TypedFieldDef; - channel: NonPositionChannel; - }[]; - /** - * See `stack` property of Position Field Def. - */ - offset: StackOffset; - /** - * Whether this stack will produce impute transform - */ - impute: boolean; -} -export declare const STACKABLE_MARKS: Set<"square" | "circle" | "text" | "point" | "arc" | "area" | "image" | "line" | "rect" | "rule" | "trail" | "geoshape" | "bar" | "tick">; -export declare const STACK_BY_DEFAULT_MARKS: Set<"square" | "circle" | "text" | "point" | "arc" | "area" | "image" | "line" | "rect" | "rule" | "trail" | "geoshape" | "bar" | "tick">; -export declare function stack(m: Mark | MarkDef, encoding: Encoding, opt?: { - disallowNonLinearStack?: boolean; -}): StackProperties; -export {}; -//# sourceMappingURL=stack.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/stack.d.ts.map b/node_modules/vega-lite/build/src/stack.d.ts.map deleted file mode 100644 index 174ba12..0000000 --- a/node_modules/vega-lite/build/src/stack.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/stack.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,kBAAkB,EAAuB,MAAM,WAAW,CAAC;AAC7F,OAAO,EAEL,SAAS,EAMT,aAAa,EAEd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAkB,QAAQ,EAAc,MAAM,YAAY,CAAC;AAElE,OAAO,EAQL,IAAI,EACJ,OAAO,EAMR,MAAM,QAAQ,CAAC;AAIhB,QAAA,MAAM,kBAAkB;;;;CAId,CAAC;AAEX,oBAAY,WAAW,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAE1D,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,WAAW,CAEzD;AAED,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,cAAc,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,CAAC;IAEhD,gCAAgC;IAChC,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB,iCAAiC;IACjC,YAAY,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,CAAC;IAE7C,0CAA0C;IAC1C,OAAO,EAAE;QACP,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,EAAE,kBAAkB,CAAC;KAC7B,EAAE,CAAC;IAEJ;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,2IAAiF,CAAC;AAC9G,eAAO,MAAM,sBAAsB,2IAAkC,CAAC;AA6DtE,wBAAgB,KAAK,CACnB,CAAC,EAAE,IAAI,GAAG,OAAO,EACjB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC1B,GAAG,GAAE;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC7B,GACL,eAAe,CA8GjB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/stack.js b/node_modules/vega-lite/build/src/stack.js deleted file mode 100644 index 5c8db01..0000000 --- a/node_modules/vega-lite/build/src/stack.js +++ /dev/null @@ -1,176 +0,0 @@ -import { array, isBoolean } from 'vega-util'; -import { SUM_OPS } from './aggregate'; -import { getSecondaryRangeChannel, NONPOSITION_CHANNELS } from './channel'; -import { channelDefType, getFieldDef, isFieldDef, isFieldOrDatumDef, vgField } from './channeldef'; -import { channelHasField, isAggregate } from './encoding'; -import * as log from './log'; -import { ARC, AREA, BAR, CIRCLE, isMarkDef, isPathMark, LINE, POINT, RULE, SQUARE, TEXT, TICK } from './mark'; -import { ScaleType } from './scale'; -import { contains } from './util'; -const STACK_OFFSET_INDEX = { - zero: 1, - center: 1, - normalize: 1 -}; -export function isStackOffset(s) { - return s in STACK_OFFSET_INDEX; -} -export const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]); -export const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]); -function potentialStackedChannel(encoding, x) { - var _a, _b; - const y = x === 'x' ? 'y' : 'radius'; - const xDef = encoding[x]; - const yDef = encoding[y]; - if (isFieldDef(xDef) && isFieldDef(yDef)) { - if (channelDefType(xDef) === 'quantitative' && channelDefType(yDef) === 'quantitative') { - if (xDef.stack) { - return x; - } - else if (yDef.stack) { - return y; - } - const xAggregate = isFieldDef(xDef) && !!xDef.aggregate; - const yAggregate = isFieldDef(yDef) && !!yDef.aggregate; - // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y - if (xAggregate !== yAggregate) { - return xAggregate ? x : y; - } - else { - const xScale = (_a = xDef.scale) === null || _a === void 0 ? void 0 : _a.type; - const yScale = (_b = yDef.scale) === null || _b === void 0 ? void 0 : _b.type; - if (xScale && xScale !== 'linear') { - return y; - } - else if (yScale && yScale !== 'linear') { - return x; - } - } - } - else if (channelDefType(xDef) === 'quantitative') { - return x; - } - else if (channelDefType(yDef) === 'quantitative') { - return y; - } - } - else if (channelDefType(xDef) === 'quantitative') { - return x; - } - else if (channelDefType(yDef) === 'quantitative') { - return y; - } - return undefined; -} -function getDimensionChannel(channel) { - switch (channel) { - case 'x': - return 'y'; - case 'y': - return 'x'; - case 'theta': - return 'radius'; - case 'radius': - return 'theta'; - } -} -// Note: CompassQL uses this method and only pass in required properties of each argument object. -// If required properties change, make sure to update CompassQL. -export function stack(m, encoding, opt = {}) { - const mark = isMarkDef(m) ? m.type : m; - // Should have stackable mark - if (!STACKABLE_MARKS.has(mark)) { - return null; - } - // Run potential stacked twice, one for Cartesian and another for Polar, - // so text marks can be stacked in any of the coordinates. - // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking. - // However, since we probably never want to do that, let's just note the limitation here. - const fieldChannel = potentialStackedChannel(encoding, 'x') || potentialStackedChannel(encoding, 'theta'); - if (!fieldChannel) { - return null; - } - const stackedFieldDef = encoding[fieldChannel]; - const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined; - let dimensionChannel = getDimensionChannel(fieldChannel); - let dimensionDef = encoding[dimensionChannel]; - let dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined; - // avoid grouping by the stacked field - if (dimensionField === stackedField) { - dimensionField = undefined; - dimensionDef = undefined; - dimensionChannel = undefined; - } - // Should have grouping level of detail that is different from the dimension field - const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => { - // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001) - if (channel !== 'tooltip' && channelHasField(encoding, channel)) { - const channelDef = encoding[channel]; - for (const cDef of array(channelDef)) { - const fieldDef = getFieldDef(cDef); - if (fieldDef.aggregate) { - continue; - } - // Check whether the channel's field is identical to x/y's field or if the channel is a repeat - const f = vgField(fieldDef, {}); - if ( - // if fielddef is a repeat, just include it in the stack by - !f || - // otherwise, the field must be different from x and y fields. - f !== dimensionField) { - sc.push({ channel, fieldDef }); - } - } - } - return sc; - }, []); - // Automatically determine offset - let offset; - if (stackedFieldDef.stack !== undefined) { - if (isBoolean(stackedFieldDef.stack)) { - offset = stackedFieldDef.stack ? 'zero' : null; - } - else { - offset = stackedFieldDef.stack; - } - } - else if (stackBy.length > 0 && STACK_BY_DEFAULT_MARKS.has(mark)) { - // Bar and Area with sum ops are automatically stacked by default - offset = 'zero'; - } - if (!offset || !isStackOffset(offset)) { - return null; - } - if (isAggregate(encoding) && stackBy.length === 0) { - return null; - } - // warn when stacking non-linear - if (stackedFieldDef.scale && stackedFieldDef.scale.type && stackedFieldDef.scale.type !== ScaleType.LINEAR) { - if (opt.disallowNonLinearStack) { - return null; - } - else { - log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type)); - } - } - // Check if it is a ranged mark - if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) { - if (stackedFieldDef.stack !== undefined) { - log.warn(log.message.cannotStackRangedMark(fieldChannel)); - } - return null; - } - // Warn if stacking non-summative aggregate - if (isFieldDef(stackedFieldDef) && stackedFieldDef.aggregate && !contains(SUM_OPS, stackedFieldDef.aggregate)) { - log.warn(log.message.stackNonSummativeAggregate(stackedFieldDef.aggregate)); - } - return { - groupbyChannel: dimensionDef ? dimensionChannel : undefined, - groupbyField: dimensionField, - fieldChannel, - impute: stackedFieldDef.impute === null ? false : isPathMark(mark), - stackBy, - offset - }; -} -//# sourceMappingURL=stack.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/stack.js.map b/node_modules/vega-lite/build/src/stack.js.map deleted file mode 100644 index a4fa2c6..0000000 --- a/node_modules/vega-lite/build/src/stack.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../src/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,wBAAwB,EAAsB,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAC7F,OAAO,EACL,cAAc,EAEd,WAAW,EACX,UA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,YAAY,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS;QAC3D,YAAY,EAAE,cAAc;QAC5B,YAAY;QACZ,MAAM,EAAE,eAAe,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;QAClE,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/timeunit.d.ts b/node_modules/vega-lite/build/src/timeunit.d.ts deleted file mode 100644 index a914732..0000000 --- a/node_modules/vega-lite/build/src/timeunit.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -/** Time Unit that only corresponds to only one part of Date objects. */ -export declare const LOCAL_SINGLE_TIMEUNIT_INDEX: { - readonly year: 1; - readonly quarter: 1; - readonly month: 1; - readonly week: 1; - readonly day: 1; - readonly dayofyear: 1; - readonly date: 1; - readonly hours: 1; - readonly minutes: 1; - readonly seconds: 1; - readonly milliseconds: 1; -}; -export declare type LocalSingleTimeUnit = keyof typeof LOCAL_SINGLE_TIMEUNIT_INDEX; -export declare const TIMEUNIT_PARTS: import("vega-typings/types").TimeUnit[]; -export declare function isLocalSingleTimeUnit(timeUnit: string): timeUnit is LocalSingleTimeUnit; -export declare const UTC_SINGLE_TIMEUNIT_INDEX: { - readonly utcyear: 1; - readonly utcquarter: 1; - readonly utcmonth: 1; - readonly utcweek: 1; - readonly utcday: 1; - readonly utcdayofyear: 1; - readonly utcdate: 1; - readonly utchours: 1; - readonly utcminutes: 1; - readonly utcseconds: 1; - readonly utcmilliseconds: 1; -}; -export declare type UtcSingleTimeUnit = keyof typeof UTC_SINGLE_TIMEUNIT_INDEX; -export declare type SingleTimeUnit = LocalSingleTimeUnit | UtcSingleTimeUnit; -export declare const LOCAL_MULTI_TIMEUNIT_INDEX: { - readonly yearquarter: 1; - readonly yearquartermonth: 1; - readonly yearmonth: 1; - readonly yearmonthdate: 1; - readonly yearmonthdatehours: 1; - readonly yearmonthdatehoursminutes: 1; - readonly yearmonthdatehoursminutesseconds: 1; - readonly yearweek: 1; - readonly yearweekday: 1; - readonly yearweekdayhours: 1; - readonly yearweekdayhoursminutes: 1; - readonly yearweekdayhoursminutesseconds: 1; - readonly yeardayofyear: 1; - readonly quartermonth: 1; - readonly monthdate: 1; - readonly monthdatehours: 1; - readonly monthdatehoursminutes: 1; - readonly monthdatehoursminutesseconds: 1; - readonly weekday: 1; - readonly weeksdayhours: 1; - readonly weekdayhoursminutes: 1; - readonly weekdayhoursminutesseconds: 1; - readonly dayhours: 1; - readonly dayhoursminutes: 1; - readonly dayhoursminutesseconds: 1; - readonly hoursminutes: 1; - readonly hoursminutesseconds: 1; - readonly minutesseconds: 1; - readonly secondsmilliseconds: 1; -}; -export declare type LocalMultiTimeUnit = keyof typeof LOCAL_MULTI_TIMEUNIT_INDEX; -export declare const UTC_MULTI_TIMEUNIT_INDEX: { - readonly utcyearquarter: 1; - readonly utcyearquartermonth: 1; - readonly utcyearmonth: 1; - readonly utcyearmonthdate: 1; - readonly utcyearmonthdatehours: 1; - readonly utcyearmonthdatehoursminutes: 1; - readonly utcyearmonthdatehoursminutesseconds: 1; - readonly utcyearweek: 1; - readonly utcyearweekday: 1; - readonly utcyearweekdayhours: 1; - readonly utcyearweekdayhoursminutes: 1; - readonly utcyearweekdayhoursminutesseconds: 1; - readonly utcyeardayofyear: 1; - readonly utcquartermonth: 1; - readonly utcmonthdate: 1; - readonly utcmonthdatehours: 1; - readonly utcmonthdatehoursminutes: 1; - readonly utcmonthdatehoursminutesseconds: 1; - readonly utcweekday: 1; - readonly utcweeksdayhours: 1; - readonly utcweekdayhoursminutes: 1; - readonly utcweekdayhoursminutesseconds: 1; - readonly utcdayhours: 1; - readonly utcdayhoursminutes: 1; - readonly utcdayhoursminutesseconds: 1; - readonly utchoursminutes: 1; - readonly utchoursminutesseconds: 1; - readonly utcminutesseconds: 1; - readonly utcsecondsmilliseconds: 1; -}; -export declare type UtcMultiTimeUnit = keyof typeof UTC_MULTI_TIMEUNIT_INDEX; -export declare type MultiTimeUnit = LocalMultiTimeUnit | UtcMultiTimeUnit; -export declare type LocalTimeUnit = LocalSingleTimeUnit | LocalMultiTimeUnit; -export declare type UtcTimeUnit = UtcSingleTimeUnit | UtcMultiTimeUnit; -export declare function isUTCTimeUnit(t: string): t is UtcTimeUnit; -export declare function getLocalTimeUnit(t: UtcTimeUnit): LocalTimeUnit; -export declare type TimeUnit = SingleTimeUnit | MultiTimeUnit; -export declare type TimeUnitFormat = 'year' | 'year-month' | 'year-month-date' | 'quarter' | 'month' | 'date' | 'week' | 'day' | 'hours' | 'hours-minutes' | 'minutes' | 'seconds' | 'milliseconds'; -export interface TimeUnitParams { - /** - * Defines how date-time values should be binned. - */ - unit?: TimeUnit; - /** - * If no `unit` is specified, maxbins is used to infer time units. - */ - maxbins?: number; - /** - * The number of steps between bins, in terms of the least - * significant unit provided. - */ - step?: number; - /** - * True to use UTC timezone. Equivalent to using a `utc` prefixed `TimeUnit`. - */ - utc?: boolean; -} -export declare type TimeFormatConfig = Partial>; -export declare const VEGALITE_TIMEFORMAT: TimeFormatConfig; -export declare function getTimeUnitParts(timeUnit: TimeUnit): import("vega-typings/types").TimeUnit[]; -/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */ -export declare function containsTimeUnit(fullTimeUnit: TimeUnit, timeUnit: TimeUnit): boolean; -/** - * Returns Vega expression for a given timeUnit and fieldRef - */ -export declare function fieldExpr(fullTimeUnit: TimeUnit, field: string, { end }?: { - end: boolean; -}): string; -export declare function timeUnitSpecifierExpression(timeUnit: TimeUnit): string; -/** - * Returns the signal expression used for axis labels for a time unit. - */ -export declare function formatExpression(timeUnit: TimeUnit, field: string, isUTCScale: boolean): string; -export declare function normalizeTimeUnit(timeUnit: TimeUnit | TimeUnitParams): TimeUnitParams; -export declare function timeUnitToString(tu: TimeUnit | TimeUnitParams): string; -//# sourceMappingURL=timeunit.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/timeunit.d.ts.map b/node_modules/vega-lite/build/src/timeunit.d.ts.map deleted file mode 100644 index 00b9b34..0000000 --- a/node_modules/vega-lite/build/src/timeunit.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"timeunit.d.ts","sourceRoot":"","sources":["../../src/timeunit.ts"],"names":[],"mappings":"AAKA,wEAAwE;AACxE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;CAY9B,CAAC;AAEX,oBAAY,mBAAmB,GAAG,MAAM,OAAO,2BAA2B,CAAC;AAE3E,eAAO,MAAM,cAAc,yCAAoC,CAAC;AAEhE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,mBAAmB,CAEvF;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;CAY5B,CAAC;AAEX,oBAAY,iBAAiB,GAAG,MAAM,OAAO,yBAAyB,CAAC;AAEvE,oBAAY,cAAc,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAErE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC7B,CAAC;AAEX,oBAAY,kBAAkB,GAAG,MAAM,OAAO,0BAA0B,CAAC;AAEzE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC3B,CAAC;AAEX,oBAAY,gBAAgB,GAAG,MAAM,OAAO,wBAAwB,CAAC;AAErE,oBAAY,aAAa,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAElE,oBAAY,aAAa,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AACrE,oBAAY,WAAW,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAE/D,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,WAAW,CAEzD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,WAAW,GAAG,aAAa,CAE9D;AAED,oBAAY,QAAQ,GAAG,cAAc,GAAG,aAA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/build/src/timeunit.js b/node_modules/vega-lite/build/src/timeunit.js deleted file mode 100644 index 5169efb..0000000 --- a/node_modules/vega-lite/build/src/timeunit.js +++ /dev/null @@ -1,223 +0,0 @@ -import { __rest } from "tslib"; -import stringify from 'fast-json-stable-stringify'; -import { isObject, isString } from 'vega-util'; -import { dateTimeExprToExpr } from './datetime'; -import { accessPathWithDatum, keys, varName } from './util'; -/** Time Unit that only corresponds to only one part of Date objects. */ -export const LOCAL_SINGLE_TIMEUNIT_INDEX = { - year: 1, - quarter: 1, - month: 1, - week: 1, - day: 1, - dayofyear: 1, - date: 1, - hours: 1, - minutes: 1, - seconds: 1, - milliseconds: 1 -}; -export const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX); -export function isLocalSingleTimeUnit(timeUnit) { - return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit]; -} -export const UTC_SINGLE_TIMEUNIT_INDEX = { - utcyear: 1, - utcquarter: 1, - utcmonth: 1, - utcweek: 1, - utcday: 1, - utcdayofyear: 1, - utcdate: 1, - utchours: 1, - utcminutes: 1, - utcseconds: 1, - utcmilliseconds: 1 -}; -export const LOCAL_MULTI_TIMEUNIT_INDEX = { - yearquarter: 1, - yearquartermonth: 1, - yearmonth: 1, - yearmonthdate: 1, - yearmonthdatehours: 1, - yearmonthdatehoursminutes: 1, - yearmonthdatehoursminutesseconds: 1, - yearweek: 1, - yearweekday: 1, - yearweekdayhours: 1, - yearweekdayhoursminutes: 1, - yearweekdayhoursminutesseconds: 1, - yeardayofyear: 1, - quartermonth: 1, - monthdate: 1, - monthdatehours: 1, - monthdatehoursminutes: 1, - monthdatehoursminutesseconds: 1, - weekday: 1, - weeksdayhours: 1, - weekdayhoursminutes: 1, - weekdayhoursminutesseconds: 1, - dayhours: 1, - dayhoursminutes: 1, - dayhoursminutesseconds: 1, - hoursminutes: 1, - hoursminutesseconds: 1, - minutesseconds: 1, - secondsmilliseconds: 1 -}; -export const UTC_MULTI_TIMEUNIT_INDEX = { - utcyearquarter: 1, - utcyearquartermonth: 1, - utcyearmonth: 1, - utcyearmonthdate: 1, - utcyearmonthdatehours: 1, - utcyearmonthdatehoursminutes: 1, - utcyearmonthdatehoursminutesseconds: 1, - utcyearweek: 1, - utcyearweekday: 1, - utcyearweekdayhours: 1, - utcyearweekdayhoursminutes: 1, - utcyearweekdayhoursminutesseconds: 1, - utcyeardayofyear: 1, - utcquartermonth: 1, - utcmonthdate: 1, - utcmonthdatehours: 1, - utcmonthdatehoursminutes: 1, - utcmonthdatehoursminutesseconds: 1, - utcweekday: 1, - utcweeksdayhours: 1, - utcweekdayhoursminutes: 1, - utcweekdayhoursminutesseconds: 1, - utcdayhours: 1, - utcdayhoursminutes: 1, - utcdayhoursminutesseconds: 1, - utchoursminutes: 1, - utchoursminutesseconds: 1, - utcminutesseconds: 1, - utcsecondsmilliseconds: 1 -}; -export function isUTCTimeUnit(t) { - return t.startsWith('utc'); -} -export function getLocalTimeUnit(t) { - return t.substr(3); -} -// In order of increasing specificity -export const VEGALITE_TIMEFORMAT = { - 'year-month': '%b %Y ', - 'year-month-date': '%b %d, %Y ' -}; -export function getTimeUnitParts(timeUnit) { - const parts = []; - for (const part of TIMEUNIT_PARTS) { - if (containsTimeUnit(timeUnit, part)) { - parts.push(part); - } - } - return parts; -} -/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */ -export function containsTimeUnit(fullTimeUnit, timeUnit) { - const index = fullTimeUnit.indexOf(timeUnit); - if (index < 0) { - return false; - } - // exclude milliseconds - if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') { - return false; - } - // exclude dayofyear - if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') { - return false; - } - if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') { - return false; - } - return true; -} -/** - * Returns Vega expression for a given timeUnit and fieldRef - */ -export function fieldExpr(fullTimeUnit, field, { end } = { end: false }) { - const fieldRef = accessPathWithDatum(field); - const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : ''; - function func(timeUnit) { - if (timeUnit === 'quarter') { - // quarter starting at 0 (0,3,6,9). - return `(${utc}quarter(${fieldRef})-1)`; - } - else { - return `${utc}${timeUnit}(${fieldRef})`; - } - } - let lastTimeUnit; - const dateExpr = {}; - for (const part of TIMEUNIT_PARTS) { - if (containsTimeUnit(fullTimeUnit, part)) { - dateExpr[part] = func(part); - lastTimeUnit = part; - } - } - if (end) { - dateExpr[lastTimeUnit] += '+1'; - } - return dateTimeExprToExpr(dateExpr); -} -export function timeUnitSpecifierExpression(timeUnit) { - if (!timeUnit) { - return undefined; - } - const timeUnitParts = getTimeUnitParts(timeUnit); - return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`; -} -/** - * Returns the signal expression used for axis labels for a time unit. - */ -export function formatExpression(timeUnit, field, isUTCScale) { - if (!timeUnit) { - return undefined; - } - const expr = timeUnitSpecifierExpression(timeUnit); - // We only use utcFormat for utc scale - // For utc time units, the data is already converted as a part of timeUnit transform. - // Thus, utc time units should use timeFormat to avoid shifting the time twice. - const utc = isUTCScale || isUTCTimeUnit(timeUnit); - return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`; -} -export function normalizeTimeUnit(timeUnit) { - if (!timeUnit) { - return undefined; - } - let params; - if (isString(timeUnit)) { - params = { - unit: timeUnit - }; - } - else if (isObject(timeUnit)) { - params = Object.assign(Object.assign({}, timeUnit), (timeUnit.unit ? { unit: timeUnit.unit } : {})); - } - if (isUTCTimeUnit(params.unit)) { - params.utc = true; - params.unit = getLocalTimeUnit(params.unit); - } - return params; -} -export function timeUnitToString(tu) { - const _a = normalizeTimeUnit(tu), { utc } = _a, rest = __rest(_a, ["utc"]); - if (rest.unit) { - return ((utc ? 'utc' : '') + - keys(rest) - .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`)) - .join('')); - } - else { - // when maxbins is specified instead of units - return ((utc ? 'utc' : '') + - 'timeunit' + - keys(rest) - .map(p => varName(`_${p}_${rest[p]}`)) - .join('')); - } -} -//# sourceMappingURL=timeunit.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/timeunit.js.map b/node_modules/vega-lite/build/src/timeunit.js.map deleted file mode 100644 index e4ad616..0000000 --- a/node_modules/vega-lite/build/src/timeunit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"timeunit.js","sourceRoot":"","sources":["../../src/timeunit.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAe,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAC,mBAAmB,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AAE1D,wEAAwE;AACxE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,GAAG,EAAE,CAAC;IACN,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,CAAC;CACP,CAAC;AAIX,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,2BAA2B,CAAC,CAAC;AAEhE,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,OAAO,CAAC,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC;IACb,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,YAAY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;KACH;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/title.d.ts b/node_modules/vega-lite/build/src/title.d.ts deleted file mode 100644 index 31892bf..0000000 --- a/node_modules/vega-lite/build/src/title.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { BaseTitle, Text, TextEncodeEntry, TitleAnchor } from 'vega'; -import { MarkConfig } from './mark'; -import { ExcludeMappedValueRef, ExcludeMappedValueRefButKeepSignal } from './vega.schema'; -export declare type BaseTitleNoValueRefs = ExcludeMappedValueRefButKeepSignal> & ExcludeMappedValueRef>; -export declare type TitleConfig = BaseTitleNoValueRefs; -export interface TitleBase extends BaseTitleNoValueRefs { - /** - * The anchor position for placing the title. One of `"start"`, `"middle"`, or `"end"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title. - * - * __Default value:__ `"middle"` for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. - * `"start"` for other composite views. - * - * __Note:__ [For now](https://github.com/vega/vega-lite/issues/2875), `anchor` is only customizable only for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. For other composite views, `anchor` is always `"start"`. - */ - anchor?: TitleAnchor; - /** - * A [mark style property](https://vega.github.io/vega-lite/docs/config.html#style) to apply to the title text mark. - * - * __Default value:__ `"group-title"`. - */ - style?: string | string[]; - /** - * The integer z-index indicating the layering of the title group relative to other axis, mark and legend groups. - * - * __Default value:__ `0`. - * - * @TJS-type integer - * @minimum 0 - */ - zindex?: number; - /** - * Mark definitions for custom encoding. - * - * @hidden - */ - encoding?: TextEncodeEntry; -} -export interface TitleParams extends TitleBase { - /** - * The title text. - */ - text: Text; - /** - * The subtitle Text. - */ - subtitle?: Text; -} -export declare function extractTitleConfig(titleConfig: TitleConfig): { - titleMarkConfig: MarkConfig; - subtitleMarkConfig: MarkConfig; - nonMark: BaseTitleNoValueRefs; - subtitle: BaseTitleNoValueRefs; -}; -export declare function isText(v: any): v is Text; -//# sourceMappingURL=title.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/title.d.ts.map b/node_modules/vega-lite/build/src/title.d.ts.map deleted file mode 100644 index eecbf6b..0000000 --- a/node_modules/vega-lite/build/src/title.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../src/title.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AAEnE,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAC,qBAAqB,EAAE,kCAAkC,EAAC,MAAM,eAAe,CAAC;AAExF,oBAAY,oBAAoB,GAAG,kCAAkC,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,GAE1G,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC;AAE/D,oBAAY,WAAW,GAAG,oBAAoB,CAAC;AAE/C,MAAM,WAAW,SAAU,SAAQ,oBAAoB;IACrD;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE1B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;OAEG;IACH,QAAQ,CAAC,EAAE,IAAI,CAAC;CACjB;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,WAAW,GACvB;IACD,eAAe,EAAE,UAAU,CAAC;IAC5B,kBAAkB,EAAE,UAAU,CAAC;IAC/B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,QAAQ,EAAE,oBAAoB,CAAC;CAChC,CAmDA;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,CAExC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/title.js b/node_modules/vega-lite/build/src/title.js deleted file mode 100644 index f75aa1a..0000000 --- a/node_modules/vega-lite/build/src/title.js +++ /dev/null @@ -1,25 +0,0 @@ -import { __rest } from "tslib"; -import { isArray, isString } from 'vega-util'; -import { pick } from './util'; -export function extractTitleConfig(titleConfig) { - const { - // These are non-mark title config that need to be hardcoded - anchor, frame, offset, orient, - // color needs to be redirect to fill - color, - // subtitle properties - subtitleColor, subtitleFont, subtitleFontSize, subtitleFontStyle, subtitleFontWeight, subtitleLineHeight, subtitlePadding } = titleConfig, - // The rest are mark config. - rest = __rest(titleConfig, ["anchor", "frame", "offset", "orient", "color", "subtitleColor", "subtitleFont", "subtitleFontSize", "subtitleFontStyle", "subtitleFontWeight", "subtitleLineHeight", "subtitlePadding"]); - const titleMarkConfig = Object.assign(Object.assign({}, rest), (color ? { fill: color } : {})); - // These are non-mark title config that need to be hardcoded - const nonMark = Object.assign(Object.assign(Object.assign(Object.assign({}, (anchor ? { anchor } : {})), (frame ? { frame } : {})), (offset ? { offset } : {})), (orient ? { orient } : {})); - // subtitle part can stay in config.title since header titles do not use subtitle - const subtitle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (subtitleColor ? { subtitleColor } : {})), (subtitleFont ? { subtitleFont } : {})), (subtitleFontSize ? { subtitleFontSize } : {})), (subtitleFontStyle ? { subtitleFontStyle } : {})), (subtitleFontWeight ? { subtitleFontWeight } : {})), (subtitleLineHeight ? { subtitleLineHeight } : {})), (subtitlePadding ? { subtitlePadding } : {})); - const subtitleMarkConfig = pick(titleMarkConfig, ['align', 'baseline', 'dx', 'dy', 'limit']); - return { titleMarkConfig, subtitleMarkConfig, nonMark, subtitle }; -} -export function isText(v) { - return isString(v) || (isArray(v) && isString(v[0])); -} -//# sourceMappingURL=title.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/title.js.map b/node_modules/vega-lite/build/src/title.js.map deleted file mode 100644 index db13de6..0000000 --- a/node_modules/vega-lite/build/src/title.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"title.js","sourceRoot":"","sources":["../../src/title.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAyD5B,MAAM,UAAU,kBAAkB,CAChC,WAAwB;IAOxB,MAAM;IACJ,4DAA4D;IAC5D,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM;IAEN,qCAAqC;IACrC,KAAK;IAEL,sBAAsB;IACtB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,KAIb,WAAW;IAFb,4BAA4B;IACzB,IAAI,UACL,WAAW,EArBT,yLAqBL,CAAc,CAAC;IAEhB,MAAM,eAAe,mCAChB,IAAI,GACJ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAChC,CAAC;IAEF,4DAA4D;IAC5D,MAAM,OAAO,+DACR,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACxB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACtB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACxB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAC5B,CAAC;IAEF,iFAAiF;IACjF,MAAM,QAAQ,yGACT,CAAC,aAAa,CAAC,CAAC,CAAC,EAAC,aAAa,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACtC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAC,YAAY,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACpC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAC,gBAAgB,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAC5C,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAC,iBAAiB,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAC9C,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAC,kBAAkB,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAChD,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAC,kBAAkB,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAChD,CAAC,eAAe,CAAC,CAAC,CAAC,EAAC,eAAe,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAC9C,CAAC;IAEF,MAAM,kBAAkB,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7F,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,OAAO,EAAE,QAAQ,EAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,CAAM;IAC3B,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/transform.d.ts b/node_modules/vega-lite/build/src/transform.d.ts deleted file mode 100644 index 36bc6bd..0000000 --- a/node_modules/vega-lite/build/src/transform.d.ts +++ /dev/null @@ -1,510 +0,0 @@ -import { AggregateOp } from 'vega'; -import { BinParams } from './bin'; -import { FieldName } from './channeldef'; -import { Data } from './data'; -import { ImputeParams } from './impute'; -import { LogicalComposition } from './logical'; -import { Predicate } from './predicate'; -import { SortField } from './sort'; -import { TimeUnit, TimeUnitParams } from './timeunit'; -export interface FilterTransform { - /** - * The `filter` property must be a predication definition, which can takes one of the following forms: - * - * 1) an [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string, - * where `datum` can be used to refer to the current data object. - * For example, `{filter: "datum.b2 > 60"}` would make the output data includes only items that have values in the field `b2` over 60. - * - * 2) one of the [field predicates](https://vega.github.io/vega-lite/docs/predicate.html#field-predicate): - * [`equal`](https://vega.github.io/vega-lite/docs/predicate.html#field-equal-predicate), - * [`lt`](https://vega.github.io/vega-lite/docs/predicate.html#lt-predicate), - * [`lte`](https://vega.github.io/vega-lite/docs/predicate.html#lte-predicate), - * [`gt`](https://vega.github.io/vega-lite/docs/predicate.html#gt-predicate), - * [`gte`](https://vega.github.io/vega-lite/docs/predicate.html#gte-predicate), - * [`range`](https://vega.github.io/vega-lite/docs/predicate.html#range-predicate), - * [`oneOf`](https://vega.github.io/vega-lite/docs/predicate.html#one-of-predicate), - * or [`valid`](https://vega.github.io/vega-lite/docs/predicate.html#valid-predicate), - - * 3) a [selection predicate](https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate), which define the names of a selection that the data point should belong to (or a logical composition of selections). - * - * 4) a [logical composition](https://vega.github.io/vega-lite/docs/predicate.html#composition) of (1), (2), or (3). - */ - filter: LogicalComposition; -} -export declare function isFilter(t: Transform): t is FilterTransform; -export interface CalculateTransform { - /** - * A [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string. Use the variable `datum` to refer to the current data object. - */ - calculate: string; - /** - * The field for storing the computed formula value. - */ - as: FieldName; -} -export interface BinTransform { - /** - * An object indicating bin properties, or simply `true` for using default bin parameters. - */ - bin: true | BinParams; - /** - * The data field to bin. - */ - field: FieldName; - /** - * The output fields at which to write the start and end bin values. - * This can be either a string or an array of strings with two elements denoting the name for the fields for bin start and bin end respectively. - * If a single string (e.g., `"val"`) is provided, the end field will be `"val_end"`. - */ - as: FieldName | FieldName[]; -} -export interface TimeUnitTransform { - /** - * The timeUnit. - */ - timeUnit: TimeUnit | TimeUnitParams; - /** - * The data field to apply time unit. - */ - field: FieldName; - /** - * The output field to write the timeUnit value. - */ - as: FieldName; -} -export interface AggregateTransform { - /** - * Array of objects that define fields to aggregate. - */ - aggregate: AggregatedFieldDef[]; - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; -} -export interface AggregatedFieldDef { - /** - * The aggregation operation to apply to the fields (e.g., `"sum"`, `"average"`, or `"count"`). - * See the [full list of supported aggregation operations](https://vega.github.io/vega-lite/docs/aggregate.html#ops) - * for more information. - */ - op: AggregateOp; - /** - * The data field for which to compute aggregate function. This is required for all aggregation operations except `"count"`. - */ - field?: FieldName; - /** - * The output field names to use for each aggregated field. - */ - as: FieldName; -} -export interface StackTransform { - /** - * The field which is stacked. - */ - stack: FieldName; - /** - * The data fields to group by. - */ - groupby: FieldName[]; - /** - * Mode for stacking marks. One of `"zero"` (default), `"center"`, or `"normalize"`. - * The `"zero"` offset will stack starting at `0`. The `"center"` offset will center the stacks. The `"normalize"` offset will compute percentage values for each stack point, with output values in the range `[0,1]`. - * - * __Default value:__ `"zero"` - */ - offset?: 'zero' | 'center' | 'normalize'; - /** - * Field that determines the order of leaves in the stacked charts. - */ - sort?: SortField[]; - /** - * Output field names. This can be either a string or an array of strings with two elements denoting the name for the fields for stack start and stack end respectively. - * If a single string(e.g., `"val"`) is provided, the end field will be `"val_end"`. - */ - as: FieldName | [FieldName, FieldName]; -} -export declare type WindowOnlyOp = 'row_number' | 'rank' | 'dense_rank' | 'percent_rank' | 'cume_dist' | 'ntile' | 'lag' | 'lead' | 'first_value' | 'last_value' | 'nth_value'; -export interface WindowFieldDef { - /** - * The window or aggregation operation to apply within a window (e.g., `"rank"`, `"lead"`, `"sum"`, `"average"` or `"count"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/window.html#ops). - */ - op: AggregateOp | WindowOnlyOp; - /** - * Parameter values for the window functions. Parameter values can be omitted for operations that do not accept a parameter. - * - * See the list of all supported operations and their parameters [here](https://vega.github.io/vega-lite/docs/transforms/window.html). - */ - param?: number; - /** - * The data field for which to compute the aggregate or window function. This can be omitted for window functions that do not operate over a field such as `"count"`, `"rank"`, `"dense_rank"`. - */ - field?: FieldName; - /** - * The output name for the window operation. - */ - as: FieldName; -} -export interface WindowTransform { - /** - * The definition of the fields in the window, and what calculations to use. - */ - window: WindowFieldDef[]; - /** - * A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is `[null, 0]`, indicating that the sliding window includes the current object and all preceding objects. The value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. Finally, `[null, null]` indicates that the window frame should always include all data objects. If you this frame and want to assign the same value to add objects, you can use the simpler [join aggregate transform](https://vega.github.io/vega-lite/docs/joinaggregate.html). The only operators affected are the aggregation operations and the `first_value`, `last_value`, and `nth_value` window operations. The other window operations are not affected by this. - * - * __Default value:__: `[null, 0]` (includes the current object and all preceding objects) - */ - frame?: (null | number)[]; - /** - * Indicates if the sliding window frame should ignore peer values (data that are considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations. - * - * __Default value:__ `false` - */ - ignorePeers?: boolean; - /** - * The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single window. - */ - groupby?: FieldName[]; - /** - * A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered "peer" values of equal rank. If sort is not specified, the order is undefined: data objects are processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to `true`). - */ - sort?: SortField[]; -} -export interface JoinAggregateFieldDef { - /** - * The aggregation operation to apply (e.g., `"sum"`, `"average"` or `"count"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/aggregate.html#ops). - */ - op: AggregateOp; - /** - * The data field for which to compute the aggregate function. This can be omitted for functions that do not operate over a field such as `"count"`. - */ - field?: FieldName; - /** - * The output name for the join aggregate operation. - */ - as: FieldName; -} -export interface JoinAggregateTransform { - /** - * The definition of the fields in the join aggregate, and what calculations to use. - */ - joinaggregate: JoinAggregateFieldDef[]; - /** - * The data fields for partitioning the data objects into separate groups. If unspecified, all data points will be in a single group. - */ - groupby?: FieldName[]; -} -export interface ImputeSequence { - /** - * The starting value of the sequence. - * __Default value:__ `0` - */ - start?: number; - /** - * The ending value(exclusive) of the sequence. - */ - stop: number; - /** - * The step value between sequence entries. - * __Default value:__ `1` or `-1` if `stop < start` - */ - step?: number; -} -export declare function isImputeSequence(t: ImputeSequence | any[] | undefined): t is ImputeSequence; -export interface ImputeTransform extends ImputeParams { - /** - * The data field for which the missing values should be imputed. - */ - impute: FieldName; - /** - * A key field that uniquely identifies data objects within a group. - * Missing key values (those occurring in the data but not in the current group) will be imputed. - */ - key: FieldName; - /** - * An optional array of fields by which to group the values. - * Imputation will then be performed on a per-group basis. - */ - groupby?: FieldName[]; -} -export interface FlattenTransform { - /** - * An array of one or more data fields containing arrays to flatten. - * If multiple fields are specified, their array values should have a parallel structure, ideally with the same length. - * If the lengths of parallel arrays do not match, - * the longest array will be used with `null` values added for missing entries. - */ - flatten: FieldName[]; - /** - * The output field names for extracted array values. - * - * __Default value:__ The field name of the corresponding array field - */ - as?: FieldName[]; -} -export interface SampleTransform { - /** - * The maximum number of data objects to include in the sample. - * - * __Default value:__ `1000` - */ - sample: number; -} -export interface LookupBase { - /** - * Key in data to lookup. - */ - key: FieldName; - /** - * Fields in foreign data or selection to lookup. - * If not specified, the entire object is queried. - */ - fields?: FieldName[]; -} -export interface LookupData extends LookupBase { - /** - * Secondary data source to lookup in. - */ - data: Data; -} -export interface LookupSelection extends LookupBase { - /** - * Selection name to look up. - */ - selection: string; -} -export interface LookupTransform { - /** - * Key in primary data source. - */ - lookup: string; - /** - * The output fields on which to store the looked up data values. - * - * For data lookups, this property may be left blank if `from.fields` - * has been specified (those field names will be used); if `from.fields` - * has not been specified, `as` must be a string. - * - * For selection lookups, this property is optional: if unspecified, - * looked up values will be stored under a property named for the selection; - * and if specified, it must correspond to `from.fields`. - */ - as?: FieldName | FieldName[]; - /** - * The default value to use if lookup fails. - * - * __Default value:__ `null` - */ - default?: string; - /** - * Data source or selection for secondary data reference. - */ - from: LookupData | LookupSelection; -} -export declare function isLookup(t: Transform): t is LookupTransform; -export declare function isLookupData(from: LookupData | LookupSelection): from is LookupData; -export declare function isLookupSelection(from: LookupData | LookupSelection): from is LookupData; -export interface FoldTransform { - /** - * An array of data fields indicating the properties to fold. - */ - fold: FieldName[]; - /** - * The output field names for the key and value properties produced by the fold transform. - * __Default value:__ `["key", "value"]` - */ - as?: [FieldName, FieldName]; -} -export interface PivotTransform { - /** - * The data field to pivot on. The unique values of this field become new field names in the output stream. - */ - pivot: FieldName; - /** - * The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields. - */ - value: FieldName; - /** - * The optional data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - /** - * An optional parameter indicating the maximum number of pivoted fields to generate. - * The default (`0`) applies no limit. The pivoted `pivot` names are sorted in ascending order prior to enforcing the limit. - * __Default value:__ `0` - */ - limit?: number; - /** - * The aggregation operation to apply to grouped `value` field values. - * __Default value:__ `sum` - */ - op?: string; -} -export declare function isPivot(t: Transform): t is PivotTransform; -export interface DensityTransform { - /** - * The data field for which to perform density estimation. - */ - density: FieldName; - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - /** - * A boolean flag indicating whether to produce density estimates (false) or cumulative density estimates (true). - * - * __Default value:__ `false` - */ - cumulative?: boolean; - /** - * A boolean flag indicating if the output values should be probability estimates (false) or smoothed counts (true). - * - * __Default value:__ `false` - */ - counts?: boolean; - /** - * The bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott’s rule. - */ - bandwidth?: number; - /** - * A [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field. - */ - extent?: [number, number]; - /** - * The minimum number of samples to take along the extent domain for plotting the density. - * - * __Default value:__ `25` - */ - minsteps?: number; - /** - * The maximum number of samples to take along the extent domain for plotting the density. - * - * __Default value:__ `200` - */ - maxsteps?: number; - /** - * The exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities. - */ - steps?: number; - /** - * The output fields for the sample value and corresponding density estimate. - * - * __Default value:__ `["value", "density"]` - */ - as?: [FieldName, FieldName]; -} -export declare function isDensity(t: Transform): t is DensityTransform; -export interface QuantileTransform { - /** - * The data field for which to perform quantile estimation. - */ - quantile: FieldName; - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - /** - * An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the *step* parameter will be used. - */ - probs?: number[]; - /** - * A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the *probs* parameter is not provided. - */ - step?: number; - /** - * The output field names for the probability and quantile values. - * - * __Default value:__ `["prob", "value"]` - */ - as?: [FieldName, FieldName]; -} -export declare function isQuantile(t: Transform): t is QuantileTransform; -export interface RegressionTransform { - /** - * The data field of the dependent variable to predict. - */ - regression: FieldName; - /** - * The data field of the independent variable to use a predictor. - */ - on: FieldName; - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - /** - * The functional form of the regression model. One of `"linear"`, `"log"`, `"exp"`, `"pow"`, `"quad"`, or `"poly"`. - * - * __Default value:__ `"linear"` - */ - method?: 'linear' | 'log' | 'exp' | 'pow' | 'quad' | 'poly'; - /** - * The polynomial order (number of coefficients) for the 'poly' method. - * - * __Default value:__ `3` - */ - order?: number; - /** - * A [min, max] domain over the independent (x) field for the starting and ending points of the generated trend line. - */ - extent?: [number, number]; - /** - * A boolean flag indicating if the transform should return the regression model parameters (one object per group), rather than trend line points. - * The resulting objects include a `coef` array of fitted coefficient values (starting with the intercept term and then including terms of increasing order) - * and an `rSquared` value (indicating the total variance explained by the model). - * - * __Default value:__ `false` - */ - params?: boolean; - /** - * The output field names for the smoothed points generated by the regression transform. - * - * __Default value:__ The field names of the input x and y values. - */ - as?: [FieldName, FieldName]; -} -export declare function isRegression(t: Transform): t is RegressionTransform; -export interface LoessTransform { - /** - * The data field of the dependent variable to smooth. - */ - loess: FieldName; - /** - * The data field of the independent variable to use a predictor. - */ - on: FieldName; - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - /** - * A bandwidth parameter in the range `[0, 1]` that determines the amount of smoothing. - * - * __Default value:__ `0.3` - */ - bandwidth?: number; - /** - * The output field names for the smoothed points generated by the loess transform. - * - * __Default value:__ The field names of the input x and y values. - */ - as?: [FieldName, FieldName]; -} -export declare function isLoess(t: Transform): t is LoessTransform; -export declare function isSample(t: Transform): t is SampleTransform; -export declare function isWindow(t: Transform): t is WindowTransform; -export declare function isJoinAggregate(t: Transform): t is JoinAggregateTransform; -export declare function isFlatten(t: Transform): t is FlattenTransform; -export declare function isCalculate(t: Transform): t is CalculateTransform; -export declare function isBin(t: Transform): t is BinTransform; -export declare function isImpute(t: Transform): t is ImputeTransform; -export declare function isTimeUnit(t: Transform): t is TimeUnitTransform; -export declare function isAggregate(t: Transform): t is AggregateTransform; -export declare function isStack(t: Transform): t is StackTransform; -export declare function isFold(t: Transform): t is FoldTransform; -export declare type Transform = AggregateTransform | BinTransform | CalculateTransform | DensityTransform | FilterTransform | FlattenTransform | FoldTransform | ImputeTransform | JoinAggregateTransform | LoessTransform | LookupTransform | QuantileTransform | RegressionTransform | TimeUnitTransform | SampleTransform | StackTransform | WindowTransform | PivotTransform; -export declare function normalizeTransform(transform: Transform[]): (AggregateTransform | BinTransform | CalculateTransform | DensityTransform | FlattenTransform | FoldTransform | ImputeTransform | JoinAggregateTransform | LoessTransform | LookupTransform | QuantileTransform | RegressionTransform | TimeUnitTransform | SampleTransform | StackTransform | WindowTransform | PivotTransform | { - filter: LogicalComposition; -})[]; -//# sourceMappingURL=transform.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/transform.d.ts.map b/node_modules/vega-lite/build/src/transform.d.ts.map deleted file mode 100644 index 9b981b4..0000000 --- a/node_modules/vega-lite/build/src/transform.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAA8B,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAqB,SAAS,EAAC,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;CACvC;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,eAAe,CAE3D;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,EAAE,EAAE,S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I,eAAe,CAE3D;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,sBAAsB,CAEzE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,gBAAgB,CAE7D;AACD,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,kBAAkB,CAEjE;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,YAAY,CAErD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,eAAe,CAE3D;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,iBAAiB,CAE/D;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,kBAAkB,CAEjE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,cAAc,CAEzD;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,aAAa,CAEvD;AAED,oBAAY,SAAS,GACjB,kBAAkB,GAClB,YAAY,GACZ,kBAAkB,GAClB,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,eAAe,GACf,sBAAsB,GACtB,cAAc,GACd,eAAe,GACf,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,eAAe,GACf,cAAc,GACd,eAAe,GACf,cAAc,CAAC;AAEnB,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE;;KASxD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/transform.js b/node_modules/vega-lite/build/src/transform.js deleted file mode 100644 index e30206a..0000000 --- a/node_modules/vega-lite/build/src/transform.js +++ /dev/null @@ -1,76 +0,0 @@ -import { normalizeLogicalComposition } from './logical'; -import { normalizePredicate } from './predicate'; -export function isFilter(t) { - return 'filter' in t; -} -export function isImputeSequence(t) { - return (t === null || t === void 0 ? void 0 : t['stop']) !== undefined; -} -export function isLookup(t) { - return 'lookup' in t; -} -export function isLookupData(from) { - return 'data' in from; -} -export function isLookupSelection(from) { - return 'selection' in from; -} -export function isPivot(t) { - return 'pivot' in t; -} -export function isDensity(t) { - return 'density' in t; -} -export function isQuantile(t) { - return 'quantile' in t; -} -export function isRegression(t) { - return 'regression' in t; -} -export function isLoess(t) { - return 'loess' in t; -} -export function isSample(t) { - return 'sample' in t; -} -export function isWindow(t) { - return 'window' in t; -} -export function isJoinAggregate(t) { - return 'joinaggregate' in t; -} -export function isFlatten(t) { - return 'flatten' in t; -} -export function isCalculate(t) { - return 'calculate' in t; -} -export function isBin(t) { - return 'bin' in t; -} -export function isImpute(t) { - return 'impute' in t; -} -export function isTimeUnit(t) { - return 'timeUnit' in t; -} -export function isAggregate(t) { - return 'aggregate' in t; -} -export function isStack(t) { - return 'stack' in t; -} -export function isFold(t) { - return 'fold' in t; -} -export function normalizeTransform(transform) { - return transform.map(t => { - if (isFilter(t)) { - return { - filter: normalizeLogicalComposition(t.filter, normalizePredicate) - }; - } - return t; - }); -} -//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/transform.js.map b/node_modules/vega-lite/build/src/transform.js.map deleted file mode 100644 index 4e37e58..0000000 --- a/node_modules/vega-lite/build/src/transform.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/transform.ts"],"names":[],"mappings":"AAKA,OAAO,EAAqB,2BAA2B,EAAC,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAC,kBAAkB,EAAY,MAAM,aAAa,CAAC;AA6B1D,MAAM,UAAU,QAAQ,CAAC,CAAY;IACnC,OAAO,QAAQ,IAAI,CAAC,CAAC;AACvB,CAAC;AA8ND,MAAM,UAAU,gBAAgB,CAAC,CAAqC;IACpE,OAAO,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,C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AC;AAED,MAAM,UAAU,QAAQ,CAAC,CAAY;IACnC,OAAO,QAAQ,IAAI,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAY;IACrC,OAAO,UAAU,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAY;IACtC,OAAO,WAAW,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,CAAY;IAClC,OAAO,OAAO,IAAI,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,CAAY;IACjC,OAAO,MAAM,IAAI,CAAC,CAAC;AACrB,CAAC;AAsBD,MAAM,UAAU,kBAAkB,CAAC,SAAsB;IACvD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACvB,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE;YACf,OAAO;gBACL,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC,MAAM,EAAE,kBAAkB,CAAC;aAClE,CAAC;SACH;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/type.d.ts b/node_modules/vega-lite/build/src/type.d.ts deleted file mode 100644 index dcc7a05..0000000 --- a/node_modules/vega-lite/build/src/type.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Data type based on level of measurement - */ -export declare const Type: { - readonly quantitative: "quantitative"; - readonly ordinal: "ordinal"; - readonly temporal: "temporal"; - readonly nominal: "nominal"; - readonly geojson: "geojson"; -}; -export declare type Type = keyof typeof Type; -export declare function isType(t: any): t is Type; -export declare const QUANTITATIVE: "quantitative"; -export declare const ORDINAL: "ordinal"; -export declare const TEMPORAL: "temporal"; -export declare const NOMINAL: "nominal"; -export declare const GEOJSON: "geojson"; -export declare type StandardType = 'quantitative' | 'ordinal' | 'temporal' | 'nominal'; -export declare const TYPES: ("ordinal" | "geojson" | "quantitative" | "temporal" | "nominal")[]; -/** - * Get full, lowercase type name for a given type. - * @param type - * @return Full type name. - */ -export declare function getFullName(type: Type | string): Type | undefined; -//# sourceMappingURL=type.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/type.d.ts.map b/node_modules/vega-lite/build/src/type.d.ts.map deleted file mode 100644 index c256d1f..0000000 --- a/node_modules/vega-lite/build/src/type.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;CAMP,CAAC;AAEX,oBAAY,IAAI,GAAG,MAAM,OAAO,IAAI,CAAC;AAErC,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,CAExC;AAED,eAAO,MAAM,YAAY,gBAAoB,CAAC;AAC9C,eAAO,MAAM,OAAO,WAAe,CAAC;AACpC,eAAO,MAAM,QAAQ,YAAgB,CAAC;AACtC,eAAO,MAAM,OAAO,WAAe,CAAC;AAEpC,eAAO,MAAM,OAAO,WAAe,CAAC;AAEpC,oBAAY,YAAY,GAAG,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/E,eAAO,MAAM,KAAK,qEAAa,CAAC;AAEhC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAsBjE"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/type.js b/node_modules/vega-lite/build/src/type.js deleted file mode 100644 index b6cc051..0000000 --- a/node_modules/vega-lite/build/src/type.js +++ /dev/null @@ -1,49 +0,0 @@ -import { keys } from './util'; -/** - * Data type based on level of measurement - */ -export const Type = { - quantitative: 'quantitative', - ordinal: 'ordinal', - temporal: 'temporal', - nominal: 'nominal', - geojson: 'geojson' -}; -export function isType(t) { - return t in Type; -} -export const QUANTITATIVE = Type.quantitative; -export const ORDINAL = Type.ordinal; -export const TEMPORAL = Type.temporal; -export const NOMINAL = Type.nominal; -export const GEOJSON = Type.geojson; -export const TYPES = keys(Type); -/** - * Get full, lowercase type name for a given type. - * @param type - * @return Full type name. - */ -export function getFullName(type) { - if (type) { - type = type.toLowerCase(); - switch (type) { - case 'q': - case QUANTITATIVE: - return 'quantitative'; - case 't': - case TEMPORAL: - return 'temporal'; - case 'o': - case ORDINAL: - return 'ordinal'; - case 'n': - case NOMINAL: - return 'nominal'; - case GEOJSON: - return 'geojson'; - } - } - // If we get invalid input, return undefined type. - return undefined; -} -//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/type.js.map b/node_modules/vega-lite/build/src/type.js.map deleted file mode 100644 index d719c57..0000000 --- a/node_modules/vega-lite/build/src/type.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,YAAY,EAAE,cAAc;IAC5B,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AAIX,MAAM,UAAU,MAAM,CAAC,CAAM;IAC3B,OAAO,CAAC,IAAI,IAAI,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;AAC9C,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AACpC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAEpC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAIpC,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAmB;IAC7C,IAAI,IAAI,EAAE;QACR,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1B,QAAQ,IAAI,EAAE;YACZ,KAAK,GAAG,CAAC;YACT,KAAK,YAAY;gBACf,OAAO,cAAc,CAAC;YACxB,KAAK,GAAG,CAAC;YACT,KAAK,QAAQ;gBACX,OAAO,UAAU,CAAC;YACpB,KAAK,GAAG,CAAC;YACT,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;YACnB,KAAK,GAAG,CAAC;YACT,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;YACnB,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;SACpB;KACF;IACD,kDAAkD;IAClD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/util.d.ts b/node_modules/vega-lite/build/src/util.d.ts deleted file mode 100644 index 77c6e38..0000000 --- a/node_modules/vega-lite/build/src/util.d.ts +++ /dev/null @@ -1,149 +0,0 @@ -import 'array-flat-polyfill'; -import { default as clone_ } from 'clone'; -import stableStringify from 'fast-json-stable-stringify'; -import { LogicalComposition } from './logical'; -export declare const deepEqual: (a: any, b: any) => boolean; -export declare const duplicate: typeof clone_; -/** - * Creates an object composed of the picked object properties. - * - * var object = {'a': 1, 'b': '2', 'c': 3}; - * pick(object, ['a', 'c']); - * // → {'a': 1, 'c': 3} - */ -export declare function pick(obj: T, props: readonly K[]): Pick; -/** - * The opposite of _.pick; this method creates an object composed of the own - * and inherited enumerable string keyed properties of object that are not omitted. - */ -export declare function omit(obj: T, props: readonly K[]): Omit; -/** - * Converts any object to a string representation that can be consumed by humans. - */ -export declare const stringify: typeof stableStringify; -/** - * Converts any object to a string of limited size, or a number. - */ -export declare function hash(a: any): string | number; -export declare function isNullOrFalse(x: any): x is false | null; -export declare function contains(array: readonly T[], item: T): boolean; -/** - * Returns true if any item returns true. - */ -export declare function some(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean): boolean; -/** - * Returns true if all items return true. - */ -export declare function every(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean): boolean; -/** - * Like TS Partial but applies recursively to all properties. - */ -export declare type DeepPartial = { - [P in keyof T]?: DeepPartial; -}; -/** - * recursively merges src into dest - */ -export declare function mergeDeep(dest: T, ...src: readonly DeepPartial[]): T; -export declare function unique(values: readonly T[], f: (item: T) => string | number): T[]; -export declare type Dict = Record; -/** - * Returns true if the two dictionaries disagree. Applies only to defined values. - */ -export declare function isEqual(dict: Dict, other: Dict): boolean; -export declare function setEqual(a: Set, b: Set): boolean; -export declare function hasIntersection(a: ReadonlySet, b: ReadonlySet): boolean; -export declare function prefixGenerator(a: ReadonlySet): ReadonlySet; -/** - * Returns true if a and b have an intersection. Also return true if a or b are undefined - * since this means we don't know what fields a node produces or depends on. - */ -export declare function fieldIntersection(a: ReadonlySet, b: ReadonlySet): boolean; -export declare function isEmpty(obj: object): boolean; -export declare const keys: (o: T) => Extract[]; -export declare const vals: { - (o: { - [s: string]: T; - } | ArrayLike): T[]; - (o: {}): any[]; -}; -export declare function entries(x: { - [key: string]: T; -}): { - key: string; - value: T; -}[]; -export declare type Flag = { - [K in S]: 1; -}; -export declare function isBoolean(b: any): b is boolean; -/** - * Convert a string into a valid variable name - */ -export declare function varName(s: string): string; -export declare function logicalExpr(op: LogicalComposition, cb: (...args: readonly any[]) => string): string; -/** - * Delete nested property of an object, and delete the ancestors of the property if they become empty. - */ -export declare function deleteNestedProperty(obj: any, orderedProps: string[]): boolean; -export declare function titleCase(s: string): string; -/** - * Converts a path to an access path with datum. - * @param path The field name. - * @param datum The string to use for `datum`. - */ -export declare function accessPathWithDatum(path: string, datum?: string): string; -/** - * Return access with datum to the flattened field. - * - * @param path The field name. - * @param datum The string to use for `datum`. - */ -export declare function flatAccessWithDatum(path: string, datum?: 'datum' | 'parent' | 'datum.datum'): string; -/** - * Replaces path accesses with access to non-nested field. - * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`. - */ -export declare function replacePathInField(path: string): string; -/** - * Replace all occurrences of a string with another string. - * - * @param string the string to replace in - * @param find the string to replace - * @param replacement the replacement - */ -export declare function replaceAll(string: string, find: string, replacement: string): string; -/** - * Remove path accesses with access from field. - * For example, `foo["bar"].baz` becomes `foo.bar.baz`. - */ -export declare function removePathFromField(path: string): string; -/** - * Count the depth of the path. Returns 1 for fields that are not nested. - */ -export declare function accessPathDepth(path: string): number; -/** - * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included. - */ -export declare function getFirstDefined(...args: readonly T[]): T | undefined; -/** - * Returns a new random id every time it gets called. - * - * Has side effect! - */ -export declare function uniqueId(prefix?: string): string | number; -/** - * Resets the id counter used in uniqueId. This can be useful for testing. - */ -export declare function resetIdCounter(): void; -export declare function internalField(name: string): string; -export declare function isInternalField(name: string): boolean; -/** - * Normalize angle to be within [0,360). - */ -export declare function normalizeAngle(angle: number): number; -/** - * Returns whether the passed in value is a valid number. - */ -export declare function isNumeric(value: number | string): boolean; -//# sourceMappingURL=util.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/util.d.ts.map b/node_modules/vega-lite/build/src/util.d.ts.map deleted file mode 100644 index 0aa1336..0000000 --- a/node_modules/vega-lite/build/src/util.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,OAAO,CAAC;AAExC,OAAO,eAAe,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAA0C,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAEtF,eAAO,MAAM,SAAS,6BAAa,CAAC;AACpC,eAAO,MAAM,SAAS,eAAS,CAAC;AAEhC;;;;;;GA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CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAOvE;AAKD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,mBAGvC;AAED;;GAEG;AACH,wBAAgB,cAAc,SAE7B;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,UAEzC;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,WAE3C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,UAK3C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAKzD"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/util.js b/node_modules/vega-lite/build/src/util.js deleted file mode 100644 index 3c6017a..0000000 --- a/node_modules/vega-lite/build/src/util.js +++ /dev/null @@ -1,357 +0,0 @@ -import 'array-flat-polyfill'; -import { default as clone_ } from 'clone'; -import deepEqual_ from 'fast-deep-equal'; -import stableStringify from 'fast-json-stable-stringify'; -import { hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig } from 'vega-util'; -import { isLogicalAnd, isLogicalNot, isLogicalOr } from './logical'; -export const deepEqual = deepEqual_; -export const duplicate = clone_; -/** - * Creates an object composed of the picked object properties. - * - * var object = {'a': 1, 'b': '2', 'c': 3}; - * pick(object, ['a', 'c']); - * // → {'a': 1, 'c': 3} - */ -// eslint-disable-next-line @typescript-eslint/ban-types -export function pick(obj, props) { - const copy = {}; - for (const prop of props) { - if (hasOwnProperty(obj, prop)) { - copy[prop] = obj[prop]; - } - } - return copy; -} -/** - * The opposite of _.pick; this method creates an object composed of the own - * and inherited enumerable string keyed properties of object that are not omitted. - */ -// eslint-disable-next-line @typescript-eslint/ban-types -export function omit(obj, props) { - const copy = Object.assign({}, obj); - for (const prop of props) { - delete copy[prop]; - } - return copy; -} -/** - * Monkey patch Set so that `stringify` produces a string representation of sets. - */ -Set.prototype['toJSON'] = function () { - return `Set(${[...this].map(x => stableStringify(x)).join(',')})`; -}; -/** - * Converts any object to a string representation that can be consumed by humans. - */ -export const stringify = stableStringify; -/** - * Converts any object to a string of limited size, or a number. - */ -export function hash(a) { - if (isNumber(a)) { - return a; - } - const str = isString(a) ? a : stableStringify(a); - // short strings can be used as hash directly, longer strings are hashed to reduce memory usage - if (str.length < 250) { - return str; - } - // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ - let h = 0; - for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - h = (h << 5) - h + char; - h = h & h; // Convert to 32bit integer - } - return h; -} -export function isNullOrFalse(x) { - return x === false || x === null; -} -export function contains(array, item) { - return array.indexOf(item) > -1; -} -/** - * Returns true if any item returns true. - */ -export function some(arr, f) { - let i = 0; - for (const [k, a] of arr.entries()) { - if (f(a, k, i++)) { - return true; - } - } - return false; -} -/** - * Returns true if all items return true. - */ -export function every(arr, f) { - let i = 0; - for (const [k, a] of arr.entries()) { - if (!f(a, k, i++)) { - return false; - } - } - return true; -} -/** - * recursively merges src into dest - */ -export function mergeDeep(dest, ...src) { - for (const s of src) { - deepMerge_(dest, s !== null && s !== void 0 ? s : {}); - } - return dest; -} -function deepMerge_(dest, src) { - for (const property of keys(src)) { - writeConfig(dest, property, src[property], true); - } -} -export function unique(values, f) { - const results = []; - const u = {}; - let v; - for (const val of values) { - v = f(val); - if (v in u) { - continue; - } - u[v] = 1; - results.push(val); - } - return results; -} -/** - * Returns true if the two dictionaries disagree. Applies only to defined values. - */ -export function isEqual(dict, other) { - const dictKeys = keys(dict); - const otherKeys = keys(other); - if (dictKeys.length !== otherKeys.length) { - return false; - } - for (const key of dictKeys) { - if (dict[key] !== other[key]) { - return false; - } - } - return true; -} -export function setEqual(a, b) { - if (a.size !== b.size) { - return false; - } - for (const e of a) { - if (!b.has(e)) { - return false; - } - } - return true; -} -export function hasIntersection(a, b) { - for (const key of a) { - if (b.has(key)) { - return true; - } - } - return false; -} -export function prefixGenerator(a) { - const prefixes = new Set(); - for (const x of a) { - const splitField = splitAccessPath(x); - // Wrap every element other than the first in `[]` - const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`)); - const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join('')); - for (const y of computedPrefixes) { - prefixes.add(y); - } - } - return prefixes; -} -/** - * Returns true if a and b have an intersection. Also return true if a or b are undefined - * since this means we don't know what fields a node produces or depends on. - */ -export function fieldIntersection(a, b) { - if (a === undefined || b === undefined) { - return true; - } - return hasIntersection(prefixGenerator(a), prefixGenerator(b)); -} -// eslint-disable-next-line @typescript-eslint/ban-types -export function isEmpty(obj) { - return keys(obj).length === 0; -} -// This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 -export const keys = Object.keys; -export const vals = Object.values; -export function entries(x) { - const _entries = []; - for (const k in x) { - if (hasOwnProperty(x, k)) { - _entries.push({ - key: k, - value: x[k] - }); - } - } - return _entries; -} -export function isBoolean(b) { - return b === true || b === false; -} -/** - * Convert a string into a valid variable name - */ -export function varName(s) { - // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _ - const alphanumericS = s.replace(/\W/g, '_'); - // Add _ if the string has leading numbers. - return (s.match(/^\d+/) ? '_' : '') + alphanumericS; -} -export function logicalExpr(op, cb) { - if (isLogicalNot(op)) { - return '!(' + logicalExpr(op.not, cb) + ')'; - } - else if (isLogicalAnd(op)) { - return '(' + op.and.map((and) => logicalExpr(and, cb)).join(') && (') + ')'; - } - else if (isLogicalOr(op)) { - return '(' + op.or.map((or) => logicalExpr(or, cb)).join(') || (') + ')'; - } - else { - return cb(op); - } -} -/** - * Delete nested property of an object, and delete the ancestors of the property if they become empty. - */ -export function deleteNestedProperty(obj, orderedProps) { - if (orderedProps.length === 0) { - return true; - } - const prop = orderedProps.shift(); // eslint-disable-line @typescript-eslint/no-non-null-assertion - if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) { - delete obj[prop]; - } - return isEmpty(obj); -} -export function titleCase(s) { - return s.charAt(0).toUpperCase() + s.substr(1); -} -/** - * Converts a path to an access path with datum. - * @param path The field name. - * @param datum The string to use for `datum`. - */ -export function accessPathWithDatum(path, datum = 'datum') { - const pieces = splitAccessPath(path); - const prefixes = []; - for (let i = 1; i <= pieces.length; i++) { - const prefix = `[${pieces.slice(0, i).map(stringValue).join('][')}]`; - prefixes.push(`${datum}${prefix}`); - } - return prefixes.join(' && '); -} -/** - * Return access with datum to the flattened field. - * - * @param path The field name. - * @param datum The string to use for `datum`. - */ -export function flatAccessWithDatum(path, datum = 'datum') { - return `${datum}[${stringValue(splitAccessPath(path).join('.'))}]`; -} -function escapePathAccess(string) { - return string.replace(/(\[|\]|\.|'|")/g, '\\$1'); -} -/** - * Replaces path accesses with access to non-nested field. - * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`. - */ -export function replacePathInField(path) { - return `${splitAccessPath(path).map(escapePathAccess).join('\\.')}`; -} -/** - * Replace all occurrences of a string with another string. - * - * @param string the string to replace in - * @param find the string to replace - * @param replacement the replacement - */ -export function replaceAll(string, find, replacement) { - return string.replace(new RegExp(find.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replacement); -} -/** - * Remove path accesses with access from field. - * For example, `foo["bar"].baz` becomes `foo.bar.baz`. - */ -export function removePathFromField(path) { - return `${splitAccessPath(path).join('.')}`; -} -/** - * Count the depth of the path. Returns 1 for fields that are not nested. - */ -export function accessPathDepth(path) { - if (!path) { - return 0; - } - return splitAccessPath(path).length; -} -/** - * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included. - */ -export function getFirstDefined(...args) { - for (const arg of args) { - if (arg !== undefined) { - return arg; - } - } - return undefined; -} -// variable used to generate id -let idCounter = 42; -/** - * Returns a new random id every time it gets called. - * - * Has side effect! - */ -export function uniqueId(prefix) { - const id = ++idCounter; - return prefix ? String(prefix) + id : id; -} -/** - * Resets the id counter used in uniqueId. This can be useful for testing. - */ -export function resetIdCounter() { - idCounter = 42; -} -export function internalField(name) { - return isInternalField(name) ? name : `__${name}`; -} -export function isInternalField(name) { - return name.indexOf('__') === 0; -} -/** - * Normalize angle to be within [0,360). - */ -export function normalizeAngle(angle) { - if (angle === undefined) { - return undefined; - } - return ((angle % 360) + 360) % 360; -} -/** - * Returns whether the passed in value is a valid number. - */ -export function isNumeric(value) { - if (isNumber(value)) { - return true; - } - return !isNaN(value) && !isNaN(parseFloat(value)); -} -//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/util.js.map b/node_modules/vega-lite/build/src/util.js.map deleted file mode 100644 index 0cfe23d..0000000 --- a/node_modules/vega-lite/build/src/util.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,eAAe,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AACxG,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAqB,MAAM,WAAW,CAAC;AAEtF,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC;AAEhC;;;;;;GAMG;AACH,wDAAwD;AACxD,MAAM,UAAU,IAAI,CAAsC,GAAM,EAAE,KAAmB;IACnF,MAAM,IAAI,GAAQ,EAAE,CAAC;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,cAAc,CAAC,GAAG,EAAE,IAAI,C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IAC1C,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAAsB;IAC9C,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CAAC,KAAK,CAAC,KAAY,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3D,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/vega.schema.d.ts b/node_modules/vega-lite/build/src/vega.schema.d.ts deleted file mode 100644 index 51e16f1..0000000 --- a/node_modules/vega-lite/build/src/vega.schema.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { AggregateOp, BandScale, BaseScale, BinOrdinalScale, ColorValueRef, Compare as VgCompare, ExprRef as VgExprRef, GeoShapeTransform as VgGeoShapeTransform, IdentityScale, LayoutAlign, LinearScale, LogScale, NumericValueRef, OrdinalScale, PointScale, PowScale, ProjectionType, QuantileScale, QuantizeScale, RangeBand, RangeRaw, RangeScheme, ScaleData, ScaleDataRef, ScaledValueRef, ScaleMultiDataRef, ScaleMultiFieldsRef, SequentialScale, SignalRef, SortField as VgSortField, SqrtScale, SymLogScale, ThresholdScale, TimeInterval, TimeIntervalStep, TimeScale, Title as VgTitle, Transforms as VgTransform, UnionSortField as VgUnionSortField, Mark } from 'vega'; -import { Value } from './channeldef'; -import { SortOrder } from './sort'; -import { Flag, Dict } from './util'; -export { VgSortField, VgUnionSortField, VgCompare, VgTitle, LayoutAlign, ProjectionType, VgExprRef }; -declare type ExcludeMapped = { - [P in keyof T]: Exclude; -}; -declare type ExcludeMappedButKeepSignals = { - [P in keyof T]: SignalRef extends T[P] ? Exclude | SignalRef : Exclude; -}; -export declare type ExcludeMappedValueRef = ExcludeMapped | NumericValueRef | ColorValueRef>; -export declare type ExcludeMappedValueRefButKeepSignal = ExcludeMappedButKeepSignals | NumericValueRef | ColorValueRef>; -export interface VgData { - name: string; - source?: string; - values?: any; - format?: { - type?: string; - parse?: string | Dict; - property?: string; - feature?: string; - mesh?: string; - }; - url?: string; - transform?: VgTransform[]; -} -export declare type VgScaleDataRefWithSort = ScaleDataRef & { - sort?: VgSortField; -}; -export declare function isSignalRef(o: any): o is SignalRef; -export interface VgValueRef { - value?: Value | number[]; - field?: string | { - datum?: string; - group?: string; - parent?: string; - }; - signal?: string; - scale?: string; - mult?: number; - offset?: number | VgValueRef; - band?: boolean | number | VgValueRef; - test?: string; -} -export declare type VgScaleMultiDataRefWithSort = ScaleMultiDataRef & { - fields: (any[] | VgScaleDataRefWithSort | SignalRef)[]; - sort?: VgUnionSortField; -}; -export declare type VgMultiFieldsRefWithSort = ScaleMultiFieldsRef & { - sort?: VgUnionSortField; -}; -export declare type VgRange = RangeScheme | ScaleData | RangeBand | RangeRaw; -export declare function isVgRangeStep(range: VgRange): range is VgRangeStep; -export interface VgRangeStep { - step: number | SignalRef; -} -export declare type VgNonUnionDomain = (null | string | number | boolean | SignalRef)[] | VgScaleDataRefWithSort | SignalRef; -export declare type VgDomain = BaseScale['domain']; -export declare type VgMarkGroup = any; -/** - * A combined type for any Vega scales that Vega-Lite can generate - */ -export declare type VgScale = Pick & { - range?: RangeScheme | RangeBand | ScaleData; - nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef; - zero?: boolean | SignalRef; -} & Omit & Omit & Omit & Omit, 'type'> & // use partial so exponent is not required -Omit & Omit & Omit & Omit & Omit & Omit & Omit & Omit & Omit & Omit & Omit, 'range' | 'nice' | 'zero'>; -export interface RowCol { - row?: T; - column?: T; -} -export interface VgLayout { - center?: boolean | RowCol; - padding?: number | RowCol; - headerBand?: number | RowCol; - footerBand?: number | RowCol; - titleAnchor?: 'start' | 'end' | RowCol<'start' | 'end'>; - offset?: number | { - rowHeader?: number; - rowFooter?: number; - rowTitle?: number; - columnHeader?: number; - columnFooter?: number; - columnTitle?: number; - }; - bounds?: 'full' | 'flush'; - columns?: number | { - signal: string; - }; - align?: LayoutAlign | RowCol; -} -export declare function isDataRefUnionedDomain(domain: VgDomain): domain is VgScaleMultiDataRefWithSort; -export declare function isFieldRefUnionDomain(domain: VgDomain): domain is VgMultiFieldsRefWithSort; -export declare function isDataRefDomain(domain: VgDomain | any): domain is VgScaleDataRefWithSort; -export declare type VgEncodeChannel = 'x' | 'x2' | 'xc' | 'width' | 'y' | 'y2' | 'yc' | 'height' | 'opacity' | 'fill' | 'fillOpacity' | 'stroke' | 'strokeWidth' | 'strokeCap' | 'strokeOpacity' | 'strokeDash' | 'strokeDashOffset' | 'strokeMiterLimit' | 'strokeJoin' | 'strokeOffset' | 'strokeForeground' | 'cursor' | 'clip' | 'size' | 'shape' | 'path' | 'innerRadius' | 'outerRadius' | 'startAngle' | 'endAngle' | 'interpolate' | 'tension' | 'orient' | 'url' | 'align' | 'baseline' | 'text' | 'dir' | 'ellipsis' | 'limit' | 'dx' | 'dy' | 'radius' | 'theta' | 'angle' | 'font' | 'fontSize' | 'fontWeight' | 'fontStyle' | 'tooltip' | 'href' | 'cursor' | 'defined' | 'cornerRadius' | 'cornerRadiusTopLeft' | 'cornerRadiusTopRight' | 'cornerRadiusBottomRight' | 'cornerRadiusBottomLeft' | 'scaleX' | 'scaleY'; -export declare type VgEncodeEntry = Partial>; -export declare type VgPostEncodingTransform = VgGeoShapeTransform; -export declare const VG_MARK_CONFIGS: ("stroke" | "text" | "width" | "height" | "shape" | "orient" | "aria" | "description" | "cornerRadius" | "theta" | "radius" | "fill" | "opacity" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "strokeDash" | "size" | "angle" | "tooltip" | "href" | "interpolate" | "align" | "strokeCap" | "strokeDashOffset" | "strokeMiterLimit" | "strokeJoin" | "strokeOffset" | "cursor" | "innerRadius" | "outerRadius" | "startAngle" | "endAngle" | "tension" | "baseline" | "dir" | "ellipsis" | "limit" | "dx" | "dy" | "font" | "fontSize" | "fontWeight" | "fontStyle" | "cornerRadiusTopLeft" | "cornerRadiusTopRight" | "cornerRadiusBottomRight" | "cornerRadiusBottomLeft" | "ariaRole" | "ariaRoleDescription" | "aspect" | "blend" | "padAngle" | "lineBreak" | "lineHeight")[]; -export declare const VG_MARK_INDEX: Flag; -export declare const VG_CORNERRADIUS_CHANNELS: readonly ["cornerRadius", "cornerRadiusTopLeft", "cornerRadiusTopRight", "cornerRadiusBottomLeft", "cornerRadiusBottomRight"]; -export interface VgComparator { - field?: string | string[]; - order?: SortOrder | SortOrder[]; -} -export interface VgJoinAggregateTransform { - type: 'joinaggregate'; - as?: string[]; - ops?: AggregateOp[]; - fields?: string[]; - groupby?: string[]; -} -//# sourceMappingURL=vega.schema.d.ts.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/vega.schema.d.ts.map b/node_modules/vega-lite/build/src/vega.schema.d.ts.map deleted file mode 100644 index c75d0d8..0000000 --- a/node_modules/vega-lite/build/src/vega.schema.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vega.schema.d.ts","sourceRoot":"","sources":["../../src/vega.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,eAAe,EACf,aAAa,EACb,OAAO,IAAI,SAAS,EACpB,OAAO,IAAI,SAAS,EACpB,iBAAiB,IAAI,mBAAmB,EACxC,aAAa,EACb,WAAW,EACX,WAAW,EACX,QAAQ,EAER,eAAe,EACf,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,cAAc,EACd,aAAa,EACb,aAAa,EACb,SAAS,EACT,QAAQ,EACR,WAAW,EACX,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,SAAS,IAAI,WAAW,EACxB,SAAS,EACT,WAAW,EACX,cAAc,EACd,YAAY,EACZ,g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,CAAC;AAGF,eAAO,MAAM,wBAAwB,+HAM3B,CAAC;AAEX,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/vega.schema.js b/node_modules/vega-lite/build/src/vega.schema.js deleted file mode 100644 index bc4be78..0000000 --- a/node_modules/vega-lite/build/src/vega.schema.js +++ /dev/null @@ -1,116 +0,0 @@ -import { isArray } from 'vega-util'; -import { keys } from './util'; -export function isSignalRef(o) { - return o && !!o['signal']; -} -export function isVgRangeStep(range) { - return !!range['step']; -} -export function isDataRefUnionedDomain(domain) { - if (!isArray(domain)) { - return 'fields' in domain && !('data' in domain); - } - return false; -} -export function isFieldRefUnionDomain(domain) { - if (!isArray(domain)) { - return 'fields' in domain && 'data' in domain; - } - return false; -} -export function isDataRefDomain(domain) { - if (!isArray(domain)) { - return 'field' in domain && 'data' in domain; - } - return false; -} -const VG_MARK_CONFIG_INDEX = { - aria: 1, - description: 1, - ariaRole: 1, - ariaRoleDescription: 1, - blend: 1, - opacity: 1, - fill: 1, - fillOpacity: 1, - stroke: 1, - strokeCap: 1, - strokeWidth: 1, - strokeOpacity: 1, - strokeDash: 1, - strokeDashOffset: 1, - strokeJoin: 1, - strokeOffset: 1, - strokeMiterLimit: 1, - startAngle: 1, - endAngle: 1, - padAngle: 1, - innerRadius: 1, - outerRadius: 1, - size: 1, - shape: 1, - interpolate: 1, - tension: 1, - orient: 1, - align: 1, - baseline: 1, - text: 1, - dir: 1, - dx: 1, - dy: 1, - ellipsis: 1, - limit: 1, - radius: 1, - theta: 1, - angle: 1, - font: 1, - fontSize: 1, - fontWeight: 1, - fontStyle: 1, - lineBreak: 1, - lineHeight: 1, - cursor: 1, - href: 1, - tooltip: 1, - cornerRadius: 1, - cornerRadiusTopLeft: 1, - cornerRadiusTopRight: 1, - cornerRadiusBottomLeft: 1, - cornerRadiusBottomRight: 1, - aspect: 1, - width: 1, - height: 1 - // commented below are vg channel that do not have mark config. - // x: 1, - // y: 1, - // x2: 1, - // y2: 1, - // xc'|'yc' - // clip: 1, - // path: 1, - // url: 1, -}; -export const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX); -export const VG_MARK_INDEX = { - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 -}; -// Vega's cornerRadius channels. -export const VG_CORNERRADIUS_CHANNELS = [ - 'cornerRadius', - 'cornerRadiusTopLeft', - 'cornerRadiusTopRight', - 'cornerRadiusBottomLeft', - 'cornerRadiusBottomRight' -]; -//# sourceMappingURL=vega.schema.js.map \ No newline at end of file diff --git a/node_modules/vega-lite/build/src/vega.schema.js.map b/node_modules/vega-lite/build/src/vega.schema.js.map deleted file mode 100644 index e2f63fb..0000000 --- a/node_modules/vega-lite/build/src/vega.schema.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vega.schema.js","sourceRoot":"","sources":["../../src/vega.schema.ts"],"names":[],"mappings":"AA2CA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAO,IAAI,EAAO,MAAM,QAAQ,CAAC;AAwCxC,MAAM,UAAU,WAAW,CAAC,CAAM;IAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC5B,CAAC;AAgCD,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,CAAC,CAA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EF,gCAAgC;AAChC,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc;IACd,qBAAqB;IACrB,sBAAsB;IACtB,wBAAwB;IACxB,yBAAyB;CACjB,CAAC"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/vega-lite-schema.json b/node_modules/vega-lite/build/vega-lite-schema.json deleted file mode 100644 index ad4a821..0000000 --- a/node_modules/vega-lite/build/vega-lite-schema.json +++ /dev/null @@ -1,23976 +0,0 @@ -{ - "$ref": "#/definitions/TopLevelSpec", - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "Aggregate": { - "anyOf": [ - { - "$ref": "#/definitions/NonArgAggregateOp" - }, - { - "$ref": "#/definitions/ArgmaxDef" - }, - { - "$ref": "#/definitions/ArgminDef" - } - ] - }, - "AggregateOp": { - "enum": [ - "argmax", - "argmin", - "average", - "count", - "distinct", - "max", - "mean", - "median", - "min", - "missing", - "product", - "q1", - "q3", - "ci0", - "ci1", - "stderr", - "stdev", - "stdevp", - "sum", - "valid", - "values", - "variance", - "variancep" - ], - "type": "string" - }, - "AggregateTransform": { - "additionalProperties": false, - "properties": { - "aggregate": { - "description": "Array of objects that define fields to aggregate.", - "items": { - "$ref": "#/definitions/AggregatedFieldDef" - }, - "type": "array" - }, - "groupby": { - "description": "The data fields to group by. If not specified, a single group containing all data objects will be used.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - } - }, - "required": [ - "aggregate" - ], - "type": "object" - }, - "AggregatedFieldDef": { - "additionalProperties": false, - "properties": { - "as": { - "$ref": "#/definitions/FieldName", - "description": "The output field names to use for each aggregated field." - }, - "field": { - "$ref": "#/definitions/FieldName", - "description": "The data field for which to compute aggregate function. This is required for all aggregation operations except `\"count\"`." - }, - "op": { - "$ref": "#/definitions/AggregateOp", - "description": "The aggregation operation to apply to the fields (e.g., `\"sum\"`, `\"average\"`, or `\"count\"`).\nSee the [full list of supported aggregation operations](https://vega.github.io/vega-lite/docs/aggregate.html#ops)\nfor more information." - } - }, - "required": [ - "op", - "as" - ], - "type": "object" - }, - "Align": { - "enum": [ - "left", - "center", - "right" - ], - "type": "string" - }, - "AllSortString": { - "anyOf": [ - { - "$ref": "#/definitions/SortOrder" - }, - { - "$ref": "#/definitions/SortByChannel" - }, - { - "$ref": "#/definitions/SortByChannelDesc" - } - ] - }, - "AnyMark": { - "anyOf": [ - { - "$ref": "#/definitions/CompositeMark" - }, - { - "$ref": "#/definitions/CompositeMarkDef" - }, - { - "$ref": "#/definitions/Mark" - }, - { - "$ref": "#/definitions/MarkDef" - } - ] - }, - "AnyMarkConfig": { - "anyOf": [ - { - "$ref": "#/definitions/MarkConfig" - }, - { - "$ref": "#/definitions/AreaConfig" - }, - { - "$ref": "#/definitions/BarConfig" - }, - { - "$ref": "#/definitions/RectConfig" - }, - { - "$ref": "#/definitions/LineConfig" - }, - { - "$ref": "#/definitions/TickConfig" - } - ] - }, - "AreaConfig": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`." - }, - "angle": { - "description": "The rotation angle of the text, in degrees.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree.", - "type": "boolean" - }, - "ariaRole": { - "description": "Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"role\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "ariaRoleDescription": { - "description": "A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"aria-roledescription\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "aspect": { - "description": "Whether to keep aspect ratio of image marks.", - "type": "boolean" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone." - }, - "blend": { - "$ref": "#/definitions/Blend", - "description": "The color blend mode for drawing an item on its current background. Any valid [CSS mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) value can be used.\n\n__Default value: `\"source-over\"`" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomLeft": { - "description": "The radius in pixels of rounded rectangles' bottom left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomRight": { - "description": "The radius in pixels of rounded rectangles' bottom right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopLeft": { - "description": "The radius in pixels of rounded rectangles' top right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopRight": { - "description": "The radius in pixels of rounded rectangles' top left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "description": { - "description": "A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute).", - "type": "string" - }, - "dir": { - "$ref": "#/definitions/TextDirection", - "description": "The direction of the text. One of `\"ltr\"` (left-to-right) or `\"rtl\"` (right-to-left). This property determines on which side is truncated in response to the limit parameter.\n\n__Default value:__ `\"ltr\"`" - }, - "dx": { - "description": "The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "dy": { - "description": "The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "ellipsis": { - "description": "The ellipsis string for text truncated in response to the limit parameter.\n\n__Default value:__ `\"…\"`", - "type": "string" - }, - "endAngle": { - "description": "The end angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n\n__Default value:__ (None)" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "filled": { - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n\n__Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).", - "type": "boolean" - }, - "font": { - "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "fontSize": { - "description": "The font size, in pixels.\n\n__Default value:__ `11`", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style (e.g., `\"italic\"`)." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "height": { - "description": "Height of the marks.", - "type": "number" - }, - "href": { - "description": "A URL to load upon mouse click. If defined, the mark acts as a hyperlink.", - "format": "uri", - "type": "string" - }, - "innerRadius": { - "description": "The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.", - "type": "number" - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method to use for line and area marks. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"step-before\"`: alternate between vertical and horizontal segments, as in a step function.\n- `\"step-after\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null - ], - "type": [ - "string", - "null" - ] - }, - "limit": { - "description": "The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0` -- indicating no limit", - "type": "number" - }, - "line": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/OverlayMarkDef" - } - ], - "description": "A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.\n\n- If this value is an empty object (`{}`) or `true`, lines with default properties will be used.\n\n- If this value is `false`, no lines would be automatically added to area marks.\n\n__Default value:__ `false`." - }, - "lineBreak": { - "description": "A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property is ignored if the text is array-valued.", - "type": "string" - }, - "lineHeight": { - "description": "The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "order": { - "description": "For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.", - "type": [ - "null", - "boolean" - ] - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "The orientation of a non-stacked bar, tick, area, and line charts.\nThe value is either horizontal (default) or vertical.\n- For bar, rule and tick, this determines whether the size of the bar and tick\nshould be applied to x or y dimension.\n- For area, this property determines the orient property of the Vega output.\n- For line and trail marks, this property determines the sort order of the points in the line\nif `config.sortLineBy` is not specified.\nFor stacked charts, this is always determined by the orientation of the stack;\ntherefore explicitly specified value will be ignored." - }, - "outerRadius": { - "description": "The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.", - "type": "number" - }, - "padAngle": { - "description": "The angular padding applied to sides of the arc, in radians.", - "type": "number" - }, - "point": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/OverlayMarkDef" - }, - { - "enum": [ - "transparent" - ], - "type": "string" - } - ], - "description": "A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.\n\n- If this property is `\"transparent\"`, transparent points will be used (for enhancing tooltips and selections).\n\n- If this property is an empty object (`{}`) or `true`, filled points with default properties will be used.\n\n- If this property is `false`, no points would be automatically added to line or area marks.\n\n__Default value:__ `false`." - }, - "radius": { - "description": "For arc mark, the primary (outer) radius in pixels.\n\nFor text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.", - "type": "number" - }, - "radius2": { - "description": "The secondary (inner) radius in pixels of arc marks.", - "type": "number" - }, - "shape": { - "anyOf": [ - { - "$ref": "#/definitions/SymbolShape" - }, - { - "type": "string" - } - ], - "description": "Shape of the point marks. Supported values include:\n- plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n- the line symbol `\"stroke\"`\n- centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n- a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n__Default value:__ `\"circle\"`" - }, - "size": { - "description": "Default size for marks.\n- For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n- For `bar`, this represents the band size of the bar, in pixels.\n- For `text`, this represents the font size, in pixels.\n\n__Default value:__\n- `30` for point, circle, square marks; width/height's `step`\n- `2` for bar marks with discrete dimensions;\n- `5` for bar marks with continuous dimensions;\n- `11` for text marks.", - "minimum": 0, - "type": "number" - }, - "startAngle": { - "description": "The start angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n\n__Default value:__ (None)" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOffset": { - "description": "The offset in pixels at which to draw the group stroke and fill. If unspecified, the default behavior is to dynamically offset stroked groups such that 1 pixel stroke widths align with the pixel grid.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "tension": { - "description": "Depending on the interpolation type, sets the tension parameter (for line and area marks).", - "type": "number" - }, - "text": { - "$ref": "#/definitions/Text", - "description": "Placeholder text if the `text` channel is not specified" - }, - "theta": { - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "theta2": { - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.", - "type": "number" - }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\nIf set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, - "timeUnitBandPosition": { - "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\nIf set to `0.5`, the marks will be positioned in the middle of the time unit band step.", - "type": "number" - }, - "tooltip": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/TooltipContent" - }, - { - "type": "null" - } - ], - "description": "The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n\n- If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n- If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n- If set to `null` or `false`, then no tooltip will be used.\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n\n__Default value:__ `null`" - }, - "width": { - "description": "Width of the marks.", - "type": "number" - }, - "x": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "y": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - } - }, - "type": "object" - }, - "ArgmaxDef": { - "additionalProperties": false, - "properties": { - "argmax": { - "type": "string" - } - }, - "required": [ - "argmax" - ], - "type": "object" - }, - "ArgminDef": { - "additionalProperties": false, - "properties": { - "argmin": { - "type": "string" - } - }, - "required": [ - "argmin" - ], - "type": "object" - }, - "AutoSizeParams": { - "additionalProperties": false, - "properties": { - "contains": { - "description": "Determines how size calculation should be performed, one of `\"content\"` or `\"padding\"`. The default setting (`\"content\"`) interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the `\"padding\"` setting includes the padding within the view size calculations, such that the width and height settings indicate the **total** intended size of the view.\n\n__Default value__: `\"content\"`", - "enum": [ - "content", - "padding" - ], - "type": "string" - }, - "resize": { - "description": "A boolean flag indicating if autosize layout should be re-calculated on every view update.\n\n__Default value__: `false`", - "type": "boolean" - }, - "type": { - "$ref": "#/definitions/AutosizeType", - "description": "The sizing format type. One of `\"pad\"`, `\"fit\"`, `\"fit-x\"`, `\"fit-y\"`, or `\"none\"`. See the [autosize type](https://vega.github.io/vega-lite/docs/size.html#autosize) documentation for descriptions of each.\n\n__Default value__: `\"pad\"`" - } - }, - "type": "object" - }, - "AutosizeType": { - "enum": [ - "pad", - "none", - "fit", - "fit-x", - "fit-y" - ], - "type": "string" - }, - "Axis": { - "additionalProperties": false, - "properties": { - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG group, removing the axis from the ARIA accessibility tree.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "bandPosition": { - "description": "An interpolation fraction indicating where, for `band` scales, axis ticks should be positioned. A value of `0` places ticks at the left edge of their bands. A value of `0.5` places ticks in the middle of their bands.\n\n __Default value:__ `0.5`", - "type": "number" - }, - "description": { - "description": "A text description of this axis for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf the `aria` property is true, for SVG output the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute) will be set to this description.\nIf the description is unspecified it will be automatically generated.", - "type": "string" - }, - "domain": { - "description": "A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "domainCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for the domain line's ending style. One of `\"butt\"`, `\"round\"` or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "domainColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Color of axis domain line.\n\n__Default value:__ `\"gray\"`." - }, - "domainDash": { - "description": "An array of alternating [stroke, space] lengths for dashed domain lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "domainDashOffset": { - "description": "The pixel offset at which to start drawing with the domain dash array.", - "type": "number" - }, - "domainOpacity": { - "description": "Opacity of the axis domain line.", - "type": "number" - }, - "domainWidth": { - "description": "Stroke width of axis domain line\n\n__Default value:__ `1`", - "type": "number" - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "grid": { - "description": "A boolean flag indicating if grid lines should be included as part of the axis\n\n__Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`.", - "type": "boolean" - }, - "gridCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for grid lines' ending style. One of `\"butt\"`, `\"round\"` or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "gridColor": { - "anyOf": [ - { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Color of gridlines.\n\n__Default value:__ `\"lightGray\"`." - }, - { - "$ref": "#/definitions/ConditionalAxisColor" - } - ] - }, - "gridDash": { - "anyOf": [ - { - "description": "An array of alternating [stroke, space] lengths for dashed grid lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - { - "$ref": "#/definitions/ConditionalAxisNumberArray" - } - ] - }, - "gridDashOffset": { - "anyOf": [ - { - "description": "The pixel offset at which to start drawing with the grid dash array.", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "gridOpacity": { - "anyOf": [ - { - "description": "The stroke opacity of grid (value between [0,1])\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "gridWidth": { - "anyOf": [ - { - "description": "The grid width, in pixels.\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelAlign": { - "anyOf": [ - { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment of axis tick labels, overriding the default setting for the current axis orientation." - }, - { - "$ref": "#/definitions/ConditionalAxisLabelAlign" - } - ] - }, - "labelAngle": { - "description": "The rotation angle of the axis labels.\n\n__Default value:__ `-90` for nominal and ordinal fields; `0` otherwise.", - "maximum": 360, - "minimum": -360, - "type": "number" - }, - "labelBaseline": { - "anyOf": [ - { - "$ref": "#/definitions/TextBaseline", - "description": "Vertical text baseline of axis tick labels, overriding the default setting for the current axis orientation.\nOne of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone." - }, - { - "$ref": "#/definitions/ConditionalAxisLabelBaseline" - } - ] - }, - "labelBound": { - "description": "Indicates if labels should be hidden if they exceed the axis range. If `false` (the default) no bounds overlap analysis is performed. If `true`, labels will be hidden if they exceed the axis range by more than 1 pixel. If this property is a number, it specifies the pixel tolerance: the maximum amount by which a label bounding box may exceed the axis range.\n\n__Default value:__ `false`.", - "type": [ - "number", - "boolean" - ] - }, - "labelColor": { - "anyOf": [ - { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the tick label, can be in hex color code or regular color name." - }, - { - "$ref": "#/definitions/ConditionalAxisColor" - } - ] - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "labelFlush": { - "description": "Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.\n\n__Default value:__ `true` for axis of a continuous x-scale. Otherwise, `false`.", - "type": [ - "boolean", - "number" - ] - }, - "labelFlushOffset": { - "description": "Indicates the number of pixels by which to offset flush-adjusted labels. For example, a value of `2` will push flush-adjusted labels 2 pixels outward from the center of the axis. Offsets can help the labels better visually group with corresponding axis ticks.\n\n__Default value:__ `0`.", - "type": "number" - }, - "labelFont": { - "anyOf": [ - { - "description": "The font of the tick label.", - "type": "string" - }, - { - "$ref": "#/definitions/ConditionalAxisString" - } - ] - }, - "labelFontSize": { - "anyOf": [ - { - "description": "The font size of the label, in pixels.", - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelFontStyle": { - "anyOf": [ - { - "$ref": "#/definitions/FontStyle", - "description": "Font style of the title." - }, - { - "$ref": "#/definitions/ConditionalAxisLabelFontStyle" - } - ] - }, - "labelFontWeight": { - "anyOf": [ - { - "$ref": "#/definitions/FontWeight", - "description": "Font weight of axis tick labels." - }, - { - "$ref": "#/definitions/ConditionalAxisLabelFontWeight" - } - ] - }, - "labelLimit": { - "description": "Maximum allowed pixel width of axis tick labels.\n\n__Default value:__ `180`", - "type": "number" - }, - "labelLineHeight": { - "description": "Line height in pixels for multi-line label text or label text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "labelOffset": { - "anyOf": [ - { - "description": "Position offset in pixels to apply to labels, in addition to tickOffset.\n\n__Default value:__ `0`", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelOpacity": { - "anyOf": [ - { - "description": "The opacity of the labels.", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelOverlap": { - "$ref": "#/definitions/LabelOverlap", - "description": "The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `\"greedy\"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).\n\n__Default value:__ `true` for non-nominal fields with non-log scales; `\"greedy\"` for log scales; otherwise `false`." - }, - "labelPadding": { - "anyOf": [ - { - "description": "The padding in pixels between labels and ticks.\n\n__Default value:__ `2`", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelSeparation": { - "description": "The minimum separation that must be between label bounding boxes for them to be considered non-overlapping (default `0`). This property is ignored if *labelOverlap* resolution is not enabled.", - "type": "number" - }, - "labels": { - "description": "A boolean flag indicating if labels should be included as part of the axis.\n\n__Default value:__ `true`.", - "type": "boolean" - }, - "maxExtent": { - "description": "The maximum extent in pixels that axis ticks and labels should use. This determines a maximum offset value for axis titles.\n\n__Default value:__ `undefined`.", - "type": "number" - }, - "minExtent": { - "description": "The minimum extent in pixels that axis ticks and labels should use. This determines a minimum offset value for axis titles.\n\n__Default value:__ `30` for y-axis; `undefined` for x-axis.", - "type": "number" - }, - "offset": { - "description": "The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n\n__Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)", - "type": "number" - }, - "orient": { - "$ref": "#/definitions/AxisOrient", - "description": "The orientation of the axis. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart).\n\n__Default value:__ `\"bottom\"` for x-axes and `\"left\"` for y-axes." - }, - "position": { - "description": "The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate.\n\n__Default value__: `0`", - "type": "number" - }, - "style": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n\n__Default value:__ (none)\n__Note:__ Any specified style will augment the default style. For example, an x-axis mark with `\"style\": \"foo\"` will use `config.axisX` and `config.style.foo` (the specified style `\"foo\"` has higher precedence)." - }, - "tickBand": { - "description": "For band scales, indicates if ticks and grid lines should be placed at the `\"center\"` of a band (default) or at the band `\"extent\"`s to indicate intervals", - "enum": [ - "center", - "extent" - ], - "type": "string" - }, - "tickCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for the tick lines' ending style. One of `\"butt\"`, `\"round\"` or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "tickColor": { - "anyOf": [ - { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the axis's tick.\n\n__Default value:__ `\"gray\"`" - }, - { - "$ref": "#/definitions/ConditionalAxisColor" - } - ] - }, - "tickCount": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/TimeInterval" - }, - { - "$ref": "#/definitions/TimeIntervalStep" - } - ], - "description": "A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are \"nice\" (multiples of 2, 5, 10) and lie within the underlying scale's range.\n\nFor scales of type `\"time\"` or `\"utc\"`, the tick count can instead be a time interval specifier. Legal string values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and \"year\". Alternatively, an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary.\n\n__Default value__: Determine using a formula `ceil(width/40)` for x and `ceil(height/40)` for y.", - "minimum": 0 - }, - "tickDash": { - "anyOf": [ - { - "description": "An array of alternating [stroke, space] lengths for dashed tick mark lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - { - "$ref": "#/definitions/ConditionalAxisNumberArray" - } - ] - }, - "tickDashOffset": { - "anyOf": [ - { - "description": "The pixel offset at which to start drawing with the tick mark dash array.", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "tickExtra": { - "description": "Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `\"bandPosition\": 1` and an axis `\"padding\"` value of `0`.", - "type": "boolean" - }, - "tickMinStep": { - "description": "The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.", - "type": "number" - }, - "tickOffset": { - "description": "Position offset in pixels to apply to ticks, labels, and gridlines.", - "type": "number" - }, - "tickOpacity": { - "anyOf": [ - { - "description": "Opacity of the ticks.", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "tickRound": { - "description": "Boolean flag indicating if pixel position values should be rounded to the nearest integer.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "tickSize": { - "anyOf": [ - { - "description": "The size in pixels of axis ticks.\n\n__Default value:__ `5`", - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "tickWidth": { - "anyOf": [ - { - "description": "The width, in pixels, of ticks.\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "ticks": { - "description": "Boolean value that determines whether the axis should include ticks.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "titleAlign": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment of axis titles." - }, - "titleAnchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "Text anchor position for placing axis titles." - }, - "titleAngle": { - "description": "Angle in degrees of axis titles.", - "type": "number" - }, - "titleBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "Vertical text baseline for axis titles. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone." - }, - "titleColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Color of the title, can be in hex color code or regular color name." - }, - "titleFont": { - "description": "Font of the title. (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "titleFontSize": { - "description": "Font size of the title.", - "minimum": 0, - "type": "number" - }, - "titleFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "Font style of the title." - }, - "titleFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "Font weight of the title.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "titleLimit": { - "description": "Maximum allowed pixel width of axis titles.", - "minimum": 0, - "type": "number" - }, - "titleLineHeight": { - "description": "Line height in pixels for multi-line title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "titleOpacity": { - "description": "Opacity of the axis title.", - "type": "number" - }, - "titlePadding": { - "description": "The padding, in pixels, between title and axis.", - "type": "number" - }, - "titleX": { - "description": "X-coordinate of the axis title relative to the axis group.", - "type": "number" - }, - "titleY": { - "description": "Y-coordinate of the axis title relative to the axis group.", - "type": "number" - }, - "translate": { - "description": "Coordinate space translation offset for axis layout. By default, axes are translated by a 0.5 pixel offset for both the x and y coordinates in order to align stroked lines with the pixel grid. However, for vector graphics output these pixel-specific adjustments may be undesirable, in which case translate can be changed (for example, to zero).\n\n__Default value:__ `0.5`", - "type": "number" - }, - "values": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "items": { - "type": "boolean" - }, - "type": "array" - }, - { - "items": { - "$ref": "#/definitions/DateTime" - }, - "type": "array" - } - ], - "description": "Explicitly set the visible axis tick values." - }, - "zindex": { - "description": "A non-negative integer indicating the z-index of the axis.\nIf zindex is 0, axes should be drawn behind all chart elements.\nTo put them in front, set `zindex` to `1` or more.\n\n__Default value:__ `0` (behind the marks).", - "minimum": 0, - "type": "number" - } - }, - "type": "object" - }, - "AxisConfig": { - "additionalProperties": false, - "properties": { - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG group, removing the axis from the ARIA accessibility tree.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "bandPosition": { - "description": "An interpolation fraction indicating where, for `band` scales, axis ticks should be positioned. A value of `0` places ticks at the left edge of their bands. A value of `0.5` places ticks in the middle of their bands.\n\n __Default value:__ `0.5`", - "type": "number" - }, - "description": { - "description": "A text description of this axis for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf the `aria` property is true, for SVG output the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute) will be set to this description.\nIf the description is unspecified it will be automatically generated.", - "type": "string" - }, - "disable": { - "description": "Disable axis by default.", - "type": "boolean" - }, - "domain": { - "description": "A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "domainCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for the domain line's ending style. One of `\"butt\"`, `\"round\"` or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "domainColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Color of axis domain line.\n\n__Default value:__ `\"gray\"`." - }, - "domainDash": { - "description": "An array of alternating [stroke, space] lengths for dashed domain lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "domainDashOffset": { - "description": "The pixel offset at which to start drawing with the domain dash array.", - "type": "number" - }, - "domainOpacity": { - "description": "Opacity of the axis domain line.", - "type": "number" - }, - "domainWidth": { - "description": "Stroke width of axis domain line\n\n__Default value:__ `1`", - "type": "number" - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "grid": { - "description": "A boolean flag indicating if grid lines should be included as part of the axis\n\n__Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`.", - "type": "boolean" - }, - "gridCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for grid lines' ending style. One of `\"butt\"`, `\"round\"` or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "gridColor": { - "anyOf": [ - { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Color of gridlines.\n\n__Default value:__ `\"lightGray\"`." - }, - { - "$ref": "#/definitions/ConditionalAxisColor" - } - ] - }, - "gridDash": { - "anyOf": [ - { - "description": "An array of alternating [stroke, space] lengths for dashed grid lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - { - "$ref": "#/definitions/ConditionalAxisNumberArray" - } - ] - }, - "gridDashOffset": { - "anyOf": [ - { - "description": "The pixel offset at which to start drawing with the grid dash array.", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "gridOpacity": { - "anyOf": [ - { - "description": "The stroke opacity of grid (value between [0,1])\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "gridWidth": { - "anyOf": [ - { - "description": "The grid width, in pixels.\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelAlign": { - "anyOf": [ - { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment of axis tick labels, overriding the default setting for the current axis orientation." - }, - { - "$ref": "#/definitions/ConditionalAxisLabelAlign" - } - ] - }, - "labelAngle": { - "description": "The rotation angle of the axis labels.\n\n__Default value:__ `-90` for nominal and ordinal fields; `0` otherwise.", - "maximum": 360, - "minimum": -360, - "type": "number" - }, - "labelBaseline": { - "anyOf": [ - { - "$ref": "#/definitions/TextBaseline", - "description": "Vertical text baseline of axis tick labels, overriding the default setting for the current axis orientation.\nOne of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone." - }, - { - "$ref": "#/definitions/ConditionalAxisLabelBaseline" - } - ] - }, - "labelBound": { - "description": "Indicates if labels should be hidden if they exceed the axis range. If `false` (the default) no bounds overlap analysis is performed. If `true`, labels will be hidden if they exceed the axis range by more than 1 pixel. If this property is a number, it specifies the pixel tolerance: the maximum amount by which a label bounding box may exceed the axis range.\n\n__Default value:__ `false`.", - "type": [ - "number", - "boolean" - ] - }, - "labelColor": { - "anyOf": [ - { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the tick label, can be in hex color code or regular color name." - }, - { - "$ref": "#/definitions/ConditionalAxisColor" - } - ] - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "labelFlush": { - "description": "Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.\n\n__Default value:__ `true` for axis of a continuous x-scale. Otherwise, `false`.", - "type": [ - "boolean", - "number" - ] - }, - "labelFlushOffset": { - "description": "Indicates the number of pixels by which to offset flush-adjusted labels. For example, a value of `2` will push flush-adjusted labels 2 pixels outward from the center of the axis. Offsets can help the labels better visually group with corresponding axis ticks.\n\n__Default value:__ `0`.", - "type": "number" - }, - "labelFont": { - "anyOf": [ - { - "description": "The font of the tick label.", - "type": "string" - }, - { - "$ref": "#/definitions/ConditionalAxisString" - } - ] - }, - "labelFontSize": { - "anyOf": [ - { - "description": "The font size of the label, in pixels.", - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelFontStyle": { - "anyOf": [ - { - "$ref": "#/definitions/FontStyle", - "description": "Font style of the title." - }, - { - "$ref": "#/definitions/ConditionalAxisLabelFontStyle" - } - ] - }, - "labelFontWeight": { - "anyOf": [ - { - "$ref": "#/definitions/FontWeight", - "description": "Font weight of axis tick labels." - }, - { - "$ref": "#/definitions/ConditionalAxisLabelFontWeight" - } - ] - }, - "labelLimit": { - "description": "Maximum allowed pixel width of axis tick labels.\n\n__Default value:__ `180`", - "type": "number" - }, - "labelLineHeight": { - "description": "Line height in pixels for multi-line label text or label text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "labelOffset": { - "anyOf": [ - { - "description": "Position offset in pixels to apply to labels, in addition to tickOffset.\n\n__Default value:__ `0`", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelOpacity": { - "anyOf": [ - { - "description": "The opacity of the labels.", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelOverlap": { - "$ref": "#/definitions/LabelOverlap", - "description": "The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `\"greedy\"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).\n\n__Default value:__ `true` for non-nominal fields with non-log scales; `\"greedy\"` for log scales; otherwise `false`." - }, - "labelPadding": { - "anyOf": [ - { - "description": "The padding in pixels between labels and ticks.\n\n__Default value:__ `2`", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "labelSeparation": { - "description": "The minimum separation that must be between label bounding boxes for them to be considered non-overlapping (default `0`). This property is ignored if *labelOverlap* resolution is not enabled.", - "type": "number" - }, - "labels": { - "description": "A boolean flag indicating if labels should be included as part of the axis.\n\n__Default value:__ `true`.", - "type": "boolean" - }, - "maxExtent": { - "description": "The maximum extent in pixels that axis ticks and labels should use. This determines a maximum offset value for axis titles.\n\n__Default value:__ `undefined`.", - "type": "number" - }, - "minExtent": { - "description": "The minimum extent in pixels that axis ticks and labels should use. This determines a minimum offset value for axis titles.\n\n__Default value:__ `30` for y-axis; `undefined` for x-axis.", - "type": "number" - }, - "offset": { - "description": "The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n\n__Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)", - "type": "number" - }, - "orient": { - "$ref": "#/definitions/AxisOrient", - "description": "The orientation of the axis. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart).\n\n__Default value:__ `\"bottom\"` for x-axes and `\"left\"` for y-axes." - }, - "position": { - "description": "The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate.\n\n__Default value__: `0`", - "type": "number" - }, - "style": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n\n__Default value:__ (none)\n__Note:__ Any specified style will augment the default style. For example, an x-axis mark with `\"style\": \"foo\"` will use `config.axisX` and `config.style.foo` (the specified style `\"foo\"` has higher precedence)." - }, - "tickBand": { - "description": "For band scales, indicates if ticks and grid lines should be placed at the `\"center\"` of a band (default) or at the band `\"extent\"`s to indicate intervals", - "enum": [ - "center", - "extent" - ], - "type": "string" - }, - "tickCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for the tick lines' ending style. One of `\"butt\"`, `\"round\"` or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "tickColor": { - "anyOf": [ - { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the axis's tick.\n\n__Default value:__ `\"gray\"`" - }, - { - "$ref": "#/definitions/ConditionalAxisColor" - } - ] - }, - "tickCount": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/TimeInterval" - }, - { - "$ref": "#/definitions/TimeIntervalStep" - } - ], - "description": "A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are \"nice\" (multiples of 2, 5, 10) and lie within the underlying scale's range.\n\nFor scales of type `\"time\"` or `\"utc\"`, the tick count can instead be a time interval specifier. Legal string values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and \"year\". Alternatively, an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary.\n\n__Default value__: Determine using a formula `ceil(width/40)` for x and `ceil(height/40)` for y.", - "minimum": 0 - }, - "tickDash": { - "anyOf": [ - { - "description": "An array of alternating [stroke, space] lengths for dashed tick mark lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - { - "$ref": "#/definitions/ConditionalAxisNumberArray" - } - ] - }, - "tickDashOffset": { - "anyOf": [ - { - "description": "The pixel offset at which to start drawing with the tick mark dash array.", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "tickExtra": { - "description": "Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `\"bandPosition\": 1` and an axis `\"padding\"` value of `0`.", - "type": "boolean" - }, - "tickMinStep": { - "description": "The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.", - "type": "number" - }, - "tickOffset": { - "description": "Position offset in pixels to apply to ticks, labels, and gridlines.", - "type": "number" - }, - "tickOpacity": { - "anyOf": [ - { - "description": "Opacity of the ticks.", - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "tickRound": { - "description": "Boolean flag indicating if pixel position values should be rounded to the nearest integer.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "tickSize": { - "anyOf": [ - { - "description": "The size in pixels of axis ticks.\n\n__Default value:__ `5`", - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "tickWidth": { - "anyOf": [ - { - "description": "The width, in pixels, of ticks.\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - { - "$ref": "#/definitions/ConditionalAxisNumber" - } - ] - }, - "ticks": { - "description": "Boolean value that determines whether the axis should include ticks.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "titleAlign": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment of axis titles." - }, - "titleAnchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "Text anchor position for placing axis titles." - }, - "titleAngle": { - "description": "Angle in degrees of axis titles.", - "type": "number" - }, - "titleBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "Vertical text baseline for axis titles. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone." - }, - "titleColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Color of the title, can be in hex color code or regular color name." - }, - "titleFont": { - "description": "Font of the title. (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "titleFontSize": { - "description": "Font size of the title.", - "minimum": 0, - "type": "number" - }, - "titleFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "Font style of the title." - }, - "titleFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "Font weight of the title.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "titleLimit": { - "description": "Maximum allowed pixel width of axis titles.", - "minimum": 0, - "type": "number" - }, - "titleLineHeight": { - "description": "Line height in pixels for multi-line title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "titleOpacity": { - "description": "Opacity of the axis title.", - "type": "number" - }, - "titlePadding": { - "description": "The padding, in pixels, between title and axis.", - "type": "number" - }, - "titleX": { - "description": "X-coordinate of the axis title relative to the axis group.", - "type": "number" - }, - "titleY": { - "description": "Y-coordinate of the axis title relative to the axis group.", - "type": "number" - }, - "translate": { - "description": "Coordinate space translation offset for axis layout. By default, axes are translated by a 0.5 pixel offset for both the x and y coordinates in order to align stroked lines with the pixel grid. However, for vector graphics output these pixel-specific adjustments may be undesirable, in which case translate can be changed (for example, to zero).\n\n__Default value:__ `0.5`", - "type": "number" - }, - "values": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "items": { - "type": "boolean" - }, - "type": "array" - }, - { - "items": { - "$ref": "#/definitions/DateTime" - }, - "type": "array" - } - ], - "description": "Explicitly set the visible axis tick values." - }, - "zindex": { - "description": "A non-negative integer indicating the z-index of the axis.\nIf zindex is 0, axes should be drawn behind all chart elements.\nTo put them in front, set `zindex` to `1` or more.\n\n__Default value:__ `0` (behind the marks).", - "minimum": 0, - "type": "number" - } - }, - "type": "object" - }, - "AxisOrient": { - "enum": [ - "top", - "bottom", - "left", - "right" - ], - "type": "string" - }, - "AxisResolveMap": { - "additionalProperties": false, - "properties": { - "x": { - "$ref": "#/definitions/ResolveMode" - }, - "y": { - "$ref": "#/definitions/ResolveMode" - } - }, - "type": "object" - }, - "BarConfig": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`." - }, - "angle": { - "description": "The rotation angle of the text, in degrees.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree.", - "type": "boolean" - }, - "ariaRole": { - "description": "Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"role\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "ariaRoleDescription": { - "description": "A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"aria-roledescription\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "aspect": { - "description": "Whether to keep aspect ratio of image marks.", - "type": "boolean" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone." - }, - "binSpacing": { - "description": "Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style).\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - "blend": { - "$ref": "#/definitions/Blend", - "description": "The color blend mode for drawing an item on its current background. Any valid [CSS mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) value can be used.\n\n__Default value: `\"source-over\"`" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "continuousBandSize": { - "description": "The default size of the bars on continuous scales.\n\n__Default value:__ `5`", - "minimum": 0, - "type": "number" - }, - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomLeft": { - "description": "The radius in pixels of rounded rectangles' bottom left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomRight": { - "description": "The radius in pixels of rounded rectangles' bottom right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusEnd": { - "description": "- For vertical bars, top-left and top-right corner radius.\n- For horizontal bars, top-right and bottom-right corner radius.", - "type": "number" - }, - "cornerRadiusTopLeft": { - "description": "The radius in pixels of rounded rectangles' top right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopRight": { - "description": "The radius in pixels of rounded rectangles' top left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "description": { - "description": "A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute).", - "type": "string" - }, - "dir": { - "$ref": "#/definitions/TextDirection", - "description": "The direction of the text. One of `\"ltr\"` (left-to-right) or `\"rtl\"` (right-to-left). This property determines on which side is truncated in response to the limit parameter.\n\n__Default value:__ `\"ltr\"`" - }, - "discreteBandSize": { - "description": "The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.", - "minimum": 0, - "type": "number" - }, - "dx": { - "description": "The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "dy": { - "description": "The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "ellipsis": { - "description": "The ellipsis string for text truncated in response to the limit parameter.\n\n__Default value:__ `\"…\"`", - "type": "string" - }, - "endAngle": { - "description": "The end angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n\n__Default value:__ (None)" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "filled": { - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n\n__Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).", - "type": "boolean" - }, - "font": { - "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "fontSize": { - "description": "The font size, in pixels.\n\n__Default value:__ `11`", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style (e.g., `\"italic\"`)." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "height": { - "description": "Height of the marks.", - "type": "number" - }, - "href": { - "description": "A URL to load upon mouse click. If defined, the mark acts as a hyperlink.", - "format": "uri", - "type": "string" - }, - "innerRadius": { - "description": "The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.", - "type": "number" - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method to use for line and area marks. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"step-before\"`: alternate between vertical and horizontal segments, as in a step function.\n- `\"step-after\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null - ], - "type": [ - "string", - "null" - ] - }, - "limit": { - "description": "The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0` -- indicating no limit", - "type": "number" - }, - "lineBreak": { - "description": "A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property is ignored if the text is array-valued.", - "type": "string" - }, - "lineHeight": { - "description": "The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "order": { - "description": "For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.", - "type": [ - "null", - "boolean" - ] - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "The orientation of a non-stacked bar, tick, area, and line charts.\nThe value is either horizontal (default) or vertical.\n- For bar, rule and tick, this determines whether the size of the bar and tick\nshould be applied to x or y dimension.\n- For area, this property determines the orient property of the Vega output.\n- For line and trail marks, this property determines the sort order of the points in the line\nif `config.sortLineBy` is not specified.\nFor stacked charts, this is always determined by the orientation of the stack;\ntherefore explicitly specified value will be ignored." - }, - "outerRadius": { - "description": "The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.", - "type": "number" - }, - "padAngle": { - "description": "The angular padding applied to sides of the arc, in radians.", - "type": "number" - }, - "radius": { - "description": "For arc mark, the primary (outer) radius in pixels.\n\nFor text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.", - "type": "number" - }, - "radius2": { - "description": "The secondary (inner) radius in pixels of arc marks.", - "type": "number" - }, - "shape": { - "anyOf": [ - { - "$ref": "#/definitions/SymbolShape" - }, - { - "type": "string" - } - ], - "description": "Shape of the point marks. Supported values include:\n- plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n- the line symbol `\"stroke\"`\n- centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n- a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n__Default value:__ `\"circle\"`" - }, - "size": { - "description": "Default size for marks.\n- For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n- For `bar`, this represents the band size of the bar, in pixels.\n- For `text`, this represents the font size, in pixels.\n\n__Default value:__\n- `30` for point, circle, square marks; width/height's `step`\n- `2` for bar marks with discrete dimensions;\n- `5` for bar marks with continuous dimensions;\n- `11` for text marks.", - "minimum": 0, - "type": "number" - }, - "startAngle": { - "description": "The start angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n\n__Default value:__ (None)" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOffset": { - "description": "The offset in pixels at which to draw the group stroke and fill. If unspecified, the default behavior is to dynamically offset stroked groups such that 1 pixel stroke widths align with the pixel grid.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "tension": { - "description": "Depending on the interpolation type, sets the tension parameter (for line and area marks).", - "type": "number" - }, - "text": { - "$ref": "#/definitions/Text", - "description": "Placeholder text if the `text` channel is not specified" - }, - "theta": { - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "theta2": { - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.", - "type": "number" - }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\nIf set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, - "timeUnitBandPosition": { - "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\nIf set to `0.5`, the marks will be positioned in the middle of the time unit band step.", - "type": "number" - }, - "tooltip": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/TooltipContent" - }, - { - "type": "null" - } - ], - "description": "The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n\n- If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n- If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n- If set to `null` or `false`, then no tooltip will be used.\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n\n__Default value:__ `null`" - }, - "width": { - "description": "Width of the marks.", - "type": "number" - }, - "x": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "y": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - } - }, - "type": "object" - }, - "BaseLegendLayout": { - "additionalProperties": false, - "properties": { - "anchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "The anchor point for legend orient group layout." - }, - "bounds": { - "$ref": "#/definitions/LayoutBounds", - "description": "The bounds calculation to use for legend orient group layout." - }, - "center": { - "description": "A flag to center legends within a shared orient group.", - "type": "boolean" - }, - "direction": { - "$ref": "#/definitions/Orientation", - "description": "The layout direction for legend orient group layout." - }, - "margin": { - "description": "The pixel margin between legends within a orient group.", - "type": "number" - }, - "offset": { - "description": "The pixel offset from the chart body for a legend orient group.", - "type": "number" - } - }, - "type": "object" - }, - "BaseTitleNoValueRefs": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment for title text. One of `\"left\"`, `\"center\"`, or `\"right\"`." - }, - "anchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "The anchor position for placing the title and subtitle text. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title." - }, - "angle": { - "description": "Angle in degrees of title and subtitle text.", - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG group, removing the title from the ARIA accessibility tree.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "Vertical text baseline for title and subtitle text. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone." - }, - "color": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Text color for title text." - }, - "dx": { - "description": "Delta offset for title and subtitle text x-coordinate.", - "type": "number" - }, - "dy": { - "description": "Delta offset for title and subtitle text y-coordinate.", - "type": "number" - }, - "font": { - "description": "Font name for title text.", - "type": "string" - }, - "fontSize": { - "description": "Font size in pixels for title text.", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "Font style for title text." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "Font weight for title text.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "frame": { - "anyOf": [ - { - "$ref": "#/definitions/TitleFrame" - }, - { - "type": "string" - } - ], - "description": "The reference frame for the anchor position, one of `\"bounds\"` (to anchor relative to the full bounding box) or `\"group\"` (to anchor relative to the group width or height)." - }, - "limit": { - "description": "The maximum allowed length in pixels of title and subtitle text.", - "minimum": 0, - "type": "number" - }, - "lineHeight": { - "description": "Line height in pixels for multi-line title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "offset": { - "description": "The orthogonal offset in pixels by which to displace the title group from its position along the edge of the chart.", - "type": "number" - }, - "orient": { - "$ref": "#/definitions/TitleOrient", - "description": "Default title orientation (`\"top\"`, `\"bottom\"`, `\"left\"`, or `\"right\"`)" - }, - "subtitleColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Text color for subtitle text." - }, - "subtitleFont": { - "description": "Font name for subtitle text.", - "type": "string" - }, - "subtitleFontSize": { - "description": "Font size in pixels for subtitle text.", - "minimum": 0, - "type": "number" - }, - "subtitleFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "Font style for subtitle text." - }, - "subtitleFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "Font weight for subtitle text.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "subtitleLineHeight": { - "description": "Line height in pixels for multi-line subtitle text.", - "type": "number" - }, - "subtitlePadding": { - "description": "The padding in pixels between title and subtitle text.", - "type": "number" - }, - "zindex": { - "description": "The integer z-index indicating the layering of the title group relative to other axis, mark, and legend groups.\n\n__Default value:__ `0`.", - "minimum": 0, - "type": "number" - } - }, - "type": "object" - }, - "Baseline": { - "enum": [ - "top", - "middle", - "bottom" - ], - "type": "string" - }, - "BinExtent": { - "anyOf": [ - { - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - { - "$ref": "#/definitions/SelectionExtent" - } - ] - }, - "BinParams": { - "additionalProperties": false, - "description": "Binning properties or boolean flag for determining whether to bin data or not.", - "properties": { - "anchor": { - "description": "A value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value.\n\n__Default value:__ the minimum bin extent value", - "type": "number" - }, - "base": { - "description": "The number base to use for automatic bin determination (default is base 10).\n\n__Default value:__ `10`", - "type": "number" - }, - "binned": { - "description": "When set to `true`, Vega-Lite treats the input data as already binned.", - "type": "boolean" - }, - "divide": { - "description": "Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints.\n\n__Default value:__ `[5, 2]`", - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 1, - "type": "array" - }, - "extent": { - "$ref": "#/definitions/BinExtent", - "description": "A two-element (`[min, max]`) array indicating the range of desired bin values." - }, - "maxbins": { - "description": "Maximum number of bins.\n\n__Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels", - "minimum": 2, - "type": "number" - }, - "minstep": { - "description": "A minimum allowable step size (particularly useful for integer values).", - "type": "number" - }, - "nice": { - "description": "If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "step": { - "description": "An exact step size to use between bins.\n\n__Note:__ If provided, options such as maxbins will be ignored.", - "type": "number" - }, - "steps": { - "description": "An array of allowable step sizes to choose from.", - "items": { - "type": "number" - }, - "minItems": 1, - "type": "array" - } - }, - "type": "object" - }, - "BinTransform": { - "additionalProperties": false, - "properties": { - "as": { - "anyOf": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - } - ], - "description": "The output fields at which to write the start and end bin values.\nThis can be either a string or an array of strings with two elements denoting the name for the fields for bin start and bin end respectively.\nIf a single string (e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`." - }, - "bin": { - "anyOf": [ - { - "enum": [ - true - ], - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - } - ], - "description": "An object indicating bin properties, or simply `true` for using default bin parameters." - }, - "field": { - "$ref": "#/definitions/FieldName", - "description": "The data field to bin." - } - }, - "required": [ - "bin", - "field", - "as" - ], - "type": "object" - }, - "BindCheckbox": { - "additionalProperties": false, - "properties": { - "debounce": { - "type": "number" - }, - "element": { - "$ref": "#/definitions/Element" - }, - "input": { - "enum": [ - "checkbox" - ], - "type": "string" - }, - "name": { - "type": "string" - }, - "type": { - "type": "string" - } - }, - "required": [ - "input" - ], - "type": "object" - }, - "BindRadioSelect": { - "additionalProperties": false, - "properties": { - "debounce": { - "type": "number" - }, - "element": { - "$ref": "#/definitions/Element" - }, - "input": { - "enum": [ - "radio", - "select" - ], - "type": "string" - }, - "labels": { - "items": { - "type": "string" - }, - "type": "array" - }, - "name": { - "type": "string" - }, - "options": { - "items": { - }, - "type": "array" - }, - "type": { - "type": "string" - } - }, - "required": [ - "input", - "options" - ], - "type": "object" - }, - "BindRange": { - "additionalProperties": false, - "properties": { - "debounce": { - "type": "number" - }, - "element": { - "$ref": "#/definitions/Element" - }, - "input": { - "enum": [ - "range" - ], - "type": "string" - }, - "max": { - "type": "number" - }, - "min": { - "type": "number" - }, - "name": { - "type": "string" - }, - "step": { - "type": "number" - }, - "type": { - "type": "string" - } - }, - "required": [ - "input" - ], - "type": "object" - }, - "Binding": { - "anyOf": [ - { - "$ref": "#/definitions/BindCheckbox" - }, - { - "$ref": "#/definitions/BindRadioSelect" - }, - { - "$ref": "#/definitions/BindRange" - }, - { - "$ref": "#/definitions/InputBinding" - } - ] - }, - "Blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "type": [ - "null", - "string" - ] - }, - "BoxPlot": { - "enum": [ - "boxplot" - ], - "type": "string" - }, - "BoxPlotConfig": { - "additionalProperties": false, - "properties": { - "box": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "extent": { - "anyOf": [ - { - "enum": [ - "min-max" - ], - "type": "string" - }, - { - "type": "number" - } - ], - "description": "The extent of the whiskers. Available options include:\n- `\"min-max\"`: min and max are the lower and upper whiskers respectively.\n- A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_).\n\n__Default value:__ `1.5`." - }, - "median": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "outliers": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "rule": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "size": { - "description": "Size of the box and median tick of a box plot", - "type": "number" - }, - "ticks": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - } - }, - "type": "object" - }, - "BoxPlotDef": { - "additionalProperties": false, - "properties": { - "box": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "clip": { - "description": "Whether a composite mark be clipped to the enclosing group’s width and height.", - "type": "boolean" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "extent": { - "anyOf": [ - { - "enum": [ - "min-max" - ], - "type": "string" - }, - { - "type": "number" - } - ], - "description": "The extent of the whiskers. Available options include:\n- `\"min-max\"`: min and max are the lower and upper whiskers respectively.\n- A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_).\n\n__Default value:__ `1.5`." - }, - "median": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "opacity": { - "description": "The opacity (value between [0,1]) of the mark.", - "type": "number" - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "Orientation of the box plot. This is normally automatically determined based on types of fields on x and y channels. However, an explicit `orient` be specified when the orientation is ambiguous.\n\n__Default value:__ `\"vertical\"`." - }, - "outliers": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "rule": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "size": { - "description": "Size of the box and median tick of a box plot", - "type": "number" - }, - "ticks": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "type": { - "$ref": "#/definitions/BoxPlot", - "description": "The mark type. This could a primitive mark type\n(one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n`\"area\"`, `\"point\"`, `\"geoshape\"`, `\"rule\"`, and `\"text\"`)\nor a composite mark type (`\"boxplot\"`, `\"errorband\"`, `\"errorbar\"`)." - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "BrushConfig": { - "additionalProperties": false, - "properties": { - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the interval mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "fill": { - "$ref": "#/definitions/Color", - "description": "The fill color of the interval mark.\n\n__Default value:__ `\"#333333\"`" - }, - "fillOpacity": { - "description": "The fill opacity of the interval mark (a value between `0` and `1`).\n\n__Default value:__ `0.125`", - "type": "number" - }, - "stroke": { - "$ref": "#/definitions/Color", - "description": "The stroke color of the interval mark.\n\n__Default value:__ `\"#ffffff\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke and space lengths, for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) with which to begin drawing the stroke dash array.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity of the interval mark (a value between `0` and `1`).", - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width of the interval mark.", - "type": "number" - } - }, - "type": "object" - }, - "CalculateTransform": { - "additionalProperties": false, - "properties": { - "as": { - "$ref": "#/definitions/FieldName", - "description": "The field for storing the computed formula value." - }, - "calculate": { - "description": "A [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string. Use the variable `datum` to refer to the current data object.", - "type": "string" - } - }, - "required": [ - "calculate", - "as" - ], - "type": "object" - }, - "Categorical": { - "enum": [ - "accent", - "category10", - "category20", - "category20b", - "category20c", - "dark2", - "paired", - "pastel1", - "pastel2", - "set1", - "set2", - "set3", - "tableau10", - "tableau20" - ], - "type": "string" - }, - "Color": { - "anyOf": [ - { - "$ref": "#/definitions/ColorName" - }, - { - "$ref": "#/definitions/HexColor" - }, - { - "type": "string" - } - ] - }, - "ColorDef": { - "$ref": "#/definitions/MarkPropDef<(Gradient|string|null)>" - }, - "ColorName": { - "enum": [ - "black", - "silver", - "gray", - "white", - "maroon", - "red", - "purple", - "fuchsia", - "green", - "lime", - "olive", - "yellow", - "navy", - "blue", - "teal", - "aqua", - "orange", - "aliceblue", - "antiquewhite", - "aquamarine", - "azure", - "beige", - "bisque", - "blanchedalmond", - "blueviolet", - "brown", - "burlywood", - "cadetblue", - "chartreuse", - "chocolate", - "coral", - "cornflowerblue", - "cornsilk", - "crimson", - "cyan", - "darkblue", - "darkcyan", - "darkgoldenrod", - "darkgray", - "darkgreen", - "darkgrey", - "darkkhaki", - "darkmagenta", - "darkolivegreen", - "darkorange", - "darkorchid", - "darkred", - "darksalmon", - "darkseagreen", - "darkslateblue", - "darkslategray", - "darkslategrey", - "darkturquoise", - "darkviolet", - "deeppink", - "deepskyblue", - "dimgray", - "dimgrey", - "dodgerblue", - "firebrick", - "floralwhite", - "forestgreen", - "gainsboro", - "ghostwhite", - "gold", - "goldenrod", - "greenyellow", - "grey", - "honeydew", - "hotpink", - "indianred", - "indigo", - "ivory", - "khaki", - "lavender", - "lavenderblush", - "lawngreen", - "lemonchiffon", - "lightblue", - "lightcoral", - "lightcyan", - "lightgoldenrodyellow", - "lightgray", - "lightgreen", - "lightgrey", - "lightpink", - "lightsalmon", - "lightseagreen", - "lightskyblue", - "lightslategray", - "lightslategrey", - "lightsteelblue", - "lightyellow", - "limegreen", - "linen", - "magenta", - "mediumaquamarine", - "mediumblue", - "mediumorchid", - "mediumpurple", - "mediumseagreen", - "mediumslateblue", - "mediumspringgreen", - "mediumturquoise", - "mediumvioletred", - "midnightblue", - "mintcream", - "mistyrose", - "moccasin", - "navajowhite", - "oldlace", - "olivedrab", - "orangered", - "orchid", - "palegoldenrod", - "palegreen", - "paleturquoise", - "palevioletred", - "papayawhip", - "peachpuff", - "peru", - "pink", - "plum", - "powderblue", - "rosybrown", - "royalblue", - "saddlebrown", - "salmon", - "sandybrown", - "seagreen", - "seashell", - "sienna", - "skyblue", - "slateblue", - "slategray", - "slategrey", - "snow", - "springgreen", - "steelblue", - "tan", - "thistle", - "tomato", - "turquoise", - "violet", - "wheat", - "whitesmoke", - "yellowgreen", - "rebeccapurple" - ], - "type": "string" - }, - "ColorScheme": { - "anyOf": [ - { - "$ref": "#/definitions/Categorical" - }, - { - "$ref": "#/definitions/SequentialSingleHue" - }, - { - "$ref": "#/definitions/SequentialMultiHue" - }, - { - "$ref": "#/definitions/Diverging" - }, - { - "$ref": "#/definitions/Cyclical" - } - ] - }, - "Encoding": { - "additionalProperties": false, - "properties": { - "angle": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Rotation angle of point and text marks." - }, - "color": { - "$ref": "#/definitions/ColorDef", - "description": "Color of the marks – either fill or stroke color based on the `filled` property of mark definition.\nBy default, `color` represents fill color for `\"area\"`, `\"bar\"`, `\"tick\"`,\n`\"text\"`, `\"trail\"`, `\"circle\"`, and `\"square\"` / stroke color for `\"line\"` and `\"point\"`.\n\n__Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n\n_Note:_\n1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme)." - }, - "description": { - "anyOf": [ - { - "$ref": "#/definitions/StringFieldDefWithCondition" - }, - { - "$ref": "#/definitions/StringValueDefWithCondition" - } - ], - "description": "A text description of this mark for ARIA accessibility (SVG output only). For SVG output the `\"aria-label\"` attribute will be set to this description." - }, - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/FieldDefWithoutScale" - }, - { - "items": { - "$ref": "#/definitions/FieldDefWithoutScale" - }, - "type": "array" - } - ], - "description": "Additional levels of detail for grouping data in aggregate views and\nin line, trail, and area marks without mapping data to a specific visual channel." - }, - "fill": { - "$ref": "#/definitions/ColorDef", - "description": "Fill color of the marks.\n__Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n\n_Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified." - }, - "fillOpacity": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Fill opacity of the marks.\n\n__Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `fillOpacity` property." - }, - "href": { - "anyOf": [ - { - "$ref": "#/definitions/StringFieldDefWithCondition" - }, - { - "$ref": "#/definitions/StringValueDefWithCondition" - } - ], - "description": "A URL to load upon mouse click." - }, - "key": { - "$ref": "#/definitions/FieldDefWithoutScale", - "description": "A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data." - }, - "latitude": { - "$ref": "#/definitions/LatLongDef", - "description": "Latitude position of geographically projected marks." - }, - "latitude2": { - "$ref": "#/definitions/Position2Def", - "description": "Latitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`." - }, - "longitude": { - "$ref": "#/definitions/LatLongDef", - "description": "Longitude position of geographically projected marks." - }, - "longitude2": { - "$ref": "#/definitions/Position2Def", - "description": "Longitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`." - }, - "opacity": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Opacity of the marks.\n\n__Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `opacity` property." - }, - "order": { - "anyOf": [ - { - "$ref": "#/definitions/OrderFieldDef" - }, - { - "items": { - "$ref": "#/definitions/OrderFieldDef" - }, - "type": "array" - }, - { - "$ref": "#/definitions/OrderValueDef" - } - ], - "description": "Order of the marks.\n- For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n- For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{\"value\": null}` makes the line marks use the original order in the data sources.\n- Otherwise, this `order` channel encodes layer order of the marks.\n\n__Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping." - }, - "radius": { - "$ref": "#/definitions/PolarDef", - "description": "The outer radius in pixels of arc marks." - }, - "radius2": { - "$ref": "#/definitions/Position2Def", - "description": "The inner radius in pixels of arc marks." - }, - "shape": { - "$ref": "#/definitions/ShapeDef", - "description": "Shape of the mark.\n\n1. For `point` marks the supported values include:\n - plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n - the line symbol `\"stroke\"`\n - centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n2. For `geoshape` marks it should be a field definition of the geojson data\n\n__Default value:__ If undefined, the default shape depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#point-config)'s `shape` property. (`\"circle\"` if unset.)" - }, - "size": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Size of the mark.\n- For `\"point\"`, `\"square\"` and `\"circle\"`, – the symbol size, or pixel area of the mark.\n- For `\"bar\"` and `\"tick\"` – the bar and tick's size.\n- For `\"text\"` – the text's font size.\n- Size is unsupported for `\"line\"`, `\"area\"`, and `\"rect\"`. (Use `\"trail\"` instead of line with varying size)" - }, - "stroke": { - "$ref": "#/definitions/ColorDef", - "description": "Stroke color of the marks.\n__Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n\n_Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified." - }, - "strokeDash": { - "$ref": "#/definitions/NumericArrayMarkPropDef", - "description": "Stroke dash of the marks.\n\n__Default value:__ `[1,0]` (No dash)." - }, - "strokeOpacity": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Stroke opacity of the marks.\n\n__Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeOpacity` property." - }, - "strokeWidth": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Stroke width of the marks.\n\n__Default value:__ If undefined, the default stroke width depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeWidth` property." - }, - "text": { - "$ref": "#/definitions/TextDef", - "description": "Text of the `text` mark." - }, - "theta": { - "$ref": "#/definitions/PolarDef", - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians." - }, - "theta2": { - "$ref": "#/definitions/Position2Def", - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise." - }, - "tooltip": { - "anyOf": [ - { - "$ref": "#/definitions/StringFieldDefWithCondition" - }, - { - "$ref": "#/definitions/StringValueDefWithCondition" - }, - { - "items": { - "$ref": "#/definitions/StringFieldDef" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "description": "The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite." - }, - "url": { - "anyOf": [ - { - "$ref": "#/definitions/StringFieldDefWithCondition" - }, - { - "$ref": "#/definitions/StringValueDefWithCondition" - } - ], - "description": "The URL of an image mark." - }, - "x": { - "$ref": "#/definitions/PositionDef", - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "$ref": "#/definitions/Position2Def", - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "xError": { - "anyOf": [ - { - "$ref": "#/definitions/SecondaryFieldDef" - }, - { - "$ref": "#/definitions/ValueDef" - } - ], - "description": "Error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`." - }, - "xError2": { - "anyOf": [ - { - "$ref": "#/definitions/SecondaryFieldDef" - }, - { - "$ref": "#/definitions/ValueDef" - } - ], - "description": "Secondary error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`." - }, - "y": { - "$ref": "#/definitions/PositionDef", - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "$ref": "#/definitions/Position2Def", - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "yError": { - "anyOf": [ - { - "$ref": "#/definitions/SecondaryFieldDef" - }, - { - "$ref": "#/definitions/ValueDef" - } - ], - "description": "Error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`." - }, - "yError2": { - "anyOf": [ - { - "$ref": "#/definitions/SecondaryFieldDef" - }, - { - "$ref": "#/definitions/ValueDef" - } - ], - "description": "Secondary error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`." - } - }, - "type": "object" - }, - "CompositeMark": { - "anyOf": [ - { - "$ref": "#/definitions/BoxPlot" - }, - { - "$ref": "#/definitions/ErrorBar" - }, - { - "$ref": "#/definitions/ErrorBand" - } - ] - }, - "CompositeMarkDef": { - "anyOf": [ - { - "$ref": "#/definitions/BoxPlotDef" - }, - { - "$ref": "#/definitions/ErrorBarDef" - }, - { - "$ref": "#/definitions/ErrorBandDef" - } - ] - }, - "CompositionConfig": { - "additionalProperties": false, - "properties": { - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "spacing": { - "description": "The default spacing in pixels between composed sub-views.\n\n__Default value__: `20`", - "type": "number" - } - }, - "type": "object" - }, - "ConditionalMarkPropFieldOrDatumDef": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate" - }, - { - "$ref": "#/definitions/ConditionalSelection" - } - ] - }, - "ConditionalMarkPropFieldOrDatumDef": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "$ref": "#/definitions/ConditionalSelection>" - } - ] - }, - "ConditionalStringFieldDef": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate" - }, - { - "$ref": "#/definitions/ConditionalSelection" - } - ] - }, - "ConditionalValueDef<(Gradient|string|null)>": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "$ref": "#/definitions/ConditionalSelection>" - } - ] - }, - "ConditionalValueDef<(string|null)>": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "$ref": "#/definitions/ConditionalSelection>" - } - ] - }, - "ConditionalValueDef": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "$ref": "#/definitions/ConditionalSelection>" - } - ] - }, - "ConditionalValueDef": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "$ref": "#/definitions/ConditionalSelection>" - } - ] - }, - "ConditionalValueDef": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "$ref": "#/definitions/ConditionalSelection>" - } - ] - }, - "ConditionalValueDef": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "$ref": "#/definitions/ConditionalSelection>" - } - ] - }, - "ConditionalAxisColor": { - "$ref": "#/definitions/ConditionalAxisProperty<(Color|null)>" - }, - "ConditionalAxisLabelAlign": { - "$ref": "#/definitions/ConditionalAxisProperty<(Align|null)>" - }, - "ConditionalAxisLabelBaseline": { - "$ref": "#/definitions/ConditionalAxisProperty<(TextBaseline|null)>" - }, - "ConditionalAxisLabelFontStyle": { - "$ref": "#/definitions/ConditionalAxisProperty<(FontStyle|null)>" - }, - "ConditionalAxisLabelFontWeight": { - "$ref": "#/definitions/ConditionalAxisProperty<(FontWeight|null)>" - }, - "ConditionalAxisNumber": { - "$ref": "#/definitions/ConditionalAxisProperty<(number|null)>" - }, - "ConditionalAxisNumberArray": { - "$ref": "#/definitions/ConditionalAxisProperty<(number[]|null)>" - }, - "ConditionalAxisProperty<(Align|null)>": { - "additionalProperties": false, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalPredicate>" - }, - "type": "array" - } - ] - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Align" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "condition", - "value" - ], - "type": "object" - }, - "ConditionalAxisProperty<(Color|null)>": { - "additionalProperties": false, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalPredicate>" - }, - "type": "array" - } - ] - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "condition", - "value" - ], - "type": "object" - }, - "ConditionalAxisProperty<(FontStyle|null)>": { - "additionalProperties": false, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalPredicate>" - }, - "type": "array" - } - ] - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/FontStyle" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "condition", - "value" - ], - "type": "object" - }, - "ConditionalAxisProperty<(FontWeight|null)>": { - "additionalProperties": false, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalPredicate>" - }, - "type": "array" - } - ] - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/FontWeight" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "condition", - "value" - ], - "type": "object" - }, - "ConditionalAxisProperty<(TextBaseline|null)>": { - "additionalProperties": false, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalPredicate>" - }, - "type": "array" - } - ] - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/TextBaseline" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "condition", - "value" - ], - "type": "object" - }, - "ConditionalAxisProperty<(number[]|null)>": { - "additionalProperties": false, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalPredicate>" - }, - "type": "array" - } - ] - }, - "value": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "condition", - "value" - ], - "type": "object" - }, - "ConditionalAxisProperty<(number|null)>": { - "additionalProperties": false, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalPredicate>" - }, - "type": "array" - } - ] - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "number", - "null" - ] - } - }, - "required": [ - "condition", - "value" - ], - "type": "object" - }, - "ConditionalAxisProperty<(string|null)>": { - "additionalProperties": false, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalPredicate>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalPredicate>" - }, - "type": "array" - } - ] - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "condition", - "value" - ], - "type": "object" - }, - "ConditionalAxisString": { - "$ref": "#/definitions/ConditionalAxisProperty<(string|null)>" - }, - "ConditionalPredicate": { - "anyOf": [ - { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "test" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "test" - ], - "type": "object" - } - ] - }, - "ConditionalPredicate>": { - "anyOf": [ - { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/TypeForShape", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "test" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "test" - ], - "type": "object" - } - ] - }, - "ConditionalPredicate": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "test" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Align" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/FontStyle" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/FontWeight" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/TextBaseline" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "number", - "null" - ] - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "$ref": "#/definitions/Text", - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "items": { - "type": "number" - }, - "type": "array" - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalPredicate>": { - "additionalProperties": false, - "properties": { - "test": { - "$ref": "#/definitions/PredicateComposition", - "description": "Predicate for triggering the condition" - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "string" - } - }, - "required": [ - "test", - "value" - ], - "type": "object" - }, - "ConditionalSelection": { - "anyOf": [ - { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "selection" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "selection" - ], - "type": "object" - } - ] - }, - "ConditionalSelection>": { - "anyOf": [ - { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/TypeForShape", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "selection" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "selection" - ], - "type": "object" - } - ] - }, - "ConditionalSelection": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "required": [ - "selection" - ], - "type": "object" - }, - "ConditionalSelection>": { - "additionalProperties": false, - "properties": { - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "selection", - "value" - ], - "type": "object" - }, - "ConditionalSelection>": { - "additionalProperties": false, - "properties": { - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "selection", - "value" - ], - "type": "object" - }, - "ConditionalSelection>": { - "additionalProperties": false, - "properties": { - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "value": { - "$ref": "#/definitions/Text", - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "selection", - "value" - ], - "type": "object" - }, - "ConditionalSelection>": { - "additionalProperties": false, - "properties": { - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "required": [ - "selection", - "value" - ], - "type": "object" - }, - "ConditionalSelection>": { - "additionalProperties": false, - "properties": { - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "items": { - "type": "number" - }, - "type": "array" - } - }, - "required": [ - "selection", - "value" - ], - "type": "object" - }, - "ConditionalSelection>": { - "additionalProperties": false, - "properties": { - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose)." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "string" - } - }, - "required": [ - "selection", - "value" - ], - "type": "object" - }, - "Config": { - "additionalProperties": false, - "properties": { - "arc": { - "$ref": "#/definitions/RectConfig", - "description": "Arc-specific Config" - }, - "area": { - "$ref": "#/definitions/AreaConfig", - "description": "Area-Specific Config" - }, - "aria": { - "description": "A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the `\"aria-hidden\"` attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks.\n\n__Default value:__ `true`.", - "type": "boolean" - }, - "autosize": { - "anyOf": [ - { - "$ref": "#/definitions/AutosizeType" - }, - { - "$ref": "#/definitions/AutoSizeParams" - } - ], - "description": "How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\nObject values can additionally specify parameters for content sizing and automatic resizing.\n\n__Default value__: `pad`" - }, - "axis": { - "$ref": "#/definitions/AxisConfig", - "description": "Axis configuration, which determines default properties for all `x` and `y` [axes](https://vega.github.io/vega-lite/docs/axis.html). For a full list of axis configuration options, please see the [corresponding section of the axis documentation](https://vega.github.io/vega-lite/docs/axis.html#config)." - }, - "axisBand": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for axes with \"band\" scales." - }, - "axisBottom": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for x-axis along the bottom edge of the chart." - }, - "axisDiscrete": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for axes with \"point\" or \"band\" scales." - }, - "axisLeft": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for y-axis along the left edge of the chart." - }, - "axisPoint": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for axes with \"point\" scales." - }, - "axisQuantitative": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for quantitative axes." - }, - "axisRight": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for y-axis along the right edge of the chart." - }, - "axisTemporal": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for temporal axes." - }, - "axisTop": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for x-axis along the top edge of the chart." - }, - "axisX": { - "$ref": "#/definitions/AxisConfig", - "description": "X-axis specific config." - }, - "axisXBand": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for x-axes with \"band\" scales." - }, - "axisXDiscrete": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for x-axes with \"point\" or \"band\" scales." - }, - "axisXPoint": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for x-axes with \"point\" scales." - }, - "axisXQuantitative": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for x-quantitative axes." - }, - "axisXTemporal": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for x-temporal axes." - }, - "axisY": { - "$ref": "#/definitions/AxisConfig", - "description": "Y-axis specific config." - }, - "axisYBand": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for y-axes with \"band\" scales." - }, - "axisYDiscrete": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for y-axes with \"point\" or \"band\" scales." - }, - "axisYPoint": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for y-axes with \"point\" scales." - }, - "axisYQuantitative": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for y-quantitative axes." - }, - "axisYTemporal": { - "$ref": "#/definitions/AxisConfig", - "description": "Config for y-temporal axes." - }, - "background": { - "$ref": "#/definitions/Color", - "description": "CSS color property to use as the background of the entire view.\n\n__Default value:__ `\"white\"`" - }, - "bar": { - "$ref": "#/definitions/BarConfig", - "description": "Bar-Specific Config" - }, - "boxplot": { - "$ref": "#/definitions/BoxPlotConfig", - "description": "Box Config" - }, - "circle": { - "$ref": "#/definitions/MarkConfig", - "description": "Circle-Specific Config" - }, - "concat": { - "$ref": "#/definitions/CompositionConfig", - "description": "Default configuration for all concatenation and repeat view composition operators (`concat`, `hconcat`, `vconcat`, and `repeat`)" - }, - "countTitle": { - "description": "Default axis and legend title for count fields.\n\n__Default value:__ `'Count of Records`.", - "type": "string" - }, - "customFormatTypes": { - "description": "Allow the `formatType` property for text marks and guides to accept a custom formatter function [registered as a Vega expression](https://vega.github.io/vega-lite/usage/compile.html#format-type).", - "type": "boolean" - }, - "errorband": { - "$ref": "#/definitions/ErrorBandConfig", - "description": "ErrorBand Config" - }, - "errorbar": { - "$ref": "#/definitions/ErrorBarConfig", - "description": "ErrorBar Config" - }, - "facet": { - "$ref": "#/definitions/CompositionConfig", - "description": "Default configuration for the `facet` view composition operator" - }, - "fieldTitle": { - "description": "Defines how Vega-Lite generates title for fields. There are three possible styles:\n- `\"verbal\"` (Default) - displays function in a verbal style (e.g., \"Sum of field\", \"Year-month of date\", \"field (binned)\").\n- `\"function\"` - displays function using parentheses and capitalized texts (e.g., \"SUM(field)\", \"YEARMONTH(date)\", \"BIN(field)\").\n- `\"plain\"` - displays only the field name without functions (e.g., \"field\", \"date\", \"field\").", - "enum": [ - "verbal", - "functional", - "plain" - ], - "type": "string" - }, - "font": { - "description": "Default font for all text marks, titles, and labels.", - "type": "string" - }, - "geoshape": { - "$ref": "#/definitions/MarkConfig", - "description": "Geoshape-Specific Config" - }, - "header": { - "$ref": "#/definitions/HeaderConfig", - "description": "Header configuration, which determines default properties for all [headers](https://vega.github.io/vega-lite/docs/header.html).\n\nFor a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config)." - }, - "headerColumn": { - "$ref": "#/definitions/HeaderConfig", - "description": "Header configuration, which determines default properties for column [headers](https://vega.github.io/vega-lite/docs/header.html).\n\nFor a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config)." - }, - "headerFacet": { - "$ref": "#/definitions/HeaderConfig", - "description": "Header configuration, which determines default properties for non-row/column facet [headers](https://vega.github.io/vega-lite/docs/header.html).\n\nFor a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config)." - }, - "headerRow": { - "$ref": "#/definitions/HeaderConfig", - "description": "Header configuration, which determines default properties for row [headers](https://vega.github.io/vega-lite/docs/header.html).\n\nFor a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config)." - }, - "image": { - "$ref": "#/definitions/RectConfig", - "description": "Image-specific Config" - }, - "legend": { - "$ref": "#/definitions/LegendConfig", - "description": "Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config)." - }, - "line": { - "$ref": "#/definitions/LineConfig", - "description": "Line-Specific Config" - }, - "lineBreak": { - "description": "A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid.", - "type": "string" - }, - "mark": { - "$ref": "#/definitions/MarkConfig", - "description": "Mark Config" - }, - "numberFormat": { - "description": "D3 Number format for guide labels and text marks. For example `\"s\"` for SI units. Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format).", - "type": "string" - }, - "padding": { - "$ref": "#/definitions/Padding", - "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\nIf an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" - }, - "point": { - "$ref": "#/definitions/MarkConfig", - "description": "Point-Specific Config" - }, - "projection": { - "$ref": "#/definitions/ProjectionConfig", - "description": "Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config)." - }, - "range": { - "$ref": "#/definitions/RangeConfig", - "description": "An object hash that defines default range arrays or schemes for using with scales.\nFor a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config)." - }, - "rect": { - "$ref": "#/definitions/RectConfig", - "description": "Rect-Specific Config" - }, - "rule": { - "$ref": "#/definitions/MarkConfig", - "description": "Rule-Specific Config" - }, - "scale": { - "$ref": "#/definitions/ScaleConfig", - "description": "Scale configuration determines default properties for all [scales](https://vega.github.io/vega-lite/docs/scale.html). For a full list of scale configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config)." - }, - "selection": { - "$ref": "#/definitions/SelectionConfig", - "description": "An object hash for defining default properties for each type of selections." - }, - "square": { - "$ref": "#/definitions/MarkConfig", - "description": "Square-Specific Config" - }, - "style": { - "$ref": "#/definitions/StyleConfigIndex", - "description": "An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config)." - }, - "text": { - "$ref": "#/definitions/MarkConfig", - "description": "Text-Specific Config" - }, - "tick": { - "$ref": "#/definitions/TickConfig", - "description": "Tick-Specific Config" - }, - "timeFormat": { - "description": "Default time format for raw time values (without time units) in text marks, legend labels and header labels.\n\n__Default value:__ `\"%b %d, %Y\"`\n__Note:__ Axes automatically determine the format for each label automatically so this config does not affect axes.", - "type": "string" - }, - "title": { - "$ref": "#/definitions/TitleConfig", - "description": "Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config)." - }, - "trail": { - "$ref": "#/definitions/LineConfig", - "description": "Trail-Specific Config" - }, - "view": { - "$ref": "#/definitions/ViewConfig", - "description": "Default properties for [single view plots](https://vega.github.io/vega-lite/docs/spec.html#single)." - } - }, - "type": "object" - }, - "CsvDataFormat": { - "additionalProperties": false, - "properties": { - "parse": { - "anyOf": [ - { - "$ref": "#/definitions/Parse" - }, - { - "type": "null" - } - ], - "description": "If set to `null`, disable type inference based on the spec and only use type inference based on the data.\nAlternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `\"number\"`, `\"boolean\"`, `\"date\"`, or null (do not parse the field)).\nFor example, `\"parse\": {\"modified_on\": \"date\"}` parses the `modified_on` field in each input record a Date value.\n\nFor `\"date\"`, we parse data based using Javascript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).\nFor Specific date formats can be provided (e.g., `{foo: \"date:'%m%d%Y'\"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: \"utc:'%m%d%Y'\"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc)" - }, - "type": { - "description": "Type of input data: `\"json\"`, `\"csv\"`, `\"tsv\"`, `\"dsv\"`.\n\n__Default value:__ The default format type is determined by the extension of the file URL.\nIf no extension is detected, `\"json\"` will be used by default.", - "enum": [ - "csv", - "tsv" - ], - "type": "string" - } - }, - "type": "object" - }, - "Cursor": { - "enum": [ - "auto", - "default", - "none", - "context-menu", - "help", - "pointer", - "progress", - "wait", - "cell", - "crosshair", - "text", - "vertical-text", - "alias", - "copy", - "move", - "no-drop", - "not-allowed", - "e-resize", - "n-resize", - "ne-resize", - "nw-resize", - "s-resize", - "se-resize", - "sw-resize", - "w-resize", - "ew-resize", - "ns-resize", - "nesw-resize", - "nwse-resize", - "col-resize", - "row-resize", - "all-scroll", - "zoom-in", - "zoom-out", - "grab", - "grabbing" - ], - "type": "string" - }, - "Cyclical": { - "enum": [ - "rainbow", - "sinebow" - ], - "type": "string" - }, - "Data": { - "anyOf": [ - { - "$ref": "#/definitions/DataSource" - }, - { - "$ref": "#/definitions/Generator" - } - ] - }, - "DataFormat": { - "anyOf": [ - { - "$ref": "#/definitions/CsvDataFormat" - }, - { - "$ref": "#/definitions/DsvDataFormat" - }, - { - "$ref": "#/definitions/JsonDataFormat" - }, - { - "$ref": "#/definitions/TopoDataFormat" - } - ] - }, - "DataSource": { - "anyOf": [ - { - "$ref": "#/definitions/UrlData" - }, - { - "$ref": "#/definitions/InlineData" - }, - { - "$ref": "#/definitions/NamedData" - } - ] - }, - "Datasets": { - "$ref": "#/definitions/Dict" - }, - "DateTime": { - "additionalProperties": false, - "description": "Object for defining datetime in Vega-Lite Filter.\nIf both month and quarter are provided, month has higher precedence.\n`day` cannot be combined with other date.\nWe accept string for month and day names.", - "properties": { - "date": { - "description": "Integer value representing the date (day of the month) from 1-31.", - "maximum": 31, - "minimum": 1, - "type": "number" - }, - "day": { - "anyOf": [ - { - "$ref": "#/definitions/Day" - }, - { - "type": "string" - } - ], - "description": "Value representing the day of a week. This can be one of:\n(1) integer value -- `1` represents Monday;\n(2) case-insensitive day name (e.g., `\"Monday\"`);\n(3) case-insensitive, 3-character short day name (e.g., `\"Mon\"`).\n\n**Warning:** A DateTime definition object with `day`** should not be combined with `year`, `quarter`, `month`, or `date`." - }, - "hours": { - "description": "Integer value representing the hour of a day from 0-23.", - "maximum": 24, - "minimum": 0, - "type": "number" - }, - "milliseconds": { - "description": "Integer value representing the millisecond segment of time.", - "maximum": 1000, - "minimum": 0, - "type": "number" - }, - "minutes": { - "description": "Integer value representing the minute segment of time from 0-59.", - "maximum": 60, - "minimum": 0, - "type": "number" - }, - "month": { - "anyOf": [ - { - "$ref": "#/definitions/Month" - }, - { - "type": "string" - } - ], - "description": "One of:\n(1) integer value representing the month from `1`-`12`. `1` represents January;\n(2) case-insensitive month name (e.g., `\"January\"`);\n(3) case-insensitive, 3-character short month name (e.g., `\"Jan\"`)." - }, - "quarter": { - "description": "Integer value representing the quarter of the year (from 1-4).", - "maximum": 4, - "minimum": 1, - "type": "number" - }, - "seconds": { - "description": "Integer value representing the second segment (0-59) of a time value", - "maximum": 60, - "minimum": 0, - "type": "number" - }, - "utc": { - "description": "A boolean flag indicating if date time is in utc time. If false, the date time is in local time", - "type": "boolean" - }, - "year": { - "description": "Integer value representing the year.", - "type": "number" - } - }, - "type": "object" - }, - "DatumDef": { - "additionalProperties": false, - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "Day": { - "maximum": 7, - "minimum": 1, - "type": "number" - }, - "DensityTransform": { - "additionalProperties": false, - "properties": { - "as": { - "description": "The output fields for the sample value and corresponding density estimate.\n\n__Default value:__ `[\"value\", \"density\"]`", - "items": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "$ref": "#/definitions/FieldName" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "bandwidth": { - "description": "The bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott’s rule.", - "type": "number" - }, - "counts": { - "description": "A boolean flag indicating if the output values should be probability estimates (false) or smoothed counts (true).\n\n__Default value:__ `false`", - "type": "boolean" - }, - "cumulative": { - "description": "A boolean flag indicating whether to produce density estimates (false) or cumulative density estimates (true).\n\n__Default value:__ `false`", - "type": "boolean" - }, - "density": { - "$ref": "#/definitions/FieldName", - "description": "The data field for which to perform density estimation." - }, - "extent": { - "description": "A [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field.", - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "groupby": { - "description": "The data fields to group by. If not specified, a single group containing all data objects will be used.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "maxsteps": { - "description": "The maximum number of samples to take along the extent domain for plotting the density.\n\n__Default value:__ `200`", - "type": "number" - }, - "minsteps": { - "description": "The minimum number of samples to take along the extent domain for plotting the density.\n\n__Default value:__ `25`", - "type": "number" - }, - "steps": { - "description": "The exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities.", - "type": "number" - } - }, - "required": [ - "density" - ], - "type": "object" - }, - "DerivedStream": { - "additionalProperties": false, - "properties": { - "between": { - "items": { - "$ref": "#/definitions/Stream" - }, - "type": "array" - }, - "consume": { - "type": "boolean" - }, - "debounce": { - "type": "number" - }, - "filter": { - "anyOf": [ - { - "$ref": "#/definitions/Expr" - }, - { - "items": { - "$ref": "#/definitions/Expr" - }, - "type": "array" - } - ] - }, - "markname": { - "type": "string" - }, - "marktype": { - "$ref": "#/definitions/MarkType" - }, - "stream": { - "$ref": "#/definitions/Stream" - }, - "throttle": { - "type": "number" - } - }, - "required": [ - "stream" - ], - "type": "object" - }, - "Dict": { - "additionalProperties": { - "$ref": "#/definitions/InlineDataset" - }, - "type": "object" - }, - "Dict": { - "additionalProperties": { - "$ref": "#/definitions/SelectionInit" - }, - "type": "object" - }, - "Dict": { - "additionalProperties": { - "$ref": "#/definitions/SelectionInitInterval" - }, - "type": "object" - }, - "Dict": { - "additionalProperties": { - }, - "type": "object" - }, - "Diverging": { - "enum": [ - "blueorange", - "blueorange-3", - "blueorange-4", - "blueorange-5", - "blueorange-6", - "blueorange-7", - "blueorange-8", - "blueorange-9", - "blueorange-10", - "blueorange-11", - "brownbluegreen", - "brownbluegreen-3", - "brownbluegreen-4", - "brownbluegreen-5", - "brownbluegreen-6", - "brownbluegreen-7", - "brownbluegreen-8", - "brownbluegreen-9", - "brownbluegreen-10", - "brownbluegreen-11", - "purplegreen", - "purplegreen-3", - "purplegreen-4", - "purplegreen-5", - "purplegreen-6", - "purplegreen-7", - "purplegreen-8", - "purplegreen-9", - "purplegreen-10", - "purplegreen-11", - "pinkyellowgreen", - "pinkyellowgreen-3", - "pinkyellowgreen-4", - "pinkyellowgreen-5", - "pinkyellowgreen-6", - "pinkyellowgreen-7", - "pinkyellowgreen-8", - "pinkyellowgreen-9", - "pinkyellowgreen-10", - "pinkyellowgreen-11", - "purpleorange", - "purpleorange-3", - "purpleorange-4", - "purpleorange-5", - "purpleorange-6", - "purpleorange-7", - "purpleorange-8", - "purpleorange-9", - "purpleorange-10", - "purpleorange-11", - "redblue", - "redblue-3", - "redblue-4", - "redblue-5", - "redblue-6", - "redblue-7", - "redblue-8", - "redblue-9", - "redblue-10", - "redblue-11", - "redgrey", - "redgrey-3", - "redgrey-4", - "redgrey-5", - "redgrey-6", - "redgrey-7", - "redgrey-8", - "redgrey-9", - "redgrey-10", - "redgrey-11", - "redyellowblue", - "redyellowblue-3", - "redyellowblue-4", - "redyellowblue-5", - "redyellowblue-6", - "redyellowblue-7", - "redyellowblue-8", - "redyellowblue-9", - "redyellowblue-10", - "redyellowblue-11", - "redyellowgreen", - "redyellowgreen-3", - "redyellowgreen-4", - "redyellowgreen-5", - "redyellowgreen-6", - "redyellowgreen-7", - "redyellowgreen-8", - "redyellowgreen-9", - "redyellowgreen-10", - "redyellowgreen-11", - "spectral", - "spectral-3", - "spectral-4", - "spectral-5", - "spectral-6", - "spectral-7", - "spectral-8", - "spectral-9", - "spectral-10", - "spectral-11" - ], - "type": "string" - }, - "DomainUnionWith": { - "additionalProperties": false, - "properties": { - "unionWith": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "items": { - "type": "boolean" - }, - "type": "array" - }, - { - "items": { - "$ref": "#/definitions/DateTime" - }, - "type": "array" - } - ], - "description": "Customized domain values to be union with the field's values.\n\n1) `domain` for _quantitative_ fields can take one of the following forms:\n\n- a two-element array with minimum and maximum values.\n- an array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). (Alternatively, the `domainMid` property can be set for a diverging scale.)\n- a string value `\"unaggregated\"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation.\n\n2) `domain` for _temporal_ fields can be a two-element array minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime).\n\n3) `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values." - } - }, - "required": [ - "unionWith" - ], - "type": "object" - }, - "DsvDataFormat": { - "additionalProperties": false, - "properties": { - "delimiter": { - "description": "The delimiter between records. The delimiter must be a single character (i.e., a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not.", - "maxLength": 1, - "minLength": 1, - "type": "string" - }, - "parse": { - "anyOf": [ - { - "$ref": "#/definitions/Parse" - }, - { - "type": "null" - } - ], - "description": "If set to `null`, disable type inference based on the spec and only use type inference based on the data.\nAlternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `\"number\"`, `\"boolean\"`, `\"date\"`, or null (do not parse the field)).\nFor example, `\"parse\": {\"modified_on\": \"date\"}` parses the `modified_on` field in each input record a Date value.\n\nFor `\"date\"`, we parse data based using Javascript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).\nFor Specific date formats can be provided (e.g., `{foo: \"date:'%m%d%Y'\"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: \"utc:'%m%d%Y'\"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc)" - }, - "type": { - "description": "Type of input data: `\"json\"`, `\"csv\"`, `\"tsv\"`, `\"dsv\"`.\n\n__Default value:__ The default format type is determined by the extension of the file URL.\nIf no extension is detected, `\"json\"` will be used by default.", - "enum": [ - "dsv" - ], - "type": "string" - } - }, - "required": [ - "delimiter" - ], - "type": "object" - }, - "Element": { - "type": "string" - }, - "EncodingSortField": { - "additionalProperties": false, - "description": "A sort definition for sorting a discrete scale in an encoding field definition.", - "properties": { - "field": { - "$ref": "#/definitions/Field", - "description": "The data [field](https://vega.github.io/vega-lite/docs/field.html) to sort by.\n\n__Default value:__ If unspecified, defaults to the field specified in the outer data reference." - }, - "op": { - "$ref": "#/definitions/NonArgAggregateOp", - "description": "An [aggregate operation](https://vega.github.io/vega-lite/docs/aggregate.html#ops) to perform on the field prior to sorting (e.g., `\"count\"`, `\"mean\"` and `\"median\"`).\nAn aggregation is required when there are multiple values of the sort field for each encoded data field.\nThe input data objects will be aggregated, grouped by the encoded data field.\n\nFor a full list of operations, please see the documentation for [aggregate](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n\n__Default value:__ `\"sum\"` for stacked plots. Otherwise, `\"min\"`." - }, - "order": { - "anyOf": [ - { - "$ref": "#/definitions/SortOrder" - }, - { - "type": "null" - } - ], - "description": "The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort)." - } - }, - "type": "object" - }, - "EncodingSortField": { - "additionalProperties": false, - "description": "A sort definition for sorting a discrete scale in an encoding field definition.", - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "The data [field](https://vega.github.io/vega-lite/docs/field.html) to sort by.\n\n__Default value:__ If unspecified, defaults to the field specified in the outer data reference." - }, - "op": { - "$ref": "#/definitions/NonArgAggregateOp", - "description": "An [aggregate operation](https://vega.github.io/vega-lite/docs/aggregate.html#ops) to perform on the field prior to sorting (e.g., `\"count\"`, `\"mean\"` and `\"median\"`).\nAn aggregation is required when there are multiple values of the sort field for each encoded data field.\nThe input data objects will be aggregated, grouped by the encoded data field.\n\nFor a full list of operations, please see the documentation for [aggregate](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n\n__Default value:__ `\"sum\"` for stacked plots. Otherwise, `\"min\"`." - }, - "order": { - "anyOf": [ - { - "$ref": "#/definitions/SortOrder" - }, - { - "type": "null" - } - ], - "description": "The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort)." - } - }, - "type": "object" - }, - "ErrorBand": { - "enum": [ - "errorband" - ], - "type": "string" - }, - "ErrorBandConfig": { - "additionalProperties": false, - "properties": { - "band": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "borders": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "extent": { - "$ref": "#/definitions/ErrorBarExtent", - "description": "The extent of the band. Available options include:\n- `\"ci\"`: Extend the band to the confidence interval of the mean.\n- `\"stderr\"`: The size of band are set to the value of standard error, extending from the mean.\n- `\"stdev\"`: The size of band are set to the value of standard deviation, extending from the mean.\n- `\"iqr\"`: Extend the band to the q1 and q3.\n\n__Default value:__ `\"stderr\"`." - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method for the error band. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes at the midpoint of each pair of adjacent x-values.\n- `\"step-before\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes before the x-value.\n- `\"step-after\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes after the x-value.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "tension": { - "description": "The tension parameter for the interpolation type of the error band.", - "maximum": 1, - "minimum": 0, - "type": "number" - } - }, - "type": "object" - }, - "ErrorBandDef": { - "additionalProperties": false, - "properties": { - "band": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "borders": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "clip": { - "description": "Whether a composite mark be clipped to the enclosing group’s width and height.", - "type": "boolean" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "extent": { - "$ref": "#/definitions/ErrorBarExtent", - "description": "The extent of the band. Available options include:\n- `\"ci\"`: Extend the band to the confidence interval of the mean.\n- `\"stderr\"`: The size of band are set to the value of standard error, extending from the mean.\n- `\"stdev\"`: The size of band are set to the value of standard deviation, extending from the mean.\n- `\"iqr\"`: Extend the band to the q1 and q3.\n\n__Default value:__ `\"stderr\"`." - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method for the error band. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes at the midpoint of each pair of adjacent x-values.\n- `\"step-before\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes before the x-value.\n- `\"step-after\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes after the x-value.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "opacity": { - "description": "The opacity (value between [0,1]) of the mark.", - "type": "number" - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "Orientation of the error band. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined." - }, - "tension": { - "description": "The tension parameter for the interpolation type of the error band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "type": { - "$ref": "#/definitions/ErrorBand", - "description": "The mark type. This could a primitive mark type\n(one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n`\"area\"`, `\"point\"`, `\"geoshape\"`, `\"rule\"`, and `\"text\"`)\nor a composite mark type (`\"boxplot\"`, `\"errorband\"`, `\"errorbar\"`)." - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "ErrorBar": { - "enum": [ - "errorbar" - ], - "type": "string" - }, - "ErrorBarConfig": { - "additionalProperties": false, - "properties": { - "extent": { - "$ref": "#/definitions/ErrorBarExtent", - "description": "The extent of the rule. Available options include:\n- `\"ci\"`: Extend the rule to the confidence interval of the mean.\n- `\"stderr\"`: The size of rule are set to the value of standard error, extending from the mean.\n- `\"stdev\"`: The size of rule are set to the value of standard deviation, extending from the mean.\n- `\"iqr\"`: Extend the rule to the q1 and q3.\n\n__Default value:__ `\"stderr\"`." - }, - "rule": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "ticks": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - } - }, - "type": "object" - }, - "ErrorBarDef": { - "additionalProperties": false, - "properties": { - "clip": { - "description": "Whether a composite mark be clipped to the enclosing group’s width and height.", - "type": "boolean" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "extent": { - "$ref": "#/definitions/ErrorBarExtent", - "description": "The extent of the rule. Available options include:\n- `\"ci\"`: Extend the rule to the confidence interval of the mean.\n- `\"stderr\"`: The size of rule are set to the value of standard error, extending from the mean.\n- `\"stdev\"`: The size of rule are set to the value of standard deviation, extending from the mean.\n- `\"iqr\"`: Extend the rule to the q1 and q3.\n\n__Default value:__ `\"stderr\"`." - }, - "opacity": { - "description": "The opacity (value between [0,1]) of the mark.", - "type": "number" - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "Orientation of the error bar. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined." - }, - "rule": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "ticks": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MarkConfig" - } - ] - }, - "type": { - "$ref": "#/definitions/ErrorBar", - "description": "The mark type. This could a primitive mark type\n(one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n`\"area\"`, `\"point\"`, `\"geoshape\"`, `\"rule\"`, and `\"text\"`)\nor a composite mark type (`\"boxplot\"`, `\"errorband\"`, `\"errorbar\"`)." - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "ErrorBarExtent": { - "enum": [ - "ci", - "iqr", - "stderr", - "stdev" - ], - "type": "string" - }, - "EventStream": { - "anyOf": [ - { - "additionalProperties": false, - "properties": { - "between": { - "items": { - "$ref": "#/definitions/Stream" - }, - "type": "array" - }, - "consume": { - "type": "boolean" - }, - "debounce": { - "type": "number" - }, - "filter": { - "anyOf": [ - { - "$ref": "#/definitions/Expr" - }, - { - "items": { - "$ref": "#/definitions/Expr" - }, - "type": "array" - } - ] - }, - "markname": { - "type": "string" - }, - "marktype": { - "$ref": "#/definitions/MarkType" - }, - "source": { - "enum": [ - "view", - "scope" - ], - "type": "string" - }, - "throttle": { - "type": "number" - }, - "type": { - "$ref": "#/definitions/EventType" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "between": { - "items": { - "$ref": "#/definitions/Stream" - }, - "type": "array" - }, - "consume": { - "type": "boolean" - }, - "debounce": { - "type": "number" - }, - "filter": { - "anyOf": [ - { - "$ref": "#/definitions/Expr" - }, - { - "items": { - "$ref": "#/definitions/Expr" - }, - "type": "array" - } - ] - }, - "markname": { - "type": "string" - }, - "marktype": { - "$ref": "#/definitions/MarkType" - }, - "source": { - "enum": [ - "window" - ], - "type": "string" - }, - "throttle": { - "type": "number" - }, - "type": { - "$ref": "#/definitions/WindowEventType" - } - }, - "required": [ - "source", - "type" - ], - "type": "object" - } - ] - }, - "EventType": { - "enum": [ - "click", - "dblclick", - "dragenter", - "dragleave", - "dragover", - "keydown", - "keypress", - "keyup", - "mousedown", - "mousemove", - "mouseout", - "mouseover", - "mouseup", - "mousewheel", - "timer", - "touchend", - "touchmove", - "touchstart", - "wheel" - ], - "type": "string" - }, - "Expr": { - "type": "string" - }, - "FacetEncodingFieldDef": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "header": { - "$ref": "#/definitions/Header", - "description": "An object defining properties of a facet's header." - }, - "sort": { - "anyOf": [ - { - "$ref": "#/definitions/SortArray" - }, - { - "$ref": "#/definitions/SortOrder" - }, - { - "$ref": "#/definitions/EncodingSortField" - }, - { - "type": "null" - } - ], - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` is not supported for `row` and `column`." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FacetFieldDef": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "header": { - "$ref": "#/definitions/Header", - "description": "An object defining properties of a facet's header." - }, - "sort": { - "anyOf": [ - { - "$ref": "#/definitions/SortArray" - }, - { - "$ref": "#/definitions/SortOrder" - }, - { - "$ref": "#/definitions/EncodingSortField" - }, - { - "type": "null" - } - ], - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` is not supported for `row` and `column`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FacetFieldDef": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/FieldName", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "header": { - "$ref": "#/definitions/Header", - "description": "An object defining properties of a facet's header." - }, - "sort": { - "anyOf": [ - { - "$ref": "#/definitions/SortArray" - }, - { - "$ref": "#/definitions/SortOrder" - }, - { - "$ref": "#/definitions/EncodingSortField" - }, - { - "type": "null" - } - ], - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` is not supported for `row` and `column`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FacetMapping": { - "additionalProperties": false, - "properties": { - "column": { - "$ref": "#/definitions/FacetFieldDef", - "description": "A field definition for the horizontal facet of trellis plots." - }, - "row": { - "$ref": "#/definitions/FacetFieldDef", - "description": "A field definition for the vertical facet of trellis plots." - } - }, - "type": "object" - }, - "FacetMapping": { - "additionalProperties": false, - "properties": { - "column": { - "$ref": "#/definitions/FacetFieldDef", - "description": "A field definition for the horizontal facet of trellis plots." - }, - "row": { - "$ref": "#/definitions/FacetFieldDef", - "description": "A field definition for the vertical facet of trellis plots." - } - }, - "type": "object" - }, - "FacetedEncoding": { - "additionalProperties": false, - "properties": { - "angle": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Rotation angle of point and text marks." - }, - "color": { - "$ref": "#/definitions/ColorDef", - "description": "Color of the marks – either fill or stroke color based on the `filled` property of mark definition.\nBy default, `color` represents fill color for `\"area\"`, `\"bar\"`, `\"tick\"`,\n`\"text\"`, `\"trail\"`, `\"circle\"`, and `\"square\"` / stroke color for `\"line\"` and `\"point\"`.\n\n__Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n\n_Note:_\n1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme)." - }, - "column": { - "$ref": "#/definitions/RowColumnEncodingFieldDef", - "description": "A field definition for the horizontal facet of trellis plots." - }, - "description": { - "anyOf": [ - { - "$ref": "#/definitions/StringFieldDefWithCondition" - }, - { - "$ref": "#/definitions/StringValueDefWithCondition" - } - ], - "description": "A text description of this mark for ARIA accessibility (SVG output only). For SVG output the `\"aria-label\"` attribute will be set to this description." - }, - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/FieldDefWithoutScale" - }, - { - "items": { - "$ref": "#/definitions/FieldDefWithoutScale" - }, - "type": "array" - } - ], - "description": "Additional levels of detail for grouping data in aggregate views and\nin line, trail, and area marks without mapping data to a specific visual channel." - }, - "facet": { - "$ref": "#/definitions/FacetEncodingFieldDef", - "description": "A field definition for the (flexible) facet of trellis plots.\n\nIf either `row` or `column` is specified, this channel will be ignored." - }, - "fill": { - "$ref": "#/definitions/ColorDef", - "description": "Fill color of the marks.\n__Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n\n_Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified." - }, - "fillOpacity": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Fill opacity of the marks.\n\n__Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `fillOpacity` property." - }, - "href": { - "anyOf": [ - { - "$ref": "#/definitions/StringFieldDefWithCondition" - }, - { - "$ref": "#/definitions/StringValueDefWithCondition" - } - ], - "description": "A URL to load upon mouse click." - }, - "key": { - "$ref": "#/definitions/FieldDefWithoutScale", - "description": "A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data." - }, - "latitude": { - "$ref": "#/definitions/LatLongDef", - "description": "Latitude position of geographically projected marks." - }, - "latitude2": { - "$ref": "#/definitions/Position2Def", - "description": "Latitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`." - }, - "longitude": { - "$ref": "#/definitions/LatLongDef", - "description": "Longitude position of geographically projected marks." - }, - "longitude2": { - "$ref": "#/definitions/Position2Def", - "description": "Longitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`." - }, - "opacity": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Opacity of the marks.\n\n__Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `opacity` property." - }, - "order": { - "anyOf": [ - { - "$ref": "#/definitions/OrderFieldDef" - }, - { - "items": { - "$ref": "#/definitions/OrderFieldDef" - }, - "type": "array" - }, - { - "$ref": "#/definitions/OrderValueDef" - } - ], - "description": "Order of the marks.\n- For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n- For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{\"value\": null}` makes the line marks use the original order in the data sources.\n- Otherwise, this `order` channel encodes layer order of the marks.\n\n__Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping." - }, - "radius": { - "$ref": "#/definitions/PolarDef", - "description": "The outer radius in pixels of arc marks." - }, - "radius2": { - "$ref": "#/definitions/Position2Def", - "description": "The inner radius in pixels of arc marks." - }, - "row": { - "$ref": "#/definitions/RowColumnEncodingFieldDef", - "description": "A field definition for the vertical facet of trellis plots." - }, - "shape": { - "$ref": "#/definitions/ShapeDef", - "description": "Shape of the mark.\n\n1. For `point` marks the supported values include:\n - plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n - the line symbol `\"stroke\"`\n - centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n2. For `geoshape` marks it should be a field definition of the geojson data\n\n__Default value:__ If undefined, the default shape depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#point-config)'s `shape` property. (`\"circle\"` if unset.)" - }, - "size": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Size of the mark.\n- For `\"point\"`, `\"square\"` and `\"circle\"`, – the symbol size, or pixel area of the mark.\n- For `\"bar\"` and `\"tick\"` – the bar and tick's size.\n- For `\"text\"` – the text's font size.\n- Size is unsupported for `\"line\"`, `\"area\"`, and `\"rect\"`. (Use `\"trail\"` instead of line with varying size)" - }, - "stroke": { - "$ref": "#/definitions/ColorDef", - "description": "Stroke color of the marks.\n__Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n\n_Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified." - }, - "strokeDash": { - "$ref": "#/definitions/NumericArrayMarkPropDef", - "description": "Stroke dash of the marks.\n\n__Default value:__ `[1,0]` (No dash)." - }, - "strokeOpacity": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Stroke opacity of the marks.\n\n__Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeOpacity` property." - }, - "strokeWidth": { - "$ref": "#/definitions/NumericMarkPropDef", - "description": "Stroke width of the marks.\n\n__Default value:__ If undefined, the default stroke width depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeWidth` property." - }, - "text": { - "$ref": "#/definitions/TextDef", - "description": "Text of the `text` mark." - }, - "theta": { - "$ref": "#/definitions/PolarDef", - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians." - }, - "theta2": { - "$ref": "#/definitions/Position2Def", - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise." - }, - "tooltip": { - "anyOf": [ - { - "$ref": "#/definitions/StringFieldDefWithCondition" - }, - { - "$ref": "#/definitions/StringValueDefWithCondition" - }, - { - "items": { - "$ref": "#/definitions/StringFieldDef" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "description": "The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite." - }, - "url": { - "anyOf": [ - { - "$ref": "#/definitions/StringFieldDefWithCondition" - }, - { - "$ref": "#/definitions/StringValueDefWithCondition" - } - ], - "description": "The URL of an image mark." - }, - "x": { - "$ref": "#/definitions/PositionDef", - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "$ref": "#/definitions/Position2Def", - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "xError": { - "anyOf": [ - { - "$ref": "#/definitions/SecondaryFieldDef" - }, - { - "$ref": "#/definitions/ValueDef" - } - ], - "description": "Error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`." - }, - "xError2": { - "anyOf": [ - { - "$ref": "#/definitions/SecondaryFieldDef" - }, - { - "$ref": "#/definitions/ValueDef" - } - ], - "description": "Secondary error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`." - }, - "y": { - "$ref": "#/definitions/PositionDef", - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "$ref": "#/definitions/Position2Def", - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "yError": { - "anyOf": [ - { - "$ref": "#/definitions/SecondaryFieldDef" - }, - { - "$ref": "#/definitions/ValueDef" - } - ], - "description": "Error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`." - }, - "yError2": { - "anyOf": [ - { - "$ref": "#/definitions/SecondaryFieldDef" - }, - { - "$ref": "#/definitions/ValueDef" - } - ], - "description": "Secondary error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`." - } - }, - "type": "object" - }, - "FacetedUnitSpec": { - "additionalProperties": false, - "description": "Unit spec that can have a composite mark and row or column channels (shorthand for a facet spec).", - "properties": { - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "encoding": { - "$ref": "#/definitions/FacetedEncoding", - "description": "A key-value mapping between encoding channels and definition of fields." - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The height of a visualization.\n\n- For a plot with a continuous y-field, height should be a number.\n- For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.)\n- To enable responsive sizing on height, it should be set to `\"container\"`.\n\n__Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation." - }, - "mark": { - "$ref": "#/definitions/AnyMark", - "description": "A string describing the mark type (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n`\"area\"`, `\"point\"`, `\"rule\"`, `\"geoshape\"`, and `\"text\"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def)." - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "projection": { - "$ref": "#/definitions/Projection", - "description": "An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks\nand to `latitude` and `\"longitude\"` channels for other marks." - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "selection": { - "additionalProperties": { - "$ref": "#/definitions/SelectionDef" - }, - "description": "A key-value mapping between selection names and definitions.", - "type": "object" - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "view": { - "$ref": "#/definitions/ViewBackground", - "description": "An object defining the view background's fill and stroke.\n\n__Default value:__ none (transparent)" - }, - "width": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The width of a visualization.\n\n- For a plot with a continuous x-field, width should be a number.\n- For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.)\n- To enable responsive sizing on width, it should be set to `\"container\"`.\n\n__Default value:__\nBased on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation." - } - }, - "required": [ - "mark" - ], - "type": "object" - }, - "Field": { - "anyOf": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ] - }, - "FieldDefWithoutScale": { - "$ref": "#/definitions/TypedFieldDef", - "description": "Field Def without scale (and without bin: \"binned\" support)." - }, - "FieldEqualPredicate": { - "additionalProperties": false, - "properties": { - "equal": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/DateTime" - } - ], - "description": "The value that the field should be equal to." - }, - "field": { - "$ref": "#/definitions/FieldName", - "description": "Field to be tested." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit for the field to be tested." - } - }, - "required": [ - "equal", - "field" - ], - "type": "object" - }, - "FieldGTEPredicate": { - "additionalProperties": false, - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "Field to be tested." - }, - "gte": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/definitions/DateTime" - } - ], - "description": "The value that the field should be greater than or equals to." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit for the field to be tested." - } - }, - "required": [ - "field", - "gte" - ], - "type": "object" - }, - "FieldGTPredicate": { - "additionalProperties": false, - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "Field to be tested." - }, - "gt": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/definitions/DateTime" - } - ], - "description": "The value that the field should be greater than." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit for the field to be tested." - } - }, - "required": [ - "field", - "gt" - ], - "type": "object" - }, - "FieldLTEPredicate": { - "additionalProperties": false, - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "Field to be tested." - }, - "lte": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/definitions/DateTime" - } - ], - "description": "The value that the field should be less than or equals to." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit for the field to be tested." - } - }, - "required": [ - "field", - "lte" - ], - "type": "object" - }, - "FieldLTPredicate": { - "additionalProperties": false, - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "Field to be tested." - }, - "lt": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/definitions/DateTime" - } - ], - "description": "The value that the field should be less than." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit for the field to be tested." - } - }, - "required": [ - "field", - "lt" - ], - "type": "object" - }, - "FieldName": { - "type": "string" - }, - "FieldOneOfPredicate": { - "additionalProperties": false, - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "Field to be tested." - }, - "oneOf": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "items": { - "type": "boolean" - }, - "type": "array" - }, - { - "items": { - "$ref": "#/definitions/DateTime" - }, - "type": "array" - } - ], - "description": "A set of values that the `field`'s value should be a member of,\nfor a data item included in the filtered data." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit for the field to be tested." - } - }, - "required": [ - "field", - "oneOf" - ], - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition,(string|null)>": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/TypeForShape", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldOrDatumDefWithCondition": { - "additionalProperties": false, - "description": "A FieldDef with Condition\n{\n condition: {value: ...},\n field: ...,\n ...\n}", - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "FieldRangePredicate": { - "additionalProperties": false, - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "Field to be tested." - }, - "range": { - "description": "An array of inclusive minimum and maximum values\nfor a field value of a data item to be included in the filtered data.", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "type": "null" - } - ] - }, - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit for the field to be tested." - } - }, - "required": [ - "field", - "range" - ], - "type": "object" - }, - "FieldValidPredicate": { - "additionalProperties": false, - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "Field to be tested." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit for the field to be tested." - }, - "valid": { - "description": "If set to true the field's value has to be valid, meaning both not `null` and not [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN).", - "type": "boolean" - } - }, - "required": [ - "field", - "valid" - ], - "type": "object" - }, - "FilterTransform": { - "additionalProperties": false, - "properties": { - "filter": { - "$ref": "#/definitions/PredicateComposition", - "description": "The `filter` property must be a predication definition, which can takes one of the following forms:\n\n1) an [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string,\nwhere `datum` can be used to refer to the current data object.\nFor example, `{filter: \"datum.b2 > 60\"}` would make the output data includes only items that have values in the field `b2` over 60.\n\n2) one of the [field predicates](https://vega.github.io/vega-lite/docs/predicate.html#field-predicate): \n[`equal`](https://vega.github.io/vega-lite/docs/predicate.html#field-equal-predicate),\n[`lt`](https://vega.github.io/vega-lite/docs/predicate.html#lt-predicate),\n[`lte`](https://vega.github.io/vega-lite/docs/predicate.html#lte-predicate),\n[`gt`](https://vega.github.io/vega-lite/docs/predicate.html#gt-predicate),\n[`gte`](https://vega.github.io/vega-lite/docs/predicate.html#gte-predicate),\n[`range`](https://vega.github.io/vega-lite/docs/predicate.html#range-predicate),\n[`oneOf`](https://vega.github.io/vega-lite/docs/predicate.html#one-of-predicate),\nor [`valid`](https://vega.github.io/vega-lite/docs/predicate.html#valid-predicate),\n\n3) a [selection predicate](https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate), which define the names of a selection that the data point should belong to (or a logical composition of selections).\n\n4) a [logical composition](https://vega.github.io/vega-lite/docs/predicate.html#composition) of (1), (2), or (3)." - } - }, - "required": [ - "filter" - ], - "type": "object" - }, - "Fit": { - "anyOf": [ - { - "$ref": "#/definitions/GeoJsonFeature" - }, - { - "$ref": "#/definitions/GeoJsonFeatureCollection" - }, - { - "items": { - "$ref": "#/definitions/GeoJsonFeature" - }, - "type": "array" - } - ] - }, - "FlattenTransform": { - "additionalProperties": false, - "properties": { - "as": { - "description": "The output field names for extracted array values.\n\n__Default value:__ The field name of the corresponding array field", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "flatten": { - "description": "An array of one or more data fields containing arrays to flatten.\nIf multiple fields are specified, their array values should have a parallel structure, ideally with the same length.\nIf the lengths of parallel arrays do not match,\nthe longest array will be used with `null` values added for missing entries.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - } - }, - "required": [ - "flatten" - ], - "type": "object" - }, - "FoldTransform": { - "additionalProperties": false, - "properties": { - "as": { - "description": "The output field names for the key and value properties produced by the fold transform.\n__Default value:__ `[\"key\", \"value\"]`", - "items": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "$ref": "#/definitions/FieldName" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "fold": { - "description": "An array of data fields indicating the properties to fold.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - } - }, - "required": [ - "fold" - ], - "type": "object" - }, - "FontStyle": { - "type": "string" - }, - "FontWeight": { - "enum": [ - "normal", - "bold", - "lighter", - "bolder", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ], - "type": [ - "string", - "number" - ] - }, - "Generator": { - "anyOf": [ - { - "$ref": "#/definitions/SequenceGenerator" - }, - { - "$ref": "#/definitions/SphereGenerator" - }, - { - "$ref": "#/definitions/GraticuleGenerator" - } - ] - }, - "NormalizedConcatSpec": { - "additionalProperties": false, - "description": "Base interface for a generalized concatenation specification.", - "properties": { - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "concat": { - "description": "A list of views to be concatenated.", - "items": { - "$ref": "#/definitions/NormalizedSpec" - }, - "type": "array" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - } - }, - "required": [ - "concat" - ], - "type": "object" - }, - "ConcatSpec": { - "additionalProperties": false, - "description": "Base interface for a generalized concatenation specification.", - "properties": { - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "concat": { - "description": "A list of views to be concatenated.", - "items": { - "$ref": "#/definitions/Spec" - }, - "type": "array" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - } - }, - "required": [ - "concat" - ], - "type": "object" - }, - "NormalizedFacetSpec": { - "additionalProperties": false, - "description": "Base interface for a facet specification.", - "properties": { - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "facet": { - "anyOf": [ - { - "$ref": "#/definitions/FacetFieldDef" - }, - { - "$ref": "#/definitions/FacetMapping" - } - ], - "description": "Definition for how to facet the data. One of:\n1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def)\n2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping)" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "spec": { - "anyOf": [ - { - "$ref": "#/definitions/LayerSpec" - }, - { - "$ref": "#/definitions/FacetedUnitSpec" - } - ], - "description": "A specification of the view that gets faceted." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - } - }, - "required": [ - "facet", - "spec" - ], - "type": "object" - }, - "FacetSpec": { - "additionalProperties": false, - "description": "Base interface for a facet specification.", - "properties": { - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "facet": { - "anyOf": [ - { - "$ref": "#/definitions/FacetFieldDef" - }, - { - "$ref": "#/definitions/FacetMapping" - } - ], - "description": "Definition for how to facet the data. One of:\n1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def)\n2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping)" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "spec": { - "anyOf": [ - { - "$ref": "#/definitions/LayerSpec" - }, - { - "$ref": "#/definitions/FacetedUnitSpec" - } - ], - "description": "A specification of the view that gets faceted." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - } - }, - "required": [ - "facet", - "spec" - ], - "type": "object" - }, - "NormalizedHConcatSpec": { - "additionalProperties": false, - "description": "Base interface for a horizontal concatenation specification.", - "properties": { - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\n__Default value:__ `false`", - "type": "boolean" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "hconcat": { - "description": "A list of views to be concatenated and put into a row.", - "items": { - "$ref": "#/definitions/NormalizedSpec" - }, - "type": "array" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "description": "The spacing in pixels between sub-views of the concat operator.\n\n__Default value__: `10`", - "type": "number" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - } - }, - "required": [ - "hconcat" - ], - "type": "object" - }, - "HConcatSpec": { - "additionalProperties": false, - "description": "Base interface for a horizontal concatenation specification.", - "properties": { - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\n__Default value:__ `false`", - "type": "boolean" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "hconcat": { - "description": "A list of views to be concatenated and put into a row.", - "items": { - "$ref": "#/definitions/Spec" - }, - "type": "array" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "description": "The spacing in pixels between sub-views of the concat operator.\n\n__Default value__: `10`", - "type": "number" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - } - }, - "required": [ - "hconcat" - ], - "type": "object" - }, - "NormalizedSpec": { - "anyOf": [ - { - "$ref": "#/definitions/FacetedUnitSpec" - }, - { - "$ref": "#/definitions/LayerSpec" - }, - { - "$ref": "#/definitions/RepeatSpec" - }, - { - "$ref": "#/definitions/NormalizedFacetSpec" - }, - { - "$ref": "#/definitions/NormalizedConcatSpec" - }, - { - "$ref": "#/definitions/NormalizedVConcatSpec" - }, - { - "$ref": "#/definitions/NormalizedHConcatSpec" - } - ], - "description": "Any specification in Vega-Lite." - }, - "Spec": { - "anyOf": [ - { - "$ref": "#/definitions/FacetedUnitSpec" - }, - { - "$ref": "#/definitions/LayerSpec" - }, - { - "$ref": "#/definitions/RepeatSpec" - }, - { - "$ref": "#/definitions/FacetSpec" - }, - { - "$ref": "#/definitions/ConcatSpec" - }, - { - "$ref": "#/definitions/VConcatSpec" - }, - { - "$ref": "#/definitions/HConcatSpec" - } - ], - "description": "Any specification in Vega-Lite." - }, - "NormalizedVConcatSpec": { - "additionalProperties": false, - "description": "Base interface for a vertical concatenation specification.", - "properties": { - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\n__Default value:__ `false`", - "type": "boolean" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "description": "The spacing in pixels between sub-views of the concat operator.\n\n__Default value__: `10`", - "type": "number" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "vconcat": { - "description": "A list of views to be concatenated and put into a column.", - "items": { - "$ref": "#/definitions/NormalizedSpec" - }, - "type": "array" - } - }, - "required": [ - "vconcat" - ], - "type": "object" - }, - "VConcatSpec": { - "additionalProperties": false, - "description": "Base interface for a vertical concatenation specification.", - "properties": { - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\n__Default value:__ `false`", - "type": "boolean" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "description": "The spacing in pixels between sub-views of the concat operator.\n\n__Default value__: `10`", - "type": "number" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "vconcat": { - "description": "A list of views to be concatenated and put into a column.", - "items": { - "$ref": "#/definitions/Spec" - }, - "type": "array" - } - }, - "required": [ - "vconcat" - ], - "type": "object" - }, - "GeoJsonFeature": { - }, - "GeoJsonFeatureCollection": { - }, - "Gradient": { - "anyOf": [ - { - "$ref": "#/definitions/LinearGradient" - }, - { - "$ref": "#/definitions/RadialGradient" - } - ] - }, - "GradientStop": { - "additionalProperties": false, - "properties": { - "color": { - "$ref": "#/definitions/Color", - "description": "The color value at this point in the gradient." - }, - "offset": { - "description": "The offset fraction for the color stop, indicating its position within the gradient.", - "type": "number" - } - }, - "required": [ - "offset", - "color" - ], - "type": "object" - }, - "GraticuleGenerator": { - "additionalProperties": false, - "properties": { - "graticule": { - "anyOf": [ - { - "enum": [ - true - ], - "type": "boolean" - }, - { - "$ref": "#/definitions/GraticuleParams" - } - ], - "description": "Generate graticule GeoJSON data for geographic reference lines." - }, - "name": { - "description": "Provide a placeholder name and bind data at runtime.", - "type": "string" - } - }, - "required": [ - "graticule" - ], - "type": "object" - }, - "GraticuleParams": { - "additionalProperties": false, - "properties": { - "extent": { - "$ref": "#/definitions/Vector2>", - "description": "Sets both the major and minor extents to the same values." - }, - "extentMajor": { - "$ref": "#/definitions/Vector2>", - "description": "The major extent of the graticule as a two-element array of coordinates." - }, - "extentMinor": { - "$ref": "#/definitions/Vector2>", - "description": "The minor extent of the graticule as a two-element array of coordinates." - }, - "precision": { - "description": "The precision of the graticule in degrees.\n\n__Default value:__ `2.5`", - "type": "number" - }, - "step": { - "$ref": "#/definitions/Vector2", - "description": "Sets both the major and minor step angles to the same values." - }, - "stepMajor": { - "$ref": "#/definitions/Vector2", - "description": "The major step angles of the graticule.\n\n\n__Default value:__ `[90, 360]`" - }, - "stepMinor": { - "$ref": "#/definitions/Vector2", - "description": "The minor step angles of the graticule.\n\n__Default value:__ `[10, 10]`" - } - }, - "type": "object" - }, - "Header": { - "additionalProperties": false, - "description": "Headers of row / column channels for faceted plots.", - "properties": { - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelAlign": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment of header labels. One of `\"left\"`, `\"center\"`, or `\"right\"`." - }, - "labelAnchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "The anchor position for placing the labels. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label." - }, - "labelAngle": { - "description": "The rotation angle of the header labels.\n\n__Default value:__ `0` for column header, `-90` for row header.", - "maximum": 360, - "minimum": -360, - "type": "number" - }, - "labelBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline for the header labels. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\nThe `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone." - }, - "labelColor": { - "$ref": "#/definitions/Color", - "description": "The color of the header label, can be in hex color code or regular color name." - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the header's backing `datum` object.", - "type": "string" - }, - "labelFont": { - "description": "The font of the header label.", - "type": "string" - }, - "labelFontSize": { - "description": "The font size of the header label, in pixels.", - "minimum": 0, - "type": "number" - }, - "labelFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style of the header label." - }, - "labelFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight of the header label." - }, - "labelLimit": { - "description": "The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0`, indicating no limit", - "type": "number" - }, - "labelLineHeight": { - "description": "Line height in pixels for multi-line header labels or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "labelOrient": { - "$ref": "#/definitions/Orient", - "description": "The orientation of the header label. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`." - }, - "labelPadding": { - "description": "The padding, in pixel, between facet header's label and the plot.\n\n__Default value:__ `10`", - "type": "number" - }, - "labels": { - "description": "A boolean flag indicating if labels should be included as part of the header.\n\n__Default value:__ `true`.", - "type": "boolean" - }, - "orient": { - "$ref": "#/definitions/Orient", - "description": "Shortcut for setting both labelOrient and titleOrient." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "titleAlign": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment (to the anchor) of header titles." - }, - "titleAnchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title." - }, - "titleAngle": { - "description": "The rotation angle of the header title.\n\n__Default value:__ `0`.", - "maximum": 360, - "minimum": -360, - "type": "number" - }, - "titleBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline for the header title. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\nThe `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n\n__Default value:__ `\"middle\"`" - }, - "titleColor": { - "$ref": "#/definitions/Color", - "description": "Color of the header title, can be in hex color code or regular color name." - }, - "titleFont": { - "description": "Font of the header title. (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "titleFontSize": { - "description": "Font size of the header title.", - "minimum": 0, - "type": "number" - }, - "titleFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style of the header title." - }, - "titleFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "Font weight of the header title.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "titleLimit": { - "description": "The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0`, indicating no limit", - "type": "number" - }, - "titleLineHeight": { - "description": "Line height in pixels for multi-line header title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "titleOrient": { - "$ref": "#/definitions/Orient", - "description": "The orientation of the header title. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`." - }, - "titlePadding": { - "description": "The padding, in pixel, between facet header's title and the label.\n\n__Default value:__ `10`", - "type": "number" - } - }, - "type": "object" - }, - "HeaderConfig": { - "additionalProperties": false, - "properties": { - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelAlign": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment of header labels. One of `\"left\"`, `\"center\"`, or `\"right\"`." - }, - "labelAnchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "The anchor position for placing the labels. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label." - }, - "labelAngle": { - "description": "The rotation angle of the header labels.\n\n__Default value:__ `0` for column header, `-90` for row header.", - "maximum": 360, - "minimum": -360, - "type": "number" - }, - "labelBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline for the header labels. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\nThe `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone." - }, - "labelColor": { - "$ref": "#/definitions/Color", - "description": "The color of the header label, can be in hex color code or regular color name." - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the header's backing `datum` object.", - "type": "string" - }, - "labelFont": { - "description": "The font of the header label.", - "type": "string" - }, - "labelFontSize": { - "description": "The font size of the header label, in pixels.", - "minimum": 0, - "type": "number" - }, - "labelFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style of the header label." - }, - "labelFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight of the header label." - }, - "labelLimit": { - "description": "The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0`, indicating no limit", - "type": "number" - }, - "labelLineHeight": { - "description": "Line height in pixels for multi-line header labels or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "labelOrient": { - "$ref": "#/definitions/Orient", - "description": "The orientation of the header label. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`." - }, - "labelPadding": { - "description": "The padding, in pixel, between facet header's label and the plot.\n\n__Default value:__ `10`", - "type": "number" - }, - "labels": { - "description": "A boolean flag indicating if labels should be included as part of the header.\n\n__Default value:__ `true`.", - "type": "boolean" - }, - "orient": { - "$ref": "#/definitions/Orient", - "description": "Shortcut for setting both labelOrient and titleOrient." - }, - "title": { - "description": "Set to null to disable title for the axis, legend, or header.", - "type": "null" - }, - "titleAlign": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment (to the anchor) of header titles." - }, - "titleAnchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title." - }, - "titleAngle": { - "description": "The rotation angle of the header title.\n\n__Default value:__ `0`.", - "maximum": 360, - "minimum": -360, - "type": "number" - }, - "titleBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline for the header title. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\nThe `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n\n__Default value:__ `\"middle\"`" - }, - "titleColor": { - "$ref": "#/definitions/Color", - "description": "Color of the header title, can be in hex color code or regular color name." - }, - "titleFont": { - "description": "Font of the header title. (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "titleFontSize": { - "description": "Font size of the header title.", - "minimum": 0, - "type": "number" - }, - "titleFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style of the header title." - }, - "titleFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "Font weight of the header title.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "titleLimit": { - "description": "The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0`, indicating no limit", - "type": "number" - }, - "titleLineHeight": { - "description": "Line height in pixels for multi-line header title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "titleOrient": { - "$ref": "#/definitions/Orient", - "description": "The orientation of the header title. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`." - }, - "titlePadding": { - "description": "The padding, in pixel, between facet header's title and the label.\n\n__Default value:__ `10`", - "type": "number" - } - }, - "type": "object" - }, - "HexColor": { - "format": "color-hex", - "type": "string" - }, - "ImputeMethod": { - "enum": [ - "value", - "median", - "max", - "min", - "mean" - ], - "type": "string" - }, - "ImputeParams": { - "additionalProperties": false, - "properties": { - "frame": { - "description": "A frame specification as a two-element array used to control the window over which the specified method is applied. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. For example, the value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object.\n\n__Default value:__: `[null, null]` indicating that the window includes all objects.", - "items": [ - { - "type": [ - "null", - "number" - ] - }, - { - "type": [ - "null", - "number" - ] - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "keyvals": { - "anyOf": [ - { - "items": { - }, - "type": "array" - }, - { - "$ref": "#/definitions/ImputeSequence" - } - ], - "description": "Defines the key values that should be considered for imputation.\nAn array of key values or an object defining a [number sequence](https://vega.github.io/vega-lite/docs/impute.html#sequence-def).\n\nIf provided, this will be used in addition to the key values observed within the input data. If not provided, the values will be derived from all unique values of the `key` field. For `impute` in `encoding`, the key field is the x-field if the y-field is imputed, or vice versa.\n\nIf there is no impute grouping, this property _must_ be specified." - }, - "method": { - "$ref": "#/definitions/ImputeMethod", - "description": "The imputation method to use for the field value of imputed data objects.\nOne of `\"value\"`, `\"mean\"`, `\"median\"`, `\"max\"` or `\"min\"`.\n\n__Default value:__ `\"value\"`" - }, - "value": { - "description": "The field value to use when the imputation `method` is `\"value\"`." - } - }, - "type": "object" - }, - "ImputeSequence": { - "additionalProperties": false, - "properties": { - "start": { - "description": "The starting value of the sequence.\n__Default value:__ `0`", - "type": "number" - }, - "step": { - "description": "The step value between sequence entries.\n__Default value:__ `1` or `-1` if `stop < start`", - "type": "number" - }, - "stop": { - "description": "The ending value(exclusive) of the sequence.", - "type": "number" - } - }, - "required": [ - "stop" - ], - "type": "object" - }, - "ImputeTransform": { - "additionalProperties": false, - "properties": { - "frame": { - "description": "A frame specification as a two-element array used to control the window over which the specified method is applied. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. For example, the value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object.\n\n__Default value:__: `[null, null]` indicating that the window includes all objects.", - "items": [ - { - "type": [ - "null", - "number" - ] - }, - { - "type": [ - "null", - "number" - ] - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "groupby": { - "description": "An optional array of fields by which to group the values.\nImputation will then be performed on a per-group basis.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "impute": { - "$ref": "#/definitions/FieldName", - "description": "The data field for which the missing values should be imputed." - }, - "key": { - "$ref": "#/definitions/FieldName", - "description": "A key field that uniquely identifies data objects within a group.\nMissing key values (those occurring in the data but not in the current group) will be imputed." - }, - "keyvals": { - "anyOf": [ - { - "items": { - }, - "type": "array" - }, - { - "$ref": "#/definitions/ImputeSequence" - } - ], - "description": "Defines the key values that should be considered for imputation.\nAn array of key values or an object defining a [number sequence](https://vega.github.io/vega-lite/docs/impute.html#sequence-def).\n\nIf provided, this will be used in addition to the key values observed within the input data. If not provided, the values will be derived from all unique values of the `key` field. For `impute` in `encoding`, the key field is the x-field if the y-field is imputed, or vice versa.\n\nIf there is no impute grouping, this property _must_ be specified." - }, - "method": { - "$ref": "#/definitions/ImputeMethod", - "description": "The imputation method to use for the field value of imputed data objects.\nOne of `\"value\"`, `\"mean\"`, `\"median\"`, `\"max\"` or `\"min\"`.\n\n__Default value:__ `\"value\"`" - }, - "value": { - "description": "The field value to use when the imputation `method` is `\"value\"`." - } - }, - "required": [ - "impute", - "key" - ], - "type": "object" - }, - "InlineData": { - "additionalProperties": false, - "properties": { - "format": { - "$ref": "#/definitions/DataFormat", - "description": "An object that specifies the format for parsing the data." - }, - "name": { - "description": "Provide a placeholder name and bind data at runtime.", - "type": "string" - }, - "values": { - "$ref": "#/definitions/InlineDataset", - "description": "The full data set, included inline. This can be an array of objects or primitive values, an object, or a string.\nArrays of primitive values are ingested as objects with a `data` property. Strings are parsed according to the specified format type." - } - }, - "required": [ - "values" - ], - "type": "object" - }, - "InlineDataset": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "items": { - "type": "boolean" - }, - "type": "array" - }, - { - "items": { - "type": "object" - }, - "type": "array" - }, - { - "type": "string" - }, - { - "type": "object" - } - ] - }, - "InputBinding": { - "additionalProperties": false, - "properties": { - "autocomplete": { - "type": "string" - }, - "debounce": { - "type": "number" - }, - "element": { - "$ref": "#/definitions/Element" - }, - "input": { - "type": "string" - }, - "name": { - "type": "string" - }, - "placeholder": { - "type": "string" - }, - "type": { - "type": "string" - } - }, - "type": "object" - }, - "Interpolate": { - "enum": [ - "basis", - "basis-open", - "basis-closed", - "bundle", - "cardinal", - "cardinal-open", - "cardinal-closed", - "catmull-rom", - "linear", - "linear-closed", - "monotone", - "natural", - "step", - "step-before", - "step-after" - ], - "maximum": 900, - "minimum": 100, - "type": "string" - }, - "IntervalSelection": { - "additionalProperties": false, - "properties": { - "bind": { - "description": "Establishes a two-way binding between the interval selection and the scales\nused within the same view. This allows a user to interactively pan and\nzoom the view.\n\n__See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation.", - "enum": [ - "scales" - ], - "type": "string" - }, - "clear": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ], - "description": "Clears the selection, emptying it of all values. Can be a\n[Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n\n__Default value:__ `dblclick`.\n\n__See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation." - }, - "empty": { - "description": "By default, `all` data values are considered to lie within an empty selection.\nWhen set to `none`, empty selections contain no data values.", - "enum": [ - "all", - "none" - ], - "type": "string" - }, - "encodings": { - "description": "An array of encoding channels. The corresponding data field values\nmust match for a data tuple to fall within the selection.\n\n__See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/SingleDefUnitChannel" - }, - "type": "array" - }, - "fields": { - "description": "An array of field names whose values must match for a data tuple to\nfall within the selection.\n\n__See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "init": { - "$ref": "#/definitions/SelectionInitIntervalMapping", - "description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and arrays of\ninitial values.\n\n__See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation." - }, - "mark": { - "$ref": "#/definitions/BrushConfig", - "description": "An interval selection also adds a rectangle mark to depict the\nextents of the interval. The `mark` property can be used to customize the\nappearance of the mark.\n\n__See also:__ [`mark`](https://vega.github.io/vega-lite/docs/selection-mark.html) documentation." - }, - "on": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - } - ], - "description": "A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\nFor interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters)." - }, - "resolve": { - "$ref": "#/definitions/SelectionResolution", - "description": "With layered and multi-view displays, a strategy that determines how\nselections' data queries are resolved when applied in a filter transform,\nconditional encoding rule, or scale domain.\n\n__See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation." - }, - "translate": { - "description": "When truthy, allows a user to interactively move an interval selection\nback-and-forth. Can be `true`, `false` (to disable panning), or a\n[Vega event stream definition](https://vega.github.io/vega/docs/event-streams/)\nwhich must include a start and end event to trigger continuous panning.\n\n__Default value:__ `true`, which corresponds to\n`[mousedown, window:mouseup] > window:mousemove!` which corresponds to\nclicks and dragging within an interval selection to reposition it.\n\n__See also:__ [`translate`](https://vega.github.io/vega-lite/docs/translate.html) documentation.", - "type": [ - "string", - "boolean" - ] - }, - "type": { - "description": "Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types:\n\n- `\"single\"` -- to select a single discrete data value on `click`.\n- `\"multi\"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`.\n- `\"interval\"` -- to select a continuous range of data values on `drag`.", - "enum": [ - "interval" - ], - "type": "string" - }, - "zoom": { - "description": "When truthy, allows a user to interactively resize an interval selection.\nCan be `true`, `false` (to disable zooming), or a [Vega event stream\ndefinition](https://vega.github.io/vega/docs/event-streams/). Currently,\nonly `wheel` events are supported.\n\n__Default value:__ `true`, which corresponds to `wheel!`.\n\n__See also:__ [`zoom`](https://vega.github.io/vega-lite/docs/zoom.html) documentation.", - "type": [ - "string", - "boolean" - ] - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "IntervalSelectionConfig": { - "additionalProperties": false, - "properties": { - "bind": { - "description": "Establishes a two-way binding between the interval selection and the scales\nused within the same view. This allows a user to interactively pan and\nzoom the view.\n\n__See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation.", - "enum": [ - "scales" - ], - "type": "string" - }, - "clear": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ], - "description": "Clears the selection, emptying it of all values. Can be a\n[Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n\n__Default value:__ `dblclick`.\n\n__See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation." - }, - "empty": { - "description": "By default, `all` data values are considered to lie within an empty selection.\nWhen set to `none`, empty selections contain no data values.", - "enum": [ - "all", - "none" - ], - "type": "string" - }, - "encodings": { - "description": "An array of encoding channels. The corresponding data field values\nmust match for a data tuple to fall within the selection.\n\n__See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/SingleDefUnitChannel" - }, - "type": "array" - }, - "fields": { - "description": "An array of field names whose values must match for a data tuple to\nfall within the selection.\n\n__See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "init": { - "$ref": "#/definitions/SelectionInitIntervalMapping", - "description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and arrays of\ninitial values.\n\n__See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation." - }, - "mark": { - "$ref": "#/definitions/BrushConfig", - "description": "An interval selection also adds a rectangle mark to depict the\nextents of the interval. The `mark` property can be used to customize the\nappearance of the mark.\n\n__See also:__ [`mark`](https://vega.github.io/vega-lite/docs/selection-mark.html) documentation." - }, - "on": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - } - ], - "description": "A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\nFor interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters)." - }, - "resolve": { - "$ref": "#/definitions/SelectionResolution", - "description": "With layered and multi-view displays, a strategy that determines how\nselections' data queries are resolved when applied in a filter transform,\nconditional encoding rule, or scale domain.\n\n__See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation." - }, - "translate": { - "description": "When truthy, allows a user to interactively move an interval selection\nback-and-forth. Can be `true`, `false` (to disable panning), or a\n[Vega event stream definition](https://vega.github.io/vega/docs/event-streams/)\nwhich must include a start and end event to trigger continuous panning.\n\n__Default value:__ `true`, which corresponds to\n`[mousedown, window:mouseup] > window:mousemove!` which corresponds to\nclicks and dragging within an interval selection to reposition it.\n\n__See also:__ [`translate`](https://vega.github.io/vega-lite/docs/translate.html) documentation.", - "type": [ - "string", - "boolean" - ] - }, - "zoom": { - "description": "When truthy, allows a user to interactively resize an interval selection.\nCan be `true`, `false` (to disable zooming), or a [Vega event stream\ndefinition](https://vega.github.io/vega/docs/event-streams/). Currently,\nonly `wheel` events are supported.\n\n__Default value:__ `true`, which corresponds to `wheel!`.\n\n__See also:__ [`zoom`](https://vega.github.io/vega-lite/docs/zoom.html) documentation.", - "type": [ - "string", - "boolean" - ] - } - }, - "type": "object" - }, - "JoinAggregateFieldDef": { - "additionalProperties": false, - "properties": { - "as": { - "$ref": "#/definitions/FieldName", - "description": "The output name for the join aggregate operation." - }, - "field": { - "$ref": "#/definitions/FieldName", - "description": "The data field for which to compute the aggregate function. This can be omitted for functions that do not operate over a field such as `\"count\"`." - }, - "op": { - "$ref": "#/definitions/AggregateOp", - "description": "The aggregation operation to apply (e.g., `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/aggregate.html#ops)." - } - }, - "required": [ - "op", - "as" - ], - "type": "object" - }, - "JoinAggregateTransform": { - "additionalProperties": false, - "properties": { - "groupby": { - "description": "The data fields for partitioning the data objects into separate groups. If unspecified, all data points will be in a single group.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "joinaggregate": { - "description": "The definition of the fields in the join aggregate, and what calculations to use.", - "items": { - "$ref": "#/definitions/JoinAggregateFieldDef" - }, - "type": "array" - } - }, - "required": [ - "joinaggregate" - ], - "type": "object" - }, - "JsonDataFormat": { - "additionalProperties": false, - "properties": { - "parse": { - "anyOf": [ - { - "$ref": "#/definitions/Parse" - }, - { - "type": "null" - } - ], - "description": "If set to `null`, disable type inference based on the spec and only use type inference based on the data.\nAlternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `\"number\"`, `\"boolean\"`, `\"date\"`, or null (do not parse the field)).\nFor example, `\"parse\": {\"modified_on\": \"date\"}` parses the `modified_on` field in each input record a Date value.\n\nFor `\"date\"`, we parse data based using Javascript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).\nFor Specific date formats can be provided (e.g., `{foo: \"date:'%m%d%Y'\"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: \"utc:'%m%d%Y'\"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc)" - }, - "property": { - "description": "The JSON property containing the desired data.\nThis parameter can be used when the loaded JSON file may have surrounding structure or meta-data.\nFor example `\"property\": \"values.features\"` is equivalent to retrieving `json.values.features`\nfrom the loaded JSON object.", - "type": "string" - }, - "type": { - "description": "Type of input data: `\"json\"`, `\"csv\"`, `\"tsv\"`, `\"dsv\"`.\n\n__Default value:__ The default format type is determined by the extension of the file URL.\nIf no extension is detected, `\"json\"` will be used by default.", - "enum": [ - "json" - ], - "type": "string" - } - }, - "type": "object" - }, - "LabelOverlap": { - "anyOf": [ - { - "type": "boolean" - }, - { - "enum": [ - "parity" - ], - "type": "string" - }, - { - "enum": [ - "greedy" - ], - "type": "string" - } - ] - }, - "LatLongDef": { - "anyOf": [ - { - "$ref": "#/definitions/LatLongFieldDef" - }, - { - "$ref": "#/definitions/DatumDef" - }, - { - "$ref": "#/definitions/NumericValueDef" - } - ] - }, - "LatLongFieldDef": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation.", - "enum": [ - "quantitative" - ], - "type": "string" - } - }, - "type": "object" - }, - "LayerRepeatMapping": { - "additionalProperties": false, - "properties": { - "column": { - "description": "An array of fields to be repeated horizontally.", - "items": { - "type": "string" - }, - "type": "array" - }, - "layer": { - "description": "An array of fields to be repeated as layers.", - "items": { - "type": "string" - }, - "type": "array" - }, - "row": { - "description": "An array of fields to be repeated vertically.", - "items": { - "type": "string" - }, - "type": "array" - } - }, - "required": [ - "layer" - ], - "type": "object" - }, - "LayerRepeatSpec": { - "additionalProperties": false, - "properties": { - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "repeat": { - "$ref": "#/definitions/LayerRepeatMapping", - "description": "Definition for fields to be repeated. One of:\n1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively." - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "spec": { - "anyOf": [ - { - "$ref": "#/definitions/LayerSpec" - }, - { - "$ref": "#/definitions/UnitSpec" - } - ], - "description": "A specification of the view that gets repeated." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - } - }, - "required": [ - "repeat", - "spec" - ], - "type": "object" - }, - "LayerSpec": { - "additionalProperties": false, - "description": "A full layered plot specification, which may contains `encoding` and `projection` properties that will be applied to underlying unit (single-view) specifications.", - "properties": { - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "encoding": { - "$ref": "#/definitions/SharedEncoding", - "description": "A shared key-value mapping between encoding channels and definition of fields in the underlying layers." - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The height of a visualization.\n\n- For a plot with a continuous y-field, height should be a number.\n- For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.)\n- To enable responsive sizing on height, it should be set to `\"container\"`.\n\n__Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation." - }, - "layer": { - "description": "Layer or single view specifications to be layered.\n\n__Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/LayerSpec" - }, - { - "$ref": "#/definitions/UnitSpec" - } - ] - }, - "type": "array" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "projection": { - "$ref": "#/definitions/Projection", - "description": "An object defining properties of the geographic projection shared by underlying layers." - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "view": { - "$ref": "#/definitions/ViewBackground", - "description": "An object defining the view background's fill and stroke.\n\n__Default value:__ none (transparent)" - }, - "width": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The width of a visualization.\n\n- For a plot with a continuous x-field, width should be a number.\n- For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.)\n- To enable responsive sizing on width, it should be set to `\"container\"`.\n\n__Default value:__\nBased on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation." - } - }, - "required": [ - "layer" - ], - "type": "object" - }, - "LayoutAlign": { - "enum": [ - "all", - "each", - "none" - ], - "type": "string" - }, - "LayoutBounds": { - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "Legend": { - "additionalProperties": false, - "description": "Properties of a legend or boolean flag for determining whether to show it.", - "properties": { - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG group, removing the legend from the ARIA accessibility tree.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "clipHeight": { - "description": "The height in pixels to clip symbol legend entries and limit their size.", - "type": "number" - }, - "columnPadding": { - "description": "The horizontal padding in pixels between symbol legend entries.\n\n__Default value:__ `10`.", - "type": "number" - }, - "columns": { - "description": "The number of columns in which to arrange symbol legend entries. A value of `0` or lower indicates a single row with one column per entry.", - "type": "number" - }, - "cornerRadius": { - "description": "Corner radius for the full legend.", - "type": "number" - }, - "description": { - "description": "A text description of this legend for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf the `aria` property is true, for SVG output the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute) will be set to this description.\nIf the description is unspecified it will be automatically generated.", - "type": "string" - }, - "direction": { - "$ref": "#/definitions/Orientation", - "description": "The direction of the legend, one of `\"vertical\"` or `\"horizontal\"`.\n\n__Default value:__\n- For top-/bottom-`orient`ed legends, `\"horizontal\"`\n- For left-/right-`orient`ed legends, `\"vertical\"`\n- For top/bottom-left/right-`orient`ed legends, `\"horizontal\"` for gradient legends and `\"vertical\"` for symbol legends." - }, - "fillColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Background fill color for the full legend." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "gradientLength": { - "description": "The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient.\n\n__Default value:__ `200`.", - "minimum": 0, - "type": "number" - }, - "gradientOpacity": { - "description": "Opacity of the color gradient.", - "type": "number" - }, - "gradientStrokeColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the gradient stroke, can be in hex color code or regular color name.\n\n__Default value:__ `\"lightGray\"`." - }, - "gradientStrokeWidth": { - "description": "The width of the gradient stroke, in pixels.\n\n__Default value:__ `0`.", - "minimum": 0, - "type": "number" - }, - "gradientThickness": { - "description": "The thickness in pixels of the color gradient. This value corresponds to the width of a vertical gradient or the height of a horizontal gradient.\n\n__Default value:__ `16`.", - "minimum": 0, - "type": "number" - }, - "gridAlign": { - "$ref": "#/definitions/LayoutAlign", - "description": "The alignment to apply to symbol legends rows and columns. The supported string values are `\"all\"`, `\"each\"` (the default), and `none`. For more information, see the [grid layout documentation](https://vega.github.io/vega/docs/layout).\n\n__Default value:__ `\"each\"`." - }, - "labelAlign": { - "$ref": "#/definitions/Align", - "description": "The alignment of the legend label, can be left, center, or right." - }, - "labelBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The position of the baseline of legend label, can be `\"top\"`, `\"middle\"`, `\"bottom\"`, or `\"alphabetic\"`.\n\n__Default value:__ `\"middle\"`." - }, - "labelColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the legend label, can be in hex color code or regular color name." - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the legend's backing `datum` object.", - "type": "string" - }, - "labelFont": { - "description": "The font of the legend label.", - "type": "string" - }, - "labelFontSize": { - "description": "The font size of legend label.\n\n__Default value:__ `10`.", - "minimum": 0, - "type": "number" - }, - "labelFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style of legend label." - }, - "labelFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight of legend label." - }, - "labelLimit": { - "description": "Maximum allowed pixel width of legend tick labels.\n\n__Default value:__ `160`.", - "type": "number" - }, - "labelOffset": { - "description": "The offset of the legend label.", - "type": "number" - }, - "labelOpacity": { - "description": "Opacity of labels.", - "type": "number" - }, - "labelOverlap": { - "$ref": "#/definitions/LabelOverlap", - "description": "The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` (default) or `\"parity\"`, a strategy of removing every other label is used. If set to `\"greedy\"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes).\n\n__Default value:__ `true`." - }, - "labelPadding": { - "description": "Padding in pixels between the legend and legend labels.", - "type": "number" - }, - "labelSeparation": { - "description": "The minimum separation that must be between label bounding boxes for them to be considered non-overlapping (default `0`). This property is ignored if *labelOverlap* resolution is not enabled.", - "type": "number" - }, - "legendX": { - "description": "Custom x-position for legend with orient \"none\".", - "type": "number" - }, - "legendY": { - "description": "Custom y-position for legend with orient \"none\".", - "type": "number" - }, - "offset": { - "description": "The offset in pixels by which to displace the legend from the data rectangle and axes.\n\n__Default value:__ `18`.", - "type": "number" - }, - "orient": { - "$ref": "#/definitions/LegendOrient", - "description": "The orientation of the legend, which determines how the legend is positioned within the scene. One of `\"left\"`, `\"right\"`, `\"top\"`, `\"bottom\"`, `\"top-left\"`, `\"top-right\"`, `\"bottom-left\"`, `\"bottom-right\"`, `\"none\"`.\n\n__Default value:__ `\"right\"`" - }, - "padding": { - "description": "The padding between the border and content of the legend group.\n\n__Default value:__ `0`.", - "type": "number" - }, - "rowPadding": { - "description": "The vertical padding in pixels between symbol legend entries.\n\n__Default value:__ `2`.", - "type": "number" - }, - "strokeColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Border stroke color for the full legend." - }, - "symbolDash": { - "description": "An array of alternating [stroke, space] lengths for dashed symbol strokes.", - "items": { - "type": "number" - }, - "type": "array" - }, - "symbolDashOffset": { - "description": "The pixel offset at which to start drawing with the symbol stroke dash array.", - "type": "number" - }, - "symbolFillColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the legend symbol," - }, - "symbolLimit": { - "description": "The maximum number of allowed entries for a symbol legend. Additional entries will be dropped.", - "type": "number" - }, - "symbolOffset": { - "description": "Horizontal pixel offset for legend symbols.\n\n__Default value:__ `0`.", - "type": "number" - }, - "symbolOpacity": { - "description": "Opacity of the legend symbols.", - "type": "number" - }, - "symbolSize": { - "description": "The size of the legend symbol, in pixels.\n\n__Default value:__ `100`.", - "minimum": 0, - "type": "number" - }, - "symbolStrokeColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Stroke color for legend symbols." - }, - "symbolStrokeWidth": { - "description": "The width of the symbol's stroke.\n\n__Default value:__ `1.5`.", - "minimum": 0, - "type": "number" - }, - "symbolType": { - "$ref": "#/definitions/SymbolShape", - "description": "The symbol shape. One of the plotting shapes `circle` (default), `square`, `cross`, `diamond`, `triangle-up`, `triangle-down`, `triangle-right`, or `triangle-left`, the line symbol `stroke`, or one of the centered directional shapes `arrow`, `wedge`, or `triangle`. Alternatively, a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) can be provided. For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.\n\n__Default value:__ `\"circle\"`." - }, - "tickCount": { - "$ref": "#/definitions/TickCount", - "description": "The desired number of tick values for quantitative legends." - }, - "tickMinStep": { - "description": "The minimum desired step between legend ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.\n\n__Default value__: `undefined`", - "type": "number" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "titleAlign": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment for legend titles.\n\n__Default value:__ `\"left\"`." - }, - "titleAnchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "Text anchor position for placing legend titles." - }, - "titleBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "Vertical text baseline for legend titles. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone.\n\n__Default value:__ `\"top\"`." - }, - "titleColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the legend title, can be in hex color code or regular color name." - }, - "titleFont": { - "description": "The font of the legend title.", - "type": "string" - }, - "titleFontSize": { - "description": "The font size of the legend title.", - "type": "number" - }, - "titleFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style of the legend title." - }, - "titleFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight of the legend title.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "titleLimit": { - "description": "Maximum allowed pixel width of legend titles.\n\n__Default value:__ `180`.", - "minimum": 0, - "type": "number" - }, - "titleLineHeight": { - "description": "Line height in pixels for multi-line title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "titleOpacity": { - "description": "Opacity of the legend title.", - "type": "number" - }, - "titleOrient": { - "$ref": "#/definitions/Orient", - "description": "Orientation of the legend title." - }, - "titlePadding": { - "description": "The padding, in pixels, between title and legend.\n\n__Default value:__ `5`.", - "type": "number" - }, - "type": { - "description": "The type of the legend. Use `\"symbol\"` to create a discrete legend and `\"gradient\"` for a continuous color gradient.\n\n__Default value:__ `\"gradient\"` for non-binned quantitative fields and temporal fields; `\"symbol\"` otherwise.", - "enum": [ - "symbol", - "gradient" - ], - "type": "string" - }, - "values": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "items": { - "type": "boolean" - }, - "type": "array" - }, - { - "items": { - "$ref": "#/definitions/DateTime" - }, - "type": "array" - } - ], - "description": "Explicitly set the visible legend values." - }, - "zindex": { - "description": "A non-negative integer indicating the z-index of the legend.\nIf zindex is 0, legend should be drawn behind all chart elements.\nTo put them in front, use zindex = 1.", - "minimum": 0, - "type": "number" - } - }, - "type": "object" - }, - "LegendBinding": { - "anyOf": [ - { - "enum": [ - "legend" - ], - "type": "string" - }, - { - "$ref": "#/definitions/LegendStreamBinding" - } - ] - }, - "LegendConfig": { - "additionalProperties": false, - "properties": { - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG group, removing the legend from the ARIA accessibility tree.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "clipHeight": { - "description": "The height in pixels to clip symbol legend entries and limit their size.", - "type": "number" - }, - "columnPadding": { - "description": "The horizontal padding in pixels between symbol legend entries.\n\n__Default value:__ `10`.", - "type": "number" - }, - "columns": { - "description": "The number of columns in which to arrange symbol legend entries. A value of `0` or lower indicates a single row with one column per entry.", - "type": "number" - }, - "cornerRadius": { - "description": "Corner radius for the full legend.", - "type": "number" - }, - "description": { - "description": "A text description of this legend for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf the `aria` property is true, for SVG output the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute) will be set to this description.\nIf the description is unspecified it will be automatically generated.", - "type": "string" - }, - "direction": { - "$ref": "#/definitions/Orientation", - "description": "The direction of the legend, one of `\"vertical\"` or `\"horizontal\"`.\n\n__Default value:__\n- For top-/bottom-`orient`ed legends, `\"horizontal\"`\n- For left-/right-`orient`ed legends, `\"vertical\"`\n- For top/bottom-left/right-`orient`ed legends, `\"horizontal\"` for gradient legends and `\"vertical\"` for symbol legends." - }, - "disable": { - "description": "Disable legend by default", - "type": "boolean" - }, - "fillColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Background fill color for the full legend." - }, - "gradientDirection": { - "$ref": "#/definitions/Orientation", - "description": "The default direction (`\"horizontal\"` or `\"vertical\"`) for gradient legends.\n\n__Default value:__ `\"vertical\"`." - }, - "gradientHorizontalMaxLength": { - "description": "Max legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n\n__Default value:__ `200`", - "type": "number" - }, - "gradientHorizontalMinLength": { - "description": "Min legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n\n__Default value:__ `100`", - "type": "number" - }, - "gradientLabelLimit": { - "description": "The maximum allowed length in pixels of color ramp gradient labels.", - "type": "number" - }, - "gradientLabelOffset": { - "description": "Vertical offset in pixels for color ramp gradient labels.\n\n__Default value:__ `2`.", - "type": "number" - }, - "gradientLength": { - "description": "The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient.\n\n__Default value:__ `200`.", - "minimum": 0, - "type": "number" - }, - "gradientOpacity": { - "description": "Opacity of the color gradient.", - "type": "number" - }, - "gradientStrokeColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the gradient stroke, can be in hex color code or regular color name.\n\n__Default value:__ `\"lightGray\"`." - }, - "gradientStrokeWidth": { - "description": "The width of the gradient stroke, in pixels.\n\n__Default value:__ `0`.", - "minimum": 0, - "type": "number" - }, - "gradientThickness": { - "description": "The thickness in pixels of the color gradient. This value corresponds to the width of a vertical gradient or the height of a horizontal gradient.\n\n__Default value:__ `16`.", - "minimum": 0, - "type": "number" - }, - "gradientVerticalMaxLength": { - "description": "Max legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n\n__Default value:__ `200`", - "type": "number" - }, - "gradientVerticalMinLength": { - "description": "Min legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n\n__Default value:__ `100`", - "type": "number" - }, - "gridAlign": { - "$ref": "#/definitions/LayoutAlign", - "description": "The alignment to apply to symbol legends rows and columns. The supported string values are `\"all\"`, `\"each\"` (the default), and `none`. For more information, see the [grid layout documentation](https://vega.github.io/vega/docs/layout).\n\n__Default value:__ `\"each\"`." - }, - "labelAlign": { - "$ref": "#/definitions/Align", - "description": "The alignment of the legend label, can be left, center, or right." - }, - "labelBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The position of the baseline of legend label, can be `\"top\"`, `\"middle\"`, `\"bottom\"`, or `\"alphabetic\"`.\n\n__Default value:__ `\"middle\"`." - }, - "labelColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the legend label, can be in hex color code or regular color name." - }, - "labelFont": { - "description": "The font of the legend label.", - "type": "string" - }, - "labelFontSize": { - "description": "The font size of legend label.\n\n__Default value:__ `10`.", - "minimum": 0, - "type": "number" - }, - "labelFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style of legend label." - }, - "labelFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight of legend label." - }, - "labelLimit": { - "description": "Maximum allowed pixel width of legend tick labels.\n\n__Default value:__ `160`.", - "type": "number" - }, - "labelOffset": { - "description": "The offset of the legend label.", - "type": "number" - }, - "labelOpacity": { - "description": "Opacity of labels.", - "type": "number" - }, - "labelOverlap": { - "$ref": "#/definitions/LabelOverlap", - "description": "The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used. If set to `\"greedy\"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes).\n\n__Default value:__ `\"greedy\"` for `log scales otherwise `true`." - }, - "labelPadding": { - "description": "Padding in pixels between the legend and legend labels.", - "type": "number" - }, - "labelSeparation": { - "description": "The minimum separation that must be between label bounding boxes for them to be considered non-overlapping (default `0`). This property is ignored if *labelOverlap* resolution is not enabled.", - "type": "number" - }, - "layout": { - "$ref": "#/definitions/LegendLayout", - "description": "Legend orient group layout parameters." - }, - "legendX": { - "description": "Custom x-position for legend with orient \"none\".", - "type": "number" - }, - "legendY": { - "description": "Custom y-position for legend with orient \"none\".", - "type": "number" - }, - "offset": { - "description": "The offset in pixels by which to displace the legend from the data rectangle and axes.\n\n__Default value:__ `18`.", - "type": "number" - }, - "orient": { - "$ref": "#/definitions/LegendOrient", - "description": "The orientation of the legend, which determines how the legend is positioned within the scene. One of `\"left\"`, `\"right\"`, `\"top\"`, `\"bottom\"`, `\"top-left\"`, `\"top-right\"`, `\"bottom-left\"`, `\"bottom-right\"`, `\"none\"`.\n\n__Default value:__ `\"right\"`" - }, - "padding": { - "description": "The padding between the border and content of the legend group.\n\n__Default value:__ `0`.", - "type": "number" - }, - "rowPadding": { - "description": "The vertical padding in pixels between symbol legend entries.\n\n__Default value:__ `2`.", - "type": "number" - }, - "strokeColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Border stroke color for the full legend." - }, - "strokeDash": { - "description": "Border stroke dash pattern for the full legend.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeWidth": { - "description": "Border stroke width for the full legend.", - "type": "number" - }, - "symbolBaseFillColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Default fill color for legend symbols. Only applied if there is no `\"fill\"` scale color encoding for the legend.\n\n__Default value:__ `\"transparent\"`." - }, - "symbolBaseStrokeColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Default stroke color for legend symbols. Only applied if there is no `\"fill\"` scale color encoding for the legend.\n\n__Default value:__ `\"gray\"`." - }, - "symbolDash": { - "description": "An array of alternating [stroke, space] lengths for dashed symbol strokes.", - "items": { - "type": "number" - }, - "type": "array" - }, - "symbolDashOffset": { - "description": "The pixel offset at which to start drawing with the symbol stroke dash array.", - "type": "number" - }, - "symbolDirection": { - "$ref": "#/definitions/Orientation", - "description": "The default direction (`\"horizontal\"` or `\"vertical\"`) for symbol legends.\n\n__Default value:__ `\"vertical\"`." - }, - "symbolFillColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the legend symbol," - }, - "symbolLimit": { - "description": "The maximum number of allowed entries for a symbol legend. Additional entries will be dropped.", - "type": "number" - }, - "symbolOffset": { - "description": "Horizontal pixel offset for legend symbols.\n\n__Default value:__ `0`.", - "type": "number" - }, - "symbolOpacity": { - "description": "Opacity of the legend symbols.", - "type": "number" - }, - "symbolSize": { - "description": "The size of the legend symbol, in pixels.\n\n__Default value:__ `100`.", - "minimum": 0, - "type": "number" - }, - "symbolStrokeColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Stroke color for legend symbols." - }, - "symbolStrokeWidth": { - "description": "The width of the symbol's stroke.\n\n__Default value:__ `1.5`.", - "minimum": 0, - "type": "number" - }, - "symbolType": { - "$ref": "#/definitions/SymbolShape", - "description": "The symbol shape. One of the plotting shapes `circle` (default), `square`, `cross`, `diamond`, `triangle-up`, `triangle-down`, `triangle-right`, or `triangle-left`, the line symbol `stroke`, or one of the centered directional shapes `arrow`, `wedge`, or `triangle`. Alternatively, a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) can be provided. For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.\n\n__Default value:__ `\"circle\"`." - }, - "tickCount": { - "$ref": "#/definitions/TickCount", - "description": "The desired number of tick values for quantitative legends." - }, - "title": { - "description": "Set to null to disable title for the axis, legend, or header.", - "type": "null" - }, - "titleAlign": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment for legend titles.\n\n__Default value:__ `\"left\"`." - }, - "titleAnchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "Text anchor position for placing legend titles." - }, - "titleBaseline": { - "$ref": "#/definitions/TextBaseline", - "description": "Vertical text baseline for legend titles. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone.\n\n__Default value:__ `\"top\"`." - }, - "titleColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "The color of the legend title, can be in hex color code or regular color name." - }, - "titleFont": { - "description": "The font of the legend title.", - "type": "string" - }, - "titleFontSize": { - "description": "The font size of the legend title.", - "type": "number" - }, - "titleFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style of the legend title." - }, - "titleFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight of the legend title.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "titleLimit": { - "description": "Maximum allowed pixel width of legend titles.\n\n__Default value:__ `180`.", - "minimum": 0, - "type": "number" - }, - "titleLineHeight": { - "description": "Line height in pixels for multi-line title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "titleOpacity": { - "description": "Opacity of the legend title.", - "type": "number" - }, - "titleOrient": { - "$ref": "#/definitions/Orient", - "description": "Orientation of the legend title." - }, - "titlePadding": { - "description": "The padding, in pixels, between title and legend.\n\n__Default value:__ `5`.", - "type": "number" - }, - "unselectedOpacity": { - "description": "The opacity of unselected legend entries.\n\n__Default value:__ 0.35.", - "type": "number" - }, - "zindex": { - "description": "The integer z-index indicating the layering of the legend group relative to other axis, mark, and legend groups.", - "minimum": 0, - "type": "number" - } - }, - "type": "object" - }, - "LegendLayout": { - "additionalProperties": false, - "properties": { - "anchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "The anchor point for legend orient group layout." - }, - "bottom": { - "$ref": "#/definitions/BaseLegendLayout" - }, - "bottom-left": { - "$ref": "#/definitions/BaseLegendLayout" - }, - "bottom-right": { - "$ref": "#/definitions/BaseLegendLayout" - }, - "bounds": { - "$ref": "#/definitions/LayoutBounds", - "description": "The bounds calculation to use for legend orient group layout." - }, - "center": { - "description": "A flag to center legends within a shared orient group.", - "type": "boolean" - }, - "direction": { - "$ref": "#/definitions/Orientation", - "description": "The layout direction for legend orient group layout." - }, - "left": { - "$ref": "#/definitions/BaseLegendLayout" - }, - "margin": { - "description": "The pixel margin between legends within a orient group.", - "type": "number" - }, - "offset": { - "description": "The pixel offset from the chart body for a legend orient group.", - "type": "number" - }, - "right": { - "$ref": "#/definitions/BaseLegendLayout" - }, - "top": { - "$ref": "#/definitions/BaseLegendLayout" - }, - "top-left": { - "$ref": "#/definitions/BaseLegendLayout" - }, - "top-right": { - "$ref": "#/definitions/BaseLegendLayout" - } - }, - "type": "object" - }, - "LegendOrient": { - "enum": [ - "none", - "left", - "right", - "top", - "bottom", - "top-left", - "top-right", - "bottom-left", - "bottom-right" - ], - "type": "string" - }, - "LegendResolveMap": { - "additionalProperties": false, - "properties": { - "angle": { - "$ref": "#/definitions/ResolveMode" - }, - "color": { - "$ref": "#/definitions/ResolveMode" - }, - "fill": { - "$ref": "#/definitions/ResolveMode" - }, - "fillOpacity": { - "$ref": "#/definitions/ResolveMode" - }, - "opacity": { - "$ref": "#/definitions/ResolveMode" - }, - "shape": { - "$ref": "#/definitions/ResolveMode" - }, - "size": { - "$ref": "#/definitions/ResolveMode" - }, - "stroke": { - "$ref": "#/definitions/ResolveMode" - }, - "strokeDash": { - "$ref": "#/definitions/ResolveMode" - }, - "strokeOpacity": { - "$ref": "#/definitions/ResolveMode" - }, - "strokeWidth": { - "$ref": "#/definitions/ResolveMode" - } - }, - "type": "object" - }, - "LegendStreamBinding": { - "additionalProperties": false, - "properties": { - "legend": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Stream" - } - ] - } - }, - "required": [ - "legend" - ], - "type": "object" - }, - "LineConfig": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`." - }, - "angle": { - "description": "The rotation angle of the text, in degrees.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree.", - "type": "boolean" - }, - "ariaRole": { - "description": "Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"role\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "ariaRoleDescription": { - "description": "A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"aria-roledescription\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "aspect": { - "description": "Whether to keep aspect ratio of image marks.", - "type": "boolean" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone." - }, - "blend": { - "$ref": "#/definitions/Blend", - "description": "The color blend mode for drawing an item on its current background. Any valid [CSS mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) value can be used.\n\n__Default value: `\"source-over\"`" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomLeft": { - "description": "The radius in pixels of rounded rectangles' bottom left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomRight": { - "description": "The radius in pixels of rounded rectangles' bottom right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopLeft": { - "description": "The radius in pixels of rounded rectangles' top right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopRight": { - "description": "The radius in pixels of rounded rectangles' top left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "description": { - "description": "A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute).", - "type": "string" - }, - "dir": { - "$ref": "#/definitions/TextDirection", - "description": "The direction of the text. One of `\"ltr\"` (left-to-right) or `\"rtl\"` (right-to-left). This property determines on which side is truncated in response to the limit parameter.\n\n__Default value:__ `\"ltr\"`" - }, - "dx": { - "description": "The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "dy": { - "description": "The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "ellipsis": { - "description": "The ellipsis string for text truncated in response to the limit parameter.\n\n__Default value:__ `\"…\"`", - "type": "string" - }, - "endAngle": { - "description": "The end angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n\n__Default value:__ (None)" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "filled": { - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n\n__Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).", - "type": "boolean" - }, - "font": { - "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "fontSize": { - "description": "The font size, in pixels.\n\n__Default value:__ `11`", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style (e.g., `\"italic\"`)." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "height": { - "description": "Height of the marks.", - "type": "number" - }, - "href": { - "description": "A URL to load upon mouse click. If defined, the mark acts as a hyperlink.", - "format": "uri", - "type": "string" - }, - "innerRadius": { - "description": "The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.", - "type": "number" - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method to use for line and area marks. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"step-before\"`: alternate between vertical and horizontal segments, as in a step function.\n- `\"step-after\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null - ], - "type": [ - "string", - "null" - ] - }, - "limit": { - "description": "The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0` -- indicating no limit", - "type": "number" - }, - "lineBreak": { - "description": "A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property is ignored if the text is array-valued.", - "type": "string" - }, - "lineHeight": { - "description": "The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "order": { - "description": "For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.", - "type": [ - "null", - "boolean" - ] - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "The orientation of a non-stacked bar, tick, area, and line charts.\nThe value is either horizontal (default) or vertical.\n- For bar, rule and tick, this determines whether the size of the bar and tick\nshould be applied to x or y dimension.\n- For area, this property determines the orient property of the Vega output.\n- For line and trail marks, this property determines the sort order of the points in the line\nif `config.sortLineBy` is not specified.\nFor stacked charts, this is always determined by the orientation of the stack;\ntherefore explicitly specified value will be ignored." - }, - "outerRadius": { - "description": "The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.", - "type": "number" - }, - "padAngle": { - "description": "The angular padding applied to sides of the arc, in radians.", - "type": "number" - }, - "point": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/OverlayMarkDef" - }, - { - "enum": [ - "transparent" - ], - "type": "string" - } - ], - "description": "A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.\n\n- If this property is `\"transparent\"`, transparent points will be used (for enhancing tooltips and selections).\n\n- If this property is an empty object (`{}`) or `true`, filled points with default properties will be used.\n\n- If this property is `false`, no points would be automatically added to line or area marks.\n\n__Default value:__ `false`." - }, - "radius": { - "description": "For arc mark, the primary (outer) radius in pixels.\n\nFor text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.", - "type": "number" - }, - "radius2": { - "description": "The secondary (inner) radius in pixels of arc marks.", - "type": "number" - }, - "shape": { - "anyOf": [ - { - "$ref": "#/definitions/SymbolShape" - }, - { - "type": "string" - } - ], - "description": "Shape of the point marks. Supported values include:\n- plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n- the line symbol `\"stroke\"`\n- centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n- a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n__Default value:__ `\"circle\"`" - }, - "size": { - "description": "Default size for marks.\n- For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n- For `bar`, this represents the band size of the bar, in pixels.\n- For `text`, this represents the font size, in pixels.\n\n__Default value:__\n- `30` for point, circle, square marks; width/height's `step`\n- `2` for bar marks with discrete dimensions;\n- `5` for bar marks with continuous dimensions;\n- `11` for text marks.", - "minimum": 0, - "type": "number" - }, - "startAngle": { - "description": "The start angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n\n__Default value:__ (None)" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOffset": { - "description": "The offset in pixels at which to draw the group stroke and fill. If unspecified, the default behavior is to dynamically offset stroked groups such that 1 pixel stroke widths align with the pixel grid.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "tension": { - "description": "Depending on the interpolation type, sets the tension parameter (for line and area marks).", - "type": "number" - }, - "text": { - "$ref": "#/definitions/Text", - "description": "Placeholder text if the `text` channel is not specified" - }, - "theta": { - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "theta2": { - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.", - "type": "number" - }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\nIf set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, - "timeUnitBandPosition": { - "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\nIf set to `0.5`, the marks will be positioned in the middle of the time unit band step.", - "type": "number" - }, - "tooltip": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/TooltipContent" - }, - { - "type": "null" - } - ], - "description": "The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n\n- If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n- If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n- If set to `null` or `false`, then no tooltip will be used.\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n\n__Default value:__ `null`" - }, - "width": { - "description": "Width of the marks.", - "type": "number" - }, - "x": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "y": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - } - }, - "type": "object" - }, - "LinearGradient": { - "additionalProperties": false, - "properties": { - "gradient": { - "description": "The type of gradient. Use `\"linear\"` for a linear gradient.", - "enum": [ - "linear" - ], - "type": "string" - }, - "id": { - "type": "string" - }, - "stops": { - "description": "An array of gradient stops defining the gradient color sequence.", - "items": { - "$ref": "#/definitions/GradientStop" - }, - "type": "array" - }, - "x1": { - "description": "The starting x-coordinate, in normalized [0, 1] coordinates, of the linear gradient.\n\n__Default value:__ `0`", - "type": "number" - }, - "x2": { - "description": "The ending x-coordinate, in normalized [0, 1] coordinates, of the linear gradient.\n\n__Default value:__ `1`", - "type": "number" - }, - "y1": { - "description": "The starting y-coordinate, in normalized [0, 1] coordinates, of the linear gradient.\n\n__Default value:__ `0`", - "type": "number" - }, - "y2": { - "description": "The ending y-coordinate, in normalized [0, 1] coordinates, of the linear gradient.\n\n__Default value:__ `0`", - "type": "number" - } - }, - "required": [ - "gradient", - "stops" - ], - "type": "object" - }, - "LocalMultiTimeUnit": { - "enum": [ - "yearquarter", - "yearquartermonth", - "yearmonth", - "yearmonthdate", - "yearmonthdatehours", - "yearmonthdatehoursminutes", - "yearmonthdatehoursminutesseconds", - "yearweek", - "yearweekday", - "yearweekdayhours", - "yearweekdayhoursminutes", - "yearweekdayhoursminutesseconds", - "yeardayofyear", - "quartermonth", - "monthdate", - "monthdatehours", - "monthdatehoursminutes", - "monthdatehoursminutesseconds", - "weekday", - "weeksdayhours", - "weekdayhoursminutes", - "weekdayhoursminutesseconds", - "dayhours", - "dayhoursminutes", - "dayhoursminutesseconds", - "hoursminutes", - "hoursminutesseconds", - "minutesseconds", - "secondsmilliseconds" - ], - "type": "string" - }, - "LocalSingleTimeUnit": { - "enum": [ - "year", - "quarter", - "month", - "week", - "day", - "dayofyear", - "date", - "hours", - "minutes", - "seconds", - "milliseconds" - ], - "type": "string" - }, - "LoessTransform": { - "additionalProperties": false, - "properties": { - "as": { - "description": "The output field names for the smoothed points generated by the loess transform.\n\n__Default value:__ The field names of the input x and y values.", - "items": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "$ref": "#/definitions/FieldName" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "bandwidth": { - "description": "A bandwidth parameter in the range `[0, 1]` that determines the amount of smoothing.\n\n__Default value:__ `0.3`", - "type": "number" - }, - "groupby": { - "description": "The data fields to group by. If not specified, a single group containing all data objects will be used.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "loess": { - "$ref": "#/definitions/FieldName", - "description": "The data field of the dependent variable to smooth." - }, - "on": { - "$ref": "#/definitions/FieldName", - "description": "The data field of the independent variable to use a predictor." - } - }, - "required": [ - "loess", - "on" - ], - "type": "object" - }, - "LogicalAnd": { - "additionalProperties": false, - "properties": { - "and": { - "items": { - "$ref": "#/definitions/PredicateComposition" - }, - "type": "array" - } - }, - "required": [ - "and" - ], - "type": "object" - }, - "SelectionAnd": { - "additionalProperties": false, - "properties": { - "and": { - "items": { - "$ref": "#/definitions/SelectionComposition" - }, - "type": "array" - } - }, - "required": [ - "and" - ], - "type": "object" - }, - "PredicateComposition": { - "anyOf": [ - { - "$ref": "#/definitions/LogicalNot" - }, - { - "$ref": "#/definitions/LogicalAnd" - }, - { - "$ref": "#/definitions/LogicalOr" - }, - { - "$ref": "#/definitions/Predicate" - } - ] - }, - "SelectionComposition": { - "anyOf": [ - { - "$ref": "#/definitions/SelectionNot" - }, - { - "$ref": "#/definitions/SelectionAnd" - }, - { - "$ref": "#/definitions/SelectionOr" - }, - { - "type": "string" - } - ] - }, - "LogicalNot": { - "additionalProperties": false, - "properties": { - "not": { - "$ref": "#/definitions/PredicateComposition" - } - }, - "required": [ - "not" - ], - "type": "object" - }, - "SelectionNot": { - "additionalProperties": false, - "properties": { - "not": { - "$ref": "#/definitions/SelectionComposition" - } - }, - "required": [ - "not" - ], - "type": "object" - }, - "LogicalOr": { - "additionalProperties": false, - "properties": { - "or": { - "items": { - "$ref": "#/definitions/PredicateComposition" - }, - "type": "array" - } - }, - "required": [ - "or" - ], - "type": "object" - }, - "SelectionOr": { - "additionalProperties": false, - "properties": { - "or": { - "items": { - "$ref": "#/definitions/SelectionComposition" - }, - "type": "array" - } - }, - "required": [ - "or" - ], - "type": "object" - }, - "LookupData": { - "additionalProperties": false, - "properties": { - "data": { - "$ref": "#/definitions/Data", - "description": "Secondary data source to lookup in." - }, - "fields": { - "description": "Fields in foreign data or selection to lookup.\nIf not specified, the entire object is queried.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "key": { - "$ref": "#/definitions/FieldName", - "description": "Key in data to lookup." - } - }, - "required": [ - "data", - "key" - ], - "type": "object" - }, - "LookupSelection": { - "additionalProperties": false, - "properties": { - "fields": { - "description": "Fields in foreign data or selection to lookup.\nIf not specified, the entire object is queried.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "key": { - "$ref": "#/definitions/FieldName", - "description": "Key in data to lookup." - }, - "selection": { - "description": "Selection name to look up.", - "type": "string" - } - }, - "required": [ - "key", - "selection" - ], - "type": "object" - }, - "LookupTransform": { - "additionalProperties": false, - "properties": { - "as": { - "anyOf": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - } - ], - "description": "The output fields on which to store the looked up data values.\n\nFor data lookups, this property may be left blank if `from.fields`\nhas been specified (those field names will be used); if `from.fields`\nhas not been specified, `as` must be a string.\n\nFor selection lookups, this property is optional: if unspecified,\nlooked up values will be stored under a property named for the selection;\nand if specified, it must correspond to `from.fields`." - }, - "default": { - "description": "The default value to use if lookup fails.\n\n__Default value:__ `null`", - "type": "string" - }, - "from": { - "anyOf": [ - { - "$ref": "#/definitions/LookupData" - }, - { - "$ref": "#/definitions/LookupSelection" - } - ], - "description": "Data source or selection for secondary data reference." - }, - "lookup": { - "description": "Key in primary data source.", - "type": "string" - } - }, - "required": [ - "lookup", - "from" - ], - "type": "object" - }, - "Mark": { - "description": "All types of primitive marks.", - "enum": [ - "arc", - "area", - "bar", - "image", - "line", - "point", - "rect", - "rule", - "text", - "tick", - "trail", - "circle", - "square", - "geoshape" - ], - "type": "string" - }, - "MarkConfig": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`." - }, - "angle": { - "description": "The rotation angle of the text, in degrees.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree.", - "type": "boolean" - }, - "ariaRole": { - "description": "Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"role\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "ariaRoleDescription": { - "description": "A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"aria-roledescription\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "aspect": { - "description": "Whether to keep aspect ratio of image marks.", - "type": "boolean" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone." - }, - "blend": { - "$ref": "#/definitions/Blend", - "description": "The color blend mode for drawing an item on its current background. Any valid [CSS mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) value can be used.\n\n__Default value: `\"source-over\"`" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomLeft": { - "description": "The radius in pixels of rounded rectangles' bottom left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomRight": { - "description": "The radius in pixels of rounded rectangles' bottom right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopLeft": { - "description": "The radius in pixels of rounded rectangles' top right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopRight": { - "description": "The radius in pixels of rounded rectangles' top left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "description": { - "description": "A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute).", - "type": "string" - }, - "dir": { - "$ref": "#/definitions/TextDirection", - "description": "The direction of the text. One of `\"ltr\"` (left-to-right) or `\"rtl\"` (right-to-left). This property determines on which side is truncated in response to the limit parameter.\n\n__Default value:__ `\"ltr\"`" - }, - "dx": { - "description": "The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "dy": { - "description": "The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "ellipsis": { - "description": "The ellipsis string for text truncated in response to the limit parameter.\n\n__Default value:__ `\"…\"`", - "type": "string" - }, - "endAngle": { - "description": "The end angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n\n__Default value:__ (None)" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "filled": { - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n\n__Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).", - "type": "boolean" - }, - "font": { - "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "fontSize": { - "description": "The font size, in pixels.\n\n__Default value:__ `11`", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style (e.g., `\"italic\"`)." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "height": { - "description": "Height of the marks.", - "type": "number" - }, - "href": { - "description": "A URL to load upon mouse click. If defined, the mark acts as a hyperlink.", - "format": "uri", - "type": "string" - }, - "innerRadius": { - "description": "The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.", - "type": "number" - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method to use for line and area marks. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"step-before\"`: alternate between vertical and horizontal segments, as in a step function.\n- `\"step-after\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null - ], - "type": [ - "string", - "null" - ] - }, - "limit": { - "description": "The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0` -- indicating no limit", - "type": "number" - }, - "lineBreak": { - "description": "A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property is ignored if the text is array-valued.", - "type": "string" - }, - "lineHeight": { - "description": "The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "order": { - "description": "For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.", - "type": [ - "null", - "boolean" - ] - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "The orientation of a non-stacked bar, tick, area, and line charts.\nThe value is either horizontal (default) or vertical.\n- For bar, rule and tick, this determines whether the size of the bar and tick\nshould be applied to x or y dimension.\n- For area, this property determines the orient property of the Vega output.\n- For line and trail marks, this property determines the sort order of the points in the line\nif `config.sortLineBy` is not specified.\nFor stacked charts, this is always determined by the orientation of the stack;\ntherefore explicitly specified value will be ignored." - }, - "outerRadius": { - "description": "The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.", - "type": "number" - }, - "padAngle": { - "description": "The angular padding applied to sides of the arc, in radians.", - "type": "number" - }, - "radius": { - "description": "For arc mark, the primary (outer) radius in pixels.\n\nFor text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.", - "type": "number" - }, - "radius2": { - "description": "The secondary (inner) radius in pixels of arc marks.", - "type": "number" - }, - "shape": { - "anyOf": [ - { - "$ref": "#/definitions/SymbolShape" - }, - { - "type": "string" - } - ], - "description": "Shape of the point marks. Supported values include:\n- plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n- the line symbol `\"stroke\"`\n- centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n- a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n__Default value:__ `\"circle\"`" - }, - "size": { - "description": "Default size for marks.\n- For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n- For `bar`, this represents the band size of the bar, in pixels.\n- For `text`, this represents the font size, in pixels.\n\n__Default value:__\n- `30` for point, circle, square marks; width/height's `step`\n- `2` for bar marks with discrete dimensions;\n- `5` for bar marks with continuous dimensions;\n- `11` for text marks.", - "minimum": 0, - "type": "number" - }, - "startAngle": { - "description": "The start angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n\n__Default value:__ (None)" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOffset": { - "description": "The offset in pixels at which to draw the group stroke and fill. If unspecified, the default behavior is to dynamically offset stroked groups such that 1 pixel stroke widths align with the pixel grid.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "tension": { - "description": "Depending on the interpolation type, sets the tension parameter (for line and area marks).", - "type": "number" - }, - "text": { - "$ref": "#/definitions/Text", - "description": "Placeholder text if the `text` channel is not specified" - }, - "theta": { - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "theta2": { - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.", - "type": "number" - }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\nIf set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, - "timeUnitBandPosition": { - "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\nIf set to `0.5`, the marks will be positioned in the middle of the time unit band step.", - "type": "number" - }, - "tooltip": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/TooltipContent" - }, - { - "type": "null" - } - ], - "description": "The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n\n- If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n- If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n- If set to `null` or `false`, then no tooltip will be used.\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n\n__Default value:__ `null`" - }, - "width": { - "description": "Width of the marks.", - "type": "number" - }, - "x": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "y": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - } - }, - "type": "object" - }, - "MarkDef": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`." - }, - "angle": { - "description": "The rotation angle of the text, in degrees.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree.", - "type": "boolean" - }, - "ariaRole": { - "description": "Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"role\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "ariaRoleDescription": { - "description": "A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"aria-roledescription\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "aspect": { - "description": "Whether to keep aspect ratio of image marks.", - "type": "boolean" - }, - "bandSize": { - "description": "The width of the ticks.\n\n__Default value:__ 3/4 of step (width step for horizontal ticks and height step for vertical ticks).", - "minimum": 0, - "type": "number" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone." - }, - "binSpacing": { - "description": "Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style).\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - "blend": { - "$ref": "#/definitions/Blend", - "description": "The color blend mode for drawing an item on its current background. Any valid [CSS mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) value can be used.\n\n__Default value: `\"source-over\"`" - }, - "clip": { - "description": "Whether a mark be clipped to the enclosing group’s width and height.", - "type": "boolean" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "continuousBandSize": { - "description": "The default size of the bars on continuous scales.\n\n__Default value:__ `5`", - "minimum": 0, - "type": "number" - }, - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomLeft": { - "description": "The radius in pixels of rounded rectangles' bottom left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomRight": { - "description": "The radius in pixels of rounded rectangles' bottom right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusEnd": { - "description": "- For vertical bars, top-left and top-right corner radius.\n- For horizontal bars, top-right and bottom-right corner radius.", - "type": "number" - }, - "cornerRadiusTopLeft": { - "description": "The radius in pixels of rounded rectangles' top right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopRight": { - "description": "The radius in pixels of rounded rectangles' top left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "description": { - "description": "A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute).", - "type": "string" - }, - "dir": { - "$ref": "#/definitions/TextDirection", - "description": "The direction of the text. One of `\"ltr\"` (left-to-right) or `\"rtl\"` (right-to-left). This property determines on which side is truncated in response to the limit parameter.\n\n__Default value:__ `\"ltr\"`" - }, - "discreteBandSize": { - "description": "The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.", - "minimum": 0, - "type": "number" - }, - "dx": { - "description": "The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "dy": { - "description": "The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "ellipsis": { - "description": "The ellipsis string for text truncated in response to the limit parameter.\n\n__Default value:__ `\"…\"`", - "type": "string" - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n\n__Default value:__ (None)" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "filled": { - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n\n__Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).", - "type": "boolean" - }, - "font": { - "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "fontSize": { - "description": "The font size, in pixels.\n\n__Default value:__ `11`", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style (e.g., `\"italic\"`)." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "height": { - "description": "Height of the marks.", - "type": "number" - }, - "href": { - "description": "A URL to load upon mouse click. If defined, the mark acts as a hyperlink.", - "format": "uri", - "type": "string" - }, - "innerRadius": { - "description": "The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.", - "type": "number" - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method to use for line and area marks. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"step-before\"`: alternate between vertical and horizontal segments, as in a step function.\n- `\"step-after\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null - ], - "type": [ - "string", - "null" - ] - }, - "limit": { - "description": "The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0` -- indicating no limit", - "type": "number" - }, - "line": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/OverlayMarkDef" - } - ], - "description": "A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.\n\n- If this value is an empty object (`{}`) or `true`, lines with default properties will be used.\n\n- If this value is `false`, no lines would be automatically added to area marks.\n\n__Default value:__ `false`." - }, - "lineBreak": { - "description": "A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property is ignored if the text is array-valued.", - "type": "string" - }, - "lineHeight": { - "description": "The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "order": { - "description": "For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.", - "type": [ - "null", - "boolean" - ] - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "The orientation of a non-stacked bar, tick, area, and line charts.\nThe value is either horizontal (default) or vertical.\n- For bar, rule and tick, this determines whether the size of the bar and tick\nshould be applied to x or y dimension.\n- For area, this property determines the orient property of the Vega output.\n- For line and trail marks, this property determines the sort order of the points in the line\nif `config.sortLineBy` is not specified.\nFor stacked charts, this is always determined by the orientation of the stack;\ntherefore explicitly specified value will be ignored." - }, - "outerRadius": { - "description": "The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.", - "type": "number" - }, - "padAngle": { - "description": "The angular padding applied to sides of the arc, in radians.", - "type": "number" - }, - "point": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/OverlayMarkDef" - }, - { - "enum": [ - "transparent" - ], - "type": "string" - } - ], - "description": "A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.\n\n- If this property is `\"transparent\"`, transparent points will be used (for enhancing tooltips and selections).\n\n- If this property is an empty object (`{}`) or `true`, filled points with default properties will be used.\n\n- If this property is `false`, no points would be automatically added to line or area marks.\n\n__Default value:__ `false`." - }, - "radius": { - "description": "For arc mark, the primary (outer) radius in pixels.\n\nFor text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.", - "type": "number" - }, - "radius2": { - "description": "The secondary (inner) radius in pixels of arc marks.", - "type": "number" - }, - "radius2Offset": { - "description": "Offset for radius2.", - "type": "number" - }, - "radiusOffset": { - "description": "Offset for radius.", - "type": "number" - }, - "shape": { - "anyOf": [ - { - "$ref": "#/definitions/SymbolShape" - }, - { - "type": "string" - } - ], - "description": "Shape of the point marks. Supported values include:\n- plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n- the line symbol `\"stroke\"`\n- centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n- a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n__Default value:__ `\"circle\"`" - }, - "size": { - "description": "Default size for marks.\n- For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n- For `bar`, this represents the band size of the bar, in pixels.\n- For `text`, this represents the font size, in pixels.\n\n__Default value:__\n- `30` for point, circle, square marks; width/height's `step`\n- `2` for bar marks with discrete dimensions;\n- `5` for bar marks with continuous dimensions;\n- `11` for text marks.", - "minimum": 0, - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n\n__Default value:__ (None)" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOffset": { - "description": "The offset in pixels at which to draw the group stroke and fill. If unspecified, the default behavior is to dynamically offset stroked groups such that 1 pixel stroke widths align with the pixel grid.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "style": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](https://vega.github.io/vega-lite/docs/encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default.\n\n__Default value:__ The mark's name. For example, a bar mark will have style `\"bar\"` by default.\n__Note:__ Any specified style will augment the default style. For example, a bar mark with `\"style\": \"foo\"` will receive from `config.style.bar` and `config.style.foo` (the specified style `\"foo\"` has higher precedence)." - }, - "tension": { - "description": "Depending on the interpolation type, sets the tension parameter (for line and area marks).", - "type": "number" - }, - "text": { - "$ref": "#/definitions/Text", - "description": "Placeholder text if the `text` channel is not specified" - }, - "theta": { - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "theta2": { - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.", - "type": "number" - }, - "theta2Offset": { - "description": "Offset for theta2.", - "type": "number" - }, - "thetaOffset": { - "description": "Offset for theta.", - "type": "number" - }, - "thickness": { - "description": "Thickness of the tick mark.\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\nIf set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, - "timeUnitBandPosition": { - "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\nIf set to `0.5`, the marks will be positioned in the middle of the time unit band step.", - "type": "number" - }, - "tooltip": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/TooltipContent" - }, - { - "type": "null" - } - ], - "description": "The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n\n- If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n- If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n- If set to `null` or `false`, then no tooltip will be used.\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n\n__Default value:__ `null`" - }, - "type": { - "$ref": "#/definitions/Mark", - "description": "The mark type. This could a primitive mark type\n(one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n`\"area\"`, `\"point\"`, `\"geoshape\"`, `\"rule\"`, and `\"text\"`)\nor a composite mark type (`\"boxplot\"`, `\"errorband\"`, `\"errorbar\"`)." - }, - "width": { - "description": "Width of the marks.", - "type": "number" - }, - "x": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2Offset": { - "description": "Offset for x2-position.", - "type": "number" - }, - "xOffset": { - "description": "Offset for x-position.", - "type": "number" - }, - "y": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2Offset": { - "description": "Offset for y2-position.", - "type": "number" - }, - "yOffset": { - "description": "Offset for y-position.", - "type": "number" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "MarkPropDef<(Gradient|string|null)>": { - "anyOf": [ - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - { - "$ref": "#/definitions/ValueDefWithCondition" - } - ] - }, - "MarkPropDef<(string|null),TypeForShape>": { - "anyOf": [ - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition,(string|null)>" - }, - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - { - "$ref": "#/definitions/ValueDefWithCondition,(string|null)>" - } - ] - }, - "MarkPropDef": { - "anyOf": [ - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - { - "$ref": "#/definitions/ValueDefWithCondition" - } - ] - }, - "MarkPropDef": { - "anyOf": [ - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - { - "$ref": "#/definitions/ValueDefWithCondition" - } - ] - }, - "MarkType": { - "enum": [ - "arc", - "area", - "image", - "group", - "line", - "path", - "rect", - "rule", - "shape", - "symbol", - "text", - "trail" - ], - "type": "string" - }, - "MergedStream": { - "additionalProperties": false, - "properties": { - "between": { - "items": { - "$ref": "#/definitions/Stream" - }, - "type": "array" - }, - "consume": { - "type": "boolean" - }, - "debounce": { - "type": "number" - }, - "filter": { - "anyOf": [ - { - "$ref": "#/definitions/Expr" - }, - { - "items": { - "$ref": "#/definitions/Expr" - }, - "type": "array" - } - ] - }, - "markname": { - "type": "string" - }, - "marktype": { - "$ref": "#/definitions/MarkType" - }, - "merge": { - "items": { - "$ref": "#/definitions/Stream" - }, - "type": "array" - }, - "throttle": { - "type": "number" - } - }, - "required": [ - "merge" - ], - "type": "object" - }, - "Month": { - "maximum": 12, - "minimum": 1, - "type": "number" - }, - "MultiSelection": { - "additionalProperties": false, - "properties": { - "bind": { - "$ref": "#/definitions/LegendBinding", - "description": "When set, a selection is populated by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\nto re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n\nLegend bindings are restricted to selections that only specify a single field or encoding." - }, - "clear": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ], - "description": "Clears the selection, emptying it of all values. Can be a\n[Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n\n__Default value:__ `dblclick`.\n\n__See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation." - }, - "empty": { - "description": "By default, `all` data values are considered to lie within an empty selection.\nWhen set to `none`, empty selections contain no data values.", - "enum": [ - "all", - "none" - ], - "type": "string" - }, - "encodings": { - "description": "An array of encoding channels. The corresponding data field values\nmust match for a data tuple to fall within the selection.\n\n__See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/SingleDefUnitChannel" - }, - "type": "array" - }, - "fields": { - "description": "An array of field names whose values must match for a data tuple to\nfall within the selection.\n\n__See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "init": { - "description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and an initial\nvalue (or array of values).\n\n__See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation.", - "items": { - "$ref": "#/definitions/SelectionInitMapping" - }, - "type": "array" - }, - "nearest": { - "description": "When true, an invisible voronoi diagram is computed to accelerate discrete\nselection. The data value _nearest_ the mouse cursor is added to the selection.\n\n__See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.", - "type": "boolean" - }, - "on": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - } - ], - "description": "A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\nFor interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters)." - }, - "resolve": { - "$ref": "#/definitions/SelectionResolution", - "description": "With layered and multi-view displays, a strategy that determines how\nselections' data queries are resolved when applied in a filter transform,\nconditional encoding rule, or scale domain.\n\n__See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation." - }, - "toggle": { - "description": "Controls whether data values should be toggled or only ever inserted into\nmulti selections. Can be `true`, `false` (for insertion only), or a\n[Vega expression](https://vega.github.io/vega/docs/expressions/).\n\n__Default value:__ `true`, which corresponds to `event.shiftKey` (i.e.,\ndata values are toggled when a user interacts with the shift-key pressed).\n\nSetting the value to the Vega expression `\"true\"` will toggle data values\nwithout the user pressing the shift-key.\n\n__See also:__ [`toggle`](https://vega.github.io/vega-lite/docs/toggle.html) documentation.", - "type": [ - "string", - "boolean" - ] - }, - "type": { - "description": "Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types:\n\n- `\"single\"` -- to select a single discrete data value on `click`.\n- `\"multi\"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`.\n- `\"interval\"` -- to select a continuous range of data values on `drag`.", - "enum": [ - "multi" - ], - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "MultiSelectionConfig": { - "additionalProperties": false, - "properties": { - "bind": { - "$ref": "#/definitions/LegendBinding", - "description": "When set, a selection is populated by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\nto re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n\nLegend bindings are restricted to selections that only specify a single field or encoding." - }, - "clear": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ], - "description": "Clears the selection, emptying it of all values. Can be a\n[Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n\n__Default value:__ `dblclick`.\n\n__See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation." - }, - "empty": { - "description": "By default, `all` data values are considered to lie within an empty selection.\nWhen set to `none`, empty selections contain no data values.", - "enum": [ - "all", - "none" - ], - "type": "string" - }, - "encodings": { - "description": "An array of encoding channels. The corresponding data field values\nmust match for a data tuple to fall within the selection.\n\n__See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/SingleDefUnitChannel" - }, - "type": "array" - }, - "fields": { - "description": "An array of field names whose values must match for a data tuple to\nfall within the selection.\n\n__See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "init": { - "description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and an initial\nvalue (or array of values).\n\n__See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation.", - "items": { - "$ref": "#/definitions/SelectionInitMapping" - }, - "type": "array" - }, - "nearest": { - "description": "When true, an invisible voronoi diagram is computed to accelerate discrete\nselection. The data value _nearest_ the mouse cursor is added to the selection.\n\n__See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.", - "type": "boolean" - }, - "on": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - } - ], - "description": "A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\nFor interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters)." - }, - "resolve": { - "$ref": "#/definitions/SelectionResolution", - "description": "With layered and multi-view displays, a strategy that determines how\nselections' data queries are resolved when applied in a filter transform,\nconditional encoding rule, or scale domain.\n\n__See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation." - }, - "toggle": { - "description": "Controls whether data values should be toggled or only ever inserted into\nmulti selections. Can be `true`, `false` (for insertion only), or a\n[Vega expression](https://vega.github.io/vega/docs/expressions/).\n\n__Default value:__ `true`, which corresponds to `event.shiftKey` (i.e.,\ndata values are toggled when a user interacts with the shift-key pressed).\n\nSetting the value to the Vega expression `\"true\"` will toggle data values\nwithout the user pressing the shift-key.\n\n__See also:__ [`toggle`](https://vega.github.io/vega-lite/docs/toggle.html) documentation.", - "type": [ - "string", - "boolean" - ] - } - }, - "type": "object" - }, - "MultiTimeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/LocalMultiTimeUnit" - }, - { - "$ref": "#/definitions/UtcMultiTimeUnit" - } - ] - }, - "NamedData": { - "additionalProperties": false, - "properties": { - "format": { - "$ref": "#/definitions/DataFormat", - "description": "An object that specifies the format for parsing the data." - }, - "name": { - "description": "Provide a placeholder name and bind data at runtime.", - "type": "string" - } - }, - "required": [ - "name" - ], - "type": "object" - }, - "NonArgAggregateOp": { - "enum": [ - "average", - "count", - "distinct", - "max", - "mean", - "median", - "min", - "missing", - "product", - "q1", - "q3", - "ci0", - "ci1", - "stderr", - "stdev", - "stdevp", - "sum", - "valid", - "values", - "variance", - "variancep" - ], - "type": "string" - }, - "NonLayerRepeatSpec": { - "additionalProperties": false, - "description": "Base interface for a repeat specification.", - "properties": { - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "repeat": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "$ref": "#/definitions/RepeatMapping" - } - ], - "description": "Definition for fields to be repeated. One of:\n1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively." - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "spec": { - "$ref": "#/definitions/Spec", - "description": "A specification of the view that gets repeated." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - } - }, - "required": [ - "repeat", - "spec" - ], - "type": "object" - }, - "NumericArrayMarkPropDef": { - "$ref": "#/definitions/MarkPropDef" - }, - "NumericMarkPropDef": { - "$ref": "#/definitions/MarkPropDef" - }, - "NumericValueDef": { - "$ref": "#/definitions/ValueDef" - }, - "OrderFieldDef": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "sort": { - "$ref": "#/definitions/SortOrder", - "description": "The sort order. One of `\"ascending\"` (default) or `\"descending\"`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "OrderValueDef": { - "additionalProperties": false, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "required": [ - "value" - ], - "type": "object" - }, - "Orient": { - "enum": [ - "left", - "right", - "top", - "bottom" - ], - "type": "string" - }, - "Orientation": { - "enum": [ - "horizontal", - "vertical" - ], - "type": "string" - }, - "OverlayMarkDef": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`." - }, - "angle": { - "description": "The rotation angle of the text, in degrees.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree.", - "type": "boolean" - }, - "ariaRole": { - "description": "Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"role\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "ariaRoleDescription": { - "description": "A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"aria-roledescription\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "aspect": { - "description": "Whether to keep aspect ratio of image marks.", - "type": "boolean" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone." - }, - "blend": { - "$ref": "#/definitions/Blend", - "description": "The color blend mode for drawing an item on its current background. Any valid [CSS mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) value can be used.\n\n__Default value: `\"source-over\"`" - }, - "clip": { - "description": "Whether a mark be clipped to the enclosing group’s width and height.", - "type": "boolean" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomLeft": { - "description": "The radius in pixels of rounded rectangles' bottom left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomRight": { - "description": "The radius in pixels of rounded rectangles' bottom right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopLeft": { - "description": "The radius in pixels of rounded rectangles' top right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopRight": { - "description": "The radius in pixels of rounded rectangles' top left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "description": { - "description": "A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute).", - "type": "string" - }, - "dir": { - "$ref": "#/definitions/TextDirection", - "description": "The direction of the text. One of `\"ltr\"` (left-to-right) or `\"rtl\"` (right-to-left). This property determines on which side is truncated in response to the limit parameter.\n\n__Default value:__ `\"ltr\"`" - }, - "dx": { - "description": "The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "dy": { - "description": "The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "ellipsis": { - "description": "The ellipsis string for text truncated in response to the limit parameter.\n\n__Default value:__ `\"…\"`", - "type": "string" - }, - "endAngle": { - "description": "The end angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n\n__Default value:__ (None)" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "filled": { - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n\n__Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).", - "type": "boolean" - }, - "font": { - "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "fontSize": { - "description": "The font size, in pixels.\n\n__Default value:__ `11`", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style (e.g., `\"italic\"`)." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "height": { - "description": "Height of the marks.", - "type": "number" - }, - "href": { - "description": "A URL to load upon mouse click. If defined, the mark acts as a hyperlink.", - "format": "uri", - "type": "string" - }, - "innerRadius": { - "description": "The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.", - "type": "number" - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method to use for line and area marks. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"step-before\"`: alternate between vertical and horizontal segments, as in a step function.\n- `\"step-after\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null - ], - "type": [ - "string", - "null" - ] - }, - "limit": { - "description": "The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0` -- indicating no limit", - "type": "number" - }, - "lineBreak": { - "description": "A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property is ignored if the text is array-valued.", - "type": "string" - }, - "lineHeight": { - "description": "The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "order": { - "description": "For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.", - "type": [ - "null", - "boolean" - ] - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "The orientation of a non-stacked bar, tick, area, and line charts.\nThe value is either horizontal (default) or vertical.\n- For bar, rule and tick, this determines whether the size of the bar and tick\nshould be applied to x or y dimension.\n- For area, this property determines the orient property of the Vega output.\n- For line and trail marks, this property determines the sort order of the points in the line\nif `config.sortLineBy` is not specified.\nFor stacked charts, this is always determined by the orientation of the stack;\ntherefore explicitly specified value will be ignored." - }, - "outerRadius": { - "description": "The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.", - "type": "number" - }, - "padAngle": { - "description": "The angular padding applied to sides of the arc, in radians.", - "type": "number" - }, - "radius": { - "description": "For arc mark, the primary (outer) radius in pixels.\n\nFor text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.", - "type": "number" - }, - "radius2": { - "description": "The secondary (inner) radius in pixels of arc marks.", - "type": "number" - }, - "radius2Offset": { - "description": "Offset for radius2.", - "type": "number" - }, - "radiusOffset": { - "description": "Offset for radius.", - "type": "number" - }, - "shape": { - "anyOf": [ - { - "$ref": "#/definitions/SymbolShape" - }, - { - "type": "string" - } - ], - "description": "Shape of the point marks. Supported values include:\n- plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n- the line symbol `\"stroke\"`\n- centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n- a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n__Default value:__ `\"circle\"`" - }, - "size": { - "description": "Default size for marks.\n- For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n- For `bar`, this represents the band size of the bar, in pixels.\n- For `text`, this represents the font size, in pixels.\n\n__Default value:__\n- `30` for point, circle, square marks; width/height's `step`\n- `2` for bar marks with discrete dimensions;\n- `5` for bar marks with continuous dimensions;\n- `11` for text marks.", - "minimum": 0, - "type": "number" - }, - "startAngle": { - "description": "The start angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n\n__Default value:__ (None)" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOffset": { - "description": "The offset in pixels at which to draw the group stroke and fill. If unspecified, the default behavior is to dynamically offset stroked groups such that 1 pixel stroke widths align with the pixel grid.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "style": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](https://vega.github.io/vega-lite/docs/encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default.\n\n__Default value:__ The mark's name. For example, a bar mark will have style `\"bar\"` by default.\n__Note:__ Any specified style will augment the default style. For example, a bar mark with `\"style\": \"foo\"` will receive from `config.style.bar` and `config.style.foo` (the specified style `\"foo\"` has higher precedence)." - }, - "tension": { - "description": "Depending on the interpolation type, sets the tension parameter (for line and area marks).", - "type": "number" - }, - "text": { - "$ref": "#/definitions/Text", - "description": "Placeholder text if the `text` channel is not specified" - }, - "theta": { - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "theta2": { - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.", - "type": "number" - }, - "theta2Offset": { - "description": "Offset for theta2.", - "type": "number" - }, - "thetaOffset": { - "description": "Offset for theta.", - "type": "number" - }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\nIf set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, - "timeUnitBandPosition": { - "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\nIf set to `0.5`, the marks will be positioned in the middle of the time unit band step.", - "type": "number" - }, - "tooltip": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/TooltipContent" - }, - { - "type": "null" - } - ], - "description": "The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n\n- If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n- If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n- If set to `null` or `false`, then no tooltip will be used.\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n\n__Default value:__ `null`" - }, - "width": { - "description": "Width of the marks.", - "type": "number" - }, - "x": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2Offset": { - "description": "Offset for x2-position.", - "type": "number" - }, - "xOffset": { - "description": "Offset for x-position.", - "type": "number" - }, - "y": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2Offset": { - "description": "Offset for y2-position.", - "type": "number" - }, - "yOffset": { - "description": "Offset for y-position.", - "type": "number" - } - }, - "type": "object" - }, - "Padding": { - "anyOf": [ - { - "type": "number" - }, - { - "additionalProperties": false, - "properties": { - "bottom": { - "type": "number" - }, - "left": { - "type": "number" - }, - "right": { - "type": "number" - }, - "top": { - "type": "number" - } - }, - "type": "object" - } - ], - "minimum": 0 - }, - "Parse": { - "additionalProperties": { - "$ref": "#/definitions/ParseValue" - }, - "type": "object" - }, - "ParseValue": { - "anyOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "enum": [ - "string" - ], - "type": "string" - }, - { - "enum": [ - "boolean" - ], - "type": "string" - }, - { - "enum": [ - "date" - ], - "type": "string" - }, - { - "enum": [ - "number" - ], - "type": "string" - } - ] - }, - "PivotTransform": { - "additionalProperties": false, - "properties": { - "groupby": { - "description": "The optional data fields to group by. If not specified, a single group containing all data objects will be used.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "limit": { - "description": "An optional parameter indicating the maximum number of pivoted fields to generate.\nThe default (`0`) applies no limit. The pivoted `pivot` names are sorted in ascending order prior to enforcing the limit.\n__Default value:__ `0`", - "type": "number" - }, - "op": { - "description": "The aggregation operation to apply to grouped `value` field values.\n__Default value:__ `sum`", - "type": "string" - }, - "pivot": { - "$ref": "#/definitions/FieldName", - "description": "The data field to pivot on. The unique values of this field become new field names in the output stream." - }, - "value": { - "$ref": "#/definitions/FieldName", - "description": "The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields." - } - }, - "required": [ - "pivot", - "value" - ], - "type": "object" - }, - "PolarDef": { - "anyOf": [ - { - "$ref": "#/definitions/PositionFieldDefBase" - }, - { - "$ref": "#/definitions/PositionDatumDefBase" - }, - { - "$ref": "#/definitions/PositionValueDef" - } - ] - }, - "Position2Def": { - "anyOf": [ - { - "$ref": "#/definitions/SecondaryFieldDef" - }, - { - "$ref": "#/definitions/DatumDef" - }, - { - "$ref": "#/definitions/PositionValueDef" - } - ] - }, - "PositionDatumDef": { - "additionalProperties": false, - "properties": { - "axis": { - "anyOf": [ - { - "$ref": "#/definitions/Axis" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of axis's gridlines, ticks and labels.\nIf `null`, the axis for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n\n__See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "impute": { - "anyOf": [ - { - "$ref": "#/definitions/ImputeParams" - }, - { - "type": "null" - } - ], - "description": "An object defining the properties of the Impute Operation to be applied.\nThe field value of the other positional channel is taken as `key` of the `Impute` Operation.\nThe field of the `color` channel if specified is used as `groupby` of the `Impute` Operation.\n\n__See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "stack": { - "anyOf": [ - { - "$ref": "#/definitions/StackOffset" - }, - { - "type": "null" - }, - { - "type": "boolean" - } - ], - "description": "Type of stacking offset if the field should be stacked.\n`stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\nFor example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n\n`stack` can be one of the following values:\n- `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n- `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n-`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n- `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n\n__Default value:__ `zero` for plots with all of the following conditions are true:\n(1) the mark is `bar`, `area`, or `arc`;\n(2) the stacked measure channel (x or y) has a linear scale;\n(3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n\n__See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "PositionDatumDefBase": { - "additionalProperties": false, - "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "stack": { - "anyOf": [ - { - "$ref": "#/definitions/StackOffset" - }, - { - "type": "null" - }, - { - "type": "boolean" - } - ], - "description": "Type of stacking offset if the field should be stacked.\n`stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\nFor example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n\n`stack` can be one of the following values:\n- `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n- `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n-`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n- `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n\n__Default value:__ `zero` for plots with all of the following conditions are true:\n(1) the mark is `bar`, `area`, or `arc`;\n(2) the stacked measure channel (x or y) has a linear scale;\n(3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n\n__See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "PositionDef": { - "anyOf": [ - { - "$ref": "#/definitions/PositionFieldDef" - }, - { - "$ref": "#/definitions/PositionDatumDef" - }, - { - "$ref": "#/definitions/PositionValueDef" - } - ] - }, - "PositionFieldDef": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "axis": { - "anyOf": [ - { - "$ref": "#/definitions/Axis" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of axis's gridlines, ticks and labels.\nIf `null`, the axis for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n\n__See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "impute": { - "anyOf": [ - { - "$ref": "#/definitions/ImputeParams" - }, - { - "type": "null" - } - ], - "description": "An object defining the properties of the Impute Operation to be applied.\nThe field value of the other positional channel is taken as `key` of the `Impute` Operation.\nThe field of the `color` channel if specified is used as `groupby` of the `Impute` Operation.\n\n__See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "stack": { - "anyOf": [ - { - "$ref": "#/definitions/StackOffset" - }, - { - "type": "null" - }, - { - "type": "boolean" - } - ], - "description": "Type of stacking offset if the field should be stacked.\n`stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\nFor example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n\n`stack` can be one of the following values:\n- `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n- `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n-`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n- `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n\n__Default value:__ `zero` for plots with all of the following conditions are true:\n(1) the mark is `bar`, `area`, or `arc`;\n(2) the stacked measure channel (x or y) has a linear scale;\n(3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n\n__See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "PositionFieldDefBase": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "stack": { - "anyOf": [ - { - "$ref": "#/definitions/StackOffset" - }, - { - "type": "null" - }, - { - "type": "boolean" - } - ], - "description": "Type of stacking offset if the field should be stacked.\n`stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\nFor example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n\n`stack` can be one of the following values:\n- `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n- `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n-`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n- `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n\n__Default value:__ `zero` for plots with all of the following conditions are true:\n(1) the mark is `bar`, `area`, or `arc`;\n(2) the stacked measure channel (x or y) has a linear scale;\n(3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n\n__See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "PositionValueDef": { - "$ref": "#/definitions/ValueDef<(number|\"width\"|\"height\")>" - }, - "Predicate": { - "anyOf": [ - { - "$ref": "#/definitions/FieldEqualPredicate" - }, - { - "$ref": "#/definitions/FieldRangePredicate" - }, - { - "$ref": "#/definitions/FieldOneOfPredicate" - }, - { - "$ref": "#/definitions/FieldLTPredicate" - }, - { - "$ref": "#/definitions/FieldGTPredicate" - }, - { - "$ref": "#/definitions/FieldLTEPredicate" - }, - { - "$ref": "#/definitions/FieldGTEPredicate" - }, - { - "$ref": "#/definitions/FieldValidPredicate" - }, - { - "$ref": "#/definitions/SelectionPredicate" - }, - { - "type": "string" - } - ] - }, - "PrimitiveValue": { - "type": [ - "number", - "string", - "boolean", - "null" - ] - }, - "Projection": { - "additionalProperties": false, - "properties": { - "center": { - "$ref": "#/definitions/Vector2", - "description": "The projection's center, a two-element array of longitude and latitude in degrees.\n\n__Default value:__ `[0, 0]`" - }, - "clipAngle": { - "description": "The projection's clipping circle radius to the specified angle in degrees. If `null`, switches to [antimeridian](http://bl.ocks.org/mbostock/3788999) cutting rather than small-circle clipping.", - "type": "number" - }, - "clipExtent": { - "$ref": "#/definitions/Vector2>", - "description": "The projection's viewport clip extent to the specified bounds in pixels. The extent bounds are specified as an array `[[x0, y0], [x1, y1]]`, where `x0` is the left-side of the viewport, `y0` is the top, `x1` is the right and `y1` is the bottom. If `null`, no viewport clipping is performed." - }, - "coefficient": { - "type": "number" - }, - "distance": { - "type": "number" - }, - "extent": { - "$ref": "#/definitions/Vector2>" - }, - "fit": { - "anyOf": [ - { - "$ref": "#/definitions/Fit" - }, - { - "items": { - "$ref": "#/definitions/Fit" - }, - "type": "array" - } - ] - }, - "fraction": { - "type": "number" - }, - "lobes": { - "type": "number" - }, - "parallel": { - "type": "number" - }, - "parallels": { - "description": "For conic projections, the [two standard parallels](https://en.wikipedia.org/wiki/Map_projection#Conic) that define the map layout. The default depends on the specific conic projection used.", - "items": { - "type": "number" - }, - "type": "array" - }, - "pointRadius": { - "description": "The default radius (in pixels) to use when drawing GeoJSON `Point` and `MultiPoint` geometries. This parameter sets a constant default value. To modify the point radius in response to data, see the corresponding parameter of the GeoPath and GeoShape transforms.\n\n__Default value:__ `4.5`", - "type": "number" - }, - "precision": { - "description": "The threshold for the projection's [adaptive resampling](http://bl.ocks.org/mbostock/3795544) to the specified value in pixels. This value corresponds to the [Douglas–Peucker distance](http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm). If precision is not specified, returns the projection's current resampling precision which defaults to `√0.5 ≅ 0.70710…`.", - "type": "number" - }, - "radius": { - "type": "number" - }, - "ratio": { - "type": "number" - }, - "reflectX": { - "type": "boolean" - }, - "reflectY": { - "type": "boolean" - }, - "rotate": { - "anyOf": [ - { - "$ref": "#/definitions/Vector2" - }, - { - "$ref": "#/definitions/Vector3" - } - ], - "description": "The projection's three-axis rotation to the specified angles, which must be a two- or three-element array of numbers [`lambda`, `phi`, `gamma`] specifying the rotation angles in degrees about each spherical axis. (These correspond to yaw, pitch and roll.)\n\n__Default value:__ `[0, 0, 0]`" - }, - "scale": { - "description": "The projection’s scale (zoom) factor, overriding automatic fitting. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections.", - "type": "number" - }, - "size": { - "$ref": "#/definitions/Vector2" - }, - "spacing": { - "type": "number" - }, - "tilt": { - "type": "number" - }, - "translate": { - "$ref": "#/definitions/Vector2", - "description": "The projection’s translation offset as a two-element array `[tx, ty]`." - }, - "type": { - "$ref": "#/definitions/ProjectionType", - "description": "The cartographic projection to use. This value is case-insensitive, for example `\"albers\"` and `\"Albers\"` indicate the same projection type. You can find all valid projection types [in the documentation](https://vega.github.io/vega-lite/docs/projection.html#projection-types).\n\n__Default value:__ `mercator`" - } - }, - "type": "object" - }, - "ProjectionConfig": { - "$ref": "#/definitions/Projection", - "description": "Any property of Projection can be in config" - }, - "ProjectionType": { - "enum": [ - "albers", - "albersUsa", - "azimuthalEqualArea", - "azimuthalEquidistant", - "conicConformal", - "conicEqualArea", - "conicEquidistant", - "equalEarth", - "equirectangular", - "gnomonic", - "identity", - "mercator", - "naturalEarth1", - "orthographic", - "stereographic", - "transverseMercator" - ], - "type": "string" - }, - "QuantileTransform": { - "additionalProperties": false, - "properties": { - "as": { - "description": "The output field names for the probability and quantile values.\n\n__Default value:__ `[\"prob\", \"value\"]`", - "items": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "$ref": "#/definitions/FieldName" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "groupby": { - "description": "The data fields to group by. If not specified, a single group containing all data objects will be used.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "probs": { - "description": "An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the *step* parameter will be used.", - "items": { - "type": "number" - }, - "type": "array" - }, - "quantile": { - "$ref": "#/definitions/FieldName", - "description": "The data field for which to perform quantile estimation." - }, - "step": { - "description": "A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the *probs* parameter is not provided.", - "type": "number" - } - }, - "required": [ - "quantile" - ], - "type": "object" - }, - "RadialGradient": { - "additionalProperties": false, - "properties": { - "gradient": { - "description": "The type of gradient. Use `\"radial\"` for a radial gradient.", - "enum": [ - "radial" - ], - "type": "string" - }, - "id": { - "type": "string" - }, - "r1": { - "description": "The radius length, in normalized [0, 1] coordinates, of the inner circle for the gradient.\n\n__Default value:__ `0`", - "type": "number" - }, - "r2": { - "description": "The radius length, in normalized [0, 1] coordinates, of the outer circle for the gradient.\n\n__Default value:__ `0.5`", - "type": "number" - }, - "stops": { - "description": "An array of gradient stops defining the gradient color sequence.", - "items": { - "$ref": "#/definitions/GradientStop" - }, - "type": "array" - }, - "x1": { - "description": "The x-coordinate, in normalized [0, 1] coordinates, for the center of the inner circle for the gradient.\n\n__Default value:__ `0.5`", - "type": "number" - }, - "x2": { - "description": "The x-coordinate, in normalized [0, 1] coordinates, for the center of the outer circle for the gradient.\n\n__Default value:__ `0.5`", - "type": "number" - }, - "y1": { - "description": "The y-coordinate, in normalized [0, 1] coordinates, for the center of the inner circle for the gradient.\n\n__Default value:__ `0.5`", - "type": "number" - }, - "y2": { - "description": "The y-coordinate, in normalized [0, 1] coordinates, for the center of the outer circle for the gradient.\n\n__Default value:__ `0.5`", - "type": "number" - } - }, - "required": [ - "gradient", - "stops" - ], - "type": "object" - }, - "RangeConfig": { - "additionalProperties": { - "anyOf": [ - { - "$ref": "#/definitions/RangeScheme" - }, - { - "type": "array" - } - ] - }, - "properties": { - "category": { - "anyOf": [ - { - "$ref": "#/definitions/RangeScheme" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "Default [color scheme](https://vega.github.io/vega/docs/schemes/) for categorical data." - }, - "diverging": { - "anyOf": [ - { - "$ref": "#/definitions/RangeScheme" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "Default [color scheme](https://vega.github.io/vega/docs/schemes/) for diverging quantitative ramps." - }, - "heatmap": { - "anyOf": [ - { - "$ref": "#/definitions/RangeScheme" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "Default [color scheme](https://vega.github.io/vega/docs/schemes/) for quantitative heatmaps." - }, - "ordinal": { - "anyOf": [ - { - "$ref": "#/definitions/RangeScheme" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "Default [color scheme](https://vega.github.io/vega/docs/schemes/) for rank-ordered data." - }, - "ramp": { - "anyOf": [ - { - "$ref": "#/definitions/RangeScheme" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "Default [color scheme](https://vega.github.io/vega/docs/schemes/) for sequential quantitative ramps." - }, - "symbol": { - "description": "Array of [symbol](https://vega.github.io/vega/docs/marks/symbol/) names or paths for the default shape palette.", - "items": { - "$ref": "#/definitions/SymbolShape" - }, - "type": "array" - } - }, - "type": "object" - }, - "RangeEnum": { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ], - "type": "string" - }, - "RangeRaw": { - "items": { - "anyOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/definitions/RangeRawArray" - } - ] - }, - "type": "array" - }, - "RangeRawArray": { - "items": { - "type": "number" - }, - "type": "array" - }, - "RangeScheme": { - "anyOf": [ - { - "$ref": "#/definitions/RangeEnum" - }, - { - "$ref": "#/definitions/RangeRaw" - }, - { - "additionalProperties": false, - "properties": { - "count": { - "type": "number" - }, - "extent": { - "items": { - "type": "number" - }, - "type": "array" - }, - "scheme": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "$ref": "#/definitions/ColorScheme" - } - ] - } - }, - "required": [ - "scheme" - ], - "type": "object" - } - ] - }, - "RectConfig": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`." - }, - "angle": { - "description": "The rotation angle of the text, in degrees.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree.", - "type": "boolean" - }, - "ariaRole": { - "description": "Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"role\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "ariaRoleDescription": { - "description": "A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"aria-roledescription\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "aspect": { - "description": "Whether to keep aspect ratio of image marks.", - "type": "boolean" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone." - }, - "binSpacing": { - "description": "Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style).\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - "blend": { - "$ref": "#/definitions/Blend", - "description": "The color blend mode for drawing an item on its current background. Any valid [CSS mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) value can be used.\n\n__Default value: `\"source-over\"`" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "continuousBandSize": { - "description": "The default size of the bars on continuous scales.\n\n__Default value:__ `5`", - "minimum": 0, - "type": "number" - }, - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomLeft": { - "description": "The radius in pixels of rounded rectangles' bottom left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomRight": { - "description": "The radius in pixels of rounded rectangles' bottom right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopLeft": { - "description": "The radius in pixels of rounded rectangles' top right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopRight": { - "description": "The radius in pixels of rounded rectangles' top left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "description": { - "description": "A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute).", - "type": "string" - }, - "dir": { - "$ref": "#/definitions/TextDirection", - "description": "The direction of the text. One of `\"ltr\"` (left-to-right) or `\"rtl\"` (right-to-left). This property determines on which side is truncated in response to the limit parameter.\n\n__Default value:__ `\"ltr\"`" - }, - "discreteBandSize": { - "description": "The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.", - "minimum": 0, - "type": "number" - }, - "dx": { - "description": "The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "dy": { - "description": "The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "ellipsis": { - "description": "The ellipsis string for text truncated in response to the limit parameter.\n\n__Default value:__ `\"…\"`", - "type": "string" - }, - "endAngle": { - "description": "The end angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n\n__Default value:__ (None)" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "filled": { - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n\n__Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).", - "type": "boolean" - }, - "font": { - "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "fontSize": { - "description": "The font size, in pixels.\n\n__Default value:__ `11`", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style (e.g., `\"italic\"`)." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "height": { - "description": "Height of the marks.", - "type": "number" - }, - "href": { - "description": "A URL to load upon mouse click. If defined, the mark acts as a hyperlink.", - "format": "uri", - "type": "string" - }, - "innerRadius": { - "description": "The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.", - "type": "number" - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method to use for line and area marks. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"step-before\"`: alternate between vertical and horizontal segments, as in a step function.\n- `\"step-after\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null - ], - "type": [ - "string", - "null" - ] - }, - "limit": { - "description": "The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0` -- indicating no limit", - "type": "number" - }, - "lineBreak": { - "description": "A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property is ignored if the text is array-valued.", - "type": "string" - }, - "lineHeight": { - "description": "The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "order": { - "description": "For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.", - "type": [ - "null", - "boolean" - ] - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "The orientation of a non-stacked bar, tick, area, and line charts.\nThe value is either horizontal (default) or vertical.\n- For bar, rule and tick, this determines whether the size of the bar and tick\nshould be applied to x or y dimension.\n- For area, this property determines the orient property of the Vega output.\n- For line and trail marks, this property determines the sort order of the points in the line\nif `config.sortLineBy` is not specified.\nFor stacked charts, this is always determined by the orientation of the stack;\ntherefore explicitly specified value will be ignored." - }, - "outerRadius": { - "description": "The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.", - "type": "number" - }, - "padAngle": { - "description": "The angular padding applied to sides of the arc, in radians.", - "type": "number" - }, - "radius": { - "description": "For arc mark, the primary (outer) radius in pixels.\n\nFor text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.", - "type": "number" - }, - "radius2": { - "description": "The secondary (inner) radius in pixels of arc marks.", - "type": "number" - }, - "shape": { - "anyOf": [ - { - "$ref": "#/definitions/SymbolShape" - }, - { - "type": "string" - } - ], - "description": "Shape of the point marks. Supported values include:\n- plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n- the line symbol `\"stroke\"`\n- centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n- a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n__Default value:__ `\"circle\"`" - }, - "size": { - "description": "Default size for marks.\n- For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n- For `bar`, this represents the band size of the bar, in pixels.\n- For `text`, this represents the font size, in pixels.\n\n__Default value:__\n- `30` for point, circle, square marks; width/height's `step`\n- `2` for bar marks with discrete dimensions;\n- `5` for bar marks with continuous dimensions;\n- `11` for text marks.", - "minimum": 0, - "type": "number" - }, - "startAngle": { - "description": "The start angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n\n__Default value:__ (None)" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOffset": { - "description": "The offset in pixels at which to draw the group stroke and fill. If unspecified, the default behavior is to dynamically offset stroked groups such that 1 pixel stroke widths align with the pixel grid.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "tension": { - "description": "Depending on the interpolation type, sets the tension parameter (for line and area marks).", - "type": "number" - }, - "text": { - "$ref": "#/definitions/Text", - "description": "Placeholder text if the `text` channel is not specified" - }, - "theta": { - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "theta2": { - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.", - "type": "number" - }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\nIf set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, - "timeUnitBandPosition": { - "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\nIf set to `0.5`, the marks will be positioned in the middle of the time unit band step.", - "type": "number" - }, - "tooltip": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/TooltipContent" - }, - { - "type": "null" - } - ], - "description": "The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n\n- If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n- If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n- If set to `null` or `false`, then no tooltip will be used.\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n\n__Default value:__ `null`" - }, - "width": { - "description": "Width of the marks.", - "type": "number" - }, - "x": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "y": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - } - }, - "type": "object" - }, - "RegressionTransform": { - "additionalProperties": false, - "properties": { - "as": { - "description": "The output field names for the smoothed points generated by the regression transform.\n\n__Default value:__ The field names of the input x and y values.", - "items": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "$ref": "#/definitions/FieldName" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "extent": { - "description": "A [min, max] domain over the independent (x) field for the starting and ending points of the generated trend line.", - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "groupby": { - "description": "The data fields to group by. If not specified, a single group containing all data objects will be used.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "method": { - "description": "The functional form of the regression model. One of `\"linear\"`, `\"log\"`, `\"exp\"`, `\"pow\"`, `\"quad\"`, or `\"poly\"`.\n\n__Default value:__ `\"linear\"`", - "enum": [ - "linear", - "log", - "exp", - "pow", - "quad", - "poly" - ], - "type": "string" - }, - "on": { - "$ref": "#/definitions/FieldName", - "description": "The data field of the independent variable to use a predictor." - }, - "order": { - "description": "The polynomial order (number of coefficients) for the 'poly' method.\n\n__Default value:__ `3`", - "type": "number" - }, - "params": { - "description": "A boolean flag indicating if the transform should return the regression model parameters (one object per group), rather than trend line points.\nThe resulting objects include a `coef` array of fitted coefficient values (starting with the intercept term and then including terms of increasing order)\nand an `rSquared` value (indicating the total variance explained by the model).\n\n__Default value:__ `false`", - "type": "boolean" - }, - "regression": { - "$ref": "#/definitions/FieldName", - "description": "The data field of the dependent variable to predict." - } - }, - "required": [ - "regression", - "on" - ], - "type": "object" - }, - "RepeatMapping": { - "additionalProperties": false, - "properties": { - "column": { - "description": "An array of fields to be repeated horizontally.", - "items": { - "type": "string" - }, - "type": "array" - }, - "row": { - "description": "An array of fields to be repeated vertically.", - "items": { - "type": "string" - }, - "type": "array" - } - }, - "type": "object" - }, - "RepeatRef": { - "additionalProperties": false, - "description": "Reference to a repeated value.", - "properties": { - "repeat": { - "enum": [ - "row", - "column", - "repeat", - "layer" - ], - "type": "string" - } - }, - "required": [ - "repeat" - ], - "type": "object" - }, - "RepeatSpec": { - "anyOf": [ - { - "$ref": "#/definitions/NonLayerRepeatSpec" - }, - { - "$ref": "#/definitions/LayerRepeatSpec" - } - ] - }, - "Resolve": { - "additionalProperties": false, - "description": "Defines how scales, axes, and legends from different specs should be combined. Resolve is a mapping from `scale`, `axis`, and `legend` to a mapping from channels to resolutions. Scales and guides can be resolved to be `\"independent\"` or `\"shared\"`.", - "properties": { - "axis": { - "$ref": "#/definitions/AxisResolveMap" - }, - "legend": { - "$ref": "#/definitions/LegendResolveMap" - }, - "scale": { - "$ref": "#/definitions/ScaleResolveMap" - } - }, - "type": "object" - }, - "ResolveMode": { - "enum": [ - "independent", - "shared" - ], - "type": "string" - }, - "RowCol": { - "additionalProperties": false, - "properties": { - "column": { - "$ref": "#/definitions/LayoutAlign" - }, - "row": { - "$ref": "#/definitions/LayoutAlign" - } - }, - "type": "object" - }, - "RowCol": { - "additionalProperties": false, - "properties": { - "column": { - "type": "boolean" - }, - "row": { - "type": "boolean" - } - }, - "type": "object" - }, - "RowCol": { - "additionalProperties": false, - "properties": { - "column": { - "type": "number" - }, - "row": { - "type": "number" - } - }, - "type": "object" - }, - "RowColumnEncodingFieldDef": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "align": { - "$ref": "#/definitions/LayoutAlign", - "description": "The alignment to apply to row/column facet's subplot.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "center": { - "description": "Boolean flag indicating if facet's subviews should be centered relative to their respective rows or columns.\n\n__Default value:__ `false`", - "type": "boolean" - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "header": { - "$ref": "#/definitions/Header", - "description": "An object defining properties of a facet's header." - }, - "sort": { - "anyOf": [ - { - "$ref": "#/definitions/SortArray" - }, - { - "$ref": "#/definitions/SortOrder" - }, - { - "$ref": "#/definitions/EncodingSortField" - }, - { - "type": "null" - } - ], - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` is not supported for `row` and `column`." - }, - "spacing": { - "description": "The spacing in pixels between facet's sub-views.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)", - "type": "number" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "SampleTransform": { - "additionalProperties": false, - "properties": { - "sample": { - "description": "The maximum number of data objects to include in the sample.\n\n__Default value:__ `1000`", - "type": "number" - } - }, - "required": [ - "sample" - ], - "type": "object" - }, - "Scale": { - "additionalProperties": false, - "properties": { - "align": { - "description": "The alignment of the steps within the scale range.\n\nThis value must lie in the range `[0,1]`. A value of `0.5` indicates that the steps should be centered within the range. A value of `0` or `1` may be used to shift the bands to one side, say to position them adjacent to an axis.\n\n__Default value:__ `0.5`", - "type": "number" - }, - "base": { - "description": "The logarithm base of the `log` scale (default `10`).", - "type": "number" - }, - "bins": { - "$ref": "#/definitions/ScaleBins", - "description": "Bin boundaries can be provided to scales as either an explicit array of bin boundaries or as a bin specification object. The legal values are:\n- An [array](../types/#Array) literal of bin boundary values. For example, `[0, 5, 10, 15, 20]`. The array must include both starting and ending boundaries. The previous example uses five values to indicate a total of four bin intervals: [0-5), [5-10), [10-15), [15-20]. Array literals may include signal references as elements.\n- A [bin specification object](https://vega.github.io/vega-lite/docs/scale.html#bins) that indicates the bin _step_ size, and optionally the _start_ and _stop_ boundaries.\n- An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels." - }, - "clamp": { - "description": "If `true`, values that exceed the data domain are clamped to either the minimum or maximum range value\n\n__Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/config.html#scale-config)'s `clamp` (`true` by default).", - "type": "boolean" - }, - "constant": { - "description": "A constant determining the slope of the symlog function around zero. Only used for `symlog` scales.\n\n__Default value:__ `1`", - "type": "number" - }, - "domain": { - "anyOf": [ - { - "items": { - "anyOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/DateTime" - } - ] - }, - "type": "array" - }, - { - "enum": [ - "unaggregated" - ], - "type": "string" - }, - { - "$ref": "#/definitions/SelectionExtent" - }, - { - "$ref": "#/definitions/DomainUnionWith" - } - ], - "description": "Customized domain values in the form of constant values or dynamic values driven by a selection.\n\n1) Constant `domain` for _quantitative_ fields can take one of the following forms:\n\n- A two-element array with minimum and maximum values. To create a diverging scale, this two-element array can be combined with the `domainMid` property.\n- An array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n- A string value `\"unaggregated\"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation.\n\n2) Constant `domain` for _temporal_ fields can be a two-element array with minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime).\n\n3) Constant `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values.\n\n4) To combine (union) specified constant domain with the field's values, `domain` can be an object with a `unionWith` property that specify constant domain to be combined. For example, `domain: {unionWith: [0, 100]}` for a quantitative scale means that the scale domain always includes `[0, 100]`, but will include other values in the fields beyond `[0, 100]`.\n\n5) Domain can also takes an object defining a field or encoding of a selection that [interactively determines](https://vega.github.io/vega-lite/docs/selection.html#scale-domains) the scale domain." - }, - "domainMax": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/DateTime" - } - ], - "description": "Sets the maximum value in the scale domain, overriding the `domain` property. This property is only intended for use with scales having continuous domains." - }, - "domainMid": { - "description": "Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint for [diverging color scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). The domainMid property is only intended for use with scales supporting continuous, piecewise domains.", - "type": "number" - }, - "domainMin": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/DateTime" - } - ], - "description": "Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains." - }, - "exponent": { - "description": "The exponent of the `pow` scale.", - "type": "number" - }, - "interpolate": { - "anyOf": [ - { - "$ref": "#/definitions/ScaleInterpolateEnum" - }, - { - "$ref": "#/definitions/ScaleInterpolateParams" - } - ], - "description": "The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include `rgb`, `hsl`, `hsl-long`, `lab`, `hcl`, `hcl-long`, `cubehelix` and `cubehelix-long` ('-long' variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued _type_ property and an optional numeric _gamma_ property applicable to rgb and cubehelix interpolators. For more, see the [d3-interpolate documentation](https://github.com/d3/d3-interpolate).\n\n* __Default value:__ `hcl`" - }, - "nice": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "$ref": "#/definitions/TimeInterval" - }, - { - "$ref": "#/definitions/TimeIntervalStep" - } - ], - "description": "Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of _[0.201479…, 0.996679…]_, a nice domain might be _[0.2, 1.0]_.\n\nFor quantitative scales such as linear, `nice` can be either a boolean flag or a number. If `nice` is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.\n\nFor temporal fields with time and utc scales, the `nice` value can be a string indicating the desired time interval. Legal values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and `\"year\"`. Alternatively, `time` and `utc` scales can accept an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}`, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries.\n\n__Default value:__ `true` for unbinned _quantitative_ fields; `false` otherwise." - }, - "padding": { - "description": "For _[continuous](https://vega.github.io/vega-lite/docs/scale.html#continuous)_ scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the `zero`, `nice`, `domainMin`, and `domainMax` properties.\n\nFor _[band](https://vega.github.io/vega-lite/docs/scale.html#band)_ scales, shortcut for setting `paddingInner` and `paddingOuter` to the same value.\n\nFor _[point](https://vega.github.io/vega-lite/docs/scale.html#point)_ scales, alias for `paddingOuter`.\n\n__Default value:__ For _continuous_ scales, derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `continuousPadding`.\nFor _band and point_ scales, see `paddingInner` and `paddingOuter`. By default, Vega-Lite sets padding such that _width/height = number of unique values * step_.", - "minimum": 0, - "type": "number" - }, - "paddingInner": { - "description": "The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].\n\nFor point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands).\n\n__Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingInner`.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "paddingOuter": { - "description": "The outer padding (spacing) at the ends of the range of band and point scales,\nas a fraction of the step size. This value must lie in the range [0,1].\n\n__Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingOuter` for band scales and `pointPadding` for point scales.\nBy default, Vega-Lite sets outer padding such that _width/height = number of unique values * step_.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "range": { - "anyOf": [ - { - "$ref": "#/definitions/RangeEnum" - }, - { - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "items": { - "type": "number" - }, - "type": "array" - } - ] - }, - "type": "array" - }, - { - "additionalProperties": false, - "properties": { - "field": { - "type": "string" - } - }, - "required": [ - "field" - ], - "type": "object" - } - ], - "description": "The range of the scale. One of:\n\n- A string indicating a [pre-defined named scale range](https://vega.github.io/vega-lite/docs/scale.html#range-config) (e.g., example, `\"symbol\"`, or `\"diverging\"`).\n\n- For [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous), two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a [piecewise scale](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n\n- For [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) and [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales, an array of desired output values or an object with a `field` property representing the range values. For example, if a field `color` contains CSS color names, we can set `range` to `{field: \"color\"}`.\n\n__Notes:__\n\n1) For color scales you can also specify a color [`scheme`](https://vega.github.io/vega-lite/docs/scale.html#scheme) instead of `range`.\n\n2) Any directly specified `range` for `x` and `y` channels will be ignored. Range can be customized via the view's corresponding [size](https://vega.github.io/vega-lite/docs/size.html) (`width` and `height`)." - }, - "rangeMax": { - "description": "Sets the maximum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.", - "type": [ - "number", - "string" - ] - }, - "rangeMin": { - "description": "Sets the minimum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.", - "type": [ - "number", - "string" - ] - }, - "reverse": { - "description": "If true, reverses the order of the scale range.\n__Default value:__ `false`.", - "type": "boolean" - }, - "round": { - "description": "If `true`, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid.\n\n__Default value:__ `false`.", - "type": "boolean" - }, - "scheme": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/SchemeParams" - } - ], - "description": "A string indicating a color [scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme) name (e.g., `\"category10\"` or `\"blues\"`) or a [scheme parameter object](https://vega.github.io/vega-lite/docs/scale.html#scheme-params).\n\nDiscrete color schemes may be used with [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) or [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales. Continuous color schemes are intended for use with color scales.\n\nFor the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference." - }, - "type": { - "$ref": "#/definitions/ScaleType", - "description": "The type of scale. Vega-Lite supports the following categories of scale types:\n\n1) [**Continuous Scales**](https://vega.github.io/vega-lite/docs/scale.html#continuous) -- mapping continuous domains to continuous output ranges ([`\"linear\"`](https://vega.github.io/vega-lite/docs/scale.html#linear), [`\"pow\"`](https://vega.github.io/vega-lite/docs/scale.html#pow), [`\"sqrt\"`](https://vega.github.io/vega-lite/docs/scale.html#sqrt), [`\"symlog\"`](https://vega.github.io/vega-lite/docs/scale.html#symlog), [`\"log\"`](https://vega.github.io/vega-lite/docs/scale.html#log), [`\"time\"`](https://vega.github.io/vega-lite/docs/scale.html#time), [`\"utc\"`](https://vega.github.io/vega-lite/docs/scale.html#utc).\n\n2) [**Discrete Scales**](https://vega.github.io/vega-lite/docs/scale.html#discrete) -- mapping discrete domains to discrete ([`\"ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#ordinal)) or continuous ([`\"band\"`](https://vega.github.io/vega-lite/docs/scale.html#band) and [`\"point\"`](https://vega.github.io/vega-lite/docs/scale.html#point)) output ranges.\n\n3) [**Discretizing Scales**](https://vega.github.io/vega-lite/docs/scale.html#discretizing) -- mapping continuous domains to discrete output ranges [`\"bin-ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#bin-ordinal), [`\"quantile\"`](https://vega.github.io/vega-lite/docs/scale.html#quantile), [`\"quantize\"`](https://vega.github.io/vega-lite/docs/scale.html#quantize) and [`\"threshold\"`](https://vega.github.io/vega-lite/docs/scale.html#threshold).\n\n__Default value:__ please see the [scale type table](https://vega.github.io/vega-lite/docs/scale.html#type)." - }, - "zero": { - "description": "If `true`, ensures that a zero baseline value is included in the scale domain.\n\n__Default value:__ `true` for x and y channels if the quantitative field is not binned and no custom `domain` is provided; `false` otherwise.\n\n__Note:__ Log, time, and utc scales do not support `zero`.", - "type": "boolean" - } - }, - "type": "object" - }, - "ScaleBinParams": { - "additionalProperties": false, - "properties": { - "start": { - "description": "The starting (lowest-valued) bin boundary.\n\n__Default value:__ The lowest value of the scale domain will be used.", - "type": "number" - }, - "step": { - "description": "The step size defining the bin interval width.", - "type": "number" - }, - "stop": { - "description": "The stopping (highest-valued) bin boundary.\n\n__Default value:__ The highest value of the scale domain will be used.", - "type": "number" - } - }, - "required": [ - "step" - ], - "type": "object" - }, - "ScaleBins": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "$ref": "#/definitions/ScaleBinParams" - } - ] - }, - "ScaleConfig": { - "additionalProperties": false, - "properties": { - "bandPaddingInner": { - "description": "Default inner padding for `x` and `y` band-ordinal scales.\n\n__Default value:__\n- `barBandPaddingInner` for bar marks (`0.1` by default)\n- `rectBandPaddingInner` for rect and other marks (`0` by default)", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bandPaddingOuter": { - "description": "Default outer padding for `x` and `y` band-ordinal scales.\n\n__Default value:__ `paddingInner/2` (which makes _width/height = number of unique values * step_)", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "barBandPaddingInner": { - "description": "Default inner padding for `x` and `y` band-ordinal scales of `\"bar\"` marks.\n\n__Default value:__ `0.1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "clamp": { - "description": "If true, values that exceed the data domain are clamped to either the minimum or maximum range value", - "type": "boolean" - }, - "continuousPadding": { - "description": "Default padding for continuous scales.\n\n__Default:__ `5` for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.; `0` otherwise.", - "minimum": 0, - "type": "number" - }, - "maxBandSize": { - "description": "The default max value for mapping quantitative fields to bar's size/bandSize.\n\nIf undefined (default), we will use the axis's size (width or height) - 1.", - "minimum": 0, - "type": "number" - }, - "maxFontSize": { - "description": "The default max value for mapping quantitative fields to text's size/fontSize.\n\n__Default value:__ `40`", - "minimum": 0, - "type": "number" - }, - "maxOpacity": { - "description": "Default max opacity for mapping a field to opacity.\n\n__Default value:__ `0.8`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "maxSize": { - "description": "Default max value for point size scale.", - "minimum": 0, - "type": "number" - }, - "maxStrokeWidth": { - "description": "Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks.\n\n__Default value:__ `4`", - "minimum": 0, - "type": "number" - }, - "minBandSize": { - "description": "The default min value for mapping quantitative fields to bar and tick's size/bandSize scale with zero=false.\n\n__Default value:__ `2`", - "minimum": 0, - "type": "number" - }, - "minFontSize": { - "description": "The default min value for mapping quantitative fields to tick's size/fontSize scale with zero=false\n\n__Default value:__ `8`", - "minimum": 0, - "type": "number" - }, - "minOpacity": { - "description": "Default minimum opacity for mapping a field to opacity.\n\n__Default value:__ `0.3`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "minSize": { - "description": "Default minimum value for point size scale with zero=false.\n\n__Default value:__ `9`", - "minimum": 0, - "type": "number" - }, - "minStrokeWidth": { - "description": "Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks with zero=false.\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - "pointPadding": { - "description": "Default outer padding for `x` and `y` point-ordinal scales.\n\n__Default value:__ `0.5` (which makes _width/height = number of unique values * step_)", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "quantileCount": { - "description": "Default range cardinality for [`quantile`](https://vega.github.io/vega-lite/docs/scale.html#quantile) scale.\n\n__Default value:__ `4`", - "minimum": 0, - "type": "number" - }, - "quantizeCount": { - "description": "Default range cardinality for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale.\n\n__Default value:__ `4`", - "minimum": 0, - "type": "number" - }, - "rectBandPaddingInner": { - "description": "Default inner padding for `x` and `y` band-ordinal scales of `\"rect\"` marks.\n\n__Default value:__ `0`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "round": { - "description": "If true, rounds numeric output values to integers.\nThis can be helpful for snapping to the pixel grid.\n(Only available for `x`, `y`, and `size` scales.)", - "type": "boolean" - }, - "useUnaggregatedDomain": { - "description": "Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis.\n\nThis is equivalent to setting `domain` to `\"unaggregate\"` for aggregated _quantitative_ fields by default.\n\nThis property only works with aggregate functions that produce values within the raw data domain (`\"mean\"`, `\"average\"`, `\"median\"`, `\"q1\"`, `\"q3\"`, `\"min\"`, `\"max\"`). For other aggregations that produce values outside of the raw data domain (e.g. `\"count\"`, `\"sum\"`), this property is ignored.\n\n__Default value:__ `false`", - "type": "boolean" - }, - "xReverse": { - "description": "Reverse x-scale by default (useful for right-to-left charts).", - "type": "boolean" - } - }, - "type": "object" - }, - "ScaleInterpolateEnum": { - "enum": [ - "rgb", - "lab", - "hcl", - "hsl", - "hsl-long", - "hcl-long", - "cubehelix", - "cubehelix-long" - ], - "type": "string" - }, - "ScaleInterpolateParams": { - "additionalProperties": false, - "properties": { - "gamma": { - "type": "number" - }, - "type": { - "enum": [ - "rgb", - "cubehelix", - "cubehelix-long" - ], - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "ScaleResolveMap": { - "additionalProperties": false, - "properties": { - "angle": { - "$ref": "#/definitions/ResolveMode" - }, - "color": { - "$ref": "#/definitions/ResolveMode" - }, - "fill": { - "$ref": "#/definitions/ResolveMode" - }, - "fillOpacity": { - "$ref": "#/definitions/ResolveMode" - }, - "opacity": { - "$ref": "#/definitions/ResolveMode" - }, - "radius": { - "$ref": "#/definitions/ResolveMode" - }, - "shape": { - "$ref": "#/definitions/ResolveMode" - }, - "size": { - "$ref": "#/definitions/ResolveMode" - }, - "stroke": { - "$ref": "#/definitions/ResolveMode" - }, - "strokeDash": { - "$ref": "#/definitions/ResolveMode" - }, - "strokeOpacity": { - "$ref": "#/definitions/ResolveMode" - }, - "strokeWidth": { - "$ref": "#/definitions/ResolveMode" - }, - "theta": { - "$ref": "#/definitions/ResolveMode" - }, - "x": { - "$ref": "#/definitions/ResolveMode" - }, - "y": { - "$ref": "#/definitions/ResolveMode" - } - }, - "type": "object" - }, - "ScaleType": { - "enum": [ - "linear", - "log", - "pow", - "sqrt", - "symlog", - "identity", - "sequential", - "time", - "utc", - "quantile", - "quantize", - "threshold", - "bin-ordinal", - "ordinal", - "point", - "band" - ], - "type": "string" - }, - "SchemeParams": { - "additionalProperties": false, - "properties": { - "count": { - "description": "The number of colors to use in the scheme. This can be useful for scale types such as `\"quantize\"`, which use the length of the scale range to determine the number of discrete bins for the scale domain.", - "type": "number" - }, - "extent": { - "description": "The extent of the color range to use. For example `[0.2, 1]` will rescale the color scheme such that color values in the range _[0, 0.2)_ are excluded from the scheme.", - "items": { - "type": "number" - }, - "type": "array" - }, - "name": { - "description": "A color scheme name for ordinal scales (e.g., `\"category10\"` or `\"blues\"`).\n\nFor the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.", - "type": "string" - } - }, - "required": [ - "name" - ], - "type": "object" - }, - "SecondaryFieldDef": { - "additionalProperties": false, - "description": "A field definition of a secondary channel that shares a scale with another primary channel. For example, `x2`, `xError` and `xError2` share the same scale with `x`.", - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - } - }, - "type": "object" - }, - "SelectionConfig": { - "additionalProperties": false, - "properties": { - "interval": { - "$ref": "#/definitions/IntervalSelectionConfig", - "description": "The default definition for an [`interval`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations\nfor an interval selection definition (except `type`) may be specified here.\n\nFor instance, setting `interval` to `{\"translate\": false}` disables the ability to move\ninterval selections by default." - }, - "multi": { - "$ref": "#/definitions/MultiSelectionConfig", - "description": "The default definition for a [`multi`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations\nfor a multi selection definition (except `type`) may be specified here.\n\nFor instance, setting `multi` to `{\"toggle\": \"event.altKey\"}` adds additional values to\nmulti selections when clicking with the alt-key pressed by default." - }, - "single": { - "$ref": "#/definitions/SingleSelectionConfig", - "description": "The default definition for a [`single`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations\n for a single selection definition (except `type`) may be specified here.\n\nFor instance, setting `single` to `{\"on\": \"dblclick\"}` populates single selections on double-click by default." - } - }, - "type": "object" - }, - "SelectionDef": { - "anyOf": [ - { - "$ref": "#/definitions/SingleSelection" - }, - { - "$ref": "#/definitions/MultiSelection" - }, - { - "$ref": "#/definitions/IntervalSelection" - } - ] - }, - "SelectionExtent": { - "anyOf": [ - { - "additionalProperties": false, - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "The field name to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html)\nover multiple fields or encodings." - }, - "selection": { - "description": "The name of a selection.", - "type": "string" - } - }, - "required": [ - "selection" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "encoding": { - "$ref": "#/definitions/SingleDefUnitChannel", - "description": "The encoding channel to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html)\nover multiple fields or encodings." - }, - "selection": { - "description": "The name of a selection.", - "type": "string" - } - }, - "required": [ - "selection" - ], - "type": "object" - } - ] - }, - "SelectionInit": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - } - ] - }, - "SelectionInitInterval": { - "anyOf": [ - { - "$ref": "#/definitions/Vector2" - }, - { - "$ref": "#/definitions/Vector2" - }, - { - "$ref": "#/definitions/Vector2" - }, - { - "$ref": "#/definitions/Vector2" - } - ] - }, - "SelectionInitIntervalMapping": { - "$ref": "#/definitions/Dict" - }, - "SelectionInitMapping": { - "$ref": "#/definitions/Dict" - }, - "SelectionPredicate": { - "additionalProperties": false, - "properties": { - "selection": { - "$ref": "#/definitions/SelectionComposition", - "description": "Filter using a selection name or a logical composition of selection names." - } - }, - "required": [ - "selection" - ], - "type": "object" - }, - "SelectionResolution": { - "enum": [ - "global", - "union", - "intersect" - ], - "type": "string" - }, - "SequenceGenerator": { - "additionalProperties": false, - "properties": { - "name": { - "description": "Provide a placeholder name and bind data at runtime.", - "type": "string" - }, - "sequence": { - "$ref": "#/definitions/SequenceParams", - "description": "Generate a sequence of numbers." - } - }, - "required": [ - "sequence" - ], - "type": "object" - }, - "SequenceParams": { - "additionalProperties": false, - "properties": { - "as": { - "$ref": "#/definitions/FieldName", - "description": "The name of the generated sequence field.\n\n__Default value:__ `\"data\"`" - }, - "start": { - "description": "The starting value of the sequence (inclusive).", - "type": "number" - }, - "step": { - "description": "The step value between sequence entries.\n\n__Default value:__ `1`", - "type": "number" - }, - "stop": { - "description": "The ending value of the sequence (exclusive).", - "type": "number" - } - }, - "required": [ - "start", - "stop" - ], - "type": "object" - }, - "SequentialMultiHue": { - "enum": [ - "viridis", - "inferno", - "magma", - "plasma", - "bluegreen", - "bluegreen-3", - "bluegreen-4", - "bluegreen-5", - "bluegreen-6", - "bluegreen-7", - "bluegreen-8", - "bluegreen-9", - "bluepurple", - "bluepurple-3", - "bluepurple-4", - "bluepurple-5", - "bluepurple-6", - "bluepurple-7", - "bluepurple-8", - "bluepurple-9", - "goldgreen", - "goldgreen-3", - "goldgreen-4", - "goldgreen-5", - "goldgreen-6", - "goldgreen-7", - "goldgreen-8", - "goldgreen-9", - "goldorange", - "goldorange-3", - "goldorange-4", - "goldorange-5", - "goldorange-6", - "goldorange-7", - "goldorange-8", - "goldorange-9", - "goldred", - "goldred-3", - "goldred-4", - "goldred-5", - "goldred-6", - "goldred-7", - "goldred-8", - "goldred-9", - "greenblue", - "greenblue-3", - "greenblue-4", - "greenblue-5", - "greenblue-6", - "greenblue-7", - "greenblue-8", - "greenblue-9", - "orangered", - "orangered-3", - "orangered-4", - "orangered-5", - "orangered-6", - "orangered-7", - "orangered-8", - "orangered-9", - "purplebluegreen", - "purplebluegreen-3", - "purplebluegreen-4", - "purplebluegreen-5", - "purplebluegreen-6", - "purplebluegreen-7", - "purplebluegreen-8", - "purplebluegreen-9", - "purpleblue", - "purpleblue-3", - "purpleblue-4", - "purpleblue-5", - "purpleblue-6", - "purpleblue-7", - "purpleblue-8", - "purpleblue-9", - "purplered", - "purplered-3", - "purplered-4", - "purplered-5", - "purplered-6", - "purplered-7", - "purplered-8", - "purplered-9", - "redpurple", - "redpurple-3", - "redpurple-4", - "redpurple-5", - "redpurple-6", - "redpurple-7", - "redpurple-8", - "redpurple-9", - "yellowgreenblue", - "yellowgreenblue-3", - "yellowgreenblue-4", - "yellowgreenblue-5", - "yellowgreenblue-6", - "yellowgreenblue-7", - "yellowgreenblue-8", - "yellowgreenblue-9", - "yellowgreen", - "yellowgreen-3", - "yellowgreen-4", - "yellowgreen-5", - "yellowgreen-6", - "yellowgreen-7", - "yellowgreen-8", - "yellowgreen-9", - "yelloworangebrown", - "yelloworangebrown-3", - "yelloworangebrown-4", - "yelloworangebrown-5", - "yelloworangebrown-6", - "yelloworangebrown-7", - "yelloworangebrown-8", - "yelloworangebrown-9", - "yelloworangered", - "yelloworangered-3", - "yelloworangered-4", - "yelloworangered-5", - "yelloworangered-6", - "yelloworangered-7", - "yelloworangered-8", - "yelloworangered-9", - "darkblue", - "darkblue-3", - "darkblue-4", - "darkblue-5", - "darkblue-6", - "darkblue-7", - "darkblue-8", - "darkblue-9", - "darkgold", - "darkgold-3", - "darkgold-4", - "darkgold-5", - "darkgold-6", - "darkgold-7", - "darkgold-8", - "darkgold-9", - "darkgreen", - "darkgreen-3", - "darkgreen-4", - "darkgreen-5", - "darkgreen-6", - "darkgreen-7", - "darkgreen-8", - "darkgreen-9", - "darkmulti", - "darkmulti-3", - "darkmulti-4", - "darkmulti-5", - "darkmulti-6", - "darkmulti-7", - "darkmulti-8", - "darkmulti-9", - "darkred", - "darkred-3", - "darkred-4", - "darkred-5", - "darkred-6", - "darkred-7", - "darkred-8", - "darkred-9", - "lightgreyred", - "lightgreyred-3", - "lightgreyred-4", - "lightgreyred-5", - "lightgreyred-6", - "lightgreyred-7", - "lightgreyred-8", - "lightgreyred-9", - "lightgreyteal", - "lightgreyteal-3", - "lightgreyteal-4", - "lightgreyteal-5", - "lightgreyteal-6", - "lightgreyteal-7", - "lightgreyteal-8", - "lightgreyteal-9", - "lightmulti", - "lightmulti-3", - "lightmulti-4", - "lightmulti-5", - "lightmulti-6", - "lightmulti-7", - "lightmulti-8", - "lightmulti-9", - "lightorange", - "lightorange-3", - "lightorange-4", - "lightorange-5", - "lightorange-6", - "lightorange-7", - "lightorange-8", - "lightorange-9", - "lighttealblue", - "lighttealblue-3", - "lighttealblue-4", - "lighttealblue-5", - "lighttealblue-6", - "lighttealblue-7", - "lighttealblue-8", - "lighttealblue-9" - ], - "type": "string" - }, - "SequentialSingleHue": { - "enum": [ - "blues", - "tealblues", - "teals", - "greens", - "browns", - "greys", - "purples", - "warmgreys", - "reds", - "oranges" - ], - "type": "string" - }, - "ShapeDef": { - "$ref": "#/definitions/MarkPropDef<(string|null),TypeForShape>" - }, - "SharedEncoding": { - "additionalProperties": false, - "properties": { - "angle": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "color": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "description": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "string", - "null" - ] - } - }, - "type": "object" - }, - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/FieldDefWithoutScale" - }, - { - "items": { - "$ref": "#/definitions/FieldDefWithoutScale" - }, - "type": "array" - } - ], - "description": "Additional levels of detail for grouping data in aggregate views and\nin line, trail, and area marks without mapping data to a specific visual channel." - }, - "fill": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "fillOpacity": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "href": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "string", - "null" - ] - } - }, - "type": "object" - }, - "key": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "latitude": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation.", - "enum": [ - "quantitative" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "latitude2": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "longitude": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation.", - "enum": [ - "quantitative" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "longitude2": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "opacity": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "order": { - "anyOf": [ - { - "$ref": "#/definitions/OrderFieldDef" - }, - { - "items": { - "$ref": "#/definitions/OrderFieldDef" - }, - "type": "array" - }, - { - "$ref": "#/definitions/OrderValueDef" - } - ], - "description": "Order of the marks.\n- For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n- For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{\"value\": null}` makes the line marks use the original order in the data sources.\n- Otherwise, this `order` channel encodes layer order of the marks.\n\n__Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping." - }, - "radius": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "stack": { - "anyOf": [ - { - "$ref": "#/definitions/StackOffset" - }, - { - "type": "null" - }, - { - "type": "boolean" - } - ], - "description": "Type of stacking offset if the field should be stacked.\n`stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\nFor example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n\n`stack` can be one of the following values:\n- `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n- `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n-`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n- `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n\n__Default value:__ `zero` for plots with all of the following conditions are true:\n(1) the mark is `bar`, `area`, or `arc`;\n(2) the stacked measure channel (x or y) has a linear scale;\n(3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n\n__See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "radius2": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "shape": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/TypeForShape", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "string", - "null" - ] - } - }, - "type": "object" - }, - "size": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "stroke": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "strokeDash": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "items": { - "type": "number" - }, - "type": "array" - } - }, - "type": "object" - }, - "strokeOpacity": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "strokeWidth": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "legend": { - "anyOf": [ - { - "$ref": "#/definitions/Legend" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the legend.\nIf `null`, the legend for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n\n__See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "text": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalStringFieldDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "$ref": "#/definitions/Text", - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "theta": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "stack": { - "anyOf": [ - { - "$ref": "#/definitions/StackOffset" - }, - { - "type": "null" - }, - { - "type": "boolean" - } - ], - "description": "Type of stacking offset if the field should be stacked.\n`stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\nFor example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n\n`stack` can be one of the following values:\n- `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n- `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n-`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n- `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n\n__Default value:__ `zero` for plots with all of the following conditions are true:\n(1) the mark is `bar`, `area`, or `arc`;\n(2) the stacked measure channel (x or y) has a linear scale;\n(3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n\n__See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "theta2": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "tooltip": { - "anyOf": [ - { - "$ref": "#/definitions/StringFieldDefWithCondition" - }, - { - "$ref": "#/definitions/StringValueDefWithCondition" - }, - { - "items": { - "$ref": "#/definitions/StringFieldDef" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "description": "The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite." - }, - "url": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "condition": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - } - ], - "description": "One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n\n__Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\nsince Vega-Lite only allows at most one encoded field per encoding channel." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "string", - "null" - ] - } - }, - "type": "object" - }, - "x": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "axis": { - "anyOf": [ - { - "$ref": "#/definitions/Axis" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of axis's gridlines, ticks and labels.\nIf `null`, the axis for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n\n__See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "impute": { - "anyOf": [ - { - "$ref": "#/definitions/ImputeParams" - }, - { - "type": "null" - } - ], - "description": "An object defining the properties of the Impute Operation to be applied.\nThe field value of the other positional channel is taken as `key` of the `Impute` Operation.\nThe field of the `color` channel if specified is used as `groupby` of the `Impute` Operation.\n\n__See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "stack": { - "anyOf": [ - { - "$ref": "#/definitions/StackOffset" - }, - { - "type": "null" - }, - { - "type": "boolean" - } - ], - "description": "Type of stacking offset if the field should be stacked.\n`stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\nFor example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n\n`stack` can be one of the following values:\n- `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n- `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n-`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n- `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n\n__Default value:__ `zero` for plots with all of the following conditions are true:\n(1) the mark is `bar`, `area`, or `arc`;\n(2) the stacked measure channel (x or y) has a linear scale;\n(3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n\n__See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "x2": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "xError": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "xError2": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "y": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "axis": { - "anyOf": [ - { - "$ref": "#/definitions/Axis" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of axis's gridlines, ticks and labels.\nIf `null`, the axis for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n\n__See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "impute": { - "anyOf": [ - { - "$ref": "#/definitions/ImputeParams" - }, - { - "type": "null" - } - ], - "description": "An object defining the properties of the Impute Operation to be applied.\nThe field value of the other positional channel is taken as `key` of the `Impute` Operation.\nThe field of the `color` channel if specified is used as `groupby` of the `Impute` Operation.\n\n__See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation." - }, - "scale": { - "anyOf": [ - { - "$ref": "#/definitions/Scale" - }, - { - "type": "null" - } - ], - "description": "An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n\nIf `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n\n__Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n\n__See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation." - }, - "sort": { - "$ref": "#/definitions/Sort", - "description": "Sort order for the encoded field.\n\nFor continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n\nFor discrete fields, `sort` can be one of the following:\n- `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n- [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n- [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n- [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n- `null` indicating no sort.\n\n__Default value:__ `\"ascending\"`\n\n__Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n\n__See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation." - }, - "stack": { - "anyOf": [ - { - "$ref": "#/definitions/StackOffset" - }, - { - "type": "null" - }, - { - "type": "boolean" - } - ], - "description": "Type of stacking offset if the field should be stacked.\n`stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\nFor example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n\n`stack` can be one of the following values:\n- `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n- `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n-`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n- `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n\n__Default value:__ `zero` for plots with all of the following conditions are true:\n(1) the mark is `bar`, `area`, or `arc`;\n(2) the stacked measure channel (x or y) has a linear scale;\n(3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n\n__See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - ], - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "y2": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "datum": { - "anyOf": [ - { - "$ref": "#/definitions/PrimitiveValue" - }, - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/RepeatRef" - } - ], - "description": "A constant value in data domain." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/Type", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "yError": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "yError2": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.", - "type": "null" - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "SingleDefUnitChannel": { - "enum": [ - "x", - "y", - "x2", - "y2", - "longitude", - "latitude", - "longitude2", - "latitude2", - "theta", - "theta2", - "radius", - "radius2", - "color", - "fill", - "stroke", - "opacity", - "fillOpacity", - "strokeOpacity", - "strokeWidth", - "strokeDash", - "size", - "angle", - "shape", - "key", - "text", - "href", - "url", - "description" - ], - "type": "string" - }, - "SingleSelection": { - "additionalProperties": false, - "properties": { - "bind": { - "anyOf": [ - { - "$ref": "#/definitions/Binding" - }, - { - "additionalProperties": { - "$ref": "#/definitions/Binding" - }, - "type": "object" - }, - { - "$ref": "#/definitions/LegendBinding" - } - ], - "description": "When set, a selection is populated by input elements (also known as dynamic query widgets)\nor by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\nto re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n\nLegend bindings are restricted to selections that only specify a single field or encoding.\n\nQuery widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind)\nor can be a mapping between projected field/encodings and binding definitions.\n\n__See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation." - }, - "clear": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ], - "description": "Clears the selection, emptying it of all values. Can be a\n[Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n\n__Default value:__ `dblclick`.\n\n__See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation." - }, - "empty": { - "description": "By default, `all` data values are considered to lie within an empty selection.\nWhen set to `none`, empty selections contain no data values.", - "enum": [ - "all", - "none" - ], - "type": "string" - }, - "encodings": { - "description": "An array of encoding channels. The corresponding data field values\nmust match for a data tuple to fall within the selection.\n\n__See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/SingleDefUnitChannel" - }, - "type": "array" - }, - "fields": { - "description": "An array of field names whose values must match for a data tuple to\nfall within the selection.\n\n__See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "init": { - "$ref": "#/definitions/SelectionInitMapping", - "description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and initial values.\n\n__See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation." - }, - "nearest": { - "description": "When true, an invisible voronoi diagram is computed to accelerate discrete\nselection. The data value _nearest_ the mouse cursor is added to the selection.\n\n__See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.", - "type": "boolean" - }, - "on": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - } - ], - "description": "A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\nFor interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters)." - }, - "resolve": { - "$ref": "#/definitions/SelectionResolution", - "description": "With layered and multi-view displays, a strategy that determines how\nselections' data queries are resolved when applied in a filter transform,\nconditional encoding rule, or scale domain.\n\n__See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation." - }, - "type": { - "description": "Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types:\n\n- `\"single\"` -- to select a single discrete data value on `click`.\n- `\"multi\"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`.\n- `\"interval\"` -- to select a continuous range of data values on `drag`.", - "enum": [ - "single" - ], - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "SingleSelectionConfig": { - "additionalProperties": false, - "properties": { - "bind": { - "anyOf": [ - { - "$ref": "#/definitions/Binding" - }, - { - "additionalProperties": { - "$ref": "#/definitions/Binding" - }, - "type": "object" - }, - { - "$ref": "#/definitions/LegendBinding" - } - ], - "description": "When set, a selection is populated by input elements (also known as dynamic query widgets)\nor by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\nto re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n\nLegend bindings are restricted to selections that only specify a single field or encoding.\n\nQuery widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind)\nor can be a mapping between projected field/encodings and binding definitions.\n\n__See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation." - }, - "clear": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ], - "description": "Clears the selection, emptying it of all values. Can be a\n[Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n\n__Default value:__ `dblclick`.\n\n__See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation." - }, - "empty": { - "description": "By default, `all` data values are considered to lie within an empty selection.\nWhen set to `none`, empty selections contain no data values.", - "enum": [ - "all", - "none" - ], - "type": "string" - }, - "encodings": { - "description": "An array of encoding channels. The corresponding data field values\nmust match for a data tuple to fall within the selection.\n\n__See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/SingleDefUnitChannel" - }, - "type": "array" - }, - "fields": { - "description": "An array of field names whose values must match for a data tuple to\nfall within the selection.\n\n__See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "init": { - "$ref": "#/definitions/SelectionInitMapping", - "description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and initial values.\n\n__See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation." - }, - "nearest": { - "description": "When true, an invisible voronoi diagram is computed to accelerate discrete\nselection. The data value _nearest_ the mouse cursor is added to the selection.\n\n__See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.", - "type": "boolean" - }, - "on": { - "anyOf": [ - { - "$ref": "#/definitions/Stream" - }, - { - "type": "string" - } - ], - "description": "A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\nFor interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters)." - }, - "resolve": { - "$ref": "#/definitions/SelectionResolution", - "description": "With layered and multi-view displays, a strategy that determines how\nselections' data queries are resolved when applied in a filter transform,\nconditional encoding rule, or scale domain.\n\n__See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation." - } - }, - "type": "object" - }, - "SingleTimeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/LocalSingleTimeUnit" - }, - { - "$ref": "#/definitions/UtcSingleTimeUnit" - } - ] - }, - "Sort": { - "anyOf": [ - { - "$ref": "#/definitions/SortArray" - }, - { - "$ref": "#/definitions/AllSortString" - }, - { - "$ref": "#/definitions/EncodingSortField" - }, - { - "$ref": "#/definitions/SortByEncoding" - }, - { - "type": "null" - } - ] - }, - "SortArray": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "items": { - "type": "boolean" - }, - "type": "array" - }, - { - "items": { - "$ref": "#/definitions/DateTime" - }, - "type": "array" - } - ] - }, - "SortByChannel": { - "enum": [ - "x", - "y", - "color", - "fill", - "stroke", - "strokeWidth", - "size", - "shape", - "fillOpacity", - "strokeOpacity", - "opacity", - "text" - ], - "type": "string" - }, - "SortByChannelDesc": { - "enum": [ - "-x", - "-y", - "-color", - "-fill", - "-stroke", - "-strokeWidth", - "-size", - "-shape", - "-fillOpacity", - "-strokeOpacity", - "-opacity", - "-text" - ], - "type": "string" - }, - "SortByEncoding": { - "additionalProperties": false, - "properties": { - "encoding": { - "$ref": "#/definitions/SortByChannel", - "description": "The [encoding channel](https://vega.github.io/vega-lite/docs/encoding.html#channels) to sort by (e.g., `\"x\"`, `\"y\"`)" - }, - "order": { - "anyOf": [ - { - "$ref": "#/definitions/SortOrder" - }, - { - "type": "null" - } - ], - "description": "The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort)." - } - }, - "required": [ - "encoding" - ], - "type": "object" - }, - "SortField": { - "additionalProperties": false, - "description": "A sort definition for transform", - "properties": { - "field": { - "$ref": "#/definitions/FieldName", - "description": "The name of the field to sort." - }, - "order": { - "anyOf": [ - { - "$ref": "#/definitions/SortOrder" - }, - { - "type": "null" - } - ], - "description": "Whether to sort the field in ascending or descending order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort)." - } - }, - "required": [ - "field" - ], - "type": "object" - }, - "SortOrder": { - "enum": [ - "ascending", - "descending" - ], - "type": "string" - }, - "SphereGenerator": { - "additionalProperties": false, - "properties": { - "name": { - "description": "Provide a placeholder name and bind data at runtime.", - "type": "string" - }, - "sphere": { - "anyOf": [ - { - "enum": [ - true - ], - "type": "boolean" - }, - { - "additionalProperties": false, - "type": "object" - } - ], - "description": "Generate sphere GeoJSON data for the full globe." - } - }, - "required": [ - "sphere" - ], - "type": "object" - }, - "StackOffset": { - "enum": [ - "zero", - "center", - "normalize" - ], - "type": "string" - }, - "StackTransform": { - "additionalProperties": false, - "properties": { - "as": { - "anyOf": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "items": [ - { - "$ref": "#/definitions/FieldName" - }, - { - "$ref": "#/definitions/FieldName" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - } - ], - "description": "Output field names. This can be either a string or an array of strings with two elements denoting the name for the fields for stack start and stack end respectively.\nIf a single string(e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`." - }, - "groupby": { - "description": "The data fields to group by.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "offset": { - "description": "Mode for stacking marks. One of `\"zero\"` (default), `\"center\"`, or `\"normalize\"`.\nThe `\"zero\"` offset will stack starting at `0`. The `\"center\"` offset will center the stacks. The `\"normalize\"` offset will compute percentage values for each stack point, with output values in the range `[0,1]`.\n\n__Default value:__ `\"zero\"`", - "enum": [ - "zero", - "center", - "normalize" - ], - "type": "string" - }, - "sort": { - "description": "Field that determines the order of leaves in the stacked charts.", - "items": { - "$ref": "#/definitions/SortField" - }, - "type": "array" - }, - "stack": { - "$ref": "#/definitions/FieldName", - "description": "The field which is stacked." - } - }, - "required": [ - "stack", - "groupby", - "as" - ], - "type": "object" - }, - "StandardType": { - "enum": [ - "quantitative", - "ordinal", - "temporal", - "nominal" - ], - "type": "string" - }, - "Step": { - "additionalProperties": false, - "properties": { - "step": { - "description": "The size (width/height) per discrete step.", - "type": "number" - } - }, - "required": [ - "step" - ], - "type": "object" - }, - "Stream": { - "anyOf": [ - { - "$ref": "#/definitions/EventStream" - }, - { - "$ref": "#/definitions/DerivedStream" - }, - { - "$ref": "#/definitions/MergedStream" - } - ] - }, - "StringFieldDef": { - "additionalProperties": false, - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/Dict" - } - ], - "description": "When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n\n- If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n- If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n\nSee the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n\nWhen used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n\n__Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format." - }, - "formatType": { - "description": "The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n\n__Default value:__\n- `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n- `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.", - "type": "string" - }, - "labelExpr": { - "description": "[Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n\n__Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.", - "type": "string" - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "StringFieldDefWithCondition": { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - "StringValueDefWithCondition": { - "$ref": "#/definitions/ValueDefWithCondition" - }, - "StrokeCap": { - "enum": [ - "butt", - "round", - "square" - ], - "type": "string" - }, - "StrokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "type": "string" - }, - "StyleConfigIndex": { - "additionalProperties": { - "anyOf": [ - { - "$ref": "#/definitions/AnyMarkConfig" - }, - { - "$ref": "#/definitions/Axis" - } - ] - }, - "properties": { - "arc": { - "$ref": "#/definitions/RectConfig", - "description": "Arc-specific Config" - }, - "area": { - "$ref": "#/definitions/AreaConfig", - "description": "Area-Specific Config" - }, - "bar": { - "$ref": "#/definitions/BarConfig", - "description": "Bar-Specific Config" - }, - "circle": { - "$ref": "#/definitions/MarkConfig", - "description": "Circle-Specific Config" - }, - "geoshape": { - "$ref": "#/definitions/MarkConfig", - "description": "Geoshape-Specific Config" - }, - "group-subtitle": { - "$ref": "#/definitions/MarkConfig", - "description": "Default style for chart subtitles" - }, - "group-title": { - "$ref": "#/definitions/MarkConfig", - "description": "Default style for chart titles" - }, - "guide-label": { - "$ref": "#/definitions/MarkConfig", - "description": "Default style for axis, legend, and header labels." - }, - "guide-title": { - "$ref": "#/definitions/MarkConfig", - "description": "Default style for axis, legend, and header titles." - }, - "image": { - "$ref": "#/definitions/RectConfig", - "description": "Image-specific Config" - }, - "line": { - "$ref": "#/definitions/LineConfig", - "description": "Line-Specific Config" - }, - "mark": { - "$ref": "#/definitions/MarkConfig", - "description": "Mark Config" - }, - "point": { - "$ref": "#/definitions/MarkConfig", - "description": "Point-Specific Config" - }, - "rect": { - "$ref": "#/definitions/RectConfig", - "description": "Rect-Specific Config" - }, - "rule": { - "$ref": "#/definitions/MarkConfig", - "description": "Rule-Specific Config" - }, - "square": { - "$ref": "#/definitions/MarkConfig", - "description": "Square-Specific Config" - }, - "text": { - "$ref": "#/definitions/MarkConfig", - "description": "Text-Specific Config" - }, - "tick": { - "$ref": "#/definitions/TickConfig", - "description": "Tick-Specific Config" - }, - "trail": { - "$ref": "#/definitions/LineConfig", - "description": "Trail-Specific Config" - } - }, - "type": "object" - }, - "SymbolShape": { - "type": "string" - }, - "Text": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ] - }, - "TextBaseline": { - "anyOf": [ - { - "enum": [ - "alphabetic" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Baseline" - }, - { - "enum": [ - "line-top" - ], - "type": "string" - }, - { - "enum": [ - "line-bottom" - ], - "type": "string" - } - ] - }, - "TextDef": { - "anyOf": [ - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - { - "$ref": "#/definitions/FieldOrDatumDefWithCondition" - }, - { - "$ref": "#/definitions/ValueDefWithCondition" - } - ] - }, - "TextDirection": { - "enum": [ - "ltr", - "rtl" - ], - "type": "string" - }, - "TickConfig": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`." - }, - "angle": { - "description": "The rotation angle of the text, in degrees.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree.", - "type": "boolean" - }, - "ariaRole": { - "description": "Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"role\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "ariaRoleDescription": { - "description": "A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the \"aria-roledescription\" attribute.\nWarning: this property is experimental and may be changed in the future.", - "type": "string" - }, - "aspect": { - "description": "Whether to keep aspect ratio of image marks.", - "type": "boolean" - }, - "bandSize": { - "description": "The width of the ticks.\n\n__Default value:__ 3/4 of step (width step for horizontal ticks and height step for vertical ticks).", - "minimum": 0, - "type": "number" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone." - }, - "blend": { - "$ref": "#/definitions/Blend", - "description": "The color blend mode for drawing an item on its current background. Any valid [CSS mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) value can be used.\n\n__Default value: `\"source-over\"`" - }, - "color": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - } - ], - "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." - }, - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomLeft": { - "description": "The radius in pixels of rounded rectangles' bottom left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusBottomRight": { - "description": "The radius in pixels of rounded rectangles' bottom right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopLeft": { - "description": "The radius in pixels of rounded rectangles' top right corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cornerRadiusTopRight": { - "description": "The radius in pixels of rounded rectangles' top left corner.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "description": { - "description": "A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only).\nIf specified, this property determines the [\"aria-label\" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute).", - "type": "string" - }, - "dir": { - "$ref": "#/definitions/TextDirection", - "description": "The direction of the text. One of `\"ltr\"` (left-to-right) or `\"rtl\"` (right-to-left). This property determines on which side is truncated in response to the limit parameter.\n\n__Default value:__ `\"ltr\"`" - }, - "dx": { - "description": "The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "dy": { - "description": "The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "ellipsis": { - "description": "The ellipsis string for text truncated in response to the limit parameter.\n\n__Default value:__ `\"…\"`", - "type": "string" - }, - "endAngle": { - "description": "The end angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n\n__Default value:__ (None)" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "filled": { - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n\n__Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).", - "type": "boolean" - }, - "font": { - "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "fontSize": { - "description": "The font size, in pixels.\n\n__Default value:__ `11`", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style (e.g., `\"italic\"`)." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "height": { - "description": "Height of the marks.", - "type": "number" - }, - "href": { - "description": "A URL to load upon mouse click. If defined, the mark acts as a hyperlink.", - "format": "uri", - "type": "string" - }, - "innerRadius": { - "description": "The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.", - "type": "number" - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method to use for line and area marks. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"step-before\"`: alternate between vertical and horizontal segments, as in a step function.\n- `\"step-after\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null - ], - "type": [ - "string", - "null" - ] - }, - "limit": { - "description": "The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n\n__Default value:__ `0` -- indicating no limit", - "type": "number" - }, - "lineBreak": { - "description": "A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property is ignored if the text is array-valued.", - "type": "string" - }, - "lineHeight": { - "description": "The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "order": { - "description": "For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.", - "type": [ - "null", - "boolean" - ] - }, - "orient": { - "$ref": "#/definitions/Orientation", - "description": "The orientation of a non-stacked bar, tick, area, and line charts.\nThe value is either horizontal (default) or vertical.\n- For bar, rule and tick, this determines whether the size of the bar and tick\nshould be applied to x or y dimension.\n- For area, this property determines the orient property of the Vega output.\n- For line and trail marks, this property determines the sort order of the points in the line\nif `config.sortLineBy` is not specified.\nFor stacked charts, this is always determined by the orientation of the stack;\ntherefore explicitly specified value will be ignored." - }, - "outerRadius": { - "description": "The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.", - "type": "number" - }, - "padAngle": { - "description": "The angular padding applied to sides of the arc, in radians.", - "type": "number" - }, - "radius": { - "description": "For arc mark, the primary (outer) radius in pixels.\n\nFor text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.", - "type": "number" - }, - "radius2": { - "description": "The secondary (inner) radius in pixels of arc marks.", - "type": "number" - }, - "shape": { - "anyOf": [ - { - "$ref": "#/definitions/SymbolShape" - }, - { - "type": "string" - } - ], - "description": "Shape of the point marks. Supported values include:\n- plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n- the line symbol `\"stroke\"`\n- centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n- a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n__Default value:__ `\"circle\"`" - }, - "size": { - "description": "Default size for marks.\n- For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n- For `bar`, this represents the band size of the bar, in pixels.\n- For `text`, this represents the font size, in pixels.\n\n__Default value:__\n- `30` for point, circle, square marks; width/height's `step`\n- `2` for bar marks with discrete dimensions;\n- `5` for bar marks with continuous dimensions;\n- `11` for text marks.", - "minimum": 0, - "type": "number" - }, - "startAngle": { - "description": "The start angle in radians for arc marks.\nA value of `0` indicates up (north), increasing values proceed clockwise.", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "null" - } - ], - "description": "Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n\n__Default value:__ (None)" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOffset": { - "description": "The offset in pixels at which to draw the group stroke and fill. If unspecified, the default behavior is to dynamically offset stroked groups such that 1 pixel stroke widths align with the pixel grid.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "tension": { - "description": "Depending on the interpolation type, sets the tension parameter (for line and area marks).", - "type": "number" - }, - "text": { - "$ref": "#/definitions/Text", - "description": "Placeholder text if the `text` channel is not specified" - }, - "theta": { - "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "theta2": { - "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.", - "type": "number" - }, - "thickness": { - "description": "Thickness of the tick mark.\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\nIf set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, - "timeUnitBandPosition": { - "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\nIf set to `0.5`, the marks will be positioned in the middle of the time unit band step.", - "type": "number" - }, - "tooltip": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "$ref": "#/definitions/TooltipContent" - }, - { - "type": "null" - } - ], - "description": "The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n\n- If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n- If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n- If set to `null` or `false`, then no tooltip will be used.\n\nSee the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n\n__Default value:__ `null`" - }, - "width": { - "description": "Width of the marks.", - "type": "number" - }, - "x": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "x2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - } - ], - "description": "X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." - }, - "y": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - }, - "y2": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." - } - }, - "type": "object" - }, - "TickCount": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/TimeInterval" - }, - { - "$ref": "#/definitions/TimeIntervalStep" - } - ] - }, - "TimeInterval": { - "enum": [ - "millisecond", - "second", - "minute", - "hour", - "day", - "week", - "month", - "year" - ], - "type": "string" - }, - "TimeIntervalStep": { - "additionalProperties": false, - "properties": { - "interval": { - "$ref": "#/definitions/TimeInterval" - }, - "step": { - "type": "number" - } - }, - "required": [ - "interval", - "step" - ], - "type": "object" - }, - "TimeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/SingleTimeUnit" - }, - { - "$ref": "#/definitions/MultiTimeUnit" - } - ] - }, - "TimeUnitParams": { - "additionalProperties": false, - "properties": { - "maxbins": { - "description": "If no `unit` is specified, maxbins is used to infer time units.", - "type": "number" - }, - "step": { - "description": "The number of steps between bins, in terms of the least\nsignificant unit provided.", - "type": "number" - }, - "unit": { - "$ref": "#/definitions/TimeUnit", - "description": "Defines how date-time values should be binned." - }, - "utc": { - "description": "True to use UTC timezone. Equivalent to using a `utc` prefixed `TimeUnit`.", - "type": "boolean" - } - }, - "type": "object" - }, - "TimeUnitTransform": { - "additionalProperties": false, - "properties": { - "as": { - "$ref": "#/definitions/FieldName", - "description": "The output field to write the timeUnit value." - }, - "field": { - "$ref": "#/definitions/FieldName", - "description": "The data field to apply time unit." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "The timeUnit." - } - }, - "required": [ - "timeUnit", - "field", - "as" - ], - "type": "object" - }, - "TitleAnchor": { - "enum": [ - null, - "start", - "middle", - "end" - ], - "type": [ - "null", - "string" - ] - }, - "TitleConfig": { - "$ref": "#/definitions/BaseTitleNoValueRefs" - }, - "TitleFrame": { - "enum": [ - "bounds", - "group" - ], - "type": "string" - }, - "TitleOrient": { - "enum": [ - "none", - "left", - "right", - "top", - "bottom" - ], - "type": "string" - }, - "TitleParams": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/Align", - "description": "Horizontal text alignment for title text. One of `\"left\"`, `\"center\"`, or `\"right\"`." - }, - "anchor": { - "$ref": "#/definitions/TitleAnchor", - "description": "The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.\n\n__Default value:__ `\"middle\"` for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views.\n`\"start\"` for other composite views.\n\n__Note:__ [For now](https://github.com/vega/vega-lite/issues/2875), `anchor` is only customizable only for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. For other composite views, `anchor` is always `\"start\"`." - }, - "angle": { - "description": "Angle in degrees of title and subtitle text.", - "type": "number" - }, - "aria": { - "description": "A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only).\nIf `false`, the \"aria-hidden\" attribute will be set on the output SVG group, removing the title from the ARIA accessibility tree.\n\n__Default value:__ `true`", - "type": "boolean" - }, - "baseline": { - "$ref": "#/definitions/TextBaseline", - "description": "Vertical text baseline for title and subtitle text. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone." - }, - "color": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Text color for title text." - }, - "dx": { - "description": "Delta offset for title and subtitle text x-coordinate.", - "type": "number" - }, - "dy": { - "description": "Delta offset for title and subtitle text y-coordinate.", - "type": "number" - }, - "font": { - "description": "Font name for title text.", - "type": "string" - }, - "fontSize": { - "description": "Font size in pixels for title text.", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "Font style for title text." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "Font weight for title text.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "frame": { - "anyOf": [ - { - "$ref": "#/definitions/TitleFrame" - }, - { - "type": "string" - } - ], - "description": "The reference frame for the anchor position, one of `\"bounds\"` (to anchor relative to the full bounding box) or `\"group\"` (to anchor relative to the group width or height)." - }, - "limit": { - "description": "The maximum allowed length in pixels of title and subtitle text.", - "minimum": 0, - "type": "number" - }, - "lineHeight": { - "description": "Line height in pixels for multi-line title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.", - "type": "number" - }, - "offset": { - "description": "The orthogonal offset in pixels by which to displace the title group from its position along the edge of the chart.", - "type": "number" - }, - "orient": { - "$ref": "#/definitions/TitleOrient", - "description": "Default title orientation (`\"top\"`, `\"bottom\"`, `\"left\"`, or `\"right\"`)" - }, - "style": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "A [mark style property](https://vega.github.io/vega-lite/docs/config.html#style) to apply to the title text mark.\n\n__Default value:__ `\"group-title\"`." - }, - "subtitle": { - "$ref": "#/definitions/Text", - "description": "The subtitle Text." - }, - "subtitleColor": { - "anyOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/Color" - } - ], - "description": "Text color for subtitle text." - }, - "subtitleFont": { - "description": "Font name for subtitle text.", - "type": "string" - }, - "subtitleFontSize": { - "description": "Font size in pixels for subtitle text.", - "minimum": 0, - "type": "number" - }, - "subtitleFontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "Font style for subtitle text." - }, - "subtitleFontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "Font weight for subtitle text.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "subtitleLineHeight": { - "description": "Line height in pixels for multi-line subtitle text.", - "type": "number" - }, - "subtitlePadding": { - "description": "The padding in pixels between title and subtitle text.", - "type": "number" - }, - "text": { - "$ref": "#/definitions/Text", - "description": "The title text." - }, - "zindex": { - "description": "The integer z-index indicating the layering of the title group relative to other axis, mark and legend groups.\n\n__Default value:__ `0`.", - "minimum": 0, - "type": "number" - } - }, - "required": [ - "text" - ], - "type": "object" - }, - "TooltipContent": { - "additionalProperties": false, - "properties": { - "content": { - "enum": [ - "encoding", - "data" - ], - "type": "string" - } - }, - "required": [ - "content" - ], - "type": "object" - }, - "TopLevelNormalizedConcatSpec": { - "additionalProperties": false, - "properties": { - "$schema": { - "description": "URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.", - "format": "uri", - "type": "string" - }, - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "autosize": { - "anyOf": [ - { - "$ref": "#/definitions/AutosizeType" - }, - { - "$ref": "#/definitions/AutoSizeParams" - } - ], - "description": "How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\nObject values can additionally specify parameters for content sizing and automatic resizing.\n\n__Default value__: `pad`" - }, - "background": { - "$ref": "#/definitions/Color", - "description": "CSS color property to use as the background of the entire view.\n\n__Default value:__ `\"white\"`" - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "concat": { - "description": "A list of views to be concatenated.", - "items": { - "$ref": "#/definitions/NormalizedSpec" - }, - "type": "array" - }, - "config": { - "$ref": "#/definitions/Config", - "description": "Vega-Lite configuration object. This property can only be defined at the top-level of a specification." - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "datasets": { - "$ref": "#/definitions/Datasets", - "description": "A global data store for named datasets. This is a mapping from names to inline datasets.\nThis can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "padding": { - "$ref": "#/definitions/Padding", - "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\nIf an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "usermeta": { - "$ref": "#/definitions/Dict", - "description": "Optional metadata that will be passed to Vega.\nThis object is completely ignored by Vega and Vega-Lite and can be used for custom metadata." - } - }, - "required": [ - "concat" - ], - "type": "object" - }, - "TopLevelNormalizedHConcatSpec": { - "additionalProperties": false, - "properties": { - "$schema": { - "description": "URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.", - "format": "uri", - "type": "string" - }, - "autosize": { - "anyOf": [ - { - "$ref": "#/definitions/AutosizeType" - }, - { - "$ref": "#/definitions/AutoSizeParams" - } - ], - "description": "How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\nObject values can additionally specify parameters for content sizing and automatic resizing.\n\n__Default value__: `pad`" - }, - "background": { - "$ref": "#/definitions/Color", - "description": "CSS color property to use as the background of the entire view.\n\n__Default value:__ `\"white\"`" - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\n__Default value:__ `false`", - "type": "boolean" - }, - "config": { - "$ref": "#/definitions/Config", - "description": "Vega-Lite configuration object. This property can only be defined at the top-level of a specification." - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "datasets": { - "$ref": "#/definitions/Datasets", - "description": "A global data store for named datasets. This is a mapping from names to inline datasets.\nThis can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "hconcat": { - "description": "A list of views to be concatenated and put into a row.", - "items": { - "$ref": "#/definitions/NormalizedSpec" - }, - "type": "array" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "padding": { - "$ref": "#/definitions/Padding", - "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\nIf an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "description": "The spacing in pixels between sub-views of the concat operator.\n\n__Default value__: `10`", - "type": "number" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "usermeta": { - "$ref": "#/definitions/Dict", - "description": "Optional metadata that will be passed to Vega.\nThis object is completely ignored by Vega and Vega-Lite and can be used for custom metadata." - } - }, - "required": [ - "hconcat" - ], - "type": "object" - }, - "TopLevelNormalizedVConcatSpec": { - "additionalProperties": false, - "properties": { - "$schema": { - "description": "URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.", - "format": "uri", - "type": "string" - }, - "autosize": { - "anyOf": [ - { - "$ref": "#/definitions/AutosizeType" - }, - { - "$ref": "#/definitions/AutoSizeParams" - } - ], - "description": "How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\nObject values can additionally specify parameters for content sizing and automatic resizing.\n\n__Default value__: `pad`" - }, - "background": { - "$ref": "#/definitions/Color", - "description": "CSS color property to use as the background of the entire view.\n\n__Default value:__ `\"white\"`" - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\n__Default value:__ `false`", - "type": "boolean" - }, - "config": { - "$ref": "#/definitions/Config", - "description": "Vega-Lite configuration object. This property can only be defined at the top-level of a specification." - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "datasets": { - "$ref": "#/definitions/Datasets", - "description": "A global data store for named datasets. This is a mapping from names to inline datasets.\nThis can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "padding": { - "$ref": "#/definitions/Padding", - "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\nIf an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "description": "The spacing in pixels between sub-views of the concat operator.\n\n__Default value__: `10`", - "type": "number" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "usermeta": { - "$ref": "#/definitions/Dict", - "description": "Optional metadata that will be passed to Vega.\nThis object is completely ignored by Vega and Vega-Lite and can be used for custom metadata." - }, - "vconcat": { - "description": "A list of views to be concatenated and put into a column.", - "items": { - "$ref": "#/definitions/NormalizedSpec" - }, - "type": "array" - } - }, - "required": [ - "vconcat" - ], - "type": "object" - }, - "TopLevelLayerSpec": { - "additionalProperties": false, - "properties": { - "$schema": { - "description": "URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.", - "format": "uri", - "type": "string" - }, - "autosize": { - "anyOf": [ - { - "$ref": "#/definitions/AutosizeType" - }, - { - "$ref": "#/definitions/AutoSizeParams" - } - ], - "description": "How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\nObject values can additionally specify parameters for content sizing and automatic resizing.\n\n__Default value__: `pad`" - }, - "background": { - "$ref": "#/definitions/Color", - "description": "CSS color property to use as the background of the entire view.\n\n__Default value:__ `\"white\"`" - }, - "config": { - "$ref": "#/definitions/Config", - "description": "Vega-Lite configuration object. This property can only be defined at the top-level of a specification." - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "datasets": { - "$ref": "#/definitions/Datasets", - "description": "A global data store for named datasets. This is a mapping from names to inline datasets.\nThis can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "encoding": { - "$ref": "#/definitions/SharedEncoding", - "description": "A shared key-value mapping between encoding channels and definition of fields in the underlying layers." - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The height of a visualization.\n\n- For a plot with a continuous y-field, height should be a number.\n- For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.)\n- To enable responsive sizing on height, it should be set to `\"container\"`.\n\n__Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation." - }, - "layer": { - "description": "Layer or single view specifications to be layered.\n\n__Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/LayerSpec" - }, - { - "$ref": "#/definitions/UnitSpec" - } - ] - }, - "type": "array" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "padding": { - "$ref": "#/definitions/Padding", - "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\nIf an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" - }, - "projection": { - "$ref": "#/definitions/Projection", - "description": "An object defining properties of the geographic projection shared by underlying layers." - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "usermeta": { - "$ref": "#/definitions/Dict", - "description": "Optional metadata that will be passed to Vega.\nThis object is completely ignored by Vega and Vega-Lite and can be used for custom metadata." - }, - "view": { - "$ref": "#/definitions/ViewBackground", - "description": "An object defining the view background's fill and stroke.\n\n__Default value:__ none (transparent)" - }, - "width": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The width of a visualization.\n\n- For a plot with a continuous x-field, width should be a number.\n- For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.)\n- To enable responsive sizing on width, it should be set to `\"container\"`.\n\n__Default value:__\nBased on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation." - } - }, - "required": [ - "layer" - ], - "type": "object" - }, - "TopLevelRepeatSpec": { - "anyOf": [ - { - "additionalProperties": false, - "properties": { - "$schema": { - "description": "URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.", - "format": "uri", - "type": "string" - }, - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "autosize": { - "anyOf": [ - { - "$ref": "#/definitions/AutosizeType" - }, - { - "$ref": "#/definitions/AutoSizeParams" - } - ], - "description": "How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\nObject values can additionally specify parameters for content sizing and automatic resizing.\n\n__Default value__: `pad`" - }, - "background": { - "$ref": "#/definitions/Color", - "description": "CSS color property to use as the background of the entire view.\n\n__Default value:__ `\"white\"`" - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "config": { - "$ref": "#/definitions/Config", - "description": "Vega-Lite configuration object. This property can only be defined at the top-level of a specification." - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "datasets": { - "$ref": "#/definitions/Datasets", - "description": "A global data store for named datasets. This is a mapping from names to inline datasets.\nThis can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "padding": { - "$ref": "#/definitions/Padding", - "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\nIf an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" - }, - "repeat": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "$ref": "#/definitions/RepeatMapping" - } - ], - "description": "Definition for fields to be repeated. One of:\n1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively." - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "spec": { - "$ref": "#/definitions/Spec", - "description": "A specification of the view that gets repeated." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "usermeta": { - "$ref": "#/definitions/Dict", - "description": "Optional metadata that will be passed to Vega.\nThis object is completely ignored by Vega and Vega-Lite and can be used for custom metadata." - } - }, - "required": [ - "repeat", - "spec" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "$schema": { - "description": "URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.", - "format": "uri", - "type": "string" - }, - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "autosize": { - "anyOf": [ - { - "$ref": "#/definitions/AutosizeType" - }, - { - "$ref": "#/definitions/AutoSizeParams" - } - ], - "description": "How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\nObject values can additionally specify parameters for content sizing and automatic resizing.\n\n__Default value__: `pad`" - }, - "background": { - "$ref": "#/definitions/Color", - "description": "CSS color property to use as the background of the entire view.\n\n__Default value:__ `\"white\"`" - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "config": { - "$ref": "#/definitions/Config", - "description": "Vega-Lite configuration object. This property can only be defined at the top-level of a specification." - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "datasets": { - "$ref": "#/definitions/Datasets", - "description": "A global data store for named datasets. This is a mapping from names to inline datasets.\nThis can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "padding": { - "$ref": "#/definitions/Padding", - "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\nIf an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" - }, - "repeat": { - "$ref": "#/definitions/LayerRepeatMapping", - "description": "Definition for fields to be repeated. One of:\n1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively." - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "spec": { - "anyOf": [ - { - "$ref": "#/definitions/LayerSpec" - }, - { - "$ref": "#/definitions/UnitSpec" - } - ], - "description": "A specification of the view that gets repeated." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "usermeta": { - "$ref": "#/definitions/Dict", - "description": "Optional metadata that will be passed to Vega.\nThis object is completely ignored by Vega and Vega-Lite and can be used for custom metadata." - } - }, - "required": [ - "repeat", - "spec" - ], - "type": "object" - } - ] - }, - "TopLevelFacetSpec": { - "additionalProperties": false, - "properties": { - "$schema": { - "description": "URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.", - "format": "uri", - "type": "string" - }, - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "autosize": { - "anyOf": [ - { - "$ref": "#/definitions/AutosizeType" - }, - { - "$ref": "#/definitions/AutoSizeParams" - } - ], - "description": "How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\nObject values can additionally specify parameters for content sizing and automatic resizing.\n\n__Default value__: `pad`" - }, - "background": { - "$ref": "#/definitions/Color", - "description": "CSS color property to use as the background of the entire view.\n\n__Default value:__ `\"white\"`" - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "columns": { - "description": "The number of columns to include in the view composition layout.\n\n__Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n`hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n\n__Note__:\n\n1) This property is only for:\n- the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n- the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n\n2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).", - "type": "number" - }, - "config": { - "$ref": "#/definitions/Config", - "description": "Vega-Lite configuration object. This property can only be defined at the top-level of a specification." - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "datasets": { - "$ref": "#/definitions/Datasets", - "description": "A global data store for named datasets. This is a mapping from names to inline datasets.\nThis can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "facet": { - "anyOf": [ - { - "$ref": "#/definitions/FacetFieldDef" - }, - { - "$ref": "#/definitions/FacetMapping" - } - ], - "description": "Definition for how to facet the data. One of:\n1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def)\n2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping)" - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "padding": { - "$ref": "#/definitions/Padding", - "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\nIf an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "spec": { - "anyOf": [ - { - "$ref": "#/definitions/LayerSpec" - }, - { - "$ref": "#/definitions/UnitSpecWithFrame" - } - ], - "description": "A specification of the view that gets faceted." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "usermeta": { - "$ref": "#/definitions/Dict", - "description": "Optional metadata that will be passed to Vega.\nThis object is completely ignored by Vega and Vega-Lite and can be used for custom metadata." - } - }, - "required": [ - "data", - "facet", - "spec" - ], - "type": "object" - }, - "TopLevelSpec": { - "anyOf": [ - { - "$ref": "#/definitions/TopLevelUnitSpec" - }, - { - "$ref": "#/definitions/TopLevelFacetSpec" - }, - { - "$ref": "#/definitions/TopLevelLayerSpec" - }, - { - "$ref": "#/definitions/TopLevelRepeatSpec" - }, - { - "$ref": "#/definitions/TopLevelNormalizedConcatSpec" - }, - { - "$ref": "#/definitions/TopLevelNormalizedVConcatSpec" - }, - { - "$ref": "#/definitions/TopLevelNormalizedHConcatSpec" - } - ], - "description": "A Vega-Lite top-level specification.\nThis is the root class for all Vega-Lite specifications.\n(The json schema is generated from this type.)" - }, - "TopLevelUnitSpec": { - "additionalProperties": false, - "properties": { - "$schema": { - "description": "URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.", - "format": "uri", - "type": "string" - }, - "align": { - "anyOf": [ - { - "$ref": "#/definitions/LayoutAlign" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The alignment to apply to grid rows and columns.\nThe supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n- For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n- For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." - }, - "autosize": { - "anyOf": [ - { - "$ref": "#/definitions/AutosizeType" - }, - { - "$ref": "#/definitions/AutoSizeParams" - } - ], - "description": "How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\nObject values can additionally specify parameters for content sizing and automatic resizing.\n\n__Default value__: `pad`" - }, - "background": { - "$ref": "#/definitions/Color", - "description": "CSS color property to use as the background of the entire view.\n\n__Default value:__ `\"white\"`" - }, - "bounds": { - "description": "The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n\n- If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n- If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n\n__Default value:__ `\"full\"`", - "enum": [ - "full", - "flush" - ], - "type": "string" - }, - "center": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n\nAn object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n\n__Default value:__ `false`" - }, - "config": { - "$ref": "#/definitions/Config", - "description": "Vega-Lite configuration object. This property can only be defined at the top-level of a specification." - }, - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "datasets": { - "$ref": "#/definitions/Datasets", - "description": "A global data store for named datasets. This is a mapping from names to inline datasets.\nThis can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "encoding": { - "$ref": "#/definitions/FacetedEncoding", - "description": "A key-value mapping between encoding channels and definition of fields." - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The height of a visualization.\n\n- For a plot with a continuous y-field, height should be a number.\n- For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.)\n- To enable responsive sizing on height, it should be set to `\"container\"`.\n\n__Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation." - }, - "mark": { - "$ref": "#/definitions/AnyMark", - "description": "A string describing the mark type (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n`\"area\"`, `\"point\"`, `\"rule\"`, `\"geoshape\"`, and `\"text\"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def)." - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "padding": { - "$ref": "#/definitions/Padding", - "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\nIf an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" - }, - "projection": { - "$ref": "#/definitions/Projection", - "description": "An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks\nand to `latitude` and `\"longitude\"` channels for other marks." - }, - "resolve": { - "$ref": "#/definitions/Resolve", - "description": "Scale, axis, and legend resolutions for view composition specifications." - }, - "selection": { - "additionalProperties": { - "$ref": "#/definitions/SelectionDef" - }, - "description": "A key-value mapping between selection names and definitions.", - "type": "object" - }, - "spacing": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/definitions/RowCol" - } - ], - "description": "The spacing in pixels between sub-views of the composition operator.\nAn object of the form `{\"row\": number, \"column\": number}` can be used to set\ndifferent spacing values for rows and columns.\n\n__Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "usermeta": { - "$ref": "#/definitions/Dict", - "description": "Optional metadata that will be passed to Vega.\nThis object is completely ignored by Vega and Vega-Lite and can be used for custom metadata." - }, - "view": { - "$ref": "#/definitions/ViewBackground", - "description": "An object defining the view background's fill and stroke.\n\n__Default value:__ none (transparent)" - }, - "width": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The width of a visualization.\n\n- For a plot with a continuous x-field, width should be a number.\n- For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.)\n- To enable responsive sizing on width, it should be set to `\"container\"`.\n\n__Default value:__\nBased on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation." - } - }, - "required": [ - "data", - "mark" - ], - "type": "object" - }, - "TopoDataFormat": { - "additionalProperties": false, - "properties": { - "feature": { - "description": "The name of the TopoJSON object set to convert to a GeoJSON feature collection.\nFor example, in a map of the world, there may be an object set named `\"countries\"`.\nUsing the feature property, we can extract this set and generate a GeoJSON feature object for each country.", - "type": "string" - }, - "mesh": { - "description": "The name of the TopoJSON object set to convert to mesh.\nSimilar to the `feature` option, `mesh` extracts a named TopoJSON object set.\n Unlike the `feature` option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features.\nExtracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties.", - "type": "string" - }, - "parse": { - "anyOf": [ - { - "$ref": "#/definitions/Parse" - }, - { - "type": "null" - } - ], - "description": "If set to `null`, disable type inference based on the spec and only use type inference based on the data.\nAlternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `\"number\"`, `\"boolean\"`, `\"date\"`, or null (do not parse the field)).\nFor example, `\"parse\": {\"modified_on\": \"date\"}` parses the `modified_on` field in each input record a Date value.\n\nFor `\"date\"`, we parse data based using Javascript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).\nFor Specific date formats can be provided (e.g., `{foo: \"date:'%m%d%Y'\"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: \"utc:'%m%d%Y'\"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc)" - }, - "type": { - "description": "Type of input data: `\"json\"`, `\"csv\"`, `\"tsv\"`, `\"dsv\"`.\n\n__Default value:__ The default format type is determined by the extension of the file URL.\nIf no extension is detected, `\"json\"` will be used by default.", - "enum": [ - "topojson" - ], - "type": "string" - } - }, - "type": "object" - }, - "Transform": { - "anyOf": [ - { - "$ref": "#/definitions/AggregateTransform" - }, - { - "$ref": "#/definitions/BinTransform" - }, - { - "$ref": "#/definitions/CalculateTransform" - }, - { - "$ref": "#/definitions/DensityTransform" - }, - { - "$ref": "#/definitions/FilterTransform" - }, - { - "$ref": "#/definitions/FlattenTransform" - }, - { - "$ref": "#/definitions/FoldTransform" - }, - { - "$ref": "#/definitions/ImputeTransform" - }, - { - "$ref": "#/definitions/JoinAggregateTransform" - }, - { - "$ref": "#/definitions/LoessTransform" - }, - { - "$ref": "#/definitions/LookupTransform" - }, - { - "$ref": "#/definitions/QuantileTransform" - }, - { - "$ref": "#/definitions/RegressionTransform" - }, - { - "$ref": "#/definitions/TimeUnitTransform" - }, - { - "$ref": "#/definitions/SampleTransform" - }, - { - "$ref": "#/definitions/StackTransform" - }, - { - "$ref": "#/definitions/WindowTransform" - }, - { - "$ref": "#/definitions/PivotTransform" - } - ] - }, - "Type": { - "description": "Data type based on level of measurement", - "enum": [ - "quantitative", - "ordinal", - "temporal", - "nominal", - "geojson" - ], - "type": "string" - }, - "TypeForShape": { - "enum": [ - "nominal", - "ordinal", - "geojson" - ], - "type": "string" - }, - "TypedFieldDef": { - "additionalProperties": false, - "description": "Definition object for a data field, its type and transformation of an encoding channel.", - "properties": { - "aggregate": { - "$ref": "#/definitions/Aggregate", - "description": "Aggregation function for the field\n(e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." - }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "bin": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/BinParams" - }, - { - "enum": [ - "binned" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n\n- If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n\n- If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n\n__Default value:__ `false`\n\n__See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation." - }, - "field": { - "$ref": "#/definitions/Field", - "description": "__Required.__ A string defining the name of the field from which to pull a data value\nor an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__\n1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\nIf field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\nSee more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n2) `field` is not required if `aggregate` is `count`." - }, - "timeUnit": { - "anyOf": [ - { - "$ref": "#/definitions/TimeUnit" - }, - { - "$ref": "#/definitions/TimeUnitParams" - } - ], - "description": "Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\nor [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation." - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "type": "null" - } - ], - "description": "A title for the field. If `null`, the title will be removed.\n\n__Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n\n__Notes__:\n\n1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n\n2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used." - }, - "type": { - "$ref": "#/definitions/StandardType", - "description": "The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\nIt can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n\nSince Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n(1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\nor (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n\n__Default value:__\n\n1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n- `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n- `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n- `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n\n2) For a constant value in data domain (`datum`):\n- `\"quantitative\"` if the datum is a number\n- `\"nominal\"` if the datum is a string\n- `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n\n__Note:__\n- Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n- Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n- When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n- When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n- Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n\n__See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation." - } - }, - "type": "object" - }, - "UnitSpec": { - "additionalProperties": false, - "description": "A unit specification, which can contain either [primitive marks or composite marks](https://vega.github.io/vega-lite/docs/mark.html#types).", - "properties": { - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "encoding": { - "$ref": "#/definitions/Encoding", - "description": "A key-value mapping between encoding channels and definition of fields." - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "__Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec." - }, - "mark": { - "$ref": "#/definitions/AnyMark", - "description": "A string describing the mark type (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n`\"area\"`, `\"point\"`, `\"rule\"`, `\"geoshape\"`, and `\"text\"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def)." - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "projection": { - "$ref": "#/definitions/Projection", - "description": "An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks\nand to `latitude` and `\"longitude\"` channels for other marks." - }, - "selection": { - "additionalProperties": { - "$ref": "#/definitions/SelectionDef" - }, - "description": "A key-value mapping between selection names and definitions.", - "type": "object" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "view": { - "$ref": "#/definitions/ViewBackground", - "description": "__Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec." - }, - "width": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "__Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec." - } - }, - "required": [ - "mark" - ], - "type": "object" - }, - "UnitSpecWithFrame": { - "additionalProperties": false, - "properties": { - "data": { - "anyOf": [ - { - "$ref": "#/definitions/Data" - }, - { - "type": "null" - } - ], - "description": "An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent." - }, - "description": { - "description": "Description of this mark for commenting purpose.", - "type": "string" - }, - "encoding": { - "$ref": "#/definitions/Encoding", - "description": "A key-value mapping between encoding channels and definition of fields." - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The height of a visualization.\n\n- For a plot with a continuous y-field, height should be a number.\n- For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.)\n- To enable responsive sizing on height, it should be set to `\"container\"`.\n\n__Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation." - }, - "mark": { - "$ref": "#/definitions/AnyMark", - "description": "A string describing the mark type (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n`\"area\"`, `\"point\"`, `\"rule\"`, `\"geoshape\"`, and `\"text\"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def)." - }, - "name": { - "description": "Name of the visualization for later reference.", - "type": "string" - }, - "projection": { - "$ref": "#/definitions/Projection", - "description": "An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks\nand to `latitude` and `\"longitude\"` channels for other marks." - }, - "selection": { - "additionalProperties": { - "$ref": "#/definitions/SelectionDef" - }, - "description": "A key-value mapping between selection names and definitions.", - "type": "object" - }, - "title": { - "anyOf": [ - { - "$ref": "#/definitions/Text" - }, - { - "$ref": "#/definitions/TitleParams" - } - ], - "description": "Title for the plot." - }, - "transform": { - "description": "An array of data transformations such as filter and new field calculation.", - "items": { - "$ref": "#/definitions/Transform" - }, - "type": "array" - }, - "view": { - "$ref": "#/definitions/ViewBackground", - "description": "An object defining the view background's fill and stroke.\n\n__Default value:__ none (transparent)" - }, - "width": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "container" - ], - "type": "string" - }, - { - "$ref": "#/definitions/Step" - } - ], - "description": "The width of a visualization.\n\n- For a plot with a continuous x-field, width should be a number.\n- For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.)\n- To enable responsive sizing on width, it should be set to `\"container\"`.\n\n__Default value:__\nBased on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise.\n\n__Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `\"container\"` option cannot be used.\n\n__See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation." - } - }, - "required": [ - "mark" - ], - "type": "object" - }, - "UrlData": { - "additionalProperties": false, - "properties": { - "format": { - "$ref": "#/definitions/DataFormat", - "description": "An object that specifies the format for parsing the data." - }, - "name": { - "description": "Provide a placeholder name and bind data at runtime.", - "type": "string" - }, - "url": { - "description": "An URL from which to load the data set. Use the `format.type` property\nto ensure the loaded data is correctly parsed.", - "type": "string" - } - }, - "required": [ - "url" - ], - "type": "object" - }, - "UtcMultiTimeUnit": { - "enum": [ - "utcyearquarter", - "utcyearquartermonth", - "utcyearmonth", - "utcyearmonthdate", - "utcyearmonthdatehours", - "utcyearmonthdatehoursminutes", - "utcyearmonthdatehoursminutesseconds", - "utcyearweek", - "utcyearweekday", - "utcyearweekdayhours", - "utcyearweekdayhoursminutes", - "utcyearweekdayhoursminutesseconds", - "utcyeardayofyear", - "utcquartermonth", - "utcmonthdate", - "utcmonthdatehours", - "utcmonthdatehoursminutes", - "utcmonthdatehoursminutesseconds", - "utcweekday", - "utcweeksdayhours", - "utcweekdayhoursminutes", - "utcweekdayhoursminutesseconds", - "utcdayhours", - "utcdayhoursminutes", - "utcdayhoursminutesseconds", - "utchoursminutes", - "utchoursminutesseconds", - "utcminutesseconds", - "utcsecondsmilliseconds" - ], - "type": "string" - }, - "UtcSingleTimeUnit": { - "enum": [ - "utcyear", - "utcquarter", - "utcmonth", - "utcweek", - "utcday", - "utcdayofyear", - "utcdate", - "utchours", - "utcminutes", - "utcseconds", - "utcmilliseconds" - ], - "type": "string" - }, - "ValueDef<(number|\"width\"|\"height\")>": { - "additionalProperties": false, - "description": "Definition object for a constant value (primitive value or gradient definition) of an encoding channel.", - "properties": { - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "enum": [ - "width" - ], - "type": "string" - }, - { - "enum": [ - "height" - ], - "type": "string" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "required": [ - "value" - ], - "type": "object" - }, - "ValueDef": { - "additionalProperties": false, - "description": "Definition object for a constant value (primitive value or gradient definition) of an encoding channel.", - "properties": { - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "required": [ - "value" - ], - "type": "object" - }, - "ValueDefWithCondition": { - "additionalProperties": false, - "minProperties": 1, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(Gradient|string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - }, - "value": { - "anyOf": [ - { - "$ref": "#/definitions/Gradient" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "ValueDefWithCondition": { - "additionalProperties": false, - "minProperties": 1, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "string", - "null" - ] - } - }, - "type": "object" - }, - "ValueDefWithCondition": { - "additionalProperties": false, - "minProperties": 1, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": "number" - } - }, - "type": "object" - }, - "ValueDefWithCondition": { - "additionalProperties": false, - "minProperties": 1, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "items": { - "type": "number" - }, - "type": "array" - } - }, - "type": "object" - }, - "ValueDefWithCondition,(string|null)>": { - "additionalProperties": false, - "minProperties": 1, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalMarkPropFieldOrDatumDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef<(string|null)>" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - }, - "value": { - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).", - "type": [ - "string", - "null" - ] - } - }, - "type": "object" - }, - "ValueDefWithCondition": { - "additionalProperties": false, - "minProperties": 1, - "properties": { - "condition": { - "anyOf": [ - { - "$ref": "#/definitions/ConditionalStringFieldDef" - }, - { - "$ref": "#/definitions/ConditionalValueDef" - }, - { - "items": { - "$ref": "#/definitions/ConditionalValueDef" - }, - "type": "array" - } - ], - "description": "A field definition or one or more value definition(s) with a selection predicate." - }, - "value": { - "$ref": "#/definitions/Text", - "description": "A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity)." - } - }, - "type": "object" - }, - "Vector2": { - "items": [ - { - "$ref": "#/definitions/DateTime" - }, - { - "$ref": "#/definitions/DateTime" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "Vector2>": { - "items": [ - { - "$ref": "#/definitions/Vector2" - }, - { - "$ref": "#/definitions/Vector2" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "Vector2": { - "items": [ - { - "type": "boolean" - }, - { - "type": "boolean" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "Vector2": { - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "Vector2": { - "items": [ - { - "type": "string" - }, - { - "type": "string" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "Vector3": { - "items": [ - { - "type": "number" - }, - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 3, - "minItems": 3, - "type": "array" - }, - "ViewBackground": { - "additionalProperties": false, - "properties": { - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the view. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "type": "null" - } - ], - "description": "The fill color.\n\n__Default value:__ `undefined`" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "type": "null" - } - ], - "description": "The stroke color.\n\n__Default value:__ `\"#ddd\"`" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "style": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "A string or array of strings indicating the name of custom styles to apply to the view background. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n\n__Default value:__ `\"cell\"`\n__Note:__ Any specified view background properties will augment the default style." - } - }, - "type": "object" - }, - "ViewConfig": { - "additionalProperties": false, - "properties": { - "clip": { - "description": "Whether the view should be clipped.", - "type": "boolean" - }, - "continuousHeight": { - "description": "The default height when the plot has a continuous y-field for x or latitude, or has arc marks.\n\n__Default value:__ `200`", - "type": "number" - }, - "continuousWidth": { - "description": "The default width when the plot has a continuous field for x or longitude, or has arc marks.\n\n__Default value:__ `200`", - "type": "number" - }, - "cornerRadius": { - "description": "The radius in pixels of rounded rectangles or arcs' corners.\n\n__Default value:__ `0`", - "type": "number" - }, - "cursor": { - "$ref": "#/definitions/Cursor", - "description": "The mouse cursor used over the view. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used." - }, - "discreteHeight": { - "anyOf": [ - { - "type": "number" - }, - { - "additionalProperties": false, - "properties": { - "step": { - "type": "number" - } - }, - "required": [ - "step" - ], - "type": "object" - } - ], - "description": "The default height when the plot has non arc marks and either a discrete y-field or no y-field.\nThe height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step.\n\n__Default value:__ a step size based on `config.view.step`." - }, - "discreteWidth": { - "anyOf": [ - { - "type": "number" - }, - { - "additionalProperties": false, - "properties": { - "step": { - "type": "number" - } - }, - "required": [ - "step" - ], - "type": "object" - } - ], - "description": "The default width when the plot has non-arc marks and either a discrete x-field or no x-field.\nThe width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step.\n\n__Default value:__ a step size based on `config.view.step`." - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "type": "null" - } - ], - "description": "The fill color.\n\n__Default value:__ `undefined`" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "height": { - "description": "Default height\n\n__Deprecated:__ Since Vega-Lite 4.0. Please use continuousHeight and discreteHeight instead.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "step": { - "description": "Default step size for x-/y- discrete fields.", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/Color" - }, - { - "type": "null" - } - ], - "description": "The stroke color.\n\n__Default value:__ `\"#ddd\"`" - }, - "strokeCap": { - "$ref": "#/definitions/StrokeCap", - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"butt\"`" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeJoin": { - "$ref": "#/definitions/StrokeJoin", - "description": "The stroke line join method. One of `\"miter\"`, `\"round\"` or `\"bevel\"`.\n\n__Default value:__ `\"miter\"`" - }, - "strokeMiterLimit": { - "description": "The miter limit at which to bevel a line join.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "width": { - "description": "Default width\n\n__Deprecated:__ Since Vega-Lite 4.0. Please use continuousWidth and discreteWidth instead.", - "type": "number" - } - }, - "type": "object" - }, - "WindowEventType": { - "anyOf": [ - { - "$ref": "#/definitions/EventType" - }, - { - "type": "string" - } - ] - }, - "WindowFieldDef": { - "additionalProperties": false, - "properties": { - "as": { - "$ref": "#/definitions/FieldName", - "description": "The output name for the window operation." - }, - "field": { - "$ref": "#/definitions/FieldName", - "description": "The data field for which to compute the aggregate or window function. This can be omitted for window functions that do not operate over a field such as `\"count\"`, `\"rank\"`, `\"dense_rank\"`." - }, - "op": { - "anyOf": [ - { - "$ref": "#/definitions/AggregateOp" - }, - { - "$ref": "#/definitions/WindowOnlyOp" - } - ], - "description": "The window or aggregation operation to apply within a window (e.g., `\"rank\"`, `\"lead\"`, `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/window.html#ops)." - }, - "param": { - "description": "Parameter values for the window functions. Parameter values can be omitted for operations that do not accept a parameter.\n\nSee the list of all supported operations and their parameters [here](https://vega.github.io/vega-lite/docs/transforms/window.html).", - "type": "number" - } - }, - "required": [ - "op", - "as" - ], - "type": "object" - }, - "WindowOnlyOp": { - "enum": [ - "row_number", - "rank", - "dense_rank", - "percent_rank", - "cume_dist", - "ntile", - "lag", - "lead", - "first_value", - "last_value", - "nth_value" - ], - "type": "string" - }, - "WindowTransform": { - "additionalProperties": false, - "properties": { - "frame": { - "description": "A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is `[null, 0]`, indicating that the sliding window includes the current object and all preceding objects. The value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. Finally, `[null, null]` indicates that the window frame should always include all data objects. If you this frame and want to assign the same value to add objects, you can use the simpler [join aggregate transform](https://vega.github.io/vega-lite/docs/joinaggregate.html). The only operators affected are the aggregation operations and the `first_value`, `last_value`, and `nth_value` window operations. The other window operations are not affected by this.\n\n__Default value:__: `[null, 0]` (includes the current object and all preceding objects)", - "items": { - "type": [ - "null", - "number" - ] - }, - "type": "array" - }, - "groupby": { - "description": "The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single window.", - "items": { - "$ref": "#/definitions/FieldName" - }, - "type": "array" - }, - "ignorePeers": { - "description": "Indicates if the sliding window frame should ignore peer values (data that are considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations.\n\n__Default value:__ `false`", - "type": "boolean" - }, - "sort": { - "description": "A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered \"peer\" values of equal rank. If sort is not specified, the order is undefined: data objects are processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to `true`).", - "items": { - "$ref": "#/definitions/SortField" - }, - "type": "array" - }, - "window": { - "description": "The definition of the fields in the window, and what calculations to use.", - "items": { - "$ref": "#/definitions/WindowFieldDef" - }, - "type": "array" - } - }, - "required": [ - "window" - ], - "type": "object" - } - } -} \ No newline at end of file diff --git a/node_modules/vega-lite/build/vega-lite.js b/node_modules/vega-lite/build/vega-lite.js deleted file mode 100644 index 6793f26..0000000 --- a/node_modules/vega-lite/build/vega-lite.js +++ /dev/null @@ -1,19773 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.vegaLite = {})); -}(this, (function (exports) { 'use strict'; - - var version = "4.14.0"; - - function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; - } - - function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); - } - - const get1 = field => function(obj) { - return obj[field]; - }; - - const getN = path => { - const len = path.length; - return function(obj) { - for (let i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - return obj; - }; - }; - - function error(message) { - throw Error(message); - } - - function splitAccessPath(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, j, c; - - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i=j=0; j i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; - } - - function field(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor( - (opt && opt.get || getter)(path), - [field], - name || field - ); - } - - var empty = []; - - var id = field('id'); - - var identity = accessor(function(_) { return _; }, empty, 'identity'); - - var zero = accessor(function() { return 0; }, empty, 'zero'); - - var one = accessor(function() { return 1; }, empty, 'one'); - - var truthy = accessor(function() { return true; }, empty, 'true'); - - var falsy = accessor(function() { return false; }, empty, 'false'); - - function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console - } - - var None = 0; - var Error$1 = 1; - var Warn = 2; - var Info = 3; - var Debug = 4; - - function logger(_, method) { - var level = _ || None; - return { - level: function(_) { - if (arguments.length) { - level = +_; - return this; - } else { - return level; - } - }, - error: function() { - if (level >= Error$1) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function() { - if (level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function() { - if (level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function() { - if (level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; - } - - var isArray = Array.isArray; - - function isObject(_) { - return _ === Object(_); - } - - const isLegalKey = key => key !== '__proto__'; - - function mergeConfig(...configs) { - return configs.reduce((out, source) => { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? {layout: 1} - : key === 'style' ? true - : null; - writeConfig(out, key, source[key], r); - } - } - return out; - }, {}); - } - - function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - - var k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : (output[key] = {}); - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } - } - - function mergeNamed(a, b) { - if (a == null) return b; - - const map = {}, out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; - } - - function array(_) { - return _ != null ? (isArray(_) ? _ : [_]) : []; - } - - function isFunction(_) { - return typeof _ === 'function'; - } - - const hop = Object.prototype.hasOwnProperty; - - function hasOwnProperty(object, property) { - return hop.call(object, property); - } - - function isBoolean(_) { - return typeof _ === 'boolean'; - } - - function isNumber(_) { - return typeof _ === 'number'; - } - - function isString(_) { - return typeof _ === 'string'; - } - - function $(x) { - return isArray(x) ? '[' + x.map($) + ']' - : isObject(x) || isString(x) ? - // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029') - : x; - } - - function toSet(_) { - for (var s={}, i=0, n=_.length; i= 4.5.0 - child = Buffer.allocUnsafe(parent.length); - } else { - // Older Node.js versions - child = new Buffer(parent.length); - } - parent.copy(child); - return child; - } else if (_instanceof(parent, Error)) { - child = Object.create(parent); - } else { - if (typeof prototype == 'undefined') { - proto = Object.getPrototypeOf(parent); - child = Object.create(proto); - } - else { - child = Object.create(prototype); - proto = prototype; - } - } - - if (circular) { - var index = allParents.indexOf(parent); - - if (index != -1) { - return allChildren[index]; - } - allParents.push(parent); - allChildren.push(child); - } - - if (_instanceof(parent, nativeMap)) { - parent.forEach(function(value, key) { - var keyChild = _clone(key, depth - 1); - var valueChild = _clone(value, depth - 1); - child.set(keyChild, valueChild); - }); - } - if (_instanceof(parent, nativeSet)) { - parent.forEach(function(value) { - var entryChild = _clone(value, depth - 1); - child.add(entryChild); - }); - } - - for (var i in parent) { - var attrs; - if (proto) { - attrs = Object.getOwnPropertyDescriptor(proto, i); - } - - if (attrs && attrs.set == null) { - continue; - } - child[i] = _clone(parent[i], depth - 1); - } - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(parent); - for (var i = 0; i < symbols.length; i++) { - // Don't need to worry about cloning a symbol because it is a primitive, - // like a number or string. - var symbol = symbols[i]; - var descriptor = Object.getOwnPropertyDescriptor(parent, symbol); - if (descriptor && !descriptor.enumerable && !includeNonEnumerable) { - continue; - } - child[symbol] = _clone(parent[symbol], depth - 1); - if (!descriptor.enumerable) { - Object.defineProperty(child, symbol, { - enumerable: false - }); - } - } - } - - if (includeNonEnumerable) { - var allPropertyNames = Object.getOwnPropertyNames(parent); - for (var i = 0; i < allPropertyNames.length; i++) { - var propertyName = allPropertyNames[i]; - var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName); - if (descriptor && descriptor.enumerable) { - continue; - } - child[propertyName] = _clone(parent[propertyName], depth - 1); - Object.defineProperty(child, propertyName, { - enumerable: false - }); - } - } - - return child; - } - - return _clone(parent, depth); - } - - /** - * Simple flat clone using prototype, accepts only objects, usefull for property - * override on FLAT configuration object (no nested props). - * - * USE WITH CAUTION! This may not behave as you wish if you do not know how this - * works. - */ - clone.clonePrototype = function clonePrototype(parent) { - if (parent === null) - return null; - - var c = function () {}; - c.prototype = parent; - return new c(); - }; - - // private utility functions - - function __objToStr(o) { - return Object.prototype.toString.call(o); - } - clone.__objToStr = __objToStr; - - function __isDate(o) { - return typeof o === 'object' && __objToStr(o) === '[object Date]'; - } - clone.__isDate = __isDate; - - function __isArray(o) { - return typeof o === 'object' && __objToStr(o) === '[object Array]'; - } - clone.__isArray = __isArray; - - function __isRegExp(o) { - return typeof o === 'object' && __objToStr(o) === '[object RegExp]'; - } - clone.__isRegExp = __isRegExp; - - function __getRegExpFlags(re) { - var flags = ''; - if (re.global) flags += 'g'; - if (re.ignoreCase) flags += 'i'; - if (re.multiline) flags += 'm'; - return flags; - } - clone.__getRegExpFlags = __getRegExpFlags; - - return clone; - })(); - - if ( module.exports) { - module.exports = clone; - } - }); - - // do not edit .js files directly - edit src/index.jst - - - - var fastDeepEqual = function equal(a, b) { - if (a === b) return true; - - if (a && b && typeof a == 'object' && typeof b == 'object') { - if (a.constructor !== b.constructor) return false; - - var length, i, keys; - if (Array.isArray(a)) { - length = a.length; - if (length != b.length) return false; - for (i = length; i-- !== 0;) - if (!equal(a[i], b[i])) return false; - return true; - } - - - - if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; - if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); - if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); - - keys = Object.keys(a); - length = keys.length; - if (length !== Object.keys(b).length) return false; - - for (i = length; i-- !== 0;) - if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; - - for (i = length; i-- !== 0;) { - var key = keys[i]; - - if (!equal(a[key], b[key])) return false; - } - - return true; - } - - // true if both NaN, false otherwise - return a!==a && b!==b; - }; - - var fastJsonStableStringify = function (data, opts) { - if (!opts) opts = {}; - if (typeof opts === 'function') opts = { cmp: opts }; - var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; - - var cmp = opts.cmp && (function (f) { - return function (node) { - return function (a, b) { - var aobj = { key: a, value: node[a] }; - var bobj = { key: b, value: node[b] }; - return f(aobj, bobj); - }; - }; - })(opts.cmp); - - var seen = []; - return (function stringify (node) { - if (node && node.toJSON && typeof node.toJSON === 'function') { - node = node.toJSON(); - } - - if (node === undefined) return; - if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; - if (typeof node !== 'object') return JSON.stringify(node); - - var i, out; - if (Array.isArray(node)) { - out = '['; - for (i = 0; i < node.length; i++) { - if (i) out += ','; - out += stringify(node[i]) || 'null'; - } - return out + ']'; - } - - if (node === null) return 'null'; - - if (seen.indexOf(node) !== -1) { - if (cycles) return JSON.stringify('__cycle__'); - throw new TypeError('Converting circular structure to JSON'); - } - - var seenIndex = seen.push(node) - 1; - var keys = Object.keys(node).sort(cmp && cmp(node)); - out = ''; - for (i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = stringify(node[key]); - - if (!value) continue; - if (out) out += ','; - out += JSON.stringify(key) + ':' + value; - } - seen.splice(seenIndex, 1); - return '{' + out + '}'; - })(data); - }; - - function isLogicalOr(op) { - return !!op.or; - } - function isLogicalAnd(op) { - return !!op.and; - } - function isLogicalNot(op) { - return !!op.not; - } - function forEachLeaf(op, fn) { - if (isLogicalNot(op)) { - forEachLeaf(op.not, fn); - } - else if (isLogicalAnd(op)) { - for (const subop of op.and) { - forEachLeaf(subop, fn); - } - } - else if (isLogicalOr(op)) { - for (const subop of op.or) { - forEachLeaf(subop, fn); - } - } - else { - fn(op); - } - } - function normalizeLogicalComposition(op, normalizer) { - if (isLogicalNot(op)) { - return { not: normalizeLogicalComposition(op.not, normalizer) }; - } - else if (isLogicalAnd(op)) { - return { and: op.and.map(o => normalizeLogicalComposition(o, normalizer)) }; - } - else if (isLogicalOr(op)) { - return { or: op.or.map(o => normalizeLogicalComposition(o, normalizer)) }; - } - else { - return normalizer(op); - } - } - - const deepEqual = fastDeepEqual; - const duplicate = clone_1; - /** - * Creates an object composed of the picked object properties. - * - * var object = {'a': 1, 'b': '2', 'c': 3}; - * pick(object, ['a', 'c']); - * // → {'a': 1, 'c': 3} - */ - // eslint-disable-next-line @typescript-eslint/ban-types - function pick(obj, props) { - const copy = {}; - for (const prop of props) { - if (hasOwnProperty(obj, prop)) { - copy[prop] = obj[prop]; - } - } - return copy; - } - /** - * The opposite of _.pick; this method creates an object composed of the own - * and inherited enumerable string keyed properties of object that are not omitted. - */ - // eslint-disable-next-line @typescript-eslint/ban-types - function omit(obj, props) { - const copy = Object.assign({}, obj); - for (const prop of props) { - delete copy[prop]; - } - return copy; - } - /** - * Monkey patch Set so that `stringify` produces a string representation of sets. - */ - Set.prototype['toJSON'] = function () { - return `Set(${[...this].map(x => fastJsonStableStringify(x)).join(',')})`; - }; - /** - * Converts any object to a string representation that can be consumed by humans. - */ - const stringify = fastJsonStableStringify; - /** - * Converts any object to a string of limited size, or a number. - */ - function hash(a) { - if (isNumber(a)) { - return a; - } - const str = isString(a) ? a : fastJsonStableStringify(a); - // short strings can be used as hash directly, longer strings are hashed to reduce memory usage - if (str.length < 250) { - return str; - } - // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ - let h = 0; - for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - h = (h << 5) - h + char; - h = h & h; // Convert to 32bit integer - } - return h; - } - function isNullOrFalse(x) { - return x === false || x === null; - } - function contains(array, item) { - return array.indexOf(item) > -1; - } - /** - * Returns true if any item returns true. - */ - function some(arr, f) { - let i = 0; - for (const [k, a] of arr.entries()) { - if (f(a, k, i++)) { - return true; - } - } - return false; - } - /** - * Returns true if all items return true. - */ - function every(arr, f) { - let i = 0; - for (const [k, a] of arr.entries()) { - if (!f(a, k, i++)) { - return false; - } - } - return true; - } - /** - * recursively merges src into dest - */ - function mergeDeep(dest, ...src) { - for (const s of src) { - deepMerge_(dest, s !== null && s !== void 0 ? s : {}); - } - return dest; - } - function deepMerge_(dest, src) { - for (const property of keys(src)) { - writeConfig(dest, property, src[property], true); - } - } - function unique(values, f) { - const results = []; - const u = {}; - let v; - for (const val of values) { - v = f(val); - if (v in u) { - continue; - } - u[v] = 1; - results.push(val); - } - return results; - } - function setEqual(a, b) { - if (a.size !== b.size) { - return false; - } - for (const e of a) { - if (!b.has(e)) { - return false; - } - } - return true; - } - function hasIntersection(a, b) { - for (const key of a) { - if (b.has(key)) { - return true; - } - } - return false; - } - function prefixGenerator(a) { - const prefixes = new Set(); - for (const x of a) { - const splitField = splitAccessPath(x); - // Wrap every element other than the first in `[]` - const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`)); - const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join('')); - for (const y of computedPrefixes) { - prefixes.add(y); - } - } - return prefixes; - } - /** - * Returns true if a and b have an intersection. Also return true if a or b are undefined - * since this means we don't know what fields a node produces or depends on. - */ - function fieldIntersection(a, b) { - if (a === undefined || b === undefined) { - return true; - } - return hasIntersection(prefixGenerator(a), prefixGenerator(b)); - } - // eslint-disable-next-line @typescript-eslint/ban-types - function isEmpty(obj) { - return keys(obj).length === 0; - } - // This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 - const keys = Object.keys; - const vals = Object.values; - function entries(x) { - const _entries = []; - for (const k in x) { - if (hasOwnProperty(x, k)) { - _entries.push({ - key: k, - value: x[k] - }); - } - } - return _entries; - } - function isBoolean$1(b) { - return b === true || b === false; - } - /** - * Convert a string into a valid variable name - */ - function varName(s) { - // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _ - const alphanumericS = s.replace(/\W/g, '_'); - // Add _ if the string has leading numbers. - return (s.match(/^\d+/) ? '_' : '') + alphanumericS; - } - function logicalExpr(op, cb) { - if (isLogicalNot(op)) { - return '!(' + logicalExpr(op.not, cb) + ')'; - } - else if (isLogicalAnd(op)) { - return '(' + op.and.map((and) => logicalExpr(and, cb)).join(') && (') + ')'; - } - else if (isLogicalOr(op)) { - return '(' + op.or.map((or) => logicalExpr(or, cb)).join(') || (') + ')'; - } - else { - return cb(op); - } - } - /** - * Delete nested property of an object, and delete the ancestors of the property if they become empty. - */ - function deleteNestedProperty(obj, orderedProps) { - if (orderedProps.length === 0) { - return true; - } - const prop = orderedProps.shift(); // eslint-disable-line @typescript-eslint/no-non-null-assertion - if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) { - delete obj[prop]; - } - return isEmpty(obj); - } - function titleCase(s) { - return s.charAt(0).toUpperCase() + s.substr(1); - } - /** - * Converts a path to an access path with datum. - * @param path The field name. - * @param datum The string to use for `datum`. - */ - function accessPathWithDatum(path, datum = 'datum') { - const pieces = splitAccessPath(path); - const prefixes = []; - for (let i = 1; i <= pieces.length; i++) { - const prefix = `[${pieces.slice(0, i).map($).join('][')}]`; - prefixes.push(`${datum}${prefix}`); - } - return prefixes.join(' && '); - } - /** - * Return access with datum to the flattened field. - * - * @param path The field name. - * @param datum The string to use for `datum`. - */ - function flatAccessWithDatum(path, datum = 'datum') { - return `${datum}[${$(splitAccessPath(path).join('.'))}]`; - } - function escapePathAccess(string) { - return string.replace(/(\[|\]|\.|'|")/g, '\\$1'); - } - /** - * Replaces path accesses with access to non-nested field. - * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`. - */ - function replacePathInField(path) { - return `${splitAccessPath(path).map(escapePathAccess).join('\\.')}`; - } - /** - * Replace all occurrences of a string with another string. - * - * @param string the string to replace in - * @param find the string to replace - * @param replacement the replacement - */ - function replaceAll(string, find, replacement) { - return string.replace(new RegExp(find.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replacement); - } - /** - * Remove path accesses with access from field. - * For example, `foo["bar"].baz` becomes `foo.bar.baz`. - */ - function removePathFromField(path) { - return `${splitAccessPath(path).join('.')}`; - } - /** - * Count the depth of the path. Returns 1 for fields that are not nested. - */ - function accessPathDepth(path) { - if (!path) { - return 0; - } - return splitAccessPath(path).length; - } - /** - * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included. - */ - function getFirstDefined(...args) { - for (const arg of args) { - if (arg !== undefined) { - return arg; - } - } - return undefined; - } - // variable used to generate id - let idCounter = 42; - /** - * Returns a new random id every time it gets called. - * - * Has side effect! - */ - function uniqueId(prefix) { - const id = ++idCounter; - return prefix ? String(prefix) + id : id; - } - function internalField(name) { - return isInternalField(name) ? name : `__${name}`; - } - function isInternalField(name) { - return name.indexOf('__') === 0; - } - /** - * Normalize angle to be within [0,360). - */ - function normalizeAngle(angle) { - if (angle === undefined) { - return undefined; - } - return ((angle % 360) + 360) % 360; - } - /** - * Returns whether the passed in value is a valid number. - */ - function isNumeric(value) { - if (isNumber(value)) { - return true; - } - return !isNaN(value) && !isNaN(parseFloat(value)); - } - - const CONDITIONAL_AXIS_PROP_INDEX = { - domainColor: { - part: 'domain', - vgProp: 'stroke' - }, - labelAlign: { - part: 'labels', - vgProp: 'align' - }, - labelBaseline: { - part: 'labels', - vgProp: 'baseline' - }, - labelColor: { - part: 'labels', - vgProp: 'fill' - }, - labelFont: { - part: 'labels', - vgProp: 'font' - }, - labelFontSize: { - part: 'labels', - vgProp: 'fontSize' - }, - labelFontStyle: { - part: 'labels', - vgProp: 'fontStyle' - }, - labelFontWeight: { - part: 'labels', - vgProp: 'fontWeight' - }, - labelOpacity: { - part: 'labels', - vgProp: 'opacity' - }, - labelOffset: null, - labelPadding: null, - gridColor: { - part: 'grid', - vgProp: 'stroke' - }, - gridDash: { - part: 'grid', - vgProp: 'strokeDash' - }, - gridDashOffset: { - part: 'grid', - vgProp: 'strokeDashOffset' - }, - gridOpacity: { - part: 'grid', - vgProp: 'opacity' - }, - gridWidth: { - part: 'grid', - vgProp: 'strokeWidth' - }, - tickColor: { - part: 'ticks', - vgProp: 'stroke' - }, - tickDash: { - part: 'ticks', - vgProp: 'strokeDash' - }, - tickDashOffset: { - part: 'ticks', - vgProp: 'strokeDashOffset' - }, - tickOpacity: { - part: 'ticks', - vgProp: 'opacity' - }, - tickSize: null, - tickWidth: { - part: 'ticks', - vgProp: 'strokeWidth' - }, - titleColor: { - part: 'title', - vgProp: 'fill' - }, - title: null // title supports signal, let's use it. - }; - function isConditionalAxisValue(v) { - return v && v['condition']; - } - const AXIS_PARTS = ['domain', 'grid', 'labels', 'ticks', 'title']; - /** - * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes. - */ - const AXIS_PROPERTY_TYPE = { - grid: 'grid', - gridCap: 'grid', - gridColor: 'grid', - gridDash: 'grid', - gridDashOffset: 'grid', - gridOpacity: 'grid', - gridScale: 'grid', - gridWidth: 'grid', - orient: 'main', - bandPosition: 'both', - aria: 'main', - description: 'main', - domain: 'main', - domainCap: 'main', - domainColor: 'main', - domainDash: 'main', - domainDashOffset: 'main', - domainOpacity: 'main', - domainWidth: 'main', - format: 'main', - formatType: 'main', - labelAlign: 'main', - labelAngle: 'main', - labelBaseline: 'main', - labelBound: 'main', - labelColor: 'main', - labelFlush: 'main', - labelFlushOffset: 'main', - labelFont: 'main', - labelFontSize: 'main', - labelFontStyle: 'main', - labelFontWeight: 'main', - labelLimit: 'main', - labelLineHeight: 'main', - labelOffset: 'main', - labelOpacity: 'main', - labelOverlap: 'main', - labelPadding: 'main', - labels: 'main', - labelSeparation: 'main', - maxExtent: 'main', - minExtent: 'main', - offset: 'both', - position: 'main', - tickCap: 'main', - tickColor: 'main', - tickDash: 'main', - tickDashOffset: 'main', - tickMinStep: 'main', - tickOffset: 'both', - tickOpacity: 'main', - tickRound: 'both', - ticks: 'main', - tickSize: 'main', - tickWidth: 'both', - title: 'main', - titleAlign: 'main', - titleAnchor: 'main', - titleAngle: 'main', - titleBaseline: 'main', - titleColor: 'main', - titleFont: 'main', - titleFontSize: 'main', - titleFontStyle: 'main', - titleFontWeight: 'main', - titleLimit: 'main', - titleLineHeight: 'main', - titleOpacity: 'main', - titlePadding: 'main', - titleX: 'main', - titleY: 'main', - encode: 'both', - scale: 'both', - tickBand: 'both', - tickCount: 'both', - tickExtra: 'both', - translate: 'both', - values: 'both', - zindex: 'both' // this is actually set afterward, so it doesn't matter - }; - const COMMON_AXIS_PROPERTIES_INDEX = { - orient: 1, - aria: 1, - bandPosition: 1, - description: 1, - domain: 1, - domainCap: 1, - domainColor: 1, - domainDash: 1, - domainDashOffset: 1, - domainOpacity: 1, - domainWidth: 1, - format: 1, - formatType: 1, - grid: 1, - gridCap: 1, - gridColor: 1, - gridDash: 1, - gridDashOffset: 1, - gridOpacity: 1, - gridWidth: 1, - labelAlign: 1, - labelAngle: 1, - labelBaseline: 1, - labelBound: 1, - labelColor: 1, - labelFlush: 1, - labelFlushOffset: 1, - labelFont: 1, - labelFontSize: 1, - labelFontStyle: 1, - labelFontWeight: 1, - labelLimit: 1, - labelLineHeight: 1, - labelOffset: 1, - labelOpacity: 1, - labelOverlap: 1, - labelPadding: 1, - labels: 1, - labelSeparation: 1, - maxExtent: 1, - minExtent: 1, - offset: 1, - position: 1, - tickBand: 1, - tickCap: 1, - tickColor: 1, - tickCount: 1, - tickDash: 1, - tickDashOffset: 1, - tickExtra: 1, - tickMinStep: 1, - tickOffset: 1, - tickOpacity: 1, - tickRound: 1, - ticks: 1, - tickSize: 1, - tickWidth: 1, - title: 1, - titleAlign: 1, - titleAnchor: 1, - titleAngle: 1, - titleBaseline: 1, - titleColor: 1, - titleFont: 1, - titleFontSize: 1, - titleFontStyle: 1, - titleFontWeight: 1, - titleLimit: 1, - titleLineHeight: 1, - titleOpacity: 1, - titlePadding: 1, - titleX: 1, - titleY: 1, - translate: 1, - values: 1, - zindex: 1 - }; - const AXIS_PROPERTIES_INDEX = Object.assign(Object.assign({}, COMMON_AXIS_PROPERTIES_INDEX), { style: 1, labelExpr: 1, encoding: 1 }); - function isAxisProperty(prop) { - return !!AXIS_PROPERTIES_INDEX[prop]; - } - - /** - * All types of primitive marks. - */ - const Mark = { - arc: 'arc', - area: 'area', - bar: 'bar', - image: 'image', - line: 'line', - point: 'point', - rect: 'rect', - rule: 'rule', - text: 'text', - tick: 'tick', - trail: 'trail', - circle: 'circle', - square: 'square', - geoshape: 'geoshape' - }; - const ARC = Mark.arc; - const AREA = Mark.area; - const BAR = Mark.bar; - const IMAGE = Mark.image; - const LINE = Mark.line; - const POINT = Mark.point; - const RECT = Mark.rect; - const RULE = Mark.rule; - const TEXT = Mark.text; - const TICK = Mark.tick; - const TRAIL = Mark.trail; - const CIRCLE = Mark.circle; - const SQUARE = Mark.square; - const GEOSHAPE = Mark.geoshape; - function isPathMark(m) { - return contains(['line', 'area', 'trail'], m); - } - function isRectBasedMark(m) { - return contains(['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */], m); - } - const PRIMITIVE_MARKS = keys(Mark); - function isMarkDef(mark) { - return mark['type']; - } - const PRIMITIVE_MARK_INDEX = toSet(PRIMITIVE_MARKS); - const STROKE_CONFIG = [ - 'stroke', - 'strokeWidth', - 'strokeDash', - 'strokeDashOffset', - 'strokeOpacity', - 'strokeJoin', - 'strokeMiterLimit' - ]; - const FILL_CONFIG = ['fill', 'fillOpacity']; - const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG]; - const VL_ONLY_MARK_CONFIG_INDEX = { - color: 1, - filled: 1, - invalid: 1, - order: 1, - radius2: 1, - theta2: 1, - timeUnitBand: 1, - timeUnitBandPosition: 1 - }; - const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX); - const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = { - area: ['line', 'point'], - bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize'], - rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize'], - line: ['point'], - tick: ['bandSize', 'thickness'] - }; - const defaultMarkConfig = { - color: '#4c78a8', - invalid: 'filter', - timeUnitBand: 1 - }; - const BAR_CORNER_RADIUS_INDEX = { - horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'], - vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight'] - }; - const DEFAULT_RECT_BAND_SIZE = 5; - const defaultBarConfig = { - binSpacing: 1, - continuousBandSize: DEFAULT_RECT_BAND_SIZE, - timeUnitBandPosition: 0.5 - }; - const defaultRectConfig = { - binSpacing: 0, - continuousBandSize: DEFAULT_RECT_BAND_SIZE, - timeUnitBandPosition: 0.5 - }; - const defaultTickConfig = { - thickness: 1 - }; - function getMarkType(m) { - return isMarkDef(m) ? m.type : m; - } - - function isUnitSpec(spec) { - return 'mark' in spec; - } - - class CompositeMarkNormalizer { - constructor(name, run) { - this.name = name; - this.run = run; - } - hasMatchingType(spec) { - if (isUnitSpec(spec)) { - return getMarkType(spec.mark) === this.name; - } - return false; - } - } - - const AGGREGATE_OP_INDEX = { - argmax: 1, - argmin: 1, - average: 1, - count: 1, - distinct: 1, - product: 1, - max: 1, - mean: 1, - median: 1, - min: 1, - missing: 1, - q1: 1, - q3: 1, - ci0: 1, - ci1: 1, - stderr: 1, - stdev: 1, - stdevp: 1, - sum: 1, - valid: 1, - values: 1, - variance: 1, - variancep: 1 - }; - const MULTIDOMAIN_SORT_OP_INDEX = { - count: 1, - min: 1, - max: 1 - }; - function isArgminDef(a) { - return !!a && !!a['argmin']; - } - function isArgmaxDef(a) { - return !!a && !!a['argmax']; - } - function isAggregateOp(a) { - return isString(a) && !!AGGREGATE_OP_INDEX[a]; - } - const COUNTING_OPS = ['count', 'valid', 'missing', 'distinct']; - function isCountingAggregateOp(aggregate) { - return isString(aggregate) && contains(COUNTING_OPS, aggregate); - } - function isMinMaxOp(aggregate) { - return isString(aggregate) && contains(['min', 'max'], aggregate); - } - /** Additive-based aggregation operations. These can be applied to stack. */ - const SUM_OPS = ['count', 'sum', 'distinct', 'valid', 'missing']; - /** - * Aggregation operators that always produce values within the range [domainMin, domainMax]. - */ - const SHARED_DOMAIN_OPS = ['mean', 'average', 'median', 'q1', 'q3', 'min', 'max']; - const SHARED_DOMAIN_OP_INDEX = toSet(SHARED_DOMAIN_OPS); - - /* - * Constants and utilities for encoding channels (Visual variables) - * such as 'x', 'y', 'color'. - */ - // Facet - const ROW = 'row'; - const COLUMN = 'column'; - const FACET = 'facet'; - // Position - const X = 'x'; - const Y = 'y'; - const X2 = 'x2'; - const Y2 = 'y2'; - // Arc-Position - const RADIUS = 'radius'; - const RADIUS2 = 'radius2'; - const THETA = 'theta'; - const THETA2 = 'theta2'; - // Geo Position - const LATITUDE = 'latitude'; - const LONGITUDE = 'longitude'; - const LATITUDE2 = 'latitude2'; - const LONGITUDE2 = 'longitude2'; - // Mark property with scale - const COLOR = 'color'; - const FILL = 'fill'; - const STROKE = 'stroke'; - const SHAPE = 'shape'; - const SIZE = 'size'; - const ANGLE = 'angle'; - const OPACITY = 'opacity'; - const FILLOPACITY = 'fillOpacity'; - const STROKEOPACITY = 'strokeOpacity'; - const STROKEWIDTH = 'strokeWidth'; - const STROKEDASH = 'strokeDash'; - // Non-scale channel - const TEXT$1 = 'text'; - const ORDER = 'order'; - const DETAIL = 'detail'; - const KEY = 'key'; - const TOOLTIP = 'tooltip'; - const HREF = 'href'; - const URL = 'url'; - const DESCRIPTION = 'description'; - const POSITION_CHANNEL_INDEX = { - x: 1, - y: 1, - x2: 1, - y2: 1 - }; - const POLAR_POSITION_CHANNEL_INDEX = { - theta: 1, - theta2: 1, - radius: 1, - radius2: 1 - }; - function isPolarPositionChannel(c) { - return c in POLAR_POSITION_CHANNEL_INDEX; - } - const GEO_POSIITON_CHANNEL_INDEX = { - longitude: 1, - longitude2: 1, - latitude: 1, - latitude2: 1 - }; - function getPositionChannelFromLatLong(channel) { - switch (channel) { - case LATITUDE: - return 'y'; - case LATITUDE2: - return 'y2'; - case LONGITUDE: - return 'x'; - case LONGITUDE2: - return 'x2'; - } - } - function isGeoPositionChannel(c) { - return c in GEO_POSIITON_CHANNEL_INDEX; - } - const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX); - const UNIT_CHANNEL_INDEX = Object.assign(Object.assign(Object.assign(Object.assign({}, POSITION_CHANNEL_INDEX), POLAR_POSITION_CHANNEL_INDEX), GEO_POSIITON_CHANNEL_INDEX), { - // color - color: 1, fill: 1, stroke: 1, - // other non-position with scale - opacity: 1, fillOpacity: 1, strokeOpacity: 1, strokeWidth: 1, strokeDash: 1, size: 1, angle: 1, shape: 1, - // channels without scales - order: 1, text: 1, detail: 1, key: 1, tooltip: 1, href: 1, url: 1, description: 1 }); - function isColorChannel(channel) { - return channel === COLOR || channel === FILL || channel === STROKE; - } - const FACET_CHANNEL_INDEX = { - row: 1, - column: 1, - facet: 1 - }; - const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX); - const CHANNEL_INDEX = Object.assign(Object.assign({}, UNIT_CHANNEL_INDEX), FACET_CHANNEL_INDEX); - const CHANNELS = keys(CHANNEL_INDEX); - const SINGLE_DEF_CHANNEL_INDEX = __rest(CHANNEL_INDEX, ["order", "detail", "tooltip"]); - const SINGLE_DEF_UNIT_CHANNEL_INDEX = __rest(SINGLE_DEF_CHANNEL_INDEX, ["row", "column", "facet"]); - function isSingleDefUnitChannel(str) { - return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str]; - } - function isChannel(str) { - return !!CHANNEL_INDEX[str]; - } - const SECONDARY_RANGE_CHANNEL = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2]; - function isSecondaryRangeChannel(c) { - const main = getMainRangeChannel(c); - return main !== c; - } - /** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ - function getMainRangeChannel(channel) { - switch (channel) { - case X2: - return X; - case Y2: - return Y; - case LATITUDE2: - return LATITUDE; - case LONGITUDE2: - return LONGITUDE; - case THETA2: - return THETA; - case RADIUS2: - return RADIUS; - } - return channel; - } - function getVgPositionChannel(channel) { - if (isPolarPositionChannel(channel)) { - switch (channel) { - case THETA: - return 'startAngle'; - case THETA2: - return 'endAngle'; - case RADIUS: - return 'outerRadius'; - case RADIUS2: - return 'innerRadius'; - } - } - return channel; - } - /** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ - function getSecondaryRangeChannel(channel) { - switch (channel) { - case X: - return X2; - case Y: - return Y2; - case LATITUDE: - return LATITUDE2; - case LONGITUDE: - return LONGITUDE2; - case THETA: - return THETA2; - case RADIUS: - return RADIUS2; - } - return undefined; - } - function getSizeChannel(channel) { - switch (channel) { - case X: - case X2: - return 'width'; - case Y: - case Y2: - return 'height'; - } - return undefined; - } - /** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ - function getOffsetChannel(channel) { - switch (channel) { - case X: - return 'xOffset'; - case Y: - return 'yOffset'; - case X2: - return 'x2Offset'; - case Y2: - return 'y2Offset'; - case THETA: - return 'thetaOffset'; - case RADIUS: - return 'radiusOffset'; - case THETA2: - return 'theta2Offset'; - case RADIUS2: - return 'radius2Offset'; - } - return undefined; - } - // NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2; - const // The rest of unit channels then have scale - NONPOSITION_CHANNEL_INDEX = __rest(UNIT_CHANNEL_INDEX, ["x", "y", "x2", "y2", "latitude", "longitude", "latitude2", "longitude2", "theta", "theta2", "radius", "radius2"]); - const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX); - const POSITION_SCALE_CHANNEL_INDEX = { - x: 1, - y: 1 - }; - const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX); - function isXorY(channel) { - return channel in POSITION_SCALE_CHANNEL_INDEX; - } - const POLAR_POSITION_SCALE_CHANNEL_INDEX = { - theta: 1, - radius: 1 - }; - const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX); - function getPositionScaleChannel(sizeType) { - return sizeType === 'width' ? X : Y; - } - // NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without X, Y - const NONPOSITION_SCALE_CHANNEL_INDEX = __rest(NONPOSITION_CHANNEL_INDEX, ["text", "tooltip", "href", "url", "description", "detail", "key", "order"]); - const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX); - function isNonPositionScaleChannel(channel) { - return !!NONPOSITION_CHANNEL_INDEX[channel]; - } - /** - * @returns whether Vega supports legends for a particular channel - */ - function supportLegend(channel) { - switch (channel) { - case COLOR: - case FILL: - case STROKE: - case SIZE: - case SHAPE: - case OPACITY: - case STROKEWIDTH: - case STROKEDASH: - return true; - case FILLOPACITY: - case STROKEOPACITY: - case ANGLE: - return false; - } - } - // Declare SCALE_CHANNEL_INDEX - const SCALE_CHANNEL_INDEX = Object.assign(Object.assign(Object.assign({}, POSITION_SCALE_CHANNEL_INDEX), POLAR_POSITION_SCALE_CHANNEL_INDEX), NONPOSITION_SCALE_CHANNEL_INDEX); - /** List of channels with scales */ - const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX); - function isScaleChannel(channel) { - return !!SCALE_CHANNEL_INDEX[channel]; - } - /** - * Return whether a channel supports a particular mark type. - * @param channel channel name - * @param mark the mark type - * @return whether the mark supports the channel - */ - function supportMark(channel, mark) { - return getSupportedMark(channel)[mark]; - } - const ALL_MARKS = { - // all marks - arc: 'always', - area: 'always', - bar: 'always', - circle: 'always', - geoshape: 'always', - image: 'always', - line: 'always', - rule: 'always', - point: 'always', - rect: 'always', - square: 'always', - trail: 'always', - text: 'always', - tick: 'always' - }; - const ALL_MARKS_EXCEPT_GEOSHAPE = __rest(ALL_MARKS, ["geoshape"]); - /** - * Return a dictionary showing whether a channel supports mark type. - * @param channel - * @return A dictionary mapping mark types to 'always', 'binned', or undefined - */ - function getSupportedMark(channel) { - switch (channel) { - case COLOR: - case FILL: - case STROKE: - // falls through - case DESCRIPTION: - case DETAIL: - case KEY: - case TOOLTIP: - case HREF: - case ORDER: // TODO: revise (order might not support rect, which is not stackable?) - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEWIDTH: - // falls through - case FACET: - case ROW: // falls through - case COLUMN: - return ALL_MARKS; - case X: - case Y: - case LATITUDE: - case LONGITUDE: - // all marks except geoshape. geoshape does not use X, Y -- it uses a projection - return ALL_MARKS_EXCEPT_GEOSHAPE; - case X2: - case Y2: - case LATITUDE2: - case LONGITUDE2: - return { - area: 'always', - bar: 'always', - image: 'always', - rect: 'always', - rule: 'always', - circle: 'binned', - point: 'binned', - square: 'binned', - tick: 'binned', - line: 'binned', - trail: 'binned' - }; - case SIZE: - return { - point: 'always', - tick: 'always', - rule: 'always', - circle: 'always', - square: 'always', - bar: 'always', - text: 'always', - line: 'always', - trail: 'always' - }; - case STROKEDASH: - return { - line: 'always', - point: 'always', - tick: 'always', - rule: 'always', - circle: 'always', - square: 'always', - bar: 'always', - geoshape: 'always' - }; - case SHAPE: - return { point: 'always', geoshape: 'always' }; - case TEXT$1: - return { text: 'always' }; - case ANGLE: - return { point: 'always', square: 'always', text: 'always' }; - case URL: - return { image: 'always' }; - case THETA: - return { text: 'always', arc: 'always' }; - case RADIUS: - return { text: 'always', arc: 'always' }; - case THETA2: - case RADIUS2: - return { arc: 'always' }; - } - } - function rangeType(channel) { - switch (channel) { - case X: - case Y: - case THETA: - case RADIUS: - case SIZE: - case ANGLE: - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through] - case X2: - case Y2: - case THETA2: - case RADIUS2: - return undefined; - case FACET: - case ROW: - case COLUMN: - case SHAPE: - case STROKEDASH: - // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through] - case TEXT$1: - case TOOLTIP: - case HREF: - case URL: - case DESCRIPTION: - return 'discrete'; - // Color can be either continuous or discrete, depending on scale type. - case COLOR: - case FILL: - case STROKE: - return 'flexible'; - // No scale, no range type. - case LATITUDE: - case LONGITUDE: - case LATITUDE2: - case LONGITUDE2: - case DETAIL: - case KEY: - case ORDER: - return undefined; - } - } - - /** - * Create a key for the bin configuration. Not for prebinned bin. - */ - function binToString(bin) { - if (isBoolean(bin)) { - bin = normalizeBin(bin, undefined); - } - return ('bin' + - keys(bin) - .map(p => (isSelectionExtent(bin[p]) ? varName(`_${p}_${Object.entries(bin[p])}`) : varName(`_${p}_${bin[p]}`))) - .join('')); - } - /** - * Vega-Lite should bin the data. - */ - function isBinning(bin) { - return bin === true || (isBinParams(bin) && !bin.binned); - } - /** - * The data is already binned and so Vega-Lite should not bin it again. - */ - function isBinned(bin) { - return bin === 'binned' || (isBinParams(bin) && bin.binned === true); - } - function isBinParams(bin) { - return isObject(bin); - } - function isSelectionExtent(extent) { - return extent === null || extent === void 0 ? void 0 : extent['selection']; - } - function autoMaxBins(channel) { - switch (channel) { - case ROW: - case COLUMN: - case SIZE: - case COLOR: - case FILL: - case STROKE: - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - // Facets and Size shouldn't have too many bins - // We choose 6 like shape to simplify the rule [falls through] - case SHAPE: - return 6; // Vega's "shape" has 6 distinct values - case STROKEDASH: - return 4; // We only provide 5 different stroke dash values (but 4 is more effective) - default: - return 10; - } - } - - function invalidSpec(spec) { - return `Invalid specification ${JSON.stringify(spec)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`; - } - // FIT - const FIT_NON_SINGLE = 'Autosize "fit" only works for single views and layered views.'; - function containerSizeNonSingle(name) { - const uName = name == 'width' ? 'Width' : 'Height'; - return `${uName} "container" only works for single views and layered views.`; - } - function containerSizeNotCompatibleWithAutosize(name) { - const uName = name == 'width' ? 'Width' : 'Height'; - const fitDirection = name == 'width' ? 'x' : 'y'; - return `${uName} "container" only works well with autosize "fit" or "fit-${fitDirection}".`; - } - function droppingFit(channel) { - return channel - ? `Dropping "fit-${channel}" because spec has discrete ${getSizeChannel(channel)}.` - : `Dropping "fit" because spec has discrete size.`; - } - // VIEW SIZE - function unknownField(channel) { - return `Unknown field for ${channel}. Cannot calculate view size.`; - } - // SELECTION - function cannotProjectOnChannelWithoutField(channel) { - return `Cannot project a selection on encoding channel "${channel}", which has no field.`; - } - function cannotProjectAggregate(channel, aggregate) { - return `Cannot project a selection on encoding channel "${channel}" as it uses an aggregate function ("${aggregate}").`; - } - function nearestNotSupportForContinuous(mark) { - return `The "nearest" transform is not supported for ${mark} marks.`; - } - function selectionNotSupported(mark) { - return `Selection not supported for ${mark} yet.`; - } - function selectionNotFound(name) { - return `Cannot find a selection named "${name}".`; - } - const SCALE_BINDINGS_CONTINUOUS = 'Scale bindings are currently only supported for scales with unbinned, continuous domains.'; - const LEGEND_BINDINGS_MUST_HAVE_PROJECTION = 'Legend bindings are only supported for selections over an individual field or encoding channel.'; - function noSameUnitLookup(name) { - return (`Cannot define and lookup the "${name}" selection in the same view. ` + - `Try moving the lookup into a second, layered view?`); - } - const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.'; - const INTERVAL_INITIALIZED_WITH_X_Y = 'Interval selections should be initialized using "x" and/or "y" keys.'; - // REPEAT - function noSuchRepeatedValue(field) { - return `Unknown repeated value "${field}".`; - } - function columnsNotSupportByRowCol(type) { - return `The "columns" property cannot be used when "${type}" has nested row/column.`; - } - // CONCAT / REPEAT - const CONCAT_CANNOT_SHARE_AXIS = 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).'; - // DATA - function unrecognizedParse(p) { - return `Unrecognized parse "${p}".`; - } - function differentParse(field, local, ancestor) { - return `An ancestor parsed field "${field}" as ${ancestor} but a child wants to parse the field as ${local}.`; - } - const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.'; - // TRANSFORMS - function invalidTransformIgnored(transform) { - return `Ignoring an invalid transform: ${stringify(transform)}.`; - } - const NO_FIELDS_NEEDS_AS = 'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'; - // ENCODING & FACET - function customFormatTypeNotAllowed(channel) { - return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`; - } - function projectionOverridden(opt) { - const { parentProjection, projection } = opt; - return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(projection)}.`; - } - const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.'; - function primitiveChannelDef(channel, type, value) { - return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`; - } - function invalidFieldType(type) { - return `Invalid field type "${type}".`; - } - function invalidFieldTypeForCountAggregate(type, aggregate) { - return `Invalid field type "${type}" for aggregate: "${aggregate}", using "quantitative" instead.`; - } - function invalidAggregate(aggregate) { - return `Invalid aggregation operator "${aggregate}".`; - } - function droppingColor(type, opt) { - const { fill, stroke } = opt; - return `Dropping color ${type} as the plot also has ${fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'}.`; - } - function emptyFieldDef(fieldDef, channel) { - return `Dropping ${stringify(fieldDef)} from channel "${channel}" since it does not contain any data field, datum, value, or signal.`; - } - const LINE_WITH_VARYING_SIZE = 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.'; - function incompatibleChannel(channel, markOrFacet, when) { - return `${channel} dropped as it is incompatible with "${markOrFacet}"${when ? ` when ${when}` : ''}.`; - } - function invalidEncodingChannel(channel) { - return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`; - } - function facetChannelShouldBeDiscrete(channel) { - return `${channel} encoding should be discrete (ordinal / nominal / binned).`; - } - function facetChannelDropped(channels) { - return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`; - } - function discreteChannelCannotEncode(channel, type) { - return `Using discrete channel "${channel}" to encode "${type}" field can be misleading as it does not encode ${type === 'ordinal' ? 'order' : 'magnitude'}.`; - } - // MARK - function lineWithRange(hasX2, hasY2) { - const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2'; - return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`; - } - function orientOverridden(original, actual) { - return `Specified orient "${original}" overridden with "${actual}".`; - } - const RANGE_STEP_DEPRECATED = `Scale's "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.`; - function cannotUseScalePropertyWithNonColor(prop) { - return `Cannot use the scale property "${prop}" with non-color channel.`; - } - function unaggregateDomainHasNoEffectForRawField(fieldDef) { - return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`; - } - function unaggregateDomainWithNonSharedDomainOp(aggregate) { - return `Unaggregated domain not applicable for "${aggregate}" since it produces values outside the origin domain of the source data.`; - } - function unaggregatedDomainWithLogScale(fieldDef) { - return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`; - } - function cannotApplySizeToNonOrientedMark(mark) { - return `Cannot apply size to non-oriented mark "${mark}".`; - } - function scaleTypeNotWorkWithChannel(channel, scaleType, defaultScaleType) { - return `Channel "${channel}" does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; - } - function scaleTypeNotWorkWithFieldDef(scaleType, defaultScaleType) { - return `FieldDef does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; - } - function scalePropertyNotWorkWithScaleType(scaleType, propName, channel) { - return `${channel}-scale's "${propName}" is dropped as it does not work with ${scaleType} scale.`; - } - function stepDropped(channel) { - return `The step for "${channel}" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`; - } - function mergeConflictingProperty(property, propertyOf, v1, v2) { - return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify(v2)}). Using ${stringify(v1)}.`; - } - function mergeConflictingDomainProperty(property, propertyOf, v1, v2) { - return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify(v2)}). Using the union of the two domains.`; - } - function independentScaleMeansIndependentGuide(channel) { - return `Setting the scale to be independent for "${channel}" means we also have to set the guide (axis or legend) to be independent.`; - } - function domainSortDropped(sort) { - return `Dropping sort property ${stringify(sort)} as unioned domains only support boolean or op "count", "min", and "max".`; - } - const MORE_THAN_ONE_SORT = 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.'; - const FACETED_INDEPENDENT_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.'; - const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.'; - const FACETED_INDEPENDENT_SAME_SOURCE = 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.'; - // STACK - function cannotStackRangedMark(channel) { - return `Cannot stack "${channel}" if there is already "${channel}2".`; - } - function cannotStackNonLinearScale(scaleType) { - return `Cannot stack non-linear scale (${scaleType}).`; - } - function stackNonSummativeAggregate(aggregate) { - return `Stacking is applied even though the aggregate function is non-summative ("${aggregate}").`; - } - // TIMEUNIT - function invalidTimeUnit(unitName, value) { - return `Invalid ${unitName}: ${stringify(value)}.`; - } - function droppedDay(d) { - return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`; - } - function errorBarCenterAndExtentAreNotNeeded(center, extent) { - return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${extent && center ? 'are ' : 'is '}not needed when data are aggregated.`; - } - function errorBarCenterIsUsedWithWrongExtent(center, extent, mark) { - return `${center} is not usually used with ${extent} for ${mark}.`; - } - function errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark) { - return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`; - } - function errorBand1DNotSupport(property) { - return `1D error band does not support ${property}.`; - } - // CHANNEL - function channelRequiredForBinned(channel) { - return `Channel ${channel} is required for "binned" bin.`; - } - function channelShouldNotBeUsedForBinned(channel) { - return `Channel ${channel} should not be used with "binned" bin.`; - } - function domainRequiredForThresholdScale(channel) { - return `Domain for ${channel} is required for threshold scale.`; - } - - /** - * Vega-Lite's singleton logger utility. - */ - var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; - }; - var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); - }; - /** - * Main (default) Vega Logger instance for Vega-Lite. - */ - const main = logger(Warn); - let current = main; - /** - * Set the singleton logger to be a custom logger. - */ - function set(newLogger) { - current = newLogger; - return current; - } - /** - * Reset the main logger to use the default Vega Logger. - */ - function reset() { - current = main; - return current; - } - function warn(...args) { - current.warn(...args); - } - function debug(...args) { - current.debug(...args); - } - - // DateTime definition object - function isDateTime(o) { - if (o && isObject(o)) { - for (const part of TIMEUNIT_PARTS) { - if (part in o) { - return true; - } - } - } - return false; - } - const MONTHS = [ - 'january', - 'february', - 'march', - 'april', - 'may', - 'june', - 'july', - 'august', - 'september', - 'october', - 'november', - 'december' - ]; - const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3)); - const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; - const SHORT_DAYS = DAYS.map(d => d.substr(0, 3)); - function normalizeQuarter(q) { - if (isNumeric(q)) { - q = +q; - } - if (isNumber(q)) { - if (q > 4) { - warn(invalidTimeUnit('quarter', q)); - } - // We accept 1-based quarter, so need to readjust to 0-based quarter - return q - 1; - } - else { - // Invalid quarter - throw new Error(invalidTimeUnit('quarter', q)); - } - } - function normalizeMonth(m) { - if (isNumeric(m)) { - m = +m; - } - if (isNumber(m)) { - // We accept 1-based month, so need to readjust to 0-based month - return m - 1; - } - else { - const lowerM = m.toLowerCase(); - const monthIndex = MONTHS.indexOf(lowerM); - if (monthIndex !== -1) { - return monthIndex; // 0 for january, ... - } - const shortM = lowerM.substr(0, 3); - const shortMonthIndex = SHORT_MONTHS.indexOf(shortM); - if (shortMonthIndex !== -1) { - return shortMonthIndex; - } - // Invalid month - throw new Error(invalidTimeUnit('month', m)); - } - } - function normalizeDay(d) { - if (isNumeric(d)) { - d = +d; - } - if (isNumber(d)) { - // mod so that this can be both 0-based where 0 = sunday - // and 1-based where 7=sunday - return d % 7; - } - else { - const lowerD = d.toLowerCase(); - const dayIndex = DAYS.indexOf(lowerD); - if (dayIndex !== -1) { - return dayIndex; // 0 for january, ... - } - const shortD = lowerD.substr(0, 3); - const shortDayIndex = SHORT_DAYS.indexOf(shortD); - if (shortDayIndex !== -1) { - return shortDayIndex; - } - // Invalid day - throw new Error(invalidTimeUnit('day', d)); - } - } - /** - * @param d the date. - * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime. - * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds] - */ - function dateTimeParts(d, normalize) { - const parts = []; - if (normalize && d.day !== undefined) { - if (keys(d).length > 1) { - warn(droppedDay(d)); - d = duplicate(d); - delete d.day; - } - } - if (d.year !== undefined) { - parts.push(d.year); - } - else { - // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega - // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year). - parts.push(2012); - } - if (d.month !== undefined) { - const month = normalize ? normalizeMonth(d.month) : d.month; - parts.push(month); - } - else if (d.quarter !== undefined) { - const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter; - parts.push(isNumber(quarter) ? quarter * 3 : quarter + '*3'); - } - else { - parts.push(0); // months start at zero in JS - } - if (d.date !== undefined) { - parts.push(d.date); - } - else if (d.day !== undefined) { - // HACK: Day only works as a standalone unit - // This is only correct because we always set year to 2006 for day - const day = normalize ? normalizeDay(d.day) : d.day; - parts.push(isNumber(day) ? day + 1 : day + '+1'); - } - else { - parts.push(1); // Date starts at 1 in JS - } - // Note: can't use TimeUnit enum here as importing it will create - // circular dependency problem! - for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds']) { - const unit = d[timeUnit]; - parts.push(typeof unit === 'undefined' ? 0 : unit); - } - return parts; - } - /** - * Return Vega expression for a date time. - * - * @param d the date time. - * @returns the Vega expression. - */ - function dateTimeToExpr(d) { - const parts = dateTimeParts(d, true); - const string = parts.join(', '); - if (d.utc) { - return `utc(${string})`; - } - else { - return `datetime(${string})`; - } - } - /** - * Return Vega expression for a date time expression. - * - * @param d the internal date time object with expression. - * @returns the Vega expression. - */ - function dateTimeExprToExpr(d) { - const parts = dateTimeParts(d, false); - const string = parts.join(', '); - if (d.utc) { - return `utc(${string})`; - } - else { - return `datetime(${string})`; - } - } - /** - * @param d the date time. - * @returns the timestamp. - */ - function dateTimeToTimestamp(d) { - const parts = dateTimeParts(d, true); - if (d.utc) { - return +new Date(Date.UTC(...parts)); - } - else { - return +new Date(...parts); - } - } - - /** Time Unit that only corresponds to only one part of Date objects. */ - const LOCAL_SINGLE_TIMEUNIT_INDEX = { - year: 1, - quarter: 1, - month: 1, - week: 1, - day: 1, - dayofyear: 1, - date: 1, - hours: 1, - minutes: 1, - seconds: 1, - milliseconds: 1 - }; - const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX); - function isLocalSingleTimeUnit(timeUnit) { - return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit]; - } - function isUTCTimeUnit(t) { - return t.startsWith('utc'); - } - function getLocalTimeUnit(t) { - return t.substr(3); - } - // In order of increasing specificity - const VEGALITE_TIMEFORMAT = { - 'year-month': '%b %Y ', - 'year-month-date': '%b %d, %Y ' - }; - function getTimeUnitParts(timeUnit) { - const parts = []; - for (const part of TIMEUNIT_PARTS) { - if (containsTimeUnit(timeUnit, part)) { - parts.push(part); - } - } - return parts; - } - /** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */ - function containsTimeUnit(fullTimeUnit, timeUnit) { - const index = fullTimeUnit.indexOf(timeUnit); - if (index < 0) { - return false; - } - // exclude milliseconds - if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') { - return false; - } - // exclude dayofyear - if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') { - return false; - } - if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') { - return false; - } - return true; - } - /** - * Returns Vega expression for a given timeUnit and fieldRef - */ - function fieldExpr(fullTimeUnit, field, { end } = { end: false }) { - const fieldRef = accessPathWithDatum(field); - const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : ''; - function func(timeUnit) { - if (timeUnit === 'quarter') { - // quarter starting at 0 (0,3,6,9). - return `(${utc}quarter(${fieldRef})-1)`; - } - else { - return `${utc}${timeUnit}(${fieldRef})`; - } - } - let lastTimeUnit; - const dateExpr = {}; - for (const part of TIMEUNIT_PARTS) { - if (containsTimeUnit(fullTimeUnit, part)) { - dateExpr[part] = func(part); - lastTimeUnit = part; - } - } - if (end) { - dateExpr[lastTimeUnit] += '+1'; - } - return dateTimeExprToExpr(dateExpr); - } - function timeUnitSpecifierExpression(timeUnit) { - if (!timeUnit) { - return undefined; - } - const timeUnitParts = getTimeUnitParts(timeUnit); - return `timeUnitSpecifier(${fastJsonStableStringify(timeUnitParts)}, ${fastJsonStableStringify(VEGALITE_TIMEFORMAT)})`; - } - /** - * Returns the signal expression used for axis labels for a time unit. - */ - function formatExpression(timeUnit, field, isUTCScale) { - if (!timeUnit) { - return undefined; - } - const expr = timeUnitSpecifierExpression(timeUnit); - // We only use utcFormat for utc scale - // For utc time units, the data is already converted as a part of timeUnit transform. - // Thus, utc time units should use timeFormat to avoid shifting the time twice. - const utc = isUTCScale || isUTCTimeUnit(timeUnit); - return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`; - } - function normalizeTimeUnit(timeUnit) { - if (!timeUnit) { - return undefined; - } - let params; - if (isString(timeUnit)) { - params = { - unit: timeUnit - }; - } - else if (isObject(timeUnit)) { - params = Object.assign(Object.assign({}, timeUnit), (timeUnit.unit ? { unit: timeUnit.unit } : {})); - } - if (isUTCTimeUnit(params.unit)) { - params.utc = true; - params.unit = getLocalTimeUnit(params.unit); - } - return params; - } - function timeUnitToString(tu) { - const _a = normalizeTimeUnit(tu), { utc } = _a, rest = __rest(_a, ["utc"]); - if (rest.unit) { - return ((utc ? 'utc' : '') + - keys(rest) - .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`)) - .join('')); - } - else { - // when maxbins is specified instead of units - return ((utc ? 'utc' : '') + - 'timeunit' + - keys(rest) - .map(p => varName(`_${p}_${rest[p]}`)) - .join('')); - } - } - - function isSignalRef(o) { - return o && !!o['signal']; - } - function isVgRangeStep(range) { - return !!range['step']; - } - function isDataRefUnionedDomain(domain) { - if (!isArray(domain)) { - return 'fields' in domain && !('data' in domain); - } - return false; - } - function isFieldRefUnionDomain(domain) { - if (!isArray(domain)) { - return 'fields' in domain && 'data' in domain; - } - return false; - } - function isDataRefDomain(domain) { - if (!isArray(domain)) { - return 'field' in domain && 'data' in domain; - } - return false; - } - const VG_MARK_CONFIG_INDEX = { - aria: 1, - description: 1, - ariaRole: 1, - ariaRoleDescription: 1, - blend: 1, - opacity: 1, - fill: 1, - fillOpacity: 1, - stroke: 1, - strokeCap: 1, - strokeWidth: 1, - strokeOpacity: 1, - strokeDash: 1, - strokeDashOffset: 1, - strokeJoin: 1, - strokeOffset: 1, - strokeMiterLimit: 1, - startAngle: 1, - endAngle: 1, - padAngle: 1, - innerRadius: 1, - outerRadius: 1, - size: 1, - shape: 1, - interpolate: 1, - tension: 1, - orient: 1, - align: 1, - baseline: 1, - text: 1, - dir: 1, - dx: 1, - dy: 1, - ellipsis: 1, - limit: 1, - radius: 1, - theta: 1, - angle: 1, - font: 1, - fontSize: 1, - fontWeight: 1, - fontStyle: 1, - lineBreak: 1, - lineHeight: 1, - cursor: 1, - href: 1, - tooltip: 1, - cornerRadius: 1, - cornerRadiusTopLeft: 1, - cornerRadiusTopRight: 1, - cornerRadiusBottomLeft: 1, - cornerRadiusBottomRight: 1, - aspect: 1, - width: 1, - height: 1 - // commented below are vg channel that do not have mark config. - // x: 1, - // y: 1, - // x2: 1, - // y2: 1, - // xc'|'yc' - // clip: 1, - // path: 1, - // url: 1, - }; - const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX); - const VG_MARK_INDEX = { - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - // Vega's cornerRadius channels. - const VG_CORNERRADIUS_CHANNELS = [ - 'cornerRadius', - 'cornerRadiusTopLeft', - 'cornerRadiusTopRight', - 'cornerRadiusBottomLeft', - 'cornerRadiusBottomRight' - ]; - - function isSelectionPredicate(predicate) { - return predicate === null || predicate === void 0 ? void 0 : predicate['selection']; - } - function isFieldEqualPredicate(predicate) { - return predicate && !!predicate.field && predicate.equal !== undefined; - } - function isFieldLTPredicate(predicate) { - return predicate && !!predicate.field && predicate.lt !== undefined; - } - function isFieldLTEPredicate(predicate) { - return predicate && !!predicate.field && predicate.lte !== undefined; - } - function isFieldGTPredicate(predicate) { - return predicate && !!predicate.field && predicate.gt !== undefined; - } - function isFieldGTEPredicate(predicate) { - return predicate && !!predicate.field && predicate.gte !== undefined; - } - function isFieldRangePredicate(predicate) { - if (predicate && predicate.field) { - if (isArray(predicate.range) && predicate.range.length === 2) { - return true; - } - else if (isSignalRef(predicate.range)) { - return true; - } - } - return false; - } - function isFieldOneOfPredicate(predicate) { - return (predicate && !!predicate.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility - ); - } - function isFieldValidPredicate(predicate) { - return predicate && !!predicate.field && predicate.valid !== undefined; - } - function isFieldPredicate(predicate) { - return (isFieldOneOfPredicate(predicate) || - isFieldEqualPredicate(predicate) || - isFieldRangePredicate(predicate) || - isFieldLTPredicate(predicate) || - isFieldGTPredicate(predicate) || - isFieldLTEPredicate(predicate) || - isFieldGTEPredicate(predicate)); - } - function predicateValueExpr(v, timeUnit) { - return valueExpr(v, { timeUnit, wrapTime: true }); - } - function predicateValuesExpr(vals, timeUnit) { - return vals.map(v => predicateValueExpr(v, timeUnit)); - } - // This method is used by Voyager. Do not change its behavior without changing Voyager. - function fieldFilterExpression(predicate, useInRange = true) { - var _a; - const { field } = predicate; - const timeUnit = (_a = normalizeTimeUnit(predicate.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit; - const fieldExpr$1 = timeUnit - ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly. - // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline - // TODO: support utc - 'time(' + fieldExpr(timeUnit, field) + ')' - : vgField(predicate, { expr: 'datum' }); - if (isFieldEqualPredicate(predicate)) { - return fieldExpr$1 + '===' + predicateValueExpr(predicate.equal, timeUnit); - } - else if (isFieldLTPredicate(predicate)) { - const upper = predicate.lt; - return `${fieldExpr$1}<${predicateValueExpr(upper, timeUnit)}`; - } - else if (isFieldGTPredicate(predicate)) { - const lower = predicate.gt; - return `${fieldExpr$1}>${predicateValueExpr(lower, timeUnit)}`; - } - else if (isFieldLTEPredicate(predicate)) { - const upper = predicate.lte; - return `${fieldExpr$1}<=${predicateValueExpr(upper, timeUnit)}`; - } - else if (isFieldGTEPredicate(predicate)) { - const lower = predicate.gte; - return `${fieldExpr$1}>=${predicateValueExpr(lower, timeUnit)}`; - } - else if (isFieldOneOfPredicate(predicate)) { - return `indexof([${predicateValuesExpr(predicate.oneOf, timeUnit).join(',')}], ${fieldExpr$1}) !== -1`; - } - else if (isFieldValidPredicate(predicate)) { - return fieldValidPredicate(fieldExpr$1, predicate.valid); - } - else if (isFieldRangePredicate(predicate)) { - const { range } = predicate; - const lower = isSignalRef(range) ? { signal: `${range.signal}[0]` } : range[0]; - const upper = isSignalRef(range) ? { signal: `${range.signal}[1]` } : range[1]; - if (lower !== null && upper !== null && useInRange) { - return ('inrange(' + - fieldExpr$1 + - ', [' + - predicateValueExpr(lower, timeUnit) + - ', ' + - predicateValueExpr(upper, timeUnit) + - '])'); - } - const exprs = []; - if (lower !== null) { - exprs.push(`${fieldExpr$1} >= ${predicateValueExpr(lower, timeUnit)}`); - } - if (upper !== null) { - exprs.push(`${fieldExpr$1} <= ${predicateValueExpr(upper, timeUnit)}`); - } - return exprs.length > 0 ? exprs.join(' && ') : 'true'; - } - /* istanbul ignore next: it should never reach here */ - throw new Error(`Invalid field predicate: ${JSON.stringify(predicate)}`); - } - function fieldValidPredicate(fieldExpr, valid = true) { - if (valid) { - return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`; - } - else { - return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`; - } - } - function normalizePredicate(f) { - var _a; - if (isFieldPredicate(f) && f.timeUnit) { - return Object.assign(Object.assign({}, f), { timeUnit: (_a = normalizeTimeUnit(f.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit }); - } - return f; - } - - /** - * Data type based on level of measurement - */ - const Type = { - quantitative: 'quantitative', - ordinal: 'ordinal', - temporal: 'temporal', - nominal: 'nominal', - geojson: 'geojson' - }; - const QUANTITATIVE = Type.quantitative; - const ORDINAL = Type.ordinal; - const TEMPORAL = Type.temporal; - const NOMINAL = Type.nominal; - const GEOJSON = Type.geojson; - /** - * Get full, lowercase type name for a given type. - * @param type - * @return Full type name. - */ - function getFullName(type) { - if (type) { - type = type.toLowerCase(); - switch (type) { - case 'q': - case QUANTITATIVE: - return 'quantitative'; - case 't': - case TEMPORAL: - return 'temporal'; - case 'o': - case ORDINAL: - return 'ordinal'; - case 'n': - case NOMINAL: - return 'nominal'; - case GEOJSON: - return 'geojson'; - } - } - // If we get invalid input, return undefined type. - return undefined; - } - - const ScaleType = { - // Continuous - Quantitative - LINEAR: 'linear', - LOG: 'log', - POW: 'pow', - SQRT: 'sqrt', - SYMLOG: 'symlog', - IDENTITY: 'identity', - SEQUENTIAL: 'sequential', - // Continuous - Time - TIME: 'time', - UTC: 'utc', - // Discretizing scales - QUANTILE: 'quantile', - QUANTIZE: 'quantize', - THRESHOLD: 'threshold', - BIN_ORDINAL: 'bin-ordinal', - // Discrete scales - ORDINAL: 'ordinal', - POINT: 'point', - BAND: 'band' - }; - /** - * Index for scale categories -- only scale of the same categories can be merged together. - * Current implementation is trying to be conservative and avoid merging scale type that might not work together - */ - const SCALE_CATEGORY_INDEX = { - linear: 'numeric', - log: 'numeric', - pow: 'numeric', - sqrt: 'numeric', - symlog: 'numeric', - identity: 'numeric', - sequential: 'numeric', - time: 'time', - utc: 'time', - ordinal: 'ordinal', - 'bin-ordinal': 'bin-ordinal', - point: 'ordinal-position', - band: 'ordinal-position', - quantile: 'discretizing', - quantize: 'discretizing', - threshold: 'discretizing' - }; - /** - * Whether the two given scale types can be merged together. - */ - function scaleCompatible(scaleType1, scaleType2) { - const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1]; - const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2]; - return (scaleCategory1 === scaleCategory2 || - (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') || - (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time')); - } - /** - * Index for scale precedence -- high score = higher priority for merging. - */ - const SCALE_PRECEDENCE_INDEX = { - // numeric - linear: 0, - log: 1, - pow: 1, - sqrt: 1, - symlog: 1, - identity: 1, - sequential: 1, - // time - time: 0, - utc: 0, - // ordinal-position -- these have higher precedence than continuous scales as they support more types of data - point: 10, - band: 11, - // non grouped types - ordinal: 0, - 'bin-ordinal': 0, - quantile: 0, - quantize: 0, - threshold: 0 - }; - /** - * Return scale categories -- only scale of the same categories can be merged together. - */ - function scaleTypePrecedence(scaleType) { - return SCALE_PRECEDENCE_INDEX[scaleType]; - } - const CONTINUOUS_TO_CONTINUOUS_SCALES = ['linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc']; - const CONTINUOUS_TO_CONTINUOUS_INDEX = toSet(CONTINUOUS_TO_CONTINUOUS_SCALES); - const QUANTITATIVE_SCALES = ['linear', 'log', 'pow', 'sqrt', 'symlog']; - const QUANTITATIVE_SCALES_INDEX = toSet(QUANTITATIVE_SCALES); - function isQuantitative(type) { - return type in QUANTITATIVE_SCALES_INDEX; - } - const CONTINUOUS_TO_DISCRETE_SCALES = ['quantile', 'quantize', 'threshold']; - const CONTINUOUS_TO_DISCRETE_INDEX = toSet(CONTINUOUS_TO_DISCRETE_SCALES); - const CONTINUOUS_DOMAIN_SCALES = CONTINUOUS_TO_CONTINUOUS_SCALES.concat([ - 'quantile', - 'quantize', - 'threshold', - 'sequential', - 'identity' - ]); - const CONTINUOUS_DOMAIN_INDEX = toSet(CONTINUOUS_DOMAIN_SCALES); - const DISCRETE_DOMAIN_SCALES = ['ordinal', 'bin-ordinal', 'point', 'band']; - const DISCRETE_DOMAIN_INDEX = toSet(DISCRETE_DOMAIN_SCALES); - function hasDiscreteDomain(type) { - return type in DISCRETE_DOMAIN_INDEX; - } - function hasContinuousDomain(type) { - return type in CONTINUOUS_DOMAIN_INDEX; - } - function isContinuousToContinuous(type) { - return type in CONTINUOUS_TO_CONTINUOUS_INDEX; - } - function isContinuousToDiscrete(type) { - return type in CONTINUOUS_TO_DISCRETE_INDEX; - } - const defaultScaleConfig = { - pointPadding: 0.5, - barBandPaddingInner: 0.1, - rectBandPaddingInner: 0, - minBandSize: 2, - minFontSize: 8, - maxFontSize: 40, - minOpacity: 0.3, - maxOpacity: 0.8, - // FIXME: revise if these *can* become ratios of width/height step - minSize: 9, - minStrokeWidth: 1, - maxStrokeWidth: 4, - quantileCount: 4, - quantizeCount: 4 - }; - function isExtendedScheme(scheme) { - return !isString(scheme) && !!scheme['name']; - } - function isSelectionDomain(domain) { - return domain === null || domain === void 0 ? void 0 : domain['selection']; - } - function isDomainUnionWith(domain) { - return domain && domain['unionWith']; - } - const SCALE_PROPERTY_INDEX = { - type: 1, - domain: 1, - domainMax: 1, - domainMin: 1, - domainMid: 1, - align: 1, - range: 1, - rangeMax: 1, - rangeMin: 1, - scheme: 1, - bins: 1, - // Other properties - reverse: 1, - round: 1, - // quantitative / time - clamp: 1, - nice: 1, - // quantitative - base: 1, - exponent: 1, - constant: 1, - interpolate: 1, - zero: 1, - // band/point - padding: 1, - paddingInner: 1, - paddingOuter: 1 - }; - const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX = __rest(SCALE_PROPERTY_INDEX, ["type", "domain", "range", "rangeMax", "rangeMin", "scheme"]); - const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX); - function scaleTypeSupportProperty(scaleType, propName) { - switch (propName) { - case 'type': - case 'domain': - case 'reverse': - case 'range': - return true; - case 'scheme': - case 'interpolate': - return !contains(['point', 'band', 'identity'], scaleType); - case 'bins': - return !contains(['point', 'band', 'identity', 'ordinal'], scaleType); - case 'round': - return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point'; - case 'padding': - case 'rangeMin': - case 'rangeMax': - return isContinuousToContinuous(scaleType) || contains(['point', 'band'], scaleType); - case 'paddingOuter': - case 'align': - return contains(['point', 'band'], scaleType); - case 'paddingInner': - return scaleType === 'band'; - case 'domainMax': - case 'domainMid': - case 'domainMin': - case 'clamp': - return isContinuousToContinuous(scaleType); - case 'nice': - return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold'; - case 'exponent': - return scaleType === 'pow'; - case 'base': - return scaleType === 'log'; - case 'constant': - return scaleType === 'symlog'; - case 'zero': - return (hasContinuousDomain(scaleType) && - !contains([ - 'log', - 'time', - 'utc', - 'threshold', - 'quantile' // quantile depends on distribution so zero does not matter - ], scaleType)); - } - } - /** - * Returns undefined if the input channel supports the input scale property name - */ - function channelScalePropertyIncompatability(channel, propName) { - switch (propName) { - case 'interpolate': - case 'scheme': - case 'domainMid': - if (!isColorChannel(channel)) { - return cannotUseScalePropertyWithNonColor(channel); - } - return undefined; - case 'align': - case 'type': - case 'bins': - case 'domain': - case 'domainMax': - case 'domainMin': - case 'range': - case 'base': - case 'exponent': - case 'constant': - case 'nice': - case 'padding': - case 'paddingInner': - case 'paddingOuter': - case 'rangeMax': - case 'rangeMin': - case 'reverse': - case 'round': - case 'clamp': - case 'zero': - return undefined; // GOOD! - } - } - function scaleTypeSupportDataType(specifiedType, fieldDefType) { - if (contains([ORDINAL, NOMINAL], fieldDefType)) { - return specifiedType === undefined || hasDiscreteDomain(specifiedType); - } - else if (fieldDefType === TEMPORAL) { - return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType); - } - else if (fieldDefType === QUANTITATIVE) { - return contains([ - ScaleType.LOG, - ScaleType.POW, - ScaleType.SQRT, - ScaleType.SYMLOG, - ScaleType.QUANTILE, - ScaleType.QUANTIZE, - ScaleType.THRESHOLD, - ScaleType.LINEAR, - undefined - ], specifiedType); - } - return true; - } - function channelSupportScaleType(channel, scaleType) { - if (!isScaleChannel(channel)) { - return false; - } - switch (channel) { - case X: - case Y: - case THETA: - case RADIUS: - return isContinuousToContinuous(scaleType) || contains(['band', 'point'], scaleType); - case SIZE: // TODO: size and opacity can support ordinal with more modification - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case ANGLE: - // Although it generally doesn't make sense to use band with size and opacity, - // it can also work since we use band: 0.5 to get midpoint. - return (isContinuousToContinuous(scaleType) || - isContinuousToDiscrete(scaleType) || - contains(['band', 'point', 'ordinal'], scaleType)); - case COLOR: - case FILL: - case STROKE: - return scaleType !== 'band'; // band does not make sense with color - case STROKEDASH: - return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType); - case SHAPE: - return scaleType === 'ordinal'; // shape = lookup only - } - } - - function midPointRefWithPositionInvalidTest(params) { - const { channel, channelDef, markDef, scale, config } = params; - const ref = midPoint(params); - // Wrap to check if the positional value is invalid, if so, plot the point on the min value - if ( - // Only this for field def without counting aggregate (as count wouldn't be null) - isFieldDef(channelDef) && - !isCountingAggregateOp(channelDef.aggregate) && - // and only for continuous scale without zero (otherwise, null / invalid will be interpreted as zero, which doesn't cause layout problem) - scale && - isContinuousToContinuous(scale.get('type')) && - scale.get('zero') === false) { - return wrapPositionInvalidTest({ - fieldDef: channelDef, - channel, - markDef, - ref, - config - }); - } - return ref; - } - function wrapPositionInvalidTest({ fieldDef, channel, markDef, ref, config }) { - if (isPathMark(markDef.type)) { - // path mark already use defined to skip points, no need to do it here. - return ref; - } - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid === null) { - // if there is no invalid filter, don't do the invalid test - return ref; - } - return [fieldInvalidTestValueRef(fieldDef, channel), ref]; - } - function fieldInvalidTestValueRef(fieldDef, channel) { - const test = fieldInvalidPredicate(fieldDef, true); - const mainChannel = getMainRangeChannel(channel); // we can cast here as the output can't be other things. - const zeroValueRef = mainChannel === 'y' - ? { field: { group: 'height' } } - : // x / angle / radius can all use 0 - { value: 0 }; - return Object.assign({ test }, zeroValueRef); - } - function fieldInvalidPredicate(field, invalid = true) { - return fieldValidPredicate(isString(field) ? field : vgField(field, { expr: 'datum' }), !invalid); - } - function datumDefToExpr(datumDef) { - const { datum } = datumDef; - if (isDateTime(datum)) { - return dateTimeToExpr(datum); - } - return `${JSON.stringify(datum)}`; - } - function valueRefForFieldOrDatumDef(fieldDef, scaleName, opt, encode) { - const ref = {}; - if (scaleName) { - ref.scale = scaleName; - } - if (isDatumDef(fieldDef)) { - const { datum } = fieldDef; - if (isDateTime(datum)) { - ref.signal = dateTimeToExpr(datum); - } - else if (isSignalRef(datum)) { - ref.signal = datum.signal; - } - else { - ref.value = datum; - } - } - else { - ref.field = vgField(fieldDef, opt); - } - if (encode) { - const { offset, band } = encode; - if (offset) { - ref.offset = offset; - } - if (band) { - ref.band = band; - } - } - return ref; - } - /** - * Signal that returns the middle of a bin from start and end field. Should only be used with x and y. - */ - function interpolatedSignalRef({ scaleName, fieldOrDatumDef, fieldOrDatumDef2, offset, startSuffix, band = 0.5 }) { - const expr = 0 < band && band < 1 ? 'datum' : undefined; - const start = vgField(fieldOrDatumDef, { expr, suffix: startSuffix }); - const end = fieldOrDatumDef2 !== undefined - ? vgField(fieldOrDatumDef2, { expr }) - : vgField(fieldOrDatumDef, { suffix: 'end', expr }); - const ref = {}; - if (band === 0 || band === 1) { - ref.scale = scaleName; - const val = band === 0 ? start : end; - ref.field = val; - } - else { - const datum = `${band} * ${start} + ${1 - band} * ${end}`; - ref.signal = `scale("${scaleName}", ${datum})`; - } - if (offset) { - ref.offset = offset; - } - return ref; - } - /** - * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels. - */ - function midPoint({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef, band }) { - var _a; - // TODO: datum support - if (channelDef) { - /* istanbul ignore else */ - if (isFieldOrDatumDef(channelDef)) { - if (isTypedFieldDef(channelDef)) { - band = band !== null && band !== void 0 ? band : getBand({ - channel, - fieldDef: channelDef, - fieldDef2: channel2Def, - markDef, - stack, - config, - isMidPoint: true - }); - const { bin, timeUnit, type } = channelDef; - if (isBinning(bin) || (band && timeUnit && type === TEMPORAL)) { - // Use middle only for x an y to place marks in the center between start and end of the bin range. - // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match. - if (stack && stack.impute) { - // For stack, we computed bin_mid so we can impute. - return valueRefForFieldOrDatumDef(channelDef, scaleName, { binSuffix: 'mid' }, { offset }); - } - if (band) { - // if band = 0, no need to call interpolation - // For non-stack, we can just calculate bin mid on the fly using signal. - return interpolatedSignalRef({ scaleName, fieldOrDatumDef: channelDef, band, offset }); - } - return valueRefForFieldOrDatumDef(channelDef, scaleName, binRequiresRange(channelDef, channel) ? { binSuffix: 'range' } : {}, { - offset - }); - } - else if (isBinned(bin)) { - if (isFieldDef(channel2Def)) { - return interpolatedSignalRef({ - scaleName, - fieldOrDatumDef: channelDef, - fieldOrDatumDef2: channel2Def, - band, - offset - }); - } - else { - const channel2 = channel === X ? X2 : Y2; - warn(channelRequiredForBinned(channel2)); - } - } - } - const scaleType = scale === null || scale === void 0 ? void 0 : scale.get('type'); - return valueRefForFieldOrDatumDef(channelDef, scaleName, hasDiscreteDomain(scaleType) ? { binSuffix: 'range' } : {}, // no need for bin suffix if there is no scale - { - offset, - // For band, to get mid point, need to offset by half of the band - band: scaleType === 'band' ? (_a = band !== null && band !== void 0 ? band : channelDef.band) !== null && _a !== void 0 ? _a : 0.5 : undefined - }); - } - else if (isValueDef(channelDef)) { - const value = channelDef.value; - const offsetMixins = offset ? { offset } : {}; - return Object.assign(Object.assign({}, widthHeightValueOrSignalRef(channel, value)), offsetMixins); - } - // If channelDef is neither field def or value def, it's a condition-only def. - // In such case, we will use default ref. - } - if (isFunction(defaultRef)) { - defaultRef = defaultRef(); - } - if (defaultRef) { - // for non-position, ref could be undefined. - return Object.assign(Object.assign({}, defaultRef), (offset ? { offset } : {})); - } - return defaultRef; - } - /** - * Convert special "width" and "height" values in Vega-Lite into Vega value ref. - */ - function widthHeightValueOrSignalRef(channel, value) { - if (contains(['x', 'x2'], channel) && value === 'width') { - return { field: { group: 'width' } }; - } - else if (contains(['y', 'y2'], channel) && value === 'height') { - return { field: { group: 'height' } }; - } - return signalOrValueRef(value); - } - - function isCustomFormatType(formatType) { - return formatType && formatType !== 'number' && formatType !== 'time'; - } - function customFormatExpr(formatType, field, format) { - return `${formatType}(${field}${format ? `, ${JSON.stringify(format)}` : ''})`; - } - const BIN_RANGE_DELIMITER = ' \u2013 '; - function formatSignalRef({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config }) { - var _a, _b; - if (isCustomFormatType(formatType)) { - return formatCustomType({ - fieldOrDatumDef, - format, - formatType, - expr, - config - }); - } - const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack); - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { - const signal = timeFormatExpression(field, isFieldDef(fieldOrDatumDef) ? (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit : undefined, format, config.timeFormat, isScaleFieldDef(fieldOrDatumDef) && ((_b = fieldOrDatumDef.scale) === null || _b === void 0 ? void 0 : _b.type) === ScaleType.UTC); - return signal ? { signal } : undefined; - } - format = numberFormat(channelDefType(fieldOrDatumDef), format, config); - if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { - const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' }); - return { - signal: binFormatExpression(field, endField, format, formatType, config) - }; - } - else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') { - return { - signal: `${formatExpr(field, format)}` - }; - } - else { - return { signal: `isValid(${field}) ? ${field} : ""+${field}` }; - } - } - function fieldToFormat(fieldOrDatumDef, expr, normalizeStack) { - if (isFieldDef(fieldOrDatumDef)) { - if (normalizeStack) { - return `${vgField(fieldOrDatumDef, { expr, suffix: 'end' })}-${vgField(fieldOrDatumDef, { - expr, - suffix: 'start' - })}`; - } - else { - return vgField(fieldOrDatumDef, { expr }); - } - } - else { - return datumDefToExpr(fieldOrDatumDef); - } - } - function formatCustomType({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config, field }) { - field = field !== null && field !== void 0 ? field : fieldToFormat(fieldOrDatumDef, expr, normalizeStack); - if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { - const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' }); - return { - signal: binFormatExpression(field, endField, format, formatType, config) - }; - } - return { signal: customFormatExpr(formatType, field, format) }; - } - function guideFormat(fieldOrDatumDef, type, format, formatType, config, omitTimeFormatConfig // axis doesn't use config.timeFormat - ) { - var _a; - if (isCustomFormatType(formatType)) { - return undefined; // handled in encode block - } - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { - const timeUnit = isFieldDef(fieldOrDatumDef) ? (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit : undefined; - return timeFormat(format, timeUnit, config, omitTimeFormatConfig); - } - return numberFormat(type, format, config); - } - function guideFormatType(formatType, fieldOrDatumDef, scaleType) { - if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) { - return formatType; - } - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') { - return 'time'; - } - return undefined; - } - /** - * Returns number format for a fieldDef. - */ - function numberFormat(type, specifiedFormat, config) { - // Specified format in axis/legend has higher precedence than fieldDef.format - if (isString(specifiedFormat)) { - return specifiedFormat; - } - if (type === QUANTITATIVE) { - // we only apply the default if the field is quantitative - return config.numberFormat; - } - return undefined; - } - /** - * Returns time format for a fieldDef for use in guides. - */ - function timeFormat(specifiedFormat, timeUnit, config, omitTimeFormatConfig) { - if (specifiedFormat) { - return specifiedFormat; - } - if (timeUnit) { - return { - signal: timeUnitSpecifierExpression(timeUnit) - }; - } - return omitTimeFormatConfig ? undefined : config.timeFormat; - } - function formatExpr(field, format) { - return `format(${field}, "${format || ''}")`; - } - function binNumberFormatExpr(field, format, formatType, config) { - var _a; - if (isCustomFormatType(formatType)) { - return customFormatExpr(formatType, field, format); - } - return formatExpr(field, (_a = (isString(format) ? format : undefined)) !== null && _a !== void 0 ? _a : config.numberFormat); - } - function binFormatExpression(startField, endField, format, formatType, config) { - const start = binNumberFormatExpr(startField, format, formatType, config); - const end = binNumberFormatExpr(endField, format, formatType, config); - return `${fieldValidPredicate(startField, false)} ? "null" : ${start} + "${BIN_RANGE_DELIMITER}" + ${end}`; - } - /** - * Returns the time expression used for axis/legend labels or text mark for a temporal field - */ - function timeFormatExpression(field, timeUnit, format, rawTimeFormat, // should be provided only for actual text and headers, not axis/legend labels - isUTCScale) { - if (!timeUnit || format) { - // If there is no time unit, or if user explicitly specifies format for axis/legend/text. - format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit. - return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`; - } - else { - return formatExpression(timeUnit, field, isUTCScale); - } - } - - const DEFAULT_SORT_OP = 'min'; - const SORT_BY_CHANNEL_INDEX = { - x: 1, - y: 1, - color: 1, - fill: 1, - stroke: 1, - strokeWidth: 1, - size: 1, - shape: 1, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - text: 1 - }; - function isSortByChannel(c) { - return c in SORT_BY_CHANNEL_INDEX; - } - function isSortByEncoding(sort) { - return !!sort && !!sort['encoding']; - } - function isSortField(sort) { - return !!sort && (sort['op'] === 'count' || !!sort['field']); - } - function isSortArray(sort) { - return !!sort && isArray(sort); - } - - function isFacetMapping(f) { - return 'row' in f || 'column' in f; - } - function isFacetFieldDef(channelDef) { - return !!channelDef && 'header' in channelDef; - } - function isFacetSpec(spec) { - return 'facet' in spec; - } - - function isConditionalSelection(c) { - return c['selection']; - } - function isRepeatRef(field) { - return field && !isString(field) && 'repeat' in field; - } - function toFieldDefBase(fieldDef) { - const { field, timeUnit, bin, aggregate } = fieldDef; - return Object.assign(Object.assign(Object.assign(Object.assign({}, (timeUnit ? { timeUnit } : {})), (bin ? { bin } : {})), (aggregate ? { aggregate } : {})), { field }); - } - function isSortableFieldDef(fieldDef) { - return 'sort' in fieldDef; - } - function getBand({ channel, fieldDef, fieldDef2, markDef: mark, stack, config, isMidPoint }) { - if (isFieldOrDatumDef(fieldDef) && fieldDef.band !== undefined) { - return fieldDef.band; - } - if (isFieldDef(fieldDef)) { - const { timeUnit, bin } = fieldDef; - if (timeUnit && !fieldDef2) { - if (isMidPoint) { - return getMarkConfig('timeUnitBandPosition', mark, config); - } - else { - return isRectBasedMark(mark.type) ? getMarkConfig('timeUnitBand', mark, config) : 0; - } - } - else if (isBinning(bin)) { - return isRectBasedMark(mark.type) && !isMidPoint ? 1 : 0.5; - } - } - if ((stack === null || stack === void 0 ? void 0 : stack.fieldChannel) === channel && isMidPoint) { - return 0.5; - } - return undefined; - } - function hasBand(channel, fieldDef, fieldDef2, stack, markDef, config) { - if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) { - return !!getBand({ channel, fieldDef, fieldDef2, stack, markDef, config }); - } - return false; - } - function isConditionalDef(channelDef) { - return !!channelDef && 'condition' in channelDef; - } - /** - * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef - */ - function hasConditionalFieldDef(channelDef) { - const condition = channelDef && channelDef['condition']; - return !!condition && !isArray(condition) && isFieldDef(condition); - } - function hasConditionalFieldOrDatumDef(channelDef) { - const condition = channelDef && channelDef['condition']; - return !!condition && !isArray(condition) && isFieldOrDatumDef(condition); - } - function hasConditionalValueDef(channelDef) { - const condition = channelDef && channelDef['condition']; - return !!condition && (isArray(condition) || isValueDef(condition)); - } - function isFieldDef(channelDef) { - // TODO: we can't use field in channelDef here as it's somehow failing runtime test - return !!channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count'); - } - function channelDefType(channelDef) { - return channelDef && channelDef['type']; - } - function isDatumDef(channelDef) { - return !!channelDef && 'datum' in channelDef; - } - function isContinuousFieldOrDatumDef(cd) { - // TODO: make datum support DateTime object - return (isTypedFieldDef(cd) && isContinuous(cd)) || isNumericDataDef(cd); - } - function isNumericDataDef(cd) { - return isDatumDef(cd) && isNumber(cd.datum); - } - function isFieldOrDatumDef(channelDef) { - return isFieldDef(channelDef) || isDatumDef(channelDef); - } - function isTypedFieldDef(channelDef) { - return !!channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef; - } - function isValueDef(channelDef) { - return channelDef && 'value' in channelDef && 'value' in channelDef; - } - function isScaleFieldDef(channelDef) { - return !!channelDef && ('scale' in channelDef || 'sort' in channelDef); - } - function isPositionFieldOrDatumDef(channelDef) { - return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef); - } - function isMarkPropFieldOrDatumDef(channelDef) { - return !!channelDef && 'legend' in channelDef; - } - function isStringFieldOrDatumDef(channelDef) { - return !!channelDef && ('format' in channelDef || 'formatType' in channelDef); - } - function toStringFieldDef(fieldDef) { - // omit properties that don't exist in string field defs - return omit(fieldDef, ['legend', 'axis', 'header', 'scale']); - } - function isOpFieldDef(fieldDef) { - return 'op' in fieldDef; - } - /** - * Get a Vega field reference from a Vega-Lite field def. - */ - function vgField(fieldDef, opt = {}) { - var _a, _b, _c; - let field = fieldDef.field; - const prefix = opt.prefix; - let suffix = opt.suffix; - let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped - if (isCount(fieldDef)) { - field = internalField('count'); - } - else { - let fn; - if (!opt.nofn) { - if (isOpFieldDef(fieldDef)) { - fn = fieldDef.op; - } - else { - const { bin, aggregate, timeUnit } = fieldDef; - if (isBinning(bin)) { - fn = binToString(bin); - suffix = ((_a = opt.binSuffix) !== null && _a !== void 0 ? _a : '') + ((_b = opt.suffix) !== null && _b !== void 0 ? _b : ''); - } - else if (aggregate) { - if (isArgmaxDef(aggregate)) { - argAccessor = `["${field}"]`; - field = `argmax_${aggregate.argmax}`; - } - else if (isArgminDef(aggregate)) { - argAccessor = `["${field}"]`; - field = `argmin_${aggregate.argmin}`; - } - else { - fn = String(aggregate); - } - } - else if (timeUnit) { - fn = timeUnitToString(timeUnit); - suffix = ((!contains(['range', 'mid'], opt.binSuffix) && opt.binSuffix) || '') + ((_c = opt.suffix) !== null && _c !== void 0 ? _c : ''); - } - } - } - if (fn) { - field = field ? `${fn}_${field}` : fn; - } - } - if (suffix) { - field = `${field}_${suffix}`; - } - if (prefix) { - field = `${prefix}_${field}`; - } - if (opt.forAs) { - return removePathFromField(field); - } - else if (opt.expr) { - // Expression to access flattened field. No need to escape dots. - return flatAccessWithDatum(field, opt.expr) + argAccessor; - } - else { - // We flattened all fields so paths should have become dot. - return replacePathInField(field) + argAccessor; - } - } - function isDiscrete(def) { - switch (def.type) { - case 'nominal': - case 'ordinal': - case 'geojson': - return true; - case 'quantitative': - return isFieldDef(def) && !!def.bin; - case 'temporal': - return false; - } - throw new Error(invalidFieldType(def.type)); - } - function isContinuous(fieldDef) { - return !isDiscrete(fieldDef); - } - function isCount(fieldDef) { - return fieldDef.aggregate === 'count'; - } - function verbalTitleFormatter(fieldDef, config) { - var _a; - const { field, bin, timeUnit, aggregate } = fieldDef; - if (aggregate === 'count') { - return config.countTitle; - } - else if (isBinning(bin)) { - return `${field} (binned)`; - } - else if (timeUnit) { - const unit = (_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit; - if (unit) { - return `${field} (${getTimeUnitParts(unit).join('-')})`; - } - } - else if (aggregate) { - if (isArgmaxDef(aggregate)) { - return `${field} for max ${aggregate.argmax}`; - } - else if (isArgminDef(aggregate)) { - return `${field} for min ${aggregate.argmin}`; - } - else { - return `${titleCase(aggregate)} of ${field}`; - } - } - return field; - } - function functionalTitleFormatter(fieldDef) { - const { aggregate, bin, timeUnit, field } = fieldDef; - if (isArgmaxDef(aggregate)) { - return `${field} for argmax(${aggregate.argmax})`; - } - else if (isArgminDef(aggregate)) { - return `${field} for argmin(${aggregate.argmin})`; - } - const timeUnitParams = normalizeTimeUnit(timeUnit); - const fn = aggregate || (timeUnitParams === null || timeUnitParams === void 0 ? void 0 : timeUnitParams.unit) || ((timeUnitParams === null || timeUnitParams === void 0 ? void 0 : timeUnitParams.maxbins) && 'timeunit') || (isBinning(bin) && 'bin'); - if (fn) { - return fn.toUpperCase() + '(' + field + ')'; - } - else { - return field; - } - } - const defaultTitleFormatter = (fieldDef, config) => { - switch (config.fieldTitle) { - case 'plain': - return fieldDef.field; - case 'functional': - return functionalTitleFormatter(fieldDef); - default: - return verbalTitleFormatter(fieldDef, config); - } - }; - let titleFormatter = defaultTitleFormatter; - function setTitleFormatter(formatter) { - titleFormatter = formatter; - } - function resetTitleFormatter() { - setTitleFormatter(defaultTitleFormatter); - } - function title(fieldOrDatumDef, config, { allowDisabling, includeDefault = true }) { - var _a, _b; - const guideTitle = (_a = getGuide(fieldOrDatumDef)) === null || _a === void 0 ? void 0 : _a.title; - if (!isFieldDef(fieldOrDatumDef)) { - return guideTitle; - } - const fieldDef = fieldOrDatumDef; - const def = includeDefault ? defaultTitle(fieldDef, config) : undefined; - if (allowDisabling) { - return getFirstDefined(guideTitle, fieldDef.title, def); - } - else { - return (_b = guideTitle !== null && guideTitle !== void 0 ? guideTitle : fieldDef.title) !== null && _b !== void 0 ? _b : def; - } - } - function getGuide(fieldDef) { - if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) { - return fieldDef.axis; - } - else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) { - return fieldDef.legend; - } - else if (isFacetFieldDef(fieldDef) && fieldDef.header) { - return fieldDef.header; - } - return undefined; - } - function defaultTitle(fieldDef, config) { - return titleFormatter(fieldDef, config); - } - function getFormatMixins(fieldDef) { - var _a; - if (isStringFieldOrDatumDef(fieldDef)) { - const { format, formatType } = fieldDef; - return { format, formatType }; - } - else { - const guide = (_a = getGuide(fieldDef)) !== null && _a !== void 0 ? _a : {}; - const { format, formatType } = guide; - return { format, formatType }; - } - } - function defaultType(fieldDef, channel) { - var _a; - switch (channel) { - case 'latitude': - case 'longitude': - return 'quantitative'; - case 'row': - case 'column': - case 'facet': - case 'shape': - case 'strokeDash': - return 'nominal'; - } - if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) { - return 'ordinal'; - } - const { aggregate, bin, timeUnit } = fieldDef; - if (timeUnit) { - return 'temporal'; - } - if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) { - return 'quantitative'; - } - if (isScaleFieldDef(fieldDef) && ((_a = fieldDef.scale) === null || _a === void 0 ? void 0 : _a.type)) { - switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) { - case 'numeric': - case 'discretizing': - return 'quantitative'; - case 'time': - return 'temporal'; - } - } - return 'nominal'; - } - /** - * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef. - * @param channelDef - */ - function getFieldDef(channelDef) { - if (isFieldDef(channelDef)) { - return channelDef; - } - else if (hasConditionalFieldDef(channelDef)) { - return channelDef.condition; - } - return undefined; - } - function getFieldOrDatumDef(channelDef) { - if (isFieldOrDatumDef(channelDef)) { - return channelDef; - } - else if (hasConditionalFieldOrDatumDef(channelDef)) { - return channelDef.condition; - } - return undefined; - } - /** - * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. - */ - function initChannelDef(channelDef, channel, config, opt = {}) { - if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) { - const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean'; - warn(primitiveChannelDef(channel, primitiveType, channelDef)); - return { value: channelDef }; - } - // If a fieldDef contains a field, we need type. - if (isFieldOrDatumDef(channelDef)) { - return initFieldOrDatumDef(channelDef, channel, config, opt); - } - else if (hasConditionalFieldOrDatumDef(channelDef)) { - return Object.assign(Object.assign({}, channelDef), { - // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition - condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) }); - } - return channelDef; - } - function initFieldOrDatumDef(fd, channel, config, opt) { - if (isStringFieldOrDatumDef(fd)) { - const { format, formatType } = fd, rest = __rest(fd, ["format", "formatType"]); - if (isCustomFormatType(formatType) && !config.customFormatTypes) { - warn(customFormatTypeNotAllowed(channel)); - return initFieldOrDatumDef(rest, channel, config, opt); - } - } - else { - const guideType = isPositionFieldOrDatumDef(fd) - ? 'axis' - : isMarkPropFieldOrDatumDef(fd) - ? 'legend' - : isFacetFieldDef(fd) - ? 'header' - : null; - if (guideType && fd[guideType]) { - const _a = fd[guideType], { format, formatType } = _a, newGuide = __rest(_a, ["format", "formatType"]); - if (isCustomFormatType(formatType) && !config.customFormatTypes) { - warn(customFormatTypeNotAllowed(channel)); - return initFieldOrDatumDef(Object.assign(Object.assign({}, fd), { [guideType]: newGuide }), channel, config, opt); - } - } - } - if (isFieldDef(fd)) { - return initFieldDef(fd, channel, opt); - } - return initDatumDef(fd); - } - function initDatumDef(datumDef) { - let type = datumDef['type']; - if (type) { - return datumDef; - } - const { datum } = datumDef; - type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined; - return Object.assign(Object.assign({}, datumDef), { type }); - } - function initFieldDef(fd, channel, { compositeMark = false } = {}) { - const { aggregate, timeUnit, bin, field } = fd; - const fieldDef = Object.assign({}, fd); - // Drop invalid aggregate - if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) { - warn(invalidAggregate(aggregate)); - delete fieldDef.aggregate; - } - // Normalize Time Unit - if (timeUnit) { - fieldDef.timeUnit = normalizeTimeUnit(timeUnit); - } - if (field) { - fieldDef.field = `${field}`; - } - // Normalize bin - if (isBinning(bin)) { - fieldDef.bin = normalizeBin(bin, channel); - } - if (isBinned(bin) && !isXorY(channel)) { - warn(channelShouldNotBeUsedForBinned(channel)); - } - // Normalize Type - if (isTypedFieldDef(fieldDef)) { - const { type } = fieldDef; - const fullType = getFullName(type); - if (type !== fullType) { - // convert short type to full type - fieldDef.type = fullType; - } - if (type !== 'quantitative') { - if (isCountingAggregateOp(aggregate)) { - warn(invalidFieldTypeForCountAggregate(type, aggregate)); - fieldDef.type = 'quantitative'; - } - } - } - else if (!isSecondaryRangeChannel(channel)) { - // If type is empty / invalid, then augment with default type - const newType = defaultType(fieldDef, channel); - fieldDef['type'] = newType; - } - if (isTypedFieldDef(fieldDef)) { - const { compatible, warning } = channelCompatibility(fieldDef, channel) || {}; - if (compatible === false) { - warn(warning); - } - } - if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) { - const { sort } = fieldDef; - if (isSortByChannel(sort)) { - return Object.assign(Object.assign({}, fieldDef), { sort: { encoding: sort } }); - } - const sub = sort.substr(1); - if (sort.charAt(0) === '-' && isSortByChannel(sub)) { - return Object.assign(Object.assign({}, fieldDef), { sort: { encoding: sub, order: 'descending' } }); - } - } - if (isFacetFieldDef(fieldDef)) { - const { header } = fieldDef; - const { orient } = header, rest = __rest(header, ["orient"]); - if (orient) { - return Object.assign(Object.assign({}, fieldDef), { header: Object.assign(Object.assign({}, rest), { labelOrient: header.labelOrient || orient, titleOrient: header.titleOrient || orient }) }); - } - } - return fieldDef; - } - function normalizeBin(bin, channel) { - if (isBoolean(bin)) { - return { maxbins: autoMaxBins(channel) }; - } - else if (bin === 'binned') { - return { - binned: true - }; - } - else if (!bin.maxbins && !bin.step) { - return Object.assign(Object.assign({}, bin), { maxbins: autoMaxBins(channel) }); - } - else { - return bin; - } - } - const COMPATIBLE = { compatible: true }; - function channelCompatibility(fieldDef, channel) { - const type = fieldDef.type; - if (type === 'geojson' && channel !== 'shape') { - return { - compatible: false, - warning: `Channel ${channel} should not be used with a geojson data.` - }; - } - switch (channel) { - case ROW: - case COLUMN: - case FACET: - if (isContinuous(fieldDef)) { - return { - compatible: false, - warning: facetChannelShouldBeDiscrete(channel) - }; - } - return COMPATIBLE; - case X: - case Y: - case COLOR: - case FILL: - case STROKE: - case TEXT$1: - case DETAIL: - case KEY: - case TOOLTIP: - case HREF: - case URL: - case ANGLE: - case THETA: - case RADIUS: - case DESCRIPTION: - return COMPATIBLE; - case LONGITUDE: - case LONGITUDE2: - case LATITUDE: - case LATITUDE2: - if (type !== QUANTITATIVE) { - return { - compatible: false, - warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.` - }; - } - return COMPATIBLE; - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEWIDTH: - case SIZE: - case THETA2: - case RADIUS2: - case X2: - case Y2: - if (type === 'nominal' && !fieldDef['sort']) { - return { - compatible: false, - warning: `Channel ${channel} should not be used with an unsorted discrete field.` - }; - } - return COMPATIBLE; - case STROKEDASH: - if (!contains(['ordinal', 'nominal'], fieldDef.type)) { - return { - compatible: false, - warning: 'StrokeDash channel should be used with only discrete data.' - }; - } - return COMPATIBLE; - case SHAPE: - if (!contains(['ordinal', 'nominal', 'geojson'], fieldDef.type)) { - return { - compatible: false, - warning: 'Shape channel should be used with only either discrete or geojson data.' - }; - } - return COMPATIBLE; - case ORDER: - if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) { - return { - compatible: false, - warning: `Channel order is inappropriate for nominal field, which has no inherent order.` - }; - } - return COMPATIBLE; - } - } - /** - * Check if the field def uses a time format or does not use any format but is temporal - * (this does not cover field defs that are temporal but use a number format). - */ - function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) { - const { formatType } = getFormatMixins(fieldOrDatumDef); - return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef)); - } - /** - * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`. - */ - function isTimeFieldDef(def) { - return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit)); - } - /** - * Getting a value associated with a fielddef. - * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit) - */ - function valueExpr(v, { timeUnit, type, wrapTime, undefinedIfExprNotRequired }) { - var _a; - const unit = timeUnit && ((_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit); - let isTime = unit || type === 'temporal'; - let expr; - if (isSignalRef(v)) { - expr = v.signal; - } - else if (isDateTime(v)) { - isTime = true; - expr = dateTimeToExpr(v); - } - else if (isString(v) || isNumber(v)) { - if (isTime) { - expr = `datetime(${JSON.stringify(v)})`; - if (isLocalSingleTimeUnit(unit)) { - // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit - if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) { - expr = dateTimeToExpr({ [unit]: v }); - } - } - } - } - if (expr) { - return wrapTime && isTime ? `time(${expr})` : expr; - } - // number or boolean or normal string - return undefinedIfExprNotRequired ? undefined : JSON.stringify(v); - } - /** - * Standardize value array -- convert each value to Vega expression if applicable - */ - function valueArray(fieldOrDatumDef, values) { - const { type } = fieldOrDatumDef; - return values.map(v => { - const expr = valueExpr(v, { - timeUnit: isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.timeUnit : undefined, - type, - undefinedIfExprNotRequired: true - }); - // return signal for the expression if we need an expression - if (expr !== undefined) { - return { signal: expr }; - } - // otherwise just return the original value - return v; - }); - } - /** - * Checks whether a fieldDef for a particular channel requires a computed bin range. - */ - function binRequiresRange(fieldDef, channel) { - if (!isBinning(fieldDef.bin)) { - console.warn('Only call this method for binned field defs.'); - return false; - } - // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels. - // We could check whether the axis or legend exists (not disabled) but that seems overkill. - return isScaleChannel(channel) && contains(['ordinal', 'nominal'], fieldDef.type); - } - - function extractTitleConfig(titleConfig) { - const { - // These are non-mark title config that need to be hardcoded - anchor, frame, offset, orient, - // color needs to be redirect to fill - color, - // subtitle properties - subtitleColor, subtitleFont, subtitleFontSize, subtitleFontStyle, subtitleFontWeight, subtitleLineHeight, subtitlePadding } = titleConfig, - // The rest are mark config. - rest = __rest(titleConfig, ["anchor", "frame", "offset", "orient", "color", "subtitleColor", "subtitleFont", "subtitleFontSize", "subtitleFontStyle", "subtitleFontWeight", "subtitleLineHeight", "subtitlePadding"]); - const titleMarkConfig = Object.assign(Object.assign({}, rest), (color ? { fill: color } : {})); - // These are non-mark title config that need to be hardcoded - const nonMark = Object.assign(Object.assign(Object.assign(Object.assign({}, (anchor ? { anchor } : {})), (frame ? { frame } : {})), (offset ? { offset } : {})), (orient ? { orient } : {})); - // subtitle part can stay in config.title since header titles do not use subtitle - const subtitle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (subtitleColor ? { subtitleColor } : {})), (subtitleFont ? { subtitleFont } : {})), (subtitleFontSize ? { subtitleFontSize } : {})), (subtitleFontStyle ? { subtitleFontStyle } : {})), (subtitleFontWeight ? { subtitleFontWeight } : {})), (subtitleLineHeight ? { subtitleLineHeight } : {})), (subtitlePadding ? { subtitlePadding } : {})); - const subtitleMarkConfig = pick(titleMarkConfig, ['align', 'baseline', 'dx', 'dy', 'limit']); - return { titleMarkConfig, subtitleMarkConfig, nonMark, subtitle }; - } - function isText(v) { - return isString(v) || (isArray(v) && isString(v[0])); - } - - function signalOrValueRef(value) { - if (isSignalRef(value)) { - return value; - } - return value !== undefined ? { value } : undefined; - } - function exprFromValueOrSignalRef(ref) { - if (isSignalRef(ref)) { - return ref.signal; - } - return $(ref.value); - } - function signalOrStringValue(v) { - if (isSignalRef(v)) { - return v.signal; - } - return v == null ? null : $(v); - } - function applyMarkConfig(e, model, propsList) { - for (const property of propsList) { - const value = getMarkConfig(property, model.markDef, model.config); - if (value !== undefined) { - e[property] = signalOrValueRef(value); - } - } - return e; - } - function getStyles(mark) { - var _a; - return [].concat(mark.type, (_a = mark.style) !== null && _a !== void 0 ? _a : []); - } - function getMarkPropOrConfig(channel, mark, config, opt = {}) { - const { vgChannel, ignoreVgConfig } = opt; - if (vgChannel && mark[vgChannel] !== undefined) { - return mark[vgChannel]; - } - else if (mark[channel] !== undefined) { - return mark[channel]; - } - else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) { - return undefined; - } - return getMarkConfig(channel, mark, config, opt); - } - /** - * Return property value from style or mark specific config property if exists. - * Otherwise, return general mark specific config. - */ - function getMarkConfig(channel, mark, config, { vgChannel } = {}) { - return getFirstDefined( - // style config has highest precedence - vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined, getMarkStyleConfig(channel, mark, config.style), - // then mark-specific config - vgChannel ? config[mark.type][vgChannel] : undefined, config[mark.type][channel], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine - // If there is vgChannel, skip vl channel. - // For example, vl size for text is vg fontSize, but config.mark.size is only for point size. - vgChannel ? config.mark[vgChannel] : config.mark[channel] // Need to cast for the same reason as above - ); - } - function getMarkStyleConfig(prop, mark, styleConfigIndex) { - return getStyleConfig(prop, getStyles(mark), styleConfigIndex); - } - function getStyleConfig(p, styles, styleConfigIndex) { - styles = array(styles); - let value; - for (const style of styles) { - const styleConfig = styleConfigIndex[style]; - if (styleConfig && styleConfig[p] !== undefined) { - value = styleConfig[p]; - } - } - return value; - } - /** - * Return Vega sort parameters (tuple of field and order). - */ - function sortParams(orderDef, fieldRefOption) { - return array(orderDef).reduce((s, orderChannelDef) => { - var _a; - s.field.push(vgField(orderChannelDef, fieldRefOption)); - s.order.push((_a = orderChannelDef.sort) !== null && _a !== void 0 ? _a : 'ascending'); - return s; - }, { field: [], order: [] }); - } - function mergeTitleFieldDefs(f1, f2) { - const merged = [...f1]; - f2.forEach(fdToMerge => { - for (const fieldDef1 of merged) { - // If already exists, no need to append to merged array - if (deepEqual(fieldDef1, fdToMerge)) { - return; - } - } - merged.push(fdToMerge); - }); - return merged; - } - function mergeTitle(title1, title2) { - if (deepEqual(title1, title2) || !title2) { - // if titles are the same or title2 is falsy - return title1; - } - else if (!title1) { - // if title1 is falsy - return title2; - } - else { - return [...array(title1), ...array(title2)].join(', '); - } - } - function mergeTitleComponent(v1, v2) { - const v1Val = v1.value; - const v2Val = v2.value; - if (v1Val == null || v2Val === null) { - return { - explicit: v1.explicit, - value: null - }; - } - else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) { - return { - explicit: v1.explicit, - value: mergeTitle(v1Val, v2Val) - }; - } - else if (isText(v1Val) || isSignalRef(v1Val)) { - return { - explicit: v1.explicit, - value: v1Val - }; - } - else if (isText(v2Val) || isSignalRef(v2Val)) { - return { - explicit: v1.explicit, - value: v2Val - }; - } - else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) { - return { - explicit: v1.explicit, - value: mergeTitleFieldDefs(v1Val, v2Val) - }; - } - /* istanbul ignore next: Condition should not happen -- only for warning in development. */ - throw new Error('It should never reach here'); - } - - function channelHasField(encoding, channel) { - const channelDef = encoding && encoding[channel]; - if (channelDef) { - if (isArray(channelDef)) { - return some(channelDef, fieldDef => !!fieldDef.field); - } - else { - return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef); - } - } - return false; - } - function isAggregate(encoding) { - return some(CHANNELS, channel => { - if (channelHasField(encoding, channel)) { - const channelDef = encoding[channel]; - if (isArray(channelDef)) { - return some(channelDef, fieldDef => !!fieldDef.aggregate); - } - else { - const fieldDef = getFieldDef(channelDef); - return fieldDef && !!fieldDef.aggregate; - } - } - return false; - }); - } - function extractTransformsFromEncoding(oldEncoding, config) { - const groupby = []; - const bins = []; - const timeUnits = []; - const aggregate = []; - const encoding = {}; - forEach(oldEncoding, (channelDef, channel) => { - // Extract potential embedded transformations along with remaining properties - if (isFieldDef(channelDef)) { - const { field, aggregate: aggOp, bin, timeUnit } = channelDef, remaining = __rest(channelDef, ["field", "aggregate", "bin", "timeUnit"]); - if (aggOp || timeUnit || bin) { - const guide = getGuide(channelDef); - const isTitleDefined = guide && guide.title; - let newField = vgField(channelDef, { forAs: true }); - const newFieldDef = Object.assign(Object.assign(Object.assign({}, (isTitleDefined ? [] : { title: title(channelDef, config, { allowDisabling: true }) })), remaining), { - // Always overwrite field - field: newField }); - if (aggOp) { - let op; - if (isArgmaxDef(aggOp)) { - op = 'argmax'; - newField = vgField({ op: 'argmax', field: aggOp.argmax }, { forAs: true }); - newFieldDef.field = `${newField}.${field}`; - } - else if (isArgminDef(aggOp)) { - op = 'argmin'; - newField = vgField({ op: 'argmin', field: aggOp.argmin }, { forAs: true }); - newFieldDef.field = `${newField}.${field}`; - } - else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') { - op = aggOp; - } - if (op) { - const aggregateEntry = { - op, - as: newField - }; - if (field) { - aggregateEntry.field = field; - } - aggregate.push(aggregateEntry); - } - } - else { - groupby.push(newField); - if (isTypedFieldDef(channelDef) && isBinning(bin)) { - bins.push({ bin, field, as: newField }); - // Add additional groupbys for range and end of bins - groupby.push(vgField(channelDef, { binSuffix: 'end' })); - if (binRequiresRange(channelDef, channel)) { - groupby.push(vgField(channelDef, { binSuffix: 'range' })); - } - // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively - if (isXorY(channel)) { - const secondaryChannel = { - field: newField + '_end' - }; - encoding[channel + '2'] = secondaryChannel; - } - newFieldDef.bin = 'binned'; - if (!isSecondaryRangeChannel(channel)) { - newFieldDef['type'] = QUANTITATIVE; - } - } - else if (timeUnit) { - timeUnits.push({ - timeUnit, - field, - as: newField - }); - // define the format type for later compilation - const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time'; - if (formatType) { - if (channel === TEXT$1 || channel === TOOLTIP) { - newFieldDef['formatType'] = formatType; - } - else if (isNonPositionScaleChannel(channel)) { - newFieldDef['legend'] = Object.assign({ formatType }, newFieldDef['legend']); - } - else if (isXorY(channel)) { - newFieldDef['axis'] = Object.assign({ formatType }, newFieldDef['axis']); - } - } - } - } - // now the field should refer to post-transformed field instead - encoding[channel] = newFieldDef; - } - else { - groupby.push(field); - encoding[channel] = oldEncoding[channel]; - } - } - else { - // For value def / signal ref / datum def, just copy - encoding[channel] = oldEncoding[channel]; - } - }); - return { - bins, - timeUnits, - aggregate, - groupby, - encoding - }; - } - function markChannelCompatible(encoding, channel, mark) { - const markSupported = supportMark(channel, mark); - if (!markSupported) { - return false; - } - else if (markSupported === 'binned') { - const primaryFieldDef = encoding[channel === X2 ? X : Y]; - // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef - // has "binned" data and thus need x2/y2 to specify the bin-end field. - if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) { - return true; - } - else { - return false; - } - } - return true; - } - function initEncoding(encoding, mark, filled, config) { - return keys(encoding).reduce((normalizedEncoding, channel) => { - if (!isChannel(channel)) { - // Drop invalid channel - warn(invalidEncodingChannel(channel)); - return normalizedEncoding; - } - const channelDef = encoding[channel]; - if (channel === 'angle' && mark === 'arc' && !encoding.theta) { - warn(REPLACE_ANGLE_WITH_THETA); - channel = THETA; - } - if (!markChannelCompatible(encoding, channel, mark)) { - // Drop unsupported channel - warn(incompatibleChannel(channel, mark)); - return normalizedEncoding; - } - // Drop line's size if the field is aggregated. - if (channel === SIZE && mark === 'line') { - const fieldDef = getFieldDef(encoding[channel]); - if (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.aggregate) { - warn(LINE_WITH_VARYING_SIZE); - return normalizedEncoding; - } - } - // Drop color if either fill or stroke is specified - if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) { - warn(droppingColor('encoding', { fill: 'fill' in encoding, stroke: 'stroke' in encoding })); - return normalizedEncoding; - } - if (channel === DETAIL || - (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) || - (channel === TOOLTIP && isArray(channelDef))) { - if (channelDef) { - // Array of fieldDefs for detail channel (or production rule) - normalizedEncoding[channel] = array(channelDef).reduce((defs, fieldDef) => { - if (!isFieldDef(fieldDef)) { - warn(emptyFieldDef(fieldDef, channel)); - } - else { - defs.push(initFieldDef(fieldDef, channel)); - } - return defs; - }, []); - } - } - else { - if (channel === TOOLTIP && channelDef === null) { - // Preserve null so we can use it to disable tooltip - normalizedEncoding[channel] = null; - } - else if (!isFieldDef(channelDef) && - !isDatumDef(channelDef) && - !isValueDef(channelDef) && - !isConditionalDef(channelDef) && - !isSignalRef(channelDef)) { - warn(emptyFieldDef(channelDef, channel)); - return normalizedEncoding; - } - normalizedEncoding[channel] = initChannelDef(channelDef, channel, config); - } - return normalizedEncoding; - }, {}); - } - /** - * For composite marks, we have to call initChannelDef during init so we can infer types earlier. - */ - function normalizeEncoding(encoding, config) { - return keys(encoding).reduce((normalizedEncoding, channel) => { - const newChannelDef = initChannelDef(encoding[channel], channel, config, { compositeMark: true }); - normalizedEncoding[channel] = newChannelDef; - return normalizedEncoding; - }, {}); - } - function fieldDefs(encoding) { - const arr = []; - for (const channel of keys(encoding)) { - if (channelHasField(encoding, channel)) { - const channelDef = encoding[channel]; - const channelDefArray = array(channelDef); - for (const def of channelDefArray) { - if (isFieldDef(def)) { - arr.push(def); - } - else if (hasConditionalFieldDef(def)) { - arr.push(def.condition); - } - } - } - } - return arr; - } - function forEach(mapping, f, thisArg) { - if (!mapping) { - return; - } - for (const channel of keys(mapping)) { - const el = mapping[channel]; - if (isArray(el)) { - for (const channelDef of el) { - f.call(thisArg, channelDef, channel); - } - } - else { - f.call(thisArg, el, channel); - } - } - } - function reduce(mapping, f, init, thisArg) { - if (!mapping) { - return init; - } - return keys(mapping).reduce((r, channel) => { - const map = mapping[channel]; - if (isArray(map)) { - return map.reduce((r1, channelDef) => { - return f.call(thisArg, r1, channelDef, channel); - }, r); - } - else { - return f.call(thisArg, r, map, channel); - } - }, init); - } - /** - * Returns list of path grouping fields for the given encoding - */ - function pathGroupingFields(mark, encoding) { - return keys(encoding).reduce((details, channel) => { - switch (channel) { - // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group - case X: - case Y: - case HREF: - case DESCRIPTION: - case URL: - case X2: - case Y2: - case THETA: - case THETA2: - case RADIUS: - case RADIUS2: - // falls through - case LATITUDE: - case LONGITUDE: - case LATITUDE2: - case LONGITUDE2: - // TODO: case 'cursor': - // text, shape, shouldn't be a part of line/trail/area [falls through] - case TEXT$1: - case SHAPE: - case ANGLE: - // falls through - // tooltip fields should not be added to group by [falls through] - case TOOLTIP: - return details; - case ORDER: - // order should not group line / trail - if (mark === 'line' || mark === 'trail') { - return details; - } - // but order should group area for stacking (falls through) - case DETAIL: - case KEY: { - const channelDef = encoding[channel]; - if (isArray(channelDef) || isFieldDef(channelDef)) { - for (const fieldDef of array(channelDef)) { - if (!fieldDef.aggregate) { - details.push(vgField(fieldDef, {})); - } - } - } - return details; - } - case SIZE: - if (mark === 'trail') { - // For trail, size should not group trail lines. - return details; - } - // For line, size should group lines. - // falls through - case COLOR: - case FILL: - case STROKE: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEDASH: - case STROKEWIDTH: { - // TODO strokeDashOffset: - // falls through - const fieldDef = getFieldDef(encoding[channel]); - if (fieldDef && !fieldDef.aggregate) { - details.push(vgField(fieldDef, {})); - } - return details; - } - } - }, []); - } - - function filterTooltipWithAggregatedField(oldEncoding) { - const { tooltip } = oldEncoding, filteredEncoding = __rest(oldEncoding, ["tooltip"]); - if (!tooltip) { - return { filteredEncoding }; - } - let customTooltipWithAggregatedField; - let customTooltipWithoutAggregatedField; - if (isArray(tooltip)) { - for (const t of tooltip) { - if (t.aggregate) { - if (!customTooltipWithAggregatedField) { - customTooltipWithAggregatedField = []; - } - customTooltipWithAggregatedField.push(t); - } - else { - if (!customTooltipWithoutAggregatedField) { - customTooltipWithoutAggregatedField = []; - } - customTooltipWithoutAggregatedField.push(t); - } - } - if (customTooltipWithAggregatedField) { - filteredEncoding.tooltip = customTooltipWithAggregatedField; - } - } - else { - if (tooltip['aggregate']) { - filteredEncoding.tooltip = tooltip; - } - else { - customTooltipWithoutAggregatedField = tooltip; - } - } - if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) { - customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0]; - } - return { customTooltipWithoutAggregatedField, filteredEncoding }; - } - function getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, withFieldName = true) { - if ('tooltip' in encodingWithoutContinuousAxis) { - return { tooltip: encodingWithoutContinuousAxis.tooltip }; - } - const fiveSummaryTooltip = tooltipSummary.map(({ fieldPrefix, titlePrefix }) => { - const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : ''; - return { - field: fieldPrefix + continuousAxisChannelDef.field, - type: continuousAxisChannelDef.type, - title: isSignalRef(titlePrefix) ? { signal: titlePrefix + `"${escape(mainTitle)}"` } : titlePrefix + mainTitle - }; - }); - const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef); - return { - tooltip: [ - ...fiveSummaryTooltip, - // need to cast because TextFieldDef supports fewer types of bin - ...unique(tooltipFieldDefs, hash) - ] - }; - } - function getTitle(continuousAxisChannelDef) { - const { title, field } = continuousAxisChannelDef; - return getFirstDefined(title, field); - } - function makeCompositeAggregatePartFactory(compositeMarkDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, compositeMarkConfig) { - const { scale, axis } = continuousAxisChannelDef; - return ({ partName, mark, positionPrefix, endPositionPrefix = undefined, extraEncoding = {} }) => { - const title = getTitle(continuousAxisChannelDef); - return partLayerMixins(compositeMarkDef, partName, compositeMarkConfig, { - mark, - encoding: Object.assign(Object.assign(Object.assign({ [continuousAxis]: Object.assign(Object.assign(Object.assign({ field: positionPrefix + '_' + continuousAxisChannelDef.field, type: continuousAxisChannelDef.type }, (title !== undefined ? { title } : {})), (scale !== undefined ? { scale } : {})), (axis !== undefined ? { axis } : {})) }, (isString(endPositionPrefix) - ? { - [continuousAxis + '2']: { - field: endPositionPrefix + '_' + continuousAxisChannelDef.field - } - } - : {})), sharedEncoding), extraEncoding) - }); - }; - } - function partLayerMixins(markDef, part, compositeMarkConfig, partBaseSpec) { - const { clip, color, opacity } = markDef; - const mark = markDef.type; - if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) { - return [ - Object.assign(Object.assign({}, partBaseSpec), { mark: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, compositeMarkConfig[part]), (clip ? { clip } : {})), (color ? { color } : {})), (opacity ? { opacity } : {})), (isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : { type: partBaseSpec.mark })), { style: `${mark}-${part}` }), (isBoolean(markDef[part]) ? {} : markDef[part])) }) - ]; - } - return []; - } - function compositeMarkContinuousAxis(spec, orient, compositeMark) { - const { encoding } = spec; - const continuousAxis = orient === 'vertical' ? 'y' : 'x'; - const continuousAxisChannelDef = encoding[continuousAxis]; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal. - const continuousAxisChannelDef2 = encoding[continuousAxis + '2']; - const continuousAxisChannelDefError = encoding[continuousAxis + 'Error']; - const continuousAxisChannelDefError2 = encoding[continuousAxis + 'Error2']; - return { - continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark), - continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark), - continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark), - continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark), - continuousAxis - }; - } - function filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark) { - if (continuousAxisChannelDef && continuousAxisChannelDef.aggregate) { - const { aggregate } = continuousAxisChannelDef, continuousAxisWithoutAggregate = __rest(continuousAxisChannelDef, ["aggregate"]); - if (aggregate !== compositeMark) { - warn(errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark)); - } - return continuousAxisWithoutAggregate; - } - else { - return continuousAxisChannelDef; - } - } - function compositeMarkOrient(spec, compositeMark) { - const { mark, encoding } = spec; - const { x, y } = encoding; - if (isMarkDef(mark) && mark.orient) { - return mark.orient; - } - if (isContinuousFieldOrDatumDef(x)) { - // x is continuous - if (isContinuousFieldOrDatumDef(y)) { - // both x and y are continuous - const xAggregate = isFieldDef(x) && x.aggregate; - const yAggregate = isFieldDef(y) && y.aggregate; - if (!xAggregate && yAggregate === compositeMark) { - return 'vertical'; - } - else if (!yAggregate && xAggregate === compositeMark) { - return 'horizontal'; - } - else if (xAggregate === compositeMark && yAggregate === compositeMark) { - throw new Error('Both x and y cannot have aggregate'); - } - else { - if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) { - // y is temporal but x is not - return 'horizontal'; - } - // default orientation for two continuous - return 'vertical'; - } - } - return 'horizontal'; - } - else if (isContinuousFieldOrDatumDef(y)) { - // y is continuous but x is not - return 'vertical'; - } - else { - // Neither x nor y is continuous. - throw new Error(`Need a valid continuous axis for ${compositeMark}s`); - } - } - - const BOXPLOT = 'boxplot'; - const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks']; - const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot); - function getBoxPlotType(extent) { - if (isNumber(extent)) { - return 'tukey'; - } - // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now. - return extent; - } - function normalizeBoxPlot(spec, { config }) { - var _a, _b; - // Need to initEncoding first so we can infer type - spec = Object.assign(Object.assign({}, spec), { encoding: normalizeEncoding(spec.encoding, config) }); - const { mark, encoding: _encoding, selection, projection: _p } = spec, outerSpec = __rest(spec, ["mark", "encoding", "selection", "projection"]); - const markDef = isMarkDef(mark) ? mark : { type: mark }; - // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - if (selection) { - warn(selectionNotSupported('boxplot')); - } - const extent = (_a = markDef.extent) !== null && _a !== void 0 ? _a : config.boxplot.extent; - const sizeValue = getMarkPropOrConfig('size', markDef, // TODO: https://github.com/vega/vega-lite/issues/6245 - config); - const boxPlotType = getBoxPlotType(extent); - const { transform, continuousAxisChannelDef, continuousAxis, groupby, aggregate, encodingWithoutContinuousAxis, ticksOrient, boxOrient, customTooltipWithoutAggregatedField } = boxParams(spec, extent, config); - const { color, size } = encodingWithoutContinuousAxis, encodingWithoutSizeColorAndContinuousAxis = __rest(encodingWithoutContinuousAxis, ["color", "size"]); - const makeBoxPlotPart = (sharedEncoding) => { - return makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, config.boxplot); - }; - const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis); - const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis); - const makeBoxPlotMidTick = makeBoxPlotPart(Object.assign(Object.assign({}, encodingWithoutSizeColorAndContinuousAxis), (size ? { size } : {}))); - const fiveSummaryTooltipEncoding = getCompositeMarkTooltip([ - { fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max' }, - { fieldPrefix: 'upper_box_', titlePrefix: 'Q3' }, - { fieldPrefix: 'mid_box_', titlePrefix: 'Median' }, - { fieldPrefix: 'lower_box_', titlePrefix: 'Q1' }, - { fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min' } - ], continuousAxisChannelDef, encodingWithoutContinuousAxis); - // ## Whisker Layers - const endTick = { type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid: null, aria: false }; - const whiskerTooltipEncoding = boxPlotType === 'min-max' - ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker - : // for tukey / k-IQR, just show upper/lower-whisker - getCompositeMarkTooltip([ - { fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker' }, - { fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker' } - ], continuousAxisChannelDef, encodingWithoutContinuousAxis); - const whiskerLayers = [ - ...makeBoxPlotExtent({ - partName: 'rule', - mark: { type: 'rule', invalid: null, aria: false }, - positionPrefix: 'lower_whisker', - endPositionPrefix: 'lower_box', - extraEncoding: whiskerTooltipEncoding - }), - ...makeBoxPlotExtent({ - partName: 'rule', - mark: { type: 'rule', invalid: null, aria: false }, - positionPrefix: 'upper_box', - endPositionPrefix: 'upper_whisker', - extraEncoding: whiskerTooltipEncoding - }), - ...makeBoxPlotExtent({ - partName: 'ticks', - mark: endTick, - positionPrefix: 'lower_whisker', - extraEncoding: whiskerTooltipEncoding - }), - ...makeBoxPlotExtent({ - partName: 'ticks', - mark: endTick, - positionPrefix: 'upper_whisker', - extraEncoding: whiskerTooltipEncoding - }) - ]; - // ## Box Layers - // TODO: support hiding certain mark parts - const boxLayers = [ - ...(boxPlotType !== 'tukey' ? whiskerLayers : []), - ...makeBoxPlotBox({ - partName: 'box', - mark: Object.assign(Object.assign({ type: 'bar' }, (sizeValue ? { size: sizeValue } : {})), { orient: boxOrient, invalid: null, ariaRoleDescription: 'box' }), - positionPrefix: 'lower_box', - endPositionPrefix: 'upper_box', - extraEncoding: fiveSummaryTooltipEncoding - }), - ...makeBoxPlotMidTick({ - partName: 'median', - mark: Object.assign(Object.assign(Object.assign({ type: 'tick', invalid: null }, (isObject(config.boxplot.median) && config.boxplot.median.color ? { color: config.boxplot.median.color } : {})), (sizeValue ? { size: sizeValue } : {})), { orient: ticksOrient, aria: false }), - positionPrefix: 'mid_box', - extraEncoding: fiveSummaryTooltipEncoding - }) - ]; - // ## Filtered Layers - let filteredLayersMixins; - if (boxPlotType !== 'min-max') { - const lowerBoxExpr = `datum["lower_box_${continuousAxisChannelDef.field}"]`; - const upperBoxExpr = `datum["upper_box_${continuousAxisChannelDef.field}"]`; - const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`; - const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`; - const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`; - const fieldExpr = `datum["${continuousAxisChannelDef.field}"]`; - const joinaggregateTransform = { - joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field), - groupby - }; - let filteredWhiskerSpec = undefined; - if (boxPlotType === 'tukey') { - filteredWhiskerSpec = { - transform: [ - { - filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})` - }, - { - aggregate: [ - { - op: 'min', - field: continuousAxisChannelDef.field, - as: 'lower_whisker_' + continuousAxisChannelDef.field - }, - { - op: 'max', - field: continuousAxisChannelDef.field, - as: 'upper_whisker_' + continuousAxisChannelDef.field - }, - // preserve lower_box / upper_box - { - op: 'min', - field: 'lower_box_' + continuousAxisChannelDef.field, - as: 'lower_box_' + continuousAxisChannelDef.field - }, - { - op: 'max', - field: 'upper_box_' + continuousAxisChannelDef.field, - as: 'upper_box_' + continuousAxisChannelDef.field - }, - ...aggregate - ], - groupby - } - ], - layer: whiskerLayers - }; - } - const encodingWithoutSizeColorContinuousAxisAndTooltip = __rest(encodingWithoutSizeColorAndContinuousAxis, ["tooltip"]); - const { scale, axis } = continuousAxisChannelDef; - const title = getTitle(continuousAxisChannelDef); - const axisWithoutTitle = omit(axis, ['title']); - const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, { - transform: [{ filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})` }], - mark: 'point', - encoding: Object.assign(Object.assign({ [continuousAxis]: Object.assign(Object.assign(Object.assign({ field: continuousAxisChannelDef.field, type: continuousAxisChannelDef.type }, (title !== undefined ? { title } : {})), (scale !== undefined ? { scale } : {})), (isEmpty(axisWithoutTitle) ? {} : { axis: axisWithoutTitle })) }, encodingWithoutSizeColorContinuousAxisAndTooltip), (customTooltipWithoutAggregatedField ? { tooltip: customTooltipWithoutAggregatedField } : {})) - })[0]; - if (outlierLayersMixins && filteredWhiskerSpec) { - filteredLayersMixins = { - transform: [joinaggregateTransform], - layer: [outlierLayersMixins, filteredWhiskerSpec] - }; - } - else if (outlierLayersMixins) { - filteredLayersMixins = outlierLayersMixins; - filteredLayersMixins.transform.unshift(joinaggregateTransform); - } - else if (filteredWhiskerSpec) { - filteredLayersMixins = filteredWhiskerSpec; - filteredLayersMixins.transform.unshift(joinaggregateTransform); - } - } - if (filteredLayersMixins) { - // tukey box plot with outliers included - return Object.assign(Object.assign({}, outerSpec), { layer: [ - filteredLayersMixins, - { - // boxplot - transform, - layer: boxLayers - } - ] }); - } - return Object.assign(Object.assign({}, outerSpec), { transform: ((_b = outerSpec.transform) !== null && _b !== void 0 ? _b : []).concat(transform), layer: boxLayers }); - } - function boxParamsQuartiles(continousAxisField) { - return [ - { - op: 'q1', - field: continousAxisField, - as: 'lower_box_' + continousAxisField - }, - { - op: 'q3', - field: continousAxisField, - as: 'upper_box_' + continousAxisField - } - ]; - } - function boxParams(spec, extent, config) { - const orient = compositeMarkOrient(spec, BOXPLOT); - const { continuousAxisChannelDef, continuousAxis } = compositeMarkContinuousAxis(spec, orient, BOXPLOT); - const continuousFieldName = continuousAxisChannelDef.field; - const boxPlotType = getBoxPlotType(extent); - const boxplotSpecificAggregate = [ - ...boxParamsQuartiles(continuousFieldName), - { - op: 'median', - field: continuousFieldName, - as: 'mid_box_' + continuousFieldName - }, - { - op: 'min', - field: continuousFieldName, - as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName - }, - { - op: 'max', - field: continuousFieldName, - as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName - } - ]; - const postAggregateCalculates = boxPlotType === 'min-max' || boxPlotType === 'tukey' - ? [] - : [ - // This is for the original k-IQR, which we do not expose - { - calculate: `datum["upper_box_${continuousFieldName}"] - datum["lower_box_${continuousFieldName}"]`, - as: 'iqr_' + continuousFieldName - }, - { - calculate: `min(datum["upper_box_${continuousFieldName}"] + datum["iqr_${continuousFieldName}"] * ${extent}, datum["max_${continuousFieldName}"])`, - as: 'upper_whisker_' + continuousFieldName - }, - { - calculate: `max(datum["lower_box_${continuousFieldName}"] - datum["iqr_${continuousFieldName}"] * ${extent}, datum["min_${continuousFieldName}"])`, - as: 'lower_whisker_' + continuousFieldName - } - ]; - const _a = spec.encoding, _b = continuousAxis, oldContinuousAxisChannelDef = _a[_b], oldEncodingWithoutContinuousAxis = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]); - const { customTooltipWithoutAggregatedField, filteredEncoding } = filterTooltipWithAggregatedField(oldEncodingWithoutContinuousAxis); - const { bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(filteredEncoding, config); - const ticksOrient = orient === 'vertical' ? 'horizontal' : 'vertical'; - const boxOrient = orient; - const transform = [ - ...bins, - ...timeUnits, - { - aggregate: [...aggregate, ...boxplotSpecificAggregate], - groupby - }, - ...postAggregateCalculates - ]; - return { - transform, - groupby, - aggregate, - continuousAxisChannelDef, - continuousAxis, - encodingWithoutContinuousAxis, - ticksOrient, - boxOrient, - customTooltipWithoutAggregatedField - }; - } - - const ERRORBAR = 'errorbar'; - const ERRORBAR_PARTS = ['ticks', 'rule']; - const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar); - function normalizeErrorBar(spec, { config }) { - // Need to initEncoding first so we can infer type - spec = Object.assign(Object.assign({}, spec), { encoding: normalizeEncoding(spec.encoding, config) }); - const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, ticksOrient, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAR, config); - const makeErrorBarPart = makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorbar); - const tick = { type: 'tick', orient: ticksOrient, aria: false }; - const layer = [ - ...makeErrorBarPart({ - partName: 'ticks', - mark: tick, - positionPrefix: 'lower', - extraEncoding: tooltipEncoding - }), - ...makeErrorBarPart({ - partName: 'ticks', - mark: tick, - positionPrefix: 'upper', - extraEncoding: tooltipEncoding - }), - ...makeErrorBarPart({ - partName: 'rule', - mark: { - type: 'rule', - ariaRoleDescription: 'errorbar' - }, - positionPrefix: 'lower', - endPositionPrefix: 'upper', - extraEncoding: tooltipEncoding - }) - ]; - return Object.assign(Object.assign(Object.assign({}, outerSpec), { transform }), (layer.length > 1 ? { layer } : Object.assign({}, layer[0]))); - } - function errorBarOrientAndInputType(spec, compositeMark) { - const { encoding } = spec; - if (errorBarIsInputTypeRaw(encoding)) { - return { - orient: compositeMarkOrient(spec, compositeMark), - inputType: 'raw' - }; - } - const isTypeAggregatedUpperLower = errorBarIsInputTypeAggregatedUpperLower(encoding); - const isTypeAggregatedError = errorBarIsInputTypeAggregatedError(encoding); - const x = encoding.x; - const y = encoding.y; - if (isTypeAggregatedUpperLower) { - // type is aggregated-upper-lower - if (isTypeAggregatedError) { - throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`); - } - const x2 = encoding.x2; - const y2 = encoding.y2; - if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) { - // having both x, x2 and y, y2 - throw new Error(`${compositeMark} cannot have both x2 and y2`); - } - else if (isFieldOrDatumDef(x2)) { - if (isContinuousFieldOrDatumDef(x)) { - // having x, x2 quantitative and field y, y2 are not specified - return { orient: 'horizontal', inputType: 'aggregated-upper-lower' }; - } - else { - // having x, x2 that are not both quantitative - throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`); - } - } - else if (isFieldOrDatumDef(y2)) { - // y2 is a FieldDef - if (isContinuousFieldOrDatumDef(y)) { - // having y, y2 quantitative and field x, x2 are not specified - return { orient: 'vertical', inputType: 'aggregated-upper-lower' }; - } - else { - // having y, y2 that are not both quantitative - throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`); - } - } - throw new Error('No ranged axis'); - } - else { - // type is aggregated-error - const xError = encoding.xError; - const xError2 = encoding.xError2; - const yError = encoding.yError; - const yError2 = encoding.yError2; - if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) { - // having xError2 without xError - throw new Error(`${compositeMark} cannot have xError2 without xError`); - } - if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) { - // having yError2 without yError - throw new Error(`${compositeMark} cannot have yError2 without yError`); - } - if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) { - // having both xError and yError - throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`); - } - else if (isFieldOrDatumDef(xError)) { - if (isContinuousFieldOrDatumDef(x)) { - // having x and xError that are all quantitative - return { orient: 'horizontal', inputType: 'aggregated-error' }; - } - else { - // having x, xError, and xError2 that are not all quantitative - throw new Error('All x, xError, and xError2 (if exist) have to be quantitative'); - } - } - else if (isFieldOrDatumDef(yError)) { - if (isContinuousFieldOrDatumDef(y)) { - // having y and yError that are all quantitative - return { orient: 'vertical', inputType: 'aggregated-error' }; - } - else { - // having y, yError, and yError2 that are not all quantitative - throw new Error('All y, yError, and yError2 (if exist) have to be quantitative'); - } - } - throw new Error('No ranged axis'); - } - } - function errorBarIsInputTypeRaw(encoding) { - return ((isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) && - !isFieldOrDatumDef(encoding.x2) && - !isFieldOrDatumDef(encoding.y2) && - !isFieldOrDatumDef(encoding.xError) && - !isFieldOrDatumDef(encoding.xError2) && - !isFieldOrDatumDef(encoding.yError) && - !isFieldOrDatumDef(encoding.yError2)); - } - function errorBarIsInputTypeAggregatedUpperLower(encoding) { - return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2); - } - function errorBarIsInputTypeAggregatedError(encoding) { - return (isFieldOrDatumDef(encoding.xError) || - isFieldOrDatumDef(encoding.xError2) || - isFieldOrDatumDef(encoding.yError) || - isFieldOrDatumDef(encoding.yError2)); - } - function errorBarParams(spec, compositeMark, config) { - var _a; - // TODO: use selection - const { mark, encoding, selection, projection: _p } = spec, outerSpec = __rest(spec, ["mark", "encoding", "selection", "projection"]); - const markDef = isMarkDef(mark) ? mark : { type: mark }; - // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - if (selection) { - warn(selectionNotSupported(compositeMark)); - } - const { orient, inputType } = errorBarOrientAndInputType(spec, compositeMark); - const { continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, continuousAxis } = compositeMarkContinuousAxis(spec, orient, compositeMark); - const { errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName } = errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config); - const _b = encoding, _c = continuousAxis, oldContinuousAxisChannelDef = _b[_c], _d = continuousAxis === 'x' ? 'x2' : 'y2', oldContinuousAxisChannelDef2 = _b[_d], _e = continuousAxis === 'x' ? 'xError' : 'yError', oldContinuousAxisChannelDefError = _b[_e], _f = continuousAxis === 'x' ? 'xError2' : 'yError2', oldContinuousAxisChannelDefError2 = _b[_f], oldEncodingWithoutContinuousAxis = __rest(_b, [typeof _c === "symbol" ? _c : _c + "", typeof _d === "symbol" ? _d : _d + "", typeof _e === "symbol" ? _e : _e + "", typeof _f === "symbol" ? _f : _f + ""]); - const { bins, timeUnits, aggregate: oldAggregate, groupby: oldGroupBy, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config); - const aggregate = [...oldAggregate, ...errorBarSpecificAggregate]; - const groupby = inputType !== 'raw' ? [] : oldGroupBy; - const tooltipEncoding = getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, tooltipTitleWithFieldName); - return { - transform: [ - ...((_a = outerSpec.transform) !== null && _a !== void 0 ? _a : []), - ...bins, - ...timeUnits, - ...(aggregate.length === 0 ? [] : [{ aggregate, groupby }]), - ...postAggregateCalculates - ], - groupby, - continuousAxisChannelDef, - continuousAxis, - encodingWithoutContinuousAxis, - ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical', - markDef, - outerSpec, - tooltipEncoding - }; - } - function errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config) { - let errorBarSpecificAggregate = []; - let postAggregateCalculates = []; - const continuousFieldName = continuousAxisChannelDef.field; - let tooltipSummary; - let tooltipTitleWithFieldName = false; - if (inputType === 'raw') { - const center = markDef.center - ? markDef.center - : markDef.extent - ? markDef.extent === 'iqr' - ? 'median' - : 'mean' - : config.errorbar.center; - const extent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr'; - if ((center === 'median') !== (extent === 'iqr')) { - warn(errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark)); - } - if (extent === 'stderr' || extent === 'stdev') { - errorBarSpecificAggregate = [ - { op: extent, field: continuousFieldName, as: 'extent_' + continuousFieldName }, - { op: center, field: continuousFieldName, as: 'center_' + continuousFieldName } - ]; - postAggregateCalculates = [ - { - calculate: `datum["center_${continuousFieldName}"] + datum["extent_${continuousFieldName}"]`, - as: 'upper_' + continuousFieldName - }, - { - calculate: `datum["center_${continuousFieldName}"] - datum["extent_${continuousFieldName}"]`, - as: 'lower_' + continuousFieldName - } - ]; - tooltipSummary = [ - { fieldPrefix: 'center_', titlePrefix: titleCase(center) }, - { fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+') }, - { fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-') } - ]; - tooltipTitleWithFieldName = true; - } - else { - let centerOp; - let lowerExtentOp; - let upperExtentOp; - if (extent === 'ci') { - centerOp = 'mean'; - lowerExtentOp = 'ci0'; - upperExtentOp = 'ci1'; - } - else { - centerOp = 'median'; - lowerExtentOp = 'q1'; - upperExtentOp = 'q3'; - } - errorBarSpecificAggregate = [ - { op: lowerExtentOp, field: continuousFieldName, as: 'lower_' + continuousFieldName }, - { op: upperExtentOp, field: continuousFieldName, as: 'upper_' + continuousFieldName }, - { op: centerOp, field: continuousFieldName, as: 'center_' + continuousFieldName } - ]; - tooltipSummary = [ - { - fieldPrefix: 'upper_', - titlePrefix: title({ field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative' }, config, { - allowDisabling: false - }) - }, - { - fieldPrefix: 'lower_', - titlePrefix: title({ field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative' }, config, { - allowDisabling: false - }) - }, - { - fieldPrefix: 'center_', - titlePrefix: title({ field: continuousFieldName, aggregate: centerOp, type: 'quantitative' }, config, { - allowDisabling: false - }) - } - ]; - } - } - else { - if (markDef.center || markDef.extent) { - warn(errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent)); - } - if (inputType === 'aggregated-upper-lower') { - tooltipSummary = []; - postAggregateCalculates = [ - { calculate: `datum["${continuousAxisChannelDef2.field}"]`, as: 'upper_' + continuousFieldName }, - { calculate: `datum["${continuousFieldName}"]`, as: 'lower_' + continuousFieldName } - ]; - } - else if (inputType === 'aggregated-error') { - tooltipSummary = [{ fieldPrefix: '', titlePrefix: continuousFieldName }]; - postAggregateCalculates = [ - { - calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError.field}"]`, - as: 'upper_' + continuousFieldName - } - ]; - if (continuousAxisChannelDefError2) { - postAggregateCalculates.push({ - calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError2.field}"]`, - as: 'lower_' + continuousFieldName - }); - } - else { - postAggregateCalculates.push({ - calculate: `datum["${continuousFieldName}"] - datum["${continuousAxisChannelDefError.field}"]`, - as: 'lower_' + continuousFieldName - }); - } - } - for (const postAggregateCalculate of postAggregateCalculates) { - tooltipSummary.push({ - fieldPrefix: postAggregateCalculate.as.substring(0, 6), - titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum["', ''), '"]', '') - }); - } - } - return { postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName }; - } - function getTitlePrefix(center, extent, operation) { - return titleCase(center) + ' ' + operation + ' ' + extent; - } - - const ERRORBAND = 'errorband'; - const ERRORBAND_PARTS = ['band', 'borders']; - const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand); - function normalizeErrorBand(spec, { config }) { - // Need to initEncoding first so we can infer type - spec = Object.assign(Object.assign({}, spec), { encoding: normalizeEncoding(spec.encoding, config) }); - const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAND, config); - const errorBandDef = markDef; - const makeErrorBandPart = makeCompositeAggregatePartFactory(errorBandDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorband); - const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined; - let bandMark = { type: is2D ? 'area' : 'rect' }; - let bordersMark = { type: is2D ? 'line' : 'rule' }; - const interpolate = Object.assign(Object.assign({}, (errorBandDef.interpolate ? { interpolate: errorBandDef.interpolate } : {})), (errorBandDef.tension && errorBandDef.interpolate ? { tension: errorBandDef.tension } : {})); - if (is2D) { - bandMark = Object.assign(Object.assign(Object.assign({}, bandMark), interpolate), { ariaRoleDescription: 'errorband' }); - bordersMark = Object.assign(Object.assign(Object.assign({}, bordersMark), interpolate), { aria: false }); - } - else if (errorBandDef.interpolate) { - warn(errorBand1DNotSupport('interpolate')); - } - else if (errorBandDef.tension) { - warn(errorBand1DNotSupport('tension')); - } - return Object.assign(Object.assign({}, outerSpec), { transform, layer: [ - ...makeErrorBandPart({ - partName: 'band', - mark: bandMark, - positionPrefix: 'lower', - endPositionPrefix: 'upper', - extraEncoding: tooltipEncoding - }), - ...makeErrorBandPart({ - partName: 'borders', - mark: bordersMark, - positionPrefix: 'lower', - extraEncoding: tooltipEncoding - }), - ...makeErrorBandPart({ - partName: 'borders', - mark: bordersMark, - positionPrefix: 'upper', - extraEncoding: tooltipEncoding - }) - ] }); - } - - /** - * Registry index for all composite mark's normalizer - */ - const compositeMarkRegistry = {}; - function add(mark, run, parts) { - const normalizer = new CompositeMarkNormalizer(mark, run); - compositeMarkRegistry[mark] = { normalizer, parts }; - } - function getAllCompositeMarks() { - return keys(compositeMarkRegistry); - } - add(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS); - add(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS); - add(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS); - - const VL_ONLY_LEGEND_CONFIG = [ - 'gradientHorizontalMaxLength', - 'gradientHorizontalMinLength', - 'gradientVerticalMaxLength', - 'gradientVerticalMinLength', - 'unselectedOpacity' - ]; - - const LEGEND_SCALE_CHANNELS = [ - 'size', - 'shape', - 'fill', - 'stroke', - 'strokeDash', - 'strokeWidth', - 'opacity' - ]; - const SIGNAL_LEGEND_PROP_INDEX = { - fillColor: { - part: 'legend', - vgProp: 'fill' - }, - gradientStrokeColor: { - part: 'gradient', - vgProp: 'stroke' - }, - labelColor: { - part: 'labels', - vgProp: 'fill' - }, - strokeColor: { - part: 'legend', - vgProp: 'stroke' - }, - symbolFillColor: { - part: 'symbols', - vgProp: 'fill' - }, - symbolStrokeColor: { - part: 'symbols', - vgProp: 'stroke' - }, - titleColor: { - part: 'title', - vgProp: 'fill' - } - }; - const defaultLegendConfig = { - gradientHorizontalMaxLength: 200, - gradientHorizontalMinLength: 100, - gradientVerticalMaxLength: 200, - gradientVerticalMinLength: 64, - unselectedOpacity: 0.35 - }; - const COMMON_LEGEND_PROPERTY_INDEX = { - aria: 1, - clipHeight: 1, - columnPadding: 1, - columns: 1, - cornerRadius: 1, - description: 1, - direction: 1, - fillColor: 1, - format: 1, - formatType: 1, - gradientLength: 1, - gradientOpacity: 1, - gradientStrokeColor: 1, - gradientStrokeWidth: 1, - gradientThickness: 1, - gridAlign: 1, - labelAlign: 1, - labelBaseline: 1, - labelColor: 1, - labelFont: 1, - labelFontSize: 1, - labelFontStyle: 1, - labelFontWeight: 1, - labelLimit: 1, - labelOffset: 1, - labelOpacity: 1, - labelOverlap: 1, - labelPadding: 1, - labelSeparation: 1, - legendX: 1, - legendY: 1, - offset: 1, - orient: 1, - padding: 1, - rowPadding: 1, - strokeColor: 1, - symbolDash: 1, - symbolDashOffset: 1, - symbolFillColor: 1, - symbolLimit: 1, - symbolOffset: 1, - symbolOpacity: 1, - symbolSize: 1, - symbolStrokeColor: 1, - symbolStrokeWidth: 1, - symbolType: 1, - tickCount: 1, - tickMinStep: 1, - title: 1, - titleAlign: 1, - titleAnchor: 1, - titleBaseline: 1, - titleColor: 1, - titleFont: 1, - titleFontSize: 1, - titleFontStyle: 1, - titleFontWeight: 1, - titleLimit: 1, - titleLineHeight: 1, - titleOpacity: 1, - titleOrient: 1, - titlePadding: 1, - type: 1, - values: 1, - zindex: 1 - }; - - const SELECTION_ID = '_vgsid_'; - const defaultConfig = { - single: { - on: 'click', - fields: [SELECTION_ID], - resolve: 'global', - empty: 'all', - clear: 'dblclick' - }, - multi: { - on: 'click', - fields: [SELECTION_ID], - toggle: 'event.shiftKey', - resolve: 'global', - empty: 'all', - clear: 'dblclick' - }, - interval: { - on: '[mousedown, window:mouseup] > window:mousemove!', - encodings: ['x', 'y'], - translate: '[mousedown, window:mouseup] > window:mousemove!', - zoom: 'wheel!', - mark: { fill: '#333', fillOpacity: 0.125, stroke: 'white' }, - resolve: 'global', - clear: 'dblclick' - } - }; - function isLegendBinding(bind) { - return !!bind && (bind === 'legend' || !!bind.legend); - } - function isLegendStreamBinding(bind) { - return isLegendBinding(bind) && isObject(bind); - } - - function isAnyConcatSpec(spec) { - return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec); - } - function isConcatSpec(spec) { - return 'concat' in spec; - } - function isVConcatSpec(spec) { - return 'vconcat' in spec; - } - function isHConcatSpec(spec) { - return 'hconcat' in spec; - } - - function isStep(size) { - return isObject(size) && size['step'] !== undefined; - } - function isFrameMixins(o) { - return o['view'] || o['width'] || o['height']; - } - const DEFAULT_SPACING = 20; - const COMPOSITION_LAYOUT_INDEX = { - align: 1, - bounds: 1, - center: 1, - columns: 1, - spacing: 1 - }; - const COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX); - function extractCompositionLayout(spec, specType, config) { - var _a, _b; - const compositionConfig = config[specType]; - const layout = {}; - // Apply config first - const { spacing: spacingConfig, columns } = compositionConfig; - if (spacingConfig !== undefined) { - layout.spacing = spacingConfig; - } - if (columns !== undefined) { - if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) { - layout.columns = columns; - } - } - if (isVConcatSpec(spec)) { - layout.columns = 1; - } - // Then copy properties from the spec - for (const prop of COMPOSITION_LAYOUT_PROPERTIES) { - if (spec[prop] !== undefined) { - if (prop === 'spacing') { - const spacing = spec[prop]; - layout[prop] = isNumber(spacing) - ? spacing - : { - row: (_a = spacing.row) !== null && _a !== void 0 ? _a : spacingConfig, - column: (_b = spacing.column) !== null && _b !== void 0 ? _b : spacingConfig - }; - } - else { - layout[prop] = spec[prop]; - } - } - } - return layout; - } - - function getViewConfigContinuousSize(viewConfig, channel) { - var _a; - return (_a = viewConfig[channel]) !== null && _a !== void 0 ? _a : viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility - } - function getViewConfigDiscreteStep(viewConfig, channel) { - const size = getViewConfigDiscreteSize(viewConfig, channel); - return isStep(size) ? size.step : DEFAULT_STEP; - } - function getViewConfigDiscreteSize(viewConfig, channel) { - var _a; - const size = (_a = viewConfig[channel]) !== null && _a !== void 0 ? _a : viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility - return getFirstDefined(size, { step: viewConfig.step }); - } - const DEFAULT_STEP = 20; - const defaultViewConfig = { - continuousWidth: 200, - continuousHeight: 200, - step: DEFAULT_STEP - }; - const defaultConfig$1 = { - background: 'white', - padding: 5, - timeFormat: '%b %d, %Y', - countTitle: 'Count of Records', - view: defaultViewConfig, - mark: defaultMarkConfig, - arc: {}, - area: {}, - bar: defaultBarConfig, - circle: {}, - geoshape: {}, - image: {}, - line: {}, - point: {}, - rect: defaultRectConfig, - rule: { color: 'black' }, - square: {}, - text: { color: 'black' }, - tick: defaultTickConfig, - trail: {}, - boxplot: { - size: 14, - extent: 1.5, - box: {}, - median: { color: 'white' }, - outliers: {}, - rule: {}, - ticks: null - }, - errorbar: { - center: 'mean', - rule: true, - ticks: false - }, - errorband: { - band: { - opacity: 0.3 - }, - borders: false - }, - scale: defaultScaleConfig, - projection: {}, - legend: defaultLegendConfig, - header: { titlePadding: 10, labelPadding: 10 }, - headerColumn: {}, - headerRow: {}, - headerFacet: {}, - selection: defaultConfig, - style: {}, - title: {}, - facet: { spacing: DEFAULT_SPACING }, - concat: { spacing: DEFAULT_SPACING } - }; - // Tableau10 color palette, copied from `vegaScale.scheme('tableau10')` - const tab10 = [ - '#4c78a8', - '#f58518', - '#e45756', - '#72b7b2', - '#54a24b', - '#eeca3b', - '#b279a2', - '#ff9da6', - '#9d755d', - '#bab0ac' - ]; - const DEFAULT_FONT_SIZE = { - text: 11, - guideLabel: 10, - guideTitle: 11, - groupTitle: 13, - groupSubtitle: 12 - }; - const DEFAULT_COLOR = { - blue: tab10[0], - orange: tab10[1], - red: tab10[2], - teal: tab10[3], - green: tab10[4], - yellow: tab10[5], - purple: tab10[6], - pink: tab10[7], - brown: tab10[8], - gray0: '#000', - gray1: '#111', - gray2: '#222', - gray3: '#333', - gray4: '#444', - gray5: '#555', - gray6: '#666', - gray7: '#777', - gray8: '#888', - gray9: '#999', - gray10: '#aaa', - gray11: '#bbb', - gray12: '#ccc', - gray13: '#ddd', - gray14: '#eee', - gray15: '#fff' - }; - function colorSignalConfig(color = {}) { - return { - signals: [ - { - name: 'color', - value: isObject(color) ? Object.assign(Object.assign({}, DEFAULT_COLOR), color) : DEFAULT_COLOR - } - ], - mark: { color: { signal: 'color.blue' } }, - rule: { color: { signal: 'color.gray0' } }, - text: { - color: { signal: 'color.gray0' } - }, - style: { - 'guide-label': { - fill: { signal: 'color.gray0' } - }, - 'guide-title': { - fill: { signal: 'color.gray0' } - }, - 'group-title': { - fill: { signal: 'color.gray0' } - }, - 'group-subtitle': { - fill: { signal: 'color.gray0' } - }, - cell: { - stroke: { signal: 'color.gray8' } - } - }, - axis: { - domainColor: { signal: 'color.gray13' }, - gridColor: { signal: 'color.gray8' }, - tickColor: { signal: 'color.gray13' } - }, - range: { - category: [ - { signal: 'color.blue' }, - { signal: 'color.orange' }, - { signal: 'color.red' }, - { signal: 'color.teal' }, - { signal: 'color.green' }, - { signal: 'color.yellow' }, - { signal: 'color.purple' }, - { signal: 'color.pink' }, - { signal: 'color.brown' }, - { signal: 'color.grey8' } - ] - } - }; - } - function fontSizeSignalConfig(fontSize) { - return { - signals: [ - { - name: 'fontSize', - value: isObject(fontSize) ? Object.assign(Object.assign({}, DEFAULT_FONT_SIZE), fontSize) : DEFAULT_FONT_SIZE - } - ], - text: { - fontSize: { signal: 'fontSize.text' } - }, - style: { - 'guide-label': { - fontSize: { signal: 'fontSize.guideLabel' } - }, - 'guide-title': { - fontSize: { signal: 'fontSize.guideTitle' } - }, - 'group-title': { - fontSize: { signal: 'fontSize.groupTitle' } - }, - 'group-subtitle': { - fontSize: { signal: 'fontSize.groupSubtitle' } - } - } - }; - } - function fontConfig(font) { - return { - text: { font }, - style: { - 'guide-label': { font }, - 'guide-title': { font }, - 'group-title': { font }, - 'group-subtitle': { font } - } - }; - } - function initConfig(config = {}) { - const { color, font, fontSize } = config, restConfig = __rest(config, ["color", "font", "fontSize"]); - return mergeConfig({}, defaultConfig$1, font ? fontConfig(font) : {}, color ? colorSignalConfig(color) : {}, fontSize ? fontSizeSignalConfig(fontSize) : {}, restConfig || {}); - } - const MARK_STYLES = ['view', ...PRIMITIVE_MARKS]; - const VL_ONLY_CONFIG_PROPERTIES = [ - 'color', - 'fontSize', - 'background', - 'padding', - 'facet', - 'concat', - 'numberFormat', - 'timeFormat', - 'countTitle', - 'header', - 'axisQuantitative', - 'axisTemporal', - 'axisDiscrete', - 'axisPoint', - 'axisXBand', - 'axisXPoint', - 'axisXDiscrete', - 'axisXQuantitative', - 'axisXTemporal', - 'axisYBand', - 'axisYPoint', - 'axisYDiscrete', - 'axisYQuantitative', - 'axisYTemporal', - 'scale', - 'selection', - 'overlay' // FIXME: Redesign and unhide this - ]; - const VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = Object.assign({ view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'] }, VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX); - function stripAndRedirectConfig(config) { - config = duplicate(config); - for (const prop of VL_ONLY_CONFIG_PROPERTIES) { - delete config[prop]; - } - if (config.axis) { - // delete condition axis config - for (const prop in config.axis) { - if (isConditionalAxisValue(config.axis[prop])) { - delete config.axis[prop]; - } - } - } - if (config.legend) { - for (const prop of VL_ONLY_LEGEND_CONFIG) { - delete config.legend[prop]; - } - } - // Remove Vega-Lite only generic mark config - if (config.mark) { - for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { - delete config.mark[prop]; - } - if (config.mark.tooltip && isObject(config.mark.tooltip)) { - delete config.mark.tooltip; - } - } - for (const markType of MARK_STYLES) { - // Remove Vega-Lite-only mark config - for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { - delete config[markType][prop]; - } - // Remove Vega-Lite only mark-specific config - const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType]; - if (vlOnlyMarkSpecificConfigs) { - for (const prop of vlOnlyMarkSpecificConfigs) { - delete config[markType][prop]; - } - } - // Redirect mark config to config.style so that mark config only affect its own mark type - // without affecting other marks that share the same underlying Vega marks. - // For example, config.rect should not affect bar marks. - redirectConfigToStyleConfig(config, markType); - } - for (const m of getAllCompositeMarks()) { - // Clean up the composite mark config as we don't need them in the output specs anymore - delete config[m]; - } - redirectTitleConfig(config); - // Remove empty config objects. - for (const prop in config) { - if (isObject(config[prop]) && isEmpty(config[prop])) { - delete config[prop]; - } - } - return isEmpty(config) ? undefined : config; - } - /** - * - * Redirect config.title -- so that title config do not affect header labels, - * which also uses `title` directive to implement. - * - * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles. - */ - function redirectTitleConfig(config) { - const { titleMarkConfig, subtitleMarkConfig, subtitle } = extractTitleConfig(config.title); - // set config.style if title/subtitleMarkConfig is not an empty object - if (!isEmpty(titleMarkConfig)) { - config.style['group-title'] = Object.assign(Object.assign({}, config.style['group-title']), titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega - ); - } - if (!isEmpty(subtitleMarkConfig)) { - config.style['group-subtitle'] = Object.assign(Object.assign({}, config.style['group-subtitle']), subtitleMarkConfig); - } - // subtitle part can stay in config.title since header titles do not use subtitle - if (!isEmpty(subtitle)) { - config.title = subtitle; - } - else { - delete config.title; - } - } - function redirectConfigToStyleConfig(config, prop, // string = composite mark - toProp, compositeMarkPart) { - const propConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop]; - if (prop === 'view') { - toProp = 'cell'; // View's default style is "cell" - } - const style = Object.assign(Object.assign({}, propConfig), config.style[toProp !== null && toProp !== void 0 ? toProp : prop]); - // set config.style if it is not an empty object - if (!isEmpty(style)) { - config.style[toProp !== null && toProp !== void 0 ? toProp : prop] = style; - } - if (!compositeMarkPart) { - // For composite mark, so don't delete the whole config yet as we have to do multiple redirections. - delete config[prop]; - } - } - - function isLayerSpec(spec) { - return 'layer' in spec; - } - - function isRepeatSpec(spec) { - return 'repeat' in spec; - } - function isLayerRepeatSpec(spec) { - return !isArray(spec.repeat) && spec.repeat['layer']; - } - - class SpecMapper { - map(spec, params) { - if (isFacetSpec(spec)) { - return this.mapFacet(spec, params); - } - else if (isRepeatSpec(spec)) { - return this.mapRepeat(spec, params); - } - else if (isHConcatSpec(spec)) { - return this.mapHConcat(spec, params); - } - else if (isVConcatSpec(spec)) { - return this.mapVConcat(spec, params); - } - else if (isConcatSpec(spec)) { - return this.mapConcat(spec, params); - } - else { - return this.mapLayerOrUnit(spec, params); - } - } - mapLayerOrUnit(spec, params) { - if (isLayerSpec(spec)) { - return this.mapLayer(spec, params); - } - else if (isUnitSpec(spec)) { - return this.mapUnit(spec, params); - } - throw new Error(invalidSpec(spec)); - } - mapLayer(spec, params) { - return Object.assign(Object.assign({}, spec), { layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params)) }); - } - mapHConcat(spec, params) { - return Object.assign(Object.assign({}, spec), { hconcat: spec.hconcat.map(subspec => this.map(subspec, params)) }); - } - mapVConcat(spec, params) { - return Object.assign(Object.assign({}, spec), { vconcat: spec.vconcat.map(subspec => this.map(subspec, params)) }); - } - mapConcat(spec, params) { - const { concat } = spec, rest = __rest(spec, ["concat"]); - return Object.assign(Object.assign({}, rest), { concat: concat.map(subspec => this.map(subspec, params)) }); - } - mapFacet(spec, params) { - return Object.assign(Object.assign({}, spec), { - // TODO: remove "any" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760 - spec: this.map(spec.spec, params) }); - } - mapRepeat(spec, params) { - return Object.assign(Object.assign({}, spec), { - // as any is required here since TS cannot infer that the output type satisfies the input type - spec: this.map(spec.spec, params) }); - } - } - - const STACK_OFFSET_INDEX = { - zero: 1, - center: 1, - normalize: 1 - }; - function isStackOffset(s) { - return s in STACK_OFFSET_INDEX; - } - const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]); - const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]); - function potentialStackedChannel(encoding, x) { - var _a, _b; - const y = x === 'x' ? 'y' : 'radius'; - const xDef = encoding[x]; - const yDef = encoding[y]; - if (isFieldDef(xDef) && isFieldDef(yDef)) { - if (channelDefType(xDef) === 'quantitative' && channelDefType(yDef) === 'quantitative') { - if (xDef.stack) { - return x; - } - else if (yDef.stack) { - return y; - } - const xAggregate = isFieldDef(xDef) && !!xDef.aggregate; - const yAggregate = isFieldDef(yDef) && !!yDef.aggregate; - // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y - if (xAggregate !== yAggregate) { - return xAggregate ? x : y; - } - else { - const xScale = (_a = xDef.scale) === null || _a === void 0 ? void 0 : _a.type; - const yScale = (_b = yDef.scale) === null || _b === void 0 ? void 0 : _b.type; - if (xScale && xScale !== 'linear') { - return y; - } - else if (yScale && yScale !== 'linear') { - return x; - } - } - } - else if (channelDefType(xDef) === 'quantitative') { - return x; - } - else if (channelDefType(yDef) === 'quantitative') { - return y; - } - } - else if (channelDefType(xDef) === 'quantitative') { - return x; - } - else if (channelDefType(yDef) === 'quantitative') { - return y; - } - return undefined; - } - function getDimensionChannel(channel) { - switch (channel) { - case 'x': - return 'y'; - case 'y': - return 'x'; - case 'theta': - return 'radius'; - case 'radius': - return 'theta'; - } - } - // Note: CompassQL uses this method and only pass in required properties of each argument object. - // If required properties change, make sure to update CompassQL. - function stack(m, encoding, opt = {}) { - const mark = isMarkDef(m) ? m.type : m; - // Should have stackable mark - if (!STACKABLE_MARKS.has(mark)) { - return null; - } - // Run potential stacked twice, one for Cartesian and another for Polar, - // so text marks can be stacked in any of the coordinates. - // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking. - // However, since we probably never want to do that, let's just note the limitation here. - const fieldChannel = potentialStackedChannel(encoding, 'x') || potentialStackedChannel(encoding, 'theta'); - if (!fieldChannel) { - return null; - } - const stackedFieldDef = encoding[fieldChannel]; - const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined; - let dimensionChannel = getDimensionChannel(fieldChannel); - let dimensionDef = encoding[dimensionChannel]; - let dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined; - // avoid grouping by the stacked field - if (dimensionField === stackedField) { - dimensionField = undefined; - dimensionDef = undefined; - dimensionChannel = undefined; - } - // Should have grouping level of detail that is different from the dimension field - const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => { - // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001) - if (channel !== 'tooltip' && channelHasField(encoding, channel)) { - const channelDef = encoding[channel]; - for (const cDef of array(channelDef)) { - const fieldDef = getFieldDef(cDef); - if (fieldDef.aggregate) { - continue; - } - // Check whether the channel's field is identical to x/y's field or if the channel is a repeat - const f = vgField(fieldDef, {}); - if ( - // if fielddef is a repeat, just include it in the stack by - !f || - // otherwise, the field must be different from x and y fields. - f !== dimensionField) { - sc.push({ channel, fieldDef }); - } - } - } - return sc; - }, []); - // Automatically determine offset - let offset; - if (stackedFieldDef.stack !== undefined) { - if (isBoolean(stackedFieldDef.stack)) { - offset = stackedFieldDef.stack ? 'zero' : null; - } - else { - offset = stackedFieldDef.stack; - } - } - else if (stackBy.length > 0 && STACK_BY_DEFAULT_MARKS.has(mark)) { - // Bar and Area with sum ops are automatically stacked by default - offset = 'zero'; - } - if (!offset || !isStackOffset(offset)) { - return null; - } - if (isAggregate(encoding) && stackBy.length === 0) { - return null; - } - // warn when stacking non-linear - if (stackedFieldDef.scale && stackedFieldDef.scale.type && stackedFieldDef.scale.type !== ScaleType.LINEAR) { - if (opt.disallowNonLinearStack) { - return null; - } - else { - warn(cannotStackNonLinearScale(stackedFieldDef.scale.type)); - } - } - // Check if it is a ranged mark - if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) { - if (stackedFieldDef.stack !== undefined) { - warn(cannotStackRangedMark(fieldChannel)); - } - return null; - } - // Warn if stacking non-summative aggregate - if (isFieldDef(stackedFieldDef) && stackedFieldDef.aggregate && !contains(SUM_OPS, stackedFieldDef.aggregate)) { - warn(stackNonSummativeAggregate(stackedFieldDef.aggregate)); - } - return { - groupbyChannel: dimensionDef ? dimensionChannel : undefined, - groupbyField: dimensionField, - fieldChannel, - impute: stackedFieldDef.impute === null ? false : isPathMark(mark), - stackBy, - offset - }; - } - - function dropLineAndPoint(markDef) { - const mark = __rest(markDef, ["point", "line"]); - return keys(mark).length > 1 ? mark : mark.type; - } - function dropLineAndPointFromConfig(config) { - for (const mark of ['line', 'area', 'rule', 'trail']) { - if (config[mark]) { - config = Object.assign(Object.assign({}, config), { - // TODO: remove as any - [mark]: omit(config[mark], ['point', 'line']) }); - } - } - return config; - } - function getPointOverlay(markDef, markConfig = {}, encoding) { - if (markDef.point === 'transparent') { - return { opacity: 0 }; - } - else if (markDef.point) { - // truthy : true or object - return isObject(markDef.point) ? markDef.point : {}; - } - else if (markDef.point !== undefined) { - // false or null - return null; - } - else { - // undefined (not disabled) - if (markConfig.point || encoding.shape) { - // enable point overlay if config[mark].point is truthy or if encoding.shape is provided - return isObject(markConfig.point) ? markConfig.point : {}; - } - // markDef.point is defined as falsy - return undefined; - } - } - function getLineOverlay(markDef, markConfig = {}) { - if (markDef.line) { - // true or object - return markDef.line === true ? {} : markDef.line; - } - else if (markDef.line !== undefined) { - // false or null - return null; - } - else { - // undefined (not disabled) - if (markConfig.line) { - // enable line overlay if config[mark].line is truthy - return markConfig.line === true ? {} : markConfig.line; - } - // markDef.point is defined as falsy - return undefined; - } - } - class PathOverlayNormalizer { - constructor() { - this.name = 'path-overlay'; - } - hasMatchingType(spec, config) { - if (isUnitSpec(spec)) { - const { mark, encoding } = spec; - const markDef = isMarkDef(mark) ? mark : { type: mark }; - switch (markDef.type) { - case 'line': - case 'rule': - case 'trail': - return !!getPointOverlay(markDef, config[markDef.type], encoding); - case 'area': - return ( - // false / null are also included as we want to remove the properties - !!getPointOverlay(markDef, config[markDef.type], encoding) || - !!getLineOverlay(markDef, config[markDef.type])); - } - } - return false; - } - run(spec, params, normalize) { - const { config } = params; - const { selection, projection, mark, encoding: e } = spec, outerSpec = __rest(spec, ["selection", "projection", "mark", "encoding"]); - // Need to call normalizeEncoding because we need the inferred types to correctly determine stack - const encoding = normalizeEncoding(e, config); - const markDef = isMarkDef(mark) ? mark : { type: mark }; - const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding); - const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]); - const layer = [ - Object.assign(Object.assign({}, (selection ? { selection } : {})), { mark: dropLineAndPoint(Object.assign(Object.assign({}, (markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined - ? { opacity: 0.7 } - : {})), markDef)), - // drop shape from encoding as this might be used to trigger point overlay - encoding: omit(encoding, ['shape']) }) - ]; - // FIXME: determine rules for applying selections. - // Need to copy stack config to overlayed layer - const stackProps = stack(markDef, encoding); - let overlayEncoding = encoding; - if (stackProps) { - const { fieldChannel: stackFieldChannel, offset } = stackProps; - overlayEncoding = Object.assign(Object.assign({}, encoding), { [stackFieldChannel]: Object.assign(Object.assign({}, encoding[stackFieldChannel]), (offset ? { stack: offset } : {})) }); - } - if (lineOverlay) { - layer.push(Object.assign(Object.assign({}, (projection ? { projection } : {})), { mark: Object.assign(Object.assign({ type: 'line' }, pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip'])), lineOverlay), encoding: overlayEncoding })); - } - if (pointOverlay) { - layer.push(Object.assign(Object.assign({}, (projection ? { projection } : {})), { mark: Object.assign(Object.assign({ type: 'point', opacity: 1, filled: true }, pick(markDef, ['clip', 'tooltip'])), pointOverlay), encoding: overlayEncoding })); - } - return normalize(Object.assign(Object.assign({}, outerSpec), { layer }), Object.assign(Object.assign({}, params), { config: dropLineAndPointFromConfig(config) })); - } - } - - class RangeStepNormalizer { - constructor() { - this.name = 'RangeStep'; - } - hasMatchingType(spec) { - var _a; - if (isUnitSpec(spec) && spec.encoding) { - for (const channel of POSITION_SCALE_CHANNELS) { - const def = spec.encoding[channel]; - if (def && isFieldOrDatumDef(def)) { - if ((_a = def === null || def === void 0 ? void 0 : def.scale) === null || _a === void 0 ? void 0 : _a['rangeStep']) { - return true; - } - } - } - } - return false; - } - run(spec) { - var _a; - const sizeMixins = {}; - let encoding = Object.assign({}, spec.encoding); - for (const channel of POSITION_SCALE_CHANNELS) { - const sizeType = getSizeChannel(channel); - const def = encoding[channel]; - if (def && isFieldOrDatumDef(def)) { - if ((_a = def === null || def === void 0 ? void 0 : def.scale) === null || _a === void 0 ? void 0 : _a['rangeStep']) { - const { scale } = def, defWithoutScale = __rest(def, ["scale"]); - const _b = scale, scaleWithoutRangeStep = __rest(_b, ["rangeStep"]); - sizeMixins[sizeType] = { step: scale['rangeStep'] }; - warn(RANGE_STEP_DEPRECATED); - encoding = Object.assign(Object.assign({}, encoding), { [channel]: Object.assign(Object.assign({}, defWithoutScale), (isEmpty(scaleWithoutRangeStep) ? {} : { scale: scaleWithoutRangeStep })) }); - } - } - } - return Object.assign(Object.assign(Object.assign({}, sizeMixins), spec), { encoding }); - } - } - - function replaceRepeaterInFacet(facet, repeater) { - if (!repeater) { - return facet; - } - if (isFacetMapping(facet)) { - return replaceRepeaterInMapping(facet, repeater); - } - return replaceRepeaterInFieldDef(facet, repeater); - } - function replaceRepeaterInEncoding(encoding, repeater) { - if (!repeater) { - return encoding; - } - return replaceRepeaterInMapping(encoding, repeater); - } - /** - * Replaces repeated value and returns if the repeated value is valid. - */ - function replaceRepeatInProp(prop, o, repeater) { - const val = o[prop]; - if (isRepeatRef(val)) { - if (val.repeat in repeater) { - return Object.assign(Object.assign({}, o), { [prop]: repeater[val.repeat] }); - } - else { - warn(noSuchRepeatedValue(val.repeat)); - return undefined; - } - } - return o; - } - /** - * Replace repeater values in a field def with the concrete field name. - */ - function replaceRepeaterInFieldDef(fieldDef, repeater) { - fieldDef = replaceRepeatInProp('field', fieldDef, repeater); - if (fieldDef === undefined) { - // the field def should be ignored - return undefined; - } - else if (fieldDef === null) { - return null; - } - if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) { - const sort = replaceRepeatInProp('field', fieldDef.sort, repeater); - fieldDef = Object.assign(Object.assign({}, fieldDef), (sort ? { sort } : {})); - } - return fieldDef; - } - function replaceRepeaterInFieldOrDatumDef(def, repeater) { - if (isFieldDef(def)) { - return replaceRepeaterInFieldDef(def, repeater); - } - else { - const datumDef = replaceRepeatInProp('datum', def, repeater); - if (datumDef !== def && !datumDef.type) { - datumDef.type = 'nominal'; - } - return datumDef; - } - } - function replaceRepeaterInChannelDef(channelDef, repeater) { - if (isFieldOrDatumDef(channelDef)) { - const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater); - if (fd) { - return fd; - } - else if (isConditionalDef(channelDef)) { - return { condition: channelDef.condition }; - } - } - else { - if (hasConditionalFieldOrDatumDef(channelDef)) { - const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater); - if (fd) { - return Object.assign(Object.assign({}, channelDef), { condition: fd }); - } - else { - const channelDefWithoutCondition = __rest(channelDef, ["condition"]); - return channelDefWithoutCondition; - } - } - return channelDef; - } - return undefined; - } - function replaceRepeaterInMapping(mapping, repeater) { - const out = {}; - for (const channel in mapping) { - if (hasOwnProperty(mapping, channel)) { - const channelDef = mapping[channel]; - if (isArray(channelDef)) { - // array cannot have condition - out[channel] = channelDef // somehow we need to cast it here - .map(cd => replaceRepeaterInChannelDef(cd, repeater)) - .filter(cd => cd); - } - else { - const cd = replaceRepeaterInChannelDef(channelDef, repeater); - if (cd !== undefined) { - out[channel] = cd; - } - } - } - } - return out; - } - - class RuleForRangedLineNormalizer { - constructor() { - this.name = 'RuleForRangedLine'; - } - hasMatchingType(spec) { - if (isUnitSpec(spec)) { - const { encoding, mark } = spec; - if (mark === 'line') { - for (const channel of SECONDARY_RANGE_CHANNEL) { - const mainChannel = getMainRangeChannel(channel); - const mainChannelDef = encoding[mainChannel]; - if (encoding[channel]) { - if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) { - return true; - } - } - } - } - } - return false; - } - run(spec, params, normalize) { - const { encoding } = spec; - warn(lineWithRange(!!encoding.x2, !!encoding.y2)); - return normalize(Object.assign(Object.assign({}, spec), { mark: 'rule' }), params); - } - } - - class CoreNormalizer extends SpecMapper { - constructor() { - super(...arguments); - this.nonFacetUnitNormalizers = [ - boxPlotNormalizer, - errorBarNormalizer, - errorBandNormalizer, - new PathOverlayNormalizer(), - new RuleForRangedLineNormalizer(), - new RangeStepNormalizer() - ]; - } - map(spec, params) { - // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec. - if (isUnitSpec(spec)) { - const hasRow = channelHasField(spec.encoding, ROW); - const hasColumn = channelHasField(spec.encoding, COLUMN); - const hasFacet = channelHasField(spec.encoding, FACET); - if (hasRow || hasColumn || hasFacet) { - return this.mapFacetedUnit(spec, params); - } - } - return super.map(spec, params); - } - // This is for normalizing non-facet unit - mapUnit(spec, params) { - const { parentEncoding, parentProjection } = params; - const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater); - const specWithReplacedEncoding = Object.assign(Object.assign({}, spec), (encoding ? { encoding } : {})); - if (parentEncoding || parentProjection) { - return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params); - } - const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this); - for (const unitNormalizer of this.nonFacetUnitNormalizers) { - if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) { - return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit); - } - } - return specWithReplacedEncoding; - } - mapRepeat(spec, params) { - if (isLayerRepeatSpec(spec)) { - return this.mapLayerRepeat(spec, params); - } - else { - return this.mapNonLayerRepeat(spec, params); - } - } - mapLayerRepeat(spec, params) { - const { repeat, spec: childSpec } = spec, rest = __rest(spec, ["repeat", "spec"]); - const { row, column, layer } = repeat; - const { repeater = {}, repeaterPrefix = '' } = params; - if (row || column) { - return this.mapRepeat(Object.assign(Object.assign({}, spec), { repeat: Object.assign(Object.assign({}, (row ? { row } : {})), (column ? { column } : {})), spec: { - repeat: { layer }, - spec: childSpec - } }), params); - } - else { - return Object.assign(Object.assign({}, rest), { layer: layer.map(layerValue => { - const childRepeater = Object.assign(Object.assign({}, repeater), { layer: layerValue }); - const childName = (childSpec.name || '') + repeaterPrefix + `child__layer_${varName(layerValue)}`; - const child = this.mapLayerOrUnit(childSpec, Object.assign(Object.assign({}, params), { repeater: childRepeater, repeaterPrefix: childName })); - child.name = childName; - return child; - }) }); - } - } - mapNonLayerRepeat(spec, params) { - var _a; - const { repeat, spec: childSpec, data } = spec, remainingProperties = __rest(spec, ["repeat", "spec", "data"]); - if (!isArray(repeat) && spec.columns) { - // is repeat with row/column - spec = omit(spec, ['columns']); - warn(columnsNotSupportByRowCol('repeat')); - } - const concat = []; - const { repeater = {}, repeaterPrefix = '' } = params; - const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null]; - const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null]; - const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null]; - // cross product - for (const repeatValue of repeatValues) { - for (const rowValue of row) { - for (const columnValue of column) { - const childRepeater = { - repeat: repeatValue, - row: rowValue, - column: columnValue, - layer: repeater.layer - }; - const childName = (childSpec.name || '') + - repeaterPrefix + - 'child__' + - (isArray(repeat) - ? `${varName(repeatValue)}` - : (repeat.row ? `row_${varName(rowValue)}` : '') + - (repeat.column ? `column_${varName(columnValue)}` : '')); - const child = this.map(childSpec, Object.assign(Object.assign({}, params), { repeater: childRepeater, repeaterPrefix: childName })); - child.name = childName; - // we move data up - concat.push(omit(child, ['data'])); - } - } - } - const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1; - return Object.assign(Object.assign({ data: (_a = childSpec.data) !== null && _a !== void 0 ? _a : data, align: 'all' }, remainingProperties), { columns, - concat }); - } - mapFacet(spec, params) { - const { facet } = spec; - if (isFacetMapping(facet) && spec.columns) { - // is facet with row/column - spec = omit(spec, ['columns']); - warn(columnsNotSupportByRowCol('facet')); - } - return super.mapFacet(spec, params); - } - mapUnitWithParentEncodingOrProjection(spec, params) { - const { encoding, projection } = spec; - const { parentEncoding, parentProjection, config } = params; - const mergedProjection = mergeProjection({ parentProjection, projection }); - const mergedEncoding = mergeEncoding({ - parentEncoding, - encoding: replaceRepeaterInEncoding(encoding, params.repeater) - }); - return this.mapUnit(Object.assign(Object.assign(Object.assign({}, spec), (mergedProjection ? { projection: mergedProjection } : {})), (mergedEncoding ? { encoding: mergedEncoding } : {})), { config }); - } - mapFacetedUnit(spec, params) { - // New encoding in the inside spec should not contain row / column - // as row/column should be moved to facet - const _a = spec.encoding, { row, column, facet } = _a, encoding = __rest(_a, ["row", "column", "facet"]); - // Mark and encoding should be moved into the inner spec - const { mark, width, projection, height, view, selection, encoding: _ } = spec, outerSpec = __rest(spec, ["mark", "width", "projection", "height", "view", "selection", "encoding"]); - const { facetMapping, layout } = this.getFacetMappingAndLayout({ row, column, facet }, params); - const newEncoding = replaceRepeaterInEncoding(encoding, params.repeater); - return this.mapFacet(Object.assign(Object.assign(Object.assign({}, outerSpec), layout), { - // row / column has higher precedence than facet - facet: facetMapping, spec: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (width ? { width } : {})), (height ? { height } : {})), (view ? { view } : {})), (projection ? { projection } : {})), { mark, encoding: newEncoding }), (selection ? { selection } : {})) }), params); - } - getFacetMappingAndLayout(facets, params) { - var _a; - const { row, column, facet } = facets; - if (row || column) { - if (facet) { - warn(facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])])); - } - const facetMapping = {}; - const layout = {}; - for (const channel of [ROW, COLUMN]) { - const def = facets[channel]; - if (def) { - const defWithoutLayout = __rest(def, ["align", "center", "spacing", "columns"]); - facetMapping[channel] = defWithoutLayout; - for (const prop of ['align', 'center', 'spacing']) { - if (def[prop] !== undefined) { - layout[prop] = (_a = layout[prop]) !== null && _a !== void 0 ? _a : {}; - layout[prop][channel] = def[prop]; - } - } - } - } - return { facetMapping, layout }; - } - else { - const { align, center, spacing, columns } = facet, facetMapping = __rest(facet, ["align", "center", "spacing", "columns"]); - return { - facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater), - layout: Object.assign(Object.assign(Object.assign(Object.assign({}, (align ? { align } : {})), (center ? { center } : {})), (spacing ? { spacing } : {})), (columns ? { columns } : {})) - }; - } - } - mapLayer(spec, _a) { - // Special handling for extended layer spec - var { parentEncoding, parentProjection } = _a, otherParams = __rest(_a, ["parentEncoding", "parentProjection"]); - const { encoding, projection } = spec, rest = __rest(spec, ["encoding", "projection"]); - const params = Object.assign(Object.assign({}, otherParams), { parentEncoding: mergeEncoding({ parentEncoding, encoding, layer: true }), parentProjection: mergeProjection({ parentProjection, projection }) }); - return super.mapLayer(rest, params); - } - } - function mergeEncoding({ parentEncoding, encoding = {}, layer }) { - let merged = {}; - if (parentEncoding) { - const channels = new Set([...keys(parentEncoding), ...keys(encoding)]); - for (const channel of channels) { - const channelDef = encoding[channel]; - const parentChannelDef = parentEncoding[channel]; - if (isFieldOrDatumDef(channelDef)) { - // Field/Datum Def can inherit properties from its parent - // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one. - const mergedChannelDef = Object.assign(Object.assign({}, parentChannelDef), channelDef); - merged[channel] = mergedChannelDef; - } - else if (hasConditionalFieldOrDatumDef(channelDef)) { - merged[channel] = Object.assign(Object.assign({}, channelDef), { condition: Object.assign(Object.assign({}, parentChannelDef), channelDef.condition) }); - } - else if (channelDef) { - merged[channel] = channelDef; - } - else if (layer || - isValueDef(parentChannelDef) || - isSignalRef(parentChannelDef) || - isFieldOrDatumDef(parentChannelDef) || - isArray(parentChannelDef)) { - merged[channel] = parentChannelDef; - } - } - } - else { - merged = encoding; - } - return !merged || isEmpty(merged) ? undefined : merged; - } - function mergeProjection(opt) { - const { parentProjection, projection } = opt; - if (parentProjection && projection) { - warn(projectionOverridden({ parentProjection, projection })); - } - return projection !== null && projection !== void 0 ? projection : parentProjection; - } - - function normalize(spec, config) { - if (config === undefined) { - config = initConfig(spec.config); - } - const normalizedSpec = normalizeGenericSpec(spec, config); - const { width, height } = spec; - const autosize = normalizeAutoSize(normalizedSpec, { width, height, autosize: spec.autosize }, config); - return Object.assign(Object.assign({}, normalizedSpec), (autosize ? { autosize } : {})); - } - const normalizer = new CoreNormalizer(); - /** - * Decompose extended unit specs into composition of pure unit specs. - */ - function normalizeGenericSpec(spec, config = {}) { - return normalizer.map(spec, { config }); - } - function _normalizeAutoSize(autosize) { - return isString(autosize) ? { type: autosize } : autosize !== null && autosize !== void 0 ? autosize : {}; - } - /** - * Normalize autosize and deal with width or height == "container". - */ - function normalizeAutoSize(spec, sizeInfo, config) { - let { width, height } = sizeInfo; - const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec); - const autosizeDefault = {}; - if (!isFitCompatible) { - // If spec is not compatible with autosize == "fit", discard width/height == container - if (width == 'container') { - warn(containerSizeNonSingle('width')); - width = undefined; - } - if (height == 'container') { - warn(containerSizeNonSingle('height')); - height = undefined; - } - } - else { - // Default autosize parameters to fit when width/height is "container" - if (width == 'container' && height == 'container') { - autosizeDefault.type = 'fit'; - autosizeDefault.contains = 'padding'; - } - else if (width == 'container') { - autosizeDefault.type = 'fit-x'; - autosizeDefault.contains = 'padding'; - } - else if (height == 'container') { - autosizeDefault.type = 'fit-y'; - autosizeDefault.contains = 'padding'; - } - } - const autosize = Object.assign(Object.assign(Object.assign({ type: 'pad' }, autosizeDefault), (config ? _normalizeAutoSize(config.autosize) : {})), _normalizeAutoSize(spec.autosize)); - if (autosize.type === 'fit' && !isFitCompatible) { - warn(FIT_NON_SINGLE); - autosize.type = 'pad'; - } - if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) { - warn(containerSizeNotCompatibleWithAutosize('width')); - } - if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) { - warn(containerSizeNotCompatibleWithAutosize('height')); - } - // Delete autosize property if it's Vega's default - if (deepEqual(autosize, { type: 'pad' })) { - return undefined; - } - return autosize; - } - - function isFitType(autoSizeType) { - return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y'; - } - function getFitType(sizeType) { - return sizeType ? `fit-${getPositionScaleChannel(sizeType)}` : 'fit'; - } - const TOP_LEVEL_PROPERTIES = [ - 'background', - 'padding' - // We do not include "autosize" here as it is supported by only unit and layer specs and thus need to be normalized - ]; - function extractTopLevelProperties(t) { - return TOP_LEVEL_PROPERTIES.reduce((o, p) => { - if (t && t[p] !== undefined) { - o[p] = t[p]; - } - return o; - }, {}); - } - - /** - * Generic class for storing properties that are explicitly specified - * and implicitly determined by the compiler. - * This is important for scale/axis/legend merging as - * we want to prioritize properties that users explicitly specified. - */ - // eslint-disable-next-line @typescript-eslint/ban-types - class Split { - constructor(explicit = {}, implicit = {}) { - this.explicit = explicit; - this.implicit = implicit; - } - clone() { - return new Split(duplicate(this.explicit), duplicate(this.implicit)); - } - combine() { - // FIXME remove "as any". - // Add "as any" to avoid an error "Spread types may only be created from object types". - return Object.assign(Object.assign({}, this.explicit), this.implicit); - } - get(key) { - // Explicit has higher precedence - return getFirstDefined(this.explicit[key], this.implicit[key]); - } - getWithExplicit(key) { - // Explicit has higher precedence - if (this.explicit[key] !== undefined) { - return { explicit: true, value: this.explicit[key] }; - } - else if (this.implicit[key] !== undefined) { - return { explicit: false, value: this.implicit[key] }; - } - return { explicit: false, value: undefined }; - } - setWithExplicit(key, value) { - if (value.value !== undefined) { - this.set(key, value.value, value.explicit); - } - } - set(key, value, explicit) { - delete this[explicit ? 'implicit' : 'explicit'][key]; - this[explicit ? 'explicit' : 'implicit'][key] = value; - return this; - } - copyKeyFromSplit(key, s) { - // Explicit has higher precedence - if (s.explicit[key] !== undefined) { - this.set(key, s.explicit[key], true); - } - else if (s.implicit[key] !== undefined) { - this.set(key, s.implicit[key], false); - } - } - copyKeyFromObject(key, s) { - // Explicit has higher precedence - if (s[key] !== undefined) { - this.set(key, s[key], true); - } - } - /** - * Merge split object into this split object. Properties from the other split - * overwrite properties from this split. - */ - copyAll(other) { - for (const key of keys(other.combine())) { - const val = other.getWithExplicit(key); - this.setWithExplicit(key, val); - } - } - } - function makeExplicit(value) { - return { - explicit: true, - value - }; - } - function makeImplicit(value) { - return { - explicit: false, - value - }; - } - function tieBreakByComparing(compare) { - return (v1, v2, property, propertyOf) => { - const diff = compare(v1.value, v2.value); - if (diff > 0) { - return v1; - } - else if (diff < 0) { - return v2; - } - return defaultTieBreaker(v1, v2, property, propertyOf); - }; - } - function defaultTieBreaker(v1, v2, property, propertyOf) { - if (v1.explicit && v2.explicit) { - warn(mergeConflictingProperty(property, propertyOf, v1.value, v2.value)); - } - // If equal score, prefer v1. - return v1; - } - function mergeValuesWithExplicit(v1, v2, property, propertyOf, tieBreaker = defaultTieBreaker) { - if (v1 === undefined || v1.value === undefined) { - // For first run - return v2; - } - if (v1.explicit && !v2.explicit) { - return v1; - } - else if (v2.explicit && !v1.explicit) { - return v2; - } - else if (deepEqual(v1.value, v2.value)) { - return v1; - } - else { - return tieBreaker(v1, v2, property, propertyOf); - } - } - - /** - * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf) - * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the - * same field again (or differently). - */ - class AncestorParse extends Split { - constructor(explicit = {}, implicit = {}, parseNothing = false) { - super(explicit, implicit); - this.explicit = explicit; - this.implicit = implicit; - this.parseNothing = parseNothing; - } - clone() { - const clone = super.clone(); - clone.parseNothing = this.parseNothing; - return clone; - } - } - - function isUrlData(data) { - return 'url' in data; - } - function isInlineData(data) { - return 'values' in data; - } - function isNamedData(data) { - return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data); - } - function isGenerator(data) { - return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data)); - } - function isSequenceGenerator(data) { - return 'sequence' in data; - } - function isSphereGenerator(data) { - return 'sphere' in data; - } - function isGraticuleGenerator(data) { - return 'graticule' in data; - } - var DataSourceType; - (function (DataSourceType) { - DataSourceType[DataSourceType["Raw"] = 0] = "Raw"; - DataSourceType[DataSourceType["Main"] = 1] = "Main"; - DataSourceType[DataSourceType["Row"] = 2] = "Row"; - DataSourceType[DataSourceType["Column"] = 3] = "Column"; - DataSourceType[DataSourceType["Lookup"] = 4] = "Lookup"; - })(DataSourceType || (DataSourceType = {})); - - function isFilter(t) { - return 'filter' in t; - } - function isImputeSequence(t) { - return (t === null || t === void 0 ? void 0 : t['stop']) !== undefined; - } - function isLookup(t) { - return 'lookup' in t; - } - function isLookupData(from) { - return 'data' in from; - } - function isLookupSelection(from) { - return 'selection' in from; - } - function isPivot(t) { - return 'pivot' in t; - } - function isDensity(t) { - return 'density' in t; - } - function isQuantile(t) { - return 'quantile' in t; - } - function isRegression(t) { - return 'regression' in t; - } - function isLoess(t) { - return 'loess' in t; - } - function isSample(t) { - return 'sample' in t; - } - function isWindow(t) { - return 'window' in t; - } - function isJoinAggregate(t) { - return 'joinaggregate' in t; - } - function isFlatten(t) { - return 'flatten' in t; - } - function isCalculate(t) { - return 'calculate' in t; - } - function isBin(t) { - return 'bin' in t; - } - function isImpute(t) { - return 'impute' in t; - } - function isTimeUnit(t) { - return 'timeUnit' in t; - } - function isAggregate$1(t) { - return 'aggregate' in t; - } - function isStack(t) { - return 'stack' in t; - } - function isFold(t) { - return 'fold' in t; - } - function normalizeTransform(transform) { - return transform.map(t => { - if (isFilter(t)) { - return { - filter: normalizeLogicalComposition(t.filter, normalizePredicate) - }; - } - return t; - }); - } - - /** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ - function parseSelector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector$1); - } - - var VIEW = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - - function isMarkType(type) { - return MARKS[type]; - } - - function find(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - for (; i= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - return i; - } - - function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - return output; - } - - function parseSelector$1(s) { - return s[0] === '[' - ? parseBetween(s) - : parseStream(s); - } - - function parseBetween(s) { - var n = s.length, - i = 1, - b, stream; - - i = find(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector$1); - - stream = parseSelector$1(s.slice(1).trim()); - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; - } - - function parseStream(s) { - var stream = {source: DEFAULT_SOURCE}, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, j, - filter; - - // extract throttle from end - if (s[n-1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i+1, n-1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - - if (!n) throw s; - - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - - // extract first part of multi-part stream selector - j = find(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } - - // extract remaining part of stream selector - i = find(s, i, LBRACK); - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - - // extract filters - while (i < n) { - i = find(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n-1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - - // marshall event stream specification - if (!(n = source.length) || ILLEGAL.test(source[n-1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - - return stream; - } - - function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function(_) { - var x = +_; - if (x !== x) throw s; - return x; - }); - } - - /** - * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition - * or a simple mixin if channel def has no condition. - */ - function wrapCondition(model, channelDef, vgChannel, refFn) { - const condition = isConditionalDef(channelDef) && channelDef.condition; - const valueRef = refFn(channelDef); - if (condition) { - const conditions = array(condition); - const vgConditions = conditions.map(c => { - const conditionValueRef = refFn(c); - const test = isConditionalSelection(c) - ? parseSelectionPredicate(model, c.selection) // FIXME: remove casting once TS is no longer dumb about it - : expression(model, c.test); // FIXME: remove casting once TS is no longer dumb about it - return Object.assign({ test }, conditionValueRef); - }); - return { - [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])] - }; - } - else { - return valueRef !== undefined ? { [vgChannel]: valueRef } : {}; - } - } - - function text(model, channel = 'text') { - const channelDef = model.encoding[channel]; - return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config)); - } - function textRef(channelDef, config, expr = 'datum') { - // text - if (channelDef) { - if (isValueDef(channelDef)) { - return signalOrValueRef(channelDef.value); - } - if (isFieldOrDatumDef(channelDef)) { - const { format, formatType } = getFormatMixins(channelDef); - return formatSignalRef({ fieldOrDatumDef: channelDef, format, formatType, expr, config }); - } - } - return undefined; - } - - function tooltip(model, opt = {}) { - const { encoding, markDef, config, stack } = model; - const channelDef = encoding.tooltip; - if (isArray(channelDef)) { - return { tooltip: tooltipRefForEncoding({ tooltip: channelDef }, stack, config, opt) }; - } - else { - const datum = opt.reactiveGeom ? 'datum.datum' : 'datum'; - return wrapCondition(model, channelDef, 'tooltip', cDef => { - // use valueRef based on channelDef first - const tooltipRefFromChannelDef = textRef(cDef, config, datum); - if (tooltipRefFromChannelDef) { - return tooltipRefFromChannelDef; - } - if (cDef === null) { - // Allow using encoding.tooltip = null to disable tooltip - return undefined; - } - let markTooltip = getMarkPropOrConfig('tooltip', markDef, config); - if (markTooltip === true) { - markTooltip = { content: 'encoding' }; - } - if (isString(markTooltip)) { - return { value: markTooltip }; - } - else if (isObject(markTooltip)) { - // `tooltip` is `{fields: 'encodings' | 'fields'}` - if (isSignalRef(markTooltip)) { - return markTooltip; - } - else if (markTooltip.content === 'encoding') { - return tooltipRefForEncoding(encoding, stack, config, opt); - } - else { - return { signal: datum }; - } - } - return undefined; - }); - } - } - function tooltipData(encoding, stack, config, { reactiveGeom } = {}) { - const toSkip = {}; - const expr = reactiveGeom ? 'datum.datum' : 'datum'; - const tuples = []; - function add(fDef, channel) { - const mainChannel = getMainRangeChannel(channel); - const fieldDef = isTypedFieldDef(fDef) - ? fDef - : Object.assign(Object.assign({}, fDef), { type: encoding[mainChannel].type // for secondary field def, copy type from main channel - }); - const title = fieldDef.title || defaultTitle(fieldDef, config); - const key = array(title).join(', '); - let value; - if (isXorY(channel)) { - const channel2 = channel === 'x' ? 'x2' : 'y2'; - const fieldDef2 = getFieldDef(encoding[channel2]); - if (isBinned(fieldDef.bin) && fieldDef2) { - const startField = vgField(fieldDef, { expr }); - const endField = vgField(fieldDef2, { expr }); - const { format, formatType } = getFormatMixins(fieldDef); - value = binFormatExpression(startField, endField, format, formatType, config); - toSkip[channel2] = true; - } - else if (stack && stack.fieldChannel === channel && stack.offset === 'normalize') { - const { format, formatType } = getFormatMixins(fieldDef); - value = formatSignalRef({ fieldOrDatumDef: fieldDef, format, formatType, expr, config, normalizeStack: true }) - .signal; - } - } - value = value !== null && value !== void 0 ? value : textRef(fieldDef, config, expr).signal; - tuples.push({ channel, key, value }); - } - forEach(encoding, (channelDef, channel) => { - if (isFieldDef(channelDef)) { - add(channelDef, channel); - } - else if (hasConditionalFieldDef(channelDef)) { - add(channelDef.condition, channel); - } - }); - const out = {}; - for (const { channel, key, value } of tuples) { - if (!toSkip[channel] && !out[key]) { - out[key] = value; - } - } - return out; - } - function tooltipRefForEncoding(encoding, stack, config, { reactiveGeom } = {}) { - const data = tooltipData(encoding, stack, config, { reactiveGeom }); - const keyValues = entries(data).map(({ key, value }) => `"${key}": ${value}`); - return keyValues.length > 0 ? { signal: `{${keyValues.join(', ')}}` } : undefined; - } - - function aria(model) { - const { markDef, config } = model; - const enableAria = getMarkPropOrConfig('aria', markDef, config); - // We can ignore other aria properties if ariaHidden is true. - if (enableAria === false) { - // getMarkGroups sets aria to false already so we don't have to set it in the encode block - return {}; - } - return Object.assign(Object.assign(Object.assign({}, (enableAria ? { aria: enableAria } : {})), ariaRoleDescription(model)), description(model)); - } - function ariaRoleDescription(model) { - const { mark, markDef, config } = model; - if (config.aria === false) { - return {}; - } - const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config); - if (ariaRoleDesc != null) { - return { ariaRoleDescription: { value: ariaRoleDesc } }; - } - return mark in VG_MARK_INDEX ? {} : { ariaRoleDescription: { value: mark } }; - } - function description(model) { - const { encoding, markDef, config, stack } = model; - const channelDef = encoding.description; - if (channelDef) { - return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config)); - } - // Use default from mark def or config if defined. - // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here. - const descriptionValue = getMarkPropOrConfig('description', markDef, config); - if (descriptionValue != null) { - return { - description: signalOrValueRef(descriptionValue) - }; - } - if (config.aria === false) { - return {}; - } - const data = tooltipData(encoding, stack, config); - if (isEmpty(data)) { - return undefined; - } - return { - description: { - signal: entries(data) - .map(({ key, value }, index) => `"${index > 0 ? '; ' : ''}${key}: " + (${value})`) - .join(' + ') - } - }; - } - - /** - * Return encode for non-positional channels with scales. (Text doesn't have scale.) - */ - function nonPosition(channel, model, opt = {}) { - const { markDef, encoding, config } = model; - const { vgChannel } = opt; - let { defaultRef, defaultValue } = opt; - if (defaultRef === undefined) { - // prettier-ignore - defaultValue = defaultValue !== null && defaultValue !== void 0 ? defaultValue : getMarkPropOrConfig(channel, markDef, config, { vgChannel, ignoreVgConfig: true }); - if (defaultValue !== undefined) { - defaultRef = signalOrValueRef(defaultValue); - } - } - const channelDef = encoding[channel]; - return wrapCondition(model, channelDef, vgChannel !== null && vgChannel !== void 0 ? vgChannel : channel, cDef => { - return midPoint({ - channel, - channelDef: cDef, - markDef, - config, - scaleName: model.scaleName(channel), - scale: model.getScaleComponent(channel), - stack: null, - defaultRef - }); - }); - } - - function color(model, opt = { filled: undefined }) { - var _a, _b, _c, _d; - const { markDef, encoding, config } = model; - const { type: markType } = markDef; - // Allow filled to be overridden (for trail's "filled") - const filled = (_a = opt.filled) !== null && _a !== void 0 ? _a : getMarkPropOrConfig('filled', markDef, config); - const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType) - ? 'transparent' - : undefined; - const defaultFill = (_c = (_b = getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, { vgChannel: 'fill' })) !== null && _b !== void 0 ? _b : - // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified - config.mark[filled === true && 'color']) !== null && _c !== void 0 ? _c : - // If there is no fill, always fill symbols, bar, geoshape - // with transparent fills https://github.com/vega/vega-lite/issues/1316 - transparentIfNeeded; - const defaultStroke = (_d = getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, { vgChannel: 'stroke' })) !== null && _d !== void 0 ? _d : - // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified - config.mark[filled === false && 'color']; - const colorVgChannel = filled ? 'fill' : 'stroke'; - const fillStrokeMarkDefAndConfig = Object.assign(Object.assign({}, (defaultFill ? { fill: signalOrValueRef(defaultFill) } : {})), (defaultStroke ? { stroke: signalOrValueRef(defaultStroke) } : {})); - if (markDef.color && (filled ? markDef.fill : markDef.stroke)) { - warn(droppingColor('property', { fill: 'fill' in markDef, stroke: 'stroke' in markDef })); - } - return Object.assign(Object.assign(Object.assign(Object.assign({}, fillStrokeMarkDefAndConfig), nonPosition('color', model, { - vgChannel: colorVgChannel, - defaultValue: filled ? defaultFill : defaultStroke - })), nonPosition('fill', model, { - // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding - defaultValue: encoding.fill ? defaultFill : undefined - })), nonPosition('stroke', model, { - // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding - defaultValue: encoding.stroke ? defaultStroke : undefined - })); - } - - function zindex(model) { - const { encoding, mark } = model; - const order = encoding.order; - if (!isPathMark(mark) && isValueDef(order)) { - return wrapCondition(model, order, 'zindex', cd => cd); - } - return {}; - } - - function getOffset(channel, markDef) { - const offsetChannel = getOffsetChannel(channel); - // TODO: in the future read from encoding channel too - const markDefOffsetValue = markDef[offsetChannel]; - if (markDefOffsetValue) { - return markDefOffsetValue; - } - return undefined; - } - - /** - * Return encode for point (non-band) position channels. - */ - function pointPosition(channel, model, { defaultPos, vgChannel, isMidPoint }) { - const { encoding, markDef, config, stack } = model; - const channelDef = encoding[channel]; - const channel2Def = encoding[getSecondaryRangeChannel(channel)]; - const scaleName = model.scaleName(channel); - const scale = model.getScaleComponent(channel); - const offset = getOffset(channel, markDef); - // Get default position or position from mark def - const defaultRef = pointPositionDefaultRef({ - model, - defaultPos, - channel, - scaleName, - scale - }); - const valueRef = !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude) - ? // use geopoint output if there are lat/long and there is no point position overriding lat/long. - { field: model.getName(channel) } - : positionRef({ - channel, - channelDef, - channel2Def, - markDef, - config, - isMidPoint, - scaleName, - scale, - stack, - offset, - defaultRef - }); - return valueRef ? { [vgChannel || channel]: valueRef } : undefined; - } - // TODO: we need to find a way to refactor these so that scaleName is a part of scale - // but that's complicated. For now, this is a huge step moving forward. - /** - * @return Vega ValueRef for normal x- or y-position without projection - */ - function positionRef(params) { - const { channel, channelDef, isMidPoint, scaleName, stack, offset, markDef, config } = params; - // This isn't a part of midPoint because we use midPoint for non-position too - if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) { - if (isFieldDef(channelDef)) { - const band = getBand({ - channel, - fieldDef: channelDef, - isMidPoint, - markDef, - stack, - config - }); - if (band !== undefined) { - return interpolatedSignalRef({ - scaleName, - fieldOrDatumDef: channelDef, - startSuffix: 'start', - band, - offset - }); - } - } - // x or y use stack_end so that stacked line's point mark use stack_end too. - return valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'end' }, { offset }); - } - return midPointRefWithPositionInvalidTest(params); - } - function pointPositionDefaultRef({ model, defaultPos, channel, scaleName, scale }) { - const { markDef, config } = model; - return () => { - const mainChannel = getMainRangeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, { vgChannel }); - if (definedValueOrConfig !== undefined) { - return widthHeightValueOrSignalRef(channel, definedValueOrConfig); - } - switch (defaultPos) { - case 'zeroOrMin': - case 'zeroOrMax': - if (scaleName) { - const scaleType = scale.get('type'); - if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) ; - else { - if (scale.domainDefinitelyIncludesZero()) { - return { - scale: scaleName, - value: 0 - }; - } - } - } - if (defaultPos === 'zeroOrMin') { - return mainChannel === 'y' ? { field: { group: 'height' } } : { value: 0 }; - } - else { - // zeroOrMax - switch (mainChannel) { - case 'radius': - // max of radius is min(width, height) / 2 - return { - signal: `min(${model.width.signal},${model.height.signal})/2` - }; - case 'theta': - return { signal: '2*PI' }; - case 'x': - return { field: { group: 'width' } }; - case 'y': - return { value: 0 }; - } - } - break; - case 'mid': { - const sizeRef = model[getSizeChannel(channel)]; - return Object.assign(Object.assign({}, sizeRef), { mult: 0.5 }); - } - } - // defaultPos === null - return undefined; - }; - } - - const ALIGNED_X_CHANNEL = { - left: 'x', - center: 'xc', - right: 'x2' - }; - const BASELINED_Y_CHANNEL = { - top: 'y', - middle: 'yc', - bottom: 'y2' - }; - function vgAlignedPositionChannel(channel, markDef, config, defaultAlign = 'middle') { - if (channel === 'radius' || channel === 'theta') { - return getVgPositionChannel(channel); - } - const alignChannel = channel === 'x' ? 'align' : 'baseline'; - const align = getMarkPropOrConfig(alignChannel, markDef, config); - if (channel === 'x') { - return ALIGNED_X_CHANNEL[align || (defaultAlign === 'top' ? 'left' : 'center')]; - } - else { - return BASELINED_Y_CHANNEL[align || defaultAlign]; - } - } - - /** - * Utility for area/rule position, which can be either point or range. (One of the axes should be point and the other should be range.) - */ - function pointOrRangePosition(channel, model, { defaultPos, defaultPos2, range }) { - if (range) { - return rangePosition(channel, model, { defaultPos, defaultPos2 }); - } - return pointPosition(channel, model, { defaultPos }); - } - function rangePosition(channel, model, { defaultPos, defaultPos2 }) { - const { markDef, config } = model; - const channel2 = getSecondaryRangeChannel(channel); - const sizeChannel = getSizeChannel(channel); - const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2); - const vgChannel = pos2Mixins[sizeChannel] - ? // If there is width/height, we need to position the marks based on the alignment. - vgAlignedPositionChannel(channel, markDef, config) - : // Otherwise, make sure to apply to the right Vg Channel (for arc mark) - getVgPositionChannel(channel); - return Object.assign(Object.assign({}, pointPosition(channel, model, { defaultPos, vgChannel })), pos2Mixins); - } - /** - * Return encode for x2, y2. - * If channel is not specified, return one channel based on orientation. - */ - function pointPosition2OrSize(model, defaultPos, channel) { - const { encoding, mark, markDef, stack, config } = model; - const baseChannel = getMainRangeChannel(channel); - const sizeChannel = getSizeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - const channelDef = encoding[baseChannel]; - const scaleName = model.scaleName(baseChannel); - const scale = model.getScaleComponent(baseChannel); - const offset = channel in encoding || channel in markDef - ? getOffset(channel, model.markDef) - : getOffset(baseChannel, model.markDef); - if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) { - // use geopoint output if there are lat2/long2 and there is no point position2 overriding lat2/long2. - return { [vgChannel]: { field: model.getName(channel) } }; - } - const valueRef = position2Ref({ - channel, - channelDef, - channel2Def: encoding[channel], - markDef, - config, - scaleName, - scale, - stack, - offset, - defaultRef: undefined - }); - if (valueRef !== undefined) { - return { [vgChannel]: valueRef }; - } - // TODO: check width/height encoding here once we add them - // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence: - // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark) - return (position2orSize(channel, markDef) || - position2orSize(channel, { - [channel]: getMarkStyleConfig(channel, markDef, config.style), - [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style) - }) || - position2orSize(channel, config[mark]) || - position2orSize(channel, config.mark) || { - [vgChannel]: pointPositionDefaultRef({ - model, - defaultPos, - channel, - scaleName, - scale - })() - }); - } - function position2Ref({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef }) { - if (isFieldOrDatumDef(channelDef) && - stack && - // If fieldChannel is X and channel is X2 (or Y and Y2) - channel.charAt(0) === stack.fieldChannel.charAt(0)) { - return valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'start' }, { offset }); - } - return midPointRefWithPositionInvalidTest({ - channel, - channelDef: channel2Def, - scaleName, - scale, - stack, - markDef, - config, - offset, - defaultRef - }); - } - function position2orSize(channel, markDef) { - const sizeChannel = getSizeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - if (markDef[vgChannel] !== undefined) { - return { [vgChannel]: widthHeightValueOrSignalRef(channel, markDef[vgChannel]) }; - } - else if (markDef[channel] !== undefined) { - return { [vgChannel]: widthHeightValueOrSignalRef(channel, markDef[channel]) }; - } - else if (markDef[sizeChannel]) { - return { [sizeChannel]: widthHeightValueOrSignalRef(channel, markDef[sizeChannel]) }; - } - return undefined; - } - - function rectPosition(model, channel, mark) { - var _a, _b, _c, _d; - const { config, encoding, markDef, stack } = model; - const channel2 = getSecondaryRangeChannel(channel); - const sizeChannel = getSizeChannel(channel); - const channelDef = encoding[channel]; - const channelDef2 = encoding[channel2]; - const scale = model.getScaleComponent(channel); - const scaleType = scale ? scale.get('type') : undefined; - const scaleName = model.scaleName(channel); - const orient = markDef.orient; - const hasSizeDef = (_b = (_a = encoding[sizeChannel]) !== null && _a !== void 0 ? _a : encoding.size) !== null && _b !== void 0 ? _b : getMarkPropOrConfig('size', markDef, config, { vgChannel: sizeChannel }); - const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal'); - // x, x2, and width -- we must specify two of these in all conditions - if (isFieldDef(channelDef) && - (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) && - !hasSizeDef && - !hasDiscreteDomain(scaleType)) { - const band = getBand({ channel, fieldDef: channelDef, stack, markDef, config }); - const axis = (_c = model.component.axes[channel]) === null || _c === void 0 ? void 0 : _c[0]; - const axisTranslate = (_d = axis === null || axis === void 0 ? void 0 : axis.get('translate')) !== null && _d !== void 0 ? _d : 0.5; // vega default is 0.5 - return rectBinPosition({ - fieldDef: channelDef, - fieldDef2: channelDef2, - channel, - markDef, - scaleName, - band, - axisTranslate, - spacing: isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) : undefined, - reverse: scale.get('reverse'), - config - }); - } - else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) { - return positionAndSize(mark, channelDef, channel, model); - } - else { - return rangePosition(channel, model, { defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin' }); - } - } - function defaultSizeRef(mark, sizeChannel, scaleName, scale, config, band) { - if (scale) { - const scaleType = scale.get('type'); - if (scaleType === 'point' || scaleType === 'band') { - if (config[mark].discreteBandSize !== undefined) { - return { value: config[mark].discreteBandSize }; - } - if (scaleType === ScaleType.POINT) { - const scaleRange = scale.get('range'); - if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { - return { value: scaleRange.step - 2 }; - } - return { value: DEFAULT_STEP - 2 }; - } - else { - // BAND - return { scale: scaleName, band }; - } - } - else { - // continuous scale - return { value: config[mark].continuousBandSize }; - } - } - // No Scale - const step = getViewConfigDiscreteStep(config.view, sizeChannel); - const value = getFirstDefined( - // No scale is like discrete bar (with one item) - config[mark].discreteBandSize, step - 2); - return value !== undefined ? { value } : undefined; - } - /** - * Output position encoding and its size encoding for continuous, point, and band scales. - */ - function positionAndSize(mark, fieldDef, channel, model) { - var _a; - const { markDef, encoding, config, stack } = model; - const orient = markDef.orient; - const scaleName = model.scaleName(channel); - const scale = model.getScaleComponent(channel); - const vgSizeChannel = getSizeChannel(channel); - const channel2 = getSecondaryRangeChannel(channel); - // use "size" channel for bars, if there is orient and the channel matches the right orientation - const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x'); - const sizeFromMarkOrConfig = getMarkPropOrConfig(useVlSizeChannel ? 'size' : vgSizeChannel, markDef, config, { - vgChannel: vgSizeChannel - }); - // Use size encoding / mark property / config if it exists - let sizeMixins; - if (encoding.size || sizeFromMarkOrConfig !== undefined) { - if (useVlSizeChannel) { - sizeMixins = nonPosition('size', model, { vgChannel: vgSizeChannel, defaultValue: sizeFromMarkOrConfig }); - } - else { - warn(cannotApplySizeToNonOrientedMark(markDef.type)); - } - } - // Otherwise, apply default value - const band = (_a = (isFieldOrDatumDef(fieldDef) ? getBand({ channel, fieldDef, markDef, stack, config }) : undefined)) !== null && _a !== void 0 ? _a : 1; - sizeMixins = sizeMixins || { [vgSizeChannel]: defaultSizeRef(mark, vgSizeChannel, scaleName, scale, config, band) }; - /* - Band scales with size value and all point scales, use xc/yc + band=0.5 - - Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2. - In this case, size_band is the band specified in the x/y-encoding. - By default band is 1, so `(1 - band) / 2` = 0. - If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2 - */ - const center = (scale === null || scale === void 0 ? void 0 : scale.get('type')) !== 'band' || !('band' in sizeMixins[vgSizeChannel]); - const vgChannel = vgAlignedPositionChannel(channel, markDef, config, center ? 'middle' : 'top'); - const offset = getOffset(channel, markDef); - const posRef = midPointRefWithPositionInvalidTest({ - channel, - channelDef: fieldDef, - markDef, - config, - scaleName, - scale, - stack, - offset, - defaultRef: pointPositionDefaultRef({ model, defaultPos: 'mid', channel, scaleName, scale }), - band: center ? 0.5 : (1 - band) / 2 - }); - if (vgSizeChannel) { - return Object.assign({ [vgChannel]: posRef }, sizeMixins); - } - else { - // otherwise, we must simulate size by setting position2 = position + size - // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth) - const vgChannel2 = getVgPositionChannel(channel2); - const sizeRef = sizeMixins[vgSizeChannel]; - const sizeOffset = offset ? Object.assign(Object.assign({}, sizeRef), { offset }) : sizeRef; - return { - [vgChannel]: posRef, - // posRef might be an array that wraps position invalid test - [vgChannel2]: isArray(posRef) - ? [posRef[0], Object.assign(Object.assign({}, posRef[1]), { offset: sizeOffset })] - : Object.assign(Object.assign({}, posRef), { offset: sizeOffset }) - }; - } - } - function getBinSpacing(channel, spacing, reverse, translate, offset) { - if (isPolarPositionChannel(channel)) { - return 0; - } - const spacingOffset = channel === 'x' || channel === 'y2' ? -spacing / 2 : spacing / 2; - if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(translate)) { - const reverseExpr = signalOrStringValue(reverse); - const offsetExpr = signalOrStringValue(offset); - const translateExpr = signalOrStringValue(translate); - const t = translateExpr ? `${translateExpr} + ` : ''; - const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : ''; - const o = offsetExpr ? `(${offsetExpr} + ${spacingOffset})` : spacingOffset; - return { - signal: t + r + o - }; - } - else { - offset = offset || 0; - return translate + (reverse ? -offset - spacingOffset : +offset + spacingOffset); - } - } - function rectBinPosition({ fieldDef, fieldDef2, channel, band, scaleName, markDef, spacing = 0, axisTranslate, reverse, config }) { - const channel2 = getSecondaryRangeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - const vgChannel2 = getVgPositionChannel(channel2); - const offset = getOffset(channel, markDef); - if (isBinning(fieldDef.bin) || fieldDef.timeUnit) { - return { - [vgChannel2]: rectBinRef({ - channel, - fieldDef, - scaleName, - markDef, - band: (1 - band) / 2, - offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset), - config - }), - [vgChannel]: rectBinRef({ - channel, - fieldDef, - scaleName, - markDef, - band: 1 - (1 - band) / 2, - offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset), - config - }) - }; - } - else if (isBinned(fieldDef.bin)) { - const startRef = valueRefForFieldOrDatumDef(fieldDef, scaleName, {}, { offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset) }); - if (isFieldDef(fieldDef2)) { - return { - [vgChannel2]: startRef, - [vgChannel]: valueRefForFieldOrDatumDef(fieldDef2, scaleName, {}, { offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset) }) - }; - } - else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) { - return { - [vgChannel2]: startRef, - [vgChannel]: { - signal: `scale("${scaleName}", ${vgField(fieldDef, { expr: 'datum' })} + ${fieldDef.bin.step})`, - offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset) - } - }; - } - } - warn(channelRequiredForBinned(channel2)); - return undefined; - } - /** - * Value Ref for binned fields - */ - function rectBinRef({ channel, fieldDef, scaleName, markDef, band, offset, config }) { - const r = interpolatedSignalRef({ - scaleName, - fieldOrDatumDef: fieldDef, - band, - offset - }); - return wrapPositionInvalidTest({ - fieldDef, - channel, - markDef, - ref: r, - config - }); - } - - const ALWAYS_IGNORE = new Set(['aria']); - function baseEncodeEntry(model, ignore) { - const { fill = undefined, stroke = undefined } = ignore.color === 'include' ? color(model) : {}; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, markDefProperties(model.markDef, ignore)), wrapAllFieldsInvalid(model, 'fill', fill)), wrapAllFieldsInvalid(model, 'stroke', stroke)), nonPosition('opacity', model)), nonPosition('fillOpacity', model)), nonPosition('strokeOpacity', model)), nonPosition('strokeWidth', model)), nonPosition('strokeDash', model)), zindex(model)), tooltip(model)), text(model, 'href')), aria(model)); - } - // TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987 - function wrapAllFieldsInvalid(model, channel, valueRef) { - const { config, mark, markDef } = model; - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid === 'hide' && valueRef && !isPathMark(mark)) { - // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains. - // For path marks, we will use "defined" property and skip these values instead. - const test = allFieldsInvalidPredicate(model, { invalid: true, channels: SCALE_CHANNELS }); - if (test) { - return { - [channel]: [ - // prepend the invalid case - // TODO: support custom value - { test, value: null }, - ...array(valueRef) - ] - }; - } - } - return valueRef ? { [channel]: valueRef } : {}; - } - function markDefProperties(mark, ignore) { - return VG_MARK_CONFIGS.reduce((m, prop) => { - if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') { - m[prop] = signalOrValueRef(mark[prop]); - } - return m; - }, {}); - } - function allFieldsInvalidPredicate(model, { invalid = false, channels }) { - const filterIndex = channels.reduce((aggregator, channel) => { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const field = model.vgField(channel, { expr: 'datum' }); - // While discrete domain scales can handle invalid values, continuous scales can't. - if (field && hasContinuousDomain(scaleType)) { - aggregator[field] = true; - } - } - return aggregator; - }, {}); - const fields = keys(filterIndex); - if (fields.length > 0) { - const op = invalid ? '||' : '&&'; - return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); - } - return undefined; - } - - function defined(model) { - const { config, markDef } = model; - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid) { - const signal = allFieldsInvalidPredicate$1(model, { channels: POSITION_SCALE_CHANNELS }); - if (signal) { - return { defined: { signal } }; - } - } - return {}; - } - function allFieldsInvalidPredicate$1(model, { invalid = false, channels }) { - const filterIndex = channels.reduce((aggregator, channel) => { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const field = model.vgField(channel, { expr: 'datum' }); - // While discrete domain scales can handle invalid values, continuous scales can't. - if (field && hasContinuousDomain(scaleType)) { - aggregator[field] = true; - } - } - return aggregator; - }, {}); - const fields = keys(filterIndex); - if (fields.length > 0) { - const op = invalid ? '||' : '&&'; - return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); - } - return undefined; - } - function valueIfDefined(prop, value) { - if (value !== undefined) { - return { [prop]: signalOrValueRef(value) }; - } - return undefined; - } - - const VORONOI = 'voronoi'; - const nearest = { - has: selCmpt => { - return selCmpt.type !== 'interval' && selCmpt.nearest; - }, - parse: (model, selCmpt) => { - // Scope selection events to the voronoi mark to prevent capturing - // events that occur on the group mark (https://github.com/vega/vega/issues/2112). - if (selCmpt.events) { - for (const s of selCmpt.events) { - s.markname = model.getName(VORONOI); - } - } - }, - marks: (model, selCmpt, marks) => { - const { x, y } = selCmpt.project.hasChannel; - const markType = model.mark; - if (isPathMark(markType)) { - warn(nearestNotSupportForContinuous(markType)); - return marks; - } - const cellDef = { - name: model.getName(VORONOI), - type: 'path', - interactive: true, - from: { data: model.getName('marks') }, - encode: { - update: Object.assign({ fill: { value: 'transparent' }, strokeWidth: { value: 0.35 }, stroke: { value: 'transparent' }, isVoronoi: { value: true } }, tooltip(model, { reactiveGeom: true })) - }, - transform: [ - { - type: 'voronoi', - x: { expr: x || !y ? 'datum.datum.x || 0' : '0' }, - y: { expr: y || !x ? 'datum.datum.y || 0' : '0' }, - size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] - } - ] - }; - let index = 0; - let exists = false; - marks.forEach((mark, i) => { - var _a; - const name = (_a = mark.name) !== null && _a !== void 0 ? _a : ''; - if (name === model.component.mark[0].name) { - index = i; - } - else if (name.indexOf(VORONOI) >= 0) { - exists = true; - } - }); - if (!exists) { - marks.splice(index + 1, 0, cellDef); - } - return marks; - } - }; - - /** - * A node in the dataflow tree. - */ - class DataFlowNode { - constructor(parent, debugName) { - this.debugName = debugName; - this._children = []; - this._parent = null; - if (parent) { - this.parent = parent; - } - } - /** - * Clone this node with a deep copy but don't clone links to children or parents. - */ - clone() { - throw new Error('Cannot clone node'); - } - get parent() { - return this._parent; - } - /** - * Set the parent of the node and also add this node to the parent's children. - */ - set parent(parent) { - this._parent = parent; - if (parent) { - parent.addChild(this); - } - } - get children() { - return this._children; - } - numChildren() { - return this._children.length; - } - addChild(child, loc) { - // do not add the same child twice - if (this._children.indexOf(child) > -1) { - warn(ADD_SAME_CHILD_TWICE); - return; - } - if (loc !== undefined) { - this._children.splice(loc, 0, child); - } - else { - this._children.push(child); - } - } - removeChild(oldChild) { - const loc = this._children.indexOf(oldChild); - this._children.splice(loc, 1); - return loc; - } - /** - * Remove node from the dataflow. - */ - remove() { - let loc = this._parent.removeChild(this); - for (const child of this._children) { - // do not use the set method because we want to insert at a particular location - child._parent = this._parent; - this._parent.addChild(child, loc++); - } - } - /** - * Insert another node as a parent of this node. - */ - insertAsParentOf(other) { - const parent = other.parent; - parent.removeChild(this); - this.parent = parent; - other.parent = this; - } - swapWithParent() { - const parent = this._parent; - const newParent = parent.parent; - // reconnect the children - for (const child of this._children) { - child.parent = parent; - } - // remove old links - this._children = []; // equivalent to removing every child link one by one - parent.removeChild(this); - parent.parent.removeChild(parent); - // swap two nodes - this.parent = newParent; - parent.parent = this; - } - } - class OutputNode extends DataFlowNode { - /** - * @param source The name of the source. Will change in assemble. - * @param type The type of the output node. - * @param refCounts A global ref counter map. - */ - constructor(parent, source, type, refCounts) { - super(parent, source); - this.type = type; - this.refCounts = refCounts; - this._source = this._name = source; - if (this.refCounts && !(this._name in this.refCounts)) { - this.refCounts[this._name] = 0; - } - } - clone() { - const cloneObj = new this.constructor(); - cloneObj.debugName = 'clone_' + this.debugName; - cloneObj._source = this._source; - cloneObj._name = 'clone_' + this._name; - cloneObj.type = this.type; - cloneObj.refCounts = this.refCounts; - cloneObj.refCounts[cloneObj._name] = 0; - return cloneObj; - } - dependentFields() { - return new Set(); - } - producedFields() { - return new Set(); - } - hash() { - if (this._hash === undefined) { - this._hash = `Output ${uniqueId()}`; - } - return this._hash; - } - /** - * Request the datasource name and increase the ref counter. - * - * During the parsing phase, this will return the simple name such as 'main' or 'raw'. - * It is crucial to request the name from an output node to mark it as a required node. - * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase. - * - * In the assemble phase, this will return the correct name. - */ - getSource() { - this.refCounts[this._name]++; - return this._source; - } - isRequired() { - return !!this.refCounts[this._name]; - } - setSource(source) { - this._source = source; - } - } - - class TimeUnitNode extends DataFlowNode { - constructor(parent, formula) { - super(parent); - this.formula = formula; - } - clone() { - return new TimeUnitNode(null, duplicate(this.formula)); - } - static makeFromEncoding(parent, model) { - const formula = model.reduceFieldDef((timeUnitComponent, fieldDef, channel) => { - const { field, timeUnit } = fieldDef; - const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; - const band = isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config); - if (timeUnit) { - const as = vgField(fieldDef, { forAs: true }); - timeUnitComponent[hash({ - as, - field, - timeUnit - })] = Object.assign({ as, - field, - timeUnit }, (band ? { band: true } : {})); - } - return timeUnitComponent; - }, {}); - if (isEmpty(formula)) { - return null; - } - return new TimeUnitNode(parent, formula); - } - static makeFromTransform(parent, t) { - const _a = Object.assign({}, t), { timeUnit } = _a, other = __rest(_a, ["timeUnit"]); - const normalizedTimeUnit = normalizeTimeUnit(timeUnit); - const component = Object.assign(Object.assign({}, other), { timeUnit: normalizedTimeUnit }); - return new TimeUnitNode(parent, { - [hash(component)]: component - }); - } - /** - * Merge together TimeUnitNodes assigning the children of `other` to `this` - * and removing `other`. - */ - merge(other) { - this.formula = Object.assign({}, this.formula); - // if the same hash happen twice, merge "band" - for (const key in other.formula) { - if (!this.formula[key] || other.formula[key].band) { - // copy if it's not a duplicate or if we need to include copy band over - this.formula[key] = other.formula[key]; - } - } - for (const child of other.children) { - other.removeChild(child); - child.parent = this; - } - other.remove(); - } - producedFields() { - return new Set(vals(this.formula).map(f => f.as)); - } - dependentFields() { - return new Set(vals(this.formula).map(f => f.field)); - } - hash() { - return `TimeUnit ${hash(this.formula)}`; - } - assemble() { - const transforms = []; - for (const f of vals(this.formula)) { - const { field, as, timeUnit } = f; - const _a = normalizeTimeUnit(timeUnit), { unit, utc } = _a, params = __rest(_a, ["unit", "utc"]); - transforms.push(Object.assign(Object.assign(Object.assign(Object.assign({ field: replacePathInField(field), type: 'timeunit' }, (unit ? { units: getTimeUnitParts(unit) } : {})), (utc ? { timezone: 'utc' } : {})), params), { as: [as, `${as}_end`] })); - } - return transforms; - } - } - - const TUPLE_FIELDS = '_tuple_fields'; - class SelectionProjectionComponent { - constructor(...items) { - this.items = items; - this.hasChannel = {}; - this.hasField = {}; - } - } - const project = { - has: () => { - return true; // This transform handles its own defaults, so always run parse. - }, - parse: (model, selCmpt, selDef) => { - var _a, _b, _c; - const name = selCmpt.name; - const proj = (_a = selCmpt.project) !== null && _a !== void 0 ? _a : (selCmpt.project = new SelectionProjectionComponent()); - const parsed = {}; - const timeUnits = {}; - const signals = new Set(); - const signalName = (p, range) => { - const suffix = range === 'visual' ? p.channel : p.field; - let sg = varName(`${name}_${suffix}`); - for (let counter = 1; signals.has(sg); counter++) { - sg = varName(`${name}_${suffix}_${counter}`); - } - signals.add(sg); - return { [range]: sg }; - }; - // If no explicit projection (either fields or encodings) is specified, set some defaults. - // If an initial value is set, try to infer projections. - // Otherwise, use the default configuration. - if (!selDef.fields && !selDef.encodings) { - const cfg = model.config.selection[selDef.type]; - if (selDef.init) { - for (const init of array(selDef.init)) { - for (const key of keys(init)) { - if (isSingleDefUnitChannel(key)) { - (selDef.encodings || (selDef.encodings = [])).push(key); - } - else { - if (selDef.type === 'interval') { - warn(INTERVAL_INITIALIZED_WITH_X_Y); - selDef.encodings = cfg.encodings; - } - else { - (selDef.fields || (selDef.fields = [])).push(key); - } - } - } - } - } - else { - selDef.encodings = cfg.encodings; - selDef.fields = cfg.fields; - } - } - // TODO: find a possible channel mapping for these fields. - for (const field of (_b = selDef.fields) !== null && _b !== void 0 ? _b : []) { - const p = { type: 'E', field }; - p.signals = Object.assign({}, signalName(p, 'data')); - proj.items.push(p); - proj.hasField[field] = p; - } - for (const channel of (_c = selDef.encodings) !== null && _c !== void 0 ? _c : []) { - const fieldDef = model.fieldDef(channel); - if (fieldDef) { - let field = fieldDef.field; - if (fieldDef.aggregate) { - warn(cannotProjectAggregate(channel, fieldDef.aggregate)); - continue; - } - else if (!field) { - warn(cannotProjectOnChannelWithoutField(channel)); - continue; - } - if (fieldDef.timeUnit) { - field = model.vgField(channel); - // Construct TimeUnitComponents which will be combined into a - // TimeUnitNode. This node may need to be inserted into the - // dataflow if the selection is used across views that do not - // have these time units defined. - const component = { - timeUnit: fieldDef.timeUnit, - as: field, - field: fieldDef.field - }; - timeUnits[hash(component)] = component; - } - // Prevent duplicate projections on the same field. - // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag). - if (!parsed[field]) { - // Determine whether the tuple will store enumerated or ranged values. - // Interval selections store ranges for continuous scales, and enumerations otherwise. - // Single/multi selections store ranges for binned fields, and enumerations otherwise. - let type = 'E'; - if (selCmpt.type === 'interval') { - const scaleType = model.getScaleComponent(channel).get('type'); - if (hasContinuousDomain(scaleType)) { - type = 'R'; - } - } - else if (fieldDef.bin) { - type = 'R-RE'; - } - const p = { field, channel, type }; - p.signals = Object.assign(Object.assign({}, signalName(p, 'data')), signalName(p, 'visual')); - proj.items.push((parsed[field] = p)); - proj.hasField[field] = proj.hasChannel[channel] = parsed[field]; - } - } - else { - warn(cannotProjectOnChannelWithoutField(channel)); - } - } - if (selDef.init) { - const parseInit = (i) => { - return proj.items.map(p => (i[p.channel] !== undefined ? i[p.channel] : i[p.field])); - }; - if (selDef.type === 'interval') { - selCmpt.init = parseInit(selDef.init); - } - else { - const init = array(selDef.init); - selCmpt.init = init.map(parseInit); - } - } - if (!isEmpty(timeUnits)) { - proj.timeUnit = new TimeUnitNode(null, timeUnits); - } - }, - signals: (model, selCmpt, allSignals) => { - const name = selCmpt.name + TUPLE_FIELDS; - const hasSignal = allSignals.filter(s => s.name === name); - return hasSignal.length > 0 - ? allSignals - : allSignals.concat({ - name, - value: selCmpt.project.items.map(proj => { - const rest = __rest(proj, ["signals", "hasLegend"]); - rest.field = replacePathInField(rest.field); - return rest; - }) - }); - } - }; - - const inputBindings = { - has: selCmpt => { - return (selCmpt.type === 'single' && - selCmpt.resolve === 'global' && - selCmpt.bind && - selCmpt.bind !== 'scales' && - !isLegendBinding(selCmpt.bind)); - }, - parse: (model, selCmpt, selDef, origDef) => { - // Binding a selection to input widgets disables default direct manipulation interaction. - // A user can choose to re-enable it by explicitly specifying triggering input events. - if (!origDef.on) - delete selCmpt.events; - if (!origDef.clear) - delete selCmpt.clear; - }, - topLevelSignals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const proj = selCmpt.project; - const bind = selCmpt.bind; - const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value). - const datum = nearest.has(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum'; - proj.items.forEach((p, i) => { - var _a, _b; - const sgname = varName(`${name}_${p.field}`); - const hasSignal = signals.filter(s => s.name === sgname); - if (!hasSignal.length) { - signals.unshift(Object.assign(Object.assign({ name: sgname }, (init ? { init: assembleInit(init[i]) } : { value: null })), { on: selCmpt.events - ? [ - { - events: selCmpt.events, - update: `datum && item().mark.marktype !== 'group' ? ${datum}[${$(p.field)}] : null` - } - ] - : [], bind: (_b = (_a = bind[p.field]) !== null && _a !== void 0 ? _a : bind[p.channel]) !== null && _b !== void 0 ? _b : bind })); - } - }); - return signals; - }, - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const proj = selCmpt.project; - const signal = signals.filter(s => s.name === name + TUPLE)[0]; - const fields = name + TUPLE_FIELDS; - const values = proj.items.map(p => varName(`${name}_${p.field}`)); - const valid = values.map(v => `${v} !== null`).join(' && '); - if (values.length) { - signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; - } - delete signal.value; - delete signal.on; - return signals; - } - }; - - const TOGGLE = '_toggle'; - const toggle = { - has: selCmpt => { - return selCmpt.type === 'multi' && !!selCmpt.toggle; - }, - signals: (model, selCmpt, signals) => { - return signals.concat({ - name: selCmpt.name + TOGGLE, - value: false, - on: [{ events: selCmpt.events, update: selCmpt.toggle }] - }); - }, - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - const signal = selCmpt.name + TOGGLE; - return (`${signal} ? null : ${tpl}, ` + - (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) + - `${signal} ? ${tpl} : null`); - } - }; - - const clear = { - has: selCmpt => { - return selCmpt.clear !== undefined && selCmpt.clear !== false; - }, - parse: (model, selCmpt, selDef) => { - if (selDef.clear) { - selCmpt.clear = isString(selDef.clear) ? parseSelector(selDef.clear, 'scope') : selDef.clear; - } - }, - topLevelSignals: (model, selCmpt, signals) => { - if (inputBindings.has(selCmpt)) { - for (const proj of selCmpt.project.items) { - const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`)); - if (idx !== -1) { - signals[idx].on.push({ events: selCmpt.clear, update: 'null' }); - } - } - } - return signals; - }, - signals: (model, selCmpt, signals) => { - function addClear(idx, update) { - if (idx !== -1 && signals[idx].on) { - signals[idx].on.push({ events: selCmpt.clear, update }); - } - } - // Be as minimalist as possible when adding clear triggers to minimize dataflow execution. - if (selCmpt.type === 'interval') { - for (const proj of selCmpt.project.items) { - const vIdx = signals.findIndex(n => n.name === proj.signals.visual); - addClear(vIdx, '[0, 0]'); - if (vIdx === -1) { - const dIdx = signals.findIndex(n => n.name === proj.signals.data); - addClear(dIdx, 'null'); - } - } - } - else { - let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE); - addClear(tIdx, 'null'); - if (toggle.has(selCmpt)) { - tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE); - addClear(tIdx, 'false'); - } - } - return signals; - } - }; - - const scaleBindings = { - has: selCmpt => { - return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales'; - }, - parse: (model, selCmpt) => { - const bound = (selCmpt.scales = []); - for (const proj of selCmpt.project.items) { - const channel = proj.channel; - if (!isScaleChannel(channel)) { - continue; - } - const scale = model.getScaleComponent(channel); - const scaleType = scale ? scale.get('type') : undefined; - if (!scale || !hasContinuousDomain(scaleType)) { - warn(SCALE_BINDINGS_CONTINUOUS); - continue; - } - const extent = { selection: selCmpt.name, field: proj.field }; - scale.set('selectionExtent', extent, true); - bound.push(proj); - } - }, - topLevelSignals: (model, selCmpt, signals) => { - const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0); - // Top-level signals are only needed for multiview displays and if this - // view's top-level signals haven't already been generated. - if (!model.parent || isTopLevelLayer(model) || bound.length === 0) { - return signals; - } - // vlSelectionResolve does not account for the behavior of bound scales in - // multiview displays. Each unit view adds a tuple to the store, but the - // state of the selection is the unit selection most recently updated. This - // state is captured by the top-level signals that we insert and "push - // outer" to from within the units. We need to reassemble this state into - // the top-level named signal, except no single selCmpt has a global view. - const namedSg = signals.filter(s => s.name === selCmpt.name)[0]; - let update = namedSg.update; - if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) { - namedSg.update = `{${bound.map(proj => `${$(proj.field)}: ${proj.signals.data}`).join(', ')}}`; - } - else { - for (const proj of bound) { - const mapping = `${$(proj.field)}: ${proj.signals.data}`; - if (update.indexOf(mapping) < 0) { - update = `${update.substring(0, update.length - 1)}, ${mapping}}`; - } - } - namedSg.update = update; - } - return signals.concat(bound.map(proj => ({ name: proj.signals.data }))); - }, - signals: (model, selCmpt, signals) => { - // Nested signals need only push to top-level signals with multiview displays. - if (model.parent && !isTopLevelLayer(model)) { - for (const proj of selCmpt.scales) { - const signal = signals.filter(s => s.name === proj.signals.data)[0]; - signal.push = 'outer'; - delete signal.value; - delete signal.update; - } - } - return signals; - } - }; - function domain(model, channel) { - const scale = $(model.scaleName(channel)); - return `domain(${scale})`; - } - function isTopLevelLayer(model) { - var _a; - return model.parent && isLayerModel(model.parent) && ((_a = !model.parent.parent) !== null && _a !== void 0 ? _a : isTopLevelLayer(model.parent.parent)); - } - - const legendBindings = { - has: (selCmpt) => { - const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind); - const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID; - if (spec && !projLen) { - warn(LEGEND_BINDINGS_MUST_HAVE_PROJECTION); - } - return spec && projLen; - }, - parse: (model, selCmpt, selDef, origDef) => { - var _a; - // Binding a selection to a legend disables default direct manipulation interaction. - // A user can choose to re-enable it by explicitly specifying triggering input events. - if (!origDef.on) - delete selCmpt.events; - if (!origDef.clear) - delete selCmpt.clear; - if (origDef.on || origDef.clear) { - const legendFilter = 'event.item && indexof(event.item.mark.role, "legend") < 0'; - for (const evt of selCmpt.events) { - evt.filter = array((_a = evt.filter) !== null && _a !== void 0 ? _a : []); - if (evt.filter.indexOf(legendFilter) < 0) { - evt.filter.push(legendFilter); - } - } - } - const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click'; - const stream = isString(evt) ? parseSelector(evt, 'view') : array(evt); - selCmpt.bind = { legend: { merge: stream } }; - }, - topLevelSignals: (model, selCmpt, signals) => { - const selName = selCmpt.name; - const stream = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; - const markName = (name) => (s) => { - const ds = duplicate(s); - ds.markname = name; - return ds; - }; - for (const proj of selCmpt.project.items) { - if (!proj.hasLegend) - continue; - const prefix = `${varName(proj.field)}_legend`; - const sgName = `${selName}_${prefix}`; - const hasSignal = signals.filter(s => s.name === sgName); - if (hasSignal.length === 0) { - const events = stream.merge - .map(markName(`${prefix}_symbols`)) - .concat(stream.merge.map(markName(`${prefix}_labels`))) - .concat(stream.merge.map(markName(`${prefix}_entries`))); - signals.unshift(Object.assign(Object.assign({ name: sgName }, (!selCmpt.init ? { value: null } : {})), { on: [ - // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum. - { events, update: 'datum.value || item().items[0].items[0].datum.value', force: true }, - { events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true } - ] })); - } - } - return signals; - }, - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const proj = selCmpt.project; - const tuple = signals.find(s => s.name === name + TUPLE); - const fields = name + TUPLE_FIELDS; - const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`)); - const valid = values.map(v => `${v} !== null`).join(' && '); - const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; - if (selCmpt.events && values.length > 0) { - tuple.on.push({ - events: values.map(signal => ({ signal })), - update - }); - } - else if (values.length > 0) { - tuple.update = update; - delete tuple.value; - delete tuple.on; - } - const toggle = signals.find(s => s.name === name + TOGGLE); - const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; - if (toggle) { - if (!selCmpt.events) - toggle.on[0].events = events; - else - toggle.on.push(Object.assign(Object.assign({}, toggle.on[0]), { events })); - } - return signals; - } - }; - function parseInteractiveLegend(model, channel, legendCmpt) { - var _a; - const field = (_a = model.fieldDef(channel)) === null || _a === void 0 ? void 0 : _a.field; - forEachSelection(model, selCmpt => { - var _a, _b; - const proj = (_a = selCmpt.project.hasField[field]) !== null && _a !== void 0 ? _a : selCmpt.project.hasChannel[channel]; - if (proj && legendBindings.has(selCmpt)) { - const legendSelections = (_b = legendCmpt.get('selections')) !== null && _b !== void 0 ? _b : []; - legendSelections.push(selCmpt.name); - legendCmpt.set('selections', legendSelections, false); - proj.hasLegend = true; - } - }); - } - - const ANCHOR = '_translate_anchor'; - const DELTA = '_translate_delta'; - const translate = { - has: selCmpt => { - return selCmpt.type === 'interval' && selCmpt.translate; - }, - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const hasScales = scaleBindings.has(selCmpt); - const anchor = name + ANCHOR; - const { x, y } = selCmpt.project.hasChannel; - let events = parseSelector(selCmpt.translate, 'scope'); - if (!hasScales) { - events = events.map(e => ((e.between[0].markname = name + BRUSH), e)); - } - signals.push({ - name: anchor, - value: {}, - on: [ - { - events: events.map(e => e.between[0]), - update: '{x: x(unit), y: y(unit)' + - (x !== undefined ? ', extent_x: ' + (hasScales ? domain(model, X) : `slice(${x.signals.visual})`) : '') + - (y !== undefined ? ', extent_y: ' + (hasScales ? domain(model, Y) : `slice(${y.signals.visual})`) : '') + - '}' - } - ] - }, { - name: name + DELTA, - value: {}, - on: [ - { - events: events, - update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}` - } - ] - }); - if (x !== undefined) { - onDelta(model, selCmpt, x, 'width', signals); - } - if (y !== undefined) { - onDelta(model, selCmpt, y, 'height', signals); - } - return signals; - } - }; - function onDelta(model, selCmpt, proj, size, signals) { - var _a; - const name = selCmpt.name; - const anchor = name + ANCHOR; - const delta = name + DELTA; - const channel = proj.channel; - const hasScales = scaleBindings.has(selCmpt); - const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0]; - const sizeSg = model.getSizeSignalRef(size).signal; - const scaleCmpt = model.getScaleComponent(channel); - const scaleType = scaleCmpt.get('type'); - const sign = hasScales && channel === X ? '-' : ''; // Invert delta when panning x-scales. - const extent = `${anchor}.extent_${channel}`; - const offset = `${sign}${delta}.${channel} / ` + (hasScales ? `${sizeSg}` : `span(${extent})`); - const panFn = !hasScales - ? 'panLinear' - : scaleType === 'log' - ? 'panLog' - : scaleType === 'pow' - ? 'panPow' - : 'panLinear'; - const update = `${panFn}(${extent}, ${offset}` + - (hasScales && scaleType === 'pow' ? `, ${(_a = scaleCmpt.get('exponent')) !== null && _a !== void 0 ? _a : 1}` : '') + - ')'; - signal.on.push({ - events: { signal: delta }, - update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})` - }); - } - - const ANCHOR$1 = '_zoom_anchor'; - const DELTA$1 = '_zoom_delta'; - const zoom = { - has: selCmpt => { - return selCmpt.type === 'interval' && selCmpt.zoom; - }, - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const hasScales = scaleBindings.has(selCmpt); - const delta = name + DELTA$1; - const { x, y } = selCmpt.project.hasChannel; - const sx = $(model.scaleName(X)); - const sy = $(model.scaleName(Y)); - let events = parseSelector(selCmpt.zoom, 'scope'); - if (!hasScales) { - events = events.map(e => ((e.markname = name + BRUSH), e)); - } - signals.push({ - name: name + ANCHOR$1, - on: [ - { - events: events, - update: !hasScales - ? `{x: x(unit), y: y(unit)}` - : '{' + - [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : ''] - .filter(expr => !!expr) - .join(', ') + - '}' - } - ] - }, { - name: delta, - on: [ - { - events: events, - force: true, - update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))' - } - ] - }); - if (x !== undefined) { - onDelta$1(model, selCmpt, x, 'width', signals); - } - if (y !== undefined) { - onDelta$1(model, selCmpt, y, 'height', signals); - } - return signals; - } - }; - function onDelta$1(model, selCmpt, proj, size, signals) { - var _a; - const name = selCmpt.name; - const channel = proj.channel; - const hasScales = scaleBindings.has(selCmpt); - const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0]; - const sizeSg = model.getSizeSignalRef(size).signal; - const scaleCmpt = model.getScaleComponent(channel); - const scaleType = scaleCmpt.get('type'); - const base = hasScales ? domain(model, channel) : signal.name; - const delta = name + DELTA$1; - const anchor = `${name}${ANCHOR$1}.${channel}`; - const zoomFn = !hasScales - ? 'zoomLinear' - : scaleType === 'log' - ? 'zoomLog' - : scaleType === 'pow' - ? 'zoomPow' - : 'zoomLinear'; - const update = `${zoomFn}(${base}, ${anchor}, ${delta}` + - (hasScales && scaleType === 'pow' ? `, ${(_a = scaleCmpt.get('exponent')) !== null && _a !== void 0 ? _a : 1}` : '') + - ')'; - signal.on.push({ - events: { signal: delta }, - update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})` - }); - } - - const compilers = [project, toggle, scaleBindings, legendBindings, translate, zoom, inputBindings, nearest, clear]; - function forEachTransform(selCmpt, cb) { - for (const t of compilers) { - if (t.has(selCmpt)) { - cb(t); - } - } - } - - function assembleInit(init, isExpr = true, wrap = identity) { - if (isArray(init)) { - const assembled = init.map(v => assembleInit(v, isExpr, wrap)); - return isExpr ? `[${assembled.join(', ')}]` : assembled; - } - else if (isDateTime(init)) { - if (isExpr) { - return wrap(dateTimeToExpr(init)); - } - else { - return wrap(dateTimeToTimestamp(init)); - } - } - return isExpr ? wrap(JSON.stringify(init)) : init; - } - function assembleUnitSelectionSignals(model, signals) { - forEachSelection(model, (selCmpt, selCompiler) => { - const name = selCmpt.name; - let modifyExpr = selCompiler.modifyExpr(model, selCmpt); - signals.push(...selCompiler.signals(model, selCmpt)); - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.signals) { - signals = txCompiler.signals(model, selCmpt, signals); - } - if (txCompiler.modifyExpr) { - modifyExpr = txCompiler.modifyExpr(model, selCmpt, modifyExpr); - } - }); - signals.push({ - name: name + MODIFY, - on: [ - { - events: { signal: selCmpt.name + TUPLE }, - update: `modify(${$(selCmpt.name + STORE)}, ${modifyExpr})` - } - ] - }); - }); - return cleanupEmptyOnArray(signals); - } - function assembleFacetSignals(model, signals) { - if (model.component.selection && keys(model.component.selection).length) { - const name = $(model.getName('cell')); - signals.unshift({ - name: 'facet', - value: {}, - on: [ - { - events: parseSelector('mousemove', 'scope'), - update: `isTuple(facet) ? facet : group(${name}).datum` - } - ] - }); - } - return cleanupEmptyOnArray(signals); - } - function assembleTopLevelSignals(model, signals) { - let hasSelections = false; - forEachSelection(model, (selCmpt, selCompiler) => { - const name = selCmpt.name; - const store = $(name + STORE); - const hasSg = signals.filter(s => s.name === name); - if (hasSg.length === 0) { - const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve; - const isMulti = selCmpt.type === 'multi' ? ', true)' : ')'; - signals.push({ - name: selCmpt.name, - update: `${VL_SELECTION_RESOLVE}(${store}, ${$(resolve)}${isMulti}` - }); - } - hasSelections = true; - if (selCompiler.topLevelSignals) { - signals = selCompiler.topLevelSignals(model, selCmpt, signals); - } - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.topLevelSignals) { - signals = txCompiler.topLevelSignals(model, selCmpt, signals); - } - }); - }); - if (hasSelections) { - const hasUnit = signals.filter(s => s.name === 'unit'); - if (hasUnit.length === 0) { - signals.unshift({ - name: 'unit', - value: {}, - on: [{ events: 'mousemove', update: 'isTuple(group()) ? group() : unit' }] - }); - } - } - return cleanupEmptyOnArray(signals); - } - function assembleUnitSelectionData(model, data) { - const dataCopy = [...data]; - forEachSelection(model, selCmpt => { - const init = { name: selCmpt.name + STORE }; - if (selCmpt.init) { - const fields = selCmpt.project.items.map(proj => { - const rest = __rest(proj, ["signals"]); - return rest; - }); - const insert = selCmpt.init.map(i => assembleInit(i, false)); - init.values = - selCmpt.type === 'interval' - ? [{ unit: unitName(model, { escape: false }), fields, values: insert }] - : insert.map(i => ({ unit: unitName(model, { escape: false }), fields, values: i })); - } - const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE); - if (!contains.length) { - dataCopy.push(init); - } - }); - return dataCopy; - } - function assembleUnitSelectionMarks(model, marks) { - forEachSelection(model, (selCmpt, selCompiler) => { - marks = selCompiler.marks ? selCompiler.marks(model, selCmpt, marks) : marks; - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.marks) { - marks = txCompiler.marks(model, selCmpt, marks); - } - }); - }); - return marks; - } - function assembleLayerSelectionMarks(model, marks) { - for (const child of model.children) { - if (isUnitModel(child)) { - marks = assembleUnitSelectionMarks(child, marks); - } - } - return marks; - } - function assembleSelectionScaleDomain(model, extent) { - const name = extent.selection; - const selCmpt = model.getSelectionComponent(name, varName(name)); - return { signal: parseSelectionBinExtent(selCmpt, extent) }; - } - function cleanupEmptyOnArray(signals) { - return signals.map(s => { - if (s.on && !s.on.length) - delete s.on; - return s; - }); - } - - const BRUSH = '_brush'; - const SCALE_TRIGGER = '_scale_trigger'; - const interval = { - signals: (model, selCmpt) => { - const name = selCmpt.name; - const fieldsSg = name + TUPLE_FIELDS; - const hasScales = scaleBindings.has(selCmpt); - const signals = []; - const dataSignals = []; - const scaleTriggers = []; - if (selCmpt.translate && !hasScales) { - const filterExpr = `!event.item || event.item.mark.name !== ${$(name + BRUSH)}`; - events(selCmpt, (on, evt) => { - var _a; - const filters = array((_a = evt.between[0].filter) !== null && _a !== void 0 ? _a : (evt.between[0].filter = [])); - if (filters.indexOf(filterExpr) < 0) { - filters.push(filterExpr); - } - return on; - }); - } - selCmpt.project.items.forEach((proj, i) => { - const channel = proj.channel; - if (channel !== X && channel !== Y) { - warn('Interval selections only support x and y encoding channels.'); - return; - } - const init = selCmpt.init ? selCmpt.init[i] : null; - const cs = channelSignals(model, selCmpt, proj, init); - const dname = proj.signals.data; - const vname = proj.signals.visual; - const scaleName = $(model.scaleName(channel)); - const scaleType = model.getScaleComponent(channel).get('type'); - const toNum = hasContinuousDomain(scaleType) ? '+' : ''; - signals.push(...cs); - dataSignals.push(dname); - scaleTriggers.push({ - scaleName: model.scaleName(channel), - expr: `(!isArray(${dname}) || ` + - `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` + - `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))` - }); - }); - // Proxy scale reactions to ensure that an infinite loop doesn't occur - // when an interval selection filter touches the scale. - if (!hasScales) { - signals.push({ - name: name + SCALE_TRIGGER, - value: {}, - on: [ - { - events: scaleTriggers.map(t => ({ scale: t.scaleName })), - update: scaleTriggers.map(t => t.expr).join(' && ') + ` ? ${name + SCALE_TRIGGER} : {}` - } - ] - }); - } - // Only add an interval to the store if it has valid data extents. Data extents - // are set to null if pixel extents are equal to account for intervals over - // ordinal/nominal domains which, when inverted, will still produce a valid datum. - const init = selCmpt.init; - const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`; - return signals.concat(Object.assign(Object.assign({ name: name + TUPLE }, (init ? { init: `{${update}: ${assembleInit(init)}}` } : {})), { on: [ - { - events: [{ signal: dataSignals.join(' || ') }], - update: dataSignals.join(' && ') + ` ? {${update}: [${dataSignals}]} : null` - } - ] })); - }, - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`); - }, - marks: (model, selCmpt, marks) => { - const name = selCmpt.name; - const { x, y } = selCmpt.project.hasChannel; - const xvname = x && x.signals.visual; - const yvname = y && y.signals.visual; - const store = `data(${$(selCmpt.name + STORE)})`; - // Do not add a brush if we're binding to scales. - if (scaleBindings.has(selCmpt)) { - return marks; - } - const update = { - x: x !== undefined ? { signal: `${xvname}[0]` } : { value: 0 }, - y: y !== undefined ? { signal: `${yvname}[0]` } : { value: 0 }, - x2: x !== undefined ? { signal: `${xvname}[1]` } : { field: { group: 'width' } }, - y2: y !== undefined ? { signal: `${yvname}[1]` } : { field: { group: 'height' } } - }; - // If the selection is resolved to global, only a single interval is in - // the store. Wrap brush mark's encodings with a production rule to test - // this based on the `unit` property. Hide the brush mark if it corresponds - // to a unit different from the one in the store. - if (selCmpt.resolve === 'global') { - for (const key of keys(update)) { - update[key] = [ - Object.assign({ test: `${store}.length && ${store}[0].unit === ${unitName(model)}` }, update[key]), - { value: 0 } - ]; - } - } - // Two brush marks ensure that fill colors and other aesthetic choices do - // not interefere with the core marks, but that the brushed region can still - // be interacted with (e.g., dragging it around). - const _a = selCmpt.mark, { fill, fillOpacity, cursor } = _a, stroke = __rest(_a, ["fill", "fillOpacity", "cursor"]); - const vgStroke = keys(stroke).reduce((def, k) => { - def[k] = [ - { - test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`] - .filter(t => t) - .join(' && '), - value: stroke[k] - }, - { value: null } - ]; - return def; - }, {}); - return [ - { - name: name + BRUSH + '_bg', - type: 'rect', - clip: true, - encode: { - enter: { - fill: { value: fill }, - fillOpacity: { value: fillOpacity } - }, - update: update - } - }, - ...marks, - { - name: name + BRUSH, - type: 'rect', - clip: true, - encode: { - enter: Object.assign(Object.assign({}, (cursor ? { cursor: { value: cursor } } : {})), { fill: { value: 'transparent' } }), - update: Object.assign(Object.assign({}, update), vgStroke) - } - } - ]; - } - }; - /** - * Returns the visual and data signals for an interval selection. - */ - function channelSignals(model, selCmpt, proj, init) { - const channel = proj.channel; - const vname = proj.signals.visual; - const dname = proj.signals.data; - const hasScales = scaleBindings.has(selCmpt); - const scaleName = $(model.scaleName(channel)); - const scale = model.getScaleComponent(channel); - const scaleType = scale ? scale.get('type') : undefined; - const scaled = (str) => `scale(${scaleName}, ${str})`; - const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal; - const coord = `${channel}(unit)`; - const on = events(selCmpt, (def, evt) => { - return [ - ...def, - { events: evt.between[0], update: `[${coord}, ${coord}]` }, - { events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]` } // Brush End - ]; - }); - // React to pan/zooms of continuous scales. Non-continuous scales - // (band, point) cannot be pan/zoomed and any other changes - // to their domains (e.g., filtering) should clear the brushes. - on.push({ - events: { signal: selCmpt.name + SCALE_TRIGGER }, - update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]` - }); - return hasScales - ? [{ name: dname, on: [] }] - : [ - Object.assign(Object.assign({ name: vname }, (init ? { init: assembleInit(init, true, scaled) } : { value: [] })), { on: on }), - Object.assign(Object.assign({ name: dname }, (init ? { init: assembleInit(init) } : {})), { on: [ - { - events: { signal: vname }, - update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})` - } - ] }) - ]; - } - function events(selCmpt, cb) { - return selCmpt.events.reduce((on, evt) => { - if (!evt.between) { - warn(`${evt} is not an ordered event stream for interval selections.`); - return on; - } - return cb(on, evt); - }, []); - } - - function singleOrMultiSignals(model, selCmpt) { - const name = selCmpt.name; - const fieldsSg = name + TUPLE_FIELDS; - const project = selCmpt.project; - const datum = '(item().isVoronoi ? datum.datum : datum)'; - const values = project.items - .map(p => { - const fieldDef = model.fieldDef(p.channel); - // Binned fields should capture extents, for a range test against the raw field. - return fieldDef && fieldDef.bin - ? `[${datum}[${$(model.vgField(p.channel, {}))}], ` + - `${datum}[${$(model.vgField(p.channel, { binSuffix: 'end' }))}]]` - : `${datum}[${$(p.field)}]`; - }) - .join(', '); - // Only add a discrete selection to the store if a datum is present _and_ - // the interaction isn't occurring on a group mark. This guards against - // polluting interactive state with invalid values in faceted displays - // as the group marks are also data-driven. We force the update to account - // for constant null states but varying toggles (e.g., shift-click in - // whitespace followed by a click in whitespace; the store should only - // be cleared on the second click). - const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`; - const events = selCmpt.events; - return [ - { - name: name + TUPLE, - on: events - ? [ - { - events, - update: `datum && item().mark.marktype !== 'group' ? {${update}: [${values}]} : null`, - force: true - } - ] - : [] - } - ]; - } - const multi = { - signals: singleOrMultiSignals, - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'null' : `{unit: ${unitName(model)}}`); - } - }; - - const single = { - signals: singleOrMultiSignals, - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`); - } - }; - - const STORE = '_store'; - const TUPLE = '_tuple'; - const MODIFY = '_modify'; - const VL_SELECTION_RESOLVE = 'vlSelectionResolve'; - const compilers$1 = { single, multi, interval }; - function forEachSelection(model, cb) { - const selections = model.component.selection; - if (selections) { - for (const sel of vals(selections)) { - const success = cb(sel, compilers$1[sel.type]); - if (success === true) - break; - } - } - } - function getFacetModel(model) { - let parent = model.parent; - while (parent) { - if (isFacetModel(parent)) { - break; - } - parent = parent.parent; - } - return parent; - } - function unitName(model, { escape } = { escape: true }) { - let name = escape ? $(model.name) : model.name; - const facetModel = getFacetModel(model); - if (facetModel) { - const { facet } = facetModel; - for (const channel of FACET_CHANNELS) { - if (facet[channel]) { - name += ` + '__facet_${channel}_' + (facet[${$(facetModel.vgField(channel))}])`; - } - } - } - return name; - } - function requiresSelectionId(model) { - let identifier = false; - forEachSelection(model, selCmpt => { - identifier = identifier || selCmpt.project.items.some(proj => proj.field === SELECTION_ID); - }); - return identifier; - } - - var RawCode = 'RawCode'; - var Literal = 'Literal'; - var Property = 'Property'; - var Identifier = 'Identifier'; - - var ArrayExpression = 'ArrayExpression'; - var BinaryExpression = 'BinaryExpression'; - var CallExpression = 'CallExpression'; - var ConditionalExpression = 'ConditionalExpression'; - var LogicalExpression = 'LogicalExpression'; - var MemberExpression = 'MemberExpression'; - var ObjectExpression = 'ObjectExpression'; - var UnaryExpression = 'UnaryExpression'; - - function ASTNode(type) { - this.type = type; - } - - ASTNode.prototype.visit = function(visitor) { - var node = this, c, i, n; - - if (visitor(node)) return 1; - - for (c=children(node), i=0, n=c.length; i - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - - 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. - - 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 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. - */ - - var TokenName, - source, - index, - length, - lookahead; - - var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; - - TokenName = {}; - TokenName[TokenBooleanLiteral] = 'Boolean'; - TokenName[TokenEOF] = ''; - TokenName[TokenIdentifier] = 'Identifier'; - TokenName[TokenKeyword] = 'Keyword'; - TokenName[TokenNullLiteral] = 'Null'; - TokenName[TokenNumericLiteral] = 'Numeric'; - TokenName[TokenPunctuator] = 'Punctuator'; - TokenName[TokenStringLiteral] = 'String'; - TokenName[TokenRegularExpression] = 'RegularExpression'; - - var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; - - // Error messages should be identical to V8. - var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; - - var ILLEGAL$1 = 'ILLEGAL', - DISABLED = 'Disabled.'; - - // See also tools/generate-unicode-regex.py. - var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), - // eslint-disable-next-line no-misleading-character-class - RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B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\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); - - // Ensure the condition is true, otherwise throw an error. - // This is only to have a better contract semantic, i.e. another safety net - // to catch a logic error. The condition shall be fulfilled in normal case. - // Do NOT use this to enforce a certain condition on any user input. - - function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - - function isDecimalDigit(ch) { - return (ch >= 0x30 && ch <= 0x39); // 0..9 - } - - function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; - } - - function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; - } - - // 7.2 White Space - - function isWhiteSpace(ch) { - return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || - (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); - } - - // 7.3 Line Terminators - - function isLineTerminator(ch) { - return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); - } - - // 7.6 Identifier Names and Identifiers - - function isIdentifierStart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch))); - } - - function isIdentifierPart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch >= 0x30 && ch <= 0x39) || // 0..9 - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch))); - } - - // 7.6.1.1 Keywords - - var keywords = { - 'if':1, 'in':1, 'do':1, - 'var':1, 'for':1, 'new':1, 'try':1, 'let':1, - 'this':1, 'else':1, 'case':1, 'void':1, 'with':1, 'enum':1, - 'while':1, 'break':1, 'catch':1, 'throw':1, 'const':1, 'yield':1, 'class':1, 'super':1, - 'return':1, 'typeof':1, 'delete':1, 'switch':1, 'export':1, 'import':1, 'public':1, 'static':1, - 'default':1, 'finally':1, 'extends':1, 'package':1, 'private':1, - 'function':1, 'continue':1, 'debugger':1, - 'interface':1, 'protected':1, - 'instanceof':1, 'implements':1 - }; - - function skipComment() { - var ch; - - while (index < length) { - ch = source.charCodeAt(index); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index; - } else { - break; - } - } - } - - function scanHexEscape(prefix) { - var i, len, ch, code = 0; - - len = (prefix === 'u') ? 4 : 2; - for (i = 0; i < len; ++i) { - if (index < length && isHexDigit(source[index])) { - ch = source[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - } - return String.fromCharCode(code); - } - - function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - - ch = source[index]; - code = 0; - - // At least, one hex digit is required. - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - while (index < length) { - ch = source[index++]; - if (!isHexDigit(ch)) { - break; - } - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - // UTF-16 Encoding - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - cu1 = ((code - 0x10000) >> 10) + 0xD800; - cu2 = ((code - 0x10000) & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); - } - - function getEscapedIdentifier() { - var ch, id; - - ch = source.charCodeAt(index++); - id = String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - id = ch; - } - - while (index < length) { - ch = source.charCodeAt(index); - if (!isIdentifierPart(ch)) { - break; - } - ++index; - id += String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - id += ch; - } - } - - return id; - } - - function getIdentifier() { - var start, ch; - - start = index++; - while (index < length) { - ch = source.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); - } - if (isIdentifierPart(ch)) { - ++index; - } else { - break; - } - } - - return source.slice(start, index); - } - - function scanIdentifier() { - var start, id, type; - - start = index; - - // Backslash (U+005C) starts an escaped character. - id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); - - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index - }; - } - - // 7.7 Punctuators - - function scanPunctuator() { - var start = index, - code = source.charCodeAt(index), - code2, - ch1 = source[index], - ch2, - ch3, - ch4; - - switch (code) { - - // Check for most common single-character punctuators. - case 0x2E: // . dot - case 0x28: // ( open bracket - case 0x29: // ) close bracket - case 0x3B: // ; semicolon - case 0x2C: // , comma - case 0x7B: // { open curly brace - case 0x7D: // } close curly brace - case 0x5B: // [ - case 0x5D: // ] - case 0x3A: // : - case 0x3F: // ? - case 0x7E: // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - - default: - code2 = source.charCodeAt(index + 1); - - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - case 0x2D: // - - case 0x2F: // / - case 0x3C: // < - case 0x3E: // > - case 0x5E: // ^ - case 0x7C: // | - case 0x25: // % - case 0x26: // & - case 0x2A: // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - - case 0x21: // ! - case 0x3D: // = - index += 2; - - // !== and === - if (source.charCodeAt(index) === 0x3D) { - ++index; - } - return { - type: TokenPunctuator, - value: source.slice(start, index), - start: start, - end: index - }; - } - } - } - - // 4-character punctuator: >>>= - - ch4 = source.substr(index, 4); - - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } - - // 3-character punctuators: === !== >>> <<= >>= - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } - - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - - if ((ch1 === ch2[1] && ('+-<>&|'.indexOf(ch1) >= 0)) || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } - - // 1-character punctuators: < > = ! + - * % & | ^ / - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - // 7.8.3 Numeric Literals - - function scanHexLiteral(start) { - var number = ''; - - while (index < length) { - if (!isHexDigit(source[index])) { - break; - } - number += source[index++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index - }; - } - - function scanOctalLiteral(start) { - var number = '0' + source[index++]; - while (index < length) { - if (!isOctalDigit(source[index])) { - break; - } - number += source[index++]; - } - - if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; - } - - function scanNumericLiteral() { - var number, start, ch; - - ch = source[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), - 'Numeric literal must start with a decimal digit or a decimal point'); - - start = index; - number = ''; - if (ch !== '.') { - number = source[index++]; - ch = source[index]; - - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } - - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - } - - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - ch = source[index]; - } - - if (ch === '.') { - number += source[index++]; - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - ch = source[index]; - } - - if (ch === 'e' || ch === 'E') { - number += source[index++]; - - ch = source[index]; - if (ch === '+' || ch === '-') { - number += source[index++]; - } - if (isDecimalDigit(source.charCodeAt(index))) { - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; - } - - // 7.8.4 String Literals - - function scanStringLiteral() { - var str = '', - quote, start, ch, code, octal = false; - - quote = source[index]; - assert((quote === '\'' || quote === '"'), - 'String literal must starts with a quote'); - - start = index; - ++index; - - while (index < length) { - ch = source[index++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - - // \0 is not octal escape sequence - if (code !== 0) { - octal = true; - } - - if (index < length && isOctalDigit(source[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source[index++]); - - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.indexOf(ch) >= 0 && - index < length && - isOctalDigit(source[index])) { - code = code * 8 + '01234567'.indexOf(source[index++]); - } - } - str += String.fromCharCode(code); - } else { - str += ch; - } - break; - } - } else { - if (ch === '\r' && source[index] === '\n') { - ++index; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index - }; - } - - function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp - .replace(/\\u\{([0-9a-fA-F]+)\}/g, function($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - throwError({}, MessageInvalidRegExp); - }) - .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } - - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } - - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } - } - - function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - - ch = source[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source[index++]; - - classMarker = false; - terminated = false; - while (index < length) { - ch = source[index++]; - str += ch; - if (ch === '\\') { - ch = source[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } - - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; - } - - function scanRegExpFlags() { - var ch, str, flags; - - str = ''; - flags = ''; - while (index < length) { - ch = source[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index; - if (ch === '\\' && index < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL$1); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; - } - - function scanRegExp() { - var start, body, flags, value; - - lookahead = null; - skipComment(); - start = index; - - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index - }; - } - - function isIdentifierName(token) { - return token.type === TokenIdentifier || - token.type === TokenKeyword || - token.type === TokenBooleanLiteral || - token.type === TokenNullLiteral; - } - - function advance() { - var ch; - - skipComment(); - - if (index >= length) { - return { - type: TokenEOF, - start: index, - end: index - }; - } - - ch = source.charCodeAt(index); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } - - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } - - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } - - - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source.charCodeAt(index + 1))) { - return scanNumericLiteral(); - } - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - function lex() { - var token; - - token = lookahead; - index = token.end; - - lookahead = advance(); - - index = token.end; - - return token; - } - - function peek() { - var pos; - - pos = index; - - lookahead = advance(); - index = pos; - } - - function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; - } - - function finishBinaryExpression(operator, left, right) { - var node = new ASTNode((operator === '||' || operator === '&&') ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; - } - - function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; - } - - function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; - } - - function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; - } - - function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - node.regex = token.regex; - } - return node; - } - - function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; - } - - function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; - } - - function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; - } - - function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; - } - - // Throw an exception - - function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace( - /%(\d)/g, - function(whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - } - ); - - - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; - } - - // Throw an exception because of the token. - - function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } - - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); - } - - // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - - function expect(value) { - var token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } - } - - // Return true if the next token matches the specified punctuator. - - function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; - } - - // Return true if the next token matches the specified keyword - - function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; - } - - // 11.1.4 Array Initialiser - - function parseArrayInitialiser() { - var elements = []; - - index = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - - return finishArrayExpression(elements); - } - - // 11.1.5 Object Initialiser - - function parseObjectPropertyKey() { - var token; - - index = lookahead.start; - token = lex(); - - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - return finishLiteral(token); - } - - return finishIdentifier(token.value); - } - - function parseObjectProperty() { - var token, key, id, value; - - index = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } - } - - function parseObjectInitialiser() { - var properties = [], - property, name, key, map = {}, - toString = String; - - index = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - - return finishObjectExpression(properties); - } - - // 11.1.6 The Grouping Operator - - function parseGroupExpression() { - var expr; - - expect('('); - - expr = parseExpression(); - - expect(')'); - - return expr; - } - - - // 11.1 Primary Expressions - - var legalKeywords = { - 'if': 1 - }; - - function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index = lookahead.start; - - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = (token.value === 'true'); - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek(); - } else { - throwUnexpected(lex()); - } - - return expr; - } - - // 11.2 Left-Hand-Side Expressions - - function parseArguments() { - var args = []; - - expect('('); - - if (!match(')')) { - while (index < length) { - args.push(parseConditionalExpression()); - if (match(')')) { - break; - } - expect(','); - } - } - - expect(')'); - - return args; - } - - function parseNonComputedProperty() { - var token; - index = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); - } - - function parseNonComputedMember() { - expect('.'); - - return parseNonComputedProperty(); - } - - function parseComputedMember() { - var expr; - - expect('['); - - expr = parseExpression(); - - expect(']'); - - return expr; - } - - function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; - } - - // 11.3 Postfix Expressions - - function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if ((match('++') || match('--'))) { - throw new Error(DISABLED); - } - } - - return expr; - } - - // 11.4 Unary Operators - - function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; - } - - function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - } - - return prec; - } - - // 11.5 Multiplicative Operators - // 11.6 Additive Operators - // 11.7 Bitwise Shift Operators - // 11.8 Relational Operators - // 11.9 Equality Operators - // 11.10 Binary Bitwise Operators - // 11.11 Binary Logical Operators - - function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - - marker = lookahead; - left = parseUnaryExpression(); - - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) { - return left; - } - token.prec = prec; - lex(); - - markers = [marker, lookahead]; - right = parseUnaryExpression(); - - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - - // Reduce: make a binary expression from the three topmost entries. - while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; - } - - // 11.12 Conditional Operator - - function parseConditionalExpression() { - var expr, consequent, alternate; - - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; - } - - // 11.14 Comma Operator - - function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; - } - - function parse(code) { - source = code; - index = 0; - length = source.length; - lookahead = null; - - peek(); - - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - return expr; - } - - function getName(node) { - const name = []; - if (node.type === 'Identifier') { - return [node.name]; - } - if (node.type === 'Literal') { - return [node.value]; - } - if (node.type === 'MemberExpression') { - name.push(...getName(node.object)); - name.push(...getName(node.property)); - } - return name; - } - function startsWithDatum(node) { - if (node.object.type === 'MemberExpression') { - return startsWithDatum(node.object); - } - return node.object.name === 'datum'; - } - function getDependentFields(expression) { - const ast = parse(expression); - const dependents = new Set(); - ast.visit((node) => { - if (node.type === 'MemberExpression' && startsWithDatum(node)) { - dependents.add(getName(node).slice(1).join('.')); - } - }); - return dependents; - } - - class FilterNode extends DataFlowNode { - constructor(parent, model, filter) { - super(parent); - this.model = model; - this.filter = filter; - // TODO: refactor this to not take a node and - // then add a static function makeFromOperand and make the constructor take only an expression - this.expr = expression(this.model, this.filter, this); - this._dependentFields = getDependentFields(this.expr); - } - clone() { - return new FilterNode(null, this.model, duplicate(this.filter)); - } - dependentFields() { - return this._dependentFields; - } - producedFields() { - return new Set(); // filter does not produce any new fields - } - assemble() { - return { - type: 'filter', - expr: this.expr - }; - } - hash() { - return `Filter ${this.expr}`; - } - } - - function parseUnitSelection(model, selDefs) { - var _a; - const selCmpts = {}; - const selectionConfig = model.config.selection; - for (const name of keys(selDefs !== null && selDefs !== void 0 ? selDefs : {})) { - const selDef = duplicate(selDefs[name]); - const _b = selectionConfig[selDef.type], cfg = __rest(_b, ["fields", "encodings"]); // Project transform applies its defaults. - // Set default values from config if a property hasn't been specified, - // or if it is true. E.g., "translate": true should use the default - // event handlers for translate. However, true may be a valid value for - // a property (e.g., "nearest": true). - for (const key in cfg) { - // A selection should contain either `encodings` or `fields`, only use - // default values for these two values if neither of them is specified. - if ((key === 'encodings' && selDef.fields) || (key === 'fields' && selDef.encodings)) { - continue; - } - if (key === 'mark') { - selDef[key] = Object.assign(Object.assign({}, cfg[key]), selDef[key]); - } - if (selDef[key] === undefined || selDef[key] === true) { - selDef[key] = (_a = cfg[key]) !== null && _a !== void 0 ? _a : selDef[key]; - } - } - const safeName = varName(name); - const selCmpt = (selCmpts[safeName] = Object.assign(Object.assign({}, selDef), { name: safeName, events: isString(selDef.on) ? parseSelector(selDef.on, 'scope') : duplicate(selDef.on) })); - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.has(selCmpt) && txCompiler.parse) { - txCompiler.parse(model, selCmpt, selDef, selDefs[name]); - } - }); - } - return selCmpts; - } - function parseSelectionPredicate(model, selections, dfnode, datum = 'datum') { - const stores = []; - function expr(name) { - const vname = varName(name); - const selCmpt = model.getSelectionComponent(vname, name); - const store = $(vname + STORE); - if (selCmpt.project.timeUnit) { - const child = dfnode !== null && dfnode !== void 0 ? dfnode : model.component.data.raw; - const tunode = selCmpt.project.timeUnit.clone(); - if (child.parent) { - tunode.insertAsParentOf(child); - } - else { - child.parent = tunode; - } - } - if (selCmpt.empty !== 'none') { - stores.push(store); - } - return (`vlSelectionTest(${store}, ${datum}` + (selCmpt.resolve === 'global' ? ')' : `, ${$(selCmpt.resolve)})`)); - } - const predicateStr = logicalExpr(selections, expr); - return ((stores.length ? '!(' + stores.map(s => `length(data(${s}))`).join(' || ') + ') || ' : '') + `(${predicateStr})`); - } - function parseSelectionBinExtent(selCmpt, extent) { - const encoding = extent['encoding']; - let field = extent['field']; - if (!encoding && !field) { - field = selCmpt.project.items[0].field; - if (selCmpt.project.items.length > 1) { - warn('A "field" or "encoding" must be specified when using a selection as a scale domain. ' + - `Using "field": ${$(field)}.`); - } - } - else if (encoding && !field) { - const encodings = selCmpt.project.items.filter(p => p.channel === encoding); - if (!encodings.length || encodings.length > 1) { - field = selCmpt.project.items[0].field; - warn((!encodings.length ? 'No ' : 'Multiple ') + - `matching ${$(encoding)} encoding found for selection ${$(extent.selection)}. ` + - `Using "field": ${$(field)}.`); - } - else { - field = encodings[0].field; - } - } - return `${selCmpt.name}[${$(field)}]`; - } - function materializeSelections(model, main) { - forEachSelection(model, selCmpt => { - const selection = selCmpt.name; - const lookupName = model.getName(`lookup_${selection}`); - model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(new FilterNode(main, model, { selection }), lookupName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); - }); - } - - /** - * Converts a predicate into an expression. - */ - // model is only used for selection filters. - function expression(model, filterOp, node) { - return logicalExpr(filterOp, (predicate) => { - if (isString(predicate)) { - return predicate; - } - else if (isSelectionPredicate(predicate)) { - return parseSelectionPredicate(model, predicate.selection, node); - } - else { - // Filter Object - return fieldFilterExpression(predicate); - } - }); - } - - function assembleTitle(title, config) { - if (!title) { - return undefined; - } - if (isArray(title) && !isText(title)) { - return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', '); - } - return title; - } - function setAxisEncode(axis, part, vgProp, vgRef) { - var _a, _b, _c; - axis.encode = (_a = axis.encode) !== null && _a !== void 0 ? _a : {}; - axis.encode[part] = (_b = axis.encode[part]) !== null && _b !== void 0 ? _b : {}; - axis.encode[part].update = (_c = axis.encode[part].update) !== null && _c !== void 0 ? _c : {}; - // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 - axis.encode[part].update[vgProp] = vgRef; - } - function assembleAxis(axisCmpt, kind, config, opt = { header: false }) { - var _a, _b; - const _c = axisCmpt.combine(), { disable, orient, scale, labelExpr, title, zindex } = _c, axis = __rest(_c, ["disable", "orient", "scale", "labelExpr", "title", "zindex"]); - if (disable) { - return undefined; - } - for (const prop in axis) { - const propType = AXIS_PROPERTY_TYPE[prop]; - const propValue = axis[prop]; - if (propType && propType !== kind && propType !== 'both') { - // Remove properties that are not valid for this kind of axis - delete axis[prop]; - } - else if (isConditionalAxisValue(propValue)) { - // deal with conditional axis value - const { condition } = propValue, valueOrSignalRef = __rest(propValue, ["condition"]); - const conditions = array(condition); - const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; - if (propIndex) { - const { vgProp, part } = propIndex; - // If there is a corresponding Vega property for the channel, - // use Vega's custom axis encoding and delete the original axis property to avoid conflicts - const vgRef = [ - ...conditions.map(c => { - const { test } = c, valueOrSignalCRef = __rest(c, ["test"]); - return Object.assign({ test: expression(null, test) }, valueOrSignalCRef); - }), - valueOrSignalRef - ]; - setAxisEncode(axis, part, vgProp, vgRef); - delete axis[prop]; - } - else if (propIndex === null) { - // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead. - const signalRef = { - signal: conditions - .map(c => { - const { test } = c, valueOrSignalCRef = __rest(c, ["test"]); - return `${expression(null, test)} ? ${exprFromValueOrSignalRef(valueOrSignalCRef)} : `; - }) - .join('') + exprFromValueOrSignalRef(valueOrSignalRef) - }; - axis[prop] = signalRef; - } - } - else if (isSignalRef(propValue)) { - const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; - if (propIndex) { - const { vgProp, part } = propIndex; - setAxisEncode(axis, part, vgProp, propValue); - delete axis[prop]; - } // else do nothing since the property already supports signal - } - } - if (kind === 'grid') { - if (!axis.grid) { - return undefined; - } - // Remove unnecessary encode block - if (axis.encode) { - // Only need to keep encode block for grid - const { grid } = axis.encode; - axis.encode = Object.assign({}, (grid ? { grid } : {})); - if (isEmpty(axis.encode)) { - delete axis.encode; - } - } - return Object.assign(Object.assign({ scale, - orient }, axis), { domain: false, labels: false, aria: false, - // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent` - // would not affect gridAxis - maxExtent: 0, minExtent: 0, ticks: false, zindex: getFirstDefined(zindex, 0) // put grid behind marks by default - }); - } - else { - // kind === 'main' - if (!opt.header && axisCmpt.mainExtracted) { - // if mainExtracted has been extracted to a separate facet - return undefined; - } - if (labelExpr !== undefined) { - let expr = labelExpr; - if (((_b = (_a = axis.encode) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.update) && isSignalRef(axis.encode.labels.update.text)) { - expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal); - } - setAxisEncode(axis, 'labels', 'text', { signal: expr }); - } - if (axis.labelAlign === null) { - delete axis.labelAlign; - } - // Remove unnecessary encode block - if (axis.encode) { - for (const part of AXIS_PARTS) { - if (!axisCmpt.hasAxisPart(part)) { - delete axis.encode[part]; - } - } - if (isEmpty(axis.encode)) { - delete axis.encode; - } - } - const titleString = assembleTitle(title, config); - return Object.assign(Object.assign(Object.assign(Object.assign({ scale, - orient, grid: false }, (titleString ? { title: titleString } : {})), axis), (config.aria === false ? { aria: false } : {})), { zindex: getFirstDefined(zindex, 0) // put axis line above marks by default - }); - } - } - /** - * Add axis signals so grid line works correctly - * (Fix https://github.com/vega/vega-lite/issues/4226) - */ - function assembleAxisSignals(model) { - const { axes } = model.component; - const signals = []; - for (const channel of POSITION_SCALE_CHANNELS) { - if (axes[channel]) { - for (const axis of axes[channel]) { - if (!axis.get('disable') && !axis.get('gridScale')) { - // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width. - const sizeType = channel === 'x' ? 'height' : 'width'; - const update = model.getSizeSignalRef(sizeType).signal; - if (sizeType !== update) { - signals.push({ - name: sizeType, - update: update - }); - } - } - } - } - } - return signals; - } - function assembleAxes(axisComponents, config) { - const { x = [], y = [] } = axisComponents; - return [ - ...x.map(a => assembleAxis(a, 'grid', config)), - ...y.map(a => assembleAxis(a, 'grid', config)), - ...x.map(a => assembleAxis(a, 'main', config)), - ...y.map(a => assembleAxis(a, 'main', config)) - ].filter(a => a); // filter undefined - } - - const HEADER_TITLE_PROPERTIES_MAP = { - titleAlign: 'align', - titleAnchor: 'anchor', - titleAngle: 'angle', - titleBaseline: 'baseline', - titleColor: 'color', - titleFont: 'font', - titleFontSize: 'fontSize', - titleFontStyle: 'fontStyle', - titleFontWeight: 'fontWeight', - titleLimit: 'limit', - titleLineHeight: 'lineHeight', - titleOrient: 'orient', - titlePadding: 'offset' - }; - const HEADER_LABEL_PROPERTIES_MAP = { - labelAlign: 'align', - labelAnchor: 'anchor', - labelAngle: 'angle', - labelBaseline: 'baseline', - labelColor: 'color', - labelFont: 'font', - labelFontSize: 'fontSize', - labelFontStyle: 'fontStyle', - labelFontWeight: 'fontWeight', - labelLimit: 'limit', - labelLineHeight: 'lineHeight', - labelOrient: 'orient', - labelPadding: 'offset' - }; - const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP); - const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP); - - function getAxisConfigFromConfigTypes(configTypes, config, channel, orient) { - // TODO: add special casing to add conditional value based on orient signal - return Object.assign.apply(null, [ - {}, - ...configTypes.map(configType => { - if (configType === 'axisOrient') { - const orient1 = channel === 'x' ? 'bottom' : 'left'; - const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {}; - const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {}; - const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]); - const conditionalOrientAxisConfig = {}; - for (const prop of props.values()) { - conditionalOrientAxisConfig[prop] = { - // orient is surely signal in this case - signal: `${orient['signal']} === "${orient1}" ? ${signalOrStringValue(orientConfig1[prop])} : ${signalOrStringValue(orientConfig2[prop])}` - }; - } - return conditionalOrientAxisConfig; - } - return config[configType]; - }) - ]); - } - function getAxisConfigs(channel, scaleType, orient, config) { - const typeBasedConfigTypes = scaleType === 'band' - ? ['axisDiscrete', 'axisBand'] - : scaleType === 'point' - ? ['axisDiscrete', 'axisPoint'] - : isQuantitative(scaleType) - ? ['axisQuantitative'] - : scaleType === 'time' || scaleType === 'utc' - ? ['axisTemporal'] - : []; - const axisChannel = channel === 'x' ? 'axisX' : 'axisY'; - const axisOrient = isSignalRef(orient) ? 'axisOrient' : 'axis' + titleCase(orient); // axisTop, axisBottom, ... - const vlOnlyConfigTypes = [ - // technically Vega does have axisBand, but if we make another separation here, - // it will further introduce complexity in the code - ...typeBasedConfigTypes, - ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4)) - ]; - const vgConfigTypes = ['axis', axisOrient, axisChannel]; - return { - vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient), - vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient), - axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config) - }; - } - function getAxisConfigStyle(axisConfigTypes, config) { - var _a; - const toMerge = [{}]; - for (const configType of axisConfigTypes) { - // TODO: add special casing to add conditional value based on orient signal - let style = (_a = config[configType]) === null || _a === void 0 ? void 0 : _a.style; - if (style) { - style = array(style); - for (const s of style) { - toMerge.push(config.style[s]); - } - } - } - return Object.assign.apply(null, toMerge); - } - function getAxisConfig(property, styleConfigIndex, style, axisConfigs = {}) { - var _a; - const styleConfig = getStyleConfig(property, style, styleConfigIndex); - if (styleConfig !== undefined) { - return { - configFrom: 'style', - configValue: styleConfig - }; - } - for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) { - if (((_a = axisConfigs[configFrom]) === null || _a === void 0 ? void 0 : _a[property]) !== undefined) { - return { configFrom, configValue: axisConfigs[configFrom][property] }; - } - } - return {}; - } - - const axisRules = { - scale: ({ model, channel }) => model.scaleName(channel), - format: ({ fieldOrDatumDef, config, axis }) => { - const { format, formatType } = axis; - return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, true); - }, - formatType: ({ axis, fieldOrDatumDef, scaleType }) => { - const { formatType } = axis; - return guideFormatType(formatType, fieldOrDatumDef, scaleType); - }, - grid: ({ fieldOrDatumDef, axis, scaleType }) => { - var _a; - if (isFieldDef(fieldOrDatumDef) && isBinned(fieldOrDatumDef.bin)) { - return false; - } - else { - return (_a = axis.grid) !== null && _a !== void 0 ? _a : defaultGrid(scaleType, fieldOrDatumDef); - } - }, - gridScale: ({ model, channel }) => gridScale(model, channel), - labelAlign: ({ axis, labelAngle, orient, channel }) => axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel), - labelAngle: ({ labelAngle }) => labelAngle, - labelBaseline: ({ axis, labelAngle, orient, channel }) => axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel), - labelFlush: ({ axis, fieldOrDatumDef, channel }) => { var _a; return (_a = axis.labelFlush) !== null && _a !== void 0 ? _a : defaultLabelFlush(fieldOrDatumDef.type, channel); }, - labelOverlap: ({ axis, fieldOrDatumDef, scaleType }) => { var _a; return (_a = axis.labelOverlap) !== null && _a !== void 0 ? _a : defaultLabelOverlap(fieldOrDatumDef.type, scaleType, isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit, isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined); }, - // we already calculate orient in parse - orient: ({ orient }) => orient, - tickCount: ({ channel, model, axis, fieldOrDatumDef, scaleType }) => { - var _a; - const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; - const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined; - return (_a = axis.tickCount) !== null && _a !== void 0 ? _a : defaultTickCount({ fieldOrDatumDef, scaleType, size, values: axis.values }); - }, - title: ({ axis, model, channel }) => { - if (axis.title !== undefined) { - return axis.title; - } - const fieldDefTitle = getFieldDefTitle(model, channel); - if (fieldDefTitle !== undefined) { - return fieldDefTitle; - } - const fieldDef = model.typedFieldDef(channel); - const channel2 = channel === 'x' ? 'x2' : 'y2'; - const fieldDef2 = model.fieldDef(channel2); - // If title not specified, store base parts of fieldDef (and fieldDef2 if exists) - return mergeTitleFieldDefs(fieldDef ? [toFieldDefBase(fieldDef)] : [], isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []); - }, - values: ({ axis, fieldOrDatumDef }) => values(axis, fieldOrDatumDef), - zindex: ({ axis, fieldOrDatumDef, mark }) => { var _a; return (_a = axis.zindex) !== null && _a !== void 0 ? _a : defaultZindex(mark, fieldOrDatumDef); } - }; - // TODO: we need to refactor this method after we take care of config refactoring - /** - * Default rules for whether to show a grid should be shown for a channel. - * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned - */ - function defaultGrid(scaleType, fieldDef) { - return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.bin); - } - function gridScale(model, channel) { - const gridChannel = channel === 'x' ? 'y' : 'x'; - if (model.getScaleComponent(gridChannel)) { - return model.scaleName(gridChannel); - } - return undefined; - } - function getLabelAngle(fieldOrDatumDef, axis, channel, styleConfig, axisConfigs) { - const labelAngle = axis === null || axis === void 0 ? void 0 : axis.labelAngle; - // try axis value - if (labelAngle !== undefined) { - return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle); - } - else { - // try axis config value - const { configValue: angle } = getAxisConfig('labelAngle', styleConfig, axis === null || axis === void 0 ? void 0 : axis.style, axisConfigs); - if (angle !== undefined) { - return normalizeAngle(angle); - } - else { - // get default value - if (channel === X && - contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) && - !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)) { - return 270; - } - // no default - return undefined; - } - } - } - function normalizeAngleExpr(angle) { - return `(((${angle.signal} % 360) + 360) % 360)`; - } - function defaultLabelBaseline(angle, orient, channel, alwaysIncludeMiddle) { - if (angle !== undefined) { - if (channel === 'x') { - if (isSignalRef(angle)) { - const a = normalizeAngleExpr(angle); - const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === "top")` : orient === 'top'; - return { - signal: `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? "middle" :` + - `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? "bottom" : "top"` - }; - } - if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) { - return 'middle'; - } - if (isSignalRef(orient)) { - const op = angle <= 45 || 315 <= angle ? '===' : '!=='; - return { signal: `${orient.signal} ${op} "top" ? "bottom" : "top"` }; - } - return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top'; - } - else { - if (isSignalRef(angle)) { - const a = normalizeAngleExpr(angle); - const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === "left")` : orient === 'left'; - const middle = alwaysIncludeMiddle ? '"middle"' : 'null'; - return { - signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? "top" : "bottom"` - }; - } - if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) { - return alwaysIncludeMiddle ? 'middle' : null; - } - if (isSignalRef(orient)) { - const op = 45 <= angle && angle <= 135 ? '===' : '!=='; - return { signal: `${orient.signal} ${op} "left" ? "top" : "bottom"` }; - } - return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom'; - } - } - return undefined; - } - function defaultLabelAlign(angle, orient, channel) { - if (angle === undefined) { - return undefined; - } - const isX = channel === 'x'; - const startAngle = isX ? 0 : 90; - const mainOrient = isX ? 'bottom' : 'left'; - if (isSignalRef(angle)) { - const a = normalizeAngleExpr(angle); - const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === "${mainOrient}")` : orient === mainOrient; - return { - signal: `(${startAngle ? '(' + a + ' + 90)' : a} % 180 === 0) ? ${isX ? null : '"center"'} :` + - `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? "left" : "right"` - }; - } - if ((angle + startAngle) % 180 === 0) { - // For bottom, use default label align so label flush still works - return isX ? null : 'center'; - } - if (isSignalRef(orient)) { - const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!=='; - const orientIsMain = `${orient.signal} ${op} "${mainOrient}"`; - return { - signal: `${orientIsMain} ? "left" : "right"` - }; - } - if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) { - return 'left'; - } - return 'right'; - } - function defaultLabelFlush(type, channel) { - if (channel === 'x' && contains(['quantitative', 'temporal'], type)) { - return true; - } - return undefined; - } - function defaultLabelOverlap(type, scaleType, hasTimeUnit, sort) { - // do not prevent overlap for nominal data because there is no way to infer what the missing labels are - if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) { - if (scaleType === 'log') { - return 'greedy'; - } - return true; - } - return undefined; - } - function defaultOrient(channel) { - return channel === 'x' ? 'bottom' : 'left'; - } - function defaultTickCount({ fieldOrDatumDef, scaleType, size, values: vals }) { - var _a; - if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') { - if (isFieldDef(fieldOrDatumDef)) { - if (isBinning(fieldOrDatumDef.bin)) { - // for binned data, we don't want more ticks than maxbins - return { signal: `ceil(${size.signal}/10)` }; - } - if (fieldOrDatumDef.timeUnit && - contains(['month', 'hours', 'day', 'quarter'], (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit)) { - return undefined; - } - } - return { signal: `ceil(${size.signal}/40)` }; - } - return undefined; - } - function getFieldDefTitle(model, channel) { - const channel2 = channel === 'x' ? 'x2' : 'y2'; - const fieldDef = model.fieldDef(channel); - const fieldDef2 = model.fieldDef(channel2); - const title1 = fieldDef ? fieldDef.title : undefined; - const title2 = fieldDef2 ? fieldDef2.title : undefined; - if (title1 && title2) { - return mergeTitle(title1, title2); - } - else if (title1) { - return title1; - } - else if (title2) { - return title2; - } - else if (title1 !== undefined) { - // falsy value to disable config - return title1; - } - else if (title2 !== undefined) { - // falsy value to disable config - return title2; - } - return undefined; - } - function values(axis, fieldOrDatumDef) { - const vals = axis.values; - if (isArray(vals)) { - return valueArray(fieldOrDatumDef, vals); - } - else if (isSignalRef(vals)) { - return vals; - } - return undefined; - } - function defaultZindex(mark, fieldDef) { - if (mark === 'rect' && isDiscrete(fieldDef)) { - return 1; - } - return 0; - } - - class CalculateNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - this._dependentFields = getDependentFields(this.transform.calculate); - } - clone() { - return new CalculateNode(null, duplicate(this.transform)); - } - static parseAllForSortIndex(parent, model) { - // get all the encoding with sort fields from model - model.forEachFieldDef((fieldDef, channel) => { - if (!isScaleFieldDef(fieldDef)) { - return; - } - if (isSortArray(fieldDef.sort)) { - const { field, timeUnit } = fieldDef; - const sort = fieldDef.sort; - // generate `datum["a"] === val0 ? 0 : datum["a"] === val1 ? 1 : ... : n` via FieldEqualPredicate - const calculate = sort - .map((sortValue, i) => { - return `${fieldFilterExpression({ field, timeUnit, equal: sortValue })} ? ${i} : `; - }) - .join('') + sort.length; - parent = new CalculateNode(parent, { - calculate, - as: sortArrayIndexField(fieldDef, channel, { forAs: true }) - }); - } - }); - return parent; - } - producedFields() { - return new Set([this.transform.as]); - } - dependentFields() { - return this._dependentFields; - } - assemble() { - return { - type: 'formula', - expr: this.transform.calculate, - as: this.transform.as - }; - } - hash() { - return `Calculate ${hash(this.transform)}`; - } - } - function sortArrayIndexField(fieldDef, channel, opt) { - return vgField(fieldDef, Object.assign({ prefix: channel, suffix: 'sort_index' }, (opt !== null && opt !== void 0 ? opt : {}))); - } - - /** - * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet. - */ - function getHeaderChannel(channel, orient) { - if (contains(['top', 'bottom'], orient)) { - return 'column'; - } - else if (contains(['left', 'right'], orient)) { - return 'row'; - } - return channel === 'row' ? 'row' : 'column'; - } - function getHeaderProperty(prop, facetFieldDef, config, channel) { - const headerSpecificConfig = channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet; - return getFirstDefined(((facetFieldDef === null || facetFieldDef === void 0 ? void 0 : facetFieldDef.header) || {})[prop], headerSpecificConfig[prop], config.header[prop]); - } - function getHeaderProperties(properties, facetFieldDef, config, channel) { - const props = {}; - for (const prop of properties) { - const value = getHeaderProperty(prop, facetFieldDef, config, channel); - if (value !== undefined) { - props[prop] = value; - } - } - return props; - } - - const HEADER_CHANNELS = ['row', 'column']; - const HEADER_TYPES = ['header', 'footer']; - - /** - * Utility for generating row / column headers - */ - // TODO: rename to assembleHeaderTitleGroup - function assembleTitleGroup(model, channel) { - const title = model.component.layoutHeaders[channel].title; - const config = model.config ? model.config : undefined; - const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef - ? model.component.layoutHeaders[channel].facetFieldDef - : undefined; - const { titleAnchor, titleAngle: ta, titleOrient } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef, config, channel); - const headerChannel = getHeaderChannel(channel, titleOrient); - const titleAngle = normalizeAngle(ta); - return { - name: `${channel}-title`, - type: 'group', - role: `${headerChannel}-title`, - title: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ text: title }, (channel === 'row' ? { orient: 'left' } : {})), { style: 'guide-title' }), defaultHeaderGuideBaseline(titleAngle, headerChannel)), defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor)), assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)) - }; - } - function defaultHeaderGuideAlign(headerChannel, angle, anchor = 'middle') { - switch (anchor) { - case 'start': - return { align: 'left' }; - case 'end': - return { align: 'right' }; - } - const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x'); - return align ? { align } : {}; - } - function defaultHeaderGuideBaseline(angle, channel) { - const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true); - return baseline ? { baseline } : {}; - } - function assembleHeaderGroups(model, channel) { - const layoutHeader = model.component.layoutHeaders[channel]; - const groups = []; - for (const headerType of HEADER_TYPES) { - if (layoutHeader[headerType]) { - for (const headerComponent of layoutHeader[headerType]) { - const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent); - if (group != null) { - groups.push(group); - } - } - } - } - return groups; - } - function getSort(facetFieldDef, channel) { - var _a; - const { sort } = facetFieldDef; - if (isSortField(sort)) { - return { - field: vgField(sort, { expr: 'datum' }), - order: (_a = sort.order) !== null && _a !== void 0 ? _a : 'ascending' - }; - } - else if (isArray(sort)) { - return { - field: sortArrayIndexField(facetFieldDef, channel, { expr: 'datum' }), - order: 'ascending' - }; - } - else { - return { - field: vgField(facetFieldDef, { expr: 'datum' }), - order: sort !== null && sort !== void 0 ? sort : 'ascending' - }; - } - } - function assembleLabelTitle(facetFieldDef, channel, config) { - const { format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr } = getHeaderProperties(['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], facetFieldDef, config, channel); - const titleTextExpr = formatSignalRef({ fieldOrDatumDef: facetFieldDef, format, formatType, expr: 'parent', config }) - .signal; - const headerChannel = getHeaderChannel(channel, labelOrient); - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ text: { - signal: labelExpr - ? replaceAll(replaceAll(labelExpr, 'datum.label', titleTextExpr), 'datum.value', vgField(facetFieldDef, { expr: 'parent' })) - : titleTextExpr - } }, (channel === 'row' ? { orient: 'left' } : {})), { style: 'guide-label', frame: 'group' }), defaultHeaderGuideBaseline(labelAngle, headerChannel)), defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor)), assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)); - } - function assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent) { - if (headerComponent) { - let title = null; - const { facetFieldDef } = layoutHeader; - const config = model.config ? model.config : undefined; - if (facetFieldDef && headerComponent.labels) { - const { labelOrient } = getHeaderProperties(['labelOrient'], facetFieldDef, config, channel); - // Include label title in the header if orient aligns with the channel - if ((channel === 'row' && !contains(['top', 'bottom'], labelOrient)) || - (channel === 'column' && !contains(['left', 'right'], labelOrient))) { - title = assembleLabelTitle(facetFieldDef, channel, config); - } - } - const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet); - const axes = headerComponent.axes; - const hasAxes = (axes === null || axes === void 0 ? void 0 : axes.length) > 0; - if (title || hasAxes) { - const sizeChannel = channel === 'row' ? 'height' : 'width'; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name: model.getName(`${channel}_${headerType}`), type: 'group', role: `${channel}-${headerType}` }, (layoutHeader.facetFieldDef - ? { - from: { data: model.getName(channel + '_domain') }, - sort: getSort(facetFieldDef, channel) - } - : {})), (hasAxes && isFacetWithoutRowCol - ? { - from: { data: model.getName(`facet_domain_${channel}`) } - } - : {})), (title ? { title } : {})), (headerComponent.sizeSignal - ? { - encode: { - update: { - [sizeChannel]: headerComponent.sizeSignal - } - } - } - : {})), (hasAxes ? { axes } : {})); - } - } - return null; - } - const LAYOUT_TITLE_BAND = { - column: { - start: 0, - end: 1 - }, - row: { - start: 1, - end: 0 - } - }; - function getLayoutTitleBand(titleAnchor, headerChannel) { - return LAYOUT_TITLE_BAND[headerChannel][titleAnchor]; - } - function assembleLayoutTitleBand(headerComponentIndex, config) { - const titleBand = {}; - for (const channel of FACET_CHANNELS) { - const headerComponent = headerComponentIndex[channel]; - if (headerComponent === null || headerComponent === void 0 ? void 0 : headerComponent.facetFieldDef) { - const { titleAnchor, titleOrient } = getHeaderProperties(['titleAnchor', 'titleOrient'], headerComponent.facetFieldDef, config, channel); - const headerChannel = getHeaderChannel(channel, titleOrient); - const band = getLayoutTitleBand(titleAnchor, headerChannel); - if (band !== undefined) { - titleBand[headerChannel] = band; - } - } - } - return isEmpty(titleBand) ? undefined : titleBand; - } - function assembleHeaderProperties(config, facetFieldDef, channel, properties, propertiesMap) { - const props = {}; - for (const prop of properties) { - if (!propertiesMap[prop]) { - continue; - } - const value = getHeaderProperty(prop, facetFieldDef, config, channel); - if (value !== undefined) { - props[propertiesMap[prop]] = value; - } - } - return props; - } - - function assembleLayoutSignals(model) { - return [ - ...sizeSignals(model, 'width'), - ...sizeSignals(model, 'height'), - ...sizeSignals(model, 'childWidth'), - ...sizeSignals(model, 'childHeight') - ]; - } - function sizeSignals(model, sizeType) { - const channel = sizeType === 'width' ? 'x' : 'y'; - const size = model.component.layoutSize.get(sizeType); - if (!size || size === 'merged') { - return []; - } - // Read size signal name from name map, just in case it is the top-level size signal that got renamed. - const name = model.getSizeSignalRef(sizeType).signal; - if (size === 'step') { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const type = scaleComponent.get('type'); - const range = scaleComponent.get('range'); - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const scaleName = model.scaleName(channel); - if (isFacetModel(model.parent)) { - // If parent is facet and this is an independent scale, return only signal signal - // as the width/height will be calculated using the cardinality from - // facet's aggregate rather than reading from scale domain - const parentResolve = model.parent.component.resolve; - if (parentResolve.scale[channel] === 'independent') { - return [stepSignal(scaleName, range)]; - } - } - return [ - stepSignal(scaleName, range), - { - name, - update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`) - } - ]; - } - } - /* istanbul ignore next: Condition should not happen -- only for warning in development. */ - throw new Error('layout size is step although width/height is not step.'); - } - else if (size == 'container') { - const isWidth = name.endsWith('width'); - const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]'; - const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height'); - const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`; - return [{ name, init: safeExpr, on: [{ update: safeExpr, events: 'window:resize' }] }]; - } - else { - return [ - { - name, - value: size - } - ]; - } - } - function stepSignal(scaleName, range) { - return { - name: scaleName + '_step', - value: range.step - }; - } - function sizeExpr(scaleName, scaleComponent, cardinality) { - const type = scaleComponent.get('type'); - const padding = scaleComponent.get('padding'); - const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding); - let paddingInner = scaleComponent.get('paddingInner'); - paddingInner = - type === 'band' - ? // only band has real paddingInner - paddingInner !== undefined - ? paddingInner - : padding - : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128, - // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points. - 1; - return `bandspace(${cardinality}, ${paddingInner}, ${paddingOuter}) * ${scaleName}_step`; - } - - function getSizeTypeFromLayoutSizeType(layoutSizeType) { - return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType; - } - - function guideEncodeEntry(encoding, model) { - return keys(encoding).reduce((encode, channel) => { - const valueDef = encoding[channel]; - return Object.assign(Object.assign({}, encode), wrapCondition(model, valueDef, channel, (x) => (isSignalRef(x) ? x : { value: x.value }))); - }, {}); - } - - function defaultScaleResolve(channel, model) { - if (isLayerModel(model) || isFacetModel(model)) { - return 'shared'; - } - else if (isConcatModel(model)) { - return isXorY(channel) ? 'independent' : 'shared'; - } - /* istanbul ignore next: should never reach here. */ - throw new Error('invalid model type for resolve'); - } - function parseGuideResolve(resolve, channel) { - const channelScaleResolve = resolve.scale[channel]; - const guide = isXorY(channel) ? 'axis' : 'legend'; - if (channelScaleResolve === 'independent') { - if (resolve[guide][channel] === 'shared') { - warn(independentScaleMeansIndependentGuide(channel)); - } - return 'independent'; - } - return resolve[guide][channel] || 'shared'; - } - - const LEGEND_COMPONENT_PROPERTY_INDEX = Object.assign(Object.assign({}, COMMON_LEGEND_PROPERTY_INDEX), { disable: 1, labelExpr: 1, selections: 1, - // channel scales - opacity: 1, shape: 1, stroke: 1, fill: 1, size: 1, strokeWidth: 1, strokeDash: 1, - // encode - encode: 1 }); - const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX); - class LegendComponent extends Split { - } - - const legendEncodeRules = { - symbols, - gradient, - labels, - entries: entries$1 - }; - function symbols(symbolsSpec, { fieldOrDatumDef, model, channel, legendCmpt, legendType }) { - var _a, _b, _c, _d, _e, _f, _g, _h; - if (legendType !== 'symbol') { - return undefined; - } - const { markDef, encoding, config, mark } = model; - const filled = markDef.filled && mark !== 'trail'; - let out = Object.assign(Object.assign({}, applyMarkConfig({}, model, FILL_STROKE_CONFIG)), color(model, { filled })); // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry - const symbolOpacity = (_a = legendCmpt.get('symbolOpacity')) !== null && _a !== void 0 ? _a : config.legend.symbolOpacity; - const symbolFillColor = (_b = legendCmpt.get('symbolFillColor')) !== null && _b !== void 0 ? _b : config.legend.symbolFillColor; - const symbolStrokeColor = (_c = legendCmpt.get('symbolStrokeColor')) !== null && _c !== void 0 ? _c : config.legend.symbolStrokeColor; - const opacity = symbolOpacity === undefined ? (_d = getMaxValue(encoding.opacity)) !== null && _d !== void 0 ? _d : markDef.opacity : undefined; - if (out.fill) { - // for fill legend, we don't want any fill in symbol - if (channel === 'fill' || (filled && channel === COLOR)) { - delete out.fill; - } - else { - if (out.fill['field']) { - // For others, set fill to some opaque value (or nothing if a color is already set) - if (symbolFillColor) { - delete out.fill; - } - else { - out.fill = signalOrValueRef((_e = config.legend.symbolBaseFillColor) !== null && _e !== void 0 ? _e : 'black'); - out.fillOpacity = signalOrValueRef(opacity !== null && opacity !== void 0 ? opacity : 1); - } - } - else if (isArray(out.fill)) { - const fill = (_h = (_g = getFirstConditionValue((_f = encoding.fill) !== null && _f !== void 0 ? _f : encoding.color)) !== null && _g !== void 0 ? _g : markDef.fill) !== null && _h !== void 0 ? _h : (filled && markDef.color); - if (fill) { - out.fill = signalOrValueRef(fill); - } - } - } - } - if (out.stroke) { - if (channel === 'stroke' || (!filled && channel === COLOR)) { - delete out.stroke; - } - else { - if (out.stroke['field'] || symbolStrokeColor) { - // For others, remove stroke field - delete out.stroke; - } - else if (isArray(out.stroke)) { - const stroke = getFirstDefined(getFirstConditionValue(encoding.stroke || encoding.color), markDef.stroke, filled ? markDef.color : undefined); - if (stroke) { - out.stroke = { value: stroke }; - } - } - } - } - if (channel !== OPACITY) { - const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef); - if (condition) { - out.opacity = [ - Object.assign({ test: condition }, signalOrValueRef(opacity !== null && opacity !== void 0 ? opacity : 1)), - signalOrValueRef(config.legend.unselectedOpacity) - ]; - } - else if (opacity) { - out.opacity = signalOrValueRef(opacity); - } - } - out = Object.assign(Object.assign({}, out), symbolsSpec); - return isEmpty(out) ? undefined : out; - } - function gradient(gradientSpec, { model, legendType, legendCmpt }) { - var _a; - if (legendType !== 'gradient') { - return undefined; - } - const { config, markDef, encoding } = model; - let out = {}; - const gradientOpacity = (_a = legendCmpt.get('gradientOpacity')) !== null && _a !== void 0 ? _a : config.legend.gradientOpacity; - const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined; - if (opacity) { - // only apply opacity if it is neither zero or undefined - out.opacity = signalOrValueRef(opacity); - } - out = Object.assign(Object.assign({}, out), gradientSpec); - return isEmpty(out) ? undefined : out; - } - function labels(specifiedlabelsSpec, { fieldOrDatumDef, model, channel, legendCmpt }) { - const legend = model.legend(channel) || {}; - const config = model.config; - const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined; - const opacity = condition ? [{ test: condition, value: 1 }, { value: config.legend.unselectedOpacity }] : undefined; - const { format, formatType } = legend; - const text = isCustomFormatType(formatType) - ? formatCustomType({ - fieldOrDatumDef, - field: 'datum.value', - format, - formatType, - config - }) - : undefined; - const labelsSpec = Object.assign(Object.assign(Object.assign({}, (opacity ? { opacity } : {})), (text ? { text } : {})), specifiedlabelsSpec); - return isEmpty(labelsSpec) ? undefined : labelsSpec; - } - function entries$1(entriesSpec, { legendCmpt }) { - const selections = legendCmpt.get('selections'); - return (selections === null || selections === void 0 ? void 0 : selections.length) ? Object.assign(Object.assign({}, entriesSpec), { fill: { value: 'transparent' } }) : entriesSpec; - } - function getMaxValue(channelDef) { - return getConditionValue(channelDef, (v, conditionalDef) => Math.max(v, conditionalDef.value)); - } - function getFirstConditionValue(channelDef) { - return getConditionValue(channelDef, (v, conditionalDef) => { - return getFirstDefined(v, conditionalDef.value); - }); - } - function getConditionValue(channelDef, reducer) { - if (hasConditionalValueDef(channelDef)) { - return array(channelDef.condition).reduce(reducer, channelDef.value); - } - else if (isValueDef(channelDef)) { - return channelDef.value; - } - return undefined; - } - function selectedCondition(model, legendCmpt, fieldDef) { - const selections = legendCmpt.get('selections'); - if (!(selections === null || selections === void 0 ? void 0 : selections.length)) - return undefined; - const field = $(fieldDef.field); - return selections - .map(name => { - const store = $(varName(name) + STORE); - return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`; - }) - .join(' || '); - } - - const legendRules = { - direction: ({ direction }) => direction, - format: ({ fieldOrDatumDef, legend, config }) => { - const { format, formatType } = legend; - return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false); - }, - formatType: ({ legend, fieldOrDatumDef, scaleType }) => { - const { formatType } = legend; - return guideFormatType(formatType, fieldOrDatumDef, scaleType); - }, - gradientLength: params => { - var _a, _b; - const { legend, legendConfig } = params; - return (_b = (_a = legend.gradientLength) !== null && _a !== void 0 ? _a : legendConfig.gradientLength) !== null && _b !== void 0 ? _b : defaultGradientLength(params); - }, - labelOverlap: ({ legend, legendConfig, scaleType }) => { var _a, _b; return (_b = (_a = legend.labelOverlap) !== null && _a !== void 0 ? _a : legendConfig.labelOverlap) !== null && _b !== void 0 ? _b : defaultLabelOverlap$1(scaleType); }, - symbolType: ({ legend, markDef, channel, encoding }) => { var _a; return (_a = legend.symbolType) !== null && _a !== void 0 ? _a : defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape); }, - title: ({ fieldOrDatumDef, config }) => title(fieldOrDatumDef, config, { allowDisabling: true }), - type: ({ legendType, scaleType, channel }) => { - if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) { - if (legendType === 'gradient') { - return undefined; - } - } - else if (legendType === 'symbol') { - return undefined; - } - return legendType; - }, - values: ({ fieldOrDatumDef, legend }) => values$1(legend, fieldOrDatumDef) - }; - function values$1(legend, fieldOrDatumDef) { - const vals = legend.values; - if (isArray(vals)) { - return valueArray(fieldOrDatumDef, vals); - } - else if (isSignalRef(vals)) { - return vals; - } - return undefined; - } - function defaultSymbolType(mark, channel, shapeChannelDef, markShape) { - var _a; - if (channel !== 'shape') { - // use the value from the shape encoding or the mark config if they exist - const shape = (_a = getFirstConditionValue(shapeChannelDef)) !== null && _a !== void 0 ? _a : markShape; - if (shape) { - return shape; - } - } - switch (mark) { - case 'bar': - case 'rect': - case 'image': - case 'square': - return 'square'; - case 'line': - case 'trail': - case 'rule': - return 'stroke'; - case 'arc': - case 'point': - case 'circle': - case 'tick': - case 'geoshape': - case 'area': - case 'text': - return 'circle'; - } - } - function getLegendType(params) { - const { legend } = params; - return getFirstDefined(legend.type, defaultType$1(params)); - } - function defaultType$1({ channel, timeUnit, scaleType }) { - // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js - if (isColorChannel(channel)) { - if (contains(['quarter', 'month', 'day'], timeUnit)) { - return 'symbol'; - } - if (isContinuousToContinuous(scaleType)) { - return 'gradient'; - } - } - return 'symbol'; - } - function getDirection({ legendConfig, legendType, orient, legend }) { - var _a, _b; - return ((_b = (_a = legend.direction) !== null && _a !== void 0 ? _a : legendConfig[legendType ? 'gradientDirection' : 'symbolDirection']) !== null && _b !== void 0 ? _b : defaultDirection(orient, legendType)); - } - function defaultDirection(orient, legendType) { - switch (orient) { - case 'top': - case 'bottom': - return 'horizontal'; - case 'left': - case 'right': - case 'none': - case undefined: // undefined = "right" in Vega - return undefined; // vertical is Vega's default - default: - // top-left / ... - // For inner legend, uses compact layout like Tableau - return legendType === 'gradient' ? 'horizontal' : undefined; - } - } - function defaultGradientLength({ legendConfig, model, direction, orient, scaleType }) { - const { gradientHorizontalMaxLength, gradientHorizontalMinLength, gradientVerticalMaxLength, gradientVerticalMinLength } = legendConfig; - if (isContinuousToContinuous(scaleType)) { - if (direction === 'horizontal') { - if (orient === 'top' || orient === 'bottom') { - return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength); - } - else { - return gradientHorizontalMinLength; - } - } - else { - // vertical / undefined (Vega uses vertical by default) - return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength); - } - } - return undefined; - } - function gradientLengthSignal(model, sizeType, min, max) { - const sizeSignal = model.getSizeSignalRef(sizeType).signal; - return { signal: `clamp(${sizeSignal}, ${min}, ${max})` }; - } - function defaultLabelOverlap$1(scaleType) { - if (contains(['quantile', 'threshold', 'log'], scaleType)) { - return 'greedy'; - } - return undefined; - } - - function parseLegend(model) { - const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model); - model.component.legends = legendComponent; - return legendComponent; - } - function parseUnitLegend(model) { - const { encoding } = model; - const legendComponent = {}; - for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) { - const def = getFieldOrDatumDef(encoding[channel]); - if (!def || !model.getScaleComponent(channel)) { - continue; - } - if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) { - continue; - } - legendComponent[channel] = parseLegendForChannel(model, channel); - } - return legendComponent; - } - function getLegendDefWithScale(model, channel) { - const scale = model.scaleName(channel); - if (model.mark === 'trail') { - if (channel === 'color') { - // trail is a filled mark, but its default symbolType ("stroke") should use "stroke" - return { stroke: scale }; - } - else if (channel === 'size') { - return { strokeWidth: scale }; - } - } - if (channel === 'color') { - return model.markDef.filled ? { fill: scale } : { stroke: scale }; - } - return { [channel]: scale }; - } - // eslint-disable-next-line @typescript-eslint/ban-types - function isExplicit(value, property, legend, fieldDef) { - switch (property) { - case 'disable': - return legend !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit - case 'values': - // specified legend.values is already respected, but may get transformed. - return !!(legend === null || legend === void 0 ? void 0 : legend.values); - case 'title': - // title can be explicit if fieldDef.title is set - if (property === 'title' && value === (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.title)) { - return true; - } - } - // Otherwise, things are explicit if the returned value matches the specified property - return value === (legend || {})[property]; - } - function parseLegendForChannel(model, channel) { - var _a, _b, _c; - let legend = model.legend(channel); - const { markDef, encoding, config } = model; - const legendConfig = config.legend; - const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel)); - parseInteractiveLegend(model, channel, legendCmpt); - const disable = legend !== undefined ? !legend : legendConfig.disable; - legendCmpt.set('disable', disable, legend !== undefined); - if (disable) { - return legendCmpt; - } - legend = legend || {}; - const scaleType = model.getScaleComponent(channel).get('type'); - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - const timeUnit = isFieldDef(fieldOrDatumDef) ? (_a = normalizeTimeUnit(fieldOrDatumDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit : undefined; - const orient = legend.orient || config.legend.orient || 'right'; - const legendType = getLegendType({ legend, channel, timeUnit, scaleType }); - const direction = getDirection({ legend, legendType, orient, legendConfig }); - const ruleParams = { - legend, - channel, - model, - markDef, - encoding, - fieldOrDatumDef, - legendConfig, - config, - scaleType, - orient, - legendType, - direction - }; - for (const property of LEGEND_COMPONENT_PROPERTIES) { - if ((legendType === 'gradient' && property.startsWith('symbol')) || - (legendType === 'symbol' && property.startsWith('gradient'))) { - continue; - } - const value = property in legendRules ? legendRules[property](ruleParams) : legend[property]; - if (value !== undefined) { - const explicit = isExplicit(value, property, legend, model.fieldDef(channel)); - if (explicit || config.legend[property] === undefined) { - legendCmpt.set(property, value, explicit); - } - } - } - const legendEncoding = (_b = legend === null || legend === void 0 ? void 0 : legend.encoding) !== null && _b !== void 0 ? _b : {}; - const selections = legendCmpt.get('selections'); - const legendEncode = {}; - const legendEncodeParams = { fieldOrDatumDef, model, channel, legendCmpt, legendType }; - for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) { - const legendEncodingPart = guideEncodeEntry((_c = legendEncoding[part]) !== null && _c !== void 0 ? _c : {}, model); - const value = part in legendEncodeRules - ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule - : legendEncodingPart; // no rule -- just default values - if (value !== undefined && !isEmpty(value)) { - legendEncode[part] = Object.assign(Object.assign(Object.assign({}, ((selections === null || selections === void 0 ? void 0 : selections.length) && isFieldDef(fieldOrDatumDef) - ? { name: `${varName(fieldOrDatumDef.field)}_legend_${part}` } - : {})), ((selections === null || selections === void 0 ? void 0 : selections.length) ? { interactive: !!selections } : {})), { update: value }); - } - } - if (!isEmpty(legendEncode)) { - legendCmpt.set('encode', legendEncode, !!(legend === null || legend === void 0 ? void 0 : legend.encoding)); - } - return legendCmpt; - } - function parseNonUnitLegend(model) { - const { legends, resolve } = model.component; - for (const child of model.children) { - parseLegend(child); - for (const channel of keys(child.component.legends)) { - resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel); - if (resolve.legend[channel] === 'shared') { - // If the resolve says shared (and has not been overridden) - // We will try to merge and see if there is a conflict - legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]); - if (!legends[channel]) { - // If merge returns nothing, there is a conflict so we cannot make the legend shared. - // Thus, mark legend as independent and remove the legend component. - resolve.legend[channel] = 'independent'; - delete legends[channel]; - } - } - } - } - for (const channel of keys(legends)) { - for (const child of model.children) { - if (!child.component.legends[channel]) { - // skip if the child does not have a particular legend - continue; - } - if (resolve.legend[channel] === 'shared') { - // After merging shared legend, make sure to remove legend from child - delete child.component.legends[channel]; - } - } - } - return legends; - } - function mergeLegendComponent(mergedLegend, childLegend) { - var _a, _b, _c, _d; - if (!mergedLegend) { - return childLegend.clone(); - } - const mergedOrient = mergedLegend.getWithExplicit('orient'); - const childOrient = childLegend.getWithExplicit('orient'); - if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { - // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) - // Cannot merge due to inconsistent orient - return undefined; - } - let typeMerged = false; - // Otherwise, let's merge - for (const prop of LEGEND_COMPONENT_PROPERTIES) { - const mergedValueWithExplicit = mergeValuesWithExplicit(mergedLegend.getWithExplicit(prop), childLegend.getWithExplicit(prop), prop, 'legend', - // Tie breaker function - (v1, v2) => { - switch (prop) { - case 'symbolType': - return mergeSymbolType(v1, v2); - case 'title': - return mergeTitleComponent(v1, v2); - case 'type': - // There are only two types. If we have different types, then prefer symbol over gradient. - typeMerged = true; - return makeImplicit('symbol'); - } - return defaultTieBreaker(v1, v2, prop, 'legend'); - }); - mergedLegend.setWithExplicit(prop, mergedValueWithExplicit); - } - if (typeMerged) { - if ((_b = (_a = mergedLegend.implicit) === null || _a === void 0 ? void 0 : _a.encode) === null || _b === void 0 ? void 0 : _b.gradient) { - deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']); - } - if ((_d = (_c = mergedLegend.explicit) === null || _c === void 0 ? void 0 : _c.encode) === null || _d === void 0 ? void 0 : _d.gradient) { - deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']); - } - } - return mergedLegend; - } - function mergeSymbolType(st1, st2) { - if (st2.value === 'circle') { - // prefer "circle" over "stroke" - return st2; - } - return st1; - } - - function setLegendEncode(legend, part, vgProp, vgRef) { - var _a, _b, _c; - legend.encode = (_a = legend.encode) !== null && _a !== void 0 ? _a : {}; - legend.encode[part] = (_b = legend.encode[part]) !== null && _b !== void 0 ? _b : {}; - legend.encode[part].update = (_c = legend.encode[part].update) !== null && _c !== void 0 ? _c : {}; - // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 - legend.encode[part].update[vgProp] = vgRef; - } - function assembleLegends(model) { - const legendComponentIndex = model.component.legends; - const legendByDomain = {}; - for (const channel of keys(legendComponentIndex)) { - const scaleComponent = model.getScaleComponent(channel); - const domainHash = stringify(scaleComponent.get('domains')); - if (legendByDomain[domainHash]) { - for (const mergedLegendComponent of legendByDomain[domainHash]) { - const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]); - if (!merged) { - // If cannot merge, need to add this legend separately - legendByDomain[domainHash].push(legendComponentIndex[channel]); - } - } - } - else { - legendByDomain[domainHash] = [legendComponentIndex[channel].clone()]; - } - } - const legends = vals(legendByDomain) - .flat() - .map(l => assembleLegend(l, model.config)) - .filter(l => l !== undefined); - return legends; - } - function assembleLegend(legendCmpt, config) { - var _a, _b, _c; - const _d = legendCmpt.combine(), { disable, labelExpr, selections } = _d, legend = __rest(_d, ["disable", "labelExpr", "selections"]); - if (disable) { - return undefined; - } - if (config.aria === false && legend.aria == undefined) { - legend.aria = false; - } - if ((_a = legend.encode) === null || _a === void 0 ? void 0 : _a.symbols) { - const out = legend.encode.symbols.update; - if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) { - // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used. - out.stroke = { value: 'transparent' }; - } - // Remove properties that the legend is encoding. - for (const property of LEGEND_SCALE_CHANNELS) { - if (legend[property]) { - delete out[property]; - } - } - } - if (!legend.title) { - // title schema doesn't include null, '' - delete legend.title; - } - if (labelExpr !== undefined) { - let expr = labelExpr; - if (((_c = (_b = legend.encode) === null || _b === void 0 ? void 0 : _b.labels) === null || _c === void 0 ? void 0 : _c.update) && isSignalRef(legend.encode.labels.update.text)) { - expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal); - } - setLegendEncode(legend, 'labels', 'text', { signal: expr }); - } - for (const prop in legend) { - const propValue = legend[prop]; - if (isSignalRef(propValue)) { - const propIndex = SIGNAL_LEGEND_PROP_INDEX[prop]; - if (propIndex) { - const { vgProp, part } = propIndex; - setLegendEncode(legend, part, vgProp, propValue); - delete legend[prop]; - } - } - } - return legend; - } - - function assembleProjections(model) { - if (isLayerModel(model) || isConcatModel(model)) { - return assembleProjectionsForModelAndChildren(model); - } - else { - return assembleProjectionForModel(model); - } - } - function assembleProjectionsForModelAndChildren(model) { - return model.children.reduce((projections, child) => { - return projections.concat(child.assembleProjections()); - }, assembleProjectionForModel(model)); - } - function assembleProjectionForModel(model) { - const component = model.component.projection; - if (!component || component.merged) { - return []; - } - const projection = component.combine(); - const { name } = projection; // we need to extract name so that it is always present in the output and pass TS type validation - if (!component.data) { - // generate custom projection, no automatic fitting - return [ - Object.assign(Object.assign({ name }, { translate: { signal: '[width / 2, height / 2]' } }), projection) - ]; - } - else { - // generate projection that uses extent fitting - const size = { - signal: `[${component.size.map(ref => ref.signal).join(', ')}]` - }; - const fits = component.data.reduce((sources, data) => { - const source = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`; - if (!contains(sources, source)) { - // build a unique list of sources - sources.push(source); - } - return sources; - }, []); - if (fits.length <= 0) { - throw new Error("Projection's fit didn't find any data sources"); - } - return [ - Object.assign({ name, - size, fit: { - signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0] - } }, projection) - ]; - } - } - - const PROJECTION_PROPERTIES = [ - 'type', - 'clipAngle', - 'clipExtent', - 'center', - 'rotate', - 'precision', - 'reflectX', - 'reflectY', - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' - ]; - - class ProjectionComponent extends Split { - constructor(name, specifiedProjection, size, data) { - super(Object.assign({}, specifiedProjection), // all explicit properties of projection - { name } // name as initial implicit property - ); - this.specifiedProjection = specifiedProjection; - this.size = size; - this.data = data; - this.merged = false; - } - /** - * Whether the projection parameters should fit provided data. - */ - get isFit() { - return !!this.data; - } - } - - function parseProjection(model) { - model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model); - } - function parseUnitProjection(model) { - var _a; - if (model.hasProjection) { - const proj = model.specifiedProjection; - const fit = !(proj && (proj.scale != null || proj.translate != null)); - const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined; - const data = fit ? gatherFitData(model) : undefined; - return new ProjectionComponent(model.projectionName(true), Object.assign(Object.assign({}, ((_a = model.config.projection) !== null && _a !== void 0 ? _a : {})), (proj !== null && proj !== void 0 ? proj : {})), size, data); - } - return undefined; - } - function gatherFitData(model) { - const data = []; - const { encoding } = model; - for (const posssiblePair of [ - [LONGITUDE, LATITUDE], - [LONGITUDE2, LATITUDE2] - ]) { - if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) { - data.push({ - signal: model.getName(`geojson_${data.length}`) - }); - } - } - if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) { - data.push({ - signal: model.getName(`geojson_${data.length}`) - }); - } - if (data.length === 0) { - // main source is geojson, so we can just use that - data.push(model.requestDataName(DataSourceType.Main)); - } - return data; - } - function mergeIfNoConflict(first, second) { - const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => { - // neither has the property - if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) { - return true; - } - // both have property and an equal value for property - if (hasOwnProperty(first.explicit, prop) && - hasOwnProperty(second.explicit, prop) && - // some properties might be signals or objects and require hashing for comparison - stringify(first.get(prop)) === stringify(second.get(prop))) { - return true; - } - return false; - }); - const size = stringify(first.size) === stringify(second.size); - if (size) { - if (allPropertiesShared) { - return first; - } - else if (stringify(first.explicit) === stringify({})) { - return second; - } - else if (stringify(second.explicit) === stringify({})) { - return first; - } - } - // if all properties don't match, let each unit spec have its own projection - return null; - } - function parseNonUnitProjections(model) { - if (model.children.length === 0) { - return undefined; - } - let nonUnitProjection; - // parse all children first - for (const child of model.children) { - parseProjection(child); - } - // analyze parsed projections, attempt to merge - const mergable = every(model.children, child => { - const projection = child.component.projection; - if (!projection) { - // child layer does not use a projection - return true; - } - else if (!nonUnitProjection) { - // cached 'projection' is null, cache this one - nonUnitProjection = projection; - return true; - } - else { - const merge = mergeIfNoConflict(nonUnitProjection, projection); - if (merge) { - nonUnitProjection = merge; - } - return !!merge; - } - }); - // if cached one and all other children share the same projection, - if (nonUnitProjection && mergable) { - // so we can elevate it to the layer level - const name = model.projectionName(true); - const modelProjection = new ProjectionComponent(name, nonUnitProjection.specifiedProjection, nonUnitProjection.size, duplicate(nonUnitProjection.data)); - // rename and assign all others as merged - for (const child of model.children) { - const projection = child.component.projection; - if (projection) { - if (projection.isFit) { - modelProjection.data.push(...child.component.projection.data); - } - child.renameProjection(projection.get('name'), name); - projection.merged = true; - } - } - return modelProjection; - } - return undefined; - } - - function rangeFormula(model, fieldDef, channel, config) { - var _a, _b; - if (binRequiresRange(fieldDef, channel)) { - // read format from axis or legend, if there is no format then use config.numberFormat - const guide = isUnitModel(model) - ? (_b = (_a = model.axis(channel)) !== null && _a !== void 0 ? _a : model.legend(channel)) !== null && _b !== void 0 ? _b : {} : {}; - const startField = vgField(fieldDef, { expr: 'datum' }); - const endField = vgField(fieldDef, { expr: 'datum', binSuffix: 'end' }); - return { - formulaAs: vgField(fieldDef, { binSuffix: 'range', forAs: true }), - formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config) - }; - } - return {}; - } - function binKey(bin, field) { - return `${binToString(bin)}_${field}`; - } - function getSignalsFromModel(model, key) { - return { - signal: model.getName(`${key}_bins`), - extentSignal: model.getName(`${key}_extent`) - }; - } - function getBinSignalName(model, field, bin) { - var _a; - const normalizedBin = (_a = normalizeBin(bin, undefined)) !== null && _a !== void 0 ? _a : {}; - const key = binKey(normalizedBin, field); - return model.getName(`${key}_bins`); - } - function isBinTransform(t) { - return 'as' in t; - } - function createBinComponent(t, bin, model) { - let as; - let span; - if (isBinTransform(t)) { - as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]]; - } - else { - as = [vgField(t, { forAs: true }), vgField(t, { binSuffix: 'end', forAs: true })]; - } - const normalizedBin = Object.assign({}, normalizeBin(bin, undefined)); - const key = binKey(normalizedBin, t.field); - const { signal, extentSignal } = getSignalsFromModel(model, key); - if (isSelectionExtent(normalizedBin.extent)) { - const ext = normalizedBin.extent; - const selName = ext.selection; - span = parseSelectionBinExtent(model.getSelectionComponent(varName(selName), selName), ext); - delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property. - } - const binComponent = Object.assign(Object.assign(Object.assign({ bin: normalizedBin, field: t.field, as: [as] }, (signal ? { signal } : {})), (extentSignal ? { extentSignal } : {})), (span ? { span } : {})); - return { key, binComponent }; - } - class BinNode extends DataFlowNode { - constructor(parent, bins) { - super(parent); - this.bins = bins; - } - clone() { - return new BinNode(null, duplicate(this.bins)); - } - static makeFromEncoding(parent, model) { - const bins = model.reduceFieldDef((binComponentIndex, fieldDef, channel) => { - if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) { - const { key, binComponent } = createBinComponent(fieldDef, fieldDef.bin, model); - binComponentIndex[key] = Object.assign(Object.assign(Object.assign({}, binComponent), binComponentIndex[key]), rangeFormula(model, fieldDef, channel, model.config)); - } - return binComponentIndex; - }, {}); - if (isEmpty(bins)) { - return null; - } - return new BinNode(parent, bins); - } - /** - * Creates a bin node from BinTransform. - * The optional parameter should provide - */ - static makeFromTransform(parent, t, model) { - const { key, binComponent } = createBinComponent(t, t.bin, model); - return new BinNode(parent, { - [key]: binComponent - }); - } - /** - * Merge bin nodes. This method either integrates the bin config from the other node - * or if this node already has a bin config, renames the corresponding signal in the model. - */ - merge(other, renameSignal) { - for (const key of keys(other.bins)) { - if (key in this.bins) { - renameSignal(other.bins[key].signal, this.bins[key].signal); - // Ensure that we don't have duplicate names for signal pairs - this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash); - } - else { - this.bins[key] = other.bins[key]; - } - } - for (const child of other.children) { - other.removeChild(child); - child.parent = this; - } - other.remove(); - } - producedFields() { - return new Set(vals(this.bins) - .map(c => c.as) - .flat(2)); - } - dependentFields() { - return new Set(vals(this.bins).map(c => c.field)); - } - hash() { - return `Bin ${hash(this.bins)}`; - } - assemble() { - return vals(this.bins).flatMap(bin => { - const transform = []; - const [binAs, ...remainingAs] = bin.as; - const _a = bin.bin, { extent } = _a, params = __rest(_a, ["extent"]); - const binTrans = Object.assign(Object.assign(Object.assign({ type: 'bin', field: replacePathInField(bin.field), as: binAs, signal: bin.signal }, (!isSelectionExtent(extent) ? { extent } : { extent: null })), (bin.span ? { span: { signal: `span(${bin.span})` } } : {})), params); - if (!extent && bin.extentSignal) { - transform.push({ - type: 'extent', - field: replacePathInField(bin.field), - signal: bin.extentSignal - }); - binTrans.extent = { signal: bin.extentSignal }; - } - transform.push(binTrans); - for (const as of remainingAs) { - for (let i = 0; i < 2; i++) { - transform.push({ - type: 'formula', - expr: vgField({ field: binAs[i] }, { expr: 'datum' }), - as: as[i] - }); - } - } - if (bin.formula) { - transform.push({ - type: 'formula', - expr: bin.formula, - as: bin.formulaAs - }); - } - return transform; - }); - } - } - - class SourceNode extends DataFlowNode { - constructor(data) { - super(null); // source cannot have parent - data = data !== null && data !== void 0 ? data : { name: 'source' }; - let format; - if (!isGenerator(data)) { - format = data.format ? Object.assign({}, omit(data.format, ['parse'])) : {}; - } - if (isInlineData(data)) { - this._data = { values: data.values }; - } - else if (isUrlData(data)) { - this._data = { url: data.url }; - if (!format.type) { - // Extract extension from URL using snippet from - // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript - let defaultExtension = /(?:\.([^.]+))?$/.exec(data.url)[1]; - if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) { - defaultExtension = 'json'; - } - // defaultExtension has type string but we ensure that it is DataFormatType above - format.type = defaultExtension; - } - } - else if (isSphereGenerator(data)) { - // hardwire GeoJSON sphere data into output specification - this._data = { values: [{ type: 'Sphere' }] }; - } - else if (isNamedData(data) || isGenerator(data)) { - this._data = {}; - } - // set flag to check if generator - this._generator = isGenerator(data); - // any dataset can be named - if (data.name) { - this._name = data.name; - } - if (format && !isEmpty(format)) { - this._data.format = format; - } - } - dependentFields() { - return new Set(); - } - producedFields() { - return undefined; // we don't know what this source produces - } - get data() { - return this._data; - } - hasName() { - return !!this._name; - } - get isGenerator() { - return this._generator; - } - get dataName() { - return this._name; - } - set dataName(name) { - this._name = name; - } - set parent(parent) { - throw new Error('Source nodes have to be roots.'); - } - remove() { - throw new Error('Source nodes are roots and cannot be removed.'); - } - hash() { - throw new Error('Cannot hash sources'); - } - assemble() { - return Object.assign(Object.assign({ name: this._name }, this._data), { transform: [] }); - } - } - - class GraticuleNode extends DataFlowNode { - constructor(parent, params) { - super(parent); - this.params = params; - } - clone() { - return new GraticuleNode(null, this.params); - } - dependentFields() { - return new Set(); - } - producedFields() { - return undefined; // there should never be a node before graticule - } - hash() { - return `Graticule ${hash(this.params)}`; - } - assemble() { - return Object.assign({ type: 'graticule' }, (this.params === true ? {} : this.params)); - } - } - - class SequenceNode extends DataFlowNode { - constructor(parent, params) { - super(parent); - this.params = params; - } - clone() { - return new SequenceNode(null, this.params); - } - dependentFields() { - return new Set(); - } - producedFields() { - var _a; - return new Set([(_a = this.params.as) !== null && _a !== void 0 ? _a : 'data']); - } - hash() { - return `Hash ${hash(this.params)}`; - } - assemble() { - return Object.assign({ type: 'sequence' }, this.params); - } - } - - /** - * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator. - */ - function isDataSourceNode(node) { - return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode; - } - /** - * Abstract base class for BottomUpOptimizer and TopDownOptimizer. - * Contains only mutation handling logic. Subclasses need to implement iteration logic. - */ - class OptimizerBase { - constructor() { - this._mutated = false; - } - // Once true, _mutated is never set to false - setMutated() { - this._mutated = true; - } - get mutatedFlag() { - return this._mutated; - } - } - /** - * Starts from a node and runs the optimization function(the "run" method) upwards to the root, - * depending on the continueFlag and mutatedFlag values returned by the optimization function. - */ - class BottomUpOptimizer extends OptimizerBase { - constructor() { - super(); - this._continue = false; - } - setContinue() { - this._continue = true; - } - get continueFlag() { - return this._continue; - } - get flags() { - return { continueFlag: this.continueFlag, mutatedFlag: this.mutatedFlag }; - } - set flags({ continueFlag, mutatedFlag }) { - if (continueFlag) { - this.setContinue(); - } - if (mutatedFlag) { - this.setMutated(); - } - } - /** - * Reset the state of the optimizer after it has completed a run from the bottom of the tree to the top. - */ - reset() { - // do nothing - } - optimizeNextFromLeaves(node) { - if (isDataSourceNode(node)) { - return false; - } - const next = node.parent; - const { continueFlag } = this.run(node); - if (continueFlag) { - this.optimizeNextFromLeaves(next); - } - return this.mutatedFlag; - } - } - /** - * The optimizer function( the "run" method), is invoked on the given node and then continues recursively. - */ - class TopDownOptimizer extends OptimizerBase { - } - - function addDimension(dims, channel, fieldDef, model) { - const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; - if (isTypedFieldDef(fieldDef) && - isUnitModel(model) && - hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config)) { - dims.add(vgField(fieldDef, {})); - dims.add(vgField(fieldDef, { suffix: 'end' })); - if (fieldDef.bin && binRequiresRange(fieldDef, channel)) { - dims.add(vgField(fieldDef, { binSuffix: 'range' })); - } - } - else if (isGeoPositionChannel(channel)) { - const posChannel = getPositionChannelFromLatLong(channel); - dims.add(model.getName(posChannel)); - } - else { - dims.add(vgField(fieldDef)); - } - return dims; - } - function mergeMeasures(parentMeasures, childMeasures) { - var _a; - for (const field of keys(childMeasures)) { - // when we merge a measure, we either have to add an aggregation operator or even a new field - const ops = childMeasures[field]; - for (const op of keys(ops)) { - if (field in parentMeasures) { - // add operator to existing measure field - parentMeasures[field][op] = new Set([...((_a = parentMeasures[field][op]) !== null && _a !== void 0 ? _a : []), ...ops[op]]); - } - else { - parentMeasures[field] = { [op]: ops[op] }; - } - } - } - } - class AggregateNode extends DataFlowNode { - /** - * @param dimensions string set for dimensions - * @param measures dictionary mapping field name => dict of aggregation functions and names to use - */ - constructor(parent, dimensions, measures) { - super(parent); - this.dimensions = dimensions; - this.measures = measures; - } - clone() { - return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures)); - } - get groupBy() { - return this.dimensions; - } - static makeFromEncoding(parent, model) { - let isAggregate = false; - model.forEachFieldDef(fd => { - if (fd.aggregate) { - isAggregate = true; - } - }); - const meas = {}; - const dims = new Set(); - if (!isAggregate) { - // no need to create this node if the model has no aggregation - return null; - } - model.forEachFieldDef((fieldDef, channel) => { - var _a, _b, _c, _d; - const { aggregate, field } = fieldDef; - if (aggregate) { - if (aggregate === 'count') { - meas['*'] = (_a = meas['*']) !== null && _a !== void 0 ? _a : {}; - meas['*']['count'] = new Set([vgField(fieldDef, { forAs: true })]); - } - else { - if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { - const op = isArgminDef(aggregate) ? 'argmin' : 'argmax'; - const argField = aggregate[op]; - meas[argField] = (_b = meas[argField]) !== null && _b !== void 0 ? _b : {}; - meas[argField][op] = new Set([vgField({ op, field: argField }, { forAs: true })]); - } - else { - meas[field] = (_c = meas[field]) !== null && _c !== void 0 ? _c : {}; - meas[field][aggregate] = new Set([vgField(fieldDef, { forAs: true })]); - } - // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain - if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') { - meas[field] = (_d = meas[field]) !== null && _d !== void 0 ? _d : {}; - meas[field]['min'] = new Set([vgField({ field, aggregate: 'min' }, { forAs: true })]); - meas[field]['max'] = new Set([vgField({ field, aggregate: 'max' }, { forAs: true })]); - } - } - } - else { - addDimension(dims, channel, fieldDef, model); - } - }); - if (dims.size + keys(meas).length === 0) { - return null; - } - return new AggregateNode(parent, dims, meas); - } - static makeFromTransform(parent, t) { - var _a, _b, _c; - const dims = new Set(); - const meas = {}; - for (const s of t.aggregate) { - const { op, field, as } = s; - if (op) { - if (op === 'count') { - meas['*'] = (_a = meas['*']) !== null && _a !== void 0 ? _a : {}; - meas['*']['count'] = new Set([as ? as : vgField(s, { forAs: true })]); - } - else { - meas[field] = (_b = meas[field]) !== null && _b !== void 0 ? _b : {}; - meas[field][op] = new Set([as ? as : vgField(s, { forAs: true })]); - } - } - } - for (const s of (_c = t.groupby) !== null && _c !== void 0 ? _c : []) { - dims.add(s); - } - if (dims.size + keys(meas).length === 0) { - return null; - } - return new AggregateNode(parent, dims, meas); - } - merge(other) { - if (setEqual(this.dimensions, other.dimensions)) { - mergeMeasures(this.measures, other.measures); - return true; - } - else { - debug('different dimensions, cannot merge'); - return false; - } - } - addDimensions(fields) { - fields.forEach(this.dimensions.add, this.dimensions); - } - dependentFields() { - return new Set([...this.dimensions, ...keys(this.measures)]); - } - producedFields() { - const out = new Set(); - for (const field of keys(this.measures)) { - for (const op of keys(this.measures[field])) { - const m = this.measures[field][op]; - if (m.size === 0) { - out.add(`${op}_${field}`); - } - else { - m.forEach(out.add, out); - } - } - } - return out; - } - hash() { - return `Aggregate ${hash({ dimensions: this.dimensions, measures: this.measures })}`; - } - assemble() { - const ops = []; - const fields = []; - const as = []; - for (const field of keys(this.measures)) { - for (const op of keys(this.measures[field])) { - for (const alias of this.measures[field][op]) { - as.push(alias); - ops.push(op); - fields.push(field === '*' ? null : replacePathInField(field)); - } - } - } - const result = { - type: 'aggregate', - groupby: [...this.dimensions].map(replacePathInField), - ops, - fields, - as - }; - return result; - } - } - - /** - * A node that helps us track what fields we are faceting by. - */ - class FacetNode extends DataFlowNode { - /** - * @param model The facet model. - * @param name The name that this facet source will have. - * @param data The source data for this facet data. - */ - constructor(parent, model, name, data) { - super(parent); - this.model = model; - this.name = name; - this.data = data; - for (const channel of FACET_CHANNELS) { - const fieldDef = model.facet[channel]; - if (fieldDef) { - const { bin, sort } = fieldDef; - this[channel] = Object.assign({ name: model.getName(`${channel}_domain`), fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, { binSuffix: 'end' })] : [])] }, (isSortField(sort) - ? { sortField: sort } - : isArray(sort) - ? { sortIndexField: sortArrayIndexField(fieldDef, channel) } - : {})); - } - } - this.childModel = model.child; - } - hash() { - let out = `Facet`; - for (const channel of FACET_CHANNELS) { - if (this[channel]) { - out += ` ${channel.charAt(0)}:${hash(this[channel])}`; - } - } - return out; - } - get fields() { - var _a; - const f = []; - for (const channel of FACET_CHANNELS) { - if ((_a = this[channel]) === null || _a === void 0 ? void 0 : _a.fields) { - f.push(...this[channel].fields); - } - } - return f; - } - dependentFields() { - const depFields = new Set(this.fields); - for (const channel of FACET_CHANNELS) { - if (this[channel]) { - if (this[channel].sortField) { - depFields.add(this[channel].sortField.field); - } - if (this[channel].sortIndexField) { - depFields.add(this[channel].sortIndexField); - } - } - } - return depFields; - } - producedFields() { - return new Set(); // facet does not produce any new fields - } - /** - * The name to reference this source is its name. - */ - getSource() { - return this.name; - } - getChildIndependentFieldsWithStep() { - const childIndependentFieldsWithStep = {}; - for (const channel of POSITION_SCALE_CHANNELS) { - const childScaleComponent = this.childModel.component.scales[channel]; - if (childScaleComponent && !childScaleComponent.merged) { - // independent scale - const type = childScaleComponent.get('type'); - const range = childScaleComponent.get('range'); - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const domain = assembleDomain(this.childModel, channel); - const field = getFieldFromDomain(domain); - if (field) { - childIndependentFieldsWithStep[channel] = field; - } - else { - warn(unknownField(channel)); - } - } - } - } - return childIndependentFieldsWithStep; - } - assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep) { - const childChannel = { row: 'y', column: 'x' }[channel]; - const fields = []; - const ops = []; - const as = []; - if (childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) { - if (crossedDataName) { - // If there is a crossed data, calculate max - fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); - ops.push('max'); - } - else { - // If there is no crossed data, just calculate distinct - fields.push(childIndependentFieldsWithStep[childChannel]); - ops.push('distinct'); - } - // Although it is technically a max, just name it distinct so it's easier to refer to it - as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); - } - const { sortField, sortIndexField } = this[channel]; - if (sortField) { - const { op = DEFAULT_SORT_OP, field } = sortField; - fields.push(field); - ops.push(op); - as.push(vgField(sortField, { forAs: true })); - } - else if (sortIndexField) { - fields.push(sortIndexField); - ops.push('max'); - as.push(sortIndexField); - } - return { - name: this[channel].name, - // Use data from the crossed one if it exist - source: crossedDataName !== null && crossedDataName !== void 0 ? crossedDataName : this.data, - transform: [ - Object.assign({ type: 'aggregate', groupby: this[channel].fields }, (fields.length - ? { - fields, - ops, - as - } - : {})) - ] - }; - } - assembleFacetHeaderData(childIndependentFieldsWithStep) { - var _a, _b; - const { columns } = this.model.layout; - const { layoutHeaders } = this.model.component; - const data = []; - const hasSharedAxis = {}; - for (const headerChannel of HEADER_CHANNELS) { - for (const headerType of HEADER_TYPES) { - const headers = (_a = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType])) !== null && _a !== void 0 ? _a : []; - for (const header of headers) { - if (((_b = header.axes) === null || _b === void 0 ? void 0 : _b.length) > 0) { - hasSharedAxis[headerChannel] = true; - break; - } - } - } - if (hasSharedAxis[headerChannel]) { - const cardinality = `length(data("${this.facet.name}"))`; - const stop = headerChannel === 'row' - ? columns - ? { signal: `ceil(${cardinality} / ${columns})` } - : 1 - : columns - ? { signal: `min(${cardinality}, ${columns})` } - : { signal: cardinality }; - data.push({ - name: `${this.facet.name}_${headerChannel}`, - transform: [ - { - type: 'sequence', - start: 0, - stop - } - ] - }); - } - } - const { row, column } = hasSharedAxis; - if (row || column) { - data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep)); - } - return data; - } - assemble() { - var _a, _b; - const data = []; - let crossedDataName = null; - const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep(); - const { column, row, facet } = this; - if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) { - // Need to create a cross dataset to correctly calculate cardinality - crossedDataName = `cross_${this.column.name}_${this.row.name}`; - const fields = [].concat((_a = childIndependentFieldsWithStep.x) !== null && _a !== void 0 ? _a : [], (_b = childIndependentFieldsWithStep.y) !== null && _b !== void 0 ? _b : []); - const ops = fields.map(() => 'distinct'); - data.push({ - name: crossedDataName, - source: this.data, - transform: [ - { - type: 'aggregate', - groupby: this.fields, - fields, - ops - } - ] - }); - } - for (const channel of [COLUMN, ROW]) { - if (this[channel]) { - data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep)); - } - } - if (facet) { - const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep); - if (facetData) { - data.push(...facetData); - } - } - return data; - } - } - - /** - * Remove quotes from a string. - */ - function unquote(pattern) { - if ((pattern[0] === "'" && pattern[pattern.length - 1] === "'") || - (pattern[0] === '"' && pattern[pattern.length - 1] === '"')) { - return pattern.slice(1, -1); - } - return pattern; - } - /** - * @param field The field. - * @param parse What to parse the field as. - */ - function parseExpression$1(field, parse) { - const f = accessPathWithDatum(field); - if (parse === 'number') { - return `toNumber(${f})`; - } - else if (parse === 'boolean') { - return `toBoolean(${f})`; - } - else if (parse === 'string') { - return `toString(${f})`; - } - else if (parse === 'date') { - return `toDate(${f})`; - } - else if (parse === 'flatten') { - return f; - } - else if (parse.indexOf('date:') === 0) { - const specifier = unquote(parse.slice(5, parse.length)); - return `timeParse(${f},'${specifier}')`; - } - else if (parse.indexOf('utc:') === 0) { - const specifier = unquote(parse.slice(4, parse.length)); - return `utcParse(${f},'${specifier}')`; - } - else { - warn(unrecognizedParse(parse)); - return null; - } - } - function getImplicitFromFilterTransform(transform) { - const implicit = {}; - forEachLeaf(transform.filter, filter => { - var _a; - if (isFieldPredicate(filter)) { - // Automatically add a parse node for filters with filter objects - let val = null; - // For EqualFilter, just use the equal property. - // For RangeFilter and OneOfFilter, all array members should have - // the same type, so we only use the first one. - if (isFieldEqualPredicate(filter)) { - val = filter.equal; - } - else if (isFieldRangePredicate(filter)) { - val = filter.range[0]; - } - else if (isFieldOneOfPredicate(filter)) { - val = ((_a = filter.oneOf) !== null && _a !== void 0 ? _a : filter['in'])[0]; - } // else -- for filter expression, we can't infer anything - if (val) { - if (isDateTime(val)) { - implicit[filter.field] = 'date'; - } - else if (isNumber(val)) { - implicit[filter.field] = 'number'; - } - else if (isString(val)) { - implicit[filter.field] = 'string'; - } - } - if (filter.timeUnit) { - implicit[filter.field] = 'date'; - } - } - }); - return implicit; - } - /** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ - function getImplicitFromEncoding(model) { - const implicit = {}; - function add(fieldDef) { - if (isFieldOrDatumDefForTimeFormat(fieldDef)) { - implicit[fieldDef.field] = 'date'; - } - else if (fieldDef.type === 'quantitative' && - isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max - ) { - implicit[fieldDef.field] = 'number'; - } - else if (accessPathDepth(fieldDef.field) > 1) { - // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field. - // (Parsing numbers / dates already flattens numeric and temporal fields.) - if (!(fieldDef.field in implicit)) { - implicit[fieldDef.field] = 'flatten'; - } - } - else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) { - // Flatten fields that we sort by but that are not otherwise flattened. - if (!(fieldDef.sort.field in implicit)) { - implicit[fieldDef.sort.field] = 'flatten'; - } - } - } - if (isUnitModel(model) || isFacetModel(model)) { - // Parse encoded fields - model.forEachFieldDef((fieldDef, channel) => { - if (isTypedFieldDef(fieldDef)) { - add(fieldDef); - } - else { - const mainChannel = getMainRangeChannel(channel); - const mainFieldDef = model.fieldDef(mainChannel); - add(Object.assign(Object.assign({}, fieldDef), { type: mainFieldDef.type })); - } - }); - } - // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly. - if (isUnitModel(model)) { - const { mark, markDef, encoding } = model; - if (isPathMark(mark) && - // No need to sort by dimension if we have a connected scatterplot (order channel is present) - !model.encoding.order) { - const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; - const dimensionChannelDef = encoding[dimensionChannel]; - if (isFieldDef(dimensionChannelDef) && - dimensionChannelDef.type === 'quantitative' && - !(dimensionChannelDef.field in implicit)) { - implicit[dimensionChannelDef.field] = 'number'; - } - } - } - return implicit; - } - /** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ - function getImplicitFromSelection(model) { - const implicit = {}; - if (isUnitModel(model) && model.component.selection) { - for (const name of keys(model.component.selection)) { - const selCmpt = model.component.selection[name]; - for (const proj of selCmpt.project.items) { - if (!proj.channel && accessPathDepth(proj.field) > 1) { - implicit[proj.field] = 'flatten'; - } - } - } - } - return implicit; - } - class ParseNode extends DataFlowNode { - constructor(parent, parse) { - super(parent); - this._parse = parse; - } - clone() { - return new ParseNode(null, duplicate(this._parse)); - } - hash() { - return `Parse ${hash(this._parse)}`; - } - /** - * Creates a parse node from a data.format.parse and updates ancestorParse. - */ - static makeExplicit(parent, model, ancestorParse) { - // Custom parse - let explicit = {}; - const data = model.data; - if (!isGenerator(data) && data && data.format && data.format.parse) { - explicit = data.format.parse; - } - return this.makeWithAncestors(parent, explicit, {}, ancestorParse); - } - /** - * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse. - */ - static makeWithAncestors(parent, explicit, implicit, ancestorParse) { - // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as "derived"). We also don't need to flatten a field that has already been parsed. - for (const field of keys(implicit)) { - const parsedAs = ancestorParse.getWithExplicit(field); - if (parsedAs.value !== undefined) { - // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types. - if (parsedAs.explicit || - parsedAs.value === implicit[field] || - parsedAs.value === 'derived' || - implicit[field] === 'flatten') { - delete implicit[field]; - } - else { - warn(differentParse(field, implicit[field], parsedAs.value)); - } - } - } - for (const field of keys(explicit)) { - const parsedAs = ancestorParse.get(field); - if (parsedAs !== undefined) { - // Don't parse a field again if it has been parsed with the same type already. - if (parsedAs === explicit[field]) { - delete explicit[field]; - } - else { - warn(differentParse(field, explicit[field], parsedAs)); - } - } - } - const parse = new Split(explicit, implicit); - // add the format parse from this model so that children don't parse the same field again - ancestorParse.copyAll(parse); - // copy only non-null parses - const p = {}; - for (const key of keys(parse.combine())) { - const val = parse.get(key); - if (val !== null) { - p[key] = val; - } - } - if (keys(p).length === 0 || ancestorParse.parseNothing) { - return null; - } - return new ParseNode(parent, p); - } - get parse() { - return this._parse; - } - merge(other) { - this._parse = Object.assign(Object.assign({}, this._parse), other.parse); - other.remove(); - } - /** - * Assemble an object for Vega's format.parse property. - */ - assembleFormatParse() { - const formatParse = {}; - for (const field of keys(this._parse)) { - const p = this._parse[field]; - if (accessPathDepth(field) === 1) { - formatParse[field] = p; - } - } - return formatParse; - } - // format parse depends and produces all fields in its parse - producedFields() { - return new Set(keys(this._parse)); - } - dependentFields() { - return new Set(keys(this._parse)); - } - assembleTransforms(onlyNested = false) { - return keys(this._parse) - .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true)) - .map(field => { - const expr = parseExpression$1(field, this._parse[field]); - if (!expr) { - return null; - } - const formula = { - type: 'formula', - expr, - as: removePathFromField(field) // Vega output is always flattened - }; - return formula; - }) - .filter(t => t !== null); - } - } - - class IdentifierNode extends DataFlowNode { - clone() { - return new IdentifierNode(null); - } - constructor(parent) { - super(parent); - } - dependentFields() { - return new Set(); - } - producedFields() { - return new Set([SELECTION_ID]); - } - hash() { - return 'Identifier'; - } - assemble() { - return { type: 'identifier', as: SELECTION_ID }; - } - } - - /** - * A class for the join aggregate transform nodes. - */ - class JoinAggregateTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new JoinAggregateTransformNode(null, duplicate(this.transform)); - } - addDimensions(fields) { - this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); - } - dependentFields() { - const out = new Set(); - if (this.transform.groupby) { - this.transform.groupby.forEach(out.add, out); - } - this.transform.joinaggregate - .map(w => w.field) - .filter(f => f !== undefined) - .forEach(out.add, out); - return out; - } - producedFields() { - return new Set(this.transform.joinaggregate.map(this.getDefaultName)); - } - getDefaultName(joinAggregateFieldDef) { - var _a; - return (_a = joinAggregateFieldDef.as) !== null && _a !== void 0 ? _a : vgField(joinAggregateFieldDef); - } - hash() { - return `JoinAggregateTransform ${hash(this.transform)}`; - } - assemble() { - const fields = []; - const ops = []; - const as = []; - for (const joinaggregate of this.transform.joinaggregate) { - ops.push(joinaggregate.op); - as.push(this.getDefaultName(joinaggregate)); - fields.push(joinaggregate.field === undefined ? null : joinaggregate.field); - } - const groupby = this.transform.groupby; - return Object.assign({ type: 'joinaggregate', as, - ops, - fields }, (groupby !== undefined ? { groupby } : {})); - } - } - - function getStackByFields(model) { - return model.stack.stackBy.reduce((fields, by) => { - const fieldDef = by.fieldDef; - const _field = vgField(fieldDef); - if (_field) { - fields.push(_field); - } - return fields; - }, []); - } - function isValidAsArray(as) { - return isArray(as) && as.every(s => isString(s)) && as.length > 1; - } - class StackNode extends DataFlowNode { - constructor(parent, stack) { - super(parent); - this._stack = stack; - } - clone() { - return new StackNode(null, duplicate(this._stack)); - } - static makeFromTransform(parent, stackTransform) { - const { stack, groupby, as, offset = 'zero' } = stackTransform; - const sortFields = []; - const sortOrder = []; - if (stackTransform.sort !== undefined) { - for (const sortField of stackTransform.sort) { - sortFields.push(sortField.field); - sortOrder.push(getFirstDefined(sortField.order, 'ascending')); - } - } - const sort = { - field: sortFields, - order: sortOrder - }; - let normalizedAs; - if (isValidAsArray(as)) { - normalizedAs = as; - } - else if (isString(as)) { - normalizedAs = [as, as + '_end']; - } - else { - normalizedAs = [stackTransform.stack + '_start', stackTransform.stack + '_end']; - } - return new StackNode(parent, { - stackField: stack, - groupby, - offset, - sort, - facetby: [], - as: normalizedAs - }); - } - static makeFromEncoding(parent, model) { - const stackProperties = model.stack; - const { encoding } = model; - if (!stackProperties) { - return null; - } - const { groupbyChannel, fieldChannel, offset, impute } = stackProperties; - let dimensionFieldDef; - if (groupbyChannel) { - const cDef = encoding[groupbyChannel]; - dimensionFieldDef = getFieldDef(cDef); // Fair to cast as groupByChannel is always either x or y - } - const stackby = getStackByFields(model); - const orderDef = model.encoding.order; - let sort; - if (isArray(orderDef) || isFieldDef(orderDef)) { - sort = sortParams(orderDef); - } - else { - // default = descending by stackFields - // FIXME is the default here correct for binned fields? - sort = stackby.reduce((s, field) => { - s.field.push(field); - s.order.push(fieldChannel === 'y' ? 'descending' : 'ascending'); - return s; - }, { field: [], order: [] }); - } - return new StackNode(parent, { - dimensionFieldDef, - stackField: model.vgField(fieldChannel), - facetby: [], - stackby, - sort, - offset, - impute, - as: [ - model.vgField(fieldChannel, { suffix: 'start', forAs: true }), - model.vgField(fieldChannel, { suffix: 'end', forAs: true }) - ] - }); - } - get stack() { - return this._stack; - } - addDimensions(fields) { - this._stack.facetby.push(...fields); - } - dependentFields() { - const out = new Set(); - out.add(this._stack.stackField); - this.getGroupbyFields().forEach(out.add, out); - this._stack.facetby.forEach(out.add, out); - this._stack.sort.field.forEach(out.add, out); - return out; - } - producedFields() { - return new Set(this._stack.as); - } - hash() { - return `Stack ${hash(this._stack)}`; - } - getGroupbyFields() { - const { dimensionFieldDef, impute, groupby } = this._stack; - if (dimensionFieldDef) { - if (dimensionFieldDef.bin) { - if (impute) { - // For binned group by field with impute, we calculate bin_mid - // as we cannot impute two fields simultaneously - return [vgField(dimensionFieldDef, { binSuffix: 'mid' })]; - } - return [ - // For binned group by field without impute, we need both bin (start) and bin_end - vgField(dimensionFieldDef, {}), - vgField(dimensionFieldDef, { binSuffix: 'end' }) - ]; - } - return [vgField(dimensionFieldDef)]; - } - return groupby !== null && groupby !== void 0 ? groupby : []; - } - assemble() { - const transform = []; - const { facetby, dimensionFieldDef, stackField: field, stackby, sort, offset, impute, as } = this._stack; - // Impute - if (impute && dimensionFieldDef) { - const { band = 0.5, bin } = dimensionFieldDef; - if (bin) { - // As we can only impute one field at a time, we need to calculate - // mid point for a binned field - transform.push({ - type: 'formula', - expr: `${band}*` + - vgField(dimensionFieldDef, { expr: 'datum' }) + - `+${1 - band}*` + - vgField(dimensionFieldDef, { expr: 'datum', binSuffix: 'end' }), - as: vgField(dimensionFieldDef, { binSuffix: 'mid', forAs: true }) - }); - } - transform.push({ - type: 'impute', - field, - groupby: [...stackby, ...facetby], - key: vgField(dimensionFieldDef, { binSuffix: 'mid' }), - method: 'value', - value: 0 - }); - } - // Stack - transform.push({ - type: 'stack', - groupby: [...this.getGroupbyFields(), ...facetby], - field, - sort, - as, - offset - }); - return transform; - } - } - - /** - * A class for the window transform nodes - */ - class WindowTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new WindowTransformNode(null, duplicate(this.transform)); - } - addDimensions(fields) { - this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); - } - dependentFields() { - var _a, _b; - const out = new Set(); - ((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []).forEach(out.add, out); - ((_b = this.transform.sort) !== null && _b !== void 0 ? _b : []).forEach(m => out.add(m.field)); - this.transform.window - .map(w => w.field) - .filter(f => f !== undefined) - .forEach(out.add, out); - return out; - } - producedFields() { - return new Set(this.transform.window.map(this.getDefaultName)); - } - getDefaultName(windowFieldDef) { - var _a; - return (_a = windowFieldDef.as) !== null && _a !== void 0 ? _a : vgField(windowFieldDef); - } - hash() { - return `WindowTransform ${hash(this.transform)}`; - } - assemble() { - var _a; - const fields = []; - const ops = []; - const as = []; - const params = []; - for (const window of this.transform.window) { - ops.push(window.op); - as.push(this.getDefaultName(window)); - params.push(window.param === undefined ? null : window.param); - fields.push(window.field === undefined ? null : window.field); - } - const frame = this.transform.frame; - const groupby = this.transform.groupby; - if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) { - // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate - return Object.assign({ type: 'joinaggregate', as, ops: ops, fields }, (groupby !== undefined ? { groupby } : {})); - } - const sortFields = []; - const sortOrder = []; - if (this.transform.sort !== undefined) { - for (const sortField of this.transform.sort) { - sortFields.push(sortField.field); - sortOrder.push((_a = sortField.order) !== null && _a !== void 0 ? _a : 'ascending'); - } - } - const sort = { - field: sortFields, - order: sortOrder - }; - const ignorePeers = this.transform.ignorePeers; - return Object.assign(Object.assign(Object.assign({ type: 'window', params, - as, - ops, - fields, - sort }, (ignorePeers !== undefined ? { ignorePeers } : {})), (groupby !== undefined ? { groupby } : {})), (frame !== undefined ? { frame } : {})); - } - } - - /** - * Move parse nodes up to forks. - */ - class MoveParseUp extends BottomUpOptimizer { - run(node) { - const parent = node.parent; - // Move parse up by merging or swapping. - if (node instanceof ParseNode) { - if (isDataSourceNode(parent)) { - return this.flags; - } - if (parent.numChildren() > 1) { - // Don't move parse further up but continue with parent. - this.setContinue(); - return this.flags; - } - if (parent instanceof ParseNode) { - this.setMutated(); - parent.merge(node); - } - else { - // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup). - if (fieldIntersection(parent.producedFields(), node.dependentFields())) { - this.setContinue(); - return this.flags; - } - this.setMutated(); - node.swapWithParent(); - } - } - this.setContinue(); - return this.flags; - } - } - /** - * Merge identical nodes at forks by comparing hashes. - * - * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler. - */ - class MergeIdenticalNodes extends TopDownOptimizer { - mergeNodes(parent, nodes) { - const mergedNode = nodes.shift(); - for (const node of nodes) { - parent.removeChild(node); - node.parent = mergedNode; - node.remove(); - } - } - run(node) { - const hashes = node.children.map(x => x.hash()); - const buckets = {}; - for (let i = 0; i < hashes.length; i++) { - if (buckets[hashes[i]] === undefined) { - buckets[hashes[i]] = [node.children[i]]; - } - else { - buckets[hashes[i]].push(node.children[i]); - } - } - for (const k of keys(buckets)) { - if (buckets[k].length > 1) { - this.setMutated(); - this.mergeNodes(node, buckets[k]); - } - } - for (const child of node.children) { - this.run(child); - } - return this.mutatedFlag; - } - } - /** - * Repeatedly remove leaf nodes that are not output or facet nodes. - * The reason is that we don't need subtrees that don't have any output nodes. - * Facet nodes are needed for the row or column domains. - */ - class RemoveUnusedSubtrees extends BottomUpOptimizer { - run(node) { - if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) { - // no need to continue with parent because it is output node or will have children (there was a fork) - return this.flags; - } - else { - this.setMutated(); - node.remove(); - } - return this.flags; - } - } - /** - * Removes duplicate time unit nodes (as determined by the name of the - * output field) that may be generated due to selections projected over - * time units. - * - * TODO: Try to make this a top down optimizer that keeps only the first - * insance of a time unit node. - * TODO: Try to make a generic version of this that only keeps one node per hash. - */ - class RemoveDuplicateTimeUnits extends BottomUpOptimizer { - constructor() { - super(...arguments); - this.fields = new Set(); - this.prev = null; - } - run(node) { - this.setContinue(); - if (node instanceof TimeUnitNode) { - const pfields = node.producedFields(); - if (hasIntersection(pfields, this.fields)) { - this.setMutated(); - this.prev.remove(); - } - else { - this.fields = new Set([...this.fields, ...pfields]); - } - this.prev = node; - } - return this.flags; - } - reset() { - this.fields.clear(); - } - } - /** - * Merge adjacent time unit nodes. - */ - class MergeTimeUnits extends BottomUpOptimizer { - run(node) { - this.setContinue(); - const parent = node.parent; - const timeUnitChildren = parent.children.filter(x => x instanceof TimeUnitNode); - const combination = timeUnitChildren.pop(); - for (const timeUnit of timeUnitChildren) { - this.setMutated(); - combination.merge(timeUnit); - } - return this.flags; - } - } - /** - * Clones the subtree and ignores output nodes except for the leaves, which are renamed. - */ - function cloneSubtree(facet) { - function clone(node) { - if (!(node instanceof FacetNode)) { - const copy = node.clone(); - if (copy instanceof OutputNode) { - const newName = FACET_SCALE_PREFIX + copy.getSource(); - copy.setSource(newName); - facet.model.component.data.outputNodes[newName] = copy; - } - else if (copy instanceof AggregateNode || - copy instanceof StackNode || - copy instanceof WindowTransformNode || - copy instanceof JoinAggregateTransformNode) { - copy.addDimensions(facet.fields); - } - for (const n of node.children.flatMap(clone)) { - n.parent = copy; - } - return [copy]; - } - return node.children.flatMap(clone); - } - return clone; - } - /** - * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node. - * After moving down the facet node, make a copy of the subtree and make it a child of the main output. - */ - function moveFacetDown(node) { - if (node instanceof FacetNode) { - if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) { - // move down until we hit a fork or output node - const child = node.children[0]; - if (child instanceof AggregateNode || - child instanceof StackNode || - child instanceof WindowTransformNode || - child instanceof JoinAggregateTransformNode) { - child.addDimensions(node.fields); - } - child.swapWithParent(); - moveFacetDown(node); - } - else { - // move main to facet - const facetMain = node.model.component.data.main; - moveMainDownToFacet(facetMain); - // replicate the subtree and place it before the facet's main node - const cloner = cloneSubtree(node); - const copy = node.children.map(cloner).flat(); - for (const c of copy) { - c.parent = facetMain; - } - } - } - else { - node.children.map(moveFacetDown); - } - } - function moveMainDownToFacet(node) { - if (node instanceof OutputNode && node.type === DataSourceType.Main) { - if (node.numChildren() === 1) { - const child = node.children[0]; - if (!(child instanceof FacetNode)) { - child.swapWithParent(); - moveMainDownToFacet(node); - } - } - } - } - /** - * Remove output nodes that are not required. Starting from a root. - */ - class RemoveUnnecessaryOutputNodes extends TopDownOptimizer { - constructor() { - super(); - } - run(node) { - if (node instanceof OutputNode && !node.isRequired()) { - this.setMutated(); - node.remove(); - } - for (const child of node.children) { - this.run(child); - } - return this.mutatedFlag; - } - } - class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer { - constructor(model) { - super(); - this.requiresSelectionId = model && requiresSelectionId(model); - } - run(node) { - if (node instanceof IdentifierNode) { - // Only preserve IdentifierNodes if we have default discrete selections - // in our model tree, and if the nodes come after tuple producing nodes. - if (!(this.requiresSelectionId && - (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode))) { - this.setMutated(); - node.remove(); - } - } - for (const child of node.children) { - this.run(child); - } - return this.mutatedFlag; - } - } - /** - * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes. - * - * We assume that dependent paths that do not have a parse node can be just merged. - */ - class MergeParse extends BottomUpOptimizer { - run(node) { - const parent = node.parent; - const originalChildren = [...parent.children]; - const parseChildren = parent.children.filter((child) => child instanceof ParseNode); - if (parent.numChildren() > 1 && parseChildren.length >= 1) { - const commonParse = {}; - const conflictingParse = new Set(); - for (const parseNode of parseChildren) { - const parse = parseNode.parse; - for (const k of keys(parse)) { - if (!(k in commonParse)) { - commonParse[k] = parse[k]; - } - else if (commonParse[k] !== parse[k]) { - conflictingParse.add(k); - } - } - } - for (const field of conflictingParse) { - delete commonParse[field]; - } - if (!isEmpty(commonParse)) { - this.setMutated(); - const mergedParseNode = new ParseNode(parent, commonParse); - for (const childNode of originalChildren) { - if (childNode instanceof ParseNode) { - for (const key of keys(commonParse)) { - delete childNode.parse[key]; - } - } - parent.removeChild(childNode); - childNode.parent = mergedParseNode; - // remove empty parse nodes - if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) { - childNode.remove(); - } - } - } - } - this.setContinue(); - return this.flags; - } - } - class MergeAggregates extends BottomUpOptimizer { - run(node) { - const parent = node.parent; - const aggChildren = parent.children.filter((child) => child instanceof AggregateNode); - // Object which we'll use to map the fields which an aggregate is grouped by to - // the set of aggregates with that grouping. This is useful as only aggregates - // with the same group by can be merged - const groupedAggregates = {}; - // Build groupedAggregates - for (const agg of aggChildren) { - const groupBys = hash(agg.groupBy); - if (!(groupBys in groupedAggregates)) { - groupedAggregates[groupBys] = []; - } - groupedAggregates[groupBys].push(agg); - } - // Merge aggregateNodes with same key in groupedAggregates - for (const group of keys(groupedAggregates)) { - const mergeableAggs = groupedAggregates[group]; - if (mergeableAggs.length > 1) { - const mergedAggs = mergeableAggs.pop(); - for (const agg of mergeableAggs) { - if (mergedAggs.merge(agg)) { - parent.removeChild(agg); - agg.parent = mergedAggs; - agg.remove(); - this.setMutated(); - } - } - } - } - this.setContinue(); - return this.flags; - } - } - /** - * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node. - */ - class MergeBins extends BottomUpOptimizer { - constructor(model) { - super(); - this.model = model; - } - run(node) { - const parent = node.parent; - const moveBinsUp = !(isDataSourceNode(parent) || - parent instanceof FilterNode || - parent instanceof ParseNode || - parent instanceof IdentifierNode); - const promotableBins = []; - const remainingBins = []; - for (const child of parent.children) { - if (child instanceof BinNode) { - if (moveBinsUp && !fieldIntersection(parent.producedFields(), child.dependentFields())) { - promotableBins.push(child); - } - else { - remainingBins.push(child); - } - } - } - if (promotableBins.length > 0) { - const promotedBin = promotableBins.pop(); - for (const bin of promotableBins) { - promotedBin.merge(bin, this.model.renameSignal.bind(this.model)); - } - this.setMutated(); - if (parent instanceof BinNode) { - parent.merge(promotedBin, this.model.renameSignal.bind(this.model)); - } - else { - promotedBin.swapWithParent(); - } - } - if (remainingBins.length > 1) { - const remainingBin = remainingBins.pop(); - for (const bin of remainingBins) { - remainingBin.merge(bin, this.model.renameSignal.bind(this.model)); - } - this.setMutated(); - } - this.setContinue(); - return this.flags; - } - } - /** - * This optimizer takes output nodes that are at a fork and moves them before the fork. - * - * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes. - * It then moves all output nodes before that main output node. All other children (and the children of the output nodes) - * are inserted after the main output node. - */ - class MergeOutputs extends BottomUpOptimizer { - run(node) { - const parent = node.parent; - const children = [...parent.children]; - const hasOutputChild = some(children, child => child instanceof OutputNode); - if (!hasOutputChild || parent.numChildren() <= 1) { - this.setContinue(); - return this.flags; - } - const otherChildren = []; - // The output node we will connect all other nodes to. - // Output nodes will be added before the new node, other nodes after. - let mainOutput; - for (const child of children) { - if (child instanceof OutputNode) { - let lastOutput = child; - while (lastOutput.numChildren() === 1) { - const [theChild] = lastOutput.children; - if (theChild instanceof OutputNode) { - lastOutput = theChild; - } - else { - break; - } - } - otherChildren.push(...lastOutput.children); - if (mainOutput) { - // Move the output nodes before the mainOutput. We do this by setting - // the parent of the first not to the parent of the main output and - // the main output's parent to the last output. - // note: the child is the first output - parent.removeChild(child); - child.parent = mainOutput.parent; - mainOutput.parent.removeChild(mainOutput); - mainOutput.parent = lastOutput; - this.setMutated(); - } - else { - mainOutput = lastOutput; - } - } - else { - otherChildren.push(child); - } - } - if (otherChildren.length) { - this.setMutated(); - for (const child of otherChildren) { - child.parent.removeChild(child); - child.parent = mainOutput; - } - } - this.setContinue(); - return this.flags; - } - } - - const FACET_SCALE_PREFIX = 'scale_'; - const MAX_OPTIMIZATION_RUNS = 5; - /** - * Iterates over a dataflow graph and checks whether all links are consistent. - */ - function checkLinks(nodes) { - for (const node of nodes) { - for (const child of node.children) { - if (child.parent !== node) { - // log.error('Dataflow graph is inconsistent.', node, child); - return false; - } - } - if (!checkLinks(node.children)) { - return false; - } - } - return true; - } - /** - * Return all leaf nodes. - */ - function getLeaves(roots) { - const leaves = []; - function append(node) { - if (node.numChildren() === 0) { - leaves.push(node); - } - else { - for (const child of node.children) { - append(child); - } - } - } - for (const child of roots) { - append(child); - } - return leaves; - } - function isTrue(x) { - return x; - } - /** - * Run the specified optimizer on the provided nodes. - * - * @param optimizer The optimizer instance to run. - * @param nodes A set of nodes to optimize. - * @param flag Flag that will be or'ed with return valued from optimization calls to the nodes. - */ - function runOptimizer(optimizer, nodes) { - const flags = nodes.map(node => { - if (optimizer instanceof BottomUpOptimizer) { - const runFlags = optimizer.optimizeNextFromLeaves(node); - optimizer.reset(); - return runFlags; - } - else { - return optimizer.run(node); - } - }); - return flags.some(isTrue); - } - function optimizationDataflowHelper(dataComponent, model, firstPass) { - let roots = dataComponent.sources; - const mutatedFlags = new Set(); - mutatedFlags.add(runOptimizer(new RemoveUnnecessaryOutputNodes(), roots)); - mutatedFlags.add(runOptimizer(new RemoveUnnecessaryIdentifierNodes(model), roots)); - // remove source nodes that don't have any children because they also don't have output nodes - roots = roots.filter(r => r.numChildren() > 0); - mutatedFlags.add(runOptimizer(new RemoveUnusedSubtrees(), getLeaves(roots))); - roots = roots.filter(r => r.numChildren() > 0); - if (!firstPass) { - // Only run these optimizations after the optimizer has moved down the facet node. - // With this change, we can be more aggressive in the optimizations. - mutatedFlags.add(runOptimizer(new MoveParseUp(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeBins(model), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new RemoveDuplicateTimeUnits(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeParse(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeAggregates(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeTimeUnits(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new MergeIdenticalNodes(), roots)); - mutatedFlags.add(runOptimizer(new MergeOutputs(), getLeaves(roots))); - } - dataComponent.sources = roots; - return mutatedFlags.has(true); - } - /** - * Optimizes the dataflow of the passed in data component. - */ - function optimizeDataflow(data, model) { - // check before optimizations - checkLinks(data.sources); - let firstPassCounter = 0; - let secondPassCounter = 0; - for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { - if (!optimizationDataflowHelper(data, model, true)) { - break; - } - firstPassCounter++; - } - // move facets down and make a copy of the subtree so that we can have scales at the top level - data.sources.map(moveFacetDown); - for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { - if (!optimizationDataflowHelper(data, model, false)) { - break; - } - secondPassCounter++; - } - // check after optimizations - checkLinks(data.sources); - if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) { - warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`); - } - } - - /** - * A class that behaves like a SignalRef but lazily generates the signal. - * The provided generator function should use `Model.getSignalName` to use the correct signal name. - */ - class SignalRefWrapper { - constructor(exprGenerator) { - Object.defineProperty(this, 'signal', { - enumerable: true, - get: exprGenerator - }); - } - static fromName(rename, signalName) { - return new SignalRefWrapper(() => rename(signalName)); - } - } - - function parseScaleDomain(model) { - if (isUnitModel(model)) { - parseUnitScaleDomain(model); - } - else { - parseNonUnitScaleDomain(model); - } - } - function parseUnitScaleDomain(model) { - const localScaleComponents = model.component.scales; - for (const channel of keys(localScaleComponents)) { - const domains = parseDomainForChannel(model, channel); - const localScaleCmpt = localScaleComponents[channel]; - localScaleCmpt.setWithExplicit('domains', domains); - parseSelectionDomain(model, channel); - if (model.component.data.isFaceted) { - // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not - let facetParent = model; - while (!isFacetModel(facetParent) && facetParent.parent) { - facetParent = facetParent.parent; - } - const resolve = facetParent.component.resolve.scale[channel]; - if (resolve === 'shared') { - for (const domain of domains.value) { - // Replace the scale domain with data output from a cloned subtree after the facet. - if (isDataRefDomain(domain)) { - // use data from cloned subtree (which is the same as data but with a prefix added once) - domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, ''); - } - } - } - } - } - } - function parseNonUnitScaleDomain(model) { - for (const child of model.children) { - parseScaleDomain(child); - } - const localScaleComponents = model.component.scales; - for (const channel of keys(localScaleComponents)) { - let domains; - let selectionExtent = null; - for (const child of model.children) { - const childComponent = child.component.scales[channel]; - if (childComponent) { - if (domains === undefined) { - domains = childComponent.getWithExplicit('domains'); - } - else { - domains = mergeValuesWithExplicit(domains, childComponent.getWithExplicit('domains'), 'domains', 'scale', domainsTieBreaker); - } - const se = childComponent.get('selectionExtent'); - if (selectionExtent && se && selectionExtent.selection !== se.selection) { - warn(NEEDS_SAME_SELECTION); - } - selectionExtent = se; - } - } - localScaleComponents[channel].setWithExplicit('domains', domains); - if (selectionExtent) { - localScaleComponents[channel].set('selectionExtent', selectionExtent, true); - } - } - } - /** - * Remove unaggregated domain if it is not applicable - * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true. - */ - function normalizeUnaggregatedDomain(domain, fieldDef, scaleType, scaleConfig) { - if (domain === 'unaggregated') { - const { valid, reason } = canUseUnaggregatedDomain(fieldDef, scaleType); - if (!valid) { - warn(reason); - return undefined; - } - } - else if (domain === undefined && scaleConfig.useUnaggregatedDomain) { - // Apply config if domain is not specified. - const { valid } = canUseUnaggregatedDomain(fieldDef, scaleType); - if (valid) { - return 'unaggregated'; - } - } - return domain; - } - function parseDomainForChannel(model, channel) { - const scaleType = model.getScaleComponent(channel).get('type'); - const { encoding } = model; - const domain = normalizeUnaggregatedDomain(model.scaleDomain(channel), model.typedFieldDef(channel), scaleType, model.config.scale); - if (domain !== model.scaleDomain(channel)) { - model.specifiedScales[channel] = Object.assign(Object.assign({}, model.specifiedScales[channel]), { domain }); - } - // If channel is either X or Y then union them with X2 & Y2 if they exist - if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) { - if (getFieldOrDatumDef(encoding.x)) { - return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'x'), parseSingleChannelDomain(scaleType, domain, model, 'x2'), 'domain', 'scale', domainsTieBreaker); - } - else { - return parseSingleChannelDomain(scaleType, domain, model, 'x2'); - } - } - else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) { - if (getFieldOrDatumDef(encoding.y)) { - return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'y'), parseSingleChannelDomain(scaleType, domain, model, 'y2'), 'domain', 'scale', domainsTieBreaker); - } - else { - return parseSingleChannelDomain(scaleType, domain, model, 'y2'); - } - } - return parseSingleChannelDomain(scaleType, domain, model, channel); - } - function mapDomainToDataSignal(domain, type, timeUnit) { - return domain.map(v => { - const data = valueExpr(v, { timeUnit, type }); - return { signal: `{data: ${data}}` }; - }); - } - function convertDomainIfItIsDateTime(domain, type, timeUnit) { - var _a; - // explicit value - const normalizedTimeUnit = (_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit; - if (type === 'temporal' || normalizedTimeUnit) { - return mapDomainToDataSignal(domain, type, normalizedTimeUnit); - } - return [domain]; // Date time won't make sense - } - function parseSingleChannelDomain(scaleType, domain, model, channel) { - const { encoding } = model; - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - const { type } = fieldOrDatumDef; - const timeUnit = fieldOrDatumDef['timeUnit']; - if (isDomainUnionWith(domain)) { - const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel); - const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit); - return makeExplicit([...defaultDomain.value, ...unionWith]); - } - else if (isSignalRef(domain)) { - return makeExplicit([domain]); - } - else if (domain && domain !== 'unaggregated' && !isSelectionDomain(domain)) { - return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit)); - } - const stack = model.stack; - if (stack && channel === stack.fieldChannel) { - if (stack.offset === 'normalize') { - return makeImplicit([[0, 1]]); - } - const data = model.requestDataName(DataSourceType.Main); - return makeImplicit([ - { - data, - field: model.vgField(channel, { suffix: 'start' }) - }, - { - data, - field: model.vgField(channel, { suffix: 'end' }) - } - ]); - } - const sort = isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined; - if (isDatumDef(fieldOrDatumDef)) { - const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit); - return makeImplicit(d); - } - const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef - if (domain === 'unaggregated') { - const data = model.requestDataName(DataSourceType.Main); - const { field } = fieldOrDatumDef; - return makeImplicit([ - { - data, - field: vgField({ field, aggregate: 'min' }) - }, - { - data, - field: vgField({ field, aggregate: 'max' }) - } - ]); - } - else if (isBinning(fieldDef.bin)) { - if (hasDiscreteDomain(scaleType)) { - if (scaleType === 'bin-ordinal') { - // we can omit the domain as it is inferred from the `bins` property - return makeImplicit([]); - } - // ordinal bin scale takes domain from bin_range, ordered by bin start - // This is useful for both axis-based scale (x/y) and legend-based scale (other channels). - return makeImplicit([ - { - // If sort by aggregation of a specified sort field, we need to use RAW table, - // so we can aggregate values for the scale independently from the main aggregation. - data: isBoolean$1(sort) - ? model.requestDataName(DataSourceType.Main) - : model.requestDataName(DataSourceType.Raw), - // Use range if we added it and the scale does not support computing a range as a signal. - field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? { binSuffix: 'range' } : {}), - // we have to use a sort object if sort = true to make the sort correct by bin start - sort: sort === true || !isObject(sort) - ? { - field: model.vgField(channel, {}), - op: 'min' // min or max doesn't matter since we sort by the start of the bin range - } - : sort - } - ]); - } - else { - // continuous scales - const { bin } = fieldDef; - if (isBinning(bin)) { - const binSignal = getBinSignalName(model, fieldDef.field, bin); - return makeImplicit([ - new SignalRefWrapper(() => { - const signal = model.getSignalName(binSignal); - return `[${signal}.start, ${signal}.stop]`; - }) - ]); - } - else { - return makeImplicit([ - { - data: model.requestDataName(DataSourceType.Main), - field: model.vgField(channel, {}) - } - ]); - } - } - } - else if (fieldDef.timeUnit && - contains(['time', 'utc'], scaleType) && - hasBand(channel, fieldDef, isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined, model.stack, model.markDef, model.config)) { - const data = model.requestDataName(DataSourceType.Main); - return makeImplicit([ - { - data, - field: model.vgField(channel) - }, - { - data, - field: model.vgField(channel, { suffix: 'end' }) - } - ]); - } - else if (sort) { - return makeImplicit([ - { - // If sort by aggregation of a specified sort field, we need to use RAW table, - // so we can aggregate values for the scale independently from the main aggregation. - data: isBoolean$1(sort) - ? model.requestDataName(DataSourceType.Main) - : model.requestDataName(DataSourceType.Raw), - field: model.vgField(channel), - sort: sort - } - ]); - } - else { - return makeImplicit([ - { - data: model.requestDataName(DataSourceType.Main), - field: model.vgField(channel) - } - ]); - } - } - function normalizeSortField(sort, isStackedMeasure) { - const { op, field, order } = sort; - return Object.assign(Object.assign({ - // Apply default op - op: op !== null && op !== void 0 ? op : (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP) }, (field ? { field: replacePathInField(field) } : {})), (order ? { order } : {})); - } - function parseSelectionDomain(model, channel) { - var _a; - const scale = model.component.scales[channel]; - const spec = model.specifiedScales[channel].domain; - const bin = (_a = model.fieldDef(channel)) === null || _a === void 0 ? void 0 : _a.bin; - const domain = isSelectionDomain(spec) && spec; - const extent = isBinParams(bin) && isSelectionExtent(bin.extent) && bin.extent; - if (domain || extent) { - // As scale parsing occurs before selection parsing, we cannot set - // domainRaw directly. So instead, we store the selectionExtent on - // the scale component, and then add domainRaw during scale assembly. - scale.set('selectionExtent', domain !== null && domain !== void 0 ? domain : extent, true); - } - } - function domainSort(model, channel, scaleType) { - if (!hasDiscreteDomain(scaleType)) { - return undefined; - } - // save to cast as the only exception is the geojson type for shape, which would not generate a scale - const fieldDef = model.fieldDef(channel); - const sort = fieldDef.sort; - // if the sort is specified with array, use the derived sort index field - if (isSortArray(sort)) { - return { - op: 'min', - field: sortArrayIndexField(fieldDef, channel), - order: 'ascending' - }; - } - const { stack } = model; - const stackDimensions = stack - ? [...(stack.groupbyField ? [stack.groupbyField] : []), ...stack.stackBy.map(s => s.fieldDef.field)] - : undefined; - // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale) - if (isSortField(sort)) { - const isStackedMeasure = stack && !contains(stackDimensions, sort.field); - return normalizeSortField(sort, isStackedMeasure); - } - else if (isSortByEncoding(sort)) { - const { encoding, order } = sort; - const fieldDefToSortBy = model.fieldDef(encoding); - const { aggregate, field } = fieldDefToSortBy; - const isStackedMeasure = stack && !contains(stackDimensions, field); - if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { - return normalizeSortField({ - field: vgField(fieldDefToSortBy), - order - }, isStackedMeasure); - } - else if (isAggregateOp(aggregate) || !aggregate) { - return normalizeSortField({ - op: aggregate, - field, - order - }, isStackedMeasure); - } - } - else if (sort === 'descending') { - return { - op: 'min', - field: model.vgField(channel), - order: 'descending' - }; - } - else if (contains(['ascending', undefined /* default =ascending*/], sort)) { - return true; - } - // sort == null - return undefined; - } - /** - * Determine if a scale can use unaggregated domain. - * @return {Boolean} Returns true if all of the following conditions apply: - * 1. `scale.domain` is `unaggregated` - * 2. Aggregation function is not `count` or `sum` - * 3. The scale is quantitative or time scale. - */ - function canUseUnaggregatedDomain(fieldDef, scaleType) { - const { aggregate, type } = fieldDef; - if (!aggregate) { - return { - valid: false, - reason: unaggregateDomainHasNoEffectForRawField(fieldDef) - }; - } - if (isString(aggregate) && !SHARED_DOMAIN_OP_INDEX[aggregate]) { - return { - valid: false, - reason: unaggregateDomainWithNonSharedDomainOp(aggregate) - }; - } - if (type === 'quantitative') { - if (scaleType === 'log') { - return { - valid: false, - reason: unaggregatedDomainWithLogScale(fieldDef) - }; - } - } - return { valid: true }; - } - /** - * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values. - */ - function domainsTieBreaker(v1, v2, property, propertyOf) { - if (v1.explicit && v2.explicit) { - warn(mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value)); - } - // If equal score, concat the domains so that we union them later. - return { explicit: v1.explicit, value: [...v1.value, ...v2.value] }; - } - /** - * Converts an array of domains to a single Vega scale domain. - */ - function mergeDomains(domains) { - const uniqueDomains = unique(domains.map(domain => { - // ignore sort property when computing the unique domains - if (isDataRefDomain(domain)) { - const domainWithoutSort = __rest(domain, ["sort"]); - return domainWithoutSort; - } - return domain; - }), hash); - const sorts = unique(domains - .map(d => { - if (isDataRefDomain(d)) { - const s = d.sort; - if (s !== undefined && !isBoolean$1(s)) { - if ('op' in s && s.op === 'count') { - // let's make sure that if op is count, we don't use a field - delete s.field; - } - if (s.order === 'ascending') { - // drop order: ascending as it is the default - delete s.order; - } - } - return s; - } - return undefined; - }) - .filter(s => s !== undefined), hash); - if (uniqueDomains.length === 0) { - return undefined; - } - else if (uniqueDomains.length === 1) { - const domain = domains[0]; - if (isDataRefDomain(domain) && sorts.length > 0) { - let sort = sorts[0]; - if (sorts.length > 1) { - warn(MORE_THAN_ONE_SORT); - sort = true; - } - else { - // Simplify domain sort by removing field and op when the field is the same as the domain field. - if (isObject(sort) && 'field' in sort) { - const sortField = sort.field; - if (domain.field === sortField) { - sort = sort.order ? { order: sort.order } : true; - } - } - } - return Object.assign(Object.assign({}, domain), { sort }); - } - return domain; - } - // only keep sort properties that work with unioned domains - const unionDomainSorts = unique(sorts.map(s => { - if (isBoolean$1(s) || !('op' in s) || s.op in MULTIDOMAIN_SORT_OP_INDEX) { - return s; - } - warn(domainSortDropped(s)); - return true; - }), hash); - let sort; - if (unionDomainSorts.length === 1) { - sort = unionDomainSorts[0]; - } - else if (unionDomainSorts.length > 1) { - warn(MORE_THAN_ONE_SORT); - sort = true; - } - const allData = unique(domains.map(d => { - if (isDataRefDomain(d)) { - return d.data; - } - return null; - }), x => x); - if (allData.length === 1 && allData[0] !== null) { - // create a union domain of different fields with a single data source - const domain = Object.assign({ data: allData[0], fields: uniqueDomains.map(d => d.field) }, (sort ? { sort } : {})); - return domain; - } - return Object.assign({ fields: uniqueDomains }, (sort ? { sort } : {})); - } - /** - * Return a field if a scale uses a single field. - * Return `undefined` otherwise. - */ - function getFieldFromDomain(domain) { - if (isDataRefDomain(domain) && isString(domain.field)) { - return domain.field; - } - else if (isDataRefUnionedDomain(domain)) { - let field; - for (const nonUnionDomain of domain.fields) { - if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) { - if (!field) { - field = nonUnionDomain.field; - } - else if (field !== nonUnionDomain.field) { - warn(FACETED_INDEPENDENT_DIFFERENT_SOURCES); - return field; - } - } - } - warn(FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES); - return field; - } - else if (isFieldRefUnionDomain(domain)) { - warn(FACETED_INDEPENDENT_SAME_SOURCE); - const field = domain.fields[0]; - return isString(field) ? field : undefined; - } - return undefined; - } - function assembleDomain(model, channel) { - const scaleComponent = model.component.scales[channel]; - const domains = scaleComponent.get('domains').map((domain) => { - // Correct references to data as the original domain's data was determined - // in parseScale, which happens before parseData. Thus the original data - // reference can be incorrect. - if (isDataRefDomain(domain)) { - domain.data = model.lookupDataSource(domain.data); - } - return domain; - }); - // domains is an array that has to be merged into a single vega domain - return mergeDomains(domains); - } - - function assembleScales(model) { - if (isLayerModel(model) || isConcatModel(model)) { - // For concat and layer, include scales of children too - return model.children.reduce((scales, child) => { - return scales.concat(assembleScales(child)); - }, assembleScalesForModel(model)); - } - else { - // For facet, child scales would not be included in the parent's scope. - // For unit, there is no child. - return assembleScalesForModel(model); - } - } - function assembleScalesForModel(model) { - return keys(model.component.scales).reduce((scales, channel) => { - const scaleComponent = model.component.scales[channel]; - if (scaleComponent.merged) { - // Skipped merged scales - return scales; - } - const scale = scaleComponent.combine(); - const { name, type, selectionExtent, domains: _d, range: _r, reverse } = scale, otherScaleProps = __rest(scale, ["name", "type", "selectionExtent", "domains", "range", "reverse"]); - const range = assembleScaleRange(scale.range, name, channel, model); - let domainRaw; - if (selectionExtent) { - domainRaw = assembleSelectionScaleDomain(model, selectionExtent); - } - const domain = assembleDomain(model, channel); - scales.push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name, - type }, (domain ? { domain } : {})), (domainRaw ? { domainRaw } : {})), { range }), (reverse !== undefined ? { reverse: reverse } : {})), otherScaleProps)); - return scales; - }, []); - } - function assembleScaleRange(scaleRange, scaleName, channel, model) { - // add signals to x/y range - if (isXorY(channel)) { - if (isVgRangeStep(scaleRange)) { - // For width/height step, use a signal created in layout assemble instead of a constant step. - return { - step: { signal: scaleName + '_step' } - }; - } - } - else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) { - return Object.assign(Object.assign({}, scaleRange), { data: model.lookupDataSource(scaleRange.data) }); - } - return scaleRange; - } - - class ScaleComponent extends Split { - constructor(name, typeWithExplicit) { - super({}, // no initial explicit property - { name } // name as initial implicit property - ); - this.merged = false; - this.setWithExplicit('type', typeWithExplicit); - } - /** - * Whether the scale definitely includes zero in the domain - */ - domainDefinitelyIncludesZero() { - if (this.get('zero') !== false) { - return true; - } - return some(this.get('domains'), d => isArray(d) && d.length === 2 && d[0] <= 0 && d[1] >= 0); - } - } - - const RANGE_PROPERTIES = ['range', 'scheme']; - function getSizeChannel$1(channel) { - return channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; - } - function parseUnitScaleRange(model) { - const localScaleComponents = model.component.scales; - // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first! - for (const channel of SCALE_CHANNELS) { - const localScaleCmpt = localScaleComponents[channel]; - if (!localScaleCmpt) { - continue; - } - const rangeWithExplicit = parseRangeForChannel(channel, model); - localScaleCmpt.setWithExplicit('range', rangeWithExplicit); - } - } - function getBinStepSignal(model, channel) { - const fieldDef = model.fieldDef(channel); - if (fieldDef && fieldDef.bin && isBinning(fieldDef.bin)) { - const binSignal = getBinSignalName(model, fieldDef.field, fieldDef.bin); - // TODO: extract this to be range step signal - const sizeType = getSizeChannel$1(channel); - const sizeSignal = model.getName(sizeType); - return new SignalRefWrapper(() => { - const updatedName = model.getSignalName(binSignal); - const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`; - return `${model.getSignalName(sizeSignal)} / (${binCount})`; - }); - } - return undefined; - } - /** - * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme). - */ - function parseRangeForChannel(channel, model) { - const specifiedScale = model.specifiedScales[channel]; - const { size } = model; - const mergedScaleCmpt = model.getScaleComponent(channel); - const scaleType = mergedScaleCmpt.get('type'); - // Check if any of the range properties is specified. - // If so, check if it is compatible and make sure that we only output one of the properties - for (const property of RANGE_PROPERTIES) { - if (specifiedScale[property] !== undefined) { - const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); - const channelIncompatability = channelScalePropertyIncompatability(channel, property); - if (!supportedByScaleType) { - warn(scalePropertyNotWorkWithScaleType(scaleType, property, channel)); - } - else if (channelIncompatability) { - // channel - warn(channelIncompatability); - } - else { - switch (property) { - case 'range': { - const range = specifiedScale.range; - if (isArray(range)) { - if (isXorY(channel)) { - return makeExplicit(range.map(v => { - if (v === 'width' || v === 'height') { - // get signal for width/height - // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames. - const sizeSignal = model.getName(v); - const getSignalName = model.getSignalName.bind(model); - return SignalRefWrapper.fromName(getSignalName, sizeSignal); - } - return v; - })); - } - } - else if (isObject(range)) { - return makeExplicit({ - data: model.requestDataName(DataSourceType.Main), - field: range.field, - sort: { op: 'min', field: model.vgField(channel) } - }); - } - return makeExplicit(range); - } - case 'scheme': - return makeExplicit(parseScheme(specifiedScale[property])); - } - } - } - } - if (channel === X || channel === Y) { - const sizeChannel = channel === X ? 'width' : 'height'; - const sizeValue = size[sizeChannel]; - if (isStep(sizeValue)) { - if (hasDiscreteDomain(scaleType)) { - return makeExplicit({ step: sizeValue.step }); - } - else { - warn(stepDropped(sizeChannel)); - } - } - } - const { rangeMin, rangeMax } = specifiedScale; - const d = defaultRange(channel, model); - if ((rangeMin !== undefined || rangeMax !== undefined) && - // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same - scaleTypeSupportProperty(scaleType, 'rangeMin') && - isArray(d) && - d.length === 2) { - return makeExplicit([rangeMin !== null && rangeMin !== void 0 ? rangeMin : d[0], rangeMax !== null && rangeMax !== void 0 ? rangeMax : d[1]]); - } - return makeImplicit(d); - } - function parseScheme(scheme) { - if (isExtendedScheme(scheme)) { - return Object.assign({ scheme: scheme.name }, omit(scheme, ['name'])); - } - return { scheme: scheme }; - } - function defaultRange(channel, model) { - const { size, config, mark, encoding } = model; - const getSignalName = model.getSignalName.bind(model); - const { type } = getFieldOrDatumDef(encoding[channel]); - const mergedScaleCmpt = model.getScaleComponent(channel); - const scaleType = mergedScaleCmpt.get('type'); - const { domain, domainMid } = model.specifiedScales[channel]; - switch (channel) { - case X: - case Y: { - // If there is no explicit width/height for discrete x/y scales - if (contains(['point', 'band'], scaleType)) { - if (channel === X && !size.width) { - const w = getViewConfigDiscreteSize(config.view, 'width'); - if (isStep(w)) { - return w; - } - } - else if (channel === Y && !size.height) { - const h = getViewConfigDiscreteSize(config.view, 'height'); - if (isStep(h)) { - return h; - } - } - } - // If step is null, use zero to width or height. - // Note that we use SignalRefWrapper to account for potential merges and renames. - const sizeType = getSizeChannel$1(channel); - const sizeSignal = model.getName(sizeType); - if (channel === Y && hasContinuousDomain(scaleType)) { - // For y continuous scale, we have to start from the height as the bottom part has the max value. - return [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0]; - } - else { - return [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)]; - } - } - case SIZE: { - // TODO: support custom rangeMin, rangeMax - const zero = model.component.scales[channel].get('zero'); - const rangeMin = sizeRangeMin(mark, zero, config); - const rangeMax = sizeRangeMax(mark, size, model, config); - if (isContinuousToDiscrete(scaleType)) { - return interpolateRange(rangeMin, rangeMax, defaultContinuousToDiscreteCount(scaleType, config, domain, channel)); - } - else { - return [rangeMin, rangeMax]; - } - } - case THETA: - return [0, Math.PI * 2]; - case ANGLE: - // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks. - // (It's weird to add just config.scale.min/maxAngleDegree for now) - return [0, 360]; - case RADIUS: { - // max radius = half od min(width,height) - return [ - 0, - new SignalRefWrapper(() => { - const w = model.getSignalName('width'); - const h = model.getSignalName('height'); - return `min(${w},${h})/2`; - }) - ]; - } - case STROKEWIDTH: - // TODO: support custom rangeMin, rangeMax - return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth]; - case STROKEDASH: - return [ - // TODO: add this to Vega's config.range? - [1, 0], - [4, 2], - [2, 1], - [1, 1], - [1, 2, 4, 2] - ]; - case SHAPE: - return 'symbol'; - case COLOR: - case FILL: - case STROKE: - if (scaleType === 'ordinal') { - // Only nominal data uses ordinal scale by default - return type === 'nominal' ? 'category' : 'ordinal'; - } - else { - if (domainMid !== undefined) { - return 'diverging'; - } - else { - return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp'; - } - } - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - // TODO: support custom rangeMin, rangeMax - return [config.scale.minOpacity, config.scale.maxOpacity]; - } - /* istanbul ignore next: should never reach here */ - throw new Error(`Scale range undefined for channel ${channel}`); - } - function defaultContinuousToDiscreteCount(scaleType, config, domain, channel) { - switch (scaleType) { - case 'quantile': - return config.scale.quantileCount; - case 'quantize': - return config.scale.quantizeCount; - case 'threshold': - if (domain !== undefined && isArray(domain)) { - return domain.length + 1; - } - else { - warn(domainRequiredForThresholdScale(channel)); - // default threshold boundaries for threshold scale since domain has cardinality of 2 - return 3; - } - } - } - /** - * Returns the linear interpolation of the range according to the cardinality - * - * @param rangeMin start of the range - * @param rangeMax end of the range - * @param cardinality number of values in the output range - */ - function interpolateRange(rangeMin, rangeMax, cardinality) { - // always return a signal since it's better to compute the sequence in Vega later - const f = () => { - const rMax = signalOrStringValue(rangeMax); - const rMin = signalOrStringValue(rangeMin); - const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`; - return `sequence(${rMin}, ${rMax} + ${step}, ${step})`; - }; - if (isSignalRef(rangeMax)) { - return new SignalRefWrapper(f); - } - else { - return { signal: f() }; - } - } - function sizeRangeMin(mark, zero, config) { - if (zero) { - if (isSignalRef(zero)) { - return { signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}` }; - } - else { - return 0; - } - } - switch (mark) { - case 'bar': - case 'tick': - return config.scale.minBandSize; - case 'line': - case 'trail': - case 'rule': - return config.scale.minStrokeWidth; - case 'text': - return config.scale.minFontSize; - case 'point': - case 'square': - case 'circle': - return config.scale.minSize; - } - /* istanbul ignore next: should never reach here */ - // sizeRangeMin not implemented for the mark - throw new Error(incompatibleChannel('size', mark)); - } - const MAX_SIZE_RANGE_STEP_RATIO = 0.95; - function sizeRangeMax(mark, size, model, config) { - const xyStepSignals = { - x: getBinStepSignal(model, 'x'), - y: getBinStepSignal(model, 'y') - }; - switch (mark) { - case 'bar': - case 'tick': { - if (config.scale.maxBandSize !== undefined) { - return config.scale.maxBandSize; - } - const min = minXYStep(size, xyStepSignals, config.view); - if (isNumber(min)) { - return min - 1; - } - else { - return new SignalRefWrapper(() => `${min.signal} - 1`); - } - } - case 'line': - case 'trail': - case 'rule': - return config.scale.maxStrokeWidth; - case 'text': - return config.scale.maxFontSize; - case 'point': - case 'square': - case 'circle': { - if (config.scale.maxSize) { - return config.scale.maxSize; - } - const pointStep = minXYStep(size, xyStepSignals, config.view); - if (isNumber(pointStep)) { - return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2); - } - else { - return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`); - } - } - } - /* istanbul ignore next: should never reach here */ - // sizeRangeMax not implemented for the mark - throw new Error(incompatibleChannel('size', mark)); - } - /** - * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale. - */ - function minXYStep(size, xyStepSignals, viewConfig) { - const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width'); - const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height'); - if (xyStepSignals.x || xyStepSignals.y) { - return new SignalRefWrapper(() => { - const exprs = [ - xyStepSignals.x ? xyStepSignals.x.signal : widthStep, - xyStepSignals.y ? xyStepSignals.y.signal : heightStep - ]; - return `min(${exprs.join(', ')})`; - }); - } - return Math.min(widthStep, heightStep); - } - - function parseScaleProperty(model, property) { - if (isUnitModel(model)) { - parseUnitScaleProperty(model, property); - } - else { - parseNonUnitScaleProperty(model, property); - } - } - function parseUnitScaleProperty(model, property) { - const localScaleComponents = model.component.scales; - const { config, encoding, markDef, specifiedScales } = model; - for (const channel of keys(localScaleComponents)) { - const specifiedScale = specifiedScales[channel]; - const localScaleCmpt = localScaleComponents[channel]; - const mergedScaleCmpt = model.getScaleComponent(channel); - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - const specifiedValue = specifiedScale[property]; - const scaleType = mergedScaleCmpt.get('type'); - const scalePadding = mergedScaleCmpt.get('padding'); - const scalePaddingInner = mergedScaleCmpt.get('paddingInner'); - const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); - const channelIncompatability = channelScalePropertyIncompatability(channel, property); - if (specifiedValue !== undefined) { - // If there is a specified value, check if it is compatible with scale type and channel - if (!supportedByScaleType) { - warn(scalePropertyNotWorkWithScaleType(scaleType, property, channel)); - } - else if (channelIncompatability) { - // channel - warn(channelIncompatability); - } - } - if (supportedByScaleType && channelIncompatability === undefined) { - if (specifiedValue !== undefined) { - const timeUnit = fieldOrDatumDef['timeUnit']; - const type = fieldOrDatumDef.type; - switch (property) { - // domainMax/Min to signal if the value is a datetime object - case 'domainMax': - case 'domainMin': - if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) { - localScaleCmpt.set(property, { signal: valueExpr(specifiedScale[property], { type, timeUnit }) }, true); - } - else { - localScaleCmpt.set(property, specifiedScale[property], true); - } - break; - default: - localScaleCmpt.copyKeyFromObject(property, specifiedScale); - } - } - else { - const value = property in scaleRules - ? scaleRules[property]({ - model, - channel, - fieldOrDatumDef, - scaleType, - scalePadding, - scalePaddingInner, - domain: specifiedScale.domain, - markDef, - config - }) - : config.scale[property]; - if (value !== undefined) { - localScaleCmpt.set(property, value, false); - } - } - } - } - } - const scaleRules = { - bins: ({ model, fieldOrDatumDef }) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined), - interpolate: ({ channel, fieldOrDatumDef }) => interpolate(channel, fieldOrDatumDef.type), - nice: ({ scaleType, channel, fieldOrDatumDef }) => nice(scaleType, channel, fieldOrDatumDef), - padding: ({ channel, scaleType, fieldOrDatumDef, markDef, config }) => padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar), - paddingInner: ({ scalePadding, channel, markDef, config }) => paddingInner(scalePadding, channel, markDef.type, config.scale), - paddingOuter: ({ scalePadding, channel, scaleType, markDef, scalePaddingInner, config }) => paddingOuter(scalePadding, channel, scaleType, markDef.type, scalePaddingInner, config.scale), - reverse: ({ fieldOrDatumDef, scaleType, channel, config }) => { - const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined; - return reverse(scaleType, sort, channel, config.scale); - }, - zero: ({ channel, fieldOrDatumDef, domain, markDef, scaleType }) => zero$1(channel, fieldOrDatumDef, domain, markDef, scaleType) - }; - // This method is here rather than in range.ts to avoid circular dependency. - function parseScaleRange(model) { - if (isUnitModel(model)) { - parseUnitScaleRange(model); - } - else { - parseNonUnitScaleProperty(model, 'range'); - } - } - function parseNonUnitScaleProperty(model, property) { - const localScaleComponents = model.component.scales; - for (const child of model.children) { - if (property === 'range') { - parseScaleRange(child); - } - else { - parseScaleProperty(child, property); - } - } - for (const channel of keys(localScaleComponents)) { - let valueWithExplicit; - for (const child of model.children) { - const childComponent = child.component.scales[channel]; - if (childComponent) { - const childValueWithExplicit = childComponent.getWithExplicit(property); - valueWithExplicit = mergeValuesWithExplicit(valueWithExplicit, childValueWithExplicit, property, 'scale', tieBreakByComparing((v1, v2) => { - switch (property) { - case 'range': - // For step, prefer larger step - if (v1.step && v2.step) { - return v1.step - v2.step; - } - return 0; - // TODO: precedence rule for other properties - } - return 0; - })); - } - } - localScaleComponents[channel].setWithExplicit(property, valueWithExplicit); - } - } - function bins(model, fieldDef) { - const bin = fieldDef.bin; - if (isBinning(bin)) { - const binSignal = getBinSignalName(model, fieldDef.field, bin); - return new SignalRefWrapper(() => { - return model.getSignalName(binSignal); - }); - } - else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) { - // start and stop will be determined from the scale domain - return { - step: bin.step - }; - } - return undefined; - } - function interpolate(channel, type) { - if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') { - return 'hcl'; - } - return undefined; - } - function nice(scaleType, channel, fieldOrDatumDef) { - var _a; - if (((_a = getFieldDef(fieldOrDatumDef)) === null || _a === void 0 ? void 0 : _a.bin) || contains([ScaleType.TIME, ScaleType.UTC], scaleType)) { - return undefined; - } - return channel in POSITION_SCALE_CHANNEL_INDEX ? true : undefined; - } - function padding(channel, scaleType, scaleConfig, fieldOrDatumDef, markDef, barConfig) { - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - if (isContinuousToContinuous(scaleType)) { - if (scaleConfig.continuousPadding !== undefined) { - return scaleConfig.continuousPadding; - } - const { type, orient } = markDef; - if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) { - if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) { - return barConfig.continuousBandSize; - } - } - } - if (scaleType === ScaleType.POINT) { - return scaleConfig.pointPadding; - } - } - return undefined; - } - function paddingInner(paddingValue, channel, mark, scaleConfig) { - if (paddingValue !== undefined) { - // If user has already manually specified "padding", no need to add default paddingInner. - return undefined; - } - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - // Padding is only set for X and Y by default. - // Basically it doesn't make sense to add padding for color and size. - // paddingOuter would only be called if it's a band scale, just return the default for bandScale. - const { bandPaddingInner, barBandPaddingInner, rectBandPaddingInner } = scaleConfig; - return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); - } - return undefined; - } - function paddingOuter(paddingValue, channel, scaleType, mark, paddingInnerValue, scaleConfig) { - if (paddingValue !== undefined) { - // If user has already manually specified "padding", no need to add default paddingOuter. - return undefined; - } - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - // Padding is only set for X and Y by default. - // Basically it doesn't make sense to add padding for color and size. - if (scaleType === ScaleType.BAND) { - const { bandPaddingOuter } = scaleConfig; - return getFirstDefined(bandPaddingOuter, - /* By default, paddingOuter is paddingInner / 2. The reason is that - size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter). - and we want the width/height to be integer by default. - Note that step (by default) and cardinality are integers.) */ - isSignalRef(paddingInnerValue) ? { signal: `${paddingInnerValue.signal}/2` } : paddingInnerValue / 2); - } - } - return undefined; - } - function reverse(scaleType, sort, channel, scaleConfig) { - if (channel === 'x' && scaleConfig.xReverse !== undefined) { - if (hasContinuousDomain(scaleType) && sort === 'descending') { - if (isSignalRef(scaleConfig.xReverse)) { - return { signal: `!${scaleConfig.xReverse.signal}` }; - } - else { - return !scaleConfig.xReverse; - } - } - return scaleConfig.xReverse; - } - if (hasContinuousDomain(scaleType) && sort === 'descending') { - // For continuous domain scales, Vega does not support domain sort. - // Thus, we reverse range instead if sort is descending - return true; - } - return undefined; - } - function zero$1(channel, fieldDef, specifiedDomain, markDef, scaleType) { - // If users explicitly provide a domain range, we should not augment zero as that will be unexpected. - const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated'; - if (hasCustomDomain) { - if (hasContinuousDomain(scaleType)) { - if (isArray(specifiedDomain)) { - const first = specifiedDomain[0]; - const last = specifiedDomain[specifiedDomain.length - 1]; - if (first <= 0 && last >= 0) { - // if the domain includes zero, make zero remains true - return true; - } - } - return false; - } - } - // If there is no custom domain, return true only for the following cases: - // 1) using quantitative field with size - // While this can be either ratio or interval fields, our assumption is that - // ratio are more common. However, if the scaleType is discretizing scale, we want to return - // false so that range doesn't start at zero - if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) { - return true; - } - // 2) non-binned, quantitative x-scale or y-scale - // (For binning, we should not include zero by default because binning are calculated without zero.) - if (!(isFieldDef(fieldDef) && fieldDef.bin) && - contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)) { - const { orient, type } = markDef; - if (contains(['bar', 'area', 'line', 'trail'], type)) { - if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) { - return false; - } - } - return true; - } - return false; - } - - /** - * Determine if there is a specified scale type and if it is appropriate, - * or determine default type if type is unspecified or inappropriate. - */ - // NOTE: CompassQL uses this method. - function scaleType(specifiedScale, channel, fieldDef, mark) { - const defaultScaleType = defaultType$2(channel, fieldDef, mark); - const { type } = specifiedScale; - if (!isScaleChannel(channel)) { - // There is no scale for these channels - return null; - } - if (type !== undefined) { - // Check if explicitly specified scale type is supported by the channel - if (!channelSupportScaleType(channel, type)) { - warn(scaleTypeNotWorkWithChannel(channel, type, defaultScaleType)); - return defaultScaleType; - } - // Check if explicitly specified scale type is supported by the data type - if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) { - warn(scaleTypeNotWorkWithFieldDef(type, defaultScaleType)); - return defaultScaleType; - } - return type; - } - return defaultScaleType; - } - /** - * Determine appropriate default scale type. - */ - // NOTE: Voyager uses this method. - function defaultType$2(channel, fieldDef, mark) { - var _a; - switch (fieldDef.type) { - case 'nominal': - case 'ordinal': - if (isColorChannel(channel) || rangeType(channel) === 'discrete') { - if (channel === 'shape' && fieldDef.type === 'ordinal') { - warn(discreteChannelCannotEncode(channel, 'ordinal')); - } - return 'ordinal'; - } - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - if (contains(['rect', 'bar', 'image', 'rule'], mark)) { - // The rect/bar mark should fit into a band. - // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429 - return 'band'; - } - } - else if (mark === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) { - return 'band'; - } - if (fieldDef.band !== undefined || (isPositionFieldOrDatumDef(fieldDef) && ((_a = fieldDef.axis) === null || _a === void 0 ? void 0 : _a.tickBand))) { - return 'band'; - } - // Otherwise, use ordinal point scale so we can easily get center positions of the marks. - return 'point'; - case 'temporal': - if (isColorChannel(channel)) { - return 'time'; - } - else if (rangeType(channel) === 'discrete') { - warn(discreteChannelCannotEncode(channel, 'temporal')); - // TODO: consider using quantize (equivalent to binning) once we have it - return 'ordinal'; - } - else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) { - return 'utc'; - } - return 'time'; - case 'quantitative': - if (isColorChannel(channel)) { - if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) { - return 'bin-ordinal'; - } - return 'linear'; - } - else if (rangeType(channel) === 'discrete') { - warn(discreteChannelCannotEncode(channel, 'quantitative')); - // TODO: consider using quantize (equivalent to binning) once we have it - return 'ordinal'; - } - return 'linear'; - case 'geojson': - return undefined; - } - /* istanbul ignore next: should never reach this */ - throw new Error(invalidFieldType(fieldDef.type)); - } - - function parseScales(model, { ignoreRange } = {}) { - parseScaleCore(model); - parseScaleDomain(model); - for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) { - parseScaleProperty(model, prop); - } - if (!ignoreRange) { - // range depends on zero - parseScaleRange(model); - } - } - function parseScaleCore(model) { - if (isUnitModel(model)) { - model.component.scales = parseUnitScaleCore(model); - } - else { - model.component.scales = parseNonUnitScaleCore(model); - } - } - /** - * Parse scales for all channels of a model. - */ - function parseUnitScaleCore(model) { - const { encoding, mark } = model; - return SCALE_CHANNELS.reduce((scaleComponents, channel) => { - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); // must be typed def to have scale - // Don't generate scale for shape of geoshape - if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) { - return scaleComponents; - } - let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale']; - if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) { - specifiedScale = specifiedScale !== null && specifiedScale !== void 0 ? specifiedScale : {}; - const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, mark); - scaleComponents[channel] = new ScaleComponent(model.scaleName(channel + '', true), { - value: sType, - explicit: specifiedScale.type === sType - }); - } - return scaleComponents; - }, {}); - } - const scaleTypeTieBreaker = tieBreakByComparing((st1, st2) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2)); - function parseNonUnitScaleCore(model) { - var _a; - const scaleComponents = (model.component.scales = {}); - const scaleTypeWithExplicitIndex = {}; - const resolve = model.component.resolve; - // Parse each child scale and determine if a particular channel can be merged. - for (const child of model.children) { - parseScaleCore(child); - // Instead of always merging right away -- check if it is compatible to merge first! - for (const channel of keys(child.component.scales)) { - // if resolve is undefined, set default first - resolve.scale[channel] = (_a = resolve.scale[channel]) !== null && _a !== void 0 ? _a : defaultScaleResolve(channel, model); - if (resolve.scale[channel] === 'shared') { - const explicitScaleType = scaleTypeWithExplicitIndex[channel]; - const childScaleType = child.component.scales[channel].getWithExplicit('type'); - if (explicitScaleType) { - if (scaleCompatible(explicitScaleType.value, childScaleType.value)) { - // merge scale component if type are compatible - scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(explicitScaleType, childScaleType, 'type', 'scale', scaleTypeTieBreaker); - } - else { - // Otherwise, update conflicting channel to be independent - resolve.scale[channel] = 'independent'; - // Remove from the index so they don't get merged - delete scaleTypeWithExplicitIndex[channel]; - } - } - else { - scaleTypeWithExplicitIndex[channel] = childScaleType; - } - } - } - } - // Merge each channel listed in the index - for (const channel of keys(scaleTypeWithExplicitIndex)) { - // Create new merged scale component - const name = model.scaleName(channel, true); - const typeWithExplicit = scaleTypeWithExplicitIndex[channel]; - scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit); - // rename each child and mark them as merged - for (const child of model.children) { - const childScale = child.component.scales[channel]; - if (childScale) { - child.renameScale(childScale.get('name'), name); - childScale.merged = true; - } - } - } - return scaleComponents; - } - - class NameMap { - constructor() { - this.nameMap = {}; - } - rename(oldName, newName) { - this.nameMap[oldName] = newName; - } - has(name) { - return this.nameMap[name] !== undefined; - } - get(name) { - // If the name appears in the _nameMap, we need to read its new name. - // We have to loop over the dict just in case the new name also gets renamed. - while (this.nameMap[name] && name !== this.nameMap[name]) { - name = this.nameMap[name]; - } - return name; - } - } - /* - We use type guards instead of `instanceof` as `instanceof` makes - different parts of the compiler depend on the actual implementation of - the model classes, which in turn depend on different parts of the compiler. - Thus, `instanceof` leads to circular dependency problems. - - On the other hand, type guards only make different parts of the compiler - depend on the type of the model classes, but not the actual implementation. - */ - function isUnitModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'unit'; - } - function isFacetModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'facet'; - } - function isConcatModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'concat'; - } - function isLayerModel(model) { - return (model === null || model === void 0 ? void 0 : model.type) === 'layer'; - } - class Model { - constructor(spec, type, parent, parentGivenName, config, resolve, view) { - var _a, _b; - this.type = type; - this.parent = parent; - this.config = config; - this.view = view; - this.children = []; - /** - * Corrects the data references in marks after assemble. - */ - this.correctDataNames = (mark) => { - // TODO: make this correct - // for normal data references - if (mark.from && mark.from.data) { - mark.from.data = this.lookupDataSource(mark.from.data); - } - // for access to facet data - if (mark.from && mark.from.facet && mark.from.facet.data) { - mark.from.facet.data = this.lookupDataSource(mark.from.facet.data); - } - return mark; - }; - this.parent = parent; - this.config = config; - // If name is not provided, always use parent's givenName to avoid name conflicts. - this.name = (_a = spec.name) !== null && _a !== void 0 ? _a : parentGivenName; - this.title = isText(spec.title) ? { text: spec.title } : spec.title; - // Shared name maps - this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap(); - this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap(); - this.signalNameMap = parent ? parent.signalNameMap : new NameMap(); - this.data = spec.data; - this.description = spec.description; - this.transforms = normalizeTransform((_b = spec.transform) !== null && _b !== void 0 ? _b : []); - this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config); - this.component = { - data: { - sources: parent ? parent.component.data.sources : [], - outputNodes: parent ? parent.component.data.outputNodes : {}, - outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {}, - // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined - isFaceted: isFacetSpec(spec) || (parent && parent.component.data.isFaceted && spec.data === undefined) - }, - layoutSize: new Split(), - layoutHeaders: { row: {}, column: {}, facet: {} }, - mark: null, - resolve: Object.assign({ scale: {}, axis: {}, legend: {} }, (resolve ? duplicate(resolve) : {})), - selection: null, - scales: null, - projection: null, - axes: {}, - legends: {} - }; - } - get width() { - return this.getSizeSignalRef('width'); - } - get height() { - return this.getSizeSignalRef('height'); - } - parse() { - this.parseScale(); - this.parseLayoutSize(); // depends on scale - this.renameTopLevelLayoutSizeSignal(); - this.parseSelections(); - this.parseProjection(); - this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name. - this.parseAxesAndHeaders(); // depends on scale and layout size - this.parseLegends(); // depends on scale, markDef - this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark. - } - parseScale() { - parseScales(this); - } - parseProjection() { - parseProjection(this); - } - /** - * Rename top-level spec's size to be just width / height, ignoring model name. - * This essentially merges the top-level spec's width/height signals with the width/height signals - * to help us reduce redundant signals declaration. - */ - renameTopLevelLayoutSizeSignal() { - if (this.getName('width') !== 'width') { - this.renameSignal(this.getName('width'), 'width'); - } - if (this.getName('height') !== 'height') { - this.renameSignal(this.getName('height'), 'height'); - } - } - parseLegends() { - parseLegend(this); - } - assembleGroupStyle() { - var _a, _b; - if (this.type === 'unit' || this.type === 'layer') { - return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : 'cell'; - } - return undefined; - } - assembleEncodeFromView(view) { - // Exclude "style" - const baseView = __rest(view, ["style"]); - const e = {}; - for (const property of keys(baseView)) { - const value = baseView[property]; - if (value !== undefined) { - e[property] = signalOrValueRef(value); - } - } - return e; - } - assembleGroupEncodeEntry(isTopLevel) { - let encodeEntry = {}; - if (this.view) { - encodeEntry = this.assembleEncodeFromView(this.view); - } - if (!isTopLevel) { - // Descriptions are already added to the top-level description so we only need to add them to the inner views. - if (this.description) { - encodeEntry['description'] = signalOrValueRef(this.description); - } - // For top-level spec, we can set the global width and height signal to adjust the group size. - // For other child specs, we have to manually set width and height in the encode entry. - if (this.type === 'unit' || this.type === 'layer') { - return Object.assign({ width: this.getSizeSignalRef('width'), height: this.getSizeSignalRef('height') }, (encodeEntry !== null && encodeEntry !== void 0 ? encodeEntry : {})); - } - } - return isEmpty(encodeEntry) ? undefined : encodeEntry; - } - assembleLayout() { - if (!this.layout) { - return undefined; - } - const _a = this.layout, { spacing } = _a, layout = __rest(_a, ["spacing"]); - const { component, config } = this; - const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config); - return Object.assign(Object.assign(Object.assign({ padding: spacing }, this.assembleDefaultLayout()), layout), (titleBand ? { titleBand } : {})); - } - assembleDefaultLayout() { - return {}; - } - assembleHeaderMarks() { - const { layoutHeaders } = this.component; - let headerMarks = []; - for (const channel of FACET_CHANNELS) { - if (layoutHeaders[channel].title) { - headerMarks.push(assembleTitleGroup(this, channel)); - } - } - for (const channel of HEADER_CHANNELS) { - headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel)); - } - return headerMarks; - } - assembleAxes() { - return assembleAxes(this.component.axes, this.config); - } - assembleLegends() { - return assembleLegends(this); - } - assembleProjections() { - return assembleProjections(this); - } - assembleTitle() { - var _a, _b, _c; - const _d = (_a = this.title) !== null && _a !== void 0 ? _a : {}, { encoding } = _d, titleNoEncoding = __rest(_d, ["encoding"]); - const title = Object.assign(Object.assign(Object.assign({}, extractTitleConfig(this.config.title).nonMark), titleNoEncoding), (encoding ? { encode: { update: encoding } } : {})); - if (title.text) { - if (contains(['unit', 'layer'], this.type)) { - // Unit/Layer - if (contains(['middle', undefined], title.anchor)) { - title.frame = (_b = title.frame) !== null && _b !== void 0 ? _b : 'group'; - } - } - else { - // composition with Vega layout - // Set title = "start" by default for composition as "middle" does not look nice - // https://github.com/vega/vega/issues/960#issuecomment-471360328 - title.anchor = (_c = title.anchor) !== null && _c !== void 0 ? _c : 'start'; - } - return isEmpty(title) ? undefined : title; - } - return undefined; - } - /** - * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals. - */ - assembleGroup(signals = []) { - const group = {}; - signals = signals.concat(this.assembleSignals()); - if (signals.length > 0) { - group.signals = signals; - } - const layout = this.assembleLayout(); - if (layout) { - group.layout = layout; - } - group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks()); - // Only include scales if this spec is top-level or if parent is facet. - // (Otherwise, it will be merged with upper-level's scope.) - const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : []; - if (scales.length > 0) { - group.scales = scales; - } - const axes = this.assembleAxes(); - if (axes.length > 0) { - group.axes = axes; - } - const legends = this.assembleLegends(); - if (legends.length > 0) { - group.legends = legends; - } - return group; - } - getName(text) { - return varName((this.name ? this.name + '_' : '') + text); - } - getDataName(type) { - return this.getName(DataSourceType[type].toLowerCase()); - } - /** - * Request a data source name for the given data source type and mark that data source as required. - * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData(). - * You can lookup the correct dataset name in assemble with `lookupDataSource`. - */ - requestDataName(name) { - const fullName = this.getDataName(name); - // Increase ref count. This is critical because otherwise we won't create a data source. - // We also increase the ref counts on OutputNode.getSource() calls. - const refCounts = this.component.data.outputNodeRefCounts; - refCounts[fullName] = (refCounts[fullName] || 0) + 1; - return fullName; - } - getSizeSignalRef(layoutSizeType) { - if (isFacetModel(this.parent)) { - const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); - const channel = getPositionScaleChannel(sizeType); - const scaleComponent = this.component.scales[channel]; - if (scaleComponent && !scaleComponent.merged) { - // independent scale - const type = scaleComponent.get('type'); - const range = scaleComponent.get('range'); - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const scaleName = scaleComponent.get('name'); - const domain = assembleDomain(this, channel); - const field = getFieldFromDomain(domain); - if (field) { - const fieldRef = vgField({ aggregate: 'distinct', field }, { expr: 'datum' }); - return { - signal: sizeExpr(scaleName, scaleComponent, fieldRef) - }; - } - else { - warn(unknownField(channel)); - return null; - } - } - } - } - return { - signal: this.signalNameMap.get(this.getName(layoutSizeType)) - }; - } - /** - * Lookup the name of the datasource for an output node. You probably want to call this in assemble. - */ - lookupDataSource(name) { - const node = this.component.data.outputNodes[name]; - if (!node) { - // Name not found in map so let's just return what we got. - // This can happen if we already have the correct name. - return name; - } - return node.getSource(); - } - getSignalName(oldSignalName) { - return this.signalNameMap.get(oldSignalName); - } - renameSignal(oldName, newName) { - this.signalNameMap.rename(oldName, newName); - } - renameScale(oldName, newName) { - this.scaleNameMap.rename(oldName, newName); - } - renameProjection(oldName, newName) { - this.projectionNameMap.rename(oldName, newName); - } - /** - * @return scale name for a given channel after the scale has been parsed and named. - */ - scaleName(originalScaleName, parse) { - if (parse) { - // During the parse phase always return a value - // No need to refer to rename map because a scale can't be renamed - // before it has the original name. - return this.getName(originalScaleName); - } - // If there is a scale for the channel, it should either - // be in the scale component or exist in the name map - if ( - // If there is a scale for the channel, there should be a local scale component for it - (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) || - // in the scale name map (the scale get merged by its parent) - this.scaleNameMap.has(this.getName(originalScaleName))) { - return this.scaleNameMap.get(this.getName(originalScaleName)); - } - return undefined; - } - /** - * @return projection name after the projection has been parsed and named. - */ - projectionName(parse) { - if (parse) { - // During the parse phase always return a value - // No need to refer to rename map because a projection can't be renamed - // before it has the original name. - return this.getName('projection'); - } - if ((this.component.projection && !this.component.projection.merged) || - this.projectionNameMap.has(this.getName('projection'))) { - return this.projectionNameMap.get(this.getName('projection')); - } - return undefined; - } - /** - * Traverse a model's hierarchy to get the scale component for a particular channel. - */ - getScaleComponent(channel) { - /* istanbul ignore next: This is warning for debugging test */ - if (!this.component.scales) { - throw new Error('getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().'); - } - const localScaleComponent = this.component.scales[channel]; - if (localScaleComponent && !localScaleComponent.merged) { - return localScaleComponent; - } - return this.parent ? this.parent.getScaleComponent(channel) : undefined; - } - /** - * Traverse a model's hierarchy to get a particular selection component. - */ - getSelectionComponent(variableName, origName) { - let sel = this.component.selection[variableName]; - if (!sel && this.parent) { - sel = this.parent.getSelectionComponent(variableName, origName); - } - if (!sel) { - throw new Error(selectionNotFound(origName)); - } - return sel; - } - /** - * Returns true if the model has a signalRef for an axis orient. - */ - hasAxisOrientSignalRef() { - var _a, _b; - return (((_a = this.component.axes.x) === null || _a === void 0 ? void 0 : _a.some(a => a.hasOrientSignalRef())) || ((_b = this.component.axes.y) === null || _b === void 0 ? void 0 : _b.some(a => a.hasOrientSignalRef()))); - } - } - /** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */ - class ModelWithField extends Model { - /** Get "field" reference for Vega */ - vgField(channel, opt = {}) { - const fieldDef = this.fieldDef(channel); - if (!fieldDef) { - return undefined; - } - return vgField(fieldDef, opt); - } - reduceFieldDef(f, init) { - return reduce(this.getMapping(), (acc, cd, c) => { - const fieldDef = getFieldDef(cd); - if (fieldDef) { - return f(acc, fieldDef, c); - } - return acc; - }, init); - } - forEachFieldDef(f, t) { - forEach(this.getMapping(), (cd, c) => { - const fieldDef = getFieldDef(cd); - if (fieldDef) { - f(fieldDef, c); - } - }, t); - } - } - - /** - * A class for density transform nodes - */ - class DensityTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'value', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'density']; - } - clone() { - return new DensityTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.density, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `DensityTransform ${hash(this.transform)}`; - } - assemble() { - const _a = this.transform, { density } = _a, rest = __rest(_a, ["density"]); - const result = Object.assign({ type: 'kde', field: density }, rest); - return result; - } - } - - class FilterInvalidNode extends DataFlowNode { - constructor(parent, filter) { - super(parent); - this.filter = filter; - } - clone() { - return new FilterInvalidNode(null, Object.assign({}, this.filter)); - } - static make(parent, model) { - const { config, mark, markDef } = model; - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid !== 'filter') { - return null; - } - const filter = model.reduceFieldDef((aggregator, fieldDef, channel) => { - const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - // While discrete domain scales can handle invalid values, continuous scales can't. - // Thus, for non-path marks, we have to filter null for scales with continuous domains. - // (For path marks, we will use "defined" property and skip these values instead.) - if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { - aggregator[fieldDef.field] = fieldDef; // we know that the fieldDef is a typed field def - } - } - return aggregator; - }, {}); - if (!keys(filter).length) { - return null; - } - return new FilterInvalidNode(parent, filter); - } - dependentFields() { - return new Set(keys(this.filter)); - } - producedFields() { - return new Set(); // filter does not produce any new fields - } - hash() { - return `FilterInvalid ${hash(this.filter)}`; - } - /** - * Create the VgTransforms for each of the filtered fields. - */ - assemble() { - const filters = keys(this.filter).reduce((vegaFilters, field) => { - const fieldDef = this.filter[field]; - const ref = vgField(fieldDef, { expr: 'datum' }); - if (fieldDef !== null) { - if (fieldDef.type === 'temporal') { - vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`); - } - else if (fieldDef.type === 'quantitative') { - vegaFilters.push(`isValid(${ref})`); - vegaFilters.push(`isFinite(+${ref})`); - } - } - return vegaFilters; - }, []); - return filters.length > 0 - ? { - type: 'filter', - expr: filters.join(' && ') - } - : null; - } - } - - /** - * A class for flatten transform nodes - */ - class FlattenTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const { flatten, as = [] } = this.transform; - this.transform.as = flatten.map((f, i) => { var _a; return (_a = as[i]) !== null && _a !== void 0 ? _a : f; }); - } - clone() { - return new FlattenTransformNode(this.parent, duplicate(this.transform)); - } - dependentFields() { - return new Set(this.transform.flatten); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `FlattenTransform ${hash(this.transform)}`; - } - assemble() { - const { flatten: fields, as } = this.transform; - const result = { - type: 'flatten', - fields, - as - }; - return result; - } - } - - /** - * A class for flatten transform nodes - */ - class FoldTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'key', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'value']; - } - clone() { - return new FoldTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - return new Set(this.transform.fold); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `FoldTransform ${hash(this.transform)}`; - } - assemble() { - const { fold, as } = this.transform; - const result = { - type: 'fold', - fields: fold, - as - }; - return result; - } - } - - class GeoJSONNode extends DataFlowNode { - constructor(parent, fields, geojson, signal) { - super(parent); - this.fields = fields; - this.geojson = geojson; - this.signal = signal; - } - clone() { - return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal); - } - static parseAll(parent, model) { - if (model.component.projection && !model.component.projection.isFit) { - return parent; - } - let geoJsonCounter = 0; - for (const coordinates of [ - [LONGITUDE, LATITUDE], - [LONGITUDE2, LATITUDE2] - ]) { - const pair = coordinates.map(channel => { - const def = getFieldOrDatumDef(model.encoding[channel]); - return isFieldDef(def) - ? def.field - : isDatumDef(def) - ? { expr: `${def.datum}` } - : isValueDef(def) - ? { expr: `${def['value']}` } - : undefined; - }); - if (pair[0] || pair[1]) { - parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`)); - } - } - if (model.channelHasField(SHAPE)) { - const fieldDef = model.typedFieldDef(SHAPE); - if (fieldDef.type === GEOJSON) { - parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`)); - } - } - return parent; - } - dependentFields() { - var _a; - const fields = ((_a = this.fields) !== null && _a !== void 0 ? _a : []).filter(isString); - return new Set([...(this.geojson ? [this.geojson] : []), ...fields]); - } - producedFields() { - return new Set(); - } - hash() { - return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`; - } - assemble() { - return Object.assign(Object.assign(Object.assign({ type: 'geojson' }, (this.fields ? { fields: this.fields } : {})), (this.geojson ? { geojson: this.geojson } : {})), { signal: this.signal }); - } - } - - class GeoPointNode extends DataFlowNode { - constructor(parent, projection, fields, as) { - super(parent); - this.projection = projection; - this.fields = fields; - this.as = as; - } - clone() { - return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as)); - } - static parseAll(parent, model) { - if (!model.projectionName()) { - return parent; - } - for (const coordinates of [ - [LONGITUDE, LATITUDE], - [LONGITUDE2, LATITUDE2] - ]) { - const pair = coordinates.map(channel => { - const def = getFieldOrDatumDef(model.encoding[channel]); - return isFieldDef(def) - ? def.field - : isDatumDef(def) - ? { expr: `${def.datum}` } - : isValueDef(def) - ? { expr: `${def['value']}` } - : undefined; - }); - const suffix = coordinates[0] === LONGITUDE2 ? '2' : ''; - if (pair[0] || pair[1]) { - parent = new GeoPointNode(parent, model.projectionName(), pair, [ - model.getName('x' + suffix), - model.getName('y' + suffix) - ]); - } - } - return parent; - } - dependentFields() { - return new Set(this.fields.filter(isString)); - } - producedFields() { - return new Set(this.as); - } - hash() { - return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`; - } - assemble() { - return { - type: 'geopoint', - projection: this.projection, - fields: this.fields, - as: this.as - }; - } - } - - class ImputeNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new ImputeNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.impute, this.transform.key, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set([this.transform.impute]); - } - processSequence(keyvals) { - const { start = 0, stop, step } = keyvals; - const result = [start, stop, ...(step ? [step] : [])].join(','); - return { signal: `sequence(${result})` }; - } - static makeFromTransform(parent, imputeTransform) { - return new ImputeNode(parent, imputeTransform); - } - static makeFromEncoding(parent, model) { - const encoding = model.encoding; - const xDef = encoding.x; - const yDef = encoding.y; - if (isFieldDef(xDef) && isFieldDef(yDef)) { - const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined; - if (imputedChannel === undefined) { - return undefined; - } - const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined; - const { method, value, frame, keyvals } = imputedChannel.impute; - const groupbyFields = pathGroupingFields(model.mark, encoding); - return new ImputeNode(parent, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ impute: imputedChannel.field, key: keyChannel.field }, (method ? { method } : {})), (value !== undefined ? { value } : {})), (frame ? { frame } : {})), (keyvals !== undefined ? { keyvals } : {})), (groupbyFields.length ? { groupby: groupbyFields } : {}))); - } - return null; - } - hash() { - return `Impute ${hash(this.transform)}`; - } - assemble() { - const { impute, key, keyvals, method, groupby, value, frame = [null, null] } = this.transform; - const imputeTransform = Object.assign(Object.assign(Object.assign(Object.assign({ type: 'impute', field: impute, key }, (keyvals ? { keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals } : {})), { method: 'value' }), (groupby ? { groupby } : {})), { value: !method || method === 'value' ? value : null }); - if (method && method !== 'value') { - const deriveNewField = Object.assign({ type: 'window', as: [`imputed_${impute}_value`], ops: [method], fields: [impute], frame, ignorePeers: false }, (groupby ? { groupby } : {})); - const replaceOriginal = { - type: 'formula', - expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`, - as: impute - }; - return [imputeTransform, deriveNewField, replaceOriginal]; - } - else { - return [imputeTransform]; - } - } - } - - /** - * A class for loess transform nodes - */ - class LoessTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : transform.on, (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : transform.loess]; - } - clone() { - return new LoessTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.loess, this.transform.on, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `LoessTransform ${hash(this.transform)}`; - } - assemble() { - const _a = this.transform, { loess, on } = _a, rest = __rest(_a, ["loess", "on"]); - const result = Object.assign({ type: 'loess', x: on, y: loess }, rest); - return result; - } - } - - class LookupNode extends DataFlowNode { - constructor(parent, transform, secondary) { - super(parent); - this.transform = transform; - this.secondary = secondary; - } - clone() { - return new LookupNode(null, duplicate(this.transform), this.secondary); - } - static make(parent, model, transform, counter) { - const sources = model.component.data.sources; - const { from } = transform; - let fromOutputNode = null; - if (isLookupData(from)) { - let fromSource = findSource(from.data, sources); - if (!fromSource) { - fromSource = new SourceNode(from.data); - sources.push(fromSource); - } - const fromOutputName = model.getName(`lookup_${counter}`); - fromOutputNode = new OutputNode(fromSource, fromOutputName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); - model.component.data.outputNodes[fromOutputName] = fromOutputNode; - } - else if (isLookupSelection(from)) { - const selName = from.selection; - transform = Object.assign({ as: selName }, transform); - fromOutputNode = model.getSelectionComponent(varName(selName), selName).materialized; - if (!fromOutputNode) { - throw new Error(noSameUnitLookup(selName)); - } - } - return new LookupNode(parent, transform, fromOutputNode.getSource()); - } - dependentFields() { - return new Set([this.transform.lookup]); - } - producedFields() { - return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields); - } - hash() { - return `Lookup ${hash({ transform: this.transform, secondary: this.secondary })}`; - } - assemble() { - let foreign; - if (this.transform.from.fields) { - // lookup a few fields and add create a flat output - foreign = Object.assign({ values: this.transform.from.fields }, (this.transform.as ? { as: array(this.transform.as) } : {})); - } - else { - // lookup full record and nest it - let asName = this.transform.as; - if (!isString(asName)) { - warn(NO_FIELDS_NEEDS_AS); - asName = '_lookup'; - } - foreign = { - as: [asName] - }; - } - return Object.assign(Object.assign({ type: 'lookup', from: this.secondary, key: this.transform.from.key, fields: [this.transform.lookup] }, foreign), (this.transform.default ? { default: this.transform.default } : {})); - } - } - - /** - * A class for quantile transform nodes - */ - class QuantileTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'prob', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'value']; - } - clone() { - return new QuantileTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.quantile, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `QuantileTransform ${hash(this.transform)}`; - } - assemble() { - const _a = this.transform, { quantile } = _a, rest = __rest(_a, ["quantile"]); - const result = Object.assign({ type: 'quantile', field: quantile }, rest); - return result; - } - } - - /** - * A class for regression transform nodes - */ - class RegressionTransformNode extends DataFlowNode { - constructor(parent, transform) { - var _a, _b, _c; - super(parent); - this.transform = transform; - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = (_a = this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined]; - this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : transform.on, (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : transform.regression]; - } - clone() { - return new RegressionTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - var _a; - return new Set([this.transform.regression, this.transform.on, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - producedFields() { - return new Set(this.transform.as); - } - hash() { - return `RegressionTransform ${hash(this.transform)}`; - } - assemble() { - const _a = this.transform, { regression, on } = _a, rest = __rest(_a, ["regression", "on"]); - const result = Object.assign({ type: 'regression', x: on, y: regression }, rest); - return result; - } - } - - /** - * A class for pivot transform nodes. - */ - class PivotTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new PivotTransformNode(null, duplicate(this.transform)); - } - addDimensions(fields) { - var _a; - this.transform.groupby = unique(((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []).concat(fields), d => d); - } - producedFields() { - return undefined; // return undefined so that potentially everything can depend on the pivot - } - dependentFields() { - var _a; - return new Set([this.transform.pivot, this.transform.value, ...((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])]); - } - hash() { - return `PivotTransform ${hash(this.transform)}`; - } - assemble() { - const { pivot, value, groupby, limit, op } = this.transform; - return Object.assign(Object.assign(Object.assign({ type: 'pivot', field: pivot, value }, (limit !== undefined ? { limit } : {})), (op !== undefined ? { op } : {})), (groupby !== undefined ? { groupby } : {})); - } - } - - /** - * A class for the sample transform nodes - */ - class SampleTransformNode extends DataFlowNode { - constructor(parent, transform) { - super(parent); - this.transform = transform; - } - clone() { - return new SampleTransformNode(null, duplicate(this.transform)); - } - dependentFields() { - return new Set(); - } - producedFields() { - return new Set(); - } - hash() { - return `SampleTransform ${hash(this.transform)}`; - } - assemble() { - return { - type: 'sample', - size: this.transform.sample - }; - } - } - - function makeWalkTree(data) { - // to name datasources - let datasetIndex = 0; - /** - * Recursively walk down the tree. - */ - function walkTree(node, dataSource) { - var _a; - if (node instanceof SourceNode) { - // If the source is a named data source or a data source with values, we need - // to put it in a different data source. Otherwise, Vega may override the data. - if (!node.isGenerator && !isUrlData(node.data)) { - data.push(dataSource); - const newData = { - name: null, - source: dataSource.name, - transform: [] - }; - dataSource = newData; - } - } - if (node instanceof ParseNode) { - if (node.parent instanceof SourceNode && !dataSource.source) { - // If node's parent is a root source and the data source does not refer to another data source, use normal format parse - dataSource.format = Object.assign(Object.assign({}, ((_a = dataSource.format) !== null && _a !== void 0 ? _a : {})), { parse: node.assembleFormatParse() }); - // add calculates for all nested fields - dataSource.transform.push(...node.assembleTransforms(true)); - } - else { - // Otherwise use Vega expression to parse - dataSource.transform.push(...node.assembleTransforms()); - } - } - if (node instanceof FacetNode) { - if (!dataSource.name) { - dataSource.name = `data_${datasetIndex++}`; - } - if (!dataSource.source || dataSource.transform.length > 0) { - data.push(dataSource); - node.data = dataSource.name; - } - else { - node.data = dataSource.source; - } - for (const d of node.assemble()) { - data.push(d); - } - // break here because the rest of the tree has to be taken care of by the facet. - return; - } - if (node instanceof GraticuleNode || - node instanceof SequenceNode || - node instanceof FilterInvalidNode || - node instanceof FilterNode || - node instanceof CalculateNode || - node instanceof GeoPointNode || - node instanceof GeoJSONNode || - node instanceof AggregateNode || - node instanceof LookupNode || - node instanceof WindowTransformNode || - node instanceof JoinAggregateTransformNode || - node instanceof FoldTransformNode || - node instanceof FlattenTransformNode || - node instanceof DensityTransformNode || - node instanceof LoessTransformNode || - node instanceof QuantileTransformNode || - node instanceof RegressionTransformNode || - node instanceof IdentifierNode || - node instanceof SampleTransformNode || - node instanceof PivotTransformNode) { - dataSource.transform.push(node.assemble()); - } - if (node instanceof BinNode || - node instanceof TimeUnitNode || - node instanceof ImputeNode || - node instanceof StackNode) { - dataSource.transform.push(...node.assemble()); - } - if (node instanceof OutputNode) { - if (dataSource.source && dataSource.transform.length === 0) { - node.setSource(dataSource.source); - } - else if (node.parent instanceof OutputNode) { - // Note that an output node may be required but we still do not assemble a - // separate data source for it. - node.setSource(dataSource.name); - } - else { - if (!dataSource.name) { - dataSource.name = `data_${datasetIndex++}`; - } - // Here we set the name of the datasource we generated. From now on - // other assemblers can use it. - node.setSource(dataSource.name); - // if this node has more than one child, we will add a datasource automatically - if (node.numChildren() === 1) { - data.push(dataSource); - const newData = { - name: null, - source: dataSource.name, - transform: [] - }; - dataSource = newData; - } - } - } - switch (node.numChildren()) { - case 0: - // done - if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) { - // do not push empty datasources that are simply references - data.push(dataSource); - } - break; - case 1: - walkTree(node.children[0], dataSource); - break; - default: { - if (!dataSource.name) { - dataSource.name = `data_${datasetIndex++}`; - } - let source = dataSource.name; - if (!dataSource.source || dataSource.transform.length > 0) { - data.push(dataSource); - } - else { - source = dataSource.source; - } - for (const child of node.children) { - const newData = { - name: null, - source: source, - transform: [] - }; - walkTree(child, newData); - } - break; - } - } - } - return walkTree; - } - /** - * Assemble data sources that are derived from faceted data. - */ - function assembleFacetData(root) { - const data = []; - const walkTree = makeWalkTree(data); - for (const child of root.children) { - walkTree(child, { - source: root.name, - name: null, - transform: [] - }); - } - return data; - } - /** - * Create Vega data array from a given compiled model and append all of them to the given array - * - * @param model - * @param data array - * @return modified data array - */ - function assembleRootData(dataComponent, datasets) { - var _a, _b; - const data = []; - // dataComponent.sources.forEach(debug); - // draw(dataComponent.sources); - const walkTree = makeWalkTree(data); - let sourceIndex = 0; - for (const root of dataComponent.sources) { - // assign a name if the source does not have a name yet - if (!root.hasName()) { - root.dataName = `source_${sourceIndex++}`; - } - const newData = root.assemble(); - walkTree(root, newData); - } - // remove empty transform arrays for cleaner output - for (const d of data) { - if (d.transform.length === 0) { - delete d.transform; - } - } - // move sources without transforms (the ones that are potentially used in lookups) to the beginning - let whereTo = 0; - for (const [i, d] of data.entries()) { - if (((_a = d.transform) !== null && _a !== void 0 ? _a : []).length === 0 && !d.source) { - data.splice(whereTo++, 0, data.splice(i, 1)[0]); - } - } - // now fix the from references in lookup transforms - for (const d of data) { - for (const t of (_b = d.transform) !== null && _b !== void 0 ? _b : []) { - if (t.type === 'lookup') { - t.from = dataComponent.outputNodes[t.from].getSource(); - } - } - } - // inline values for datasets that are in the datastore - for (const d of data) { - if (d.name in datasets) { - d.values = datasets[d.name]; - } - } - return data; - } - - function getHeaderType(orient) { - if (orient === 'top' || orient === 'left' || isSignalRef(orient)) { - // we always use header for orient signal since we can't dynamically make header becomes footer - return 'header'; - } - return 'footer'; - } - function parseFacetHeaders(model) { - for (const channel of FACET_CHANNELS) { - parseFacetHeader(model, channel); - } - mergeChildAxis(model, 'x'); - mergeChildAxis(model, 'y'); - } - function parseFacetHeader(model, channel) { - var _a; - const { facet, config, child, component } = model; - if (model.channelHasField(channel)) { - const fieldDef = facet[channel]; - const titleConfig = getHeaderProperty('title', null, config, channel); - let title$1 = title(fieldDef, config, { - allowDisabling: true, - includeDefault: titleConfig === undefined || !!titleConfig - }); - if (child.component.layoutHeaders[channel].title) { - // TODO: better handle multiline titles - title$1 = isArray(title$1) ? title$1.join(', ') : title$1; - // merge title with child to produce "Title / Subtitle / Sub-subtitle" - title$1 += ' / ' + child.component.layoutHeaders[channel].title; - child.component.layoutHeaders[channel].title = null; - } - const labelOrient = getHeaderProperty('labelOrient', fieldDef, config, channel); - const header = (_a = fieldDef.header) !== null && _a !== void 0 ? _a : {}; - const labels = getFirstDefined(header.labels, config.header.labels, true); - const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header'; - component.layoutHeaders[channel] = { - title: title$1, - facetFieldDef: fieldDef, - [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)] - }; - } - } - function makeHeaderComponent(model, channel, labels) { - const sizeType = channel === 'row' ? 'height' : 'width'; - return { - labels, - sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined, - axes: [] - }; - } - function mergeChildAxis(model, channel) { - var _a; - const { child } = model; - if (child.component.axes[channel]) { - const { layoutHeaders, resolve } = model.component; - resolve.axis[channel] = parseGuideResolve(resolve, channel); - if (resolve.axis[channel] === 'shared') { - // For shared axis, move the axes to facet's header or footer - const headerChannel = channel === 'x' ? 'column' : 'row'; - const layoutHeader = layoutHeaders[headerChannel]; - for (const axisComponent of child.component.axes[channel]) { - const headerType = getHeaderType(axisComponent.get('orient')); - layoutHeader[headerType] = (_a = layoutHeader[headerType]) !== null && _a !== void 0 ? _a : [makeHeaderComponent(model, headerChannel, false)]; - // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes - const mainAxis = assembleAxis(axisComponent, 'main', model.config, { header: true }); - if (mainAxis) { - // LayoutHeader no longer keep track of property precedence, thus let's combine. - layoutHeader[headerType][0].axes.push(mainAxis); - } - axisComponent.mainExtracted = true; - } - } - } - } - - function parseLayerLayoutSize(model) { - parseChildrenLayoutSize(model); - parseNonUnitLayoutSizeForChannel(model, 'width'); - parseNonUnitLayoutSizeForChannel(model, 'height'); - } - function parseConcatLayoutSize(model) { - parseChildrenLayoutSize(model); - // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth. - const widthType = model.layout.columns === 1 ? 'width' : 'childWidth'; - // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight. - const heightType = model.layout.columns === undefined ? 'height' : 'childHeight'; - parseNonUnitLayoutSizeForChannel(model, widthType); - parseNonUnitLayoutSizeForChannel(model, heightType); - } - function parseChildrenLayoutSize(model) { - for (const child of model.children) { - child.parseLayoutSize(); - } - } - /** - * Merge child layout size (width or height). - */ - function parseNonUnitLayoutSizeForChannel(model, layoutSizeType) { - /* - * For concat, the parent width or height might not be the same as the children's shared height. - * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width. - * - * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height) - * while the sizeType represents the properties of the child. - */ - const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); - const channel = getPositionScaleChannel(sizeType); - const resolve = model.component.resolve; - const layoutSizeCmpt = model.component.layoutSize; - let mergedSize; - // Try to merge layout size - for (const child of model.children) { - const childSize = child.component.layoutSize.getWithExplicit(sizeType); - const scaleResolve = resolve.scale[channel]; - if (scaleResolve === 'independent' && childSize.value === 'step') { - // Do not merge independent scales with range-step as their size depends - // on the scale domains, which can be different between scales. - mergedSize = undefined; - break; - } - if (mergedSize) { - if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) { - // For independent scale, only merge if all the sizes are the same. - // If the values are different, abandon the merge! - mergedSize = undefined; - break; - } - mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, ''); - } - else { - mergedSize = childSize; - } - } - if (mergedSize) { - // If merged, rename size and set size of all children. - for (const child of model.children) { - model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType)); - child.component.layoutSize.set(sizeType, 'merged', false); - } - layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize); - } - else { - layoutSizeCmpt.setWithExplicit(layoutSizeType, { - explicit: false, - value: undefined - }); - } - } - function parseUnitLayoutSize(model) { - const { size, component } = model; - for (const channel of POSITION_SCALE_CHANNELS) { - const sizeType = getSizeChannel(channel); - if (size[sizeType]) { - const specifiedSize = size[sizeType]; - component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true); - } - else { - const defaultSize = defaultUnitSize(model, sizeType); - component.layoutSize.set(sizeType, defaultSize, false); - } - } - } - function defaultUnitSize(model, sizeType) { - const channel = sizeType === 'width' ? 'x' : 'y'; - const config = model.config; - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const range = scaleComponent.get('range'); - if (hasDiscreteDomain(scaleType)) { - const size = getViewConfigDiscreteSize(config.view, sizeType); - if (isVgRangeStep(range) || isStep(size)) { - // For discrete domain with range.step, use dynamic width/height - return 'step'; - } - else { - return size; - } - } - else { - return getViewConfigContinuousSize(config.view, sizeType); - } - } - else if (model.hasProjection || model.mark === 'arc') { - // arc should use continuous size by default otherwise the pie is extremely small - return getViewConfigContinuousSize(config.view, sizeType); - } - else { - const size = getViewConfigDiscreteSize(config.view, sizeType); - return isStep(size) ? size.step : size; - } - } - - function facetSortFieldName(fieldDef, sort, opt) { - return vgField(sort, Object.assign({ suffix: `by_${vgField(fieldDef)}` }, (opt !== null && opt !== void 0 ? opt : {}))); - } - class FacetModel extends ModelWithField { - constructor(spec, parent, parentGivenName, config) { - super(spec, 'facet', parent, parentGivenName, config, spec.resolve); - this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config); - this.children = [this.child]; - this.facet = this.initFacet(spec.facet, config); - } - initFacet(facet, config) { - // clone to prevent side effect to the original spec - if (!isFacetMapping(facet)) { - return { facet: initChannelDef(facet, 'facet', config) }; - } - return reduce(facet, (normalizedFacet, fieldDef, channel) => { - if (!contains([ROW, COLUMN], channel)) { - // Drop unsupported channel - warn(incompatibleChannel(channel, 'facet')); - return normalizedFacet; - } - if (fieldDef.field === undefined) { - warn(emptyFieldDef(fieldDef, channel)); - return normalizedFacet; - } - // Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. - normalizedFacet[channel] = initChannelDef(fieldDef, channel, config); - return normalizedFacet; - }, {}); - } - channelHasField(channel) { - return !!this.facet[channel]; - } - fieldDef(channel) { - return this.facet[channel]; - } - parseData() { - this.component.data = parseData(this); - this.child.parseData(); - } - parseLayoutSize() { - parseChildrenLayoutSize(this); - } - parseSelections() { - // As a facet has a single child, the selection components are the same. - // The child maintains its selections to assemble signals, which remain - // within its unit. - this.child.parseSelections(); - this.component.selection = this.child.component.selection; - } - parseMarkGroup() { - this.child.parseMarkGroup(); - } - parseAxesAndHeaders() { - this.child.parseAxesAndHeaders(); - parseFacetHeaders(this); - } - assembleSelectionTopLevelSignals(signals) { - return this.child.assembleSelectionTopLevelSignals(signals); - } - assembleSignals() { - this.child.assembleSignals(); - return []; - } - assembleSelectionData(data) { - return this.child.assembleSelectionData(data); - } - getHeaderLayoutMixins() { - var _a, _b, _c; - const layoutMixins = {}; - for (const channel of FACET_CHANNELS) { - for (const headerType of HEADER_TYPES) { - const layoutHeaderComponent = this.component.layoutHeaders[channel]; - const headerComponent = layoutHeaderComponent[headerType]; - const { facetFieldDef } = layoutHeaderComponent; - if (facetFieldDef) { - const titleOrient = getHeaderProperty('titleOrient', facetFieldDef, this.config, channel); - if (contains(['right', 'bottom'], titleOrient)) { - const headerChannel = getHeaderChannel(channel, titleOrient); - layoutMixins.titleAnchor = (_a = layoutMixins.titleAnchor) !== null && _a !== void 0 ? _a : {}; - layoutMixins.titleAnchor[headerChannel] = 'end'; - } - } - if (headerComponent === null || headerComponent === void 0 ? void 0 : headerComponent[0]) { - // set header/footerBand - const sizeType = channel === 'row' ? 'height' : 'width'; - const bandType = headerType === 'header' ? 'headerBand' : 'footerBand'; - if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) { - // If facet child does not have size signal, then apply headerBand - layoutMixins[bandType] = (_b = layoutMixins[bandType]) !== null && _b !== void 0 ? _b : {}; - layoutMixins[bandType][channel] = 0.5; - } - if (layoutHeaderComponent.title) { - layoutMixins.offset = (_c = layoutMixins.offset) !== null && _c !== void 0 ? _c : {}; - layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10; - } - } - } - } - return layoutMixins; - } - assembleDefaultLayout() { - const { column, row } = this.facet; - const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined; - let align = 'all'; - // Do not align the cells if the scale corresponding to the direction is indepent. - // We always align when we facet into both row and column. - if (!row && this.component.resolve.scale.x === 'independent') { - align = 'none'; - } - else if (!column && this.component.resolve.scale.y === 'independent') { - align = 'none'; - } - return Object.assign(Object.assign(Object.assign({}, this.getHeaderLayoutMixins()), (columns ? { columns } : {})), { bounds: 'full', align }); - } - assembleLayoutSignals() { - // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales. - return this.child.assembleLayoutSignals(); - } - columnDistinctSignal() { - if (this.parent && this.parent instanceof FacetModel) { - // For nested facet, we will add columns to group mark instead - // See discussion in https://github.com/vega/vega/issues/952 - // and https://github.com/vega/vega-view/releases/tag/v1.2.6 - return undefined; - } - else { - // In facetNode.assemble(), the name is always this.getName('column') + '_layout'. - const facetLayoutDataName = this.getName('column_domain'); - return { signal: `length(data('${facetLayoutDataName}'))` }; - } - } - assembleGroup(signals) { - if (this.parent && this.parent instanceof FacetModel) { - // Provide number of columns for layout. - // See discussion in https://github.com/vega/vega/issues/952 - // and https://github.com/vega/vega-view/releases/tag/v1.2.6 - return Object.assign(Object.assign({}, (this.channelHasField('column') - ? { - encode: { - update: { - // TODO(https://github.com/vega/vega-lite/issues/2759): - // Correct the signal for facet of concat of facet_column - columns: { field: vgField(this.facet.column, { prefix: 'distinct' }) } - } - } - } - : {})), super.assembleGroup(signals)); - } - return super.assembleGroup(signals); - } - /** - * Aggregate cardinality for calculating size - */ - getCardinalityAggregateForChild() { - const fields = []; - const ops = []; - const as = []; - if (this.child instanceof FacetModel) { - if (this.child.channelHasField('column')) { - const field = vgField(this.child.facet.column); - fields.push(field); - ops.push('distinct'); - as.push(`distinct_${field}`); - } - } - else { - for (const channel of POSITION_SCALE_CHANNELS) { - const childScaleComponent = this.child.component.scales[channel]; - if (childScaleComponent && !childScaleComponent.merged) { - const type = childScaleComponent.get('type'); - const range = childScaleComponent.get('range'); - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const domain = assembleDomain(this.child, channel); - const field = getFieldFromDomain(domain); - if (field) { - fields.push(field); - ops.push('distinct'); - as.push(`distinct_${field}`); - } - else { - warn(unknownField(channel)); - } - } - } - } - } - return { fields, ops, as }; - } - assembleFacet() { - const { name, data } = this.component.data.facetRoot; - const { row, column } = this.facet; - const { fields, ops, as } = this.getCardinalityAggregateForChild(); - const groupby = []; - for (const channel of FACET_CHANNELS) { - const fieldDef = this.facet[channel]; - if (fieldDef) { - groupby.push(vgField(fieldDef)); - const { bin, sort } = fieldDef; - if (isBinning(bin)) { - groupby.push(vgField(fieldDef, { binSuffix: 'end' })); - } - if (isSortField(sort)) { - const { field, op = DEFAULT_SORT_OP } = sort; - const outputName = facetSortFieldName(fieldDef, sort); - if (row && column) { - // For crossed facet, use pre-calculate field as it requires a different groupby - // For each calculated field, apply max and assign them to the same name as - // all values of the same group should be the same anyway. - fields.push(outputName); - ops.push('max'); - as.push(outputName); - } - else { - fields.push(field); - ops.push(op); - as.push(outputName); - } - } - else if (isArray(sort)) { - const outputName = sortArrayIndexField(fieldDef, channel); - fields.push(outputName); - ops.push('max'); - as.push(outputName); - } - } - } - const cross = !!row && !!column; - return Object.assign({ name, - data, - groupby }, (cross || fields.length > 0 - ? { - aggregate: Object.assign(Object.assign({}, (cross ? { cross } : {})), (fields.length ? { fields, ops, as } : {})) - } - : {})); - } - facetSortFields(channel) { - const { facet } = this; - const fieldDef = facet[channel]; - if (fieldDef) { - if (isSortField(fieldDef.sort)) { - return [facetSortFieldName(fieldDef, fieldDef.sort, { expr: 'datum' })]; - } - else if (isArray(fieldDef.sort)) { - return [sortArrayIndexField(fieldDef, channel, { expr: 'datum' })]; - } - return [vgField(fieldDef, { expr: 'datum' })]; - } - return []; - } - facetSortOrder(channel) { - const { facet } = this; - const fieldDef = facet[channel]; - if (fieldDef) { - const { sort } = fieldDef; - const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending'; - return [order]; - } - return []; - } - assembleLabelTitle() { - const { facet, config } = this; - if (facet.facet) { - // Facet always uses title to display labels - return assembleLabelTitle(facet.facet, 'facet', config); - } - const ORTHOGONAL_ORIENT = { - row: ['top', 'bottom'], - column: ['left', 'right'] - }; - for (const channel of HEADER_CHANNELS) { - if (facet[channel]) { - const labelOrient = getHeaderProperty('labelOrient', facet[channel], config, channel); - if (contains(ORTHOGONAL_ORIENT[channel], labelOrient)) { - // Row/Column with orthogonal labelOrient must use title to display labels - return assembleLabelTitle(facet[channel], channel, config); - } - } - } - return undefined; - } - assembleMarks() { - const { child } = this; - // If we facet by two dimensions, we need to add a cross operator to the aggregation - // so that we create all groups - const facetRoot = this.component.data.facetRoot; - const data = assembleFacetData(facetRoot); - const encodeEntry = child.assembleGroupEncodeEntry(false); - const title = this.assembleLabelTitle() || child.assembleTitle(); - const style = child.assembleGroupStyle(); - const markGroup = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name: this.getName('cell'), type: 'group' }, (title ? { title } : {})), (style ? { style } : {})), { from: { - facet: this.assembleFacet() - }, - // TODO: move this to after data - sort: { - field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(), - order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat() - } }), (data.length > 0 ? { data: data } : {})), (encodeEntry ? { encode: { update: encodeEntry } } : {})), child.assembleGroup(assembleFacetSignals(this, []))); - return [markGroup]; - } - getMapping() { - return this.facet; - } - } - - function makeJoinAggregateFromFacet(parent, facet) { - const { row, column } = facet; - if (row && column) { - let newParent = null; - // only need to make one for crossed facet - for (const fieldDef of [row, column]) { - if (isSortField(fieldDef.sort)) { - const { field, op = DEFAULT_SORT_OP } = fieldDef.sort; - parent = newParent = new JoinAggregateTransformNode(parent, { - joinaggregate: [ - { - op, - field, - as: facetSortFieldName(fieldDef, fieldDef.sort, { forAs: true }) - } - ], - groupby: [vgField(fieldDef)] - }); - } - } - return newParent; - } - return null; - } - - function findSource(data, sources) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - for (const other of sources) { - const otherData = other.data; - // if both datasets have a name defined, we cannot merge - if (data.name && other.hasName() && data.name !== other.dataName) { - continue; - } - // feature and mesh are mutually exclusive - if (((_a = data['format']) === null || _a === void 0 ? void 0 : _a.mesh) && ((_b = otherData.format) === null || _b === void 0 ? void 0 : _b.feature)) { - continue; - } - // we have to extract the same feature or mesh - if ((((_c = data['format']) === null || _c === void 0 ? void 0 : _c.feature) || ((_d = otherData.format) === null || _d === void 0 ? void 0 : _d.feature)) && - ((_e = data['format']) === null || _e === void 0 ? void 0 : _e.feature) !== ((_f = otherData.format) === null || _f === void 0 ? void 0 : _f.feature)) { - continue; - } - if ((((_g = data['format']) === null || _g === void 0 ? void 0 : _g.mesh) || ((_h = otherData.format) === null || _h === void 0 ? void 0 : _h.mesh)) && ((_j = data['format']) === null || _j === void 0 ? void 0 : _j.mesh) !== ((_k = otherData.format) === null || _k === void 0 ? void 0 : _k.mesh)) { - continue; - } - if (isInlineData(data) && isInlineData(otherData)) { - if (deepEqual(data.values, otherData.values)) { - return other; - } - } - else if (isUrlData(data) && isUrlData(otherData)) { - if (data.url === otherData.url) { - return other; - } - } - else if (isNamedData(data)) { - if (data.name === other.dataName) { - return other; - } - } - } - return null; - } - function parseRoot(model, sources) { - if (model.data || !model.parent) { - // if the model defines a data source or is the root, create a source node - if (model.data === null) { - // data: null means we should ignore the parent's data so we just create a new data source - const source = new SourceNode({ values: [] }); - sources.push(source); - return source; - } - const existingSource = findSource(model.data, sources); - if (existingSource) { - if (!isGenerator(model.data)) { - existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format); - } - // if the new source has a name but the existing one does not, we can set it - if (!existingSource.hasName() && model.data.name) { - existingSource.dataName = model.data.name; - } - return existingSource; - } - else { - const source = new SourceNode(model.data); - sources.push(source); - return source; - } - } - else { - // If we don't have a source defined (overriding parent's data), use the parent's facet root or main. - return model.parent.component.data.facetRoot - ? model.parent.component.data.facetRoot - : model.parent.component.data.main; - } - } - /** - * Parses a transform array into a chain of connected dataflow nodes. - */ - function parseTransformArray(head, model, ancestorParse) { - var _a, _b; - let lookupCounter = 0; - for (const t of model.transforms) { - let derivedType = undefined; - let transformNode; - if (isCalculate(t)) { - transformNode = head = new CalculateNode(head, t); - derivedType = 'derived'; - } - else if (isFilter(t)) { - const implicit = getImplicitFromFilterTransform(t); - transformNode = head = (_a = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse)) !== null && _a !== void 0 ? _a : head; - head = new FilterNode(head, model, t.filter); - } - else if (isBin(t)) { - transformNode = head = BinNode.makeFromTransform(head, t, model); - derivedType = 'number'; - } - else if (isTimeUnit(t)) { - derivedType = 'date'; - const parsedAs = ancestorParse.getWithExplicit(t.field); - // Create parse node because the input to time unit is always date. - if (parsedAs.value === undefined) { - head = new ParseNode(head, { [t.field]: derivedType }); - ancestorParse.set(t.field, derivedType, false); - } - transformNode = head = TimeUnitNode.makeFromTransform(head, t); - } - else if (isAggregate$1(t)) { - transformNode = head = AggregateNode.makeFromTransform(head, t); - derivedType = 'number'; - if (requiresSelectionId(model)) { - head = new IdentifierNode(head); - } - } - else if (isLookup(t)) { - transformNode = head = LookupNode.make(head, model, t, lookupCounter++); - derivedType = 'derived'; - } - else if (isWindow(t)) { - transformNode = head = new WindowTransformNode(head, t); - derivedType = 'number'; - } - else if (isJoinAggregate(t)) { - transformNode = head = new JoinAggregateTransformNode(head, t); - derivedType = 'number'; - } - else if (isStack(t)) { - transformNode = head = StackNode.makeFromTransform(head, t); - derivedType = 'derived'; - } - else if (isFold(t)) { - transformNode = head = new FoldTransformNode(head, t); - derivedType = 'derived'; - } - else if (isFlatten(t)) { - transformNode = head = new FlattenTransformNode(head, t); - derivedType = 'derived'; - } - else if (isPivot(t)) { - transformNode = head = new PivotTransformNode(head, t); - derivedType = 'derived'; - } - else if (isSample(t)) { - head = new SampleTransformNode(head, t); - } - else if (isImpute(t)) { - transformNode = head = ImputeNode.makeFromTransform(head, t); - derivedType = 'derived'; - } - else if (isDensity(t)) { - transformNode = head = new DensityTransformNode(head, t); - derivedType = 'derived'; - } - else if (isQuantile(t)) { - transformNode = head = new QuantileTransformNode(head, t); - derivedType = 'derived'; - } - else if (isRegression(t)) { - transformNode = head = new RegressionTransformNode(head, t); - derivedType = 'derived'; - } - else if (isLoess(t)) { - transformNode = head = new LoessTransformNode(head, t); - derivedType = 'derived'; - } - else { - warn(invalidTransformIgnored(t)); - continue; - } - if (transformNode && derivedType !== undefined) { - for (const field of (_b = transformNode.producedFields()) !== null && _b !== void 0 ? _b : []) { - ancestorParse.set(field, derivedType, false); - } - } - } - return head; - } - /* - Description of the dataflow (http://asciiflow.com/): - +--------+ - | Source | - +---+----+ - | - v - FormatParse - (explicit) - | - v - Transforms - (Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...) - | - v - FormatParse - (implicit) - | - v - Binning (in `encoding`) - | - v - Timeunit (in `encoding`) - | - v - Formula From Sort Array - | - v - +--+--+ - | Raw | - +-----+ - | - v - Aggregate (in `encoding`) - | - v - Stack (in `encoding`) - | - v - Invalid Filter - | - v - +----------+ - | Main | - +----------+ - | - v - +-------+ - | Facet |----> "column", "column-layout", and "row" - +-------+ - | - v - ...Child data... - */ - function parseData(model) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - let head = parseRoot(model, model.component.data.sources); - const { outputNodes, outputNodeRefCounts } = model.component.data; - const ancestorParse = model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse(); - const data = model.data; - if (isGenerator(data)) { - // insert generator transform - if (isSequenceGenerator(data)) { - head = new SequenceNode(head, data.sequence); - } - else if (isGraticuleGenerator(data)) { - head = new GraticuleNode(head, data.graticule); - } - // no parsing necessary for generator - ancestorParse.parseNothing = true; - } - else if (((_a = data === null || data === void 0 ? void 0 : data.format) === null || _a === void 0 ? void 0 : _a.parse) === null) { - // format.parse: null means disable parsing - ancestorParse.parseNothing = true; - } - head = (_b = ParseNode.makeExplicit(head, model, ancestorParse)) !== null && _b !== void 0 ? _b : head; - // Default discrete selections require an identifer transform to - // uniquely identify data points. Add this transform at the head of - // the pipeline such that the identifier field is available for all - // subsequent datasets. During optimization, we will remove this - // transform if it proves to be unnecessary. Additional identifier - // transforms will be necessary when new tuples are constructed - // (e.g., post-aggregation). - head = new IdentifierNode(head); - // HACK: This is equivalent for merging bin extent for union scale. - // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale - const parentIsLayer = model.parent && isLayerModel(model.parent); - if (isUnitModel(model) || isFacetModel(model)) { - if (parentIsLayer) { - head = (_c = BinNode.makeFromEncoding(head, model)) !== null && _c !== void 0 ? _c : head; - } - } - if (model.transforms.length > 0) { - head = parseTransformArray(head, model, ancestorParse); - } - // create parse nodes for fields that need to be parsed (or flattened) implicitly - const implicitSelection = getImplicitFromSelection(model); - const implicitEncoding = getImplicitFromEncoding(model); - head = (_d = ParseNode.makeWithAncestors(head, {}, Object.assign(Object.assign({}, implicitSelection), implicitEncoding), ancestorParse)) !== null && _d !== void 0 ? _d : head; - if (isUnitModel(model)) { - head = GeoJSONNode.parseAll(head, model); - head = GeoPointNode.parseAll(head, model); - } - if (isUnitModel(model) || isFacetModel(model)) { - if (!parentIsLayer) { - head = (_e = BinNode.makeFromEncoding(head, model)) !== null && _e !== void 0 ? _e : head; - } - head = (_f = TimeUnitNode.makeFromEncoding(head, model)) !== null && _f !== void 0 ? _f : head; - head = CalculateNode.parseAllForSortIndex(head, model); - } - // add an output node pre aggregation - const rawName = model.getDataName(DataSourceType.Raw); - const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts); - outputNodes[rawName] = raw; - head = raw; - if (isUnitModel(model)) { - const agg = AggregateNode.makeFromEncoding(head, model); - if (agg) { - head = agg; - if (requiresSelectionId(model)) { - head = new IdentifierNode(head); - } - } - head = (_g = ImputeNode.makeFromEncoding(head, model)) !== null && _g !== void 0 ? _g : head; - head = (_h = StackNode.makeFromEncoding(head, model)) !== null && _h !== void 0 ? _h : head; - } - if (isUnitModel(model)) { - head = (_j = FilterInvalidNode.make(head, model)) !== null && _j !== void 0 ? _j : head; - } - // output node for marks - const mainName = model.getDataName(DataSourceType.Main); - const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts); - outputNodes[mainName] = main; - head = main; - if (isUnitModel(model)) { - materializeSelections(model, main); - } - // add facet marker - let facetRoot = null; - if (isFacetModel(model)) { - const facetName = model.getName('facet'); - // Derive new aggregate for facet's sort field - // augment data source with new fields for crossed facet - head = (_k = makeJoinAggregateFromFacet(head, model.facet)) !== null && _k !== void 0 ? _k : head; - facetRoot = new FacetNode(head, model, facetName, main.getSource()); - outputNodes[facetName] = facetRoot; - } - return Object.assign(Object.assign({}, model.component.data), { outputNodes, - outputNodeRefCounts, - raw, - main, - facetRoot, - ancestorParse }); - } - - class ConcatModel extends Model { - constructor(spec, parent, parentGivenName, config) { - var _a, _b, _c, _d; - super(spec, 'concat', parent, parentGivenName, config, spec.resolve); - if (((_b = (_a = spec.resolve) === null || _a === void 0 ? void 0 : _a.axis) === null || _b === void 0 ? void 0 : _b.x) === 'shared' || ((_d = (_c = spec.resolve) === null || _c === void 0 ? void 0 : _c.axis) === null || _d === void 0 ? void 0 : _d.y) === 'shared') { - warn(CONCAT_CANNOT_SHARE_AXIS); - } - this.children = this.getChildren(spec).map((child, i) => { - return buildModel(child, this, this.getName('concat_' + i), undefined, config); - }); - } - parseData() { - this.component.data = parseData(this); - for (const child of this.children) { - child.parseData(); - } - } - parseSelections() { - // Merge selections up the hierarchy so that they may be referenced - // across unit specs. Persist their definitions within each child - // to assemble signals which remain within output Vega unit groups. - this.component.selection = {}; - for (const child of this.children) { - child.parseSelections(); - for (const key of keys(child.component.selection)) { - this.component.selection[key] = child.component.selection[key]; - } - } - } - parseMarkGroup() { - for (const child of this.children) { - child.parseMarkGroup(); - } - } - parseAxesAndHeaders() { - for (const child of this.children) { - child.parseAxesAndHeaders(); - } - // TODO(#2415): support shared axes - } - getChildren(spec) { - if (isVConcatSpec(spec)) { - return spec.vconcat; - } - else if (isHConcatSpec(spec)) { - return spec.hconcat; - } - return spec.concat; - } - parseLayoutSize() { - parseConcatLayoutSize(this); - } - parseAxisGroup() { - return null; - } - assembleSelectionTopLevelSignals(signals) { - return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); - } - assembleSignals() { - this.children.forEach(child => child.assembleSignals()); - return []; - } - assembleLayoutSignals() { - const layoutSignals = assembleLayoutSignals(this); - for (const child of this.children) { - layoutSignals.push(...child.assembleLayoutSignals()); - } - return layoutSignals; - } - assembleSelectionData(data) { - return this.children.reduce((db, child) => child.assembleSelectionData(db), data); - } - assembleMarks() { - // only children have marks - return this.children.map(child => { - const title = child.assembleTitle(); - const style = child.assembleGroupStyle(); - const encodeEntry = child.assembleGroupEncodeEntry(false); - return Object.assign(Object.assign(Object.assign(Object.assign({ type: 'group', name: child.getName('group') }, (title ? { title } : {})), (style ? { style } : {})), (encodeEntry ? { encode: { update: encodeEntry } } : {})), child.assembleGroup()); - }); - } - assembleDefaultLayout() { - const columns = this.layout.columns; - return Object.assign(Object.assign({}, (columns != null ? { columns: columns } : {})), { bounds: 'full', - // Use align each so it can work with multiple plots with different size - align: 'each' }); - } - } - - function isFalseOrNull(v) { - return v === false || v === null; - } - const AXIS_COMPONENT_PROPERTIES_INDEX = Object.assign(Object.assign({ disable: 1, gridScale: 1, scale: 1 }, COMMON_AXIS_PROPERTIES_INDEX), { labelExpr: 1, encode: 1 }); - const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX); - class AxisComponent extends Split { - constructor(explicit = {}, implicit = {}, mainExtracted = false) { - super(); - this.explicit = explicit; - this.implicit = implicit; - this.mainExtracted = mainExtracted; - } - clone() { - return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted); - } - hasAxisPart(part) { - // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme. - if (part === 'axis') { - // always has the axis container part - return true; - } - if (part === 'grid' || part === 'title') { - return !!this.get(part); - } - // Other parts are enabled by default, so they should not be false or null. - return !isFalseOrNull(this.get(part)); - } - hasOrientSignalRef() { - return isSignalRef(this.explicit.orient); - } - } - - function labels$1(model, channel, specifiedLabelsSpec) { - var _a; - const { encoding, config } = model; - const fieldOrDatumDef = (_a = getFieldOrDatumDef(encoding[channel])) !== null && _a !== void 0 ? _a : getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]); - const axis = model.axis(channel) || {}; - const { format, formatType } = axis; - if (isCustomFormatType(formatType)) { - return Object.assign({ text: formatCustomType({ - fieldOrDatumDef, - field: 'datum.value', - format, - formatType, - config - }) }, specifiedLabelsSpec); - } - return specifiedLabelsSpec; - } - - function parseUnitAxes(model) { - return POSITION_SCALE_CHANNELS.reduce((axis, channel) => { - if (model.component.scales[channel]) { - axis[channel] = [parseAxis(channel, model)]; - } - return axis; - }, {}); - } - const OPPOSITE_ORIENT = { - bottom: 'top', - top: 'bottom', - left: 'right', - right: 'left' - }; - function parseLayerAxes(model) { - var _a; - const { axes, resolve } = model.component; - const axisCount = { top: 0, bottom: 0, right: 0, left: 0 }; - for (const child of model.children) { - child.parseAxesAndHeaders(); - for (const channel of keys(child.component.axes)) { - resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel); - if (resolve.axis[channel] === 'shared') { - // If the resolve says shared (and has not been overridden) - // We will try to merge and see if there is a conflict - axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]); - if (!axes[channel]) { - // If merge returns nothing, there is a conflict so we cannot make the axis shared. - // Thus, mark axis as independent and remove the axis component. - resolve.axis[channel] = 'independent'; - delete axes[channel]; - } - } - } - } - // Move axes to layer's axis component and merge shared axes - for (const channel of POSITION_SCALE_CHANNELS) { - for (const child of model.children) { - if (!child.component.axes[channel]) { - // skip if the child does not have a particular axis - continue; - } - if (resolve.axis[channel] === 'independent') { - // If axes are independent, concat the axisComponent array. - axes[channel] = ((_a = axes[channel]) !== null && _a !== void 0 ? _a : []).concat(child.component.axes[channel]); - // Automatically adjust orient - for (const axisComponent of child.component.axes[channel]) { - const { value: orient, explicit } = axisComponent.getWithExplicit('orient'); - if (isSignalRef(orient)) { - continue; - } - if (axisCount[orient] > 0 && !explicit) { - // Change axis orient if the number do not match - const oppositeOrient = OPPOSITE_ORIENT[orient]; - if (axisCount[orient] > axisCount[oppositeOrient]) { - axisComponent.set('orient', oppositeOrient, false); - } - } - axisCount[orient]++; - // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset? - } - } - // After merging, make sure to remove axes from child - delete child.component.axes[channel]; - } - // Suppress grid lines for dual axis charts (https://github.com/vega/vega-lite/issues/4676) - if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) { - for (const axisCmpt of axes[channel]) { - if (!!axisCmpt.get('grid') && !axisCmpt.explicit.grid) { - axisCmpt.implicit.grid = false; - } - } - } - } - } - function mergeAxisComponents(mergedAxisCmpts, childAxisCmpts) { - if (mergedAxisCmpts) { - // FIXME: this is a bit wrong once we support multiple axes - if (mergedAxisCmpts.length !== childAxisCmpts.length) { - return undefined; // Cannot merge axis component with different number of axes. - } - const length = mergedAxisCmpts.length; - for (let i = 0; i < length; i++) { - const merged = mergedAxisCmpts[i]; - const child = childAxisCmpts[i]; - if (!!merged !== !!child) { - return undefined; - } - else if (merged && child) { - const mergedOrient = merged.getWithExplicit('orient'); - const childOrient = child.getWithExplicit('orient'); - if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { - // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) - // Cannot merge due to inconsistent orient - return undefined; - } - else { - mergedAxisCmpts[i] = mergeAxisComponent(merged, child); - } - } - } - } - else { - // For first one, return a copy of the child - return childAxisCmpts.map(axisComponent => axisComponent.clone()); - } - return mergedAxisCmpts; - } - function mergeAxisComponent(merged, child) { - for (const prop of AXIS_COMPONENT_PROPERTIES) { - const mergedValueWithExplicit = mergeValuesWithExplicit(merged.getWithExplicit(prop), child.getWithExplicit(prop), prop, 'axis', - // Tie breaker function - (v1, v2) => { - switch (prop) { - case 'title': - return mergeTitleComponent(v1, v2); - case 'gridScale': - return { - explicit: v1.explicit, - value: getFirstDefined(v1.value, v2.value) - }; - } - return defaultTieBreaker(v1, v2, prop, 'axis'); - }); - merged.setWithExplicit(prop, mergedValueWithExplicit); - } - return merged; - } - // eslint-disable-next-line @typescript-eslint/ban-types - function isExplicit$1(value, property, axis, model, channel) { - if (property === 'disable') { - return axis !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit - } - axis = axis || {}; - switch (property) { - case 'titleAngle': - case 'labelAngle': - return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle)); - case 'values': - return !!axis.values; - // specified axis.values is already respected, but may get transformed. - case 'encode': - // both VL axis.encoding and axis.labelAngle affect VG axis.encode - return !!axis.encoding || !!axis.labelAngle; - case 'title': - // title can be explicit if fieldDef.title is set - if (value === getFieldDefTitle(model, channel)) { - return true; - } - } - // Otherwise, things are explicit if the returned value matches the specified property - return value === axis[property]; - } - /** - * Properties to always include values from config - */ - const propsToAlwaysIncludeConfig = new Set([ - 'grid', - 'translate', - // the rest are not axis configs in Vega, but are in VL, so we need to set too. - 'format', - 'formatType', - 'orient', - 'labelExpr', - 'tickCount', - 'position', - 'tickMinStep' - ]); - function parseAxis(channel, model) { - var _a, _b, _c; - let axis = model.axis(channel); - const axisComponent = new AxisComponent(); - const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]); - const { mark, config } = model; - const orient = (axis === null || axis === void 0 ? void 0 : axis.orient) || ((_a = config[channel === 'x' ? 'axisX' : 'axisY']) === null || _a === void 0 ? void 0 : _a.orient) || ((_b = config.axis) === null || _b === void 0 ? void 0 : _b.orient) || - defaultOrient(channel); - const scaleType = model.getScaleComponent(channel).get('type'); - const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config); - const disable = axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis === null || axis === void 0 ? void 0 : axis.style, axisConfigs).configValue; - axisComponent.set('disable', disable, axis !== undefined); - if (disable) { - return axisComponent; - } - axis = axis || {}; - const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs); - const ruleParams = { - fieldOrDatumDef, - axis, - channel, - model, - scaleType, - orient, - labelAngle, - mark, - config - }; - // 1.2. Add properties - for (const property of AXIS_COMPONENT_PROPERTIES) { - const value = property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined; - const hasValue = value !== undefined; - const explicit = isExplicit$1(value, property, axis, model, channel); - if (hasValue && explicit) { - axisComponent.set(property, value, explicit); - } - else { - const { configValue = undefined, configFrom = undefined } = isAxisProperty(property) && property !== 'values' - ? getAxisConfig(property, config.style, axis.style, axisConfigs) - : {}; - const hasConfigValue = configValue !== undefined; - if (hasValue && !hasConfigValue) { - // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config) - axisComponent.set(property, value, explicit); - } - else if ( - // Cases need implicit values - // 1. Axis config that aren't available in Vega - !(configFrom === 'vgAxisConfig') || - // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details) - (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) || - // 3. Conditional axis values and signals - isConditionalAxisValue(configValue) || - isSignalRef(configValue)) { - // If a config is specified and is conditional, copy conditional value from axis config - axisComponent.set(property, configValue, false); - } - } - } - // 2) Add guide encode definition groups - const axisEncoding = (_c = axis.encoding) !== null && _c !== void 0 ? _c : {}; - const axisEncode = AXIS_PARTS.reduce((e, part) => { - var _a; - if (!axisComponent.hasAxisPart(part)) { - // No need to create encode for a disabled part. - return e; - } - const axisEncodingPart = guideEncodeEntry((_a = axisEncoding[part]) !== null && _a !== void 0 ? _a : {}, model); - const value = part === 'labels' ? labels$1(model, channel, axisEncodingPart) : axisEncodingPart; - if (value !== undefined && !isEmpty(value)) { - e[part] = { update: value }; - } - return e; - }, {}); - // FIXME: By having encode as one property, we won't have fine grained encode merging. - if (!isEmpty(axisEncode)) { - axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined); - } - return axisComponent; - } - - function initLayoutSize({ encoding, size }) { - for (const channel of POSITION_SCALE_CHANNELS) { - const sizeType = getSizeChannel(channel); - if (isStep(size[sizeType])) { - if (isContinuousFieldOrDatumDef(encoding[channel])) { - delete size[sizeType]; - warn(stepDropped(sizeType)); - } - } - } - return size; - } - - function initMarkdef(markDef, encoding, config) { - // set orient, which can be overridden by rules as sometimes the specified orient is invalid. - const specifiedOrient = getMarkPropOrConfig('orient', markDef, config); - markDef.orient = orient(markDef.type, encoding, specifiedOrient); - if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) { - warn(orientOverridden(markDef.orient, specifiedOrient)); - } - if (markDef.type === 'bar' && markDef.orient) { - const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config); - if (cornerRadiusEnd !== undefined) { - const newProps = (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2) - ? ['cornerRadius'] - : BAR_CORNER_RADIUS_INDEX[markDef.orient]; - for (const newProp of newProps) { - markDef[newProp] = cornerRadiusEnd; - } - if (markDef.cornerRadiusEnd !== undefined) { - delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius - } - } - } - // set opacity and filled if not specified in mark config - const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config); - if (specifiedOpacity === undefined) { - markDef.opacity = opacity(markDef.type, encoding); - } - // set cursor, which should be pointer if href channel is present unless otherwise specified - const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config); - if (specifiedCursor === undefined) { - markDef.cursor = cursor(markDef, encoding, config); - } - return markDef; - } - function cursor(markDef, encoding, config) { - if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) { - return 'pointer'; - } - return markDef.cursor; - } - function opacity(mark, encoding) { - if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) { - // point-based marks - if (!isAggregate(encoding)) { - return 0.7; - } - } - return undefined; - } - function defaultFilled(markDef, config, { graticule }) { - if (graticule) { - return false; - } - const filledConfig = getMarkConfig('filled', markDef, config); - const mark = markDef.type; - return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE); - } - function orient(mark, encoding, specifiedOrient) { - switch (mark) { - case POINT: - case CIRCLE: - case SQUARE: - case TEXT: - case RECT: - case IMAGE: - // orient is meaningless for these marks. - return undefined; - } - const { x, y, x2, y2 } = encoding; - switch (mark) { - case BAR: - if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) { - return 'vertical'; - } - if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) { - return 'horizontal'; - } - if (y2 || x2) { - // Ranged bar does not always have clear orientation, so we allow overriding - if (specifiedOrient) { - return specifiedOrient; - } - // If y is range and x is non-range, non-bin Q, y is likely a prebinned field - if (!x2) { - if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) { - return 'horizontal'; - } - } - // If x is range and y is non-range, non-bin Q, x is likely a prebinned field - if (!y2) { - if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) { - return 'vertical'; - } - } - } - // falls through - case RULE: - // return undefined for line segment rule and bar with both axis ranged - // we have to ignore the case that the data are already binned - if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) { - return undefined; - } - // falls through - case AREA: - // If there are range for both x and y, y (vertical) has higher precedence. - if (y2) { - if (isFieldDef(y) && isBinned(y.bin)) { - return 'horizontal'; - } - else { - return 'vertical'; - } - } - else if (x2) { - if (isFieldDef(x) && isBinned(x.bin)) { - return 'vertical'; - } - else { - return 'horizontal'; - } - } - else if (mark === RULE) { - if (x && !y) { - return 'vertical'; - } - else if (y && !x) { - return 'horizontal'; - } - } - // falls through - case LINE: - case TICK: { - // Tick is opposite to bar, line, area and never have ranged mark. - const xIsContinuous = isContinuousFieldOrDatumDef(x); - const yIsContinuous = isContinuousFieldOrDatumDef(y); - if (xIsContinuous && !yIsContinuous) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - else if (!xIsContinuous && yIsContinuous) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } - else if (xIsContinuous && yIsContinuous) { - const xDef = x; // we can cast here since they are surely fieldDef - const yDef = y; - const xIsTemporal = xDef.type === TEMPORAL; - const yIsTemporal = yDef.type === TEMPORAL; - // temporal without timeUnit is considered continuous, but better serves as dimension - if (xIsTemporal && !yIsTemporal) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } - else if (!xIsTemporal && yIsTemporal) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - if (!xDef.aggregate && yDef.aggregate) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } - else if (xDef.aggregate && !yDef.aggregate) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - if (specifiedOrient) { - // When ambiguous, use user specified one. - return specifiedOrient; - } - return 'vertical'; - } - else { - // Discrete x Discrete case - if (specifiedOrient) { - // When ambiguous, use user specified one. - return specifiedOrient; - } - return undefined; - } - } - } - return 'vertical'; - } - - const arc = { - vgMark: 'arc', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { defaultPos: 'mid' })), pointPosition('y', model, { defaultPos: 'mid' })), rectPosition(model, 'radius', 'arc')), rectPosition(model, 'theta', 'arc')); - } - }; - - const area = { - vgMark: 'area', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'include', - size: 'ignore', - theta: 'ignore' - })), pointOrRangePosition('x', model, { - defaultPos: 'zeroOrMin', - defaultPos2: 'zeroOrMin', - range: model.markDef.orient === 'horizontal' - })), pointOrRangePosition('y', model, { - defaultPos: 'zeroOrMin', - defaultPos2: 'zeroOrMin', - range: model.markDef.orient === 'vertical' - })), defined(model)); - } - }; - - const bar = { - vgMark: 'rect', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), rectPosition(model, 'x', 'bar')), rectPosition(model, 'y', 'bar')); - } - }; - - const geoshape = { - vgMark: 'shape', - encodeEntry: (model) => { - return Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - })); - }, - postEncodingTransform: (model) => { - const { encoding } = model; - const shapeDef = encoding.shape; - const transform = Object.assign({ type: 'geoshape', projection: model.projectionName() }, (shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON - ? { field: vgField(shapeDef, { expr: 'datum' }) } - : {})); - return [transform]; - } - }; - - const image = { - vgMark: 'image', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'ignore', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), rectPosition(model, 'x', 'image')), rectPosition(model, 'y', 'image')), text(model, 'url')); - } - }; - - const line = { - vgMark: 'line', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { defaultPos: 'mid' })), pointPosition('y', model, { defaultPos: 'mid' })), nonPosition('size', model, { - vgChannel: 'strokeWidth' // VL's line size is strokeWidth - })), defined(model)); - } - }; - const trail = { - vgMark: 'trail', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'include', - orient: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { defaultPos: 'mid' })), pointPosition('y', model, { defaultPos: 'mid' })), nonPosition('size', model)), defined(model)); - } - }; - - function encodeEntry(model, fixedShape) { - const { config } = model; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'include', - orient: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { defaultPos: 'mid' })), pointPosition('y', model, { defaultPos: 'mid' })), nonPosition('size', model)), nonPosition('angle', model)), shapeMixins(model, config, fixedShape)); - } - function shapeMixins(model, config, fixedShape) { - if (fixedShape) { - return { shape: { value: fixedShape } }; - } - return nonPosition('shape', model); - } - const point = { - vgMark: 'symbol', - encodeEntry: (model) => { - return encodeEntry(model); - } - }; - const circle = { - vgMark: 'symbol', - encodeEntry: (model) => { - return encodeEntry(model, 'circle'); - } - }; - const square = { - vgMark: 'symbol', - encodeEntry: (model) => { - return encodeEntry(model, 'square'); - } - }; - - const rect = { - vgMark: 'rect', - encodeEntry: (model) => { - return Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), rectPosition(model, 'x', 'rect')), rectPosition(model, 'y', 'rect')); - } - }; - - const rule = { - vgMark: 'rule', - encodeEntry: (model) => { - const { markDef } = model; - const orient = markDef.orient; - if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) { - // Show nothing if we have none of x, y, lat, and long. - return {}; - } - return Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), pointOrRangePosition('x', model, { - defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid', - defaultPos2: 'zeroOrMin', - range: orient !== 'vertical' // include x2 for horizontal or line segment rule - })), pointOrRangePosition('y', model, { - defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid', - defaultPos2: 'zeroOrMin', - range: orient !== 'horizontal' // include y2 for vertical or line segment rule - })), nonPosition('size', model, { - vgChannel: 'strokeWidth' // VL's rule size is strokeWidth - })); - } - }; - - const text$1 = { - vgMark: 'text', - encodeEntry: (model) => { - const { config, encoding } = model; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'include', - baseline: 'include', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'include' - })), pointPosition('x', model, { defaultPos: 'mid' })), pointPosition('y', model, { defaultPos: 'mid' })), text(model)), nonPosition('size', model, { - vgChannel: 'fontSize' // VL's text size is fontSize - })), nonPosition('angle', model)), valueIfDefined('align', align(model.markDef, encoding, config))), valueIfDefined('baseline', baseline(model.markDef, encoding, config))), pointPosition('radius', model, { defaultPos: null, isMidPoint: true })), pointPosition('theta', model, { defaultPos: null, isMidPoint: true })); - } - }; - function align(markDef, encoding, config) { - const a = getMarkPropOrConfig('align', markDef, config); - if (a === undefined) { - return 'center'; - } - // If there is a config, Vega-parser will process this already. - return undefined; - } - function baseline(markDef, encoding, config) { - const b = getMarkPropOrConfig('baseline', markDef, config); - if (b === undefined) { - return 'middle'; - } - // If there is a config, Vega-parser will process this already. - return undefined; - } - - const tick = { - vgMark: 'rect', - encodeEntry: (model) => { - const { config, markDef } = model; - const orient = markDef.orient; - const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; - const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width'; - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - })), pointPosition('x', model, { defaultPos: 'mid', vgChannel: 'xc' })), pointPosition('y', model, { defaultPos: 'mid', vgChannel: 'yc' })), nonPosition('size', model, { - defaultValue: defaultSize(model), - vgChannel: vgSizeChannel - })), { [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config)) }); - } - }; - function defaultSize(model) { - var _a; - const { config, markDef } = model; - const { orient } = markDef; - const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; - const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y'); - const markPropOrConfig = (_a = getMarkPropOrConfig('size', markDef, config, { vgChannel: vgSizeChannel })) !== null && _a !== void 0 ? _a : config.tick.bandSize; - if (markPropOrConfig !== undefined) { - return markPropOrConfig; - } - else { - const scaleRange = scale ? scale.get('range') : undefined; - if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { - return (scaleRange.step * 3) / 4; - } - const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel); - return (defaultViewStep * 3) / 4; - } - } - - const markCompiler = { - arc, - area, - bar, - circle, - geoshape, - image, - line, - point, - rect, - rule, - square, - text: text$1, - tick, - trail - }; - function parseMarkGroups(model) { - if (contains([LINE, AREA, TRAIL], model.mark)) { - const details = pathGroupingFields(model.mark, model.encoding); - if (details.length > 0) { - return getPathGroups(model, details); - } - // otherwise use standard mark groups - } - else if (contains([BAR], model.mark)) { - const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop => getMarkPropOrConfig(prop, model.markDef, model.config)); - if (model.stack && !model.fieldDef('size') && hasCornerRadius) { - return getGroupsForStackedBarWithCornerRadius(model); - } - } - return getMarkGroup(model); - } - const FACETED_PATH_PREFIX = 'faceted_path_'; - function getPathGroups(model, details) { - // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?) - return [ - { - name: model.getName('pathgroup'), - type: 'group', - from: { - facet: { - name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main), - data: model.requestDataName(DataSourceType.Main), - groupby: details - } - }, - encode: { - update: { - width: { field: { group: 'width' } }, - height: { field: { group: 'height' } } - } - }, - // With subfacet for line/area group, need to use faceted data from above. - marks: getMarkGroup(model, { fromPrefix: FACETED_PATH_PREFIX }) - } - ]; - } - const STACK_GROUP_PREFIX = 'stack_group_'; - /** - * We need to put stacked bars into groups in order to enable cornerRadius for stacks. - * If stack is used and the model doesn't have size encoding, we put the mark into groups, - * and apply cornerRadius properties at the group. - */ - function getGroupsForStackedBarWithCornerRadius(model) { - // Generate the mark - const [mark] = getMarkGroup(model, { fromPrefix: STACK_GROUP_PREFIX }); - // Get the scale for the stacked field - const fieldScale = model.scaleName(model.stack.fieldChannel); - const stackField = (opt = {}) => model.vgField(model.stack.fieldChannel, opt); - // Find the min/max of the pixel value on the stacked direction - const stackFieldGroup = (func, expr) => { - const vgFieldMinMax = [ - stackField({ prefix: 'min', suffix: 'start', expr }), - stackField({ prefix: 'max', suffix: 'start', expr }), - stackField({ prefix: 'min', suffix: 'end', expr }), - stackField({ prefix: 'max', suffix: 'end', expr }) - ]; - return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`; - }; - let groupUpdate; - let innerGroupUpdate; - // Build the encoding for group and an inner group - if (model.stack.fieldChannel === 'x') { - // Move cornerRadius, y/yc/y2/height properties to group - // Group x/x2 should be the min/max of the marks within - groupUpdate = Object.assign(Object.assign({}, pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS])), { x: { signal: stackFieldGroup('min', 'datum') }, x2: { signal: stackFieldGroup('max', 'datum') }, clip: { value: true } }); - // Inner group should revert the x translation, and pass height through - innerGroupUpdate = { - x: { field: { group: 'x' }, mult: -1 }, - height: { field: { group: 'height' } } - }; - // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group) - // This is why size encoding is not supported yet - mark.encode.update = Object.assign(Object.assign({}, omit(mark.encode.update, ['y', 'yc', 'y2'])), { height: { field: { group: 'height' } } }); - } - else { - groupUpdate = Object.assign(Object.assign({}, pick(mark.encode.update, ['x', 'xc', 'x2', 'width'])), { y: { signal: stackFieldGroup('min', 'datum') }, y2: { signal: stackFieldGroup('max', 'datum') }, clip: { value: true } }); - innerGroupUpdate = { - y: { field: { group: 'y' }, mult: -1 }, - width: { field: { group: 'width' } } - }; - mark.encode.update = Object.assign(Object.assign({}, omit(mark.encode.update, ['x', 'xc', 'x2'])), { width: { field: { group: 'width' } } }); - } - // Deal with cornerRadius properties - for (const key of VG_CORNERRADIUS_CHANNELS) { - const configValue = getMarkConfig(key, model.markDef, model.config); - // Move from mark to group - if (mark.encode.update[key]) { - groupUpdate[key] = mark.encode.update[key]; - delete mark.encode.update[key]; - } - else if (configValue) { - groupUpdate[key] = signalOrValueRef(configValue); - } - // Overwrite any cornerRadius on mark set by config --- they are already moved to the group - if (configValue) { - mark.encode.update[key] = { value: 0 }; - } - } - // For bin and time unit, we have to add bin/timeunit -end channels. - const groupByField = model.fieldDef(model.stack.groupbyChannel); - const groupby = vgField(groupByField) ? [vgField(groupByField)] : []; - if ((groupByField === null || groupByField === void 0 ? void 0 : groupByField.bin) || (groupByField === null || groupByField === void 0 ? void 0 : groupByField.timeUnit)) { - groupby.push(vgField(groupByField, { binSuffix: 'end' })); - } - const strokeProperties = [ - 'stroke', - 'strokeWidth', - 'strokeJoin', - 'strokeCap', - 'strokeDash', - 'strokeDashOffset', - 'strokeMiterLimit', - 'strokeOpacity' - ]; - // Generate stroke properties for the group - groupUpdate = strokeProperties.reduce((encode, prop) => { - if (mark.encode.update[prop]) { - return Object.assign(Object.assign({}, encode), { [prop]: mark.encode.update[prop] }); - } - else { - const configValue = getMarkConfig(prop, model.markDef, model.config); - if (configValue !== undefined) { - return Object.assign(Object.assign({}, encode), { [prop]: signalOrValueRef(configValue) }); - } - else { - return encode; - } - } - }, groupUpdate); - // Apply strokeForeground and strokeOffset if stroke is used - if (groupUpdate.stroke) { - groupUpdate.strokeForeground = { value: true }; - groupUpdate.strokeOffset = { value: 0 }; - } - return [ - { - type: 'group', - from: { - facet: { - data: model.requestDataName(DataSourceType.Main), - name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main), - groupby, - aggregate: { - fields: [ - stackField({ suffix: 'start' }), - stackField({ suffix: 'start' }), - stackField({ suffix: 'end' }), - stackField({ suffix: 'end' }) - ], - ops: ['min', 'max', 'min', 'max'] - } - } - }, - encode: { - update: groupUpdate - }, - marks: [ - { - type: 'group', - encode: { update: innerGroupUpdate }, - marks: [mark] - } - ] - } - ]; - } - function getSort$1(model) { - const { encoding, stack, mark, markDef, config } = model; - const order = encoding.order; - if ((!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) || - (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config)))) { - return undefined; - } - else if ((isArray(order) || isFieldDef(order)) && !stack) { - // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.) - return sortParams(order, { expr: 'datum' }); - } - else if (isPathMark(mark)) { - // For both line and area, we sort values based on dimension by default - const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; - const dimensionChannelDef = encoding[dimensionChannel]; - if (isFieldDef(dimensionChannelDef)) { - const s = dimensionChannelDef.sort; - if (isArray(s)) { - return { - field: vgField(dimensionChannelDef, { prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum' }) - }; - } - else if (isSortField(s)) { - return { - field: vgField({ - // FIXME: this op might not already exist? - // FIXME: what if dimensionChannel (x or y) contains custom domain? - aggregate: isAggregate(model.encoding) ? s.op : undefined, - field: s.field - }, { expr: 'datum' }) - }; - } - else if (isSortByEncoding(s)) { - const fieldDefToSort = model.fieldDef(s.encoding); - return { - field: vgField(fieldDefToSort, { expr: 'datum' }), - order: s.order - }; - } - else if (s === null) { - return undefined; - } - else { - return { - field: vgField(dimensionChannelDef, { - // For stack with imputation, we only have bin_mid - binSuffix: model.stack && model.stack.impute ? 'mid' : undefined, - expr: 'datum' - }) - }; - } - } - return undefined; - } - return undefined; - } - function getMarkGroup(model, opt = { fromPrefix: '' }) { - const { mark, markDef, encoding, config } = model; - const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model)); - const style = getStyles(markDef); - const key = encoding.key; - const sort = getSort$1(model); - const interactive = interactiveFlag(model); - const aria = getMarkPropOrConfig('aria', markDef, config); - const postEncodingTransform = markCompiler[mark].postEncodingTransform - ? markCompiler[mark].postEncodingTransform(model) - : null; - return [ - Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name: model.getName('marks'), type: markCompiler[mark].vgMark }, (clip ? { clip: true } : {})), (style ? { style } : {})), (key ? { key: key.field } : {})), (sort ? { sort } : {})), (interactive ? interactive : {})), (aria === false ? { aria } : {})), { from: { data: opt.fromPrefix + model.requestDataName(DataSourceType.Main) }, encode: { - update: markCompiler[mark].encodeEntry(model) - } }), (postEncodingTransform - ? { - transform: postEncodingTransform - } - : {})) - ]; - } - /** - * If scales are bound to interval selections, we want to automatically clip - * marks to account for panning/zooming interactions. We identify bound scales - * by the selectionExtent property, which gets added during scale parsing. - */ - function scaleClip(model) { - const xScale = model.getScaleComponent('x'); - const yScale = model.getScaleComponent('y'); - return (xScale && xScale.get('selectionExtent')) || (yScale && yScale.get('selectionExtent')) ? true : undefined; - } - /** - * If we use a custom projection with auto-fitting to the geodata extent, - * we need to clip to ensure the chart size doesn't explode. - */ - function projectionClip(model) { - const projection = model.component.projection; - return projection && !projection.isFit ? true : undefined; - } - /** - * Only output interactive flags if we have selections defined somewhere in our model hierarchy. - */ - function interactiveFlag(model) { - if (!model.component.selection) - return null; - const unitCount = keys(model.component.selection).length; - let parentCount = unitCount; - let parent = model.parent; - while (parent && parentCount === 0) { - parentCount = keys(parent.component.selection).length; - parent = parent.parent; - } - return parentCount ? { interactive: unitCount > 0 } : null; - } - - /** - * Internal model of Vega-Lite specification for the compiler. - */ - class UnitModel extends ModelWithField { - constructor(spec, parent, parentGivenName, parentGivenSize = {}, config) { - super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined); - this.specifiedScales = {}; - this.specifiedAxes = {}; - this.specifiedLegends = {}; - this.specifiedProjection = {}; - this.selection = {}; - this.children = []; - const markDef = isMarkDef(spec.mark) ? Object.assign({}, spec.mark) : { type: spec.mark }; - const mark = markDef.type; - // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding - if (markDef.filled === undefined) { - markDef.filled = defaultFilled(markDef, config, { - graticule: spec.data && isGraticuleGenerator(spec.data) - }); - } - const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config)); - this.markDef = initMarkdef(markDef, encoding, config); - this.size = initLayoutSize({ - encoding: encoding, - size: isFrameMixins(spec) - ? Object.assign(Object.assign(Object.assign({}, parentGivenSize), (spec.width ? { width: spec.width } : {})), (spec.height ? { height: spec.height } : {})) : parentGivenSize - }); - // calculate stack properties - this.stack = stack(mark, encoding); - this.specifiedScales = this.initScales(mark, encoding); - this.specifiedAxes = this.initAxes(encoding); - this.specifiedLegends = this.initLegend(encoding); - this.specifiedProjection = spec.projection; - // Selections will be initialized upon parse. - this.selection = spec.selection; - } - get hasProjection() { - const { encoding } = this; - const isGeoShapeMark = this.mark === GEOSHAPE; - const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel])); - return isGeoShapeMark || hasGeoPosition; - } - /** - * Return specified Vega-Lite scale domain for a particular channel - * @param channel - */ - scaleDomain(channel) { - const scale = this.specifiedScales[channel]; - return scale ? scale.domain : undefined; - } - axis(channel) { - return this.specifiedAxes[channel]; - } - legend(channel) { - return this.specifiedLegends[channel]; - } - initScales(mark, encoding) { - return SCALE_CHANNELS.reduce((scales, channel) => { - var _a; - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - if (fieldOrDatumDef) { - scales[channel] = (_a = fieldOrDatumDef.scale) !== null && _a !== void 0 ? _a : {}; - } - return scales; - }, {}); - } - initAxes(encoding) { - return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => { - // Position Axis - // TODO: handle ConditionFieldDef - const channelDef = encoding[channel]; - if (isFieldOrDatumDef(channelDef) || - (channel === X && isFieldOrDatumDef(encoding.x2)) || - (channel === Y && isFieldOrDatumDef(encoding.y2))) { - const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined; - _axis[channel] = axisSpec ? Object.assign({}, axisSpec) : axisSpec; // convert truthy value to object - } - return _axis; - }, {}); - } - initLegend(encoding) { - return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => { - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); - if (fieldOrDatumDef && supportLegend(channel)) { - const legend = fieldOrDatumDef.legend; - _legend[channel] = legend ? Object.assign({}, legend) : legend; // convert truthy value to object - } - return _legend; - }, {}); - } - parseData() { - this.component.data = parseData(this); - } - parseLayoutSize() { - parseUnitLayoutSize(this); - } - parseSelections() { - this.component.selection = parseUnitSelection(this, this.selection); - } - parseMarkGroup() { - this.component.mark = parseMarkGroups(this); - } - parseAxesAndHeaders() { - this.component.axes = parseUnitAxes(this); - } - assembleSelectionTopLevelSignals(signals) { - return assembleTopLevelSignals(this, signals); - } - assembleSignals() { - return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])]; - } - assembleSelectionData(data) { - return assembleUnitSelectionData(this, data); - } - assembleLayout() { - return null; - } - assembleLayoutSignals() { - return assembleLayoutSignals(this); - } - assembleMarks() { - var _a; - let marks = (_a = this.component.mark) !== null && _a !== void 0 ? _a : []; - // If this unit is part of a layer, selections should augment - // all in concert rather than each unit individually. This - // ensures correct interleaving of clipping and brushed marks. - if (!this.parent || !isLayerModel(this.parent)) { - marks = assembleUnitSelectionMarks(this, marks); - } - return marks.map(this.correctDataNames); - } - getMapping() { - return this.encoding; - } - get mark() { - return this.markDef.type; - } - channelHasField(channel) { - return channelHasField(this.encoding, channel); - } - fieldDef(channel) { - const channelDef = this.encoding[channel]; - return getFieldDef(channelDef); - } - typedFieldDef(channel) { - const fieldDef = this.fieldDef(channel); - if (isTypedFieldDef(fieldDef)) { - return fieldDef; - } - return null; - } - } - - class LayerModel extends Model { - constructor(spec, parent, parentGivenName, parentGivenSize, config) { - super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view); - const layoutSize = Object.assign(Object.assign(Object.assign({}, parentGivenSize), (spec.width ? { width: spec.width } : {})), (spec.height ? { height: spec.height } : {})); - this.children = spec.layer.map((layer, i) => { - if (isLayerSpec(layer)) { - return new LayerModel(layer, this, this.getName('layer_' + i), layoutSize, config); - } - else if (isUnitSpec(layer)) { - return new UnitModel(layer, this, this.getName('layer_' + i), layoutSize, config); - } - throw new Error(invalidSpec(layer)); - }); - } - parseData() { - this.component.data = parseData(this); - for (const child of this.children) { - child.parseData(); - } - } - parseLayoutSize() { - parseLayerLayoutSize(this); - } - parseSelections() { - // Merge selections up the hierarchy so that they may be referenced - // across unit specs. Persist their definitions within each child - // to assemble signals which remain within output Vega unit groups. - this.component.selection = {}; - for (const child of this.children) { - child.parseSelections(); - for (const key of keys(child.component.selection)) { - this.component.selection[key] = child.component.selection[key]; - } - } - } - parseMarkGroup() { - for (const child of this.children) { - child.parseMarkGroup(); - } - } - parseAxesAndHeaders() { - parseLayerAxes(this); - } - assembleSelectionTopLevelSignals(signals) { - return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); - } - // TODO: Support same named selections across children. - assembleSignals() { - return this.children.reduce((signals, child) => { - return signals.concat(child.assembleSignals()); - }, assembleAxisSignals(this)); - } - assembleLayoutSignals() { - return this.children.reduce((signals, child) => { - return signals.concat(child.assembleLayoutSignals()); - }, assembleLayoutSignals(this)); - } - assembleSelectionData(data) { - return this.children.reduce((db, child) => child.assembleSelectionData(db), data); - } - assembleTitle() { - let title = super.assembleTitle(); - if (title) { - return title; - } - // If title does not provide layer, look into children - for (const child of this.children) { - title = child.assembleTitle(); - if (title) { - return title; - } - } - return undefined; - } - assembleLayout() { - return null; - } - assembleMarks() { - return assembleLayerSelectionMarks(this, this.children.flatMap(child => { - return child.assembleMarks(); - })); - } - assembleLegends() { - return this.children.reduce((legends, child) => { - return legends.concat(child.assembleLegends()); - }, assembleLegends(this)); - } - } - - function buildModel(spec, parent, parentGivenName, unitSize, config) { - if (isFacetSpec(spec)) { - return new FacetModel(spec, parent, parentGivenName, config); - } - else if (isLayerSpec(spec)) { - return new LayerModel(spec, parent, parentGivenName, unitSize, config); - } - else if (isUnitSpec(spec)) { - return new UnitModel(spec, parent, parentGivenName, unitSize, config); - } - else if (isAnyConcatSpec(spec)) { - return new ConcatModel(spec, parent, parentGivenName, config); - } - throw new Error(invalidSpec(spec)); - } - - /** - * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec. - * - * At a high-level, we make the following transformations in different phases: - * - * Input spec - * | - * | (Normalization) - * v - * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.) - * | - * | (Build Model) - * v - * A model tree of the spec - * | - * | (Parse) - * v - * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged) - * | - * | (Optimize) - * v - * A model tree with parsed components with the data component optimized - * | - * | (Assemble) - * v - * Vega spec - * - * @param inputSpec The Vega-Lite specification. - * @param opt Optional arguments passed to the Vega-Lite compiler. - * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec. - */ - function compile(inputSpec, opt = {}) { - // 0. Augment opt with default opts - if (opt.logger) { - // set the singleton logger to the provided logger - set(opt.logger); - } - if (opt.fieldTitle) { - // set the singleton field title formatter - setTitleFormatter(opt.fieldTitle); - } - try { - // 1. Initialize config by deep merging default config with the config provided via option and the input spec. - const config = initConfig(mergeConfig(opt.config, inputSpec.config)); - // 2. Normalize: Convert input spec -> normalized spec - // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec. - // - Normalize autosize and width or height spec - const spec = normalize(inputSpec, config); - // 3. Build Model: normalized spec -> Model (a tree structure) - // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors. - // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models. - const model = buildModel(spec, null, '', undefined, config); - // 4 Parse: Model --> Model with components - // Note that components = intermediate representations that are equivalent to Vega specs. - // We need these intermediate representation because we need to merge many visualization "components" like projections, scales, axes, and legends. - // We will later convert these components into actual Vega specs in the assemble phase. - // In this phase, we do a bottom-up traversal over the whole tree to - // parse for each type of components once (e.g., data, layout, mark, scale). - // By doing bottom-up traversal, we start parsing components of unit specs and - // then merge child components of parent composite specs. - // - // Please see inside model.parse() for order of different components parsed. - model.parse(); - // drawDataflow(model.component.data.sources); - // 5. Optimize the dataflow. This will modify the data component of the model. - optimizeDataflow(model.component.data, model); - // drawDataflow(model.component.data.sources); - // 6. Assemble: convert model components --> Vega Spec. - const vgSpec = assembleTopLevelModel(model, getTopLevelProperties(inputSpec, spec.autosize, config, model), inputSpec.datasets, inputSpec.usermeta); - return { - spec: vgSpec, - normalized: spec - }; - } - finally { - // Reset the singleton logger if a logger is provided - if (opt.logger) { - reset(); - } - // Reset the singleton field title formatter if provided - if (opt.fieldTitle) { - resetTitleFormatter(); - } - } - } - function getTopLevelProperties(inputSpec, autosize, config, model) { - const width = model.component.layoutSize.get('width'); - const height = model.component.layoutSize.get('height'); - if (autosize === undefined) { - autosize = { type: 'pad' }; - if (model.hasAxisOrientSignalRef()) { - autosize.resize = true; - } - } - else if (isString(autosize)) { - autosize = { type: autosize }; - } - if (width && height && isFitType(autosize.type)) { - if (width === 'step' && height === 'step') { - warn(droppingFit()); - autosize.type = 'pad'; - } - else if (width === 'step' || height === 'step') { - // effectively XOR, because else if - // get step dimension - const sizeType = width === 'step' ? 'width' : 'height'; - // log that we're dropping fit for respective channel - warn(droppingFit(getPositionScaleChannel(sizeType))); - // setting type to inverse fit (so if we dropped fit-x, type is now fit-y) - const inverseSizeType = sizeType === 'width' ? 'height' : 'width'; - autosize.type = getFitType(inverseSizeType); - } - } - return Object.assign(Object.assign(Object.assign({}, (keys(autosize).length === 1 && autosize.type - ? autosize.type === 'pad' - ? {} - : { autosize: autosize.type } - : { autosize })), extractTopLevelProperties(config)), extractTopLevelProperties(inputSpec)); - } - /* - * Assemble the top-level model to a Vega spec. - * - * Note: this couldn't be `model.assemble()` since the top-level model - * needs some special treatment to generate top-level properties. - */ - function assembleTopLevelModel(model, topLevelProperties, datasets = {}, usermeta) { - // Config with Vega-Lite only config removed. - const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined; - const data = [].concat(model.assembleSelectionData([]), - // only assemble data in the root - assembleRootData(model.component.data, datasets)); - const projections = model.assembleProjections(); - const title = model.assembleTitle(); - const style = model.assembleGroupStyle(); - const encodeEntry = model.assembleGroupEncodeEntry(true); - let layoutSignals = model.assembleLayoutSignals(); - // move width and height signals with values to top level - layoutSignals = layoutSignals.filter(signal => { - if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) { - topLevelProperties[signal.name] = +signal.value; - return false; - } - return true; - }); - return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ $schema: 'https://vega.github.io/schema/vega/v5.json' }, (model.description ? { description: model.description } : {})), topLevelProperties), (title ? { title } : {})), (style ? { style } : {})), (encodeEntry ? { encode: { update: encodeEntry } } : {})), { data }), (projections.length > 0 ? { projections: projections } : {})), model.assembleGroup([...layoutSignals, ...model.assembleSelectionTopLevelSignals([])])), (vgConfig ? { config: vgConfig } : {})), (usermeta ? { usermeta } : {})); - } - - exports.compile = compile; - exports.normalize = normalize; - exports.version = version; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -//# sourceMappingURL=vega-lite.js.map diff --git a/node_modules/vega-lite/build/vega-lite.js.map b/node_modules/vega-lite/build/vega-lite.js.map deleted file mode 100644 index 3a0a39d..0000000 --- a/node_modules/vega-lite/build/vega-lite.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vega-lite.js","sources":["../node_modules/vega-util/src/accessor.js","../node_modules/vega-util/src/getter.js","../node_modules/vega-util/src/error.js","../node_modules/vega-util/src/splitAccessPath.js","../node_modules/vega-util/src/field.js","../node_modules/vega-util/src/accessors.js","../node_modules/vega-util/src/logger.js","../node_modules/vega-util/src/isArray.js","../node_modules/vega-util/src/isObject.js","../node_modules/vega-util/src/mergeConfig.js","../node_modules/vega-util/src/array.js","../node_modules/vega-util/src/isFunction.js","../node_modules/vega-util/src/hasOwnProperty.js","../node_modules/vega-util/src/isBoolean.js","../node_modules/vega-util/src/isNumber.js","../node_modules/vega-util/src/isString.js","../node_modules/vega-util/src/stringValue.js","../node_modules/vega-util/src/toSet.js","../node_modules/tslib/tslib.es6.js","../node_modules/array-flat-polyfill/index.mjs","../node_modules/clone/clone.js","../node_modules/fast-deep-equal/index.js","../node_modules/fast-json-stable-stringify/index.js","../src/logical.ts","../src/util.ts","../src/axis.ts","../src/mark.ts","../src/spec/unit.ts","../src/compositemark/base.ts","../src/aggregate.ts","../src/channel.ts","../src/bin.ts","../src/log/message.ts","../src/log/index.ts","../src/datetime.ts","../src/timeunit.ts","../src/vega.schema.ts","../src/predicate.ts","../src/type.ts","../src/scale.ts","../src/compile/mark/encode/valueref.ts","../src/compile/format.ts","../src/sort.ts","../src/spec/facet.ts","../src/channeldef.ts","../src/title.ts","../src/compile/common.ts","../src/encoding.ts","../src/compositemark/common.ts","../src/compositemark/boxplot.ts","../src/compositemark/errorbar.ts","../src/compositemark/errorband.ts","../src/compositemark/index.ts","../src/guide.ts","../src/legend.ts","../src/selection.ts","../src/spec/concat.ts","../src/spec/base.ts","../src/config.ts","../src/spec/layer.ts","../src/spec/repeat.ts","../src/spec/map.ts","../src/stack.ts","../src/normalize/pathoverlay.ts","../src/normalize/rangestep.ts","../src/normalize/repeater.ts","../src/normalize/ruleforrangedline.ts","../src/normalize/core.ts","../src/normalize/index.ts","../src/spec/toplevel.ts","../src/compile/split.ts","../src/compile/data/index.ts","../src/data.ts","../src/transform.ts","../node_modules/vega-event-selector/src/event-selector.js","../src/compile/mark/encode/conditional.ts","../src/compile/mark/encode/text.ts","../src/compile/mark/encode/tooltip.ts","../src/compile/mark/encode/aria.ts","../src/compile/mark/encode/nonposition.ts","../src/compile/mark/encode/color.ts","../src/compile/mark/encode/zindex.ts","../src/compile/mark/encode/offset.ts","../src/compile/mark/encode/position-point.ts","../src/compile/mark/encode/position-align.ts","../src/compile/mark/encode/position-range.ts","../src/compile/mark/encode/position-rect.ts","../src/compile/mark/encode/base.ts","../src/compile/mark/encode/defined.ts","../src/compile/selection/transforms/nearest.ts","../src/compile/data/dataflow.ts","../src/compile/data/timeunit.ts","../src/compile/selection/transforms/project.ts","../src/compile/selection/transforms/inputs.ts","../src/compile/selection/transforms/toggle.ts","../src/compile/selection/transforms/clear.ts","../src/compile/selection/transforms/scales.ts","../src/compile/selection/transforms/legends.ts","../src/compile/selection/transforms/translate.ts","../src/compile/selection/transforms/zoom.ts","../src/compile/selection/transforms/transforms.ts","../src/compile/selection/assemble.ts","../src/compile/selection/interval.ts","../src/compile/selection/multi.ts","../src/compile/selection/single.ts","../src/compile/selection/index.ts","../node_modules/vega-expression/src/ast.js","../node_modules/vega-expression/src/parser.js","../src/compile/data/expressions.ts","../src/compile/data/filter.ts","../src/compile/selection/parse.ts","../src/compile/predicate.ts","../src/compile/axis/assemble.ts","../src/header.ts","../src/compile/axis/config.ts","../src/compile/axis/properties.ts","../src/compile/data/calculate.ts","../src/compile/header/common.ts","../src/compile/header/component.ts","../src/compile/header/assemble.ts","../src/compile/layoutsize/assemble.ts","../src/compile/layoutsize/component.ts","../src/compile/guide.ts","../src/compile/resolve.ts","../src/compile/legend/component.ts","../src/compile/legend/encode.ts","../src/compile/legend/properties.ts","../src/compile/legend/parse.ts","../src/compile/legend/assemble.ts","../src/compile/projection/assemble.ts","../src/projection.ts","../src/compile/projection/component.ts","../src/compile/projection/parse.ts","../src/compile/data/bin.ts","../src/compile/data/source.ts","../src/compile/data/graticule.ts","../src/compile/data/sequence.ts","../src/compile/data/optimizer.ts","../src/compile/data/aggregate.ts","../src/compile/data/facet.ts","../src/compile/data/formatparse.ts","../src/compile/data/identifier.ts","../src/compile/data/joinaggregate.ts","../src/compile/data/stack.ts","../src/compile/data/window.ts","../src/compile/data/optimizers.ts","../src/compile/data/optimize.ts","../src/compile/signal.ts","../src/compile/scale/domain.ts","../src/compile/scale/assemble.ts","../src/compile/scale/component.ts","../src/compile/scale/range.ts","../src/compile/scale/properties.ts","../src/compile/scale/type.ts","../src/compile/scale/parse.ts","../src/compile/model.ts","../src/compile/data/density.ts","../src/compile/data/filterinvalid.ts","../src/compile/data/flatten.ts","../src/compile/data/fold.ts","../src/compile/data/geojson.ts","../src/compile/data/geopoint.ts","../src/compile/data/impute.ts","../src/compile/data/loess.ts","../src/compile/data/lookup.ts","../src/compile/data/quantile.ts","../src/compile/data/regression.ts","../src/compile/data/pivot.ts","../src/compile/data/sample.ts","../src/compile/data/assemble.ts","../src/compile/header/parse.ts","../src/compile/layoutsize/parse.ts","../src/compile/facet.ts","../src/compile/data/joinaggregatefacet.ts","../src/compile/data/parse.ts","../src/compile/concat.ts","../src/compile/axis/component.ts","../src/compile/axis/encode.ts","../src/compile/axis/parse.ts","../src/compile/layoutsize/init.ts","../src/compile/mark/init.ts","../src/compile/mark/arc.ts","../src/compile/mark/area.ts","../src/compile/mark/bar.ts","../src/compile/mark/geoshape.ts","../src/compile/mark/image.ts","../src/compile/mark/line.ts","../src/compile/mark/point.ts","../src/compile/mark/rect.ts","../src/compile/mark/rule.ts","../src/compile/mark/text.ts","../src/compile/mark/tick.ts","../src/compile/mark/mark.ts","../src/compile/unit.ts","../src/compile/layer.ts","../src/compile/buildmodel.ts","../src/compile/compile.ts"],"sourcesContent":["export default function(fn, fields, name) {\n fn.fields = fields || [];\n fn.fname = name;\n return fn;\n}\n\nexport function accessorName(fn) {\n return fn == null ? null : fn.fname;\n}\n\nexport function accessorFields(fn) {\n return fn == null ? null : fn.fields;\n}\n","export default function(path) {\n return path.length === 1 ? get1(path[0]) : getN(path);\n}\n\nconst get1 = field => function(obj) {\n return obj[field];\n};\n\nconst getN = path => {\n const len = path.length;\n return function(obj) {\n for (let i = 0; i < len; ++i) {\n obj = obj[path[i]];\n }\n return obj;\n };\n};\n\n","export default function(message) {\n throw Error(message);\n}\n","import error from './error';\n\nexport default function(p) {\n var path = [],\n q = null,\n b = 0,\n n = p.length,\n s = '',\n i, j, c;\n\n p = p + '';\n\n function push() {\n path.push(s + p.substring(i, j));\n s = '';\n i = j + 1;\n }\n\n for (i=j=0; j i) {\n push();\n } else {\n i = j + 1;\n }\n } else if (c === '[') {\n if (j > i) push();\n b = i = j + 1;\n } else if (c === ']') {\n if (!b) error('Access path missing open bracket: ' + p);\n if (b > 0) push();\n b = 0;\n i = j + 1;\n }\n }\n\n if (b) error('Access path missing closing bracket: ' + p);\n if (q) error('Access path missing closing quote: ' + p);\n\n if (j > i) {\n j++;\n push();\n }\n\n return path;\n}\n","import accessor from './accessor';\nimport getter from './getter';\nimport splitAccessPath from './splitAccessPath';\n\nexport default function(field, name, opt) {\n const path = splitAccessPath(field);\n field = path.length === 1 ? path[0] : field;\n return accessor(\n (opt && opt.get || getter)(path),\n [field],\n name || field\n );\n}\n","import accessor from './accessor';\nimport field from './field';\n\nvar empty = [];\n\nexport var id = field('id');\n\nexport var identity = accessor(function(_) { return _; }, empty, 'identity');\n\nexport var zero = accessor(function() { return 0; }, empty, 'zero');\n\nexport var one = accessor(function() { return 1; }, empty, 'one');\n\nexport var truthy = accessor(function() { return true; }, empty, 'true');\n\nexport var falsy = accessor(function() { return false; }, empty, 'false');\n","function log(method, level, input) {\n var args = [level].concat([].slice.call(input));\n console[method].apply(console, args); // eslint-disable-line no-console\n}\n\nexport var None = 0;\nexport var Error = 1;\nexport var Warn = 2;\nexport var Info = 3;\nexport var Debug = 4;\n\nexport default function(_, method) {\n var level = _ || None;\n return {\n level: function(_) {\n if (arguments.length) {\n level = +_;\n return this;\n } else {\n return level;\n }\n },\n error: function() {\n if (level >= Error) log(method || 'error', 'ERROR', arguments);\n return this;\n },\n warn: function() {\n if (level >= Warn) log(method || 'warn', 'WARN', arguments);\n return this;\n },\n info: function() {\n if (level >= Info) log(method || 'log', 'INFO', arguments);\n return this;\n },\n debug: function() {\n if (level >= Debug) log(method || 'log', 'DEBUG', arguments);\n return this;\n }\n };\n}\n","export default Array.isArray;\n","export default function(_) {\n return _ === Object(_);\n}\n","import isArray from './isArray';\nimport isObject from './isObject';\n\nconst isLegalKey = key => key !== '__proto__';\n\nexport function mergeConfig(...configs) {\n return configs.reduce((out, source) => {\n for (var key in source) {\n if (key === 'signals') {\n // for signals, we merge the signals arrays\n // source signals take precedence over\n // existing signals with the same name\n out.signals = mergeNamed(out.signals, source.signals);\n } else {\n // otherwise, merge objects subject to recursion constraints\n // for legend block, recurse for the layout entry only\n // for style block, recurse for all properties\n // otherwise, no recursion: objects overwrite, no merging\n var r = key === 'legend' ? {layout: 1}\n : key === 'style' ? true\n : null;\n writeConfig(out, key, source[key], r);\n }\n }\n return out;\n }, {});\n}\n\nexport function writeConfig(output, key, value, recurse) {\n if (!isLegalKey(key)) return;\n\n var k, o;\n if (isObject(value) && !isArray(value)) {\n o = isObject(output[key]) ? output[key] : (output[key] = {});\n for (k in value) {\n if (recurse && (recurse === true || recurse[k])) {\n writeConfig(o, k, value[k]);\n } else if (isLegalKey(k)) {\n o[k] = value[k];\n }\n }\n } else {\n output[key] = value;\n }\n}\n\nfunction mergeNamed(a, b) {\n if (a == null) return b;\n\n const map = {}, out = [];\n\n function add(_) {\n if (!map[_.name]) {\n map[_.name] = 1;\n out.push(_);\n }\n }\n\n b.forEach(add);\n a.forEach(add);\n return out;\n}\n","import isArray from './isArray';\n\nexport default function(_) {\n return _ != null ? (isArray(_) ? _ : [_]) : [];\n}\n","export default function(_) {\n return typeof _ === 'function';\n}\n","const hop = Object.prototype.hasOwnProperty;\n\nexport default function(object, property) {\n return hop.call(object, property);\n}\n","export default function(_) {\n return typeof _ === 'boolean';\n}\n","export default function(_) {\n return typeof _ === 'number';\n}\n","export default function(_) {\n return typeof _ === 'string';\n}\n","import isArray from './isArray';\nimport isObject from './isObject';\nimport isString from './isString';\n\nexport default function $(x) {\n return isArray(x) ? '[' + x.map($) + ']'\n : isObject(x) || isString(x) ?\n // Output valid JSON and JS source strings.\n // See http://timelessrepo.com/json-isnt-a-javascript-subset\n JSON.stringify(x).replace('\\u2028','\\\\u2028').replace('\\u2029', '\\\\u2029')\n : x;\n}\n","export default function(_) {\n for (var s={}, i=0, n=_.length; i= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","Array.prototype.flat||Object.defineProperty(Array.prototype,\"flat\",{configurable:!0,value:function r(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,function(a,e){return Array.isArray(e)?a.push.apply(a,r.call(e,t-1)):a.push(e),a},[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,\"flatMap\",{configurable:!0,value:function(r){return Array.prototype.map.apply(this,arguments).flat()},writable:!0})\n","var clone = (function() {\n'use strict';\n\nfunction _instanceof(obj, type) {\n return type != null && obj instanceof type;\n}\n\nvar nativeMap;\ntry {\n nativeMap = Map;\n} catch(_) {\n // maybe a reference error because no `Map`. Give it a dummy value that no\n // value will ever be an instanceof.\n nativeMap = function() {};\n}\n\nvar nativeSet;\ntry {\n nativeSet = Set;\n} catch(_) {\n nativeSet = function() {};\n}\n\nvar nativePromise;\ntry {\n nativePromise = Promise;\n} catch(_) {\n nativePromise = function() {};\n}\n\n/**\n * Clones (copies) an Object using deep copying.\n *\n * This function supports circular references by default, but if you are certain\n * there are no circular references in your object, you can save some CPU time\n * by calling clone(obj, false).\n *\n * Caution: if `circular` is false and `parent` contains circular references,\n * your program may enter an infinite loop and crash.\n *\n * @param `parent` - the object to be cloned\n * @param `circular` - set to true if the object to be cloned may contain\n * circular references. (optional - true by default)\n * @param `depth` - set to a number if the object is only to be cloned to\n * a particular depth. (optional - defaults to Infinity)\n * @param `prototype` - sets the prototype to be used when cloning an object.\n * (optional - defaults to parent prototype).\n * @param `includeNonEnumerable` - set to true if the non-enumerable properties\n * should be cloned as well. Non-enumerable properties on the prototype\n * chain will be ignored. (optional - false by default)\n*/\nfunction clone(parent, circular, depth, prototype, includeNonEnumerable) {\n if (typeof circular === 'object') {\n depth = circular.depth;\n prototype = circular.prototype;\n includeNonEnumerable = circular.includeNonEnumerable;\n circular = circular.circular;\n }\n // maintain two arrays for circular references, where corresponding parents\n // and children have the same index\n var allParents = [];\n var allChildren = [];\n\n var useBuffer = typeof Buffer != 'undefined';\n\n if (typeof circular == 'undefined')\n circular = true;\n\n if (typeof depth == 'undefined')\n depth = Infinity;\n\n // recurse this function so we don't reset allParents and allChildren\n function _clone(parent, depth) {\n // cloning null always returns null\n if (parent === null)\n return null;\n\n if (depth === 0)\n return parent;\n\n var child;\n var proto;\n if (typeof parent != 'object') {\n return parent;\n }\n\n if (_instanceof(parent, nativeMap)) {\n child = new nativeMap();\n } else if (_instanceof(parent, nativeSet)) {\n child = new nativeSet();\n } else if (_instanceof(parent, nativePromise)) {\n child = new nativePromise(function (resolve, reject) {\n parent.then(function(value) {\n resolve(_clone(value, depth - 1));\n }, function(err) {\n reject(_clone(err, depth - 1));\n });\n });\n } else if (clone.__isArray(parent)) {\n child = [];\n } else if (clone.__isRegExp(parent)) {\n child = new RegExp(parent.source, __getRegExpFlags(parent));\n if (parent.lastIndex) child.lastIndex = parent.lastIndex;\n } else if (clone.__isDate(parent)) {\n child = new Date(parent.getTime());\n } else if (useBuffer && Buffer.isBuffer(parent)) {\n if (Buffer.allocUnsafe) {\n // Node.js >= 4.5.0\n child = Buffer.allocUnsafe(parent.length);\n } else {\n // Older Node.js versions\n child = new Buffer(parent.length);\n }\n parent.copy(child);\n return child;\n } else if (_instanceof(parent, Error)) {\n child = Object.create(parent);\n } else {\n if (typeof prototype == 'undefined') {\n proto = Object.getPrototypeOf(parent);\n child = Object.create(proto);\n }\n else {\n child = Object.create(prototype);\n proto = prototype;\n }\n }\n\n if (circular) {\n var index = allParents.indexOf(parent);\n\n if (index != -1) {\n return allChildren[index];\n }\n allParents.push(parent);\n allChildren.push(child);\n }\n\n if (_instanceof(parent, nativeMap)) {\n parent.forEach(function(value, key) {\n var keyChild = _clone(key, depth - 1);\n var valueChild = _clone(value, depth - 1);\n child.set(keyChild, valueChild);\n });\n }\n if (_instanceof(parent, nativeSet)) {\n parent.forEach(function(value) {\n var entryChild = _clone(value, depth - 1);\n child.add(entryChild);\n });\n }\n\n for (var i in parent) {\n var attrs;\n if (proto) {\n attrs = Object.getOwnPropertyDescriptor(proto, i);\n }\n\n if (attrs && attrs.set == null) {\n continue;\n }\n child[i] = _clone(parent[i], depth - 1);\n }\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(parent);\n for (var i = 0; i < symbols.length; i++) {\n // Don't need to worry about cloning a symbol because it is a primitive,\n // like a number or string.\n var symbol = symbols[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);\n if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {\n continue;\n }\n child[symbol] = _clone(parent[symbol], depth - 1);\n if (!descriptor.enumerable) {\n Object.defineProperty(child, symbol, {\n enumerable: false\n });\n }\n }\n }\n\n if (includeNonEnumerable) {\n var allPropertyNames = Object.getOwnPropertyNames(parent);\n for (var i = 0; i < allPropertyNames.length; i++) {\n var propertyName = allPropertyNames[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);\n if (descriptor && descriptor.enumerable) {\n continue;\n }\n child[propertyName] = _clone(parent[propertyName], depth - 1);\n Object.defineProperty(child, propertyName, {\n enumerable: false\n });\n }\n }\n\n return child;\n }\n\n return _clone(parent, depth);\n}\n\n/**\n * Simple flat clone using prototype, accepts only objects, usefull for property\n * override on FLAT configuration object (no nested props).\n *\n * USE WITH CAUTION! This may not behave as you wish if you do not know how this\n * works.\n */\nclone.clonePrototype = function clonePrototype(parent) {\n if (parent === null)\n return null;\n\n var c = function () {};\n c.prototype = parent;\n return new c();\n};\n\n// private utility functions\n\nfunction __objToStr(o) {\n return Object.prototype.toString.call(o);\n}\nclone.__objToStr = __objToStr;\n\nfunction __isDate(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Date]';\n}\nclone.__isDate = __isDate;\n\nfunction __isArray(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Array]';\n}\nclone.__isArray = __isArray;\n\nfunction __isRegExp(o) {\n return typeof o === 'object' && __objToStr(o) === '[object RegExp]';\n}\nclone.__isRegExp = __isRegExp;\n\nfunction __getRegExpFlags(re) {\n var flags = '';\n if (re.global) flags += 'g';\n if (re.ignoreCase) flags += 'i';\n if (re.multiline) flags += 'm';\n return flags;\n}\nclone.__getRegExpFlags = __getRegExpFlags;\n\nreturn clone;\n})();\n\nif (typeof module === 'object' && module.exports) {\n module.exports = clone;\n}\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","'use strict';\n\nmodule.exports = function (data, opts) {\n if (!opts) opts = {};\n if (typeof opts === 'function') opts = { cmp: opts };\n var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;\n\n var cmp = opts.cmp && (function (f) {\n return function (node) {\n return function (a, b) {\n var aobj = { key: a, value: node[a] };\n var bobj = { key: b, value: node[b] };\n return f(aobj, bobj);\n };\n };\n })(opts.cmp);\n\n var seen = [];\n return (function stringify (node) {\n if (node && node.toJSON && typeof node.toJSON === 'function') {\n node = node.toJSON();\n }\n\n if (node === undefined) return;\n if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';\n if (typeof node !== 'object') return JSON.stringify(node);\n\n var i, out;\n if (Array.isArray(node)) {\n out = '[';\n for (i = 0; i < node.length; i++) {\n if (i) out += ',';\n out += stringify(node[i]) || 'null';\n }\n return out + ']';\n }\n\n if (node === null) return 'null';\n\n if (seen.indexOf(node) !== -1) {\n if (cycles) return JSON.stringify('__cycle__');\n throw new TypeError('Converting circular structure to JSON');\n }\n\n var seenIndex = seen.push(node) - 1;\n var keys = Object.keys(node).sort(cmp && cmp(node));\n out = '';\n for (i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = stringify(node[key]);\n\n if (!value) continue;\n if (out) out += ',';\n out += JSON.stringify(key) + ':' + value;\n }\n seen.splice(seenIndex, 1);\n return '{' + out + '}';\n })(data);\n};\n","export type LogicalComposition = LogicalNot | LogicalAnd | LogicalOr | T;\n\nexport interface LogicalOr {\n or: LogicalComposition[];\n}\n\nexport interface LogicalAnd {\n and: LogicalComposition[];\n}\n\nexport interface LogicalNot {\n not: LogicalComposition;\n}\n\nexport function isLogicalOr(op: LogicalComposition): op is LogicalOr {\n return !!op.or;\n}\n\nexport function isLogicalAnd(op: LogicalComposition): op is LogicalAnd {\n return !!op.and;\n}\n\nexport function isLogicalNot(op: LogicalComposition): op is LogicalNot {\n return !!op.not;\n}\n\nexport function forEachLeaf(op: LogicalComposition, fn: (op: T) => void) {\n if (isLogicalNot(op)) {\n forEachLeaf(op.not, fn);\n } else if (isLogicalAnd(op)) {\n for (const subop of op.and) {\n forEachLeaf(subop, fn);\n }\n } else if (isLogicalOr(op)) {\n for (const subop of op.or) {\n forEachLeaf(subop, fn);\n }\n } else {\n fn(op);\n }\n}\n\nexport function normalizeLogicalComposition(\n op: LogicalComposition,\n normalizer: (o: T) => T\n): LogicalComposition {\n if (isLogicalNot(op)) {\n return {not: normalizeLogicalComposition(op.not, normalizer)};\n } else if (isLogicalAnd(op)) {\n return {and: op.and.map(o => normalizeLogicalComposition(o, normalizer))};\n } else if (isLogicalOr(op)) {\n return {or: op.or.map(o => normalizeLogicalComposition(o, normalizer))};\n } else {\n return normalizer(op);\n }\n}\n","import 'array-flat-polyfill';\nimport {default as clone_} from 'clone';\nimport deepEqual_ from 'fast-deep-equal';\nimport stableStringify from 'fast-json-stable-stringify';\nimport {hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig} from 'vega-util';\nimport {isLogicalAnd, isLogicalNot, isLogicalOr, LogicalComposition} from './logical';\n\nexport const deepEqual = deepEqual_;\nexport const duplicate = clone_;\n\n/**\n * Creates an object composed of the picked object properties.\n *\n * var object = {'a': 1, 'b': '2', 'c': 3};\n * pick(object, ['a', 'c']);\n * // → {'a': 1, 'c': 3}\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function pick(obj: T, props: readonly K[]): Pick {\n const copy: any = {};\n for (const prop of props) {\n if (hasOwnProperty(obj, prop)) {\n copy[prop] = obj[prop];\n }\n }\n return copy;\n}\n\n/**\n * The opposite of _.pick; this method creates an object composed of the own\n * and inherited enumerable string keyed properties of object that are not omitted.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function omit(obj: T, props: readonly K[]): Omit {\n const copy = {...(obj as any)};\n for (const prop of props) {\n delete copy[prop];\n }\n return copy;\n}\n\n/**\n * Monkey patch Set so that `stringify` produces a string representation of sets.\n */\nSet.prototype['toJSON'] = function () {\n return `Set(${[...this].map(x => stableStringify(x)).join(',')})`;\n};\n\n/**\n * Converts any object to a string representation that can be consumed by humans.\n */\nexport const stringify = stableStringify;\n\n/**\n * Converts any object to a string of limited size, or a number.\n */\nexport function hash(a: any): string | number {\n if (isNumber(a)) {\n return a;\n }\n\n const str = isString(a) ? a : stableStringify(a);\n\n // short strings can be used as hash directly, longer strings are hashed to reduce memory usage\n if (str.length < 250) {\n return str;\n }\n\n // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n let h = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n h = (h << 5) - h + char;\n h = h & h; // Convert to 32bit integer\n }\n return h;\n}\n\nexport function isNullOrFalse(x: any): x is false | null {\n return x === false || x === null;\n}\n\nexport function contains(array: readonly T[], item: T) {\n return array.indexOf(item) > -1;\n}\n\n/**\n * Returns true if any item returns true.\n */\nexport function some(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (f(a, k, i++)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Returns true if all items return true.\n */\nexport function every(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (!f(a, k, i++)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Like TS Partial but applies recursively to all properties.\n */\nexport type DeepPartial = {[P in keyof T]?: DeepPartial};\n\n/**\n * recursively merges src into dest\n */\nexport function mergeDeep(dest: T, ...src: readonly DeepPartial[]): T {\n for (const s of src) {\n deepMerge_(dest, s ?? {});\n }\n return dest;\n}\n\nfunction deepMerge_(dest: any, src: any) {\n for (const property of keys(src)) {\n writeConfig(dest, property, src[property], true);\n }\n}\n\nexport function unique(values: readonly T[], f: (item: T) => string | number): T[] {\n const results: T[] = [];\n const u = {};\n let v: string | number;\n for (const val of values) {\n v = f(val);\n if (v in u) {\n continue;\n }\n u[v] = 1;\n results.push(val);\n }\n return results;\n}\n\nexport type Dict = Record;\n\n/**\n * Returns true if the two dictionaries disagree. Applies only to defined values.\n */\nexport function isEqual(dict: Dict, other: Dict) {\n const dictKeys = keys(dict);\n const otherKeys = keys(other);\n if (dictKeys.length !== otherKeys.length) {\n return false;\n }\n for (const key of dictKeys) {\n if (dict[key] !== other[key]) {\n return false;\n }\n }\n return true;\n}\n\nexport function setEqual(a: Set, b: Set) {\n if (a.size !== b.size) {\n return false;\n }\n for (const e of a) {\n if (!b.has(e)) {\n return false;\n }\n }\n return true;\n}\n\nexport function hasIntersection(a: ReadonlySet, b: ReadonlySet) {\n for (const key of a) {\n if (b.has(key)) {\n return true;\n }\n }\n return false;\n}\n\nexport function prefixGenerator(a: ReadonlySet): ReadonlySet {\n const prefixes = new Set();\n for (const x of a) {\n const splitField = splitAccessPath(x);\n // Wrap every element other than the first in `[]`\n const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`));\n const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join(''));\n for (const y of computedPrefixes) {\n prefixes.add(y);\n }\n }\n return prefixes;\n}\n\n/**\n * Returns true if a and b have an intersection. Also return true if a or b are undefined\n * since this means we don't know what fields a node produces or depends on.\n */\nexport function fieldIntersection(a: ReadonlySet, b: ReadonlySet): boolean {\n if (a === undefined || b === undefined) {\n return true;\n }\n return hasIntersection(prefixGenerator(a), prefixGenerator(b));\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isEmpty(obj: object) {\n return keys(obj).length === 0;\n}\n\n// This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208\nexport const keys = Object.keys as (o: T) => Extract[];\n\nexport const vals = Object.values;\n\nexport function entries(x: {[key: string]: T}): {key: string; value: T}[] {\n const _entries: {key: string; value: T}[] = [];\n for (const k in x) {\n if (hasOwnProperty(x, k)) {\n _entries.push({\n key: k,\n value: x[k]\n });\n }\n }\n return _entries;\n}\n\n// Using mapped type to declare a collect of flags for a string literal type S\n// https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types\nexport type Flag = {[K in S]: 1};\n\nexport function isBoolean(b: any): b is boolean {\n return b === true || b === false;\n}\n\n/**\n * Convert a string into a valid variable name\n */\nexport function varName(s: string): string {\n // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _\n const alphanumericS = s.replace(/\\W/g, '_');\n\n // Add _ if the string has leading numbers.\n return (s.match(/^\\d+/) ? '_' : '') + alphanumericS;\n}\n\nexport function logicalExpr(op: LogicalComposition, cb: (...args: readonly any[]) => string): string {\n if (isLogicalNot(op)) {\n return '!(' + logicalExpr(op.not, cb) + ')';\n } else if (isLogicalAnd(op)) {\n return '(' + op.and.map((and: LogicalComposition) => logicalExpr(and, cb)).join(') && (') + ')';\n } else if (isLogicalOr(op)) {\n return '(' + op.or.map((or: LogicalComposition) => logicalExpr(or, cb)).join(') || (') + ')';\n } else {\n return cb(op);\n }\n}\n\n/**\n * Delete nested property of an object, and delete the ancestors of the property if they become empty.\n */\nexport function deleteNestedProperty(obj: any, orderedProps: string[]) {\n if (orderedProps.length === 0) {\n return true;\n }\n const prop = orderedProps.shift()!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) {\n delete obj[prop];\n }\n return isEmpty(obj);\n}\n\nexport function titleCase(s: string) {\n return s.charAt(0).toUpperCase() + s.substr(1);\n}\n\n/**\n * Converts a path to an access path with datum.\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function accessPathWithDatum(path: string, datum = 'datum') {\n const pieces = splitAccessPath(path);\n const prefixes = [];\n for (let i = 1; i <= pieces.length; i++) {\n const prefix = `[${pieces.slice(0, i).map(stringValue).join('][')}]`;\n prefixes.push(`${datum}${prefix}`);\n }\n return prefixes.join(' && ');\n}\n\n/**\n * Return access with datum to the flattened field.\n *\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function flatAccessWithDatum(path: string, datum: 'datum' | 'parent' | 'datum.datum' = 'datum') {\n return `${datum}[${stringValue(splitAccessPath(path).join('.'))}]`;\n}\n\nfunction escapePathAccess(string: string) {\n return string.replace(/(\\[|\\]|\\.|'|\")/g, '\\\\$1');\n}\n\n/**\n * Replaces path accesses with access to non-nested field.\n * For example, `foo[\"bar\"].baz` becomes `foo\\\\.bar\\\\.baz`.\n */\nexport function replacePathInField(path: string) {\n return `${splitAccessPath(path).map(escapePathAccess).join('\\\\.')}`;\n}\n\n/**\n * Replace all occurrences of a string with another string.\n *\n * @param string the string to replace in\n * @param find the string to replace\n * @param replacement the replacement\n */\nexport function replaceAll(string: string, find: string, replacement: string) {\n return string.replace(new RegExp(find.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'g'), replacement);\n}\n\n/**\n * Remove path accesses with access from field.\n * For example, `foo[\"bar\"].baz` becomes `foo.bar.baz`.\n */\nexport function removePathFromField(path: string) {\n return `${splitAccessPath(path).join('.')}`;\n}\n\n/**\n * Count the depth of the path. Returns 1 for fields that are not nested.\n */\nexport function accessPathDepth(path: string) {\n if (!path) {\n return 0;\n }\n return splitAccessPath(path).length;\n}\n\n/**\n * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included.\n */\nexport function getFirstDefined(...args: readonly T[]): T | undefined {\n for (const arg of args) {\n if (arg !== undefined) {\n return arg;\n }\n }\n return undefined;\n}\n\n// variable used to generate id\nlet idCounter = 42;\n\n/**\n * Returns a new random id every time it gets called.\n *\n * Has side effect!\n */\nexport function uniqueId(prefix?: string) {\n const id = ++idCounter;\n return prefix ? String(prefix) + id : id;\n}\n\n/**\n * Resets the id counter used in uniqueId. This can be useful for testing.\n */\nexport function resetIdCounter() {\n idCounter = 42;\n}\n\nexport function internalField(name: string) {\n return isInternalField(name) ? name : `__${name}`;\n}\n\nexport function isInternalField(name: string) {\n return name.indexOf('__') === 0;\n}\n\n/**\n * Normalize angle to be within [0,360).\n */\nexport function normalizeAngle(angle: number) {\n if (angle === undefined) {\n return undefined;\n }\n return ((angle % 360) + 360) % 360;\n}\n\n/**\n * Returns whether the passed in value is a valid number.\n */\nexport function isNumeric(value: number | string): boolean {\n if (isNumber(value)) {\n return true;\n }\n return !isNaN(value as any) && !isNaN(parseFloat(value));\n}\n","import {\n Align,\n Axis as VgAxis,\n AxisEncode,\n AxisOrient,\n BaseAxis,\n Color,\n FontStyle,\n FontWeight,\n LabelOverlap,\n SignalRef,\n TextBaseline,\n TimeInterval,\n TimeIntervalStep\n} from 'vega';\nimport {ConditionalPredicate, Value, ValueDef} from './channeldef';\nimport {DateTime} from './datetime';\nimport {Guide, GuideEncodingEntry, TitleMixins, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\nimport {ExcludeMappedValueRefButKeepSignal, VgEncodeChannel} from './vega.schema';\n\nexport type BaseAxisNoValueRefs = AxisOverrideMixins & VLOnlyAxisMixins & ExcludeMappedValueRefButKeepSignal;\n\ninterface AxisOverrideMixins {\n // Position and tickMinStep are not config in Vega, but are in Vega-Lite. So we just copy them here.\n\n /**\n * The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate.\n *\n * __Default value__: `0`\n */\n position?: number | SignalRef;\n\n /**\n * The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.\n */\n tickMinStep?: number | SignalRef;\n\n // Override comments to be Vega-Lite specific\n /**\n * A boolean flag indicating if grid lines should be included as part of the axis\n *\n * __Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`.\n */\n grid?: boolean;\n\n /**\n * Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.\n *\n * __Default value:__ `true` for axis of a continuous x-scale. Otherwise, `false`.\n */\n labelFlush?: boolean | number;\n\n /**\n * The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `\"greedy\"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).\n *\n * __Default value:__ `true` for non-nominal fields with non-log scales; `\"greedy\"` for log scales; otherwise `false`.\n */\n labelOverlap?: LabelOverlap;\n\n /**\n * The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n *\n * __Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)\n */\n offset?: number;\n\n /**\n * The orientation of the axis. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart).\n *\n * __Default value:__ `\"bottom\"` for x-axes and `\"left\"` for y-axes.\n */\n orient?: AxisOrient | SignalRef;\n\n /**\n * A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are \"nice\" (multiples of 2, 5, 10) and lie within the underlying scale's range.\n *\n * For scales of type `\"time\"` or `\"utc\"`, the tick count can instead be a time interval specifier. Legal string values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and \"year\". Alternatively, an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary.\n *\n * __Default value__: Determine using a formula `ceil(width/40)` for x and `ceil(height/40)` for y.\n *\n * @minimum 0\n */\n tickCount?: number | TimeInterval | TimeIntervalStep | SignalRef;\n\n /**\n * Explicitly set the visible axis tick values.\n */\n values?: number[] | string[] | boolean[] | DateTime[] | SignalRef; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega.\n\n /**\n * A non-negative integer indicating the z-index of the axis.\n * If zindex is 0, axes should be drawn behind all chart elements.\n * To put them in front, set `zindex` to `1` or more.\n *\n * __Default value:__ `0` (behind the marks).\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n}\n\ninterface VLOnlyAxisMixins {\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n *\n * __Default value:__ (none)\n * __Note:__ Any specified style will augment the default style. For example, an x-axis mark with `\"style\": \"foo\"` will use `config.axisX` and `config.style.foo` (the specified style `\"foo\"` has higher precedence).\n */\n style?: string | string[];\n}\n\nexport type SignalAxisProp =\n | 'domainColor'\n | 'labelAlign'\n | 'labelColor'\n | 'gridColor'\n | 'tickColor'\n | 'titleColor'\n | 'title';\n\nexport type ConditionalAxisProp =\n | 'labelAlign'\n | 'labelBaseline'\n | 'labelColor'\n | 'labelFont'\n | 'labelFontSize'\n | 'labelFontStyle'\n | 'labelFontWeight'\n | 'labelOpacity'\n | 'labelOffset'\n | 'labelPadding'\n | 'gridColor'\n | 'gridDash'\n | 'gridDashOffset'\n | 'gridOpacity'\n | 'gridWidth'\n | 'tickColor'\n | 'tickDash'\n | 'tickDashOffset'\n | 'tickOpacity'\n | 'tickSize'\n | 'tickWidth';\n\nexport const CONDITIONAL_AXIS_PROP_INDEX: Record<\n ConditionalAxisProp | SignalAxisProp,\n {\n part: keyof AxisEncode;\n vgProp: VgEncodeChannel;\n } | null // null if we need to convert condition to signal\n> = {\n domainColor: {\n part: 'domain',\n vgProp: 'stroke'\n },\n labelAlign: {\n part: 'labels',\n vgProp: 'align'\n },\n labelBaseline: {\n part: 'labels',\n vgProp: 'baseline'\n },\n labelColor: {\n part: 'labels',\n vgProp: 'fill'\n },\n labelFont: {\n part: 'labels',\n vgProp: 'font'\n },\n labelFontSize: {\n part: 'labels',\n vgProp: 'fontSize'\n },\n labelFontStyle: {\n part: 'labels',\n vgProp: 'fontStyle'\n },\n labelFontWeight: {\n part: 'labels',\n vgProp: 'fontWeight'\n },\n labelOpacity: {\n part: 'labels',\n vgProp: 'opacity'\n },\n labelOffset: null,\n labelPadding: null, // There is no fixed vgProp for tickSize, need to use signal.\n gridColor: {\n part: 'grid',\n vgProp: 'stroke'\n },\n gridDash: {\n part: 'grid',\n vgProp: 'strokeDash'\n },\n gridDashOffset: {\n part: 'grid',\n vgProp: 'strokeDashOffset'\n },\n gridOpacity: {\n part: 'grid',\n vgProp: 'opacity'\n },\n gridWidth: {\n part: 'grid',\n vgProp: 'strokeWidth'\n },\n tickColor: {\n part: 'ticks',\n vgProp: 'stroke'\n },\n tickDash: {\n part: 'ticks',\n vgProp: 'strokeDash'\n },\n tickDashOffset: {\n part: 'ticks',\n vgProp: 'strokeDashOffset'\n },\n tickOpacity: {\n part: 'ticks',\n vgProp: 'opacity'\n },\n tickSize: null, // There is no fixed vgProp for tickSize, need to use signal.\n tickWidth: {\n part: 'ticks',\n vgProp: 'strokeWidth'\n },\n titleColor: {\n part: 'title',\n vgProp: 'fill'\n },\n title: null // title supports signal, let's use it.\n};\n\nexport type ConditionalAxisProperty = (ValueDef | SignalRef) & {\n condition: ConditionalPredicate | SignalRef> | ConditionalPredicate | SignalRef>[];\n};\n\nexport function isConditionalAxisValue(v: any): v is ConditionalAxisProperty {\n return v && v['condition'];\n}\n\nexport type ConditionalAxisNumber = ConditionalAxisProperty;\nexport type ConditionalAxisLabelAlign = ConditionalAxisProperty;\nexport type ConditionalAxisLabelBaseline = ConditionalAxisProperty;\nexport type ConditionalAxisColor = ConditionalAxisProperty;\nexport type ConditionalAxisString = ConditionalAxisProperty;\n\nexport type ConditionalAxisLabelFontStyle = ConditionalAxisProperty;\nexport type ConditionalAxisLabelFontWeight = ConditionalAxisProperty;\n\nexport type ConditionalAxisNumberArray = ConditionalAxisProperty;\n\n// Vega axis config is the same as Vega axis base. If this is not the case, add specific type.\nexport type AxisConfigBaseWithConditionalAndSignal = Omit &\n AxisPropsWithConditionAndSignal;\n\nexport interface AxisPropsWithConditionAndSignal {\n domainColor?: BaseAxisNoValueRefs['domainColor'] | SignalRef;\n labelAlign?: BaseAxisNoValueRefs['labelAlign'] | ConditionalAxisLabelAlign;\n labelBaseline?: BaseAxisNoValueRefs['labelBaseline'] | ConditionalAxisLabelBaseline;\n labelColor?: BaseAxisNoValueRefs['labelColor'] | ConditionalAxisColor | SignalRef;\n labelFont?: BaseAxisNoValueRefs['labelFont'] | ConditionalAxisString;\n labelFontSize?: BaseAxisNoValueRefs['labelFontSize'] | ConditionalAxisNumber;\n labelFontStyle?: BaseAxisNoValueRefs['labelFontStyle'] | ConditionalAxisLabelFontStyle;\n labelFontWeight?: BaseAxisNoValueRefs['labelFontWeight'] | ConditionalAxisLabelFontWeight;\n labelLineHeight?: BaseAxisNoValueRefs['labelLineHeight'] | ConditionalAxisNumber | SignalRef;\n labelOpacity?: BaseAxisNoValueRefs['labelOpacity'] | ConditionalAxisNumber;\n labelOffset?: BaseAxisNoValueRefs['labelOffset'] | ConditionalAxisNumber | SignalRef;\n labelPadding?: BaseAxisNoValueRefs['labelPadding'] | ConditionalAxisNumber;\n gridColor?: BaseAxisNoValueRefs['gridColor'] | ConditionalAxisColor | SignalRef;\n gridDash?: BaseAxisNoValueRefs['gridDash'] | ConditionalAxisNumberArray;\n gridDashOffset?: BaseAxisNoValueRefs['gridDashOffset'] | ConditionalAxisNumber;\n gridOpacity?: BaseAxisNoValueRefs['gridOpacity'] | ConditionalAxisNumber;\n gridWidth?: BaseAxisNoValueRefs['gridWidth'] | ConditionalAxisNumber;\n tickColor?: BaseAxisNoValueRefs['tickColor'] | ConditionalAxisColor | SignalRef;\n tickDash?: BaseAxisNoValueRefs['tickDash'] | ConditionalAxisNumberArray;\n tickDashOffset?: BaseAxisNoValueRefs['tickDashOffset'] | ConditionalAxisNumber;\n tickOpacity?: BaseAxisNoValueRefs['tickOpacity'] | ConditionalAxisNumber;\n tickSize?: BaseAxisNoValueRefs['tickSize'] | ConditionalAxisNumber;\n tickWidth?: BaseAxisNoValueRefs['tickWidth'] | ConditionalAxisNumber;\n titleColor?: BaseAxisNoValueRefs['titleColor'] | SignalRef;\n title?: TitleMixins['title'];\n}\n\nexport type AxisConfig = Guide &\n VlOnlyGuideConfig &\n AxisConfigBaseWithConditionalAndSignal & {\n /**\n * Disable axis by default.\n */\n disable?: boolean;\n };\n\nexport interface Axis extends AxisConfigBaseWithConditionalAndSignal, Guide {\n /**\n * Mark definitions for custom axis encoding.\n *\n * @hidden\n */\n encoding?: AxisEncoding;\n}\n\nexport type AxisPart = keyof AxisEncoding;\nexport const AXIS_PARTS: AxisPart[] = ['domain', 'grid', 'labels', 'ticks', 'title'];\n\n/**\n * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes.\n */\nexport const AXIS_PROPERTY_TYPE: Record = {\n grid: 'grid',\n gridCap: 'grid',\n gridColor: 'grid',\n gridDash: 'grid',\n gridDashOffset: 'grid',\n gridOpacity: 'grid',\n gridScale: 'grid',\n gridWidth: 'grid',\n\n orient: 'main',\n\n bandPosition: 'both', // Need to be applied to grid axis too, so the grid will align with ticks.\n\n aria: 'main',\n description: 'main',\n domain: 'main',\n domainCap: 'main',\n domainColor: 'main',\n domainDash: 'main',\n domainDashOffset: 'main',\n domainOpacity: 'main',\n domainWidth: 'main',\n format: 'main',\n formatType: 'main',\n labelAlign: 'main',\n labelAngle: 'main',\n labelBaseline: 'main',\n labelBound: 'main',\n labelColor: 'main',\n labelFlush: 'main',\n labelFlushOffset: 'main',\n labelFont: 'main',\n labelFontSize: 'main',\n labelFontStyle: 'main',\n labelFontWeight: 'main',\n labelLimit: 'main',\n labelLineHeight: 'main',\n labelOffset: 'main',\n labelOpacity: 'main',\n labelOverlap: 'main',\n labelPadding: 'main',\n labels: 'main',\n labelSeparation: 'main',\n maxExtent: 'main',\n minExtent: 'main',\n offset: 'both',\n position: 'main',\n tickCap: 'main',\n tickColor: 'main',\n tickDash: 'main',\n tickDashOffset: 'main',\n tickMinStep: 'main',\n tickOffset: 'both', // Need to be applied to grid axis too, so the grid will align with ticks.\n tickOpacity: 'main',\n tickRound: 'both', // Apply rounding to grid and ticks so they are aligned.\n ticks: 'main',\n tickSize: 'main',\n tickWidth: 'both',\n title: 'main',\n titleAlign: 'main',\n titleAnchor: 'main',\n titleAngle: 'main',\n titleBaseline: 'main',\n titleColor: 'main',\n titleFont: 'main',\n titleFontSize: 'main',\n titleFontStyle: 'main',\n titleFontWeight: 'main',\n titleLimit: 'main',\n titleLineHeight: 'main',\n titleOpacity: 'main',\n titlePadding: 'main',\n titleX: 'main',\n titleY: 'main',\n\n encode: 'both', // we hide this in Vega-Lite\n scale: 'both',\n tickBand: 'both',\n tickCount: 'both',\n tickExtra: 'both',\n translate: 'both',\n values: 'both',\n zindex: 'both' // this is actually set afterward, so it doesn't matter\n};\n\nexport interface AxisEncoding {\n /**\n * Custom encoding for the axis container.\n */\n axis?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the axis domain rule mark.\n */\n domain?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis gridline rule marks.\n */\n grid?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis label text marks.\n */\n labels?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis tick rule marks.\n */\n ticks?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the axis title text mark.\n */\n title?: GuideEncodingEntry;\n}\n\nexport const COMMON_AXIS_PROPERTIES_INDEX: Flag = {\n orient: 1, // other things can depend on orient\n\n aria: 1,\n bandPosition: 1,\n description: 1,\n domain: 1,\n domainCap: 1,\n domainColor: 1,\n domainDash: 1,\n domainDashOffset: 1,\n domainOpacity: 1,\n domainWidth: 1,\n format: 1,\n formatType: 1,\n grid: 1,\n gridCap: 1,\n gridColor: 1,\n gridDash: 1,\n gridDashOffset: 1,\n gridOpacity: 1,\n gridWidth: 1,\n labelAlign: 1,\n labelAngle: 1,\n labelBaseline: 1,\n labelBound: 1,\n labelColor: 1,\n labelFlush: 1,\n labelFlushOffset: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelLineHeight: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labels: 1,\n labelSeparation: 1,\n maxExtent: 1,\n minExtent: 1,\n offset: 1,\n position: 1,\n tickBand: 1,\n tickCap: 1,\n tickColor: 1,\n tickCount: 1,\n tickDash: 1,\n tickDashOffset: 1,\n tickExtra: 1,\n tickMinStep: 1,\n tickOffset: 1,\n tickOpacity: 1,\n tickRound: 1,\n ticks: 1,\n tickSize: 1,\n tickWidth: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleAngle: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titlePadding: 1,\n titleX: 1,\n titleY: 1,\n translate: 1,\n values: 1,\n zindex: 1\n};\n\nconst AXIS_PROPERTIES_INDEX: Flag = {\n ...COMMON_AXIS_PROPERTIES_INDEX,\n style: 1,\n labelExpr: 1,\n encoding: 1\n};\n\nexport function isAxisProperty(prop: string): prop is keyof Axis {\n return !!AXIS_PROPERTIES_INDEX[prop];\n}\n\n// Export for dependent projects\nexport const AXIS_PROPERTIES = keys(AXIS_PROPERTIES_INDEX);\n\nexport interface AxisConfigMixins {\n /**\n * Axis configuration, which determines default properties for all `x` and `y` [axes](https://vega.github.io/vega-lite/docs/axis.html). For a full list of axis configuration options, please see the [corresponding section of the axis documentation](https://vega.github.io/vega-lite/docs/axis.html#config).\n */\n axis?: AxisConfig;\n\n /**\n * X-axis specific config.\n */\n axisX?: AxisConfig;\n\n /**\n * Y-axis specific config.\n */\n axisY?: AxisConfig;\n\n /**\n * Config for y-axis along the left edge of the chart.\n */\n axisLeft?: AxisConfig;\n\n /**\n * Config for y-axis along the right edge of the chart.\n */\n axisRight?: AxisConfig;\n\n /**\n * Config for x-axis along the top edge of the chart.\n */\n axisTop?: AxisConfig;\n\n /**\n * Config for x-axis along the bottom edge of the chart.\n */\n axisBottom?: AxisConfig;\n\n /**\n * Config for axes with \"band\" scales.\n */\n axisBand?: AxisConfig;\n\n /**\n * Config for axes with \"point\" scales.\n */\n axisPoint?: AxisConfig;\n\n /**\n * Config for axes with \"point\" or \"band\" scales.\n */\n axisDiscrete?: AxisConfig;\n\n /**\n * Config for quantitative axes.\n */\n axisQuantitative?: AxisConfig;\n\n /**\n * Config for temporal axes.\n */\n axisTemporal?: AxisConfig;\n\n /**\n * Config for x-axes with \"band\" scales.\n */\n axisXBand?: AxisConfig;\n\n /**\n * Config for x-axes with \"point\" scales.\n */\n axisXPoint?: AxisConfig;\n\n /**\n * Config for x-axes with \"point\" or \"band\" scales.\n */\n axisXDiscrete?: AxisConfig;\n\n /**\n * Config for x-quantitative axes.\n */\n axisXQuantitative?: AxisConfig;\n\n /**\n * Config for x-temporal axes.\n */\n axisXTemporal?: AxisConfig;\n\n /**\n * Config for y-axes with \"band\" scales.\n */\n axisYBand?: AxisConfig;\n\n /**\n * Config for y-axes with \"point\" scales.\n */\n axisYPoint?: AxisConfig;\n\n /**\n * Config for y-axes with \"point\" or \"band\" scales.\n */\n axisYDiscrete?: AxisConfig;\n\n /**\n * Config for y-quantitative axes.\n */\n axisYQuantitative?: AxisConfig;\n\n /**\n * Config for y-temporal axes.\n */\n axisYTemporal?: AxisConfig;\n}\n","import {Align, Color, Gradient, MarkConfig as VgMarkConfig, Orientation, SignalRef, TextBaseline} from 'vega';\nimport {toSet} from 'vega-util';\nimport {CompositeMark, CompositeMarkDef} from './compositemark';\nimport {contains, Flag, keys} from './util';\n\n/**\n * All types of primitive marks.\n */\nexport const Mark = {\n arc: 'arc',\n area: 'area',\n bar: 'bar',\n image: 'image',\n line: 'line',\n point: 'point',\n rect: 'rect',\n rule: 'rule',\n text: 'text',\n tick: 'tick',\n trail: 'trail',\n circle: 'circle',\n square: 'square',\n geoshape: 'geoshape'\n} as const;\n\nexport const ARC = Mark.arc;\nexport const AREA = Mark.area;\nexport const BAR = Mark.bar;\nexport const IMAGE = Mark.image;\nexport const LINE = Mark.line;\nexport const POINT = Mark.point;\nexport const RECT = Mark.rect;\nexport const RULE = Mark.rule;\nexport const TEXT = Mark.text;\nexport const TICK = Mark.tick;\nexport const TRAIL = Mark.trail;\nexport const CIRCLE = Mark.circle;\nexport const SQUARE = Mark.square;\nexport const GEOSHAPE = Mark.geoshape;\n\nexport type Mark = keyof typeof Mark;\n\nexport function isMark(m: string): m is Mark {\n return m in Mark;\n}\n\nexport function isPathMark(m: Mark | CompositeMark): m is 'line' | 'area' | 'trail' {\n return contains(['line', 'area', 'trail'], m);\n}\n\nexport function isRectBasedMark(m: Mark | CompositeMark): m is 'rect' | 'bar' | 'image' | 'arc' {\n return contains(['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */], m);\n}\n\nexport const PRIMITIVE_MARKS = keys(Mark);\n\nexport interface ColorMixins {\n /**\n * Default color.\n *\n * __Default value:__ `\"#4682b4\"`\n *\n * __Note:__\n * - This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n * - The `fill` and `stroke` properties have higher precedence than `color` and will override `color`.\n */\n color?: Color | Gradient | SignalRef;\n}\n\nexport interface TooltipContent {\n content: 'encoding' | 'data';\n}\n\n/** @hidden */\nexport type Hide = 'hide';\n\nexport interface VLOnlyMarkConfig extends ColorMixins {\n /**\n * Whether the mark's color should be used as fill color instead of stroke color.\n *\n * __Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n *\n * __Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n *\n */\n filled?: boolean;\n\n /**\n * Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n * - If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n * - If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.\n */\n invalid?: 'filter' | Hide | null;\n\n /**\n * For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.\n */\n order?: null | boolean;\n\n /**\n * Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\n * If set to `0.5`, the marks will be positioned in the middle of the time unit band step.\n */\n timeUnitBandPosition?: number;\n\n /**\n * Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\n * If set to `0.5`, bandwidth of the marks will be half of the time unit band step.\n */\n timeUnitBand?: number;\n\n /**\n * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.\n */\n theta2?: number | SignalRef; // In Vega, this is called endAngle\n\n /**\n * The secondary (inner) radius in pixels of arc marks.\n *\n * @minimum 0\n * __Default value:__ `0`\n */\n radius2?: number | SignalRef; // In Vega, this is called innerRadius\n}\n\nexport interface MarkConfig extends VLOnlyMarkConfig, Omit {\n // ========== Overriding Vega ==========\n\n /**\n * The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n *\n * - If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n * - If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n * - If set to `null` or `false`, then no tooltip will be used.\n *\n * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n *\n * __Default value:__ `null`\n */\n tooltip?: number | string | boolean | TooltipContent | SignalRef | null; // VL has a special object form for tooltip content\n\n /**\n * Default size for marks.\n * - For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n * - For `bar`, this represents the band size of the bar, in pixels.\n * - For `text`, this represents the font size, in pixels.\n *\n * __Default value:__\n * - `30` for point, circle, square marks; width/height's `step`\n * - `2` for bar marks with discrete dimensions;\n * - `5` for bar marks with continuous dimensions;\n * - `11` for text marks.\n *\n * @minimum 0\n */\n size?: number | SignalRef; // size works beyond symbol marks in VL\n\n /**\n * X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x?: number | 'width' | SignalRef; // Vega doesn't have 'width'\n\n /**\n * Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y?: number | 'height' | SignalRef; // Vega doesn't have 'height'\n\n /**\n * X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x2?: number | 'width' | SignalRef; // Vega doesn't have 'width'\n\n /**\n * Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y2?: number | 'height' | SignalRef; // Vega doesn't have 'height'\n\n /**\n * Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n *\n * __Default value:__ (None)\n *\n */\n fill?: Color | Gradient | null | SignalRef; // docs: Vega doesn't have config.color\n\n /**\n * Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n *\n * __Default value:__ (None)\n *\n */\n stroke?: Color | Gradient | null | SignalRef; // docs: Vega doesn't have config.color\n\n /**\n * The overall opacity (value between [0,1]).\n *\n * __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.\n *\n * @minimum 0\n * @maximum 1\n */\n opacity?: number | SignalRef; // docs (different defaults)\n\n /**\n * The orientation of a non-stacked bar, tick, area, and line charts.\n * The value is either horizontal (default) or vertical.\n * - For bar, rule and tick, this determines whether the size of the bar and tick\n * should be applied to x or y dimension.\n * - For area, this property determines the orient property of the Vega output.\n * - For line and trail marks, this property determines the sort order of the points in the line\n * if `config.sortLineBy` is not specified.\n * For stacked charts, this is always determined by the orientation of the stack;\n * therefore explicitly specified value will be ignored.\n */\n orient?: Orientation; // Vega orient doesn't apply to bar/tick/line. Since some logic depends on this property, Vega-Lite does NOT allow signal for orient.\n\n /**\n * The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`.\n */\n align?: Align; // Vega doesn't apply align to ranged marks. Since some logic depends on this property, Vega-Lite does NOT allow signal for align.\n\n /**\n * The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone.\n */\n baseline?: TextBaseline; // Vega doesn't apply align to ranged marks. Since some logic depends on this property, Vega-Lite does NOT allow signal for baseline.\n\n /**\n * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n *\n * - For text marks, polar coordinate angle in radians.\n *\n * @minimum 0\n * @maximum 360\n */\n theta?: number | SignalRef; // overriding VG\n\n /**\n *\n * For arc mark, the primary (outer) radius in pixels.\n *\n * For text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.\n *\n * @minimum 0\n *\n * __Default value:__ `min(plot_width, plot_height)/2`\n */\n radius?: number | SignalRef; // overriding VG\n\n /**\n * The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.\n *\n * @minimum 0\n * __Default value:__ `0`\n */\n innerRadius?: number | SignalRef;\n\n /**\n * The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.\n *\n * @minimum 0\n * __Default value:__ `0`\n */\n outerRadius?: number | SignalRef;\n}\n\nexport interface RectBinSpacingMixins {\n /**\n * Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style).\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n binSpacing?: number;\n}\n\nexport type AnyMark = CompositeMark | CompositeMarkDef | Mark | MarkDef;\n\nexport function isMarkDef(mark: string | GenericMarkDef): mark is GenericMarkDef {\n return mark['type'];\n}\n\nconst PRIMITIVE_MARK_INDEX = toSet(PRIMITIVE_MARKS);\n\nexport function isPrimitiveMark(mark: AnyMark): mark is Mark {\n const markType = isMarkDef(mark) ? mark.type : mark;\n return markType in PRIMITIVE_MARK_INDEX;\n}\n\nexport const STROKE_CONFIG = [\n 'stroke',\n 'strokeWidth',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeOpacity',\n 'strokeJoin',\n 'strokeMiterLimit'\n] as const;\n\nexport const FILL_CONFIG = ['fill', 'fillOpacity'] as const;\n\nexport const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG];\n\nconst VL_ONLY_MARK_CONFIG_INDEX: Flag = {\n color: 1,\n filled: 1,\n invalid: 1,\n order: 1,\n radius2: 1,\n theta2: 1,\n timeUnitBand: 1,\n timeUnitBandPosition: 1\n};\n\nexport const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX);\n\nexport const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: {\n [k in Mark]?: (keyof Required[k])[];\n} = {\n area: ['line', 'point'],\n bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize'],\n rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize'],\n line: ['point'],\n tick: ['bandSize', 'thickness']\n};\n\nexport const defaultMarkConfig: MarkConfig = {\n color: '#4c78a8',\n invalid: 'filter',\n timeUnitBand: 1\n};\n\n// TODO: replace with MarkConfigMixins[Mark] once https://github.com/vega/ts-json-schema-generator/issues/344 is fixed\nexport type AnyMarkConfig = MarkConfig | AreaConfig | BarConfig | RectConfig | LineConfig | TickConfig;\n\nexport interface MarkConfigMixins {\n /** Mark Config */\n mark?: MarkConfig;\n\n // MARK-SPECIFIC CONFIGS\n\n /** Arc-specific Config */\n arc?: RectConfig;\n\n /** Area-Specific Config */\n area?: AreaConfig;\n\n /** Bar-Specific Config */\n bar?: BarConfig;\n\n /** Circle-Specific Config */\n circle?: MarkConfig;\n\n /** Image-specific Config */\n image?: RectConfig;\n\n /** Line-Specific Config */\n line?: LineConfig;\n\n /** Point-Specific Config */\n point?: MarkConfig;\n\n /** Rect-Specific Config */\n rect?: RectConfig;\n\n /** Rule-Specific Config */\n rule?: MarkConfig;\n\n /** Square-Specific Config */\n square?: MarkConfig;\n\n /** Text-Specific Config */\n text?: MarkConfig;\n\n /** Tick-Specific Config */\n tick?: TickConfig;\n\n /** Trail-Specific Config */\n trail?: LineConfig;\n\n /** Geoshape-Specific Config */\n geoshape?: MarkConfig;\n}\n\nexport interface RectConfig extends RectBinSpacingMixins, MarkConfig {\n /**\n * The default size of the bars on continuous scales.\n *\n * __Default value:__ `5`\n *\n * @minimum 0\n */\n continuousBandSize?: number;\n\n /**\n * The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.\n * @minimum 0\n */\n discreteBandSize?: number;\n}\n\nexport const BAR_CORNER_RADIUS_INDEX: Partial> = {\n horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'],\n vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight']\n};\n\nexport interface BarCornerRadiusMixins {\n /**\n * - For vertical bars, top-left and top-right corner radius.\n * - For horizontal bars, top-right and bottom-right corner radius.\n */\n cornerRadiusEnd?: number | SignalRef;\n}\n\nexport type BarConfig = RectConfig & BarCornerRadiusMixins;\n\nexport type OverlayMarkDef = MarkConfig & MarkDefMixins;\n\nexport interface PointOverlayMixins {\n /**\n * A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.\n *\n * - If this property is `\"transparent\"`, transparent points will be used (for enhancing tooltips and selections).\n *\n * - If this property is an empty object (`{}`) or `true`, filled points with default properties will be used.\n *\n * - If this property is `false`, no points would be automatically added to line or area marks.\n *\n * __Default value:__ `false`.\n */\n point?: boolean | OverlayMarkDef | 'transparent';\n}\n\nexport interface LineConfig extends MarkConfig, PointOverlayMixins {}\n\nexport interface LineOverlayMixins {\n /**\n * A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.\n *\n * - If this value is an empty object (`{}`) or `true`, lines with default properties will be used.\n *\n * - If this value is `false`, no lines would be automatically added to area marks.\n *\n * __Default value:__ `false`.\n */\n line?: boolean | OverlayMarkDef;\n}\n\nexport interface AreaConfig extends MarkConfig, PointOverlayMixins, LineOverlayMixins {}\n\nexport interface TickThicknessMixins {\n /**\n * Thickness of the tick mark.\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n thickness?: number | SignalRef;\n}\n\nexport interface GenericMarkDef {\n /**\n * The mark type. This could a primitive mark type\n * (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n * `\"area\"`, `\"point\"`, `\"geoshape\"`, `\"rule\"`, and `\"text\"`)\n * or a composite mark type (`\"boxplot\"`, `\"errorband\"`, `\"errorbar\"`).\n */\n type: M;\n}\n\nexport interface MarkDefMixins {\n /**\n * A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](https://vega.github.io/vega-lite/docs/encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default.\n *\n * __Default value:__ The mark's name. For example, a bar mark will have style `\"bar\"` by default.\n * __Note:__ Any specified style will augment the default style. For example, a bar mark with `\"style\": \"foo\"` will receive from `config.style.bar` and `config.style.foo` (the specified style `\"foo\"` has higher precedence).\n */\n style?: string | string[];\n\n /**\n * Whether a mark be clipped to the enclosing group’s width and height.\n */\n clip?: boolean;\n\n // Offset properties should not be a part of config\n\n /**\n * Offset for x-position.\n */\n xOffset?: number | SignalRef;\n\n /**\n * Offset for y-position.\n */\n yOffset?: number | SignalRef;\n\n /**\n * Offset for x2-position.\n */\n x2Offset?: number | SignalRef;\n\n /**\n * Offset for y2-position.\n */\n y2Offset?: number | SignalRef;\n\n /**\n * Offset for theta.\n */\n thetaOffset?: number | SignalRef;\n\n /**\n * Offset for theta2.\n */\n theta2Offset?: number | SignalRef;\n\n /**\n * Offset for radius.\n */\n radiusOffset?: number | SignalRef;\n\n /**\n * Offset for radius2.\n */\n radius2Offset?: number | SignalRef;\n}\n\n// Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef\n\n// Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef\nexport interface MarkDef\n extends GenericMarkDef,\n Omit<\n MarkConfig &\n AreaConfig &\n BarConfig & // always extends RectConfig\n LineConfig &\n TickConfig,\n 'startAngle' | 'endAngle'\n >,\n MarkDefMixins {\n // Omit startAngle/endAngle since we use theta/theta2 from Vega-Lite schema to avoid confusion\n // We still support start/endAngle only in config, just in case people use Vega config with Vega-Lite.\n\n /**\n * @hidden\n */\n startAngle?: number | SignalRef;\n /**\n * @hidden\n */\n endAngle?: number | SignalRef;\n}\n\nconst DEFAULT_RECT_BAND_SIZE = 5;\n\nexport const defaultBarConfig: RectConfig = {\n binSpacing: 1,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n timeUnitBandPosition: 0.5\n};\n\nexport const defaultRectConfig: RectConfig = {\n binSpacing: 0,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n timeUnitBandPosition: 0.5\n};\n\nexport interface TickConfig extends MarkConfig, TickThicknessMixins {\n /**\n * The width of the ticks.\n *\n * __Default value:__ 3/4 of step (width step for horizontal ticks and height step for vertical ticks).\n * @minimum 0\n */\n bandSize?: number;\n}\n\nexport const defaultTickConfig: TickConfig = {\n thickness: 1\n};\n\nexport function getMarkType(m: string | GenericMarkDef) {\n return isMarkDef(m) ? m.type : m;\n}\n","import {FieldName} from '../channeldef';\nimport {CompositeEncoding, FacetedCompositeEncoding} from '../compositemark';\nimport {Encoding} from '../encoding';\nimport {AnyMark, Mark, MarkDef} from '../mark';\nimport {Projection} from '../projection';\nimport {SelectionDef} from '../selection';\nimport {\n BaseSpec,\n DataMixins,\n DeprecatedFrameMixins,\n FrameMixins,\n GenericCompositionLayout,\n ResolveMixins\n} from './base';\nimport {TopLevel} from './toplevel';\n\n/**\n * Base interface for a unit (single-view) specification.\n */\nexport interface GenericUnitSpec, M> extends BaseSpec {\n /**\n * A string describing the mark type (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n * `\"area\"`, `\"point\"`, `\"rule\"`, `\"geoshape\"`, and `\"text\"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n */\n mark: M;\n\n /**\n * A key-value mapping between encoding channels and definition of fields.\n */\n encoding?: E;\n\n /**\n * An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks\n * and to `latitude` and `\"longitude\"` channels for other marks.\n */\n projection?: Projection;\n\n /**\n * A key-value mapping between selection names and definitions.\n */\n selection?: Record;\n}\n\n/**\n * A unit specification without any shortcut/expansion syntax.\n */\nexport type NormalizedUnitSpec = GenericUnitSpec, Mark | MarkDef>;\n\n/**\n * A unit specification, which can contain either [primitive marks or composite marks](https://vega.github.io/vega-lite/docs/mark.html#types).\n */\nexport type UnitSpec = GenericUnitSpec & DeprecatedFrameMixins;\n\nexport type UnitSpecWithFrame = GenericUnitSpec & FrameMixins;\n\n/**\n * Unit spec that can have a composite mark and row or column channels (shorthand for a facet spec).\n */\nexport type FacetedUnitSpec = GenericUnitSpec &\n ResolveMixins &\n GenericCompositionLayout &\n FrameMixins;\n\nexport type TopLevelUnitSpec = TopLevel & DataMixins;\n\nexport function isUnitSpec(spec: BaseSpec): spec is FacetedUnitSpec | NormalizedUnitSpec {\n return 'mark' in spec;\n}\n","import {Encoding} from '../encoding';\nimport {GenericMarkDef, getMarkType} from '../mark';\nimport {NonFacetUnitNormalizer, Normalize, NormalizerParams} from '../normalize/base';\nimport {GenericSpec} from '../spec';\nimport {GenericLayerSpec, NormalizedLayerSpec} from '../spec/layer';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {FieldName} from '../channeldef';\n\n// TODO: replace string with Mark\nexport type CompositeMarkUnitSpec = GenericUnitSpec>;\n\nexport class CompositeMarkNormalizer implements NonFacetUnitNormalizer> {\n constructor(\n public name: string,\n public run: (\n spec: CompositeMarkUnitSpec,\n params: NormalizerParams,\n normalize: Normalize<\n // Input of the normalize method\n GenericUnitSpec, M> | GenericLayerSpec,\n // Output of the normalize method\n NormalizedLayerSpec | NormalizedUnitSpec\n >\n ) => NormalizedLayerSpec | NormalizedUnitSpec\n ) {}\n\n public hasMatchingType(spec: GenericSpec): spec is CompositeMarkUnitSpec {\n if (isUnitSpec(spec)) {\n return getMarkType(spec.mark) === this.name;\n }\n return false;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {isString, toSet} from 'vega-util';\nimport {contains, Flag, keys} from './util';\n\nconst AGGREGATE_OP_INDEX: Flag = {\n argmax: 1,\n argmin: 1,\n average: 1,\n count: 1,\n distinct: 1,\n product: 1,\n max: 1,\n mean: 1,\n median: 1,\n min: 1,\n missing: 1,\n q1: 1,\n q3: 1,\n ci0: 1,\n ci1: 1,\n stderr: 1,\n stdev: 1,\n stdevp: 1,\n sum: 1,\n valid: 1,\n values: 1,\n variance: 1,\n variancep: 1\n};\n\nexport const MULTIDOMAIN_SORT_OP_INDEX = {\n count: 1,\n min: 1,\n max: 1\n};\n\nexport interface ArgminDef {\n argmin: string;\n}\n\nexport interface ArgmaxDef {\n argmax: string;\n}\n\nexport type NonArgAggregateOp = Exclude;\n\nexport type Aggregate = NonArgAggregateOp | ArgmaxDef | ArgminDef;\n\nexport function isArgminDef(a: Aggregate | string): a is ArgminDef {\n return !!a && !!a['argmin'];\n}\n\nexport function isArgmaxDef(a: Aggregate | string): a is ArgmaxDef {\n return !!a && !!a['argmax'];\n}\n\nexport const AGGREGATE_OPS = keys(AGGREGATE_OP_INDEX);\n\nexport function isAggregateOp(a: string | ArgminDef | ArgmaxDef): a is AggregateOp {\n return isString(a) && !!AGGREGATE_OP_INDEX[a];\n}\n\nexport const COUNTING_OPS: NonArgAggregateOp[] = ['count', 'valid', 'missing', 'distinct'];\n\nexport function isCountingAggregateOp(aggregate?: string | Aggregate): boolean {\n return isString(aggregate) && contains(COUNTING_OPS, aggregate);\n}\n\nexport function isMinMaxOp(aggregate?: Aggregate | string): boolean {\n return isString(aggregate) && contains(['min', 'max'], aggregate);\n}\n\n/** Additive-based aggregation operations. These can be applied to stack. */\nexport const SUM_OPS: NonArgAggregateOp[] = ['count', 'sum', 'distinct', 'valid', 'missing'];\n\n/**\n * Aggregation operators that always produce values within the range [domainMin, domainMax].\n */\nexport const SHARED_DOMAIN_OPS: AggregateOp[] = ['mean', 'average', 'median', 'q1', 'q3', 'min', 'max'];\n\nexport const SHARED_DOMAIN_OP_INDEX = toSet(SHARED_DOMAIN_OPS);\n","/*\n * Constants and utilities for encoding channels (Visual variables)\n * such as 'x', 'y', 'color'.\n */\n\nimport {RangeType} from './compile/scale/type';\nimport {Encoding} from './encoding';\nimport {Mark} from './mark';\nimport {EncodingFacetMapping} from './spec/facet';\nimport {Flag, keys} from './util';\n\nexport type Channel = keyof Encoding;\nexport type ExtendedChannel = Channel | FacetChannel;\n\n// Facet\nexport const ROW = 'row' as const;\nexport const COLUMN = 'column' as const;\n\nexport const FACET = 'facet' as const;\n\n// Position\nexport const X = 'x' as const;\nexport const Y = 'y' as const;\nexport const X2 = 'x2' as const;\nexport const Y2 = 'y2' as const;\n\n// Arc-Position\nexport const RADIUS = 'radius' as const;\nexport const RADIUS2 = 'radius2' as const;\nexport const THETA = 'theta' as const;\nexport const THETA2 = 'theta2' as const;\n\n// Geo Position\nexport const LATITUDE = 'latitude' as const;\nexport const LONGITUDE = 'longitude' as const;\nexport const LATITUDE2 = 'latitude2' as const;\nexport const LONGITUDE2 = 'longitude2' as const;\n\n// Mark property with scale\nexport const COLOR = 'color' as const;\n\nexport const FILL = 'fill' as const;\n\nexport const STROKE = 'stroke' as const;\n\nexport const SHAPE = 'shape' as const;\nexport const SIZE = 'size' as const;\n\nexport const ANGLE = 'angle' as const;\n\nexport const OPACITY = 'opacity' as const;\nexport const FILLOPACITY = 'fillOpacity' as const;\n\nexport const STROKEOPACITY = 'strokeOpacity' as const;\n\nexport const STROKEWIDTH = 'strokeWidth' as const;\nexport const STROKEDASH = 'strokeDash' as const;\n\n// Non-scale channel\nexport const TEXT = 'text' as const;\nexport const ORDER = 'order' as const;\nexport const DETAIL = 'detail' as const;\nexport const KEY = 'key' as const;\n\nexport const TOOLTIP = 'tooltip' as const;\nexport const HREF = 'href' as const;\n\nexport const URL = 'url' as const;\nexport const DESCRIPTION = 'description' as const;\n\nconst POSITION_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n x2: 1,\n y2: 1\n} as const;\n\nexport type PositionChannel = keyof typeof POSITION_CHANNEL_INDEX;\n\nconst POLAR_POSITION_CHANNEL_INDEX = {\n theta: 1,\n theta2: 1,\n radius: 1,\n radius2: 1\n} as const;\n\nexport type PolarPositionChannel = keyof typeof POLAR_POSITION_CHANNEL_INDEX;\n\nexport function isPolarPositionChannel(c: Channel): c is PolarPositionChannel {\n return c in POLAR_POSITION_CHANNEL_INDEX;\n}\n\nconst GEO_POSIITON_CHANNEL_INDEX = {\n longitude: 1,\n longitude2: 1,\n latitude: 1,\n latitude2: 1\n} as const;\n\nexport type GeoPositionChannel = keyof typeof GEO_POSIITON_CHANNEL_INDEX;\n\nexport function getPositionChannelFromLatLong(channel: GeoPositionChannel): PositionChannel {\n switch (channel) {\n case LATITUDE:\n return 'y';\n case LATITUDE2:\n return 'y2';\n case LONGITUDE:\n return 'x';\n case LONGITUDE2:\n return 'x2';\n }\n}\n\nexport function isGeoPositionChannel(c: Channel): c is GeoPositionChannel {\n return c in GEO_POSIITON_CHANNEL_INDEX;\n}\n\nexport const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX);\n\nconst UNIT_CHANNEL_INDEX: Flag = {\n ...POSITION_CHANNEL_INDEX,\n ...POLAR_POSITION_CHANNEL_INDEX,\n\n ...GEO_POSIITON_CHANNEL_INDEX,\n\n // color\n color: 1,\n fill: 1,\n stroke: 1,\n\n // other non-position with scale\n opacity: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n\n strokeWidth: 1,\n strokeDash: 1,\n size: 1,\n angle: 1,\n shape: 1,\n\n // channels without scales\n order: 1,\n text: 1,\n detail: 1,\n key: 1,\n tooltip: 1,\n href: 1,\n url: 1,\n description: 1\n};\n\nexport type ColorChannel = 'color' | 'fill' | 'stroke';\n\nexport function isColorChannel(channel: Channel): channel is ColorChannel {\n return channel === COLOR || channel === FILL || channel === STROKE;\n}\n\nexport type FacetChannel = keyof EncodingFacetMapping;\n\nconst FACET_CHANNEL_INDEX: Flag> = {\n row: 1,\n column: 1,\n facet: 1\n};\n\nexport const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX);\n\nconst CHANNEL_INDEX = {\n ...UNIT_CHANNEL_INDEX,\n ...FACET_CHANNEL_INDEX\n};\n\nexport const CHANNELS = keys(CHANNEL_INDEX);\n\nconst {order: _o, detail: _d, tooltip: _tt1, ...SINGLE_DEF_CHANNEL_INDEX} = CHANNEL_INDEX;\nconst {row: _r, column: _c, facet: _f, ...SINGLE_DEF_UNIT_CHANNEL_INDEX} = SINGLE_DEF_CHANNEL_INDEX;\n/**\n * Channels that cannot have an array of channelDef.\n * model.fieldDef, getFieldDef only work for these channels.\n *\n * (The only two channels that can have an array of channelDefs are \"detail\" and \"order\".\n * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef\n * are not applicable for them. Similarly, selection projection won't work with \"detail\" and \"order\".)\n */\n\nexport const SINGLE_DEF_CHANNELS = keys(SINGLE_DEF_CHANNEL_INDEX);\n\nexport type SingleDefChannel = typeof SINGLE_DEF_CHANNELS[number];\n\nexport const SINGLE_DEF_UNIT_CHANNELS = keys(SINGLE_DEF_UNIT_CHANNEL_INDEX);\n\nexport type SingleDefUnitChannel = typeof SINGLE_DEF_UNIT_CHANNELS[number];\n\nexport function isSingleDefUnitChannel(str: string): str is SingleDefUnitChannel {\n return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str];\n}\n\nexport function isChannel(str: string): str is Channel {\n return !!CHANNEL_INDEX[str];\n}\n\nexport type SecondaryRangeChannel = 'x2' | 'y2' | 'latitude2' | 'longitude2' | 'theta2' | 'radius2';\n\nexport const SECONDARY_RANGE_CHANNEL: SecondaryRangeChannel[] = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2];\n\nexport function isSecondaryRangeChannel(c: ExtendedChannel): c is SecondaryRangeChannel {\n const main = getMainRangeChannel(c);\n return main !== c;\n}\n\nexport type MainChannelOf = C extends 'x2'\n ? 'x'\n : C extends 'y2'\n ? 'y'\n : C extends 'latitude2'\n ? 'latitude'\n : C extends 'longitude2'\n ? 'longitude'\n : C extends 'theta2'\n ? 'theta'\n : C extends 'radius2'\n ? 'radius'\n : C;\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getMainRangeChannel(channel: C): MainChannelOf {\n switch (channel) {\n case X2:\n return X as MainChannelOf;\n case Y2:\n return Y as MainChannelOf;\n case LATITUDE2:\n return LATITUDE as MainChannelOf;\n case LONGITUDE2:\n return LONGITUDE as MainChannelOf;\n case THETA2:\n return THETA as MainChannelOf;\n case RADIUS2:\n return RADIUS as MainChannelOf;\n }\n return channel as MainChannelOf;\n}\n\nexport type SecondaryChannelOf = C extends 'x'\n ? 'x2'\n : C extends 'y'\n ? 'y2'\n : C extends 'latitude'\n ? 'latitude2'\n : C extends 'longitude'\n ? 'longitude2'\n : C extends 'theta'\n ? 'theta2'\n : C extends 'radius'\n ? 'radius2'\n : undefined;\n\nexport function getVgPositionChannel(channel: PolarPositionChannel | PositionChannel) {\n if (isPolarPositionChannel(channel)) {\n switch (channel) {\n case THETA:\n return 'startAngle';\n case THETA2:\n return 'endAngle';\n case RADIUS:\n return 'outerRadius';\n case RADIUS2:\n return 'innerRadius';\n }\n }\n return channel;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getSecondaryRangeChannel(channel: C): SecondaryChannelOf | undefined {\n switch (channel) {\n case X:\n return X2 as SecondaryChannelOf;\n case Y:\n return Y2 as SecondaryChannelOf;\n case LATITUDE:\n return LATITUDE2 as SecondaryChannelOf;\n case LONGITUDE:\n return LONGITUDE2 as SecondaryChannelOf;\n case THETA:\n return THETA2 as SecondaryChannelOf;\n case RADIUS:\n return RADIUS2 as SecondaryChannelOf;\n }\n return undefined;\n}\n\nexport function getSizeChannel(channel: PositionChannel): 'width' | 'height';\nexport function getSizeChannel(channel: Channel): 'width' | 'height' | undefined;\nexport function getSizeChannel(channel: Channel): 'width' | 'height' | undefined {\n switch (channel) {\n case X:\n case X2:\n return 'width';\n case Y:\n case Y2:\n return 'height';\n }\n return undefined;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetChannel(channel: Channel) {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n case X2:\n return 'x2Offset';\n case Y2:\n return 'y2Offset';\n case THETA:\n return 'thetaOffset';\n case RADIUS:\n return 'radiusOffset';\n case THETA2:\n return 'theta2Offset';\n case RADIUS2:\n return 'radius2Offset';\n }\n return undefined;\n}\n\n// CHANNELS without COLUMN, ROW\nexport const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX);\n\n// NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2;\nconst {\n x: _x,\n y: _y,\n // x2 and y2 share the same scale as x and y\n x2: _x2,\n y2: _y2,\n latitude: _latitude,\n longitude: _longitude,\n latitude2: _latitude2,\n longitude2: _longitude2,\n theta: _theta,\n theta2: _theta2,\n radius: _radius,\n radius2: _radius2,\n // The rest of unit channels then have scale\n ...NONPOSITION_CHANNEL_INDEX\n} = UNIT_CHANNEL_INDEX;\n\nexport const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX);\nexport type NonPositionChannel = typeof NONPOSITION_CHANNELS[number];\n\nexport const POSITION_SCALE_CHANNEL_INDEX = {\n x: 1,\n y: 1\n} as const;\nexport const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX);\nexport type PositionScaleChannel = keyof typeof POSITION_SCALE_CHANNEL_INDEX;\n\nexport function isXorY(channel: ExtendedChannel): channel is PositionScaleChannel {\n return channel in POSITION_SCALE_CHANNEL_INDEX;\n}\n\nexport const POLAR_POSITION_SCALE_CHANNEL_INDEX = {\n theta: 1,\n radius: 1\n} as const;\n\nexport const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX);\nexport type PolarPositionScaleChannel = keyof typeof POLAR_POSITION_SCALE_CHANNEL_INDEX;\n\nexport function getPositionScaleChannel(sizeType: 'width' | 'height'): PositionScaleChannel {\n return sizeType === 'width' ? X : Y;\n}\n\n// NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without X, Y\nconst {\n // x2 and y2 share the same scale as x and y\n // text and tooltip have format instead of scale,\n // href has neither format, nor scale\n text: _t,\n tooltip: _tt,\n href: _hr,\n url: _u,\n description: _al,\n // detail and order have no scale\n detail: _dd,\n key: _k,\n order: _oo,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n} = NONPOSITION_CHANNEL_INDEX;\nexport const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX);\nexport type NonPositionScaleChannel = typeof NONPOSITION_SCALE_CHANNELS[number];\n\nexport function isNonPositionScaleChannel(channel: Channel): channel is NonPositionScaleChannel {\n return !!NONPOSITION_CHANNEL_INDEX[channel];\n}\n\n/**\n * @returns whether Vega supports legends for a particular channel\n */\nexport function supportLegend(channel: NonPositionScaleChannel) {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n case SIZE:\n case SHAPE:\n case OPACITY:\n case STROKEWIDTH:\n case STROKEDASH:\n return true;\n case FILLOPACITY:\n case STROKEOPACITY:\n case ANGLE:\n return false;\n }\n}\n\n// Declare SCALE_CHANNEL_INDEX\nconst SCALE_CHANNEL_INDEX = {\n ...POSITION_SCALE_CHANNEL_INDEX,\n ...POLAR_POSITION_SCALE_CHANNEL_INDEX,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n};\n\n/** List of channels with scales */\nexport const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX);\nexport type ScaleChannel = typeof SCALE_CHANNELS[number];\n\nexport function isScaleChannel(channel: Channel): channel is ScaleChannel {\n return !!SCALE_CHANNEL_INDEX[channel];\n}\n\nexport type SupportedMark = Partial>;\n\n/**\n * Return whether a channel supports a particular mark type.\n * @param channel channel name\n * @param mark the mark type\n * @return whether the mark supports the channel\n */\nexport function supportMark(channel: Channel, mark: Mark) {\n return getSupportedMark(channel)[mark];\n}\n\nconst ALL_MARKS: Record = {\n // all marks\n arc: 'always',\n area: 'always',\n bar: 'always',\n circle: 'always',\n geoshape: 'always',\n image: 'always',\n line: 'always',\n rule: 'always',\n point: 'always',\n rect: 'always',\n square: 'always',\n trail: 'always',\n text: 'always',\n tick: 'always'\n};\n\nconst {geoshape: _g, ...ALL_MARKS_EXCEPT_GEOSHAPE} = ALL_MARKS;\n\n/**\n * Return a dictionary showing whether a channel supports mark type.\n * @param channel\n * @return A dictionary mapping mark types to 'always', 'binned', or undefined\n */\nfunction getSupportedMark(channel: ExtendedChannel): SupportedMark {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n // falls through\n\n case DESCRIPTION:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case ORDER: // TODO: revise (order might not support rect, which is not stackable?)\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n\n // falls through\n\n case FACET:\n case ROW: // falls through\n case COLUMN:\n return ALL_MARKS;\n case X:\n case Y:\n case LATITUDE:\n case LONGITUDE:\n // all marks except geoshape. geoshape does not use X, Y -- it uses a projection\n return ALL_MARKS_EXCEPT_GEOSHAPE;\n case X2:\n case Y2:\n case LATITUDE2:\n case LONGITUDE2:\n return {\n area: 'always',\n bar: 'always',\n image: 'always',\n rect: 'always',\n rule: 'always',\n circle: 'binned',\n point: 'binned',\n square: 'binned',\n tick: 'binned',\n line: 'binned',\n trail: 'binned'\n };\n case SIZE:\n return {\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n text: 'always',\n line: 'always',\n trail: 'always'\n };\n case STROKEDASH:\n return {\n line: 'always',\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n geoshape: 'always'\n };\n case SHAPE:\n return {point: 'always', geoshape: 'always'};\n case TEXT:\n return {text: 'always'};\n case ANGLE:\n return {point: 'always', square: 'always', text: 'always'};\n case URL:\n return {image: 'always'};\n case THETA:\n return {text: 'always', arc: 'always'};\n case RADIUS:\n return {text: 'always', arc: 'always'};\n case THETA2:\n case RADIUS2:\n return {arc: 'always'};\n }\n}\n\nexport function rangeType(channel: ExtendedChannel): RangeType {\n switch (channel) {\n case X:\n case Y:\n case THETA:\n case RADIUS:\n case SIZE:\n case ANGLE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n\n // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through]\n case X2:\n case Y2:\n case THETA2:\n case RADIUS2:\n return undefined;\n\n case FACET:\n case ROW:\n case COLUMN:\n case SHAPE:\n case STROKEDASH:\n // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through]\n case TEXT:\n case TOOLTIP:\n case HREF:\n case URL:\n case DESCRIPTION:\n return 'discrete';\n\n // Color can be either continuous or discrete, depending on scale type.\n case COLOR:\n case FILL:\n case STROKE:\n return 'flexible';\n\n // No scale, no range type.\n\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n case DETAIL:\n case KEY:\n case ORDER:\n return undefined;\n }\n}\n","import {isBoolean, isObject} from 'vega-util';\nimport {\n COLOR,\n COLUMN,\n ExtendedChannel,\n FILL,\n FILLOPACITY,\n OPACITY,\n ROW,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH\n} from './channel';\nimport {normalizeBin} from './channeldef';\nimport {SelectionExtent} from './selection';\nimport {keys, varName} from './util';\n\nexport interface BaseBin {\n /**\n * The number base to use for automatic bin determination (default is base 10).\n *\n * __Default value:__ `10`\n *\n */\n base?: number;\n /**\n * An exact step size to use between bins.\n *\n * __Note:__ If provided, options such as maxbins will be ignored.\n */\n step?: number;\n /**\n * An array of allowable step sizes to choose from.\n * @minItems 1\n */\n steps?: number[];\n /**\n * A minimum allowable step size (particularly useful for integer values).\n */\n minstep?: number;\n /**\n * Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints.\n *\n * __Default value:__ `[5, 2]`\n *\n * @minItems 1\n */\n divide?: [number, number];\n /**\n * Maximum number of bins.\n *\n * __Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels\n *\n * @minimum 2\n */\n maxbins?: number;\n /**\n * A value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value.\n *\n * __Default value:__ the minimum bin extent value\n */\n anchor?: number;\n /**\n * If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.\n *\n * __Default value:__ `true`\n */\n nice?: boolean;\n}\n\n/**\n * Binning properties or boolean flag for determining whether to bin data or not.\n */\nexport interface BinParams extends BaseBin {\n /**\n * A two-element (`[min, max]`) array indicating the range of desired bin values.\n */\n extent?: BinExtent; // VgBinTransform uses a different extent so we need to pull this out.\n\n /**\n * When set to `true`, Vega-Lite treats the input data as already binned.\n */\n binned?: boolean;\n}\n\nexport type Bin = boolean | BinParams | 'binned' | null;\n\nexport type BinExtent = [number, number] | SelectionExtent;\n\n/**\n * Create a key for the bin configuration. Not for prebinned bin.\n */\nexport function binToString(bin: BinParams | true) {\n if (isBoolean(bin)) {\n bin = normalizeBin(bin, undefined);\n }\n return (\n 'bin' +\n keys(bin)\n .map(p => (isSelectionExtent(bin[p]) ? varName(`_${p}_${Object.entries(bin[p])}`) : varName(`_${p}_${bin[p]}`)))\n .join('')\n );\n}\n\n/**\n * Vega-Lite should bin the data.\n */\nexport function isBinning(bin: BinParams | boolean | 'binned'): bin is BinParams | true {\n return bin === true || (isBinParams(bin) && !bin.binned);\n}\n\n/**\n * The data is already binned and so Vega-Lite should not bin it again.\n */\nexport function isBinned(bin: BinParams | boolean | 'binned'): bin is 'binned' | BinParams {\n return bin === 'binned' || (isBinParams(bin) && bin.binned === true);\n}\n\nexport function isBinParams(bin: BinParams | boolean | 'binned'): bin is BinParams {\n return isObject(bin);\n}\n\nexport function isSelectionExtent(extent: BinExtent): extent is SelectionExtent {\n return extent?.['selection'];\n}\n\nexport function autoMaxBins(channel?: ExtendedChannel): number {\n switch (channel) {\n case ROW:\n case COLUMN:\n case SIZE:\n case COLOR:\n case FILL:\n case STROKE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // Facets and Size shouldn't have too many bins\n // We choose 6 like shape to simplify the rule [falls through]\n case SHAPE:\n return 6; // Vega's \"shape\" has 6 distinct values\n case STROKEDASH:\n return 4; // We only provide 5 different stroke dash values (but 4 is more effective)\n default:\n return 10;\n }\n}\n","/**\n * Collection of all Vega-Lite Error Messages\n */\nimport {AggregateOp} from 'vega';\nimport {Aggregate} from '../aggregate';\nimport {\n Channel,\n FacetChannel,\n GeoPositionChannel,\n getSizeChannel,\n PositionScaleChannel,\n ScaleChannel,\n ExtendedChannel\n} from '../channel';\nimport {HiddenCompositeAggregate, TypedFieldDef, Value} from '../channeldef';\nimport {SplitParentProperty} from '../compile/split';\nimport {CompositeMark} from '../compositemark';\nimport {ErrorBarCenter, ErrorBarExtent} from '../compositemark/errorbar';\nimport {DateTime, DateTimeExpr} from '../datetime';\nimport {Mark} from '../mark';\nimport {Projection} from '../projection';\nimport {ScaleType} from '../scale';\nimport {GenericSpec} from '../spec';\nimport {Type} from '../type';\nimport {stringify} from '../util';\nimport {VgSortField} from '../vega.schema';\n\nexport function invalidSpec(spec: GenericSpec) {\n return `Invalid specification ${JSON.stringify(\n spec\n )}. Make sure the specification includes at least one of the following properties: \"mark\", \"layer\", \"facet\", \"hconcat\", \"vconcat\", \"concat\", or \"repeat\".`;\n}\n\n// FIT\nexport const FIT_NON_SINGLE = 'Autosize \"fit\" only works for single views and layered views.';\n\nexport function containerSizeNonSingle(name: 'width' | 'height') {\n const uName = name == 'width' ? 'Width' : 'Height';\n return `${uName} \"container\" only works for single views and layered views.`;\n}\n\nexport function containerSizeNotCompatibleWithAutosize(name: 'width' | 'height') {\n const uName = name == 'width' ? 'Width' : 'Height';\n const fitDirection = name == 'width' ? 'x' : 'y';\n return `${uName} \"container\" only works well with autosize \"fit\" or \"fit-${fitDirection}\".`;\n}\n\nexport function droppingFit(channel?: PositionScaleChannel) {\n return channel\n ? `Dropping \"fit-${channel}\" because spec has discrete ${getSizeChannel(channel)}.`\n : `Dropping \"fit\" because spec has discrete size.`;\n}\n\n// VIEW SIZE\n\nexport function unknownField(channel: Channel) {\n return `Unknown field for ${channel}. Cannot calculate view size.`;\n}\n\n// SELECTION\nexport function cannotProjectOnChannelWithoutField(channel: Channel) {\n return `Cannot project a selection on encoding channel \"${channel}\", which has no field.`;\n}\n\nexport function cannotProjectAggregate(channel: Channel, aggregate: Aggregate | HiddenCompositeAggregate) {\n return `Cannot project a selection on encoding channel \"${channel}\" as it uses an aggregate function (\"${aggregate}\").`;\n}\n\nexport function nearestNotSupportForContinuous(mark: string) {\n return `The \"nearest\" transform is not supported for ${mark} marks.`;\n}\n\nexport function selectionNotSupported(mark: CompositeMark) {\n return `Selection not supported for ${mark} yet.`;\n}\n\nexport function selectionNotFound(name: string) {\n return `Cannot find a selection named \"${name}\".`;\n}\n\nexport const SCALE_BINDINGS_CONTINUOUS =\n 'Scale bindings are currently only supported for scales with unbinned, continuous domains.';\n\nexport const LEGEND_BINDINGS_MUST_HAVE_PROJECTION =\n 'Legend bindings are only supported for selections over an individual field or encoding channel.';\nexport function noSameUnitLookup(name: string) {\n return (\n `Cannot define and lookup the \"${name}\" selection in the same view. ` +\n `Try moving the lookup into a second, layered view?`\n );\n}\n\nexport const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.';\n\nexport const INTERVAL_INITIALIZED_WITH_X_Y = 'Interval selections should be initialized using \"x\" and/or \"y\" keys.';\n\n// REPEAT\nexport function noSuchRepeatedValue(field: string) {\n return `Unknown repeated value \"${field}\".`;\n}\n\nexport function columnsNotSupportByRowCol(type: 'facet' | 'repeat') {\n return `The \"columns\" property cannot be used when \"${type}\" has nested row/column.`;\n}\n\n// CONCAT / REPEAT\nexport const CONCAT_CANNOT_SHARE_AXIS =\n 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).';\n\n// DATA\nexport function unrecognizedParse(p: string) {\n return `Unrecognized parse \"${p}\".`;\n}\n\nexport function differentParse(field: string, local: string, ancestor: string) {\n return `An ancestor parsed field \"${field}\" as ${ancestor} but a child wants to parse the field as ${local}.`;\n}\n\nexport const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.';\n\n// TRANSFORMS\nexport function invalidTransformIgnored(transform: any) {\n return `Ignoring an invalid transform: ${stringify(transform)}.`;\n}\n\nexport const NO_FIELDS_NEEDS_AS =\n 'If \"from.fields\" is not specified, \"as\" has to be a string that specifies the key to be used for the data from the secondary source.';\n\n// ENCODING & FACET\n\nexport function customFormatTypeNotAllowed(channel: ExtendedChannel) {\n return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`;\n}\n\nexport function projectionOverridden(opt: {parentProjection: Projection; projection: Projection}) {\n const {parentProjection, projection} = opt;\n return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(\n projection\n )}.`;\n}\n\nexport const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.';\n\nexport function primitiveChannelDef(\n channel: ExtendedChannel,\n type: 'string' | 'number' | 'boolean',\n value: Exclude\n) {\n return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`;\n}\n\nexport function invalidFieldType(type: Type) {\n return `Invalid field type \"${type}\".`;\n}\n\nexport function invalidFieldTypeForCountAggregate(type: Type, aggregate: Aggregate | string) {\n return `Invalid field type \"${type}\" for aggregate: \"${aggregate}\", using \"quantitative\" instead.`;\n}\n\nexport function invalidAggregate(aggregate: AggregateOp | string) {\n return `Invalid aggregation operator \"${aggregate}\".`;\n}\n\nexport function missingFieldType(channel: Channel, newType: Type) {\n return `Missing type for channel \"${channel}\", using \"${newType}\" instead.`;\n}\nexport function droppingColor(type: 'encoding' | 'property', opt: {fill?: boolean; stroke?: boolean}) {\n const {fill, stroke} = opt;\n return `Dropping color ${type} as the plot also has ${\n fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'\n }.`;\n}\n\nexport function emptyFieldDef(fieldDef: unknown, channel: ExtendedChannel) {\n return `Dropping ${stringify(\n fieldDef\n )} from channel \"${channel}\" since it does not contain any data field, datum, value, or signal.`;\n}\nexport function latLongDeprecated(channel: Channel, type: Type, newChannel: GeoPositionChannel) {\n return `${channel}-encoding with type ${type} is deprecated. Replacing with ${newChannel}-encoding.`;\n}\n\nexport const LINE_WITH_VARYING_SIZE =\n 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.';\n\nexport function incompatibleChannel(\n channel: ExtendedChannel,\n markOrFacet: Mark | 'facet' | CompositeMark,\n when?: string\n) {\n return `${channel} dropped as it is incompatible with \"${markOrFacet}\"${when ? ` when ${when}` : ''}.`;\n}\n\nexport function invalidEncodingChannel(channel: ExtendedChannel) {\n return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`;\n}\n\nexport function facetChannelShouldBeDiscrete(channel: FacetChannel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned).`;\n}\n\nexport function facetChannelDropped(channels: FacetChannel[]) {\n return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`;\n}\n\nexport function discreteChannelCannotEncode(channel: Channel, type: Type) {\n return `Using discrete channel \"${channel}\" to encode \"${type}\" field can be misleading as it does not encode ${\n type === 'ordinal' ? 'order' : 'magnitude'\n }.`;\n}\n\n// MARK\nexport function lineWithRange(hasX2: boolean, hasY2: boolean) {\n const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2';\n return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`;\n}\n\nexport function orientOverridden(original: string, actual: string) {\n return `Specified orient \"${original}\" overridden with \"${actual}\".`;\n}\n\n// SCALE\nexport const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN =\n 'Custom domain scale cannot be unioned with default field-based domain.';\n\nexport const RANGE_STEP_DEPRECATED = `Scale's \"rangeStep\" is deprecated and will be removed in Vega-Lite 5.0. Please use \"width\"/\"height\": {\"step\": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.`;\n\nexport function cannotUseScalePropertyWithNonColor(prop: string) {\n return `Cannot use the scale property \"${prop}\" with non-color channel.`;\n}\n\nexport function unaggregateDomainHasNoEffectForRawField(fieldDef: TypedFieldDef) {\n return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`;\n}\n\nexport function unaggregateDomainWithNonSharedDomainOp(aggregate: Aggregate | string) {\n return `Unaggregated domain not applicable for \"${aggregate}\" since it produces values outside the origin domain of the source data.`;\n}\n\nexport function unaggregatedDomainWithLogScale(fieldDef: TypedFieldDef) {\n return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`;\n}\n\nexport function cannotApplySizeToNonOrientedMark(mark: Mark) {\n return `Cannot apply size to non-oriented mark \"${mark}\".`;\n}\n\nexport function scaleTypeNotWorkWithChannel(channel: Channel, scaleType: ScaleType, defaultScaleType: ScaleType) {\n return `Channel \"${channel}\" does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\n\nexport function scaleTypeNotWorkWithFieldDef(scaleType: ScaleType, defaultScaleType: ScaleType) {\n return `FieldDef does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\n\nexport function scalePropertyNotWorkWithScaleType(scaleType: ScaleType, propName: string, channel: Channel) {\n return `${channel}-scale's \"${propName}\" is dropped as it does not work with ${scaleType} scale.`;\n}\n\nexport function scaleTypeNotWorkWithMark(mark: Mark, scaleType: ScaleType) {\n return `Scale type \"${scaleType}\" does not work with mark \"${mark}\".`;\n}\n\nexport function stepDropped(channel: 'width' | 'height') {\n return `The step for \"${channel}\" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`;\n}\n\nexport function mergeConflictingProperty(\n property: string | number | symbol,\n propertyOf: SplitParentProperty,\n v1: T,\n v2: T\n) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(\n v2\n )}). Using ${stringify(v1)}.`;\n}\n\nexport function mergeConflictingDomainProperty(property: 'domains', propertyOf: SplitParentProperty, v1: T, v2: T) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(\n v2\n )}). Using the union of the two domains.`;\n}\n\nexport function independentScaleMeansIndependentGuide(channel: Channel) {\n return `Setting the scale to be independent for \"${channel}\" means we also have to set the guide (axis or legend) to be independent.`;\n}\n\nexport function domainSortDropped(sort: VgSortField) {\n return `Dropping sort property ${stringify(\n sort\n )} as unioned domains only support boolean or op \"count\", \"min\", and \"max\".`;\n}\n\nexport const MORE_THAN_ONE_SORT =\n 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.';\n\nexport const FACETED_INDEPENDENT_DIFFERENT_SOURCES =\n 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.';\n\nexport const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES =\n 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.';\n\nexport const FACETED_INDEPENDENT_SAME_SOURCE =\n 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.';\n\n// AXIS\nexport const INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.';\n\n// STACK\nexport function cannotStackRangedMark(channel: Channel) {\n return `Cannot stack \"${channel}\" if there is already \"${channel}2\".`;\n}\n\nexport function cannotStackNonLinearScale(scaleType: ScaleType) {\n return `Cannot stack non-linear scale (${scaleType}).`;\n}\n\nexport function stackNonSummativeAggregate(aggregate: Aggregate | string) {\n return `Stacking is applied even though the aggregate function is non-summative (\"${aggregate}\").`;\n}\n\n// TIMEUNIT\nexport function invalidTimeUnit(unitName: string, value: string | number) {\n return `Invalid ${unitName}: ${stringify(value)}.`;\n}\n\nexport function droppedDay(d: DateTime | DateTimeExpr) {\n return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`;\n}\n\nexport function errorBarCenterAndExtentAreNotNeeded(center: ErrorBarCenter, extent: ErrorBarExtent) {\n return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${\n extent && center ? 'are ' : 'is '\n }not needed when data are aggregated.`;\n}\n\nexport function errorBarCenterIsUsedWithWrongExtent(\n center: ErrorBarCenter,\n extent: ErrorBarExtent,\n mark: 'errorbar' | 'errorband'\n) {\n return `${center} is not usually used with ${extent} for ${mark}.`;\n}\n\nexport function errorBarContinuousAxisHasCustomizedAggregate(\n aggregate: Aggregate | string,\n compositeMark: CompositeMark\n) {\n return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`;\n}\n\nexport function errorBand1DNotSupport(property: 'interpolate' | 'tension') {\n return `1D error band does not support ${property}.`;\n}\n\n// CHANNEL\nexport function channelRequiredForBinned(channel: Channel) {\n return `Channel ${channel} is required for \"binned\" bin.`;\n}\n\nexport function channelShouldNotBeUsedForBinned(channel: ExtendedChannel) {\n return `Channel ${channel} should not be used with \"binned\" bin.`;\n}\n\nexport function domainRequiredForThresholdScale(channel: ScaleChannel) {\n return `Domain for ${channel} is required for threshold scale.`;\n}\n","/**\n * Vega-Lite's singleton logger utility.\n */\n\nimport {Debug, Error as ErrorLevel, Info, logger, LoggerInterface, Warn} from 'vega-util';\nexport * as message from './message';\n\n/**\n * Main (default) Vega Logger instance for Vega-Lite.\n */\nconst main = logger(Warn);\nlet current: LoggerInterface = main;\n\n/**\n * Logger tool for checking if the code throws correct warning.\n */\nexport class LocalLogger implements LoggerInterface {\n public warns: any[] = [];\n public infos: any[] = [];\n public debugs: any[] = [];\n\n #level: number = Warn;\n\n public level(): number;\n public level(_: number): this;\n public level(_?: number) {\n if (_) {\n this.#level = _;\n return this;\n }\n return this.#level;\n }\n\n public warn(...args: readonly any[]) {\n if (this.#level >= Warn) this.warns.push(...args);\n return this;\n }\n\n public info(...args: readonly any[]) {\n if (this.#level >= Info) this.infos.push(...args);\n return this;\n }\n\n public debug(...args: readonly any[]) {\n if (this.#level >= Debug) this.debugs.push(...args);\n return this;\n }\n\n public error(...args: readonly any[]): this {\n if (this.#level >= ErrorLevel) throw Error(...args);\n return this;\n }\n}\n\nexport function wrap(f: (logger: LocalLogger) => void) {\n return () => {\n current = new LocalLogger();\n f(current as LocalLogger);\n reset();\n };\n}\n\n/**\n * Set the singleton logger to be a custom logger.\n */\nexport function set(newLogger: LoggerInterface) {\n current = newLogger;\n return current;\n}\n\n/**\n * Reset the main logger to use the default Vega Logger.\n */\nexport function reset() {\n current = main;\n return current;\n}\n\nexport function error(...args: readonly any[]) {\n current.error(...args);\n}\n\nexport function warn(...args: readonly any[]) {\n current.warn(...args);\n}\n\nexport function info(...args: readonly any[]) {\n current.info(...args);\n}\n\nexport function debug(...args: readonly any[]) {\n current.debug(...args);\n}\n","// DateTime definition object\n\nimport {isNumber, isObject} from 'vega-util';\nimport * as log from './log';\nimport {TIMEUNIT_PARTS} from './timeunit';\nimport {duplicate, isNumeric, keys} from './util';\n\n/**\n * @minimum 1\n * @maximum 12\n * @TJS-type integer\n */\nexport type Month = number;\n\n/**\n * @minimum 1\n * @maximum 7\n */\nexport type Day = number;\n\n/**\n * Object for defining datetime in Vega-Lite Filter.\n * If both month and quarter are provided, month has higher precedence.\n * `day` cannot be combined with other date.\n * We accept string for month and day names.\n */\nexport interface DateTime {\n /**\n * Integer value representing the year.\n * @TJS-type integer\n */\n year?: number;\n\n /**\n * Integer value representing the quarter of the year (from 1-4).\n * @minimum 1\n * @maximum 4\n * @TJS-type integer\n */\n quarter?: number;\n\n /**\n * One of:\n * (1) integer value representing the month from `1`-`12`. `1` represents January;\n * (2) case-insensitive month name (e.g., `\"January\"`);\n * (3) case-insensitive, 3-character short month name (e.g., `\"Jan\"`).\n */\n month?: Month | string;\n\n /**\n * Integer value representing the date (day of the month) from 1-31.\n * @minimum 1\n * @maximum 31\n * @TJS-type integer\n */\n date?: number;\n\n /**\n * Value representing the day of a week. This can be one of:\n * (1) integer value -- `1` represents Monday;\n * (2) case-insensitive day name (e.g., `\"Monday\"`);\n * (3) case-insensitive, 3-character short day name (e.g., `\"Mon\"`).\n *\n * **Warning:** A DateTime definition object with `day`** should not be combined with `year`, `quarter`, `month`, or `date`.\n */\n day?: Day | string;\n\n /**\n * Integer value representing the hour of a day from 0-23.\n * @minimum 0\n * @maximum 24\n * @TJS-type integer\n */\n hours?: number;\n\n /**\n * Integer value representing the minute segment of time from 0-59.\n * @minimum 0\n * @maximum 60\n * @TJS-type integer\n */\n minutes?: number;\n\n /**\n * Integer value representing the second segment (0-59) of a time value\n * @minimum 0\n * @maximum 60\n * @TJS-type integer\n */\n seconds?: number;\n\n /**\n * Integer value representing the millisecond segment of time.\n * @minimum 0\n * @maximum 1000\n * @TJS-type integer\n */\n milliseconds?: number;\n\n /**\n * A boolean flag indicating if date time is in utc time. If false, the date time is in local time\n */\n utc?: boolean;\n}\n\n/**\n * Internal Object for defining datetime expressions.\n * This is an expression version of DateTime.\n * If both month and quarter are provided, month has higher precedence.\n * `day` cannot be combined with other date.\n */\nexport interface DateTimeExpr {\n year?: string;\n quarter?: string;\n month?: string;\n date?: string;\n day?: string;\n hours?: string;\n minutes?: string;\n seconds?: string;\n milliseconds?: string;\n utc?: boolean;\n}\n\nexport function isDateTime(o: any): o is DateTime {\n if (o && isObject(o)) {\n for (const part of TIMEUNIT_PARTS) {\n if (part in o) {\n return true;\n }\n }\n }\n return false;\n}\n\nexport const MONTHS = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december'\n];\nexport const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3));\n\nexport const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];\nexport const SHORT_DAYS = DAYS.map(d => d.substr(0, 3));\n\nfunction normalizeQuarter(q: number | string): number {\n if (isNumeric(q)) {\n q = +q;\n }\n\n if (isNumber(q)) {\n if (q > 4) {\n log.warn(log.message.invalidTimeUnit('quarter', q));\n }\n // We accept 1-based quarter, so need to readjust to 0-based quarter\n return q - 1;\n } else {\n // Invalid quarter\n throw new Error(log.message.invalidTimeUnit('quarter', q));\n }\n}\n\nfunction normalizeMonth(m: string | number): number {\n if (isNumeric(m)) {\n m = +m;\n }\n\n if (isNumber(m)) {\n // We accept 1-based month, so need to readjust to 0-based month\n return m - 1;\n } else {\n const lowerM = m.toLowerCase();\n const monthIndex = MONTHS.indexOf(lowerM);\n if (monthIndex !== -1) {\n return monthIndex; // 0 for january, ...\n }\n const shortM = lowerM.substr(0, 3);\n const shortMonthIndex = SHORT_MONTHS.indexOf(shortM);\n if (shortMonthIndex !== -1) {\n return shortMonthIndex;\n }\n\n // Invalid month\n throw new Error(log.message.invalidTimeUnit('month', m));\n }\n}\n\nfunction normalizeDay(d: string | number): number {\n if (isNumeric(d)) {\n d = +d;\n }\n\n if (isNumber(d)) {\n // mod so that this can be both 0-based where 0 = sunday\n // and 1-based where 7=sunday\n return d % 7;\n } else {\n const lowerD = d.toLowerCase();\n const dayIndex = DAYS.indexOf(lowerD);\n if (dayIndex !== -1) {\n return dayIndex; // 0 for january, ...\n }\n const shortD = lowerD.substr(0, 3);\n const shortDayIndex = SHORT_DAYS.indexOf(shortD);\n if (shortDayIndex !== -1) {\n return shortDayIndex;\n }\n // Invalid day\n throw new Error(log.message.invalidTimeUnit('day', d));\n }\n}\n\n/**\n * @param d the date.\n * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime.\n * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds]\n */\nfunction dateTimeParts(d: DateTime | DateTimeExpr, normalize: boolean) {\n const parts: (string | number)[] = [];\n\n if (normalize && d.day !== undefined) {\n if (keys(d).length > 1) {\n log.warn(log.message.droppedDay(d));\n d = duplicate(d);\n delete d.day;\n }\n }\n\n if (d.year !== undefined) {\n parts.push(d.year);\n } else {\n // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega\n // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year).\n parts.push(2012);\n }\n\n if (d.month !== undefined) {\n const month = normalize ? normalizeMonth(d.month) : d.month;\n parts.push(month);\n } else if (d.quarter !== undefined) {\n const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter;\n parts.push(isNumber(quarter) ? quarter * 3 : quarter + '*3');\n } else {\n parts.push(0); // months start at zero in JS\n }\n\n if (d.date !== undefined) {\n parts.push(d.date);\n } else if (d.day !== undefined) {\n // HACK: Day only works as a standalone unit\n // This is only correct because we always set year to 2006 for day\n const day = normalize ? normalizeDay(d.day) : d.day;\n parts.push(isNumber(day) ? day + 1 : day + '+1');\n } else {\n parts.push(1); // Date starts at 1 in JS\n }\n\n // Note: can't use TimeUnit enum here as importing it will create\n // circular dependency problem!\n for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds'] as const) {\n const unit = d[timeUnit];\n parts.push(typeof unit === 'undefined' ? 0 : unit);\n }\n\n return parts;\n}\n\n/**\n * Return Vega expression for a date time.\n *\n * @param d the date time.\n * @returns the Vega expression.\n */\nexport function dateTimeToExpr(d: DateTime) {\n const parts: (string | number)[] = dateTimeParts(d, true);\n\n const string = parts.join(', ');\n\n if (d.utc) {\n return `utc(${string})`;\n } else {\n return `datetime(${string})`;\n }\n}\n\n/**\n * Return Vega expression for a date time expression.\n *\n * @param d the internal date time object with expression.\n * @returns the Vega expression.\n */\nexport function dateTimeExprToExpr(d: DateTimeExpr) {\n const parts: (string | number)[] = dateTimeParts(d, false);\n\n const string = parts.join(', ');\n\n if (d.utc) {\n return `utc(${string})`;\n } else {\n return `datetime(${string})`;\n }\n}\n\n/**\n * @param d the date time.\n * @returns the timestamp.\n */\nexport function dateTimeToTimestamp(d: DateTime) {\n const parts: (string | number)[] = dateTimeParts(d, true);\n\n if (d.utc) {\n return +new Date(Date.UTC(...(parts as [any, any])));\n } else {\n return +new Date(...(parts as [any]));\n }\n}\n","import stringify from 'fast-json-stable-stringify';\nimport {isObject, isString} from 'vega-util';\nimport {DateTimeExpr, dateTimeExprToExpr} from './datetime';\nimport {accessPathWithDatum, keys, varName} from './util';\n\n/** Time Unit that only corresponds to only one part of Date objects. */\nexport const LOCAL_SINGLE_TIMEUNIT_INDEX = {\n year: 1,\n quarter: 1,\n month: 1,\n week: 1,\n day: 1,\n dayofyear: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n} as const;\n\nexport type LocalSingleTimeUnit = keyof typeof LOCAL_SINGLE_TIMEUNIT_INDEX;\n\nexport const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX);\n\nexport function isLocalSingleTimeUnit(timeUnit: string): timeUnit is LocalSingleTimeUnit {\n return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit];\n}\n\nexport const UTC_SINGLE_TIMEUNIT_INDEX = {\n utcyear: 1,\n utcquarter: 1,\n utcmonth: 1,\n utcweek: 1,\n utcday: 1,\n utcdayofyear: 1,\n utcdate: 1,\n utchours: 1,\n utcminutes: 1,\n utcseconds: 1,\n utcmilliseconds: 1\n} as const;\n\nexport type UtcSingleTimeUnit = keyof typeof UTC_SINGLE_TIMEUNIT_INDEX;\n\nexport type SingleTimeUnit = LocalSingleTimeUnit | UtcSingleTimeUnit;\n\nexport const LOCAL_MULTI_TIMEUNIT_INDEX = {\n yearquarter: 1,\n yearquartermonth: 1,\n\n yearmonth: 1,\n yearmonthdate: 1,\n yearmonthdatehours: 1,\n yearmonthdatehoursminutes: 1,\n yearmonthdatehoursminutesseconds: 1,\n\n yearweek: 1,\n yearweekday: 1,\n yearweekdayhours: 1,\n yearweekdayhoursminutes: 1,\n yearweekdayhoursminutesseconds: 1,\n\n yeardayofyear: 1,\n\n quartermonth: 1,\n\n monthdate: 1,\n monthdatehours: 1,\n monthdatehoursminutes: 1,\n monthdatehoursminutesseconds: 1,\n\n weekday: 1,\n weeksdayhours: 1,\n weekdayhoursminutes: 1,\n weekdayhoursminutesseconds: 1,\n\n dayhours: 1,\n dayhoursminutes: 1,\n dayhoursminutesseconds: 1,\n\n hoursminutes: 1,\n hoursminutesseconds: 1,\n\n minutesseconds: 1,\n\n secondsmilliseconds: 1\n} as const;\n\nexport type LocalMultiTimeUnit = keyof typeof LOCAL_MULTI_TIMEUNIT_INDEX;\n\nexport const UTC_MULTI_TIMEUNIT_INDEX = {\n utcyearquarter: 1,\n utcyearquartermonth: 1,\n\n utcyearmonth: 1,\n utcyearmonthdate: 1,\n utcyearmonthdatehours: 1,\n utcyearmonthdatehoursminutes: 1,\n utcyearmonthdatehoursminutesseconds: 1,\n\n utcyearweek: 1,\n utcyearweekday: 1,\n utcyearweekdayhours: 1,\n utcyearweekdayhoursminutes: 1,\n utcyearweekdayhoursminutesseconds: 1,\n\n utcyeardayofyear: 1,\n\n utcquartermonth: 1,\n\n utcmonthdate: 1,\n utcmonthdatehours: 1,\n utcmonthdatehoursminutes: 1,\n utcmonthdatehoursminutesseconds: 1,\n\n utcweekday: 1,\n utcweeksdayhours: 1,\n utcweekdayhoursminutes: 1,\n utcweekdayhoursminutesseconds: 1,\n\n utcdayhours: 1,\n utcdayhoursminutes: 1,\n utcdayhoursminutesseconds: 1,\n\n utchoursminutes: 1,\n utchoursminutesseconds: 1,\n\n utcminutesseconds: 1,\n\n utcsecondsmilliseconds: 1\n} as const;\n\nexport type UtcMultiTimeUnit = keyof typeof UTC_MULTI_TIMEUNIT_INDEX;\n\nexport type MultiTimeUnit = LocalMultiTimeUnit | UtcMultiTimeUnit;\n\nexport type LocalTimeUnit = LocalSingleTimeUnit | LocalMultiTimeUnit;\nexport type UtcTimeUnit = UtcSingleTimeUnit | UtcMultiTimeUnit;\n\nexport function isUTCTimeUnit(t: string): t is UtcTimeUnit {\n return t.startsWith('utc');\n}\n\nexport function getLocalTimeUnit(t: UtcTimeUnit): LocalTimeUnit {\n return t.substr(3) as LocalTimeUnit;\n}\n\nexport type TimeUnit = SingleTimeUnit | MultiTimeUnit;\n\nexport type TimeUnitFormat =\n | 'year'\n | 'year-month'\n | 'year-month-date'\n | 'quarter'\n | 'month'\n | 'date'\n | 'week'\n | 'day'\n | 'hours'\n | 'hours-minutes'\n | 'minutes'\n | 'seconds'\n | 'milliseconds';\n\nexport interface TimeUnitParams {\n /**\n * Defines how date-time values should be binned.\n */\n unit?: TimeUnit;\n\n /**\n * If no `unit` is specified, maxbins is used to infer time units.\n */\n maxbins?: number;\n\n /**\n * The number of steps between bins, in terms of the least\n * significant unit provided.\n */\n step?: number;\n\n /**\n * True to use UTC timezone. Equivalent to using a `utc` prefixed `TimeUnit`.\n */\n utc?: boolean;\n}\n\n// matches vega time unit format specifier\nexport type TimeFormatConfig = Partial>;\n\n// In order of increasing specificity\nexport const VEGALITE_TIMEFORMAT: TimeFormatConfig = {\n 'year-month': '%b %Y ',\n 'year-month-date': '%b %d, %Y '\n};\n\nexport function getTimeUnitParts(timeUnit: TimeUnit) {\n const parts: LocalSingleTimeUnit[] = [];\n\n for (const part of TIMEUNIT_PARTS) {\n if (containsTimeUnit(timeUnit, part)) {\n parts.push(part);\n }\n }\n\n return parts;\n}\n\n/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */\nexport function containsTimeUnit(fullTimeUnit: TimeUnit, timeUnit: TimeUnit) {\n const index = fullTimeUnit.indexOf(timeUnit);\n\n if (index < 0) {\n return false;\n }\n\n // exclude milliseconds\n if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') {\n return false;\n }\n\n // exclude dayofyear\n if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') {\n return false;\n }\n if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') {\n return false;\n }\n\n return true;\n}\n\n/**\n * Returns Vega expression for a given timeUnit and fieldRef\n */\nexport function fieldExpr(fullTimeUnit: TimeUnit, field: string, {end}: {end: boolean} = {end: false}): string {\n const fieldRef = accessPathWithDatum(field);\n\n const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : '';\n\n function func(timeUnit: TimeUnit) {\n if (timeUnit === 'quarter') {\n // quarter starting at 0 (0,3,6,9).\n return `(${utc}quarter(${fieldRef})-1)`;\n } else {\n return `${utc}${timeUnit}(${fieldRef})`;\n }\n }\n\n let lastTimeUnit: TimeUnit;\n\n const dateExpr: DateTimeExpr = {};\n\n for (const part of TIMEUNIT_PARTS) {\n if (containsTimeUnit(fullTimeUnit, part)) {\n dateExpr[part] = func(part);\n lastTimeUnit = part;\n }\n }\n\n if (end) {\n dateExpr[lastTimeUnit] += '+1';\n }\n\n return dateTimeExprToExpr(dateExpr);\n}\n\nexport function timeUnitSpecifierExpression(timeUnit: TimeUnit) {\n if (!timeUnit) {\n return undefined;\n }\n\n const timeUnitParts = getTimeUnitParts(timeUnit);\n return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`;\n}\n\n/**\n * Returns the signal expression used for axis labels for a time unit.\n */\nexport function formatExpression(timeUnit: TimeUnit, field: string, isUTCScale: boolean): string {\n if (!timeUnit) {\n return undefined;\n }\n\n const expr = timeUnitSpecifierExpression(timeUnit);\n\n // We only use utcFormat for utc scale\n // For utc time units, the data is already converted as a part of timeUnit transform.\n // Thus, utc time units should use timeFormat to avoid shifting the time twice.\n const utc = isUTCScale || isUTCTimeUnit(timeUnit);\n\n return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`;\n}\n\nexport function normalizeTimeUnit(timeUnit: TimeUnit | TimeUnitParams): TimeUnitParams {\n if (!timeUnit) {\n return undefined;\n }\n\n let params: TimeUnitParams;\n if (isString(timeUnit)) {\n params = {\n unit: timeUnit\n };\n } else if (isObject(timeUnit)) {\n params = {\n ...timeUnit,\n ...(timeUnit.unit ? {unit: timeUnit.unit} : {})\n };\n }\n\n if (isUTCTimeUnit(params.unit)) {\n params.utc = true;\n params.unit = getLocalTimeUnit(params.unit);\n }\n\n return params;\n}\n\nexport function timeUnitToString(tu: TimeUnit | TimeUnitParams) {\n const {utc, ...rest} = normalizeTimeUnit(tu);\n\n if (rest.unit) {\n return (\n (utc ? 'utc' : '') +\n keys(rest)\n .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`))\n .join('')\n );\n } else {\n // when maxbins is specified instead of units\n return (\n (utc ? 'utc' : '') +\n 'timeunit' +\n keys(rest)\n .map(p => varName(`_${p}_${rest[p]}`))\n .join('')\n );\n }\n}\n","import {\n AggregateOp,\n BandScale,\n BaseScale,\n BinOrdinalScale,\n ColorValueRef,\n Compare as VgCompare,\n ExprRef as VgExprRef,\n GeoShapeTransform as VgGeoShapeTransform,\n IdentityScale,\n LayoutAlign,\n LinearScale,\n LogScale,\n MarkConfig,\n NumericValueRef,\n OrdinalScale,\n PointScale,\n PowScale,\n ProjectionType,\n QuantileScale,\n QuantizeScale,\n RangeBand,\n RangeRaw,\n RangeScheme,\n ScaleData,\n ScaleDataRef,\n ScaledValueRef,\n ScaleMultiDataRef,\n ScaleMultiFieldsRef,\n SequentialScale,\n SignalRef,\n SortField as VgSortField,\n SqrtScale,\n SymLogScale,\n ThresholdScale,\n TimeInterval,\n TimeIntervalStep,\n TimeScale,\n Title as VgTitle,\n Transforms as VgTransform,\n UnionSortField as VgUnionSortField,\n Mark\n} from 'vega';\nimport {isArray} from 'vega-util';\nimport {Value} from './channeldef';\nimport {SortOrder} from './sort';\nimport {Flag, keys, Dict} from './util';\n\nexport {VgSortField, VgUnionSortField, VgCompare, VgTitle, LayoutAlign, ProjectionType, VgExprRef};\n\n// TODO: make recursive\ntype ExcludeMapped = {\n [P in keyof T]: Exclude;\n};\n\ntype ExcludeMappedButKeepSignals = {\n [P in keyof T]: SignalRef extends T[P] ? Exclude | SignalRef : Exclude;\n};\n\n// Remove ValueRefs from mapped types\nexport type ExcludeMappedValueRef = ExcludeMapped | NumericValueRef | ColorValueRef>;\n\nexport type ExcludeMappedValueRefButKeepSignal = ExcludeMappedButKeepSignals<\n T,\n ScaledValueRef | NumericValueRef | ColorValueRef\n>;\n\nexport interface VgData {\n name: string;\n source?: string;\n values?: any;\n format?: {\n type?: string;\n parse?: string | Dict;\n property?: string;\n feature?: string;\n mesh?: string;\n };\n url?: string;\n transform?: VgTransform[];\n}\n\nexport type VgScaleDataRefWithSort = ScaleDataRef & {\n sort?: VgSortField;\n};\n\nexport function isSignalRef(o: any): o is SignalRef {\n return o && !!o['signal'];\n}\n\n// TODO: add type of value (Make it VgValueRef {value?:V ...})\nexport interface VgValueRef {\n value?: Value | number[];\n field?:\n | string\n | {\n datum?: string;\n group?: string;\n parent?: string;\n };\n signal?: string;\n scale?: string; // TODO: object\n mult?: number;\n offset?: number | VgValueRef;\n band?: boolean | number | VgValueRef;\n test?: string;\n}\n\n// TODO: add vg prefix\nexport type VgScaleMultiDataRefWithSort = ScaleMultiDataRef & {\n fields: (any[] | VgScaleDataRefWithSort | SignalRef)[];\n sort?: VgUnionSortField;\n};\n\nexport type VgMultiFieldsRefWithSort = ScaleMultiFieldsRef & {\n sort?: VgUnionSortField;\n};\n\nexport type VgRange = RangeScheme | ScaleData | RangeBand | RangeRaw;\n\nexport function isVgRangeStep(range: VgRange): range is VgRangeStep {\n return !!range['step'];\n}\n\nexport interface VgRangeStep {\n step: number | SignalRef;\n}\n// Domains that are not a union of domains\nexport type VgNonUnionDomain = (null | string | number | boolean | SignalRef)[] | VgScaleDataRefWithSort | SignalRef;\n\nexport type VgDomain = BaseScale['domain'];\n\nexport type VgMarkGroup = any;\n\n/**\n * A combined type for any Vega scales that Vega-Lite can generate\n */\nexport type VgScale = Pick & {\n range?: RangeScheme | RangeBand | ScaleData; // different Vega scales have conflicting range, need to union them here\n nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef; // different Vega scales have conflicting range, need to union them here\n zero?: boolean | SignalRef; // LogScale only allow false, making the intersection type overly strict\n} & Omit<\n // Continuous\n Omit &\n Omit &\n Omit &\n Omit, 'type'> & // use partial so exponent is not required\n Omit &\n Omit &\n Omit &\n // Discretizing\n Omit &\n Omit &\n Omit &\n Omit &\n // Sequential\n Omit &\n // Discrete\n Omit &\n Omit &\n Omit,\n 'range' | 'nice' | 'zero'\n >;\n\nexport interface RowCol {\n row?: T;\n column?: T;\n}\n\nexport interface VgLayout {\n center?: boolean | RowCol;\n padding?: number | RowCol;\n headerBand?: number | RowCol;\n footerBand?: number | RowCol;\n\n titleAnchor?: 'start' | 'end' | RowCol<'start' | 'end'>;\n offset?:\n | number\n | {\n rowHeader?: number;\n rowFooter?: number;\n rowTitle?: number;\n columnHeader?: number;\n columnFooter?: number;\n columnTitle?: number;\n };\n bounds?: 'full' | 'flush';\n columns?: number | {signal: string};\n align?: LayoutAlign | RowCol;\n}\n\nexport function isDataRefUnionedDomain(domain: VgDomain): domain is VgScaleMultiDataRefWithSort {\n if (!isArray(domain)) {\n return 'fields' in domain && !('data' in domain);\n }\n return false;\n}\n\nexport function isFieldRefUnionDomain(domain: VgDomain): domain is VgMultiFieldsRefWithSort {\n if (!isArray(domain)) {\n return 'fields' in domain && 'data' in domain;\n }\n return false;\n}\n\nexport function isDataRefDomain(domain: VgDomain | any): domain is VgScaleDataRefWithSort {\n if (!isArray(domain)) {\n return 'field' in domain && 'data' in domain;\n }\n return false;\n}\n\nexport type VgEncodeChannel =\n | 'x'\n | 'x2'\n | 'xc'\n | 'width'\n | 'y'\n | 'y2'\n | 'yc'\n | 'height'\n | 'opacity'\n | 'fill'\n | 'fillOpacity'\n | 'stroke'\n | 'strokeWidth'\n | 'strokeCap'\n | 'strokeOpacity'\n | 'strokeDash'\n | 'strokeDashOffset'\n | 'strokeMiterLimit'\n | 'strokeJoin'\n | 'strokeOffset'\n | 'strokeForeground'\n | 'cursor'\n | 'clip'\n | 'size'\n | 'shape'\n | 'path'\n | 'innerRadius'\n | 'outerRadius'\n | 'startAngle'\n | 'endAngle'\n | 'interpolate'\n | 'tension'\n | 'orient'\n | 'url'\n | 'align'\n | 'baseline'\n | 'text'\n | 'dir'\n | 'ellipsis'\n | 'limit'\n | 'dx'\n | 'dy'\n | 'radius'\n | 'theta'\n | 'angle'\n | 'font'\n | 'fontSize'\n | 'fontWeight'\n | 'fontStyle'\n | 'tooltip'\n | 'href'\n | 'cursor'\n | 'defined'\n | 'cornerRadius'\n | 'cornerRadiusTopLeft'\n | 'cornerRadiusTopRight'\n | 'cornerRadiusBottomRight'\n | 'cornerRadiusBottomLeft'\n | 'scaleX'\n | 'scaleY';\n\nexport type VgEncodeEntry = Partial>;\n\n// TODO: make export interface VgEncodeEntry {\n// x?: VgValueRef\n// y?: VgValueRef\n// ...\n// color?: VgValueRef\n// ...\n// }\n\nexport type VgPostEncodingTransform = VgGeoShapeTransform;\n\nconst VG_MARK_CONFIG_INDEX: Flag = {\n aria: 1,\n description: 1,\n ariaRole: 1,\n ariaRoleDescription: 1,\n blend: 1,\n opacity: 1,\n fill: 1,\n fillOpacity: 1,\n stroke: 1,\n strokeCap: 1,\n strokeWidth: 1,\n strokeOpacity: 1,\n strokeDash: 1,\n strokeDashOffset: 1,\n strokeJoin: 1,\n strokeOffset: 1,\n strokeMiterLimit: 1,\n startAngle: 1,\n endAngle: 1,\n padAngle: 1,\n innerRadius: 1,\n outerRadius: 1,\n size: 1,\n shape: 1,\n interpolate: 1,\n tension: 1,\n orient: 1,\n align: 1,\n baseline: 1,\n text: 1,\n dir: 1,\n dx: 1,\n dy: 1,\n ellipsis: 1,\n limit: 1,\n radius: 1,\n theta: 1,\n angle: 1,\n font: 1,\n fontSize: 1,\n fontWeight: 1,\n fontStyle: 1,\n lineBreak: 1,\n lineHeight: 1,\n cursor: 1,\n href: 1,\n tooltip: 1,\n cornerRadius: 1,\n cornerRadiusTopLeft: 1,\n cornerRadiusTopRight: 1,\n cornerRadiusBottomLeft: 1,\n cornerRadiusBottomRight: 1,\n aspect: 1,\n width: 1,\n height: 1\n\n // commented below are vg channel that do not have mark config.\n // x: 1,\n // y: 1,\n // x2: 1,\n // y2: 1,\n\n // xc'|'yc'\n // clip: 1,\n // path: 1,\n // url: 1,\n};\n\nexport const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX);\n\nexport const VG_MARK_INDEX: Flag = {\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n};\n\n// Vega's cornerRadius channels.\nexport const VG_CORNERRADIUS_CHANNELS = [\n 'cornerRadius',\n 'cornerRadiusTopLeft',\n 'cornerRadiusTopRight',\n 'cornerRadiusBottomLeft',\n 'cornerRadiusBottomRight'\n] as const;\n\nexport interface VgComparator {\n field?: string | string[];\n order?: SortOrder | SortOrder[];\n}\n\nexport interface VgJoinAggregateTransform {\n type: 'joinaggregate';\n as?: string[];\n ops?: AggregateOp[];\n fields?: string[];\n groupby?: string[];\n}\n","import {SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FieldName, valueExpr, vgField} from './channeldef';\nimport {DateTime} from './datetime';\nimport {LogicalComposition} from './logical';\nimport {fieldExpr as timeUnitFieldExpr, normalizeTimeUnit, TimeUnit, TimeUnitParams} from './timeunit';\nimport {isSignalRef} from './vega.schema';\n\nexport type Predicate =\n // a) FieldPredicate (but we don't type FieldFilter here so the schema has no nesting\n // and thus the documentation shows all of the types clearly)\n | FieldEqualPredicate\n | FieldRangePredicate\n | FieldOneOfPredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate\n | FieldValidPredicate\n // b) Selection Predicate\n | SelectionPredicate\n // c) Vega Expression string\n | string;\n\nexport type FieldPredicate =\n | FieldEqualPredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate\n | FieldRangePredicate\n | FieldOneOfPredicate\n | FieldValidPredicate;\n\nexport interface SelectionPredicate {\n /**\n * Filter using a selection name or a logical composition of selection names.\n */\n selection: LogicalComposition;\n}\n\nexport function isSelectionPredicate(predicate: LogicalComposition): predicate is SelectionPredicate {\n return predicate?.['selection'];\n}\n\nexport interface FieldPredicateBase {\n // TODO: support aggregate\n\n /**\n * Time unit for the field to be tested.\n */\n timeUnit?: TimeUnit | TimeUnitParams;\n\n /**\n * Field to be tested.\n */\n field: FieldName;\n}\n\nexport interface FieldEqualPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be equal to.\n */\n equal: string | number | boolean | DateTime | SignalRef;\n}\n\nexport function isFieldEqualPredicate(predicate: any): predicate is FieldEqualPredicate {\n return predicate && !!predicate.field && predicate.equal !== undefined;\n}\n\nexport interface FieldLTPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be less than.\n */\n lt: string | number | DateTime | SignalRef;\n}\n\nexport function isFieldLTPredicate(predicate: any): predicate is FieldLTPredicate {\n return predicate && !!predicate.field && predicate.lt !== undefined;\n}\n\nexport interface FieldLTEPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be less than or equals to.\n */\n lte: string | number | DateTime | SignalRef;\n}\n\nexport function isFieldLTEPredicate(predicate: any): predicate is FieldLTEPredicate {\n return predicate && !!predicate.field && predicate.lte !== undefined;\n}\n\nexport interface FieldGTPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be greater than.\n */\n gt: string | number | DateTime | SignalRef;\n}\n\nexport function isFieldGTPredicate(predicate: any): predicate is FieldGTPredicate {\n return predicate && !!predicate.field && predicate.gt !== undefined;\n}\n\nexport interface FieldGTEPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be greater than or equals to.\n */\n gte: string | number | DateTime | SignalRef;\n}\n\nexport function isFieldGTEPredicate(predicate: any): predicate is FieldGTEPredicate {\n return predicate && !!predicate.field && predicate.gte !== undefined;\n}\n\nexport interface FieldRangePredicate extends FieldPredicateBase {\n /**\n * An array of inclusive minimum and maximum values\n * for a field value of a data item to be included in the filtered data.\n * @maxItems 2\n * @minItems 2\n */\n range: (number | DateTime | null | SignalRef)[] | SignalRef;\n}\n\nexport function isFieldRangePredicate(predicate: any): predicate is FieldRangePredicate {\n if (predicate && predicate.field) {\n if (isArray(predicate.range) && predicate.range.length === 2) {\n return true;\n } else if (isSignalRef(predicate.range)) {\n return true;\n }\n }\n return false;\n}\n\nexport interface FieldOneOfPredicate extends FieldPredicateBase {\n /**\n * A set of values that the `field`'s value should be a member of,\n * for a data item included in the filtered data.\n */\n oneOf: string[] | number[] | boolean[] | DateTime[];\n}\n\nexport interface FieldValidPredicate extends FieldPredicateBase {\n /**\n * If set to true the field's value has to be valid, meaning both not `null` and not [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN).\n */\n valid: boolean;\n}\n\nexport function isFieldOneOfPredicate(predicate: any): predicate is FieldOneOfPredicate {\n return (\n predicate && !!predicate.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility\n );\n}\n\nexport function isFieldValidPredicate(predicate: any): predicate is FieldValidPredicate {\n return predicate && !!predicate.field && predicate.valid !== undefined;\n}\n\nexport function isFieldPredicate(\n predicate: Predicate\n): predicate is\n | FieldOneOfPredicate\n | FieldEqualPredicate\n | FieldRangePredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate {\n return (\n isFieldOneOfPredicate(predicate) ||\n isFieldEqualPredicate(predicate) ||\n isFieldRangePredicate(predicate) ||\n isFieldLTPredicate(predicate) ||\n isFieldGTPredicate(predicate) ||\n isFieldLTEPredicate(predicate) ||\n isFieldGTEPredicate(predicate)\n );\n}\n\nfunction predicateValueExpr(v: number | string | boolean | DateTime | SignalRef, timeUnit: TimeUnit) {\n return valueExpr(v, {timeUnit, wrapTime: true});\n}\n\nfunction predicateValuesExpr(vals: (number | string | boolean | DateTime)[], timeUnit: TimeUnit) {\n return vals.map(v => predicateValueExpr(v, timeUnit));\n}\n\n// This method is used by Voyager. Do not change its behavior without changing Voyager.\nexport function fieldFilterExpression(predicate: FieldPredicate, useInRange = true) {\n const {field} = predicate;\n const timeUnit = normalizeTimeUnit(predicate.timeUnit)?.unit;\n const fieldExpr = timeUnit\n ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly.\n // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline\n // TODO: support utc\n 'time(' + timeUnitFieldExpr(timeUnit, field) + ')'\n : vgField(predicate, {expr: 'datum'});\n\n if (isFieldEqualPredicate(predicate)) {\n return fieldExpr + '===' + predicateValueExpr(predicate.equal, timeUnit);\n } else if (isFieldLTPredicate(predicate)) {\n const upper = predicate.lt;\n return `${fieldExpr}<${predicateValueExpr(upper, timeUnit)}`;\n } else if (isFieldGTPredicate(predicate)) {\n const lower = predicate.gt;\n return `${fieldExpr}>${predicateValueExpr(lower, timeUnit)}`;\n } else if (isFieldLTEPredicate(predicate)) {\n const upper = predicate.lte;\n return `${fieldExpr}<=${predicateValueExpr(upper, timeUnit)}`;\n } else if (isFieldGTEPredicate(predicate)) {\n const lower = predicate.gte;\n return `${fieldExpr}>=${predicateValueExpr(lower, timeUnit)}`;\n } else if (isFieldOneOfPredicate(predicate)) {\n return `indexof([${predicateValuesExpr(predicate.oneOf, timeUnit).join(',')}], ${fieldExpr}) !== -1`;\n } else if (isFieldValidPredicate(predicate)) {\n return fieldValidPredicate(fieldExpr, predicate.valid);\n } else if (isFieldRangePredicate(predicate)) {\n const {range} = predicate;\n const lower = isSignalRef(range) ? {signal: `${range.signal}[0]`} : range[0];\n const upper = isSignalRef(range) ? {signal: `${range.signal}[1]`} : range[1];\n\n if (lower !== null && upper !== null && useInRange) {\n return (\n 'inrange(' +\n fieldExpr +\n ', [' +\n predicateValueExpr(lower, timeUnit) +\n ', ' +\n predicateValueExpr(upper, timeUnit) +\n '])'\n );\n }\n\n const exprs = [];\n if (lower !== null) {\n exprs.push(`${fieldExpr} >= ${predicateValueExpr(lower, timeUnit)}`);\n }\n if (upper !== null) {\n exprs.push(`${fieldExpr} <= ${predicateValueExpr(upper, timeUnit)}`);\n }\n\n return exprs.length > 0 ? exprs.join(' && ') : 'true';\n }\n\n /* istanbul ignore next: it should never reach here */\n throw new Error(`Invalid field predicate: ${JSON.stringify(predicate)}`);\n}\n\nexport function fieldValidPredicate(fieldExpr: string, valid = true) {\n if (valid) {\n return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`;\n } else {\n return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`;\n }\n}\n\nexport function normalizePredicate(f: Predicate): Predicate {\n if (isFieldPredicate(f) && f.timeUnit) {\n return {\n ...f,\n timeUnit: normalizeTimeUnit(f.timeUnit)?.unit\n };\n }\n return f;\n}\n","import {keys} from './util';\n\n/**\n * Data type based on level of measurement\n */\nexport const Type = {\n quantitative: 'quantitative',\n ordinal: 'ordinal',\n temporal: 'temporal',\n nominal: 'nominal',\n geojson: 'geojson'\n} as const;\n\nexport type Type = keyof typeof Type;\n\nexport function isType(t: any): t is Type {\n return t in Type;\n}\n\nexport const QUANTITATIVE = Type.quantitative;\nexport const ORDINAL = Type.ordinal;\nexport const TEMPORAL = Type.temporal;\nexport const NOMINAL = Type.nominal;\n\nexport const GEOJSON = Type.geojson;\n\nexport type StandardType = 'quantitative' | 'ordinal' | 'temporal' | 'nominal';\n\nexport const TYPES = keys(Type);\n\n/**\n * Get full, lowercase type name for a given type.\n * @param type\n * @return Full type name.\n */\nexport function getFullName(type: Type | string): Type | undefined {\n if (type) {\n type = type.toLowerCase();\n switch (type) {\n case 'q':\n case QUANTITATIVE:\n return 'quantitative';\n case 't':\n case TEMPORAL:\n return 'temporal';\n case 'o':\n case ORDINAL:\n return 'ordinal';\n case 'n':\n case NOMINAL:\n return 'nominal';\n case GEOJSON:\n return 'geojson';\n }\n }\n // If we get invalid input, return undefined type.\n return undefined;\n}\n","import {\n RangeEnum,\n ScaleBins,\n ScaleInterpolateEnum,\n ScaleInterpolateParams,\n SignalRef,\n TimeInterval,\n TimeIntervalStep\n} from 'vega';\nimport {isString, toSet} from 'vega-util';\nimport * as CHANNEL from './channel';\nimport {Channel, isColorChannel} from './channel';\nimport {DateTime} from './datetime';\nimport * as log from './log';\nimport {SelectionExtent} from './selection';\nimport {NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL, Type} from './type';\nimport {contains, Flag, keys} from './util';\n\nexport const ScaleType = {\n // Continuous - Quantitative\n LINEAR: 'linear',\n LOG: 'log',\n POW: 'pow',\n SQRT: 'sqrt',\n SYMLOG: 'symlog',\n\n IDENTITY: 'identity',\n SEQUENTIAL: 'sequential',\n\n // Continuous - Time\n TIME: 'time',\n UTC: 'utc',\n\n // Discretizing scales\n QUANTILE: 'quantile',\n QUANTIZE: 'quantize',\n THRESHOLD: 'threshold',\n BIN_ORDINAL: 'bin-ordinal',\n\n // Discrete scales\n ORDINAL: 'ordinal',\n POINT: 'point',\n BAND: 'band'\n} as const;\n\ntype ValueOf = T[keyof T];\nexport type ScaleType = ValueOf;\n\n/**\n * Index for scale categories -- only scale of the same categories can be merged together.\n * Current implementation is trying to be conservative and avoid merging scale type that might not work together\n */\nexport const SCALE_CATEGORY_INDEX: Record = {\n linear: 'numeric',\n log: 'numeric',\n pow: 'numeric',\n sqrt: 'numeric',\n symlog: 'numeric',\n identity: 'numeric',\n sequential: 'numeric',\n time: 'time',\n utc: 'time',\n ordinal: 'ordinal',\n 'bin-ordinal': 'bin-ordinal', // TODO: should bin-ordinal support merging with other\n point: 'ordinal-position',\n band: 'ordinal-position',\n quantile: 'discretizing',\n quantize: 'discretizing',\n threshold: 'discretizing'\n};\n\nexport const SCALE_TYPES = keys(SCALE_CATEGORY_INDEX) as ScaleType[];\n\n/**\n * Whether the two given scale types can be merged together.\n */\nexport function scaleCompatible(scaleType1: ScaleType, scaleType2: ScaleType) {\n const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1];\n const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2];\n return (\n scaleCategory1 === scaleCategory2 ||\n (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') ||\n (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time')\n );\n}\n\n/**\n * Index for scale precedence -- high score = higher priority for merging.\n */\nconst SCALE_PRECEDENCE_INDEX: Record = {\n // numeric\n linear: 0,\n log: 1,\n pow: 1,\n sqrt: 1,\n symlog: 1,\n identity: 1,\n sequential: 1,\n // time\n time: 0,\n utc: 0,\n // ordinal-position -- these have higher precedence than continuous scales as they support more types of data\n point: 10,\n band: 11, // band has higher precedence as it is better for interaction\n // non grouped types\n ordinal: 0,\n 'bin-ordinal': 0,\n quantile: 0,\n quantize: 0,\n threshold: 0\n};\n\n/**\n * Return scale categories -- only scale of the same categories can be merged together.\n */\nexport function scaleTypePrecedence(scaleType: ScaleType): number {\n return SCALE_PRECEDENCE_INDEX[scaleType];\n}\n\nexport const CONTINUOUS_TO_CONTINUOUS_SCALES: ScaleType[] = ['linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc'];\nconst CONTINUOUS_TO_CONTINUOUS_INDEX = toSet(CONTINUOUS_TO_CONTINUOUS_SCALES);\n\nexport const QUANTITATIVE_SCALES: ScaleType[] = ['linear', 'log', 'pow', 'sqrt', 'symlog'];\n\nconst QUANTITATIVE_SCALES_INDEX = toSet(QUANTITATIVE_SCALES);\n\nexport function isQuantitative(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' {\n return type in QUANTITATIVE_SCALES_INDEX;\n}\n\nexport const CONTINUOUS_TO_DISCRETE_SCALES: ScaleType[] = ['quantile', 'quantize', 'threshold'];\nconst CONTINUOUS_TO_DISCRETE_INDEX = toSet(CONTINUOUS_TO_DISCRETE_SCALES);\n\nexport const CONTINUOUS_DOMAIN_SCALES: ScaleType[] = CONTINUOUS_TO_CONTINUOUS_SCALES.concat([\n 'quantile',\n 'quantize',\n 'threshold',\n 'sequential',\n 'identity'\n]);\nconst CONTINUOUS_DOMAIN_INDEX = toSet(CONTINUOUS_DOMAIN_SCALES);\n\nexport const DISCRETE_DOMAIN_SCALES: ScaleType[] = ['ordinal', 'bin-ordinal', 'point', 'band'];\nconst DISCRETE_DOMAIN_INDEX = toSet(DISCRETE_DOMAIN_SCALES);\n\nexport const TIME_SCALE_TYPES: ScaleType[] = ['time', 'utc'];\n\nexport function hasDiscreteDomain(type: ScaleType): type is 'ordinal' | 'bin-ordinal' | 'point' | 'band' {\n return type in DISCRETE_DOMAIN_INDEX;\n}\n\nexport function hasContinuousDomain(\n type: ScaleType\n): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' | 'quantile' | 'quantize' | 'threshold' {\n return type in CONTINUOUS_DOMAIN_INDEX;\n}\n\nexport function isContinuousToContinuous(\n type: ScaleType\n): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' {\n return type in CONTINUOUS_TO_CONTINUOUS_INDEX;\n}\n\nexport function isContinuousToDiscrete(type: ScaleType): type is 'quantile' | 'quantize' | 'threshold' {\n return type in CONTINUOUS_TO_DISCRETE_INDEX;\n}\n\nexport interface ScaleConfig {\n /**\n * If true, rounds numeric output values to integers.\n * This can be helpful for snapping to the pixel grid.\n * (Only available for `x`, `y`, and `size` scales.)\n */\n round?: boolean | SignalRef;\n\n /**\n * If true, values that exceed the data domain are clamped to either the minimum or maximum range value\n */\n clamp?: boolean | SignalRef;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales.\n *\n * __Default value:__\n * - `barBandPaddingInner` for bar marks (`0.1` by default)\n * - `rectBandPaddingInner` for rect and other marks (`0` by default)\n *\n * @minimum 0\n * @maximum 1\n */\n bandPaddingInner?: number | SignalRef;\n\n /**\n * Default outer padding for `x` and `y` band-ordinal scales.\n *\n * __Default value:__ `paddingInner/2` (which makes _width/height = number of unique values * step_)\n *\n * @minimum 0\n * @maximum 1\n */\n bandPaddingOuter?: number | SignalRef;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales of `\"bar\"` marks.\n *\n * __Default value:__ `0.1`\n *\n * @minimum 0\n * @maximum 1\n */\n barBandPaddingInner?: number | SignalRef;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales of `\"rect\"` marks.\n *\n * __Default value:__ `0`\n *\n * @minimum 0\n * @maximum 1\n */\n rectBandPaddingInner?: number | SignalRef;\n\n /**\n * Default padding for continuous scales.\n *\n * __Default:__ `5` for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.; `0` otherwise.\n *\n * @minimum 0\n */\n continuousPadding?: number | SignalRef;\n\n /**\n * Default outer padding for `x` and `y` point-ordinal scales.\n *\n * __Default value:__ `0.5` (which makes _width/height = number of unique values * step_)\n *\n * @minimum 0\n * @maximum 1\n */\n pointPadding?: number | SignalRef;\n\n /**\n * Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis.\n *\n * This is equivalent to setting `domain` to `\"unaggregate\"` for aggregated _quantitative_ fields by default.\n *\n * This property only works with aggregate functions that produce values within the raw data domain (`\"mean\"`, `\"average\"`, `\"median\"`, `\"q1\"`, `\"q3\"`, `\"min\"`, `\"max\"`). For other aggregations that produce values outside of the raw data domain (e.g. `\"count\"`, `\"sum\"`), this property is ignored.\n *\n * __Default value:__ `false`\n */\n useUnaggregatedDomain?: boolean;\n\n // nice should depends on type (quantitative or temporal), so\n // let's not make a config.\n\n // Configs for Range\n\n /**\n * The default max value for mapping quantitative fields to bar's size/bandSize.\n *\n * If undefined (default), we will use the axis's size (width or height) - 1.\n * @minimum 0\n */\n maxBandSize?: number;\n\n /**\n * The default min value for mapping quantitative fields to bar and tick's size/bandSize scale with zero=false.\n *\n * __Default value:__ `2`\n *\n * @minimum 0\n */\n minBandSize?: number;\n\n /**\n * The default max value for mapping quantitative fields to text's size/fontSize.\n *\n * __Default value:__ `40`\n *\n * @minimum 0\n */\n maxFontSize?: number;\n\n /**\n * The default min value for mapping quantitative fields to tick's size/fontSize scale with zero=false\n *\n * __Default value:__ `8`\n *\n * @minimum 0\n */\n minFontSize?: number;\n\n /**\n * Default minimum opacity for mapping a field to opacity.\n *\n * __Default value:__ `0.3`\n *\n * @minimum 0\n * @maximum 1\n */\n minOpacity?: number;\n\n /**\n * Default max opacity for mapping a field to opacity.\n *\n * __Default value:__ `0.8`\n *\n * @minimum 0\n * @maximum 1\n */\n maxOpacity?: number;\n\n /**\n * Default minimum value for point size scale with zero=false.\n *\n * __Default value:__ `9`\n *\n * @minimum 0\n */\n minSize?: number;\n\n /**\n * Default max value for point size scale.\n * @minimum 0\n */\n maxSize?: number;\n\n /**\n * Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks with zero=false.\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n minStrokeWidth?: number;\n\n /**\n * Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n maxStrokeWidth?: number;\n\n /**\n * Default range cardinality for [`quantile`](https://vega.github.io/vega-lite/docs/scale.html#quantile) scale.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n quantileCount?: number;\n\n /**\n * Default range cardinality for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n quantizeCount?: number;\n\n /**\n * Reverse x-scale by default (useful for right-to-left charts).\n */\n xReverse?: boolean | SignalRef;\n}\n\nexport const defaultScaleConfig: ScaleConfig = {\n pointPadding: 0.5,\n\n barBandPaddingInner: 0.1,\n rectBandPaddingInner: 0,\n\n minBandSize: 2,\n\n minFontSize: 8,\n maxFontSize: 40,\n\n minOpacity: 0.3,\n maxOpacity: 0.8,\n\n // FIXME: revise if these *can* become ratios of width/height step\n minSize: 9, // Point size is area. For square point, 9 = 3 pixel ^ 2, not too small!\n\n minStrokeWidth: 1,\n maxStrokeWidth: 4,\n quantileCount: 4,\n quantizeCount: 4\n};\n\nexport interface SchemeParams {\n /**\n * A color scheme name for ordinal scales (e.g., `\"category10\"` or `\"blues\"`).\n *\n * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.\n */\n name: string | SignalRef;\n\n /**\n * The extent of the color range to use. For example `[0.2, 1]` will rescale the color scheme such that color values in the range _[0, 0.2)_ are excluded from the scheme.\n */\n extent?: (number | SignalRef)[] | SignalRef;\n\n /**\n * The number of colors to use in the scheme. This can be useful for scale types such as `\"quantize\"`, which use the length of the scale range to determine the number of discrete bins for the scale domain.\n */\n count?: number | SignalRef;\n}\n\nexport type Domain =\n | (null | string | number | boolean | DateTime | SignalRef)[]\n | 'unaggregated'\n | SelectionExtent\n | SignalRef\n | DomainUnionWith;\n\nexport type Scheme = string | SchemeParams;\n\nexport function isExtendedScheme(scheme: Scheme | SignalRef): scheme is SchemeParams {\n return !isString(scheme) && !!scheme['name'];\n}\n\nexport function isSelectionDomain(domain: Domain): domain is SelectionExtent {\n return domain?.['selection'];\n}\n\nexport interface DomainUnionWith {\n /**\n * Customized domain values to be union with the field's values.\n *\n * 1) `domain` for _quantitative_ fields can take one of the following forms:\n *\n * - a two-element array with minimum and maximum values.\n * - an array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). (Alternatively, the `domainMid` property can be set for a diverging scale.)\n * - a string value `\"unaggregated\"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation.\n *\n * 2) `domain` for _temporal_ fields can be a two-element array minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime).\n *\n * 3) `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values.\n */\n unionWith: number[] | string[] | boolean[] | DateTime[];\n}\n\nexport function isDomainUnionWith(domain: Domain): domain is DomainUnionWith {\n return domain && domain['unionWith'];\n}\n\nexport interface Scale {\n /**\n * The type of scale. Vega-Lite supports the following categories of scale types:\n *\n * 1) [**Continuous Scales**](https://vega.github.io/vega-lite/docs/scale.html#continuous) -- mapping continuous domains to continuous output ranges ([`\"linear\"`](https://vega.github.io/vega-lite/docs/scale.html#linear), [`\"pow\"`](https://vega.github.io/vega-lite/docs/scale.html#pow), [`\"sqrt\"`](https://vega.github.io/vega-lite/docs/scale.html#sqrt), [`\"symlog\"`](https://vega.github.io/vega-lite/docs/scale.html#symlog), [`\"log\"`](https://vega.github.io/vega-lite/docs/scale.html#log), [`\"time\"`](https://vega.github.io/vega-lite/docs/scale.html#time), [`\"utc\"`](https://vega.github.io/vega-lite/docs/scale.html#utc).\n *\n * 2) [**Discrete Scales**](https://vega.github.io/vega-lite/docs/scale.html#discrete) -- mapping discrete domains to discrete ([`\"ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#ordinal)) or continuous ([`\"band\"`](https://vega.github.io/vega-lite/docs/scale.html#band) and [`\"point\"`](https://vega.github.io/vega-lite/docs/scale.html#point)) output ranges.\n *\n * 3) [**Discretizing Scales**](https://vega.github.io/vega-lite/docs/scale.html#discretizing) -- mapping continuous domains to discrete output ranges [`\"bin-ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#bin-ordinal), [`\"quantile\"`](https://vega.github.io/vega-lite/docs/scale.html#quantile), [`\"quantize\"`](https://vega.github.io/vega-lite/docs/scale.html#quantize) and [`\"threshold\"`](https://vega.github.io/vega-lite/docs/scale.html#threshold).\n *\n * __Default value:__ please see the [scale type table](https://vega.github.io/vega-lite/docs/scale.html#type).\n */\n type?: ScaleType;\n\n /**\n * Customized domain values in the form of constant values or dynamic values driven by a selection.\n *\n * 1) Constant `domain` for _quantitative_ fields can take one of the following forms:\n *\n * - A two-element array with minimum and maximum values. To create a diverging scale, this two-element array can be combined with the `domainMid` property.\n * - An array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n * - A string value `\"unaggregated\"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation.\n *\n * 2) Constant `domain` for _temporal_ fields can be a two-element array with minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime).\n *\n * 3) Constant `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values.\n *\n * 4) To combine (union) specified constant domain with the field's values, `domain` can be an object with a `unionWith` property that specify constant domain to be combined. For example, `domain: {unionWith: [0, 100]}` for a quantitative scale means that the scale domain always includes `[0, 100]`, but will include other values in the fields beyond `[0, 100]`.\n *\n * 5) Domain can also takes an object defining a field or encoding of a selection that [interactively determines](https://vega.github.io/vega-lite/docs/selection.html#scale-domains) the scale domain.\n */\n domain?:\n | (null | string | number | boolean | DateTime | SignalRef)[]\n | 'unaggregated'\n | SelectionExtent\n | DomainUnionWith\n | SignalRef;\n\n /**\n * Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint for [diverging color scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). The domainMid property is only intended for use with scales supporting continuous, piecewise domains.\n */\n domainMid?: number | SignalRef;\n\n /**\n * Sets the maximum value in the scale domain, overriding the `domain` property. This property is only intended for use with scales having continuous domains.\n */\n domainMax?: number | DateTime | SignalRef;\n\n /**\n * Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains.\n */\n domainMin?: number | DateTime | SignalRef;\n\n /**\n * If true, reverses the order of the scale range.\n * __Default value:__ `false`.\n */\n reverse?: boolean | SignalRef;\n\n /**\n * The range of the scale. One of:\n *\n * - A string indicating a [pre-defined named scale range](https://vega.github.io/vega-lite/docs/scale.html#range-config) (e.g., example, `\"symbol\"`, or `\"diverging\"`).\n *\n * - For [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous), two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a [piecewise scale](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n *\n * - For [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) and [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales, an array of desired output values or an object with a `field` property representing the range values. For example, if a field `color` contains CSS color names, we can set `range` to `{field: \"color\"}`.\n *\n * __Notes:__\n *\n * 1) For color scales you can also specify a color [`scheme`](https://vega.github.io/vega-lite/docs/scale.html#scheme) instead of `range`.\n *\n * 2) Any directly specified `range` for `x` and `y` channels will be ignored. Range can be customized via the view's corresponding [size](https://vega.github.io/vega-lite/docs/size.html) (`width` and `height`).\n */\n range?: RangeEnum | (number | string | number[] | SignalRef)[] | {field: string};\n\n /**\n * Sets the maximum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.\n */\n rangeMax?: number | string | SignalRef;\n\n /**\n * Sets the minimum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.\n */\n rangeMin?: number | string | SignalRef;\n\n // ordinal\n\n /**\n * A string indicating a color [scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme) name (e.g., `\"category10\"` or `\"blues\"`) or a [scheme parameter object](https://vega.github.io/vega-lite/docs/scale.html#scheme-params).\n *\n * Discrete color schemes may be used with [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) or [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales. Continuous color schemes are intended for use with color scales.\n *\n * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.\n */\n scheme?: string | SchemeParams | SignalRef;\n\n /**\n * The alignment of the steps within the scale range.\n *\n * This value must lie in the range `[0,1]`. A value of `0.5` indicates that the steps should be centered within the range. A value of `0` or `1` may be used to shift the bands to one side, say to position them adjacent to an axis.\n *\n * __Default value:__ `0.5`\n */\n align?: number | SignalRef;\n\n /**\n * Bin boundaries can be provided to scales as either an explicit array of bin boundaries or as a bin specification object. The legal values are:\n * - An [array](../types/#Array) literal of bin boundary values. For example, `[0, 5, 10, 15, 20]`. The array must include both starting and ending boundaries. The previous example uses five values to indicate a total of four bin intervals: [0-5), [5-10), [10-15), [15-20]. Array literals may include signal references as elements.\n * - A [bin specification object](https://vega.github.io/vega-lite/docs/scale.html#bins) that indicates the bin _step_ size, and optionally the _start_ and _stop_ boundaries.\n * - An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels.\n */\n // TODO: add - A [signal reference](../types/#Signal) that resolves to either an array or bin specification object.\n bins?: ScaleBins;\n\n /**\n * If `true`, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid.\n *\n * __Default value:__ `false`.\n */\n round?: boolean | SignalRef;\n\n /**\n * For _[continuous](https://vega.github.io/vega-lite/docs/scale.html#continuous)_ scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the `zero`, `nice`, `domainMin`, and `domainMax` properties.\n *\n * For _[band](https://vega.github.io/vega-lite/docs/scale.html#band)_ scales, shortcut for setting `paddingInner` and `paddingOuter` to the same value.\n *\n * For _[point](https://vega.github.io/vega-lite/docs/scale.html#point)_ scales, alias for `paddingOuter`.\n *\n * __Default value:__ For _continuous_ scales, derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `continuousPadding`.\n * For _band and point_ scales, see `paddingInner` and `paddingOuter`. By default, Vega-Lite sets padding such that _width/height = number of unique values * step_.\n *\n * @minimum 0\n */\n padding?: number | SignalRef;\n\n /**\n * The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].\n *\n * For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands).\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingInner`.\n *\n * @minimum 0\n * @maximum 1\n */\n paddingInner?: number | SignalRef;\n\n /**\n * The outer padding (spacing) at the ends of the range of band and point scales,\n * as a fraction of the step size. This value must lie in the range [0,1].\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingOuter` for band scales and `pointPadding` for point scales.\n * By default, Vega-Lite sets outer padding such that _width/height = number of unique values * step_.\n *\n * @minimum 0\n * @maximum 1\n */\n paddingOuter?: number | SignalRef;\n\n // typical\n /**\n * If `true`, values that exceed the data domain are clamped to either the minimum or maximum range value\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/config.html#scale-config)'s `clamp` (`true` by default).\n */\n clamp?: boolean | SignalRef;\n\n /**\n * Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of _[0.201479…, 0.996679…]_, a nice domain might be _[0.2, 1.0]_.\n *\n * For quantitative scales such as linear, `nice` can be either a boolean flag or a number. If `nice` is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.\n *\n * For temporal fields with time and utc scales, the `nice` value can be a string indicating the desired time interval. Legal values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and `\"year\"`. Alternatively, `time` and `utc` scales can accept an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}`, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries.\n *\n * __Default value:__ `true` for unbinned _quantitative_ fields; `false` otherwise.\n *\n */\n nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef;\n\n /**\n * The logarithm base of the `log` scale (default `10`).\n */\n base?: number | SignalRef;\n\n /**\n * The exponent of the `pow` scale.\n */\n exponent?: number | SignalRef;\n\n /**\n * A constant determining the slope of the symlog function around zero. Only used for `symlog` scales.\n *\n * __Default value:__ `1`\n */\n constant?: number | SignalRef;\n\n /**\n * If `true`, ensures that a zero baseline value is included in the scale domain.\n *\n * __Default value:__ `true` for x and y channels if the quantitative field is not binned and no custom `domain` is provided; `false` otherwise.\n *\n * __Note:__ Log, time, and utc scales do not support `zero`.\n */\n zero?: boolean | SignalRef;\n\n /**\n * The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include `rgb`, `hsl`, `hsl-long`, `lab`, `hcl`, `hcl-long`, `cubehelix` and `cubehelix-long` ('-long' variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued _type_ property and an optional numeric _gamma_ property applicable to rgb and cubehelix interpolators. For more, see the [d3-interpolate documentation](https://github.com/d3/d3-interpolate).\n *\n * * __Default value:__ `hcl`\n */\n interpolate?: ScaleInterpolateEnum | SignalRef | ScaleInterpolateParams;\n}\n\nconst SCALE_PROPERTY_INDEX: Flag = {\n type: 1,\n domain: 1,\n domainMax: 1,\n domainMin: 1,\n domainMid: 1,\n align: 1,\n range: 1,\n rangeMax: 1,\n rangeMin: 1,\n scheme: 1,\n bins: 1,\n // Other properties\n reverse: 1,\n round: 1,\n // quantitative / time\n clamp: 1,\n nice: 1,\n // quantitative\n base: 1,\n exponent: 1,\n constant: 1,\n interpolate: 1,\n zero: 1, // zero depends on domain\n // band/point\n padding: 1,\n paddingInner: 1,\n paddingOuter: 1\n};\n\nexport const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX);\n\nconst {\n type,\n domain,\n range,\n rangeMax,\n rangeMin,\n scheme,\n ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX\n} = SCALE_PROPERTY_INDEX;\n\nexport const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX);\n\nexport function scaleTypeSupportProperty(scaleType: ScaleType, propName: keyof Scale): boolean {\n switch (propName) {\n case 'type':\n case 'domain':\n case 'reverse':\n case 'range':\n return true;\n case 'scheme':\n case 'interpolate':\n return !contains(['point', 'band', 'identity'], scaleType);\n case 'bins':\n return !contains(['point', 'band', 'identity', 'ordinal'], scaleType);\n case 'round':\n return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point';\n case 'padding':\n case 'rangeMin':\n case 'rangeMax':\n return isContinuousToContinuous(scaleType) || contains(['point', 'band'], scaleType);\n case 'paddingOuter':\n case 'align':\n return contains(['point', 'band'], scaleType);\n case 'paddingInner':\n return scaleType === 'band';\n case 'domainMax':\n case 'domainMid':\n case 'domainMin':\n case 'clamp':\n return isContinuousToContinuous(scaleType);\n case 'nice':\n return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold';\n case 'exponent':\n return scaleType === 'pow';\n case 'base':\n return scaleType === 'log';\n case 'constant':\n return scaleType === 'symlog';\n case 'zero':\n return (\n hasContinuousDomain(scaleType) &&\n !contains(\n [\n 'log', // log scale cannot have zero value\n 'time',\n 'utc', // zero is not meaningful for time\n 'threshold', // threshold requires custom domain so zero does not matter\n 'quantile' // quantile depends on distribution so zero does not matter\n ],\n scaleType\n )\n );\n }\n}\n\n/**\n * Returns undefined if the input channel supports the input scale property name\n */\nexport function channelScalePropertyIncompatability(channel: Channel, propName: keyof Scale): string {\n switch (propName) {\n case 'interpolate':\n case 'scheme':\n case 'domainMid':\n if (!isColorChannel(channel)) {\n return log.message.cannotUseScalePropertyWithNonColor(channel);\n }\n return undefined;\n case 'align':\n case 'type':\n case 'bins':\n case 'domain':\n case 'domainMax':\n case 'domainMin':\n case 'range':\n case 'base':\n case 'exponent':\n case 'constant':\n case 'nice':\n case 'padding':\n case 'paddingInner':\n case 'paddingOuter':\n case 'rangeMax':\n case 'rangeMin':\n case 'reverse':\n case 'round':\n case 'clamp':\n case 'zero':\n return undefined; // GOOD!\n }\n}\n\nexport function scaleTypeSupportDataType(specifiedType: ScaleType, fieldDefType: Type): boolean {\n if (contains([ORDINAL, NOMINAL], fieldDefType)) {\n return specifiedType === undefined || hasDiscreteDomain(specifiedType);\n } else if (fieldDefType === TEMPORAL) {\n return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType);\n } else if (fieldDefType === QUANTITATIVE) {\n return contains(\n [\n ScaleType.LOG,\n ScaleType.POW,\n ScaleType.SQRT,\n ScaleType.SYMLOG,\n ScaleType.QUANTILE,\n ScaleType.QUANTIZE,\n ScaleType.THRESHOLD,\n ScaleType.LINEAR,\n undefined\n ],\n specifiedType\n );\n }\n\n return true;\n}\n\nexport function channelSupportScaleType(channel: Channel, scaleType: ScaleType): boolean {\n if (!CHANNEL.isScaleChannel(channel)) {\n return false;\n }\n switch (channel) {\n case CHANNEL.X:\n case CHANNEL.Y:\n case CHANNEL.THETA:\n case CHANNEL.RADIUS:\n return isContinuousToContinuous(scaleType) || contains(['band', 'point'], scaleType);\n case CHANNEL.SIZE: // TODO: size and opacity can support ordinal with more modification\n case CHANNEL.STROKEWIDTH:\n case CHANNEL.OPACITY:\n case CHANNEL.FILLOPACITY:\n case CHANNEL.STROKEOPACITY:\n case CHANNEL.ANGLE:\n // Although it generally doesn't make sense to use band with size and opacity,\n // it can also work since we use band: 0.5 to get midpoint.\n return (\n isContinuousToContinuous(scaleType) ||\n isContinuousToDiscrete(scaleType) ||\n contains(['band', 'point', 'ordinal'], scaleType)\n );\n case CHANNEL.COLOR:\n case CHANNEL.FILL:\n case CHANNEL.STROKE:\n return scaleType !== 'band'; // band does not make sense with color\n case CHANNEL.STROKEDASH:\n return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType);\n case CHANNEL.SHAPE:\n return scaleType === 'ordinal'; // shape = lookup only\n }\n}\n","/**\n * Utility files for producing Vega ValueRef for marks\n */\nimport {SignalRef} from 'vega';\nimport {isFunction, isString} from 'vega-util';\nimport {isCountingAggregateOp} from '../../../aggregate';\nimport {isBinned, isBinning} from '../../../bin';\nimport {Channel, getMainRangeChannel, PolarPositionChannel, PositionChannel, X, X2, Y2} from '../../../channel';\nimport {\n binRequiresRange,\n ChannelDef,\n DatumDef,\n FieldDef,\n FieldDefBase,\n FieldName,\n FieldRefOption,\n getBand,\n isDatumDef,\n isFieldDef,\n isFieldOrDatumDef,\n isTypedFieldDef,\n isValueDef,\n SecondaryChannelDef,\n SecondaryFieldDef,\n TypedFieldDef,\n Value,\n vgField\n} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {dateTimeToExpr, isDateTime} from '../../../datetime';\nimport * as log from '../../../log';\nimport {isPathMark, Mark, MarkDef} from '../../../mark';\nimport {fieldValidPredicate} from '../../../predicate';\nimport {hasDiscreteDomain, isContinuousToContinuous} from '../../../scale';\nimport {StackProperties} from '../../../stack';\nimport {TEMPORAL} from '../../../type';\nimport {contains} from '../../../util';\nimport {isSignalRef, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\n\nexport function midPointRefWithPositionInvalidTest(\n params: MidPointParams & {\n channel: PositionChannel | PolarPositionChannel;\n }\n) {\n const {channel, channelDef, markDef, scale, config} = params;\n const ref = midPoint(params);\n\n // Wrap to check if the positional value is invalid, if so, plot the point on the min value\n if (\n // Only this for field def without counting aggregate (as count wouldn't be null)\n isFieldDef(channelDef) &&\n !isCountingAggregateOp(channelDef.aggregate) &&\n // and only for continuous scale without zero (otherwise, null / invalid will be interpreted as zero, which doesn't cause layout problem)\n scale &&\n isContinuousToContinuous(scale.get('type')) &&\n scale.get('zero') === false\n ) {\n return wrapPositionInvalidTest({\n fieldDef: channelDef,\n channel,\n markDef,\n ref,\n config\n });\n }\n return ref;\n}\n\nexport function wrapPositionInvalidTest({\n fieldDef,\n channel,\n markDef,\n ref,\n config\n}: {\n fieldDef: FieldDef;\n channel: PositionChannel | PolarPositionChannel;\n markDef: MarkDef;\n ref: VgValueRef;\n config: Config;\n}): VgValueRef | VgValueRef[] {\n if (isPathMark(markDef.type)) {\n // path mark already use defined to skip points, no need to do it here.\n return ref;\n }\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid === null) {\n // if there is no invalid filter, don't do the invalid test\n return ref;\n }\n\n return [fieldInvalidTestValueRef(fieldDef, channel), ref];\n}\n\nexport function fieldInvalidTestValueRef(fieldDef: FieldDef, channel: PositionChannel | PolarPositionChannel) {\n const test = fieldInvalidPredicate(fieldDef, true);\n\n const mainChannel = getMainRangeChannel(channel) as PositionChannel | PolarPositionChannel; // we can cast here as the output can't be other things.\n const zeroValueRef =\n mainChannel === 'y'\n ? {field: {group: 'height'}}\n : // x / angle / radius can all use 0\n {value: 0};\n\n return {test, ...zeroValueRef};\n}\n\nexport function fieldInvalidPredicate(field: FieldName | FieldDef, invalid = true) {\n return fieldValidPredicate(isString(field) ? field : vgField(field, {expr: 'datum'}), !invalid);\n}\n\nexport function datumDefToExpr(datumDef: DatumDef) {\n const {datum} = datumDef;\n if (isDateTime(datum)) {\n return dateTimeToExpr(datum);\n }\n return `${JSON.stringify(datum)}`;\n}\n\nexport function valueRefForFieldOrDatumDef(\n fieldDef: FieldDefBase | DatumDef,\n scaleName: string,\n opt: FieldRefOption,\n encode: {offset?: number | VgValueRef; band?: number | boolean}\n): VgValueRef {\n const ref: VgValueRef = {};\n\n if (scaleName) {\n ref.scale = scaleName;\n }\n\n if (isDatumDef(fieldDef)) {\n const {datum} = fieldDef;\n if (isDateTime(datum)) {\n ref.signal = dateTimeToExpr(datum);\n } else if (isSignalRef(datum)) {\n ref.signal = datum.signal;\n } else {\n ref.value = datum;\n }\n } else {\n ref.field = vgField(fieldDef, opt);\n }\n\n if (encode) {\n const {offset, band} = encode;\n if (offset) {\n ref.offset = offset;\n }\n if (band) {\n ref.band = band;\n }\n }\n return ref;\n}\n\n/**\n * Signal that returns the middle of a bin from start and end field. Should only be used with x and y.\n */\nexport function interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef,\n fieldOrDatumDef2,\n offset,\n startSuffix,\n band = 0.5\n}: {\n scaleName: string;\n fieldOrDatumDef: TypedFieldDef;\n fieldOrDatumDef2?: SecondaryFieldDef;\n startSuffix?: string;\n offset: number | SignalRef;\n band: number;\n}): VgValueRef {\n const expr = 0 < band && band < 1 ? 'datum' : undefined;\n const start = vgField(fieldOrDatumDef, {expr, suffix: startSuffix});\n const end =\n fieldOrDatumDef2 !== undefined\n ? vgField(fieldOrDatumDef2, {expr})\n : vgField(fieldOrDatumDef, {suffix: 'end', expr});\n\n const ref: VgValueRef = {};\n\n if (band === 0 || band === 1) {\n ref.scale = scaleName;\n const val = band === 0 ? start : end;\n ref.field = val;\n } else {\n const datum = `${band} * ${start} + ${1 - band} * ${end}`;\n ref.signal = `scale(\"${scaleName}\", ${datum})`;\n }\n\n if (offset) {\n ref.offset = offset;\n }\n return ref;\n}\n\nexport interface MidPointParams {\n channel: Channel;\n channelDef: ChannelDef;\n channel2Def?: SecondaryChannelDef;\n\n markDef: MarkDef;\n config: Config;\n\n scaleName: string;\n scale: ScaleComponent;\n stack?: StackProperties;\n offset?: number | SignalRef;\n defaultRef: VgValueRef | (() => VgValueRef);\n\n /**\n * Allow overriding band instead of reading to field def since band is applied to size (width/height) instead of the position for x/y-position with band scales.\n */\n band?: number;\n}\n\n/**\n * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels.\n */\nexport function midPoint({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef,\n band\n}: MidPointParams): VgValueRef {\n // TODO: datum support\n if (channelDef) {\n /* istanbul ignore else */\n\n if (isFieldOrDatumDef(channelDef)) {\n if (isTypedFieldDef(channelDef)) {\n band =\n band ??\n getBand({\n channel,\n fieldDef: channelDef,\n fieldDef2: channel2Def,\n markDef,\n stack,\n config,\n isMidPoint: true\n });\n const {bin, timeUnit, type} = channelDef;\n\n if (isBinning(bin) || (band && timeUnit && type === TEMPORAL)) {\n // Use middle only for x an y to place marks in the center between start and end of the bin range.\n // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match.\n if (stack && stack.impute) {\n // For stack, we computed bin_mid so we can impute.\n return valueRefForFieldOrDatumDef(channelDef, scaleName, {binSuffix: 'mid'}, {offset});\n }\n if (band) {\n // if band = 0, no need to call interpolation\n // For non-stack, we can just calculate bin mid on the fly using signal.\n return interpolatedSignalRef({scaleName, fieldOrDatumDef: channelDef, band, offset});\n }\n return valueRefForFieldOrDatumDef(\n channelDef,\n scaleName,\n binRequiresRange(channelDef, channel) ? {binSuffix: 'range'} : {},\n {\n offset\n }\n );\n } else if (isBinned(bin)) {\n if (isFieldDef(channel2Def)) {\n return interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef,\n fieldOrDatumDef2: channel2Def,\n band,\n offset\n });\n } else {\n const channel2 = channel === X ? X2 : Y2;\n log.warn(log.message.channelRequiredForBinned(channel2));\n }\n }\n }\n\n const scaleType = scale?.get('type');\n return valueRefForFieldOrDatumDef(\n channelDef,\n scaleName,\n hasDiscreteDomain(scaleType) ? {binSuffix: 'range'} : {}, // no need for bin suffix if there is no scale\n {\n offset,\n // For band, to get mid point, need to offset by half of the band\n band: scaleType === 'band' ? band ?? channelDef.band ?? 0.5 : undefined\n }\n );\n } else if (isValueDef(channelDef)) {\n const value = channelDef.value;\n const offsetMixins = offset ? {offset} : {};\n\n return {...widthHeightValueOrSignalRef(channel, value), ...offsetMixins};\n }\n\n // If channelDef is neither field def or value def, it's a condition-only def.\n // In such case, we will use default ref.\n }\n\n if (isFunction(defaultRef)) {\n defaultRef = defaultRef();\n }\n\n if (defaultRef) {\n // for non-position, ref could be undefined.\n return {\n ...defaultRef,\n // only include offset when it is non-zero (zero = no offset)\n ...(offset ? {offset} : {})\n };\n }\n return defaultRef;\n}\n\n/**\n * Convert special \"width\" and \"height\" values in Vega-Lite into Vega value ref.\n */\nexport function widthHeightValueOrSignalRef(channel: Channel, value: Value | SignalRef) {\n if (contains(['x', 'x2'], channel) && value === 'width') {\n return {field: {group: 'width'}};\n } else if (contains(['y', 'y2'], channel) && value === 'height') {\n return {field: {group: 'height'}};\n }\n return signalOrValueRef(value);\n}\n","import {SignalRef} from 'vega-typings/types';\nimport {isString} from 'vega-util';\nimport {isBinning} from '../bin';\nimport {\n channelDefType,\n DatumDef,\n FieldDef,\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n isScaleFieldDef,\n vgField\n} from '../channeldef';\nimport {Config} from '../config';\nimport {fieldValidPredicate} from '../predicate';\nimport {ScaleType} from '../scale';\nimport {formatExpression, normalizeTimeUnit, timeUnitSpecifierExpression} from '../timeunit';\nimport {QUANTITATIVE, Type} from '../type';\nimport {Dict} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {TimeUnit} from './../timeunit';\nimport {datumDefToExpr} from './mark/encode/valueref';\n\nexport function isCustomFormatType(formatType: string) {\n return formatType && formatType !== 'number' && formatType !== 'time';\n}\n\nfunction customFormatExpr(formatType: string, field: string, format: string | Dict) {\n return `${formatType}(${field}${format ? `, ${JSON.stringify(format)}` : ''})`;\n}\n\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\n\nexport function formatSignalRef({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n normalizeStack,\n config\n}: {\n fieldOrDatumDef: FieldDef | DatumDef;\n format: string | Dict;\n formatType: string;\n expr?: 'datum' | 'parent' | 'datum.datum';\n normalizeStack?: boolean;\n config: Config;\n}) {\n if (isCustomFormatType(formatType)) {\n return formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n config\n });\n }\n\n const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const signal = timeFormatExpression(\n field,\n isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined,\n format,\n config.timeFormat,\n isScaleFieldDef(fieldOrDatumDef) && fieldOrDatumDef.scale?.type === ScaleType.UTC\n );\n return signal ? {signal} : undefined;\n }\n\n format = numberFormat(channelDefType(fieldOrDatumDef), format, config);\n if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'});\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n } else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') {\n return {\n signal: `${formatExpr(field, format)}`\n };\n } else {\n return {signal: `isValid(${field}) ? ${field} : \"\"+${field}`};\n }\n}\n\nfunction fieldToFormat(\n fieldOrDatumDef: FieldDef | DatumDef,\n expr: 'datum' | 'parent' | 'datum.datum',\n normalizeStack: boolean\n) {\n if (isFieldDef(fieldOrDatumDef)) {\n if (normalizeStack) {\n return `${vgField(fieldOrDatumDef, {expr, suffix: 'end'})}-${vgField(fieldOrDatumDef, {\n expr,\n suffix: 'start'\n })}`;\n } else {\n return vgField(fieldOrDatumDef, {expr});\n }\n } else {\n return datumDefToExpr(fieldOrDatumDef);\n }\n}\n\nexport function formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n normalizeStack,\n config,\n field\n}: {\n fieldOrDatumDef: FieldDef | DatumDef;\n format: string | Dict;\n formatType: string;\n expr?: 'datum' | 'parent' | 'datum.datum';\n normalizeStack?: boolean;\n config: Config;\n field?: string; // axis/legend \"use datum.value\"\n}) {\n field = field ?? fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n\n if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'});\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n }\n return {signal: customFormatExpr(formatType, field, format)};\n}\n\nexport function guideFormat(\n fieldOrDatumDef: FieldDef | DatumDef,\n type: Type,\n format: string | Dict,\n formatType: string,\n config: Config,\n omitTimeFormatConfig: boolean // axis doesn't use config.timeFormat\n) {\n if (isCustomFormatType(formatType)) {\n return undefined; // handled in encode block\n }\n\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n\n return timeFormat(format as string, timeUnit, config, omitTimeFormatConfig);\n }\n\n return numberFormat(type, format, config);\n}\n\nexport function guideFormatType(\n formatType: string | SignalRef,\n fieldOrDatumDef: FieldDef | DatumDef,\n scaleType: ScaleType\n) {\n if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) {\n return formatType;\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') {\n return 'time';\n }\n return undefined;\n}\n\n/**\n * Returns number format for a fieldDef.\n */\nexport function numberFormat(type: Type, specifiedFormat: string | Dict, config: Config) {\n // Specified format in axis/legend has higher precedence than fieldDef.format\n if (isString(specifiedFormat)) {\n return specifiedFormat;\n }\n\n if (type === QUANTITATIVE) {\n // we only apply the default if the field is quantitative\n return config.numberFormat;\n }\n return undefined;\n}\n\n/**\n * Returns time format for a fieldDef for use in guides.\n */\nexport function timeFormat(specifiedFormat: string, timeUnit: TimeUnit, config: Config, omitTimeFormatConfig: boolean) {\n if (specifiedFormat) {\n return specifiedFormat;\n }\n\n if (timeUnit) {\n return {\n signal: timeUnitSpecifierExpression(timeUnit)\n };\n }\n\n return omitTimeFormatConfig ? undefined : config.timeFormat;\n}\n\nfunction formatExpr(field: string, format: string) {\n return `format(${field}, \"${format || ''}\")`;\n}\n\nfunction binNumberFormatExpr(field: string, format: string | Dict, formatType: string, config: Config) {\n if (isCustomFormatType(formatType)) {\n return customFormatExpr(formatType, field, format);\n }\n\n return formatExpr(field, (isString(format) ? format : undefined) ?? config.numberFormat);\n}\n\nexport function binFormatExpression(\n startField: string,\n endField: string,\n format: string | Dict,\n formatType: string,\n config: Config\n) {\n const start = binNumberFormatExpr(startField, format, formatType, config);\n const end = binNumberFormatExpr(endField, format, formatType, config);\n return `${fieldValidPredicate(startField, false)} ? \"null\" : ${start} + \"${BIN_RANGE_DELIMITER}\" + ${end}`;\n}\n\n/**\n * Returns the time expression used for axis/legend labels or text mark for a temporal field\n */\nexport function timeFormatExpression(\n field: string,\n timeUnit: TimeUnit,\n format: string | Dict,\n rawTimeFormat: string, // should be provided only for actual text and headers, not axis/legend labels\n isUTCScale: boolean\n): string {\n if (!timeUnit || format) {\n // If there is no time unit, or if user explicitly specifies format for axis/legend/text.\n format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit.\n return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`;\n } else {\n return formatExpression(timeUnit, field, isUTCScale);\n }\n}\n","import {isArray} from 'vega-util';\nimport {NonArgAggregateOp} from './aggregate';\nimport {FieldName} from './channeldef';\nimport {DateTime} from './datetime';\n\nexport type SortOrder = 'ascending' | 'descending';\n\n/**\n * A sort definition for transform\n */\nexport interface SortField {\n /**\n * The name of the field to sort.\n */\n field: FieldName;\n\n /**\n * Whether to sort the field in ascending or descending order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport interface SortFields {\n field: FieldName[];\n order?: SortOrder[];\n}\n\nexport const DEFAULT_SORT_OP = 'min';\n\n/**\n * A sort definition for sorting a discrete scale in an encoding field definition.\n */\n\nexport interface EncodingSortField {\n /**\n * The data [field](https://vega.github.io/vega-lite/docs/field.html) to sort by.\n *\n * __Default value:__ If unspecified, defaults to the field specified in the outer data reference.\n */\n field?: F; // Field is optional because `\"op\": \"count\"` does not require a field.\n /**\n * An [aggregate operation](https://vega.github.io/vega-lite/docs/aggregate.html#ops) to perform on the field prior to sorting (e.g., `\"count\"`, `\"mean\"` and `\"median\"`).\n * An aggregation is required when there are multiple values of the sort field for each encoded data field.\n * The input data objects will be aggregated, grouped by the encoded data field.\n *\n * For a full list of operations, please see the documentation for [aggregate](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n *\n * __Default value:__ `\"sum\"` for stacked plots. Otherwise, `\"min\"`.\n */\n op?: NonArgAggregateOp;\n\n /**\n * The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport interface SortByEncoding {\n /**\n * The [encoding channel](https://vega.github.io/vega-lite/docs/encoding.html#channels) to sort by (e.g., `\"x\"`, `\"y\"`)\n */\n encoding: SortByChannel;\n\n /**\n * The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport type SortArray = number[] | string[] | boolean[] | DateTime[];\n\nconst SORT_BY_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n color: 1,\n fill: 1,\n stroke: 1,\n strokeWidth: 1,\n size: 1,\n shape: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n opacity: 1,\n text: 1\n} as const;\n\nexport type SortByChannel = keyof typeof SORT_BY_CHANNEL_INDEX;\n\nexport function isSortByChannel(c: string): c is SortByChannel {\n return c in SORT_BY_CHANNEL_INDEX;\n}\n\nexport type SortByChannelDesc =\n | '-x'\n | '-y'\n | '-color'\n | '-fill'\n | '-stroke'\n | '-strokeWidth'\n | '-size'\n | '-shape'\n | '-fillOpacity'\n | '-strokeOpacity'\n | '-opacity'\n | '-text';\n\nexport type AllSortString = SortOrder | SortByChannel | SortByChannelDesc;\n\nexport type Sort = SortArray | AllSortString | EncodingSortField | SortByEncoding | null;\n\nexport function isSortByEncoding(sort: Sort): sort is SortByEncoding {\n return !!sort && !!sort['encoding'];\n}\n\nexport function isSortField(sort: Sort): sort is EncodingSortField {\n return !!sort && (sort['op'] === 'count' || !!sort['field']);\n}\n\nexport function isSortArray(sort: Sort): sort is SortArray {\n return !!sort && isArray(sort);\n}\n","import {LayoutAlign} from 'vega';\nimport {BinParams} from '../bin';\nimport {ChannelDef, Field, FieldName, TypedFieldDef} from '../channeldef';\nimport {Header} from '../header';\nimport {EncodingSortField, SortArray, SortOrder} from '../sort';\nimport {StandardType} from '../type';\nimport {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\nimport {GenericLayerSpec, NormalizedLayerSpec} from './layer';\nimport {GenericUnitSpec, NormalizedUnitSpec} from './unit';\n\nexport interface FacetFieldDef extends TypedFieldDef {\n /**\n * An object defining properties of a facet's header.\n */\n header?: Header;\n\n // Note: `\"sort\"` for facet field def is different from encoding field def as it does not support `SortByEncoding`\n\n /**\n * Sort order for the encoded field.\n *\n * For continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n *\n * For discrete fields, `sort` can be one of the following:\n * - `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n * - `null` indicating no sort.\n *\n * __Default value:__ `\"ascending\"`\n *\n * __Note:__ `null` is not supported for `row` and `column`.\n */\n sort?: SortArray | SortOrder | EncodingSortField | null;\n}\n\nexport type FacetEncodingFieldDef = FacetFieldDef & GenericCompositionLayoutWithColumns;\n\nexport interface RowColumnEncodingFieldDef extends FacetFieldDef {\n // Manually declarae this separated from GenericCompositionLayout as we don't support RowCol object in RowColumnEncodingFieldDef\n\n /**\n * The alignment to apply to row/column facet's subplot.\n * The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n *\n * - For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n * - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n * - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n *\n * __Default value:__ `\"all\"`.\n */\n align?: LayoutAlign;\n\n /**\n * Boolean flag indicating if facet's subviews should be centered relative to their respective rows or columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean;\n\n /**\n * The spacing in pixels between facet's sub-views.\n *\n * __Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)\n */\n spacing?: number;\n}\n\nexport interface FacetMapping = FacetFieldDef> {\n /**\n * A field definition for the vertical facet of trellis plots.\n */\n row?: FD;\n\n /**\n * A field definition for the horizontal facet of trellis plots.\n */\n column?: FD;\n}\n\nexport function isFacetMapping(f: FacetFieldDef | FacetMapping): f is FacetMapping {\n return 'row' in f || 'column' in f;\n}\n\n/**\n * Facet mapping for encoding macro\n */\nexport interface EncodingFacetMapping extends FacetMapping> {\n /**\n * A field definition for the (flexible) facet of trellis plots.\n *\n * If either `row` or `column` is specified, this channel will be ignored.\n */\n facet?: FacetEncodingFieldDef;\n}\n\nexport function isFacetFieldDef(channelDef: ChannelDef): channelDef is FacetFieldDef {\n return !!channelDef && 'header' in channelDef;\n}\n\n/**\n * Base interface for a facet specification.\n */\nexport interface GenericFacetSpec<\n U extends GenericUnitSpec,\n L extends GenericLayerSpec,\n F extends Field\n> extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for how to facet the data. One of:\n * 1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def)\n * 2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping)\n */\n facet: FacetFieldDef | FacetMapping;\n\n /**\n * A specification of the view that gets faceted.\n */\n spec: L | U;\n // TODO: replace this with GenericSpec once we support all cases;\n}\n\n/**\n * A facet specification without any shortcut / expansion syntax\n */\nexport type NormalizedFacetSpec = GenericFacetSpec;\n\nexport function isFacetSpec(spec: BaseSpec): spec is GenericFacetSpec {\n return 'facet' in spec;\n}\n","import {Gradient, SignalRef, Text} from 'vega';\nimport {isArray, isBoolean, isNumber, isString} from 'vega-util';\nimport {Aggregate, isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp} from './aggregate';\nimport {Axis} from './axis';\nimport {autoMaxBins, Bin, BinParams, binToString, isBinned, isBinning} from './bin';\nimport {\n ANGLE,\n Channel,\n COLOR,\n COLUMN,\n DESCRIPTION,\n DETAIL,\n FACET,\n FILL,\n FILLOPACITY,\n HREF,\n isScaleChannel,\n isSecondaryRangeChannel,\n isXorY,\n KEY,\n LATITUDE,\n LATITUDE2,\n LONGITUDE,\n LONGITUDE2,\n OPACITY,\n ORDER,\n RADIUS,\n RADIUS2,\n ROW,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n TEXT,\n THETA,\n THETA2,\n TOOLTIP,\n URL,\n X,\n X2,\n Y,\n Y2,\n ExtendedChannel\n} from './channel';\nimport {getMarkConfig} from './compile/common';\nimport {isCustomFormatType} from './compile/format';\nimport {CompositeAggregate} from './compositemark';\nimport {Config} from './config';\nimport {DateTime, dateTimeToExpr, isDateTime} from './datetime';\nimport {Encoding} from './encoding';\nimport {FormatMixins, Guide, GuideEncodingConditionalValueDef, TitleMixins} from './guide';\nimport {ImputeParams} from './impute';\nimport {Legend} from './legend';\nimport * as log from './log';\nimport {LogicalComposition} from './logical';\nimport {isRectBasedMark, MarkDef} from './mark';\nimport {Predicate} from './predicate';\nimport {Scale, SCALE_CATEGORY_INDEX} from './scale';\nimport {isSortByChannel, Sort, SortOrder} from './sort';\nimport {isFacetFieldDef} from './spec/facet';\nimport {StackOffset, StackProperties} from './stack';\nimport {\n getTimeUnitParts,\n isLocalSingleTimeUnit,\n normalizeTimeUnit,\n TimeUnit,\n TimeUnitParams,\n timeUnitToString\n} from './timeunit';\nimport {AggregatedFieldDef, WindowFieldDef} from './transform';\nimport {getFullName, QUANTITATIVE, StandardType, Type} from './type';\nimport {\n contains,\n flatAccessWithDatum,\n getFirstDefined,\n internalField,\n omit,\n removePathFromField,\n replacePathInField,\n titleCase\n} from './util';\nimport {isSignalRef} from './vega.schema';\n\nexport type PrimitiveValue = number | string | boolean | null;\n\nexport type Value = PrimitiveValue | number[] | Gradient | Text | SignalRef;\n\n/**\n * Definition object for a constant value (primitive value or gradient definition) of an encoding channel.\n */\nexport interface ValueDef {\n /**\n * A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).\n */\n value: V;\n}\n\nexport type PositionValueDef = ValueDef;\n\nexport type NumericValueDef = ValueDef;\n\n/**\n * A ValueDef with Condition where either the condition or the value are optional.\n * {\n * condition: {field: ...} | {value: ...},\n * value: ...,\n * }\n */\n\n/**\n * @minProperties 1\n */\nexport type ValueDefWithCondition | DatumDef, V extends Value = Value> = Partial<\n ValueDef\n> & {\n /**\n * A field definition or one or more value definition(s) with a selection predicate.\n */\n condition?: Conditional | Conditional> | Conditional>[];\n};\n\nexport type StringValueDefWithCondition = ValueDefWithCondition<\n MarkPropFieldOrDatumDef,\n string | null\n>;\nexport type TypeForShape = 'nominal' | 'ordinal' | 'geojson';\n\nexport type Conditional | DatumDef | ValueDef | SignalRef> =\n | ConditionalPredicate\n | ConditionalSelection;\n\nexport type ConditionalPredicate | DatumDef | ValueDef | SignalRef> = {\n /**\n * Predicate for triggering the condition\n */\n test: LogicalComposition;\n} & CD;\n\nexport type ConditionalSelection | DatumDef | ValueDef | SignalRef> = {\n /**\n * A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose).\n */\n selection: LogicalComposition;\n} & CD;\n\nexport function isConditionalSelection(c: Conditional): c is ConditionalSelection {\n return c['selection'];\n}\n\nexport interface ConditionValueDefMixins {\n /**\n * One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n *\n * __Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\n * since Vega-Lite only allows at most one encoded field per encoding channel.\n */\n condition?: Conditional> | Conditional>[];\n}\n\n/**\n * A FieldDef with Condition\n * {\n * condition: {value: ...},\n * field: ...,\n * ...\n * }\n */\n\nexport type FieldOrDatumDefWithCondition | DatumDef, V extends Value = Value> = F &\n ConditionValueDefMixins;\n\nexport type MarkPropDef =\n | FieldOrDatumDefWithCondition, V>\n | FieldOrDatumDefWithCondition, V>\n | ValueDefWithCondition, V>;\n\nexport type ColorDef = MarkPropDef;\nexport type NumericMarkPropDef = MarkPropDef;\n\nexport type NumericArrayMarkPropDef = MarkPropDef;\n\nexport type ShapeDef = MarkPropDef;\n\nexport type StringFieldDefWithCondition = FieldOrDatumDefWithCondition, string>;\nexport type TextDef =\n | FieldOrDatumDefWithCondition, Text>\n | FieldOrDatumDefWithCondition, Text>\n | ValueDefWithCondition, Text>;\n\n/**\n * A ValueDef with optional Condition\n * {\n * condition: {field: ...} | {value: ...},\n * value: ...,\n * }\n */\n\n/**\n * Reference to a repeated value.\n */\nexport interface RepeatRef {\n repeat: 'row' | 'column' | 'repeat' | 'layer';\n}\n\nexport type FieldName = string;\nexport type Field = FieldName | RepeatRef;\n\nexport function isRepeatRef(field: Field | any): field is RepeatRef {\n return field && !isString(field) && 'repeat' in field;\n}\n\n/** @@hidden */\nexport type HiddenCompositeAggregate = CompositeAggregate;\n\nexport interface FieldDefBase extends BandMixins {\n /**\n * __Required.__ A string defining the name of the field from which to pull a data value\n * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n *\n * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n *\n * __Notes:__\n * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\n * If field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\n * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n * 2) `field` is not required if `aggregate` is `count`.\n */\n field?: F;\n\n // function\n\n /**\n * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\n * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n *\n * __Default value:__ `undefined` (None)\n *\n * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation.\n */\n timeUnit?: TimeUnit | TimeUnitParams;\n\n /**\n * Aggregation function for the field\n * (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n *\n * __Default value:__ `undefined` (None)\n *\n * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation.\n */\n aggregate?: Aggregate | HiddenCompositeAggregate;\n\n /**\n * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n *\n * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n *\n * - If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n *\n * __Default value:__ `false`\n *\n * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.\n */\n bin?: B;\n}\n\nexport function toFieldDefBase(fieldDef: FieldDef): FieldDefBase {\n const {field, timeUnit, bin, aggregate} = fieldDef;\n return {\n ...(timeUnit ? {timeUnit} : {}),\n ...(bin ? {bin} : {}),\n ...(aggregate ? {aggregate} : {}),\n field\n };\n}\n\nexport interface TypeMixins {\n /**\n * The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\n * It can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n *\n * Since Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\n * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n *\n * __Default value:__\n *\n * 1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n * - `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n * - `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n * - `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n *\n * 2) For a constant value in data domain (`datum`):\n * - `\"quantitative\"` if the datum is a number\n * - `\"nominal\"` if the datum is a string\n * - `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n *\n * __Note:__\n * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n * - Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n *\n * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation.\n */\n type?: T;\n}\n\n/**\n * Definition object for a data field, its type and transformation of an encoding channel.\n */\nexport type TypedFieldDef<\n F extends Field,\n T extends Type = any,\n B extends Bin = boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types\n> = FieldDefBase & TitleMixins & TypeMixins;\n\nexport interface SortableFieldDef<\n F extends Field,\n T extends Type = StandardType,\n B extends Bin = boolean | BinParams | null\n> extends TypedFieldDef {\n /**\n * Sort order for the encoded field.\n *\n * For continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n *\n * For discrete fields, `sort` can be one of the following:\n * - `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n * - [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n * - `null` indicating no sort.\n *\n * __Default value:__ `\"ascending\"`\n *\n * __Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n *\n * __See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation.\n */\n sort?: Sort;\n}\n\nexport function isSortableFieldDef(fieldDef: FieldDef): fieldDef is SortableFieldDef {\n return 'sort' in fieldDef;\n}\n\nexport type ScaleFieldDef<\n F extends Field,\n T extends Type = StandardType,\n B extends Bin = boolean | BinParams | null\n> = SortableFieldDef & ScaleMixins;\n\nexport interface ScaleMixins {\n /**\n * An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n *\n * If `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n *\n * __Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n *\n * __See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation.\n */\n scale?: Scale | null;\n}\n\nexport interface DatumDef<\n F extends Field = string,\n V extends PrimitiveValue | DateTime | SignalRef = PrimitiveValue | DateTime | SignalRef\n> extends Partial>, BandMixins {\n /**\n * A constant value in data domain.\n */\n datum?: F extends RepeatRef ? V | RepeatRef : V;\n // only apply Repeatref if field (F) can be RepeatRef\n // FIXME(https://github.com/microsoft/TypeScript/issues/37586):\n // `F extends RepeatRef` probably should be `RepeatRef extends F` but there is likely a bug in TS.\n}\n\nexport type StringDatumDef = DatumDef & FormatMixins;\n\nexport type ScaleDatumDef = ScaleMixins & DatumDef;\n\n/**\n * A field definition of a secondary channel that shares a scale with another primary channel. For example, `x2`, `xError` and `xError2` share the same scale with `x`.\n */\nexport type SecondaryFieldDef = FieldDefBase & TitleMixins; // x2/y2 shouldn't have bin, but we keep bin property for simplicity of the codebase.\n\nexport type Position2Def = SecondaryFieldDef | DatumDef | PositionValueDef;\n\nexport type SecondaryChannelDef = Encoding['x2' | 'y2'];\n\n/**\n * Field Def without scale (and without bin: \"binned\" support).\n */\nexport type FieldDefWithoutScale = TypedFieldDef;\n\nexport type LatLongFieldDef = FieldDefBase &\n TitleMixins &\n Partial>; // Lat long shouldn't have bin, but we keep bin property for simplicity of the codebase.\n\nexport type LatLongDef = LatLongFieldDef | DatumDef | NumericValueDef;\n\nexport type PositionFieldDefBase = ScaleFieldDef<\n F,\n StandardType,\n boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types\n> &\n PositionBaseMixins;\n\nexport type PositionDatumDefBase = ScaleDatumDef & PositionBaseMixins;\n\nexport interface PositionBaseMixins {\n /**\n * Type of stacking offset if the field should be stacked.\n * `stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\n * For example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n *\n * `stack` can be one of the following values:\n * - `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n * - `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n * -`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n * - `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n *\n * __Default value:__ `zero` for plots with all of the following conditions are true:\n * (1) the mark is `bar`, `area`, or `arc`;\n * (2) the stacked measure channel (x or y) has a linear scale;\n * (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n *\n * __See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation.\n */\n stack?: StackOffset | null | boolean;\n}\n\nexport interface BandMixins {\n /**\n * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n *\n * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.\n *\n * @minimum 0\n * @maximum 1\n */\n band?: number;\n}\n\nexport type PositionFieldDef = PositionFieldDefBase & PositionMixins;\n\nexport type PositionDatumDef = PositionDatumDefBase & PositionMixins;\n\nexport type PositionDef = PositionFieldDef | PositionDatumDef | PositionValueDef;\n\nexport interface PositionMixins {\n /**\n * An object defining properties of axis's gridlines, ticks and labels.\n * If `null`, the axis for the encoding channel will be removed.\n *\n * __Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n *\n * __See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation.\n */\n axis?: Axis | null;\n\n /**\n * An object defining the properties of the Impute Operation to be applied.\n * The field value of the other positional channel is taken as `key` of the `Impute` Operation.\n * The field of the `color` channel if specified is used as `groupby` of the `Impute` Operation.\n *\n * __See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation.\n */\n impute?: ImputeParams | null;\n}\n\nexport type PolarDef = PositionFieldDefBase | PositionDatumDefBase | PositionValueDef;\n\nexport function getBand({\n channel,\n fieldDef,\n fieldDef2,\n markDef: mark,\n stack,\n config,\n isMidPoint\n}: {\n isMidPoint?: boolean;\n channel: Channel;\n fieldDef: FieldDef | DatumDef;\n fieldDef2?: SecondaryChannelDef;\n stack: StackProperties;\n markDef: MarkDef;\n config: Config;\n}): number {\n if (isFieldOrDatumDef(fieldDef) && fieldDef.band !== undefined) {\n return fieldDef.band;\n }\n if (isFieldDef(fieldDef)) {\n const {timeUnit, bin} = fieldDef;\n\n if (timeUnit && !fieldDef2) {\n if (isMidPoint) {\n return getMarkConfig('timeUnitBandPosition', mark, config);\n } else {\n return isRectBasedMark(mark.type) ? getMarkConfig('timeUnitBand', mark, config) : 0;\n }\n } else if (isBinning(bin)) {\n return isRectBasedMark(mark.type) && !isMidPoint ? 1 : 0.5;\n }\n }\n if (stack?.fieldChannel === channel && isMidPoint) {\n return 0.5;\n }\n return undefined;\n}\n\nexport function hasBand(\n channel: Channel,\n fieldDef: FieldDef,\n fieldDef2: SecondaryChannelDef,\n stack: StackProperties,\n markDef: MarkDef,\n config: Config\n): boolean {\n if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) {\n return !!getBand({channel, fieldDef, fieldDef2, stack, markDef, config});\n }\n return false;\n}\n\n/**\n * Field definition of a mark property, which can contain a legend.\n */\nexport type MarkPropFieldDef = ScaleFieldDef &\n LegendMixins;\n\nexport type MarkPropDatumDef = LegendMixins & ScaleDatumDef;\n\nexport type MarkPropFieldOrDatumDef =\n | MarkPropFieldDef\n | MarkPropDatumDef;\n\nexport interface LegendMixins {\n /**\n * An object defining properties of the legend.\n * If `null`, the legend for the encoding channel will be removed.\n *\n * __Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n *\n * __See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation.\n */\n legend?: Legend | null;\n}\n\n// Detail\n\n// Order Path have no scale\n\nexport interface OrderFieldDef extends FieldDefWithoutScale {\n /**\n * The sort order. One of `\"ascending\"` (default) or `\"descending\"`.\n */\n sort?: SortOrder;\n}\n\nexport type OrderValueDef = ConditionValueDefMixins & NumericValueDef;\n\nexport interface StringFieldDef extends FieldDefWithoutScale, FormatMixins {}\n\nexport type FieldDef = SecondaryFieldDef | TypedFieldDef;\nexport type ChannelDef = Encoding[keyof Encoding];\n\nexport function isConditionalDef | GuideEncodingConditionalValueDef | SignalRef>(\n channelDef: CD\n): channelDef is CD & {condition: Conditional} {\n return !!channelDef && 'condition' in channelDef;\n}\n\n/**\n * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef\n */\nexport function hasConditionalFieldDef(\n channelDef: Partial>\n): channelDef is {condition: Conditional>} {\n const condition = channelDef && channelDef['condition'];\n return !!condition && !isArray(condition) && isFieldDef(condition);\n}\n\nexport function hasConditionalFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is {condition: Conditional>} {\n const condition = channelDef && channelDef['condition'];\n return !!condition && !isArray(condition) && isFieldOrDatumDef(condition);\n}\n\nexport function hasConditionalValueDef(\n channelDef: ChannelDef\n): channelDef is ValueDef & {condition: Conditional> | Conditional>[]} {\n const condition = channelDef && channelDef['condition'];\n return !!condition && (isArray(condition) || isValueDef(condition));\n}\n\nexport function isFieldDef(\n channelDef: Partial> | FieldDefBase | DatumDef\n): channelDef is FieldDefBase | TypedFieldDef | SecondaryFieldDef {\n // TODO: we can't use field in channelDef here as it's somehow failing runtime test\n return !!channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count');\n}\n\nexport function channelDefType(channelDef: ChannelDef): Type | undefined {\n return channelDef && channelDef['type'];\n}\n\nexport function isDatumDef(\n channelDef: Partial> | FieldDefBase | DatumDef\n): channelDef is DatumDef {\n return !!channelDef && 'datum' in channelDef;\n}\n\nexport function isContinuousFieldOrDatumDef(\n cd: ChannelDef\n): cd is TypedFieldDef | DatumDef {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && isContinuous(cd)) || isNumericDataDef(cd);\n}\n\nexport function isQuantitativeFieldOrDatumDef(cd: ChannelDef) {\n // TODO: make datum support DateTime object\n return channelDefType(cd) === 'quantitative' || isNumericDataDef(cd);\n}\n\nexport function isNumericDataDef(cd: ChannelDef): cd is DatumDef {\n return isDatumDef(cd) && isNumber(cd.datum);\n}\n\nexport function isFieldOrDatumDef(\n channelDef: Partial>\n): channelDef is FieldDef | DatumDef {\n return isFieldDef(channelDef) || isDatumDef(channelDef);\n}\n\nexport function isTypedFieldDef(channelDef: ChannelDef): channelDef is TypedFieldDef {\n return !!channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef;\n}\n\nexport function isValueDef(channelDef: Partial>): channelDef is ValueDef {\n return channelDef && 'value' in channelDef && 'value' in channelDef;\n}\n\nexport function isScaleFieldDef(channelDef: ChannelDef): channelDef is ScaleFieldDef {\n return !!channelDef && ('scale' in channelDef || 'sort' in channelDef);\n}\n\nexport function isPositionFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is PositionFieldDef | PositionDatumDef {\n return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef);\n}\n\nexport function isMarkPropFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is MarkPropFieldDef | MarkPropDatumDef {\n return !!channelDef && 'legend' in channelDef;\n}\n\nexport function isStringFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is StringFieldDef | StringDatumDef {\n return !!channelDef && ('format' in channelDef || 'formatType' in channelDef);\n}\n\nexport function toStringFieldDef(fieldDef: FieldDef): StringFieldDef {\n // omit properties that don't exist in string field defs\n return omit(fieldDef, ['legend', 'axis', 'header', 'scale'] as any[]);\n}\n\nexport interface FieldRefOption {\n /** Exclude bin, aggregate, timeUnit */\n nofn?: boolean;\n /** Wrap the field with datum, parent, or datum.datum (e.g., datum['...'] for Vega Expression */\n expr?: 'datum' | 'parent' | 'datum.datum';\n /** Prepend fn with custom function prefix */\n prefix?: string;\n /** Append suffix to the field ref for bin (default='start') */\n binSuffix?: 'end' | 'range' | 'mid';\n /** Append suffix to the field ref (general) */\n suffix?: string;\n /**\n * Use the field name for `as` in a transform.\n * We will not escape nested accesses because Vega transform outputs cannot be nested.\n */\n forAs?: boolean;\n}\n\nfunction isOpFieldDef(\n fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef\n): fieldDef is WindowFieldDef | AggregatedFieldDef {\n return 'op' in fieldDef;\n}\n\n/**\n * Get a Vega field reference from a Vega-Lite field def.\n */\nexport function vgField(\n fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef,\n opt: FieldRefOption = {}\n): string {\n let field = fieldDef.field;\n const prefix = opt.prefix;\n let suffix = opt.suffix;\n\n let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped\n\n if (isCount(fieldDef)) {\n field = internalField('count');\n } else {\n let fn: string;\n\n if (!opt.nofn) {\n if (isOpFieldDef(fieldDef)) {\n fn = fieldDef.op;\n } else {\n const {bin, aggregate, timeUnit} = fieldDef;\n if (isBinning(bin)) {\n fn = binToString(bin);\n suffix = (opt.binSuffix ?? '') + (opt.suffix ?? '');\n } else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmax_${aggregate.argmax}`;\n } else if (isArgminDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmin_${aggregate.argmin}`;\n } else {\n fn = String(aggregate);\n }\n } else if (timeUnit) {\n fn = timeUnitToString(timeUnit);\n suffix = ((!contains(['range', 'mid'], opt.binSuffix) && opt.binSuffix) || '') + (opt.suffix ?? '');\n }\n }\n }\n\n if (fn) {\n field = field ? `${fn}_${field}` : fn;\n }\n }\n\n if (suffix) {\n field = `${field}_${suffix}`;\n }\n\n if (prefix) {\n field = `${prefix}_${field}`;\n }\n\n if (opt.forAs) {\n return removePathFromField(field);\n } else if (opt.expr) {\n // Expression to access flattened field. No need to escape dots.\n return flatAccessWithDatum(field, opt.expr) + argAccessor;\n } else {\n // We flattened all fields so paths should have become dot.\n return replacePathInField(field) + argAccessor;\n }\n}\n\nexport function isDiscrete(def: TypedFieldDef | DatumDef) {\n switch (def.type) {\n case 'nominal':\n case 'ordinal':\n case 'geojson':\n return true;\n case 'quantitative':\n return isFieldDef(def) && !!def.bin;\n case 'temporal':\n return false;\n }\n throw new Error(log.message.invalidFieldType(def.type));\n}\n\nexport function isContinuous(fieldDef: TypedFieldDef) {\n return !isDiscrete(fieldDef);\n}\n\nexport function isCount(fieldDef: FieldDefBase) {\n return fieldDef.aggregate === 'count';\n}\n\nexport type FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => string;\n\nexport function verbalTitleFormatter(fieldDef: FieldDefBase, config: Config) {\n const {field, bin, timeUnit, aggregate} = fieldDef;\n if (aggregate === 'count') {\n return config.countTitle;\n } else if (isBinning(bin)) {\n return `${field} (binned)`;\n } else if (timeUnit) {\n const unit = normalizeTimeUnit(timeUnit)?.unit;\n if (unit) {\n return `${field} (${getTimeUnitParts(unit).join('-')})`;\n }\n } else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n return `${field} for max ${aggregate.argmax}`;\n } else if (isArgminDef(aggregate)) {\n return `${field} for min ${aggregate.argmin}`;\n } else {\n return `${titleCase(aggregate)} of ${field}`;\n }\n }\n return field;\n}\n\nexport function functionalTitleFormatter(fieldDef: FieldDefBase) {\n const {aggregate, bin, timeUnit, field} = fieldDef;\n if (isArgmaxDef(aggregate)) {\n return `${field} for argmax(${aggregate.argmax})`;\n } else if (isArgminDef(aggregate)) {\n return `${field} for argmin(${aggregate.argmin})`;\n }\n\n const timeUnitParams = normalizeTimeUnit(timeUnit);\n\n const fn = aggregate || timeUnitParams?.unit || (timeUnitParams?.maxbins && 'timeunit') || (isBinning(bin) && 'bin');\n if (fn) {\n return fn.toUpperCase() + '(' + field + ')';\n } else {\n return field;\n }\n}\n\nexport const defaultTitleFormatter: FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => {\n switch (config.fieldTitle) {\n case 'plain':\n return fieldDef.field;\n case 'functional':\n return functionalTitleFormatter(fieldDef);\n default:\n return verbalTitleFormatter(fieldDef, config);\n }\n};\n\nlet titleFormatter = defaultTitleFormatter;\n\nexport function setTitleFormatter(formatter: FieldTitleFormatter) {\n titleFormatter = formatter;\n}\n\nexport function resetTitleFormatter() {\n setTitleFormatter(defaultTitleFormatter);\n}\n\nexport function title(\n fieldOrDatumDef: TypedFieldDef | SecondaryFieldDef | DatumDef,\n config: Config,\n {allowDisabling, includeDefault = true}: {allowDisabling: boolean; includeDefault?: boolean}\n) {\n const guideTitle = getGuide(fieldOrDatumDef)?.title;\n\n if (!isFieldDef(fieldOrDatumDef)) {\n return guideTitle;\n }\n const fieldDef = fieldOrDatumDef;\n\n const def = includeDefault ? defaultTitle(fieldDef, config) : undefined;\n\n if (allowDisabling) {\n return getFirstDefined(guideTitle, fieldDef.title, def);\n } else {\n return guideTitle ?? fieldDef.title ?? def;\n }\n}\n\nexport function getGuide(fieldDef: TypedFieldDef | SecondaryFieldDef | DatumDef): Guide {\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) {\n return fieldDef.axis;\n } else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) {\n return fieldDef.legend;\n } else if (isFacetFieldDef(fieldDef) && fieldDef.header) {\n return fieldDef.header;\n }\n return undefined;\n}\n\nexport function defaultTitle(fieldDef: FieldDefBase, config: Config) {\n return titleFormatter(fieldDef, config);\n}\n\nexport function getFormatMixins(fieldDef: TypedFieldDef | DatumDef) {\n if (isStringFieldOrDatumDef(fieldDef)) {\n const {format, formatType} = fieldDef;\n return {format, formatType};\n } else {\n const guide = getGuide(fieldDef) ?? {};\n const {format, formatType} = guide;\n return {format, formatType};\n }\n}\n\nexport function defaultType>(fieldDef: T, channel: ExtendedChannel): Type {\n switch (channel) {\n case 'latitude':\n case 'longitude':\n return 'quantitative';\n\n case 'row':\n case 'column':\n case 'facet':\n case 'shape':\n case 'strokeDash':\n return 'nominal';\n }\n\n if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) {\n return 'ordinal';\n }\n\n const {aggregate, bin, timeUnit} = fieldDef;\n if (timeUnit) {\n return 'temporal';\n }\n\n if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) {\n return 'quantitative';\n }\n\n if (isScaleFieldDef(fieldDef) && fieldDef.scale?.type) {\n switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) {\n case 'numeric':\n case 'discretizing':\n return 'quantitative';\n case 'time':\n return 'temporal';\n }\n }\n\n return 'nominal';\n}\n\n/**\n * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef.\n * @param channelDef\n */\n\nexport function getFieldDef(channelDef: ChannelDef): FieldDef {\n if (isFieldDef(channelDef)) {\n return channelDef;\n } else if (hasConditionalFieldDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n\nexport function getFieldOrDatumDef = ChannelDef>(\n channelDef: CD\n): FieldDef | DatumDef {\n if (isFieldOrDatumDef(channelDef)) {\n return channelDef;\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n\n/**\n * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.\n */\nexport function initChannelDef(\n channelDef: ChannelDef,\n channel: ExtendedChannel,\n config: Config,\n opt: {compositeMark?: boolean} = {}\n): ChannelDef {\n if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) {\n const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean';\n log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef));\n return {value: channelDef} as ValueDef;\n }\n\n // If a fieldDef contains a field, we need type.\n if (isFieldOrDatumDef(channelDef)) {\n return initFieldOrDatumDef(channelDef, channel, config, opt);\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return {\n ...channelDef,\n // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition\n condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) as Conditional>\n };\n }\n return channelDef;\n}\n\nexport function initFieldOrDatumDef(\n fd: FieldDef | DatumDef,\n channel: ExtendedChannel,\n config: Config,\n opt: {compositeMark?: boolean}\n): FieldDef | DatumDef {\n if (isStringFieldOrDatumDef(fd)) {\n const {format, formatType, ...rest} = fd;\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef(rest, channel, config, opt);\n }\n } else {\n const guideType = isPositionFieldOrDatumDef(fd)\n ? 'axis'\n : isMarkPropFieldOrDatumDef(fd)\n ? 'legend'\n : isFacetFieldDef(fd)\n ? 'header'\n : null;\n if (guideType && fd[guideType]) {\n const {format, formatType, ...newGuide} = fd[guideType];\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef({...fd, [guideType]: newGuide}, channel, config, opt);\n }\n }\n }\n\n if (isFieldDef(fd)) {\n return initFieldDef(fd, channel, opt);\n }\n return initDatumDef(fd);\n}\n\nfunction initDatumDef(datumDef: DatumDef): DatumDef {\n let type = datumDef['type'];\n if (type) {\n return datumDef;\n }\n const {datum} = datumDef;\n type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined;\n\n return {...datumDef, type};\n}\n\nexport function initFieldDef(\n fd: FieldDef,\n channel: ExtendedChannel,\n {compositeMark = false}: {compositeMark?: boolean} = {}\n) {\n const {aggregate, timeUnit, bin, field} = fd;\n const fieldDef = {...fd};\n\n // Drop invalid aggregate\n if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) {\n log.warn(log.message.invalidAggregate(aggregate));\n delete fieldDef.aggregate;\n }\n\n // Normalize Time Unit\n if (timeUnit) {\n fieldDef.timeUnit = normalizeTimeUnit(timeUnit);\n }\n\n if (field) {\n fieldDef.field = `${field}`;\n }\n\n // Normalize bin\n if (isBinning(bin)) {\n fieldDef.bin = normalizeBin(bin, channel);\n }\n\n if (isBinned(bin) && !isXorY(channel)) {\n log.warn(log.message.channelShouldNotBeUsedForBinned(channel));\n }\n\n // Normalize Type\n if (isTypedFieldDef(fieldDef)) {\n const {type} = fieldDef;\n const fullType = getFullName(type);\n if (type !== fullType) {\n // convert short type to full type\n fieldDef.type = fullType;\n }\n if (type !== 'quantitative') {\n if (isCountingAggregateOp(aggregate)) {\n log.warn(log.message.invalidFieldTypeForCountAggregate(type, aggregate));\n fieldDef.type = 'quantitative';\n }\n }\n } else if (!isSecondaryRangeChannel(channel)) {\n // If type is empty / invalid, then augment with default type\n const newType = defaultType(fieldDef as TypedFieldDef, channel);\n fieldDef['type'] = newType;\n }\n\n if (isTypedFieldDef(fieldDef)) {\n const {compatible, warning} = channelCompatibility(fieldDef, channel) || {};\n if (compatible === false) {\n log.warn(warning);\n }\n }\n\n if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) {\n const {sort} = fieldDef;\n if (isSortByChannel(sort)) {\n return {\n ...fieldDef,\n sort: {encoding: sort}\n };\n }\n const sub = sort.substr(1);\n if (sort.charAt(0) === '-' && isSortByChannel(sub)) {\n return {\n ...fieldDef,\n sort: {encoding: sub, order: 'descending'}\n };\n }\n }\n\n if (isFacetFieldDef(fieldDef)) {\n const {header} = fieldDef;\n const {orient, ...rest} = header;\n if (orient) {\n return {\n ...fieldDef,\n header: {\n ...rest,\n labelOrient: header.labelOrient || orient,\n titleOrient: header.titleOrient || orient\n }\n };\n }\n }\n\n return fieldDef;\n}\n\nexport function normalizeBin(bin: BinParams | boolean | 'binned', channel?: ExtendedChannel) {\n if (isBoolean(bin)) {\n return {maxbins: autoMaxBins(channel)};\n } else if (bin === 'binned') {\n return {\n binned: true\n };\n } else if (!bin.maxbins && !bin.step) {\n return {...bin, maxbins: autoMaxBins(channel)};\n } else {\n return bin;\n }\n}\n\nconst COMPATIBLE = {compatible: true};\nexport function channelCompatibility(\n fieldDef: TypedFieldDef,\n channel: ExtendedChannel\n): {compatible: boolean; warning?: string} {\n const type = fieldDef.type;\n\n if (type === 'geojson' && channel !== 'shape') {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with a geojson data.`\n };\n }\n\n switch (channel) {\n case ROW:\n case COLUMN:\n case FACET:\n if (isContinuous(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.facetChannelShouldBeDiscrete(channel)\n };\n }\n return COMPATIBLE;\n\n case X:\n case Y:\n case COLOR:\n case FILL:\n case STROKE:\n case TEXT:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case URL:\n case ANGLE:\n case THETA:\n case RADIUS:\n case DESCRIPTION:\n return COMPATIBLE;\n\n case LONGITUDE:\n case LONGITUDE2:\n case LATITUDE:\n case LATITUDE2:\n if (type !== QUANTITATIVE) {\n return {\n compatible: false,\n warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.`\n };\n }\n return COMPATIBLE;\n\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n case SIZE:\n case THETA2:\n case RADIUS2:\n case X2:\n case Y2:\n if (type === 'nominal' && !fieldDef['sort']) {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with an unsorted discrete field.`\n };\n }\n return COMPATIBLE;\n\n case STROKEDASH:\n if (!contains(['ordinal', 'nominal'], fieldDef.type)) {\n return {\n compatible: false,\n warning: 'StrokeDash channel should be used with only discrete data.'\n };\n }\n return COMPATIBLE;\n\n case SHAPE:\n if (!contains(['ordinal', 'nominal', 'geojson'], fieldDef.type)) {\n return {\n compatible: false,\n warning: 'Shape channel should be used with only either discrete or geojson data.'\n };\n }\n return COMPATIBLE;\n\n case ORDER:\n if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) {\n return {\n compatible: false,\n warning: `Channel order is inappropriate for nominal field, which has no inherent order.`\n };\n }\n return COMPATIBLE;\n }\n}\n\n/**\n * Check if the field def uses a time format or does not use any format but is temporal\n * (this does not cover field defs that are temporal but use a number format).\n */\nexport function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef: FieldDef | DatumDef): boolean {\n const {formatType} = getFormatMixins(fieldOrDatumDef);\n return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef));\n}\n\n/**\n * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`.\n */\nexport function isTimeFieldDef(def: FieldDef | DatumDef): boolean {\n return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit));\n}\n\n/**\n * Getting a value associated with a fielddef.\n * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit)\n */\nexport function valueExpr(\n v: number | string | boolean | DateTime | SignalRef | number[],\n {\n timeUnit,\n type,\n wrapTime,\n undefinedIfExprNotRequired\n }: {\n timeUnit: TimeUnit | TimeUnitParams;\n type?: Type;\n wrapTime?: boolean;\n undefinedIfExprNotRequired?: boolean;\n }\n): string {\n const unit = timeUnit && normalizeTimeUnit(timeUnit)?.unit;\n let isTime = unit || type === 'temporal';\n\n let expr;\n if (isSignalRef(v)) {\n expr = v.signal;\n } else if (isDateTime(v)) {\n isTime = true;\n expr = dateTimeToExpr(v);\n } else if (isString(v) || isNumber(v)) {\n if (isTime) {\n expr = `datetime(${JSON.stringify(v)})`;\n\n if (isLocalSingleTimeUnit(unit)) {\n // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit\n if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) {\n expr = dateTimeToExpr({[unit]: v});\n }\n }\n }\n }\n if (expr) {\n return wrapTime && isTime ? `time(${expr})` : expr;\n }\n // number or boolean or normal string\n return undefinedIfExprNotRequired ? undefined : JSON.stringify(v);\n}\n\n/**\n * Standardize value array -- convert each value to Vega expression if applicable\n */\nexport function valueArray(\n fieldOrDatumDef: TypedFieldDef | DatumDef,\n values: (number | string | boolean | DateTime)[]\n) {\n const {type} = fieldOrDatumDef;\n return values.map(v => {\n const expr = valueExpr(v, {\n timeUnit: isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.timeUnit : undefined,\n type,\n undefinedIfExprNotRequired: true\n });\n // return signal for the expression if we need an expression\n if (expr !== undefined) {\n return {signal: expr};\n }\n // otherwise just return the original value\n return v;\n });\n}\n\n/**\n * Checks whether a fieldDef for a particular channel requires a computed bin range.\n */\nexport function binRequiresRange(fieldDef: FieldDef, channel: Channel): boolean {\n if (!isBinning(fieldDef.bin)) {\n console.warn('Only call this method for binned field defs.');\n return false;\n }\n\n // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels.\n // We could check whether the axis or legend exists (not disabled) but that seems overkill.\n return isScaleChannel(channel) && contains(['ordinal', 'nominal'], (fieldDef as ScaleFieldDef).type);\n}\n","import {BaseTitle, Text, TextEncodeEntry, TitleAnchor} from 'vega';\nimport {isArray, isString} from 'vega-util';\nimport {MarkConfig} from './mark';\nimport {pick} from './util';\nimport {ExcludeMappedValueRef, ExcludeMappedValueRefButKeepSignal} from './vega.schema';\n\nexport type BaseTitleNoValueRefs = ExcludeMappedValueRefButKeepSignal> &\n // Since some logic depends on align/baseline, Vega-Lite does NOT allow signal for them.\n ExcludeMappedValueRef>;\n\nexport type TitleConfig = BaseTitleNoValueRefs;\n\nexport interface TitleBase extends BaseTitleNoValueRefs {\n /**\n * The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.\n *\n * __Default value:__ `\"middle\"` for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views.\n * `\"start\"` for other composite views.\n *\n * __Note:__ [For now](https://github.com/vega/vega-lite/issues/2875), `anchor` is only customizable only for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. For other composite views, `anchor` is always `\"start\"`.\n */\n anchor?: TitleAnchor;\n\n /**\n * A [mark style property](https://vega.github.io/vega-lite/docs/config.html#style) to apply to the title text mark.\n *\n * __Default value:__ `\"group-title\"`.\n */\n style?: string | string[];\n\n /**\n * \tThe integer z-index indicating the layering of the title group relative to other axis, mark and legend groups.\n *\n * __Default value:__ `0`.\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n\n /**\n * Mark definitions for custom encoding.\n *\n * @hidden\n */\n encoding?: TextEncodeEntry;\n}\n\nexport interface TitleParams extends TitleBase {\n /**\n * The title text.\n */\n text: Text;\n\n /**\n * The subtitle Text.\n */\n subtitle?: Text;\n}\n\nexport function extractTitleConfig(\n titleConfig: TitleConfig\n): {\n titleMarkConfig: MarkConfig;\n subtitleMarkConfig: MarkConfig;\n nonMark: BaseTitleNoValueRefs;\n subtitle: BaseTitleNoValueRefs;\n} {\n const {\n // These are non-mark title config that need to be hardcoded\n anchor,\n frame,\n offset,\n orient,\n\n // color needs to be redirect to fill\n color,\n\n // subtitle properties\n subtitleColor,\n subtitleFont,\n subtitleFontSize,\n subtitleFontStyle,\n subtitleFontWeight,\n subtitleLineHeight,\n subtitlePadding,\n\n // The rest are mark config.\n ...rest\n } = titleConfig;\n\n const titleMarkConfig: MarkConfig = {\n ...rest,\n ...(color ? {fill: color} : {})\n };\n\n // These are non-mark title config that need to be hardcoded\n const nonMark: BaseTitleNoValueRefs = {\n ...(anchor ? {anchor} : {}),\n ...(frame ? {frame} : {}),\n ...(offset ? {offset} : {}),\n ...(orient ? {orient} : {})\n };\n\n // subtitle part can stay in config.title since header titles do not use subtitle\n const subtitle: BaseTitleNoValueRefs = {\n ...(subtitleColor ? {subtitleColor} : {}),\n ...(subtitleFont ? {subtitleFont} : {}),\n ...(subtitleFontSize ? {subtitleFontSize} : {}),\n ...(subtitleFontStyle ? {subtitleFontStyle} : {}),\n ...(subtitleFontWeight ? {subtitleFontWeight} : {}),\n ...(subtitleLineHeight ? {subtitleLineHeight} : {}),\n ...(subtitlePadding ? {subtitlePadding} : {})\n };\n\n const subtitleMarkConfig = pick(titleMarkConfig, ['align', 'baseline', 'dx', 'dy', 'limit']);\n\n return {titleMarkConfig, subtitleMarkConfig, nonMark, subtitle};\n}\n\nexport function isText(v: any): v is Text {\n return isString(v) || (isArray(v) && isString(v[0]));\n}\n","import {SignalRef, Text} from 'vega';\nimport {array, stringValue} from 'vega-util';\nimport {AxisConfig} from '../axis';\nimport {FieldDefBase, FieldRefOption, OrderFieldDef, vgField} from '../channeldef';\nimport {Config, StyleConfigIndex} from '../config';\nimport {MarkConfig, MarkDef} from '../mark';\nimport {SortFields} from '../sort';\nimport {isText} from '../title';\nimport {deepEqual, getFirstDefined} from '../util';\nimport {isSignalRef, VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../vega.schema';\nimport {AxisComponentProps} from './axis/component';\nimport {Explicit} from './split';\nimport {UnitModel} from './unit';\n\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\n\nexport function signalOrValueRef(value: T | SignalRef): {value: T} | SignalRef {\n if (isSignalRef(value)) {\n return value;\n }\n return value !== undefined ? {value} : undefined;\n}\n\nexport function exprFromValueOrSignalRef(ref: VgValueRef | SignalRef): string {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref.value);\n}\n\nexport function signalOrStringValue(v: SignalRef | any) {\n if (isSignalRef(v)) {\n return v.signal;\n }\n return v == null ? null : stringValue(v);\n}\n\nexport function applyMarkConfig(e: VgEncodeEntry, model: UnitModel, propsList: (keyof MarkConfig)[]) {\n for (const property of propsList) {\n const value = getMarkConfig(property, model.markDef, model.config);\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n return e;\n}\n\nexport function getStyles(mark: MarkDef): string[] {\n return [].concat(mark.type, mark.style ?? []);\n}\n\nexport function getMarkPropOrConfig

(\n channel: P,\n mark: MarkDef,\n config: Config,\n opt: {\n vgChannel?: VgEncodeChannel;\n ignoreVgConfig?: boolean;\n } = {}\n): MarkDef[P] {\n const {vgChannel, ignoreVgConfig} = opt;\n if (vgChannel && mark[vgChannel] !== undefined) {\n return mark[vgChannel];\n } else if (mark[channel] !== undefined) {\n return mark[channel];\n } else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) {\n return undefined;\n }\n\n return getMarkConfig(channel, mark, config, opt);\n}\n\n/**\n * Return property value from style or mark specific config property if exists.\n * Otherwise, return general mark specific config.\n */\nexport function getMarkConfig

(\n channel: P,\n mark: MarkDef,\n config: Config,\n {vgChannel}: {vgChannel?: VgEncodeChannel} = {}\n): MarkDef[P] {\n return getFirstDefined(\n // style config has highest precedence\n vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined,\n getMarkStyleConfig(channel, mark, config.style),\n // then mark-specific config\n vgChannel ? config[mark.type][vgChannel] : undefined,\n\n config[mark.type][channel as any], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine\n\n // If there is vgChannel, skip vl channel.\n // For example, vl size for text is vg fontSize, but config.mark.size is only for point size.\n vgChannel ? config.mark[vgChannel] : config.mark[channel as any] // Need to cast for the same reason as above\n );\n}\n\nexport function getMarkStyleConfig

(\n prop: P,\n mark: MarkDef,\n styleConfigIndex: StyleConfigIndex\n) {\n return getStyleConfig(prop, getStyles(mark), styleConfigIndex);\n}\n\nexport function getStyleConfig

(\n p: P,\n styles: string | string[],\n styleConfigIndex: StyleConfigIndex\n) {\n styles = array(styles);\n let value;\n for (const style of styles) {\n const styleConfig = styleConfigIndex[style];\n\n if (styleConfig && styleConfig[p as string] !== undefined) {\n value = styleConfig[p as string];\n }\n }\n return value;\n}\n\n/**\n * Return Vega sort parameters (tuple of field and order).\n */\nexport function sortParams(\n orderDef: OrderFieldDef | OrderFieldDef[],\n fieldRefOption?: FieldRefOption\n): SortFields {\n return array(orderDef).reduce(\n (s, orderChannelDef) => {\n s.field.push(vgField(orderChannelDef, fieldRefOption));\n s.order.push(orderChannelDef.sort ?? 'ascending');\n return s;\n },\n {field: [], order: []}\n );\n}\n\nexport type AxisTitleComponent = AxisComponentProps['title'];\n\nexport function mergeTitleFieldDefs(f1: readonly FieldDefBase[], f2: readonly FieldDefBase[]) {\n const merged = [...f1];\n\n f2.forEach(fdToMerge => {\n for (const fieldDef1 of merged) {\n // If already exists, no need to append to merged array\n if (deepEqual(fieldDef1, fdToMerge)) {\n return;\n }\n }\n merged.push(fdToMerge);\n });\n return merged;\n}\n\nexport function mergeTitle(title1: Text | SignalRef, title2: Text | SignalRef) {\n if (deepEqual(title1, title2) || !title2) {\n // if titles are the same or title2 is falsy\n return title1;\n } else if (!title1) {\n // if title1 is falsy\n return title2;\n } else {\n return [...array(title1), ...array(title2)].join(', ');\n }\n}\n\nexport function mergeTitleComponent(v1: Explicit, v2: Explicit) {\n const v1Val = v1.value;\n const v2Val = v2.value;\n\n if (v1Val == null || v2Val === null) {\n return {\n explicit: v1.explicit,\n value: null\n };\n } else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) {\n return {\n explicit: v1.explicit,\n value: mergeTitle(v1Val, v2Val)\n };\n } else if (isText(v1Val) || isSignalRef(v1Val)) {\n return {\n explicit: v1.explicit,\n value: v1Val\n };\n } else if (isText(v2Val) || isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: v2Val\n };\n } else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: mergeTitleFieldDefs(v1Val, v2Val)\n };\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('It should never reach here');\n}\n","import {AggregateOp} from 'vega';\nimport {array, isArray} from 'vega-util';\nimport {isArgmaxDef, isArgminDef} from './aggregate';\nimport {isBinned, isBinning} from './bin';\nimport {\n ANGLE,\n CHANNELS,\n COLOR,\n DESCRIPTION,\n DETAIL,\n FILL,\n FILLOPACITY,\n HREF,\n isChannel,\n isNonPositionScaleChannel,\n isSecondaryRangeChannel,\n isXorY,\n KEY,\n LATITUDE,\n LATITUDE2,\n LONGITUDE,\n LONGITUDE2,\n OPACITY,\n ORDER,\n RADIUS,\n RADIUS2,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n supportMark,\n TEXT,\n THETA,\n THETA2,\n TOOLTIP,\n URL,\n X,\n X2,\n Y,\n Y2,\n Channel\n} from './channel';\nimport {\n binRequiresRange,\n ChannelDef,\n ColorDef,\n Field,\n FieldDef,\n FieldDefWithoutScale,\n getFieldDef,\n getGuide,\n hasConditionalFieldDef,\n initChannelDef,\n initFieldDef,\n isConditionalDef,\n isDatumDef,\n isFieldDef,\n isTypedFieldDef,\n isValueDef,\n LatLongDef,\n NumericArrayMarkPropDef,\n NumericMarkPropDef,\n OrderFieldDef,\n OrderValueDef,\n PolarDef,\n Position2Def,\n PositionDef,\n SecondaryFieldDef,\n ShapeDef,\n StringFieldDef,\n StringFieldDefWithCondition,\n StringValueDefWithCondition,\n TextDef,\n title,\n TypedFieldDef,\n vgField\n} from './channeldef';\nimport {Config} from './config';\nimport * as log from './log';\nimport {Mark} from './mark';\nimport {EncodingFacetMapping} from './spec/facet';\nimport {AggregatedFieldDef, BinTransform, TimeUnitTransform} from './transform';\nimport {QUANTITATIVE, TEMPORAL} from './type';\nimport {keys, some} from './util';\nimport {isSignalRef} from './vega.schema';\n\nexport interface Encoding {\n /**\n * X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x?: PositionDef;\n\n /**\n * Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y?: PositionDef;\n\n /**\n * X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n // TODO: Ham need to add default behavior\n // `x2` cannot have type as it should have the same type as `x`\n x2?: Position2Def;\n\n /**\n * Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n // TODO: Ham need to add default behavior\n // `y2` cannot have type as it should have the same type as `y`\n y2?: Position2Def;\n\n /**\n * Longitude position of geographically projected marks.\n */\n longitude?: LatLongDef;\n\n /**\n * Latitude position of geographically projected marks.\n */\n latitude?: LatLongDef;\n\n /**\n * Longitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n */\n // `longitude2` cannot have type as it should have the same type as `longitude`\n longitude2?: Position2Def;\n\n /**\n * Latitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n */\n // `latitude2` cannot have type as it should have the same type as `latitude`\n latitude2?: Position2Def;\n\n /**\n * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n *\n * - For text marks, polar coordinate angle in radians.\n */\n theta?: PolarDef;\n\n /**\n * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.\n */\n theta2?: Position2Def;\n\n /**\n * The outer radius in pixels of arc marks.\n */\n\n radius?: PolarDef;\n\n /**\n * The inner radius in pixels of arc marks.\n */\n radius2?: Position2Def;\n\n /**\n * Color of the marks – either fill or stroke color based on the `filled` property of mark definition.\n * By default, `color` represents fill color for `\"area\"`, `\"bar\"`, `\"tick\"`,\n * `\"text\"`, `\"trail\"`, `\"circle\"`, and `\"square\"` / stroke color for `\"line\"` and `\"point\"`.\n *\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_\n * 1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n * 2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme).\n */\n color?: ColorDef;\n\n /**\n * Fill color of the marks.\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n */\n fill?: ColorDef;\n\n /**\n * Stroke color of the marks.\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n */\n\n stroke?: ColorDef;\n\n /**\n * Opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `opacity` property.\n */\n opacity?: NumericMarkPropDef;\n\n /**\n * Fill opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `fillOpacity` property.\n */\n fillOpacity?: NumericMarkPropDef;\n\n /**\n * Stroke opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeOpacity` property.\n */\n strokeOpacity?: NumericMarkPropDef;\n\n /**\n * Stroke width of the marks.\n *\n * __Default value:__ If undefined, the default stroke width depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeWidth` property.\n */\n strokeWidth?: NumericMarkPropDef;\n\n /**\n * Stroke dash of the marks.\n *\n * __Default value:__ `[1,0]` (No dash).\n */\n strokeDash?: NumericArrayMarkPropDef;\n\n /**\n * Size of the mark.\n * - For `\"point\"`, `\"square\"` and `\"circle\"`, – the symbol size, or pixel area of the mark.\n * - For `\"bar\"` and `\"tick\"` – the bar and tick's size.\n * - For `\"text\"` – the text's font size.\n * - Size is unsupported for `\"line\"`, `\"area\"`, and `\"rect\"`. (Use `\"trail\"` instead of line with varying size)\n */\n size?: NumericMarkPropDef;\n\n /**\n * Rotation angle of point and text marks.\n */\n angle?: NumericMarkPropDef;\n\n /**\n * Shape of the mark.\n *\n * 1. For `point` marks the supported values include:\n * - plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n * - the line symbol `\"stroke\"`\n * - centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n * - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n *\n * 2. For `geoshape` marks it should be a field definition of the geojson data\n *\n * __Default value:__ If undefined, the default shape depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#point-config)'s `shape` property. (`\"circle\"` if unset.)\n */\n shape?: ShapeDef;\n /**\n * Additional levels of detail for grouping data in aggregate views and\n * in line, trail, and area marks without mapping data to a specific visual channel.\n */\n detail?: FieldDefWithoutScale | FieldDefWithoutScale[];\n\n /**\n * A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data.\n */\n key?: FieldDefWithoutScale;\n\n /**\n * Text of the `text` mark.\n */\n text?: TextDef;\n\n /**\n * The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n *\n * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n */\n tooltip?: StringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[] | null;\n\n /**\n * A URL to load upon mouse click.\n */\n href?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * The URL of an image mark.\n */\n url?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * A text description of this mark for ARIA accessibility (SVG output only). For SVG output the `\"aria-label\"` attribute will be set to this description.\n */\n description?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * Order of the marks.\n * - For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n * - For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{\"value\": null}` makes the line marks use the original order in the data sources.\n * - Otherwise, this `order` channel encodes layer order of the marks.\n *\n * __Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping.\n */\n order?: OrderFieldDef | OrderFieldDef[] | OrderValueDef;\n}\n\nexport interface EncodingWithFacet extends Encoding, EncodingFacetMapping {}\n\nexport function channelHasField(\n encoding: EncodingWithFacet,\n channel: keyof EncodingWithFacet\n): boolean {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n } else {\n return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef);\n }\n }\n return false;\n}\n\nexport function isAggregate(encoding: EncodingWithFacet) {\n return some(CHANNELS, channel => {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.aggregate);\n } else {\n const fieldDef = getFieldDef(channelDef);\n return fieldDef && !!fieldDef.aggregate;\n }\n }\n return false;\n });\n}\n\nexport function extractTransformsFromEncoding(oldEncoding: Encoding, config: Config) {\n const groupby: string[] = [];\n const bins: BinTransform[] = [];\n const timeUnits: TimeUnitTransform[] = [];\n const aggregate: AggregatedFieldDef[] = [];\n const encoding: Encoding = {};\n\n forEach(oldEncoding, (channelDef, channel) => {\n // Extract potential embedded transformations along with remaining properties\n if (isFieldDef(channelDef)) {\n const {field, aggregate: aggOp, bin, timeUnit, ...remaining} = channelDef;\n if (aggOp || timeUnit || bin) {\n const guide = getGuide(channelDef);\n const isTitleDefined = guide && guide.title;\n let newField = vgField(channelDef, {forAs: true});\n const newFieldDef: FieldDef = {\n // Only add title if it doesn't exist\n ...(isTitleDefined ? [] : {title: title(channelDef, config, {allowDisabling: true})}),\n ...remaining,\n // Always overwrite field\n field: newField\n };\n\n if (aggOp) {\n let op: AggregateOp;\n\n if (isArgmaxDef(aggOp)) {\n op = 'argmax';\n newField = vgField({op: 'argmax', field: aggOp.argmax}, {forAs: true});\n newFieldDef.field = `${newField}.${field}`;\n } else if (isArgminDef(aggOp)) {\n op = 'argmin';\n newField = vgField({op: 'argmin', field: aggOp.argmin}, {forAs: true});\n newFieldDef.field = `${newField}.${field}`;\n } else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') {\n op = aggOp;\n }\n\n if (op) {\n const aggregateEntry: AggregatedFieldDef = {\n op,\n as: newField\n };\n if (field) {\n aggregateEntry.field = field;\n }\n aggregate.push(aggregateEntry);\n }\n } else {\n groupby.push(newField);\n if (isTypedFieldDef(channelDef) && isBinning(bin)) {\n bins.push({bin, field, as: newField});\n // Add additional groupbys for range and end of bins\n groupby.push(vgField(channelDef, {binSuffix: 'end'}));\n if (binRequiresRange(channelDef, channel)) {\n groupby.push(vgField(channelDef, {binSuffix: 'range'}));\n }\n // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively\n if (isXorY(channel)) {\n const secondaryChannel: SecondaryFieldDef = {\n field: newField + '_end'\n };\n encoding[channel + '2'] = secondaryChannel;\n }\n newFieldDef.bin = 'binned';\n if (!isSecondaryRangeChannel(channel)) {\n newFieldDef['type'] = QUANTITATIVE;\n }\n } else if (timeUnit) {\n timeUnits.push({\n timeUnit,\n field,\n as: newField\n });\n\n // define the format type for later compilation\n const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time';\n if (formatType) {\n if (channel === TEXT || channel === TOOLTIP) {\n newFieldDef['formatType'] = formatType;\n } else if (isNonPositionScaleChannel(channel)) {\n newFieldDef['legend'] = {\n formatType,\n ...newFieldDef['legend']\n };\n } else if (isXorY(channel)) {\n newFieldDef['axis'] = {\n formatType,\n ...newFieldDef['axis']\n };\n }\n }\n }\n }\n\n // now the field should refer to post-transformed field instead\n encoding[channel as any] = newFieldDef;\n } else {\n groupby.push(field);\n encoding[channel as any] = oldEncoding[channel];\n }\n } else {\n // For value def / signal ref / datum def, just copy\n encoding[channel as any] = oldEncoding[channel];\n }\n });\n\n return {\n bins,\n timeUnits,\n aggregate,\n groupby,\n encoding\n };\n}\n\nexport function markChannelCompatible(encoding: Encoding, channel: Channel, mark: Mark) {\n const markSupported = supportMark(channel, mark);\n if (!markSupported) {\n return false;\n } else if (markSupported === 'binned') {\n const primaryFieldDef = encoding[channel === X2 ? X : Y];\n\n // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef\n // has \"binned\" data and thus need x2/y2 to specify the bin-end field.\n if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) {\n return true;\n } else {\n return false;\n }\n }\n return true;\n}\n\nexport function initEncoding(\n encoding: Encoding,\n mark: Mark,\n filled: boolean,\n config: Config\n): Encoding {\n return keys(encoding).reduce((normalizedEncoding: Encoding, channel: Channel) => {\n if (!isChannel(channel)) {\n // Drop invalid channel\n log.warn(log.message.invalidEncodingChannel(channel));\n return normalizedEncoding;\n }\n\n const channelDef = encoding[channel];\n if (channel === 'angle' && mark === 'arc' && !encoding.theta) {\n log.warn(log.message.REPLACE_ANGLE_WITH_THETA);\n channel = THETA;\n }\n\n if (!markChannelCompatible(encoding, channel, mark)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, mark));\n return normalizedEncoding;\n }\n\n // Drop line's size if the field is aggregated.\n if (channel === SIZE && mark === 'line') {\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef?.aggregate) {\n log.warn(log.message.LINE_WITH_VARYING_SIZE);\n return normalizedEncoding;\n }\n }\n // Drop color if either fill or stroke is specified\n\n if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) {\n log.warn(log.message.droppingColor('encoding', {fill: 'fill' in encoding, stroke: 'stroke' in encoding}));\n return normalizedEncoding;\n }\n\n if (\n channel === DETAIL ||\n (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) ||\n (channel === TOOLTIP && isArray(channelDef))\n ) {\n if (channelDef) {\n // Array of fieldDefs for detail channel (or production rule)\n (normalizedEncoding[channel] as any) = array(channelDef).reduce(\n (defs: FieldDef[], fieldDef: FieldDef) => {\n if (!isFieldDef(fieldDef)) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n } else {\n defs.push(initFieldDef(fieldDef, channel));\n }\n return defs;\n },\n []\n );\n }\n } else {\n if (channel === TOOLTIP && channelDef === null) {\n // Preserve null so we can use it to disable tooltip\n normalizedEncoding[channel] = null;\n } else if (\n !isFieldDef(channelDef) &&\n !isDatumDef(channelDef) &&\n !isValueDef(channelDef) &&\n !isConditionalDef(channelDef) &&\n !isSignalRef(channelDef)\n ) {\n log.warn(log.message.emptyFieldDef(channelDef, channel));\n return normalizedEncoding;\n }\n\n normalizedEncoding[channel as any] = initChannelDef(channelDef as ChannelDef, channel, config);\n }\n return normalizedEncoding;\n }, {});\n}\n\n/**\n * For composite marks, we have to call initChannelDef during init so we can infer types earlier.\n */\nexport function normalizeEncoding(encoding: Encoding, config: Config): Encoding {\n return keys(encoding).reduce((normalizedEncoding: Encoding, channel) => {\n const newChannelDef = initChannelDef(encoding[channel], channel, config, {compositeMark: true});\n\n normalizedEncoding[channel as any] = newChannelDef;\n return normalizedEncoding;\n }, {});\n}\n\nexport function fieldDefs(encoding: EncodingWithFacet): FieldDef[] {\n const arr: FieldDef[] = [];\n for (const channel of keys(encoding)) {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n const channelDefArray = array(channelDef);\n for (const def of channelDefArray) {\n if (isFieldDef(def)) {\n arr.push(def);\n } else if (hasConditionalFieldDef(def)) {\n arr.push(def.condition);\n }\n }\n }\n }\n return arr;\n}\n\nexport function forEach>(\n mapping: U,\n f: (cd: ChannelDef, c: keyof U) => void,\n thisArg?: any\n) {\n if (!mapping) {\n return;\n }\n\n for (const channel of keys(mapping)) {\n const el = mapping[channel];\n if (isArray(el)) {\n for (const channelDef of el as unknown[]) {\n f.call(thisArg, channelDef, channel);\n }\n } else {\n f.call(thisArg, el, channel);\n }\n }\n}\n\nexport function reduce>(\n mapping: U,\n f: (acc: any, fd: TypedFieldDef, c: keyof U) => U,\n init: T,\n thisArg?: any\n) {\n if (!mapping) {\n return init;\n }\n\n return keys(mapping).reduce((r, channel) => {\n const map = mapping[channel];\n if (isArray(map)) {\n return map.reduce((r1: T, channelDef: ChannelDef) => {\n return f.call(thisArg, r1, channelDef, channel);\n }, r);\n } else {\n return f.call(thisArg, r, map, channel);\n }\n }, init);\n}\n\n/**\n * Returns list of path grouping fields for the given encoding\n */\nexport function pathGroupingFields(mark: Mark, encoding: Encoding): string[] {\n return keys(encoding).reduce((details, channel) => {\n switch (channel) {\n // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group\n case X:\n case Y:\n case HREF:\n case DESCRIPTION:\n case URL:\n case X2:\n case Y2:\n case THETA:\n case THETA2:\n case RADIUS:\n case RADIUS2:\n // falls through\n\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n // TODO: case 'cursor':\n\n // text, shape, shouldn't be a part of line/trail/area [falls through]\n case TEXT:\n case SHAPE:\n case ANGLE:\n // falls through\n\n // tooltip fields should not be added to group by [falls through]\n case TOOLTIP:\n return details;\n\n case ORDER:\n // order should not group line / trail\n if (mark === 'line' || mark === 'trail') {\n return details;\n }\n // but order should group area for stacking (falls through)\n\n case DETAIL:\n case KEY: {\n const channelDef = encoding[channel];\n if (isArray(channelDef) || isFieldDef(channelDef)) {\n for (const fieldDef of array(channelDef)) {\n if (!fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n }\n }\n return details;\n }\n\n case SIZE:\n if (mark === 'trail') {\n // For trail, size should not group trail lines.\n return details;\n }\n // For line, size should group lines.\n\n // falls through\n case COLOR:\n case FILL:\n case STROKE:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEDASH:\n case STROKEWIDTH: {\n // TODO strokeDashOffset:\n // falls through\n\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef && !fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n return details;\n }\n }\n }, []);\n}\n","import {Orientation, SignalRef, Text} from 'vega';\nimport {isArray, isBoolean, isString} from 'vega-util';\nimport {CompositeMark, CompositeMarkDef} from '.';\nimport {\n Field,\n FieldDefBase,\n isContinuousFieldOrDatumDef,\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n PositionFieldDef,\n SecondaryFieldDef,\n StringFieldDef,\n StringFieldDefWithCondition,\n StringValueDefWithCondition\n} from '../channeldef';\nimport {Encoding, fieldDefs} from '../encoding';\nimport * as log from '../log';\nimport {ColorMixins, GenericMarkDef, isMarkDef, Mark, MarkConfig, MarkDef} from '../mark';\nimport {GenericUnitSpec, NormalizedUnitSpec} from '../spec';\nimport {getFirstDefined, hash, unique} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {toStringFieldDef} from './../channeldef';\n\nexport type PartsMixins

= Partial>;\n\nexport type GenericCompositeMarkDef = GenericMarkDef &\n ColorMixins & {\n /**\n * The opacity (value between [0,1]) of the mark.\n */\n opacity?: number;\n\n /**\n * Whether a composite mark be clipped to the enclosing group’s width and height.\n */\n clip?: boolean;\n };\n\nexport interface CompositeMarkTooltipSummary {\n /**\n * The prefix of the field to be shown in tooltip\n */\n fieldPrefix: string;\n\n /**\n * The title prefix to show, corresponding to the field with field prefix `fieldPrefix`\n */\n titlePrefix: Text | SignalRef;\n}\n\nexport function filterTooltipWithAggregatedField(\n oldEncoding: Encoding\n): {\n customTooltipWithoutAggregatedField?:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n filteredEncoding: Encoding;\n} {\n const {tooltip, ...filteredEncoding} = oldEncoding;\n if (!tooltip) {\n return {filteredEncoding};\n }\n\n let customTooltipWithAggregatedField:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n let customTooltipWithoutAggregatedField:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n\n if (isArray(tooltip)) {\n for (const t of tooltip) {\n if (t.aggregate) {\n if (!customTooltipWithAggregatedField) {\n customTooltipWithAggregatedField = [];\n }\n (customTooltipWithAggregatedField as StringFieldDef[]).push(t);\n } else {\n if (!customTooltipWithoutAggregatedField) {\n customTooltipWithoutAggregatedField = [];\n }\n (customTooltipWithoutAggregatedField as StringFieldDef[]).push(t);\n }\n }\n\n if (customTooltipWithAggregatedField) {\n (filteredEncoding as Encoding).tooltip = customTooltipWithAggregatedField;\n }\n } else {\n if (tooltip['aggregate']) {\n (filteredEncoding as Encoding).tooltip = tooltip;\n } else {\n customTooltipWithoutAggregatedField = tooltip;\n }\n }\n\n if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) {\n customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0];\n }\n return {customTooltipWithoutAggregatedField, filteredEncoding};\n}\n\nexport function getCompositeMarkTooltip(\n tooltipSummary: CompositeMarkTooltipSummary[],\n continuousAxisChannelDef: PositionFieldDef,\n encodingWithoutContinuousAxis: Encoding,\n withFieldName = true\n): Encoding {\n if ('tooltip' in encodingWithoutContinuousAxis) {\n return {tooltip: encodingWithoutContinuousAxis.tooltip};\n }\n\n const fiveSummaryTooltip: StringFieldDef[] = tooltipSummary.map(\n ({fieldPrefix, titlePrefix}): StringFieldDef => {\n const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : '';\n return {\n field: fieldPrefix + continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n title: isSignalRef(titlePrefix) ? {signal: titlePrefix + `\"${escape(mainTitle)}\"`} : titlePrefix + mainTitle\n };\n }\n );\n\n const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef);\n\n return {\n tooltip: [\n ...fiveSummaryTooltip,\n // need to cast because TextFieldDef supports fewer types of bin\n ...unique(tooltipFieldDefs, hash)\n ]\n };\n}\n\nexport function getTitle(continuousAxisChannelDef: PositionFieldDef) {\n const {title, field} = continuousAxisChannelDef;\n return getFirstDefined(title, field);\n}\n\nexport function makeCompositeAggregatePartFactory

>(\n compositeMarkDef: GenericCompositeMarkDef & P,\n continuousAxis: 'x' | 'y',\n continuousAxisChannelDef: PositionFieldDef,\n sharedEncoding: Encoding,\n compositeMarkConfig: P\n) {\n const {scale, axis} = continuousAxisChannelDef;\n\n return ({\n partName,\n mark,\n positionPrefix,\n endPositionPrefix = undefined,\n extraEncoding = {}\n }: {\n partName: keyof P;\n mark: Mark | MarkDef;\n positionPrefix: string;\n endPositionPrefix?: string;\n extraEncoding?: Encoding;\n }) => {\n const title = getTitle(continuousAxisChannelDef);\n\n return partLayerMixins

(compositeMarkDef, partName, compositeMarkConfig, {\n mark, // TODO better remove this method and just have mark as a parameter of the method\n encoding: {\n [continuousAxis]: {\n field: positionPrefix + '_' + continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? {title} : {}),\n ...(scale !== undefined ? {scale} : {}),\n ...(axis !== undefined ? {axis} : {})\n },\n ...(isString(endPositionPrefix)\n ? {\n [continuousAxis + '2']: {\n field: endPositionPrefix + '_' + continuousAxisChannelDef.field\n }\n }\n : {}),\n ...sharedEncoding,\n ...extraEncoding\n }\n });\n };\n}\n\nexport function partLayerMixins

>(\n markDef: GenericCompositeMarkDef & P,\n part: keyof P,\n compositeMarkConfig: P,\n partBaseSpec: NormalizedUnitSpec\n): NormalizedUnitSpec[] {\n const {clip, color, opacity} = markDef;\n\n const mark = markDef.type;\n\n if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) {\n return [\n {\n ...partBaseSpec,\n mark: {\n ...(compositeMarkConfig[part] as MarkConfig),\n ...(clip ? {clip} : {}),\n ...(color ? {color} : {}),\n ...(opacity ? {opacity} : {}),\n ...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : {type: partBaseSpec.mark}),\n style: `${mark}-${part}`,\n ...(isBoolean(markDef[part]) ? {} : (markDef[part] as MarkConfig))\n }\n }\n ];\n }\n return [];\n}\n\nexport function compositeMarkContinuousAxis(\n spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>,\n orient: Orientation,\n compositeMark: M\n): {\n continuousAxisChannelDef: PositionFieldDef;\n continuousAxisChannelDef2: SecondaryFieldDef;\n continuousAxisChannelDefError: SecondaryFieldDef;\n continuousAxisChannelDefError2: SecondaryFieldDef;\n continuousAxis: 'x' | 'y';\n} {\n const {encoding} = spec;\n const continuousAxis: 'x' | 'y' = orient === 'vertical' ? 'y' : 'x';\n\n const continuousAxisChannelDef = encoding[continuousAxis] as PositionFieldDef; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal.\n const continuousAxisChannelDef2 = encoding[continuousAxis + '2'] as SecondaryFieldDef;\n const continuousAxisChannelDefError = encoding[continuousAxis + 'Error'] as SecondaryFieldDef;\n const continuousAxisChannelDefError2 = encoding[continuousAxis + 'Error2'] as SecondaryFieldDef;\n\n return {\n continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark),\n continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark),\n continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark),\n continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark),\n continuousAxis\n };\n}\n\nfunction filterAggregateFromChannelDef>(\n continuousAxisChannelDef: F,\n compositeMark: M\n): F {\n if (continuousAxisChannelDef && continuousAxisChannelDef.aggregate) {\n const {aggregate, ...continuousAxisWithoutAggregate} = continuousAxisChannelDef;\n if (aggregate !== compositeMark) {\n log.warn(log.message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark));\n }\n return continuousAxisWithoutAggregate as F;\n } else {\n return continuousAxisChannelDef;\n }\n}\n\nexport function compositeMarkOrient(\n spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>,\n compositeMark: M\n): Orientation {\n const {mark, encoding} = spec;\n const {x, y} = encoding;\n\n if (isMarkDef(mark) && mark.orient) {\n return mark.orient;\n }\n\n if (isContinuousFieldOrDatumDef(x)) {\n // x is continuous\n if (isContinuousFieldOrDatumDef(y)) {\n // both x and y are continuous\n const xAggregate = isFieldDef(x) && x.aggregate;\n const yAggregate = isFieldDef(y) && y.aggregate;\n\n if (!xAggregate && yAggregate === compositeMark) {\n return 'vertical';\n } else if (!yAggregate && xAggregate === compositeMark) {\n return 'horizontal';\n } else if (xAggregate === compositeMark && yAggregate === compositeMark) {\n throw new Error('Both x and y cannot have aggregate');\n } else {\n if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) {\n // y is temporal but x is not\n return 'horizontal';\n }\n\n // default orientation for two continuous\n return 'vertical';\n }\n }\n\n return 'horizontal';\n } else if (isContinuousFieldOrDatumDef(y)) {\n // y is continuous but x is not\n return 'vertical';\n } else {\n // Neither x nor y is continuous.\n throw new Error(`Need a valid continuous axis for ${compositeMark}s`);\n }\n}\n","import {Orientation} from 'vega';\nimport {isNumber, isObject} from 'vega-util';\nimport {getMarkPropOrConfig} from '../compile/common';\nimport {Config} from '../config';\nimport {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {isMarkDef, MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec, NormalizedUnitSpec} from '../spec';\nimport {AggregatedFieldDef, CalculateTransform, JoinAggregateTransform, Transform} from '../transform';\nimport {isEmpty, omit} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {\n compositeMarkContinuousAxis,\n compositeMarkOrient,\n filterTooltipWithAggregatedField,\n GenericCompositeMarkDef,\n getCompositeMarkTooltip,\n getTitle,\n makeCompositeAggregatePartFactory,\n partLayerMixins,\n PartsMixins\n} from './common';\n\nexport const BOXPLOT = 'boxplot' as const;\nexport type BoxPlot = typeof BOXPLOT;\n\nexport const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks'] as const;\n\ntype BoxPlotPart = typeof BOXPLOT_PARTS[number];\n\nexport type BoxPlotPartsMixins = PartsMixins;\n\nexport interface BoxPlotConfig extends BoxPlotPartsMixins {\n /** Size of the box and median tick of a box plot */\n size?: number;\n\n /**\n * The extent of the whiskers. Available options include:\n * - `\"min-max\"`: min and max are the lower and upper whiskers respectively.\n * - A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_).\n *\n * __Default value:__ `1.5`.\n */\n extent?: 'min-max' | number;\n}\n\nexport type BoxPlotDef = GenericCompositeMarkDef &\n BoxPlotConfig & {\n /**\n * Type of the mark. For box plots, this should always be `\"boxplot\"`.\n * [boxplot](https://vega.github.io/vega-lite/docs/boxplot.html)\n */\n type: BoxPlot;\n\n /**\n * Orientation of the box plot. This is normally automatically determined based on types of fields on x and y channels. However, an explicit `orient` be specified when the orientation is ambiguous.\n *\n * __Default value:__ `\"vertical\"`.\n */\n orient?: Orientation;\n };\n\nexport interface BoxPlotConfigMixins {\n /**\n * Box Config\n */\n boxplot?: BoxPlotConfig;\n}\n\nexport const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot);\n\nexport function getBoxPlotType(extent: number | 'min-max') {\n if (isNumber(extent)) {\n return 'tukey';\n }\n // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now.\n return extent;\n}\n\nexport function normalizeBoxPlot(\n spec: GenericUnitSpec, BoxPlot | BoxPlotDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const {mark, encoding: _encoding, selection, projection: _p, ...outerSpec} = spec;\n const markDef: BoxPlotDef = isMarkDef(mark) ? mark : {type: mark};\n\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (selection) {\n log.warn(log.message.selectionNotSupported('boxplot'));\n }\n\n const extent = markDef.extent ?? config.boxplot.extent;\n const sizeValue = getMarkPropOrConfig(\n 'size',\n markDef as any, // TODO: https://github.com/vega/vega-lite/issues/6245\n config\n );\n\n const boxPlotType = getBoxPlotType(extent);\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n groupby,\n aggregate,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n } = boxParams(spec, extent, config);\n\n const {color, size, ...encodingWithoutSizeColorAndContinuousAxis} = encodingWithoutContinuousAxis;\n\n const makeBoxPlotPart = (sharedEncoding: Encoding) => {\n return makeCompositeAggregatePartFactory(\n markDef,\n continuousAxis,\n continuousAxisChannelDef,\n sharedEncoding,\n config.boxplot\n );\n };\n\n const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis);\n const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis);\n const makeBoxPlotMidTick = makeBoxPlotPart({...encodingWithoutSizeColorAndContinuousAxis, ...(size ? {size} : {})});\n\n const fiveSummaryTooltipEncoding: Encoding = getCompositeMarkTooltip(\n [\n {fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max'},\n {fieldPrefix: 'upper_box_', titlePrefix: 'Q3'},\n {fieldPrefix: 'mid_box_', titlePrefix: 'Median'},\n {fieldPrefix: 'lower_box_', titlePrefix: 'Q1'},\n {fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min'}\n ],\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis\n );\n\n // ## Whisker Layers\n\n const endTick: MarkDef = {type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid: null, aria: false};\n const whiskerTooltipEncoding: Encoding =\n boxPlotType === 'min-max'\n ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker\n : // for tukey / k-IQR, just show upper/lower-whisker\n getCompositeMarkTooltip(\n [\n {fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker'},\n {fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker'}\n ],\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis\n );\n\n const whiskerLayers = [\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: {type: 'rule', invalid: null, aria: false},\n positionPrefix: 'lower_whisker',\n endPositionPrefix: 'lower_box',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: {type: 'rule', invalid: null, aria: false},\n positionPrefix: 'upper_box',\n endPositionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'lower_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n })\n ];\n\n // ## Box Layers\n\n // TODO: support hiding certain mark parts\n const boxLayers: NormalizedUnitSpec[] = [\n ...(boxPlotType !== 'tukey' ? whiskerLayers : []),\n ...makeBoxPlotBox({\n partName: 'box',\n mark: {\n type: 'bar',\n ...(sizeValue ? {size: sizeValue} : {}),\n orient: boxOrient,\n invalid: null,\n ariaRoleDescription: 'box'\n },\n positionPrefix: 'lower_box',\n endPositionPrefix: 'upper_box',\n extraEncoding: fiveSummaryTooltipEncoding\n }),\n ...makeBoxPlotMidTick({\n partName: 'median',\n mark: {\n type: 'tick',\n invalid: null,\n ...(isObject(config.boxplot.median) && config.boxplot.median.color ? {color: config.boxplot.median.color} : {}),\n ...(sizeValue ? {size: sizeValue} : {}),\n orient: ticksOrient,\n aria: false\n },\n positionPrefix: 'mid_box',\n extraEncoding: fiveSummaryTooltipEncoding\n })\n ];\n\n // ## Filtered Layers\n\n let filteredLayersMixins: NormalizedUnitSpec | NormalizedLayerSpec;\n\n if (boxPlotType !== 'min-max') {\n const lowerBoxExpr = `datum[\"lower_box_${continuousAxisChannelDef.field}\"]`;\n const upperBoxExpr = `datum[\"upper_box_${continuousAxisChannelDef.field}\"]`;\n const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`;\n const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`;\n const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`;\n const fieldExpr = `datum[\"${continuousAxisChannelDef.field}\"]`;\n\n const joinaggregateTransform: JoinAggregateTransform = {\n joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field),\n groupby\n };\n\n let filteredWhiskerSpec: NormalizedLayerSpec = undefined;\n if (boxPlotType === 'tukey') {\n filteredWhiskerSpec = {\n transform: [\n {\n filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})`\n },\n {\n aggregate: [\n {\n op: 'min',\n field: continuousAxisChannelDef.field,\n as: 'lower_whisker_' + continuousAxisChannelDef.field\n },\n {\n op: 'max',\n field: continuousAxisChannelDef.field,\n as: 'upper_whisker_' + continuousAxisChannelDef.field\n },\n // preserve lower_box / upper_box\n {\n op: 'min',\n field: 'lower_box_' + continuousAxisChannelDef.field,\n as: 'lower_box_' + continuousAxisChannelDef.field\n },\n {\n op: 'max',\n field: 'upper_box_' + continuousAxisChannelDef.field,\n as: 'upper_box_' + continuousAxisChannelDef.field\n },\n ...aggregate\n ],\n groupby\n }\n ],\n layer: whiskerLayers\n };\n }\n\n const {tooltip, ...encodingWithoutSizeColorContinuousAxisAndTooltip} = encodingWithoutSizeColorAndContinuousAxis;\n\n const {scale, axis} = continuousAxisChannelDef;\n const title = getTitle(continuousAxisChannelDef);\n const axisWithoutTitle = omit(axis, ['title']);\n\n const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, {\n transform: [{filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})`}],\n mark: 'point',\n encoding: {\n [continuousAxis]: {\n field: continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? {title} : {}),\n ...(scale !== undefined ? {scale} : {}),\n // add axis without title since we already added the title above\n ...(isEmpty(axisWithoutTitle) ? {} : {axis: axisWithoutTitle})\n },\n ...encodingWithoutSizeColorContinuousAxisAndTooltip,\n ...(customTooltipWithoutAggregatedField ? {tooltip: customTooltipWithoutAggregatedField} : {})\n }\n })[0];\n\n if (outlierLayersMixins && filteredWhiskerSpec) {\n filteredLayersMixins = {\n transform: [joinaggregateTransform],\n layer: [outlierLayersMixins, filteredWhiskerSpec]\n };\n } else if (outlierLayersMixins) {\n filteredLayersMixins = outlierLayersMixins;\n filteredLayersMixins.transform.unshift(joinaggregateTransform);\n } else if (filteredWhiskerSpec) {\n filteredLayersMixins = filteredWhiskerSpec;\n filteredLayersMixins.transform.unshift(joinaggregateTransform);\n }\n }\n\n if (filteredLayersMixins) {\n // tukey box plot with outliers included\n return {\n ...outerSpec,\n layer: [\n filteredLayersMixins,\n {\n // boxplot\n transform,\n layer: boxLayers\n }\n ]\n };\n }\n return {\n ...outerSpec,\n transform: (outerSpec.transform ?? []).concat(transform),\n layer: boxLayers\n };\n}\n\nfunction boxParamsQuartiles(continousAxisField: string): AggregatedFieldDef[] {\n return [\n {\n op: 'q1',\n field: continousAxisField,\n as: 'lower_box_' + continousAxisField\n },\n {\n op: 'q3',\n field: continousAxisField,\n as: 'upper_box_' + continousAxisField\n }\n ];\n}\n\nfunction boxParams(\n spec: GenericUnitSpec, BoxPlot | BoxPlotDef>,\n extent: 'min-max' | number,\n config: Config\n) {\n const orient = compositeMarkOrient(spec, BOXPLOT);\n const {continuousAxisChannelDef, continuousAxis} = compositeMarkContinuousAxis(spec, orient, BOXPLOT);\n const continuousFieldName: string = continuousAxisChannelDef.field;\n\n const boxPlotType = getBoxPlotType(extent);\n\n const boxplotSpecificAggregate: AggregatedFieldDef[] = [\n ...boxParamsQuartiles(continuousFieldName),\n {\n op: 'median',\n field: continuousFieldName,\n as: 'mid_box_' + continuousFieldName\n },\n {\n op: 'min',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName\n },\n {\n op: 'max',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName\n }\n ];\n\n const postAggregateCalculates: CalculateTransform[] =\n boxPlotType === 'min-max' || boxPlotType === 'tukey'\n ? []\n : [\n // This is for the original k-IQR, which we do not expose\n {\n calculate: `datum[\"upper_box_${continuousFieldName}\"] - datum[\"lower_box_${continuousFieldName}\"]`,\n as: 'iqr_' + continuousFieldName\n },\n {\n calculate: `min(datum[\"upper_box_${continuousFieldName}\"] + datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"max_${continuousFieldName}\"])`,\n as: 'upper_whisker_' + continuousFieldName\n },\n {\n calculate: `max(datum[\"lower_box_${continuousFieldName}\"] - datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"min_${continuousFieldName}\"])`,\n as: 'lower_whisker_' + continuousFieldName\n }\n ];\n\n const {[continuousAxis]: oldContinuousAxisChannelDef, ...oldEncodingWithoutContinuousAxis} = spec.encoding;\n const {customTooltipWithoutAggregatedField, filteredEncoding} = filterTooltipWithAggregatedField(\n oldEncodingWithoutContinuousAxis\n );\n\n const {bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis} = extractTransformsFromEncoding(\n filteredEncoding,\n config\n );\n\n const ticksOrient: Orientation = orient === 'vertical' ? 'horizontal' : 'vertical';\n const boxOrient: Orientation = orient;\n\n const transform: Transform[] = [\n ...bins,\n ...timeUnits,\n {\n aggregate: [...aggregate, ...boxplotSpecificAggregate],\n groupby\n },\n ...postAggregateCalculates\n ];\n\n return {\n transform,\n groupby,\n aggregate,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n };\n}\n","import {AggregateOp, Orientation, Text} from 'vega';\nimport {PositionChannel} from '../channel';\nimport {\n Field,\n isContinuousFieldOrDatumDef,\n isFieldOrDatumDef,\n PositionFieldDef,\n SecondaryFieldDef,\n title,\n ValueDef\n} from '../channeldef';\nimport {Config} from '../config';\nimport {Data} from '../data';\nimport {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {isMarkDef, MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {Step} from '../spec/base';\nimport {NormalizedUnitSpec} from '../spec/unit';\nimport {TitleParams} from '../title';\nimport {AggregatedFieldDef, CalculateTransform, Transform} from '../transform';\nimport {replaceAll, titleCase} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {\n compositeMarkContinuousAxis,\n compositeMarkOrient,\n CompositeMarkTooltipSummary,\n GenericCompositeMarkDef,\n getCompositeMarkTooltip,\n makeCompositeAggregatePartFactory,\n PartsMixins\n} from './common';\nimport {ErrorBand, ErrorBandDef} from './errorband';\n\nexport const ERRORBAR = 'errorbar' as const;\nexport type ErrorBar = typeof ERRORBAR;\n\nexport type ErrorBarExtent = 'ci' | 'iqr' | 'stderr' | 'stdev';\nexport type ErrorBarCenter = 'mean' | 'median';\n\nexport type ErrorInputType = 'raw' | 'aggregated-upper-lower' | 'aggregated-error';\n\nexport const ERRORBAR_PARTS = ['ticks', 'rule'] as const;\n\nexport type ErrorBarPart = typeof ERRORBAR_PARTS[number];\n\nexport interface ErrorExtraEncoding {\n /**\n * Error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n xError?: SecondaryFieldDef | ValueDef;\n\n /**\n * Secondary error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n // `xError2` cannot have type as it should have the same type as `xError`\n xError2?: SecondaryFieldDef | ValueDef;\n\n /**\n * Error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n yError?: SecondaryFieldDef | ValueDef;\n\n /**\n * Secondary error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n // `yError2` cannot have type as it should have the same type as `yError`\n yError2?: SecondaryFieldDef | ValueDef;\n}\n\nexport type ErrorEncoding = Pick, PositionChannel | 'color' | 'detail' | 'opacity'> &\n ErrorExtraEncoding;\n\nexport type ErrorBarPartsMixins = PartsMixins;\n\nexport interface ErrorBarConfig extends ErrorBarPartsMixins {\n /**\n * The center of the errorbar. Available options include:\n * - `\"mean\"`: the mean of the data points.\n * - `\"median\"`: the median of the data points.\n *\n * __Default value:__ `\"mean\"`.\n * @hidden\n */\n\n // center is not needed right now but will be added back to the schema if future features require it.\n center?: ErrorBarCenter;\n\n /**\n * The extent of the rule. Available options include:\n * - `\"ci\"`: Extend the rule to the confidence interval of the mean.\n * - `\"stderr\"`: The size of rule are set to the value of standard error, extending from the mean.\n * - `\"stdev\"`: The size of rule are set to the value of standard deviation, extending from the mean.\n * - `\"iqr\"`: Extend the rule to the q1 and q3.\n *\n * __Default value:__ `\"stderr\"`.\n */\n extent?: ErrorBarExtent;\n}\n\nexport type ErrorBarDef = GenericCompositeMarkDef &\n ErrorBarConfig & {\n /**\n * Orientation of the error bar. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined.\n */\n orient?: Orientation;\n };\n\nexport interface ErrorBarConfigMixins {\n /**\n * ErrorBar Config\n */\n errorbar?: ErrorBarConfig;\n}\n\nexport const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar);\n\nexport function normalizeErrorBar(\n spec: GenericUnitSpec, ErrorBar | ErrorBarDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec | NormalizedUnitSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n markDef,\n outerSpec,\n tooltipEncoding\n } = errorBarParams(spec, ERRORBAR, config);\n\n const makeErrorBarPart = makeCompositeAggregatePartFactory(\n markDef,\n continuousAxis,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n config.errorbar\n );\n\n const tick: MarkDef = {type: 'tick', orient: ticksOrient, aria: false};\n\n const layer = [\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'lower',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'rule',\n mark: {\n type: 'rule',\n ariaRoleDescription: 'errorbar'\n },\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ];\n\n return {\n ...outerSpec,\n transform,\n ...(layer.length > 1 ? {layer} : {...layer[0]})\n };\n}\n\nfunction errorBarOrientAndInputType(\n spec: GenericUnitSpec, ErrorBar | ErrorBand | ErrorBarDef | ErrorBandDef>,\n compositeMark: ErrorBar | ErrorBand\n): {\n orient: Orientation;\n inputType: ErrorInputType;\n} {\n const {encoding} = spec;\n\n if (errorBarIsInputTypeRaw(encoding)) {\n return {\n orient: compositeMarkOrient(spec, compositeMark),\n inputType: 'raw'\n };\n }\n\n const isTypeAggregatedUpperLower: boolean = errorBarIsInputTypeAggregatedUpperLower(encoding);\n const isTypeAggregatedError: boolean = errorBarIsInputTypeAggregatedError(encoding);\n const x = encoding.x;\n const y = encoding.y;\n\n if (isTypeAggregatedUpperLower) {\n // type is aggregated-upper-lower\n\n if (isTypeAggregatedError) {\n throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`);\n }\n\n const x2 = encoding.x2;\n const y2 = encoding.y2;\n\n if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) {\n // having both x, x2 and y, y2\n throw new Error(`${compositeMark} cannot have both x2 and y2`);\n } else if (isFieldOrDatumDef(x2)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x, x2 quantitative and field y, y2 are not specified\n return {orient: 'horizontal', inputType: 'aggregated-upper-lower'};\n } else {\n // having x, x2 that are not both quantitative\n throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`);\n }\n } else if (isFieldOrDatumDef(y2)) {\n // y2 is a FieldDef\n if (isContinuousFieldOrDatumDef(y)) {\n // having y, y2 quantitative and field x, x2 are not specified\n return {orient: 'vertical', inputType: 'aggregated-upper-lower'};\n } else {\n // having y, y2 that are not both quantitative\n throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`);\n }\n }\n throw new Error('No ranged axis');\n } else {\n // type is aggregated-error\n\n const xError = encoding.xError;\n const xError2 = encoding.xError2;\n const yError = encoding.yError;\n const yError2 = encoding.yError2;\n\n if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) {\n // having xError2 without xError\n throw new Error(`${compositeMark} cannot have xError2 without xError`);\n }\n\n if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) {\n // having yError2 without yError\n throw new Error(`${compositeMark} cannot have yError2 without yError`);\n }\n\n if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) {\n // having both xError and yError\n throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`);\n } else if (isFieldOrDatumDef(xError)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x and xError that are all quantitative\n return {orient: 'horizontal', inputType: 'aggregated-error'};\n } else {\n // having x, xError, and xError2 that are not all quantitative\n throw new Error('All x, xError, and xError2 (if exist) have to be quantitative');\n }\n } else if (isFieldOrDatumDef(yError)) {\n if (isContinuousFieldOrDatumDef(y)) {\n // having y and yError that are all quantitative\n return {orient: 'vertical', inputType: 'aggregated-error'};\n } else {\n // having y, yError, and yError2 that are not all quantitative\n throw new Error('All y, yError, and yError2 (if exist) have to be quantitative');\n }\n }\n throw new Error('No ranged axis');\n }\n}\n\nfunction errorBarIsInputTypeRaw(encoding: ErrorEncoding): boolean {\n return (\n (isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) &&\n !isFieldOrDatumDef(encoding.x2) &&\n !isFieldOrDatumDef(encoding.y2) &&\n !isFieldOrDatumDef(encoding.xError) &&\n !isFieldOrDatumDef(encoding.xError2) &&\n !isFieldOrDatumDef(encoding.yError) &&\n !isFieldOrDatumDef(encoding.yError2)\n );\n}\n\nfunction errorBarIsInputTypeAggregatedUpperLower(encoding: ErrorEncoding): boolean {\n return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2);\n}\n\nfunction errorBarIsInputTypeAggregatedError(encoding: ErrorEncoding): boolean {\n return (\n isFieldOrDatumDef(encoding.xError) ||\n isFieldOrDatumDef(encoding.xError2) ||\n isFieldOrDatumDef(encoding.yError) ||\n isFieldOrDatumDef(encoding.yError2)\n );\n}\n\nexport function errorBarParams<\n M extends ErrorBar | ErrorBand,\n MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef)\n>(\n spec: GenericUnitSpec, M | MD>,\n compositeMark: M,\n config: Config\n): {\n transform: Transform[];\n groupby: string[];\n continuousAxisChannelDef: PositionFieldDef;\n continuousAxis: 'x' | 'y';\n encodingWithoutContinuousAxis: ErrorEncoding;\n ticksOrient: Orientation;\n markDef: MD;\n outerSpec: {\n data?: Data;\n title?: Text | TitleParams;\n name?: string;\n description?: string;\n transform?: Transform[];\n width?: number | 'container' | Step;\n height?: number | 'container' | Step;\n };\n tooltipEncoding: ErrorEncoding;\n} {\n // TODO: use selection\n const {mark, encoding, selection, projection: _p, ...outerSpec} = spec;\n const markDef: MD = isMarkDef(mark) ? mark : ({type: mark} as MD);\n\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (selection) {\n log.warn(log.message.selectionNotSupported(compositeMark));\n }\n\n const {orient, inputType} = errorBarOrientAndInputType(spec, compositeMark);\n const {\n continuousAxisChannelDef,\n continuousAxisChannelDef2,\n continuousAxisChannelDefError,\n continuousAxisChannelDefError2,\n continuousAxis\n } = compositeMarkContinuousAxis(spec, orient, compositeMark);\n\n const {\n errorBarSpecificAggregate,\n postAggregateCalculates,\n tooltipSummary,\n tooltipTitleWithFieldName\n } = errorBarAggregationAndCalculation(\n markDef,\n continuousAxisChannelDef,\n continuousAxisChannelDef2,\n continuousAxisChannelDefError,\n continuousAxisChannelDefError2,\n inputType,\n compositeMark,\n config\n );\n\n const {\n [continuousAxis]: oldContinuousAxisChannelDef,\n [continuousAxis === 'x' ? 'x2' : 'y2']: oldContinuousAxisChannelDef2,\n [continuousAxis === 'x' ? 'xError' : 'yError']: oldContinuousAxisChannelDefError,\n [continuousAxis === 'x' ? 'xError2' : 'yError2']: oldContinuousAxisChannelDefError2,\n ...oldEncodingWithoutContinuousAxis\n } = encoding;\n\n const {\n bins,\n timeUnits,\n aggregate: oldAggregate,\n groupby: oldGroupBy,\n encoding: encodingWithoutContinuousAxis\n } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config);\n\n const aggregate: AggregatedFieldDef[] = [...oldAggregate, ...errorBarSpecificAggregate];\n const groupby: string[] = inputType !== 'raw' ? [] : oldGroupBy;\n\n const tooltipEncoding: ErrorEncoding = getCompositeMarkTooltip(\n tooltipSummary,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n tooltipTitleWithFieldName\n );\n\n return {\n transform: [\n ...(outerSpec.transform ?? []),\n ...bins,\n ...timeUnits,\n ...(aggregate.length === 0 ? [] : [{aggregate, groupby}]),\n ...postAggregateCalculates\n ],\n groupby,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical',\n markDef,\n outerSpec,\n tooltipEncoding\n };\n}\n\nfunction errorBarAggregationAndCalculation<\n M extends ErrorBar | ErrorBand,\n MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef)\n>(\n markDef: MD,\n continuousAxisChannelDef: PositionFieldDef,\n continuousAxisChannelDef2: SecondaryFieldDef,\n continuousAxisChannelDefError: SecondaryFieldDef,\n continuousAxisChannelDefError2: SecondaryFieldDef,\n inputType: ErrorInputType,\n compositeMark: M,\n config: Config\n): {\n postAggregateCalculates: CalculateTransform[];\n errorBarSpecificAggregate: AggregatedFieldDef[];\n tooltipSummary: CompositeMarkTooltipSummary[];\n tooltipTitleWithFieldName: boolean;\n} {\n let errorBarSpecificAggregate: AggregatedFieldDef[] = [];\n let postAggregateCalculates: CalculateTransform[] = [];\n const continuousFieldName: string = continuousAxisChannelDef.field;\n\n let tooltipSummary: CompositeMarkTooltipSummary[];\n let tooltipTitleWithFieldName = false;\n\n if (inputType === 'raw') {\n const center: ErrorBarCenter = markDef.center\n ? markDef.center\n : markDef.extent\n ? markDef.extent === 'iqr'\n ? 'median'\n : 'mean'\n : config.errorbar.center;\n const extent: ErrorBarExtent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr';\n\n if ((center === 'median') !== (extent === 'iqr')) {\n log.warn(log.message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark));\n }\n\n if (extent === 'stderr' || extent === 'stdev') {\n errorBarSpecificAggregate = [\n {op: extent, field: continuousFieldName, as: 'extent_' + continuousFieldName},\n {op: center, field: continuousFieldName, as: 'center_' + continuousFieldName}\n ];\n\n postAggregateCalculates = [\n {\n calculate: `datum[\"center_${continuousFieldName}\"] + datum[\"extent_${continuousFieldName}\"]`,\n as: 'upper_' + continuousFieldName\n },\n {\n calculate: `datum[\"center_${continuousFieldName}\"] - datum[\"extent_${continuousFieldName}\"]`,\n as: 'lower_' + continuousFieldName\n }\n ];\n\n tooltipSummary = [\n {fieldPrefix: 'center_', titlePrefix: titleCase(center)},\n {fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+')},\n {fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-')}\n ];\n tooltipTitleWithFieldName = true;\n } else {\n let centerOp: AggregateOp;\n let lowerExtentOp: AggregateOp;\n let upperExtentOp: AggregateOp;\n if (extent === 'ci') {\n centerOp = 'mean';\n lowerExtentOp = 'ci0';\n upperExtentOp = 'ci1';\n } else {\n centerOp = 'median';\n lowerExtentOp = 'q1';\n upperExtentOp = 'q3';\n }\n\n errorBarSpecificAggregate = [\n {op: lowerExtentOp, field: continuousFieldName, as: 'lower_' + continuousFieldName},\n {op: upperExtentOp, field: continuousFieldName, as: 'upper_' + continuousFieldName},\n {op: centerOp, field: continuousFieldName, as: 'center_' + continuousFieldName}\n ];\n\n tooltipSummary = [\n {\n fieldPrefix: 'upper_',\n titlePrefix: title({field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'lower_',\n titlePrefix: title({field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'center_',\n titlePrefix: title({field: continuousFieldName, aggregate: centerOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n }\n ];\n }\n } else {\n if (markDef.center || markDef.extent) {\n log.warn(log.message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent));\n }\n\n if (inputType === 'aggregated-upper-lower') {\n tooltipSummary = [];\n postAggregateCalculates = [\n {calculate: `datum[\"${continuousAxisChannelDef2.field}\"]`, as: 'upper_' + continuousFieldName},\n {calculate: `datum[\"${continuousFieldName}\"]`, as: 'lower_' + continuousFieldName}\n ];\n } else if (inputType === 'aggregated-error') {\n tooltipSummary = [{fieldPrefix: '', titlePrefix: continuousFieldName}];\n postAggregateCalculates = [\n {\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: 'upper_' + continuousFieldName\n }\n ];\n\n if (continuousAxisChannelDefError2) {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError2.field}\"]`,\n as: 'lower_' + continuousFieldName\n });\n } else {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] - datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: 'lower_' + continuousFieldName\n });\n }\n }\n\n for (const postAggregateCalculate of postAggregateCalculates) {\n tooltipSummary.push({\n fieldPrefix: postAggregateCalculate.as.substring(0, 6),\n titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum[\"', ''), '\"]', '')\n });\n }\n }\n return {postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName};\n}\n\nfunction getTitlePrefix(center: ErrorBarCenter, extent: ErrorBarExtent, operation: '+' | '-'): string {\n return titleCase(center) + ' ' + operation + ' ' + extent;\n}\n","import {Interpolate, Orientation} from 'vega';\nimport {Field} from '../channeldef';\nimport {Encoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {CompositeMarkNormalizer} from './base';\nimport {GenericCompositeMarkDef, makeCompositeAggregatePartFactory, PartsMixins} from './common';\nimport {ErrorBarCenter, ErrorBarExtent, errorBarParams, ErrorEncoding} from './errorbar';\n\nexport type ErrorBandUnitSpec<\n EE = undefined // extra encoding parameter (for faceted composite unit spec)\n> = GenericUnitSpec & EE, ErrorBand | ErrorBandDef>;\n\nexport const ERRORBAND = 'errorband' as const;\nexport type ErrorBand = typeof ERRORBAND;\n\nexport const ERRORBAND_PARTS = ['band', 'borders'] as const;\n\ntype ErrorBandPart = typeof ERRORBAND_PARTS[number];\n\nexport type ErrorBandPartsMixins = PartsMixins;\n\nexport interface ErrorBandConfig extends ErrorBandPartsMixins {\n /**\n * The center of the error band. Available options include:\n * - `\"mean\"`: the mean of the data points.\n * - `\"median\"`: the median of the data points.\n *\n * __Default value:__ `\"mean\"`.\n * @hidden\n */\n\n // center is not needed right now but will be added back to the schema if future features require it.\n center?: ErrorBarCenter;\n\n /**\n * The extent of the band. Available options include:\n * - `\"ci\"`: Extend the band to the confidence interval of the mean.\n * - `\"stderr\"`: The size of band are set to the value of standard error, extending from the mean.\n * - `\"stdev\"`: The size of band are set to the value of standard deviation, extending from the mean.\n * - `\"iqr\"`: Extend the band to the q1 and q3.\n *\n * __Default value:__ `\"stderr\"`.\n */\n extent?: ErrorBarExtent;\n\n /**\n * The line interpolation method for the error band. One of the following:\n * - `\"linear\"`: piecewise linear segments, as in a polyline.\n * - `\"linear-closed\"`: close the linear segments to form a polygon.\n * - `\"step\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes at the midpoint of each pair of adjacent x-values.\n * - `\"step-before\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes before the x-value.\n * - `\"step-after\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes after the x-value.\n * - `\"basis\"`: a B-spline, with control point duplication on the ends.\n * - `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n * - `\"basis-closed\"`: a closed B-spline, as in a loop.\n * - `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n * - `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n * - `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n * - `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n * - `\"monotone\"`: cubic interpolation that preserves monotonicity in y.\n */\n interpolate?: Interpolate;\n\n /**\n * The tension parameter for the interpolation type of the error band.\n *\n * @minimum 0\n * @maximum 1\n */\n tension?: number;\n}\n\nexport type ErrorBandDef = GenericCompositeMarkDef &\n ErrorBandConfig & {\n /**\n * Orientation of the error band. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined.\n */\n orient?: Orientation;\n };\n\nexport interface ErrorBandConfigMixins {\n /**\n * ErrorBand Config\n */\n errorband?: ErrorBandConfig;\n}\n\nexport const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand);\n\nexport function normalizeErrorBand(\n spec: GenericUnitSpec, ErrorBand | ErrorBandDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n markDef,\n outerSpec,\n tooltipEncoding\n } = errorBarParams(spec, ERRORBAND, config);\n const errorBandDef: ErrorBandDef = markDef;\n\n const makeErrorBandPart = makeCompositeAggregatePartFactory(\n errorBandDef,\n continuousAxis,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n config.errorband\n );\n\n const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined;\n\n let bandMark: MarkDef = {type: is2D ? 'area' : 'rect'};\n let bordersMark: MarkDef = {type: is2D ? 'line' : 'rule'};\n const interpolate = {\n ...(errorBandDef.interpolate ? {interpolate: errorBandDef.interpolate} : {}),\n ...(errorBandDef.tension && errorBandDef.interpolate ? {tension: errorBandDef.tension} : {})\n };\n\n if (is2D) {\n bandMark = {\n ...bandMark,\n ...interpolate,\n ariaRoleDescription: 'errorband'\n };\n bordersMark = {\n ...bordersMark,\n ...interpolate,\n aria: false\n };\n } else if (errorBandDef.interpolate) {\n log.warn(log.message.errorBand1DNotSupport('interpolate'));\n } else if (errorBandDef.tension) {\n log.warn(log.message.errorBand1DNotSupport('tension'));\n }\n\n return {\n ...outerSpec,\n transform,\n layer: [\n ...makeErrorBandPart({\n partName: 'band',\n mark: bandMark,\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'lower',\n\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ]\n };\n}\n","import {Field} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {EncodingFacetMapping} from '../spec/facet';\nimport {NormalizedUnitSpec} from '../spec/unit';\nimport {keys} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {BOXPLOT, BoxPlot, BoxPlotConfigMixins, BoxPlotDef, BOXPLOT_PARTS, normalizeBoxPlot} from './boxplot';\nimport {\n ERRORBAND,\n ErrorBand,\n ErrorBandConfigMixins,\n ErrorBandDef,\n ERRORBAND_PARTS,\n normalizeErrorBand\n} from './errorband';\nimport {\n ERRORBAR,\n ErrorBar,\n ErrorBarConfigMixins,\n ErrorBarDef,\n ERRORBAR_PARTS,\n ErrorExtraEncoding,\n normalizeErrorBar\n} from './errorbar';\n\nexport {BoxPlotConfig} from './boxplot';\nexport {ErrorBandConfigMixins} from './errorband';\nexport {ErrorBarConfigMixins} from './errorbar';\n\nexport type CompositeMarkNormalizerRun = (\n spec: GenericUnitSpec,\n params: NormalizerParams\n) => NormalizedLayerSpec | NormalizedUnitSpec;\n\n/**\n * Registry index for all composite mark's normalizer\n */\nconst compositeMarkRegistry: {\n [mark: string]: {\n normalizer: CompositeMarkNormalizer;\n parts: readonly string[];\n };\n} = {};\n\nexport function add(mark: string, run: CompositeMarkNormalizerRun, parts: readonly string[]) {\n const normalizer = new CompositeMarkNormalizer(mark, run);\n compositeMarkRegistry[mark] = {normalizer, parts};\n}\n\nexport function remove(mark: string) {\n delete compositeMarkRegistry[mark];\n}\n\nexport type CompositeEncoding = Encoding & ErrorExtraEncoding;\n\nexport type PartialIndex> = {\n [t in keyof T]?: Partial;\n};\n\nexport type SharedCompositeEncoding = PartialIndex<\n Omit, 'detail' | 'order' | 'tooltip'> // need to omit and cherry pick detail / order / tooltip since they allow array\n> &\n Pick, 'detail' | 'order' | 'tooltip'>;\n\nexport type FacetedCompositeEncoding = Encoding &\n ErrorExtraEncoding &\n EncodingFacetMapping;\n\nexport type CompositeMark = BoxPlot | ErrorBar | ErrorBand;\n\nexport function getAllCompositeMarks() {\n return keys(compositeMarkRegistry);\n}\n\nexport type CompositeMarkDef = BoxPlotDef | ErrorBarDef | ErrorBandDef;\n\nexport type CompositeAggregate = BoxPlot | ErrorBar | ErrorBand;\n\nexport interface CompositeMarkConfigMixins extends BoxPlotConfigMixins, ErrorBarConfigMixins, ErrorBandConfigMixins {}\n\nadd(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS);\nadd(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS);\nadd(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS);\n","import {SignalRef, Text} from 'vega';\nimport {ConditionValueDefMixins, ValueDef} from './channeldef';\nimport {LegendConfig} from './legend';\nimport {Dict} from './util';\nimport {VgEncodeChannel} from './vega.schema';\n\nexport interface TitleMixins {\n /**\n * A title for the field. If `null`, the title will be removed.\n *\n * __Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n *\n * __Notes__:\n *\n * 1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n *\n * 2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used.\n */\n title?: Text | null | SignalRef;\n}\n\nexport interface FormatMixins {\n /**\n * When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n *\n * - If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n * - If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n *\n * See the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n *\n * When used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n *\n * __Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format.\n */\n format?: string | Dict;\n\n /**\n * The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n *\n * __Default value:__\n * - `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n * - `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.\n */\n formatType?: 'number' | 'time' | string;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.\n */\n labelExpr?: string;\n}\n\nexport interface Guide extends TitleMixins, FormatMixins {}\n\nexport interface VlOnlyGuideConfig {\n /**\n * Set to null to disable title for the axis, legend, or header.\n */\n title?: null;\n}\n\nexport type GuideEncodingConditionalValueDef = ValueDef & ConditionValueDefMixins;\n\nexport type GuideEncodingEntry = Partial>;\n\nexport const VL_ONLY_LEGEND_CONFIG: (keyof LegendConfig)[] = [\n 'gradientHorizontalMaxLength',\n 'gradientHorizontalMinLength',\n 'gradientVerticalMaxLength',\n 'gradientVerticalMinLength',\n 'unselectedOpacity'\n];\n","import {\n BaseLegend,\n LabelOverlap,\n Legend as VgLegend,\n LegendConfig as VgLegendConfig,\n LegendEncode,\n LegendOrient,\n Orientation,\n SignalRef\n} from 'vega';\nimport {DateTime} from './datetime';\nimport {Guide, GuideEncodingEntry, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\nimport {ExcludeMappedValueRefButKeepSignal, VgEncodeChannel} from './vega.schema';\n\nexport const LEGEND_SCALE_CHANNELS = [\n 'size',\n 'shape',\n 'fill',\n 'stroke',\n 'strokeDash',\n 'strokeWidth',\n 'opacity'\n] as const;\n\nexport type SignalLegendProp =\n | 'fillColor'\n | 'gradientStrokeColor'\n | 'labelColor'\n | 'strokeColor'\n | 'symbolFillColor'\n | 'symbolStrokeColor'\n | 'titleColor';\n\nexport const SIGNAL_LEGEND_PROP_INDEX: Record<\n SignalLegendProp,\n {\n part: keyof LegendEncode;\n vgProp: VgEncodeChannel;\n } | null // null if we need to convert condition to signal\n> = {\n fillColor: {\n part: 'legend',\n vgProp: 'fill'\n },\n gradientStrokeColor: {\n part: 'gradient',\n vgProp: 'stroke'\n },\n labelColor: {\n part: 'labels',\n vgProp: 'fill'\n },\n strokeColor: {\n part: 'legend',\n vgProp: 'stroke'\n },\n symbolFillColor: {\n part: 'symbols',\n vgProp: 'fill'\n },\n symbolStrokeColor: {\n part: 'symbols',\n vgProp: 'stroke'\n },\n titleColor: {\n part: 'title',\n vgProp: 'fill'\n }\n};\n\ntype BaseLegendNoValueRefs = ExcludeMappedValueRefButKeepSignal;\n\nexport interface LegendPropsWithSignal {\n fillColor?: BaseLegendNoValueRefs['fillColor'] | SignalRef;\n gradientStrokeColor?: BaseLegendNoValueRefs['gradientStrokeColor'] | SignalRef;\n labelColor?: BaseLegendNoValueRefs['labelColor'] | SignalRef;\n strokeColor?: BaseLegendNoValueRefs['strokeColor'] | SignalRef;\n symbolFillColor?: BaseLegendNoValueRefs['symbolFillColor'] | SignalRef;\n symbolStrokeColor?: BaseLegendNoValueRefs['symbolStrokeColor'] | SignalRef;\n titleColor?: BaseLegendNoValueRefs['titleColor'] | SignalRef;\n}\n\nexport type LegendConfig = LegendMixins &\n VlOnlyGuideConfig &\n Omit &\n LegendPropsWithSignal & {\n /**\n * Max legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `200`\n */\n gradientVerticalMaxLength?: number;\n\n /**\n * Min legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `100`\n */\n gradientVerticalMinLength?: number;\n\n /**\n * Max legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `200`\n */\n gradientHorizontalMaxLength?: number;\n\n /**\n * Min legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `100`\n */\n gradientHorizontalMinLength?: number;\n\n /**\n * The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient.\n *\n * __Default value:__ `undefined`. If `undefined`, the default gradient will be determined based on the following rules:\n * - For vertical gradients, `clamp(plot_height, gradientVerticalMinLength, gradientVerticalMaxLength)`\n * - For top-`orient`ed or bottom-`orient`ed horizontal gradients, `clamp(plot_width, gradientHorizontalMinLength, gradientHorizontalMaxLength)`\n * - For other horizontal gradients, `gradientHorizontalMinLength`\n *\n * where `clamp(value, min, max)` restricts _value_ to be between the specified _min_ and _max_.\n * @minimum 0\n */\n gradientLength?: number;\n\n /**\n * The opacity of unselected legend entries.\n *\n * __Default value:__ 0.35.\n */\n unselectedOpacity?: number;\n\n /**\n * Disable legend by default\n */\n disable?: boolean;\n };\n\n/**\n * Properties of a legend or boolean flag for determining whether to show it.\n */\nexport interface Legend\n extends Omit,\n LegendPropsWithSignal,\n LegendMixins,\n Guide {\n /**\n * Mark definitions for custom legend encoding.\n *\n * @hidden\n */\n encoding?: LegendEncoding;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the legend's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * The minimum desired step between legend ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.\n *\n * __Default value__: `undefined`\n */\n tickMinStep?: number | SignalRef;\n\n /**\n * Explicitly set the visible legend values.\n */\n values?: number[] | string[] | boolean[] | DateTime[] | SignalRef; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega.\n\n /**\n * The type of the legend. Use `\"symbol\"` to create a discrete legend and `\"gradient\"` for a continuous color gradient.\n *\n * __Default value:__ `\"gradient\"` for non-binned quantitative fields and temporal fields; `\"symbol\"` otherwise.\n */\n type?: 'symbol' | 'gradient';\n\n /**\n * A non-negative integer indicating the z-index of the legend.\n * If zindex is 0, legend should be drawn behind all chart elements.\n * To put them in front, use zindex = 1.\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n}\n\n// Change comments to be Vega-Lite specific\ninterface LegendMixins {\n /**\n * The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used. If set to `\"greedy\"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes).\n *\n * __Default value:__ `\"greedy\"` for `log scales otherwise `true`.\n */\n labelOverlap?: LabelOverlap | SignalRef; // override comment since our default differs from Vega\n\n /**\n * The direction of the legend, one of `\"vertical\"` or `\"horizontal\"`.\n *\n * __Default value:__\n * - For top-/bottom-`orient`ed legends, `\"horizontal\"`\n * - For left-/right-`orient`ed legends, `\"vertical\"`\n * - For top/bottom-left/right-`orient`ed legends, `\"horizontal\"` for gradient legends and `\"vertical\"` for symbol legends.\n */\n direction?: Orientation; // Omit SignalRef\n\n /**\n * The orientation of the legend, which determines how the legend is positioned within the scene. One of `\"left\"`, `\"right\"`, `\"top\"`, `\"bottom\"`, `\"top-left\"`, `\"top-right\"`, `\"bottom-left\"`, `\"bottom-right\"`, `\"none\"`.\n *\n * __Default value:__ `\"right\"`\n */\n orient?: LegendOrient; // Omit SignalRef\n}\n\nexport interface LegendEncoding {\n /**\n * Custom encoding for the legend container.\n * This can be useful for creating legend with custom x, y position.\n */\n legend?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the legend title text mark.\n */\n title?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend label text marks.\n */\n labels?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend symbol marks.\n */\n symbols?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend gradient filled rect marks.\n */\n gradient?: GuideEncodingEntry;\n}\n\nexport const defaultLegendConfig: LegendConfig = {\n gradientHorizontalMaxLength: 200,\n gradientHorizontalMinLength: 100,\n gradientVerticalMaxLength: 200,\n gradientVerticalMinLength: 64, // This is Vega's minimum.\n unselectedOpacity: 0.35\n};\n\nexport const COMMON_LEGEND_PROPERTY_INDEX: Flag = {\n aria: 1,\n clipHeight: 1,\n columnPadding: 1,\n columns: 1,\n cornerRadius: 1,\n description: 1,\n direction: 1,\n fillColor: 1,\n format: 1,\n formatType: 1,\n gradientLength: 1,\n gradientOpacity: 1,\n gradientStrokeColor: 1,\n gradientStrokeWidth: 1,\n gradientThickness: 1,\n gridAlign: 1,\n labelAlign: 1,\n labelBaseline: 1,\n labelColor: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labelSeparation: 1,\n legendX: 1,\n legendY: 1,\n offset: 1,\n orient: 1,\n padding: 1,\n rowPadding: 1,\n strokeColor: 1,\n symbolDash: 1,\n symbolDashOffset: 1,\n symbolFillColor: 1,\n symbolLimit: 1,\n symbolOffset: 1,\n symbolOpacity: 1,\n symbolSize: 1,\n symbolStrokeColor: 1,\n symbolStrokeWidth: 1,\n symbolType: 1,\n tickCount: 1,\n tickMinStep: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titleOrient: 1,\n titlePadding: 1,\n type: 1,\n values: 1,\n zindex: 1\n};\n\nexport const LEGEND_PROPERTIES = keys(COMMON_LEGEND_PROPERTY_INDEX);\n","import {Binding, Color, Cursor, Stream, Vector2} from 'vega';\nimport {isObject} from 'vega-util';\nimport {SingleDefUnitChannel} from './channel';\nimport {FieldName, PrimitiveValue} from './channeldef';\nimport {DateTime} from './datetime';\nimport {Dict} from './util';\n\nexport const SELECTION_ID = '_vgsid_';\nexport type SelectionType = 'single' | 'multi' | 'interval';\nexport type SelectionResolution = 'global' | 'union' | 'intersect';\n\nexport type SelectionInit = PrimitiveValue | DateTime;\nexport type SelectionInitInterval = Vector2 | Vector2 | Vector2 | Vector2;\n\nexport type SelectionInitMapping = Dict;\nexport type SelectionInitIntervalMapping = Dict;\n\nexport type LegendStreamBinding = {legend: string | Stream};\nexport type LegendBinding = 'legend' | LegendStreamBinding;\n\nexport interface BaseSelectionConfig {\n /**\n * Clears the selection, emptying it of all values. Can be a\n * [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n *\n * __Default value:__ `dblclick`.\n *\n * __See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation.\n */\n clear?: Stream | string | boolean;\n\n /**\n * A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\n * For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters).\n */\n on?: Stream | string;\n /**\n * With layered and multi-view displays, a strategy that determines how\n * selections' data queries are resolved when applied in a filter transform,\n * conditional encoding rule, or scale domain.\n *\n * __See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation.\n */\n resolve?: SelectionResolution;\n\n // TODO(https://github.com/vega/vega-lite/issues/2596).\n // predicate?: string;\n // domain?: SelectionDomain;\n\n /**\n * An array of encoding channels. The corresponding data field values\n * must match for a data tuple to fall within the selection.\n *\n * __See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.\n */\n encodings?: SingleDefUnitChannel[];\n\n /**\n * An array of field names whose values must match for a data tuple to\n * fall within the selection.\n *\n * __See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.\n */\n fields?: FieldName[];\n\n /**\n * By default, `all` data values are considered to lie within an empty selection.\n * When set to `none`, empty selections contain no data values.\n */\n empty?: 'all' | 'none';\n}\n\nexport interface SingleSelectionConfig extends BaseSelectionConfig {\n /**\n * When set, a selection is populated by input elements (also known as dynamic query widgets)\n * or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\n * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n *\n * Legend bindings are restricted to selections that only specify a single field or encoding.\n *\n * Query widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind)\n * or can be a mapping between projected field/encodings and binding definitions.\n *\n * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation.\n */\n bind?: Binding | Record | LegendBinding;\n\n /**\n * When true, an invisible voronoi diagram is computed to accelerate discrete\n * selection. The data value _nearest_ the mouse cursor is added to the selection.\n *\n * __See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.\n */\n nearest?: boolean;\n\n /**\n * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and initial values.\n *\n * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation.\n */\n init?: SelectionInitMapping;\n}\n\nexport interface MultiSelectionConfig extends BaseSelectionConfig {\n /**\n * Controls whether data values should be toggled or only ever inserted into\n * multi selections. Can be `true`, `false` (for insertion only), or a\n * [Vega expression](https://vega.github.io/vega/docs/expressions/).\n *\n * __Default value:__ `true`, which corresponds to `event.shiftKey` (i.e.,\n * data values are toggled when a user interacts with the shift-key pressed).\n *\n * Setting the value to the Vega expression `\"true\"` will toggle data values\n * without the user pressing the shift-key.\n *\n * __See also:__ [`toggle`](https://vega.github.io/vega-lite/docs/toggle.html) documentation.\n */\n toggle?: string | boolean;\n\n /**\n * When true, an invisible voronoi diagram is computed to accelerate discrete\n * selection. The data value _nearest_ the mouse cursor is added to the selection.\n *\n * __See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.\n */\n nearest?: boolean;\n\n /**\n * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and an initial\n * value (or array of values).\n *\n * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation.\n */\n init?: SelectionInitMapping[];\n\n /**\n * When set, a selection is populated by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\n * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n *\n * Legend bindings are restricted to selections that only specify a single field or encoding.\n */\n bind?: LegendBinding;\n}\n\n// Similar to BaseMarkConfig but the field documentations are specificly for an interval mark.\nexport interface BrushConfig {\n /**\n * The fill color of the interval mark.\n *\n * __Default value:__ `\"#333333\"`\n *\n */\n fill?: Color;\n /**\n * The fill opacity of the interval mark (a value between `0` and `1`).\n *\n * __Default value:__ `0.125`\n */\n fillOpacity?: number;\n /**\n * The stroke color of the interval mark.\n *\n * __Default value:__ `\"#ffffff\"`\n */\n stroke?: Color;\n /**\n * The stroke opacity of the interval mark (a value between `0` and `1`).\n */\n strokeOpacity?: number;\n /**\n * The stroke width of the interval mark.\n */\n strokeWidth?: number;\n /**\n * An array of alternating stroke and space lengths, for creating dashed or dotted lines.\n */\n strokeDash?: number[];\n /**\n * The offset (in pixels) with which to begin drawing the stroke dash array.\n */\n strokeDashOffset?: number;\n /**\n * The mouse cursor used over the interval mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used.\n */\n cursor?: Cursor;\n}\n\nexport interface IntervalSelectionConfig extends BaseSelectionConfig {\n /**\n * When truthy, allows a user to interactively move an interval selection\n * back-and-forth. Can be `true`, `false` (to disable panning), or a\n * [Vega event stream definition](https://vega.github.io/vega/docs/event-streams/)\n * which must include a start and end event to trigger continuous panning.\n *\n * __Default value:__ `true`, which corresponds to\n * `[mousedown, window:mouseup] > window:mousemove!` which corresponds to\n * clicks and dragging within an interval selection to reposition it.\n *\n * __See also:__ [`translate`](https://vega.github.io/vega-lite/docs/translate.html) documentation.\n */\n translate?: string | boolean;\n\n /**\n * When truthy, allows a user to interactively resize an interval selection.\n * Can be `true`, `false` (to disable zooming), or a [Vega event stream\n * definition](https://vega.github.io/vega/docs/event-streams/). Currently,\n * only `wheel` events are supported.\n *\n * __Default value:__ `true`, which corresponds to `wheel!`.\n *\n * __See also:__ [`zoom`](https://vega.github.io/vega-lite/docs/zoom.html) documentation.\n */\n zoom?: string | boolean;\n\n /**\n * Establishes a two-way binding between the interval selection and the scales\n * used within the same view. This allows a user to interactively pan and\n * zoom the view.\n *\n * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation.\n */\n bind?: 'scales';\n\n /**\n * An interval selection also adds a rectangle mark to depict the\n * extents of the interval. The `mark` property can be used to customize the\n * appearance of the mark.\n *\n * __See also:__ [`mark`](https://vega.github.io/vega-lite/docs/selection-mark.html) documentation.\n */\n mark?: BrushConfig;\n\n /**\n * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and arrays of\n * initial values.\n *\n * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation.\n */\n init?: SelectionInitIntervalMapping;\n}\n\nexport interface BaseSelectionDef {\n /**\n * Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types:\n *\n * - `\"single\"` -- to select a single discrete data value on `click`.\n * - `\"multi\"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`.\n * - `\"interval\"` -- to select a continuous range of data values on `drag`.\n */\n type: T;\n}\n\nexport interface SingleSelection extends BaseSelectionDef<'single'>, SingleSelectionConfig {}\n\nexport interface MultiSelection extends BaseSelectionDef<'multi'>, MultiSelectionConfig {}\n\nexport interface IntervalSelection extends BaseSelectionDef<'interval'>, IntervalSelectionConfig {}\n\nexport type SelectionDef = SingleSelection | MultiSelection | IntervalSelection;\n\nexport type SelectionExtent =\n | {\n /**\n * The name of a selection.\n */\n selection: string;\n /**\n * The field name to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html)\n * over multiple fields or encodings.\n */\n field?: FieldName;\n }\n | {\n /**\n * The name of a selection.\n */\n selection: string;\n /**\n * The encoding channel to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html)\n * over multiple fields or encodings.\n */\n encoding?: SingleDefUnitChannel;\n };\n\nexport interface SelectionConfig {\n /**\n * The default definition for a [`single`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations\n * for a single selection definition (except `type`) may be specified here.\n *\n * For instance, setting `single` to `{\"on\": \"dblclick\"}` populates single selections on double-click by default.\n */\n single?: SingleSelectionConfig;\n /**\n * The default definition for a [`multi`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations\n * for a multi selection definition (except `type`) may be specified here.\n *\n * For instance, setting `multi` to `{\"toggle\": \"event.altKey\"}` adds additional values to\n * multi selections when clicking with the alt-key pressed by default.\n */\n multi?: MultiSelectionConfig;\n /**\n * The default definition for an [`interval`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations\n * for an interval selection definition (except `type`) may be specified here.\n *\n * For instance, setting `interval` to `{\"translate\": false}` disables the ability to move\n * interval selections by default.\n */\n interval?: IntervalSelectionConfig;\n}\n\nexport const defaultConfig: SelectionConfig = {\n single: {\n on: 'click',\n fields: [SELECTION_ID],\n resolve: 'global',\n empty: 'all',\n clear: 'dblclick'\n },\n multi: {\n on: 'click',\n fields: [SELECTION_ID],\n toggle: 'event.shiftKey',\n resolve: 'global',\n empty: 'all',\n clear: 'dblclick'\n },\n interval: {\n on: '[mousedown, window:mouseup] > window:mousemove!',\n encodings: ['x', 'y'],\n translate: '[mousedown, window:mouseup] > window:mousemove!',\n zoom: 'wheel!',\n mark: {fill: '#333', fillOpacity: 0.125, stroke: 'white'},\n resolve: 'global',\n clear: 'dblclick'\n }\n};\n\nexport function isLegendBinding(bind: any): bind is LegendBinding {\n return !!bind && (bind === 'legend' || !!bind.legend);\n}\n\nexport function isLegendStreamBinding(bind: any): bind is LegendStreamBinding {\n return isLegendBinding(bind) && isObject(bind);\n}\n","import {GenericSpec, NormalizedSpec} from '.';\nimport {BaseSpec, BoundsMixins, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\n\n/**\n * Base layout mixins for V/HConcatSpec, which should not have RowCol generic fo its property.\n */\nexport interface OneDirectionalConcatLayout extends BoundsMixins, ResolveMixins {\n /**\n * Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean;\n\n /**\n * The spacing in pixels between sub-views of the concat operator.\n *\n * __Default value__: `10`\n */\n spacing?: number;\n}\n\n/**\n * Base interface for a generalized concatenation specification.\n */\nexport interface GenericConcatSpec>\n extends BaseSpec,\n GenericCompositionLayoutWithColumns,\n ResolveMixins {\n /**\n * A list of views to be concatenated.\n */\n concat: S[];\n}\n\n/**\n * Base interface for a vertical concatenation specification.\n */\nexport interface GenericVConcatSpec>\n extends BaseSpec,\n OneDirectionalConcatLayout {\n /**\n * A list of views to be concatenated and put into a column.\n */\n vconcat: S[];\n}\n\n/**\n * Base interface for a horizontal concatenation specification.\n */\nexport interface GenericHConcatSpec>\n extends BaseSpec,\n OneDirectionalConcatLayout {\n /**\n * A list of views to be concatenated and put into a row.\n */\n hconcat: S[];\n}\n\n/** A concat spec without any shortcut/expansion syntax */\nexport type NormalizedConcatSpec =\n | GenericConcatSpec\n | GenericVConcatSpec\n | GenericHConcatSpec;\n\nexport function isAnyConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec | GenericHConcatSpec {\n return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec);\n}\n\nexport function isConcatSpec(spec: BaseSpec): spec is GenericConcatSpec {\n return 'concat' in spec;\n}\n\nexport function isVConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec {\n return 'vconcat' in spec;\n}\n\nexport function isHConcatSpec(spec: BaseSpec): spec is GenericHConcatSpec {\n return 'hconcat' in spec;\n}\n","import {Color, Cursor, SignalRef, Text} from 'vega';\nimport {isNumber, isObject} from 'vega-util';\nimport {NormalizedSpec} from '.';\nimport {Data} from '../data';\nimport {MarkConfig} from '../mark';\nimport {Resolve} from '../resolve';\nimport {TitleParams} from '../title';\nimport {Transform} from '../transform';\nimport {Flag, keys} from '../util';\nimport {LayoutAlign, RowCol} from '../vega.schema';\nimport {isConcatSpec, isVConcatSpec} from './concat';\nimport {isFacetMapping, isFacetSpec} from './facet';\n\nexport {TopLevel} from './toplevel';\n\n/**\n * Common properties for all types of specification\n */\nexport interface BaseSpec {\n /**\n * Title for the plot.\n */\n title?: Text | TitleParams;\n\n /**\n * Name of the visualization for later reference.\n */\n name?: string;\n\n /**\n * Description of this mark for commenting purpose.\n */\n description?: string;\n\n /**\n * An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent.\n */\n data?: Data | null;\n\n /**\n * An array of data transformations such as filter and new field calculation.\n */\n transform?: Transform[];\n}\n\nexport interface DataMixins {\n /**\n * An object describing the data source.\n */\n data: Data;\n}\n\nexport interface Step {\n /**\n * The size (width/height) per discrete step.\n */\n step: number;\n}\n\nexport function isStep(size: number | Step | 'container' | 'merged'): size is Step {\n return isObject(size) && size['step'] !== undefined;\n}\n\n// TODO(https://github.com/vega/vega-lite/issues/2503): Make this generic so we can support some form of top-down sizing.\n/**\n * Common properties for specifying width and height of unit and layer specifications.\n */\nexport interface LayoutSizeMixins {\n /**\n * The width of a visualization.\n *\n * - For a plot with a continuous x-field, width should be a number.\n * - For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.)\n * - To enable responsive sizing on width, it should be set to `\"container\"`.\n *\n * __Default value:__\n * Based on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise.\n *\n * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `\"container\"` option cannot be used.\n *\n * __See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation.\n */\n width?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here.\n\n /**\n * The height of a visualization.\n *\n * - For a plot with a continuous y-field, height should be a number.\n * - For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.)\n * - To enable responsive sizing on height, it should be set to `\"container\"`.\n *\n * __Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise.\n *\n * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `\"container\"` option cannot be used.\n *\n * __See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation.\n */\n height?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here.\n}\n\nexport function isFrameMixins(o: any): o is FrameMixins {\n return o['view'] || o['width'] || o['height'];\n}\n\nexport interface FrameMixins extends LayoutSizeMixins {\n /**\n * An object defining the view background's fill and stroke.\n *\n * __Default value:__ none (transparent)\n */\n view?: ViewBackground;\n}\n\nexport type DeprecatedFrameMixins = {\n /**\n * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec.\n */\n width?: FrameMixins['width'];\n\n /**\n * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec.\n */\n height?: FrameMixins['height'];\n\n /**\n * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec.\n */\n view?: FrameMixins['view'];\n};\n\nexport interface ResolveMixins {\n /**\n * Scale, axis, and legend resolutions for view composition specifications.\n */\n resolve?: Resolve;\n}\n\nexport interface BaseViewBackground\n extends Partial<\n Pick<\n MarkConfig,\n | 'cornerRadius'\n | 'fillOpacity'\n | 'opacity'\n | 'strokeCap'\n | 'strokeDash'\n | 'strokeDashOffset'\n | 'strokeJoin'\n | 'strokeMiterLimit'\n | 'strokeOpacity'\n | 'strokeWidth'\n >\n > {\n // Override documentations for fill, stroke, and cursor\n /**\n * The fill color.\n *\n * __Default value:__ `undefined`\n */\n fill?: Color | null | SignalRef;\n\n /**\n * The stroke color.\n *\n * __Default value:__ `\"#ddd\"`\n */\n stroke?: Color | null | SignalRef;\n\n /**\n * The mouse cursor used over the view. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used.\n */\n cursor?: Cursor;\n}\n\nexport interface ViewBackground extends BaseViewBackground {\n /**\n * A string or array of strings indicating the name of custom styles to apply to the view background. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n *\n * __Default value:__ `\"cell\"`\n * __Note:__ Any specified view background properties will augment the default style.\n */\n style?: string | string[];\n}\n\nexport interface BoundsMixins {\n /**\n * The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n *\n * - If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n * - If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n *\n * __Default value:__ `\"full\"`\n */\n\n bounds?: 'full' | 'flush';\n}\n\n/**\n * Base layout for FacetSpec and RepeatSpec.\n * This is named \"GenericComposition\" layout as ConcatLayout is a GenericCompositionLayout too\n * (but _not_ vice versa).\n */\nexport interface GenericCompositionLayout extends BoundsMixins {\n /**\n * The alignment to apply to grid rows and columns.\n * The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n *\n * - For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n * - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n * - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n *\n * Alternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n *\n * __Default value:__ `\"all\"`.\n */\n align?: LayoutAlign | RowCol;\n\n /**\n * Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n *\n * An object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean | RowCol;\n\n /**\n * The spacing in pixels between sub-views of the composition operator.\n * An object of the form `{\"row\": number, \"column\": number}` can be used to set\n * different spacing values for rows and columns.\n *\n * __Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)\n */\n spacing?: number | RowCol;\n}\n\nexport const DEFAULT_SPACING = 20;\n\nexport interface ColumnMixins {\n /**\n * The number of columns to include in the view composition layout.\n *\n * __Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n * `hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n *\n * __Note__:\n *\n * 1) This property is only for:\n * - the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n * - the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n *\n * 2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).\n */\n columns?: number;\n}\n\nexport type GenericCompositionLayoutWithColumns = GenericCompositionLayout & ColumnMixins;\n\nexport type CompositionConfig = ColumnMixins & {\n /**\n * The default spacing in pixels between composed sub-views.\n *\n * __Default value__: `20`\n */\n spacing?: number;\n};\n\nexport interface CompositionConfigMixins {\n /** Default configuration for the `facet` view composition operator */\n facet?: CompositionConfig;\n\n /** Default configuration for all concatenation and repeat view composition operators (`concat`, `hconcat`, `vconcat`, and `repeat`) */\n concat?: CompositionConfig;\n}\n\nconst COMPOSITION_LAYOUT_INDEX: Flag = {\n align: 1,\n bounds: 1,\n center: 1,\n columns: 1,\n spacing: 1\n};\n\nconst COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX);\n\nexport type SpecType = 'unit' | 'facet' | 'layer' | 'concat';\n\nexport function extractCompositionLayout(\n spec: NormalizedSpec,\n specType: keyof CompositionConfigMixins,\n config: CompositionConfigMixins\n): GenericCompositionLayoutWithColumns {\n const compositionConfig = config[specType];\n const layout: GenericCompositionLayoutWithColumns = {};\n\n // Apply config first\n const {spacing: spacingConfig, columns} = compositionConfig;\n if (spacingConfig !== undefined) {\n layout.spacing = spacingConfig;\n }\n\n if (columns !== undefined) {\n if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) {\n layout.columns = columns;\n }\n }\n\n if (isVConcatSpec(spec)) {\n layout.columns = 1;\n }\n\n // Then copy properties from the spec\n for (const prop of COMPOSITION_LAYOUT_PROPERTIES) {\n if (spec[prop] !== undefined) {\n if (prop === 'spacing') {\n const spacing: number | RowCol = spec[prop];\n\n layout[prop] = isNumber(spacing)\n ? spacing\n : {\n row: spacing.row ?? spacingConfig,\n column: spacing.column ?? spacingConfig\n };\n } else {\n (layout[prop] as any) = spec[prop];\n }\n }\n }\n\n return layout;\n}\n","import {Color, InitSignal, NewSignal, RangeConfig, RangeScheme, SignalRef} from 'vega';\nimport {isObject, mergeConfig} from 'vega-util';\nimport {Axis, AxisConfigMixins, isConditionalAxisValue} from './axis';\nimport {CompositeMarkConfigMixins, getAllCompositeMarks} from './compositemark';\nimport {VL_ONLY_LEGEND_CONFIG} from './guide';\nimport {HeaderConfigMixins} from './header';\nimport {defaultLegendConfig, LegendConfig} from './legend';\nimport * as mark from './mark';\nimport {\n AnyMarkConfig,\n Mark,\n MarkConfig,\n MarkConfigMixins,\n PRIMITIVE_MARKS,\n VL_ONLY_MARK_CONFIG_PROPERTIES,\n VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n} from './mark';\nimport {ProjectionConfig} from './projection';\nimport {defaultScaleConfig, ScaleConfig} from './scale';\nimport {defaultConfig as defaultSelectionConfig, SelectionConfig} from './selection';\nimport {BaseViewBackground, CompositionConfigMixins, DEFAULT_SPACING, isStep} from './spec/base';\nimport {TopLevelProperties} from './spec/toplevel';\nimport {extractTitleConfig, TitleConfig} from './title';\nimport {duplicate, getFirstDefined, isEmpty} from './util';\n\nexport interface ViewConfig extends BaseViewBackground {\n /**\n * Default width\n *\n * __Deprecated:__ Since Vega-Lite 4.0. Please use continuousWidth and discreteWidth instead.\n */\n width?: number;\n\n /**\n * Default height\n *\n * __Deprecated:__ Since Vega-Lite 4.0. Please use continuousHeight and discreteHeight instead.\n */\n height?: number;\n\n /**\n * The default width when the plot has a continuous field for x or longitude, or has arc marks.\n *\n * __Default value:__ `200`\n */\n continuousWidth?: number;\n\n /**\n * The default width when the plot has non-arc marks and either a discrete x-field or no x-field.\n * The width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step.\n *\n * __Default value:__ a step size based on `config.view.step`.\n */\n discreteWidth?: number | {step: number};\n /**\n * The default height when the plot has a continuous y-field for x or latitude, or has arc marks.\n *\n * __Default value:__ `200`\n */\n continuousHeight?: number;\n\n /**\n * The default height when the plot has non arc marks and either a discrete y-field or no y-field.\n * The height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step.\n *\n * __Default value:__ a step size based on `config.view.step`.\n */\n discreteHeight?: number | {step: number};\n\n /**\n * Default step size for x-/y- discrete fields.\n */\n step?: number;\n\n /**\n * Whether the view should be clipped.\n */\n clip?: boolean;\n}\n\nexport function getViewConfigContinuousSize(viewConfig: ViewConfig, channel: 'width' | 'height') {\n return viewConfig[channel] ?? viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility\n}\n\nexport function getViewConfigDiscreteStep(viewConfig: ViewConfig, channel: 'width' | 'height') {\n const size = getViewConfigDiscreteSize(viewConfig, channel);\n return isStep(size) ? size.step : DEFAULT_STEP;\n}\n\nexport function getViewConfigDiscreteSize(viewConfig: ViewConfig, channel: 'width' | 'height') {\n const size = viewConfig[channel] ?? viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility\n return getFirstDefined(size, {step: viewConfig.step});\n}\n\nexport const DEFAULT_STEP = 20;\n\nexport const defaultViewConfig: ViewConfig = {\n continuousWidth: 200,\n continuousHeight: 200,\n step: DEFAULT_STEP\n};\n\nexport function isVgScheme(rangeScheme: string[] | RangeScheme): rangeScheme is RangeScheme {\n return rangeScheme && !!rangeScheme['scheme'];\n}\n\nexport type ColorConfig = Record;\n\nexport type FontSizeConfig = Record;\n\nexport interface VLOnlyConfig {\n /**\n * Default font for all text marks, titles, and labels.\n */\n font?: string;\n\n /**\n * Default color signals.\n *\n * @hidden\n */\n color?: boolean | ColorConfig;\n\n /**\n * Default font size signals.\n *\n * @hidden\n */\n fontSize?: boolean | FontSizeConfig;\n\n /**\n * Default axis and legend title for count fields.\n *\n * __Default value:__ `'Count of Records`.\n *\n * @type {string}\n */\n countTitle?: string;\n\n /**\n * Defines how Vega-Lite generates title for fields. There are three possible styles:\n * - `\"verbal\"` (Default) - displays function in a verbal style (e.g., \"Sum of field\", \"Year-month of date\", \"field (binned)\").\n * - `\"function\"` - displays function using parentheses and capitalized texts (e.g., \"SUM(field)\", \"YEARMONTH(date)\", \"BIN(field)\").\n * - `\"plain\"` - displays only the field name without functions (e.g., \"field\", \"date\", \"field\").\n */\n fieldTitle?: 'verbal' | 'functional' | 'plain';\n\n /**\n * D3 Number format for guide labels and text marks. For example `\"s\"` for SI units. Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format).\n */\n numberFormat?: string;\n\n /**\n * Default time format for raw time values (without time units) in text marks, legend labels and header labels.\n *\n * __Default value:__ `\"%b %d, %Y\"`\n * __Note:__ Axes automatically determine the format for each label automatically so this config does not affect axes.\n */\n timeFormat?: string;\n\n /**\n * Allow the `formatType` property for text marks and guides to accept a custom formatter function [registered as a Vega expression](https://vega.github.io/vega-lite/usage/compile.html#format-type).\n */\n customFormatTypes?: boolean;\n\n /** Default properties for [single view plots](https://vega.github.io/vega-lite/docs/spec.html#single). */\n view?: ViewConfig;\n\n /**\n * Scale configuration determines default properties for all [scales](https://vega.github.io/vega-lite/docs/scale.html). For a full list of scale configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config).\n */\n scale?: ScaleConfig;\n\n /** An object hash for defining default properties for each type of selections. */\n selection?: SelectionConfig;\n}\n\nexport type StyleConfigIndex = Partial> &\n MarkConfigMixins & {\n /**\n * Default style for axis, legend, and header titles.\n */\n 'guide-title'?: MarkConfig;\n\n /**\n * Default style for axis, legend, and header labels.\n */\n 'guide-label'?: MarkConfig;\n\n /**\n * Default style for chart titles\n */\n 'group-title'?: MarkConfig;\n\n /**\n * Default style for chart subtitles\n */\n 'group-subtitle'?: MarkConfig;\n };\n\nexport interface Config\n extends TopLevelProperties,\n VLOnlyConfig,\n MarkConfigMixins,\n CompositeMarkConfigMixins,\n AxisConfigMixins,\n HeaderConfigMixins,\n CompositionConfigMixins {\n /**\n * An object hash that defines default range arrays or schemes for using with scales.\n * For a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config).\n */\n range?: RangeConfig;\n\n /**\n * Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config).\n */\n legend?: LegendConfig;\n\n /**\n * Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config).\n */\n title?: TitleConfig;\n\n /**\n * Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config).\n */\n projection?: ProjectionConfig;\n\n /** An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config). */\n style?: StyleConfigIndex;\n\n /**\n * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid.\n */\n lineBreak?: string | SignalRef;\n\n /**\n * A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the `\"aria-hidden\"` attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks.\n *\n * __Default value:__ `true`.\n */\n aria?: boolean;\n\n /**\n * @hidden\n */\n signals?: (InitSignal | NewSignal)[];\n}\n\nexport const defaultConfig: Config = {\n background: 'white',\n\n padding: 5,\n timeFormat: '%b %d, %Y',\n countTitle: 'Count of Records',\n\n view: defaultViewConfig,\n\n mark: mark.defaultMarkConfig,\n\n arc: {},\n area: {},\n bar: mark.defaultBarConfig,\n circle: {},\n geoshape: {},\n image: {},\n line: {},\n point: {},\n rect: mark.defaultRectConfig,\n rule: {color: 'black'}, // Need this to override default color in mark config\n square: {},\n text: {color: 'black'}, // Need this to override default color in mark config\n tick: mark.defaultTickConfig,\n trail: {},\n\n boxplot: {\n size: 14,\n extent: 1.5,\n box: {},\n median: {color: 'white'},\n outliers: {},\n rule: {},\n ticks: null\n },\n\n errorbar: {\n center: 'mean',\n rule: true,\n ticks: false\n },\n\n errorband: {\n band: {\n opacity: 0.3\n },\n borders: false\n },\n\n scale: defaultScaleConfig,\n\n projection: {},\n\n legend: defaultLegendConfig,\n header: {titlePadding: 10, labelPadding: 10},\n headerColumn: {},\n headerRow: {},\n headerFacet: {},\n\n selection: defaultSelectionConfig,\n style: {},\n\n title: {},\n\n facet: {spacing: DEFAULT_SPACING},\n concat: {spacing: DEFAULT_SPACING}\n};\n\n// Tableau10 color palette, copied from `vegaScale.scheme('tableau10')`\nconst tab10 = [\n '#4c78a8',\n '#f58518',\n '#e45756',\n '#72b7b2',\n '#54a24b',\n '#eeca3b',\n '#b279a2',\n '#ff9da6',\n '#9d755d',\n '#bab0ac'\n];\n\nexport const DEFAULT_FONT_SIZE = {\n text: 11,\n guideLabel: 10,\n guideTitle: 11,\n groupTitle: 13,\n groupSubtitle: 12\n};\n\nexport const DEFAULT_COLOR = {\n blue: tab10[0],\n orange: tab10[1],\n red: tab10[2],\n teal: tab10[3],\n green: tab10[4],\n yellow: tab10[5],\n purple: tab10[6],\n pink: tab10[7],\n brown: tab10[8],\n gray0: '#000',\n gray1: '#111',\n gray2: '#222',\n gray3: '#333',\n gray4: '#444',\n gray5: '#555',\n gray6: '#666',\n gray7: '#777',\n gray8: '#888',\n gray9: '#999',\n gray10: '#aaa',\n gray11: '#bbb',\n gray12: '#ccc',\n gray13: '#ddd',\n gray14: '#eee',\n gray15: '#fff'\n};\n\nexport function colorSignalConfig(color: boolean | ColorConfig = {}): Config {\n return {\n signals: [\n {\n name: 'color',\n value: isObject(color) ? {...DEFAULT_COLOR, ...color} : DEFAULT_COLOR\n }\n ],\n mark: {color: {signal: 'color.blue'}},\n rule: {color: {signal: 'color.gray0'}},\n text: {\n color: {signal: 'color.gray0'}\n },\n style: {\n 'guide-label': {\n fill: {signal: 'color.gray0'}\n },\n 'guide-title': {\n fill: {signal: 'color.gray0'}\n },\n 'group-title': {\n fill: {signal: 'color.gray0'}\n },\n 'group-subtitle': {\n fill: {signal: 'color.gray0'}\n },\n cell: {\n stroke: {signal: 'color.gray8'}\n }\n },\n axis: {\n domainColor: {signal: 'color.gray13'},\n gridColor: {signal: 'color.gray8'},\n tickColor: {signal: 'color.gray13'}\n },\n range: {\n category: [\n {signal: 'color.blue'},\n {signal: 'color.orange'},\n {signal: 'color.red'},\n {signal: 'color.teal'},\n {signal: 'color.green'},\n {signal: 'color.yellow'},\n {signal: 'color.purple'},\n {signal: 'color.pink'},\n {signal: 'color.brown'},\n {signal: 'color.grey8'}\n ]\n }\n };\n}\n\nexport function fontSizeSignalConfig(fontSize: boolean | FontSizeConfig): Config {\n return {\n signals: [\n {\n name: 'fontSize',\n value: isObject(fontSize) ? {...DEFAULT_FONT_SIZE, ...fontSize} : DEFAULT_FONT_SIZE\n }\n ],\n text: {\n fontSize: {signal: 'fontSize.text'}\n },\n style: {\n 'guide-label': {\n fontSize: {signal: 'fontSize.guideLabel'}\n },\n 'guide-title': {\n fontSize: {signal: 'fontSize.guideTitle'}\n },\n 'group-title': {\n fontSize: {signal: 'fontSize.groupTitle'}\n },\n 'group-subtitle': {\n fontSize: {signal: 'fontSize.groupSubtitle'}\n }\n }\n };\n}\n\nexport function fontConfig(font: string): Config {\n return {\n text: {font},\n style: {\n 'guide-label': {font},\n 'guide-title': {font},\n 'group-title': {font},\n 'group-subtitle': {font}\n }\n };\n}\n\nexport function initConfig(config: Config = {}) {\n const {color, font, fontSize, ...restConfig} = config;\n\n return mergeConfig(\n {},\n defaultConfig,\n font ? fontConfig(font) : {},\n color ? colorSignalConfig(color) : {},\n fontSize ? fontSizeSignalConfig(fontSize) : {},\n restConfig || {}\n );\n}\n\nconst MARK_STYLES = ['view', ...PRIMITIVE_MARKS] as ('view' | Mark)[];\n\nconst VL_ONLY_CONFIG_PROPERTIES: (keyof Config)[] = [\n 'color',\n 'fontSize',\n 'background', // We apply background to the spec directly.\n 'padding',\n 'facet',\n 'concat',\n 'numberFormat',\n 'timeFormat',\n 'countTitle',\n 'header',\n\n 'axisQuantitative',\n 'axisTemporal',\n 'axisDiscrete',\n 'axisPoint',\n\n 'axisXBand',\n 'axisXPoint',\n 'axisXDiscrete',\n 'axisXQuantitative',\n 'axisXTemporal',\n\n 'axisYBand',\n 'axisYPoint',\n 'axisYDiscrete',\n 'axisYQuantitative',\n 'axisYTemporal',\n\n 'scale',\n 'selection',\n 'overlay' as keyof Config // FIXME: Redesign and unhide this\n];\n\nconst VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {\n view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'],\n ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n};\n\nexport function stripAndRedirectConfig(config: Config) {\n config = duplicate(config);\n\n for (const prop of VL_ONLY_CONFIG_PROPERTIES) {\n delete config[prop];\n }\n\n if (config.axis) {\n // delete condition axis config\n for (const prop in config.axis) {\n if (isConditionalAxisValue(config.axis[prop])) {\n delete config.axis[prop];\n }\n }\n }\n\n if (config.legend) {\n for (const prop of VL_ONLY_LEGEND_CONFIG) {\n delete config.legend[prop];\n }\n }\n\n // Remove Vega-Lite only generic mark config\n if (config.mark) {\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config.mark[prop];\n }\n\n if (config.mark.tooltip && isObject(config.mark.tooltip)) {\n delete config.mark.tooltip;\n }\n }\n\n for (const markType of MARK_STYLES) {\n // Remove Vega-Lite-only mark config\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config[markType][prop];\n }\n\n // Remove Vega-Lite only mark-specific config\n const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType];\n if (vlOnlyMarkSpecificConfigs) {\n for (const prop of vlOnlyMarkSpecificConfigs) {\n delete config[markType][prop];\n }\n }\n\n // Redirect mark config to config.style so that mark config only affect its own mark type\n // without affecting other marks that share the same underlying Vega marks.\n // For example, config.rect should not affect bar marks.\n redirectConfigToStyleConfig(config, markType);\n }\n\n for (const m of getAllCompositeMarks()) {\n // Clean up the composite mark config as we don't need them in the output specs anymore\n delete config[m];\n }\n\n redirectTitleConfig(config);\n\n // Remove empty config objects.\n for (const prop in config) {\n if (isObject(config[prop]) && isEmpty(config[prop])) {\n delete config[prop];\n }\n }\n\n return isEmpty(config) ? undefined : config;\n}\n\n/**\n *\n * Redirect config.title -- so that title config do not affect header labels,\n * which also uses `title` directive to implement.\n *\n * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles.\n */\nfunction redirectTitleConfig(config: Config) {\n const {titleMarkConfig, subtitleMarkConfig, subtitle} = extractTitleConfig(config.title);\n\n // set config.style if title/subtitleMarkConfig is not an empty object\n if (!isEmpty(titleMarkConfig)) {\n config.style['group-title'] = {\n ...config.style['group-title'],\n ...titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega\n };\n }\n if (!isEmpty(subtitleMarkConfig)) {\n config.style['group-subtitle'] = {\n ...config.style['group-subtitle'],\n ...subtitleMarkConfig\n };\n }\n\n // subtitle part can stay in config.title since header titles do not use subtitle\n if (!isEmpty(subtitle)) {\n config.title = subtitle;\n } else {\n delete config.title;\n }\n}\n\nfunction redirectConfigToStyleConfig(\n config: Config,\n prop: Mark | 'view' | string, // string = composite mark\n toProp?: string,\n compositeMarkPart?: string\n) {\n const propConfig: MarkConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop];\n\n if (prop === 'view') {\n toProp = 'cell'; // View's default style is \"cell\"\n }\n\n const style: MarkConfig = {\n ...propConfig,\n ...(config.style[toProp ?? prop] as MarkConfig)\n };\n\n // set config.style if it is not an empty object\n if (!isEmpty(style)) {\n config.style[toProp ?? prop] = style;\n }\n\n if (!compositeMarkPart) {\n // For composite mark, so don't delete the whole config yet as we have to do multiple redirections.\n delete config[prop];\n }\n}\n","import {SharedCompositeEncoding} from '../compositemark';\nimport {Projection} from '../projection';\nimport {BaseSpec, FrameMixins, ResolveMixins} from './base';\nimport {GenericUnitSpec, NormalizedUnitSpec, UnitSpec} from './unit';\n\n/**\n * Base interface for a layer specification.\n */\nexport interface GenericLayerSpec> extends BaseSpec, FrameMixins, ResolveMixins {\n /**\n * Layer or single view specifications to be layered.\n *\n * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.\n */\n layer: (GenericLayerSpec | U)[];\n}\n\n/**\n * A full layered plot specification, which may contains `encoding` and `projection` properties that will be applied to underlying unit (single-view) specifications.\n */\nexport interface LayerSpec extends BaseSpec, FrameMixins, ResolveMixins {\n /**\n * Layer or single view specifications to be layered.\n *\n * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.\n */\n layer: (LayerSpec | UnitSpec)[];\n\n /**\n * A shared key-value mapping between encoding channels and definition of fields in the underlying layers.\n */\n encoding?: SharedCompositeEncoding;\n\n /**\n * An object defining properties of the geographic projection shared by underlying layers.\n */\n projection?: Projection;\n}\n\n/**\n * A layered specification without any shortcut/expansion syntax.\n */\nexport type NormalizedLayerSpec = GenericLayerSpec;\n\nexport function isLayerSpec(spec: BaseSpec): spec is GenericLayerSpec {\n return 'layer' in spec;\n}\n","import {isArray} from 'vega-util';\nimport {GenericSpec, LayerSpec} from '.';\nimport {FieldName} from '../channeldef';\nimport {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\nimport {FacetedUnitSpec, UnitSpec} from './unit';\n\nexport interface RepeatMapping {\n /**\n * An array of fields to be repeated vertically.\n */\n row?: string[];\n\n /**\n * An array of fields to be repeated horizontally.\n */\n column?: string[];\n}\n\nexport interface LayerRepeatMapping extends RepeatMapping {\n /**\n * An array of fields to be repeated as layers.\n */\n layer: string[];\n}\n\nexport type RepeatSpec = NonLayerRepeatSpec | LayerRepeatSpec;\n\n/**\n * Base interface for a repeat specification.\n */\nexport interface NonLayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for fields to be repeated. One of:\n * 1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n * 2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively.\n */\n repeat: string[] | RepeatMapping;\n\n /**\n * A specification of the view that gets repeated.\n */\n spec: GenericSpec;\n}\n\nexport interface LayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for fields to be repeated. One of:\n * 1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n * 2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively.\n */\n repeat: LayerRepeatMapping;\n\n /**\n * A specification of the view that gets repeated.\n */\n spec: LayerSpec | UnitSpec;\n}\n\nexport function isRepeatSpec(spec: BaseSpec): spec is RepeatSpec {\n return 'repeat' in spec;\n}\n\nexport function isLayerRepeatSpec(spec: RepeatSpec): spec is LayerRepeatSpec {\n return !isArray(spec.repeat) && spec.repeat['layer'];\n}\n","import {GenericSpec} from '.';\nimport * as log from '../log';\nimport {Field, FieldName} from '../channeldef';\nimport {\n GenericConcatSpec,\n GenericHConcatSpec,\n GenericVConcatSpec,\n isConcatSpec,\n isHConcatSpec,\n isVConcatSpec\n} from './concat';\nimport {GenericFacetSpec, isFacetSpec} from './facet';\nimport {GenericLayerSpec, isLayerSpec} from './layer';\nimport {isRepeatSpec, RepeatSpec} from './repeat';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from './unit';\n\nexport abstract class SpecMapper<\n P,\n UI extends GenericUnitSpec,\n LI extends GenericLayerSpec = GenericLayerSpec,\n UO extends GenericUnitSpec = NormalizedUnitSpec,\n RO extends RepeatSpec = never,\n FO extends Field = FieldName\n> {\n public map(spec: GenericSpec, params: P): GenericSpec, RO, FO> {\n if (isFacetSpec(spec)) {\n return this.mapFacet(spec, params);\n } else if (isRepeatSpec(spec)) {\n return this.mapRepeat(spec, params);\n } else if (isHConcatSpec(spec)) {\n return this.mapHConcat(spec, params);\n } else if (isVConcatSpec(spec)) {\n return this.mapVConcat(spec, params);\n } else if (isConcatSpec(spec)) {\n return this.mapConcat(spec, params);\n } else {\n return this.mapLayerOrUnit(spec, params);\n }\n }\n\n public mapLayerOrUnit(spec: UI | LI, params: P): UO | GenericLayerSpec {\n if (isLayerSpec(spec)) {\n return this.mapLayer(spec, params);\n } else if (isUnitSpec(spec)) {\n return this.mapUnit(spec, params);\n }\n throw new Error(log.message.invalidSpec(spec));\n }\n\n public abstract mapUnit(spec: UI, params: P): UO | GenericLayerSpec;\n\n protected mapLayer(spec: LI, params: P): GenericLayerSpec {\n return {\n ...spec,\n layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params))\n };\n }\n\n protected mapHConcat(\n spec: GenericHConcatSpec>,\n params: P\n ): GenericHConcatSpec, RO, FO>> {\n return {\n ...spec,\n hconcat: spec.hconcat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapVConcat(\n spec: GenericVConcatSpec>,\n params: P\n ): GenericVConcatSpec, RO, FO>> {\n return {\n ...spec,\n vconcat: spec.vconcat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapConcat(\n spec: GenericConcatSpec>,\n params: P\n ): GenericConcatSpec, RO, FO>> {\n const {concat, ...rest} = spec;\n\n return {\n ...rest,\n concat: concat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapFacet(spec: GenericFacetSpec, params: P): GenericFacetSpec, FO> {\n return {\n // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef\n ...(spec as any),\n // TODO: remove \"any\" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760\n spec: this.map(spec.spec, params) as any\n };\n }\n\n protected mapRepeat(spec: RepeatSpec, params: P): GenericSpec {\n return {\n ...spec,\n // as any is required here since TS cannot infer that the output type satisfies the input type\n spec: this.map(spec.spec as any, params)\n };\n }\n}\n","import {array, isBoolean} from 'vega-util';\nimport {SUM_OPS} from './aggregate';\nimport {getSecondaryRangeChannel, NonPositionChannel, NONPOSITION_CHANNELS} from './channel';\nimport {\n channelDefType,\n FieldName,\n getFieldDef,\n isFieldDef,\n isFieldOrDatumDef,\n PositionDatumDef,\n PositionFieldDef,\n TypedFieldDef,\n vgField\n} from './channeldef';\nimport {channelHasField, Encoding, isAggregate} from './encoding';\nimport * as log from './log';\nimport {\n ARC,\n AREA,\n BAR,\n CIRCLE,\n isMarkDef,\n isPathMark,\n LINE,\n Mark,\n MarkDef,\n POINT,\n RULE,\n SQUARE,\n TEXT,\n TICK\n} from './mark';\nimport {ScaleType} from './scale';\nimport {contains} from './util';\n\nconst STACK_OFFSET_INDEX = {\n zero: 1,\n center: 1,\n normalize: 1\n} as const;\n\nexport type StackOffset = keyof typeof STACK_OFFSET_INDEX;\n\nexport function isStackOffset(s: string): s is StackOffset {\n return s in STACK_OFFSET_INDEX;\n}\n\nexport interface StackProperties {\n /** Dimension axis of the stack. */\n groupbyChannel?: 'x' | 'y' | 'theta' | 'radius';\n\n /** Field for groupbyChannel. */\n groupbyField?: FieldName;\n\n /** Measure axis of the stack. */\n fieldChannel: 'x' | 'y' | 'theta' | 'radius';\n\n /** Stack-by fields e.g., color, detail */\n stackBy: {\n fieldDef: TypedFieldDef;\n channel: NonPositionChannel;\n }[];\n\n /**\n * See `stack` property of Position Field Def.\n */\n offset: StackOffset;\n\n /**\n * Whether this stack will produce impute transform\n */\n impute: boolean;\n}\n\nexport const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]);\nexport const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]);\n\nfunction potentialStackedChannel(\n encoding: Encoding,\n x: 'x' | 'theta'\n): 'x' | 'y' | 'theta' | 'radius' | undefined {\n const y = x === 'x' ? 'y' : 'radius';\n\n const xDef = encoding[x];\n const yDef = encoding[y];\n\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n if (channelDefType(xDef) === 'quantitative' && channelDefType(yDef) === 'quantitative') {\n if (xDef.stack) {\n return x;\n } else if (yDef.stack) {\n return y;\n }\n const xAggregate = isFieldDef(xDef) && !!xDef.aggregate;\n const yAggregate = isFieldDef(yDef) && !!yDef.aggregate;\n // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y\n if (xAggregate !== yAggregate) {\n return xAggregate ? x : y;\n } else {\n const xScale = xDef.scale?.type;\n const yScale = yDef.scale?.type;\n\n if (xScale && xScale !== 'linear') {\n return y;\n } else if (yScale && yScale !== 'linear') {\n return x;\n }\n }\n } else if (channelDefType(xDef) === 'quantitative') {\n return x;\n } else if (channelDefType(yDef) === 'quantitative') {\n return y;\n }\n } else if (channelDefType(xDef) === 'quantitative') {\n return x;\n } else if (channelDefType(yDef) === 'quantitative') {\n return y;\n }\n return undefined;\n}\n\nfunction getDimensionChannel(channel: 'x' | 'y' | 'theta' | 'radius') {\n switch (channel) {\n case 'x':\n return 'y';\n case 'y':\n return 'x';\n case 'theta':\n return 'radius';\n case 'radius':\n return 'theta';\n }\n}\n\n// Note: CompassQL uses this method and only pass in required properties of each argument object.\n// If required properties change, make sure to update CompassQL.\nexport function stack(\n m: Mark | MarkDef,\n encoding: Encoding,\n opt: {\n disallowNonLinearStack?: boolean; // This option is for CompassQL\n } = {}\n): StackProperties {\n const mark = isMarkDef(m) ? m.type : m;\n // Should have stackable mark\n if (!STACKABLE_MARKS.has(mark)) {\n return null;\n }\n\n // Run potential stacked twice, one for Cartesian and another for Polar,\n // so text marks can be stacked in any of the coordinates.\n\n // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking.\n // However, since we probably never want to do that, let's just note the limitation here.\n const fieldChannel = potentialStackedChannel(encoding, 'x') || potentialStackedChannel(encoding, 'theta');\n\n if (!fieldChannel) {\n return null;\n }\n\n const stackedFieldDef = encoding[fieldChannel] as PositionFieldDef | PositionDatumDef;\n const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined;\n\n let dimensionChannel: 'x' | 'y' | 'theta' | 'radius' = getDimensionChannel(fieldChannel);\n let dimensionDef = encoding[dimensionChannel];\n\n let dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined;\n\n // avoid grouping by the stacked field\n if (dimensionField === stackedField) {\n dimensionField = undefined;\n dimensionDef = undefined;\n dimensionChannel = undefined;\n }\n\n // Should have grouping level of detail that is different from the dimension field\n const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => {\n // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001)\n if (channel !== 'tooltip' && channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n for (const cDef of array(channelDef)) {\n const fieldDef = getFieldDef(cDef);\n if (fieldDef.aggregate) {\n continue;\n }\n\n // Check whether the channel's field is identical to x/y's field or if the channel is a repeat\n const f = vgField(fieldDef, {});\n if (\n // if fielddef is a repeat, just include it in the stack by\n !f ||\n // otherwise, the field must be different from x and y fields.\n f !== dimensionField\n ) {\n sc.push({channel, fieldDef});\n }\n }\n }\n return sc;\n }, []);\n\n // Automatically determine offset\n let offset: StackOffset;\n if (stackedFieldDef.stack !== undefined) {\n if (isBoolean(stackedFieldDef.stack)) {\n offset = stackedFieldDef.stack ? 'zero' : null;\n } else {\n offset = stackedFieldDef.stack;\n }\n } else if (stackBy.length > 0 && STACK_BY_DEFAULT_MARKS.has(mark)) {\n // Bar and Area with sum ops are automatically stacked by default\n offset = 'zero';\n }\n\n if (!offset || !isStackOffset(offset)) {\n return null;\n }\n\n if (isAggregate(encoding) && stackBy.length === 0) {\n return null;\n }\n\n // warn when stacking non-linear\n if (stackedFieldDef.scale && stackedFieldDef.scale.type && stackedFieldDef.scale.type !== ScaleType.LINEAR) {\n if (opt.disallowNonLinearStack) {\n return null;\n } else {\n log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type));\n }\n }\n\n // Check if it is a ranged mark\n if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) {\n if (stackedFieldDef.stack !== undefined) {\n log.warn(log.message.cannotStackRangedMark(fieldChannel));\n }\n return null;\n }\n\n // Warn if stacking non-summative aggregate\n if (isFieldDef(stackedFieldDef) && stackedFieldDef.aggregate && !contains(SUM_OPS, stackedFieldDef.aggregate)) {\n log.warn(log.message.stackNonSummativeAggregate(stackedFieldDef.aggregate));\n }\n\n return {\n groupbyChannel: dimensionDef ? dimensionChannel : undefined,\n groupbyField: dimensionField,\n fieldChannel,\n impute: stackedFieldDef.impute === null ? false : isPathMark(mark),\n stackBy,\n offset\n };\n}\n","import {isObject} from 'vega-util';\nimport {Config} from '../config';\nimport {Encoding, normalizeEncoding} from '../encoding';\nimport {AreaConfig, isMarkDef, LineConfig, Mark, MarkConfig, MarkDef} from '../mark';\nimport {GenericUnitSpec, NormalizedUnitSpec} from '../spec';\nimport {isUnitSpec} from '../spec/unit';\nimport {stack} from '../stack';\nimport {keys, omit, pick} from '../util';\nimport {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base';\n\ntype UnitSpecWithPathOverlay = GenericUnitSpec, Mark | MarkDef<'line' | 'area' | 'rule' | 'trail'>>;\n\nfunction dropLineAndPoint(markDef: MarkDef): MarkDef | Mark {\n const {point: _point, line: _line, ...mark} = markDef;\n\n return keys(mark).length > 1 ? mark : mark.type;\n}\n\nfunction dropLineAndPointFromConfig(config: Config) {\n for (const mark of ['line', 'area', 'rule', 'trail'] as const) {\n if (config[mark]) {\n config = {\n ...config,\n // TODO: remove as any\n [mark]: omit(config[mark], ['point', 'line'] as any)\n };\n }\n }\n return config;\n}\n\nfunction getPointOverlay(markDef: MarkDef, markConfig: LineConfig = {}, encoding: Encoding): MarkConfig {\n if (markDef.point === 'transparent') {\n return {opacity: 0};\n } else if (markDef.point) {\n // truthy : true or object\n return isObject(markDef.point) ? markDef.point : {};\n } else if (markDef.point !== undefined) {\n // false or null\n return null;\n } else {\n // undefined (not disabled)\n if (markConfig.point || encoding.shape) {\n // enable point overlay if config[mark].point is truthy or if encoding.shape is provided\n return isObject(markConfig.point) ? markConfig.point : {};\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\n\nfunction getLineOverlay(markDef: MarkDef, markConfig: AreaConfig = {}): MarkConfig {\n if (markDef.line) {\n // true or object\n return markDef.line === true ? {} : markDef.line;\n } else if (markDef.line !== undefined) {\n // false or null\n return null;\n } else {\n // undefined (not disabled)\n if (markConfig.line) {\n // enable line overlay if config[mark].line is truthy\n return markConfig.line === true ? {} : markConfig.line;\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\n\nexport class PathOverlayNormalizer implements NonFacetUnitNormalizer {\n public name = 'path-overlay';\n\n public hasMatchingType(spec: GenericUnitSpec, config: Config): spec is UnitSpecWithPathOverlay {\n if (isUnitSpec(spec)) {\n const {mark, encoding} = spec;\n const markDef = isMarkDef(mark) ? mark : {type: mark};\n switch (markDef.type) {\n case 'line':\n case 'rule':\n case 'trail':\n return !!getPointOverlay(markDef, config[markDef.type], encoding);\n case 'area':\n return (\n // false / null are also included as we want to remove the properties\n !!getPointOverlay(markDef, config[markDef.type], encoding) ||\n !!getLineOverlay(markDef, config[markDef.type])\n );\n }\n }\n return false;\n }\n\n public run(spec: UnitSpecWithPathOverlay, params: NormalizerParams, normalize: NormalizeLayerOrUnit) {\n const {config} = params;\n const {selection, projection, mark, encoding: e, ...outerSpec} = spec;\n\n // Need to call normalizeEncoding because we need the inferred types to correctly determine stack\n const encoding = normalizeEncoding(e, config);\n\n const markDef: MarkDef = isMarkDef(mark) ? mark : {type: mark};\n\n const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding);\n const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]);\n\n const layer: NormalizedUnitSpec[] = [\n {\n ...(selection ? {selection} : {}),\n mark: dropLineAndPoint({\n // TODO: extract this 0.7 to be shared with default opacity for point/tick/...\n ...(markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined\n ? {opacity: 0.7}\n : {}),\n ...markDef\n }),\n // drop shape from encoding as this might be used to trigger point overlay\n encoding: omit(encoding, ['shape'])\n }\n ];\n\n // FIXME: determine rules for applying selections.\n\n // Need to copy stack config to overlayed layer\n const stackProps = stack(markDef, encoding);\n\n let overlayEncoding = encoding;\n if (stackProps) {\n const {fieldChannel: stackFieldChannel, offset} = stackProps;\n overlayEncoding = {\n ...encoding,\n [stackFieldChannel]: {\n ...encoding[stackFieldChannel],\n ...(offset ? {stack: offset} : {})\n }\n };\n }\n\n if (lineOverlay) {\n layer.push({\n ...(projection ? {projection} : {}),\n mark: {\n type: 'line',\n ...pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip']),\n ...lineOverlay\n },\n encoding: overlayEncoding\n });\n }\n if (pointOverlay) {\n layer.push({\n ...(projection ? {projection} : {}),\n mark: {\n type: 'point',\n opacity: 1,\n filled: true,\n ...pick(markDef, ['clip', 'tooltip']),\n ...pointOverlay\n },\n encoding: overlayEncoding\n });\n }\n\n return normalize(\n {\n ...outerSpec,\n layer\n },\n {\n ...params,\n config: dropLineAndPointFromConfig(config)\n }\n );\n }\n}\n","import {getSizeChannel, POSITION_SCALE_CHANNELS} from '../channel';\nimport {isFieldOrDatumDef} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {Scale} from '../scale';\nimport {GenericSpec} from '../spec';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {isEmpty} from '../util';\nimport {NonFacetUnitNormalizer} from './base';\n\ntype UnitSpecWithRangeStep = GenericUnitSpec, any>; // this is not accurate, but it's not worth making it accurate\n\nexport class RangeStepNormalizer implements NonFacetUnitNormalizer {\n public name = 'RangeStep';\n\n public hasMatchingType(spec: GenericSpec): spec is UnitSpecWithRangeStep {\n if (isUnitSpec(spec) && spec.encoding) {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const def = spec.encoding[channel];\n if (def && isFieldOrDatumDef(def)) {\n if (def?.scale?.['rangeStep']) {\n return true;\n }\n }\n }\n }\n return false;\n }\n\n public run(spec: UnitSpecWithRangeStep): NormalizedUnitSpec {\n const sizeMixins = {};\n let encoding = {...spec.encoding};\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n const def = encoding[channel];\n if (def && isFieldOrDatumDef(def)) {\n if (def?.scale?.['rangeStep']) {\n const {scale, ...defWithoutScale} = def;\n\n const {rangeStep, ...scaleWithoutRangeStep} = scale as Scale & {rangeStep: number};\n sizeMixins[sizeType] = {step: scale['rangeStep']};\n\n log.warn(log.message.RANGE_STEP_DEPRECATED);\n\n encoding = {\n ...encoding,\n [channel]: {\n ...defWithoutScale,\n ...(isEmpty(scaleWithoutRangeStep) ? {} : {scale: scaleWithoutRangeStep})\n }\n };\n }\n }\n }\n return {\n ...sizeMixins,\n ...spec,\n encoding\n };\n }\n}\n","import {hasOwnProperty, isArray} from 'vega-util';\nimport {\n ChannelDef,\n DatumDef,\n Field,\n FieldDef,\n FieldName,\n hasConditionalFieldOrDatumDef,\n isConditionalDef,\n isFieldDef,\n isFieldOrDatumDef,\n isRepeatRef,\n isSortableFieldDef,\n ScaleFieldDef,\n ValueDef\n} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {isSortField} from '../sort';\nimport {FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet';\n\nexport interface RepeaterValue {\n row?: string;\n column?: string;\n\n repeat?: string;\n\n layer?: string;\n}\n\nexport function replaceRepeaterInFacet(\n facet: FacetFieldDef | FacetMapping,\n repeater: RepeaterValue\n): FacetFieldDef | FacetMapping {\n if (!repeater) {\n return facet as FacetFieldDef;\n }\n\n if (isFacetMapping(facet)) {\n return replaceRepeaterInMapping(facet, repeater) as FacetMapping;\n }\n return replaceRepeaterInFieldDef(facet, repeater) as FacetFieldDef;\n}\n\nexport function replaceRepeaterInEncoding>(\n encoding: E,\n repeater: RepeaterValue\n): Encoding {\n if (!repeater) {\n return encoding as Encoding;\n }\n\n return replaceRepeaterInMapping(encoding, repeater) as Encoding;\n}\n\n/**\n * Replaces repeated value and returns if the repeated value is valid.\n */\nfunction replaceRepeatInProp(prop: keyof T, o: T, repeater: RepeaterValue): T {\n const val = o[prop];\n if (isRepeatRef(val)) {\n if (val.repeat in repeater) {\n return {...o, [prop]: repeater[val.repeat]};\n } else {\n log.warn(log.message.noSuchRepeatedValue(val.repeat));\n return undefined;\n }\n }\n return o;\n}\n\n/**\n * Replace repeater values in a field def with the concrete field name.\n */\n\nfunction replaceRepeaterInFieldDef(fieldDef: FieldDef, repeater: RepeaterValue) {\n fieldDef = replaceRepeatInProp('field', fieldDef, repeater);\n\n if (fieldDef === undefined) {\n // the field def should be ignored\n return undefined;\n } else if (fieldDef === null) {\n return null;\n }\n\n if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) {\n const sort = replaceRepeatInProp('field', fieldDef.sort, repeater);\n fieldDef = {\n ...fieldDef,\n ...(sort ? {sort} : {})\n };\n }\n\n return fieldDef as ScaleFieldDef;\n}\n\nfunction replaceRepeaterInFieldOrDatumDef(def: FieldDef | DatumDef, repeater: RepeaterValue) {\n if (isFieldDef(def)) {\n return replaceRepeaterInFieldDef(def, repeater);\n } else {\n const datumDef = replaceRepeatInProp('datum', def, repeater);\n if (datumDef !== def && !datumDef.type) {\n datumDef.type = 'nominal';\n }\n return datumDef;\n }\n}\n\nfunction replaceRepeaterInChannelDef(channelDef: ChannelDef, repeater: RepeaterValue) {\n if (isFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater);\n if (fd) {\n return fd;\n } else if (isConditionalDef>(channelDef)) {\n return {condition: channelDef.condition};\n }\n } else {\n if (hasConditionalFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater);\n if (fd) {\n return {\n ...channelDef,\n condition: fd\n } as ChannelDef;\n } else {\n const {condition, ...channelDefWithoutCondition} = channelDef;\n return channelDefWithoutCondition as ChannelDef;\n }\n }\n return channelDef as ValueDef;\n }\n return undefined;\n}\n\ntype EncodingOrFacet = Encoding | FacetMapping;\n\nfunction replaceRepeaterInMapping(\n mapping: EncodingOrFacet,\n repeater: RepeaterValue\n): EncodingOrFacet {\n const out: EncodingOrFacet = {};\n for (const channel in mapping) {\n if (hasOwnProperty(mapping, channel)) {\n const channelDef: ChannelDef | ChannelDef[] = mapping[channel];\n\n if (isArray(channelDef)) {\n // array cannot have condition\n out[channel] = (channelDef as ChannelDef[]) // somehow we need to cast it here\n .map(cd => replaceRepeaterInChannelDef(cd, repeater))\n .filter(cd => cd);\n } else {\n const cd = replaceRepeaterInChannelDef(channelDef, repeater);\n if (cd !== undefined) {\n out[channel] = cd;\n }\n }\n }\n }\n return out;\n}\n","import {isBinned} from '../bin';\nimport {getMainRangeChannel, SECONDARY_RANGE_CHANNEL} from '../channel';\nimport {Field, isDatumDef, isFieldDef} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {GenericSpec} from '../spec';\nimport {GenericUnitSpec, isUnitSpec} from '../spec/unit';\nimport {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base';\n\ninterface EncodingX2Mixins {\n x2: Encoding['x2'];\n}\n\ninterface EncodingY2Mixins {\n y2: Encoding['y2'];\n}\n\ntype RangedLineSpec = GenericUnitSpec & (EncodingX2Mixins | EncodingY2Mixins), 'line'>;\n\nexport class RuleForRangedLineNormalizer implements NonFacetUnitNormalizer {\n public name = 'RuleForRangedLine';\n\n public hasMatchingType(spec: GenericSpec): spec is RangedLineSpec {\n if (isUnitSpec(spec)) {\n const {encoding, mark} = spec;\n if (mark === 'line') {\n for (const channel of SECONDARY_RANGE_CHANNEL) {\n const mainChannel = getMainRangeChannel(channel);\n const mainChannelDef = encoding[mainChannel];\n\n if (encoding[channel]) {\n if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) {\n return true;\n }\n }\n }\n }\n }\n return false;\n }\n\n public run(spec: RangedLineSpec, params: NormalizerParams, normalize: NormalizeLayerOrUnit) {\n const {encoding} = spec;\n log.warn(log.message.lineWithRange(!!encoding.x2, !!encoding.y2));\n\n return normalize(\n {\n ...spec,\n mark: 'rule'\n },\n params\n );\n }\n}\n","import {isArray} from 'vega-util';\nimport {COLUMN, FACET, ROW} from '../channel';\nimport {Field, FieldName, hasConditionalFieldOrDatumDef, isFieldOrDatumDef, isValueDef} from '../channeldef';\nimport {SharedCompositeEncoding} from '../compositemark';\nimport {boxPlotNormalizer} from '../compositemark/boxplot';\nimport {errorBandNormalizer} from '../compositemark/errorband';\nimport {errorBarNormalizer} from '../compositemark/errorbar';\nimport {channelHasField, Encoding} from '../encoding';\nimport * as log from '../log';\nimport {Projection} from '../projection';\nimport {FacetedUnitSpec, GenericSpec, LayerSpec, UnitSpec} from '../spec';\nimport {GenericCompositionLayoutWithColumns} from '../spec/base';\nimport {GenericConcatSpec} from '../spec/concat';\nimport {\n FacetEncodingFieldDef,\n FacetFieldDef,\n FacetMapping,\n GenericFacetSpec,\n isFacetMapping,\n NormalizedFacetSpec\n} from '../spec/facet';\nimport {NormalizedSpec} from '../spec/index';\nimport {NormalizedLayerSpec} from '../spec/layer';\nimport {SpecMapper} from '../spec/map';\nimport {isLayerRepeatSpec, LayerRepeatSpec, NonLayerRepeatSpec, RepeatSpec} from '../spec/repeat';\nimport {isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {isEmpty, keys, omit, varName} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {NonFacetUnitNormalizer, NormalizerParams} from './base';\nimport {PathOverlayNormalizer} from './pathoverlay';\nimport {RangeStepNormalizer} from './rangestep';\nimport {replaceRepeaterInEncoding, replaceRepeaterInFacet} from './repeater';\nimport {RuleForRangedLineNormalizer} from './ruleforrangedline';\n\nexport class CoreNormalizer extends SpecMapper {\n private nonFacetUnitNormalizers: NonFacetUnitNormalizer[] = [\n boxPlotNormalizer,\n errorBarNormalizer,\n errorBandNormalizer,\n new PathOverlayNormalizer(),\n new RuleForRangedLineNormalizer(),\n new RangeStepNormalizer()\n ];\n\n public map(spec: GenericSpec, params: NormalizerParams) {\n // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec.\n if (isUnitSpec(spec)) {\n const hasRow = channelHasField(spec.encoding, ROW);\n const hasColumn = channelHasField(spec.encoding, COLUMN);\n const hasFacet = channelHasField(spec.encoding, FACET);\n\n if (hasRow || hasColumn || hasFacet) {\n return this.mapFacetedUnit(spec, params);\n }\n }\n\n return super.map(spec, params);\n }\n\n // This is for normalizing non-facet unit\n public mapUnit(spec: UnitSpec, params: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec {\n const {parentEncoding, parentProjection} = params;\n\n const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater);\n\n const specWithReplacedEncoding = {\n ...spec,\n ...(encoding ? {encoding} : {})\n };\n\n if (parentEncoding || parentProjection) {\n return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params);\n }\n\n const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this);\n\n for (const unitNormalizer of this.nonFacetUnitNormalizers) {\n if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) {\n return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit);\n }\n }\n\n return specWithReplacedEncoding as NormalizedUnitSpec;\n }\n\n protected mapRepeat(\n spec: RepeatSpec,\n params: NormalizerParams\n ): GenericConcatSpec | NormalizedLayerSpec {\n if (isLayerRepeatSpec(spec)) {\n return this.mapLayerRepeat(spec, params);\n } else {\n return this.mapNonLayerRepeat(spec, params);\n }\n }\n\n private mapLayerRepeat(\n spec: LayerRepeatSpec,\n params: NormalizerParams\n ): GenericConcatSpec | NormalizedLayerSpec {\n const {repeat, spec: childSpec, ...rest} = spec;\n const {row, column, layer} = repeat;\n\n const {repeater = {}, repeaterPrefix = ''} = params;\n\n if (row || column) {\n return this.mapRepeat(\n {\n ...spec,\n repeat: {\n ...(row ? {row} : {}),\n ...(column ? {column} : {})\n },\n spec: {\n repeat: {layer},\n spec: childSpec\n }\n },\n params\n );\n } else {\n return {\n ...rest,\n layer: layer.map(layerValue => {\n const childRepeater = {\n ...repeater,\n layer: layerValue\n };\n\n const childName = (childSpec.name || '') + repeaterPrefix + `child__layer_${varName(layerValue)}`;\n\n const child = this.mapLayerOrUnit(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName});\n child.name = childName;\n\n return child;\n })\n };\n }\n }\n\n private mapNonLayerRepeat(spec: NonLayerRepeatSpec, params: NormalizerParams): GenericConcatSpec {\n const {repeat, spec: childSpec, data, ...remainingProperties} = spec;\n\n if (!isArray(repeat) && spec.columns) {\n // is repeat with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('repeat'));\n }\n\n const concat: NormalizedSpec[] = [];\n\n const {repeater = {}, repeaterPrefix = ''} = params;\n\n const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null];\n const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null];\n\n const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null];\n\n // cross product\n for (const repeatValue of repeatValues) {\n for (const rowValue of row) {\n for (const columnValue of column) {\n const childRepeater = {\n repeat: repeatValue,\n row: rowValue,\n column: columnValue,\n layer: repeater.layer\n };\n\n const childName =\n (childSpec.name || '') +\n repeaterPrefix +\n 'child__' +\n (isArray(repeat)\n ? `${varName(repeatValue)}`\n : (repeat.row ? `row_${varName(rowValue)}` : '') +\n (repeat.column ? `column_${varName(columnValue)}` : ''));\n\n const child = this.map(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName});\n child.name = childName;\n\n // we move data up\n concat.push(omit(child, ['data']) as NormalizedSpec);\n }\n }\n }\n\n const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1;\n return {\n data: childSpec.data ?? data, // data from child spec should have precedence\n align: 'all',\n ...remainingProperties,\n columns,\n concat\n };\n }\n\n protected mapFacet(\n spec: GenericFacetSpec,\n params: NormalizerParams\n ): GenericFacetSpec {\n const {facet} = spec;\n\n if (isFacetMapping(facet) && spec.columns) {\n // is facet with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('facet'));\n }\n\n return super.mapFacet(spec, params);\n }\n\n private mapUnitWithParentEncodingOrProjection(\n spec: FacetedUnitSpec,\n params: NormalizerParams\n ): NormalizedUnitSpec | NormalizedLayerSpec {\n const {encoding, projection} = spec;\n const {parentEncoding, parentProjection, config} = params;\n const mergedProjection = mergeProjection({parentProjection, projection});\n const mergedEncoding = mergeEncoding({\n parentEncoding,\n encoding: replaceRepeaterInEncoding(encoding, params.repeater)\n });\n\n return this.mapUnit(\n {\n ...spec,\n ...(mergedProjection ? {projection: mergedProjection} : {}),\n ...(mergedEncoding ? {encoding: mergedEncoding} : {})\n },\n {config}\n );\n }\n\n private mapFacetedUnit(spec: FacetedUnitSpec, params: NormalizerParams): NormalizedFacetSpec {\n // New encoding in the inside spec should not contain row / column\n // as row/column should be moved to facet\n const {row, column, facet, ...encoding} = spec.encoding;\n\n // Mark and encoding should be moved into the inner spec\n const {mark, width, projection, height, view, selection, encoding: _, ...outerSpec} = spec;\n\n const {facetMapping, layout} = this.getFacetMappingAndLayout({row, column, facet}, params);\n\n const newEncoding = replaceRepeaterInEncoding(encoding, params.repeater);\n\n return this.mapFacet(\n {\n ...outerSpec,\n ...layout,\n\n // row / column has higher precedence than facet\n facet: facetMapping,\n spec: {\n ...(width ? {width} : {}),\n ...(height ? {height} : {}),\n ...(view ? {view} : {}),\n ...(projection ? {projection} : {}),\n mark,\n encoding: newEncoding,\n ...(selection ? {selection} : {})\n }\n },\n params\n );\n }\n\n private getFacetMappingAndLayout(\n facets: {\n row: FacetEncodingFieldDef;\n column: FacetEncodingFieldDef;\n facet: FacetEncodingFieldDef;\n },\n params: NormalizerParams\n ): {facetMapping: FacetMapping | FacetFieldDef; layout: GenericCompositionLayoutWithColumns} {\n const {row, column, facet} = facets;\n\n if (row || column) {\n if (facet) {\n log.warn(log.message.facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])]));\n }\n\n const facetMapping = {};\n const layout = {};\n\n for (const channel of [ROW, COLUMN]) {\n const def = facets[channel];\n if (def) {\n const {align, center, spacing, columns, ...defWithoutLayout} = def;\n facetMapping[channel] = defWithoutLayout;\n\n for (const prop of ['align', 'center', 'spacing'] as const) {\n if (def[prop] !== undefined) {\n layout[prop] = layout[prop] ?? {};\n layout[prop][channel] = def[prop];\n }\n }\n }\n }\n\n return {facetMapping, layout};\n } else {\n const {align, center, spacing, columns, ...facetMapping} = facet;\n return {\n facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater),\n layout: {\n ...(align ? {align} : {}),\n ...(center ? {center} : {}),\n ...(spacing ? {spacing} : {}),\n ...(columns ? {columns} : {})\n }\n };\n }\n }\n\n public mapLayer(\n spec: LayerSpec,\n {parentEncoding, parentProjection, ...otherParams}: NormalizerParams\n ): NormalizedLayerSpec {\n // Special handling for extended layer spec\n\n const {encoding, projection, ...rest} = spec;\n const params: NormalizerParams = {\n ...otherParams,\n parentEncoding: mergeEncoding({parentEncoding, encoding, layer: true}),\n parentProjection: mergeProjection({parentProjection, projection})\n };\n return super.mapLayer(rest, params);\n }\n}\n\nfunction mergeEncoding({\n parentEncoding,\n encoding = {},\n layer\n}: {\n parentEncoding: SharedCompositeEncoding;\n encoding: SharedCompositeEncoding | Encoding;\n layer?: boolean;\n}): Encoding {\n let merged: any = {};\n if (parentEncoding) {\n const channels = new Set([...keys(parentEncoding), ...keys(encoding)]);\n for (const channel of channels) {\n const channelDef = encoding[channel];\n const parentChannelDef = parentEncoding[channel];\n\n if (isFieldOrDatumDef(channelDef)) {\n // Field/Datum Def can inherit properties from its parent\n // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one.\n const mergedChannelDef = {\n ...parentChannelDef,\n ...channelDef\n };\n merged[channel] = mergedChannelDef;\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n merged[channel] = {\n ...channelDef,\n condition: {\n ...parentChannelDef,\n ...channelDef.condition\n }\n };\n } else if (channelDef) {\n merged[channel] = channelDef;\n } else if (\n layer ||\n isValueDef(parentChannelDef) ||\n isSignalRef(parentChannelDef) ||\n isFieldOrDatumDef(parentChannelDef) ||\n isArray(parentChannelDef)\n ) {\n merged[channel] = parentChannelDef;\n }\n }\n } else {\n merged = encoding;\n }\n return !merged || isEmpty(merged) ? undefined : merged;\n}\n\nfunction mergeProjection(opt: {parentProjection: Projection; projection: Projection}) {\n const {parentProjection, projection} = opt;\n if (parentProjection && projection) {\n log.warn(log.message.projectionOverridden({parentProjection, projection}));\n }\n return projection ?? parentProjection;\n}\n","import {Field} from '../channeldef';\nimport {isString} from 'vega-util';\nimport {Config, initConfig} from '../config';\nimport * as log from '../log';\nimport {\n LayerSpec,\n FacetedUnitSpec,\n GenericSpec,\n isLayerSpec,\n isUnitSpec,\n LayoutSizeMixins,\n NormalizedSpec,\n TopLevelSpec,\n UnitSpec,\n RepeatSpec\n} from '../spec';\nimport {AutoSizeParams, AutosizeType, TopLevel} from '../spec/toplevel';\nimport {deepEqual} from '../util';\nimport {NormalizerParams} from './base';\nimport {CoreNormalizer} from './core';\n\nexport function normalize(\n spec: TopLevelSpec & LayoutSizeMixins,\n config?: Config\n): TopLevel & LayoutSizeMixins {\n if (config === undefined) {\n config = initConfig(spec.config);\n }\n\n const normalizedSpec = normalizeGenericSpec(spec, config);\n\n const {width, height} = spec;\n const autosize = normalizeAutoSize(normalizedSpec, {width, height, autosize: spec.autosize}, config);\n\n return {\n ...normalizedSpec,\n ...(autosize ? {autosize} : {})\n };\n}\n\nconst normalizer = new CoreNormalizer();\n\n/**\n * Decompose extended unit specs into composition of pure unit specs.\n */\nfunction normalizeGenericSpec(\n spec: GenericSpec | FacetedUnitSpec | RepeatSpec,\n config: Config = {}\n) {\n return normalizer.map(spec, {config});\n}\n\nfunction _normalizeAutoSize(autosize: AutosizeType | AutoSizeParams) {\n return isString(autosize) ? {type: autosize} : autosize ?? {};\n}\n\n/**\n * Normalize autosize and deal with width or height == \"container\".\n */\nexport function normalizeAutoSize(\n spec: TopLevel,\n sizeInfo: {autosize: AutosizeType | AutoSizeParams} & LayoutSizeMixins,\n config?: Config\n) {\n let {width, height} = sizeInfo;\n\n const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec);\n const autosizeDefault: AutoSizeParams = {};\n\n if (!isFitCompatible) {\n // If spec is not compatible with autosize == \"fit\", discard width/height == container\n if (width == 'container') {\n log.warn(log.message.containerSizeNonSingle('width'));\n width = undefined;\n }\n if (height == 'container') {\n log.warn(log.message.containerSizeNonSingle('height'));\n height = undefined;\n }\n } else {\n // Default autosize parameters to fit when width/height is \"container\"\n if (width == 'container' && height == 'container') {\n autosizeDefault.type = 'fit';\n autosizeDefault.contains = 'padding';\n } else if (width == 'container') {\n autosizeDefault.type = 'fit-x';\n autosizeDefault.contains = 'padding';\n } else if (height == 'container') {\n autosizeDefault.type = 'fit-y';\n autosizeDefault.contains = 'padding';\n }\n }\n\n const autosize: AutoSizeParams = {\n type: 'pad',\n ...autosizeDefault,\n ...(config ? _normalizeAutoSize(config.autosize) : {}),\n ..._normalizeAutoSize(spec.autosize)\n };\n\n if (autosize.type === 'fit' && !isFitCompatible) {\n log.warn(log.message.FIT_NON_SINGLE);\n autosize.type = 'pad';\n }\n\n if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('width'));\n }\n if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('height'));\n }\n\n // Delete autosize property if it's Vega's default\n if (deepEqual(autosize, {type: 'pad'})) {\n return undefined;\n }\n\n return autosize;\n}\n\nexport {NormalizerParams};\n","import {Color, SignalRef} from 'vega';\nimport {BaseSpec} from '.';\nimport {getPositionScaleChannel} from '../channel';\nimport {Config} from '../config';\nimport {InlineDataset} from '../data';\nimport {Dict} from '../util';\n\n/**\n * @minimum 0\n */\nexport type Padding = number | {top?: number; bottom?: number; left?: number; right?: number};\n\nexport type Datasets = Dict;\n\nexport type TopLevel = S &\n TopLevelProperties & {\n /**\n * URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.\n * @format uri\n */\n $schema?: string;\n\n /**\n * Vega-Lite configuration object. This property can only be defined at the top-level of a specification.\n */\n config?: Config;\n\n /**\n * A global data store for named datasets. This is a mapping from names to inline datasets.\n * This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property.\n */\n datasets?: Datasets;\n\n /**\n * Optional metadata that will be passed to Vega.\n * This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata.\n */\n usermeta?: Dict;\n };\n\nexport interface TopLevelProperties {\n /**\n * CSS color property to use as the background of the entire view.\n *\n * __Default value:__ `\"white\"`\n */\n background?: Color | SignalRef;\n\n /**\n * The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\n * If an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n *\n * __Default value__: `5`\n */\n padding?: Padding | SignalRef;\n\n /**\n * How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\n * Object values can additionally specify parameters for content sizing and automatic resizing.\n *\n * __Default value__: `pad`\n */\n autosize?: AutosizeType | AutoSizeParams; // Vega actually supports signal for autosize. However, we need to check autosize at compile time to infer the rest of the spec. Thus VL's autosize won't support SignalRef for now.\n}\n\nexport type FitType = 'fit' | 'fit-x' | 'fit-y';\n\nexport function isFitType(autoSizeType: AutosizeType): autoSizeType is FitType {\n return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y';\n}\n\nexport function getFitType(sizeType?: 'width' | 'height'): FitType {\n return sizeType ? (`fit-${getPositionScaleChannel(sizeType)}` as FitType) : 'fit';\n}\n\nexport type AutosizeType = 'pad' | 'none' | 'fit' | 'fit-x' | 'fit-y';\n\nexport interface AutoSizeParams {\n /**\n * The sizing format type. One of `\"pad\"`, `\"fit\"`, `\"fit-x\"`, `\"fit-y\"`, or `\"none\"`. See the [autosize type](https://vega.github.io/vega-lite/docs/size.html#autosize) documentation for descriptions of each.\n *\n * __Default value__: `\"pad\"`\n */\n type?: AutosizeType;\n\n /**\n * A boolean flag indicating if autosize layout should be re-calculated on every view update.\n *\n * __Default value__: `false`\n */\n resize?: boolean;\n\n /**\n * Determines how size calculation should be performed, one of `\"content\"` or `\"padding\"`. The default setting (`\"content\"`) interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the `\"padding\"` setting includes the padding within the view size calculations, such that the width and height settings indicate the **total** intended size of the view.\n *\n * __Default value__: `\"content\"`\n */\n contains?: 'content' | 'padding';\n}\n\nconst TOP_LEVEL_PROPERTIES: (keyof TopLevelProperties)[] = [\n 'background',\n 'padding'\n // We do not include \"autosize\" here as it is supported by only unit and layer specs and thus need to be normalized\n];\n\nexport function extractTopLevelProperties(t: T) {\n return TOP_LEVEL_PROPERTIES.reduce((o, p) => {\n if (t && t[p] !== undefined) {\n o[p] = t[p];\n }\n return o;\n }, {});\n}\n","import * as log from '../log';\nimport {deepEqual, duplicate, getFirstDefined, keys} from '../util';\n\n/**\n * Generic class for storing properties that are explicitly specified\n * and implicitly determined by the compiler.\n * This is important for scale/axis/legend merging as\n * we want to prioritize properties that users explicitly specified.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport class Split {\n constructor(public readonly explicit: Partial = {}, public readonly implicit: Partial = {}) {}\n\n public clone() {\n return new Split(duplicate(this.explicit), duplicate(this.implicit));\n }\n\n public combine(): Partial {\n // FIXME remove \"as any\".\n // Add \"as any\" to avoid an error \"Spread types may only be created from object types\".\n return {\n ...(this.explicit as any), // Explicit properties comes first\n ...(this.implicit as any)\n };\n }\n\n public get(key: K): T[K] {\n // Explicit has higher precedence\n return getFirstDefined(this.explicit[key], this.implicit[key]);\n }\n\n public getWithExplicit(key: K): Explicit {\n // Explicit has higher precedence\n if (this.explicit[key] !== undefined) {\n return {explicit: true, value: this.explicit[key]};\n } else if (this.implicit[key] !== undefined) {\n return {explicit: false, value: this.implicit[key]};\n }\n return {explicit: false, value: undefined};\n }\n\n public setWithExplicit(key: K, value: Explicit) {\n if (value.value !== undefined) {\n this.set(key, value.value, value.explicit);\n }\n }\n\n public set(key: K, value: T[K], explicit: boolean) {\n delete this[explicit ? 'implicit' : 'explicit'][key];\n this[explicit ? 'explicit' : 'implicit'][key] = value;\n return this;\n }\n\n public copyKeyFromSplit(key: keyof T, s: Split) {\n // Explicit has higher precedence\n if (s.explicit[key] !== undefined) {\n this.set(key, s.explicit[key], true);\n } else if (s.implicit[key] !== undefined) {\n this.set(key, s.implicit[key], false);\n }\n }\n public copyKeyFromObject(key: keyof T, s: Partial) {\n // Explicit has higher precedence\n if (s[key] !== undefined) {\n this.set(key, s[key], true);\n }\n }\n\n /**\n * Merge split object into this split object. Properties from the other split\n * overwrite properties from this split.\n */\n public copyAll(other: Split) {\n for (const key of keys(other.combine())) {\n const val = other.getWithExplicit(key);\n this.setWithExplicit(key, val);\n }\n }\n}\n\nexport interface Explicit {\n explicit: boolean;\n value: T;\n}\n\nexport function makeExplicit(value: T): Explicit {\n return {\n explicit: true,\n value\n };\n}\n\nexport function makeImplicit(value: T): Explicit {\n return {\n explicit: false,\n value\n };\n}\n\nexport type SplitParentProperty = 'scale' | 'axis' | 'legend' | '';\n\nexport function tieBreakByComparing(compare: (v1: T, v2: T) => number) {\n return (\n v1: Explicit,\n v2: Explicit,\n property: keyof S | never,\n propertyOf: SplitParentProperty\n ): Explicit => {\n const diff = compare(v1.value, v2.value);\n if (diff > 0) {\n return v1;\n } else if (diff < 0) {\n return v2;\n }\n return defaultTieBreaker(v1, v2, property, propertyOf);\n };\n}\n\nexport function defaultTieBreaker(\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: SplitParentProperty\n) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, prefer v1.\n return v1;\n}\n\nexport function mergeValuesWithExplicit(\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: SplitParentProperty,\n tieBreaker: (\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: string\n ) => Explicit = defaultTieBreaker\n) {\n if (v1 === undefined || v1.value === undefined) {\n // For first run\n return v2;\n }\n\n if (v1.explicit && !v2.explicit) {\n return v1;\n } else if (v2.explicit && !v1.explicit) {\n return v2;\n } else if (deepEqual(v1.value, v2.value)) {\n return v1;\n } else {\n return tieBreaker(v1, v2, property, propertyOf);\n }\n}\n","import {Parse} from '../../data';\nimport {Dict} from '../../util';\nimport {Split} from '../split';\nimport {OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {SourceNode} from './source';\n\nexport interface DataComponent {\n /**\n * A list of unique sources.\n */\n sources: SourceNode[];\n\n /**\n * Registry of output nodes.\n */\n outputNodes: Dict;\n\n /**\n * How often is an output node used. If it is not used, we don't need to\n * instantiate it in the assemble step.\n */\n outputNodeRefCounts: Dict;\n\n /**\n * The output node before aggregation.\n */\n raw?: OutputNode;\n\n /**\n * The main output node.\n */\n main?: OutputNode;\n\n /**\n * For facets, we store the reference to the root node.\n */\n facetRoot?: FacetNode;\n\n /**\n * True if the data for this model is faceted.\n * A dataset is faceted if a parent model is a facet and no new dataset is\n * defined (which would make the data unfaceted again).\n */\n isFaceted: boolean;\n\n /**\n * Parse properties passed down from ancestors. Helps us to keep track of what has been parsed or is derived.\n */\n ancestorParse?: AncestorParse;\n}\n\n/**\n * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf)\n * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the\n * same field again (or differently).\n */\nexport class AncestorParse extends Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {},\n public parseNothing = false\n ) {\n super(explicit, implicit);\n }\n\n public clone(): AncestorParse {\n const clone = super.clone() as AncestorParse;\n clone.parseNothing = this.parseNothing;\n return clone;\n }\n}\n","/*\n * Constants and utilities for data.\n */\nimport {Vector2} from 'vega';\nimport {FieldName} from './channeldef';\nimport {VgData} from './vega.schema';\n\nexport type ParseValue = null | string | 'string' | 'boolean' | 'date' | 'number';\n\nexport interface Parse {\n [field: string]: ParseValue;\n}\n\nexport interface DataFormatBase {\n /**\n * If set to `null`, disable type inference based on the spec and only use type inference based on the data.\n * Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `\"number\"`, `\"boolean\"`, `\"date\"`, or null (do not parse the field)).\n * For example, `\"parse\": {\"modified_on\": \"date\"}` parses the `modified_on` field in each input record a Date value.\n *\n * For `\"date\"`, we parse data based using Javascript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).\n * For Specific date formats can be provided (e.g., `{foo: \"date:'%m%d%Y'\"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: \"utc:'%m%d%Y'\"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc)\n */\n parse?: Parse | null;\n\n /**\n * Type of input data: `\"json\"`, `\"csv\"`, `\"tsv\"`, `\"dsv\"`.\n *\n * __Default value:__ The default format type is determined by the extension of the file URL.\n * If no extension is detected, `\"json\"` will be used by default.\n */\n type?: 'csv' | 'tsv' | 'dsv' | 'json' | 'topojson';\n}\n\nexport interface CsvDataFormat extends DataFormatBase {\n type?: 'csv' | 'tsv';\n}\n\nexport interface DsvDataFormat extends DataFormatBase {\n type?: 'dsv';\n\n /**\n * The delimiter between records. The delimiter must be a single character (i.e., a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not.\n *\n * @minLength 1\n * @maxLength 1\n */\n delimiter: string;\n}\n\nexport interface JsonDataFormat extends DataFormatBase {\n type?: 'json';\n /**\n * The JSON property containing the desired data.\n * This parameter can be used when the loaded JSON file may have surrounding structure or meta-data.\n * For example `\"property\": \"values.features\"` is equivalent to retrieving `json.values.features`\n * from the loaded JSON object.\n */\n property?: string;\n}\n\nexport interface TopoDataFormat extends DataFormatBase {\n type?: 'topojson';\n /**\n * The name of the TopoJSON object set to convert to a GeoJSON feature collection.\n * For example, in a map of the world, there may be an object set named `\"countries\"`.\n * Using the feature property, we can extract this set and generate a GeoJSON feature object for each country.\n */\n feature?: string;\n /**\n * The name of the TopoJSON object set to convert to mesh.\n * Similar to the `feature` option, `mesh` extracts a named TopoJSON object set.\n * Unlike the `feature` option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features.\n * Extracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties.\n */\n mesh?: string;\n}\n\nexport type DataFormat = CsvDataFormat | DsvDataFormat | JsonDataFormat | TopoDataFormat;\n\nexport type DataFormatType = 'json' | 'csv' | 'tsv' | 'dsv' | 'topojson';\n\nexport type DataSource = UrlData | InlineData | NamedData;\n\nexport type Data = DataSource | Generator;\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type InlineDataset = number[] | string[] | boolean[] | object[] | string | object;\n\nexport interface DataBase {\n /**\n * An object that specifies the format for parsing the data.\n */\n format?: DataFormat;\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name?: string;\n}\n\nexport interface UrlData extends DataBase {\n /**\n * An URL from which to load the data set. Use the `format.type` property\n * to ensure the loaded data is correctly parsed.\n */\n url: string;\n}\n\nexport interface InlineData extends DataBase {\n /**\n * The full data set, included inline. This can be an array of objects or primitive values, an object, or a string.\n * Arrays of primitive values are ingested as objects with a `data` property. Strings are parsed according to the specified format type.\n */\n values: InlineDataset;\n}\n\nexport interface NamedData extends DataBase {\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name: string;\n}\n\nexport function isUrlData(data: Partial | Partial): data is UrlData {\n return 'url' in data;\n}\n\nexport function isInlineData(data: Partial | Partial): data is InlineData {\n return 'values' in data;\n}\n\nexport function isNamedData(data: Partial | Partial): data is NamedData {\n return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data);\n}\n\nexport function isGenerator(data: Partial | Partial): data is Generator {\n return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data));\n}\n\nexport function isSequenceGenerator(data: Partial | Partial): data is SequenceGenerator {\n return 'sequence' in data;\n}\n\nexport function isSphereGenerator(data: Partial | Partial): data is SphereGenerator {\n return 'sphere' in data;\n}\n\nexport function isGraticuleGenerator(data: Partial | Partial): data is GraticuleGenerator {\n return 'graticule' in data;\n}\n\nexport enum DataSourceType {\n Raw,\n Main,\n Row,\n Column,\n Lookup\n}\n\nexport type Generator = SequenceGenerator | SphereGenerator | GraticuleGenerator;\n\nexport interface GeneratorBase {\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name?: string;\n}\n\nexport interface SequenceGenerator extends GeneratorBase {\n /**\n * Generate a sequence of numbers.\n */\n sequence: SequenceParams;\n}\n\nexport interface SequenceParams {\n /**\n * The starting value of the sequence (inclusive).\n */\n start: number;\n /**\n * The ending value of the sequence (exclusive).\n */\n stop: number;\n /**\n * The step value between sequence entries.\n *\n * __Default value:__ `1`\n */\n step?: number;\n\n /**\n * The name of the generated sequence field.\n *\n * __Default value:__ `\"data\"`\n */\n as?: FieldName;\n}\n\nexport interface SphereGenerator extends GeneratorBase {\n /**\n * Generate sphere GeoJSON data for the full globe.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n sphere: true | {};\n}\n\nexport interface GraticuleGenerator extends GeneratorBase {\n /**\n * Generate graticule GeoJSON data for geographic reference lines.\n */\n graticule: true | GraticuleParams;\n}\n\nexport interface GraticuleParams {\n /**\n * The major extent of the graticule as a two-element array of coordinates.\n */\n extentMajor?: Vector2>;\n\n /**\n * The minor extent of the graticule as a two-element array of coordinates.\n */\n extentMinor?: Vector2>;\n\n /**\n * Sets both the major and minor extents to the same values.\n */\n extent?: Vector2>;\n\n /**\n * The major step angles of the graticule.\n *\n *\n * __Default value:__ `[90, 360]`\n */\n stepMajor?: Vector2;\n\n /**\n * The minor step angles of the graticule.\n *\n * __Default value:__ `[10, 10]`\n */\n stepMinor?: Vector2;\n\n /**\n * Sets both the major and minor step angles to the same values.\n */\n step?: Vector2;\n\n /**\n * The precision of the graticule in degrees.\n *\n * __Default value:__ `2.5`\n */\n precision?: number;\n}\n","import {AggregateOp} from 'vega';\nimport {BinParams} from './bin';\nimport {FieldName} from './channeldef';\nimport {Data} from './data';\nimport {ImputeParams} from './impute';\nimport {LogicalComposition, normalizeLogicalComposition} from './logical';\nimport {normalizePredicate, Predicate} from './predicate';\nimport {SortField} from './sort';\nimport {TimeUnit, TimeUnitParams} from './timeunit';\n\nexport interface FilterTransform {\n /**\n * The `filter` property must be a predication definition, which can takes one of the following forms:\n *\n * 1) an [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string,\n * where `datum` can be used to refer to the current data object.\n * For example, `{filter: \"datum.b2 > 60\"}` would make the output data includes only items that have values in the field `b2` over 60.\n *\n * 2) one of the [field predicates](https://vega.github.io/vega-lite/docs/predicate.html#field-predicate): \n * [`equal`](https://vega.github.io/vega-lite/docs/predicate.html#field-equal-predicate),\n * [`lt`](https://vega.github.io/vega-lite/docs/predicate.html#lt-predicate),\n * [`lte`](https://vega.github.io/vega-lite/docs/predicate.html#lte-predicate),\n * [`gt`](https://vega.github.io/vega-lite/docs/predicate.html#gt-predicate),\n * [`gte`](https://vega.github.io/vega-lite/docs/predicate.html#gte-predicate),\n * [`range`](https://vega.github.io/vega-lite/docs/predicate.html#range-predicate),\n * [`oneOf`](https://vega.github.io/vega-lite/docs/predicate.html#one-of-predicate),\n * or [`valid`](https://vega.github.io/vega-lite/docs/predicate.html#valid-predicate),\n\n * 3) a [selection predicate](https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate), which define the names of a selection that the data point should belong to (or a logical composition of selections).\n *\n * 4) a [logical composition](https://vega.github.io/vega-lite/docs/predicate.html#composition) of (1), (2), or (3).\n */\n filter: LogicalComposition;\n}\n\nexport function isFilter(t: Transform): t is FilterTransform {\n return 'filter' in t;\n}\n\nexport interface CalculateTransform {\n /**\n * A [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string. Use the variable `datum` to refer to the current data object.\n */\n calculate: string;\n\n /**\n * The field for storing the computed formula value.\n */\n as: FieldName;\n}\n\nexport interface BinTransform {\n /**\n * An object indicating bin properties, or simply `true` for using default bin parameters.\n */\n bin: true | BinParams;\n\n /**\n * The data field to bin.\n */\n field: FieldName;\n\n /**\n * The output fields at which to write the start and end bin values.\n * This can be either a string or an array of strings with two elements denoting the name for the fields for bin start and bin end respectively.\n * If a single string (e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`.\n */\n as: FieldName | FieldName[];\n}\n\nexport interface TimeUnitTransform {\n /**\n * The timeUnit.\n */\n timeUnit: TimeUnit | TimeUnitParams;\n\n /**\n * The data field to apply time unit.\n */\n field: FieldName;\n\n /**\n * The output field to write the timeUnit value.\n */\n as: FieldName;\n}\n\nexport interface AggregateTransform {\n /**\n * Array of objects that define fields to aggregate.\n */\n aggregate: AggregatedFieldDef[];\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n}\n\nexport interface AggregatedFieldDef {\n /**\n * The aggregation operation to apply to the fields (e.g., `\"sum\"`, `\"average\"`, or `\"count\"`).\n * See the [full list of supported aggregation operations](https://vega.github.io/vega-lite/docs/aggregate.html#ops)\n * for more information.\n */\n op: AggregateOp;\n\n /**\n * The data field for which to compute aggregate function. This is required for all aggregation operations except `\"count\"`.\n */\n field?: FieldName;\n\n /**\n * The output field names to use for each aggregated field.\n */\n as: FieldName;\n}\n\nexport interface StackTransform {\n /**\n * The field which is stacked.\n */\n stack: FieldName;\n /**\n * The data fields to group by.\n */\n groupby: FieldName[];\n /**\n * Mode for stacking marks. One of `\"zero\"` (default), `\"center\"`, or `\"normalize\"`.\n * The `\"zero\"` offset will stack starting at `0`. The `\"center\"` offset will center the stacks. The `\"normalize\"` offset will compute percentage values for each stack point, with output values in the range `[0,1]`.\n *\n * __Default value:__ `\"zero\"`\n */\n offset?: 'zero' | 'center' | 'normalize';\n /**\n * Field that determines the order of leaves in the stacked charts.\n */\n sort?: SortField[];\n /**\n * Output field names. This can be either a string or an array of strings with two elements denoting the name for the fields for stack start and stack end respectively.\n * If a single string(e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`.\n */\n as: FieldName | [FieldName, FieldName];\n}\n\nexport type WindowOnlyOp =\n | 'row_number'\n | 'rank'\n | 'dense_rank'\n | 'percent_rank'\n | 'cume_dist'\n | 'ntile'\n | 'lag'\n | 'lead'\n | 'first_value'\n | 'last_value'\n | 'nth_value';\n\nexport interface WindowFieldDef {\n /**\n * The window or aggregation operation to apply within a window (e.g., `\"rank\"`, `\"lead\"`, `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/window.html#ops).\n */\n op: AggregateOp | WindowOnlyOp;\n\n /**\n * Parameter values for the window functions. Parameter values can be omitted for operations that do not accept a parameter.\n *\n * See the list of all supported operations and their parameters [here](https://vega.github.io/vega-lite/docs/transforms/window.html).\n */\n param?: number;\n\n /**\n * The data field for which to compute the aggregate or window function. This can be omitted for window functions that do not operate over a field such as `\"count\"`, `\"rank\"`, `\"dense_rank\"`.\n */\n field?: FieldName;\n\n /**\n * The output name for the window operation.\n */\n as: FieldName;\n}\n\nexport interface WindowTransform {\n /**\n * The definition of the fields in the window, and what calculations to use.\n */\n window: WindowFieldDef[];\n\n /**\n * A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is `[null, 0]`, indicating that the sliding window includes the current object and all preceding objects. The value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. Finally, `[null, null]` indicates that the window frame should always include all data objects. If you this frame and want to assign the same value to add objects, you can use the simpler [join aggregate transform](https://vega.github.io/vega-lite/docs/joinaggregate.html). The only operators affected are the aggregation operations and the `first_value`, `last_value`, and `nth_value` window operations. The other window operations are not affected by this.\n *\n * __Default value:__: `[null, 0]` (includes the current object and all preceding objects)\n */\n frame?: (null | number)[];\n\n /**\n * Indicates if the sliding window frame should ignore peer values (data that are considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations.\n *\n * __Default value:__ `false`\n */\n ignorePeers?: boolean;\n\n /**\n * The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single window.\n */\n groupby?: FieldName[];\n\n /**\n * A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered \"peer\" values of equal rank. If sort is not specified, the order is undefined: data objects are processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to `true`).\n */\n sort?: SortField[];\n}\n\nexport interface JoinAggregateFieldDef {\n /**\n * The aggregation operation to apply (e.g., `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n */\n op: AggregateOp;\n\n /**\n * The data field for which to compute the aggregate function. This can be omitted for functions that do not operate over a field such as `\"count\"`.\n */\n field?: FieldName;\n\n /**\n * The output name for the join aggregate operation.\n */\n as: FieldName;\n}\n\nexport interface JoinAggregateTransform {\n /**\n * The definition of the fields in the join aggregate, and what calculations to use.\n */\n joinaggregate: JoinAggregateFieldDef[];\n\n /**\n * The data fields for partitioning the data objects into separate groups. If unspecified, all data points will be in a single group.\n */\n groupby?: FieldName[];\n}\n\nexport interface ImputeSequence {\n /**\n * The starting value of the sequence.\n * __Default value:__ `0`\n */\n start?: number;\n /**\n * The ending value(exclusive) of the sequence.\n */\n stop: number;\n /**\n * The step value between sequence entries.\n * __Default value:__ `1` or `-1` if `stop < start`\n */\n step?: number;\n}\n\nexport function isImputeSequence(t: ImputeSequence | any[] | undefined): t is ImputeSequence {\n return t?.['stop'] !== undefined;\n}\n\nexport interface ImputeTransform extends ImputeParams {\n /**\n * The data field for which the missing values should be imputed.\n */\n impute: FieldName;\n\n /**\n * A key field that uniquely identifies data objects within a group.\n * Missing key values (those occurring in the data but not in the current group) will be imputed.\n */\n key: FieldName;\n\n /**\n * An optional array of fields by which to group the values.\n * Imputation will then be performed on a per-group basis.\n */\n groupby?: FieldName[];\n}\n\nexport interface FlattenTransform {\n /**\n * An array of one or more data fields containing arrays to flatten.\n * If multiple fields are specified, their array values should have a parallel structure, ideally with the same length.\n * If the lengths of parallel arrays do not match,\n * the longest array will be used with `null` values added for missing entries.\n */\n flatten: FieldName[];\n\n /**\n * The output field names for extracted array values.\n *\n * __Default value:__ The field name of the corresponding array field\n */\n as?: FieldName[];\n}\n\nexport interface SampleTransform {\n /**\n * The maximum number of data objects to include in the sample.\n *\n * __Default value:__ `1000`\n */\n sample: number;\n}\n\nexport interface LookupBase {\n /**\n * Key in data to lookup.\n */\n key: FieldName;\n /**\n * Fields in foreign data or selection to lookup.\n * If not specified, the entire object is queried.\n */\n fields?: FieldName[];\n}\n\nexport interface LookupData extends LookupBase {\n /**\n * Secondary data source to lookup in.\n */\n data: Data;\n}\n\nexport interface LookupSelection extends LookupBase {\n /**\n * Selection name to look up.\n */\n selection: string;\n}\n\nexport interface LookupTransform {\n /**\n * Key in primary data source.\n */\n lookup: string;\n\n /**\n * The output fields on which to store the looked up data values.\n *\n * For data lookups, this property may be left blank if `from.fields`\n * has been specified (those field names will be used); if `from.fields`\n * has not been specified, `as` must be a string.\n *\n * For selection lookups, this property is optional: if unspecified,\n * looked up values will be stored under a property named for the selection;\n * and if specified, it must correspond to `from.fields`.\n */\n as?: FieldName | FieldName[];\n\n /**\n * The default value to use if lookup fails.\n *\n * __Default value:__ `null`\n */\n default?: string;\n\n /**\n * Data source or selection for secondary data reference.\n */\n from: LookupData | LookupSelection;\n}\n\nexport function isLookup(t: Transform): t is LookupTransform {\n return 'lookup' in t;\n}\n\nexport function isLookupData(from: LookupData | LookupSelection): from is LookupData {\n return 'data' in from;\n}\n\nexport function isLookupSelection(from: LookupData | LookupSelection): from is LookupData {\n return 'selection' in from;\n}\n\nexport interface FoldTransform {\n /**\n * An array of data fields indicating the properties to fold.\n */\n fold: FieldName[];\n\n /**\n * The output field names for the key and value properties produced by the fold transform.\n * __Default value:__ `[\"key\", \"value\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport interface PivotTransform {\n /**\n * The data field to pivot on. The unique values of this field become new field names in the output stream.\n */\n pivot: FieldName;\n\n /**\n * The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields.\n */\n value: FieldName;\n\n /**\n * The optional data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * An optional parameter indicating the maximum number of pivoted fields to generate.\n * The default (`0`) applies no limit. The pivoted `pivot` names are sorted in ascending order prior to enforcing the limit.\n * __Default value:__ `0`\n */\n limit?: number;\n\n /**\n * The aggregation operation to apply to grouped `value` field values.\n * __Default value:__ `sum`\n */\n op?: string;\n}\n\nexport function isPivot(t: Transform): t is PivotTransform {\n return 'pivot' in t;\n}\n\nexport interface DensityTransform {\n /**\n * The data field for which to perform density estimation.\n */\n density: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * A boolean flag indicating whether to produce density estimates (false) or cumulative density estimates (true).\n *\n * __Default value:__ `false`\n */\n cumulative?: boolean;\n\n /**\n * A boolean flag indicating if the output values should be probability estimates (false) or smoothed counts (true).\n *\n * __Default value:__ `false`\n */\n counts?: boolean;\n\n /**\n * The bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott’s rule.\n */\n bandwidth?: number;\n\n /**\n * A [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field.\n */\n extent?: [number, number];\n\n /**\n * The minimum number of samples to take along the extent domain for plotting the density.\n *\n * __Default value:__ `25`\n */\n minsteps?: number;\n\n /**\n * The maximum number of samples to take along the extent domain for plotting the density.\n *\n * __Default value:__ `200`\n */\n maxsteps?: number;\n\n /**\n * The exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities.\n */\n steps?: number;\n\n /**\n * The output fields for the sample value and corresponding density estimate.\n *\n * __Default value:__ `[\"value\", \"density\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isDensity(t: Transform): t is DensityTransform {\n return 'density' in t;\n}\n\nexport interface QuantileTransform {\n /**\n * The data field for which to perform quantile estimation.\n */\n quantile: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the *step* parameter will be used.\n */\n probs?: number[];\n\n /**\n * A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the *probs* parameter is not provided.\n */\n step?: number;\n\n /**\n * The output field names for the probability and quantile values.\n *\n * __Default value:__ `[\"prob\", \"value\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isQuantile(t: Transform): t is QuantileTransform {\n return 'quantile' in t;\n}\n\nexport interface RegressionTransform {\n /**\n * The data field of the dependent variable to predict.\n */\n regression: FieldName;\n\n /**\n * The data field of the independent variable to use a predictor.\n */\n on: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * The functional form of the regression model. One of `\"linear\"`, `\"log\"`, `\"exp\"`, `\"pow\"`, `\"quad\"`, or `\"poly\"`.\n *\n * __Default value:__ `\"linear\"`\n */\n method?: 'linear' | 'log' | 'exp' | 'pow' | 'quad' | 'poly';\n\n /**\n * The polynomial order (number of coefficients) for the 'poly' method.\n *\n * __Default value:__ `3`\n */\n order?: number;\n\n /**\n * A [min, max] domain over the independent (x) field for the starting and ending points of the generated trend line.\n */\n extent?: [number, number];\n\n /**\n * A boolean flag indicating if the transform should return the regression model parameters (one object per group), rather than trend line points.\n * The resulting objects include a `coef` array of fitted coefficient values (starting with the intercept term and then including terms of increasing order)\n * and an `rSquared` value (indicating the total variance explained by the model).\n *\n * __Default value:__ `false`\n */\n params?: boolean;\n\n /**\n * The output field names for the smoothed points generated by the regression transform.\n *\n * __Default value:__ The field names of the input x and y values.\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isRegression(t: Transform): t is RegressionTransform {\n return 'regression' in t;\n}\n\nexport interface LoessTransform {\n /**\n * The data field of the dependent variable to smooth.\n */\n loess: FieldName;\n\n /**\n * The data field of the independent variable to use a predictor.\n */\n on: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * A bandwidth parameter in the range `[0, 1]` that determines the amount of smoothing.\n *\n * __Default value:__ `0.3`\n */\n bandwidth?: number;\n\n /**\n * The output field names for the smoothed points generated by the loess transform.\n *\n * __Default value:__ The field names of the input x and y values.\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isLoess(t: Transform): t is LoessTransform {\n return 'loess' in t;\n}\n\nexport function isSample(t: Transform): t is SampleTransform {\n return 'sample' in t;\n}\n\nexport function isWindow(t: Transform): t is WindowTransform {\n return 'window' in t;\n}\n\nexport function isJoinAggregate(t: Transform): t is JoinAggregateTransform {\n return 'joinaggregate' in t;\n}\n\nexport function isFlatten(t: Transform): t is FlattenTransform {\n return 'flatten' in t;\n}\nexport function isCalculate(t: Transform): t is CalculateTransform {\n return 'calculate' in t;\n}\n\nexport function isBin(t: Transform): t is BinTransform {\n return 'bin' in t;\n}\n\nexport function isImpute(t: Transform): t is ImputeTransform {\n return 'impute' in t;\n}\n\nexport function isTimeUnit(t: Transform): t is TimeUnitTransform {\n return 'timeUnit' in t;\n}\n\nexport function isAggregate(t: Transform): t is AggregateTransform {\n return 'aggregate' in t;\n}\n\nexport function isStack(t: Transform): t is StackTransform {\n return 'stack' in t;\n}\n\nexport function isFold(t: Transform): t is FoldTransform {\n return 'fold' in t;\n}\n\nexport type Transform =\n | AggregateTransform\n | BinTransform\n | CalculateTransform\n | DensityTransform\n | FilterTransform\n | FlattenTransform\n | FoldTransform\n | ImputeTransform\n | JoinAggregateTransform\n | LoessTransform\n | LookupTransform\n | QuantileTransform\n | RegressionTransform\n | TimeUnitTransform\n | SampleTransform\n | StackTransform\n | WindowTransform\n | PivotTransform;\n\nexport function normalizeTransform(transform: Transform[]) {\n return transform.map(t => {\n if (isFilter(t)) {\n return {\n filter: normalizeLogicalComposition(t.filter, normalizePredicate)\n };\n }\n return t;\n });\n}\n","/**\n * Parse an event selector string.\n * Returns an array of event stream definitions.\n */\nexport default function(selector, source, marks) {\n DEFAULT_SOURCE = source || VIEW;\n MARKS = marks || DEFAULT_MARKS;\n return parseMerge(selector.trim()).map(parseSelector);\n}\n\nvar VIEW = 'view',\n LBRACK = '[',\n RBRACK = ']',\n LBRACE = '{',\n RBRACE = '}',\n COLON = ':',\n COMMA = ',',\n NAME = '@',\n GT = '>',\n ILLEGAL = /[[\\]{}]/,\n DEFAULT_SOURCE,\n MARKS,\n DEFAULT_MARKS = {\n '*': 1,\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n };\n\nfunction isMarkType(type) {\n return MARKS[type];\n}\n\nfunction find(s, i, endChar, pushChar, popChar) {\n var count = 0,\n n = s.length,\n c;\n for (; i= 0) --count;\n else if (pushChar && pushChar.indexOf(c) >= 0) ++count;\n }\n return i;\n}\n\nfunction parseMerge(s) {\n var output = [],\n start = 0,\n n = s.length,\n i = 0;\n\n while (i < n) {\n i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE);\n output.push(s.substring(start, i).trim());\n start = ++i;\n }\n\n if (output.length === 0) {\n throw 'Empty event selector: ' + s;\n }\n return output;\n}\n\nfunction parseSelector(s) {\n return s[0] === '['\n ? parseBetween(s)\n : parseStream(s);\n}\n\nfunction parseBetween(s) {\n var n = s.length,\n i = 1,\n b, stream;\n\n i = find(s, i, RBRACK, LBRACK, RBRACK);\n if (i === n) {\n throw 'Empty between selector: ' + s;\n }\n\n b = parseMerge(s.substring(1, i));\n if (b.length !== 2) {\n throw 'Between selector must have two elements: ' + s;\n }\n\n s = s.slice(i + 1).trim();\n if (s[0] !== GT) {\n throw 'Expected \\'>\\' after between selector: ' + s;\n }\n\n b = b.map(parseSelector);\n\n stream = parseSelector(s.slice(1).trim());\n if (stream.between) {\n return {\n between: b,\n stream: stream\n };\n } else {\n stream.between = b;\n }\n\n return stream;\n}\n\nfunction parseStream(s) {\n var stream = {source: DEFAULT_SOURCE},\n source = [],\n throttle = [0, 0],\n markname = 0,\n start = 0,\n n = s.length,\n i = 0, j,\n filter;\n\n // extract throttle from end\n if (s[n-1] === RBRACE) {\n i = s.lastIndexOf(LBRACE);\n if (i >= 0) {\n try {\n throttle = parseThrottle(s.substring(i+1, n-1));\n } catch (e) {\n throw 'Invalid throttle specification: ' + s;\n }\n s = s.slice(0, i).trim();\n n = s.length;\n } else throw 'Unmatched right brace: ' + s;\n i = 0;\n }\n\n if (!n) throw s;\n\n // set name flag based on first char\n if (s[0] === NAME) markname = ++i;\n\n // extract first part of multi-part stream selector\n j = find(s, i, COLON);\n if (j < n) {\n source.push(s.substring(start, j).trim());\n start = i = ++j;\n }\n\n // extract remaining part of stream selector\n i = find(s, i, LBRACK);\n if (i === n) {\n source.push(s.substring(start, n).trim());\n } else {\n source.push(s.substring(start, i).trim());\n filter = [];\n start = ++i;\n if (start === n) throw 'Unmatched left bracket: ' + s;\n }\n\n // extract filters\n while (i < n) {\n i = find(s, i, RBRACK);\n if (i === n) throw 'Unmatched left bracket: ' + s;\n filter.push(s.substring(start, i).trim());\n if (i < n-1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s;\n start = ++i;\n }\n\n // marshall event stream specification\n if (!(n = source.length) || ILLEGAL.test(source[n-1])) {\n throw 'Invalid event selector: ' + s;\n }\n\n if (n > 1) {\n stream.type = source[1];\n if (markname) {\n stream.markname = source[0].slice(1);\n } else if (isMarkType(source[0])) {\n stream.marktype = source[0];\n } else {\n stream.source = source[0];\n }\n } else {\n stream.type = source[0];\n }\n if (stream.type.slice(-1) === '!') {\n stream.consume = true;\n stream.type = stream.type.slice(0, -1);\n }\n if (filter != null) stream.filter = filter;\n if (throttle[0]) stream.throttle = throttle[0];\n if (throttle[1]) stream.debounce = throttle[1];\n\n return stream;\n}\n\nfunction parseThrottle(s) {\n var a = s.split(COMMA);\n if (!s.length || a.length > 2) throw s;\n return a.map(function(_) {\n var x = +_;\n if (x !== x) throw s;\n return x;\n });\n}\n","import {SignalRef} from 'vega';\nimport {array} from 'vega-util';\nimport {\n ChannelDef,\n ConditionalPredicate,\n ConditionalSelection,\n isConditionalDef,\n isConditionalSelection\n} from '../../../channeldef';\nimport {GuideEncodingConditionalValueDef} from '../../../guide';\nimport {VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {expression} from '../../predicate';\nimport {parseSelectionPredicate} from '../../selection/parse';\nimport {UnitModel} from '../../unit';\n\n/**\n * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition\n * or a simple mixin if channel def has no condition.\n */\nexport function wrapCondition(\n model: UnitModel,\n channelDef: CD,\n vgChannel: string,\n refFn: (cDef: CD) => VgValueRef\n): VgEncodeEntry {\n const condition = isConditionalDef(channelDef) && channelDef.condition;\n const valueRef = refFn(channelDef);\n if (condition) {\n const conditions = array(condition);\n const vgConditions = conditions.map(c => {\n const conditionValueRef = refFn(c);\n const test = isConditionalSelection(c)\n ? parseSelectionPredicate(model, (c as ConditionalSelection).selection) // FIXME: remove casting once TS is no longer dumb about it\n : expression(model, (c as ConditionalPredicate).test); // FIXME: remove casting once TS is no longer dumb about it\n return {\n test,\n ...conditionValueRef\n };\n });\n return {\n [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])]\n };\n } else {\n return valueRef !== undefined ? {[vgChannel]: valueRef} : {};\n }\n}\n","import {getFormatMixins, isFieldOrDatumDef, isValueDef} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {Encoding} from '../../../encoding';\nimport {VgValueRef} from '../../../vega.schema';\nimport {signalOrValueRef} from '../../common';\nimport {formatSignalRef} from '../../format';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\n\nexport function text(model: UnitModel, channel: 'text' | 'href' | 'url' | 'description' = 'text') {\n const channelDef = model.encoding[channel];\n return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config));\n}\n\nexport function textRef(\n channelDef: Encoding['text' | 'tooltip'],\n config: Config,\n expr: 'datum' | 'datum.datum' = 'datum'\n): VgValueRef {\n // text\n if (channelDef) {\n if (isValueDef(channelDef)) {\n return signalOrValueRef(channelDef.value);\n }\n if (isFieldOrDatumDef(channelDef)) {\n const {format, formatType} = getFormatMixins(channelDef);\n return formatSignalRef({fieldOrDatumDef: channelDef, format, formatType, expr, config});\n }\n }\n return undefined;\n}\n","import {array, isArray, isObject, isString} from 'vega-util';\nimport {isBinned} from '../../../bin';\nimport {getMainRangeChannel, isXorY, Channel} from '../../../channel';\nimport {\n defaultTitle,\n getFieldDef,\n getFormatMixins,\n hasConditionalFieldDef,\n isFieldDef,\n isTypedFieldDef,\n SecondaryFieldDef,\n TypedFieldDef,\n vgField\n} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {Encoding, forEach} from '../../../encoding';\nimport {StackProperties} from '../../../stack';\nimport {entries} from '../../../util';\nimport {isSignalRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\nimport {binFormatExpression, formatSignalRef} from '../../format';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\nimport {textRef} from './text';\n\nexport function tooltip(model: UnitModel, opt: {reactiveGeom?: boolean} = {}) {\n const {encoding, markDef, config, stack} = model;\n const channelDef = encoding.tooltip;\n if (isArray(channelDef)) {\n return {tooltip: tooltipRefForEncoding({tooltip: channelDef}, stack, config, opt)};\n } else {\n const datum = opt.reactiveGeom ? 'datum.datum' : 'datum';\n return wrapCondition(model, channelDef, 'tooltip', cDef => {\n // use valueRef based on channelDef first\n const tooltipRefFromChannelDef = textRef(cDef, config, datum);\n if (tooltipRefFromChannelDef) {\n return tooltipRefFromChannelDef;\n }\n\n if (cDef === null) {\n // Allow using encoding.tooltip = null to disable tooltip\n return undefined;\n }\n\n let markTooltip = getMarkPropOrConfig('tooltip', markDef, config);\n\n if (markTooltip === true) {\n markTooltip = {content: 'encoding'};\n }\n\n if (isString(markTooltip)) {\n return {value: markTooltip};\n } else if (isObject(markTooltip)) {\n // `tooltip` is `{fields: 'encodings' | 'fields'}`\n if (isSignalRef(markTooltip)) {\n return markTooltip;\n } else if (markTooltip.content === 'encoding') {\n return tooltipRefForEncoding(encoding, stack, config, opt);\n } else {\n return {signal: datum};\n }\n }\n\n return undefined;\n });\n }\n}\n\nexport function tooltipData(\n encoding: Encoding,\n stack: StackProperties,\n config: Config,\n {reactiveGeom}: {reactiveGeom?: boolean} = {}\n) {\n const toSkip = {};\n const expr = reactiveGeom ? 'datum.datum' : 'datum';\n const tuples: {channel: Channel; key: string; value: string}[] = [];\n\n function add(fDef: TypedFieldDef | SecondaryFieldDef, channel: Channel) {\n const mainChannel = getMainRangeChannel(channel);\n\n const fieldDef: TypedFieldDef = isTypedFieldDef(fDef)\n ? fDef\n : {\n ...fDef,\n type: (encoding[mainChannel] as TypedFieldDef).type // for secondary field def, copy type from main channel\n };\n\n const title = fieldDef.title || defaultTitle(fieldDef, config);\n const key = array(title).join(', ');\n\n let value: string;\n\n if (isXorY(channel)) {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = getFieldDef(encoding[channel2]);\n\n if (isBinned(fieldDef.bin) && fieldDef2) {\n const startField = vgField(fieldDef, {expr});\n const endField = vgField(fieldDef2, {expr});\n const {format, formatType} = getFormatMixins(fieldDef);\n value = binFormatExpression(startField, endField, format, formatType, config);\n toSkip[channel2] = true;\n } else if (stack && stack.fieldChannel === channel && stack.offset === 'normalize') {\n const {format, formatType} = getFormatMixins(fieldDef);\n value = formatSignalRef({fieldOrDatumDef: fieldDef, format, formatType, expr, config, normalizeStack: true})\n .signal;\n }\n }\n\n value = value ?? textRef(fieldDef, config, expr).signal;\n\n tuples.push({channel, key, value});\n }\n\n forEach(encoding, (channelDef, channel) => {\n if (isFieldDef(channelDef)) {\n add(channelDef, channel);\n } else if (hasConditionalFieldDef(channelDef)) {\n add(channelDef.condition, channel);\n }\n });\n\n const out = {};\n for (const {channel, key, value} of tuples) {\n if (!toSkip[channel] && !out[key]) {\n out[key] = value;\n }\n }\n\n return out;\n}\n\nexport function tooltipRefForEncoding(\n encoding: Encoding,\n stack: StackProperties,\n config: Config,\n {reactiveGeom}: {reactiveGeom?: boolean} = {}\n) {\n const data = tooltipData(encoding, stack, config, {reactiveGeom});\n\n const keyValues = entries(data).map(({key, value}) => `\"${key}\": ${value}`);\n return keyValues.length > 0 ? {signal: `{${keyValues.join(', ')}}`} : undefined;\n}\n","import {entries, isEmpty} from '../../../util';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {VG_MARK_INDEX} from './../../../vega.schema';\nimport {UnitModel} from './../../unit';\nimport {wrapCondition} from './conditional';\nimport {textRef} from './text';\nimport {tooltipData} from './tooltip';\n\nexport function aria(model: UnitModel) {\n const {markDef, config} = model;\n\n const enableAria = getMarkPropOrConfig('aria', markDef, config);\n\n // We can ignore other aria properties if ariaHidden is true.\n if (enableAria === false) {\n // getMarkGroups sets aria to false already so we don't have to set it in the encode block\n return {};\n }\n\n return {\n ...(enableAria ? {aria: enableAria} : {}),\n ...ariaRoleDescription(model),\n ...description(model)\n };\n}\n\nfunction ariaRoleDescription(model: UnitModel) {\n const {mark, markDef, config} = model;\n\n if (config.aria === false) {\n return {};\n }\n\n const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config);\n\n if (ariaRoleDesc != null) {\n return {ariaRoleDescription: {value: ariaRoleDesc}};\n }\n\n return mark in VG_MARK_INDEX ? {} : {ariaRoleDescription: {value: mark}};\n}\n\nexport function description(model: UnitModel) {\n const {encoding, markDef, config, stack} = model;\n const channelDef = encoding.description;\n\n if (channelDef) {\n return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config));\n }\n\n // Use default from mark def or config if defined.\n // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here.\n const descriptionValue = getMarkPropOrConfig('description', markDef, config);\n if (descriptionValue != null) {\n return {\n description: signalOrValueRef(descriptionValue)\n };\n }\n\n if (config.aria === false) {\n return {};\n }\n\n const data = tooltipData(encoding, stack, config);\n\n if (isEmpty(data)) {\n return undefined;\n }\n\n return {\n description: {\n signal: entries(data)\n .map(({key, value}, index) => `\"${index > 0 ? '; ' : ''}${key}: \" + (${value})`)\n .join(' + ')\n }\n };\n}\n","import {SignalRef} from 'vega';\nimport {NonPositionScaleChannel} from '../../../channel';\nimport {Value} from '../../../channeldef';\nimport {VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\nimport * as ref from './valueref';\n\n/**\n * Return encode for non-positional channels with scales. (Text doesn't have scale.)\n */\nexport function nonPosition(\n channel: NonPositionScaleChannel,\n model: UnitModel,\n opt: {\n defaultValue?: Value | SignalRef;\n vgChannel?: VgEncodeChannel;\n defaultRef?: VgValueRef;\n } = {}\n): VgEncodeEntry {\n const {markDef, encoding, config} = model;\n const {vgChannel} = opt;\n let {defaultRef, defaultValue} = opt;\n\n if (defaultRef === undefined) {\n // prettier-ignore\n defaultValue = defaultValue ?? getMarkPropOrConfig(channel, markDef, config, {vgChannel, ignoreVgConfig: true});\n\n if (defaultValue !== undefined) {\n defaultRef = signalOrValueRef(defaultValue);\n }\n }\n\n const channelDef = encoding[channel];\n\n return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => {\n return ref.midPoint({\n channel,\n channelDef: cDef,\n markDef,\n config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null, // No need to provide stack for non-position as it does not affect mid point\n defaultRef\n });\n });\n}\n","import * as log from '../../../log';\nimport {contains} from '../../../util';\nimport {VgEncodeEntry} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {nonPosition} from './nonposition';\n\nexport function color(model: UnitModel, opt: {filled: boolean | undefined} = {filled: undefined}): VgEncodeEntry {\n const {markDef, encoding, config} = model;\n const {type: markType} = markDef;\n\n // Allow filled to be overridden (for trail's \"filled\")\n const filled = opt.filled ?? getMarkPropOrConfig('filled', markDef, config);\n\n const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType)\n ? 'transparent'\n : undefined;\n\n const defaultFill =\n getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, {vgChannel: 'fill'}) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === true && 'color'] ??\n // If there is no fill, always fill symbols, bar, geoshape\n // with transparent fills https://github.com/vega/vega-lite/issues/1316\n transparentIfNeeded;\n\n const defaultStroke =\n getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, {vgChannel: 'stroke'}) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === false && 'color'];\n\n const colorVgChannel = filled ? 'fill' : 'stroke';\n\n const fillStrokeMarkDefAndConfig: VgEncodeEntry = {\n ...(defaultFill ? {fill: signalOrValueRef(defaultFill)} : {}),\n ...(defaultStroke ? {stroke: signalOrValueRef(defaultStroke)} : {})\n };\n\n if (markDef.color && (filled ? markDef.fill : markDef.stroke)) {\n log.warn(log.message.droppingColor('property', {fill: 'fill' in markDef, stroke: 'stroke' in markDef}));\n }\n\n return {\n ...fillStrokeMarkDefAndConfig,\n ...nonPosition('color', model, {\n vgChannel: colorVgChannel,\n defaultValue: filled ? defaultFill : defaultStroke\n }),\n ...nonPosition('fill', model, {\n // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding\n defaultValue: encoding.fill ? defaultFill : undefined\n }),\n ...nonPosition('stroke', model, {\n // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding\n defaultValue: encoding.stroke ? defaultStroke : undefined\n })\n };\n}\n","import {isValueDef} from '../../../channeldef';\nimport {isPathMark} from '../../../mark';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\n\nexport function zindex(model: UnitModel) {\n const {encoding, mark} = model;\n const order = encoding.order;\n\n if (!isPathMark(mark) && isValueDef(order)) {\n return wrapCondition(model, order, 'zindex', cd => cd);\n }\n return {};\n}\n","/**\n * Utility files for producing Vega ValueRef for marks\n */\nimport {SignalRef} from 'vega-typings/types';\nimport {getOffsetChannel, PolarPositionChannel, PositionChannel} from '../../../channel';\nimport {MarkDef} from '../../../mark';\n\nexport function getOffset(channel: PositionChannel | PolarPositionChannel, markDef: MarkDef): number | SignalRef {\n const offsetChannel = getOffsetChannel(channel);\n\n // TODO: in the future read from encoding channel too\n const markDefOffsetValue = markDef[offsetChannel];\n if (markDefOffsetValue) {\n return markDefOffsetValue;\n }\n\n return undefined;\n}\n","import {\n getMainRangeChannel,\n getSecondaryRangeChannel,\n getSizeChannel,\n getVgPositionChannel,\n isXorY,\n PolarPositionChannel,\n PositionChannel\n} from '../../../channel';\nimport {getBand, isFieldDef, isFieldOrDatumDef, TypedFieldDef} from '../../../channeldef';\nimport {ScaleType} from '../../../scale';\nimport {contains} from '../../../util';\nimport {VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\nimport {UnitModel} from '../../unit';\nimport {getOffset} from './offset';\nimport * as ref from './valueref';\n\n/**\n * Return encode for point (non-band) position channels.\n */\nexport function pointPosition(\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel,\n {\n defaultPos,\n vgChannel,\n isMidPoint\n }: {\n defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null;\n vgChannel?: 'x' | 'y' | 'xc' | 'yc';\n isMidPoint?: boolean;\n }\n) {\n const {encoding, markDef, config, stack} = model;\n\n const channelDef = encoding[channel];\n const channel2Def = encoding[getSecondaryRangeChannel(channel)];\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n\n const offset = getOffset(channel, markDef);\n\n // Get default position or position from mark def\n const defaultRef = pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n });\n\n const valueRef =\n !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude)\n ? // use geopoint output if there are lat/long and there is no point position overriding lat/long.\n {field: model.getName(channel)}\n : positionRef({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n isMidPoint,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef\n });\n\n return valueRef ? {[vgChannel || channel]: valueRef} : undefined;\n}\n\n// TODO: we need to find a way to refactor these so that scaleName is a part of scale\n// but that's complicated. For now, this is a huge step moving forward.\n\n/**\n * @return Vega ValueRef for normal x- or y-position without projection\n */\nexport function positionRef(\n params: ref.MidPointParams & {\n channel: 'x' | 'y' | 'radius' | 'theta';\n isMidPoint?: boolean;\n }\n): VgValueRef | VgValueRef[] {\n const {channel, channelDef, isMidPoint, scaleName, stack, offset, markDef, config} = params;\n\n // This isn't a part of midPoint because we use midPoint for non-position too\n if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) {\n if (isFieldDef(channelDef)) {\n const band = getBand({\n channel,\n fieldDef: channelDef,\n isMidPoint,\n markDef,\n stack,\n config\n });\n if (band !== undefined) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef as TypedFieldDef, // positionRef always have type\n startSuffix: 'start',\n band,\n offset\n });\n }\n }\n // x or y use stack_end so that stacked line's point mark use stack_end too.\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'end'}, {offset});\n }\n\n return ref.midPointRefWithPositionInvalidTest(params);\n}\n\nexport function pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n}: {\n model: UnitModel;\n defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null;\n channel: PositionChannel | PolarPositionChannel;\n scaleName: string;\n scale: ScaleComponent;\n}): () => VgValueRef {\n const {markDef, config} = model;\n return () => {\n const mainChannel = getMainRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n\n const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, {vgChannel});\n if (definedValueOrConfig !== undefined) {\n return ref.widthHeightValueOrSignalRef(channel, definedValueOrConfig);\n }\n\n switch (defaultPos) {\n case 'zeroOrMin':\n case 'zeroOrMax':\n if (scaleName) {\n const scaleType = scale.get('type');\n if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) {\n // Log scales cannot have zero.\n // Zero in time scale is arbitrary, and does not affect ratio.\n // (Time is an interval level of measurement, not ratio).\n // See https://en.wikipedia.org/wiki/Level_of_measurement for more info.\n } else {\n if (scale.domainDefinitelyIncludesZero()) {\n return {\n scale: scaleName,\n value: 0\n };\n }\n }\n }\n\n if (defaultPos === 'zeroOrMin') {\n return mainChannel === 'y' ? {field: {group: 'height'}} : {value: 0};\n } else {\n // zeroOrMax\n switch (mainChannel) {\n case 'radius':\n // max of radius is min(width, height) / 2\n return {\n signal: `min(${model.width.signal},${model.height.signal})/2`\n };\n case 'theta':\n return {signal: '2*PI'};\n case 'x':\n return {field: {group: 'width'}};\n case 'y':\n return {value: 0};\n }\n }\n break;\n case 'mid': {\n const sizeRef = model[getSizeChannel(channel)];\n return {...sizeRef, mult: 0.5};\n }\n }\n // defaultPos === null\n return undefined;\n };\n}\n","import {Align} from 'vega';\nimport {getVgPositionChannel} from '../../../channel';\nimport {Config} from '../../../config';\nimport {MarkDef} from '../../../mark';\nimport {VgEncodeChannel} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\n\nconst ALIGNED_X_CHANNEL: Record = {\n left: 'x',\n center: 'xc',\n right: 'x2'\n};\n\nconst BASELINED_Y_CHANNEL = {\n top: 'y',\n middle: 'yc',\n bottom: 'y2'\n};\n\nexport function vgAlignedPositionChannel(\n channel: 'x' | 'y' | 'radius' | 'theta',\n markDef: MarkDef,\n config: Config,\n defaultAlign: 'top' | 'middle' = 'middle'\n) {\n if (channel === 'radius' || channel === 'theta') {\n return getVgPositionChannel(channel);\n }\n const alignChannel = channel === 'x' ? 'align' : 'baseline';\n const align = getMarkPropOrConfig(alignChannel, markDef, config);\n if (channel === 'x') {\n return ALIGNED_X_CHANNEL[align || (defaultAlign === 'top' ? 'left' : 'center')];\n } else {\n return BASELINED_Y_CHANNEL[align || defaultAlign];\n }\n}\n","import {getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel} from '../../../channel';\nimport {isFieldOrDatumDef} from '../../../channeldef';\nimport {MarkConfig} from '../../../mark';\nimport {VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkStyleConfig} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {getOffset} from './offset';\nimport {vgAlignedPositionChannel} from './position-align';\nimport {pointPosition, pointPositionDefaultRef} from './position-point';\nimport * as ref from './valueref';\n\n/**\n * Utility for area/rule position, which can be either point or range. (One of the axes should be point and the other should be range.)\n */\nexport function pointOrRangePosition(\n channel: 'x' | 'y',\n model: UnitModel,\n {\n defaultPos,\n defaultPos2,\n range\n }: {\n defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid';\n defaultPos2: 'zeroOrMin' | 'zeroOrMax';\n range: boolean;\n }\n) {\n if (range) {\n return rangePosition(channel, model, {defaultPos, defaultPos2});\n }\n return pointPosition(channel, model, {defaultPos});\n}\n\nexport function rangePosition(\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel,\n {\n defaultPos,\n defaultPos2\n }: {\n defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid';\n defaultPos2: 'zeroOrMin' | 'zeroOrMax';\n }\n): VgEncodeEntry {\n const {markDef, config} = model;\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n\n const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2);\n\n const vgChannel = pos2Mixins[sizeChannel]\n ? // If there is width/height, we need to position the marks based on the alignment.\n vgAlignedPositionChannel(channel, markDef, config)\n : // Otherwise, make sure to apply to the right Vg Channel (for arc mark)\n getVgPositionChannel(channel);\n\n return {\n ...pointPosition(channel, model, {defaultPos, vgChannel}),\n ...pos2Mixins\n };\n}\n\n/**\n * Return encode for x2, y2.\n * If channel is not specified, return one channel based on orientation.\n */\nfunction pointPosition2OrSize(\n model: UnitModel,\n defaultPos: 'zeroOrMin' | 'zeroOrMax',\n channel: 'x2' | 'y2' | 'radius2' | 'theta2'\n) {\n const {encoding, mark, markDef, stack, config} = model;\n\n const baseChannel = getMainRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n\n const channelDef = encoding[baseChannel];\n const scaleName = model.scaleName(baseChannel);\n const scale = model.getScaleComponent(baseChannel);\n\n const offset =\n channel in encoding || channel in markDef\n ? getOffset(channel, model.markDef)\n : getOffset(baseChannel, model.markDef);\n\n if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) {\n // use geopoint output if there are lat2/long2 and there is no point position2 overriding lat2/long2.\n return {[vgChannel]: {field: model.getName(channel)}};\n }\n\n const valueRef = position2Ref({\n channel,\n channelDef,\n channel2Def: encoding[channel],\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: undefined\n });\n\n if (valueRef !== undefined) {\n return {[vgChannel]: valueRef};\n }\n\n // TODO: check width/height encoding here once we add them\n\n // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence:\n // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark)\n\n return (\n position2orSize(channel, markDef) ||\n position2orSize(channel, {\n [channel]: getMarkStyleConfig(channel, markDef, config.style),\n [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style)\n }) ||\n position2orSize(channel, config[mark]) ||\n position2orSize(channel, config.mark) || {\n [vgChannel]: pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n })()\n }\n );\n}\n\nexport function position2Ref({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef\n}: ref.MidPointParams & {\n channel: 'x2' | 'y2' | 'radius2' | 'theta2';\n}): VgValueRef | VgValueRef[] {\n if (\n isFieldOrDatumDef(channelDef) &&\n stack &&\n // If fieldChannel is X and channel is X2 (or Y and Y2)\n channel.charAt(0) === stack.fieldChannel.charAt(0)\n ) {\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'start'}, {offset});\n }\n return ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: channel2Def,\n scaleName,\n scale,\n stack,\n markDef,\n config,\n offset,\n defaultRef\n });\n}\n\nfunction position2orSize(channel: 'x2' | 'y2' | 'radius2' | 'theta2', markDef: MarkConfig) {\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n if (markDef[vgChannel] !== undefined) {\n return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[vgChannel])};\n } else if (markDef[channel] !== undefined) {\n return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel])};\n } else if (markDef[sizeChannel]) {\n return {[sizeChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[sizeChannel])};\n }\n return undefined;\n}\n","import {SignalRef} from 'vega';\nimport {isArray, isNumber} from 'vega-util';\nimport {isBinned, isBinning, isBinParams} from '../../../bin';\nimport {\n getSecondaryRangeChannel,\n getSizeChannel,\n getVgPositionChannel,\n isPolarPositionChannel,\n isXorY,\n PolarPositionChannel,\n PositionChannel\n} from '../../../channel';\nimport {getBand, isFieldDef, isFieldOrDatumDef, TypedFieldDef, vgField} from '../../../channeldef';\nimport {Config, DEFAULT_STEP, getViewConfigDiscreteStep} from '../../../config';\nimport {Encoding} from '../../../encoding';\nimport * as log from '../../../log';\nimport {Mark, MarkDef} from '../../../mark';\nimport {hasDiscreteDomain, ScaleType} from '../../../scale';\nimport {getFirstDefined} from '../../../util';\nimport {isSignalRef, isVgRangeStep, VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrStringValue} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\nimport {UnitModel} from '../../unit';\nimport {nonPosition} from './nonposition';\nimport {getOffset} from './offset';\nimport {vgAlignedPositionChannel} from './position-align';\nimport {pointPositionDefaultRef} from './position-point';\nimport {rangePosition} from './position-range';\nimport * as ref from './valueref';\n\nexport function rectPosition(\n model: UnitModel,\n channel: 'x' | 'y' | 'theta' | 'radius',\n mark: 'bar' | 'rect' | 'image' | 'arc'\n): VgEncodeEntry {\n const {config, encoding, markDef, stack} = model;\n\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const channelDef = encoding[channel];\n const channelDef2 = encoding[channel2];\n\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const scaleName = model.scaleName(channel);\n\n const orient = markDef.orient;\n const hasSizeDef =\n encoding[sizeChannel] ?? encoding.size ?? getMarkPropOrConfig('size', markDef, config, {vgChannel: sizeChannel});\n\n const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal');\n\n // x, x2, and width -- we must specify two of these in all conditions\n if (\n isFieldDef(channelDef) &&\n (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) &&\n !hasSizeDef &&\n !hasDiscreteDomain(scaleType)\n ) {\n const band = getBand({channel, fieldDef: channelDef, stack, markDef, config});\n const axis = model.component.axes[channel]?.[0];\n const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5\n\n return rectBinPosition({\n fieldDef: channelDef,\n fieldDef2: channelDef2,\n channel,\n markDef,\n scaleName,\n band,\n axisTranslate,\n spacing: isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) : undefined,\n reverse: scale.get('reverse'),\n config\n });\n } else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) {\n return positionAndSize(mark, channelDef, channel, model);\n } else {\n return rangePosition(channel, model, {defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin'});\n }\n}\nfunction defaultSizeRef(\n mark: 'bar' | 'rect' | 'image' | 'arc',\n sizeChannel: 'width' | 'height',\n scaleName: string,\n scale: ScaleComponent,\n config: Config,\n band: number | true\n): VgValueRef {\n if (scale) {\n const scaleType = scale.get('type');\n if (scaleType === 'point' || scaleType === 'band') {\n if (config[mark].discreteBandSize !== undefined) {\n return {value: config[mark].discreteBandSize};\n }\n if (scaleType === ScaleType.POINT) {\n const scaleRange = scale.get('range');\n if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return {value: scaleRange.step - 2};\n }\n return {value: DEFAULT_STEP - 2};\n } else {\n // BAND\n return {scale: scaleName, band};\n }\n } else {\n // continuous scale\n return {value: config[mark].continuousBandSize};\n }\n }\n // No Scale\n\n const step = getViewConfigDiscreteStep(config.view, sizeChannel);\n\n const value = getFirstDefined(\n // No scale is like discrete bar (with one item)\n config[mark].discreteBandSize,\n step - 2\n );\n return value !== undefined ? {value} : undefined;\n}\n\n/**\n * Output position encoding and its size encoding for continuous, point, and band scales.\n */\nfunction positionAndSize(\n mark: 'bar' | 'rect' | 'image' | 'arc',\n fieldDef: Encoding['x' | 'y' | 'theta' | 'radius'],\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel\n) {\n const {markDef, encoding, config, stack} = model;\n const orient = markDef.orient;\n\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n const vgSizeChannel = getSizeChannel(channel);\n const channel2 = getSecondaryRangeChannel(channel);\n\n // use \"size\" channel for bars, if there is orient and the channel matches the right orientation\n const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x');\n\n const sizeFromMarkOrConfig = getMarkPropOrConfig(useVlSizeChannel ? 'size' : vgSizeChannel, markDef, config, {\n vgChannel: vgSizeChannel\n });\n\n // Use size encoding / mark property / config if it exists\n let sizeMixins;\n if (encoding.size || sizeFromMarkOrConfig !== undefined) {\n if (useVlSizeChannel) {\n sizeMixins = nonPosition('size', model, {vgChannel: vgSizeChannel, defaultValue: sizeFromMarkOrConfig});\n } else {\n log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type));\n }\n }\n\n // Otherwise, apply default value\n const band = (isFieldOrDatumDef(fieldDef) ? getBand({channel, fieldDef, markDef, stack, config}) : undefined) ?? 1;\n sizeMixins = sizeMixins || {[vgSizeChannel]: defaultSizeRef(mark, vgSizeChannel, scaleName, scale, config, band)};\n\n /*\n Band scales with size value and all point scales, use xc/yc + band=0.5\n\n Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2.\n In this case, size_band is the band specified in the x/y-encoding.\n By default band is 1, so `(1 - band) / 2` = 0.\n If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2\n */\n\n const center = scale?.get('type') !== 'band' || !('band' in sizeMixins[vgSizeChannel]);\n\n const vgChannel = vgAlignedPositionChannel(channel, markDef, config, center ? 'middle' : 'top');\n const offset = getOffset(channel, markDef);\n\n const posRef = ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: fieldDef,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: pointPositionDefaultRef({model, defaultPos: 'mid', channel, scaleName, scale}),\n band: center ? 0.5 : (1 - band) / 2\n });\n\n if (vgSizeChannel) {\n return {[vgChannel]: posRef, ...sizeMixins};\n } else {\n // otherwise, we must simulate size by setting position2 = position + size\n // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth)\n const vgChannel2 = getVgPositionChannel(channel2);\n const sizeRef = sizeMixins[vgSizeChannel];\n const sizeOffset = offset ? {...sizeRef, offset} : sizeRef;\n return {\n [vgChannel]: posRef,\n\n // posRef might be an array that wraps position invalid test\n [vgChannel2]: isArray(posRef)\n ? [posRef[0], {...posRef[1], offset: sizeOffset}]\n : {\n ...posRef,\n offset: sizeOffset\n }\n };\n }\n}\n\nfunction getBinSpacing(\n channel: PositionChannel | PolarPositionChannel,\n spacing: number,\n reverse: boolean | SignalRef,\n translate: number | SignalRef,\n offset: number | SignalRef\n) {\n if (isPolarPositionChannel(channel)) {\n return 0;\n }\n\n const spacingOffset = channel === 'x' || channel === 'y2' ? -spacing / 2 : spacing / 2;\n\n if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(translate)) {\n const reverseExpr = signalOrStringValue(reverse);\n const offsetExpr = signalOrStringValue(offset);\n const translateExpr = signalOrStringValue(translate);\n\n const t = translateExpr ? `${translateExpr} + ` : '';\n const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : '';\n const o = offsetExpr ? `(${offsetExpr} + ${spacingOffset})` : spacingOffset;\n\n return {\n signal: t + r + o\n };\n } else {\n offset = offset || 0;\n return translate + (reverse ? -offset - spacingOffset : +offset + spacingOffset);\n }\n}\n\nexport function rectBinPosition({\n fieldDef,\n fieldDef2,\n channel,\n band,\n scaleName,\n markDef,\n spacing = 0,\n axisTranslate,\n reverse,\n config\n}: {\n fieldDef: TypedFieldDef;\n fieldDef2?: Encoding['x2' | 'y2'];\n channel: 'x' | 'y' | 'theta' | 'radius';\n band: number;\n scaleName: string;\n markDef: MarkDef;\n spacing?: number;\n axisTranslate: number | SignalRef;\n reverse: boolean | SignalRef;\n config: Config;\n}) {\n const channel2 = getSecondaryRangeChannel(channel);\n\n const vgChannel = getVgPositionChannel(channel);\n const vgChannel2 = getVgPositionChannel(channel2);\n\n const offset = getOffset(channel, markDef);\n\n if (isBinning(fieldDef.bin) || fieldDef.timeUnit) {\n return {\n [vgChannel2]: rectBinRef({\n channel,\n fieldDef,\n scaleName,\n markDef,\n band: (1 - band) / 2,\n offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset),\n config\n }),\n [vgChannel]: rectBinRef({\n channel,\n fieldDef,\n scaleName,\n markDef,\n band: 1 - (1 - band) / 2,\n offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset),\n config\n })\n };\n } else if (isBinned(fieldDef.bin)) {\n const startRef = ref.valueRefForFieldOrDatumDef(\n fieldDef,\n scaleName,\n {},\n {offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset)}\n );\n\n if (isFieldDef(fieldDef2)) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: ref.valueRefForFieldOrDatumDef(\n fieldDef2,\n scaleName,\n {},\n {offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset)}\n )\n };\n } else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: {\n signal: `scale(\"${scaleName}\", ${vgField(fieldDef, {expr: 'datum'})} + ${fieldDef.bin.step})`,\n offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset)\n }\n };\n }\n }\n log.warn(log.message.channelRequiredForBinned(channel2));\n return undefined;\n}\n\n/**\n * Value Ref for binned fields\n */\nexport function rectBinRef({\n channel,\n fieldDef,\n scaleName,\n markDef,\n band,\n offset,\n config\n}: {\n channel: PositionChannel | PolarPositionChannel;\n fieldDef: TypedFieldDef;\n scaleName: string;\n markDef: MarkDef;\n band: number;\n offset?: number | SignalRef;\n config?: Config;\n}) {\n const r = ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: fieldDef,\n band,\n offset\n });\n\n return ref.wrapPositionInvalidTest({\n fieldDef,\n channel,\n markDef,\n ref: r,\n config\n });\n}\n","import {array} from 'vega-util';\nimport {Channel, ScaleChannel, SCALE_CHANNELS} from '../../../channel';\nimport {isPathMark, MarkDef} from '../../../mark';\nimport {hasContinuousDomain} from '../../../scale';\nimport {Dict, keys} from '../../../util';\nimport {VgEncodeEntry, VgValueRef, VG_MARK_CONFIGS} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {aria} from './aria';\nimport {color} from './color';\nimport {nonPosition} from './nonposition';\nimport {text} from './text';\nimport {tooltip} from './tooltip';\nimport {fieldInvalidPredicate} from './valueref';\nimport {zindex} from './zindex';\n\nexport {color} from './color';\nexport {wrapCondition} from './conditional';\nexport {nonPosition} from './nonposition';\nexport {pointPosition} from './position-point';\nexport {pointOrRangePosition, rangePosition} from './position-range';\nexport {rectPosition} from './position-rect';\nexport {text} from './text';\nexport {tooltip} from './tooltip';\n\nexport type Ignore = Record<'color' | 'size' | 'orient' | 'align' | 'baseline' | 'theta', 'ignore' | 'include'>;\n\nconst ALWAYS_IGNORE = new Set(['aria']);\n\nexport function baseEncodeEntry(model: UnitModel, ignore: Ignore) {\n const {fill = undefined, stroke = undefined} = ignore.color === 'include' ? color(model) : {};\n return {\n ...markDefProperties(model.markDef, ignore),\n ...wrapAllFieldsInvalid(model, 'fill', fill),\n ...wrapAllFieldsInvalid(model, 'stroke', stroke),\n ...nonPosition('opacity', model),\n ...nonPosition('fillOpacity', model),\n ...nonPosition('strokeOpacity', model),\n ...nonPosition('strokeWidth', model),\n ...nonPosition('strokeDash', model),\n ...zindex(model),\n ...tooltip(model),\n ...text(model, 'href'),\n ...aria(model)\n };\n}\n\n// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987\nfunction wrapAllFieldsInvalid(model: UnitModel, channel: Channel, valueRef: VgValueRef | VgValueRef[]): VgEncodeEntry {\n const {config, mark, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n\n if (invalid === 'hide' && valueRef && !isPathMark(mark)) {\n // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains.\n // For path marks, we will use \"defined\" property and skip these values instead.\n const test = allFieldsInvalidPredicate(model, {invalid: true, channels: SCALE_CHANNELS});\n if (test) {\n return {\n [channel]: [\n // prepend the invalid case\n // TODO: support custom value\n {test, value: null},\n ...array(valueRef)\n ]\n };\n }\n }\n return valueRef ? {[channel]: valueRef} : {};\n}\n\nfunction markDefProperties(mark: MarkDef, ignore: Ignore) {\n return VG_MARK_CONFIGS.reduce((m, prop) => {\n if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') {\n m[prop] = signalOrValueRef(mark[prop]);\n }\n return m;\n }, {});\n}\n\nfunction allFieldsInvalidPredicate(\n model: UnitModel,\n {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]}\n) {\n const filterIndex = channels.reduce((aggregator: Dict, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, {expr: 'datum'});\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n","import {POSITION_SCALE_CHANNELS} from '../../../channel';\nimport {ScaleChannel} from '../../../channel';\nimport {Value} from '../../../channeldef';\nimport {hasContinuousDomain} from '../../../scale';\nimport {Dict, keys} from '../../../util';\nimport {VgEncodeEntry} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {fieldInvalidPredicate} from './valueref';\n\nexport function defined(model: UnitModel): VgEncodeEntry {\n const {config, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid) {\n const signal = allFieldsInvalidPredicate(model, {channels: POSITION_SCALE_CHANNELS});\n\n if (signal) {\n return {defined: {signal}};\n }\n }\n return {};\n}\n\nfunction allFieldsInvalidPredicate(\n model: UnitModel,\n {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]}\n) {\n const filterIndex = channels.reduce((aggregator: Dict, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, {expr: 'datum'});\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n\nexport function valueIfDefined(prop: string, value: Value): VgEncodeEntry {\n if (value !== undefined) {\n return {[prop]: signalOrValueRef(value)};\n }\n return undefined;\n}\n","import * as log from '../../../log';\nimport {isPathMark} from '../../../mark';\nimport {tooltip} from '../../mark/encode';\nimport {TransformCompiler} from './transforms';\n\nconst VORONOI = 'voronoi';\n\nconst nearest: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type !== 'interval' && selCmpt.nearest;\n },\n\n parse: (model, selCmpt) => {\n // Scope selection events to the voronoi mark to prevent capturing\n // events that occur on the group mark (https://github.com/vega/vega/issues/2112).\n if (selCmpt.events) {\n for (const s of selCmpt.events) {\n s.markname = model.getName(VORONOI);\n }\n }\n },\n\n marks: (model, selCmpt, marks) => {\n const {x, y} = selCmpt.project.hasChannel;\n const markType = model.mark;\n if (isPathMark(markType)) {\n log.warn(log.message.nearestNotSupportForContinuous(markType));\n return marks;\n }\n\n const cellDef = {\n name: model.getName(VORONOI),\n type: 'path',\n interactive: true,\n from: {data: model.getName('marks')},\n encode: {\n update: {\n fill: {value: 'transparent'},\n strokeWidth: {value: 0.35},\n stroke: {value: 'transparent'},\n isVoronoi: {value: true},\n ...tooltip(model, {reactiveGeom: true})\n }\n },\n transform: [\n {\n type: 'voronoi',\n x: {expr: x || !y ? 'datum.datum.x || 0' : '0'},\n y: {expr: y || !x ? 'datum.datum.y || 0' : '0'},\n size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')]\n }\n ]\n };\n\n let index = 0;\n let exists = false;\n marks.forEach((mark, i) => {\n const name = mark.name ?? '';\n if (name === model.component.mark[0].name) {\n index = i;\n } else if (name.indexOf(VORONOI) >= 0) {\n exists = true;\n }\n });\n\n if (!exists) {\n marks.splice(index + 1, 0, cellDef);\n }\n\n return marks;\n }\n};\n\nexport default nearest;\n","import {DataSourceType} from '../../data';\nimport * as log from '../../log';\nimport {Dict, uniqueId} from '../../util';\n\n/**\n * A node in the dataflow tree.\n */\nexport abstract class DataFlowNode {\n private _children: DataFlowNode[] = [];\n\n private _parent: DataFlowNode = null;\n\n protected _hash: string | number;\n\n constructor(parent: DataFlowNode, public readonly debugName?: string) {\n if (parent) {\n this.parent = parent;\n }\n }\n\n /**\n * Clone this node with a deep copy but don't clone links to children or parents.\n */\n public clone(): DataFlowNode {\n throw new Error('Cannot clone node');\n }\n\n /**\n * Return a hash of the node.\n */\n public abstract hash(): string | number;\n\n /**\n * Set of fields that this node depends on.\n */\n public abstract dependentFields(): Set;\n\n /**\n * Set of fields that are being created by this node.\n */\n public abstract producedFields(): Set;\n\n get parent() {\n return this._parent;\n }\n\n /**\n * Set the parent of the node and also add this node to the parent's children.\n */\n set parent(parent: DataFlowNode) {\n this._parent = parent;\n if (parent) {\n parent.addChild(this);\n }\n }\n\n get children() {\n return this._children;\n }\n\n public numChildren() {\n return this._children.length;\n }\n\n public addChild(child: DataFlowNode, loc?: number) {\n // do not add the same child twice\n if (this._children.indexOf(child) > -1) {\n log.warn(log.message.ADD_SAME_CHILD_TWICE);\n return;\n }\n\n if (loc !== undefined) {\n this._children.splice(loc, 0, child);\n } else {\n this._children.push(child);\n }\n }\n\n public removeChild(oldChild: DataFlowNode) {\n const loc = this._children.indexOf(oldChild);\n this._children.splice(loc, 1);\n return loc;\n }\n\n /**\n * Remove node from the dataflow.\n */\n public remove() {\n let loc = this._parent.removeChild(this);\n for (const child of this._children) {\n // do not use the set method because we want to insert at a particular location\n child._parent = this._parent;\n this._parent.addChild(child, loc++);\n }\n }\n\n /**\n * Insert another node as a parent of this node.\n */\n public insertAsParentOf(other: DataFlowNode) {\n const parent = other.parent;\n parent.removeChild(this);\n this.parent = parent;\n other.parent = this;\n }\n\n public swapWithParent() {\n const parent = this._parent;\n const newParent = parent.parent;\n\n // reconnect the children\n for (const child of this._children) {\n child.parent = parent;\n }\n\n // remove old links\n this._children = []; // equivalent to removing every child link one by one\n parent.removeChild(this);\n parent.parent.removeChild(parent);\n\n // swap two nodes\n this.parent = newParent;\n parent.parent = this;\n }\n}\n\nexport class OutputNode extends DataFlowNode {\n private _source: string;\n\n private _name: string;\n\n public clone(): this {\n const cloneObj = new (this.constructor as any)();\n cloneObj.debugName = 'clone_' + this.debugName;\n cloneObj._source = this._source;\n cloneObj._name = 'clone_' + this._name;\n cloneObj.type = this.type;\n cloneObj.refCounts = this.refCounts;\n cloneObj.refCounts[cloneObj._name] = 0;\n return cloneObj;\n }\n\n /**\n * @param source The name of the source. Will change in assemble.\n * @param type The type of the output node.\n * @param refCounts A global ref counter map.\n */\n constructor(\n parent: DataFlowNode,\n source: string,\n public readonly type: DataSourceType,\n private readonly refCounts: Dict\n ) {\n super(parent, source);\n\n this._source = this._name = source;\n\n if (this.refCounts && !(this._name in this.refCounts)) {\n this.refCounts[this._name] = 0;\n }\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n if (this._hash === undefined) {\n this._hash = `Output ${uniqueId()}`;\n }\n return this._hash;\n }\n\n /**\n * Request the datasource name and increase the ref counter.\n *\n * During the parsing phase, this will return the simple name such as 'main' or 'raw'.\n * It is crucial to request the name from an output node to mark it as a required node.\n * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase.\n *\n * In the assemble phase, this will return the correct name.\n */\n public getSource() {\n this.refCounts[this._name]++;\n return this._source;\n }\n\n public isRequired(): boolean {\n return !!this.refCounts[this._name];\n }\n\n public setSource(source: string) {\n this._source = source;\n }\n}\n","import {TimeUnitTransform as VgTimeUnitTransform} from 'vega';\nimport {getSecondaryRangeChannel} from '../../channel';\nimport {hasBand, vgField} from '../../channeldef';\nimport {getTimeUnitParts, normalizeTimeUnit} from '../../timeunit';\nimport {TimeUnitTransform} from '../../transform';\nimport {Dict, duplicate, hash, isEmpty, replacePathInField, vals} from '../../util';\nimport {isUnitModel, ModelWithField} from '../model';\nimport {DataFlowNode} from './dataflow';\n\nexport type TimeUnitComponent = TimeUnitTransform & {\n /** whether to output time unit as a band (generate two formula including start and end) */\n band?: boolean;\n};\n\nexport class TimeUnitNode extends DataFlowNode {\n public clone() {\n return new TimeUnitNode(null, duplicate(this.formula));\n }\n\n constructor(parent: DataFlowNode, private formula: Dict) {\n super(parent);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) {\n const formula = model.reduceFieldDef((timeUnitComponent: TimeUnitComponent, fieldDef, channel) => {\n const {field, timeUnit} = fieldDef;\n\n const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;\n\n const band =\n isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config);\n\n if (timeUnit) {\n const as = vgField(fieldDef, {forAs: true});\n timeUnitComponent[\n hash({\n as,\n field,\n timeUnit\n })\n ] = {\n as,\n field,\n timeUnit,\n ...(band ? {band: true} : {})\n };\n }\n return timeUnitComponent;\n }, {} as Dict);\n\n if (isEmpty(formula)) {\n return null;\n }\n\n return new TimeUnitNode(parent, formula);\n }\n\n public static makeFromTransform(parent: DataFlowNode, t: TimeUnitTransform) {\n const {timeUnit, ...other} = {...t};\n\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n\n const component = {\n ...other,\n timeUnit: normalizedTimeUnit\n };\n\n return new TimeUnitNode(parent, {\n [hash(component)]: component\n });\n }\n\n /**\n * Merge together TimeUnitNodes assigning the children of `other` to `this`\n * and removing `other`.\n */\n public merge(other: TimeUnitNode) {\n this.formula = {...this.formula};\n\n // if the same hash happen twice, merge \"band\"\n for (const key in other.formula) {\n if (!this.formula[key] || other.formula[key].band) {\n // copy if it's not a duplicate or if we need to include copy band over\n this.formula[key] = other.formula[key];\n }\n }\n\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n\n other.remove();\n }\n\n public producedFields() {\n return new Set(vals(this.formula).map(f => f.as));\n }\n\n public dependentFields() {\n return new Set(vals(this.formula).map(f => f.field));\n }\n\n public hash() {\n return `TimeUnit ${hash(this.formula)}`;\n }\n\n public assemble() {\n const transforms: VgTimeUnitTransform[] = [];\n\n for (const f of vals(this.formula)) {\n const {field, as, timeUnit} = f;\n const {unit, utc, ...params} = normalizeTimeUnit(timeUnit);\n\n transforms.push({\n field: replacePathInField(field),\n type: 'timeunit',\n ...(unit ? {units: getTimeUnitParts(unit)} : {}),\n ...(utc ? {timezone: 'utc'} : {}),\n ...params,\n as: [as, `${as}_end`]\n });\n }\n\n return transforms;\n }\n}\n","import {array} from 'vega-util';\nimport {isSingleDefUnitChannel, ScaleChannel, SingleDefUnitChannel} from '../../../channel';\nimport * as log from '../../../log';\nimport {hasContinuousDomain} from '../../../scale';\nimport {SelectionInit, SelectionInitInterval} from '../../../selection';\nimport {Dict, hash, keys, replacePathInField, varName, isEmpty} from '../../../util';\nimport {TimeUnitComponent, TimeUnitNode} from '../../data/timeunit';\nimport {TransformCompiler} from './transforms';\n\nexport const TUPLE_FIELDS = '_tuple_fields';\n\n/**\n * Whether the selection tuples hold enumerated or ranged values for a field.\n */\nexport type TupleStoreType =\n // enumerated\n | 'E'\n // ranged, exclusive, left-right inclusive\n | 'R'\n // ranged, left-inclusive, right-exclusive\n | 'R-RE';\n\nexport interface SelectionProjection {\n type: TupleStoreType;\n field: string;\n channel?: SingleDefUnitChannel;\n signals?: {data?: string; visual?: string};\n hasLegend?: boolean;\n}\n\nexport class SelectionProjectionComponent {\n public hasChannel: Partial>;\n public hasField: Record;\n public timeUnit?: TimeUnitNode;\n public items: SelectionProjection[];\n\n constructor(...items: SelectionProjection[]) {\n this.items = items;\n this.hasChannel = {};\n this.hasField = {};\n }\n}\n\nconst project: TransformCompiler = {\n has: () => {\n return true; // This transform handles its own defaults, so always run parse.\n },\n\n parse: (model, selCmpt, selDef) => {\n const name = selCmpt.name;\n const proj = selCmpt.project ?? (selCmpt.project = new SelectionProjectionComponent());\n const parsed: Dict = {};\n const timeUnits: Dict = {};\n\n const signals = new Set();\n const signalName = (p: SelectionProjection, range: 'data' | 'visual') => {\n const suffix = range === 'visual' ? p.channel : p.field;\n let sg = varName(`${name}_${suffix}`);\n for (let counter = 1; signals.has(sg); counter++) {\n sg = varName(`${name}_${suffix}_${counter}`);\n }\n signals.add(sg);\n return {[range]: sg};\n };\n\n // If no explicit projection (either fields or encodings) is specified, set some defaults.\n // If an initial value is set, try to infer projections.\n // Otherwise, use the default configuration.\n if (!selDef.fields && !selDef.encodings) {\n const cfg = model.config.selection[selDef.type];\n\n if (selDef.init) {\n for (const init of array(selDef.init)) {\n for (const key of keys(init)) {\n if (isSingleDefUnitChannel(key)) {\n (selDef.encodings || (selDef.encodings = [])).push(key as SingleDefUnitChannel);\n } else {\n if (selDef.type === 'interval') {\n log.warn(log.message.INTERVAL_INITIALIZED_WITH_X_Y);\n selDef.encodings = cfg.encodings;\n } else {\n (selDef.fields || (selDef.fields = [])).push(key);\n }\n }\n }\n }\n } else {\n selDef.encodings = cfg.encodings;\n selDef.fields = cfg.fields;\n }\n }\n\n // TODO: find a possible channel mapping for these fields.\n for (const field of selDef.fields ?? []) {\n const p: SelectionProjection = {type: 'E', field};\n p.signals = {...signalName(p, 'data')};\n proj.items.push(p);\n proj.hasField[field] = p;\n }\n\n for (const channel of selDef.encodings ?? []) {\n const fieldDef = model.fieldDef(channel);\n if (fieldDef) {\n let field = fieldDef.field;\n\n if (fieldDef.aggregate) {\n log.warn(log.message.cannotProjectAggregate(channel, fieldDef.aggregate));\n continue;\n } else if (!field) {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n continue;\n }\n\n if (fieldDef.timeUnit) {\n field = model.vgField(channel);\n // Construct TimeUnitComponents which will be combined into a\n // TimeUnitNode. This node may need to be inserted into the\n // dataflow if the selection is used across views that do not\n // have these time units defined.\n const component = {\n timeUnit: fieldDef.timeUnit,\n as: field,\n field: fieldDef.field\n };\n\n timeUnits[hash(component)] = component;\n }\n\n // Prevent duplicate projections on the same field.\n // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag).\n if (!parsed[field]) {\n // Determine whether the tuple will store enumerated or ranged values.\n // Interval selections store ranges for continuous scales, and enumerations otherwise.\n // Single/multi selections store ranges for binned fields, and enumerations otherwise.\n let type: TupleStoreType = 'E';\n if (selCmpt.type === 'interval') {\n const scaleType = model.getScaleComponent(channel as ScaleChannel).get('type');\n if (hasContinuousDomain(scaleType)) {\n type = 'R';\n }\n } else if (fieldDef.bin) {\n type = 'R-RE';\n }\n\n const p: SelectionProjection = {field, channel, type};\n p.signals = {...signalName(p, 'data'), ...signalName(p, 'visual')};\n proj.items.push((parsed[field] = p));\n proj.hasField[field] = proj.hasChannel[channel] = parsed[field];\n }\n } else {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n }\n }\n\n if (selDef.init) {\n const parseInit = (i: Dict): T[] => {\n return proj.items.map(p => (i[p.channel] !== undefined ? i[p.channel] : i[p.field]));\n };\n\n if (selDef.type === 'interval') {\n selCmpt.init = parseInit(selDef.init);\n } else {\n const init = array(selDef.init);\n selCmpt.init = init.map(parseInit);\n }\n }\n\n if (!isEmpty(timeUnits)) {\n proj.timeUnit = new TimeUnitNode(null, timeUnits);\n }\n },\n\n signals: (model, selCmpt, allSignals) => {\n const name = selCmpt.name + TUPLE_FIELDS;\n const hasSignal = allSignals.filter(s => s.name === name);\n return hasSignal.length > 0\n ? allSignals\n : allSignals.concat({\n name,\n value: selCmpt.project.items.map(proj => {\n const {signals, hasLegend, ...rest} = proj;\n rest.field = replacePathInField(rest.field);\n return rest;\n })\n });\n }\n};\n\nexport default project;\n","import {stringValue} from 'vega-util';\nimport {TUPLE} from '..';\nimport {varName} from '../../../util';\nimport {assembleInit} from '../assemble';\nimport nearest from './nearest';\nimport {TUPLE_FIELDS} from './project';\nimport {TransformCompiler} from './transforms';\nimport {isLegendBinding} from '../../../selection';\n\nconst inputBindings: TransformCompiler = {\n has: selCmpt => {\n return (\n selCmpt.type === 'single' &&\n selCmpt.resolve === 'global' &&\n selCmpt.bind &&\n selCmpt.bind !== 'scales' &&\n !isLegendBinding(selCmpt.bind)\n );\n },\n\n parse: (model, selCmpt, selDef, origDef) => {\n // Binding a selection to input widgets disables default direct manipulation interaction.\n // A user can choose to re-enable it by explicitly specifying triggering input events.\n if (!origDef.on) delete selCmpt.events;\n if (!origDef.clear) delete selCmpt.clear;\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const bind = selCmpt.bind;\n const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value).\n const datum = nearest.has(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum';\n\n proj.items.forEach((p, i) => {\n const sgname = varName(`${name}_${p.field}`);\n const hasSignal = signals.filter(s => s.name === sgname);\n\n if (!hasSignal.length) {\n signals.unshift({\n name: sgname,\n ...(init ? {init: assembleInit(init[i])} : {value: null}),\n on: selCmpt.events\n ? [\n {\n events: selCmpt.events,\n update: `datum && item().mark.marktype !== 'group' ? ${datum}[${stringValue(p.field)}] : null`\n }\n ]\n : [],\n bind: bind[p.field] ?? bind[p.channel] ?? bind\n });\n }\n });\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const signal = signals.filter(s => s.name === name + TUPLE)[0];\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.map(p => varName(`${name}_${p.field}`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n\n if (values.length) {\n signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n }\n\n delete signal.value;\n delete signal.on;\n\n return signals;\n }\n};\n\nexport default inputBindings;\n","import {TUPLE, unitName} from '..';\nimport {TransformCompiler} from './transforms';\n\nexport const TOGGLE = '_toggle';\n\nconst toggle: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type === 'multi' && !!selCmpt.toggle;\n },\n\n signals: (model, selCmpt, signals) => {\n return signals.concat({\n name: selCmpt.name + TOGGLE,\n value: false,\n on: [{events: selCmpt.events, update: selCmpt.toggle}]\n });\n },\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n const signal = selCmpt.name + TOGGLE;\n\n return (\n `${signal} ? null : ${tpl}, ` +\n (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) +\n `${signal} ? ${tpl} : null`\n );\n }\n};\n\nexport default toggle;\n","import {Update} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {isString} from 'vega-util';\nimport {TUPLE} from '..';\nimport {varName} from '../../../util';\nimport inputBindings from './inputs';\nimport toggle, {TOGGLE} from './toggle';\nimport {TransformCompiler} from './transforms';\n\nconst clear: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.clear !== undefined && selCmpt.clear !== false;\n },\n\n parse: (model, selCmpt, selDef) => {\n if (selDef.clear) {\n selCmpt.clear = isString(selDef.clear) ? parseSelector(selDef.clear, 'scope') : selDef.clear;\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n if (inputBindings.has(selCmpt)) {\n for (const proj of selCmpt.project.items) {\n const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`));\n if (idx !== -1) {\n signals[idx].on.push({events: selCmpt.clear, update: 'null'});\n }\n }\n }\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n function addClear(idx: number, update: Update) {\n if (idx !== -1 && signals[idx].on) {\n signals[idx].on.push({events: selCmpt.clear, update});\n }\n }\n\n // Be as minimalist as possible when adding clear triggers to minimize dataflow execution.\n if (selCmpt.type === 'interval') {\n for (const proj of selCmpt.project.items) {\n const vIdx = signals.findIndex(n => n.name === proj.signals.visual);\n addClear(vIdx, '[0, 0]');\n\n if (vIdx === -1) {\n const dIdx = signals.findIndex(n => n.name === proj.signals.data);\n addClear(dIdx, 'null');\n }\n }\n } else {\n let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE);\n addClear(tIdx, 'null');\n\n if (toggle.has(selCmpt)) {\n tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE);\n addClear(tIdx, 'false');\n }\n }\n\n return signals;\n }\n};\n\nexport default clear;\n","import {stringValue} from 'vega-util';\nimport {VL_SELECTION_RESOLVE} from '..';\nimport {isScaleChannel, ScaleChannel} from '../../../channel';\nimport * as log from '../../../log';\nimport {hasContinuousDomain} from '../../../scale';\nimport {isLayerModel, Model} from '../../model';\nimport {UnitModel} from '../../unit';\nimport {SelectionProjection} from './project';\nimport {TransformCompiler} from './transforms';\n\nconst scaleBindings: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales';\n },\n\n parse: (model, selCmpt) => {\n const bound: SelectionProjection[] = (selCmpt.scales = []);\n\n for (const proj of selCmpt.project.items) {\n const channel = proj.channel;\n\n if (!isScaleChannel(channel)) {\n continue;\n }\n\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n\n if (!scale || !hasContinuousDomain(scaleType)) {\n log.warn(log.message.SCALE_BINDINGS_CONTINUOUS);\n continue;\n }\n\n const extent = {selection: selCmpt.name, field: proj.field};\n scale.set('selectionExtent', extent, true);\n bound.push(proj);\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0);\n\n // Top-level signals are only needed for multiview displays and if this\n // view's top-level signals haven't already been generated.\n if (!model.parent || isTopLevelLayer(model) || bound.length === 0) {\n return signals;\n }\n\n // vlSelectionResolve does not account for the behavior of bound scales in\n // multiview displays. Each unit view adds a tuple to the store, but the\n // state of the selection is the unit selection most recently updated. This\n // state is captured by the top-level signals that we insert and \"push\n // outer\" to from within the units. We need to reassemble this state into\n // the top-level named signal, except no single selCmpt has a global view.\n const namedSg = signals.filter(s => s.name === selCmpt.name)[0];\n let update = namedSg.update;\n if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) {\n namedSg.update = `{${bound.map(proj => `${stringValue(proj.field)}: ${proj.signals.data}`).join(', ')}}`;\n } else {\n for (const proj of bound) {\n const mapping = `${stringValue(proj.field)}: ${proj.signals.data}`;\n if (update.indexOf(mapping) < 0) {\n update = `${update.substring(0, update.length - 1)}, ${mapping}}`;\n }\n }\n namedSg.update = update;\n }\n\n return signals.concat(bound.map(proj => ({name: proj.signals.data})));\n },\n\n signals: (model, selCmpt, signals) => {\n // Nested signals need only push to top-level signals with multiview displays.\n if (model.parent && !isTopLevelLayer(model)) {\n for (const proj of selCmpt.scales) {\n const signal: any = signals.filter(s => s.name === proj.signals.data)[0];\n signal.push = 'outer';\n delete signal.value;\n delete signal.update;\n }\n }\n\n return signals;\n }\n};\n\nexport default scaleBindings;\n\nexport function domain(model: UnitModel, channel: ScaleChannel) {\n const scale = stringValue(model.scaleName(channel));\n return `domain(${scale})`;\n}\n\nfunction isTopLevelLayer(model: Model): boolean {\n return model.parent && isLayerModel(model.parent) && (!model.parent.parent ?? isTopLevelLayer(model.parent.parent));\n}\n","import {MergedStream, Stream} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {array, isString} from 'vega-util';\nimport {forEachSelection, SelectionComponent, TUPLE} from '..';\nimport {NonPositionScaleChannel} from '../../../channel';\nimport * as log from '../../../log';\nimport {isLegendBinding, isLegendStreamBinding, SELECTION_ID} from '../../../selection';\nimport {duplicate, varName} from '../../../util';\nimport {LegendComponent} from '../../legend/component';\nimport {UnitModel} from '../../unit';\nimport {TUPLE_FIELDS} from './project';\nimport {TOGGLE} from './toggle';\nimport {TransformCompiler} from './transforms';\n\nconst legendBindings: TransformCompiler = {\n has: (selCmpt: SelectionComponent<'single' | 'multi'>) => {\n const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind);\n const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID;\n if (spec && !projLen) {\n log.warn(log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION);\n }\n\n return spec && projLen;\n },\n\n parse: (model, selCmpt, selDef, origDef) => {\n // Binding a selection to a legend disables default direct manipulation interaction.\n // A user can choose to re-enable it by explicitly specifying triggering input events.\n if (!origDef.on) delete selCmpt.events;\n if (!origDef.clear) delete selCmpt.clear;\n\n if (origDef.on || origDef.clear) {\n const legendFilter = 'event.item && indexof(event.item.mark.role, \"legend\") < 0';\n for (const evt of selCmpt.events) {\n evt.filter = array(evt.filter ?? []);\n if (evt.filter.indexOf(legendFilter) < 0) {\n evt.filter.push(legendFilter);\n }\n }\n }\n\n const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click';\n const stream: Stream[] = isString(evt) ? parseSelector(evt, 'view') : array(evt);\n selCmpt.bind = {legend: {merge: stream}};\n },\n\n topLevelSignals: (model, selCmpt: SelectionComponent<'single' | 'multi'>, signals) => {\n const selName = selCmpt.name;\n const stream = isLegendStreamBinding(selCmpt.bind) && (selCmpt.bind.legend as MergedStream);\n const markName = (name: string) => (s: Stream) => {\n const ds = duplicate(s);\n ds.markname = name;\n return ds;\n };\n\n for (const proj of selCmpt.project.items) {\n if (!proj.hasLegend) continue;\n const prefix = `${varName(proj.field)}_legend`;\n const sgName = `${selName}_${prefix}`;\n const hasSignal = signals.filter(s => s.name === sgName);\n\n if (hasSignal.length === 0) {\n const events = stream.merge\n .map(markName(`${prefix}_symbols`))\n .concat(stream.merge.map(markName(`${prefix}_labels`)))\n .concat(stream.merge.map(markName(`${prefix}_entries`)));\n\n signals.unshift({\n name: sgName,\n ...(!selCmpt.init ? {value: null} : {}),\n on: [\n // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum.\n {events, update: 'datum.value || item().items[0].items[0].datum.value', force: true},\n {events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true}\n ]\n });\n }\n }\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const tuple = signals.find(s => s.name === name + TUPLE);\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n\n if (selCmpt.events && values.length > 0) {\n tuple.on.push({\n events: values.map(signal => ({signal})),\n update\n });\n } else if (values.length > 0) {\n tuple.update = update;\n delete tuple.value;\n delete tuple.on;\n }\n\n const toggle = signals.find(s => s.name === name + TOGGLE);\n const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;\n if (toggle) {\n if (!selCmpt.events) toggle.on[0].events = events;\n else toggle.on.push({...toggle.on[0], events});\n }\n\n return signals;\n }\n};\n\nexport default legendBindings;\n\nexport function parseInteractiveLegend(\n model: UnitModel,\n channel: NonPositionScaleChannel,\n legendCmpt: LegendComponent\n) {\n const field = model.fieldDef(channel)?.field;\n forEachSelection(model, selCmpt => {\n const proj = selCmpt.project.hasField[field] ?? selCmpt.project.hasChannel[channel];\n if (proj && legendBindings.has(selCmpt)) {\n const legendSelections = legendCmpt.get('selections') ?? [];\n legendSelections.push(selCmpt.name);\n legendCmpt.set('selections', legendSelections, false);\n proj.hasLegend = true;\n }\n });\n}\n","import {NewSignal} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {SelectionComponent} from '..';\nimport {ScaleChannel, X, Y} from '../../../channel';\nimport {UnitModel} from '../../unit';\nimport {BRUSH as INTERVAL_BRUSH} from '../interval';\nimport {SelectionProjection} from './project';\nimport scalesCompiler, {domain} from './scales';\nimport {TransformCompiler} from './transforms';\n\nconst ANCHOR = '_translate_anchor';\nconst DELTA = '_translate_delta';\n\nconst translate: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.translate;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const hasScales = scalesCompiler.has(selCmpt);\n const anchor = name + ANCHOR;\n const {x, y} = selCmpt.project.hasChannel;\n let events = parseSelector(selCmpt.translate, 'scope');\n\n if (!hasScales) {\n events = events.map(e => ((e.between[0].markname = name + INTERVAL_BRUSH), e));\n }\n\n signals.push(\n {\n name: anchor,\n value: {},\n on: [\n {\n events: events.map(e => e.between[0]),\n update:\n '{x: x(unit), y: y(unit)' +\n (x !== undefined ? ', extent_x: ' + (hasScales ? domain(model, X) : `slice(${x.signals.visual})`) : '') +\n (y !== undefined ? ', extent_y: ' + (hasScales ? domain(model, Y) : `slice(${y.signals.visual})`) : '') +\n '}'\n }\n ]\n },\n {\n name: name + DELTA,\n value: {},\n on: [\n {\n events: events,\n update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}`\n }\n ]\n }\n );\n\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n\n return signals;\n }\n};\n\nexport default translate;\n\nfunction onDelta(\n model: UnitModel,\n selCmpt: SelectionComponent,\n proj: SelectionProjection,\n size: 'width' | 'height',\n signals: NewSignal[]\n) {\n const name = selCmpt.name;\n const anchor = name + ANCHOR;\n const delta = name + DELTA;\n const channel = proj.channel as ScaleChannel;\n const hasScales = scalesCompiler.has(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt.get('type');\n const sign = hasScales && channel === X ? '-' : ''; // Invert delta when panning x-scales.\n const extent = `${anchor}.extent_${channel}`;\n const offset = `${sign}${delta}.${channel} / ` + (hasScales ? `${sizeSg}` : `span(${extent})`);\n const panFn = !hasScales\n ? 'panLinear'\n : scaleType === 'log'\n ? 'panLog'\n : scaleType === 'pow'\n ? 'panPow'\n : 'panLinear';\n const update =\n `${panFn}(${extent}, ${offset}` +\n (hasScales && scaleType === 'pow' ? `, ${scaleCmpt.get('exponent') ?? 1}` : '') +\n ')';\n\n signal.on.push({\n events: {signal: delta},\n update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n","import {NewSignal} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {stringValue} from 'vega-util';\nimport {SelectionComponent} from '..';\nimport {ScaleChannel, X, Y} from '../../../channel';\nimport {UnitModel} from '../../unit';\nimport {BRUSH as INTERVAL_BRUSH} from '../interval';\nimport {SelectionProjection} from './project';\nimport {default as scalesCompiler, domain} from './scales';\nimport {TransformCompiler} from './transforms';\n\nconst ANCHOR = '_zoom_anchor';\nconst DELTA = '_zoom_delta';\n\nconst zoom: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.zoom;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const hasScales = scalesCompiler.has(selCmpt);\n const delta = name + DELTA;\n const {x, y} = selCmpt.project.hasChannel;\n const sx = stringValue(model.scaleName(X));\n const sy = stringValue(model.scaleName(Y));\n let events = parseSelector(selCmpt.zoom, 'scope');\n\n if (!hasScales) {\n events = events.map(e => ((e.markname = name + INTERVAL_BRUSH), e));\n }\n\n signals.push(\n {\n name: name + ANCHOR,\n on: [\n {\n events: events,\n update: !hasScales\n ? `{x: x(unit), y: y(unit)}`\n : '{' +\n [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : '']\n .filter(expr => !!expr)\n .join(', ') +\n '}'\n }\n ]\n },\n {\n name: delta,\n on: [\n {\n events: events,\n force: true,\n update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))'\n }\n ]\n }\n );\n\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n\n return signals;\n }\n};\n\nexport default zoom;\n\nfunction onDelta(\n model: UnitModel,\n selCmpt: SelectionComponent,\n proj: SelectionProjection,\n size: 'width' | 'height',\n signals: NewSignal[]\n) {\n const name = selCmpt.name;\n const channel = proj.channel as ScaleChannel;\n const hasScales = scalesCompiler.has(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt.get('type');\n const base = hasScales ? domain(model, channel) : signal.name;\n const delta = name + DELTA;\n const anchor = `${name}${ANCHOR}.${channel}`;\n const zoomFn = !hasScales\n ? 'zoomLinear'\n : scaleType === 'log'\n ? 'zoomLog'\n : scaleType === 'pow'\n ? 'zoomPow'\n : 'zoomLinear';\n const update =\n `${zoomFn}(${base}, ${anchor}, ${delta}` +\n (hasScales && scaleType === 'pow' ? `, ${scaleCmpt.get('exponent') ?? 1}` : '') +\n ')';\n\n signal.on.push({\n events: {signal: delta},\n update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n","import {NewSignal, Signal} from 'vega';\nimport {SelectionComponent} from '..';\nimport {SelectionDef} from '../../../selection';\nimport {Model} from '../../model';\nimport {UnitModel} from '../../unit';\nimport clear from './clear';\nimport inputs from './inputs';\nimport nearest from './nearest';\nimport project from './project';\nimport scales from './scales';\nimport legends from './legends';\nimport toggle from './toggle';\nimport translate from './translate';\nimport zoom from './zoom';\n\nexport interface TransformCompiler {\n has: (selCmpt: SelectionComponent) => boolean;\n parse?: (model: UnitModel, selCmpt: SelectionComponent, def: SelectionDef, origDef: SelectionDef) => void;\n signals?: (model: UnitModel, selCmpt: SelectionComponent, signals: NewSignal[]) => Signal[]; // the output can be a new or a push signal\n topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: NewSignal[]) => NewSignal[];\n modifyExpr?: (model: UnitModel, selCmpt: SelectionComponent, expr: string) => string;\n marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[];\n}\n\nconst compilers: TransformCompiler[] = [project, toggle, scales, legends, translate, zoom, inputs, nearest, clear];\n\nexport function forEachTransform(selCmpt: SelectionComponent, cb: (tx: TransformCompiler) => void) {\n for (const t of compilers) {\n if (t.has(selCmpt)) {\n cb(t);\n }\n }\n}\n","import {Signal, SignalRef} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {identity, isArray, stringValue} from 'vega-util';\nimport {forEachSelection, MODIFY, STORE, unitName, VL_SELECTION_RESOLVE, TUPLE} from '.';\nimport {dateTimeToExpr, isDateTime, dateTimeToTimestamp} from '../../datetime';\nimport {SelectionInit, SelectionInitInterval, SelectionExtent} from '../../selection';\nimport {keys, varName} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {FacetModel} from '../facet';\nimport {LayerModel} from '../layer';\nimport {isUnitModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {forEachTransform} from './transforms/transforms';\nimport {parseSelectionBinExtent} from './parse';\n\nexport function assembleInit(\n init: readonly (SelectionInit | readonly SelectionInit[] | SelectionInitInterval)[] | SelectionInit,\n isExpr = true,\n wrap: (str: string | number) => string | number = identity\n): any {\n if (isArray(init)) {\n const assembled = init.map(v => assembleInit(v, isExpr, wrap));\n return isExpr ? `[${assembled.join(', ')}]` : assembled;\n } else if (isDateTime(init)) {\n if (isExpr) {\n return wrap(dateTimeToExpr(init));\n } else {\n return wrap(dateTimeToTimestamp(init));\n }\n }\n return isExpr ? wrap(JSON.stringify(init)) : init;\n}\n\nexport function assembleUnitSelectionSignals(model: UnitModel, signals: Signal[]) {\n forEachSelection(model, (selCmpt, selCompiler) => {\n const name = selCmpt.name;\n let modifyExpr = selCompiler.modifyExpr(model, selCmpt);\n\n signals.push(...selCompiler.signals(model, selCmpt));\n\n forEachTransform(selCmpt, txCompiler => {\n if (txCompiler.signals) {\n signals = txCompiler.signals(model, selCmpt, signals);\n }\n if (txCompiler.modifyExpr) {\n modifyExpr = txCompiler.modifyExpr(model, selCmpt, modifyExpr);\n }\n });\n\n signals.push({\n name: name + MODIFY,\n on: [\n {\n events: {signal: selCmpt.name + TUPLE},\n update: `modify(${stringValue(selCmpt.name + STORE)}, ${modifyExpr})`\n }\n ]\n });\n });\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleFacetSignals(model: FacetModel, signals: Signal[]) {\n if (model.component.selection && keys(model.component.selection).length) {\n const name = stringValue(model.getName('cell'));\n signals.unshift({\n name: 'facet',\n value: {},\n on: [\n {\n events: parseSelector('mousemove', 'scope'),\n update: `isTuple(facet) ? facet : group(${name}).datum`\n }\n ]\n });\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleTopLevelSignals(model: UnitModel, signals: Signal[]) {\n let hasSelections = false;\n forEachSelection(model, (selCmpt, selCompiler) => {\n const name = selCmpt.name;\n const store = stringValue(name + STORE);\n const hasSg = signals.filter(s => s.name === name);\n if (hasSg.length === 0) {\n const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve;\n const isMulti = selCmpt.type === 'multi' ? ', true)' : ')';\n signals.push({\n name: selCmpt.name,\n update: `${VL_SELECTION_RESOLVE}(${store}, ${stringValue(resolve)}${isMulti}`\n });\n }\n hasSelections = true;\n\n if (selCompiler.topLevelSignals) {\n signals = selCompiler.topLevelSignals(model, selCmpt, signals);\n }\n\n forEachTransform(selCmpt, txCompiler => {\n if (txCompiler.topLevelSignals) {\n signals = txCompiler.topLevelSignals(model, selCmpt, signals);\n }\n });\n });\n\n if (hasSelections) {\n const hasUnit = signals.filter(s => s.name === 'unit');\n if (hasUnit.length === 0) {\n signals.unshift({\n name: 'unit',\n value: {},\n on: [{events: 'mousemove', update: 'isTuple(group()) ? group() : unit'}]\n });\n }\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleUnitSelectionData(model: UnitModel, data: readonly VgData[]): VgData[] {\n const dataCopy = [...data];\n forEachSelection(model, selCmpt => {\n const init: VgData = {name: selCmpt.name + STORE};\n if (selCmpt.init) {\n const fields = selCmpt.project.items.map(proj => {\n const {signals, ...rest} = proj;\n return rest;\n });\n\n const insert = selCmpt.init.map(i => assembleInit(i, false));\n init.values =\n selCmpt.type === 'interval'\n ? [{unit: unitName(model, {escape: false}), fields, values: insert}]\n : insert.map(i => ({unit: unitName(model, {escape: false}), fields, values: i}));\n }\n const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE);\n if (!contains.length) {\n dataCopy.push(init);\n }\n });\n\n return dataCopy;\n}\n\nexport function assembleUnitSelectionMarks(model: UnitModel, marks: any[]): any[] {\n forEachSelection(model, (selCmpt, selCompiler) => {\n marks = selCompiler.marks ? selCompiler.marks(model, selCmpt, marks) : marks;\n forEachTransform(selCmpt, txCompiler => {\n if (txCompiler.marks) {\n marks = txCompiler.marks(model, selCmpt, marks);\n }\n });\n });\n\n return marks;\n}\n\nexport function assembleLayerSelectionMarks(model: LayerModel, marks: any[]): any[] {\n for (const child of model.children) {\n if (isUnitModel(child)) {\n marks = assembleUnitSelectionMarks(child, marks);\n }\n }\n\n return marks;\n}\n\nexport function assembleSelectionScaleDomain(model: Model, extent: SelectionExtent): SignalRef {\n const name = extent.selection;\n const selCmpt = model.getSelectionComponent(name, varName(name));\n return {signal: parseSelectionBinExtent(selCmpt, extent)};\n}\n\nfunction cleanupEmptyOnArray(signals: Signal[]) {\n return signals.map(s => {\n if (s.on && !s.on.length) delete s.on;\n return s;\n });\n}\n","import {NewSignal, OnEvent, Stream} from 'vega';\nimport {array, stringValue} from 'vega-util';\nimport {SelectionCompiler, SelectionComponent, STORE, TUPLE, unitName} from '.';\nimport {ScaleChannel, X, Y} from '../../channel';\nimport {warn} from '../../log';\nimport {hasContinuousDomain} from '../../scale';\nimport {SelectionInitInterval} from '../../selection';\nimport {keys} from '../../util';\nimport {UnitModel} from '../unit';\nimport {assembleInit} from './assemble';\nimport {SelectionProjection, TUPLE_FIELDS} from './transforms/project';\nimport scales from './transforms/scales';\n\nexport const BRUSH = '_brush';\nexport const SCALE_TRIGGER = '_scale_trigger';\n\nconst interval: SelectionCompiler<'interval'> = {\n signals: (model, selCmpt) => {\n const name = selCmpt.name;\n const fieldsSg = name + TUPLE_FIELDS;\n const hasScales = scales.has(selCmpt);\n const signals: NewSignal[] = [];\n const dataSignals: string[] = [];\n const scaleTriggers: {\n scaleName: string;\n expr: string;\n }[] = [];\n\n if (selCmpt.translate && !hasScales) {\n const filterExpr = `!event.item || event.item.mark.name !== ${stringValue(name + BRUSH)}`;\n events(selCmpt, (on: OnEvent[], evt: Stream) => {\n const filters = array(evt.between[0].filter ?? (evt.between[0].filter = []));\n if (filters.indexOf(filterExpr) < 0) {\n filters.push(filterExpr);\n }\n return on;\n });\n }\n\n selCmpt.project.items.forEach((proj, i) => {\n const channel = proj.channel;\n if (channel !== X && channel !== Y) {\n warn('Interval selections only support x and y encoding channels.');\n return;\n }\n\n const init = selCmpt.init ? selCmpt.init[i] : null;\n const cs = channelSignals(model, selCmpt, proj, init);\n const dname = proj.signals.data;\n const vname = proj.signals.visual;\n const scaleName = stringValue(model.scaleName(channel));\n const scaleType = model.getScaleComponent(channel).get('type');\n const toNum = hasContinuousDomain(scaleType) ? '+' : '';\n\n signals.push(...cs);\n dataSignals.push(dname);\n\n scaleTriggers.push({\n scaleName: model.scaleName(channel),\n expr:\n `(!isArray(${dname}) || ` +\n `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` +\n `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))`\n });\n });\n\n // Proxy scale reactions to ensure that an infinite loop doesn't occur\n // when an interval selection filter touches the scale.\n if (!hasScales) {\n signals.push({\n name: name + SCALE_TRIGGER,\n value: {},\n on: [\n {\n events: scaleTriggers.map(t => ({scale: t.scaleName})),\n update: scaleTriggers.map(t => t.expr).join(' && ') + ` ? ${name + SCALE_TRIGGER} : {}`\n }\n ]\n });\n }\n\n // Only add an interval to the store if it has valid data extents. Data extents\n // are set to null if pixel extents are equal to account for intervals over\n // ordinal/nominal domains which, when inverted, will still produce a valid datum.\n const init = selCmpt.init;\n const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`;\n return signals.concat({\n name: name + TUPLE,\n ...(init ? {init: `{${update}: ${assembleInit(init)}}`} : {}),\n on: [\n {\n events: [{signal: dataSignals.join(' || ')}], // Prevents double invocation, see https://github.com/vega/vega#1672.\n update: dataSignals.join(' && ') + ` ? {${update}: [${dataSignals}]} : null`\n }\n ]\n });\n },\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`);\n },\n\n marks: (model, selCmpt, marks) => {\n const name = selCmpt.name;\n const {x, y} = selCmpt.project.hasChannel;\n const xvname = x && x.signals.visual;\n const yvname = y && y.signals.visual;\n const store = `data(${stringValue(selCmpt.name + STORE)})`;\n\n // Do not add a brush if we're binding to scales.\n if (scales.has(selCmpt)) {\n return marks;\n }\n\n const update: any = {\n x: x !== undefined ? {signal: `${xvname}[0]`} : {value: 0},\n y: y !== undefined ? {signal: `${yvname}[0]`} : {value: 0},\n x2: x !== undefined ? {signal: `${xvname}[1]`} : {field: {group: 'width'}},\n y2: y !== undefined ? {signal: `${yvname}[1]`} : {field: {group: 'height'}}\n };\n\n // If the selection is resolved to global, only a single interval is in\n // the store. Wrap brush mark's encodings with a production rule to test\n // this based on the `unit` property. Hide the brush mark if it corresponds\n // to a unit different from the one in the store.\n if (selCmpt.resolve === 'global') {\n for (const key of keys(update)) {\n update[key] = [\n {\n test: `${store}.length && ${store}[0].unit === ${unitName(model)}`,\n ...update[key]\n },\n {value: 0}\n ];\n }\n }\n\n // Two brush marks ensure that fill colors and other aesthetic choices do\n // not interefere with the core marks, but that the brushed region can still\n // be interacted with (e.g., dragging it around).\n const {fill, fillOpacity, cursor, ...stroke} = selCmpt.mark;\n const vgStroke = keys(stroke).reduce((def, k) => {\n def[k] = [\n {\n test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`]\n .filter(t => t)\n .join(' && '),\n value: stroke[k]\n },\n {value: null}\n ];\n return def;\n }, {});\n\n return [\n {\n name: name + BRUSH + '_bg',\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n fill: {value: fill},\n fillOpacity: {value: fillOpacity}\n },\n update: update\n }\n },\n ...marks,\n {\n name: name + BRUSH,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n ...(cursor ? {cursor: {value: cursor}} : {}),\n fill: {value: 'transparent'}\n },\n update: {...update, ...vgStroke}\n }\n }\n ];\n }\n};\nexport default interval;\n\n/**\n * Returns the visual and data signals for an interval selection.\n */\nfunction channelSignals(\n model: UnitModel,\n selCmpt: SelectionComponent<'interval'>,\n proj: SelectionProjection,\n init?: SelectionInitInterval\n): NewSignal[] {\n const channel = proj.channel;\n const vname = proj.signals.visual;\n const dname = proj.signals.data;\n const hasScales = scales.has(selCmpt);\n const scaleName = stringValue(model.scaleName(channel));\n const scale = model.getScaleComponent(channel as ScaleChannel);\n const scaleType = scale ? scale.get('type') : undefined;\n const scaled = (str: string) => `scale(${scaleName}, ${str})`;\n const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal;\n const coord = `${channel}(unit)`;\n\n const on = events(selCmpt, (def: OnEvent[], evt: Stream) => {\n return [\n ...def,\n {events: evt.between[0], update: `[${coord}, ${coord}]`}, // Brush Start\n {events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]`} // Brush End\n ];\n });\n\n // React to pan/zooms of continuous scales. Non-continuous scales\n // (band, point) cannot be pan/zoomed and any other changes\n // to their domains (e.g., filtering) should clear the brushes.\n on.push({\n events: {signal: selCmpt.name + SCALE_TRIGGER},\n update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]`\n });\n\n return hasScales\n ? [{name: dname, on: []}]\n : [\n {\n name: vname,\n ...(init ? {init: assembleInit(init, true, scaled)} : {value: []}),\n on: on\n },\n {\n name: dname,\n ...(init ? {init: assembleInit(init)} : {}), // Cannot be `value` as `init` may require datetime exprs.\n on: [\n {\n events: {signal: vname},\n update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})`\n }\n ]\n }\n ];\n}\n\nfunction events(selCmpt: SelectionComponent<'interval'>, cb: (def: OnEvent[], evt: Stream) => OnEvent[]): OnEvent[] {\n return selCmpt.events.reduce((on, evt) => {\n if (!evt.between) {\n warn(`${evt} is not an ordered event stream for interval selections.`);\n return on;\n }\n return cb(on, evt);\n }, [] as OnEvent[]);\n}\n","import {Stream} from 'vega';\nimport {stringValue} from 'vega-util';\nimport {SelectionCompiler, SelectionComponent, TUPLE, unitName} from '.';\nimport {UnitModel} from '../unit';\nimport {TUPLE_FIELDS} from './transforms/project';\n\nexport function singleOrMultiSignals(model: UnitModel, selCmpt: SelectionComponent<'single' | 'multi'>) {\n const name = selCmpt.name;\n const fieldsSg = name + TUPLE_FIELDS;\n const project = selCmpt.project;\n const datum = '(item().isVoronoi ? datum.datum : datum)';\n const values = project.items\n .map(p => {\n const fieldDef = model.fieldDef(p.channel);\n // Binned fields should capture extents, for a range test against the raw field.\n return fieldDef && fieldDef.bin\n ? `[${datum}[${stringValue(model.vgField(p.channel, {}))}], ` +\n `${datum}[${stringValue(model.vgField(p.channel, {binSuffix: 'end'}))}]]`\n : `${datum}[${stringValue(p.field)}]`;\n })\n .join(', ');\n\n // Only add a discrete selection to the store if a datum is present _and_\n // the interaction isn't occurring on a group mark. This guards against\n // polluting interactive state with invalid values in faceted displays\n // as the group marks are also data-driven. We force the update to account\n // for constant null states but varying toggles (e.g., shift-click in\n // whitespace followed by a click in whitespace; the store should only\n // be cleared on the second click).\n const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`;\n\n const events: Stream[] = selCmpt.events;\n\n return [\n {\n name: name + TUPLE,\n on: events\n ? [\n {\n events,\n update: `datum && item().mark.marktype !== 'group' ? {${update}: [${values}]} : null`,\n force: true\n }\n ]\n : []\n }\n ];\n}\n\nconst multi: SelectionCompiler<'multi'> = {\n signals: singleOrMultiSignals,\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n return tpl + ', ' + (selCmpt.resolve === 'global' ? 'null' : `{unit: ${unitName(model)}}`);\n }\n};\n\nexport default multi;\n","import {SelectionCompiler, TUPLE, unitName} from '.';\nimport {singleOrMultiSignals} from './multi';\n\nconst single: SelectionCompiler<'single'> = {\n signals: singleOrMultiSignals,\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`);\n }\n};\n\nexport default single;\n","import {Binding, NewSignal, Stream} from 'vega';\nimport {stringValue} from 'vega-util';\nimport {FACET_CHANNELS} from '../../channel';\nimport {\n BrushConfig,\n LegendBinding,\n SelectionInit,\n SelectionInitInterval,\n SelectionResolution,\n SelectionType,\n SELECTION_ID\n} from '../../selection';\nimport {Dict, vals} from '../../util';\nimport {OutputNode} from '../data/dataflow';\nimport {FacetModel} from '../facet';\nimport {isFacetModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport interval from './interval';\nimport multi from './multi';\nimport single from './single';\nimport {SelectionProjection, SelectionProjectionComponent} from './transforms/project';\n\nexport const STORE = '_store';\nexport const TUPLE = '_tuple';\nexport const MODIFY = '_modify';\nexport const SELECTION_DOMAIN = '_selection_domain_';\nexport const VL_SELECTION_RESOLVE = 'vlSelectionResolve';\n\nexport interface SelectionComponent {\n name: string;\n type: T;\n // Use conditional types for stricter type of init (as the type of init depends on selection type).\n init?: (T extends 'interval'\n ? SelectionInitInterval\n : T extends 'single'\n ? SelectionInit\n : T extends 'multi'\n ? SelectionInit | SelectionInit[]\n : never)[];\n events: Stream[];\n materialized: OutputNode;\n bind?: 'scales' | Binding | Dict | LegendBinding;\n resolve: SelectionResolution;\n empty: 'all' | 'none';\n mark?: BrushConfig;\n\n // Transforms\n project?: SelectionProjectionComponent;\n scales?: SelectionProjection[];\n toggle?: any;\n translate?: any;\n zoom?: any;\n nearest?: any;\n clear?: any;\n}\n\nexport interface SelectionCompiler {\n signals: (model: UnitModel, selCmpt: SelectionComponent) => NewSignal[];\n topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: NewSignal[]) => NewSignal[];\n modifyExpr: (model: UnitModel, selCmpt: SelectionComponent) => string;\n marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[];\n}\n\nconst compilers: Dict = {single, multi, interval};\n\nexport function forEachSelection(\n model: Model,\n cb: (selCmpt: SelectionComponent, selCompiler: SelectionCompiler) => void | boolean\n) {\n const selections = model.component.selection;\n if (selections) {\n for (const sel of vals(selections)) {\n const success = cb(sel, compilers[sel.type]);\n if (success === true) break;\n }\n }\n}\n\nfunction getFacetModel(model: Model): FacetModel {\n let parent = model.parent;\n while (parent) {\n if (isFacetModel(parent)) {\n break;\n }\n parent = parent.parent;\n }\n\n return parent as FacetModel;\n}\n\nexport function unitName(model: Model, {escape} = {escape: true}) {\n let name = escape ? stringValue(model.name) : model.name;\n const facetModel = getFacetModel(model);\n if (facetModel) {\n const {facet} = facetModel;\n for (const channel of FACET_CHANNELS) {\n if (facet[channel]) {\n name += ` + '__facet_${channel}_' + (facet[${stringValue(facetModel.vgField(channel))}])`;\n }\n }\n }\n return name;\n}\n\nexport function requiresSelectionId(model: Model) {\n let identifier = false;\n forEachSelection(model, selCmpt => {\n identifier = identifier || selCmpt.project.items.some(proj => proj.field === SELECTION_ID);\n });\n return identifier;\n}\n","export var RawCode = 'RawCode';\nexport var Literal = 'Literal';\nexport var Property = 'Property';\nexport var Identifier = 'Identifier';\n\nexport var ArrayExpression = 'ArrayExpression';\nexport var BinaryExpression = 'BinaryExpression';\nexport var CallExpression = 'CallExpression';\nexport var ConditionalExpression = 'ConditionalExpression';\nexport var LogicalExpression = 'LogicalExpression';\nexport var MemberExpression = 'MemberExpression';\nexport var ObjectExpression = 'ObjectExpression';\nexport var UnaryExpression = 'UnaryExpression';\n\nexport default function ASTNode(type) {\n this.type = type;\n}\n\nASTNode.prototype.visit = function(visitor) {\n var node = this, c, i, n;\n\n if (visitor(node)) return 1;\n\n for (c=children(node), i=0, n=c.length; i\n Copyright (C) 2013 Thaddee Tyl \n Copyright (C) 2013 Mathias Bynens \n Copyright (C) 2012 Ariya Hidayat \n Copyright (C) 2012 Mathias Bynens \n Copyright (C) 2012 Joost-Wim Boekesteijn \n Copyright (C) 2012 Kris Kowal \n Copyright (C) 2012 Yusuke Suzuki \n Copyright (C) 2012 Arpad Borsos \n Copyright (C) 2011 Ariya Hidayat \n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\nimport ASTNode from './ast';\n\nvar TokenName,\n source,\n index,\n length,\n lookahead;\n\nvar TokenBooleanLiteral = 1,\n TokenEOF = 2,\n TokenIdentifier = 3,\n TokenKeyword = 4,\n TokenNullLiteral = 5,\n TokenNumericLiteral = 6,\n TokenPunctuator = 7,\n TokenStringLiteral = 8,\n TokenRegularExpression = 9;\n\nTokenName = {};\nTokenName[TokenBooleanLiteral] = 'Boolean';\nTokenName[TokenEOF] = '';\nTokenName[TokenIdentifier] = 'Identifier';\nTokenName[TokenKeyword] = 'Keyword';\nTokenName[TokenNullLiteral] = 'Null';\nTokenName[TokenNumericLiteral] = 'Numeric';\nTokenName[TokenPunctuator] = 'Punctuator';\nTokenName[TokenStringLiteral] = 'String';\nTokenName[TokenRegularExpression] = 'RegularExpression';\n\nvar SyntaxArrayExpression = 'ArrayExpression',\n SyntaxBinaryExpression = 'BinaryExpression',\n SyntaxCallExpression = 'CallExpression',\n SyntaxConditionalExpression = 'ConditionalExpression',\n SyntaxIdentifier = 'Identifier',\n SyntaxLiteral = 'Literal',\n SyntaxLogicalExpression = 'LogicalExpression',\n SyntaxMemberExpression = 'MemberExpression',\n SyntaxObjectExpression = 'ObjectExpression',\n SyntaxProperty = 'Property',\n SyntaxUnaryExpression = 'UnaryExpression';\n\n// Error messages should be identical to V8.\nvar MessageUnexpectedToken = 'Unexpected token %0',\n MessageUnexpectedNumber = 'Unexpected number',\n MessageUnexpectedString = 'Unexpected string',\n MessageUnexpectedIdentifier = 'Unexpected identifier',\n MessageUnexpectedReserved = 'Unexpected reserved word',\n MessageUnexpectedEOS = 'Unexpected end of input',\n MessageInvalidRegExp = 'Invalid regular expression',\n MessageUnterminatedRegExp = 'Invalid regular expression: missing /',\n MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.',\n MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';\n\nvar ILLEGAL = 'ILLEGAL',\n DISABLED = 'Disabled.';\n\n// See also tools/generate-unicode-regex.py.\nvar RegexNonAsciiIdentifierStart = new RegExp('[\\\\xAA\\\\xB5\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0370-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0620-\\\\u064A\\\\u066E\\\\u066F\\\\u0671-\\\\u06D3\\\\u06D5\\\\u06E5\\\\u06E6\\\\u06EE\\\\u06EF\\\\u06FA-\\\\u06FC\\\\u06FF\\\\u0710\\\\u0712-\\\\u072F\\\\u074D-\\\\u07A5\\\\u07B1\\\\u07CA-\\\\u07EA\\\\u07F4\\\\u07F5\\\\u07FA\\\\u0800-\\\\u0815\\\\u081A\\\\u0824\\\\u0828\\\\u0840-\\\\u0858\\\\u08A0-\\\\u08B2\\\\u0904-\\\\u0939\\\\u093D\\\\u0950\\\\u0958-\\\\u0961\\\\u0971-\\\\u0980\\\\u0985-\\\\u098C\\\\u098F\\\\u0990\\\\u0993-\\\\u09A8\\\\u09AA-\\\\u09B0\\\\u09B2\\\\u09B6-\\\\u09B9\\\\u09BD\\\\u09CE\\\\u09DC\\\\u09DD\\\\u09DF-\\\\u09E1\\\\u09F0\\\\u09F1\\\\u0A05-\\\\u0A0A\\\\u0A0F\\\\u0A10\\\\u0A13-\\\\u0A28\\\\u0A2A-\\\\u0A30\\\\u0A32\\\\u0A33\\\\u0A35\\\\u0A36\\\\u0A38\\\\u0A39\\\\u0A59-\\\\u0A5C\\\\u0A5E\\\\u0A72-\\\\u0A74\\\\u0A85-\\\\u0A8D\\\\u0A8F-\\\\u0A91\\\\u0A93-\\\\u0AA8\\\\u0AAA-\\\\u0AB0\\\\u0AB2\\\\u0AB3\\\\u0AB5-\\\\u0AB9\\\\u0ABD\\\\u0AD0\\\\u0AE0\\\\u0AE1\\\\u0B05-\\\\u0B0C\\\\u0B0F\\\\u0B10\\\\u0B13-\\\\u0B28\\\\u0B2A-\\\\u0B30\\\\u0B32\\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0F6C\\\\u0F88-\\\\u0F8C\\\\u1000-\\\\u102A\\\\u103F\\\\u1050-\\\\u1055\\\\u105A-\\\\u105D\\\\u1061\\\\u1065\\\\u1066\\\\u106E-\\\\u1070\\\\u1075-\\\\u1081\\\\u108E\\\\u10A0-\\\\u10C5\\\\u10C7\\\\u10CD\\\\u10D0-\\\\u10FA\\\\u10FC-\\\\u1248\\\\u124A-\\\\u124D\\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F4\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1711\\\\u1720-\\\\u1731\\\\u1740-\\\\u1751\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1780-\\\\u17B3\\\\u17D7\\\\u17DC\\\\u1820-\\\\u1877\\\\u1880-\\\\u18A8\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1950-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19C1-\\\\u19C7\\\\u1A00-\\\\u1A16\\\\u1A20-\\\\u1A54\\\\u1AA7\\\\u1B05-\\\\u1B33\\\\u1B45-\\\\u1B4B\\\\u1B83-\\\\u1BA0\\\\u1BAE\\\\u1BAF\\\\u1BBA-\\\\u1BE5\\\\u1C00-\\\\u1C23\\\\u1C4D-\\\\u1C4F\\\\u1C5A-\\\\u1C7D\\\\u1CE9-\\\\u1CEC\\\\u1CEE-\\\\u1CF1\\\\u1CF5\\\\u1CF6\\\\u1D00-\\\\u1DBF\\\\u1E00-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u2071\\\\u207F\\\\u2090-\\\\u209C\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2119-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u212D\\\\u212F-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2160-\\\\u2188\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2CE4\\\\u2CEB-\\\\u2CEE\\\\u2CF2\\\\u2CF3\\\\u2D00-\\\\u2D25\\\\u2D27\\\\u2D2D\\\\u2D30-\\\\u2D67\\\\u2D6F\\\\u2D80-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u2E2F\\\\u3005-\\\\u3007\\\\u3021-\\\\u3029\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u31F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\\\uFB1F-\\\\uFB28\\\\uFB2A-\\\\uFB36\\\\uFB38-\\\\uFB3C\\\\uFB3E\\\\uFB40\\\\uFB41\\\\uFB43\\\\uFB44\\\\uFB46-\\\\uFBB1\\\\uFBD3-\\\\uFD3D\\\\uFD50-\\\\uFD8F\\\\uFD92-\\\\uFDC7\\\\uFDF0-\\\\uFDFB\\\\uFE70-\\\\uFE74\\\\uFE76-\\\\uFEFC\\\\uFF21-\\\\uFF3A\\\\uFF41-\\\\uFF5A\\\\uFF66-\\\\uFFBE\\\\uFFC2-\\\\uFFC7\\\\uFFCA-\\\\uFFCF\\\\uFFD2-\\\\uFFD7\\\\uFFDA-\\\\uFFDC]'),\n // eslint-disable-next-line no-misleading-character-class\n RegexNonAsciiIdentifierPart = new RegExp('[\\\\xAA\\\\xB5\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0300-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u0483-\\\\u0487\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u0591-\\\\u05BD\\\\u05BF\\\\u05C1\\\\u05C2\\\\u05C4\\\\u05C5\\\\u05C7\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0610-\\\\u061A\\\\u0620-\\\\u0669\\\\u066E-\\\\u06D3\\\\u06D5-\\\\u06DC\\\\u06DF-\\\\u06E8\\\\u06EA-\\\\u06FC\\\\u06FF\\\\u0710-\\\\u074A\\\\u074D-\\\\u07B1\\\\u07C0-\\\\u07F5\\\\u07FA\\\\u0800-\\\\u082D\\\\u0840-\\\\u085B\\\\u08A0-\\\\u08B2\\\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DEF\\\\u0DF2\\\\u0DF3\\\\u0E01-\\\\u0E3A\\\\u0E40-\\\\u0E4E\\\\u0E50-\\\\u0E59\\\\u0E81\\\\u0E82\\\\u0E84\\\\u0E87\\\\u0E88\\\\u0E8A\\\\u0E8D\\\\u0E94-\\\\u0E97\\\\u0E99-\\\\u0E9F\\\\u0EA1-\\\\u0EA3\\\\u0EA5\\\\u0EA7\\\\u0EAA\\\\u0EAB\\\\u0EAD-\\\\u0EB9\\\\u0EBB-\\\\u0EBD\\\\u0EC0-\\\\u0EC4\\\\u0EC6\\\\u0EC8-\\\\u0ECD\\\\u0ED0-\\\\u0ED9\\\\u0EDC-\\\\u0EDF\\\\u0F00\\\\u0F18\\\\u0F19\\\\u0F20-\\\\u0F29\\\\u0F35\\\\u0F37\\\\u0F39\\\\u0F3E-\\\\u0F47\\\\u0F49-\\\\u0F6C\\\\u0F71-\\\\u0F84\\\\u0F86-\\\\u0F97\\\\u0F99-\\\\u0FBC\\\\u0FC6\\\\u1000-\\\\u1049\\\\u1050-\\\\u109D\\\\u10A0-\\\\u10C5\\\\u10C7\\\\u10CD\\\\u10D0-\\\\u10FA\\\\u10FC-\\\\u1248\\\\u124A-\\\\u124D\\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u135D-\\\\u135F\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F4\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1714\\\\u1720-\\\\u1734\\\\u1740-\\\\u1753\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1772\\\\u1773\\\\u1780-\\\\u17D3\\\\u17D7\\\\u17DC\\\\u17DD\\\\u17E0-\\\\u17E9\\\\u180B-\\\\u180D\\\\u1810-\\\\u1819\\\\u1820-\\\\u1877\\\\u1880-\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1920-\\\\u192B\\\\u1930-\\\\u193B\\\\u1946-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19B0-\\\\u19C9\\\\u19D0-\\\\u19D9\\\\u1A00-\\\\u1A1B\\\\u1A20-\\\\u1A5E\\\\u1A60-\\\\u1A7C\\\\u1A7F-\\\\u1A89\\\\u1A90-\\\\u1A99\\\\u1AA7\\\\u1AB0-\\\\u1ABD\\\\u1B00-\\\\u1B4B\\\\u1B50-\\\\u1B59\\\\u1B6B-\\\\u1B73\\\\u1B80-\\\\u1BF3\\\\u1C00-\\\\u1C37\\\\u1C40-\\\\u1C49\\\\u1C4D-\\\\u1C7D\\\\u1CD0-\\\\u1CD2\\\\u1CD4-\\\\u1CF6\\\\u1CF8\\\\u1CF9\\\\u1D00-\\\\u1DF5\\\\u1DFC-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u200C\\\\u200D\\\\u203F\\\\u2040\\\\u2054\\\\u2071\\\\u207F\\\\u2090-\\\\u209C\\\\u20D0-\\\\u20DC\\\\u20E1\\\\u20E5-\\\\u20F0\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2119-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u212D\\\\u212F-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2160-\\\\u2188\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2CE4\\\\u2CEB-\\\\u2CF3\\\\u2D00-\\\\u2D25\\\\u2D27\\\\u2D2D\\\\u2D30-\\\\u2D67\\\\u2D6F\\\\u2D7F-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u2DE0-\\\\u2DFF\\\\u2E2F\\\\u3005-\\\\u3007\\\\u3021-\\\\u302F\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u3099\\\\u309A\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u31F0-\\\\u31FF\\\\u3400-\\\\u4DB5\\\\u4E00-\\\\u9FCC\\\\uA000-\\\\uA48C\\\\uA4D0-\\\\uA4FD\\\\uA500-\\\\uA60C\\\\uA610-\\\\uA62B\\\\uA640-\\\\uA66F\\\\uA674-\\\\uA67D\\\\uA67F-\\\\uA69D\\\\uA69F-\\\\uA6F1\\\\uA717-\\\\uA71F\\\\uA722-\\\\uA788\\\\uA78B-\\\\uA78E\\\\uA790-\\\\uA7AD\\\\uA7B0\\\\uA7B1\\\\uA7F7-\\\\uA827\\\\uA840-\\\\uA873\\\\uA880-\\\\uA8C4\\\\uA8D0-\\\\uA8D9\\\\uA8E0-\\\\uA8F7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Ensure the condition is true, otherwise throw an error.\n// This is only to have a better contract semantic, i.e. another safety net\n// to catch a logic error. The condition shall be fulfilled in normal case.\n// Do NOT use this to enforce a certain condition on any user input.\n\nfunction assert(condition, message) {\n /* istanbul ignore next */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n}\n\nfunction isDecimalDigit(ch) {\n return (ch >= 0x30 && ch <= 0x39); // 0..9\n}\n\nfunction isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n}\n\nfunction isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n}\n\n// 7.2 White Space\n\nfunction isWhiteSpace(ch) {\n return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) ||\n (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0);\n}\n\n// 7.3 Line Terminators\n\nfunction isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n}\n\n// 7.6 Identifier Names and Identifiers\n\nfunction isIdentifierStart(ch) {\n return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)\n (ch >= 0x41 && ch <= 0x5A) || // A..Z\n (ch >= 0x61 && ch <= 0x7A) || // a..z\n (ch === 0x5C) || // \\ (backslash)\n ((ch >= 0x80) && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)));\n}\n\nfunction isIdentifierPart(ch) {\n return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)\n (ch >= 0x41 && ch <= 0x5A) || // A..Z\n (ch >= 0x61 && ch <= 0x7A) || // a..z\n (ch >= 0x30 && ch <= 0x39) || // 0..9\n (ch === 0x5C) || // \\ (backslash)\n ((ch >= 0x80) && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n}\n\n// 7.6.1.1 Keywords\n\nvar keywords = {\n 'if':1, 'in':1, 'do':1,\n 'var':1, 'for':1, 'new':1, 'try':1, 'let':1,\n 'this':1, 'else':1, 'case':1, 'void':1, 'with':1, 'enum':1,\n 'while':1, 'break':1, 'catch':1, 'throw':1, 'const':1, 'yield':1, 'class':1, 'super':1,\n 'return':1, 'typeof':1, 'delete':1, 'switch':1, 'export':1, 'import':1, 'public':1, 'static':1,\n 'default':1, 'finally':1, 'extends':1, 'package':1, 'private':1,\n 'function':1, 'continue':1, 'debugger':1,\n 'interface':1, 'protected':1,\n 'instanceof':1, 'implements':1\n};\n\nfunction skipComment() {\n var ch;\n\n while (index < length) {\n ch = source.charCodeAt(index);\n\n if (isWhiteSpace(ch) || isLineTerminator(ch)) {\n ++index;\n } else {\n break;\n }\n }\n}\n\nfunction scanHexEscape(prefix) {\n var i, len, ch, code = 0;\n\n len = (prefix === 'u') ? 4 : 2;\n for (i = 0; i < len; ++i) {\n if (index < length && isHexDigit(source[index])) {\n ch = source[index++];\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n } else {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n return String.fromCharCode(code);\n}\n\nfunction scanUnicodeCodePointEscape() {\n var ch, code, cu1, cu2;\n\n ch = source[index];\n code = 0;\n\n // At least, one hex digit is required.\n if (ch === '}') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n while (index < length) {\n ch = source[index++];\n if (!isHexDigit(ch)) {\n break;\n }\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n }\n\n if (code > 0x10FFFF || ch !== '}') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n // UTF-16 Encoding\n if (code <= 0xFFFF) {\n return String.fromCharCode(code);\n }\n cu1 = ((code - 0x10000) >> 10) + 0xD800;\n cu2 = ((code - 0x10000) & 1023) + 0xDC00;\n return String.fromCharCode(cu1, cu2);\n}\n\nfunction getEscapedIdentifier() {\n var ch, id;\n\n ch = source.charCodeAt(index++);\n id = String.fromCharCode(ch);\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (ch === 0x5C) {\n if (source.charCodeAt(index) !== 0x75) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n id = ch;\n }\n\n while (index < length) {\n ch = source.charCodeAt(index);\n if (!isIdentifierPart(ch)) {\n break;\n }\n ++index;\n id += String.fromCharCode(ch);\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (ch === 0x5C) {\n id = id.substr(0, id.length - 1);\n if (source.charCodeAt(index) !== 0x75) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n id += ch;\n }\n }\n\n return id;\n}\n\nfunction getIdentifier() {\n var start, ch;\n\n start = index++;\n while (index < length) {\n ch = source.charCodeAt(index);\n if (ch === 0x5C) {\n // Blackslash (U+005C) marks Unicode escape sequence.\n index = start;\n return getEscapedIdentifier();\n }\n if (isIdentifierPart(ch)) {\n ++index;\n } else {\n break;\n }\n }\n\n return source.slice(start, index);\n}\n\nfunction scanIdentifier() {\n var start, id, type;\n\n start = index;\n\n // Backslash (U+005C) starts an escaped character.\n id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier();\n\n // There is no keyword or literal with only one character.\n // Thus, it must be an identifier.\n if (id.length === 1) {\n type = TokenIdentifier;\n } else if (keywords.hasOwnProperty(id)) { // eslint-disable-line no-prototype-builtins\n type = TokenKeyword;\n } else if (id === 'null') {\n type = TokenNullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = TokenBooleanLiteral;\n } else {\n type = TokenIdentifier;\n }\n\n return {\n type: type,\n value: id,\n start: start,\n end: index\n };\n}\n\n// 7.7 Punctuators\n\nfunction scanPunctuator() {\n var start = index,\n code = source.charCodeAt(index),\n code2,\n ch1 = source[index],\n ch2,\n ch3,\n ch4;\n\n switch (code) {\n\n // Check for most common single-character punctuators.\n case 0x2E: // . dot\n case 0x28: // ( open bracket\n case 0x29: // ) close bracket\n case 0x3B: // ; semicolon\n case 0x2C: // , comma\n case 0x7B: // { open curly brace\n case 0x7D: // } close curly brace\n case 0x5B: // [\n case 0x5D: // ]\n case 0x3A: // :\n case 0x3F: // ?\n case 0x7E: // ~\n ++index;\n return {\n type: TokenPunctuator,\n value: String.fromCharCode(code),\n start: start,\n end: index\n };\n\n default:\n code2 = source.charCodeAt(index + 1);\n\n // '=' (U+003D) marks an assignment or comparison operator.\n if (code2 === 0x3D) {\n switch (code) {\n case 0x2B: // +\n case 0x2D: // -\n case 0x2F: // /\n case 0x3C: // <\n case 0x3E: // >\n case 0x5E: // ^\n case 0x7C: // |\n case 0x25: // %\n case 0x26: // &\n case 0x2A: // *\n index += 2;\n return {\n type: TokenPunctuator,\n value: String.fromCharCode(code) + String.fromCharCode(code2),\n start: start,\n end: index\n };\n\n case 0x21: // !\n case 0x3D: // =\n index += 2;\n\n // !== and ===\n if (source.charCodeAt(index) === 0x3D) {\n ++index;\n }\n return {\n type: TokenPunctuator,\n value: source.slice(start, index),\n start: start,\n end: index\n };\n }\n }\n }\n\n // 4-character punctuator: >>>=\n\n ch4 = source.substr(index, 4);\n\n if (ch4 === '>>>=') {\n index += 4;\n return {\n type: TokenPunctuator,\n value: ch4,\n start: start,\n end: index\n };\n }\n\n // 3-character punctuators: === !== >>> <<= >>=\n\n ch3 = ch4.substr(0, 3);\n\n if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {\n index += 3;\n return {\n type: TokenPunctuator,\n value: ch3,\n start: start,\n end: index\n };\n }\n\n // Other 2-character punctuators: ++ -- << >> && ||\n ch2 = ch3.substr(0, 2);\n\n if ((ch1 === ch2[1] && ('+-<>&|'.indexOf(ch1) >= 0)) || ch2 === '=>') {\n index += 2;\n return {\n type: TokenPunctuator,\n value: ch2,\n start: start,\n end: index\n };\n }\n\n // 1-character punctuators: < > = ! + - * % & | ^ /\n\n if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {\n ++index;\n return {\n type: TokenPunctuator,\n value: ch1,\n start: start,\n end: index\n };\n }\n\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n}\n\n// 7.8.3 Numeric Literals\n\nfunction scanHexLiteral(start) {\n var number = '';\n\n while (index < length) {\n if (!isHexDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n\n if (number.length === 0) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n return {\n type: TokenNumericLiteral,\n value: parseInt('0x' + number, 16),\n start: start,\n end: index\n };\n}\n\nfunction scanOctalLiteral(start) {\n var number = '0' + source[index++];\n while (index < length) {\n if (!isOctalDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n\n if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n return {\n type: TokenNumericLiteral,\n value: parseInt(number, 8),\n octal: true,\n start: start,\n end: index\n };\n}\n\nfunction scanNumericLiteral() {\n var number, start, ch;\n\n ch = source[index];\n assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),\n 'Numeric literal must start with a decimal digit or a decimal point');\n\n start = index;\n number = '';\n if (ch !== '.') {\n number = source[index++];\n ch = source[index];\n\n // Hex number starts with '0x'.\n // Octal number starts with '0'.\n if (number === '0') {\n if (ch === 'x' || ch === 'X') {\n ++index;\n return scanHexLiteral(start);\n }\n if (isOctalDigit(ch)) {\n return scanOctalLiteral(start);\n }\n\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDecimalDigit(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n\n if (ch === '.') {\n number += source[index++];\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n\n if (ch === 'e' || ch === 'E') {\n number += source[index++];\n\n ch = source[index];\n if (ch === '+' || ch === '-') {\n number += source[index++];\n }\n if (isDecimalDigit(source.charCodeAt(index))) {\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n } else {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n return {\n type: TokenNumericLiteral,\n value: parseFloat(number),\n start: start,\n end: index\n };\n}\n\n// 7.8.4 String Literals\n\nfunction scanStringLiteral() {\n var str = '',\n quote, start, ch, code, octal = false;\n\n quote = source[index];\n assert((quote === '\\'' || quote === '\"'),\n 'String literal must starts with a quote');\n\n start = index;\n ++index;\n\n while (index < length) {\n ch = source[index++];\n\n if (ch === quote) {\n quote = '';\n break;\n } else if (ch === '\\\\') {\n ch = source[index++];\n if (!ch || !isLineTerminator(ch.charCodeAt(0))) {\n switch (ch) {\n case 'u':\n case 'x':\n if (source[index] === '{') {\n ++index;\n str += scanUnicodeCodePointEscape();\n } else {\n str += scanHexEscape(ch);\n }\n break;\n case 'n':\n str += '\\n';\n break;\n case 'r':\n str += '\\r';\n break;\n case 't':\n str += '\\t';\n break;\n case 'b':\n str += '\\b';\n break;\n case 'f':\n str += '\\f';\n break;\n case 'v':\n str += '\\x0B';\n break;\n\n default:\n if (isOctalDigit(ch)) {\n code = '01234567'.indexOf(ch);\n\n // \\0 is not octal escape sequence\n if (code !== 0) {\n octal = true;\n }\n\n if (index < length && isOctalDigit(source[index])) {\n octal = true;\n code = code * 8 + '01234567'.indexOf(source[index++]);\n\n // 3 digits are only allowed when string starts\n // with 0, 1, 2, 3\n if ('0123'.indexOf(ch) >= 0 &&\n index < length &&\n isOctalDigit(source[index])) {\n code = code * 8 + '01234567'.indexOf(source[index++]);\n }\n }\n str += String.fromCharCode(code);\n } else {\n str += ch;\n }\n break;\n }\n } else {\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n\n if (quote !== '') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n return {\n type: TokenStringLiteral,\n value: str,\n octal: octal,\n start: start,\n end: index\n };\n}\n\nfunction testRegExp(pattern, flags) {\n var tmp = pattern;\n\n if (flags.indexOf('u') >= 0) {\n // Replace each astral symbol and every Unicode code point\n // escape sequence with a single ASCII symbol to avoid throwing on\n // regular expressions that are only valid in combination with the\n // `/u` flag.\n // Note: replacing with the ASCII symbol `x` might cause false\n // negatives in unlikely scenarios. For example, `[\\u{61}-b]` is a\n // perfectly valid pattern that is equivalent to `[a-b]`, but it\n // would be replaced by `[x-b]` which throws an error.\n tmp = tmp\n .replace(/\\\\u\\{([0-9a-fA-F]+)\\}/g, function($0, $1) {\n if (parseInt($1, 16) <= 0x10FFFF) {\n return 'x';\n }\n throwError({}, MessageInvalidRegExp);\n })\n .replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n }\n\n // First, detect invalid regular expressions.\n try {\n new RegExp(tmp);\n } catch (e) {\n throwError({}, MessageInvalidRegExp);\n }\n\n // Return a regular expression object for this pattern-flag pair, or\n // `null` in case the current environment doesn't support the flags it\n // uses.\n try {\n return new RegExp(pattern, flags);\n } catch (exception) {\n return null;\n }\n}\n\nfunction scanRegExpBody() {\n var ch, str, classMarker, terminated, body;\n\n ch = source[index];\n assert(ch === '/', 'Regular expression literal must start with a slash');\n str = source[index++];\n\n classMarker = false;\n terminated = false;\n while (index < length) {\n ch = source[index++];\n str += ch;\n if (ch === '\\\\') {\n ch = source[index++];\n // ECMA-262 7.8.5\n if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, MessageUnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, MessageUnterminatedRegExp);\n } else if (classMarker) {\n if (ch === ']') {\n classMarker = false;\n }\n } else {\n if (ch === '/') {\n terminated = true;\n break;\n } else if (ch === '[') {\n classMarker = true;\n }\n }\n }\n\n if (!terminated) {\n throwError({}, MessageUnterminatedRegExp);\n }\n\n // Exclude leading and trailing slash.\n body = str.substr(1, str.length - 2);\n return {\n value: body,\n literal: str\n };\n}\n\nfunction scanRegExpFlags() {\n var ch, str, flags;\n\n str = '';\n flags = '';\n while (index < length) {\n ch = source[index];\n if (!isIdentifierPart(ch.charCodeAt(0))) {\n break;\n }\n\n ++index;\n if (ch === '\\\\' && index < length) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n } else {\n flags += ch;\n str += ch;\n }\n }\n\n if (flags.search(/[^gimuy]/g) >= 0) {\n throwError({}, MessageInvalidRegExp, flags);\n }\n\n return {\n value: flags,\n literal: str\n };\n}\n\nfunction scanRegExp() {\n var start, body, flags, value;\n\n lookahead = null;\n skipComment();\n start = index;\n\n body = scanRegExpBody();\n flags = scanRegExpFlags();\n value = testRegExp(body.value, flags.value);\n\n return {\n literal: body.literal + flags.literal,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n start: start,\n end: index\n };\n}\n\nfunction isIdentifierName(token) {\n return token.type === TokenIdentifier ||\n token.type === TokenKeyword ||\n token.type === TokenBooleanLiteral ||\n token.type === TokenNullLiteral;\n}\n\nfunction advance() {\n var ch;\n\n skipComment();\n\n if (index >= length) {\n return {\n type: TokenEOF,\n start: index,\n end: index\n };\n }\n\n ch = source.charCodeAt(index);\n\n if (isIdentifierStart(ch)) {\n return scanIdentifier();\n }\n\n // Very common: ( and ) and ;\n if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {\n return scanPunctuator();\n }\n\n // String literal starts with single quote (U+0027) or double quote (U+0022).\n if (ch === 0x27 || ch === 0x22) {\n return scanStringLiteral();\n }\n\n\n // Dot (.) U+002E can also start a floating-point number, hence the need\n // to check the next character.\n if (ch === 0x2E) {\n if (isDecimalDigit(source.charCodeAt(index + 1))) {\n return scanNumericLiteral();\n }\n return scanPunctuator();\n }\n\n if (isDecimalDigit(ch)) {\n return scanNumericLiteral();\n }\n\n return scanPunctuator();\n}\n\nfunction lex() {\n var token;\n\n token = lookahead;\n index = token.end;\n\n lookahead = advance();\n\n index = token.end;\n\n return token;\n}\n\nfunction peek() {\n var pos;\n\n pos = index;\n\n lookahead = advance();\n index = pos;\n}\n\nfunction finishArrayExpression(elements) {\n var node = new ASTNode(SyntaxArrayExpression);\n node.elements = elements;\n return node;\n}\n\nfunction finishBinaryExpression(operator, left, right) {\n var node = new ASTNode((operator === '||' || operator === '&&') ? SyntaxLogicalExpression : SyntaxBinaryExpression);\n node.operator = operator;\n node.left = left;\n node.right = right;\n return node;\n}\n\nfunction finishCallExpression(callee, args) {\n var node = new ASTNode(SyntaxCallExpression);\n node.callee = callee;\n node.arguments = args;\n return node;\n}\n\nfunction finishConditionalExpression(test, consequent, alternate) {\n var node = new ASTNode(SyntaxConditionalExpression);\n node.test = test;\n node.consequent = consequent;\n node.alternate = alternate;\n return node;\n}\n\nfunction finishIdentifier(name) {\n var node = new ASTNode(SyntaxIdentifier);\n node.name = name;\n return node;\n}\n\nfunction finishLiteral(token) {\n var node = new ASTNode(SyntaxLiteral);\n node.value = token.value;\n node.raw = source.slice(token.start, token.end);\n if (token.regex) {\n if (node.raw === '//') {\n node.raw = '/(?:)/';\n }\n node.regex = token.regex;\n }\n return node;\n}\n\nfunction finishMemberExpression(accessor, object, property) {\n var node = new ASTNode(SyntaxMemberExpression);\n node.computed = accessor === '[';\n node.object = object;\n node.property = property;\n if (!node.computed) property.member = true;\n return node;\n}\n\nfunction finishObjectExpression(properties) {\n var node = new ASTNode(SyntaxObjectExpression);\n node.properties = properties;\n return node;\n}\n\nfunction finishProperty(kind, key, value) {\n var node = new ASTNode(SyntaxProperty);\n node.key = key;\n node.value = value;\n node.kind = kind;\n return node;\n}\n\nfunction finishUnaryExpression(operator, argument) {\n var node = new ASTNode(SyntaxUnaryExpression);\n node.operator = operator;\n node.argument = argument;\n node.prefix = true;\n return node;\n}\n\n// Throw an exception\n\nfunction throwError(token, messageFormat) {\n var error,\n args = Array.prototype.slice.call(arguments, 2),\n msg = messageFormat.replace(\n /%(\\d)/g,\n function(whole, index) {\n assert(index < args.length, 'Message reference must be in range');\n return args[index];\n }\n );\n\n\n error = new Error(msg);\n error.index = index;\n error.description = msg;\n throw error;\n}\n\n// Throw an exception because of the token.\n\nfunction throwUnexpected(token) {\n if (token.type === TokenEOF) {\n throwError(token, MessageUnexpectedEOS);\n }\n\n if (token.type === TokenNumericLiteral) {\n throwError(token, MessageUnexpectedNumber);\n }\n\n if (token.type === TokenStringLiteral) {\n throwError(token, MessageUnexpectedString);\n }\n\n if (token.type === TokenIdentifier) {\n throwError(token, MessageUnexpectedIdentifier);\n }\n\n if (token.type === TokenKeyword) {\n throwError(token, MessageUnexpectedReserved);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, MessageUnexpectedToken, token.value);\n}\n\n// Expect the next token to match the specified punctuator.\n// If not, an exception will be thrown.\n\nfunction expect(value) {\n var token = lex();\n if (token.type !== TokenPunctuator || token.value !== value) {\n throwUnexpected(token);\n }\n}\n\n// Return true if the next token matches the specified punctuator.\n\nfunction match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n}\n\n// Return true if the next token matches the specified keyword\n\nfunction matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n}\n\n// 11.1.4 Array Initialiser\n\nfunction parseArrayInitialiser() {\n var elements = [];\n\n index = lookahead.start;\n expect('[');\n\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n elements.push(parseConditionalExpression());\n\n if (!match(']')) {\n expect(',');\n }\n }\n }\n\n lex();\n\n return finishArrayExpression(elements);\n}\n\n// 11.1.5 Object Initialiser\n\nfunction parseObjectPropertyKey() {\n var token;\n\n index = lookahead.start;\n token = lex();\n\n // Note: This function is called only from parseObjectProperty(), where\n // EOF and Punctuator tokens are already filtered out.\n\n if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) {\n if (token.octal) {\n throwError(token, MessageStrictOctalLiteral);\n }\n return finishLiteral(token);\n }\n\n return finishIdentifier(token.value);\n}\n\nfunction parseObjectProperty() {\n var token, key, id, value;\n\n index = lookahead.start;\n token = lookahead;\n\n if (token.type === TokenIdentifier) {\n id = parseObjectPropertyKey();\n expect(':');\n value = parseConditionalExpression();\n return finishProperty('init', id, value);\n }\n if (token.type === TokenEOF || token.type === TokenPunctuator) {\n throwUnexpected(token);\n } else {\n key = parseObjectPropertyKey();\n expect(':');\n value = parseConditionalExpression();\n return finishProperty('init', key, value);\n }\n}\n\nfunction parseObjectInitialiser() {\n var properties = [],\n property, name, key, map = {},\n toString = String;\n\n index = lookahead.start;\n expect('{');\n\n while (!match('}')) {\n property = parseObjectProperty();\n\n if (property.key.type === SyntaxIdentifier) {\n name = property.key.name;\n } else {\n name = toString(property.key.value);\n }\n\n key = '$' + name;\n if (Object.prototype.hasOwnProperty.call(map, key)) {\n throwError({}, MessageStrictDuplicateProperty);\n } else {\n map[key] = true;\n }\n\n properties.push(property);\n\n if (!match('}')) {\n expect(',');\n }\n }\n\n expect('}');\n\n return finishObjectExpression(properties);\n}\n\n// 11.1.6 The Grouping Operator\n\nfunction parseGroupExpression() {\n var expr;\n\n expect('(');\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n}\n\n\n// 11.1 Primary Expressions\n\nvar legalKeywords = {\n 'if': 1\n};\n\nfunction parsePrimaryExpression() {\n var type, token, expr;\n\n if (match('(')) {\n return parseGroupExpression();\n }\n\n if (match('[')) {\n return parseArrayInitialiser();\n }\n\n if (match('{')) {\n return parseObjectInitialiser();\n }\n\n type = lookahead.type;\n index = lookahead.start;\n\n\n if (type === TokenIdentifier || legalKeywords[lookahead.value]) {\n expr = finishIdentifier(lex().value);\n } else if (type === TokenStringLiteral || type === TokenNumericLiteral) {\n if (lookahead.octal) {\n throwError(lookahead, MessageStrictOctalLiteral);\n }\n expr = finishLiteral(lex());\n } else if (type === TokenKeyword) {\n throw new Error(DISABLED);\n } else if (type === TokenBooleanLiteral) {\n token = lex();\n token.value = (token.value === 'true');\n expr = finishLiteral(token);\n } else if (type === TokenNullLiteral) {\n token = lex();\n token.value = null;\n expr = finishLiteral(token);\n } else if (match('/') || match('/=')) {\n expr = finishLiteral(scanRegExp());\n peek();\n } else {\n throwUnexpected(lex());\n }\n\n return expr;\n}\n\n// 11.2 Left-Hand-Side Expressions\n\nfunction parseArguments() {\n var args = [];\n\n expect('(');\n\n if (!match(')')) {\n while (index < length) {\n args.push(parseConditionalExpression());\n if (match(')')) {\n break;\n }\n expect(',');\n }\n }\n\n expect(')');\n\n return args;\n}\n\nfunction parseNonComputedProperty() {\n var token;\n index = lookahead.start;\n token = lex();\n\n if (!isIdentifierName(token)) {\n throwUnexpected(token);\n }\n\n return finishIdentifier(token.value);\n}\n\nfunction parseNonComputedMember() {\n expect('.');\n\n return parseNonComputedProperty();\n}\n\nfunction parseComputedMember() {\n var expr;\n\n expect('[');\n\n expr = parseExpression();\n\n expect(']');\n\n return expr;\n}\n\nfunction parseLeftHandSideExpressionAllowCall() {\n var expr, args, property;\n\n expr = parsePrimaryExpression();\n\n for (;;) {\n if (match('.')) {\n property = parseNonComputedMember();\n expr = finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n args = parseArguments();\n expr = finishCallExpression(expr, args);\n } else if (match('[')) {\n property = parseComputedMember();\n expr = finishMemberExpression('[', expr, property);\n } else {\n break;\n }\n }\n\n return expr;\n}\n\n// 11.3 Postfix Expressions\n\nfunction parsePostfixExpression() {\n var expr = parseLeftHandSideExpressionAllowCall();\n\n if (lookahead.type === TokenPunctuator) {\n if ((match('++') || match('--'))) {\n throw new Error(DISABLED);\n }\n }\n\n return expr;\n}\n\n// 11.4 Unary Operators\n\nfunction parseUnaryExpression() {\n var token, expr;\n\n if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n throw new Error(DISABLED);\n } else if (match('+') || match('-') || match('~') || match('!')) {\n token = lex();\n expr = parseUnaryExpression();\n expr = finishUnaryExpression(token.value, expr);\n } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {\n throw new Error(DISABLED);\n } else {\n expr = parsePostfixExpression();\n }\n\n return expr;\n}\n\nfunction binaryPrecedence(token) {\n var prec = 0;\n\n if (token.type !== TokenPunctuator && token.type !== TokenKeyword) {\n return 0;\n }\n\n switch (token.value) {\n case '||':\n prec = 1;\n break;\n\n case '&&':\n prec = 2;\n break;\n\n case '|':\n prec = 3;\n break;\n\n case '^':\n prec = 4;\n break;\n\n case '&':\n prec = 5;\n break;\n\n case '==':\n case '!=':\n case '===':\n case '!==':\n prec = 6;\n break;\n\n case '<':\n case '>':\n case '<=':\n case '>=':\n case 'instanceof':\n case 'in':\n prec = 7;\n break;\n\n case '<<':\n case '>>':\n case '>>>':\n prec = 8;\n break;\n\n case '+':\n case '-':\n prec = 9;\n break;\n\n case '*':\n case '/':\n case '%':\n prec = 11;\n break;\n\n default:\n break;\n }\n\n return prec;\n}\n\n// 11.5 Multiplicative Operators\n// 11.6 Additive Operators\n// 11.7 Bitwise Shift Operators\n// 11.8 Relational Operators\n// 11.9 Equality Operators\n// 11.10 Binary Bitwise Operators\n// 11.11 Binary Logical Operators\n\nfunction parseBinaryExpression() {\n var marker, markers, expr, token, prec, stack, right, operator, left, i;\n\n marker = lookahead;\n left = parseUnaryExpression();\n\n token = lookahead;\n prec = binaryPrecedence(token);\n if (prec === 0) {\n return left;\n }\n token.prec = prec;\n lex();\n\n markers = [marker, lookahead];\n right = parseUnaryExpression();\n\n stack = [left, token, right];\n\n while ((prec = binaryPrecedence(lookahead)) > 0) {\n\n // Reduce: make a binary expression from the three topmost entries.\n while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {\n right = stack.pop();\n operator = stack.pop().value;\n left = stack.pop();\n markers.pop();\n expr = finishBinaryExpression(operator, left, right);\n stack.push(expr);\n }\n\n // Shift.\n token = lex();\n token.prec = prec;\n stack.push(token);\n markers.push(lookahead);\n expr = parseUnaryExpression();\n stack.push(expr);\n }\n\n // Final reduce to clean-up the stack.\n i = stack.length - 1;\n expr = stack[i];\n markers.pop();\n while (i > 1) {\n markers.pop();\n expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);\n i -= 2;\n }\n\n return expr;\n}\n\n// 11.12 Conditional Operator\n\nfunction parseConditionalExpression() {\n var expr, consequent, alternate;\n\n expr = parseBinaryExpression();\n\n if (match('?')) {\n lex();\n consequent = parseConditionalExpression();\n expect(':');\n alternate = parseConditionalExpression();\n\n expr = finishConditionalExpression(expr, consequent, alternate);\n }\n\n return expr;\n}\n\n// 11.14 Comma Operator\n\nfunction parseExpression() {\n var expr = parseConditionalExpression();\n\n if (match(',')) {\n throw new Error(DISABLED); // no sequence expressions\n }\n\n return expr;\n}\n\nexport default function(code) {\n source = code;\n index = 0;\n length = source.length;\n lookahead = null;\n\n peek();\n\n var expr = parseExpression();\n\n if (lookahead.type !== TokenEOF) {\n throw new Error('Unexpect token after expression.');\n }\n return expr;\n}\n","import {parse} from 'vega-expression';\n\nfunction getName(node: any) {\n const name: string[] = [];\n\n if (node.type === 'Identifier') {\n return [node.name];\n }\n\n if (node.type === 'Literal') {\n return [node.value];\n }\n\n if (node.type === 'MemberExpression') {\n name.push(...getName(node.object));\n name.push(...getName(node.property));\n }\n\n return name;\n}\n\nfunction startsWithDatum(node: any): boolean {\n if (node.object.type === 'MemberExpression') {\n return startsWithDatum(node.object);\n }\n return node.object.name === 'datum';\n}\n\nexport function getDependentFields(expression: string) {\n const ast = parse(expression);\n const dependents = new Set();\n ast.visit((node: any) => {\n if (node.type === 'MemberExpression' && startsWithDatum(node)) {\n dependents.add(getName(node).slice(1).join('.'));\n }\n });\n\n return dependents;\n}\n","import {FilterTransform as VgFilterTransform} from 'vega';\nimport {LogicalComposition} from '../../logical';\nimport {Predicate} from '../../predicate';\nimport {duplicate} from '../../util';\nimport {Model} from '../model';\nimport {expression} from '../predicate';\nimport {DataFlowNode} from './dataflow';\nimport {getDependentFields} from './expressions';\n\nexport class FilterNode extends DataFlowNode {\n private expr: string;\n private _dependentFields: Set;\n public clone() {\n return new FilterNode(null, this.model, duplicate(this.filter));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly model: Model,\n private readonly filter: LogicalComposition\n ) {\n super(parent);\n\n // TODO: refactor this to not take a node and\n // then add a static function makeFromOperand and make the constructor take only an expression\n this.expr = expression(this.model, this.filter, this);\n\n this._dependentFields = getDependentFields(this.expr);\n }\n\n public dependentFields() {\n return this._dependentFields;\n }\n\n public producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n\n public assemble(): VgFilterTransform {\n return {\n type: 'filter',\n expr: this.expr\n };\n }\n\n public hash() {\n return `Filter ${this.expr}`;\n }\n}\n","import {selector as parseSelector} from 'vega-event-selector';\nimport {isString, stringValue} from 'vega-util';\nimport {forEachSelection, SelectionComponent, STORE} from '.';\nimport {warn} from '../../log';\nimport {LogicalComposition} from '../../logical';\nimport {SelectionDef, SelectionExtent} from '../../selection';\nimport {Dict, duplicate, keys, logicalExpr, varName} from '../../util';\nimport {DataFlowNode, OutputNode} from '../data/dataflow';\nimport {FilterNode} from '../data/filter';\nimport {Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {forEachTransform} from './transforms/transforms';\nimport {DataSourceType} from '../../data';\n\nexport function parseUnitSelection(model: UnitModel, selDefs: Dict) {\n const selCmpts: Dict> = {};\n const selectionConfig = model.config.selection;\n\n for (const name of keys(selDefs ?? {})) {\n const selDef = duplicate(selDefs[name]);\n const {fields, encodings, ...cfg} = selectionConfig[selDef.type]; // Project transform applies its defaults.\n\n // Set default values from config if a property hasn't been specified,\n // or if it is true. E.g., \"translate\": true should use the default\n // event handlers for translate. However, true may be a valid value for\n // a property (e.g., \"nearest\": true).\n for (const key in cfg) {\n // A selection should contain either `encodings` or `fields`, only use\n // default values for these two values if neither of them is specified.\n if ((key === 'encodings' && selDef.fields) || (key === 'fields' && selDef.encodings)) {\n continue;\n }\n\n if (key === 'mark') {\n selDef[key] = {...cfg[key], ...selDef[key]};\n }\n\n if (selDef[key] === undefined || selDef[key] === true) {\n selDef[key] = cfg[key] ?? selDef[key];\n }\n }\n\n const safeName = varName(name);\n const selCmpt = (selCmpts[safeName] = {\n ...selDef,\n name: safeName,\n events: isString(selDef.on) ? parseSelector(selDef.on, 'scope') : duplicate(selDef.on)\n } as any);\n\n forEachTransform(selCmpt, txCompiler => {\n if (txCompiler.has(selCmpt) && txCompiler.parse) {\n txCompiler.parse(model, selCmpt, selDef, selDefs[name]);\n }\n });\n }\n\n return selCmpts;\n}\n\nexport function parseSelectionPredicate(\n model: Model,\n selections: LogicalComposition,\n dfnode?: DataFlowNode,\n datum = 'datum'\n): string {\n const stores: string[] = [];\n function expr(name: string): string {\n const vname = varName(name);\n const selCmpt = model.getSelectionComponent(vname, name);\n const store = stringValue(vname + STORE);\n\n if (selCmpt.project.timeUnit) {\n const child = dfnode ?? model.component.data.raw;\n const tunode = selCmpt.project.timeUnit.clone();\n if (child.parent) {\n tunode.insertAsParentOf(child);\n } else {\n child.parent = tunode;\n }\n }\n\n if (selCmpt.empty !== 'none') {\n stores.push(store);\n }\n\n return (\n `vlSelectionTest(${store}, ${datum}` + (selCmpt.resolve === 'global' ? ')' : `, ${stringValue(selCmpt.resolve)})`)\n );\n }\n\n const predicateStr = logicalExpr(selections, expr);\n return (\n (stores.length ? '!(' + stores.map(s => `length(data(${s}))`).join(' || ') + ') || ' : '') + `(${predicateStr})`\n );\n}\n\nexport function parseSelectionBinExtent(selCmpt: SelectionComponent, extent: SelectionExtent) {\n const encoding = extent['encoding'];\n let field = extent['field'];\n\n if (!encoding && !field) {\n field = selCmpt.project.items[0].field;\n if (selCmpt.project.items.length > 1) {\n warn(\n 'A \"field\" or \"encoding\" must be specified when using a selection as a scale domain. ' +\n `Using \"field\": ${stringValue(field)}.`\n );\n }\n } else if (encoding && !field) {\n const encodings = selCmpt.project.items.filter(p => p.channel === encoding);\n if (!encodings.length || encodings.length > 1) {\n field = selCmpt.project.items[0].field;\n warn(\n (!encodings.length ? 'No ' : 'Multiple ') +\n `matching ${stringValue(encoding)} encoding found for selection ${stringValue(extent.selection)}. ` +\n `Using \"field\": ${stringValue(field)}.`\n );\n } else {\n field = encodings[0].field;\n }\n }\n\n return `${selCmpt.name}[${stringValue(field)}]`;\n}\n\nexport function materializeSelections(model: UnitModel, main: OutputNode) {\n forEachSelection(model, selCmpt => {\n const selection = selCmpt.name;\n const lookupName = model.getName(`lookup_${selection}`);\n model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(\n new FilterNode(main, model, {selection}),\n lookupName,\n DataSourceType.Lookup,\n model.component.data.outputNodeRefCounts\n );\n });\n}\n","import {isString} from 'vega-util';\nimport {LogicalComposition} from '../logical';\nimport {fieldFilterExpression, isSelectionPredicate, Predicate} from '../predicate';\nimport {logicalExpr} from '../util';\nimport {DataFlowNode} from './data/dataflow';\nimport {Model} from './model';\nimport {parseSelectionPredicate} from './selection/parse';\n\n/**\n * Converts a predicate into an expression.\n */\n// model is only used for selection filters.\nexport function expression(model: Model, filterOp: LogicalComposition, node?: DataFlowNode): string {\n return logicalExpr(filterOp, (predicate: Predicate) => {\n if (isString(predicate)) {\n return predicate;\n } else if (isSelectionPredicate(predicate)) {\n return parseSelectionPredicate(model, predicate.selection, node);\n } else {\n // Filter Object\n return fieldFilterExpression(predicate);\n }\n });\n}\n","import {Axis as VgAxis, AxisEncode, NewSignal, SignalRef, Text} from 'vega';\nimport {array, isArray} from 'vega-util';\nimport {AXIS_PARTS, AXIS_PROPERTY_TYPE, CONDITIONAL_AXIS_PROP_INDEX, isConditionalAxisValue} from '../../axis';\nimport {POSITION_SCALE_CHANNELS} from '../../channel';\nimport {defaultTitle, FieldDefBase} from '../../channeldef';\nimport {Config} from '../../config';\nimport {isText} from '../../title';\nimport {getFirstDefined, isEmpty, replaceAll} from '../../util';\nimport {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema';\nimport {exprFromValueOrSignalRef} from '../common';\nimport {Model} from '../model';\nimport {expression} from '../predicate';\nimport {AxisComponent, AxisComponentIndex} from './component';\n\nfunction assembleTitle(title: Text | FieldDefBase[] | SignalRef, config: Config): Text | SignalRef {\n if (!title) {\n return undefined;\n }\n if (isArray(title) && !isText(title)) {\n return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', ');\n }\n return title;\n}\n\nfunction setAxisEncode(\n axis: Omit,\n part: keyof AxisEncode,\n vgProp: VgEncodeChannel,\n vgRef: VgValueRef | readonly VgValueRef[]\n) {\n axis.encode = axis.encode ?? {};\n axis.encode[part] = axis.encode[part] ?? {};\n axis.encode[part].update = axis.encode[part].update ?? {};\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n (axis.encode[part].update[vgProp] as any) = vgRef;\n}\n\nexport function assembleAxis(\n axisCmpt: AxisComponent,\n kind: 'main' | 'grid',\n config: Config,\n opt: {\n header: boolean; // whether this is called via a header\n } = {header: false}\n): VgAxis {\n const {disable, orient, scale, labelExpr, title, zindex, ...axis} = axisCmpt.combine();\n\n if (disable) {\n return undefined;\n }\n\n for (const prop in axis) {\n const propType = AXIS_PROPERTY_TYPE[prop];\n const propValue = axis[prop];\n\n if (propType && propType !== kind && propType !== 'both') {\n // Remove properties that are not valid for this kind of axis\n delete axis[prop];\n } else if (isConditionalAxisValue(propValue)) {\n // deal with conditional axis value\n\n const {condition, ...valueOrSignalRef} = propValue;\n const conditions = array(condition);\n\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n // If there is a corresponding Vega property for the channel,\n // use Vega's custom axis encoding and delete the original axis property to avoid conflicts\n\n const vgRef = [\n ...conditions.map(c => {\n const {test, ...valueOrSignalCRef} = c;\n return {\n test: expression(null, test),\n ...valueOrSignalCRef\n };\n }),\n valueOrSignalRef\n ];\n setAxisEncode(axis, part, vgProp, vgRef);\n delete axis[prop];\n } else if (propIndex === null) {\n // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead.\n const signalRef: SignalRef = {\n signal:\n conditions\n .map(c => {\n const {test, ...valueOrSignalCRef} = c;\n return `${expression(null, test)} ? ${exprFromValueOrSignalRef(valueOrSignalCRef)} : `;\n })\n .join('') + exprFromValueOrSignalRef(valueOrSignalRef)\n };\n axis[prop] = signalRef;\n }\n } else if (isSignalRef(propValue)) {\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n setAxisEncode(axis, part, vgProp, propValue);\n delete axis[prop];\n } // else do nothing since the property already supports signal\n }\n }\n\n if (kind === 'grid') {\n if (!axis.grid) {\n return undefined;\n }\n\n // Remove unnecessary encode block\n if (axis.encode) {\n // Only need to keep encode block for grid\n const {grid} = axis.encode;\n axis.encode = {\n ...(grid ? {grid} : {})\n };\n\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n\n return {\n scale,\n orient,\n ...axis,\n domain: false,\n labels: false,\n aria: false, // always hide grid axis\n\n // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent`\n // would not affect gridAxis\n maxExtent: 0,\n minExtent: 0,\n ticks: false,\n zindex: getFirstDefined(zindex, 0) // put grid behind marks by default\n };\n } else {\n // kind === 'main'\n\n if (!opt.header && axisCmpt.mainExtracted) {\n // if mainExtracted has been extracted to a separate facet\n return undefined;\n }\n\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (axis.encode?.labels?.update && isSignalRef(axis.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal);\n }\n setAxisEncode(axis, 'labels', 'text', {signal: expr});\n }\n\n if (axis.labelAlign === null) {\n delete axis.labelAlign;\n }\n\n // Remove unnecessary encode block\n if (axis.encode) {\n for (const part of AXIS_PARTS) {\n if (!axisCmpt.hasAxisPart(part)) {\n delete axis.encode[part];\n }\n }\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n\n const titleString = assembleTitle(title, config);\n\n return {\n scale,\n orient,\n grid: false,\n ...(titleString ? {title: titleString} : {}),\n ...axis,\n ...(config.aria === false ? {aria: false} : {}),\n zindex: getFirstDefined(zindex, 0) // put axis line above marks by default\n };\n }\n}\n\n/**\n * Add axis signals so grid line works correctly\n * (Fix https://github.com/vega/vega-lite/issues/4226)\n */\nexport function assembleAxisSignals(model: Model): NewSignal[] {\n const {axes} = model.component;\n const signals: NewSignal[] = [];\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n if (axes[channel]) {\n for (const axis of axes[channel]) {\n if (!axis.get('disable') && !axis.get('gridScale')) {\n // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width.\n\n const sizeType = channel === 'x' ? 'height' : 'width';\n const update = model.getSizeSignalRef(sizeType).signal;\n\n if (sizeType !== update) {\n signals.push({\n name: sizeType,\n update: update\n });\n }\n }\n }\n }\n }\n return signals;\n}\n\nexport function assembleAxes(axisComponents: AxisComponentIndex, config: Config): VgAxis[] {\n const {x = [], y = []} = axisComponents;\n return [\n ...x.map(a => assembleAxis(a, 'grid', config)),\n ...y.map(a => assembleAxis(a, 'grid', config)),\n ...x.map(a => assembleAxis(a, 'main', config)),\n ...y.map(a => assembleAxis(a, 'main', config))\n ].filter(a => a); // filter undefined\n}\n","import {Align, Color, FontStyle, FontWeight, Orient, SignalRef, TextBaseline, TitleAnchor, TitleConfig} from 'vega';\nimport {FormatMixins, Guide, VlOnlyGuideConfig} from './guide';\nimport {keys} from './util';\n\nexport const HEADER_TITLE_PROPERTIES_MAP: Partial> = {\n titleAlign: 'align',\n titleAnchor: 'anchor',\n titleAngle: 'angle',\n titleBaseline: 'baseline',\n titleColor: 'color',\n titleFont: 'font',\n titleFontSize: 'fontSize',\n titleFontStyle: 'fontStyle',\n titleFontWeight: 'fontWeight',\n titleLimit: 'limit',\n titleLineHeight: 'lineHeight',\n titleOrient: 'orient',\n titlePadding: 'offset'\n};\n\nexport const HEADER_LABEL_PROPERTIES_MAP: Partial> = {\n labelAlign: 'align',\n labelAnchor: 'anchor',\n labelAngle: 'angle',\n labelBaseline: 'baseline',\n labelColor: 'color',\n labelFont: 'font',\n labelFontSize: 'fontSize',\n labelFontStyle: 'fontStyle',\n labelFontWeight: 'fontWeight',\n labelLimit: 'limit',\n labelLineHeight: 'lineHeight',\n labelOrient: 'orient',\n labelPadding: 'offset'\n};\n\nexport const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP);\n\nexport const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP);\n\nexport interface CoreHeader extends FormatMixins {\n // ---------- Title ----------\n /**\n * The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.\n */\n titleAnchor?: TitleAnchor; // We don't allow signal for titleAnchor since there is a dependent logic\n\n /**\n * Horizontal text alignment (to the anchor) of header titles.\n */\n titleAlign?: Align | SignalRef;\n\n /**\n * The rotation angle of the header title.\n *\n * __Default value:__ `0`.\n *\n * @minimum -360\n * @maximum 360\n */\n titleAngle?: number; // We don't allow signal for titleAngle since there is a dependent logic\n\n /**\n * The vertical text baseline for the header title. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n *\n * __Default value:__ `\"middle\"`\n */\n titleBaseline?: TextBaseline | SignalRef;\n\n /**\n * Color of the header title, can be in hex color code or regular color name.\n */\n titleColor?: Color | SignalRef;\n\n /**\n * Font of the header title. (e.g., `\"Helvetica Neue\"`).\n */\n titleFont?: string | SignalRef;\n\n /**\n * Font size of the header title.\n *\n * @minimum 0\n */\n titleFontSize?: number | SignalRef;\n\n /**\n * The font style of the header title.\n */\n titleFontStyle?: FontStyle | SignalRef;\n\n /**\n * Font weight of the header title.\n * This can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`).\n */\n titleFontWeight?: FontWeight | SignalRef;\n\n /**\n * The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n *\n * __Default value:__ `0`, indicating no limit\n */\n titleLimit?: number | SignalRef;\n\n /**\n * Line height in pixels for multi-line header title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.\n */\n titleLineHeight?: number | SignalRef;\n\n /**\n * The orientation of the header title. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`.\n */\n titleOrient?: Orient;\n\n /**\n * The padding, in pixel, between facet header's title and the label.\n *\n * __Default value:__ `10`\n */\n titlePadding?: number | SignalRef;\n\n // ---------- Label ----------\n\n /**\n * A boolean flag indicating if labels should be included as part of the header.\n *\n * __Default value:__ `true`.\n */\n labels?: boolean;\n\n /**\n * Horizontal text alignment of header labels. One of `\"left\"`, `\"center\"`, or `\"right\"`.\n */\n labelAlign?: Align | SignalRef;\n\n /**\n * The vertical text baseline for the header labels. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n *\n */\n labelBaseline?: TextBaseline | SignalRef;\n\n /**\n * The anchor position for placing the labels. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label.\n */\n labelAnchor?: TitleAnchor;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the header's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * The rotation angle of the header labels.\n *\n * __Default value:__ `0` for column header, `-90` for row header.\n *\n * @minimum -360\n * @maximum 360\n */\n labelAngle?: number; // no signal ref since there is a dependent logic\n\n /**\n * The color of the header label, can be in hex color code or regular color name.\n */\n labelColor?: Color | SignalRef;\n\n /**\n * The font of the header label.\n */\n labelFont?: string | SignalRef;\n\n /**\n * The font size of the header label, in pixels.\n *\n * @minimum 0\n */\n labelFontSize?: number | SignalRef;\n\n /**\n * The font style of the header label.\n */\n labelFontStyle?: FontStyle | SignalRef;\n\n /**\n * The font weight of the header label.\n */\n labelFontWeight?: FontWeight | SignalRef;\n\n /**\n * The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n *\n * __Default value:__ `0`, indicating no limit\n */\n labelLimit?: number | SignalRef;\n\n /**\n * Line height in pixels for multi-line header labels or title text with `\"line-top\"` or `\"line-bottom\"` baseline.\n */\n labelLineHeight?: number | SignalRef;\n\n /**\n * The orientation of the header label. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`.\n */\n labelOrient?: Orient; // no signal ref since there is a dependent logic\n\n /**\n * The padding, in pixel, between facet header's label and the plot.\n *\n * __Default value:__ `10`\n */\n labelPadding?: number | SignalRef;\n\n /**\n * Shortcut for setting both labelOrient and titleOrient.\n */\n orient?: Orient; // no signal ref since there is a dependent logic\n}\n\nexport interface HeaderConfig extends CoreHeader, VlOnlyGuideConfig {}\n\n/**\n * Headers of row / column channels for faceted plots.\n */\nexport interface Header extends CoreHeader, Guide {}\n\nexport interface HeaderConfigMixins {\n /**\n * Header configuration, which determines default properties for all [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n header?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for row [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerRow?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for column [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerColumn?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for non-row/column facet [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerFacet?: HeaderConfig;\n}\n","import {ScaleType, SignalRef} from 'vega';\nimport {array} from 'vega-util';\nimport {AxisConfig} from '../../axis';\nimport {PositionScaleChannel} from '../../channel';\nimport {Config, StyleConfigIndex} from '../../config';\nimport {isQuantitative} from '../../scale';\nimport {keys, titleCase} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {getStyleConfig, signalOrStringValue} from '../common';\n\nfunction getAxisConfigFromConfigTypes(\n configTypes: string[],\n config: Config,\n channel: 'x' | 'y',\n orient: string | SignalRef\n) {\n // TODO: add special casing to add conditional value based on orient signal\n return Object.assign.apply(null, [\n {},\n ...configTypes.map(configType => {\n if (configType === 'axisOrient') {\n const orient1 = channel === 'x' ? 'bottom' : 'left';\n const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {};\n const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {};\n\n const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]);\n\n const conditionalOrientAxisConfig = {};\n for (const prop of props.values()) {\n conditionalOrientAxisConfig[prop] = {\n // orient is surely signal in this case\n signal: `${orient['signal']} === \"${orient1}\" ? ${signalOrStringValue(\n orientConfig1[prop]\n )} : ${signalOrStringValue(orientConfig2[prop])}`\n };\n }\n\n return conditionalOrientAxisConfig;\n }\n\n return config[configType];\n })\n ]);\n}\n\nexport type AxisConfigs = ReturnType;\n\nexport function getAxisConfigs(\n channel: PositionScaleChannel,\n scaleType: ScaleType,\n orient: string | SignalRef,\n config: Config\n) {\n const typeBasedConfigTypes =\n scaleType === 'band'\n ? ['axisDiscrete', 'axisBand']\n : scaleType === 'point'\n ? ['axisDiscrete', 'axisPoint']\n : isQuantitative(scaleType)\n ? ['axisQuantitative']\n : scaleType === 'time' || scaleType === 'utc'\n ? ['axisTemporal']\n : [];\n\n const axisChannel = channel === 'x' ? 'axisX' : 'axisY';\n const axisOrient = isSignalRef(orient) ? 'axisOrient' : 'axis' + titleCase(orient); // axisTop, axisBottom, ...\n\n const vlOnlyConfigTypes = [\n // technically Vega does have axisBand, but if we make another separation here,\n // it will further introduce complexity in the code\n ...typeBasedConfigTypes,\n ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4))\n ];\n\n const vgConfigTypes = ['axis', axisOrient, axisChannel];\n\n return {\n vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient),\n vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient),\n axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config)\n };\n}\n\nexport function getAxisConfigStyle(axisConfigTypes: string[], config: Config) {\n const toMerge = [{}];\n for (const configType of axisConfigTypes) {\n // TODO: add special casing to add conditional value based on orient signal\n let style = config[configType]?.style;\n if (style) {\n style = array(style);\n for (const s of style) {\n toMerge.push(config.style[s]);\n }\n }\n }\n return Object.assign.apply(null, toMerge);\n}\nexport function getAxisConfig(\n property: keyof AxisConfig,\n styleConfigIndex: StyleConfigIndex,\n style: string | string[],\n axisConfigs: Partial = {}\n): {configFrom?: string; configValue?: any} {\n const styleConfig = getStyleConfig(property, style, styleConfigIndex);\n\n if (styleConfig !== undefined) {\n return {\n configFrom: 'style',\n configValue: styleConfig\n };\n }\n\n for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) {\n if (axisConfigs[configFrom]?.[property] !== undefined) {\n return {configFrom, configValue: axisConfigs[configFrom][property]};\n }\n }\n return {};\n}\n","import {Align, AxisOrient, Orient, SignalRef} from 'vega';\nimport {isArray, isObject} from 'vega-util';\nimport {Axis} from '../../axis';\nimport {isBinned, isBinning} from '../../bin';\nimport {PositionScaleChannel, X} from '../../channel';\nimport {\n DatumDef,\n isDiscrete,\n isFieldDef,\n PositionDatumDef,\n PositionFieldDef,\n toFieldDefBase,\n TypedFieldDef,\n valueArray\n} from '../../channeldef';\nimport {Config, StyleConfigIndex} from '../../config';\nimport {Mark} from '../../mark';\nimport {hasDiscreteDomain} from '../../scale';\nimport {Sort} from '../../sort';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport {NOMINAL, ORDINAL, Type} from '../../type';\nimport {contains, normalizeAngle} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {mergeTitle, mergeTitleFieldDefs} from '../common';\nimport {guideFormat, guideFormatType} from '../format';\nimport {UnitModel} from '../unit';\nimport {ScaleType} from './../../scale';\nimport {AxisComponentProps} from './component';\nimport {AxisConfigs, getAxisConfig} from './config';\n\nexport interface AxisRuleParams {\n fieldOrDatumDef: PositionFieldDef | PositionDatumDef;\n axis: Axis;\n channel: PositionScaleChannel;\n model: UnitModel;\n\n mark: Mark;\n scaleType: ScaleType;\n orient: Orient | SignalRef;\n labelAngle: number | SignalRef;\n config: Config;\n}\n\nexport const axisRules: {\n [k in keyof AxisComponentProps]?: (params: AxisRuleParams) => AxisComponentProps[k];\n} = {\n scale: ({model, channel}) => model.scaleName(channel),\n\n format: ({fieldOrDatumDef, config, axis}) => {\n const {format, formatType} = axis;\n return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, true);\n },\n\n formatType: ({axis, fieldOrDatumDef, scaleType}) => {\n const {formatType} = axis;\n return guideFormatType(formatType, fieldOrDatumDef, scaleType);\n },\n\n grid: ({fieldOrDatumDef, axis, scaleType}) => {\n if (isFieldDef(fieldOrDatumDef) && isBinned(fieldOrDatumDef.bin)) {\n return false;\n } else {\n return axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef);\n }\n },\n\n gridScale: ({model, channel}) => gridScale(model, channel),\n\n labelAlign: ({axis, labelAngle, orient, channel}) =>\n axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel),\n\n labelAngle: ({labelAngle}) => labelAngle, // we already calculate this in parse\n\n labelBaseline: ({axis, labelAngle, orient, channel}) =>\n axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel),\n\n labelFlush: ({axis, fieldOrDatumDef, channel}) => axis.labelFlush ?? defaultLabelFlush(fieldOrDatumDef.type, channel),\n\n labelOverlap: ({axis, fieldOrDatumDef, scaleType}) =>\n axis.labelOverlap ??\n defaultLabelOverlap(\n fieldOrDatumDef.type,\n scaleType,\n isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit,\n isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined\n ),\n\n // we already calculate orient in parse\n orient: ({orient}) => orient as AxisOrient, // Need to cast until Vega supports signal\n\n tickCount: ({channel, model, axis, fieldOrDatumDef, scaleType}) => {\n const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;\n const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined;\n return axis.tickCount ?? defaultTickCount({fieldOrDatumDef, scaleType, size, values: axis.values});\n },\n\n title: ({axis, model, channel}) => {\n if (axis.title !== undefined) {\n return axis.title;\n }\n const fieldDefTitle = getFieldDefTitle(model, channel);\n if (fieldDefTitle !== undefined) {\n return fieldDefTitle;\n }\n const fieldDef = model.typedFieldDef(channel);\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = model.fieldDef(channel2);\n\n // If title not specified, store base parts of fieldDef (and fieldDef2 if exists)\n return mergeTitleFieldDefs(\n fieldDef ? [toFieldDefBase(fieldDef)] : [],\n isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []\n );\n },\n\n values: ({axis, fieldOrDatumDef}) => values(axis, fieldOrDatumDef),\n\n zindex: ({axis, fieldOrDatumDef, mark}) => axis.zindex ?? defaultZindex(mark, fieldOrDatumDef)\n};\n\n// TODO: we need to refactor this method after we take care of config refactoring\n/**\n * Default rules for whether to show a grid should be shown for a channel.\n * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned\n */\n\nexport function defaultGrid(scaleType: ScaleType, fieldDef: TypedFieldDef | DatumDef) {\n return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin);\n}\n\nexport function gridScale(model: UnitModel, channel: PositionScaleChannel) {\n const gridChannel: PositionScaleChannel = channel === 'x' ? 'y' : 'x';\n if (model.getScaleComponent(gridChannel)) {\n return model.scaleName(gridChannel);\n }\n return undefined;\n}\n\nexport function getLabelAngle(\n fieldOrDatumDef: PositionFieldDef | PositionDatumDef,\n axis: Axis,\n channel: PositionScaleChannel,\n styleConfig: StyleConfigIndex,\n axisConfigs?: AxisConfigs\n) {\n const labelAngle = axis?.labelAngle;\n // try axis value\n if (labelAngle !== undefined) {\n return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle);\n } else {\n // try axis config value\n const {configValue: angle} = getAxisConfig('labelAngle', styleConfig, axis?.style, axisConfigs);\n if (angle !== undefined) {\n return normalizeAngle(angle);\n } else {\n // get default value\n if (\n channel === X &&\n contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) &&\n !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)\n ) {\n return 270;\n }\n // no default\n return undefined;\n }\n }\n}\n\nexport function normalizeAngleExpr(angle: SignalRef) {\n return `(((${angle.signal} % 360) + 360) % 360)`;\n}\n\nexport function defaultLabelBaseline(\n angle: number | SignalRef,\n orient: AxisOrient | SignalRef,\n channel: 'x' | 'y',\n alwaysIncludeMiddle?: boolean\n) {\n if (angle !== undefined) {\n if (channel === 'x') {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === \"top\")` : orient === 'top';\n return {\n signal:\n `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? \"middle\" :` +\n `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? \"bottom\" : \"top\"`\n };\n }\n\n if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) {\n return 'middle';\n }\n\n if (isSignalRef(orient)) {\n const op = angle <= 45 || 315 <= angle ? '===' : '!==';\n return {signal: `${orient.signal} ${op} \"top\" ? \"bottom\" : \"top\"`};\n }\n\n return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top';\n } else {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === \"left\")` : orient === 'left';\n const middle = alwaysIncludeMiddle ? '\"middle\"' : 'null';\n return {\n signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? \"top\" : \"bottom\"`\n };\n }\n\n if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) {\n return alwaysIncludeMiddle ? 'middle' : null;\n }\n\n if (isSignalRef(orient)) {\n const op = 45 <= angle && angle <= 135 ? '===' : '!==';\n return {signal: `${orient.signal} ${op} \"left\" ? \"top\" : \"bottom\"`};\n }\n\n return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom';\n }\n }\n return undefined;\n}\n\nexport function defaultLabelAlign(\n angle: number | SignalRef,\n orient: AxisOrient | SignalRef,\n channel: 'x' | 'y'\n): Align | SignalRef {\n if (angle === undefined) {\n return undefined;\n }\n\n const isX = channel === 'x';\n const startAngle = isX ? 0 : 90;\n const mainOrient = isX ? 'bottom' : 'left';\n\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === \"${mainOrient}\")` : orient === mainOrient;\n return {\n signal:\n `(${startAngle ? '(' + a + ' + 90)' : a} % 180 === 0) ? ${isX ? null : '\"center\"'} :` +\n `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n\n if ((angle + startAngle) % 180 === 0) {\n // For bottom, use default label align so label flush still works\n return isX ? null : 'center';\n }\n\n if (isSignalRef(orient)) {\n const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!==';\n const orientIsMain = `${orient.signal} ${op} \"${mainOrient}\"`;\n return {\n signal: `${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n\n if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) {\n return 'left';\n }\n\n return 'right';\n}\n\nexport function defaultLabelFlush(type: Type, channel: PositionScaleChannel) {\n if (channel === 'x' && contains(['quantitative', 'temporal'], type)) {\n return true;\n }\n return undefined;\n}\n\nexport function defaultLabelOverlap(type: Type, scaleType: ScaleType, hasTimeUnit: boolean, sort?: Sort) {\n // do not prevent overlap for nominal data because there is no way to infer what the missing labels are\n if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) {\n if (scaleType === 'log') {\n return 'greedy';\n }\n return true;\n }\n return undefined;\n}\n\nexport function defaultOrient(channel: PositionScaleChannel) {\n return channel === 'x' ? 'bottom' : 'left';\n}\n\nexport function defaultTickCount({\n fieldOrDatumDef,\n scaleType,\n size,\n values: vals\n}: {\n fieldOrDatumDef: TypedFieldDef | DatumDef;\n scaleType: ScaleType;\n size?: SignalRef;\n values?: Axis['values'];\n}) {\n if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') {\n if (isFieldDef(fieldOrDatumDef)) {\n if (isBinning(fieldOrDatumDef.bin)) {\n // for binned data, we don't want more ticks than maxbins\n return {signal: `ceil(${size.signal}/10)`};\n }\n\n if (\n fieldOrDatumDef.timeUnit &&\n contains(['month', 'hours', 'day', 'quarter'], normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit)\n ) {\n return undefined;\n }\n }\n\n return {signal: `ceil(${size.signal}/40)`};\n }\n\n return undefined;\n}\n\nexport function getFieldDefTitle(model: UnitModel, channel: 'x' | 'y') {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef = model.fieldDef(channel);\n const fieldDef2 = model.fieldDef(channel2);\n\n const title1 = fieldDef ? fieldDef.title : undefined;\n const title2 = fieldDef2 ? fieldDef2.title : undefined;\n\n if (title1 && title2) {\n return mergeTitle(title1, title2);\n } else if (title1) {\n return title1;\n } else if (title2) {\n return title2;\n } else if (title1 !== undefined) {\n // falsy value to disable config\n return title1;\n } else if (title2 !== undefined) {\n // falsy value to disable config\n return title2;\n }\n\n return undefined;\n}\n\nexport function values(axis: Axis, fieldOrDatumDef: TypedFieldDef | DatumDef) {\n const vals = axis.values;\n\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n } else if (isSignalRef(vals)) {\n return vals;\n }\n\n return undefined;\n}\n\nexport function defaultZindex(mark: Mark, fieldDef: TypedFieldDef | DatumDef) {\n if (mark === 'rect' && isDiscrete(fieldDef)) {\n return 1;\n }\n return 0;\n}\n","import {FormulaTransform as VgFormulaTransform} from 'vega';\nimport {SingleDefChannel} from '../../channel';\nimport {FieldRefOption, isScaleFieldDef, TypedFieldDef, vgField} from '../../channeldef';\nimport {DateTime} from '../../datetime';\nimport {fieldFilterExpression} from '../../predicate';\nimport {isSortArray} from '../../sort';\nimport {CalculateTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {ModelWithField} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {getDependentFields} from './expressions';\n\nexport class CalculateNode extends DataFlowNode {\n private _dependentFields: Set;\n\n public clone() {\n return new CalculateNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private readonly transform: CalculateTransform) {\n super(parent);\n\n this._dependentFields = getDependentFields(this.transform.calculate);\n }\n\n public static parseAllForSortIndex(parent: DataFlowNode, model: ModelWithField) {\n // get all the encoding with sort fields from model\n model.forEachFieldDef((fieldDef: TypedFieldDef, channel: SingleDefChannel) => {\n if (!isScaleFieldDef(fieldDef)) {\n return;\n }\n if (isSortArray(fieldDef.sort)) {\n const {field, timeUnit} = fieldDef;\n const sort: (number | string | boolean | DateTime)[] = fieldDef.sort;\n // generate `datum[\"a\"] === val0 ? 0 : datum[\"a\"] === val1 ? 1 : ... : n` via FieldEqualPredicate\n const calculate =\n sort\n .map((sortValue, i) => {\n return `${fieldFilterExpression({field, timeUnit, equal: sortValue})} ? ${i} : `;\n })\n .join('') + sort.length;\n\n parent = new CalculateNode(parent, {\n calculate,\n as: sortArrayIndexField(fieldDef, channel, {forAs: true})\n });\n }\n });\n return parent;\n }\n\n public producedFields() {\n return new Set([this.transform.as]);\n }\n\n public dependentFields() {\n return this._dependentFields;\n }\n\n public assemble(): VgFormulaTransform {\n return {\n type: 'formula',\n expr: this.transform.calculate,\n as: this.transform.as\n };\n }\n\n public hash() {\n return `Calculate ${hash(this.transform)}`;\n }\n}\n\nexport function sortArrayIndexField(fieldDef: TypedFieldDef, channel: SingleDefChannel, opt?: FieldRefOption) {\n return vgField(fieldDef, {prefix: channel, suffix: 'sort_index', ...(opt ?? {})});\n}\n","import {Orient} from 'vega';\nimport {FacetChannel} from '../../channel';\nimport {Config} from '../../config';\nimport {Header} from '../../header';\nimport {FacetFieldDef} from '../../spec/facet';\nimport {contains, getFirstDefined} from '../../util';\nimport {HeaderChannel} from './component';\n\n/**\n * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet.\n */\nexport function getHeaderChannel(channel: FacetChannel, orient: Orient): HeaderChannel {\n if (contains(['top', 'bottom'], orient)) {\n return 'column';\n } else if (contains(['left', 'right'], orient)) {\n return 'row';\n }\n return channel === 'row' ? 'row' : 'column';\n}\n\nexport function getHeaderProperty

(\n prop: P,\n facetFieldDef: FacetFieldDef,\n config: Config,\n channel: FacetChannel\n): Header[P] {\n const headerSpecificConfig =\n channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet;\n\n return getFirstDefined((facetFieldDef?.header || {})[prop], headerSpecificConfig[prop], config.header[prop]);\n}\n\nexport function getHeaderProperties(\n properties: (keyof Header)[],\n facetFieldDef: FacetFieldDef,\n config: Config,\n channel: FacetChannel\n): Header {\n const props = {};\n for (const prop of properties) {\n const value = getHeaderProperty(prop, facetFieldDef, config, channel);\n if (value !== undefined) {\n props[prop] = value;\n }\n }\n return props;\n}\n","/**\n * Utility for generating row / column headers\n */\nimport {Axis as VgAxis, SignalRef, Text} from 'vega';\nimport {FacetFieldDef} from '../../spec/facet';\n\nexport type HeaderChannel = 'row' | 'column';\nexport const HEADER_CHANNELS: HeaderChannel[] = ['row', 'column'];\n\nexport type HeaderType = 'header' | 'footer';\nexport const HEADER_TYPES: HeaderType[] = ['header', 'footer'];\n\nexport interface LayoutHeaderComponentIndex {\n row?: LayoutHeaderComponent;\n column?: LayoutHeaderComponent;\n facet?: LayoutHeaderComponent;\n}\n\n/**\n * A component that represents all header, footers and title of a Vega group with layout directive.\n */\nexport interface LayoutHeaderComponent {\n title?: Text | SignalRef;\n\n // TODO: concat can have multiple header / footer.\n // Need to redesign this part a bit.\n\n facetFieldDef?: FacetFieldDef;\n\n /**\n * An array of header components for headers.\n * For facet, there should be only one header component, which is data-driven.\n * For concat, there can be multiple header components that explicitly list different axes.\n */\n header?: HeaderComponent[];\n\n /**\n * An array of header components for footers.\n * For facet, there should be only one header component, which is data-driven.\n * For concat, there can be multiple header components that explicitly list different axes.\n */\n footer?: HeaderComponent[];\n}\n\n/**\n * A component that represents one group of row/column-header/footer.\n */\nexport interface HeaderComponent {\n labels: boolean;\n\n sizeSignal: {signal: string};\n\n axes: VgAxis[];\n}\n","/**\n * Utility for generating row / column headers\n */\n\nimport {TitleAnchor, TitleConfig} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FacetChannel, FACET_CHANNELS} from '../../channel';\nimport {vgField} from '../../channeldef';\nimport {Config} from '../../config';\nimport {\n CoreHeader,\n HEADER_LABEL_PROPERTIES,\n HEADER_LABEL_PROPERTIES_MAP,\n HEADER_TITLE_PROPERTIES,\n HEADER_TITLE_PROPERTIES_MAP\n} from '../../header';\nimport {isSortField} from '../../sort';\nimport {FacetFieldDef, isFacetMapping} from '../../spec/facet';\nimport {contains, isEmpty, normalizeAngle, replaceAll} from '../../util';\nimport {RowCol, VgComparator, VgMarkGroup, VgTitle} from '../../vega.schema';\nimport {defaultLabelAlign, defaultLabelBaseline} from '../axis/properties';\nimport {sortArrayIndexField} from '../data/calculate';\nimport {formatSignalRef} from '../format';\nimport {isFacetModel, Model} from '../model';\nimport {getHeaderChannel, getHeaderProperties, getHeaderProperty} from './common';\nimport {\n HeaderChannel,\n HeaderComponent,\n HeaderType,\n HEADER_TYPES,\n LayoutHeaderComponent,\n LayoutHeaderComponentIndex\n} from './component';\n\n// TODO: rename to assembleHeaderTitleGroup\nexport function assembleTitleGroup(model: Model, channel: FacetChannel) {\n const title = model.component.layoutHeaders[channel].title;\n const config = model.config ? model.config : undefined;\n const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef\n ? model.component.layoutHeaders[channel].facetFieldDef\n : undefined;\n\n const {titleAnchor, titleAngle: ta, titleOrient} = getHeaderProperties(\n ['titleAnchor', 'titleAngle', 'titleOrient'],\n facetFieldDef,\n config,\n channel\n );\n const headerChannel = getHeaderChannel(channel, titleOrient);\n\n const titleAngle = normalizeAngle(ta);\n\n return {\n name: `${channel}-title`,\n type: 'group',\n role: `${headerChannel}-title`,\n title: {\n text: title,\n ...(channel === 'row' ? {orient: 'left'} : {}),\n style: 'guide-title',\n ...defaultHeaderGuideBaseline(titleAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)\n }\n };\n}\n\nexport function defaultHeaderGuideAlign(headerChannel: HeaderChannel, angle: number, anchor: TitleAnchor = 'middle') {\n switch (anchor) {\n case 'start':\n return {align: 'left'};\n case 'end':\n return {align: 'right'};\n }\n\n const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x');\n return align ? {align} : {};\n}\n\nexport function defaultHeaderGuideBaseline(angle: number, channel: FacetChannel) {\n const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true);\n return baseline ? {baseline} : {};\n}\n\nexport function assembleHeaderGroups(model: Model, channel: HeaderChannel): VgMarkGroup[] {\n const layoutHeader = model.component.layoutHeaders[channel];\n const groups = [];\n for (const headerType of HEADER_TYPES) {\n if (layoutHeader[headerType]) {\n for (const headerComponent of layoutHeader[headerType]) {\n const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent);\n if (group != null) {\n groups.push(group);\n }\n }\n }\n }\n return groups;\n}\n\nfunction getSort(facetFieldDef: FacetFieldDef, channel: HeaderChannel): VgComparator {\n const {sort} = facetFieldDef;\n if (isSortField(sort)) {\n return {\n field: vgField(sort, {expr: 'datum'}),\n order: sort.order ?? 'ascending'\n };\n } else if (isArray(sort)) {\n return {\n field: sortArrayIndexField(facetFieldDef, channel, {expr: 'datum'}),\n order: 'ascending'\n };\n } else {\n return {\n field: vgField(facetFieldDef, {expr: 'datum'}),\n order: sort ?? 'ascending'\n };\n }\n}\n\nexport function assembleLabelTitle(facetFieldDef: FacetFieldDef, channel: FacetChannel, config: Config) {\n const {format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr} = getHeaderProperties(\n ['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'],\n facetFieldDef,\n config,\n channel\n );\n\n const titleTextExpr = formatSignalRef({fieldOrDatumDef: facetFieldDef, format, formatType, expr: 'parent', config})\n .signal;\n const headerChannel = getHeaderChannel(channel, labelOrient);\n\n return {\n text: {\n signal: labelExpr\n ? replaceAll(\n replaceAll(labelExpr, 'datum.label', titleTextExpr),\n 'datum.value',\n vgField(facetFieldDef, {expr: 'parent'})\n )\n : titleTextExpr\n },\n ...(channel === 'row' ? {orient: 'left'} : {}),\n style: 'guide-label',\n frame: 'group',\n ...defaultHeaderGuideBaseline(labelAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)\n };\n}\n\nexport function assembleHeaderGroup(\n model: Model,\n channel: HeaderChannel,\n headerType: HeaderType,\n layoutHeader: LayoutHeaderComponent,\n headerComponent: HeaderComponent\n) {\n if (headerComponent) {\n let title = null;\n const {facetFieldDef} = layoutHeader;\n const config = model.config ? model.config : undefined;\n if (facetFieldDef && headerComponent.labels) {\n const {labelOrient} = getHeaderProperties(['labelOrient'], facetFieldDef, config, channel);\n\n // Include label title in the header if orient aligns with the channel\n if (\n (channel === 'row' && !contains(['top', 'bottom'], labelOrient)) ||\n (channel === 'column' && !contains(['left', 'right'], labelOrient))\n ) {\n title = assembleLabelTitle(facetFieldDef, channel, config);\n }\n }\n\n const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet);\n\n const axes = headerComponent.axes;\n\n const hasAxes = axes?.length > 0;\n if (title || hasAxes) {\n const sizeChannel = channel === 'row' ? 'height' : 'width';\n\n return {\n name: model.getName(`${channel}_${headerType}`),\n type: 'group',\n role: `${channel}-${headerType}`,\n\n ...(layoutHeader.facetFieldDef\n ? {\n from: {data: model.getName(channel + '_domain')},\n sort: getSort(facetFieldDef, channel)\n }\n : {}),\n ...(hasAxes && isFacetWithoutRowCol\n ? {\n from: {data: model.getName(`facet_domain_${channel}`)}\n }\n : {}),\n\n ...(title ? {title} : {}),\n ...(headerComponent.sizeSignal\n ? {\n encode: {\n update: {\n [sizeChannel]: headerComponent.sizeSignal\n }\n }\n }\n : {}),\n ...(hasAxes ? {axes} : {})\n };\n }\n }\n return null;\n}\n\nconst LAYOUT_TITLE_BAND = {\n column: {\n start: 0,\n end: 1\n },\n row: {\n start: 1,\n end: 0\n }\n};\n\nexport function getLayoutTitleBand(titleAnchor: TitleAnchor, headerChannel: HeaderChannel) {\n return LAYOUT_TITLE_BAND[headerChannel][titleAnchor];\n}\n\nexport function assembleLayoutTitleBand(\n headerComponentIndex: LayoutHeaderComponentIndex,\n config: Config\n): RowCol {\n const titleBand = {};\n\n for (const channel of FACET_CHANNELS) {\n const headerComponent = headerComponentIndex[channel];\n if (headerComponent?.facetFieldDef) {\n const {titleAnchor, titleOrient} = getHeaderProperties(\n ['titleAnchor', 'titleOrient'],\n headerComponent.facetFieldDef,\n config,\n channel\n );\n\n const headerChannel = getHeaderChannel(channel, titleOrient);\n const band = getLayoutTitleBand(titleAnchor, headerChannel);\n if (band !== undefined) {\n titleBand[headerChannel] = band;\n }\n }\n }\n\n return isEmpty(titleBand) ? undefined : titleBand;\n}\n\nexport function assembleHeaderProperties(\n config: Config,\n facetFieldDef: FacetFieldDef,\n channel: FacetChannel,\n properties: (keyof CoreHeader)[],\n propertiesMap: Partial>\n): Partial {\n const props = {};\n for (const prop of properties) {\n if (!propertiesMap[prop]) {\n continue;\n }\n\n const value = getHeaderProperty(prop, facetFieldDef, config, channel);\n if (value !== undefined) {\n props[propertiesMap[prop]] = value;\n }\n }\n return props;\n}\n","import {InitSignal, NewSignal} from 'vega';\nimport {getViewConfigContinuousSize} from '../../config';\nimport {hasDiscreteDomain} from '../../scale';\nimport {getFirstDefined} from '../../util';\nimport {isVgRangeStep, VgRangeStep} from '../../vega.schema';\nimport {isFacetModel, Model} from '../model';\nimport {ScaleComponent} from '../scale/component';\nimport {LayoutSizeType} from './component';\n\nexport function assembleLayoutSignals(model: Model): NewSignal[] {\n return [\n ...sizeSignals(model, 'width'),\n ...sizeSignals(model, 'height'),\n ...sizeSignals(model, 'childWidth'),\n ...sizeSignals(model, 'childHeight')\n ];\n}\n\nexport function sizeSignals(model: Model, sizeType: LayoutSizeType): (NewSignal | InitSignal)[] {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const size = model.component.layoutSize.get(sizeType);\n if (!size || size === 'merged') {\n return [];\n }\n\n // Read size signal name from name map, just in case it is the top-level size signal that got renamed.\n const name = model.getSizeSignalRef(sizeType).signal;\n\n if (size === 'step') {\n const scaleComponent = model.getScaleComponent(channel);\n\n if (scaleComponent) {\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = model.scaleName(channel);\n\n if (isFacetModel(model.parent)) {\n // If parent is facet and this is an independent scale, return only signal signal\n // as the width/height will be calculated using the cardinality from\n // facet's aggregate rather than reading from scale domain\n const parentResolve = model.parent.component.resolve;\n if (parentResolve.scale[channel] === 'independent') {\n return [stepSignal(scaleName, range)];\n }\n }\n\n return [\n stepSignal(scaleName, range),\n {\n name,\n update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`)\n }\n ];\n }\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('layout size is step although width/height is not step.');\n } else if (size == 'container') {\n const isWidth = name.endsWith('width');\n const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]';\n const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height');\n const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`;\n return [{name, init: safeExpr, on: [{update: safeExpr, events: 'window:resize'}]}];\n } else {\n return [\n {\n name,\n value: size\n }\n ];\n }\n}\n\nfunction stepSignal(scaleName: string, range: VgRangeStep): NewSignal {\n return {\n name: scaleName + '_step',\n value: range.step\n };\n}\n\nexport function sizeExpr(scaleName: string, scaleComponent: ScaleComponent, cardinality: string) {\n const type = scaleComponent.get('type');\n const padding = scaleComponent.get('padding');\n const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding);\n\n let paddingInner = scaleComponent.get('paddingInner');\n paddingInner =\n type === 'band'\n ? // only band has real paddingInner\n paddingInner !== undefined\n ? paddingInner\n : padding\n : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128,\n // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points.\n 1;\n return `bandspace(${cardinality}, ${paddingInner}, ${paddingOuter}) * ${scaleName}_step`;\n}\n","import {Split} from '../split';\n\nexport type LayoutSize = number | 'container' | 'step' | 'merged';\n\nexport interface LayoutSizeIndex {\n width?: LayoutSize;\n\n childWidth?: LayoutSize;\n\n height?: LayoutSize;\n\n childHeight?: LayoutSize;\n}\n\nexport type LayoutSizeType = keyof LayoutSizeIndex;\n\nexport type LayoutSizeComponent = Split;\n\nexport function getSizeTypeFromLayoutSizeType(layoutSizeType: LayoutSizeType): 'width' | 'height' {\n return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType;\n}\n","import {SignalRef} from 'vega';\nimport {ValueDef} from '../channeldef';\nimport {GuideEncodingEntry} from '../guide';\nimport {keys} from '../util';\nimport {isSignalRef, VgEncodeChannel} from '../vega.schema';\nimport {wrapCondition} from './mark/encode';\nimport {UnitModel} from './unit';\n\nexport function guideEncodeEntry(encoding: GuideEncodingEntry, model: UnitModel) {\n return keys(encoding).reduce((encode, channel: VgEncodeChannel) => {\n const valueDef = encoding[channel];\n return {\n ...encode,\n ...wrapCondition(model, valueDef, channel, (x: ValueDef | SignalRef) => (isSignalRef(x) ? x : {value: x.value}))\n };\n }, {});\n}\n","import {isXorY, ScaleChannel} from '../channel';\nimport * as log from '../log';\nimport {Resolve, ResolveMode} from '../resolve';\nimport {isConcatModel, isFacetModel, isLayerModel, Model} from './model';\n\nexport function defaultScaleResolve(channel: ScaleChannel, model: Model): ResolveMode {\n if (isLayerModel(model) || isFacetModel(model)) {\n return 'shared';\n } else if (isConcatModel(model)) {\n return isXorY(channel) ? 'independent' : 'shared';\n }\n /* istanbul ignore next: should never reach here. */\n throw new Error('invalid model type for resolve');\n}\n\nexport function parseGuideResolve(resolve: Resolve, channel: ScaleChannel): ResolveMode {\n const channelScaleResolve = resolve.scale[channel];\n const guide = isXorY(channel) ? 'axis' : 'legend';\n\n if (channelScaleResolve === 'independent') {\n if (resolve[guide][channel] === 'shared') {\n log.warn(log.message.independentScaleMeansIndependentGuide(channel));\n }\n return 'independent';\n }\n\n return resolve[guide][channel] || 'shared';\n}\n","import {Legend as VgLegend} from 'vega';\nimport {NonPositionScaleChannel} from '../../channel';\nimport {COMMON_LEGEND_PROPERTY_INDEX, Legend} from '../../legend';\nimport {Flag, keys} from '../../util';\nimport {Split} from '../split';\n\nexport type LegendComponentProps = VgLegend & {\n labelExpr?: string;\n selections?: string[];\n disable?: boolean;\n};\n\nconst LEGEND_COMPONENT_PROPERTY_INDEX: Flag = {\n ...COMMON_LEGEND_PROPERTY_INDEX,\n disable: 1,\n labelExpr: 1,\n selections: 1,\n // channel scales\n opacity: 1,\n shape: 1,\n stroke: 1,\n fill: 1,\n size: 1,\n strokeWidth: 1,\n strokeDash: 1,\n // encode\n encode: 1\n};\n\nexport const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX);\n\nexport class LegendComponent extends Split {}\n\nexport type LegendComponentIndex = Partial>;\n\nexport type LegendIndex = Partial>;\n","import {ColorValueRef, EncodeEntry, Gradient, LegendEncode, LegendType, SignalRef, SymbolEncodeEntry} from 'vega';\nimport {array, isArray, stringValue} from 'vega-util';\nimport {COLOR, NonPositionScaleChannel, OPACITY} from '../../channel';\nimport {\n Conditional,\n DatumDef,\n hasConditionalValueDef,\n isFieldDef,\n isValueDef,\n TypedFieldDef,\n Value,\n ValueDef\n} from '../../channeldef';\nimport {Encoding} from '../../encoding';\nimport {FILL_STROKE_CONFIG} from '../../mark';\nimport {getFirstDefined, isEmpty, varName} from '../../util';\nimport {applyMarkConfig, signalOrValueRef} from '../common';\nimport {formatCustomType, isCustomFormatType} from '../format';\nimport * as mixins from '../mark/encode';\nimport {STORE} from '../selection';\nimport {UnitModel} from '../unit';\nimport {LegendComponent} from './component';\n\nexport interface LegendEncodeParams {\n fieldOrDatumDef: TypedFieldDef | DatumDef;\n model: UnitModel;\n channel: NonPositionScaleChannel;\n legendCmpt: LegendComponent;\n legendType: LegendType;\n}\n\nexport const legendEncodeRules: {\n [part in keyof LegendEncode]?: (spec: EncodeEntry, params: LegendEncodeParams) => EncodeEntry;\n} = {\n symbols,\n gradient,\n labels,\n entries\n};\n\nexport function symbols(\n symbolsSpec: any,\n {fieldOrDatumDef, model, channel, legendCmpt, legendType}: LegendEncodeParams\n): SymbolEncodeEntry {\n if (legendType !== 'symbol') {\n return undefined;\n }\n\n const {markDef, encoding, config, mark} = model;\n const filled = markDef.filled && mark !== 'trail';\n\n let out = {\n ...applyMarkConfig({}, model, FILL_STROKE_CONFIG),\n ...mixins.color(model, {filled})\n } as SymbolEncodeEntry; // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry\n\n const symbolOpacity = legendCmpt.get('symbolOpacity') ?? config.legend.symbolOpacity;\n const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor;\n const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor;\n\n const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined;\n\n if (out.fill) {\n // for fill legend, we don't want any fill in symbol\n if (channel === 'fill' || (filled && channel === COLOR)) {\n delete out.fill;\n } else {\n if (out.fill['field']) {\n // For others, set fill to some opaque value (or nothing if a color is already set)\n if (symbolFillColor) {\n delete out.fill;\n } else {\n out.fill = signalOrValueRef(config.legend.symbolBaseFillColor ?? 'black');\n out.fillOpacity = signalOrValueRef(opacity ?? 1);\n }\n } else if (isArray(out.fill)) {\n const fill =\n getFirstConditionValue(encoding.fill ?? encoding.color) ?? markDef.fill ?? (filled && markDef.color);\n if (fill) {\n out.fill = signalOrValueRef(fill) as ColorValueRef;\n }\n }\n }\n }\n\n if (out.stroke) {\n if (channel === 'stroke' || (!filled && channel === COLOR)) {\n delete out.stroke;\n } else {\n if (out.stroke['field'] || symbolStrokeColor) {\n // For others, remove stroke field\n delete out.stroke;\n } else if (isArray(out.stroke)) {\n const stroke = getFirstDefined(\n getFirstConditionValue(encoding.stroke || encoding.color),\n markDef.stroke,\n filled ? markDef.color : undefined\n );\n if (stroke) {\n out.stroke = {value: stroke} as ColorValueRef;\n }\n }\n }\n }\n\n if (channel !== OPACITY) {\n const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef);\n\n if (condition) {\n out.opacity = [\n {test: condition, ...signalOrValueRef(opacity ?? 1)},\n signalOrValueRef(config.legend.unselectedOpacity)\n ];\n } else if (opacity) {\n out.opacity = signalOrValueRef(opacity);\n }\n }\n\n out = {...out, ...symbolsSpec};\n\n return isEmpty(out) ? undefined : out;\n}\n\nexport function gradient(gradientSpec: any, {model, legendType, legendCmpt}: LegendEncodeParams) {\n if (legendType !== 'gradient') {\n return undefined;\n }\n\n const {config, markDef, encoding} = model;\n\n let out: SymbolEncodeEntry = {};\n\n const gradientOpacity = legendCmpt.get('gradientOpacity') ?? config.legend.gradientOpacity;\n const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined;\n if (opacity) {\n // only apply opacity if it is neither zero or undefined\n out.opacity = signalOrValueRef(opacity);\n }\n\n out = {...out, ...gradientSpec};\n return isEmpty(out) ? undefined : out;\n}\n\nexport function labels(specifiedlabelsSpec: any, {fieldOrDatumDef, model, channel, legendCmpt}: LegendEncodeParams) {\n const legend = model.legend(channel) || {};\n const config = model.config;\n\n const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined;\n const opacity = condition ? [{test: condition, value: 1}, {value: config.legend.unselectedOpacity}] : undefined;\n\n const {format, formatType} = legend;\n\n const text = isCustomFormatType(formatType)\n ? formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n })\n : undefined;\n\n const labelsSpec = {\n ...(opacity ? {opacity} : {}),\n ...(text ? {text} : {}),\n ...specifiedlabelsSpec\n };\n\n return isEmpty(labelsSpec) ? undefined : labelsSpec;\n}\n\nexport function entries(entriesSpec: any, {legendCmpt}: LegendEncodeParams) {\n const selections = legendCmpt.get('selections');\n return selections?.length ? {...entriesSpec, fill: {value: 'transparent'}} : entriesSpec;\n}\n\nfunction getMaxValue(channelDef: Encoding['opacity']) {\n return getConditionValue(channelDef, (v: number, conditionalDef) => Math.max(v, conditionalDef.value as any));\n}\n\nexport function getFirstConditionValue(\n channelDef: Encoding['fill' | 'stroke' | 'shape']\n): V {\n return getConditionValue(channelDef, (v: V, conditionalDef: Conditional>) => {\n return getFirstDefined(v, conditionalDef.value);\n });\n}\n\nfunction getConditionValue(\n channelDef: Encoding['fill' | 'stroke' | 'shape' | 'opacity'],\n reducer: (val: V, conditionalDef: Conditional>) => V\n): V {\n if (hasConditionalValueDef(channelDef)) {\n return array(channelDef.condition).reduce(reducer, channelDef.value as any);\n } else if (isValueDef(channelDef)) {\n return channelDef.value as any;\n }\n return undefined;\n}\n\nfunction selectedCondition(model: UnitModel, legendCmpt: LegendComponent, fieldDef: TypedFieldDef) {\n const selections = legendCmpt.get('selections');\n if (!selections?.length) return undefined;\n\n const field = stringValue(fieldDef.field);\n return selections\n .map(name => {\n const store = stringValue(varName(name) + STORE);\n return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`;\n })\n .join(' || ');\n}\n","import {LabelOverlap, LegendOrient, LegendType, Orientation, SignalRef, SymbolShape} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isColorChannel} from '../../channel';\nimport {DatumDef, MarkPropFieldOrDatumDef, title as fieldDefTitle, TypedFieldDef, valueArray} from '../../channeldef';\nimport {Config} from '../../config';\nimport {Encoding} from '../../encoding';\nimport {Legend, LegendConfig} from '../../legend';\nimport {Mark, MarkDef} from '../../mark';\nimport {isContinuousToContinuous, ScaleType} from '../../scale';\nimport {TimeUnit} from '../../timeunit';\nimport {contains, getFirstDefined} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {guideFormat, guideFormatType} from '../format';\nimport {Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {NonPositionScaleChannel} from './../../channel';\nimport {LegendComponentProps} from './component';\nimport {getFirstConditionValue} from './encode';\n\nexport interface LegendRuleParams {\n legend: Legend;\n channel: NonPositionScaleChannel;\n model: UnitModel;\n markDef: MarkDef;\n encoding: Encoding;\n fieldOrDatumDef: MarkPropFieldOrDatumDef;\n legendConfig: LegendConfig;\n config: Config;\n scaleType: ScaleType;\n orient: LegendOrient;\n legendType: LegendType;\n direction: Orientation;\n}\n\nexport const legendRules: {\n [k in keyof LegendComponentProps]?: (params: LegendRuleParams) => LegendComponentProps[k];\n} = {\n direction: ({direction}) => direction,\n\n format: ({fieldOrDatumDef, legend, config}) => {\n const {format, formatType} = legend;\n return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false);\n },\n\n formatType: ({legend, fieldOrDatumDef, scaleType}) => {\n const {formatType} = legend;\n return guideFormatType(formatType, fieldOrDatumDef, scaleType);\n },\n\n gradientLength: params => {\n const {legend, legendConfig} = params;\n return legend.gradientLength ?? legendConfig.gradientLength ?? defaultGradientLength(params);\n },\n\n labelOverlap: ({legend, legendConfig, scaleType}) =>\n legend.labelOverlap ?? legendConfig.labelOverlap ?? defaultLabelOverlap(scaleType),\n\n symbolType: ({legend, markDef, channel, encoding}) =>\n legend.symbolType ?? defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape),\n\n title: ({fieldOrDatumDef, config}) => fieldDefTitle(fieldOrDatumDef, config, {allowDisabling: true}),\n\n type: ({legendType, scaleType, channel}) => {\n if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) {\n if (legendType === 'gradient') {\n return undefined;\n }\n } else if (legendType === 'symbol') {\n return undefined;\n }\n return legendType;\n }, // depended by other property, let's define upfront\n\n values: ({fieldOrDatumDef, legend}) => values(legend, fieldOrDatumDef)\n};\n\nexport function values(legend: Legend, fieldOrDatumDef: TypedFieldDef | DatumDef) {\n const vals = legend.values;\n\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n } else if (isSignalRef(vals)) {\n return vals;\n }\n return undefined;\n}\n\nexport function defaultSymbolType(\n mark: Mark,\n channel: NonPositionScaleChannel,\n shapeChannelDef: Encoding['shape'],\n markShape: SymbolShape | SignalRef\n): SymbolShape | SignalRef {\n if (channel !== 'shape') {\n // use the value from the shape encoding or the mark config if they exist\n const shape = getFirstConditionValue(shapeChannelDef) ?? markShape;\n if (shape) {\n return shape;\n }\n }\n\n switch (mark) {\n case 'bar':\n case 'rect':\n case 'image':\n case 'square':\n return 'square';\n case 'line':\n case 'trail':\n case 'rule':\n return 'stroke';\n case 'arc':\n case 'point':\n case 'circle':\n case 'tick':\n case 'geoshape':\n case 'area':\n case 'text':\n return 'circle';\n }\n}\n\nexport function clipHeight(legendType: LegendType) {\n if (legendType === 'gradient') {\n return 20;\n }\n return undefined;\n}\n\nexport function getLegendType(params: {\n legend: Legend;\n channel: NonPositionScaleChannel;\n timeUnit?: TimeUnit;\n scaleType: ScaleType;\n}): LegendType {\n const {legend} = params;\n\n return getFirstDefined(legend.type, defaultType(params));\n}\n\nexport function defaultType({\n channel,\n timeUnit,\n scaleType\n}: {\n channel: NonPositionScaleChannel;\n timeUnit?: TimeUnit;\n scaleType: ScaleType;\n}): LegendType {\n // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js\n\n if (isColorChannel(channel)) {\n if (contains(['quarter', 'month', 'day'], timeUnit)) {\n return 'symbol';\n }\n\n if (isContinuousToContinuous(scaleType)) {\n return 'gradient';\n }\n }\n return 'symbol';\n}\n\nexport function getDirection({\n legendConfig,\n legendType,\n orient,\n legend\n}: {\n orient: LegendOrient;\n legendConfig: LegendConfig;\n legendType: LegendType;\n legend: Legend;\n}): Orientation {\n return (\n legend.direction ??\n legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'] ??\n defaultDirection(orient, legendType)\n );\n}\n\nexport function defaultDirection(orient: LegendOrient, legendType: LegendType): 'horizontal' | undefined {\n switch (orient) {\n case 'top':\n case 'bottom':\n return 'horizontal';\n\n case 'left':\n case 'right':\n case 'none':\n case undefined: // undefined = \"right\" in Vega\n return undefined; // vertical is Vega's default\n default:\n // top-left / ...\n // For inner legend, uses compact layout like Tableau\n return legendType === 'gradient' ? 'horizontal' : undefined;\n }\n}\n\nexport function defaultGradientLength({\n legendConfig,\n model,\n direction,\n orient,\n scaleType\n}: {\n scaleType: ScaleType;\n direction: Orientation;\n orient: LegendOrient;\n model: Model;\n legendConfig: LegendConfig;\n}) {\n const {\n gradientHorizontalMaxLength,\n gradientHorizontalMinLength,\n gradientVerticalMaxLength,\n gradientVerticalMinLength\n } = legendConfig;\n if (isContinuousToContinuous(scaleType)) {\n if (direction === 'horizontal') {\n if (orient === 'top' || orient === 'bottom') {\n return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength);\n } else {\n return gradientHorizontalMinLength;\n }\n } else {\n // vertical / undefined (Vega uses vertical by default)\n return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength);\n }\n }\n return undefined;\n}\n\nfunction gradientLengthSignal(model: Model, sizeType: 'width' | 'height', min: number, max: number) {\n const sizeSignal = model.getSizeSignalRef(sizeType).signal;\n return {signal: `clamp(${sizeSignal}, ${min}, ${max})`};\n}\n\nexport function defaultLabelOverlap(scaleType: ScaleType): LabelOverlap {\n if (contains(['quantile', 'threshold', 'log'], scaleType)) {\n return 'greedy';\n }\n return undefined;\n}\n","import {Legend as VgLegend, LegendEncode} from 'vega';\nimport {COLOR, NonPositionScaleChannel, SHAPE} from '../../channel';\nimport {DatumDef, FieldDef, getFieldOrDatumDef, isFieldDef, MarkPropDatumDef, MarkPropFieldDef} from '../../channeldef';\nimport {Legend, LEGEND_SCALE_CHANNELS} from '../../legend';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport {GEOJSON} from '../../type';\nimport {deleteNestedProperty, isEmpty, keys, varName} from '../../util';\nimport {mergeTitleComponent} from '../common';\nimport {guideEncodeEntry} from '../guide';\nimport {isUnitModel, Model} from '../model';\nimport {parseGuideResolve} from '../resolve';\nimport {parseInteractiveLegend} from '../selection/transforms/legends';\nimport {defaultTieBreaker, Explicit, makeImplicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {LegendComponent, LegendComponentIndex, LegendComponentProps, LEGEND_COMPONENT_PROPERTIES} from './component';\nimport {LegendEncodeParams, legendEncodeRules} from './encode';\nimport {getDirection, getLegendType, LegendRuleParams, legendRules} from './properties';\n\nexport function parseLegend(model: Model) {\n const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model);\n model.component.legends = legendComponent;\n return legendComponent;\n}\n\nfunction parseUnitLegend(model: UnitModel): LegendComponentIndex {\n const {encoding} = model;\n\n const legendComponent: LegendComponentIndex = {};\n\n for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) {\n const def = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | MarkPropDatumDef;\n\n if (!def || !model.getScaleComponent(channel)) {\n continue;\n }\n\n if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) {\n continue;\n }\n\n legendComponent[channel] = parseLegendForChannel(model, channel);\n }\n\n return legendComponent;\n}\n\nfunction getLegendDefWithScale(model: UnitModel, channel: NonPositionScaleChannel): VgLegend {\n const scale = model.scaleName(channel);\n if (model.mark === 'trail') {\n if (channel === 'color') {\n // trail is a filled mark, but its default symbolType (\"stroke\") should use \"stroke\"\n return {stroke: scale};\n } else if (channel === 'size') {\n return {strokeWidth: scale};\n }\n }\n\n if (channel === 'color') {\n return model.markDef.filled ? {fill: scale} : {stroke: scale};\n }\n return {[channel]: scale};\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isExplicit(\n value: T,\n property: keyof LegendComponentProps,\n legend: Legend,\n fieldDef: FieldDef\n) {\n switch (property) {\n case 'disable':\n return legend !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit\n case 'values':\n // specified legend.values is already respected, but may get transformed.\n return !!legend?.values;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (property === 'title' && value === fieldDef?.title) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === (legend || {})[property];\n}\n\nexport function parseLegendForChannel(model: UnitModel, channel: NonPositionScaleChannel): LegendComponent {\n let legend = model.legend(channel);\n\n const {markDef, encoding, config} = model;\n const legendConfig = config.legend;\n const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel));\n parseInteractiveLegend(model, channel, legendCmpt);\n\n const disable = legend !== undefined ? !legend : legendConfig.disable;\n legendCmpt.set('disable', disable, legend !== undefined);\n if (disable) {\n return legendCmpt;\n }\n\n legend = legend || {};\n\n const scaleType = model.getScaleComponent(channel).get('type');\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | DatumDef;\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n\n const orient = legend.orient || config.legend.orient || 'right';\n const legendType = getLegendType({legend, channel, timeUnit, scaleType});\n\n const direction = getDirection({legend, legendType, orient, legendConfig});\n\n const ruleParams: LegendRuleParams = {\n legend,\n channel,\n model,\n markDef,\n encoding,\n fieldOrDatumDef,\n legendConfig,\n config,\n scaleType,\n orient,\n legendType,\n direction\n };\n\n for (const property of LEGEND_COMPONENT_PROPERTIES) {\n if (\n (legendType === 'gradient' && property.startsWith('symbol')) ||\n (legendType === 'symbol' && property.startsWith('gradient'))\n ) {\n continue;\n }\n\n const value = property in legendRules ? legendRules[property](ruleParams) : legend[property];\n if (value !== undefined) {\n const explicit = isExplicit(value, property, legend, model.fieldDef(channel));\n if (explicit || config.legend[property] === undefined) {\n legendCmpt.set(property, value, explicit);\n }\n }\n }\n\n const legendEncoding = legend?.encoding ?? {};\n const selections = legendCmpt.get('selections');\n const legendEncode: LegendEncode = {};\n\n const legendEncodeParams: LegendEncodeParams = {fieldOrDatumDef, model, channel, legendCmpt, legendType};\n\n for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) {\n const legendEncodingPart = guideEncodeEntry(legendEncoding[part] ?? {}, model);\n\n const value =\n part in legendEncodeRules\n ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule\n : legendEncodingPart; // no rule -- just default values\n\n if (value !== undefined && !isEmpty(value)) {\n legendEncode[part] = {\n ...(selections?.length && isFieldDef(fieldOrDatumDef)\n ? {name: `${varName(fieldOrDatumDef.field)}_legend_${part}`}\n : {}),\n ...(selections?.length ? {interactive: !!selections} : {}),\n update: value\n };\n }\n }\n\n if (!isEmpty(legendEncode)) {\n legendCmpt.set('encode', legendEncode, !!legend?.encoding);\n }\n\n return legendCmpt;\n}\n\nfunction parseNonUnitLegend(model: Model) {\n const {legends, resolve} = model.component;\n\n for (const child of model.children) {\n parseLegend(child);\n\n for (const channel of keys(child.component.legends)) {\n resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel);\n\n if (resolve.legend[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n\n legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]);\n\n if (!legends[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the legend shared.\n // Thus, mark legend as independent and remove the legend component.\n resolve.legend[channel] = 'independent';\n delete legends[channel];\n }\n }\n }\n }\n\n for (const channel of keys(legends)) {\n for (const child of model.children) {\n if (!child.component.legends[channel]) {\n // skip if the child does not have a particular legend\n continue;\n }\n\n if (resolve.legend[channel] === 'shared') {\n // After merging shared legend, make sure to remove legend from child\n delete child.component.legends[channel];\n }\n }\n }\n\n return legends;\n}\n\nexport function mergeLegendComponent(mergedLegend: LegendComponent, childLegend: LegendComponent): LegendComponent {\n if (!mergedLegend) {\n return childLegend.clone();\n }\n const mergedOrient = mergedLegend.getWithExplicit('orient');\n const childOrient = childLegend.getWithExplicit('orient');\n\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n // Cannot merge due to inconsistent orient\n return undefined;\n }\n\n let typeMerged = false;\n // Otherwise, let's merge\n for (const prop of LEGEND_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(\n mergedLegend.getWithExplicit(prop),\n childLegend.getWithExplicit(prop),\n prop,\n 'legend',\n\n // Tie breaker function\n (v1: Explicit, v2: Explicit): any => {\n switch (prop) {\n case 'symbolType':\n return mergeSymbolType(v1, v2);\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'type':\n // There are only two types. If we have different types, then prefer symbol over gradient.\n typeMerged = true;\n return makeImplicit('symbol');\n }\n return defaultTieBreaker(v1, v2, prop, 'legend');\n }\n );\n mergedLegend.setWithExplicit(prop, mergedValueWithExplicit);\n }\n if (typeMerged) {\n if (mergedLegend.implicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']);\n }\n if (mergedLegend.explicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']);\n }\n }\n\n return mergedLegend;\n}\n\nfunction mergeSymbolType(st1: Explicit, st2: Explicit) {\n if (st2.value === 'circle') {\n // prefer \"circle\" over \"stroke\"\n return st2;\n }\n return st1;\n}\n","import {Legend as VgLegend, LegendEncode} from 'vega';\nimport {Config} from '../../config';\nimport {LEGEND_SCALE_CHANNELS, SIGNAL_LEGEND_PROP_INDEX} from '../../legend';\nimport {keys, replaceAll, stringify, vals} from '../../util';\nimport {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema';\nimport {Model} from '../model';\nimport {LegendComponent} from './component';\nimport {mergeLegendComponent} from './parse';\n\nfunction setLegendEncode(\n legend: VgLegend,\n part: keyof LegendEncode,\n vgProp: VgEncodeChannel,\n vgRef: VgValueRef | VgValueRef[]\n) {\n legend.encode = legend.encode ?? {};\n legend.encode[part] = legend.encode[part] ?? {};\n legend.encode[part].update = legend.encode[part].update ?? {};\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n (legend.encode[part].update[vgProp] as any) = vgRef;\n}\n\nexport function assembleLegends(model: Model): VgLegend[] {\n const legendComponentIndex = model.component.legends;\n const legendByDomain: Record = {};\n\n for (const channel of keys(legendComponentIndex)) {\n const scaleComponent = model.getScaleComponent(channel);\n const domainHash = stringify(scaleComponent.get('domains'));\n if (legendByDomain[domainHash]) {\n for (const mergedLegendComponent of legendByDomain[domainHash]) {\n const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]);\n if (!merged) {\n // If cannot merge, need to add this legend separately\n legendByDomain[domainHash].push(legendComponentIndex[channel]);\n }\n }\n } else {\n legendByDomain[domainHash] = [legendComponentIndex[channel].clone()];\n }\n }\n\n const legends = vals(legendByDomain)\n .flat()\n .map(l => assembleLegend(l, model.config))\n .filter(l => l !== undefined);\n\n return legends;\n}\n\nexport function assembleLegend(legendCmpt: LegendComponent, config: Config) {\n const {disable, labelExpr, selections, ...legend} = legendCmpt.combine();\n\n if (disable) {\n return undefined;\n }\n\n if (config.aria === false && legend.aria == undefined) {\n legend.aria = false;\n }\n\n if (legend.encode?.symbols) {\n const out = legend.encode.symbols.update;\n if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) {\n // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used.\n out.stroke = {value: 'transparent'};\n }\n\n // Remove properties that the legend is encoding.\n for (const property of LEGEND_SCALE_CHANNELS) {\n if (legend[property]) {\n delete out[property];\n }\n }\n }\n\n if (!legend.title) {\n // title schema doesn't include null, ''\n delete legend.title;\n }\n\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (legend.encode?.labels?.update && isSignalRef(legend.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal);\n }\n setLegendEncode(legend, 'labels', 'text', {signal: expr});\n }\n\n for (const prop in legend) {\n const propValue = legend[prop];\n if (isSignalRef(propValue)) {\n const propIndex = SIGNAL_LEGEND_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n setLegendEncode(legend, part, vgProp, propValue);\n delete legend[prop];\n }\n }\n }\n\n return legend;\n}\n","import {Projection as VgProjection, SignalRef} from 'vega';\nimport {contains} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {isConcatModel, isLayerModel, Model} from '../model';\n\nexport function assembleProjections(model: Model): VgProjection[] {\n if (isLayerModel(model) || isConcatModel(model)) {\n return assembleProjectionsForModelAndChildren(model);\n } else {\n return assembleProjectionForModel(model);\n }\n}\n\nexport function assembleProjectionsForModelAndChildren(model: Model): VgProjection[] {\n return model.children.reduce((projections, child) => {\n return projections.concat(child.assembleProjections());\n }, assembleProjectionForModel(model));\n}\n\nexport function assembleProjectionForModel(model: Model): VgProjection[] {\n const component = model.component.projection;\n if (!component || component.merged) {\n return [];\n }\n\n const projection = component.combine();\n const {name} = projection; // we need to extract name so that it is always present in the output and pass TS type validation\n\n if (!component.data) {\n // generate custom projection, no automatic fitting\n return [\n {\n name,\n // translate to center by default\n ...{translate: {signal: '[width / 2, height / 2]'}},\n // parameters, overwrite default translate if specified\n ...projection\n }\n ];\n } else {\n // generate projection that uses extent fitting\n const size: SignalRef = {\n signal: `[${component.size.map(ref => ref.signal).join(', ')}]`\n };\n\n const fits: string[] = component.data.reduce((sources, data) => {\n const source: string = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`;\n if (!contains(sources, source)) {\n // build a unique list of sources\n sources.push(source);\n }\n return sources;\n }, []);\n\n if (fits.length <= 0) {\n throw new Error(\"Projection's fit didn't find any data sources\");\n }\n\n return [\n {\n name,\n size,\n fit: {\n signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0]\n },\n ...projection\n }\n ];\n }\n}\n","import {BaseProjection, SignalRef, Vector2} from 'vega';\nimport {ProjectionType} from './vega.schema';\n\nexport interface Projection extends BaseProjection {\n /**\n * The cartographic projection to use. This value is case-insensitive, for example `\"albers\"` and `\"Albers\"` indicate the same projection type. You can find all valid projection types [in the documentation](https://vega.github.io/vega-lite/docs/projection.html#projection-types).\n *\n * __Default value:__ `mercator`\n */\n type?: ProjectionType | SignalRef; // Re-declare to override docs\n\n /**\n * The projection’s scale (zoom) factor, overriding automatic fitting. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections.\n */\n scale?: number | SignalRef; // Re-declare to override docs\n\n /**\n * The projection’s translation offset as a two-element array `[tx, ty]`.\n */\n translate?: Vector2 | SignalRef; // TODO: figure what's VL default value\n}\n\n/**\n * Any property of Projection can be in config\n */\nexport type ProjectionConfig = Projection;\n\nexport const PROJECTION_PROPERTIES: (keyof Projection)[] = [\n 'type',\n 'clipAngle',\n 'clipExtent',\n 'center',\n 'rotate',\n 'precision',\n 'reflectX',\n 'reflectY',\n 'coefficient',\n 'distance',\n 'fraction',\n 'lobes',\n 'parallel',\n 'radius',\n 'ratio',\n 'spacing',\n 'tilt'\n];\n","import {SignalRef} from 'vega';\nimport {Projection} from '../../projection';\nimport {Projection as VgProjection} from 'vega';\nimport {Split} from '../split';\n\nexport class ProjectionComponent extends Split {\n public merged = false;\n\n constructor(\n name: string,\n public specifiedProjection: Projection,\n public size: SignalRef[],\n public data: (string | SignalRef)[]\n ) {\n super(\n {...specifiedProjection}, // all explicit properties of projection\n {name} // name as initial implicit property\n );\n }\n\n /**\n * Whether the projection parameters should fit provided data.\n */\n public get isFit() {\n return !!this.data;\n }\n}\n","import {SignalRef} from 'vega';\nimport {hasOwnProperty} from 'vega-util';\nimport {LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {PROJECTION_PROPERTIES} from '../../projection';\nimport {GEOJSON} from '../../type';\nimport {duplicate, every, stringify} from '../../util';\nimport {isUnitModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {ProjectionComponent} from './component';\n\nexport function parseProjection(model: Model) {\n model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model);\n}\n\nfunction parseUnitProjection(model: UnitModel): ProjectionComponent {\n if (model.hasProjection) {\n const proj = model.specifiedProjection;\n const fit = !(proj && (proj.scale != null || proj.translate != null));\n const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined;\n const data = fit ? gatherFitData(model) : undefined;\n\n return new ProjectionComponent(\n model.projectionName(true),\n {\n ...(model.config.projection ?? {}),\n ...(proj ?? {})\n },\n size,\n data\n );\n }\n\n return undefined;\n}\n\nfunction gatherFitData(model: UnitModel) {\n const data: (SignalRef | string)[] = [];\n\n const {encoding} = model;\n\n for (const posssiblePair of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n }\n\n if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n\n if (data.length === 0) {\n // main source is geojson, so we can just use that\n data.push(model.requestDataName(DataSourceType.Main));\n }\n\n return data;\n}\n\nfunction mergeIfNoConflict(first: ProjectionComponent, second: ProjectionComponent): ProjectionComponent {\n const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => {\n // neither has the property\n if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) {\n return true;\n }\n // both have property and an equal value for property\n if (\n hasOwnProperty(first.explicit, prop) &&\n hasOwnProperty(second.explicit, prop) &&\n // some properties might be signals or objects and require hashing for comparison\n stringify(first.get(prop)) === stringify(second.get(prop))\n ) {\n return true;\n }\n return false;\n });\n\n const size = stringify(first.size) === stringify(second.size);\n if (size) {\n if (allPropertiesShared) {\n return first;\n } else if (stringify(first.explicit) === stringify({})) {\n return second;\n } else if (stringify(second.explicit) === stringify({})) {\n return first;\n }\n }\n\n // if all properties don't match, let each unit spec have its own projection\n return null;\n}\n\nfunction parseNonUnitProjections(model: Model): ProjectionComponent {\n if (model.children.length === 0) {\n return undefined;\n }\n\n let nonUnitProjection: ProjectionComponent;\n\n // parse all children first\n for (const child of model.children) {\n parseProjection(child);\n }\n\n // analyze parsed projections, attempt to merge\n const mergable = every(model.children, child => {\n const projection = child.component.projection;\n if (!projection) {\n // child layer does not use a projection\n return true;\n } else if (!nonUnitProjection) {\n // cached 'projection' is null, cache this one\n nonUnitProjection = projection;\n return true;\n } else {\n const merge = mergeIfNoConflict(nonUnitProjection, projection);\n if (merge) {\n nonUnitProjection = merge;\n }\n return !!merge;\n }\n });\n\n // if cached one and all other children share the same projection,\n if (nonUnitProjection && mergable) {\n // so we can elevate it to the layer level\n const name = model.projectionName(true);\n const modelProjection = new ProjectionComponent(\n name,\n nonUnitProjection.specifiedProjection,\n nonUnitProjection.size,\n duplicate(nonUnitProjection.data)\n );\n\n // rename and assign all others as merged\n for (const child of model.children) {\n const projection = child.component.projection;\n if (projection) {\n if (projection.isFit) {\n modelProjection.data.push(...child.component.projection.data);\n }\n child.renameProjection(projection.get('name'), name);\n projection.merged = true;\n }\n }\n\n return modelProjection;\n }\n\n return undefined;\n}\n","import {BinTransform as VgBinTransform, Transforms as VgTransform} from 'vega';\nimport {isString} from 'vega-util';\nimport {BinParams, binToString, isBinning, isSelectionExtent} from '../../bin';\nimport {Channel} from '../../channel';\nimport {binRequiresRange, FieldName, isTypedFieldDef, normalizeBin, TypedFieldDef, vgField} from '../../channeldef';\nimport {Config} from '../../config';\nimport {BinTransform} from '../../transform';\nimport {Dict, duplicate, hash, isEmpty, keys, replacePathInField, unique, vals, varName} from '../../util';\nimport {binFormatExpression} from '../format';\nimport {isUnitModel, Model, ModelWithField} from '../model';\nimport {parseSelectionBinExtent} from '../selection/parse';\nimport {NonPositionScaleChannel, PositionChannel} from './../../channel';\nimport {DataFlowNode} from './dataflow';\n\nfunction rangeFormula(model: ModelWithField, fieldDef: TypedFieldDef, channel: Channel, config: Config) {\n if (binRequiresRange(fieldDef, channel)) {\n // read format from axis or legend, if there is no format then use config.numberFormat\n\n const guide = isUnitModel(model)\n ? model.axis(channel as PositionChannel) ?? model.legend(channel as NonPositionScaleChannel) ?? {}\n : {};\n\n const startField = vgField(fieldDef, {expr: 'datum'});\n const endField = vgField(fieldDef, {expr: 'datum', binSuffix: 'end'});\n\n return {\n formulaAs: vgField(fieldDef, {binSuffix: 'range', forAs: true}),\n formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config)\n };\n }\n return {};\n}\n\nfunction binKey(bin: BinParams, field: string) {\n return `${binToString(bin)}_${field}`;\n}\n\nfunction getSignalsFromModel(model: Model, key: string) {\n return {\n signal: model.getName(`${key}_bins`),\n extentSignal: model.getName(`${key}_extent`)\n };\n}\n\nexport function getBinSignalName(model: Model, field: string, bin: boolean | BinParams) {\n const normalizedBin = normalizeBin(bin, undefined) ?? {};\n const key = binKey(normalizedBin, field);\n return model.getName(`${key}_bins`);\n}\n\nfunction isBinTransform(t: TypedFieldDef | BinTransform): t is BinTransform {\n return 'as' in t;\n}\n\nfunction createBinComponent(t: TypedFieldDef | BinTransform, bin: boolean | BinParams, model: Model) {\n let as: [string, string];\n let span: string;\n\n if (isBinTransform(t)) {\n as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]];\n } else {\n as = [vgField(t, {forAs: true}), vgField(t, {binSuffix: 'end', forAs: true})];\n }\n\n const normalizedBin = {...normalizeBin(bin, undefined)};\n const key = binKey(normalizedBin, t.field);\n const {signal, extentSignal} = getSignalsFromModel(model, key);\n\n if (isSelectionExtent(normalizedBin.extent)) {\n const ext = normalizedBin.extent;\n const selName = ext.selection;\n span = parseSelectionBinExtent(model.getSelectionComponent(varName(selName), selName), ext);\n delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property.\n }\n\n const binComponent: BinComponent = {\n bin: normalizedBin,\n field: t.field,\n as: [as],\n ...(signal ? {signal} : {}),\n ...(extentSignal ? {extentSignal} : {}),\n ...(span ? {span} : {})\n };\n\n return {key, binComponent};\n}\n\nexport interface BinComponent {\n bin: BinParams;\n field: FieldName;\n extentSignal?: string;\n signal?: string;\n span?: string;\n\n /** Pairs of strings of the names of start and end signals */\n as: [string, string][];\n\n // Range Formula\n\n formula?: string;\n formulaAs?: string;\n}\n\nexport class BinNode extends DataFlowNode {\n public clone() {\n return new BinNode(null, duplicate(this.bins));\n }\n\n constructor(parent: DataFlowNode, private bins: Dict) {\n super(parent);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) {\n const bins = model.reduceFieldDef((binComponentIndex: Dict, fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n const {key, binComponent} = createBinComponent(fieldDef, fieldDef.bin, model);\n binComponentIndex[key] = {\n ...binComponent,\n ...binComponentIndex[key],\n ...rangeFormula(model, fieldDef, channel, model.config)\n };\n }\n return binComponentIndex;\n }, {} as Dict);\n\n if (isEmpty(bins)) {\n return null;\n }\n\n return new BinNode(parent, bins);\n }\n\n /**\n * Creates a bin node from BinTransform.\n * The optional parameter should provide\n */\n public static makeFromTransform(parent: DataFlowNode, t: BinTransform, model: Model) {\n const {key, binComponent} = createBinComponent(t, t.bin, model);\n return new BinNode(parent, {\n [key]: binComponent\n });\n }\n\n /**\n * Merge bin nodes. This method either integrates the bin config from the other node\n * or if this node already has a bin config, renames the corresponding signal in the model.\n */\n public merge(other: BinNode, renameSignal: (s1: string, s2: string) => void) {\n for (const key of keys(other.bins)) {\n if (key in this.bins) {\n renameSignal(other.bins[key].signal, this.bins[key].signal);\n // Ensure that we don't have duplicate names for signal pairs\n this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash);\n } else {\n this.bins[key] = other.bins[key];\n }\n }\n\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n other.remove();\n }\n\n public producedFields() {\n return new Set(\n vals(this.bins)\n .map(c => c.as)\n .flat(2)\n );\n }\n\n public dependentFields() {\n return new Set(vals(this.bins).map(c => c.field));\n }\n\n public hash() {\n return `Bin ${hash(this.bins)}`;\n }\n\n public assemble(): VgTransform[] {\n return vals(this.bins).flatMap(bin => {\n const transform: VgTransform[] = [];\n\n const [binAs, ...remainingAs] = bin.as;\n const {extent, ...params} = bin.bin;\n const binTrans: VgBinTransform = {\n type: 'bin',\n field: replacePathInField(bin.field),\n as: binAs,\n signal: bin.signal,\n ...(!isSelectionExtent(extent) ? {extent} : {extent: null}),\n ...(bin.span ? {span: {signal: `span(${bin.span})`}} : {}),\n ...params\n };\n\n if (!extent && bin.extentSignal) {\n transform.push({\n type: 'extent',\n field: replacePathInField(bin.field),\n signal: bin.extentSignal\n });\n binTrans.extent = {signal: bin.extentSignal};\n }\n\n transform.push(binTrans);\n\n for (const as of remainingAs) {\n for (let i = 0; i < 2; i++) {\n transform.push({\n type: 'formula',\n expr: vgField({field: binAs[i]}, {expr: 'datum'}),\n as: as[i]\n });\n }\n }\n\n if (bin.formula) {\n transform.push({\n type: 'formula',\n expr: bin.formula,\n as: bin.formulaAs\n });\n }\n return transform;\n });\n }\n}\n","import {\n Data,\n DataFormat,\n DataFormatType,\n isGenerator,\n isInlineData,\n isNamedData,\n isSphereGenerator,\n isUrlData\n} from '../../data';\nimport {contains, isEmpty, omit} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {DataFlowNode} from './dataflow';\n\nexport class SourceNode extends DataFlowNode {\n private _data: Partial;\n\n private _name: string;\n\n private _generator: boolean;\n\n constructor(data: Data) {\n super(null); // source cannot have parent\n\n data = data ?? {name: 'source'};\n let format;\n\n if (!isGenerator(data)) {\n format = data.format ? {...omit(data.format, ['parse'])} : ({} as DataFormat);\n }\n\n if (isInlineData(data)) {\n this._data = {values: data.values};\n } else if (isUrlData(data)) {\n this._data = {url: data.url};\n\n if (!format.type) {\n // Extract extension from URL using snippet from\n // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript\n let defaultExtension = /(?:\\.([^.]+))?$/.exec(data.url)[1];\n if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) {\n defaultExtension = 'json';\n }\n\n // defaultExtension has type string but we ensure that it is DataFormatType above\n format.type = defaultExtension as DataFormatType;\n }\n } else if (isSphereGenerator(data)) {\n // hardwire GeoJSON sphere data into output specification\n this._data = {values: [{type: 'Sphere'}]};\n } else if (isNamedData(data) || isGenerator(data)) {\n this._data = {};\n }\n\n // set flag to check if generator\n this._generator = isGenerator(data);\n\n // any dataset can be named\n if (data.name) {\n this._name = data.name;\n }\n\n if (format && !isEmpty(format)) {\n this._data.format = format;\n }\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields(): undefined {\n return undefined; // we don't know what this source produces\n }\n\n get data() {\n return this._data;\n }\n\n public hasName(): boolean {\n return !!this._name;\n }\n\n get isGenerator() {\n return this._generator;\n }\n get dataName() {\n return this._name;\n }\n\n set dataName(name: string) {\n this._name = name;\n }\n\n set parent(parent: DataFlowNode) {\n throw new Error('Source nodes have to be roots.');\n }\n\n public remove() {\n throw new Error('Source nodes are roots and cannot be removed.');\n }\n\n public hash(): string | number {\n throw new Error('Cannot hash sources');\n }\n\n public assemble(): VgData {\n return {\n name: this._name,\n ...this._data,\n transform: []\n };\n }\n}\n","import {GraticuleTransform as VgGraticuleTransform} from 'vega';\nimport {GraticuleParams} from '../../data';\nimport {hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\nexport class GraticuleNode extends DataFlowNode {\n public clone() {\n return new GraticuleNode(null, this.params);\n }\n\n constructor(parent: DataFlowNode, private params: true | GraticuleParams) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields(): undefined {\n return undefined; // there should never be a node before graticule\n }\n\n public hash() {\n return `Graticule ${hash(this.params)}`;\n }\n\n public assemble(): VgGraticuleTransform {\n return {\n type: 'graticule',\n ...(this.params === true ? {} : this.params)\n };\n }\n}\n","import {SequenceParams} from '../../data';\nimport {hash} from '../../util';\nimport {SequenceTransform as VgSequenceTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\nexport class SequenceNode extends DataFlowNode {\n public clone() {\n return new SequenceNode(null, this.params);\n }\n\n constructor(parent: DataFlowNode, private params: SequenceParams) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set([this.params.as ?? 'data']);\n }\n\n public hash() {\n return `Hash ${hash(this.params)}`;\n }\n\n public assemble(): VgSequenceTransform {\n return {\n type: 'sequence',\n ...this.params\n };\n }\n}\n","import {DataFlowNode} from './dataflow';\nimport {OptimizerFlags} from './optimizers';\nimport {SourceNode} from './source';\nimport {GraticuleNode} from './graticule';\nimport {SequenceNode} from './sequence';\n\n/**\n * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator.\n */\nexport function isDataSourceNode(node: DataFlowNode) {\n return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode;\n}\n\n/**\n * Abstract base class for BottomUpOptimizer and TopDownOptimizer.\n * Contains only mutation handling logic. Subclasses need to implement iteration logic.\n */\nabstract class OptimizerBase {\n private _mutated: boolean;\n constructor() {\n this._mutated = false;\n }\n // Once true, _mutated is never set to false\n public setMutated() {\n this._mutated = true;\n }\n\n get mutatedFlag() {\n return this._mutated;\n }\n}\n\n/**\n * Starts from a node and runs the optimization function(the \"run\" method) upwards to the root,\n * depending on the continueFlag and mutatedFlag values returned by the optimization function.\n */\nexport abstract class BottomUpOptimizer extends OptimizerBase {\n private _continue: boolean;\n\n constructor() {\n super();\n this._continue = false;\n }\n\n public setContinue() {\n this._continue = true;\n }\n\n get continueFlag() {\n return this._continue;\n }\n\n get flags(): OptimizerFlags {\n return {continueFlag: this.continueFlag, mutatedFlag: this.mutatedFlag};\n }\n\n set flags({continueFlag, mutatedFlag}: OptimizerFlags) {\n if (continueFlag) {\n this.setContinue();\n }\n if (mutatedFlag) {\n this.setMutated();\n }\n }\n\n public abstract run(node: DataFlowNode): OptimizerFlags;\n\n /**\n * Reset the state of the optimizer after it has completed a run from the bottom of the tree to the top.\n */\n public reset(): void {\n // do nothing\n }\n\n public optimizeNextFromLeaves(node: DataFlowNode): boolean {\n if (isDataSourceNode(node)) {\n return false;\n }\n const next = node.parent;\n const {continueFlag} = this.run(node);\n if (continueFlag) {\n this.optimizeNextFromLeaves(next);\n }\n return this.mutatedFlag;\n }\n}\n\n/**\n * The optimizer function( the \"run\" method), is invoked on the given node and then continues recursively.\n */\nexport abstract class TopDownOptimizer extends OptimizerBase {\n public abstract run(node: DataFlowNode): boolean;\n}\n","import {AggregateOp, AggregateTransform as VgAggregateTransform} from 'vega';\nimport {isArgmaxDef, isArgminDef} from '../../aggregate';\nimport {\n Channel,\n getPositionChannelFromLatLong,\n getSecondaryRangeChannel,\n isGeoPositionChannel,\n isScaleChannel\n} from '../../channel';\nimport {binRequiresRange, FieldDef, hasBand, isTypedFieldDef, vgField} from '../../channeldef';\nimport * as log from '../../log';\nimport {AggregateTransform} from '../../transform';\nimport {Dict, duplicate, hash, keys, replacePathInField, setEqual} from '../../util';\nimport {isUnitModel, ModelWithField} from '../model';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\ntype Measures = Dict>>>;\n\nfunction addDimension(dims: Set, channel: Channel, fieldDef: FieldDef, model: ModelWithField) {\n const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;\n\n if (\n isTypedFieldDef(fieldDef) &&\n isUnitModel(model) &&\n hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config)\n ) {\n dims.add(vgField(fieldDef, {}));\n dims.add(vgField(fieldDef, {suffix: 'end'}));\n\n if (fieldDef.bin && binRequiresRange(fieldDef, channel)) {\n dims.add(vgField(fieldDef, {binSuffix: 'range'}));\n }\n } else if (isGeoPositionChannel(channel)) {\n const posChannel = getPositionChannelFromLatLong(channel);\n dims.add(model.getName(posChannel));\n } else {\n dims.add(vgField(fieldDef));\n }\n return dims;\n}\n\nfunction mergeMeasures(parentMeasures: Measures, childMeasures: Measures) {\n for (const field of keys(childMeasures)) {\n // when we merge a measure, we either have to add an aggregation operator or even a new field\n const ops = childMeasures[field];\n for (const op of keys(ops)) {\n if (field in parentMeasures) {\n // add operator to existing measure field\n parentMeasures[field][op] = new Set([...(parentMeasures[field][op] ?? []), ...ops[op]]);\n } else {\n parentMeasures[field] = {[op]: ops[op]};\n }\n }\n }\n}\n\nexport class AggregateNode extends DataFlowNode {\n public clone() {\n return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures));\n }\n\n /**\n * @param dimensions string set for dimensions\n * @param measures dictionary mapping field name => dict of aggregation functions and names to use\n */\n constructor(parent: DataFlowNode, private dimensions: Set, private measures: Measures) {\n super(parent);\n }\n\n get groupBy() {\n return this.dimensions;\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel): AggregateNode {\n let isAggregate = false;\n model.forEachFieldDef(fd => {\n if (fd.aggregate) {\n isAggregate = true;\n }\n });\n\n const meas: Measures = {};\n const dims = new Set();\n\n if (!isAggregate) {\n // no need to create this node if the model has no aggregation\n return null;\n }\n\n model.forEachFieldDef((fieldDef, channel: Channel) => {\n const {aggregate, field} = fieldDef;\n if (aggregate) {\n if (aggregate === 'count') {\n meas['*'] = meas['*'] ?? {};\n meas['*']['count'] = new Set([vgField(fieldDef, {forAs: true})]);\n } else {\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n const op = isArgminDef(aggregate) ? 'argmin' : 'argmax';\n const argField = aggregate[op];\n meas[argField] = meas[argField] ?? {};\n meas[argField][op] = new Set([vgField({op, field: argField}, {forAs: true})]);\n } else {\n meas[field] = meas[field] ?? {};\n meas[field][aggregate] = new Set([vgField(fieldDef, {forAs: true})]);\n }\n\n // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain\n if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') {\n meas[field] = meas[field] ?? {};\n meas[field]['min'] = new Set([vgField({field, aggregate: 'min'}, {forAs: true})]);\n meas[field]['max'] = new Set([vgField({field, aggregate: 'max'}, {forAs: true})]);\n }\n }\n } else {\n addDimension(dims, channel, fieldDef, model);\n }\n });\n\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n\n return new AggregateNode(parent, dims, meas);\n }\n\n public static makeFromTransform(parent: DataFlowNode, t: AggregateTransform): AggregateNode {\n const dims = new Set();\n const meas: Measures = {};\n\n for (const s of t.aggregate) {\n const {op, field, as} = s;\n if (op) {\n if (op === 'count') {\n meas['*'] = meas['*'] ?? {};\n meas['*']['count'] = new Set([as ? as : vgField(s, {forAs: true})]);\n } else {\n meas[field] = meas[field] ?? {};\n meas[field][op] = new Set([as ? as : vgField(s, {forAs: true})]);\n }\n }\n }\n\n for (const s of t.groupby ?? []) {\n dims.add(s);\n }\n\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n\n return new AggregateNode(parent, dims, meas);\n }\n\n public merge(other: AggregateNode): boolean {\n if (setEqual(this.dimensions, other.dimensions)) {\n mergeMeasures(this.measures, other.measures);\n return true;\n } else {\n log.debug('different dimensions, cannot merge');\n return false;\n }\n }\n\n public addDimensions(fields: readonly string[]) {\n fields.forEach(this.dimensions.add, this.dimensions);\n }\n\n public dependentFields() {\n return new Set([...this.dimensions, ...keys(this.measures)]);\n }\n\n public producedFields() {\n const out = new Set();\n\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n const m = this.measures[field][op];\n if (m.size === 0) {\n out.add(`${op}_${field}`);\n } else {\n m.forEach(out.add, out);\n }\n }\n }\n\n return out;\n }\n\n public hash() {\n return `Aggregate ${hash({dimensions: this.dimensions, measures: this.measures})}`;\n }\n\n public assemble(): VgAggregateTransform {\n const ops: AggregateOp[] = [];\n const fields: string[] = [];\n const as: string[] = [];\n\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n for (const alias of this.measures[field][op]) {\n as.push(alias);\n ops.push(op);\n fields.push(field === '*' ? null : replacePathInField(field));\n }\n }\n }\n\n const result: VgAggregateTransform = {\n type: 'aggregate',\n groupby: [...this.dimensions].map(replacePathInField),\n ops,\n fields,\n as\n };\n\n return result;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinning} from '../../bin';\nimport {COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../../channel';\nimport {vgField} from '../../channeldef';\nimport * as log from '../../log';\nimport {hasDiscreteDomain} from '../../scale';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortField} from '../../sort';\nimport {hash} from '../../util';\nimport {isVgRangeStep, VgData} from '../../vega.schema';\nimport {FacetModel} from '../facet';\nimport {HEADER_CHANNELS, HEADER_TYPES} from '../header/component';\nimport {Model} from '../model';\nimport {assembleDomain, getFieldFromDomain} from '../scale/domain';\nimport {sortArrayIndexField} from './calculate';\nimport {DataFlowNode} from './dataflow';\n\ninterface ChildIndependentFieldsWithStep {\n x?: string;\n y?: string;\n}\n\ninterface FacetChannelInfo {\n name: string;\n fields: string[];\n sortField?: EncodingSortField;\n\n sortIndexField?: string;\n}\n\n/**\n * A node that helps us track what fields we are faceting by.\n */\nexport class FacetNode extends DataFlowNode {\n private readonly column: FacetChannelInfo;\n\n private readonly row: FacetChannelInfo;\n\n private readonly facet: FacetChannelInfo;\n\n private readonly childModel: Model;\n\n /**\n * @param model The facet model.\n * @param name The name that this facet source will have.\n * @param data The source data for this facet data.\n */\n public constructor(\n parent: DataFlowNode,\n public readonly model: FacetModel,\n public readonly name: string,\n public data: string\n ) {\n super(parent);\n\n for (const channel of FACET_CHANNELS) {\n const fieldDef = model.facet[channel];\n if (fieldDef) {\n const {bin, sort} = fieldDef;\n this[channel] = {\n name: model.getName(`${channel}_domain`),\n fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, {binSuffix: 'end'})] : [])],\n ...(isSortField(sort)\n ? {sortField: sort}\n : isArray(sort)\n ? {sortIndexField: sortArrayIndexField(fieldDef, channel)}\n : {})\n };\n }\n }\n this.childModel = model.child;\n }\n\n public hash() {\n let out = `Facet`;\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n out += ` ${channel.charAt(0)}:${hash(this[channel])}`;\n }\n }\n\n return out;\n }\n\n get fields() {\n const f: string[] = [];\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]?.fields) {\n f.push(...this[channel].fields);\n }\n }\n return f;\n }\n\n public dependentFields() {\n const depFields = new Set(this.fields);\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n if (this[channel].sortField) {\n depFields.add(this[channel].sortField.field);\n }\n if (this[channel].sortIndexField) {\n depFields.add(this[channel].sortIndexField);\n }\n }\n }\n\n return depFields;\n }\n\n public producedFields() {\n return new Set(); // facet does not produce any new fields\n }\n\n /**\n * The name to reference this source is its name.\n */\n public getSource() {\n return this.name;\n }\n\n private getChildIndependentFieldsWithStep() {\n const childIndependentFieldsWithStep: ChildIndependentFieldsWithStep = {};\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.childModel.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n // independent scale\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.childModel, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n childIndependentFieldsWithStep[channel] = field;\n } else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n\n return childIndependentFieldsWithStep;\n }\n\n private assembleRowColumnHeaderData(\n channel: 'row' | 'column' | 'facet',\n crossedDataName: string,\n childIndependentFieldsWithStep: ChildIndependentFieldsWithStep\n ): VgData {\n const childChannel = {row: 'y', column: 'x'}[channel];\n\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n\n if (childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) {\n if (crossedDataName) {\n // If there is a crossed data, calculate max\n fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n\n ops.push('max');\n } else {\n // If there is no crossed data, just calculate distinct\n fields.push(childIndependentFieldsWithStep[childChannel]);\n ops.push('distinct');\n }\n // Although it is technically a max, just name it distinct so it's easier to refer to it\n as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n }\n\n const {sortField, sortIndexField} = this[channel];\n if (sortField) {\n const {op = DEFAULT_SORT_OP, field} = sortField;\n fields.push(field);\n ops.push(op);\n as.push(vgField(sortField, {forAs: true}));\n } else if (sortIndexField) {\n fields.push(sortIndexField);\n ops.push('max');\n as.push(sortIndexField);\n }\n\n return {\n name: this[channel].name,\n // Use data from the crossed one if it exist\n source: crossedDataName ?? this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this[channel].fields,\n ...(fields.length\n ? {\n fields,\n ops,\n as\n }\n : {})\n }\n ]\n };\n }\n\n private assembleFacetHeaderData(childIndependentFieldsWithStep: ChildIndependentFieldsWithStep) {\n const {columns} = this.model.layout;\n const {layoutHeaders} = this.model.component;\n const data: VgData[] = [];\n\n const hasSharedAxis: {row?: true; column?: true} = {};\n for (const headerChannel of HEADER_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const headers = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) ?? [];\n for (const header of headers) {\n if (header.axes?.length > 0) {\n hasSharedAxis[headerChannel] = true;\n break;\n }\n }\n }\n\n if (hasSharedAxis[headerChannel]) {\n const cardinality = `length(data(\"${this.facet.name}\"))`;\n\n const stop =\n headerChannel === 'row'\n ? columns\n ? {signal: `ceil(${cardinality} / ${columns})`}\n : 1\n : columns\n ? {signal: `min(${cardinality}, ${columns})`}\n : {signal: cardinality};\n\n data.push({\n name: `${this.facet.name}_${headerChannel}`,\n transform: [\n {\n type: 'sequence',\n start: 0,\n stop\n }\n ]\n });\n }\n }\n\n const {row, column} = hasSharedAxis;\n\n if (row || column) {\n data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep));\n }\n\n return data;\n }\n\n public assemble() {\n const data: VgData[] = [];\n let crossedDataName = null;\n const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep();\n\n const {column, row, facet} = this;\n\n if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) {\n // Need to create a cross dataset to correctly calculate cardinality\n crossedDataName = `cross_${this.column.name}_${this.row.name}`;\n\n const fields: string[] = [].concat(\n childIndependentFieldsWithStep.x ?? [],\n childIndependentFieldsWithStep.y ?? []\n );\n const ops = fields.map((): AggregateOp => 'distinct');\n\n data.push({\n name: crossedDataName,\n source: this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this.fields,\n fields,\n ops\n }\n ]\n });\n }\n\n for (const channel of [COLUMN, ROW]) {\n if (this[channel]) {\n data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep));\n }\n }\n\n if (facet) {\n const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep);\n if (facetData) {\n data.push(...facetData);\n }\n }\n\n return data;\n }\n}\n","import {FormulaTransform as VgFormulaTransform, SignalRef} from 'vega';\nimport {isNumber, isString} from 'vega-util';\nimport {AncestorParse} from '.';\nimport {isMinMaxOp} from '../../aggregate';\nimport {getMainRangeChannel, SingleDefChannel} from '../../channel';\nimport {\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n isScaleFieldDef,\n isTypedFieldDef,\n TypedFieldDef\n} from '../../channeldef';\nimport {isGenerator, Parse} from '../../data';\nimport {DateTime, isDateTime} from '../../datetime';\nimport * as log from '../../log';\nimport {forEachLeaf} from '../../logical';\nimport {isPathMark} from '../../mark';\nimport {isFieldEqualPredicate, isFieldOneOfPredicate, isFieldPredicate, isFieldRangePredicate} from '../../predicate';\nimport {isSortField} from '../../sort';\nimport {FilterTransform} from '../../transform';\nimport {accessPathDepth, accessPathWithDatum, Dict, duplicate, hash, keys, removePathFromField} from '../../util';\nimport {isFacetModel, isUnitModel, Model} from '../model';\nimport {Split} from '../split';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * Remove quotes from a string.\n */\nfunction unquote(pattern: string) {\n if (\n (pattern[0] === \"'\" && pattern[pattern.length - 1] === \"'\") ||\n (pattern[0] === '\"' && pattern[pattern.length - 1] === '\"')\n ) {\n return pattern.slice(1, -1);\n }\n return pattern;\n}\n\n/**\n * @param field The field.\n * @param parse What to parse the field as.\n */\nfunction parseExpression(field: string, parse: string): string {\n const f = accessPathWithDatum(field);\n if (parse === 'number') {\n return `toNumber(${f})`;\n } else if (parse === 'boolean') {\n return `toBoolean(${f})`;\n } else if (parse === 'string') {\n return `toString(${f})`;\n } else if (parse === 'date') {\n return `toDate(${f})`;\n } else if (parse === 'flatten') {\n return f;\n } else if (parse.indexOf('date:') === 0) {\n const specifier = unquote(parse.slice(5, parse.length));\n return `timeParse(${f},'${specifier}')`;\n } else if (parse.indexOf('utc:') === 0) {\n const specifier = unquote(parse.slice(4, parse.length));\n return `utcParse(${f},'${specifier}')`;\n } else {\n log.warn(log.message.unrecognizedParse(parse));\n return null;\n }\n}\n\nexport function getImplicitFromFilterTransform(transform: FilterTransform) {\n const implicit: Dict = {};\n forEachLeaf(transform.filter, filter => {\n if (isFieldPredicate(filter)) {\n // Automatically add a parse node for filters with filter objects\n let val: string | number | boolean | DateTime | SignalRef = null;\n\n // For EqualFilter, just use the equal property.\n // For RangeFilter and OneOfFilter, all array members should have\n // the same type, so we only use the first one.\n if (isFieldEqualPredicate(filter)) {\n val = filter.equal;\n } else if (isFieldRangePredicate(filter)) {\n val = filter.range[0];\n } else if (isFieldOneOfPredicate(filter)) {\n val = (filter.oneOf ?? filter['in'])[0];\n } // else -- for filter expression, we can't infer anything\n if (val) {\n if (isDateTime(val)) {\n implicit[filter.field] = 'date';\n } else if (isNumber(val)) {\n implicit[filter.field] = 'number';\n } else if (isString(val)) {\n implicit[filter.field] = 'string';\n }\n }\n\n if (filter.timeUnit) {\n implicit[filter.field] = 'date';\n }\n }\n });\n\n return implicit;\n}\n\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromEncoding(model: Model) {\n const implicit: Dict = {};\n\n function add(fieldDef: TypedFieldDef) {\n if (isFieldOrDatumDefForTimeFormat(fieldDef)) {\n implicit[fieldDef.field] = 'date';\n } else if (\n fieldDef.type === 'quantitative' &&\n isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max\n ) {\n implicit[fieldDef.field] = 'number';\n } else if (accessPathDepth(fieldDef.field) > 1) {\n // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field.\n // (Parsing numbers / dates already flattens numeric and temporal fields.)\n if (!(fieldDef.field in implicit)) {\n implicit[fieldDef.field] = 'flatten';\n }\n } else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) {\n // Flatten fields that we sort by but that are not otherwise flattened.\n if (!(fieldDef.sort.field in implicit)) {\n implicit[fieldDef.sort.field] = 'flatten';\n }\n }\n }\n\n if (isUnitModel(model) || isFacetModel(model)) {\n // Parse encoded fields\n model.forEachFieldDef((fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef)) {\n add(fieldDef);\n } else {\n const mainChannel = getMainRangeChannel(channel);\n const mainFieldDef = model.fieldDef(mainChannel as SingleDefChannel) as TypedFieldDef;\n add({\n ...fieldDef,\n type: mainFieldDef.type\n });\n }\n });\n }\n\n // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly.\n if (isUnitModel(model)) {\n const {mark, markDef, encoding} = model;\n if (\n isPathMark(mark) &&\n // No need to sort by dimension if we have a connected scatterplot (order channel is present)\n !model.encoding.order\n ) {\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (\n isFieldDef(dimensionChannelDef) &&\n dimensionChannelDef.type === 'quantitative' &&\n !(dimensionChannelDef.field in implicit)\n ) {\n implicit[dimensionChannelDef.field] = 'number';\n }\n }\n }\n\n return implicit;\n}\n\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromSelection(model: Model) {\n const implicit: Dict = {};\n\n if (isUnitModel(model) && model.component.selection) {\n for (const name of keys(model.component.selection)) {\n const selCmpt = model.component.selection[name];\n for (const proj of selCmpt.project.items) {\n if (!proj.channel && accessPathDepth(proj.field) > 1) {\n implicit[proj.field] = 'flatten';\n }\n }\n }\n }\n\n return implicit;\n}\n\nexport class ParseNode extends DataFlowNode {\n private _parse: Parse;\n\n public clone() {\n return new ParseNode(null, duplicate(this._parse));\n }\n\n constructor(parent: DataFlowNode, parse: Parse) {\n super(parent);\n\n this._parse = parse;\n }\n\n public hash() {\n return `Parse ${hash(this._parse)}`;\n }\n\n /**\n * Creates a parse node from a data.format.parse and updates ancestorParse.\n */\n public static makeExplicit(parent: DataFlowNode, model: Model, ancestorParse: AncestorParse) {\n // Custom parse\n let explicit = {};\n const data = model.data;\n if (!isGenerator(data) && data && data.format && data.format.parse) {\n explicit = data.format.parse;\n }\n\n return this.makeWithAncestors(parent, explicit, {}, ancestorParse);\n }\n\n /**\n * Creates a parse node from \"explicit\" parse and \"implicit\" parse and updates ancestorParse.\n */\n public static makeWithAncestors(\n parent: DataFlowNode,\n explicit: Parse,\n implicit: Parse,\n ancestorParse: AncestorParse\n ) {\n // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as \"derived\"). We also don't need to flatten a field that has already been parsed.\n for (const field of keys(implicit)) {\n const parsedAs = ancestorParse.getWithExplicit(field);\n if (parsedAs.value !== undefined) {\n // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types.\n if (\n parsedAs.explicit ||\n parsedAs.value === implicit[field] ||\n parsedAs.value === 'derived' ||\n implicit[field] === 'flatten'\n ) {\n delete implicit[field];\n } else {\n log.warn(log.message.differentParse(field, implicit[field], parsedAs.value));\n }\n }\n }\n\n for (const field of keys(explicit)) {\n const parsedAs = ancestorParse.get(field);\n if (parsedAs !== undefined) {\n // Don't parse a field again if it has been parsed with the same type already.\n if (parsedAs === explicit[field]) {\n delete explicit[field];\n } else {\n log.warn(log.message.differentParse(field, explicit[field], parsedAs));\n }\n }\n }\n\n const parse = new Split(explicit, implicit);\n\n // add the format parse from this model so that children don't parse the same field again\n ancestorParse.copyAll(parse);\n\n // copy only non-null parses\n const p: Dict = {};\n for (const key of keys(parse.combine())) {\n const val = parse.get(key);\n if (val !== null) {\n p[key] = val;\n }\n }\n\n if (keys(p).length === 0 || ancestorParse.parseNothing) {\n return null;\n }\n\n return new ParseNode(parent, p);\n }\n\n public get parse() {\n return this._parse;\n }\n\n public merge(other: ParseNode) {\n this._parse = {...this._parse, ...other.parse};\n other.remove();\n }\n\n /**\n * Assemble an object for Vega's format.parse property.\n */\n public assembleFormatParse() {\n const formatParse: Dict = {};\n for (const field of keys(this._parse)) {\n const p = this._parse[field];\n if (accessPathDepth(field) === 1) {\n formatParse[field] = p;\n }\n }\n return formatParse;\n }\n\n // format parse depends and produces all fields in its parse\n public producedFields() {\n return new Set(keys(this._parse));\n }\n\n public dependentFields() {\n return new Set(keys(this._parse));\n }\n\n public assembleTransforms(onlyNested = false): VgFormulaTransform[] {\n return keys(this._parse)\n .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true))\n .map(field => {\n const expr = parseExpression(field, this._parse[field]);\n if (!expr) {\n return null;\n }\n\n const formula: VgFormulaTransform = {\n type: 'formula',\n expr,\n as: removePathFromField(field) // Vega output is always flattened\n };\n return formula;\n })\n .filter(t => t !== null);\n }\n}\n","import {SELECTION_ID} from '../../selection';\nimport {IdentifierTransform as VgIdentifierTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\nexport class IdentifierNode extends DataFlowNode {\n public clone() {\n return new IdentifierNode(null);\n }\n\n constructor(parent: DataFlowNode) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set([SELECTION_ID]);\n }\n\n public hash() {\n return 'Identifier';\n }\n\n public assemble(): VgIdentifierTransform {\n return {type: 'identifier', as: SELECTION_ID};\n }\n}\n","import {AggregateOp} from 'vega';\nimport {vgField} from '../../channeldef';\nimport {JoinAggregateTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {VgJoinAggregateTransform} from '../../vega.schema';\nimport {JoinAggregateFieldDef} from '../../transform';\nimport {unique} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the join aggregate transform nodes.\n */\nexport class JoinAggregateTransformNode extends DataFlowNode {\n public clone() {\n return new JoinAggregateTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private readonly transform: JoinAggregateTransform) {\n super(parent);\n }\n\n public addDimensions(fields: string[]) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n\n public dependentFields() {\n const out = new Set();\n\n if (this.transform.groupby) {\n this.transform.groupby.forEach(out.add, out);\n }\n this.transform.joinaggregate\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this.transform.joinaggregate.map(this.getDefaultName));\n }\n\n private getDefaultName(joinAggregateFieldDef: JoinAggregateFieldDef): string {\n return joinAggregateFieldDef.as ?? vgField(joinAggregateFieldDef);\n }\n\n public hash() {\n return `JoinAggregateTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgJoinAggregateTransform {\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n for (const joinaggregate of this.transform.joinaggregate) {\n ops.push(joinaggregate.op);\n as.push(this.getDefaultName(joinaggregate));\n fields.push(joinaggregate.field === undefined ? null : joinaggregate.field);\n }\n\n const groupby = this.transform.groupby;\n\n return {\n type: 'joinaggregate',\n as,\n ops,\n fields,\n ...(groupby !== undefined ? {groupby} : {})\n };\n }\n}\n","import {Transforms as VgTransform} from 'vega';\nimport {isArray, isString} from 'vega-util';\nimport {FieldName, getFieldDef, isFieldDef, PositionFieldDef, vgField} from '../../channeldef';\nimport {SortFields, SortOrder} from '../../sort';\nimport {StackOffset} from '../../stack';\nimport {StackTransform} from '../../transform';\nimport {duplicate, getFirstDefined, hash} from '../../util';\nimport {sortParams} from '../common';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nfunction getStackByFields(model: UnitModel): string[] {\n return model.stack.stackBy.reduce((fields, by) => {\n const fieldDef = by.fieldDef;\n\n const _field = vgField(fieldDef);\n if (_field) {\n fields.push(_field);\n }\n return fields;\n }, [] as string[]);\n}\n\nexport interface StackComponent {\n /**\n * Faceted field.\n */\n facetby: string[];\n\n dimensionFieldDef?: PositionFieldDef;\n\n /**\n * Stack measure's field. Used in makeFromEncoding.\n */\n stackField: string;\n\n /**\n * Level of detail fields for each level in the stacked charts such as color or detail.\n * Used in makeFromEncoding.\n */\n stackby?: string[];\n\n /**\n * Field that determines order of levels in the stacked charts.\n * Used in both but optional in transform.\n */\n sort: SortFields;\n\n /** Mode for stacking marks.\n */\n offset: StackOffset;\n\n /**\n * Whether to impute the data before stacking. Used only in makeFromEncoding.\n */\n impute?: boolean;\n\n /**\n * The data fields to group by.\n */\n groupby?: FieldName[];\n /**\n * Output field names of each stack field.\n */\n as: [FieldName, FieldName];\n}\n\nfunction isValidAsArray(as: string[] | string): as is string[] {\n return isArray(as) && as.every(s => isString(s)) && as.length > 1;\n}\n\nexport class StackNode extends DataFlowNode {\n private _stack: StackComponent;\n\n public clone() {\n return new StackNode(null, duplicate(this._stack));\n }\n\n constructor(parent: DataFlowNode, stack: StackComponent) {\n super(parent);\n\n this._stack = stack;\n }\n\n public static makeFromTransform(parent: DataFlowNode, stackTransform: StackTransform) {\n const {stack, groupby, as, offset = 'zero'} = stackTransform;\n\n const sortFields: string[] = [];\n const sortOrder: SortOrder[] = [];\n if (stackTransform.sort !== undefined) {\n for (const sortField of stackTransform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(getFirstDefined(sortField.order, 'ascending'));\n }\n }\n const sort: SortFields = {\n field: sortFields,\n order: sortOrder\n };\n let normalizedAs: [string, string];\n if (isValidAsArray(as)) {\n normalizedAs = as;\n } else if (isString(as)) {\n normalizedAs = [as, as + '_end'];\n } else {\n normalizedAs = [stackTransform.stack + '_start', stackTransform.stack + '_end'];\n }\n\n return new StackNode(parent, {\n stackField: stack,\n groupby,\n offset,\n sort,\n facetby: [],\n as: normalizedAs\n });\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) {\n const stackProperties = model.stack;\n const {encoding} = model;\n\n if (!stackProperties) {\n return null;\n }\n\n const {groupbyChannel, fieldChannel, offset, impute} = stackProperties;\n\n let dimensionFieldDef: PositionFieldDef;\n if (groupbyChannel) {\n const cDef = encoding[groupbyChannel];\n dimensionFieldDef = getFieldDef(cDef) as PositionFieldDef; // Fair to cast as groupByChannel is always either x or y\n }\n\n const stackby = getStackByFields(model);\n const orderDef = model.encoding.order;\n\n let sort: SortFields;\n if (isArray(orderDef) || isFieldDef(orderDef)) {\n sort = sortParams(orderDef);\n } else {\n // default = descending by stackFields\n // FIXME is the default here correct for binned fields?\n sort = stackby.reduce(\n (s, field) => {\n s.field.push(field);\n s.order.push(fieldChannel === 'y' ? 'descending' : 'ascending');\n return s;\n },\n {field: [], order: []}\n );\n }\n\n return new StackNode(parent, {\n dimensionFieldDef,\n stackField: model.vgField(fieldChannel),\n facetby: [],\n stackby,\n sort,\n offset,\n impute,\n as: [\n model.vgField(fieldChannel, {suffix: 'start', forAs: true}),\n model.vgField(fieldChannel, {suffix: 'end', forAs: true})\n ]\n });\n }\n\n get stack(): StackComponent {\n return this._stack;\n }\n\n public addDimensions(fields: string[]) {\n this._stack.facetby.push(...fields);\n }\n\n public dependentFields() {\n const out = new Set();\n\n out.add(this._stack.stackField);\n\n this.getGroupbyFields().forEach(out.add, out);\n this._stack.facetby.forEach(out.add, out);\n this._stack.sort.field.forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this._stack.as);\n }\n\n public hash() {\n return `Stack ${hash(this._stack)}`;\n }\n\n private getGroupbyFields() {\n const {dimensionFieldDef, impute, groupby} = this._stack;\n if (dimensionFieldDef) {\n if (dimensionFieldDef.bin) {\n if (impute) {\n // For binned group by field with impute, we calculate bin_mid\n // as we cannot impute two fields simultaneously\n return [vgField(dimensionFieldDef, {binSuffix: 'mid'})];\n }\n return [\n // For binned group by field without impute, we need both bin (start) and bin_end\n vgField(dimensionFieldDef, {}),\n vgField(dimensionFieldDef, {binSuffix: 'end'})\n ];\n }\n return [vgField(dimensionFieldDef)];\n }\n return groupby ?? [];\n }\n\n public assemble(): VgTransform[] {\n const transform: VgTransform[] = [];\n const {facetby, dimensionFieldDef, stackField: field, stackby, sort, offset, impute, as} = this._stack;\n\n // Impute\n if (impute && dimensionFieldDef) {\n const {band = 0.5, bin} = dimensionFieldDef;\n if (bin) {\n // As we can only impute one field at a time, we need to calculate\n // mid point for a binned field\n transform.push({\n type: 'formula',\n expr:\n `${band}*` +\n vgField(dimensionFieldDef, {expr: 'datum'}) +\n `+${1 - band}*` +\n vgField(dimensionFieldDef, {expr: 'datum', binSuffix: 'end'}),\n as: vgField(dimensionFieldDef, {binSuffix: 'mid', forAs: true})\n });\n }\n\n transform.push({\n type: 'impute',\n field,\n groupby: [...stackby, ...facetby],\n key: vgField(dimensionFieldDef, {binSuffix: 'mid'}),\n method: 'value',\n value: 0\n });\n }\n\n // Stack\n transform.push({\n type: 'stack',\n groupby: [...this.getGroupbyFields(), ...facetby],\n field,\n sort,\n as,\n offset\n });\n\n return transform;\n }\n}\n","import {AggregateOp, WindowTransform as VgWindowTransform} from 'vega';\nimport {isAggregateOp} from '../../aggregate';\nimport {vgField} from '../../channeldef';\nimport {SortOrder} from '../../sort';\nimport {WindowFieldDef, WindowOnlyOp, WindowTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {VgComparator, VgJoinAggregateTransform} from '../../vega.schema';\nimport {unique} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the window transform nodes\n */\nexport class WindowTransformNode extends DataFlowNode {\n public clone() {\n return new WindowTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private readonly transform: WindowTransform) {\n super(parent);\n }\n\n public addDimensions(fields: string[]) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n\n public dependentFields() {\n const out = new Set();\n\n (this.transform.groupby ?? []).forEach(out.add, out);\n (this.transform.sort ?? []).forEach(m => out.add(m.field));\n\n this.transform.window\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this.transform.window.map(this.getDefaultName));\n }\n\n private getDefaultName(windowFieldDef: WindowFieldDef): string {\n return windowFieldDef.as ?? vgField(windowFieldDef);\n }\n\n public hash() {\n return `WindowTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgWindowTransform | VgJoinAggregateTransform {\n const fields: string[] = [];\n const ops: (AggregateOp | WindowOnlyOp)[] = [];\n const as: string[] = [];\n const params = [];\n\n for (const window of this.transform.window) {\n ops.push(window.op);\n as.push(this.getDefaultName(window));\n params.push(window.param === undefined ? null : window.param);\n fields.push(window.field === undefined ? null : window.field);\n }\n\n const frame = this.transform.frame;\n const groupby = this.transform.groupby;\n\n if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) {\n // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate\n return {\n type: 'joinaggregate',\n as,\n ops: ops as AggregateOp[],\n fields,\n ...(groupby !== undefined ? {groupby} : {})\n } as VgJoinAggregateTransform;\n }\n\n const sortFields: string[] = [];\n const sortOrder: SortOrder[] = [];\n if (this.transform.sort !== undefined) {\n for (const sortField of this.transform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(sortField.order ?? 'ascending');\n }\n }\n const sort: VgComparator = {\n field: sortFields,\n order: sortOrder\n };\n const ignorePeers = this.transform.ignorePeers;\n\n return {\n type: 'window',\n params,\n as,\n ops,\n fields,\n sort,\n ...(ignorePeers !== undefined ? {ignorePeers} : {}),\n ...(groupby !== undefined ? {groupby} : {}),\n ...(frame !== undefined ? {frame} : {})\n } as VgWindowTransform;\n }\n}\n","import {DataSourceType, Parse} from '../../data';\nimport {Dict, fieldIntersection, hash, hasIntersection, isEmpty, keys, some} from '../../util';\nimport {Model} from '../model';\nimport {requiresSelectionId} from '../selection';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {ParseNode} from './formatparse';\nimport {IdentifierNode} from './identifier';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {FACET_SCALE_PREFIX} from './optimize';\nimport {BottomUpOptimizer, isDataSourceNode, TopDownOptimizer} from './optimizer';\nimport * as optimizers from './optimizers';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nexport interface OptimizerFlags {\n /**\n * If true, iteration continues.\n */\n continueFlag: boolean;\n /**\n * If true, the tree has been mutated by the function.\n */\n mutatedFlag: boolean;\n}\n\n/**\n * Move parse nodes up to forks.\n */\nexport class MoveParseUp extends BottomUpOptimizer {\n public run(node: DataFlowNode): OptimizerFlags {\n const parent = node.parent;\n // Move parse up by merging or swapping.\n if (node instanceof ParseNode) {\n if (isDataSourceNode(parent)) {\n return this.flags;\n }\n\n if (parent.numChildren() > 1) {\n // Don't move parse further up but continue with parent.\n this.setContinue();\n return this.flags;\n }\n\n if (parent instanceof ParseNode) {\n this.setMutated();\n parent.merge(node);\n } else {\n // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup).\n if (fieldIntersection(parent.producedFields(), node.dependentFields())) {\n this.setContinue();\n return this.flags;\n }\n this.setMutated();\n node.swapWithParent();\n }\n }\n this.setContinue();\n return this.flags;\n }\n}\n\n/**\n * Merge identical nodes at forks by comparing hashes.\n *\n * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler.\n */\nexport class MergeIdenticalNodes extends TopDownOptimizer {\n public mergeNodes(parent: DataFlowNode, nodes: DataFlowNode[]) {\n const mergedNode = nodes.shift();\n for (const node of nodes) {\n parent.removeChild(node);\n node.parent = mergedNode;\n node.remove();\n }\n }\n\n public run(node: DataFlowNode): boolean {\n const hashes = node.children.map(x => x.hash());\n const buckets: {hash?: DataFlowNode[]} = {};\n\n for (let i = 0; i < hashes.length; i++) {\n if (buckets[hashes[i]] === undefined) {\n buckets[hashes[i]] = [node.children[i]];\n } else {\n buckets[hashes[i]].push(node.children[i]);\n }\n }\n\n for (const k of keys(buckets)) {\n if (buckets[k].length > 1) {\n this.setMutated();\n this.mergeNodes(node, buckets[k]);\n }\n }\n for (const child of node.children) {\n this.run(child);\n }\n return this.mutatedFlag;\n }\n}\n\n/**\n * Repeatedly remove leaf nodes that are not output or facet nodes.\n * The reason is that we don't need subtrees that don't have any output nodes.\n * Facet nodes are needed for the row or column domains.\n */\nexport class RemoveUnusedSubtrees extends BottomUpOptimizer {\n public run(node: DataFlowNode): OptimizerFlags {\n if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) {\n // no need to continue with parent because it is output node or will have children (there was a fork)\n return this.flags;\n } else {\n this.setMutated();\n node.remove();\n }\n return this.flags;\n }\n}\n\n/**\n * Removes duplicate time unit nodes (as determined by the name of the\n * output field) that may be generated due to selections projected over\n * time units.\n *\n * TODO: Try to make this a top down optimizer that keeps only the first\n * insance of a time unit node.\n * TODO: Try to make a generic version of this that only keeps one node per hash.\n */\nexport class RemoveDuplicateTimeUnits extends BottomUpOptimizer {\n private fields = new Set();\n private prev: DataFlowNode = null;\n public run(node: DataFlowNode): OptimizerFlags {\n this.setContinue();\n if (node instanceof TimeUnitNode) {\n const pfields = node.producedFields();\n if (hasIntersection(pfields, this.fields)) {\n this.setMutated();\n this.prev.remove();\n } else {\n this.fields = new Set([...this.fields, ...pfields]);\n }\n this.prev = node;\n }\n return this.flags;\n }\n\n public reset(): void {\n this.fields.clear();\n }\n}\n\n/**\n * Merge adjacent time unit nodes.\n */\nexport class MergeTimeUnits extends BottomUpOptimizer {\n public run(node: DataFlowNode): OptimizerFlags {\n this.setContinue();\n const parent = node.parent;\n const timeUnitChildren = parent.children.filter(x => x instanceof TimeUnitNode) as TimeUnitNode[];\n const combination = timeUnitChildren.pop();\n for (const timeUnit of timeUnitChildren) {\n this.setMutated();\n combination.merge(timeUnit);\n }\n return this.flags;\n }\n}\n\n/**\n * Clones the subtree and ignores output nodes except for the leaves, which are renamed.\n */\nfunction cloneSubtree(facet: FacetNode) {\n function clone(node: DataFlowNode): DataFlowNode[] {\n if (!(node instanceof FacetNode)) {\n const copy = node.clone();\n\n if (copy instanceof OutputNode) {\n const newName = FACET_SCALE_PREFIX + copy.getSource();\n copy.setSource(newName);\n\n facet.model.component.data.outputNodes[newName] = copy;\n } else if (\n copy instanceof AggregateNode ||\n copy instanceof StackNode ||\n copy instanceof WindowTransformNode ||\n copy instanceof JoinAggregateTransformNode\n ) {\n copy.addDimensions(facet.fields);\n }\n for (const n of node.children.flatMap(clone)) {\n n.parent = copy;\n }\n\n return [copy];\n }\n\n return node.children.flatMap(clone);\n }\n return clone;\n}\n\n/**\n * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node.\n * After moving down the facet node, make a copy of the subtree and make it a child of the main output.\n */\nexport function moveFacetDown(node: DataFlowNode) {\n if (node instanceof FacetNode) {\n if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) {\n // move down until we hit a fork or output node\n const child = node.children[0];\n\n if (\n child instanceof AggregateNode ||\n child instanceof StackNode ||\n child instanceof WindowTransformNode ||\n child instanceof JoinAggregateTransformNode\n ) {\n child.addDimensions(node.fields);\n }\n\n child.swapWithParent();\n moveFacetDown(node);\n } else {\n // move main to facet\n\n const facetMain = node.model.component.data.main;\n moveMainDownToFacet(facetMain);\n\n // replicate the subtree and place it before the facet's main node\n const cloner = cloneSubtree(node);\n const copy: DataFlowNode[] = node.children.map(cloner).flat();\n for (const c of copy) {\n c.parent = facetMain;\n }\n }\n } else {\n node.children.map(moveFacetDown);\n }\n}\n\nfunction moveMainDownToFacet(node: DataFlowNode) {\n if (node instanceof OutputNode && node.type === DataSourceType.Main) {\n if (node.numChildren() === 1) {\n const child = node.children[0];\n if (!(child instanceof FacetNode)) {\n child.swapWithParent();\n moveMainDownToFacet(node);\n }\n }\n }\n}\n\n/**\n * Remove output nodes that are not required. Starting from a root.\n */\nexport class RemoveUnnecessaryOutputNodes extends TopDownOptimizer {\n constructor() {\n super();\n }\n\n public run(node: DataFlowNode): boolean {\n if (node instanceof OutputNode && !node.isRequired()) {\n this.setMutated();\n node.remove();\n }\n\n for (const child of node.children) {\n this.run(child);\n }\n\n return this.mutatedFlag;\n }\n}\n\nexport class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer {\n private requiresSelectionId: boolean;\n constructor(model: Model) {\n super();\n this.requiresSelectionId = model && requiresSelectionId(model);\n }\n\n public run(node: DataFlowNode): boolean {\n if (node instanceof IdentifierNode) {\n // Only preserve IdentifierNodes if we have default discrete selections\n // in our model tree, and if the nodes come after tuple producing nodes.\n if (\n !(\n this.requiresSelectionId &&\n (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode)\n )\n ) {\n this.setMutated();\n node.remove();\n }\n }\n\n for (const child of node.children) {\n this.run(child);\n }\n\n return this.mutatedFlag;\n }\n}\n\n/**\n * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes.\n *\n * We assume that dependent paths that do not have a parse node can be just merged.\n */\nexport class MergeParse extends BottomUpOptimizer {\n public run(node: DataFlowNode): optimizers.OptimizerFlags {\n const parent = node.parent;\n const originalChildren = [...parent.children];\n const parseChildren = parent.children.filter((child): child is ParseNode => child instanceof ParseNode);\n\n if (parent.numChildren() > 1 && parseChildren.length >= 1) {\n const commonParse: Parse = {};\n const conflictingParse = new Set();\n for (const parseNode of parseChildren) {\n const parse = parseNode.parse;\n for (const k of keys(parse)) {\n if (!(k in commonParse)) {\n commonParse[k] = parse[k];\n } else if (commonParse[k] !== parse[k]) {\n conflictingParse.add(k);\n }\n }\n }\n\n for (const field of conflictingParse) {\n delete commonParse[field];\n }\n\n if (!isEmpty(commonParse)) {\n this.setMutated();\n const mergedParseNode = new ParseNode(parent, commonParse);\n for (const childNode of originalChildren) {\n if (childNode instanceof ParseNode) {\n for (const key of keys(commonParse)) {\n delete childNode.parse[key];\n }\n }\n\n parent.removeChild(childNode);\n childNode.parent = mergedParseNode;\n\n // remove empty parse nodes\n if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) {\n childNode.remove();\n }\n }\n }\n }\n\n this.setContinue();\n return this.flags;\n }\n}\n\nexport class MergeAggregates extends BottomUpOptimizer {\n public run(node: DataFlowNode): optimizers.OptimizerFlags {\n const parent = node.parent;\n const aggChildren = parent.children.filter((child): child is AggregateNode => child instanceof AggregateNode);\n\n // Object which we'll use to map the fields which an aggregate is grouped by to\n // the set of aggregates with that grouping. This is useful as only aggregates\n // with the same group by can be merged\n const groupedAggregates: Dict = {};\n\n // Build groupedAggregates\n for (const agg of aggChildren) {\n const groupBys = hash(agg.groupBy);\n if (!(groupBys in groupedAggregates)) {\n groupedAggregates[groupBys] = [];\n }\n groupedAggregates[groupBys].push(agg);\n }\n\n // Merge aggregateNodes with same key in groupedAggregates\n for (const group of keys(groupedAggregates)) {\n const mergeableAggs = groupedAggregates[group];\n if (mergeableAggs.length > 1) {\n const mergedAggs = mergeableAggs.pop();\n for (const agg of mergeableAggs) {\n if (mergedAggs.merge(agg)) {\n parent.removeChild(agg);\n agg.parent = mergedAggs;\n agg.remove();\n\n this.setMutated();\n }\n }\n }\n }\n\n this.setContinue();\n return this.flags;\n }\n}\n\n/**\n * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node.\n */\nexport class MergeBins extends BottomUpOptimizer {\n constructor(private model: Model) {\n super();\n }\n public run(node: DataFlowNode): OptimizerFlags {\n const parent = node.parent;\n const moveBinsUp = !(\n isDataSourceNode(parent) ||\n parent instanceof FilterNode ||\n parent instanceof ParseNode ||\n parent instanceof IdentifierNode\n );\n\n const promotableBins: BinNode[] = [];\n const remainingBins: BinNode[] = [];\n\n for (const child of parent.children) {\n if (child instanceof BinNode) {\n if (moveBinsUp && !fieldIntersection(parent.producedFields(), child.dependentFields())) {\n promotableBins.push(child);\n } else {\n remainingBins.push(child);\n }\n }\n }\n\n if (promotableBins.length > 0) {\n const promotedBin = promotableBins.pop();\n for (const bin of promotableBins) {\n promotedBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setMutated();\n if (parent instanceof BinNode) {\n parent.merge(promotedBin, this.model.renameSignal.bind(this.model));\n } else {\n promotedBin.swapWithParent();\n }\n }\n if (remainingBins.length > 1) {\n const remainingBin = remainingBins.pop();\n for (const bin of remainingBins) {\n remainingBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setMutated();\n }\n this.setContinue();\n return this.flags;\n }\n}\n\n/**\n * This optimizer takes output nodes that are at a fork and moves them before the fork.\n *\n * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes.\n * It then moves all output nodes before that main output node. All other children (and the children of the output nodes)\n * are inserted after the main output node.\n */\nexport class MergeOutputs extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const parent = node.parent;\n const children = [...parent.children];\n const hasOutputChild = some(children, child => child instanceof OutputNode);\n\n if (!hasOutputChild || parent.numChildren() <= 1) {\n this.setContinue();\n return this.flags;\n }\n\n const otherChildren: DataFlowNode[] = [];\n\n // The output node we will connect all other nodes to.\n // Output nodes will be added before the new node, other nodes after.\n let mainOutput: OutputNode;\n\n for (const child of children) {\n if (child instanceof OutputNode) {\n let lastOutput = child;\n\n while (lastOutput.numChildren() === 1) {\n const [theChild] = lastOutput.children;\n if (theChild instanceof OutputNode) {\n lastOutput = theChild;\n } else {\n break;\n }\n }\n\n otherChildren.push(...lastOutput.children);\n\n if (mainOutput) {\n // Move the output nodes before the mainOutput. We do this by setting\n // the parent of the first not to the parent of the main output and\n // the main output's parent to the last output.\n\n // note: the child is the first output\n parent.removeChild(child);\n child.parent = mainOutput.parent;\n\n mainOutput.parent.removeChild(mainOutput);\n mainOutput.parent = lastOutput;\n\n this.setMutated();\n } else {\n mainOutput = lastOutput;\n }\n } else {\n otherChildren.push(child);\n }\n }\n\n if (otherChildren.length) {\n this.setMutated();\n for (const child of otherChildren) {\n child.parent.removeChild(child);\n child.parent = mainOutput;\n }\n }\n\n this.setContinue();\n return this.flags;\n }\n}\n","import {DataComponent} from '.';\nimport * as log from '../../log';\nimport {Model} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {BottomUpOptimizer, TopDownOptimizer} from './optimizer';\nimport * as optimizers from './optimizers';\n\nexport const FACET_SCALE_PREFIX = 'scale_';\nexport const MAX_OPTIMIZATION_RUNS = 5;\n\n/**\n * Iterates over a dataflow graph and checks whether all links are consistent.\n */\nexport function checkLinks(nodes: readonly DataFlowNode[]): boolean {\n for (const node of nodes) {\n for (const child of node.children) {\n if (child.parent !== node) {\n // log.error('Dataflow graph is inconsistent.', node, child);\n return false;\n }\n }\n\n if (!checkLinks(node.children)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Return all leaf nodes.\n */\nfunction getLeaves(roots: DataFlowNode[]) {\n const leaves: DataFlowNode[] = [];\n function append(node: DataFlowNode) {\n if (node.numChildren() === 0) {\n leaves.push(node);\n } else {\n for (const child of node.children) {\n append(child);\n }\n }\n }\n\n for (const child of roots) {\n append(child);\n }\n return leaves;\n}\n\nexport function isTrue(x: boolean) {\n return x;\n}\n\n/**\n * Run the specified optimizer on the provided nodes.\n *\n * @param optimizer The optimizer instance to run.\n * @param nodes A set of nodes to optimize.\n * @param flag Flag that will be or'ed with return valued from optimization calls to the nodes.\n */\nfunction runOptimizer(optimizer: BottomUpOptimizer | TopDownOptimizer, nodes: DataFlowNode[]): boolean {\n const flags = nodes.map(node => {\n if (optimizer instanceof BottomUpOptimizer) {\n const runFlags = optimizer.optimizeNextFromLeaves(node);\n optimizer.reset();\n return runFlags;\n } else {\n return optimizer.run(node);\n }\n });\n return flags.some(isTrue);\n}\n\nfunction optimizationDataflowHelper(dataComponent: DataComponent, model: Model, firstPass: boolean) {\n let roots = dataComponent.sources;\n const mutatedFlags: Set = new Set();\n\n mutatedFlags.add(runOptimizer(new optimizers.RemoveUnnecessaryOutputNodes(), roots));\n mutatedFlags.add(runOptimizer(new optimizers.RemoveUnnecessaryIdentifierNodes(model), roots));\n\n // remove source nodes that don't have any children because they also don't have output nodes\n roots = roots.filter(r => r.numChildren() > 0);\n\n mutatedFlags.add(runOptimizer(new optimizers.RemoveUnusedSubtrees(), getLeaves(roots)));\n\n roots = roots.filter(r => r.numChildren() > 0);\n\n if (!firstPass) {\n // Only run these optimizations after the optimizer has moved down the facet node.\n // With this change, we can be more aggressive in the optimizations.\n mutatedFlags.add(runOptimizer(new optimizers.MoveParseUp(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeBins(model), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.RemoveDuplicateTimeUnits(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeParse(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeAggregates(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeTimeUnits(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeIdenticalNodes(), roots));\n mutatedFlags.add(runOptimizer(new optimizers.MergeOutputs(), getLeaves(roots)));\n }\n\n dataComponent.sources = roots;\n\n return mutatedFlags.has(true);\n}\n\n/**\n * Optimizes the dataflow of the passed in data component.\n */\nexport function optimizeDataflow(data: DataComponent, model: Model) {\n // check before optimizations\n checkLinks(data.sources);\n\n let firstPassCounter = 0;\n let secondPassCounter = 0;\n\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, true)) {\n break;\n }\n firstPassCounter++;\n }\n\n // move facets down and make a copy of the subtree so that we can have scales at the top level\n data.sources.map(optimizers.moveFacetDown);\n\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, false)) {\n break;\n }\n secondPassCounter++;\n }\n\n // check after optimizations\n checkLinks(data.sources);\n\n if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) {\n log.warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`);\n }\n}\n","import {SignalRef} from 'vega';\n\nexport type Rename = (oldSignalName: string) => string;\n\n/**\n * A class that behaves like a SignalRef but lazily generates the signal.\n * The provided generator function should use `Model.getSignalName` to use the correct signal name.\n */\nexport class SignalRefWrapper implements SignalRef {\n constructor(exprGenerator: () => string) {\n Object.defineProperty(this, 'signal', {\n enumerable: true,\n get: exprGenerator\n });\n }\n\n public signal: string; // for ts\n\n public static fromName(rename: Rename, signalName: string) {\n return new SignalRefWrapper(() => rename(signalName));\n }\n}\n","import {SignalRef} from 'vega';\nimport {isObject, isString} from 'vega-util';\nimport {\n isAggregateOp,\n isArgmaxDef,\n isArgminDef,\n MULTIDOMAIN_SORT_OP_INDEX as UNIONDOMAIN_SORT_OP_INDEX,\n NonArgAggregateOp,\n SHARED_DOMAIN_OP_INDEX\n} from '../../aggregate';\nimport {isBinning, isBinParams, isSelectionExtent} from '../../bin';\nimport {getSecondaryRangeChannel, isScaleChannel, ScaleChannel} from '../../channel';\nimport {\n binRequiresRange,\n getFieldOrDatumDef,\n hasBand,\n isDatumDef,\n isFieldDef,\n ScaleDatumDef,\n ScaleFieldDef,\n TypedFieldDef,\n valueExpr,\n vgField\n} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {DateTime} from '../../datetime';\nimport * as log from '../../log';\nimport {Domain, hasDiscreteDomain, isDomainUnionWith, isSelectionDomain, ScaleConfig, ScaleType} from '../../scale';\nimport {SelectionExtent} from '../../selection';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortArray, isSortByEncoding, isSortField} from '../../sort';\nimport {normalizeTimeUnit, TimeUnit, TimeUnitParams} from '../../timeunit';\nimport {Type} from '../../type';\nimport * as util from '../../util';\nimport {\n isDataRefDomain,\n isDataRefUnionedDomain,\n isFieldRefUnionDomain,\n isSignalRef,\n VgDomain,\n VgMultiFieldsRefWithSort,\n VgNonUnionDomain,\n VgScaleDataRefWithSort,\n VgSortField,\n VgUnionSortField\n} from '../../vega.schema';\nimport {getBinSignalName} from '../data/bin';\nimport {sortArrayIndexField} from '../data/calculate';\nimport {FACET_SCALE_PREFIX} from '../data/optimize';\nimport {isFacetModel, isUnitModel, Model} from '../model';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, makeExplicit, makeImplicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponent, ScaleComponentIndex} from './component';\n\nexport function parseScaleDomain(model: Model) {\n if (isUnitModel(model)) {\n parseUnitScaleDomain(model);\n } else {\n parseNonUnitScaleDomain(model);\n }\n}\n\nfunction parseUnitScaleDomain(model: UnitModel) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const channel of util.keys(localScaleComponents)) {\n const domains = parseDomainForChannel(model, channel);\n const localScaleCmpt = localScaleComponents[channel];\n localScaleCmpt.setWithExplicit('domains', domains);\n parseSelectionDomain(model, channel);\n\n if (model.component.data.isFaceted) {\n // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not\n let facetParent: Model = model;\n while (!isFacetModel(facetParent) && facetParent.parent) {\n facetParent = facetParent.parent;\n }\n\n const resolve = facetParent.component.resolve.scale[channel];\n\n if (resolve === 'shared') {\n for (const domain of domains.value) {\n // Replace the scale domain with data output from a cloned subtree after the facet.\n if (isDataRefDomain(domain)) {\n // use data from cloned subtree (which is the same as data but with a prefix added once)\n domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, '');\n }\n }\n }\n }\n }\n}\n\nfunction parseNonUnitScaleDomain(model: Model) {\n for (const child of model.children) {\n parseScaleDomain(child);\n }\n\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const channel of util.keys(localScaleComponents)) {\n let domains: Explicit;\n let selectionExtent: SelectionExtent = null;\n\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n if (domains === undefined) {\n domains = childComponent.getWithExplicit('domains');\n } else {\n domains = mergeValuesWithExplicit(\n domains,\n childComponent.getWithExplicit('domains'),\n 'domains',\n 'scale',\n domainsTieBreaker\n );\n }\n\n const se = childComponent.get('selectionExtent');\n if (selectionExtent && se && selectionExtent.selection !== se.selection) {\n log.warn(log.message.NEEDS_SAME_SELECTION);\n }\n selectionExtent = se;\n }\n }\n\n localScaleComponents[channel].setWithExplicit('domains', domains);\n\n if (selectionExtent) {\n localScaleComponents[channel].set('selectionExtent', selectionExtent, true);\n }\n }\n}\n\n/**\n * Remove unaggregated domain if it is not applicable\n * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true.\n */\nfunction normalizeUnaggregatedDomain(\n domain: Domain,\n fieldDef: TypedFieldDef,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig\n) {\n if (domain === 'unaggregated') {\n const {valid, reason} = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (!valid) {\n log.warn(reason);\n return undefined;\n }\n } else if (domain === undefined && scaleConfig.useUnaggregatedDomain) {\n // Apply config if domain is not specified.\n const {valid} = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (valid) {\n return 'unaggregated';\n }\n }\n\n return domain;\n}\n\nexport function parseDomainForChannel(model: UnitModel, channel: ScaleChannel): Explicit {\n const scaleType = model.getScaleComponent(channel).get('type');\n const {encoding} = model;\n\n const domain = normalizeUnaggregatedDomain(\n model.scaleDomain(channel),\n model.typedFieldDef(channel),\n scaleType,\n model.config.scale\n );\n if (domain !== model.scaleDomain(channel)) {\n model.specifiedScales[channel] = {\n ...model.specifiedScales[channel],\n domain\n };\n }\n\n // If channel is either X or Y then union them with X2 & Y2 if they exist\n if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) {\n if (getFieldOrDatumDef(encoding.x)) {\n return mergeValuesWithExplicit(\n parseSingleChannelDomain(scaleType, domain, model, 'x'),\n parseSingleChannelDomain(scaleType, domain, model, 'x2'),\n 'domain',\n 'scale',\n domainsTieBreaker\n );\n } else {\n return parseSingleChannelDomain(scaleType, domain, model, 'x2');\n }\n } else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) {\n if (getFieldOrDatumDef(encoding.y)) {\n return mergeValuesWithExplicit(\n parseSingleChannelDomain(scaleType, domain, model, 'y'),\n parseSingleChannelDomain(scaleType, domain, model, 'y2'),\n 'domain',\n 'scale',\n domainsTieBreaker\n );\n } else {\n return parseSingleChannelDomain(scaleType, domain, model, 'y2');\n }\n }\n return parseSingleChannelDomain(scaleType, domain, model, channel);\n}\n\nfunction mapDomainToDataSignal(\n domain: (number | string | boolean | DateTime | SignalRef | number[])[],\n type: Type,\n timeUnit: TimeUnit\n) {\n return domain.map(v => {\n const data = valueExpr(v, {timeUnit, type});\n return {signal: `{data: ${data}}`};\n });\n}\n\nfunction convertDomainIfItIsDateTime(\n domain: (number | string | boolean | DateTime | SignalRef | number[])[],\n type: Type,\n timeUnit: TimeUnit | TimeUnitParams\n): [number[]] | [string[]] | [boolean[]] | SignalRef[] {\n // explicit value\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit)?.unit;\n if (type === 'temporal' || normalizedTimeUnit) {\n return mapDomainToDataSignal(domain, type, normalizedTimeUnit);\n }\n\n return [domain] as [number[]] | [string[]] | [boolean[]]; // Date time won't make sense\n}\n\nfunction parseSingleChannelDomain(\n scaleType: ScaleType,\n domain: Domain,\n model: UnitModel,\n channel: ScaleChannel | 'x2' | 'y2'\n): Explicit {\n const {encoding} = model;\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleDatumDef | ScaleFieldDef;\n\n const {type} = fieldOrDatumDef;\n const timeUnit = fieldOrDatumDef['timeUnit'];\n\n if (isDomainUnionWith(domain)) {\n const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel);\n\n const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit);\n\n return makeExplicit([...defaultDomain.value, ...unionWith]);\n } else if (isSignalRef(domain)) {\n return makeExplicit([domain]);\n } else if (domain && domain !== 'unaggregated' && !isSelectionDomain(domain)) {\n return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit));\n }\n\n const stack = model.stack;\n if (stack && channel === stack.fieldChannel) {\n if (stack.offset === 'normalize') {\n return makeImplicit([[0, 1]]);\n }\n\n const data = model.requestDataName(DataSourceType.Main);\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, {suffix: 'start'})\n },\n {\n data,\n field: model.vgField(channel, {suffix: 'end'})\n }\n ]);\n }\n\n const sort: undefined | true | VgSortField =\n isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined;\n\n if (isDatumDef(fieldOrDatumDef)) {\n const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit);\n return makeImplicit(d);\n }\n\n const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef\n if (domain === 'unaggregated') {\n const data = model.requestDataName(DataSourceType.Main);\n const {field} = fieldOrDatumDef;\n return makeImplicit([\n {\n data,\n field: vgField({field, aggregate: 'min'})\n },\n {\n data,\n field: vgField({field, aggregate: 'max'})\n }\n ]);\n } else if (isBinning(fieldDef.bin)) {\n if (hasDiscreteDomain(scaleType)) {\n if (scaleType === 'bin-ordinal') {\n // we can omit the domain as it is inferred from the `bins` property\n return makeImplicit([]);\n }\n\n // ordinal bin scale takes domain from bin_range, ordered by bin start\n // This is useful for both axis-based scale (x/y) and legend-based scale (other channels).\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n // Use range if we added it and the scale does not support computing a range as a signal.\n field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? {binSuffix: 'range'} : {}),\n // we have to use a sort object if sort = true to make the sort correct by bin start\n sort:\n sort === true || !isObject(sort)\n ? {\n field: model.vgField(channel, {}),\n op: 'min' // min or max doesn't matter since we sort by the start of the bin range\n }\n : sort\n }\n ]);\n } else {\n // continuous scales\n const {bin} = fieldDef;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return makeImplicit([\n new SignalRefWrapper(() => {\n const signal = model.getSignalName(binSignal);\n return `[${signal}.start, ${signal}.stop]`;\n })\n ]);\n } else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel, {})\n }\n ]);\n }\n }\n } else if (\n fieldDef.timeUnit &&\n util.contains(['time', 'utc'], scaleType) &&\n hasBand(\n channel,\n fieldDef,\n isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined,\n model.stack,\n model.markDef,\n model.config\n )\n ) {\n const data = model.requestDataName(DataSourceType.Main);\n return makeImplicit([\n {\n data,\n field: model.vgField(channel)\n },\n {\n data,\n field: model.vgField(channel, {suffix: 'end'})\n }\n ]);\n } else if (sort) {\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n field: model.vgField(channel),\n sort: sort\n }\n ]);\n } else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel)\n }\n ]);\n }\n}\n\nfunction normalizeSortField(sort: EncodingSortField, isStackedMeasure: boolean): VgSortField {\n const {op, field, order} = sort;\n return {\n // Apply default op\n op: op ?? (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP),\n // flatten nested fields\n ...(field ? {field: util.replacePathInField(field)} : {}),\n\n ...(order ? {order} : {})\n };\n}\n\nfunction parseSelectionDomain(model: UnitModel, channel: ScaleChannel) {\n const scale = model.component.scales[channel];\n const spec = model.specifiedScales[channel].domain;\n const bin = model.fieldDef(channel)?.bin;\n const domain = isSelectionDomain(spec) && spec;\n const extent = isBinParams(bin) && isSelectionExtent(bin.extent) && bin.extent;\n\n if (domain || extent) {\n // As scale parsing occurs before selection parsing, we cannot set\n // domainRaw directly. So instead, we store the selectionExtent on\n // the scale component, and then add domainRaw during scale assembly.\n scale.set('selectionExtent', domain ?? extent, true);\n }\n}\n\nexport function domainSort(\n model: UnitModel,\n channel: ScaleChannel,\n scaleType: ScaleType\n): undefined | true | VgSortField {\n if (!hasDiscreteDomain(scaleType)) {\n return undefined;\n }\n\n // save to cast as the only exception is the geojson type for shape, which would not generate a scale\n const fieldDef = model.fieldDef(channel) as ScaleFieldDef;\n const sort = fieldDef.sort;\n\n // if the sort is specified with array, use the derived sort index field\n if (isSortArray(sort)) {\n return {\n op: 'min',\n field: sortArrayIndexField(fieldDef, channel),\n order: 'ascending'\n };\n }\n\n const {stack} = model;\n const stackDimensions = stack\n ? [...(stack.groupbyField ? [stack.groupbyField] : []), ...stack.stackBy.map(s => s.fieldDef.field)]\n : undefined;\n\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (isSortField(sort)) {\n const isStackedMeasure = stack && !util.contains(stackDimensions, sort.field);\n return normalizeSortField(sort, isStackedMeasure);\n } else if (isSortByEncoding(sort)) {\n const {encoding, order} = sort;\n const fieldDefToSortBy = model.fieldDef(encoding);\n const {aggregate, field} = fieldDefToSortBy;\n\n const isStackedMeasure = stack && !util.contains(stackDimensions, field);\n\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n return normalizeSortField(\n {\n field: vgField(fieldDefToSortBy),\n order\n },\n isStackedMeasure\n );\n } else if (isAggregateOp(aggregate) || !aggregate) {\n return normalizeSortField(\n {\n op: aggregate as NonArgAggregateOp, // can't be argmin/argmax since we don't support them in encoding field def\n field,\n order\n },\n isStackedMeasure\n );\n }\n } else if (sort === 'descending') {\n return {\n op: 'min',\n field: model.vgField(channel),\n order: 'descending'\n };\n } else if (util.contains(['ascending', undefined /* default =ascending*/], sort)) {\n return true;\n }\n\n // sort == null\n return undefined;\n}\n\n/**\n * Determine if a scale can use unaggregated domain.\n * @return {Boolean} Returns true if all of the following conditions apply:\n * 1. `scale.domain` is `unaggregated`\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nexport function canUseUnaggregatedDomain(\n fieldDef: TypedFieldDef,\n scaleType: ScaleType\n): {valid: boolean; reason?: string} {\n const {aggregate, type} = fieldDef;\n\n if (!aggregate) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainHasNoEffectForRawField(fieldDef)\n };\n }\n\n if (isString(aggregate) && !SHARED_DOMAIN_OP_INDEX[aggregate]) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainWithNonSharedDomainOp(aggregate)\n };\n }\n\n if (type === 'quantitative') {\n if (scaleType === 'log') {\n return {\n valid: false,\n reason: log.message.unaggregatedDomainWithLogScale(fieldDef)\n };\n }\n }\n\n return {valid: true};\n}\n\n/**\n * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values.\n */\nfunction domainsTieBreaker(\n v1: Explicit,\n v2: Explicit,\n property: 'domains',\n propertyOf: 'scale'\n) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, concat the domains so that we union them later.\n return {explicit: v1.explicit, value: [...v1.value, ...v2.value]};\n}\n\n/**\n * Converts an array of domains to a single Vega scale domain.\n */\nexport function mergeDomains(domains: VgNonUnionDomain[]): VgDomain {\n const uniqueDomains = util.unique(\n domains.map(domain => {\n // ignore sort property when computing the unique domains\n if (isDataRefDomain(domain)) {\n const {sort: _s, ...domainWithoutSort} = domain;\n return domainWithoutSort;\n }\n return domain;\n }),\n util.hash\n );\n\n const sorts: VgSortField[] = util.unique(\n domains\n .map(d => {\n if (isDataRefDomain(d)) {\n const s = d.sort;\n if (s !== undefined && !util.isBoolean(s)) {\n if ('op' in s && s.op === 'count') {\n // let's make sure that if op is count, we don't use a field\n delete s.field;\n }\n if (s.order === 'ascending') {\n // drop order: ascending as it is the default\n delete s.order;\n }\n }\n return s;\n }\n return undefined;\n })\n .filter(s => s !== undefined),\n util.hash\n );\n\n if (uniqueDomains.length === 0) {\n return undefined;\n } else if (uniqueDomains.length === 1) {\n const domain = domains[0];\n if (isDataRefDomain(domain) && sorts.length > 0) {\n let sort = sorts[0];\n if (sorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n sort = true;\n } else {\n // Simplify domain sort by removing field and op when the field is the same as the domain field.\n if (isObject(sort) && 'field' in sort) {\n const sortField = sort.field;\n if (domain.field === sortField) {\n sort = sort.order ? {order: sort.order} : true;\n }\n }\n }\n return {\n ...domain,\n sort\n };\n }\n return domain;\n }\n\n // only keep sort properties that work with unioned domains\n const unionDomainSorts = util.unique(\n sorts.map(s => {\n if (util.isBoolean(s) || !('op' in s) || s.op in UNIONDOMAIN_SORT_OP_INDEX) {\n return s as VgUnionSortField;\n }\n log.warn(log.message.domainSortDropped(s));\n return true;\n }),\n util.hash\n ) as VgUnionSortField[];\n\n let sort: VgUnionSortField;\n\n if (unionDomainSorts.length === 1) {\n sort = unionDomainSorts[0];\n } else if (unionDomainSorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n sort = true;\n }\n\n const allData = util.unique(\n domains.map(d => {\n if (isDataRefDomain(d)) {\n return d.data;\n }\n return null;\n }),\n x => x\n );\n\n if (allData.length === 1 && allData[0] !== null) {\n // create a union domain of different fields with a single data source\n const domain: VgMultiFieldsRefWithSort = {\n data: allData[0],\n fields: uniqueDomains.map(d => (d as VgScaleDataRefWithSort).field),\n ...(sort ? {sort} : {})\n };\n\n return domain;\n }\n\n return {fields: uniqueDomains, ...(sort ? {sort} : {})};\n}\n\n/**\n * Return a field if a scale uses a single field.\n * Return `undefined` otherwise.\n */\nexport function getFieldFromDomain(domain: VgDomain): string {\n if (isDataRefDomain(domain) && isString(domain.field)) {\n return domain.field;\n } else if (isDataRefUnionedDomain(domain)) {\n let field;\n for (const nonUnionDomain of domain.fields) {\n if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) {\n if (!field) {\n field = nonUnionDomain.field;\n } else if (field !== nonUnionDomain.field) {\n log.warn(log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES);\n return field;\n }\n }\n }\n log.warn(log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES);\n return field;\n } else if (isFieldRefUnionDomain(domain)) {\n log.warn(log.message.FACETED_INDEPENDENT_SAME_SOURCE);\n const field = domain.fields[0];\n return isString(field) ? field : undefined;\n }\n\n return undefined;\n}\n\nexport function assembleDomain(model: Model, channel: ScaleChannel) {\n const scaleComponent: ScaleComponent = model.component.scales[channel];\n\n const domains = scaleComponent.get('domains').map((domain: VgNonUnionDomain) => {\n // Correct references to data as the original domain's data was determined\n // in parseScale, which happens before parseData. Thus the original data\n // reference can be incorrect.\n if (isDataRefDomain(domain)) {\n domain.data = model.lookupDataSource(domain.data);\n }\n\n return domain;\n });\n\n // domains is an array that has to be merged into a single vega domain\n return mergeDomains(domains);\n}\n","import {isObject} from 'vega-util';\nimport {isXorY, ScaleChannel} from '../../channel';\nimport {keys} from '../../util';\nimport {isDataRefDomain, isVgRangeStep, VgRange, VgScale} from '../../vega.schema';\nimport {isConcatModel, isLayerModel, Model} from '../model';\nimport {assembleSelectionScaleDomain} from '../selection/assemble';\nimport {assembleDomain} from './domain';\n\nexport function assembleScales(model: Model): VgScale[] {\n if (isLayerModel(model) || isConcatModel(model)) {\n // For concat and layer, include scales of children too\n return model.children.reduce((scales, child) => {\n return scales.concat(assembleScales(child));\n }, assembleScalesForModel(model));\n } else {\n // For facet, child scales would not be included in the parent's scope.\n // For unit, there is no child.\n return assembleScalesForModel(model);\n }\n}\n\nexport function assembleScalesForModel(model: Model): VgScale[] {\n return keys(model.component.scales).reduce((scales: VgScale[], channel: ScaleChannel) => {\n const scaleComponent = model.component.scales[channel];\n if (scaleComponent.merged) {\n // Skipped merged scales\n return scales;\n }\n\n const scale = scaleComponent.combine();\n const {name, type, selectionExtent, domains: _d, range: _r, reverse, ...otherScaleProps} = scale;\n const range = assembleScaleRange(scale.range, name, channel, model);\n\n let domainRaw;\n if (selectionExtent) {\n domainRaw = assembleSelectionScaleDomain(model, selectionExtent);\n }\n\n const domain = assembleDomain(model, channel);\n\n scales.push({\n name,\n type,\n ...(domain ? {domain} : {}),\n ...(domainRaw ? {domainRaw} : {}),\n range,\n ...(reverse !== undefined ? {reverse: reverse as any} : {}),\n ...otherScaleProps\n });\n\n return scales;\n }, [] as VgScale[]);\n}\n\nexport function assembleScaleRange(\n scaleRange: VgRange,\n scaleName: string,\n channel: ScaleChannel,\n model?: Model\n): VgRange {\n // add signals to x/y range\n if (isXorY(channel)) {\n if (isVgRangeStep(scaleRange)) {\n // For width/height step, use a signal created in layout assemble instead of a constant step.\n return {\n step: {signal: scaleName + '_step'}\n };\n }\n } else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) {\n return {\n ...scaleRange,\n data: model.lookupDataSource(scaleRange.data)\n };\n }\n return scaleRange;\n}\n","import {SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {ScaleChannel} from '../../channel';\nimport {Scale, ScaleType} from '../../scale';\nimport {SelectionExtent} from '../../selection';\nimport {some} from '../../util';\nimport {VgNonUnionDomain, VgScale} from '../../vega.schema';\nimport {Explicit, Split} from '../split';\n\n/**\n * All VgDomain property except domain.\n * (We exclude domain as we have a special \"domains\" array that allow us merge them all at once in assemble.)\n */\nexport type ScaleComponentProps = Omit & {\n domains: VgNonUnionDomain[];\n selectionExtent?: SelectionExtent;\n reverse?: boolean | SignalRef; // Need override since Vega doesn't official support scale reverse yet (though it does in practice)\n};\n\nexport type Range = ScaleComponentProps['range'];\n\nexport class ScaleComponent extends Split {\n public merged = false;\n\n constructor(name: string, typeWithExplicit: Explicit) {\n super(\n {}, // no initial explicit property\n {name} // name as initial implicit property\n );\n this.setWithExplicit('type', typeWithExplicit);\n }\n\n /**\n * Whether the scale definitely includes zero in the domain\n */\n public domainDefinitelyIncludesZero() {\n if (this.get('zero') !== false) {\n return true;\n }\n return some(this.get('domains'), d => isArray(d) && d.length === 2 && d[0] <= 0 && d[1] >= 0);\n }\n}\n\nexport type ScaleComponentIndex = Partial>;\n\nexport type ScaleIndex = Partial>;\n","import {RangeScheme, SignalRef} from 'vega';\nimport {isArray, isNumber, isObject} from 'vega-util';\nimport {isBinning} from '../../bin';\nimport {\n ANGLE,\n COLOR,\n FILL,\n FILLOPACITY,\n isXorY,\n OPACITY,\n RADIUS,\n ScaleChannel,\n SCALE_CHANNELS,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n THETA,\n X,\n Y\n} from '../../channel';\nimport {getFieldOrDatumDef, ScaleDatumDef, ScaleFieldDef} from '../../channeldef';\nimport {Config, getViewConfigDiscreteSize, getViewConfigDiscreteStep, ViewConfig} from '../../config';\nimport {DataSourceType} from '../../data';\nimport * as log from '../../log';\nimport {Mark} from '../../mark';\nimport {\n channelScalePropertyIncompatability,\n Domain,\n hasContinuousDomain,\n hasDiscreteDomain,\n isContinuousToDiscrete,\n isExtendedScheme,\n Scale,\n scaleTypeSupportProperty,\n Scheme\n} from '../../scale';\nimport {isStep, LayoutSizeMixins} from '../../spec/base';\nimport * as util from '../../util';\nimport {isSignalRef, VgRange} from '../../vega.schema';\nimport {signalOrStringValue} from '../common';\nimport {getBinSignalName} from '../data/bin';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, makeExplicit, makeImplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponentIndex} from './component';\n\nexport const RANGE_PROPERTIES: (keyof Scale)[] = ['range', 'scheme'];\n\nfunction getSizeChannel(channel: ScaleChannel) {\n return channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;\n}\n\nexport function parseUnitScaleRange(model: UnitModel) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first!\n for (const channel of SCALE_CHANNELS) {\n const localScaleCmpt = localScaleComponents[channel];\n if (!localScaleCmpt) {\n continue;\n }\n\n const rangeWithExplicit = parseRangeForChannel(channel, model);\n\n localScaleCmpt.setWithExplicit('range', rangeWithExplicit);\n }\n}\n\nfunction getBinStepSignal(model: UnitModel, channel: 'x' | 'y'): SignalRefWrapper {\n const fieldDef = model.fieldDef(channel);\n\n if (fieldDef && fieldDef.bin && isBinning(fieldDef.bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, fieldDef.bin);\n\n // TODO: extract this to be range step signal\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n return new SignalRefWrapper(() => {\n const updatedName = model.getSignalName(binSignal);\n const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n }\n return undefined;\n}\n\n/**\n * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme).\n */\nexport function parseRangeForChannel(channel: ScaleChannel, model: UnitModel): Explicit {\n const specifiedScale = model.specifiedScales[channel];\n const {size} = model;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n\n // Check if any of the range properties is specified.\n // If so, check if it is compatible and make sure that we only output one of the properties\n for (const property of RANGE_PROPERTIES) {\n if (specifiedScale[property] !== undefined) {\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n } else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n } else {\n switch (property) {\n case 'range': {\n const range = specifiedScale.range;\n if (isArray(range)) {\n if (isXorY(channel)) {\n return makeExplicit(\n range.map(v => {\n if (v === 'width' || v === 'height') {\n // get signal for width/height\n\n // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames.\n\n const sizeSignal = model.getName(v);\n const getSignalName = model.getSignalName.bind(model);\n return SignalRefWrapper.fromName(getSignalName, sizeSignal);\n }\n return v;\n })\n );\n }\n } else if (isObject(range)) {\n return makeExplicit({\n data: model.requestDataName(DataSourceType.Main),\n field: range.field,\n sort: {op: 'min', field: model.vgField(channel)}\n });\n }\n\n return makeExplicit(range);\n }\n case 'scheme':\n return makeExplicit(parseScheme(specifiedScale[property]));\n }\n }\n }\n }\n\n if (channel === X || channel === Y) {\n const sizeChannel = channel === X ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (isStep(sizeValue)) {\n if (hasDiscreteDomain(scaleType)) {\n return makeExplicit({step: sizeValue.step});\n } else {\n log.warn(log.message.stepDropped(sizeChannel));\n }\n }\n }\n\n const {rangeMin, rangeMax} = specifiedScale;\n const d = defaultRange(channel, model);\n\n if (\n (rangeMin !== undefined || rangeMax !== undefined) &&\n // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same\n scaleTypeSupportProperty(scaleType, 'rangeMin') &&\n isArray(d) &&\n d.length === 2\n ) {\n return makeExplicit([rangeMin ?? d[0], rangeMax ?? d[1]]);\n }\n\n return makeImplicit(d);\n}\n\nfunction parseScheme(scheme: Scheme | SignalRef): RangeScheme {\n if (isExtendedScheme(scheme)) {\n return {\n scheme: scheme.name,\n ...util.omit(scheme, ['name'])\n };\n }\n return {scheme: scheme};\n}\n\nfunction defaultRange(channel: ScaleChannel, model: UnitModel): VgRange {\n const {size, config, mark, encoding} = model;\n\n const getSignalName = model.getSignalName.bind(model);\n\n const {type} = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n\n const {domain, domainMid} = model.specifiedScales[channel];\n\n switch (channel) {\n case X:\n case Y: {\n // If there is no explicit width/height for discrete x/y scales\n if (util.contains(['point', 'band'], scaleType)) {\n if (channel === X && !size.width) {\n const w = getViewConfigDiscreteSize(config.view, 'width');\n if (isStep(w)) {\n return w;\n }\n } else if (channel === Y && !size.height) {\n const h = getViewConfigDiscreteSize(config.view, 'height');\n if (isStep(h)) {\n return h;\n }\n }\n }\n\n // If step is null, use zero to width or height.\n // Note that we use SignalRefWrapper to account for potential merges and renames.\n\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n\n if (channel === Y && hasContinuousDomain(scaleType)) {\n // For y continuous scale, we have to start from the height as the bottom part has the max value.\n return [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0];\n } else {\n return [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)];\n }\n }\n\n case SIZE: {\n // TODO: support custom rangeMin, rangeMax\n const zero = model.component.scales[channel].get('zero');\n const rangeMin = sizeRangeMin(mark, zero, config);\n const rangeMax = sizeRangeMax(mark, size, model, config);\n if (isContinuousToDiscrete(scaleType)) {\n return interpolateRange(\n rangeMin,\n rangeMax,\n defaultContinuousToDiscreteCount(scaleType, config, domain, channel)\n );\n } else {\n return [rangeMin, rangeMax];\n }\n }\n\n case THETA:\n return [0, Math.PI * 2];\n\n case ANGLE:\n // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks.\n // (It's weird to add just config.scale.min/maxAngleDegree for now)\n return [0, 360];\n\n case RADIUS: {\n // max radius = half od min(width,height)\n return [\n 0,\n new SignalRefWrapper(() => {\n const w = model.getSignalName('width');\n const h = model.getSignalName('height');\n return `min(${w},${h})/2`;\n })\n ];\n }\n\n case STROKEWIDTH:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth];\n case STROKEDASH:\n return [\n // TODO: add this to Vega's config.range?\n [1, 0],\n [4, 2],\n [2, 1],\n [1, 1],\n [1, 2, 4, 2]\n ];\n case SHAPE:\n return 'symbol';\n case COLOR:\n case FILL:\n case STROKE:\n if (scaleType === 'ordinal') {\n // Only nominal data uses ordinal scale by default\n return type === 'nominal' ? 'category' : 'ordinal';\n } else {\n if (domainMid !== undefined) {\n return 'diverging';\n } else {\n return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp';\n }\n }\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minOpacity, config.scale.maxOpacity];\n }\n /* istanbul ignore next: should never reach here */\n throw new Error(`Scale range undefined for channel ${channel}`);\n}\n\nexport function defaultContinuousToDiscreteCount(\n scaleType: 'quantile' | 'quantize' | 'threshold',\n config: Config,\n domain: Domain,\n channel: ScaleChannel\n) {\n switch (scaleType) {\n case 'quantile':\n return config.scale.quantileCount;\n case 'quantize':\n return config.scale.quantizeCount;\n case 'threshold':\n if (domain !== undefined && isArray(domain)) {\n return domain.length + 1;\n } else {\n log.warn(log.message.domainRequiredForThresholdScale(channel));\n // default threshold boundaries for threshold scale since domain has cardinality of 2\n return 3;\n }\n }\n}\n\n/**\n * Returns the linear interpolation of the range according to the cardinality\n *\n * @param rangeMin start of the range\n * @param rangeMax end of the range\n * @param cardinality number of values in the output range\n */\nexport function interpolateRange(\n rangeMin: number | SignalRef,\n rangeMax: number | SignalRef,\n cardinality: number\n): SignalRef {\n // always return a signal since it's better to compute the sequence in Vega later\n const f = () => {\n const rMax = signalOrStringValue(rangeMax);\n const rMin = signalOrStringValue(rangeMin);\n const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`;\n return `sequence(${rMin}, ${rMax} + ${step}, ${step})`;\n };\n if (isSignalRef(rangeMax)) {\n return new SignalRefWrapper(f);\n } else {\n return {signal: f()};\n }\n}\n\nfunction sizeRangeMin(mark: Mark, zero: boolean | SignalRef, config: Config): number | SignalRef {\n if (zero) {\n if (isSignalRef(zero)) {\n return {signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}`};\n } else {\n return 0;\n }\n }\n switch (mark) {\n case 'bar':\n case 'tick':\n return config.scale.minBandSize;\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.minStrokeWidth;\n case 'text':\n return config.scale.minFontSize;\n case 'point':\n case 'square':\n case 'circle':\n return config.scale.minSize;\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMin not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n\nexport const MAX_SIZE_RANGE_STEP_RATIO = 0.95;\n\nfunction sizeRangeMax(mark: Mark, size: LayoutSizeMixins, model: UnitModel, config: Config): number | SignalRef {\n const xyStepSignals = {\n x: getBinStepSignal(model, 'x'),\n y: getBinStepSignal(model, 'y')\n };\n\n switch (mark) {\n case 'bar':\n case 'tick': {\n if (config.scale.maxBandSize !== undefined) {\n return config.scale.maxBandSize;\n }\n const min = minXYStep(size, xyStepSignals, config.view);\n\n if (isNumber(min)) {\n return min - 1;\n } else {\n return new SignalRefWrapper(() => `${min.signal} - 1`);\n }\n }\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.maxStrokeWidth;\n case 'text':\n return config.scale.maxFontSize;\n case 'point':\n case 'square':\n case 'circle': {\n if (config.scale.maxSize) {\n return config.scale.maxSize;\n }\n\n const pointStep = minXYStep(size, xyStepSignals, config.view);\n if (isNumber(pointStep)) {\n return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2);\n } else {\n return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`);\n }\n }\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMax not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n\n/**\n * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale.\n */\nfunction minXYStep(\n size: LayoutSizeMixins,\n xyStepSignals: {x?: SignalRefWrapper; y?: SignalRefWrapper},\n viewConfig: ViewConfig\n): number | SignalRef {\n const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width');\n const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height');\n\n if (xyStepSignals.x || xyStepSignals.y) {\n return new SignalRefWrapper(() => {\n const exprs = [\n xyStepSignals.x ? xyStepSignals.x.signal : widthStep,\n xyStepSignals.y ? xyStepSignals.y.signal : heightStep\n ];\n return `min(${exprs.join(', ')})`;\n });\n }\n\n return Math.min(widthStep, heightStep);\n}\n","import {SignalRef, TimeInterval} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinned, isBinning, isBinParams} from '../../bin';\nimport {\n COLOR,\n FILL,\n POLAR_POSITION_SCALE_CHANNELS,\n POSITION_SCALE_CHANNELS,\n POSITION_SCALE_CHANNEL_INDEX,\n ScaleChannel,\n STROKE\n} from '../../channel';\nimport {\n getFieldDef,\n getFieldOrDatumDef,\n isFieldDef,\n ScaleDatumDef,\n ScaleFieldDef,\n TypedFieldDef,\n valueExpr\n} from '../../channeldef';\nimport {Config} from '../../config';\nimport {isDateTime} from '../../datetime';\nimport * as log from '../../log';\nimport {Mark, MarkDef, RectConfig} from '../../mark';\nimport {\n channelScalePropertyIncompatability,\n Domain,\n hasContinuousDomain,\n isContinuousToContinuous,\n isContinuousToDiscrete,\n Scale,\n ScaleConfig,\n ScaleType,\n scaleTypeSupportProperty\n} from '../../scale';\nimport {Sort} from '../../sort';\nimport {Type} from '../../type';\nimport * as util from '../../util';\nimport {contains, getFirstDefined, keys} from '../../util';\nimport {isSignalRef, VgScale} from '../../vega.schema';\nimport {getBinSignalName} from '../data/bin';\nimport {isUnitModel, Model} from '../model';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponentIndex, ScaleComponentProps} from './component';\nimport {parseUnitScaleRange} from './range';\n\nexport function parseScaleProperty(model: Model, property: Exclude) {\n if (isUnitModel(model)) {\n parseUnitScaleProperty(model, property);\n } else {\n parseNonUnitScaleProperty(model, property);\n }\n}\n\nfunction parseUnitScaleProperty(model: UnitModel, property: Exclude) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n const {config, encoding, markDef, specifiedScales} = model;\n\n for (const channel of keys(localScaleComponents)) {\n const specifiedScale = specifiedScales[channel];\n const localScaleCmpt = localScaleComponents[channel];\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef;\n\n const specifiedValue = specifiedScale[property];\n const scaleType = mergedScaleCmpt.get('type');\n const scalePadding = mergedScaleCmpt.get('padding');\n const scalePaddingInner = mergedScaleCmpt.get('paddingInner');\n\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n\n if (specifiedValue !== undefined) {\n // If there is a specified value, check if it is compatible with scale type and channel\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n } else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n }\n }\n if (supportedByScaleType && channelIncompatability === undefined) {\n if (specifiedValue !== undefined) {\n const timeUnit = fieldOrDatumDef['timeUnit'];\n const type = fieldOrDatumDef.type;\n\n switch (property) {\n // domainMax/Min to signal if the value is a datetime object\n case 'domainMax':\n case 'domainMin':\n if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) {\n localScaleCmpt.set(property, {signal: valueExpr(specifiedScale[property], {type, timeUnit})}, true);\n } else {\n localScaleCmpt.set(property, specifiedScale[property] as any, true);\n }\n break;\n default:\n localScaleCmpt.copyKeyFromObject>(\n property,\n specifiedScale\n );\n }\n } else {\n const value =\n property in scaleRules\n ? scaleRules[property]({\n model,\n channel,\n fieldOrDatumDef,\n scaleType,\n scalePadding,\n scalePaddingInner,\n domain: specifiedScale.domain,\n markDef,\n config\n })\n : config.scale[property];\n if (value !== undefined) {\n localScaleCmpt.set(property, value, false);\n }\n }\n }\n }\n}\n\nexport interface ScaleRuleParams {\n model: Model;\n channel: ScaleChannel;\n fieldOrDatumDef: ScaleFieldDef | ScaleDatumDef;\n scaleType: ScaleType;\n scalePadding: number | SignalRef;\n scalePaddingInner: number | SignalRef;\n domain: Scale['domain'];\n markDef: MarkDef;\n config: Config;\n}\n\nexport const scaleRules: {\n [k in keyof Scale]?: (params: ScaleRuleParams) => Scale[k];\n} = {\n bins: ({model, fieldOrDatumDef}) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined),\n\n interpolate: ({channel, fieldOrDatumDef}) => interpolate(channel, fieldOrDatumDef.type),\n\n nice: ({scaleType, channel, fieldOrDatumDef}) => nice(scaleType, channel, fieldOrDatumDef),\n\n padding: ({channel, scaleType, fieldOrDatumDef, markDef, config}) =>\n padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar),\n\n paddingInner: ({scalePadding, channel, markDef, config}) =>\n paddingInner(scalePadding, channel, markDef.type, config.scale),\n\n paddingOuter: ({scalePadding, channel, scaleType, markDef, scalePaddingInner, config}) =>\n paddingOuter(scalePadding, channel, scaleType, markDef.type, scalePaddingInner, config.scale),\n\n reverse: ({fieldOrDatumDef, scaleType, channel, config}) => {\n const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined;\n return reverse(scaleType, sort, channel, config.scale);\n },\n zero: ({channel, fieldOrDatumDef, domain, markDef, scaleType}) =>\n zero(channel, fieldOrDatumDef, domain, markDef, scaleType)\n};\n\n// This method is here rather than in range.ts to avoid circular dependency.\nexport function parseScaleRange(model: Model) {\n if (isUnitModel(model)) {\n parseUnitScaleRange(model);\n } else {\n parseNonUnitScaleProperty(model, 'range');\n }\n}\n\nexport function parseNonUnitScaleProperty(model: Model, property: keyof (Scale | ScaleComponentProps)) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const child of model.children) {\n if (property === 'range') {\n parseScaleRange(child);\n } else {\n parseScaleProperty(child, property);\n }\n }\n\n for (const channel of keys(localScaleComponents)) {\n let valueWithExplicit: Explicit;\n\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n const childValueWithExplicit = childComponent.getWithExplicit(property);\n valueWithExplicit = mergeValuesWithExplicit(\n valueWithExplicit,\n childValueWithExplicit,\n property,\n 'scale',\n tieBreakByComparing((v1, v2) => {\n switch (property) {\n case 'range':\n // For step, prefer larger step\n if (v1.step && v2.step) {\n return v1.step - v2.step;\n }\n return 0;\n // TODO: precedence rule for other properties\n }\n return 0;\n })\n );\n }\n }\n localScaleComponents[channel].setWithExplicit(property, valueWithExplicit);\n }\n}\n\nexport function bins(model: Model, fieldDef: TypedFieldDef) {\n const bin = fieldDef.bin;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return new SignalRefWrapper(() => {\n return model.getSignalName(binSignal);\n });\n } else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) {\n // start and stop will be determined from the scale domain\n return {\n step: bin.step\n };\n }\n return undefined;\n}\n\nexport function interpolate(channel: ScaleChannel, type: Type): Scale['interpolate'] {\n if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') {\n return 'hcl';\n }\n return undefined;\n}\n\nexport function nice(\n scaleType: ScaleType,\n channel: ScaleChannel,\n fieldOrDatumDef: TypedFieldDef | ScaleDatumDef\n): boolean | TimeInterval {\n if (getFieldDef(fieldOrDatumDef)?.bin || util.contains([ScaleType.TIME, ScaleType.UTC], scaleType)) {\n return undefined;\n }\n return channel in POSITION_SCALE_CHANNEL_INDEX ? true : undefined;\n}\n\nexport function padding(\n channel: ScaleChannel,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig,\n fieldOrDatumDef: TypedFieldDef | ScaleDatumDef,\n markDef: MarkDef,\n barConfig: RectConfig\n) {\n if (channel in POSITION_SCALE_CHANNEL_INDEX) {\n if (isContinuousToContinuous(scaleType)) {\n if (scaleConfig.continuousPadding !== undefined) {\n return scaleConfig.continuousPadding;\n }\n\n const {type, orient} = markDef;\n if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) {\n if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) {\n return barConfig.continuousBandSize;\n }\n }\n }\n\n if (scaleType === ScaleType.POINT) {\n return scaleConfig.pointPadding;\n }\n }\n return undefined;\n}\n\nexport function paddingInner(\n paddingValue: number | SignalRef,\n channel: ScaleChannel,\n mark: Mark,\n scaleConfig: ScaleConfig\n) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingInner.\n return undefined;\n }\n\n if (channel in POSITION_SCALE_CHANNEL_INDEX) {\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n\n // paddingOuter would only be called if it's a band scale, just return the default for bandScale.\n\n const {bandPaddingInner, barBandPaddingInner, rectBandPaddingInner} = scaleConfig;\n\n return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner);\n }\n return undefined;\n}\n\nexport function paddingOuter(\n paddingValue: number | SignalRef,\n channel: ScaleChannel,\n scaleType: ScaleType,\n mark: Mark,\n paddingInnerValue: number | SignalRef,\n scaleConfig: ScaleConfig\n) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingOuter.\n return undefined;\n }\n\n if (channel in POSITION_SCALE_CHANNEL_INDEX) {\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n if (scaleType === ScaleType.BAND) {\n const {bandPaddingOuter} = scaleConfig;\n\n return getFirstDefined(\n bandPaddingOuter,\n /* By default, paddingOuter is paddingInner / 2. The reason is that\n size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter).\n and we want the width/height to be integer by default.\n Note that step (by default) and cardinality are integers.) */\n isSignalRef(paddingInnerValue) ? {signal: `${paddingInnerValue.signal}/2`} : paddingInnerValue / 2\n );\n }\n }\n return undefined;\n}\n\nexport function reverse(scaleType: ScaleType, sort: Sort, channel: ScaleChannel, scaleConfig: ScaleConfig) {\n if (channel === 'x' && scaleConfig.xReverse !== undefined) {\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n if (isSignalRef(scaleConfig.xReverse)) {\n return {signal: `!${scaleConfig.xReverse.signal}`};\n } else {\n return !scaleConfig.xReverse;\n }\n }\n return scaleConfig.xReverse;\n }\n\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n // For continuous domain scales, Vega does not support domain sort.\n // Thus, we reverse range instead if sort is descending\n return true;\n }\n return undefined;\n}\n\nexport function zero(\n channel: ScaleChannel,\n fieldDef: TypedFieldDef | ScaleDatumDef,\n specifiedDomain: Domain,\n markDef: MarkDef,\n scaleType: ScaleType\n) {\n // If users explicitly provide a domain range, we should not augment zero as that will be unexpected.\n const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated';\n if (hasCustomDomain) {\n if (hasContinuousDomain(scaleType)) {\n if (isArray(specifiedDomain)) {\n const first = specifiedDomain[0];\n const last = specifiedDomain[specifiedDomain.length - 1];\n\n if (first <= 0 && last >= 0) {\n // if the domain includes zero, make zero remains true\n return true;\n }\n }\n return false;\n }\n }\n\n // If there is no custom domain, return true only for the following cases:\n\n // 1) using quantitative field with size\n // While this can be either ratio or interval fields, our assumption is that\n // ratio are more common. However, if the scaleType is discretizing scale, we want to return\n // false so that range doesn't start at zero\n if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) {\n return true;\n }\n\n // 2) non-binned, quantitative x-scale or y-scale\n // (For binning, we should not include zero by default because binning are calculated without zero.)\n if (\n !(isFieldDef(fieldDef) && fieldDef.bin) &&\n util.contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)\n ) {\n const {orient, type} = markDef;\n if (contains(['bar', 'area', 'line', 'trail'], type)) {\n if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) {\n return false;\n }\n }\n\n return true;\n }\n return false;\n}\n","import {isBinning} from '../../bin';\nimport {Channel, isColorChannel, isScaleChannel, rangeType} from '../../channel';\nimport {DatumDef, isFieldDef, isPositionFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef';\nimport * as log from '../../log';\nimport {Mark} from '../../mark';\nimport {channelSupportScaleType, Scale, ScaleType, scaleTypeSupportDataType} from '../../scale';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport * as util from '../../util';\nimport {POLAR_POSITION_SCALE_CHANNEL_INDEX, POSITION_SCALE_CHANNEL_INDEX} from './../../channel';\n\nexport type RangeType = 'continuous' | 'discrete' | 'flexible' | undefined;\n\n/**\n * Determine if there is a specified scale type and if it is appropriate,\n * or determine default type if type is unspecified or inappropriate.\n */\n// NOTE: CompassQL uses this method.\nexport function scaleType(\n specifiedScale: Scale,\n channel: Channel,\n fieldDef: TypedFieldDef | DatumDef,\n mark: Mark\n): ScaleType {\n const defaultScaleType = defaultType(channel, fieldDef, mark);\n const {type} = specifiedScale;\n\n if (!isScaleChannel(channel)) {\n // There is no scale for these channels\n return null;\n }\n if (type !== undefined) {\n // Check if explicitly specified scale type is supported by the channel\n if (!channelSupportScaleType(channel, type)) {\n log.warn(log.message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType));\n return defaultScaleType;\n }\n\n // Check if explicitly specified scale type is supported by the data type\n if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) {\n log.warn(log.message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType));\n return defaultScaleType;\n }\n\n return type;\n }\n\n return defaultScaleType;\n}\n\n/**\n * Determine appropriate default scale type.\n */\n// NOTE: Voyager uses this method.\nfunction defaultType(channel: Channel, fieldDef: TypedFieldDef | ScaleDatumDef, mark: Mark): ScaleType {\n switch (fieldDef.type) {\n case 'nominal':\n case 'ordinal':\n if (isColorChannel(channel) || rangeType(channel) === 'discrete') {\n if (channel === 'shape' && fieldDef.type === 'ordinal') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal'));\n }\n return 'ordinal';\n }\n\n if (channel in POSITION_SCALE_CHANNEL_INDEX) {\n if (util.contains(['rect', 'bar', 'image', 'rule'], mark)) {\n // The rect/bar mark should fit into a band.\n // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429\n return 'band';\n }\n } else if (mark === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) {\n return 'band';\n }\n\n if (fieldDef.band !== undefined || (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand)) {\n return 'band';\n }\n // Otherwise, use ordinal point scale so we can easily get center positions of the marks.\n return 'point';\n\n case 'temporal':\n if (isColorChannel(channel)) {\n return 'time';\n } else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'temporal'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n } else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) {\n return 'utc';\n }\n return 'time';\n\n case 'quantitative':\n if (isColorChannel(channel)) {\n if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n return 'bin-ordinal';\n }\n\n return 'linear';\n } else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'quantitative'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n }\n\n return 'linear';\n\n case 'geojson':\n return undefined;\n }\n\n /* istanbul ignore next: should never reach this */\n throw new Error(log.message.invalidFieldType(fieldDef.type));\n}\n","import {ScaleChannel, SCALE_CHANNELS, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef';\nimport {GEOSHAPE} from '../../mark';\nimport {\n NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES,\n scaleCompatible,\n ScaleType,\n scaleTypePrecedence\n} from '../../scale';\nimport {GEOJSON} from '../../type';\nimport {keys} from '../../util';\nimport {VgScale} from '../../vega.schema';\nimport {isUnitModel, Model} from '../model';\nimport {defaultScaleResolve} from '../resolve';\nimport {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponent, ScaleComponentIndex} from './component';\nimport {parseScaleDomain} from './domain';\nimport {parseScaleProperty, parseScaleRange} from './properties';\nimport {scaleType} from './type';\n\nexport function parseScales(model: Model, {ignoreRange}: {ignoreRange?: boolean} = {}) {\n parseScaleCore(model);\n parseScaleDomain(model);\n for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) {\n parseScaleProperty(model, prop);\n }\n if (!ignoreRange) {\n // range depends on zero\n parseScaleRange(model);\n }\n}\n\nexport function parseScaleCore(model: Model) {\n if (isUnitModel(model)) {\n model.component.scales = parseUnitScaleCore(model);\n } else {\n model.component.scales = parseNonUnitScaleCore(model);\n }\n}\n\n/**\n * Parse scales for all channels of a model.\n */\nfunction parseUnitScaleCore(model: UnitModel): ScaleComponentIndex {\n const {encoding, mark} = model;\n\n return SCALE_CHANNELS.reduce((scaleComponents: ScaleComponentIndex, channel: ScaleChannel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as TypedFieldDef | ScaleDatumDef; // must be typed def to have scale\n\n // Don't generate scale for shape of geoshape\n if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) {\n return scaleComponents;\n }\n let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale'];\n\n if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) {\n specifiedScale = specifiedScale ?? {};\n\n const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, mark);\n scaleComponents[channel] = new ScaleComponent(model.scaleName(channel + '', true), {\n value: sType,\n explicit: specifiedScale.type === sType\n });\n }\n\n return scaleComponents;\n }, {});\n}\n\nconst scaleTypeTieBreaker = tieBreakByComparing(\n (st1: ScaleType, st2: ScaleType) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2)\n);\n\nfunction parseNonUnitScaleCore(model: Model) {\n const scaleComponents: ScaleComponentIndex = (model.component.scales = {});\n\n const scaleTypeWithExplicitIndex: Partial>> = {};\n const resolve = model.component.resolve;\n\n // Parse each child scale and determine if a particular channel can be merged.\n for (const child of model.children) {\n parseScaleCore(child);\n\n // Instead of always merging right away -- check if it is compatible to merge first!\n for (const channel of keys(child.component.scales)) {\n // if resolve is undefined, set default first\n resolve.scale[channel] = resolve.scale[channel] ?? defaultScaleResolve(channel, model);\n\n if (resolve.scale[channel] === 'shared') {\n const explicitScaleType = scaleTypeWithExplicitIndex[channel];\n const childScaleType = child.component.scales[channel].getWithExplicit('type');\n\n if (explicitScaleType) {\n if (scaleCompatible(explicitScaleType.value, childScaleType.value)) {\n // merge scale component if type are compatible\n scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(\n explicitScaleType,\n childScaleType,\n 'type',\n 'scale',\n scaleTypeTieBreaker\n );\n } else {\n // Otherwise, update conflicting channel to be independent\n resolve.scale[channel] = 'independent';\n // Remove from the index so they don't get merged\n delete scaleTypeWithExplicitIndex[channel];\n }\n } else {\n scaleTypeWithExplicitIndex[channel] = childScaleType;\n }\n }\n }\n }\n\n // Merge each channel listed in the index\n for (const channel of keys(scaleTypeWithExplicitIndex)) {\n // Create new merged scale component\n const name = model.scaleName(channel, true);\n const typeWithExplicit = scaleTypeWithExplicitIndex[channel];\n scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit);\n\n // rename each child and mark them as merged\n for (const child of model.children) {\n const childScale = child.component.scales[channel];\n if (childScale) {\n child.renameScale(childScale.get('name'), name);\n childScale.merged = true;\n }\n }\n }\n\n return scaleComponents;\n}\n","import {\n AnchorValue,\n Axis as VgAxis,\n Legend as VgLegend,\n NewSignal,\n Projection as VgProjection,\n SignalRef,\n Title as VgTitle\n} from 'vega';\nimport {\n Channel,\n FACET_CHANNELS,\n getPositionScaleChannel,\n isChannel,\n isScaleChannel,\n ScaleChannel,\n SingleDefChannel,\n ExtendedChannel\n} from '../channel';\nimport {ChannelDef, FieldDef, FieldRefOption, getFieldDef, vgField} from '../channeldef';\nimport {Config} from '../config';\nimport {Data, DataSourceType} from '../data';\nimport {forEach, reduce} from '../encoding';\nimport * as log from '../log';\nimport {Resolve} from '../resolve';\nimport {hasDiscreteDomain} from '../scale';\nimport {isFacetSpec} from '../spec';\nimport {\n extractCompositionLayout,\n GenericCompositionLayoutWithColumns,\n LayoutSizeMixins,\n SpecType,\n ViewBackground\n} from '../spec/base';\nimport {NormalizedSpec} from '../spec/index';\nimport {extractTitleConfig, isText, TitleParams} from '../title';\nimport {normalizeTransform, Transform} from '../transform';\nimport {contains, Dict, duplicate, keys, varName, isEmpty} from '../util';\nimport {isVgRangeStep, VgData, VgEncodeEntry, VgLayout, VgMarkGroup} from '../vega.schema';\nimport {assembleAxes} from './axis/assemble';\nimport {AxisComponentIndex} from './axis/component';\nimport {signalOrValueRef} from './common';\nimport {ConcatModel} from './concat';\nimport {DataComponent} from './data';\nimport {FacetModel} from './facet';\nimport {assembleHeaderGroups, assembleLayoutTitleBand, assembleTitleGroup} from './header/assemble';\nimport {HEADER_CHANNELS, LayoutHeaderComponent} from './header/component';\nimport {LayerModel} from './layer';\nimport {sizeExpr} from './layoutsize/assemble';\nimport {\n getSizeTypeFromLayoutSizeType,\n LayoutSizeComponent,\n LayoutSizeIndex,\n LayoutSizeType\n} from './layoutsize/component';\nimport {assembleLegends} from './legend/assemble';\nimport {LegendComponentIndex} from './legend/component';\nimport {parseLegend} from './legend/parse';\nimport {assembleProjections} from './projection/assemble';\nimport {ProjectionComponent} from './projection/component';\nimport {parseProjection} from './projection/parse';\nimport {assembleScales} from './scale/assemble';\nimport {ScaleComponent, ScaleComponentIndex} from './scale/component';\nimport {assembleDomain, getFieldFromDomain} from './scale/domain';\nimport {parseScales} from './scale/parse';\nimport {SelectionComponent} from './selection';\nimport {Split} from './split';\nimport {UnitModel} from './unit';\n\n/**\n * Composable Components that are intermediate results of the parsing phase of the\n * compilations. The components represents parts of the specification in a form that\n * can be easily merged (during parsing for composite specs).\n * In addition, these components are easily transformed into Vega specifications\n * during the \"assemble\" phase, which is the last phase of the compilation step.\n */\nexport interface Component {\n data: DataComponent;\n\n layoutSize: LayoutSizeComponent;\n\n layoutHeaders: {\n row?: LayoutHeaderComponent;\n column?: LayoutHeaderComponent;\n facet?: LayoutHeaderComponent;\n };\n\n mark: VgMarkGroup[];\n scales: ScaleComponentIndex;\n projection: ProjectionComponent;\n selection: Dict;\n\n /** Dictionary mapping channel to VgAxis definition */\n axes: AxisComponentIndex;\n\n /** Dictionary mapping channel to VgLegend definition */\n legends: LegendComponentIndex;\n\n resolve: Resolve;\n}\n\nexport interface NameMapInterface {\n rename(oldname: string, newName: string): void;\n has(name: string): boolean;\n get(name: string): string;\n}\n\nexport class NameMap implements NameMapInterface {\n private nameMap: Dict;\n\n constructor() {\n this.nameMap = {};\n }\n\n public rename(oldName: string, newName: string) {\n this.nameMap[oldName] = newName;\n }\n\n public has(name: string): boolean {\n return this.nameMap[name] !== undefined;\n }\n\n public get(name: string): string {\n // If the name appears in the _nameMap, we need to read its new name.\n // We have to loop over the dict just in case the new name also gets renamed.\n while (this.nameMap[name] && name !== this.nameMap[name]) {\n name = this.nameMap[name];\n }\n\n return name;\n }\n}\n\n/*\n We use type guards instead of `instanceof` as `instanceof` makes\n different parts of the compiler depend on the actual implementation of\n the model classes, which in turn depend on different parts of the compiler.\n Thus, `instanceof` leads to circular dependency problems.\n\n On the other hand, type guards only make different parts of the compiler\n depend on the type of the model classes, but not the actual implementation.\n*/\n\nexport function isUnitModel(model: Model): model is UnitModel {\n return model?.type === 'unit';\n}\n\nexport function isFacetModel(model: Model): model is FacetModel {\n return model?.type === 'facet';\n}\n\nexport function isConcatModel(model: Model): model is ConcatModel {\n return model?.type === 'concat';\n}\n\nexport function isLayerModel(model: Model): model is LayerModel {\n return model?.type === 'layer';\n}\n\nexport abstract class Model {\n public readonly name: string;\n\n public size: LayoutSizeMixins;\n\n public readonly title: TitleParams;\n public readonly description: string;\n\n public readonly data: Data | null;\n public readonly transforms: Transform[];\n public readonly layout: GenericCompositionLayoutWithColumns;\n\n /** Name map for scales, which can be renamed by a model's parent. */\n protected scaleNameMap: NameMapInterface;\n\n /** Name map for projections, which can be renamed by a model's parent. */\n protected projectionNameMap: NameMapInterface;\n\n /** Name map for signals, which can be renamed by a model's parent. */\n protected signalNameMap: NameMapInterface;\n\n public readonly component: Component;\n\n public abstract readonly children: Model[] = [];\n\n constructor(\n spec: NormalizedSpec,\n public readonly type: SpecType,\n public readonly parent: Model,\n parentGivenName: string,\n public readonly config: Config,\n resolve: Resolve,\n public readonly view?: ViewBackground\n ) {\n this.parent = parent;\n this.config = config;\n\n // If name is not provided, always use parent's givenName to avoid name conflicts.\n this.name = spec.name ?? parentGivenName;\n this.title = isText(spec.title) ? {text: spec.title} : (spec.title as TitleParams);\n\n // Shared name maps\n this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap();\n this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap();\n this.signalNameMap = parent ? parent.signalNameMap : new NameMap();\n\n this.data = spec.data;\n\n this.description = spec.description;\n this.transforms = normalizeTransform(spec.transform ?? []);\n this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config);\n\n this.component = {\n data: {\n sources: parent ? parent.component.data.sources : [],\n outputNodes: parent ? parent.component.data.outputNodes : {},\n outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {},\n // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined\n isFaceted: isFacetSpec(spec) || (parent && parent.component.data.isFaceted && spec.data === undefined)\n },\n layoutSize: new Split(),\n layoutHeaders: {row: {}, column: {}, facet: {}},\n mark: null,\n resolve: {\n scale: {},\n axis: {},\n legend: {},\n ...(resolve ? duplicate(resolve) : {})\n },\n selection: null,\n scales: null,\n projection: null,\n axes: {},\n legends: {}\n };\n }\n\n public get width(): SignalRef {\n return this.getSizeSignalRef('width');\n }\n\n public get height(): SignalRef {\n return this.getSizeSignalRef('height');\n }\n\n public parse() {\n this.parseScale();\n\n this.parseLayoutSize(); // depends on scale\n this.renameTopLevelLayoutSizeSignal();\n\n this.parseSelections();\n this.parseProjection();\n this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name.\n this.parseAxesAndHeaders(); // depends on scale and layout size\n this.parseLegends(); // depends on scale, markDef\n this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark.\n }\n\n public abstract parseData(): void;\n\n public abstract parseSelections(): void;\n\n public parseScale() {\n parseScales(this);\n }\n\n public parseProjection() {\n parseProjection(this);\n }\n\n public abstract parseLayoutSize(): void;\n\n /**\n * Rename top-level spec's size to be just width / height, ignoring model name.\n * This essentially merges the top-level spec's width/height signals with the width/height signals\n * to help us reduce redundant signals declaration.\n */\n private renameTopLevelLayoutSizeSignal() {\n if (this.getName('width') !== 'width') {\n this.renameSignal(this.getName('width'), 'width');\n }\n if (this.getName('height') !== 'height') {\n this.renameSignal(this.getName('height'), 'height');\n }\n }\n\n public abstract parseMarkGroup(): void;\n\n public abstract parseAxesAndHeaders(): void;\n\n public parseLegends() {\n parseLegend(this);\n }\n\n public abstract assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[];\n public abstract assembleSignals(): NewSignal[];\n\n public abstract assembleSelectionData(data: readonly VgData[]): readonly VgData[];\n\n public assembleGroupStyle(): string | string[] {\n if (this.type === 'unit' || this.type === 'layer') {\n return this.view?.style ?? 'cell';\n }\n return undefined;\n }\n\n private assembleEncodeFromView(view: ViewBackground): VgEncodeEntry {\n // Exclude \"style\"\n const {style: _, ...baseView} = view;\n\n const e: VgEncodeEntry = {};\n for (const property of keys(baseView)) {\n const value = baseView[property];\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n\n return e;\n }\n\n public assembleGroupEncodeEntry(isTopLevel: boolean): VgEncodeEntry {\n let encodeEntry: VgEncodeEntry = {};\n if (this.view) {\n encodeEntry = this.assembleEncodeFromView(this.view);\n }\n\n if (!isTopLevel) {\n // Descriptions are already added to the top-level description so we only need to add them to the inner views.\n if (this.description) {\n encodeEntry['description'] = signalOrValueRef(this.description);\n }\n\n // For top-level spec, we can set the global width and height signal to adjust the group size.\n // For other child specs, we have to manually set width and height in the encode entry.\n if (this.type === 'unit' || this.type === 'layer') {\n return {\n width: this.getSizeSignalRef('width'),\n height: this.getSizeSignalRef('height'),\n ...(encodeEntry ?? {})\n };\n }\n }\n\n return isEmpty(encodeEntry) ? undefined : encodeEntry;\n }\n\n public assembleLayout(): VgLayout {\n if (!this.layout) {\n return undefined;\n }\n\n const {spacing, ...layout} = this.layout;\n\n const {component, config} = this;\n const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config);\n\n return {\n padding: spacing,\n ...this.assembleDefaultLayout(),\n ...layout,\n ...(titleBand ? {titleBand} : {})\n };\n }\n\n protected assembleDefaultLayout(): VgLayout {\n return {};\n }\n\n public abstract assembleLayoutSignals(): NewSignal[];\n\n public assembleHeaderMarks(): VgMarkGroup[] {\n const {layoutHeaders} = this.component;\n let headerMarks = [];\n\n for (const channel of FACET_CHANNELS) {\n if (layoutHeaders[channel].title) {\n headerMarks.push(assembleTitleGroup(this, channel));\n }\n }\n\n for (const channel of HEADER_CHANNELS) {\n headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel));\n }\n return headerMarks;\n }\n\n public abstract assembleMarks(): VgMarkGroup[];\n\n public assembleAxes(): VgAxis[] {\n return assembleAxes(this.component.axes, this.config);\n }\n\n public assembleLegends(): VgLegend[] {\n return assembleLegends(this);\n }\n\n public assembleProjections(): VgProjection[] {\n return assembleProjections(this);\n }\n\n public assembleTitle(): VgTitle {\n const {encoding, ...titleNoEncoding} = this.title ?? ({} as TitleParams);\n\n const title: VgTitle = {\n ...extractTitleConfig(this.config.title).nonMark,\n ...titleNoEncoding,\n ...(encoding ? {encode: {update: encoding}} : {})\n };\n\n if (title.text) {\n if (contains(['unit', 'layer'], this.type)) {\n // Unit/Layer\n if (contains(['middle', undefined], title.anchor)) {\n title.frame = title.frame ?? 'group';\n }\n } else {\n // composition with Vega layout\n\n // Set title = \"start\" by default for composition as \"middle\" does not look nice\n // https://github.com/vega/vega/issues/960#issuecomment-471360328\n title.anchor = title.anchor ?? 'start';\n }\n\n return isEmpty(title) ? undefined : title;\n }\n return undefined;\n }\n\n /**\n * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals.\n */\n public assembleGroup(signals: NewSignal[] = []) {\n const group: VgMarkGroup = {};\n\n signals = signals.concat(this.assembleSignals());\n\n if (signals.length > 0) {\n group.signals = signals;\n }\n\n const layout = this.assembleLayout();\n if (layout) {\n group.layout = layout;\n }\n\n group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());\n\n // Only include scales if this spec is top-level or if parent is facet.\n // (Otherwise, it will be merged with upper-level's scope.)\n const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : [];\n if (scales.length > 0) {\n group.scales = scales;\n }\n\n const axes = this.assembleAxes();\n if (axes.length > 0) {\n group.axes = axes;\n }\n\n const legends = this.assembleLegends();\n if (legends.length > 0) {\n group.legends = legends;\n }\n\n return group;\n }\n\n public getName(text: string) {\n return varName((this.name ? this.name + '_' : '') + text);\n }\n\n public getDataName(type: DataSourceType) {\n return this.getName(DataSourceType[type].toLowerCase());\n }\n\n /**\n * Request a data source name for the given data source type and mark that data source as required.\n * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData().\n * You can lookup the correct dataset name in assemble with `lookupDataSource`.\n */\n public requestDataName(name: DataSourceType) {\n const fullName = this.getDataName(name);\n\n // Increase ref count. This is critical because otherwise we won't create a data source.\n // We also increase the ref counts on OutputNode.getSource() calls.\n const refCounts = this.component.data.outputNodeRefCounts;\n refCounts[fullName] = (refCounts[fullName] || 0) + 1;\n\n return fullName;\n }\n\n public getSizeSignalRef(layoutSizeType: LayoutSizeType): SignalRef {\n if (isFacetModel(this.parent)) {\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const scaleComponent = this.component.scales[channel];\n\n if (scaleComponent && !scaleComponent.merged) {\n // independent scale\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = scaleComponent.get('name');\n const domain = assembleDomain(this, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n const fieldRef = vgField({aggregate: 'distinct', field}, {expr: 'datum'});\n return {\n signal: sizeExpr(scaleName, scaleComponent, fieldRef)\n };\n } else {\n log.warn(log.message.unknownField(channel));\n return null;\n }\n }\n }\n }\n\n return {\n signal: this.signalNameMap.get(this.getName(layoutSizeType))\n };\n }\n\n /**\n * Lookup the name of the datasource for an output node. You probably want to call this in assemble.\n */\n public lookupDataSource(name: string) {\n const node = this.component.data.outputNodes[name];\n\n if (!node) {\n // Name not found in map so let's just return what we got.\n // This can happen if we already have the correct name.\n return name;\n }\n\n return node.getSource();\n }\n\n public getSignalName(oldSignalName: string): string {\n return this.signalNameMap.get(oldSignalName);\n }\n\n public renameSignal(oldName: string, newName: string) {\n this.signalNameMap.rename(oldName, newName);\n }\n\n public renameScale(oldName: string, newName: string) {\n this.scaleNameMap.rename(oldName, newName);\n }\n\n public renameProjection(oldName: string, newName: string) {\n this.projectionNameMap.rename(oldName, newName);\n }\n\n /**\n * @return scale name for a given channel after the scale has been parsed and named.\n */\n public scaleName(originalScaleName: ScaleChannel | string, parse?: boolean): string {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a scale can't be renamed\n // before it has the original name.\n return this.getName(originalScaleName);\n }\n\n // If there is a scale for the channel, it should either\n // be in the scale component or exist in the name map\n if (\n // If there is a scale for the channel, there should be a local scale component for it\n (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) ||\n // in the scale name map (the scale get merged by its parent)\n this.scaleNameMap.has(this.getName(originalScaleName))\n ) {\n return this.scaleNameMap.get(this.getName(originalScaleName));\n }\n return undefined;\n }\n\n /**\n * @return projection name after the projection has been parsed and named.\n */\n public projectionName(parse?: boolean): string {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a projection can't be renamed\n // before it has the original name.\n return this.getName('projection');\n }\n\n if (\n (this.component.projection && !this.component.projection.merged) ||\n this.projectionNameMap.has(this.getName('projection'))\n ) {\n return this.projectionNameMap.get(this.getName('projection'));\n }\n return undefined;\n }\n\n /**\n * Corrects the data references in marks after assemble.\n */\n public correctDataNames = (mark: VgMarkGroup) => {\n // TODO: make this correct\n\n // for normal data references\n if (mark.from && mark.from.data) {\n mark.from.data = this.lookupDataSource(mark.from.data);\n }\n\n // for access to facet data\n if (mark.from && mark.from.facet && mark.from.facet.data) {\n mark.from.facet.data = this.lookupDataSource(mark.from.facet.data);\n }\n\n return mark;\n };\n\n /**\n * Traverse a model's hierarchy to get the scale component for a particular channel.\n */\n public getScaleComponent(channel: ScaleChannel): ScaleComponent {\n /* istanbul ignore next: This is warning for debugging test */\n if (!this.component.scales) {\n throw new Error(\n 'getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().'\n );\n }\n\n const localScaleComponent = this.component.scales[channel];\n if (localScaleComponent && !localScaleComponent.merged) {\n return localScaleComponent;\n }\n return this.parent ? this.parent.getScaleComponent(channel) : undefined;\n }\n\n /**\n * Traverse a model's hierarchy to get a particular selection component.\n */\n public getSelectionComponent(variableName: string, origName: string): SelectionComponent {\n let sel = this.component.selection[variableName];\n if (!sel && this.parent) {\n sel = this.parent.getSelectionComponent(variableName, origName);\n }\n if (!sel) {\n throw new Error(log.message.selectionNotFound(origName));\n }\n return sel;\n }\n\n /**\n * Returns true if the model has a signalRef for an axis orient.\n */\n public hasAxisOrientSignalRef() {\n return (\n this.component.axes.x?.some(a => a.hasOrientSignalRef()) ||\n this.component.axes.y?.some(a => a.hasOrientSignalRef())\n );\n }\n}\n\n/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */\nexport abstract class ModelWithField extends Model {\n public abstract fieldDef(channel: SingleDefChannel): FieldDef;\n\n /** Get \"field\" reference for Vega */\n public vgField(channel: SingleDefChannel, opt: FieldRefOption = {}) {\n const fieldDef = this.fieldDef(channel);\n\n if (!fieldDef) {\n return undefined;\n }\n\n return vgField(fieldDef, opt);\n }\n\n protected abstract getMapping(): Partial>;\n\n public reduceFieldDef(f: (acc: U, fd: FieldDef, c: Channel) => U, init: T): T {\n return reduce(\n this.getMapping(),\n (acc: U, cd: ChannelDef, c: Channel) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n return f(acc, fieldDef, c);\n }\n return acc;\n },\n init\n );\n }\n\n public forEachFieldDef(f: (fd: FieldDef, c: ExtendedChannel) => void, t?: any) {\n forEach(\n this.getMapping(),\n (cd, c) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n f(fieldDef, c);\n }\n },\n t\n );\n }\n\n public abstract channelHasField(channel: Channel): boolean;\n}\n","import {KDETransform as VgKDETransform} from 'vega';\nimport {DensityTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for density transform nodes\n */\nexport class DensityTransformNode extends DataFlowNode {\n public clone() {\n return new DensityTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: DensityTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density'];\n }\n\n public dependentFields() {\n return new Set([this.transform.density, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `DensityTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgKDETransform {\n const {density, ...rest} = this.transform;\n const result: VgKDETransform = {\n type: 'kde',\n field: density,\n ...rest\n };\n return result;\n }\n}\n","import {FilterTransform as VgFilterTransform} from 'vega';\nimport {isScaleChannel} from '../../channel';\nimport {TypedFieldDef, vgField as fieldRef} from '../../channeldef';\nimport {isPathMark} from '../../mark';\nimport {hasContinuousDomain} from '../../scale';\nimport {Dict, hash, keys} from '../../util';\nimport {getMarkPropOrConfig} from '../common';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class FilterInvalidNode extends DataFlowNode {\n public clone() {\n return new FilterInvalidNode(null, {...this.filter});\n }\n\n constructor(parent: DataFlowNode, public readonly filter: Dict>) {\n super(parent);\n }\n\n public static make(parent: DataFlowNode, model: UnitModel): FilterInvalidNode {\n const {config, mark, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid !== 'filter') {\n return null;\n }\n\n const filter = model.reduceFieldDef((aggregator: Dict>, fieldDef, channel) => {\n const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n // Thus, for non-path marks, we have to filter null for scales with continuous domains.\n // (For path marks, we will use \"defined\" property and skip these values instead.)\n if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) {\n aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def\n }\n }\n return aggregator;\n }, {} as Dict>);\n\n if (!keys(filter).length) {\n return null;\n }\n\n return new FilterInvalidNode(parent, filter);\n }\n\n public dependentFields() {\n return new Set(keys(this.filter));\n }\n\n public producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n\n public hash() {\n return `FilterInvalid ${hash(this.filter)}`;\n }\n\n /**\n * Create the VgTransforms for each of the filtered fields.\n */\n public assemble(): VgFilterTransform {\n const filters = keys(this.filter).reduce((vegaFilters, field) => {\n const fieldDef = this.filter[field];\n const ref = fieldRef(fieldDef, {expr: 'datum'});\n\n if (fieldDef !== null) {\n if (fieldDef.type === 'temporal') {\n vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`);\n } else if (fieldDef.type === 'quantitative') {\n vegaFilters.push(`isValid(${ref})`);\n vegaFilters.push(`isFinite(+${ref})`);\n } else {\n // should never get here\n }\n }\n return vegaFilters;\n }, [] as string[]);\n\n return filters.length > 0\n ? {\n type: 'filter',\n expr: filters.join(' && ')\n }\n : null;\n }\n}\n","import {FlattenTransform as VgFlattenTransform} from 'vega';\nimport {FlattenTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class FlattenTransformNode extends DataFlowNode {\n public clone() {\n return new FlattenTransformNode(this.parent, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: FlattenTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const {flatten, as = []} = this.transform;\n this.transform.as = flatten.map((f, i) => as[i] ?? f);\n }\n\n public dependentFields() {\n return new Set(this.transform.flatten);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `FlattenTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgFlattenTransform {\n const {flatten: fields, as} = this.transform;\n\n const result: VgFlattenTransform = {\n type: 'flatten',\n fields,\n as\n };\n return result;\n }\n}\n","import {FoldTransform as VgFoldTransform} from 'vega';\nimport {FoldTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class FoldTransformNode extends DataFlowNode {\n public clone() {\n return new FoldTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: FoldTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'key', specifiedAs[1] ?? 'value'];\n }\n\n public dependentFields() {\n return new Set(this.transform.fold);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `FoldTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgFoldTransform {\n const {fold, as} = this.transform;\n const result: VgFoldTransform = {\n type: 'fold',\n fields: fold,\n as\n };\n return result;\n }\n}\n","import {GeoJSONTransform as VgGeoJSONTransform, Vector2} from 'vega';\nimport {isString} from 'vega-util';\nimport {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef';\nimport {GEOJSON} from '../../type';\nimport {duplicate, hash} from '../../util';\nimport {VgExprRef} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class GeoJSONNode extends DataFlowNode {\n public clone() {\n return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal);\n }\n\n public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode {\n if (model.component.projection && !model.component.projection.isFit) {\n return parent;\n }\n\n let geoJsonCounter = 0;\n\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ] as Vector2[]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? {expr: `${def.datum}`}\n : isValueDef(def)\n ? {expr: `${def['value']}`}\n : undefined;\n }) as [GeoPositionChannel, GeoPositionChannel];\n\n if (pair[0] || pair[1]) {\n parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n\n if (model.channelHasField(SHAPE)) {\n const fieldDef = model.typedFieldDef(SHAPE);\n if (fieldDef.type === GEOJSON) {\n parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n\n return parent;\n }\n\n constructor(\n parent: DataFlowNode,\n private fields?: Vector2,\n private geojson?: string,\n private signal?: string\n ) {\n super(parent);\n }\n\n public dependentFields() {\n const fields = (this.fields ?? []).filter(isString) as string[];\n return new Set([...(this.geojson ? [this.geojson] : []), ...fields]);\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`;\n }\n\n public assemble(): VgGeoJSONTransform {\n return {\n type: 'geojson',\n ...(this.fields ? {fields: this.fields} : {}),\n ...(this.geojson ? {geojson: this.geojson} : {}),\n signal: this.signal\n };\n }\n}\n","import {GeoPointTransform as VgGeoPointTransform, Vector2} from 'vega';\nimport {isString} from 'vega-util';\nimport {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2} from '../../channel';\nimport {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef';\nimport {duplicate, hash} from '../../util';\nimport {VgExprRef} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class GeoPointNode extends DataFlowNode {\n public clone() {\n return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as));\n }\n\n constructor(\n parent: DataFlowNode,\n private projection: string,\n private fields: [string | VgExprRef, string | VgExprRef],\n private as: [string, string]\n ) {\n super(parent);\n }\n\n public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode {\n if (!model.projectionName()) {\n return parent;\n }\n\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ] as Vector2[]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? {expr: `${def.datum}`}\n : isValueDef(def)\n ? {expr: `${def['value']}`}\n : undefined;\n }) as [GeoPositionChannel, GeoPositionChannel];\n\n const suffix = coordinates[0] === LONGITUDE2 ? '2' : '';\n\n if (pair[0] || pair[1]) {\n parent = new GeoPointNode(parent, model.projectionName(), pair, [\n model.getName('x' + suffix),\n model.getName('y' + suffix)\n ]);\n }\n }\n\n return parent;\n }\n\n public dependentFields() {\n return new Set(this.fields.filter(isString));\n }\n\n public producedFields() {\n return new Set(this.as);\n }\n\n public hash() {\n return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`;\n }\n\n public assemble(): VgGeoPointTransform {\n return {\n type: 'geopoint',\n projection: this.projection,\n fields: this.fields,\n as: this.as\n };\n }\n}\n","import {\n FormulaTransform as VgFormulaTransform,\n ImputeTransform as VgImputeTransform,\n SignalRef,\n WindowTransform as VgWindowTransform\n} from 'vega';\nimport {isFieldDef} from '../../channeldef';\nimport {pathGroupingFields} from '../../encoding';\nimport {ImputeSequence, ImputeTransform, isImputeSequence} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class ImputeNode extends DataFlowNode {\n public clone() {\n return new ImputeNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private readonly transform: ImputeTransform) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set([this.transform.impute, this.transform.key, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set([this.transform.impute]);\n }\n\n private processSequence(keyvals: ImputeSequence): SignalRef {\n const {start = 0, stop, step} = keyvals;\n const result = [start, stop, ...(step ? [step] : [])].join(',');\n\n return {signal: `sequence(${result})`};\n }\n\n public static makeFromTransform(parent: DataFlowNode, imputeTransform: ImputeTransform): ImputeNode {\n return new ImputeNode(parent, imputeTransform);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) {\n const encoding = model.encoding;\n const xDef = encoding.x;\n const yDef = encoding.y;\n\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined;\n if (imputedChannel === undefined) {\n return undefined;\n }\n const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined;\n const {method, value, frame, keyvals} = imputedChannel.impute;\n const groupbyFields = pathGroupingFields(model.mark, encoding);\n\n return new ImputeNode(parent, {\n impute: imputedChannel.field,\n key: keyChannel.field,\n ...(method ? {method} : {}),\n ...(value !== undefined ? {value} : {}),\n ...(frame ? {frame} : {}),\n ...(keyvals !== undefined ? {keyvals} : {}),\n ...(groupbyFields.length ? {groupby: groupbyFields} : {})\n });\n }\n return null;\n }\n\n public hash() {\n return `Impute ${hash(this.transform)}`;\n }\n\n public assemble() {\n const {impute, key, keyvals, method, groupby, value, frame = [null, null] as [null, null]} = this.transform;\n\n const imputeTransform: VgImputeTransform = {\n type: 'impute',\n field: impute,\n key,\n ...(keyvals ? {keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals} : {}),\n method: 'value',\n ...(groupby ? {groupby} : {}),\n value: !method || method === 'value' ? value : null\n };\n\n if (method && method !== 'value') {\n const deriveNewField: VgWindowTransform = {\n type: 'window',\n as: [`imputed_${impute}_value`],\n ops: [method],\n fields: [impute],\n frame,\n ignorePeers: false,\n ...(groupby ? {groupby} : {})\n };\n const replaceOriginal: VgFormulaTransform = {\n type: 'formula',\n expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`,\n as: impute\n };\n return [imputeTransform, deriveNewField, replaceOriginal];\n } else {\n return [imputeTransform];\n }\n }\n}\n","import {LoessTransform as VgLoessTransform} from 'vega';\nimport {LoessTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for loess transform nodes\n */\nexport class LoessTransformNode extends DataFlowNode {\n public clone() {\n return new LoessTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: LoessTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.loess];\n }\n\n public dependentFields() {\n return new Set([this.transform.loess, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `LoessTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgLoessTransform {\n const {loess, on, ...rest} = this.transform;\n const result: VgLoessTransform = {\n type: 'loess',\n x: on,\n y: loess,\n ...rest\n };\n return result;\n }\n}\n","import {LookupTransform as VgLookupTransform} from 'vega';\nimport {array, isString} from 'vega-util';\nimport * as log from '../../log';\nimport {isLookupData, isLookupSelection, LookupTransform} from '../../transform';\nimport {duplicate, hash, varName} from '../../util';\nimport {Model} from '../model';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {findSource} from './parse';\nimport {SourceNode} from './source';\nimport {DataSourceType} from '../../data';\n\nexport class LookupNode extends DataFlowNode {\n public clone() {\n return new LookupNode(null, duplicate(this.transform), this.secondary);\n }\n\n constructor(parent: DataFlowNode, public readonly transform: LookupTransform, public readonly secondary: string) {\n super(parent);\n }\n\n public static make(parent: DataFlowNode, model: Model, transform: LookupTransform, counter: number) {\n const sources = model.component.data.sources;\n const {from} = transform;\n let fromOutputNode = null;\n\n if (isLookupData(from)) {\n let fromSource = findSource(from.data, sources);\n\n if (!fromSource) {\n fromSource = new SourceNode(from.data);\n sources.push(fromSource);\n }\n\n const fromOutputName = model.getName(`lookup_${counter}`);\n fromOutputNode = new OutputNode(\n fromSource,\n fromOutputName,\n DataSourceType.Lookup,\n model.component.data.outputNodeRefCounts\n );\n model.component.data.outputNodes[fromOutputName] = fromOutputNode;\n } else if (isLookupSelection(from)) {\n const selName = from.selection;\n transform = {as: selName, ...transform};\n fromOutputNode = model.getSelectionComponent(varName(selName), selName).materialized;\n if (!fromOutputNode) {\n throw new Error(log.message.noSameUnitLookup(selName));\n }\n }\n\n return new LookupNode(parent, transform, fromOutputNode.getSource());\n }\n\n public dependentFields() {\n return new Set([this.transform.lookup]);\n }\n\n public producedFields() {\n return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields);\n }\n\n public hash() {\n return `Lookup ${hash({transform: this.transform, secondary: this.secondary})}`;\n }\n\n public assemble(): VgLookupTransform {\n let foreign: Partial;\n\n if (this.transform.from.fields) {\n // lookup a few fields and add create a flat output\n foreign = {\n values: this.transform.from.fields,\n ...(this.transform.as ? {as: array(this.transform.as)} : {})\n };\n } else {\n // lookup full record and nest it\n let asName = this.transform.as;\n if (!isString(asName)) {\n log.warn(log.message.NO_FIELDS_NEEDS_AS);\n asName = '_lookup';\n }\n\n foreign = {\n as: [asName]\n };\n }\n\n return {\n type: 'lookup',\n from: this.secondary,\n key: this.transform.from.key,\n fields: [this.transform.lookup],\n ...foreign,\n ...(this.transform.default ? {default: this.transform.default} : {})\n };\n }\n}\n","import {QuantileTransform as VgQuantileTransform} from 'vega';\nimport {QuantileTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for quantile transform nodes\n */\nexport class QuantileTransformNode extends DataFlowNode {\n public clone() {\n return new QuantileTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: QuantileTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'prob', specifiedAs[1] ?? 'value'];\n }\n\n public dependentFields() {\n return new Set([this.transform.quantile, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `QuantileTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgQuantileTransform {\n const {quantile, ...rest} = this.transform;\n const result: VgQuantileTransform = {\n type: 'quantile',\n field: quantile,\n ...rest\n };\n return result;\n }\n}\n","import {RegressionTransform as VgRegressionTransform} from 'vega';\nimport {RegressionTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for regression transform nodes\n */\nexport class RegressionTransformNode extends DataFlowNode {\n public clone() {\n return new RegressionTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: RegressionTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.regression];\n }\n\n public dependentFields() {\n return new Set([this.transform.regression, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `RegressionTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgRegressionTransform {\n const {regression, on, ...rest} = this.transform;\n const result: VgRegressionTransform = {\n type: 'regression',\n x: on,\n y: regression,\n ...rest\n };\n return result;\n }\n}\n","import {PivotTransform} from '../../transform';\nimport {duplicate, hash, unique} from '../../util';\nimport {PivotTransform as VgPivotTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for pivot transform nodes.\n */\nexport class PivotTransformNode extends DataFlowNode {\n public clone() {\n return new PivotTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: PivotTransform) {\n super(parent);\n }\n\n public addDimensions(fields: readonly string[]) {\n this.transform.groupby = unique((this.transform.groupby ?? []).concat(fields), d => d);\n }\n\n public producedFields(): undefined {\n return undefined; // return undefined so that potentially everything can depend on the pivot\n }\n\n public dependentFields() {\n return new Set([this.transform.pivot, this.transform.value, ...(this.transform.groupby ?? [])]);\n }\n\n public hash() {\n return `PivotTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgPivotTransform {\n const {pivot, value, groupby, limit, op} = this.transform;\n return {\n type: 'pivot',\n field: pivot,\n value,\n ...(limit !== undefined ? {limit} : {}),\n ...(op !== undefined ? {op} : {}),\n ...(groupby !== undefined ? {groupby} : {})\n };\n }\n}\n","import {SampleTransform as VgSampleTransform} from 'vega';\nimport {SampleTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the sample transform nodes\n */\nexport class SampleTransformNode extends DataFlowNode {\n public clone() {\n return new SampleTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: SampleTransform) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n return `SampleTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgSampleTransform {\n return {\n type: 'sample',\n size: this.transform.sample\n };\n }\n}\n","import {InlineDataset, isUrlData} from '../../data';\nimport {Dict} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {DataComponent} from './';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {CalculateNode} from './calculate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {DensityTransformNode} from './density';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {FilterInvalidNode} from './filterinvalid';\nimport {FlattenTransformNode} from './flatten';\nimport {FoldTransformNode} from './fold';\nimport {ParseNode} from './formatparse';\nimport {GeoJSONNode} from './geojson';\nimport {GeoPointNode} from './geopoint';\nimport {GraticuleNode} from './graticule';\nimport {IdentifierNode} from './identifier';\nimport {ImputeNode} from './impute';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {LoessTransformNode} from './loess';\nimport {LookupNode} from './lookup';\nimport {QuantileTransformNode} from './quantile';\nimport {RegressionTransformNode} from './regression';\nimport {PivotTransformNode} from './pivot';\nimport {SampleTransformNode} from './sample';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nfunction makeWalkTree(data: VgData[]) {\n // to name datasources\n let datasetIndex = 0;\n\n /**\n * Recursively walk down the tree.\n */\n function walkTree(node: DataFlowNode, dataSource: VgData) {\n if (node instanceof SourceNode) {\n // If the source is a named data source or a data source with values, we need\n // to put it in a different data source. Otherwise, Vega may override the data.\n if (!node.isGenerator && !isUrlData(node.data)) {\n data.push(dataSource);\n const newData: VgData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n\n if (node instanceof ParseNode) {\n if (node.parent instanceof SourceNode && !dataSource.source) {\n // If node's parent is a root source and the data source does not refer to another data source, use normal format parse\n dataSource.format = {\n ...(dataSource.format ?? {}),\n parse: node.assembleFormatParse()\n };\n\n // add calculates for all nested fields\n dataSource.transform.push(...node.assembleTransforms(true));\n } else {\n // Otherwise use Vega expression to parse\n dataSource.transform.push(...node.assembleTransforms());\n }\n }\n\n if (node instanceof FacetNode) {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n node.data = dataSource.name;\n } else {\n node.data = dataSource.source;\n }\n\n for (const d of node.assemble()) {\n data.push(d);\n }\n\n // break here because the rest of the tree has to be taken care of by the facet.\n return;\n }\n\n if (\n node instanceof GraticuleNode ||\n node instanceof SequenceNode ||\n node instanceof FilterInvalidNode ||\n node instanceof FilterNode ||\n node instanceof CalculateNode ||\n node instanceof GeoPointNode ||\n node instanceof GeoJSONNode ||\n node instanceof AggregateNode ||\n node instanceof LookupNode ||\n node instanceof WindowTransformNode ||\n node instanceof JoinAggregateTransformNode ||\n node instanceof FoldTransformNode ||\n node instanceof FlattenTransformNode ||\n node instanceof DensityTransformNode ||\n node instanceof LoessTransformNode ||\n node instanceof QuantileTransformNode ||\n node instanceof RegressionTransformNode ||\n node instanceof IdentifierNode ||\n node instanceof SampleTransformNode ||\n node instanceof PivotTransformNode\n ) {\n dataSource.transform.push(node.assemble());\n }\n\n if (\n node instanceof BinNode ||\n node instanceof TimeUnitNode ||\n node instanceof ImputeNode ||\n node instanceof StackNode\n ) {\n dataSource.transform.push(...node.assemble());\n }\n\n if (node instanceof OutputNode) {\n if (dataSource.source && dataSource.transform.length === 0) {\n node.setSource(dataSource.source);\n } else if (node.parent instanceof OutputNode) {\n // Note that an output node may be required but we still do not assemble a\n // separate data source for it.\n node.setSource(dataSource.name);\n } else {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n // Here we set the name of the datasource we generated. From now on\n // other assemblers can use it.\n node.setSource(dataSource.name);\n\n // if this node has more than one child, we will add a datasource automatically\n if (node.numChildren() === 1) {\n data.push(dataSource);\n const newData: VgData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n }\n\n switch (node.numChildren()) {\n case 0:\n // done\n if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) {\n // do not push empty datasources that are simply references\n data.push(dataSource);\n }\n break;\n case 1:\n walkTree(node.children[0], dataSource);\n break;\n default: {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n let source = dataSource.name;\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n } else {\n source = dataSource.source;\n }\n\n for (const child of node.children) {\n const newData: VgData = {\n name: null,\n source: source,\n transform: []\n };\n walkTree(child, newData);\n }\n break;\n }\n }\n }\n\n return walkTree;\n}\n\n/**\n * Assemble data sources that are derived from faceted data.\n */\nexport function assembleFacetData(root: FacetNode): VgData[] {\n const data: VgData[] = [];\n const walkTree = makeWalkTree(data);\n\n for (const child of root.children) {\n walkTree(child, {\n source: root.name,\n name: null,\n transform: []\n });\n }\n\n return data;\n}\n\n/**\n * Create Vega data array from a given compiled model and append all of them to the given array\n *\n * @param model\n * @param data array\n * @return modified data array\n */\nexport function assembleRootData(dataComponent: DataComponent, datasets: Dict): VgData[] {\n const data: VgData[] = [];\n\n // dataComponent.sources.forEach(debug);\n // draw(dataComponent.sources);\n\n const walkTree = makeWalkTree(data);\n\n let sourceIndex = 0;\n\n for (const root of dataComponent.sources) {\n // assign a name if the source does not have a name yet\n if (!root.hasName()) {\n root.dataName = `source_${sourceIndex++}`;\n }\n\n const newData: VgData = root.assemble();\n\n walkTree(root, newData);\n }\n\n // remove empty transform arrays for cleaner output\n for (const d of data) {\n if (d.transform.length === 0) {\n delete d.transform;\n }\n }\n\n // move sources without transforms (the ones that are potentially used in lookups) to the beginning\n let whereTo = 0;\n for (const [i, d] of data.entries()) {\n if ((d.transform ?? []).length === 0 && !d.source) {\n data.splice(whereTo++, 0, data.splice(i, 1)[0]);\n }\n }\n\n // now fix the from references in lookup transforms\n for (const d of data) {\n for (const t of d.transform ?? []) {\n if (t.type === 'lookup') {\n t.from = dataComponent.outputNodes[t.from].getSource();\n }\n }\n }\n\n // inline values for datasets that are in the datastore\n for (const d of data) {\n if (d.name in datasets) {\n d.values = datasets[d.name];\n }\n }\n\n return data;\n}\n","import {AxisOrient, SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FacetChannel, FACET_CHANNELS} from '../../channel';\nimport {title as fieldDefTitle} from '../../channeldef';\nimport {contains, getFirstDefined} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {assembleAxis} from '../axis/assemble';\nimport {FacetModel} from '../facet';\nimport {parseGuideResolve} from '../resolve';\nimport {getHeaderProperty} from './common';\nimport {HeaderChannel, HeaderComponent} from './component';\n\nexport function getHeaderType(orient: AxisOrient | SignalRef) {\n if (orient === 'top' || orient === 'left' || isSignalRef(orient)) {\n // we always use header for orient signal since we can't dynamically make header becomes footer\n return 'header';\n }\n return 'footer';\n}\n\nexport function parseFacetHeaders(model: FacetModel) {\n for (const channel of FACET_CHANNELS) {\n parseFacetHeader(model, channel);\n }\n\n mergeChildAxis(model, 'x');\n mergeChildAxis(model, 'y');\n}\n\nfunction parseFacetHeader(model: FacetModel, channel: FacetChannel) {\n const {facet, config, child, component} = model;\n if (model.channelHasField(channel)) {\n const fieldDef = facet[channel];\n const titleConfig = getHeaderProperty('title', null, config, channel);\n let title = fieldDefTitle(fieldDef, config, {\n allowDisabling: true,\n includeDefault: titleConfig === undefined || !!titleConfig\n });\n\n if (child.component.layoutHeaders[channel].title) {\n // TODO: better handle multiline titles\n title = isArray(title) ? title.join(', ') : title;\n\n // merge title with child to produce \"Title / Subtitle / Sub-subtitle\"\n title += ' / ' + child.component.layoutHeaders[channel].title;\n child.component.layoutHeaders[channel].title = null;\n }\n\n const labelOrient = getHeaderProperty('labelOrient', fieldDef, config, channel);\n\n const header = fieldDef.header ?? {};\n const labels = getFirstDefined(header.labels, config.header.labels, true);\n const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header';\n\n component.layoutHeaders[channel] = {\n title,\n facetFieldDef: fieldDef,\n [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)]\n };\n }\n}\n\nfunction makeHeaderComponent(model: FacetModel, channel: HeaderChannel, labels: boolean): HeaderComponent {\n const sizeType = channel === 'row' ? 'height' : 'width';\n\n return {\n labels,\n sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined,\n axes: []\n };\n}\n\nfunction mergeChildAxis(model: FacetModel, channel: 'x' | 'y') {\n const {child} = model;\n if (child.component.axes[channel]) {\n const {layoutHeaders, resolve} = model.component;\n resolve.axis[channel] = parseGuideResolve(resolve, channel);\n\n if (resolve.axis[channel] === 'shared') {\n // For shared axis, move the axes to facet's header or footer\n const headerChannel = channel === 'x' ? 'column' : 'row';\n\n const layoutHeader = layoutHeaders[headerChannel];\n for (const axisComponent of child.component.axes[channel]) {\n const headerType = getHeaderType(axisComponent.get('orient'));\n layoutHeader[headerType] = layoutHeader[headerType] ?? [makeHeaderComponent(model, headerChannel, false)];\n\n // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes\n const mainAxis = assembleAxis(axisComponent, 'main', model.config, {header: true});\n if (mainAxis) {\n // LayoutHeader no longer keep track of property precedence, thus let's combine.\n layoutHeader[headerType][0].axes.push(mainAxis);\n }\n axisComponent.mainExtracted = true;\n }\n } else {\n // Otherwise do nothing for independent axes\n }\n }\n}\n","import {getPositionScaleChannel, getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {getViewConfigContinuousSize, getViewConfigDiscreteSize} from '../../config';\nimport {hasDiscreteDomain} from '../../scale';\nimport {isStep} from '../../spec/base';\nimport {isVgRangeStep} from '../../vega.schema';\nimport {ConcatModel} from '../concat';\nimport {Model} from '../model';\nimport {Explicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {getSizeTypeFromLayoutSizeType, LayoutSize, LayoutSizeIndex, LayoutSizeType} from './component';\n\nexport function parseLayerLayoutSize(model: Model) {\n parseChildrenLayoutSize(model);\n\n parseNonUnitLayoutSizeForChannel(model, 'width');\n parseNonUnitLayoutSizeForChannel(model, 'height');\n}\n\nexport const parseRepeatLayoutSize = parseConcatLayoutSize;\n\nexport function parseConcatLayoutSize(model: ConcatModel) {\n parseChildrenLayoutSize(model);\n\n // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth.\n const widthType = model.layout.columns === 1 ? 'width' : 'childWidth';\n\n // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight.\n const heightType = model.layout.columns === undefined ? 'height' : 'childHeight';\n\n parseNonUnitLayoutSizeForChannel(model, widthType);\n parseNonUnitLayoutSizeForChannel(model, heightType);\n}\n\nexport function parseChildrenLayoutSize(model: Model) {\n for (const child of model.children) {\n child.parseLayoutSize();\n }\n}\n\n/**\n * Merge child layout size (width or height).\n */\nfunction parseNonUnitLayoutSizeForChannel(model: Model, layoutSizeType: LayoutSizeType) {\n /*\n * For concat, the parent width or height might not be the same as the children's shared height.\n * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width.\n *\n * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height)\n * while the sizeType represents the properties of the child.\n */\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const resolve = model.component.resolve;\n const layoutSizeCmpt = model.component.layoutSize;\n\n let mergedSize: Explicit;\n // Try to merge layout size\n for (const child of model.children) {\n const childSize = child.component.layoutSize.getWithExplicit(sizeType);\n const scaleResolve = resolve.scale[channel];\n if (scaleResolve === 'independent' && childSize.value === 'step') {\n // Do not merge independent scales with range-step as their size depends\n // on the scale domains, which can be different between scales.\n mergedSize = undefined;\n break;\n }\n\n if (mergedSize) {\n if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) {\n // For independent scale, only merge if all the sizes are the same.\n // If the values are different, abandon the merge!\n mergedSize = undefined;\n break;\n }\n mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, '');\n } else {\n mergedSize = childSize;\n }\n }\n\n if (mergedSize) {\n // If merged, rename size and set size of all children.\n for (const child of model.children) {\n model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType));\n child.component.layoutSize.set(sizeType, 'merged', false);\n }\n layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize);\n } else {\n layoutSizeCmpt.setWithExplicit(layoutSizeType, {\n explicit: false,\n value: undefined\n });\n }\n}\n\nexport function parseUnitLayoutSize(model: UnitModel) {\n const {size, component} = model;\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n\n if (size[sizeType]) {\n const specifiedSize = size[sizeType];\n component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true);\n } else {\n const defaultSize = defaultUnitSize(model, sizeType);\n component.layoutSize.set(sizeType, defaultSize, false);\n }\n }\n}\n\nfunction defaultUnitSize(model: UnitModel, sizeType: 'width' | 'height'): LayoutSize {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const config = model.config;\n const scaleComponent = model.getScaleComponent(channel);\n\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(scaleType)) {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n if (isVgRangeStep(range) || isStep(size)) {\n // For discrete domain with range.step, use dynamic width/height\n return 'step';\n } else {\n return size;\n }\n } else {\n return getViewConfigContinuousSize(config.view, sizeType);\n }\n } else if (model.hasProjection || model.mark === 'arc') {\n // arc should use continuous size by default otherwise the pie is extremely small\n return getViewConfigContinuousSize(config.view, sizeType);\n } else {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n return isStep(size) ? size.step : size;\n }\n}\n","import {AggregateOp, LayoutAlign, NewSignal} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinning} from '../bin';\nimport {COLUMN, ExtendedChannel, FacetChannel, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../channel';\nimport {FieldName, FieldRefOption, initChannelDef, TypedFieldDef, vgField} from '../channeldef';\nimport {Config} from '../config';\nimport {reduce} from '../encoding';\nimport * as log from '../log';\nimport {hasDiscreteDomain} from '../scale';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortField, SortOrder} from '../sort';\nimport {NormalizedFacetSpec} from '../spec';\nimport {EncodingFacetMapping, FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet';\nimport {contains} from '../util';\nimport {isVgRangeStep, VgData, VgLayout, VgMarkGroup} from '../vega.schema';\nimport {buildModel} from './buildmodel';\nimport {assembleFacetData} from './data/assemble';\nimport {sortArrayIndexField} from './data/calculate';\nimport {parseData} from './data/parse';\nimport {assembleLabelTitle} from './header/assemble';\nimport {getHeaderChannel, getHeaderProperty} from './header/common';\nimport {HEADER_CHANNELS, HEADER_TYPES} from './header/component';\nimport {parseFacetHeaders} from './header/parse';\nimport {parseChildrenLayoutSize} from './layoutsize/parse';\nimport {Model, ModelWithField} from './model';\nimport {assembleDomain, getFieldFromDomain} from './scale/domain';\nimport {assembleFacetSignals} from './selection/assemble';\n\nexport function facetSortFieldName(\n fieldDef: FacetFieldDef,\n sort: EncodingSortField,\n opt?: FieldRefOption\n) {\n return vgField(sort, {suffix: `by_${vgField(fieldDef)}`, ...(opt ?? {})});\n}\n\nexport class FacetModel extends ModelWithField {\n public readonly facet: EncodingFacetMapping;\n\n public readonly child: Model;\n\n public readonly children: Model[];\n\n constructor(spec: NormalizedFacetSpec, parent: Model, parentGivenName: string, config: Config) {\n super(spec, 'facet', parent, parentGivenName, config, spec.resolve);\n\n this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config);\n this.children = [this.child];\n\n this.facet = this.initFacet(spec.facet, config);\n }\n\n private initFacet(\n facet: FacetFieldDef | FacetMapping,\n config: Config\n ): EncodingFacetMapping {\n // clone to prevent side effect to the original spec\n if (!isFacetMapping(facet)) {\n return {facet: initChannelDef(facet, 'facet', config) as FacetFieldDef};\n }\n\n return reduce(\n facet,\n (normalizedFacet, fieldDef, channel) => {\n if (!contains([ROW, COLUMN], channel)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, 'facet'));\n return normalizedFacet;\n }\n\n if (fieldDef.field === undefined) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n return normalizedFacet;\n }\n\n // Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.\n normalizedFacet[channel] = initChannelDef(fieldDef, channel, config);\n return normalizedFacet;\n },\n {}\n );\n }\n\n public channelHasField(channel: ExtendedChannel): boolean {\n return !!this.facet[channel];\n }\n\n public fieldDef(channel: ExtendedChannel): TypedFieldDef {\n return this.facet[channel];\n }\n\n public parseData() {\n this.component.data = parseData(this);\n this.child.parseData();\n }\n\n public parseLayoutSize() {\n parseChildrenLayoutSize(this);\n }\n\n public parseSelections() {\n // As a facet has a single child, the selection components are the same.\n // The child maintains its selections to assemble signals, which remain\n // within its unit.\n this.child.parseSelections();\n this.component.selection = this.child.component.selection;\n }\n\n public parseMarkGroup() {\n this.child.parseMarkGroup();\n }\n\n public parseAxesAndHeaders() {\n this.child.parseAxesAndHeaders();\n\n parseFacetHeaders(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.child.assembleSelectionTopLevelSignals(signals);\n }\n\n public assembleSignals(): NewSignal[] {\n this.child.assembleSignals();\n return [];\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.child.assembleSelectionData(data);\n }\n\n private getHeaderLayoutMixins(): VgLayout {\n const layoutMixins: VgLayout = {};\n\n for (const channel of FACET_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const layoutHeaderComponent = this.component.layoutHeaders[channel];\n const headerComponent = layoutHeaderComponent[headerType];\n\n const {facetFieldDef} = layoutHeaderComponent;\n if (facetFieldDef) {\n const titleOrient = getHeaderProperty('titleOrient', facetFieldDef, this.config, channel);\n\n if (contains(['right', 'bottom'], titleOrient)) {\n const headerChannel = getHeaderChannel(channel, titleOrient);\n layoutMixins.titleAnchor = layoutMixins.titleAnchor ?? {};\n layoutMixins.titleAnchor[headerChannel] = 'end';\n }\n }\n\n if (headerComponent?.[0]) {\n // set header/footerBand\n const sizeType = channel === 'row' ? 'height' : 'width';\n const bandType = headerType === 'header' ? 'headerBand' : 'footerBand';\n if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) {\n // If facet child does not have size signal, then apply headerBand\n layoutMixins[bandType] = layoutMixins[bandType] ?? {};\n layoutMixins[bandType][channel] = 0.5;\n }\n\n if (layoutHeaderComponent.title) {\n layoutMixins.offset = layoutMixins.offset ?? {};\n layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10;\n }\n }\n }\n }\n return layoutMixins;\n }\n\n protected assembleDefaultLayout(): VgLayout {\n const {column, row} = this.facet;\n\n const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined;\n\n let align: LayoutAlign = 'all';\n\n // Do not align the cells if the scale corresponding to the direction is indepent.\n // We always align when we facet into both row and column.\n if (!row && this.component.resolve.scale.x === 'independent') {\n align = 'none';\n } else if (!column && this.component.resolve.scale.y === 'independent') {\n align = 'none';\n }\n\n return {\n ...this.getHeaderLayoutMixins(),\n\n ...(columns ? {columns} : {}),\n bounds: 'full',\n align\n };\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales.\n return this.child.assembleLayoutSignals();\n }\n\n private columnDistinctSignal() {\n if (this.parent && this.parent instanceof FacetModel) {\n // For nested facet, we will add columns to group mark instead\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return undefined;\n } else {\n // In facetNode.assemble(), the name is always this.getName('column') + '_layout'.\n const facetLayoutDataName = this.getName('column_domain');\n return {signal: `length(data('${facetLayoutDataName}'))`};\n }\n }\n\n public assembleGroup(signals: NewSignal[]) {\n if (this.parent && this.parent instanceof FacetModel) {\n // Provide number of columns for layout.\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return {\n ...(this.channelHasField('column')\n ? {\n encode: {\n update: {\n // TODO(https://github.com/vega/vega-lite/issues/2759):\n // Correct the signal for facet of concat of facet_column\n columns: {field: vgField(this.facet.column, {prefix: 'distinct'})}\n }\n }\n }\n : {}),\n ...super.assembleGroup(signals)\n };\n }\n return super.assembleGroup(signals);\n }\n\n /**\n * Aggregate cardinality for calculating size\n */\n private getCardinalityAggregateForChild() {\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n\n if (this.child instanceof FacetModel) {\n if (this.child.channelHasField('column')) {\n const field = vgField(this.child.facet.column);\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n }\n } else {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.child.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.child, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n } else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n }\n return {fields, ops, as};\n }\n\n private assembleFacet() {\n const {name, data} = this.component.data.facetRoot;\n const {row, column} = this.facet;\n const {fields, ops, as} = this.getCardinalityAggregateForChild();\n const groupby: string[] = [];\n\n for (const channel of FACET_CHANNELS) {\n const fieldDef = this.facet[channel];\n if (fieldDef) {\n groupby.push(vgField(fieldDef));\n\n const {bin, sort} = fieldDef;\n\n if (isBinning(bin)) {\n groupby.push(vgField(fieldDef, {binSuffix: 'end'}));\n }\n\n if (isSortField(sort)) {\n const {field, op = DEFAULT_SORT_OP} = sort;\n const outputName = facetSortFieldName(fieldDef, sort);\n if (row && column) {\n // For crossed facet, use pre-calculate field as it requires a different groupby\n // For each calculated field, apply max and assign them to the same name as\n // all values of the same group should be the same anyway.\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n } else {\n fields.push(field);\n ops.push(op);\n as.push(outputName);\n }\n } else if (isArray(sort)) {\n const outputName = sortArrayIndexField(fieldDef, channel);\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n }\n }\n }\n\n const cross = !!row && !!column;\n\n return {\n name,\n data,\n groupby,\n ...(cross || fields.length > 0\n ? {\n aggregate: {\n ...(cross ? {cross} : {}),\n ...(fields.length ? {fields, ops, as} : {})\n }\n }\n : {})\n };\n }\n\n private facetSortFields(channel: FacetChannel): string[] {\n const {facet} = this;\n const fieldDef = facet[channel];\n\n if (fieldDef) {\n if (isSortField(fieldDef.sort)) {\n return [facetSortFieldName(fieldDef, fieldDef.sort, {expr: 'datum'})];\n } else if (isArray(fieldDef.sort)) {\n return [sortArrayIndexField(fieldDef, channel, {expr: 'datum'})];\n }\n return [vgField(fieldDef, {expr: 'datum'})];\n }\n return [];\n }\n\n private facetSortOrder(channel: FacetChannel): SortOrder[] {\n const {facet} = this;\n const fieldDef = facet[channel];\n if (fieldDef) {\n const {sort} = fieldDef;\n const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending';\n return [order];\n }\n return [];\n }\n\n private assembleLabelTitle() {\n const {facet, config} = this;\n if (facet.facet) {\n // Facet always uses title to display labels\n return assembleLabelTitle(facet.facet, 'facet', config);\n }\n\n const ORTHOGONAL_ORIENT = {\n row: ['top', 'bottom'],\n column: ['left', 'right']\n };\n\n for (const channel of HEADER_CHANNELS) {\n if (facet[channel]) {\n const labelOrient = getHeaderProperty('labelOrient', facet[channel], config, channel);\n if (contains(ORTHOGONAL_ORIENT[channel], labelOrient)) {\n // Row/Column with orthogonal labelOrient must use title to display labels\n return assembleLabelTitle(facet[channel], channel, config);\n }\n }\n }\n return undefined;\n }\n\n public assembleMarks(): VgMarkGroup[] {\n const {child} = this;\n\n // If we facet by two dimensions, we need to add a cross operator to the aggregation\n // so that we create all groups\n const facetRoot = this.component.data.facetRoot;\n const data = assembleFacetData(facetRoot);\n\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n\n const title = this.assembleLabelTitle() || child.assembleTitle();\n const style = child.assembleGroupStyle();\n\n const markGroup = {\n name: this.getName('cell'),\n type: 'group',\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n from: {\n facet: this.assembleFacet()\n },\n // TODO: move this to after data\n sort: {\n field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(),\n order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat()\n },\n ...(data.length > 0 ? {data: data} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n ...child.assembleGroup(assembleFacetSignals(this, []))\n };\n\n return [markGroup];\n }\n\n protected getMapping() {\n return this.facet;\n }\n}\n","import {vgField} from '../../channeldef';\nimport {DEFAULT_SORT_OP, isSortField} from '../../sort';\nimport {FacetMapping} from '../../spec/facet';\nimport {facetSortFieldName} from '../facet';\nimport {DataFlowNode} from './dataflow';\nimport {JoinAggregateTransformNode} from './joinaggregate';\n\nexport function makeJoinAggregateFromFacet(\n parent: DataFlowNode,\n facet: FacetMapping\n): JoinAggregateTransformNode {\n const {row, column} = facet;\n if (row && column) {\n let newParent = null;\n // only need to make one for crossed facet\n for (const fieldDef of [row, column]) {\n if (isSortField(fieldDef.sort)) {\n const {field, op = DEFAULT_SORT_OP} = fieldDef.sort;\n parent = newParent = new JoinAggregateTransformNode(parent, {\n joinaggregate: [\n {\n op,\n field,\n as: facetSortFieldName(fieldDef, fieldDef.sort, {forAs: true})\n }\n ],\n groupby: [vgField(fieldDef)]\n });\n }\n }\n return newParent;\n }\n return null;\n}\n","import {AncestorParse, DataComponent} from '.';\nimport {\n Data,\n isGenerator,\n isGraticuleGenerator,\n isInlineData,\n isNamedData,\n isSequenceGenerator,\n isUrlData,\n DataSourceType,\n ParseValue\n} from '../../data';\nimport * as log from '../../log';\nimport {\n isAggregate,\n isBin,\n isCalculate,\n isDensity,\n isFilter,\n isFlatten,\n isFold,\n isImpute,\n isJoinAggregate,\n isLoess,\n isLookup,\n isPivot,\n isQuantile,\n isRegression,\n isSample,\n isStack,\n isTimeUnit,\n isWindow\n} from '../../transform';\nimport {deepEqual, mergeDeep} from '../../util';\nimport {isFacetModel, isLayerModel, isUnitModel, Model} from '../model';\nimport {requiresSelectionId} from '../selection';\nimport {materializeSelections} from '../selection/parse';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {CalculateNode} from './calculate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {DensityTransformNode} from './density';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {FilterInvalidNode} from './filterinvalid';\nimport {FlattenTransformNode} from './flatten';\nimport {FoldTransformNode} from './fold';\nimport {\n getImplicitFromEncoding,\n getImplicitFromFilterTransform,\n getImplicitFromSelection,\n ParseNode\n} from './formatparse';\nimport {GeoJSONNode} from './geojson';\nimport {GeoPointNode} from './geopoint';\nimport {GraticuleNode} from './graticule';\nimport {IdentifierNode} from './identifier';\nimport {ImputeNode} from './impute';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {makeJoinAggregateFromFacet} from './joinaggregatefacet';\nimport {LoessTransformNode} from './loess';\nimport {LookupNode} from './lookup';\nimport {PivotTransformNode} from './pivot';\nimport {QuantileTransformNode} from './quantile';\nimport {RegressionTransformNode} from './regression';\nimport {SampleTransformNode} from './sample';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nexport function findSource(data: Data, sources: SourceNode[]) {\n for (const other of sources) {\n const otherData = other.data;\n\n // if both datasets have a name defined, we cannot merge\n if (data.name && other.hasName() && data.name !== other.dataName) {\n continue;\n }\n\n // feature and mesh are mutually exclusive\n if (data['format']?.mesh && otherData.format?.feature) {\n continue;\n }\n\n // we have to extract the same feature or mesh\n if (\n (data['format']?.feature || otherData.format?.feature) &&\n data['format']?.feature !== otherData.format?.feature\n ) {\n continue;\n }\n if ((data['format']?.mesh || otherData.format?.mesh) && data['format']?.mesh !== otherData.format?.mesh) {\n continue;\n }\n\n if (isInlineData(data) && isInlineData(otherData)) {\n if (deepEqual(data.values, otherData.values)) {\n return other;\n }\n } else if (isUrlData(data) && isUrlData(otherData)) {\n if (data.url === otherData.url) {\n return other;\n }\n } else if (isNamedData(data)) {\n if (data.name === other.dataName) {\n return other;\n }\n }\n }\n return null;\n}\n\nfunction parseRoot(model: Model, sources: SourceNode[]): DataFlowNode {\n if (model.data || !model.parent) {\n // if the model defines a data source or is the root, create a source node\n\n if (model.data === null) {\n // data: null means we should ignore the parent's data so we just create a new data source\n const source = new SourceNode({values: []});\n sources.push(source);\n return source;\n }\n\n const existingSource = findSource(model.data, sources);\n\n if (existingSource) {\n if (!isGenerator(model.data)) {\n existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format);\n }\n\n // if the new source has a name but the existing one does not, we can set it\n if (!existingSource.hasName() && model.data.name) {\n existingSource.dataName = model.data.name;\n }\n\n return existingSource;\n } else {\n const source = new SourceNode(model.data);\n sources.push(source);\n return source;\n }\n } else {\n // If we don't have a source defined (overriding parent's data), use the parent's facet root or main.\n return model.parent.component.data.facetRoot\n ? model.parent.component.data.facetRoot\n : model.parent.component.data.main;\n }\n}\n\n/**\n * Parses a transform array into a chain of connected dataflow nodes.\n */\nexport function parseTransformArray(head: DataFlowNode, model: Model, ancestorParse: AncestorParse): DataFlowNode {\n let lookupCounter = 0;\n\n for (const t of model.transforms) {\n let derivedType: ParseValue = undefined;\n let transformNode: DataFlowNode;\n\n if (isCalculate(t)) {\n transformNode = head = new CalculateNode(head, t);\n derivedType = 'derived';\n } else if (isFilter(t)) {\n const implicit = getImplicitFromFilterTransform(t);\n transformNode = head = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse) ?? head;\n\n head = new FilterNode(head, model, t.filter);\n } else if (isBin(t)) {\n transformNode = head = BinNode.makeFromTransform(head, t, model);\n derivedType = 'number';\n } else if (isTimeUnit(t)) {\n derivedType = 'date';\n const parsedAs = ancestorParse.getWithExplicit(t.field);\n // Create parse node because the input to time unit is always date.\n if (parsedAs.value === undefined) {\n head = new ParseNode(head, {[t.field]: derivedType});\n ancestorParse.set(t.field, derivedType, false);\n }\n transformNode = head = TimeUnitNode.makeFromTransform(head, t);\n } else if (isAggregate(t)) {\n transformNode = head = AggregateNode.makeFromTransform(head, t);\n derivedType = 'number';\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n } else if (isLookup(t)) {\n transformNode = head = LookupNode.make(head, model, t, lookupCounter++);\n derivedType = 'derived';\n } else if (isWindow(t)) {\n transformNode = head = new WindowTransformNode(head, t);\n derivedType = 'number';\n } else if (isJoinAggregate(t)) {\n transformNode = head = new JoinAggregateTransformNode(head, t);\n derivedType = 'number';\n } else if (isStack(t)) {\n transformNode = head = StackNode.makeFromTransform(head, t);\n derivedType = 'derived';\n } else if (isFold(t)) {\n transformNode = head = new FoldTransformNode(head, t);\n derivedType = 'derived';\n } else if (isFlatten(t)) {\n transformNode = head = new FlattenTransformNode(head, t);\n derivedType = 'derived';\n } else if (isPivot(t)) {\n transformNode = head = new PivotTransformNode(head, t);\n derivedType = 'derived';\n } else if (isSample(t)) {\n head = new SampleTransformNode(head, t);\n } else if (isImpute(t)) {\n transformNode = head = ImputeNode.makeFromTransform(head, t);\n derivedType = 'derived';\n } else if (isDensity(t)) {\n transformNode = head = new DensityTransformNode(head, t);\n derivedType = 'derived';\n } else if (isQuantile(t)) {\n transformNode = head = new QuantileTransformNode(head, t);\n derivedType = 'derived';\n } else if (isRegression(t)) {\n transformNode = head = new RegressionTransformNode(head, t);\n derivedType = 'derived';\n } else if (isLoess(t)) {\n transformNode = head = new LoessTransformNode(head, t);\n derivedType = 'derived';\n } else {\n log.warn(log.message.invalidTransformIgnored(t));\n continue;\n }\n\n if (transformNode && derivedType !== undefined) {\n for (const field of transformNode.producedFields() ?? []) {\n ancestorParse.set(field, derivedType, false);\n }\n }\n }\n\n return head;\n}\n\n/*\nDescription of the dataflow (http://asciiflow.com/):\n +--------+\n | Source |\n +---+----+\n |\n v\n FormatParse\n (explicit)\n |\n v\n Transforms\n(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...)\n |\n v\n FormatParse\n (implicit)\n |\n v\n Binning (in `encoding`)\n |\n v\n Timeunit (in `encoding`)\n |\n v\nFormula From Sort Array\n |\n v\n +--+--+\n | Raw |\n +-----+\n |\n v\n Aggregate (in `encoding`)\n |\n v\n Stack (in `encoding`)\n |\n v\n Invalid Filter\n |\n v\n +----------+\n | Main |\n +----------+\n |\n v\n +-------+\n | Facet |----> \"column\", \"column-layout\", and \"row\"\n +-------+\n |\n v\n ...Child data...\n*/\n\nexport function parseData(model: Model): DataComponent {\n let head = parseRoot(model, model.component.data.sources);\n\n const {outputNodes, outputNodeRefCounts} = model.component.data;\n const ancestorParse = model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse();\n const data = model.data;\n\n if (isGenerator(data)) {\n // insert generator transform\n if (isSequenceGenerator(data)) {\n head = new SequenceNode(head, data.sequence);\n } else if (isGraticuleGenerator(data)) {\n head = new GraticuleNode(head, data.graticule);\n }\n // no parsing necessary for generator\n ancestorParse.parseNothing = true;\n } else if (data?.format?.parse === null) {\n // format.parse: null means disable parsing\n ancestorParse.parseNothing = true;\n }\n\n head = ParseNode.makeExplicit(head, model, ancestorParse) ?? head;\n\n // Default discrete selections require an identifer transform to\n // uniquely identify data points. Add this transform at the head of\n // the pipeline such that the identifier field is available for all\n // subsequent datasets. During optimization, we will remove this\n // transform if it proves to be unnecessary. Additional identifier\n // transforms will be necessary when new tuples are constructed\n // (e.g., post-aggregation).\n head = new IdentifierNode(head);\n\n // HACK: This is equivalent for merging bin extent for union scale.\n // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale\n const parentIsLayer = model.parent && isLayerModel(model.parent);\n if (isUnitModel(model) || isFacetModel(model)) {\n if (parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n }\n\n if (model.transforms.length > 0) {\n head = parseTransformArray(head, model, ancestorParse);\n }\n\n // create parse nodes for fields that need to be parsed (or flattened) implicitly\n const implicitSelection = getImplicitFromSelection(model);\n const implicitEncoding = getImplicitFromEncoding(model);\n head = ParseNode.makeWithAncestors(head, {}, {...implicitSelection, ...implicitEncoding}, ancestorParse) ?? head;\n\n if (isUnitModel(model)) {\n head = GeoJSONNode.parseAll(head, model);\n head = GeoPointNode.parseAll(head, model);\n }\n\n if (isUnitModel(model) || isFacetModel(model)) {\n if (!parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n\n head = TimeUnitNode.makeFromEncoding(head, model) ?? head;\n head = CalculateNode.parseAllForSortIndex(head, model);\n }\n\n // add an output node pre aggregation\n const rawName = model.getDataName(DataSourceType.Raw);\n const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts);\n outputNodes[rawName] = raw;\n head = raw;\n\n if (isUnitModel(model)) {\n const agg = AggregateNode.makeFromEncoding(head, model);\n if (agg) {\n head = agg;\n\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n }\n head = ImputeNode.makeFromEncoding(head, model) ?? head;\n head = StackNode.makeFromEncoding(head, model) ?? head;\n }\n\n if (isUnitModel(model)) {\n head = FilterInvalidNode.make(head, model) ?? head;\n }\n\n // output node for marks\n const mainName = model.getDataName(DataSourceType.Main);\n const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts);\n outputNodes[mainName] = main;\n head = main;\n\n if (isUnitModel(model)) {\n materializeSelections(model, main);\n }\n\n // add facet marker\n let facetRoot = null;\n if (isFacetModel(model)) {\n const facetName = model.getName('facet');\n\n // Derive new aggregate for facet's sort field\n // augment data source with new fields for crossed facet\n head = makeJoinAggregateFromFacet(head, model.facet) ?? head;\n\n facetRoot = new FacetNode(head, model, facetName, main.getSource());\n outputNodes[facetName] = facetRoot;\n }\n\n return {\n ...model.component.data,\n outputNodes,\n outputNodeRefCounts,\n raw,\n main,\n facetRoot,\n ancestorParse\n };\n}\n","import {NewSignal} from 'vega';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isHConcatSpec, isVConcatSpec, NormalizedConcatSpec, NormalizedSpec} from '../spec';\nimport {VgLayout} from '../vega.schema';\nimport {keys} from '../util';\nimport {VgData} from '../vega.schema';\nimport {buildModel} from './buildmodel';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {parseConcatLayoutSize} from './layoutsize/parse';\nimport {Model} from './model';\n\nexport class ConcatModel extends Model {\n public readonly children: Model[];\n\n constructor(spec: NormalizedConcatSpec, parent: Model, parentGivenName: string, config: Config) {\n super(spec, 'concat', parent, parentGivenName, config, spec.resolve);\n\n if (spec.resolve?.axis?.x === 'shared' || spec.resolve?.axis?.y === 'shared') {\n log.warn(log.message.CONCAT_CANNOT_SHARE_AXIS);\n }\n\n this.children = this.getChildren(spec).map((child, i) => {\n return buildModel(child, this, this.getName('concat_' + i), undefined, config);\n });\n }\n\n public parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n\n public parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n\n public parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n\n public parseAxesAndHeaders() {\n for (const child of this.children) {\n child.parseAxesAndHeaders();\n }\n\n // TODO(#2415): support shared axes\n }\n\n private getChildren(spec: NormalizedConcatSpec): NormalizedSpec[] {\n if (isVConcatSpec(spec)) {\n return spec.vconcat;\n } else if (isHConcatSpec(spec)) {\n return spec.hconcat;\n }\n return spec.concat;\n }\n\n public parseLayoutSize() {\n parseConcatLayoutSize(this);\n }\n\n public parseAxisGroup(): void {\n return null;\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n\n public assembleSignals(): NewSignal[] {\n this.children.forEach(child => child.assembleSignals());\n return [];\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n const layoutSignals = assembleLayoutSignals(this);\n\n for (const child of this.children) {\n layoutSignals.push(...child.assembleLayoutSignals());\n }\n\n return layoutSignals;\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n\n public assembleMarks(): any[] {\n // only children have marks\n return this.children.map(child => {\n const title = child.assembleTitle();\n const style = child.assembleGroupStyle();\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n\n return {\n type: 'group',\n name: child.getName('group'),\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n ...child.assembleGroup()\n };\n });\n }\n\n protected assembleDefaultLayout(): VgLayout {\n const columns = this.layout.columns;\n return {\n ...(columns != null ? {columns: columns} : {}),\n bounds: 'full',\n // Use align each so it can work with multiple plots with different size\n align: 'each'\n };\n }\n}\n","import {Axis as VgAxis, SignalRef, Text} from 'vega';\nimport {\n Axis,\n AxisPart,\n AxisPropsWithConditionAndSignal,\n COMMON_AXIS_PROPERTIES_INDEX,\n ConditionalAxisProp,\n SignalAxisProp\n} from '../../axis';\nimport {FieldDefBase} from '../../channeldef';\nimport {duplicate, Flag, keys} from '../../util';\nimport {Split} from '../split';\nimport {isSignalRef} from '../../vega.schema';\n\nfunction isFalseOrNull(v: any) {\n return v === false || v === null;\n}\n\nexport type AxisComponentProps = Omit &\n Omit & {\n title: Text | FieldDefBase[] | SignalRef;\n labelExpr: string;\n disable: boolean;\n };\n\nconst AXIS_COMPONENT_PROPERTIES_INDEX: Flag = {\n disable: 1,\n gridScale: 1,\n scale: 1,\n ...COMMON_AXIS_PROPERTIES_INDEX,\n labelExpr: 1,\n encode: 1\n};\n\nexport const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX);\n\nexport class AxisComponent extends Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {},\n public mainExtracted = false\n ) {\n super();\n }\n\n public clone() {\n return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted);\n }\n\n public hasAxisPart(part: AxisPart) {\n // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme.\n\n if (part === 'axis') {\n // always has the axis container part\n return true;\n }\n\n if (part === 'grid' || part === 'title') {\n return !!this.get(part);\n }\n // Other parts are enabled by default, so they should not be false or null.\n return !isFalseOrNull(this.get(part));\n }\n\n public hasOrientSignalRef() {\n return isSignalRef(this.explicit.orient);\n }\n}\n\nexport interface AxisComponentIndex {\n x?: AxisComponent[];\n y?: AxisComponent[];\n}\n\nexport interface AxisIndex {\n x?: Axis;\n y?: Axis;\n}\n","import {getSecondaryRangeChannel, PositionScaleChannel} from '../../channel';\nimport {getFieldOrDatumDef} from '../../channeldef';\nimport {formatCustomType, isCustomFormatType} from '../format';\nimport {UnitModel} from '../unit';\n\nexport function labels(model: UnitModel, channel: PositionScaleChannel, specifiedLabelsSpec: any) {\n const {encoding, config} = model;\n\n const fieldOrDatumDef =\n getFieldOrDatumDef(encoding[channel]) ?? getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]);\n const axis = model.axis(channel) || {};\n const {format, formatType} = axis;\n\n if (isCustomFormatType(formatType)) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n\n return specifiedLabelsSpec;\n}\n","import {AxisEncode as VgAxisEncode, AxisOrient} from 'vega';\nimport {Axis, AXIS_PARTS, isAxisProperty, isConditionalAxisValue} from '../../axis';\nimport {PositionScaleChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {getFieldOrDatumDef, PositionDatumDef, PositionFieldDef} from '../../channeldef';\nimport {getFirstDefined, isEmpty, keys, normalizeAngle} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {mergeTitleComponent} from '../common';\nimport {guideEncodeEntry} from '../guide';\nimport {LayerModel} from '../layer';\nimport {parseGuideResolve} from '../resolve';\nimport {defaultTieBreaker, Explicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {AxisComponent, AxisComponentIndex, AxisComponentProps, AXIS_COMPONENT_PROPERTIES} from './component';\nimport {getAxisConfig, getAxisConfigs} from './config';\nimport * as encode from './encode';\nimport {AxisRuleParams, axisRules, defaultOrient, getFieldDefTitle, getLabelAngle} from './properties';\n\nexport function parseUnitAxes(model: UnitModel): AxisComponentIndex {\n return POSITION_SCALE_CHANNELS.reduce((axis, channel) => {\n if (model.component.scales[channel]) {\n axis[channel] = [parseAxis(channel, model)];\n }\n return axis;\n }, {} as AxisComponentIndex);\n}\n\nconst OPPOSITE_ORIENT: Record = {\n bottom: 'top',\n top: 'bottom',\n left: 'right',\n right: 'left'\n};\n\nexport function parseLayerAxes(model: LayerModel) {\n const {axes, resolve} = model.component;\n const axisCount: Record = {top: 0, bottom: 0, right: 0, left: 0};\n\n for (const child of model.children) {\n child.parseAxesAndHeaders();\n\n for (const channel of keys(child.component.axes)) {\n resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel);\n if (resolve.axis[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n\n axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]);\n\n if (!axes[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the axis shared.\n // Thus, mark axis as independent and remove the axis component.\n resolve.axis[channel] = 'independent';\n delete axes[channel];\n }\n }\n }\n }\n\n // Move axes to layer's axis component and merge shared axes\n for (const channel of POSITION_SCALE_CHANNELS) {\n for (const child of model.children) {\n if (!child.component.axes[channel]) {\n // skip if the child does not have a particular axis\n continue;\n }\n\n if (resolve.axis[channel] === 'independent') {\n // If axes are independent, concat the axisComponent array.\n axes[channel] = (axes[channel] ?? []).concat(child.component.axes[channel]);\n\n // Automatically adjust orient\n for (const axisComponent of child.component.axes[channel]) {\n const {value: orient, explicit} = axisComponent.getWithExplicit('orient');\n if (isSignalRef(orient)) {\n continue;\n }\n\n if (axisCount[orient] > 0 && !explicit) {\n // Change axis orient if the number do not match\n const oppositeOrient = OPPOSITE_ORIENT[orient];\n if (axisCount[orient] > axisCount[oppositeOrient]) {\n axisComponent.set('orient', oppositeOrient, false);\n }\n }\n axisCount[orient]++;\n\n // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset?\n }\n }\n\n // After merging, make sure to remove axes from child\n delete child.component.axes[channel];\n }\n\n // Suppress grid lines for dual axis charts (https://github.com/vega/vega-lite/issues/4676)\n if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) {\n for (const axisCmpt of axes[channel]) {\n if (!!axisCmpt.get('grid') && !axisCmpt.explicit.grid) {\n axisCmpt.implicit.grid = false;\n }\n }\n }\n }\n}\n\nfunction mergeAxisComponents(\n mergedAxisCmpts: AxisComponent[],\n childAxisCmpts: readonly AxisComponent[]\n): AxisComponent[] {\n if (mergedAxisCmpts) {\n // FIXME: this is a bit wrong once we support multiple axes\n if (mergedAxisCmpts.length !== childAxisCmpts.length) {\n return undefined; // Cannot merge axis component with different number of axes.\n }\n const length = mergedAxisCmpts.length;\n for (let i = 0; i < length; i++) {\n const merged = mergedAxisCmpts[i];\n const child = childAxisCmpts[i];\n\n if (!!merged !== !!child) {\n return undefined;\n } else if (merged && child) {\n const mergedOrient = merged.getWithExplicit('orient');\n const childOrient = child.getWithExplicit('orient');\n\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n\n // Cannot merge due to inconsistent orient\n return undefined;\n } else {\n mergedAxisCmpts[i] = mergeAxisComponent(merged, child);\n }\n }\n }\n } else {\n // For first one, return a copy of the child\n return childAxisCmpts.map(axisComponent => axisComponent.clone());\n }\n return mergedAxisCmpts;\n}\n\nfunction mergeAxisComponent(merged: AxisComponent, child: AxisComponent): AxisComponent {\n for (const prop of AXIS_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(\n merged.getWithExplicit(prop),\n child.getWithExplicit(prop),\n prop,\n 'axis',\n\n // Tie breaker function\n (v1: Explicit, v2: Explicit) => {\n switch (prop) {\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'gridScale':\n return {\n explicit: v1.explicit, // keep the old explicit\n value: getFirstDefined(v1.value, v2.value)\n };\n }\n return defaultTieBreaker(v1, v2, prop, 'axis');\n }\n );\n merged.setWithExplicit(prop, mergedValueWithExplicit);\n }\n return merged;\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isExplicit(\n value: T,\n property: keyof AxisComponentProps,\n axis: Axis,\n model: UnitModel,\n channel: PositionScaleChannel\n) {\n if (property === 'disable') {\n return axis !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit\n }\n\n axis = axis || {};\n\n switch (property) {\n case 'titleAngle':\n case 'labelAngle':\n return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle));\n case 'values':\n return !!axis.values;\n // specified axis.values is already respected, but may get transformed.\n case 'encode':\n // both VL axis.encoding and axis.labelAngle affect VG axis.encode\n return !!axis.encoding || !!axis.labelAngle;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (value === getFieldDefTitle(model, channel)) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === axis[property];\n}\n\n/**\n * Properties to always include values from config\n */\nconst propsToAlwaysIncludeConfig = new Set([\n 'grid', // Grid is an exception because we need to set grid = true to generate another grid axis\n 'translate', // translate has dependent logic for bar's bin position and it's 0.5 by default in Vega. If a config overrides this value, we need to know.\n // the rest are not axis configs in Vega, but are in VL, so we need to set too.\n 'format',\n 'formatType',\n 'orient',\n 'labelExpr',\n 'tickCount',\n 'position',\n 'tickMinStep'\n]);\n\nfunction parseAxis(channel: PositionScaleChannel, model: UnitModel): AxisComponent {\n let axis = model.axis(channel);\n\n const axisComponent = new AxisComponent();\n\n const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]) as\n | PositionFieldDef\n | PositionDatumDef;\n\n const {mark, config} = model;\n\n const orient =\n axis?.orient ||\n config[channel === 'x' ? 'axisX' : 'axisY']?.orient ||\n config.axis?.orient ||\n defaultOrient(channel);\n\n const scaleType = model.getScaleComponent(channel).get('type');\n\n const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config);\n\n const disable =\n axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis?.style, axisConfigs).configValue;\n axisComponent.set('disable', disable, axis !== undefined);\n if (disable) {\n return axisComponent;\n }\n\n axis = axis || {};\n\n const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs);\n\n const ruleParams: AxisRuleParams = {\n fieldOrDatumDef,\n axis,\n channel,\n model,\n scaleType,\n orient,\n labelAngle,\n mark,\n config\n };\n // 1.2. Add properties\n for (const property of AXIS_COMPONENT_PROPERTIES) {\n const value =\n property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined;\n\n const hasValue = value !== undefined;\n\n const explicit = isExplicit(value, property, axis, model, channel);\n\n if (hasValue && explicit) {\n axisComponent.set(property, value, explicit);\n } else {\n const {configValue = undefined, configFrom = undefined} =\n isAxisProperty(property) && property !== 'values'\n ? getAxisConfig(property, config.style, axis.style, axisConfigs)\n : {};\n const hasConfigValue = configValue !== undefined;\n\n if (hasValue && !hasConfigValue) {\n // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config)\n axisComponent.set(property, value, explicit);\n } else if (\n // Cases need implicit values\n // 1. Axis config that aren't available in Vega\n !(configFrom === 'vgAxisConfig') ||\n // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details)\n (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) ||\n // 3. Conditional axis values and signals\n isConditionalAxisValue(configValue) ||\n isSignalRef(configValue)\n ) {\n // If a config is specified and is conditional, copy conditional value from axis config\n axisComponent.set(property, configValue, false);\n }\n }\n }\n\n // 2) Add guide encode definition groups\n const axisEncoding = axis.encoding ?? {};\n const axisEncode = AXIS_PARTS.reduce((e: VgAxisEncode, part) => {\n if (!axisComponent.hasAxisPart(part)) {\n // No need to create encode for a disabled part.\n return e;\n }\n\n const axisEncodingPart = guideEncodeEntry(axisEncoding[part] ?? {}, model);\n\n const value = part === 'labels' ? encode.labels(model, channel, axisEncodingPart) : axisEncodingPart;\n\n if (value !== undefined && !isEmpty(value)) {\n e[part] = {update: value};\n }\n return e;\n }, {} as VgAxisEncode);\n\n // FIXME: By having encode as one property, we won't have fine grained encode merging.\n if (!isEmpty(axisEncode)) {\n axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined);\n }\n\n return axisComponent;\n}\n","import {getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {isContinuousFieldOrDatumDef} from '../../channeldef';\nimport {Encoding} from '../../encoding';\nimport * as log from '../../log';\nimport {isStep, LayoutSizeMixins} from '../../spec/base';\n\nexport function initLayoutSize({encoding, size}: {encoding: Encoding; size: LayoutSizeMixins}) {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n if (isStep(size[sizeType])) {\n if (isContinuousFieldOrDatumDef(encoding[channel])) {\n delete size[sizeType];\n log.warn(log.message.stepDropped(sizeType));\n }\n }\n }\n\n return size;\n}\n","import {Orientation} from 'vega';\nimport {isBinned, isBinning} from '../../bin';\nimport {isContinuousFieldOrDatumDef, isFieldDef, isNumericDataDef, TypedFieldDef} from '../../channeldef';\nimport {Config} from '../../config';\nimport {Encoding, isAggregate} from '../../encoding';\nimport * as log from '../../log';\nimport {\n AREA,\n BAR,\n BAR_CORNER_RADIUS_INDEX as BAR_CORNER_RADIUS_END_INDEX,\n CIRCLE,\n IMAGE,\n LINE,\n Mark,\n MarkDef,\n POINT,\n RECT,\n RULE,\n SQUARE,\n TEXT,\n TICK\n} from '../../mark';\nimport {QUANTITATIVE, TEMPORAL} from '../../type';\nimport {contains, getFirstDefined} from '../../util';\nimport {getMarkConfig, getMarkPropOrConfig} from '../common';\n\nexport function initMarkdef(markDef: MarkDef, encoding: Encoding, config: Config) {\n // set orient, which can be overridden by rules as sometimes the specified orient is invalid.\n const specifiedOrient = getMarkPropOrConfig('orient', markDef, config);\n markDef.orient = orient(markDef.type, encoding, specifiedOrient);\n if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) {\n log.warn(log.message.orientOverridden(markDef.orient, specifiedOrient));\n }\n\n if (markDef.type === 'bar' && markDef.orient) {\n const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config);\n if (cornerRadiusEnd !== undefined) {\n const newProps =\n (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2)\n ? ['cornerRadius']\n : BAR_CORNER_RADIUS_END_INDEX[markDef.orient];\n\n for (const newProp of newProps) {\n markDef[newProp] = cornerRadiusEnd;\n }\n\n if (markDef.cornerRadiusEnd !== undefined) {\n delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius\n }\n }\n }\n\n // set opacity and filled if not specified in mark config\n const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config);\n if (specifiedOpacity === undefined) {\n markDef.opacity = opacity(markDef.type, encoding);\n }\n\n // set cursor, which should be pointer if href channel is present unless otherwise specified\n const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config);\n if (specifiedCursor === undefined) {\n markDef.cursor = cursor(markDef, encoding, config);\n }\n\n return markDef;\n}\n\nfunction cursor(markDef: MarkDef, encoding: Encoding, config: Config) {\n if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) {\n return 'pointer';\n }\n return markDef.cursor;\n}\n\nfunction opacity(mark: Mark, encoding: Encoding) {\n if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) {\n // point-based marks\n if (!isAggregate(encoding)) {\n return 0.7;\n }\n }\n return undefined;\n}\n\nexport function defaultFilled(markDef: MarkDef, config: Config, {graticule}: {graticule: boolean}) {\n if (graticule) {\n return false;\n }\n const filledConfig = getMarkConfig('filled', markDef, config);\n const mark = markDef.type;\n return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE);\n}\n\nfunction orient(mark: Mark, encoding: Encoding, specifiedOrient: Orientation): Orientation {\n switch (mark) {\n case POINT:\n case CIRCLE:\n case SQUARE:\n case TEXT:\n case RECT:\n case IMAGE:\n // orient is meaningless for these marks.\n return undefined;\n }\n\n const {x, y, x2, y2} = encoding;\n\n switch (mark) {\n case BAR:\n if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) {\n return 'vertical';\n }\n if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) {\n return 'horizontal';\n }\n if (y2 || x2) {\n // Ranged bar does not always have clear orientation, so we allow overriding\n if (specifiedOrient) {\n return specifiedOrient;\n }\n\n // If y is range and x is non-range, non-bin Q, y is likely a prebinned field\n if (!x2) {\n if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) {\n return 'horizontal';\n }\n }\n\n // If x is range and y is non-range, non-bin Q, x is likely a prebinned field\n if (!y2) {\n if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) {\n return 'vertical';\n }\n }\n }\n\n // falls through\n case RULE:\n // return undefined for line segment rule and bar with both axis ranged\n // we have to ignore the case that the data are already binned\n if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) {\n return undefined;\n }\n\n // falls through\n case AREA:\n // If there are range for both x and y, y (vertical) has higher precedence.\n if (y2) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n } else {\n return 'vertical';\n }\n } else if (x2) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n } else {\n return 'horizontal';\n }\n } else if (mark === RULE) {\n if (x && !y) {\n return 'vertical';\n } else if (y && !x) {\n return 'horizontal';\n }\n }\n\n // falls through\n case LINE:\n case TICK: {\n // Tick is opposite to bar, line, area and never have ranged mark.\n const xIsContinuous = isContinuousFieldOrDatumDef(x);\n const yIsContinuous = isContinuousFieldOrDatumDef(y);\n if (xIsContinuous && !yIsContinuous) {\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n } else if (!xIsContinuous && yIsContinuous) {\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n } else if (xIsContinuous && yIsContinuous) {\n const xDef = x as TypedFieldDef; // we can cast here since they are surely fieldDef\n const yDef = y as TypedFieldDef;\n\n const xIsTemporal = xDef.type === TEMPORAL;\n const yIsTemporal = yDef.type === TEMPORAL;\n\n // temporal without timeUnit is considered continuous, but better serves as dimension\n if (xIsTemporal && !yIsTemporal) {\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n } else if (!xIsTemporal && yIsTemporal) {\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n }\n\n if (!xDef.aggregate && yDef.aggregate) {\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n } else if (xDef.aggregate && !yDef.aggregate) {\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n }\n\n if (specifiedOrient) {\n // When ambiguous, use user specified one.\n return specifiedOrient;\n }\n\n return 'vertical';\n } else {\n // Discrete x Discrete case\n if (specifiedOrient) {\n // When ambiguous, use user specified one.\n return specifiedOrient;\n }\n\n return undefined;\n }\n }\n }\n return 'vertical';\n}\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const arc: MarkCompiler = {\n vgMark: 'arc',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n\n // arcs are rectangles in polar coordinates\n ...encode.rectPosition(model, 'radius', 'arc'),\n ...encode.rectPosition(model, 'theta', 'arc')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const area: MarkCompiler = {\n vgMark: 'area',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'include',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'horizontal'\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'vertical'\n }),\n ...encode.defined(model)\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const bar: MarkCompiler = {\n vgMark: 'rect',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x', 'bar'),\n ...encode.rectPosition(model, 'y', 'bar')\n };\n }\n};\n","import {GeoShapeTransform as VgGeoShapeTransform} from 'vega';\nimport {isFieldDef, vgField} from '../../channeldef';\nimport {GEOJSON} from '../../type';\nimport {VgPostEncodingTransform} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const geoshape: MarkCompiler = {\n vgMark: 'shape',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n })\n };\n },\n postEncodingTransform: (model: UnitModel): VgPostEncodingTransform[] => {\n const {encoding} = model;\n const shapeDef = encoding.shape;\n\n const transform: VgGeoShapeTransform = {\n type: 'geoshape',\n projection: model.projectionName(),\n // as: 'shape',\n ...(shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON\n ? {field: vgField(shapeDef, {expr: 'datum'})}\n : {})\n };\n return [transform];\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const image: MarkCompiler = {\n vgMark: 'image',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'ignore',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x', 'image'),\n ...encode.rectPosition(model, 'y', 'image'),\n ...encode.text(model, 'url')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const line: MarkCompiler = {\n vgMark: 'line',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's line size is strokeWidth\n }),\n ...encode.defined(model)\n };\n }\n};\n\nexport const trail: MarkCompiler = {\n vgMark: 'trail',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model),\n ...encode.defined(model)\n };\n }\n};\n","import {Config} from '../../config';\nimport {VgEncodeEntry} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nfunction encodeEntry(model: UnitModel, fixedShape?: 'circle' | 'square') {\n const {config} = model;\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model),\n ...encode.nonPosition('angle', model),\n ...shapeMixins(model, config, fixedShape)\n };\n}\n\nexport function shapeMixins(model: UnitModel, config: Config, fixedShape?: 'circle' | 'square'): VgEncodeEntry {\n if (fixedShape) {\n return {shape: {value: fixedShape}};\n }\n return encode.nonPosition('shape', model);\n}\n\nexport const point: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model);\n }\n};\n\nexport const circle: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model, 'circle');\n }\n};\n\nexport const square: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model, 'square');\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const rect: MarkCompiler = {\n vgMark: 'rect',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x', 'rect'),\n ...encode.rectPosition(model, 'y', 'rect')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const rule: MarkCompiler = {\n vgMark: 'rule',\n encodeEntry: (model: UnitModel) => {\n const {markDef} = model;\n const orient = markDef.orient;\n\n if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) {\n // Show nothing if we have none of x, y, lat, and long.\n return {};\n }\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'vertical' // include x2 for horizontal or line segment rule\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'horizontal' // include y2 for vertical or line segment rule\n }),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's rule size is strokeWidth\n })\n };\n }\n};\n","import {Config} from '../../config';\nimport {Encoding} from '../../encoding';\nimport {MarkDef} from '../../mark';\nimport {getMarkPropOrConfig} from '../common';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const text: MarkCompiler = {\n vgMark: 'text',\n\n encodeEntry: (model: UnitModel) => {\n const {config, encoding} = model;\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'include',\n baseline: 'include',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'include'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.text(model),\n ...encode.nonPosition('size', model, {\n vgChannel: 'fontSize' // VL's text size is fontSize\n }),\n ...encode.nonPosition('angle', model),\n ...encode.valueIfDefined('align', align(model.markDef, encoding, config)),\n ...encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config)),\n ...encode.pointPosition('radius', model, {defaultPos: null, isMidPoint: true}),\n ...encode.pointPosition('theta', model, {defaultPos: null, isMidPoint: true})\n };\n }\n};\n\nfunction align(markDef: MarkDef, encoding: Encoding, config: Config) {\n const a = getMarkPropOrConfig('align', markDef, config);\n if (a === undefined) {\n return 'center';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n\nfunction baseline(markDef: MarkDef, encoding: Encoding, config: Config) {\n const b = getMarkPropOrConfig('baseline', markDef, config);\n if (b === undefined) {\n return 'middle';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n","import {SignalRef} from 'vega';\nimport {isNumber} from 'vega-util';\nimport {getViewConfigDiscreteStep} from '../../config';\nimport {isVgRangeStep} from '../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../common';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const tick: MarkCompiler = {\n vgMark: 'rect',\n\n encodeEntry: (model: UnitModel) => {\n const {config, markDef} = model;\n const orient = markDef.orient;\n\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width';\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n\n ...encode.pointPosition('x', model, {defaultPos: 'mid', vgChannel: 'xc'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid', vgChannel: 'yc'}),\n\n // size / thickness => width / height\n ...encode.nonPosition('size', model, {\n defaultValue: defaultSize(model),\n vgChannel: vgSizeChannel\n }),\n [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config))\n };\n }\n};\n\nfunction defaultSize(model: UnitModel): number | SignalRef {\n const {config, markDef} = model;\n const {orient} = markDef;\n\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y');\n\n const markPropOrConfig =\n getMarkPropOrConfig('size', markDef, config, {vgChannel: vgSizeChannel}) ?? config.tick.bandSize;\n\n if (markPropOrConfig !== undefined) {\n return markPropOrConfig;\n } else {\n const scaleRange = scale ? scale.get('range') : undefined;\n if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return (scaleRange.step * 3) / 4;\n }\n\n const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel);\n\n return (defaultViewStep * 3) / 4;\n }\n}\n","import {isArray} from 'vega-util';\nimport {FieldRefOption, isFieldDef, isValueDef, vgField} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {isAggregate, pathGroupingFields} from '../../encoding';\nimport {AREA, BAR, isPathMark, LINE, Mark, TRAIL} from '../../mark';\nimport {isSortByEncoding, isSortField} from '../../sort';\nimport {contains, getFirstDefined, isNullOrFalse, keys, omit, pick} from '../../util';\nimport {VgCompare, VgEncodeEntry, VG_CORNERRADIUS_CHANNELS} from '../../vega.schema';\nimport {getMarkConfig, getMarkPropOrConfig, getStyles, signalOrValueRef, sortParams} from '../common';\nimport {UnitModel} from '../unit';\nimport {arc} from './arc';\nimport {area} from './area';\nimport {bar} from './bar';\nimport {MarkCompiler} from './base';\nimport {geoshape} from './geoshape';\nimport {image} from './image';\nimport {line, trail} from './line';\nimport {circle, point, square} from './point';\nimport {rect} from './rect';\nimport {rule} from './rule';\nimport {text} from './text';\nimport {tick} from './tick';\n\nconst markCompiler: Record = {\n arc,\n area,\n bar,\n circle,\n geoshape,\n image,\n line,\n point,\n rect,\n rule,\n square,\n text,\n tick,\n trail\n};\n\nexport function parseMarkGroups(model: UnitModel): any[] {\n if (contains([LINE, AREA, TRAIL], model.mark)) {\n const details = pathGroupingFields(model.mark, model.encoding);\n if (details.length > 0) {\n return getPathGroups(model, details);\n }\n // otherwise use standard mark groups\n } else if (contains([BAR], model.mark)) {\n const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop =>\n getMarkPropOrConfig(prop, model.markDef, model.config)\n );\n if (model.stack && !model.fieldDef('size') && hasCornerRadius) {\n return getGroupsForStackedBarWithCornerRadius(model);\n }\n }\n\n return getMarkGroup(model);\n}\n\nconst FACETED_PATH_PREFIX = 'faceted_path_';\n\nfunction getPathGroups(model: UnitModel, details: string[]) {\n // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?)\n\n return [\n {\n name: model.getName('pathgroup'),\n type: 'group',\n from: {\n facet: {\n name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main),\n data: model.requestDataName(DataSourceType.Main),\n groupby: details\n }\n },\n encode: {\n update: {\n width: {field: {group: 'width'}},\n height: {field: {group: 'height'}}\n }\n },\n // With subfacet for line/area group, need to use faceted data from above.\n marks: getMarkGroup(model, {fromPrefix: FACETED_PATH_PREFIX})\n }\n ];\n}\n\nconst STACK_GROUP_PREFIX = 'stack_group_';\n\n/**\n * We need to put stacked bars into groups in order to enable cornerRadius for stacks.\n * If stack is used and the model doesn't have size encoding, we put the mark into groups,\n * and apply cornerRadius properties at the group.\n */\nfunction getGroupsForStackedBarWithCornerRadius(model: UnitModel) {\n // Generate the mark\n const [mark] = getMarkGroup(model, {fromPrefix: STACK_GROUP_PREFIX});\n\n // Get the scale for the stacked field\n const fieldScale = model.scaleName(model.stack.fieldChannel);\n const stackField = (opt: FieldRefOption = {}) => model.vgField(model.stack.fieldChannel, opt);\n // Find the min/max of the pixel value on the stacked direction\n const stackFieldGroup = (func: 'min' | 'max', expr: 'datum' | 'parent') => {\n const vgFieldMinMax = [\n stackField({prefix: 'min', suffix: 'start', expr}),\n stackField({prefix: 'max', suffix: 'start', expr}),\n stackField({prefix: 'min', suffix: 'end', expr}),\n stackField({prefix: 'max', suffix: 'end', expr})\n ];\n return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`;\n };\n\n let groupUpdate: VgEncodeEntry;\n let innerGroupUpdate: VgEncodeEntry;\n\n // Build the encoding for group and an inner group\n if (model.stack.fieldChannel === 'x') {\n // Move cornerRadius, y/yc/y2/height properties to group\n // Group x/x2 should be the min/max of the marks within\n groupUpdate = {\n ...pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS]),\n x: {signal: stackFieldGroup('min', 'datum')},\n x2: {signal: stackFieldGroup('max', 'datum')},\n clip: {value: true}\n };\n // Inner group should revert the x translation, and pass height through\n innerGroupUpdate = {\n x: {field: {group: 'x'}, mult: -1},\n height: {field: {group: 'height'}}\n };\n // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group)\n // This is why size encoding is not supported yet\n mark.encode.update = {\n ...omit(mark.encode.update, ['y', 'yc', 'y2']),\n height: {field: {group: 'height'}}\n };\n } else {\n groupUpdate = {\n ...pick(mark.encode.update, ['x', 'xc', 'x2', 'width']),\n y: {signal: stackFieldGroup('min', 'datum')},\n y2: {signal: stackFieldGroup('max', 'datum')},\n clip: {value: true}\n };\n innerGroupUpdate = {\n y: {field: {group: 'y'}, mult: -1},\n width: {field: {group: 'width'}}\n };\n mark.encode.update = {\n ...omit(mark.encode.update, ['x', 'xc', 'x2']),\n width: {field: {group: 'width'}}\n };\n }\n\n // Deal with cornerRadius properties\n for (const key of VG_CORNERRADIUS_CHANNELS) {\n const configValue = getMarkConfig(key, model.markDef, model.config);\n // Move from mark to group\n if (mark.encode.update[key]) {\n groupUpdate[key] = mark.encode.update[key];\n delete mark.encode.update[key];\n } else if (configValue) {\n groupUpdate[key] = signalOrValueRef(configValue);\n }\n // Overwrite any cornerRadius on mark set by config --- they are already moved to the group\n if (configValue) {\n mark.encode.update[key] = {value: 0};\n }\n }\n\n // For bin and time unit, we have to add bin/timeunit -end channels.\n const groupByField = model.fieldDef(model.stack.groupbyChannel);\n const groupby: string[] = vgField(groupByField) ? [vgField(groupByField)] : [];\n\n if (groupByField?.bin || groupByField?.timeUnit) {\n groupby.push(vgField(groupByField, {binSuffix: 'end'}));\n }\n\n const strokeProperties = [\n 'stroke',\n 'strokeWidth',\n 'strokeJoin',\n 'strokeCap',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeMiterLimit',\n 'strokeOpacity'\n ] as const;\n\n // Generate stroke properties for the group\n groupUpdate = strokeProperties.reduce((encode, prop) => {\n if (mark.encode.update[prop]) {\n return {...encode, [prop]: mark.encode.update[prop]};\n } else {\n const configValue = getMarkConfig(prop, model.markDef, model.config);\n if (configValue !== undefined) {\n return {...encode, [prop]: signalOrValueRef(configValue)};\n } else {\n return encode;\n }\n }\n }, groupUpdate);\n\n // Apply strokeForeground and strokeOffset if stroke is used\n if (groupUpdate.stroke) {\n groupUpdate.strokeForeground = {value: true};\n groupUpdate.strokeOffset = {value: 0};\n }\n\n return [\n {\n type: 'group',\n from: {\n facet: {\n data: model.requestDataName(DataSourceType.Main),\n name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main),\n groupby,\n aggregate: {\n fields: [\n stackField({suffix: 'start'}),\n stackField({suffix: 'start'}),\n stackField({suffix: 'end'}),\n stackField({suffix: 'end'})\n ],\n ops: ['min', 'max', 'min', 'max']\n }\n }\n },\n encode: {\n update: groupUpdate\n },\n marks: [\n {\n type: 'group',\n encode: {update: innerGroupUpdate},\n marks: [mark]\n }\n ]\n }\n ];\n}\n\nexport function getSort(model: UnitModel): VgCompare {\n const {encoding, stack, mark, markDef, config} = model;\n const order = encoding.order;\n if (\n (!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) ||\n (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config)))\n ) {\n return undefined;\n } else if ((isArray(order) || isFieldDef(order)) && !stack) {\n // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.)\n return sortParams(order, {expr: 'datum'});\n } else if (isPathMark(mark)) {\n // For both line and area, we sort values based on dimension by default\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (isFieldDef(dimensionChannelDef)) {\n const s = dimensionChannelDef.sort;\n\n if (isArray(s)) {\n return {\n field: vgField(dimensionChannelDef, {prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum'})\n };\n } else if (isSortField(s)) {\n return {\n field: vgField(\n {\n // FIXME: this op might not already exist?\n // FIXME: what if dimensionChannel (x or y) contains custom domain?\n aggregate: isAggregate(model.encoding) ? s.op : undefined,\n field: s.field\n },\n {expr: 'datum'}\n )\n };\n } else if (isSortByEncoding(s)) {\n const fieldDefToSort = model.fieldDef(s.encoding);\n return {\n field: vgField(fieldDefToSort, {expr: 'datum'}),\n order: s.order\n };\n } else if (s === null) {\n return undefined;\n } else {\n return {\n field: vgField(dimensionChannelDef, {\n // For stack with imputation, we only have bin_mid\n binSuffix: model.stack && model.stack.impute ? 'mid' : undefined,\n expr: 'datum'\n })\n };\n }\n }\n return undefined;\n }\n return undefined;\n}\n\nfunction getMarkGroup(model: UnitModel, opt: {fromPrefix: string} = {fromPrefix: ''}) {\n const {mark, markDef, encoding, config} = model;\n\n const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model));\n const style = getStyles(markDef);\n const key = encoding.key;\n const sort = getSort(model);\n const interactive = interactiveFlag(model);\n const aria = getMarkPropOrConfig('aria', markDef, config);\n\n const postEncodingTransform = markCompiler[mark].postEncodingTransform\n ? markCompiler[mark].postEncodingTransform(model)\n : null;\n\n return [\n {\n name: model.getName('marks'),\n type: markCompiler[mark].vgMark,\n ...(clip ? {clip: true} : {}),\n ...(style ? {style} : {}),\n ...(key ? {key: key.field} : {}),\n ...(sort ? {sort} : {}),\n ...(interactive ? interactive : {}),\n ...(aria === false ? {aria} : {}),\n from: {data: opt.fromPrefix + model.requestDataName(DataSourceType.Main)},\n encode: {\n update: markCompiler[mark].encodeEntry(model)\n },\n ...(postEncodingTransform\n ? {\n transform: postEncodingTransform\n }\n : {})\n }\n ];\n}\n\n/**\n * If scales are bound to interval selections, we want to automatically clip\n * marks to account for panning/zooming interactions. We identify bound scales\n * by the selectionExtent property, which gets added during scale parsing.\n */\nfunction scaleClip(model: UnitModel) {\n const xScale = model.getScaleComponent('x');\n const yScale = model.getScaleComponent('y');\n return (xScale && xScale.get('selectionExtent')) || (yScale && yScale.get('selectionExtent')) ? true : undefined;\n}\n\n/**\n * If we use a custom projection with auto-fitting to the geodata extent,\n * we need to clip to ensure the chart size doesn't explode.\n */\nfunction projectionClip(model: UnitModel) {\n const projection = model.component.projection;\n return projection && !projection.isFit ? true : undefined;\n}\n\n/**\n * Only output interactive flags if we have selections defined somewhere in our model hierarchy.\n */\nfunction interactiveFlag(model: UnitModel) {\n if (!model.component.selection) return null;\n const unitCount = keys(model.component.selection).length;\n let parentCount = unitCount;\n let parent = model.parent;\n while (parent && parentCount === 0) {\n parentCount = keys(parent.component.selection).length;\n parent = parent.parent;\n }\n return parentCount ? {interactive: unitCount > 0} : null;\n}\n","import {NewSignal} from 'vega';\nimport {Axis} from '../axis';\nimport {\n Channel,\n GEOPOSITION_CHANNELS,\n NONPOSITION_SCALE_CHANNELS,\n POSITION_SCALE_CHANNELS,\n ScaleChannel,\n SCALE_CHANNELS,\n SingleDefChannel,\n supportLegend,\n X,\n Y,\n PositionChannel,\n NonPositionScaleChannel\n} from '../channel';\nimport {\n getFieldDef,\n getFieldOrDatumDef,\n isFieldOrDatumDef,\n isTypedFieldDef,\n MarkPropFieldOrDatumDef,\n PositionFieldDef\n} from '../channeldef';\nimport {Config} from '../config';\nimport {isGraticuleGenerator} from '../data';\nimport * as vlEncoding from '../encoding';\nimport {Encoding, initEncoding} from '../encoding';\nimport {Legend} from '../legend';\nimport {GEOSHAPE, isMarkDef, Mark, MarkDef} from '../mark';\nimport {Projection} from '../projection';\nimport {Domain} from '../scale';\nimport {SelectionDef} from '../selection';\nimport {LayoutSizeMixins, NormalizedUnitSpec} from '../spec';\nimport {isFrameMixins} from '../spec/base';\nimport {stack, StackProperties} from '../stack';\nimport {Dict} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {assembleAxisSignals} from './axis/assemble';\nimport {AxisIndex} from './axis/component';\nimport {parseUnitAxes} from './axis/parse';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {initLayoutSize} from './layoutsize/init';\nimport {parseUnitLayoutSize} from './layoutsize/parse';\nimport {LegendIndex} from './legend/component';\nimport {defaultFilled, initMarkdef} from './mark/init';\nimport {parseMarkGroups} from './mark/mark';\nimport {isLayerModel, Model, ModelWithField} from './model';\nimport {ScaleIndex} from './scale/component';\nimport {\n assembleTopLevelSignals,\n assembleUnitSelectionData,\n assembleUnitSelectionMarks,\n assembleUnitSelectionSignals\n} from './selection/assemble';\nimport {parseUnitSelection} from './selection/parse';\n\n/**\n * Internal model of Vega-Lite specification for the compiler.\n */\nexport class UnitModel extends ModelWithField {\n public readonly markDef: MarkDef;\n public readonly encoding: Encoding;\n\n public readonly specifiedScales: ScaleIndex = {};\n\n public readonly stack: StackProperties;\n\n protected specifiedAxes: AxisIndex = {};\n\n protected specifiedLegends: LegendIndex = {};\n\n public specifiedProjection: Projection = {};\n\n public readonly selection: Dict = {};\n public children: Model[] = [];\n\n constructor(\n spec: NormalizedUnitSpec,\n parent: Model,\n parentGivenName: string,\n parentGivenSize: LayoutSizeMixins = {},\n config: Config\n ) {\n super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined);\n\n const markDef = isMarkDef(spec.mark) ? {...spec.mark} : {type: spec.mark};\n const mark = markDef.type;\n\n // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding\n if (markDef.filled === undefined) {\n markDef.filled = defaultFilled(markDef, config, {\n graticule: spec.data && isGraticuleGenerator(spec.data)\n });\n }\n\n const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config));\n this.markDef = initMarkdef(markDef, encoding, config);\n\n this.size = initLayoutSize({\n encoding: encoding,\n size: isFrameMixins(spec)\n ? {\n ...parentGivenSize,\n ...(spec.width ? {width: spec.width} : {}),\n ...(spec.height ? {height: spec.height} : {})\n }\n : parentGivenSize\n });\n\n // calculate stack properties\n this.stack = stack(mark, encoding);\n this.specifiedScales = this.initScales(mark, encoding);\n\n this.specifiedAxes = this.initAxes(encoding);\n this.specifiedLegends = this.initLegend(encoding);\n this.specifiedProjection = spec.projection;\n\n // Selections will be initialized upon parse.\n this.selection = spec.selection;\n }\n\n public get hasProjection(): boolean {\n const {encoding} = this;\n const isGeoShapeMark = this.mark === GEOSHAPE;\n const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel]));\n return isGeoShapeMark || hasGeoPosition;\n }\n\n /**\n * Return specified Vega-Lite scale domain for a particular channel\n * @param channel\n */\n public scaleDomain(channel: ScaleChannel): Domain {\n const scale = this.specifiedScales[channel];\n return scale ? scale.domain : undefined;\n }\n\n public axis(channel: PositionChannel): Axis {\n return this.specifiedAxes[channel];\n }\n\n public legend(channel: NonPositionScaleChannel): Legend {\n return this.specifiedLegends[channel];\n }\n\n private initScales(mark: Mark, encoding: Encoding): ScaleIndex {\n return SCALE_CHANNELS.reduce((scales, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as\n | PositionFieldDef\n | MarkPropFieldOrDatumDef;\n if (fieldOrDatumDef) {\n scales[channel] = fieldOrDatumDef.scale ?? {};\n }\n return scales;\n }, {} as ScaleIndex);\n }\n\n private initAxes(encoding: Encoding): AxisIndex {\n return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => {\n // Position Axis\n\n // TODO: handle ConditionFieldDef\n const channelDef = encoding[channel];\n if (\n isFieldOrDatumDef(channelDef) ||\n (channel === X && isFieldOrDatumDef(encoding.x2)) ||\n (channel === Y && isFieldOrDatumDef(encoding.y2))\n ) {\n const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined;\n\n _axis[channel] = axisSpec ? {...axisSpec} : axisSpec; // convert truthy value to object\n }\n return _axis;\n }, {});\n }\n\n private initLegend(encoding: Encoding): LegendIndex {\n return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldOrDatumDef;\n\n if (fieldOrDatumDef && supportLegend(channel)) {\n const legend = fieldOrDatumDef.legend;\n _legend[channel] = legend ? {...legend} : legend; // convert truthy value to object\n }\n\n return _legend;\n }, {});\n }\n\n public parseData() {\n this.component.data = parseData(this);\n }\n\n public parseLayoutSize() {\n parseUnitLayoutSize(this);\n }\n\n public parseSelections() {\n this.component.selection = parseUnitSelection(this, this.selection);\n }\n\n public parseMarkGroup() {\n this.component.mark = parseMarkGroups(this);\n }\n\n public parseAxesAndHeaders() {\n this.component.axes = parseUnitAxes(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: any[]): NewSignal[] {\n return assembleTopLevelSignals(this, signals);\n }\n\n public assembleSignals(): NewSignal[] {\n return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])];\n }\n\n public assembleSelectionData(data: readonly VgData[]): VgData[] {\n return assembleUnitSelectionData(this, data);\n }\n\n public assembleLayout(): VgLayout {\n return null;\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n return assembleLayoutSignals(this);\n }\n\n public assembleMarks() {\n let marks = this.component.mark ?? [];\n\n // If this unit is part of a layer, selections should augment\n // all in concert rather than each unit individually. This\n // ensures correct interleaving of clipping and brushed marks.\n if (!this.parent || !isLayerModel(this.parent)) {\n marks = assembleUnitSelectionMarks(this, marks);\n }\n\n return marks.map(this.correctDataNames);\n }\n\n protected getMapping() {\n return this.encoding;\n }\n\n public get mark(): Mark {\n return this.markDef.type;\n }\n\n public channelHasField(channel: Channel) {\n return vlEncoding.channelHasField(this.encoding, channel);\n }\n\n public fieldDef(channel: SingleDefChannel) {\n const channelDef = this.encoding[channel];\n return getFieldDef(channelDef);\n }\n\n public typedFieldDef(channel: SingleDefChannel) {\n const fieldDef = this.fieldDef(channel);\n if (isTypedFieldDef(fieldDef)) {\n return fieldDef;\n }\n return null;\n }\n}\n","import {Legend as VgLegend, NewSignal, Title as VgTitle} from 'vega';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedLayerSpec} from '../spec';\nimport {keys} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {assembleAxisSignals} from './axis/assemble';\nimport {parseLayerAxes} from './axis/parse';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {parseLayerLayoutSize} from './layoutsize/parse';\nimport {assembleLegends} from './legend/assemble';\nimport {Model} from './model';\nimport {assembleLayerSelectionMarks} from './selection/assemble';\nimport {UnitModel} from './unit';\n\nexport class LayerModel extends Model {\n // HACK: This should be (LayerModel | UnitModel)[], but setting the correct type leads to weird error.\n // So I'm just putting generic Model for now\n public readonly children: Model[];\n\n constructor(\n spec: NormalizedLayerSpec,\n parent: Model,\n parentGivenName: string,\n parentGivenSize: LayoutSizeMixins,\n config: Config\n ) {\n super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view);\n\n const layoutSize = {\n ...parentGivenSize,\n ...(spec.width ? {width: spec.width} : {}),\n ...(spec.height ? {height: spec.height} : {})\n };\n\n this.children = spec.layer.map((layer, i) => {\n if (isLayerSpec(layer)) {\n return new LayerModel(layer, this, this.getName('layer_' + i), layoutSize, config);\n } else if (isUnitSpec(layer)) {\n return new UnitModel(layer, this, this.getName('layer_' + i), layoutSize, config);\n }\n\n throw new Error(log.message.invalidSpec(layer));\n });\n }\n\n public parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n\n public parseLayoutSize() {\n parseLayerLayoutSize(this);\n }\n\n public parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n\n public parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n\n public parseAxesAndHeaders() {\n parseLayerAxes(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n\n // TODO: Support same named selections across children.\n public assembleSignals(): NewSignal[] {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleSignals());\n }, assembleAxisSignals(this));\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleLayoutSignals());\n }, assembleLayoutSignals(this));\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n\n public assembleTitle(): VgTitle {\n let title = super.assembleTitle();\n if (title) {\n return title;\n }\n // If title does not provide layer, look into children\n for (const child of this.children) {\n title = child.assembleTitle();\n if (title) {\n return title;\n }\n }\n return undefined;\n }\n\n public assembleLayout(): VgLayout {\n return null;\n }\n\n public assembleMarks(): any[] {\n return assembleLayerSelectionMarks(\n this,\n this.children.flatMap(child => {\n return child.assembleMarks();\n })\n );\n }\n\n public assembleLegends(): VgLegend[] {\n return this.children.reduce((legends, child) => {\n return legends.concat(child.assembleLegends());\n }, assembleLegends(this));\n }\n}\n","import {Config} from '../config';\nimport * as log from '../log';\nimport {isAnyConcatSpec, isFacetSpec, isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedSpec} from '../spec';\nimport {ConcatModel} from './concat';\nimport {FacetModel} from './facet';\nimport {LayerModel} from './layer';\nimport {Model} from './model';\nimport {UnitModel} from './unit';\n\nexport function buildModel(\n spec: NormalizedSpec,\n parent: Model,\n parentGivenName: string,\n unitSize: LayoutSizeMixins,\n config: Config\n): Model {\n if (isFacetSpec(spec)) {\n return new FacetModel(spec, parent, parentGivenName, config);\n } else if (isLayerSpec(spec)) {\n return new LayerModel(spec, parent, parentGivenName, unitSize, config);\n } else if (isUnitSpec(spec)) {\n return new UnitModel(spec, parent, parentGivenName, unitSize, config);\n } else if (isAnyConcatSpec(spec)) {\n return new ConcatModel(spec, parent, parentGivenName, config);\n }\n throw new Error(log.message.invalidSpec(spec));\n}\n","import {AutoSizeType, LoggerInterface, Spec as VgSpec} from 'vega';\nimport {isString, mergeConfig} from 'vega-util';\nimport {getPositionScaleChannel} from '../channel';\nimport * as vlFieldDef from '../channeldef';\nimport {Config, initConfig, stripAndRedirectConfig} from '../config';\nimport * as log from '../log';\nimport {normalize} from '../normalize';\nimport {LayoutSizeMixins, TopLevel, TopLevelSpec} from '../spec';\nimport {\n AutoSizeParams,\n Datasets,\n extractTopLevelProperties,\n getFitType,\n isFitType,\n TopLevelProperties\n} from '../spec/toplevel';\nimport {Dict, keys} from '../util';\nimport {buildModel} from './buildmodel';\nimport {assembleRootData} from './data/assemble';\nimport {optimizeDataflow} from './data/optimize';\nimport {Model} from './model';\n\nexport interface CompileOptions {\n /**\n * Sets a Vega-Lite configuration.\n */\n config?: Config;\n\n /**\n * Sets a custom logger.\n */\n logger?: LoggerInterface;\n\n /**\n * Sets a field title formatter.\n */\n fieldTitle?: vlFieldDef.FieldTitleFormatter;\n}\n\n/**\n * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec.\n *\n * At a high-level, we make the following transformations in different phases:\n *\n * Input spec\n * |\n * | (Normalization)\n * v\n * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.)\n * |\n * | (Build Model)\n * v\n * A model tree of the spec\n * |\n * | (Parse)\n * v\n * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged)\n * |\n * | (Optimize)\n * v\n * A model tree with parsed components with the data component optimized\n * |\n * | (Assemble)\n * v\n * Vega spec\n *\n * @param inputSpec The Vega-Lite specification.\n * @param opt Optional arguments passed to the Vega-Lite compiler.\n * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec.\n */\nexport function compile(inputSpec: TopLevelSpec, opt: CompileOptions = {}) {\n // 0. Augment opt with default opts\n if (opt.logger) {\n // set the singleton logger to the provided logger\n log.set(opt.logger);\n }\n\n if (opt.fieldTitle) {\n // set the singleton field title formatter\n vlFieldDef.setTitleFormatter(opt.fieldTitle);\n }\n\n try {\n // 1. Initialize config by deep merging default config with the config provided via option and the input spec.\n const config = initConfig(mergeConfig(opt.config, inputSpec.config));\n\n // 2. Normalize: Convert input spec -> normalized spec\n\n // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec.\n // - Normalize autosize and width or height spec\n const spec = normalize(inputSpec, config);\n\n // 3. Build Model: normalized spec -> Model (a tree structure)\n\n // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors.\n // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models.\n const model: Model = buildModel(spec, null, '', undefined, config);\n\n // 4 Parse: Model --> Model with components\n\n // Note that components = intermediate representations that are equivalent to Vega specs.\n // We need these intermediate representation because we need to merge many visualization \"components\" like projections, scales, axes, and legends.\n // We will later convert these components into actual Vega specs in the assemble phase.\n\n // In this phase, we do a bottom-up traversal over the whole tree to\n // parse for each type of components once (e.g., data, layout, mark, scale).\n // By doing bottom-up traversal, we start parsing components of unit specs and\n // then merge child components of parent composite specs.\n //\n // Please see inside model.parse() for order of different components parsed.\n model.parse();\n\n // drawDataflow(model.component.data.sources);\n\n // 5. Optimize the dataflow. This will modify the data component of the model.\n optimizeDataflow(model.component.data, model);\n\n // drawDataflow(model.component.data.sources);\n\n // 6. Assemble: convert model components --> Vega Spec.\n const vgSpec = assembleTopLevelModel(\n model,\n getTopLevelProperties(inputSpec, spec.autosize, config, model),\n inputSpec.datasets,\n inputSpec.usermeta\n );\n\n return {\n spec: vgSpec,\n normalized: spec\n };\n } finally {\n // Reset the singleton logger if a logger is provided\n if (opt.logger) {\n log.reset();\n }\n // Reset the singleton field title formatter if provided\n if (opt.fieldTitle) {\n vlFieldDef.resetTitleFormatter();\n }\n }\n}\n\nfunction getTopLevelProperties(\n inputSpec: TopLevel,\n autosize: AutoSizeType | AutoSizeParams,\n config: Config,\n model: Model\n) {\n const width = model.component.layoutSize.get('width');\n const height = model.component.layoutSize.get('height');\n if (autosize === undefined) {\n autosize = {type: 'pad'};\n if (model.hasAxisOrientSignalRef()) {\n autosize.resize = true;\n }\n } else if (isString(autosize)) {\n autosize = {type: autosize};\n }\n if (width && height && isFitType(autosize.type)) {\n if (width === 'step' && height === 'step') {\n log.warn(log.message.droppingFit());\n autosize.type = 'pad';\n } else if (width === 'step' || height === 'step') {\n // effectively XOR, because else if\n\n // get step dimension\n const sizeType = width === 'step' ? 'width' : 'height';\n // log that we're dropping fit for respective channel\n log.warn(log.message.droppingFit(getPositionScaleChannel(sizeType)));\n\n // setting type to inverse fit (so if we dropped fit-x, type is now fit-y)\n const inverseSizeType = sizeType === 'width' ? 'height' : 'width';\n autosize.type = getFitType(inverseSizeType);\n }\n }\n\n return {\n ...(keys(autosize).length === 1 && autosize.type\n ? autosize.type === 'pad'\n ? {}\n : {autosize: autosize.type}\n : {autosize}),\n ...extractTopLevelProperties(config),\n ...extractTopLevelProperties(inputSpec)\n };\n}\n\n/*\n * Assemble the top-level model to a Vega spec.\n *\n * Note: this couldn't be `model.assemble()` since the top-level model\n * needs some special treatment to generate top-level properties.\n */\nfunction assembleTopLevelModel(\n model: Model,\n topLevelProperties: TopLevelProperties & LayoutSizeMixins,\n datasets: Datasets = {},\n usermeta: Dict\n): VgSpec {\n // Config with Vega-Lite only config removed.\n const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined;\n\n const data = [].concat(\n model.assembleSelectionData([]),\n // only assemble data in the root\n assembleRootData(model.component.data, datasets)\n );\n\n const projections = model.assembleProjections();\n const title = model.assembleTitle();\n const style = model.assembleGroupStyle();\n const encodeEntry = model.assembleGroupEncodeEntry(true);\n\n let layoutSignals = model.assembleLayoutSignals();\n\n // move width and height signals with values to top level\n layoutSignals = layoutSignals.filter(signal => {\n if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) {\n topLevelProperties[signal.name] = +signal.value;\n return false;\n }\n return true;\n });\n\n return {\n $schema: 'https://vega.github.io/schema/vega/v5.json',\n ...(model.description ? {description: model.description} : {}),\n ...topLevelProperties,\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n data,\n ...(projections.length > 0 ? {projections: projections} : {}),\n ...model.assembleGroup([...layoutSignals, ...model.assembleSelectionTopLevelSignals([])]),\n ...(vgConfig ? {config: vgConfig} : {}),\n ...(usermeta ? {usermeta} : {})\n };\n}\n"],"names":["Error","deepEqual_","clone_","stableStringify","isBoolean","stringValue","TEXT","log.warn","log.message.invalidTimeUnit","log.message.droppedDay","stringify","fieldExpr","timeUnitFieldExpr","log.message.cannotUseScalePropertyWithNonColor","CHANNEL.isScaleChannel","CHANNEL.X","CHANNEL.Y","CHANNEL.THETA","CHANNEL.RADIUS","CHANNEL.SIZE","CHANNEL.STROKEWIDTH","CHANNEL.OPACITY","CHANNEL.FILLOPACITY","CHANNEL.STROKEOPACITY","CHANNEL.ANGLE","CHANNEL.COLOR","CHANNEL.FILL","CHANNEL.STROKE","CHANNEL.STROKEDASH","CHANNEL.SHAPE","log.message.channelRequiredForBinned","log.message.invalidFieldType","log.message.primitiveChannelDef","log.message.customFormatTypeNotAllowed","log.message.invalidAggregate","log.message.channelShouldNotBeUsedForBinned","log.message.invalidFieldTypeForCountAggregate","log.message.facetChannelShouldBeDiscrete","log.message.invalidEncodingChannel","log.message.REPLACE_ANGLE_WITH_THETA","log.message.incompatibleChannel","log.message.LINE_WITH_VARYING_SIZE","log.message.droppingColor","log.message.emptyFieldDef","log.message.errorBarContinuousAxisHasCustomizedAggregate","log.message.selectionNotSupported","log.message.errorBarCenterIsUsedWithWrongExtent","log.message.errorBarCenterAndExtentAreNotNeeded","log.message.errorBand1DNotSupport","defaultConfig","mark.defaultMarkConfig","mark.defaultBarConfig","mark.defaultRectConfig","mark.defaultTickConfig","defaultSelectionConfig","log.message.invalidSpec","log.message.cannotStackNonLinearScale","log.message.cannotStackRangedMark","log.message.stackNonSummativeAggregate","log.message.RANGE_STEP_DEPRECATED","log.message.noSuchRepeatedValue","log.message.lineWithRange","log.message.columnsNotSupportByRowCol","log.message.facetChannelDropped","log.message.projectionOverridden","log.message.containerSizeNonSingle","log.message.FIT_NON_SINGLE","log.message.containerSizeNotCompatibleWithAutosize","log.message.mergeConflictingProperty","isAggregate","parseSelector","ref.midPoint","ref.interpolatedSignalRef","ref.valueRefForFieldOrDatumDef","ref.midPointRefWithPositionInvalidTest","ref.widthHeightValueOrSignalRef","log.message.cannotApplySizeToNonOrientedMark","ref.wrapPositionInvalidTest","allFieldsInvalidPredicate","log.message.nearestNotSupportForContinuous","log.message.ADD_SAME_CHILD_TWICE","log.message.INTERVAL_INITIALIZED_WITH_X_Y","log.message.cannotProjectAggregate","log.message.cannotProjectOnChannelWithoutField","log.message.SCALE_BINDINGS_CONTINUOUS","log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION","scalesCompiler","INTERVAL_BRUSH","ANCHOR","DELTA","onDelta","scales","legends","inputs","compilers","ILLEGAL","log.message.independentScaleMeansIndependentGuide","entries","mixins.color","defaultLabelOverlap","fieldDefTitle","values","defaultType","log.debug","log.message.unknownField","parseExpression","log.message.unrecognizedParse","log.message.differentParse","optimizers.RemoveUnnecessaryOutputNodes","optimizers.RemoveUnnecessaryIdentifierNodes","optimizers.RemoveUnusedSubtrees","optimizers.MoveParseUp","optimizers.MergeBins","optimizers.RemoveDuplicateTimeUnits","optimizers.MergeParse","optimizers.MergeAggregates","optimizers.MergeTimeUnits","optimizers.MergeIdenticalNodes","optimizers.MergeOutputs","optimizers.moveFacetDown","util.keys","log.message.NEEDS_SAME_SELECTION","util.isBoolean","util.contains","util.replacePathInField","log.message.unaggregateDomainHasNoEffectForRawField","log.message.unaggregateDomainWithNonSharedDomainOp","log.message.unaggregatedDomainWithLogScale","log.message.mergeConflictingDomainProperty","util.unique","util.hash","log.message.MORE_THAN_ONE_SORT","UNIONDOMAIN_SORT_OP_INDEX","log.message.domainSortDropped","log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES","log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES","log.message.FACETED_INDEPENDENT_SAME_SOURCE","getSizeChannel","log.message.scalePropertyNotWorkWithScaleType","log.message.stepDropped","util.omit","log.message.domainRequiredForThresholdScale","zero","log.message.scaleTypeNotWorkWithChannel","log.message.scaleTypeNotWorkWithFieldDef","log.message.discreteChannelCannotEncode","log.message.selectionNotFound","fieldRef","log.message.noSameUnitLookup","log.message.NO_FIELDS_NEEDS_AS","title","log.message.invalidTransformIgnored","log.message.CONCAT_CANNOT_SHARE_AXIS","labels","isExplicit","encode.labels","log.message.orientOverridden","BAR_CORNER_RADIUS_END_INDEX","encode.baseEncodeEntry","encode.pointPosition","encode.rectPosition","encode.pointOrRangePosition","encode.defined","encode.text","encode.nonPosition","text","encode.valueIfDefined","getSort","vlEncoding.channelHasField","log.set","vlFieldDef.setTitleFormatter","log.reset","vlFieldDef.resetTitleFormatter","log.message.droppingFit"],"mappings":";;;;;;;;IAAe,iBAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAC1C,EAAE,EAAE,CAAC,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAC3B,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC;IAClB,EAAE,OAAO,EAAE,CAAC;IACZ;;ICJe,eAAQ,CAAC,IAAI,EAAE;IAC9B,EAAE,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;AACD;IACA,MAAM,IAAI,GAAG,KAAK,IAAI,SAAS,GAAG,EAAE;IACpC,EAAE,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC,CAAC;AACF;IACA,MAAM,IAAI,GAAG,IAAI,IAAI;IACrB,EAAE,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1B,EAAE,OAAO,SAAS,GAAG,EAAE;IACvB,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,EAAE;IAClC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK;IACL,IAAI,OAAO,GAAG,CAAC;IACf,GAAG,CAAC;IACJ,CAAC;;IChBc,cAAQ,CAAC,OAAO,EAAE;IACjC,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB;;ICAe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O,IAAI,CAAC;SACb,CAAC,CAAC;QAEH,qJACE,OAAO,EAAE,4CAA4C,KACjD,KAAK,CAAC,WAAW,GAAG,EAAC,WAAW,EAAE,KAAK,CAAC,WAAW,EAAC,GAAG,EAAE,IAC1D,kBAAkB,IACjB,KAAK,GAAG,EAAC,KAAK,EAAC,GAAG,EAAE,KACpB,KAAK,GAAG,EAAC,KAAK,EAAC,GAAG,EAAE,KACpB,WAAW,GAAG,EAAC,MAAM,EAAE,EAAC,MAAM,EAAE,WAAW,EAAC,EAAC,GAAG,EAAE,MACtD,IAAI,MACA,WAAW,CAAC,MAAM,GAAG,CAAC,GAAG,EAAC,WAAW,EAAE,WAAW,EAAC,GAAG,EAAE,IACzD,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,aAAa,EAAE,GAAG,KAAK,CAAC,gCAAgC,CAAC,EAAE,CAAC,CAAC,CAAC,IACrF,QAAQ,GAAG,EAAC,MAAM,EAAE,QAAQ,EAAC,GAAG,EAAE,KAClC,QAAQ,GAAG,EAAC,QAAQ,EAAC,GAAG,EAAE,GAC9B;IACJ;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/vega-lite/build/vega-lite.min.js b/node_modules/vega-lite/build/vega-lite.min.js deleted file mode 100644 index a71fec1..0000000 --- a/node_modules/vega-lite/build/vega-lite.min.js +++ /dev/null @@ -1,15 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).vegaLite={})}(this,(function(e){"use strict";function t(e,t,n){return e.fields=t||[],e.fname=n,e}function n(e){return 1===e.length?i(e[0]):r(e)}const i=e=>function(t){return t[e]},r=e=>{const t=e.length;return function(n){for(let i=0;it&&c(),a=t=n+1):"]"===i&&(a||o("Access path missing open bracket: "+e),a>0&&c(),a=0,t=n+1):n>t?c():t=n+1}return a&&o("Access path missing closing bracket: "+e),s&&o("Access path missing closing quote: "+e),n>t&&(n++,c()),r}var a=[],u=(function(e,i,r){const o=s(e);e=1===o.length?o[0]:e,t((r&&r.get||n)(o),[e],i||e)}("id"),t((function(e){return e}),a,"identity"));t((function(){return 0}),a,"zero"),t((function(){return 1}),a,"one"),t((function(){return!0}),a,"true"),t((function(){return!1}),a,"false");function l(e,t,n){var i=[t].concat([].slice.call(n));console[e].apply(console,i)}var c=Array.isArray;function f(e){return e===Object(e)}const d=e=>"__proto__"!==e;function g(...e){return e.reduce((e,t)=>{for(var n in t)if("signals"===n)e.signals=m(e.signals,t.signals);else{var i="legend"===n?{layout:1}:"style"===n||null;p(e,n,t[n],i)}return e},{})}function p(e,t,n,i){var r,o;if(d(t))if(f(n)&&!c(n))for(r in o=f(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?p(o,r,n[r]):d(r)&&(o[r]=n[r]);else e[t]=n}function m(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function h(e){return null!=e?c(e)?e:[e]:[]}const b=Object.prototype.hasOwnProperty;function v(e,t){return b.call(e,t)}function y(e){return"boolean"==typeof e}function x(e){return"number"==typeof e}function O(e){return"string"==typeof e}function w(e){return c(e)?"["+e.map(w)+"]":f(e)||O(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function j(e){for(var t={},n=0,i=e.length;nS(e,t))}:k(e)?{or:e.or.map(e=>S(e,t))}:t(e)}const $=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,o;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,o[r]))return!1;for(r=i;0!=r--;){var s=o[r];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n},B=D;function _(e,t){const n={};for(const i of t)v(e,i)&&(n[i]=e[i]);return n}function z(e,t){const n=Object.assign({},e);for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>F(e)).join(",")})`};const P=F;function N(e){if(x(e))return e;const t=O(e)?e:F(e);if(t.length<250)return t;let n=0;for(let e=0;e-1}function T(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function q(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function R(e,t){for(const n of V(t))p(e,n,t[n],!0)}function W(e,t){const n=[],i={};let r;for(const o of e)r=t(o),r in i||(i[r]=1,n.push(o));return n}function U(e,t){for(const n of e)if(t.has(n))return!0;return!1}function I(e){const t=new Set;for(const n of e){const e=s(n).map((e,t)=>0===t?e:`[${e}]`),i=e.map((t,n)=>e.slice(0,n+1).join(""));for(const e of i)t.add(e)}return t}function H(e,t){return void 0===e||void 0===t||U(I(e),I(t))}function G(e){return 0===V(e).length}const V=Object.keys,J=Object.values;function Y(e){const t=[];for(const n in e)v(e,n)&&t.push({key:n,value:e[n]});return t}function X(e){return!0===e||!1===e}function Q(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function K(e,t){return E(e)?"!("+K(e.not,t)+")":C(e)?"("+e.and.map(e=>K(e,t)).join(") && (")+")":k(e)?"("+e.or.map(e=>K(e,t)).join(") || (")+")":t(e)}function Z(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&Z(e[n],t)&&delete e[n],G(e)}function ee(e){return e.charAt(0).toUpperCase()+e.substr(1)}function te(e,t="datum"){const n=s(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(w).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function ne(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function ie(e){return""+s(e).map(ne).join("\\.")}function re(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function oe(e){return""+s(e).join(".")}function se(e){return e?s(e).length:0}function ae(...e){for(const t of e)if(void 0!==t)return t}let ue=42;function le(e){if(void 0!==e)return(e%360+360)%360}function ce(e){return!!x(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const fe={domainColor:{part:"domain",vgProp:"stroke"},labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"},titleColor:{part:"title",vgProp:"fill"},title:null};function de(e){return e&&e.condition}const ge=["domain","grid","labels","ticks","title"],pe={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"main",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},me={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},he=Object.assign(Object.assign({},me),{style:1,labelExpr:1,encoding:1});function be(e){return!!he[e]}const ve={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},ye=ve.arc,xe=ve.area,Oe=ve.bar,we=ve.image,je=ve.line,Ae=ve.point,De=ve.rect,Fe=ve.rule,ke=ve.text,Ce=ve.tick,Ee=ve.trail,Se=ve.circle,$e=ve.square,Be=ve.geoshape;function _e(e){return M(["line","area","trail"],e)}function ze(e){return M(["rect","bar","image","arc"],e)}const Pe=V(ve);function Ne(e){return e.type}j(Pe);const Le=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],Me=V({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBand:1,timeUnitBandPosition:1}),Te={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},qe={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},Re={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function We(e){return"mark"in e}class Ue{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!We(e)&&(Ne(t=e.mark)?t.type:t)===this.name;var t}}const Ie={argmax:1,argmin:1,average:1,count:1,distinct:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},He={count:1,min:1,max:1};function Ge(e){return!!e&&!!e.argmin}function Ve(e){return!!e&&!!e.argmax}function Je(e){return O(e)&&!!Ie[e]}const Ye=["count","valid","missing","distinct"];function Xe(e){return O(e)&&M(Ye,e)}const Qe=["count","sum","distinct","valid","missing"],Ke=j(["mean","average","median","q1","q3","min","max"]),Ze="row",et="column",tt="x",nt="y",it="x2",rt="y2",ot="radius",st="theta",at="theta2",ut="color",lt="fill",ct="stroke",ft="shape",dt="size",gt={theta:1,theta2:1,radius:1,radius2:1};function pt(e){return e in gt}const mt={longitude:1,longitude2:1,latitude:1,latitude2:1};const ht=V(mt),bt=Object.assign(Object.assign(Object.assign(Object.assign({},{x:1,y:1,x2:1,y2:1}),gt),mt),{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1});function vt(e){return e===ut||e===lt||e===ct}const yt={row:1,column:1,facet:1},xt=V(yt),Ot=Object.assign(Object.assign({},bt),yt),wt=V(Ot),jt=A(Ot,["order","detail","tooltip"]),At=A(jt,["row","column","facet"]);function Dt(e){return!!Ot[e]}const Ft=[it,rt,"latitude2","longitude2",at,"radius2"];function kt(e){return Ct(e)!==e}function Ct(e){switch(e){case it:return tt;case rt:return nt;case"latitude2":return"latitude";case"longitude2":return"longitude";case at:return st;case"radius2":return ot}return e}function Et(e){if(pt(e))switch(e){case st:return"startAngle";case at:return"endAngle";case ot:return"outerRadius";case"radius2":return"innerRadius"}return e}function St(e){switch(e){case tt:return it;case nt:return rt;case"latitude":return"latitude2";case"longitude":return"longitude2";case st:return at;case ot:return"radius2"}}function $t(e){switch(e){case tt:case it:return"width";case nt:case rt:return"height"}}const Bt=A(bt,["x","y","x2","y2","latitude","longitude","latitude2","longitude2","theta","theta2","radius","radius2"]),_t=V(Bt),zt={x:1,y:1},Pt=V(zt);function Nt(e){return e in zt}const Lt={theta:1,radius:1},Mt=V(Lt);function Tt(e){return"width"===e?tt:nt}const qt=A(Bt,["text","tooltip","href","url","description","detail","key","order"]),Rt=V(qt);const Wt=Object.assign(Object.assign(Object.assign({},zt),Lt),qt),Ut=V(Wt);function It(e){return!!Wt[e]}function Ht(e,t){return function(e){switch(e){case ut:case lt:case ct:case"description":case"detail":case"key":case"tooltip":case"href":case"order":case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case"facet":case Ze:case et:return Gt;case tt:case nt:case"latitude":case"longitude":return Vt;case it:case rt:case"latitude2":case"longitude2":return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case dt:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case"strokeDash":return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case ft:return{point:"always",geoshape:"always"};case"text":return{text:"always"};case"angle":return{point:"always",square:"always",text:"always"};case"url":return{image:"always"};case st:case ot:return{text:"always",arc:"always"};case at:case"radius2":return{arc:"always"}}}(e)[t]}const Gt={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},Vt=A(Gt,["geoshape"]);function Jt(e){switch(e){case tt:case nt:case st:case ot:case dt:case"angle":case"strokeWidth":case"opacity":case"fillOpacity":case"strokeOpacity":case it:case rt:case at:case"radius2":return;case"facet":case Ze:case et:case ft:case"strokeDash":case"text":case"tooltip":case"href":case"url":case"description":return"discrete";case ut:case lt:case ct:return"flexible";case"latitude":case"longitude":case"latitude2":case"longitude2":case"detail":case"key":case"order":return}}function Yt(e){return y(e)&&(e=ro(e,void 0)),"bin"+V(e).map(t=>Zt(e[t])?Q(`_${t}_${Object.entries(e[t])}`):Q(`_${t}_${e[t]}`)).join("")}function Xt(e){return!0===e||Kt(e)&&!e.binned}function Qt(e){return"binned"===e||Kt(e)&&!0===e.binned}function Kt(e){return f(e)}function Zt(e){return null==e?void 0:e.selection}function en(e){switch(e){case Ze:case et:case dt:case ut:case lt:case ct:case"strokeWidth":case"opacity":case"fillOpacity":case"strokeOpacity":case ft:return 6;case"strokeDash":return 4;default:return 10}}function tn(e){return`Invalid specification ${JSON.stringify(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}function nn(e){return("width"==e?"Width":"Height")+' "container" only works for single views and layered views.'}function rn(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function on(e){return e?`Dropping "fit-${e}" because spec has discrete ${$t(e)}.`:'Dropping "fit" because spec has discrete size.'}function sn(e){return`Unknown field for ${e}. Cannot calculate view size.`}function an(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function un(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function ln(e){return`Selection not supported for ${e} yet.`}function cn(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function fn(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function dn(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function gn(e){return`Invalid field type "${e}".`}function pn(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function mn(e,t){return`Dropping ${P(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function hn(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?" when "+n:""}.`}function bn(e){return e+" encoding should be discrete (ordinal / nominal / binned)."}function vn(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function yn(e){return`Using unaggregated domain with raw field has no effect (${P(e)}).`}function xn(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function On(e){return`Unaggregated domain is currently unsupported for log scale (${P(e)}).`}function wn(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function jn(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const An="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function Dn(e,t){return`Invalid ${e}: ${P(t)}.`}function Fn(e){return`1D error band does not support ${e}.`}function kn(e){return`Channel ${e} is required for "binned" bin.`}const Cn=(Sn=2||0,{level:function(e){return arguments.length?(Sn=+e,this):Sn},error:function(){return Sn>=1&&l(En||"error","ERROR",arguments),this},warn:function(){return Sn>=2&&l(En||"warn","WARN",arguments),this},info:function(){return Sn>=3&&l(En||"log","INFO",arguments),this},debug:function(){return Sn>=4&&l(En||"log","DEBUG",arguments),this}});var En,Sn;let $n=Cn;function Bn(...e){$n.warn(...e)}function _n(e){if(e&&f(e))for(const t of Rn)if(t in e)return!0;return!1}const zn=["january","february","march","april","may","june","july","august","september","october","november","december"],Pn=zn.map(e=>e.substr(0,3)),Nn=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Ln=Nn.map(e=>e.substr(0,3));function Mn(e,t){const n=[];if(t&&void 0!==e.day&&V(e).length>1&&(Bn(function(e){return`Dropping day from datetime ${P(e)} as day cannot be combined with other units.`}(e)),delete(e=B(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(ce(e)&&(e=+e),x(e))return e-1;{const t=e.toLowerCase(),n=zn.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Pn.indexOf(i);if(-1!==r)return r;throw new Error(Dn("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(ce(e)&&(e=+e),x(e))return e>4&&Bn(Dn("quarter",e)),e-1;throw new Error(Dn("quarter",e))}(e.quarter):e.quarter;n.push(x(i)?3*i:i+"*3")}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){const i=t?function(e){if(ce(e)&&(e=+e),x(e))return e%7;{const t=e.toLowerCase(),n=Nn.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Ln.indexOf(i);if(-1!==r)return r;throw new Error(Dn("day",e))}}(e.day):e.day;n.push(x(i)?i+1:i+"+1")}else n.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const i=e[t];n.push(void 0===i?0:i)}return n}function Tn(e){const t=Mn(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const qn={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Rn=V(qn);function Wn(e){return e.startsWith("utc")}const Un={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function In(e){const t=[];for(const n of Rn)Hn(e,n)&&t.push(n);return t}function Hn(e,t){const n=e.indexOf(t);return!(n<0)&&(!(n>0&&"seconds"===t&&"i"===e.charAt(n-1))&&(!(e.length>n+3&&"day"===t&&"o"===e.charAt(n+3))&&!(n>0&&"year"===t&&"f"===e.charAt(n-1))))}function Gn(e,t,{end:n}={end:!1}){const i=te(t),r=Wn(e)?"utc":"";let o;const s={};for(const t of Rn)Hn(e,t)&&(s[t]="quarter"===(a=t)?`(${r}quarter(${i})-1)`:`${r}${a}(${i})`,o=t);var a;return n&&(s[o]+="+1"),function(e){const t=Mn(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(s)}function Vn(e){if(!e)return;const t=In(e);return`timeUnitSpecifier(${F(t)}, ${F(Un)})`}function Jn(e){if(!e)return;let t;return O(e)?t={unit:e}:f(e)&&(t=Object.assign(Object.assign({},e),e.unit?{unit:e.unit}:{})),Wn(t.unit)&&(t.utc=!0,t.unit=t.unit.substr(3)),t}function Yn(e){return e&&!!e.signal}function Xn(e){return!!e.step}function Qn(e){return!c(e)&&("field"in e&&"data"in e)}const Kn=V({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1}),Zn={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},ei=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function ti(e){return e&&!!e.field&&void 0!==e.equal}function ni(e){return e&&!!e.field&&void 0!==e.lt}function ii(e){return e&&!!e.field&&void 0!==e.lte}function ri(e){return e&&!!e.field&&void 0!==e.gt}function oi(e){return e&&!!e.field&&void 0!==e.gte}function si(e){if(e&&e.field){if(c(e.range)&&2===e.range.length)return!0;if(Yn(e.range))return!0}return!1}function ai(e){return e&&!!e.field&&(c(e.oneOf)||c(e.in))}function ui(e){return ai(e)||ti(e)||si(e)||ni(e)||ri(e)||ii(e)||oi(e)}function li(e,t){return ao(e,{timeUnit:t,wrapTime:!0})}function ci(e,t=!0){var n;const{field:i}=e,r=null===(n=Jn(e.timeUnit))||void 0===n?void 0:n.unit,o=r?"time("+Gn(r,i)+")":Ur(e,{expr:"datum"});if(ti(e))return o+"==="+li(e.equal,r);if(ni(e)){return`${o}<${li(e.lt,r)}`}if(ri(e)){return`${o}>${li(e.gt,r)}`}if(ii(e)){return`${o}<=${li(e.lte,r)}`}if(oi(e)){return`${o}>=${li(e.gte,r)}`}if(ai(e))return`indexof([${function(e,t){return e.map(e=>li(e,t))}(e.oneOf,r).join(",")}], ${o}) !== -1`;if(function(e){return e&&!!e.field&&void 0!==e.valid}(e))return fi(o,e.valid);if(si(e)){const{range:n}=e,i=Yn(n)?{signal:n.signal+"[0]"}:n[0],s=Yn(n)?{signal:n.signal+"[1]"}:n[1];if(null!==i&&null!==s&&t)return"inrange("+o+", ["+li(i,r)+", "+li(s,r)+"])";const a=[];return null!==i&&a.push(`${o} >= ${li(i,r)}`),null!==s&&a.push(`${o} <= ${li(s,r)}`),a.length>0?a.join(" && "):"true"}throw new Error("Invalid field predicate: "+JSON.stringify(e))}function fi(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function di(e){var t;return ui(e)&&e.timeUnit?Object.assign(Object.assign({},e),{timeUnit:null===(t=Jn(e.timeUnit))||void 0===t?void 0:t.unit}):e}const gi="quantitative",pi="ordinal",mi="temporal",hi="nominal",bi="geojson";const vi="linear",yi="log",xi="pow",Oi="sqrt",wi="symlog",ji="time",Ai="utc",Di="quantile",Fi="quantize",ki="threshold",Ci="point",Ei="band",Si={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function $i(e,t){const n=Si[e],i=Si[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const Bi={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function _i(e){return Bi[e]}const zi=["linear","log","pow","sqrt","symlog","time","utc"],Pi=j(zi),Ni=j(["linear","log","pow","sqrt","symlog"]);const Li=j(["quantile","quantize","threshold"]),Mi=j(zi.concat(["quantile","quantize","threshold","sequential","identity"])),Ti=j(["ordinal","bin-ordinal","point","band"]);function qi(e){return e in Ti}function Ri(e){return e in Mi}function Wi(e){return e in Pi}function Ui(e){return e in Li}function Ii(e){return null==e?void 0:e.selection}const Hi=A({type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},["type","domain","range","rangeMax","rangeMin","scheme"]),Gi=V(Hi);function Vi(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!M(["point","band","identity"],e);case"bins":return!M(["point","band","identity","ordinal"],e);case"round":return Wi(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return Wi(e)||M(["point","band"],e);case"paddingOuter":case"align":return M(["point","band"],e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"clamp":return Wi(e);case"nice":return Wi(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return Ri(e)&&!M(["log","time","utc","threshold","quantile"],e)}}function Ji(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return vt(e)?void 0:`Cannot use the scale property "${e}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}function Yi(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,s=tr(e);return Sr(n)&&!Xe(n.aggregate)&&r&&Wi(r.get("type"))&&!1===r.get("zero")?Xi({fieldDef:n,channel:t,markDef:i,ref:s,config:o}):s}function Xi({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(_e(n.type))return i;return null===bo("invalid",n,r)?i:[Qi(e,t),i]}function Qi(e,t){const n=Ki(e,!0),i="y"===Ct(t)?{field:{group:"height"}}:{value:0};return Object.assign({test:n},i)}function Ki(e,t=!0){return fi(O(e)?e:Ur(e,{expr:"datum"}),!t)}function Zi(e,t,n,i){const r={};if(t&&(r.scale=t),Br(e)){const{datum:t}=e;_n(t)?r.signal=Tn(t):Yn(t)?r.signal=t.signal:r.value=t}else r.field=Ur(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function er({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,band:o=.5}){const s=0Q(`${"unit"===e?"":`_${e}_`}${i[e]}`)).join(""):(n?"utc":"")+"timeunit"+V(i).map(e=>Q(`_${e}_${i[e]}`)).join("")}(f),u=(!M(["range","mid"],t.binSuffix)&&t.binSuffix||"")+(null!==(r=t.suffix)&&void 0!==r?r:""))}s&&(o=o?`${s}_${o}`:s)}var c;return u&&(o=`${o}_${u}`),a&&(o=`${a}_${o}`),t.forAs?oe(o):t.expr?function(e,t="datum"){return`${t}[${w(s(e).join("."))}]`}(o,t.expr)+l:ie(o)+l}function Ir(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return Sr(e)&&!!e.bin;case"temporal":return!1}throw new Error(gn(e.type))}function Hr(e){return!Ir(e)}const Gr=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(Ve(t))return`${r} for argmax(${t.argmax})`;if(Ge(t))return`${r} for argmin(${t.argmin})`;const o=Jn(i),s=t||(null==o?void 0:o.unit)||(null==o?void 0:o.maxbins)&&"timeunit"||Xt(n)&&"bin";return s?s.toUpperCase()+"("+r+")":r}(e);default:return function(e,t){var n;const{field:i,bin:r,timeUnit:o,aggregate:s}=e;if("count"===s)return t.countTitle;if(Xt(r))return i+" (binned)";if(o){const e=null===(n=Jn(o))||void 0===n?void 0:n.unit;if(e)return`${i} (${In(e).join("-")})`}else if(s)return Ve(s)?`${i} for max ${s.argmax}`:Ge(s)?`${i} for min ${s.argmin}`:`${ee(s)} of ${i}`;return i}(e,t)}};let Vr=Gr;function Jr(e){Vr=e}function Yr(e,t,{allowDisabling:n,includeDefault:i=!0}){var r,o;const s=null===(r=Xr(e))||void 0===r?void 0:r.title;if(!Sr(e))return s;const a=e,u=i?Qr(a,t):void 0;return n?ae(s,a.title,u):null!==(o=null!=s?s:a.title)&&void 0!==o?o:u}function Xr(e){return Tr(e)&&e.axis?e.axis:qr(e)&&e.legend?e.legend:Or(e)&&e.header?e.header:void 0}function Qr(e,t){return Vr(e,t)}function Kr(e){var t;if(Rr(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const n=null!==(t=Xr(e))&&void 0!==t?t:{},{format:i,formatType:r}=n;return{format:i,formatType:r}}}function Zr(e){return Sr(e)?e:Cr(e)?e.condition:void 0}function eo(e){return Pr(e)?e:Er(e)?e.condition:void 0}function to(e,t,n,i={}){if(O(e)||x(e)||y(e)){return Bn(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${P(n)}}.`}(t,O(e)?"string":x(e)?"number":"boolean",e)),{value:e}}return Pr(e)?no(e,t,n,i):Er(e)?Object.assign(Object.assign({},e),{condition:no(e.condition,t,n,i)}):e}function no(e,t,n,i){if(Rr(e)){const{format:r,formatType:o}=e,s=A(e,["format","formatType"]);if(ir(o)&&!n.customFormatTypes)return Bn(dn(t)),no(s,t,n,i)}else{const r=Tr(e)?"axis":qr(e)?"legend":Or(e)?"header":null;if(r&&e[r]){const o=e[r],{format:s,formatType:a}=o,u=A(o,["format","formatType"]);if(ir(a)&&!n.customFormatTypes)return Bn(dn(t)),no(Object.assign(Object.assign({},e),{[r]:u}),t,n,i)}}return Sr(e)?io(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=x(n)?"quantitative":O(n)?"nominal":_n(n)?"temporal":void 0,Object.assign(Object.assign({},e),{type:t})}(e)}function io(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:s}=e,a=Object.assign({},e);if(n||!i||Je(i)||Ve(i)||Ge(i)||(Bn(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete a.aggregate),r&&(a.timeUnit=Jn(r)),s&&(a.field=""+s),Xt(o)&&(a.bin=ro(o,t)),Qt(o)&&!Nt(t)&&Bn(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),Nr(a)){const{type:e}=a,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case gi:return"quantitative";case"t":case mi:return"temporal";case"o":case pi:return"ordinal";case"n":case hi:return"nominal";case bi:return"geojson"}}(e);e!==t&&(a.type=t),"quantitative"!==e&&Xe(i)&&(Bn(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),a.type="quantitative")}else if(!kt(t)){const e=function(e,t){var n;switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal"}if(Ar(e)&&c(e.sort))return"ordinal";const{aggregate:i,bin:r,timeUnit:o}=e;if(o)return"temporal";if(r||i&&!Ve(i)&&!Ge(i))return"quantitative";if(Mr(e)&&(null===(n=e.scale)||void 0===n?void 0:n.type))switch(Si[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(a,t);a.type=e}if(Nr(a)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case Ze:case et:case"facet":return Hr(e)?{compatible:!1,warning:bn(t)}:oo;case tt:case nt:case ut:case lt:case ct:case"text":case"detail":case"key":case"tooltip":case"href":case"url":case"angle":case st:case ot:case"description":return oo;case"longitude":case"longitude2":case"latitude":case"latitude2":return n!==gi?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:oo;case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case dt:case at:case"radius2":case it:case rt:return"nominal"!==n||e.sort?oo:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case"strokeDash":return M(["ordinal","nominal"],e.type)?oo:{compatible:!1,warning:"StrokeDash channel should be used with only discrete data."};case ft:return M(["ordinal","nominal","geojson"],e.type)?oo:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case"order":return"nominal"!==e.type||"sort"in e?oo:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(a,t)||{};!1===e&&Bn(n)}if(Ar(a)&&O(a.sort)){const{sort:e}=a;if(hr(e))return Object.assign(Object.assign({},a),{sort:{encoding:e}});const t=e.substr(1);if("-"===e.charAt(0)&&hr(t))return Object.assign(Object.assign({},a),{sort:{encoding:t,order:"descending"}})}if(Or(a)){const{header:e}=a,{orient:t}=e,n=A(e,["orient"]);if(t)return Object.assign(Object.assign({},a),{header:Object.assign(Object.assign({},n),{labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t})})}return a}function ro(e,t){return y(e)?{maxbins:en(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:Object.assign(Object.assign({},e),{maxbins:en(t)})}const oo={compatible:!0};function so(e){const{formatType:t}=Kr(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||Sr(n)&&!!n.timeUnit));var n}function ao(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){var o;const s=t&&(null===(o=Jn(t))||void 0===o?void 0:o.unit);let a,u=s||"temporal"===n;return Yn(e)?a=e.signal:_n(e)?(u=!0,a=Tn(e)):(O(e)||x(e))&&u&&(a=`datetime(${JSON.stringify(e)})`,function(e){return!!qn[e]}(s)&&(x(e)&&e<1e4||O(e)&&isNaN(Date.parse(e)))&&(a=Tn({[s]:e}))),a?i&&u?`time(${a})`:a:r?void 0:JSON.stringify(e)}function uo(e,t){const{type:n}=e;return t.map(t=>{const i=ao(t,{timeUnit:Sr(e)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t})}function lo(e,t){return Xt(e.bin)?It(t)&&M(["ordinal","nominal"],e.type):(console.warn("Only call this method for binned field defs."),!1)}function co(e){const{anchor:t,frame:n,offset:i,orient:r,color:o,subtitleColor:s,subtitleFont:a,subtitleFontSize:u,subtitleFontStyle:l,subtitleFontWeight:c,subtitleLineHeight:f,subtitlePadding:d}=e,g=A(e,["anchor","frame","offset","orient","color","subtitleColor","subtitleFont","subtitleFontSize","subtitleFontStyle","subtitleFontWeight","subtitleLineHeight","subtitlePadding"]),p=Object.assign(Object.assign({},g),o?{fill:o}:{}),m=Object.assign(Object.assign(Object.assign(Object.assign({},t?{anchor:t}:{}),n?{frame:n}:{}),i?{offset:i}:{}),r?{orient:r}:{}),h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},s?{subtitleColor:s}:{}),a?{subtitleFont:a}:{}),u?{subtitleFontSize:u}:{}),l?{subtitleFontStyle:l}:{}),c?{subtitleFontWeight:c}:{}),f?{subtitleLineHeight:f}:{}),d?{subtitlePadding:d}:{});return{titleMarkConfig:p,subtitleMarkConfig:_(p,["align","baseline","dx","dy","limit"]),nonMark:m,subtitle:h}}function fo(e){return O(e)||c(e)&&O(e[0])}function go(e){return Yn(e)?e:void 0!==e?{value:e}:void 0}function po(e){return Yn(e)?e.signal:w(e.value)}function mo(e){return Yn(e)?e.signal:null==e?null:w(e)}function ho(e){var t;return[].concat(e.type,null!==(t=e.style)&&void 0!==t?t:[])}function bo(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&void 0!==t[r]?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?vo(e,t,n,i):void 0}function vo(e,t,n,{vgChannel:i}={}){return ae(i?yo(e,t,n.style):void 0,yo(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function yo(e,t,n){return xo(e,ho(t),n)}function xo(e,t,n){let i;t=h(t);for(const r of t){const t=n[r];t&&void 0!==t[e]&&(i=t[e])}return i}function Oo(e,t){return h(e).reduce((e,n)=>{var i;return e.field.push(Ur(n,t)),e.order.push(null!==(i=n.sort)&&void 0!==i?i:"ascending"),e},{field:[],order:[]})}function wo(e,t){const n=[...e];return t.forEach(e=>{for(const t of n)if($(t,e))return;n.push(e)}),n}function jo(e,t){return $(e,t)||!t?e:e?[...h(e),...h(t)].join(", "):t}function Ao(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((fo(n)||Yn(n))&&(fo(i)||Yn(i)))return{explicit:e.explicit,value:jo(n,i)};if(fo(n)||Yn(n))return{explicit:e.explicit,value:n};if(fo(i)||Yn(i))return{explicit:e.explicit,value:i};if(!(fo(n)||Yn(n)||fo(i)||Yn(i)))return{explicit:e.explicit,value:wo(n,i)};throw new Error("It should never reach here")}function Do(e,t){const n=e&&e[t];return!!n&&(c(n)?T(n,e=>!!e.field):Sr(n)||Cr(n))}function Fo(e){return T(wt,t=>{if(Do(e,t)){const n=e[t];if(c(n))return T(n,e=>!!e.aggregate);{const e=Zr(n);return e&&!!e.aggregate}}return!1})}function ko(e,t){const n=[],i=[],r=[],o=[],s={};return So(e,(a,u)=>{if(Sr(a)){const{field:l,aggregate:c,bin:f,timeUnit:d}=a,g=A(a,["field","aggregate","bin","timeUnit"]);if(c||d||f){const e=Xr(a),p=e&&e.title;let m=Ur(a,{forAs:!0});const h=Object.assign(Object.assign(Object.assign({},p?[]:{title:Yr(a,t,{allowDisabling:!0})}),g),{field:m});if(c){let e;if(Ve(c)?(e="argmax",m=Ur({op:"argmax",field:c.argmax},{forAs:!0}),h.field=`${m}.${l}`):Ge(c)?(e="argmin",m=Ur({op:"argmin",field:c.argmin},{forAs:!0}),h.field=`${m}.${l}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:m};l&&(t.field=l),o.push(t)}}else if(n.push(m),Nr(a)&&Xt(f)){if(i.push({bin:f,field:l,as:m}),n.push(Ur(a,{binSuffix:"end"})),lo(a,u)&&n.push(Ur(a,{binSuffix:"range"})),Nt(u)){const e={field:m+"_end"};s[u+"2"]=e}h.bin="binned",kt(u)||(h.type=gi)}else if(d){r.push({timeUnit:d,field:l,as:m});const e=Nr(a)&&a.type!==mi&&"time";e&&("text"===u||"tooltip"===u?h.formatType=e:!function(e){return!!Bt[e]}(u)?Nt(u)&&(h.axis=Object.assign({formatType:e},h.axis)):h.legend=Object.assign({formatType:e},h.legend))}s[u]=h}else n.push(l),s[u]=e[u]}else s[u]=e[u]}),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:s}}function Co(e,t,n,i){return V(e).reduce((r,o)=>{if(!Dt(o))return Bn(function(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}(o)),r;const s=e[o];if("angle"!==o||"arc"!==t||e.theta||(Bn("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=st),!function(e,t,n){const i=Ht(t,n);if(!i)return!1;if("binned"===i){const n=e[t===it?tt:nt];return!!(Sr(n)&&Sr(e[t])&&Qt(n.bin))}return!0}(e,o,t))return Bn(hn(o,t)),r;if(o===dt&&"line"===t){const t=Zr(e[o]);if(null==t?void 0:t.aggregate)return Bn("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead."),r}if(o===ut&&(n?"fill"in e:"stroke"in e))return Bn(pn("encoding",{fill:"fill"in e,stroke:"stroke"in e})),r;if("detail"===o||"order"===o&&!c(s)&&!Lr(s)||"tooltip"===o&&c(s))s&&(r[o]=h(s).reduce((e,t)=>(Sr(t)?e.push(io(t,o)):Bn(mn(t,o)),e),[]));else{if("tooltip"===o&&null===s)r[o]=null;else if(!(Sr(s)||Br(s)||Lr(s)||kr(s)||Yn(s)))return Bn(mn(s,o)),r;r[o]=to(s,o,i)}return r},{})}function Eo(e,t){return V(e).reduce((n,i)=>{const r=to(e[i],i,t,{compositeMark:!0});return n[i]=r,n},{})}function So(e,t,n){if(e)for(const i of V(e)){const r=e[i];if(c(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function $o(e,t,n,i){return e?V(e).reduce((n,r)=>{const o=e[r];return c(o)?o.reduce((e,n)=>t.call(i,e,n,r),n):t.call(i,n,o,r)},n):n}function Bo(e,t){return V(t).reduce((n,i)=>{switch(i){case tt:case nt:case"href":case"description":case"url":case it:case rt:case st:case at:case ot:case"radius2":case"latitude":case"longitude":case"latitude2":case"longitude2":case"text":case ft:case"angle":case"tooltip":return n;case"order":if("line"===e||"trail"===e)return n;case"detail":case"key":{const e=t[i];if(c(e)||Sr(e))for(const t of h(e))t.aggregate||n.push(Ur(t,{}));return n}case dt:if("trail"===e)return n;case ut:case lt:case ct:case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeDash":case"strokeWidth":{const e=Zr(t[i]);return e&&!e.aggregate&&n.push(Ur(e,{})),n}}},[])}function _o(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map(({fieldPrefix:e,titlePrefix:n})=>{const r=i?" of "+zo(t):"";return{field:e+t.field,type:t.type,title:Yn(n)?{signal:n+`"${escape(r)}"`}:n+r}}),...W(function(e){const t=[];for(const n of V(e))if(Do(e,n)){const i=h(e[n]);for(const e of i)Sr(e)?t.push(e):Cr(e)&&t.push(e.condition)}return t}(n).map(Wr),N)]}}function zo(e){const{title:t,field:n}=e;return ae(t,n)}function Po(e,t,n,i,r){const{scale:o,axis:s}=n;return({partName:a,mark:u,positionPrefix:l,endPositionPrefix:c,extraEncoding:f={}})=>{const d=zo(n);return No(e,a,r,{mark:u,encoding:Object.assign(Object.assign(Object.assign({[t]:Object.assign(Object.assign(Object.assign({field:l+"_"+n.field,type:n.type},void 0!==d?{title:d}:{}),void 0!==o?{scale:o}:{}),void 0!==s?{axis:s}:{})},O(c)?{[t+"2"]:{field:c+"_"+n.field}}:{}),i),f)})}}function No(e,t,n,i){const{clip:r,color:o,opacity:s}=e,a=e.type;return e[t]||void 0===e[t]&&n[t]?[Object.assign(Object.assign({},i),{mark:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n[t]),r?{clip:r}:{}),o?{color:o}:{}),s?{opacity:s}:{}),Ne(i.mark)?i.mark:{type:i.mark}),{style:`${a}-${t}`}),y(e[t])?{}:e[t])})]:[]}function Lo(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],s=i[r+"2"],a=i[r+"Error"],u=i[r+"Error2"];return{continuousAxisChannelDef:Mo(o,n),continuousAxisChannelDef2:Mo(s,n),continuousAxisChannelDefError:Mo(a,n),continuousAxisChannelDefError2:Mo(u,n),continuousAxis:r}}function Mo(e,t){if(e&&e.aggregate){const{aggregate:n}=e,i=A(e,["aggregate"]);return n!==t&&Bn(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function To(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(Ne(n)&&n.orient)return n.orient;if(_r(r)){if(_r(o)){const e=Sr(r)&&r.aggregate,n=Sr(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return so(o)&&!so(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(_r(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const qo=new Ue("boxplot",Wo);function Ro(e){return x(e)?"tukey":e}function Wo(e,{config:t}){var n,i;e=Object.assign(Object.assign({},e),{encoding:Eo(e.encoding,t)});const{mark:r,encoding:o,selection:s,projection:a}=e,u=A(e,["mark","encoding","selection","projection"]),l=Ne(r)?r:{type:r};s&&Bn(ln("boxplot"));const d=null!==(n=l.extent)&&void 0!==n?n:t.boxplot.extent,g=bo("size",l,t),p=Ro(d),{transform:m,continuousAxisChannelDef:h,continuousAxis:b,groupby:v,aggregate:y,encodingWithoutContinuousAxis:x,ticksOrient:O,boxOrient:w,customTooltipWithoutAggregatedField:j}=function(e,t,n){const i=To(e,"boxplot"),{continuousAxisChannelDef:r,continuousAxis:o}=Lo(e,i,"boxplot"),s=r.field,a=Ro(t),u=[...Uo(s),{op:"median",field:s,as:"mid_box_"+s},{op:"min",field:s,as:("min-max"===a?"lower_whisker_":"min_")+s},{op:"max",field:s,as:("min-max"===a?"upper_whisker_":"max_")+s}],l="min-max"===a||"tukey"===a?[]:[{calculate:`datum["upper_box_${s}"] - datum["lower_box_${s}"]`,as:"iqr_"+s},{calculate:`min(datum["upper_box_${s}"] + datum["iqr_${s}"] * ${t}, datum["max_${s}"])`,as:"upper_whisker_"+s},{calculate:`max(datum["lower_box_${s}"] - datum["iqr_${s}"] * ${t}, datum["min_${s}"])`,as:"lower_whisker_"+s}],f=e.encoding,d=o,g=(f[d],A(f,["symbol"==typeof d?d:d+""])),{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=function(e){const{tooltip:t}=e,n=A(e,["tooltip"]);if(!t)return{filteredEncoding:n};let i,r;if(c(t)){for(const e of t)e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return c(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(g),{bins:h,timeUnits:b,aggregate:v,groupby:y,encoding:x}=ko(m,n),O="vertical"===i?"horizontal":"vertical",w=i;return{transform:[...h,...b,{aggregate:[...v,...u],groupby:y},...l],groupby:y,aggregate:v,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:x,ticksOrient:O,boxOrient:w,customTooltipWithoutAggregatedField:p}}(e,d,t),{color:D,size:F}=x,k=A(x,["color","size"]),C=e=>Po(l,b,h,e,t.boxplot),E=C(k),S=C(x),$=C(Object.assign(Object.assign({},k),F?{size:F}:{})),B=_o([{fieldPrefix:"min-max"===p?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===p?"lower_whisker_":"min_",titlePrefix:"Min"}],h,x),_={type:"tick",color:"black",opacity:1,orient:O,invalid:null,aria:!1},P="min-max"===p?B:_o([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],h,x),N=[...E({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:P}),...E({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:P}),...E({partName:"ticks",mark:_,positionPrefix:"lower_whisker",extraEncoding:P}),...E({partName:"ticks",mark:_,positionPrefix:"upper_whisker",extraEncoding:P})],L=[..."tukey"!==p?N:[],...S({partName:"box",mark:Object.assign(Object.assign({type:"bar"},g?{size:g}:{}),{orient:w,invalid:null,ariaRoleDescription:"box"}),positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:B}),...$({partName:"median",mark:Object.assign(Object.assign(Object.assign({type:"tick",invalid:null},f(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{}),g?{size:g}:{}),{orient:O,aria:!1}),positionPrefix:"mid_box",extraEncoding:B})];let M;if("min-max"!==p){const e=`datum["lower_box_${h.field}"]`,n=`datum["upper_box_${h.field}"]`,i=`(${n} - ${e})`,r=`${e} - ${d} * ${i}`,o=`${n} + ${d} * ${i}`,s=`datum["${h.field}"]`,a={joinaggregate:Uo(h.field),groupby:v};let u=void 0;"tukey"===p&&(u={transform:[{filter:`(${r} <= ${s}) && (${s} <= ${o})`},{aggregate:[{op:"min",field:h.field,as:"lower_whisker_"+h.field},{op:"max",field:h.field,as:"upper_whisker_"+h.field},{op:"min",field:"lower_box_"+h.field,as:"lower_box_"+h.field},{op:"max",field:"upper_box_"+h.field,as:"upper_box_"+h.field},...y],groupby:v}],layer:N});const c=A(k,["tooltip"]),{scale:f,axis:g}=h,m=zo(h),x=z(g,["title"]),O=No(l,"outliers",t.boxplot,{transform:[{filter:`(${s} < ${r}) || (${s} > ${o})`}],mark:"point",encoding:Object.assign(Object.assign({[b]:Object.assign(Object.assign(Object.assign({field:h.field,type:h.type},void 0!==m?{title:m}:{}),void 0!==f?{scale:f}:{}),G(x)?{}:{axis:x})},c),j?{tooltip:j}:{})})[0];O&&u?M={transform:[a],layer:[O,u]}:O?(M=O,M.transform.unshift(a)):u&&(M=u,M.transform.unshift(a))}return M?Object.assign(Object.assign({},u),{layer:[M,{transform:m,layer:L}]}):Object.assign(Object.assign({},u),{transform:(null!==(i=u.transform)&&void 0!==i?i:[]).concat(m),layer:L})}function Uo(e){return[{op:"q1",field:e,as:"lower_box_"+e},{op:"q3",field:e,as:"upper_box_"+e}]}const Io=new Ue("errorbar",Ho);function Ho(e,{config:t}){e=Object.assign(Object.assign({},e),{encoding:Eo(e.encoding,t)});const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:s,markDef:a,outerSpec:u,tooltipEncoding:l}=Vo(e,"errorbar",t),c=Po(a,r,i,o,t.errorbar),f={type:"tick",orient:s,aria:!1},d=[...c({partName:"ticks",mark:f,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:f,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar"},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return Object.assign(Object.assign(Object.assign({},u),{transform:n}),d.length>1?{layer:d}:Object.assign({},d[0]))}function Go(e,t){const{encoding:n}=e;if(function(e){return(Pr(e.x)||Pr(e.y))&&!Pr(e.x2)&&!Pr(e.y2)&&!Pr(e.xError)&&!Pr(e.xError2)&&!Pr(e.yError)&&!Pr(e.yError2)}(n))return{orient:To(e,t),inputType:"raw"};const i=function(e){return Pr(e.x2)||Pr(e.y2)}(n),r=function(e){return Pr(e.xError)||Pr(e.xError2)||Pr(e.yError)||Pr(e.yError2)}(n),o=n.x,s=n.y;if(i){if(r)throw new Error(t+" cannot be both type aggregated-upper-lower and aggregated-error");const e=n.x2,i=n.y2;if(Pr(e)&&Pr(i))throw new Error(t+" cannot have both x2 and y2");if(Pr(e)){if(_r(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error("Both x and x2 have to be quantitative in "+t)}if(Pr(i)){if(_r(s))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error("Both y and y2 have to be quantitative in "+t)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,a=n.yError2;if(Pr(i)&&!Pr(e))throw new Error(t+" cannot have xError2 without xError");if(Pr(a)&&!Pr(r))throw new Error(t+" cannot have yError2 without yError");if(Pr(e)&&Pr(r))throw new Error(t+" cannot have both xError and yError with both are quantiative");if(Pr(e)){if(_r(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(Pr(r)){if(_r(s))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function Vo(e,t,n){var i;const{mark:r,encoding:o,selection:s,projection:a}=e,u=A(e,["mark","encoding","selection","projection"]),l=Ne(r)?r:{type:r};s&&Bn(ln(t));const{orient:c,inputType:f}=Go(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:g,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:m,continuousAxis:h}=Lo(e,c,t),{errorBarSpecificAggregate:b,postAggregateCalculates:v,tooltipSummary:y,tooltipTitleWithFieldName:x}=function(e,t,n,i,r,o,s,a){let u=[],l=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":a.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&Bn(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,s)),"stderr"===n||"stdev"===n)u=[{op:n,field:c,as:"extent_"+c},{op:t,field:c,as:"center_"+c}],l=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:"upper_"+c},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:"lower_"+c}],f=[{fieldPrefix:"center_",titlePrefix:ee(t)},{fieldPrefix:"upper_",titlePrefix:Jo(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:Jo(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),u=[{op:t,field:c,as:"lower_"+c},{op:i,field:c,as:"upper_"+c},{op:e,field:c,as:"center_"+c}],f=[{fieldPrefix:"upper_",titlePrefix:Yr({field:c,aggregate:i,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Yr({field:c,aggregate:t,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Yr({field:c,aggregate:e,type:"quantitative"},a,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Bn((g=e.center,`${(p=e.extent)?"extent ":""}${p&&g?"and ":""}${g?"center ":""}${p&&g?"are ":"is "}not needed when data are aggregated.`)),"aggregated-upper-lower"===o?(f=[],l=[{calculate:`datum["${n.field}"]`,as:"upper_"+c},{calculate:`datum["${c}"]`,as:"lower_"+c}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`datum["${c}"] + datum["${i.field}"]`,as:"upper_"+c}],r?l.push({calculate:`datum["${c}"] + datum["${r.field}"]`,as:"lower_"+c}):l.push({calculate:`datum["${c}"] - datum["${i.field}"]`,as:"lower_"+c}));for(const e of l)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:re(re(e.calculate,'datum["',""),'"]',"")})}var g,p;return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,d,g,p,m,f,t,n),O=o,w=h,j=(O[w],"x"===h?"x2":"y2"),D=(O[j],"x"===h?"xError":"yError"),F=(O[D],"x"===h?"xError2":"yError2"),k=(O[F],A(O,["symbol"==typeof w?w:w+"","symbol"==typeof j?j:j+"","symbol"==typeof D?D:D+"","symbol"==typeof F?F:F+""])),{bins:C,timeUnits:E,aggregate:S,groupby:$,encoding:B}=ko(k,n),_=[...S,...b],z="raw"!==f?[]:$,P=_o(y,d,B,x);return{transform:[...null!==(i=u.transform)&&void 0!==i?i:[],...C,...E,...0===_.length?[]:[{aggregate:_,groupby:z}],...v],groupby:z,continuousAxisChannelDef:d,continuousAxis:h,encodingWithoutContinuousAxis:B,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:l,outerSpec:u,tooltipEncoding:P}}function Jo(e,t,n){return ee(e)+" "+n+" "+t}const Yo=new Ue("errorband",Xo);function Xo(e,{config:t}){e=Object.assign(Object.assign({},e),{encoding:Eo(e.encoding,t)});const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:s,outerSpec:a,tooltipEncoding:u}=Vo(e,"errorband",t),l=s,c=Po(l,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},g={type:f?"line":"rule"};const p=Object.assign(Object.assign({},l.interpolate?{interpolate:l.interpolate}:{}),l.tension&&l.interpolate?{tension:l.tension}:{});return f?(d=Object.assign(Object.assign(Object.assign({},d),p),{ariaRoleDescription:"errorband"}),g=Object.assign(Object.assign(Object.assign({},g),p),{aria:!1})):l.interpolate?Bn(Fn("interpolate")):l.tension&&Bn(Fn("tension")),Object.assign(Object.assign({},a),{transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:g,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:g,positionPrefix:"upper",extraEncoding:u})]})}const Qo={};function Ko(e,t,n){const i=new Ue(e,t);Qo[e]={normalizer:i,parts:n}}Ko("boxplot",Wo,["box","median","outliers","rule","ticks"]),Ko("errorbar",Ho,["ticks","rule"]),Ko("errorband",Xo,["band","borders"]);const Zo=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],es=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],ts={fillColor:{part:"legend",vgProp:"fill"},gradientStrokeColor:{part:"gradient",vgProp:"stroke"},labelColor:{part:"labels",vgProp:"fill"},strokeColor:{part:"legend",vgProp:"stroke"},symbolFillColor:{part:"symbols",vgProp:"fill"},symbolStrokeColor:{part:"symbols",vgProp:"stroke"},titleColor:{part:"title",vgProp:"fill"}},ns={single:{on:"click",fields:["_vgsid_"],resolve:"global",empty:"all",clear:"dblclick"},multi:{on:"click",fields:["_vgsid_"],toggle:"event.shiftKey",resolve:"global",empty:"all",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function is(e){return!(!e||"legend"!==e&&!e.legend)}function rs(e){return is(e)&&f(e)}function os(e){return"concat"in e}function ss(e){return"vconcat"in e}function as(e){return"hconcat"in e}function us(e){return f(e)&&void 0!==e.step}function ls(e){return e.view||e.width||e.height}const cs=V({align:1,bounds:1,center:1,columns:1,spacing:1});function fs(e,t){var n;return null!==(n=e[t])&&void 0!==n?n:e["width"===t?"continuousWidth":"continuousHeight"]}function ds(e,t){const n=gs(e,t);return us(n)?n.step:ps}function gs(e,t){var n;return ae(null!==(n=e[t])&&void 0!==n?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const ps=20,ms={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:ps},mark:{color:"#4c78a8",invalid:"filter",timeUnitBand:1},arc:{},area:{},bar:qe,circle:{},geoshape:{},image:{},line:{},point:{},rect:Re,rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:ns,style:{},title:{},facet:{spacing:20},concat:{spacing:20}},hs=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],bs={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},vs={blue:hs[0],orange:hs[1],red:hs[2],teal:hs[3],green:hs[4],yellow:hs[5],purple:hs[6],pink:hs[7],brown:hs[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function ys(e={}){const{color:t,font:n,fontSize:i}=e,r=A(e,["color","font","fontSize"]);return g({},ms,n?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(n):{},t?function(e={}){return{signals:[{name:"color",value:f(e)?Object.assign(Object.assign({},vs),e):vs}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},i?function(e){return{signals:[{name:"fontSize",value:f(e)?Object.assign(Object.assign({},bs),e):bs}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(i):{},r||{})}const xs=["view",...Pe],Os=["color","fontSize","background","padding","facet","concat","numberFormat","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],ws=Object.assign({view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"]},{area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]});function js(e){e=B(e);for(const t of Os)delete e[t];if(e.axis)for(const t in e.axis)de(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of Zo)delete e.legend[t];if(e.mark){for(const t of Me)delete e.mark[t];e.mark.tooltip&&f(e.mark.tooltip)&&delete e.mark.tooltip}for(const t of xs){for(const n of Me)delete e[t][n];const n=ws[t];if(n)for(const i of n)delete e[t][i];As(e,t)}for(const t of V(Qo))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=co(e.title);G(t)||(e.style["group-title"]=Object.assign(Object.assign({},e.style["group-title"]),t));G(n)||(e.style["group-subtitle"]=Object.assign(Object.assign({},e.style["group-subtitle"]),n));G(i)?delete e.title:e.title=i}(e);for(const t in e)f(e[t])&&G(e[t])&&delete e[t];return G(e)?void 0:e}function As(e,t,n,i){const r=i?e[t][i]:e[t];"view"===t&&(n="cell");const o=Object.assign(Object.assign({},r),e.style[null!=n?n:t]);G(o)||(e.style[null!=n?n:t]=o),i||delete e[t]}function Ds(e){return"layer"in e}const Fs={zero:1,center:1,normalize:1};const ks=new Set([ye,Oe,xe,Fe,Ae,Se,$e,je,ke,Ce]),Cs=new Set([Oe,xe,ye]);function Es(e,t){var n,i;const r="x"===t?"y":"radius",o=e[t],s=e[r];if(Sr(o)&&Sr(s))if("quantitative"===$r(o)&&"quantitative"===$r(s)){if(o.stack)return t;if(s.stack)return r;const e=Sr(o)&&!!o.aggregate;if(e!==(Sr(s)&&!!s.aggregate))return e?t:r;{const e=null===(n=o.scale)||void 0===n?void 0:n.type,a=null===(i=s.scale)||void 0===i?void 0:i.type;if(e&&"linear"!==e)return r;if(a&&"linear"!==a)return t}}else{if("quantitative"===$r(o))return t;if("quantitative"===$r(s))return r}else{if("quantitative"===$r(o))return t;if("quantitative"===$r(s))return r}}function Ss(e,t,n={}){const i=Ne(e)?e.type:e;if(!ks.has(i))return null;const r=Es(t,"x")||Es(t,"theta");if(!r)return null;const o=t[r],s=Sr(o)?Ur(o,{}):void 0;let a=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(r),u=t[a],l=Sr(u)?Ur(u,{}):void 0;l===s&&(l=void 0,u=void 0,a=void 0);const c=_t.reduce((e,n)=>{if("tooltip"!==n&&Do(t,n)){const i=t[n];for(const t of h(i)){const i=Zr(t);if(i.aggregate)continue;const r=Ur(i,{});r&&r===l||e.push({channel:n,fieldDef:i})}}return e},[]);let f;if(void 0!==o.stack?f=y(o.stack)?o.stack?"zero":null:o.stack:c.length>0&&Cs.has(i)&&(f="zero"),!f||!(f in Fs))return null;var d;if(Fo(t)&&0===c.length)return null;if(o.scale&&o.scale.type&&o.scale.type!==vi){if(n.disallowNonLinearStack)return null;Bn(function(e){return`Cannot stack non-linear scale (${e}).`}(o.scale.type))}return Pr(t[St(r)])?(void 0!==o.stack&&Bn(`Cannot stack "${d=r}" if there is already "${d}2".`),null):(Sr(o)&&o.aggregate&&!M(Qe,o.aggregate)&&Bn(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannel:u?a:void 0,groupbyField:l,fieldChannel:r,impute:null!==o.impute&&_e(i),stackBy:c,offset:f})}function $s(e){const t=A(e,["point","line"]);return V(t).length>1?t:t.type}function Bs(e){for(const t of["line","area","rule","trail"])e[t]&&(e=Object.assign(Object.assign({},e),{[t]:z(e[t],["point","line"])}));return e}function _s(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?f(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?f(t.point)?t.point:{}:void 0}function zs(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class Ps{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(We(e)){const{mark:n,encoding:i}=e,r=Ne(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!_s(r,t[r.type],i);case"area":return!!_s(r,t[r.type],i)||!!zs(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{selection:r,projection:o,mark:s,encoding:a}=e,u=A(e,["selection","projection","mark","encoding"]),l=Eo(a,i),c=Ne(s)?s:{type:s},f=_s(c,i[c.type],l),d="area"===c.type&&zs(c,i[c.type]),g=[Object.assign(Object.assign({},r?{selection:r}:{}),{mark:$s(Object.assign(Object.assign({},"area"===c.type&&void 0===c.opacity&&void 0===c.fillOpacity?{opacity:.7}:{}),c)),encoding:z(l,["shape"])})],p=Ss(c,l);let m=l;if(p){const{fieldChannel:e,offset:t}=p;m=Object.assign(Object.assign({},l),{[e]:Object.assign(Object.assign({},l[e]),t?{stack:t}:{})})}return d&&g.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"line"},_(c,["clip","interpolate","tension","tooltip"])),d),encoding:m})),f&&g.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"point",opacity:1,filled:!0},_(c,["clip","tooltip"])),f),encoding:m})),n(Object.assign(Object.assign({},u),{layer:g}),Object.assign(Object.assign({},t),{config:Bs(i)}))}}class Ns{constructor(){this.name="RangeStep"}hasMatchingType(e){var t;if(We(e)&&e.encoding)for(const n of Pt){const i=e.encoding[n];if(i&&Pr(i)&&(null===(t=null==i?void 0:i.scale)||void 0===t?void 0:t.rangeStep))return!0}return!1}run(e){var t;const n={};let i=Object.assign({},e.encoding);for(const e of Pt){const r=$t(e),o=i[e];if(o&&Pr(o)&&(null===(t=null==o?void 0:o.scale)||void 0===t?void 0:t.rangeStep)){const{scale:t}=o,s=A(o,["scale"]),a=A(t,["rangeStep"]);n[r]={step:t.rangeStep},Bn('Scale\'s "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.'),i=Object.assign(Object.assign({},i),{[e]:Object.assign(Object.assign({},s),G(a)?{}:{scale:a})})}}return Object.assign(Object.assign(Object.assign({},n),e),{encoding:i})}}function Ls(e,t){return t?xr(e)?Us(e,t):qs(e,t):e}function Ms(e,t){return t?Us(e,t):e}function Ts(e,t,n){const i=t[e];return function(e){return e&&!O(e)&&"repeat"in e}(i)?i.repeat in n?Object.assign(Object.assign({},t),{[e]:n[i.repeat]}):void Bn(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t}function qs(e,t){if(void 0!==(e=Ts("field",e,t))){if(null===e)return null;if(Ar(e)&&vr(e.sort)){const n=Ts("field",e.sort,t);e=Object.assign(Object.assign({},e),n?{sort:n}:{})}return e}}function Rs(e,t){if(Sr(e))return qs(e,t);{const n=Ts("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function Ws(e,t){if(!Pr(e)){if(Er(e)){const n=Rs(e.condition,t);if(n)return Object.assign(Object.assign({},e),{condition:n});return A(e,["condition"])}return e}{const n=Rs(e,t);if(n)return n;if(kr(e))return{condition:e.condition}}}function Us(e,t){const n={};for(const i in e)if(v(e,i)){const r=e[i];if(c(r))n[i]=r.map(e=>Ws(e,t)).filter(e=>e);else{const e=Ws(r,t);void 0!==e&&(n[i]=e)}}return n}class Is{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(We(e)){const{encoding:t,mark:n}=e;if("line"===n)for(const e of Ft){const n=t[Ct(e)];if(t[e]&&(Sr(n)&&!Qt(n.bin)||Br(n)))return!0}}return!1}run(e,t,n){const{encoding:i}=e;var r,o;return Bn((r=!!i.x2,o=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${r&&o?"x2 and y2":r?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n(Object.assign(Object.assign({},e),{mark:"rule"}),t)}}function Hs({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...V(e),...V(t)]);for(const o of r){const r=t[o],s=e[o];if(Pr(r)){const e=Object.assign(Object.assign({},s),r);i[o]=e}else Er(r)?i[o]=Object.assign(Object.assign({},r),{condition:Object.assign(Object.assign({},s),r.condition)}):r?i[o]=r:(n||Lr(s)||Yn(s)||Pr(s)||c(s))&&(i[o]=s)}}else i=t;return!i||G(i)?void 0:i}function Gs(e){const{parentProjection:t,projection:n}=e;return t&&n&&Bn(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${P(t)} is overridden by a child projection ${P(n)}.`}({parentProjection:t,projection:n})),null!=n?n:t}function Vs(e,t){void 0===t&&(t=ys(e.config));const n=function(e,t={}){return Js.map(e,{config:t})}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=We(e)||Ds(e),s={};o?"container"==i&&"container"==r?(s.type="fit",s.contains="padding"):"container"==i?(s.type="fit-x",s.contains="padding"):"container"==r&&(s.type="fit-y",s.contains="padding"):("container"==i&&(Bn(nn("width")),i=void 0),"container"==r&&(Bn(nn("height")),r=void 0));const a=Object.assign(Object.assign(Object.assign({type:"pad"},s),n?Ys(n.autosize):{}),Ys(e.autosize));"fit"!==a.type||o||(Bn('Autosize "fit" only works for single views and layered views.'),a.type="pad");"container"==i&&"fit"!=a.type&&"fit-x"!=a.type&&Bn(rn("width"));"container"==r&&"fit"!=a.type&&"fit-y"!=a.type&&Bn(rn("height"));if($(a,{type:"pad"}))return;return a}(n,{width:i,height:r,autosize:e.autosize},t);return Object.assign(Object.assign({},n),o?{autosize:o}:{})}const Js=new class extends class{map(e,t){return wr(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):as(e)?this.mapHConcat(e,t):ss(e)?this.mapVConcat(e,t):os(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Ds(e))return this.mapLayer(e,t);if(We(e))return this.mapUnit(e,t);throw new Error(tn(e))}mapLayer(e,t){return Object.assign(Object.assign({},e),{layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))})}mapHConcat(e,t){return Object.assign(Object.assign({},e),{hconcat:e.hconcat.map(e=>this.map(e,t))})}mapVConcat(e,t){return Object.assign(Object.assign({},e),{vconcat:e.vconcat.map(e=>this.map(e,t))})}mapConcat(e,t){const{concat:n}=e,i=A(e,["concat"]);return Object.assign(Object.assign({},i),{concat:n.map(e=>this.map(e,t))})}mapFacet(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapRepeat(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}}{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[qo,Io,Yo,new Ps,new Is,new Ns]}map(e,t){if(We(e)){const n=Do(e.encoding,Ze),i=Do(e.encoding,et),r=Do(e.encoding,"facet");if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=Ms(e.encoding,t.repeater),o=Object.assign(Object.assign({},e),r?{encoding:r}:{});if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const s=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,s);return o}mapRepeat(e,t){return function(e){return!c(e.repeat)&&e.repeat.layer}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i}=e,r=A(e,["repeat","spec"]),{row:o,column:s,layer:a}=n,{repeater:u={},repeaterPrefix:l=""}=t;return o||s?this.mapRepeat(Object.assign(Object.assign({},e),{repeat:Object.assign(Object.assign({},o?{row:o}:{}),s?{column:s}:{}),spec:{repeat:{layer:a},spec:i}}),t):Object.assign(Object.assign({},r),{layer:a.map(e=>{const n=Object.assign(Object.assign({},u),{layer:e}),r=(i.name||"")+l+"child__layer_"+Q(e),o=this.mapLayerOrUnit(i,Object.assign(Object.assign({},t),{repeater:n,repeaterPrefix:r}));return o.name=r,o})})}mapNonLayerRepeat(e,t){var n;const{repeat:i,spec:r,data:o}=e,s=A(e,["repeat","spec","data"]);!c(i)&&e.columns&&(e=z(e,["columns"]),Bn(cn("repeat")));const a=[],{repeater:u={},repeaterPrefix:l=""}=t,f=!c(i)&&i.row||[u?u.row:null],d=!c(i)&&i.column||[u?u.column:null],g=c(i)&&i||[u?u.repeat:null];for(const e of g)for(const n of f)for(const o of d){const s={repeat:e,row:n,column:o,layer:u.layer},f=(r.name||"")+l+"child__"+(c(i)?""+Q(e):(i.row?"row_"+Q(n):"")+(i.column?"column_"+Q(o):"")),d=this.map(r,Object.assign(Object.assign({},t),{repeater:s,repeaterPrefix:f}));d.name=f,a.push(z(d,["data"]))}const p=c(i)?e.columns:i.column?i.column.length:1;return Object.assign(Object.assign({data:null!==(n=r.data)&&void 0!==n?n:o,align:"all"},s),{columns:p,concat:a})}mapFacet(e,t){const{facet:n}=e;return xr(n)&&e.columns&&(e=z(e,["columns"]),Bn(cn("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:s}=t,a=Gs({parentProjection:o,projection:i}),u=Hs({parentEncoding:r,encoding:Ms(n,t.repeater)});return this.mapUnit(Object.assign(Object.assign(Object.assign({},e),a?{projection:a}:{}),u?{encoding:u}:{}),{config:s})}mapFacetedUnit(e,t){const n=e.encoding,{row:i,column:r,facet:o}=n,s=A(n,["row","column","facet"]),{mark:a,width:u,projection:l,height:c,view:f,selection:d,encoding:g}=e,p=A(e,["mark","width","projection","height","view","selection","encoding"]),{facetMapping:m,layout:h}=this.getFacetMappingAndLayout({row:i,column:r,facet:o},t),b=Ms(s,t.repeater);return this.mapFacet(Object.assign(Object.assign(Object.assign({},p),h),{facet:m,spec:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},u?{width:u}:{}),c?{height:c}:{}),f?{view:f}:{}),l?{projection:l}:{}),{mark:a,encoding:b}),d?{selection:d}:{})}),t)}getFacetMappingAndLayout(e,t){var n;const{row:i,column:r,facet:o}=e;if(i||r){o&&Bn(`Facet encoding dropped as ${(s=[...i?[Ze]:[],...r?[et]:[]]).join(" and ")} ${s.length>1?"are":"is"} also specified.`);const t={},a={};for(const i of[Ze,et]){const r=e[i];if(r){const e=A(r,["align","center","spacing","columns"]);t[i]=e;for(const e of["align","center","spacing"])void 0!==r[e]&&(a[e]=null!==(n=a[e])&&void 0!==n?n:{},a[e][i]=r[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:r}=o;return{facetMapping:Ls(A(o,["align","center","spacing","columns"]),t.repeater),layout:Object.assign(Object.assign(Object.assign(Object.assign({},e?{align:e}:{}),n?{center:n}:{}),i?{spacing:i}:{}),r?{columns:r}:{})}}var s}mapLayer(e,t){var{parentEncoding:n,parentProjection:i}=t,r=A(t,["parentEncoding","parentProjection"]);const{encoding:o,projection:s}=e,a=A(e,["encoding","projection"]),u=Object.assign(Object.assign({},r),{parentEncoding:Hs({parentEncoding:n,encoding:o,layer:!0}),parentProjection:Gs({parentProjection:i,projection:s})});return super.mapLayer(a,u)}};function Ys(e){return O(e)?{type:e}:null!=e?e:{}}const Xs=["background","padding"];function Qs(e){return Xs.reduce((t,n)=>(e&&void 0!==e[n]&&(t[n]=e[n]),t),{})}class Ks{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new Ks(B(this.explicit),B(this.implicit))}combine(){return Object.assign(Object.assign({},this.explicit),this.implicit)}get(e){return ae(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,t){void 0!==t.value&&this.set(e,t.value,t.explicit)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){void 0!==t.explicit[e]?this.set(e,t.explicit[e],!0):void 0!==t.implicit[e]&&this.set(e,t.implicit[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of V(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function Zs(e){return{explicit:!0,value:e}}function ea(e){return{explicit:!1,value:e}}function ta(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:na(t,n,i,r)}}function na(e,t,n,i){return e.explicit&&t.explicit&&Bn(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${P(n)} and ${P(i)}). Using ${P(n)}.`}(n,i,e.value,t.value)),e}function ia(e,t,n,i,r=na){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:$(e.value,t.value)?e:r(e,t,n,i)}class ra extends Ks{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function oa(e){return"url"in e}function sa(e){return"values"in e}function aa(e){return"name"in e&&!oa(e)&&!sa(e)&&!ua(e)}function ua(e){return e&&(la(e)||ca(e)||fa(e))}function la(e){return"sequence"in e}function ca(e){return"sphere"in e}function fa(e){return"graticule"in e}var da;function ga(e){return"filter"in e}function pa(e){return"lookup"in e}function ma(e){return"pivot"in e}function ha(e){return"density"in e}function ba(e){return"quantile"in e}function va(e){return"regression"in e}function ya(e){return"loess"in e}function xa(e){return"sample"in e}function Oa(e){return"window"in e}function wa(e){return"joinaggregate"in e}function ja(e){return"flatten"in e}function Aa(e){return"calculate"in e}function Da(e){return"bin"in e}function Fa(e){return"impute"in e}function ka(e){return"timeUnit"in e}function Ca(e){return"aggregate"in e}function Ea(e){return"stack"in e}function Sa(e){return"fold"in e}function $a(e,t,n){return Ba=t||za,_a=n||Na,Ma(e.trim()).map(Ta)}!function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup"}(da||(da={}));var Ba,_a,za="view",Pa=/[[\]{}]/,Na={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function La(e,t,n,i,r){for(var o,s=0,a=e.length;t=0?--s:i&&i.indexOf(o)>=0&&++s}return t}function Ma(e){for(var t=[],n=0,i=e.length,r=0;r"!==(e=e.slice(r+1).trim())[0])throw"Expected '>' after between selector: "+e;if(t=t.map(Ta),(n=Ta(e.slice(1).trim())).between)return{between:t,stream:n};n.between=t;return n}(e):function(e){var t,n,i={source:Ba},r=[],o=[0,0],s=0,a=0,u=e.length,l=0;if("}"===e[u-1]){if(!((l=e.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+e;try{o=function(e){var t=e.split(",");if(!e.length||t.length>2)throw e;return t.map((function(t){var n=+t;if(n!=n)throw e;return n}))}(e.substring(l+1,u-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,l).trim(),u=e.length,l=0}if(!u)throw e;"@"===e[0]&&(s=++l);(t=La(e,l,":"))1?(i.type=r[1],s?i.markname=r[0].slice(1):(c=r[0],_a[c]?i.marktype=r[0]:i.source=r[0])):i.type=r[0];var c;"!"===i.type.slice(-1)&&(i.consume=!0,i.type=i.type.slice(0,-1));null!=n&&(i.filter=n);o[0]&&(i.throttle=o[0]);o[1]&&(i.debounce=o[1]);return i}(e)}function qa(e,t,n,i){const r=kr(t)&&t.condition,o=i(t);if(r){return{[n]:[...h(r).map(t=>{const n=i(t),r=function(e){return e.selection}(t)?Xl(e,t.selection):Kl(e,t.test);return Object.assign({test:r},n)}),...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function Ra(e,t="text"){const n=e.encoding[t];return qa(e,n,t,t=>Wa(t,e.config))}function Wa(e,t,n="datum"){if(e){if(Lr(e))return go(e.value);if(Pr(e)){const{format:i,formatType:r}=Kr(e);return or({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function Ua(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,s=n.tooltip;if(c(s))return{tooltip:Ha({tooltip:s},o,r,t)};{const a=t.reactiveGeom?"datum.datum":"datum";return qa(e,s,"tooltip",e=>{const s=Wa(e,r,a);if(s)return s;if(null===e)return;let u=bo("tooltip",i,r);return!0===u&&(u={content:"encoding"}),O(u)?{value:u}:f(u)?Yn(u)?u:"encoding"===u.content?Ha(n,o,r,t):{signal:a}:void 0})}}function Ia(e,t,n,{reactiveGeom:i}={}){const r={},o=i?"datum.datum":"datum",s=[];function a(i,a){const u=Ct(a),l=Nr(i)?i:Object.assign(Object.assign({},i),{type:e[u].type}),c=h(l.title||Qr(l,n)).join(", ");let f;if(Nt(a)){const i="x"===a?"x2":"y2",s=Zr(e[i]);if(Qt(l.bin)&&s){const e=Ur(l,{expr:o}),t=Ur(s,{expr:o}),{format:a,formatType:u}=Kr(l);f=gr(e,t,a,u,n),r[i]=!0}else if(t&&t.fieldChannel===a&&"normalize"===t.offset){const{format:e,formatType:t}=Kr(l);f=or({fieldOrDatumDef:l,format:e,formatType:t,expr:o,config:n,normalizeStack:!0}).signal}}f=null!=f?f:Wa(l,n,o).signal,s.push({channel:a,key:c,value:f})}So(e,(e,t)=>{Sr(e)?a(e,t):Cr(e)&&a(e.condition,t)});const u={};for(const{channel:e,key:t,value:n}of s)r[e]||u[t]||(u[t]=n);return u}function Ha(e,t,n,{reactiveGeom:i}={}){const r=Y(Ia(e,t,n,{reactiveGeom:i})).map(({key:e,value:t})=>`"${e}": ${t}`);return r.length>0?{signal:`{${r.join(", ")}}`}:void 0}function Ga(e){const{markDef:t,config:n}=e,i=bo("aria",t,n);return!1===i?{}:Object.assign(Object.assign(Object.assign({},i?{aria:i}:{}),function(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=bo("ariaRoleDescription",n,i);if(null!=r)return{ariaRoleDescription:{value:r}};return t in Zn?{}:{ariaRoleDescription:{value:t}}}(e)),function(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return qa(e,o,"description",t=>Wa(t,e.config));const s=bo("description",n,i);if(null!=s)return{description:go(s)};if(!1===i.aria)return{};const a=Ia(t,r,i);if(G(a))return;return{description:{signal:Y(a).map(({key:e,value:t},n)=>`"${n>0?"; ":""}${e}: " + (${t})`).join(" + ")}}}(e))}function Va(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:s}=n;let{defaultRef:a,defaultValue:u}=n;void 0===a&&(u=null!=u?u:bo(e,i,o,{vgChannel:s,ignoreVgConfig:!0}),void 0!==u&&(a=go(u)));const l=r[e];return qa(t,l,null!=s?s:e,n=>tr({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:a}))}function Ja(e,t={filled:void 0}){var n,i,r,o;const{markDef:s,encoding:a,config:u}=e,{type:l}=s,c=null!==(n=t.filled)&&void 0!==n?n:bo("filled",s,u),f=M(["bar","point","circle","square","geoshape"],l)?"transparent":void 0,d=null!==(r=null!==(i=bo(!0===c?"color":void 0,s,u,{vgChannel:"fill"}))&&void 0!==i?i:u.mark[!0===c&&"color"])&&void 0!==r?r:f,g=null!==(o=bo(!1===c?"color":void 0,s,u,{vgChannel:"stroke"}))&&void 0!==o?o:u.mark[!1===c&&"color"],p=c?"fill":"stroke",m=Object.assign(Object.assign({},d?{fill:go(d)}:{}),g?{stroke:go(g)}:{});return s.color&&(c?s.fill:s.stroke)&&Bn(pn("property",{fill:"fill"in s,stroke:"stroke"in s})),Object.assign(Object.assign(Object.assign(Object.assign({},m),Va("color",e,{vgChannel:p,defaultValue:c?d:g})),Va("fill",e,{defaultValue:a.fill?d:void 0})),Va("stroke",e,{defaultValue:a.stroke?g:void 0}))}function Ya(e,t){const n=t[function(e){switch(e){case tt:return"xOffset";case nt:return"yOffset";case it:return"x2Offset";case rt:return"y2Offset";case st:return"thetaOffset";case ot:return"radiusOffset";case at:return"theta2Offset";case"radius2":return"radius2Offset"}}(e)];if(n)return n}function Xa(e,t,{defaultPos:n,vgChannel:i,isMidPoint:r}){const{encoding:o,markDef:s,config:a,stack:u}=t,l=o[e],c=o[St(e)],f=t.scaleName(e),d=t.getScaleComponent(e),g=Ya(e,s),p=Qa({model:t,defaultPos:n,channel:e,scaleName:f,scale:d}),m=!l&&Nt(e)&&(o.latitude||o.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,isMidPoint:i,scaleName:r,stack:o,offset:s,markDef:a,config:u}=e;if(Pr(n)&&o&&t===o.fieldChannel){if(Sr(n)){const e=Dr({channel:t,fieldDef:n,isMidPoint:i,markDef:a,stack:o,config:u});if(void 0!==e)return er({scaleName:r,fieldOrDatumDef:n,startSuffix:"start",band:e,offset:s})}return Zi(n,r,{suffix:"end"},{offset:s})}return Yi(e)}({channel:e,channelDef:l,channel2Def:c,markDef:s,config:a,isMidPoint:r,scaleName:f,scale:d,stack:u,offset:g,defaultRef:p});return m?{[i||e]:m}:void 0}function Qa({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:s}=e;return()=>{const a=Ct(n),u=Et(n),l=bo(n,o,s,{vgChannel:u});if(void 0!==l)return nr(n,l);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(M([yi,ji,Ai],e));else if(r.domainDefinitelyIncludesZero())return{scale:i,value:0}}if("zeroOrMin"===t)return"y"===a?{field:{group:"height"}}:{value:0};switch(a){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":{const t=e[$t(n)];return Object.assign(Object.assign({},t),{mult:.5})}}}}const Ka={left:"x",center:"xc",right:"x2"},Za={top:"y",middle:"yc",bottom:"y2"};function eu(e,t,n,i="middle"){if("radius"===e||"theta"===e)return Et(e);const r=bo("x"===e?"align":"baseline",t,n);return"x"===e?Ka[r||("top"===i?"left":"center")]:Za[r||i]}function tu(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?nu(e,t,{defaultPos:n,defaultPos2:i}):Xa(e,t,{defaultPos:n})}function nu(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,s=St(e),a=$t(e),u=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:s,config:a}=e,u=Ct(n),l=$t(n),c=Et(n),f=i[u],d=e.scaleName(u),g=e.getScaleComponent(u),p=Ya(n in i||n in o?n:u,e.markDef);if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude))return{[c]:{field:e.getName(n)}};const m=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:s,stack:a,offset:u,defaultRef:l}){if(Pr(t)&&a&&e.charAt(0)===a.fieldChannel.charAt(0))return Zi(t,o,{suffix:"start"},{offset:u});return Yi({channel:e,channelDef:n,scaleName:o,scale:s,stack:a,markDef:i,config:r,offset:u,defaultRef:l})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:a,scaleName:d,scale:g,stack:s,offset:p,defaultRef:void 0});if(void 0!==m)return{[c]:m};return iu(n,o)||iu(n,{[n]:yo(n,o,a.style),[l]:yo(l,o,a.style)})||iu(n,a[r])||iu(n,a.mark)||{[c]:Qa({model:e,defaultPos:t,channel:n,scaleName:d,scale:g})()}}(t,i,s),l=u[a]?eu(e,r,o):Et(e);return Object.assign(Object.assign({},Xa(e,t,{defaultPos:n,vgChannel:l})),u)}function iu(e,t){const n=$t(e),i=Et(e);return void 0!==t[i]?{[i]:nr(e,t[i])}:void 0!==t[e]?{[i]:nr(e,t[e])}:t[n]?{[n]:nr(e,t[n])}:void 0}function ru(e,t,n){var i,r,o,s;const{config:a,encoding:u,markDef:l,stack:f}=e,d=St(t),g=$t(t),p=u[t],m=u[d],h=e.getScaleComponent(t),b=h?h.get("type"):void 0,v=e.scaleName(t),y=l.orient,x=null!==(r=null!==(i=u[g])&&void 0!==i?i:u.size)&&void 0!==r?r:bo("size",l,a,{vgChannel:g}),O="bar"===n&&("x"===t?"vertical"===y:"horizontal"===y);if(Sr(p)&&(Xt(p.bin)||Qt(p.bin)||p.timeUnit&&!m)&&!x&&!qi(b)){const n=Dr({channel:t,fieldDef:p,stack:f,markDef:l,config:a}),i=null===(o=e.component.axes[t])||void 0===o?void 0:o[0];return function({fieldDef:e,fieldDef2:t,channel:n,band:i,scaleName:r,markDef:o,spacing:s=0,axisTranslate:a,reverse:u,config:l}){const c=St(n),f=Et(n),d=Et(c),g=Ya(n,o);if(Xt(e.bin)||e.timeUnit)return{[d]:au({channel:n,fieldDef:e,scaleName:r,markDef:o,band:(1-i)/2,offset:su(c,s,u,a,g),config:l}),[f]:au({channel:n,fieldDef:e,scaleName:r,markDef:o,band:1-(1-i)/2,offset:su(n,s,u,a,g),config:l})};if(Qt(e.bin)){const i=Zi(e,r,{},{offset:su(c,s,u,a,g)});if(Sr(t))return{[d]:i,[f]:Zi(t,r,{},{offset:su(n,s,u,a,g)})};if(Kt(e.bin)&&e.bin.step)return{[d]:i,[f]:{signal:`scale("${r}", ${Ur(e,{expr:"datum"})} + ${e.bin.step})`,offset:su(n,s,u,a,g)}}}return void Bn(kn(c))}({fieldDef:p,fieldDef2:m,channel:t,markDef:l,scaleName:v,band:n,axisTranslate:null!==(s=null==i?void 0:i.get("translate"))&&void 0!==s?s:.5,spacing:Nt(t)?bo("binSpacing",l,a):void 0,reverse:h.get("reverse"),config:a})}return(Pr(p)&&qi(b)||O)&&!m?function(e,t,n,i){var r;const{markDef:o,encoding:s,config:a,stack:u}=i,l=o.orient,f=i.scaleName(n),d=i.getScaleComponent(n),g=$t(n),p=St(n),m="horizontal"===l&&"y"===n||"vertical"===l&&"x"===n,h=bo(m?"size":g,o,a,{vgChannel:g});let b;(s.size||void 0!==h)&&(m?b=Va("size",i,{vgChannel:g,defaultValue:h}):Bn(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(o.type)));const v=null!==(r=Pr(t)?Dr({channel:n,fieldDef:t,markDef:o,stack:u,config:a}):void 0)&&void 0!==r?r:1;b=b||{[g]:ou(e,g,f,d,a,v)};const y="band"!==(null==d?void 0:d.get("type"))||!("band"in b[g]),x=eu(n,o,a,y?"middle":"top"),O=Ya(n,o),w=Yi({channel:n,channelDef:t,markDef:o,config:a,scaleName:f,scale:d,stack:u,offset:O,defaultRef:Qa({model:i,defaultPos:"mid",channel:n,scaleName:f,scale:d}),band:y?.5:(1-v)/2});if(g)return Object.assign({[x]:w},b);{const e=Et(p),t=b[g],n=O?Object.assign(Object.assign({},t),{offset:O}):t;return{[x]:w,[e]:c(w)?[w[0],Object.assign(Object.assign({},w[1]),{offset:n})]:Object.assign(Object.assign({},w),{offset:n})}}}(n,p,t,e):nu(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function ou(e,t,n,i,r,o){if(i){const t=i.get("type");if("point"===t||"band"===t){if(void 0!==r[e].discreteBandSize)return{value:r[e].discreteBandSize};if(t===Ci){const e=i.get("range");return Xn(e)&&x(e.step)?{value:e.step-2}:{value:ps-2}}return{scale:n,band:o}}return{value:r[e].continuousBandSize}}const s=ds(r.view,t),a=ae(r[e].discreteBandSize,s-2);return void 0!==a?{value:a}:void 0}function su(e,t,n,i,r){if(pt(e))return 0;const o="x"===e||"y2"===e?-t/2:t/2;if(Yn(n)||Yn(r)||Yn(i)){const e=mo(n),t=mo(r),s=mo(i);return{signal:(s?s+" + ":"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${o})`:o)}}return r=r||0,i+(n?-r-o:+r+o)}function au({channel:e,fieldDef:t,scaleName:n,markDef:i,band:r,offset:o,config:s}){return Xi({fieldDef:t,channel:e,markDef:i,ref:er({scaleName:n,fieldOrDatumDef:t,band:r,offset:o}),config:s})}const uu=new Set(["aria"]);function lu(e,t){const{fill:n,stroke:i}="include"===t.color?Ja(e):{};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},function(e,t){return Kn.reduce((n,i)=>(uu.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=go(e[i])),n),{})}(e.markDef,t)),cu(e,"fill",n)),cu(e,"stroke",i)),Va("opacity",e)),Va("fillOpacity",e)),Va("strokeOpacity",e)),Va("strokeWidth",e)),Va("strokeDash",e)),function(e){const{encoding:t,mark:n}=e,i=t.order;return!_e(n)&&Lr(i)?qa(e,i,"zindex",e=>e):{}}(e)),Ua(e)),Ra(e,"href")),Ga(e))}function cu(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===bo("invalid",o,i)&&n&&!_e(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&Ri(r)&&(t[o]=!0)}return t},{}),r=V(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>Ki(e,t)).join(` ${e} `)}return}(e,{invalid:!0,channels:Ut});if(i)return{[t]:[{test:i,value:null},...h(n)]}}return n?{[t]:n}:{}}function fu(e){const{config:t,markDef:n}=e;if(bo("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&Ri(r)&&(t[o]=!0)}return t},{}),r=V(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>Ki(e,t)).join(` ${e} `)}return}(e,{channels:Pt});if(t)return{defined:{signal:t}}}return{}}function du(e,t){if(void 0!==t)return{[e]:go(t)}}const gu={has:e=>"interval"!==e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName("voronoi")},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(_e(o))return Bn(`The "nearest" transform is not supported for ${o} marks.`),n;const s={name:e.getName("voronoi"),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:Object.assign({fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}},Ua(e,{reactiveGeom:!0}))},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let a=0,u=!1;return n.forEach((t,n)=>{var i;const r=null!==(i=t.name)&&void 0!==i?i:"";r===e.component.mark[0].name?a=n:r.indexOf("voronoi")>=0&&(u=!0)}),u||n.splice(a+1,0,s),n}};class pu{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.indexOf(e)>-1?Bn("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this),e.parent.removeChild(e),this.parent=t,e.parent=this}}class mu extends pu{constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}clone(){const e=new this.constructor;return e.debugName="clone_"+this.debugName,e._source=this._source,e._name="clone_"+this._name,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash="Output "+function(e){const t=++ue;return e?String(e)+t:t}()),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class hu extends pu{constructor(e,t){super(e),this.formula=t}clone(){return new hu(null,B(this.formula))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{const{field:r,timeUnit:o}=n,s=Dd(t)?t.encoding[St(i)]:void 0,a=Dd(t)&&Fr(i,n,s,t.stack,t.markDef,t.config);if(o){const t=Ur(n,{forAs:!0});e[N({as:t,field:r,timeUnit:o})]=Object.assign({as:t,field:r,timeUnit:o},a?{band:!0}:{})}return e},{});return G(n)?null:new hu(e,n)}static makeFromTransform(e,t){const n=Object.assign({},t),{timeUnit:i}=n,r=A(n,["timeUnit"]),o=Jn(i),s=Object.assign(Object.assign({},r),{timeUnit:o});return new hu(e,{[N(s)]:s})}merge(e){this.formula=Object.assign({},this.formula);for(const t in e.formula)this.formula[t]&&!e.formula[t].band||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(J(this.formula).map(e=>e.as))}dependentFields(){return new Set(J(this.formula).map(e=>e.field))}hash(){return"TimeUnit "+N(this.formula)}assemble(){const e=[];for(const t of J(this.formula)){const{field:n,as:i,timeUnit:r}=t,o=Jn(r),{unit:s,utc:a}=o,u=A(o,["unit","utc"]);e.push(Object.assign(Object.assign(Object.assign(Object.assign({field:ie(n),type:"timeunit"},s?{units:In(s)}:{}),a?{timezone:"utc"}:{}),u),{as:[i,i+"_end"]}))}return e}}class bu{constructor(...e){this.items=e,this.hasChannel={},this.hasField={}}}const vu={has:e=>"single"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!is(e.bind),parse:(e,t,n,i)=>{i.on||delete t.events,i.clear||delete t.clear},topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,s=t.init&&t.init[0],a=gu.has(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach((e,r)=>{var u,l;const c=Q(`${i}_${e.field}`);n.filter(e=>e.name===c).length||n.unshift(Object.assign(Object.assign({name:c},s?{init:Bu(s[r])}:{value:null}),{on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${a}[${w(e.field)}] : null`}]:[],bind:null!==(l=null!==(u=o[e.field])&&void 0!==u?u:o[e.channel])&&void 0!==l?l:o}))}),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter(e=>e.name===i+Wu)[0],s=i+"_tuple_fields",a=r.items.map(e=>Q(`${i}_${e.field}`)),u=a.map(e=>e+" !== null").join(" && ");return a.length&&(o.update=`${u} ? {fields: ${s}, values: [${a.join(", ")}]} : null`),delete o.value,delete o.on,n}},yu={has:e=>"multi"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+"_toggle",value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Wu,i=t.name+"_toggle";return`${i} ? null : ${n}, `+("global"===t.resolve?i+" ? null : true, ":`${i} ? null : {unit: ${Vu(e)}}, `)+`${i} ? ${n} : null`}},xu={has:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t,n)=>{n.clear&&(t.clear=O(n.clear)?$a(n.clear,"scope"):n.clear)},topLevelSignals:(e,t,n)=>{if(vu.has(t))for(const e of t.project.items){const i=n.findIndex(n=>n.name===Q(`${t.name}_${e.field}`));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const e of t.project.items){const t=n.findIndex(t=>t.name===e.signals.visual);if(i(t,"[0, 0]"),-1===t){i(n.findIndex(t=>t.name===e.signals.data),"null")}}else{let e=n.findIndex(e=>e.name===t.name+Wu);i(e,"null"),yu.has(t)&&(e=n.findIndex(e=>e.name===t.name+"_toggle"),i(e,"false"))}return n}},Ou={has:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!It(r))continue;const o=e.getScaleComponent(r),s=o?o.get("type"):void 0;if(!o||!Ri(s)){Bn("Scale bindings are currently only supported for scales with unbinned, continuous domains.");continue}const a={selection:t.name,field:i.field};o.set("selectionExtent",a,!0),n.push(i)}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter(e=>0===n.filter(t=>t.name===e.signals.data).length);if(!e.parent||ju(e)||0===i.length)return n;const r=n.filter(e=>e.name===t.name)[0];let o=r.update;if(o.indexOf(Iu)>=0)r.update=`{${i.map(e=>`${w(e.field)}: ${e.signals.data}`).join(", ")}}`;else{for(const e of i){const t=`${w(e.field)}: ${e.signals.data}`;o.indexOf(t)<0&&(o=`${o.substring(0,o.length-1)}, ${t}}`)}r.update=o}return n.concat(i.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!ju(e))for(const e of t.scales){const t=n.filter(t=>t.name===e.signals.data)[0];t.push="outer",delete t.value,delete t.update}return n}};function wu(e,t){return`domain(${w(e.scaleName(t))})`}function ju(e){var t;return e.parent&&Cd(e.parent)&&(null!==(t=!e.parent.parent)&&void 0!==t?t:ju(e.parent.parent))}const Au={has:e=>{const t="global"===e.resolve&&e.bind&&is(e.bind),n=1===e.project.items.length&&"_vgsid_"!==e.project.items[0].field;return t&&!n&&Bn("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n,i)=>{var r;if(i.on||delete t.events,i.clear||delete t.clear,i.on||i.clear){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=h(null!==(r=n.filter)&&void 0!==r?r:[]),n.filter.indexOf(e)<0&&n.filter.push(e)}const o=rs(t.bind)?t.bind.legend:"click",s=O(o)?$a(o,"view"):h(o);t.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=rs(t.bind)&&t.bind.legend,o=e=>t=>{const n=B(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const s=Q(e.field)+"_legend",a=`${i}_${s}`;if(0===n.filter(e=>e.name===a).length){const e=r.merge.map(o(s+"_symbols")).concat(r.merge.map(o(s+"_labels"))).concat(r.merge.map(o(s+"_entries")));n.unshift(Object.assign(Object.assign({name:a},t.init?{}:{value:null}),{on:[{events:e,update:"datum.value || item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:"!event.item || !datum ? null : "+a,force:!0}]}))}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find(e=>e.name===i+Wu),s=i+"_tuple_fields",a=r.items.filter(e=>e.hasLegend).map(e=>Q(`${i}_${Q(e.field)}_legend`)),u=`${a.map(e=>e+" !== null").join(" && ")} ? {fields: ${s}, values: [${a.join(", ")}]} : null`;t.events&&a.length>0?o.on.push({events:a.map(e=>({signal:e})),update:u}):a.length>0&&(o.update=u,delete o.value,delete o.on);const l=n.find(e=>e.name===i+"_toggle"),c=rs(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push(Object.assign(Object.assign({},l.on[0]),{events:c})):l.on[0].events=c),n}};const Du="_translate_delta",Fu={has:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Ou.has(t),o=i+"_translate_anchor",{x:s,y:a}=t.project.hasChannel;let u=$a(t.translate,"scope");return r||(u=u.map(e=>(e.between[0].markname=i+Pu,e))),n.push({name:o,value:{},on:[{events:u.map(e=>e.between[0]),update:"{x: x(unit), y: y(unit)"+(void 0!==s?", extent_x: "+(r?wu(e,tt):`slice(${s.signals.visual})`):"")+(void 0!==a?", extent_y: "+(r?wu(e,nt):`slice(${a.signals.visual})`):"")+"}"}]},{name:i+Du,value:{},on:[{events:u,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==s&&ku(e,t,s,"width",n),void 0!==a&&ku(e,t,a,"height",n),n}};function ku(e,t,n,i,r){var o;const s=t.name,a=s+"_translate_anchor",u=s+Du,l=n.channel,c=Ou.has(t),f=r.filter(e=>e.name===n.signals[c?"data":"visual"])[0],d=e.getSizeSignalRef(i).signal,g=e.getScaleComponent(l),p=g.get("type"),m=`${a}.extent_${l}`,h=`${c?"log"===p?"panLog":"pow"===p?"panPow":"panLinear":"panLinear"}(${m}, ${`${c&&l===tt?"-":""}${u}.${l} / `+(c?""+d:`span(${m})`)}`+(c&&"pow"===p?", "+(null!==(o=g.get("exponent"))&&void 0!==o?o:1):"")+")";f.on.push({events:{signal:u},update:c?h:`clampRange(${h}, 0, ${d})`})}const Cu={has:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Ou.has(t),o=i+"_zoom_delta",{x:s,y:a}=t.project.hasChannel,u=w(e.scaleName(tt)),l=w(e.scaleName(nt));let c=$a(t.zoom,"scope");return r||(c=c.map(e=>(e.markname=i+Pu,e))),n.push({name:i+"_zoom_anchor",on:[{events:c,update:r?"{"+[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(e=>!!e).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&Eu(e,t,s,"width",n),void 0!==a&&Eu(e,t,a,"height",n),n}};function Eu(e,t,n,i,r){var o;const s=t.name,a=n.channel,u=Ou.has(t),l=r.filter(e=>e.name===n.signals[u?"data":"visual"])[0],c=e.getSizeSignalRef(i).signal,f=e.getScaleComponent(a),d=f.get("type"),g=u?wu(e,a):l.name,p=s+"_zoom_delta",m=`${u?"log"===d?"zoomLog":"pow"===d?"zoomPow":"zoomLinear":"zoomLinear"}(${g}, ${`${s}_zoom_anchor.${a}`}, ${p}`+(u&&"pow"===d?", "+(null!==(o=f.get("exponent"))&&void 0!==o?o:1):"")+")";l.on.push({events:{signal:p},update:u?m:`clampRange(${m}, 0, ${c})`})}const Su=[{has:()=>!0,parse:(e,t,n)=>{var i,r,o;const s=t.name,a=null!==(i=t.project)&&void 0!==i?i:t.project=new bu,u={},l={},c=new Set,f=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=Q(`${s}_${n}`);for(let e=1;c.has(i);e++)i=Q(`${s}_${n}_${e}`);return c.add(i),{[t]:i}};if(!n.fields&&!n.encodings){const t=e.config.selection[n.type];if(n.init)for(const e of h(n.init))for(const i of V(e))At[i]?(n.encodings||(n.encodings=[])).push(i):"interval"===n.type?(Bn('Interval selections should be initialized using "x" and/or "y" keys.'),n.encodings=t.encodings):(n.fields||(n.fields=[])).push(i);else n.encodings=t.encodings,n.fields=t.fields}for(const e of null!==(r=n.fields)&&void 0!==r?r:[]){const t={type:"E",field:e};t.signals=Object.assign({},f(t,"data")),a.items.push(t),a.hasField[e]=t}for(const i of null!==(o=n.encodings)&&void 0!==o?o:[]){const n=e.fieldDef(i);if(n){let r=n.field;if(n.aggregate){Bn(un(i,n.aggregate));continue}if(!r){Bn(an(i));continue}if(n.timeUnit){r=e.vgField(i);const t={timeUnit:n.timeUnit,as:r,field:n.field};l[N(t)]=t}if(!u[r]){let o="E";if("interval"===t.type){Ri(e.getScaleComponent(i).get("type"))&&(o="R")}else n.bin&&(o="R-RE");const s={field:r,channel:i,type:o};s.signals=Object.assign(Object.assign({},f(s,"data")),f(s,"visual")),a.items.push(u[r]=s),a.hasField[r]=a.hasChannel[i]=u[r]}}else Bn(an(i))}if(n.init){const e=e=>a.items.map(t=>void 0!==e[t.channel]?e[t.channel]:e[t.field]);if("interval"===n.type)t.init=e(n.init);else{const i=h(n.init);t.init=i.map(e)}}G(l)||(a.timeUnit=new hu(null,l))},signals:(e,t,n)=>{const i=t.name+"_tuple_fields";return n.filter(e=>e.name===i).length>0?n:n.concat({name:i,value:t.project.items.map(e=>{const t=A(e,["signals","hasLegend"]);return t.field=ie(t.field),t})})}},yu,Ou,Au,Fu,Cu,vu,gu,xu];function $u(e,t){for(const n of Su)n.has(e)&&t(n)}function Bu(e,t=!0,n=u){if(c(e)){const i=e.map(e=>Bu(e,t,n));return t?`[${i.join(", ")}]`:i}return _n(e)?n(t?Tn(e):function(e){const t=Mn(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(JSON.stringify(e)):e}function _u(e,t){return Gu(e,(n,i)=>{t=i.marks?i.marks(e,n,t):t,$u(n,i=>{i.marks&&(t=i.marks(e,n,t))})}),t}function zu(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}const Pu="_brush",Nu={signals:(e,t)=>{const n=t.name,i=n+"_tuple_fields",r=Ou.has(t),o=[],s=[],a=[];if(t.translate&&!r){const e="!event.item || event.item.mark.name !== "+w(n+Pu);Lu(t,(t,n)=>{var i;const r=h(null!==(i=n.between[0].filter)&&void 0!==i?i:n.between[0].filter=[]);return r.indexOf(e)<0&&r.push(e),t})}t.project.items.forEach((n,i)=>{const r=n.channel;if(r!==tt&&r!==nt)return void Bn("Interval selections only support x and y encoding channels.");const u=t.init?t.init[i]:null,l=function(e,t,n,i){const r=n.channel,o=n.signals.visual,s=n.signals.data,a=Ou.has(t),u=w(e.scaleName(r)),l=e.getScaleComponent(r),c=l?l.get("type"):void 0,f=e=>`scale(${u}, ${e})`,d=e.getSizeSignalRef(r===tt?"width":"height").signal,g=r+"(unit)",p=Lu(t,(e,t)=>[...e,{events:t.between[0],update:`[${g}, ${g}]`},{events:t,update:`[${o}[0], clamp(${g}, 0, ${d})]`}]);return p.push({events:{signal:t.name+"_scale_trigger"},update:Ri(c)?`[${f(s+"[0]")}, ${f(s+"[1]")}]`:"[0, 0]"}),a?[{name:s,on:[]}]:[Object.assign(Object.assign({name:o},i?{init:Bu(i,!0,f)}:{value:[]}),{on:p}),Object.assign(Object.assign({name:s},i?{init:Bu(i)}:{}),{on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${u}, ${o})`}]})]}(e,t,n,u),c=n.signals.data,f=n.signals.visual,d=w(e.scaleName(r)),g=Ri(e.getScaleComponent(r).get("type"))?"+":"";o.push(...l),s.push(c),a.push({scaleName:e.scaleName(r),expr:`(!isArray(${c}) || (${g}invert(${d}, ${f})[0] === ${g}${c}[0] && ${g}invert(${d}, ${f})[1] === ${g}${c}[1]))`})}),r||o.push({name:n+"_scale_trigger",value:{},on:[{events:a.map(e=>({scale:e.scaleName})),update:a.map(e=>e.expr).join(" && ")+` ? ${n+"_scale_trigger"} : {}`}]});const u=t.init,l=`unit: ${Vu(e)}, fields: ${i}, values`;return o.concat(Object.assign(Object.assign({name:n+Wu},u?{init:`{${l}: ${Bu(u)}}`}:{}),{on:[{events:[{signal:s.join(" || ")}],update:s.join(" && ")+` ? {${l}: [${s}]} : null`}]}))},modifyExpr:(e,t)=>t.name+Wu+", "+("global"===t.resolve?"true":`{unit: ${Vu(e)}}`),marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,s=r&&r.signals.visual,a=o&&o.signals.visual,u=`data(${w(t.name+Ru)})`;if(Ou.has(t))return n;const l={x:void 0!==r?{signal:s+"[0]"}:{value:0},y:void 0!==o?{signal:a+"[0]"}:{value:0},x2:void 0!==r?{signal:s+"[1]"}:{field:{group:"width"}},y2:void 0!==o?{signal:a+"[1]"}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of V(l))l[t]=[Object.assign({test:`${u}.length && ${u}[0].unit === ${Vu(e)}`},l[t]),{value:0}];const c=t.mark,{fill:f,fillOpacity:d,cursor:g}=c,p=A(c,["fill","fillOpacity","cursor"]),m=V(p).reduce((e,t)=>(e[t]=[{test:[void 0!==r&&`${s}[0] !== ${s}[1]`,void 0!==o&&`${a}[0] !== ${a}[1]`].filter(e=>e).join(" && "),value:p[t]},{value:null}],e),{});return[{name:i+Pu+"_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:l}},...n,{name:i+Pu,type:"rect",clip:!0,encode:{enter:Object.assign(Object.assign({},g?{cursor:{value:g}}:{}),{fill:{value:"transparent"}}),update:Object.assign(Object.assign({},l),m)}}]}};function Lu(e,t){return e.events.reduce((e,n)=>n.between?t(e,n):(Bn(n+" is not an ordered event stream for interval selections."),e),[])}function Mu(e,t){const n=t.name,i=n+"_tuple_fields",r=t.project,o="(item().isVoronoi ? datum.datum : datum)",s=r.items.map(t=>{const n=e.fieldDef(t.channel);return n&&n.bin?`[${o}[${w(e.vgField(t.channel,{}))}], ${o}[${w(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${o}[${w(t.field)}]`}).join(", "),a=`unit: ${Vu(e)}, fields: ${i}, values`,u=t.events;return[{name:n+Wu,on:u?[{events:u,update:`datum && item().mark.marktype !== 'group' ? {${a}: [${s}]} : null`,force:!0}]:[]}]}const Tu={signals:Mu,modifyExpr:(e,t)=>t.name+Wu+", "+("global"===t.resolve?"null":`{unit: ${Vu(e)}}`)},qu={signals:Mu,modifyExpr:(e,t)=>t.name+Wu+", "+("global"===t.resolve?"true":`{unit: ${Vu(e)}}`)},Ru="_store",Wu="_tuple",Uu="_modify",Iu="vlSelectionResolve",Hu={single:qu,multi:Tu,interval:Nu};function Gu(e,t){const n=e.component.selection;if(n)for(const e of J(n)){if(!0===t(e,Hu[e.type]))break}}function Vu(e,{escape:t}={escape:!0}){let n=t?w(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!Fd(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of xt)e[t]&&(n+=` + '__facet_${t}_' + (facet[${w(i.vgField(t))}])`)}return n}function Ju(e){let t=!1;return Gu(e,e=>{t=t||e.project.items.some(e=>"_vgsid_"===e.field)}),t}var Yu,Xu,Qu,Ku,Zu;function el(e){this.type=e}el.prototype.visit=function(e){var t,n,i;if(e(this))return 1;for(n=0,i=(t=function(e){switch(e.type){case"ArrayExpression":return e.elements;case"BinaryExpression":case"LogicalExpression":return[e.left,e.right];case"CallExpression":var t=e.arguments.slice();return t.unshift(e.callee),t;case"ConditionalExpression":return[e.test,e.consequent,e.alternate];case"MemberExpression":return[e.object,e.property];case"ObjectExpression":return e.properties;case"Property":return[e.key,e.value];case"UnaryExpression":return[e.argument];case"Identifier":case"Literal":case"RawCode":default:return[]}}(this)).length;n",Yu[3]="Identifier",Yu[4]="Keyword",Yu[5]="Null",Yu[6]="Numeric",Yu[7]="Punctuator",Yu[8]="String",Yu[9]="RegularExpression";var tl=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0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\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),nl=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F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256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function il(e,t){if(!e)throw new Error("ASSERT: "+t)}function rl(e){return e>=48&&e<=57}function ol(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function sl(e){return"01234567".indexOf(e)>=0}function al(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function ul(e){return 10===e||13===e||8232===e||8233===e}function ll(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&tl.test(String.fromCharCode(e))}function cl(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&nl.test(String.fromCharCode(e))}var fl={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function dl(){for(var e;Qu1114111||"}"!==e)&&El({},"Unexpected token %0","ILLEGAL"),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function ml(){var e,t;for(e=Xu.charCodeAt(Qu++),t=String.fromCharCode(e),92===e&&(117!==Xu.charCodeAt(Qu)&&El({},"Unexpected token %0","ILLEGAL"),++Qu,(e=gl("u"))&&"\\"!==e&&ll(e.charCodeAt(0))||El({},"Unexpected token %0","ILLEGAL"),t=e);Qu>>="===(i=Xu.substr(Qu,4))?{type:7,value:i,start:r,end:Qu+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:Qu+=3}:s===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(s)>=0||"=>"===t?{type:7,value:t,start:r,end:Qu+=2}:"<>=!+-*%&|^/".indexOf(s)>=0?{type:7,value:s,start:r,end:++Qu}:void El({},"Unexpected token %0","ILLEGAL")}function vl(){var e,t,n;if(il(rl((n=Xu[Qu]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=Qu,e="","."!==n){if(e=Xu[Qu++],n=Xu[Qu],"0"===e){if("x"===n||"X"===n)return++Qu,function(e){for(var t="";Qu=0&&El({},"Invalid regular expression",n),{value:n,literal:t}}(),i=function(e,t){var n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(e,t){if(parseInt(t,16)<=1114111)return"x";El({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){El({},"Invalid regular expression")}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:Qu}}function xl(){var e;return dl(),Qu>=Ku?{type:2,start:Qu,end:Qu}:ll(e=Xu.charCodeAt(Qu))?hl():40===e||41===e||59===e?bl():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(il("'"===(e=Xu[Qu])||'"'===e,"String literal must starts with a quote"),t=Qu,++Qu;Qu=0&&Qu":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function Gl(){var e,t;return e=function(){var e,t,n,i,r,o,s,a,u,l;if(e=Zu,u=Il(),0===(r=Hl(i=Zu)))return u;for(i.prec=r,Ol(),t=[e,Zu],o=[u,i,s=Il()];(r=Hl(Zu))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)s=o.pop(),a=o.pop().value,u=o.pop(),t.pop(),n=jl(a,u,s),o.push(n);(i=Ol()).prec=r,o.push(i),t.push(Zu),n=Il(),o.push(n)}for(n=o[l=o.length-1],t.pop();l>1;)t.pop(),n=jl(o[l-1].value,o[l-2],n),l-=2;return n}(),Bl("?")&&(Ol(),t=Gl(),$l(":"),e=function(e,t,n){var i=new el("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,Gl())),e}function Vl(){var e=Gl();if(Bl(","))throw new Error("Disabled.");return e}function Jl(e){const t=function(e){Qu=0,Ku=(Xu=e).length,Zu=null,wl();var t=Vl();if(2!==Zu.type)throw new Error("Unexpect token after expression.");return t}(e),n=new Set;return t.visit(e=>{"MemberExpression"===e.type&&function e(t){return"MemberExpression"===t.object.type?e(t.object):"datum"===t.object.name}(e)&&n.add(function e(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...e(t.object)),n.push(...e(t.property))),n)}(e).slice(1).join("."))}),n}class Yl extends pu{constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=Kl(this.model,this.filter,this),this._dependentFields=Jl(this.expr)}clone(){return new Yl(null,this.model,B(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return"Filter "+this.expr}}function Xl(e,t,n,i="datum"){const r=[];const o=K(t,(function(t){const o=Q(t),s=e.getSelectionComponent(o,t),a=w(o+Ru);if(s.project.timeUnit){const t=null!=n?n:e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}return"none"!==s.empty&&r.push(a),`vlSelectionTest(${a}, ${i}`+("global"===s.resolve?")":`, ${w(s.resolve)})`)}));return(r.length?"!("+r.map(e=>`length(data(${e}))`).join(" || ")+") || ":"")+`(${o})`}function Ql(e,t){const n=t.encoding;let i=t.field;if(n||i){if(n&&!i){const r=e.project.items.filter(e=>e.channel===n);!r.length||r.length>1?(i=e.project.items[0].field,Bn((r.length?"Multiple ":"No ")+`matching ${w(n)} encoding found for selection ${w(t.selection)}. `+`Using "field": ${w(i)}.`)):i=r[0].field}}else i=e.project.items[0].field,e.project.items.length>1&&Bn(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${w(i)}.`);return`${e.name}[${w(i)}]`}function Kl(e,t,n){return K(t,t=>O(t)?t:function(e){return null==e?void 0:e.selection}(t)?Xl(e,t.selection,n):ci(t))}function Zl(e,t,n,i){var r,o,s;e.encode=null!==(r=e.encode)&&void 0!==r?r:{},e.encode[t]=null!==(o=e.encode[t])&&void 0!==o?o:{},e.encode[t].update=null!==(s=e.encode[t].update)&&void 0!==s?s:{},e.encode[t].update[n]=i}function ec(e,t,n,i={header:!1}){var r,o;const s=e.combine(),{disable:a,orient:u,scale:l,labelExpr:f,title:d,zindex:g}=s,p=A(s,["disable","orient","scale","labelExpr","title","zindex"]);if(!a){for(const e in p){const n=pe[e],i=p[e];if(n&&n!==t&&"both"!==n)delete p[e];else if(de(i)){const{condition:t}=i,n=A(i,["condition"]),r=h(t),o=fe[e];if(o){const{vgProp:t,part:i}=o;Zl(p,i,t,[...r.map(e=>{const{test:t}=e,n=A(e,["test"]);return Object.assign({test:Kl(null,t)},n)}),n]),delete p[e]}else if(null===o){const t={signal:r.map(e=>{const{test:t}=e,n=A(e,["test"]);return`${Kl(null,t)} ? ${po(n)} : `}).join("")+po(n)};p[e]=t}}else if(Yn(i)){const t=fe[e];if(t){const{vgProp:n,part:r}=t;Zl(p,r,n,i),delete p[e]}}}if("grid"===t){if(!p.grid)return;if(p.encode){const{grid:e}=p.encode;p.encode=Object.assign({},e?{grid:e}:{}),G(p.encode)&&delete p.encode}return Object.assign(Object.assign({scale:l,orient:u},p),{domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:ae(g,0)})}{if(!i.header&&e.mainExtracted)return;if(void 0!==f){let e=f;(null===(o=null===(r=p.encode)||void 0===r?void 0:r.labels)||void 0===o?void 0:o.update)&&Yn(p.encode.labels.update.text)&&(e=re(f,"datum.label",p.encode.labels.update.text.signal)),Zl(p,"labels","text",{signal:e})}if(null===p.labelAlign&&delete p.labelAlign,p.encode){for(const t of ge)e.hasAxisPart(t)||delete p.encode[t];G(p.encode)&&delete p.encode}const t=function(e,t){if(e)return c(e)&&!fo(e)?e.map(e=>Qr(e,t)).join(", "):e}(d,n);return Object.assign(Object.assign(Object.assign(Object.assign({scale:l,orient:u,grid:!1},t?{title:t}:{}),p),!1===n.aria?{aria:!1}:{}),{zindex:ae(g,0)})}}}function tc(e){const{axes:t}=e.component,n=[];for(const i of Pt)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}const nc={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},ic={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},rc=V(nc),oc=V(ic);function sc(e,t,n,i){return Object.assign.apply(null,[{},...e.map(e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},s=new Set([...V(r),...V(o)]),a={};for(const t of s.values())a[t]={signal:`${i.signal} === "${e}" ? ${mo(r[t])} : ${mo(o[t])}`};return a}return t[e]})])}function ac(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:t in Ni?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[];const o="x"===e?"axisX":"axisY",s=Yn(n)?"axisOrient":"axis"+ee(n),a=[...r,...r.map(e=>o+e.substr(4))],u=["axis",s,o];return{vlOnlyAxisConfig:sc(a,i,e,n),vgAxisConfig:sc(u,i,e,n),axisConfigStyle:uc([...u,...a],i)}}function uc(e,t){var n;const i=[{}];for(const r of e){let e=null===(n=t[r])||void 0===n?void 0:n.style;if(e){e=h(e);for(const n of e)i.push(t.style[n])}}return Object.assign.apply(null,i)}function lc(e,t,n,i={}){var r;const o=xo(e,n,t);if(void 0!==o)return{configFrom:"style",configValue:o};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==(null===(r=i[t])||void 0===r?void 0:r[e]))return{configFrom:t,configValue:i[t][e]};return{}}const cc={scale:({model:e,channel:t})=>e.scaleName(t),format:({fieldOrDatumDef:e,config:t,axis:n})=>{const{format:i,formatType:r}=n;return ur(e,e.type,i,r,t,!0)},formatType:({axis:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return lr(i,t,n)},grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>{var i;return(!Sr(e)||!Qt(e.bin))&&(null!==(i=t.grid)&&void 0!==i?i:function(e,t){return!qi(e)&&Sr(t)&&!Xt(null==t?void 0:t.bin)}(n,e))},gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||gc(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||dc(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>{var i;return null!==(i=e.labelFlush)&&void 0!==i?i:function(e,t){if("x"===t&&M(["quantitative","temporal"],e))return!0;return}(t.type,n)},labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>{var i;return null!==(i=e.labelOverlap)&&void 0!==i?i:function(e,t,n,i){if(n&&!f(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t||"greedy";return}(t.type,n,Sr(t)&&!!t.timeUnit,Sr(t)?t.sort:void 0)},orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{var o;const s="x"===e?"width":"y"===e?"height":void 0,a=s?t.getSizeSignalRef(s):void 0;return null!==(o=n.tickCount)&&void 0!==o?o:function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){var r;if(!i&&!qi(t)&&"log"!==t){if(Sr(e)){if(Xt(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&M(["month","hours","day","quarter"],null===(r=Jn(e.timeUnit))||void 0===r?void 0:r.unit))return}return{signal:`ceil(${n.signal}/40)`}}return}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=pc(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",s=t.fieldDef(o);return wo(r?[jr(r)]:[],Sr(s)?[jr(s)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;if(c(n))return uo(t,n);if(Yn(n))return n;return}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>{var i;return null!==(i=e.zindex)&&void 0!==i?i:function(e,t){if("rect"===e&&Ir(t))return 1;return 0}(n,t)}};function fc(e){return`(((${e.signal} % 360) + 360) % 360)`}function dc(e,t,n,i){if(void 0!==e){if("x"===n){if(Yn(e)){const n=fc(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${Yn(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45{if(Mr(t)&&yr(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,s=o.map((e,t)=>`${ci({field:i,timeUnit:r,equal:e})} ? ${t} : `).join("")+o.length;e=new mc(e,{calculate:s,as:hc(t,n,{forAs:!0})})}}),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return"Calculate "+N(this.transform)}}function hc(e,t,n){return Ur(e,Object.assign({prefix:t,suffix:"sort_index"},null!=n?n:{}))}function bc(e,t){return M(["top","bottom"],t)?"column":M(["left","right"],t)||"row"===e?"row":"column"}function vc(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return ae(((null==t?void 0:t.header)||{})[e],r[e],n.header[e])}function yc(e,t,n,i){const r={};for(const o of e){const e=vc(o,t,n,i);void 0!==e&&(r[o]=e)}return r}const xc=["row","column"],Oc=["header","footer"];function wc(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:s,titleOrient:a}=yc(["titleAnchor","titleAngle","titleOrient"],r,i,t),u=bc(t,a),l=le(s);return{name:t+"-title",type:"group",role:u+"-title",title:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:n},"row"===t?{orient:"left"}:{}),{style:"guide-title"}),Ac(l,u)),jc(u,l,o)),$c(i,r,t,rc,nc))}}function jc(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=gc(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function Ac(e,t){const n=dc(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function Dc(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of Oc)if(n[r])for(const o of n[r]){const s=Cc(e,t,r,n,o);null!=s&&i.push(s)}return i}function Fc(e,t){var n;const{sort:i}=e;return vr(i)?{field:Ur(i,{expr:"datum"}),order:null!==(n=i.order)&&void 0!==n?n:"ascending"}:c(i)?{field:hc(e,t,{expr:"datum"}),order:"ascending"}:{field:Ur(e,{expr:"datum"}),order:null!=i?i:"ascending"}}function kc(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:s,labelOrient:a,labelExpr:u}=yc(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e,n,t),l=or({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=bc(t,a);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:{signal:u?re(re(u,"datum.label",l),"datum.value",Ur(e,{expr:"parent"})):l}},"row"===t?{orient:"left"}:{}),{style:"guide-label",frame:"group"}),Ac(o,c)),jc(c,o,s)),$c(n,e,t,oc,ic))}function Cc(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:s}=i,a=e.config?e.config:void 0;if(s&&r.labels){const{labelOrient:e}=yc(["labelOrient"],s,a,t);("row"===t&&!M(["top","bottom"],e)||"column"===t&&!M(["left","right"],e))&&(o=kc(s,t,a))}const u=Fd(e)&&!xr(e.facet),l=r.axes,c=(null==l?void 0:l.length)>0;if(o||c){const a="row"===t?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`},i.facetFieldDef?{from:{data:e.getName(t+"_domain")},sort:Fc(s,t)}:{}),c&&u?{from:{data:e.getName("facet_domain_"+t)}}:{}),o?{title:o}:{}),r.sizeSignal?{encode:{update:{[a]:r.sizeSignal}}}:{}),c?{axes:l}:{})}}return null}const Ec={column:{start:0,end:1},row:{start:1,end:0}};function Sc(e,t){return Ec[t][e]}function $c(e,t,n,i,r){const o={};for(const s of i){if(!r[s])continue;const i=vc(s,t,e,n);void 0!==i&&(o[r[s]]=i)}return o}function Bc(e){return[..._c(e,"width"),..._c(e,"height"),..._c(e,"childWidth"),..._c(e,"childHeight")]}function _c(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(qi(i)&&Xn(o)){const i=e.scaleName(n);if(Fd(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[zc(i,o)]}return[zc(i,o),{name:r,update:Pc(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${fs(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function zc(e,t){return{name:e+"_step",value:t.step}}function Pc(e,t,n){const i=t.get("type"),r=t.get("padding"),o=ae(t.get("paddingOuter"),r);let s=t.get("paddingInner");return s="band"===i?void 0!==s?s:r:1,`bandspace(${n}, ${s}, ${o}) * ${e}_step`}function Nc(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function Lc(e,t){return V(e).reduce((n,i)=>{const r=e[i];return Object.assign(Object.assign({},n),qa(t,r,i,e=>Yn(e)?e:{value:e.value}))},{})}function Mc(e,t){if(Cd(t)||Fd(t))return"shared";if(kd(t))return Nt(e)?"independent":"shared";throw new Error("invalid model type for resolve")}function Tc(e,t){const n=e.scale[t],i=Nt(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&Bn(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const qc=Object.assign(Object.assign({},{aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1}),{disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),Rc=V(qc);class Wc extends Ks{}const Uc={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){var s,a,u,l,f,d,g,p;if("symbol"!==o)return;const{markDef:m,encoding:h,config:b,mark:v}=n,y=m.filled&&"trail"!==v;let x=Object.assign(Object.assign({},function(e,t,n){for(const i of n){const n=vo(i,t.markDef,t.config);void 0!==n&&(e[i]=go(n))}return e}({},n,Le)),Ja(n,{filled:y}));const O=null!==(s=r.get("symbolOpacity"))&&void 0!==s?s:b.legend.symbolOpacity,w=null!==(a=r.get("symbolFillColor"))&&void 0!==a?a:b.legend.symbolFillColor,j=null!==(u=r.get("symbolStrokeColor"))&&void 0!==u?u:b.legend.symbolStrokeColor,A=void 0===O?null!==(l=Ic(h.opacity))&&void 0!==l?l:m.opacity:void 0;if(x.fill)if("fill"===i||y&&i===ut)delete x.fill;else if(x.fill.field)w?delete x.fill:(x.fill=go(null!==(f=b.legend.symbolBaseFillColor)&&void 0!==f?f:"black"),x.fillOpacity=go(null!=A?A:1));else if(c(x.fill)){const e=null!==(p=null!==(g=Hc(null!==(d=h.fill)&&void 0!==d?d:h.color))&&void 0!==g?g:m.fill)&&void 0!==p?p:y&&m.color;e&&(x.fill=go(e))}if(x.stroke)if("stroke"===i||!y&&i===ut)delete x.stroke;else if(x.stroke.field||j)delete x.stroke;else if(c(x.stroke)){const e=ae(Hc(h.stroke||h.color),m.stroke,y?m.color:void 0);e&&(x.stroke={value:e})}if("opacity"!==i){const e=Sr(t)&&Vc(n,r,t);e?x.opacity=[Object.assign({test:e},go(null!=A?A:1)),go(b.legend.unselectedOpacity)]:A&&(x.opacity=go(A))}return x=Object.assign(Object.assign({},x),e),G(x)?void 0:x},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){var r;if("gradient"!==n)return;const{config:o,markDef:s,encoding:a}=t;let u={};const l=void 0===(null!==(r=i.get("gradientOpacity"))&&void 0!==r?r:o.legend.gradientOpacity)?Ic(a.opacity)||s.opacity:void 0;l&&(u.opacity=go(l));return u=Object.assign(Object.assign({},u),e),G(u)?void 0:u},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},s=n.config,a=Sr(t)?Vc(n,r,t):void 0,u=a?[{test:a,value:1},{value:s.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=o,f=ir(c)?ar({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:s}):void 0,d=Object.assign(Object.assign(Object.assign({},u?{opacity:u}:{}),f?{text:f}:{}),e);return G(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return(null==n?void 0:n.length)?Object.assign(Object.assign({},e),{fill:{value:"transparent"}}):e}};function Ic(e){return Gc(e,(e,t)=>Math.max(e,t.value))}function Hc(e){return Gc(e,(e,t)=>ae(e,t.value))}function Gc(e,t){return function(e){const t=e&&e.condition;return!!t&&(c(t)||Lr(t))}(e)?h(e.condition).reduce(t,e.value):Lr(e)?e.value:void 0}function Vc(e,t,n){const i=t.get("selections");if(!(null==i?void 0:i.length))return;const r=w(n.field);return i.map(e=>`(!length(data(${w(Q(e)+Ru)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`).join(" || ")}const Jc={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return ur(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return lr(i,t,n)},gradientLength:e=>{var t,n;const{legend:i,legendConfig:r}=e;return null!==(n=null!==(t=i.gradientLength)&&void 0!==t?t:r.gradientLength)&&void 0!==n?n:function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:s,gradientVerticalMaxLength:a,gradientVerticalMinLength:u}=e;if(Wi(r))return"horizontal"===n?"top"===i||"bottom"===i?Qc(t,"width",s,o):s:Qc(t,"height",u,a);return}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>{var i,r;return null!==(r=null!==(i=e.labelOverlap)&&void 0!==i?i:t.labelOverlap)&&void 0!==r?r:function(e){if(M(["quantile","threshold","log"],e))return"greedy";return}(n)},symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>{var r;return null!==(r=e.symbolType)&&void 0!==r?r:function(e,t,n,i){var r;if("shape"!==t){const e=null!==(r=Hc(n))&&void 0!==r?r:i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape)},title:({fieldOrDatumDef:e,config:t})=>Yr(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(vt(n)&&Wi(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;if(c(n))return uo(t,n);if(Yn(n))return n;return}(t,e)};function Yc(e){const{legend:t}=e;return ae(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(vt(e)){if(M(["quarter","month","day"],t))return"symbol";if(Wi(n))return"gradient"}return"symbol"}(e))}function Xc({legendConfig:e,legendType:t,orient:n,legend:i}){var r,o;return null!==(o=null!==(r=i.direction)&&void 0!==r?r:e[t?"gradientDirection":"symbolDirection"])&&void 0!==o?o:function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(n,t)}function Qc(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function Kc(e){const t=Dd(e)?function(e){const{encoding:t}=e,n={};for(const i of[ut,...es]){const r=eo(t[i]);r&&e.getScaleComponent(i)&&(i===ft&&Sr(r)&&r.type===bi||(n[i]=ef(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){Kc(i);for(const r of V(i.component.legends))n.legend[r]=Tc(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=tf(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of V(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function Zc(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!(null==n?void 0:n.values);case"title":if("title"===t&&e===(null==i?void 0:i.title))return!0}return e===(n||{})[t]}function ef(e,t){var n,i,r;let o=e.legend(t);const{markDef:s,encoding:a,config:u}=e,l=u.legend,c=new Wc({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){var i;const r=null===(i=e.fieldDef(t))||void 0===i?void 0:i.field;Gu(e,e=>{var i,o;const s=null!==(i=e.project.hasField[r])&&void 0!==i?i:e.project.hasChannel[t];if(s&&Au.has(e)){const t=null!==(o=n.get("selections"))&&void 0!==o?o:[];t.push(e.name),n.set("selections",t,!1),s.hasLegend=!0}})}(e,t,c);const f=void 0!==o?!o:l.disable;if(c.set("disable",f,void 0!==o),f)return c;o=o||{};const d=e.getScaleComponent(t).get("type"),g=eo(a[t]),p=Sr(g)?null===(n=Jn(g.timeUnit))||void 0===n?void 0:n.unit:void 0,m=o.orient||u.legend.orient||"right",h=Yc({legend:o,channel:t,timeUnit:p,scaleType:d}),b={legend:o,channel:t,model:e,markDef:s,encoding:a,fieldOrDatumDef:g,legendConfig:l,config:u,scaleType:d,orient:m,legendType:h,direction:Xc({legend:o,legendType:h,orient:m,legendConfig:l})};for(const n of Rc){if("gradient"===h&&n.startsWith("symbol")||"symbol"===h&&n.startsWith("gradient"))continue;const i=n in Jc?Jc[n](b):o[n];if(void 0!==i){const r=Zc(i,n,o,e.fieldDef(t));(r||void 0===u.legend[n])&&c.set(n,i,r)}}const v=null!==(i=null==o?void 0:o.encoding)&&void 0!==i?i:{},y=c.get("selections"),x={},O={fieldOrDatumDef:g,model:e,channel:t,legendCmpt:c,legendType:h};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=Lc(null!==(r=v[t])&&void 0!==r?r:{},e),i=t in Uc?Uc[t](n,O):n;void 0===i||G(i)||(x[t]=Object.assign(Object.assign(Object.assign({},(null==y?void 0:y.length)&&Sr(g)?{name:`${Q(g.field)}_legend_${t}`}:{}),(null==y?void 0:y.length)?{interactive:!!y}:{}),{update:i}))}return G(x)||c.set("encode",x,!!(null==o?void 0:o.encoding)),c}function tf(e,t){var n,i,r,o;if(!e)return t.clone();const s=e.getWithExplicit("orient"),a=t.getWithExplicit("orient");if(s.explicit&&a.explicit&&s.value!==a.value)return;let u=!1;for(const n of Rc){const i=ia(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",(e,t)=>{switch(n){case"symbolType":return nf(e,t);case"title":return Ao(e,t);case"type":return u=!0,ea("symbol")}return na(e,t,n,"legend")});e.setWithExplicit(n,i)}return u&&((null===(i=null===(n=e.implicit)||void 0===n?void 0:n.encode)||void 0===i?void 0:i.gradient)&&Z(e.implicit,["encode","gradient"]),(null===(o=null===(r=e.explicit)||void 0===r?void 0:r.encode)||void 0===o?void 0:o.gradient)&&Z(e.explicit,["encode","gradient"])),e}function nf(e,t){return"circle"===t.value?t:e}function rf(e,t,n,i){var r,o,s;e.encode=null!==(r=e.encode)&&void 0!==r?r:{},e.encode[t]=null!==(o=e.encode[t])&&void 0!==o?o:{},e.encode[t].update=null!==(s=e.encode[t].update)&&void 0!==s?s:{},e.encode[t].update[n]=i}function of(e){const t=e.component.legends,n={};for(const i of V(t)){const r=e.getScaleComponent(i),o=P(r.get("domains"));if(n[o])for(const e of n[o]){tf(e,t[i])||n[o].push(t[i])}else n[o]=[t[i].clone()]}return J(n).flat().map(t=>function(e,t){var n,i,r;const o=e.combine(),{disable:s,labelExpr:a,selections:u}=o,l=A(o,["disable","labelExpr","selections"]);if(s)return;!1===t.aria&&null==l.aria&&(l.aria=!1);if(null===(n=l.encode)||void 0===n?void 0:n.symbols){const e=l.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||l.stroke||(e.stroke={value:"transparent"});for(const t of es)l[t]&&delete e[t]}l.title||delete l.title;if(void 0!==a){let e=a;(null===(r=null===(i=l.encode)||void 0===i?void 0:i.labels)||void 0===r?void 0:r.update)&&Yn(l.encode.labels.update.text)&&(e=re(a,"datum.label",l.encode.labels.update.text.signal)),rf(l,"labels","text",{signal:e})}for(const e in l){const t=l[e];if(Yn(t)){const n=ts[e];if(n){const{vgProp:i,part:r}=n;rf(l,r,i,t),delete l[e]}}}return l}(t,e.config)).filter(e=>void 0!==e)}function sf(e){return Cd(e)||kd(e)?function(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),af(e))}(e):af(e)}function af(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map(e=>e.signal).join(", ")}]`},o=t.data.reduce((t,n)=>{const i=Yn(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return M(t,i)||t.push(i),t},[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[Object.assign({name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]}},n)]}return[Object.assign(Object.assign({name:i},{translate:{signal:"[width / 2, height / 2]"}}),n)]}const uf=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class lf extends Ks{constructor(e,t,n,i){super(Object.assign({},t),{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function cf(e){e.component.projection=Dd(e)?function(e){var t;if(e.hasProjection){const n=e.specifiedProjection,i=!(n&&(null!=n.scale||null!=n.translate)),r=i?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,o=i?function(e){const t=[],{encoding:n}=e;for(const i of[["longitude","latitude"],["longitude2","latitude2"]])(eo(n[i[0]])||eo(n[i[1]]))&&t.push({signal:e.getName("geojson_"+t.length)});e.channelHasField(ft)&&e.typedFieldDef(ft).type===bi&&t.push({signal:e.getName("geojson_"+t.length)});0===t.length&&t.push(e.requestDataName(da.Main));return t}(e):void 0;return new lf(e.projectionName(!0),Object.assign(Object.assign({},null!==(t=e.config.projection)&&void 0!==t?t:{}),null!=n?n:{}),r,o)}return}(e):function(e){if(0===e.children.length)return;let t;for(const t of e.children)cf(t);const n=q(e.children,e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=q(uf,n=>!v(e.explicit,n)&&!v(t.explicit,n)||!(!v(e.explicit,n)||!v(t.explicit,n)||P(e.get(n))!==P(t.get(n))));if(P(e.size)===P(t.size)){if(n)return e;if(P(e.explicit)===P({}))return t;if(P(t.explicit)===P({}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0});if(t&&n){const n=e.projectionName(!0),i=new lf(n,t.specifiedProjection,t.size,B(t.data));for(const t of e.children){const e=t.component.projection;e&&(e.isFit&&i.data.push(...t.component.projection.data),t.renameProjection(e.get("name"),n),e.merged=!0)}return i}return}(e)}function ff(e,t){return`${Yt(e)}_${t}`}function df(e,t,n){var i;const r=ff(null!==(i=ro(n,void 0))&&void 0!==i?i:{},t);return e.getName(r+"_bins")}function gf(e,t,n){let i,r;i=function(e){return"as"in e}(e)?O(e.as)?[e.as,e.as+"_end"]:[e.as[0],e.as[1]]:[Ur(e,{forAs:!0}),Ur(e,{binSuffix:"end",forAs:!0})];const o=Object.assign({},ro(t,void 0)),s=ff(o,e.field),{signal:a,extentSignal:u}=function(e,t){return{signal:e.getName(t+"_bins"),extentSignal:e.getName(t+"_extent")}}(n,s);if(Zt(o.extent)){const e=o.extent,t=e.selection;r=Ql(n.getSelectionComponent(Q(t),t),e),delete o.extent}return{key:s,binComponent:Object.assign(Object.assign(Object.assign({bin:o,field:e.field,as:[i]},a?{signal:a}:{}),u?{extentSignal:u}:{}),r?{span:r}:{})}}class pf extends pu{constructor(e,t){super(e),this.bins=t}clone(){return new pf(null,B(this.bins))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{if(Nr(n)&&Xt(n.bin)){const{key:r,binComponent:o}=gf(n,n.bin,t);e[r]=Object.assign(Object.assign(Object.assign({},o),e[r]),function(e,t,n,i){var r,o;if(lo(t,n)){const s=Dd(e)&&null!==(o=null!==(r=e.axis(n))&&void 0!==r?r:e.legend(n))&&void 0!==o?o:{},a=Ur(t,{expr:"datum"}),u=Ur(t,{expr:"datum",binSuffix:"end"});return{formulaAs:Ur(t,{binSuffix:"range",forAs:!0}),formula:gr(a,u,s.format,s.formatType,i)}}return{}}(t,n,i,t.config))}return e},{});return G(n)?null:new pf(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=gf(t,t.bin,n);return new pf(e,{[i]:r})}merge(e,t){for(const n of V(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=W([...this.bins[n].as,...e.bins[n].as],N)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(J(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(J(this.bins).map(e=>e.field))}hash(){return"Bin "+N(this.bins)}assemble(){return J(this.bins).flatMap(e=>{const t=[],[n,...i]=e.as,r=e.bin,{extent:o}=r,s=A(r,["extent"]),a=Object.assign(Object.assign(Object.assign({type:"bin",field:ie(e.field),as:n,signal:e.signal},Zt(o)?{extent:null}:{extent:o}),e.span?{span:{signal:`span(${e.span})`}}:{}),s);!o&&e.extentSignal&&(t.push({type:"extent",field:ie(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:Ur({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t})}}class mf extends pu{constructor(e){let t;if(super(null),ua(e=null!=e?e:{name:"source"})||(t=e.format?Object.assign({},z(e.format,["parse"])):{}),sa(e))this._data={values:e.values};else if(oa(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];M(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else ca(e)?this._data={values:[{type:"Sphere"}]}:(aa(e)||ua(e))&&(this._data={});this._generator=ua(e),e.name&&(this._name=e.name),t&&!G(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return Object.assign(Object.assign({name:this._name},this._data),{transform:[]})}}class hf extends pu{constructor(e,t){super(e),this.params=t}clone(){return new hf(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return"Graticule "+N(this.params)}assemble(){return Object.assign({type:"graticule"},!0===this.params?{}:this.params)}}class bf extends pu{constructor(e,t){super(e),this.params=t}clone(){return new bf(null,this.params)}dependentFields(){return new Set}producedFields(){var e;return new Set([null!==(e=this.params.as)&&void 0!==e?e:"data"])}hash(){return"Hash "+N(this.params)}assemble(){return Object.assign({type:"sequence"},this.params)}}function vf(e){return e instanceof mf||e instanceof hf||e instanceof bf}class yf{constructor(){this._mutated=!1}setMutated(){this._mutated=!0}get mutatedFlag(){return this._mutated}}class xf extends yf{constructor(){super(),this._continue=!1}setContinue(){this._continue=!0}get continueFlag(){return this._continue}get flags(){return{continueFlag:this.continueFlag,mutatedFlag:this.mutatedFlag}}set flags({continueFlag:e,mutatedFlag:t}){e&&this.setContinue(),t&&this.setMutated()}reset(){}optimizeNextFromLeaves(e){if(vf(e))return!1;const t=e.parent,{continueFlag:n}=this.run(e);return n&&this.optimizeNextFromLeaves(t),this.mutatedFlag}}class Of extends yf{}function wf(e,t,n,i){const r=Dd(i)?i.encoding[St(t)]:void 0;if(Nr(n)&&Dd(i)&&Fr(t,n,r,i.stack,i.markDef,i.config))e.add(Ur(n,{})),e.add(Ur(n,{suffix:"end"})),n.bin&&lo(n,t)&&e.add(Ur(n,{binSuffix:"range"}));else if(t in mt){const n=function(e){switch(e){case"latitude":return"y";case"latitude2":return"y2";case"longitude":return"x";case"longitude2":return"x2"}}(t);e.add(i.getName(n))}else e.add(Ur(n));return e}class jf extends pu{constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}clone(){return new jf(null,new Set(this.dimensions),B(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef(e=>{e.aggregate&&(n=!0)});const i={},r=new Set;return n?(t.forEachFieldDef((e,n)=>{var o,s,a,u;const{aggregate:l,field:c}=e;if(l)if("count"===l)i["*"]=null!==(o=i["*"])&&void 0!==o?o:{},i["*"].count=new Set([Ur(e,{forAs:!0})]);else{if(Ge(l)||Ve(l)){const e=Ge(l)?"argmin":"argmax",t=l[e];i[t]=null!==(s=i[t])&&void 0!==s?s:{},i[t][e]=new Set([Ur({op:e,field:t},{forAs:!0})])}else i[c]=null!==(a=i[c])&&void 0!==a?a:{},i[c][l]=new Set([Ur(e,{forAs:!0})]);It(n)&&"unaggregated"===t.scaleDomain(n)&&(i[c]=null!==(u=i[c])&&void 0!==u?u:{},i[c].min=new Set([Ur({field:c,aggregate:"min"},{forAs:!0})]),i[c].max=new Set([Ur({field:c,aggregate:"max"},{forAs:!0})]))}else wf(r,n,e,t)}),r.size+V(i).length===0?null:new jf(e,r,i)):null}static makeFromTransform(e,t){var n,i,r;const o=new Set,s={};for(const e of t.aggregate){const{op:t,field:r,as:o}=e;t&&("count"===t?(s["*"]=null!==(n=s["*"])&&void 0!==n?n:{},s["*"].count=new Set([o||Ur(e,{forAs:!0})])):(s[r]=null!==(i=s[r])&&void 0!==i?i:{},s[r][t]=new Set([o||Ur(e,{forAs:!0})])))}for(const e of null!==(r=t.groupby)&&void 0!==r?r:[])o.add(e);return o.size+V(s).length===0?null:new jf(e,o,s)}merge(e){return function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(this.dimensions,e.dimensions)?(function(e,t){var n;for(const i of V(t)){const r=t[i];for(const t of V(r))i in e?e[i][t]=new Set([...null!==(n=e[i][t])&&void 0!==n?n:[],...r[t]]):e[i]={[t]:r[t]}}}(this.measures,e.measures),!0):(function(...e){$n.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...V(this.measures)])}producedFields(){const e=new Set;for(const t of V(this.measures))for(const n of V(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return"Aggregate "+N({dimensions:this.dimensions,measures:this.measures})}assemble(){const e=[],t=[],n=[];for(const i of V(this.measures))for(const r of V(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:ie(i));return{type:"aggregate",groupby:[...this.dimensions].map(ie),ops:e,fields:t,as:n}}}class Af extends pu{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of xt){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]=Object.assign({name:t.getName(e+"_domain"),fields:[Ur(n),...Xt(i)?[Ur(n,{binSuffix:"end"})]:[]]},vr(r)?{sortField:r}:c(r)?{sortIndexField:hc(n,e)}:{})}}this.childModel=t.child}hash(){let e="Facet";for(const t of xt)this[t]&&(e+=` ${t.charAt(0)}:${N(this[t])}`);return e}get fields(){var e;const t=[];for(const n of xt)(null===(e=this[n])||void 0===e?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of xt)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of Pt){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(qi(i)&&Xn(r)){const n=ad(ud(this.childModel,t));n?e[t]=n:Bn(sn(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x"}[e],r=[],o=[],s=[];n&&n[i]&&(t?(r.push("distinct_"+n[i]),o.push("max")):(r.push(n[i]),o.push("distinct")),s.push("distinct_"+n[i]));const{sortField:a,sortIndexField:u}=this[e];if(a){const{op:e=pr,field:t}=a;r.push(t),o.push(e),s.push(Ur(a,{forAs:!0}))}else u&&(r.push(u),o.push("max"),s.push(u));return{name:this[e].name,source:null!=t?t:this.data,transform:[Object.assign({type:"aggregate",groupby:this[e].fields},r.length?{fields:r,ops:o,as:s}:{})]}}assembleFacetHeaderData(e){var t,n;const{columns:i}=this.model.layout,{layoutHeaders:r}=this.model.component,o=[],s={};for(const e of xc){for(const i of Oc){const o=null!==(t=r[e]&&r[e][i])&&void 0!==t?t:[];for(const t of o)if((null===(n=t.axes)||void 0===n?void 0:n.length)>0){s[e]=!0;break}}if(s[e]){const t=`length(data("${this.facet.name}"))`,n="row"===e?i?{signal:`ceil(${t} / ${i})`}:1:i?{signal:`min(${t}, ${i})`}:{signal:t};o.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:n}]})}}const{row:a,column:u}=s;return(a||u)&&o.unshift(this.assembleRowColumnHeaderData("facet",null,e)),o}assemble(){var e,t;const n=[];let i=null;const r=this.getChildIndependentFieldsWithStep(),{column:o,row:s,facet:a}=this;if(o&&s&&(r.x||r.y)){i=`cross_${this.column.name}_${this.row.name}`;const o=[].concat(null!==(e=r.x)&&void 0!==e?e:[],null!==(t=r.y)&&void 0!==t?t:[]),s=o.map(()=>"distinct");n.push({name:i,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:o,ops:s}]})}for(const e of[et,Ze])this[e]&&n.push(this.assembleRowColumnHeaderData(e,i,r));if(a){const e=this.assembleFacetHeaderData(r);e&&n.push(...e)}return n}}function Df(e){return"'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]?e.slice(1,-1):e}function Ff(e){const t={};return function e(t,n){if(E(t))e(t.not,n);else if(C(t))for(const i of t.and)e(i,n);else if(k(t))for(const i of t.or)e(i,n);else n(t)}(e.filter,e=>{var n;if(ui(e)){let i=null;ti(e)?i=e.equal:si(e)?i=e.range[0]:ai(e)&&(i=(null!==(n=e.oneOf)&&void 0!==n?n:e.in)[0]),i&&(_n(i)?t[e.field]="date":x(i)?t[e.field]="number":O(i)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}}),t}function kf(e){const t={};function n(e){var n;so(e)?t[e.field]="date":"quantitative"===e.type&&(O(n=e.aggregate)&&M(["min","max"],n))?t[e.field]="number":se(e.field)>1?e.field in t||(t[e.field]="flatten"):Mr(e)&&vr(e.sort)&&se(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((Dd(e)||Fd(e))&&e.forEachFieldDef((t,i)=>{if(Nr(t))n(t);else{const r=Ct(i),o=e.fieldDef(r);n(Object.assign(Object.assign({},t),{type:o.type}))}}),Dd(e)){const{mark:n,markDef:i,encoding:r}=e;if(_e(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];Sr(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}class Cf extends pu{constructor(e,t){super(e),this._parse=t}clone(){return new Cf(null,B(this._parse))}hash(){return"Parse "+N(this._parse)}static makeExplicit(e,t,n){let i={};const r=t.data;return!ua(r)&&r&&r.format&&r.format.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of V(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:Bn(fn(e,n[e],t.value)))}for(const e of V(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:Bn(fn(e,t[e],n)))}const r=new Ks(t,n);i.copyAll(r);const o={};for(const e of V(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===V(o).length||i.parseNothing?null:new Cf(e,o)}get parse(){return this._parse}merge(e){this._parse=Object.assign(Object.assign({},this._parse),e.parse),e.remove()}assembleFormatParse(){const e={};for(const t of V(this._parse)){const n=this._parse[t];1===se(t)&&(e[t]=n)}return e}producedFields(){return new Set(V(this._parse))}dependentFields(){return new Set(V(this._parse))}assembleTransforms(e=!1){return V(this._parse).filter(t=>!e||se(t)>1).map(e=>{const t=function(e,t){const n=te(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(0===t.indexOf("date:")){return`timeParse(${n},'${Df(t.slice(5,t.length))}')`}if(0===t.indexOf("utc:")){return`utcParse(${n},'${Df(t.slice(4,t.length))}')`}return Bn(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:oe(e)}}).filter(e=>null!==e)}}class Ef extends pu{clone(){return new Ef(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set(["_vgsid_"])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:"_vgsid_"}}}class Sf extends pu{constructor(e,t){super(e),this.transform=t}clone(){return new Sf(null,B(this.transform))}addDimensions(e){this.transform.groupby=W(this.transform.groupby.concat(e),e=>e)}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map(e=>e.field).filter(e=>void 0!==e).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){var t;return null!==(t=e.as)&&void 0!==t?t:Ur(e)}hash(){return"JoinAggregateTransform "+N(this.transform)}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return Object.assign({type:"joinaggregate",as:n,ops:t,fields:e},void 0!==i?{groupby:i}:{})}}class $f extends pu{constructor(e,t){super(e),this._stack=t}clone(){return new $f(null,B(this._stack))}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:o="zero"}=t,s=[],a=[];if(void 0!==t.sort)for(const e of t.sort)s.push(e.field),a.push(ae(e.order,"ascending"));const u={field:s,order:a};let l;return l=function(e){return c(e)&&e.every(e=>O(e))&&e.length>1}(r)?r:O(r)?[r,r+"_end"]:[t.stack+"_start",t.stack+"_end"],new $f(e,{stackField:n,groupby:i,offset:o,sort:u,facetby:[],as:l})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannel:r,fieldChannel:o,offset:s,impute:a}=n;let u;if(r){u=Zr(i[r])}const l=function(e){return e.stack.stackBy.reduce((e,t)=>{const n=Ur(t.fieldDef);return n&&e.push(n),e},[])}(t),f=t.encoding.order;let d;return d=c(f)||Sr(f)?Oo(f):l.reduce((e,t)=>(e.field.push(t),e.order.push("y"===o?"descending":"ascending"),e),{field:[],order:[]}),new $f(e,{dimensionFieldDef:u,stackField:t.vgField(o),facetby:[],stackby:l,sort:d,offset:s,impute:a,as:[t.vgField(o,{suffix:"start",forAs:!0}),t.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return"Stack "+N(this._stack)}getGroupbyFields(){const{dimensionFieldDef:e,impute:t,groupby:n}=this._stack;return e?e.bin?t?[Ur(e,{binSuffix:"mid"})]:[Ur(e,{}),Ur(e,{binSuffix:"end"})]:[Ur(e)]:null!=n?n:[]}assemble(){const e=[],{facetby:t,dimensionFieldDef:n,stackField:i,stackby:r,sort:o,offset:s,impute:a,as:u}=this._stack;if(a&&n){const{band:o=.5,bin:s}=n;s&&e.push({type:"formula",expr:o+"*"+Ur(n,{expr:"datum"})+`+${1-o}*`+Ur(n,{expr:"datum",binSuffix:"end"}),as:Ur(n,{binSuffix:"mid",forAs:!0})}),e.push({type:"impute",field:i,groupby:[...r,...t],key:Ur(n,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:u,offset:s}),e}}class Bf extends pu{constructor(e,t){super(e),this.transform=t}clone(){return new Bf(null,B(this.transform))}addDimensions(e){this.transform.groupby=W(this.transform.groupby.concat(e),e=>e)}dependentFields(){var e,t;const n=new Set;return(null!==(e=this.transform.groupby)&&void 0!==e?e:[]).forEach(n.add,n),(null!==(t=this.transform.sort)&&void 0!==t?t:[]).forEach(e=>n.add(e.field)),this.transform.window.map(e=>e.field).filter(e=>void 0!==e).forEach(n.add,n),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){var t;return null!==(t=e.as)&&void 0!==t?t:Ur(e)}hash(){return"WindowTransform "+N(this.transform)}assemble(){var e;const t=[],n=[],i=[],r=[];for(const e of this.transform.window)n.push(e.op),i.push(this.getDefaultName(e)),r.push(void 0===e.param?null:e.param),t.push(void 0===e.field?null:e.field);const o=this.transform.frame,s=this.transform.groupby;if(o&&null===o[0]&&null===o[1]&&n.every(e=>Je(e)))return Object.assign({type:"joinaggregate",as:i,ops:n,fields:t},void 0!==s?{groupby:s}:{});const a=[],u=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),u.push(null!==(e=t.order)&&void 0!==e?e:"ascending");const l={field:a,order:u},c=this.transform.ignorePeers;return Object.assign(Object.assign(Object.assign({type:"window",params:r,as:i,ops:n,fields:t,sort:l},void 0!==c?{ignorePeers:c}:{}),void 0!==s?{groupby:s}:{}),void 0!==o?{frame:o}:{})}}class _f extends xf{run(e){const t=e.parent;if(e instanceof Cf){if(vf(t))return this.flags;if(t.numChildren()>1)return this.setContinue(),this.flags;if(t instanceof Cf)this.setMutated(),t.merge(e);else{if(H(t.producedFields(),e.dependentFields()))return this.setContinue(),this.flags;this.setMutated(),e.swapWithParent()}}return this.setContinue(),this.flags}}class zf extends Of{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map(e=>e.hash()),n={};for(let i=0;i1&&(this.setMutated(),this.mergeNodes(e,n[t]));for(const t of e.children)this.run(t);return this.mutatedFlag}}class Pf extends xf{run(e){return e instanceof mu||e.numChildren()>0||e instanceof Af||(this.setMutated(),e.remove()),this.flags}}class Nf extends xf{constructor(){super(...arguments),this.fields=new Set,this.prev=null}run(e){if(this.setContinue(),e instanceof hu){const t=e.producedFields();U(t,this.fields)?(this.setMutated(),this.prev.remove()):this.fields=new Set([...this.fields,...t]),this.prev=e}return this.flags}reset(){this.fields.clear()}}class Lf extends xf{run(e){this.setContinue();const t=e.parent.children.filter(e=>e instanceof hu),n=t.pop();for(const e of t)this.setMutated(),n.merge(e);return this.flags}}function Mf(e){if(e instanceof Af)if(1!==e.numChildren()||e.children[0]instanceof mu){const n=e.model.component.data.main;!function e(t){if(t instanceof mu&&t.type===da.Main&&1===t.numChildren()){const n=t.children[0];n instanceof Af||(n.swapWithParent(),e(t))}}(n);const i=(t=e,function e(n){if(!(n instanceof Af)){const i=n.clone();if(i instanceof mu){const e=Hf+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof jf||i instanceof $f||i instanceof Bf||i instanceof Sf)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof jf||t instanceof $f||t instanceof Bf||t instanceof Sf)&&t.addDimensions(e.fields),t.swapWithParent(),Mf(e)}else e.children.map(Mf);var t}class Tf extends Of{constructor(){super()}run(e){e instanceof mu&&!e.isRequired()&&(this.setMutated(),e.remove());for(const t of e.children)this.run(t);return this.mutatedFlag}}class qf extends Of{constructor(e){super(),this.requiresSelectionId=e&&Ju(e)}run(e){e instanceof Ef&&(this.requiresSelectionId&&(vf(e.parent)||e.parent instanceof jf||e.parent instanceof Cf)||(this.setMutated(),e.remove()));for(const t of e.children)this.run(t);return this.mutatedFlag}}class Rf extends xf{run(e){const t=e.parent,n=[...t.children],i=t.children.filter(e=>e instanceof Cf);if(t.numChildren()>1&&i.length>=1){const e={},r=new Set;for(const t of i){const n=t.parse;for(const t of V(n))t in e?e[t]!==n[t]&&r.add(t):e[t]=n[t]}for(const t of r)delete e[t];if(!G(e)){this.setMutated();const i=new Cf(t,e);for(const r of n){if(r instanceof Cf)for(const t of V(e))delete r.parse[t];t.removeChild(r),r.parent=i,r instanceof Cf&&0===V(r.parse).length&&r.remove()}}}return this.setContinue(),this.flags}}class Wf extends xf{run(e){const t=e.parent,n=t.children.filter(e=>e instanceof jf),i={};for(const e of n){const t=N(e.groupBy);t in i||(i[t]=[]),i[t].push(e)}for(const e of V(i)){const n=i[e];if(n.length>1){const e=n.pop();for(const i of n)e.merge(i)&&(t.removeChild(i),i.parent=e,i.remove(),this.setMutated())}}return this.setContinue(),this.flags}}class Uf extends xf{constructor(e){super(),this.model=e}run(e){const t=e.parent,n=!(vf(t)||t instanceof Yl||t instanceof Cf||t instanceof Ef),i=[],r=[];for(const e of t.children)e instanceof pf&&(n&&!H(t.producedFields(),e.dependentFields())?i.push(e):r.push(e));if(i.length>0){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated(),t instanceof pf?t.merge(e,this.model.renameSignal.bind(this.model)):e.swapWithParent()}if(r.length>1){const e=r.pop();for(const t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated()}return this.setContinue(),this.flags}}class If extends xf{run(e){const t=e.parent,n=[...t.children];if(!T(n,e=>e instanceof mu)||t.numChildren()<=1)return this.setContinue(),this.flags;const i=[];let r;for(const e of n)if(e instanceof mu){let n=e;for(;1===n.numChildren();){const[e]=n.children;if(!(e instanceof mu))break;n=e}i.push(...n.children),r?(t.removeChild(e),e.parent=r.parent,r.parent.removeChild(r),r.parent=n,this.setMutated()):r=n}else i.push(e);if(i.length){this.setMutated();for(const e of i)e.parent.removeChild(e),e.parent=r}return this.setContinue(),this.flags}}const Hf="scale_";function Gf(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!Gf(t.children))return!1}return!0}function Vf(e){const t=[];function n(e){if(0===e.numChildren())t.push(e);else for(const t of e.children)n(t)}for(const t of e)n(t);return t}function Jf(e){return e}function Yf(e,t){return t.map(t=>{if(e instanceof xf){const n=e.optimizeNextFromLeaves(t);return e.reset(),n}return e.run(t)}).some(Jf)}function Xf(e,t,n){let i=e.sources;const r=new Set;return r.add(Yf(new Tf,i)),r.add(Yf(new qf(t),i)),i=i.filter(e=>e.numChildren()>0),r.add(Yf(new Pf,Vf(i))),i=i.filter(e=>e.numChildren()>0),n||(r.add(Yf(new _f,Vf(i))),r.add(Yf(new Uf(t),Vf(i))),r.add(Yf(new Nf,Vf(i))),r.add(Yf(new Rf,Vf(i))),r.add(Yf(new Wf,Vf(i))),r.add(Yf(new Lf,Vf(i))),r.add(Yf(new zf,i)),r.add(Yf(new If,Vf(i)))),e.sources=i,r.has(!0)}class Qf{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new Qf(()=>e(t))}}function Kf(e){Dd(e)?function(e){const t=e.component.scales;for(const n of V(t)){const i=Zf(e,n);if(t[n].setWithExplicit("domains",i),id(e,n),e.component.data.isFaceted){let t=e;for(;!Fd(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)Qn(e)&&(e.data=Hf+e.data.replace(Hf,""))}}}(e):function(e){for(const t of e.children)Kf(t);const t=e.component.scales;for(const n of V(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):ia(i,e.getWithExplicit("domains"),"domains","scale",od);const t=e.get("selectionExtent");r&&t&&r.selection!==t.selection&&Bn("The same selection must be used to override scale domains in a layered view."),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function Zf(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=rd(t,n);if(!e)return void Bn(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=rd(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]=Object.assign(Object.assign({},e.specifiedScales[t]),{domain:r})),"x"===t&&eo(i.x2)?eo(i.x)?ia(td(n,r,e,"x"),td(n,r,e,"x2"),"domain","scale",od):td(n,r,e,"x2"):"y"===t&&eo(i.y2)?eo(i.y)?ia(td(n,r,e,"y"),td(n,r,e,"y2"),"domain","scale",od):td(n,r,e,"y2"):td(n,r,e,t)}function ed(e,t,n){var i;const r=null===(i=Jn(n))||void 0===i?void 0:i.unit;return"temporal"===t||r?function(e,t,n){return e.map(e=>({signal:`{data: ${ao(e,{timeUnit:n,type:t})}}`}))}(e,t,r):[e]}function td(e,t,n,i){const{encoding:r}=n,o=eo(r[i]),{type:s}=o,a=o.timeUnit;if(function(e){return e&&e.unionWith}(t)){const r=td(e,void 0,n,i),o=ed(t.unionWith,s,a);return Zs([...r.value,...o])}if(Yn(t))return Zs([t]);if(t&&"unaggregated"!==t&&!Ii(t))return Zs(ed(t,s,a));const u=n.stack;if(u&&i===u.fieldChannel){if("normalize"===u.offset)return ea([[0,1]]);const e=n.requestDataName(da.Main);return ea([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const l=It(i)&&Sr(o)?function(e,t,n){if(!qi(n))return;const i=e.fieldDef(t),r=i.sort;if(yr(r))return{op:"min",field:hc(i,t),order:"ascending"};const{stack:o}=e,s=o?[...o.groupbyField?[o.groupbyField]:[],...o.stackBy.map(e=>e.fieldDef.field)]:void 0;if(vr(r)){const e=o&&!M(s,r.field);return nd(r,e)}if(br(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:a,field:u}=i,l=o&&!M(s,u);if(Ge(a)||Ve(a))return nd({field:Ur(i),order:n},l);if(Je(a)||!a)return nd({op:a,field:u,order:n},l)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(M(["ascending",void 0],r))return!0}return}(n,i,e):void 0;if(Br(o)){return ea(ed([o.datum],s,a))}const c=o;if("unaggregated"===t){const e=n.requestDataName(da.Main),{field:t}=o;return ea([{data:e,field:Ur({field:t,aggregate:"min"})},{data:e,field:Ur({field:t,aggregate:"max"})}])}if(Xt(c.bin)){if(qi(e))return ea("bin-ordinal"===e?[]:[{data:X(l)?n.requestDataName(da.Main):n.requestDataName(da.Raw),field:n.vgField(i,lo(c,i)?{binSuffix:"range"}:{}),sort:!0!==l&&f(l)?l:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=c;if(Xt(e)){const t=df(n,c.field,e);return ea([new Qf(()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}return ea([{data:n.requestDataName(da.Main),field:n.vgField(i,{})}])}}if(c.timeUnit&&M(["time","utc"],e)&&Fr(i,c,Dd(n)?n.encoding[St(i)]:void 0,n.stack,n.markDef,n.config)){const e=n.requestDataName(da.Main);return ea([{data:e,field:n.vgField(i)},{data:e,field:n.vgField(i,{suffix:"end"})}])}return ea(l?[{data:X(l)?n.requestDataName(da.Main):n.requestDataName(da.Raw),field:n.vgField(i),sort:l}]:[{data:n.requestDataName(da.Main),field:n.vgField(i)}])}function nd(e,t){const{op:n,field:i,order:r}=e;return Object.assign(Object.assign({op:null!=n?n:t?"sum":pr},i?{field:ie(i)}:{}),r?{order:r}:{})}function id(e,t){var n;const i=e.component.scales[t],r=e.specifiedScales[t].domain,o=null===(n=e.fieldDef(t))||void 0===n?void 0:n.bin,s=Ii(r)&&r,a=Kt(o)&&Zt(o.extent)&&o.extent;(s||a)&&i.set("selectionExtent",null!=s?s:a,!0)}function rd(e,t){const{aggregate:n,type:i}=e;return n?O(n)&&!Ke[n]?{valid:!1,reason:xn(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:On(e)}:{valid:!0}:{valid:!1,reason:yn(e)}}function od(e,t,n,i){return e.explicit&&t.explicit&&Bn(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${P(n)} and ${P(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function sd(e){const t=W(e.map(e=>{if(Qn(e)){return A(e,["sort"])}return e}),N),n=W(e.map(e=>{if(Qn(e)){const t=e.sort;return void 0===t||X(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}}).filter(e=>void 0!==e),N);if(0===t.length)return;if(1===t.length){const t=e[0];if(Qn(t)&&n.length>0){let e=n[0];if(n.length>1)Bn(An),e=!0;else if(f(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return Object.assign(Object.assign({},t),{sort:e})}return t}const i=W(n.map(e=>X(e)||!("op"in e)||e.op in He?e:(Bn(function(e){return`Dropping sort property ${P(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0)),N);let r;1===i.length?r=i[0]:i.length>1&&(Bn(An),r=!0);const o=W(e.map(e=>Qn(e)?e.data:null),e=>e);if(1===o.length&&null!==o[0]){return Object.assign({data:o[0],fields:t.map(e=>e.field)},r?{sort:r}:{})}return Object.assign({fields:t},r?{sort:r}:{})}function ad(e){if(Qn(e)&&O(e.field))return e.field;if(function(e){return!c(e)&&("fields"in e&&!("data"in e))}(e)){let t;for(const n of e.fields)if(Qn(n)&&O(n.field))if(t){if(t!==n.field)return Bn("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),t}else t=n.field;return Bn("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),t}if(function(e){return!c(e)&&("fields"in e&&"data"in e)}(e)){Bn("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const t=e.fields[0];return O(t)?t:void 0}}function ud(e,t){return sd(e.component.scales[t].get("domains").map(t=>(Qn(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function ld(e){return V(e.component.scales).reduce((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:s,selectionExtent:a,domains:u,range:l,reverse:c}=r,d=A(r,["name","type","selectionExtent","domains","range","reverse"]),g=function(e,t,n,i){if(Nt(n)){if(Xn(e))return{step:{signal:t+"_step"}}}else if(f(e)&&Qn(e))return Object.assign(Object.assign({},e),{data:i.lookupDataSource(e.data)});return e}(r.range,o,n,e);let p;a&&(p=function(e,t){const n=t.selection;return{signal:Ql(e.getSelectionComponent(n,Q(n)),t)}}(e,a));const m=ud(e,n);return t.push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:o,type:s},m?{domain:m}:{}),p?{domainRaw:p}:{}),{range:g}),void 0!==c?{reverse:c}:{}),d)),t},[])}class cd extends Ks{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||T(this.get("domains"),e=>c(e)&&2===e.length&&e[0]<=0&&e[1]>=0)}}const fd=["range","scheme"];function dd(e){return"x"===e?"width":"y"===e?"height":void 0}function gd(e,t){const n=e.fieldDef(t);if(n&&n.bin&&Xt(n.bin)){const i=df(e,n.field,n.bin),r=dd(t),o=e.getName(r);return new Qf(()=>{const t=e.getSignalName(i),n=`(${t}.stop - ${t}.start) / ${t}.step`;return`${e.getSignalName(o)} / (${n})`})}}function pd(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const i of fd)if(void 0!==n[i]){const o=Vi(r,i),s=Ji(e,i);if(o)if(s)Bn(s);else switch(i){case"range":{const i=n.range;if(c(i)){if(Nt(e))return Zs(i.map(e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return Qf.fromName(i,n)}return e}))}else if(f(i))return Zs({data:t.requestDataName(da.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return Zs(i)}case"scheme":return Zs(md(n[i]))}else Bn(wn(r,i,e))}if(e===tt||e===nt){const t=e===tt?"width":"height",n=i[t];if(us(n)){if(qi(r))return Zs({step:n.step});Bn(jn(t))}}const{rangeMin:o,rangeMax:s}=n,a=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,s=t.getSignalName.bind(t),{type:a}=eo(o[e]),u=t.getScaleComponent(e).get("type"),{domain:l,domainMid:f}=t.specifiedScales[e];switch(e){case tt:case nt:{if(M(["point","band"],u))if(e!==tt||n.width){if(e===nt&&!n.height){const e=gs(i.view,"height");if(us(e))return e}}else{const e=gs(i.view,"width");if(us(e))return e}const r=dd(e),o=t.getName(r);return e===nt&&Ri(u)?[Qf.fromName(s,o),0]:[0,Qf.fromName(s,o)]}case dt:{const o=t.component.scales[e].get("zero"),s=function e(t,n,i){if(n)return Yn(n)?{signal:`${n.signal} ? 0 : ${e(t,!1,i)}`}:0;switch(t){case"bar":case"tick":return i.scale.minBandSize;case"line":case"trail":case"rule":return i.scale.minStrokeWidth;case"text":return i.scale.minFontSize;case"point":case"square":case"circle":return i.scale.minSize}throw new Error(hn("size",t))}(r,o,i),a=function(e,t,n,i){const r={x:gd(n,"x"),y:gd(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=hd(t,r,i.view);return x(e)?e-1:new Qf(()=>e.signal+" - 1")}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const e=hd(t,r,i.view);return x(e)?Math.pow(.95*e,2):new Qf(()=>`pow(0.95 * ${e.signal}, 2)`)}}throw new Error(hn("size",e))}(r,n,t,i);return Ui(u)?function(e,t,n){const i=()=>{const i=mo(t),r=mo(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return Yn(t)?new Qf(i):{signal:i()}}(s,a,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&c(n)?n.length+1:(Bn(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(u,i,l,e)):[s,a]}case st:return[0,2*Math.PI];case"angle":return[0,360];case ot:return[0,new Qf(()=>`min(${t.getSignalName("width")},${t.getSignalName("height")})/2`)];case"strokeWidth":return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case"strokeDash":return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case ft:return"symbol";case ut:case lt:case ct:return"ordinal"===u?"nominal"===a?"category":"ordinal":void 0!==f?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case"opacity":case"fillOpacity":case"strokeOpacity":return[i.scale.minOpacity,i.scale.maxOpacity]}throw new Error("Scale range undefined for channel "+e)}(e,t);return(void 0!==o||void 0!==s)&&Vi(r,"rangeMin")&&c(a)&&2===a.length?Zs([null!=o?o:a[0],null!=s?s:a[1]]):ea(a)}function md(e){return function(e){return!O(e)&&!!e.name}(e)?Object.assign({scheme:e.name},z(e,["name"])):{scheme:e}}function hd(e,t,n){const i=us(e.width)?e.width.step:ds(n,"width"),r=us(e.height)?e.height.step:ds(n,"height");return t.x||t.y?new Qf(()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`):Math.min(i,r)}function bd(e,t){Dd(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:s}=e;for(const a of V(n)){const u=s[a],l=n[a],c=e.getScaleComponent(a),f=eo(r[a]),d=u[t],g=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),h=Vi(g,t),b=Ji(a,t);if(void 0!==d&&(h?b&&Bn(b):Bn(wn(g,t,a))),h&&void 0===b)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":_n(u[t])||"temporal"===n||e?l.set(t,{signal:ao(u[t],{type:n,timeUnit:e})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const n=t in vd?vd[t]({model:e,channel:a,fieldOrDatumDef:f,scaleType:g,scalePadding:p,scalePaddingInner:m,domain:u.domain,markDef:o,config:i}):i.scale[t];void 0!==n&&l.set(t,n,!1)}}}(e,t):xd(e,t)}const vd={bins:({model:e,fieldOrDatumDef:t})=>Sr(t)?function(e,t){const n=t.bin;if(Xt(n)){const i=df(e,t.field,n);return new Qf(()=>e.getSignalName(i))}if(Qt(n)&&Kt(n)&&void 0!==n.step)return{step:n.step};return}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(M([ut,lt,ct],e)&&"nominal"!==t)return"hcl";return}(e,t.type),nice:({scaleType:e,channel:t,fieldOrDatumDef:n})=>function(e,t,n){var i;if((null===(i=Zr(n))||void 0===i?void 0:i.bin)||M([ji,Ai],e))return;return t in zt||void 0}(e,t,n),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(e in zt){if(Wi(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:s}=r;if("bar"===t&&(!Sr(i)||!i.bin&&!i.timeUnit)&&("vertical"===s&&"x"===e||"horizontal"===s&&"y"===e))return o.continuousBandSize}if(t===Ci)return n.pointPadding}return}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,config:i})=>function(e,t,n,i){if(void 0!==e)return;if(t in zt){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r}=i;return ae(e,"bar"===n?t:r)}return}(e,t,n.type,i.scale),paddingOuter:({scalePadding:e,channel:t,scaleType:n,markDef:i,scalePaddingInner:r,config:o})=>function(e,t,n,i,r,o){if(void 0!==e)return;if(t in zt&&n===Ei){const{bandPaddingOuter:e}=o;return ae(e,Yn(r)?{signal:r.signal+"/2"}:r/2)}return}(e,t,n,i.type,r,o.scale),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return Ri(e)&&"descending"===t?Yn(i.xReverse)?{signal:"!"+i.xReverse.signal}:!i.xReverse:i.xReverse;if(Ri(e)&&"descending"===t)return!0;return}(t,Sr(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r})=>function(e,t,n,i,r){if(n&&"unaggregated"!==n&&Ri(r)){if(c(n)){const e=n[0],t=n[n.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!Ui(r))return!0;if((!Sr(t)||!t.bin)&&M([...Pt,...Mt],e)){const{orient:t,type:n}=i;return!M(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e)}return!1}(e,t,n,i,r)};function yd(e){Dd(e)?function(e){const t=e.component.scales;for(const n of Ut){const i=t[n];if(!i)continue;const r=pd(n,e);i.setWithExplicit("range",r)}}(e):xd(e,"range")}function xd(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?yd(n):bd(n,t);for(const i of V(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=ia(r,e.getWithExplicit(t),t,"scale",ta((e,n)=>{switch(t){case"range":return e.step&&n.step?e.step-n.step:0}return 0}))}}n[i].setWithExplicit(t,r)}}function Od(e,t,n,i){const r=function(e,t,n){var i;switch(t.type){case"nominal":case"ordinal":if(vt(e)||"discrete"===Jt(e))return"shape"===e&&"ordinal"===t.type&&Bn(vn(e,"ordinal")),"ordinal";if(e in zt){if(M(["rect","bar","image","rule"],n))return"band"}else if("arc"===n&&e in Lt)return"band";return void 0!==t.band||Tr(t)&&(null===(i=t.axis)||void 0===i?void 0:i.tickBand)?"band":"point";case"temporal":return vt(e)?"time":"discrete"===Jt(e)?(Bn(vn(e,"temporal")),"ordinal"):Sr(t)&&t.timeUnit&&Jn(t.timeUnit).utc?"utc":"time";case"quantitative":return vt(e)?Sr(t)&&Xt(t.bin)?"bin-ordinal":"linear":"discrete"===Jt(e)?(Bn(vn(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(gn(t.type))}(t,n,i),{type:o}=e;return It(t)?void 0!==o?function(e,t){if(!It(e))return!1;switch(e){case tt:case nt:case st:case ot:return Wi(t)||M(["band","point"],t);case dt:case"strokeWidth":case"opacity":case"fillOpacity":case"strokeOpacity":case"angle":return Wi(t)||Ui(t)||M(["band","point","ordinal"],t);case ut:case lt:case ct:return"band"!==t;case"strokeDash":return"ordinal"===t||Ui(t);case ft:return"ordinal"===t}}(t,o)?Sr(n)&&(s=o,a=n.type,!(M([pi,hi],a)?void 0===s||qi(s):a===mi?M([ji,Ai,void 0],s):a!==gi||M([yi,xi,Oi,wi,Di,Fi,ki,vi,void 0],s)))?(Bn(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(o,r)),r):o:(Bn(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,o,r)),r):r:null;var s,a}function wd(e){Dd(e)?e.component.scales=function(e){const{encoding:t,mark:n}=e;return Ut.reduce((i,r)=>{const o=eo(t[r]);if(o&&n===Be&&r===ft&&o.type===bi)return i;let s=o&&o.scale;if(o&&null!==s&&!1!==s){s=null!=s?s:{};const t=Od(s,r,o,n);i[r]=new cd(e.scaleName(r+"",!0),{value:t,explicit:s.type===t})}return i},{})}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const n of e.children){wd(n);for(const o of V(n.component.scales))if(r.scale[o]=null!==(t=r.scale[o])&&void 0!==t?t:Mc(o,e),"shared"===r.scale[o]){const e=i[o],t=n.component.scales[o].getWithExplicit("type");e?$i(e.value,t.value)?i[o]=ia(e,t,"type","scale",jd):(r.scale[o]="independent",delete i[o]):i[o]=t}}for(const t of V(i)){const r=e.scaleName(t,!0),o=i[t];n[t]=new cd(r,o);for(const n of e.children){const e=n.component.scales[t];e&&(n.renameScale(e.get("name"),r),e.merged=!0)}}return n}(e)}const jd=ta((e,t)=>_i(e)-_i(t));class Ad{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function Dd(e){return"unit"===(null==e?void 0:e.type)}function Fd(e){return"facet"===(null==e?void 0:e.type)}function kd(e){return"concat"===(null==e?void 0:e.type)}function Cd(e){return"layer"===(null==e?void 0:e.type)}class Ed{constructor(e,t,n,i,r,o,s){var a,u;this.type=t,this.parent=n,this.config=r,this.view=s,this.children=[],this.correctDataNames=e=>(e.from&&e.from.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from&&e.from.facet&&e.from.facet.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.name=null!==(a=e.name)&&void 0!==a?a:i,this.title=fo(e.title)?{text:e.title}:e.title,this.scaleNameMap=n?n.scaleNameMap:new Ad,this.projectionNameMap=n?n.projectionNameMap:new Ad,this.signalNameMap=n?n.signalNameMap:new Ad,this.data=e.data,this.description=e.description,this.transforms=(null!==(u=e.transform)&&void 0!==u?u:[]).map(e=>ga(e)?{filter:S(e.filter,di)}:e),this.layout="layer"===t||"unit"===t?{}:function(e,t,n){var i,r;const o=n[t],s={},{spacing:a,columns:u}=o;void 0!==a&&(s.spacing=a),void 0!==u&&(wr(e)&&!xr(e.facet)||os(e))&&(s.columns=u),ss(e)&&(s.columns=1);for(const t of cs)if(void 0!==e[t])if("spacing"===t){const n=e[t];s[t]=x(n)?n:{row:null!==(i=n.row)&&void 0!==i?i:a,column:null!==(r=n.column)&&void 0!==r?r:a}}else s[t]=e[t];return s}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:wr(e)||n&&n.component.data.isFaceted&&void 0===e.data},layoutSize:new Ks,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:Object.assign({scale:{},axis:{},legend:{}},o?B(o):{}),selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e,{ignoreRange:t}={}){wd(e),Kf(e);for(const t of Gi)bd(e,t);t||yd(e)}(this)}parseProjection(){cf(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){Kc(this)}assembleGroupStyle(){var e,t;if("unit"===this.type||"layer"===this.type)return null!==(t=null===(e=this.view)||void 0===e?void 0:e.style)&&void 0!==t?t:"cell"}assembleEncodeFromView(e){const t=A(e,["style"]),n={};for(const e of V(t)){const i=t[e];void 0!==i&&(n[e]=go(i))}return n}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=go(this.description)),"unit"!==this.type&&"layer"!==this.type)?G(t)?void 0:t:Object.assign({width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")},null!=t?t:{})}assembleLayout(){if(!this.layout)return;const e=this.layout,{spacing:t}=e,n=A(e,["spacing"]),{component:i,config:r}=this,o=function(e,t){const n={};for(const i of xt){const r=e[i];if(null==r?void 0:r.facetFieldDef){const{titleAnchor:e,titleOrient:o}=yc(["titleAnchor","titleOrient"],r.facetFieldDef,t,i),s=bc(i,o),a=Sc(e,s);void 0!==a&&(n[s]=a)}}return G(n)?void 0:n}(i.layoutHeaders,r);return Object.assign(Object.assign(Object.assign({padding:t},this.assembleDefaultLayout()),n),o?{titleBand:o}:{})}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of xt)e[n].title&&t.push(wc(this,n));for(const e of xc)t=t.concat(Dc(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map(e=>ec(e,"grid",t)),...i.map(e=>ec(e,"grid",t)),...n.map(e=>ec(e,"main",t)),...i.map(e=>ec(e,"main",t))].filter(e=>e)}(this.component.axes,this.config)}assembleLegends(){return of(this)}assembleProjections(){return sf(this)}assembleTitle(){var e,t,n;const i=null!==(e=this.title)&&void 0!==e?e:{},{encoding:r}=i,o=A(i,["encoding"]),s=Object.assign(Object.assign(Object.assign({},co(this.config.title).nonMark),o),r?{encode:{update:r}}:{});if(s.text)return M(["unit","layer"],this.type)?M(["middle",void 0],s.anchor)&&(s.frame=null!==(t=s.frame)&&void 0!==t?t:"group"):s.anchor=null!==(n=s.anchor)&&void 0!==n?n:"start",G(s)?void 0:s}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||Fd(this.parent)?function e(t){return Cd(t)||kd(t)?t.children.reduce((t,n)=>t.concat(e(n)),ld(t)):ld(t)}(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}getName(e){return Q((this.name?this.name+"_":"")+e)}getDataName(e){return this.getName(da[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(Fd(this.parent)){const t=Tt(Nc(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(qi(e)&&Xn(i)){const e=n.get("name"),i=ad(ud(this,t));if(i){return{signal:Pc(e,n,Ur({aggregate:"distinct",field:i},{expr:"datum"}))}}return Bn(sn(t)),null}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):Dt(e)&&It(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){var e,t;return(null===(e=this.component.axes.x)||void 0===e?void 0:e.some(e=>e.hasOrientSignalRef()))||(null===(t=this.component.axes.y)||void 0===t?void 0:t.some(e=>e.hasOrientSignalRef()))}}class Sd extends Ed{vgField(e,t={}){const n=this.fieldDef(e);if(n)return Ur(n,t)}reduceFieldDef(e,t){return $o(this.getMapping(),(t,n,i)=>{const r=Zr(n);return r?e(t,r,i):t},t)}forEachFieldDef(e,t){So(this.getMapping(),(t,n)=>{const i=Zr(t);i&&e(i,n)},t)}}class $d extends pu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:"value",null!==(r=o[1])&&void 0!==r?r:"density"]}clone(){return new $d(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.density,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"DensityTransform "+N(this.transform)}assemble(){const e=this.transform,{density:t}=e,n=A(e,["density"]);return Object.assign({type:"kde",field:t},n)}}class Bd extends pu{constructor(e,t){super(e),this.filter=t}clone(){return new Bd(null,Object.assign({},this.filter))}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==bo("invalid",r,n))return null;const o=t.reduceFieldDef((e,n,r)=>{const o=It(r)&&t.getScaleComponent(r);if(o){Ri(o.get("type"))&&"count"!==n.aggregate&&!_e(i)&&(e[n.field]=n)}return e},{});return V(o).length?new Bd(e,o):null}dependentFields(){return new Set(V(this.filter))}producedFields(){return new Set}hash(){return"FilterInvalid "+N(this.filter)}assemble(){const e=V(this.filter).reduce((e,t)=>{const n=this.filter[t],i=Ur(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e},[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class _d extends pu{constructor(e,t){super(e),this.transform=t,this.transform=B(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map((e,t)=>{var n;return null!==(n=i[t])&&void 0!==n?n:e})}clone(){return new _d(this.parent,B(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return"FlattenTransform "+N(this.transform)}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class zd extends pu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:"key",null!==(r=o[1])&&void 0!==r?r:"value"]}clone(){return new zd(null,B(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return"FoldTransform "+N(this.transform)}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Pd extends pu{constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}clone(){return new Pd(null,B(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[["longitude","latitude"],["longitude2","latitude2"]]){const r=i.map(e=>{const n=eo(t.encoding[e]);return Sr(n)?n.field:Br(n)?{expr:""+n.datum}:Lr(n)?{expr:""+n.value}:void 0});(r[0]||r[1])&&(e=new Pd(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(ft)){const i=t.typedFieldDef(ft);i.type===bi&&(e=new Pd(e,null,i.field,t.getName("geojson_"+n++)))}return e}dependentFields(){var e;const t=(null!==(e=this.fields)&&void 0!==e?e:[]).filter(O);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${N(this.fields)}`}assemble(){return Object.assign(Object.assign(Object.assign({type:"geojson"},this.fields?{fields:this.fields}:{}),this.geojson?{geojson:this.geojson}:{}),{signal:this.signal})}}class Nd extends pu{constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}clone(){return new Nd(null,this.projection,B(this.fields),B(this.as))}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[["longitude","latitude"],["longitude2","latitude2"]]){const i=n.map(e=>{const n=eo(t.encoding[e]);return Sr(n)?n.field:Br(n)?{expr:""+n.datum}:Lr(n)?{expr:""+n.value}:void 0}),r="longitude2"===n[0]?"2":"";(i[0]||i[1])&&(e=new Nd(e,t.projectionName(),i,[t.getName("x"+r),t.getName("y"+r)]))}return e}dependentFields(){return new Set(this.fields.filter(O))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${N(this.fields)} ${N(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Ld extends pu{constructor(e,t){super(e),this.transform=t}clone(){return new Ld(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.impute,this.transform.key,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new Ld(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(Sr(i)&&Sr(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const s=i.impute?r:r.impute?i:void 0,{method:a,value:u,frame:l,keyvals:c}=o.impute,f=Bo(t.mark,n);return new Ld(e,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({impute:o.field,key:s.field},a?{method:a}:{}),void 0!==u?{value:u}:{}),l?{frame:l}:{}),void 0!==c?{keyvals:c}:{}),f.length?{groupby:f}:{}))}return null}hash(){return"Impute "+N(this.transform)}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:s=[null,null]}=this.transform,a=Object.assign(Object.assign(Object.assign(Object.assign({type:"impute",field:e,key:t},n?{keyvals:(u=n,void 0!==(null==u?void 0:u.stop)?this.processSequence(n):n)}:{}),{method:"value"}),r?{groupby:r}:{}),{value:i&&"value"!==i?null:o});var u;if(i&&"value"!==i){return[a,Object.assign({type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:s,ignorePeers:!1},r?{groupby:r}:{}),{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[a]}}class Md extends pu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:t.on,null!==(r=o[1])&&void 0!==r?r:t.loess]}clone(){return new Md(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.loess,this.transform.on,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"LoessTransform "+N(this.transform)}assemble(){const e=this.transform,{loess:t,on:n}=e,i=A(e,["loess","on"]);return Object.assign({type:"loess",x:n,y:t},i)}}class Td extends pu{constructor(e,t,n){super(e),this.transform=t,this.secondary=n}clone(){return new Td(null,B(this.transform),this.secondary)}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let s=null;if(function(e){return"data"in e}(o)){let e=eg(o.data,r);e||(e=new mf(o.data),r.push(e));const n=t.getName("lookup_"+i);s=new mu(e,n,da.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=s}else if(function(e){return"selection"in e}(o)){const e=o.selection;if(n=Object.assign({as:e},n),s=t.getSelectionComponent(Q(e),e).materialized,!s)throw new Error(`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new Td(e,n,s.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?h(this.transform.as):this.transform.from.fields)}hash(){return"Lookup "+N({transform:this.transform,secondary:this.secondary})}assemble(){let e;if(this.transform.from.fields)e=Object.assign({values:this.transform.from.fields},this.transform.as?{as:h(this.transform.as)}:{});else{let t=this.transform.as;O(t)||(Bn('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),t="_lookup"),e={as:[t]}}return Object.assign(Object.assign({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},e),this.transform.default?{default:this.transform.default}:{})}}class qd extends pu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:"prob",null!==(r=o[1])&&void 0!==r?r:"value"]}clone(){return new qd(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.quantile,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"QuantileTransform "+N(this.transform)}assemble(){const e=this.transform,{quantile:t}=e,n=A(e,["quantile"]);return Object.assign({type:"quantile",field:t},n)}}class Rd extends pu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:t.on,null!==(r=o[1])&&void 0!==r?r:t.regression]}clone(){return new Rd(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.regression,this.transform.on,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"RegressionTransform "+N(this.transform)}assemble(){const e=this.transform,{regression:t,on:n}=e,i=A(e,["regression","on"]);return Object.assign({type:"regression",x:n,y:t},i)}}class Wd extends pu{constructor(e,t){super(e),this.transform=t}clone(){return new Wd(null,B(this.transform))}addDimensions(e){var t;this.transform.groupby=W((null!==(t=this.transform.groupby)&&void 0!==t?t:[]).concat(e),e=>e)}producedFields(){}dependentFields(){var e;return new Set([this.transform.pivot,this.transform.value,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}hash(){return"PivotTransform "+N(this.transform)}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return Object.assign(Object.assign(Object.assign({type:"pivot",field:e,value:t},void 0!==i?{limit:i}:{}),void 0!==r?{op:r}:{}),void 0!==n?{groupby:n}:{})}}class Ud extends pu{constructor(e,t){super(e),this.transform=t}clone(){return new Ud(null,B(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return"SampleTransform "+N(this.transform)}assemble(){return{type:"sample",size:this.transform.sample}}}function Id(e){let t=0;return function n(i,r){var o;if(i instanceof mf&&!i.isGenerator&&!oa(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof Cf&&(i.parent instanceof mf&&!r.source?(r.format=Object.assign(Object.assign({},null!==(o=r.format)&&void 0!==o?o:{}),{parse:i.assembleFormatParse()}),r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof Af){r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source;for(const t of i.assemble())e.push(t)}else{if((i instanceof hf||i instanceof bf||i instanceof Bd||i instanceof Yl||i instanceof mc||i instanceof Nd||i instanceof Pd||i instanceof jf||i instanceof Td||i instanceof Bf||i instanceof Sf||i instanceof zd||i instanceof _d||i instanceof $d||i instanceof Md||i instanceof qd||i instanceof Rd||i instanceof Ef||i instanceof Ud||i instanceof Wd)&&r.transform.push(i.assemble()),(i instanceof pf||i instanceof hu||i instanceof Ld||i instanceof $f)&&r.transform.push(...i.assemble()),i instanceof mu)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof mu)i.setSource(r.name);else if(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()){e.push(r);r={name:null,source:r.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof mu&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children){n(e,{name:null,source:o,transform:[]})}break}}}}}function Hd(e){return"top"===e||"left"===e||Yn(e)?"header":"footer"}function Gd(e,t){var n;const{facet:i,config:r,child:o,component:s}=e;if(e.channelHasField(t)){const a=i[t],u=vc("title",null,r,t);let l=Yr(a,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});o.component.layoutHeaders[t].title&&(l=c(l)?l.join(", "):l,l+=" / "+o.component.layoutHeaders[t].title,o.component.layoutHeaders[t].title=null);const f=vc("labelOrient",a,r,t),d=ae((null!==(n=a.header)&&void 0!==n?n:{}).labels,r.header.labels,!0),g=M(["bottom","right"],f)?"footer":"header";s.layoutHeaders[t]={title:l,facetFieldDef:a,[g]:"facet"===t?[]:[Vd(e,t,d)]}}}function Vd(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function Jd(e,t){var n;const{child:i}=e;if(i.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=Tc(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",s=r[o];for(const r of i.component.axes[t]){const t=Hd(r.get("orient"));s[t]=null!==(n=s[t])&&void 0!==n?n:[Vd(e,o,!1)];const i=ec(r,"main",e.config,{header:!0});i&&s[t][0].axes.push(i),r.mainExtracted=!0}}}}function Yd(e){for(const t of e.children)t.parseLayoutSize()}function Xd(e,t){const n=Nc(t),i=Tt(n),r=e.component.resolve,o=e.component.layoutSize;let s;for(const t of e.children){const e=t.component.layoutSize.getWithExplicit(n),o=r.scale[i];if("independent"===o&&"step"===e.value){s=void 0;break}if(s){if("independent"===o&&s.value!==e.value){s=void 0;break}s=ia(s,e,n,"")}else s=e}if(s){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,s)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function Qd(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(qi(e)){const e=gs(i.view,t);return Xn(n)||us(e)?"step":e}return fs(i.view,t)}if(e.hasProjection||"arc"===e.mark)return fs(i.view,t);{const e=gs(i.view,t);return us(e)?e.step:e}}function Kd(e,t,n){return Ur(t,Object.assign({suffix:"by_"+Ur(e)},null!=n?n:{}))}class Zd extends Sd{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=Og(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet,i)}initFacet(e,t){return xr(e)?$o(e,(e,n,i)=>M([Ze,et],i)?void 0===n.field?(Bn(mn(n,i)),e):(e[i]=to(n,i,t),e):(Bn(hn(i,"facet")),e),{}):{facet:to(e,"facet",t)}}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=ng(this),this.child.parseData()}parseLayoutSize(){Yd(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of xt)Gd(e,t);Jd(e,"x"),Jd(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){var e,t,n;const i={};for(const r of xt)for(const o of Oc){const s=this.component.layoutHeaders[r],a=s[o],{facetFieldDef:u}=s;if(u){const t=vc("titleOrient",u,this.config,r);if(M(["right","bottom"],t)){const n=bc(r,t);i.titleAnchor=null!==(e=i.titleAnchor)&&void 0!==e?e:{},i.titleAnchor[n]="end"}}if(null==a?void 0:a[0]){const e="row"===r?"height":"width",a="header"===o?"headerBand":"footerBand";"facet"===r||this.child.component.layoutSize.get(e)||(i[a]=null!==(t=i[a])&&void 0!==t?t:{},i[a][r]=.5),s.title&&(i.offset=null!==(n=i.offset)&&void 0!==n?n:{},i.offset["row"===r?"rowTitle":"columnTitle"]=10)}}return i}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),Object.assign(Object.assign(Object.assign({},this.getHeaderLayoutMixins()),n?{columns:n}:{}),{bounds:"full",align:i})}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof Zd)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroup(e){return this.parent&&this.parent instanceof Zd?Object.assign(Object.assign({},this.channelHasField("column")?{encode:{update:{columns:{field:Ur(this.facet.column,{prefix:"distinct"})}}}}:{}),super.assembleGroup(e)):super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof Zd){if(this.child.channelHasField("column")){const i=Ur(this.child.facet.column);e.push(i),t.push("distinct"),n.push("distinct_"+i)}}else for(const i of Pt){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),s=r.get("range");if(qi(o)&&Xn(s)){const r=ad(ud(this.child,i));r?(e.push(r),t.push("distinct"),n.push("distinct_"+r)):Bn(sn(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:o,as:s}=this.getCardinalityAggregateForChild(),a=[];for(const e of xt){const t=this.facet[e];if(t){a.push(Ur(t));const{bin:u,sort:l}=t;if(Xt(u)&&a.push(Ur(t,{binSuffix:"end"})),vr(l)){const{field:e,op:a=pr}=l,u=Kd(t,l);n&&i?(r.push(u),o.push("max"),s.push(u)):(r.push(e),o.push(a),s.push(u))}else if(c(l)){const n=hc(t,e);r.push(n),o.push("max"),s.push(n)}}}const u=!!n&&!!i;return Object.assign({name:e,data:t,groupby:a},u||r.length>0?{aggregate:Object.assign(Object.assign({},u?{cross:u}:{}),r.length?{fields:r,ops:o,as:s}:{})}:{})}facetSortFields(e){const{facet:t}=this,n=t[e];return n?vr(n.sort)?[Kd(n,n.sort,{expr:"datum"})]:c(n.sort)?[hc(n,e,{expr:"datum"})]:[Ur(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(vr(e)?e.order:!c(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return kc(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of xc)if(e[i]){const r=vc("labelOrient",e[i],t,i);if(M(n[i],r))return kc(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=Id(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:this.getName("cell"),type:"group"},i?{title:i}:{}),r?{style:r}:{}),{from:{facet:this.assembleFacet()},sort:{field:xt.map(e=>this.facetSortFields(e)).flat(),order:xt.map(e=>this.facetSortOrder(e)).flat()}}),t.length>0?{data:t}:{}),n?{encode:{update:n}}:{}),e.assembleGroup(function(e,t){if(e.component.selection&&V(e.component.selection).length){const n=w(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:$a("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return zu(t)}(this,[])))]}getMapping(){return this.facet}}function eg(e,t){var n,i,r,o,s,a,u,l,c,f;for(const d of t){const t=d.data;if((!e.name||!d.hasName()||e.name===d.dataName)&&!((null===(n=e.format)||void 0===n?void 0:n.mesh)&&(null===(i=t.format)||void 0===i?void 0:i.feature)||((null===(r=e.format)||void 0===r?void 0:r.feature)||(null===(o=t.format)||void 0===o?void 0:o.feature))&&(null===(s=e.format)||void 0===s?void 0:s.feature)!==(null===(a=t.format)||void 0===a?void 0:a.feature)||((null===(u=e.format)||void 0===u?void 0:u.mesh)||(null===(l=t.format)||void 0===l?void 0:l.mesh))&&(null===(c=e.format)||void 0===c?void 0:c.mesh)!==(null===(f=t.format)||void 0===f?void 0:f.mesh)))if(sa(e)&&sa(t)){if($(e.values,t.values))return d}else if(oa(e)&&oa(t)){if(e.url===t.url)return d}else if(aa(e)&&e.name===d.dataName)return d}return null}function tg(e,t){if(e.data||!e.parent){if(null===e.data){const e=new mf({values:[]});return t.push(e),e}const n=eg(e.data,t);if(n)return ua(e.data)||(n.data.format=function(e,...t){for(const n of t)R(e,null!=n?n:{});return e}({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new mf(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function ng(e){var t,n,i,r,o,s,a,u,l,c;let f=tg(e,e.component.data.sources);const{outputNodes:d,outputNodeRefCounts:g}=e.component.data,p=e.parent?e.parent.component.data.ancestorParse.clone():new ra,m=e.data;ua(m)?(la(m)?f=new bf(f,m.sequence):fa(m)&&(f=new hf(f,m.graticule)),p.parseNothing=!0):null===(null===(t=null==m?void 0:m.format)||void 0===t?void 0:t.parse)&&(p.parseNothing=!0),f=null!==(n=Cf.makeExplicit(f,e,p))&&void 0!==n?n:f,f=new Ef(f);const h=e.parent&&Cd(e.parent);(Dd(e)||Fd(e))&&h&&(f=null!==(i=pf.makeFromEncoding(f,e))&&void 0!==i?i:f),e.transforms.length>0&&(f=function(e,t,n){var i,r;let o=0;for(const s of t.transforms){let a,u=void 0;if(Aa(s))a=e=new mc(e,s),u="derived";else if(ga(s)){const r=Ff(s);a=e=null!==(i=Cf.makeWithAncestors(e,{},r,n))&&void 0!==i?i:e,e=new Yl(e,t,s.filter)}else if(Da(s))a=e=pf.makeFromTransform(e,s,t),u="number";else if(ka(s)){u="date";void 0===n.getWithExplicit(s.field).value&&(e=new Cf(e,{[s.field]:u}),n.set(s.field,u,!1)),a=e=hu.makeFromTransform(e,s)}else if(Ca(s))a=e=jf.makeFromTransform(e,s),u="number",Ju(t)&&(e=new Ef(e));else if(pa(s))a=e=Td.make(e,t,s,o++),u="derived";else if(Oa(s))a=e=new Bf(e,s),u="number";else if(wa(s))a=e=new Sf(e,s),u="number";else if(Ea(s))a=e=$f.makeFromTransform(e,s),u="derived";else if(Sa(s))a=e=new zd(e,s),u="derived";else if(ja(s))a=e=new _d(e,s),u="derived";else if(ma(s))a=e=new Wd(e,s),u="derived";else if(xa(s))e=new Ud(e,s);else if(Fa(s))a=e=Ld.makeFromTransform(e,s),u="derived";else if(ha(s))a=e=new $d(e,s),u="derived";else if(ba(s))a=e=new qd(e,s),u="derived";else if(va(s))a=e=new Rd(e,s),u="derived";else{if(!ya(s)){Bn(`Ignoring an invalid transform: ${P(s)}.`);continue}a=e=new Md(e,s),u="derived"}if(a&&void 0!==u)for(const e of null!==(r=a.producedFields())&&void 0!==r?r:[])n.set(e,u,!1)}return e}(f,e,p));const b=function(e){const t={};if(Dd(e)&&e.component.selection)for(const n of V(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&se(e.field)>1&&(t[e.field]="flatten")}return t}(e),v=kf(e);f=null!==(r=Cf.makeWithAncestors(f,{},Object.assign(Object.assign({},b),v),p))&&void 0!==r?r:f,Dd(e)&&(f=Pd.parseAll(f,e),f=Nd.parseAll(f,e)),(Dd(e)||Fd(e))&&(h||(f=null!==(o=pf.makeFromEncoding(f,e))&&void 0!==o?o:f),f=null!==(s=hu.makeFromEncoding(f,e))&&void 0!==s?s:f,f=mc.parseAllForSortIndex(f,e));const y=e.getDataName(da.Raw),x=new mu(f,y,da.Raw,g);if(d[y]=x,f=x,Dd(e)){const t=jf.makeFromEncoding(f,e);t&&(f=t,Ju(e)&&(f=new Ef(f))),f=null!==(a=Ld.makeFromEncoding(f,e))&&void 0!==a?a:f,f=null!==(u=$f.makeFromEncoding(f,e))&&void 0!==u?u:f}Dd(e)&&(f=null!==(l=Bd.make(f,e))&&void 0!==l?l:f);const O=e.getDataName(da.Main),w=new mu(f,O,da.Main,g);d[O]=w,f=w,Dd(e)&&function(e,t){Gu(e,n=>{const i=n.name,r=e.getName("lookup_"+i);e.component.data.outputNodes[r]=n.materialized=new mu(new Yl(t,e,{selection:i}),r,da.Lookup,e.component.data.outputNodeRefCounts)})}(e,w);let j=null;if(Fd(e)){const t=e.getName("facet");f=null!==(c=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(vr(r.sort)){const{field:n,op:i=pr}=r.sort;e=t=new Sf(e,{joinaggregate:[{op:i,field:n,as:Kd(r,r.sort,{forAs:!0})}],groupby:[Ur(r)]})}return t}return null}(f,e.facet))&&void 0!==c?c:f,j=new Af(f,e,t,w.getSource()),d[t]=j}return Object.assign(Object.assign({},e.component.data),{outputNodes:d,outputNodeRefCounts:g,raw:x,main:w,facetRoot:j,ancestorParse:p})}class ig extends Ed{constructor(e,t,n,i){var r,o,s,a;super(e,"concat",t,n,i,e.resolve),"shared"!==(null===(o=null===(r=e.resolve)||void 0===r?void 0:r.axis)||void 0===o?void 0:o.x)&&"shared"!==(null===(a=null===(s=e.resolve)||void 0===s?void 0:s.axis)||void 0===a?void 0:a.y)||Bn("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map((e,t)=>Og(e,this,this.getName("concat_"+t),void 0,i))}parseData(){this.component.data=ng(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of V(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return ss(e)?e.vconcat:as(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){Yd(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";Xd(e,t),Xd(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){const e=Bc(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleMarks(){return this.children.map(e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return Object.assign(Object.assign(Object.assign(Object.assign({type:"group",name:e.getName("group")},t?{title:t}:{}),n?{style:n}:{}),i?{encode:{update:i}}:{}),e.assembleGroup())})}assembleDefaultLayout(){const e=this.layout.columns;return Object.assign(Object.assign({},null!=e?{columns:e}:{}),{bounds:"full",align:"each"})}}const rg=Object.assign(Object.assign({disable:1,gridScale:1,scale:1},me),{labelExpr:1,encode:1}),og=V(rg);class sg extends Ks{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new sg(B(this.explicit),B(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}hasOrientSignalRef(){return Yn(this.explicit.orient)}}const ag={bottom:"top",top:"bottom",left:"right",right:"left"};function ug(e,t){if(!e)return t.map(e=>e.clone());{if(e.length!==t.length)return;const n=e.length;for(let i=0;i{switch(n){case"title":return Ao(e,t);case"gridScale":return{explicit:e.explicit,value:ae(e.value,t.value)}}return na(e,t,n,"axis")});e.setWithExplicit(n,i)}return e}function cg(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(Yn(n.labelAngle)?n.labelAngle:le(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===pc(i,r))return!0}return e===n[t]}const fg=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function dg(e,t){var n,i,r;let o=t.axis(e);const s=new sg,a=eo(t.encoding[e]),{mark:u,config:l}=t,c=(null==o?void 0:o.orient)||(null===(n=l["x"===e?"axisX":"axisY"])||void 0===n?void 0:n.orient)||(null===(i=l.axis)||void 0===i?void 0:i.orient)||function(e){return"x"===e?"bottom":"left"}(e),f=t.getScaleComponent(e).get("type"),d=ac(e,f,c,t.config),g=void 0!==o?!o:lc("disable",l.style,null==o?void 0:o.style,d).configValue;if(s.set("disable",g,void 0!==o),g)return s;o=o||{};const p=function(e,t,n,i,r){const o=null==t?void 0:t.labelAngle;if(void 0!==o)return Yn(o)?o:le(o);{const{configValue:o}=lc("labelAngle",i,null==t?void 0:t.style,r);return void 0!==o?le(o):n!==tt||!M([hi,pi],e.type)||Sr(e)&&e.timeUnit?void 0:270}}(a,o,e,l.style,d),m={fieldOrDatumDef:a,axis:o,channel:e,model:t,scaleType:f,orient:c,labelAngle:p,mark:u,config:l};for(const n of og){const i=n in cc?cc[n](m):be(n)?o[n]:void 0,r=void 0!==i,a=cg(i,n,o,t,e);if(r&&a)s.set(n,i,a);else{const{configValue:e,configFrom:t}=be(n)&&"values"!==n?lc(n,l.style,o.style,d):{},u=void 0!==e;r&&!u?s.set(n,i,a):("vgAxisConfig"!==t||fg.has(n)&&u||de(e)||Yn(e))&&s.set(n,e,!1)}}const h=null!==(r=o.encoding)&&void 0!==r?r:{},b=ge.reduce((n,i)=>{var r;if(!s.hasAxisPart(i))return n;const o=Lc(null!==(r=h[i])&&void 0!==r?r:{},t),a="labels"===i?function(e,t,n){var i;const{encoding:r,config:o}=e,s=null!==(i=eo(r[t]))&&void 0!==i?i:eo(r[St(t)]),a=e.axis(t)||{},{format:u,formatType:l}=a;return ir(l)?Object.assign({text:ar({fieldOrDatumDef:s,field:"datum.value",format:u,formatType:l,config:o})},n):n}(t,e,o):o;return void 0===a||G(a)||(n[i]={update:a}),n},{});return G(b)||s.set("encode",b,!!o.encoding||void 0!==o.labelAngle),s}function gg(e,t,n){const i=bo("orient",e,n);if(e.orient=function(e,t,n){switch(e){case Ae:case Se:case $e:case ke:case De:case we:return}const{x:i,y:r,x2:o,y2:s}=t;switch(e){case Oe:if(Sr(i)&&(Qt(i.bin)||Sr(r)&&r.aggregate&&!i.aggregate))return"vertical";if(Sr(r)&&(Qt(r.bin)||Sr(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(s||o){if(n)return n;if(!o&&(Sr(i)&&i.type===gi&&!Xt(i.bin)||zr(i)))return"horizontal";if(!s&&(Sr(r)&&r.type===gi&&!Xt(r.bin)||zr(r)))return"vertical"}case Fe:if(o&&(!Sr(i)||!Qt(i.bin))&&s&&(!Sr(r)||!Qt(r.bin)))return;case xe:if(s)return Sr(r)&&Qt(r.bin)?"horizontal":"vertical";if(o)return Sr(i)&&Qt(i.bin)?"vertical":"horizontal";if(e===Fe){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case je:case Ce:{const t=_r(i),o=_r(r);if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o){const t=i,o=r,s=t.type===mi,a=o.type===mi;return s&&!a?"tick"!==e?"vertical":"horizontal":!s&&a?"tick"!==e?"horizontal":"vertical":!t.aggregate&&o.aggregate?"tick"!==e?"vertical":"horizontal":t.aggregate&&!o.aggregate?"tick"!==e?"horizontal":"vertical":n||"vertical"}return n||void 0}}return"vertical"}(e.type,t,i),void 0!==i&&i!==e.orient&&Bn(`Specified orient "${e.orient}" overridden with "${i}".`),"bar"===e.type&&e.orient){const i=bo("cornerRadiusEnd",e,n);if(void 0!==i){const n="horizontal"===e.orient&&t.x2||"vertical"===e.orient&&t.y2?["cornerRadius"]:Te[e.orient];for(const t of n)e[t]=i;void 0!==e.cornerRadiusEnd&&delete e.cornerRadiusEnd}}void 0===bo("opacity",e,n)&&(e.opacity=function(e,t){if(M([Ae,Ce,Se,$e],e)&&!Fo(t))return.7;return}(e.type,t));return void 0===bo("cursor",e,n)&&(e.cursor=function(e,t,n){if(t.href||e.href||bo("href",e,n))return"pointer";return e.cursor}(e,t,n)),e}function pg(e,t){const{config:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"})),Xa("x",e,{defaultPos:"mid"})),Xa("y",e,{defaultPos:"mid"})),Va("size",e)),Va("angle",e)),function(e,t,n){if(n)return{shape:{value:n}};return Va("shape",e)}(e,0,t))}function mg(e){var t;const{config:n,markDef:i}=e,{orient:r}=i,o="horizontal"===r?"width":"height",s=e.getScaleComponent("horizontal"===r?"x":"y"),a=null!==(t=bo("size",i,n,{vgChannel:o}))&&void 0!==t?t:n.tick.bandSize;if(void 0!==a)return a;{const e=s?s.get("range"):void 0;if(e&&Xn(e)&&x(e.step))return 3*e.step/4;return 3*ds(n.view,o)/4}}const hg={arc:{vgMark:"arc",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),Xa("x",e,{defaultPos:"mid"})),Xa("y",e,{defaultPos:"mid"})),ru(e,"radius","arc")),ru(e,"theta","arc"))},area:{vgMark:"area",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"})),tu("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient})),tu("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient})),fu(e))},bar:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),ru(e,"x","bar")),ru(e,"y","bar"))},circle:{vgMark:"symbol",encodeEntry:e=>pg(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[Object.assign({type:"geoshape",projection:e.projectionName()},n&&Sr(n)&&n.type===bi?{field:Ur(n,{expr:"datum"})}:{})]}},image:{vgMark:"image",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"})),ru(e,"x","image")),ru(e,"y","image")),Ra(e,"url"))},line:{vgMark:"line",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),Xa("x",e,{defaultPos:"mid"})),Xa("y",e,{defaultPos:"mid"})),Va("size",e,{vgChannel:"strokeWidth"})),fu(e))},point:{vgMark:"symbol",encodeEntry:e=>pg(e)},rect:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),ru(e,"x","rect")),ru(e,"y","rect"))},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?Object.assign(Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),tu("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n})),tu("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n})),Va("size",e,{vgChannel:"strokeWidth"})):{}}},square:{vgMark:"symbol",encodeEntry:e=>pg(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},lu(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"})),Xa("x",e,{defaultPos:"mid"})),Xa("y",e,{defaultPos:"mid"})),Ra(e)),Va("size",e,{vgChannel:"fontSize"})),Va("angle",e)),du("align",function(e,t,n){if(void 0===bo("align",e,n))return"center";return}(e.markDef,0,t))),du("baseline",function(e,t,n){if(void 0===bo("baseline",e,n))return"middle";return}(e.markDef,0,t))),Xa("radius",e,{defaultPos:null,isMidPoint:!0})),Xa("theta",e,{defaultPos:null,isMidPoint:!0}))}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),Xa("x",e,{defaultPos:"mid",vgChannel:"xc"})),Xa("y",e,{defaultPos:"mid",vgChannel:"yc"})),Va("size",e,{defaultValue:mg(e),vgChannel:r})),{[o]:go(bo("thickness",n,t))})}},trail:{vgMark:"trail",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},lu(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"})),Xa("x",e,{defaultPos:"mid"})),Xa("y",e,{defaultPos:"mid"})),Va("size",e)),fu(e))}};function bg(e){if(M([je,xe,Ee],e.mark)){const t=Bo(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:"faceted_path_"+e.requestDataName(da.Main),data:e.requestDataName(da.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:vg(e,{fromPrefix:"faceted_path_"})}]}(e,t)}else if(M([Oe],e.mark)){const t=ei.some(t=>bo(t,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=vg(e,{fromPrefix:"stack_group_"}),n=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map(e=>`scale('${n}',${e})`).join(",")})`;let o,s;"x"===e.stack.fieldChannel?(o=Object.assign(Object.assign({},_(t.encode.update,["y","yc","y2","height",...ei])),{x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}}),s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update=Object.assign(Object.assign({},z(t.encode.update,["y","yc","y2"])),{height:{field:{group:"height"}}})):(o=Object.assign(Object.assign({},_(t.encode.update,["x","xc","x2","width"])),{y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}}),s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update=Object.assign(Object.assign({},z(t.encode.update,["x","xc","x2"])),{width:{field:{group:"width"}}}));for(const n of ei){const i=vo(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=go(i)),i&&(t.encode.update[n]={value:0})}const a=e.fieldDef(e.stack.groupbyChannel),u=Ur(a)?[Ur(a)]:[];((null==a?void 0:a.bin)||(null==a?void 0:a.timeUnit))&&u.push(Ur(a,{binSuffix:"end"}));o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((n,i)=>{if(t.encode.update[i])return Object.assign(Object.assign({},n),{[i]:t.encode.update[i]});{const t=vo(i,e.markDef,e.config);return void 0!==t?Object.assign(Object.assign({},n),{[i]:go(t)}):n}},o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(da.Main),name:"stack_group_"+e.requestDataName(da.Main),groupby:u,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:s},marks:[t]}]}]}(e)}return vg(e)}function vg(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,s=ae(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!!(t&&t.get("selectionExtent")||n&&n.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),a=ho(i),u=r.key,l=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,s=t.order;if(!(!c(s)&&Lr(s)&&L(s.value)||!s&&L(bo("order",r,o)))){if((c(s)||Sr(s))&&!n)return Oo(s,{expr:"datum"});if(_e(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(Sr(i)){const t=i.sort;if(c(t))return{field:Ur(i,{prefix:n,suffix:"sort_index",expr:"datum"})};if(vr(t))return{field:Ur({aggregate:Fo(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})};if(br(t)){return{field:Ur(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}}return null===t?void 0:{field:Ur(i,{binSuffix:e.stack&&e.stack.impute?"mid":void 0,expr:"datum"})}}}else;}}(e),f=function(e){if(!e.component.selection)return null;const t=V(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=V(i.component.selection).length,i=i.parent;return n?{interactive:t>0}:null}(e),d=bo("aria",i,o),g=hg[n].postEncodingTransform?hg[n].postEncodingTransform(e):null;return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName("marks"),type:hg[n].vgMark},s?{clip:!0}:{}),a?{style:a}:{}),u?{key:u.field}:{}),l?{sort:l}:{}),f||{}),!1===d?{aria:d}:{}),{from:{data:t.fromPrefix+e.requestDataName(da.Main)},encode:{update:hg[n].encodeEntry(e)}}),g?{transform:g}:{})]}class yg extends Sd{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,ls(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection={},this.children=[];const o=Ne(e.mark)?Object.assign({},e.mark):{type:e.mark},s=o.type;void 0===o.filled&&(o.filled=function(e,t,{graticule:n}){if(n)return!1;const i=vo("filled",e,t),r=e.type;return ae(i,r!==Ae&&r!==je&&r!==Fe)}(o,r,{graticule:e.data&&fa(e.data)}));const a=this.encoding=Co(e.encoding||{},s,o.filled,r);this.markDef=gg(o,a,r),this.size=function({encoding:e,size:t}){for(const n of Pt){const i=$t(n);us(t[i])&&_r(e[n])&&(delete t[i],Bn(jn(i)))}return t}({encoding:a,size:ls(e)?Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{}):i}),this.stack=Ss(s,a),this.specifiedScales=this.initScales(s,a),this.specifiedAxes=this.initAxes(a),this.specifiedLegends=this.initLegend(a),this.specifiedProjection=e.projection,this.selection=e.selection}get hasProjection(){const{encoding:e}=this,t=this.mark===Be,n=e&&ht.some(t=>Pr(e[t]));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return Ut.reduce((e,n)=>{var i;const r=eo(t[n]);return r&&(e[n]=null!==(i=r.scale)&&void 0!==i?i:{}),e},{})}initAxes(e){return Pt.reduce((t,n)=>{const i=e[n];if(Pr(i)||n===tt&&Pr(e.x2)||n===nt&&Pr(e.y2)){const e=Pr(i)?i.axis:void 0;t[n]=e?Object.assign({},e):e}return t},{})}initLegend(e){return Rt.reduce((t,n)=>{const i=eo(e[n]);if(i&&function(e){switch(e){case ut:case lt:case ct:case dt:case ft:case"opacity":case"strokeWidth":case"strokeDash":return!0;case"fillOpacity":case"strokeOpacity":case"angle":return!1}}(n)){const e=i.legend;t[n]=e?Object.assign({},e):e}return t},{})}parseData(){this.component.data=ng(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of Pt){const r=$t(i);if(t[r]){const e=t[r];n.layoutSize.set(r,us(e)?"step":e,!0)}else{const t=Qd(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){var n;const i={},r=e.config.selection;for(const o of V(null!=t?t:{})){const s=B(t[o]),a=A(r[s.type],["fields","encodings"]);for(const e in a)"encodings"===e&&s.fields||"fields"===e&&s.encodings||("mark"===e&&(s[e]=Object.assign(Object.assign({},a[e]),s[e])),void 0!==s[e]&&!0!==s[e]||(s[e]=null!==(n=a[e])&&void 0!==n?n:s[e]));const u=Q(o),l=i[u]=Object.assign(Object.assign({},s),{name:u,events:O(s.on)?$a(s.on,"scope"):B(s.on)});$u(l,n=>{n.has(l)&&n.parse&&n.parse(e,l,s,t[o])})}return i}(this,this.selection)}parseMarkGroup(){this.component.mark=bg(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,Pt.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[dg(n,e)]),t),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;if(Gu(e,(i,r)=>{const o=i.name,s=w(o+Ru);if(0===t.filter(e=>e.name===o).length){const e="global"===i.resolve?"union":i.resolve,n="multi"===i.type?", true)":")";t.push({name:i.name,update:`${Iu}(${s}, ${w(e)}${n}`})}n=!0,r.topLevelSignals&&(t=r.topLevelSignals(e,i,t)),$u(i,n=>{n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))})}),n){0===t.filter(e=>"unit"===e.name).length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})}return zu(t)}(this,e)}assembleSignals(){return[...tc(this),...(e=this,t=[],Gu(e,(n,i)=>{const r=n.name;let o=i.modifyExpr(e,n);t.push(...i.signals(e,n)),$u(n,i=>{i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(o=i.modifyExpr(e,n,o))}),t.push({name:r+Uu,on:[{events:{signal:n.name+Wu},update:`modify(${w(n.name+Ru)}, ${o})`}]})}),zu(t))];var e,t}assembleSelectionData(e){return function(e,t){const n=[...t];return Gu(e,t=>{const i={name:t.name+Ru};if(t.init){const n=t.project.items.map(e=>A(e,["signals"])),r=t.init.map(e=>Bu(e,!1));i.values="interval"===t.type?[{unit:Vu(e,{escape:!1}),fields:n,values:r}]:r.map(t=>({unit:Vu(e,{escape:!1}),fields:n,values:t}))}n.filter(e=>e.name===t.name+Ru).length||n.push(i)}),n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return Bc(this)}assembleMarks(){var e;let t=null!==(e=this.component.mark)&&void 0!==e?e:[];return this.parent&&Cd(this.parent)||(t=_u(this,t)),t.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return Do(this.encoding,e)}fieldDef(e){return Zr(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return Nr(t)?t:null}}class xg extends Ed{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o=Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{});this.children=e.layer.map((e,t)=>{if(Ds(e))return new xg(e,this,this.getName("layer_"+t),o,r);if(We(e))return new yg(e,this,this.getName("layer_"+t),o,r);throw new Error(tn(e))})}parseData(){this.component.data=ng(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;Yd(e=this),Xd(e,"width"),Xd(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of V(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){var t;const{axes:n,resolve:i}=e.component,r={top:0,bottom:0,right:0,left:0};for(const t of e.children){t.parseAxesAndHeaders();for(const r of V(t.component.axes))i.axis[r]=Tc(e.component.resolve,r),"shared"===i.axis[r]&&(n[r]=ug(n[r],t.component.axes[r]),n[r]||(i.axis[r]="independent",delete n[r]))}for(const o of Pt){for(const s of e.children)if(s.component.axes[o]){if("independent"===i.axis[o]){n[o]=(null!==(t=n[o])&&void 0!==t?t:[]).concat(s.component.axes[o]);for(const e of s.component.axes[o]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!Yn(t)){if(r[t]>0&&!n){const n=ag[t];r[t]>r[n]&&e.set("orient",n,!1)}r[t]++}}}delete s.component.axes[o]}if("independent"===i.axis[o]&&n[o]&&n[o].length>1)for(const e of n[o])e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleSignals()),tc(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),Bc(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)Dd(n)&&(t=_u(n,t));return t}(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),of(this))}}function Og(e,t,n,i,r){if(wr(e))return new Zd(e,t,n,r);if(Ds(e))return new xg(e,t,n,i,r);if(We(e))return new yg(e,t,n,i,r);if(function(e){return ss(e)||as(e)||os(e)}(e))return new ig(e,t,n,r);throw new Error(tn(e))}e.compile=function(e,t={}){var n;t.logger&&(n=t.logger,$n=n),t.fieldTitle&&Jr(t.fieldTitle);try{const n=ys(g(t.config,e.config)),i=Vs(e,n),r=Og(i,null,"",void 0,n);r.parse(),function(e,t){Gf(e.sources);let n=0,i=0;for(let i=0;i<5&&Xf(e,t,!0);i++)n++;e.sources.map(Mf);for(let n=0;n<5&&Xf(e,t,!1);n++)i++;Gf(e.sources),5===Math.max(n,i)&&Bn("Maximum optimization runs(5) reached.")}(r.component.data,r);return{spec:function(e,t,n={},i){const r=e.config?js(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){var n,i;const r=[],o=Id(r);let s=0;for(const t of e.sources){t.hasName()||(t.dataName="source_"+s++);const e=t.assemble();o(t,e)}for(const e of r)0===e.transform.length&&delete e.transform;let a=0;for(const[e,t]of r.entries())0!==(null!==(n=t.transform)&&void 0!==n?n:[]).length||t.source||r.splice(a++,0,r.splice(e,1)[0]);for(const t of r)for(const n of null!==(i=t.transform)&&void 0!==i?i:[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of r)e.name in t&&(e.values=t[e.name]);return r}(e.component.data,n)),s=e.assembleProjections(),a=e.assembleTitle(),u=e.assembleGroupStyle(),l=e.assembleGroupEncodeEntry(!0);let c=e.assembleLayoutSignals();return c=c.filter(e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({$schema:"https://vega.github.io/schema/vega/v5.json"},e.description?{description:e.description}:{}),t),a?{title:a}:{}),u?{style:u}:{}),l?{encode:{update:l}}:{}),{data:o}),s.length>0?{projections:s}:{}),e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([])])),r?{config:r}:{}),i?{usermeta:i}:{})}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):O(t)&&(t={type:t});if(r&&o&&(s=t.type,"fit"===s||"fit-x"===s||"fit-y"===s))if("step"===r&&"step"===o)Bn(on()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";Bn(on(Tt(e)));const n="width"===e?"height":"width";t.type=function(e){return e?"fit-"+Tt(e):"fit"}(n)}var s;return Object.assign(Object.assign(Object.assign({},1===V(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t}),Qs(n)),Qs(e))}(e,i.autosize,n,r),e.datasets,e.usermeta),normalized:i}}finally{t.logger&&($n=Cn),t.fieldTitle&&Jr(Gr)}},e.normalize=Vs,e.version="4.14.0",Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-lite/build/vega-lite.min.js.map b/node_modules/vega-lite/build/vega-lite.min.js.map deleted file mode 100644 index 127f670..0000000 --- a/node_modules/vega-lite/build/vega-lite.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../node_modules/vega-util/src/accessor.js","../node_modules/vega-util/src/getter.js","../node_modules/vega-util/src/error.js","../node_modules/vega-util/src/splitAccessPath.js","../node_modules/vega-util/src/accessors.js","../node_modules/vega-util/src/field.js","../node_modules/vega-util/src/logger.js","../node_modules/vega-util/src/isArray.js","../node_modules/vega-util/src/isObject.js","../node_modules/vega-util/src/mergeConfig.js","../node_modules/vega-util/src/array.js","../node_modules/vega-util/src/hasOwnProperty.js","../node_modules/vega-util/src/isBoolean.js","../node_modules/vega-util/src/isNumber.js","../node_modules/vega-util/src/isString.js","../node_modules/vega-util/src/stringValue.js","../node_modules/vega-util/src/toSet.js","../node_modules/tslib/tslib.es6.js","../node_modules/array-flat-polyfill/index.mjs","../node_modules/clone/clone.js","../node_modules/fast-json-stable-stringify/index.js","../src/logical.ts","../src/util.ts","../node_modules/fast-deep-equal/index.js","../src/axis.ts","../src/mark.ts","../src/spec/unit.ts","../src/compositemark/base.ts","../src/aggregate.ts","../src/channel.ts","../src/bin.ts","../src/log/message.ts","../src/log/index.ts","../src/datetime.ts","../src/timeunit.ts","../src/vega.schema.ts","../src/predicate.ts","../src/type.ts","../src/scale.ts","../src/compile/mark/encode/valueref.ts","../node_modules/vega-util/src/isFunction.js","../src/compile/format.ts","../src/sort.ts","../src/spec/facet.ts","../src/channeldef.ts","../src/title.ts","../src/compile/common.ts","../src/encoding.ts","../src/compositemark/common.ts","../src/compositemark/boxplot.ts","../src/compositemark/errorbar.ts","../src/compositemark/errorband.ts","../src/compositemark/index.ts","../src/guide.ts","../src/legend.ts","../src/selection.ts","../src/spec/concat.ts","../src/spec/base.ts","../src/config.ts","../src/spec/layer.ts","../src/stack.ts","../src/normalize/pathoverlay.ts","../src/normalize/rangestep.ts","../src/normalize/repeater.ts","../src/normalize/ruleforrangedline.ts","../src/normalize/core.ts","../src/normalize/index.ts","../src/spec/map.ts","../src/spec/repeat.ts","../src/spec/toplevel.ts","../src/compile/split.ts","../src/compile/data/index.ts","../src/data.ts","../src/transform.ts","../node_modules/vega-event-selector/src/event-selector.js","../src/compile/mark/encode/conditional.ts","../src/compile/mark/encode/text.ts","../src/compile/mark/encode/tooltip.ts","../src/compile/mark/encode/aria.ts","../src/compile/mark/encode/nonposition.ts","../src/compile/mark/encode/color.ts","../src/compile/mark/encode/offset.ts","../src/compile/mark/encode/position-point.ts","../src/compile/mark/encode/position-align.ts","../src/compile/mark/encode/position-range.ts","../src/compile/mark/encode/position-rect.ts","../src/compile/mark/encode/base.ts","../src/compile/mark/encode/zindex.ts","../src/compile/mark/encode/defined.ts","../src/compile/selection/transforms/nearest.ts","../src/compile/data/dataflow.ts","../src/compile/data/timeunit.ts","../src/compile/selection/transforms/project.ts","../src/compile/selection/transforms/inputs.ts","../src/compile/selection/transforms/toggle.ts","../src/compile/selection/transforms/clear.ts","../src/compile/selection/transforms/scales.ts","../src/compile/selection/transforms/legends.ts","../src/compile/selection/transforms/translate.ts","../src/compile/selection/transforms/zoom.ts","../src/compile/selection/transforms/transforms.ts","../src/compile/selection/assemble.ts","../src/compile/selection/interval.ts","../src/compile/selection/multi.ts","../src/compile/selection/single.ts","../src/compile/selection/index.ts","../node_modules/vega-expression/src/ast.js","../node_modules/vega-expression/src/parser.js","../src/compile/data/expressions.ts","../src/compile/data/filter.ts","../src/compile/selection/parse.ts","../src/compile/predicate.ts","../src/compile/axis/assemble.ts","../src/header.ts","../src/compile/axis/config.ts","../src/compile/axis/properties.ts","../src/compile/data/calculate.ts","../src/compile/header/common.ts","../src/compile/header/component.ts","../src/compile/header/assemble.ts","../src/compile/layoutsize/assemble.ts","../src/compile/layoutsize/component.ts","../src/compile/guide.ts","../src/compile/resolve.ts","../src/compile/legend/component.ts","../src/compile/legend/encode.ts","../src/compile/legend/properties.ts","../src/compile/legend/parse.ts","../src/compile/legend/assemble.ts","../src/compile/projection/assemble.ts","../src/projection.ts","../src/compile/projection/component.ts","../src/compile/projection/parse.ts","../src/compile/data/bin.ts","../src/compile/data/source.ts","../src/compile/data/graticule.ts","../src/compile/data/sequence.ts","../src/compile/data/optimizer.ts","../src/compile/data/aggregate.ts","../src/compile/data/facet.ts","../src/compile/data/formatparse.ts","../src/compile/data/identifier.ts","../src/compile/data/joinaggregate.ts","../src/compile/data/stack.ts","../src/compile/data/window.ts","../src/compile/data/optimizers.ts","../src/compile/data/optimize.ts","../src/compile/signal.ts","../src/compile/scale/domain.ts","../src/compile/scale/assemble.ts","../src/compile/scale/component.ts","../src/compile/scale/range.ts","../src/compile/scale/properties.ts","../src/compile/scale/type.ts","../src/compile/scale/parse.ts","../src/compile/model.ts","../src/compile/data/density.ts","../src/compile/data/filterinvalid.ts","../src/compile/data/flatten.ts","../src/compile/data/fold.ts","../src/compile/data/geojson.ts","../src/compile/data/geopoint.ts","../src/compile/data/impute.ts","../src/compile/data/loess.ts","../src/compile/data/lookup.ts","../src/compile/data/quantile.ts","../src/compile/data/regression.ts","../src/compile/data/pivot.ts","../src/compile/data/sample.ts","../src/compile/data/assemble.ts","../src/compile/header/parse.ts","../src/compile/layoutsize/parse.ts","../src/compile/facet.ts","../src/compile/data/parse.ts","../src/compile/data/joinaggregatefacet.ts","../src/compile/concat.ts","../src/compile/axis/component.ts","../src/compile/axis/parse.ts","../src/compile/axis/encode.ts","../src/compile/mark/init.ts","../src/compile/mark/point.ts","../src/compile/mark/tick.ts","../src/compile/mark/mark.ts","../src/compile/mark/arc.ts","../src/compile/mark/area.ts","../src/compile/mark/bar.ts","../src/compile/mark/geoshape.ts","../src/compile/mark/image.ts","../src/compile/mark/line.ts","../src/compile/mark/rect.ts","../src/compile/mark/rule.ts","../src/compile/mark/text.ts","../src/compile/unit.ts","../src/compile/layoutsize/init.ts","../src/compile/layer.ts","../src/compile/buildmodel.ts","../src/compile/compile.ts"],"names":["accessor","fn","fields","name","fname","getter","path","length","get1","getN","field","obj","len","i","error","message","Error","splitAccessPath","p","j","c","q","b","n","s","push","substring","empty","identity","opt","get","_","log","method","level","input","args","concat","slice","call","console","apply","isArray","Array","isObject","Object","isLegalKey","key","mergeConfig","configs","reduce","out","source","signals","mergeNamed","r","layout","writeConfig","output","value","recurse","k","o","a","map","add","forEach","array","hop","prototype","hasOwnProperty","object","property","isBoolean","isNumber","isString","$","x","JSON","stringify","replace","toSet","__rest","e","t","indexOf","getOwnPropertySymbols","propertyIsEnumerable","flat","defineProperty","configurable","isNaN","arguments","Number","this","writable","flatMap","clone","_instanceof","type","nativeMap","nativeSet","nativePromise","Map","Set","Promise","parent","circular","depth","includeNonEnumerable","allParents","allChildren","useBuffer","Buffer","Infinity","_clone","child","proto","resolve","reject","then","err","__isArray","__isRegExp","RegExp","__getRegExpFlags","lastIndex","__isDate","Date","getTime","isBuffer","allocUnsafe","copy","create","getPrototypeOf","index","keyChild","valueChild","set","entryChild","attrs","getOwnPropertyDescriptor","symbols","symbol","descriptor","enumerable","allPropertyNames","getOwnPropertyNames","propertyName","__objToStr","toString","re","flags","global","ignoreCase","multiline","clonePrototype","module","exports","fastJsonStableStringify","data","opts","cmp","f","cycles","node","aobj","bobj","seen","toJSON","undefined","isFinite","TypeError","seenIndex","keys","sort","splice","isLogicalOr","op","or","isLogicalAnd","and","isLogicalNot","not","normalizeLogicalComposition","normalizer","deepEqual","equal","constructor","valueOf","duplicate","clone_","pick","props","prop","omit","assign","stableStringify","join","hash","str","h","charCodeAt","isNullOrFalse","contains","item","some","arr","entries","every","deepMerge_","dest","src","unique","values","results","u","v","val","hasIntersection","has","prefixGenerator","prefixes","wrappedWithAccessors","y","computedPrefixes","fieldIntersection","isEmpty","vals","_entries","varName","alphanumericS","match","logicalExpr","cb","deleteNestedProperty","orderedProps","shift","titleCase","charAt","toUpperCase","substr","accessPathWithDatum","datum","pieces","prefix","stringValue","escapePathAccess","string","replacePathInField","replaceAll","find","replacement","removePathFromField","accessPathDepth","getFirstDefined","arg","idCounter","normalizeAngle","angle","isNumeric","parseFloat","CONDITIONAL_AXIS_PROP_INDEX","domainColor","part","vgProp","labelAlign","labelBaseline","labelColor","labelFont","labelFontSize","labelFontStyle","labelFontWeight","labelOpacity","labelOffset","labelPadding","gridColor","gridDash","gridDashOffset","gridOpacity","gridWidth","tickColor","tickDash","tickDashOffset","tickOpacity","tickSize","tickWidth","titleColor","title","isConditionalAxisValue","AXIS_PARTS","AXIS_PROPERTY_TYPE","grid","gridCap","gridScale","orient","bandPosition","aria","description","domain","domainCap","domainDash","domainDashOffset","domainOpacity","domainWidth","format","formatType","labelAngle","labelBound","labelFlush","labelFlushOffset","labelLimit","labelLineHeight","labelOverlap","labels","labelSeparation","maxExtent","minExtent","offset","position","tickCap","tickMinStep","tickOffset","tickRound","ticks","titleAlign","titleAnchor","titleAngle","titleBaseline","titleFont","titleFontSize","titleFontStyle","titleFontWeight","titleLimit","titleLineHeight","titleOpacity","titlePadding","titleX","titleY","encode","scale","tickBand","tickCount","tickExtra","translate","zindex","COMMON_AXIS_PROPERTIES_INDEX","AXIS_PROPERTIES_INDEX","style","labelExpr","encoding","isAxisProperty","Mark","arc","area","bar","image","line","point","rect","rule","text","tick","trail","circle","square","geoshape","ARC","AREA","BAR","IMAGE","LINE","POINT","RECT","RULE","TEXT","TICK","TRAIL","CIRCLE","SQUARE","GEOSHAPE","isPathMark","m","isRectBasedMark","PRIMITIVE_MARKS","isMarkDef","mark","FILL_STROKE_CONFIG","VL_ONLY_MARK_CONFIG_PROPERTIES","color","filled","invalid","order","radius2","theta2","timeUnitBand","timeUnitBandPosition","BAR_CORNER_RADIUS_INDEX","horizontal","vertical","defaultBarConfig","binSpacing","continuousBandSize","defaultRectConfig","isUnitSpec","spec","CompositeMarkNormalizer","[object Object]","run","AGGREGATE_OP_INDEX","argmax","argmin","average","count","distinct","product","max","mean","median","min","missing","q1","q3","ci0","ci1","stderr","stdev","stdevp","sum","valid","variance","variancep","MULTIDOMAIN_SORT_OP_INDEX","isArgminDef","isArgmaxDef","isAggregateOp","COUNTING_OPS","isCountingAggregateOp","aggregate","SUM_OPS","SHARED_DOMAIN_OP_INDEX","ROW","COLUMN","X","Y","X2","Y2","RADIUS","THETA","THETA2","COLOR","FILL","STROKE","SHAPE","SIZE","POLAR_POSITION_CHANNEL_INDEX","theta","radius","isPolarPositionChannel","GEO_POSIITON_CHANNEL_INDEX","longitude","longitude2","latitude","latitude2","GEOPOSITION_CHANNELS","UNIT_CHANNEL_INDEX","x2","y2","fill","stroke","opacity","fillOpacity","strokeOpacity","strokeWidth","strokeDash","size","shape","detail","tooltip","href","url","isColorChannel","channel","FACET_CHANNEL_INDEX","row","column","facet","FACET_CHANNELS","CHANNEL_INDEX","CHANNELS","SINGLE_DEF_CHANNEL_INDEX","SINGLE_DEF_UNIT_CHANNEL_INDEX","isChannel","SECONDARY_RANGE_CHANNEL","isSecondaryRangeChannel","getMainRangeChannel","getVgPositionChannel","getSecondaryRangeChannel","getSizeChannel","NONPOSITION_CHANNEL_INDEX","NONPOSITION_CHANNELS","POSITION_SCALE_CHANNEL_INDEX","POSITION_SCALE_CHANNELS","isXorY","POLAR_POSITION_SCALE_CHANNEL_INDEX","POLAR_POSITION_SCALE_CHANNELS","getPositionScaleChannel","sizeType","NONPOSITION_SCALE_CHANNEL_INDEX","NONPOSITION_SCALE_CHANNELS","SCALE_CHANNEL_INDEX","SCALE_CHANNELS","isScaleChannel","supportMark","ALL_MARKS","ALL_MARKS_EXCEPT_GEOSHAPE","getSupportedMark","rangeType","binToString","bin","normalizeBin","isSelectionExtent","isBinning","isBinParams","binned","isBinned","extent","autoMaxBins","invalidSpec","containerSizeNonSingle","containerSizeNotCompatibleWithAutosize","droppingFit","unknownField","cannotProjectOnChannelWithoutField","cannotProjectAggregate","selectionNotSupported","columnsNotSupportByRowCol","differentParse","local","ancestor","customFormatTypeNotAllowed","invalidFieldType","droppingColor","emptyFieldDef","fieldDef","incompatibleChannel","markOrFacet","when","facetChannelShouldBeDiscrete","discreteChannelCannotEncode","unaggregateDomainHasNoEffectForRawField","unaggregateDomainWithNonSharedDomainOp","unaggregatedDomainWithLogScale","scalePropertyNotWorkWithScaleType","scaleType","propName","stepDropped","MORE_THAN_ONE_SORT","invalidTimeUnit","unitName","errorBand1DNotSupport","channelRequiredForBinned","main","warn","info","debug","current","isDateTime","TIMEUNIT_PARTS","MONTHS","SHORT_MONTHS","DAYS","SHORT_DAYS","d","dateTimeParts","normalize","parts","day","log.warn","log.message.droppedDay","year","month","lowerM","toLowerCase","monthIndex","shortM","shortMonthIndex","log.message.invalidTimeUnit","normalizeMonth","quarter","normalizeQuarter","date","lowerD","dayIndex","shortD","shortDayIndex","normalizeDay","timeUnit","unit","dateTimeToExpr","utc","LOCAL_SINGLE_TIMEUNIT_INDEX","week","dayofyear","hours","minutes","seconds","milliseconds","isUTCTimeUnit","startsWith","VEGALITE_TIMEFORMAT","year-month","year-month-date","getTimeUnitParts","containsTimeUnit","fullTimeUnit","fieldExpr","end","fieldRef","lastTimeUnit","dateExpr","dateTimeExprToExpr","timeUnitSpecifierExpression","timeUnitParts","normalizeTimeUnit","params","isSignalRef","isVgRangeStep","range","isDataRefDomain","VG_MARK_CONFIGS","ariaRole","ariaRoleDescription","blend","strokeCap","strokeDashOffset","strokeJoin","strokeOffset","strokeMiterLimit","startAngle","endAngle","padAngle","innerRadius","outerRadius","interpolate","tension","align","baseline","dir","dx","dy","ellipsis","limit","font","fontSize","fontWeight","fontStyle","lineBreak","lineHeight","cursor","cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","aspect","width","height","VG_MARK_INDEX","group","VG_CORNERRADIUS_CHANNELS","isFieldEqualPredicate","predicate","isFieldLTPredicate","lt","isFieldLTEPredicate","lte","isFieldGTPredicate","gt","isFieldGTEPredicate","gte","isFieldRangePredicate","isFieldOneOfPredicate","oneOf","in","isFieldPredicate","predicateValueExpr","valueExpr","wrapTime","fieldFilterExpression","useInRange","_a","timeUnitFieldExpr","vgField","expr","predicateValuesExpr","isFieldValidPredicate","fieldValidPredicate","lower","signal","upper","exprs","normalizePredicate","QUANTITATIVE","ORDINAL","TEMPORAL","NOMINAL","GEOJSON","ScaleType","SCALE_CATEGORY_INDEX","linear","pow","sqrt","symlog","sequential","time","ordinal","bin-ordinal","band","quantile","quantize","threshold","scaleCompatible","scaleType1","scaleType2","scaleCategory1","scaleCategory2","SCALE_PRECEDENCE_INDEX","scaleTypePrecedence","CONTINUOUS_TO_CONTINUOUS_SCALES","CONTINUOUS_TO_CONTINUOUS_INDEX","QUANTITATIVE_SCALES_INDEX","CONTINUOUS_TO_DISCRETE_INDEX","CONTINUOUS_DOMAIN_INDEX","DISCRETE_DOMAIN_INDEX","hasDiscreteDomain","hasContinuousDomain","isContinuousToContinuous","isContinuousToDiscrete","isSelectionDomain","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX","domainMax","domainMin","domainMid","rangeMax","rangeMin","scheme","bins","reverse","round","clamp","nice","base","exponent","constant","zero","padding","paddingInner","paddingOuter","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES","scaleTypeSupportProperty","channelScalePropertyIncompatability","midPointRefWithPositionInvalidTest","channelDef","markDef","config","ref","midPoint","isFieldDef","wrapPositionInvalidTest","getMarkPropOrConfig","fieldInvalidTestValueRef","test","fieldInvalidPredicate","zeroValueRef","valueRefForFieldOrDatumDef","scaleName","isDatumDef","interpolatedSignalRef","fieldOrDatumDef","fieldOrDatumDef2","startSuffix","start","suffix","channel2Def","stack","defaultRef","isFieldOrDatumDef","isTypedFieldDef","getBand","fieldDef2","isMidPoint","impute","binSuffix","binRequiresRange","log.message.channelRequiredForBinned","isValueDef","offsetMixins","widthHeightValueOrSignalRef","isFunction","signalOrValueRef","isCustomFormatType","customFormatExpr","formatSignalRef","normalizeStack","formatCustomType","fieldToFormat","isFieldOrDatumDefForTimeFormat","rawTimeFormat","isUTCScale","formatExpression","timeFormatExpression","timeFormat","isScaleFieldDef","_b","numberFormat","channelDefType","binFormatExpression","formatExpr","datumDef","datumDefToExpr","guideFormat","omitTimeFormatConfig","specifiedFormat","guideFormatType","binNumberFormatExpr","startField","endField","DEFAULT_SORT_OP","SORT_BY_CHANNEL_INDEX","isSortByChannel","isSortByEncoding","isSortField","isSortArray","isFacetMapping","isFacetFieldDef","isFacetSpec","toFieldDefBase","isSortableFieldDef","getMarkConfig","fieldChannel","hasBand","isConditionalDef","hasConditionalFieldDef","condition","hasConditionalFieldOrDatumDef","isContinuousFieldOrDatumDef","cd","isContinuous","isNumericDataDef","isPositionFieldOrDatumDef","isMarkPropFieldOrDatumDef","isStringFieldOrDatumDef","toStringFieldDef","argAccessor","isCount","isInternalField","nofn","isOpFieldDef","String","tu","rest","timeUnitToString","_c","forAs","flatAccessWithDatum","isDiscrete","def","log.message.invalidFieldType","defaultTitleFormatter","fieldTitle","timeUnitParams","maxbins","functionalTitleFormatter","countTitle","verbalTitleFormatter","titleFormatter","setTitleFormatter","formatter","allowDisabling","includeDefault","guideTitle","getGuide","defaultTitle","axis","legend","header","getFormatMixins","guide","getFieldDef","getFieldOrDatumDef","initChannelDef","log.message.primitiveChannelDef","initFieldOrDatumDef","fd","customFormatTypes","log.message.customFormatTypeNotAllowed","guideType","newGuide","initFieldDef","initDatumDef","compositeMark","log.message.invalidAggregate","log.message.channelShouldNotBeUsedForBinned","fullType","getFullName","log.message.invalidFieldTypeForCountAggregate","newType","defaultType","compatible","warning","log.message.facetChannelShouldBeDiscrete","COMPATIBLE","channelCompatibility","sub","labelOrient","titleOrient","step","undefinedIfExprNotRequired","isTime","isLocalSingleTimeUnit","parse","valueArray","extractTitleConfig","titleConfig","anchor","frame","subtitleColor","subtitleFont","subtitleFontSize","subtitleFontStyle","subtitleFontWeight","subtitleLineHeight","subtitlePadding","titleMarkConfig","nonMark","subtitle","subtitleMarkConfig","isText","exprFromValueOrSignalRef","signalOrStringValue","getStyles","vgChannel","ignoreVgConfig","getMarkStyleConfig","styleConfigIndex","getStyleConfig","styles","styleConfig","sortParams","orderDef","fieldRefOption","orderChannelDef","mergeTitleFieldDefs","f1","f2","merged","fdToMerge","fieldDef1","mergeTitle","title1","title2","mergeTitleComponent","v1","v2","v1Val","v2Val","explicit","channelHasField","isAggregate","extractTransformsFromEncoding","oldEncoding","groupby","timeUnits","aggOp","remaining","isTitleDefined","newField","newFieldDef","aggregateEntry","as","secondaryChannel","isNonPositionScaleChannel","initEncoding","normalizedEncoding","log.message.invalidEncodingChannel","markSupported","primaryFieldDef","markChannelCompatible","log.message.incompatibleChannel","log.message.droppingColor","defs","log.message.emptyFieldDef","normalizeEncoding","newChannelDef","mapping","thisArg","el","init","r1","pathGroupingFields","details","getCompositeMarkTooltip","tooltipSummary","continuousAxisChannelDef","encodingWithoutContinuousAxis","withFieldName","fieldPrefix","titlePrefix","mainTitle","getTitle","escape","channelDefArray","fieldDefs","makeCompositeAggregatePartFactory","compositeMarkDef","continuousAxis","sharedEncoding","compositeMarkConfig","partName","positionPrefix","endPositionPrefix","extraEncoding","partLayerMixins","partBaseSpec","clip","compositeMarkContinuousAxis","continuousAxisChannelDef2","continuousAxisChannelDefError","continuousAxisChannelDefError2","filterAggregateFromChannelDef","continuousAxisWithoutAggregate","log.message.errorBarContinuousAxisHasCustomizedAggregate","compositeMarkOrient","xAggregate","yAggregate","boxPlotNormalizer","normalizeBoxPlot","getBoxPlotType","_encoding","selection","projection","_p","outerSpec","log.message.selectionNotSupported","boxplot","sizeValue","boxPlotType","transform","ticksOrient","boxOrient","customTooltipWithoutAggregatedField","continuousFieldName","boxplotSpecificAggregate","boxParamsQuartiles","postAggregateCalculates","calculate","oldEncodingWithoutContinuousAxis","filteredEncoding","customTooltipWithAggregatedField","filterTooltipWithAggregatedField","boxParams","encodingWithoutSizeColorAndContinuousAxis","makeBoxPlotPart","makeBoxPlotExtent","makeBoxPlotBox","makeBoxPlotMidTick","fiveSummaryTooltipEncoding","endTick","whiskerTooltipEncoding","whiskerLayers","boxLayers","filteredLayersMixins","lowerBoxExpr","upperBoxExpr","iqrExpr","lowerWhiskerExpr","upperWhiskerExpr","joinaggregateTransform","joinaggregate","filteredWhiskerSpec","filter","layer","encodingWithoutSizeColorContinuousAxisAndTooltip","axisWithoutTitle","outlierLayersMixins","unshift","continousAxisField","errorBarNormalizer","normalizeErrorBar","tooltipEncoding","errorBarParams","makeErrorBarPart","errorbar","errorBarOrientAndInputType","xError","xError2","yError","yError2","errorBarIsInputTypeRaw","inputType","isTypeAggregatedUpperLower","errorBarIsInputTypeAggregatedUpperLower","isTypeAggregatedError","errorBarIsInputTypeAggregatedError","errorBarSpecificAggregate","tooltipTitleWithFieldName","center","log.message.errorBarCenterIsUsedWithWrongExtent","getTitlePrefix","centerOp","lowerExtentOp","upperExtentOp","postAggregateCalculate","errorBarAggregationAndCalculation","_d","_e","_f","oldAggregate","oldGroupBy","operation","errorBandNormalizer","normalizeErrorBand","errorBandDef","makeErrorBandPart","errorband","is2D","bandMark","bordersMark","log.message.errorBand1DNotSupport","compositeMarkRegistry","VL_ONLY_LEGEND_CONFIG","LEGEND_SCALE_CHANNELS","SIGNAL_LEGEND_PROP_INDEX","fillColor","gradientStrokeColor","strokeColor","symbolFillColor","symbolStrokeColor","defaultConfig","single","on","clear","multi","toggle","interval","encodings","zoom","isLegendBinding","bind","isLegendStreamBinding","isConcatSpec","isVConcatSpec","isHConcatSpec","isStep","isFrameMixins","COMPOSITION_LAYOUT_PROPERTIES","bounds","columns","spacing","getViewConfigContinuousSize","viewConfig","getViewConfigDiscreteStep","getViewConfigDiscreteSize","DEFAULT_STEP","background","view","continuousWidth","continuousHeight","mark.defaultBarConfig","mark.defaultRectConfig","thickness","box","outliers","borders","pointPadding","barBandPaddingInner","rectBandPaddingInner","minBandSize","minFontSize","maxFontSize","minOpacity","maxOpacity","minSize","minStrokeWidth","maxStrokeWidth","quantileCount","quantizeCount","gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity","headerColumn","headerRow","headerFacet","defaultSelectionConfig","tab10","DEFAULT_FONT_SIZE","guideLabel","groupTitle","groupSubtitle","DEFAULT_COLOR","blue","orange","red","teal","green","yellow","purple","pink","brown","gray0","gray1","gray2","gray3","gray4","gray5","gray6","gray7","gray8","gray9","gray10","gray11","gray12","gray13","gray14","gray15","initConfig","restConfig","guide-label","guide-title","group-title","group-subtitle","fontConfig","cell","category","colorSignalConfig","fontSizeSignalConfig","MARK_STYLES","VL_ONLY_CONFIG_PROPERTIES","VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX","stripAndRedirectConfig","markType","vlOnlyMarkSpecificConfigs","redirectConfigToStyleConfig","redirectTitleConfig","toProp","compositeMarkPart","propConfig","isLayerSpec","STACK_OFFSET_INDEX","STACKABLE_MARKS","STACK_BY_DEFAULT_MARKS","potentialStackedChannel","xDef","yDef","xScale","yScale","stackedFieldDef","stackedField","dimensionChannel","getDimensionChannel","dimensionDef","dimensionField","stackBy","sc","cDef","disallowNonLinearStack","log.message.cannotStackNonLinearScale","groupbyChannel","groupbyField","dropLineAndPoint","dropLineAndPointFromConfig","getPointOverlay","markConfig","getLineOverlay","PathOverlayNormalizer","pointOverlay","lineOverlay","stackProps","overlayEncoding","stackFieldChannel","RangeStepNormalizer","sizeMixins","defWithoutScale","scaleWithoutRangeStep","replaceRepeaterInFacet","repeater","replaceRepeaterInMapping","replaceRepeaterInFieldDef","replaceRepeaterInEncoding","replaceRepeatInProp","isRepeatRef","repeat","log.message.noSuchRepeatedValue","replaceRepeaterInFieldOrDatumDef","replaceRepeaterInChannelDef","RuleForRangedLineNormalizer","mainChannelDef","hasX2","hasY2","mergeEncoding","parentEncoding","channels","parentChannelDef","mergedChannelDef","mergeProjection","parentProjection","log.message.projectionOverridden","normalizedSpec","normalizeGenericSpec","autosize","sizeInfo","isFitCompatible","autosizeDefault","log.message.containerSizeNonSingle","_normalizeAutoSize","log.message.containerSizeNotCompatibleWithAutosize","normalizeAutoSize","mapFacet","isRepeatSpec","mapRepeat","mapHConcat","mapVConcat","mapConcat","mapLayerOrUnit","mapLayer","mapUnit","log.message.invalidSpec","subspec","hconcat","vconcat","nonFacetUnitNormalizers","hasRow","hasColumn","hasFacet","mapFacetedUnit","super","specWithReplacedEncoding","mapUnitWithParentEncodingOrProjection","normalizeLayerOrUnit","unitNormalizer","hasMatchingType","isLayerRepeatSpec","mapLayerRepeat","mapNonLayerRepeat","childSpec","repeaterPrefix","layerValue","childRepeater","childName","remainingProperties","log.message.columnsNotSupportByRowCol","repeatValues","repeatValue","rowValue","columnValue","mergedProjection","mergedEncoding","facetMapping","getFacetMappingAndLayout","newEncoding","facets","defWithoutLayout","otherParams","TOP_LEVEL_PROPERTIES","extractTopLevelProperties","Split","implicit","other","combine","getWithExplicit","setWithExplicit","makeExplicit","makeImplicit","tieBreakByComparing","compare","propertyOf","diff","defaultTieBreaker","log.message.mergeConflictingProperty","mergeValuesWithExplicit","tieBreaker","AncestorParse","parseNothing","isUrlData","isInlineData","isNamedData","isGenerator","isSequenceGenerator","isSphereGenerator","isGraticuleGenerator","DataSourceType","isFilter","isLookup","isPivot","isDensity","isQuantile","isRegression","isLoess","isSample","isWindow","isJoinAggregate","isFlatten","isCalculate","isBin","isImpute","isTimeUnit","isStack","isFold","parseSelector","selector","marks","DEFAULT_SOURCE","VIEW","MARKS","DEFAULT_MARKS","parseMerge","trim","ILLEGAL","*","endChar","pushChar","popChar","LBRACK","RBRACK","stream","between","parseBetween","throttle","markname","lastIndexOf","split","parseThrottle","marktype","consume","debounce","parseStream","wrapCondition","model","refFn","valueRef","conditionValueRef","isConditionalSelection","parseSelectionPredicate","expression","textRef","tooltipRefForEncoding","reactiveGeom","tooltipRefFromChannelDef","markTooltip","content","tooltipData","toSkip","tuples","fDef","mainChannel","channel2","keyValues","enableAria","ariaRoleDesc","descriptionValue","nonPosition","defaultValue","ref.midPoint","getScaleComponent","transparentIfNeeded","defaultFill","defaultStroke","colorVgChannel","fillStrokeMarkDefAndConfig","getOffset","markDefOffsetValue","getOffsetChannel","pointPosition","defaultPos","pointPositionDefaultRef","getName","ref.interpolatedSignalRef","ref.valueRefForFieldOrDatumDef","ref.midPointRefWithPositionInvalidTest","positionRef","definedValueOrConfig","ref.widthHeightValueOrSignalRef","domainDefinitelyIncludesZero","sizeRef","mult","ALIGNED_X_CHANNEL","left","right","BASELINED_Y_CHANNEL","top","middle","bottom","vgAlignedPositionChannel","defaultAlign","pointOrRangePosition","defaultPos2","rangePosition","sizeChannel","pos2Mixins","baseChannel","position2Ref","position2orSize","pointPosition2OrSize","rectPosition","channelDef2","hasSizeDef","isBarBand","component","axes","axisTranslate","vgChannel2","rectBinRef","getBinSpacing","startRef","rectBinPosition","vgSizeChannel","useVlSizeChannel","sizeFromMarkOrConfig","log.message.cannotApplySizeToNonOrientedMark","defaultSizeRef","posRef","sizeOffset","positionAndSize","discreteBandSize","scaleRange","spacingOffset","reverseExpr","offsetExpr","translateExpr","ref.wrapPositionInvalidTest","ALWAYS_IGNORE","baseEncodeEntry","ignore","markDefProperties","wrapAllFieldsInvalid","filterIndex","aggregator","scaleComponent","allFieldsInvalidPredicate","defined","valueIfDefined","nearest","selCmpt","events","project","hasChannel","cellDef","interactive","from","update","isVoronoi","getSizeSignalRef","exists","DataFlowNode","debugName","_children","_parent","addChild","children","loc","oldChild","removeChild","newParent","OutputNode","refCounts","_source","_name","cloneObj","_hash","id","uniqueId","TimeUnitNode","formula","reduceFieldDef","timeUnitComponent","isUnitModel","normalizedTimeUnit","remove","transforms","units","timezone","SelectionProjectionComponent","items","hasField","inputBindings","selDef","origDef","topLevelSignals","proj","sgname","assembleInit","TUPLE","modifyExpr","tpl","idx","findIndex","addClear","vIdx","visual","tIdx","scaleBindings","bound","scales","isTopLevelLayer","namedSg","VL_SELECTION_RESOLVE","isLayerModel","legendBindings","projLen","legendFilter","evt","merge","selName","markName","ds","hasLegend","sgName","force","tuple","DELTA","hasScales","scalesCompiler","INTERVAL_BRUSH","onDelta","delta","sizeSg","scaleCmpt","sx","sy","compilers","parsed","signalName","sg","counter","cfg","log.message.cannotProjectAggregate","log.message.cannotProjectOnChannelWithoutField","parseInit","allSignals","legends","inputs","forEachTransform","isExpr","wrap","assembled","UTC","dateTimeToTimestamp","assembleUnitSelectionMarks","forEachSelection","selCompiler","txCompiler","cleanupEmptyOnArray","BRUSH","fieldsSg","dataSignals","scaleTriggers","filterExpr","filters","cs","vname","dname","scaled","coord","channelSignals","toNum","xvname","yvname","store","STORE","vgStroke","enter","singleOrMultiSignals","MODIFY","selections","sel","facetModel","isFacetModel","getFacetModel","requiresSelectionId","identifier","TokenName","lookahead","ASTNode","visit","visitor","elements","callee","consequent","alternate","properties","argument","RegexNonAsciiIdentifierStart","RegexNonAsciiIdentifierPart","assert","isDecimalDigit","ch","isHexDigit","isOctalDigit","isWhiteSpace","isLineTerminator","isIdentifierStart","fromCharCode","isIdentifierPart","keywords","if","do","var","for","new","try","let","else","case","void","with","enum","while","break","catch","throw","const","yield","class","return","typeof","delete","switch","export","import","public","static","default","finally","extends","package","private","function","continue","debugger","interface","protected","instanceof","implements","skipComment","scanHexEscape","code","throwError","scanUnicodeCodePointEscape","cu1","cu2","getEscapedIdentifier","scanIdentifier","getIdentifier","scanPunctuator","code2","ch2","ch3","ch4","ch1","scanNumericLiteral","number","parseInt","scanHexLiteral","octal","scanOctalLiteral","scanRegExp","body","classMarker","terminated","literal","scanRegExpBody","search","scanRegExpFlags","pattern","tmp","$0","$1","exception","testRegExp","regex","advance","quote","scanStringLiteral","lex","token","peek","pos","finishBinaryExpression","operator","finishCallExpression","finishIdentifier","finishLiteral","raw","finishMemberExpression","computed","member","finishProperty","kind","messageFormat","msg","whole","throwUnexpected","expect","matchKeyword","keyword","parseArrayInitialiser","parseConditionalExpression","finishArrayExpression","parseObjectPropertyKey","parseObjectProperty","parseObjectInitialiser","finishObjectExpression","legalKeywords","parsePrimaryExpression","parseExpression","parseGroupExpression","parseArguments","parseNonComputedMember","isIdentifierName","parseComputedMember","parsePostfixExpression","parseLeftHandSideExpressionAllowCall","parseUnaryExpression","binaryPrecedence","prec","marker","markers","pop","parseBinaryExpression","finishConditionalExpression","getDependentFields","ast","dependents","startsWithDatum","FilterNode","_dependentFields","dfnode","stores","predicateStr","getSelectionComponent","tunode","insertAsParentOf","parseSelectionBinExtent","filterOp","isSelectionPredicate","setAxisEncode","vgRef","assembleAxis","axisCmpt","disable","propType","propValue","valueOrSignalRef","conditions","propIndex","valueOrSignalCRef","signalRef","mainExtracted","hasAxisPart","titleString","assembleTitle","assembleAxisSignals","HEADER_TITLE_PROPERTIES_MAP","HEADER_LABEL_PROPERTIES_MAP","labelAnchor","HEADER_TITLE_PROPERTIES","HEADER_LABEL_PROPERTIES","getAxisConfigFromConfigTypes","configTypes","configType","orient1","orientConfig1","orientConfig2","conditionalOrientAxisConfig","getAxisConfigs","typeBasedConfigTypes","axisChannel","axisOrient","vlOnlyConfigTypes","vgConfigTypes","vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle","getAxisConfigStyle","axisConfigTypes","toMerge","getAxisConfig","axisConfigs","configFrom","configValue","axisRules","defaultGrid","gridChannel","defaultLabelAlign","defaultLabelBaseline","defaultLabelFlush","hasTimeUnit","defaultLabelOverlap","defaultTickCount","fieldDefTitle","getFieldDefTitle","typedFieldDef","defaultZindex","normalizeAngleExpr","alwaysIncludeMiddle","isX","mainOrient","CalculateNode","forEachFieldDef","sortValue","sortArrayIndexField","getHeaderChannel","getHeaderProperty","facetFieldDef","headerSpecificConfig","getHeaderProperties","HEADER_CHANNELS","HEADER_TYPES","assembleTitleGroup","layoutHeaders","ta","headerChannel","role","defaultHeaderGuideBaseline","defaultHeaderGuideAlign","assembleHeaderProperties","assembleHeaderGroups","layoutHeader","groups","headerType","headerComponent","assembleHeaderGroup","getSort","assembleLabelTitle","titleTextExpr","isFacetWithoutRowCol","hasAxes","sizeSignal","LAYOUT_TITLE_BAND","getLayoutTitleBand","propertiesMap","assembleLayoutSignals","sizeSignals","layoutSize","stepSignal","sizeExpr","isWidth","endsWith","safeExpr","cardinality","getSizeTypeFromLayoutSizeType","layoutSizeType","guideEncodeEntry","valueDef","defaultScaleResolve","isConcatModel","parseGuideResolve","channelScaleResolve","log.message.independentScaleMeansIndependentGuide","LEGEND_COMPONENT_PROPERTY_INDEX","clipHeight","columnPadding","direction","gradientLength","gradientOpacity","gradientStrokeWidth","gradientThickness","gridAlign","legendX","legendY","rowPadding","symbolDash","symbolDashOffset","symbolLimit","symbolOffset","symbolOpacity","symbolSize","symbolStrokeWidth","symbolType","LEGEND_COMPONENT_PROPERTIES","LegendComponent","legendEncodeRules","symbolsSpec","legendCmpt","legendType","propsList","applyMarkConfig","mixins.color","getMaxValue","symbolBaseFillColor","_h","_g","getFirstConditionValue","selectedCondition","gradient","gradientSpec","specifiedlabelsSpec","labelsSpec","entriesSpec","getConditionValue","conditionalDef","Math","reducer","hasConditionalValueDef","legendRules","legendConfig","gradientLengthSignal","defaultGradientLength","shapeChannelDef","markShape","defaultSymbolType","getLegendType","getDirection","defaultDirection","parseLegend","legendComponent","parseLegendForChannel","parseUnitLegend","mergeLegendComponent","parseNonUnitLegend","isExplicit","getLegendDefWithScale","legendSelections","parseInteractiveLegend","ruleParams","legendEncoding","legendEncode","legendEncodeParams","legendEncodingPart","mergedLegend","childLegend","mergedOrient","childOrient","typeMerged","mergedValueWithExplicit","mergeSymbolType","st1","st2","setLegendEncode","assembleLegends","legendComponentIndex","legendByDomain","domainHash","mergedLegendComponent","l","assembleLegend","assembleProjections","projections","assembleProjectionForModel","assembleProjectionsForModelAndChildren","fits","sources","lookupDataSource","fit","PROJECTION_PROPERTIES","ProjectionComponent","specifiedProjection","isFit","parseProjection","hasProjection","posssiblePair","requestDataName","Main","gatherFitData","projectionName","parseUnitProjection","nonUnitProjection","mergable","first","second","allPropertiesShared","mergeIfNoConflict","modelProjection","renameProjection","parseNonUnitProjections","binKey","getBinSignalName","createBinComponent","span","isBinTransform","normalizedBin","extentSignal","getSignalsFromModel","ext","binComponent","BinNode","binComponentIndex","formulaAs","rangeFormula","renameSignal","binAs","remainingAs","binTrans","SourceNode","_data","defaultExtension","exec","_generator","dataName","GraticuleNode","SequenceNode","isDataSourceNode","OptimizerBase","_mutated","mutatedFlag","BottomUpOptimizer","_continue","continueFlag","setContinue","setMutated","next","optimizeNextFromLeaves","TopDownOptimizer","addDimension","dims","posChannel","getPositionChannelFromLatLong","AggregateNode","dimensions","measures","groupBy","meas","argField","scaleDomain","setEqual","parentMeasures","childMeasures","ops","mergeMeasures","log.debug","alias","FacetNode","sortField","sortIndexField","childModel","depFields","childIndependentFieldsWithStep","childScaleComponent","getFieldFromDomain","assembleDomain","log.message.unknownField","crossedDataName","childChannel","hasSharedAxis","headers","stop","assembleRowColumnHeaderData","getChildIndependentFieldsWithStep","facetData","assembleFacetHeaderData","unquote","getImplicitFromFilterTransform","forEachLeaf","subop","getImplicitFromEncoding","mainFieldDef","dimensionChannelDef","ParseNode","_parse","ancestorParse","makeWithAncestors","parsedAs","log.message.differentParse","copyAll","formatParse","onlyNested","IdentifierNode","JoinAggregateTransformNode","w","getDefaultName","joinAggregateFieldDef","StackNode","_stack","stackTransform","sortFields","sortOrder","normalizedAs","isValidAsArray","stackField","facetby","stackProperties","dimensionFieldDef","stackby","by","_field","getStackByFields","getGroupbyFields","WindowTransformNode","window","windowFieldDef","param","ignorePeers","MoveParseUp","numChildren","producedFields","dependentFields","swapWithParent","MergeIdenticalNodes","nodes","mergedNode","hashes","buckets","mergeNodes","RemoveUnusedSubtrees","RemoveDuplicateTimeUnits","prev","pfields","MergeTimeUnits","timeUnitChildren","combination","moveFacetDown","facetMain","moveMainDownToFacet","cloner","newName","FACET_SCALE_PREFIX","getSource","setSource","outputNodes","addDimensions","RemoveUnnecessaryOutputNodes","isRequired","RemoveUnnecessaryIdentifierNodes","MergeParse","originalChildren","parseChildren","commonParse","conflictingParse","parseNode","mergedParseNode","childNode","MergeAggregates","aggChildren","groupedAggregates","agg","groupBys","mergeableAggs","mergedAggs","MergeBins","moveBinsUp","promotableBins","remainingBins","promotedBin","remainingBin","MergeOutputs","otherChildren","mainOutput","lastOutput","theChild","checkLinks","getLeaves","roots","leaves","append","isTrue","runOptimizer","optimizer","runFlags","reset","optimizationDataflowHelper","dataComponent","firstPass","mutatedFlags","optimizers.RemoveUnnecessaryOutputNodes","optimizers.RemoveUnnecessaryIdentifierNodes","optimizers.RemoveUnusedSubtrees","optimizers.MoveParseUp","optimizers.MergeBins","optimizers.RemoveDuplicateTimeUnits","optimizers.MergeParse","optimizers.MergeAggregates","optimizers.MergeTimeUnits","optimizers.MergeIdenticalNodes","optimizers.MergeOutputs","SignalRefWrapper","exprGenerator","rename","parseScaleDomain","localScaleComponents","util.keys","domains","parseDomainForChannel","parseSelectionDomain","isFaceted","facetParent","parseUnitScaleDomain","selectionExtent","childComponent","domainsTieBreaker","se","parseNonUnitScaleDomain","scaleConfig","reason","canUseUnaggregatedDomain","useUnaggregatedDomain","normalizeUnaggregatedDomain","specifiedScales","parseSingleChannelDomain","convertDomainIfItIsDateTime","mapDomainToDataSignal","isDomainUnionWith","defaultDomain","unionWith","stackDimensions","isStackedMeasure","util.contains","normalizeSortField","fieldDefToSortBy","domainSort","util.isBoolean","Raw","binSignal","getSignalName","util.replacePathInField","log.message.unaggregateDomainWithNonSharedDomainOp","log.message.unaggregatedDomainWithLogScale","log.message.unaggregateDomainHasNoEffectForRawField","log.message.mergeConflictingDomainProperty","mergeDomains","uniqueDomains","util.unique","util.hash","sorts","log.message.MORE_THAN_ONE_SORT","unionDomainSorts","UNIONDOMAIN_SORT_OP_INDEX","log.message.domainSortDropped","allData","isDataRefUnionedDomain","nonUnionDomain","isFieldRefUnionDomain","assembleScalesForModel","_r","otherScaleProps","assembleScaleRange","domainRaw","assembleSelectionScaleDomain","ScaleComponent","typeWithExplicit","RANGE_PROPERTIES","getBinStepSignal","updatedName","binCount","parseRangeForChannel","specifiedScale","supportedByScaleType","channelIncompatability","fromName","parseScheme","log.message.scalePropertyNotWorkWithScaleType","log.message.stepDropped","sizeRangeMin","xyStepSignals","maxBandSize","minXYStep","maxSize","pointStep","sizeRangeMax","rMax","rMin","interpolateRange","log.message.domainRequiredForThresholdScale","defaultContinuousToDiscreteCount","PI","defaultRange","isExtendedScheme","util.omit","widthStep","heightStep","parseScaleProperty","localScaleCmpt","mergedScaleCmpt","specifiedValue","scalePadding","scalePaddingInner","copyKeyFromObject","scaleRules","parseUnitScaleProperty","parseNonUnitScaleProperty","barConfig","continuousPadding","paddingValue","bandPaddingInner","paddingInnerValue","bandPaddingOuter","xReverse","specifiedDomain","last","parseScaleRange","rangeWithExplicit","parseUnitScaleRange","valueWithExplicit","defaultScaleType","log.message.discreteChannelCannotEncode","CHANNEL.isScaleChannel","CHANNEL.X","CHANNEL.Y","CHANNEL.THETA","CHANNEL.RADIUS","CHANNEL.SIZE","CHANNEL.COLOR","CHANNEL.FILL","CHANNEL.STROKE","CHANNEL.SHAPE","channelSupportScaleType","specifiedType","fieldDefType","log.message.scaleTypeNotWorkWithFieldDef","log.message.scaleTypeNotWorkWithChannel","parseScaleCore","scaleComponents","sType","parseUnitScaleCore","scaleTypeWithExplicitIndex","explicitScaleType","childScaleType","scaleTypeTieBreaker","childScale","renameScale","parseNonUnitScaleCore","NameMap","nameMap","oldName","Model","parentGivenName","correctDataNames","scaleNameMap","projectionNameMap","signalNameMap","specType","compositionConfig","spacingConfig","extractCompositionLayout","outputNodeRefCounts","parseScale","parseLayoutSize","renameTopLevelLayoutSizeSignal","parseSelections","parseData","parseAxesAndHeaders","parseLegends","parseMarkGroup","ignoreRange","parseScales","baseView","isTopLevel","encodeEntry","assembleEncodeFromView","titleBand","headerComponentIndex","assembleLayoutTitleBand","assembleDefaultLayout","headerMarks","axisComponents","assembleAxes","titleNoEncoding","assembleSignals","assembleLayout","assembleHeaderMarks","assembleMarks","assembleScales","fullName","getDataName","oldSignalName","originalScaleName","localScaleComponent","variableName","origName","hasOrientSignalRef","ModelWithField","getMapping","acc","DensityTransformNode","specifiedAs","density","FilterInvalidNode","vegaFilters","FlattenTransformNode","flatten","FoldTransformNode","fold","GeoJSONNode","geojson","geoJsonCounter","coordinates","pair","GeoPointNode","ImputeNode","keyvals","imputeTransform","imputedChannel","keyChannel","groupbyFields","processSequence","LoessTransformNode","loess","LookupNode","secondary","fromOutputNode","isLookupData","fromSource","findSource","fromOutputName","Lookup","isLookupSelection","materialized","lookup","foreign","asName","QuantileTransformNode","RegressionTransformNode","regression","PivotTransformNode","pivot","SampleTransformNode","sample","makeWalkTree","datasetIndex","walkTree","dataSource","assembleFormatParse","assembleTransforms","assemble","getHeaderType","parseFacetHeader","makeHeaderComponent","mergeChildAxis","axisComponent","mainAxis","parseChildrenLayoutSize","parseNonUnitLayoutSizeForChannel","layoutSizeCmpt","mergedSize","childSize","scaleResolve","defaultUnitSize","facetSortFieldName","FacetModel","buildModel","initFacet","normalizedFacet","parseFacetHeaders","assembleSelectionTopLevelSignals","assembleSelectionData","layoutMixins","layoutHeaderComponent","bandType","columnDistinctSignal","getHeaderLayoutMixins","assembleGroup","facetRoot","getCardinalityAggregateForChild","outputName","cross","ORTHOGONAL_ORIENT","root","assembleFacetData","assembleGroupEncodeEntry","assembleGroupStyle","assembleFacet","facetSortFields","facetSortOrder","assembleFacetSignals","otherData","hasName","mesh","feature","_j","_k","parseRoot","existingSource","mergeDeep","head","sequence","graticule","parentIsLayer","makeFromEncoding","lookupCounter","transformNode","derivedType","makeFromTransform","make","parseTransformArray","implicitSelection","getImplicitFromSelection","implicitEncoding","parseAll","parseAllForSortIndex","rawName","mainName","lookupName","materializeSelections","facetName","makeJoinAggregateFromFacet","ConcatModel","getChildren","widthType","heightType","parseConcatLayoutSize","layoutSignals","db","AXIS_COMPONENT_PROPERTIES_INDEX","AXIS_COMPONENT_PROPERTIES","AxisComponent","OPPOSITE_ORIENT","mergeAxisComponents","mergedAxisCmpts","childAxisCmpts","mergeAxisComponent","propsToAlwaysIncludeConfig","parseAxis","defaultOrient","getLabelAngle","hasValue","hasConfigValue","axisEncoding","axisEncode","axisEncodingPart","specifiedLabelsSpec","encode.labels","initMarkdef","specifiedOrient","xIsContinuous","yIsContinuous","xIsTemporal","yIsTemporal","cornerRadiusEnd","newProps","BAR_CORNER_RADIUS_END_INDEX","newProp","fixedShape","encode.baseEncodeEntry","encode.pointPosition","encode.nonPosition","shapeMixins","defaultSize","markPropOrConfig","bandSize","markCompiler","vgMark","encode.rectPosition","encode.pointOrRangePosition","encode.defined","postEncodingTransform","shapeDef","encode.text","encode.valueIfDefined","vgThicknessChannel","parseMarkGroups","getMarkGroup","fromPrefix","getPathGroups","hasCornerRadius","fieldScale","stackFieldGroup","func","groupUpdate","innerGroupUpdate","groupByField","strokeForeground","getGroupsForStackedBarWithCornerRadius","scaleClip","projectionClip","unitCount","parentCount","interactiveFlag","UnitModel","parentGivenSize","specifiedAxes","specifiedLegends","filledConfig","defaultFilled","initLayoutSize","initScales","initAxes","initLegend","isGeoShapeMark","hasGeoPosition","_axis","axisSpec","_legend","supportLegend","specifiedSize","parseUnitLayoutSize","selDefs","selCmpts","selectionConfig","safeName","parseUnitSelection","hasSelections","isMulti","assembleTopLevelSignals","dataCopy","insert","assembleUnitSelectionData","vlEncoding.channelHasField","LayerModel","axisCount","oppositeOrient","parseLayerAxes","assembleLayerSelectionMarks","unitSize","isAnyConcatSpec","inputSpec","newLogger","logger","vlFieldDef.setTitleFormatter","firstPassCounter","secondPassCounter","optimizers.moveFacetDown","optimizeDataflow","topLevelProperties","datasets","usermeta","vgConfig","sourceIndex","newData","whereTo","assembleRootData","$schema","assembleTopLevelModel","hasAxisOrientSignalRef","resize","autoSizeType","log.message.droppingFit","inverseSizeType","getFitType","getTopLevelProperties","normalized"],"mappings":"sMAAe,SAAAA,EAASC,EAAIC,EAAQC,GAGlC,OAFAF,EAAGC,OAASA,GAAU,GACtBD,EAAGG,MAAQD,EACJF,ECHM,SAAAI,EAASC,GACtB,OAAuB,IAAhBA,EAAKC,OAAeC,EAAKF,EAAK,IAAMG,EAAKH,GAGlD,MAAME,EAAOE,GAAS,SAASC,GAC7B,OAAOA,EAAID,IAGPD,EAAOH,IACX,MAAMM,EAAMN,EAAKC,OACjB,OAAO,SAASI,GACd,IAAK,IAAIE,EAAI,EAAGA,EAAID,IAAOC,EACzBF,EAAMA,EAAIL,EAAKO,IAEjB,OAAOF,ICdI,SAAAG,EAASC,GACtB,MAAMC,MAAMD,GCCC,SAAAE,EAASC,GACtB,IAKIL,EAAGM,EAAGC,EALNd,EAAO,GACPe,EAAI,KACJC,EAAI,EACJC,EAAIL,EAAEX,OACNiB,EAAI,GAKR,SAASC,IACPnB,EAAKmB,KAAKD,EAAIN,EAAEQ,UAAUb,EAAGM,IAC7BK,EAAI,GACJX,EAAIM,EAAI,EAGV,IARAD,GAAQ,GAQHL,EAAEM,EAAE,EAAGA,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AlB6rC,EAAS7rC,KACP,GACA,CAAC6rC,SAAUA,EAAS7rC,MACtB,CAAC6rC,SAAAA,IACFuD,GAA0B1lB,IAC1B0lB,GAA0B2zC,IA9D3BwB,CAAsBxB,EAAW7vE,EAAK24B,SAAUniB,EAAQmqB,GACxDkvC,EAAUS,SACVT,EAAUU,UAKVe,WAAYtxE,WAIVxX,EAAIunF,SpK3DV9lE,GAAUJ,IoK+DJrhB,EAAIy0B,YxJ0sBVO,GAAkBR","file":"build/vega-lite.min.js.map","sourcesContent":["export default function(fn, fields, name) {\n fn.fields = fields || [];\n fn.fname = name;\n return fn;\n}\n\nexport function accessorName(fn) {\n return fn == null ? null : fn.fname;\n}\n\nexport function accessorFields(fn) {\n return fn == null ? null : fn.fields;\n}\n","export default function(path) {\n return path.length === 1 ? get1(path[0]) : getN(path);\n}\n\nconst get1 = field => function(obj) {\n return obj[field];\n};\n\nconst getN = path => {\n const len = path.length;\n return function(obj) {\n for (let i = 0; i < len; ++i) {\n obj = obj[path[i]];\n }\n return obj;\n };\n};\n\n","export default function(message) {\n throw Error(message);\n}\n","import error from './error';\n\nexport default function(p) {\n var path = [],\n q = null,\n b = 0,\n n = p.length,\n s = '',\n i, j, c;\n\n p = p + '';\n\n function push() {\n path.push(s + p.substring(i, j));\n s = '';\n i = j + 1;\n }\n\n for (i=j=0; j i) {\n push();\n } else {\n i = j + 1;\n }\n } else if (c === '[') {\n if (j > i) push();\n b = i = j + 1;\n } else if (c === ']') {\n if (!b) error('Access path missing open bracket: ' + p);\n if (b > 0) push();\n b = 0;\n i = j + 1;\n }\n }\n\n if (b) error('Access path missing closing bracket: ' + p);\n if (q) error('Access path missing closing quote: ' + p);\n\n if (j > i) {\n j++;\n push();\n }\n\n return path;\n}\n","import accessor from './accessor';\nimport field from './field';\n\nvar empty = [];\n\nexport var id = field('id');\n\nexport var identity = accessor(function(_) { return _; }, empty, 'identity');\n\nexport var zero = accessor(function() { return 0; }, empty, 'zero');\n\nexport var one = accessor(function() { return 1; }, empty, 'one');\n\nexport var truthy = accessor(function() { return true; }, empty, 'true');\n\nexport var falsy = accessor(function() { return false; }, empty, 'false');\n","import accessor from './accessor';\nimport getter from './getter';\nimport splitAccessPath from './splitAccessPath';\n\nexport default function(field, name, opt) {\n const path = splitAccessPath(field);\n field = path.length === 1 ? path[0] : field;\n return accessor(\n (opt && opt.get || getter)(path),\n [field],\n name || field\n );\n}\n","function log(method, level, input) {\n var args = [level].concat([].slice.call(input));\n console[method].apply(console, args); // eslint-disable-line no-console\n}\n\nexport var None = 0;\nexport var Error = 1;\nexport var Warn = 2;\nexport var Info = 3;\nexport var Debug = 4;\n\nexport default function(_, method) {\n var level = _ || None;\n return {\n level: function(_) {\n if (arguments.length) {\n level = +_;\n return this;\n } else {\n return level;\n }\n },\n error: function() {\n if (level >= Error) log(method || 'error', 'ERROR', arguments);\n return this;\n },\n warn: function() {\n if (level >= Warn) log(method || 'warn', 'WARN', arguments);\n return this;\n },\n info: function() {\n if (level >= Info) log(method || 'log', 'INFO', arguments);\n return this;\n },\n debug: function() {\n if (level >= Debug) log(method || 'log', 'DEBUG', arguments);\n return this;\n }\n };\n}\n","export default Array.isArray;\n","export default function(_) {\n return _ === Object(_);\n}\n","import isArray from './isArray';\nimport isObject from './isObject';\n\nconst isLegalKey = key => key !== '__proto__';\n\nexport function mergeConfig(...configs) {\n return configs.reduce((out, source) => {\n for (var key in source) {\n if (key === 'signals') {\n // for signals, we merge the signals arrays\n // source signals take precedence over\n // existing signals with the same name\n out.signals = mergeNamed(out.signals, source.signals);\n } else {\n // otherwise, merge objects subject to recursion constraints\n // for legend block, recurse for the layout entry only\n // for style block, recurse for all properties\n // otherwise, no recursion: objects overwrite, no merging\n var r = key === 'legend' ? {layout: 1}\n : key === 'style' ? true\n : null;\n writeConfig(out, key, source[key], r);\n }\n }\n return out;\n }, {});\n}\n\nexport function writeConfig(output, key, value, recurse) {\n if (!isLegalKey(key)) return;\n\n var k, o;\n if (isObject(value) && !isArray(value)) {\n o = isObject(output[key]) ? output[key] : (output[key] = {});\n for (k in value) {\n if (recurse && (recurse === true || recurse[k])) {\n writeConfig(o, k, value[k]);\n } else if (isLegalKey(k)) {\n o[k] = value[k];\n }\n }\n } else {\n output[key] = value;\n }\n}\n\nfunction mergeNamed(a, b) {\n if (a == null) return b;\n\n const map = {}, out = [];\n\n function add(_) {\n if (!map[_.name]) {\n map[_.name] = 1;\n out.push(_);\n }\n }\n\n b.forEach(add);\n a.forEach(add);\n return out;\n}\n","import isArray from './isArray';\n\nexport default function(_) {\n return _ != null ? (isArray(_) ? _ : [_]) : [];\n}\n","const hop = Object.prototype.hasOwnProperty;\n\nexport default function(object, property) {\n return hop.call(object, property);\n}\n","export default function(_) {\n return typeof _ === 'boolean';\n}\n","export default function(_) {\n return typeof _ === 'number';\n}\n","export default function(_) {\n return typeof _ === 'string';\n}\n","import isArray from './isArray';\nimport isObject from './isObject';\nimport isString from './isString';\n\nexport default function $(x) {\n return isArray(x) ? '[' + x.map($) + ']'\n : isObject(x) || isString(x) ?\n // Output valid JSON and JS source strings.\n // See http://timelessrepo.com/json-isnt-a-javascript-subset\n JSON.stringify(x).replace('\\u2028','\\\\u2028').replace('\\u2029', '\\\\u2029')\n : x;\n}\n","export default function(_) {\n for (var s={}, i=0, n=_.length; i= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","Array.prototype.flat||Object.defineProperty(Array.prototype,\"flat\",{configurable:!0,value:function r(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,function(a,e){return Array.isArray(e)?a.push.apply(a,r.call(e,t-1)):a.push(e),a},[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,\"flatMap\",{configurable:!0,value:function(r){return Array.prototype.map.apply(this,arguments).flat()},writable:!0})\n","var clone = (function() {\n'use strict';\n\nfunction _instanceof(obj, type) {\n return type != null && obj instanceof type;\n}\n\nvar nativeMap;\ntry {\n nativeMap = Map;\n} catch(_) {\n // maybe a reference error because no `Map`. Give it a dummy value that no\n // value will ever be an instanceof.\n nativeMap = function() {};\n}\n\nvar nativeSet;\ntry {\n nativeSet = Set;\n} catch(_) {\n nativeSet = function() {};\n}\n\nvar nativePromise;\ntry {\n nativePromise = Promise;\n} catch(_) {\n nativePromise = function() {};\n}\n\n/**\n * Clones (copies) an Object using deep copying.\n *\n * This function supports circular references by default, but if you are certain\n * there are no circular references in your object, you can save some CPU time\n * by calling clone(obj, false).\n *\n * Caution: if `circular` is false and `parent` contains circular references,\n * your program may enter an infinite loop and crash.\n *\n * @param `parent` - the object to be cloned\n * @param `circular` - set to true if the object to be cloned may contain\n * circular references. (optional - true by default)\n * @param `depth` - set to a number if the object is only to be cloned to\n * a particular depth. (optional - defaults to Infinity)\n * @param `prototype` - sets the prototype to be used when cloning an object.\n * (optional - defaults to parent prototype).\n * @param `includeNonEnumerable` - set to true if the non-enumerable properties\n * should be cloned as well. Non-enumerable properties on the prototype\n * chain will be ignored. (optional - false by default)\n*/\nfunction clone(parent, circular, depth, prototype, includeNonEnumerable) {\n if (typeof circular === 'object') {\n depth = circular.depth;\n prototype = circular.prototype;\n includeNonEnumerable = circular.includeNonEnumerable;\n circular = circular.circular;\n }\n // maintain two arrays for circular references, where corresponding parents\n // and children have the same index\n var allParents = [];\n var allChildren = [];\n\n var useBuffer = typeof Buffer != 'undefined';\n\n if (typeof circular == 'undefined')\n circular = true;\n\n if (typeof depth == 'undefined')\n depth = Infinity;\n\n // recurse this function so we don't reset allParents and allChildren\n function _clone(parent, depth) {\n // cloning null always returns null\n if (parent === null)\n return null;\n\n if (depth === 0)\n return parent;\n\n var child;\n var proto;\n if (typeof parent != 'object') {\n return parent;\n }\n\n if (_instanceof(parent, nativeMap)) {\n child = new nativeMap();\n } else if (_instanceof(parent, nativeSet)) {\n child = new nativeSet();\n } else if (_instanceof(parent, nativePromise)) {\n child = new nativePromise(function (resolve, reject) {\n parent.then(function(value) {\n resolve(_clone(value, depth - 1));\n }, function(err) {\n reject(_clone(err, depth - 1));\n });\n });\n } else if (clone.__isArray(parent)) {\n child = [];\n } else if (clone.__isRegExp(parent)) {\n child = new RegExp(parent.source, __getRegExpFlags(parent));\n if (parent.lastIndex) child.lastIndex = parent.lastIndex;\n } else if (clone.__isDate(parent)) {\n child = new Date(parent.getTime());\n } else if (useBuffer && Buffer.isBuffer(parent)) {\n if (Buffer.allocUnsafe) {\n // Node.js >= 4.5.0\n child = Buffer.allocUnsafe(parent.length);\n } else {\n // Older Node.js versions\n child = new Buffer(parent.length);\n }\n parent.copy(child);\n return child;\n } else if (_instanceof(parent, Error)) {\n child = Object.create(parent);\n } else {\n if (typeof prototype == 'undefined') {\n proto = Object.getPrototypeOf(parent);\n child = Object.create(proto);\n }\n else {\n child = Object.create(prototype);\n proto = prototype;\n }\n }\n\n if (circular) {\n var index = allParents.indexOf(parent);\n\n if (index != -1) {\n return allChildren[index];\n }\n allParents.push(parent);\n allChildren.push(child);\n }\n\n if (_instanceof(parent, nativeMap)) {\n parent.forEach(function(value, key) {\n var keyChild = _clone(key, depth - 1);\n var valueChild = _clone(value, depth - 1);\n child.set(keyChild, valueChild);\n });\n }\n if (_instanceof(parent, nativeSet)) {\n parent.forEach(function(value) {\n var entryChild = _clone(value, depth - 1);\n child.add(entryChild);\n });\n }\n\n for (var i in parent) {\n var attrs;\n if (proto) {\n attrs = Object.getOwnPropertyDescriptor(proto, i);\n }\n\n if (attrs && attrs.set == null) {\n continue;\n }\n child[i] = _clone(parent[i], depth - 1);\n }\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(parent);\n for (var i = 0; i < symbols.length; i++) {\n // Don't need to worry about cloning a symbol because it is a primitive,\n // like a number or string.\n var symbol = symbols[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);\n if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {\n continue;\n }\n child[symbol] = _clone(parent[symbol], depth - 1);\n if (!descriptor.enumerable) {\n Object.defineProperty(child, symbol, {\n enumerable: false\n });\n }\n }\n }\n\n if (includeNonEnumerable) {\n var allPropertyNames = Object.getOwnPropertyNames(parent);\n for (var i = 0; i < allPropertyNames.length; i++) {\n var propertyName = allPropertyNames[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);\n if (descriptor && descriptor.enumerable) {\n continue;\n }\n child[propertyName] = _clone(parent[propertyName], depth - 1);\n Object.defineProperty(child, propertyName, {\n enumerable: false\n });\n }\n }\n\n return child;\n }\n\n return _clone(parent, depth);\n}\n\n/**\n * Simple flat clone using prototype, accepts only objects, usefull for property\n * override on FLAT configuration object (no nested props).\n *\n * USE WITH CAUTION! This may not behave as you wish if you do not know how this\n * works.\n */\nclone.clonePrototype = function clonePrototype(parent) {\n if (parent === null)\n return null;\n\n var c = function () {};\n c.prototype = parent;\n return new c();\n};\n\n// private utility functions\n\nfunction __objToStr(o) {\n return Object.prototype.toString.call(o);\n}\nclone.__objToStr = __objToStr;\n\nfunction __isDate(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Date]';\n}\nclone.__isDate = __isDate;\n\nfunction __isArray(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Array]';\n}\nclone.__isArray = __isArray;\n\nfunction __isRegExp(o) {\n return typeof o === 'object' && __objToStr(o) === '[object RegExp]';\n}\nclone.__isRegExp = __isRegExp;\n\nfunction __getRegExpFlags(re) {\n var flags = '';\n if (re.global) flags += 'g';\n if (re.ignoreCase) flags += 'i';\n if (re.multiline) flags += 'm';\n return flags;\n}\nclone.__getRegExpFlags = __getRegExpFlags;\n\nreturn clone;\n})();\n\nif (typeof module === 'object' && module.exports) {\n module.exports = clone;\n}\n","'use strict';\n\nmodule.exports = function (data, opts) {\n if (!opts) opts = {};\n if (typeof opts === 'function') opts = { cmp: opts };\n var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;\n\n var cmp = opts.cmp && (function (f) {\n return function (node) {\n return function (a, b) {\n var aobj = { key: a, value: node[a] };\n var bobj = { key: b, value: node[b] };\n return f(aobj, bobj);\n };\n };\n })(opts.cmp);\n\n var seen = [];\n return (function stringify (node) {\n if (node && node.toJSON && typeof node.toJSON === 'function') {\n node = node.toJSON();\n }\n\n if (node === undefined) return;\n if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';\n if (typeof node !== 'object') return JSON.stringify(node);\n\n var i, out;\n if (Array.isArray(node)) {\n out = '[';\n for (i = 0; i < node.length; i++) {\n if (i) out += ',';\n out += stringify(node[i]) || 'null';\n }\n return out + ']';\n }\n\n if (node === null) return 'null';\n\n if (seen.indexOf(node) !== -1) {\n if (cycles) return JSON.stringify('__cycle__');\n throw new TypeError('Converting circular structure to JSON');\n }\n\n var seenIndex = seen.push(node) - 1;\n var keys = Object.keys(node).sort(cmp && cmp(node));\n out = '';\n for (i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = stringify(node[key]);\n\n if (!value) continue;\n if (out) out += ',';\n out += JSON.stringify(key) + ':' + value;\n }\n seen.splice(seenIndex, 1);\n return '{' + out + '}';\n })(data);\n};\n","export type LogicalComposition = LogicalNot | LogicalAnd | LogicalOr | T;\n\nexport interface LogicalOr {\n or: LogicalComposition[];\n}\n\nexport interface LogicalAnd {\n and: LogicalComposition[];\n}\n\nexport interface LogicalNot {\n not: LogicalComposition;\n}\n\nexport function isLogicalOr(op: LogicalComposition): op is LogicalOr {\n return !!op.or;\n}\n\nexport function isLogicalAnd(op: LogicalComposition): op is LogicalAnd {\n return !!op.and;\n}\n\nexport function isLogicalNot(op: LogicalComposition): op is LogicalNot {\n return !!op.not;\n}\n\nexport function forEachLeaf(op: LogicalComposition, fn: (op: T) => void) {\n if (isLogicalNot(op)) {\n forEachLeaf(op.not, fn);\n } else if (isLogicalAnd(op)) {\n for (const subop of op.and) {\n forEachLeaf(subop, fn);\n }\n } else if (isLogicalOr(op)) {\n for (const subop of op.or) {\n forEachLeaf(subop, fn);\n }\n } else {\n fn(op);\n }\n}\n\nexport function normalizeLogicalComposition(\n op: LogicalComposition,\n normalizer: (o: T) => T\n): LogicalComposition {\n if (isLogicalNot(op)) {\n return {not: normalizeLogicalComposition(op.not, normalizer)};\n } else if (isLogicalAnd(op)) {\n return {and: op.and.map(o => normalizeLogicalComposition(o, normalizer))};\n } else if (isLogicalOr(op)) {\n return {or: op.or.map(o => normalizeLogicalComposition(o, normalizer))};\n } else {\n return normalizer(op);\n }\n}\n","import 'array-flat-polyfill';\nimport {default as clone_} from 'clone';\nimport deepEqual_ from 'fast-deep-equal';\nimport stableStringify from 'fast-json-stable-stringify';\nimport {hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig} from 'vega-util';\nimport {isLogicalAnd, isLogicalNot, isLogicalOr, LogicalComposition} from './logical';\n\nexport const deepEqual = deepEqual_;\nexport const duplicate = clone_;\n\n/**\n * Creates an object composed of the picked object properties.\n *\n * var object = {'a': 1, 'b': '2', 'c': 3};\n * pick(object, ['a', 'c']);\n * // → {'a': 1, 'c': 3}\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function pick(obj: T, props: readonly K[]): Pick {\n const copy: any = {};\n for (const prop of props) {\n if (hasOwnProperty(obj, prop)) {\n copy[prop] = obj[prop];\n }\n }\n return copy;\n}\n\n/**\n * The opposite of _.pick; this method creates an object composed of the own\n * and inherited enumerable string keyed properties of object that are not omitted.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function omit(obj: T, props: readonly K[]): Omit {\n const copy = {...(obj as any)};\n for (const prop of props) {\n delete copy[prop];\n }\n return copy;\n}\n\n/**\n * Monkey patch Set so that `stringify` produces a string representation of sets.\n */\nSet.prototype['toJSON'] = function () {\n return `Set(${[...this].map(x => stableStringify(x)).join(',')})`;\n};\n\n/**\n * Converts any object to a string representation that can be consumed by humans.\n */\nexport const stringify = stableStringify;\n\n/**\n * Converts any object to a string of limited size, or a number.\n */\nexport function hash(a: any): string | number {\n if (isNumber(a)) {\n return a;\n }\n\n const str = isString(a) ? a : stableStringify(a);\n\n // short strings can be used as hash directly, longer strings are hashed to reduce memory usage\n if (str.length < 250) {\n return str;\n }\n\n // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n let h = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n h = (h << 5) - h + char;\n h = h & h; // Convert to 32bit integer\n }\n return h;\n}\n\nexport function isNullOrFalse(x: any): x is false | null {\n return x === false || x === null;\n}\n\nexport function contains(array: readonly T[], item: T) {\n return array.indexOf(item) > -1;\n}\n\n/**\n * Returns true if any item returns true.\n */\nexport function some(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (f(a, k, i++)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Returns true if all items return true.\n */\nexport function every(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (!f(a, k, i++)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Like TS Partial but applies recursively to all properties.\n */\nexport type DeepPartial = {[P in keyof T]?: DeepPartial};\n\n/**\n * recursively merges src into dest\n */\nexport function mergeDeep(dest: T, ...src: readonly DeepPartial[]): T {\n for (const s of src) {\n deepMerge_(dest, s ?? {});\n }\n return dest;\n}\n\nfunction deepMerge_(dest: any, src: any) {\n for (const property of keys(src)) {\n writeConfig(dest, property, src[property], true);\n }\n}\n\nexport function unique(values: readonly T[], f: (item: T) => string | number): T[] {\n const results: T[] = [];\n const u = {};\n let v: string | number;\n for (const val of values) {\n v = f(val);\n if (v in u) {\n continue;\n }\n u[v] = 1;\n results.push(val);\n }\n return results;\n}\n\nexport type Dict = Record;\n\n/**\n * Returns true if the two dictionaries disagree. Applies only to defined values.\n */\nexport function isEqual(dict: Dict, other: Dict) {\n const dictKeys = keys(dict);\n const otherKeys = keys(other);\n if (dictKeys.length !== otherKeys.length) {\n return false;\n }\n for (const key of dictKeys) {\n if (dict[key] !== other[key]) {\n return false;\n }\n }\n return true;\n}\n\nexport function setEqual(a: Set, b: Set) {\n if (a.size !== b.size) {\n return false;\n }\n for (const e of a) {\n if (!b.has(e)) {\n return false;\n }\n }\n return true;\n}\n\nexport function hasIntersection(a: ReadonlySet, b: ReadonlySet) {\n for (const key of a) {\n if (b.has(key)) {\n return true;\n }\n }\n return false;\n}\n\nexport function prefixGenerator(a: ReadonlySet): ReadonlySet {\n const prefixes = new Set();\n for (const x of a) {\n const splitField = splitAccessPath(x);\n // Wrap every element other than the first in `[]`\n const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`));\n const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join(''));\n for (const y of computedPrefixes) {\n prefixes.add(y);\n }\n }\n return prefixes;\n}\n\n/**\n * Returns true if a and b have an intersection. Also return true if a or b are undefined\n * since this means we don't know what fields a node produces or depends on.\n */\nexport function fieldIntersection(a: ReadonlySet, b: ReadonlySet): boolean {\n if (a === undefined || b === undefined) {\n return true;\n }\n return hasIntersection(prefixGenerator(a), prefixGenerator(b));\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isEmpty(obj: object) {\n return keys(obj).length === 0;\n}\n\n// This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208\nexport const keys = Object.keys as (o: T) => Extract[];\n\nexport const vals = Object.values;\n\nexport function entries(x: {[key: string]: T}): {key: string; value: T}[] {\n const _entries: {key: string; value: T}[] = [];\n for (const k in x) {\n if (hasOwnProperty(x, k)) {\n _entries.push({\n key: k,\n value: x[k]\n });\n }\n }\n return _entries;\n}\n\n// Using mapped type to declare a collect of flags for a string literal type S\n// https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types\nexport type Flag = {[K in S]: 1};\n\nexport function isBoolean(b: any): b is boolean {\n return b === true || b === false;\n}\n\n/**\n * Convert a string into a valid variable name\n */\nexport function varName(s: string): string {\n // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _\n const alphanumericS = s.replace(/\\W/g, '_');\n\n // Add _ if the string has leading numbers.\n return (s.match(/^\\d+/) ? '_' : '') + alphanumericS;\n}\n\nexport function logicalExpr(op: LogicalComposition, cb: (...args: readonly any[]) => string): string {\n if (isLogicalNot(op)) {\n return '!(' + logicalExpr(op.not, cb) + ')';\n } else if (isLogicalAnd(op)) {\n return '(' + op.and.map((and: LogicalComposition) => logicalExpr(and, cb)).join(') && (') + ')';\n } else if (isLogicalOr(op)) {\n return '(' + op.or.map((or: LogicalComposition) => logicalExpr(or, cb)).join(') || (') + ')';\n } else {\n return cb(op);\n }\n}\n\n/**\n * Delete nested property of an object, and delete the ancestors of the property if they become empty.\n */\nexport function deleteNestedProperty(obj: any, orderedProps: string[]) {\n if (orderedProps.length === 0) {\n return true;\n }\n const prop = orderedProps.shift()!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) {\n delete obj[prop];\n }\n return isEmpty(obj);\n}\n\nexport function titleCase(s: string) {\n return s.charAt(0).toUpperCase() + s.substr(1);\n}\n\n/**\n * Converts a path to an access path with datum.\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function accessPathWithDatum(path: string, datum = 'datum') {\n const pieces = splitAccessPath(path);\n const prefixes = [];\n for (let i = 1; i <= pieces.length; i++) {\n const prefix = `[${pieces.slice(0, i).map(stringValue).join('][')}]`;\n prefixes.push(`${datum}${prefix}`);\n }\n return prefixes.join(' && ');\n}\n\n/**\n * Return access with datum to the flattened field.\n *\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function flatAccessWithDatum(path: string, datum: 'datum' | 'parent' | 'datum.datum' = 'datum') {\n return `${datum}[${stringValue(splitAccessPath(path).join('.'))}]`;\n}\n\nfunction escapePathAccess(string: string) {\n return string.replace(/(\\[|\\]|\\.|'|\")/g, '\\\\$1');\n}\n\n/**\n * Replaces path accesses with access to non-nested field.\n * For example, `foo[\"bar\"].baz` becomes `foo\\\\.bar\\\\.baz`.\n */\nexport function replacePathInField(path: string) {\n return `${splitAccessPath(path).map(escapePathAccess).join('\\\\.')}`;\n}\n\n/**\n * Replace all occurrences of a string with another string.\n *\n * @param string the string to replace in\n * @param find the string to replace\n * @param replacement the replacement\n */\nexport function replaceAll(string: string, find: string, replacement: string) {\n return string.replace(new RegExp(find.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'g'), replacement);\n}\n\n/**\n * Remove path accesses with access from field.\n * For example, `foo[\"bar\"].baz` becomes `foo.bar.baz`.\n */\nexport function removePathFromField(path: string) {\n return `${splitAccessPath(path).join('.')}`;\n}\n\n/**\n * Count the depth of the path. Returns 1 for fields that are not nested.\n */\nexport function accessPathDepth(path: string) {\n if (!path) {\n return 0;\n }\n return splitAccessPath(path).length;\n}\n\n/**\n * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included.\n */\nexport function getFirstDefined(...args: readonly T[]): T | undefined {\n for (const arg of args) {\n if (arg !== undefined) {\n return arg;\n }\n }\n return undefined;\n}\n\n// variable used to generate id\nlet idCounter = 42;\n\n/**\n * Returns a new random id every time it gets called.\n *\n * Has side effect!\n */\nexport function uniqueId(prefix?: string) {\n const id = ++idCounter;\n return prefix ? String(prefix) + id : id;\n}\n\n/**\n * Resets the id counter used in uniqueId. This can be useful for testing.\n */\nexport function resetIdCounter() {\n idCounter = 42;\n}\n\nexport function internalField(name: string) {\n return isInternalField(name) ? name : `__${name}`;\n}\n\nexport function isInternalField(name: string) {\n return name.indexOf('__') === 0;\n}\n\n/**\n * Normalize angle to be within [0,360).\n */\nexport function normalizeAngle(angle: number) {\n if (angle === undefined) {\n return undefined;\n }\n return ((angle % 360) + 360) % 360;\n}\n\n/**\n * Returns whether the passed in value is a valid number.\n */\nexport function isNumeric(value: number | string): boolean {\n if (isNumber(value)) {\n return true;\n }\n return !isNaN(value as any) && !isNaN(parseFloat(value));\n}\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","import {\n Align,\n Axis as VgAxis,\n AxisEncode,\n AxisOrient,\n BaseAxis,\n Color,\n FontStyle,\n FontWeight,\n LabelOverlap,\n SignalRef,\n TextBaseline,\n TimeInterval,\n TimeIntervalStep\n} from 'vega';\nimport {ConditionalPredicate, Value, ValueDef} from './channeldef';\nimport {DateTime} from './datetime';\nimport {Guide, GuideEncodingEntry, TitleMixins, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\nimport {ExcludeMappedValueRefButKeepSignal, VgEncodeChannel} from './vega.schema';\n\nexport type BaseAxisNoValueRefs = AxisOverrideMixins & VLOnlyAxisMixins & ExcludeMappedValueRefButKeepSignal;\n\ninterface AxisOverrideMixins {\n // Position and tickMinStep are not config in Vega, but are in Vega-Lite. So we just copy them here.\n\n /**\n * The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate.\n *\n * __Default value__: `0`\n */\n position?: number | SignalRef;\n\n /**\n * The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.\n */\n tickMinStep?: number | SignalRef;\n\n // Override comments to be Vega-Lite specific\n /**\n * A boolean flag indicating if grid lines should be included as part of the axis\n *\n * __Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`.\n */\n grid?: boolean;\n\n /**\n * Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.\n *\n * __Default value:__ `true` for axis of a continuous x-scale. Otherwise, `false`.\n */\n labelFlush?: boolean | number;\n\n /**\n * The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `\"greedy\"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).\n *\n * __Default value:__ `true` for non-nominal fields with non-log scales; `\"greedy\"` for log scales; otherwise `false`.\n */\n labelOverlap?: LabelOverlap;\n\n /**\n * The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n *\n * __Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)\n */\n offset?: number;\n\n /**\n * The orientation of the axis. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart).\n *\n * __Default value:__ `\"bottom\"` for x-axes and `\"left\"` for y-axes.\n */\n orient?: AxisOrient | SignalRef;\n\n /**\n * A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are \"nice\" (multiples of 2, 5, 10) and lie within the underlying scale's range.\n *\n * For scales of type `\"time\"` or `\"utc\"`, the tick count can instead be a time interval specifier. Legal string values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and \"year\". Alternatively, an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary.\n *\n * __Default value__: Determine using a formula `ceil(width/40)` for x and `ceil(height/40)` for y.\n *\n * @minimum 0\n */\n tickCount?: number | TimeInterval | TimeIntervalStep | SignalRef;\n\n /**\n * Explicitly set the visible axis tick values.\n */\n values?: number[] | string[] | boolean[] | DateTime[] | SignalRef; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega.\n\n /**\n * A non-negative integer indicating the z-index of the axis.\n * If zindex is 0, axes should be drawn behind all chart elements.\n * To put them in front, set `zindex` to `1` or more.\n *\n * __Default value:__ `0` (behind the marks).\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n}\n\ninterface VLOnlyAxisMixins {\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n *\n * __Default value:__ (none)\n * __Note:__ Any specified style will augment the default style. For example, an x-axis mark with `\"style\": \"foo\"` will use `config.axisX` and `config.style.foo` (the specified style `\"foo\"` has higher precedence).\n */\n style?: string | string[];\n}\n\nexport type SignalAxisProp =\n | 'domainColor'\n | 'labelAlign'\n | 'labelColor'\n | 'gridColor'\n | 'tickColor'\n | 'titleColor'\n | 'title';\n\nexport type ConditionalAxisProp =\n | 'labelAlign'\n | 'labelBaseline'\n | 'labelColor'\n | 'labelFont'\n | 'labelFontSize'\n | 'labelFontStyle'\n | 'labelFontWeight'\n | 'labelOpacity'\n | 'labelOffset'\n | 'labelPadding'\n | 'gridColor'\n | 'gridDash'\n | 'gridDashOffset'\n | 'gridOpacity'\n | 'gridWidth'\n | 'tickColor'\n | 'tickDash'\n | 'tickDashOffset'\n | 'tickOpacity'\n | 'tickSize'\n | 'tickWidth';\n\nexport const CONDITIONAL_AXIS_PROP_INDEX: Record<\n ConditionalAxisProp | SignalAxisProp,\n {\n part: keyof AxisEncode;\n vgProp: VgEncodeChannel;\n } | null // null if we need to convert condition to signal\n> = {\n domainColor: {\n part: 'domain',\n vgProp: 'stroke'\n },\n labelAlign: {\n part: 'labels',\n vgProp: 'align'\n },\n labelBaseline: {\n part: 'labels',\n vgProp: 'baseline'\n },\n labelColor: {\n part: 'labels',\n vgProp: 'fill'\n },\n labelFont: {\n part: 'labels',\n vgProp: 'font'\n },\n labelFontSize: {\n part: 'labels',\n vgProp: 'fontSize'\n },\n labelFontStyle: {\n part: 'labels',\n vgProp: 'fontStyle'\n },\n labelFontWeight: {\n part: 'labels',\n vgProp: 'fontWeight'\n },\n labelOpacity: {\n part: 'labels',\n vgProp: 'opacity'\n },\n labelOffset: null,\n labelPadding: null, // There is no fixed vgProp for tickSize, need to use signal.\n gridColor: {\n part: 'grid',\n vgProp: 'stroke'\n },\n gridDash: {\n part: 'grid',\n vgProp: 'strokeDash'\n },\n gridDashOffset: {\n part: 'grid',\n vgProp: 'strokeDashOffset'\n },\n gridOpacity: {\n part: 'grid',\n vgProp: 'opacity'\n },\n gridWidth: {\n part: 'grid',\n vgProp: 'strokeWidth'\n },\n tickColor: {\n part: 'ticks',\n vgProp: 'stroke'\n },\n tickDash: {\n part: 'ticks',\n vgProp: 'strokeDash'\n },\n tickDashOffset: {\n part: 'ticks',\n vgProp: 'strokeDashOffset'\n },\n tickOpacity: {\n part: 'ticks',\n vgProp: 'opacity'\n },\n tickSize: null, // There is no fixed vgProp for tickSize, need to use signal.\n tickWidth: {\n part: 'ticks',\n vgProp: 'strokeWidth'\n },\n titleColor: {\n part: 'title',\n vgProp: 'fill'\n },\n title: null // title supports signal, let's use it.\n};\n\nexport type ConditionalAxisProperty = (ValueDef | SignalRef) & {\n condition: ConditionalPredicate | SignalRef> | ConditionalPredicate | SignalRef>[];\n};\n\nexport function isConditionalAxisValue(v: any): v is ConditionalAxisProperty {\n return v && v['condition'];\n}\n\nexport type ConditionalAxisNumber = ConditionalAxisProperty;\nexport type ConditionalAxisLabelAlign = ConditionalAxisProperty;\nexport type ConditionalAxisLabelBaseline = ConditionalAxisProperty;\nexport type ConditionalAxisColor = ConditionalAxisProperty;\nexport type ConditionalAxisString = ConditionalAxisProperty;\n\nexport type ConditionalAxisLabelFontStyle = ConditionalAxisProperty;\nexport type ConditionalAxisLabelFontWeight = ConditionalAxisProperty;\n\nexport type ConditionalAxisNumberArray = ConditionalAxisProperty;\n\n// Vega axis config is the same as Vega axis base. If this is not the case, add specific type.\nexport type AxisConfigBaseWithConditionalAndSignal = Omit &\n AxisPropsWithConditionAndSignal;\n\nexport interface AxisPropsWithConditionAndSignal {\n domainColor?: BaseAxisNoValueRefs['domainColor'] | SignalRef;\n labelAlign?: BaseAxisNoValueRefs['labelAlign'] | ConditionalAxisLabelAlign;\n labelBaseline?: BaseAxisNoValueRefs['labelBaseline'] | ConditionalAxisLabelBaseline;\n labelColor?: BaseAxisNoValueRefs['labelColor'] | ConditionalAxisColor | SignalRef;\n labelFont?: BaseAxisNoValueRefs['labelFont'] | ConditionalAxisString;\n labelFontSize?: BaseAxisNoValueRefs['labelFontSize'] | ConditionalAxisNumber;\n labelFontStyle?: BaseAxisNoValueRefs['labelFontStyle'] | ConditionalAxisLabelFontStyle;\n labelFontWeight?: BaseAxisNoValueRefs['labelFontWeight'] | ConditionalAxisLabelFontWeight;\n labelLineHeight?: BaseAxisNoValueRefs['labelLineHeight'] | ConditionalAxisNumber | SignalRef;\n labelOpacity?: BaseAxisNoValueRefs['labelOpacity'] | ConditionalAxisNumber;\n labelOffset?: BaseAxisNoValueRefs['labelOffset'] | ConditionalAxisNumber | SignalRef;\n labelPadding?: BaseAxisNoValueRefs['labelPadding'] | ConditionalAxisNumber;\n gridColor?: BaseAxisNoValueRefs['gridColor'] | ConditionalAxisColor | SignalRef;\n gridDash?: BaseAxisNoValueRefs['gridDash'] | ConditionalAxisNumberArray;\n gridDashOffset?: BaseAxisNoValueRefs['gridDashOffset'] | ConditionalAxisNumber;\n gridOpacity?: BaseAxisNoValueRefs['gridOpacity'] | ConditionalAxisNumber;\n gridWidth?: BaseAxisNoValueRefs['gridWidth'] | ConditionalAxisNumber;\n tickColor?: BaseAxisNoValueRefs['tickColor'] | ConditionalAxisColor | SignalRef;\n tickDash?: BaseAxisNoValueRefs['tickDash'] | ConditionalAxisNumberArray;\n tickDashOffset?: BaseAxisNoValueRefs['tickDashOffset'] | ConditionalAxisNumber;\n tickOpacity?: BaseAxisNoValueRefs['tickOpacity'] | ConditionalAxisNumber;\n tickSize?: BaseAxisNoValueRefs['tickSize'] | ConditionalAxisNumber;\n tickWidth?: BaseAxisNoValueRefs['tickWidth'] | ConditionalAxisNumber;\n titleColor?: BaseAxisNoValueRefs['titleColor'] | SignalRef;\n title?: TitleMixins['title'];\n}\n\nexport type AxisConfig = Guide &\n VlOnlyGuideConfig &\n AxisConfigBaseWithConditionalAndSignal & {\n /**\n * Disable axis by default.\n */\n disable?: boolean;\n };\n\nexport interface Axis extends AxisConfigBaseWithConditionalAndSignal, Guide {\n /**\n * Mark definitions for custom axis encoding.\n *\n * @hidden\n */\n encoding?: AxisEncoding;\n}\n\nexport type AxisPart = keyof AxisEncoding;\nexport const AXIS_PARTS: AxisPart[] = ['domain', 'grid', 'labels', 'ticks', 'title'];\n\n/**\n * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes.\n */\nexport const AXIS_PROPERTY_TYPE: Record = {\n grid: 'grid',\n gridCap: 'grid',\n gridColor: 'grid',\n gridDash: 'grid',\n gridDashOffset: 'grid',\n gridOpacity: 'grid',\n gridScale: 'grid',\n gridWidth: 'grid',\n\n orient: 'main',\n\n bandPosition: 'both', // Need to be applied to grid axis too, so the grid will align with ticks.\n\n aria: 'main',\n description: 'main',\n domain: 'main',\n domainCap: 'main',\n domainColor: 'main',\n domainDash: 'main',\n domainDashOffset: 'main',\n domainOpacity: 'main',\n domainWidth: 'main',\n format: 'main',\n formatType: 'main',\n labelAlign: 'main',\n labelAngle: 'main',\n labelBaseline: 'main',\n labelBound: 'main',\n labelColor: 'main',\n labelFlush: 'main',\n labelFlushOffset: 'main',\n labelFont: 'main',\n labelFontSize: 'main',\n labelFontStyle: 'main',\n labelFontWeight: 'main',\n labelLimit: 'main',\n labelLineHeight: 'main',\n labelOffset: 'main',\n labelOpacity: 'main',\n labelOverlap: 'main',\n labelPadding: 'main',\n labels: 'main',\n labelSeparation: 'main',\n maxExtent: 'main',\n minExtent: 'main',\n offset: 'both',\n position: 'main',\n tickCap: 'main',\n tickColor: 'main',\n tickDash: 'main',\n tickDashOffset: 'main',\n tickMinStep: 'main',\n tickOffset: 'both', // Need to be applied to grid axis too, so the grid will align with ticks.\n tickOpacity: 'main',\n tickRound: 'both', // Apply rounding to grid and ticks so they are aligned.\n ticks: 'main',\n tickSize: 'main',\n tickWidth: 'both',\n title: 'main',\n titleAlign: 'main',\n titleAnchor: 'main',\n titleAngle: 'main',\n titleBaseline: 'main',\n titleColor: 'main',\n titleFont: 'main',\n titleFontSize: 'main',\n titleFontStyle: 'main',\n titleFontWeight: 'main',\n titleLimit: 'main',\n titleLineHeight: 'main',\n titleOpacity: 'main',\n titlePadding: 'main',\n titleX: 'main',\n titleY: 'main',\n\n encode: 'both', // we hide this in Vega-Lite\n scale: 'both',\n tickBand: 'both',\n tickCount: 'both',\n tickExtra: 'both',\n translate: 'both',\n values: 'both',\n zindex: 'both' // this is actually set afterward, so it doesn't matter\n};\n\nexport interface AxisEncoding {\n /**\n * Custom encoding for the axis container.\n */\n axis?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the axis domain rule mark.\n */\n domain?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis gridline rule marks.\n */\n grid?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis label text marks.\n */\n labels?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis tick rule marks.\n */\n ticks?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the axis title text mark.\n */\n title?: GuideEncodingEntry;\n}\n\nexport const COMMON_AXIS_PROPERTIES_INDEX: Flag = {\n orient: 1, // other things can depend on orient\n\n aria: 1,\n bandPosition: 1,\n description: 1,\n domain: 1,\n domainCap: 1,\n domainColor: 1,\n domainDash: 1,\n domainDashOffset: 1,\n domainOpacity: 1,\n domainWidth: 1,\n format: 1,\n formatType: 1,\n grid: 1,\n gridCap: 1,\n gridColor: 1,\n gridDash: 1,\n gridDashOffset: 1,\n gridOpacity: 1,\n gridWidth: 1,\n labelAlign: 1,\n labelAngle: 1,\n labelBaseline: 1,\n labelBound: 1,\n labelColor: 1,\n labelFlush: 1,\n labelFlushOffset: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelLineHeight: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labels: 1,\n labelSeparation: 1,\n maxExtent: 1,\n minExtent: 1,\n offset: 1,\n position: 1,\n tickBand: 1,\n tickCap: 1,\n tickColor: 1,\n tickCount: 1,\n tickDash: 1,\n tickDashOffset: 1,\n tickExtra: 1,\n tickMinStep: 1,\n tickOffset: 1,\n tickOpacity: 1,\n tickRound: 1,\n ticks: 1,\n tickSize: 1,\n tickWidth: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleAngle: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titlePadding: 1,\n titleX: 1,\n titleY: 1,\n translate: 1,\n values: 1,\n zindex: 1\n};\n\nconst AXIS_PROPERTIES_INDEX: Flag = {\n ...COMMON_AXIS_PROPERTIES_INDEX,\n style: 1,\n labelExpr: 1,\n encoding: 1\n};\n\nexport function isAxisProperty(prop: string): prop is keyof Axis {\n return !!AXIS_PROPERTIES_INDEX[prop];\n}\n\n// Export for dependent projects\nexport const AXIS_PROPERTIES = keys(AXIS_PROPERTIES_INDEX);\n\nexport interface AxisConfigMixins {\n /**\n * Axis configuration, which determines default properties for all `x` and `y` [axes](https://vega.github.io/vega-lite/docs/axis.html). For a full list of axis configuration options, please see the [corresponding section of the axis documentation](https://vega.github.io/vega-lite/docs/axis.html#config).\n */\n axis?: AxisConfig;\n\n /**\n * X-axis specific config.\n */\n axisX?: AxisConfig;\n\n /**\n * Y-axis specific config.\n */\n axisY?: AxisConfig;\n\n /**\n * Config for y-axis along the left edge of the chart.\n */\n axisLeft?: AxisConfig;\n\n /**\n * Config for y-axis along the right edge of the chart.\n */\n axisRight?: AxisConfig;\n\n /**\n * Config for x-axis along the top edge of the chart.\n */\n axisTop?: AxisConfig;\n\n /**\n * Config for x-axis along the bottom edge of the chart.\n */\n axisBottom?: AxisConfig;\n\n /**\n * Config for axes with \"band\" scales.\n */\n axisBand?: AxisConfig;\n\n /**\n * Config for axes with \"point\" scales.\n */\n axisPoint?: AxisConfig;\n\n /**\n * Config for axes with \"point\" or \"band\" scales.\n */\n axisDiscrete?: AxisConfig;\n\n /**\n * Config for quantitative axes.\n */\n axisQuantitative?: AxisConfig;\n\n /**\n * Config for temporal axes.\n */\n axisTemporal?: AxisConfig;\n\n /**\n * Config for x-axes with \"band\" scales.\n */\n axisXBand?: AxisConfig;\n\n /**\n * Config for x-axes with \"point\" scales.\n */\n axisXPoint?: AxisConfig;\n\n /**\n * Config for x-axes with \"point\" or \"band\" scales.\n */\n axisXDiscrete?: AxisConfig;\n\n /**\n * Config for x-quantitative axes.\n */\n axisXQuantitative?: AxisConfig;\n\n /**\n * Config for x-temporal axes.\n */\n axisXTemporal?: AxisConfig;\n\n /**\n * Config for y-axes with \"band\" scales.\n */\n axisYBand?: AxisConfig;\n\n /**\n * Config for y-axes with \"point\" scales.\n */\n axisYPoint?: AxisConfig;\n\n /**\n * Config for y-axes with \"point\" or \"band\" scales.\n */\n axisYDiscrete?: AxisConfig;\n\n /**\n * Config for y-quantitative axes.\n */\n axisYQuantitative?: AxisConfig;\n\n /**\n * Config for y-temporal axes.\n */\n axisYTemporal?: AxisConfig;\n}\n","import {Align, Color, Gradient, MarkConfig as VgMarkConfig, Orientation, SignalRef, TextBaseline} from 'vega';\nimport {toSet} from 'vega-util';\nimport {CompositeMark, CompositeMarkDef} from './compositemark';\nimport {contains, Flag, keys} from './util';\n\n/**\n * All types of primitive marks.\n */\nexport const Mark = {\n arc: 'arc',\n area: 'area',\n bar: 'bar',\n image: 'image',\n line: 'line',\n point: 'point',\n rect: 'rect',\n rule: 'rule',\n text: 'text',\n tick: 'tick',\n trail: 'trail',\n circle: 'circle',\n square: 'square',\n geoshape: 'geoshape'\n} as const;\n\nexport const ARC = Mark.arc;\nexport const AREA = Mark.area;\nexport const BAR = Mark.bar;\nexport const IMAGE = Mark.image;\nexport const LINE = Mark.line;\nexport const POINT = Mark.point;\nexport const RECT = Mark.rect;\nexport const RULE = Mark.rule;\nexport const TEXT = Mark.text;\nexport const TICK = Mark.tick;\nexport const TRAIL = Mark.trail;\nexport const CIRCLE = Mark.circle;\nexport const SQUARE = Mark.square;\nexport const GEOSHAPE = Mark.geoshape;\n\nexport type Mark = keyof typeof Mark;\n\nexport function isMark(m: string): m is Mark {\n return m in Mark;\n}\n\nexport function isPathMark(m: Mark | CompositeMark): m is 'line' | 'area' | 'trail' {\n return contains(['line', 'area', 'trail'], m);\n}\n\nexport function isRectBasedMark(m: Mark | CompositeMark): m is 'rect' | 'bar' | 'image' | 'arc' {\n return contains(['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */], m);\n}\n\nexport const PRIMITIVE_MARKS = keys(Mark);\n\nexport interface ColorMixins {\n /**\n * Default color.\n *\n * __Default value:__ `\"#4682b4\"`\n *\n * __Note:__\n * - This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n * - The `fill` and `stroke` properties have higher precedence than `color` and will override `color`.\n */\n color?: Color | Gradient | SignalRef;\n}\n\nexport interface TooltipContent {\n content: 'encoding' | 'data';\n}\n\n/** @hidden */\nexport type Hide = 'hide';\n\nexport interface VLOnlyMarkConfig extends ColorMixins {\n /**\n * Whether the mark's color should be used as fill color instead of stroke color.\n *\n * __Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n *\n * __Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n *\n */\n filled?: boolean;\n\n /**\n * Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n * - If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n * - If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.\n */\n invalid?: 'filter' | Hide | null;\n\n /**\n * For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.\n */\n order?: null | boolean;\n\n /**\n * Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\n * If set to `0.5`, the marks will be positioned in the middle of the time unit band step.\n */\n timeUnitBandPosition?: number;\n\n /**\n * Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\n * If set to `0.5`, bandwidth of the marks will be half of the time unit band step.\n */\n timeUnitBand?: number;\n\n /**\n * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.\n */\n theta2?: number | SignalRef; // In Vega, this is called endAngle\n\n /**\n * The secondary (inner) radius in pixels of arc marks.\n *\n * @minimum 0\n * __Default value:__ `0`\n */\n radius2?: number | SignalRef; // In Vega, this is called innerRadius\n}\n\nexport interface MarkConfig extends VLOnlyMarkConfig, Omit {\n // ========== Overriding Vega ==========\n\n /**\n * The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n *\n * - If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n * - If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n * - If set to `null` or `false`, then no tooltip will be used.\n *\n * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n *\n * __Default value:__ `null`\n */\n tooltip?: number | string | boolean | TooltipContent | SignalRef | null; // VL has a special object form for tooltip content\n\n /**\n * Default size for marks.\n * - For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n * - For `bar`, this represents the band size of the bar, in pixels.\n * - For `text`, this represents the font size, in pixels.\n *\n * __Default value:__\n * - `30` for point, circle, square marks; width/height's `step`\n * - `2` for bar marks with discrete dimensions;\n * - `5` for bar marks with continuous dimensions;\n * - `11` for text marks.\n *\n * @minimum 0\n */\n size?: number | SignalRef; // size works beyond symbol marks in VL\n\n /**\n * X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x?: number | 'width' | SignalRef; // Vega doesn't have 'width'\n\n /**\n * Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y?: number | 'height' | SignalRef; // Vega doesn't have 'height'\n\n /**\n * X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x2?: number | 'width' | SignalRef; // Vega doesn't have 'width'\n\n /**\n * Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y2?: number | 'height' | SignalRef; // Vega doesn't have 'height'\n\n /**\n * Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n *\n * __Default value:__ (None)\n *\n */\n fill?: Color | Gradient | null | SignalRef; // docs: Vega doesn't have config.color\n\n /**\n * Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n *\n * __Default value:__ (None)\n *\n */\n stroke?: Color | Gradient | null | SignalRef; // docs: Vega doesn't have config.color\n\n /**\n * The overall opacity (value between [0,1]).\n *\n * __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.\n *\n * @minimum 0\n * @maximum 1\n */\n opacity?: number | SignalRef; // docs (different defaults)\n\n /**\n * The orientation of a non-stacked bar, tick, area, and line charts.\n * The value is either horizontal (default) or vertical.\n * - For bar, rule and tick, this determines whether the size of the bar and tick\n * should be applied to x or y dimension.\n * - For area, this property determines the orient property of the Vega output.\n * - For line and trail marks, this property determines the sort order of the points in the line\n * if `config.sortLineBy` is not specified.\n * For stacked charts, this is always determined by the orientation of the stack;\n * therefore explicitly specified value will be ignored.\n */\n orient?: Orientation; // Vega orient doesn't apply to bar/tick/line. Since some logic depends on this property, Vega-Lite does NOT allow signal for orient.\n\n /**\n * The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`.\n */\n align?: Align; // Vega doesn't apply align to ranged marks. Since some logic depends on this property, Vega-Lite does NOT allow signal for align.\n\n /**\n * The vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`. The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone.\n */\n baseline?: TextBaseline; // Vega doesn't apply align to ranged marks. Since some logic depends on this property, Vega-Lite does NOT allow signal for baseline.\n\n /**\n * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n *\n * - For text marks, polar coordinate angle in radians.\n *\n * @minimum 0\n * @maximum 360\n */\n theta?: number | SignalRef; // overriding VG\n\n /**\n *\n * For arc mark, the primary (outer) radius in pixels.\n *\n * For text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.\n *\n * @minimum 0\n *\n * __Default value:__ `min(plot_width, plot_height)/2`\n */\n radius?: number | SignalRef; // overriding VG\n\n /**\n * The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.\n *\n * @minimum 0\n * __Default value:__ `0`\n */\n innerRadius?: number | SignalRef;\n\n /**\n * The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.\n *\n * @minimum 0\n * __Default value:__ `0`\n */\n outerRadius?: number | SignalRef;\n}\n\nexport interface RectBinSpacingMixins {\n /**\n * Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style).\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n binSpacing?: number;\n}\n\nexport type AnyMark = CompositeMark | CompositeMarkDef | Mark | MarkDef;\n\nexport function isMarkDef(mark: string | GenericMarkDef): mark is GenericMarkDef {\n return mark['type'];\n}\n\nconst PRIMITIVE_MARK_INDEX = toSet(PRIMITIVE_MARKS);\n\nexport function isPrimitiveMark(mark: AnyMark): mark is Mark {\n const markType = isMarkDef(mark) ? mark.type : mark;\n return markType in PRIMITIVE_MARK_INDEX;\n}\n\nexport const STROKE_CONFIG = [\n 'stroke',\n 'strokeWidth',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeOpacity',\n 'strokeJoin',\n 'strokeMiterLimit'\n] as const;\n\nexport const FILL_CONFIG = ['fill', 'fillOpacity'] as const;\n\nexport const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG];\n\nconst VL_ONLY_MARK_CONFIG_INDEX: Flag = {\n color: 1,\n filled: 1,\n invalid: 1,\n order: 1,\n radius2: 1,\n theta2: 1,\n timeUnitBand: 1,\n timeUnitBandPosition: 1\n};\n\nexport const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX);\n\nexport const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: {\n [k in Mark]?: (keyof Required[k])[];\n} = {\n area: ['line', 'point'],\n bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize'],\n rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize'],\n line: ['point'],\n tick: ['bandSize', 'thickness']\n};\n\nexport const defaultMarkConfig: MarkConfig = {\n color: '#4c78a8',\n invalid: 'filter',\n timeUnitBand: 1\n};\n\n// TODO: replace with MarkConfigMixins[Mark] once https://github.com/vega/ts-json-schema-generator/issues/344 is fixed\nexport type AnyMarkConfig = MarkConfig | AreaConfig | BarConfig | RectConfig | LineConfig | TickConfig;\n\nexport interface MarkConfigMixins {\n /** Mark Config */\n mark?: MarkConfig;\n\n // MARK-SPECIFIC CONFIGS\n\n /** Arc-specific Config */\n arc?: RectConfig;\n\n /** Area-Specific Config */\n area?: AreaConfig;\n\n /** Bar-Specific Config */\n bar?: BarConfig;\n\n /** Circle-Specific Config */\n circle?: MarkConfig;\n\n /** Image-specific Config */\n image?: RectConfig;\n\n /** Line-Specific Config */\n line?: LineConfig;\n\n /** Point-Specific Config */\n point?: MarkConfig;\n\n /** Rect-Specific Config */\n rect?: RectConfig;\n\n /** Rule-Specific Config */\n rule?: MarkConfig;\n\n /** Square-Specific Config */\n square?: MarkConfig;\n\n /** Text-Specific Config */\n text?: MarkConfig;\n\n /** Tick-Specific Config */\n tick?: TickConfig;\n\n /** Trail-Specific Config */\n trail?: LineConfig;\n\n /** Geoshape-Specific Config */\n geoshape?: MarkConfig;\n}\n\nexport interface RectConfig extends RectBinSpacingMixins, MarkConfig {\n /**\n * The default size of the bars on continuous scales.\n *\n * __Default value:__ `5`\n *\n * @minimum 0\n */\n continuousBandSize?: number;\n\n /**\n * The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.\n * @minimum 0\n */\n discreteBandSize?: number;\n}\n\nexport const BAR_CORNER_RADIUS_INDEX: Partial> = {\n horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'],\n vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight']\n};\n\nexport interface BarCornerRadiusMixins {\n /**\n * - For vertical bars, top-left and top-right corner radius.\n * - For horizontal bars, top-right and bottom-right corner radius.\n */\n cornerRadiusEnd?: number | SignalRef;\n}\n\nexport type BarConfig = RectConfig & BarCornerRadiusMixins;\n\nexport type OverlayMarkDef = MarkConfig & MarkDefMixins;\n\nexport interface PointOverlayMixins {\n /**\n * A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.\n *\n * - If this property is `\"transparent\"`, transparent points will be used (for enhancing tooltips and selections).\n *\n * - If this property is an empty object (`{}`) or `true`, filled points with default properties will be used.\n *\n * - If this property is `false`, no points would be automatically added to line or area marks.\n *\n * __Default value:__ `false`.\n */\n point?: boolean | OverlayMarkDef | 'transparent';\n}\n\nexport interface LineConfig extends MarkConfig, PointOverlayMixins {}\n\nexport interface LineOverlayMixins {\n /**\n * A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.\n *\n * - If this value is an empty object (`{}`) or `true`, lines with default properties will be used.\n *\n * - If this value is `false`, no lines would be automatically added to area marks.\n *\n * __Default value:__ `false`.\n */\n line?: boolean | OverlayMarkDef;\n}\n\nexport interface AreaConfig extends MarkConfig, PointOverlayMixins, LineOverlayMixins {}\n\nexport interface TickThicknessMixins {\n /**\n * Thickness of the tick mark.\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n thickness?: number | SignalRef;\n}\n\nexport interface GenericMarkDef {\n /**\n * The mark type. This could a primitive mark type\n * (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n * `\"area\"`, `\"point\"`, `\"geoshape\"`, `\"rule\"`, and `\"text\"`)\n * or a composite mark type (`\"boxplot\"`, `\"errorband\"`, `\"errorbar\"`).\n */\n type: M;\n}\n\nexport interface MarkDefMixins {\n /**\n * A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](https://vega.github.io/vega-lite/docs/encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default.\n *\n * __Default value:__ The mark's name. For example, a bar mark will have style `\"bar\"` by default.\n * __Note:__ Any specified style will augment the default style. For example, a bar mark with `\"style\": \"foo\"` will receive from `config.style.bar` and `config.style.foo` (the specified style `\"foo\"` has higher precedence).\n */\n style?: string | string[];\n\n /**\n * Whether a mark be clipped to the enclosing group’s width and height.\n */\n clip?: boolean;\n\n // Offset properties should not be a part of config\n\n /**\n * Offset for x-position.\n */\n xOffset?: number | SignalRef;\n\n /**\n * Offset for y-position.\n */\n yOffset?: number | SignalRef;\n\n /**\n * Offset for x2-position.\n */\n x2Offset?: number | SignalRef;\n\n /**\n * Offset for y2-position.\n */\n y2Offset?: number | SignalRef;\n\n /**\n * Offset for theta.\n */\n thetaOffset?: number | SignalRef;\n\n /**\n * Offset for theta2.\n */\n theta2Offset?: number | SignalRef;\n\n /**\n * Offset for radius.\n */\n radiusOffset?: number | SignalRef;\n\n /**\n * Offset for radius2.\n */\n radius2Offset?: number | SignalRef;\n}\n\n// Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef\n\n// Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef\nexport interface MarkDef\n extends GenericMarkDef,\n Omit<\n MarkConfig &\n AreaConfig &\n BarConfig & // always extends RectConfig\n LineConfig &\n TickConfig,\n 'startAngle' | 'endAngle'\n >,\n MarkDefMixins {\n // Omit startAngle/endAngle since we use theta/theta2 from Vega-Lite schema to avoid confusion\n // We still support start/endAngle only in config, just in case people use Vega config with Vega-Lite.\n\n /**\n * @hidden\n */\n startAngle?: number | SignalRef;\n /**\n * @hidden\n */\n endAngle?: number | SignalRef;\n}\n\nconst DEFAULT_RECT_BAND_SIZE = 5;\n\nexport const defaultBarConfig: RectConfig = {\n binSpacing: 1,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n timeUnitBandPosition: 0.5\n};\n\nexport const defaultRectConfig: RectConfig = {\n binSpacing: 0,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n timeUnitBandPosition: 0.5\n};\n\nexport interface TickConfig extends MarkConfig, TickThicknessMixins {\n /**\n * The width of the ticks.\n *\n * __Default value:__ 3/4 of step (width step for horizontal ticks and height step for vertical ticks).\n * @minimum 0\n */\n bandSize?: number;\n}\n\nexport const defaultTickConfig: TickConfig = {\n thickness: 1\n};\n\nexport function getMarkType(m: string | GenericMarkDef) {\n return isMarkDef(m) ? m.type : m;\n}\n","import {FieldName} from '../channeldef';\nimport {CompositeEncoding, FacetedCompositeEncoding} from '../compositemark';\nimport {Encoding} from '../encoding';\nimport {AnyMark, Mark, MarkDef} from '../mark';\nimport {Projection} from '../projection';\nimport {SelectionDef} from '../selection';\nimport {\n BaseSpec,\n DataMixins,\n DeprecatedFrameMixins,\n FrameMixins,\n GenericCompositionLayout,\n ResolveMixins\n} from './base';\nimport {TopLevel} from './toplevel';\n\n/**\n * Base interface for a unit (single-view) specification.\n */\nexport interface GenericUnitSpec, M> extends BaseSpec {\n /**\n * A string describing the mark type (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n * `\"area\"`, `\"point\"`, `\"rule\"`, `\"geoshape\"`, and `\"text\"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n */\n mark: M;\n\n /**\n * A key-value mapping between encoding channels and definition of fields.\n */\n encoding?: E;\n\n /**\n * An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks\n * and to `latitude` and `\"longitude\"` channels for other marks.\n */\n projection?: Projection;\n\n /**\n * A key-value mapping between selection names and definitions.\n */\n selection?: Record;\n}\n\n/**\n * A unit specification without any shortcut/expansion syntax.\n */\nexport type NormalizedUnitSpec = GenericUnitSpec, Mark | MarkDef>;\n\n/**\n * A unit specification, which can contain either [primitive marks or composite marks](https://vega.github.io/vega-lite/docs/mark.html#types).\n */\nexport type UnitSpec = GenericUnitSpec & DeprecatedFrameMixins;\n\nexport type UnitSpecWithFrame = GenericUnitSpec & FrameMixins;\n\n/**\n * Unit spec that can have a composite mark and row or column channels (shorthand for a facet spec).\n */\nexport type FacetedUnitSpec = GenericUnitSpec &\n ResolveMixins &\n GenericCompositionLayout &\n FrameMixins;\n\nexport type TopLevelUnitSpec = TopLevel & DataMixins;\n\nexport function isUnitSpec(spec: BaseSpec): spec is FacetedUnitSpec | NormalizedUnitSpec {\n return 'mark' in spec;\n}\n","import {Encoding} from '../encoding';\nimport {GenericMarkDef, getMarkType} from '../mark';\nimport {NonFacetUnitNormalizer, Normalize, NormalizerParams} from '../normalize/base';\nimport {GenericSpec} from '../spec';\nimport {GenericLayerSpec, NormalizedLayerSpec} from '../spec/layer';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {FieldName} from '../channeldef';\n\n// TODO: replace string with Mark\nexport type CompositeMarkUnitSpec = GenericUnitSpec>;\n\nexport class CompositeMarkNormalizer implements NonFacetUnitNormalizer> {\n constructor(\n public name: string,\n public run: (\n spec: CompositeMarkUnitSpec,\n params: NormalizerParams,\n normalize: Normalize<\n // Input of the normalize method\n GenericUnitSpec, M> | GenericLayerSpec,\n // Output of the normalize method\n NormalizedLayerSpec | NormalizedUnitSpec\n >\n ) => NormalizedLayerSpec | NormalizedUnitSpec\n ) {}\n\n public hasMatchingType(spec: GenericSpec): spec is CompositeMarkUnitSpec {\n if (isUnitSpec(spec)) {\n return getMarkType(spec.mark) === this.name;\n }\n return false;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {isString, toSet} from 'vega-util';\nimport {contains, Flag, keys} from './util';\n\nconst AGGREGATE_OP_INDEX: Flag = {\n argmax: 1,\n argmin: 1,\n average: 1,\n count: 1,\n distinct: 1,\n product: 1,\n max: 1,\n mean: 1,\n median: 1,\n min: 1,\n missing: 1,\n q1: 1,\n q3: 1,\n ci0: 1,\n ci1: 1,\n stderr: 1,\n stdev: 1,\n stdevp: 1,\n sum: 1,\n valid: 1,\n values: 1,\n variance: 1,\n variancep: 1\n};\n\nexport const MULTIDOMAIN_SORT_OP_INDEX = {\n count: 1,\n min: 1,\n max: 1\n};\n\nexport interface ArgminDef {\n argmin: string;\n}\n\nexport interface ArgmaxDef {\n argmax: string;\n}\n\nexport type NonArgAggregateOp = Exclude;\n\nexport type Aggregate = NonArgAggregateOp | ArgmaxDef | ArgminDef;\n\nexport function isArgminDef(a: Aggregate | string): a is ArgminDef {\n return !!a && !!a['argmin'];\n}\n\nexport function isArgmaxDef(a: Aggregate | string): a is ArgmaxDef {\n return !!a && !!a['argmax'];\n}\n\nexport const AGGREGATE_OPS = keys(AGGREGATE_OP_INDEX);\n\nexport function isAggregateOp(a: string | ArgminDef | ArgmaxDef): a is AggregateOp {\n return isString(a) && !!AGGREGATE_OP_INDEX[a];\n}\n\nexport const COUNTING_OPS: NonArgAggregateOp[] = ['count', 'valid', 'missing', 'distinct'];\n\nexport function isCountingAggregateOp(aggregate?: string | Aggregate): boolean {\n return isString(aggregate) && contains(COUNTING_OPS, aggregate);\n}\n\nexport function isMinMaxOp(aggregate?: Aggregate | string): boolean {\n return isString(aggregate) && contains(['min', 'max'], aggregate);\n}\n\n/** Additive-based aggregation operations. These can be applied to stack. */\nexport const SUM_OPS: NonArgAggregateOp[] = ['count', 'sum', 'distinct', 'valid', 'missing'];\n\n/**\n * Aggregation operators that always produce values within the range [domainMin, domainMax].\n */\nexport const SHARED_DOMAIN_OPS: AggregateOp[] = ['mean', 'average', 'median', 'q1', 'q3', 'min', 'max'];\n\nexport const SHARED_DOMAIN_OP_INDEX = toSet(SHARED_DOMAIN_OPS);\n","/*\n * Constants and utilities for encoding channels (Visual variables)\n * such as 'x', 'y', 'color'.\n */\n\nimport {RangeType} from './compile/scale/type';\nimport {Encoding} from './encoding';\nimport {Mark} from './mark';\nimport {EncodingFacetMapping} from './spec/facet';\nimport {Flag, keys} from './util';\n\nexport type Channel = keyof Encoding;\nexport type ExtendedChannel = Channel | FacetChannel;\n\n// Facet\nexport const ROW = 'row' as const;\nexport const COLUMN = 'column' as const;\n\nexport const FACET = 'facet' as const;\n\n// Position\nexport const X = 'x' as const;\nexport const Y = 'y' as const;\nexport const X2 = 'x2' as const;\nexport const Y2 = 'y2' as const;\n\n// Arc-Position\nexport const RADIUS = 'radius' as const;\nexport const RADIUS2 = 'radius2' as const;\nexport const THETA = 'theta' as const;\nexport const THETA2 = 'theta2' as const;\n\n// Geo Position\nexport const LATITUDE = 'latitude' as const;\nexport const LONGITUDE = 'longitude' as const;\nexport const LATITUDE2 = 'latitude2' as const;\nexport const LONGITUDE2 = 'longitude2' as const;\n\n// Mark property with scale\nexport const COLOR = 'color' as const;\n\nexport const FILL = 'fill' as const;\n\nexport const STROKE = 'stroke' as const;\n\nexport const SHAPE = 'shape' as const;\nexport const SIZE = 'size' as const;\n\nexport const ANGLE = 'angle' as const;\n\nexport const OPACITY = 'opacity' as const;\nexport const FILLOPACITY = 'fillOpacity' as const;\n\nexport const STROKEOPACITY = 'strokeOpacity' as const;\n\nexport const STROKEWIDTH = 'strokeWidth' as const;\nexport const STROKEDASH = 'strokeDash' as const;\n\n// Non-scale channel\nexport const TEXT = 'text' as const;\nexport const ORDER = 'order' as const;\nexport const DETAIL = 'detail' as const;\nexport const KEY = 'key' as const;\n\nexport const TOOLTIP = 'tooltip' as const;\nexport const HREF = 'href' as const;\n\nexport const URL = 'url' as const;\nexport const DESCRIPTION = 'description' as const;\n\nconst POSITION_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n x2: 1,\n y2: 1\n} as const;\n\nexport type PositionChannel = keyof typeof POSITION_CHANNEL_INDEX;\n\nconst POLAR_POSITION_CHANNEL_INDEX = {\n theta: 1,\n theta2: 1,\n radius: 1,\n radius2: 1\n} as const;\n\nexport type PolarPositionChannel = keyof typeof POLAR_POSITION_CHANNEL_INDEX;\n\nexport function isPolarPositionChannel(c: Channel): c is PolarPositionChannel {\n return c in POLAR_POSITION_CHANNEL_INDEX;\n}\n\nconst GEO_POSIITON_CHANNEL_INDEX = {\n longitude: 1,\n longitude2: 1,\n latitude: 1,\n latitude2: 1\n} as const;\n\nexport type GeoPositionChannel = keyof typeof GEO_POSIITON_CHANNEL_INDEX;\n\nexport function getPositionChannelFromLatLong(channel: GeoPositionChannel): PositionChannel {\n switch (channel) {\n case LATITUDE:\n return 'y';\n case LATITUDE2:\n return 'y2';\n case LONGITUDE:\n return 'x';\n case LONGITUDE2:\n return 'x2';\n }\n}\n\nexport function isGeoPositionChannel(c: Channel): c is GeoPositionChannel {\n return c in GEO_POSIITON_CHANNEL_INDEX;\n}\n\nexport const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX);\n\nconst UNIT_CHANNEL_INDEX: Flag = {\n ...POSITION_CHANNEL_INDEX,\n ...POLAR_POSITION_CHANNEL_INDEX,\n\n ...GEO_POSIITON_CHANNEL_INDEX,\n\n // color\n color: 1,\n fill: 1,\n stroke: 1,\n\n // other non-position with scale\n opacity: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n\n strokeWidth: 1,\n strokeDash: 1,\n size: 1,\n angle: 1,\n shape: 1,\n\n // channels without scales\n order: 1,\n text: 1,\n detail: 1,\n key: 1,\n tooltip: 1,\n href: 1,\n url: 1,\n description: 1\n};\n\nexport type ColorChannel = 'color' | 'fill' | 'stroke';\n\nexport function isColorChannel(channel: Channel): channel is ColorChannel {\n return channel === COLOR || channel === FILL || channel === STROKE;\n}\n\nexport type FacetChannel = keyof EncodingFacetMapping;\n\nconst FACET_CHANNEL_INDEX: Flag> = {\n row: 1,\n column: 1,\n facet: 1\n};\n\nexport const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX);\n\nconst CHANNEL_INDEX = {\n ...UNIT_CHANNEL_INDEX,\n ...FACET_CHANNEL_INDEX\n};\n\nexport const CHANNELS = keys(CHANNEL_INDEX);\n\nconst {order: _o, detail: _d, tooltip: _tt1, ...SINGLE_DEF_CHANNEL_INDEX} = CHANNEL_INDEX;\nconst {row: _r, column: _c, facet: _f, ...SINGLE_DEF_UNIT_CHANNEL_INDEX} = SINGLE_DEF_CHANNEL_INDEX;\n/**\n * Channels that cannot have an array of channelDef.\n * model.fieldDef, getFieldDef only work for these channels.\n *\n * (The only two channels that can have an array of channelDefs are \"detail\" and \"order\".\n * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef\n * are not applicable for them. Similarly, selection projection won't work with \"detail\" and \"order\".)\n */\n\nexport const SINGLE_DEF_CHANNELS = keys(SINGLE_DEF_CHANNEL_INDEX);\n\nexport type SingleDefChannel = typeof SINGLE_DEF_CHANNELS[number];\n\nexport const SINGLE_DEF_UNIT_CHANNELS = keys(SINGLE_DEF_UNIT_CHANNEL_INDEX);\n\nexport type SingleDefUnitChannel = typeof SINGLE_DEF_UNIT_CHANNELS[number];\n\nexport function isSingleDefUnitChannel(str: string): str is SingleDefUnitChannel {\n return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str];\n}\n\nexport function isChannel(str: string): str is Channel {\n return !!CHANNEL_INDEX[str];\n}\n\nexport type SecondaryRangeChannel = 'x2' | 'y2' | 'latitude2' | 'longitude2' | 'theta2' | 'radius2';\n\nexport const SECONDARY_RANGE_CHANNEL: SecondaryRangeChannel[] = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2];\n\nexport function isSecondaryRangeChannel(c: ExtendedChannel): c is SecondaryRangeChannel {\n const main = getMainRangeChannel(c);\n return main !== c;\n}\n\nexport type MainChannelOf = C extends 'x2'\n ? 'x'\n : C extends 'y2'\n ? 'y'\n : C extends 'latitude2'\n ? 'latitude'\n : C extends 'longitude2'\n ? 'longitude'\n : C extends 'theta2'\n ? 'theta'\n : C extends 'radius2'\n ? 'radius'\n : C;\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getMainRangeChannel(channel: C): MainChannelOf {\n switch (channel) {\n case X2:\n return X as MainChannelOf;\n case Y2:\n return Y as MainChannelOf;\n case LATITUDE2:\n return LATITUDE as MainChannelOf;\n case LONGITUDE2:\n return LONGITUDE as MainChannelOf;\n case THETA2:\n return THETA as MainChannelOf;\n case RADIUS2:\n return RADIUS as MainChannelOf;\n }\n return channel as MainChannelOf;\n}\n\nexport type SecondaryChannelOf = C extends 'x'\n ? 'x2'\n : C extends 'y'\n ? 'y2'\n : C extends 'latitude'\n ? 'latitude2'\n : C extends 'longitude'\n ? 'longitude2'\n : C extends 'theta'\n ? 'theta2'\n : C extends 'radius'\n ? 'radius2'\n : undefined;\n\nexport function getVgPositionChannel(channel: PolarPositionChannel | PositionChannel) {\n if (isPolarPositionChannel(channel)) {\n switch (channel) {\n case THETA:\n return 'startAngle';\n case THETA2:\n return 'endAngle';\n case RADIUS:\n return 'outerRadius';\n case RADIUS2:\n return 'innerRadius';\n }\n }\n return channel;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getSecondaryRangeChannel(channel: C): SecondaryChannelOf | undefined {\n switch (channel) {\n case X:\n return X2 as SecondaryChannelOf;\n case Y:\n return Y2 as SecondaryChannelOf;\n case LATITUDE:\n return LATITUDE2 as SecondaryChannelOf;\n case LONGITUDE:\n return LONGITUDE2 as SecondaryChannelOf;\n case THETA:\n return THETA2 as SecondaryChannelOf;\n case RADIUS:\n return RADIUS2 as SecondaryChannelOf;\n }\n return undefined;\n}\n\nexport function getSizeChannel(channel: PositionChannel): 'width' | 'height';\nexport function getSizeChannel(channel: Channel): 'width' | 'height' | undefined;\nexport function getSizeChannel(channel: Channel): 'width' | 'height' | undefined {\n switch (channel) {\n case X:\n case X2:\n return 'width';\n case Y:\n case Y2:\n return 'height';\n }\n return undefined;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetChannel(channel: Channel) {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n case X2:\n return 'x2Offset';\n case Y2:\n return 'y2Offset';\n case THETA:\n return 'thetaOffset';\n case RADIUS:\n return 'radiusOffset';\n case THETA2:\n return 'theta2Offset';\n case RADIUS2:\n return 'radius2Offset';\n }\n return undefined;\n}\n\n// CHANNELS without COLUMN, ROW\nexport const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX);\n\n// NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2;\nconst {\n x: _x,\n y: _y,\n // x2 and y2 share the same scale as x and y\n x2: _x2,\n y2: _y2,\n latitude: _latitude,\n longitude: _longitude,\n latitude2: _latitude2,\n longitude2: _longitude2,\n theta: _theta,\n theta2: _theta2,\n radius: _radius,\n radius2: _radius2,\n // The rest of unit channels then have scale\n ...NONPOSITION_CHANNEL_INDEX\n} = UNIT_CHANNEL_INDEX;\n\nexport const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX);\nexport type NonPositionChannel = typeof NONPOSITION_CHANNELS[number];\n\nexport const POSITION_SCALE_CHANNEL_INDEX = {\n x: 1,\n y: 1\n} as const;\nexport const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX);\nexport type PositionScaleChannel = keyof typeof POSITION_SCALE_CHANNEL_INDEX;\n\nexport function isXorY(channel: ExtendedChannel): channel is PositionScaleChannel {\n return channel in POSITION_SCALE_CHANNEL_INDEX;\n}\n\nexport const POLAR_POSITION_SCALE_CHANNEL_INDEX = {\n theta: 1,\n radius: 1\n} as const;\n\nexport const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX);\nexport type PolarPositionScaleChannel = keyof typeof POLAR_POSITION_SCALE_CHANNEL_INDEX;\n\nexport function getPositionScaleChannel(sizeType: 'width' | 'height'): PositionScaleChannel {\n return sizeType === 'width' ? X : Y;\n}\n\n// NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without X, Y\nconst {\n // x2 and y2 share the same scale as x and y\n // text and tooltip have format instead of scale,\n // href has neither format, nor scale\n text: _t,\n tooltip: _tt,\n href: _hr,\n url: _u,\n description: _al,\n // detail and order have no scale\n detail: _dd,\n key: _k,\n order: _oo,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n} = NONPOSITION_CHANNEL_INDEX;\nexport const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX);\nexport type NonPositionScaleChannel = typeof NONPOSITION_SCALE_CHANNELS[number];\n\nexport function isNonPositionScaleChannel(channel: Channel): channel is NonPositionScaleChannel {\n return !!NONPOSITION_CHANNEL_INDEX[channel];\n}\n\n/**\n * @returns whether Vega supports legends for a particular channel\n */\nexport function supportLegend(channel: NonPositionScaleChannel) {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n case SIZE:\n case SHAPE:\n case OPACITY:\n case STROKEWIDTH:\n case STROKEDASH:\n return true;\n case FILLOPACITY:\n case STROKEOPACITY:\n case ANGLE:\n return false;\n }\n}\n\n// Declare SCALE_CHANNEL_INDEX\nconst SCALE_CHANNEL_INDEX = {\n ...POSITION_SCALE_CHANNEL_INDEX,\n ...POLAR_POSITION_SCALE_CHANNEL_INDEX,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n};\n\n/** List of channels with scales */\nexport const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX);\nexport type ScaleChannel = typeof SCALE_CHANNELS[number];\n\nexport function isScaleChannel(channel: Channel): channel is ScaleChannel {\n return !!SCALE_CHANNEL_INDEX[channel];\n}\n\nexport type SupportedMark = Partial>;\n\n/**\n * Return whether a channel supports a particular mark type.\n * @param channel channel name\n * @param mark the mark type\n * @return whether the mark supports the channel\n */\nexport function supportMark(channel: Channel, mark: Mark) {\n return getSupportedMark(channel)[mark];\n}\n\nconst ALL_MARKS: Record = {\n // all marks\n arc: 'always',\n area: 'always',\n bar: 'always',\n circle: 'always',\n geoshape: 'always',\n image: 'always',\n line: 'always',\n rule: 'always',\n point: 'always',\n rect: 'always',\n square: 'always',\n trail: 'always',\n text: 'always',\n tick: 'always'\n};\n\nconst {geoshape: _g, ...ALL_MARKS_EXCEPT_GEOSHAPE} = ALL_MARKS;\n\n/**\n * Return a dictionary showing whether a channel supports mark type.\n * @param channel\n * @return A dictionary mapping mark types to 'always', 'binned', or undefined\n */\nfunction getSupportedMark(channel: ExtendedChannel): SupportedMark {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n // falls through\n\n case DESCRIPTION:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case ORDER: // TODO: revise (order might not support rect, which is not stackable?)\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n\n // falls through\n\n case FACET:\n case ROW: // falls through\n case COLUMN:\n return ALL_MARKS;\n case X:\n case Y:\n case LATITUDE:\n case LONGITUDE:\n // all marks except geoshape. geoshape does not use X, Y -- it uses a projection\n return ALL_MARKS_EXCEPT_GEOSHAPE;\n case X2:\n case Y2:\n case LATITUDE2:\n case LONGITUDE2:\n return {\n area: 'always',\n bar: 'always',\n image: 'always',\n rect: 'always',\n rule: 'always',\n circle: 'binned',\n point: 'binned',\n square: 'binned',\n tick: 'binned',\n line: 'binned',\n trail: 'binned'\n };\n case SIZE:\n return {\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n text: 'always',\n line: 'always',\n trail: 'always'\n };\n case STROKEDASH:\n return {\n line: 'always',\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n geoshape: 'always'\n };\n case SHAPE:\n return {point: 'always', geoshape: 'always'};\n case TEXT:\n return {text: 'always'};\n case ANGLE:\n return {point: 'always', square: 'always', text: 'always'};\n case URL:\n return {image: 'always'};\n case THETA:\n return {text: 'always', arc: 'always'};\n case RADIUS:\n return {text: 'always', arc: 'always'};\n case THETA2:\n case RADIUS2:\n return {arc: 'always'};\n }\n}\n\nexport function rangeType(channel: ExtendedChannel): RangeType {\n switch (channel) {\n case X:\n case Y:\n case THETA:\n case RADIUS:\n case SIZE:\n case ANGLE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n\n // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through]\n case X2:\n case Y2:\n case THETA2:\n case RADIUS2:\n return undefined;\n\n case FACET:\n case ROW:\n case COLUMN:\n case SHAPE:\n case STROKEDASH:\n // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through]\n case TEXT:\n case TOOLTIP:\n case HREF:\n case URL:\n case DESCRIPTION:\n return 'discrete';\n\n // Color can be either continuous or discrete, depending on scale type.\n case COLOR:\n case FILL:\n case STROKE:\n return 'flexible';\n\n // No scale, no range type.\n\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n case DETAIL:\n case KEY:\n case ORDER:\n return undefined;\n }\n}\n","import {isBoolean, isObject} from 'vega-util';\nimport {\n COLOR,\n COLUMN,\n ExtendedChannel,\n FILL,\n FILLOPACITY,\n OPACITY,\n ROW,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH\n} from './channel';\nimport {normalizeBin} from './channeldef';\nimport {SelectionExtent} from './selection';\nimport {keys, varName} from './util';\n\nexport interface BaseBin {\n /**\n * The number base to use for automatic bin determination (default is base 10).\n *\n * __Default value:__ `10`\n *\n */\n base?: number;\n /**\n * An exact step size to use between bins.\n *\n * __Note:__ If provided, options such as maxbins will be ignored.\n */\n step?: number;\n /**\n * An array of allowable step sizes to choose from.\n * @minItems 1\n */\n steps?: number[];\n /**\n * A minimum allowable step size (particularly useful for integer values).\n */\n minstep?: number;\n /**\n * Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints.\n *\n * __Default value:__ `[5, 2]`\n *\n * @minItems 1\n */\n divide?: [number, number];\n /**\n * Maximum number of bins.\n *\n * __Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels\n *\n * @minimum 2\n */\n maxbins?: number;\n /**\n * A value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value.\n *\n * __Default value:__ the minimum bin extent value\n */\n anchor?: number;\n /**\n * If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.\n *\n * __Default value:__ `true`\n */\n nice?: boolean;\n}\n\n/**\n * Binning properties or boolean flag for determining whether to bin data or not.\n */\nexport interface BinParams extends BaseBin {\n /**\n * A two-element (`[min, max]`) array indicating the range of desired bin values.\n */\n extent?: BinExtent; // VgBinTransform uses a different extent so we need to pull this out.\n\n /**\n * When set to `true`, Vega-Lite treats the input data as already binned.\n */\n binned?: boolean;\n}\n\nexport type Bin = boolean | BinParams | 'binned' | null;\n\nexport type BinExtent = [number, number] | SelectionExtent;\n\n/**\n * Create a key for the bin configuration. Not for prebinned bin.\n */\nexport function binToString(bin: BinParams | true) {\n if (isBoolean(bin)) {\n bin = normalizeBin(bin, undefined);\n }\n return (\n 'bin' +\n keys(bin)\n .map(p => (isSelectionExtent(bin[p]) ? varName(`_${p}_${Object.entries(bin[p])}`) : varName(`_${p}_${bin[p]}`)))\n .join('')\n );\n}\n\n/**\n * Vega-Lite should bin the data.\n */\nexport function isBinning(bin: BinParams | boolean | 'binned'): bin is BinParams | true {\n return bin === true || (isBinParams(bin) && !bin.binned);\n}\n\n/**\n * The data is already binned and so Vega-Lite should not bin it again.\n */\nexport function isBinned(bin: BinParams | boolean | 'binned'): bin is 'binned' | BinParams {\n return bin === 'binned' || (isBinParams(bin) && bin.binned === true);\n}\n\nexport function isBinParams(bin: BinParams | boolean | 'binned'): bin is BinParams {\n return isObject(bin);\n}\n\nexport function isSelectionExtent(extent: BinExtent): extent is SelectionExtent {\n return extent?.['selection'];\n}\n\nexport function autoMaxBins(channel?: ExtendedChannel): number {\n switch (channel) {\n case ROW:\n case COLUMN:\n case SIZE:\n case COLOR:\n case FILL:\n case STROKE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // Facets and Size shouldn't have too many bins\n // We choose 6 like shape to simplify the rule [falls through]\n case SHAPE:\n return 6; // Vega's \"shape\" has 6 distinct values\n case STROKEDASH:\n return 4; // We only provide 5 different stroke dash values (but 4 is more effective)\n default:\n return 10;\n }\n}\n","/**\n * Collection of all Vega-Lite Error Messages\n */\nimport {AggregateOp} from 'vega';\nimport {Aggregate} from '../aggregate';\nimport {\n Channel,\n FacetChannel,\n GeoPositionChannel,\n getSizeChannel,\n PositionScaleChannel,\n ScaleChannel,\n ExtendedChannel\n} from '../channel';\nimport {HiddenCompositeAggregate, TypedFieldDef, Value} from '../channeldef';\nimport {SplitParentProperty} from '../compile/split';\nimport {CompositeMark} from '../compositemark';\nimport {ErrorBarCenter, ErrorBarExtent} from '../compositemark/errorbar';\nimport {DateTime, DateTimeExpr} from '../datetime';\nimport {Mark} from '../mark';\nimport {Projection} from '../projection';\nimport {ScaleType} from '../scale';\nimport {GenericSpec} from '../spec';\nimport {Type} from '../type';\nimport {stringify} from '../util';\nimport {VgSortField} from '../vega.schema';\n\nexport function invalidSpec(spec: GenericSpec) {\n return `Invalid specification ${JSON.stringify(\n spec\n )}. Make sure the specification includes at least one of the following properties: \"mark\", \"layer\", \"facet\", \"hconcat\", \"vconcat\", \"concat\", or \"repeat\".`;\n}\n\n// FIT\nexport const FIT_NON_SINGLE = 'Autosize \"fit\" only works for single views and layered views.';\n\nexport function containerSizeNonSingle(name: 'width' | 'height') {\n const uName = name == 'width' ? 'Width' : 'Height';\n return `${uName} \"container\" only works for single views and layered views.`;\n}\n\nexport function containerSizeNotCompatibleWithAutosize(name: 'width' | 'height') {\n const uName = name == 'width' ? 'Width' : 'Height';\n const fitDirection = name == 'width' ? 'x' : 'y';\n return `${uName} \"container\" only works well with autosize \"fit\" or \"fit-${fitDirection}\".`;\n}\n\nexport function droppingFit(channel?: PositionScaleChannel) {\n return channel\n ? `Dropping \"fit-${channel}\" because spec has discrete ${getSizeChannel(channel)}.`\n : `Dropping \"fit\" because spec has discrete size.`;\n}\n\n// VIEW SIZE\n\nexport function unknownField(channel: Channel) {\n return `Unknown field for ${channel}. Cannot calculate view size.`;\n}\n\n// SELECTION\nexport function cannotProjectOnChannelWithoutField(channel: Channel) {\n return `Cannot project a selection on encoding channel \"${channel}\", which has no field.`;\n}\n\nexport function cannotProjectAggregate(channel: Channel, aggregate: Aggregate | HiddenCompositeAggregate) {\n return `Cannot project a selection on encoding channel \"${channel}\" as it uses an aggregate function (\"${aggregate}\").`;\n}\n\nexport function nearestNotSupportForContinuous(mark: string) {\n return `The \"nearest\" transform is not supported for ${mark} marks.`;\n}\n\nexport function selectionNotSupported(mark: CompositeMark) {\n return `Selection not supported for ${mark} yet.`;\n}\n\nexport function selectionNotFound(name: string) {\n return `Cannot find a selection named \"${name}\".`;\n}\n\nexport const SCALE_BINDINGS_CONTINUOUS =\n 'Scale bindings are currently only supported for scales with unbinned, continuous domains.';\n\nexport const LEGEND_BINDINGS_MUST_HAVE_PROJECTION =\n 'Legend bindings are only supported for selections over an individual field or encoding channel.';\nexport function noSameUnitLookup(name: string) {\n return (\n `Cannot define and lookup the \"${name}\" selection in the same view. ` +\n `Try moving the lookup into a second, layered view?`\n );\n}\n\nexport const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.';\n\nexport const INTERVAL_INITIALIZED_WITH_X_Y = 'Interval selections should be initialized using \"x\" and/or \"y\" keys.';\n\n// REPEAT\nexport function noSuchRepeatedValue(field: string) {\n return `Unknown repeated value \"${field}\".`;\n}\n\nexport function columnsNotSupportByRowCol(type: 'facet' | 'repeat') {\n return `The \"columns\" property cannot be used when \"${type}\" has nested row/column.`;\n}\n\n// CONCAT / REPEAT\nexport const CONCAT_CANNOT_SHARE_AXIS =\n 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).';\n\n// DATA\nexport function unrecognizedParse(p: string) {\n return `Unrecognized parse \"${p}\".`;\n}\n\nexport function differentParse(field: string, local: string, ancestor: string) {\n return `An ancestor parsed field \"${field}\" as ${ancestor} but a child wants to parse the field as ${local}.`;\n}\n\nexport const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.';\n\n// TRANSFORMS\nexport function invalidTransformIgnored(transform: any) {\n return `Ignoring an invalid transform: ${stringify(transform)}.`;\n}\n\nexport const NO_FIELDS_NEEDS_AS =\n 'If \"from.fields\" is not specified, \"as\" has to be a string that specifies the key to be used for the data from the secondary source.';\n\n// ENCODING & FACET\n\nexport function customFormatTypeNotAllowed(channel: ExtendedChannel) {\n return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`;\n}\n\nexport function projectionOverridden(opt: {parentProjection: Projection; projection: Projection}) {\n const {parentProjection, projection} = opt;\n return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(\n projection\n )}.`;\n}\n\nexport const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.';\n\nexport function primitiveChannelDef(\n channel: ExtendedChannel,\n type: 'string' | 'number' | 'boolean',\n value: Exclude\n) {\n return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`;\n}\n\nexport function invalidFieldType(type: Type) {\n return `Invalid field type \"${type}\".`;\n}\n\nexport function invalidFieldTypeForCountAggregate(type: Type, aggregate: Aggregate | string) {\n return `Invalid field type \"${type}\" for aggregate: \"${aggregate}\", using \"quantitative\" instead.`;\n}\n\nexport function invalidAggregate(aggregate: AggregateOp | string) {\n return `Invalid aggregation operator \"${aggregate}\".`;\n}\n\nexport function missingFieldType(channel: Channel, newType: Type) {\n return `Missing type for channel \"${channel}\", using \"${newType}\" instead.`;\n}\nexport function droppingColor(type: 'encoding' | 'property', opt: {fill?: boolean; stroke?: boolean}) {\n const {fill, stroke} = opt;\n return `Dropping color ${type} as the plot also has ${\n fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'\n }.`;\n}\n\nexport function emptyFieldDef(fieldDef: unknown, channel: ExtendedChannel) {\n return `Dropping ${stringify(\n fieldDef\n )} from channel \"${channel}\" since it does not contain any data field, datum, value, or signal.`;\n}\nexport function latLongDeprecated(channel: Channel, type: Type, newChannel: GeoPositionChannel) {\n return `${channel}-encoding with type ${type} is deprecated. Replacing with ${newChannel}-encoding.`;\n}\n\nexport const LINE_WITH_VARYING_SIZE =\n 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.';\n\nexport function incompatibleChannel(\n channel: ExtendedChannel,\n markOrFacet: Mark | 'facet' | CompositeMark,\n when?: string\n) {\n return `${channel} dropped as it is incompatible with \"${markOrFacet}\"${when ? ` when ${when}` : ''}.`;\n}\n\nexport function invalidEncodingChannel(channel: ExtendedChannel) {\n return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`;\n}\n\nexport function facetChannelShouldBeDiscrete(channel: FacetChannel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned).`;\n}\n\nexport function facetChannelDropped(channels: FacetChannel[]) {\n return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`;\n}\n\nexport function discreteChannelCannotEncode(channel: Channel, type: Type) {\n return `Using discrete channel \"${channel}\" to encode \"${type}\" field can be misleading as it does not encode ${\n type === 'ordinal' ? 'order' : 'magnitude'\n }.`;\n}\n\n// MARK\nexport function lineWithRange(hasX2: boolean, hasY2: boolean) {\n const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2';\n return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`;\n}\n\nexport function orientOverridden(original: string, actual: string) {\n return `Specified orient \"${original}\" overridden with \"${actual}\".`;\n}\n\n// SCALE\nexport const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN =\n 'Custom domain scale cannot be unioned with default field-based domain.';\n\nexport const RANGE_STEP_DEPRECATED = `Scale's \"rangeStep\" is deprecated and will be removed in Vega-Lite 5.0. Please use \"width\"/\"height\": {\"step\": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.`;\n\nexport function cannotUseScalePropertyWithNonColor(prop: string) {\n return `Cannot use the scale property \"${prop}\" with non-color channel.`;\n}\n\nexport function unaggregateDomainHasNoEffectForRawField(fieldDef: TypedFieldDef) {\n return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`;\n}\n\nexport function unaggregateDomainWithNonSharedDomainOp(aggregate: Aggregate | string) {\n return `Unaggregated domain not applicable for \"${aggregate}\" since it produces values outside the origin domain of the source data.`;\n}\n\nexport function unaggregatedDomainWithLogScale(fieldDef: TypedFieldDef) {\n return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`;\n}\n\nexport function cannotApplySizeToNonOrientedMark(mark: Mark) {\n return `Cannot apply size to non-oriented mark \"${mark}\".`;\n}\n\nexport function scaleTypeNotWorkWithChannel(channel: Channel, scaleType: ScaleType, defaultScaleType: ScaleType) {\n return `Channel \"${channel}\" does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\n\nexport function scaleTypeNotWorkWithFieldDef(scaleType: ScaleType, defaultScaleType: ScaleType) {\n return `FieldDef does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\n\nexport function scalePropertyNotWorkWithScaleType(scaleType: ScaleType, propName: string, channel: Channel) {\n return `${channel}-scale's \"${propName}\" is dropped as it does not work with ${scaleType} scale.`;\n}\n\nexport function scaleTypeNotWorkWithMark(mark: Mark, scaleType: ScaleType) {\n return `Scale type \"${scaleType}\" does not work with mark \"${mark}\".`;\n}\n\nexport function stepDropped(channel: 'width' | 'height') {\n return `The step for \"${channel}\" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`;\n}\n\nexport function mergeConflictingProperty(\n property: string | number | symbol,\n propertyOf: SplitParentProperty,\n v1: T,\n v2: T\n) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(\n v2\n )}). Using ${stringify(v1)}.`;\n}\n\nexport function mergeConflictingDomainProperty(property: 'domains', propertyOf: SplitParentProperty, v1: T, v2: T) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(\n v2\n )}). Using the union of the two domains.`;\n}\n\nexport function independentScaleMeansIndependentGuide(channel: Channel) {\n return `Setting the scale to be independent for \"${channel}\" means we also have to set the guide (axis or legend) to be independent.`;\n}\n\nexport function domainSortDropped(sort: VgSortField) {\n return `Dropping sort property ${stringify(\n sort\n )} as unioned domains only support boolean or op \"count\", \"min\", and \"max\".`;\n}\n\nexport const MORE_THAN_ONE_SORT =\n 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.';\n\nexport const FACETED_INDEPENDENT_DIFFERENT_SOURCES =\n 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.';\n\nexport const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES =\n 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.';\n\nexport const FACETED_INDEPENDENT_SAME_SOURCE =\n 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.';\n\n// AXIS\nexport const INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.';\n\n// STACK\nexport function cannotStackRangedMark(channel: Channel) {\n return `Cannot stack \"${channel}\" if there is already \"${channel}2\".`;\n}\n\nexport function cannotStackNonLinearScale(scaleType: ScaleType) {\n return `Cannot stack non-linear scale (${scaleType}).`;\n}\n\nexport function stackNonSummativeAggregate(aggregate: Aggregate | string) {\n return `Stacking is applied even though the aggregate function is non-summative (\"${aggregate}\").`;\n}\n\n// TIMEUNIT\nexport function invalidTimeUnit(unitName: string, value: string | number) {\n return `Invalid ${unitName}: ${stringify(value)}.`;\n}\n\nexport function droppedDay(d: DateTime | DateTimeExpr) {\n return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`;\n}\n\nexport function errorBarCenterAndExtentAreNotNeeded(center: ErrorBarCenter, extent: ErrorBarExtent) {\n return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${\n extent && center ? 'are ' : 'is '\n }not needed when data are aggregated.`;\n}\n\nexport function errorBarCenterIsUsedWithWrongExtent(\n center: ErrorBarCenter,\n extent: ErrorBarExtent,\n mark: 'errorbar' | 'errorband'\n) {\n return `${center} is not usually used with ${extent} for ${mark}.`;\n}\n\nexport function errorBarContinuousAxisHasCustomizedAggregate(\n aggregate: Aggregate | string,\n compositeMark: CompositeMark\n) {\n return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`;\n}\n\nexport function errorBand1DNotSupport(property: 'interpolate' | 'tension') {\n return `1D error band does not support ${property}.`;\n}\n\n// CHANNEL\nexport function channelRequiredForBinned(channel: Channel) {\n return `Channel ${channel} is required for \"binned\" bin.`;\n}\n\nexport function channelShouldNotBeUsedForBinned(channel: ExtendedChannel) {\n return `Channel ${channel} should not be used with \"binned\" bin.`;\n}\n\nexport function domainRequiredForThresholdScale(channel: ScaleChannel) {\n return `Domain for ${channel} is required for threshold scale.`;\n}\n","/**\n * Vega-Lite's singleton logger utility.\n */\n\nimport {Debug, Error as ErrorLevel, Info, logger, LoggerInterface, Warn} from 'vega-util';\nexport * as message from './message';\n\n/**\n * Main (default) Vega Logger instance for Vega-Lite.\n */\nconst main = logger(Warn);\nlet current: LoggerInterface = main;\n\n/**\n * Logger tool for checking if the code throws correct warning.\n */\nexport class LocalLogger implements LoggerInterface {\n public warns: any[] = [];\n public infos: any[] = [];\n public debugs: any[] = [];\n\n #level: number = Warn;\n\n public level(): number;\n public level(_: number): this;\n public level(_?: number) {\n if (_) {\n this.#level = _;\n return this;\n }\n return this.#level;\n }\n\n public warn(...args: readonly any[]) {\n if (this.#level >= Warn) this.warns.push(...args);\n return this;\n }\n\n public info(...args: readonly any[]) {\n if (this.#level >= Info) this.infos.push(...args);\n return this;\n }\n\n public debug(...args: readonly any[]) {\n if (this.#level >= Debug) this.debugs.push(...args);\n return this;\n }\n\n public error(...args: readonly any[]): this {\n if (this.#level >= ErrorLevel) throw Error(...args);\n return this;\n }\n}\n\nexport function wrap(f: (logger: LocalLogger) => void) {\n return () => {\n current = new LocalLogger();\n f(current as LocalLogger);\n reset();\n };\n}\n\n/**\n * Set the singleton logger to be a custom logger.\n */\nexport function set(newLogger: LoggerInterface) {\n current = newLogger;\n return current;\n}\n\n/**\n * Reset the main logger to use the default Vega Logger.\n */\nexport function reset() {\n current = main;\n return current;\n}\n\nexport function error(...args: readonly any[]) {\n current.error(...args);\n}\n\nexport function warn(...args: readonly any[]) {\n current.warn(...args);\n}\n\nexport function info(...args: readonly any[]) {\n current.info(...args);\n}\n\nexport function debug(...args: readonly any[]) {\n current.debug(...args);\n}\n","// DateTime definition object\n\nimport {isNumber, isObject} from 'vega-util';\nimport * as log from './log';\nimport {TIMEUNIT_PARTS} from './timeunit';\nimport {duplicate, isNumeric, keys} from './util';\n\n/**\n * @minimum 1\n * @maximum 12\n * @TJS-type integer\n */\nexport type Month = number;\n\n/**\n * @minimum 1\n * @maximum 7\n */\nexport type Day = number;\n\n/**\n * Object for defining datetime in Vega-Lite Filter.\n * If both month and quarter are provided, month has higher precedence.\n * `day` cannot be combined with other date.\n * We accept string for month and day names.\n */\nexport interface DateTime {\n /**\n * Integer value representing the year.\n * @TJS-type integer\n */\n year?: number;\n\n /**\n * Integer value representing the quarter of the year (from 1-4).\n * @minimum 1\n * @maximum 4\n * @TJS-type integer\n */\n quarter?: number;\n\n /**\n * One of:\n * (1) integer value representing the month from `1`-`12`. `1` represents January;\n * (2) case-insensitive month name (e.g., `\"January\"`);\n * (3) case-insensitive, 3-character short month name (e.g., `\"Jan\"`).\n */\n month?: Month | string;\n\n /**\n * Integer value representing the date (day of the month) from 1-31.\n * @minimum 1\n * @maximum 31\n * @TJS-type integer\n */\n date?: number;\n\n /**\n * Value representing the day of a week. This can be one of:\n * (1) integer value -- `1` represents Monday;\n * (2) case-insensitive day name (e.g., `\"Monday\"`);\n * (3) case-insensitive, 3-character short day name (e.g., `\"Mon\"`).\n *\n * **Warning:** A DateTime definition object with `day`** should not be combined with `year`, `quarter`, `month`, or `date`.\n */\n day?: Day | string;\n\n /**\n * Integer value representing the hour of a day from 0-23.\n * @minimum 0\n * @maximum 24\n * @TJS-type integer\n */\n hours?: number;\n\n /**\n * Integer value representing the minute segment of time from 0-59.\n * @minimum 0\n * @maximum 60\n * @TJS-type integer\n */\n minutes?: number;\n\n /**\n * Integer value representing the second segment (0-59) of a time value\n * @minimum 0\n * @maximum 60\n * @TJS-type integer\n */\n seconds?: number;\n\n /**\n * Integer value representing the millisecond segment of time.\n * @minimum 0\n * @maximum 1000\n * @TJS-type integer\n */\n milliseconds?: number;\n\n /**\n * A boolean flag indicating if date time is in utc time. If false, the date time is in local time\n */\n utc?: boolean;\n}\n\n/**\n * Internal Object for defining datetime expressions.\n * This is an expression version of DateTime.\n * If both month and quarter are provided, month has higher precedence.\n * `day` cannot be combined with other date.\n */\nexport interface DateTimeExpr {\n year?: string;\n quarter?: string;\n month?: string;\n date?: string;\n day?: string;\n hours?: string;\n minutes?: string;\n seconds?: string;\n milliseconds?: string;\n utc?: boolean;\n}\n\nexport function isDateTime(o: any): o is DateTime {\n if (o && isObject(o)) {\n for (const part of TIMEUNIT_PARTS) {\n if (part in o) {\n return true;\n }\n }\n }\n return false;\n}\n\nexport const MONTHS = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december'\n];\nexport const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3));\n\nexport const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];\nexport const SHORT_DAYS = DAYS.map(d => d.substr(0, 3));\n\nfunction normalizeQuarter(q: number | string): number {\n if (isNumeric(q)) {\n q = +q;\n }\n\n if (isNumber(q)) {\n if (q > 4) {\n log.warn(log.message.invalidTimeUnit('quarter', q));\n }\n // We accept 1-based quarter, so need to readjust to 0-based quarter\n return q - 1;\n } else {\n // Invalid quarter\n throw new Error(log.message.invalidTimeUnit('quarter', q));\n }\n}\n\nfunction normalizeMonth(m: string | number): number {\n if (isNumeric(m)) {\n m = +m;\n }\n\n if (isNumber(m)) {\n // We accept 1-based month, so need to readjust to 0-based month\n return m - 1;\n } else {\n const lowerM = m.toLowerCase();\n const monthIndex = MONTHS.indexOf(lowerM);\n if (monthIndex !== -1) {\n return monthIndex; // 0 for january, ...\n }\n const shortM = lowerM.substr(0, 3);\n const shortMonthIndex = SHORT_MONTHS.indexOf(shortM);\n if (shortMonthIndex !== -1) {\n return shortMonthIndex;\n }\n\n // Invalid month\n throw new Error(log.message.invalidTimeUnit('month', m));\n }\n}\n\nfunction normalizeDay(d: string | number): number {\n if (isNumeric(d)) {\n d = +d;\n }\n\n if (isNumber(d)) {\n // mod so that this can be both 0-based where 0 = sunday\n // and 1-based where 7=sunday\n return d % 7;\n } else {\n const lowerD = d.toLowerCase();\n const dayIndex = DAYS.indexOf(lowerD);\n if (dayIndex !== -1) {\n return dayIndex; // 0 for january, ...\n }\n const shortD = lowerD.substr(0, 3);\n const shortDayIndex = SHORT_DAYS.indexOf(shortD);\n if (shortDayIndex !== -1) {\n return shortDayIndex;\n }\n // Invalid day\n throw new Error(log.message.invalidTimeUnit('day', d));\n }\n}\n\n/**\n * @param d the date.\n * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime.\n * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds]\n */\nfunction dateTimeParts(d: DateTime | DateTimeExpr, normalize: boolean) {\n const parts: (string | number)[] = [];\n\n if (normalize && d.day !== undefined) {\n if (keys(d).length > 1) {\n log.warn(log.message.droppedDay(d));\n d = duplicate(d);\n delete d.day;\n }\n }\n\n if (d.year !== undefined) {\n parts.push(d.year);\n } else {\n // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega\n // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year).\n parts.push(2012);\n }\n\n if (d.month !== undefined) {\n const month = normalize ? normalizeMonth(d.month) : d.month;\n parts.push(month);\n } else if (d.quarter !== undefined) {\n const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter;\n parts.push(isNumber(quarter) ? quarter * 3 : quarter + '*3');\n } else {\n parts.push(0); // months start at zero in JS\n }\n\n if (d.date !== undefined) {\n parts.push(d.date);\n } else if (d.day !== undefined) {\n // HACK: Day only works as a standalone unit\n // This is only correct because we always set year to 2006 for day\n const day = normalize ? normalizeDay(d.day) : d.day;\n parts.push(isNumber(day) ? day + 1 : day + '+1');\n } else {\n parts.push(1); // Date starts at 1 in JS\n }\n\n // Note: can't use TimeUnit enum here as importing it will create\n // circular dependency problem!\n for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds'] as const) {\n const unit = d[timeUnit];\n parts.push(typeof unit === 'undefined' ? 0 : unit);\n }\n\n return parts;\n}\n\n/**\n * Return Vega expression for a date time.\n *\n * @param d the date time.\n * @returns the Vega expression.\n */\nexport function dateTimeToExpr(d: DateTime) {\n const parts: (string | number)[] = dateTimeParts(d, true);\n\n const string = parts.join(', ');\n\n if (d.utc) {\n return `utc(${string})`;\n } else {\n return `datetime(${string})`;\n }\n}\n\n/**\n * Return Vega expression for a date time expression.\n *\n * @param d the internal date time object with expression.\n * @returns the Vega expression.\n */\nexport function dateTimeExprToExpr(d: DateTimeExpr) {\n const parts: (string | number)[] = dateTimeParts(d, false);\n\n const string = parts.join(', ');\n\n if (d.utc) {\n return `utc(${string})`;\n } else {\n return `datetime(${string})`;\n }\n}\n\n/**\n * @param d the date time.\n * @returns the timestamp.\n */\nexport function dateTimeToTimestamp(d: DateTime) {\n const parts: (string | number)[] = dateTimeParts(d, true);\n\n if (d.utc) {\n return +new Date(Date.UTC(...(parts as [any, any])));\n } else {\n return +new Date(...(parts as [any]));\n }\n}\n","import stringify from 'fast-json-stable-stringify';\nimport {isObject, isString} from 'vega-util';\nimport {DateTimeExpr, dateTimeExprToExpr} from './datetime';\nimport {accessPathWithDatum, keys, varName} from './util';\n\n/** Time Unit that only corresponds to only one part of Date objects. */\nexport const LOCAL_SINGLE_TIMEUNIT_INDEX = {\n year: 1,\n quarter: 1,\n month: 1,\n week: 1,\n day: 1,\n dayofyear: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n} as const;\n\nexport type LocalSingleTimeUnit = keyof typeof LOCAL_SINGLE_TIMEUNIT_INDEX;\n\nexport const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX);\n\nexport function isLocalSingleTimeUnit(timeUnit: string): timeUnit is LocalSingleTimeUnit {\n return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit];\n}\n\nexport const UTC_SINGLE_TIMEUNIT_INDEX = {\n utcyear: 1,\n utcquarter: 1,\n utcmonth: 1,\n utcweek: 1,\n utcday: 1,\n utcdayofyear: 1,\n utcdate: 1,\n utchours: 1,\n utcminutes: 1,\n utcseconds: 1,\n utcmilliseconds: 1\n} as const;\n\nexport type UtcSingleTimeUnit = keyof typeof UTC_SINGLE_TIMEUNIT_INDEX;\n\nexport type SingleTimeUnit = LocalSingleTimeUnit | UtcSingleTimeUnit;\n\nexport const LOCAL_MULTI_TIMEUNIT_INDEX = {\n yearquarter: 1,\n yearquartermonth: 1,\n\n yearmonth: 1,\n yearmonthdate: 1,\n yearmonthdatehours: 1,\n yearmonthdatehoursminutes: 1,\n yearmonthdatehoursminutesseconds: 1,\n\n yearweek: 1,\n yearweekday: 1,\n yearweekdayhours: 1,\n yearweekdayhoursminutes: 1,\n yearweekdayhoursminutesseconds: 1,\n\n yeardayofyear: 1,\n\n quartermonth: 1,\n\n monthdate: 1,\n monthdatehours: 1,\n monthdatehoursminutes: 1,\n monthdatehoursminutesseconds: 1,\n\n weekday: 1,\n weeksdayhours: 1,\n weekdayhoursminutes: 1,\n weekdayhoursminutesseconds: 1,\n\n dayhours: 1,\n dayhoursminutes: 1,\n dayhoursminutesseconds: 1,\n\n hoursminutes: 1,\n hoursminutesseconds: 1,\n\n minutesseconds: 1,\n\n secondsmilliseconds: 1\n} as const;\n\nexport type LocalMultiTimeUnit = keyof typeof LOCAL_MULTI_TIMEUNIT_INDEX;\n\nexport const UTC_MULTI_TIMEUNIT_INDEX = {\n utcyearquarter: 1,\n utcyearquartermonth: 1,\n\n utcyearmonth: 1,\n utcyearmonthdate: 1,\n utcyearmonthdatehours: 1,\n utcyearmonthdatehoursminutes: 1,\n utcyearmonthdatehoursminutesseconds: 1,\n\n utcyearweek: 1,\n utcyearweekday: 1,\n utcyearweekdayhours: 1,\n utcyearweekdayhoursminutes: 1,\n utcyearweekdayhoursminutesseconds: 1,\n\n utcyeardayofyear: 1,\n\n utcquartermonth: 1,\n\n utcmonthdate: 1,\n utcmonthdatehours: 1,\n utcmonthdatehoursminutes: 1,\n utcmonthdatehoursminutesseconds: 1,\n\n utcweekday: 1,\n utcweeksdayhours: 1,\n utcweekdayhoursminutes: 1,\n utcweekdayhoursminutesseconds: 1,\n\n utcdayhours: 1,\n utcdayhoursminutes: 1,\n utcdayhoursminutesseconds: 1,\n\n utchoursminutes: 1,\n utchoursminutesseconds: 1,\n\n utcminutesseconds: 1,\n\n utcsecondsmilliseconds: 1\n} as const;\n\nexport type UtcMultiTimeUnit = keyof typeof UTC_MULTI_TIMEUNIT_INDEX;\n\nexport type MultiTimeUnit = LocalMultiTimeUnit | UtcMultiTimeUnit;\n\nexport type LocalTimeUnit = LocalSingleTimeUnit | LocalMultiTimeUnit;\nexport type UtcTimeUnit = UtcSingleTimeUnit | UtcMultiTimeUnit;\n\nexport function isUTCTimeUnit(t: string): t is UtcTimeUnit {\n return t.startsWith('utc');\n}\n\nexport function getLocalTimeUnit(t: UtcTimeUnit): LocalTimeUnit {\n return t.substr(3) as LocalTimeUnit;\n}\n\nexport type TimeUnit = SingleTimeUnit | MultiTimeUnit;\n\nexport type TimeUnitFormat =\n | 'year'\n | 'year-month'\n | 'year-month-date'\n | 'quarter'\n | 'month'\n | 'date'\n | 'week'\n | 'day'\n | 'hours'\n | 'hours-minutes'\n | 'minutes'\n | 'seconds'\n | 'milliseconds';\n\nexport interface TimeUnitParams {\n /**\n * Defines how date-time values should be binned.\n */\n unit?: TimeUnit;\n\n /**\n * If no `unit` is specified, maxbins is used to infer time units.\n */\n maxbins?: number;\n\n /**\n * The number of steps between bins, in terms of the least\n * significant unit provided.\n */\n step?: number;\n\n /**\n * True to use UTC timezone. Equivalent to using a `utc` prefixed `TimeUnit`.\n */\n utc?: boolean;\n}\n\n// matches vega time unit format specifier\nexport type TimeFormatConfig = Partial>;\n\n// In order of increasing specificity\nexport const VEGALITE_TIMEFORMAT: TimeFormatConfig = {\n 'year-month': '%b %Y ',\n 'year-month-date': '%b %d, %Y '\n};\n\nexport function getTimeUnitParts(timeUnit: TimeUnit) {\n const parts: LocalSingleTimeUnit[] = [];\n\n for (const part of TIMEUNIT_PARTS) {\n if (containsTimeUnit(timeUnit, part)) {\n parts.push(part);\n }\n }\n\n return parts;\n}\n\n/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */\nexport function containsTimeUnit(fullTimeUnit: TimeUnit, timeUnit: TimeUnit) {\n const index = fullTimeUnit.indexOf(timeUnit);\n\n if (index < 0) {\n return false;\n }\n\n // exclude milliseconds\n if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') {\n return false;\n }\n\n // exclude dayofyear\n if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') {\n return false;\n }\n if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') {\n return false;\n }\n\n return true;\n}\n\n/**\n * Returns Vega expression for a given timeUnit and fieldRef\n */\nexport function fieldExpr(fullTimeUnit: TimeUnit, field: string, {end}: {end: boolean} = {end: false}): string {\n const fieldRef = accessPathWithDatum(field);\n\n const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : '';\n\n function func(timeUnit: TimeUnit) {\n if (timeUnit === 'quarter') {\n // quarter starting at 0 (0,3,6,9).\n return `(${utc}quarter(${fieldRef})-1)`;\n } else {\n return `${utc}${timeUnit}(${fieldRef})`;\n }\n }\n\n let lastTimeUnit: TimeUnit;\n\n const dateExpr: DateTimeExpr = {};\n\n for (const part of TIMEUNIT_PARTS) {\n if (containsTimeUnit(fullTimeUnit, part)) {\n dateExpr[part] = func(part);\n lastTimeUnit = part;\n }\n }\n\n if (end) {\n dateExpr[lastTimeUnit] += '+1';\n }\n\n return dateTimeExprToExpr(dateExpr);\n}\n\nexport function timeUnitSpecifierExpression(timeUnit: TimeUnit) {\n if (!timeUnit) {\n return undefined;\n }\n\n const timeUnitParts = getTimeUnitParts(timeUnit);\n return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`;\n}\n\n/**\n * Returns the signal expression used for axis labels for a time unit.\n */\nexport function formatExpression(timeUnit: TimeUnit, field: string, isUTCScale: boolean): string {\n if (!timeUnit) {\n return undefined;\n }\n\n const expr = timeUnitSpecifierExpression(timeUnit);\n\n // We only use utcFormat for utc scale\n // For utc time units, the data is already converted as a part of timeUnit transform.\n // Thus, utc time units should use timeFormat to avoid shifting the time twice.\n const utc = isUTCScale || isUTCTimeUnit(timeUnit);\n\n return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`;\n}\n\nexport function normalizeTimeUnit(timeUnit: TimeUnit | TimeUnitParams): TimeUnitParams {\n if (!timeUnit) {\n return undefined;\n }\n\n let params: TimeUnitParams;\n if (isString(timeUnit)) {\n params = {\n unit: timeUnit\n };\n } else if (isObject(timeUnit)) {\n params = {\n ...timeUnit,\n ...(timeUnit.unit ? {unit: timeUnit.unit} : {})\n };\n }\n\n if (isUTCTimeUnit(params.unit)) {\n params.utc = true;\n params.unit = getLocalTimeUnit(params.unit);\n }\n\n return params;\n}\n\nexport function timeUnitToString(tu: TimeUnit | TimeUnitParams) {\n const {utc, ...rest} = normalizeTimeUnit(tu);\n\n if (rest.unit) {\n return (\n (utc ? 'utc' : '') +\n keys(rest)\n .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`))\n .join('')\n );\n } else {\n // when maxbins is specified instead of units\n return (\n (utc ? 'utc' : '') +\n 'timeunit' +\n keys(rest)\n .map(p => varName(`_${p}_${rest[p]}`))\n .join('')\n );\n }\n}\n","import {\n AggregateOp,\n BandScale,\n BaseScale,\n BinOrdinalScale,\n ColorValueRef,\n Compare as VgCompare,\n ExprRef as VgExprRef,\n GeoShapeTransform as VgGeoShapeTransform,\n IdentityScale,\n LayoutAlign,\n LinearScale,\n LogScale,\n MarkConfig,\n NumericValueRef,\n OrdinalScale,\n PointScale,\n PowScale,\n ProjectionType,\n QuantileScale,\n QuantizeScale,\n RangeBand,\n RangeRaw,\n RangeScheme,\n ScaleData,\n ScaleDataRef,\n ScaledValueRef,\n ScaleMultiDataRef,\n ScaleMultiFieldsRef,\n SequentialScale,\n SignalRef,\n SortField as VgSortField,\n SqrtScale,\n SymLogScale,\n ThresholdScale,\n TimeInterval,\n TimeIntervalStep,\n TimeScale,\n Title as VgTitle,\n Transforms as VgTransform,\n UnionSortField as VgUnionSortField,\n Mark\n} from 'vega';\nimport {isArray} from 'vega-util';\nimport {Value} from './channeldef';\nimport {SortOrder} from './sort';\nimport {Flag, keys, Dict} from './util';\n\nexport {VgSortField, VgUnionSortField, VgCompare, VgTitle, LayoutAlign, ProjectionType, VgExprRef};\n\n// TODO: make recursive\ntype ExcludeMapped = {\n [P in keyof T]: Exclude;\n};\n\ntype ExcludeMappedButKeepSignals = {\n [P in keyof T]: SignalRef extends T[P] ? Exclude | SignalRef : Exclude;\n};\n\n// Remove ValueRefs from mapped types\nexport type ExcludeMappedValueRef = ExcludeMapped | NumericValueRef | ColorValueRef>;\n\nexport type ExcludeMappedValueRefButKeepSignal = ExcludeMappedButKeepSignals<\n T,\n ScaledValueRef | NumericValueRef | ColorValueRef\n>;\n\nexport interface VgData {\n name: string;\n source?: string;\n values?: any;\n format?: {\n type?: string;\n parse?: string | Dict;\n property?: string;\n feature?: string;\n mesh?: string;\n };\n url?: string;\n transform?: VgTransform[];\n}\n\nexport type VgScaleDataRefWithSort = ScaleDataRef & {\n sort?: VgSortField;\n};\n\nexport function isSignalRef(o: any): o is SignalRef {\n return o && !!o['signal'];\n}\n\n// TODO: add type of value (Make it VgValueRef {value?:V ...})\nexport interface VgValueRef {\n value?: Value | number[];\n field?:\n | string\n | {\n datum?: string;\n group?: string;\n parent?: string;\n };\n signal?: string;\n scale?: string; // TODO: object\n mult?: number;\n offset?: number | VgValueRef;\n band?: boolean | number | VgValueRef;\n test?: string;\n}\n\n// TODO: add vg prefix\nexport type VgScaleMultiDataRefWithSort = ScaleMultiDataRef & {\n fields: (any[] | VgScaleDataRefWithSort | SignalRef)[];\n sort?: VgUnionSortField;\n};\n\nexport type VgMultiFieldsRefWithSort = ScaleMultiFieldsRef & {\n sort?: VgUnionSortField;\n};\n\nexport type VgRange = RangeScheme | ScaleData | RangeBand | RangeRaw;\n\nexport function isVgRangeStep(range: VgRange): range is VgRangeStep {\n return !!range['step'];\n}\n\nexport interface VgRangeStep {\n step: number | SignalRef;\n}\n// Domains that are not a union of domains\nexport type VgNonUnionDomain = (null | string | number | boolean | SignalRef)[] | VgScaleDataRefWithSort | SignalRef;\n\nexport type VgDomain = BaseScale['domain'];\n\nexport type VgMarkGroup = any;\n\n/**\n * A combined type for any Vega scales that Vega-Lite can generate\n */\nexport type VgScale = Pick & {\n range?: RangeScheme | RangeBand | ScaleData; // different Vega scales have conflicting range, need to union them here\n nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef; // different Vega scales have conflicting range, need to union them here\n zero?: boolean | SignalRef; // LogScale only allow false, making the intersection type overly strict\n} & Omit<\n // Continuous\n Omit &\n Omit &\n Omit &\n Omit, 'type'> & // use partial so exponent is not required\n Omit &\n Omit &\n Omit &\n // Discretizing\n Omit &\n Omit &\n Omit &\n Omit &\n // Sequential\n Omit &\n // Discrete\n Omit &\n Omit &\n Omit,\n 'range' | 'nice' | 'zero'\n >;\n\nexport interface RowCol {\n row?: T;\n column?: T;\n}\n\nexport interface VgLayout {\n center?: boolean | RowCol;\n padding?: number | RowCol;\n headerBand?: number | RowCol;\n footerBand?: number | RowCol;\n\n titleAnchor?: 'start' | 'end' | RowCol<'start' | 'end'>;\n offset?:\n | number\n | {\n rowHeader?: number;\n rowFooter?: number;\n rowTitle?: number;\n columnHeader?: number;\n columnFooter?: number;\n columnTitle?: number;\n };\n bounds?: 'full' | 'flush';\n columns?: number | {signal: string};\n align?: LayoutAlign | RowCol;\n}\n\nexport function isDataRefUnionedDomain(domain: VgDomain): domain is VgScaleMultiDataRefWithSort {\n if (!isArray(domain)) {\n return 'fields' in domain && !('data' in domain);\n }\n return false;\n}\n\nexport function isFieldRefUnionDomain(domain: VgDomain): domain is VgMultiFieldsRefWithSort {\n if (!isArray(domain)) {\n return 'fields' in domain && 'data' in domain;\n }\n return false;\n}\n\nexport function isDataRefDomain(domain: VgDomain | any): domain is VgScaleDataRefWithSort {\n if (!isArray(domain)) {\n return 'field' in domain && 'data' in domain;\n }\n return false;\n}\n\nexport type VgEncodeChannel =\n | 'x'\n | 'x2'\n | 'xc'\n | 'width'\n | 'y'\n | 'y2'\n | 'yc'\n | 'height'\n | 'opacity'\n | 'fill'\n | 'fillOpacity'\n | 'stroke'\n | 'strokeWidth'\n | 'strokeCap'\n | 'strokeOpacity'\n | 'strokeDash'\n | 'strokeDashOffset'\n | 'strokeMiterLimit'\n | 'strokeJoin'\n | 'strokeOffset'\n | 'strokeForeground'\n | 'cursor'\n | 'clip'\n | 'size'\n | 'shape'\n | 'path'\n | 'innerRadius'\n | 'outerRadius'\n | 'startAngle'\n | 'endAngle'\n | 'interpolate'\n | 'tension'\n | 'orient'\n | 'url'\n | 'align'\n | 'baseline'\n | 'text'\n | 'dir'\n | 'ellipsis'\n | 'limit'\n | 'dx'\n | 'dy'\n | 'radius'\n | 'theta'\n | 'angle'\n | 'font'\n | 'fontSize'\n | 'fontWeight'\n | 'fontStyle'\n | 'tooltip'\n | 'href'\n | 'cursor'\n | 'defined'\n | 'cornerRadius'\n | 'cornerRadiusTopLeft'\n | 'cornerRadiusTopRight'\n | 'cornerRadiusBottomRight'\n | 'cornerRadiusBottomLeft'\n | 'scaleX'\n | 'scaleY';\n\nexport type VgEncodeEntry = Partial>;\n\n// TODO: make export interface VgEncodeEntry {\n// x?: VgValueRef\n// y?: VgValueRef\n// ...\n// color?: VgValueRef\n// ...\n// }\n\nexport type VgPostEncodingTransform = VgGeoShapeTransform;\n\nconst VG_MARK_CONFIG_INDEX: Flag = {\n aria: 1,\n description: 1,\n ariaRole: 1,\n ariaRoleDescription: 1,\n blend: 1,\n opacity: 1,\n fill: 1,\n fillOpacity: 1,\n stroke: 1,\n strokeCap: 1,\n strokeWidth: 1,\n strokeOpacity: 1,\n strokeDash: 1,\n strokeDashOffset: 1,\n strokeJoin: 1,\n strokeOffset: 1,\n strokeMiterLimit: 1,\n startAngle: 1,\n endAngle: 1,\n padAngle: 1,\n innerRadius: 1,\n outerRadius: 1,\n size: 1,\n shape: 1,\n interpolate: 1,\n tension: 1,\n orient: 1,\n align: 1,\n baseline: 1,\n text: 1,\n dir: 1,\n dx: 1,\n dy: 1,\n ellipsis: 1,\n limit: 1,\n radius: 1,\n theta: 1,\n angle: 1,\n font: 1,\n fontSize: 1,\n fontWeight: 1,\n fontStyle: 1,\n lineBreak: 1,\n lineHeight: 1,\n cursor: 1,\n href: 1,\n tooltip: 1,\n cornerRadius: 1,\n cornerRadiusTopLeft: 1,\n cornerRadiusTopRight: 1,\n cornerRadiusBottomLeft: 1,\n cornerRadiusBottomRight: 1,\n aspect: 1,\n width: 1,\n height: 1\n\n // commented below are vg channel that do not have mark config.\n // x: 1,\n // y: 1,\n // x2: 1,\n // y2: 1,\n\n // xc'|'yc'\n // clip: 1,\n // path: 1,\n // url: 1,\n};\n\nexport const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX);\n\nexport const VG_MARK_INDEX: Flag = {\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n};\n\n// Vega's cornerRadius channels.\nexport const VG_CORNERRADIUS_CHANNELS = [\n 'cornerRadius',\n 'cornerRadiusTopLeft',\n 'cornerRadiusTopRight',\n 'cornerRadiusBottomLeft',\n 'cornerRadiusBottomRight'\n] as const;\n\nexport interface VgComparator {\n field?: string | string[];\n order?: SortOrder | SortOrder[];\n}\n\nexport interface VgJoinAggregateTransform {\n type: 'joinaggregate';\n as?: string[];\n ops?: AggregateOp[];\n fields?: string[];\n groupby?: string[];\n}\n","import {SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FieldName, valueExpr, vgField} from './channeldef';\nimport {DateTime} from './datetime';\nimport {LogicalComposition} from './logical';\nimport {fieldExpr as timeUnitFieldExpr, normalizeTimeUnit, TimeUnit, TimeUnitParams} from './timeunit';\nimport {isSignalRef} from './vega.schema';\n\nexport type Predicate =\n // a) FieldPredicate (but we don't type FieldFilter here so the schema has no nesting\n // and thus the documentation shows all of the types clearly)\n | FieldEqualPredicate\n | FieldRangePredicate\n | FieldOneOfPredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate\n | FieldValidPredicate\n // b) Selection Predicate\n | SelectionPredicate\n // c) Vega Expression string\n | string;\n\nexport type FieldPredicate =\n | FieldEqualPredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate\n | FieldRangePredicate\n | FieldOneOfPredicate\n | FieldValidPredicate;\n\nexport interface SelectionPredicate {\n /**\n * Filter using a selection name or a logical composition of selection names.\n */\n selection: LogicalComposition;\n}\n\nexport function isSelectionPredicate(predicate: LogicalComposition): predicate is SelectionPredicate {\n return predicate?.['selection'];\n}\n\nexport interface FieldPredicateBase {\n // TODO: support aggregate\n\n /**\n * Time unit for the field to be tested.\n */\n timeUnit?: TimeUnit | TimeUnitParams;\n\n /**\n * Field to be tested.\n */\n field: FieldName;\n}\n\nexport interface FieldEqualPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be equal to.\n */\n equal: string | number | boolean | DateTime | SignalRef;\n}\n\nexport function isFieldEqualPredicate(predicate: any): predicate is FieldEqualPredicate {\n return predicate && !!predicate.field && predicate.equal !== undefined;\n}\n\nexport interface FieldLTPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be less than.\n */\n lt: string | number | DateTime | SignalRef;\n}\n\nexport function isFieldLTPredicate(predicate: any): predicate is FieldLTPredicate {\n return predicate && !!predicate.field && predicate.lt !== undefined;\n}\n\nexport interface FieldLTEPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be less than or equals to.\n */\n lte: string | number | DateTime | SignalRef;\n}\n\nexport function isFieldLTEPredicate(predicate: any): predicate is FieldLTEPredicate {\n return predicate && !!predicate.field && predicate.lte !== undefined;\n}\n\nexport interface FieldGTPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be greater than.\n */\n gt: string | number | DateTime | SignalRef;\n}\n\nexport function isFieldGTPredicate(predicate: any): predicate is FieldGTPredicate {\n return predicate && !!predicate.field && predicate.gt !== undefined;\n}\n\nexport interface FieldGTEPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be greater than or equals to.\n */\n gte: string | number | DateTime | SignalRef;\n}\n\nexport function isFieldGTEPredicate(predicate: any): predicate is FieldGTEPredicate {\n return predicate && !!predicate.field && predicate.gte !== undefined;\n}\n\nexport interface FieldRangePredicate extends FieldPredicateBase {\n /**\n * An array of inclusive minimum and maximum values\n * for a field value of a data item to be included in the filtered data.\n * @maxItems 2\n * @minItems 2\n */\n range: (number | DateTime | null | SignalRef)[] | SignalRef;\n}\n\nexport function isFieldRangePredicate(predicate: any): predicate is FieldRangePredicate {\n if (predicate && predicate.field) {\n if (isArray(predicate.range) && predicate.range.length === 2) {\n return true;\n } else if (isSignalRef(predicate.range)) {\n return true;\n }\n }\n return false;\n}\n\nexport interface FieldOneOfPredicate extends FieldPredicateBase {\n /**\n * A set of values that the `field`'s value should be a member of,\n * for a data item included in the filtered data.\n */\n oneOf: string[] | number[] | boolean[] | DateTime[];\n}\n\nexport interface FieldValidPredicate extends FieldPredicateBase {\n /**\n * If set to true the field's value has to be valid, meaning both not `null` and not [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN).\n */\n valid: boolean;\n}\n\nexport function isFieldOneOfPredicate(predicate: any): predicate is FieldOneOfPredicate {\n return (\n predicate && !!predicate.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility\n );\n}\n\nexport function isFieldValidPredicate(predicate: any): predicate is FieldValidPredicate {\n return predicate && !!predicate.field && predicate.valid !== undefined;\n}\n\nexport function isFieldPredicate(\n predicate: Predicate\n): predicate is\n | FieldOneOfPredicate\n | FieldEqualPredicate\n | FieldRangePredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate {\n return (\n isFieldOneOfPredicate(predicate) ||\n isFieldEqualPredicate(predicate) ||\n isFieldRangePredicate(predicate) ||\n isFieldLTPredicate(predicate) ||\n isFieldGTPredicate(predicate) ||\n isFieldLTEPredicate(predicate) ||\n isFieldGTEPredicate(predicate)\n );\n}\n\nfunction predicateValueExpr(v: number | string | boolean | DateTime | SignalRef, timeUnit: TimeUnit) {\n return valueExpr(v, {timeUnit, wrapTime: true});\n}\n\nfunction predicateValuesExpr(vals: (number | string | boolean | DateTime)[], timeUnit: TimeUnit) {\n return vals.map(v => predicateValueExpr(v, timeUnit));\n}\n\n// This method is used by Voyager. Do not change its behavior without changing Voyager.\nexport function fieldFilterExpression(predicate: FieldPredicate, useInRange = true) {\n const {field} = predicate;\n const timeUnit = normalizeTimeUnit(predicate.timeUnit)?.unit;\n const fieldExpr = timeUnit\n ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly.\n // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline\n // TODO: support utc\n 'time(' + timeUnitFieldExpr(timeUnit, field) + ')'\n : vgField(predicate, {expr: 'datum'});\n\n if (isFieldEqualPredicate(predicate)) {\n return fieldExpr + '===' + predicateValueExpr(predicate.equal, timeUnit);\n } else if (isFieldLTPredicate(predicate)) {\n const upper = predicate.lt;\n return `${fieldExpr}<${predicateValueExpr(upper, timeUnit)}`;\n } else if (isFieldGTPredicate(predicate)) {\n const lower = predicate.gt;\n return `${fieldExpr}>${predicateValueExpr(lower, timeUnit)}`;\n } else if (isFieldLTEPredicate(predicate)) {\n const upper = predicate.lte;\n return `${fieldExpr}<=${predicateValueExpr(upper, timeUnit)}`;\n } else if (isFieldGTEPredicate(predicate)) {\n const lower = predicate.gte;\n return `${fieldExpr}>=${predicateValueExpr(lower, timeUnit)}`;\n } else if (isFieldOneOfPredicate(predicate)) {\n return `indexof([${predicateValuesExpr(predicate.oneOf, timeUnit).join(',')}], ${fieldExpr}) !== -1`;\n } else if (isFieldValidPredicate(predicate)) {\n return fieldValidPredicate(fieldExpr, predicate.valid);\n } else if (isFieldRangePredicate(predicate)) {\n const {range} = predicate;\n const lower = isSignalRef(range) ? {signal: `${range.signal}[0]`} : range[0];\n const upper = isSignalRef(range) ? {signal: `${range.signal}[1]`} : range[1];\n\n if (lower !== null && upper !== null && useInRange) {\n return (\n 'inrange(' +\n fieldExpr +\n ', [' +\n predicateValueExpr(lower, timeUnit) +\n ', ' +\n predicateValueExpr(upper, timeUnit) +\n '])'\n );\n }\n\n const exprs = [];\n if (lower !== null) {\n exprs.push(`${fieldExpr} >= ${predicateValueExpr(lower, timeUnit)}`);\n }\n if (upper !== null) {\n exprs.push(`${fieldExpr} <= ${predicateValueExpr(upper, timeUnit)}`);\n }\n\n return exprs.length > 0 ? exprs.join(' && ') : 'true';\n }\n\n /* istanbul ignore next: it should never reach here */\n throw new Error(`Invalid field predicate: ${JSON.stringify(predicate)}`);\n}\n\nexport function fieldValidPredicate(fieldExpr: string, valid = true) {\n if (valid) {\n return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`;\n } else {\n return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`;\n }\n}\n\nexport function normalizePredicate(f: Predicate): Predicate {\n if (isFieldPredicate(f) && f.timeUnit) {\n return {\n ...f,\n timeUnit: normalizeTimeUnit(f.timeUnit)?.unit\n };\n }\n return f;\n}\n","import {keys} from './util';\n\n/**\n * Data type based on level of measurement\n */\nexport const Type = {\n quantitative: 'quantitative',\n ordinal: 'ordinal',\n temporal: 'temporal',\n nominal: 'nominal',\n geojson: 'geojson'\n} as const;\n\nexport type Type = keyof typeof Type;\n\nexport function isType(t: any): t is Type {\n return t in Type;\n}\n\nexport const QUANTITATIVE = Type.quantitative;\nexport const ORDINAL = Type.ordinal;\nexport const TEMPORAL = Type.temporal;\nexport const NOMINAL = Type.nominal;\n\nexport const GEOJSON = Type.geojson;\n\nexport type StandardType = 'quantitative' | 'ordinal' | 'temporal' | 'nominal';\n\nexport const TYPES = keys(Type);\n\n/**\n * Get full, lowercase type name for a given type.\n * @param type\n * @return Full type name.\n */\nexport function getFullName(type: Type | string): Type | undefined {\n if (type) {\n type = type.toLowerCase();\n switch (type) {\n case 'q':\n case QUANTITATIVE:\n return 'quantitative';\n case 't':\n case TEMPORAL:\n return 'temporal';\n case 'o':\n case ORDINAL:\n return 'ordinal';\n case 'n':\n case NOMINAL:\n return 'nominal';\n case GEOJSON:\n return 'geojson';\n }\n }\n // If we get invalid input, return undefined type.\n return undefined;\n}\n","import {\n RangeEnum,\n ScaleBins,\n ScaleInterpolateEnum,\n ScaleInterpolateParams,\n SignalRef,\n TimeInterval,\n TimeIntervalStep\n} from 'vega';\nimport {isString, toSet} from 'vega-util';\nimport * as CHANNEL from './channel';\nimport {Channel, isColorChannel} from './channel';\nimport {DateTime} from './datetime';\nimport * as log from './log';\nimport {SelectionExtent} from './selection';\nimport {NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL, Type} from './type';\nimport {contains, Flag, keys} from './util';\n\nexport const ScaleType = {\n // Continuous - Quantitative\n LINEAR: 'linear',\n LOG: 'log',\n POW: 'pow',\n SQRT: 'sqrt',\n SYMLOG: 'symlog',\n\n IDENTITY: 'identity',\n SEQUENTIAL: 'sequential',\n\n // Continuous - Time\n TIME: 'time',\n UTC: 'utc',\n\n // Discretizing scales\n QUANTILE: 'quantile',\n QUANTIZE: 'quantize',\n THRESHOLD: 'threshold',\n BIN_ORDINAL: 'bin-ordinal',\n\n // Discrete scales\n ORDINAL: 'ordinal',\n POINT: 'point',\n BAND: 'band'\n} as const;\n\ntype ValueOf = T[keyof T];\nexport type ScaleType = ValueOf;\n\n/**\n * Index for scale categories -- only scale of the same categories can be merged together.\n * Current implementation is trying to be conservative and avoid merging scale type that might not work together\n */\nexport const SCALE_CATEGORY_INDEX: Record = {\n linear: 'numeric',\n log: 'numeric',\n pow: 'numeric',\n sqrt: 'numeric',\n symlog: 'numeric',\n identity: 'numeric',\n sequential: 'numeric',\n time: 'time',\n utc: 'time',\n ordinal: 'ordinal',\n 'bin-ordinal': 'bin-ordinal', // TODO: should bin-ordinal support merging with other\n point: 'ordinal-position',\n band: 'ordinal-position',\n quantile: 'discretizing',\n quantize: 'discretizing',\n threshold: 'discretizing'\n};\n\nexport const SCALE_TYPES = keys(SCALE_CATEGORY_INDEX) as ScaleType[];\n\n/**\n * Whether the two given scale types can be merged together.\n */\nexport function scaleCompatible(scaleType1: ScaleType, scaleType2: ScaleType) {\n const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1];\n const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2];\n return (\n scaleCategory1 === scaleCategory2 ||\n (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') ||\n (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time')\n );\n}\n\n/**\n * Index for scale precedence -- high score = higher priority for merging.\n */\nconst SCALE_PRECEDENCE_INDEX: Record = {\n // numeric\n linear: 0,\n log: 1,\n pow: 1,\n sqrt: 1,\n symlog: 1,\n identity: 1,\n sequential: 1,\n // time\n time: 0,\n utc: 0,\n // ordinal-position -- these have higher precedence than continuous scales as they support more types of data\n point: 10,\n band: 11, // band has higher precedence as it is better for interaction\n // non grouped types\n ordinal: 0,\n 'bin-ordinal': 0,\n quantile: 0,\n quantize: 0,\n threshold: 0\n};\n\n/**\n * Return scale categories -- only scale of the same categories can be merged together.\n */\nexport function scaleTypePrecedence(scaleType: ScaleType): number {\n return SCALE_PRECEDENCE_INDEX[scaleType];\n}\n\nexport const CONTINUOUS_TO_CONTINUOUS_SCALES: ScaleType[] = ['linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc'];\nconst CONTINUOUS_TO_CONTINUOUS_INDEX = toSet(CONTINUOUS_TO_CONTINUOUS_SCALES);\n\nexport const QUANTITATIVE_SCALES: ScaleType[] = ['linear', 'log', 'pow', 'sqrt', 'symlog'];\n\nconst QUANTITATIVE_SCALES_INDEX = toSet(QUANTITATIVE_SCALES);\n\nexport function isQuantitative(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' {\n return type in QUANTITATIVE_SCALES_INDEX;\n}\n\nexport const CONTINUOUS_TO_DISCRETE_SCALES: ScaleType[] = ['quantile', 'quantize', 'threshold'];\nconst CONTINUOUS_TO_DISCRETE_INDEX = toSet(CONTINUOUS_TO_DISCRETE_SCALES);\n\nexport const CONTINUOUS_DOMAIN_SCALES: ScaleType[] = CONTINUOUS_TO_CONTINUOUS_SCALES.concat([\n 'quantile',\n 'quantize',\n 'threshold',\n 'sequential',\n 'identity'\n]);\nconst CONTINUOUS_DOMAIN_INDEX = toSet(CONTINUOUS_DOMAIN_SCALES);\n\nexport const DISCRETE_DOMAIN_SCALES: ScaleType[] = ['ordinal', 'bin-ordinal', 'point', 'band'];\nconst DISCRETE_DOMAIN_INDEX = toSet(DISCRETE_DOMAIN_SCALES);\n\nexport const TIME_SCALE_TYPES: ScaleType[] = ['time', 'utc'];\n\nexport function hasDiscreteDomain(type: ScaleType): type is 'ordinal' | 'bin-ordinal' | 'point' | 'band' {\n return type in DISCRETE_DOMAIN_INDEX;\n}\n\nexport function hasContinuousDomain(\n type: ScaleType\n): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' | 'quantile' | 'quantize' | 'threshold' {\n return type in CONTINUOUS_DOMAIN_INDEX;\n}\n\nexport function isContinuousToContinuous(\n type: ScaleType\n): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' {\n return type in CONTINUOUS_TO_CONTINUOUS_INDEX;\n}\n\nexport function isContinuousToDiscrete(type: ScaleType): type is 'quantile' | 'quantize' | 'threshold' {\n return type in CONTINUOUS_TO_DISCRETE_INDEX;\n}\n\nexport interface ScaleConfig {\n /**\n * If true, rounds numeric output values to integers.\n * This can be helpful for snapping to the pixel grid.\n * (Only available for `x`, `y`, and `size` scales.)\n */\n round?: boolean | SignalRef;\n\n /**\n * If true, values that exceed the data domain are clamped to either the minimum or maximum range value\n */\n clamp?: boolean | SignalRef;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales.\n *\n * __Default value:__\n * - `barBandPaddingInner` for bar marks (`0.1` by default)\n * - `rectBandPaddingInner` for rect and other marks (`0` by default)\n *\n * @minimum 0\n * @maximum 1\n */\n bandPaddingInner?: number | SignalRef;\n\n /**\n * Default outer padding for `x` and `y` band-ordinal scales.\n *\n * __Default value:__ `paddingInner/2` (which makes _width/height = number of unique values * step_)\n *\n * @minimum 0\n * @maximum 1\n */\n bandPaddingOuter?: number | SignalRef;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales of `\"bar\"` marks.\n *\n * __Default value:__ `0.1`\n *\n * @minimum 0\n * @maximum 1\n */\n barBandPaddingInner?: number | SignalRef;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales of `\"rect\"` marks.\n *\n * __Default value:__ `0`\n *\n * @minimum 0\n * @maximum 1\n */\n rectBandPaddingInner?: number | SignalRef;\n\n /**\n * Default padding for continuous scales.\n *\n * __Default:__ `5` for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.; `0` otherwise.\n *\n * @minimum 0\n */\n continuousPadding?: number | SignalRef;\n\n /**\n * Default outer padding for `x` and `y` point-ordinal scales.\n *\n * __Default value:__ `0.5` (which makes _width/height = number of unique values * step_)\n *\n * @minimum 0\n * @maximum 1\n */\n pointPadding?: number | SignalRef;\n\n /**\n * Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis.\n *\n * This is equivalent to setting `domain` to `\"unaggregate\"` for aggregated _quantitative_ fields by default.\n *\n * This property only works with aggregate functions that produce values within the raw data domain (`\"mean\"`, `\"average\"`, `\"median\"`, `\"q1\"`, `\"q3\"`, `\"min\"`, `\"max\"`). For other aggregations that produce values outside of the raw data domain (e.g. `\"count\"`, `\"sum\"`), this property is ignored.\n *\n * __Default value:__ `false`\n */\n useUnaggregatedDomain?: boolean;\n\n // nice should depends on type (quantitative or temporal), so\n // let's not make a config.\n\n // Configs for Range\n\n /**\n * The default max value for mapping quantitative fields to bar's size/bandSize.\n *\n * If undefined (default), we will use the axis's size (width or height) - 1.\n * @minimum 0\n */\n maxBandSize?: number;\n\n /**\n * The default min value for mapping quantitative fields to bar and tick's size/bandSize scale with zero=false.\n *\n * __Default value:__ `2`\n *\n * @minimum 0\n */\n minBandSize?: number;\n\n /**\n * The default max value for mapping quantitative fields to text's size/fontSize.\n *\n * __Default value:__ `40`\n *\n * @minimum 0\n */\n maxFontSize?: number;\n\n /**\n * The default min value for mapping quantitative fields to tick's size/fontSize scale with zero=false\n *\n * __Default value:__ `8`\n *\n * @minimum 0\n */\n minFontSize?: number;\n\n /**\n * Default minimum opacity for mapping a field to opacity.\n *\n * __Default value:__ `0.3`\n *\n * @minimum 0\n * @maximum 1\n */\n minOpacity?: number;\n\n /**\n * Default max opacity for mapping a field to opacity.\n *\n * __Default value:__ `0.8`\n *\n * @minimum 0\n * @maximum 1\n */\n maxOpacity?: number;\n\n /**\n * Default minimum value for point size scale with zero=false.\n *\n * __Default value:__ `9`\n *\n * @minimum 0\n */\n minSize?: number;\n\n /**\n * Default max value for point size scale.\n * @minimum 0\n */\n maxSize?: number;\n\n /**\n * Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks with zero=false.\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n minStrokeWidth?: number;\n\n /**\n * Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n maxStrokeWidth?: number;\n\n /**\n * Default range cardinality for [`quantile`](https://vega.github.io/vega-lite/docs/scale.html#quantile) scale.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n quantileCount?: number;\n\n /**\n * Default range cardinality for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n quantizeCount?: number;\n\n /**\n * Reverse x-scale by default (useful for right-to-left charts).\n */\n xReverse?: boolean | SignalRef;\n}\n\nexport const defaultScaleConfig: ScaleConfig = {\n pointPadding: 0.5,\n\n barBandPaddingInner: 0.1,\n rectBandPaddingInner: 0,\n\n minBandSize: 2,\n\n minFontSize: 8,\n maxFontSize: 40,\n\n minOpacity: 0.3,\n maxOpacity: 0.8,\n\n // FIXME: revise if these *can* become ratios of width/height step\n minSize: 9, // Point size is area. For square point, 9 = 3 pixel ^ 2, not too small!\n\n minStrokeWidth: 1,\n maxStrokeWidth: 4,\n quantileCount: 4,\n quantizeCount: 4\n};\n\nexport interface SchemeParams {\n /**\n * A color scheme name for ordinal scales (e.g., `\"category10\"` or `\"blues\"`).\n *\n * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.\n */\n name: string | SignalRef;\n\n /**\n * The extent of the color range to use. For example `[0.2, 1]` will rescale the color scheme such that color values in the range _[0, 0.2)_ are excluded from the scheme.\n */\n extent?: (number | SignalRef)[] | SignalRef;\n\n /**\n * The number of colors to use in the scheme. This can be useful for scale types such as `\"quantize\"`, which use the length of the scale range to determine the number of discrete bins for the scale domain.\n */\n count?: number | SignalRef;\n}\n\nexport type Domain =\n | (null | string | number | boolean | DateTime | SignalRef)[]\n | 'unaggregated'\n | SelectionExtent\n | SignalRef\n | DomainUnionWith;\n\nexport type Scheme = string | SchemeParams;\n\nexport function isExtendedScheme(scheme: Scheme | SignalRef): scheme is SchemeParams {\n return !isString(scheme) && !!scheme['name'];\n}\n\nexport function isSelectionDomain(domain: Domain): domain is SelectionExtent {\n return domain?.['selection'];\n}\n\nexport interface DomainUnionWith {\n /**\n * Customized domain values to be union with the field's values.\n *\n * 1) `domain` for _quantitative_ fields can take one of the following forms:\n *\n * - a two-element array with minimum and maximum values.\n * - an array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). (Alternatively, the `domainMid` property can be set for a diverging scale.)\n * - a string value `\"unaggregated\"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation.\n *\n * 2) `domain` for _temporal_ fields can be a two-element array minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime).\n *\n * 3) `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values.\n */\n unionWith: number[] | string[] | boolean[] | DateTime[];\n}\n\nexport function isDomainUnionWith(domain: Domain): domain is DomainUnionWith {\n return domain && domain['unionWith'];\n}\n\nexport interface Scale {\n /**\n * The type of scale. Vega-Lite supports the following categories of scale types:\n *\n * 1) [**Continuous Scales**](https://vega.github.io/vega-lite/docs/scale.html#continuous) -- mapping continuous domains to continuous output ranges ([`\"linear\"`](https://vega.github.io/vega-lite/docs/scale.html#linear), [`\"pow\"`](https://vega.github.io/vega-lite/docs/scale.html#pow), [`\"sqrt\"`](https://vega.github.io/vega-lite/docs/scale.html#sqrt), [`\"symlog\"`](https://vega.github.io/vega-lite/docs/scale.html#symlog), [`\"log\"`](https://vega.github.io/vega-lite/docs/scale.html#log), [`\"time\"`](https://vega.github.io/vega-lite/docs/scale.html#time), [`\"utc\"`](https://vega.github.io/vega-lite/docs/scale.html#utc).\n *\n * 2) [**Discrete Scales**](https://vega.github.io/vega-lite/docs/scale.html#discrete) -- mapping discrete domains to discrete ([`\"ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#ordinal)) or continuous ([`\"band\"`](https://vega.github.io/vega-lite/docs/scale.html#band) and [`\"point\"`](https://vega.github.io/vega-lite/docs/scale.html#point)) output ranges.\n *\n * 3) [**Discretizing Scales**](https://vega.github.io/vega-lite/docs/scale.html#discretizing) -- mapping continuous domains to discrete output ranges [`\"bin-ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#bin-ordinal), [`\"quantile\"`](https://vega.github.io/vega-lite/docs/scale.html#quantile), [`\"quantize\"`](https://vega.github.io/vega-lite/docs/scale.html#quantize) and [`\"threshold\"`](https://vega.github.io/vega-lite/docs/scale.html#threshold).\n *\n * __Default value:__ please see the [scale type table](https://vega.github.io/vega-lite/docs/scale.html#type).\n */\n type?: ScaleType;\n\n /**\n * Customized domain values in the form of constant values or dynamic values driven by a selection.\n *\n * 1) Constant `domain` for _quantitative_ fields can take one of the following forms:\n *\n * - A two-element array with minimum and maximum values. To create a diverging scale, this two-element array can be combined with the `domainMid` property.\n * - An array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n * - A string value `\"unaggregated\"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation.\n *\n * 2) Constant `domain` for _temporal_ fields can be a two-element array with minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime).\n *\n * 3) Constant `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values.\n *\n * 4) To combine (union) specified constant domain with the field's values, `domain` can be an object with a `unionWith` property that specify constant domain to be combined. For example, `domain: {unionWith: [0, 100]}` for a quantitative scale means that the scale domain always includes `[0, 100]`, but will include other values in the fields beyond `[0, 100]`.\n *\n * 5) Domain can also takes an object defining a field or encoding of a selection that [interactively determines](https://vega.github.io/vega-lite/docs/selection.html#scale-domains) the scale domain.\n */\n domain?:\n | (null | string | number | boolean | DateTime | SignalRef)[]\n | 'unaggregated'\n | SelectionExtent\n | DomainUnionWith\n | SignalRef;\n\n /**\n * Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint for [diverging color scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). The domainMid property is only intended for use with scales supporting continuous, piecewise domains.\n */\n domainMid?: number | SignalRef;\n\n /**\n * Sets the maximum value in the scale domain, overriding the `domain` property. This property is only intended for use with scales having continuous domains.\n */\n domainMax?: number | DateTime | SignalRef;\n\n /**\n * Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains.\n */\n domainMin?: number | DateTime | SignalRef;\n\n /**\n * If true, reverses the order of the scale range.\n * __Default value:__ `false`.\n */\n reverse?: boolean | SignalRef;\n\n /**\n * The range of the scale. One of:\n *\n * - A string indicating a [pre-defined named scale range](https://vega.github.io/vega-lite/docs/scale.html#range-config) (e.g., example, `\"symbol\"`, or `\"diverging\"`).\n *\n * - For [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous), two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a [piecewise scale](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n *\n * - For [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) and [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales, an array of desired output values or an object with a `field` property representing the range values. For example, if a field `color` contains CSS color names, we can set `range` to `{field: \"color\"}`.\n *\n * __Notes:__\n *\n * 1) For color scales you can also specify a color [`scheme`](https://vega.github.io/vega-lite/docs/scale.html#scheme) instead of `range`.\n *\n * 2) Any directly specified `range` for `x` and `y` channels will be ignored. Range can be customized via the view's corresponding [size](https://vega.github.io/vega-lite/docs/size.html) (`width` and `height`).\n */\n range?: RangeEnum | (number | string | number[] | SignalRef)[] | {field: string};\n\n /**\n * Sets the maximum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.\n */\n rangeMax?: number | string | SignalRef;\n\n /**\n * Sets the minimum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.\n */\n rangeMin?: number | string | SignalRef;\n\n // ordinal\n\n /**\n * A string indicating a color [scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme) name (e.g., `\"category10\"` or `\"blues\"`) or a [scheme parameter object](https://vega.github.io/vega-lite/docs/scale.html#scheme-params).\n *\n * Discrete color schemes may be used with [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) or [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales. Continuous color schemes are intended for use with color scales.\n *\n * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.\n */\n scheme?: string | SchemeParams | SignalRef;\n\n /**\n * The alignment of the steps within the scale range.\n *\n * This value must lie in the range `[0,1]`. A value of `0.5` indicates that the steps should be centered within the range. A value of `0` or `1` may be used to shift the bands to one side, say to position them adjacent to an axis.\n *\n * __Default value:__ `0.5`\n */\n align?: number | SignalRef;\n\n /**\n * Bin boundaries can be provided to scales as either an explicit array of bin boundaries or as a bin specification object. The legal values are:\n * - An [array](../types/#Array) literal of bin boundary values. For example, `[0, 5, 10, 15, 20]`. The array must include both starting and ending boundaries. The previous example uses five values to indicate a total of four bin intervals: [0-5), [5-10), [10-15), [15-20]. Array literals may include signal references as elements.\n * - A [bin specification object](https://vega.github.io/vega-lite/docs/scale.html#bins) that indicates the bin _step_ size, and optionally the _start_ and _stop_ boundaries.\n * - An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels.\n */\n // TODO: add - A [signal reference](../types/#Signal) that resolves to either an array or bin specification object.\n bins?: ScaleBins;\n\n /**\n * If `true`, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid.\n *\n * __Default value:__ `false`.\n */\n round?: boolean | SignalRef;\n\n /**\n * For _[continuous](https://vega.github.io/vega-lite/docs/scale.html#continuous)_ scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the `zero`, `nice`, `domainMin`, and `domainMax` properties.\n *\n * For _[band](https://vega.github.io/vega-lite/docs/scale.html#band)_ scales, shortcut for setting `paddingInner` and `paddingOuter` to the same value.\n *\n * For _[point](https://vega.github.io/vega-lite/docs/scale.html#point)_ scales, alias for `paddingOuter`.\n *\n * __Default value:__ For _continuous_ scales, derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `continuousPadding`.\n * For _band and point_ scales, see `paddingInner` and `paddingOuter`. By default, Vega-Lite sets padding such that _width/height = number of unique values * step_.\n *\n * @minimum 0\n */\n padding?: number | SignalRef;\n\n /**\n * The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].\n *\n * For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands).\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingInner`.\n *\n * @minimum 0\n * @maximum 1\n */\n paddingInner?: number | SignalRef;\n\n /**\n * The outer padding (spacing) at the ends of the range of band and point scales,\n * as a fraction of the step size. This value must lie in the range [0,1].\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingOuter` for band scales and `pointPadding` for point scales.\n * By default, Vega-Lite sets outer padding such that _width/height = number of unique values * step_.\n *\n * @minimum 0\n * @maximum 1\n */\n paddingOuter?: number | SignalRef;\n\n // typical\n /**\n * If `true`, values that exceed the data domain are clamped to either the minimum or maximum range value\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/config.html#scale-config)'s `clamp` (`true` by default).\n */\n clamp?: boolean | SignalRef;\n\n /**\n * Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of _[0.201479…, 0.996679…]_, a nice domain might be _[0.2, 1.0]_.\n *\n * For quantitative scales such as linear, `nice` can be either a boolean flag or a number. If `nice` is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.\n *\n * For temporal fields with time and utc scales, the `nice` value can be a string indicating the desired time interval. Legal values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and `\"year\"`. Alternatively, `time` and `utc` scales can accept an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}`, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries.\n *\n * __Default value:__ `true` for unbinned _quantitative_ fields; `false` otherwise.\n *\n */\n nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef;\n\n /**\n * The logarithm base of the `log` scale (default `10`).\n */\n base?: number | SignalRef;\n\n /**\n * The exponent of the `pow` scale.\n */\n exponent?: number | SignalRef;\n\n /**\n * A constant determining the slope of the symlog function around zero. Only used for `symlog` scales.\n *\n * __Default value:__ `1`\n */\n constant?: number | SignalRef;\n\n /**\n * If `true`, ensures that a zero baseline value is included in the scale domain.\n *\n * __Default value:__ `true` for x and y channels if the quantitative field is not binned and no custom `domain` is provided; `false` otherwise.\n *\n * __Note:__ Log, time, and utc scales do not support `zero`.\n */\n zero?: boolean | SignalRef;\n\n /**\n * The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include `rgb`, `hsl`, `hsl-long`, `lab`, `hcl`, `hcl-long`, `cubehelix` and `cubehelix-long` ('-long' variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued _type_ property and an optional numeric _gamma_ property applicable to rgb and cubehelix interpolators. For more, see the [d3-interpolate documentation](https://github.com/d3/d3-interpolate).\n *\n * * __Default value:__ `hcl`\n */\n interpolate?: ScaleInterpolateEnum | SignalRef | ScaleInterpolateParams;\n}\n\nconst SCALE_PROPERTY_INDEX: Flag = {\n type: 1,\n domain: 1,\n domainMax: 1,\n domainMin: 1,\n domainMid: 1,\n align: 1,\n range: 1,\n rangeMax: 1,\n rangeMin: 1,\n scheme: 1,\n bins: 1,\n // Other properties\n reverse: 1,\n round: 1,\n // quantitative / time\n clamp: 1,\n nice: 1,\n // quantitative\n base: 1,\n exponent: 1,\n constant: 1,\n interpolate: 1,\n zero: 1, // zero depends on domain\n // band/point\n padding: 1,\n paddingInner: 1,\n paddingOuter: 1\n};\n\nexport const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX);\n\nconst {\n type,\n domain,\n range,\n rangeMax,\n rangeMin,\n scheme,\n ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX\n} = SCALE_PROPERTY_INDEX;\n\nexport const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX);\n\nexport function scaleTypeSupportProperty(scaleType: ScaleType, propName: keyof Scale): boolean {\n switch (propName) {\n case 'type':\n case 'domain':\n case 'reverse':\n case 'range':\n return true;\n case 'scheme':\n case 'interpolate':\n return !contains(['point', 'band', 'identity'], scaleType);\n case 'bins':\n return !contains(['point', 'band', 'identity', 'ordinal'], scaleType);\n case 'round':\n return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point';\n case 'padding':\n case 'rangeMin':\n case 'rangeMax':\n return isContinuousToContinuous(scaleType) || contains(['point', 'band'], scaleType);\n case 'paddingOuter':\n case 'align':\n return contains(['point', 'band'], scaleType);\n case 'paddingInner':\n return scaleType === 'band';\n case 'domainMax':\n case 'domainMid':\n case 'domainMin':\n case 'clamp':\n return isContinuousToContinuous(scaleType);\n case 'nice':\n return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold';\n case 'exponent':\n return scaleType === 'pow';\n case 'base':\n return scaleType === 'log';\n case 'constant':\n return scaleType === 'symlog';\n case 'zero':\n return (\n hasContinuousDomain(scaleType) &&\n !contains(\n [\n 'log', // log scale cannot have zero value\n 'time',\n 'utc', // zero is not meaningful for time\n 'threshold', // threshold requires custom domain so zero does not matter\n 'quantile' // quantile depends on distribution so zero does not matter\n ],\n scaleType\n )\n );\n }\n}\n\n/**\n * Returns undefined if the input channel supports the input scale property name\n */\nexport function channelScalePropertyIncompatability(channel: Channel, propName: keyof Scale): string {\n switch (propName) {\n case 'interpolate':\n case 'scheme':\n case 'domainMid':\n if (!isColorChannel(channel)) {\n return log.message.cannotUseScalePropertyWithNonColor(channel);\n }\n return undefined;\n case 'align':\n case 'type':\n case 'bins':\n case 'domain':\n case 'domainMax':\n case 'domainMin':\n case 'range':\n case 'base':\n case 'exponent':\n case 'constant':\n case 'nice':\n case 'padding':\n case 'paddingInner':\n case 'paddingOuter':\n case 'rangeMax':\n case 'rangeMin':\n case 'reverse':\n case 'round':\n case 'clamp':\n case 'zero':\n return undefined; // GOOD!\n }\n}\n\nexport function scaleTypeSupportDataType(specifiedType: ScaleType, fieldDefType: Type): boolean {\n if (contains([ORDINAL, NOMINAL], fieldDefType)) {\n return specifiedType === undefined || hasDiscreteDomain(specifiedType);\n } else if (fieldDefType === TEMPORAL) {\n return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType);\n } else if (fieldDefType === QUANTITATIVE) {\n return contains(\n [\n ScaleType.LOG,\n ScaleType.POW,\n ScaleType.SQRT,\n ScaleType.SYMLOG,\n ScaleType.QUANTILE,\n ScaleType.QUANTIZE,\n ScaleType.THRESHOLD,\n ScaleType.LINEAR,\n undefined\n ],\n specifiedType\n );\n }\n\n return true;\n}\n\nexport function channelSupportScaleType(channel: Channel, scaleType: ScaleType): boolean {\n if (!CHANNEL.isScaleChannel(channel)) {\n return false;\n }\n switch (channel) {\n case CHANNEL.X:\n case CHANNEL.Y:\n case CHANNEL.THETA:\n case CHANNEL.RADIUS:\n return isContinuousToContinuous(scaleType) || contains(['band', 'point'], scaleType);\n case CHANNEL.SIZE: // TODO: size and opacity can support ordinal with more modification\n case CHANNEL.STROKEWIDTH:\n case CHANNEL.OPACITY:\n case CHANNEL.FILLOPACITY:\n case CHANNEL.STROKEOPACITY:\n case CHANNEL.ANGLE:\n // Although it generally doesn't make sense to use band with size and opacity,\n // it can also work since we use band: 0.5 to get midpoint.\n return (\n isContinuousToContinuous(scaleType) ||\n isContinuousToDiscrete(scaleType) ||\n contains(['band', 'point', 'ordinal'], scaleType)\n );\n case CHANNEL.COLOR:\n case CHANNEL.FILL:\n case CHANNEL.STROKE:\n return scaleType !== 'band'; // band does not make sense with color\n case CHANNEL.STROKEDASH:\n return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType);\n case CHANNEL.SHAPE:\n return scaleType === 'ordinal'; // shape = lookup only\n }\n}\n","/**\n * Utility files for producing Vega ValueRef for marks\n */\nimport {SignalRef} from 'vega';\nimport {isFunction, isString} from 'vega-util';\nimport {isCountingAggregateOp} from '../../../aggregate';\nimport {isBinned, isBinning} from '../../../bin';\nimport {Channel, getMainRangeChannel, PolarPositionChannel, PositionChannel, X, X2, Y2} from '../../../channel';\nimport {\n binRequiresRange,\n ChannelDef,\n DatumDef,\n FieldDef,\n FieldDefBase,\n FieldName,\n FieldRefOption,\n getBand,\n isDatumDef,\n isFieldDef,\n isFieldOrDatumDef,\n isTypedFieldDef,\n isValueDef,\n SecondaryChannelDef,\n SecondaryFieldDef,\n TypedFieldDef,\n Value,\n vgField\n} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {dateTimeToExpr, isDateTime} from '../../../datetime';\nimport * as log from '../../../log';\nimport {isPathMark, Mark, MarkDef} from '../../../mark';\nimport {fieldValidPredicate} from '../../../predicate';\nimport {hasDiscreteDomain, isContinuousToContinuous} from '../../../scale';\nimport {StackProperties} from '../../../stack';\nimport {TEMPORAL} from '../../../type';\nimport {contains} from '../../../util';\nimport {isSignalRef, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\n\nexport function midPointRefWithPositionInvalidTest(\n params: MidPointParams & {\n channel: PositionChannel | PolarPositionChannel;\n }\n) {\n const {channel, channelDef, markDef, scale, config} = params;\n const ref = midPoint(params);\n\n // Wrap to check if the positional value is invalid, if so, plot the point on the min value\n if (\n // Only this for field def without counting aggregate (as count wouldn't be null)\n isFieldDef(channelDef) &&\n !isCountingAggregateOp(channelDef.aggregate) &&\n // and only for continuous scale without zero (otherwise, null / invalid will be interpreted as zero, which doesn't cause layout problem)\n scale &&\n isContinuousToContinuous(scale.get('type')) &&\n scale.get('zero') === false\n ) {\n return wrapPositionInvalidTest({\n fieldDef: channelDef,\n channel,\n markDef,\n ref,\n config\n });\n }\n return ref;\n}\n\nexport function wrapPositionInvalidTest({\n fieldDef,\n channel,\n markDef,\n ref,\n config\n}: {\n fieldDef: FieldDef;\n channel: PositionChannel | PolarPositionChannel;\n markDef: MarkDef;\n ref: VgValueRef;\n config: Config;\n}): VgValueRef | VgValueRef[] {\n if (isPathMark(markDef.type)) {\n // path mark already use defined to skip points, no need to do it here.\n return ref;\n }\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid === null) {\n // if there is no invalid filter, don't do the invalid test\n return ref;\n }\n\n return [fieldInvalidTestValueRef(fieldDef, channel), ref];\n}\n\nexport function fieldInvalidTestValueRef(fieldDef: FieldDef, channel: PositionChannel | PolarPositionChannel) {\n const test = fieldInvalidPredicate(fieldDef, true);\n\n const mainChannel = getMainRangeChannel(channel) as PositionChannel | PolarPositionChannel; // we can cast here as the output can't be other things.\n const zeroValueRef =\n mainChannel === 'y'\n ? {field: {group: 'height'}}\n : // x / angle / radius can all use 0\n {value: 0};\n\n return {test, ...zeroValueRef};\n}\n\nexport function fieldInvalidPredicate(field: FieldName | FieldDef, invalid = true) {\n return fieldValidPredicate(isString(field) ? field : vgField(field, {expr: 'datum'}), !invalid);\n}\n\nexport function datumDefToExpr(datumDef: DatumDef) {\n const {datum} = datumDef;\n if (isDateTime(datum)) {\n return dateTimeToExpr(datum);\n }\n return `${JSON.stringify(datum)}`;\n}\n\nexport function valueRefForFieldOrDatumDef(\n fieldDef: FieldDefBase | DatumDef,\n scaleName: string,\n opt: FieldRefOption,\n encode: {offset?: number | VgValueRef; band?: number | boolean}\n): VgValueRef {\n const ref: VgValueRef = {};\n\n if (scaleName) {\n ref.scale = scaleName;\n }\n\n if (isDatumDef(fieldDef)) {\n const {datum} = fieldDef;\n if (isDateTime(datum)) {\n ref.signal = dateTimeToExpr(datum);\n } else if (isSignalRef(datum)) {\n ref.signal = datum.signal;\n } else {\n ref.value = datum;\n }\n } else {\n ref.field = vgField(fieldDef, opt);\n }\n\n if (encode) {\n const {offset, band} = encode;\n if (offset) {\n ref.offset = offset;\n }\n if (band) {\n ref.band = band;\n }\n }\n return ref;\n}\n\n/**\n * Signal that returns the middle of a bin from start and end field. Should only be used with x and y.\n */\nexport function interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef,\n fieldOrDatumDef2,\n offset,\n startSuffix,\n band = 0.5\n}: {\n scaleName: string;\n fieldOrDatumDef: TypedFieldDef;\n fieldOrDatumDef2?: SecondaryFieldDef;\n startSuffix?: string;\n offset: number | SignalRef;\n band: number;\n}): VgValueRef {\n const expr = 0 < band && band < 1 ? 'datum' : undefined;\n const start = vgField(fieldOrDatumDef, {expr, suffix: startSuffix});\n const end =\n fieldOrDatumDef2 !== undefined\n ? vgField(fieldOrDatumDef2, {expr})\n : vgField(fieldOrDatumDef, {suffix: 'end', expr});\n\n const ref: VgValueRef = {};\n\n if (band === 0 || band === 1) {\n ref.scale = scaleName;\n const val = band === 0 ? start : end;\n ref.field = val;\n } else {\n const datum = `${band} * ${start} + ${1 - band} * ${end}`;\n ref.signal = `scale(\"${scaleName}\", ${datum})`;\n }\n\n if (offset) {\n ref.offset = offset;\n }\n return ref;\n}\n\nexport interface MidPointParams {\n channel: Channel;\n channelDef: ChannelDef;\n channel2Def?: SecondaryChannelDef;\n\n markDef: MarkDef;\n config: Config;\n\n scaleName: string;\n scale: ScaleComponent;\n stack?: StackProperties;\n offset?: number | SignalRef;\n defaultRef: VgValueRef | (() => VgValueRef);\n\n /**\n * Allow overriding band instead of reading to field def since band is applied to size (width/height) instead of the position for x/y-position with band scales.\n */\n band?: number;\n}\n\n/**\n * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels.\n */\nexport function midPoint({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef,\n band\n}: MidPointParams): VgValueRef {\n // TODO: datum support\n if (channelDef) {\n /* istanbul ignore else */\n\n if (isFieldOrDatumDef(channelDef)) {\n if (isTypedFieldDef(channelDef)) {\n band =\n band ??\n getBand({\n channel,\n fieldDef: channelDef,\n fieldDef2: channel2Def,\n markDef,\n stack,\n config,\n isMidPoint: true\n });\n const {bin, timeUnit, type} = channelDef;\n\n if (isBinning(bin) || (band && timeUnit && type === TEMPORAL)) {\n // Use middle only for x an y to place marks in the center between start and end of the bin range.\n // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match.\n if (stack && stack.impute) {\n // For stack, we computed bin_mid so we can impute.\n return valueRefForFieldOrDatumDef(channelDef, scaleName, {binSuffix: 'mid'}, {offset});\n }\n if (band) {\n // if band = 0, no need to call interpolation\n // For non-stack, we can just calculate bin mid on the fly using signal.\n return interpolatedSignalRef({scaleName, fieldOrDatumDef: channelDef, band, offset});\n }\n return valueRefForFieldOrDatumDef(\n channelDef,\n scaleName,\n binRequiresRange(channelDef, channel) ? {binSuffix: 'range'} : {},\n {\n offset\n }\n );\n } else if (isBinned(bin)) {\n if (isFieldDef(channel2Def)) {\n return interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef,\n fieldOrDatumDef2: channel2Def,\n band,\n offset\n });\n } else {\n const channel2 = channel === X ? X2 : Y2;\n log.warn(log.message.channelRequiredForBinned(channel2));\n }\n }\n }\n\n const scaleType = scale?.get('type');\n return valueRefForFieldOrDatumDef(\n channelDef,\n scaleName,\n hasDiscreteDomain(scaleType) ? {binSuffix: 'range'} : {}, // no need for bin suffix if there is no scale\n {\n offset,\n // For band, to get mid point, need to offset by half of the band\n band: scaleType === 'band' ? band ?? channelDef.band ?? 0.5 : undefined\n }\n );\n } else if (isValueDef(channelDef)) {\n const value = channelDef.value;\n const offsetMixins = offset ? {offset} : {};\n\n return {...widthHeightValueOrSignalRef(channel, value), ...offsetMixins};\n }\n\n // If channelDef is neither field def or value def, it's a condition-only def.\n // In such case, we will use default ref.\n }\n\n if (isFunction(defaultRef)) {\n defaultRef = defaultRef();\n }\n\n if (defaultRef) {\n // for non-position, ref could be undefined.\n return {\n ...defaultRef,\n // only include offset when it is non-zero (zero = no offset)\n ...(offset ? {offset} : {})\n };\n }\n return defaultRef;\n}\n\n/**\n * Convert special \"width\" and \"height\" values in Vega-Lite into Vega value ref.\n */\nexport function widthHeightValueOrSignalRef(channel: Channel, value: Value | SignalRef) {\n if (contains(['x', 'x2'], channel) && value === 'width') {\n return {field: {group: 'width'}};\n } else if (contains(['y', 'y2'], channel) && value === 'height') {\n return {field: {group: 'height'}};\n }\n return signalOrValueRef(value);\n}\n","export default function(_) {\n return typeof _ === 'function';\n}\n","import {SignalRef} from 'vega-typings/types';\nimport {isString} from 'vega-util';\nimport {isBinning} from '../bin';\nimport {\n channelDefType,\n DatumDef,\n FieldDef,\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n isScaleFieldDef,\n vgField\n} from '../channeldef';\nimport {Config} from '../config';\nimport {fieldValidPredicate} from '../predicate';\nimport {ScaleType} from '../scale';\nimport {formatExpression, normalizeTimeUnit, timeUnitSpecifierExpression} from '../timeunit';\nimport {QUANTITATIVE, Type} from '../type';\nimport {Dict} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {TimeUnit} from './../timeunit';\nimport {datumDefToExpr} from './mark/encode/valueref';\n\nexport function isCustomFormatType(formatType: string) {\n return formatType && formatType !== 'number' && formatType !== 'time';\n}\n\nfunction customFormatExpr(formatType: string, field: string, format: string | Dict) {\n return `${formatType}(${field}${format ? `, ${JSON.stringify(format)}` : ''})`;\n}\n\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\n\nexport function formatSignalRef({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n normalizeStack,\n config\n}: {\n fieldOrDatumDef: FieldDef | DatumDef;\n format: string | Dict;\n formatType: string;\n expr?: 'datum' | 'parent' | 'datum.datum';\n normalizeStack?: boolean;\n config: Config;\n}) {\n if (isCustomFormatType(formatType)) {\n return formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n config\n });\n }\n\n const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const signal = timeFormatExpression(\n field,\n isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined,\n format,\n config.timeFormat,\n isScaleFieldDef(fieldOrDatumDef) && fieldOrDatumDef.scale?.type === ScaleType.UTC\n );\n return signal ? {signal} : undefined;\n }\n\n format = numberFormat(channelDefType(fieldOrDatumDef), format, config);\n if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'});\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n } else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') {\n return {\n signal: `${formatExpr(field, format)}`\n };\n } else {\n return {signal: `isValid(${field}) ? ${field} : \"\"+${field}`};\n }\n}\n\nfunction fieldToFormat(\n fieldOrDatumDef: FieldDef | DatumDef,\n expr: 'datum' | 'parent' | 'datum.datum',\n normalizeStack: boolean\n) {\n if (isFieldDef(fieldOrDatumDef)) {\n if (normalizeStack) {\n return `${vgField(fieldOrDatumDef, {expr, suffix: 'end'})}-${vgField(fieldOrDatumDef, {\n expr,\n suffix: 'start'\n })}`;\n } else {\n return vgField(fieldOrDatumDef, {expr});\n }\n } else {\n return datumDefToExpr(fieldOrDatumDef);\n }\n}\n\nexport function formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n normalizeStack,\n config,\n field\n}: {\n fieldOrDatumDef: FieldDef | DatumDef;\n format: string | Dict;\n formatType: string;\n expr?: 'datum' | 'parent' | 'datum.datum';\n normalizeStack?: boolean;\n config: Config;\n field?: string; // axis/legend \"use datum.value\"\n}) {\n field = field ?? fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n\n if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'});\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n }\n return {signal: customFormatExpr(formatType, field, format)};\n}\n\nexport function guideFormat(\n fieldOrDatumDef: FieldDef | DatumDef,\n type: Type,\n format: string | Dict,\n formatType: string,\n config: Config,\n omitTimeFormatConfig: boolean // axis doesn't use config.timeFormat\n) {\n if (isCustomFormatType(formatType)) {\n return undefined; // handled in encode block\n }\n\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n\n return timeFormat(format as string, timeUnit, config, omitTimeFormatConfig);\n }\n\n return numberFormat(type, format, config);\n}\n\nexport function guideFormatType(\n formatType: string | SignalRef,\n fieldOrDatumDef: FieldDef | DatumDef,\n scaleType: ScaleType\n) {\n if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) {\n return formatType;\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') {\n return 'time';\n }\n return undefined;\n}\n\n/**\n * Returns number format for a fieldDef.\n */\nexport function numberFormat(type: Type, specifiedFormat: string | Dict, config: Config) {\n // Specified format in axis/legend has higher precedence than fieldDef.format\n if (isString(specifiedFormat)) {\n return specifiedFormat;\n }\n\n if (type === QUANTITATIVE) {\n // we only apply the default if the field is quantitative\n return config.numberFormat;\n }\n return undefined;\n}\n\n/**\n * Returns time format for a fieldDef for use in guides.\n */\nexport function timeFormat(specifiedFormat: string, timeUnit: TimeUnit, config: Config, omitTimeFormatConfig: boolean) {\n if (specifiedFormat) {\n return specifiedFormat;\n }\n\n if (timeUnit) {\n return {\n signal: timeUnitSpecifierExpression(timeUnit)\n };\n }\n\n return omitTimeFormatConfig ? undefined : config.timeFormat;\n}\n\nfunction formatExpr(field: string, format: string) {\n return `format(${field}, \"${format || ''}\")`;\n}\n\nfunction binNumberFormatExpr(field: string, format: string | Dict, formatType: string, config: Config) {\n if (isCustomFormatType(formatType)) {\n return customFormatExpr(formatType, field, format);\n }\n\n return formatExpr(field, (isString(format) ? format : undefined) ?? config.numberFormat);\n}\n\nexport function binFormatExpression(\n startField: string,\n endField: string,\n format: string | Dict,\n formatType: string,\n config: Config\n) {\n const start = binNumberFormatExpr(startField, format, formatType, config);\n const end = binNumberFormatExpr(endField, format, formatType, config);\n return `${fieldValidPredicate(startField, false)} ? \"null\" : ${start} + \"${BIN_RANGE_DELIMITER}\" + ${end}`;\n}\n\n/**\n * Returns the time expression used for axis/legend labels or text mark for a temporal field\n */\nexport function timeFormatExpression(\n field: string,\n timeUnit: TimeUnit,\n format: string | Dict,\n rawTimeFormat: string, // should be provided only for actual text and headers, not axis/legend labels\n isUTCScale: boolean\n): string {\n if (!timeUnit || format) {\n // If there is no time unit, or if user explicitly specifies format for axis/legend/text.\n format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit.\n return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`;\n } else {\n return formatExpression(timeUnit, field, isUTCScale);\n }\n}\n","import {isArray} from 'vega-util';\nimport {NonArgAggregateOp} from './aggregate';\nimport {FieldName} from './channeldef';\nimport {DateTime} from './datetime';\n\nexport type SortOrder = 'ascending' | 'descending';\n\n/**\n * A sort definition for transform\n */\nexport interface SortField {\n /**\n * The name of the field to sort.\n */\n field: FieldName;\n\n /**\n * Whether to sort the field in ascending or descending order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport interface SortFields {\n field: FieldName[];\n order?: SortOrder[];\n}\n\nexport const DEFAULT_SORT_OP = 'min';\n\n/**\n * A sort definition for sorting a discrete scale in an encoding field definition.\n */\n\nexport interface EncodingSortField {\n /**\n * The data [field](https://vega.github.io/vega-lite/docs/field.html) to sort by.\n *\n * __Default value:__ If unspecified, defaults to the field specified in the outer data reference.\n */\n field?: F; // Field is optional because `\"op\": \"count\"` does not require a field.\n /**\n * An [aggregate operation](https://vega.github.io/vega-lite/docs/aggregate.html#ops) to perform on the field prior to sorting (e.g., `\"count\"`, `\"mean\"` and `\"median\"`).\n * An aggregation is required when there are multiple values of the sort field for each encoded data field.\n * The input data objects will be aggregated, grouped by the encoded data field.\n *\n * For a full list of operations, please see the documentation for [aggregate](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n *\n * __Default value:__ `\"sum\"` for stacked plots. Otherwise, `\"min\"`.\n */\n op?: NonArgAggregateOp;\n\n /**\n * The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport interface SortByEncoding {\n /**\n * The [encoding channel](https://vega.github.io/vega-lite/docs/encoding.html#channels) to sort by (e.g., `\"x\"`, `\"y\"`)\n */\n encoding: SortByChannel;\n\n /**\n * The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport type SortArray = number[] | string[] | boolean[] | DateTime[];\n\nconst SORT_BY_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n color: 1,\n fill: 1,\n stroke: 1,\n strokeWidth: 1,\n size: 1,\n shape: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n opacity: 1,\n text: 1\n} as const;\n\nexport type SortByChannel = keyof typeof SORT_BY_CHANNEL_INDEX;\n\nexport function isSortByChannel(c: string): c is SortByChannel {\n return c in SORT_BY_CHANNEL_INDEX;\n}\n\nexport type SortByChannelDesc =\n | '-x'\n | '-y'\n | '-color'\n | '-fill'\n | '-stroke'\n | '-strokeWidth'\n | '-size'\n | '-shape'\n | '-fillOpacity'\n | '-strokeOpacity'\n | '-opacity'\n | '-text';\n\nexport type AllSortString = SortOrder | SortByChannel | SortByChannelDesc;\n\nexport type Sort = SortArray | AllSortString | EncodingSortField | SortByEncoding | null;\n\nexport function isSortByEncoding(sort: Sort): sort is SortByEncoding {\n return !!sort && !!sort['encoding'];\n}\n\nexport function isSortField(sort: Sort): sort is EncodingSortField {\n return !!sort && (sort['op'] === 'count' || !!sort['field']);\n}\n\nexport function isSortArray(sort: Sort): sort is SortArray {\n return !!sort && isArray(sort);\n}\n","import {LayoutAlign} from 'vega';\nimport {BinParams} from '../bin';\nimport {ChannelDef, Field, FieldName, TypedFieldDef} from '../channeldef';\nimport {Header} from '../header';\nimport {EncodingSortField, SortArray, SortOrder} from '../sort';\nimport {StandardType} from '../type';\nimport {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\nimport {GenericLayerSpec, NormalizedLayerSpec} from './layer';\nimport {GenericUnitSpec, NormalizedUnitSpec} from './unit';\n\nexport interface FacetFieldDef extends TypedFieldDef {\n /**\n * An object defining properties of a facet's header.\n */\n header?: Header;\n\n // Note: `\"sort\"` for facet field def is different from encoding field def as it does not support `SortByEncoding`\n\n /**\n * Sort order for the encoded field.\n *\n * For continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n *\n * For discrete fields, `sort` can be one of the following:\n * - `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n * - `null` indicating no sort.\n *\n * __Default value:__ `\"ascending\"`\n *\n * __Note:__ `null` is not supported for `row` and `column`.\n */\n sort?: SortArray | SortOrder | EncodingSortField | null;\n}\n\nexport type FacetEncodingFieldDef = FacetFieldDef & GenericCompositionLayoutWithColumns;\n\nexport interface RowColumnEncodingFieldDef extends FacetFieldDef {\n // Manually declarae this separated from GenericCompositionLayout as we don't support RowCol object in RowColumnEncodingFieldDef\n\n /**\n * The alignment to apply to row/column facet's subplot.\n * The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n *\n * - For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n * - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n * - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n *\n * __Default value:__ `\"all\"`.\n */\n align?: LayoutAlign;\n\n /**\n * Boolean flag indicating if facet's subviews should be centered relative to their respective rows or columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean;\n\n /**\n * The spacing in pixels between facet's sub-views.\n *\n * __Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)\n */\n spacing?: number;\n}\n\nexport interface FacetMapping = FacetFieldDef> {\n /**\n * A field definition for the vertical facet of trellis plots.\n */\n row?: FD;\n\n /**\n * A field definition for the horizontal facet of trellis plots.\n */\n column?: FD;\n}\n\nexport function isFacetMapping(f: FacetFieldDef | FacetMapping): f is FacetMapping {\n return 'row' in f || 'column' in f;\n}\n\n/**\n * Facet mapping for encoding macro\n */\nexport interface EncodingFacetMapping extends FacetMapping> {\n /**\n * A field definition for the (flexible) facet of trellis plots.\n *\n * If either `row` or `column` is specified, this channel will be ignored.\n */\n facet?: FacetEncodingFieldDef;\n}\n\nexport function isFacetFieldDef(channelDef: ChannelDef): channelDef is FacetFieldDef {\n return !!channelDef && 'header' in channelDef;\n}\n\n/**\n * Base interface for a facet specification.\n */\nexport interface GenericFacetSpec<\n U extends GenericUnitSpec,\n L extends GenericLayerSpec,\n F extends Field\n> extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for how to facet the data. One of:\n * 1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def)\n * 2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping)\n */\n facet: FacetFieldDef | FacetMapping;\n\n /**\n * A specification of the view that gets faceted.\n */\n spec: L | U;\n // TODO: replace this with GenericSpec once we support all cases;\n}\n\n/**\n * A facet specification without any shortcut / expansion syntax\n */\nexport type NormalizedFacetSpec = GenericFacetSpec;\n\nexport function isFacetSpec(spec: BaseSpec): spec is GenericFacetSpec {\n return 'facet' in spec;\n}\n","import {Gradient, SignalRef, Text} from 'vega';\nimport {isArray, isBoolean, isNumber, isString} from 'vega-util';\nimport {Aggregate, isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp} from './aggregate';\nimport {Axis} from './axis';\nimport {autoMaxBins, Bin, BinParams, binToString, isBinned, isBinning} from './bin';\nimport {\n ANGLE,\n Channel,\n COLOR,\n COLUMN,\n DESCRIPTION,\n DETAIL,\n FACET,\n FILL,\n FILLOPACITY,\n HREF,\n isScaleChannel,\n isSecondaryRangeChannel,\n isXorY,\n KEY,\n LATITUDE,\n LATITUDE2,\n LONGITUDE,\n LONGITUDE2,\n OPACITY,\n ORDER,\n RADIUS,\n RADIUS2,\n ROW,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n TEXT,\n THETA,\n THETA2,\n TOOLTIP,\n URL,\n X,\n X2,\n Y,\n Y2,\n ExtendedChannel\n} from './channel';\nimport {getMarkConfig} from './compile/common';\nimport {isCustomFormatType} from './compile/format';\nimport {CompositeAggregate} from './compositemark';\nimport {Config} from './config';\nimport {DateTime, dateTimeToExpr, isDateTime} from './datetime';\nimport {Encoding} from './encoding';\nimport {FormatMixins, Guide, GuideEncodingConditionalValueDef, TitleMixins} from './guide';\nimport {ImputeParams} from './impute';\nimport {Legend} from './legend';\nimport * as log from './log';\nimport {LogicalComposition} from './logical';\nimport {isRectBasedMark, MarkDef} from './mark';\nimport {Predicate} from './predicate';\nimport {Scale, SCALE_CATEGORY_INDEX} from './scale';\nimport {isSortByChannel, Sort, SortOrder} from './sort';\nimport {isFacetFieldDef} from './spec/facet';\nimport {StackOffset, StackProperties} from './stack';\nimport {\n getTimeUnitParts,\n isLocalSingleTimeUnit,\n normalizeTimeUnit,\n TimeUnit,\n TimeUnitParams,\n timeUnitToString\n} from './timeunit';\nimport {AggregatedFieldDef, WindowFieldDef} from './transform';\nimport {getFullName, QUANTITATIVE, StandardType, Type} from './type';\nimport {\n contains,\n flatAccessWithDatum,\n getFirstDefined,\n internalField,\n omit,\n removePathFromField,\n replacePathInField,\n titleCase\n} from './util';\nimport {isSignalRef} from './vega.schema';\n\nexport type PrimitiveValue = number | string | boolean | null;\n\nexport type Value = PrimitiveValue | number[] | Gradient | Text | SignalRef;\n\n/**\n * Definition object for a constant value (primitive value or gradient definition) of an encoding channel.\n */\nexport interface ValueDef {\n /**\n * A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).\n */\n value: V;\n}\n\nexport type PositionValueDef = ValueDef;\n\nexport type NumericValueDef = ValueDef;\n\n/**\n * A ValueDef with Condition where either the condition or the value are optional.\n * {\n * condition: {field: ...} | {value: ...},\n * value: ...,\n * }\n */\n\n/**\n * @minProperties 1\n */\nexport type ValueDefWithCondition | DatumDef, V extends Value = Value> = Partial<\n ValueDef\n> & {\n /**\n * A field definition or one or more value definition(s) with a selection predicate.\n */\n condition?: Conditional | Conditional> | Conditional>[];\n};\n\nexport type StringValueDefWithCondition = ValueDefWithCondition<\n MarkPropFieldOrDatumDef,\n string | null\n>;\nexport type TypeForShape = 'nominal' | 'ordinal' | 'geojson';\n\nexport type Conditional | DatumDef | ValueDef | SignalRef> =\n | ConditionalPredicate\n | ConditionalSelection;\n\nexport type ConditionalPredicate | DatumDef | ValueDef | SignalRef> = {\n /**\n * Predicate for triggering the condition\n */\n test: LogicalComposition;\n} & CD;\n\nexport type ConditionalSelection | DatumDef | ValueDef | SignalRef> = {\n /**\n * A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose).\n */\n selection: LogicalComposition;\n} & CD;\n\nexport function isConditionalSelection(c: Conditional): c is ConditionalSelection {\n return c['selection'];\n}\n\nexport interface ConditionValueDefMixins {\n /**\n * One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n *\n * __Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\n * since Vega-Lite only allows at most one encoded field per encoding channel.\n */\n condition?: Conditional> | Conditional>[];\n}\n\n/**\n * A FieldDef with Condition\n * {\n * condition: {value: ...},\n * field: ...,\n * ...\n * }\n */\n\nexport type FieldOrDatumDefWithCondition | DatumDef, V extends Value = Value> = F &\n ConditionValueDefMixins;\n\nexport type MarkPropDef =\n | FieldOrDatumDefWithCondition, V>\n | FieldOrDatumDefWithCondition, V>\n | ValueDefWithCondition, V>;\n\nexport type ColorDef = MarkPropDef;\nexport type NumericMarkPropDef = MarkPropDef;\n\nexport type NumericArrayMarkPropDef = MarkPropDef;\n\nexport type ShapeDef = MarkPropDef;\n\nexport type StringFieldDefWithCondition = FieldOrDatumDefWithCondition, string>;\nexport type TextDef =\n | FieldOrDatumDefWithCondition, Text>\n | FieldOrDatumDefWithCondition, Text>\n | ValueDefWithCondition, Text>;\n\n/**\n * A ValueDef with optional Condition\n * {\n * condition: {field: ...} | {value: ...},\n * value: ...,\n * }\n */\n\n/**\n * Reference to a repeated value.\n */\nexport interface RepeatRef {\n repeat: 'row' | 'column' | 'repeat' | 'layer';\n}\n\nexport type FieldName = string;\nexport type Field = FieldName | RepeatRef;\n\nexport function isRepeatRef(field: Field | any): field is RepeatRef {\n return field && !isString(field) && 'repeat' in field;\n}\n\n/** @@hidden */\nexport type HiddenCompositeAggregate = CompositeAggregate;\n\nexport interface FieldDefBase extends BandMixins {\n /**\n * __Required.__ A string defining the name of the field from which to pull a data value\n * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n *\n * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n *\n * __Notes:__\n * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\n * If field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\n * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n * 2) `field` is not required if `aggregate` is `count`.\n */\n field?: F;\n\n // function\n\n /**\n * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\n * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n *\n * __Default value:__ `undefined` (None)\n *\n * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation.\n */\n timeUnit?: TimeUnit | TimeUnitParams;\n\n /**\n * Aggregation function for the field\n * (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n *\n * __Default value:__ `undefined` (None)\n *\n * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation.\n */\n aggregate?: Aggregate | HiddenCompositeAggregate;\n\n /**\n * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n *\n * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied.\n *\n * - If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n *\n * __Default value:__ `false`\n *\n * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.\n */\n bin?: B;\n}\n\nexport function toFieldDefBase(fieldDef: FieldDef): FieldDefBase {\n const {field, timeUnit, bin, aggregate} = fieldDef;\n return {\n ...(timeUnit ? {timeUnit} : {}),\n ...(bin ? {bin} : {}),\n ...(aggregate ? {aggregate} : {}),\n field\n };\n}\n\nexport interface TypeMixins {\n /**\n * The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\n * It can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n *\n * Since Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\n * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n *\n * __Default value:__\n *\n * 1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n * - `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n * - `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n * - `ordinal\"\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale.\n *\n * 2) For a constant value in data domain (`datum`):\n * - `\"quantitative\"` if the datum is a number\n * - `\"nominal\"` if the datum is a string\n * - `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n *\n * __Note:__\n * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n * - Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n *\n * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation.\n */\n type?: T;\n}\n\n/**\n * Definition object for a data field, its type and transformation of an encoding channel.\n */\nexport type TypedFieldDef<\n F extends Field,\n T extends Type = any,\n B extends Bin = boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types\n> = FieldDefBase & TitleMixins & TypeMixins;\n\nexport interface SortableFieldDef<\n F extends Field,\n T extends Type = StandardType,\n B extends Bin = boolean | BinParams | null\n> extends TypedFieldDef {\n /**\n * Sort order for the encoded field.\n *\n * For continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n *\n * For discrete fields, `sort` can be one of the following:\n * - `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n * - [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n * - `null` indicating no sort.\n *\n * __Default value:__ `\"ascending\"`\n *\n * __Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n *\n * __See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation.\n */\n sort?: Sort;\n}\n\nexport function isSortableFieldDef(fieldDef: FieldDef): fieldDef is SortableFieldDef {\n return 'sort' in fieldDef;\n}\n\nexport type ScaleFieldDef<\n F extends Field,\n T extends Type = StandardType,\n B extends Bin = boolean | BinParams | null\n> = SortableFieldDef & ScaleMixins;\n\nexport interface ScaleMixins {\n /**\n * An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n *\n * If `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n *\n * __Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n *\n * __See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation.\n */\n scale?: Scale | null;\n}\n\nexport interface DatumDef<\n F extends Field = string,\n V extends PrimitiveValue | DateTime | SignalRef = PrimitiveValue | DateTime | SignalRef\n> extends Partial>, BandMixins {\n /**\n * A constant value in data domain.\n */\n datum?: F extends RepeatRef ? V | RepeatRef : V;\n // only apply Repeatref if field (F) can be RepeatRef\n // FIXME(https://github.com/microsoft/TypeScript/issues/37586):\n // `F extends RepeatRef` probably should be `RepeatRef extends F` but there is likely a bug in TS.\n}\n\nexport type StringDatumDef = DatumDef & FormatMixins;\n\nexport type ScaleDatumDef = ScaleMixins & DatumDef;\n\n/**\n * A field definition of a secondary channel that shares a scale with another primary channel. For example, `x2`, `xError` and `xError2` share the same scale with `x`.\n */\nexport type SecondaryFieldDef = FieldDefBase & TitleMixins; // x2/y2 shouldn't have bin, but we keep bin property for simplicity of the codebase.\n\nexport type Position2Def = SecondaryFieldDef | DatumDef | PositionValueDef;\n\nexport type SecondaryChannelDef = Encoding['x2' | 'y2'];\n\n/**\n * Field Def without scale (and without bin: \"binned\" support).\n */\nexport type FieldDefWithoutScale = TypedFieldDef;\n\nexport type LatLongFieldDef = FieldDefBase &\n TitleMixins &\n Partial>; // Lat long shouldn't have bin, but we keep bin property for simplicity of the codebase.\n\nexport type LatLongDef = LatLongFieldDef | DatumDef | NumericValueDef;\n\nexport type PositionFieldDefBase = ScaleFieldDef<\n F,\n StandardType,\n boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types\n> &\n PositionBaseMixins;\n\nexport type PositionDatumDefBase = ScaleDatumDef & PositionBaseMixins;\n\nexport interface PositionBaseMixins {\n /**\n * Type of stacking offset if the field should be stacked.\n * `stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\n * For example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n *\n * `stack` can be one of the following values:\n * - `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n * - `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
\n * -`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n * - `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n *\n * __Default value:__ `zero` for plots with all of the following conditions are true:\n * (1) the mark is `bar`, `area`, or `arc`;\n * (2) the stacked measure channel (x or y) has a linear scale;\n * (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n *\n * __See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation.\n */\n stack?: StackOffset | null | boolean;\n}\n\nexport interface BandMixins {\n /**\n * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n *\n * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.\n *\n * @minimum 0\n * @maximum 1\n */\n band?: number;\n}\n\nexport type PositionFieldDef = PositionFieldDefBase & PositionMixins;\n\nexport type PositionDatumDef = PositionDatumDefBase & PositionMixins;\n\nexport type PositionDef = PositionFieldDef | PositionDatumDef | PositionValueDef;\n\nexport interface PositionMixins {\n /**\n * An object defining properties of axis's gridlines, ticks and labels.\n * If `null`, the axis for the encoding channel will be removed.\n *\n * __Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n *\n * __See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation.\n */\n axis?: Axis | null;\n\n /**\n * An object defining the properties of the Impute Operation to be applied.\n * The field value of the other positional channel is taken as `key` of the `Impute` Operation.\n * The field of the `color` channel if specified is used as `groupby` of the `Impute` Operation.\n *\n * __See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation.\n */\n impute?: ImputeParams | null;\n}\n\nexport type PolarDef = PositionFieldDefBase | PositionDatumDefBase | PositionValueDef;\n\nexport function getBand({\n channel,\n fieldDef,\n fieldDef2,\n markDef: mark,\n stack,\n config,\n isMidPoint\n}: {\n isMidPoint?: boolean;\n channel: Channel;\n fieldDef: FieldDef | DatumDef;\n fieldDef2?: SecondaryChannelDef;\n stack: StackProperties;\n markDef: MarkDef;\n config: Config;\n}): number {\n if (isFieldOrDatumDef(fieldDef) && fieldDef.band !== undefined) {\n return fieldDef.band;\n }\n if (isFieldDef(fieldDef)) {\n const {timeUnit, bin} = fieldDef;\n\n if (timeUnit && !fieldDef2) {\n if (isMidPoint) {\n return getMarkConfig('timeUnitBandPosition', mark, config);\n } else {\n return isRectBasedMark(mark.type) ? getMarkConfig('timeUnitBand', mark, config) : 0;\n }\n } else if (isBinning(bin)) {\n return isRectBasedMark(mark.type) && !isMidPoint ? 1 : 0.5;\n }\n }\n if (stack?.fieldChannel === channel && isMidPoint) {\n return 0.5;\n }\n return undefined;\n}\n\nexport function hasBand(\n channel: Channel,\n fieldDef: FieldDef,\n fieldDef2: SecondaryChannelDef,\n stack: StackProperties,\n markDef: MarkDef,\n config: Config\n): boolean {\n if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) {\n return !!getBand({channel, fieldDef, fieldDef2, stack, markDef, config});\n }\n return false;\n}\n\n/**\n * Field definition of a mark property, which can contain a legend.\n */\nexport type MarkPropFieldDef = ScaleFieldDef &\n LegendMixins;\n\nexport type MarkPropDatumDef = LegendMixins & ScaleDatumDef;\n\nexport type MarkPropFieldOrDatumDef =\n | MarkPropFieldDef\n | MarkPropDatumDef;\n\nexport interface LegendMixins {\n /**\n * An object defining properties of the legend.\n * If `null`, the legend for the encoding channel will be removed.\n *\n * __Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n *\n * __See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation.\n */\n legend?: Legend | null;\n}\n\n// Detail\n\n// Order Path have no scale\n\nexport interface OrderFieldDef extends FieldDefWithoutScale {\n /**\n * The sort order. One of `\"ascending\"` (default) or `\"descending\"`.\n */\n sort?: SortOrder;\n}\n\nexport type OrderValueDef = ConditionValueDefMixins & NumericValueDef;\n\nexport interface StringFieldDef extends FieldDefWithoutScale, FormatMixins {}\n\nexport type FieldDef = SecondaryFieldDef | TypedFieldDef;\nexport type ChannelDef = Encoding[keyof Encoding];\n\nexport function isConditionalDef | GuideEncodingConditionalValueDef | SignalRef>(\n channelDef: CD\n): channelDef is CD & {condition: Conditional} {\n return !!channelDef && 'condition' in channelDef;\n}\n\n/**\n * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef\n */\nexport function hasConditionalFieldDef(\n channelDef: Partial>\n): channelDef is {condition: Conditional>} {\n const condition = channelDef && channelDef['condition'];\n return !!condition && !isArray(condition) && isFieldDef(condition);\n}\n\nexport function hasConditionalFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is {condition: Conditional>} {\n const condition = channelDef && channelDef['condition'];\n return !!condition && !isArray(condition) && isFieldOrDatumDef(condition);\n}\n\nexport function hasConditionalValueDef(\n channelDef: ChannelDef\n): channelDef is ValueDef & {condition: Conditional> | Conditional>[]} {\n const condition = channelDef && channelDef['condition'];\n return !!condition && (isArray(condition) || isValueDef(condition));\n}\n\nexport function isFieldDef(\n channelDef: Partial> | FieldDefBase | DatumDef\n): channelDef is FieldDefBase | TypedFieldDef | SecondaryFieldDef {\n // TODO: we can't use field in channelDef here as it's somehow failing runtime test\n return !!channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count');\n}\n\nexport function channelDefType(channelDef: ChannelDef): Type | undefined {\n return channelDef && channelDef['type'];\n}\n\nexport function isDatumDef(\n channelDef: Partial> | FieldDefBase | DatumDef\n): channelDef is DatumDef {\n return !!channelDef && 'datum' in channelDef;\n}\n\nexport function isContinuousFieldOrDatumDef(\n cd: ChannelDef\n): cd is TypedFieldDef | DatumDef {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && isContinuous(cd)) || isNumericDataDef(cd);\n}\n\nexport function isQuantitativeFieldOrDatumDef(cd: ChannelDef) {\n // TODO: make datum support DateTime object\n return channelDefType(cd) === 'quantitative' || isNumericDataDef(cd);\n}\n\nexport function isNumericDataDef(cd: ChannelDef): cd is DatumDef {\n return isDatumDef(cd) && isNumber(cd.datum);\n}\n\nexport function isFieldOrDatumDef(\n channelDef: Partial>\n): channelDef is FieldDef | DatumDef {\n return isFieldDef(channelDef) || isDatumDef(channelDef);\n}\n\nexport function isTypedFieldDef(channelDef: ChannelDef): channelDef is TypedFieldDef {\n return !!channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef;\n}\n\nexport function isValueDef(channelDef: Partial>): channelDef is ValueDef {\n return channelDef && 'value' in channelDef && 'value' in channelDef;\n}\n\nexport function isScaleFieldDef(channelDef: ChannelDef): channelDef is ScaleFieldDef {\n return !!channelDef && ('scale' in channelDef || 'sort' in channelDef);\n}\n\nexport function isPositionFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is PositionFieldDef | PositionDatumDef {\n return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef);\n}\n\nexport function isMarkPropFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is MarkPropFieldDef | MarkPropDatumDef {\n return !!channelDef && 'legend' in channelDef;\n}\n\nexport function isStringFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is StringFieldDef | StringDatumDef {\n return !!channelDef && ('format' in channelDef || 'formatType' in channelDef);\n}\n\nexport function toStringFieldDef(fieldDef: FieldDef): StringFieldDef {\n // omit properties that don't exist in string field defs\n return omit(fieldDef, ['legend', 'axis', 'header', 'scale'] as any[]);\n}\n\nexport interface FieldRefOption {\n /** Exclude bin, aggregate, timeUnit */\n nofn?: boolean;\n /** Wrap the field with datum, parent, or datum.datum (e.g., datum['...'] for Vega Expression */\n expr?: 'datum' | 'parent' | 'datum.datum';\n /** Prepend fn with custom function prefix */\n prefix?: string;\n /** Append suffix to the field ref for bin (default='start') */\n binSuffix?: 'end' | 'range' | 'mid';\n /** Append suffix to the field ref (general) */\n suffix?: string;\n /**\n * Use the field name for `as` in a transform.\n * We will not escape nested accesses because Vega transform outputs cannot be nested.\n */\n forAs?: boolean;\n}\n\nfunction isOpFieldDef(\n fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef\n): fieldDef is WindowFieldDef | AggregatedFieldDef {\n return 'op' in fieldDef;\n}\n\n/**\n * Get a Vega field reference from a Vega-Lite field def.\n */\nexport function vgField(\n fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef,\n opt: FieldRefOption = {}\n): string {\n let field = fieldDef.field;\n const prefix = opt.prefix;\n let suffix = opt.suffix;\n\n let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped\n\n if (isCount(fieldDef)) {\n field = internalField('count');\n } else {\n let fn: string;\n\n if (!opt.nofn) {\n if (isOpFieldDef(fieldDef)) {\n fn = fieldDef.op;\n } else {\n const {bin, aggregate, timeUnit} = fieldDef;\n if (isBinning(bin)) {\n fn = binToString(bin);\n suffix = (opt.binSuffix ?? '') + (opt.suffix ?? '');\n } else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmax_${aggregate.argmax}`;\n } else if (isArgminDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmin_${aggregate.argmin}`;\n } else {\n fn = String(aggregate);\n }\n } else if (timeUnit) {\n fn = timeUnitToString(timeUnit);\n suffix = ((!contains(['range', 'mid'], opt.binSuffix) && opt.binSuffix) || '') + (opt.suffix ?? '');\n }\n }\n }\n\n if (fn) {\n field = field ? `${fn}_${field}` : fn;\n }\n }\n\n if (suffix) {\n field = `${field}_${suffix}`;\n }\n\n if (prefix) {\n field = `${prefix}_${field}`;\n }\n\n if (opt.forAs) {\n return removePathFromField(field);\n } else if (opt.expr) {\n // Expression to access flattened field. No need to escape dots.\n return flatAccessWithDatum(field, opt.expr) + argAccessor;\n } else {\n // We flattened all fields so paths should have become dot.\n return replacePathInField(field) + argAccessor;\n }\n}\n\nexport function isDiscrete(def: TypedFieldDef | DatumDef) {\n switch (def.type) {\n case 'nominal':\n case 'ordinal':\n case 'geojson':\n return true;\n case 'quantitative':\n return isFieldDef(def) && !!def.bin;\n case 'temporal':\n return false;\n }\n throw new Error(log.message.invalidFieldType(def.type));\n}\n\nexport function isContinuous(fieldDef: TypedFieldDef) {\n return !isDiscrete(fieldDef);\n}\n\nexport function isCount(fieldDef: FieldDefBase) {\n return fieldDef.aggregate === 'count';\n}\n\nexport type FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => string;\n\nexport function verbalTitleFormatter(fieldDef: FieldDefBase, config: Config) {\n const {field, bin, timeUnit, aggregate} = fieldDef;\n if (aggregate === 'count') {\n return config.countTitle;\n } else if (isBinning(bin)) {\n return `${field} (binned)`;\n } else if (timeUnit) {\n const unit = normalizeTimeUnit(timeUnit)?.unit;\n if (unit) {\n return `${field} (${getTimeUnitParts(unit).join('-')})`;\n }\n } else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n return `${field} for max ${aggregate.argmax}`;\n } else if (isArgminDef(aggregate)) {\n return `${field} for min ${aggregate.argmin}`;\n } else {\n return `${titleCase(aggregate)} of ${field}`;\n }\n }\n return field;\n}\n\nexport function functionalTitleFormatter(fieldDef: FieldDefBase) {\n const {aggregate, bin, timeUnit, field} = fieldDef;\n if (isArgmaxDef(aggregate)) {\n return `${field} for argmax(${aggregate.argmax})`;\n } else if (isArgminDef(aggregate)) {\n return `${field} for argmin(${aggregate.argmin})`;\n }\n\n const timeUnitParams = normalizeTimeUnit(timeUnit);\n\n const fn = aggregate || timeUnitParams?.unit || (timeUnitParams?.maxbins && 'timeunit') || (isBinning(bin) && 'bin');\n if (fn) {\n return fn.toUpperCase() + '(' + field + ')';\n } else {\n return field;\n }\n}\n\nexport const defaultTitleFormatter: FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => {\n switch (config.fieldTitle) {\n case 'plain':\n return fieldDef.field;\n case 'functional':\n return functionalTitleFormatter(fieldDef);\n default:\n return verbalTitleFormatter(fieldDef, config);\n }\n};\n\nlet titleFormatter = defaultTitleFormatter;\n\nexport function setTitleFormatter(formatter: FieldTitleFormatter) {\n titleFormatter = formatter;\n}\n\nexport function resetTitleFormatter() {\n setTitleFormatter(defaultTitleFormatter);\n}\n\nexport function title(\n fieldOrDatumDef: TypedFieldDef | SecondaryFieldDef | DatumDef,\n config: Config,\n {allowDisabling, includeDefault = true}: {allowDisabling: boolean; includeDefault?: boolean}\n) {\n const guideTitle = getGuide(fieldOrDatumDef)?.title;\n\n if (!isFieldDef(fieldOrDatumDef)) {\n return guideTitle;\n }\n const fieldDef = fieldOrDatumDef;\n\n const def = includeDefault ? defaultTitle(fieldDef, config) : undefined;\n\n if (allowDisabling) {\n return getFirstDefined(guideTitle, fieldDef.title, def);\n } else {\n return guideTitle ?? fieldDef.title ?? def;\n }\n}\n\nexport function getGuide(fieldDef: TypedFieldDef | SecondaryFieldDef | DatumDef): Guide {\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) {\n return fieldDef.axis;\n } else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) {\n return fieldDef.legend;\n } else if (isFacetFieldDef(fieldDef) && fieldDef.header) {\n return fieldDef.header;\n }\n return undefined;\n}\n\nexport function defaultTitle(fieldDef: FieldDefBase, config: Config) {\n return titleFormatter(fieldDef, config);\n}\n\nexport function getFormatMixins(fieldDef: TypedFieldDef | DatumDef) {\n if (isStringFieldOrDatumDef(fieldDef)) {\n const {format, formatType} = fieldDef;\n return {format, formatType};\n } else {\n const guide = getGuide(fieldDef) ?? {};\n const {format, formatType} = guide;\n return {format, formatType};\n }\n}\n\nexport function defaultType>(fieldDef: T, channel: ExtendedChannel): Type {\n switch (channel) {\n case 'latitude':\n case 'longitude':\n return 'quantitative';\n\n case 'row':\n case 'column':\n case 'facet':\n case 'shape':\n case 'strokeDash':\n return 'nominal';\n }\n\n if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) {\n return 'ordinal';\n }\n\n const {aggregate, bin, timeUnit} = fieldDef;\n if (timeUnit) {\n return 'temporal';\n }\n\n if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) {\n return 'quantitative';\n }\n\n if (isScaleFieldDef(fieldDef) && fieldDef.scale?.type) {\n switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) {\n case 'numeric':\n case 'discretizing':\n return 'quantitative';\n case 'time':\n return 'temporal';\n }\n }\n\n return 'nominal';\n}\n\n/**\n * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef.\n * @param channelDef\n */\n\nexport function getFieldDef(channelDef: ChannelDef): FieldDef {\n if (isFieldDef(channelDef)) {\n return channelDef;\n } else if (hasConditionalFieldDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n\nexport function getFieldOrDatumDef = ChannelDef>(\n channelDef: CD\n): FieldDef | DatumDef {\n if (isFieldOrDatumDef(channelDef)) {\n return channelDef;\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n\n/**\n * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.\n */\nexport function initChannelDef(\n channelDef: ChannelDef,\n channel: ExtendedChannel,\n config: Config,\n opt: {compositeMark?: boolean} = {}\n): ChannelDef {\n if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) {\n const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean';\n log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef));\n return {value: channelDef} as ValueDef;\n }\n\n // If a fieldDef contains a field, we need type.\n if (isFieldOrDatumDef(channelDef)) {\n return initFieldOrDatumDef(channelDef, channel, config, opt);\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return {\n ...channelDef,\n // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition\n condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) as Conditional>\n };\n }\n return channelDef;\n}\n\nexport function initFieldOrDatumDef(\n fd: FieldDef | DatumDef,\n channel: ExtendedChannel,\n config: Config,\n opt: {compositeMark?: boolean}\n): FieldDef | DatumDef {\n if (isStringFieldOrDatumDef(fd)) {\n const {format, formatType, ...rest} = fd;\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef(rest, channel, config, opt);\n }\n } else {\n const guideType = isPositionFieldOrDatumDef(fd)\n ? 'axis'\n : isMarkPropFieldOrDatumDef(fd)\n ? 'legend'\n : isFacetFieldDef(fd)\n ? 'header'\n : null;\n if (guideType && fd[guideType]) {\n const {format, formatType, ...newGuide} = fd[guideType];\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef({...fd, [guideType]: newGuide}, channel, config, opt);\n }\n }\n }\n\n if (isFieldDef(fd)) {\n return initFieldDef(fd, channel, opt);\n }\n return initDatumDef(fd);\n}\n\nfunction initDatumDef(datumDef: DatumDef): DatumDef {\n let type = datumDef['type'];\n if (type) {\n return datumDef;\n }\n const {datum} = datumDef;\n type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined;\n\n return {...datumDef, type};\n}\n\nexport function initFieldDef(\n fd: FieldDef,\n channel: ExtendedChannel,\n {compositeMark = false}: {compositeMark?: boolean} = {}\n) {\n const {aggregate, timeUnit, bin, field} = fd;\n const fieldDef = {...fd};\n\n // Drop invalid aggregate\n if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) {\n log.warn(log.message.invalidAggregate(aggregate));\n delete fieldDef.aggregate;\n }\n\n // Normalize Time Unit\n if (timeUnit) {\n fieldDef.timeUnit = normalizeTimeUnit(timeUnit);\n }\n\n if (field) {\n fieldDef.field = `${field}`;\n }\n\n // Normalize bin\n if (isBinning(bin)) {\n fieldDef.bin = normalizeBin(bin, channel);\n }\n\n if (isBinned(bin) && !isXorY(channel)) {\n log.warn(log.message.channelShouldNotBeUsedForBinned(channel));\n }\n\n // Normalize Type\n if (isTypedFieldDef(fieldDef)) {\n const {type} = fieldDef;\n const fullType = getFullName(type);\n if (type !== fullType) {\n // convert short type to full type\n fieldDef.type = fullType;\n }\n if (type !== 'quantitative') {\n if (isCountingAggregateOp(aggregate)) {\n log.warn(log.message.invalidFieldTypeForCountAggregate(type, aggregate));\n fieldDef.type = 'quantitative';\n }\n }\n } else if (!isSecondaryRangeChannel(channel)) {\n // If type is empty / invalid, then augment with default type\n const newType = defaultType(fieldDef as TypedFieldDef, channel);\n fieldDef['type'] = newType;\n }\n\n if (isTypedFieldDef(fieldDef)) {\n const {compatible, warning} = channelCompatibility(fieldDef, channel) || {};\n if (compatible === false) {\n log.warn(warning);\n }\n }\n\n if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) {\n const {sort} = fieldDef;\n if (isSortByChannel(sort)) {\n return {\n ...fieldDef,\n sort: {encoding: sort}\n };\n }\n const sub = sort.substr(1);\n if (sort.charAt(0) === '-' && isSortByChannel(sub)) {\n return {\n ...fieldDef,\n sort: {encoding: sub, order: 'descending'}\n };\n }\n }\n\n if (isFacetFieldDef(fieldDef)) {\n const {header} = fieldDef;\n const {orient, ...rest} = header;\n if (orient) {\n return {\n ...fieldDef,\n header: {\n ...rest,\n labelOrient: header.labelOrient || orient,\n titleOrient: header.titleOrient || orient\n }\n };\n }\n }\n\n return fieldDef;\n}\n\nexport function normalizeBin(bin: BinParams | boolean | 'binned', channel?: ExtendedChannel) {\n if (isBoolean(bin)) {\n return {maxbins: autoMaxBins(channel)};\n } else if (bin === 'binned') {\n return {\n binned: true\n };\n } else if (!bin.maxbins && !bin.step) {\n return {...bin, maxbins: autoMaxBins(channel)};\n } else {\n return bin;\n }\n}\n\nconst COMPATIBLE = {compatible: true};\nexport function channelCompatibility(\n fieldDef: TypedFieldDef,\n channel: ExtendedChannel\n): {compatible: boolean; warning?: string} {\n const type = fieldDef.type;\n\n if (type === 'geojson' && channel !== 'shape') {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with a geojson data.`\n };\n }\n\n switch (channel) {\n case ROW:\n case COLUMN:\n case FACET:\n if (isContinuous(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.facetChannelShouldBeDiscrete(channel)\n };\n }\n return COMPATIBLE;\n\n case X:\n case Y:\n case COLOR:\n case FILL:\n case STROKE:\n case TEXT:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case URL:\n case ANGLE:\n case THETA:\n case RADIUS:\n case DESCRIPTION:\n return COMPATIBLE;\n\n case LONGITUDE:\n case LONGITUDE2:\n case LATITUDE:\n case LATITUDE2:\n if (type !== QUANTITATIVE) {\n return {\n compatible: false,\n warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.`\n };\n }\n return COMPATIBLE;\n\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n case SIZE:\n case THETA2:\n case RADIUS2:\n case X2:\n case Y2:\n if (type === 'nominal' && !fieldDef['sort']) {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with an unsorted discrete field.`\n };\n }\n return COMPATIBLE;\n\n case STROKEDASH:\n if (!contains(['ordinal', 'nominal'], fieldDef.type)) {\n return {\n compatible: false,\n warning: 'StrokeDash channel should be used with only discrete data.'\n };\n }\n return COMPATIBLE;\n\n case SHAPE:\n if (!contains(['ordinal', 'nominal', 'geojson'], fieldDef.type)) {\n return {\n compatible: false,\n warning: 'Shape channel should be used with only either discrete or geojson data.'\n };\n }\n return COMPATIBLE;\n\n case ORDER:\n if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) {\n return {\n compatible: false,\n warning: `Channel order is inappropriate for nominal field, which has no inherent order.`\n };\n }\n return COMPATIBLE;\n }\n}\n\n/**\n * Check if the field def uses a time format or does not use any format but is temporal\n * (this does not cover field defs that are temporal but use a number format).\n */\nexport function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef: FieldDef | DatumDef): boolean {\n const {formatType} = getFormatMixins(fieldOrDatumDef);\n return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef));\n}\n\n/**\n * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`.\n */\nexport function isTimeFieldDef(def: FieldDef | DatumDef): boolean {\n return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit));\n}\n\n/**\n * Getting a value associated with a fielddef.\n * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit)\n */\nexport function valueExpr(\n v: number | string | boolean | DateTime | SignalRef | number[],\n {\n timeUnit,\n type,\n wrapTime,\n undefinedIfExprNotRequired\n }: {\n timeUnit: TimeUnit | TimeUnitParams;\n type?: Type;\n wrapTime?: boolean;\n undefinedIfExprNotRequired?: boolean;\n }\n): string {\n const unit = timeUnit && normalizeTimeUnit(timeUnit)?.unit;\n let isTime = unit || type === 'temporal';\n\n let expr;\n if (isSignalRef(v)) {\n expr = v.signal;\n } else if (isDateTime(v)) {\n isTime = true;\n expr = dateTimeToExpr(v);\n } else if (isString(v) || isNumber(v)) {\n if (isTime) {\n expr = `datetime(${JSON.stringify(v)})`;\n\n if (isLocalSingleTimeUnit(unit)) {\n // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit\n if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) {\n expr = dateTimeToExpr({[unit]: v});\n }\n }\n }\n }\n if (expr) {\n return wrapTime && isTime ? `time(${expr})` : expr;\n }\n // number or boolean or normal string\n return undefinedIfExprNotRequired ? undefined : JSON.stringify(v);\n}\n\n/**\n * Standardize value array -- convert each value to Vega expression if applicable\n */\nexport function valueArray(\n fieldOrDatumDef: TypedFieldDef | DatumDef,\n values: (number | string | boolean | DateTime)[]\n) {\n const {type} = fieldOrDatumDef;\n return values.map(v => {\n const expr = valueExpr(v, {\n timeUnit: isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.timeUnit : undefined,\n type,\n undefinedIfExprNotRequired: true\n });\n // return signal for the expression if we need an expression\n if (expr !== undefined) {\n return {signal: expr};\n }\n // otherwise just return the original value\n return v;\n });\n}\n\n/**\n * Checks whether a fieldDef for a particular channel requires a computed bin range.\n */\nexport function binRequiresRange(fieldDef: FieldDef, channel: Channel): boolean {\n if (!isBinning(fieldDef.bin)) {\n console.warn('Only call this method for binned field defs.');\n return false;\n }\n\n // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels.\n // We could check whether the axis or legend exists (not disabled) but that seems overkill.\n return isScaleChannel(channel) && contains(['ordinal', 'nominal'], (fieldDef as ScaleFieldDef).type);\n}\n","import {BaseTitle, Text, TextEncodeEntry, TitleAnchor} from 'vega';\nimport {isArray, isString} from 'vega-util';\nimport {MarkConfig} from './mark';\nimport {pick} from './util';\nimport {ExcludeMappedValueRef, ExcludeMappedValueRefButKeepSignal} from './vega.schema';\n\nexport type BaseTitleNoValueRefs = ExcludeMappedValueRefButKeepSignal> &\n // Since some logic depends on align/baseline, Vega-Lite does NOT allow signal for them.\n ExcludeMappedValueRef>;\n\nexport type TitleConfig = BaseTitleNoValueRefs;\n\nexport interface TitleBase extends BaseTitleNoValueRefs {\n /**\n * The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.\n *\n * __Default value:__ `\"middle\"` for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views.\n * `\"start\"` for other composite views.\n *\n * __Note:__ [For now](https://github.com/vega/vega-lite/issues/2875), `anchor` is only customizable only for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. For other composite views, `anchor` is always `\"start\"`.\n */\n anchor?: TitleAnchor;\n\n /**\n * A [mark style property](https://vega.github.io/vega-lite/docs/config.html#style) to apply to the title text mark.\n *\n * __Default value:__ `\"group-title\"`.\n */\n style?: string | string[];\n\n /**\n * \tThe integer z-index indicating the layering of the title group relative to other axis, mark and legend groups.\n *\n * __Default value:__ `0`.\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n\n /**\n * Mark definitions for custom encoding.\n *\n * @hidden\n */\n encoding?: TextEncodeEntry;\n}\n\nexport interface TitleParams extends TitleBase {\n /**\n * The title text.\n */\n text: Text;\n\n /**\n * The subtitle Text.\n */\n subtitle?: Text;\n}\n\nexport function extractTitleConfig(\n titleConfig: TitleConfig\n): {\n titleMarkConfig: MarkConfig;\n subtitleMarkConfig: MarkConfig;\n nonMark: BaseTitleNoValueRefs;\n subtitle: BaseTitleNoValueRefs;\n} {\n const {\n // These are non-mark title config that need to be hardcoded\n anchor,\n frame,\n offset,\n orient,\n\n // color needs to be redirect to fill\n color,\n\n // subtitle properties\n subtitleColor,\n subtitleFont,\n subtitleFontSize,\n subtitleFontStyle,\n subtitleFontWeight,\n subtitleLineHeight,\n subtitlePadding,\n\n // The rest are mark config.\n ...rest\n } = titleConfig;\n\n const titleMarkConfig: MarkConfig = {\n ...rest,\n ...(color ? {fill: color} : {})\n };\n\n // These are non-mark title config that need to be hardcoded\n const nonMark: BaseTitleNoValueRefs = {\n ...(anchor ? {anchor} : {}),\n ...(frame ? {frame} : {}),\n ...(offset ? {offset} : {}),\n ...(orient ? {orient} : {})\n };\n\n // subtitle part can stay in config.title since header titles do not use subtitle\n const subtitle: BaseTitleNoValueRefs = {\n ...(subtitleColor ? {subtitleColor} : {}),\n ...(subtitleFont ? {subtitleFont} : {}),\n ...(subtitleFontSize ? {subtitleFontSize} : {}),\n ...(subtitleFontStyle ? {subtitleFontStyle} : {}),\n ...(subtitleFontWeight ? {subtitleFontWeight} : {}),\n ...(subtitleLineHeight ? {subtitleLineHeight} : {}),\n ...(subtitlePadding ? {subtitlePadding} : {})\n };\n\n const subtitleMarkConfig = pick(titleMarkConfig, ['align', 'baseline', 'dx', 'dy', 'limit']);\n\n return {titleMarkConfig, subtitleMarkConfig, nonMark, subtitle};\n}\n\nexport function isText(v: any): v is Text {\n return isString(v) || (isArray(v) && isString(v[0]));\n}\n","import {SignalRef, Text} from 'vega';\nimport {array, stringValue} from 'vega-util';\nimport {AxisConfig} from '../axis';\nimport {FieldDefBase, FieldRefOption, OrderFieldDef, vgField} from '../channeldef';\nimport {Config, StyleConfigIndex} from '../config';\nimport {MarkConfig, MarkDef} from '../mark';\nimport {SortFields} from '../sort';\nimport {isText} from '../title';\nimport {deepEqual, getFirstDefined} from '../util';\nimport {isSignalRef, VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../vega.schema';\nimport {AxisComponentProps} from './axis/component';\nimport {Explicit} from './split';\nimport {UnitModel} from './unit';\n\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\n\nexport function signalOrValueRef(value: T | SignalRef): {value: T} | SignalRef {\n if (isSignalRef(value)) {\n return value;\n }\n return value !== undefined ? {value} : undefined;\n}\n\nexport function exprFromValueOrSignalRef(ref: VgValueRef | SignalRef): string {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref.value);\n}\n\nexport function signalOrStringValue(v: SignalRef | any) {\n if (isSignalRef(v)) {\n return v.signal;\n }\n return v == null ? null : stringValue(v);\n}\n\nexport function applyMarkConfig(e: VgEncodeEntry, model: UnitModel, propsList: (keyof MarkConfig)[]) {\n for (const property of propsList) {\n const value = getMarkConfig(property, model.markDef, model.config);\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n return e;\n}\n\nexport function getStyles(mark: MarkDef): string[] {\n return [].concat(mark.type, mark.style ?? []);\n}\n\nexport function getMarkPropOrConfig

(\n channel: P,\n mark: MarkDef,\n config: Config,\n opt: {\n vgChannel?: VgEncodeChannel;\n ignoreVgConfig?: boolean;\n } = {}\n): MarkDef[P] {\n const {vgChannel, ignoreVgConfig} = opt;\n if (vgChannel && mark[vgChannel] !== undefined) {\n return mark[vgChannel];\n } else if (mark[channel] !== undefined) {\n return mark[channel];\n } else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) {\n return undefined;\n }\n\n return getMarkConfig(channel, mark, config, opt);\n}\n\n/**\n * Return property value from style or mark specific config property if exists.\n * Otherwise, return general mark specific config.\n */\nexport function getMarkConfig

(\n channel: P,\n mark: MarkDef,\n config: Config,\n {vgChannel}: {vgChannel?: VgEncodeChannel} = {}\n): MarkDef[P] {\n return getFirstDefined(\n // style config has highest precedence\n vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined,\n getMarkStyleConfig(channel, mark, config.style),\n // then mark-specific config\n vgChannel ? config[mark.type][vgChannel] : undefined,\n\n config[mark.type][channel as any], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine\n\n // If there is vgChannel, skip vl channel.\n // For example, vl size for text is vg fontSize, but config.mark.size is only for point size.\n vgChannel ? config.mark[vgChannel] : config.mark[channel as any] // Need to cast for the same reason as above\n );\n}\n\nexport function getMarkStyleConfig

(\n prop: P,\n mark: MarkDef,\n styleConfigIndex: StyleConfigIndex\n) {\n return getStyleConfig(prop, getStyles(mark), styleConfigIndex);\n}\n\nexport function getStyleConfig

(\n p: P,\n styles: string | string[],\n styleConfigIndex: StyleConfigIndex\n) {\n styles = array(styles);\n let value;\n for (const style of styles) {\n const styleConfig = styleConfigIndex[style];\n\n if (styleConfig && styleConfig[p as string] !== undefined) {\n value = styleConfig[p as string];\n }\n }\n return value;\n}\n\n/**\n * Return Vega sort parameters (tuple of field and order).\n */\nexport function sortParams(\n orderDef: OrderFieldDef | OrderFieldDef[],\n fieldRefOption?: FieldRefOption\n): SortFields {\n return array(orderDef).reduce(\n (s, orderChannelDef) => {\n s.field.push(vgField(orderChannelDef, fieldRefOption));\n s.order.push(orderChannelDef.sort ?? 'ascending');\n return s;\n },\n {field: [], order: []}\n );\n}\n\nexport type AxisTitleComponent = AxisComponentProps['title'];\n\nexport function mergeTitleFieldDefs(f1: readonly FieldDefBase[], f2: readonly FieldDefBase[]) {\n const merged = [...f1];\n\n f2.forEach(fdToMerge => {\n for (const fieldDef1 of merged) {\n // If already exists, no need to append to merged array\n if (deepEqual(fieldDef1, fdToMerge)) {\n return;\n }\n }\n merged.push(fdToMerge);\n });\n return merged;\n}\n\nexport function mergeTitle(title1: Text | SignalRef, title2: Text | SignalRef) {\n if (deepEqual(title1, title2) || !title2) {\n // if titles are the same or title2 is falsy\n return title1;\n } else if (!title1) {\n // if title1 is falsy\n return title2;\n } else {\n return [...array(title1), ...array(title2)].join(', ');\n }\n}\n\nexport function mergeTitleComponent(v1: Explicit, v2: Explicit) {\n const v1Val = v1.value;\n const v2Val = v2.value;\n\n if (v1Val == null || v2Val === null) {\n return {\n explicit: v1.explicit,\n value: null\n };\n } else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) {\n return {\n explicit: v1.explicit,\n value: mergeTitle(v1Val, v2Val)\n };\n } else if (isText(v1Val) || isSignalRef(v1Val)) {\n return {\n explicit: v1.explicit,\n value: v1Val\n };\n } else if (isText(v2Val) || isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: v2Val\n };\n } else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: mergeTitleFieldDefs(v1Val, v2Val)\n };\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('It should never reach here');\n}\n","import {AggregateOp} from 'vega';\nimport {array, isArray} from 'vega-util';\nimport {isArgmaxDef, isArgminDef} from './aggregate';\nimport {isBinned, isBinning} from './bin';\nimport {\n ANGLE,\n CHANNELS,\n COLOR,\n DESCRIPTION,\n DETAIL,\n FILL,\n FILLOPACITY,\n HREF,\n isChannel,\n isNonPositionScaleChannel,\n isSecondaryRangeChannel,\n isXorY,\n KEY,\n LATITUDE,\n LATITUDE2,\n LONGITUDE,\n LONGITUDE2,\n OPACITY,\n ORDER,\n RADIUS,\n RADIUS2,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n supportMark,\n TEXT,\n THETA,\n THETA2,\n TOOLTIP,\n URL,\n X,\n X2,\n Y,\n Y2,\n Channel\n} from './channel';\nimport {\n binRequiresRange,\n ChannelDef,\n ColorDef,\n Field,\n FieldDef,\n FieldDefWithoutScale,\n getFieldDef,\n getGuide,\n hasConditionalFieldDef,\n initChannelDef,\n initFieldDef,\n isConditionalDef,\n isDatumDef,\n isFieldDef,\n isTypedFieldDef,\n isValueDef,\n LatLongDef,\n NumericArrayMarkPropDef,\n NumericMarkPropDef,\n OrderFieldDef,\n OrderValueDef,\n PolarDef,\n Position2Def,\n PositionDef,\n SecondaryFieldDef,\n ShapeDef,\n StringFieldDef,\n StringFieldDefWithCondition,\n StringValueDefWithCondition,\n TextDef,\n title,\n TypedFieldDef,\n vgField\n} from './channeldef';\nimport {Config} from './config';\nimport * as log from './log';\nimport {Mark} from './mark';\nimport {EncodingFacetMapping} from './spec/facet';\nimport {AggregatedFieldDef, BinTransform, TimeUnitTransform} from './transform';\nimport {QUANTITATIVE, TEMPORAL} from './type';\nimport {keys, some} from './util';\nimport {isSignalRef} from './vega.schema';\n\nexport interface Encoding {\n /**\n * X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x?: PositionDef;\n\n /**\n * Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y?: PositionDef;\n\n /**\n * X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n // TODO: Ham need to add default behavior\n // `x2` cannot have type as it should have the same type as `x`\n x2?: Position2Def;\n\n /**\n * Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n // TODO: Ham need to add default behavior\n // `y2` cannot have type as it should have the same type as `y`\n y2?: Position2Def;\n\n /**\n * Longitude position of geographically projected marks.\n */\n longitude?: LatLongDef;\n\n /**\n * Latitude position of geographically projected marks.\n */\n latitude?: LatLongDef;\n\n /**\n * Longitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n */\n // `longitude2` cannot have type as it should have the same type as `longitude`\n longitude2?: Position2Def;\n\n /**\n * Latitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n */\n // `latitude2` cannot have type as it should have the same type as `latitude`\n latitude2?: Position2Def;\n\n /**\n * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n *\n * - For text marks, polar coordinate angle in radians.\n */\n theta?: PolarDef;\n\n /**\n * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.\n */\n theta2?: Position2Def;\n\n /**\n * The outer radius in pixels of arc marks.\n */\n\n radius?: PolarDef;\n\n /**\n * The inner radius in pixels of arc marks.\n */\n radius2?: Position2Def;\n\n /**\n * Color of the marks – either fill or stroke color based on the `filled` property of mark definition.\n * By default, `color` represents fill color for `\"area\"`, `\"bar\"`, `\"tick\"`,\n * `\"text\"`, `\"trail\"`, `\"circle\"`, and `\"square\"` / stroke color for `\"line\"` and `\"point\"`.\n *\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_\n * 1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n * 2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme).\n */\n color?: ColorDef;\n\n /**\n * Fill color of the marks.\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n */\n fill?: ColorDef;\n\n /**\n * Stroke color of the marks.\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n */\n\n stroke?: ColorDef;\n\n /**\n * Opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `opacity` property.\n */\n opacity?: NumericMarkPropDef;\n\n /**\n * Fill opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `fillOpacity` property.\n */\n fillOpacity?: NumericMarkPropDef;\n\n /**\n * Stroke opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeOpacity` property.\n */\n strokeOpacity?: NumericMarkPropDef;\n\n /**\n * Stroke width of the marks.\n *\n * __Default value:__ If undefined, the default stroke width depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeWidth` property.\n */\n strokeWidth?: NumericMarkPropDef;\n\n /**\n * Stroke dash of the marks.\n *\n * __Default value:__ `[1,0]` (No dash).\n */\n strokeDash?: NumericArrayMarkPropDef;\n\n /**\n * Size of the mark.\n * - For `\"point\"`, `\"square\"` and `\"circle\"`, – the symbol size, or pixel area of the mark.\n * - For `\"bar\"` and `\"tick\"` – the bar and tick's size.\n * - For `\"text\"` – the text's font size.\n * - Size is unsupported for `\"line\"`, `\"area\"`, and `\"rect\"`. (Use `\"trail\"` instead of line with varying size)\n */\n size?: NumericMarkPropDef;\n\n /**\n * Rotation angle of point and text marks.\n */\n angle?: NumericMarkPropDef;\n\n /**\n * Shape of the mark.\n *\n * 1. For `point` marks the supported values include:\n * - plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n * - the line symbol `\"stroke\"`\n * - centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n * - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n *\n * 2. For `geoshape` marks it should be a field definition of the geojson data\n *\n * __Default value:__ If undefined, the default shape depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#point-config)'s `shape` property. (`\"circle\"` if unset.)\n */\n shape?: ShapeDef;\n /**\n * Additional levels of detail for grouping data in aggregate views and\n * in line, trail, and area marks without mapping data to a specific visual channel.\n */\n detail?: FieldDefWithoutScale | FieldDefWithoutScale[];\n\n /**\n * A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data.\n */\n key?: FieldDefWithoutScale;\n\n /**\n * Text of the `text` mark.\n */\n text?: TextDef;\n\n /**\n * The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n *\n * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n */\n tooltip?: StringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[] | null;\n\n /**\n * A URL to load upon mouse click.\n */\n href?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * The URL of an image mark.\n */\n url?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * A text description of this mark for ARIA accessibility (SVG output only). For SVG output the `\"aria-label\"` attribute will be set to this description.\n */\n description?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * Order of the marks.\n * - For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n * - For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{\"value\": null}` makes the line marks use the original order in the data sources.\n * - Otherwise, this `order` channel encodes layer order of the marks.\n *\n * __Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping.\n */\n order?: OrderFieldDef | OrderFieldDef[] | OrderValueDef;\n}\n\nexport interface EncodingWithFacet extends Encoding, EncodingFacetMapping {}\n\nexport function channelHasField(\n encoding: EncodingWithFacet,\n channel: keyof EncodingWithFacet\n): boolean {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n } else {\n return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef);\n }\n }\n return false;\n}\n\nexport function isAggregate(encoding: EncodingWithFacet) {\n return some(CHANNELS, channel => {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.aggregate);\n } else {\n const fieldDef = getFieldDef(channelDef);\n return fieldDef && !!fieldDef.aggregate;\n }\n }\n return false;\n });\n}\n\nexport function extractTransformsFromEncoding(oldEncoding: Encoding, config: Config) {\n const groupby: string[] = [];\n const bins: BinTransform[] = [];\n const timeUnits: TimeUnitTransform[] = [];\n const aggregate: AggregatedFieldDef[] = [];\n const encoding: Encoding = {};\n\n forEach(oldEncoding, (channelDef, channel) => {\n // Extract potential embedded transformations along with remaining properties\n if (isFieldDef(channelDef)) {\n const {field, aggregate: aggOp, bin, timeUnit, ...remaining} = channelDef;\n if (aggOp || timeUnit || bin) {\n const guide = getGuide(channelDef);\n const isTitleDefined = guide && guide.title;\n let newField = vgField(channelDef, {forAs: true});\n const newFieldDef: FieldDef = {\n // Only add title if it doesn't exist\n ...(isTitleDefined ? [] : {title: title(channelDef, config, {allowDisabling: true})}),\n ...remaining,\n // Always overwrite field\n field: newField\n };\n\n if (aggOp) {\n let op: AggregateOp;\n\n if (isArgmaxDef(aggOp)) {\n op = 'argmax';\n newField = vgField({op: 'argmax', field: aggOp.argmax}, {forAs: true});\n newFieldDef.field = `${newField}.${field}`;\n } else if (isArgminDef(aggOp)) {\n op = 'argmin';\n newField = vgField({op: 'argmin', field: aggOp.argmin}, {forAs: true});\n newFieldDef.field = `${newField}.${field}`;\n } else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') {\n op = aggOp;\n }\n\n if (op) {\n const aggregateEntry: AggregatedFieldDef = {\n op,\n as: newField\n };\n if (field) {\n aggregateEntry.field = field;\n }\n aggregate.push(aggregateEntry);\n }\n } else {\n groupby.push(newField);\n if (isTypedFieldDef(channelDef) && isBinning(bin)) {\n bins.push({bin, field, as: newField});\n // Add additional groupbys for range and end of bins\n groupby.push(vgField(channelDef, {binSuffix: 'end'}));\n if (binRequiresRange(channelDef, channel)) {\n groupby.push(vgField(channelDef, {binSuffix: 'range'}));\n }\n // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively\n if (isXorY(channel)) {\n const secondaryChannel: SecondaryFieldDef = {\n field: newField + '_end'\n };\n encoding[channel + '2'] = secondaryChannel;\n }\n newFieldDef.bin = 'binned';\n if (!isSecondaryRangeChannel(channel)) {\n newFieldDef['type'] = QUANTITATIVE;\n }\n } else if (timeUnit) {\n timeUnits.push({\n timeUnit,\n field,\n as: newField\n });\n\n // define the format type for later compilation\n const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time';\n if (formatType) {\n if (channel === TEXT || channel === TOOLTIP) {\n newFieldDef['formatType'] = formatType;\n } else if (isNonPositionScaleChannel(channel)) {\n newFieldDef['legend'] = {\n formatType,\n ...newFieldDef['legend']\n };\n } else if (isXorY(channel)) {\n newFieldDef['axis'] = {\n formatType,\n ...newFieldDef['axis']\n };\n }\n }\n }\n }\n\n // now the field should refer to post-transformed field instead\n encoding[channel as any] = newFieldDef;\n } else {\n groupby.push(field);\n encoding[channel as any] = oldEncoding[channel];\n }\n } else {\n // For value def / signal ref / datum def, just copy\n encoding[channel as any] = oldEncoding[channel];\n }\n });\n\n return {\n bins,\n timeUnits,\n aggregate,\n groupby,\n encoding\n };\n}\n\nexport function markChannelCompatible(encoding: Encoding, channel: Channel, mark: Mark) {\n const markSupported = supportMark(channel, mark);\n if (!markSupported) {\n return false;\n } else if (markSupported === 'binned') {\n const primaryFieldDef = encoding[channel === X2 ? X : Y];\n\n // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef\n // has \"binned\" data and thus need x2/y2 to specify the bin-end field.\n if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) {\n return true;\n } else {\n return false;\n }\n }\n return true;\n}\n\nexport function initEncoding(\n encoding: Encoding,\n mark: Mark,\n filled: boolean,\n config: Config\n): Encoding {\n return keys(encoding).reduce((normalizedEncoding: Encoding, channel: Channel) => {\n if (!isChannel(channel)) {\n // Drop invalid channel\n log.warn(log.message.invalidEncodingChannel(channel));\n return normalizedEncoding;\n }\n\n const channelDef = encoding[channel];\n if (channel === 'angle' && mark === 'arc' && !encoding.theta) {\n log.warn(log.message.REPLACE_ANGLE_WITH_THETA);\n channel = THETA;\n }\n\n if (!markChannelCompatible(encoding, channel, mark)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, mark));\n return normalizedEncoding;\n }\n\n // Drop line's size if the field is aggregated.\n if (channel === SIZE && mark === 'line') {\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef?.aggregate) {\n log.warn(log.message.LINE_WITH_VARYING_SIZE);\n return normalizedEncoding;\n }\n }\n // Drop color if either fill or stroke is specified\n\n if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) {\n log.warn(log.message.droppingColor('encoding', {fill: 'fill' in encoding, stroke: 'stroke' in encoding}));\n return normalizedEncoding;\n }\n\n if (\n channel === DETAIL ||\n (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) ||\n (channel === TOOLTIP && isArray(channelDef))\n ) {\n if (channelDef) {\n // Array of fieldDefs for detail channel (or production rule)\n (normalizedEncoding[channel] as any) = array(channelDef).reduce(\n (defs: FieldDef[], fieldDef: FieldDef) => {\n if (!isFieldDef(fieldDef)) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n } else {\n defs.push(initFieldDef(fieldDef, channel));\n }\n return defs;\n },\n []\n );\n }\n } else {\n if (channel === TOOLTIP && channelDef === null) {\n // Preserve null so we can use it to disable tooltip\n normalizedEncoding[channel] = null;\n } else if (\n !isFieldDef(channelDef) &&\n !isDatumDef(channelDef) &&\n !isValueDef(channelDef) &&\n !isConditionalDef(channelDef) &&\n !isSignalRef(channelDef)\n ) {\n log.warn(log.message.emptyFieldDef(channelDef, channel));\n return normalizedEncoding;\n }\n\n normalizedEncoding[channel as any] = initChannelDef(channelDef as ChannelDef, channel, config);\n }\n return normalizedEncoding;\n }, {});\n}\n\n/**\n * For composite marks, we have to call initChannelDef during init so we can infer types earlier.\n */\nexport function normalizeEncoding(encoding: Encoding, config: Config): Encoding {\n return keys(encoding).reduce((normalizedEncoding: Encoding, channel) => {\n const newChannelDef = initChannelDef(encoding[channel], channel, config, {compositeMark: true});\n\n normalizedEncoding[channel as any] = newChannelDef;\n return normalizedEncoding;\n }, {});\n}\n\nexport function fieldDefs(encoding: EncodingWithFacet): FieldDef[] {\n const arr: FieldDef[] = [];\n for (const channel of keys(encoding)) {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n const channelDefArray = array(channelDef);\n for (const def of channelDefArray) {\n if (isFieldDef(def)) {\n arr.push(def);\n } else if (hasConditionalFieldDef(def)) {\n arr.push(def.condition);\n }\n }\n }\n }\n return arr;\n}\n\nexport function forEach>(\n mapping: U,\n f: (cd: ChannelDef, c: keyof U) => void,\n thisArg?: any\n) {\n if (!mapping) {\n return;\n }\n\n for (const channel of keys(mapping)) {\n const el = mapping[channel];\n if (isArray(el)) {\n for (const channelDef of el as unknown[]) {\n f.call(thisArg, channelDef, channel);\n }\n } else {\n f.call(thisArg, el, channel);\n }\n }\n}\n\nexport function reduce>(\n mapping: U,\n f: (acc: any, fd: TypedFieldDef, c: keyof U) => U,\n init: T,\n thisArg?: any\n) {\n if (!mapping) {\n return init;\n }\n\n return keys(mapping).reduce((r, channel) => {\n const map = mapping[channel];\n if (isArray(map)) {\n return map.reduce((r1: T, channelDef: ChannelDef) => {\n return f.call(thisArg, r1, channelDef, channel);\n }, r);\n } else {\n return f.call(thisArg, r, map, channel);\n }\n }, init);\n}\n\n/**\n * Returns list of path grouping fields for the given encoding\n */\nexport function pathGroupingFields(mark: Mark, encoding: Encoding): string[] {\n return keys(encoding).reduce((details, channel) => {\n switch (channel) {\n // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group\n case X:\n case Y:\n case HREF:\n case DESCRIPTION:\n case URL:\n case X2:\n case Y2:\n case THETA:\n case THETA2:\n case RADIUS:\n case RADIUS2:\n // falls through\n\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n // TODO: case 'cursor':\n\n // text, shape, shouldn't be a part of line/trail/area [falls through]\n case TEXT:\n case SHAPE:\n case ANGLE:\n // falls through\n\n // tooltip fields should not be added to group by [falls through]\n case TOOLTIP:\n return details;\n\n case ORDER:\n // order should not group line / trail\n if (mark === 'line' || mark === 'trail') {\n return details;\n }\n // but order should group area for stacking (falls through)\n\n case DETAIL:\n case KEY: {\n const channelDef = encoding[channel];\n if (isArray(channelDef) || isFieldDef(channelDef)) {\n for (const fieldDef of array(channelDef)) {\n if (!fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n }\n }\n return details;\n }\n\n case SIZE:\n if (mark === 'trail') {\n // For trail, size should not group trail lines.\n return details;\n }\n // For line, size should group lines.\n\n // falls through\n case COLOR:\n case FILL:\n case STROKE:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEDASH:\n case STROKEWIDTH: {\n // TODO strokeDashOffset:\n // falls through\n\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef && !fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n return details;\n }\n }\n }, []);\n}\n","import {Orientation, SignalRef, Text} from 'vega';\nimport {isArray, isBoolean, isString} from 'vega-util';\nimport {CompositeMark, CompositeMarkDef} from '.';\nimport {\n Field,\n FieldDefBase,\n isContinuousFieldOrDatumDef,\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n PositionFieldDef,\n SecondaryFieldDef,\n StringFieldDef,\n StringFieldDefWithCondition,\n StringValueDefWithCondition\n} from '../channeldef';\nimport {Encoding, fieldDefs} from '../encoding';\nimport * as log from '../log';\nimport {ColorMixins, GenericMarkDef, isMarkDef, Mark, MarkConfig, MarkDef} from '../mark';\nimport {GenericUnitSpec, NormalizedUnitSpec} from '../spec';\nimport {getFirstDefined, hash, unique} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {toStringFieldDef} from './../channeldef';\n\nexport type PartsMixins

= Partial>;\n\nexport type GenericCompositeMarkDef = GenericMarkDef &\n ColorMixins & {\n /**\n * The opacity (value between [0,1]) of the mark.\n */\n opacity?: number;\n\n /**\n * Whether a composite mark be clipped to the enclosing group’s width and height.\n */\n clip?: boolean;\n };\n\nexport interface CompositeMarkTooltipSummary {\n /**\n * The prefix of the field to be shown in tooltip\n */\n fieldPrefix: string;\n\n /**\n * The title prefix to show, corresponding to the field with field prefix `fieldPrefix`\n */\n titlePrefix: Text | SignalRef;\n}\n\nexport function filterTooltipWithAggregatedField(\n oldEncoding: Encoding\n): {\n customTooltipWithoutAggregatedField?:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n filteredEncoding: Encoding;\n} {\n const {tooltip, ...filteredEncoding} = oldEncoding;\n if (!tooltip) {\n return {filteredEncoding};\n }\n\n let customTooltipWithAggregatedField:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n let customTooltipWithoutAggregatedField:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n\n if (isArray(tooltip)) {\n for (const t of tooltip) {\n if (t.aggregate) {\n if (!customTooltipWithAggregatedField) {\n customTooltipWithAggregatedField = [];\n }\n (customTooltipWithAggregatedField as StringFieldDef[]).push(t);\n } else {\n if (!customTooltipWithoutAggregatedField) {\n customTooltipWithoutAggregatedField = [];\n }\n (customTooltipWithoutAggregatedField as StringFieldDef[]).push(t);\n }\n }\n\n if (customTooltipWithAggregatedField) {\n (filteredEncoding as Encoding).tooltip = customTooltipWithAggregatedField;\n }\n } else {\n if (tooltip['aggregate']) {\n (filteredEncoding as Encoding).tooltip = tooltip;\n } else {\n customTooltipWithoutAggregatedField = tooltip;\n }\n }\n\n if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) {\n customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0];\n }\n return {customTooltipWithoutAggregatedField, filteredEncoding};\n}\n\nexport function getCompositeMarkTooltip(\n tooltipSummary: CompositeMarkTooltipSummary[],\n continuousAxisChannelDef: PositionFieldDef,\n encodingWithoutContinuousAxis: Encoding,\n withFieldName = true\n): Encoding {\n if ('tooltip' in encodingWithoutContinuousAxis) {\n return {tooltip: encodingWithoutContinuousAxis.tooltip};\n }\n\n const fiveSummaryTooltip: StringFieldDef[] = tooltipSummary.map(\n ({fieldPrefix, titlePrefix}): StringFieldDef => {\n const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : '';\n return {\n field: fieldPrefix + continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n title: isSignalRef(titlePrefix) ? {signal: titlePrefix + `\"${escape(mainTitle)}\"`} : titlePrefix + mainTitle\n };\n }\n );\n\n const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef);\n\n return {\n tooltip: [\n ...fiveSummaryTooltip,\n // need to cast because TextFieldDef supports fewer types of bin\n ...unique(tooltipFieldDefs, hash)\n ]\n };\n}\n\nexport function getTitle(continuousAxisChannelDef: PositionFieldDef) {\n const {title, field} = continuousAxisChannelDef;\n return getFirstDefined(title, field);\n}\n\nexport function makeCompositeAggregatePartFactory

>(\n compositeMarkDef: GenericCompositeMarkDef & P,\n continuousAxis: 'x' | 'y',\n continuousAxisChannelDef: PositionFieldDef,\n sharedEncoding: Encoding,\n compositeMarkConfig: P\n) {\n const {scale, axis} = continuousAxisChannelDef;\n\n return ({\n partName,\n mark,\n positionPrefix,\n endPositionPrefix = undefined,\n extraEncoding = {}\n }: {\n partName: keyof P;\n mark: Mark | MarkDef;\n positionPrefix: string;\n endPositionPrefix?: string;\n extraEncoding?: Encoding;\n }) => {\n const title = getTitle(continuousAxisChannelDef);\n\n return partLayerMixins

(compositeMarkDef, partName, compositeMarkConfig, {\n mark, // TODO better remove this method and just have mark as a parameter of the method\n encoding: {\n [continuousAxis]: {\n field: positionPrefix + '_' + continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? {title} : {}),\n ...(scale !== undefined ? {scale} : {}),\n ...(axis !== undefined ? {axis} : {})\n },\n ...(isString(endPositionPrefix)\n ? {\n [continuousAxis + '2']: {\n field: endPositionPrefix + '_' + continuousAxisChannelDef.field\n }\n }\n : {}),\n ...sharedEncoding,\n ...extraEncoding\n }\n });\n };\n}\n\nexport function partLayerMixins

>(\n markDef: GenericCompositeMarkDef & P,\n part: keyof P,\n compositeMarkConfig: P,\n partBaseSpec: NormalizedUnitSpec\n): NormalizedUnitSpec[] {\n const {clip, color, opacity} = markDef;\n\n const mark = markDef.type;\n\n if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) {\n return [\n {\n ...partBaseSpec,\n mark: {\n ...(compositeMarkConfig[part] as MarkConfig),\n ...(clip ? {clip} : {}),\n ...(color ? {color} : {}),\n ...(opacity ? {opacity} : {}),\n ...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : {type: partBaseSpec.mark}),\n style: `${mark}-${part}`,\n ...(isBoolean(markDef[part]) ? {} : (markDef[part] as MarkConfig))\n }\n }\n ];\n }\n return [];\n}\n\nexport function compositeMarkContinuousAxis(\n spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>,\n orient: Orientation,\n compositeMark: M\n): {\n continuousAxisChannelDef: PositionFieldDef;\n continuousAxisChannelDef2: SecondaryFieldDef;\n continuousAxisChannelDefError: SecondaryFieldDef;\n continuousAxisChannelDefError2: SecondaryFieldDef;\n continuousAxis: 'x' | 'y';\n} {\n const {encoding} = spec;\n const continuousAxis: 'x' | 'y' = orient === 'vertical' ? 'y' : 'x';\n\n const continuousAxisChannelDef = encoding[continuousAxis] as PositionFieldDef; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal.\n const continuousAxisChannelDef2 = encoding[continuousAxis + '2'] as SecondaryFieldDef;\n const continuousAxisChannelDefError = encoding[continuousAxis + 'Error'] as SecondaryFieldDef;\n const continuousAxisChannelDefError2 = encoding[continuousAxis + 'Error2'] as SecondaryFieldDef;\n\n return {\n continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark),\n continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark),\n continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark),\n continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark),\n continuousAxis\n };\n}\n\nfunction filterAggregateFromChannelDef>(\n continuousAxisChannelDef: F,\n compositeMark: M\n): F {\n if (continuousAxisChannelDef && continuousAxisChannelDef.aggregate) {\n const {aggregate, ...continuousAxisWithoutAggregate} = continuousAxisChannelDef;\n if (aggregate !== compositeMark) {\n log.warn(log.message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark));\n }\n return continuousAxisWithoutAggregate as F;\n } else {\n return continuousAxisChannelDef;\n }\n}\n\nexport function compositeMarkOrient(\n spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>,\n compositeMark: M\n): Orientation {\n const {mark, encoding} = spec;\n const {x, y} = encoding;\n\n if (isMarkDef(mark) && mark.orient) {\n return mark.orient;\n }\n\n if (isContinuousFieldOrDatumDef(x)) {\n // x is continuous\n if (isContinuousFieldOrDatumDef(y)) {\n // both x and y are continuous\n const xAggregate = isFieldDef(x) && x.aggregate;\n const yAggregate = isFieldDef(y) && y.aggregate;\n\n if (!xAggregate && yAggregate === compositeMark) {\n return 'vertical';\n } else if (!yAggregate && xAggregate === compositeMark) {\n return 'horizontal';\n } else if (xAggregate === compositeMark && yAggregate === compositeMark) {\n throw new Error('Both x and y cannot have aggregate');\n } else {\n if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) {\n // y is temporal but x is not\n return 'horizontal';\n }\n\n // default orientation for two continuous\n return 'vertical';\n }\n }\n\n return 'horizontal';\n } else if (isContinuousFieldOrDatumDef(y)) {\n // y is continuous but x is not\n return 'vertical';\n } else {\n // Neither x nor y is continuous.\n throw new Error(`Need a valid continuous axis for ${compositeMark}s`);\n }\n}\n","import {Orientation} from 'vega';\nimport {isNumber, isObject} from 'vega-util';\nimport {getMarkPropOrConfig} from '../compile/common';\nimport {Config} from '../config';\nimport {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {isMarkDef, MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec, NormalizedUnitSpec} from '../spec';\nimport {AggregatedFieldDef, CalculateTransform, JoinAggregateTransform, Transform} from '../transform';\nimport {isEmpty, omit} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {\n compositeMarkContinuousAxis,\n compositeMarkOrient,\n filterTooltipWithAggregatedField,\n GenericCompositeMarkDef,\n getCompositeMarkTooltip,\n getTitle,\n makeCompositeAggregatePartFactory,\n partLayerMixins,\n PartsMixins\n} from './common';\n\nexport const BOXPLOT = 'boxplot' as const;\nexport type BoxPlot = typeof BOXPLOT;\n\nexport const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks'] as const;\n\ntype BoxPlotPart = typeof BOXPLOT_PARTS[number];\n\nexport type BoxPlotPartsMixins = PartsMixins;\n\nexport interface BoxPlotConfig extends BoxPlotPartsMixins {\n /** Size of the box and median tick of a box plot */\n size?: number;\n\n /**\n * The extent of the whiskers. Available options include:\n * - `\"min-max\"`: min and max are the lower and upper whiskers respectively.\n * - A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_).\n *\n * __Default value:__ `1.5`.\n */\n extent?: 'min-max' | number;\n}\n\nexport type BoxPlotDef = GenericCompositeMarkDef &\n BoxPlotConfig & {\n /**\n * Type of the mark. For box plots, this should always be `\"boxplot\"`.\n * [boxplot](https://vega.github.io/vega-lite/docs/boxplot.html)\n */\n type: BoxPlot;\n\n /**\n * Orientation of the box plot. This is normally automatically determined based on types of fields on x and y channels. However, an explicit `orient` be specified when the orientation is ambiguous.\n *\n * __Default value:__ `\"vertical\"`.\n */\n orient?: Orientation;\n };\n\nexport interface BoxPlotConfigMixins {\n /**\n * Box Config\n */\n boxplot?: BoxPlotConfig;\n}\n\nexport const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot);\n\nexport function getBoxPlotType(extent: number | 'min-max') {\n if (isNumber(extent)) {\n return 'tukey';\n }\n // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now.\n return extent;\n}\n\nexport function normalizeBoxPlot(\n spec: GenericUnitSpec, BoxPlot | BoxPlotDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const {mark, encoding: _encoding, selection, projection: _p, ...outerSpec} = spec;\n const markDef: BoxPlotDef = isMarkDef(mark) ? mark : {type: mark};\n\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (selection) {\n log.warn(log.message.selectionNotSupported('boxplot'));\n }\n\n const extent = markDef.extent ?? config.boxplot.extent;\n const sizeValue = getMarkPropOrConfig(\n 'size',\n markDef as any, // TODO: https://github.com/vega/vega-lite/issues/6245\n config\n );\n\n const boxPlotType = getBoxPlotType(extent);\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n groupby,\n aggregate,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n } = boxParams(spec, extent, config);\n\n const {color, size, ...encodingWithoutSizeColorAndContinuousAxis} = encodingWithoutContinuousAxis;\n\n const makeBoxPlotPart = (sharedEncoding: Encoding) => {\n return makeCompositeAggregatePartFactory(\n markDef,\n continuousAxis,\n continuousAxisChannelDef,\n sharedEncoding,\n config.boxplot\n );\n };\n\n const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis);\n const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis);\n const makeBoxPlotMidTick = makeBoxPlotPart({...encodingWithoutSizeColorAndContinuousAxis, ...(size ? {size} : {})});\n\n const fiveSummaryTooltipEncoding: Encoding = getCompositeMarkTooltip(\n [\n {fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max'},\n {fieldPrefix: 'upper_box_', titlePrefix: 'Q3'},\n {fieldPrefix: 'mid_box_', titlePrefix: 'Median'},\n {fieldPrefix: 'lower_box_', titlePrefix: 'Q1'},\n {fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min'}\n ],\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis\n );\n\n // ## Whisker Layers\n\n const endTick: MarkDef = {type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid: null, aria: false};\n const whiskerTooltipEncoding: Encoding =\n boxPlotType === 'min-max'\n ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker\n : // for tukey / k-IQR, just show upper/lower-whisker\n getCompositeMarkTooltip(\n [\n {fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker'},\n {fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker'}\n ],\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis\n );\n\n const whiskerLayers = [\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: {type: 'rule', invalid: null, aria: false},\n positionPrefix: 'lower_whisker',\n endPositionPrefix: 'lower_box',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: {type: 'rule', invalid: null, aria: false},\n positionPrefix: 'upper_box',\n endPositionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'lower_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n })\n ];\n\n // ## Box Layers\n\n // TODO: support hiding certain mark parts\n const boxLayers: NormalizedUnitSpec[] = [\n ...(boxPlotType !== 'tukey' ? whiskerLayers : []),\n ...makeBoxPlotBox({\n partName: 'box',\n mark: {\n type: 'bar',\n ...(sizeValue ? {size: sizeValue} : {}),\n orient: boxOrient,\n invalid: null,\n ariaRoleDescription: 'box'\n },\n positionPrefix: 'lower_box',\n endPositionPrefix: 'upper_box',\n extraEncoding: fiveSummaryTooltipEncoding\n }),\n ...makeBoxPlotMidTick({\n partName: 'median',\n mark: {\n type: 'tick',\n invalid: null,\n ...(isObject(config.boxplot.median) && config.boxplot.median.color ? {color: config.boxplot.median.color} : {}),\n ...(sizeValue ? {size: sizeValue} : {}),\n orient: ticksOrient,\n aria: false\n },\n positionPrefix: 'mid_box',\n extraEncoding: fiveSummaryTooltipEncoding\n })\n ];\n\n // ## Filtered Layers\n\n let filteredLayersMixins: NormalizedUnitSpec | NormalizedLayerSpec;\n\n if (boxPlotType !== 'min-max') {\n const lowerBoxExpr = `datum[\"lower_box_${continuousAxisChannelDef.field}\"]`;\n const upperBoxExpr = `datum[\"upper_box_${continuousAxisChannelDef.field}\"]`;\n const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`;\n const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`;\n const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`;\n const fieldExpr = `datum[\"${continuousAxisChannelDef.field}\"]`;\n\n const joinaggregateTransform: JoinAggregateTransform = {\n joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field),\n groupby\n };\n\n let filteredWhiskerSpec: NormalizedLayerSpec = undefined;\n if (boxPlotType === 'tukey') {\n filteredWhiskerSpec = {\n transform: [\n {\n filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})`\n },\n {\n aggregate: [\n {\n op: 'min',\n field: continuousAxisChannelDef.field,\n as: 'lower_whisker_' + continuousAxisChannelDef.field\n },\n {\n op: 'max',\n field: continuousAxisChannelDef.field,\n as: 'upper_whisker_' + continuousAxisChannelDef.field\n },\n // preserve lower_box / upper_box\n {\n op: 'min',\n field: 'lower_box_' + continuousAxisChannelDef.field,\n as: 'lower_box_' + continuousAxisChannelDef.field\n },\n {\n op: 'max',\n field: 'upper_box_' + continuousAxisChannelDef.field,\n as: 'upper_box_' + continuousAxisChannelDef.field\n },\n ...aggregate\n ],\n groupby\n }\n ],\n layer: whiskerLayers\n };\n }\n\n const {tooltip, ...encodingWithoutSizeColorContinuousAxisAndTooltip} = encodingWithoutSizeColorAndContinuousAxis;\n\n const {scale, axis} = continuousAxisChannelDef;\n const title = getTitle(continuousAxisChannelDef);\n const axisWithoutTitle = omit(axis, ['title']);\n\n const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, {\n transform: [{filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})`}],\n mark: 'point',\n encoding: {\n [continuousAxis]: {\n field: continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? {title} : {}),\n ...(scale !== undefined ? {scale} : {}),\n // add axis without title since we already added the title above\n ...(isEmpty(axisWithoutTitle) ? {} : {axis: axisWithoutTitle})\n },\n ...encodingWithoutSizeColorContinuousAxisAndTooltip,\n ...(customTooltipWithoutAggregatedField ? {tooltip: customTooltipWithoutAggregatedField} : {})\n }\n })[0];\n\n if (outlierLayersMixins && filteredWhiskerSpec) {\n filteredLayersMixins = {\n transform: [joinaggregateTransform],\n layer: [outlierLayersMixins, filteredWhiskerSpec]\n };\n } else if (outlierLayersMixins) {\n filteredLayersMixins = outlierLayersMixins;\n filteredLayersMixins.transform.unshift(joinaggregateTransform);\n } else if (filteredWhiskerSpec) {\n filteredLayersMixins = filteredWhiskerSpec;\n filteredLayersMixins.transform.unshift(joinaggregateTransform);\n }\n }\n\n if (filteredLayersMixins) {\n // tukey box plot with outliers included\n return {\n ...outerSpec,\n layer: [\n filteredLayersMixins,\n {\n // boxplot\n transform,\n layer: boxLayers\n }\n ]\n };\n }\n return {\n ...outerSpec,\n transform: (outerSpec.transform ?? []).concat(transform),\n layer: boxLayers\n };\n}\n\nfunction boxParamsQuartiles(continousAxisField: string): AggregatedFieldDef[] {\n return [\n {\n op: 'q1',\n field: continousAxisField,\n as: 'lower_box_' + continousAxisField\n },\n {\n op: 'q3',\n field: continousAxisField,\n as: 'upper_box_' + continousAxisField\n }\n ];\n}\n\nfunction boxParams(\n spec: GenericUnitSpec, BoxPlot | BoxPlotDef>,\n extent: 'min-max' | number,\n config: Config\n) {\n const orient = compositeMarkOrient(spec, BOXPLOT);\n const {continuousAxisChannelDef, continuousAxis} = compositeMarkContinuousAxis(spec, orient, BOXPLOT);\n const continuousFieldName: string = continuousAxisChannelDef.field;\n\n const boxPlotType = getBoxPlotType(extent);\n\n const boxplotSpecificAggregate: AggregatedFieldDef[] = [\n ...boxParamsQuartiles(continuousFieldName),\n {\n op: 'median',\n field: continuousFieldName,\n as: 'mid_box_' + continuousFieldName\n },\n {\n op: 'min',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName\n },\n {\n op: 'max',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName\n }\n ];\n\n const postAggregateCalculates: CalculateTransform[] =\n boxPlotType === 'min-max' || boxPlotType === 'tukey'\n ? []\n : [\n // This is for the original k-IQR, which we do not expose\n {\n calculate: `datum[\"upper_box_${continuousFieldName}\"] - datum[\"lower_box_${continuousFieldName}\"]`,\n as: 'iqr_' + continuousFieldName\n },\n {\n calculate: `min(datum[\"upper_box_${continuousFieldName}\"] + datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"max_${continuousFieldName}\"])`,\n as: 'upper_whisker_' + continuousFieldName\n },\n {\n calculate: `max(datum[\"lower_box_${continuousFieldName}\"] - datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"min_${continuousFieldName}\"])`,\n as: 'lower_whisker_' + continuousFieldName\n }\n ];\n\n const {[continuousAxis]: oldContinuousAxisChannelDef, ...oldEncodingWithoutContinuousAxis} = spec.encoding;\n const {customTooltipWithoutAggregatedField, filteredEncoding} = filterTooltipWithAggregatedField(\n oldEncodingWithoutContinuousAxis\n );\n\n const {bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis} = extractTransformsFromEncoding(\n filteredEncoding,\n config\n );\n\n const ticksOrient: Orientation = orient === 'vertical' ? 'horizontal' : 'vertical';\n const boxOrient: Orientation = orient;\n\n const transform: Transform[] = [\n ...bins,\n ...timeUnits,\n {\n aggregate: [...aggregate, ...boxplotSpecificAggregate],\n groupby\n },\n ...postAggregateCalculates\n ];\n\n return {\n transform,\n groupby,\n aggregate,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n };\n}\n","import {AggregateOp, Orientation, Text} from 'vega';\nimport {PositionChannel} from '../channel';\nimport {\n Field,\n isContinuousFieldOrDatumDef,\n isFieldOrDatumDef,\n PositionFieldDef,\n SecondaryFieldDef,\n title,\n ValueDef\n} from '../channeldef';\nimport {Config} from '../config';\nimport {Data} from '../data';\nimport {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {isMarkDef, MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {Step} from '../spec/base';\nimport {NormalizedUnitSpec} from '../spec/unit';\nimport {TitleParams} from '../title';\nimport {AggregatedFieldDef, CalculateTransform, Transform} from '../transform';\nimport {replaceAll, titleCase} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {\n compositeMarkContinuousAxis,\n compositeMarkOrient,\n CompositeMarkTooltipSummary,\n GenericCompositeMarkDef,\n getCompositeMarkTooltip,\n makeCompositeAggregatePartFactory,\n PartsMixins\n} from './common';\nimport {ErrorBand, ErrorBandDef} from './errorband';\n\nexport const ERRORBAR = 'errorbar' as const;\nexport type ErrorBar = typeof ERRORBAR;\n\nexport type ErrorBarExtent = 'ci' | 'iqr' | 'stderr' | 'stdev';\nexport type ErrorBarCenter = 'mean' | 'median';\n\nexport type ErrorInputType = 'raw' | 'aggregated-upper-lower' | 'aggregated-error';\n\nexport const ERRORBAR_PARTS = ['ticks', 'rule'] as const;\n\nexport type ErrorBarPart = typeof ERRORBAR_PARTS[number];\n\nexport interface ErrorExtraEncoding {\n /**\n * Error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n xError?: SecondaryFieldDef | ValueDef;\n\n /**\n * Secondary error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n // `xError2` cannot have type as it should have the same type as `xError`\n xError2?: SecondaryFieldDef | ValueDef;\n\n /**\n * Error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n yError?: SecondaryFieldDef | ValueDef;\n\n /**\n * Secondary error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n // `yError2` cannot have type as it should have the same type as `yError`\n yError2?: SecondaryFieldDef | ValueDef;\n}\n\nexport type ErrorEncoding = Pick, PositionChannel | 'color' | 'detail' | 'opacity'> &\n ErrorExtraEncoding;\n\nexport type ErrorBarPartsMixins = PartsMixins;\n\nexport interface ErrorBarConfig extends ErrorBarPartsMixins {\n /**\n * The center of the errorbar. Available options include:\n * - `\"mean\"`: the mean of the data points.\n * - `\"median\"`: the median of the data points.\n *\n * __Default value:__ `\"mean\"`.\n * @hidden\n */\n\n // center is not needed right now but will be added back to the schema if future features require it.\n center?: ErrorBarCenter;\n\n /**\n * The extent of the rule. Available options include:\n * - `\"ci\"`: Extend the rule to the confidence interval of the mean.\n * - `\"stderr\"`: The size of rule are set to the value of standard error, extending from the mean.\n * - `\"stdev\"`: The size of rule are set to the value of standard deviation, extending from the mean.\n * - `\"iqr\"`: Extend the rule to the q1 and q3.\n *\n * __Default value:__ `\"stderr\"`.\n */\n extent?: ErrorBarExtent;\n}\n\nexport type ErrorBarDef = GenericCompositeMarkDef &\n ErrorBarConfig & {\n /**\n * Orientation of the error bar. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined.\n */\n orient?: Orientation;\n };\n\nexport interface ErrorBarConfigMixins {\n /**\n * ErrorBar Config\n */\n errorbar?: ErrorBarConfig;\n}\n\nexport const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar);\n\nexport function normalizeErrorBar(\n spec: GenericUnitSpec, ErrorBar | ErrorBarDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec | NormalizedUnitSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n markDef,\n outerSpec,\n tooltipEncoding\n } = errorBarParams(spec, ERRORBAR, config);\n\n const makeErrorBarPart = makeCompositeAggregatePartFactory(\n markDef,\n continuousAxis,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n config.errorbar\n );\n\n const tick: MarkDef = {type: 'tick', orient: ticksOrient, aria: false};\n\n const layer = [\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'lower',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'rule',\n mark: {\n type: 'rule',\n ariaRoleDescription: 'errorbar'\n },\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ];\n\n return {\n ...outerSpec,\n transform,\n ...(layer.length > 1 ? {layer} : {...layer[0]})\n };\n}\n\nfunction errorBarOrientAndInputType(\n spec: GenericUnitSpec, ErrorBar | ErrorBand | ErrorBarDef | ErrorBandDef>,\n compositeMark: ErrorBar | ErrorBand\n): {\n orient: Orientation;\n inputType: ErrorInputType;\n} {\n const {encoding} = spec;\n\n if (errorBarIsInputTypeRaw(encoding)) {\n return {\n orient: compositeMarkOrient(spec, compositeMark),\n inputType: 'raw'\n };\n }\n\n const isTypeAggregatedUpperLower: boolean = errorBarIsInputTypeAggregatedUpperLower(encoding);\n const isTypeAggregatedError: boolean = errorBarIsInputTypeAggregatedError(encoding);\n const x = encoding.x;\n const y = encoding.y;\n\n if (isTypeAggregatedUpperLower) {\n // type is aggregated-upper-lower\n\n if (isTypeAggregatedError) {\n throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`);\n }\n\n const x2 = encoding.x2;\n const y2 = encoding.y2;\n\n if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) {\n // having both x, x2 and y, y2\n throw new Error(`${compositeMark} cannot have both x2 and y2`);\n } else if (isFieldOrDatumDef(x2)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x, x2 quantitative and field y, y2 are not specified\n return {orient: 'horizontal', inputType: 'aggregated-upper-lower'};\n } else {\n // having x, x2 that are not both quantitative\n throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`);\n }\n } else if (isFieldOrDatumDef(y2)) {\n // y2 is a FieldDef\n if (isContinuousFieldOrDatumDef(y)) {\n // having y, y2 quantitative and field x, x2 are not specified\n return {orient: 'vertical', inputType: 'aggregated-upper-lower'};\n } else {\n // having y, y2 that are not both quantitative\n throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`);\n }\n }\n throw new Error('No ranged axis');\n } else {\n // type is aggregated-error\n\n const xError = encoding.xError;\n const xError2 = encoding.xError2;\n const yError = encoding.yError;\n const yError2 = encoding.yError2;\n\n if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) {\n // having xError2 without xError\n throw new Error(`${compositeMark} cannot have xError2 without xError`);\n }\n\n if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) {\n // having yError2 without yError\n throw new Error(`${compositeMark} cannot have yError2 without yError`);\n }\n\n if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) {\n // having both xError and yError\n throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`);\n } else if (isFieldOrDatumDef(xError)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x and xError that are all quantitative\n return {orient: 'horizontal', inputType: 'aggregated-error'};\n } else {\n // having x, xError, and xError2 that are not all quantitative\n throw new Error('All x, xError, and xError2 (if exist) have to be quantitative');\n }\n } else if (isFieldOrDatumDef(yError)) {\n if (isContinuousFieldOrDatumDef(y)) {\n // having y and yError that are all quantitative\n return {orient: 'vertical', inputType: 'aggregated-error'};\n } else {\n // having y, yError, and yError2 that are not all quantitative\n throw new Error('All y, yError, and yError2 (if exist) have to be quantitative');\n }\n }\n throw new Error('No ranged axis');\n }\n}\n\nfunction errorBarIsInputTypeRaw(encoding: ErrorEncoding): boolean {\n return (\n (isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) &&\n !isFieldOrDatumDef(encoding.x2) &&\n !isFieldOrDatumDef(encoding.y2) &&\n !isFieldOrDatumDef(encoding.xError) &&\n !isFieldOrDatumDef(encoding.xError2) &&\n !isFieldOrDatumDef(encoding.yError) &&\n !isFieldOrDatumDef(encoding.yError2)\n );\n}\n\nfunction errorBarIsInputTypeAggregatedUpperLower(encoding: ErrorEncoding): boolean {\n return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2);\n}\n\nfunction errorBarIsInputTypeAggregatedError(encoding: ErrorEncoding): boolean {\n return (\n isFieldOrDatumDef(encoding.xError) ||\n isFieldOrDatumDef(encoding.xError2) ||\n isFieldOrDatumDef(encoding.yError) ||\n isFieldOrDatumDef(encoding.yError2)\n );\n}\n\nexport function errorBarParams<\n M extends ErrorBar | ErrorBand,\n MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef)\n>(\n spec: GenericUnitSpec, M | MD>,\n compositeMark: M,\n config: Config\n): {\n transform: Transform[];\n groupby: string[];\n continuousAxisChannelDef: PositionFieldDef;\n continuousAxis: 'x' | 'y';\n encodingWithoutContinuousAxis: ErrorEncoding;\n ticksOrient: Orientation;\n markDef: MD;\n outerSpec: {\n data?: Data;\n title?: Text | TitleParams;\n name?: string;\n description?: string;\n transform?: Transform[];\n width?: number | 'container' | Step;\n height?: number | 'container' | Step;\n };\n tooltipEncoding: ErrorEncoding;\n} {\n // TODO: use selection\n const {mark, encoding, selection, projection: _p, ...outerSpec} = spec;\n const markDef: MD = isMarkDef(mark) ? mark : ({type: mark} as MD);\n\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (selection) {\n log.warn(log.message.selectionNotSupported(compositeMark));\n }\n\n const {orient, inputType} = errorBarOrientAndInputType(spec, compositeMark);\n const {\n continuousAxisChannelDef,\n continuousAxisChannelDef2,\n continuousAxisChannelDefError,\n continuousAxisChannelDefError2,\n continuousAxis\n } = compositeMarkContinuousAxis(spec, orient, compositeMark);\n\n const {\n errorBarSpecificAggregate,\n postAggregateCalculates,\n tooltipSummary,\n tooltipTitleWithFieldName\n } = errorBarAggregationAndCalculation(\n markDef,\n continuousAxisChannelDef,\n continuousAxisChannelDef2,\n continuousAxisChannelDefError,\n continuousAxisChannelDefError2,\n inputType,\n compositeMark,\n config\n );\n\n const {\n [continuousAxis]: oldContinuousAxisChannelDef,\n [continuousAxis === 'x' ? 'x2' : 'y2']: oldContinuousAxisChannelDef2,\n [continuousAxis === 'x' ? 'xError' : 'yError']: oldContinuousAxisChannelDefError,\n [continuousAxis === 'x' ? 'xError2' : 'yError2']: oldContinuousAxisChannelDefError2,\n ...oldEncodingWithoutContinuousAxis\n } = encoding;\n\n const {\n bins,\n timeUnits,\n aggregate: oldAggregate,\n groupby: oldGroupBy,\n encoding: encodingWithoutContinuousAxis\n } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config);\n\n const aggregate: AggregatedFieldDef[] = [...oldAggregate, ...errorBarSpecificAggregate];\n const groupby: string[] = inputType !== 'raw' ? [] : oldGroupBy;\n\n const tooltipEncoding: ErrorEncoding = getCompositeMarkTooltip(\n tooltipSummary,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n tooltipTitleWithFieldName\n );\n\n return {\n transform: [\n ...(outerSpec.transform ?? []),\n ...bins,\n ...timeUnits,\n ...(aggregate.length === 0 ? [] : [{aggregate, groupby}]),\n ...postAggregateCalculates\n ],\n groupby,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical',\n markDef,\n outerSpec,\n tooltipEncoding\n };\n}\n\nfunction errorBarAggregationAndCalculation<\n M extends ErrorBar | ErrorBand,\n MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef)\n>(\n markDef: MD,\n continuousAxisChannelDef: PositionFieldDef,\n continuousAxisChannelDef2: SecondaryFieldDef,\n continuousAxisChannelDefError: SecondaryFieldDef,\n continuousAxisChannelDefError2: SecondaryFieldDef,\n inputType: ErrorInputType,\n compositeMark: M,\n config: Config\n): {\n postAggregateCalculates: CalculateTransform[];\n errorBarSpecificAggregate: AggregatedFieldDef[];\n tooltipSummary: CompositeMarkTooltipSummary[];\n tooltipTitleWithFieldName: boolean;\n} {\n let errorBarSpecificAggregate: AggregatedFieldDef[] = [];\n let postAggregateCalculates: CalculateTransform[] = [];\n const continuousFieldName: string = continuousAxisChannelDef.field;\n\n let tooltipSummary: CompositeMarkTooltipSummary[];\n let tooltipTitleWithFieldName = false;\n\n if (inputType === 'raw') {\n const center: ErrorBarCenter = markDef.center\n ? markDef.center\n : markDef.extent\n ? markDef.extent === 'iqr'\n ? 'median'\n : 'mean'\n : config.errorbar.center;\n const extent: ErrorBarExtent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr';\n\n if ((center === 'median') !== (extent === 'iqr')) {\n log.warn(log.message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark));\n }\n\n if (extent === 'stderr' || extent === 'stdev') {\n errorBarSpecificAggregate = [\n {op: extent, field: continuousFieldName, as: 'extent_' + continuousFieldName},\n {op: center, field: continuousFieldName, as: 'center_' + continuousFieldName}\n ];\n\n postAggregateCalculates = [\n {\n calculate: `datum[\"center_${continuousFieldName}\"] + datum[\"extent_${continuousFieldName}\"]`,\n as: 'upper_' + continuousFieldName\n },\n {\n calculate: `datum[\"center_${continuousFieldName}\"] - datum[\"extent_${continuousFieldName}\"]`,\n as: 'lower_' + continuousFieldName\n }\n ];\n\n tooltipSummary = [\n {fieldPrefix: 'center_', titlePrefix: titleCase(center)},\n {fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+')},\n {fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-')}\n ];\n tooltipTitleWithFieldName = true;\n } else {\n let centerOp: AggregateOp;\n let lowerExtentOp: AggregateOp;\n let upperExtentOp: AggregateOp;\n if (extent === 'ci') {\n centerOp = 'mean';\n lowerExtentOp = 'ci0';\n upperExtentOp = 'ci1';\n } else {\n centerOp = 'median';\n lowerExtentOp = 'q1';\n upperExtentOp = 'q3';\n }\n\n errorBarSpecificAggregate = [\n {op: lowerExtentOp, field: continuousFieldName, as: 'lower_' + continuousFieldName},\n {op: upperExtentOp, field: continuousFieldName, as: 'upper_' + continuousFieldName},\n {op: centerOp, field: continuousFieldName, as: 'center_' + continuousFieldName}\n ];\n\n tooltipSummary = [\n {\n fieldPrefix: 'upper_',\n titlePrefix: title({field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'lower_',\n titlePrefix: title({field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'center_',\n titlePrefix: title({field: continuousFieldName, aggregate: centerOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n }\n ];\n }\n } else {\n if (markDef.center || markDef.extent) {\n log.warn(log.message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent));\n }\n\n if (inputType === 'aggregated-upper-lower') {\n tooltipSummary = [];\n postAggregateCalculates = [\n {calculate: `datum[\"${continuousAxisChannelDef2.field}\"]`, as: 'upper_' + continuousFieldName},\n {calculate: `datum[\"${continuousFieldName}\"]`, as: 'lower_' + continuousFieldName}\n ];\n } else if (inputType === 'aggregated-error') {\n tooltipSummary = [{fieldPrefix: '', titlePrefix: continuousFieldName}];\n postAggregateCalculates = [\n {\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: 'upper_' + continuousFieldName\n }\n ];\n\n if (continuousAxisChannelDefError2) {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError2.field}\"]`,\n as: 'lower_' + continuousFieldName\n });\n } else {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] - datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: 'lower_' + continuousFieldName\n });\n }\n }\n\n for (const postAggregateCalculate of postAggregateCalculates) {\n tooltipSummary.push({\n fieldPrefix: postAggregateCalculate.as.substring(0, 6),\n titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum[\"', ''), '\"]', '')\n });\n }\n }\n return {postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName};\n}\n\nfunction getTitlePrefix(center: ErrorBarCenter, extent: ErrorBarExtent, operation: '+' | '-'): string {\n return titleCase(center) + ' ' + operation + ' ' + extent;\n}\n","import {Interpolate, Orientation} from 'vega';\nimport {Field} from '../channeldef';\nimport {Encoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {CompositeMarkNormalizer} from './base';\nimport {GenericCompositeMarkDef, makeCompositeAggregatePartFactory, PartsMixins} from './common';\nimport {ErrorBarCenter, ErrorBarExtent, errorBarParams, ErrorEncoding} from './errorbar';\n\nexport type ErrorBandUnitSpec<\n EE = undefined // extra encoding parameter (for faceted composite unit spec)\n> = GenericUnitSpec & EE, ErrorBand | ErrorBandDef>;\n\nexport const ERRORBAND = 'errorband' as const;\nexport type ErrorBand = typeof ERRORBAND;\n\nexport const ERRORBAND_PARTS = ['band', 'borders'] as const;\n\ntype ErrorBandPart = typeof ERRORBAND_PARTS[number];\n\nexport type ErrorBandPartsMixins = PartsMixins;\n\nexport interface ErrorBandConfig extends ErrorBandPartsMixins {\n /**\n * The center of the error band. Available options include:\n * - `\"mean\"`: the mean of the data points.\n * - `\"median\"`: the median of the data points.\n *\n * __Default value:__ `\"mean\"`.\n * @hidden\n */\n\n // center is not needed right now but will be added back to the schema if future features require it.\n center?: ErrorBarCenter;\n\n /**\n * The extent of the band. Available options include:\n * - `\"ci\"`: Extend the band to the confidence interval of the mean.\n * - `\"stderr\"`: The size of band are set to the value of standard error, extending from the mean.\n * - `\"stdev\"`: The size of band are set to the value of standard deviation, extending from the mean.\n * - `\"iqr\"`: Extend the band to the q1 and q3.\n *\n * __Default value:__ `\"stderr\"`.\n */\n extent?: ErrorBarExtent;\n\n /**\n * The line interpolation method for the error band. One of the following:\n * - `\"linear\"`: piecewise linear segments, as in a polyline.\n * - `\"linear-closed\"`: close the linear segments to form a polygon.\n * - `\"step\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes at the midpoint of each pair of adjacent x-values.\n * - `\"step-before\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes before the x-value.\n * - `\"step-after\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes after the x-value.\n * - `\"basis\"`: a B-spline, with control point duplication on the ends.\n * - `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n * - `\"basis-closed\"`: a closed B-spline, as in a loop.\n * - `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n * - `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n * - `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n * - `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n * - `\"monotone\"`: cubic interpolation that preserves monotonicity in y.\n */\n interpolate?: Interpolate;\n\n /**\n * The tension parameter for the interpolation type of the error band.\n *\n * @minimum 0\n * @maximum 1\n */\n tension?: number;\n}\n\nexport type ErrorBandDef = GenericCompositeMarkDef &\n ErrorBandConfig & {\n /**\n * Orientation of the error band. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined.\n */\n orient?: Orientation;\n };\n\nexport interface ErrorBandConfigMixins {\n /**\n * ErrorBand Config\n */\n errorband?: ErrorBandConfig;\n}\n\nexport const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand);\n\nexport function normalizeErrorBand(\n spec: GenericUnitSpec, ErrorBand | ErrorBandDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n markDef,\n outerSpec,\n tooltipEncoding\n } = errorBarParams(spec, ERRORBAND, config);\n const errorBandDef: ErrorBandDef = markDef;\n\n const makeErrorBandPart = makeCompositeAggregatePartFactory(\n errorBandDef,\n continuousAxis,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n config.errorband\n );\n\n const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined;\n\n let bandMark: MarkDef = {type: is2D ? 'area' : 'rect'};\n let bordersMark: MarkDef = {type: is2D ? 'line' : 'rule'};\n const interpolate = {\n ...(errorBandDef.interpolate ? {interpolate: errorBandDef.interpolate} : {}),\n ...(errorBandDef.tension && errorBandDef.interpolate ? {tension: errorBandDef.tension} : {})\n };\n\n if (is2D) {\n bandMark = {\n ...bandMark,\n ...interpolate,\n ariaRoleDescription: 'errorband'\n };\n bordersMark = {\n ...bordersMark,\n ...interpolate,\n aria: false\n };\n } else if (errorBandDef.interpolate) {\n log.warn(log.message.errorBand1DNotSupport('interpolate'));\n } else if (errorBandDef.tension) {\n log.warn(log.message.errorBand1DNotSupport('tension'));\n }\n\n return {\n ...outerSpec,\n transform,\n layer: [\n ...makeErrorBandPart({\n partName: 'band',\n mark: bandMark,\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'lower',\n\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ]\n };\n}\n","import {Field} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {EncodingFacetMapping} from '../spec/facet';\nimport {NormalizedUnitSpec} from '../spec/unit';\nimport {keys} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {BOXPLOT, BoxPlot, BoxPlotConfigMixins, BoxPlotDef, BOXPLOT_PARTS, normalizeBoxPlot} from './boxplot';\nimport {\n ERRORBAND,\n ErrorBand,\n ErrorBandConfigMixins,\n ErrorBandDef,\n ERRORBAND_PARTS,\n normalizeErrorBand\n} from './errorband';\nimport {\n ERRORBAR,\n ErrorBar,\n ErrorBarConfigMixins,\n ErrorBarDef,\n ERRORBAR_PARTS,\n ErrorExtraEncoding,\n normalizeErrorBar\n} from './errorbar';\n\nexport {BoxPlotConfig} from './boxplot';\nexport {ErrorBandConfigMixins} from './errorband';\nexport {ErrorBarConfigMixins} from './errorbar';\n\nexport type CompositeMarkNormalizerRun = (\n spec: GenericUnitSpec,\n params: NormalizerParams\n) => NormalizedLayerSpec | NormalizedUnitSpec;\n\n/**\n * Registry index for all composite mark's normalizer\n */\nconst compositeMarkRegistry: {\n [mark: string]: {\n normalizer: CompositeMarkNormalizer;\n parts: readonly string[];\n };\n} = {};\n\nexport function add(mark: string, run: CompositeMarkNormalizerRun, parts: readonly string[]) {\n const normalizer = new CompositeMarkNormalizer(mark, run);\n compositeMarkRegistry[mark] = {normalizer, parts};\n}\n\nexport function remove(mark: string) {\n delete compositeMarkRegistry[mark];\n}\n\nexport type CompositeEncoding = Encoding & ErrorExtraEncoding;\n\nexport type PartialIndex> = {\n [t in keyof T]?: Partial;\n};\n\nexport type SharedCompositeEncoding = PartialIndex<\n Omit, 'detail' | 'order' | 'tooltip'> // need to omit and cherry pick detail / order / tooltip since they allow array\n> &\n Pick, 'detail' | 'order' | 'tooltip'>;\n\nexport type FacetedCompositeEncoding = Encoding &\n ErrorExtraEncoding &\n EncodingFacetMapping;\n\nexport type CompositeMark = BoxPlot | ErrorBar | ErrorBand;\n\nexport function getAllCompositeMarks() {\n return keys(compositeMarkRegistry);\n}\n\nexport type CompositeMarkDef = BoxPlotDef | ErrorBarDef | ErrorBandDef;\n\nexport type CompositeAggregate = BoxPlot | ErrorBar | ErrorBand;\n\nexport interface CompositeMarkConfigMixins extends BoxPlotConfigMixins, ErrorBarConfigMixins, ErrorBandConfigMixins {}\n\nadd(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS);\nadd(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS);\nadd(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS);\n","import {SignalRef, Text} from 'vega';\nimport {ConditionValueDefMixins, ValueDef} from './channeldef';\nimport {LegendConfig} from './legend';\nimport {Dict} from './util';\nimport {VgEncodeChannel} from './vega.schema';\n\nexport interface TitleMixins {\n /**\n * A title for the field. If `null`, the title will be removed.\n *\n * __Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n *\n * __Notes__:\n *\n * 1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title).\n *\n * 2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used.\n */\n title?: Text | null | SignalRef;\n}\n\nexport interface FormatMixins {\n /**\n * When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n *\n * - If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n * - If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n *\n * See the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n *\n * When used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n *\n * __Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format.\n */\n format?: string | Dict;\n\n /**\n * The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n *\n * __Default value:__\n * - `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n * - `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.\n */\n formatType?: 'number' | 'time' | string;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.\n */\n labelExpr?: string;\n}\n\nexport interface Guide extends TitleMixins, FormatMixins {}\n\nexport interface VlOnlyGuideConfig {\n /**\n * Set to null to disable title for the axis, legend, or header.\n */\n title?: null;\n}\n\nexport type GuideEncodingConditionalValueDef = ValueDef & ConditionValueDefMixins;\n\nexport type GuideEncodingEntry = Partial>;\n\nexport const VL_ONLY_LEGEND_CONFIG: (keyof LegendConfig)[] = [\n 'gradientHorizontalMaxLength',\n 'gradientHorizontalMinLength',\n 'gradientVerticalMaxLength',\n 'gradientVerticalMinLength',\n 'unselectedOpacity'\n];\n","import {\n BaseLegend,\n LabelOverlap,\n Legend as VgLegend,\n LegendConfig as VgLegendConfig,\n LegendEncode,\n LegendOrient,\n Orientation,\n SignalRef\n} from 'vega';\nimport {DateTime} from './datetime';\nimport {Guide, GuideEncodingEntry, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\nimport {ExcludeMappedValueRefButKeepSignal, VgEncodeChannel} from './vega.schema';\n\nexport const LEGEND_SCALE_CHANNELS = [\n 'size',\n 'shape',\n 'fill',\n 'stroke',\n 'strokeDash',\n 'strokeWidth',\n 'opacity'\n] as const;\n\nexport type SignalLegendProp =\n | 'fillColor'\n | 'gradientStrokeColor'\n | 'labelColor'\n | 'strokeColor'\n | 'symbolFillColor'\n | 'symbolStrokeColor'\n | 'titleColor';\n\nexport const SIGNAL_LEGEND_PROP_INDEX: Record<\n SignalLegendProp,\n {\n part: keyof LegendEncode;\n vgProp: VgEncodeChannel;\n } | null // null if we need to convert condition to signal\n> = {\n fillColor: {\n part: 'legend',\n vgProp: 'fill'\n },\n gradientStrokeColor: {\n part: 'gradient',\n vgProp: 'stroke'\n },\n labelColor: {\n part: 'labels',\n vgProp: 'fill'\n },\n strokeColor: {\n part: 'legend',\n vgProp: 'stroke'\n },\n symbolFillColor: {\n part: 'symbols',\n vgProp: 'fill'\n },\n symbolStrokeColor: {\n part: 'symbols',\n vgProp: 'stroke'\n },\n titleColor: {\n part: 'title',\n vgProp: 'fill'\n }\n};\n\ntype BaseLegendNoValueRefs = ExcludeMappedValueRefButKeepSignal;\n\nexport interface LegendPropsWithSignal {\n fillColor?: BaseLegendNoValueRefs['fillColor'] | SignalRef;\n gradientStrokeColor?: BaseLegendNoValueRefs['gradientStrokeColor'] | SignalRef;\n labelColor?: BaseLegendNoValueRefs['labelColor'] | SignalRef;\n strokeColor?: BaseLegendNoValueRefs['strokeColor'] | SignalRef;\n symbolFillColor?: BaseLegendNoValueRefs['symbolFillColor'] | SignalRef;\n symbolStrokeColor?: BaseLegendNoValueRefs['symbolStrokeColor'] | SignalRef;\n titleColor?: BaseLegendNoValueRefs['titleColor'] | SignalRef;\n}\n\nexport type LegendConfig = LegendMixins &\n VlOnlyGuideConfig &\n Omit &\n LegendPropsWithSignal & {\n /**\n * Max legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `200`\n */\n gradientVerticalMaxLength?: number;\n\n /**\n * Min legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `100`\n */\n gradientVerticalMinLength?: number;\n\n /**\n * Max legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `200`\n */\n gradientHorizontalMaxLength?: number;\n\n /**\n * Min legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `100`\n */\n gradientHorizontalMinLength?: number;\n\n /**\n * The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient.\n *\n * __Default value:__ `undefined`. If `undefined`, the default gradient will be determined based on the following rules:\n * - For vertical gradients, `clamp(plot_height, gradientVerticalMinLength, gradientVerticalMaxLength)`\n * - For top-`orient`ed or bottom-`orient`ed horizontal gradients, `clamp(plot_width, gradientHorizontalMinLength, gradientHorizontalMaxLength)`\n * - For other horizontal gradients, `gradientHorizontalMinLength`\n *\n * where `clamp(value, min, max)` restricts _value_ to be between the specified _min_ and _max_.\n * @minimum 0\n */\n gradientLength?: number;\n\n /**\n * The opacity of unselected legend entries.\n *\n * __Default value:__ 0.35.\n */\n unselectedOpacity?: number;\n\n /**\n * Disable legend by default\n */\n disable?: boolean;\n };\n\n/**\n * Properties of a legend or boolean flag for determining whether to show it.\n */\nexport interface Legend\n extends Omit,\n LegendPropsWithSignal,\n LegendMixins,\n Guide {\n /**\n * Mark definitions for custom legend encoding.\n *\n * @hidden\n */\n encoding?: LegendEncoding;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the legend's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * The minimum desired step between legend ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.\n *\n * __Default value__: `undefined`\n */\n tickMinStep?: number | SignalRef;\n\n /**\n * Explicitly set the visible legend values.\n */\n values?: number[] | string[] | boolean[] | DateTime[] | SignalRef; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega.\n\n /**\n * The type of the legend. Use `\"symbol\"` to create a discrete legend and `\"gradient\"` for a continuous color gradient.\n *\n * __Default value:__ `\"gradient\"` for non-binned quantitative fields and temporal fields; `\"symbol\"` otherwise.\n */\n type?: 'symbol' | 'gradient';\n\n /**\n * A non-negative integer indicating the z-index of the legend.\n * If zindex is 0, legend should be drawn behind all chart elements.\n * To put them in front, use zindex = 1.\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n}\n\n// Change comments to be Vega-Lite specific\ninterface LegendMixins {\n /**\n * The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used. If set to `\"greedy\"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes).\n *\n * __Default value:__ `\"greedy\"` for `log scales otherwise `true`.\n */\n labelOverlap?: LabelOverlap | SignalRef; // override comment since our default differs from Vega\n\n /**\n * The direction of the legend, one of `\"vertical\"` or `\"horizontal\"`.\n *\n * __Default value:__\n * - For top-/bottom-`orient`ed legends, `\"horizontal\"`\n * - For left-/right-`orient`ed legends, `\"vertical\"`\n * - For top/bottom-left/right-`orient`ed legends, `\"horizontal\"` for gradient legends and `\"vertical\"` for symbol legends.\n */\n direction?: Orientation; // Omit SignalRef\n\n /**\n * The orientation of the legend, which determines how the legend is positioned within the scene. One of `\"left\"`, `\"right\"`, `\"top\"`, `\"bottom\"`, `\"top-left\"`, `\"top-right\"`, `\"bottom-left\"`, `\"bottom-right\"`, `\"none\"`.\n *\n * __Default value:__ `\"right\"`\n */\n orient?: LegendOrient; // Omit SignalRef\n}\n\nexport interface LegendEncoding {\n /**\n * Custom encoding for the legend container.\n * This can be useful for creating legend with custom x, y position.\n */\n legend?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the legend title text mark.\n */\n title?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend label text marks.\n */\n labels?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend symbol marks.\n */\n symbols?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend gradient filled rect marks.\n */\n gradient?: GuideEncodingEntry;\n}\n\nexport const defaultLegendConfig: LegendConfig = {\n gradientHorizontalMaxLength: 200,\n gradientHorizontalMinLength: 100,\n gradientVerticalMaxLength: 200,\n gradientVerticalMinLength: 64, // This is Vega's minimum.\n unselectedOpacity: 0.35\n};\n\nexport const COMMON_LEGEND_PROPERTY_INDEX: Flag = {\n aria: 1,\n clipHeight: 1,\n columnPadding: 1,\n columns: 1,\n cornerRadius: 1,\n description: 1,\n direction: 1,\n fillColor: 1,\n format: 1,\n formatType: 1,\n gradientLength: 1,\n gradientOpacity: 1,\n gradientStrokeColor: 1,\n gradientStrokeWidth: 1,\n gradientThickness: 1,\n gridAlign: 1,\n labelAlign: 1,\n labelBaseline: 1,\n labelColor: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labelSeparation: 1,\n legendX: 1,\n legendY: 1,\n offset: 1,\n orient: 1,\n padding: 1,\n rowPadding: 1,\n strokeColor: 1,\n symbolDash: 1,\n symbolDashOffset: 1,\n symbolFillColor: 1,\n symbolLimit: 1,\n symbolOffset: 1,\n symbolOpacity: 1,\n symbolSize: 1,\n symbolStrokeColor: 1,\n symbolStrokeWidth: 1,\n symbolType: 1,\n tickCount: 1,\n tickMinStep: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titleOrient: 1,\n titlePadding: 1,\n type: 1,\n values: 1,\n zindex: 1\n};\n\nexport const LEGEND_PROPERTIES = keys(COMMON_LEGEND_PROPERTY_INDEX);\n","import {Binding, Color, Cursor, Stream, Vector2} from 'vega';\nimport {isObject} from 'vega-util';\nimport {SingleDefUnitChannel} from './channel';\nimport {FieldName, PrimitiveValue} from './channeldef';\nimport {DateTime} from './datetime';\nimport {Dict} from './util';\n\nexport const SELECTION_ID = '_vgsid_';\nexport type SelectionType = 'single' | 'multi' | 'interval';\nexport type SelectionResolution = 'global' | 'union' | 'intersect';\n\nexport type SelectionInit = PrimitiveValue | DateTime;\nexport type SelectionInitInterval = Vector2 | Vector2 | Vector2 | Vector2;\n\nexport type SelectionInitMapping = Dict;\nexport type SelectionInitIntervalMapping = Dict;\n\nexport type LegendStreamBinding = {legend: string | Stream};\nexport type LegendBinding = 'legend' | LegendStreamBinding;\n\nexport interface BaseSelectionConfig {\n /**\n * Clears the selection, emptying it of all values. Can be a\n * [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n *\n * __Default value:__ `dblclick`.\n *\n * __See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation.\n */\n clear?: Stream | string | boolean;\n\n /**\n * A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\n * For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters).\n */\n on?: Stream | string;\n /**\n * With layered and multi-view displays, a strategy that determines how\n * selections' data queries are resolved when applied in a filter transform,\n * conditional encoding rule, or scale domain.\n *\n * __See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation.\n */\n resolve?: SelectionResolution;\n\n // TODO(https://github.com/vega/vega-lite/issues/2596).\n // predicate?: string;\n // domain?: SelectionDomain;\n\n /**\n * An array of encoding channels. The corresponding data field values\n * must match for a data tuple to fall within the selection.\n *\n * __See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.\n */\n encodings?: SingleDefUnitChannel[];\n\n /**\n * An array of field names whose values must match for a data tuple to\n * fall within the selection.\n *\n * __See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.\n */\n fields?: FieldName[];\n\n /**\n * By default, `all` data values are considered to lie within an empty selection.\n * When set to `none`, empty selections contain no data values.\n */\n empty?: 'all' | 'none';\n}\n\nexport interface SingleSelectionConfig extends BaseSelectionConfig {\n /**\n * When set, a selection is populated by input elements (also known as dynamic query widgets)\n * or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\n * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n *\n * Legend bindings are restricted to selections that only specify a single field or encoding.\n *\n * Query widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind)\n * or can be a mapping between projected field/encodings and binding definitions.\n *\n * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation.\n */\n bind?: Binding | Record | LegendBinding;\n\n /**\n * When true, an invisible voronoi diagram is computed to accelerate discrete\n * selection. The data value _nearest_ the mouse cursor is added to the selection.\n *\n * __See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.\n */\n nearest?: boolean;\n\n /**\n * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and initial values.\n *\n * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation.\n */\n init?: SelectionInitMapping;\n}\n\nexport interface MultiSelectionConfig extends BaseSelectionConfig {\n /**\n * Controls whether data values should be toggled or only ever inserted into\n * multi selections. Can be `true`, `false` (for insertion only), or a\n * [Vega expression](https://vega.github.io/vega/docs/expressions/).\n *\n * __Default value:__ `true`, which corresponds to `event.shiftKey` (i.e.,\n * data values are toggled when a user interacts with the shift-key pressed).\n *\n * Setting the value to the Vega expression `\"true\"` will toggle data values\n * without the user pressing the shift-key.\n *\n * __See also:__ [`toggle`](https://vega.github.io/vega-lite/docs/toggle.html) documentation.\n */\n toggle?: string | boolean;\n\n /**\n * When true, an invisible voronoi diagram is computed to accelerate discrete\n * selection. The data value _nearest_ the mouse cursor is added to the selection.\n *\n * __See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.\n */\n nearest?: boolean;\n\n /**\n * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and an initial\n * value (or array of values).\n *\n * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation.\n */\n init?: SelectionInitMapping[];\n\n /**\n * When set, a selection is populated by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\n * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n *\n * Legend bindings are restricted to selections that only specify a single field or encoding.\n */\n bind?: LegendBinding;\n}\n\n// Similar to BaseMarkConfig but the field documentations are specificly for an interval mark.\nexport interface BrushConfig {\n /**\n * The fill color of the interval mark.\n *\n * __Default value:__ `\"#333333\"`\n *\n */\n fill?: Color;\n /**\n * The fill opacity of the interval mark (a value between `0` and `1`).\n *\n * __Default value:__ `0.125`\n */\n fillOpacity?: number;\n /**\n * The stroke color of the interval mark.\n *\n * __Default value:__ `\"#ffffff\"`\n */\n stroke?: Color;\n /**\n * The stroke opacity of the interval mark (a value between `0` and `1`).\n */\n strokeOpacity?: number;\n /**\n * The stroke width of the interval mark.\n */\n strokeWidth?: number;\n /**\n * An array of alternating stroke and space lengths, for creating dashed or dotted lines.\n */\n strokeDash?: number[];\n /**\n * The offset (in pixels) with which to begin drawing the stroke dash array.\n */\n strokeDashOffset?: number;\n /**\n * The mouse cursor used over the interval mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used.\n */\n cursor?: Cursor;\n}\n\nexport interface IntervalSelectionConfig extends BaseSelectionConfig {\n /**\n * When truthy, allows a user to interactively move an interval selection\n * back-and-forth. Can be `true`, `false` (to disable panning), or a\n * [Vega event stream definition](https://vega.github.io/vega/docs/event-streams/)\n * which must include a start and end event to trigger continuous panning.\n *\n * __Default value:__ `true`, which corresponds to\n * `[mousedown, window:mouseup] > window:mousemove!` which corresponds to\n * clicks and dragging within an interval selection to reposition it.\n *\n * __See also:__ [`translate`](https://vega.github.io/vega-lite/docs/translate.html) documentation.\n */\n translate?: string | boolean;\n\n /**\n * When truthy, allows a user to interactively resize an interval selection.\n * Can be `true`, `false` (to disable zooming), or a [Vega event stream\n * definition](https://vega.github.io/vega/docs/event-streams/). Currently,\n * only `wheel` events are supported.\n *\n * __Default value:__ `true`, which corresponds to `wheel!`.\n *\n * __See also:__ [`zoom`](https://vega.github.io/vega-lite/docs/zoom.html) documentation.\n */\n zoom?: string | boolean;\n\n /**\n * Establishes a two-way binding between the interval selection and the scales\n * used within the same view. This allows a user to interactively pan and\n * zoom the view.\n *\n * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation.\n */\n bind?: 'scales';\n\n /**\n * An interval selection also adds a rectangle mark to depict the\n * extents of the interval. The `mark` property can be used to customize the\n * appearance of the mark.\n *\n * __See also:__ [`mark`](https://vega.github.io/vega-lite/docs/selection-mark.html) documentation.\n */\n mark?: BrushConfig;\n\n /**\n * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and arrays of\n * initial values.\n *\n * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation.\n */\n init?: SelectionInitIntervalMapping;\n}\n\nexport interface BaseSelectionDef {\n /**\n * Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types:\n *\n * - `\"single\"` -- to select a single discrete data value on `click`.\n * - `\"multi\"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`.\n * - `\"interval\"` -- to select a continuous range of data values on `drag`.\n */\n type: T;\n}\n\nexport interface SingleSelection extends BaseSelectionDef<'single'>, SingleSelectionConfig {}\n\nexport interface MultiSelection extends BaseSelectionDef<'multi'>, MultiSelectionConfig {}\n\nexport interface IntervalSelection extends BaseSelectionDef<'interval'>, IntervalSelectionConfig {}\n\nexport type SelectionDef = SingleSelection | MultiSelection | IntervalSelection;\n\nexport type SelectionExtent =\n | {\n /**\n * The name of a selection.\n */\n selection: string;\n /**\n * The field name to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html)\n * over multiple fields or encodings.\n */\n field?: FieldName;\n }\n | {\n /**\n * The name of a selection.\n */\n selection: string;\n /**\n * The encoding channel to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html)\n * over multiple fields or encodings.\n */\n encoding?: SingleDefUnitChannel;\n };\n\nexport interface SelectionConfig {\n /**\n * The default definition for a [`single`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations\n * for a single selection definition (except `type`) may be specified here.\n *\n * For instance, setting `single` to `{\"on\": \"dblclick\"}` populates single selections on double-click by default.\n */\n single?: SingleSelectionConfig;\n /**\n * The default definition for a [`multi`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations\n * for a multi selection definition (except `type`) may be specified here.\n *\n * For instance, setting `multi` to `{\"toggle\": \"event.altKey\"}` adds additional values to\n * multi selections when clicking with the alt-key pressed by default.\n */\n multi?: MultiSelectionConfig;\n /**\n * The default definition for an [`interval`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations\n * for an interval selection definition (except `type`) may be specified here.\n *\n * For instance, setting `interval` to `{\"translate\": false}` disables the ability to move\n * interval selections by default.\n */\n interval?: IntervalSelectionConfig;\n}\n\nexport const defaultConfig: SelectionConfig = {\n single: {\n on: 'click',\n fields: [SELECTION_ID],\n resolve: 'global',\n empty: 'all',\n clear: 'dblclick'\n },\n multi: {\n on: 'click',\n fields: [SELECTION_ID],\n toggle: 'event.shiftKey',\n resolve: 'global',\n empty: 'all',\n clear: 'dblclick'\n },\n interval: {\n on: '[mousedown, window:mouseup] > window:mousemove!',\n encodings: ['x', 'y'],\n translate: '[mousedown, window:mouseup] > window:mousemove!',\n zoom: 'wheel!',\n mark: {fill: '#333', fillOpacity: 0.125, stroke: 'white'},\n resolve: 'global',\n clear: 'dblclick'\n }\n};\n\nexport function isLegendBinding(bind: any): bind is LegendBinding {\n return !!bind && (bind === 'legend' || !!bind.legend);\n}\n\nexport function isLegendStreamBinding(bind: any): bind is LegendStreamBinding {\n return isLegendBinding(bind) && isObject(bind);\n}\n","import {GenericSpec, NormalizedSpec} from '.';\nimport {BaseSpec, BoundsMixins, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\n\n/**\n * Base layout mixins for V/HConcatSpec, which should not have RowCol generic fo its property.\n */\nexport interface OneDirectionalConcatLayout extends BoundsMixins, ResolveMixins {\n /**\n * Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean;\n\n /**\n * The spacing in pixels between sub-views of the concat operator.\n *\n * __Default value__: `10`\n */\n spacing?: number;\n}\n\n/**\n * Base interface for a generalized concatenation specification.\n */\nexport interface GenericConcatSpec>\n extends BaseSpec,\n GenericCompositionLayoutWithColumns,\n ResolveMixins {\n /**\n * A list of views to be concatenated.\n */\n concat: S[];\n}\n\n/**\n * Base interface for a vertical concatenation specification.\n */\nexport interface GenericVConcatSpec>\n extends BaseSpec,\n OneDirectionalConcatLayout {\n /**\n * A list of views to be concatenated and put into a column.\n */\n vconcat: S[];\n}\n\n/**\n * Base interface for a horizontal concatenation specification.\n */\nexport interface GenericHConcatSpec>\n extends BaseSpec,\n OneDirectionalConcatLayout {\n /**\n * A list of views to be concatenated and put into a row.\n */\n hconcat: S[];\n}\n\n/** A concat spec without any shortcut/expansion syntax */\nexport type NormalizedConcatSpec =\n | GenericConcatSpec\n | GenericVConcatSpec\n | GenericHConcatSpec;\n\nexport function isAnyConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec | GenericHConcatSpec {\n return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec);\n}\n\nexport function isConcatSpec(spec: BaseSpec): spec is GenericConcatSpec {\n return 'concat' in spec;\n}\n\nexport function isVConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec {\n return 'vconcat' in spec;\n}\n\nexport function isHConcatSpec(spec: BaseSpec): spec is GenericHConcatSpec {\n return 'hconcat' in spec;\n}\n","import {Color, Cursor, SignalRef, Text} from 'vega';\nimport {isNumber, isObject} from 'vega-util';\nimport {NormalizedSpec} from '.';\nimport {Data} from '../data';\nimport {MarkConfig} from '../mark';\nimport {Resolve} from '../resolve';\nimport {TitleParams} from '../title';\nimport {Transform} from '../transform';\nimport {Flag, keys} from '../util';\nimport {LayoutAlign, RowCol} from '../vega.schema';\nimport {isConcatSpec, isVConcatSpec} from './concat';\nimport {isFacetMapping, isFacetSpec} from './facet';\n\nexport {TopLevel} from './toplevel';\n\n/**\n * Common properties for all types of specification\n */\nexport interface BaseSpec {\n /**\n * Title for the plot.\n */\n title?: Text | TitleParams;\n\n /**\n * Name of the visualization for later reference.\n */\n name?: string;\n\n /**\n * Description of this mark for commenting purpose.\n */\n description?: string;\n\n /**\n * An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent.\n */\n data?: Data | null;\n\n /**\n * An array of data transformations such as filter and new field calculation.\n */\n transform?: Transform[];\n}\n\nexport interface DataMixins {\n /**\n * An object describing the data source.\n */\n data: Data;\n}\n\nexport interface Step {\n /**\n * The size (width/height) per discrete step.\n */\n step: number;\n}\n\nexport function isStep(size: number | Step | 'container' | 'merged'): size is Step {\n return isObject(size) && size['step'] !== undefined;\n}\n\n// TODO(https://github.com/vega/vega-lite/issues/2503): Make this generic so we can support some form of top-down sizing.\n/**\n * Common properties for specifying width and height of unit and layer specifications.\n */\nexport interface LayoutSizeMixins {\n /**\n * The width of a visualization.\n *\n * - For a plot with a continuous x-field, width should be a number.\n * - For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.)\n * - To enable responsive sizing on width, it should be set to `\"container\"`.\n *\n * __Default value:__\n * Based on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise.\n *\n * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `\"container\"` option cannot be used.\n *\n * __See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation.\n */\n width?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here.\n\n /**\n * The height of a visualization.\n *\n * - For a plot with a continuous y-field, height should be a number.\n * - For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.)\n * - To enable responsive sizing on height, it should be set to `\"container\"`.\n *\n * __Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise.\n *\n * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `\"container\"` option cannot be used.\n *\n * __See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation.\n */\n height?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here.\n}\n\nexport function isFrameMixins(o: any): o is FrameMixins {\n return o['view'] || o['width'] || o['height'];\n}\n\nexport interface FrameMixins extends LayoutSizeMixins {\n /**\n * An object defining the view background's fill and stroke.\n *\n * __Default value:__ none (transparent)\n */\n view?: ViewBackground;\n}\n\nexport type DeprecatedFrameMixins = {\n /**\n * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec.\n */\n width?: FrameMixins['width'];\n\n /**\n * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec.\n */\n height?: FrameMixins['height'];\n\n /**\n * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec.\n */\n view?: FrameMixins['view'];\n};\n\nexport interface ResolveMixins {\n /**\n * Scale, axis, and legend resolutions for view composition specifications.\n */\n resolve?: Resolve;\n}\n\nexport interface BaseViewBackground\n extends Partial<\n Pick<\n MarkConfig,\n | 'cornerRadius'\n | 'fillOpacity'\n | 'opacity'\n | 'strokeCap'\n | 'strokeDash'\n | 'strokeDashOffset'\n | 'strokeJoin'\n | 'strokeMiterLimit'\n | 'strokeOpacity'\n | 'strokeWidth'\n >\n > {\n // Override documentations for fill, stroke, and cursor\n /**\n * The fill color.\n *\n * __Default value:__ `undefined`\n */\n fill?: Color | null | SignalRef;\n\n /**\n * The stroke color.\n *\n * __Default value:__ `\"#ddd\"`\n */\n stroke?: Color | null | SignalRef;\n\n /**\n * The mouse cursor used over the view. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used.\n */\n cursor?: Cursor;\n}\n\nexport interface ViewBackground extends BaseViewBackground {\n /**\n * A string or array of strings indicating the name of custom styles to apply to the view background. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n *\n * __Default value:__ `\"cell\"`\n * __Note:__ Any specified view background properties will augment the default style.\n */\n style?: string | string[];\n}\n\nexport interface BoundsMixins {\n /**\n * The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n *\n * - If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n * - If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n *\n * __Default value:__ `\"full\"`\n */\n\n bounds?: 'full' | 'flush';\n}\n\n/**\n * Base layout for FacetSpec and RepeatSpec.\n * This is named \"GenericComposition\" layout as ConcatLayout is a GenericCompositionLayout too\n * (but _not_ vice versa).\n */\nexport interface GenericCompositionLayout extends BoundsMixins {\n /**\n * The alignment to apply to grid rows and columns.\n * The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n *\n * - For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n * - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n * - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n *\n * Alternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n *\n * __Default value:__ `\"all\"`.\n */\n align?: LayoutAlign | RowCol;\n\n /**\n * Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n *\n * An object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean | RowCol;\n\n /**\n * The spacing in pixels between sub-views of the composition operator.\n * An object of the form `{\"row\": number, \"column\": number}` can be used to set\n * different spacing values for rows and columns.\n *\n * __Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)\n */\n spacing?: number | RowCol;\n}\n\nexport const DEFAULT_SPACING = 20;\n\nexport interface ColumnMixins {\n /**\n * The number of columns to include in the view composition layout.\n *\n * __Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n * `hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n *\n * __Note__:\n *\n * 1) This property is only for:\n * - the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n * - the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n *\n * 2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).\n */\n columns?: number;\n}\n\nexport type GenericCompositionLayoutWithColumns = GenericCompositionLayout & ColumnMixins;\n\nexport type CompositionConfig = ColumnMixins & {\n /**\n * The default spacing in pixels between composed sub-views.\n *\n * __Default value__: `20`\n */\n spacing?: number;\n};\n\nexport interface CompositionConfigMixins {\n /** Default configuration for the `facet` view composition operator */\n facet?: CompositionConfig;\n\n /** Default configuration for all concatenation and repeat view composition operators (`concat`, `hconcat`, `vconcat`, and `repeat`) */\n concat?: CompositionConfig;\n}\n\nconst COMPOSITION_LAYOUT_INDEX: Flag = {\n align: 1,\n bounds: 1,\n center: 1,\n columns: 1,\n spacing: 1\n};\n\nconst COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX);\n\nexport type SpecType = 'unit' | 'facet' | 'layer' | 'concat';\n\nexport function extractCompositionLayout(\n spec: NormalizedSpec,\n specType: keyof CompositionConfigMixins,\n config: CompositionConfigMixins\n): GenericCompositionLayoutWithColumns {\n const compositionConfig = config[specType];\n const layout: GenericCompositionLayoutWithColumns = {};\n\n // Apply config first\n const {spacing: spacingConfig, columns} = compositionConfig;\n if (spacingConfig !== undefined) {\n layout.spacing = spacingConfig;\n }\n\n if (columns !== undefined) {\n if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) {\n layout.columns = columns;\n }\n }\n\n if (isVConcatSpec(spec)) {\n layout.columns = 1;\n }\n\n // Then copy properties from the spec\n for (const prop of COMPOSITION_LAYOUT_PROPERTIES) {\n if (spec[prop] !== undefined) {\n if (prop === 'spacing') {\n const spacing: number | RowCol = spec[prop];\n\n layout[prop] = isNumber(spacing)\n ? spacing\n : {\n row: spacing.row ?? spacingConfig,\n column: spacing.column ?? spacingConfig\n };\n } else {\n (layout[prop] as any) = spec[prop];\n }\n }\n }\n\n return layout;\n}\n","import {Color, InitSignal, NewSignal, RangeConfig, RangeScheme, SignalRef} from 'vega';\nimport {isObject, mergeConfig} from 'vega-util';\nimport {Axis, AxisConfigMixins, isConditionalAxisValue} from './axis';\nimport {CompositeMarkConfigMixins, getAllCompositeMarks} from './compositemark';\nimport {VL_ONLY_LEGEND_CONFIG} from './guide';\nimport {HeaderConfigMixins} from './header';\nimport {defaultLegendConfig, LegendConfig} from './legend';\nimport * as mark from './mark';\nimport {\n AnyMarkConfig,\n Mark,\n MarkConfig,\n MarkConfigMixins,\n PRIMITIVE_MARKS,\n VL_ONLY_MARK_CONFIG_PROPERTIES,\n VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n} from './mark';\nimport {ProjectionConfig} from './projection';\nimport {defaultScaleConfig, ScaleConfig} from './scale';\nimport {defaultConfig as defaultSelectionConfig, SelectionConfig} from './selection';\nimport {BaseViewBackground, CompositionConfigMixins, DEFAULT_SPACING, isStep} from './spec/base';\nimport {TopLevelProperties} from './spec/toplevel';\nimport {extractTitleConfig, TitleConfig} from './title';\nimport {duplicate, getFirstDefined, isEmpty} from './util';\n\nexport interface ViewConfig extends BaseViewBackground {\n /**\n * Default width\n *\n * __Deprecated:__ Since Vega-Lite 4.0. Please use continuousWidth and discreteWidth instead.\n */\n width?: number;\n\n /**\n * Default height\n *\n * __Deprecated:__ Since Vega-Lite 4.0. Please use continuousHeight and discreteHeight instead.\n */\n height?: number;\n\n /**\n * The default width when the plot has a continuous field for x or longitude, or has arc marks.\n *\n * __Default value:__ `200`\n */\n continuousWidth?: number;\n\n /**\n * The default width when the plot has non-arc marks and either a discrete x-field or no x-field.\n * The width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step.\n *\n * __Default value:__ a step size based on `config.view.step`.\n */\n discreteWidth?: number | {step: number};\n /**\n * The default height when the plot has a continuous y-field for x or latitude, or has arc marks.\n *\n * __Default value:__ `200`\n */\n continuousHeight?: number;\n\n /**\n * The default height when the plot has non arc marks and either a discrete y-field or no y-field.\n * The height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step.\n *\n * __Default value:__ a step size based on `config.view.step`.\n */\n discreteHeight?: number | {step: number};\n\n /**\n * Default step size for x-/y- discrete fields.\n */\n step?: number;\n\n /**\n * Whether the view should be clipped.\n */\n clip?: boolean;\n}\n\nexport function getViewConfigContinuousSize(viewConfig: ViewConfig, channel: 'width' | 'height') {\n return viewConfig[channel] ?? viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility\n}\n\nexport function getViewConfigDiscreteStep(viewConfig: ViewConfig, channel: 'width' | 'height') {\n const size = getViewConfigDiscreteSize(viewConfig, channel);\n return isStep(size) ? size.step : DEFAULT_STEP;\n}\n\nexport function getViewConfigDiscreteSize(viewConfig: ViewConfig, channel: 'width' | 'height') {\n const size = viewConfig[channel] ?? viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility\n return getFirstDefined(size, {step: viewConfig.step});\n}\n\nexport const DEFAULT_STEP = 20;\n\nexport const defaultViewConfig: ViewConfig = {\n continuousWidth: 200,\n continuousHeight: 200,\n step: DEFAULT_STEP\n};\n\nexport function isVgScheme(rangeScheme: string[] | RangeScheme): rangeScheme is RangeScheme {\n return rangeScheme && !!rangeScheme['scheme'];\n}\n\nexport type ColorConfig = Record;\n\nexport type FontSizeConfig = Record;\n\nexport interface VLOnlyConfig {\n /**\n * Default font for all text marks, titles, and labels.\n */\n font?: string;\n\n /**\n * Default color signals.\n *\n * @hidden\n */\n color?: boolean | ColorConfig;\n\n /**\n * Default font size signals.\n *\n * @hidden\n */\n fontSize?: boolean | FontSizeConfig;\n\n /**\n * Default axis and legend title for count fields.\n *\n * __Default value:__ `'Count of Records`.\n *\n * @type {string}\n */\n countTitle?: string;\n\n /**\n * Defines how Vega-Lite generates title for fields. There are three possible styles:\n * - `\"verbal\"` (Default) - displays function in a verbal style (e.g., \"Sum of field\", \"Year-month of date\", \"field (binned)\").\n * - `\"function\"` - displays function using parentheses and capitalized texts (e.g., \"SUM(field)\", \"YEARMONTH(date)\", \"BIN(field)\").\n * - `\"plain\"` - displays only the field name without functions (e.g., \"field\", \"date\", \"field\").\n */\n fieldTitle?: 'verbal' | 'functional' | 'plain';\n\n /**\n * D3 Number format for guide labels and text marks. For example `\"s\"` for SI units. Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format).\n */\n numberFormat?: string;\n\n /**\n * Default time format for raw time values (without time units) in text marks, legend labels and header labels.\n *\n * __Default value:__ `\"%b %d, %Y\"`\n * __Note:__ Axes automatically determine the format for each label automatically so this config does not affect axes.\n */\n timeFormat?: string;\n\n /**\n * Allow the `formatType` property for text marks and guides to accept a custom formatter function [registered as a Vega expression](https://vega.github.io/vega-lite/usage/compile.html#format-type).\n */\n customFormatTypes?: boolean;\n\n /** Default properties for [single view plots](https://vega.github.io/vega-lite/docs/spec.html#single). */\n view?: ViewConfig;\n\n /**\n * Scale configuration determines default properties for all [scales](https://vega.github.io/vega-lite/docs/scale.html). For a full list of scale configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config).\n */\n scale?: ScaleConfig;\n\n /** An object hash for defining default properties for each type of selections. */\n selection?: SelectionConfig;\n}\n\nexport type StyleConfigIndex = Partial> &\n MarkConfigMixins & {\n /**\n * Default style for axis, legend, and header titles.\n */\n 'guide-title'?: MarkConfig;\n\n /**\n * Default style for axis, legend, and header labels.\n */\n 'guide-label'?: MarkConfig;\n\n /**\n * Default style for chart titles\n */\n 'group-title'?: MarkConfig;\n\n /**\n * Default style for chart subtitles\n */\n 'group-subtitle'?: MarkConfig;\n };\n\nexport interface Config\n extends TopLevelProperties,\n VLOnlyConfig,\n MarkConfigMixins,\n CompositeMarkConfigMixins,\n AxisConfigMixins,\n HeaderConfigMixins,\n CompositionConfigMixins {\n /**\n * An object hash that defines default range arrays or schemes for using with scales.\n * For a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config).\n */\n range?: RangeConfig;\n\n /**\n * Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config).\n */\n legend?: LegendConfig;\n\n /**\n * Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config).\n */\n title?: TitleConfig;\n\n /**\n * Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config).\n */\n projection?: ProjectionConfig;\n\n /** An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config). */\n style?: StyleConfigIndex;\n\n /**\n * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid.\n */\n lineBreak?: string | SignalRef;\n\n /**\n * A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the `\"aria-hidden\"` attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks.\n *\n * __Default value:__ `true`.\n */\n aria?: boolean;\n\n /**\n * @hidden\n */\n signals?: (InitSignal | NewSignal)[];\n}\n\nexport const defaultConfig: Config = {\n background: 'white',\n\n padding: 5,\n timeFormat: '%b %d, %Y',\n countTitle: 'Count of Records',\n\n view: defaultViewConfig,\n\n mark: mark.defaultMarkConfig,\n\n arc: {},\n area: {},\n bar: mark.defaultBarConfig,\n circle: {},\n geoshape: {},\n image: {},\n line: {},\n point: {},\n rect: mark.defaultRectConfig,\n rule: {color: 'black'}, // Need this to override default color in mark config\n square: {},\n text: {color: 'black'}, // Need this to override default color in mark config\n tick: mark.defaultTickConfig,\n trail: {},\n\n boxplot: {\n size: 14,\n extent: 1.5,\n box: {},\n median: {color: 'white'},\n outliers: {},\n rule: {},\n ticks: null\n },\n\n errorbar: {\n center: 'mean',\n rule: true,\n ticks: false\n },\n\n errorband: {\n band: {\n opacity: 0.3\n },\n borders: false\n },\n\n scale: defaultScaleConfig,\n\n projection: {},\n\n legend: defaultLegendConfig,\n header: {titlePadding: 10, labelPadding: 10},\n headerColumn: {},\n headerRow: {},\n headerFacet: {},\n\n selection: defaultSelectionConfig,\n style: {},\n\n title: {},\n\n facet: {spacing: DEFAULT_SPACING},\n concat: {spacing: DEFAULT_SPACING}\n};\n\n// Tableau10 color palette, copied from `vegaScale.scheme('tableau10')`\nconst tab10 = [\n '#4c78a8',\n '#f58518',\n '#e45756',\n '#72b7b2',\n '#54a24b',\n '#eeca3b',\n '#b279a2',\n '#ff9da6',\n '#9d755d',\n '#bab0ac'\n];\n\nexport const DEFAULT_FONT_SIZE = {\n text: 11,\n guideLabel: 10,\n guideTitle: 11,\n groupTitle: 13,\n groupSubtitle: 12\n};\n\nexport const DEFAULT_COLOR = {\n blue: tab10[0],\n orange: tab10[1],\n red: tab10[2],\n teal: tab10[3],\n green: tab10[4],\n yellow: tab10[5],\n purple: tab10[6],\n pink: tab10[7],\n brown: tab10[8],\n gray0: '#000',\n gray1: '#111',\n gray2: '#222',\n gray3: '#333',\n gray4: '#444',\n gray5: '#555',\n gray6: '#666',\n gray7: '#777',\n gray8: '#888',\n gray9: '#999',\n gray10: '#aaa',\n gray11: '#bbb',\n gray12: '#ccc',\n gray13: '#ddd',\n gray14: '#eee',\n gray15: '#fff'\n};\n\nexport function colorSignalConfig(color: boolean | ColorConfig = {}): Config {\n return {\n signals: [\n {\n name: 'color',\n value: isObject(color) ? {...DEFAULT_COLOR, ...color} : DEFAULT_COLOR\n }\n ],\n mark: {color: {signal: 'color.blue'}},\n rule: {color: {signal: 'color.gray0'}},\n text: {\n color: {signal: 'color.gray0'}\n },\n style: {\n 'guide-label': {\n fill: {signal: 'color.gray0'}\n },\n 'guide-title': {\n fill: {signal: 'color.gray0'}\n },\n 'group-title': {\n fill: {signal: 'color.gray0'}\n },\n 'group-subtitle': {\n fill: {signal: 'color.gray0'}\n },\n cell: {\n stroke: {signal: 'color.gray8'}\n }\n },\n axis: {\n domainColor: {signal: 'color.gray13'},\n gridColor: {signal: 'color.gray8'},\n tickColor: {signal: 'color.gray13'}\n },\n range: {\n category: [\n {signal: 'color.blue'},\n {signal: 'color.orange'},\n {signal: 'color.red'},\n {signal: 'color.teal'},\n {signal: 'color.green'},\n {signal: 'color.yellow'},\n {signal: 'color.purple'},\n {signal: 'color.pink'},\n {signal: 'color.brown'},\n {signal: 'color.grey8'}\n ]\n }\n };\n}\n\nexport function fontSizeSignalConfig(fontSize: boolean | FontSizeConfig): Config {\n return {\n signals: [\n {\n name: 'fontSize',\n value: isObject(fontSize) ? {...DEFAULT_FONT_SIZE, ...fontSize} : DEFAULT_FONT_SIZE\n }\n ],\n text: {\n fontSize: {signal: 'fontSize.text'}\n },\n style: {\n 'guide-label': {\n fontSize: {signal: 'fontSize.guideLabel'}\n },\n 'guide-title': {\n fontSize: {signal: 'fontSize.guideTitle'}\n },\n 'group-title': {\n fontSize: {signal: 'fontSize.groupTitle'}\n },\n 'group-subtitle': {\n fontSize: {signal: 'fontSize.groupSubtitle'}\n }\n }\n };\n}\n\nexport function fontConfig(font: string): Config {\n return {\n text: {font},\n style: {\n 'guide-label': {font},\n 'guide-title': {font},\n 'group-title': {font},\n 'group-subtitle': {font}\n }\n };\n}\n\nexport function initConfig(config: Config = {}) {\n const {color, font, fontSize, ...restConfig} = config;\n\n return mergeConfig(\n {},\n defaultConfig,\n font ? fontConfig(font) : {},\n color ? colorSignalConfig(color) : {},\n fontSize ? fontSizeSignalConfig(fontSize) : {},\n restConfig || {}\n );\n}\n\nconst MARK_STYLES = ['view', ...PRIMITIVE_MARKS] as ('view' | Mark)[];\n\nconst VL_ONLY_CONFIG_PROPERTIES: (keyof Config)[] = [\n 'color',\n 'fontSize',\n 'background', // We apply background to the spec directly.\n 'padding',\n 'facet',\n 'concat',\n 'numberFormat',\n 'timeFormat',\n 'countTitle',\n 'header',\n\n 'axisQuantitative',\n 'axisTemporal',\n 'axisDiscrete',\n 'axisPoint',\n\n 'axisXBand',\n 'axisXPoint',\n 'axisXDiscrete',\n 'axisXQuantitative',\n 'axisXTemporal',\n\n 'axisYBand',\n 'axisYPoint',\n 'axisYDiscrete',\n 'axisYQuantitative',\n 'axisYTemporal',\n\n 'scale',\n 'selection',\n 'overlay' as keyof Config // FIXME: Redesign and unhide this\n];\n\nconst VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {\n view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'],\n ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n};\n\nexport function stripAndRedirectConfig(config: Config) {\n config = duplicate(config);\n\n for (const prop of VL_ONLY_CONFIG_PROPERTIES) {\n delete config[prop];\n }\n\n if (config.axis) {\n // delete condition axis config\n for (const prop in config.axis) {\n if (isConditionalAxisValue(config.axis[prop])) {\n delete config.axis[prop];\n }\n }\n }\n\n if (config.legend) {\n for (const prop of VL_ONLY_LEGEND_CONFIG) {\n delete config.legend[prop];\n }\n }\n\n // Remove Vega-Lite only generic mark config\n if (config.mark) {\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config.mark[prop];\n }\n\n if (config.mark.tooltip && isObject(config.mark.tooltip)) {\n delete config.mark.tooltip;\n }\n }\n\n for (const markType of MARK_STYLES) {\n // Remove Vega-Lite-only mark config\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config[markType][prop];\n }\n\n // Remove Vega-Lite only mark-specific config\n const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType];\n if (vlOnlyMarkSpecificConfigs) {\n for (const prop of vlOnlyMarkSpecificConfigs) {\n delete config[markType][prop];\n }\n }\n\n // Redirect mark config to config.style so that mark config only affect its own mark type\n // without affecting other marks that share the same underlying Vega marks.\n // For example, config.rect should not affect bar marks.\n redirectConfigToStyleConfig(config, markType);\n }\n\n for (const m of getAllCompositeMarks()) {\n // Clean up the composite mark config as we don't need them in the output specs anymore\n delete config[m];\n }\n\n redirectTitleConfig(config);\n\n // Remove empty config objects.\n for (const prop in config) {\n if (isObject(config[prop]) && isEmpty(config[prop])) {\n delete config[prop];\n }\n }\n\n return isEmpty(config) ? undefined : config;\n}\n\n/**\n *\n * Redirect config.title -- so that title config do not affect header labels,\n * which also uses `title` directive to implement.\n *\n * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles.\n */\nfunction redirectTitleConfig(config: Config) {\n const {titleMarkConfig, subtitleMarkConfig, subtitle} = extractTitleConfig(config.title);\n\n // set config.style if title/subtitleMarkConfig is not an empty object\n if (!isEmpty(titleMarkConfig)) {\n config.style['group-title'] = {\n ...config.style['group-title'],\n ...titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega\n };\n }\n if (!isEmpty(subtitleMarkConfig)) {\n config.style['group-subtitle'] = {\n ...config.style['group-subtitle'],\n ...subtitleMarkConfig\n };\n }\n\n // subtitle part can stay in config.title since header titles do not use subtitle\n if (!isEmpty(subtitle)) {\n config.title = subtitle;\n } else {\n delete config.title;\n }\n}\n\nfunction redirectConfigToStyleConfig(\n config: Config,\n prop: Mark | 'view' | string, // string = composite mark\n toProp?: string,\n compositeMarkPart?: string\n) {\n const propConfig: MarkConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop];\n\n if (prop === 'view') {\n toProp = 'cell'; // View's default style is \"cell\"\n }\n\n const style: MarkConfig = {\n ...propConfig,\n ...(config.style[toProp ?? prop] as MarkConfig)\n };\n\n // set config.style if it is not an empty object\n if (!isEmpty(style)) {\n config.style[toProp ?? prop] = style;\n }\n\n if (!compositeMarkPart) {\n // For composite mark, so don't delete the whole config yet as we have to do multiple redirections.\n delete config[prop];\n }\n}\n","import {SharedCompositeEncoding} from '../compositemark';\nimport {Projection} from '../projection';\nimport {BaseSpec, FrameMixins, ResolveMixins} from './base';\nimport {GenericUnitSpec, NormalizedUnitSpec, UnitSpec} from './unit';\n\n/**\n * Base interface for a layer specification.\n */\nexport interface GenericLayerSpec> extends BaseSpec, FrameMixins, ResolveMixins {\n /**\n * Layer or single view specifications to be layered.\n *\n * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.\n */\n layer: (GenericLayerSpec | U)[];\n}\n\n/**\n * A full layered plot specification, which may contains `encoding` and `projection` properties that will be applied to underlying unit (single-view) specifications.\n */\nexport interface LayerSpec extends BaseSpec, FrameMixins, ResolveMixins {\n /**\n * Layer or single view specifications to be layered.\n *\n * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.\n */\n layer: (LayerSpec | UnitSpec)[];\n\n /**\n * A shared key-value mapping between encoding channels and definition of fields in the underlying layers.\n */\n encoding?: SharedCompositeEncoding;\n\n /**\n * An object defining properties of the geographic projection shared by underlying layers.\n */\n projection?: Projection;\n}\n\n/**\n * A layered specification without any shortcut/expansion syntax.\n */\nexport type NormalizedLayerSpec = GenericLayerSpec;\n\nexport function isLayerSpec(spec: BaseSpec): spec is GenericLayerSpec {\n return 'layer' in spec;\n}\n","import {array, isBoolean} from 'vega-util';\nimport {SUM_OPS} from './aggregate';\nimport {getSecondaryRangeChannel, NonPositionChannel, NONPOSITION_CHANNELS} from './channel';\nimport {\n channelDefType,\n FieldName,\n getFieldDef,\n isFieldDef,\n isFieldOrDatumDef,\n PositionDatumDef,\n PositionFieldDef,\n TypedFieldDef,\n vgField\n} from './channeldef';\nimport {channelHasField, Encoding, isAggregate} from './encoding';\nimport * as log from './log';\nimport {\n ARC,\n AREA,\n BAR,\n CIRCLE,\n isMarkDef,\n isPathMark,\n LINE,\n Mark,\n MarkDef,\n POINT,\n RULE,\n SQUARE,\n TEXT,\n TICK\n} from './mark';\nimport {ScaleType} from './scale';\nimport {contains} from './util';\n\nconst STACK_OFFSET_INDEX = {\n zero: 1,\n center: 1,\n normalize: 1\n} as const;\n\nexport type StackOffset = keyof typeof STACK_OFFSET_INDEX;\n\nexport function isStackOffset(s: string): s is StackOffset {\n return s in STACK_OFFSET_INDEX;\n}\n\nexport interface StackProperties {\n /** Dimension axis of the stack. */\n groupbyChannel?: 'x' | 'y' | 'theta' | 'radius';\n\n /** Field for groupbyChannel. */\n groupbyField?: FieldName;\n\n /** Measure axis of the stack. */\n fieldChannel: 'x' | 'y' | 'theta' | 'radius';\n\n /** Stack-by fields e.g., color, detail */\n stackBy: {\n fieldDef: TypedFieldDef;\n channel: NonPositionChannel;\n }[];\n\n /**\n * See `stack` property of Position Field Def.\n */\n offset: StackOffset;\n\n /**\n * Whether this stack will produce impute transform\n */\n impute: boolean;\n}\n\nexport const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]);\nexport const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]);\n\nfunction potentialStackedChannel(\n encoding: Encoding,\n x: 'x' | 'theta'\n): 'x' | 'y' | 'theta' | 'radius' | undefined {\n const y = x === 'x' ? 'y' : 'radius';\n\n const xDef = encoding[x];\n const yDef = encoding[y];\n\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n if (channelDefType(xDef) === 'quantitative' && channelDefType(yDef) === 'quantitative') {\n if (xDef.stack) {\n return x;\n } else if (yDef.stack) {\n return y;\n }\n const xAggregate = isFieldDef(xDef) && !!xDef.aggregate;\n const yAggregate = isFieldDef(yDef) && !!yDef.aggregate;\n // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y\n if (xAggregate !== yAggregate) {\n return xAggregate ? x : y;\n } else {\n const xScale = xDef.scale?.type;\n const yScale = yDef.scale?.type;\n\n if (xScale && xScale !== 'linear') {\n return y;\n } else if (yScale && yScale !== 'linear') {\n return x;\n }\n }\n } else if (channelDefType(xDef) === 'quantitative') {\n return x;\n } else if (channelDefType(yDef) === 'quantitative') {\n return y;\n }\n } else if (channelDefType(xDef) === 'quantitative') {\n return x;\n } else if (channelDefType(yDef) === 'quantitative') {\n return y;\n }\n return undefined;\n}\n\nfunction getDimensionChannel(channel: 'x' | 'y' | 'theta' | 'radius') {\n switch (channel) {\n case 'x':\n return 'y';\n case 'y':\n return 'x';\n case 'theta':\n return 'radius';\n case 'radius':\n return 'theta';\n }\n}\n\n// Note: CompassQL uses this method and only pass in required properties of each argument object.\n// If required properties change, make sure to update CompassQL.\nexport function stack(\n m: Mark | MarkDef,\n encoding: Encoding,\n opt: {\n disallowNonLinearStack?: boolean; // This option is for CompassQL\n } = {}\n): StackProperties {\n const mark = isMarkDef(m) ? m.type : m;\n // Should have stackable mark\n if (!STACKABLE_MARKS.has(mark)) {\n return null;\n }\n\n // Run potential stacked twice, one for Cartesian and another for Polar,\n // so text marks can be stacked in any of the coordinates.\n\n // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking.\n // However, since we probably never want to do that, let's just note the limitation here.\n const fieldChannel = potentialStackedChannel(encoding, 'x') || potentialStackedChannel(encoding, 'theta');\n\n if (!fieldChannel) {\n return null;\n }\n\n const stackedFieldDef = encoding[fieldChannel] as PositionFieldDef | PositionDatumDef;\n const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined;\n\n let dimensionChannel: 'x' | 'y' | 'theta' | 'radius' = getDimensionChannel(fieldChannel);\n let dimensionDef = encoding[dimensionChannel];\n\n let dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined;\n\n // avoid grouping by the stacked field\n if (dimensionField === stackedField) {\n dimensionField = undefined;\n dimensionDef = undefined;\n dimensionChannel = undefined;\n }\n\n // Should have grouping level of detail that is different from the dimension field\n const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => {\n // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001)\n if (channel !== 'tooltip' && channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n for (const cDef of array(channelDef)) {\n const fieldDef = getFieldDef(cDef);\n if (fieldDef.aggregate) {\n continue;\n }\n\n // Check whether the channel's field is identical to x/y's field or if the channel is a repeat\n const f = vgField(fieldDef, {});\n if (\n // if fielddef is a repeat, just include it in the stack by\n !f ||\n // otherwise, the field must be different from x and y fields.\n f !== dimensionField\n ) {\n sc.push({channel, fieldDef});\n }\n }\n }\n return sc;\n }, []);\n\n // Automatically determine offset\n let offset: StackOffset;\n if (stackedFieldDef.stack !== undefined) {\n if (isBoolean(stackedFieldDef.stack)) {\n offset = stackedFieldDef.stack ? 'zero' : null;\n } else {\n offset = stackedFieldDef.stack;\n }\n } else if (stackBy.length > 0 && STACK_BY_DEFAULT_MARKS.has(mark)) {\n // Bar and Area with sum ops are automatically stacked by default\n offset = 'zero';\n }\n\n if (!offset || !isStackOffset(offset)) {\n return null;\n }\n\n if (isAggregate(encoding) && stackBy.length === 0) {\n return null;\n }\n\n // warn when stacking non-linear\n if (stackedFieldDef.scale && stackedFieldDef.scale.type && stackedFieldDef.scale.type !== ScaleType.LINEAR) {\n if (opt.disallowNonLinearStack) {\n return null;\n } else {\n log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type));\n }\n }\n\n // Check if it is a ranged mark\n if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) {\n if (stackedFieldDef.stack !== undefined) {\n log.warn(log.message.cannotStackRangedMark(fieldChannel));\n }\n return null;\n }\n\n // Warn if stacking non-summative aggregate\n if (isFieldDef(stackedFieldDef) && stackedFieldDef.aggregate && !contains(SUM_OPS, stackedFieldDef.aggregate)) {\n log.warn(log.message.stackNonSummativeAggregate(stackedFieldDef.aggregate));\n }\n\n return {\n groupbyChannel: dimensionDef ? dimensionChannel : undefined,\n groupbyField: dimensionField,\n fieldChannel,\n impute: stackedFieldDef.impute === null ? false : isPathMark(mark),\n stackBy,\n offset\n };\n}\n","import {isObject} from 'vega-util';\nimport {Config} from '../config';\nimport {Encoding, normalizeEncoding} from '../encoding';\nimport {AreaConfig, isMarkDef, LineConfig, Mark, MarkConfig, MarkDef} from '../mark';\nimport {GenericUnitSpec, NormalizedUnitSpec} from '../spec';\nimport {isUnitSpec} from '../spec/unit';\nimport {stack} from '../stack';\nimport {keys, omit, pick} from '../util';\nimport {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base';\n\ntype UnitSpecWithPathOverlay = GenericUnitSpec, Mark | MarkDef<'line' | 'area' | 'rule' | 'trail'>>;\n\nfunction dropLineAndPoint(markDef: MarkDef): MarkDef | Mark {\n const {point: _point, line: _line, ...mark} = markDef;\n\n return keys(mark).length > 1 ? mark : mark.type;\n}\n\nfunction dropLineAndPointFromConfig(config: Config) {\n for (const mark of ['line', 'area', 'rule', 'trail'] as const) {\n if (config[mark]) {\n config = {\n ...config,\n // TODO: remove as any\n [mark]: omit(config[mark], ['point', 'line'] as any)\n };\n }\n }\n return config;\n}\n\nfunction getPointOverlay(markDef: MarkDef, markConfig: LineConfig = {}, encoding: Encoding): MarkConfig {\n if (markDef.point === 'transparent') {\n return {opacity: 0};\n } else if (markDef.point) {\n // truthy : true or object\n return isObject(markDef.point) ? markDef.point : {};\n } else if (markDef.point !== undefined) {\n // false or null\n return null;\n } else {\n // undefined (not disabled)\n if (markConfig.point || encoding.shape) {\n // enable point overlay if config[mark].point is truthy or if encoding.shape is provided\n return isObject(markConfig.point) ? markConfig.point : {};\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\n\nfunction getLineOverlay(markDef: MarkDef, markConfig: AreaConfig = {}): MarkConfig {\n if (markDef.line) {\n // true or object\n return markDef.line === true ? {} : markDef.line;\n } else if (markDef.line !== undefined) {\n // false or null\n return null;\n } else {\n // undefined (not disabled)\n if (markConfig.line) {\n // enable line overlay if config[mark].line is truthy\n return markConfig.line === true ? {} : markConfig.line;\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\n\nexport class PathOverlayNormalizer implements NonFacetUnitNormalizer {\n public name = 'path-overlay';\n\n public hasMatchingType(spec: GenericUnitSpec, config: Config): spec is UnitSpecWithPathOverlay {\n if (isUnitSpec(spec)) {\n const {mark, encoding} = spec;\n const markDef = isMarkDef(mark) ? mark : {type: mark};\n switch (markDef.type) {\n case 'line':\n case 'rule':\n case 'trail':\n return !!getPointOverlay(markDef, config[markDef.type], encoding);\n case 'area':\n return (\n // false / null are also included as we want to remove the properties\n !!getPointOverlay(markDef, config[markDef.type], encoding) ||\n !!getLineOverlay(markDef, config[markDef.type])\n );\n }\n }\n return false;\n }\n\n public run(spec: UnitSpecWithPathOverlay, params: NormalizerParams, normalize: NormalizeLayerOrUnit) {\n const {config} = params;\n const {selection, projection, mark, encoding: e, ...outerSpec} = spec;\n\n // Need to call normalizeEncoding because we need the inferred types to correctly determine stack\n const encoding = normalizeEncoding(e, config);\n\n const markDef: MarkDef = isMarkDef(mark) ? mark : {type: mark};\n\n const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding);\n const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]);\n\n const layer: NormalizedUnitSpec[] = [\n {\n ...(selection ? {selection} : {}),\n mark: dropLineAndPoint({\n // TODO: extract this 0.7 to be shared with default opacity for point/tick/...\n ...(markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined\n ? {opacity: 0.7}\n : {}),\n ...markDef\n }),\n // drop shape from encoding as this might be used to trigger point overlay\n encoding: omit(encoding, ['shape'])\n }\n ];\n\n // FIXME: determine rules for applying selections.\n\n // Need to copy stack config to overlayed layer\n const stackProps = stack(markDef, encoding);\n\n let overlayEncoding = encoding;\n if (stackProps) {\n const {fieldChannel: stackFieldChannel, offset} = stackProps;\n overlayEncoding = {\n ...encoding,\n [stackFieldChannel]: {\n ...encoding[stackFieldChannel],\n ...(offset ? {stack: offset} : {})\n }\n };\n }\n\n if (lineOverlay) {\n layer.push({\n ...(projection ? {projection} : {}),\n mark: {\n type: 'line',\n ...pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip']),\n ...lineOverlay\n },\n encoding: overlayEncoding\n });\n }\n if (pointOverlay) {\n layer.push({\n ...(projection ? {projection} : {}),\n mark: {\n type: 'point',\n opacity: 1,\n filled: true,\n ...pick(markDef, ['clip', 'tooltip']),\n ...pointOverlay\n },\n encoding: overlayEncoding\n });\n }\n\n return normalize(\n {\n ...outerSpec,\n layer\n },\n {\n ...params,\n config: dropLineAndPointFromConfig(config)\n }\n );\n }\n}\n","import {getSizeChannel, POSITION_SCALE_CHANNELS} from '../channel';\nimport {isFieldOrDatumDef} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {Scale} from '../scale';\nimport {GenericSpec} from '../spec';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {isEmpty} from '../util';\nimport {NonFacetUnitNormalizer} from './base';\n\ntype UnitSpecWithRangeStep = GenericUnitSpec, any>; // this is not accurate, but it's not worth making it accurate\n\nexport class RangeStepNormalizer implements NonFacetUnitNormalizer {\n public name = 'RangeStep';\n\n public hasMatchingType(spec: GenericSpec): spec is UnitSpecWithRangeStep {\n if (isUnitSpec(spec) && spec.encoding) {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const def = spec.encoding[channel];\n if (def && isFieldOrDatumDef(def)) {\n if (def?.scale?.['rangeStep']) {\n return true;\n }\n }\n }\n }\n return false;\n }\n\n public run(spec: UnitSpecWithRangeStep): NormalizedUnitSpec {\n const sizeMixins = {};\n let encoding = {...spec.encoding};\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n const def = encoding[channel];\n if (def && isFieldOrDatumDef(def)) {\n if (def?.scale?.['rangeStep']) {\n const {scale, ...defWithoutScale} = def;\n\n const {rangeStep, ...scaleWithoutRangeStep} = scale as Scale & {rangeStep: number};\n sizeMixins[sizeType] = {step: scale['rangeStep']};\n\n log.warn(log.message.RANGE_STEP_DEPRECATED);\n\n encoding = {\n ...encoding,\n [channel]: {\n ...defWithoutScale,\n ...(isEmpty(scaleWithoutRangeStep) ? {} : {scale: scaleWithoutRangeStep})\n }\n };\n }\n }\n }\n return {\n ...sizeMixins,\n ...spec,\n encoding\n };\n }\n}\n","import {hasOwnProperty, isArray} from 'vega-util';\nimport {\n ChannelDef,\n DatumDef,\n Field,\n FieldDef,\n FieldName,\n hasConditionalFieldOrDatumDef,\n isConditionalDef,\n isFieldDef,\n isFieldOrDatumDef,\n isRepeatRef,\n isSortableFieldDef,\n ScaleFieldDef,\n ValueDef\n} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {isSortField} from '../sort';\nimport {FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet';\n\nexport interface RepeaterValue {\n row?: string;\n column?: string;\n\n repeat?: string;\n\n layer?: string;\n}\n\nexport function replaceRepeaterInFacet(\n facet: FacetFieldDef | FacetMapping,\n repeater: RepeaterValue\n): FacetFieldDef | FacetMapping {\n if (!repeater) {\n return facet as FacetFieldDef;\n }\n\n if (isFacetMapping(facet)) {\n return replaceRepeaterInMapping(facet, repeater) as FacetMapping;\n }\n return replaceRepeaterInFieldDef(facet, repeater) as FacetFieldDef;\n}\n\nexport function replaceRepeaterInEncoding>(\n encoding: E,\n repeater: RepeaterValue\n): Encoding {\n if (!repeater) {\n return encoding as Encoding;\n }\n\n return replaceRepeaterInMapping(encoding, repeater) as Encoding;\n}\n\n/**\n * Replaces repeated value and returns if the repeated value is valid.\n */\nfunction replaceRepeatInProp(prop: keyof T, o: T, repeater: RepeaterValue): T {\n const val = o[prop];\n if (isRepeatRef(val)) {\n if (val.repeat in repeater) {\n return {...o, [prop]: repeater[val.repeat]};\n } else {\n log.warn(log.message.noSuchRepeatedValue(val.repeat));\n return undefined;\n }\n }\n return o;\n}\n\n/**\n * Replace repeater values in a field def with the concrete field name.\n */\n\nfunction replaceRepeaterInFieldDef(fieldDef: FieldDef, repeater: RepeaterValue) {\n fieldDef = replaceRepeatInProp('field', fieldDef, repeater);\n\n if (fieldDef === undefined) {\n // the field def should be ignored\n return undefined;\n } else if (fieldDef === null) {\n return null;\n }\n\n if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) {\n const sort = replaceRepeatInProp('field', fieldDef.sort, repeater);\n fieldDef = {\n ...fieldDef,\n ...(sort ? {sort} : {})\n };\n }\n\n return fieldDef as ScaleFieldDef;\n}\n\nfunction replaceRepeaterInFieldOrDatumDef(def: FieldDef | DatumDef, repeater: RepeaterValue) {\n if (isFieldDef(def)) {\n return replaceRepeaterInFieldDef(def, repeater);\n } else {\n const datumDef = replaceRepeatInProp('datum', def, repeater);\n if (datumDef !== def && !datumDef.type) {\n datumDef.type = 'nominal';\n }\n return datumDef;\n }\n}\n\nfunction replaceRepeaterInChannelDef(channelDef: ChannelDef, repeater: RepeaterValue) {\n if (isFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater);\n if (fd) {\n return fd;\n } else if (isConditionalDef>(channelDef)) {\n return {condition: channelDef.condition};\n }\n } else {\n if (hasConditionalFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater);\n if (fd) {\n return {\n ...channelDef,\n condition: fd\n } as ChannelDef;\n } else {\n const {condition, ...channelDefWithoutCondition} = channelDef;\n return channelDefWithoutCondition as ChannelDef;\n }\n }\n return channelDef as ValueDef;\n }\n return undefined;\n}\n\ntype EncodingOrFacet = Encoding | FacetMapping;\n\nfunction replaceRepeaterInMapping(\n mapping: EncodingOrFacet,\n repeater: RepeaterValue\n): EncodingOrFacet {\n const out: EncodingOrFacet = {};\n for (const channel in mapping) {\n if (hasOwnProperty(mapping, channel)) {\n const channelDef: ChannelDef | ChannelDef[] = mapping[channel];\n\n if (isArray(channelDef)) {\n // array cannot have condition\n out[channel] = (channelDef as ChannelDef[]) // somehow we need to cast it here\n .map(cd => replaceRepeaterInChannelDef(cd, repeater))\n .filter(cd => cd);\n } else {\n const cd = replaceRepeaterInChannelDef(channelDef, repeater);\n if (cd !== undefined) {\n out[channel] = cd;\n }\n }\n }\n }\n return out;\n}\n","import {isBinned} from '../bin';\nimport {getMainRangeChannel, SECONDARY_RANGE_CHANNEL} from '../channel';\nimport {Field, isDatumDef, isFieldDef} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {GenericSpec} from '../spec';\nimport {GenericUnitSpec, isUnitSpec} from '../spec/unit';\nimport {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base';\n\ninterface EncodingX2Mixins {\n x2: Encoding['x2'];\n}\n\ninterface EncodingY2Mixins {\n y2: Encoding['y2'];\n}\n\ntype RangedLineSpec = GenericUnitSpec & (EncodingX2Mixins | EncodingY2Mixins), 'line'>;\n\nexport class RuleForRangedLineNormalizer implements NonFacetUnitNormalizer {\n public name = 'RuleForRangedLine';\n\n public hasMatchingType(spec: GenericSpec): spec is RangedLineSpec {\n if (isUnitSpec(spec)) {\n const {encoding, mark} = spec;\n if (mark === 'line') {\n for (const channel of SECONDARY_RANGE_CHANNEL) {\n const mainChannel = getMainRangeChannel(channel);\n const mainChannelDef = encoding[mainChannel];\n\n if (encoding[channel]) {\n if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) {\n return true;\n }\n }\n }\n }\n }\n return false;\n }\n\n public run(spec: RangedLineSpec, params: NormalizerParams, normalize: NormalizeLayerOrUnit) {\n const {encoding} = spec;\n log.warn(log.message.lineWithRange(!!encoding.x2, !!encoding.y2));\n\n return normalize(\n {\n ...spec,\n mark: 'rule'\n },\n params\n );\n }\n}\n","import {isArray} from 'vega-util';\nimport {COLUMN, FACET, ROW} from '../channel';\nimport {Field, FieldName, hasConditionalFieldOrDatumDef, isFieldOrDatumDef, isValueDef} from '../channeldef';\nimport {SharedCompositeEncoding} from '../compositemark';\nimport {boxPlotNormalizer} from '../compositemark/boxplot';\nimport {errorBandNormalizer} from '../compositemark/errorband';\nimport {errorBarNormalizer} from '../compositemark/errorbar';\nimport {channelHasField, Encoding} from '../encoding';\nimport * as log from '../log';\nimport {Projection} from '../projection';\nimport {FacetedUnitSpec, GenericSpec, LayerSpec, UnitSpec} from '../spec';\nimport {GenericCompositionLayoutWithColumns} from '../spec/base';\nimport {GenericConcatSpec} from '../spec/concat';\nimport {\n FacetEncodingFieldDef,\n FacetFieldDef,\n FacetMapping,\n GenericFacetSpec,\n isFacetMapping,\n NormalizedFacetSpec\n} from '../spec/facet';\nimport {NormalizedSpec} from '../spec/index';\nimport {NormalizedLayerSpec} from '../spec/layer';\nimport {SpecMapper} from '../spec/map';\nimport {isLayerRepeatSpec, LayerRepeatSpec, NonLayerRepeatSpec, RepeatSpec} from '../spec/repeat';\nimport {isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {isEmpty, keys, omit, varName} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {NonFacetUnitNormalizer, NormalizerParams} from './base';\nimport {PathOverlayNormalizer} from './pathoverlay';\nimport {RangeStepNormalizer} from './rangestep';\nimport {replaceRepeaterInEncoding, replaceRepeaterInFacet} from './repeater';\nimport {RuleForRangedLineNormalizer} from './ruleforrangedline';\n\nexport class CoreNormalizer extends SpecMapper {\n private nonFacetUnitNormalizers: NonFacetUnitNormalizer[] = [\n boxPlotNormalizer,\n errorBarNormalizer,\n errorBandNormalizer,\n new PathOverlayNormalizer(),\n new RuleForRangedLineNormalizer(),\n new RangeStepNormalizer()\n ];\n\n public map(spec: GenericSpec, params: NormalizerParams) {\n // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec.\n if (isUnitSpec(spec)) {\n const hasRow = channelHasField(spec.encoding, ROW);\n const hasColumn = channelHasField(spec.encoding, COLUMN);\n const hasFacet = channelHasField(spec.encoding, FACET);\n\n if (hasRow || hasColumn || hasFacet) {\n return this.mapFacetedUnit(spec, params);\n }\n }\n\n return super.map(spec, params);\n }\n\n // This is for normalizing non-facet unit\n public mapUnit(spec: UnitSpec, params: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec {\n const {parentEncoding, parentProjection} = params;\n\n const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater);\n\n const specWithReplacedEncoding = {\n ...spec,\n ...(encoding ? {encoding} : {})\n };\n\n if (parentEncoding || parentProjection) {\n return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params);\n }\n\n const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this);\n\n for (const unitNormalizer of this.nonFacetUnitNormalizers) {\n if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) {\n return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit);\n }\n }\n\n return specWithReplacedEncoding as NormalizedUnitSpec;\n }\n\n protected mapRepeat(\n spec: RepeatSpec,\n params: NormalizerParams\n ): GenericConcatSpec | NormalizedLayerSpec {\n if (isLayerRepeatSpec(spec)) {\n return this.mapLayerRepeat(spec, params);\n } else {\n return this.mapNonLayerRepeat(spec, params);\n }\n }\n\n private mapLayerRepeat(\n spec: LayerRepeatSpec,\n params: NormalizerParams\n ): GenericConcatSpec | NormalizedLayerSpec {\n const {repeat, spec: childSpec, ...rest} = spec;\n const {row, column, layer} = repeat;\n\n const {repeater = {}, repeaterPrefix = ''} = params;\n\n if (row || column) {\n return this.mapRepeat(\n {\n ...spec,\n repeat: {\n ...(row ? {row} : {}),\n ...(column ? {column} : {})\n },\n spec: {\n repeat: {layer},\n spec: childSpec\n }\n },\n params\n );\n } else {\n return {\n ...rest,\n layer: layer.map(layerValue => {\n const childRepeater = {\n ...repeater,\n layer: layerValue\n };\n\n const childName = (childSpec.name || '') + repeaterPrefix + `child__layer_${varName(layerValue)}`;\n\n const child = this.mapLayerOrUnit(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName});\n child.name = childName;\n\n return child;\n })\n };\n }\n }\n\n private mapNonLayerRepeat(spec: NonLayerRepeatSpec, params: NormalizerParams): GenericConcatSpec {\n const {repeat, spec: childSpec, data, ...remainingProperties} = spec;\n\n if (!isArray(repeat) && spec.columns) {\n // is repeat with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('repeat'));\n }\n\n const concat: NormalizedSpec[] = [];\n\n const {repeater = {}, repeaterPrefix = ''} = params;\n\n const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null];\n const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null];\n\n const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null];\n\n // cross product\n for (const repeatValue of repeatValues) {\n for (const rowValue of row) {\n for (const columnValue of column) {\n const childRepeater = {\n repeat: repeatValue,\n row: rowValue,\n column: columnValue,\n layer: repeater.layer\n };\n\n const childName =\n (childSpec.name || '') +\n repeaterPrefix +\n 'child__' +\n (isArray(repeat)\n ? `${varName(repeatValue)}`\n : (repeat.row ? `row_${varName(rowValue)}` : '') +\n (repeat.column ? `column_${varName(columnValue)}` : ''));\n\n const child = this.map(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName});\n child.name = childName;\n\n // we move data up\n concat.push(omit(child, ['data']) as NormalizedSpec);\n }\n }\n }\n\n const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1;\n return {\n data: childSpec.data ?? data, // data from child spec should have precedence\n align: 'all',\n ...remainingProperties,\n columns,\n concat\n };\n }\n\n protected mapFacet(\n spec: GenericFacetSpec,\n params: NormalizerParams\n ): GenericFacetSpec {\n const {facet} = spec;\n\n if (isFacetMapping(facet) && spec.columns) {\n // is facet with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('facet'));\n }\n\n return super.mapFacet(spec, params);\n }\n\n private mapUnitWithParentEncodingOrProjection(\n spec: FacetedUnitSpec,\n params: NormalizerParams\n ): NormalizedUnitSpec | NormalizedLayerSpec {\n const {encoding, projection} = spec;\n const {parentEncoding, parentProjection, config} = params;\n const mergedProjection = mergeProjection({parentProjection, projection});\n const mergedEncoding = mergeEncoding({\n parentEncoding,\n encoding: replaceRepeaterInEncoding(encoding, params.repeater)\n });\n\n return this.mapUnit(\n {\n ...spec,\n ...(mergedProjection ? {projection: mergedProjection} : {}),\n ...(mergedEncoding ? {encoding: mergedEncoding} : {})\n },\n {config}\n );\n }\n\n private mapFacetedUnit(spec: FacetedUnitSpec, params: NormalizerParams): NormalizedFacetSpec {\n // New encoding in the inside spec should not contain row / column\n // as row/column should be moved to facet\n const {row, column, facet, ...encoding} = spec.encoding;\n\n // Mark and encoding should be moved into the inner spec\n const {mark, width, projection, height, view, selection, encoding: _, ...outerSpec} = spec;\n\n const {facetMapping, layout} = this.getFacetMappingAndLayout({row, column, facet}, params);\n\n const newEncoding = replaceRepeaterInEncoding(encoding, params.repeater);\n\n return this.mapFacet(\n {\n ...outerSpec,\n ...layout,\n\n // row / column has higher precedence than facet\n facet: facetMapping,\n spec: {\n ...(width ? {width} : {}),\n ...(height ? {height} : {}),\n ...(view ? {view} : {}),\n ...(projection ? {projection} : {}),\n mark,\n encoding: newEncoding,\n ...(selection ? {selection} : {})\n }\n },\n params\n );\n }\n\n private getFacetMappingAndLayout(\n facets: {\n row: FacetEncodingFieldDef;\n column: FacetEncodingFieldDef;\n facet: FacetEncodingFieldDef;\n },\n params: NormalizerParams\n ): {facetMapping: FacetMapping | FacetFieldDef; layout: GenericCompositionLayoutWithColumns} {\n const {row, column, facet} = facets;\n\n if (row || column) {\n if (facet) {\n log.warn(log.message.facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])]));\n }\n\n const facetMapping = {};\n const layout = {};\n\n for (const channel of [ROW, COLUMN]) {\n const def = facets[channel];\n if (def) {\n const {align, center, spacing, columns, ...defWithoutLayout} = def;\n facetMapping[channel] = defWithoutLayout;\n\n for (const prop of ['align', 'center', 'spacing'] as const) {\n if (def[prop] !== undefined) {\n layout[prop] = layout[prop] ?? {};\n layout[prop][channel] = def[prop];\n }\n }\n }\n }\n\n return {facetMapping, layout};\n } else {\n const {align, center, spacing, columns, ...facetMapping} = facet;\n return {\n facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater),\n layout: {\n ...(align ? {align} : {}),\n ...(center ? {center} : {}),\n ...(spacing ? {spacing} : {}),\n ...(columns ? {columns} : {})\n }\n };\n }\n }\n\n public mapLayer(\n spec: LayerSpec,\n {parentEncoding, parentProjection, ...otherParams}: NormalizerParams\n ): NormalizedLayerSpec {\n // Special handling for extended layer spec\n\n const {encoding, projection, ...rest} = spec;\n const params: NormalizerParams = {\n ...otherParams,\n parentEncoding: mergeEncoding({parentEncoding, encoding, layer: true}),\n parentProjection: mergeProjection({parentProjection, projection})\n };\n return super.mapLayer(rest, params);\n }\n}\n\nfunction mergeEncoding({\n parentEncoding,\n encoding = {},\n layer\n}: {\n parentEncoding: SharedCompositeEncoding;\n encoding: SharedCompositeEncoding | Encoding;\n layer?: boolean;\n}): Encoding {\n let merged: any = {};\n if (parentEncoding) {\n const channels = new Set([...keys(parentEncoding), ...keys(encoding)]);\n for (const channel of channels) {\n const channelDef = encoding[channel];\n const parentChannelDef = parentEncoding[channel];\n\n if (isFieldOrDatumDef(channelDef)) {\n // Field/Datum Def can inherit properties from its parent\n // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one.\n const mergedChannelDef = {\n ...parentChannelDef,\n ...channelDef\n };\n merged[channel] = mergedChannelDef;\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n merged[channel] = {\n ...channelDef,\n condition: {\n ...parentChannelDef,\n ...channelDef.condition\n }\n };\n } else if (channelDef) {\n merged[channel] = channelDef;\n } else if (\n layer ||\n isValueDef(parentChannelDef) ||\n isSignalRef(parentChannelDef) ||\n isFieldOrDatumDef(parentChannelDef) ||\n isArray(parentChannelDef)\n ) {\n merged[channel] = parentChannelDef;\n }\n }\n } else {\n merged = encoding;\n }\n return !merged || isEmpty(merged) ? undefined : merged;\n}\n\nfunction mergeProjection(opt: {parentProjection: Projection; projection: Projection}) {\n const {parentProjection, projection} = opt;\n if (parentProjection && projection) {\n log.warn(log.message.projectionOverridden({parentProjection, projection}));\n }\n return projection ?? parentProjection;\n}\n","import {Field} from '../channeldef';\nimport {isString} from 'vega-util';\nimport {Config, initConfig} from '../config';\nimport * as log from '../log';\nimport {\n LayerSpec,\n FacetedUnitSpec,\n GenericSpec,\n isLayerSpec,\n isUnitSpec,\n LayoutSizeMixins,\n NormalizedSpec,\n TopLevelSpec,\n UnitSpec,\n RepeatSpec\n} from '../spec';\nimport {AutoSizeParams, AutosizeType, TopLevel} from '../spec/toplevel';\nimport {deepEqual} from '../util';\nimport {NormalizerParams} from './base';\nimport {CoreNormalizer} from './core';\n\nexport function normalize(\n spec: TopLevelSpec & LayoutSizeMixins,\n config?: Config\n): TopLevel & LayoutSizeMixins {\n if (config === undefined) {\n config = initConfig(spec.config);\n }\n\n const normalizedSpec = normalizeGenericSpec(spec, config);\n\n const {width, height} = spec;\n const autosize = normalizeAutoSize(normalizedSpec, {width, height, autosize: spec.autosize}, config);\n\n return {\n ...normalizedSpec,\n ...(autosize ? {autosize} : {})\n };\n}\n\nconst normalizer = new CoreNormalizer();\n\n/**\n * Decompose extended unit specs into composition of pure unit specs.\n */\nfunction normalizeGenericSpec(\n spec: GenericSpec | FacetedUnitSpec | RepeatSpec,\n config: Config = {}\n) {\n return normalizer.map(spec, {config});\n}\n\nfunction _normalizeAutoSize(autosize: AutosizeType | AutoSizeParams) {\n return isString(autosize) ? {type: autosize} : autosize ?? {};\n}\n\n/**\n * Normalize autosize and deal with width or height == \"container\".\n */\nexport function normalizeAutoSize(\n spec: TopLevel,\n sizeInfo: {autosize: AutosizeType | AutoSizeParams} & LayoutSizeMixins,\n config?: Config\n) {\n let {width, height} = sizeInfo;\n\n const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec);\n const autosizeDefault: AutoSizeParams = {};\n\n if (!isFitCompatible) {\n // If spec is not compatible with autosize == \"fit\", discard width/height == container\n if (width == 'container') {\n log.warn(log.message.containerSizeNonSingle('width'));\n width = undefined;\n }\n if (height == 'container') {\n log.warn(log.message.containerSizeNonSingle('height'));\n height = undefined;\n }\n } else {\n // Default autosize parameters to fit when width/height is \"container\"\n if (width == 'container' && height == 'container') {\n autosizeDefault.type = 'fit';\n autosizeDefault.contains = 'padding';\n } else if (width == 'container') {\n autosizeDefault.type = 'fit-x';\n autosizeDefault.contains = 'padding';\n } else if (height == 'container') {\n autosizeDefault.type = 'fit-y';\n autosizeDefault.contains = 'padding';\n }\n }\n\n const autosize: AutoSizeParams = {\n type: 'pad',\n ...autosizeDefault,\n ...(config ? _normalizeAutoSize(config.autosize) : {}),\n ..._normalizeAutoSize(spec.autosize)\n };\n\n if (autosize.type === 'fit' && !isFitCompatible) {\n log.warn(log.message.FIT_NON_SINGLE);\n autosize.type = 'pad';\n }\n\n if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('width'));\n }\n if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('height'));\n }\n\n // Delete autosize property if it's Vega's default\n if (deepEqual(autosize, {type: 'pad'})) {\n return undefined;\n }\n\n return autosize;\n}\n\nexport {NormalizerParams};\n","import {GenericSpec} from '.';\nimport * as log from '../log';\nimport {Field, FieldName} from '../channeldef';\nimport {\n GenericConcatSpec,\n GenericHConcatSpec,\n GenericVConcatSpec,\n isConcatSpec,\n isHConcatSpec,\n isVConcatSpec\n} from './concat';\nimport {GenericFacetSpec, isFacetSpec} from './facet';\nimport {GenericLayerSpec, isLayerSpec} from './layer';\nimport {isRepeatSpec, RepeatSpec} from './repeat';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from './unit';\n\nexport abstract class SpecMapper<\n P,\n UI extends GenericUnitSpec,\n LI extends GenericLayerSpec = GenericLayerSpec,\n UO extends GenericUnitSpec = NormalizedUnitSpec,\n RO extends RepeatSpec = never,\n FO extends Field = FieldName\n> {\n public map(spec: GenericSpec, params: P): GenericSpec, RO, FO> {\n if (isFacetSpec(spec)) {\n return this.mapFacet(spec, params);\n } else if (isRepeatSpec(spec)) {\n return this.mapRepeat(spec, params);\n } else if (isHConcatSpec(spec)) {\n return this.mapHConcat(spec, params);\n } else if (isVConcatSpec(spec)) {\n return this.mapVConcat(spec, params);\n } else if (isConcatSpec(spec)) {\n return this.mapConcat(spec, params);\n } else {\n return this.mapLayerOrUnit(spec, params);\n }\n }\n\n public mapLayerOrUnit(spec: UI | LI, params: P): UO | GenericLayerSpec {\n if (isLayerSpec(spec)) {\n return this.mapLayer(spec, params);\n } else if (isUnitSpec(spec)) {\n return this.mapUnit(spec, params);\n }\n throw new Error(log.message.invalidSpec(spec));\n }\n\n public abstract mapUnit(spec: UI, params: P): UO | GenericLayerSpec;\n\n protected mapLayer(spec: LI, params: P): GenericLayerSpec {\n return {\n ...spec,\n layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params))\n };\n }\n\n protected mapHConcat(\n spec: GenericHConcatSpec>,\n params: P\n ): GenericHConcatSpec, RO, FO>> {\n return {\n ...spec,\n hconcat: spec.hconcat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapVConcat(\n spec: GenericVConcatSpec>,\n params: P\n ): GenericVConcatSpec, RO, FO>> {\n return {\n ...spec,\n vconcat: spec.vconcat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapConcat(\n spec: GenericConcatSpec>,\n params: P\n ): GenericConcatSpec, RO, FO>> {\n const {concat, ...rest} = spec;\n\n return {\n ...rest,\n concat: concat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapFacet(spec: GenericFacetSpec, params: P): GenericFacetSpec, FO> {\n return {\n // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef\n ...(spec as any),\n // TODO: remove \"any\" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760\n spec: this.map(spec.spec, params) as any\n };\n }\n\n protected mapRepeat(spec: RepeatSpec, params: P): GenericSpec {\n return {\n ...spec,\n // as any is required here since TS cannot infer that the output type satisfies the input type\n spec: this.map(spec.spec as any, params)\n };\n }\n}\n","import {isArray} from 'vega-util';\nimport {GenericSpec, LayerSpec} from '.';\nimport {FieldName} from '../channeldef';\nimport {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\nimport {FacetedUnitSpec, UnitSpec} from './unit';\n\nexport interface RepeatMapping {\n /**\n * An array of fields to be repeated vertically.\n */\n row?: string[];\n\n /**\n * An array of fields to be repeated horizontally.\n */\n column?: string[];\n}\n\nexport interface LayerRepeatMapping extends RepeatMapping {\n /**\n * An array of fields to be repeated as layers.\n */\n layer: string[];\n}\n\nexport type RepeatSpec = NonLayerRepeatSpec | LayerRepeatSpec;\n\n/**\n * Base interface for a repeat specification.\n */\nexport interface NonLayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for fields to be repeated. One of:\n * 1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n * 2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively.\n */\n repeat: string[] | RepeatMapping;\n\n /**\n * A specification of the view that gets repeated.\n */\n spec: GenericSpec;\n}\n\nexport interface LayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for fields to be repeated. One of:\n * 1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n * 2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively.\n */\n repeat: LayerRepeatMapping;\n\n /**\n * A specification of the view that gets repeated.\n */\n spec: LayerSpec | UnitSpec;\n}\n\nexport function isRepeatSpec(spec: BaseSpec): spec is RepeatSpec {\n return 'repeat' in spec;\n}\n\nexport function isLayerRepeatSpec(spec: RepeatSpec): spec is LayerRepeatSpec {\n return !isArray(spec.repeat) && spec.repeat['layer'];\n}\n","import {Color, SignalRef} from 'vega';\nimport {BaseSpec} from '.';\nimport {getPositionScaleChannel} from '../channel';\nimport {Config} from '../config';\nimport {InlineDataset} from '../data';\nimport {Dict} from '../util';\n\n/**\n * @minimum 0\n */\nexport type Padding = number | {top?: number; bottom?: number; left?: number; right?: number};\n\nexport type Datasets = Dict;\n\nexport type TopLevel = S &\n TopLevelProperties & {\n /**\n * URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.\n * @format uri\n */\n $schema?: string;\n\n /**\n * Vega-Lite configuration object. This property can only be defined at the top-level of a specification.\n */\n config?: Config;\n\n /**\n * A global data store for named datasets. This is a mapping from names to inline datasets.\n * This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property.\n */\n datasets?: Datasets;\n\n /**\n * Optional metadata that will be passed to Vega.\n * This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata.\n */\n usermeta?: Dict;\n };\n\nexport interface TopLevelProperties {\n /**\n * CSS color property to use as the background of the entire view.\n *\n * __Default value:__ `\"white\"`\n */\n background?: Color | SignalRef;\n\n /**\n * The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\n * If an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n *\n * __Default value__: `5`\n */\n padding?: Padding | SignalRef;\n\n /**\n * How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\n * Object values can additionally specify parameters for content sizing and automatic resizing.\n *\n * __Default value__: `pad`\n */\n autosize?: AutosizeType | AutoSizeParams; // Vega actually supports signal for autosize. However, we need to check autosize at compile time to infer the rest of the spec. Thus VL's autosize won't support SignalRef for now.\n}\n\nexport type FitType = 'fit' | 'fit-x' | 'fit-y';\n\nexport function isFitType(autoSizeType: AutosizeType): autoSizeType is FitType {\n return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y';\n}\n\nexport function getFitType(sizeType?: 'width' | 'height'): FitType {\n return sizeType ? (`fit-${getPositionScaleChannel(sizeType)}` as FitType) : 'fit';\n}\n\nexport type AutosizeType = 'pad' | 'none' | 'fit' | 'fit-x' | 'fit-y';\n\nexport interface AutoSizeParams {\n /**\n * The sizing format type. One of `\"pad\"`, `\"fit\"`, `\"fit-x\"`, `\"fit-y\"`, or `\"none\"`. See the [autosize type](https://vega.github.io/vega-lite/docs/size.html#autosize) documentation for descriptions of each.\n *\n * __Default value__: `\"pad\"`\n */\n type?: AutosizeType;\n\n /**\n * A boolean flag indicating if autosize layout should be re-calculated on every view update.\n *\n * __Default value__: `false`\n */\n resize?: boolean;\n\n /**\n * Determines how size calculation should be performed, one of `\"content\"` or `\"padding\"`. The default setting (`\"content\"`) interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the `\"padding\"` setting includes the padding within the view size calculations, such that the width and height settings indicate the **total** intended size of the view.\n *\n * __Default value__: `\"content\"`\n */\n contains?: 'content' | 'padding';\n}\n\nconst TOP_LEVEL_PROPERTIES: (keyof TopLevelProperties)[] = [\n 'background',\n 'padding'\n // We do not include \"autosize\" here as it is supported by only unit and layer specs and thus need to be normalized\n];\n\nexport function extractTopLevelProperties(t: T) {\n return TOP_LEVEL_PROPERTIES.reduce((o, p) => {\n if (t && t[p] !== undefined) {\n o[p] = t[p];\n }\n return o;\n }, {});\n}\n","import * as log from '../log';\nimport {deepEqual, duplicate, getFirstDefined, keys} from '../util';\n\n/**\n * Generic class for storing properties that are explicitly specified\n * and implicitly determined by the compiler.\n * This is important for scale/axis/legend merging as\n * we want to prioritize properties that users explicitly specified.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport class Split {\n constructor(public readonly explicit: Partial = {}, public readonly implicit: Partial = {}) {}\n\n public clone() {\n return new Split(duplicate(this.explicit), duplicate(this.implicit));\n }\n\n public combine(): Partial {\n // FIXME remove \"as any\".\n // Add \"as any\" to avoid an error \"Spread types may only be created from object types\".\n return {\n ...(this.explicit as any), // Explicit properties comes first\n ...(this.implicit as any)\n };\n }\n\n public get(key: K): T[K] {\n // Explicit has higher precedence\n return getFirstDefined(this.explicit[key], this.implicit[key]);\n }\n\n public getWithExplicit(key: K): Explicit {\n // Explicit has higher precedence\n if (this.explicit[key] !== undefined) {\n return {explicit: true, value: this.explicit[key]};\n } else if (this.implicit[key] !== undefined) {\n return {explicit: false, value: this.implicit[key]};\n }\n return {explicit: false, value: undefined};\n }\n\n public setWithExplicit(key: K, value: Explicit) {\n if (value.value !== undefined) {\n this.set(key, value.value, value.explicit);\n }\n }\n\n public set(key: K, value: T[K], explicit: boolean) {\n delete this[explicit ? 'implicit' : 'explicit'][key];\n this[explicit ? 'explicit' : 'implicit'][key] = value;\n return this;\n }\n\n public copyKeyFromSplit(key: keyof T, s: Split) {\n // Explicit has higher precedence\n if (s.explicit[key] !== undefined) {\n this.set(key, s.explicit[key], true);\n } else if (s.implicit[key] !== undefined) {\n this.set(key, s.implicit[key], false);\n }\n }\n public copyKeyFromObject(key: keyof T, s: Partial) {\n // Explicit has higher precedence\n if (s[key] !== undefined) {\n this.set(key, s[key], true);\n }\n }\n\n /**\n * Merge split object into this split object. Properties from the other split\n * overwrite properties from this split.\n */\n public copyAll(other: Split) {\n for (const key of keys(other.combine())) {\n const val = other.getWithExplicit(key);\n this.setWithExplicit(key, val);\n }\n }\n}\n\nexport interface Explicit {\n explicit: boolean;\n value: T;\n}\n\nexport function makeExplicit(value: T): Explicit {\n return {\n explicit: true,\n value\n };\n}\n\nexport function makeImplicit(value: T): Explicit {\n return {\n explicit: false,\n value\n };\n}\n\nexport type SplitParentProperty = 'scale' | 'axis' | 'legend' | '';\n\nexport function tieBreakByComparing(compare: (v1: T, v2: T) => number) {\n return (\n v1: Explicit,\n v2: Explicit,\n property: keyof S | never,\n propertyOf: SplitParentProperty\n ): Explicit => {\n const diff = compare(v1.value, v2.value);\n if (diff > 0) {\n return v1;\n } else if (diff < 0) {\n return v2;\n }\n return defaultTieBreaker(v1, v2, property, propertyOf);\n };\n}\n\nexport function defaultTieBreaker(\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: SplitParentProperty\n) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, prefer v1.\n return v1;\n}\n\nexport function mergeValuesWithExplicit(\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: SplitParentProperty,\n tieBreaker: (\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: string\n ) => Explicit = defaultTieBreaker\n) {\n if (v1 === undefined || v1.value === undefined) {\n // For first run\n return v2;\n }\n\n if (v1.explicit && !v2.explicit) {\n return v1;\n } else if (v2.explicit && !v1.explicit) {\n return v2;\n } else if (deepEqual(v1.value, v2.value)) {\n return v1;\n } else {\n return tieBreaker(v1, v2, property, propertyOf);\n }\n}\n","import {Parse} from '../../data';\nimport {Dict} from '../../util';\nimport {Split} from '../split';\nimport {OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {SourceNode} from './source';\n\nexport interface DataComponent {\n /**\n * A list of unique sources.\n */\n sources: SourceNode[];\n\n /**\n * Registry of output nodes.\n */\n outputNodes: Dict;\n\n /**\n * How often is an output node used. If it is not used, we don't need to\n * instantiate it in the assemble step.\n */\n outputNodeRefCounts: Dict;\n\n /**\n * The output node before aggregation.\n */\n raw?: OutputNode;\n\n /**\n * The main output node.\n */\n main?: OutputNode;\n\n /**\n * For facets, we store the reference to the root node.\n */\n facetRoot?: FacetNode;\n\n /**\n * True if the data for this model is faceted.\n * A dataset is faceted if a parent model is a facet and no new dataset is\n * defined (which would make the data unfaceted again).\n */\n isFaceted: boolean;\n\n /**\n * Parse properties passed down from ancestors. Helps us to keep track of what has been parsed or is derived.\n */\n ancestorParse?: AncestorParse;\n}\n\n/**\n * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf)\n * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the\n * same field again (or differently).\n */\nexport class AncestorParse extends Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {},\n public parseNothing = false\n ) {\n super(explicit, implicit);\n }\n\n public clone(): AncestorParse {\n const clone = super.clone() as AncestorParse;\n clone.parseNothing = this.parseNothing;\n return clone;\n }\n}\n","/*\n * Constants and utilities for data.\n */\nimport {Vector2} from 'vega';\nimport {FieldName} from './channeldef';\nimport {VgData} from './vega.schema';\n\nexport type ParseValue = null | string | 'string' | 'boolean' | 'date' | 'number';\n\nexport interface Parse {\n [field: string]: ParseValue;\n}\n\nexport interface DataFormatBase {\n /**\n * If set to `null`, disable type inference based on the spec and only use type inference based on the data.\n * Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `\"number\"`, `\"boolean\"`, `\"date\"`, or null (do not parse the field)).\n * For example, `\"parse\": {\"modified_on\": \"date\"}` parses the `modified_on` field in each input record a Date value.\n *\n * For `\"date\"`, we parse data based using Javascript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).\n * For Specific date formats can be provided (e.g., `{foo: \"date:'%m%d%Y'\"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: \"utc:'%m%d%Y'\"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc)\n */\n parse?: Parse | null;\n\n /**\n * Type of input data: `\"json\"`, `\"csv\"`, `\"tsv\"`, `\"dsv\"`.\n *\n * __Default value:__ The default format type is determined by the extension of the file URL.\n * If no extension is detected, `\"json\"` will be used by default.\n */\n type?: 'csv' | 'tsv' | 'dsv' | 'json' | 'topojson';\n}\n\nexport interface CsvDataFormat extends DataFormatBase {\n type?: 'csv' | 'tsv';\n}\n\nexport interface DsvDataFormat extends DataFormatBase {\n type?: 'dsv';\n\n /**\n * The delimiter between records. The delimiter must be a single character (i.e., a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not.\n *\n * @minLength 1\n * @maxLength 1\n */\n delimiter: string;\n}\n\nexport interface JsonDataFormat extends DataFormatBase {\n type?: 'json';\n /**\n * The JSON property containing the desired data.\n * This parameter can be used when the loaded JSON file may have surrounding structure or meta-data.\n * For example `\"property\": \"values.features\"` is equivalent to retrieving `json.values.features`\n * from the loaded JSON object.\n */\n property?: string;\n}\n\nexport interface TopoDataFormat extends DataFormatBase {\n type?: 'topojson';\n /**\n * The name of the TopoJSON object set to convert to a GeoJSON feature collection.\n * For example, in a map of the world, there may be an object set named `\"countries\"`.\n * Using the feature property, we can extract this set and generate a GeoJSON feature object for each country.\n */\n feature?: string;\n /**\n * The name of the TopoJSON object set to convert to mesh.\n * Similar to the `feature` option, `mesh` extracts a named TopoJSON object set.\n * Unlike the `feature` option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features.\n * Extracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties.\n */\n mesh?: string;\n}\n\nexport type DataFormat = CsvDataFormat | DsvDataFormat | JsonDataFormat | TopoDataFormat;\n\nexport type DataFormatType = 'json' | 'csv' | 'tsv' | 'dsv' | 'topojson';\n\nexport type DataSource = UrlData | InlineData | NamedData;\n\nexport type Data = DataSource | Generator;\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type InlineDataset = number[] | string[] | boolean[] | object[] | string | object;\n\nexport interface DataBase {\n /**\n * An object that specifies the format for parsing the data.\n */\n format?: DataFormat;\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name?: string;\n}\n\nexport interface UrlData extends DataBase {\n /**\n * An URL from which to load the data set. Use the `format.type` property\n * to ensure the loaded data is correctly parsed.\n */\n url: string;\n}\n\nexport interface InlineData extends DataBase {\n /**\n * The full data set, included inline. This can be an array of objects or primitive values, an object, or a string.\n * Arrays of primitive values are ingested as objects with a `data` property. Strings are parsed according to the specified format type.\n */\n values: InlineDataset;\n}\n\nexport interface NamedData extends DataBase {\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name: string;\n}\n\nexport function isUrlData(data: Partial | Partial): data is UrlData {\n return 'url' in data;\n}\n\nexport function isInlineData(data: Partial | Partial): data is InlineData {\n return 'values' in data;\n}\n\nexport function isNamedData(data: Partial | Partial): data is NamedData {\n return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data);\n}\n\nexport function isGenerator(data: Partial | Partial): data is Generator {\n return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data));\n}\n\nexport function isSequenceGenerator(data: Partial | Partial): data is SequenceGenerator {\n return 'sequence' in data;\n}\n\nexport function isSphereGenerator(data: Partial | Partial): data is SphereGenerator {\n return 'sphere' in data;\n}\n\nexport function isGraticuleGenerator(data: Partial | Partial): data is GraticuleGenerator {\n return 'graticule' in data;\n}\n\nexport enum DataSourceType {\n Raw,\n Main,\n Row,\n Column,\n Lookup\n}\n\nexport type Generator = SequenceGenerator | SphereGenerator | GraticuleGenerator;\n\nexport interface GeneratorBase {\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name?: string;\n}\n\nexport interface SequenceGenerator extends GeneratorBase {\n /**\n * Generate a sequence of numbers.\n */\n sequence: SequenceParams;\n}\n\nexport interface SequenceParams {\n /**\n * The starting value of the sequence (inclusive).\n */\n start: number;\n /**\n * The ending value of the sequence (exclusive).\n */\n stop: number;\n /**\n * The step value between sequence entries.\n *\n * __Default value:__ `1`\n */\n step?: number;\n\n /**\n * The name of the generated sequence field.\n *\n * __Default value:__ `\"data\"`\n */\n as?: FieldName;\n}\n\nexport interface SphereGenerator extends GeneratorBase {\n /**\n * Generate sphere GeoJSON data for the full globe.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n sphere: true | {};\n}\n\nexport interface GraticuleGenerator extends GeneratorBase {\n /**\n * Generate graticule GeoJSON data for geographic reference lines.\n */\n graticule: true | GraticuleParams;\n}\n\nexport interface GraticuleParams {\n /**\n * The major extent of the graticule as a two-element array of coordinates.\n */\n extentMajor?: Vector2>;\n\n /**\n * The minor extent of the graticule as a two-element array of coordinates.\n */\n extentMinor?: Vector2>;\n\n /**\n * Sets both the major and minor extents to the same values.\n */\n extent?: Vector2>;\n\n /**\n * The major step angles of the graticule.\n *\n *\n * __Default value:__ `[90, 360]`\n */\n stepMajor?: Vector2;\n\n /**\n * The minor step angles of the graticule.\n *\n * __Default value:__ `[10, 10]`\n */\n stepMinor?: Vector2;\n\n /**\n * Sets both the major and minor step angles to the same values.\n */\n step?: Vector2;\n\n /**\n * The precision of the graticule in degrees.\n *\n * __Default value:__ `2.5`\n */\n precision?: number;\n}\n","import {AggregateOp} from 'vega';\nimport {BinParams} from './bin';\nimport {FieldName} from './channeldef';\nimport {Data} from './data';\nimport {ImputeParams} from './impute';\nimport {LogicalComposition, normalizeLogicalComposition} from './logical';\nimport {normalizePredicate, Predicate} from './predicate';\nimport {SortField} from './sort';\nimport {TimeUnit, TimeUnitParams} from './timeunit';\n\nexport interface FilterTransform {\n /**\n * The `filter` property must be a predication definition, which can takes one of the following forms:\n *\n * 1) an [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string,\n * where `datum` can be used to refer to the current data object.\n * For example, `{filter: \"datum.b2 > 60\"}` would make the output data includes only items that have values in the field `b2` over 60.\n *\n * 2) one of the [field predicates](https://vega.github.io/vega-lite/docs/predicate.html#field-predicate): \n * [`equal`](https://vega.github.io/vega-lite/docs/predicate.html#field-equal-predicate),\n * [`lt`](https://vega.github.io/vega-lite/docs/predicate.html#lt-predicate),\n * [`lte`](https://vega.github.io/vega-lite/docs/predicate.html#lte-predicate),\n * [`gt`](https://vega.github.io/vega-lite/docs/predicate.html#gt-predicate),\n * [`gte`](https://vega.github.io/vega-lite/docs/predicate.html#gte-predicate),\n * [`range`](https://vega.github.io/vega-lite/docs/predicate.html#range-predicate),\n * [`oneOf`](https://vega.github.io/vega-lite/docs/predicate.html#one-of-predicate),\n * or [`valid`](https://vega.github.io/vega-lite/docs/predicate.html#valid-predicate),\n\n * 3) a [selection predicate](https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate), which define the names of a selection that the data point should belong to (or a logical composition of selections).\n *\n * 4) a [logical composition](https://vega.github.io/vega-lite/docs/predicate.html#composition) of (1), (2), or (3).\n */\n filter: LogicalComposition;\n}\n\nexport function isFilter(t: Transform): t is FilterTransform {\n return 'filter' in t;\n}\n\nexport interface CalculateTransform {\n /**\n * A [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string. Use the variable `datum` to refer to the current data object.\n */\n calculate: string;\n\n /**\n * The field for storing the computed formula value.\n */\n as: FieldName;\n}\n\nexport interface BinTransform {\n /**\n * An object indicating bin properties, or simply `true` for using default bin parameters.\n */\n bin: true | BinParams;\n\n /**\n * The data field to bin.\n */\n field: FieldName;\n\n /**\n * The output fields at which to write the start and end bin values.\n * This can be either a string or an array of strings with two elements denoting the name for the fields for bin start and bin end respectively.\n * If a single string (e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`.\n */\n as: FieldName | FieldName[];\n}\n\nexport interface TimeUnitTransform {\n /**\n * The timeUnit.\n */\n timeUnit: TimeUnit | TimeUnitParams;\n\n /**\n * The data field to apply time unit.\n */\n field: FieldName;\n\n /**\n * The output field to write the timeUnit value.\n */\n as: FieldName;\n}\n\nexport interface AggregateTransform {\n /**\n * Array of objects that define fields to aggregate.\n */\n aggregate: AggregatedFieldDef[];\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n}\n\nexport interface AggregatedFieldDef {\n /**\n * The aggregation operation to apply to the fields (e.g., `\"sum\"`, `\"average\"`, or `\"count\"`).\n * See the [full list of supported aggregation operations](https://vega.github.io/vega-lite/docs/aggregate.html#ops)\n * for more information.\n */\n op: AggregateOp;\n\n /**\n * The data field for which to compute aggregate function. This is required for all aggregation operations except `\"count\"`.\n */\n field?: FieldName;\n\n /**\n * The output field names to use for each aggregated field.\n */\n as: FieldName;\n}\n\nexport interface StackTransform {\n /**\n * The field which is stacked.\n */\n stack: FieldName;\n /**\n * The data fields to group by.\n */\n groupby: FieldName[];\n /**\n * Mode for stacking marks. One of `\"zero\"` (default), `\"center\"`, or `\"normalize\"`.\n * The `\"zero\"` offset will stack starting at `0`. The `\"center\"` offset will center the stacks. The `\"normalize\"` offset will compute percentage values for each stack point, with output values in the range `[0,1]`.\n *\n * __Default value:__ `\"zero\"`\n */\n offset?: 'zero' | 'center' | 'normalize';\n /**\n * Field that determines the order of leaves in the stacked charts.\n */\n sort?: SortField[];\n /**\n * Output field names. This can be either a string or an array of strings with two elements denoting the name for the fields for stack start and stack end respectively.\n * If a single string(e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`.\n */\n as: FieldName | [FieldName, FieldName];\n}\n\nexport type WindowOnlyOp =\n | 'row_number'\n | 'rank'\n | 'dense_rank'\n | 'percent_rank'\n | 'cume_dist'\n | 'ntile'\n | 'lag'\n | 'lead'\n | 'first_value'\n | 'last_value'\n | 'nth_value';\n\nexport interface WindowFieldDef {\n /**\n * The window or aggregation operation to apply within a window (e.g., `\"rank\"`, `\"lead\"`, `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/window.html#ops).\n */\n op: AggregateOp | WindowOnlyOp;\n\n /**\n * Parameter values for the window functions. Parameter values can be omitted for operations that do not accept a parameter.\n *\n * See the list of all supported operations and their parameters [here](https://vega.github.io/vega-lite/docs/transforms/window.html).\n */\n param?: number;\n\n /**\n * The data field for which to compute the aggregate or window function. This can be omitted for window functions that do not operate over a field such as `\"count\"`, `\"rank\"`, `\"dense_rank\"`.\n */\n field?: FieldName;\n\n /**\n * The output name for the window operation.\n */\n as: FieldName;\n}\n\nexport interface WindowTransform {\n /**\n * The definition of the fields in the window, and what calculations to use.\n */\n window: WindowFieldDef[];\n\n /**\n * A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is `[null, 0]`, indicating that the sliding window includes the current object and all preceding objects. The value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. Finally, `[null, null]` indicates that the window frame should always include all data objects. If you this frame and want to assign the same value to add objects, you can use the simpler [join aggregate transform](https://vega.github.io/vega-lite/docs/joinaggregate.html). The only operators affected are the aggregation operations and the `first_value`, `last_value`, and `nth_value` window operations. The other window operations are not affected by this.\n *\n * __Default value:__: `[null, 0]` (includes the current object and all preceding objects)\n */\n frame?: (null | number)[];\n\n /**\n * Indicates if the sliding window frame should ignore peer values (data that are considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations.\n *\n * __Default value:__ `false`\n */\n ignorePeers?: boolean;\n\n /**\n * The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single window.\n */\n groupby?: FieldName[];\n\n /**\n * A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered \"peer\" values of equal rank. If sort is not specified, the order is undefined: data objects are processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to `true`).\n */\n sort?: SortField[];\n}\n\nexport interface JoinAggregateFieldDef {\n /**\n * The aggregation operation to apply (e.g., `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n */\n op: AggregateOp;\n\n /**\n * The data field for which to compute the aggregate function. This can be omitted for functions that do not operate over a field such as `\"count\"`.\n */\n field?: FieldName;\n\n /**\n * The output name for the join aggregate operation.\n */\n as: FieldName;\n}\n\nexport interface JoinAggregateTransform {\n /**\n * The definition of the fields in the join aggregate, and what calculations to use.\n */\n joinaggregate: JoinAggregateFieldDef[];\n\n /**\n * The data fields for partitioning the data objects into separate groups. If unspecified, all data points will be in a single group.\n */\n groupby?: FieldName[];\n}\n\nexport interface ImputeSequence {\n /**\n * The starting value of the sequence.\n * __Default value:__ `0`\n */\n start?: number;\n /**\n * The ending value(exclusive) of the sequence.\n */\n stop: number;\n /**\n * The step value between sequence entries.\n * __Default value:__ `1` or `-1` if `stop < start`\n */\n step?: number;\n}\n\nexport function isImputeSequence(t: ImputeSequence | any[] | undefined): t is ImputeSequence {\n return t?.['stop'] !== undefined;\n}\n\nexport interface ImputeTransform extends ImputeParams {\n /**\n * The data field for which the missing values should be imputed.\n */\n impute: FieldName;\n\n /**\n * A key field that uniquely identifies data objects within a group.\n * Missing key values (those occurring in the data but not in the current group) will be imputed.\n */\n key: FieldName;\n\n /**\n * An optional array of fields by which to group the values.\n * Imputation will then be performed on a per-group basis.\n */\n groupby?: FieldName[];\n}\n\nexport interface FlattenTransform {\n /**\n * An array of one or more data fields containing arrays to flatten.\n * If multiple fields are specified, their array values should have a parallel structure, ideally with the same length.\n * If the lengths of parallel arrays do not match,\n * the longest array will be used with `null` values added for missing entries.\n */\n flatten: FieldName[];\n\n /**\n * The output field names for extracted array values.\n *\n * __Default value:__ The field name of the corresponding array field\n */\n as?: FieldName[];\n}\n\nexport interface SampleTransform {\n /**\n * The maximum number of data objects to include in the sample.\n *\n * __Default value:__ `1000`\n */\n sample: number;\n}\n\nexport interface LookupBase {\n /**\n * Key in data to lookup.\n */\n key: FieldName;\n /**\n * Fields in foreign data or selection to lookup.\n * If not specified, the entire object is queried.\n */\n fields?: FieldName[];\n}\n\nexport interface LookupData extends LookupBase {\n /**\n * Secondary data source to lookup in.\n */\n data: Data;\n}\n\nexport interface LookupSelection extends LookupBase {\n /**\n * Selection name to look up.\n */\n selection: string;\n}\n\nexport interface LookupTransform {\n /**\n * Key in primary data source.\n */\n lookup: string;\n\n /**\n * The output fields on which to store the looked up data values.\n *\n * For data lookups, this property may be left blank if `from.fields`\n * has been specified (those field names will be used); if `from.fields`\n * has not been specified, `as` must be a string.\n *\n * For selection lookups, this property is optional: if unspecified,\n * looked up values will be stored under a property named for the selection;\n * and if specified, it must correspond to `from.fields`.\n */\n as?: FieldName | FieldName[];\n\n /**\n * The default value to use if lookup fails.\n *\n * __Default value:__ `null`\n */\n default?: string;\n\n /**\n * Data source or selection for secondary data reference.\n */\n from: LookupData | LookupSelection;\n}\n\nexport function isLookup(t: Transform): t is LookupTransform {\n return 'lookup' in t;\n}\n\nexport function isLookupData(from: LookupData | LookupSelection): from is LookupData {\n return 'data' in from;\n}\n\nexport function isLookupSelection(from: LookupData | LookupSelection): from is LookupData {\n return 'selection' in from;\n}\n\nexport interface FoldTransform {\n /**\n * An array of data fields indicating the properties to fold.\n */\n fold: FieldName[];\n\n /**\n * The output field names for the key and value properties produced by the fold transform.\n * __Default value:__ `[\"key\", \"value\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport interface PivotTransform {\n /**\n * The data field to pivot on. The unique values of this field become new field names in the output stream.\n */\n pivot: FieldName;\n\n /**\n * The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields.\n */\n value: FieldName;\n\n /**\n * The optional data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * An optional parameter indicating the maximum number of pivoted fields to generate.\n * The default (`0`) applies no limit. The pivoted `pivot` names are sorted in ascending order prior to enforcing the limit.\n * __Default value:__ `0`\n */\n limit?: number;\n\n /**\n * The aggregation operation to apply to grouped `value` field values.\n * __Default value:__ `sum`\n */\n op?: string;\n}\n\nexport function isPivot(t: Transform): t is PivotTransform {\n return 'pivot' in t;\n}\n\nexport interface DensityTransform {\n /**\n * The data field for which to perform density estimation.\n */\n density: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * A boolean flag indicating whether to produce density estimates (false) or cumulative density estimates (true).\n *\n * __Default value:__ `false`\n */\n cumulative?: boolean;\n\n /**\n * A boolean flag indicating if the output values should be probability estimates (false) or smoothed counts (true).\n *\n * __Default value:__ `false`\n */\n counts?: boolean;\n\n /**\n * The bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott’s rule.\n */\n bandwidth?: number;\n\n /**\n * A [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field.\n */\n extent?: [number, number];\n\n /**\n * The minimum number of samples to take along the extent domain for plotting the density.\n *\n * __Default value:__ `25`\n */\n minsteps?: number;\n\n /**\n * The maximum number of samples to take along the extent domain for plotting the density.\n *\n * __Default value:__ `200`\n */\n maxsteps?: number;\n\n /**\n * The exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities.\n */\n steps?: number;\n\n /**\n * The output fields for the sample value and corresponding density estimate.\n *\n * __Default value:__ `[\"value\", \"density\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isDensity(t: Transform): t is DensityTransform {\n return 'density' in t;\n}\n\nexport interface QuantileTransform {\n /**\n * The data field for which to perform quantile estimation.\n */\n quantile: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the *step* parameter will be used.\n */\n probs?: number[];\n\n /**\n * A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the *probs* parameter is not provided.\n */\n step?: number;\n\n /**\n * The output field names for the probability and quantile values.\n *\n * __Default value:__ `[\"prob\", \"value\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isQuantile(t: Transform): t is QuantileTransform {\n return 'quantile' in t;\n}\n\nexport interface RegressionTransform {\n /**\n * The data field of the dependent variable to predict.\n */\n regression: FieldName;\n\n /**\n * The data field of the independent variable to use a predictor.\n */\n on: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * The functional form of the regression model. One of `\"linear\"`, `\"log\"`, `\"exp\"`, `\"pow\"`, `\"quad\"`, or `\"poly\"`.\n *\n * __Default value:__ `\"linear\"`\n */\n method?: 'linear' | 'log' | 'exp' | 'pow' | 'quad' | 'poly';\n\n /**\n * The polynomial order (number of coefficients) for the 'poly' method.\n *\n * __Default value:__ `3`\n */\n order?: number;\n\n /**\n * A [min, max] domain over the independent (x) field for the starting and ending points of the generated trend line.\n */\n extent?: [number, number];\n\n /**\n * A boolean flag indicating if the transform should return the regression model parameters (one object per group), rather than trend line points.\n * The resulting objects include a `coef` array of fitted coefficient values (starting with the intercept term and then including terms of increasing order)\n * and an `rSquared` value (indicating the total variance explained by the model).\n *\n * __Default value:__ `false`\n */\n params?: boolean;\n\n /**\n * The output field names for the smoothed points generated by the regression transform.\n *\n * __Default value:__ The field names of the input x and y values.\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isRegression(t: Transform): t is RegressionTransform {\n return 'regression' in t;\n}\n\nexport interface LoessTransform {\n /**\n * The data field of the dependent variable to smooth.\n */\n loess: FieldName;\n\n /**\n * The data field of the independent variable to use a predictor.\n */\n on: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * A bandwidth parameter in the range `[0, 1]` that determines the amount of smoothing.\n *\n * __Default value:__ `0.3`\n */\n bandwidth?: number;\n\n /**\n * The output field names for the smoothed points generated by the loess transform.\n *\n * __Default value:__ The field names of the input x and y values.\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isLoess(t: Transform): t is LoessTransform {\n return 'loess' in t;\n}\n\nexport function isSample(t: Transform): t is SampleTransform {\n return 'sample' in t;\n}\n\nexport function isWindow(t: Transform): t is WindowTransform {\n return 'window' in t;\n}\n\nexport function isJoinAggregate(t: Transform): t is JoinAggregateTransform {\n return 'joinaggregate' in t;\n}\n\nexport function isFlatten(t: Transform): t is FlattenTransform {\n return 'flatten' in t;\n}\nexport function isCalculate(t: Transform): t is CalculateTransform {\n return 'calculate' in t;\n}\n\nexport function isBin(t: Transform): t is BinTransform {\n return 'bin' in t;\n}\n\nexport function isImpute(t: Transform): t is ImputeTransform {\n return 'impute' in t;\n}\n\nexport function isTimeUnit(t: Transform): t is TimeUnitTransform {\n return 'timeUnit' in t;\n}\n\nexport function isAggregate(t: Transform): t is AggregateTransform {\n return 'aggregate' in t;\n}\n\nexport function isStack(t: Transform): t is StackTransform {\n return 'stack' in t;\n}\n\nexport function isFold(t: Transform): t is FoldTransform {\n return 'fold' in t;\n}\n\nexport type Transform =\n | AggregateTransform\n | BinTransform\n | CalculateTransform\n | DensityTransform\n | FilterTransform\n | FlattenTransform\n | FoldTransform\n | ImputeTransform\n | JoinAggregateTransform\n | LoessTransform\n | LookupTransform\n | QuantileTransform\n | RegressionTransform\n | TimeUnitTransform\n | SampleTransform\n | StackTransform\n | WindowTransform\n | PivotTransform;\n\nexport function normalizeTransform(transform: Transform[]) {\n return transform.map(t => {\n if (isFilter(t)) {\n return {\n filter: normalizeLogicalComposition(t.filter, normalizePredicate)\n };\n }\n return t;\n });\n}\n","/**\n * Parse an event selector string.\n * Returns an array of event stream definitions.\n */\nexport default function(selector, source, marks) {\n DEFAULT_SOURCE = source || VIEW;\n MARKS = marks || DEFAULT_MARKS;\n return parseMerge(selector.trim()).map(parseSelector);\n}\n\nvar VIEW = 'view',\n LBRACK = '[',\n RBRACK = ']',\n LBRACE = '{',\n RBRACE = '}',\n COLON = ':',\n COMMA = ',',\n NAME = '@',\n GT = '>',\n ILLEGAL = /[[\\]{}]/,\n DEFAULT_SOURCE,\n MARKS,\n DEFAULT_MARKS = {\n '*': 1,\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n };\n\nfunction isMarkType(type) {\n return MARKS[type];\n}\n\nfunction find(s, i, endChar, pushChar, popChar) {\n var count = 0,\n n = s.length,\n c;\n for (; i= 0) --count;\n else if (pushChar && pushChar.indexOf(c) >= 0) ++count;\n }\n return i;\n}\n\nfunction parseMerge(s) {\n var output = [],\n start = 0,\n n = s.length,\n i = 0;\n\n while (i < n) {\n i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE);\n output.push(s.substring(start, i).trim());\n start = ++i;\n }\n\n if (output.length === 0) {\n throw 'Empty event selector: ' + s;\n }\n return output;\n}\n\nfunction parseSelector(s) {\n return s[0] === '['\n ? parseBetween(s)\n : parseStream(s);\n}\n\nfunction parseBetween(s) {\n var n = s.length,\n i = 1,\n b, stream;\n\n i = find(s, i, RBRACK, LBRACK, RBRACK);\n if (i === n) {\n throw 'Empty between selector: ' + s;\n }\n\n b = parseMerge(s.substring(1, i));\n if (b.length !== 2) {\n throw 'Between selector must have two elements: ' + s;\n }\n\n s = s.slice(i + 1).trim();\n if (s[0] !== GT) {\n throw 'Expected \\'>\\' after between selector: ' + s;\n }\n\n b = b.map(parseSelector);\n\n stream = parseSelector(s.slice(1).trim());\n if (stream.between) {\n return {\n between: b,\n stream: stream\n };\n } else {\n stream.between = b;\n }\n\n return stream;\n}\n\nfunction parseStream(s) {\n var stream = {source: DEFAULT_SOURCE},\n source = [],\n throttle = [0, 0],\n markname = 0,\n start = 0,\n n = s.length,\n i = 0, j,\n filter;\n\n // extract throttle from end\n if (s[n-1] === RBRACE) {\n i = s.lastIndexOf(LBRACE);\n if (i >= 0) {\n try {\n throttle = parseThrottle(s.substring(i+1, n-1));\n } catch (e) {\n throw 'Invalid throttle specification: ' + s;\n }\n s = s.slice(0, i).trim();\n n = s.length;\n } else throw 'Unmatched right brace: ' + s;\n i = 0;\n }\n\n if (!n) throw s;\n\n // set name flag based on first char\n if (s[0] === NAME) markname = ++i;\n\n // extract first part of multi-part stream selector\n j = find(s, i, COLON);\n if (j < n) {\n source.push(s.substring(start, j).trim());\n start = i = ++j;\n }\n\n // extract remaining part of stream selector\n i = find(s, i, LBRACK);\n if (i === n) {\n source.push(s.substring(start, n).trim());\n } else {\n source.push(s.substring(start, i).trim());\n filter = [];\n start = ++i;\n if (start === n) throw 'Unmatched left bracket: ' + s;\n }\n\n // extract filters\n while (i < n) {\n i = find(s, i, RBRACK);\n if (i === n) throw 'Unmatched left bracket: ' + s;\n filter.push(s.substring(start, i).trim());\n if (i < n-1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s;\n start = ++i;\n }\n\n // marshall event stream specification\n if (!(n = source.length) || ILLEGAL.test(source[n-1])) {\n throw 'Invalid event selector: ' + s;\n }\n\n if (n > 1) {\n stream.type = source[1];\n if (markname) {\n stream.markname = source[0].slice(1);\n } else if (isMarkType(source[0])) {\n stream.marktype = source[0];\n } else {\n stream.source = source[0];\n }\n } else {\n stream.type = source[0];\n }\n if (stream.type.slice(-1) === '!') {\n stream.consume = true;\n stream.type = stream.type.slice(0, -1);\n }\n if (filter != null) stream.filter = filter;\n if (throttle[0]) stream.throttle = throttle[0];\n if (throttle[1]) stream.debounce = throttle[1];\n\n return stream;\n}\n\nfunction parseThrottle(s) {\n var a = s.split(COMMA);\n if (!s.length || a.length > 2) throw s;\n return a.map(function(_) {\n var x = +_;\n if (x !== x) throw s;\n return x;\n });\n}\n","import {SignalRef} from 'vega';\nimport {array} from 'vega-util';\nimport {\n ChannelDef,\n ConditionalPredicate,\n ConditionalSelection,\n isConditionalDef,\n isConditionalSelection\n} from '../../../channeldef';\nimport {GuideEncodingConditionalValueDef} from '../../../guide';\nimport {VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {expression} from '../../predicate';\nimport {parseSelectionPredicate} from '../../selection/parse';\nimport {UnitModel} from '../../unit';\n\n/**\n * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition\n * or a simple mixin if channel def has no condition.\n */\nexport function wrapCondition(\n model: UnitModel,\n channelDef: CD,\n vgChannel: string,\n refFn: (cDef: CD) => VgValueRef\n): VgEncodeEntry {\n const condition = isConditionalDef(channelDef) && channelDef.condition;\n const valueRef = refFn(channelDef);\n if (condition) {\n const conditions = array(condition);\n const vgConditions = conditions.map(c => {\n const conditionValueRef = refFn(c);\n const test = isConditionalSelection(c)\n ? parseSelectionPredicate(model, (c as ConditionalSelection).selection) // FIXME: remove casting once TS is no longer dumb about it\n : expression(model, (c as ConditionalPredicate).test); // FIXME: remove casting once TS is no longer dumb about it\n return {\n test,\n ...conditionValueRef\n };\n });\n return {\n [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])]\n };\n } else {\n return valueRef !== undefined ? {[vgChannel]: valueRef} : {};\n }\n}\n","import {getFormatMixins, isFieldOrDatumDef, isValueDef} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {Encoding} from '../../../encoding';\nimport {VgValueRef} from '../../../vega.schema';\nimport {signalOrValueRef} from '../../common';\nimport {formatSignalRef} from '../../format';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\n\nexport function text(model: UnitModel, channel: 'text' | 'href' | 'url' | 'description' = 'text') {\n const channelDef = model.encoding[channel];\n return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config));\n}\n\nexport function textRef(\n channelDef: Encoding['text' | 'tooltip'],\n config: Config,\n expr: 'datum' | 'datum.datum' = 'datum'\n): VgValueRef {\n // text\n if (channelDef) {\n if (isValueDef(channelDef)) {\n return signalOrValueRef(channelDef.value);\n }\n if (isFieldOrDatumDef(channelDef)) {\n const {format, formatType} = getFormatMixins(channelDef);\n return formatSignalRef({fieldOrDatumDef: channelDef, format, formatType, expr, config});\n }\n }\n return undefined;\n}\n","import {array, isArray, isObject, isString} from 'vega-util';\nimport {isBinned} from '../../../bin';\nimport {getMainRangeChannel, isXorY, Channel} from '../../../channel';\nimport {\n defaultTitle,\n getFieldDef,\n getFormatMixins,\n hasConditionalFieldDef,\n isFieldDef,\n isTypedFieldDef,\n SecondaryFieldDef,\n TypedFieldDef,\n vgField\n} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {Encoding, forEach} from '../../../encoding';\nimport {StackProperties} from '../../../stack';\nimport {entries} from '../../../util';\nimport {isSignalRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\nimport {binFormatExpression, formatSignalRef} from '../../format';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\nimport {textRef} from './text';\n\nexport function tooltip(model: UnitModel, opt: {reactiveGeom?: boolean} = {}) {\n const {encoding, markDef, config, stack} = model;\n const channelDef = encoding.tooltip;\n if (isArray(channelDef)) {\n return {tooltip: tooltipRefForEncoding({tooltip: channelDef}, stack, config, opt)};\n } else {\n const datum = opt.reactiveGeom ? 'datum.datum' : 'datum';\n return wrapCondition(model, channelDef, 'tooltip', cDef => {\n // use valueRef based on channelDef first\n const tooltipRefFromChannelDef = textRef(cDef, config, datum);\n if (tooltipRefFromChannelDef) {\n return tooltipRefFromChannelDef;\n }\n\n if (cDef === null) {\n // Allow using encoding.tooltip = null to disable tooltip\n return undefined;\n }\n\n let markTooltip = getMarkPropOrConfig('tooltip', markDef, config);\n\n if (markTooltip === true) {\n markTooltip = {content: 'encoding'};\n }\n\n if (isString(markTooltip)) {\n return {value: markTooltip};\n } else if (isObject(markTooltip)) {\n // `tooltip` is `{fields: 'encodings' | 'fields'}`\n if (isSignalRef(markTooltip)) {\n return markTooltip;\n } else if (markTooltip.content === 'encoding') {\n return tooltipRefForEncoding(encoding, stack, config, opt);\n } else {\n return {signal: datum};\n }\n }\n\n return undefined;\n });\n }\n}\n\nexport function tooltipData(\n encoding: Encoding,\n stack: StackProperties,\n config: Config,\n {reactiveGeom}: {reactiveGeom?: boolean} = {}\n) {\n const toSkip = {};\n const expr = reactiveGeom ? 'datum.datum' : 'datum';\n const tuples: {channel: Channel; key: string; value: string}[] = [];\n\n function add(fDef: TypedFieldDef | SecondaryFieldDef, channel: Channel) {\n const mainChannel = getMainRangeChannel(channel);\n\n const fieldDef: TypedFieldDef = isTypedFieldDef(fDef)\n ? fDef\n : {\n ...fDef,\n type: (encoding[mainChannel] as TypedFieldDef).type // for secondary field def, copy type from main channel\n };\n\n const title = fieldDef.title || defaultTitle(fieldDef, config);\n const key = array(title).join(', ');\n\n let value: string;\n\n if (isXorY(channel)) {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = getFieldDef(encoding[channel2]);\n\n if (isBinned(fieldDef.bin) && fieldDef2) {\n const startField = vgField(fieldDef, {expr});\n const endField = vgField(fieldDef2, {expr});\n const {format, formatType} = getFormatMixins(fieldDef);\n value = binFormatExpression(startField, endField, format, formatType, config);\n toSkip[channel2] = true;\n } else if (stack && stack.fieldChannel === channel && stack.offset === 'normalize') {\n const {format, formatType} = getFormatMixins(fieldDef);\n value = formatSignalRef({fieldOrDatumDef: fieldDef, format, formatType, expr, config, normalizeStack: true})\n .signal;\n }\n }\n\n value = value ?? textRef(fieldDef, config, expr).signal;\n\n tuples.push({channel, key, value});\n }\n\n forEach(encoding, (channelDef, channel) => {\n if (isFieldDef(channelDef)) {\n add(channelDef, channel);\n } else if (hasConditionalFieldDef(channelDef)) {\n add(channelDef.condition, channel);\n }\n });\n\n const out = {};\n for (const {channel, key, value} of tuples) {\n if (!toSkip[channel] && !out[key]) {\n out[key] = value;\n }\n }\n\n return out;\n}\n\nexport function tooltipRefForEncoding(\n encoding: Encoding,\n stack: StackProperties,\n config: Config,\n {reactiveGeom}: {reactiveGeom?: boolean} = {}\n) {\n const data = tooltipData(encoding, stack, config, {reactiveGeom});\n\n const keyValues = entries(data).map(({key, value}) => `\"${key}\": ${value}`);\n return keyValues.length > 0 ? {signal: `{${keyValues.join(', ')}}`} : undefined;\n}\n","import {entries, isEmpty} from '../../../util';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {VG_MARK_INDEX} from './../../../vega.schema';\nimport {UnitModel} from './../../unit';\nimport {wrapCondition} from './conditional';\nimport {textRef} from './text';\nimport {tooltipData} from './tooltip';\n\nexport function aria(model: UnitModel) {\n const {markDef, config} = model;\n\n const enableAria = getMarkPropOrConfig('aria', markDef, config);\n\n // We can ignore other aria properties if ariaHidden is true.\n if (enableAria === false) {\n // getMarkGroups sets aria to false already so we don't have to set it in the encode block\n return {};\n }\n\n return {\n ...(enableAria ? {aria: enableAria} : {}),\n ...ariaRoleDescription(model),\n ...description(model)\n };\n}\n\nfunction ariaRoleDescription(model: UnitModel) {\n const {mark, markDef, config} = model;\n\n if (config.aria === false) {\n return {};\n }\n\n const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config);\n\n if (ariaRoleDesc != null) {\n return {ariaRoleDescription: {value: ariaRoleDesc}};\n }\n\n return mark in VG_MARK_INDEX ? {} : {ariaRoleDescription: {value: mark}};\n}\n\nexport function description(model: UnitModel) {\n const {encoding, markDef, config, stack} = model;\n const channelDef = encoding.description;\n\n if (channelDef) {\n return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config));\n }\n\n // Use default from mark def or config if defined.\n // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here.\n const descriptionValue = getMarkPropOrConfig('description', markDef, config);\n if (descriptionValue != null) {\n return {\n description: signalOrValueRef(descriptionValue)\n };\n }\n\n if (config.aria === false) {\n return {};\n }\n\n const data = tooltipData(encoding, stack, config);\n\n if (isEmpty(data)) {\n return undefined;\n }\n\n return {\n description: {\n signal: entries(data)\n .map(({key, value}, index) => `\"${index > 0 ? '; ' : ''}${key}: \" + (${value})`)\n .join(' + ')\n }\n };\n}\n","import {SignalRef} from 'vega';\nimport {NonPositionScaleChannel} from '../../../channel';\nimport {Value} from '../../../channeldef';\nimport {VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\nimport * as ref from './valueref';\n\n/**\n * Return encode for non-positional channels with scales. (Text doesn't have scale.)\n */\nexport function nonPosition(\n channel: NonPositionScaleChannel,\n model: UnitModel,\n opt: {\n defaultValue?: Value | SignalRef;\n vgChannel?: VgEncodeChannel;\n defaultRef?: VgValueRef;\n } = {}\n): VgEncodeEntry {\n const {markDef, encoding, config} = model;\n const {vgChannel} = opt;\n let {defaultRef, defaultValue} = opt;\n\n if (defaultRef === undefined) {\n // prettier-ignore\n defaultValue = defaultValue ?? getMarkPropOrConfig(channel, markDef, config, {vgChannel, ignoreVgConfig: true});\n\n if (defaultValue !== undefined) {\n defaultRef = signalOrValueRef(defaultValue);\n }\n }\n\n const channelDef = encoding[channel];\n\n return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => {\n return ref.midPoint({\n channel,\n channelDef: cDef,\n markDef,\n config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null, // No need to provide stack for non-position as it does not affect mid point\n defaultRef\n });\n });\n}\n","import * as log from '../../../log';\nimport {contains} from '../../../util';\nimport {VgEncodeEntry} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {nonPosition} from './nonposition';\n\nexport function color(model: UnitModel, opt: {filled: boolean | undefined} = {filled: undefined}): VgEncodeEntry {\n const {markDef, encoding, config} = model;\n const {type: markType} = markDef;\n\n // Allow filled to be overridden (for trail's \"filled\")\n const filled = opt.filled ?? getMarkPropOrConfig('filled', markDef, config);\n\n const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType)\n ? 'transparent'\n : undefined;\n\n const defaultFill =\n getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, {vgChannel: 'fill'}) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === true && 'color'] ??\n // If there is no fill, always fill symbols, bar, geoshape\n // with transparent fills https://github.com/vega/vega-lite/issues/1316\n transparentIfNeeded;\n\n const defaultStroke =\n getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, {vgChannel: 'stroke'}) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === false && 'color'];\n\n const colorVgChannel = filled ? 'fill' : 'stroke';\n\n const fillStrokeMarkDefAndConfig: VgEncodeEntry = {\n ...(defaultFill ? {fill: signalOrValueRef(defaultFill)} : {}),\n ...(defaultStroke ? {stroke: signalOrValueRef(defaultStroke)} : {})\n };\n\n if (markDef.color && (filled ? markDef.fill : markDef.stroke)) {\n log.warn(log.message.droppingColor('property', {fill: 'fill' in markDef, stroke: 'stroke' in markDef}));\n }\n\n return {\n ...fillStrokeMarkDefAndConfig,\n ...nonPosition('color', model, {\n vgChannel: colorVgChannel,\n defaultValue: filled ? defaultFill : defaultStroke\n }),\n ...nonPosition('fill', model, {\n // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding\n defaultValue: encoding.fill ? defaultFill : undefined\n }),\n ...nonPosition('stroke', model, {\n // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding\n defaultValue: encoding.stroke ? defaultStroke : undefined\n })\n };\n}\n","/**\n * Utility files for producing Vega ValueRef for marks\n */\nimport {SignalRef} from 'vega-typings/types';\nimport {getOffsetChannel, PolarPositionChannel, PositionChannel} from '../../../channel';\nimport {MarkDef} from '../../../mark';\n\nexport function getOffset(channel: PositionChannel | PolarPositionChannel, markDef: MarkDef): number | SignalRef {\n const offsetChannel = getOffsetChannel(channel);\n\n // TODO: in the future read from encoding channel too\n const markDefOffsetValue = markDef[offsetChannel];\n if (markDefOffsetValue) {\n return markDefOffsetValue;\n }\n\n return undefined;\n}\n","import {\n getMainRangeChannel,\n getSecondaryRangeChannel,\n getSizeChannel,\n getVgPositionChannel,\n isXorY,\n PolarPositionChannel,\n PositionChannel\n} from '../../../channel';\nimport {getBand, isFieldDef, isFieldOrDatumDef, TypedFieldDef} from '../../../channeldef';\nimport {ScaleType} from '../../../scale';\nimport {contains} from '../../../util';\nimport {VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\nimport {UnitModel} from '../../unit';\nimport {getOffset} from './offset';\nimport * as ref from './valueref';\n\n/**\n * Return encode for point (non-band) position channels.\n */\nexport function pointPosition(\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel,\n {\n defaultPos,\n vgChannel,\n isMidPoint\n }: {\n defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null;\n vgChannel?: 'x' | 'y' | 'xc' | 'yc';\n isMidPoint?: boolean;\n }\n) {\n const {encoding, markDef, config, stack} = model;\n\n const channelDef = encoding[channel];\n const channel2Def = encoding[getSecondaryRangeChannel(channel)];\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n\n const offset = getOffset(channel, markDef);\n\n // Get default position or position from mark def\n const defaultRef = pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n });\n\n const valueRef =\n !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude)\n ? // use geopoint output if there are lat/long and there is no point position overriding lat/long.\n {field: model.getName(channel)}\n : positionRef({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n isMidPoint,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef\n });\n\n return valueRef ? {[vgChannel || channel]: valueRef} : undefined;\n}\n\n// TODO: we need to find a way to refactor these so that scaleName is a part of scale\n// but that's complicated. For now, this is a huge step moving forward.\n\n/**\n * @return Vega ValueRef for normal x- or y-position without projection\n */\nexport function positionRef(\n params: ref.MidPointParams & {\n channel: 'x' | 'y' | 'radius' | 'theta';\n isMidPoint?: boolean;\n }\n): VgValueRef | VgValueRef[] {\n const {channel, channelDef, isMidPoint, scaleName, stack, offset, markDef, config} = params;\n\n // This isn't a part of midPoint because we use midPoint for non-position too\n if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) {\n if (isFieldDef(channelDef)) {\n const band = getBand({\n channel,\n fieldDef: channelDef,\n isMidPoint,\n markDef,\n stack,\n config\n });\n if (band !== undefined) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef as TypedFieldDef, // positionRef always have type\n startSuffix: 'start',\n band,\n offset\n });\n }\n }\n // x or y use stack_end so that stacked line's point mark use stack_end too.\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'end'}, {offset});\n }\n\n return ref.midPointRefWithPositionInvalidTest(params);\n}\n\nexport function pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n}: {\n model: UnitModel;\n defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null;\n channel: PositionChannel | PolarPositionChannel;\n scaleName: string;\n scale: ScaleComponent;\n}): () => VgValueRef {\n const {markDef, config} = model;\n return () => {\n const mainChannel = getMainRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n\n const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, {vgChannel});\n if (definedValueOrConfig !== undefined) {\n return ref.widthHeightValueOrSignalRef(channel, definedValueOrConfig);\n }\n\n switch (defaultPos) {\n case 'zeroOrMin':\n case 'zeroOrMax':\n if (scaleName) {\n const scaleType = scale.get('type');\n if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) {\n // Log scales cannot have zero.\n // Zero in time scale is arbitrary, and does not affect ratio.\n // (Time is an interval level of measurement, not ratio).\n // See https://en.wikipedia.org/wiki/Level_of_measurement for more info.\n } else {\n if (scale.domainDefinitelyIncludesZero()) {\n return {\n scale: scaleName,\n value: 0\n };\n }\n }\n }\n\n if (defaultPos === 'zeroOrMin') {\n return mainChannel === 'y' ? {field: {group: 'height'}} : {value: 0};\n } else {\n // zeroOrMax\n switch (mainChannel) {\n case 'radius':\n // max of radius is min(width, height) / 2\n return {\n signal: `min(${model.width.signal},${model.height.signal})/2`\n };\n case 'theta':\n return {signal: '2*PI'};\n case 'x':\n return {field: {group: 'width'}};\n case 'y':\n return {value: 0};\n }\n }\n break;\n case 'mid': {\n const sizeRef = model[getSizeChannel(channel)];\n return {...sizeRef, mult: 0.5};\n }\n }\n // defaultPos === null\n return undefined;\n };\n}\n","import {Align} from 'vega';\nimport {getVgPositionChannel} from '../../../channel';\nimport {Config} from '../../../config';\nimport {MarkDef} from '../../../mark';\nimport {VgEncodeChannel} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\n\nconst ALIGNED_X_CHANNEL: Record = {\n left: 'x',\n center: 'xc',\n right: 'x2'\n};\n\nconst BASELINED_Y_CHANNEL = {\n top: 'y',\n middle: 'yc',\n bottom: 'y2'\n};\n\nexport function vgAlignedPositionChannel(\n channel: 'x' | 'y' | 'radius' | 'theta',\n markDef: MarkDef,\n config: Config,\n defaultAlign: 'top' | 'middle' = 'middle'\n) {\n if (channel === 'radius' || channel === 'theta') {\n return getVgPositionChannel(channel);\n }\n const alignChannel = channel === 'x' ? 'align' : 'baseline';\n const align = getMarkPropOrConfig(alignChannel, markDef, config);\n if (channel === 'x') {\n return ALIGNED_X_CHANNEL[align || (defaultAlign === 'top' ? 'left' : 'center')];\n } else {\n return BASELINED_Y_CHANNEL[align || defaultAlign];\n }\n}\n","import {getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel} from '../../../channel';\nimport {isFieldOrDatumDef} from '../../../channeldef';\nimport {MarkConfig} from '../../../mark';\nimport {VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkStyleConfig} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {getOffset} from './offset';\nimport {vgAlignedPositionChannel} from './position-align';\nimport {pointPosition, pointPositionDefaultRef} from './position-point';\nimport * as ref from './valueref';\n\n/**\n * Utility for area/rule position, which can be either point or range. (One of the axes should be point and the other should be range.)\n */\nexport function pointOrRangePosition(\n channel: 'x' | 'y',\n model: UnitModel,\n {\n defaultPos,\n defaultPos2,\n range\n }: {\n defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid';\n defaultPos2: 'zeroOrMin' | 'zeroOrMax';\n range: boolean;\n }\n) {\n if (range) {\n return rangePosition(channel, model, {defaultPos, defaultPos2});\n }\n return pointPosition(channel, model, {defaultPos});\n}\n\nexport function rangePosition(\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel,\n {\n defaultPos,\n defaultPos2\n }: {\n defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid';\n defaultPos2: 'zeroOrMin' | 'zeroOrMax';\n }\n): VgEncodeEntry {\n const {markDef, config} = model;\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n\n const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2);\n\n const vgChannel = pos2Mixins[sizeChannel]\n ? // If there is width/height, we need to position the marks based on the alignment.\n vgAlignedPositionChannel(channel, markDef, config)\n : // Otherwise, make sure to apply to the right Vg Channel (for arc mark)\n getVgPositionChannel(channel);\n\n return {\n ...pointPosition(channel, model, {defaultPos, vgChannel}),\n ...pos2Mixins\n };\n}\n\n/**\n * Return encode for x2, y2.\n * If channel is not specified, return one channel based on orientation.\n */\nfunction pointPosition2OrSize(\n model: UnitModel,\n defaultPos: 'zeroOrMin' | 'zeroOrMax',\n channel: 'x2' | 'y2' | 'radius2' | 'theta2'\n) {\n const {encoding, mark, markDef, stack, config} = model;\n\n const baseChannel = getMainRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n\n const channelDef = encoding[baseChannel];\n const scaleName = model.scaleName(baseChannel);\n const scale = model.getScaleComponent(baseChannel);\n\n const offset =\n channel in encoding || channel in markDef\n ? getOffset(channel, model.markDef)\n : getOffset(baseChannel, model.markDef);\n\n if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) {\n // use geopoint output if there are lat2/long2 and there is no point position2 overriding lat2/long2.\n return {[vgChannel]: {field: model.getName(channel)}};\n }\n\n const valueRef = position2Ref({\n channel,\n channelDef,\n channel2Def: encoding[channel],\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: undefined\n });\n\n if (valueRef !== undefined) {\n return {[vgChannel]: valueRef};\n }\n\n // TODO: check width/height encoding here once we add them\n\n // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence:\n // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark)\n\n return (\n position2orSize(channel, markDef) ||\n position2orSize(channel, {\n [channel]: getMarkStyleConfig(channel, markDef, config.style),\n [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style)\n }) ||\n position2orSize(channel, config[mark]) ||\n position2orSize(channel, config.mark) || {\n [vgChannel]: pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n })()\n }\n );\n}\n\nexport function position2Ref({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef\n}: ref.MidPointParams & {\n channel: 'x2' | 'y2' | 'radius2' | 'theta2';\n}): VgValueRef | VgValueRef[] {\n if (\n isFieldOrDatumDef(channelDef) &&\n stack &&\n // If fieldChannel is X and channel is X2 (or Y and Y2)\n channel.charAt(0) === stack.fieldChannel.charAt(0)\n ) {\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'start'}, {offset});\n }\n return ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: channel2Def,\n scaleName,\n scale,\n stack,\n markDef,\n config,\n offset,\n defaultRef\n });\n}\n\nfunction position2orSize(channel: 'x2' | 'y2' | 'radius2' | 'theta2', markDef: MarkConfig) {\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n if (markDef[vgChannel] !== undefined) {\n return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[vgChannel])};\n } else if (markDef[channel] !== undefined) {\n return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel])};\n } else if (markDef[sizeChannel]) {\n return {[sizeChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[sizeChannel])};\n }\n return undefined;\n}\n","import {SignalRef} from 'vega';\nimport {isArray, isNumber} from 'vega-util';\nimport {isBinned, isBinning, isBinParams} from '../../../bin';\nimport {\n getSecondaryRangeChannel,\n getSizeChannel,\n getVgPositionChannel,\n isPolarPositionChannel,\n isXorY,\n PolarPositionChannel,\n PositionChannel\n} from '../../../channel';\nimport {getBand, isFieldDef, isFieldOrDatumDef, TypedFieldDef, vgField} from '../../../channeldef';\nimport {Config, DEFAULT_STEP, getViewConfigDiscreteStep} from '../../../config';\nimport {Encoding} from '../../../encoding';\nimport * as log from '../../../log';\nimport {Mark, MarkDef} from '../../../mark';\nimport {hasDiscreteDomain, ScaleType} from '../../../scale';\nimport {getFirstDefined} from '../../../util';\nimport {isSignalRef, isVgRangeStep, VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrStringValue} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\nimport {UnitModel} from '../../unit';\nimport {nonPosition} from './nonposition';\nimport {getOffset} from './offset';\nimport {vgAlignedPositionChannel} from './position-align';\nimport {pointPositionDefaultRef} from './position-point';\nimport {rangePosition} from './position-range';\nimport * as ref from './valueref';\n\nexport function rectPosition(\n model: UnitModel,\n channel: 'x' | 'y' | 'theta' | 'radius',\n mark: 'bar' | 'rect' | 'image' | 'arc'\n): VgEncodeEntry {\n const {config, encoding, markDef, stack} = model;\n\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const channelDef = encoding[channel];\n const channelDef2 = encoding[channel2];\n\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const scaleName = model.scaleName(channel);\n\n const orient = markDef.orient;\n const hasSizeDef =\n encoding[sizeChannel] ?? encoding.size ?? getMarkPropOrConfig('size', markDef, config, {vgChannel: sizeChannel});\n\n const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal');\n\n // x, x2, and width -- we must specify two of these in all conditions\n if (\n isFieldDef(channelDef) &&\n (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) &&\n !hasSizeDef &&\n !hasDiscreteDomain(scaleType)\n ) {\n const band = getBand({channel, fieldDef: channelDef, stack, markDef, config});\n const axis = model.component.axes[channel]?.[0];\n const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5\n\n return rectBinPosition({\n fieldDef: channelDef,\n fieldDef2: channelDef2,\n channel,\n markDef,\n scaleName,\n band,\n axisTranslate,\n spacing: isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) : undefined,\n reverse: scale.get('reverse'),\n config\n });\n } else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) {\n return positionAndSize(mark, channelDef, channel, model);\n } else {\n return rangePosition(channel, model, {defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin'});\n }\n}\nfunction defaultSizeRef(\n mark: 'bar' | 'rect' | 'image' | 'arc',\n sizeChannel: 'width' | 'height',\n scaleName: string,\n scale: ScaleComponent,\n config: Config,\n band: number | true\n): VgValueRef {\n if (scale) {\n const scaleType = scale.get('type');\n if (scaleType === 'point' || scaleType === 'band') {\n if (config[mark].discreteBandSize !== undefined) {\n return {value: config[mark].discreteBandSize};\n }\n if (scaleType === ScaleType.POINT) {\n const scaleRange = scale.get('range');\n if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return {value: scaleRange.step - 2};\n }\n return {value: DEFAULT_STEP - 2};\n } else {\n // BAND\n return {scale: scaleName, band};\n }\n } else {\n // continuous scale\n return {value: config[mark].continuousBandSize};\n }\n }\n // No Scale\n\n const step = getViewConfigDiscreteStep(config.view, sizeChannel);\n\n const value = getFirstDefined(\n // No scale is like discrete bar (with one item)\n config[mark].discreteBandSize,\n step - 2\n );\n return value !== undefined ? {value} : undefined;\n}\n\n/**\n * Output position encoding and its size encoding for continuous, point, and band scales.\n */\nfunction positionAndSize(\n mark: 'bar' | 'rect' | 'image' | 'arc',\n fieldDef: Encoding['x' | 'y' | 'theta' | 'radius'],\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel\n) {\n const {markDef, encoding, config, stack} = model;\n const orient = markDef.orient;\n\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n const vgSizeChannel = getSizeChannel(channel);\n const channel2 = getSecondaryRangeChannel(channel);\n\n // use \"size\" channel for bars, if there is orient and the channel matches the right orientation\n const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x');\n\n const sizeFromMarkOrConfig = getMarkPropOrConfig(useVlSizeChannel ? 'size' : vgSizeChannel, markDef, config, {\n vgChannel: vgSizeChannel\n });\n\n // Use size encoding / mark property / config if it exists\n let sizeMixins;\n if (encoding.size || sizeFromMarkOrConfig !== undefined) {\n if (useVlSizeChannel) {\n sizeMixins = nonPosition('size', model, {vgChannel: vgSizeChannel, defaultValue: sizeFromMarkOrConfig});\n } else {\n log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type));\n }\n }\n\n // Otherwise, apply default value\n const band = (isFieldOrDatumDef(fieldDef) ? getBand({channel, fieldDef, markDef, stack, config}) : undefined) ?? 1;\n sizeMixins = sizeMixins || {[vgSizeChannel]: defaultSizeRef(mark, vgSizeChannel, scaleName, scale, config, band)};\n\n /*\n Band scales with size value and all point scales, use xc/yc + band=0.5\n\n Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2.\n In this case, size_band is the band specified in the x/y-encoding.\n By default band is 1, so `(1 - band) / 2` = 0.\n If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2\n */\n\n const center = scale?.get('type') !== 'band' || !('band' in sizeMixins[vgSizeChannel]);\n\n const vgChannel = vgAlignedPositionChannel(channel, markDef, config, center ? 'middle' : 'top');\n const offset = getOffset(channel, markDef);\n\n const posRef = ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: fieldDef,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: pointPositionDefaultRef({model, defaultPos: 'mid', channel, scaleName, scale}),\n band: center ? 0.5 : (1 - band) / 2\n });\n\n if (vgSizeChannel) {\n return {[vgChannel]: posRef, ...sizeMixins};\n } else {\n // otherwise, we must simulate size by setting position2 = position + size\n // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth)\n const vgChannel2 = getVgPositionChannel(channel2);\n const sizeRef = sizeMixins[vgSizeChannel];\n const sizeOffset = offset ? {...sizeRef, offset} : sizeRef;\n return {\n [vgChannel]: posRef,\n\n // posRef might be an array that wraps position invalid test\n [vgChannel2]: isArray(posRef)\n ? [posRef[0], {...posRef[1], offset: sizeOffset}]\n : {\n ...posRef,\n offset: sizeOffset\n }\n };\n }\n}\n\nfunction getBinSpacing(\n channel: PositionChannel | PolarPositionChannel,\n spacing: number,\n reverse: boolean | SignalRef,\n translate: number | SignalRef,\n offset: number | SignalRef\n) {\n if (isPolarPositionChannel(channel)) {\n return 0;\n }\n\n const spacingOffset = channel === 'x' || channel === 'y2' ? -spacing / 2 : spacing / 2;\n\n if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(translate)) {\n const reverseExpr = signalOrStringValue(reverse);\n const offsetExpr = signalOrStringValue(offset);\n const translateExpr = signalOrStringValue(translate);\n\n const t = translateExpr ? `${translateExpr} + ` : '';\n const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : '';\n const o = offsetExpr ? `(${offsetExpr} + ${spacingOffset})` : spacingOffset;\n\n return {\n signal: t + r + o\n };\n } else {\n offset = offset || 0;\n return translate + (reverse ? -offset - spacingOffset : +offset + spacingOffset);\n }\n}\n\nexport function rectBinPosition({\n fieldDef,\n fieldDef2,\n channel,\n band,\n scaleName,\n markDef,\n spacing = 0,\n axisTranslate,\n reverse,\n config\n}: {\n fieldDef: TypedFieldDef;\n fieldDef2?: Encoding['x2' | 'y2'];\n channel: 'x' | 'y' | 'theta' | 'radius';\n band: number;\n scaleName: string;\n markDef: MarkDef;\n spacing?: number;\n axisTranslate: number | SignalRef;\n reverse: boolean | SignalRef;\n config: Config;\n}) {\n const channel2 = getSecondaryRangeChannel(channel);\n\n const vgChannel = getVgPositionChannel(channel);\n const vgChannel2 = getVgPositionChannel(channel2);\n\n const offset = getOffset(channel, markDef);\n\n if (isBinning(fieldDef.bin) || fieldDef.timeUnit) {\n return {\n [vgChannel2]: rectBinRef({\n channel,\n fieldDef,\n scaleName,\n markDef,\n band: (1 - band) / 2,\n offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset),\n config\n }),\n [vgChannel]: rectBinRef({\n channel,\n fieldDef,\n scaleName,\n markDef,\n band: 1 - (1 - band) / 2,\n offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset),\n config\n })\n };\n } else if (isBinned(fieldDef.bin)) {\n const startRef = ref.valueRefForFieldOrDatumDef(\n fieldDef,\n scaleName,\n {},\n {offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset)}\n );\n\n if (isFieldDef(fieldDef2)) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: ref.valueRefForFieldOrDatumDef(\n fieldDef2,\n scaleName,\n {},\n {offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset)}\n )\n };\n } else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: {\n signal: `scale(\"${scaleName}\", ${vgField(fieldDef, {expr: 'datum'})} + ${fieldDef.bin.step})`,\n offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset)\n }\n };\n }\n }\n log.warn(log.message.channelRequiredForBinned(channel2));\n return undefined;\n}\n\n/**\n * Value Ref for binned fields\n */\nexport function rectBinRef({\n channel,\n fieldDef,\n scaleName,\n markDef,\n band,\n offset,\n config\n}: {\n channel: PositionChannel | PolarPositionChannel;\n fieldDef: TypedFieldDef;\n scaleName: string;\n markDef: MarkDef;\n band: number;\n offset?: number | SignalRef;\n config?: Config;\n}) {\n const r = ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: fieldDef,\n band,\n offset\n });\n\n return ref.wrapPositionInvalidTest({\n fieldDef,\n channel,\n markDef,\n ref: r,\n config\n });\n}\n","import {array} from 'vega-util';\nimport {Channel, ScaleChannel, SCALE_CHANNELS} from '../../../channel';\nimport {isPathMark, MarkDef} from '../../../mark';\nimport {hasContinuousDomain} from '../../../scale';\nimport {Dict, keys} from '../../../util';\nimport {VgEncodeEntry, VgValueRef, VG_MARK_CONFIGS} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {aria} from './aria';\nimport {color} from './color';\nimport {nonPosition} from './nonposition';\nimport {text} from './text';\nimport {tooltip} from './tooltip';\nimport {fieldInvalidPredicate} from './valueref';\nimport {zindex} from './zindex';\n\nexport {color} from './color';\nexport {wrapCondition} from './conditional';\nexport {nonPosition} from './nonposition';\nexport {pointPosition} from './position-point';\nexport {pointOrRangePosition, rangePosition} from './position-range';\nexport {rectPosition} from './position-rect';\nexport {text} from './text';\nexport {tooltip} from './tooltip';\n\nexport type Ignore = Record<'color' | 'size' | 'orient' | 'align' | 'baseline' | 'theta', 'ignore' | 'include'>;\n\nconst ALWAYS_IGNORE = new Set(['aria']);\n\nexport function baseEncodeEntry(model: UnitModel, ignore: Ignore) {\n const {fill = undefined, stroke = undefined} = ignore.color === 'include' ? color(model) : {};\n return {\n ...markDefProperties(model.markDef, ignore),\n ...wrapAllFieldsInvalid(model, 'fill', fill),\n ...wrapAllFieldsInvalid(model, 'stroke', stroke),\n ...nonPosition('opacity', model),\n ...nonPosition('fillOpacity', model),\n ...nonPosition('strokeOpacity', model),\n ...nonPosition('strokeWidth', model),\n ...nonPosition('strokeDash', model),\n ...zindex(model),\n ...tooltip(model),\n ...text(model, 'href'),\n ...aria(model)\n };\n}\n\n// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987\nfunction wrapAllFieldsInvalid(model: UnitModel, channel: Channel, valueRef: VgValueRef | VgValueRef[]): VgEncodeEntry {\n const {config, mark, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n\n if (invalid === 'hide' && valueRef && !isPathMark(mark)) {\n // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains.\n // For path marks, we will use \"defined\" property and skip these values instead.\n const test = allFieldsInvalidPredicate(model, {invalid: true, channels: SCALE_CHANNELS});\n if (test) {\n return {\n [channel]: [\n // prepend the invalid case\n // TODO: support custom value\n {test, value: null},\n ...array(valueRef)\n ]\n };\n }\n }\n return valueRef ? {[channel]: valueRef} : {};\n}\n\nfunction markDefProperties(mark: MarkDef, ignore: Ignore) {\n return VG_MARK_CONFIGS.reduce((m, prop) => {\n if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') {\n m[prop] = signalOrValueRef(mark[prop]);\n }\n return m;\n }, {});\n}\n\nfunction allFieldsInvalidPredicate(\n model: UnitModel,\n {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]}\n) {\n const filterIndex = channels.reduce((aggregator: Dict, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, {expr: 'datum'});\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n","import {isValueDef} from '../../../channeldef';\nimport {isPathMark} from '../../../mark';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\n\nexport function zindex(model: UnitModel) {\n const {encoding, mark} = model;\n const order = encoding.order;\n\n if (!isPathMark(mark) && isValueDef(order)) {\n return wrapCondition(model, order, 'zindex', cd => cd);\n }\n return {};\n}\n","import {POSITION_SCALE_CHANNELS} from '../../../channel';\nimport {ScaleChannel} from '../../../channel';\nimport {Value} from '../../../channeldef';\nimport {hasContinuousDomain} from '../../../scale';\nimport {Dict, keys} from '../../../util';\nimport {VgEncodeEntry} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {fieldInvalidPredicate} from './valueref';\n\nexport function defined(model: UnitModel): VgEncodeEntry {\n const {config, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid) {\n const signal = allFieldsInvalidPredicate(model, {channels: POSITION_SCALE_CHANNELS});\n\n if (signal) {\n return {defined: {signal}};\n }\n }\n return {};\n}\n\nfunction allFieldsInvalidPredicate(\n model: UnitModel,\n {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]}\n) {\n const filterIndex = channels.reduce((aggregator: Dict, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, {expr: 'datum'});\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n\nexport function valueIfDefined(prop: string, value: Value): VgEncodeEntry {\n if (value !== undefined) {\n return {[prop]: signalOrValueRef(value)};\n }\n return undefined;\n}\n","import * as log from '../../../log';\nimport {isPathMark} from '../../../mark';\nimport {tooltip} from '../../mark/encode';\nimport {TransformCompiler} from './transforms';\n\nconst VORONOI = 'voronoi';\n\nconst nearest: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type !== 'interval' && selCmpt.nearest;\n },\n\n parse: (model, selCmpt) => {\n // Scope selection events to the voronoi mark to prevent capturing\n // events that occur on the group mark (https://github.com/vega/vega/issues/2112).\n if (selCmpt.events) {\n for (const s of selCmpt.events) {\n s.markname = model.getName(VORONOI);\n }\n }\n },\n\n marks: (model, selCmpt, marks) => {\n const {x, y} = selCmpt.project.hasChannel;\n const markType = model.mark;\n if (isPathMark(markType)) {\n log.warn(log.message.nearestNotSupportForContinuous(markType));\n return marks;\n }\n\n const cellDef = {\n name: model.getName(VORONOI),\n type: 'path',\n interactive: true,\n from: {data: model.getName('marks')},\n encode: {\n update: {\n fill: {value: 'transparent'},\n strokeWidth: {value: 0.35},\n stroke: {value: 'transparent'},\n isVoronoi: {value: true},\n ...tooltip(model, {reactiveGeom: true})\n }\n },\n transform: [\n {\n type: 'voronoi',\n x: {expr: x || !y ? 'datum.datum.x || 0' : '0'},\n y: {expr: y || !x ? 'datum.datum.y || 0' : '0'},\n size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')]\n }\n ]\n };\n\n let index = 0;\n let exists = false;\n marks.forEach((mark, i) => {\n const name = mark.name ?? '';\n if (name === model.component.mark[0].name) {\n index = i;\n } else if (name.indexOf(VORONOI) >= 0) {\n exists = true;\n }\n });\n\n if (!exists) {\n marks.splice(index + 1, 0, cellDef);\n }\n\n return marks;\n }\n};\n\nexport default nearest;\n","import {DataSourceType} from '../../data';\nimport * as log from '../../log';\nimport {Dict, uniqueId} from '../../util';\n\n/**\n * A node in the dataflow tree.\n */\nexport abstract class DataFlowNode {\n private _children: DataFlowNode[] = [];\n\n private _parent: DataFlowNode = null;\n\n protected _hash: string | number;\n\n constructor(parent: DataFlowNode, public readonly debugName?: string) {\n if (parent) {\n this.parent = parent;\n }\n }\n\n /**\n * Clone this node with a deep copy but don't clone links to children or parents.\n */\n public clone(): DataFlowNode {\n throw new Error('Cannot clone node');\n }\n\n /**\n * Return a hash of the node.\n */\n public abstract hash(): string | number;\n\n /**\n * Set of fields that this node depends on.\n */\n public abstract dependentFields(): Set;\n\n /**\n * Set of fields that are being created by this node.\n */\n public abstract producedFields(): Set;\n\n get parent() {\n return this._parent;\n }\n\n /**\n * Set the parent of the node and also add this node to the parent's children.\n */\n set parent(parent: DataFlowNode) {\n this._parent = parent;\n if (parent) {\n parent.addChild(this);\n }\n }\n\n get children() {\n return this._children;\n }\n\n public numChildren() {\n return this._children.length;\n }\n\n public addChild(child: DataFlowNode, loc?: number) {\n // do not add the same child twice\n if (this._children.indexOf(child) > -1) {\n log.warn(log.message.ADD_SAME_CHILD_TWICE);\n return;\n }\n\n if (loc !== undefined) {\n this._children.splice(loc, 0, child);\n } else {\n this._children.push(child);\n }\n }\n\n public removeChild(oldChild: DataFlowNode) {\n const loc = this._children.indexOf(oldChild);\n this._children.splice(loc, 1);\n return loc;\n }\n\n /**\n * Remove node from the dataflow.\n */\n public remove() {\n let loc = this._parent.removeChild(this);\n for (const child of this._children) {\n // do not use the set method because we want to insert at a particular location\n child._parent = this._parent;\n this._parent.addChild(child, loc++);\n }\n }\n\n /**\n * Insert another node as a parent of this node.\n */\n public insertAsParentOf(other: DataFlowNode) {\n const parent = other.parent;\n parent.removeChild(this);\n this.parent = parent;\n other.parent = this;\n }\n\n public swapWithParent() {\n const parent = this._parent;\n const newParent = parent.parent;\n\n // reconnect the children\n for (const child of this._children) {\n child.parent = parent;\n }\n\n // remove old links\n this._children = []; // equivalent to removing every child link one by one\n parent.removeChild(this);\n parent.parent.removeChild(parent);\n\n // swap two nodes\n this.parent = newParent;\n parent.parent = this;\n }\n}\n\nexport class OutputNode extends DataFlowNode {\n private _source: string;\n\n private _name: string;\n\n public clone(): this {\n const cloneObj = new (this.constructor as any)();\n cloneObj.debugName = 'clone_' + this.debugName;\n cloneObj._source = this._source;\n cloneObj._name = 'clone_' + this._name;\n cloneObj.type = this.type;\n cloneObj.refCounts = this.refCounts;\n cloneObj.refCounts[cloneObj._name] = 0;\n return cloneObj;\n }\n\n /**\n * @param source The name of the source. Will change in assemble.\n * @param type The type of the output node.\n * @param refCounts A global ref counter map.\n */\n constructor(\n parent: DataFlowNode,\n source: string,\n public readonly type: DataSourceType,\n private readonly refCounts: Dict\n ) {\n super(parent, source);\n\n this._source = this._name = source;\n\n if (this.refCounts && !(this._name in this.refCounts)) {\n this.refCounts[this._name] = 0;\n }\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n if (this._hash === undefined) {\n this._hash = `Output ${uniqueId()}`;\n }\n return this._hash;\n }\n\n /**\n * Request the datasource name and increase the ref counter.\n *\n * During the parsing phase, this will return the simple name such as 'main' or 'raw'.\n * It is crucial to request the name from an output node to mark it as a required node.\n * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase.\n *\n * In the assemble phase, this will return the correct name.\n */\n public getSource() {\n this.refCounts[this._name]++;\n return this._source;\n }\n\n public isRequired(): boolean {\n return !!this.refCounts[this._name];\n }\n\n public setSource(source: string) {\n this._source = source;\n }\n}\n","import {TimeUnitTransform as VgTimeUnitTransform} from 'vega';\nimport {getSecondaryRangeChannel} from '../../channel';\nimport {hasBand, vgField} from '../../channeldef';\nimport {getTimeUnitParts, normalizeTimeUnit} from '../../timeunit';\nimport {TimeUnitTransform} from '../../transform';\nimport {Dict, duplicate, hash, isEmpty, replacePathInField, vals} from '../../util';\nimport {isUnitModel, ModelWithField} from '../model';\nimport {DataFlowNode} from './dataflow';\n\nexport type TimeUnitComponent = TimeUnitTransform & {\n /** whether to output time unit as a band (generate two formula including start and end) */\n band?: boolean;\n};\n\nexport class TimeUnitNode extends DataFlowNode {\n public clone() {\n return new TimeUnitNode(null, duplicate(this.formula));\n }\n\n constructor(parent: DataFlowNode, private formula: Dict) {\n super(parent);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) {\n const formula = model.reduceFieldDef((timeUnitComponent: TimeUnitComponent, fieldDef, channel) => {\n const {field, timeUnit} = fieldDef;\n\n const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;\n\n const band =\n isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config);\n\n if (timeUnit) {\n const as = vgField(fieldDef, {forAs: true});\n timeUnitComponent[\n hash({\n as,\n field,\n timeUnit\n })\n ] = {\n as,\n field,\n timeUnit,\n ...(band ? {band: true} : {})\n };\n }\n return timeUnitComponent;\n }, {} as Dict);\n\n if (isEmpty(formula)) {\n return null;\n }\n\n return new TimeUnitNode(parent, formula);\n }\n\n public static makeFromTransform(parent: DataFlowNode, t: TimeUnitTransform) {\n const {timeUnit, ...other} = {...t};\n\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n\n const component = {\n ...other,\n timeUnit: normalizedTimeUnit\n };\n\n return new TimeUnitNode(parent, {\n [hash(component)]: component\n });\n }\n\n /**\n * Merge together TimeUnitNodes assigning the children of `other` to `this`\n * and removing `other`.\n */\n public merge(other: TimeUnitNode) {\n this.formula = {...this.formula};\n\n // if the same hash happen twice, merge \"band\"\n for (const key in other.formula) {\n if (!this.formula[key] || other.formula[key].band) {\n // copy if it's not a duplicate or if we need to include copy band over\n this.formula[key] = other.formula[key];\n }\n }\n\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n\n other.remove();\n }\n\n public producedFields() {\n return new Set(vals(this.formula).map(f => f.as));\n }\n\n public dependentFields() {\n return new Set(vals(this.formula).map(f => f.field));\n }\n\n public hash() {\n return `TimeUnit ${hash(this.formula)}`;\n }\n\n public assemble() {\n const transforms: VgTimeUnitTransform[] = [];\n\n for (const f of vals(this.formula)) {\n const {field, as, timeUnit} = f;\n const {unit, utc, ...params} = normalizeTimeUnit(timeUnit);\n\n transforms.push({\n field: replacePathInField(field),\n type: 'timeunit',\n ...(unit ? {units: getTimeUnitParts(unit)} : {}),\n ...(utc ? {timezone: 'utc'} : {}),\n ...params,\n as: [as, `${as}_end`]\n });\n }\n\n return transforms;\n }\n}\n","import {array} from 'vega-util';\nimport {isSingleDefUnitChannel, ScaleChannel, SingleDefUnitChannel} from '../../../channel';\nimport * as log from '../../../log';\nimport {hasContinuousDomain} from '../../../scale';\nimport {SelectionInit, SelectionInitInterval} from '../../../selection';\nimport {Dict, hash, keys, replacePathInField, varName, isEmpty} from '../../../util';\nimport {TimeUnitComponent, TimeUnitNode} from '../../data/timeunit';\nimport {TransformCompiler} from './transforms';\n\nexport const TUPLE_FIELDS = '_tuple_fields';\n\n/**\n * Whether the selection tuples hold enumerated or ranged values for a field.\n */\nexport type TupleStoreType =\n // enumerated\n | 'E'\n // ranged, exclusive, left-right inclusive\n | 'R'\n // ranged, left-inclusive, right-exclusive\n | 'R-RE';\n\nexport interface SelectionProjection {\n type: TupleStoreType;\n field: string;\n channel?: SingleDefUnitChannel;\n signals?: {data?: string; visual?: string};\n hasLegend?: boolean;\n}\n\nexport class SelectionProjectionComponent {\n public hasChannel: Partial>;\n public hasField: Record;\n public timeUnit?: TimeUnitNode;\n public items: SelectionProjection[];\n\n constructor(...items: SelectionProjection[]) {\n this.items = items;\n this.hasChannel = {};\n this.hasField = {};\n }\n}\n\nconst project: TransformCompiler = {\n has: () => {\n return true; // This transform handles its own defaults, so always run parse.\n },\n\n parse: (model, selCmpt, selDef) => {\n const name = selCmpt.name;\n const proj = selCmpt.project ?? (selCmpt.project = new SelectionProjectionComponent());\n const parsed: Dict = {};\n const timeUnits: Dict = {};\n\n const signals = new Set();\n const signalName = (p: SelectionProjection, range: 'data' | 'visual') => {\n const suffix = range === 'visual' ? p.channel : p.field;\n let sg = varName(`${name}_${suffix}`);\n for (let counter = 1; signals.has(sg); counter++) {\n sg = varName(`${name}_${suffix}_${counter}`);\n }\n signals.add(sg);\n return {[range]: sg};\n };\n\n // If no explicit projection (either fields or encodings) is specified, set some defaults.\n // If an initial value is set, try to infer projections.\n // Otherwise, use the default configuration.\n if (!selDef.fields && !selDef.encodings) {\n const cfg = model.config.selection[selDef.type];\n\n if (selDef.init) {\n for (const init of array(selDef.init)) {\n for (const key of keys(init)) {\n if (isSingleDefUnitChannel(key)) {\n (selDef.encodings || (selDef.encodings = [])).push(key as SingleDefUnitChannel);\n } else {\n if (selDef.type === 'interval') {\n log.warn(log.message.INTERVAL_INITIALIZED_WITH_X_Y);\n selDef.encodings = cfg.encodings;\n } else {\n (selDef.fields || (selDef.fields = [])).push(key);\n }\n }\n }\n }\n } else {\n selDef.encodings = cfg.encodings;\n selDef.fields = cfg.fields;\n }\n }\n\n // TODO: find a possible channel mapping for these fields.\n for (const field of selDef.fields ?? []) {\n const p: SelectionProjection = {type: 'E', field};\n p.signals = {...signalName(p, 'data')};\n proj.items.push(p);\n proj.hasField[field] = p;\n }\n\n for (const channel of selDef.encodings ?? []) {\n const fieldDef = model.fieldDef(channel);\n if (fieldDef) {\n let field = fieldDef.field;\n\n if (fieldDef.aggregate) {\n log.warn(log.message.cannotProjectAggregate(channel, fieldDef.aggregate));\n continue;\n } else if (!field) {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n continue;\n }\n\n if (fieldDef.timeUnit) {\n field = model.vgField(channel);\n // Construct TimeUnitComponents which will be combined into a\n // TimeUnitNode. This node may need to be inserted into the\n // dataflow if the selection is used across views that do not\n // have these time units defined.\n const component = {\n timeUnit: fieldDef.timeUnit,\n as: field,\n field: fieldDef.field\n };\n\n timeUnits[hash(component)] = component;\n }\n\n // Prevent duplicate projections on the same field.\n // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag).\n if (!parsed[field]) {\n // Determine whether the tuple will store enumerated or ranged values.\n // Interval selections store ranges for continuous scales, and enumerations otherwise.\n // Single/multi selections store ranges for binned fields, and enumerations otherwise.\n let type: TupleStoreType = 'E';\n if (selCmpt.type === 'interval') {\n const scaleType = model.getScaleComponent(channel as ScaleChannel).get('type');\n if (hasContinuousDomain(scaleType)) {\n type = 'R';\n }\n } else if (fieldDef.bin) {\n type = 'R-RE';\n }\n\n const p: SelectionProjection = {field, channel, type};\n p.signals = {...signalName(p, 'data'), ...signalName(p, 'visual')};\n proj.items.push((parsed[field] = p));\n proj.hasField[field] = proj.hasChannel[channel] = parsed[field];\n }\n } else {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n }\n }\n\n if (selDef.init) {\n const parseInit = (i: Dict): T[] => {\n return proj.items.map(p => (i[p.channel] !== undefined ? i[p.channel] : i[p.field]));\n };\n\n if (selDef.type === 'interval') {\n selCmpt.init = parseInit(selDef.init);\n } else {\n const init = array(selDef.init);\n selCmpt.init = init.map(parseInit);\n }\n }\n\n if (!isEmpty(timeUnits)) {\n proj.timeUnit = new TimeUnitNode(null, timeUnits);\n }\n },\n\n signals: (model, selCmpt, allSignals) => {\n const name = selCmpt.name + TUPLE_FIELDS;\n const hasSignal = allSignals.filter(s => s.name === name);\n return hasSignal.length > 0\n ? allSignals\n : allSignals.concat({\n name,\n value: selCmpt.project.items.map(proj => {\n const {signals, hasLegend, ...rest} = proj;\n rest.field = replacePathInField(rest.field);\n return rest;\n })\n });\n }\n};\n\nexport default project;\n","import {stringValue} from 'vega-util';\nimport {TUPLE} from '..';\nimport {varName} from '../../../util';\nimport {assembleInit} from '../assemble';\nimport nearest from './nearest';\nimport {TUPLE_FIELDS} from './project';\nimport {TransformCompiler} from './transforms';\nimport {isLegendBinding} from '../../../selection';\n\nconst inputBindings: TransformCompiler = {\n has: selCmpt => {\n return (\n selCmpt.type === 'single' &&\n selCmpt.resolve === 'global' &&\n selCmpt.bind &&\n selCmpt.bind !== 'scales' &&\n !isLegendBinding(selCmpt.bind)\n );\n },\n\n parse: (model, selCmpt, selDef, origDef) => {\n // Binding a selection to input widgets disables default direct manipulation interaction.\n // A user can choose to re-enable it by explicitly specifying triggering input events.\n if (!origDef.on) delete selCmpt.events;\n if (!origDef.clear) delete selCmpt.clear;\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const bind = selCmpt.bind;\n const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value).\n const datum = nearest.has(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum';\n\n proj.items.forEach((p, i) => {\n const sgname = varName(`${name}_${p.field}`);\n const hasSignal = signals.filter(s => s.name === sgname);\n\n if (!hasSignal.length) {\n signals.unshift({\n name: sgname,\n ...(init ? {init: assembleInit(init[i])} : {value: null}),\n on: selCmpt.events\n ? [\n {\n events: selCmpt.events,\n update: `datum && item().mark.marktype !== 'group' ? ${datum}[${stringValue(p.field)}] : null`\n }\n ]\n : [],\n bind: bind[p.field] ?? bind[p.channel] ?? bind\n });\n }\n });\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const signal = signals.filter(s => s.name === name + TUPLE)[0];\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.map(p => varName(`${name}_${p.field}`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n\n if (values.length) {\n signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n }\n\n delete signal.value;\n delete signal.on;\n\n return signals;\n }\n};\n\nexport default inputBindings;\n","import {TUPLE, unitName} from '..';\nimport {TransformCompiler} from './transforms';\n\nexport const TOGGLE = '_toggle';\n\nconst toggle: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type === 'multi' && !!selCmpt.toggle;\n },\n\n signals: (model, selCmpt, signals) => {\n return signals.concat({\n name: selCmpt.name + TOGGLE,\n value: false,\n on: [{events: selCmpt.events, update: selCmpt.toggle}]\n });\n },\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n const signal = selCmpt.name + TOGGLE;\n\n return (\n `${signal} ? null : ${tpl}, ` +\n (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) +\n `${signal} ? ${tpl} : null`\n );\n }\n};\n\nexport default toggle;\n","import {Update} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {isString} from 'vega-util';\nimport {TUPLE} from '..';\nimport {varName} from '../../../util';\nimport inputBindings from './inputs';\nimport toggle, {TOGGLE} from './toggle';\nimport {TransformCompiler} from './transforms';\n\nconst clear: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.clear !== undefined && selCmpt.clear !== false;\n },\n\n parse: (model, selCmpt, selDef) => {\n if (selDef.clear) {\n selCmpt.clear = isString(selDef.clear) ? parseSelector(selDef.clear, 'scope') : selDef.clear;\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n if (inputBindings.has(selCmpt)) {\n for (const proj of selCmpt.project.items) {\n const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`));\n if (idx !== -1) {\n signals[idx].on.push({events: selCmpt.clear, update: 'null'});\n }\n }\n }\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n function addClear(idx: number, update: Update) {\n if (idx !== -1 && signals[idx].on) {\n signals[idx].on.push({events: selCmpt.clear, update});\n }\n }\n\n // Be as minimalist as possible when adding clear triggers to minimize dataflow execution.\n if (selCmpt.type === 'interval') {\n for (const proj of selCmpt.project.items) {\n const vIdx = signals.findIndex(n => n.name === proj.signals.visual);\n addClear(vIdx, '[0, 0]');\n\n if (vIdx === -1) {\n const dIdx = signals.findIndex(n => n.name === proj.signals.data);\n addClear(dIdx, 'null');\n }\n }\n } else {\n let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE);\n addClear(tIdx, 'null');\n\n if (toggle.has(selCmpt)) {\n tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE);\n addClear(tIdx, 'false');\n }\n }\n\n return signals;\n }\n};\n\nexport default clear;\n","import {stringValue} from 'vega-util';\nimport {VL_SELECTION_RESOLVE} from '..';\nimport {isScaleChannel, ScaleChannel} from '../../../channel';\nimport * as log from '../../../log';\nimport {hasContinuousDomain} from '../../../scale';\nimport {isLayerModel, Model} from '../../model';\nimport {UnitModel} from '../../unit';\nimport {SelectionProjection} from './project';\nimport {TransformCompiler} from './transforms';\n\nconst scaleBindings: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales';\n },\n\n parse: (model, selCmpt) => {\n const bound: SelectionProjection[] = (selCmpt.scales = []);\n\n for (const proj of selCmpt.project.items) {\n const channel = proj.channel;\n\n if (!isScaleChannel(channel)) {\n continue;\n }\n\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n\n if (!scale || !hasContinuousDomain(scaleType)) {\n log.warn(log.message.SCALE_BINDINGS_CONTINUOUS);\n continue;\n }\n\n const extent = {selection: selCmpt.name, field: proj.field};\n scale.set('selectionExtent', extent, true);\n bound.push(proj);\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0);\n\n // Top-level signals are only needed for multiview displays and if this\n // view's top-level signals haven't already been generated.\n if (!model.parent || isTopLevelLayer(model) || bound.length === 0) {\n return signals;\n }\n\n // vlSelectionResolve does not account for the behavior of bound scales in\n // multiview displays. Each unit view adds a tuple to the store, but the\n // state of the selection is the unit selection most recently updated. This\n // state is captured by the top-level signals that we insert and \"push\n // outer\" to from within the units. We need to reassemble this state into\n // the top-level named signal, except no single selCmpt has a global view.\n const namedSg = signals.filter(s => s.name === selCmpt.name)[0];\n let update = namedSg.update;\n if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) {\n namedSg.update = `{${bound.map(proj => `${stringValue(proj.field)}: ${proj.signals.data}`).join(', ')}}`;\n } else {\n for (const proj of bound) {\n const mapping = `${stringValue(proj.field)}: ${proj.signals.data}`;\n if (update.indexOf(mapping) < 0) {\n update = `${update.substring(0, update.length - 1)}, ${mapping}}`;\n }\n }\n namedSg.update = update;\n }\n\n return signals.concat(bound.map(proj => ({name: proj.signals.data})));\n },\n\n signals: (model, selCmpt, signals) => {\n // Nested signals need only push to top-level signals with multiview displays.\n if (model.parent && !isTopLevelLayer(model)) {\n for (const proj of selCmpt.scales) {\n const signal: any = signals.filter(s => s.name === proj.signals.data)[0];\n signal.push = 'outer';\n delete signal.value;\n delete signal.update;\n }\n }\n\n return signals;\n }\n};\n\nexport default scaleBindings;\n\nexport function domain(model: UnitModel, channel: ScaleChannel) {\n const scale = stringValue(model.scaleName(channel));\n return `domain(${scale})`;\n}\n\nfunction isTopLevelLayer(model: Model): boolean {\n return model.parent && isLayerModel(model.parent) && (!model.parent.parent ?? isTopLevelLayer(model.parent.parent));\n}\n","import {MergedStream, Stream} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {array, isString} from 'vega-util';\nimport {forEachSelection, SelectionComponent, TUPLE} from '..';\nimport {NonPositionScaleChannel} from '../../../channel';\nimport * as log from '../../../log';\nimport {isLegendBinding, isLegendStreamBinding, SELECTION_ID} from '../../../selection';\nimport {duplicate, varName} from '../../../util';\nimport {LegendComponent} from '../../legend/component';\nimport {UnitModel} from '../../unit';\nimport {TUPLE_FIELDS} from './project';\nimport {TOGGLE} from './toggle';\nimport {TransformCompiler} from './transforms';\n\nconst legendBindings: TransformCompiler = {\n has: (selCmpt: SelectionComponent<'single' | 'multi'>) => {\n const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind);\n const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID;\n if (spec && !projLen) {\n log.warn(log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION);\n }\n\n return spec && projLen;\n },\n\n parse: (model, selCmpt, selDef, origDef) => {\n // Binding a selection to a legend disables default direct manipulation interaction.\n // A user can choose to re-enable it by explicitly specifying triggering input events.\n if (!origDef.on) delete selCmpt.events;\n if (!origDef.clear) delete selCmpt.clear;\n\n if (origDef.on || origDef.clear) {\n const legendFilter = 'event.item && indexof(event.item.mark.role, \"legend\") < 0';\n for (const evt of selCmpt.events) {\n evt.filter = array(evt.filter ?? []);\n if (evt.filter.indexOf(legendFilter) < 0) {\n evt.filter.push(legendFilter);\n }\n }\n }\n\n const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click';\n const stream: Stream[] = isString(evt) ? parseSelector(evt, 'view') : array(evt);\n selCmpt.bind = {legend: {merge: stream}};\n },\n\n topLevelSignals: (model, selCmpt: SelectionComponent<'single' | 'multi'>, signals) => {\n const selName = selCmpt.name;\n const stream = isLegendStreamBinding(selCmpt.bind) && (selCmpt.bind.legend as MergedStream);\n const markName = (name: string) => (s: Stream) => {\n const ds = duplicate(s);\n ds.markname = name;\n return ds;\n };\n\n for (const proj of selCmpt.project.items) {\n if (!proj.hasLegend) continue;\n const prefix = `${varName(proj.field)}_legend`;\n const sgName = `${selName}_${prefix}`;\n const hasSignal = signals.filter(s => s.name === sgName);\n\n if (hasSignal.length === 0) {\n const events = stream.merge\n .map(markName(`${prefix}_symbols`))\n .concat(stream.merge.map(markName(`${prefix}_labels`)))\n .concat(stream.merge.map(markName(`${prefix}_entries`)));\n\n signals.unshift({\n name: sgName,\n ...(!selCmpt.init ? {value: null} : {}),\n on: [\n // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum.\n {events, update: 'datum.value || item().items[0].items[0].datum.value', force: true},\n {events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true}\n ]\n });\n }\n }\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const tuple = signals.find(s => s.name === name + TUPLE);\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n\n if (selCmpt.events && values.length > 0) {\n tuple.on.push({\n events: values.map(signal => ({signal})),\n update\n });\n } else if (values.length > 0) {\n tuple.update = update;\n delete tuple.value;\n delete tuple.on;\n }\n\n const toggle = signals.find(s => s.name === name + TOGGLE);\n const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;\n if (toggle) {\n if (!selCmpt.events) toggle.on[0].events = events;\n else toggle.on.push({...toggle.on[0], events});\n }\n\n return signals;\n }\n};\n\nexport default legendBindings;\n\nexport function parseInteractiveLegend(\n model: UnitModel,\n channel: NonPositionScaleChannel,\n legendCmpt: LegendComponent\n) {\n const field = model.fieldDef(channel)?.field;\n forEachSelection(model, selCmpt => {\n const proj = selCmpt.project.hasField[field] ?? selCmpt.project.hasChannel[channel];\n if (proj && legendBindings.has(selCmpt)) {\n const legendSelections = legendCmpt.get('selections') ?? [];\n legendSelections.push(selCmpt.name);\n legendCmpt.set('selections', legendSelections, false);\n proj.hasLegend = true;\n }\n });\n}\n","import {NewSignal} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {SelectionComponent} from '..';\nimport {ScaleChannel, X, Y} from '../../../channel';\nimport {UnitModel} from '../../unit';\nimport {BRUSH as INTERVAL_BRUSH} from '../interval';\nimport {SelectionProjection} from './project';\nimport scalesCompiler, {domain} from './scales';\nimport {TransformCompiler} from './transforms';\n\nconst ANCHOR = '_translate_anchor';\nconst DELTA = '_translate_delta';\n\nconst translate: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.translate;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const hasScales = scalesCompiler.has(selCmpt);\n const anchor = name + ANCHOR;\n const {x, y} = selCmpt.project.hasChannel;\n let events = parseSelector(selCmpt.translate, 'scope');\n\n if (!hasScales) {\n events = events.map(e => ((e.between[0].markname = name + INTERVAL_BRUSH), e));\n }\n\n signals.push(\n {\n name: anchor,\n value: {},\n on: [\n {\n events: events.map(e => e.between[0]),\n update:\n '{x: x(unit), y: y(unit)' +\n (x !== undefined ? ', extent_x: ' + (hasScales ? domain(model, X) : `slice(${x.signals.visual})`) : '') +\n (y !== undefined ? ', extent_y: ' + (hasScales ? domain(model, Y) : `slice(${y.signals.visual})`) : '') +\n '}'\n }\n ]\n },\n {\n name: name + DELTA,\n value: {},\n on: [\n {\n events: events,\n update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}`\n }\n ]\n }\n );\n\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n\n return signals;\n }\n};\n\nexport default translate;\n\nfunction onDelta(\n model: UnitModel,\n selCmpt: SelectionComponent,\n proj: SelectionProjection,\n size: 'width' | 'height',\n signals: NewSignal[]\n) {\n const name = selCmpt.name;\n const anchor = name + ANCHOR;\n const delta = name + DELTA;\n const channel = proj.channel as ScaleChannel;\n const hasScales = scalesCompiler.has(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt.get('type');\n const sign = hasScales && channel === X ? '-' : ''; // Invert delta when panning x-scales.\n const extent = `${anchor}.extent_${channel}`;\n const offset = `${sign}${delta}.${channel} / ` + (hasScales ? `${sizeSg}` : `span(${extent})`);\n const panFn = !hasScales\n ? 'panLinear'\n : scaleType === 'log'\n ? 'panLog'\n : scaleType === 'pow'\n ? 'panPow'\n : 'panLinear';\n const update =\n `${panFn}(${extent}, ${offset}` +\n (hasScales && scaleType === 'pow' ? `, ${scaleCmpt.get('exponent') ?? 1}` : '') +\n ')';\n\n signal.on.push({\n events: {signal: delta},\n update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n","import {NewSignal} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {stringValue} from 'vega-util';\nimport {SelectionComponent} from '..';\nimport {ScaleChannel, X, Y} from '../../../channel';\nimport {UnitModel} from '../../unit';\nimport {BRUSH as INTERVAL_BRUSH} from '../interval';\nimport {SelectionProjection} from './project';\nimport {default as scalesCompiler, domain} from './scales';\nimport {TransformCompiler} from './transforms';\n\nconst ANCHOR = '_zoom_anchor';\nconst DELTA = '_zoom_delta';\n\nconst zoom: TransformCompiler = {\n has: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.zoom;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const hasScales = scalesCompiler.has(selCmpt);\n const delta = name + DELTA;\n const {x, y} = selCmpt.project.hasChannel;\n const sx = stringValue(model.scaleName(X));\n const sy = stringValue(model.scaleName(Y));\n let events = parseSelector(selCmpt.zoom, 'scope');\n\n if (!hasScales) {\n events = events.map(e => ((e.markname = name + INTERVAL_BRUSH), e));\n }\n\n signals.push(\n {\n name: name + ANCHOR,\n on: [\n {\n events: events,\n update: !hasScales\n ? `{x: x(unit), y: y(unit)}`\n : '{' +\n [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : '']\n .filter(expr => !!expr)\n .join(', ') +\n '}'\n }\n ]\n },\n {\n name: delta,\n on: [\n {\n events: events,\n force: true,\n update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))'\n }\n ]\n }\n );\n\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n\n return signals;\n }\n};\n\nexport default zoom;\n\nfunction onDelta(\n model: UnitModel,\n selCmpt: SelectionComponent,\n proj: SelectionProjection,\n size: 'width' | 'height',\n signals: NewSignal[]\n) {\n const name = selCmpt.name;\n const channel = proj.channel as ScaleChannel;\n const hasScales = scalesCompiler.has(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt.get('type');\n const base = hasScales ? domain(model, channel) : signal.name;\n const delta = name + DELTA;\n const anchor = `${name}${ANCHOR}.${channel}`;\n const zoomFn = !hasScales\n ? 'zoomLinear'\n : scaleType === 'log'\n ? 'zoomLog'\n : scaleType === 'pow'\n ? 'zoomPow'\n : 'zoomLinear';\n const update =\n `${zoomFn}(${base}, ${anchor}, ${delta}` +\n (hasScales && scaleType === 'pow' ? `, ${scaleCmpt.get('exponent') ?? 1}` : '') +\n ')';\n\n signal.on.push({\n events: {signal: delta},\n update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n","import {NewSignal, Signal} from 'vega';\nimport {SelectionComponent} from '..';\nimport {SelectionDef} from '../../../selection';\nimport {Model} from '../../model';\nimport {UnitModel} from '../../unit';\nimport clear from './clear';\nimport inputs from './inputs';\nimport nearest from './nearest';\nimport project from './project';\nimport scales from './scales';\nimport legends from './legends';\nimport toggle from './toggle';\nimport translate from './translate';\nimport zoom from './zoom';\n\nexport interface TransformCompiler {\n has: (selCmpt: SelectionComponent) => boolean;\n parse?: (model: UnitModel, selCmpt: SelectionComponent, def: SelectionDef, origDef: SelectionDef) => void;\n signals?: (model: UnitModel, selCmpt: SelectionComponent, signals: NewSignal[]) => Signal[]; // the output can be a new or a push signal\n topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: NewSignal[]) => NewSignal[];\n modifyExpr?: (model: UnitModel, selCmpt: SelectionComponent, expr: string) => string;\n marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[];\n}\n\nconst compilers: TransformCompiler[] = [project, toggle, scales, legends, translate, zoom, inputs, nearest, clear];\n\nexport function forEachTransform(selCmpt: SelectionComponent, cb: (tx: TransformCompiler) => void) {\n for (const t of compilers) {\n if (t.has(selCmpt)) {\n cb(t);\n }\n }\n}\n","import {Signal, SignalRef} from 'vega';\nimport {selector as parseSelector} from 'vega-event-selector';\nimport {identity, isArray, stringValue} from 'vega-util';\nimport {forEachSelection, MODIFY, STORE, unitName, VL_SELECTION_RESOLVE, TUPLE} from '.';\nimport {dateTimeToExpr, isDateTime, dateTimeToTimestamp} from '../../datetime';\nimport {SelectionInit, SelectionInitInterval, SelectionExtent} from '../../selection';\nimport {keys, varName} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {FacetModel} from '../facet';\nimport {LayerModel} from '../layer';\nimport {isUnitModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {forEachTransform} from './transforms/transforms';\nimport {parseSelectionBinExtent} from './parse';\n\nexport function assembleInit(\n init: readonly (SelectionInit | readonly SelectionInit[] | SelectionInitInterval)[] | SelectionInit,\n isExpr = true,\n wrap: (str: string | number) => string | number = identity\n): any {\n if (isArray(init)) {\n const assembled = init.map(v => assembleInit(v, isExpr, wrap));\n return isExpr ? `[${assembled.join(', ')}]` : assembled;\n } else if (isDateTime(init)) {\n if (isExpr) {\n return wrap(dateTimeToExpr(init));\n } else {\n return wrap(dateTimeToTimestamp(init));\n }\n }\n return isExpr ? wrap(JSON.stringify(init)) : init;\n}\n\nexport function assembleUnitSelectionSignals(model: UnitModel, signals: Signal[]) {\n forEachSelection(model, (selCmpt, selCompiler) => {\n const name = selCmpt.name;\n let modifyExpr = selCompiler.modifyExpr(model, selCmpt);\n\n signals.push(...selCompiler.signals(model, selCmpt));\n\n forEachTransform(selCmpt, txCompiler => {\n if (txCompiler.signals) {\n signals = txCompiler.signals(model, selCmpt, signals);\n }\n if (txCompiler.modifyExpr) {\n modifyExpr = txCompiler.modifyExpr(model, selCmpt, modifyExpr);\n }\n });\n\n signals.push({\n name: name + MODIFY,\n on: [\n {\n events: {signal: selCmpt.name + TUPLE},\n update: `modify(${stringValue(selCmpt.name + STORE)}, ${modifyExpr})`\n }\n ]\n });\n });\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleFacetSignals(model: FacetModel, signals: Signal[]) {\n if (model.component.selection && keys(model.component.selection).length) {\n const name = stringValue(model.getName('cell'));\n signals.unshift({\n name: 'facet',\n value: {},\n on: [\n {\n events: parseSelector('mousemove', 'scope'),\n update: `isTuple(facet) ? facet : group(${name}).datum`\n }\n ]\n });\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleTopLevelSignals(model: UnitModel, signals: Signal[]) {\n let hasSelections = false;\n forEachSelection(model, (selCmpt, selCompiler) => {\n const name = selCmpt.name;\n const store = stringValue(name + STORE);\n const hasSg = signals.filter(s => s.name === name);\n if (hasSg.length === 0) {\n const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve;\n const isMulti = selCmpt.type === 'multi' ? ', true)' : ')';\n signals.push({\n name: selCmpt.name,\n update: `${VL_SELECTION_RESOLVE}(${store}, ${stringValue(resolve)}${isMulti}`\n });\n }\n hasSelections = true;\n\n if (selCompiler.topLevelSignals) {\n signals = selCompiler.topLevelSignals(model, selCmpt, signals);\n }\n\n forEachTransform(selCmpt, txCompiler => {\n if (txCompiler.topLevelSignals) {\n signals = txCompiler.topLevelSignals(model, selCmpt, signals);\n }\n });\n });\n\n if (hasSelections) {\n const hasUnit = signals.filter(s => s.name === 'unit');\n if (hasUnit.length === 0) {\n signals.unshift({\n name: 'unit',\n value: {},\n on: [{events: 'mousemove', update: 'isTuple(group()) ? group() : unit'}]\n });\n }\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleUnitSelectionData(model: UnitModel, data: readonly VgData[]): VgData[] {\n const dataCopy = [...data];\n forEachSelection(model, selCmpt => {\n const init: VgData = {name: selCmpt.name + STORE};\n if (selCmpt.init) {\n const fields = selCmpt.project.items.map(proj => {\n const {signals, ...rest} = proj;\n return rest;\n });\n\n const insert = selCmpt.init.map(i => assembleInit(i, false));\n init.values =\n selCmpt.type === 'interval'\n ? [{unit: unitName(model, {escape: false}), fields, values: insert}]\n : insert.map(i => ({unit: unitName(model, {escape: false}), fields, values: i}));\n }\n const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE);\n if (!contains.length) {\n dataCopy.push(init);\n }\n });\n\n return dataCopy;\n}\n\nexport function assembleUnitSelectionMarks(model: UnitModel, marks: any[]): any[] {\n forEachSelection(model, (selCmpt, selCompiler) => {\n marks = selCompiler.marks ? selCompiler.marks(model, selCmpt, marks) : marks;\n forEachTransform(selCmpt, txCompiler => {\n if (txCompiler.marks) {\n marks = txCompiler.marks(model, selCmpt, marks);\n }\n });\n });\n\n return marks;\n}\n\nexport function assembleLayerSelectionMarks(model: LayerModel, marks: any[]): any[] {\n for (const child of model.children) {\n if (isUnitModel(child)) {\n marks = assembleUnitSelectionMarks(child, marks);\n }\n }\n\n return marks;\n}\n\nexport function assembleSelectionScaleDomain(model: Model, extent: SelectionExtent): SignalRef {\n const name = extent.selection;\n const selCmpt = model.getSelectionComponent(name, varName(name));\n return {signal: parseSelectionBinExtent(selCmpt, extent)};\n}\n\nfunction cleanupEmptyOnArray(signals: Signal[]) {\n return signals.map(s => {\n if (s.on && !s.on.length) delete s.on;\n return s;\n });\n}\n","import {NewSignal, OnEvent, Stream} from 'vega';\nimport {array, stringValue} from 'vega-util';\nimport {SelectionCompiler, SelectionComponent, STORE, TUPLE, unitName} from '.';\nimport {ScaleChannel, X, Y} from '../../channel';\nimport {warn} from '../../log';\nimport {hasContinuousDomain} from '../../scale';\nimport {SelectionInitInterval} from '../../selection';\nimport {keys} from '../../util';\nimport {UnitModel} from '../unit';\nimport {assembleInit} from './assemble';\nimport {SelectionProjection, TUPLE_FIELDS} from './transforms/project';\nimport scales from './transforms/scales';\n\nexport const BRUSH = '_brush';\nexport const SCALE_TRIGGER = '_scale_trigger';\n\nconst interval: SelectionCompiler<'interval'> = {\n signals: (model, selCmpt) => {\n const name = selCmpt.name;\n const fieldsSg = name + TUPLE_FIELDS;\n const hasScales = scales.has(selCmpt);\n const signals: NewSignal[] = [];\n const dataSignals: string[] = [];\n const scaleTriggers: {\n scaleName: string;\n expr: string;\n }[] = [];\n\n if (selCmpt.translate && !hasScales) {\n const filterExpr = `!event.item || event.item.mark.name !== ${stringValue(name + BRUSH)}`;\n events(selCmpt, (on: OnEvent[], evt: Stream) => {\n const filters = array(evt.between[0].filter ?? (evt.between[0].filter = []));\n if (filters.indexOf(filterExpr) < 0) {\n filters.push(filterExpr);\n }\n return on;\n });\n }\n\n selCmpt.project.items.forEach((proj, i) => {\n const channel = proj.channel;\n if (channel !== X && channel !== Y) {\n warn('Interval selections only support x and y encoding channels.');\n return;\n }\n\n const init = selCmpt.init ? selCmpt.init[i] : null;\n const cs = channelSignals(model, selCmpt, proj, init);\n const dname = proj.signals.data;\n const vname = proj.signals.visual;\n const scaleName = stringValue(model.scaleName(channel));\n const scaleType = model.getScaleComponent(channel).get('type');\n const toNum = hasContinuousDomain(scaleType) ? '+' : '';\n\n signals.push(...cs);\n dataSignals.push(dname);\n\n scaleTriggers.push({\n scaleName: model.scaleName(channel),\n expr:\n `(!isArray(${dname}) || ` +\n `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` +\n `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))`\n });\n });\n\n // Proxy scale reactions to ensure that an infinite loop doesn't occur\n // when an interval selection filter touches the scale.\n if (!hasScales) {\n signals.push({\n name: name + SCALE_TRIGGER,\n value: {},\n on: [\n {\n events: scaleTriggers.map(t => ({scale: t.scaleName})),\n update: scaleTriggers.map(t => t.expr).join(' && ') + ` ? ${name + SCALE_TRIGGER} : {}`\n }\n ]\n });\n }\n\n // Only add an interval to the store if it has valid data extents. Data extents\n // are set to null if pixel extents are equal to account for intervals over\n // ordinal/nominal domains which, when inverted, will still produce a valid datum.\n const init = selCmpt.init;\n const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`;\n return signals.concat({\n name: name + TUPLE,\n ...(init ? {init: `{${update}: ${assembleInit(init)}}`} : {}),\n on: [\n {\n events: [{signal: dataSignals.join(' || ')}], // Prevents double invocation, see https://github.com/vega/vega#1672.\n update: dataSignals.join(' && ') + ` ? {${update}: [${dataSignals}]} : null`\n }\n ]\n });\n },\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`);\n },\n\n marks: (model, selCmpt, marks) => {\n const name = selCmpt.name;\n const {x, y} = selCmpt.project.hasChannel;\n const xvname = x && x.signals.visual;\n const yvname = y && y.signals.visual;\n const store = `data(${stringValue(selCmpt.name + STORE)})`;\n\n // Do not add a brush if we're binding to scales.\n if (scales.has(selCmpt)) {\n return marks;\n }\n\n const update: any = {\n x: x !== undefined ? {signal: `${xvname}[0]`} : {value: 0},\n y: y !== undefined ? {signal: `${yvname}[0]`} : {value: 0},\n x2: x !== undefined ? {signal: `${xvname}[1]`} : {field: {group: 'width'}},\n y2: y !== undefined ? {signal: `${yvname}[1]`} : {field: {group: 'height'}}\n };\n\n // If the selection is resolved to global, only a single interval is in\n // the store. Wrap brush mark's encodings with a production rule to test\n // this based on the `unit` property. Hide the brush mark if it corresponds\n // to a unit different from the one in the store.\n if (selCmpt.resolve === 'global') {\n for (const key of keys(update)) {\n update[key] = [\n {\n test: `${store}.length && ${store}[0].unit === ${unitName(model)}`,\n ...update[key]\n },\n {value: 0}\n ];\n }\n }\n\n // Two brush marks ensure that fill colors and other aesthetic choices do\n // not interefere with the core marks, but that the brushed region can still\n // be interacted with (e.g., dragging it around).\n const {fill, fillOpacity, cursor, ...stroke} = selCmpt.mark;\n const vgStroke = keys(stroke).reduce((def, k) => {\n def[k] = [\n {\n test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`]\n .filter(t => t)\n .join(' && '),\n value: stroke[k]\n },\n {value: null}\n ];\n return def;\n }, {});\n\n return [\n {\n name: name + BRUSH + '_bg',\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n fill: {value: fill},\n fillOpacity: {value: fillOpacity}\n },\n update: update\n }\n },\n ...marks,\n {\n name: name + BRUSH,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n ...(cursor ? {cursor: {value: cursor}} : {}),\n fill: {value: 'transparent'}\n },\n update: {...update, ...vgStroke}\n }\n }\n ];\n }\n};\nexport default interval;\n\n/**\n * Returns the visual and data signals for an interval selection.\n */\nfunction channelSignals(\n model: UnitModel,\n selCmpt: SelectionComponent<'interval'>,\n proj: SelectionProjection,\n init?: SelectionInitInterval\n): NewSignal[] {\n const channel = proj.channel;\n const vname = proj.signals.visual;\n const dname = proj.signals.data;\n const hasScales = scales.has(selCmpt);\n const scaleName = stringValue(model.scaleName(channel));\n const scale = model.getScaleComponent(channel as ScaleChannel);\n const scaleType = scale ? scale.get('type') : undefined;\n const scaled = (str: string) => `scale(${scaleName}, ${str})`;\n const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal;\n const coord = `${channel}(unit)`;\n\n const on = events(selCmpt, (def: OnEvent[], evt: Stream) => {\n return [\n ...def,\n {events: evt.between[0], update: `[${coord}, ${coord}]`}, // Brush Start\n {events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]`} // Brush End\n ];\n });\n\n // React to pan/zooms of continuous scales. Non-continuous scales\n // (band, point) cannot be pan/zoomed and any other changes\n // to their domains (e.g., filtering) should clear the brushes.\n on.push({\n events: {signal: selCmpt.name + SCALE_TRIGGER},\n update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]`\n });\n\n return hasScales\n ? [{name: dname, on: []}]\n : [\n {\n name: vname,\n ...(init ? {init: assembleInit(init, true, scaled)} : {value: []}),\n on: on\n },\n {\n name: dname,\n ...(init ? {init: assembleInit(init)} : {}), // Cannot be `value` as `init` may require datetime exprs.\n on: [\n {\n events: {signal: vname},\n update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})`\n }\n ]\n }\n ];\n}\n\nfunction events(selCmpt: SelectionComponent<'interval'>, cb: (def: OnEvent[], evt: Stream) => OnEvent[]): OnEvent[] {\n return selCmpt.events.reduce((on, evt) => {\n if (!evt.between) {\n warn(`${evt} is not an ordered event stream for interval selections.`);\n return on;\n }\n return cb(on, evt);\n }, [] as OnEvent[]);\n}\n","import {Stream} from 'vega';\nimport {stringValue} from 'vega-util';\nimport {SelectionCompiler, SelectionComponent, TUPLE, unitName} from '.';\nimport {UnitModel} from '../unit';\nimport {TUPLE_FIELDS} from './transforms/project';\n\nexport function singleOrMultiSignals(model: UnitModel, selCmpt: SelectionComponent<'single' | 'multi'>) {\n const name = selCmpt.name;\n const fieldsSg = name + TUPLE_FIELDS;\n const project = selCmpt.project;\n const datum = '(item().isVoronoi ? datum.datum : datum)';\n const values = project.items\n .map(p => {\n const fieldDef = model.fieldDef(p.channel);\n // Binned fields should capture extents, for a range test against the raw field.\n return fieldDef && fieldDef.bin\n ? `[${datum}[${stringValue(model.vgField(p.channel, {}))}], ` +\n `${datum}[${stringValue(model.vgField(p.channel, {binSuffix: 'end'}))}]]`\n : `${datum}[${stringValue(p.field)}]`;\n })\n .join(', ');\n\n // Only add a discrete selection to the store if a datum is present _and_\n // the interaction isn't occurring on a group mark. This guards against\n // polluting interactive state with invalid values in faceted displays\n // as the group marks are also data-driven. We force the update to account\n // for constant null states but varying toggles (e.g., shift-click in\n // whitespace followed by a click in whitespace; the store should only\n // be cleared on the second click).\n const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`;\n\n const events: Stream[] = selCmpt.events;\n\n return [\n {\n name: name + TUPLE,\n on: events\n ? [\n {\n events,\n update: `datum && item().mark.marktype !== 'group' ? {${update}: [${values}]} : null`,\n force: true\n }\n ]\n : []\n }\n ];\n}\n\nconst multi: SelectionCompiler<'multi'> = {\n signals: singleOrMultiSignals,\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n return tpl + ', ' + (selCmpt.resolve === 'global' ? 'null' : `{unit: ${unitName(model)}}`);\n }\n};\n\nexport default multi;\n","import {SelectionCompiler, TUPLE, unitName} from '.';\nimport {singleOrMultiSignals} from './multi';\n\nconst single: SelectionCompiler<'single'> = {\n signals: singleOrMultiSignals,\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`);\n }\n};\n\nexport default single;\n","import {Binding, NewSignal, Stream} from 'vega';\nimport {stringValue} from 'vega-util';\nimport {FACET_CHANNELS} from '../../channel';\nimport {\n BrushConfig,\n LegendBinding,\n SelectionInit,\n SelectionInitInterval,\n SelectionResolution,\n SelectionType,\n SELECTION_ID\n} from '../../selection';\nimport {Dict, vals} from '../../util';\nimport {OutputNode} from '../data/dataflow';\nimport {FacetModel} from '../facet';\nimport {isFacetModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport interval from './interval';\nimport multi from './multi';\nimport single from './single';\nimport {SelectionProjection, SelectionProjectionComponent} from './transforms/project';\n\nexport const STORE = '_store';\nexport const TUPLE = '_tuple';\nexport const MODIFY = '_modify';\nexport const SELECTION_DOMAIN = '_selection_domain_';\nexport const VL_SELECTION_RESOLVE = 'vlSelectionResolve';\n\nexport interface SelectionComponent {\n name: string;\n type: T;\n // Use conditional types for stricter type of init (as the type of init depends on selection type).\n init?: (T extends 'interval'\n ? SelectionInitInterval\n : T extends 'single'\n ? SelectionInit\n : T extends 'multi'\n ? SelectionInit | SelectionInit[]\n : never)[];\n events: Stream[];\n materialized: OutputNode;\n bind?: 'scales' | Binding | Dict | LegendBinding;\n resolve: SelectionResolution;\n empty: 'all' | 'none';\n mark?: BrushConfig;\n\n // Transforms\n project?: SelectionProjectionComponent;\n scales?: SelectionProjection[];\n toggle?: any;\n translate?: any;\n zoom?: any;\n nearest?: any;\n clear?: any;\n}\n\nexport interface SelectionCompiler {\n signals: (model: UnitModel, selCmpt: SelectionComponent) => NewSignal[];\n topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: NewSignal[]) => NewSignal[];\n modifyExpr: (model: UnitModel, selCmpt: SelectionComponent) => string;\n marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[];\n}\n\nconst compilers: Dict = {single, multi, interval};\n\nexport function forEachSelection(\n model: Model,\n cb: (selCmpt: SelectionComponent, selCompiler: SelectionCompiler) => void | boolean\n) {\n const selections = model.component.selection;\n if (selections) {\n for (const sel of vals(selections)) {\n const success = cb(sel, compilers[sel.type]);\n if (success === true) break;\n }\n }\n}\n\nfunction getFacetModel(model: Model): FacetModel {\n let parent = model.parent;\n while (parent) {\n if (isFacetModel(parent)) {\n break;\n }\n parent = parent.parent;\n }\n\n return parent as FacetModel;\n}\n\nexport function unitName(model: Model, {escape} = {escape: true}) {\n let name = escape ? stringValue(model.name) : model.name;\n const facetModel = getFacetModel(model);\n if (facetModel) {\n const {facet} = facetModel;\n for (const channel of FACET_CHANNELS) {\n if (facet[channel]) {\n name += ` + '__facet_${channel}_' + (facet[${stringValue(facetModel.vgField(channel))}])`;\n }\n }\n }\n return name;\n}\n\nexport function requiresSelectionId(model: Model) {\n let identifier = false;\n forEachSelection(model, selCmpt => {\n identifier = identifier || selCmpt.project.items.some(proj => proj.field === SELECTION_ID);\n });\n return identifier;\n}\n","export var RawCode = 'RawCode';\nexport var Literal = 'Literal';\nexport var Property = 'Property';\nexport var Identifier = 'Identifier';\n\nexport var ArrayExpression = 'ArrayExpression';\nexport var BinaryExpression = 'BinaryExpression';\nexport var CallExpression = 'CallExpression';\nexport var ConditionalExpression = 'ConditionalExpression';\nexport var LogicalExpression = 'LogicalExpression';\nexport var MemberExpression = 'MemberExpression';\nexport var ObjectExpression = 'ObjectExpression';\nexport var UnaryExpression = 'UnaryExpression';\n\nexport default function ASTNode(type) {\n this.type = type;\n}\n\nASTNode.prototype.visit = function(visitor) {\n var node = this, c, i, n;\n\n if (visitor(node)) return 1;\n\n for (c=children(node), i=0, n=c.length; i\n Copyright (C) 2013 Thaddee Tyl \n Copyright (C) 2013 Mathias Bynens \n Copyright (C) 2012 Ariya Hidayat \n Copyright (C) 2012 Mathias Bynens \n Copyright (C) 2012 Joost-Wim Boekesteijn \n Copyright (C) 2012 Kris Kowal \n Copyright (C) 2012 Yusuke Suzuki \n Copyright (C) 2012 Arpad Borsos \n Copyright (C) 2011 Ariya Hidayat \n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\nimport ASTNode from './ast';\n\nvar TokenName,\n source,\n index,\n length,\n lookahead;\n\nvar TokenBooleanLiteral = 1,\n TokenEOF = 2,\n TokenIdentifier = 3,\n TokenKeyword = 4,\n TokenNullLiteral = 5,\n TokenNumericLiteral = 6,\n TokenPunctuator = 7,\n TokenStringLiteral = 8,\n TokenRegularExpression = 9;\n\nTokenName = {};\nTokenName[TokenBooleanLiteral] = 'Boolean';\nTokenName[TokenEOF] = '';\nTokenName[TokenIdentifier] = 'Identifier';\nTokenName[TokenKeyword] = 'Keyword';\nTokenName[TokenNullLiteral] = 'Null';\nTokenName[TokenNumericLiteral] = 'Numeric';\nTokenName[TokenPunctuator] = 'Punctuator';\nTokenName[TokenStringLiteral] = 'String';\nTokenName[TokenRegularExpression] = 'RegularExpression';\n\nvar SyntaxArrayExpression = 'ArrayExpression',\n SyntaxBinaryExpression = 'BinaryExpression',\n SyntaxCallExpression = 'CallExpression',\n SyntaxConditionalExpression = 'ConditionalExpression',\n SyntaxIdentifier = 'Identifier',\n SyntaxLiteral = 'Literal',\n SyntaxLogicalExpression = 'LogicalExpression',\n SyntaxMemberExpression = 'MemberExpression',\n SyntaxObjectExpression = 'ObjectExpression',\n SyntaxProperty = 'Property',\n SyntaxUnaryExpression = 'UnaryExpression';\n\n// Error messages should be identical to V8.\nvar MessageUnexpectedToken = 'Unexpected token %0',\n MessageUnexpectedNumber = 'Unexpected number',\n MessageUnexpectedString = 'Unexpected string',\n MessageUnexpectedIdentifier = 'Unexpected identifier',\n MessageUnexpectedReserved = 'Unexpected reserved word',\n MessageUnexpectedEOS = 'Unexpected end of input',\n MessageInvalidRegExp = 'Invalid regular expression',\n MessageUnterminatedRegExp = 'Invalid regular expression: missing /',\n MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.',\n MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';\n\nvar ILLEGAL = 'ILLEGAL',\n DISABLED = 'Disabled.';\n\n// See also tools/generate-unicode-regex.py.\nvar RegexNonAsciiIdentifierStart = new RegExp('[\\\\xAA\\\\xB5\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0370-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0620-\\\\u064A\\\\u066E\\\\u066F\\\\u0671-\\\\u06D3\\\\u06D5\\\\u06E5\\\\u06E6\\\\u06EE\\\\u06EF\\\\u06FA-\\\\u06FC\\\\u06FF\\\\u0710\\\\u0712-\\\\u072F\\\\u074D-\\\\u07A5\\\\u07B1\\\\u07CA-\\\\u07EA\\\\u07F4\\\\u07F5\\\\u07FA\\\\u0800-\\\\u0815\\\\u081A\\\\u0824\\\\u0828\\\\u0840-\\\\u0858\\\\u08A0-\\\\u08B2\\\\u0904-\\\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0CB5-\\\\u0CB9\\\\u0CBD\\\\u0CDE\\\\u0CE0\\\\u0CE1\\\\u0CF1\\\\u0CF2\\\\u0D05-\\\\u0D0C\\\\u0D0E-\\\\u0D10\\\\u0D12-\\\\u0D3A\\\\u0D3D\\\\u0D4E\\\\u0D60\\\\u0D61\\\\u0D7A-\\\\u0D7F\\\\u0D85-\\\\u0D96\\\\u0D9A-\\\\u0DB1\\\\u0DB3-\\\\u0DBB\\\\u0DBD\\\\u0DC0-\\\\u0DC6\\\\u0E01-\\\\u0E30\\\\u0E32\\\\u0E33\\\\u0E40-\\\\u0E46\\\\u0E81\\\\u0E82\\\\u0E84\\\\u0E87\\\\u0E88\\\\u0E8A\\\\u0E8D\\\\u0E94-\\\\u0E97\\\\u0E99-\\\\u0E9F\\\\u0EA1-\\\\u0EA3\\\\u0EA5\\\\u0EA7\\\\u0EAA\\\\u0EAB\\\\u0EAD-\\\\u0EB0\\\\u0EB2\\\\u0EB3\\\\u0EBD\\\\u0EC0-\\\\u0EC4\\\\u0EC6\\\\u0EDC-\\\\u0EDF\\\\u0F00\\\\u0F40-\\\\u0F47\\\\u0F49-\\\\u0F6C\\\\u0F88-\\\\u0F8C\\\\u1000-\\\\u102A\\\\u103F\\\\u1050-\\\\u1055\\\\u105A-\\\\u105D\\\\u1061\\\\u1065\\\\u1066\\\\u106E-\\\\u1070\\\\u1075-\\\\u1081\\\\u108E\\\\u10A0-\\\\u10C5\\\\u10C7\\\\u10CD\\\\u10D0-\\\\u10FA\\\\u10FC-\\\\u1248\\\\u124A-\\\\u124D\\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F4\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1711\\\\u1720-\\\\u1731\\\\u1740-\\\\u1751\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1780-\\\\u17B3\\\\u17D7\\\\u17DC\\\\u1820-\\\\u1877\\\\u1880-\\\\u18A8\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1950-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19C1-\\\\u19C7\\\\u1A00-\\\\u1A16\\\\u1A20-\\\\u1A54\\\\u1AA7\\\\u1B05-\\\\u1B33\\\\u1B45-\\\\u1B4B\\\\u1B83-\\\\u1BA0\\\\u1BAE\\\\u1BAF\\\\u1BBA-\\\\u1BE5\\\\u1C00-\\\\u1C23\\\\u1C4D-\\\\u1C4F\\\\u1C5A-\\\\u1C7D\\\\u1CE9-\\\\u1CEC\\\\u1CEE-\\\\u1CF1\\\\u1CF5\\\\u1CF6\\\\u1D00-\\\\u1DBF\\\\u1E00-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u2071\\\\u207F\\\\u2090-\\\\u209C\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2119-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u212D\\\\u212F-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2160-\\\\u2188\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2CE4\\\\u2CEB-\\\\u2CEE\\\\u2CF2\\\\u2CF3\\\\u2D00-\\\\u2D25\\\\u2D27\\\\u2D2D\\\\u2D30-\\\\u2D67\\\\u2D6F\\\\u2D80-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u2E2F\\\\u3005-\\\\u3007\\\\u3021-\\\\u3029\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u31F0-\\\\u31FF\\\\u3400-\\\\u4DB5\\\\u4E00-\\\\u9FCC\\\\uA000-\\\\uA48C\\\\uA4D0-\\\\uA4FD\\\\uA500-\\\\uA60C\\\\uA610-\\\\uA61F\\\\uA62A\\\\uA62B\\\\uA640-\\\\uA66E\\\\uA67F-\\\\uA69D\\\\uA6A0-\\\\uA6EF\\\\uA717-\\\\uA71F\\\\uA722-\\\\uA788\\\\uA78B-\\\\uA78E\\\\uA790-\\\\uA7AD\\\\uA7B0\\\\uA7B1\\\\uA7F7-\\\\uA801\\\\uA803-\\\\uA805\\\\uA807-\\\\uA80A\\\\uA80C-\\\\uA822\\\\uA840-\\\\uA873\\\\uA882-\\\\uA8B3\\\\uA8F2-\\\\uA8F7\\\\uA8FB\\\\uA90A-\\\\uA925\\\\uA930-\\\\uA946\\\\uA960-\\\\uA97C\\\\uA984-\\\\uA9B2\\\\uA9CF\\\\uA9E0-\\\\uA9E4\\\\uA9E6-\\\\uA9EF\\\\uA9FA-\\\\uA9FE\\\\uAA00-\\\\uAA28\\\\uAA40-\\\\uAA42\\\\uAA44-\\\\uAA4B\\\\uAA60-\\\\uAA76\\\\uAA7A\\\\uAA7E-\\\\uAAAF\\\\uAAB1\\\\uAAB5\\\\uAAB6\\\\uAAB9-\\\\uAABD\\\\uAAC0\\\\uAAC2\\\\uAADB-\\\\uAADD\\\\uAAE0-\\\\uAAEA\\\\uAAF2-\\\\uAAF4\\\\uAB01-\\\\uAB06\\\\uAB09-\\\\uAB0E\\\\uAB11-\\\\uAB16\\\\uAB20-\\\\uAB26\\\\uAB28-\\\\uAB2E\\\\uAB30-\\\\uAB5A\\\\uAB5C-\\\\uAB5F\\\\uAB64\\\\uAB65\\\\uABC0-\\\\uABE2\\\\uAC00-\\\\uD7A3\\\\uD7B0-\\\\uD7C6\\\\uD7CB-\\\\uD7FB\\\\uF900-\\\\uFA6D\\\\uFA70-\\\\uFAD9\\\\uFB00-\\\\uFB06\\\\uFB13-\\\\uFB17\\\\uFB1D\\\\uFB1F-\\\\uFB28\\\\uFB2A-\\\\uFB36\\\\uFB38-\\\\uFB3C\\\\uFB3E\\\\uFB40\\\\uFB41\\\\uFB43\\\\uFB44\\\\uFB46-\\\\uFBB1\\\\uFBD3-\\\\uFD3D\\\\uFD50-\\\\uFD8F\\\\uFD92-\\\\uFDC7\\\\uFDF0-\\\\uFDFB\\\\uFE70-\\\\uFE74\\\\uFE76-\\\\uFEFC\\\\uFF21-\\\\uFF3A\\\\uFF41-\\\\uFF5A\\\\uFF66-\\\\uFFBE\\\\uFFC2-\\\\uFFC7\\\\uFFCA-\\\\uFFCF\\\\uFFD2-\\\\uFFD7\\\\uFFDA-\\\\uFFDC]'),\n // eslint-disable-next-line no-misleading-character-class\n RegexNonAsciiIdentifierPart = new RegExp('[\\\\xAA\\\\xB5\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0300-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u0483-\\\\u0487\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u0591-\\\\u05BD\\\\u05BF\\\\u05C1\\\\u05C2\\\\u05C4\\\\u05C5\\\\u05C7\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0610-\\\\u061A\\\\u0620-\\\\u0669\\\\u066E-\\\\u06D3\\\\u06D5-\\\\u06DC\\\\u06DF-\\\\u06E8\\\\u06EA-\\\\u06FC\\\\u06FF\\\\u0710-\\\\u074A\\\\u074D-\\\\u07B1\\\\u07C0-\\\\u07F5\\\\u07FA\\\\u0800-\\\\u082D\\\\u0840-\\\\u085B\\\\u08A0-\\\\u08B2\\\\u08E4-\\\\u0963\\\\u0966-\\\\u096F\\\\u0971-\\\\u0983\\\\u0985-\\\\u098C\\\\u098F\\\\u0990\\\\u0993-\\\\u09A8\\\\u09AA-\\\\u09B0\\\\u09B2\\\\u09B6-\\\\u09B9\\\\u09BC-\\\\u09C4\\\\u09C7\\\\u09C8\\\\u09CB-\\\\u09CE\\\\u09D7\\\\u09DC\\\\u09DD\\\\u09DF-\\\\u09E3\\\\u09E6-\\\\u09F1\\\\u0A01-\\\\u0A03\\\\u0A05-\\\\u0A0A\\\\u0A0F\\\\u0A10\\\\u0A13-\\\\u0A28\\\\u0A2A-\\\\u0A30\\\\u0A32\\\\u0A33\\\\u0A35\\\\u0A36\\\\u0A38\\\\u0A39\\\\u0A3C\\\\u0A3E-\\\\u0A42\\\\u0A47\\\\u0A48\\\\u0A4B-\\\\u0A4D\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-\\\\u0F6C\\\\u0F71-\\\\u0F84\\\\u0F86-\\\\u0F97\\\\u0F99-\\\\u0FBC\\\\u0FC6\\\\u1000-\\\\u1049\\\\u1050-\\\\u109D\\\\u10A0-\\\\u10C5\\\\u10C7\\\\u10CD\\\\u10D0-\\\\u10FA\\\\u10FC-\\\\u1248\\\\u124A-\\\\u124D\\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u135D-\\\\u135F\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F4\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1714\\\\u1720-\\\\u1734\\\\u1740-\\\\u1753\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1772\\\\u1773\\\\u1780-\\\\u17D3\\\\u17D7\\\\u17DC\\\\u17DD\\\\u17E0-\\\\u17E9\\\\u180B-\\\\u180D\\\\u1810-\\\\u1819\\\\u1820-\\\\u1877\\\\u1880-\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1920-\\\\u192B\\\\u1930-\\\\u193B\\\\u1946-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19B0-\\\\u19C9\\\\u19D0-\\\\u19D9\\\\u1A00-\\\\u1A1B\\\\u1A20-\\\\u1A5E\\\\u1A60-\\\\u1A7C\\\\u1A7F-\\\\u1A89\\\\u1A90-\\\\u1A99\\\\u1AA7\\\\u1AB0-\\\\u1ABD\\\\u1B00-\\\\u1B4B\\\\u1B50-\\\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\\\\u2DD8-\\\\u2DDE\\\\u2DE0-\\\\u2DFF\\\\u2E2F\\\\u3005-\\\\u3007\\\\u3021-\\\\u302F\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u3099\\\\u309A\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u31F0-\\\\u31FF\\\\u3400-\\\\u4DB5\\\\u4E00-\\\\u9FCC\\\\uA000-\\\\uA48C\\\\uA4D0-\\\\uA4FD\\\\uA500-\\\\uA60C\\\\uA610-\\\\uA62B\\\\uA640-\\\\uA66F\\\\uA674-\\\\uA67D\\\\uA67F-\\\\uA69D\\\\uA69F-\\\\uA6F1\\\\uA717-\\\\uA71F\\\\uA722-\\\\uA788\\\\uA78B-\\\\uA78E\\\\uA790-\\\\uA7AD\\\\uA7B0\\\\uA7B1\\\\uA7F7-\\\\uA827\\\\uA840-\\\\uA873\\\\uA880-\\\\uA8C4\\\\uA8D0-\\\\uA8D9\\\\uA8E0-\\\\uA8F7\\\\uA8FB\\\\uA900-\\\\uA92D\\\\uA930-\\\\uA953\\\\uA960-\\\\uA97C\\\\uA980-\\\\uA9C0\\\\uA9CF-\\\\uA9D9\\\\uA9E0-\\\\uA9FE\\\\uAA00-\\\\uAA36\\\\uAA40-\\\\uAA4D\\\\uAA50-\\\\uAA59\\\\uAA60-\\\\uAA76\\\\uAA7A-\\\\uAAC2\\\\uAADB-\\\\uAADD\\\\uAAE0-\\\\uAAEF\\\\uAAF2-\\\\uAAF6\\\\uAB01-\\\\uAB06\\\\uAB09-\\\\uAB0E\\\\uAB11-\\\\uAB16\\\\uAB20-\\\\uAB26\\\\uAB28-\\\\uAB2E\\\\uAB30-\\\\uAB5A\\\\uAB5C-\\\\uAB5F\\\\uAB64\\\\uAB65\\\\uABC0-\\\\uABEA\\\\uABEC\\\\uABED\\\\uABF0-\\\\uABF9\\\\uAC00-\\\\uD7A3\\\\uD7B0-\\\\uD7C6\\\\uD7CB-\\\\uD7FB\\\\uF900-\\\\uFA6D\\\\uFA70-\\\\uFAD9\\\\uFB00-\\\\uFB06\\\\uFB13-\\\\uFB17\\\\uFB1D-\\\\uFB28\\\\uFB2A-\\\\uFB36\\\\uFB38-\\\\uFB3C\\\\uFB3E\\\\uFB40\\\\uFB41\\\\uFB43\\\\uFB44\\\\uFB46-\\\\uFBB1\\\\uFBD3-\\\\uFD3D\\\\uFD50-\\\\uFD8F\\\\uFD92-\\\\uFDC7\\\\uFDF0-\\\\uFDFB\\\\uFE00-\\\\uFE0F\\\\uFE20-\\\\uFE2D\\\\uFE33\\\\uFE34\\\\uFE4D-\\\\uFE4F\\\\uFE70-\\\\uFE74\\\\uFE76-\\\\uFEFC\\\\uFF10-\\\\uFF19\\\\uFF21-\\\\uFF3A\\\\uFF3F\\\\uFF41-\\\\uFF5A\\\\uFF66-\\\\uFFBE\\\\uFFC2-\\\\uFFC7\\\\uFFCA-\\\\uFFCF\\\\uFFD2-\\\\uFFD7\\\\uFFDA-\\\\uFFDC]');\n\n// Ensure the condition is true, otherwise throw an error.\n// This is only to have a better contract semantic, i.e. another safety net\n// to catch a logic error. The condition shall be fulfilled in normal case.\n// Do NOT use this to enforce a certain condition on any user input.\n\nfunction assert(condition, message) {\n /* istanbul ignore next */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n}\n\nfunction isDecimalDigit(ch) {\n return (ch >= 0x30 && ch <= 0x39); // 0..9\n}\n\nfunction isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n}\n\nfunction isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n}\n\n// 7.2 White Space\n\nfunction isWhiteSpace(ch) {\n return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) ||\n (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0);\n}\n\n// 7.3 Line Terminators\n\nfunction isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n}\n\n// 7.6 Identifier Names and Identifiers\n\nfunction isIdentifierStart(ch) {\n return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)\n (ch >= 0x41 && ch <= 0x5A) || // A..Z\n (ch >= 0x61 && ch <= 0x7A) || // a..z\n (ch === 0x5C) || // \\ (backslash)\n ((ch >= 0x80) && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)));\n}\n\nfunction isIdentifierPart(ch) {\n return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)\n (ch >= 0x41 && ch <= 0x5A) || // A..Z\n (ch >= 0x61 && ch <= 0x7A) || // a..z\n (ch >= 0x30 && ch <= 0x39) || // 0..9\n (ch === 0x5C) || // \\ (backslash)\n ((ch >= 0x80) && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n}\n\n// 7.6.1.1 Keywords\n\nvar keywords = {\n 'if':1, 'in':1, 'do':1,\n 'var':1, 'for':1, 'new':1, 'try':1, 'let':1,\n 'this':1, 'else':1, 'case':1, 'void':1, 'with':1, 'enum':1,\n 'while':1, 'break':1, 'catch':1, 'throw':1, 'const':1, 'yield':1, 'class':1, 'super':1,\n 'return':1, 'typeof':1, 'delete':1, 'switch':1, 'export':1, 'import':1, 'public':1, 'static':1,\n 'default':1, 'finally':1, 'extends':1, 'package':1, 'private':1,\n 'function':1, 'continue':1, 'debugger':1,\n 'interface':1, 'protected':1,\n 'instanceof':1, 'implements':1\n};\n\nfunction skipComment() {\n var ch;\n\n while (index < length) {\n ch = source.charCodeAt(index);\n\n if (isWhiteSpace(ch) || isLineTerminator(ch)) {\n ++index;\n } else {\n break;\n }\n }\n}\n\nfunction scanHexEscape(prefix) {\n var i, len, ch, code = 0;\n\n len = (prefix === 'u') ? 4 : 2;\n for (i = 0; i < len; ++i) {\n if (index < length && isHexDigit(source[index])) {\n ch = source[index++];\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n } else {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n return String.fromCharCode(code);\n}\n\nfunction scanUnicodeCodePointEscape() {\n var ch, code, cu1, cu2;\n\n ch = source[index];\n code = 0;\n\n // At least, one hex digit is required.\n if (ch === '}') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n while (index < length) {\n ch = source[index++];\n if (!isHexDigit(ch)) {\n break;\n }\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n }\n\n if (code > 0x10FFFF || ch !== '}') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n // UTF-16 Encoding\n if (code <= 0xFFFF) {\n return String.fromCharCode(code);\n }\n cu1 = ((code - 0x10000) >> 10) + 0xD800;\n cu2 = ((code - 0x10000) & 1023) + 0xDC00;\n return String.fromCharCode(cu1, cu2);\n}\n\nfunction getEscapedIdentifier() {\n var ch, id;\n\n ch = source.charCodeAt(index++);\n id = String.fromCharCode(ch);\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (ch === 0x5C) {\n if (source.charCodeAt(index) !== 0x75) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n id = ch;\n }\n\n while (index < length) {\n ch = source.charCodeAt(index);\n if (!isIdentifierPart(ch)) {\n break;\n }\n ++index;\n id += String.fromCharCode(ch);\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (ch === 0x5C) {\n id = id.substr(0, id.length - 1);\n if (source.charCodeAt(index) !== 0x75) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n id += ch;\n }\n }\n\n return id;\n}\n\nfunction getIdentifier() {\n var start, ch;\n\n start = index++;\n while (index < length) {\n ch = source.charCodeAt(index);\n if (ch === 0x5C) {\n // Blackslash (U+005C) marks Unicode escape sequence.\n index = start;\n return getEscapedIdentifier();\n }\n if (isIdentifierPart(ch)) {\n ++index;\n } else {\n break;\n }\n }\n\n return source.slice(start, index);\n}\n\nfunction scanIdentifier() {\n var start, id, type;\n\n start = index;\n\n // Backslash (U+005C) starts an escaped character.\n id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier();\n\n // There is no keyword or literal with only one character.\n // Thus, it must be an identifier.\n if (id.length === 1) {\n type = TokenIdentifier;\n } else if (keywords.hasOwnProperty(id)) { // eslint-disable-line no-prototype-builtins\n type = TokenKeyword;\n } else if (id === 'null') {\n type = TokenNullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = TokenBooleanLiteral;\n } else {\n type = TokenIdentifier;\n }\n\n return {\n type: type,\n value: id,\n start: start,\n end: index\n };\n}\n\n// 7.7 Punctuators\n\nfunction scanPunctuator() {\n var start = index,\n code = source.charCodeAt(index),\n code2,\n ch1 = source[index],\n ch2,\n ch3,\n ch4;\n\n switch (code) {\n\n // Check for most common single-character punctuators.\n case 0x2E: // . dot\n case 0x28: // ( open bracket\n case 0x29: // ) close bracket\n case 0x3B: // ; semicolon\n case 0x2C: // , comma\n case 0x7B: // { open curly brace\n case 0x7D: // } close curly brace\n case 0x5B: // [\n case 0x5D: // ]\n case 0x3A: // :\n case 0x3F: // ?\n case 0x7E: // ~\n ++index;\n return {\n type: TokenPunctuator,\n value: String.fromCharCode(code),\n start: start,\n end: index\n };\n\n default:\n code2 = source.charCodeAt(index + 1);\n\n // '=' (U+003D) marks an assignment or comparison operator.\n if (code2 === 0x3D) {\n switch (code) {\n case 0x2B: // +\n case 0x2D: // -\n case 0x2F: // /\n case 0x3C: // <\n case 0x3E: // >\n case 0x5E: // ^\n case 0x7C: // |\n case 0x25: // %\n case 0x26: // &\n case 0x2A: // *\n index += 2;\n return {\n type: TokenPunctuator,\n value: String.fromCharCode(code) + String.fromCharCode(code2),\n start: start,\n end: index\n };\n\n case 0x21: // !\n case 0x3D: // =\n index += 2;\n\n // !== and ===\n if (source.charCodeAt(index) === 0x3D) {\n ++index;\n }\n return {\n type: TokenPunctuator,\n value: source.slice(start, index),\n start: start,\n end: index\n };\n }\n }\n }\n\n // 4-character punctuator: >>>=\n\n ch4 = source.substr(index, 4);\n\n if (ch4 === '>>>=') {\n index += 4;\n return {\n type: TokenPunctuator,\n value: ch4,\n start: start,\n end: index\n };\n }\n\n // 3-character punctuators: === !== >>> <<= >>=\n\n ch3 = ch4.substr(0, 3);\n\n if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {\n index += 3;\n return {\n type: TokenPunctuator,\n value: ch3,\n start: start,\n end: index\n };\n }\n\n // Other 2-character punctuators: ++ -- << >> && ||\n ch2 = ch3.substr(0, 2);\n\n if ((ch1 === ch2[1] && ('+-<>&|'.indexOf(ch1) >= 0)) || ch2 === '=>') {\n index += 2;\n return {\n type: TokenPunctuator,\n value: ch2,\n start: start,\n end: index\n };\n }\n\n // 1-character punctuators: < > = ! + - * % & | ^ /\n\n if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {\n ++index;\n return {\n type: TokenPunctuator,\n value: ch1,\n start: start,\n end: index\n };\n }\n\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n}\n\n// 7.8.3 Numeric Literals\n\nfunction scanHexLiteral(start) {\n var number = '';\n\n while (index < length) {\n if (!isHexDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n\n if (number.length === 0) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n return {\n type: TokenNumericLiteral,\n value: parseInt('0x' + number, 16),\n start: start,\n end: index\n };\n}\n\nfunction scanOctalLiteral(start) {\n var number = '0' + source[index++];\n while (index < length) {\n if (!isOctalDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n\n if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n return {\n type: TokenNumericLiteral,\n value: parseInt(number, 8),\n octal: true,\n start: start,\n end: index\n };\n}\n\nfunction scanNumericLiteral() {\n var number, start, ch;\n\n ch = source[index];\n assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),\n 'Numeric literal must start with a decimal digit or a decimal point');\n\n start = index;\n number = '';\n if (ch !== '.') {\n number = source[index++];\n ch = source[index];\n\n // Hex number starts with '0x'.\n // Octal number starts with '0'.\n if (number === '0') {\n if (ch === 'x' || ch === 'X') {\n ++index;\n return scanHexLiteral(start);\n }\n if (isOctalDigit(ch)) {\n return scanOctalLiteral(start);\n }\n\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDecimalDigit(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n\n if (ch === '.') {\n number += source[index++];\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n\n if (ch === 'e' || ch === 'E') {\n number += source[index++];\n\n ch = source[index];\n if (ch === '+' || ch === '-') {\n number += source[index++];\n }\n if (isDecimalDigit(source.charCodeAt(index))) {\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n } else {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n return {\n type: TokenNumericLiteral,\n value: parseFloat(number),\n start: start,\n end: index\n };\n}\n\n// 7.8.4 String Literals\n\nfunction scanStringLiteral() {\n var str = '',\n quote, start, ch, code, octal = false;\n\n quote = source[index];\n assert((quote === '\\'' || quote === '\"'),\n 'String literal must starts with a quote');\n\n start = index;\n ++index;\n\n while (index < length) {\n ch = source[index++];\n\n if (ch === quote) {\n quote = '';\n break;\n } else if (ch === '\\\\') {\n ch = source[index++];\n if (!ch || !isLineTerminator(ch.charCodeAt(0))) {\n switch (ch) {\n case 'u':\n case 'x':\n if (source[index] === '{') {\n ++index;\n str += scanUnicodeCodePointEscape();\n } else {\n str += scanHexEscape(ch);\n }\n break;\n case 'n':\n str += '\\n';\n break;\n case 'r':\n str += '\\r';\n break;\n case 't':\n str += '\\t';\n break;\n case 'b':\n str += '\\b';\n break;\n case 'f':\n str += '\\f';\n break;\n case 'v':\n str += '\\x0B';\n break;\n\n default:\n if (isOctalDigit(ch)) {\n code = '01234567'.indexOf(ch);\n\n // \\0 is not octal escape sequence\n if (code !== 0) {\n octal = true;\n }\n\n if (index < length && isOctalDigit(source[index])) {\n octal = true;\n code = code * 8 + '01234567'.indexOf(source[index++]);\n\n // 3 digits are only allowed when string starts\n // with 0, 1, 2, 3\n if ('0123'.indexOf(ch) >= 0 &&\n index < length &&\n isOctalDigit(source[index])) {\n code = code * 8 + '01234567'.indexOf(source[index++]);\n }\n }\n str += String.fromCharCode(code);\n } else {\n str += ch;\n }\n break;\n }\n } else {\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n\n if (quote !== '') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n return {\n type: TokenStringLiteral,\n value: str,\n octal: octal,\n start: start,\n end: index\n };\n}\n\nfunction testRegExp(pattern, flags) {\n var tmp = pattern;\n\n if (flags.indexOf('u') >= 0) {\n // Replace each astral symbol and every Unicode code point\n // escape sequence with a single ASCII symbol to avoid throwing on\n // regular expressions that are only valid in combination with the\n // `/u` flag.\n // Note: replacing with the ASCII symbol `x` might cause false\n // negatives in unlikely scenarios. For example, `[\\u{61}-b]` is a\n // perfectly valid pattern that is equivalent to `[a-b]`, but it\n // would be replaced by `[x-b]` which throws an error.\n tmp = tmp\n .replace(/\\\\u\\{([0-9a-fA-F]+)\\}/g, function($0, $1) {\n if (parseInt($1, 16) <= 0x10FFFF) {\n return 'x';\n }\n throwError({}, MessageInvalidRegExp);\n })\n .replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n }\n\n // First, detect invalid regular expressions.\n try {\n new RegExp(tmp);\n } catch (e) {\n throwError({}, MessageInvalidRegExp);\n }\n\n // Return a regular expression object for this pattern-flag pair, or\n // `null` in case the current environment doesn't support the flags it\n // uses.\n try {\n return new RegExp(pattern, flags);\n } catch (exception) {\n return null;\n }\n}\n\nfunction scanRegExpBody() {\n var ch, str, classMarker, terminated, body;\n\n ch = source[index];\n assert(ch === '/', 'Regular expression literal must start with a slash');\n str = source[index++];\n\n classMarker = false;\n terminated = false;\n while (index < length) {\n ch = source[index++];\n str += ch;\n if (ch === '\\\\') {\n ch = source[index++];\n // ECMA-262 7.8.5\n if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, MessageUnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, MessageUnterminatedRegExp);\n } else if (classMarker) {\n if (ch === ']') {\n classMarker = false;\n }\n } else {\n if (ch === '/') {\n terminated = true;\n break;\n } else if (ch === '[') {\n classMarker = true;\n }\n }\n }\n\n if (!terminated) {\n throwError({}, MessageUnterminatedRegExp);\n }\n\n // Exclude leading and trailing slash.\n body = str.substr(1, str.length - 2);\n return {\n value: body,\n literal: str\n };\n}\n\nfunction scanRegExpFlags() {\n var ch, str, flags;\n\n str = '';\n flags = '';\n while (index < length) {\n ch = source[index];\n if (!isIdentifierPart(ch.charCodeAt(0))) {\n break;\n }\n\n ++index;\n if (ch === '\\\\' && index < length) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n } else {\n flags += ch;\n str += ch;\n }\n }\n\n if (flags.search(/[^gimuy]/g) >= 0) {\n throwError({}, MessageInvalidRegExp, flags);\n }\n\n return {\n value: flags,\n literal: str\n };\n}\n\nfunction scanRegExp() {\n var start, body, flags, value;\n\n lookahead = null;\n skipComment();\n start = index;\n\n body = scanRegExpBody();\n flags = scanRegExpFlags();\n value = testRegExp(body.value, flags.value);\n\n return {\n literal: body.literal + flags.literal,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n start: start,\n end: index\n };\n}\n\nfunction isIdentifierName(token) {\n return token.type === TokenIdentifier ||\n token.type === TokenKeyword ||\n token.type === TokenBooleanLiteral ||\n token.type === TokenNullLiteral;\n}\n\nfunction advance() {\n var ch;\n\n skipComment();\n\n if (index >= length) {\n return {\n type: TokenEOF,\n start: index,\n end: index\n };\n }\n\n ch = source.charCodeAt(index);\n\n if (isIdentifierStart(ch)) {\n return scanIdentifier();\n }\n\n // Very common: ( and ) and ;\n if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {\n return scanPunctuator();\n }\n\n // String literal starts with single quote (U+0027) or double quote (U+0022).\n if (ch === 0x27 || ch === 0x22) {\n return scanStringLiteral();\n }\n\n\n // Dot (.) U+002E can also start a floating-point number, hence the need\n // to check the next character.\n if (ch === 0x2E) {\n if (isDecimalDigit(source.charCodeAt(index + 1))) {\n return scanNumericLiteral();\n }\n return scanPunctuator();\n }\n\n if (isDecimalDigit(ch)) {\n return scanNumericLiteral();\n }\n\n return scanPunctuator();\n}\n\nfunction lex() {\n var token;\n\n token = lookahead;\n index = token.end;\n\n lookahead = advance();\n\n index = token.end;\n\n return token;\n}\n\nfunction peek() {\n var pos;\n\n pos = index;\n\n lookahead = advance();\n index = pos;\n}\n\nfunction finishArrayExpression(elements) {\n var node = new ASTNode(SyntaxArrayExpression);\n node.elements = elements;\n return node;\n}\n\nfunction finishBinaryExpression(operator, left, right) {\n var node = new ASTNode((operator === '||' || operator === '&&') ? SyntaxLogicalExpression : SyntaxBinaryExpression);\n node.operator = operator;\n node.left = left;\n node.right = right;\n return node;\n}\n\nfunction finishCallExpression(callee, args) {\n var node = new ASTNode(SyntaxCallExpression);\n node.callee = callee;\n node.arguments = args;\n return node;\n}\n\nfunction finishConditionalExpression(test, consequent, alternate) {\n var node = new ASTNode(SyntaxConditionalExpression);\n node.test = test;\n node.consequent = consequent;\n node.alternate = alternate;\n return node;\n}\n\nfunction finishIdentifier(name) {\n var node = new ASTNode(SyntaxIdentifier);\n node.name = name;\n return node;\n}\n\nfunction finishLiteral(token) {\n var node = new ASTNode(SyntaxLiteral);\n node.value = token.value;\n node.raw = source.slice(token.start, token.end);\n if (token.regex) {\n if (node.raw === '//') {\n node.raw = '/(?:)/';\n }\n node.regex = token.regex;\n }\n return node;\n}\n\nfunction finishMemberExpression(accessor, object, property) {\n var node = new ASTNode(SyntaxMemberExpression);\n node.computed = accessor === '[';\n node.object = object;\n node.property = property;\n if (!node.computed) property.member = true;\n return node;\n}\n\nfunction finishObjectExpression(properties) {\n var node = new ASTNode(SyntaxObjectExpression);\n node.properties = properties;\n return node;\n}\n\nfunction finishProperty(kind, key, value) {\n var node = new ASTNode(SyntaxProperty);\n node.key = key;\n node.value = value;\n node.kind = kind;\n return node;\n}\n\nfunction finishUnaryExpression(operator, argument) {\n var node = new ASTNode(SyntaxUnaryExpression);\n node.operator = operator;\n node.argument = argument;\n node.prefix = true;\n return node;\n}\n\n// Throw an exception\n\nfunction throwError(token, messageFormat) {\n var error,\n args = Array.prototype.slice.call(arguments, 2),\n msg = messageFormat.replace(\n /%(\\d)/g,\n function(whole, index) {\n assert(index < args.length, 'Message reference must be in range');\n return args[index];\n }\n );\n\n\n error = new Error(msg);\n error.index = index;\n error.description = msg;\n throw error;\n}\n\n// Throw an exception because of the token.\n\nfunction throwUnexpected(token) {\n if (token.type === TokenEOF) {\n throwError(token, MessageUnexpectedEOS);\n }\n\n if (token.type === TokenNumericLiteral) {\n throwError(token, MessageUnexpectedNumber);\n }\n\n if (token.type === TokenStringLiteral) {\n throwError(token, MessageUnexpectedString);\n }\n\n if (token.type === TokenIdentifier) {\n throwError(token, MessageUnexpectedIdentifier);\n }\n\n if (token.type === TokenKeyword) {\n throwError(token, MessageUnexpectedReserved);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, MessageUnexpectedToken, token.value);\n}\n\n// Expect the next token to match the specified punctuator.\n// If not, an exception will be thrown.\n\nfunction expect(value) {\n var token = lex();\n if (token.type !== TokenPunctuator || token.value !== value) {\n throwUnexpected(token);\n }\n}\n\n// Return true if the next token matches the specified punctuator.\n\nfunction match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n}\n\n// Return true if the next token matches the specified keyword\n\nfunction matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n}\n\n// 11.1.4 Array Initialiser\n\nfunction parseArrayInitialiser() {\n var elements = [];\n\n index = lookahead.start;\n expect('[');\n\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n elements.push(parseConditionalExpression());\n\n if (!match(']')) {\n expect(',');\n }\n }\n }\n\n lex();\n\n return finishArrayExpression(elements);\n}\n\n// 11.1.5 Object Initialiser\n\nfunction parseObjectPropertyKey() {\n var token;\n\n index = lookahead.start;\n token = lex();\n\n // Note: This function is called only from parseObjectProperty(), where\n // EOF and Punctuator tokens are already filtered out.\n\n if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) {\n if (token.octal) {\n throwError(token, MessageStrictOctalLiteral);\n }\n return finishLiteral(token);\n }\n\n return finishIdentifier(token.value);\n}\n\nfunction parseObjectProperty() {\n var token, key, id, value;\n\n index = lookahead.start;\n token = lookahead;\n\n if (token.type === TokenIdentifier) {\n id = parseObjectPropertyKey();\n expect(':');\n value = parseConditionalExpression();\n return finishProperty('init', id, value);\n }\n if (token.type === TokenEOF || token.type === TokenPunctuator) {\n throwUnexpected(token);\n } else {\n key = parseObjectPropertyKey();\n expect(':');\n value = parseConditionalExpression();\n return finishProperty('init', key, value);\n }\n}\n\nfunction parseObjectInitialiser() {\n var properties = [],\n property, name, key, map = {},\n toString = String;\n\n index = lookahead.start;\n expect('{');\n\n while (!match('}')) {\n property = parseObjectProperty();\n\n if (property.key.type === SyntaxIdentifier) {\n name = property.key.name;\n } else {\n name = toString(property.key.value);\n }\n\n key = '$' + name;\n if (Object.prototype.hasOwnProperty.call(map, key)) {\n throwError({}, MessageStrictDuplicateProperty);\n } else {\n map[key] = true;\n }\n\n properties.push(property);\n\n if (!match('}')) {\n expect(',');\n }\n }\n\n expect('}');\n\n return finishObjectExpression(properties);\n}\n\n// 11.1.6 The Grouping Operator\n\nfunction parseGroupExpression() {\n var expr;\n\n expect('(');\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n}\n\n\n// 11.1 Primary Expressions\n\nvar legalKeywords = {\n 'if': 1\n};\n\nfunction parsePrimaryExpression() {\n var type, token, expr;\n\n if (match('(')) {\n return parseGroupExpression();\n }\n\n if (match('[')) {\n return parseArrayInitialiser();\n }\n\n if (match('{')) {\n return parseObjectInitialiser();\n }\n\n type = lookahead.type;\n index = lookahead.start;\n\n\n if (type === TokenIdentifier || legalKeywords[lookahead.value]) {\n expr = finishIdentifier(lex().value);\n } else if (type === TokenStringLiteral || type === TokenNumericLiteral) {\n if (lookahead.octal) {\n throwError(lookahead, MessageStrictOctalLiteral);\n }\n expr = finishLiteral(lex());\n } else if (type === TokenKeyword) {\n throw new Error(DISABLED);\n } else if (type === TokenBooleanLiteral) {\n token = lex();\n token.value = (token.value === 'true');\n expr = finishLiteral(token);\n } else if (type === TokenNullLiteral) {\n token = lex();\n token.value = null;\n expr = finishLiteral(token);\n } else if (match('/') || match('/=')) {\n expr = finishLiteral(scanRegExp());\n peek();\n } else {\n throwUnexpected(lex());\n }\n\n return expr;\n}\n\n// 11.2 Left-Hand-Side Expressions\n\nfunction parseArguments() {\n var args = [];\n\n expect('(');\n\n if (!match(')')) {\n while (index < length) {\n args.push(parseConditionalExpression());\n if (match(')')) {\n break;\n }\n expect(',');\n }\n }\n\n expect(')');\n\n return args;\n}\n\nfunction parseNonComputedProperty() {\n var token;\n index = lookahead.start;\n token = lex();\n\n if (!isIdentifierName(token)) {\n throwUnexpected(token);\n }\n\n return finishIdentifier(token.value);\n}\n\nfunction parseNonComputedMember() {\n expect('.');\n\n return parseNonComputedProperty();\n}\n\nfunction parseComputedMember() {\n var expr;\n\n expect('[');\n\n expr = parseExpression();\n\n expect(']');\n\n return expr;\n}\n\nfunction parseLeftHandSideExpressionAllowCall() {\n var expr, args, property;\n\n expr = parsePrimaryExpression();\n\n for (;;) {\n if (match('.')) {\n property = parseNonComputedMember();\n expr = finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n args = parseArguments();\n expr = finishCallExpression(expr, args);\n } else if (match('[')) {\n property = parseComputedMember();\n expr = finishMemberExpression('[', expr, property);\n } else {\n break;\n }\n }\n\n return expr;\n}\n\n// 11.3 Postfix Expressions\n\nfunction parsePostfixExpression() {\n var expr = parseLeftHandSideExpressionAllowCall();\n\n if (lookahead.type === TokenPunctuator) {\n if ((match('++') || match('--'))) {\n throw new Error(DISABLED);\n }\n }\n\n return expr;\n}\n\n// 11.4 Unary Operators\n\nfunction parseUnaryExpression() {\n var token, expr;\n\n if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n throw new Error(DISABLED);\n } else if (match('+') || match('-') || match('~') || match('!')) {\n token = lex();\n expr = parseUnaryExpression();\n expr = finishUnaryExpression(token.value, expr);\n } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {\n throw new Error(DISABLED);\n } else {\n expr = parsePostfixExpression();\n }\n\n return expr;\n}\n\nfunction binaryPrecedence(token) {\n var prec = 0;\n\n if (token.type !== TokenPunctuator && token.type !== TokenKeyword) {\n return 0;\n }\n\n switch (token.value) {\n case '||':\n prec = 1;\n break;\n\n case '&&':\n prec = 2;\n break;\n\n case '|':\n prec = 3;\n break;\n\n case '^':\n prec = 4;\n break;\n\n case '&':\n prec = 5;\n break;\n\n case '==':\n case '!=':\n case '===':\n case '!==':\n prec = 6;\n break;\n\n case '<':\n case '>':\n case '<=':\n case '>=':\n case 'instanceof':\n case 'in':\n prec = 7;\n break;\n\n case '<<':\n case '>>':\n case '>>>':\n prec = 8;\n break;\n\n case '+':\n case '-':\n prec = 9;\n break;\n\n case '*':\n case '/':\n case '%':\n prec = 11;\n break;\n\n default:\n break;\n }\n\n return prec;\n}\n\n// 11.5 Multiplicative Operators\n// 11.6 Additive Operators\n// 11.7 Bitwise Shift Operators\n// 11.8 Relational Operators\n// 11.9 Equality Operators\n// 11.10 Binary Bitwise Operators\n// 11.11 Binary Logical Operators\n\nfunction parseBinaryExpression() {\n var marker, markers, expr, token, prec, stack, right, operator, left, i;\n\n marker = lookahead;\n left = parseUnaryExpression();\n\n token = lookahead;\n prec = binaryPrecedence(token);\n if (prec === 0) {\n return left;\n }\n token.prec = prec;\n lex();\n\n markers = [marker, lookahead];\n right = parseUnaryExpression();\n\n stack = [left, token, right];\n\n while ((prec = binaryPrecedence(lookahead)) > 0) {\n\n // Reduce: make a binary expression from the three topmost entries.\n while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {\n right = stack.pop();\n operator = stack.pop().value;\n left = stack.pop();\n markers.pop();\n expr = finishBinaryExpression(operator, left, right);\n stack.push(expr);\n }\n\n // Shift.\n token = lex();\n token.prec = prec;\n stack.push(token);\n markers.push(lookahead);\n expr = parseUnaryExpression();\n stack.push(expr);\n }\n\n // Final reduce to clean-up the stack.\n i = stack.length - 1;\n expr = stack[i];\n markers.pop();\n while (i > 1) {\n markers.pop();\n expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);\n i -= 2;\n }\n\n return expr;\n}\n\n// 11.12 Conditional Operator\n\nfunction parseConditionalExpression() {\n var expr, consequent, alternate;\n\n expr = parseBinaryExpression();\n\n if (match('?')) {\n lex();\n consequent = parseConditionalExpression();\n expect(':');\n alternate = parseConditionalExpression();\n\n expr = finishConditionalExpression(expr, consequent, alternate);\n }\n\n return expr;\n}\n\n// 11.14 Comma Operator\n\nfunction parseExpression() {\n var expr = parseConditionalExpression();\n\n if (match(',')) {\n throw new Error(DISABLED); // no sequence expressions\n }\n\n return expr;\n}\n\nexport default function(code) {\n source = code;\n index = 0;\n length = source.length;\n lookahead = null;\n\n peek();\n\n var expr = parseExpression();\n\n if (lookahead.type !== TokenEOF) {\n throw new Error('Unexpect token after expression.');\n }\n return expr;\n}\n","import {parse} from 'vega-expression';\n\nfunction getName(node: any) {\n const name: string[] = [];\n\n if (node.type === 'Identifier') {\n return [node.name];\n }\n\n if (node.type === 'Literal') {\n return [node.value];\n }\n\n if (node.type === 'MemberExpression') {\n name.push(...getName(node.object));\n name.push(...getName(node.property));\n }\n\n return name;\n}\n\nfunction startsWithDatum(node: any): boolean {\n if (node.object.type === 'MemberExpression') {\n return startsWithDatum(node.object);\n }\n return node.object.name === 'datum';\n}\n\nexport function getDependentFields(expression: string) {\n const ast = parse(expression);\n const dependents = new Set();\n ast.visit((node: any) => {\n if (node.type === 'MemberExpression' && startsWithDatum(node)) {\n dependents.add(getName(node).slice(1).join('.'));\n }\n });\n\n return dependents;\n}\n","import {FilterTransform as VgFilterTransform} from 'vega';\nimport {LogicalComposition} from '../../logical';\nimport {Predicate} from '../../predicate';\nimport {duplicate} from '../../util';\nimport {Model} from '../model';\nimport {expression} from '../predicate';\nimport {DataFlowNode} from './dataflow';\nimport {getDependentFields} from './expressions';\n\nexport class FilterNode extends DataFlowNode {\n private expr: string;\n private _dependentFields: Set;\n public clone() {\n return new FilterNode(null, this.model, duplicate(this.filter));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly model: Model,\n private readonly filter: LogicalComposition\n ) {\n super(parent);\n\n // TODO: refactor this to not take a node and\n // then add a static function makeFromOperand and make the constructor take only an expression\n this.expr = expression(this.model, this.filter, this);\n\n this._dependentFields = getDependentFields(this.expr);\n }\n\n public dependentFields() {\n return this._dependentFields;\n }\n\n public producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n\n public assemble(): VgFilterTransform {\n return {\n type: 'filter',\n expr: this.expr\n };\n }\n\n public hash() {\n return `Filter ${this.expr}`;\n }\n}\n","import {selector as parseSelector} from 'vega-event-selector';\nimport {isString, stringValue} from 'vega-util';\nimport {forEachSelection, SelectionComponent, STORE} from '.';\nimport {warn} from '../../log';\nimport {LogicalComposition} from '../../logical';\nimport {SelectionDef, SelectionExtent} from '../../selection';\nimport {Dict, duplicate, keys, logicalExpr, varName} from '../../util';\nimport {DataFlowNode, OutputNode} from '../data/dataflow';\nimport {FilterNode} from '../data/filter';\nimport {Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {forEachTransform} from './transforms/transforms';\nimport {DataSourceType} from '../../data';\n\nexport function parseUnitSelection(model: UnitModel, selDefs: Dict) {\n const selCmpts: Dict> = {};\n const selectionConfig = model.config.selection;\n\n for (const name of keys(selDefs ?? {})) {\n const selDef = duplicate(selDefs[name]);\n const {fields, encodings, ...cfg} = selectionConfig[selDef.type]; // Project transform applies its defaults.\n\n // Set default values from config if a property hasn't been specified,\n // or if it is true. E.g., \"translate\": true should use the default\n // event handlers for translate. However, true may be a valid value for\n // a property (e.g., \"nearest\": true).\n for (const key in cfg) {\n // A selection should contain either `encodings` or `fields`, only use\n // default values for these two values if neither of them is specified.\n if ((key === 'encodings' && selDef.fields) || (key === 'fields' && selDef.encodings)) {\n continue;\n }\n\n if (key === 'mark') {\n selDef[key] = {...cfg[key], ...selDef[key]};\n }\n\n if (selDef[key] === undefined || selDef[key] === true) {\n selDef[key] = cfg[key] ?? selDef[key];\n }\n }\n\n const safeName = varName(name);\n const selCmpt = (selCmpts[safeName] = {\n ...selDef,\n name: safeName,\n events: isString(selDef.on) ? parseSelector(selDef.on, 'scope') : duplicate(selDef.on)\n } as any);\n\n forEachTransform(selCmpt, txCompiler => {\n if (txCompiler.has(selCmpt) && txCompiler.parse) {\n txCompiler.parse(model, selCmpt, selDef, selDefs[name]);\n }\n });\n }\n\n return selCmpts;\n}\n\nexport function parseSelectionPredicate(\n model: Model,\n selections: LogicalComposition,\n dfnode?: DataFlowNode,\n datum = 'datum'\n): string {\n const stores: string[] = [];\n function expr(name: string): string {\n const vname = varName(name);\n const selCmpt = model.getSelectionComponent(vname, name);\n const store = stringValue(vname + STORE);\n\n if (selCmpt.project.timeUnit) {\n const child = dfnode ?? model.component.data.raw;\n const tunode = selCmpt.project.timeUnit.clone();\n if (child.parent) {\n tunode.insertAsParentOf(child);\n } else {\n child.parent = tunode;\n }\n }\n\n if (selCmpt.empty !== 'none') {\n stores.push(store);\n }\n\n return (\n `vlSelectionTest(${store}, ${datum}` + (selCmpt.resolve === 'global' ? ')' : `, ${stringValue(selCmpt.resolve)})`)\n );\n }\n\n const predicateStr = logicalExpr(selections, expr);\n return (\n (stores.length ? '!(' + stores.map(s => `length(data(${s}))`).join(' || ') + ') || ' : '') + `(${predicateStr})`\n );\n}\n\nexport function parseSelectionBinExtent(selCmpt: SelectionComponent, extent: SelectionExtent) {\n const encoding = extent['encoding'];\n let field = extent['field'];\n\n if (!encoding && !field) {\n field = selCmpt.project.items[0].field;\n if (selCmpt.project.items.length > 1) {\n warn(\n 'A \"field\" or \"encoding\" must be specified when using a selection as a scale domain. ' +\n `Using \"field\": ${stringValue(field)}.`\n );\n }\n } else if (encoding && !field) {\n const encodings = selCmpt.project.items.filter(p => p.channel === encoding);\n if (!encodings.length || encodings.length > 1) {\n field = selCmpt.project.items[0].field;\n warn(\n (!encodings.length ? 'No ' : 'Multiple ') +\n `matching ${stringValue(encoding)} encoding found for selection ${stringValue(extent.selection)}. ` +\n `Using \"field\": ${stringValue(field)}.`\n );\n } else {\n field = encodings[0].field;\n }\n }\n\n return `${selCmpt.name}[${stringValue(field)}]`;\n}\n\nexport function materializeSelections(model: UnitModel, main: OutputNode) {\n forEachSelection(model, selCmpt => {\n const selection = selCmpt.name;\n const lookupName = model.getName(`lookup_${selection}`);\n model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(\n new FilterNode(main, model, {selection}),\n lookupName,\n DataSourceType.Lookup,\n model.component.data.outputNodeRefCounts\n );\n });\n}\n","import {isString} from 'vega-util';\nimport {LogicalComposition} from '../logical';\nimport {fieldFilterExpression, isSelectionPredicate, Predicate} from '../predicate';\nimport {logicalExpr} from '../util';\nimport {DataFlowNode} from './data/dataflow';\nimport {Model} from './model';\nimport {parseSelectionPredicate} from './selection/parse';\n\n/**\n * Converts a predicate into an expression.\n */\n// model is only used for selection filters.\nexport function expression(model: Model, filterOp: LogicalComposition, node?: DataFlowNode): string {\n return logicalExpr(filterOp, (predicate: Predicate) => {\n if (isString(predicate)) {\n return predicate;\n } else if (isSelectionPredicate(predicate)) {\n return parseSelectionPredicate(model, predicate.selection, node);\n } else {\n // Filter Object\n return fieldFilterExpression(predicate);\n }\n });\n}\n","import {Axis as VgAxis, AxisEncode, NewSignal, SignalRef, Text} from 'vega';\nimport {array, isArray} from 'vega-util';\nimport {AXIS_PARTS, AXIS_PROPERTY_TYPE, CONDITIONAL_AXIS_PROP_INDEX, isConditionalAxisValue} from '../../axis';\nimport {POSITION_SCALE_CHANNELS} from '../../channel';\nimport {defaultTitle, FieldDefBase} from '../../channeldef';\nimport {Config} from '../../config';\nimport {isText} from '../../title';\nimport {getFirstDefined, isEmpty, replaceAll} from '../../util';\nimport {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema';\nimport {exprFromValueOrSignalRef} from '../common';\nimport {Model} from '../model';\nimport {expression} from '../predicate';\nimport {AxisComponent, AxisComponentIndex} from './component';\n\nfunction assembleTitle(title: Text | FieldDefBase[] | SignalRef, config: Config): Text | SignalRef {\n if (!title) {\n return undefined;\n }\n if (isArray(title) && !isText(title)) {\n return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', ');\n }\n return title;\n}\n\nfunction setAxisEncode(\n axis: Omit,\n part: keyof AxisEncode,\n vgProp: VgEncodeChannel,\n vgRef: VgValueRef | readonly VgValueRef[]\n) {\n axis.encode = axis.encode ?? {};\n axis.encode[part] = axis.encode[part] ?? {};\n axis.encode[part].update = axis.encode[part].update ?? {};\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n (axis.encode[part].update[vgProp] as any) = vgRef;\n}\n\nexport function assembleAxis(\n axisCmpt: AxisComponent,\n kind: 'main' | 'grid',\n config: Config,\n opt: {\n header: boolean; // whether this is called via a header\n } = {header: false}\n): VgAxis {\n const {disable, orient, scale, labelExpr, title, zindex, ...axis} = axisCmpt.combine();\n\n if (disable) {\n return undefined;\n }\n\n for (const prop in axis) {\n const propType = AXIS_PROPERTY_TYPE[prop];\n const propValue = axis[prop];\n\n if (propType && propType !== kind && propType !== 'both') {\n // Remove properties that are not valid for this kind of axis\n delete axis[prop];\n } else if (isConditionalAxisValue(propValue)) {\n // deal with conditional axis value\n\n const {condition, ...valueOrSignalRef} = propValue;\n const conditions = array(condition);\n\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n // If there is a corresponding Vega property for the channel,\n // use Vega's custom axis encoding and delete the original axis property to avoid conflicts\n\n const vgRef = [\n ...conditions.map(c => {\n const {test, ...valueOrSignalCRef} = c;\n return {\n test: expression(null, test),\n ...valueOrSignalCRef\n };\n }),\n valueOrSignalRef\n ];\n setAxisEncode(axis, part, vgProp, vgRef);\n delete axis[prop];\n } else if (propIndex === null) {\n // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead.\n const signalRef: SignalRef = {\n signal:\n conditions\n .map(c => {\n const {test, ...valueOrSignalCRef} = c;\n return `${expression(null, test)} ? ${exprFromValueOrSignalRef(valueOrSignalCRef)} : `;\n })\n .join('') + exprFromValueOrSignalRef(valueOrSignalRef)\n };\n axis[prop] = signalRef;\n }\n } else if (isSignalRef(propValue)) {\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n setAxisEncode(axis, part, vgProp, propValue);\n delete axis[prop];\n } // else do nothing since the property already supports signal\n }\n }\n\n if (kind === 'grid') {\n if (!axis.grid) {\n return undefined;\n }\n\n // Remove unnecessary encode block\n if (axis.encode) {\n // Only need to keep encode block for grid\n const {grid} = axis.encode;\n axis.encode = {\n ...(grid ? {grid} : {})\n };\n\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n\n return {\n scale,\n orient,\n ...axis,\n domain: false,\n labels: false,\n aria: false, // always hide grid axis\n\n // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent`\n // would not affect gridAxis\n maxExtent: 0,\n minExtent: 0,\n ticks: false,\n zindex: getFirstDefined(zindex, 0) // put grid behind marks by default\n };\n } else {\n // kind === 'main'\n\n if (!opt.header && axisCmpt.mainExtracted) {\n // if mainExtracted has been extracted to a separate facet\n return undefined;\n }\n\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (axis.encode?.labels?.update && isSignalRef(axis.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal);\n }\n setAxisEncode(axis, 'labels', 'text', {signal: expr});\n }\n\n if (axis.labelAlign === null) {\n delete axis.labelAlign;\n }\n\n // Remove unnecessary encode block\n if (axis.encode) {\n for (const part of AXIS_PARTS) {\n if (!axisCmpt.hasAxisPart(part)) {\n delete axis.encode[part];\n }\n }\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n\n const titleString = assembleTitle(title, config);\n\n return {\n scale,\n orient,\n grid: false,\n ...(titleString ? {title: titleString} : {}),\n ...axis,\n ...(config.aria === false ? {aria: false} : {}),\n zindex: getFirstDefined(zindex, 0) // put axis line above marks by default\n };\n }\n}\n\n/**\n * Add axis signals so grid line works correctly\n * (Fix https://github.com/vega/vega-lite/issues/4226)\n */\nexport function assembleAxisSignals(model: Model): NewSignal[] {\n const {axes} = model.component;\n const signals: NewSignal[] = [];\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n if (axes[channel]) {\n for (const axis of axes[channel]) {\n if (!axis.get('disable') && !axis.get('gridScale')) {\n // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width.\n\n const sizeType = channel === 'x' ? 'height' : 'width';\n const update = model.getSizeSignalRef(sizeType).signal;\n\n if (sizeType !== update) {\n signals.push({\n name: sizeType,\n update: update\n });\n }\n }\n }\n }\n }\n return signals;\n}\n\nexport function assembleAxes(axisComponents: AxisComponentIndex, config: Config): VgAxis[] {\n const {x = [], y = []} = axisComponents;\n return [\n ...x.map(a => assembleAxis(a, 'grid', config)),\n ...y.map(a => assembleAxis(a, 'grid', config)),\n ...x.map(a => assembleAxis(a, 'main', config)),\n ...y.map(a => assembleAxis(a, 'main', config))\n ].filter(a => a); // filter undefined\n}\n","import {Align, Color, FontStyle, FontWeight, Orient, SignalRef, TextBaseline, TitleAnchor, TitleConfig} from 'vega';\nimport {FormatMixins, Guide, VlOnlyGuideConfig} from './guide';\nimport {keys} from './util';\n\nexport const HEADER_TITLE_PROPERTIES_MAP: Partial> = {\n titleAlign: 'align',\n titleAnchor: 'anchor',\n titleAngle: 'angle',\n titleBaseline: 'baseline',\n titleColor: 'color',\n titleFont: 'font',\n titleFontSize: 'fontSize',\n titleFontStyle: 'fontStyle',\n titleFontWeight: 'fontWeight',\n titleLimit: 'limit',\n titleLineHeight: 'lineHeight',\n titleOrient: 'orient',\n titlePadding: 'offset'\n};\n\nexport const HEADER_LABEL_PROPERTIES_MAP: Partial> = {\n labelAlign: 'align',\n labelAnchor: 'anchor',\n labelAngle: 'angle',\n labelBaseline: 'baseline',\n labelColor: 'color',\n labelFont: 'font',\n labelFontSize: 'fontSize',\n labelFontStyle: 'fontStyle',\n labelFontWeight: 'fontWeight',\n labelLimit: 'limit',\n labelLineHeight: 'lineHeight',\n labelOrient: 'orient',\n labelPadding: 'offset'\n};\n\nexport const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP);\n\nexport const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP);\n\nexport interface CoreHeader extends FormatMixins {\n // ---------- Title ----------\n /**\n * The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.\n */\n titleAnchor?: TitleAnchor; // We don't allow signal for titleAnchor since there is a dependent logic\n\n /**\n * Horizontal text alignment (to the anchor) of header titles.\n */\n titleAlign?: Align | SignalRef;\n\n /**\n * The rotation angle of the header title.\n *\n * __Default value:__ `0`.\n *\n * @minimum -360\n * @maximum 360\n */\n titleAngle?: number; // We don't allow signal for titleAngle since there is a dependent logic\n\n /**\n * The vertical text baseline for the header title. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n *\n * __Default value:__ `\"middle\"`\n */\n titleBaseline?: TextBaseline | SignalRef;\n\n /**\n * Color of the header title, can be in hex color code or regular color name.\n */\n titleColor?: Color | SignalRef;\n\n /**\n * Font of the header title. (e.g., `\"Helvetica Neue\"`).\n */\n titleFont?: string | SignalRef;\n\n /**\n * Font size of the header title.\n *\n * @minimum 0\n */\n titleFontSize?: number | SignalRef;\n\n /**\n * The font style of the header title.\n */\n titleFontStyle?: FontStyle | SignalRef;\n\n /**\n * Font weight of the header title.\n * This can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`).\n */\n titleFontWeight?: FontWeight | SignalRef;\n\n /**\n * The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n *\n * __Default value:__ `0`, indicating no limit\n */\n titleLimit?: number | SignalRef;\n\n /**\n * Line height in pixels for multi-line header title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.\n */\n titleLineHeight?: number | SignalRef;\n\n /**\n * The orientation of the header title. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`.\n */\n titleOrient?: Orient;\n\n /**\n * The padding, in pixel, between facet header's title and the label.\n *\n * __Default value:__ `10`\n */\n titlePadding?: number | SignalRef;\n\n // ---------- Label ----------\n\n /**\n * A boolean flag indicating if labels should be included as part of the header.\n *\n * __Default value:__ `true`.\n */\n labels?: boolean;\n\n /**\n * Horizontal text alignment of header labels. One of `\"left\"`, `\"center\"`, or `\"right\"`.\n */\n labelAlign?: Align | SignalRef;\n\n /**\n * The vertical text baseline for the header labels. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n *\n */\n labelBaseline?: TextBaseline | SignalRef;\n\n /**\n * The anchor position for placing the labels. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label.\n */\n labelAnchor?: TitleAnchor;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the header's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * The rotation angle of the header labels.\n *\n * __Default value:__ `0` for column header, `-90` for row header.\n *\n * @minimum -360\n * @maximum 360\n */\n labelAngle?: number; // no signal ref since there is a dependent logic\n\n /**\n * The color of the header label, can be in hex color code or regular color name.\n */\n labelColor?: Color | SignalRef;\n\n /**\n * The font of the header label.\n */\n labelFont?: string | SignalRef;\n\n /**\n * The font size of the header label, in pixels.\n *\n * @minimum 0\n */\n labelFontSize?: number | SignalRef;\n\n /**\n * The font style of the header label.\n */\n labelFontStyle?: FontStyle | SignalRef;\n\n /**\n * The font weight of the header label.\n */\n labelFontWeight?: FontWeight | SignalRef;\n\n /**\n * The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n *\n * __Default value:__ `0`, indicating no limit\n */\n labelLimit?: number | SignalRef;\n\n /**\n * Line height in pixels for multi-line header labels or title text with `\"line-top\"` or `\"line-bottom\"` baseline.\n */\n labelLineHeight?: number | SignalRef;\n\n /**\n * The orientation of the header label. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`.\n */\n labelOrient?: Orient; // no signal ref since there is a dependent logic\n\n /**\n * The padding, in pixel, between facet header's label and the plot.\n *\n * __Default value:__ `10`\n */\n labelPadding?: number | SignalRef;\n\n /**\n * Shortcut for setting both labelOrient and titleOrient.\n */\n orient?: Orient; // no signal ref since there is a dependent logic\n}\n\nexport interface HeaderConfig extends CoreHeader, VlOnlyGuideConfig {}\n\n/**\n * Headers of row / column channels for faceted plots.\n */\nexport interface Header extends CoreHeader, Guide {}\n\nexport interface HeaderConfigMixins {\n /**\n * Header configuration, which determines default properties for all [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n header?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for row [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerRow?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for column [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerColumn?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for non-row/column facet [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerFacet?: HeaderConfig;\n}\n","import {ScaleType, SignalRef} from 'vega';\nimport {array} from 'vega-util';\nimport {AxisConfig} from '../../axis';\nimport {PositionScaleChannel} from '../../channel';\nimport {Config, StyleConfigIndex} from '../../config';\nimport {isQuantitative} from '../../scale';\nimport {keys, titleCase} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {getStyleConfig, signalOrStringValue} from '../common';\n\nfunction getAxisConfigFromConfigTypes(\n configTypes: string[],\n config: Config,\n channel: 'x' | 'y',\n orient: string | SignalRef\n) {\n // TODO: add special casing to add conditional value based on orient signal\n return Object.assign.apply(null, [\n {},\n ...configTypes.map(configType => {\n if (configType === 'axisOrient') {\n const orient1 = channel === 'x' ? 'bottom' : 'left';\n const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {};\n const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {};\n\n const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]);\n\n const conditionalOrientAxisConfig = {};\n for (const prop of props.values()) {\n conditionalOrientAxisConfig[prop] = {\n // orient is surely signal in this case\n signal: `${orient['signal']} === \"${orient1}\" ? ${signalOrStringValue(\n orientConfig1[prop]\n )} : ${signalOrStringValue(orientConfig2[prop])}`\n };\n }\n\n return conditionalOrientAxisConfig;\n }\n\n return config[configType];\n })\n ]);\n}\n\nexport type AxisConfigs = ReturnType;\n\nexport function getAxisConfigs(\n channel: PositionScaleChannel,\n scaleType: ScaleType,\n orient: string | SignalRef,\n config: Config\n) {\n const typeBasedConfigTypes =\n scaleType === 'band'\n ? ['axisDiscrete', 'axisBand']\n : scaleType === 'point'\n ? ['axisDiscrete', 'axisPoint']\n : isQuantitative(scaleType)\n ? ['axisQuantitative']\n : scaleType === 'time' || scaleType === 'utc'\n ? ['axisTemporal']\n : [];\n\n const axisChannel = channel === 'x' ? 'axisX' : 'axisY';\n const axisOrient = isSignalRef(orient) ? 'axisOrient' : 'axis' + titleCase(orient); // axisTop, axisBottom, ...\n\n const vlOnlyConfigTypes = [\n // technically Vega does have axisBand, but if we make another separation here,\n // it will further introduce complexity in the code\n ...typeBasedConfigTypes,\n ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4))\n ];\n\n const vgConfigTypes = ['axis', axisOrient, axisChannel];\n\n return {\n vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient),\n vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient),\n axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config)\n };\n}\n\nexport function getAxisConfigStyle(axisConfigTypes: string[], config: Config) {\n const toMerge = [{}];\n for (const configType of axisConfigTypes) {\n // TODO: add special casing to add conditional value based on orient signal\n let style = config[configType]?.style;\n if (style) {\n style = array(style);\n for (const s of style) {\n toMerge.push(config.style[s]);\n }\n }\n }\n return Object.assign.apply(null, toMerge);\n}\nexport function getAxisConfig(\n property: keyof AxisConfig,\n styleConfigIndex: StyleConfigIndex,\n style: string | string[],\n axisConfigs: Partial = {}\n): {configFrom?: string; configValue?: any} {\n const styleConfig = getStyleConfig(property, style, styleConfigIndex);\n\n if (styleConfig !== undefined) {\n return {\n configFrom: 'style',\n configValue: styleConfig\n };\n }\n\n for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) {\n if (axisConfigs[configFrom]?.[property] !== undefined) {\n return {configFrom, configValue: axisConfigs[configFrom][property]};\n }\n }\n return {};\n}\n","import {Align, AxisOrient, Orient, SignalRef} from 'vega';\nimport {isArray, isObject} from 'vega-util';\nimport {Axis} from '../../axis';\nimport {isBinned, isBinning} from '../../bin';\nimport {PositionScaleChannel, X} from '../../channel';\nimport {\n DatumDef,\n isDiscrete,\n isFieldDef,\n PositionDatumDef,\n PositionFieldDef,\n toFieldDefBase,\n TypedFieldDef,\n valueArray\n} from '../../channeldef';\nimport {Config, StyleConfigIndex} from '../../config';\nimport {Mark} from '../../mark';\nimport {hasDiscreteDomain} from '../../scale';\nimport {Sort} from '../../sort';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport {NOMINAL, ORDINAL, Type} from '../../type';\nimport {contains, normalizeAngle} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {mergeTitle, mergeTitleFieldDefs} from '../common';\nimport {guideFormat, guideFormatType} from '../format';\nimport {UnitModel} from '../unit';\nimport {ScaleType} from './../../scale';\nimport {AxisComponentProps} from './component';\nimport {AxisConfigs, getAxisConfig} from './config';\n\nexport interface AxisRuleParams {\n fieldOrDatumDef: PositionFieldDef | PositionDatumDef;\n axis: Axis;\n channel: PositionScaleChannel;\n model: UnitModel;\n\n mark: Mark;\n scaleType: ScaleType;\n orient: Orient | SignalRef;\n labelAngle: number | SignalRef;\n config: Config;\n}\n\nexport const axisRules: {\n [k in keyof AxisComponentProps]?: (params: AxisRuleParams) => AxisComponentProps[k];\n} = {\n scale: ({model, channel}) => model.scaleName(channel),\n\n format: ({fieldOrDatumDef, config, axis}) => {\n const {format, formatType} = axis;\n return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, true);\n },\n\n formatType: ({axis, fieldOrDatumDef, scaleType}) => {\n const {formatType} = axis;\n return guideFormatType(formatType, fieldOrDatumDef, scaleType);\n },\n\n grid: ({fieldOrDatumDef, axis, scaleType}) => {\n if (isFieldDef(fieldOrDatumDef) && isBinned(fieldOrDatumDef.bin)) {\n return false;\n } else {\n return axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef);\n }\n },\n\n gridScale: ({model, channel}) => gridScale(model, channel),\n\n labelAlign: ({axis, labelAngle, orient, channel}) =>\n axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel),\n\n labelAngle: ({labelAngle}) => labelAngle, // we already calculate this in parse\n\n labelBaseline: ({axis, labelAngle, orient, channel}) =>\n axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel),\n\n labelFlush: ({axis, fieldOrDatumDef, channel}) => axis.labelFlush ?? defaultLabelFlush(fieldOrDatumDef.type, channel),\n\n labelOverlap: ({axis, fieldOrDatumDef, scaleType}) =>\n axis.labelOverlap ??\n defaultLabelOverlap(\n fieldOrDatumDef.type,\n scaleType,\n isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit,\n isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined\n ),\n\n // we already calculate orient in parse\n orient: ({orient}) => orient as AxisOrient, // Need to cast until Vega supports signal\n\n tickCount: ({channel, model, axis, fieldOrDatumDef, scaleType}) => {\n const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;\n const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined;\n return axis.tickCount ?? defaultTickCount({fieldOrDatumDef, scaleType, size, values: axis.values});\n },\n\n title: ({axis, model, channel}) => {\n if (axis.title !== undefined) {\n return axis.title;\n }\n const fieldDefTitle = getFieldDefTitle(model, channel);\n if (fieldDefTitle !== undefined) {\n return fieldDefTitle;\n }\n const fieldDef = model.typedFieldDef(channel);\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = model.fieldDef(channel2);\n\n // If title not specified, store base parts of fieldDef (and fieldDef2 if exists)\n return mergeTitleFieldDefs(\n fieldDef ? [toFieldDefBase(fieldDef)] : [],\n isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []\n );\n },\n\n values: ({axis, fieldOrDatumDef}) => values(axis, fieldOrDatumDef),\n\n zindex: ({axis, fieldOrDatumDef, mark}) => axis.zindex ?? defaultZindex(mark, fieldOrDatumDef)\n};\n\n// TODO: we need to refactor this method after we take care of config refactoring\n/**\n * Default rules for whether to show a grid should be shown for a channel.\n * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned\n */\n\nexport function defaultGrid(scaleType: ScaleType, fieldDef: TypedFieldDef | DatumDef) {\n return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin);\n}\n\nexport function gridScale(model: UnitModel, channel: PositionScaleChannel) {\n const gridChannel: PositionScaleChannel = channel === 'x' ? 'y' : 'x';\n if (model.getScaleComponent(gridChannel)) {\n return model.scaleName(gridChannel);\n }\n return undefined;\n}\n\nexport function getLabelAngle(\n fieldOrDatumDef: PositionFieldDef | PositionDatumDef,\n axis: Axis,\n channel: PositionScaleChannel,\n styleConfig: StyleConfigIndex,\n axisConfigs?: AxisConfigs\n) {\n const labelAngle = axis?.labelAngle;\n // try axis value\n if (labelAngle !== undefined) {\n return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle);\n } else {\n // try axis config value\n const {configValue: angle} = getAxisConfig('labelAngle', styleConfig, axis?.style, axisConfigs);\n if (angle !== undefined) {\n return normalizeAngle(angle);\n } else {\n // get default value\n if (\n channel === X &&\n contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) &&\n !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)\n ) {\n return 270;\n }\n // no default\n return undefined;\n }\n }\n}\n\nexport function normalizeAngleExpr(angle: SignalRef) {\n return `(((${angle.signal} % 360) + 360) % 360)`;\n}\n\nexport function defaultLabelBaseline(\n angle: number | SignalRef,\n orient: AxisOrient | SignalRef,\n channel: 'x' | 'y',\n alwaysIncludeMiddle?: boolean\n) {\n if (angle !== undefined) {\n if (channel === 'x') {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === \"top\")` : orient === 'top';\n return {\n signal:\n `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? \"middle\" :` +\n `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? \"bottom\" : \"top\"`\n };\n }\n\n if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) {\n return 'middle';\n }\n\n if (isSignalRef(orient)) {\n const op = angle <= 45 || 315 <= angle ? '===' : '!==';\n return {signal: `${orient.signal} ${op} \"top\" ? \"bottom\" : \"top\"`};\n }\n\n return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top';\n } else {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === \"left\")` : orient === 'left';\n const middle = alwaysIncludeMiddle ? '\"middle\"' : 'null';\n return {\n signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? \"top\" : \"bottom\"`\n };\n }\n\n if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) {\n return alwaysIncludeMiddle ? 'middle' : null;\n }\n\n if (isSignalRef(orient)) {\n const op = 45 <= angle && angle <= 135 ? '===' : '!==';\n return {signal: `${orient.signal} ${op} \"left\" ? \"top\" : \"bottom\"`};\n }\n\n return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom';\n }\n }\n return undefined;\n}\n\nexport function defaultLabelAlign(\n angle: number | SignalRef,\n orient: AxisOrient | SignalRef,\n channel: 'x' | 'y'\n): Align | SignalRef {\n if (angle === undefined) {\n return undefined;\n }\n\n const isX = channel === 'x';\n const startAngle = isX ? 0 : 90;\n const mainOrient = isX ? 'bottom' : 'left';\n\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === \"${mainOrient}\")` : orient === mainOrient;\n return {\n signal:\n `(${startAngle ? '(' + a + ' + 90)' : a} % 180 === 0) ? ${isX ? null : '\"center\"'} :` +\n `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n\n if ((angle + startAngle) % 180 === 0) {\n // For bottom, use default label align so label flush still works\n return isX ? null : 'center';\n }\n\n if (isSignalRef(orient)) {\n const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!==';\n const orientIsMain = `${orient.signal} ${op} \"${mainOrient}\"`;\n return {\n signal: `${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n\n if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) {\n return 'left';\n }\n\n return 'right';\n}\n\nexport function defaultLabelFlush(type: Type, channel: PositionScaleChannel) {\n if (channel === 'x' && contains(['quantitative', 'temporal'], type)) {\n return true;\n }\n return undefined;\n}\n\nexport function defaultLabelOverlap(type: Type, scaleType: ScaleType, hasTimeUnit: boolean, sort?: Sort) {\n // do not prevent overlap for nominal data because there is no way to infer what the missing labels are\n if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) {\n if (scaleType === 'log') {\n return 'greedy';\n }\n return true;\n }\n return undefined;\n}\n\nexport function defaultOrient(channel: PositionScaleChannel) {\n return channel === 'x' ? 'bottom' : 'left';\n}\n\nexport function defaultTickCount({\n fieldOrDatumDef,\n scaleType,\n size,\n values: vals\n}: {\n fieldOrDatumDef: TypedFieldDef | DatumDef;\n scaleType: ScaleType;\n size?: SignalRef;\n values?: Axis['values'];\n}) {\n if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') {\n if (isFieldDef(fieldOrDatumDef)) {\n if (isBinning(fieldOrDatumDef.bin)) {\n // for binned data, we don't want more ticks than maxbins\n return {signal: `ceil(${size.signal}/10)`};\n }\n\n if (\n fieldOrDatumDef.timeUnit &&\n contains(['month', 'hours', 'day', 'quarter'], normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit)\n ) {\n return undefined;\n }\n }\n\n return {signal: `ceil(${size.signal}/40)`};\n }\n\n return undefined;\n}\n\nexport function getFieldDefTitle(model: UnitModel, channel: 'x' | 'y') {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef = model.fieldDef(channel);\n const fieldDef2 = model.fieldDef(channel2);\n\n const title1 = fieldDef ? fieldDef.title : undefined;\n const title2 = fieldDef2 ? fieldDef2.title : undefined;\n\n if (title1 && title2) {\n return mergeTitle(title1, title2);\n } else if (title1) {\n return title1;\n } else if (title2) {\n return title2;\n } else if (title1 !== undefined) {\n // falsy value to disable config\n return title1;\n } else if (title2 !== undefined) {\n // falsy value to disable config\n return title2;\n }\n\n return undefined;\n}\n\nexport function values(axis: Axis, fieldOrDatumDef: TypedFieldDef | DatumDef) {\n const vals = axis.values;\n\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n } else if (isSignalRef(vals)) {\n return vals;\n }\n\n return undefined;\n}\n\nexport function defaultZindex(mark: Mark, fieldDef: TypedFieldDef | DatumDef) {\n if (mark === 'rect' && isDiscrete(fieldDef)) {\n return 1;\n }\n return 0;\n}\n","import {FormulaTransform as VgFormulaTransform} from 'vega';\nimport {SingleDefChannel} from '../../channel';\nimport {FieldRefOption, isScaleFieldDef, TypedFieldDef, vgField} from '../../channeldef';\nimport {DateTime} from '../../datetime';\nimport {fieldFilterExpression} from '../../predicate';\nimport {isSortArray} from '../../sort';\nimport {CalculateTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {ModelWithField} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {getDependentFields} from './expressions';\n\nexport class CalculateNode extends DataFlowNode {\n private _dependentFields: Set;\n\n public clone() {\n return new CalculateNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private readonly transform: CalculateTransform) {\n super(parent);\n\n this._dependentFields = getDependentFields(this.transform.calculate);\n }\n\n public static parseAllForSortIndex(parent: DataFlowNode, model: ModelWithField) {\n // get all the encoding with sort fields from model\n model.forEachFieldDef((fieldDef: TypedFieldDef, channel: SingleDefChannel) => {\n if (!isScaleFieldDef(fieldDef)) {\n return;\n }\n if (isSortArray(fieldDef.sort)) {\n const {field, timeUnit} = fieldDef;\n const sort: (number | string | boolean | DateTime)[] = fieldDef.sort;\n // generate `datum[\"a\"] === val0 ? 0 : datum[\"a\"] === val1 ? 1 : ... : n` via FieldEqualPredicate\n const calculate =\n sort\n .map((sortValue, i) => {\n return `${fieldFilterExpression({field, timeUnit, equal: sortValue})} ? ${i} : `;\n })\n .join('') + sort.length;\n\n parent = new CalculateNode(parent, {\n calculate,\n as: sortArrayIndexField(fieldDef, channel, {forAs: true})\n });\n }\n });\n return parent;\n }\n\n public producedFields() {\n return new Set([this.transform.as]);\n }\n\n public dependentFields() {\n return this._dependentFields;\n }\n\n public assemble(): VgFormulaTransform {\n return {\n type: 'formula',\n expr: this.transform.calculate,\n as: this.transform.as\n };\n }\n\n public hash() {\n return `Calculate ${hash(this.transform)}`;\n }\n}\n\nexport function sortArrayIndexField(fieldDef: TypedFieldDef, channel: SingleDefChannel, opt?: FieldRefOption) {\n return vgField(fieldDef, {prefix: channel, suffix: 'sort_index', ...(opt ?? {})});\n}\n","import {Orient} from 'vega';\nimport {FacetChannel} from '../../channel';\nimport {Config} from '../../config';\nimport {Header} from '../../header';\nimport {FacetFieldDef} from '../../spec/facet';\nimport {contains, getFirstDefined} from '../../util';\nimport {HeaderChannel} from './component';\n\n/**\n * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet.\n */\nexport function getHeaderChannel(channel: FacetChannel, orient: Orient): HeaderChannel {\n if (contains(['top', 'bottom'], orient)) {\n return 'column';\n } else if (contains(['left', 'right'], orient)) {\n return 'row';\n }\n return channel === 'row' ? 'row' : 'column';\n}\n\nexport function getHeaderProperty

(\n prop: P,\n facetFieldDef: FacetFieldDef,\n config: Config,\n channel: FacetChannel\n): Header[P] {\n const headerSpecificConfig =\n channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet;\n\n return getFirstDefined((facetFieldDef?.header || {})[prop], headerSpecificConfig[prop], config.header[prop]);\n}\n\nexport function getHeaderProperties(\n properties: (keyof Header)[],\n facetFieldDef: FacetFieldDef,\n config: Config,\n channel: FacetChannel\n): Header {\n const props = {};\n for (const prop of properties) {\n const value = getHeaderProperty(prop, facetFieldDef, config, channel);\n if (value !== undefined) {\n props[prop] = value;\n }\n }\n return props;\n}\n","/**\n * Utility for generating row / column headers\n */\nimport {Axis as VgAxis, SignalRef, Text} from 'vega';\nimport {FacetFieldDef} from '../../spec/facet';\n\nexport type HeaderChannel = 'row' | 'column';\nexport const HEADER_CHANNELS: HeaderChannel[] = ['row', 'column'];\n\nexport type HeaderType = 'header' | 'footer';\nexport const HEADER_TYPES: HeaderType[] = ['header', 'footer'];\n\nexport interface LayoutHeaderComponentIndex {\n row?: LayoutHeaderComponent;\n column?: LayoutHeaderComponent;\n facet?: LayoutHeaderComponent;\n}\n\n/**\n * A component that represents all header, footers and title of a Vega group with layout directive.\n */\nexport interface LayoutHeaderComponent {\n title?: Text | SignalRef;\n\n // TODO: concat can have multiple header / footer.\n // Need to redesign this part a bit.\n\n facetFieldDef?: FacetFieldDef;\n\n /**\n * An array of header components for headers.\n * For facet, there should be only one header component, which is data-driven.\n * For concat, there can be multiple header components that explicitly list different axes.\n */\n header?: HeaderComponent[];\n\n /**\n * An array of header components for footers.\n * For facet, there should be only one header component, which is data-driven.\n * For concat, there can be multiple header components that explicitly list different axes.\n */\n footer?: HeaderComponent[];\n}\n\n/**\n * A component that represents one group of row/column-header/footer.\n */\nexport interface HeaderComponent {\n labels: boolean;\n\n sizeSignal: {signal: string};\n\n axes: VgAxis[];\n}\n","/**\n * Utility for generating row / column headers\n */\n\nimport {TitleAnchor, TitleConfig} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FacetChannel, FACET_CHANNELS} from '../../channel';\nimport {vgField} from '../../channeldef';\nimport {Config} from '../../config';\nimport {\n CoreHeader,\n HEADER_LABEL_PROPERTIES,\n HEADER_LABEL_PROPERTIES_MAP,\n HEADER_TITLE_PROPERTIES,\n HEADER_TITLE_PROPERTIES_MAP\n} from '../../header';\nimport {isSortField} from '../../sort';\nimport {FacetFieldDef, isFacetMapping} from '../../spec/facet';\nimport {contains, isEmpty, normalizeAngle, replaceAll} from '../../util';\nimport {RowCol, VgComparator, VgMarkGroup, VgTitle} from '../../vega.schema';\nimport {defaultLabelAlign, defaultLabelBaseline} from '../axis/properties';\nimport {sortArrayIndexField} from '../data/calculate';\nimport {formatSignalRef} from '../format';\nimport {isFacetModel, Model} from '../model';\nimport {getHeaderChannel, getHeaderProperties, getHeaderProperty} from './common';\nimport {\n HeaderChannel,\n HeaderComponent,\n HeaderType,\n HEADER_TYPES,\n LayoutHeaderComponent,\n LayoutHeaderComponentIndex\n} from './component';\n\n// TODO: rename to assembleHeaderTitleGroup\nexport function assembleTitleGroup(model: Model, channel: FacetChannel) {\n const title = model.component.layoutHeaders[channel].title;\n const config = model.config ? model.config : undefined;\n const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef\n ? model.component.layoutHeaders[channel].facetFieldDef\n : undefined;\n\n const {titleAnchor, titleAngle: ta, titleOrient} = getHeaderProperties(\n ['titleAnchor', 'titleAngle', 'titleOrient'],\n facetFieldDef,\n config,\n channel\n );\n const headerChannel = getHeaderChannel(channel, titleOrient);\n\n const titleAngle = normalizeAngle(ta);\n\n return {\n name: `${channel}-title`,\n type: 'group',\n role: `${headerChannel}-title`,\n title: {\n text: title,\n ...(channel === 'row' ? {orient: 'left'} : {}),\n style: 'guide-title',\n ...defaultHeaderGuideBaseline(titleAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)\n }\n };\n}\n\nexport function defaultHeaderGuideAlign(headerChannel: HeaderChannel, angle: number, anchor: TitleAnchor = 'middle') {\n switch (anchor) {\n case 'start':\n return {align: 'left'};\n case 'end':\n return {align: 'right'};\n }\n\n const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x');\n return align ? {align} : {};\n}\n\nexport function defaultHeaderGuideBaseline(angle: number, channel: FacetChannel) {\n const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true);\n return baseline ? {baseline} : {};\n}\n\nexport function assembleHeaderGroups(model: Model, channel: HeaderChannel): VgMarkGroup[] {\n const layoutHeader = model.component.layoutHeaders[channel];\n const groups = [];\n for (const headerType of HEADER_TYPES) {\n if (layoutHeader[headerType]) {\n for (const headerComponent of layoutHeader[headerType]) {\n const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent);\n if (group != null) {\n groups.push(group);\n }\n }\n }\n }\n return groups;\n}\n\nfunction getSort(facetFieldDef: FacetFieldDef, channel: HeaderChannel): VgComparator {\n const {sort} = facetFieldDef;\n if (isSortField(sort)) {\n return {\n field: vgField(sort, {expr: 'datum'}),\n order: sort.order ?? 'ascending'\n };\n } else if (isArray(sort)) {\n return {\n field: sortArrayIndexField(facetFieldDef, channel, {expr: 'datum'}),\n order: 'ascending'\n };\n } else {\n return {\n field: vgField(facetFieldDef, {expr: 'datum'}),\n order: sort ?? 'ascending'\n };\n }\n}\n\nexport function assembleLabelTitle(facetFieldDef: FacetFieldDef, channel: FacetChannel, config: Config) {\n const {format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr} = getHeaderProperties(\n ['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'],\n facetFieldDef,\n config,\n channel\n );\n\n const titleTextExpr = formatSignalRef({fieldOrDatumDef: facetFieldDef, format, formatType, expr: 'parent', config})\n .signal;\n const headerChannel = getHeaderChannel(channel, labelOrient);\n\n return {\n text: {\n signal: labelExpr\n ? replaceAll(\n replaceAll(labelExpr, 'datum.label', titleTextExpr),\n 'datum.value',\n vgField(facetFieldDef, {expr: 'parent'})\n )\n : titleTextExpr\n },\n ...(channel === 'row' ? {orient: 'left'} : {}),\n style: 'guide-label',\n frame: 'group',\n ...defaultHeaderGuideBaseline(labelAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)\n };\n}\n\nexport function assembleHeaderGroup(\n model: Model,\n channel: HeaderChannel,\n headerType: HeaderType,\n layoutHeader: LayoutHeaderComponent,\n headerComponent: HeaderComponent\n) {\n if (headerComponent) {\n let title = null;\n const {facetFieldDef} = layoutHeader;\n const config = model.config ? model.config : undefined;\n if (facetFieldDef && headerComponent.labels) {\n const {labelOrient} = getHeaderProperties(['labelOrient'], facetFieldDef, config, channel);\n\n // Include label title in the header if orient aligns with the channel\n if (\n (channel === 'row' && !contains(['top', 'bottom'], labelOrient)) ||\n (channel === 'column' && !contains(['left', 'right'], labelOrient))\n ) {\n title = assembleLabelTitle(facetFieldDef, channel, config);\n }\n }\n\n const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet);\n\n const axes = headerComponent.axes;\n\n const hasAxes = axes?.length > 0;\n if (title || hasAxes) {\n const sizeChannel = channel === 'row' ? 'height' : 'width';\n\n return {\n name: model.getName(`${channel}_${headerType}`),\n type: 'group',\n role: `${channel}-${headerType}`,\n\n ...(layoutHeader.facetFieldDef\n ? {\n from: {data: model.getName(channel + '_domain')},\n sort: getSort(facetFieldDef, channel)\n }\n : {}),\n ...(hasAxes && isFacetWithoutRowCol\n ? {\n from: {data: model.getName(`facet_domain_${channel}`)}\n }\n : {}),\n\n ...(title ? {title} : {}),\n ...(headerComponent.sizeSignal\n ? {\n encode: {\n update: {\n [sizeChannel]: headerComponent.sizeSignal\n }\n }\n }\n : {}),\n ...(hasAxes ? {axes} : {})\n };\n }\n }\n return null;\n}\n\nconst LAYOUT_TITLE_BAND = {\n column: {\n start: 0,\n end: 1\n },\n row: {\n start: 1,\n end: 0\n }\n};\n\nexport function getLayoutTitleBand(titleAnchor: TitleAnchor, headerChannel: HeaderChannel) {\n return LAYOUT_TITLE_BAND[headerChannel][titleAnchor];\n}\n\nexport function assembleLayoutTitleBand(\n headerComponentIndex: LayoutHeaderComponentIndex,\n config: Config\n): RowCol {\n const titleBand = {};\n\n for (const channel of FACET_CHANNELS) {\n const headerComponent = headerComponentIndex[channel];\n if (headerComponent?.facetFieldDef) {\n const {titleAnchor, titleOrient} = getHeaderProperties(\n ['titleAnchor', 'titleOrient'],\n headerComponent.facetFieldDef,\n config,\n channel\n );\n\n const headerChannel = getHeaderChannel(channel, titleOrient);\n const band = getLayoutTitleBand(titleAnchor, headerChannel);\n if (band !== undefined) {\n titleBand[headerChannel] = band;\n }\n }\n }\n\n return isEmpty(titleBand) ? undefined : titleBand;\n}\n\nexport function assembleHeaderProperties(\n config: Config,\n facetFieldDef: FacetFieldDef,\n channel: FacetChannel,\n properties: (keyof CoreHeader)[],\n propertiesMap: Partial>\n): Partial {\n const props = {};\n for (const prop of properties) {\n if (!propertiesMap[prop]) {\n continue;\n }\n\n const value = getHeaderProperty(prop, facetFieldDef, config, channel);\n if (value !== undefined) {\n props[propertiesMap[prop]] = value;\n }\n }\n return props;\n}\n","import {InitSignal, NewSignal} from 'vega';\nimport {getViewConfigContinuousSize} from '../../config';\nimport {hasDiscreteDomain} from '../../scale';\nimport {getFirstDefined} from '../../util';\nimport {isVgRangeStep, VgRangeStep} from '../../vega.schema';\nimport {isFacetModel, Model} from '../model';\nimport {ScaleComponent} from '../scale/component';\nimport {LayoutSizeType} from './component';\n\nexport function assembleLayoutSignals(model: Model): NewSignal[] {\n return [\n ...sizeSignals(model, 'width'),\n ...sizeSignals(model, 'height'),\n ...sizeSignals(model, 'childWidth'),\n ...sizeSignals(model, 'childHeight')\n ];\n}\n\nexport function sizeSignals(model: Model, sizeType: LayoutSizeType): (NewSignal | InitSignal)[] {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const size = model.component.layoutSize.get(sizeType);\n if (!size || size === 'merged') {\n return [];\n }\n\n // Read size signal name from name map, just in case it is the top-level size signal that got renamed.\n const name = model.getSizeSignalRef(sizeType).signal;\n\n if (size === 'step') {\n const scaleComponent = model.getScaleComponent(channel);\n\n if (scaleComponent) {\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = model.scaleName(channel);\n\n if (isFacetModel(model.parent)) {\n // If parent is facet and this is an independent scale, return only signal signal\n // as the width/height will be calculated using the cardinality from\n // facet's aggregate rather than reading from scale domain\n const parentResolve = model.parent.component.resolve;\n if (parentResolve.scale[channel] === 'independent') {\n return [stepSignal(scaleName, range)];\n }\n }\n\n return [\n stepSignal(scaleName, range),\n {\n name,\n update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`)\n }\n ];\n }\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('layout size is step although width/height is not step.');\n } else if (size == 'container') {\n const isWidth = name.endsWith('width');\n const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]';\n const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height');\n const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`;\n return [{name, init: safeExpr, on: [{update: safeExpr, events: 'window:resize'}]}];\n } else {\n return [\n {\n name,\n value: size\n }\n ];\n }\n}\n\nfunction stepSignal(scaleName: string, range: VgRangeStep): NewSignal {\n return {\n name: scaleName + '_step',\n value: range.step\n };\n}\n\nexport function sizeExpr(scaleName: string, scaleComponent: ScaleComponent, cardinality: string) {\n const type = scaleComponent.get('type');\n const padding = scaleComponent.get('padding');\n const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding);\n\n let paddingInner = scaleComponent.get('paddingInner');\n paddingInner =\n type === 'band'\n ? // only band has real paddingInner\n paddingInner !== undefined\n ? paddingInner\n : padding\n : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128,\n // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points.\n 1;\n return `bandspace(${cardinality}, ${paddingInner}, ${paddingOuter}) * ${scaleName}_step`;\n}\n","import {Split} from '../split';\n\nexport type LayoutSize = number | 'container' | 'step' | 'merged';\n\nexport interface LayoutSizeIndex {\n width?: LayoutSize;\n\n childWidth?: LayoutSize;\n\n height?: LayoutSize;\n\n childHeight?: LayoutSize;\n}\n\nexport type LayoutSizeType = keyof LayoutSizeIndex;\n\nexport type LayoutSizeComponent = Split;\n\nexport function getSizeTypeFromLayoutSizeType(layoutSizeType: LayoutSizeType): 'width' | 'height' {\n return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType;\n}\n","import {SignalRef} from 'vega';\nimport {ValueDef} from '../channeldef';\nimport {GuideEncodingEntry} from '../guide';\nimport {keys} from '../util';\nimport {isSignalRef, VgEncodeChannel} from '../vega.schema';\nimport {wrapCondition} from './mark/encode';\nimport {UnitModel} from './unit';\n\nexport function guideEncodeEntry(encoding: GuideEncodingEntry, model: UnitModel) {\n return keys(encoding).reduce((encode, channel: VgEncodeChannel) => {\n const valueDef = encoding[channel];\n return {\n ...encode,\n ...wrapCondition(model, valueDef, channel, (x: ValueDef | SignalRef) => (isSignalRef(x) ? x : {value: x.value}))\n };\n }, {});\n}\n","import {isXorY, ScaleChannel} from '../channel';\nimport * as log from '../log';\nimport {Resolve, ResolveMode} from '../resolve';\nimport {isConcatModel, isFacetModel, isLayerModel, Model} from './model';\n\nexport function defaultScaleResolve(channel: ScaleChannel, model: Model): ResolveMode {\n if (isLayerModel(model) || isFacetModel(model)) {\n return 'shared';\n } else if (isConcatModel(model)) {\n return isXorY(channel) ? 'independent' : 'shared';\n }\n /* istanbul ignore next: should never reach here. */\n throw new Error('invalid model type for resolve');\n}\n\nexport function parseGuideResolve(resolve: Resolve, channel: ScaleChannel): ResolveMode {\n const channelScaleResolve = resolve.scale[channel];\n const guide = isXorY(channel) ? 'axis' : 'legend';\n\n if (channelScaleResolve === 'independent') {\n if (resolve[guide][channel] === 'shared') {\n log.warn(log.message.independentScaleMeansIndependentGuide(channel));\n }\n return 'independent';\n }\n\n return resolve[guide][channel] || 'shared';\n}\n","import {Legend as VgLegend} from 'vega';\nimport {NonPositionScaleChannel} from '../../channel';\nimport {COMMON_LEGEND_PROPERTY_INDEX, Legend} from '../../legend';\nimport {Flag, keys} from '../../util';\nimport {Split} from '../split';\n\nexport type LegendComponentProps = VgLegend & {\n labelExpr?: string;\n selections?: string[];\n disable?: boolean;\n};\n\nconst LEGEND_COMPONENT_PROPERTY_INDEX: Flag = {\n ...COMMON_LEGEND_PROPERTY_INDEX,\n disable: 1,\n labelExpr: 1,\n selections: 1,\n // channel scales\n opacity: 1,\n shape: 1,\n stroke: 1,\n fill: 1,\n size: 1,\n strokeWidth: 1,\n strokeDash: 1,\n // encode\n encode: 1\n};\n\nexport const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX);\n\nexport class LegendComponent extends Split {}\n\nexport type LegendComponentIndex = Partial>;\n\nexport type LegendIndex = Partial>;\n","import {ColorValueRef, EncodeEntry, Gradient, LegendEncode, LegendType, SignalRef, SymbolEncodeEntry} from 'vega';\nimport {array, isArray, stringValue} from 'vega-util';\nimport {COLOR, NonPositionScaleChannel, OPACITY} from '../../channel';\nimport {\n Conditional,\n DatumDef,\n hasConditionalValueDef,\n isFieldDef,\n isValueDef,\n TypedFieldDef,\n Value,\n ValueDef\n} from '../../channeldef';\nimport {Encoding} from '../../encoding';\nimport {FILL_STROKE_CONFIG} from '../../mark';\nimport {getFirstDefined, isEmpty, varName} from '../../util';\nimport {applyMarkConfig, signalOrValueRef} from '../common';\nimport {formatCustomType, isCustomFormatType} from '../format';\nimport * as mixins from '../mark/encode';\nimport {STORE} from '../selection';\nimport {UnitModel} from '../unit';\nimport {LegendComponent} from './component';\n\nexport interface LegendEncodeParams {\n fieldOrDatumDef: TypedFieldDef | DatumDef;\n model: UnitModel;\n channel: NonPositionScaleChannel;\n legendCmpt: LegendComponent;\n legendType: LegendType;\n}\n\nexport const legendEncodeRules: {\n [part in keyof LegendEncode]?: (spec: EncodeEntry, params: LegendEncodeParams) => EncodeEntry;\n} = {\n symbols,\n gradient,\n labels,\n entries\n};\n\nexport function symbols(\n symbolsSpec: any,\n {fieldOrDatumDef, model, channel, legendCmpt, legendType}: LegendEncodeParams\n): SymbolEncodeEntry {\n if (legendType !== 'symbol') {\n return undefined;\n }\n\n const {markDef, encoding, config, mark} = model;\n const filled = markDef.filled && mark !== 'trail';\n\n let out = {\n ...applyMarkConfig({}, model, FILL_STROKE_CONFIG),\n ...mixins.color(model, {filled})\n } as SymbolEncodeEntry; // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry\n\n const symbolOpacity = legendCmpt.get('symbolOpacity') ?? config.legend.symbolOpacity;\n const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor;\n const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor;\n\n const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined;\n\n if (out.fill) {\n // for fill legend, we don't want any fill in symbol\n if (channel === 'fill' || (filled && channel === COLOR)) {\n delete out.fill;\n } else {\n if (out.fill['field']) {\n // For others, set fill to some opaque value (or nothing if a color is already set)\n if (symbolFillColor) {\n delete out.fill;\n } else {\n out.fill = signalOrValueRef(config.legend.symbolBaseFillColor ?? 'black');\n out.fillOpacity = signalOrValueRef(opacity ?? 1);\n }\n } else if (isArray(out.fill)) {\n const fill =\n getFirstConditionValue(encoding.fill ?? encoding.color) ?? markDef.fill ?? (filled && markDef.color);\n if (fill) {\n out.fill = signalOrValueRef(fill) as ColorValueRef;\n }\n }\n }\n }\n\n if (out.stroke) {\n if (channel === 'stroke' || (!filled && channel === COLOR)) {\n delete out.stroke;\n } else {\n if (out.stroke['field'] || symbolStrokeColor) {\n // For others, remove stroke field\n delete out.stroke;\n } else if (isArray(out.stroke)) {\n const stroke = getFirstDefined(\n getFirstConditionValue(encoding.stroke || encoding.color),\n markDef.stroke,\n filled ? markDef.color : undefined\n );\n if (stroke) {\n out.stroke = {value: stroke} as ColorValueRef;\n }\n }\n }\n }\n\n if (channel !== OPACITY) {\n const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef);\n\n if (condition) {\n out.opacity = [\n {test: condition, ...signalOrValueRef(opacity ?? 1)},\n signalOrValueRef(config.legend.unselectedOpacity)\n ];\n } else if (opacity) {\n out.opacity = signalOrValueRef(opacity);\n }\n }\n\n out = {...out, ...symbolsSpec};\n\n return isEmpty(out) ? undefined : out;\n}\n\nexport function gradient(gradientSpec: any, {model, legendType, legendCmpt}: LegendEncodeParams) {\n if (legendType !== 'gradient') {\n return undefined;\n }\n\n const {config, markDef, encoding} = model;\n\n let out: SymbolEncodeEntry = {};\n\n const gradientOpacity = legendCmpt.get('gradientOpacity') ?? config.legend.gradientOpacity;\n const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined;\n if (opacity) {\n // only apply opacity if it is neither zero or undefined\n out.opacity = signalOrValueRef(opacity);\n }\n\n out = {...out, ...gradientSpec};\n return isEmpty(out) ? undefined : out;\n}\n\nexport function labels(specifiedlabelsSpec: any, {fieldOrDatumDef, model, channel, legendCmpt}: LegendEncodeParams) {\n const legend = model.legend(channel) || {};\n const config = model.config;\n\n const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined;\n const opacity = condition ? [{test: condition, value: 1}, {value: config.legend.unselectedOpacity}] : undefined;\n\n const {format, formatType} = legend;\n\n const text = isCustomFormatType(formatType)\n ? formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n })\n : undefined;\n\n const labelsSpec = {\n ...(opacity ? {opacity} : {}),\n ...(text ? {text} : {}),\n ...specifiedlabelsSpec\n };\n\n return isEmpty(labelsSpec) ? undefined : labelsSpec;\n}\n\nexport function entries(entriesSpec: any, {legendCmpt}: LegendEncodeParams) {\n const selections = legendCmpt.get('selections');\n return selections?.length ? {...entriesSpec, fill: {value: 'transparent'}} : entriesSpec;\n}\n\nfunction getMaxValue(channelDef: Encoding['opacity']) {\n return getConditionValue(channelDef, (v: number, conditionalDef) => Math.max(v, conditionalDef.value as any));\n}\n\nexport function getFirstConditionValue(\n channelDef: Encoding['fill' | 'stroke' | 'shape']\n): V {\n return getConditionValue(channelDef, (v: V, conditionalDef: Conditional>) => {\n return getFirstDefined(v, conditionalDef.value);\n });\n}\n\nfunction getConditionValue(\n channelDef: Encoding['fill' | 'stroke' | 'shape' | 'opacity'],\n reducer: (val: V, conditionalDef: Conditional>) => V\n): V {\n if (hasConditionalValueDef(channelDef)) {\n return array(channelDef.condition).reduce(reducer, channelDef.value as any);\n } else if (isValueDef(channelDef)) {\n return channelDef.value as any;\n }\n return undefined;\n}\n\nfunction selectedCondition(model: UnitModel, legendCmpt: LegendComponent, fieldDef: TypedFieldDef) {\n const selections = legendCmpt.get('selections');\n if (!selections?.length) return undefined;\n\n const field = stringValue(fieldDef.field);\n return selections\n .map(name => {\n const store = stringValue(varName(name) + STORE);\n return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`;\n })\n .join(' || ');\n}\n","import {LabelOverlap, LegendOrient, LegendType, Orientation, SignalRef, SymbolShape} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isColorChannel} from '../../channel';\nimport {DatumDef, MarkPropFieldOrDatumDef, title as fieldDefTitle, TypedFieldDef, valueArray} from '../../channeldef';\nimport {Config} from '../../config';\nimport {Encoding} from '../../encoding';\nimport {Legend, LegendConfig} from '../../legend';\nimport {Mark, MarkDef} from '../../mark';\nimport {isContinuousToContinuous, ScaleType} from '../../scale';\nimport {TimeUnit} from '../../timeunit';\nimport {contains, getFirstDefined} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {guideFormat, guideFormatType} from '../format';\nimport {Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {NonPositionScaleChannel} from './../../channel';\nimport {LegendComponentProps} from './component';\nimport {getFirstConditionValue} from './encode';\n\nexport interface LegendRuleParams {\n legend: Legend;\n channel: NonPositionScaleChannel;\n model: UnitModel;\n markDef: MarkDef;\n encoding: Encoding;\n fieldOrDatumDef: MarkPropFieldOrDatumDef;\n legendConfig: LegendConfig;\n config: Config;\n scaleType: ScaleType;\n orient: LegendOrient;\n legendType: LegendType;\n direction: Orientation;\n}\n\nexport const legendRules: {\n [k in keyof LegendComponentProps]?: (params: LegendRuleParams) => LegendComponentProps[k];\n} = {\n direction: ({direction}) => direction,\n\n format: ({fieldOrDatumDef, legend, config}) => {\n const {format, formatType} = legend;\n return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false);\n },\n\n formatType: ({legend, fieldOrDatumDef, scaleType}) => {\n const {formatType} = legend;\n return guideFormatType(formatType, fieldOrDatumDef, scaleType);\n },\n\n gradientLength: params => {\n const {legend, legendConfig} = params;\n return legend.gradientLength ?? legendConfig.gradientLength ?? defaultGradientLength(params);\n },\n\n labelOverlap: ({legend, legendConfig, scaleType}) =>\n legend.labelOverlap ?? legendConfig.labelOverlap ?? defaultLabelOverlap(scaleType),\n\n symbolType: ({legend, markDef, channel, encoding}) =>\n legend.symbolType ?? defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape),\n\n title: ({fieldOrDatumDef, config}) => fieldDefTitle(fieldOrDatumDef, config, {allowDisabling: true}),\n\n type: ({legendType, scaleType, channel}) => {\n if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) {\n if (legendType === 'gradient') {\n return undefined;\n }\n } else if (legendType === 'symbol') {\n return undefined;\n }\n return legendType;\n }, // depended by other property, let's define upfront\n\n values: ({fieldOrDatumDef, legend}) => values(legend, fieldOrDatumDef)\n};\n\nexport function values(legend: Legend, fieldOrDatumDef: TypedFieldDef | DatumDef) {\n const vals = legend.values;\n\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n } else if (isSignalRef(vals)) {\n return vals;\n }\n return undefined;\n}\n\nexport function defaultSymbolType(\n mark: Mark,\n channel: NonPositionScaleChannel,\n shapeChannelDef: Encoding['shape'],\n markShape: SymbolShape | SignalRef\n): SymbolShape | SignalRef {\n if (channel !== 'shape') {\n // use the value from the shape encoding or the mark config if they exist\n const shape = getFirstConditionValue(shapeChannelDef) ?? markShape;\n if (shape) {\n return shape;\n }\n }\n\n switch (mark) {\n case 'bar':\n case 'rect':\n case 'image':\n case 'square':\n return 'square';\n case 'line':\n case 'trail':\n case 'rule':\n return 'stroke';\n case 'arc':\n case 'point':\n case 'circle':\n case 'tick':\n case 'geoshape':\n case 'area':\n case 'text':\n return 'circle';\n }\n}\n\nexport function clipHeight(legendType: LegendType) {\n if (legendType === 'gradient') {\n return 20;\n }\n return undefined;\n}\n\nexport function getLegendType(params: {\n legend: Legend;\n channel: NonPositionScaleChannel;\n timeUnit?: TimeUnit;\n scaleType: ScaleType;\n}): LegendType {\n const {legend} = params;\n\n return getFirstDefined(legend.type, defaultType(params));\n}\n\nexport function defaultType({\n channel,\n timeUnit,\n scaleType\n}: {\n channel: NonPositionScaleChannel;\n timeUnit?: TimeUnit;\n scaleType: ScaleType;\n}): LegendType {\n // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js\n\n if (isColorChannel(channel)) {\n if (contains(['quarter', 'month', 'day'], timeUnit)) {\n return 'symbol';\n }\n\n if (isContinuousToContinuous(scaleType)) {\n return 'gradient';\n }\n }\n return 'symbol';\n}\n\nexport function getDirection({\n legendConfig,\n legendType,\n orient,\n legend\n}: {\n orient: LegendOrient;\n legendConfig: LegendConfig;\n legendType: LegendType;\n legend: Legend;\n}): Orientation {\n return (\n legend.direction ??\n legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'] ??\n defaultDirection(orient, legendType)\n );\n}\n\nexport function defaultDirection(orient: LegendOrient, legendType: LegendType): 'horizontal' | undefined {\n switch (orient) {\n case 'top':\n case 'bottom':\n return 'horizontal';\n\n case 'left':\n case 'right':\n case 'none':\n case undefined: // undefined = \"right\" in Vega\n return undefined; // vertical is Vega's default\n default:\n // top-left / ...\n // For inner legend, uses compact layout like Tableau\n return legendType === 'gradient' ? 'horizontal' : undefined;\n }\n}\n\nexport function defaultGradientLength({\n legendConfig,\n model,\n direction,\n orient,\n scaleType\n}: {\n scaleType: ScaleType;\n direction: Orientation;\n orient: LegendOrient;\n model: Model;\n legendConfig: LegendConfig;\n}) {\n const {\n gradientHorizontalMaxLength,\n gradientHorizontalMinLength,\n gradientVerticalMaxLength,\n gradientVerticalMinLength\n } = legendConfig;\n if (isContinuousToContinuous(scaleType)) {\n if (direction === 'horizontal') {\n if (orient === 'top' || orient === 'bottom') {\n return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength);\n } else {\n return gradientHorizontalMinLength;\n }\n } else {\n // vertical / undefined (Vega uses vertical by default)\n return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength);\n }\n }\n return undefined;\n}\n\nfunction gradientLengthSignal(model: Model, sizeType: 'width' | 'height', min: number, max: number) {\n const sizeSignal = model.getSizeSignalRef(sizeType).signal;\n return {signal: `clamp(${sizeSignal}, ${min}, ${max})`};\n}\n\nexport function defaultLabelOverlap(scaleType: ScaleType): LabelOverlap {\n if (contains(['quantile', 'threshold', 'log'], scaleType)) {\n return 'greedy';\n }\n return undefined;\n}\n","import {Legend as VgLegend, LegendEncode} from 'vega';\nimport {COLOR, NonPositionScaleChannel, SHAPE} from '../../channel';\nimport {DatumDef, FieldDef, getFieldOrDatumDef, isFieldDef, MarkPropDatumDef, MarkPropFieldDef} from '../../channeldef';\nimport {Legend, LEGEND_SCALE_CHANNELS} from '../../legend';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport {GEOJSON} from '../../type';\nimport {deleteNestedProperty, isEmpty, keys, varName} from '../../util';\nimport {mergeTitleComponent} from '../common';\nimport {guideEncodeEntry} from '../guide';\nimport {isUnitModel, Model} from '../model';\nimport {parseGuideResolve} from '../resolve';\nimport {parseInteractiveLegend} from '../selection/transforms/legends';\nimport {defaultTieBreaker, Explicit, makeImplicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {LegendComponent, LegendComponentIndex, LegendComponentProps, LEGEND_COMPONENT_PROPERTIES} from './component';\nimport {LegendEncodeParams, legendEncodeRules} from './encode';\nimport {getDirection, getLegendType, LegendRuleParams, legendRules} from './properties';\n\nexport function parseLegend(model: Model) {\n const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model);\n model.component.legends = legendComponent;\n return legendComponent;\n}\n\nfunction parseUnitLegend(model: UnitModel): LegendComponentIndex {\n const {encoding} = model;\n\n const legendComponent: LegendComponentIndex = {};\n\n for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) {\n const def = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | MarkPropDatumDef;\n\n if (!def || !model.getScaleComponent(channel)) {\n continue;\n }\n\n if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) {\n continue;\n }\n\n legendComponent[channel] = parseLegendForChannel(model, channel);\n }\n\n return legendComponent;\n}\n\nfunction getLegendDefWithScale(model: UnitModel, channel: NonPositionScaleChannel): VgLegend {\n const scale = model.scaleName(channel);\n if (model.mark === 'trail') {\n if (channel === 'color') {\n // trail is a filled mark, but its default symbolType (\"stroke\") should use \"stroke\"\n return {stroke: scale};\n } else if (channel === 'size') {\n return {strokeWidth: scale};\n }\n }\n\n if (channel === 'color') {\n return model.markDef.filled ? {fill: scale} : {stroke: scale};\n }\n return {[channel]: scale};\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isExplicit(\n value: T,\n property: keyof LegendComponentProps,\n legend: Legend,\n fieldDef: FieldDef\n) {\n switch (property) {\n case 'disable':\n return legend !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit\n case 'values':\n // specified legend.values is already respected, but may get transformed.\n return !!legend?.values;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (property === 'title' && value === fieldDef?.title) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === (legend || {})[property];\n}\n\nexport function parseLegendForChannel(model: UnitModel, channel: NonPositionScaleChannel): LegendComponent {\n let legend = model.legend(channel);\n\n const {markDef, encoding, config} = model;\n const legendConfig = config.legend;\n const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel));\n parseInteractiveLegend(model, channel, legendCmpt);\n\n const disable = legend !== undefined ? !legend : legendConfig.disable;\n legendCmpt.set('disable', disable, legend !== undefined);\n if (disable) {\n return legendCmpt;\n }\n\n legend = legend || {};\n\n const scaleType = model.getScaleComponent(channel).get('type');\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | DatumDef;\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n\n const orient = legend.orient || config.legend.orient || 'right';\n const legendType = getLegendType({legend, channel, timeUnit, scaleType});\n\n const direction = getDirection({legend, legendType, orient, legendConfig});\n\n const ruleParams: LegendRuleParams = {\n legend,\n channel,\n model,\n markDef,\n encoding,\n fieldOrDatumDef,\n legendConfig,\n config,\n scaleType,\n orient,\n legendType,\n direction\n };\n\n for (const property of LEGEND_COMPONENT_PROPERTIES) {\n if (\n (legendType === 'gradient' && property.startsWith('symbol')) ||\n (legendType === 'symbol' && property.startsWith('gradient'))\n ) {\n continue;\n }\n\n const value = property in legendRules ? legendRules[property](ruleParams) : legend[property];\n if (value !== undefined) {\n const explicit = isExplicit(value, property, legend, model.fieldDef(channel));\n if (explicit || config.legend[property] === undefined) {\n legendCmpt.set(property, value, explicit);\n }\n }\n }\n\n const legendEncoding = legend?.encoding ?? {};\n const selections = legendCmpt.get('selections');\n const legendEncode: LegendEncode = {};\n\n const legendEncodeParams: LegendEncodeParams = {fieldOrDatumDef, model, channel, legendCmpt, legendType};\n\n for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) {\n const legendEncodingPart = guideEncodeEntry(legendEncoding[part] ?? {}, model);\n\n const value =\n part in legendEncodeRules\n ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule\n : legendEncodingPart; // no rule -- just default values\n\n if (value !== undefined && !isEmpty(value)) {\n legendEncode[part] = {\n ...(selections?.length && isFieldDef(fieldOrDatumDef)\n ? {name: `${varName(fieldOrDatumDef.field)}_legend_${part}`}\n : {}),\n ...(selections?.length ? {interactive: !!selections} : {}),\n update: value\n };\n }\n }\n\n if (!isEmpty(legendEncode)) {\n legendCmpt.set('encode', legendEncode, !!legend?.encoding);\n }\n\n return legendCmpt;\n}\n\nfunction parseNonUnitLegend(model: Model) {\n const {legends, resolve} = model.component;\n\n for (const child of model.children) {\n parseLegend(child);\n\n for (const channel of keys(child.component.legends)) {\n resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel);\n\n if (resolve.legend[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n\n legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]);\n\n if (!legends[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the legend shared.\n // Thus, mark legend as independent and remove the legend component.\n resolve.legend[channel] = 'independent';\n delete legends[channel];\n }\n }\n }\n }\n\n for (const channel of keys(legends)) {\n for (const child of model.children) {\n if (!child.component.legends[channel]) {\n // skip if the child does not have a particular legend\n continue;\n }\n\n if (resolve.legend[channel] === 'shared') {\n // After merging shared legend, make sure to remove legend from child\n delete child.component.legends[channel];\n }\n }\n }\n\n return legends;\n}\n\nexport function mergeLegendComponent(mergedLegend: LegendComponent, childLegend: LegendComponent): LegendComponent {\n if (!mergedLegend) {\n return childLegend.clone();\n }\n const mergedOrient = mergedLegend.getWithExplicit('orient');\n const childOrient = childLegend.getWithExplicit('orient');\n\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n // Cannot merge due to inconsistent orient\n return undefined;\n }\n\n let typeMerged = false;\n // Otherwise, let's merge\n for (const prop of LEGEND_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(\n mergedLegend.getWithExplicit(prop),\n childLegend.getWithExplicit(prop),\n prop,\n 'legend',\n\n // Tie breaker function\n (v1: Explicit, v2: Explicit): any => {\n switch (prop) {\n case 'symbolType':\n return mergeSymbolType(v1, v2);\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'type':\n // There are only two types. If we have different types, then prefer symbol over gradient.\n typeMerged = true;\n return makeImplicit('symbol');\n }\n return defaultTieBreaker(v1, v2, prop, 'legend');\n }\n );\n mergedLegend.setWithExplicit(prop, mergedValueWithExplicit);\n }\n if (typeMerged) {\n if (mergedLegend.implicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']);\n }\n if (mergedLegend.explicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']);\n }\n }\n\n return mergedLegend;\n}\n\nfunction mergeSymbolType(st1: Explicit, st2: Explicit) {\n if (st2.value === 'circle') {\n // prefer \"circle\" over \"stroke\"\n return st2;\n }\n return st1;\n}\n","import {Legend as VgLegend, LegendEncode} from 'vega';\nimport {Config} from '../../config';\nimport {LEGEND_SCALE_CHANNELS, SIGNAL_LEGEND_PROP_INDEX} from '../../legend';\nimport {keys, replaceAll, stringify, vals} from '../../util';\nimport {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema';\nimport {Model} from '../model';\nimport {LegendComponent} from './component';\nimport {mergeLegendComponent} from './parse';\n\nfunction setLegendEncode(\n legend: VgLegend,\n part: keyof LegendEncode,\n vgProp: VgEncodeChannel,\n vgRef: VgValueRef | VgValueRef[]\n) {\n legend.encode = legend.encode ?? {};\n legend.encode[part] = legend.encode[part] ?? {};\n legend.encode[part].update = legend.encode[part].update ?? {};\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n (legend.encode[part].update[vgProp] as any) = vgRef;\n}\n\nexport function assembleLegends(model: Model): VgLegend[] {\n const legendComponentIndex = model.component.legends;\n const legendByDomain: Record = {};\n\n for (const channel of keys(legendComponentIndex)) {\n const scaleComponent = model.getScaleComponent(channel);\n const domainHash = stringify(scaleComponent.get('domains'));\n if (legendByDomain[domainHash]) {\n for (const mergedLegendComponent of legendByDomain[domainHash]) {\n const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]);\n if (!merged) {\n // If cannot merge, need to add this legend separately\n legendByDomain[domainHash].push(legendComponentIndex[channel]);\n }\n }\n } else {\n legendByDomain[domainHash] = [legendComponentIndex[channel].clone()];\n }\n }\n\n const legends = vals(legendByDomain)\n .flat()\n .map(l => assembleLegend(l, model.config))\n .filter(l => l !== undefined);\n\n return legends;\n}\n\nexport function assembleLegend(legendCmpt: LegendComponent, config: Config) {\n const {disable, labelExpr, selections, ...legend} = legendCmpt.combine();\n\n if (disable) {\n return undefined;\n }\n\n if (config.aria === false && legend.aria == undefined) {\n legend.aria = false;\n }\n\n if (legend.encode?.symbols) {\n const out = legend.encode.symbols.update;\n if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) {\n // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used.\n out.stroke = {value: 'transparent'};\n }\n\n // Remove properties that the legend is encoding.\n for (const property of LEGEND_SCALE_CHANNELS) {\n if (legend[property]) {\n delete out[property];\n }\n }\n }\n\n if (!legend.title) {\n // title schema doesn't include null, ''\n delete legend.title;\n }\n\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (legend.encode?.labels?.update && isSignalRef(legend.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal);\n }\n setLegendEncode(legend, 'labels', 'text', {signal: expr});\n }\n\n for (const prop in legend) {\n const propValue = legend[prop];\n if (isSignalRef(propValue)) {\n const propIndex = SIGNAL_LEGEND_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n setLegendEncode(legend, part, vgProp, propValue);\n delete legend[prop];\n }\n }\n }\n\n return legend;\n}\n","import {Projection as VgProjection, SignalRef} from 'vega';\nimport {contains} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {isConcatModel, isLayerModel, Model} from '../model';\n\nexport function assembleProjections(model: Model): VgProjection[] {\n if (isLayerModel(model) || isConcatModel(model)) {\n return assembleProjectionsForModelAndChildren(model);\n } else {\n return assembleProjectionForModel(model);\n }\n}\n\nexport function assembleProjectionsForModelAndChildren(model: Model): VgProjection[] {\n return model.children.reduce((projections, child) => {\n return projections.concat(child.assembleProjections());\n }, assembleProjectionForModel(model));\n}\n\nexport function assembleProjectionForModel(model: Model): VgProjection[] {\n const component = model.component.projection;\n if (!component || component.merged) {\n return [];\n }\n\n const projection = component.combine();\n const {name} = projection; // we need to extract name so that it is always present in the output and pass TS type validation\n\n if (!component.data) {\n // generate custom projection, no automatic fitting\n return [\n {\n name,\n // translate to center by default\n ...{translate: {signal: '[width / 2, height / 2]'}},\n // parameters, overwrite default translate if specified\n ...projection\n }\n ];\n } else {\n // generate projection that uses extent fitting\n const size: SignalRef = {\n signal: `[${component.size.map(ref => ref.signal).join(', ')}]`\n };\n\n const fits: string[] = component.data.reduce((sources, data) => {\n const source: string = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`;\n if (!contains(sources, source)) {\n // build a unique list of sources\n sources.push(source);\n }\n return sources;\n }, []);\n\n if (fits.length <= 0) {\n throw new Error(\"Projection's fit didn't find any data sources\");\n }\n\n return [\n {\n name,\n size,\n fit: {\n signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0]\n },\n ...projection\n }\n ];\n }\n}\n","import {BaseProjection, SignalRef, Vector2} from 'vega';\nimport {ProjectionType} from './vega.schema';\n\nexport interface Projection extends BaseProjection {\n /**\n * The cartographic projection to use. This value is case-insensitive, for example `\"albers\"` and `\"Albers\"` indicate the same projection type. You can find all valid projection types [in the documentation](https://vega.github.io/vega-lite/docs/projection.html#projection-types).\n *\n * __Default value:__ `mercator`\n */\n type?: ProjectionType | SignalRef; // Re-declare to override docs\n\n /**\n * The projection’s scale (zoom) factor, overriding automatic fitting. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections.\n */\n scale?: number | SignalRef; // Re-declare to override docs\n\n /**\n * The projection’s translation offset as a two-element array `[tx, ty]`.\n */\n translate?: Vector2 | SignalRef; // TODO: figure what's VL default value\n}\n\n/**\n * Any property of Projection can be in config\n */\nexport type ProjectionConfig = Projection;\n\nexport const PROJECTION_PROPERTIES: (keyof Projection)[] = [\n 'type',\n 'clipAngle',\n 'clipExtent',\n 'center',\n 'rotate',\n 'precision',\n 'reflectX',\n 'reflectY',\n 'coefficient',\n 'distance',\n 'fraction',\n 'lobes',\n 'parallel',\n 'radius',\n 'ratio',\n 'spacing',\n 'tilt'\n];\n","import {SignalRef} from 'vega';\nimport {Projection} from '../../projection';\nimport {Projection as VgProjection} from 'vega';\nimport {Split} from '../split';\n\nexport class ProjectionComponent extends Split {\n public merged = false;\n\n constructor(\n name: string,\n public specifiedProjection: Projection,\n public size: SignalRef[],\n public data: (string | SignalRef)[]\n ) {\n super(\n {...specifiedProjection}, // all explicit properties of projection\n {name} // name as initial implicit property\n );\n }\n\n /**\n * Whether the projection parameters should fit provided data.\n */\n public get isFit() {\n return !!this.data;\n }\n}\n","import {SignalRef} from 'vega';\nimport {hasOwnProperty} from 'vega-util';\nimport {LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {PROJECTION_PROPERTIES} from '../../projection';\nimport {GEOJSON} from '../../type';\nimport {duplicate, every, stringify} from '../../util';\nimport {isUnitModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {ProjectionComponent} from './component';\n\nexport function parseProjection(model: Model) {\n model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model);\n}\n\nfunction parseUnitProjection(model: UnitModel): ProjectionComponent {\n if (model.hasProjection) {\n const proj = model.specifiedProjection;\n const fit = !(proj && (proj.scale != null || proj.translate != null));\n const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined;\n const data = fit ? gatherFitData(model) : undefined;\n\n return new ProjectionComponent(\n model.projectionName(true),\n {\n ...(model.config.projection ?? {}),\n ...(proj ?? {})\n },\n size,\n data\n );\n }\n\n return undefined;\n}\n\nfunction gatherFitData(model: UnitModel) {\n const data: (SignalRef | string)[] = [];\n\n const {encoding} = model;\n\n for (const posssiblePair of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n }\n\n if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n\n if (data.length === 0) {\n // main source is geojson, so we can just use that\n data.push(model.requestDataName(DataSourceType.Main));\n }\n\n return data;\n}\n\nfunction mergeIfNoConflict(first: ProjectionComponent, second: ProjectionComponent): ProjectionComponent {\n const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => {\n // neither has the property\n if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) {\n return true;\n }\n // both have property and an equal value for property\n if (\n hasOwnProperty(first.explicit, prop) &&\n hasOwnProperty(second.explicit, prop) &&\n // some properties might be signals or objects and require hashing for comparison\n stringify(first.get(prop)) === stringify(second.get(prop))\n ) {\n return true;\n }\n return false;\n });\n\n const size = stringify(first.size) === stringify(second.size);\n if (size) {\n if (allPropertiesShared) {\n return first;\n } else if (stringify(first.explicit) === stringify({})) {\n return second;\n } else if (stringify(second.explicit) === stringify({})) {\n return first;\n }\n }\n\n // if all properties don't match, let each unit spec have its own projection\n return null;\n}\n\nfunction parseNonUnitProjections(model: Model): ProjectionComponent {\n if (model.children.length === 0) {\n return undefined;\n }\n\n let nonUnitProjection: ProjectionComponent;\n\n // parse all children first\n for (const child of model.children) {\n parseProjection(child);\n }\n\n // analyze parsed projections, attempt to merge\n const mergable = every(model.children, child => {\n const projection = child.component.projection;\n if (!projection) {\n // child layer does not use a projection\n return true;\n } else if (!nonUnitProjection) {\n // cached 'projection' is null, cache this one\n nonUnitProjection = projection;\n return true;\n } else {\n const merge = mergeIfNoConflict(nonUnitProjection, projection);\n if (merge) {\n nonUnitProjection = merge;\n }\n return !!merge;\n }\n });\n\n // if cached one and all other children share the same projection,\n if (nonUnitProjection && mergable) {\n // so we can elevate it to the layer level\n const name = model.projectionName(true);\n const modelProjection = new ProjectionComponent(\n name,\n nonUnitProjection.specifiedProjection,\n nonUnitProjection.size,\n duplicate(nonUnitProjection.data)\n );\n\n // rename and assign all others as merged\n for (const child of model.children) {\n const projection = child.component.projection;\n if (projection) {\n if (projection.isFit) {\n modelProjection.data.push(...child.component.projection.data);\n }\n child.renameProjection(projection.get('name'), name);\n projection.merged = true;\n }\n }\n\n return modelProjection;\n }\n\n return undefined;\n}\n","import {BinTransform as VgBinTransform, Transforms as VgTransform} from 'vega';\nimport {isString} from 'vega-util';\nimport {BinParams, binToString, isBinning, isSelectionExtent} from '../../bin';\nimport {Channel} from '../../channel';\nimport {binRequiresRange, FieldName, isTypedFieldDef, normalizeBin, TypedFieldDef, vgField} from '../../channeldef';\nimport {Config} from '../../config';\nimport {BinTransform} from '../../transform';\nimport {Dict, duplicate, hash, isEmpty, keys, replacePathInField, unique, vals, varName} from '../../util';\nimport {binFormatExpression} from '../format';\nimport {isUnitModel, Model, ModelWithField} from '../model';\nimport {parseSelectionBinExtent} from '../selection/parse';\nimport {NonPositionScaleChannel, PositionChannel} from './../../channel';\nimport {DataFlowNode} from './dataflow';\n\nfunction rangeFormula(model: ModelWithField, fieldDef: TypedFieldDef, channel: Channel, config: Config) {\n if (binRequiresRange(fieldDef, channel)) {\n // read format from axis or legend, if there is no format then use config.numberFormat\n\n const guide = isUnitModel(model)\n ? model.axis(channel as PositionChannel) ?? model.legend(channel as NonPositionScaleChannel) ?? {}\n : {};\n\n const startField = vgField(fieldDef, {expr: 'datum'});\n const endField = vgField(fieldDef, {expr: 'datum', binSuffix: 'end'});\n\n return {\n formulaAs: vgField(fieldDef, {binSuffix: 'range', forAs: true}),\n formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config)\n };\n }\n return {};\n}\n\nfunction binKey(bin: BinParams, field: string) {\n return `${binToString(bin)}_${field}`;\n}\n\nfunction getSignalsFromModel(model: Model, key: string) {\n return {\n signal: model.getName(`${key}_bins`),\n extentSignal: model.getName(`${key}_extent`)\n };\n}\n\nexport function getBinSignalName(model: Model, field: string, bin: boolean | BinParams) {\n const normalizedBin = normalizeBin(bin, undefined) ?? {};\n const key = binKey(normalizedBin, field);\n return model.getName(`${key}_bins`);\n}\n\nfunction isBinTransform(t: TypedFieldDef | BinTransform): t is BinTransform {\n return 'as' in t;\n}\n\nfunction createBinComponent(t: TypedFieldDef | BinTransform, bin: boolean | BinParams, model: Model) {\n let as: [string, string];\n let span: string;\n\n if (isBinTransform(t)) {\n as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]];\n } else {\n as = [vgField(t, {forAs: true}), vgField(t, {binSuffix: 'end', forAs: true})];\n }\n\n const normalizedBin = {...normalizeBin(bin, undefined)};\n const key = binKey(normalizedBin, t.field);\n const {signal, extentSignal} = getSignalsFromModel(model, key);\n\n if (isSelectionExtent(normalizedBin.extent)) {\n const ext = normalizedBin.extent;\n const selName = ext.selection;\n span = parseSelectionBinExtent(model.getSelectionComponent(varName(selName), selName), ext);\n delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property.\n }\n\n const binComponent: BinComponent = {\n bin: normalizedBin,\n field: t.field,\n as: [as],\n ...(signal ? {signal} : {}),\n ...(extentSignal ? {extentSignal} : {}),\n ...(span ? {span} : {})\n };\n\n return {key, binComponent};\n}\n\nexport interface BinComponent {\n bin: BinParams;\n field: FieldName;\n extentSignal?: string;\n signal?: string;\n span?: string;\n\n /** Pairs of strings of the names of start and end signals */\n as: [string, string][];\n\n // Range Formula\n\n formula?: string;\n formulaAs?: string;\n}\n\nexport class BinNode extends DataFlowNode {\n public clone() {\n return new BinNode(null, duplicate(this.bins));\n }\n\n constructor(parent: DataFlowNode, private bins: Dict) {\n super(parent);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) {\n const bins = model.reduceFieldDef((binComponentIndex: Dict, fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n const {key, binComponent} = createBinComponent(fieldDef, fieldDef.bin, model);\n binComponentIndex[key] = {\n ...binComponent,\n ...binComponentIndex[key],\n ...rangeFormula(model, fieldDef, channel, model.config)\n };\n }\n return binComponentIndex;\n }, {} as Dict);\n\n if (isEmpty(bins)) {\n return null;\n }\n\n return new BinNode(parent, bins);\n }\n\n /**\n * Creates a bin node from BinTransform.\n * The optional parameter should provide\n */\n public static makeFromTransform(parent: DataFlowNode, t: BinTransform, model: Model) {\n const {key, binComponent} = createBinComponent(t, t.bin, model);\n return new BinNode(parent, {\n [key]: binComponent\n });\n }\n\n /**\n * Merge bin nodes. This method either integrates the bin config from the other node\n * or if this node already has a bin config, renames the corresponding signal in the model.\n */\n public merge(other: BinNode, renameSignal: (s1: string, s2: string) => void) {\n for (const key of keys(other.bins)) {\n if (key in this.bins) {\n renameSignal(other.bins[key].signal, this.bins[key].signal);\n // Ensure that we don't have duplicate names for signal pairs\n this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash);\n } else {\n this.bins[key] = other.bins[key];\n }\n }\n\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n other.remove();\n }\n\n public producedFields() {\n return new Set(\n vals(this.bins)\n .map(c => c.as)\n .flat(2)\n );\n }\n\n public dependentFields() {\n return new Set(vals(this.bins).map(c => c.field));\n }\n\n public hash() {\n return `Bin ${hash(this.bins)}`;\n }\n\n public assemble(): VgTransform[] {\n return vals(this.bins).flatMap(bin => {\n const transform: VgTransform[] = [];\n\n const [binAs, ...remainingAs] = bin.as;\n const {extent, ...params} = bin.bin;\n const binTrans: VgBinTransform = {\n type: 'bin',\n field: replacePathInField(bin.field),\n as: binAs,\n signal: bin.signal,\n ...(!isSelectionExtent(extent) ? {extent} : {extent: null}),\n ...(bin.span ? {span: {signal: `span(${bin.span})`}} : {}),\n ...params\n };\n\n if (!extent && bin.extentSignal) {\n transform.push({\n type: 'extent',\n field: replacePathInField(bin.field),\n signal: bin.extentSignal\n });\n binTrans.extent = {signal: bin.extentSignal};\n }\n\n transform.push(binTrans);\n\n for (const as of remainingAs) {\n for (let i = 0; i < 2; i++) {\n transform.push({\n type: 'formula',\n expr: vgField({field: binAs[i]}, {expr: 'datum'}),\n as: as[i]\n });\n }\n }\n\n if (bin.formula) {\n transform.push({\n type: 'formula',\n expr: bin.formula,\n as: bin.formulaAs\n });\n }\n return transform;\n });\n }\n}\n","import {\n Data,\n DataFormat,\n DataFormatType,\n isGenerator,\n isInlineData,\n isNamedData,\n isSphereGenerator,\n isUrlData\n} from '../../data';\nimport {contains, isEmpty, omit} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {DataFlowNode} from './dataflow';\n\nexport class SourceNode extends DataFlowNode {\n private _data: Partial;\n\n private _name: string;\n\n private _generator: boolean;\n\n constructor(data: Data) {\n super(null); // source cannot have parent\n\n data = data ?? {name: 'source'};\n let format;\n\n if (!isGenerator(data)) {\n format = data.format ? {...omit(data.format, ['parse'])} : ({} as DataFormat);\n }\n\n if (isInlineData(data)) {\n this._data = {values: data.values};\n } else if (isUrlData(data)) {\n this._data = {url: data.url};\n\n if (!format.type) {\n // Extract extension from URL using snippet from\n // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript\n let defaultExtension = /(?:\\.([^.]+))?$/.exec(data.url)[1];\n if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) {\n defaultExtension = 'json';\n }\n\n // defaultExtension has type string but we ensure that it is DataFormatType above\n format.type = defaultExtension as DataFormatType;\n }\n } else if (isSphereGenerator(data)) {\n // hardwire GeoJSON sphere data into output specification\n this._data = {values: [{type: 'Sphere'}]};\n } else if (isNamedData(data) || isGenerator(data)) {\n this._data = {};\n }\n\n // set flag to check if generator\n this._generator = isGenerator(data);\n\n // any dataset can be named\n if (data.name) {\n this._name = data.name;\n }\n\n if (format && !isEmpty(format)) {\n this._data.format = format;\n }\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields(): undefined {\n return undefined; // we don't know what this source produces\n }\n\n get data() {\n return this._data;\n }\n\n public hasName(): boolean {\n return !!this._name;\n }\n\n get isGenerator() {\n return this._generator;\n }\n get dataName() {\n return this._name;\n }\n\n set dataName(name: string) {\n this._name = name;\n }\n\n set parent(parent: DataFlowNode) {\n throw new Error('Source nodes have to be roots.');\n }\n\n public remove() {\n throw new Error('Source nodes are roots and cannot be removed.');\n }\n\n public hash(): string | number {\n throw new Error('Cannot hash sources');\n }\n\n public assemble(): VgData {\n return {\n name: this._name,\n ...this._data,\n transform: []\n };\n }\n}\n","import {GraticuleTransform as VgGraticuleTransform} from 'vega';\nimport {GraticuleParams} from '../../data';\nimport {hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\nexport class GraticuleNode extends DataFlowNode {\n public clone() {\n return new GraticuleNode(null, this.params);\n }\n\n constructor(parent: DataFlowNode, private params: true | GraticuleParams) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields(): undefined {\n return undefined; // there should never be a node before graticule\n }\n\n public hash() {\n return `Graticule ${hash(this.params)}`;\n }\n\n public assemble(): VgGraticuleTransform {\n return {\n type: 'graticule',\n ...(this.params === true ? {} : this.params)\n };\n }\n}\n","import {SequenceParams} from '../../data';\nimport {hash} from '../../util';\nimport {SequenceTransform as VgSequenceTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\nexport class SequenceNode extends DataFlowNode {\n public clone() {\n return new SequenceNode(null, this.params);\n }\n\n constructor(parent: DataFlowNode, private params: SequenceParams) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set([this.params.as ?? 'data']);\n }\n\n public hash() {\n return `Hash ${hash(this.params)}`;\n }\n\n public assemble(): VgSequenceTransform {\n return {\n type: 'sequence',\n ...this.params\n };\n }\n}\n","import {DataFlowNode} from './dataflow';\nimport {OptimizerFlags} from './optimizers';\nimport {SourceNode} from './source';\nimport {GraticuleNode} from './graticule';\nimport {SequenceNode} from './sequence';\n\n/**\n * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator.\n */\nexport function isDataSourceNode(node: DataFlowNode) {\n return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode;\n}\n\n/**\n * Abstract base class for BottomUpOptimizer and TopDownOptimizer.\n * Contains only mutation handling logic. Subclasses need to implement iteration logic.\n */\nabstract class OptimizerBase {\n private _mutated: boolean;\n constructor() {\n this._mutated = false;\n }\n // Once true, _mutated is never set to false\n public setMutated() {\n this._mutated = true;\n }\n\n get mutatedFlag() {\n return this._mutated;\n }\n}\n\n/**\n * Starts from a node and runs the optimization function(the \"run\" method) upwards to the root,\n * depending on the continueFlag and mutatedFlag values returned by the optimization function.\n */\nexport abstract class BottomUpOptimizer extends OptimizerBase {\n private _continue: boolean;\n\n constructor() {\n super();\n this._continue = false;\n }\n\n public setContinue() {\n this._continue = true;\n }\n\n get continueFlag() {\n return this._continue;\n }\n\n get flags(): OptimizerFlags {\n return {continueFlag: this.continueFlag, mutatedFlag: this.mutatedFlag};\n }\n\n set flags({continueFlag, mutatedFlag}: OptimizerFlags) {\n if (continueFlag) {\n this.setContinue();\n }\n if (mutatedFlag) {\n this.setMutated();\n }\n }\n\n public abstract run(node: DataFlowNode): OptimizerFlags;\n\n /**\n * Reset the state of the optimizer after it has completed a run from the bottom of the tree to the top.\n */\n public reset(): void {\n // do nothing\n }\n\n public optimizeNextFromLeaves(node: DataFlowNode): boolean {\n if (isDataSourceNode(node)) {\n return false;\n }\n const next = node.parent;\n const {continueFlag} = this.run(node);\n if (continueFlag) {\n this.optimizeNextFromLeaves(next);\n }\n return this.mutatedFlag;\n }\n}\n\n/**\n * The optimizer function( the \"run\" method), is invoked on the given node and then continues recursively.\n */\nexport abstract class TopDownOptimizer extends OptimizerBase {\n public abstract run(node: DataFlowNode): boolean;\n}\n","import {AggregateOp, AggregateTransform as VgAggregateTransform} from 'vega';\nimport {isArgmaxDef, isArgminDef} from '../../aggregate';\nimport {\n Channel,\n getPositionChannelFromLatLong,\n getSecondaryRangeChannel,\n isGeoPositionChannel,\n isScaleChannel\n} from '../../channel';\nimport {binRequiresRange, FieldDef, hasBand, isTypedFieldDef, vgField} from '../../channeldef';\nimport * as log from '../../log';\nimport {AggregateTransform} from '../../transform';\nimport {Dict, duplicate, hash, keys, replacePathInField, setEqual} from '../../util';\nimport {isUnitModel, ModelWithField} from '../model';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\ntype Measures = Dict>>>;\n\nfunction addDimension(dims: Set, channel: Channel, fieldDef: FieldDef, model: ModelWithField) {\n const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;\n\n if (\n isTypedFieldDef(fieldDef) &&\n isUnitModel(model) &&\n hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config)\n ) {\n dims.add(vgField(fieldDef, {}));\n dims.add(vgField(fieldDef, {suffix: 'end'}));\n\n if (fieldDef.bin && binRequiresRange(fieldDef, channel)) {\n dims.add(vgField(fieldDef, {binSuffix: 'range'}));\n }\n } else if (isGeoPositionChannel(channel)) {\n const posChannel = getPositionChannelFromLatLong(channel);\n dims.add(model.getName(posChannel));\n } else {\n dims.add(vgField(fieldDef));\n }\n return dims;\n}\n\nfunction mergeMeasures(parentMeasures: Measures, childMeasures: Measures) {\n for (const field of keys(childMeasures)) {\n // when we merge a measure, we either have to add an aggregation operator or even a new field\n const ops = childMeasures[field];\n for (const op of keys(ops)) {\n if (field in parentMeasures) {\n // add operator to existing measure field\n parentMeasures[field][op] = new Set([...(parentMeasures[field][op] ?? []), ...ops[op]]);\n } else {\n parentMeasures[field] = {[op]: ops[op]};\n }\n }\n }\n}\n\nexport class AggregateNode extends DataFlowNode {\n public clone() {\n return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures));\n }\n\n /**\n * @param dimensions string set for dimensions\n * @param measures dictionary mapping field name => dict of aggregation functions and names to use\n */\n constructor(parent: DataFlowNode, private dimensions: Set, private measures: Measures) {\n super(parent);\n }\n\n get groupBy() {\n return this.dimensions;\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel): AggregateNode {\n let isAggregate = false;\n model.forEachFieldDef(fd => {\n if (fd.aggregate) {\n isAggregate = true;\n }\n });\n\n const meas: Measures = {};\n const dims = new Set();\n\n if (!isAggregate) {\n // no need to create this node if the model has no aggregation\n return null;\n }\n\n model.forEachFieldDef((fieldDef, channel: Channel) => {\n const {aggregate, field} = fieldDef;\n if (aggregate) {\n if (aggregate === 'count') {\n meas['*'] = meas['*'] ?? {};\n meas['*']['count'] = new Set([vgField(fieldDef, {forAs: true})]);\n } else {\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n const op = isArgminDef(aggregate) ? 'argmin' : 'argmax';\n const argField = aggregate[op];\n meas[argField] = meas[argField] ?? {};\n meas[argField][op] = new Set([vgField({op, field: argField}, {forAs: true})]);\n } else {\n meas[field] = meas[field] ?? {};\n meas[field][aggregate] = new Set([vgField(fieldDef, {forAs: true})]);\n }\n\n // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain\n if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') {\n meas[field] = meas[field] ?? {};\n meas[field]['min'] = new Set([vgField({field, aggregate: 'min'}, {forAs: true})]);\n meas[field]['max'] = new Set([vgField({field, aggregate: 'max'}, {forAs: true})]);\n }\n }\n } else {\n addDimension(dims, channel, fieldDef, model);\n }\n });\n\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n\n return new AggregateNode(parent, dims, meas);\n }\n\n public static makeFromTransform(parent: DataFlowNode, t: AggregateTransform): AggregateNode {\n const dims = new Set();\n const meas: Measures = {};\n\n for (const s of t.aggregate) {\n const {op, field, as} = s;\n if (op) {\n if (op === 'count') {\n meas['*'] = meas['*'] ?? {};\n meas['*']['count'] = new Set([as ? as : vgField(s, {forAs: true})]);\n } else {\n meas[field] = meas[field] ?? {};\n meas[field][op] = new Set([as ? as : vgField(s, {forAs: true})]);\n }\n }\n }\n\n for (const s of t.groupby ?? []) {\n dims.add(s);\n }\n\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n\n return new AggregateNode(parent, dims, meas);\n }\n\n public merge(other: AggregateNode): boolean {\n if (setEqual(this.dimensions, other.dimensions)) {\n mergeMeasures(this.measures, other.measures);\n return true;\n } else {\n log.debug('different dimensions, cannot merge');\n return false;\n }\n }\n\n public addDimensions(fields: readonly string[]) {\n fields.forEach(this.dimensions.add, this.dimensions);\n }\n\n public dependentFields() {\n return new Set([...this.dimensions, ...keys(this.measures)]);\n }\n\n public producedFields() {\n const out = new Set();\n\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n const m = this.measures[field][op];\n if (m.size === 0) {\n out.add(`${op}_${field}`);\n } else {\n m.forEach(out.add, out);\n }\n }\n }\n\n return out;\n }\n\n public hash() {\n return `Aggregate ${hash({dimensions: this.dimensions, measures: this.measures})}`;\n }\n\n public assemble(): VgAggregateTransform {\n const ops: AggregateOp[] = [];\n const fields: string[] = [];\n const as: string[] = [];\n\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n for (const alias of this.measures[field][op]) {\n as.push(alias);\n ops.push(op);\n fields.push(field === '*' ? null : replacePathInField(field));\n }\n }\n }\n\n const result: VgAggregateTransform = {\n type: 'aggregate',\n groupby: [...this.dimensions].map(replacePathInField),\n ops,\n fields,\n as\n };\n\n return result;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinning} from '../../bin';\nimport {COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../../channel';\nimport {vgField} from '../../channeldef';\nimport * as log from '../../log';\nimport {hasDiscreteDomain} from '../../scale';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortField} from '../../sort';\nimport {hash} from '../../util';\nimport {isVgRangeStep, VgData} from '../../vega.schema';\nimport {FacetModel} from '../facet';\nimport {HEADER_CHANNELS, HEADER_TYPES} from '../header/component';\nimport {Model} from '../model';\nimport {assembleDomain, getFieldFromDomain} from '../scale/domain';\nimport {sortArrayIndexField} from './calculate';\nimport {DataFlowNode} from './dataflow';\n\ninterface ChildIndependentFieldsWithStep {\n x?: string;\n y?: string;\n}\n\ninterface FacetChannelInfo {\n name: string;\n fields: string[];\n sortField?: EncodingSortField;\n\n sortIndexField?: string;\n}\n\n/**\n * A node that helps us track what fields we are faceting by.\n */\nexport class FacetNode extends DataFlowNode {\n private readonly column: FacetChannelInfo;\n\n private readonly row: FacetChannelInfo;\n\n private readonly facet: FacetChannelInfo;\n\n private readonly childModel: Model;\n\n /**\n * @param model The facet model.\n * @param name The name that this facet source will have.\n * @param data The source data for this facet data.\n */\n public constructor(\n parent: DataFlowNode,\n public readonly model: FacetModel,\n public readonly name: string,\n public data: string\n ) {\n super(parent);\n\n for (const channel of FACET_CHANNELS) {\n const fieldDef = model.facet[channel];\n if (fieldDef) {\n const {bin, sort} = fieldDef;\n this[channel] = {\n name: model.getName(`${channel}_domain`),\n fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, {binSuffix: 'end'})] : [])],\n ...(isSortField(sort)\n ? {sortField: sort}\n : isArray(sort)\n ? {sortIndexField: sortArrayIndexField(fieldDef, channel)}\n : {})\n };\n }\n }\n this.childModel = model.child;\n }\n\n public hash() {\n let out = `Facet`;\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n out += ` ${channel.charAt(0)}:${hash(this[channel])}`;\n }\n }\n\n return out;\n }\n\n get fields() {\n const f: string[] = [];\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]?.fields) {\n f.push(...this[channel].fields);\n }\n }\n return f;\n }\n\n public dependentFields() {\n const depFields = new Set(this.fields);\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n if (this[channel].sortField) {\n depFields.add(this[channel].sortField.field);\n }\n if (this[channel].sortIndexField) {\n depFields.add(this[channel].sortIndexField);\n }\n }\n }\n\n return depFields;\n }\n\n public producedFields() {\n return new Set(); // facet does not produce any new fields\n }\n\n /**\n * The name to reference this source is its name.\n */\n public getSource() {\n return this.name;\n }\n\n private getChildIndependentFieldsWithStep() {\n const childIndependentFieldsWithStep: ChildIndependentFieldsWithStep = {};\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.childModel.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n // independent scale\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.childModel, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n childIndependentFieldsWithStep[channel] = field;\n } else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n\n return childIndependentFieldsWithStep;\n }\n\n private assembleRowColumnHeaderData(\n channel: 'row' | 'column' | 'facet',\n crossedDataName: string,\n childIndependentFieldsWithStep: ChildIndependentFieldsWithStep\n ): VgData {\n const childChannel = {row: 'y', column: 'x'}[channel];\n\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n\n if (childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) {\n if (crossedDataName) {\n // If there is a crossed data, calculate max\n fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n\n ops.push('max');\n } else {\n // If there is no crossed data, just calculate distinct\n fields.push(childIndependentFieldsWithStep[childChannel]);\n ops.push('distinct');\n }\n // Although it is technically a max, just name it distinct so it's easier to refer to it\n as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n }\n\n const {sortField, sortIndexField} = this[channel];\n if (sortField) {\n const {op = DEFAULT_SORT_OP, field} = sortField;\n fields.push(field);\n ops.push(op);\n as.push(vgField(sortField, {forAs: true}));\n } else if (sortIndexField) {\n fields.push(sortIndexField);\n ops.push('max');\n as.push(sortIndexField);\n }\n\n return {\n name: this[channel].name,\n // Use data from the crossed one if it exist\n source: crossedDataName ?? this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this[channel].fields,\n ...(fields.length\n ? {\n fields,\n ops,\n as\n }\n : {})\n }\n ]\n };\n }\n\n private assembleFacetHeaderData(childIndependentFieldsWithStep: ChildIndependentFieldsWithStep) {\n const {columns} = this.model.layout;\n const {layoutHeaders} = this.model.component;\n const data: VgData[] = [];\n\n const hasSharedAxis: {row?: true; column?: true} = {};\n for (const headerChannel of HEADER_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const headers = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) ?? [];\n for (const header of headers) {\n if (header.axes?.length > 0) {\n hasSharedAxis[headerChannel] = true;\n break;\n }\n }\n }\n\n if (hasSharedAxis[headerChannel]) {\n const cardinality = `length(data(\"${this.facet.name}\"))`;\n\n const stop =\n headerChannel === 'row'\n ? columns\n ? {signal: `ceil(${cardinality} / ${columns})`}\n : 1\n : columns\n ? {signal: `min(${cardinality}, ${columns})`}\n : {signal: cardinality};\n\n data.push({\n name: `${this.facet.name}_${headerChannel}`,\n transform: [\n {\n type: 'sequence',\n start: 0,\n stop\n }\n ]\n });\n }\n }\n\n const {row, column} = hasSharedAxis;\n\n if (row || column) {\n data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep));\n }\n\n return data;\n }\n\n public assemble() {\n const data: VgData[] = [];\n let crossedDataName = null;\n const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep();\n\n const {column, row, facet} = this;\n\n if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) {\n // Need to create a cross dataset to correctly calculate cardinality\n crossedDataName = `cross_${this.column.name}_${this.row.name}`;\n\n const fields: string[] = [].concat(\n childIndependentFieldsWithStep.x ?? [],\n childIndependentFieldsWithStep.y ?? []\n );\n const ops = fields.map((): AggregateOp => 'distinct');\n\n data.push({\n name: crossedDataName,\n source: this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this.fields,\n fields,\n ops\n }\n ]\n });\n }\n\n for (const channel of [COLUMN, ROW]) {\n if (this[channel]) {\n data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep));\n }\n }\n\n if (facet) {\n const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep);\n if (facetData) {\n data.push(...facetData);\n }\n }\n\n return data;\n }\n}\n","import {FormulaTransform as VgFormulaTransform, SignalRef} from 'vega';\nimport {isNumber, isString} from 'vega-util';\nimport {AncestorParse} from '.';\nimport {isMinMaxOp} from '../../aggregate';\nimport {getMainRangeChannel, SingleDefChannel} from '../../channel';\nimport {\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n isScaleFieldDef,\n isTypedFieldDef,\n TypedFieldDef\n} from '../../channeldef';\nimport {isGenerator, Parse} from '../../data';\nimport {DateTime, isDateTime} from '../../datetime';\nimport * as log from '../../log';\nimport {forEachLeaf} from '../../logical';\nimport {isPathMark} from '../../mark';\nimport {isFieldEqualPredicate, isFieldOneOfPredicate, isFieldPredicate, isFieldRangePredicate} from '../../predicate';\nimport {isSortField} from '../../sort';\nimport {FilterTransform} from '../../transform';\nimport {accessPathDepth, accessPathWithDatum, Dict, duplicate, hash, keys, removePathFromField} from '../../util';\nimport {isFacetModel, isUnitModel, Model} from '../model';\nimport {Split} from '../split';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * Remove quotes from a string.\n */\nfunction unquote(pattern: string) {\n if (\n (pattern[0] === \"'\" && pattern[pattern.length - 1] === \"'\") ||\n (pattern[0] === '\"' && pattern[pattern.length - 1] === '\"')\n ) {\n return pattern.slice(1, -1);\n }\n return pattern;\n}\n\n/**\n * @param field The field.\n * @param parse What to parse the field as.\n */\nfunction parseExpression(field: string, parse: string): string {\n const f = accessPathWithDatum(field);\n if (parse === 'number') {\n return `toNumber(${f})`;\n } else if (parse === 'boolean') {\n return `toBoolean(${f})`;\n } else if (parse === 'string') {\n return `toString(${f})`;\n } else if (parse === 'date') {\n return `toDate(${f})`;\n } else if (parse === 'flatten') {\n return f;\n } else if (parse.indexOf('date:') === 0) {\n const specifier = unquote(parse.slice(5, parse.length));\n return `timeParse(${f},'${specifier}')`;\n } else if (parse.indexOf('utc:') === 0) {\n const specifier = unquote(parse.slice(4, parse.length));\n return `utcParse(${f},'${specifier}')`;\n } else {\n log.warn(log.message.unrecognizedParse(parse));\n return null;\n }\n}\n\nexport function getImplicitFromFilterTransform(transform: FilterTransform) {\n const implicit: Dict = {};\n forEachLeaf(transform.filter, filter => {\n if (isFieldPredicate(filter)) {\n // Automatically add a parse node for filters with filter objects\n let val: string | number | boolean | DateTime | SignalRef = null;\n\n // For EqualFilter, just use the equal property.\n // For RangeFilter and OneOfFilter, all array members should have\n // the same type, so we only use the first one.\n if (isFieldEqualPredicate(filter)) {\n val = filter.equal;\n } else if (isFieldRangePredicate(filter)) {\n val = filter.range[0];\n } else if (isFieldOneOfPredicate(filter)) {\n val = (filter.oneOf ?? filter['in'])[0];\n } // else -- for filter expression, we can't infer anything\n if (val) {\n if (isDateTime(val)) {\n implicit[filter.field] = 'date';\n } else if (isNumber(val)) {\n implicit[filter.field] = 'number';\n } else if (isString(val)) {\n implicit[filter.field] = 'string';\n }\n }\n\n if (filter.timeUnit) {\n implicit[filter.field] = 'date';\n }\n }\n });\n\n return implicit;\n}\n\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromEncoding(model: Model) {\n const implicit: Dict = {};\n\n function add(fieldDef: TypedFieldDef) {\n if (isFieldOrDatumDefForTimeFormat(fieldDef)) {\n implicit[fieldDef.field] = 'date';\n } else if (\n fieldDef.type === 'quantitative' &&\n isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max\n ) {\n implicit[fieldDef.field] = 'number';\n } else if (accessPathDepth(fieldDef.field) > 1) {\n // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field.\n // (Parsing numbers / dates already flattens numeric and temporal fields.)\n if (!(fieldDef.field in implicit)) {\n implicit[fieldDef.field] = 'flatten';\n }\n } else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) {\n // Flatten fields that we sort by but that are not otherwise flattened.\n if (!(fieldDef.sort.field in implicit)) {\n implicit[fieldDef.sort.field] = 'flatten';\n }\n }\n }\n\n if (isUnitModel(model) || isFacetModel(model)) {\n // Parse encoded fields\n model.forEachFieldDef((fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef)) {\n add(fieldDef);\n } else {\n const mainChannel = getMainRangeChannel(channel);\n const mainFieldDef = model.fieldDef(mainChannel as SingleDefChannel) as TypedFieldDef;\n add({\n ...fieldDef,\n type: mainFieldDef.type\n });\n }\n });\n }\n\n // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly.\n if (isUnitModel(model)) {\n const {mark, markDef, encoding} = model;\n if (\n isPathMark(mark) &&\n // No need to sort by dimension if we have a connected scatterplot (order channel is present)\n !model.encoding.order\n ) {\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (\n isFieldDef(dimensionChannelDef) &&\n dimensionChannelDef.type === 'quantitative' &&\n !(dimensionChannelDef.field in implicit)\n ) {\n implicit[dimensionChannelDef.field] = 'number';\n }\n }\n }\n\n return implicit;\n}\n\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromSelection(model: Model) {\n const implicit: Dict = {};\n\n if (isUnitModel(model) && model.component.selection) {\n for (const name of keys(model.component.selection)) {\n const selCmpt = model.component.selection[name];\n for (const proj of selCmpt.project.items) {\n if (!proj.channel && accessPathDepth(proj.field) > 1) {\n implicit[proj.field] = 'flatten';\n }\n }\n }\n }\n\n return implicit;\n}\n\nexport class ParseNode extends DataFlowNode {\n private _parse: Parse;\n\n public clone() {\n return new ParseNode(null, duplicate(this._parse));\n }\n\n constructor(parent: DataFlowNode, parse: Parse) {\n super(parent);\n\n this._parse = parse;\n }\n\n public hash() {\n return `Parse ${hash(this._parse)}`;\n }\n\n /**\n * Creates a parse node from a data.format.parse and updates ancestorParse.\n */\n public static makeExplicit(parent: DataFlowNode, model: Model, ancestorParse: AncestorParse) {\n // Custom parse\n let explicit = {};\n const data = model.data;\n if (!isGenerator(data) && data && data.format && data.format.parse) {\n explicit = data.format.parse;\n }\n\n return this.makeWithAncestors(parent, explicit, {}, ancestorParse);\n }\n\n /**\n * Creates a parse node from \"explicit\" parse and \"implicit\" parse and updates ancestorParse.\n */\n public static makeWithAncestors(\n parent: DataFlowNode,\n explicit: Parse,\n implicit: Parse,\n ancestorParse: AncestorParse\n ) {\n // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as \"derived\"). We also don't need to flatten a field that has already been parsed.\n for (const field of keys(implicit)) {\n const parsedAs = ancestorParse.getWithExplicit(field);\n if (parsedAs.value !== undefined) {\n // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types.\n if (\n parsedAs.explicit ||\n parsedAs.value === implicit[field] ||\n parsedAs.value === 'derived' ||\n implicit[field] === 'flatten'\n ) {\n delete implicit[field];\n } else {\n log.warn(log.message.differentParse(field, implicit[field], parsedAs.value));\n }\n }\n }\n\n for (const field of keys(explicit)) {\n const parsedAs = ancestorParse.get(field);\n if (parsedAs !== undefined) {\n // Don't parse a field again if it has been parsed with the same type already.\n if (parsedAs === explicit[field]) {\n delete explicit[field];\n } else {\n log.warn(log.message.differentParse(field, explicit[field], parsedAs));\n }\n }\n }\n\n const parse = new Split(explicit, implicit);\n\n // add the format parse from this model so that children don't parse the same field again\n ancestorParse.copyAll(parse);\n\n // copy only non-null parses\n const p: Dict = {};\n for (const key of keys(parse.combine())) {\n const val = parse.get(key);\n if (val !== null) {\n p[key] = val;\n }\n }\n\n if (keys(p).length === 0 || ancestorParse.parseNothing) {\n return null;\n }\n\n return new ParseNode(parent, p);\n }\n\n public get parse() {\n return this._parse;\n }\n\n public merge(other: ParseNode) {\n this._parse = {...this._parse, ...other.parse};\n other.remove();\n }\n\n /**\n * Assemble an object for Vega's format.parse property.\n */\n public assembleFormatParse() {\n const formatParse: Dict = {};\n for (const field of keys(this._parse)) {\n const p = this._parse[field];\n if (accessPathDepth(field) === 1) {\n formatParse[field] = p;\n }\n }\n return formatParse;\n }\n\n // format parse depends and produces all fields in its parse\n public producedFields() {\n return new Set(keys(this._parse));\n }\n\n public dependentFields() {\n return new Set(keys(this._parse));\n }\n\n public assembleTransforms(onlyNested = false): VgFormulaTransform[] {\n return keys(this._parse)\n .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true))\n .map(field => {\n const expr = parseExpression(field, this._parse[field]);\n if (!expr) {\n return null;\n }\n\n const formula: VgFormulaTransform = {\n type: 'formula',\n expr,\n as: removePathFromField(field) // Vega output is always flattened\n };\n return formula;\n })\n .filter(t => t !== null);\n }\n}\n","import {SELECTION_ID} from '../../selection';\nimport {IdentifierTransform as VgIdentifierTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\nexport class IdentifierNode extends DataFlowNode {\n public clone() {\n return new IdentifierNode(null);\n }\n\n constructor(parent: DataFlowNode) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set([SELECTION_ID]);\n }\n\n public hash() {\n return 'Identifier';\n }\n\n public assemble(): VgIdentifierTransform {\n return {type: 'identifier', as: SELECTION_ID};\n }\n}\n","import {AggregateOp} from 'vega';\nimport {vgField} from '../../channeldef';\nimport {JoinAggregateTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {VgJoinAggregateTransform} from '../../vega.schema';\nimport {JoinAggregateFieldDef} from '../../transform';\nimport {unique} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the join aggregate transform nodes.\n */\nexport class JoinAggregateTransformNode extends DataFlowNode {\n public clone() {\n return new JoinAggregateTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private readonly transform: JoinAggregateTransform) {\n super(parent);\n }\n\n public addDimensions(fields: string[]) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n\n public dependentFields() {\n const out = new Set();\n\n if (this.transform.groupby) {\n this.transform.groupby.forEach(out.add, out);\n }\n this.transform.joinaggregate\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this.transform.joinaggregate.map(this.getDefaultName));\n }\n\n private getDefaultName(joinAggregateFieldDef: JoinAggregateFieldDef): string {\n return joinAggregateFieldDef.as ?? vgField(joinAggregateFieldDef);\n }\n\n public hash() {\n return `JoinAggregateTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgJoinAggregateTransform {\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n for (const joinaggregate of this.transform.joinaggregate) {\n ops.push(joinaggregate.op);\n as.push(this.getDefaultName(joinaggregate));\n fields.push(joinaggregate.field === undefined ? null : joinaggregate.field);\n }\n\n const groupby = this.transform.groupby;\n\n return {\n type: 'joinaggregate',\n as,\n ops,\n fields,\n ...(groupby !== undefined ? {groupby} : {})\n };\n }\n}\n","import {Transforms as VgTransform} from 'vega';\nimport {isArray, isString} from 'vega-util';\nimport {FieldName, getFieldDef, isFieldDef, PositionFieldDef, vgField} from '../../channeldef';\nimport {SortFields, SortOrder} from '../../sort';\nimport {StackOffset} from '../../stack';\nimport {StackTransform} from '../../transform';\nimport {duplicate, getFirstDefined, hash} from '../../util';\nimport {sortParams} from '../common';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nfunction getStackByFields(model: UnitModel): string[] {\n return model.stack.stackBy.reduce((fields, by) => {\n const fieldDef = by.fieldDef;\n\n const _field = vgField(fieldDef);\n if (_field) {\n fields.push(_field);\n }\n return fields;\n }, [] as string[]);\n}\n\nexport interface StackComponent {\n /**\n * Faceted field.\n */\n facetby: string[];\n\n dimensionFieldDef?: PositionFieldDef;\n\n /**\n * Stack measure's field. Used in makeFromEncoding.\n */\n stackField: string;\n\n /**\n * Level of detail fields for each level in the stacked charts such as color or detail.\n * Used in makeFromEncoding.\n */\n stackby?: string[];\n\n /**\n * Field that determines order of levels in the stacked charts.\n * Used in both but optional in transform.\n */\n sort: SortFields;\n\n /** Mode for stacking marks.\n */\n offset: StackOffset;\n\n /**\n * Whether to impute the data before stacking. Used only in makeFromEncoding.\n */\n impute?: boolean;\n\n /**\n * The data fields to group by.\n */\n groupby?: FieldName[];\n /**\n * Output field names of each stack field.\n */\n as: [FieldName, FieldName];\n}\n\nfunction isValidAsArray(as: string[] | string): as is string[] {\n return isArray(as) && as.every(s => isString(s)) && as.length > 1;\n}\n\nexport class StackNode extends DataFlowNode {\n private _stack: StackComponent;\n\n public clone() {\n return new StackNode(null, duplicate(this._stack));\n }\n\n constructor(parent: DataFlowNode, stack: StackComponent) {\n super(parent);\n\n this._stack = stack;\n }\n\n public static makeFromTransform(parent: DataFlowNode, stackTransform: StackTransform) {\n const {stack, groupby, as, offset = 'zero'} = stackTransform;\n\n const sortFields: string[] = [];\n const sortOrder: SortOrder[] = [];\n if (stackTransform.sort !== undefined) {\n for (const sortField of stackTransform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(getFirstDefined(sortField.order, 'ascending'));\n }\n }\n const sort: SortFields = {\n field: sortFields,\n order: sortOrder\n };\n let normalizedAs: [string, string];\n if (isValidAsArray(as)) {\n normalizedAs = as;\n } else if (isString(as)) {\n normalizedAs = [as, as + '_end'];\n } else {\n normalizedAs = [stackTransform.stack + '_start', stackTransform.stack + '_end'];\n }\n\n return new StackNode(parent, {\n stackField: stack,\n groupby,\n offset,\n sort,\n facetby: [],\n as: normalizedAs\n });\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) {\n const stackProperties = model.stack;\n const {encoding} = model;\n\n if (!stackProperties) {\n return null;\n }\n\n const {groupbyChannel, fieldChannel, offset, impute} = stackProperties;\n\n let dimensionFieldDef: PositionFieldDef;\n if (groupbyChannel) {\n const cDef = encoding[groupbyChannel];\n dimensionFieldDef = getFieldDef(cDef) as PositionFieldDef; // Fair to cast as groupByChannel is always either x or y\n }\n\n const stackby = getStackByFields(model);\n const orderDef = model.encoding.order;\n\n let sort: SortFields;\n if (isArray(orderDef) || isFieldDef(orderDef)) {\n sort = sortParams(orderDef);\n } else {\n // default = descending by stackFields\n // FIXME is the default here correct for binned fields?\n sort = stackby.reduce(\n (s, field) => {\n s.field.push(field);\n s.order.push(fieldChannel === 'y' ? 'descending' : 'ascending');\n return s;\n },\n {field: [], order: []}\n );\n }\n\n return new StackNode(parent, {\n dimensionFieldDef,\n stackField: model.vgField(fieldChannel),\n facetby: [],\n stackby,\n sort,\n offset,\n impute,\n as: [\n model.vgField(fieldChannel, {suffix: 'start', forAs: true}),\n model.vgField(fieldChannel, {suffix: 'end', forAs: true})\n ]\n });\n }\n\n get stack(): StackComponent {\n return this._stack;\n }\n\n public addDimensions(fields: string[]) {\n this._stack.facetby.push(...fields);\n }\n\n public dependentFields() {\n const out = new Set();\n\n out.add(this._stack.stackField);\n\n this.getGroupbyFields().forEach(out.add, out);\n this._stack.facetby.forEach(out.add, out);\n this._stack.sort.field.forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this._stack.as);\n }\n\n public hash() {\n return `Stack ${hash(this._stack)}`;\n }\n\n private getGroupbyFields() {\n const {dimensionFieldDef, impute, groupby} = this._stack;\n if (dimensionFieldDef) {\n if (dimensionFieldDef.bin) {\n if (impute) {\n // For binned group by field with impute, we calculate bin_mid\n // as we cannot impute two fields simultaneously\n return [vgField(dimensionFieldDef, {binSuffix: 'mid'})];\n }\n return [\n // For binned group by field without impute, we need both bin (start) and bin_end\n vgField(dimensionFieldDef, {}),\n vgField(dimensionFieldDef, {binSuffix: 'end'})\n ];\n }\n return [vgField(dimensionFieldDef)];\n }\n return groupby ?? [];\n }\n\n public assemble(): VgTransform[] {\n const transform: VgTransform[] = [];\n const {facetby, dimensionFieldDef, stackField: field, stackby, sort, offset, impute, as} = this._stack;\n\n // Impute\n if (impute && dimensionFieldDef) {\n const {band = 0.5, bin} = dimensionFieldDef;\n if (bin) {\n // As we can only impute one field at a time, we need to calculate\n // mid point for a binned field\n transform.push({\n type: 'formula',\n expr:\n `${band}*` +\n vgField(dimensionFieldDef, {expr: 'datum'}) +\n `+${1 - band}*` +\n vgField(dimensionFieldDef, {expr: 'datum', binSuffix: 'end'}),\n as: vgField(dimensionFieldDef, {binSuffix: 'mid', forAs: true})\n });\n }\n\n transform.push({\n type: 'impute',\n field,\n groupby: [...stackby, ...facetby],\n key: vgField(dimensionFieldDef, {binSuffix: 'mid'}),\n method: 'value',\n value: 0\n });\n }\n\n // Stack\n transform.push({\n type: 'stack',\n groupby: [...this.getGroupbyFields(), ...facetby],\n field,\n sort,\n as,\n offset\n });\n\n return transform;\n }\n}\n","import {AggregateOp, WindowTransform as VgWindowTransform} from 'vega';\nimport {isAggregateOp} from '../../aggregate';\nimport {vgField} from '../../channeldef';\nimport {SortOrder} from '../../sort';\nimport {WindowFieldDef, WindowOnlyOp, WindowTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {VgComparator, VgJoinAggregateTransform} from '../../vega.schema';\nimport {unique} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the window transform nodes\n */\nexport class WindowTransformNode extends DataFlowNode {\n public clone() {\n return new WindowTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private readonly transform: WindowTransform) {\n super(parent);\n }\n\n public addDimensions(fields: string[]) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n\n public dependentFields() {\n const out = new Set();\n\n (this.transform.groupby ?? []).forEach(out.add, out);\n (this.transform.sort ?? []).forEach(m => out.add(m.field));\n\n this.transform.window\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this.transform.window.map(this.getDefaultName));\n }\n\n private getDefaultName(windowFieldDef: WindowFieldDef): string {\n return windowFieldDef.as ?? vgField(windowFieldDef);\n }\n\n public hash() {\n return `WindowTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgWindowTransform | VgJoinAggregateTransform {\n const fields: string[] = [];\n const ops: (AggregateOp | WindowOnlyOp)[] = [];\n const as: string[] = [];\n const params = [];\n\n for (const window of this.transform.window) {\n ops.push(window.op);\n as.push(this.getDefaultName(window));\n params.push(window.param === undefined ? null : window.param);\n fields.push(window.field === undefined ? null : window.field);\n }\n\n const frame = this.transform.frame;\n const groupby = this.transform.groupby;\n\n if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) {\n // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate\n return {\n type: 'joinaggregate',\n as,\n ops: ops as AggregateOp[],\n fields,\n ...(groupby !== undefined ? {groupby} : {})\n } as VgJoinAggregateTransform;\n }\n\n const sortFields: string[] = [];\n const sortOrder: SortOrder[] = [];\n if (this.transform.sort !== undefined) {\n for (const sortField of this.transform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(sortField.order ?? 'ascending');\n }\n }\n const sort: VgComparator = {\n field: sortFields,\n order: sortOrder\n };\n const ignorePeers = this.transform.ignorePeers;\n\n return {\n type: 'window',\n params,\n as,\n ops,\n fields,\n sort,\n ...(ignorePeers !== undefined ? {ignorePeers} : {}),\n ...(groupby !== undefined ? {groupby} : {}),\n ...(frame !== undefined ? {frame} : {})\n } as VgWindowTransform;\n }\n}\n","import {DataSourceType, Parse} from '../../data';\nimport {Dict, fieldIntersection, hash, hasIntersection, isEmpty, keys, some} from '../../util';\nimport {Model} from '../model';\nimport {requiresSelectionId} from '../selection';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {ParseNode} from './formatparse';\nimport {IdentifierNode} from './identifier';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {FACET_SCALE_PREFIX} from './optimize';\nimport {BottomUpOptimizer, isDataSourceNode, TopDownOptimizer} from './optimizer';\nimport * as optimizers from './optimizers';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nexport interface OptimizerFlags {\n /**\n * If true, iteration continues.\n */\n continueFlag: boolean;\n /**\n * If true, the tree has been mutated by the function.\n */\n mutatedFlag: boolean;\n}\n\n/**\n * Move parse nodes up to forks.\n */\nexport class MoveParseUp extends BottomUpOptimizer {\n public run(node: DataFlowNode): OptimizerFlags {\n const parent = node.parent;\n // Move parse up by merging or swapping.\n if (node instanceof ParseNode) {\n if (isDataSourceNode(parent)) {\n return this.flags;\n }\n\n if (parent.numChildren() > 1) {\n // Don't move parse further up but continue with parent.\n this.setContinue();\n return this.flags;\n }\n\n if (parent instanceof ParseNode) {\n this.setMutated();\n parent.merge(node);\n } else {\n // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup).\n if (fieldIntersection(parent.producedFields(), node.dependentFields())) {\n this.setContinue();\n return this.flags;\n }\n this.setMutated();\n node.swapWithParent();\n }\n }\n this.setContinue();\n return this.flags;\n }\n}\n\n/**\n * Merge identical nodes at forks by comparing hashes.\n *\n * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler.\n */\nexport class MergeIdenticalNodes extends TopDownOptimizer {\n public mergeNodes(parent: DataFlowNode, nodes: DataFlowNode[]) {\n const mergedNode = nodes.shift();\n for (const node of nodes) {\n parent.removeChild(node);\n node.parent = mergedNode;\n node.remove();\n }\n }\n\n public run(node: DataFlowNode): boolean {\n const hashes = node.children.map(x => x.hash());\n const buckets: {hash?: DataFlowNode[]} = {};\n\n for (let i = 0; i < hashes.length; i++) {\n if (buckets[hashes[i]] === undefined) {\n buckets[hashes[i]] = [node.children[i]];\n } else {\n buckets[hashes[i]].push(node.children[i]);\n }\n }\n\n for (const k of keys(buckets)) {\n if (buckets[k].length > 1) {\n this.setMutated();\n this.mergeNodes(node, buckets[k]);\n }\n }\n for (const child of node.children) {\n this.run(child);\n }\n return this.mutatedFlag;\n }\n}\n\n/**\n * Repeatedly remove leaf nodes that are not output or facet nodes.\n * The reason is that we don't need subtrees that don't have any output nodes.\n * Facet nodes are needed for the row or column domains.\n */\nexport class RemoveUnusedSubtrees extends BottomUpOptimizer {\n public run(node: DataFlowNode): OptimizerFlags {\n if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) {\n // no need to continue with parent because it is output node or will have children (there was a fork)\n return this.flags;\n } else {\n this.setMutated();\n node.remove();\n }\n return this.flags;\n }\n}\n\n/**\n * Removes duplicate time unit nodes (as determined by the name of the\n * output field) that may be generated due to selections projected over\n * time units.\n *\n * TODO: Try to make this a top down optimizer that keeps only the first\n * insance of a time unit node.\n * TODO: Try to make a generic version of this that only keeps one node per hash.\n */\nexport class RemoveDuplicateTimeUnits extends BottomUpOptimizer {\n private fields = new Set();\n private prev: DataFlowNode = null;\n public run(node: DataFlowNode): OptimizerFlags {\n this.setContinue();\n if (node instanceof TimeUnitNode) {\n const pfields = node.producedFields();\n if (hasIntersection(pfields, this.fields)) {\n this.setMutated();\n this.prev.remove();\n } else {\n this.fields = new Set([...this.fields, ...pfields]);\n }\n this.prev = node;\n }\n return this.flags;\n }\n\n public reset(): void {\n this.fields.clear();\n }\n}\n\n/**\n * Merge adjacent time unit nodes.\n */\nexport class MergeTimeUnits extends BottomUpOptimizer {\n public run(node: DataFlowNode): OptimizerFlags {\n this.setContinue();\n const parent = node.parent;\n const timeUnitChildren = parent.children.filter(x => x instanceof TimeUnitNode) as TimeUnitNode[];\n const combination = timeUnitChildren.pop();\n for (const timeUnit of timeUnitChildren) {\n this.setMutated();\n combination.merge(timeUnit);\n }\n return this.flags;\n }\n}\n\n/**\n * Clones the subtree and ignores output nodes except for the leaves, which are renamed.\n */\nfunction cloneSubtree(facet: FacetNode) {\n function clone(node: DataFlowNode): DataFlowNode[] {\n if (!(node instanceof FacetNode)) {\n const copy = node.clone();\n\n if (copy instanceof OutputNode) {\n const newName = FACET_SCALE_PREFIX + copy.getSource();\n copy.setSource(newName);\n\n facet.model.component.data.outputNodes[newName] = copy;\n } else if (\n copy instanceof AggregateNode ||\n copy instanceof StackNode ||\n copy instanceof WindowTransformNode ||\n copy instanceof JoinAggregateTransformNode\n ) {\n copy.addDimensions(facet.fields);\n }\n for (const n of node.children.flatMap(clone)) {\n n.parent = copy;\n }\n\n return [copy];\n }\n\n return node.children.flatMap(clone);\n }\n return clone;\n}\n\n/**\n * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node.\n * After moving down the facet node, make a copy of the subtree and make it a child of the main output.\n */\nexport function moveFacetDown(node: DataFlowNode) {\n if (node instanceof FacetNode) {\n if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) {\n // move down until we hit a fork or output node\n const child = node.children[0];\n\n if (\n child instanceof AggregateNode ||\n child instanceof StackNode ||\n child instanceof WindowTransformNode ||\n child instanceof JoinAggregateTransformNode\n ) {\n child.addDimensions(node.fields);\n }\n\n child.swapWithParent();\n moveFacetDown(node);\n } else {\n // move main to facet\n\n const facetMain = node.model.component.data.main;\n moveMainDownToFacet(facetMain);\n\n // replicate the subtree and place it before the facet's main node\n const cloner = cloneSubtree(node);\n const copy: DataFlowNode[] = node.children.map(cloner).flat();\n for (const c of copy) {\n c.parent = facetMain;\n }\n }\n } else {\n node.children.map(moveFacetDown);\n }\n}\n\nfunction moveMainDownToFacet(node: DataFlowNode) {\n if (node instanceof OutputNode && node.type === DataSourceType.Main) {\n if (node.numChildren() === 1) {\n const child = node.children[0];\n if (!(child instanceof FacetNode)) {\n child.swapWithParent();\n moveMainDownToFacet(node);\n }\n }\n }\n}\n\n/**\n * Remove output nodes that are not required. Starting from a root.\n */\nexport class RemoveUnnecessaryOutputNodes extends TopDownOptimizer {\n constructor() {\n super();\n }\n\n public run(node: DataFlowNode): boolean {\n if (node instanceof OutputNode && !node.isRequired()) {\n this.setMutated();\n node.remove();\n }\n\n for (const child of node.children) {\n this.run(child);\n }\n\n return this.mutatedFlag;\n }\n}\n\nexport class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer {\n private requiresSelectionId: boolean;\n constructor(model: Model) {\n super();\n this.requiresSelectionId = model && requiresSelectionId(model);\n }\n\n public run(node: DataFlowNode): boolean {\n if (node instanceof IdentifierNode) {\n // Only preserve IdentifierNodes if we have default discrete selections\n // in our model tree, and if the nodes come after tuple producing nodes.\n if (\n !(\n this.requiresSelectionId &&\n (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode)\n )\n ) {\n this.setMutated();\n node.remove();\n }\n }\n\n for (const child of node.children) {\n this.run(child);\n }\n\n return this.mutatedFlag;\n }\n}\n\n/**\n * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes.\n *\n * We assume that dependent paths that do not have a parse node can be just merged.\n */\nexport class MergeParse extends BottomUpOptimizer {\n public run(node: DataFlowNode): optimizers.OptimizerFlags {\n const parent = node.parent;\n const originalChildren = [...parent.children];\n const parseChildren = parent.children.filter((child): child is ParseNode => child instanceof ParseNode);\n\n if (parent.numChildren() > 1 && parseChildren.length >= 1) {\n const commonParse: Parse = {};\n const conflictingParse = new Set();\n for (const parseNode of parseChildren) {\n const parse = parseNode.parse;\n for (const k of keys(parse)) {\n if (!(k in commonParse)) {\n commonParse[k] = parse[k];\n } else if (commonParse[k] !== parse[k]) {\n conflictingParse.add(k);\n }\n }\n }\n\n for (const field of conflictingParse) {\n delete commonParse[field];\n }\n\n if (!isEmpty(commonParse)) {\n this.setMutated();\n const mergedParseNode = new ParseNode(parent, commonParse);\n for (const childNode of originalChildren) {\n if (childNode instanceof ParseNode) {\n for (const key of keys(commonParse)) {\n delete childNode.parse[key];\n }\n }\n\n parent.removeChild(childNode);\n childNode.parent = mergedParseNode;\n\n // remove empty parse nodes\n if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) {\n childNode.remove();\n }\n }\n }\n }\n\n this.setContinue();\n return this.flags;\n }\n}\n\nexport class MergeAggregates extends BottomUpOptimizer {\n public run(node: DataFlowNode): optimizers.OptimizerFlags {\n const parent = node.parent;\n const aggChildren = parent.children.filter((child): child is AggregateNode => child instanceof AggregateNode);\n\n // Object which we'll use to map the fields which an aggregate is grouped by to\n // the set of aggregates with that grouping. This is useful as only aggregates\n // with the same group by can be merged\n const groupedAggregates: Dict = {};\n\n // Build groupedAggregates\n for (const agg of aggChildren) {\n const groupBys = hash(agg.groupBy);\n if (!(groupBys in groupedAggregates)) {\n groupedAggregates[groupBys] = [];\n }\n groupedAggregates[groupBys].push(agg);\n }\n\n // Merge aggregateNodes with same key in groupedAggregates\n for (const group of keys(groupedAggregates)) {\n const mergeableAggs = groupedAggregates[group];\n if (mergeableAggs.length > 1) {\n const mergedAggs = mergeableAggs.pop();\n for (const agg of mergeableAggs) {\n if (mergedAggs.merge(agg)) {\n parent.removeChild(agg);\n agg.parent = mergedAggs;\n agg.remove();\n\n this.setMutated();\n }\n }\n }\n }\n\n this.setContinue();\n return this.flags;\n }\n}\n\n/**\n * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node.\n */\nexport class MergeBins extends BottomUpOptimizer {\n constructor(private model: Model) {\n super();\n }\n public run(node: DataFlowNode): OptimizerFlags {\n const parent = node.parent;\n const moveBinsUp = !(\n isDataSourceNode(parent) ||\n parent instanceof FilterNode ||\n parent instanceof ParseNode ||\n parent instanceof IdentifierNode\n );\n\n const promotableBins: BinNode[] = [];\n const remainingBins: BinNode[] = [];\n\n for (const child of parent.children) {\n if (child instanceof BinNode) {\n if (moveBinsUp && !fieldIntersection(parent.producedFields(), child.dependentFields())) {\n promotableBins.push(child);\n } else {\n remainingBins.push(child);\n }\n }\n }\n\n if (promotableBins.length > 0) {\n const promotedBin = promotableBins.pop();\n for (const bin of promotableBins) {\n promotedBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setMutated();\n if (parent instanceof BinNode) {\n parent.merge(promotedBin, this.model.renameSignal.bind(this.model));\n } else {\n promotedBin.swapWithParent();\n }\n }\n if (remainingBins.length > 1) {\n const remainingBin = remainingBins.pop();\n for (const bin of remainingBins) {\n remainingBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setMutated();\n }\n this.setContinue();\n return this.flags;\n }\n}\n\n/**\n * This optimizer takes output nodes that are at a fork and moves them before the fork.\n *\n * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes.\n * It then moves all output nodes before that main output node. All other children (and the children of the output nodes)\n * are inserted after the main output node.\n */\nexport class MergeOutputs extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const parent = node.parent;\n const children = [...parent.children];\n const hasOutputChild = some(children, child => child instanceof OutputNode);\n\n if (!hasOutputChild || parent.numChildren() <= 1) {\n this.setContinue();\n return this.flags;\n }\n\n const otherChildren: DataFlowNode[] = [];\n\n // The output node we will connect all other nodes to.\n // Output nodes will be added before the new node, other nodes after.\n let mainOutput: OutputNode;\n\n for (const child of children) {\n if (child instanceof OutputNode) {\n let lastOutput = child;\n\n while (lastOutput.numChildren() === 1) {\n const [theChild] = lastOutput.children;\n if (theChild instanceof OutputNode) {\n lastOutput = theChild;\n } else {\n break;\n }\n }\n\n otherChildren.push(...lastOutput.children);\n\n if (mainOutput) {\n // Move the output nodes before the mainOutput. We do this by setting\n // the parent of the first not to the parent of the main output and\n // the main output's parent to the last output.\n\n // note: the child is the first output\n parent.removeChild(child);\n child.parent = mainOutput.parent;\n\n mainOutput.parent.removeChild(mainOutput);\n mainOutput.parent = lastOutput;\n\n this.setMutated();\n } else {\n mainOutput = lastOutput;\n }\n } else {\n otherChildren.push(child);\n }\n }\n\n if (otherChildren.length) {\n this.setMutated();\n for (const child of otherChildren) {\n child.parent.removeChild(child);\n child.parent = mainOutput;\n }\n }\n\n this.setContinue();\n return this.flags;\n }\n}\n","import {DataComponent} from '.';\nimport * as log from '../../log';\nimport {Model} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {BottomUpOptimizer, TopDownOptimizer} from './optimizer';\nimport * as optimizers from './optimizers';\n\nexport const FACET_SCALE_PREFIX = 'scale_';\nexport const MAX_OPTIMIZATION_RUNS = 5;\n\n/**\n * Iterates over a dataflow graph and checks whether all links are consistent.\n */\nexport function checkLinks(nodes: readonly DataFlowNode[]): boolean {\n for (const node of nodes) {\n for (const child of node.children) {\n if (child.parent !== node) {\n // log.error('Dataflow graph is inconsistent.', node, child);\n return false;\n }\n }\n\n if (!checkLinks(node.children)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Return all leaf nodes.\n */\nfunction getLeaves(roots: DataFlowNode[]) {\n const leaves: DataFlowNode[] = [];\n function append(node: DataFlowNode) {\n if (node.numChildren() === 0) {\n leaves.push(node);\n } else {\n for (const child of node.children) {\n append(child);\n }\n }\n }\n\n for (const child of roots) {\n append(child);\n }\n return leaves;\n}\n\nexport function isTrue(x: boolean) {\n return x;\n}\n\n/**\n * Run the specified optimizer on the provided nodes.\n *\n * @param optimizer The optimizer instance to run.\n * @param nodes A set of nodes to optimize.\n * @param flag Flag that will be or'ed with return valued from optimization calls to the nodes.\n */\nfunction runOptimizer(optimizer: BottomUpOptimizer | TopDownOptimizer, nodes: DataFlowNode[]): boolean {\n const flags = nodes.map(node => {\n if (optimizer instanceof BottomUpOptimizer) {\n const runFlags = optimizer.optimizeNextFromLeaves(node);\n optimizer.reset();\n return runFlags;\n } else {\n return optimizer.run(node);\n }\n });\n return flags.some(isTrue);\n}\n\nfunction optimizationDataflowHelper(dataComponent: DataComponent, model: Model, firstPass: boolean) {\n let roots = dataComponent.sources;\n const mutatedFlags: Set = new Set();\n\n mutatedFlags.add(runOptimizer(new optimizers.RemoveUnnecessaryOutputNodes(), roots));\n mutatedFlags.add(runOptimizer(new optimizers.RemoveUnnecessaryIdentifierNodes(model), roots));\n\n // remove source nodes that don't have any children because they also don't have output nodes\n roots = roots.filter(r => r.numChildren() > 0);\n\n mutatedFlags.add(runOptimizer(new optimizers.RemoveUnusedSubtrees(), getLeaves(roots)));\n\n roots = roots.filter(r => r.numChildren() > 0);\n\n if (!firstPass) {\n // Only run these optimizations after the optimizer has moved down the facet node.\n // With this change, we can be more aggressive in the optimizations.\n mutatedFlags.add(runOptimizer(new optimizers.MoveParseUp(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeBins(model), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.RemoveDuplicateTimeUnits(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeParse(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeAggregates(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeTimeUnits(), getLeaves(roots)));\n mutatedFlags.add(runOptimizer(new optimizers.MergeIdenticalNodes(), roots));\n mutatedFlags.add(runOptimizer(new optimizers.MergeOutputs(), getLeaves(roots)));\n }\n\n dataComponent.sources = roots;\n\n return mutatedFlags.has(true);\n}\n\n/**\n * Optimizes the dataflow of the passed in data component.\n */\nexport function optimizeDataflow(data: DataComponent, model: Model) {\n // check before optimizations\n checkLinks(data.sources);\n\n let firstPassCounter = 0;\n let secondPassCounter = 0;\n\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, true)) {\n break;\n }\n firstPassCounter++;\n }\n\n // move facets down and make a copy of the subtree so that we can have scales at the top level\n data.sources.map(optimizers.moveFacetDown);\n\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, false)) {\n break;\n }\n secondPassCounter++;\n }\n\n // check after optimizations\n checkLinks(data.sources);\n\n if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) {\n log.warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`);\n }\n}\n","import {SignalRef} from 'vega';\n\nexport type Rename = (oldSignalName: string) => string;\n\n/**\n * A class that behaves like a SignalRef but lazily generates the signal.\n * The provided generator function should use `Model.getSignalName` to use the correct signal name.\n */\nexport class SignalRefWrapper implements SignalRef {\n constructor(exprGenerator: () => string) {\n Object.defineProperty(this, 'signal', {\n enumerable: true,\n get: exprGenerator\n });\n }\n\n public signal: string; // for ts\n\n public static fromName(rename: Rename, signalName: string) {\n return new SignalRefWrapper(() => rename(signalName));\n }\n}\n","import {SignalRef} from 'vega';\nimport {isObject, isString} from 'vega-util';\nimport {\n isAggregateOp,\n isArgmaxDef,\n isArgminDef,\n MULTIDOMAIN_SORT_OP_INDEX as UNIONDOMAIN_SORT_OP_INDEX,\n NonArgAggregateOp,\n SHARED_DOMAIN_OP_INDEX\n} from '../../aggregate';\nimport {isBinning, isBinParams, isSelectionExtent} from '../../bin';\nimport {getSecondaryRangeChannel, isScaleChannel, ScaleChannel} from '../../channel';\nimport {\n binRequiresRange,\n getFieldOrDatumDef,\n hasBand,\n isDatumDef,\n isFieldDef,\n ScaleDatumDef,\n ScaleFieldDef,\n TypedFieldDef,\n valueExpr,\n vgField\n} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {DateTime} from '../../datetime';\nimport * as log from '../../log';\nimport {Domain, hasDiscreteDomain, isDomainUnionWith, isSelectionDomain, ScaleConfig, ScaleType} from '../../scale';\nimport {SelectionExtent} from '../../selection';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortArray, isSortByEncoding, isSortField} from '../../sort';\nimport {normalizeTimeUnit, TimeUnit, TimeUnitParams} from '../../timeunit';\nimport {Type} from '../../type';\nimport * as util from '../../util';\nimport {\n isDataRefDomain,\n isDataRefUnionedDomain,\n isFieldRefUnionDomain,\n isSignalRef,\n VgDomain,\n VgMultiFieldsRefWithSort,\n VgNonUnionDomain,\n VgScaleDataRefWithSort,\n VgSortField,\n VgUnionSortField\n} from '../../vega.schema';\nimport {getBinSignalName} from '../data/bin';\nimport {sortArrayIndexField} from '../data/calculate';\nimport {FACET_SCALE_PREFIX} from '../data/optimize';\nimport {isFacetModel, isUnitModel, Model} from '../model';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, makeExplicit, makeImplicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponent, ScaleComponentIndex} from './component';\n\nexport function parseScaleDomain(model: Model) {\n if (isUnitModel(model)) {\n parseUnitScaleDomain(model);\n } else {\n parseNonUnitScaleDomain(model);\n }\n}\n\nfunction parseUnitScaleDomain(model: UnitModel) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const channel of util.keys(localScaleComponents)) {\n const domains = parseDomainForChannel(model, channel);\n const localScaleCmpt = localScaleComponents[channel];\n localScaleCmpt.setWithExplicit('domains', domains);\n parseSelectionDomain(model, channel);\n\n if (model.component.data.isFaceted) {\n // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not\n let facetParent: Model = model;\n while (!isFacetModel(facetParent) && facetParent.parent) {\n facetParent = facetParent.parent;\n }\n\n const resolve = facetParent.component.resolve.scale[channel];\n\n if (resolve === 'shared') {\n for (const domain of domains.value) {\n // Replace the scale domain with data output from a cloned subtree after the facet.\n if (isDataRefDomain(domain)) {\n // use data from cloned subtree (which is the same as data but with a prefix added once)\n domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, '');\n }\n }\n }\n }\n }\n}\n\nfunction parseNonUnitScaleDomain(model: Model) {\n for (const child of model.children) {\n parseScaleDomain(child);\n }\n\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const channel of util.keys(localScaleComponents)) {\n let domains: Explicit;\n let selectionExtent: SelectionExtent = null;\n\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n if (domains === undefined) {\n domains = childComponent.getWithExplicit('domains');\n } else {\n domains = mergeValuesWithExplicit(\n domains,\n childComponent.getWithExplicit('domains'),\n 'domains',\n 'scale',\n domainsTieBreaker\n );\n }\n\n const se = childComponent.get('selectionExtent');\n if (selectionExtent && se && selectionExtent.selection !== se.selection) {\n log.warn(log.message.NEEDS_SAME_SELECTION);\n }\n selectionExtent = se;\n }\n }\n\n localScaleComponents[channel].setWithExplicit('domains', domains);\n\n if (selectionExtent) {\n localScaleComponents[channel].set('selectionExtent', selectionExtent, true);\n }\n }\n}\n\n/**\n * Remove unaggregated domain if it is not applicable\n * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true.\n */\nfunction normalizeUnaggregatedDomain(\n domain: Domain,\n fieldDef: TypedFieldDef,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig\n) {\n if (domain === 'unaggregated') {\n const {valid, reason} = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (!valid) {\n log.warn(reason);\n return undefined;\n }\n } else if (domain === undefined && scaleConfig.useUnaggregatedDomain) {\n // Apply config if domain is not specified.\n const {valid} = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (valid) {\n return 'unaggregated';\n }\n }\n\n return domain;\n}\n\nexport function parseDomainForChannel(model: UnitModel, channel: ScaleChannel): Explicit {\n const scaleType = model.getScaleComponent(channel).get('type');\n const {encoding} = model;\n\n const domain = normalizeUnaggregatedDomain(\n model.scaleDomain(channel),\n model.typedFieldDef(channel),\n scaleType,\n model.config.scale\n );\n if (domain !== model.scaleDomain(channel)) {\n model.specifiedScales[channel] = {\n ...model.specifiedScales[channel],\n domain\n };\n }\n\n // If channel is either X or Y then union them with X2 & Y2 if they exist\n if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) {\n if (getFieldOrDatumDef(encoding.x)) {\n return mergeValuesWithExplicit(\n parseSingleChannelDomain(scaleType, domain, model, 'x'),\n parseSingleChannelDomain(scaleType, domain, model, 'x2'),\n 'domain',\n 'scale',\n domainsTieBreaker\n );\n } else {\n return parseSingleChannelDomain(scaleType, domain, model, 'x2');\n }\n } else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) {\n if (getFieldOrDatumDef(encoding.y)) {\n return mergeValuesWithExplicit(\n parseSingleChannelDomain(scaleType, domain, model, 'y'),\n parseSingleChannelDomain(scaleType, domain, model, 'y2'),\n 'domain',\n 'scale',\n domainsTieBreaker\n );\n } else {\n return parseSingleChannelDomain(scaleType, domain, model, 'y2');\n }\n }\n return parseSingleChannelDomain(scaleType, domain, model, channel);\n}\n\nfunction mapDomainToDataSignal(\n domain: (number | string | boolean | DateTime | SignalRef | number[])[],\n type: Type,\n timeUnit: TimeUnit\n) {\n return domain.map(v => {\n const data = valueExpr(v, {timeUnit, type});\n return {signal: `{data: ${data}}`};\n });\n}\n\nfunction convertDomainIfItIsDateTime(\n domain: (number | string | boolean | DateTime | SignalRef | number[])[],\n type: Type,\n timeUnit: TimeUnit | TimeUnitParams\n): [number[]] | [string[]] | [boolean[]] | SignalRef[] {\n // explicit value\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit)?.unit;\n if (type === 'temporal' || normalizedTimeUnit) {\n return mapDomainToDataSignal(domain, type, normalizedTimeUnit);\n }\n\n return [domain] as [number[]] | [string[]] | [boolean[]]; // Date time won't make sense\n}\n\nfunction parseSingleChannelDomain(\n scaleType: ScaleType,\n domain: Domain,\n model: UnitModel,\n channel: ScaleChannel | 'x2' | 'y2'\n): Explicit {\n const {encoding} = model;\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleDatumDef | ScaleFieldDef;\n\n const {type} = fieldOrDatumDef;\n const timeUnit = fieldOrDatumDef['timeUnit'];\n\n if (isDomainUnionWith(domain)) {\n const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel);\n\n const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit);\n\n return makeExplicit([...defaultDomain.value, ...unionWith]);\n } else if (isSignalRef(domain)) {\n return makeExplicit([domain]);\n } else if (domain && domain !== 'unaggregated' && !isSelectionDomain(domain)) {\n return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit));\n }\n\n const stack = model.stack;\n if (stack && channel === stack.fieldChannel) {\n if (stack.offset === 'normalize') {\n return makeImplicit([[0, 1]]);\n }\n\n const data = model.requestDataName(DataSourceType.Main);\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, {suffix: 'start'})\n },\n {\n data,\n field: model.vgField(channel, {suffix: 'end'})\n }\n ]);\n }\n\n const sort: undefined | true | VgSortField =\n isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined;\n\n if (isDatumDef(fieldOrDatumDef)) {\n const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit);\n return makeImplicit(d);\n }\n\n const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef\n if (domain === 'unaggregated') {\n const data = model.requestDataName(DataSourceType.Main);\n const {field} = fieldOrDatumDef;\n return makeImplicit([\n {\n data,\n field: vgField({field, aggregate: 'min'})\n },\n {\n data,\n field: vgField({field, aggregate: 'max'})\n }\n ]);\n } else if (isBinning(fieldDef.bin)) {\n if (hasDiscreteDomain(scaleType)) {\n if (scaleType === 'bin-ordinal') {\n // we can omit the domain as it is inferred from the `bins` property\n return makeImplicit([]);\n }\n\n // ordinal bin scale takes domain from bin_range, ordered by bin start\n // This is useful for both axis-based scale (x/y) and legend-based scale (other channels).\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n // Use range if we added it and the scale does not support computing a range as a signal.\n field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? {binSuffix: 'range'} : {}),\n // we have to use a sort object if sort = true to make the sort correct by bin start\n sort:\n sort === true || !isObject(sort)\n ? {\n field: model.vgField(channel, {}),\n op: 'min' // min or max doesn't matter since we sort by the start of the bin range\n }\n : sort\n }\n ]);\n } else {\n // continuous scales\n const {bin} = fieldDef;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return makeImplicit([\n new SignalRefWrapper(() => {\n const signal = model.getSignalName(binSignal);\n return `[${signal}.start, ${signal}.stop]`;\n })\n ]);\n } else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel, {})\n }\n ]);\n }\n }\n } else if (\n fieldDef.timeUnit &&\n util.contains(['time', 'utc'], scaleType) &&\n hasBand(\n channel,\n fieldDef,\n isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined,\n model.stack,\n model.markDef,\n model.config\n )\n ) {\n const data = model.requestDataName(DataSourceType.Main);\n return makeImplicit([\n {\n data,\n field: model.vgField(channel)\n },\n {\n data,\n field: model.vgField(channel, {suffix: 'end'})\n }\n ]);\n } else if (sort) {\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n field: model.vgField(channel),\n sort: sort\n }\n ]);\n } else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel)\n }\n ]);\n }\n}\n\nfunction normalizeSortField(sort: EncodingSortField, isStackedMeasure: boolean): VgSortField {\n const {op, field, order} = sort;\n return {\n // Apply default op\n op: op ?? (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP),\n // flatten nested fields\n ...(field ? {field: util.replacePathInField(field)} : {}),\n\n ...(order ? {order} : {})\n };\n}\n\nfunction parseSelectionDomain(model: UnitModel, channel: ScaleChannel) {\n const scale = model.component.scales[channel];\n const spec = model.specifiedScales[channel].domain;\n const bin = model.fieldDef(channel)?.bin;\n const domain = isSelectionDomain(spec) && spec;\n const extent = isBinParams(bin) && isSelectionExtent(bin.extent) && bin.extent;\n\n if (domain || extent) {\n // As scale parsing occurs before selection parsing, we cannot set\n // domainRaw directly. So instead, we store the selectionExtent on\n // the scale component, and then add domainRaw during scale assembly.\n scale.set('selectionExtent', domain ?? extent, true);\n }\n}\n\nexport function domainSort(\n model: UnitModel,\n channel: ScaleChannel,\n scaleType: ScaleType\n): undefined | true | VgSortField {\n if (!hasDiscreteDomain(scaleType)) {\n return undefined;\n }\n\n // save to cast as the only exception is the geojson type for shape, which would not generate a scale\n const fieldDef = model.fieldDef(channel) as ScaleFieldDef;\n const sort = fieldDef.sort;\n\n // if the sort is specified with array, use the derived sort index field\n if (isSortArray(sort)) {\n return {\n op: 'min',\n field: sortArrayIndexField(fieldDef, channel),\n order: 'ascending'\n };\n }\n\n const {stack} = model;\n const stackDimensions = stack\n ? [...(stack.groupbyField ? [stack.groupbyField] : []), ...stack.stackBy.map(s => s.fieldDef.field)]\n : undefined;\n\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (isSortField(sort)) {\n const isStackedMeasure = stack && !util.contains(stackDimensions, sort.field);\n return normalizeSortField(sort, isStackedMeasure);\n } else if (isSortByEncoding(sort)) {\n const {encoding, order} = sort;\n const fieldDefToSortBy = model.fieldDef(encoding);\n const {aggregate, field} = fieldDefToSortBy;\n\n const isStackedMeasure = stack && !util.contains(stackDimensions, field);\n\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n return normalizeSortField(\n {\n field: vgField(fieldDefToSortBy),\n order\n },\n isStackedMeasure\n );\n } else if (isAggregateOp(aggregate) || !aggregate) {\n return normalizeSortField(\n {\n op: aggregate as NonArgAggregateOp, // can't be argmin/argmax since we don't support them in encoding field def\n field,\n order\n },\n isStackedMeasure\n );\n }\n } else if (sort === 'descending') {\n return {\n op: 'min',\n field: model.vgField(channel),\n order: 'descending'\n };\n } else if (util.contains(['ascending', undefined /* default =ascending*/], sort)) {\n return true;\n }\n\n // sort == null\n return undefined;\n}\n\n/**\n * Determine if a scale can use unaggregated domain.\n * @return {Boolean} Returns true if all of the following conditions apply:\n * 1. `scale.domain` is `unaggregated`\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nexport function canUseUnaggregatedDomain(\n fieldDef: TypedFieldDef,\n scaleType: ScaleType\n): {valid: boolean; reason?: string} {\n const {aggregate, type} = fieldDef;\n\n if (!aggregate) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainHasNoEffectForRawField(fieldDef)\n };\n }\n\n if (isString(aggregate) && !SHARED_DOMAIN_OP_INDEX[aggregate]) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainWithNonSharedDomainOp(aggregate)\n };\n }\n\n if (type === 'quantitative') {\n if (scaleType === 'log') {\n return {\n valid: false,\n reason: log.message.unaggregatedDomainWithLogScale(fieldDef)\n };\n }\n }\n\n return {valid: true};\n}\n\n/**\n * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values.\n */\nfunction domainsTieBreaker(\n v1: Explicit,\n v2: Explicit,\n property: 'domains',\n propertyOf: 'scale'\n) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, concat the domains so that we union them later.\n return {explicit: v1.explicit, value: [...v1.value, ...v2.value]};\n}\n\n/**\n * Converts an array of domains to a single Vega scale domain.\n */\nexport function mergeDomains(domains: VgNonUnionDomain[]): VgDomain {\n const uniqueDomains = util.unique(\n domains.map(domain => {\n // ignore sort property when computing the unique domains\n if (isDataRefDomain(domain)) {\n const {sort: _s, ...domainWithoutSort} = domain;\n return domainWithoutSort;\n }\n return domain;\n }),\n util.hash\n );\n\n const sorts: VgSortField[] = util.unique(\n domains\n .map(d => {\n if (isDataRefDomain(d)) {\n const s = d.sort;\n if (s !== undefined && !util.isBoolean(s)) {\n if ('op' in s && s.op === 'count') {\n // let's make sure that if op is count, we don't use a field\n delete s.field;\n }\n if (s.order === 'ascending') {\n // drop order: ascending as it is the default\n delete s.order;\n }\n }\n return s;\n }\n return undefined;\n })\n .filter(s => s !== undefined),\n util.hash\n );\n\n if (uniqueDomains.length === 0) {\n return undefined;\n } else if (uniqueDomains.length === 1) {\n const domain = domains[0];\n if (isDataRefDomain(domain) && sorts.length > 0) {\n let sort = sorts[0];\n if (sorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n sort = true;\n } else {\n // Simplify domain sort by removing field and op when the field is the same as the domain field.\n if (isObject(sort) && 'field' in sort) {\n const sortField = sort.field;\n if (domain.field === sortField) {\n sort = sort.order ? {order: sort.order} : true;\n }\n }\n }\n return {\n ...domain,\n sort\n };\n }\n return domain;\n }\n\n // only keep sort properties that work with unioned domains\n const unionDomainSorts = util.unique(\n sorts.map(s => {\n if (util.isBoolean(s) || !('op' in s) || s.op in UNIONDOMAIN_SORT_OP_INDEX) {\n return s as VgUnionSortField;\n }\n log.warn(log.message.domainSortDropped(s));\n return true;\n }),\n util.hash\n ) as VgUnionSortField[];\n\n let sort: VgUnionSortField;\n\n if (unionDomainSorts.length === 1) {\n sort = unionDomainSorts[0];\n } else if (unionDomainSorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n sort = true;\n }\n\n const allData = util.unique(\n domains.map(d => {\n if (isDataRefDomain(d)) {\n return d.data;\n }\n return null;\n }),\n x => x\n );\n\n if (allData.length === 1 && allData[0] !== null) {\n // create a union domain of different fields with a single data source\n const domain: VgMultiFieldsRefWithSort = {\n data: allData[0],\n fields: uniqueDomains.map(d => (d as VgScaleDataRefWithSort).field),\n ...(sort ? {sort} : {})\n };\n\n return domain;\n }\n\n return {fields: uniqueDomains, ...(sort ? {sort} : {})};\n}\n\n/**\n * Return a field if a scale uses a single field.\n * Return `undefined` otherwise.\n */\nexport function getFieldFromDomain(domain: VgDomain): string {\n if (isDataRefDomain(domain) && isString(domain.field)) {\n return domain.field;\n } else if (isDataRefUnionedDomain(domain)) {\n let field;\n for (const nonUnionDomain of domain.fields) {\n if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) {\n if (!field) {\n field = nonUnionDomain.field;\n } else if (field !== nonUnionDomain.field) {\n log.warn(log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES);\n return field;\n }\n }\n }\n log.warn(log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES);\n return field;\n } else if (isFieldRefUnionDomain(domain)) {\n log.warn(log.message.FACETED_INDEPENDENT_SAME_SOURCE);\n const field = domain.fields[0];\n return isString(field) ? field : undefined;\n }\n\n return undefined;\n}\n\nexport function assembleDomain(model: Model, channel: ScaleChannel) {\n const scaleComponent: ScaleComponent = model.component.scales[channel];\n\n const domains = scaleComponent.get('domains').map((domain: VgNonUnionDomain) => {\n // Correct references to data as the original domain's data was determined\n // in parseScale, which happens before parseData. Thus the original data\n // reference can be incorrect.\n if (isDataRefDomain(domain)) {\n domain.data = model.lookupDataSource(domain.data);\n }\n\n return domain;\n });\n\n // domains is an array that has to be merged into a single vega domain\n return mergeDomains(domains);\n}\n","import {isObject} from 'vega-util';\nimport {isXorY, ScaleChannel} from '../../channel';\nimport {keys} from '../../util';\nimport {isDataRefDomain, isVgRangeStep, VgRange, VgScale} from '../../vega.schema';\nimport {isConcatModel, isLayerModel, Model} from '../model';\nimport {assembleSelectionScaleDomain} from '../selection/assemble';\nimport {assembleDomain} from './domain';\n\nexport function assembleScales(model: Model): VgScale[] {\n if (isLayerModel(model) || isConcatModel(model)) {\n // For concat and layer, include scales of children too\n return model.children.reduce((scales, child) => {\n return scales.concat(assembleScales(child));\n }, assembleScalesForModel(model));\n } else {\n // For facet, child scales would not be included in the parent's scope.\n // For unit, there is no child.\n return assembleScalesForModel(model);\n }\n}\n\nexport function assembleScalesForModel(model: Model): VgScale[] {\n return keys(model.component.scales).reduce((scales: VgScale[], channel: ScaleChannel) => {\n const scaleComponent = model.component.scales[channel];\n if (scaleComponent.merged) {\n // Skipped merged scales\n return scales;\n }\n\n const scale = scaleComponent.combine();\n const {name, type, selectionExtent, domains: _d, range: _r, reverse, ...otherScaleProps} = scale;\n const range = assembleScaleRange(scale.range, name, channel, model);\n\n let domainRaw;\n if (selectionExtent) {\n domainRaw = assembleSelectionScaleDomain(model, selectionExtent);\n }\n\n const domain = assembleDomain(model, channel);\n\n scales.push({\n name,\n type,\n ...(domain ? {domain} : {}),\n ...(domainRaw ? {domainRaw} : {}),\n range,\n ...(reverse !== undefined ? {reverse: reverse as any} : {}),\n ...otherScaleProps\n });\n\n return scales;\n }, [] as VgScale[]);\n}\n\nexport function assembleScaleRange(\n scaleRange: VgRange,\n scaleName: string,\n channel: ScaleChannel,\n model?: Model\n): VgRange {\n // add signals to x/y range\n if (isXorY(channel)) {\n if (isVgRangeStep(scaleRange)) {\n // For width/height step, use a signal created in layout assemble instead of a constant step.\n return {\n step: {signal: scaleName + '_step'}\n };\n }\n } else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) {\n return {\n ...scaleRange,\n data: model.lookupDataSource(scaleRange.data)\n };\n }\n return scaleRange;\n}\n","import {SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {ScaleChannel} from '../../channel';\nimport {Scale, ScaleType} from '../../scale';\nimport {SelectionExtent} from '../../selection';\nimport {some} from '../../util';\nimport {VgNonUnionDomain, VgScale} from '../../vega.schema';\nimport {Explicit, Split} from '../split';\n\n/**\n * All VgDomain property except domain.\n * (We exclude domain as we have a special \"domains\" array that allow us merge them all at once in assemble.)\n */\nexport type ScaleComponentProps = Omit & {\n domains: VgNonUnionDomain[];\n selectionExtent?: SelectionExtent;\n reverse?: boolean | SignalRef; // Need override since Vega doesn't official support scale reverse yet (though it does in practice)\n};\n\nexport type Range = ScaleComponentProps['range'];\n\nexport class ScaleComponent extends Split {\n public merged = false;\n\n constructor(name: string, typeWithExplicit: Explicit) {\n super(\n {}, // no initial explicit property\n {name} // name as initial implicit property\n );\n this.setWithExplicit('type', typeWithExplicit);\n }\n\n /**\n * Whether the scale definitely includes zero in the domain\n */\n public domainDefinitelyIncludesZero() {\n if (this.get('zero') !== false) {\n return true;\n }\n return some(this.get('domains'), d => isArray(d) && d.length === 2 && d[0] <= 0 && d[1] >= 0);\n }\n}\n\nexport type ScaleComponentIndex = Partial>;\n\nexport type ScaleIndex = Partial>;\n","import {RangeScheme, SignalRef} from 'vega';\nimport {isArray, isNumber, isObject} from 'vega-util';\nimport {isBinning} from '../../bin';\nimport {\n ANGLE,\n COLOR,\n FILL,\n FILLOPACITY,\n isXorY,\n OPACITY,\n RADIUS,\n ScaleChannel,\n SCALE_CHANNELS,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n THETA,\n X,\n Y\n} from '../../channel';\nimport {getFieldOrDatumDef, ScaleDatumDef, ScaleFieldDef} from '../../channeldef';\nimport {Config, getViewConfigDiscreteSize, getViewConfigDiscreteStep, ViewConfig} from '../../config';\nimport {DataSourceType} from '../../data';\nimport * as log from '../../log';\nimport {Mark} from '../../mark';\nimport {\n channelScalePropertyIncompatability,\n Domain,\n hasContinuousDomain,\n hasDiscreteDomain,\n isContinuousToDiscrete,\n isExtendedScheme,\n Scale,\n scaleTypeSupportProperty,\n Scheme\n} from '../../scale';\nimport {isStep, LayoutSizeMixins} from '../../spec/base';\nimport * as util from '../../util';\nimport {isSignalRef, VgRange} from '../../vega.schema';\nimport {signalOrStringValue} from '../common';\nimport {getBinSignalName} from '../data/bin';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, makeExplicit, makeImplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponentIndex} from './component';\n\nexport const RANGE_PROPERTIES: (keyof Scale)[] = ['range', 'scheme'];\n\nfunction getSizeChannel(channel: ScaleChannel) {\n return channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;\n}\n\nexport function parseUnitScaleRange(model: UnitModel) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first!\n for (const channel of SCALE_CHANNELS) {\n const localScaleCmpt = localScaleComponents[channel];\n if (!localScaleCmpt) {\n continue;\n }\n\n const rangeWithExplicit = parseRangeForChannel(channel, model);\n\n localScaleCmpt.setWithExplicit('range', rangeWithExplicit);\n }\n}\n\nfunction getBinStepSignal(model: UnitModel, channel: 'x' | 'y'): SignalRefWrapper {\n const fieldDef = model.fieldDef(channel);\n\n if (fieldDef && fieldDef.bin && isBinning(fieldDef.bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, fieldDef.bin);\n\n // TODO: extract this to be range step signal\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n return new SignalRefWrapper(() => {\n const updatedName = model.getSignalName(binSignal);\n const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n }\n return undefined;\n}\n\n/**\n * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme).\n */\nexport function parseRangeForChannel(channel: ScaleChannel, model: UnitModel): Explicit {\n const specifiedScale = model.specifiedScales[channel];\n const {size} = model;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n\n // Check if any of the range properties is specified.\n // If so, check if it is compatible and make sure that we only output one of the properties\n for (const property of RANGE_PROPERTIES) {\n if (specifiedScale[property] !== undefined) {\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n } else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n } else {\n switch (property) {\n case 'range': {\n const range = specifiedScale.range;\n if (isArray(range)) {\n if (isXorY(channel)) {\n return makeExplicit(\n range.map(v => {\n if (v === 'width' || v === 'height') {\n // get signal for width/height\n\n // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames.\n\n const sizeSignal = model.getName(v);\n const getSignalName = model.getSignalName.bind(model);\n return SignalRefWrapper.fromName(getSignalName, sizeSignal);\n }\n return v;\n })\n );\n }\n } else if (isObject(range)) {\n return makeExplicit({\n data: model.requestDataName(DataSourceType.Main),\n field: range.field,\n sort: {op: 'min', field: model.vgField(channel)}\n });\n }\n\n return makeExplicit(range);\n }\n case 'scheme':\n return makeExplicit(parseScheme(specifiedScale[property]));\n }\n }\n }\n }\n\n if (channel === X || channel === Y) {\n const sizeChannel = channel === X ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (isStep(sizeValue)) {\n if (hasDiscreteDomain(scaleType)) {\n return makeExplicit({step: sizeValue.step});\n } else {\n log.warn(log.message.stepDropped(sizeChannel));\n }\n }\n }\n\n const {rangeMin, rangeMax} = specifiedScale;\n const d = defaultRange(channel, model);\n\n if (\n (rangeMin !== undefined || rangeMax !== undefined) &&\n // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same\n scaleTypeSupportProperty(scaleType, 'rangeMin') &&\n isArray(d) &&\n d.length === 2\n ) {\n return makeExplicit([rangeMin ?? d[0], rangeMax ?? d[1]]);\n }\n\n return makeImplicit(d);\n}\n\nfunction parseScheme(scheme: Scheme | SignalRef): RangeScheme {\n if (isExtendedScheme(scheme)) {\n return {\n scheme: scheme.name,\n ...util.omit(scheme, ['name'])\n };\n }\n return {scheme: scheme};\n}\n\nfunction defaultRange(channel: ScaleChannel, model: UnitModel): VgRange {\n const {size, config, mark, encoding} = model;\n\n const getSignalName = model.getSignalName.bind(model);\n\n const {type} = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n\n const {domain, domainMid} = model.specifiedScales[channel];\n\n switch (channel) {\n case X:\n case Y: {\n // If there is no explicit width/height for discrete x/y scales\n if (util.contains(['point', 'band'], scaleType)) {\n if (channel === X && !size.width) {\n const w = getViewConfigDiscreteSize(config.view, 'width');\n if (isStep(w)) {\n return w;\n }\n } else if (channel === Y && !size.height) {\n const h = getViewConfigDiscreteSize(config.view, 'height');\n if (isStep(h)) {\n return h;\n }\n }\n }\n\n // If step is null, use zero to width or height.\n // Note that we use SignalRefWrapper to account for potential merges and renames.\n\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n\n if (channel === Y && hasContinuousDomain(scaleType)) {\n // For y continuous scale, we have to start from the height as the bottom part has the max value.\n return [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0];\n } else {\n return [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)];\n }\n }\n\n case SIZE: {\n // TODO: support custom rangeMin, rangeMax\n const zero = model.component.scales[channel].get('zero');\n const rangeMin = sizeRangeMin(mark, zero, config);\n const rangeMax = sizeRangeMax(mark, size, model, config);\n if (isContinuousToDiscrete(scaleType)) {\n return interpolateRange(\n rangeMin,\n rangeMax,\n defaultContinuousToDiscreteCount(scaleType, config, domain, channel)\n );\n } else {\n return [rangeMin, rangeMax];\n }\n }\n\n case THETA:\n return [0, Math.PI * 2];\n\n case ANGLE:\n // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks.\n // (It's weird to add just config.scale.min/maxAngleDegree for now)\n return [0, 360];\n\n case RADIUS: {\n // max radius = half od min(width,height)\n return [\n 0,\n new SignalRefWrapper(() => {\n const w = model.getSignalName('width');\n const h = model.getSignalName('height');\n return `min(${w},${h})/2`;\n })\n ];\n }\n\n case STROKEWIDTH:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth];\n case STROKEDASH:\n return [\n // TODO: add this to Vega's config.range?\n [1, 0],\n [4, 2],\n [2, 1],\n [1, 1],\n [1, 2, 4, 2]\n ];\n case SHAPE:\n return 'symbol';\n case COLOR:\n case FILL:\n case STROKE:\n if (scaleType === 'ordinal') {\n // Only nominal data uses ordinal scale by default\n return type === 'nominal' ? 'category' : 'ordinal';\n } else {\n if (domainMid !== undefined) {\n return 'diverging';\n } else {\n return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp';\n }\n }\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minOpacity, config.scale.maxOpacity];\n }\n /* istanbul ignore next: should never reach here */\n throw new Error(`Scale range undefined for channel ${channel}`);\n}\n\nexport function defaultContinuousToDiscreteCount(\n scaleType: 'quantile' | 'quantize' | 'threshold',\n config: Config,\n domain: Domain,\n channel: ScaleChannel\n) {\n switch (scaleType) {\n case 'quantile':\n return config.scale.quantileCount;\n case 'quantize':\n return config.scale.quantizeCount;\n case 'threshold':\n if (domain !== undefined && isArray(domain)) {\n return domain.length + 1;\n } else {\n log.warn(log.message.domainRequiredForThresholdScale(channel));\n // default threshold boundaries for threshold scale since domain has cardinality of 2\n return 3;\n }\n }\n}\n\n/**\n * Returns the linear interpolation of the range according to the cardinality\n *\n * @param rangeMin start of the range\n * @param rangeMax end of the range\n * @param cardinality number of values in the output range\n */\nexport function interpolateRange(\n rangeMin: number | SignalRef,\n rangeMax: number | SignalRef,\n cardinality: number\n): SignalRef {\n // always return a signal since it's better to compute the sequence in Vega later\n const f = () => {\n const rMax = signalOrStringValue(rangeMax);\n const rMin = signalOrStringValue(rangeMin);\n const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`;\n return `sequence(${rMin}, ${rMax} + ${step}, ${step})`;\n };\n if (isSignalRef(rangeMax)) {\n return new SignalRefWrapper(f);\n } else {\n return {signal: f()};\n }\n}\n\nfunction sizeRangeMin(mark: Mark, zero: boolean | SignalRef, config: Config): number | SignalRef {\n if (zero) {\n if (isSignalRef(zero)) {\n return {signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}`};\n } else {\n return 0;\n }\n }\n switch (mark) {\n case 'bar':\n case 'tick':\n return config.scale.minBandSize;\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.minStrokeWidth;\n case 'text':\n return config.scale.minFontSize;\n case 'point':\n case 'square':\n case 'circle':\n return config.scale.minSize;\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMin not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n\nexport const MAX_SIZE_RANGE_STEP_RATIO = 0.95;\n\nfunction sizeRangeMax(mark: Mark, size: LayoutSizeMixins, model: UnitModel, config: Config): number | SignalRef {\n const xyStepSignals = {\n x: getBinStepSignal(model, 'x'),\n y: getBinStepSignal(model, 'y')\n };\n\n switch (mark) {\n case 'bar':\n case 'tick': {\n if (config.scale.maxBandSize !== undefined) {\n return config.scale.maxBandSize;\n }\n const min = minXYStep(size, xyStepSignals, config.view);\n\n if (isNumber(min)) {\n return min - 1;\n } else {\n return new SignalRefWrapper(() => `${min.signal} - 1`);\n }\n }\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.maxStrokeWidth;\n case 'text':\n return config.scale.maxFontSize;\n case 'point':\n case 'square':\n case 'circle': {\n if (config.scale.maxSize) {\n return config.scale.maxSize;\n }\n\n const pointStep = minXYStep(size, xyStepSignals, config.view);\n if (isNumber(pointStep)) {\n return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2);\n } else {\n return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`);\n }\n }\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMax not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n\n/**\n * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale.\n */\nfunction minXYStep(\n size: LayoutSizeMixins,\n xyStepSignals: {x?: SignalRefWrapper; y?: SignalRefWrapper},\n viewConfig: ViewConfig\n): number | SignalRef {\n const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width');\n const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height');\n\n if (xyStepSignals.x || xyStepSignals.y) {\n return new SignalRefWrapper(() => {\n const exprs = [\n xyStepSignals.x ? xyStepSignals.x.signal : widthStep,\n xyStepSignals.y ? xyStepSignals.y.signal : heightStep\n ];\n return `min(${exprs.join(', ')})`;\n });\n }\n\n return Math.min(widthStep, heightStep);\n}\n","import {SignalRef, TimeInterval} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinned, isBinning, isBinParams} from '../../bin';\nimport {\n COLOR,\n FILL,\n POLAR_POSITION_SCALE_CHANNELS,\n POSITION_SCALE_CHANNELS,\n POSITION_SCALE_CHANNEL_INDEX,\n ScaleChannel,\n STROKE\n} from '../../channel';\nimport {\n getFieldDef,\n getFieldOrDatumDef,\n isFieldDef,\n ScaleDatumDef,\n ScaleFieldDef,\n TypedFieldDef,\n valueExpr\n} from '../../channeldef';\nimport {Config} from '../../config';\nimport {isDateTime} from '../../datetime';\nimport * as log from '../../log';\nimport {Mark, MarkDef, RectConfig} from '../../mark';\nimport {\n channelScalePropertyIncompatability,\n Domain,\n hasContinuousDomain,\n isContinuousToContinuous,\n isContinuousToDiscrete,\n Scale,\n ScaleConfig,\n ScaleType,\n scaleTypeSupportProperty\n} from '../../scale';\nimport {Sort} from '../../sort';\nimport {Type} from '../../type';\nimport * as util from '../../util';\nimport {contains, getFirstDefined, keys} from '../../util';\nimport {isSignalRef, VgScale} from '../../vega.schema';\nimport {getBinSignalName} from '../data/bin';\nimport {isUnitModel, Model} from '../model';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponentIndex, ScaleComponentProps} from './component';\nimport {parseUnitScaleRange} from './range';\n\nexport function parseScaleProperty(model: Model, property: Exclude) {\n if (isUnitModel(model)) {\n parseUnitScaleProperty(model, property);\n } else {\n parseNonUnitScaleProperty(model, property);\n }\n}\n\nfunction parseUnitScaleProperty(model: UnitModel, property: Exclude) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n const {config, encoding, markDef, specifiedScales} = model;\n\n for (const channel of keys(localScaleComponents)) {\n const specifiedScale = specifiedScales[channel];\n const localScaleCmpt = localScaleComponents[channel];\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef;\n\n const specifiedValue = specifiedScale[property];\n const scaleType = mergedScaleCmpt.get('type');\n const scalePadding = mergedScaleCmpt.get('padding');\n const scalePaddingInner = mergedScaleCmpt.get('paddingInner');\n\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n\n if (specifiedValue !== undefined) {\n // If there is a specified value, check if it is compatible with scale type and channel\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n } else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n }\n }\n if (supportedByScaleType && channelIncompatability === undefined) {\n if (specifiedValue !== undefined) {\n const timeUnit = fieldOrDatumDef['timeUnit'];\n const type = fieldOrDatumDef.type;\n\n switch (property) {\n // domainMax/Min to signal if the value is a datetime object\n case 'domainMax':\n case 'domainMin':\n if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) {\n localScaleCmpt.set(property, {signal: valueExpr(specifiedScale[property], {type, timeUnit})}, true);\n } else {\n localScaleCmpt.set(property, specifiedScale[property] as any, true);\n }\n break;\n default:\n localScaleCmpt.copyKeyFromObject>(\n property,\n specifiedScale\n );\n }\n } else {\n const value =\n property in scaleRules\n ? scaleRules[property]({\n model,\n channel,\n fieldOrDatumDef,\n scaleType,\n scalePadding,\n scalePaddingInner,\n domain: specifiedScale.domain,\n markDef,\n config\n })\n : config.scale[property];\n if (value !== undefined) {\n localScaleCmpt.set(property, value, false);\n }\n }\n }\n }\n}\n\nexport interface ScaleRuleParams {\n model: Model;\n channel: ScaleChannel;\n fieldOrDatumDef: ScaleFieldDef | ScaleDatumDef;\n scaleType: ScaleType;\n scalePadding: number | SignalRef;\n scalePaddingInner: number | SignalRef;\n domain: Scale['domain'];\n markDef: MarkDef;\n config: Config;\n}\n\nexport const scaleRules: {\n [k in keyof Scale]?: (params: ScaleRuleParams) => Scale[k];\n} = {\n bins: ({model, fieldOrDatumDef}) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined),\n\n interpolate: ({channel, fieldOrDatumDef}) => interpolate(channel, fieldOrDatumDef.type),\n\n nice: ({scaleType, channel, fieldOrDatumDef}) => nice(scaleType, channel, fieldOrDatumDef),\n\n padding: ({channel, scaleType, fieldOrDatumDef, markDef, config}) =>\n padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar),\n\n paddingInner: ({scalePadding, channel, markDef, config}) =>\n paddingInner(scalePadding, channel, markDef.type, config.scale),\n\n paddingOuter: ({scalePadding, channel, scaleType, markDef, scalePaddingInner, config}) =>\n paddingOuter(scalePadding, channel, scaleType, markDef.type, scalePaddingInner, config.scale),\n\n reverse: ({fieldOrDatumDef, scaleType, channel, config}) => {\n const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined;\n return reverse(scaleType, sort, channel, config.scale);\n },\n zero: ({channel, fieldOrDatumDef, domain, markDef, scaleType}) =>\n zero(channel, fieldOrDatumDef, domain, markDef, scaleType)\n};\n\n// This method is here rather than in range.ts to avoid circular dependency.\nexport function parseScaleRange(model: Model) {\n if (isUnitModel(model)) {\n parseUnitScaleRange(model);\n } else {\n parseNonUnitScaleProperty(model, 'range');\n }\n}\n\nexport function parseNonUnitScaleProperty(model: Model, property: keyof (Scale | ScaleComponentProps)) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const child of model.children) {\n if (property === 'range') {\n parseScaleRange(child);\n } else {\n parseScaleProperty(child, property);\n }\n }\n\n for (const channel of keys(localScaleComponents)) {\n let valueWithExplicit: Explicit;\n\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n const childValueWithExplicit = childComponent.getWithExplicit(property);\n valueWithExplicit = mergeValuesWithExplicit(\n valueWithExplicit,\n childValueWithExplicit,\n property,\n 'scale',\n tieBreakByComparing((v1, v2) => {\n switch (property) {\n case 'range':\n // For step, prefer larger step\n if (v1.step && v2.step) {\n return v1.step - v2.step;\n }\n return 0;\n // TODO: precedence rule for other properties\n }\n return 0;\n })\n );\n }\n }\n localScaleComponents[channel].setWithExplicit(property, valueWithExplicit);\n }\n}\n\nexport function bins(model: Model, fieldDef: TypedFieldDef) {\n const bin = fieldDef.bin;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return new SignalRefWrapper(() => {\n return model.getSignalName(binSignal);\n });\n } else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) {\n // start and stop will be determined from the scale domain\n return {\n step: bin.step\n };\n }\n return undefined;\n}\n\nexport function interpolate(channel: ScaleChannel, type: Type): Scale['interpolate'] {\n if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') {\n return 'hcl';\n }\n return undefined;\n}\n\nexport function nice(\n scaleType: ScaleType,\n channel: ScaleChannel,\n fieldOrDatumDef: TypedFieldDef | ScaleDatumDef\n): boolean | TimeInterval {\n if (getFieldDef(fieldOrDatumDef)?.bin || util.contains([ScaleType.TIME, ScaleType.UTC], scaleType)) {\n return undefined;\n }\n return channel in POSITION_SCALE_CHANNEL_INDEX ? true : undefined;\n}\n\nexport function padding(\n channel: ScaleChannel,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig,\n fieldOrDatumDef: TypedFieldDef | ScaleDatumDef,\n markDef: MarkDef,\n barConfig: RectConfig\n) {\n if (channel in POSITION_SCALE_CHANNEL_INDEX) {\n if (isContinuousToContinuous(scaleType)) {\n if (scaleConfig.continuousPadding !== undefined) {\n return scaleConfig.continuousPadding;\n }\n\n const {type, orient} = markDef;\n if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) {\n if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) {\n return barConfig.continuousBandSize;\n }\n }\n }\n\n if (scaleType === ScaleType.POINT) {\n return scaleConfig.pointPadding;\n }\n }\n return undefined;\n}\n\nexport function paddingInner(\n paddingValue: number | SignalRef,\n channel: ScaleChannel,\n mark: Mark,\n scaleConfig: ScaleConfig\n) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingInner.\n return undefined;\n }\n\n if (channel in POSITION_SCALE_CHANNEL_INDEX) {\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n\n // paddingOuter would only be called if it's a band scale, just return the default for bandScale.\n\n const {bandPaddingInner, barBandPaddingInner, rectBandPaddingInner} = scaleConfig;\n\n return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner);\n }\n return undefined;\n}\n\nexport function paddingOuter(\n paddingValue: number | SignalRef,\n channel: ScaleChannel,\n scaleType: ScaleType,\n mark: Mark,\n paddingInnerValue: number | SignalRef,\n scaleConfig: ScaleConfig\n) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingOuter.\n return undefined;\n }\n\n if (channel in POSITION_SCALE_CHANNEL_INDEX) {\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n if (scaleType === ScaleType.BAND) {\n const {bandPaddingOuter} = scaleConfig;\n\n return getFirstDefined(\n bandPaddingOuter,\n /* By default, paddingOuter is paddingInner / 2. The reason is that\n size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter).\n and we want the width/height to be integer by default.\n Note that step (by default) and cardinality are integers.) */\n isSignalRef(paddingInnerValue) ? {signal: `${paddingInnerValue.signal}/2`} : paddingInnerValue / 2\n );\n }\n }\n return undefined;\n}\n\nexport function reverse(scaleType: ScaleType, sort: Sort, channel: ScaleChannel, scaleConfig: ScaleConfig) {\n if (channel === 'x' && scaleConfig.xReverse !== undefined) {\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n if (isSignalRef(scaleConfig.xReverse)) {\n return {signal: `!${scaleConfig.xReverse.signal}`};\n } else {\n return !scaleConfig.xReverse;\n }\n }\n return scaleConfig.xReverse;\n }\n\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n // For continuous domain scales, Vega does not support domain sort.\n // Thus, we reverse range instead if sort is descending\n return true;\n }\n return undefined;\n}\n\nexport function zero(\n channel: ScaleChannel,\n fieldDef: TypedFieldDef | ScaleDatumDef,\n specifiedDomain: Domain,\n markDef: MarkDef,\n scaleType: ScaleType\n) {\n // If users explicitly provide a domain range, we should not augment zero as that will be unexpected.\n const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated';\n if (hasCustomDomain) {\n if (hasContinuousDomain(scaleType)) {\n if (isArray(specifiedDomain)) {\n const first = specifiedDomain[0];\n const last = specifiedDomain[specifiedDomain.length - 1];\n\n if (first <= 0 && last >= 0) {\n // if the domain includes zero, make zero remains true\n return true;\n }\n }\n return false;\n }\n }\n\n // If there is no custom domain, return true only for the following cases:\n\n // 1) using quantitative field with size\n // While this can be either ratio or interval fields, our assumption is that\n // ratio are more common. However, if the scaleType is discretizing scale, we want to return\n // false so that range doesn't start at zero\n if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) {\n return true;\n }\n\n // 2) non-binned, quantitative x-scale or y-scale\n // (For binning, we should not include zero by default because binning are calculated without zero.)\n if (\n !(isFieldDef(fieldDef) && fieldDef.bin) &&\n util.contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)\n ) {\n const {orient, type} = markDef;\n if (contains(['bar', 'area', 'line', 'trail'], type)) {\n if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) {\n return false;\n }\n }\n\n return true;\n }\n return false;\n}\n","import {isBinning} from '../../bin';\nimport {Channel, isColorChannel, isScaleChannel, rangeType} from '../../channel';\nimport {DatumDef, isFieldDef, isPositionFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef';\nimport * as log from '../../log';\nimport {Mark} from '../../mark';\nimport {channelSupportScaleType, Scale, ScaleType, scaleTypeSupportDataType} from '../../scale';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport * as util from '../../util';\nimport {POLAR_POSITION_SCALE_CHANNEL_INDEX, POSITION_SCALE_CHANNEL_INDEX} from './../../channel';\n\nexport type RangeType = 'continuous' | 'discrete' | 'flexible' | undefined;\n\n/**\n * Determine if there is a specified scale type and if it is appropriate,\n * or determine default type if type is unspecified or inappropriate.\n */\n// NOTE: CompassQL uses this method.\nexport function scaleType(\n specifiedScale: Scale,\n channel: Channel,\n fieldDef: TypedFieldDef | DatumDef,\n mark: Mark\n): ScaleType {\n const defaultScaleType = defaultType(channel, fieldDef, mark);\n const {type} = specifiedScale;\n\n if (!isScaleChannel(channel)) {\n // There is no scale for these channels\n return null;\n }\n if (type !== undefined) {\n // Check if explicitly specified scale type is supported by the channel\n if (!channelSupportScaleType(channel, type)) {\n log.warn(log.message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType));\n return defaultScaleType;\n }\n\n // Check if explicitly specified scale type is supported by the data type\n if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) {\n log.warn(log.message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType));\n return defaultScaleType;\n }\n\n return type;\n }\n\n return defaultScaleType;\n}\n\n/**\n * Determine appropriate default scale type.\n */\n// NOTE: Voyager uses this method.\nfunction defaultType(channel: Channel, fieldDef: TypedFieldDef | ScaleDatumDef, mark: Mark): ScaleType {\n switch (fieldDef.type) {\n case 'nominal':\n case 'ordinal':\n if (isColorChannel(channel) || rangeType(channel) === 'discrete') {\n if (channel === 'shape' && fieldDef.type === 'ordinal') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal'));\n }\n return 'ordinal';\n }\n\n if (channel in POSITION_SCALE_CHANNEL_INDEX) {\n if (util.contains(['rect', 'bar', 'image', 'rule'], mark)) {\n // The rect/bar mark should fit into a band.\n // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429\n return 'band';\n }\n } else if (mark === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) {\n return 'band';\n }\n\n if (fieldDef.band !== undefined || (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand)) {\n return 'band';\n }\n // Otherwise, use ordinal point scale so we can easily get center positions of the marks.\n return 'point';\n\n case 'temporal':\n if (isColorChannel(channel)) {\n return 'time';\n } else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'temporal'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n } else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) {\n return 'utc';\n }\n return 'time';\n\n case 'quantitative':\n if (isColorChannel(channel)) {\n if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n return 'bin-ordinal';\n }\n\n return 'linear';\n } else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'quantitative'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n }\n\n return 'linear';\n\n case 'geojson':\n return undefined;\n }\n\n /* istanbul ignore next: should never reach this */\n throw new Error(log.message.invalidFieldType(fieldDef.type));\n}\n","import {ScaleChannel, SCALE_CHANNELS, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef';\nimport {GEOSHAPE} from '../../mark';\nimport {\n NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES,\n scaleCompatible,\n ScaleType,\n scaleTypePrecedence\n} from '../../scale';\nimport {GEOJSON} from '../../type';\nimport {keys} from '../../util';\nimport {VgScale} from '../../vega.schema';\nimport {isUnitModel, Model} from '../model';\nimport {defaultScaleResolve} from '../resolve';\nimport {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponent, ScaleComponentIndex} from './component';\nimport {parseScaleDomain} from './domain';\nimport {parseScaleProperty, parseScaleRange} from './properties';\nimport {scaleType} from './type';\n\nexport function parseScales(model: Model, {ignoreRange}: {ignoreRange?: boolean} = {}) {\n parseScaleCore(model);\n parseScaleDomain(model);\n for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) {\n parseScaleProperty(model, prop);\n }\n if (!ignoreRange) {\n // range depends on zero\n parseScaleRange(model);\n }\n}\n\nexport function parseScaleCore(model: Model) {\n if (isUnitModel(model)) {\n model.component.scales = parseUnitScaleCore(model);\n } else {\n model.component.scales = parseNonUnitScaleCore(model);\n }\n}\n\n/**\n * Parse scales for all channels of a model.\n */\nfunction parseUnitScaleCore(model: UnitModel): ScaleComponentIndex {\n const {encoding, mark} = model;\n\n return SCALE_CHANNELS.reduce((scaleComponents: ScaleComponentIndex, channel: ScaleChannel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as TypedFieldDef | ScaleDatumDef; // must be typed def to have scale\n\n // Don't generate scale for shape of geoshape\n if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) {\n return scaleComponents;\n }\n let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale'];\n\n if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) {\n specifiedScale = specifiedScale ?? {};\n\n const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, mark);\n scaleComponents[channel] = new ScaleComponent(model.scaleName(channel + '', true), {\n value: sType,\n explicit: specifiedScale.type === sType\n });\n }\n\n return scaleComponents;\n }, {});\n}\n\nconst scaleTypeTieBreaker = tieBreakByComparing(\n (st1: ScaleType, st2: ScaleType) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2)\n);\n\nfunction parseNonUnitScaleCore(model: Model) {\n const scaleComponents: ScaleComponentIndex = (model.component.scales = {});\n\n const scaleTypeWithExplicitIndex: Partial>> = {};\n const resolve = model.component.resolve;\n\n // Parse each child scale and determine if a particular channel can be merged.\n for (const child of model.children) {\n parseScaleCore(child);\n\n // Instead of always merging right away -- check if it is compatible to merge first!\n for (const channel of keys(child.component.scales)) {\n // if resolve is undefined, set default first\n resolve.scale[channel] = resolve.scale[channel] ?? defaultScaleResolve(channel, model);\n\n if (resolve.scale[channel] === 'shared') {\n const explicitScaleType = scaleTypeWithExplicitIndex[channel];\n const childScaleType = child.component.scales[channel].getWithExplicit('type');\n\n if (explicitScaleType) {\n if (scaleCompatible(explicitScaleType.value, childScaleType.value)) {\n // merge scale component if type are compatible\n scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(\n explicitScaleType,\n childScaleType,\n 'type',\n 'scale',\n scaleTypeTieBreaker\n );\n } else {\n // Otherwise, update conflicting channel to be independent\n resolve.scale[channel] = 'independent';\n // Remove from the index so they don't get merged\n delete scaleTypeWithExplicitIndex[channel];\n }\n } else {\n scaleTypeWithExplicitIndex[channel] = childScaleType;\n }\n }\n }\n }\n\n // Merge each channel listed in the index\n for (const channel of keys(scaleTypeWithExplicitIndex)) {\n // Create new merged scale component\n const name = model.scaleName(channel, true);\n const typeWithExplicit = scaleTypeWithExplicitIndex[channel];\n scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit);\n\n // rename each child and mark them as merged\n for (const child of model.children) {\n const childScale = child.component.scales[channel];\n if (childScale) {\n child.renameScale(childScale.get('name'), name);\n childScale.merged = true;\n }\n }\n }\n\n return scaleComponents;\n}\n","import {\n AnchorValue,\n Axis as VgAxis,\n Legend as VgLegend,\n NewSignal,\n Projection as VgProjection,\n SignalRef,\n Title as VgTitle\n} from 'vega';\nimport {\n Channel,\n FACET_CHANNELS,\n getPositionScaleChannel,\n isChannel,\n isScaleChannel,\n ScaleChannel,\n SingleDefChannel,\n ExtendedChannel\n} from '../channel';\nimport {ChannelDef, FieldDef, FieldRefOption, getFieldDef, vgField} from '../channeldef';\nimport {Config} from '../config';\nimport {Data, DataSourceType} from '../data';\nimport {forEach, reduce} from '../encoding';\nimport * as log from '../log';\nimport {Resolve} from '../resolve';\nimport {hasDiscreteDomain} from '../scale';\nimport {isFacetSpec} from '../spec';\nimport {\n extractCompositionLayout,\n GenericCompositionLayoutWithColumns,\n LayoutSizeMixins,\n SpecType,\n ViewBackground\n} from '../spec/base';\nimport {NormalizedSpec} from '../spec/index';\nimport {extractTitleConfig, isText, TitleParams} from '../title';\nimport {normalizeTransform, Transform} from '../transform';\nimport {contains, Dict, duplicate, keys, varName, isEmpty} from '../util';\nimport {isVgRangeStep, VgData, VgEncodeEntry, VgLayout, VgMarkGroup} from '../vega.schema';\nimport {assembleAxes} from './axis/assemble';\nimport {AxisComponentIndex} from './axis/component';\nimport {signalOrValueRef} from './common';\nimport {ConcatModel} from './concat';\nimport {DataComponent} from './data';\nimport {FacetModel} from './facet';\nimport {assembleHeaderGroups, assembleLayoutTitleBand, assembleTitleGroup} from './header/assemble';\nimport {HEADER_CHANNELS, LayoutHeaderComponent} from './header/component';\nimport {LayerModel} from './layer';\nimport {sizeExpr} from './layoutsize/assemble';\nimport {\n getSizeTypeFromLayoutSizeType,\n LayoutSizeComponent,\n LayoutSizeIndex,\n LayoutSizeType\n} from './layoutsize/component';\nimport {assembleLegends} from './legend/assemble';\nimport {LegendComponentIndex} from './legend/component';\nimport {parseLegend} from './legend/parse';\nimport {assembleProjections} from './projection/assemble';\nimport {ProjectionComponent} from './projection/component';\nimport {parseProjection} from './projection/parse';\nimport {assembleScales} from './scale/assemble';\nimport {ScaleComponent, ScaleComponentIndex} from './scale/component';\nimport {assembleDomain, getFieldFromDomain} from './scale/domain';\nimport {parseScales} from './scale/parse';\nimport {SelectionComponent} from './selection';\nimport {Split} from './split';\nimport {UnitModel} from './unit';\n\n/**\n * Composable Components that are intermediate results of the parsing phase of the\n * compilations. The components represents parts of the specification in a form that\n * can be easily merged (during parsing for composite specs).\n * In addition, these components are easily transformed into Vega specifications\n * during the \"assemble\" phase, which is the last phase of the compilation step.\n */\nexport interface Component {\n data: DataComponent;\n\n layoutSize: LayoutSizeComponent;\n\n layoutHeaders: {\n row?: LayoutHeaderComponent;\n column?: LayoutHeaderComponent;\n facet?: LayoutHeaderComponent;\n };\n\n mark: VgMarkGroup[];\n scales: ScaleComponentIndex;\n projection: ProjectionComponent;\n selection: Dict;\n\n /** Dictionary mapping channel to VgAxis definition */\n axes: AxisComponentIndex;\n\n /** Dictionary mapping channel to VgLegend definition */\n legends: LegendComponentIndex;\n\n resolve: Resolve;\n}\n\nexport interface NameMapInterface {\n rename(oldname: string, newName: string): void;\n has(name: string): boolean;\n get(name: string): string;\n}\n\nexport class NameMap implements NameMapInterface {\n private nameMap: Dict;\n\n constructor() {\n this.nameMap = {};\n }\n\n public rename(oldName: string, newName: string) {\n this.nameMap[oldName] = newName;\n }\n\n public has(name: string): boolean {\n return this.nameMap[name] !== undefined;\n }\n\n public get(name: string): string {\n // If the name appears in the _nameMap, we need to read its new name.\n // We have to loop over the dict just in case the new name also gets renamed.\n while (this.nameMap[name] && name !== this.nameMap[name]) {\n name = this.nameMap[name];\n }\n\n return name;\n }\n}\n\n/*\n We use type guards instead of `instanceof` as `instanceof` makes\n different parts of the compiler depend on the actual implementation of\n the model classes, which in turn depend on different parts of the compiler.\n Thus, `instanceof` leads to circular dependency problems.\n\n On the other hand, type guards only make different parts of the compiler\n depend on the type of the model classes, but not the actual implementation.\n*/\n\nexport function isUnitModel(model: Model): model is UnitModel {\n return model?.type === 'unit';\n}\n\nexport function isFacetModel(model: Model): model is FacetModel {\n return model?.type === 'facet';\n}\n\nexport function isConcatModel(model: Model): model is ConcatModel {\n return model?.type === 'concat';\n}\n\nexport function isLayerModel(model: Model): model is LayerModel {\n return model?.type === 'layer';\n}\n\nexport abstract class Model {\n public readonly name: string;\n\n public size: LayoutSizeMixins;\n\n public readonly title: TitleParams;\n public readonly description: string;\n\n public readonly data: Data | null;\n public readonly transforms: Transform[];\n public readonly layout: GenericCompositionLayoutWithColumns;\n\n /** Name map for scales, which can be renamed by a model's parent. */\n protected scaleNameMap: NameMapInterface;\n\n /** Name map for projections, which can be renamed by a model's parent. */\n protected projectionNameMap: NameMapInterface;\n\n /** Name map for signals, which can be renamed by a model's parent. */\n protected signalNameMap: NameMapInterface;\n\n public readonly component: Component;\n\n public abstract readonly children: Model[] = [];\n\n constructor(\n spec: NormalizedSpec,\n public readonly type: SpecType,\n public readonly parent: Model,\n parentGivenName: string,\n public readonly config: Config,\n resolve: Resolve,\n public readonly view?: ViewBackground\n ) {\n this.parent = parent;\n this.config = config;\n\n // If name is not provided, always use parent's givenName to avoid name conflicts.\n this.name = spec.name ?? parentGivenName;\n this.title = isText(spec.title) ? {text: spec.title} : (spec.title as TitleParams);\n\n // Shared name maps\n this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap();\n this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap();\n this.signalNameMap = parent ? parent.signalNameMap : new NameMap();\n\n this.data = spec.data;\n\n this.description = spec.description;\n this.transforms = normalizeTransform(spec.transform ?? []);\n this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config);\n\n this.component = {\n data: {\n sources: parent ? parent.component.data.sources : [],\n outputNodes: parent ? parent.component.data.outputNodes : {},\n outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {},\n // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined\n isFaceted: isFacetSpec(spec) || (parent && parent.component.data.isFaceted && spec.data === undefined)\n },\n layoutSize: new Split(),\n layoutHeaders: {row: {}, column: {}, facet: {}},\n mark: null,\n resolve: {\n scale: {},\n axis: {},\n legend: {},\n ...(resolve ? duplicate(resolve) : {})\n },\n selection: null,\n scales: null,\n projection: null,\n axes: {},\n legends: {}\n };\n }\n\n public get width(): SignalRef {\n return this.getSizeSignalRef('width');\n }\n\n public get height(): SignalRef {\n return this.getSizeSignalRef('height');\n }\n\n public parse() {\n this.parseScale();\n\n this.parseLayoutSize(); // depends on scale\n this.renameTopLevelLayoutSizeSignal();\n\n this.parseSelections();\n this.parseProjection();\n this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name.\n this.parseAxesAndHeaders(); // depends on scale and layout size\n this.parseLegends(); // depends on scale, markDef\n this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark.\n }\n\n public abstract parseData(): void;\n\n public abstract parseSelections(): void;\n\n public parseScale() {\n parseScales(this);\n }\n\n public parseProjection() {\n parseProjection(this);\n }\n\n public abstract parseLayoutSize(): void;\n\n /**\n * Rename top-level spec's size to be just width / height, ignoring model name.\n * This essentially merges the top-level spec's width/height signals with the width/height signals\n * to help us reduce redundant signals declaration.\n */\n private renameTopLevelLayoutSizeSignal() {\n if (this.getName('width') !== 'width') {\n this.renameSignal(this.getName('width'), 'width');\n }\n if (this.getName('height') !== 'height') {\n this.renameSignal(this.getName('height'), 'height');\n }\n }\n\n public abstract parseMarkGroup(): void;\n\n public abstract parseAxesAndHeaders(): void;\n\n public parseLegends() {\n parseLegend(this);\n }\n\n public abstract assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[];\n public abstract assembleSignals(): NewSignal[];\n\n public abstract assembleSelectionData(data: readonly VgData[]): readonly VgData[];\n\n public assembleGroupStyle(): string | string[] {\n if (this.type === 'unit' || this.type === 'layer') {\n return this.view?.style ?? 'cell';\n }\n return undefined;\n }\n\n private assembleEncodeFromView(view: ViewBackground): VgEncodeEntry {\n // Exclude \"style\"\n const {style: _, ...baseView} = view;\n\n const e: VgEncodeEntry = {};\n for (const property of keys(baseView)) {\n const value = baseView[property];\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n\n return e;\n }\n\n public assembleGroupEncodeEntry(isTopLevel: boolean): VgEncodeEntry {\n let encodeEntry: VgEncodeEntry = {};\n if (this.view) {\n encodeEntry = this.assembleEncodeFromView(this.view);\n }\n\n if (!isTopLevel) {\n // Descriptions are already added to the top-level description so we only need to add them to the inner views.\n if (this.description) {\n encodeEntry['description'] = signalOrValueRef(this.description);\n }\n\n // For top-level spec, we can set the global width and height signal to adjust the group size.\n // For other child specs, we have to manually set width and height in the encode entry.\n if (this.type === 'unit' || this.type === 'layer') {\n return {\n width: this.getSizeSignalRef('width'),\n height: this.getSizeSignalRef('height'),\n ...(encodeEntry ?? {})\n };\n }\n }\n\n return isEmpty(encodeEntry) ? undefined : encodeEntry;\n }\n\n public assembleLayout(): VgLayout {\n if (!this.layout) {\n return undefined;\n }\n\n const {spacing, ...layout} = this.layout;\n\n const {component, config} = this;\n const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config);\n\n return {\n padding: spacing,\n ...this.assembleDefaultLayout(),\n ...layout,\n ...(titleBand ? {titleBand} : {})\n };\n }\n\n protected assembleDefaultLayout(): VgLayout {\n return {};\n }\n\n public abstract assembleLayoutSignals(): NewSignal[];\n\n public assembleHeaderMarks(): VgMarkGroup[] {\n const {layoutHeaders} = this.component;\n let headerMarks = [];\n\n for (const channel of FACET_CHANNELS) {\n if (layoutHeaders[channel].title) {\n headerMarks.push(assembleTitleGroup(this, channel));\n }\n }\n\n for (const channel of HEADER_CHANNELS) {\n headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel));\n }\n return headerMarks;\n }\n\n public abstract assembleMarks(): VgMarkGroup[];\n\n public assembleAxes(): VgAxis[] {\n return assembleAxes(this.component.axes, this.config);\n }\n\n public assembleLegends(): VgLegend[] {\n return assembleLegends(this);\n }\n\n public assembleProjections(): VgProjection[] {\n return assembleProjections(this);\n }\n\n public assembleTitle(): VgTitle {\n const {encoding, ...titleNoEncoding} = this.title ?? ({} as TitleParams);\n\n const title: VgTitle = {\n ...extractTitleConfig(this.config.title).nonMark,\n ...titleNoEncoding,\n ...(encoding ? {encode: {update: encoding}} : {})\n };\n\n if (title.text) {\n if (contains(['unit', 'layer'], this.type)) {\n // Unit/Layer\n if (contains(['middle', undefined], title.anchor)) {\n title.frame = title.frame ?? 'group';\n }\n } else {\n // composition with Vega layout\n\n // Set title = \"start\" by default for composition as \"middle\" does not look nice\n // https://github.com/vega/vega/issues/960#issuecomment-471360328\n title.anchor = title.anchor ?? 'start';\n }\n\n return isEmpty(title) ? undefined : title;\n }\n return undefined;\n }\n\n /**\n * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals.\n */\n public assembleGroup(signals: NewSignal[] = []) {\n const group: VgMarkGroup = {};\n\n signals = signals.concat(this.assembleSignals());\n\n if (signals.length > 0) {\n group.signals = signals;\n }\n\n const layout = this.assembleLayout();\n if (layout) {\n group.layout = layout;\n }\n\n group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());\n\n // Only include scales if this spec is top-level or if parent is facet.\n // (Otherwise, it will be merged with upper-level's scope.)\n const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : [];\n if (scales.length > 0) {\n group.scales = scales;\n }\n\n const axes = this.assembleAxes();\n if (axes.length > 0) {\n group.axes = axes;\n }\n\n const legends = this.assembleLegends();\n if (legends.length > 0) {\n group.legends = legends;\n }\n\n return group;\n }\n\n public getName(text: string) {\n return varName((this.name ? this.name + '_' : '') + text);\n }\n\n public getDataName(type: DataSourceType) {\n return this.getName(DataSourceType[type].toLowerCase());\n }\n\n /**\n * Request a data source name for the given data source type and mark that data source as required.\n * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData().\n * You can lookup the correct dataset name in assemble with `lookupDataSource`.\n */\n public requestDataName(name: DataSourceType) {\n const fullName = this.getDataName(name);\n\n // Increase ref count. This is critical because otherwise we won't create a data source.\n // We also increase the ref counts on OutputNode.getSource() calls.\n const refCounts = this.component.data.outputNodeRefCounts;\n refCounts[fullName] = (refCounts[fullName] || 0) + 1;\n\n return fullName;\n }\n\n public getSizeSignalRef(layoutSizeType: LayoutSizeType): SignalRef {\n if (isFacetModel(this.parent)) {\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const scaleComponent = this.component.scales[channel];\n\n if (scaleComponent && !scaleComponent.merged) {\n // independent scale\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = scaleComponent.get('name');\n const domain = assembleDomain(this, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n const fieldRef = vgField({aggregate: 'distinct', field}, {expr: 'datum'});\n return {\n signal: sizeExpr(scaleName, scaleComponent, fieldRef)\n };\n } else {\n log.warn(log.message.unknownField(channel));\n return null;\n }\n }\n }\n }\n\n return {\n signal: this.signalNameMap.get(this.getName(layoutSizeType))\n };\n }\n\n /**\n * Lookup the name of the datasource for an output node. You probably want to call this in assemble.\n */\n public lookupDataSource(name: string) {\n const node = this.component.data.outputNodes[name];\n\n if (!node) {\n // Name not found in map so let's just return what we got.\n // This can happen if we already have the correct name.\n return name;\n }\n\n return node.getSource();\n }\n\n public getSignalName(oldSignalName: string): string {\n return this.signalNameMap.get(oldSignalName);\n }\n\n public renameSignal(oldName: string, newName: string) {\n this.signalNameMap.rename(oldName, newName);\n }\n\n public renameScale(oldName: string, newName: string) {\n this.scaleNameMap.rename(oldName, newName);\n }\n\n public renameProjection(oldName: string, newName: string) {\n this.projectionNameMap.rename(oldName, newName);\n }\n\n /**\n * @return scale name for a given channel after the scale has been parsed and named.\n */\n public scaleName(originalScaleName: ScaleChannel | string, parse?: boolean): string {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a scale can't be renamed\n // before it has the original name.\n return this.getName(originalScaleName);\n }\n\n // If there is a scale for the channel, it should either\n // be in the scale component or exist in the name map\n if (\n // If there is a scale for the channel, there should be a local scale component for it\n (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) ||\n // in the scale name map (the scale get merged by its parent)\n this.scaleNameMap.has(this.getName(originalScaleName))\n ) {\n return this.scaleNameMap.get(this.getName(originalScaleName));\n }\n return undefined;\n }\n\n /**\n * @return projection name after the projection has been parsed and named.\n */\n public projectionName(parse?: boolean): string {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a projection can't be renamed\n // before it has the original name.\n return this.getName('projection');\n }\n\n if (\n (this.component.projection && !this.component.projection.merged) ||\n this.projectionNameMap.has(this.getName('projection'))\n ) {\n return this.projectionNameMap.get(this.getName('projection'));\n }\n return undefined;\n }\n\n /**\n * Corrects the data references in marks after assemble.\n */\n public correctDataNames = (mark: VgMarkGroup) => {\n // TODO: make this correct\n\n // for normal data references\n if (mark.from && mark.from.data) {\n mark.from.data = this.lookupDataSource(mark.from.data);\n }\n\n // for access to facet data\n if (mark.from && mark.from.facet && mark.from.facet.data) {\n mark.from.facet.data = this.lookupDataSource(mark.from.facet.data);\n }\n\n return mark;\n };\n\n /**\n * Traverse a model's hierarchy to get the scale component for a particular channel.\n */\n public getScaleComponent(channel: ScaleChannel): ScaleComponent {\n /* istanbul ignore next: This is warning for debugging test */\n if (!this.component.scales) {\n throw new Error(\n 'getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().'\n );\n }\n\n const localScaleComponent = this.component.scales[channel];\n if (localScaleComponent && !localScaleComponent.merged) {\n return localScaleComponent;\n }\n return this.parent ? this.parent.getScaleComponent(channel) : undefined;\n }\n\n /**\n * Traverse a model's hierarchy to get a particular selection component.\n */\n public getSelectionComponent(variableName: string, origName: string): SelectionComponent {\n let sel = this.component.selection[variableName];\n if (!sel && this.parent) {\n sel = this.parent.getSelectionComponent(variableName, origName);\n }\n if (!sel) {\n throw new Error(log.message.selectionNotFound(origName));\n }\n return sel;\n }\n\n /**\n * Returns true if the model has a signalRef for an axis orient.\n */\n public hasAxisOrientSignalRef() {\n return (\n this.component.axes.x?.some(a => a.hasOrientSignalRef()) ||\n this.component.axes.y?.some(a => a.hasOrientSignalRef())\n );\n }\n}\n\n/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */\nexport abstract class ModelWithField extends Model {\n public abstract fieldDef(channel: SingleDefChannel): FieldDef;\n\n /** Get \"field\" reference for Vega */\n public vgField(channel: SingleDefChannel, opt: FieldRefOption = {}) {\n const fieldDef = this.fieldDef(channel);\n\n if (!fieldDef) {\n return undefined;\n }\n\n return vgField(fieldDef, opt);\n }\n\n protected abstract getMapping(): Partial>;\n\n public reduceFieldDef(f: (acc: U, fd: FieldDef, c: Channel) => U, init: T): T {\n return reduce(\n this.getMapping(),\n (acc: U, cd: ChannelDef, c: Channel) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n return f(acc, fieldDef, c);\n }\n return acc;\n },\n init\n );\n }\n\n public forEachFieldDef(f: (fd: FieldDef, c: ExtendedChannel) => void, t?: any) {\n forEach(\n this.getMapping(),\n (cd, c) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n f(fieldDef, c);\n }\n },\n t\n );\n }\n\n public abstract channelHasField(channel: Channel): boolean;\n}\n","import {KDETransform as VgKDETransform} from 'vega';\nimport {DensityTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for density transform nodes\n */\nexport class DensityTransformNode extends DataFlowNode {\n public clone() {\n return new DensityTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: DensityTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density'];\n }\n\n public dependentFields() {\n return new Set([this.transform.density, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `DensityTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgKDETransform {\n const {density, ...rest} = this.transform;\n const result: VgKDETransform = {\n type: 'kde',\n field: density,\n ...rest\n };\n return result;\n }\n}\n","import {FilterTransform as VgFilterTransform} from 'vega';\nimport {isScaleChannel} from '../../channel';\nimport {TypedFieldDef, vgField as fieldRef} from '../../channeldef';\nimport {isPathMark} from '../../mark';\nimport {hasContinuousDomain} from '../../scale';\nimport {Dict, hash, keys} from '../../util';\nimport {getMarkPropOrConfig} from '../common';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class FilterInvalidNode extends DataFlowNode {\n public clone() {\n return new FilterInvalidNode(null, {...this.filter});\n }\n\n constructor(parent: DataFlowNode, public readonly filter: Dict>) {\n super(parent);\n }\n\n public static make(parent: DataFlowNode, model: UnitModel): FilterInvalidNode {\n const {config, mark, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid !== 'filter') {\n return null;\n }\n\n const filter = model.reduceFieldDef((aggregator: Dict>, fieldDef, channel) => {\n const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n // Thus, for non-path marks, we have to filter null for scales with continuous domains.\n // (For path marks, we will use \"defined\" property and skip these values instead.)\n if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) {\n aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def\n }\n }\n return aggregator;\n }, {} as Dict>);\n\n if (!keys(filter).length) {\n return null;\n }\n\n return new FilterInvalidNode(parent, filter);\n }\n\n public dependentFields() {\n return new Set(keys(this.filter));\n }\n\n public producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n\n public hash() {\n return `FilterInvalid ${hash(this.filter)}`;\n }\n\n /**\n * Create the VgTransforms for each of the filtered fields.\n */\n public assemble(): VgFilterTransform {\n const filters = keys(this.filter).reduce((vegaFilters, field) => {\n const fieldDef = this.filter[field];\n const ref = fieldRef(fieldDef, {expr: 'datum'});\n\n if (fieldDef !== null) {\n if (fieldDef.type === 'temporal') {\n vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`);\n } else if (fieldDef.type === 'quantitative') {\n vegaFilters.push(`isValid(${ref})`);\n vegaFilters.push(`isFinite(+${ref})`);\n } else {\n // should never get here\n }\n }\n return vegaFilters;\n }, [] as string[]);\n\n return filters.length > 0\n ? {\n type: 'filter',\n expr: filters.join(' && ')\n }\n : null;\n }\n}\n","import {FlattenTransform as VgFlattenTransform} from 'vega';\nimport {FlattenTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class FlattenTransformNode extends DataFlowNode {\n public clone() {\n return new FlattenTransformNode(this.parent, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: FlattenTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const {flatten, as = []} = this.transform;\n this.transform.as = flatten.map((f, i) => as[i] ?? f);\n }\n\n public dependentFields() {\n return new Set(this.transform.flatten);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `FlattenTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgFlattenTransform {\n const {flatten: fields, as} = this.transform;\n\n const result: VgFlattenTransform = {\n type: 'flatten',\n fields,\n as\n };\n return result;\n }\n}\n","import {FoldTransform as VgFoldTransform} from 'vega';\nimport {FoldTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class FoldTransformNode extends DataFlowNode {\n public clone() {\n return new FoldTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: FoldTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'key', specifiedAs[1] ?? 'value'];\n }\n\n public dependentFields() {\n return new Set(this.transform.fold);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `FoldTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgFoldTransform {\n const {fold, as} = this.transform;\n const result: VgFoldTransform = {\n type: 'fold',\n fields: fold,\n as\n };\n return result;\n }\n}\n","import {GeoJSONTransform as VgGeoJSONTransform, Vector2} from 'vega';\nimport {isString} from 'vega-util';\nimport {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef';\nimport {GEOJSON} from '../../type';\nimport {duplicate, hash} from '../../util';\nimport {VgExprRef} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class GeoJSONNode extends DataFlowNode {\n public clone() {\n return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal);\n }\n\n public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode {\n if (model.component.projection && !model.component.projection.isFit) {\n return parent;\n }\n\n let geoJsonCounter = 0;\n\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ] as Vector2[]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? {expr: `${def.datum}`}\n : isValueDef(def)\n ? {expr: `${def['value']}`}\n : undefined;\n }) as [GeoPositionChannel, GeoPositionChannel];\n\n if (pair[0] || pair[1]) {\n parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n\n if (model.channelHasField(SHAPE)) {\n const fieldDef = model.typedFieldDef(SHAPE);\n if (fieldDef.type === GEOJSON) {\n parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n\n return parent;\n }\n\n constructor(\n parent: DataFlowNode,\n private fields?: Vector2,\n private geojson?: string,\n private signal?: string\n ) {\n super(parent);\n }\n\n public dependentFields() {\n const fields = (this.fields ?? []).filter(isString) as string[];\n return new Set([...(this.geojson ? [this.geojson] : []), ...fields]);\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`;\n }\n\n public assemble(): VgGeoJSONTransform {\n return {\n type: 'geojson',\n ...(this.fields ? {fields: this.fields} : {}),\n ...(this.geojson ? {geojson: this.geojson} : {}),\n signal: this.signal\n };\n }\n}\n","import {GeoPointTransform as VgGeoPointTransform, Vector2} from 'vega';\nimport {isString} from 'vega-util';\nimport {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2} from '../../channel';\nimport {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef';\nimport {duplicate, hash} from '../../util';\nimport {VgExprRef} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class GeoPointNode extends DataFlowNode {\n public clone() {\n return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as));\n }\n\n constructor(\n parent: DataFlowNode,\n private projection: string,\n private fields: [string | VgExprRef, string | VgExprRef],\n private as: [string, string]\n ) {\n super(parent);\n }\n\n public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode {\n if (!model.projectionName()) {\n return parent;\n }\n\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ] as Vector2[]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? {expr: `${def.datum}`}\n : isValueDef(def)\n ? {expr: `${def['value']}`}\n : undefined;\n }) as [GeoPositionChannel, GeoPositionChannel];\n\n const suffix = coordinates[0] === LONGITUDE2 ? '2' : '';\n\n if (pair[0] || pair[1]) {\n parent = new GeoPointNode(parent, model.projectionName(), pair, [\n model.getName('x' + suffix),\n model.getName('y' + suffix)\n ]);\n }\n }\n\n return parent;\n }\n\n public dependentFields() {\n return new Set(this.fields.filter(isString));\n }\n\n public producedFields() {\n return new Set(this.as);\n }\n\n public hash() {\n return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`;\n }\n\n public assemble(): VgGeoPointTransform {\n return {\n type: 'geopoint',\n projection: this.projection,\n fields: this.fields,\n as: this.as\n };\n }\n}\n","import {\n FormulaTransform as VgFormulaTransform,\n ImputeTransform as VgImputeTransform,\n SignalRef,\n WindowTransform as VgWindowTransform\n} from 'vega';\nimport {isFieldDef} from '../../channeldef';\nimport {pathGroupingFields} from '../../encoding';\nimport {ImputeSequence, ImputeTransform, isImputeSequence} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class ImputeNode extends DataFlowNode {\n public clone() {\n return new ImputeNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private readonly transform: ImputeTransform) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set([this.transform.impute, this.transform.key, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set([this.transform.impute]);\n }\n\n private processSequence(keyvals: ImputeSequence): SignalRef {\n const {start = 0, stop, step} = keyvals;\n const result = [start, stop, ...(step ? [step] : [])].join(',');\n\n return {signal: `sequence(${result})`};\n }\n\n public static makeFromTransform(parent: DataFlowNode, imputeTransform: ImputeTransform): ImputeNode {\n return new ImputeNode(parent, imputeTransform);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) {\n const encoding = model.encoding;\n const xDef = encoding.x;\n const yDef = encoding.y;\n\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined;\n if (imputedChannel === undefined) {\n return undefined;\n }\n const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined;\n const {method, value, frame, keyvals} = imputedChannel.impute;\n const groupbyFields = pathGroupingFields(model.mark, encoding);\n\n return new ImputeNode(parent, {\n impute: imputedChannel.field,\n key: keyChannel.field,\n ...(method ? {method} : {}),\n ...(value !== undefined ? {value} : {}),\n ...(frame ? {frame} : {}),\n ...(keyvals !== undefined ? {keyvals} : {}),\n ...(groupbyFields.length ? {groupby: groupbyFields} : {})\n });\n }\n return null;\n }\n\n public hash() {\n return `Impute ${hash(this.transform)}`;\n }\n\n public assemble() {\n const {impute, key, keyvals, method, groupby, value, frame = [null, null] as [null, null]} = this.transform;\n\n const imputeTransform: VgImputeTransform = {\n type: 'impute',\n field: impute,\n key,\n ...(keyvals ? {keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals} : {}),\n method: 'value',\n ...(groupby ? {groupby} : {}),\n value: !method || method === 'value' ? value : null\n };\n\n if (method && method !== 'value') {\n const deriveNewField: VgWindowTransform = {\n type: 'window',\n as: [`imputed_${impute}_value`],\n ops: [method],\n fields: [impute],\n frame,\n ignorePeers: false,\n ...(groupby ? {groupby} : {})\n };\n const replaceOriginal: VgFormulaTransform = {\n type: 'formula',\n expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`,\n as: impute\n };\n return [imputeTransform, deriveNewField, replaceOriginal];\n } else {\n return [imputeTransform];\n }\n }\n}\n","import {LoessTransform as VgLoessTransform} from 'vega';\nimport {LoessTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for loess transform nodes\n */\nexport class LoessTransformNode extends DataFlowNode {\n public clone() {\n return new LoessTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: LoessTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.loess];\n }\n\n public dependentFields() {\n return new Set([this.transform.loess, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `LoessTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgLoessTransform {\n const {loess, on, ...rest} = this.transform;\n const result: VgLoessTransform = {\n type: 'loess',\n x: on,\n y: loess,\n ...rest\n };\n return result;\n }\n}\n","import {LookupTransform as VgLookupTransform} from 'vega';\nimport {array, isString} from 'vega-util';\nimport * as log from '../../log';\nimport {isLookupData, isLookupSelection, LookupTransform} from '../../transform';\nimport {duplicate, hash, varName} from '../../util';\nimport {Model} from '../model';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {findSource} from './parse';\nimport {SourceNode} from './source';\nimport {DataSourceType} from '../../data';\n\nexport class LookupNode extends DataFlowNode {\n public clone() {\n return new LookupNode(null, duplicate(this.transform), this.secondary);\n }\n\n constructor(parent: DataFlowNode, public readonly transform: LookupTransform, public readonly secondary: string) {\n super(parent);\n }\n\n public static make(parent: DataFlowNode, model: Model, transform: LookupTransform, counter: number) {\n const sources = model.component.data.sources;\n const {from} = transform;\n let fromOutputNode = null;\n\n if (isLookupData(from)) {\n let fromSource = findSource(from.data, sources);\n\n if (!fromSource) {\n fromSource = new SourceNode(from.data);\n sources.push(fromSource);\n }\n\n const fromOutputName = model.getName(`lookup_${counter}`);\n fromOutputNode = new OutputNode(\n fromSource,\n fromOutputName,\n DataSourceType.Lookup,\n model.component.data.outputNodeRefCounts\n );\n model.component.data.outputNodes[fromOutputName] = fromOutputNode;\n } else if (isLookupSelection(from)) {\n const selName = from.selection;\n transform = {as: selName, ...transform};\n fromOutputNode = model.getSelectionComponent(varName(selName), selName).materialized;\n if (!fromOutputNode) {\n throw new Error(log.message.noSameUnitLookup(selName));\n }\n }\n\n return new LookupNode(parent, transform, fromOutputNode.getSource());\n }\n\n public dependentFields() {\n return new Set([this.transform.lookup]);\n }\n\n public producedFields() {\n return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields);\n }\n\n public hash() {\n return `Lookup ${hash({transform: this.transform, secondary: this.secondary})}`;\n }\n\n public assemble(): VgLookupTransform {\n let foreign: Partial;\n\n if (this.transform.from.fields) {\n // lookup a few fields and add create a flat output\n foreign = {\n values: this.transform.from.fields,\n ...(this.transform.as ? {as: array(this.transform.as)} : {})\n };\n } else {\n // lookup full record and nest it\n let asName = this.transform.as;\n if (!isString(asName)) {\n log.warn(log.message.NO_FIELDS_NEEDS_AS);\n asName = '_lookup';\n }\n\n foreign = {\n as: [asName]\n };\n }\n\n return {\n type: 'lookup',\n from: this.secondary,\n key: this.transform.from.key,\n fields: [this.transform.lookup],\n ...foreign,\n ...(this.transform.default ? {default: this.transform.default} : {})\n };\n }\n}\n","import {QuantileTransform as VgQuantileTransform} from 'vega';\nimport {QuantileTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for quantile transform nodes\n */\nexport class QuantileTransformNode extends DataFlowNode {\n public clone() {\n return new QuantileTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: QuantileTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'prob', specifiedAs[1] ?? 'value'];\n }\n\n public dependentFields() {\n return new Set([this.transform.quantile, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `QuantileTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgQuantileTransform {\n const {quantile, ...rest} = this.transform;\n const result: VgQuantileTransform = {\n type: 'quantile',\n field: quantile,\n ...rest\n };\n return result;\n }\n}\n","import {RegressionTransform as VgRegressionTransform} from 'vega';\nimport {RegressionTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for regression transform nodes\n */\nexport class RegressionTransformNode extends DataFlowNode {\n public clone() {\n return new RegressionTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: RegressionTransform) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.regression];\n }\n\n public dependentFields() {\n return new Set([this.transform.regression, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `RegressionTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgRegressionTransform {\n const {regression, on, ...rest} = this.transform;\n const result: VgRegressionTransform = {\n type: 'regression',\n x: on,\n y: regression,\n ...rest\n };\n return result;\n }\n}\n","import {PivotTransform} from '../../transform';\nimport {duplicate, hash, unique} from '../../util';\nimport {PivotTransform as VgPivotTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for pivot transform nodes.\n */\nexport class PivotTransformNode extends DataFlowNode {\n public clone() {\n return new PivotTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: PivotTransform) {\n super(parent);\n }\n\n public addDimensions(fields: readonly string[]) {\n this.transform.groupby = unique((this.transform.groupby ?? []).concat(fields), d => d);\n }\n\n public producedFields(): undefined {\n return undefined; // return undefined so that potentially everything can depend on the pivot\n }\n\n public dependentFields() {\n return new Set([this.transform.pivot, this.transform.value, ...(this.transform.groupby ?? [])]);\n }\n\n public hash() {\n return `PivotTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgPivotTransform {\n const {pivot, value, groupby, limit, op} = this.transform;\n return {\n type: 'pivot',\n field: pivot,\n value,\n ...(limit !== undefined ? {limit} : {}),\n ...(op !== undefined ? {op} : {}),\n ...(groupby !== undefined ? {groupby} : {})\n };\n }\n}\n","import {SampleTransform as VgSampleTransform} from 'vega';\nimport {SampleTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the sample transform nodes\n */\nexport class SampleTransformNode extends DataFlowNode {\n public clone() {\n return new SampleTransformNode(null, duplicate(this.transform));\n }\n\n constructor(parent: DataFlowNode, private transform: SampleTransform) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n return `SampleTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgSampleTransform {\n return {\n type: 'sample',\n size: this.transform.sample\n };\n }\n}\n","import {InlineDataset, isUrlData} from '../../data';\nimport {Dict} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {DataComponent} from './';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {CalculateNode} from './calculate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {DensityTransformNode} from './density';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {FilterInvalidNode} from './filterinvalid';\nimport {FlattenTransformNode} from './flatten';\nimport {FoldTransformNode} from './fold';\nimport {ParseNode} from './formatparse';\nimport {GeoJSONNode} from './geojson';\nimport {GeoPointNode} from './geopoint';\nimport {GraticuleNode} from './graticule';\nimport {IdentifierNode} from './identifier';\nimport {ImputeNode} from './impute';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {LoessTransformNode} from './loess';\nimport {LookupNode} from './lookup';\nimport {QuantileTransformNode} from './quantile';\nimport {RegressionTransformNode} from './regression';\nimport {PivotTransformNode} from './pivot';\nimport {SampleTransformNode} from './sample';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nfunction makeWalkTree(data: VgData[]) {\n // to name datasources\n let datasetIndex = 0;\n\n /**\n * Recursively walk down the tree.\n */\n function walkTree(node: DataFlowNode, dataSource: VgData) {\n if (node instanceof SourceNode) {\n // If the source is a named data source or a data source with values, we need\n // to put it in a different data source. Otherwise, Vega may override the data.\n if (!node.isGenerator && !isUrlData(node.data)) {\n data.push(dataSource);\n const newData: VgData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n\n if (node instanceof ParseNode) {\n if (node.parent instanceof SourceNode && !dataSource.source) {\n // If node's parent is a root source and the data source does not refer to another data source, use normal format parse\n dataSource.format = {\n ...(dataSource.format ?? {}),\n parse: node.assembleFormatParse()\n };\n\n // add calculates for all nested fields\n dataSource.transform.push(...node.assembleTransforms(true));\n } else {\n // Otherwise use Vega expression to parse\n dataSource.transform.push(...node.assembleTransforms());\n }\n }\n\n if (node instanceof FacetNode) {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n node.data = dataSource.name;\n } else {\n node.data = dataSource.source;\n }\n\n for (const d of node.assemble()) {\n data.push(d);\n }\n\n // break here because the rest of the tree has to be taken care of by the facet.\n return;\n }\n\n if (\n node instanceof GraticuleNode ||\n node instanceof SequenceNode ||\n node instanceof FilterInvalidNode ||\n node instanceof FilterNode ||\n node instanceof CalculateNode ||\n node instanceof GeoPointNode ||\n node instanceof GeoJSONNode ||\n node instanceof AggregateNode ||\n node instanceof LookupNode ||\n node instanceof WindowTransformNode ||\n node instanceof JoinAggregateTransformNode ||\n node instanceof FoldTransformNode ||\n node instanceof FlattenTransformNode ||\n node instanceof DensityTransformNode ||\n node instanceof LoessTransformNode ||\n node instanceof QuantileTransformNode ||\n node instanceof RegressionTransformNode ||\n node instanceof IdentifierNode ||\n node instanceof SampleTransformNode ||\n node instanceof PivotTransformNode\n ) {\n dataSource.transform.push(node.assemble());\n }\n\n if (\n node instanceof BinNode ||\n node instanceof TimeUnitNode ||\n node instanceof ImputeNode ||\n node instanceof StackNode\n ) {\n dataSource.transform.push(...node.assemble());\n }\n\n if (node instanceof OutputNode) {\n if (dataSource.source && dataSource.transform.length === 0) {\n node.setSource(dataSource.source);\n } else if (node.parent instanceof OutputNode) {\n // Note that an output node may be required but we still do not assemble a\n // separate data source for it.\n node.setSource(dataSource.name);\n } else {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n // Here we set the name of the datasource we generated. From now on\n // other assemblers can use it.\n node.setSource(dataSource.name);\n\n // if this node has more than one child, we will add a datasource automatically\n if (node.numChildren() === 1) {\n data.push(dataSource);\n const newData: VgData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n }\n\n switch (node.numChildren()) {\n case 0:\n // done\n if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) {\n // do not push empty datasources that are simply references\n data.push(dataSource);\n }\n break;\n case 1:\n walkTree(node.children[0], dataSource);\n break;\n default: {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n let source = dataSource.name;\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n } else {\n source = dataSource.source;\n }\n\n for (const child of node.children) {\n const newData: VgData = {\n name: null,\n source: source,\n transform: []\n };\n walkTree(child, newData);\n }\n break;\n }\n }\n }\n\n return walkTree;\n}\n\n/**\n * Assemble data sources that are derived from faceted data.\n */\nexport function assembleFacetData(root: FacetNode): VgData[] {\n const data: VgData[] = [];\n const walkTree = makeWalkTree(data);\n\n for (const child of root.children) {\n walkTree(child, {\n source: root.name,\n name: null,\n transform: []\n });\n }\n\n return data;\n}\n\n/**\n * Create Vega data array from a given compiled model and append all of them to the given array\n *\n * @param model\n * @param data array\n * @return modified data array\n */\nexport function assembleRootData(dataComponent: DataComponent, datasets: Dict): VgData[] {\n const data: VgData[] = [];\n\n // dataComponent.sources.forEach(debug);\n // draw(dataComponent.sources);\n\n const walkTree = makeWalkTree(data);\n\n let sourceIndex = 0;\n\n for (const root of dataComponent.sources) {\n // assign a name if the source does not have a name yet\n if (!root.hasName()) {\n root.dataName = `source_${sourceIndex++}`;\n }\n\n const newData: VgData = root.assemble();\n\n walkTree(root, newData);\n }\n\n // remove empty transform arrays for cleaner output\n for (const d of data) {\n if (d.transform.length === 0) {\n delete d.transform;\n }\n }\n\n // move sources without transforms (the ones that are potentially used in lookups) to the beginning\n let whereTo = 0;\n for (const [i, d] of data.entries()) {\n if ((d.transform ?? []).length === 0 && !d.source) {\n data.splice(whereTo++, 0, data.splice(i, 1)[0]);\n }\n }\n\n // now fix the from references in lookup transforms\n for (const d of data) {\n for (const t of d.transform ?? []) {\n if (t.type === 'lookup') {\n t.from = dataComponent.outputNodes[t.from].getSource();\n }\n }\n }\n\n // inline values for datasets that are in the datastore\n for (const d of data) {\n if (d.name in datasets) {\n d.values = datasets[d.name];\n }\n }\n\n return data;\n}\n","import {AxisOrient, SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FacetChannel, FACET_CHANNELS} from '../../channel';\nimport {title as fieldDefTitle} from '../../channeldef';\nimport {contains, getFirstDefined} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {assembleAxis} from '../axis/assemble';\nimport {FacetModel} from '../facet';\nimport {parseGuideResolve} from '../resolve';\nimport {getHeaderProperty} from './common';\nimport {HeaderChannel, HeaderComponent} from './component';\n\nexport function getHeaderType(orient: AxisOrient | SignalRef) {\n if (orient === 'top' || orient === 'left' || isSignalRef(orient)) {\n // we always use header for orient signal since we can't dynamically make header becomes footer\n return 'header';\n }\n return 'footer';\n}\n\nexport function parseFacetHeaders(model: FacetModel) {\n for (const channel of FACET_CHANNELS) {\n parseFacetHeader(model, channel);\n }\n\n mergeChildAxis(model, 'x');\n mergeChildAxis(model, 'y');\n}\n\nfunction parseFacetHeader(model: FacetModel, channel: FacetChannel) {\n const {facet, config, child, component} = model;\n if (model.channelHasField(channel)) {\n const fieldDef = facet[channel];\n const titleConfig = getHeaderProperty('title', null, config, channel);\n let title = fieldDefTitle(fieldDef, config, {\n allowDisabling: true,\n includeDefault: titleConfig === undefined || !!titleConfig\n });\n\n if (child.component.layoutHeaders[channel].title) {\n // TODO: better handle multiline titles\n title = isArray(title) ? title.join(', ') : title;\n\n // merge title with child to produce \"Title / Subtitle / Sub-subtitle\"\n title += ' / ' + child.component.layoutHeaders[channel].title;\n child.component.layoutHeaders[channel].title = null;\n }\n\n const labelOrient = getHeaderProperty('labelOrient', fieldDef, config, channel);\n\n const header = fieldDef.header ?? {};\n const labels = getFirstDefined(header.labels, config.header.labels, true);\n const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header';\n\n component.layoutHeaders[channel] = {\n title,\n facetFieldDef: fieldDef,\n [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)]\n };\n }\n}\n\nfunction makeHeaderComponent(model: FacetModel, channel: HeaderChannel, labels: boolean): HeaderComponent {\n const sizeType = channel === 'row' ? 'height' : 'width';\n\n return {\n labels,\n sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined,\n axes: []\n };\n}\n\nfunction mergeChildAxis(model: FacetModel, channel: 'x' | 'y') {\n const {child} = model;\n if (child.component.axes[channel]) {\n const {layoutHeaders, resolve} = model.component;\n resolve.axis[channel] = parseGuideResolve(resolve, channel);\n\n if (resolve.axis[channel] === 'shared') {\n // For shared axis, move the axes to facet's header or footer\n const headerChannel = channel === 'x' ? 'column' : 'row';\n\n const layoutHeader = layoutHeaders[headerChannel];\n for (const axisComponent of child.component.axes[channel]) {\n const headerType = getHeaderType(axisComponent.get('orient'));\n layoutHeader[headerType] = layoutHeader[headerType] ?? [makeHeaderComponent(model, headerChannel, false)];\n\n // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes\n const mainAxis = assembleAxis(axisComponent, 'main', model.config, {header: true});\n if (mainAxis) {\n // LayoutHeader no longer keep track of property precedence, thus let's combine.\n layoutHeader[headerType][0].axes.push(mainAxis);\n }\n axisComponent.mainExtracted = true;\n }\n } else {\n // Otherwise do nothing for independent axes\n }\n }\n}\n","import {getPositionScaleChannel, getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {getViewConfigContinuousSize, getViewConfigDiscreteSize} from '../../config';\nimport {hasDiscreteDomain} from '../../scale';\nimport {isStep} from '../../spec/base';\nimport {isVgRangeStep} from '../../vega.schema';\nimport {ConcatModel} from '../concat';\nimport {Model} from '../model';\nimport {Explicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {getSizeTypeFromLayoutSizeType, LayoutSize, LayoutSizeIndex, LayoutSizeType} from './component';\n\nexport function parseLayerLayoutSize(model: Model) {\n parseChildrenLayoutSize(model);\n\n parseNonUnitLayoutSizeForChannel(model, 'width');\n parseNonUnitLayoutSizeForChannel(model, 'height');\n}\n\nexport const parseRepeatLayoutSize = parseConcatLayoutSize;\n\nexport function parseConcatLayoutSize(model: ConcatModel) {\n parseChildrenLayoutSize(model);\n\n // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth.\n const widthType = model.layout.columns === 1 ? 'width' : 'childWidth';\n\n // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight.\n const heightType = model.layout.columns === undefined ? 'height' : 'childHeight';\n\n parseNonUnitLayoutSizeForChannel(model, widthType);\n parseNonUnitLayoutSizeForChannel(model, heightType);\n}\n\nexport function parseChildrenLayoutSize(model: Model) {\n for (const child of model.children) {\n child.parseLayoutSize();\n }\n}\n\n/**\n * Merge child layout size (width or height).\n */\nfunction parseNonUnitLayoutSizeForChannel(model: Model, layoutSizeType: LayoutSizeType) {\n /*\n * For concat, the parent width or height might not be the same as the children's shared height.\n * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width.\n *\n * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height)\n * while the sizeType represents the properties of the child.\n */\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const resolve = model.component.resolve;\n const layoutSizeCmpt = model.component.layoutSize;\n\n let mergedSize: Explicit;\n // Try to merge layout size\n for (const child of model.children) {\n const childSize = child.component.layoutSize.getWithExplicit(sizeType);\n const scaleResolve = resolve.scale[channel];\n if (scaleResolve === 'independent' && childSize.value === 'step') {\n // Do not merge independent scales with range-step as their size depends\n // on the scale domains, which can be different between scales.\n mergedSize = undefined;\n break;\n }\n\n if (mergedSize) {\n if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) {\n // For independent scale, only merge if all the sizes are the same.\n // If the values are different, abandon the merge!\n mergedSize = undefined;\n break;\n }\n mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, '');\n } else {\n mergedSize = childSize;\n }\n }\n\n if (mergedSize) {\n // If merged, rename size and set size of all children.\n for (const child of model.children) {\n model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType));\n child.component.layoutSize.set(sizeType, 'merged', false);\n }\n layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize);\n } else {\n layoutSizeCmpt.setWithExplicit(layoutSizeType, {\n explicit: false,\n value: undefined\n });\n }\n}\n\nexport function parseUnitLayoutSize(model: UnitModel) {\n const {size, component} = model;\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n\n if (size[sizeType]) {\n const specifiedSize = size[sizeType];\n component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true);\n } else {\n const defaultSize = defaultUnitSize(model, sizeType);\n component.layoutSize.set(sizeType, defaultSize, false);\n }\n }\n}\n\nfunction defaultUnitSize(model: UnitModel, sizeType: 'width' | 'height'): LayoutSize {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const config = model.config;\n const scaleComponent = model.getScaleComponent(channel);\n\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(scaleType)) {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n if (isVgRangeStep(range) || isStep(size)) {\n // For discrete domain with range.step, use dynamic width/height\n return 'step';\n } else {\n return size;\n }\n } else {\n return getViewConfigContinuousSize(config.view, sizeType);\n }\n } else if (model.hasProjection || model.mark === 'arc') {\n // arc should use continuous size by default otherwise the pie is extremely small\n return getViewConfigContinuousSize(config.view, sizeType);\n } else {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n return isStep(size) ? size.step : size;\n }\n}\n","import {AggregateOp, LayoutAlign, NewSignal} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinning} from '../bin';\nimport {COLUMN, ExtendedChannel, FacetChannel, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../channel';\nimport {FieldName, FieldRefOption, initChannelDef, TypedFieldDef, vgField} from '../channeldef';\nimport {Config} from '../config';\nimport {reduce} from '../encoding';\nimport * as log from '../log';\nimport {hasDiscreteDomain} from '../scale';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortField, SortOrder} from '../sort';\nimport {NormalizedFacetSpec} from '../spec';\nimport {EncodingFacetMapping, FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet';\nimport {contains} from '../util';\nimport {isVgRangeStep, VgData, VgLayout, VgMarkGroup} from '../vega.schema';\nimport {buildModel} from './buildmodel';\nimport {assembleFacetData} from './data/assemble';\nimport {sortArrayIndexField} from './data/calculate';\nimport {parseData} from './data/parse';\nimport {assembleLabelTitle} from './header/assemble';\nimport {getHeaderChannel, getHeaderProperty} from './header/common';\nimport {HEADER_CHANNELS, HEADER_TYPES} from './header/component';\nimport {parseFacetHeaders} from './header/parse';\nimport {parseChildrenLayoutSize} from './layoutsize/parse';\nimport {Model, ModelWithField} from './model';\nimport {assembleDomain, getFieldFromDomain} from './scale/domain';\nimport {assembleFacetSignals} from './selection/assemble';\n\nexport function facetSortFieldName(\n fieldDef: FacetFieldDef,\n sort: EncodingSortField,\n opt?: FieldRefOption\n) {\n return vgField(sort, {suffix: `by_${vgField(fieldDef)}`, ...(opt ?? {})});\n}\n\nexport class FacetModel extends ModelWithField {\n public readonly facet: EncodingFacetMapping;\n\n public readonly child: Model;\n\n public readonly children: Model[];\n\n constructor(spec: NormalizedFacetSpec, parent: Model, parentGivenName: string, config: Config) {\n super(spec, 'facet', parent, parentGivenName, config, spec.resolve);\n\n this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config);\n this.children = [this.child];\n\n this.facet = this.initFacet(spec.facet, config);\n }\n\n private initFacet(\n facet: FacetFieldDef | FacetMapping,\n config: Config\n ): EncodingFacetMapping {\n // clone to prevent side effect to the original spec\n if (!isFacetMapping(facet)) {\n return {facet: initChannelDef(facet, 'facet', config) as FacetFieldDef};\n }\n\n return reduce(\n facet,\n (normalizedFacet, fieldDef, channel) => {\n if (!contains([ROW, COLUMN], channel)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, 'facet'));\n return normalizedFacet;\n }\n\n if (fieldDef.field === undefined) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n return normalizedFacet;\n }\n\n // Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.\n normalizedFacet[channel] = initChannelDef(fieldDef, channel, config);\n return normalizedFacet;\n },\n {}\n );\n }\n\n public channelHasField(channel: ExtendedChannel): boolean {\n return !!this.facet[channel];\n }\n\n public fieldDef(channel: ExtendedChannel): TypedFieldDef {\n return this.facet[channel];\n }\n\n public parseData() {\n this.component.data = parseData(this);\n this.child.parseData();\n }\n\n public parseLayoutSize() {\n parseChildrenLayoutSize(this);\n }\n\n public parseSelections() {\n // As a facet has a single child, the selection components are the same.\n // The child maintains its selections to assemble signals, which remain\n // within its unit.\n this.child.parseSelections();\n this.component.selection = this.child.component.selection;\n }\n\n public parseMarkGroup() {\n this.child.parseMarkGroup();\n }\n\n public parseAxesAndHeaders() {\n this.child.parseAxesAndHeaders();\n\n parseFacetHeaders(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.child.assembleSelectionTopLevelSignals(signals);\n }\n\n public assembleSignals(): NewSignal[] {\n this.child.assembleSignals();\n return [];\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.child.assembleSelectionData(data);\n }\n\n private getHeaderLayoutMixins(): VgLayout {\n const layoutMixins: VgLayout = {};\n\n for (const channel of FACET_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const layoutHeaderComponent = this.component.layoutHeaders[channel];\n const headerComponent = layoutHeaderComponent[headerType];\n\n const {facetFieldDef} = layoutHeaderComponent;\n if (facetFieldDef) {\n const titleOrient = getHeaderProperty('titleOrient', facetFieldDef, this.config, channel);\n\n if (contains(['right', 'bottom'], titleOrient)) {\n const headerChannel = getHeaderChannel(channel, titleOrient);\n layoutMixins.titleAnchor = layoutMixins.titleAnchor ?? {};\n layoutMixins.titleAnchor[headerChannel] = 'end';\n }\n }\n\n if (headerComponent?.[0]) {\n // set header/footerBand\n const sizeType = channel === 'row' ? 'height' : 'width';\n const bandType = headerType === 'header' ? 'headerBand' : 'footerBand';\n if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) {\n // If facet child does not have size signal, then apply headerBand\n layoutMixins[bandType] = layoutMixins[bandType] ?? {};\n layoutMixins[bandType][channel] = 0.5;\n }\n\n if (layoutHeaderComponent.title) {\n layoutMixins.offset = layoutMixins.offset ?? {};\n layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10;\n }\n }\n }\n }\n return layoutMixins;\n }\n\n protected assembleDefaultLayout(): VgLayout {\n const {column, row} = this.facet;\n\n const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined;\n\n let align: LayoutAlign = 'all';\n\n // Do not align the cells if the scale corresponding to the direction is indepent.\n // We always align when we facet into both row and column.\n if (!row && this.component.resolve.scale.x === 'independent') {\n align = 'none';\n } else if (!column && this.component.resolve.scale.y === 'independent') {\n align = 'none';\n }\n\n return {\n ...this.getHeaderLayoutMixins(),\n\n ...(columns ? {columns} : {}),\n bounds: 'full',\n align\n };\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales.\n return this.child.assembleLayoutSignals();\n }\n\n private columnDistinctSignal() {\n if (this.parent && this.parent instanceof FacetModel) {\n // For nested facet, we will add columns to group mark instead\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return undefined;\n } else {\n // In facetNode.assemble(), the name is always this.getName('column') + '_layout'.\n const facetLayoutDataName = this.getName('column_domain');\n return {signal: `length(data('${facetLayoutDataName}'))`};\n }\n }\n\n public assembleGroup(signals: NewSignal[]) {\n if (this.parent && this.parent instanceof FacetModel) {\n // Provide number of columns for layout.\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return {\n ...(this.channelHasField('column')\n ? {\n encode: {\n update: {\n // TODO(https://github.com/vega/vega-lite/issues/2759):\n // Correct the signal for facet of concat of facet_column\n columns: {field: vgField(this.facet.column, {prefix: 'distinct'})}\n }\n }\n }\n : {}),\n ...super.assembleGroup(signals)\n };\n }\n return super.assembleGroup(signals);\n }\n\n /**\n * Aggregate cardinality for calculating size\n */\n private getCardinalityAggregateForChild() {\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n\n if (this.child instanceof FacetModel) {\n if (this.child.channelHasField('column')) {\n const field = vgField(this.child.facet.column);\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n }\n } else {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.child.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.child, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n } else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n }\n return {fields, ops, as};\n }\n\n private assembleFacet() {\n const {name, data} = this.component.data.facetRoot;\n const {row, column} = this.facet;\n const {fields, ops, as} = this.getCardinalityAggregateForChild();\n const groupby: string[] = [];\n\n for (const channel of FACET_CHANNELS) {\n const fieldDef = this.facet[channel];\n if (fieldDef) {\n groupby.push(vgField(fieldDef));\n\n const {bin, sort} = fieldDef;\n\n if (isBinning(bin)) {\n groupby.push(vgField(fieldDef, {binSuffix: 'end'}));\n }\n\n if (isSortField(sort)) {\n const {field, op = DEFAULT_SORT_OP} = sort;\n const outputName = facetSortFieldName(fieldDef, sort);\n if (row && column) {\n // For crossed facet, use pre-calculate field as it requires a different groupby\n // For each calculated field, apply max and assign them to the same name as\n // all values of the same group should be the same anyway.\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n } else {\n fields.push(field);\n ops.push(op);\n as.push(outputName);\n }\n } else if (isArray(sort)) {\n const outputName = sortArrayIndexField(fieldDef, channel);\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n }\n }\n }\n\n const cross = !!row && !!column;\n\n return {\n name,\n data,\n groupby,\n ...(cross || fields.length > 0\n ? {\n aggregate: {\n ...(cross ? {cross} : {}),\n ...(fields.length ? {fields, ops, as} : {})\n }\n }\n : {})\n };\n }\n\n private facetSortFields(channel: FacetChannel): string[] {\n const {facet} = this;\n const fieldDef = facet[channel];\n\n if (fieldDef) {\n if (isSortField(fieldDef.sort)) {\n return [facetSortFieldName(fieldDef, fieldDef.sort, {expr: 'datum'})];\n } else if (isArray(fieldDef.sort)) {\n return [sortArrayIndexField(fieldDef, channel, {expr: 'datum'})];\n }\n return [vgField(fieldDef, {expr: 'datum'})];\n }\n return [];\n }\n\n private facetSortOrder(channel: FacetChannel): SortOrder[] {\n const {facet} = this;\n const fieldDef = facet[channel];\n if (fieldDef) {\n const {sort} = fieldDef;\n const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending';\n return [order];\n }\n return [];\n }\n\n private assembleLabelTitle() {\n const {facet, config} = this;\n if (facet.facet) {\n // Facet always uses title to display labels\n return assembleLabelTitle(facet.facet, 'facet', config);\n }\n\n const ORTHOGONAL_ORIENT = {\n row: ['top', 'bottom'],\n column: ['left', 'right']\n };\n\n for (const channel of HEADER_CHANNELS) {\n if (facet[channel]) {\n const labelOrient = getHeaderProperty('labelOrient', facet[channel], config, channel);\n if (contains(ORTHOGONAL_ORIENT[channel], labelOrient)) {\n // Row/Column with orthogonal labelOrient must use title to display labels\n return assembleLabelTitle(facet[channel], channel, config);\n }\n }\n }\n return undefined;\n }\n\n public assembleMarks(): VgMarkGroup[] {\n const {child} = this;\n\n // If we facet by two dimensions, we need to add a cross operator to the aggregation\n // so that we create all groups\n const facetRoot = this.component.data.facetRoot;\n const data = assembleFacetData(facetRoot);\n\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n\n const title = this.assembleLabelTitle() || child.assembleTitle();\n const style = child.assembleGroupStyle();\n\n const markGroup = {\n name: this.getName('cell'),\n type: 'group',\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n from: {\n facet: this.assembleFacet()\n },\n // TODO: move this to after data\n sort: {\n field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(),\n order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat()\n },\n ...(data.length > 0 ? {data: data} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n ...child.assembleGroup(assembleFacetSignals(this, []))\n };\n\n return [markGroup];\n }\n\n protected getMapping() {\n return this.facet;\n }\n}\n","import {AncestorParse, DataComponent} from '.';\nimport {\n Data,\n isGenerator,\n isGraticuleGenerator,\n isInlineData,\n isNamedData,\n isSequenceGenerator,\n isUrlData,\n DataSourceType,\n ParseValue\n} from '../../data';\nimport * as log from '../../log';\nimport {\n isAggregate,\n isBin,\n isCalculate,\n isDensity,\n isFilter,\n isFlatten,\n isFold,\n isImpute,\n isJoinAggregate,\n isLoess,\n isLookup,\n isPivot,\n isQuantile,\n isRegression,\n isSample,\n isStack,\n isTimeUnit,\n isWindow\n} from '../../transform';\nimport {deepEqual, mergeDeep} from '../../util';\nimport {isFacetModel, isLayerModel, isUnitModel, Model} from '../model';\nimport {requiresSelectionId} from '../selection';\nimport {materializeSelections} from '../selection/parse';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {CalculateNode} from './calculate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {DensityTransformNode} from './density';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {FilterInvalidNode} from './filterinvalid';\nimport {FlattenTransformNode} from './flatten';\nimport {FoldTransformNode} from './fold';\nimport {\n getImplicitFromEncoding,\n getImplicitFromFilterTransform,\n getImplicitFromSelection,\n ParseNode\n} from './formatparse';\nimport {GeoJSONNode} from './geojson';\nimport {GeoPointNode} from './geopoint';\nimport {GraticuleNode} from './graticule';\nimport {IdentifierNode} from './identifier';\nimport {ImputeNode} from './impute';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {makeJoinAggregateFromFacet} from './joinaggregatefacet';\nimport {LoessTransformNode} from './loess';\nimport {LookupNode} from './lookup';\nimport {PivotTransformNode} from './pivot';\nimport {QuantileTransformNode} from './quantile';\nimport {RegressionTransformNode} from './regression';\nimport {SampleTransformNode} from './sample';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nexport function findSource(data: Data, sources: SourceNode[]) {\n for (const other of sources) {\n const otherData = other.data;\n\n // if both datasets have a name defined, we cannot merge\n if (data.name && other.hasName() && data.name !== other.dataName) {\n continue;\n }\n\n // feature and mesh are mutually exclusive\n if (data['format']?.mesh && otherData.format?.feature) {\n continue;\n }\n\n // we have to extract the same feature or mesh\n if (\n (data['format']?.feature || otherData.format?.feature) &&\n data['format']?.feature !== otherData.format?.feature\n ) {\n continue;\n }\n if ((data['format']?.mesh || otherData.format?.mesh) && data['format']?.mesh !== otherData.format?.mesh) {\n continue;\n }\n\n if (isInlineData(data) && isInlineData(otherData)) {\n if (deepEqual(data.values, otherData.values)) {\n return other;\n }\n } else if (isUrlData(data) && isUrlData(otherData)) {\n if (data.url === otherData.url) {\n return other;\n }\n } else if (isNamedData(data)) {\n if (data.name === other.dataName) {\n return other;\n }\n }\n }\n return null;\n}\n\nfunction parseRoot(model: Model, sources: SourceNode[]): DataFlowNode {\n if (model.data || !model.parent) {\n // if the model defines a data source or is the root, create a source node\n\n if (model.data === null) {\n // data: null means we should ignore the parent's data so we just create a new data source\n const source = new SourceNode({values: []});\n sources.push(source);\n return source;\n }\n\n const existingSource = findSource(model.data, sources);\n\n if (existingSource) {\n if (!isGenerator(model.data)) {\n existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format);\n }\n\n // if the new source has a name but the existing one does not, we can set it\n if (!existingSource.hasName() && model.data.name) {\n existingSource.dataName = model.data.name;\n }\n\n return existingSource;\n } else {\n const source = new SourceNode(model.data);\n sources.push(source);\n return source;\n }\n } else {\n // If we don't have a source defined (overriding parent's data), use the parent's facet root or main.\n return model.parent.component.data.facetRoot\n ? model.parent.component.data.facetRoot\n : model.parent.component.data.main;\n }\n}\n\n/**\n * Parses a transform array into a chain of connected dataflow nodes.\n */\nexport function parseTransformArray(head: DataFlowNode, model: Model, ancestorParse: AncestorParse): DataFlowNode {\n let lookupCounter = 0;\n\n for (const t of model.transforms) {\n let derivedType: ParseValue = undefined;\n let transformNode: DataFlowNode;\n\n if (isCalculate(t)) {\n transformNode = head = new CalculateNode(head, t);\n derivedType = 'derived';\n } else if (isFilter(t)) {\n const implicit = getImplicitFromFilterTransform(t);\n transformNode = head = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse) ?? head;\n\n head = new FilterNode(head, model, t.filter);\n } else if (isBin(t)) {\n transformNode = head = BinNode.makeFromTransform(head, t, model);\n derivedType = 'number';\n } else if (isTimeUnit(t)) {\n derivedType = 'date';\n const parsedAs = ancestorParse.getWithExplicit(t.field);\n // Create parse node because the input to time unit is always date.\n if (parsedAs.value === undefined) {\n head = new ParseNode(head, {[t.field]: derivedType});\n ancestorParse.set(t.field, derivedType, false);\n }\n transformNode = head = TimeUnitNode.makeFromTransform(head, t);\n } else if (isAggregate(t)) {\n transformNode = head = AggregateNode.makeFromTransform(head, t);\n derivedType = 'number';\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n } else if (isLookup(t)) {\n transformNode = head = LookupNode.make(head, model, t, lookupCounter++);\n derivedType = 'derived';\n } else if (isWindow(t)) {\n transformNode = head = new WindowTransformNode(head, t);\n derivedType = 'number';\n } else if (isJoinAggregate(t)) {\n transformNode = head = new JoinAggregateTransformNode(head, t);\n derivedType = 'number';\n } else if (isStack(t)) {\n transformNode = head = StackNode.makeFromTransform(head, t);\n derivedType = 'derived';\n } else if (isFold(t)) {\n transformNode = head = new FoldTransformNode(head, t);\n derivedType = 'derived';\n } else if (isFlatten(t)) {\n transformNode = head = new FlattenTransformNode(head, t);\n derivedType = 'derived';\n } else if (isPivot(t)) {\n transformNode = head = new PivotTransformNode(head, t);\n derivedType = 'derived';\n } else if (isSample(t)) {\n head = new SampleTransformNode(head, t);\n } else if (isImpute(t)) {\n transformNode = head = ImputeNode.makeFromTransform(head, t);\n derivedType = 'derived';\n } else if (isDensity(t)) {\n transformNode = head = new DensityTransformNode(head, t);\n derivedType = 'derived';\n } else if (isQuantile(t)) {\n transformNode = head = new QuantileTransformNode(head, t);\n derivedType = 'derived';\n } else if (isRegression(t)) {\n transformNode = head = new RegressionTransformNode(head, t);\n derivedType = 'derived';\n } else if (isLoess(t)) {\n transformNode = head = new LoessTransformNode(head, t);\n derivedType = 'derived';\n } else {\n log.warn(log.message.invalidTransformIgnored(t));\n continue;\n }\n\n if (transformNode && derivedType !== undefined) {\n for (const field of transformNode.producedFields() ?? []) {\n ancestorParse.set(field, derivedType, false);\n }\n }\n }\n\n return head;\n}\n\n/*\nDescription of the dataflow (http://asciiflow.com/):\n +--------+\n | Source |\n +---+----+\n |\n v\n FormatParse\n (explicit)\n |\n v\n Transforms\n(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...)\n |\n v\n FormatParse\n (implicit)\n |\n v\n Binning (in `encoding`)\n |\n v\n Timeunit (in `encoding`)\n |\n v\nFormula From Sort Array\n |\n v\n +--+--+\n | Raw |\n +-----+\n |\n v\n Aggregate (in `encoding`)\n |\n v\n Stack (in `encoding`)\n |\n v\n Invalid Filter\n |\n v\n +----------+\n | Main |\n +----------+\n |\n v\n +-------+\n | Facet |----> \"column\", \"column-layout\", and \"row\"\n +-------+\n |\n v\n ...Child data...\n*/\n\nexport function parseData(model: Model): DataComponent {\n let head = parseRoot(model, model.component.data.sources);\n\n const {outputNodes, outputNodeRefCounts} = model.component.data;\n const ancestorParse = model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse();\n const data = model.data;\n\n if (isGenerator(data)) {\n // insert generator transform\n if (isSequenceGenerator(data)) {\n head = new SequenceNode(head, data.sequence);\n } else if (isGraticuleGenerator(data)) {\n head = new GraticuleNode(head, data.graticule);\n }\n // no parsing necessary for generator\n ancestorParse.parseNothing = true;\n } else if (data?.format?.parse === null) {\n // format.parse: null means disable parsing\n ancestorParse.parseNothing = true;\n }\n\n head = ParseNode.makeExplicit(head, model, ancestorParse) ?? head;\n\n // Default discrete selections require an identifer transform to\n // uniquely identify data points. Add this transform at the head of\n // the pipeline such that the identifier field is available for all\n // subsequent datasets. During optimization, we will remove this\n // transform if it proves to be unnecessary. Additional identifier\n // transforms will be necessary when new tuples are constructed\n // (e.g., post-aggregation).\n head = new IdentifierNode(head);\n\n // HACK: This is equivalent for merging bin extent for union scale.\n // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale\n const parentIsLayer = model.parent && isLayerModel(model.parent);\n if (isUnitModel(model) || isFacetModel(model)) {\n if (parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n }\n\n if (model.transforms.length > 0) {\n head = parseTransformArray(head, model, ancestorParse);\n }\n\n // create parse nodes for fields that need to be parsed (or flattened) implicitly\n const implicitSelection = getImplicitFromSelection(model);\n const implicitEncoding = getImplicitFromEncoding(model);\n head = ParseNode.makeWithAncestors(head, {}, {...implicitSelection, ...implicitEncoding}, ancestorParse) ?? head;\n\n if (isUnitModel(model)) {\n head = GeoJSONNode.parseAll(head, model);\n head = GeoPointNode.parseAll(head, model);\n }\n\n if (isUnitModel(model) || isFacetModel(model)) {\n if (!parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n\n head = TimeUnitNode.makeFromEncoding(head, model) ?? head;\n head = CalculateNode.parseAllForSortIndex(head, model);\n }\n\n // add an output node pre aggregation\n const rawName = model.getDataName(DataSourceType.Raw);\n const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts);\n outputNodes[rawName] = raw;\n head = raw;\n\n if (isUnitModel(model)) {\n const agg = AggregateNode.makeFromEncoding(head, model);\n if (agg) {\n head = agg;\n\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n }\n head = ImputeNode.makeFromEncoding(head, model) ?? head;\n head = StackNode.makeFromEncoding(head, model) ?? head;\n }\n\n if (isUnitModel(model)) {\n head = FilterInvalidNode.make(head, model) ?? head;\n }\n\n // output node for marks\n const mainName = model.getDataName(DataSourceType.Main);\n const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts);\n outputNodes[mainName] = main;\n head = main;\n\n if (isUnitModel(model)) {\n materializeSelections(model, main);\n }\n\n // add facet marker\n let facetRoot = null;\n if (isFacetModel(model)) {\n const facetName = model.getName('facet');\n\n // Derive new aggregate for facet's sort field\n // augment data source with new fields for crossed facet\n head = makeJoinAggregateFromFacet(head, model.facet) ?? head;\n\n facetRoot = new FacetNode(head, model, facetName, main.getSource());\n outputNodes[facetName] = facetRoot;\n }\n\n return {\n ...model.component.data,\n outputNodes,\n outputNodeRefCounts,\n raw,\n main,\n facetRoot,\n ancestorParse\n };\n}\n","import {vgField} from '../../channeldef';\nimport {DEFAULT_SORT_OP, isSortField} from '../../sort';\nimport {FacetMapping} from '../../spec/facet';\nimport {facetSortFieldName} from '../facet';\nimport {DataFlowNode} from './dataflow';\nimport {JoinAggregateTransformNode} from './joinaggregate';\n\nexport function makeJoinAggregateFromFacet(\n parent: DataFlowNode,\n facet: FacetMapping\n): JoinAggregateTransformNode {\n const {row, column} = facet;\n if (row && column) {\n let newParent = null;\n // only need to make one for crossed facet\n for (const fieldDef of [row, column]) {\n if (isSortField(fieldDef.sort)) {\n const {field, op = DEFAULT_SORT_OP} = fieldDef.sort;\n parent = newParent = new JoinAggregateTransformNode(parent, {\n joinaggregate: [\n {\n op,\n field,\n as: facetSortFieldName(fieldDef, fieldDef.sort, {forAs: true})\n }\n ],\n groupby: [vgField(fieldDef)]\n });\n }\n }\n return newParent;\n }\n return null;\n}\n","import {NewSignal} from 'vega';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isHConcatSpec, isVConcatSpec, NormalizedConcatSpec, NormalizedSpec} from '../spec';\nimport {VgLayout} from '../vega.schema';\nimport {keys} from '../util';\nimport {VgData} from '../vega.schema';\nimport {buildModel} from './buildmodel';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {parseConcatLayoutSize} from './layoutsize/parse';\nimport {Model} from './model';\n\nexport class ConcatModel extends Model {\n public readonly children: Model[];\n\n constructor(spec: NormalizedConcatSpec, parent: Model, parentGivenName: string, config: Config) {\n super(spec, 'concat', parent, parentGivenName, config, spec.resolve);\n\n if (spec.resolve?.axis?.x === 'shared' || spec.resolve?.axis?.y === 'shared') {\n log.warn(log.message.CONCAT_CANNOT_SHARE_AXIS);\n }\n\n this.children = this.getChildren(spec).map((child, i) => {\n return buildModel(child, this, this.getName('concat_' + i), undefined, config);\n });\n }\n\n public parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n\n public parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n\n public parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n\n public parseAxesAndHeaders() {\n for (const child of this.children) {\n child.parseAxesAndHeaders();\n }\n\n // TODO(#2415): support shared axes\n }\n\n private getChildren(spec: NormalizedConcatSpec): NormalizedSpec[] {\n if (isVConcatSpec(spec)) {\n return spec.vconcat;\n } else if (isHConcatSpec(spec)) {\n return spec.hconcat;\n }\n return spec.concat;\n }\n\n public parseLayoutSize() {\n parseConcatLayoutSize(this);\n }\n\n public parseAxisGroup(): void {\n return null;\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n\n public assembleSignals(): NewSignal[] {\n this.children.forEach(child => child.assembleSignals());\n return [];\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n const layoutSignals = assembleLayoutSignals(this);\n\n for (const child of this.children) {\n layoutSignals.push(...child.assembleLayoutSignals());\n }\n\n return layoutSignals;\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n\n public assembleMarks(): any[] {\n // only children have marks\n return this.children.map(child => {\n const title = child.assembleTitle();\n const style = child.assembleGroupStyle();\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n\n return {\n type: 'group',\n name: child.getName('group'),\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n ...child.assembleGroup()\n };\n });\n }\n\n protected assembleDefaultLayout(): VgLayout {\n const columns = this.layout.columns;\n return {\n ...(columns != null ? {columns: columns} : {}),\n bounds: 'full',\n // Use align each so it can work with multiple plots with different size\n align: 'each'\n };\n }\n}\n","import {Axis as VgAxis, SignalRef, Text} from 'vega';\nimport {\n Axis,\n AxisPart,\n AxisPropsWithConditionAndSignal,\n COMMON_AXIS_PROPERTIES_INDEX,\n ConditionalAxisProp,\n SignalAxisProp\n} from '../../axis';\nimport {FieldDefBase} from '../../channeldef';\nimport {duplicate, Flag, keys} from '../../util';\nimport {Split} from '../split';\nimport {isSignalRef} from '../../vega.schema';\n\nfunction isFalseOrNull(v: any) {\n return v === false || v === null;\n}\n\nexport type AxisComponentProps = Omit &\n Omit & {\n title: Text | FieldDefBase[] | SignalRef;\n labelExpr: string;\n disable: boolean;\n };\n\nconst AXIS_COMPONENT_PROPERTIES_INDEX: Flag = {\n disable: 1,\n gridScale: 1,\n scale: 1,\n ...COMMON_AXIS_PROPERTIES_INDEX,\n labelExpr: 1,\n encode: 1\n};\n\nexport const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX);\n\nexport class AxisComponent extends Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {},\n public mainExtracted = false\n ) {\n super();\n }\n\n public clone() {\n return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted);\n }\n\n public hasAxisPart(part: AxisPart) {\n // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme.\n\n if (part === 'axis') {\n // always has the axis container part\n return true;\n }\n\n if (part === 'grid' || part === 'title') {\n return !!this.get(part);\n }\n // Other parts are enabled by default, so they should not be false or null.\n return !isFalseOrNull(this.get(part));\n }\n\n public hasOrientSignalRef() {\n return isSignalRef(this.explicit.orient);\n }\n}\n\nexport interface AxisComponentIndex {\n x?: AxisComponent[];\n y?: AxisComponent[];\n}\n\nexport interface AxisIndex {\n x?: Axis;\n y?: Axis;\n}\n","import {AxisEncode as VgAxisEncode, AxisOrient} from 'vega';\nimport {Axis, AXIS_PARTS, isAxisProperty, isConditionalAxisValue} from '../../axis';\nimport {PositionScaleChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {getFieldOrDatumDef, PositionDatumDef, PositionFieldDef} from '../../channeldef';\nimport {getFirstDefined, isEmpty, keys, normalizeAngle} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {mergeTitleComponent} from '../common';\nimport {guideEncodeEntry} from '../guide';\nimport {LayerModel} from '../layer';\nimport {parseGuideResolve} from '../resolve';\nimport {defaultTieBreaker, Explicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {AxisComponent, AxisComponentIndex, AxisComponentProps, AXIS_COMPONENT_PROPERTIES} from './component';\nimport {getAxisConfig, getAxisConfigs} from './config';\nimport * as encode from './encode';\nimport {AxisRuleParams, axisRules, defaultOrient, getFieldDefTitle, getLabelAngle} from './properties';\n\nexport function parseUnitAxes(model: UnitModel): AxisComponentIndex {\n return POSITION_SCALE_CHANNELS.reduce((axis, channel) => {\n if (model.component.scales[channel]) {\n axis[channel] = [parseAxis(channel, model)];\n }\n return axis;\n }, {} as AxisComponentIndex);\n}\n\nconst OPPOSITE_ORIENT: Record = {\n bottom: 'top',\n top: 'bottom',\n left: 'right',\n right: 'left'\n};\n\nexport function parseLayerAxes(model: LayerModel) {\n const {axes, resolve} = model.component;\n const axisCount: Record = {top: 0, bottom: 0, right: 0, left: 0};\n\n for (const child of model.children) {\n child.parseAxesAndHeaders();\n\n for (const channel of keys(child.component.axes)) {\n resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel);\n if (resolve.axis[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n\n axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]);\n\n if (!axes[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the axis shared.\n // Thus, mark axis as independent and remove the axis component.\n resolve.axis[channel] = 'independent';\n delete axes[channel];\n }\n }\n }\n }\n\n // Move axes to layer's axis component and merge shared axes\n for (const channel of POSITION_SCALE_CHANNELS) {\n for (const child of model.children) {\n if (!child.component.axes[channel]) {\n // skip if the child does not have a particular axis\n continue;\n }\n\n if (resolve.axis[channel] === 'independent') {\n // If axes are independent, concat the axisComponent array.\n axes[channel] = (axes[channel] ?? []).concat(child.component.axes[channel]);\n\n // Automatically adjust orient\n for (const axisComponent of child.component.axes[channel]) {\n const {value: orient, explicit} = axisComponent.getWithExplicit('orient');\n if (isSignalRef(orient)) {\n continue;\n }\n\n if (axisCount[orient] > 0 && !explicit) {\n // Change axis orient if the number do not match\n const oppositeOrient = OPPOSITE_ORIENT[orient];\n if (axisCount[orient] > axisCount[oppositeOrient]) {\n axisComponent.set('orient', oppositeOrient, false);\n }\n }\n axisCount[orient]++;\n\n // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset?\n }\n }\n\n // After merging, make sure to remove axes from child\n delete child.component.axes[channel];\n }\n\n // Suppress grid lines for dual axis charts (https://github.com/vega/vega-lite/issues/4676)\n if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) {\n for (const axisCmpt of axes[channel]) {\n if (!!axisCmpt.get('grid') && !axisCmpt.explicit.grid) {\n axisCmpt.implicit.grid = false;\n }\n }\n }\n }\n}\n\nfunction mergeAxisComponents(\n mergedAxisCmpts: AxisComponent[],\n childAxisCmpts: readonly AxisComponent[]\n): AxisComponent[] {\n if (mergedAxisCmpts) {\n // FIXME: this is a bit wrong once we support multiple axes\n if (mergedAxisCmpts.length !== childAxisCmpts.length) {\n return undefined; // Cannot merge axis component with different number of axes.\n }\n const length = mergedAxisCmpts.length;\n for (let i = 0; i < length; i++) {\n const merged = mergedAxisCmpts[i];\n const child = childAxisCmpts[i];\n\n if (!!merged !== !!child) {\n return undefined;\n } else if (merged && child) {\n const mergedOrient = merged.getWithExplicit('orient');\n const childOrient = child.getWithExplicit('orient');\n\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n\n // Cannot merge due to inconsistent orient\n return undefined;\n } else {\n mergedAxisCmpts[i] = mergeAxisComponent(merged, child);\n }\n }\n }\n } else {\n // For first one, return a copy of the child\n return childAxisCmpts.map(axisComponent => axisComponent.clone());\n }\n return mergedAxisCmpts;\n}\n\nfunction mergeAxisComponent(merged: AxisComponent, child: AxisComponent): AxisComponent {\n for (const prop of AXIS_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(\n merged.getWithExplicit(prop),\n child.getWithExplicit(prop),\n prop,\n 'axis',\n\n // Tie breaker function\n (v1: Explicit, v2: Explicit) => {\n switch (prop) {\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'gridScale':\n return {\n explicit: v1.explicit, // keep the old explicit\n value: getFirstDefined(v1.value, v2.value)\n };\n }\n return defaultTieBreaker(v1, v2, prop, 'axis');\n }\n );\n merged.setWithExplicit(prop, mergedValueWithExplicit);\n }\n return merged;\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isExplicit(\n value: T,\n property: keyof AxisComponentProps,\n axis: Axis,\n model: UnitModel,\n channel: PositionScaleChannel\n) {\n if (property === 'disable') {\n return axis !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit\n }\n\n axis = axis || {};\n\n switch (property) {\n case 'titleAngle':\n case 'labelAngle':\n return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle));\n case 'values':\n return !!axis.values;\n // specified axis.values is already respected, but may get transformed.\n case 'encode':\n // both VL axis.encoding and axis.labelAngle affect VG axis.encode\n return !!axis.encoding || !!axis.labelAngle;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (value === getFieldDefTitle(model, channel)) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === axis[property];\n}\n\n/**\n * Properties to always include values from config\n */\nconst propsToAlwaysIncludeConfig = new Set([\n 'grid', // Grid is an exception because we need to set grid = true to generate another grid axis\n 'translate', // translate has dependent logic for bar's bin position and it's 0.5 by default in Vega. If a config overrides this value, we need to know.\n // the rest are not axis configs in Vega, but are in VL, so we need to set too.\n 'format',\n 'formatType',\n 'orient',\n 'labelExpr',\n 'tickCount',\n 'position',\n 'tickMinStep'\n]);\n\nfunction parseAxis(channel: PositionScaleChannel, model: UnitModel): AxisComponent {\n let axis = model.axis(channel);\n\n const axisComponent = new AxisComponent();\n\n const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]) as\n | PositionFieldDef\n | PositionDatumDef;\n\n const {mark, config} = model;\n\n const orient =\n axis?.orient ||\n config[channel === 'x' ? 'axisX' : 'axisY']?.orient ||\n config.axis?.orient ||\n defaultOrient(channel);\n\n const scaleType = model.getScaleComponent(channel).get('type');\n\n const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config);\n\n const disable =\n axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis?.style, axisConfigs).configValue;\n axisComponent.set('disable', disable, axis !== undefined);\n if (disable) {\n return axisComponent;\n }\n\n axis = axis || {};\n\n const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs);\n\n const ruleParams: AxisRuleParams = {\n fieldOrDatumDef,\n axis,\n channel,\n model,\n scaleType,\n orient,\n labelAngle,\n mark,\n config\n };\n // 1.2. Add properties\n for (const property of AXIS_COMPONENT_PROPERTIES) {\n const value =\n property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined;\n\n const hasValue = value !== undefined;\n\n const explicit = isExplicit(value, property, axis, model, channel);\n\n if (hasValue && explicit) {\n axisComponent.set(property, value, explicit);\n } else {\n const {configValue = undefined, configFrom = undefined} =\n isAxisProperty(property) && property !== 'values'\n ? getAxisConfig(property, config.style, axis.style, axisConfigs)\n : {};\n const hasConfigValue = configValue !== undefined;\n\n if (hasValue && !hasConfigValue) {\n // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config)\n axisComponent.set(property, value, explicit);\n } else if (\n // Cases need implicit values\n // 1. Axis config that aren't available in Vega\n !(configFrom === 'vgAxisConfig') ||\n // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details)\n (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) ||\n // 3. Conditional axis values and signals\n isConditionalAxisValue(configValue) ||\n isSignalRef(configValue)\n ) {\n // If a config is specified and is conditional, copy conditional value from axis config\n axisComponent.set(property, configValue, false);\n }\n }\n }\n\n // 2) Add guide encode definition groups\n const axisEncoding = axis.encoding ?? {};\n const axisEncode = AXIS_PARTS.reduce((e: VgAxisEncode, part) => {\n if (!axisComponent.hasAxisPart(part)) {\n // No need to create encode for a disabled part.\n return e;\n }\n\n const axisEncodingPart = guideEncodeEntry(axisEncoding[part] ?? {}, model);\n\n const value = part === 'labels' ? encode.labels(model, channel, axisEncodingPart) : axisEncodingPart;\n\n if (value !== undefined && !isEmpty(value)) {\n e[part] = {update: value};\n }\n return e;\n }, {} as VgAxisEncode);\n\n // FIXME: By having encode as one property, we won't have fine grained encode merging.\n if (!isEmpty(axisEncode)) {\n axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined);\n }\n\n return axisComponent;\n}\n","import {getSecondaryRangeChannel, PositionScaleChannel} from '../../channel';\nimport {getFieldOrDatumDef} from '../../channeldef';\nimport {formatCustomType, isCustomFormatType} from '../format';\nimport {UnitModel} from '../unit';\n\nexport function labels(model: UnitModel, channel: PositionScaleChannel, specifiedLabelsSpec: any) {\n const {encoding, config} = model;\n\n const fieldOrDatumDef =\n getFieldOrDatumDef(encoding[channel]) ?? getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]);\n const axis = model.axis(channel) || {};\n const {format, formatType} = axis;\n\n if (isCustomFormatType(formatType)) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n\n return specifiedLabelsSpec;\n}\n","import {Orientation} from 'vega';\nimport {isBinned, isBinning} from '../../bin';\nimport {isContinuousFieldOrDatumDef, isFieldDef, isNumericDataDef, TypedFieldDef} from '../../channeldef';\nimport {Config} from '../../config';\nimport {Encoding, isAggregate} from '../../encoding';\nimport * as log from '../../log';\nimport {\n AREA,\n BAR,\n BAR_CORNER_RADIUS_INDEX as BAR_CORNER_RADIUS_END_INDEX,\n CIRCLE,\n IMAGE,\n LINE,\n Mark,\n MarkDef,\n POINT,\n RECT,\n RULE,\n SQUARE,\n TEXT,\n TICK\n} from '../../mark';\nimport {QUANTITATIVE, TEMPORAL} from '../../type';\nimport {contains, getFirstDefined} from '../../util';\nimport {getMarkConfig, getMarkPropOrConfig} from '../common';\n\nexport function initMarkdef(markDef: MarkDef, encoding: Encoding, config: Config) {\n // set orient, which can be overridden by rules as sometimes the specified orient is invalid.\n const specifiedOrient = getMarkPropOrConfig('orient', markDef, config);\n markDef.orient = orient(markDef.type, encoding, specifiedOrient);\n if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) {\n log.warn(log.message.orientOverridden(markDef.orient, specifiedOrient));\n }\n\n if (markDef.type === 'bar' && markDef.orient) {\n const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config);\n if (cornerRadiusEnd !== undefined) {\n const newProps =\n (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2)\n ? ['cornerRadius']\n : BAR_CORNER_RADIUS_END_INDEX[markDef.orient];\n\n for (const newProp of newProps) {\n markDef[newProp] = cornerRadiusEnd;\n }\n\n if (markDef.cornerRadiusEnd !== undefined) {\n delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius\n }\n }\n }\n\n // set opacity and filled if not specified in mark config\n const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config);\n if (specifiedOpacity === undefined) {\n markDef.opacity = opacity(markDef.type, encoding);\n }\n\n // set cursor, which should be pointer if href channel is present unless otherwise specified\n const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config);\n if (specifiedCursor === undefined) {\n markDef.cursor = cursor(markDef, encoding, config);\n }\n\n return markDef;\n}\n\nfunction cursor(markDef: MarkDef, encoding: Encoding, config: Config) {\n if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) {\n return 'pointer';\n }\n return markDef.cursor;\n}\n\nfunction opacity(mark: Mark, encoding: Encoding) {\n if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) {\n // point-based marks\n if (!isAggregate(encoding)) {\n return 0.7;\n }\n }\n return undefined;\n}\n\nexport function defaultFilled(markDef: MarkDef, config: Config, {graticule}: {graticule: boolean}) {\n if (graticule) {\n return false;\n }\n const filledConfig = getMarkConfig('filled', markDef, config);\n const mark = markDef.type;\n return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE);\n}\n\nfunction orient(mark: Mark, encoding: Encoding, specifiedOrient: Orientation): Orientation {\n switch (mark) {\n case POINT:\n case CIRCLE:\n case SQUARE:\n case TEXT:\n case RECT:\n case IMAGE:\n // orient is meaningless for these marks.\n return undefined;\n }\n\n const {x, y, x2, y2} = encoding;\n\n switch (mark) {\n case BAR:\n if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) {\n return 'vertical';\n }\n if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) {\n return 'horizontal';\n }\n if (y2 || x2) {\n // Ranged bar does not always have clear orientation, so we allow overriding\n if (specifiedOrient) {\n return specifiedOrient;\n }\n\n // If y is range and x is non-range, non-bin Q, y is likely a prebinned field\n if (!x2) {\n if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) {\n return 'horizontal';\n }\n }\n\n // If x is range and y is non-range, non-bin Q, x is likely a prebinned field\n if (!y2) {\n if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) {\n return 'vertical';\n }\n }\n }\n\n // falls through\n case RULE:\n // return undefined for line segment rule and bar with both axis ranged\n // we have to ignore the case that the data are already binned\n if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) {\n return undefined;\n }\n\n // falls through\n case AREA:\n // If there are range for both x and y, y (vertical) has higher precedence.\n if (y2) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n } else {\n return 'vertical';\n }\n } else if (x2) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n } else {\n return 'horizontal';\n }\n } else if (mark === RULE) {\n if (x && !y) {\n return 'vertical';\n } else if (y && !x) {\n return 'horizontal';\n }\n }\n\n // falls through\n case LINE:\n case TICK: {\n // Tick is opposite to bar, line, area and never have ranged mark.\n const xIsContinuous = isContinuousFieldOrDatumDef(x);\n const yIsContinuous = isContinuousFieldOrDatumDef(y);\n if (xIsContinuous && !yIsContinuous) {\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n } else if (!xIsContinuous && yIsContinuous) {\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n } else if (xIsContinuous && yIsContinuous) {\n const xDef = x as TypedFieldDef; // we can cast here since they are surely fieldDef\n const yDef = y as TypedFieldDef;\n\n const xIsTemporal = xDef.type === TEMPORAL;\n const yIsTemporal = yDef.type === TEMPORAL;\n\n // temporal without timeUnit is considered continuous, but better serves as dimension\n if (xIsTemporal && !yIsTemporal) {\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n } else if (!xIsTemporal && yIsTemporal) {\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n }\n\n if (!xDef.aggregate && yDef.aggregate) {\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n } else if (xDef.aggregate && !yDef.aggregate) {\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n }\n\n if (specifiedOrient) {\n // When ambiguous, use user specified one.\n return specifiedOrient;\n }\n\n return 'vertical';\n } else {\n // Discrete x Discrete case\n if (specifiedOrient) {\n // When ambiguous, use user specified one.\n return specifiedOrient;\n }\n\n return undefined;\n }\n }\n }\n return 'vertical';\n}\n","import {Config} from '../../config';\nimport {VgEncodeEntry} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nfunction encodeEntry(model: UnitModel, fixedShape?: 'circle' | 'square') {\n const {config} = model;\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model),\n ...encode.nonPosition('angle', model),\n ...shapeMixins(model, config, fixedShape)\n };\n}\n\nexport function shapeMixins(model: UnitModel, config: Config, fixedShape?: 'circle' | 'square'): VgEncodeEntry {\n if (fixedShape) {\n return {shape: {value: fixedShape}};\n }\n return encode.nonPosition('shape', model);\n}\n\nexport const point: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model);\n }\n};\n\nexport const circle: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model, 'circle');\n }\n};\n\nexport const square: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model, 'square');\n }\n};\n","import {SignalRef} from 'vega';\nimport {isNumber} from 'vega-util';\nimport {getViewConfigDiscreteStep} from '../../config';\nimport {isVgRangeStep} from '../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../common';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const tick: MarkCompiler = {\n vgMark: 'rect',\n\n encodeEntry: (model: UnitModel) => {\n const {config, markDef} = model;\n const orient = markDef.orient;\n\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width';\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n\n ...encode.pointPosition('x', model, {defaultPos: 'mid', vgChannel: 'xc'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid', vgChannel: 'yc'}),\n\n // size / thickness => width / height\n ...encode.nonPosition('size', model, {\n defaultValue: defaultSize(model),\n vgChannel: vgSizeChannel\n }),\n [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config))\n };\n }\n};\n\nfunction defaultSize(model: UnitModel): number | SignalRef {\n const {config, markDef} = model;\n const {orient} = markDef;\n\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y');\n\n const markPropOrConfig =\n getMarkPropOrConfig('size', markDef, config, {vgChannel: vgSizeChannel}) ?? config.tick.bandSize;\n\n if (markPropOrConfig !== undefined) {\n return markPropOrConfig;\n } else {\n const scaleRange = scale ? scale.get('range') : undefined;\n if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return (scaleRange.step * 3) / 4;\n }\n\n const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel);\n\n return (defaultViewStep * 3) / 4;\n }\n}\n","import {isArray} from 'vega-util';\nimport {FieldRefOption, isFieldDef, isValueDef, vgField} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {isAggregate, pathGroupingFields} from '../../encoding';\nimport {AREA, BAR, isPathMark, LINE, Mark, TRAIL} from '../../mark';\nimport {isSortByEncoding, isSortField} from '../../sort';\nimport {contains, getFirstDefined, isNullOrFalse, keys, omit, pick} from '../../util';\nimport {VgCompare, VgEncodeEntry, VG_CORNERRADIUS_CHANNELS} from '../../vega.schema';\nimport {getMarkConfig, getMarkPropOrConfig, getStyles, signalOrValueRef, sortParams} from '../common';\nimport {UnitModel} from '../unit';\nimport {arc} from './arc';\nimport {area} from './area';\nimport {bar} from './bar';\nimport {MarkCompiler} from './base';\nimport {geoshape} from './geoshape';\nimport {image} from './image';\nimport {line, trail} from './line';\nimport {circle, point, square} from './point';\nimport {rect} from './rect';\nimport {rule} from './rule';\nimport {text} from './text';\nimport {tick} from './tick';\n\nconst markCompiler: Record = {\n arc,\n area,\n bar,\n circle,\n geoshape,\n image,\n line,\n point,\n rect,\n rule,\n square,\n text,\n tick,\n trail\n};\n\nexport function parseMarkGroups(model: UnitModel): any[] {\n if (contains([LINE, AREA, TRAIL], model.mark)) {\n const details = pathGroupingFields(model.mark, model.encoding);\n if (details.length > 0) {\n return getPathGroups(model, details);\n }\n // otherwise use standard mark groups\n } else if (contains([BAR], model.mark)) {\n const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop =>\n getMarkPropOrConfig(prop, model.markDef, model.config)\n );\n if (model.stack && !model.fieldDef('size') && hasCornerRadius) {\n return getGroupsForStackedBarWithCornerRadius(model);\n }\n }\n\n return getMarkGroup(model);\n}\n\nconst FACETED_PATH_PREFIX = 'faceted_path_';\n\nfunction getPathGroups(model: UnitModel, details: string[]) {\n // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?)\n\n return [\n {\n name: model.getName('pathgroup'),\n type: 'group',\n from: {\n facet: {\n name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main),\n data: model.requestDataName(DataSourceType.Main),\n groupby: details\n }\n },\n encode: {\n update: {\n width: {field: {group: 'width'}},\n height: {field: {group: 'height'}}\n }\n },\n // With subfacet for line/area group, need to use faceted data from above.\n marks: getMarkGroup(model, {fromPrefix: FACETED_PATH_PREFIX})\n }\n ];\n}\n\nconst STACK_GROUP_PREFIX = 'stack_group_';\n\n/**\n * We need to put stacked bars into groups in order to enable cornerRadius for stacks.\n * If stack is used and the model doesn't have size encoding, we put the mark into groups,\n * and apply cornerRadius properties at the group.\n */\nfunction getGroupsForStackedBarWithCornerRadius(model: UnitModel) {\n // Generate the mark\n const [mark] = getMarkGroup(model, {fromPrefix: STACK_GROUP_PREFIX});\n\n // Get the scale for the stacked field\n const fieldScale = model.scaleName(model.stack.fieldChannel);\n const stackField = (opt: FieldRefOption = {}) => model.vgField(model.stack.fieldChannel, opt);\n // Find the min/max of the pixel value on the stacked direction\n const stackFieldGroup = (func: 'min' | 'max', expr: 'datum' | 'parent') => {\n const vgFieldMinMax = [\n stackField({prefix: 'min', suffix: 'start', expr}),\n stackField({prefix: 'max', suffix: 'start', expr}),\n stackField({prefix: 'min', suffix: 'end', expr}),\n stackField({prefix: 'max', suffix: 'end', expr})\n ];\n return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`;\n };\n\n let groupUpdate: VgEncodeEntry;\n let innerGroupUpdate: VgEncodeEntry;\n\n // Build the encoding for group and an inner group\n if (model.stack.fieldChannel === 'x') {\n // Move cornerRadius, y/yc/y2/height properties to group\n // Group x/x2 should be the min/max of the marks within\n groupUpdate = {\n ...pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS]),\n x: {signal: stackFieldGroup('min', 'datum')},\n x2: {signal: stackFieldGroup('max', 'datum')},\n clip: {value: true}\n };\n // Inner group should revert the x translation, and pass height through\n innerGroupUpdate = {\n x: {field: {group: 'x'}, mult: -1},\n height: {field: {group: 'height'}}\n };\n // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group)\n // This is why size encoding is not supported yet\n mark.encode.update = {\n ...omit(mark.encode.update, ['y', 'yc', 'y2']),\n height: {field: {group: 'height'}}\n };\n } else {\n groupUpdate = {\n ...pick(mark.encode.update, ['x', 'xc', 'x2', 'width']),\n y: {signal: stackFieldGroup('min', 'datum')},\n y2: {signal: stackFieldGroup('max', 'datum')},\n clip: {value: true}\n };\n innerGroupUpdate = {\n y: {field: {group: 'y'}, mult: -1},\n width: {field: {group: 'width'}}\n };\n mark.encode.update = {\n ...omit(mark.encode.update, ['x', 'xc', 'x2']),\n width: {field: {group: 'width'}}\n };\n }\n\n // Deal with cornerRadius properties\n for (const key of VG_CORNERRADIUS_CHANNELS) {\n const configValue = getMarkConfig(key, model.markDef, model.config);\n // Move from mark to group\n if (mark.encode.update[key]) {\n groupUpdate[key] = mark.encode.update[key];\n delete mark.encode.update[key];\n } else if (configValue) {\n groupUpdate[key] = signalOrValueRef(configValue);\n }\n // Overwrite any cornerRadius on mark set by config --- they are already moved to the group\n if (configValue) {\n mark.encode.update[key] = {value: 0};\n }\n }\n\n // For bin and time unit, we have to add bin/timeunit -end channels.\n const groupByField = model.fieldDef(model.stack.groupbyChannel);\n const groupby: string[] = vgField(groupByField) ? [vgField(groupByField)] : [];\n\n if (groupByField?.bin || groupByField?.timeUnit) {\n groupby.push(vgField(groupByField, {binSuffix: 'end'}));\n }\n\n const strokeProperties = [\n 'stroke',\n 'strokeWidth',\n 'strokeJoin',\n 'strokeCap',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeMiterLimit',\n 'strokeOpacity'\n ] as const;\n\n // Generate stroke properties for the group\n groupUpdate = strokeProperties.reduce((encode, prop) => {\n if (mark.encode.update[prop]) {\n return {...encode, [prop]: mark.encode.update[prop]};\n } else {\n const configValue = getMarkConfig(prop, model.markDef, model.config);\n if (configValue !== undefined) {\n return {...encode, [prop]: signalOrValueRef(configValue)};\n } else {\n return encode;\n }\n }\n }, groupUpdate);\n\n // Apply strokeForeground and strokeOffset if stroke is used\n if (groupUpdate.stroke) {\n groupUpdate.strokeForeground = {value: true};\n groupUpdate.strokeOffset = {value: 0};\n }\n\n return [\n {\n type: 'group',\n from: {\n facet: {\n data: model.requestDataName(DataSourceType.Main),\n name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main),\n groupby,\n aggregate: {\n fields: [\n stackField({suffix: 'start'}),\n stackField({suffix: 'start'}),\n stackField({suffix: 'end'}),\n stackField({suffix: 'end'})\n ],\n ops: ['min', 'max', 'min', 'max']\n }\n }\n },\n encode: {\n update: groupUpdate\n },\n marks: [\n {\n type: 'group',\n encode: {update: innerGroupUpdate},\n marks: [mark]\n }\n ]\n }\n ];\n}\n\nexport function getSort(model: UnitModel): VgCompare {\n const {encoding, stack, mark, markDef, config} = model;\n const order = encoding.order;\n if (\n (!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) ||\n (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config)))\n ) {\n return undefined;\n } else if ((isArray(order) || isFieldDef(order)) && !stack) {\n // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.)\n return sortParams(order, {expr: 'datum'});\n } else if (isPathMark(mark)) {\n // For both line and area, we sort values based on dimension by default\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (isFieldDef(dimensionChannelDef)) {\n const s = dimensionChannelDef.sort;\n\n if (isArray(s)) {\n return {\n field: vgField(dimensionChannelDef, {prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum'})\n };\n } else if (isSortField(s)) {\n return {\n field: vgField(\n {\n // FIXME: this op might not already exist?\n // FIXME: what if dimensionChannel (x or y) contains custom domain?\n aggregate: isAggregate(model.encoding) ? s.op : undefined,\n field: s.field\n },\n {expr: 'datum'}\n )\n };\n } else if (isSortByEncoding(s)) {\n const fieldDefToSort = model.fieldDef(s.encoding);\n return {\n field: vgField(fieldDefToSort, {expr: 'datum'}),\n order: s.order\n };\n } else if (s === null) {\n return undefined;\n } else {\n return {\n field: vgField(dimensionChannelDef, {\n // For stack with imputation, we only have bin_mid\n binSuffix: model.stack && model.stack.impute ? 'mid' : undefined,\n expr: 'datum'\n })\n };\n }\n }\n return undefined;\n }\n return undefined;\n}\n\nfunction getMarkGroup(model: UnitModel, opt: {fromPrefix: string} = {fromPrefix: ''}) {\n const {mark, markDef, encoding, config} = model;\n\n const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model));\n const style = getStyles(markDef);\n const key = encoding.key;\n const sort = getSort(model);\n const interactive = interactiveFlag(model);\n const aria = getMarkPropOrConfig('aria', markDef, config);\n\n const postEncodingTransform = markCompiler[mark].postEncodingTransform\n ? markCompiler[mark].postEncodingTransform(model)\n : null;\n\n return [\n {\n name: model.getName('marks'),\n type: markCompiler[mark].vgMark,\n ...(clip ? {clip: true} : {}),\n ...(style ? {style} : {}),\n ...(key ? {key: key.field} : {}),\n ...(sort ? {sort} : {}),\n ...(interactive ? interactive : {}),\n ...(aria === false ? {aria} : {}),\n from: {data: opt.fromPrefix + model.requestDataName(DataSourceType.Main)},\n encode: {\n update: markCompiler[mark].encodeEntry(model)\n },\n ...(postEncodingTransform\n ? {\n transform: postEncodingTransform\n }\n : {})\n }\n ];\n}\n\n/**\n * If scales are bound to interval selections, we want to automatically clip\n * marks to account for panning/zooming interactions. We identify bound scales\n * by the selectionExtent property, which gets added during scale parsing.\n */\nfunction scaleClip(model: UnitModel) {\n const xScale = model.getScaleComponent('x');\n const yScale = model.getScaleComponent('y');\n return (xScale && xScale.get('selectionExtent')) || (yScale && yScale.get('selectionExtent')) ? true : undefined;\n}\n\n/**\n * If we use a custom projection with auto-fitting to the geodata extent,\n * we need to clip to ensure the chart size doesn't explode.\n */\nfunction projectionClip(model: UnitModel) {\n const projection = model.component.projection;\n return projection && !projection.isFit ? true : undefined;\n}\n\n/**\n * Only output interactive flags if we have selections defined somewhere in our model hierarchy.\n */\nfunction interactiveFlag(model: UnitModel) {\n if (!model.component.selection) return null;\n const unitCount = keys(model.component.selection).length;\n let parentCount = unitCount;\n let parent = model.parent;\n while (parent && parentCount === 0) {\n parentCount = keys(parent.component.selection).length;\n parent = parent.parent;\n }\n return parentCount ? {interactive: unitCount > 0} : null;\n}\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const arc: MarkCompiler = {\n vgMark: 'arc',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n\n // arcs are rectangles in polar coordinates\n ...encode.rectPosition(model, 'radius', 'arc'),\n ...encode.rectPosition(model, 'theta', 'arc')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const area: MarkCompiler = {\n vgMark: 'area',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'include',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'horizontal'\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'vertical'\n }),\n ...encode.defined(model)\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const bar: MarkCompiler = {\n vgMark: 'rect',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x', 'bar'),\n ...encode.rectPosition(model, 'y', 'bar')\n };\n }\n};\n","import {GeoShapeTransform as VgGeoShapeTransform} from 'vega';\nimport {isFieldDef, vgField} from '../../channeldef';\nimport {GEOJSON} from '../../type';\nimport {VgPostEncodingTransform} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const geoshape: MarkCompiler = {\n vgMark: 'shape',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n })\n };\n },\n postEncodingTransform: (model: UnitModel): VgPostEncodingTransform[] => {\n const {encoding} = model;\n const shapeDef = encoding.shape;\n\n const transform: VgGeoShapeTransform = {\n type: 'geoshape',\n projection: model.projectionName(),\n // as: 'shape',\n ...(shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON\n ? {field: vgField(shapeDef, {expr: 'datum'})}\n : {})\n };\n return [transform];\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const image: MarkCompiler = {\n vgMark: 'image',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'ignore',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x', 'image'),\n ...encode.rectPosition(model, 'y', 'image'),\n ...encode.text(model, 'url')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const line: MarkCompiler = {\n vgMark: 'line',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's line size is strokeWidth\n }),\n ...encode.defined(model)\n };\n }\n};\n\nexport const trail: MarkCompiler = {\n vgMark: 'trail',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model),\n ...encode.defined(model)\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const rect: MarkCompiler = {\n vgMark: 'rect',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x', 'rect'),\n ...encode.rectPosition(model, 'y', 'rect')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const rule: MarkCompiler = {\n vgMark: 'rule',\n encodeEntry: (model: UnitModel) => {\n const {markDef} = model;\n const orient = markDef.orient;\n\n if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) {\n // Show nothing if we have none of x, y, lat, and long.\n return {};\n }\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'vertical' // include x2 for horizontal or line segment rule\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'horizontal' // include y2 for vertical or line segment rule\n }),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's rule size is strokeWidth\n })\n };\n }\n};\n","import {Config} from '../../config';\nimport {Encoding} from '../../encoding';\nimport {MarkDef} from '../../mark';\nimport {getMarkPropOrConfig} from '../common';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const text: MarkCompiler = {\n vgMark: 'text',\n\n encodeEntry: (model: UnitModel) => {\n const {config, encoding} = model;\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'include',\n baseline: 'include',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'include'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.text(model),\n ...encode.nonPosition('size', model, {\n vgChannel: 'fontSize' // VL's text size is fontSize\n }),\n ...encode.nonPosition('angle', model),\n ...encode.valueIfDefined('align', align(model.markDef, encoding, config)),\n ...encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config)),\n ...encode.pointPosition('radius', model, {defaultPos: null, isMidPoint: true}),\n ...encode.pointPosition('theta', model, {defaultPos: null, isMidPoint: true})\n };\n }\n};\n\nfunction align(markDef: MarkDef, encoding: Encoding, config: Config) {\n const a = getMarkPropOrConfig('align', markDef, config);\n if (a === undefined) {\n return 'center';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n\nfunction baseline(markDef: MarkDef, encoding: Encoding, config: Config) {\n const b = getMarkPropOrConfig('baseline', markDef, config);\n if (b === undefined) {\n return 'middle';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n","import {NewSignal} from 'vega';\nimport {Axis} from '../axis';\nimport {\n Channel,\n GEOPOSITION_CHANNELS,\n NONPOSITION_SCALE_CHANNELS,\n POSITION_SCALE_CHANNELS,\n ScaleChannel,\n SCALE_CHANNELS,\n SingleDefChannel,\n supportLegend,\n X,\n Y,\n PositionChannel,\n NonPositionScaleChannel\n} from '../channel';\nimport {\n getFieldDef,\n getFieldOrDatumDef,\n isFieldOrDatumDef,\n isTypedFieldDef,\n MarkPropFieldOrDatumDef,\n PositionFieldDef\n} from '../channeldef';\nimport {Config} from '../config';\nimport {isGraticuleGenerator} from '../data';\nimport * as vlEncoding from '../encoding';\nimport {Encoding, initEncoding} from '../encoding';\nimport {Legend} from '../legend';\nimport {GEOSHAPE, isMarkDef, Mark, MarkDef} from '../mark';\nimport {Projection} from '../projection';\nimport {Domain} from '../scale';\nimport {SelectionDef} from '../selection';\nimport {LayoutSizeMixins, NormalizedUnitSpec} from '../spec';\nimport {isFrameMixins} from '../spec/base';\nimport {stack, StackProperties} from '../stack';\nimport {Dict} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {assembleAxisSignals} from './axis/assemble';\nimport {AxisIndex} from './axis/component';\nimport {parseUnitAxes} from './axis/parse';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {initLayoutSize} from './layoutsize/init';\nimport {parseUnitLayoutSize} from './layoutsize/parse';\nimport {LegendIndex} from './legend/component';\nimport {defaultFilled, initMarkdef} from './mark/init';\nimport {parseMarkGroups} from './mark/mark';\nimport {isLayerModel, Model, ModelWithField} from './model';\nimport {ScaleIndex} from './scale/component';\nimport {\n assembleTopLevelSignals,\n assembleUnitSelectionData,\n assembleUnitSelectionMarks,\n assembleUnitSelectionSignals\n} from './selection/assemble';\nimport {parseUnitSelection} from './selection/parse';\n\n/**\n * Internal model of Vega-Lite specification for the compiler.\n */\nexport class UnitModel extends ModelWithField {\n public readonly markDef: MarkDef;\n public readonly encoding: Encoding;\n\n public readonly specifiedScales: ScaleIndex = {};\n\n public readonly stack: StackProperties;\n\n protected specifiedAxes: AxisIndex = {};\n\n protected specifiedLegends: LegendIndex = {};\n\n public specifiedProjection: Projection = {};\n\n public readonly selection: Dict = {};\n public children: Model[] = [];\n\n constructor(\n spec: NormalizedUnitSpec,\n parent: Model,\n parentGivenName: string,\n parentGivenSize: LayoutSizeMixins = {},\n config: Config\n ) {\n super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined);\n\n const markDef = isMarkDef(spec.mark) ? {...spec.mark} : {type: spec.mark};\n const mark = markDef.type;\n\n // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding\n if (markDef.filled === undefined) {\n markDef.filled = defaultFilled(markDef, config, {\n graticule: spec.data && isGraticuleGenerator(spec.data)\n });\n }\n\n const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config));\n this.markDef = initMarkdef(markDef, encoding, config);\n\n this.size = initLayoutSize({\n encoding: encoding,\n size: isFrameMixins(spec)\n ? {\n ...parentGivenSize,\n ...(spec.width ? {width: spec.width} : {}),\n ...(spec.height ? {height: spec.height} : {})\n }\n : parentGivenSize\n });\n\n // calculate stack properties\n this.stack = stack(mark, encoding);\n this.specifiedScales = this.initScales(mark, encoding);\n\n this.specifiedAxes = this.initAxes(encoding);\n this.specifiedLegends = this.initLegend(encoding);\n this.specifiedProjection = spec.projection;\n\n // Selections will be initialized upon parse.\n this.selection = spec.selection;\n }\n\n public get hasProjection(): boolean {\n const {encoding} = this;\n const isGeoShapeMark = this.mark === GEOSHAPE;\n const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel]));\n return isGeoShapeMark || hasGeoPosition;\n }\n\n /**\n * Return specified Vega-Lite scale domain for a particular channel\n * @param channel\n */\n public scaleDomain(channel: ScaleChannel): Domain {\n const scale = this.specifiedScales[channel];\n return scale ? scale.domain : undefined;\n }\n\n public axis(channel: PositionChannel): Axis {\n return this.specifiedAxes[channel];\n }\n\n public legend(channel: NonPositionScaleChannel): Legend {\n return this.specifiedLegends[channel];\n }\n\n private initScales(mark: Mark, encoding: Encoding): ScaleIndex {\n return SCALE_CHANNELS.reduce((scales, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as\n | PositionFieldDef\n | MarkPropFieldOrDatumDef;\n if (fieldOrDatumDef) {\n scales[channel] = fieldOrDatumDef.scale ?? {};\n }\n return scales;\n }, {} as ScaleIndex);\n }\n\n private initAxes(encoding: Encoding): AxisIndex {\n return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => {\n // Position Axis\n\n // TODO: handle ConditionFieldDef\n const channelDef = encoding[channel];\n if (\n isFieldOrDatumDef(channelDef) ||\n (channel === X && isFieldOrDatumDef(encoding.x2)) ||\n (channel === Y && isFieldOrDatumDef(encoding.y2))\n ) {\n const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined;\n\n _axis[channel] = axisSpec ? {...axisSpec} : axisSpec; // convert truthy value to object\n }\n return _axis;\n }, {});\n }\n\n private initLegend(encoding: Encoding): LegendIndex {\n return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldOrDatumDef;\n\n if (fieldOrDatumDef && supportLegend(channel)) {\n const legend = fieldOrDatumDef.legend;\n _legend[channel] = legend ? {...legend} : legend; // convert truthy value to object\n }\n\n return _legend;\n }, {});\n }\n\n public parseData() {\n this.component.data = parseData(this);\n }\n\n public parseLayoutSize() {\n parseUnitLayoutSize(this);\n }\n\n public parseSelections() {\n this.component.selection = parseUnitSelection(this, this.selection);\n }\n\n public parseMarkGroup() {\n this.component.mark = parseMarkGroups(this);\n }\n\n public parseAxesAndHeaders() {\n this.component.axes = parseUnitAxes(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: any[]): NewSignal[] {\n return assembleTopLevelSignals(this, signals);\n }\n\n public assembleSignals(): NewSignal[] {\n return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])];\n }\n\n public assembleSelectionData(data: readonly VgData[]): VgData[] {\n return assembleUnitSelectionData(this, data);\n }\n\n public assembleLayout(): VgLayout {\n return null;\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n return assembleLayoutSignals(this);\n }\n\n public assembleMarks() {\n let marks = this.component.mark ?? [];\n\n // If this unit is part of a layer, selections should augment\n // all in concert rather than each unit individually. This\n // ensures correct interleaving of clipping and brushed marks.\n if (!this.parent || !isLayerModel(this.parent)) {\n marks = assembleUnitSelectionMarks(this, marks);\n }\n\n return marks.map(this.correctDataNames);\n }\n\n protected getMapping() {\n return this.encoding;\n }\n\n public get mark(): Mark {\n return this.markDef.type;\n }\n\n public channelHasField(channel: Channel) {\n return vlEncoding.channelHasField(this.encoding, channel);\n }\n\n public fieldDef(channel: SingleDefChannel) {\n const channelDef = this.encoding[channel];\n return getFieldDef(channelDef);\n }\n\n public typedFieldDef(channel: SingleDefChannel) {\n const fieldDef = this.fieldDef(channel);\n if (isTypedFieldDef(fieldDef)) {\n return fieldDef;\n }\n return null;\n }\n}\n","import {getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {isContinuousFieldOrDatumDef} from '../../channeldef';\nimport {Encoding} from '../../encoding';\nimport * as log from '../../log';\nimport {isStep, LayoutSizeMixins} from '../../spec/base';\n\nexport function initLayoutSize({encoding, size}: {encoding: Encoding; size: LayoutSizeMixins}) {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n if (isStep(size[sizeType])) {\n if (isContinuousFieldOrDatumDef(encoding[channel])) {\n delete size[sizeType];\n log.warn(log.message.stepDropped(sizeType));\n }\n }\n }\n\n return size;\n}\n","import {Legend as VgLegend, NewSignal, Title as VgTitle} from 'vega';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedLayerSpec} from '../spec';\nimport {keys} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {assembleAxisSignals} from './axis/assemble';\nimport {parseLayerAxes} from './axis/parse';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {parseLayerLayoutSize} from './layoutsize/parse';\nimport {assembleLegends} from './legend/assemble';\nimport {Model} from './model';\nimport {assembleLayerSelectionMarks} from './selection/assemble';\nimport {UnitModel} from './unit';\n\nexport class LayerModel extends Model {\n // HACK: This should be (LayerModel | UnitModel)[], but setting the correct type leads to weird error.\n // So I'm just putting generic Model for now\n public readonly children: Model[];\n\n constructor(\n spec: NormalizedLayerSpec,\n parent: Model,\n parentGivenName: string,\n parentGivenSize: LayoutSizeMixins,\n config: Config\n ) {\n super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view);\n\n const layoutSize = {\n ...parentGivenSize,\n ...(spec.width ? {width: spec.width} : {}),\n ...(spec.height ? {height: spec.height} : {})\n };\n\n this.children = spec.layer.map((layer, i) => {\n if (isLayerSpec(layer)) {\n return new LayerModel(layer, this, this.getName('layer_' + i), layoutSize, config);\n } else if (isUnitSpec(layer)) {\n return new UnitModel(layer, this, this.getName('layer_' + i), layoutSize, config);\n }\n\n throw new Error(log.message.invalidSpec(layer));\n });\n }\n\n public parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n\n public parseLayoutSize() {\n parseLayerLayoutSize(this);\n }\n\n public parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n\n public parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n\n public parseAxesAndHeaders() {\n parseLayerAxes(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n\n // TODO: Support same named selections across children.\n public assembleSignals(): NewSignal[] {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleSignals());\n }, assembleAxisSignals(this));\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleLayoutSignals());\n }, assembleLayoutSignals(this));\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n\n public assembleTitle(): VgTitle {\n let title = super.assembleTitle();\n if (title) {\n return title;\n }\n // If title does not provide layer, look into children\n for (const child of this.children) {\n title = child.assembleTitle();\n if (title) {\n return title;\n }\n }\n return undefined;\n }\n\n public assembleLayout(): VgLayout {\n return null;\n }\n\n public assembleMarks(): any[] {\n return assembleLayerSelectionMarks(\n this,\n this.children.flatMap(child => {\n return child.assembleMarks();\n })\n );\n }\n\n public assembleLegends(): VgLegend[] {\n return this.children.reduce((legends, child) => {\n return legends.concat(child.assembleLegends());\n }, assembleLegends(this));\n }\n}\n","import {Config} from '../config';\nimport * as log from '../log';\nimport {isAnyConcatSpec, isFacetSpec, isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedSpec} from '../spec';\nimport {ConcatModel} from './concat';\nimport {FacetModel} from './facet';\nimport {LayerModel} from './layer';\nimport {Model} from './model';\nimport {UnitModel} from './unit';\n\nexport function buildModel(\n spec: NormalizedSpec,\n parent: Model,\n parentGivenName: string,\n unitSize: LayoutSizeMixins,\n config: Config\n): Model {\n if (isFacetSpec(spec)) {\n return new FacetModel(spec, parent, parentGivenName, config);\n } else if (isLayerSpec(spec)) {\n return new LayerModel(spec, parent, parentGivenName, unitSize, config);\n } else if (isUnitSpec(spec)) {\n return new UnitModel(spec, parent, parentGivenName, unitSize, config);\n } else if (isAnyConcatSpec(spec)) {\n return new ConcatModel(spec, parent, parentGivenName, config);\n }\n throw new Error(log.message.invalidSpec(spec));\n}\n","import {AutoSizeType, LoggerInterface, Spec as VgSpec} from 'vega';\nimport {isString, mergeConfig} from 'vega-util';\nimport {getPositionScaleChannel} from '../channel';\nimport * as vlFieldDef from '../channeldef';\nimport {Config, initConfig, stripAndRedirectConfig} from '../config';\nimport * as log from '../log';\nimport {normalize} from '../normalize';\nimport {LayoutSizeMixins, TopLevel, TopLevelSpec} from '../spec';\nimport {\n AutoSizeParams,\n Datasets,\n extractTopLevelProperties,\n getFitType,\n isFitType,\n TopLevelProperties\n} from '../spec/toplevel';\nimport {Dict, keys} from '../util';\nimport {buildModel} from './buildmodel';\nimport {assembleRootData} from './data/assemble';\nimport {optimizeDataflow} from './data/optimize';\nimport {Model} from './model';\n\nexport interface CompileOptions {\n /**\n * Sets a Vega-Lite configuration.\n */\n config?: Config;\n\n /**\n * Sets a custom logger.\n */\n logger?: LoggerInterface;\n\n /**\n * Sets a field title formatter.\n */\n fieldTitle?: vlFieldDef.FieldTitleFormatter;\n}\n\n/**\n * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec.\n *\n * At a high-level, we make the following transformations in different phases:\n *\n * Input spec\n * |\n * | (Normalization)\n * v\n * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.)\n * |\n * | (Build Model)\n * v\n * A model tree of the spec\n * |\n * | (Parse)\n * v\n * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged)\n * |\n * | (Optimize)\n * v\n * A model tree with parsed components with the data component optimized\n * |\n * | (Assemble)\n * v\n * Vega spec\n *\n * @param inputSpec The Vega-Lite specification.\n * @param opt Optional arguments passed to the Vega-Lite compiler.\n * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec.\n */\nexport function compile(inputSpec: TopLevelSpec, opt: CompileOptions = {}) {\n // 0. Augment opt with default opts\n if (opt.logger) {\n // set the singleton logger to the provided logger\n log.set(opt.logger);\n }\n\n if (opt.fieldTitle) {\n // set the singleton field title formatter\n vlFieldDef.setTitleFormatter(opt.fieldTitle);\n }\n\n try {\n // 1. Initialize config by deep merging default config with the config provided via option and the input spec.\n const config = initConfig(mergeConfig(opt.config, inputSpec.config));\n\n // 2. Normalize: Convert input spec -> normalized spec\n\n // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec.\n // - Normalize autosize and width or height spec\n const spec = normalize(inputSpec, config);\n\n // 3. Build Model: normalized spec -> Model (a tree structure)\n\n // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors.\n // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models.\n const model: Model = buildModel(spec, null, '', undefined, config);\n\n // 4 Parse: Model --> Model with components\n\n // Note that components = intermediate representations that are equivalent to Vega specs.\n // We need these intermediate representation because we need to merge many visualization \"components\" like projections, scales, axes, and legends.\n // We will later convert these components into actual Vega specs in the assemble phase.\n\n // In this phase, we do a bottom-up traversal over the whole tree to\n // parse for each type of components once (e.g., data, layout, mark, scale).\n // By doing bottom-up traversal, we start parsing components of unit specs and\n // then merge child components of parent composite specs.\n //\n // Please see inside model.parse() for order of different components parsed.\n model.parse();\n\n // drawDataflow(model.component.data.sources);\n\n // 5. Optimize the dataflow. This will modify the data component of the model.\n optimizeDataflow(model.component.data, model);\n\n // drawDataflow(model.component.data.sources);\n\n // 6. Assemble: convert model components --> Vega Spec.\n const vgSpec = assembleTopLevelModel(\n model,\n getTopLevelProperties(inputSpec, spec.autosize, config, model),\n inputSpec.datasets,\n inputSpec.usermeta\n );\n\n return {\n spec: vgSpec,\n normalized: spec\n };\n } finally {\n // Reset the singleton logger if a logger is provided\n if (opt.logger) {\n log.reset();\n }\n // Reset the singleton field title formatter if provided\n if (opt.fieldTitle) {\n vlFieldDef.resetTitleFormatter();\n }\n }\n}\n\nfunction getTopLevelProperties(\n inputSpec: TopLevel,\n autosize: AutoSizeType | AutoSizeParams,\n config: Config,\n model: Model\n) {\n const width = model.component.layoutSize.get('width');\n const height = model.component.layoutSize.get('height');\n if (autosize === undefined) {\n autosize = {type: 'pad'};\n if (model.hasAxisOrientSignalRef()) {\n autosize.resize = true;\n }\n } else if (isString(autosize)) {\n autosize = {type: autosize};\n }\n if (width && height && isFitType(autosize.type)) {\n if (width === 'step' && height === 'step') {\n log.warn(log.message.droppingFit());\n autosize.type = 'pad';\n } else if (width === 'step' || height === 'step') {\n // effectively XOR, because else if\n\n // get step dimension\n const sizeType = width === 'step' ? 'width' : 'height';\n // log that we're dropping fit for respective channel\n log.warn(log.message.droppingFit(getPositionScaleChannel(sizeType)));\n\n // setting type to inverse fit (so if we dropped fit-x, type is now fit-y)\n const inverseSizeType = sizeType === 'width' ? 'height' : 'width';\n autosize.type = getFitType(inverseSizeType);\n }\n }\n\n return {\n ...(keys(autosize).length === 1 && autosize.type\n ? autosize.type === 'pad'\n ? {}\n : {autosize: autosize.type}\n : {autosize}),\n ...extractTopLevelProperties(config),\n ...extractTopLevelProperties(inputSpec)\n };\n}\n\n/*\n * Assemble the top-level model to a Vega spec.\n *\n * Note: this couldn't be `model.assemble()` since the top-level model\n * needs some special treatment to generate top-level properties.\n */\nfunction assembleTopLevelModel(\n model: Model,\n topLevelProperties: TopLevelProperties & LayoutSizeMixins,\n datasets: Datasets = {},\n usermeta: Dict\n): VgSpec {\n // Config with Vega-Lite only config removed.\n const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined;\n\n const data = [].concat(\n model.assembleSelectionData([]),\n // only assemble data in the root\n assembleRootData(model.component.data, datasets)\n );\n\n const projections = model.assembleProjections();\n const title = model.assembleTitle();\n const style = model.assembleGroupStyle();\n const encodeEntry = model.assembleGroupEncodeEntry(true);\n\n let layoutSignals = model.assembleLayoutSignals();\n\n // move width and height signals with values to top level\n layoutSignals = layoutSignals.filter(signal => {\n if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) {\n topLevelProperties[signal.name] = +signal.value;\n return false;\n }\n return true;\n });\n\n return {\n $schema: 'https://vega.github.io/schema/vega/v5.json',\n ...(model.description ? {description: model.description} : {}),\n ...topLevelProperties,\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n data,\n ...(projections.length > 0 ? {projections: projections} : {}),\n ...model.assembleGroup([...layoutSignals, ...model.assembleSelectionTopLevelSignals([])]),\n ...(vgConfig ? {config: vgConfig} : {}),\n ...(usermeta ? {usermeta} : {})\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/vega-lite/package.json b/node_modules/vega-lite/package.json deleted file mode 100644 index 5da3b3c..0000000 --- a/node_modules/vega-lite/package.json +++ /dev/null @@ -1,192 +0,0 @@ -{ - "_from": "vega-lite", - "_id": "vega-lite@4.14.0", - "_inBundle": false, - "_integrity": "sha512-zWwmH3iX/U8xj4RsmpLkLFSVimNh3r/crbOk72MyolsB0v0TB3lRbsf1r5eJCdVPPSVEkE5TXwDYE+ygQ2kgbQ==", - "_location": "/vega-lite", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "vega-lite", - "name": "vega-lite", - "escapedName": "vega-lite", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/vega-lite/-/vega-lite-4.14.0.tgz", - "_shasum": "b00fae5f6e0dd842726a185f1b1b6f0522c73418", - "_spec": "vega-lite", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats", - "author": { - "name": "Dominik Moritz, Kanit \"Ham\" Wongsuphasawat, Arvind Satyanarayan, Jeffrey Heer" - }, - "bin": { - "vl2png": "bin/vl2png", - "vl2svg": "bin/vl2svg", - "vl2pdf": "bin/vl2pdf", - "vl2vg": "bin/vl2vg" - }, - "bugs": { - "url": "https://github.com/vega/vega-lite/issues" - }, - "bundleDependencies": false, - "collaborators": [ - "Kanit Wongsuphasawat (http://kanitw.yellowpigz.com)", - "Dominik Moritz (https://www.domoritz.de)", - "Arvind Satyanarayan (https://arvindsatya.com)", - "Jeffrey Heer (https://jheer.org)" - ], - "dependencies": { - "@types/clone": "~0.1.30", - "@types/fast-json-stable-stringify": "^2.0.0", - "array-flat-polyfill": "^1.0.1", - "clone": "~2.1.2", - "fast-deep-equal": "~3.1.3", - "fast-json-stable-stringify": "~2.1.0", - "json-stringify-pretty-compact": "~2.0.0", - "tslib": "~2.0.0", - "vega-event-selector": "~2.0.3", - "vega-expression": "~2.6.5", - "vega-util": "~1.14.1", - "yargs": "~15.4.1" - }, - "deprecated": false, - "description": "Vega-Lite is a concise high-level language for interactive visualization.", - "devDependencies": { - "@babel/cli": "^7.10.4", - "@babel/core": "^7.10.4", - "@babel/preset-env": "^7.10.4", - "@rollup/plugin-commonjs": "14.0.0", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^8.4.0", - "@types/chai": "^4.2.11", - "@types/d3": "^5.7.2", - "@types/jest": "^26.0.4", - "@types/mkdirp": "^1.0.1", - "@types/pako": "^1.0.1", - "@types/puppeteer": "^3.0.1", - "@typescript-eslint/eslint-plugin": "^3.6.1", - "@typescript-eslint/parser": "^3.6.1", - "ajv": "^6.12.3", - "chai": "^4.2.0", - "cheerio": "^1.0.0-rc.3", - "codecov": "^3.7.0", - "concurrently": "^5.2.0", - "conventional-changelog-cli": "^2.0.34", - "d3": "^5.16.0", - "eslint": "^7.4.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-jest": "^23.18.0", - "eslint-plugin-prettier": "^3.1.4", - "gh-pages": "^3.1.0", - "highlight.js": "^10.1.1", - "jest": "^26.1.0", - "jest-puppeteer": "^4.4.0", - "mkdirp": "^1.0.4", - "pako": "^1.0.11", - "prettier": "^2.0.5", - "puppeteer": "^5.2.0", - "rollup": "^2.21.0", - "rollup-plugin-sourcemaps": "^0.6.2", - "rollup-plugin-terser": "^6.1.0", - "serve": "^11.3.2", - "svg2png-many": "^0.0.7", - "terser": "^4.8.0", - "ts-jest": "^26.1.2", - "ts-json-schema-generator": "^0.70.2", - "typescript": "~3.9.6", - "vega-cli": "^5.13.0", - "vega-datasets": "2.1.0", - "vega-embed": "^6.10.0", - "vega-tooltip": "^0.23.2", - "vega-typings": "^0.18.0", - "yaml-front-matter": "^4.1.0" - }, - "directories": { - "test": "test" - }, - "homepage": "https://vega.github.io/vega-lite/", - "jest": { - "preset": "jest-puppeteer", - "transform": { - "^.+\\.tsx?$": "ts-jest" - }, - "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "jsx", - "json", - "node" - ], - "testPathIgnorePatterns": [ - "/node_modules", - "/build", - "/_site", - "/src" - ], - "coverageDirectory": "./coverage/", - "collectCoverage": false, - "setupFiles": [ - "./test/jest.overrides.ts" - ] - }, - "jsdelivr": "build/vega-lite.min.js", - "license": "BSD-3-Clause", - "main": "build/vega-lite.js", - "module": "build/src/index", - "name": "vega-lite", - "peerDependencies": { - "vega": "^5.13.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega-lite.git" - }, - "scripts": { - "build": "yarn build:only", - "build:example": "TZ=America/Los_Angeles scripts/build-example.sh", - "build:examples": "yarn data && TZ=America/Los_Angeles scripts/build-examples.sh", - "build:examples-full": "TZ=America/Los_Angeles scripts/build-examples.sh 1", - "build:jekyll": "pushd site && bundle exec jekyll build -q && popd", - "build:only": "yarn tsc:src && rollup -c", - "build:site": "yarn tsc:site && rollup -c site/rollup.config.js", - "build:toc": "yarn build:jekyll && scripts/generate-toc", - "build:versions": "scripts/update-version.sh", - "changelog": "conventional-changelog -p angular -r 2", - "clean": "find build ! -name 'vega-lite-schema.json' -type f -delete && rm -rf site/data/* && rm -f examples/compiled/*.png && find site/examples ! -name 'index.md' ! -name 'data' -type f -delete", - "data": "rsync -r node_modules/vega-datasets/data/* site/data", - "deploy:site": "gh-pages -d site", - "eslintbase": "eslint .", - "format": "yarn eslintbase --fix && yarn prettierbase --write", - "lint": "yarn eslintbase && yarn prettierbase --check", - "postbuild": "terser build/vega-lite.js -cm --source-map content=build/vega-lite.js.map,filename=build/vega-lite.min.js.map -o build/vega-lite.min.js && yarn schema && babel build/vega-lite.js --out-dir build-es5 --config-file ./babel.config.js", - "prebuild:examples": "yarn build:only", - "prebuild:examples-full": "yarn build:only", - "predeploy:site": "yarn presite", - "presite": "yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh", - "prettierbase": "prettier '**/*.{md,css,yml}'", - "renameschema": "scripts/rename-schema.sh", - "schema": "mkdir -p build && ts-json-schema-generator -f tsconfig.json -p src/index.ts -t TopLevelSpec --no-type-check --no-ref-encode > build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/", - "site": "pushd site && bundle exec jekyll serve -I -l && popd", - "test": "jest test/ && yarn lint && yarn schema && jest examples/ && yarn test:runtime", - "test:inspect": "node --inspect-brk ./node_modules/.bin/jest --runInBand test", - "test:runtime": "TZ=America/Los_Angeles jest test-runtime/", - "test:runtime:generate": "yarn build:only && rm -Rf test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime", - "tsc:site": "tsc -b site/tsconfig.site.json", - "tsc:src": "tsc -b src/tsconfig.src.json", - "watch:build": "yarn build:only && concurrently --kill-others -n Typescript,Rollup 'yarn tsc:src -w' 'rollup -c -w'", - "watch:site": "concurrently --kill-others -n Typescript,Rollup 'yarn tsc:site -w' 'rollup -c site/rollup.config.js -w'", - "watch:test": "jest --watch" - }, - "types": "build/src/index.d.ts", - "unpkg": "build/vega-lite.min.js", - "version": "4.14.0" -} diff --git a/node_modules/vega-lite/src/aggregate.ts b/node_modules/vega-lite/src/aggregate.ts deleted file mode 100644 index dd10cec..0000000 --- a/node_modules/vega-lite/src/aggregate.ts +++ /dev/null @@ -1,81 +0,0 @@ -import {AggregateOp} from 'vega'; -import {isString, toSet} from 'vega-util'; -import {contains, Flag, keys} from './util'; - -const AGGREGATE_OP_INDEX: Flag = { - argmax: 1, - argmin: 1, - average: 1, - count: 1, - distinct: 1, - product: 1, - max: 1, - mean: 1, - median: 1, - min: 1, - missing: 1, - q1: 1, - q3: 1, - ci0: 1, - ci1: 1, - stderr: 1, - stdev: 1, - stdevp: 1, - sum: 1, - valid: 1, - values: 1, - variance: 1, - variancep: 1 -}; - -export const MULTIDOMAIN_SORT_OP_INDEX = { - count: 1, - min: 1, - max: 1 -}; - -export interface ArgminDef { - argmin: string; -} - -export interface ArgmaxDef { - argmax: string; -} - -export type NonArgAggregateOp = Exclude; - -export type Aggregate = NonArgAggregateOp | ArgmaxDef | ArgminDef; - -export function isArgminDef(a: Aggregate | string): a is ArgminDef { - return !!a && !!a['argmin']; -} - -export function isArgmaxDef(a: Aggregate | string): a is ArgmaxDef { - return !!a && !!a['argmax']; -} - -export const AGGREGATE_OPS = keys(AGGREGATE_OP_INDEX); - -export function isAggregateOp(a: string | ArgminDef | ArgmaxDef): a is AggregateOp { - return isString(a) && !!AGGREGATE_OP_INDEX[a]; -} - -export const COUNTING_OPS: NonArgAggregateOp[] = ['count', 'valid', 'missing', 'distinct']; - -export function isCountingAggregateOp(aggregate?: string | Aggregate): boolean { - return isString(aggregate) && contains(COUNTING_OPS, aggregate); -} - -export function isMinMaxOp(aggregate?: Aggregate | string): boolean { - return isString(aggregate) && contains(['min', 'max'], aggregate); -} - -/** Additive-based aggregation operations. These can be applied to stack. */ -export const SUM_OPS: NonArgAggregateOp[] = ['count', 'sum', 'distinct', 'valid', 'missing']; - -/** - * Aggregation operators that always produce values within the range [domainMin, domainMax]. - */ -export const SHARED_DOMAIN_OPS: AggregateOp[] = ['mean', 'average', 'median', 'q1', 'q3', 'min', 'max']; - -export const SHARED_DOMAIN_OP_INDEX = toSet(SHARED_DOMAIN_OPS); diff --git a/node_modules/vega-lite/src/axis.ts b/node_modules/vega-lite/src/axis.ts deleted file mode 100644 index df4c843..0000000 --- a/node_modules/vega-lite/src/axis.ts +++ /dev/null @@ -1,643 +0,0 @@ -import { - Align, - Axis as VgAxis, - AxisEncode, - AxisOrient, - BaseAxis, - Color, - FontStyle, - FontWeight, - LabelOverlap, - SignalRef, - TextBaseline, - TimeInterval, - TimeIntervalStep -} from 'vega'; -import {ConditionalPredicate, Value, ValueDef} from './channeldef'; -import {DateTime} from './datetime'; -import {Guide, GuideEncodingEntry, TitleMixins, VlOnlyGuideConfig} from './guide'; -import {Flag, keys} from './util'; -import {ExcludeMappedValueRefButKeepSignal, VgEncodeChannel} from './vega.schema'; - -export type BaseAxisNoValueRefs = AxisOverrideMixins & VLOnlyAxisMixins & ExcludeMappedValueRefButKeepSignal; - -interface AxisOverrideMixins { - // Position and tickMinStep are not config in Vega, but are in Vega-Lite. So we just copy them here. - - /** - * The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate. - * - * __Default value__: `0` - */ - position?: number | SignalRef; - - /** - * The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value. - */ - tickMinStep?: number | SignalRef; - - // Override comments to be Vega-Lite specific - /** - * A boolean flag indicating if grid lines should be included as part of the axis - * - * __Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`. - */ - grid?: boolean; - - /** - * Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks. - * - * __Default value:__ `true` for axis of a continuous x-scale. Otherwise, `false`. - */ - labelFlush?: boolean | number; - - /** - * The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `"parity"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `"greedy"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes). - * - * __Default value:__ `true` for non-nominal fields with non-log scales; `"greedy"` for log scales; otherwise `false`. - */ - labelOverlap?: LabelOverlap; - - /** - * The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle. - * - * __Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default) - */ - offset?: number; - - /** - * The orientation of the axis. One of `"top"`, `"bottom"`, `"left"` or `"right"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart). - * - * __Default value:__ `"bottom"` for x-axes and `"left"` for y-axes. - */ - orient?: AxisOrient | SignalRef; - - /** - * A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are "nice" (multiples of 2, 5, 10) and lie within the underlying scale's range. - * - * For scales of type `"time"` or `"utc"`, the tick count can instead be a time interval specifier. Legal string values are `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and "year". Alternatively, an object-valued interval specifier of the form `{"interval": "month", "step": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary. - * - * __Default value__: Determine using a formula `ceil(width/40)` for x and `ceil(height/40)` for y. - * - * @minimum 0 - */ - tickCount?: number | TimeInterval | TimeIntervalStep | SignalRef; - - /** - * Explicitly set the visible axis tick values. - */ - values?: number[] | string[] | boolean[] | DateTime[] | SignalRef; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega. - - /** - * A non-negative integer indicating the z-index of the axis. - * If zindex is 0, axes should be drawn behind all chart elements. - * To put them in front, set `zindex` to `1` or more. - * - * __Default value:__ `0` (behind the marks). - * - * @TJS-type integer - * @minimum 0 - */ - zindex?: number; -} - -interface VLOnlyAxisMixins { - /** - * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels. - * - * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object. - */ - labelExpr?: string; - - /** - * A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. - * - * __Default value:__ (none) - * __Note:__ Any specified style will augment the default style. For example, an x-axis mark with `"style": "foo"` will use `config.axisX` and `config.style.foo` (the specified style `"foo"` has higher precedence). - */ - style?: string | string[]; -} - -export type SignalAxisProp = - | 'domainColor' - | 'labelAlign' - | 'labelColor' - | 'gridColor' - | 'tickColor' - | 'titleColor' - | 'title'; - -export type ConditionalAxisProp = - | 'labelAlign' - | 'labelBaseline' - | 'labelColor' - | 'labelFont' - | 'labelFontSize' - | 'labelFontStyle' - | 'labelFontWeight' - | 'labelOpacity' - | 'labelOffset' - | 'labelPadding' - | 'gridColor' - | 'gridDash' - | 'gridDashOffset' - | 'gridOpacity' - | 'gridWidth' - | 'tickColor' - | 'tickDash' - | 'tickDashOffset' - | 'tickOpacity' - | 'tickSize' - | 'tickWidth'; - -export const CONDITIONAL_AXIS_PROP_INDEX: Record< - ConditionalAxisProp | SignalAxisProp, - { - part: keyof AxisEncode; - vgProp: VgEncodeChannel; - } | null // null if we need to convert condition to signal -> = { - domainColor: { - part: 'domain', - vgProp: 'stroke' - }, - labelAlign: { - part: 'labels', - vgProp: 'align' - }, - labelBaseline: { - part: 'labels', - vgProp: 'baseline' - }, - labelColor: { - part: 'labels', - vgProp: 'fill' - }, - labelFont: { - part: 'labels', - vgProp: 'font' - }, - labelFontSize: { - part: 'labels', - vgProp: 'fontSize' - }, - labelFontStyle: { - part: 'labels', - vgProp: 'fontStyle' - }, - labelFontWeight: { - part: 'labels', - vgProp: 'fontWeight' - }, - labelOpacity: { - part: 'labels', - vgProp: 'opacity' - }, - labelOffset: null, - labelPadding: null, // There is no fixed vgProp for tickSize, need to use signal. - gridColor: { - part: 'grid', - vgProp: 'stroke' - }, - gridDash: { - part: 'grid', - vgProp: 'strokeDash' - }, - gridDashOffset: { - part: 'grid', - vgProp: 'strokeDashOffset' - }, - gridOpacity: { - part: 'grid', - vgProp: 'opacity' - }, - gridWidth: { - part: 'grid', - vgProp: 'strokeWidth' - }, - tickColor: { - part: 'ticks', - vgProp: 'stroke' - }, - tickDash: { - part: 'ticks', - vgProp: 'strokeDash' - }, - tickDashOffset: { - part: 'ticks', - vgProp: 'strokeDashOffset' - }, - tickOpacity: { - part: 'ticks', - vgProp: 'opacity' - }, - tickSize: null, // There is no fixed vgProp for tickSize, need to use signal. - tickWidth: { - part: 'ticks', - vgProp: 'strokeWidth' - }, - titleColor: { - part: 'title', - vgProp: 'fill' - }, - title: null // title supports signal, let's use it. -}; - -export type ConditionalAxisProperty = (ValueDef | SignalRef) & { - condition: ConditionalPredicate | SignalRef> | ConditionalPredicate | SignalRef>[]; -}; - -export function isConditionalAxisValue(v: any): v is ConditionalAxisProperty { - return v && v['condition']; -} - -export type ConditionalAxisNumber = ConditionalAxisProperty; -export type ConditionalAxisLabelAlign = ConditionalAxisProperty; -export type ConditionalAxisLabelBaseline = ConditionalAxisProperty; -export type ConditionalAxisColor = ConditionalAxisProperty; -export type ConditionalAxisString = ConditionalAxisProperty; - -export type ConditionalAxisLabelFontStyle = ConditionalAxisProperty; -export type ConditionalAxisLabelFontWeight = ConditionalAxisProperty; - -export type ConditionalAxisNumberArray = ConditionalAxisProperty; - -// Vega axis config is the same as Vega axis base. If this is not the case, add specific type. -export type AxisConfigBaseWithConditionalAndSignal = Omit & - AxisPropsWithConditionAndSignal; - -export interface AxisPropsWithConditionAndSignal { - domainColor?: BaseAxisNoValueRefs['domainColor'] | SignalRef; - labelAlign?: BaseAxisNoValueRefs['labelAlign'] | ConditionalAxisLabelAlign; - labelBaseline?: BaseAxisNoValueRefs['labelBaseline'] | ConditionalAxisLabelBaseline; - labelColor?: BaseAxisNoValueRefs['labelColor'] | ConditionalAxisColor | SignalRef; - labelFont?: BaseAxisNoValueRefs['labelFont'] | ConditionalAxisString; - labelFontSize?: BaseAxisNoValueRefs['labelFontSize'] | ConditionalAxisNumber; - labelFontStyle?: BaseAxisNoValueRefs['labelFontStyle'] | ConditionalAxisLabelFontStyle; - labelFontWeight?: BaseAxisNoValueRefs['labelFontWeight'] | ConditionalAxisLabelFontWeight; - labelLineHeight?: BaseAxisNoValueRefs['labelLineHeight'] | ConditionalAxisNumber | SignalRef; - labelOpacity?: BaseAxisNoValueRefs['labelOpacity'] | ConditionalAxisNumber; - labelOffset?: BaseAxisNoValueRefs['labelOffset'] | ConditionalAxisNumber | SignalRef; - labelPadding?: BaseAxisNoValueRefs['labelPadding'] | ConditionalAxisNumber; - gridColor?: BaseAxisNoValueRefs['gridColor'] | ConditionalAxisColor | SignalRef; - gridDash?: BaseAxisNoValueRefs['gridDash'] | ConditionalAxisNumberArray; - gridDashOffset?: BaseAxisNoValueRefs['gridDashOffset'] | ConditionalAxisNumber; - gridOpacity?: BaseAxisNoValueRefs['gridOpacity'] | ConditionalAxisNumber; - gridWidth?: BaseAxisNoValueRefs['gridWidth'] | ConditionalAxisNumber; - tickColor?: BaseAxisNoValueRefs['tickColor'] | ConditionalAxisColor | SignalRef; - tickDash?: BaseAxisNoValueRefs['tickDash'] | ConditionalAxisNumberArray; - tickDashOffset?: BaseAxisNoValueRefs['tickDashOffset'] | ConditionalAxisNumber; - tickOpacity?: BaseAxisNoValueRefs['tickOpacity'] | ConditionalAxisNumber; - tickSize?: BaseAxisNoValueRefs['tickSize'] | ConditionalAxisNumber; - tickWidth?: BaseAxisNoValueRefs['tickWidth'] | ConditionalAxisNumber; - titleColor?: BaseAxisNoValueRefs['titleColor'] | SignalRef; - title?: TitleMixins['title']; -} - -export type AxisConfig = Guide & - VlOnlyGuideConfig & - AxisConfigBaseWithConditionalAndSignal & { - /** - * Disable axis by default. - */ - disable?: boolean; - }; - -export interface Axis extends AxisConfigBaseWithConditionalAndSignal, Guide { - /** - * Mark definitions for custom axis encoding. - * - * @hidden - */ - encoding?: AxisEncoding; -} - -export type AxisPart = keyof AxisEncoding; -export const AXIS_PARTS: AxisPart[] = ['domain', 'grid', 'labels', 'ticks', 'title']; - -/** - * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes. - */ -export const AXIS_PROPERTY_TYPE: Record = { - grid: 'grid', - gridCap: 'grid', - gridColor: 'grid', - gridDash: 'grid', - gridDashOffset: 'grid', - gridOpacity: 'grid', - gridScale: 'grid', - gridWidth: 'grid', - - orient: 'main', - - bandPosition: 'both', // Need to be applied to grid axis too, so the grid will align with ticks. - - aria: 'main', - description: 'main', - domain: 'main', - domainCap: 'main', - domainColor: 'main', - domainDash: 'main', - domainDashOffset: 'main', - domainOpacity: 'main', - domainWidth: 'main', - format: 'main', - formatType: 'main', - labelAlign: 'main', - labelAngle: 'main', - labelBaseline: 'main', - labelBound: 'main', - labelColor: 'main', - labelFlush: 'main', - labelFlushOffset: 'main', - labelFont: 'main', - labelFontSize: 'main', - labelFontStyle: 'main', - labelFontWeight: 'main', - labelLimit: 'main', - labelLineHeight: 'main', - labelOffset: 'main', - labelOpacity: 'main', - labelOverlap: 'main', - labelPadding: 'main', - labels: 'main', - labelSeparation: 'main', - maxExtent: 'main', - minExtent: 'main', - offset: 'both', - position: 'main', - tickCap: 'main', - tickColor: 'main', - tickDash: 'main', - tickDashOffset: 'main', - tickMinStep: 'main', - tickOffset: 'both', // Need to be applied to grid axis too, so the grid will align with ticks. - tickOpacity: 'main', - tickRound: 'both', // Apply rounding to grid and ticks so they are aligned. - ticks: 'main', - tickSize: 'main', - tickWidth: 'both', - title: 'main', - titleAlign: 'main', - titleAnchor: 'main', - titleAngle: 'main', - titleBaseline: 'main', - titleColor: 'main', - titleFont: 'main', - titleFontSize: 'main', - titleFontStyle: 'main', - titleFontWeight: 'main', - titleLimit: 'main', - titleLineHeight: 'main', - titleOpacity: 'main', - titlePadding: 'main', - titleX: 'main', - titleY: 'main', - - encode: 'both', // we hide this in Vega-Lite - scale: 'both', - tickBand: 'both', - tickCount: 'both', - tickExtra: 'both', - translate: 'both', - values: 'both', - zindex: 'both' // this is actually set afterward, so it doesn't matter -}; - -export interface AxisEncoding { - /** - * Custom encoding for the axis container. - */ - axis?: GuideEncodingEntry; - - /** - * Custom encoding for the axis domain rule mark. - */ - domain?: GuideEncodingEntry; - - /** - * Custom encoding for axis gridline rule marks. - */ - grid?: GuideEncodingEntry; - - /** - * Custom encoding for axis label text marks. - */ - labels?: GuideEncodingEntry; - - /** - * Custom encoding for axis tick rule marks. - */ - ticks?: GuideEncodingEntry; - - /** - * Custom encoding for the axis title text mark. - */ - title?: GuideEncodingEntry; -} - -export const COMMON_AXIS_PROPERTIES_INDEX: Flag = { - orient: 1, // other things can depend on orient - - aria: 1, - bandPosition: 1, - description: 1, - domain: 1, - domainCap: 1, - domainColor: 1, - domainDash: 1, - domainDashOffset: 1, - domainOpacity: 1, - domainWidth: 1, - format: 1, - formatType: 1, - grid: 1, - gridCap: 1, - gridColor: 1, - gridDash: 1, - gridDashOffset: 1, - gridOpacity: 1, - gridWidth: 1, - labelAlign: 1, - labelAngle: 1, - labelBaseline: 1, - labelBound: 1, - labelColor: 1, - labelFlush: 1, - labelFlushOffset: 1, - labelFont: 1, - labelFontSize: 1, - labelFontStyle: 1, - labelFontWeight: 1, - labelLimit: 1, - labelLineHeight: 1, - labelOffset: 1, - labelOpacity: 1, - labelOverlap: 1, - labelPadding: 1, - labels: 1, - labelSeparation: 1, - maxExtent: 1, - minExtent: 1, - offset: 1, - position: 1, - tickBand: 1, - tickCap: 1, - tickColor: 1, - tickCount: 1, - tickDash: 1, - tickDashOffset: 1, - tickExtra: 1, - tickMinStep: 1, - tickOffset: 1, - tickOpacity: 1, - tickRound: 1, - ticks: 1, - tickSize: 1, - tickWidth: 1, - title: 1, - titleAlign: 1, - titleAnchor: 1, - titleAngle: 1, - titleBaseline: 1, - titleColor: 1, - titleFont: 1, - titleFontSize: 1, - titleFontStyle: 1, - titleFontWeight: 1, - titleLimit: 1, - titleLineHeight: 1, - titleOpacity: 1, - titlePadding: 1, - titleX: 1, - titleY: 1, - translate: 1, - values: 1, - zindex: 1 -}; - -const AXIS_PROPERTIES_INDEX: Flag = { - ...COMMON_AXIS_PROPERTIES_INDEX, - style: 1, - labelExpr: 1, - encoding: 1 -}; - -export function isAxisProperty(prop: string): prop is keyof Axis { - return !!AXIS_PROPERTIES_INDEX[prop]; -} - -// Export for dependent projects -export const AXIS_PROPERTIES = keys(AXIS_PROPERTIES_INDEX); - -export interface AxisConfigMixins { - /** - * Axis configuration, which determines default properties for all `x` and `y` [axes](https://vega.github.io/vega-lite/docs/axis.html). For a full list of axis configuration options, please see the [corresponding section of the axis documentation](https://vega.github.io/vega-lite/docs/axis.html#config). - */ - axis?: AxisConfig; - - /** - * X-axis specific config. - */ - axisX?: AxisConfig; - - /** - * Y-axis specific config. - */ - axisY?: AxisConfig; - - /** - * Config for y-axis along the left edge of the chart. - */ - axisLeft?: AxisConfig; - - /** - * Config for y-axis along the right edge of the chart. - */ - axisRight?: AxisConfig; - - /** - * Config for x-axis along the top edge of the chart. - */ - axisTop?: AxisConfig; - - /** - * Config for x-axis along the bottom edge of the chart. - */ - axisBottom?: AxisConfig; - - /** - * Config for axes with "band" scales. - */ - axisBand?: AxisConfig; - - /** - * Config for axes with "point" scales. - */ - axisPoint?: AxisConfig; - - /** - * Config for axes with "point" or "band" scales. - */ - axisDiscrete?: AxisConfig; - - /** - * Config for quantitative axes. - */ - axisQuantitative?: AxisConfig; - - /** - * Config for temporal axes. - */ - axisTemporal?: AxisConfig; - - /** - * Config for x-axes with "band" scales. - */ - axisXBand?: AxisConfig; - - /** - * Config for x-axes with "point" scales. - */ - axisXPoint?: AxisConfig; - - /** - * Config for x-axes with "point" or "band" scales. - */ - axisXDiscrete?: AxisConfig; - - /** - * Config for x-quantitative axes. - */ - axisXQuantitative?: AxisConfig; - - /** - * Config for x-temporal axes. - */ - axisXTemporal?: AxisConfig; - - /** - * Config for y-axes with "band" scales. - */ - axisYBand?: AxisConfig; - - /** - * Config for y-axes with "point" scales. - */ - axisYPoint?: AxisConfig; - - /** - * Config for y-axes with "point" or "band" scales. - */ - axisYDiscrete?: AxisConfig; - - /** - * Config for y-quantitative axes. - */ - axisYQuantitative?: AxisConfig; - - /** - * Config for y-temporal axes. - */ - axisYTemporal?: AxisConfig; -} diff --git a/node_modules/vega-lite/src/bin.ts b/node_modules/vega-lite/src/bin.ts deleted file mode 100644 index 6124d4c..0000000 --- a/node_modules/vega-lite/src/bin.ts +++ /dev/null @@ -1,151 +0,0 @@ -import {isBoolean, isObject} from 'vega-util'; -import { - COLOR, - COLUMN, - ExtendedChannel, - FILL, - FILLOPACITY, - OPACITY, - ROW, - SHAPE, - SIZE, - STROKE, - STROKEDASH, - STROKEOPACITY, - STROKEWIDTH -} from './channel'; -import {normalizeBin} from './channeldef'; -import {SelectionExtent} from './selection'; -import {keys, varName} from './util'; - -export interface BaseBin { - /** - * The number base to use for automatic bin determination (default is base 10). - * - * __Default value:__ `10` - * - */ - base?: number; - /** - * An exact step size to use between bins. - * - * __Note:__ If provided, options such as maxbins will be ignored. - */ - step?: number; - /** - * An array of allowable step sizes to choose from. - * @minItems 1 - */ - steps?: number[]; - /** - * A minimum allowable step size (particularly useful for integer values). - */ - minstep?: number; - /** - * Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints. - * - * __Default value:__ `[5, 2]` - * - * @minItems 1 - */ - divide?: [number, number]; - /** - * Maximum number of bins. - * - * __Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels - * - * @minimum 2 - */ - maxbins?: number; - /** - * A value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value. - * - * __Default value:__ the minimum bin extent value - */ - anchor?: number; - /** - * If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten. - * - * __Default value:__ `true` - */ - nice?: boolean; -} - -/** - * Binning properties or boolean flag for determining whether to bin data or not. - */ -export interface BinParams extends BaseBin { - /** - * A two-element (`[min, max]`) array indicating the range of desired bin values. - */ - extent?: BinExtent; // VgBinTransform uses a different extent so we need to pull this out. - - /** - * When set to `true`, Vega-Lite treats the input data as already binned. - */ - binned?: boolean; -} - -export type Bin = boolean | BinParams | 'binned' | null; - -export type BinExtent = [number, number] | SelectionExtent; - -/** - * Create a key for the bin configuration. Not for prebinned bin. - */ -export function binToString(bin: BinParams | true) { - if (isBoolean(bin)) { - bin = normalizeBin(bin, undefined); - } - return ( - 'bin' + - keys(bin) - .map(p => (isSelectionExtent(bin[p]) ? varName(`_${p}_${Object.entries(bin[p])}`) : varName(`_${p}_${bin[p]}`))) - .join('') - ); -} - -/** - * Vega-Lite should bin the data. - */ -export function isBinning(bin: BinParams | boolean | 'binned'): bin is BinParams | true { - return bin === true || (isBinParams(bin) && !bin.binned); -} - -/** - * The data is already binned and so Vega-Lite should not bin it again. - */ -export function isBinned(bin: BinParams | boolean | 'binned'): bin is 'binned' | BinParams { - return bin === 'binned' || (isBinParams(bin) && bin.binned === true); -} - -export function isBinParams(bin: BinParams | boolean | 'binned'): bin is BinParams { - return isObject(bin); -} - -export function isSelectionExtent(extent: BinExtent): extent is SelectionExtent { - return extent?.['selection']; -} - -export function autoMaxBins(channel?: ExtendedChannel): number { - switch (channel) { - case ROW: - case COLUMN: - case SIZE: - case COLOR: - case FILL: - case STROKE: - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - // Facets and Size shouldn't have too many bins - // We choose 6 like shape to simplify the rule [falls through] - case SHAPE: - return 6; // Vega's "shape" has 6 distinct values - case STROKEDASH: - return 4; // We only provide 5 different stroke dash values (but 4 is more effective) - default: - return 10; - } -} diff --git a/node_modules/vega-lite/src/channel.ts b/node_modules/vega-lite/src/channel.ts deleted file mode 100644 index 36980c2..0000000 --- a/node_modules/vega-lite/src/channel.ts +++ /dev/null @@ -1,620 +0,0 @@ -/* - * Constants and utilities for encoding channels (Visual variables) - * such as 'x', 'y', 'color'. - */ - -import {RangeType} from './compile/scale/type'; -import {Encoding} from './encoding'; -import {Mark} from './mark'; -import {EncodingFacetMapping} from './spec/facet'; -import {Flag, keys} from './util'; - -export type Channel = keyof Encoding; -export type ExtendedChannel = Channel | FacetChannel; - -// Facet -export const ROW = 'row' as const; -export const COLUMN = 'column' as const; - -export const FACET = 'facet' as const; - -// Position -export const X = 'x' as const; -export const Y = 'y' as const; -export const X2 = 'x2' as const; -export const Y2 = 'y2' as const; - -// Arc-Position -export const RADIUS = 'radius' as const; -export const RADIUS2 = 'radius2' as const; -export const THETA = 'theta' as const; -export const THETA2 = 'theta2' as const; - -// Geo Position -export const LATITUDE = 'latitude' as const; -export const LONGITUDE = 'longitude' as const; -export const LATITUDE2 = 'latitude2' as const; -export const LONGITUDE2 = 'longitude2' as const; - -// Mark property with scale -export const COLOR = 'color' as const; - -export const FILL = 'fill' as const; - -export const STROKE = 'stroke' as const; - -export const SHAPE = 'shape' as const; -export const SIZE = 'size' as const; - -export const ANGLE = 'angle' as const; - -export const OPACITY = 'opacity' as const; -export const FILLOPACITY = 'fillOpacity' as const; - -export const STROKEOPACITY = 'strokeOpacity' as const; - -export const STROKEWIDTH = 'strokeWidth' as const; -export const STROKEDASH = 'strokeDash' as const; - -// Non-scale channel -export const TEXT = 'text' as const; -export const ORDER = 'order' as const; -export const DETAIL = 'detail' as const; -export const KEY = 'key' as const; - -export const TOOLTIP = 'tooltip' as const; -export const HREF = 'href' as const; - -export const URL = 'url' as const; -export const DESCRIPTION = 'description' as const; - -const POSITION_CHANNEL_INDEX = { - x: 1, - y: 1, - x2: 1, - y2: 1 -} as const; - -export type PositionChannel = keyof typeof POSITION_CHANNEL_INDEX; - -const POLAR_POSITION_CHANNEL_INDEX = { - theta: 1, - theta2: 1, - radius: 1, - radius2: 1 -} as const; - -export type PolarPositionChannel = keyof typeof POLAR_POSITION_CHANNEL_INDEX; - -export function isPolarPositionChannel(c: Channel): c is PolarPositionChannel { - return c in POLAR_POSITION_CHANNEL_INDEX; -} - -const GEO_POSIITON_CHANNEL_INDEX = { - longitude: 1, - longitude2: 1, - latitude: 1, - latitude2: 1 -} as const; - -export type GeoPositionChannel = keyof typeof GEO_POSIITON_CHANNEL_INDEX; - -export function getPositionChannelFromLatLong(channel: GeoPositionChannel): PositionChannel { - switch (channel) { - case LATITUDE: - return 'y'; - case LATITUDE2: - return 'y2'; - case LONGITUDE: - return 'x'; - case LONGITUDE2: - return 'x2'; - } -} - -export function isGeoPositionChannel(c: Channel): c is GeoPositionChannel { - return c in GEO_POSIITON_CHANNEL_INDEX; -} - -export const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX); - -const UNIT_CHANNEL_INDEX: Flag = { - ...POSITION_CHANNEL_INDEX, - ...POLAR_POSITION_CHANNEL_INDEX, - - ...GEO_POSIITON_CHANNEL_INDEX, - - // color - color: 1, - fill: 1, - stroke: 1, - - // other non-position with scale - opacity: 1, - fillOpacity: 1, - strokeOpacity: 1, - - strokeWidth: 1, - strokeDash: 1, - size: 1, - angle: 1, - shape: 1, - - // channels without scales - order: 1, - text: 1, - detail: 1, - key: 1, - tooltip: 1, - href: 1, - url: 1, - description: 1 -}; - -export type ColorChannel = 'color' | 'fill' | 'stroke'; - -export function isColorChannel(channel: Channel): channel is ColorChannel { - return channel === COLOR || channel === FILL || channel === STROKE; -} - -export type FacetChannel = keyof EncodingFacetMapping; - -const FACET_CHANNEL_INDEX: Flag> = { - row: 1, - column: 1, - facet: 1 -}; - -export const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX); - -const CHANNEL_INDEX = { - ...UNIT_CHANNEL_INDEX, - ...FACET_CHANNEL_INDEX -}; - -export const CHANNELS = keys(CHANNEL_INDEX); - -const {order: _o, detail: _d, tooltip: _tt1, ...SINGLE_DEF_CHANNEL_INDEX} = CHANNEL_INDEX; -const {row: _r, column: _c, facet: _f, ...SINGLE_DEF_UNIT_CHANNEL_INDEX} = SINGLE_DEF_CHANNEL_INDEX; -/** - * Channels that cannot have an array of channelDef. - * model.fieldDef, getFieldDef only work for these channels. - * - * (The only two channels that can have an array of channelDefs are "detail" and "order". - * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef - * are not applicable for them. Similarly, selection projection won't work with "detail" and "order".) - */ - -export const SINGLE_DEF_CHANNELS = keys(SINGLE_DEF_CHANNEL_INDEX); - -export type SingleDefChannel = typeof SINGLE_DEF_CHANNELS[number]; - -export const SINGLE_DEF_UNIT_CHANNELS = keys(SINGLE_DEF_UNIT_CHANNEL_INDEX); - -export type SingleDefUnitChannel = typeof SINGLE_DEF_UNIT_CHANNELS[number]; - -export function isSingleDefUnitChannel(str: string): str is SingleDefUnitChannel { - return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str]; -} - -export function isChannel(str: string): str is Channel { - return !!CHANNEL_INDEX[str]; -} - -export type SecondaryRangeChannel = 'x2' | 'y2' | 'latitude2' | 'longitude2' | 'theta2' | 'radius2'; - -export const SECONDARY_RANGE_CHANNEL: SecondaryRangeChannel[] = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2]; - -export function isSecondaryRangeChannel(c: ExtendedChannel): c is SecondaryRangeChannel { - const main = getMainRangeChannel(c); - return main !== c; -} - -export type MainChannelOf = C extends 'x2' - ? 'x' - : C extends 'y2' - ? 'y' - : C extends 'latitude2' - ? 'latitude' - : C extends 'longitude2' - ? 'longitude' - : C extends 'theta2' - ? 'theta' - : C extends 'radius2' - ? 'radius' - : C; - -/** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ -export function getMainRangeChannel(channel: C): MainChannelOf { - switch (channel) { - case X2: - return X as MainChannelOf; - case Y2: - return Y as MainChannelOf; - case LATITUDE2: - return LATITUDE as MainChannelOf; - case LONGITUDE2: - return LONGITUDE as MainChannelOf; - case THETA2: - return THETA as MainChannelOf; - case RADIUS2: - return RADIUS as MainChannelOf; - } - return channel as MainChannelOf; -} - -export type SecondaryChannelOf = C extends 'x' - ? 'x2' - : C extends 'y' - ? 'y2' - : C extends 'latitude' - ? 'latitude2' - : C extends 'longitude' - ? 'longitude2' - : C extends 'theta' - ? 'theta2' - : C extends 'radius' - ? 'radius2' - : undefined; - -export function getVgPositionChannel(channel: PolarPositionChannel | PositionChannel) { - if (isPolarPositionChannel(channel)) { - switch (channel) { - case THETA: - return 'startAngle'; - case THETA2: - return 'endAngle'; - case RADIUS: - return 'outerRadius'; - case RADIUS2: - return 'innerRadius'; - } - } - return channel; -} - -/** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ -export function getSecondaryRangeChannel(channel: C): SecondaryChannelOf | undefined { - switch (channel) { - case X: - return X2 as SecondaryChannelOf; - case Y: - return Y2 as SecondaryChannelOf; - case LATITUDE: - return LATITUDE2 as SecondaryChannelOf; - case LONGITUDE: - return LONGITUDE2 as SecondaryChannelOf; - case THETA: - return THETA2 as SecondaryChannelOf; - case RADIUS: - return RADIUS2 as SecondaryChannelOf; - } - return undefined; -} - -export function getSizeChannel(channel: PositionChannel): 'width' | 'height'; -export function getSizeChannel(channel: Channel): 'width' | 'height' | undefined; -export function getSizeChannel(channel: Channel): 'width' | 'height' | undefined { - switch (channel) { - case X: - case X2: - return 'width'; - case Y: - case Y2: - return 'height'; - } - return undefined; -} - -/** - * Get the main channel for a range channel. E.g. `x` for `x2`. - */ -export function getOffsetChannel(channel: Channel) { - switch (channel) { - case X: - return 'xOffset'; - case Y: - return 'yOffset'; - case X2: - return 'x2Offset'; - case Y2: - return 'y2Offset'; - case THETA: - return 'thetaOffset'; - case RADIUS: - return 'radiusOffset'; - case THETA2: - return 'theta2Offset'; - case RADIUS2: - return 'radius2Offset'; - } - return undefined; -} - -// CHANNELS without COLUMN, ROW -export const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX); - -// NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2; -const { - x: _x, - y: _y, - // x2 and y2 share the same scale as x and y - x2: _x2, - y2: _y2, - latitude: _latitude, - longitude: _longitude, - latitude2: _latitude2, - longitude2: _longitude2, - theta: _theta, - theta2: _theta2, - radius: _radius, - radius2: _radius2, - // The rest of unit channels then have scale - ...NONPOSITION_CHANNEL_INDEX -} = UNIT_CHANNEL_INDEX; - -export const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX); -export type NonPositionChannel = typeof NONPOSITION_CHANNELS[number]; - -export const POSITION_SCALE_CHANNEL_INDEX = { - x: 1, - y: 1 -} as const; -export const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX); -export type PositionScaleChannel = keyof typeof POSITION_SCALE_CHANNEL_INDEX; - -export function isXorY(channel: ExtendedChannel): channel is PositionScaleChannel { - return channel in POSITION_SCALE_CHANNEL_INDEX; -} - -export const POLAR_POSITION_SCALE_CHANNEL_INDEX = { - theta: 1, - radius: 1 -} as const; - -export const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX); -export type PolarPositionScaleChannel = keyof typeof POLAR_POSITION_SCALE_CHANNEL_INDEX; - -export function getPositionScaleChannel(sizeType: 'width' | 'height'): PositionScaleChannel { - return sizeType === 'width' ? X : Y; -} - -// NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without X, Y -const { - // x2 and y2 share the same scale as x and y - // text and tooltip have format instead of scale, - // href has neither format, nor scale - text: _t, - tooltip: _tt, - href: _hr, - url: _u, - description: _al, - // detail and order have no scale - detail: _dd, - key: _k, - order: _oo, - ...NONPOSITION_SCALE_CHANNEL_INDEX -} = NONPOSITION_CHANNEL_INDEX; -export const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX); -export type NonPositionScaleChannel = typeof NONPOSITION_SCALE_CHANNELS[number]; - -export function isNonPositionScaleChannel(channel: Channel): channel is NonPositionScaleChannel { - return !!NONPOSITION_CHANNEL_INDEX[channel]; -} - -/** - * @returns whether Vega supports legends for a particular channel - */ -export function supportLegend(channel: NonPositionScaleChannel) { - switch (channel) { - case COLOR: - case FILL: - case STROKE: - case SIZE: - case SHAPE: - case OPACITY: - case STROKEWIDTH: - case STROKEDASH: - return true; - case FILLOPACITY: - case STROKEOPACITY: - case ANGLE: - return false; - } -} - -// Declare SCALE_CHANNEL_INDEX -const SCALE_CHANNEL_INDEX = { - ...POSITION_SCALE_CHANNEL_INDEX, - ...POLAR_POSITION_SCALE_CHANNEL_INDEX, - ...NONPOSITION_SCALE_CHANNEL_INDEX -}; - -/** List of channels with scales */ -export const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX); -export type ScaleChannel = typeof SCALE_CHANNELS[number]; - -export function isScaleChannel(channel: Channel): channel is ScaleChannel { - return !!SCALE_CHANNEL_INDEX[channel]; -} - -export type SupportedMark = Partial>; - -/** - * Return whether a channel supports a particular mark type. - * @param channel channel name - * @param mark the mark type - * @return whether the mark supports the channel - */ -export function supportMark(channel: Channel, mark: Mark) { - return getSupportedMark(channel)[mark]; -} - -const ALL_MARKS: Record = { - // all marks - arc: 'always', - area: 'always', - bar: 'always', - circle: 'always', - geoshape: 'always', - image: 'always', - line: 'always', - rule: 'always', - point: 'always', - rect: 'always', - square: 'always', - trail: 'always', - text: 'always', - tick: 'always' -}; - -const {geoshape: _g, ...ALL_MARKS_EXCEPT_GEOSHAPE} = ALL_MARKS; - -/** - * Return a dictionary showing whether a channel supports mark type. - * @param channel - * @return A dictionary mapping mark types to 'always', 'binned', or undefined - */ -function getSupportedMark(channel: ExtendedChannel): SupportedMark { - switch (channel) { - case COLOR: - case FILL: - case STROKE: - // falls through - - case DESCRIPTION: - case DETAIL: - case KEY: - case TOOLTIP: - case HREF: - case ORDER: // TODO: revise (order might not support rect, which is not stackable?) - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEWIDTH: - - // falls through - - case FACET: - case ROW: // falls through - case COLUMN: - return ALL_MARKS; - case X: - case Y: - case LATITUDE: - case LONGITUDE: - // all marks except geoshape. geoshape does not use X, Y -- it uses a projection - return ALL_MARKS_EXCEPT_GEOSHAPE; - case X2: - case Y2: - case LATITUDE2: - case LONGITUDE2: - return { - area: 'always', - bar: 'always', - image: 'always', - rect: 'always', - rule: 'always', - circle: 'binned', - point: 'binned', - square: 'binned', - tick: 'binned', - line: 'binned', - trail: 'binned' - }; - case SIZE: - return { - point: 'always', - tick: 'always', - rule: 'always', - circle: 'always', - square: 'always', - bar: 'always', - text: 'always', - line: 'always', - trail: 'always' - }; - case STROKEDASH: - return { - line: 'always', - point: 'always', - tick: 'always', - rule: 'always', - circle: 'always', - square: 'always', - bar: 'always', - geoshape: 'always' - }; - case SHAPE: - return {point: 'always', geoshape: 'always'}; - case TEXT: - return {text: 'always'}; - case ANGLE: - return {point: 'always', square: 'always', text: 'always'}; - case URL: - return {image: 'always'}; - case THETA: - return {text: 'always', arc: 'always'}; - case RADIUS: - return {text: 'always', arc: 'always'}; - case THETA2: - case RADIUS2: - return {arc: 'always'}; - } -} - -export function rangeType(channel: ExtendedChannel): RangeType { - switch (channel) { - case X: - case Y: - case THETA: - case RADIUS: - case SIZE: - case ANGLE: - case STROKEWIDTH: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - - // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through] - case X2: - case Y2: - case THETA2: - case RADIUS2: - return undefined; - - case FACET: - case ROW: - case COLUMN: - case SHAPE: - case STROKEDASH: - // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through] - case TEXT: - case TOOLTIP: - case HREF: - case URL: - case DESCRIPTION: - return 'discrete'; - - // Color can be either continuous or discrete, depending on scale type. - case COLOR: - case FILL: - case STROKE: - return 'flexible'; - - // No scale, no range type. - - case LATITUDE: - case LONGITUDE: - case LATITUDE2: - case LONGITUDE2: - case DETAIL: - case KEY: - case ORDER: - return undefined; - } -} diff --git a/node_modules/vega-lite/src/channeldef.ts b/node_modules/vega-lite/src/channeldef.ts deleted file mode 100644 index 06a6b33..0000000 --- a/node_modules/vega-lite/src/channeldef.ts +++ /dev/null @@ -1,1347 +0,0 @@ -import {Gradient, SignalRef, Text} from 'vega'; -import {isArray, isBoolean, isNumber, isString} from 'vega-util'; -import {Aggregate, isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp} from './aggregate'; -import {Axis} from './axis'; -import {autoMaxBins, Bin, BinParams, binToString, isBinned, isBinning} from './bin'; -import { - ANGLE, - Channel, - COLOR, - COLUMN, - DESCRIPTION, - DETAIL, - FACET, - FILL, - FILLOPACITY, - HREF, - isScaleChannel, - isSecondaryRangeChannel, - isXorY, - KEY, - LATITUDE, - LATITUDE2, - LONGITUDE, - LONGITUDE2, - OPACITY, - ORDER, - RADIUS, - RADIUS2, - ROW, - SHAPE, - SIZE, - STROKE, - STROKEDASH, - STROKEOPACITY, - STROKEWIDTH, - TEXT, - THETA, - THETA2, - TOOLTIP, - URL, - X, - X2, - Y, - Y2, - ExtendedChannel -} from './channel'; -import {getMarkConfig} from './compile/common'; -import {isCustomFormatType} from './compile/format'; -import {CompositeAggregate} from './compositemark'; -import {Config} from './config'; -import {DateTime, dateTimeToExpr, isDateTime} from './datetime'; -import {Encoding} from './encoding'; -import {FormatMixins, Guide, GuideEncodingConditionalValueDef, TitleMixins} from './guide'; -import {ImputeParams} from './impute'; -import {Legend} from './legend'; -import * as log from './log'; -import {LogicalComposition} from './logical'; -import {isRectBasedMark, MarkDef} from './mark'; -import {Predicate} from './predicate'; -import {Scale, SCALE_CATEGORY_INDEX} from './scale'; -import {isSortByChannel, Sort, SortOrder} from './sort'; -import {isFacetFieldDef} from './spec/facet'; -import {StackOffset, StackProperties} from './stack'; -import { - getTimeUnitParts, - isLocalSingleTimeUnit, - normalizeTimeUnit, - TimeUnit, - TimeUnitParams, - timeUnitToString -} from './timeunit'; -import {AggregatedFieldDef, WindowFieldDef} from './transform'; -import {getFullName, QUANTITATIVE, StandardType, Type} from './type'; -import { - contains, - flatAccessWithDatum, - getFirstDefined, - internalField, - omit, - removePathFromField, - replacePathInField, - titleCase -} from './util'; -import {isSignalRef} from './vega.schema'; - -export type PrimitiveValue = number | string | boolean | null; - -export type Value = PrimitiveValue | number[] | Gradient | Text | SignalRef; - -/** - * Definition object for a constant value (primitive value or gradient definition) of an encoding channel. - */ -export interface ValueDef { - /** - * A constant value in visual domain (e.g., `"red"` / `"#0099ff"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity). - */ - value: V; -} - -export type PositionValueDef = ValueDef; - -export type NumericValueDef = ValueDef; - -/** - * A ValueDef with Condition where either the condition or the value are optional. - * { - * condition: {field: ...} | {value: ...}, - * value: ..., - * } - */ - -/** - * @minProperties 1 - */ -export type ValueDefWithCondition | DatumDef, V extends Value = Value> = Partial< - ValueDef -> & { - /** - * A field definition or one or more value definition(s) with a selection predicate. - */ - condition?: Conditional | Conditional> | Conditional>[]; -}; - -export type StringValueDefWithCondition = ValueDefWithCondition< - MarkPropFieldOrDatumDef, - string | null ->; -export type TypeForShape = 'nominal' | 'ordinal' | 'geojson'; - -export type Conditional | DatumDef | ValueDef | SignalRef> = - | ConditionalPredicate - | ConditionalSelection; - -export type ConditionalPredicate | DatumDef | ValueDef | SignalRef> = { - /** - * Predicate for triggering the condition - */ - test: LogicalComposition; -} & CD; - -export type ConditionalSelection | DatumDef | ValueDef | SignalRef> = { - /** - * A [selection name](https://vega.github.io/vega-lite/docs/selection.html), or a series of [composed selections](https://vega.github.io/vega-lite/docs/selection.html#compose). - */ - selection: LogicalComposition; -} & CD; - -export function isConditionalSelection(c: Conditional): c is ConditionalSelection { - return c['selection']; -} - -export interface ConditionValueDefMixins { - /** - * One or more value definition(s) with [a selection or a test predicate](https://vega.github.io/vega-lite/docs/condition.html). - * - * __Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value) - * since Vega-Lite only allows at most one encoded field per encoding channel. - */ - condition?: Conditional> | Conditional>[]; -} - -/** - * A FieldDef with Condition - * { - * condition: {value: ...}, - * field: ..., - * ... - * } - */ - -export type FieldOrDatumDefWithCondition | DatumDef, V extends Value = Value> = F & - ConditionValueDefMixins; - -export type MarkPropDef = - | FieldOrDatumDefWithCondition, V> - | FieldOrDatumDefWithCondition, V> - | ValueDefWithCondition, V>; - -export type ColorDef = MarkPropDef; -export type NumericMarkPropDef = MarkPropDef; - -export type NumericArrayMarkPropDef = MarkPropDef; - -export type ShapeDef = MarkPropDef; - -export type StringFieldDefWithCondition = FieldOrDatumDefWithCondition, string>; -export type TextDef = - | FieldOrDatumDefWithCondition, Text> - | FieldOrDatumDefWithCondition, Text> - | ValueDefWithCondition, Text>; - -/** - * A ValueDef with optional Condition - * { - * condition: {field: ...} | {value: ...}, - * value: ..., - * } - */ - -/** - * Reference to a repeated value. - */ -export interface RepeatRef { - repeat: 'row' | 'column' | 'repeat' | 'layer'; -} - -export type FieldName = string; -export type Field = FieldName | RepeatRef; - -export function isRepeatRef(field: Field | any): field is RepeatRef { - return field && !isString(field) && 'repeat' in field; -} - -/** @@hidden */ -export type HiddenCompositeAggregate = CompositeAggregate; - -export interface FieldDefBase extends BandMixins { - /** - * __Required.__ A string defining the name of the field from which to pull a data value - * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. - * - * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. - * - * __Notes:__ - * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). - * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). - * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). - * 2) `field` is not required if `aggregate` is `count`. - */ - field?: F; - - // function - - /** - * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. - * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. - */ - timeUnit?: TimeUnit | TimeUnitParams; - - /** - * Aggregation function for the field - * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). - * - * __Default value:__ `undefined` (None) - * - * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. - */ - aggregate?: Aggregate | HiddenCompositeAggregate; - - /** - * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#params), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). - * - * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html) will be applied. - * - * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. - * - * __Default value:__ `false` - * - * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. - */ - bin?: B; -} - -export function toFieldDefBase(fieldDef: FieldDef): FieldDefBase { - const {field, timeUnit, bin, aggregate} = fieldDef; - return { - ...(timeUnit ? {timeUnit} : {}), - ...(bin ? {bin} : {}), - ...(aggregate ? {aggregate} : {}), - field - }; -} - -export interface TypeMixins { - /** - * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). - * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). - * - * Since Vega-Lite 4.14.0, Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: - * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` - * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. - * - * __Default value:__ - * - * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: - * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). - * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale - * - `ordinal""` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order) or (2) the specified scale type is an ordinal/point/band scale. - * - * 2) For a constant value in data domain (`datum`): - * - `"quantitative"` if the datum is a number - * - `"nominal"` if the datum is a string - * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) - * - * __Note:__ - * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. - * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). - * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). - * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. - * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). - * - * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. - */ - type?: T; -} - -/** - * Definition object for a data field, its type and transformation of an encoding channel. - */ -export type TypedFieldDef< - F extends Field, - T extends Type = any, - B extends Bin = boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types -> = FieldDefBase & TitleMixins & TypeMixins; - -export interface SortableFieldDef< - F extends Field, - T extends Type = StandardType, - B extends Bin = boolean | BinParams | null -> extends TypedFieldDef { - /** - * Sort order for the encoded field. - * - * For continuous fields (quantitative or temporal), `sort` can be either `"ascending"` or `"descending"`. - * - * For discrete fields, `sort` can be one of the following: - * - `"ascending"` or `"descending"` -- for sorting by the values' natural order in JavaScript. - * - [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `"x"` or `"y"`) with an optional minus prefix for descending sort (e.g., `"-x"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `"sort": "-x"` is equivalent to `"sort": {"encoding": "x", "order": "descending"}`. - * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field. - * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `"month"` and `"day"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `"Mon"`, `"Tue"`). - * - `null` indicating no sort. - * - * __Default value:__ `"ascending"` - * - * __Note:__ `null` and sorting by another channel is not supported for `row` and `column`. - * - * __See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation. - */ - sort?: Sort; -} - -export function isSortableFieldDef(fieldDef: FieldDef): fieldDef is SortableFieldDef { - return 'sort' in fieldDef; -} - -export type ScaleFieldDef< - F extends Field, - T extends Type = StandardType, - B extends Bin = boolean | BinParams | null -> = SortableFieldDef & ScaleMixins; - -export interface ScaleMixins { - /** - * An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels. - * - * If `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable). - * - * __Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied. - * - * __See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation. - */ - scale?: Scale | null; -} - -export interface DatumDef< - F extends Field = string, - V extends PrimitiveValue | DateTime | SignalRef = PrimitiveValue | DateTime | SignalRef -> extends Partial>, BandMixins { - /** - * A constant value in data domain. - */ - datum?: F extends RepeatRef ? V | RepeatRef : V; - // only apply Repeatref if field (F) can be RepeatRef - // FIXME(https://github.com/microsoft/TypeScript/issues/37586): - // `F extends RepeatRef` probably should be `RepeatRef extends F` but there is likely a bug in TS. -} - -export type StringDatumDef = DatumDef & FormatMixins; - -export type ScaleDatumDef = ScaleMixins & DatumDef; - -/** - * A field definition of a secondary channel that shares a scale with another primary channel. For example, `x2`, `xError` and `xError2` share the same scale with `x`. - */ -export type SecondaryFieldDef = FieldDefBase & TitleMixins; // x2/y2 shouldn't have bin, but we keep bin property for simplicity of the codebase. - -export type Position2Def = SecondaryFieldDef | DatumDef | PositionValueDef; - -export type SecondaryChannelDef = Encoding['x2' | 'y2']; - -/** - * Field Def without scale (and without bin: "binned" support). - */ -export type FieldDefWithoutScale = TypedFieldDef; - -export type LatLongFieldDef = FieldDefBase & - TitleMixins & - Partial>; // Lat long shouldn't have bin, but we keep bin property for simplicity of the codebase. - -export type LatLongDef = LatLongFieldDef | DatumDef | NumericValueDef; - -export type PositionFieldDefBase = ScaleFieldDef< - F, - StandardType, - boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types -> & - PositionBaseMixins; - -export type PositionDatumDefBase = ScaleDatumDef & PositionBaseMixins; - -export interface PositionBaseMixins { - /** - * Type of stacking offset if the field should be stacked. - * `stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains. - * For example, `stack` of `y` can be used to customize stacking for a vertical bar chart. - * - * `stack` can be one of the following values: - * - `"zero"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart). - * - `"normalize"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized).
- * -`"center"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)). - * - `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart. - * - * __Default value:__ `zero` for plots with all of the following conditions are true: - * (1) the mark is `bar`, `area`, or `arc`; - * (2) the stacked measure channel (x or y) has a linear scale; - * (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default. - * - * __See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation. - */ - stack?: StackOffset | null | boolean; -} - -export interface BandMixins { - /** - * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval. - * - * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band. - * - * @minimum 0 - * @maximum 1 - */ - band?: number; -} - -export type PositionFieldDef = PositionFieldDefBase & PositionMixins; - -export type PositionDatumDef = PositionDatumDefBase & PositionMixins; - -export type PositionDef = PositionFieldDef | PositionDatumDef | PositionValueDef; - -export interface PositionMixins { - /** - * An object defining properties of axis's gridlines, ticks and labels. - * If `null`, the axis for the encoding channel will be removed. - * - * __Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied. - * - * __See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation. - */ - axis?: Axis | null; - - /** - * An object defining the properties of the Impute Operation to be applied. - * The field value of the other positional channel is taken as `key` of the `Impute` Operation. - * The field of the `color` channel if specified is used as `groupby` of the `Impute` Operation. - * - * __See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation. - */ - impute?: ImputeParams | null; -} - -export type PolarDef = PositionFieldDefBase | PositionDatumDefBase | PositionValueDef; - -export function getBand({ - channel, - fieldDef, - fieldDef2, - markDef: mark, - stack, - config, - isMidPoint -}: { - isMidPoint?: boolean; - channel: Channel; - fieldDef: FieldDef | DatumDef; - fieldDef2?: SecondaryChannelDef; - stack: StackProperties; - markDef: MarkDef; - config: Config; -}): number { - if (isFieldOrDatumDef(fieldDef) && fieldDef.band !== undefined) { - return fieldDef.band; - } - if (isFieldDef(fieldDef)) { - const {timeUnit, bin} = fieldDef; - - if (timeUnit && !fieldDef2) { - if (isMidPoint) { - return getMarkConfig('timeUnitBandPosition', mark, config); - } else { - return isRectBasedMark(mark.type) ? getMarkConfig('timeUnitBand', mark, config) : 0; - } - } else if (isBinning(bin)) { - return isRectBasedMark(mark.type) && !isMidPoint ? 1 : 0.5; - } - } - if (stack?.fieldChannel === channel && isMidPoint) { - return 0.5; - } - return undefined; -} - -export function hasBand( - channel: Channel, - fieldDef: FieldDef, - fieldDef2: SecondaryChannelDef, - stack: StackProperties, - markDef: MarkDef, - config: Config -): boolean { - if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) { - return !!getBand({channel, fieldDef, fieldDef2, stack, markDef, config}); - } - return false; -} - -/** - * Field definition of a mark property, which can contain a legend. - */ -export type MarkPropFieldDef = ScaleFieldDef & - LegendMixins; - -export type MarkPropDatumDef = LegendMixins & ScaleDatumDef; - -export type MarkPropFieldOrDatumDef = - | MarkPropFieldDef - | MarkPropDatumDef; - -export interface LegendMixins { - /** - * An object defining properties of the legend. - * If `null`, the legend for the encoding channel will be removed. - * - * __Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied. - * - * __See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation. - */ - legend?: Legend | null; -} - -// Detail - -// Order Path have no scale - -export interface OrderFieldDef extends FieldDefWithoutScale { - /** - * The sort order. One of `"ascending"` (default) or `"descending"`. - */ - sort?: SortOrder; -} - -export type OrderValueDef = ConditionValueDefMixins & NumericValueDef; - -export interface StringFieldDef extends FieldDefWithoutScale, FormatMixins {} - -export type FieldDef = SecondaryFieldDef | TypedFieldDef; -export type ChannelDef = Encoding[keyof Encoding]; - -export function isConditionalDef | GuideEncodingConditionalValueDef | SignalRef>( - channelDef: CD -): channelDef is CD & {condition: Conditional} { - return !!channelDef && 'condition' in channelDef; -} - -/** - * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef - */ -export function hasConditionalFieldDef( - channelDef: Partial> -): channelDef is {condition: Conditional>} { - const condition = channelDef && channelDef['condition']; - return !!condition && !isArray(condition) && isFieldDef(condition); -} - -export function hasConditionalFieldOrDatumDef( - channelDef: ChannelDef -): channelDef is {condition: Conditional>} { - const condition = channelDef && channelDef['condition']; - return !!condition && !isArray(condition) && isFieldOrDatumDef(condition); -} - -export function hasConditionalValueDef( - channelDef: ChannelDef -): channelDef is ValueDef & {condition: Conditional> | Conditional>[]} { - const condition = channelDef && channelDef['condition']; - return !!condition && (isArray(condition) || isValueDef(condition)); -} - -export function isFieldDef( - channelDef: Partial> | FieldDefBase | DatumDef -): channelDef is FieldDefBase | TypedFieldDef | SecondaryFieldDef { - // TODO: we can't use field in channelDef here as it's somehow failing runtime test - return !!channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count'); -} - -export function channelDefType(channelDef: ChannelDef): Type | undefined { - return channelDef && channelDef['type']; -} - -export function isDatumDef( - channelDef: Partial> | FieldDefBase | DatumDef -): channelDef is DatumDef { - return !!channelDef && 'datum' in channelDef; -} - -export function isContinuousFieldOrDatumDef( - cd: ChannelDef -): cd is TypedFieldDef | DatumDef { - // TODO: make datum support DateTime object - return (isTypedFieldDef(cd) && isContinuous(cd)) || isNumericDataDef(cd); -} - -export function isQuantitativeFieldOrDatumDef(cd: ChannelDef) { - // TODO: make datum support DateTime object - return channelDefType(cd) === 'quantitative' || isNumericDataDef(cd); -} - -export function isNumericDataDef(cd: ChannelDef): cd is DatumDef { - return isDatumDef(cd) && isNumber(cd.datum); -} - -export function isFieldOrDatumDef( - channelDef: Partial> -): channelDef is FieldDef | DatumDef { - return isFieldDef(channelDef) || isDatumDef(channelDef); -} - -export function isTypedFieldDef(channelDef: ChannelDef): channelDef is TypedFieldDef { - return !!channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef; -} - -export function isValueDef(channelDef: Partial>): channelDef is ValueDef { - return channelDef && 'value' in channelDef && 'value' in channelDef; -} - -export function isScaleFieldDef(channelDef: ChannelDef): channelDef is ScaleFieldDef { - return !!channelDef && ('scale' in channelDef || 'sort' in channelDef); -} - -export function isPositionFieldOrDatumDef( - channelDef: ChannelDef -): channelDef is PositionFieldDef | PositionDatumDef { - return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef); -} - -export function isMarkPropFieldOrDatumDef( - channelDef: ChannelDef -): channelDef is MarkPropFieldDef | MarkPropDatumDef { - return !!channelDef && 'legend' in channelDef; -} - -export function isStringFieldOrDatumDef( - channelDef: ChannelDef -): channelDef is StringFieldDef | StringDatumDef { - return !!channelDef && ('format' in channelDef || 'formatType' in channelDef); -} - -export function toStringFieldDef(fieldDef: FieldDef): StringFieldDef { - // omit properties that don't exist in string field defs - return omit(fieldDef, ['legend', 'axis', 'header', 'scale'] as any[]); -} - -export interface FieldRefOption { - /** Exclude bin, aggregate, timeUnit */ - nofn?: boolean; - /** Wrap the field with datum, parent, or datum.datum (e.g., datum['...'] for Vega Expression */ - expr?: 'datum' | 'parent' | 'datum.datum'; - /** Prepend fn with custom function prefix */ - prefix?: string; - /** Append suffix to the field ref for bin (default='start') */ - binSuffix?: 'end' | 'range' | 'mid'; - /** Append suffix to the field ref (general) */ - suffix?: string; - /** - * Use the field name for `as` in a transform. - * We will not escape nested accesses because Vega transform outputs cannot be nested. - */ - forAs?: boolean; -} - -function isOpFieldDef( - fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef -): fieldDef is WindowFieldDef | AggregatedFieldDef { - return 'op' in fieldDef; -} - -/** - * Get a Vega field reference from a Vega-Lite field def. - */ -export function vgField( - fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef, - opt: FieldRefOption = {} -): string { - let field = fieldDef.field; - const prefix = opt.prefix; - let suffix = opt.suffix; - - let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped - - if (isCount(fieldDef)) { - field = internalField('count'); - } else { - let fn: string; - - if (!opt.nofn) { - if (isOpFieldDef(fieldDef)) { - fn = fieldDef.op; - } else { - const {bin, aggregate, timeUnit} = fieldDef; - if (isBinning(bin)) { - fn = binToString(bin); - suffix = (opt.binSuffix ?? '') + (opt.suffix ?? ''); - } else if (aggregate) { - if (isArgmaxDef(aggregate)) { - argAccessor = `["${field}"]`; - field = `argmax_${aggregate.argmax}`; - } else if (isArgminDef(aggregate)) { - argAccessor = `["${field}"]`; - field = `argmin_${aggregate.argmin}`; - } else { - fn = String(aggregate); - } - } else if (timeUnit) { - fn = timeUnitToString(timeUnit); - suffix = ((!contains(['range', 'mid'], opt.binSuffix) && opt.binSuffix) || '') + (opt.suffix ?? ''); - } - } - } - - if (fn) { - field = field ? `${fn}_${field}` : fn; - } - } - - if (suffix) { - field = `${field}_${suffix}`; - } - - if (prefix) { - field = `${prefix}_${field}`; - } - - if (opt.forAs) { - return removePathFromField(field); - } else if (opt.expr) { - // Expression to access flattened field. No need to escape dots. - return flatAccessWithDatum(field, opt.expr) + argAccessor; - } else { - // We flattened all fields so paths should have become dot. - return replacePathInField(field) + argAccessor; - } -} - -export function isDiscrete(def: TypedFieldDef | DatumDef) { - switch (def.type) { - case 'nominal': - case 'ordinal': - case 'geojson': - return true; - case 'quantitative': - return isFieldDef(def) && !!def.bin; - case 'temporal': - return false; - } - throw new Error(log.message.invalidFieldType(def.type)); -} - -export function isContinuous(fieldDef: TypedFieldDef) { - return !isDiscrete(fieldDef); -} - -export function isCount(fieldDef: FieldDefBase) { - return fieldDef.aggregate === 'count'; -} - -export type FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => string; - -export function verbalTitleFormatter(fieldDef: FieldDefBase, config: Config) { - const {field, bin, timeUnit, aggregate} = fieldDef; - if (aggregate === 'count') { - return config.countTitle; - } else if (isBinning(bin)) { - return `${field} (binned)`; - } else if (timeUnit) { - const unit = normalizeTimeUnit(timeUnit)?.unit; - if (unit) { - return `${field} (${getTimeUnitParts(unit).join('-')})`; - } - } else if (aggregate) { - if (isArgmaxDef(aggregate)) { - return `${field} for max ${aggregate.argmax}`; - } else if (isArgminDef(aggregate)) { - return `${field} for min ${aggregate.argmin}`; - } else { - return `${titleCase(aggregate)} of ${field}`; - } - } - return field; -} - -export function functionalTitleFormatter(fieldDef: FieldDefBase) { - const {aggregate, bin, timeUnit, field} = fieldDef; - if (isArgmaxDef(aggregate)) { - return `${field} for argmax(${aggregate.argmax})`; - } else if (isArgminDef(aggregate)) { - return `${field} for argmin(${aggregate.argmin})`; - } - - const timeUnitParams = normalizeTimeUnit(timeUnit); - - const fn = aggregate || timeUnitParams?.unit || (timeUnitParams?.maxbins && 'timeunit') || (isBinning(bin) && 'bin'); - if (fn) { - return fn.toUpperCase() + '(' + field + ')'; - } else { - return field; - } -} - -export const defaultTitleFormatter: FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => { - switch (config.fieldTitle) { - case 'plain': - return fieldDef.field; - case 'functional': - return functionalTitleFormatter(fieldDef); - default: - return verbalTitleFormatter(fieldDef, config); - } -}; - -let titleFormatter = defaultTitleFormatter; - -export function setTitleFormatter(formatter: FieldTitleFormatter) { - titleFormatter = formatter; -} - -export function resetTitleFormatter() { - setTitleFormatter(defaultTitleFormatter); -} - -export function title( - fieldOrDatumDef: TypedFieldDef | SecondaryFieldDef | DatumDef, - config: Config, - {allowDisabling, includeDefault = true}: {allowDisabling: boolean; includeDefault?: boolean} -) { - const guideTitle = getGuide(fieldOrDatumDef)?.title; - - if (!isFieldDef(fieldOrDatumDef)) { - return guideTitle; - } - const fieldDef = fieldOrDatumDef; - - const def = includeDefault ? defaultTitle(fieldDef, config) : undefined; - - if (allowDisabling) { - return getFirstDefined(guideTitle, fieldDef.title, def); - } else { - return guideTitle ?? fieldDef.title ?? def; - } -} - -export function getGuide(fieldDef: TypedFieldDef | SecondaryFieldDef | DatumDef): Guide { - if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) { - return fieldDef.axis; - } else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) { - return fieldDef.legend; - } else if (isFacetFieldDef(fieldDef) && fieldDef.header) { - return fieldDef.header; - } - return undefined; -} - -export function defaultTitle(fieldDef: FieldDefBase, config: Config) { - return titleFormatter(fieldDef, config); -} - -export function getFormatMixins(fieldDef: TypedFieldDef | DatumDef) { - if (isStringFieldOrDatumDef(fieldDef)) { - const {format, formatType} = fieldDef; - return {format, formatType}; - } else { - const guide = getGuide(fieldDef) ?? {}; - const {format, formatType} = guide; - return {format, formatType}; - } -} - -export function defaultType>(fieldDef: T, channel: ExtendedChannel): Type { - switch (channel) { - case 'latitude': - case 'longitude': - return 'quantitative'; - - case 'row': - case 'column': - case 'facet': - case 'shape': - case 'strokeDash': - return 'nominal'; - } - - if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) { - return 'ordinal'; - } - - const {aggregate, bin, timeUnit} = fieldDef; - if (timeUnit) { - return 'temporal'; - } - - if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) { - return 'quantitative'; - } - - if (isScaleFieldDef(fieldDef) && fieldDef.scale?.type) { - switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) { - case 'numeric': - case 'discretizing': - return 'quantitative'; - case 'time': - return 'temporal'; - } - } - - return 'nominal'; -} - -/** - * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef. - * @param channelDef - */ - -export function getFieldDef(channelDef: ChannelDef): FieldDef { - if (isFieldDef(channelDef)) { - return channelDef; - } else if (hasConditionalFieldDef(channelDef)) { - return channelDef.condition; - } - return undefined; -} - -export function getFieldOrDatumDef = ChannelDef>( - channelDef: CD -): FieldDef | DatumDef { - if (isFieldOrDatumDef(channelDef)) { - return channelDef; - } else if (hasConditionalFieldOrDatumDef(channelDef)) { - return channelDef.condition; - } - return undefined; -} - -/** - * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. - */ -export function initChannelDef( - channelDef: ChannelDef, - channel: ExtendedChannel, - config: Config, - opt: {compositeMark?: boolean} = {} -): ChannelDef { - if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) { - const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean'; - log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef)); - return {value: channelDef} as ValueDef; - } - - // If a fieldDef contains a field, we need type. - if (isFieldOrDatumDef(channelDef)) { - return initFieldOrDatumDef(channelDef, channel, config, opt); - } else if (hasConditionalFieldOrDatumDef(channelDef)) { - return { - ...channelDef, - // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition - condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) as Conditional> - }; - } - return channelDef; -} - -export function initFieldOrDatumDef( - fd: FieldDef | DatumDef, - channel: ExtendedChannel, - config: Config, - opt: {compositeMark?: boolean} -): FieldDef | DatumDef { - if (isStringFieldOrDatumDef(fd)) { - const {format, formatType, ...rest} = fd; - if (isCustomFormatType(formatType) && !config.customFormatTypes) { - log.warn(log.message.customFormatTypeNotAllowed(channel)); - return initFieldOrDatumDef(rest, channel, config, opt); - } - } else { - const guideType = isPositionFieldOrDatumDef(fd) - ? 'axis' - : isMarkPropFieldOrDatumDef(fd) - ? 'legend' - : isFacetFieldDef(fd) - ? 'header' - : null; - if (guideType && fd[guideType]) { - const {format, formatType, ...newGuide} = fd[guideType]; - if (isCustomFormatType(formatType) && !config.customFormatTypes) { - log.warn(log.message.customFormatTypeNotAllowed(channel)); - return initFieldOrDatumDef({...fd, [guideType]: newGuide}, channel, config, opt); - } - } - } - - if (isFieldDef(fd)) { - return initFieldDef(fd, channel, opt); - } - return initDatumDef(fd); -} - -function initDatumDef(datumDef: DatumDef): DatumDef { - let type = datumDef['type']; - if (type) { - return datumDef; - } - const {datum} = datumDef; - type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined; - - return {...datumDef, type}; -} - -export function initFieldDef( - fd: FieldDef, - channel: ExtendedChannel, - {compositeMark = false}: {compositeMark?: boolean} = {} -) { - const {aggregate, timeUnit, bin, field} = fd; - const fieldDef = {...fd}; - - // Drop invalid aggregate - if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) { - log.warn(log.message.invalidAggregate(aggregate)); - delete fieldDef.aggregate; - } - - // Normalize Time Unit - if (timeUnit) { - fieldDef.timeUnit = normalizeTimeUnit(timeUnit); - } - - if (field) { - fieldDef.field = `${field}`; - } - - // Normalize bin - if (isBinning(bin)) { - fieldDef.bin = normalizeBin(bin, channel); - } - - if (isBinned(bin) && !isXorY(channel)) { - log.warn(log.message.channelShouldNotBeUsedForBinned(channel)); - } - - // Normalize Type - if (isTypedFieldDef(fieldDef)) { - const {type} = fieldDef; - const fullType = getFullName(type); - if (type !== fullType) { - // convert short type to full type - fieldDef.type = fullType; - } - if (type !== 'quantitative') { - if (isCountingAggregateOp(aggregate)) { - log.warn(log.message.invalidFieldTypeForCountAggregate(type, aggregate)); - fieldDef.type = 'quantitative'; - } - } - } else if (!isSecondaryRangeChannel(channel)) { - // If type is empty / invalid, then augment with default type - const newType = defaultType(fieldDef as TypedFieldDef, channel); - fieldDef['type'] = newType; - } - - if (isTypedFieldDef(fieldDef)) { - const {compatible, warning} = channelCompatibility(fieldDef, channel) || {}; - if (compatible === false) { - log.warn(warning); - } - } - - if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) { - const {sort} = fieldDef; - if (isSortByChannel(sort)) { - return { - ...fieldDef, - sort: {encoding: sort} - }; - } - const sub = sort.substr(1); - if (sort.charAt(0) === '-' && isSortByChannel(sub)) { - return { - ...fieldDef, - sort: {encoding: sub, order: 'descending'} - }; - } - } - - if (isFacetFieldDef(fieldDef)) { - const {header} = fieldDef; - const {orient, ...rest} = header; - if (orient) { - return { - ...fieldDef, - header: { - ...rest, - labelOrient: header.labelOrient || orient, - titleOrient: header.titleOrient || orient - } - }; - } - } - - return fieldDef; -} - -export function normalizeBin(bin: BinParams | boolean | 'binned', channel?: ExtendedChannel) { - if (isBoolean(bin)) { - return {maxbins: autoMaxBins(channel)}; - } else if (bin === 'binned') { - return { - binned: true - }; - } else if (!bin.maxbins && !bin.step) { - return {...bin, maxbins: autoMaxBins(channel)}; - } else { - return bin; - } -} - -const COMPATIBLE = {compatible: true}; -export function channelCompatibility( - fieldDef: TypedFieldDef, - channel: ExtendedChannel -): {compatible: boolean; warning?: string} { - const type = fieldDef.type; - - if (type === 'geojson' && channel !== 'shape') { - return { - compatible: false, - warning: `Channel ${channel} should not be used with a geojson data.` - }; - } - - switch (channel) { - case ROW: - case COLUMN: - case FACET: - if (isContinuous(fieldDef)) { - return { - compatible: false, - warning: log.message.facetChannelShouldBeDiscrete(channel) - }; - } - return COMPATIBLE; - - case X: - case Y: - case COLOR: - case FILL: - case STROKE: - case TEXT: - case DETAIL: - case KEY: - case TOOLTIP: - case HREF: - case URL: - case ANGLE: - case THETA: - case RADIUS: - case DESCRIPTION: - return COMPATIBLE; - - case LONGITUDE: - case LONGITUDE2: - case LATITUDE: - case LATITUDE2: - if (type !== QUANTITATIVE) { - return { - compatible: false, - warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.` - }; - } - return COMPATIBLE; - - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEWIDTH: - case SIZE: - case THETA2: - case RADIUS2: - case X2: - case Y2: - if (type === 'nominal' && !fieldDef['sort']) { - return { - compatible: false, - warning: `Channel ${channel} should not be used with an unsorted discrete field.` - }; - } - return COMPATIBLE; - - case STROKEDASH: - if (!contains(['ordinal', 'nominal'], fieldDef.type)) { - return { - compatible: false, - warning: 'StrokeDash channel should be used with only discrete data.' - }; - } - return COMPATIBLE; - - case SHAPE: - if (!contains(['ordinal', 'nominal', 'geojson'], fieldDef.type)) { - return { - compatible: false, - warning: 'Shape channel should be used with only either discrete or geojson data.' - }; - } - return COMPATIBLE; - - case ORDER: - if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) { - return { - compatible: false, - warning: `Channel order is inappropriate for nominal field, which has no inherent order.` - }; - } - return COMPATIBLE; - } -} - -/** - * Check if the field def uses a time format or does not use any format but is temporal - * (this does not cover field defs that are temporal but use a number format). - */ -export function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef: FieldDef | DatumDef): boolean { - const {formatType} = getFormatMixins(fieldOrDatumDef); - return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef)); -} - -/** - * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`. - */ -export function isTimeFieldDef(def: FieldDef | DatumDef): boolean { - return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit)); -} - -/** - * Getting a value associated with a fielddef. - * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit) - */ -export function valueExpr( - v: number | string | boolean | DateTime | SignalRef | number[], - { - timeUnit, - type, - wrapTime, - undefinedIfExprNotRequired - }: { - timeUnit: TimeUnit | TimeUnitParams; - type?: Type; - wrapTime?: boolean; - undefinedIfExprNotRequired?: boolean; - } -): string { - const unit = timeUnit && normalizeTimeUnit(timeUnit)?.unit; - let isTime = unit || type === 'temporal'; - - let expr; - if (isSignalRef(v)) { - expr = v.signal; - } else if (isDateTime(v)) { - isTime = true; - expr = dateTimeToExpr(v); - } else if (isString(v) || isNumber(v)) { - if (isTime) { - expr = `datetime(${JSON.stringify(v)})`; - - if (isLocalSingleTimeUnit(unit)) { - // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit - if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) { - expr = dateTimeToExpr({[unit]: v}); - } - } - } - } - if (expr) { - return wrapTime && isTime ? `time(${expr})` : expr; - } - // number or boolean or normal string - return undefinedIfExprNotRequired ? undefined : JSON.stringify(v); -} - -/** - * Standardize value array -- convert each value to Vega expression if applicable - */ -export function valueArray( - fieldOrDatumDef: TypedFieldDef | DatumDef, - values: (number | string | boolean | DateTime)[] -) { - const {type} = fieldOrDatumDef; - return values.map(v => { - const expr = valueExpr(v, { - timeUnit: isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.timeUnit : undefined, - type, - undefinedIfExprNotRequired: true - }); - // return signal for the expression if we need an expression - if (expr !== undefined) { - return {signal: expr}; - } - // otherwise just return the original value - return v; - }); -} - -/** - * Checks whether a fieldDef for a particular channel requires a computed bin range. - */ -export function binRequiresRange(fieldDef: FieldDef, channel: Channel): boolean { - if (!isBinning(fieldDef.bin)) { - console.warn('Only call this method for binned field defs.'); - return false; - } - - // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels. - // We could check whether the axis or legend exists (not disabled) but that seems overkill. - return isScaleChannel(channel) && contains(['ordinal', 'nominal'], (fieldDef as ScaleFieldDef).type); -} diff --git a/node_modules/vega-lite/src/compile/axis/assemble.ts b/node_modules/vega-lite/src/compile/axis/assemble.ts deleted file mode 100644 index d2510aa..0000000 --- a/node_modules/vega-lite/src/compile/axis/assemble.ts +++ /dev/null @@ -1,223 +0,0 @@ -import {Axis as VgAxis, AxisEncode, NewSignal, SignalRef, Text} from 'vega'; -import {array, isArray} from 'vega-util'; -import {AXIS_PARTS, AXIS_PROPERTY_TYPE, CONDITIONAL_AXIS_PROP_INDEX, isConditionalAxisValue} from '../../axis'; -import {POSITION_SCALE_CHANNELS} from '../../channel'; -import {defaultTitle, FieldDefBase} from '../../channeldef'; -import {Config} from '../../config'; -import {isText} from '../../title'; -import {getFirstDefined, isEmpty, replaceAll} from '../../util'; -import {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema'; -import {exprFromValueOrSignalRef} from '../common'; -import {Model} from '../model'; -import {expression} from '../predicate'; -import {AxisComponent, AxisComponentIndex} from './component'; - -function assembleTitle(title: Text | FieldDefBase[] | SignalRef, config: Config): Text | SignalRef { - if (!title) { - return undefined; - } - if (isArray(title) && !isText(title)) { - return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', '); - } - return title; -} - -function setAxisEncode( - axis: Omit, - part: keyof AxisEncode, - vgProp: VgEncodeChannel, - vgRef: VgValueRef | readonly VgValueRef[] -) { - axis.encode = axis.encode ?? {}; - axis.encode[part] = axis.encode[part] ?? {}; - axis.encode[part].update = axis.encode[part].update ?? {}; - // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 - (axis.encode[part].update[vgProp] as any) = vgRef; -} - -export function assembleAxis( - axisCmpt: AxisComponent, - kind: 'main' | 'grid', - config: Config, - opt: { - header: boolean; // whether this is called via a header - } = {header: false} -): VgAxis { - const {disable, orient, scale, labelExpr, title, zindex, ...axis} = axisCmpt.combine(); - - if (disable) { - return undefined; - } - - for (const prop in axis) { - const propType = AXIS_PROPERTY_TYPE[prop]; - const propValue = axis[prop]; - - if (propType && propType !== kind && propType !== 'both') { - // Remove properties that are not valid for this kind of axis - delete axis[prop]; - } else if (isConditionalAxisValue(propValue)) { - // deal with conditional axis value - - const {condition, ...valueOrSignalRef} = propValue; - const conditions = array(condition); - - const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; - if (propIndex) { - const {vgProp, part} = propIndex; - // If there is a corresponding Vega property for the channel, - // use Vega's custom axis encoding and delete the original axis property to avoid conflicts - - const vgRef = [ - ...conditions.map(c => { - const {test, ...valueOrSignalCRef} = c; - return { - test: expression(null, test), - ...valueOrSignalCRef - }; - }), - valueOrSignalRef - ]; - setAxisEncode(axis, part, vgProp, vgRef); - delete axis[prop]; - } else if (propIndex === null) { - // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead. - const signalRef: SignalRef = { - signal: - conditions - .map(c => { - const {test, ...valueOrSignalCRef} = c; - return `${expression(null, test)} ? ${exprFromValueOrSignalRef(valueOrSignalCRef)} : `; - }) - .join('') + exprFromValueOrSignalRef(valueOrSignalRef) - }; - axis[prop] = signalRef; - } - } else if (isSignalRef(propValue)) { - const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; - if (propIndex) { - const {vgProp, part} = propIndex; - setAxisEncode(axis, part, vgProp, propValue); - delete axis[prop]; - } // else do nothing since the property already supports signal - } - } - - if (kind === 'grid') { - if (!axis.grid) { - return undefined; - } - - // Remove unnecessary encode block - if (axis.encode) { - // Only need to keep encode block for grid - const {grid} = axis.encode; - axis.encode = { - ...(grid ? {grid} : {}) - }; - - if (isEmpty(axis.encode)) { - delete axis.encode; - } - } - - return { - scale, - orient, - ...axis, - domain: false, - labels: false, - aria: false, // always hide grid axis - - // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent` - // would not affect gridAxis - maxExtent: 0, - minExtent: 0, - ticks: false, - zindex: getFirstDefined(zindex, 0) // put grid behind marks by default - }; - } else { - // kind === 'main' - - if (!opt.header && axisCmpt.mainExtracted) { - // if mainExtracted has been extracted to a separate facet - return undefined; - } - - if (labelExpr !== undefined) { - let expr = labelExpr; - if (axis.encode?.labels?.update && isSignalRef(axis.encode.labels.update.text)) { - expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal); - } - setAxisEncode(axis, 'labels', 'text', {signal: expr}); - } - - if (axis.labelAlign === null) { - delete axis.labelAlign; - } - - // Remove unnecessary encode block - if (axis.encode) { - for (const part of AXIS_PARTS) { - if (!axisCmpt.hasAxisPart(part)) { - delete axis.encode[part]; - } - } - if (isEmpty(axis.encode)) { - delete axis.encode; - } - } - - const titleString = assembleTitle(title, config); - - return { - scale, - orient, - grid: false, - ...(titleString ? {title: titleString} : {}), - ...axis, - ...(config.aria === false ? {aria: false} : {}), - zindex: getFirstDefined(zindex, 0) // put axis line above marks by default - }; - } -} - -/** - * Add axis signals so grid line works correctly - * (Fix https://github.com/vega/vega-lite/issues/4226) - */ -export function assembleAxisSignals(model: Model): NewSignal[] { - const {axes} = model.component; - const signals: NewSignal[] = []; - - for (const channel of POSITION_SCALE_CHANNELS) { - if (axes[channel]) { - for (const axis of axes[channel]) { - if (!axis.get('disable') && !axis.get('gridScale')) { - // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width. - - const sizeType = channel === 'x' ? 'height' : 'width'; - const update = model.getSizeSignalRef(sizeType).signal; - - if (sizeType !== update) { - signals.push({ - name: sizeType, - update: update - }); - } - } - } - } - } - return signals; -} - -export function assembleAxes(axisComponents: AxisComponentIndex, config: Config): VgAxis[] { - const {x = [], y = []} = axisComponents; - return [ - ...x.map(a => assembleAxis(a, 'grid', config)), - ...y.map(a => assembleAxis(a, 'grid', config)), - ...x.map(a => assembleAxis(a, 'main', config)), - ...y.map(a => assembleAxis(a, 'main', config)) - ].filter(a => a); // filter undefined -} diff --git a/node_modules/vega-lite/src/compile/axis/component.ts b/node_modules/vega-lite/src/compile/axis/component.ts deleted file mode 100644 index 9c0fc8a..0000000 --- a/node_modules/vega-lite/src/compile/axis/component.ts +++ /dev/null @@ -1,78 +0,0 @@ -import {Axis as VgAxis, SignalRef, Text} from 'vega'; -import { - Axis, - AxisPart, - AxisPropsWithConditionAndSignal, - COMMON_AXIS_PROPERTIES_INDEX, - ConditionalAxisProp, - SignalAxisProp -} from '../../axis'; -import {FieldDefBase} from '../../channeldef'; -import {duplicate, Flag, keys} from '../../util'; -import {Split} from '../split'; -import {isSignalRef} from '../../vega.schema'; - -function isFalseOrNull(v: any) { - return v === false || v === null; -} - -export type AxisComponentProps = Omit & - Omit & { - title: Text | FieldDefBase[] | SignalRef; - labelExpr: string; - disable: boolean; - }; - -const AXIS_COMPONENT_PROPERTIES_INDEX: Flag = { - disable: 1, - gridScale: 1, - scale: 1, - ...COMMON_AXIS_PROPERTIES_INDEX, - labelExpr: 1, - encode: 1 -}; - -export const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX); - -export class AxisComponent extends Split { - constructor( - public readonly explicit: Partial = {}, - public readonly implicit: Partial = {}, - public mainExtracted = false - ) { - super(); - } - - public clone() { - return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted); - } - - public hasAxisPart(part: AxisPart) { - // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme. - - if (part === 'axis') { - // always has the axis container part - return true; - } - - if (part === 'grid' || part === 'title') { - return !!this.get(part); - } - // Other parts are enabled by default, so they should not be false or null. - return !isFalseOrNull(this.get(part)); - } - - public hasOrientSignalRef() { - return isSignalRef(this.explicit.orient); - } -} - -export interface AxisComponentIndex { - x?: AxisComponent[]; - y?: AxisComponent[]; -} - -export interface AxisIndex { - x?: Axis; - y?: Axis; -} diff --git a/node_modules/vega-lite/src/compile/axis/config.ts b/node_modules/vega-lite/src/compile/axis/config.ts deleted file mode 100644 index b93f707..0000000 --- a/node_modules/vega-lite/src/compile/axis/config.ts +++ /dev/null @@ -1,119 +0,0 @@ -import {ScaleType, SignalRef} from 'vega'; -import {array} from 'vega-util'; -import {AxisConfig} from '../../axis'; -import {PositionScaleChannel} from '../../channel'; -import {Config, StyleConfigIndex} from '../../config'; -import {isQuantitative} from '../../scale'; -import {keys, titleCase} from '../../util'; -import {isSignalRef} from '../../vega.schema'; -import {getStyleConfig, signalOrStringValue} from '../common'; - -function getAxisConfigFromConfigTypes( - configTypes: string[], - config: Config, - channel: 'x' | 'y', - orient: string | SignalRef -) { - // TODO: add special casing to add conditional value based on orient signal - return Object.assign.apply(null, [ - {}, - ...configTypes.map(configType => { - if (configType === 'axisOrient') { - const orient1 = channel === 'x' ? 'bottom' : 'left'; - const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {}; - const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {}; - - const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]); - - const conditionalOrientAxisConfig = {}; - for (const prop of props.values()) { - conditionalOrientAxisConfig[prop] = { - // orient is surely signal in this case - signal: `${orient['signal']} === "${orient1}" ? ${signalOrStringValue( - orientConfig1[prop] - )} : ${signalOrStringValue(orientConfig2[prop])}` - }; - } - - return conditionalOrientAxisConfig; - } - - return config[configType]; - }) - ]); -} - -export type AxisConfigs = ReturnType; - -export function getAxisConfigs( - channel: PositionScaleChannel, - scaleType: ScaleType, - orient: string | SignalRef, - config: Config -) { - const typeBasedConfigTypes = - scaleType === 'band' - ? ['axisDiscrete', 'axisBand'] - : scaleType === 'point' - ? ['axisDiscrete', 'axisPoint'] - : isQuantitative(scaleType) - ? ['axisQuantitative'] - : scaleType === 'time' || scaleType === 'utc' - ? ['axisTemporal'] - : []; - - const axisChannel = channel === 'x' ? 'axisX' : 'axisY'; - const axisOrient = isSignalRef(orient) ? 'axisOrient' : 'axis' + titleCase(orient); // axisTop, axisBottom, ... - - const vlOnlyConfigTypes = [ - // technically Vega does have axisBand, but if we make another separation here, - // it will further introduce complexity in the code - ...typeBasedConfigTypes, - ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4)) - ]; - - const vgConfigTypes = ['axis', axisOrient, axisChannel]; - - return { - vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient), - vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient), - axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config) - }; -} - -export function getAxisConfigStyle(axisConfigTypes: string[], config: Config) { - const toMerge = [{}]; - for (const configType of axisConfigTypes) { - // TODO: add special casing to add conditional value based on orient signal - let style = config[configType]?.style; - if (style) { - style = array(style); - for (const s of style) { - toMerge.push(config.style[s]); - } - } - } - return Object.assign.apply(null, toMerge); -} -export function getAxisConfig( - property: keyof AxisConfig, - styleConfigIndex: StyleConfigIndex, - style: string | string[], - axisConfigs: Partial = {} -): {configFrom?: string; configValue?: any} { - const styleConfig = getStyleConfig(property, style, styleConfigIndex); - - if (styleConfig !== undefined) { - return { - configFrom: 'style', - configValue: styleConfig - }; - } - - for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) { - if (axisConfigs[configFrom]?.[property] !== undefined) { - return {configFrom, configValue: axisConfigs[configFrom][property]}; - } - } - return {}; -} diff --git a/node_modules/vega-lite/src/compile/axis/encode.ts b/node_modules/vega-lite/src/compile/axis/encode.ts deleted file mode 100644 index f338752..0000000 --- a/node_modules/vega-lite/src/compile/axis/encode.ts +++ /dev/null @@ -1,28 +0,0 @@ -import {getSecondaryRangeChannel, PositionScaleChannel} from '../../channel'; -import {getFieldOrDatumDef} from '../../channeldef'; -import {formatCustomType, isCustomFormatType} from '../format'; -import {UnitModel} from '../unit'; - -export function labels(model: UnitModel, channel: PositionScaleChannel, specifiedLabelsSpec: any) { - const {encoding, config} = model; - - const fieldOrDatumDef = - getFieldOrDatumDef(encoding[channel]) ?? getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]); - const axis = model.axis(channel) || {}; - const {format, formatType} = axis; - - if (isCustomFormatType(formatType)) { - return { - text: formatCustomType({ - fieldOrDatumDef, - field: 'datum.value', - format, - formatType, - config - }), - ...specifiedLabelsSpec - }; - } - - return specifiedLabelsSpec; -} diff --git a/node_modules/vega-lite/src/compile/axis/parse.ts b/node_modules/vega-lite/src/compile/axis/parse.ts deleted file mode 100644 index 1d8c178..0000000 --- a/node_modules/vega-lite/src/compile/axis/parse.ts +++ /dev/null @@ -1,324 +0,0 @@ -import {AxisEncode as VgAxisEncode, AxisOrient} from 'vega'; -import {Axis, AXIS_PARTS, isAxisProperty, isConditionalAxisValue} from '../../axis'; -import {PositionScaleChannel, POSITION_SCALE_CHANNELS} from '../../channel'; -import {getFieldOrDatumDef, PositionDatumDef, PositionFieldDef} from '../../channeldef'; -import {getFirstDefined, isEmpty, keys, normalizeAngle} from '../../util'; -import {isSignalRef} from '../../vega.schema'; -import {mergeTitleComponent} from '../common'; -import {guideEncodeEntry} from '../guide'; -import {LayerModel} from '../layer'; -import {parseGuideResolve} from '../resolve'; -import {defaultTieBreaker, Explicit, mergeValuesWithExplicit} from '../split'; -import {UnitModel} from '../unit'; -import {AxisComponent, AxisComponentIndex, AxisComponentProps, AXIS_COMPONENT_PROPERTIES} from './component'; -import {getAxisConfig, getAxisConfigs} from './config'; -import * as encode from './encode'; -import {AxisRuleParams, axisRules, defaultOrient, getFieldDefTitle, getLabelAngle} from './properties'; - -export function parseUnitAxes(model: UnitModel): AxisComponentIndex { - return POSITION_SCALE_CHANNELS.reduce((axis, channel) => { - if (model.component.scales[channel]) { - axis[channel] = [parseAxis(channel, model)]; - } - return axis; - }, {} as AxisComponentIndex); -} - -const OPPOSITE_ORIENT: Record = { - bottom: 'top', - top: 'bottom', - left: 'right', - right: 'left' -}; - -export function parseLayerAxes(model: LayerModel) { - const {axes, resolve} = model.component; - const axisCount: Record = {top: 0, bottom: 0, right: 0, left: 0}; - - for (const child of model.children) { - child.parseAxesAndHeaders(); - - for (const channel of keys(child.component.axes)) { - resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel); - if (resolve.axis[channel] === 'shared') { - // If the resolve says shared (and has not been overridden) - // We will try to merge and see if there is a conflict - - axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]); - - if (!axes[channel]) { - // If merge returns nothing, there is a conflict so we cannot make the axis shared. - // Thus, mark axis as independent and remove the axis component. - resolve.axis[channel] = 'independent'; - delete axes[channel]; - } - } - } - } - - // Move axes to layer's axis component and merge shared axes - for (const channel of POSITION_SCALE_CHANNELS) { - for (const child of model.children) { - if (!child.component.axes[channel]) { - // skip if the child does not have a particular axis - continue; - } - - if (resolve.axis[channel] === 'independent') { - // If axes are independent, concat the axisComponent array. - axes[channel] = (axes[channel] ?? []).concat(child.component.axes[channel]); - - // Automatically adjust orient - for (const axisComponent of child.component.axes[channel]) { - const {value: orient, explicit} = axisComponent.getWithExplicit('orient'); - if (isSignalRef(orient)) { - continue; - } - - if (axisCount[orient] > 0 && !explicit) { - // Change axis orient if the number do not match - const oppositeOrient = OPPOSITE_ORIENT[orient]; - if (axisCount[orient] > axisCount[oppositeOrient]) { - axisComponent.set('orient', oppositeOrient, false); - } - } - axisCount[orient]++; - - // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset? - } - } - - // After merging, make sure to remove axes from child - delete child.component.axes[channel]; - } - - // Suppress grid lines for dual axis charts (https://github.com/vega/vega-lite/issues/4676) - if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) { - for (const axisCmpt of axes[channel]) { - if (!!axisCmpt.get('grid') && !axisCmpt.explicit.grid) { - axisCmpt.implicit.grid = false; - } - } - } - } -} - -function mergeAxisComponents( - mergedAxisCmpts: AxisComponent[], - childAxisCmpts: readonly AxisComponent[] -): AxisComponent[] { - if (mergedAxisCmpts) { - // FIXME: this is a bit wrong once we support multiple axes - if (mergedAxisCmpts.length !== childAxisCmpts.length) { - return undefined; // Cannot merge axis component with different number of axes. - } - const length = mergedAxisCmpts.length; - for (let i = 0; i < length; i++) { - const merged = mergedAxisCmpts[i]; - const child = childAxisCmpts[i]; - - if (!!merged !== !!child) { - return undefined; - } else if (merged && child) { - const mergedOrient = merged.getWithExplicit('orient'); - const childOrient = child.getWithExplicit('orient'); - - if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { - // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) - - // Cannot merge due to inconsistent orient - return undefined; - } else { - mergedAxisCmpts[i] = mergeAxisComponent(merged, child); - } - } - } - } else { - // For first one, return a copy of the child - return childAxisCmpts.map(axisComponent => axisComponent.clone()); - } - return mergedAxisCmpts; -} - -function mergeAxisComponent(merged: AxisComponent, child: AxisComponent): AxisComponent { - for (const prop of AXIS_COMPONENT_PROPERTIES) { - const mergedValueWithExplicit = mergeValuesWithExplicit( - merged.getWithExplicit(prop), - child.getWithExplicit(prop), - prop, - 'axis', - - // Tie breaker function - (v1: Explicit, v2: Explicit) => { - switch (prop) { - case 'title': - return mergeTitleComponent(v1, v2); - case 'gridScale': - return { - explicit: v1.explicit, // keep the old explicit - value: getFirstDefined(v1.value, v2.value) - }; - } - return defaultTieBreaker(v1, v2, prop, 'axis'); - } - ); - merged.setWithExplicit(prop, mergedValueWithExplicit); - } - return merged; -} - -// eslint-disable-next-line @typescript-eslint/ban-types -function isExplicit( - value: T, - property: keyof AxisComponentProps, - axis: Axis, - model: UnitModel, - channel: PositionScaleChannel -) { - if (property === 'disable') { - return axis !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit - } - - axis = axis || {}; - - switch (property) { - case 'titleAngle': - case 'labelAngle': - return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle)); - case 'values': - return !!axis.values; - // specified axis.values is already respected, but may get transformed. - case 'encode': - // both VL axis.encoding and axis.labelAngle affect VG axis.encode - return !!axis.encoding || !!axis.labelAngle; - case 'title': - // title can be explicit if fieldDef.title is set - if (value === getFieldDefTitle(model, channel)) { - return true; - } - } - // Otherwise, things are explicit if the returned value matches the specified property - return value === axis[property]; -} - -/** - * Properties to always include values from config - */ -const propsToAlwaysIncludeConfig = new Set([ - 'grid', // Grid is an exception because we need to set grid = true to generate another grid axis - 'translate', // translate has dependent logic for bar's bin position and it's 0.5 by default in Vega. If a config overrides this value, we need to know. - // the rest are not axis configs in Vega, but are in VL, so we need to set too. - 'format', - 'formatType', - 'orient', - 'labelExpr', - 'tickCount', - 'position', - 'tickMinStep' -]); - -function parseAxis(channel: PositionScaleChannel, model: UnitModel): AxisComponent { - let axis = model.axis(channel); - - const axisComponent = new AxisComponent(); - - const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]) as - | PositionFieldDef - | PositionDatumDef; - - const {mark, config} = model; - - const orient = - axis?.orient || - config[channel === 'x' ? 'axisX' : 'axisY']?.orient || - config.axis?.orient || - defaultOrient(channel); - - const scaleType = model.getScaleComponent(channel).get('type'); - - const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config); - - const disable = - axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis?.style, axisConfigs).configValue; - axisComponent.set('disable', disable, axis !== undefined); - if (disable) { - return axisComponent; - } - - axis = axis || {}; - - const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs); - - const ruleParams: AxisRuleParams = { - fieldOrDatumDef, - axis, - channel, - model, - scaleType, - orient, - labelAngle, - mark, - config - }; - // 1.2. Add properties - for (const property of AXIS_COMPONENT_PROPERTIES) { - const value = - property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined; - - const hasValue = value !== undefined; - - const explicit = isExplicit(value, property, axis, model, channel); - - if (hasValue && explicit) { - axisComponent.set(property, value, explicit); - } else { - const {configValue = undefined, configFrom = undefined} = - isAxisProperty(property) && property !== 'values' - ? getAxisConfig(property, config.style, axis.style, axisConfigs) - : {}; - const hasConfigValue = configValue !== undefined; - - if (hasValue && !hasConfigValue) { - // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config) - axisComponent.set(property, value, explicit); - } else if ( - // Cases need implicit values - // 1. Axis config that aren't available in Vega - !(configFrom === 'vgAxisConfig') || - // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details) - (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) || - // 3. Conditional axis values and signals - isConditionalAxisValue(configValue) || - isSignalRef(configValue) - ) { - // If a config is specified and is conditional, copy conditional value from axis config - axisComponent.set(property, configValue, false); - } - } - } - - // 2) Add guide encode definition groups - const axisEncoding = axis.encoding ?? {}; - const axisEncode = AXIS_PARTS.reduce((e: VgAxisEncode, part) => { - if (!axisComponent.hasAxisPart(part)) { - // No need to create encode for a disabled part. - return e; - } - - const axisEncodingPart = guideEncodeEntry(axisEncoding[part] ?? {}, model); - - const value = part === 'labels' ? encode.labels(model, channel, axisEncodingPart) : axisEncodingPart; - - if (value !== undefined && !isEmpty(value)) { - e[part] = {update: value}; - } - return e; - }, {} as VgAxisEncode); - - // FIXME: By having encode as one property, we won't have fine grained encode merging. - if (!isEmpty(axisEncode)) { - axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined); - } - - return axisComponent; -} diff --git a/node_modules/vega-lite/src/compile/axis/properties.ts b/node_modules/vega-lite/src/compile/axis/properties.ts deleted file mode 100644 index b745529..0000000 --- a/node_modules/vega-lite/src/compile/axis/properties.ts +++ /dev/null @@ -1,366 +0,0 @@ -import {Align, AxisOrient, Orient, SignalRef} from 'vega'; -import {isArray, isObject} from 'vega-util'; -import {Axis} from '../../axis'; -import {isBinned, isBinning} from '../../bin'; -import {PositionScaleChannel, X} from '../../channel'; -import { - DatumDef, - isDiscrete, - isFieldDef, - PositionDatumDef, - PositionFieldDef, - toFieldDefBase, - TypedFieldDef, - valueArray -} from '../../channeldef'; -import {Config, StyleConfigIndex} from '../../config'; -import {Mark} from '../../mark'; -import {hasDiscreteDomain} from '../../scale'; -import {Sort} from '../../sort'; -import {normalizeTimeUnit} from '../../timeunit'; -import {NOMINAL, ORDINAL, Type} from '../../type'; -import {contains, normalizeAngle} from '../../util'; -import {isSignalRef} from '../../vega.schema'; -import {mergeTitle, mergeTitleFieldDefs} from '../common'; -import {guideFormat, guideFormatType} from '../format'; -import {UnitModel} from '../unit'; -import {ScaleType} from './../../scale'; -import {AxisComponentProps} from './component'; -import {AxisConfigs, getAxisConfig} from './config'; - -export interface AxisRuleParams { - fieldOrDatumDef: PositionFieldDef | PositionDatumDef; - axis: Axis; - channel: PositionScaleChannel; - model: UnitModel; - - mark: Mark; - scaleType: ScaleType; - orient: Orient | SignalRef; - labelAngle: number | SignalRef; - config: Config; -} - -export const axisRules: { - [k in keyof AxisComponentProps]?: (params: AxisRuleParams) => AxisComponentProps[k]; -} = { - scale: ({model, channel}) => model.scaleName(channel), - - format: ({fieldOrDatumDef, config, axis}) => { - const {format, formatType} = axis; - return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, true); - }, - - formatType: ({axis, fieldOrDatumDef, scaleType}) => { - const {formatType} = axis; - return guideFormatType(formatType, fieldOrDatumDef, scaleType); - }, - - grid: ({fieldOrDatumDef, axis, scaleType}) => { - if (isFieldDef(fieldOrDatumDef) && isBinned(fieldOrDatumDef.bin)) { - return false; - } else { - return axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef); - } - }, - - gridScale: ({model, channel}) => gridScale(model, channel), - - labelAlign: ({axis, labelAngle, orient, channel}) => - axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel), - - labelAngle: ({labelAngle}) => labelAngle, // we already calculate this in parse - - labelBaseline: ({axis, labelAngle, orient, channel}) => - axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel), - - labelFlush: ({axis, fieldOrDatumDef, channel}) => axis.labelFlush ?? defaultLabelFlush(fieldOrDatumDef.type, channel), - - labelOverlap: ({axis, fieldOrDatumDef, scaleType}) => - axis.labelOverlap ?? - defaultLabelOverlap( - fieldOrDatumDef.type, - scaleType, - isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit, - isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined - ), - - // we already calculate orient in parse - orient: ({orient}) => orient as AxisOrient, // Need to cast until Vega supports signal - - tickCount: ({channel, model, axis, fieldOrDatumDef, scaleType}) => { - const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; - const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined; - return axis.tickCount ?? defaultTickCount({fieldOrDatumDef, scaleType, size, values: axis.values}); - }, - - title: ({axis, model, channel}) => { - if (axis.title !== undefined) { - return axis.title; - } - const fieldDefTitle = getFieldDefTitle(model, channel); - if (fieldDefTitle !== undefined) { - return fieldDefTitle; - } - const fieldDef = model.typedFieldDef(channel); - const channel2 = channel === 'x' ? 'x2' : 'y2'; - const fieldDef2 = model.fieldDef(channel2); - - // If title not specified, store base parts of fieldDef (and fieldDef2 if exists) - return mergeTitleFieldDefs( - fieldDef ? [toFieldDefBase(fieldDef)] : [], - isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : [] - ); - }, - - values: ({axis, fieldOrDatumDef}) => values(axis, fieldOrDatumDef), - - zindex: ({axis, fieldOrDatumDef, mark}) => axis.zindex ?? defaultZindex(mark, fieldOrDatumDef) -}; - -// TODO: we need to refactor this method after we take care of config refactoring -/** - * Default rules for whether to show a grid should be shown for a channel. - * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned - */ - -export function defaultGrid(scaleType: ScaleType, fieldDef: TypedFieldDef | DatumDef) { - return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin); -} - -export function gridScale(model: UnitModel, channel: PositionScaleChannel) { - const gridChannel: PositionScaleChannel = channel === 'x' ? 'y' : 'x'; - if (model.getScaleComponent(gridChannel)) { - return model.scaleName(gridChannel); - } - return undefined; -} - -export function getLabelAngle( - fieldOrDatumDef: PositionFieldDef | PositionDatumDef, - axis: Axis, - channel: PositionScaleChannel, - styleConfig: StyleConfigIndex, - axisConfigs?: AxisConfigs -) { - const labelAngle = axis?.labelAngle; - // try axis value - if (labelAngle !== undefined) { - return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle); - } else { - // try axis config value - const {configValue: angle} = getAxisConfig('labelAngle', styleConfig, axis?.style, axisConfigs); - if (angle !== undefined) { - return normalizeAngle(angle); - } else { - // get default value - if ( - channel === X && - contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) && - !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit) - ) { - return 270; - } - // no default - return undefined; - } - } -} - -export function normalizeAngleExpr(angle: SignalRef) { - return `(((${angle.signal} % 360) + 360) % 360)`; -} - -export function defaultLabelBaseline( - angle: number | SignalRef, - orient: AxisOrient | SignalRef, - channel: 'x' | 'y', - alwaysIncludeMiddle?: boolean -) { - if (angle !== undefined) { - if (channel === 'x') { - if (isSignalRef(angle)) { - const a = normalizeAngleExpr(angle); - const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === "top")` : orient === 'top'; - return { - signal: - `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? "middle" :` + - `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? "bottom" : "top"` - }; - } - - if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) { - return 'middle'; - } - - if (isSignalRef(orient)) { - const op = angle <= 45 || 315 <= angle ? '===' : '!=='; - return {signal: `${orient.signal} ${op} "top" ? "bottom" : "top"`}; - } - - return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top'; - } else { - if (isSignalRef(angle)) { - const a = normalizeAngleExpr(angle); - const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === "left")` : orient === 'left'; - const middle = alwaysIncludeMiddle ? '"middle"' : 'null'; - return { - signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? "top" : "bottom"` - }; - } - - if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) { - return alwaysIncludeMiddle ? 'middle' : null; - } - - if (isSignalRef(orient)) { - const op = 45 <= angle && angle <= 135 ? '===' : '!=='; - return {signal: `${orient.signal} ${op} "left" ? "top" : "bottom"`}; - } - - return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom'; - } - } - return undefined; -} - -export function defaultLabelAlign( - angle: number | SignalRef, - orient: AxisOrient | SignalRef, - channel: 'x' | 'y' -): Align | SignalRef { - if (angle === undefined) { - return undefined; - } - - const isX = channel === 'x'; - const startAngle = isX ? 0 : 90; - const mainOrient = isX ? 'bottom' : 'left'; - - if (isSignalRef(angle)) { - const a = normalizeAngleExpr(angle); - const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === "${mainOrient}")` : orient === mainOrient; - return { - signal: - `(${startAngle ? '(' + a + ' + 90)' : a} % 180 === 0) ? ${isX ? null : '"center"'} :` + - `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? "left" : "right"` - }; - } - - if ((angle + startAngle) % 180 === 0) { - // For bottom, use default label align so label flush still works - return isX ? null : 'center'; - } - - if (isSignalRef(orient)) { - const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!=='; - const orientIsMain = `${orient.signal} ${op} "${mainOrient}"`; - return { - signal: `${orientIsMain} ? "left" : "right"` - }; - } - - if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) { - return 'left'; - } - - return 'right'; -} - -export function defaultLabelFlush(type: Type, channel: PositionScaleChannel) { - if (channel === 'x' && contains(['quantitative', 'temporal'], type)) { - return true; - } - return undefined; -} - -export function defaultLabelOverlap(type: Type, scaleType: ScaleType, hasTimeUnit: boolean, sort?: Sort) { - // do not prevent overlap for nominal data because there is no way to infer what the missing labels are - if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) { - if (scaleType === 'log') { - return 'greedy'; - } - return true; - } - return undefined; -} - -export function defaultOrient(channel: PositionScaleChannel) { - return channel === 'x' ? 'bottom' : 'left'; -} - -export function defaultTickCount({ - fieldOrDatumDef, - scaleType, - size, - values: vals -}: { - fieldOrDatumDef: TypedFieldDef | DatumDef; - scaleType: ScaleType; - size?: SignalRef; - values?: Axis['values']; -}) { - if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') { - if (isFieldDef(fieldOrDatumDef)) { - if (isBinning(fieldOrDatumDef.bin)) { - // for binned data, we don't want more ticks than maxbins - return {signal: `ceil(${size.signal}/10)`}; - } - - if ( - fieldOrDatumDef.timeUnit && - contains(['month', 'hours', 'day', 'quarter'], normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit) - ) { - return undefined; - } - } - - return {signal: `ceil(${size.signal}/40)`}; - } - - return undefined; -} - -export function getFieldDefTitle(model: UnitModel, channel: 'x' | 'y') { - const channel2 = channel === 'x' ? 'x2' : 'y2'; - const fieldDef = model.fieldDef(channel); - const fieldDef2 = model.fieldDef(channel2); - - const title1 = fieldDef ? fieldDef.title : undefined; - const title2 = fieldDef2 ? fieldDef2.title : undefined; - - if (title1 && title2) { - return mergeTitle(title1, title2); - } else if (title1) { - return title1; - } else if (title2) { - return title2; - } else if (title1 !== undefined) { - // falsy value to disable config - return title1; - } else if (title2 !== undefined) { - // falsy value to disable config - return title2; - } - - return undefined; -} - -export function values(axis: Axis, fieldOrDatumDef: TypedFieldDef | DatumDef) { - const vals = axis.values; - - if (isArray(vals)) { - return valueArray(fieldOrDatumDef, vals); - } else if (isSignalRef(vals)) { - return vals; - } - - return undefined; -} - -export function defaultZindex(mark: Mark, fieldDef: TypedFieldDef | DatumDef) { - if (mark === 'rect' && isDiscrete(fieldDef)) { - return 1; - } - return 0; -} diff --git a/node_modules/vega-lite/src/compile/buildmodel.ts b/node_modules/vega-lite/src/compile/buildmodel.ts deleted file mode 100644 index f8809d2..0000000 --- a/node_modules/vega-lite/src/compile/buildmodel.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {Config} from '../config'; -import * as log from '../log'; -import {isAnyConcatSpec, isFacetSpec, isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedSpec} from '../spec'; -import {ConcatModel} from './concat'; -import {FacetModel} from './facet'; -import {LayerModel} from './layer'; -import {Model} from './model'; -import {UnitModel} from './unit'; - -export function buildModel( - spec: NormalizedSpec, - parent: Model, - parentGivenName: string, - unitSize: LayoutSizeMixins, - config: Config -): Model { - if (isFacetSpec(spec)) { - return new FacetModel(spec, parent, parentGivenName, config); - } else if (isLayerSpec(spec)) { - return new LayerModel(spec, parent, parentGivenName, unitSize, config); - } else if (isUnitSpec(spec)) { - return new UnitModel(spec, parent, parentGivenName, unitSize, config); - } else if (isAnyConcatSpec(spec)) { - return new ConcatModel(spec, parent, parentGivenName, config); - } - throw new Error(log.message.invalidSpec(spec)); -} diff --git a/node_modules/vega-lite/src/compile/common.ts b/node_modules/vega-lite/src/compile/common.ts deleted file mode 100644 index da02b8e..0000000 --- a/node_modules/vega-lite/src/compile/common.ts +++ /dev/null @@ -1,201 +0,0 @@ -import {SignalRef, Text} from 'vega'; -import {array, stringValue} from 'vega-util'; -import {AxisConfig} from '../axis'; -import {FieldDefBase, FieldRefOption, OrderFieldDef, vgField} from '../channeldef'; -import {Config, StyleConfigIndex} from '../config'; -import {MarkConfig, MarkDef} from '../mark'; -import {SortFields} from '../sort'; -import {isText} from '../title'; -import {deepEqual, getFirstDefined} from '../util'; -import {isSignalRef, VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../vega.schema'; -import {AxisComponentProps} from './axis/component'; -import {Explicit} from './split'; -import {UnitModel} from './unit'; - -export const BIN_RANGE_DELIMITER = ' \u2013 '; - -export function signalOrValueRef(value: T | SignalRef): {value: T} | SignalRef { - if (isSignalRef(value)) { - return value; - } - return value !== undefined ? {value} : undefined; -} - -export function exprFromValueOrSignalRef(ref: VgValueRef | SignalRef): string { - if (isSignalRef(ref)) { - return ref.signal; - } - return stringValue(ref.value); -} - -export function signalOrStringValue(v: SignalRef | any) { - if (isSignalRef(v)) { - return v.signal; - } - return v == null ? null : stringValue(v); -} - -export function applyMarkConfig(e: VgEncodeEntry, model: UnitModel, propsList: (keyof MarkConfig)[]) { - for (const property of propsList) { - const value = getMarkConfig(property, model.markDef, model.config); - if (value !== undefined) { - e[property] = signalOrValueRef(value); - } - } - return e; -} - -export function getStyles(mark: MarkDef): string[] { - return [].concat(mark.type, mark.style ?? []); -} - -export function getMarkPropOrConfig

( - channel: P, - mark: MarkDef, - config: Config, - opt: { - vgChannel?: VgEncodeChannel; - ignoreVgConfig?: boolean; - } = {} -): MarkDef[P] { - const {vgChannel, ignoreVgConfig} = opt; - if (vgChannel && mark[vgChannel] !== undefined) { - return mark[vgChannel]; - } else if (mark[channel] !== undefined) { - return mark[channel]; - } else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) { - return undefined; - } - - return getMarkConfig(channel, mark, config, opt); -} - -/** - * Return property value from style or mark specific config property if exists. - * Otherwise, return general mark specific config. - */ -export function getMarkConfig

( - channel: P, - mark: MarkDef, - config: Config, - {vgChannel}: {vgChannel?: VgEncodeChannel} = {} -): MarkDef[P] { - return getFirstDefined( - // style config has highest precedence - vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined, - getMarkStyleConfig(channel, mark, config.style), - // then mark-specific config - vgChannel ? config[mark.type][vgChannel] : undefined, - - config[mark.type][channel as any], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine - - // If there is vgChannel, skip vl channel. - // For example, vl size for text is vg fontSize, but config.mark.size is only for point size. - vgChannel ? config.mark[vgChannel] : config.mark[channel as any] // Need to cast for the same reason as above - ); -} - -export function getMarkStyleConfig

( - prop: P, - mark: MarkDef, - styleConfigIndex: StyleConfigIndex -) { - return getStyleConfig(prop, getStyles(mark), styleConfigIndex); -} - -export function getStyleConfig

( - p: P, - styles: string | string[], - styleConfigIndex: StyleConfigIndex -) { - styles = array(styles); - let value; - for (const style of styles) { - const styleConfig = styleConfigIndex[style]; - - if (styleConfig && styleConfig[p as string] !== undefined) { - value = styleConfig[p as string]; - } - } - return value; -} - -/** - * Return Vega sort parameters (tuple of field and order). - */ -export function sortParams( - orderDef: OrderFieldDef | OrderFieldDef[], - fieldRefOption?: FieldRefOption -): SortFields { - return array(orderDef).reduce( - (s, orderChannelDef) => { - s.field.push(vgField(orderChannelDef, fieldRefOption)); - s.order.push(orderChannelDef.sort ?? 'ascending'); - return s; - }, - {field: [], order: []} - ); -} - -export type AxisTitleComponent = AxisComponentProps['title']; - -export function mergeTitleFieldDefs(f1: readonly FieldDefBase[], f2: readonly FieldDefBase[]) { - const merged = [...f1]; - - f2.forEach(fdToMerge => { - for (const fieldDef1 of merged) { - // If already exists, no need to append to merged array - if (deepEqual(fieldDef1, fdToMerge)) { - return; - } - } - merged.push(fdToMerge); - }); - return merged; -} - -export function mergeTitle(title1: Text | SignalRef, title2: Text | SignalRef) { - if (deepEqual(title1, title2) || !title2) { - // if titles are the same or title2 is falsy - return title1; - } else if (!title1) { - // if title1 is falsy - return title2; - } else { - return [...array(title1), ...array(title2)].join(', '); - } -} - -export function mergeTitleComponent(v1: Explicit, v2: Explicit) { - const v1Val = v1.value; - const v2Val = v2.value; - - if (v1Val == null || v2Val === null) { - return { - explicit: v1.explicit, - value: null - }; - } else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) { - return { - explicit: v1.explicit, - value: mergeTitle(v1Val, v2Val) - }; - } else if (isText(v1Val) || isSignalRef(v1Val)) { - return { - explicit: v1.explicit, - value: v1Val - }; - } else if (isText(v2Val) || isSignalRef(v2Val)) { - return { - explicit: v1.explicit, - value: v2Val - }; - } else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) { - return { - explicit: v1.explicit, - value: mergeTitleFieldDefs(v1Val, v2Val) - }; - } - /* istanbul ignore next: Condition should not happen -- only for warning in development. */ - throw new Error('It should never reach here'); -} diff --git a/node_modules/vega-lite/src/compile/compile.ts b/node_modules/vega-lite/src/compile/compile.ts deleted file mode 100644 index e1c32f9..0000000 --- a/node_modules/vega-lite/src/compile/compile.ts +++ /dev/null @@ -1,239 +0,0 @@ -import {AutoSizeType, LoggerInterface, Spec as VgSpec} from 'vega'; -import {isString, mergeConfig} from 'vega-util'; -import {getPositionScaleChannel} from '../channel'; -import * as vlFieldDef from '../channeldef'; -import {Config, initConfig, stripAndRedirectConfig} from '../config'; -import * as log from '../log'; -import {normalize} from '../normalize'; -import {LayoutSizeMixins, TopLevel, TopLevelSpec} from '../spec'; -import { - AutoSizeParams, - Datasets, - extractTopLevelProperties, - getFitType, - isFitType, - TopLevelProperties -} from '../spec/toplevel'; -import {Dict, keys} from '../util'; -import {buildModel} from './buildmodel'; -import {assembleRootData} from './data/assemble'; -import {optimizeDataflow} from './data/optimize'; -import {Model} from './model'; - -export interface CompileOptions { - /** - * Sets a Vega-Lite configuration. - */ - config?: Config; - - /** - * Sets a custom logger. - */ - logger?: LoggerInterface; - - /** - * Sets a field title formatter. - */ - fieldTitle?: vlFieldDef.FieldTitleFormatter; -} - -/** - * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec. - * - * At a high-level, we make the following transformations in different phases: - * - * Input spec - * | - * | (Normalization) - * v - * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.) - * | - * | (Build Model) - * v - * A model tree of the spec - * | - * | (Parse) - * v - * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged) - * | - * | (Optimize) - * v - * A model tree with parsed components with the data component optimized - * | - * | (Assemble) - * v - * Vega spec - * - * @param inputSpec The Vega-Lite specification. - * @param opt Optional arguments passed to the Vega-Lite compiler. - * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec. - */ -export function compile(inputSpec: TopLevelSpec, opt: CompileOptions = {}) { - // 0. Augment opt with default opts - if (opt.logger) { - // set the singleton logger to the provided logger - log.set(opt.logger); - } - - if (opt.fieldTitle) { - // set the singleton field title formatter - vlFieldDef.setTitleFormatter(opt.fieldTitle); - } - - try { - // 1. Initialize config by deep merging default config with the config provided via option and the input spec. - const config = initConfig(mergeConfig(opt.config, inputSpec.config)); - - // 2. Normalize: Convert input spec -> normalized spec - - // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec. - // - Normalize autosize and width or height spec - const spec = normalize(inputSpec, config); - - // 3. Build Model: normalized spec -> Model (a tree structure) - - // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors. - // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models. - const model: Model = buildModel(spec, null, '', undefined, config); - - // 4 Parse: Model --> Model with components - - // Note that components = intermediate representations that are equivalent to Vega specs. - // We need these intermediate representation because we need to merge many visualization "components" like projections, scales, axes, and legends. - // We will later convert these components into actual Vega specs in the assemble phase. - - // In this phase, we do a bottom-up traversal over the whole tree to - // parse for each type of components once (e.g., data, layout, mark, scale). - // By doing bottom-up traversal, we start parsing components of unit specs and - // then merge child components of parent composite specs. - // - // Please see inside model.parse() for order of different components parsed. - model.parse(); - - // drawDataflow(model.component.data.sources); - - // 5. Optimize the dataflow. This will modify the data component of the model. - optimizeDataflow(model.component.data, model); - - // drawDataflow(model.component.data.sources); - - // 6. Assemble: convert model components --> Vega Spec. - const vgSpec = assembleTopLevelModel( - model, - getTopLevelProperties(inputSpec, spec.autosize, config, model), - inputSpec.datasets, - inputSpec.usermeta - ); - - return { - spec: vgSpec, - normalized: spec - }; - } finally { - // Reset the singleton logger if a logger is provided - if (opt.logger) { - log.reset(); - } - // Reset the singleton field title formatter if provided - if (opt.fieldTitle) { - vlFieldDef.resetTitleFormatter(); - } - } -} - -function getTopLevelProperties( - inputSpec: TopLevel, - autosize: AutoSizeType | AutoSizeParams, - config: Config, - model: Model -) { - const width = model.component.layoutSize.get('width'); - const height = model.component.layoutSize.get('height'); - if (autosize === undefined) { - autosize = {type: 'pad'}; - if (model.hasAxisOrientSignalRef()) { - autosize.resize = true; - } - } else if (isString(autosize)) { - autosize = {type: autosize}; - } - if (width && height && isFitType(autosize.type)) { - if (width === 'step' && height === 'step') { - log.warn(log.message.droppingFit()); - autosize.type = 'pad'; - } else if (width === 'step' || height === 'step') { - // effectively XOR, because else if - - // get step dimension - const sizeType = width === 'step' ? 'width' : 'height'; - // log that we're dropping fit for respective channel - log.warn(log.message.droppingFit(getPositionScaleChannel(sizeType))); - - // setting type to inverse fit (so if we dropped fit-x, type is now fit-y) - const inverseSizeType = sizeType === 'width' ? 'height' : 'width'; - autosize.type = getFitType(inverseSizeType); - } - } - - return { - ...(keys(autosize).length === 1 && autosize.type - ? autosize.type === 'pad' - ? {} - : {autosize: autosize.type} - : {autosize}), - ...extractTopLevelProperties(config), - ...extractTopLevelProperties(inputSpec) - }; -} - -/* - * Assemble the top-level model to a Vega spec. - * - * Note: this couldn't be `model.assemble()` since the top-level model - * needs some special treatment to generate top-level properties. - */ -function assembleTopLevelModel( - model: Model, - topLevelProperties: TopLevelProperties & LayoutSizeMixins, - datasets: Datasets = {}, - usermeta: Dict -): VgSpec { - // Config with Vega-Lite only config removed. - const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined; - - const data = [].concat( - model.assembleSelectionData([]), - // only assemble data in the root - assembleRootData(model.component.data, datasets) - ); - - const projections = model.assembleProjections(); - const title = model.assembleTitle(); - const style = model.assembleGroupStyle(); - const encodeEntry = model.assembleGroupEncodeEntry(true); - - let layoutSignals = model.assembleLayoutSignals(); - - // move width and height signals with values to top level - layoutSignals = layoutSignals.filter(signal => { - if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) { - topLevelProperties[signal.name] = +signal.value; - return false; - } - return true; - }); - - return { - $schema: 'https://vega.github.io/schema/vega/v5.json', - ...(model.description ? {description: model.description} : {}), - ...topLevelProperties, - ...(title ? {title} : {}), - ...(style ? {style} : {}), - ...(encodeEntry ? {encode: {update: encodeEntry}} : {}), - data, - ...(projections.length > 0 ? {projections: projections} : {}), - ...model.assembleGroup([...layoutSignals, ...model.assembleSelectionTopLevelSignals([])]), - ...(vgConfig ? {config: vgConfig} : {}), - ...(usermeta ? {usermeta} : {}) - }; -} diff --git a/node_modules/vega-lite/src/compile/concat.ts b/node_modules/vega-lite/src/compile/concat.ts deleted file mode 100644 index 47c8af6..0000000 --- a/node_modules/vega-lite/src/compile/concat.ts +++ /dev/null @@ -1,130 +0,0 @@ -import {NewSignal} from 'vega'; -import {Config} from '../config'; -import * as log from '../log'; -import {isHConcatSpec, isVConcatSpec, NormalizedConcatSpec, NormalizedSpec} from '../spec'; -import {VgLayout} from '../vega.schema'; -import {keys} from '../util'; -import {VgData} from '../vega.schema'; -import {buildModel} from './buildmodel'; -import {parseData} from './data/parse'; -import {assembleLayoutSignals} from './layoutsize/assemble'; -import {parseConcatLayoutSize} from './layoutsize/parse'; -import {Model} from './model'; - -export class ConcatModel extends Model { - public readonly children: Model[]; - - constructor(spec: NormalizedConcatSpec, parent: Model, parentGivenName: string, config: Config) { - super(spec, 'concat', parent, parentGivenName, config, spec.resolve); - - if (spec.resolve?.axis?.x === 'shared' || spec.resolve?.axis?.y === 'shared') { - log.warn(log.message.CONCAT_CANNOT_SHARE_AXIS); - } - - this.children = this.getChildren(spec).map((child, i) => { - return buildModel(child, this, this.getName('concat_' + i), undefined, config); - }); - } - - public parseData() { - this.component.data = parseData(this); - for (const child of this.children) { - child.parseData(); - } - } - - public parseSelections() { - // Merge selections up the hierarchy so that they may be referenced - // across unit specs. Persist their definitions within each child - // to assemble signals which remain within output Vega unit groups. - this.component.selection = {}; - for (const child of this.children) { - child.parseSelections(); - for (const key of keys(child.component.selection)) { - this.component.selection[key] = child.component.selection[key]; - } - } - } - - public parseMarkGroup() { - for (const child of this.children) { - child.parseMarkGroup(); - } - } - - public parseAxesAndHeaders() { - for (const child of this.children) { - child.parseAxesAndHeaders(); - } - - // TODO(#2415): support shared axes - } - - private getChildren(spec: NormalizedConcatSpec): NormalizedSpec[] { - if (isVConcatSpec(spec)) { - return spec.vconcat; - } else if (isHConcatSpec(spec)) { - return spec.hconcat; - } - return spec.concat; - } - - public parseLayoutSize() { - parseConcatLayoutSize(this); - } - - public parseAxisGroup(): void { - return null; - } - - public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] { - return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); - } - - public assembleSignals(): NewSignal[] { - this.children.forEach(child => child.assembleSignals()); - return []; - } - - public assembleLayoutSignals(): NewSignal[] { - const layoutSignals = assembleLayoutSignals(this); - - for (const child of this.children) { - layoutSignals.push(...child.assembleLayoutSignals()); - } - - return layoutSignals; - } - - public assembleSelectionData(data: readonly VgData[]): readonly VgData[] { - return this.children.reduce((db, child) => child.assembleSelectionData(db), data); - } - - public assembleMarks(): any[] { - // only children have marks - return this.children.map(child => { - const title = child.assembleTitle(); - const style = child.assembleGroupStyle(); - const encodeEntry = child.assembleGroupEncodeEntry(false); - - return { - type: 'group', - name: child.getName('group'), - ...(title ? {title} : {}), - ...(style ? {style} : {}), - ...(encodeEntry ? {encode: {update: encodeEntry}} : {}), - ...child.assembleGroup() - }; - }); - } - - protected assembleDefaultLayout(): VgLayout { - const columns = this.layout.columns; - return { - ...(columns != null ? {columns: columns} : {}), - bounds: 'full', - // Use align each so it can work with multiple plots with different size - align: 'each' - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/aggregate.ts b/node_modules/vega-lite/src/compile/data/aggregate.ts deleted file mode 100644 index c0466fe..0000000 --- a/node_modules/vega-lite/src/compile/data/aggregate.ts +++ /dev/null @@ -1,219 +0,0 @@ -import {AggregateOp, AggregateTransform as VgAggregateTransform} from 'vega'; -import {isArgmaxDef, isArgminDef} from '../../aggregate'; -import { - Channel, - getPositionChannelFromLatLong, - getSecondaryRangeChannel, - isGeoPositionChannel, - isScaleChannel -} from '../../channel'; -import {binRequiresRange, FieldDef, hasBand, isTypedFieldDef, vgField} from '../../channeldef'; -import * as log from '../../log'; -import {AggregateTransform} from '../../transform'; -import {Dict, duplicate, hash, keys, replacePathInField, setEqual} from '../../util'; -import {isUnitModel, ModelWithField} from '../model'; -import {UnitModel} from '../unit'; -import {DataFlowNode} from './dataflow'; - -type Measures = Dict>>>; - -function addDimension(dims: Set, channel: Channel, fieldDef: FieldDef, model: ModelWithField) { - const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; - - if ( - isTypedFieldDef(fieldDef) && - isUnitModel(model) && - hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config) - ) { - dims.add(vgField(fieldDef, {})); - dims.add(vgField(fieldDef, {suffix: 'end'})); - - if (fieldDef.bin && binRequiresRange(fieldDef, channel)) { - dims.add(vgField(fieldDef, {binSuffix: 'range'})); - } - } else if (isGeoPositionChannel(channel)) { - const posChannel = getPositionChannelFromLatLong(channel); - dims.add(model.getName(posChannel)); - } else { - dims.add(vgField(fieldDef)); - } - return dims; -} - -function mergeMeasures(parentMeasures: Measures, childMeasures: Measures) { - for (const field of keys(childMeasures)) { - // when we merge a measure, we either have to add an aggregation operator or even a new field - const ops = childMeasures[field]; - for (const op of keys(ops)) { - if (field in parentMeasures) { - // add operator to existing measure field - parentMeasures[field][op] = new Set([...(parentMeasures[field][op] ?? []), ...ops[op]]); - } else { - parentMeasures[field] = {[op]: ops[op]}; - } - } - } -} - -export class AggregateNode extends DataFlowNode { - public clone() { - return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures)); - } - - /** - * @param dimensions string set for dimensions - * @param measures dictionary mapping field name => dict of aggregation functions and names to use - */ - constructor(parent: DataFlowNode, private dimensions: Set, private measures: Measures) { - super(parent); - } - - get groupBy() { - return this.dimensions; - } - - public static makeFromEncoding(parent: DataFlowNode, model: UnitModel): AggregateNode { - let isAggregate = false; - model.forEachFieldDef(fd => { - if (fd.aggregate) { - isAggregate = true; - } - }); - - const meas: Measures = {}; - const dims = new Set(); - - if (!isAggregate) { - // no need to create this node if the model has no aggregation - return null; - } - - model.forEachFieldDef((fieldDef, channel: Channel) => { - const {aggregate, field} = fieldDef; - if (aggregate) { - if (aggregate === 'count') { - meas['*'] = meas['*'] ?? {}; - meas['*']['count'] = new Set([vgField(fieldDef, {forAs: true})]); - } else { - if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { - const op = isArgminDef(aggregate) ? 'argmin' : 'argmax'; - const argField = aggregate[op]; - meas[argField] = meas[argField] ?? {}; - meas[argField][op] = new Set([vgField({op, field: argField}, {forAs: true})]); - } else { - meas[field] = meas[field] ?? {}; - meas[field][aggregate] = new Set([vgField(fieldDef, {forAs: true})]); - } - - // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain - if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') { - meas[field] = meas[field] ?? {}; - meas[field]['min'] = new Set([vgField({field, aggregate: 'min'}, {forAs: true})]); - meas[field]['max'] = new Set([vgField({field, aggregate: 'max'}, {forAs: true})]); - } - } - } else { - addDimension(dims, channel, fieldDef, model); - } - }); - - if (dims.size + keys(meas).length === 0) { - return null; - } - - return new AggregateNode(parent, dims, meas); - } - - public static makeFromTransform(parent: DataFlowNode, t: AggregateTransform): AggregateNode { - const dims = new Set(); - const meas: Measures = {}; - - for (const s of t.aggregate) { - const {op, field, as} = s; - if (op) { - if (op === 'count') { - meas['*'] = meas['*'] ?? {}; - meas['*']['count'] = new Set([as ? as : vgField(s, {forAs: true})]); - } else { - meas[field] = meas[field] ?? {}; - meas[field][op] = new Set([as ? as : vgField(s, {forAs: true})]); - } - } - } - - for (const s of t.groupby ?? []) { - dims.add(s); - } - - if (dims.size + keys(meas).length === 0) { - return null; - } - - return new AggregateNode(parent, dims, meas); - } - - public merge(other: AggregateNode): boolean { - if (setEqual(this.dimensions, other.dimensions)) { - mergeMeasures(this.measures, other.measures); - return true; - } else { - log.debug('different dimensions, cannot merge'); - return false; - } - } - - public addDimensions(fields: readonly string[]) { - fields.forEach(this.dimensions.add, this.dimensions); - } - - public dependentFields() { - return new Set([...this.dimensions, ...keys(this.measures)]); - } - - public producedFields() { - const out = new Set(); - - for (const field of keys(this.measures)) { - for (const op of keys(this.measures[field])) { - const m = this.measures[field][op]; - if (m.size === 0) { - out.add(`${op}_${field}`); - } else { - m.forEach(out.add, out); - } - } - } - - return out; - } - - public hash() { - return `Aggregate ${hash({dimensions: this.dimensions, measures: this.measures})}`; - } - - public assemble(): VgAggregateTransform { - const ops: AggregateOp[] = []; - const fields: string[] = []; - const as: string[] = []; - - for (const field of keys(this.measures)) { - for (const op of keys(this.measures[field])) { - for (const alias of this.measures[field][op]) { - as.push(alias); - ops.push(op); - fields.push(field === '*' ? null : replacePathInField(field)); - } - } - } - - const result: VgAggregateTransform = { - type: 'aggregate', - groupby: [...this.dimensions].map(replacePathInField), - ops, - fields, - as - }; - - return result; - } -} diff --git a/node_modules/vega-lite/src/compile/data/assemble.ts b/node_modules/vega-lite/src/compile/data/assemble.ts deleted file mode 100644 index 6931ae9..0000000 --- a/node_modules/vega-lite/src/compile/data/assemble.ts +++ /dev/null @@ -1,272 +0,0 @@ -import {InlineDataset, isUrlData} from '../../data'; -import {Dict} from '../../util'; -import {VgData} from '../../vega.schema'; -import {DataComponent} from './'; -import {AggregateNode} from './aggregate'; -import {BinNode} from './bin'; -import {CalculateNode} from './calculate'; -import {DataFlowNode, OutputNode} from './dataflow'; -import {DensityTransformNode} from './density'; -import {FacetNode} from './facet'; -import {FilterNode} from './filter'; -import {FilterInvalidNode} from './filterinvalid'; -import {FlattenTransformNode} from './flatten'; -import {FoldTransformNode} from './fold'; -import {ParseNode} from './formatparse'; -import {GeoJSONNode} from './geojson'; -import {GeoPointNode} from './geopoint'; -import {GraticuleNode} from './graticule'; -import {IdentifierNode} from './identifier'; -import {ImputeNode} from './impute'; -import {JoinAggregateTransformNode} from './joinaggregate'; -import {LoessTransformNode} from './loess'; -import {LookupNode} from './lookup'; -import {QuantileTransformNode} from './quantile'; -import {RegressionTransformNode} from './regression'; -import {PivotTransformNode} from './pivot'; -import {SampleTransformNode} from './sample'; -import {SequenceNode} from './sequence'; -import {SourceNode} from './source'; -import {StackNode} from './stack'; -import {TimeUnitNode} from './timeunit'; -import {WindowTransformNode} from './window'; - -function makeWalkTree(data: VgData[]) { - // to name datasources - let datasetIndex = 0; - - /** - * Recursively walk down the tree. - */ - function walkTree(node: DataFlowNode, dataSource: VgData) { - if (node instanceof SourceNode) { - // If the source is a named data source or a data source with values, we need - // to put it in a different data source. Otherwise, Vega may override the data. - if (!node.isGenerator && !isUrlData(node.data)) { - data.push(dataSource); - const newData: VgData = { - name: null, - source: dataSource.name, - transform: [] - }; - dataSource = newData; - } - } - - if (node instanceof ParseNode) { - if (node.parent instanceof SourceNode && !dataSource.source) { - // If node's parent is a root source and the data source does not refer to another data source, use normal format parse - dataSource.format = { - ...(dataSource.format ?? {}), - parse: node.assembleFormatParse() - }; - - // add calculates for all nested fields - dataSource.transform.push(...node.assembleTransforms(true)); - } else { - // Otherwise use Vega expression to parse - dataSource.transform.push(...node.assembleTransforms()); - } - } - - if (node instanceof FacetNode) { - if (!dataSource.name) { - dataSource.name = `data_${datasetIndex++}`; - } - - if (!dataSource.source || dataSource.transform.length > 0) { - data.push(dataSource); - node.data = dataSource.name; - } else { - node.data = dataSource.source; - } - - for (const d of node.assemble()) { - data.push(d); - } - - // break here because the rest of the tree has to be taken care of by the facet. - return; - } - - if ( - node instanceof GraticuleNode || - node instanceof SequenceNode || - node instanceof FilterInvalidNode || - node instanceof FilterNode || - node instanceof CalculateNode || - node instanceof GeoPointNode || - node instanceof GeoJSONNode || - node instanceof AggregateNode || - node instanceof LookupNode || - node instanceof WindowTransformNode || - node instanceof JoinAggregateTransformNode || - node instanceof FoldTransformNode || - node instanceof FlattenTransformNode || - node instanceof DensityTransformNode || - node instanceof LoessTransformNode || - node instanceof QuantileTransformNode || - node instanceof RegressionTransformNode || - node instanceof IdentifierNode || - node instanceof SampleTransformNode || - node instanceof PivotTransformNode - ) { - dataSource.transform.push(node.assemble()); - } - - if ( - node instanceof BinNode || - node instanceof TimeUnitNode || - node instanceof ImputeNode || - node instanceof StackNode - ) { - dataSource.transform.push(...node.assemble()); - } - - if (node instanceof OutputNode) { - if (dataSource.source && dataSource.transform.length === 0) { - node.setSource(dataSource.source); - } else if (node.parent instanceof OutputNode) { - // Note that an output node may be required but we still do not assemble a - // separate data source for it. - node.setSource(dataSource.name); - } else { - if (!dataSource.name) { - dataSource.name = `data_${datasetIndex++}`; - } - - // Here we set the name of the datasource we generated. From now on - // other assemblers can use it. - node.setSource(dataSource.name); - - // if this node has more than one child, we will add a datasource automatically - if (node.numChildren() === 1) { - data.push(dataSource); - const newData: VgData = { - name: null, - source: dataSource.name, - transform: [] - }; - dataSource = newData; - } - } - } - - switch (node.numChildren()) { - case 0: - // done - if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) { - // do not push empty datasources that are simply references - data.push(dataSource); - } - break; - case 1: - walkTree(node.children[0], dataSource); - break; - default: { - if (!dataSource.name) { - dataSource.name = `data_${datasetIndex++}`; - } - - let source = dataSource.name; - if (!dataSource.source || dataSource.transform.length > 0) { - data.push(dataSource); - } else { - source = dataSource.source; - } - - for (const child of node.children) { - const newData: VgData = { - name: null, - source: source, - transform: [] - }; - walkTree(child, newData); - } - break; - } - } - } - - return walkTree; -} - -/** - * Assemble data sources that are derived from faceted data. - */ -export function assembleFacetData(root: FacetNode): VgData[] { - const data: VgData[] = []; - const walkTree = makeWalkTree(data); - - for (const child of root.children) { - walkTree(child, { - source: root.name, - name: null, - transform: [] - }); - } - - return data; -} - -/** - * Create Vega data array from a given compiled model and append all of them to the given array - * - * @param model - * @param data array - * @return modified data array - */ -export function assembleRootData(dataComponent: DataComponent, datasets: Dict): VgData[] { - const data: VgData[] = []; - - // dataComponent.sources.forEach(debug); - // draw(dataComponent.sources); - - const walkTree = makeWalkTree(data); - - let sourceIndex = 0; - - for (const root of dataComponent.sources) { - // assign a name if the source does not have a name yet - if (!root.hasName()) { - root.dataName = `source_${sourceIndex++}`; - } - - const newData: VgData = root.assemble(); - - walkTree(root, newData); - } - - // remove empty transform arrays for cleaner output - for (const d of data) { - if (d.transform.length === 0) { - delete d.transform; - } - } - - // move sources without transforms (the ones that are potentially used in lookups) to the beginning - let whereTo = 0; - for (const [i, d] of data.entries()) { - if ((d.transform ?? []).length === 0 && !d.source) { - data.splice(whereTo++, 0, data.splice(i, 1)[0]); - } - } - - // now fix the from references in lookup transforms - for (const d of data) { - for (const t of d.transform ?? []) { - if (t.type === 'lookup') { - t.from = dataComponent.outputNodes[t.from].getSource(); - } - } - } - - // inline values for datasets that are in the datastore - for (const d of data) { - if (d.name in datasets) { - d.values = datasets[d.name]; - } - } - - return data; -} diff --git a/node_modules/vega-lite/src/compile/data/bin.ts b/node_modules/vega-lite/src/compile/data/bin.ts deleted file mode 100644 index 87bba39..0000000 --- a/node_modules/vega-lite/src/compile/data/bin.ts +++ /dev/null @@ -1,229 +0,0 @@ -import {BinTransform as VgBinTransform, Transforms as VgTransform} from 'vega'; -import {isString} from 'vega-util'; -import {BinParams, binToString, isBinning, isSelectionExtent} from '../../bin'; -import {Channel} from '../../channel'; -import {binRequiresRange, FieldName, isTypedFieldDef, normalizeBin, TypedFieldDef, vgField} from '../../channeldef'; -import {Config} from '../../config'; -import {BinTransform} from '../../transform'; -import {Dict, duplicate, hash, isEmpty, keys, replacePathInField, unique, vals, varName} from '../../util'; -import {binFormatExpression} from '../format'; -import {isUnitModel, Model, ModelWithField} from '../model'; -import {parseSelectionBinExtent} from '../selection/parse'; -import {NonPositionScaleChannel, PositionChannel} from './../../channel'; -import {DataFlowNode} from './dataflow'; - -function rangeFormula(model: ModelWithField, fieldDef: TypedFieldDef, channel: Channel, config: Config) { - if (binRequiresRange(fieldDef, channel)) { - // read format from axis or legend, if there is no format then use config.numberFormat - - const guide = isUnitModel(model) - ? model.axis(channel as PositionChannel) ?? model.legend(channel as NonPositionScaleChannel) ?? {} - : {}; - - const startField = vgField(fieldDef, {expr: 'datum'}); - const endField = vgField(fieldDef, {expr: 'datum', binSuffix: 'end'}); - - return { - formulaAs: vgField(fieldDef, {binSuffix: 'range', forAs: true}), - formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config) - }; - } - return {}; -} - -function binKey(bin: BinParams, field: string) { - return `${binToString(bin)}_${field}`; -} - -function getSignalsFromModel(model: Model, key: string) { - return { - signal: model.getName(`${key}_bins`), - extentSignal: model.getName(`${key}_extent`) - }; -} - -export function getBinSignalName(model: Model, field: string, bin: boolean | BinParams) { - const normalizedBin = normalizeBin(bin, undefined) ?? {}; - const key = binKey(normalizedBin, field); - return model.getName(`${key}_bins`); -} - -function isBinTransform(t: TypedFieldDef | BinTransform): t is BinTransform { - return 'as' in t; -} - -function createBinComponent(t: TypedFieldDef | BinTransform, bin: boolean | BinParams, model: Model) { - let as: [string, string]; - let span: string; - - if (isBinTransform(t)) { - as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]]; - } else { - as = [vgField(t, {forAs: true}), vgField(t, {binSuffix: 'end', forAs: true})]; - } - - const normalizedBin = {...normalizeBin(bin, undefined)}; - const key = binKey(normalizedBin, t.field); - const {signal, extentSignal} = getSignalsFromModel(model, key); - - if (isSelectionExtent(normalizedBin.extent)) { - const ext = normalizedBin.extent; - const selName = ext.selection; - span = parseSelectionBinExtent(model.getSelectionComponent(varName(selName), selName), ext); - delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property. - } - - const binComponent: BinComponent = { - bin: normalizedBin, - field: t.field, - as: [as], - ...(signal ? {signal} : {}), - ...(extentSignal ? {extentSignal} : {}), - ...(span ? {span} : {}) - }; - - return {key, binComponent}; -} - -export interface BinComponent { - bin: BinParams; - field: FieldName; - extentSignal?: string; - signal?: string; - span?: string; - - /** Pairs of strings of the names of start and end signals */ - as: [string, string][]; - - // Range Formula - - formula?: string; - formulaAs?: string; -} - -export class BinNode extends DataFlowNode { - public clone() { - return new BinNode(null, duplicate(this.bins)); - } - - constructor(parent: DataFlowNode, private bins: Dict) { - super(parent); - } - - public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) { - const bins = model.reduceFieldDef((binComponentIndex: Dict, fieldDef, channel) => { - if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) { - const {key, binComponent} = createBinComponent(fieldDef, fieldDef.bin, model); - binComponentIndex[key] = { - ...binComponent, - ...binComponentIndex[key], - ...rangeFormula(model, fieldDef, channel, model.config) - }; - } - return binComponentIndex; - }, {} as Dict); - - if (isEmpty(bins)) { - return null; - } - - return new BinNode(parent, bins); - } - - /** - * Creates a bin node from BinTransform. - * The optional parameter should provide - */ - public static makeFromTransform(parent: DataFlowNode, t: BinTransform, model: Model) { - const {key, binComponent} = createBinComponent(t, t.bin, model); - return new BinNode(parent, { - [key]: binComponent - }); - } - - /** - * Merge bin nodes. This method either integrates the bin config from the other node - * or if this node already has a bin config, renames the corresponding signal in the model. - */ - public merge(other: BinNode, renameSignal: (s1: string, s2: string) => void) { - for (const key of keys(other.bins)) { - if (key in this.bins) { - renameSignal(other.bins[key].signal, this.bins[key].signal); - // Ensure that we don't have duplicate names for signal pairs - this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash); - } else { - this.bins[key] = other.bins[key]; - } - } - - for (const child of other.children) { - other.removeChild(child); - child.parent = this; - } - other.remove(); - } - - public producedFields() { - return new Set( - vals(this.bins) - .map(c => c.as) - .flat(2) - ); - } - - public dependentFields() { - return new Set(vals(this.bins).map(c => c.field)); - } - - public hash() { - return `Bin ${hash(this.bins)}`; - } - - public assemble(): VgTransform[] { - return vals(this.bins).flatMap(bin => { - const transform: VgTransform[] = []; - - const [binAs, ...remainingAs] = bin.as; - const {extent, ...params} = bin.bin; - const binTrans: VgBinTransform = { - type: 'bin', - field: replacePathInField(bin.field), - as: binAs, - signal: bin.signal, - ...(!isSelectionExtent(extent) ? {extent} : {extent: null}), - ...(bin.span ? {span: {signal: `span(${bin.span})`}} : {}), - ...params - }; - - if (!extent && bin.extentSignal) { - transform.push({ - type: 'extent', - field: replacePathInField(bin.field), - signal: bin.extentSignal - }); - binTrans.extent = {signal: bin.extentSignal}; - } - - transform.push(binTrans); - - for (const as of remainingAs) { - for (let i = 0; i < 2; i++) { - transform.push({ - type: 'formula', - expr: vgField({field: binAs[i]}, {expr: 'datum'}), - as: as[i] - }); - } - } - - if (bin.formula) { - transform.push({ - type: 'formula', - expr: bin.formula, - as: bin.formulaAs - }); - } - return transform; - }); - } -} diff --git a/node_modules/vega-lite/src/compile/data/calculate.ts b/node_modules/vega-lite/src/compile/data/calculate.ts deleted file mode 100644 index c31baf2..0000000 --- a/node_modules/vega-lite/src/compile/data/calculate.ts +++ /dev/null @@ -1,75 +0,0 @@ -import {FormulaTransform as VgFormulaTransform} from 'vega'; -import {SingleDefChannel} from '../../channel'; -import {FieldRefOption, isScaleFieldDef, TypedFieldDef, vgField} from '../../channeldef'; -import {DateTime} from '../../datetime'; -import {fieldFilterExpression} from '../../predicate'; -import {isSortArray} from '../../sort'; -import {CalculateTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {ModelWithField} from '../model'; -import {DataFlowNode} from './dataflow'; -import {getDependentFields} from './expressions'; - -export class CalculateNode extends DataFlowNode { - private _dependentFields: Set; - - public clone() { - return new CalculateNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private readonly transform: CalculateTransform) { - super(parent); - - this._dependentFields = getDependentFields(this.transform.calculate); - } - - public static parseAllForSortIndex(parent: DataFlowNode, model: ModelWithField) { - // get all the encoding with sort fields from model - model.forEachFieldDef((fieldDef: TypedFieldDef, channel: SingleDefChannel) => { - if (!isScaleFieldDef(fieldDef)) { - return; - } - if (isSortArray(fieldDef.sort)) { - const {field, timeUnit} = fieldDef; - const sort: (number | string | boolean | DateTime)[] = fieldDef.sort; - // generate `datum["a"] === val0 ? 0 : datum["a"] === val1 ? 1 : ... : n` via FieldEqualPredicate - const calculate = - sort - .map((sortValue, i) => { - return `${fieldFilterExpression({field, timeUnit, equal: sortValue})} ? ${i} : `; - }) - .join('') + sort.length; - - parent = new CalculateNode(parent, { - calculate, - as: sortArrayIndexField(fieldDef, channel, {forAs: true}) - }); - } - }); - return parent; - } - - public producedFields() { - return new Set([this.transform.as]); - } - - public dependentFields() { - return this._dependentFields; - } - - public assemble(): VgFormulaTransform { - return { - type: 'formula', - expr: this.transform.calculate, - as: this.transform.as - }; - } - - public hash() { - return `Calculate ${hash(this.transform)}`; - } -} - -export function sortArrayIndexField(fieldDef: TypedFieldDef, channel: SingleDefChannel, opt?: FieldRefOption) { - return vgField(fieldDef, {prefix: channel, suffix: 'sort_index', ...(opt ?? {})}); -} diff --git a/node_modules/vega-lite/src/compile/data/dataflow.ts b/node_modules/vega-lite/src/compile/data/dataflow.ts deleted file mode 100644 index 43b7667..0000000 --- a/node_modules/vega-lite/src/compile/data/dataflow.ts +++ /dev/null @@ -1,199 +0,0 @@ -import {DataSourceType} from '../../data'; -import * as log from '../../log'; -import {Dict, uniqueId} from '../../util'; - -/** - * A node in the dataflow tree. - */ -export abstract class DataFlowNode { - private _children: DataFlowNode[] = []; - - private _parent: DataFlowNode = null; - - protected _hash: string | number; - - constructor(parent: DataFlowNode, public readonly debugName?: string) { - if (parent) { - this.parent = parent; - } - } - - /** - * Clone this node with a deep copy but don't clone links to children or parents. - */ - public clone(): DataFlowNode { - throw new Error('Cannot clone node'); - } - - /** - * Return a hash of the node. - */ - public abstract hash(): string | number; - - /** - * Set of fields that this node depends on. - */ - public abstract dependentFields(): Set; - - /** - * Set of fields that are being created by this node. - */ - public abstract producedFields(): Set; - - get parent() { - return this._parent; - } - - /** - * Set the parent of the node and also add this node to the parent's children. - */ - set parent(parent: DataFlowNode) { - this._parent = parent; - if (parent) { - parent.addChild(this); - } - } - - get children() { - return this._children; - } - - public numChildren() { - return this._children.length; - } - - public addChild(child: DataFlowNode, loc?: number) { - // do not add the same child twice - if (this._children.indexOf(child) > -1) { - log.warn(log.message.ADD_SAME_CHILD_TWICE); - return; - } - - if (loc !== undefined) { - this._children.splice(loc, 0, child); - } else { - this._children.push(child); - } - } - - public removeChild(oldChild: DataFlowNode) { - const loc = this._children.indexOf(oldChild); - this._children.splice(loc, 1); - return loc; - } - - /** - * Remove node from the dataflow. - */ - public remove() { - let loc = this._parent.removeChild(this); - for (const child of this._children) { - // do not use the set method because we want to insert at a particular location - child._parent = this._parent; - this._parent.addChild(child, loc++); - } - } - - /** - * Insert another node as a parent of this node. - */ - public insertAsParentOf(other: DataFlowNode) { - const parent = other.parent; - parent.removeChild(this); - this.parent = parent; - other.parent = this; - } - - public swapWithParent() { - const parent = this._parent; - const newParent = parent.parent; - - // reconnect the children - for (const child of this._children) { - child.parent = parent; - } - - // remove old links - this._children = []; // equivalent to removing every child link one by one - parent.removeChild(this); - parent.parent.removeChild(parent); - - // swap two nodes - this.parent = newParent; - parent.parent = this; - } -} - -export class OutputNode extends DataFlowNode { - private _source: string; - - private _name: string; - - public clone(): this { - const cloneObj = new (this.constructor as any)(); - cloneObj.debugName = 'clone_' + this.debugName; - cloneObj._source = this._source; - cloneObj._name = 'clone_' + this._name; - cloneObj.type = this.type; - cloneObj.refCounts = this.refCounts; - cloneObj.refCounts[cloneObj._name] = 0; - return cloneObj; - } - - /** - * @param source The name of the source. Will change in assemble. - * @param type The type of the output node. - * @param refCounts A global ref counter map. - */ - constructor( - parent: DataFlowNode, - source: string, - public readonly type: DataSourceType, - private readonly refCounts: Dict - ) { - super(parent, source); - - this._source = this._name = source; - - if (this.refCounts && !(this._name in this.refCounts)) { - this.refCounts[this._name] = 0; - } - } - - public dependentFields() { - return new Set(); - } - - public producedFields() { - return new Set(); - } - - public hash() { - if (this._hash === undefined) { - this._hash = `Output ${uniqueId()}`; - } - return this._hash; - } - - /** - * Request the datasource name and increase the ref counter. - * - * During the parsing phase, this will return the simple name such as 'main' or 'raw'. - * It is crucial to request the name from an output node to mark it as a required node. - * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase. - * - * In the assemble phase, this will return the correct name. - */ - public getSource() { - this.refCounts[this._name]++; - return this._source; - } - - public isRequired(): boolean { - return !!this.refCounts[this._name]; - } - - public setSource(source: string) { - this._source = source; - } -} diff --git a/node_modules/vega-lite/src/compile/data/debug.ts b/node_modules/vega-lite/src/compile/data/debug.ts deleted file mode 100644 index 19c30e6..0000000 --- a/node_modules/vega-lite/src/compile/data/debug.ts +++ /dev/null @@ -1,115 +0,0 @@ -import {entries, uniqueId} from '../../util'; -import {DataFlowNode, OutputNode} from './dataflow'; -import {SourceNode} from './source'; -import pako from 'pako'; -import {checkLinks} from './optimize'; - -/** - * Print debug information for dataflow tree. - */ -export function printDebugDataflow(node: DataFlowNode) { - console.log( - `${(node.constructor as any).name}${node.debugName ? `(${node.debugName})` : ''} -> ${node.children.map(c => { - return `${(c.constructor as any).name}${c.debugName ? ` (${c.debugName})` : ''}`; - })}` - ); - console.log(node); - node.children.forEach(printDebugDataflow); -} - -/** - * Show the dataflow graph as an image (rendered by https://kroki.io/) on the command line. - */ -export function drawDataflow(roots: readonly DataFlowNode[], size = 500) { - const dot = dotString(roots); - const text = new TextEncoder().encode(dot); - const compressed = pako.deflate(text, {level: 9, to: 'string'}); - const result = btoa(compressed).replace(/\+/g, '-').replace(/\//g, '_'); - const imageURL = `https://kroki.io/plantuml/png/${result}`; - console.log('%c ', `font-size:${size}px; background:url(${imageURL}) no-repeat; background-size:contain`); -} - -/** - * Print the dataflow tree as graphviz. - * - * Render the output in e.g. http://viz-js.com/. - */ -export function dotString(roots: readonly DataFlowNode[]) { - // check the graph before printing it since the logic below assumes a consistent graph - checkLinks(roots); - - const nodes: Record = {}; - const edges: [string, string][] = []; - - function getId(node: DataFlowNode) { - let id = node['__uniqueid']; - if (id === undefined) { - id = uniqueId(); - node['__uniqueid'] = id; - } - return id; - } - - function getLabel(node: DataFlowNode) { - const out = [(node.constructor as any).name.slice(0, -4)]; - - if (node.debugName) { - out.push(`${node.debugName}`); - } else if (node instanceof SourceNode) { - if (node.data.name || node.data.url) { - out.push(`${node.data.name ?? node.data.url}`); - } - } - - const dep = node.dependentFields(); - if (dep?.size) { - out.push(`IN: ${[...node.dependentFields()].join(', ')}`); - } - const prod = node.producedFields(); - if (prod?.size) { - out.push(`OUT: ${[...node.producedFields()].join(', ')}`); - } - if (node instanceof OutputNode) { - out.push(`required: ${node.isRequired()}`); - } - return out.join('
'); - } - - function collector(node: DataFlowNode) { - const id = getId(node); - nodes[id] = { - id: id, - label: getLabel(node), - hash: - node instanceof SourceNode - ? node.data.url ?? node.data.name ?? node.debugName - : String(node.hash()).replace(/"/g, '') - }; - - for (const child of node.children) { - edges.push([id, getId(child)]); - collector(child); - } - } - - for (const n of roots) { - collector(n); - } - - const dot = `digraph DataFlow { - rankdir = TB; - node [shape=record] - ${entries(nodes) - .map( - ({key, value}) => ` "${key}" [ - label = <${value.label}>; - tooltip = "[${value.id}] ${value.hash}" - ]` - ) - .join('\n')} - - ${edges.map(([source, target]) => `"${source}" -> "${target}"`).join(' ')} -}`; - - return dot; -} diff --git a/node_modules/vega-lite/src/compile/data/density.ts b/node_modules/vega-lite/src/compile/data/density.ts deleted file mode 100644 index 208b102..0000000 --- a/node_modules/vega-lite/src/compile/data/density.ts +++ /dev/null @@ -1,42 +0,0 @@ -import {KDETransform as VgKDETransform} from 'vega'; -import {DensityTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for density transform nodes - */ -export class DensityTransformNode extends DataFlowNode { - public clone() { - return new DensityTransformNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private transform: DensityTransform) { - super(parent); - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = this.transform.as ?? [undefined, undefined]; - this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density']; - } - - public dependentFields() { - return new Set([this.transform.density, ...(this.transform.groupby ?? [])]); - } - - public producedFields() { - return new Set(this.transform.as); - } - - public hash() { - return `DensityTransform ${hash(this.transform)}`; - } - - public assemble(): VgKDETransform { - const {density, ...rest} = this.transform; - const result: VgKDETransform = { - type: 'kde', - field: density, - ...rest - }; - return result; - } -} diff --git a/node_modules/vega-lite/src/compile/data/expressions.ts b/node_modules/vega-lite/src/compile/data/expressions.ts deleted file mode 100644 index 5d84810..0000000 --- a/node_modules/vega-lite/src/compile/data/expressions.ts +++ /dev/null @@ -1,39 +0,0 @@ -import {parse} from 'vega-expression'; - -function getName(node: any) { - const name: string[] = []; - - if (node.type === 'Identifier') { - return [node.name]; - } - - if (node.type === 'Literal') { - return [node.value]; - } - - if (node.type === 'MemberExpression') { - name.push(...getName(node.object)); - name.push(...getName(node.property)); - } - - return name; -} - -function startsWithDatum(node: any): boolean { - if (node.object.type === 'MemberExpression') { - return startsWithDatum(node.object); - } - return node.object.name === 'datum'; -} - -export function getDependentFields(expression: string) { - const ast = parse(expression); - const dependents = new Set(); - ast.visit((node: any) => { - if (node.type === 'MemberExpression' && startsWithDatum(node)) { - dependents.add(getName(node).slice(1).join('.')); - } - }); - - return dependents; -} diff --git a/node_modules/vega-lite/src/compile/data/facet.ts b/node_modules/vega-lite/src/compile/data/facet.ts deleted file mode 100644 index fd48e4e..0000000 --- a/node_modules/vega-lite/src/compile/data/facet.ts +++ /dev/null @@ -1,305 +0,0 @@ -import {AggregateOp} from 'vega'; -import {isArray} from 'vega-util'; -import {isBinning} from '../../bin'; -import {COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../../channel'; -import {vgField} from '../../channeldef'; -import * as log from '../../log'; -import {hasDiscreteDomain} from '../../scale'; -import {DEFAULT_SORT_OP, EncodingSortField, isSortField} from '../../sort'; -import {hash} from '../../util'; -import {isVgRangeStep, VgData} from '../../vega.schema'; -import {FacetModel} from '../facet'; -import {HEADER_CHANNELS, HEADER_TYPES} from '../header/component'; -import {Model} from '../model'; -import {assembleDomain, getFieldFromDomain} from '../scale/domain'; -import {sortArrayIndexField} from './calculate'; -import {DataFlowNode} from './dataflow'; - -interface ChildIndependentFieldsWithStep { - x?: string; - y?: string; -} - -interface FacetChannelInfo { - name: string; - fields: string[]; - sortField?: EncodingSortField; - - sortIndexField?: string; -} - -/** - * A node that helps us track what fields we are faceting by. - */ -export class FacetNode extends DataFlowNode { - private readonly column: FacetChannelInfo; - - private readonly row: FacetChannelInfo; - - private readonly facet: FacetChannelInfo; - - private readonly childModel: Model; - - /** - * @param model The facet model. - * @param name The name that this facet source will have. - * @param data The source data for this facet data. - */ - public constructor( - parent: DataFlowNode, - public readonly model: FacetModel, - public readonly name: string, - public data: string - ) { - super(parent); - - for (const channel of FACET_CHANNELS) { - const fieldDef = model.facet[channel]; - if (fieldDef) { - const {bin, sort} = fieldDef; - this[channel] = { - name: model.getName(`${channel}_domain`), - fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, {binSuffix: 'end'})] : [])], - ...(isSortField(sort) - ? {sortField: sort} - : isArray(sort) - ? {sortIndexField: sortArrayIndexField(fieldDef, channel)} - : {}) - }; - } - } - this.childModel = model.child; - } - - public hash() { - let out = `Facet`; - - for (const channel of FACET_CHANNELS) { - if (this[channel]) { - out += ` ${channel.charAt(0)}:${hash(this[channel])}`; - } - } - - return out; - } - - get fields() { - const f: string[] = []; - - for (const channel of FACET_CHANNELS) { - if (this[channel]?.fields) { - f.push(...this[channel].fields); - } - } - return f; - } - - public dependentFields() { - const depFields = new Set(this.fields); - - for (const channel of FACET_CHANNELS) { - if (this[channel]) { - if (this[channel].sortField) { - depFields.add(this[channel].sortField.field); - } - if (this[channel].sortIndexField) { - depFields.add(this[channel].sortIndexField); - } - } - } - - return depFields; - } - - public producedFields() { - return new Set(); // facet does not produce any new fields - } - - /** - * The name to reference this source is its name. - */ - public getSource() { - return this.name; - } - - private getChildIndependentFieldsWithStep() { - const childIndependentFieldsWithStep: ChildIndependentFieldsWithStep = {}; - - for (const channel of POSITION_SCALE_CHANNELS) { - const childScaleComponent = this.childModel.component.scales[channel]; - if (childScaleComponent && !childScaleComponent.merged) { - // independent scale - const type = childScaleComponent.get('type'); - const range = childScaleComponent.get('range'); - - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const domain = assembleDomain(this.childModel, channel); - const field = getFieldFromDomain(domain); - if (field) { - childIndependentFieldsWithStep[channel] = field; - } else { - log.warn(log.message.unknownField(channel)); - } - } - } - } - - return childIndependentFieldsWithStep; - } - - private assembleRowColumnHeaderData( - channel: 'row' | 'column' | 'facet', - crossedDataName: string, - childIndependentFieldsWithStep: ChildIndependentFieldsWithStep - ): VgData { - const childChannel = {row: 'y', column: 'x'}[channel]; - - const fields: string[] = []; - const ops: AggregateOp[] = []; - const as: string[] = []; - - if (childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) { - if (crossedDataName) { - // If there is a crossed data, calculate max - fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); - - ops.push('max'); - } else { - // If there is no crossed data, just calculate distinct - fields.push(childIndependentFieldsWithStep[childChannel]); - ops.push('distinct'); - } - // Although it is technically a max, just name it distinct so it's easier to refer to it - as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); - } - - const {sortField, sortIndexField} = this[channel]; - if (sortField) { - const {op = DEFAULT_SORT_OP, field} = sortField; - fields.push(field); - ops.push(op); - as.push(vgField(sortField, {forAs: true})); - } else if (sortIndexField) { - fields.push(sortIndexField); - ops.push('max'); - as.push(sortIndexField); - } - - return { - name: this[channel].name, - // Use data from the crossed one if it exist - source: crossedDataName ?? this.data, - transform: [ - { - type: 'aggregate', - groupby: this[channel].fields, - ...(fields.length - ? { - fields, - ops, - as - } - : {}) - } - ] - }; - } - - private assembleFacetHeaderData(childIndependentFieldsWithStep: ChildIndependentFieldsWithStep) { - const {columns} = this.model.layout; - const {layoutHeaders} = this.model.component; - const data: VgData[] = []; - - const hasSharedAxis: {row?: true; column?: true} = {}; - for (const headerChannel of HEADER_CHANNELS) { - for (const headerType of HEADER_TYPES) { - const headers = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) ?? []; - for (const header of headers) { - if (header.axes?.length > 0) { - hasSharedAxis[headerChannel] = true; - break; - } - } - } - - if (hasSharedAxis[headerChannel]) { - const cardinality = `length(data("${this.facet.name}"))`; - - const stop = - headerChannel === 'row' - ? columns - ? {signal: `ceil(${cardinality} / ${columns})`} - : 1 - : columns - ? {signal: `min(${cardinality}, ${columns})`} - : {signal: cardinality}; - - data.push({ - name: `${this.facet.name}_${headerChannel}`, - transform: [ - { - type: 'sequence', - start: 0, - stop - } - ] - }); - } - } - - const {row, column} = hasSharedAxis; - - if (row || column) { - data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep)); - } - - return data; - } - - public assemble() { - const data: VgData[] = []; - let crossedDataName = null; - const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep(); - - const {column, row, facet} = this; - - if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) { - // Need to create a cross dataset to correctly calculate cardinality - crossedDataName = `cross_${this.column.name}_${this.row.name}`; - - const fields: string[] = [].concat( - childIndependentFieldsWithStep.x ?? [], - childIndependentFieldsWithStep.y ?? [] - ); - const ops = fields.map((): AggregateOp => 'distinct'); - - data.push({ - name: crossedDataName, - source: this.data, - transform: [ - { - type: 'aggregate', - groupby: this.fields, - fields, - ops - } - ] - }); - } - - for (const channel of [COLUMN, ROW]) { - if (this[channel]) { - data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep)); - } - } - - if (facet) { - const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep); - if (facetData) { - data.push(...facetData); - } - } - - return data; - } -} diff --git a/node_modules/vega-lite/src/compile/data/filter.ts b/node_modules/vega-lite/src/compile/data/filter.ts deleted file mode 100644 index e592798..0000000 --- a/node_modules/vega-lite/src/compile/data/filter.ts +++ /dev/null @@ -1,49 +0,0 @@ -import {FilterTransform as VgFilterTransform} from 'vega'; -import {LogicalComposition} from '../../logical'; -import {Predicate} from '../../predicate'; -import {duplicate} from '../../util'; -import {Model} from '../model'; -import {expression} from '../predicate'; -import {DataFlowNode} from './dataflow'; -import {getDependentFields} from './expressions'; - -export class FilterNode extends DataFlowNode { - private expr: string; - private _dependentFields: Set; - public clone() { - return new FilterNode(null, this.model, duplicate(this.filter)); - } - - constructor( - parent: DataFlowNode, - private readonly model: Model, - private readonly filter: LogicalComposition - ) { - super(parent); - - // TODO: refactor this to not take a node and - // then add a static function makeFromOperand and make the constructor take only an expression - this.expr = expression(this.model, this.filter, this); - - this._dependentFields = getDependentFields(this.expr); - } - - public dependentFields() { - return this._dependentFields; - } - - public producedFields() { - return new Set(); // filter does not produce any new fields - } - - public assemble(): VgFilterTransform { - return { - type: 'filter', - expr: this.expr - }; - } - - public hash() { - return `Filter ${this.expr}`; - } -} diff --git a/node_modules/vega-lite/src/compile/data/filterinvalid.ts b/node_modules/vega-lite/src/compile/data/filterinvalid.ts deleted file mode 100644 index e0cadf5..0000000 --- a/node_modules/vega-lite/src/compile/data/filterinvalid.ts +++ /dev/null @@ -1,90 +0,0 @@ -import {FilterTransform as VgFilterTransform} from 'vega'; -import {isScaleChannel} from '../../channel'; -import {TypedFieldDef, vgField as fieldRef} from '../../channeldef'; -import {isPathMark} from '../../mark'; -import {hasContinuousDomain} from '../../scale'; -import {Dict, hash, keys} from '../../util'; -import {getMarkPropOrConfig} from '../common'; -import {UnitModel} from '../unit'; -import {DataFlowNode} from './dataflow'; - -export class FilterInvalidNode extends DataFlowNode { - public clone() { - return new FilterInvalidNode(null, {...this.filter}); - } - - constructor(parent: DataFlowNode, public readonly filter: Dict>) { - super(parent); - } - - public static make(parent: DataFlowNode, model: UnitModel): FilterInvalidNode { - const {config, mark, markDef} = model; - - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid !== 'filter') { - return null; - } - - const filter = model.reduceFieldDef((aggregator: Dict>, fieldDef, channel) => { - const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - - // While discrete domain scales can handle invalid values, continuous scales can't. - // Thus, for non-path marks, we have to filter null for scales with continuous domains. - // (For path marks, we will use "defined" property and skip these values instead.) - if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { - aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def - } - } - return aggregator; - }, {} as Dict>); - - if (!keys(filter).length) { - return null; - } - - return new FilterInvalidNode(parent, filter); - } - - public dependentFields() { - return new Set(keys(this.filter)); - } - - public producedFields() { - return new Set(); // filter does not produce any new fields - } - - public hash() { - return `FilterInvalid ${hash(this.filter)}`; - } - - /** - * Create the VgTransforms for each of the filtered fields. - */ - public assemble(): VgFilterTransform { - const filters = keys(this.filter).reduce((vegaFilters, field) => { - const fieldDef = this.filter[field]; - const ref = fieldRef(fieldDef, {expr: 'datum'}); - - if (fieldDef !== null) { - if (fieldDef.type === 'temporal') { - vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`); - } else if (fieldDef.type === 'quantitative') { - vegaFilters.push(`isValid(${ref})`); - vegaFilters.push(`isFinite(+${ref})`); - } else { - // should never get here - } - } - return vegaFilters; - }, [] as string[]); - - return filters.length > 0 - ? { - type: 'filter', - expr: filters.join(' && ') - } - : null; - } -} diff --git a/node_modules/vega-lite/src/compile/data/flatten.ts b/node_modules/vega-lite/src/compile/data/flatten.ts deleted file mode 100644 index 3a4c8b8..0000000 --- a/node_modules/vega-lite/src/compile/data/flatten.ts +++ /dev/null @@ -1,43 +0,0 @@ -import {FlattenTransform as VgFlattenTransform} from 'vega'; -import {FlattenTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for flatten transform nodes - */ -export class FlattenTransformNode extends DataFlowNode { - public clone() { - return new FlattenTransformNode(this.parent, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private transform: FlattenTransform) { - super(parent); - this.transform = duplicate(transform); // duplicate to prevent side effects - const {flatten, as = []} = this.transform; - this.transform.as = flatten.map((f, i) => as[i] ?? f); - } - - public dependentFields() { - return new Set(this.transform.flatten); - } - - public producedFields() { - return new Set(this.transform.as); - } - - public hash() { - return `FlattenTransform ${hash(this.transform)}`; - } - - public assemble(): VgFlattenTransform { - const {flatten: fields, as} = this.transform; - - const result: VgFlattenTransform = { - type: 'flatten', - fields, - as - }; - return result; - } -} diff --git a/node_modules/vega-lite/src/compile/data/fold.ts b/node_modules/vega-lite/src/compile/data/fold.ts deleted file mode 100644 index 6466a3e..0000000 --- a/node_modules/vega-lite/src/compile/data/fold.ts +++ /dev/null @@ -1,42 +0,0 @@ -import {FoldTransform as VgFoldTransform} from 'vega'; -import {FoldTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for flatten transform nodes - */ -export class FoldTransformNode extends DataFlowNode { - public clone() { - return new FoldTransformNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private transform: FoldTransform) { - super(parent); - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = this.transform.as ?? [undefined, undefined]; - this.transform.as = [specifiedAs[0] ?? 'key', specifiedAs[1] ?? 'value']; - } - - public dependentFields() { - return new Set(this.transform.fold); - } - - public producedFields() { - return new Set(this.transform.as); - } - - public hash() { - return `FoldTransform ${hash(this.transform)}`; - } - - public assemble(): VgFoldTransform { - const {fold, as} = this.transform; - const result: VgFoldTransform = { - type: 'fold', - fields: fold, - as - }; - return result; - } -} diff --git a/node_modules/vega-lite/src/compile/data/formatparse.ts b/node_modules/vega-lite/src/compile/data/formatparse.ts deleted file mode 100644 index 02a126b..0000000 --- a/node_modules/vega-lite/src/compile/data/formatparse.ts +++ /dev/null @@ -1,331 +0,0 @@ -import {FormulaTransform as VgFormulaTransform, SignalRef} from 'vega'; -import {isNumber, isString} from 'vega-util'; -import {AncestorParse} from '.'; -import {isMinMaxOp} from '../../aggregate'; -import {getMainRangeChannel, SingleDefChannel} from '../../channel'; -import { - isFieldDef, - isFieldOrDatumDefForTimeFormat, - isScaleFieldDef, - isTypedFieldDef, - TypedFieldDef -} from '../../channeldef'; -import {isGenerator, Parse} from '../../data'; -import {DateTime, isDateTime} from '../../datetime'; -import * as log from '../../log'; -import {forEachLeaf} from '../../logical'; -import {isPathMark} from '../../mark'; -import {isFieldEqualPredicate, isFieldOneOfPredicate, isFieldPredicate, isFieldRangePredicate} from '../../predicate'; -import {isSortField} from '../../sort'; -import {FilterTransform} from '../../transform'; -import {accessPathDepth, accessPathWithDatum, Dict, duplicate, hash, keys, removePathFromField} from '../../util'; -import {isFacetModel, isUnitModel, Model} from '../model'; -import {Split} from '../split'; -import {DataFlowNode} from './dataflow'; - -/** - * Remove quotes from a string. - */ -function unquote(pattern: string) { - if ( - (pattern[0] === "'" && pattern[pattern.length - 1] === "'") || - (pattern[0] === '"' && pattern[pattern.length - 1] === '"') - ) { - return pattern.slice(1, -1); - } - return pattern; -} - -/** - * @param field The field. - * @param parse What to parse the field as. - */ -function parseExpression(field: string, parse: string): string { - const f = accessPathWithDatum(field); - if (parse === 'number') { - return `toNumber(${f})`; - } else if (parse === 'boolean') { - return `toBoolean(${f})`; - } else if (parse === 'string') { - return `toString(${f})`; - } else if (parse === 'date') { - return `toDate(${f})`; - } else if (parse === 'flatten') { - return f; - } else if (parse.indexOf('date:') === 0) { - const specifier = unquote(parse.slice(5, parse.length)); - return `timeParse(${f},'${specifier}')`; - } else if (parse.indexOf('utc:') === 0) { - const specifier = unquote(parse.slice(4, parse.length)); - return `utcParse(${f},'${specifier}')`; - } else { - log.warn(log.message.unrecognizedParse(parse)); - return null; - } -} - -export function getImplicitFromFilterTransform(transform: FilterTransform) { - const implicit: Dict = {}; - forEachLeaf(transform.filter, filter => { - if (isFieldPredicate(filter)) { - // Automatically add a parse node for filters with filter objects - let val: string | number | boolean | DateTime | SignalRef = null; - - // For EqualFilter, just use the equal property. - // For RangeFilter and OneOfFilter, all array members should have - // the same type, so we only use the first one. - if (isFieldEqualPredicate(filter)) { - val = filter.equal; - } else if (isFieldRangePredicate(filter)) { - val = filter.range[0]; - } else if (isFieldOneOfPredicate(filter)) { - val = (filter.oneOf ?? filter['in'])[0]; - } // else -- for filter expression, we can't infer anything - if (val) { - if (isDateTime(val)) { - implicit[filter.field] = 'date'; - } else if (isNumber(val)) { - implicit[filter.field] = 'number'; - } else if (isString(val)) { - implicit[filter.field] = 'string'; - } - } - - if (filter.timeUnit) { - implicit[filter.field] = 'date'; - } - } - }); - - return implicit; -} - -/** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ -export function getImplicitFromEncoding(model: Model) { - const implicit: Dict = {}; - - function add(fieldDef: TypedFieldDef) { - if (isFieldOrDatumDefForTimeFormat(fieldDef)) { - implicit[fieldDef.field] = 'date'; - } else if ( - fieldDef.type === 'quantitative' && - isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max - ) { - implicit[fieldDef.field] = 'number'; - } else if (accessPathDepth(fieldDef.field) > 1) { - // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field. - // (Parsing numbers / dates already flattens numeric and temporal fields.) - if (!(fieldDef.field in implicit)) { - implicit[fieldDef.field] = 'flatten'; - } - } else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) { - // Flatten fields that we sort by but that are not otherwise flattened. - if (!(fieldDef.sort.field in implicit)) { - implicit[fieldDef.sort.field] = 'flatten'; - } - } - } - - if (isUnitModel(model) || isFacetModel(model)) { - // Parse encoded fields - model.forEachFieldDef((fieldDef, channel) => { - if (isTypedFieldDef(fieldDef)) { - add(fieldDef); - } else { - const mainChannel = getMainRangeChannel(channel); - const mainFieldDef = model.fieldDef(mainChannel as SingleDefChannel) as TypedFieldDef; - add({ - ...fieldDef, - type: mainFieldDef.type - }); - } - }); - } - - // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly. - if (isUnitModel(model)) { - const {mark, markDef, encoding} = model; - if ( - isPathMark(mark) && - // No need to sort by dimension if we have a connected scatterplot (order channel is present) - !model.encoding.order - ) { - const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; - const dimensionChannelDef = encoding[dimensionChannel]; - if ( - isFieldDef(dimensionChannelDef) && - dimensionChannelDef.type === 'quantitative' && - !(dimensionChannelDef.field in implicit) - ) { - implicit[dimensionChannelDef.field] = 'number'; - } - } - } - - return implicit; -} - -/** - * Creates a parse node for implicit parsing from a model and updates ancestorParse. - */ -export function getImplicitFromSelection(model: Model) { - const implicit: Dict = {}; - - if (isUnitModel(model) && model.component.selection) { - for (const name of keys(model.component.selection)) { - const selCmpt = model.component.selection[name]; - for (const proj of selCmpt.project.items) { - if (!proj.channel && accessPathDepth(proj.field) > 1) { - implicit[proj.field] = 'flatten'; - } - } - } - } - - return implicit; -} - -export class ParseNode extends DataFlowNode { - private _parse: Parse; - - public clone() { - return new ParseNode(null, duplicate(this._parse)); - } - - constructor(parent: DataFlowNode, parse: Parse) { - super(parent); - - this._parse = parse; - } - - public hash() { - return `Parse ${hash(this._parse)}`; - } - - /** - * Creates a parse node from a data.format.parse and updates ancestorParse. - */ - public static makeExplicit(parent: DataFlowNode, model: Model, ancestorParse: AncestorParse) { - // Custom parse - let explicit = {}; - const data = model.data; - if (!isGenerator(data) && data && data.format && data.format.parse) { - explicit = data.format.parse; - } - - return this.makeWithAncestors(parent, explicit, {}, ancestorParse); - } - - /** - * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse. - */ - public static makeWithAncestors( - parent: DataFlowNode, - explicit: Parse, - implicit: Parse, - ancestorParse: AncestorParse - ) { - // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as "derived"). We also don't need to flatten a field that has already been parsed. - for (const field of keys(implicit)) { - const parsedAs = ancestorParse.getWithExplicit(field); - if (parsedAs.value !== undefined) { - // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types. - if ( - parsedAs.explicit || - parsedAs.value === implicit[field] || - parsedAs.value === 'derived' || - implicit[field] === 'flatten' - ) { - delete implicit[field]; - } else { - log.warn(log.message.differentParse(field, implicit[field], parsedAs.value)); - } - } - } - - for (const field of keys(explicit)) { - const parsedAs = ancestorParse.get(field); - if (parsedAs !== undefined) { - // Don't parse a field again if it has been parsed with the same type already. - if (parsedAs === explicit[field]) { - delete explicit[field]; - } else { - log.warn(log.message.differentParse(field, explicit[field], parsedAs)); - } - } - } - - const parse = new Split(explicit, implicit); - - // add the format parse from this model so that children don't parse the same field again - ancestorParse.copyAll(parse); - - // copy only non-null parses - const p: Dict = {}; - for (const key of keys(parse.combine())) { - const val = parse.get(key); - if (val !== null) { - p[key] = val; - } - } - - if (keys(p).length === 0 || ancestorParse.parseNothing) { - return null; - } - - return new ParseNode(parent, p); - } - - public get parse() { - return this._parse; - } - - public merge(other: ParseNode) { - this._parse = {...this._parse, ...other.parse}; - other.remove(); - } - - /** - * Assemble an object for Vega's format.parse property. - */ - public assembleFormatParse() { - const formatParse: Dict = {}; - for (const field of keys(this._parse)) { - const p = this._parse[field]; - if (accessPathDepth(field) === 1) { - formatParse[field] = p; - } - } - return formatParse; - } - - // format parse depends and produces all fields in its parse - public producedFields() { - return new Set(keys(this._parse)); - } - - public dependentFields() { - return new Set(keys(this._parse)); - } - - public assembleTransforms(onlyNested = false): VgFormulaTransform[] { - return keys(this._parse) - .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true)) - .map(field => { - const expr = parseExpression(field, this._parse[field]); - if (!expr) { - return null; - } - - const formula: VgFormulaTransform = { - type: 'formula', - expr, - as: removePathFromField(field) // Vega output is always flattened - }; - return formula; - }) - .filter(t => t !== null); - } -} diff --git a/node_modules/vega-lite/src/compile/data/geojson.ts b/node_modules/vega-lite/src/compile/data/geojson.ts deleted file mode 100644 index 654c0a9..0000000 --- a/node_modules/vega-lite/src/compile/data/geojson.ts +++ /dev/null @@ -1,83 +0,0 @@ -import {GeoJSONTransform as VgGeoJSONTransform, Vector2} from 'vega'; -import {isString} from 'vega-util'; -import {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel'; -import {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef'; -import {GEOJSON} from '../../type'; -import {duplicate, hash} from '../../util'; -import {VgExprRef} from '../../vega.schema'; -import {UnitModel} from '../unit'; -import {DataFlowNode} from './dataflow'; - -export class GeoJSONNode extends DataFlowNode { - public clone() { - return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal); - } - - public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode { - if (model.component.projection && !model.component.projection.isFit) { - return parent; - } - - let geoJsonCounter = 0; - - for (const coordinates of [ - [LONGITUDE, LATITUDE], - [LONGITUDE2, LATITUDE2] - ] as Vector2[]) { - const pair = coordinates.map(channel => { - const def = getFieldOrDatumDef(model.encoding[channel]); - return isFieldDef(def) - ? def.field - : isDatumDef(def) - ? {expr: `${def.datum}`} - : isValueDef(def) - ? {expr: `${def['value']}`} - : undefined; - }) as [GeoPositionChannel, GeoPositionChannel]; - - if (pair[0] || pair[1]) { - parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`)); - } - } - - if (model.channelHasField(SHAPE)) { - const fieldDef = model.typedFieldDef(SHAPE); - if (fieldDef.type === GEOJSON) { - parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`)); - } - } - - return parent; - } - - constructor( - parent: DataFlowNode, - private fields?: Vector2, - private geojson?: string, - private signal?: string - ) { - super(parent); - } - - public dependentFields() { - const fields = (this.fields ?? []).filter(isString) as string[]; - return new Set([...(this.geojson ? [this.geojson] : []), ...fields]); - } - - public producedFields() { - return new Set(); - } - - public hash() { - return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`; - } - - public assemble(): VgGeoJSONTransform { - return { - type: 'geojson', - ...(this.fields ? {fields: this.fields} : {}), - ...(this.geojson ? {geojson: this.geojson} : {}), - signal: this.signal - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/geopoint.ts b/node_modules/vega-lite/src/compile/data/geopoint.ts deleted file mode 100644 index 8813015..0000000 --- a/node_modules/vega-lite/src/compile/data/geopoint.ts +++ /dev/null @@ -1,77 +0,0 @@ -import {GeoPointTransform as VgGeoPointTransform, Vector2} from 'vega'; -import {isString} from 'vega-util'; -import {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2} from '../../channel'; -import {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef'; -import {duplicate, hash} from '../../util'; -import {VgExprRef} from '../../vega.schema'; -import {UnitModel} from '../unit'; -import {DataFlowNode} from './dataflow'; - -export class GeoPointNode extends DataFlowNode { - public clone() { - return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as)); - } - - constructor( - parent: DataFlowNode, - private projection: string, - private fields: [string | VgExprRef, string | VgExprRef], - private as: [string, string] - ) { - super(parent); - } - - public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode { - if (!model.projectionName()) { - return parent; - } - - for (const coordinates of [ - [LONGITUDE, LATITUDE], - [LONGITUDE2, LATITUDE2] - ] as Vector2[]) { - const pair = coordinates.map(channel => { - const def = getFieldOrDatumDef(model.encoding[channel]); - return isFieldDef(def) - ? def.field - : isDatumDef(def) - ? {expr: `${def.datum}`} - : isValueDef(def) - ? {expr: `${def['value']}`} - : undefined; - }) as [GeoPositionChannel, GeoPositionChannel]; - - const suffix = coordinates[0] === LONGITUDE2 ? '2' : ''; - - if (pair[0] || pair[1]) { - parent = new GeoPointNode(parent, model.projectionName(), pair, [ - model.getName('x' + suffix), - model.getName('y' + suffix) - ]); - } - } - - return parent; - } - - public dependentFields() { - return new Set(this.fields.filter(isString)); - } - - public producedFields() { - return new Set(this.as); - } - - public hash() { - return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`; - } - - public assemble(): VgGeoPointTransform { - return { - type: 'geopoint', - projection: this.projection, - fields: this.fields, - as: this.as - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/graticule.ts b/node_modules/vega-lite/src/compile/data/graticule.ts deleted file mode 100644 index 2aa9321..0000000 --- a/node_modules/vega-lite/src/compile/data/graticule.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {GraticuleTransform as VgGraticuleTransform} from 'vega'; -import {GraticuleParams} from '../../data'; -import {hash} from '../../util'; -import {DataFlowNode} from './dataflow'; - -export class GraticuleNode extends DataFlowNode { - public clone() { - return new GraticuleNode(null, this.params); - } - - constructor(parent: DataFlowNode, private params: true | GraticuleParams) { - super(parent); - } - - public dependentFields() { - return new Set(); - } - - public producedFields(): undefined { - return undefined; // there should never be a node before graticule - } - - public hash() { - return `Graticule ${hash(this.params)}`; - } - - public assemble(): VgGraticuleTransform { - return { - type: 'graticule', - ...(this.params === true ? {} : this.params) - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/identifier.ts b/node_modules/vega-lite/src/compile/data/identifier.ts deleted file mode 100644 index fdc40cd..0000000 --- a/node_modules/vega-lite/src/compile/data/identifier.ts +++ /dev/null @@ -1,29 +0,0 @@ -import {SELECTION_ID} from '../../selection'; -import {IdentifierTransform as VgIdentifierTransform} from 'vega'; -import {DataFlowNode} from './dataflow'; - -export class IdentifierNode extends DataFlowNode { - public clone() { - return new IdentifierNode(null); - } - - constructor(parent: DataFlowNode) { - super(parent); - } - - public dependentFields() { - return new Set(); - } - - public producedFields() { - return new Set([SELECTION_ID]); - } - - public hash() { - return 'Identifier'; - } - - public assemble(): VgIdentifierTransform { - return {type: 'identifier', as: SELECTION_ID}; - } -} diff --git a/node_modules/vega-lite/src/compile/data/impute.ts b/node_modules/vega-lite/src/compile/data/impute.ts deleted file mode 100644 index 63f8c09..0000000 --- a/node_modules/vega-lite/src/compile/data/impute.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { - FormulaTransform as VgFormulaTransform, - ImputeTransform as VgImputeTransform, - SignalRef, - WindowTransform as VgWindowTransform -} from 'vega'; -import {isFieldDef} from '../../channeldef'; -import {pathGroupingFields} from '../../encoding'; -import {ImputeSequence, ImputeTransform, isImputeSequence} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {UnitModel} from '../unit'; -import {DataFlowNode} from './dataflow'; - -export class ImputeNode extends DataFlowNode { - public clone() { - return new ImputeNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private readonly transform: ImputeTransform) { - super(parent); - } - - public dependentFields() { - return new Set([this.transform.impute, this.transform.key, ...(this.transform.groupby ?? [])]); - } - - public producedFields() { - return new Set([this.transform.impute]); - } - - private processSequence(keyvals: ImputeSequence): SignalRef { - const {start = 0, stop, step} = keyvals; - const result = [start, stop, ...(step ? [step] : [])].join(','); - - return {signal: `sequence(${result})`}; - } - - public static makeFromTransform(parent: DataFlowNode, imputeTransform: ImputeTransform): ImputeNode { - return new ImputeNode(parent, imputeTransform); - } - - public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) { - const encoding = model.encoding; - const xDef = encoding.x; - const yDef = encoding.y; - - if (isFieldDef(xDef) && isFieldDef(yDef)) { - const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined; - if (imputedChannel === undefined) { - return undefined; - } - const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined; - const {method, value, frame, keyvals} = imputedChannel.impute; - const groupbyFields = pathGroupingFields(model.mark, encoding); - - return new ImputeNode(parent, { - impute: imputedChannel.field, - key: keyChannel.field, - ...(method ? {method} : {}), - ...(value !== undefined ? {value} : {}), - ...(frame ? {frame} : {}), - ...(keyvals !== undefined ? {keyvals} : {}), - ...(groupbyFields.length ? {groupby: groupbyFields} : {}) - }); - } - return null; - } - - public hash() { - return `Impute ${hash(this.transform)}`; - } - - public assemble() { - const {impute, key, keyvals, method, groupby, value, frame = [null, null] as [null, null]} = this.transform; - - const imputeTransform: VgImputeTransform = { - type: 'impute', - field: impute, - key, - ...(keyvals ? {keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals} : {}), - method: 'value', - ...(groupby ? {groupby} : {}), - value: !method || method === 'value' ? value : null - }; - - if (method && method !== 'value') { - const deriveNewField: VgWindowTransform = { - type: 'window', - as: [`imputed_${impute}_value`], - ops: [method], - fields: [impute], - frame, - ignorePeers: false, - ...(groupby ? {groupby} : {}) - }; - const replaceOriginal: VgFormulaTransform = { - type: 'formula', - expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`, - as: impute - }; - return [imputeTransform, deriveNewField, replaceOriginal]; - } else { - return [imputeTransform]; - } - } -} diff --git a/node_modules/vega-lite/src/compile/data/index.ts b/node_modules/vega-lite/src/compile/data/index.ts deleted file mode 100644 index 29fefae..0000000 --- a/node_modules/vega-lite/src/compile/data/index.ts +++ /dev/null @@ -1,72 +0,0 @@ -import {Parse} from '../../data'; -import {Dict} from '../../util'; -import {Split} from '../split'; -import {OutputNode} from './dataflow'; -import {FacetNode} from './facet'; -import {SourceNode} from './source'; - -export interface DataComponent { - /** - * A list of unique sources. - */ - sources: SourceNode[]; - - /** - * Registry of output nodes. - */ - outputNodes: Dict; - - /** - * How often is an output node used. If it is not used, we don't need to - * instantiate it in the assemble step. - */ - outputNodeRefCounts: Dict; - - /** - * The output node before aggregation. - */ - raw?: OutputNode; - - /** - * The main output node. - */ - main?: OutputNode; - - /** - * For facets, we store the reference to the root node. - */ - facetRoot?: FacetNode; - - /** - * True if the data for this model is faceted. - * A dataset is faceted if a parent model is a facet and no new dataset is - * defined (which would make the data unfaceted again). - */ - isFaceted: boolean; - - /** - * Parse properties passed down from ancestors. Helps us to keep track of what has been parsed or is derived. - */ - ancestorParse?: AncestorParse; -} - -/** - * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf) - * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the - * same field again (or differently). - */ -export class AncestorParse extends Split { - constructor( - public readonly explicit: Partial = {}, - public readonly implicit: Partial = {}, - public parseNothing = false - ) { - super(explicit, implicit); - } - - public clone(): AncestorParse { - const clone = super.clone() as AncestorParse; - clone.parseNothing = this.parseNothing; - return clone; - } -} diff --git a/node_modules/vega-lite/src/compile/data/joinaggregate.ts b/node_modules/vega-lite/src/compile/data/joinaggregate.ts deleted file mode 100644 index 6113860..0000000 --- a/node_modules/vega-lite/src/compile/data/joinaggregate.ts +++ /dev/null @@ -1,72 +0,0 @@ -import {AggregateOp} from 'vega'; -import {vgField} from '../../channeldef'; -import {JoinAggregateTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {VgJoinAggregateTransform} from '../../vega.schema'; -import {JoinAggregateFieldDef} from '../../transform'; -import {unique} from '../../util'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for the join aggregate transform nodes. - */ -export class JoinAggregateTransformNode extends DataFlowNode { - public clone() { - return new JoinAggregateTransformNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private readonly transform: JoinAggregateTransform) { - super(parent); - } - - public addDimensions(fields: string[]) { - this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); - } - - public dependentFields() { - const out = new Set(); - - if (this.transform.groupby) { - this.transform.groupby.forEach(out.add, out); - } - this.transform.joinaggregate - .map(w => w.field) - .filter(f => f !== undefined) - .forEach(out.add, out); - - return out; - } - - public producedFields() { - return new Set(this.transform.joinaggregate.map(this.getDefaultName)); - } - - private getDefaultName(joinAggregateFieldDef: JoinAggregateFieldDef): string { - return joinAggregateFieldDef.as ?? vgField(joinAggregateFieldDef); - } - - public hash() { - return `JoinAggregateTransform ${hash(this.transform)}`; - } - - public assemble(): VgJoinAggregateTransform { - const fields: string[] = []; - const ops: AggregateOp[] = []; - const as: string[] = []; - for (const joinaggregate of this.transform.joinaggregate) { - ops.push(joinaggregate.op); - as.push(this.getDefaultName(joinaggregate)); - fields.push(joinaggregate.field === undefined ? null : joinaggregate.field); - } - - const groupby = this.transform.groupby; - - return { - type: 'joinaggregate', - as, - ops, - fields, - ...(groupby !== undefined ? {groupby} : {}) - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/joinaggregatefacet.ts b/node_modules/vega-lite/src/compile/data/joinaggregatefacet.ts deleted file mode 100644 index 6162d94..0000000 --- a/node_modules/vega-lite/src/compile/data/joinaggregatefacet.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {vgField} from '../../channeldef'; -import {DEFAULT_SORT_OP, isSortField} from '../../sort'; -import {FacetMapping} from '../../spec/facet'; -import {facetSortFieldName} from '../facet'; -import {DataFlowNode} from './dataflow'; -import {JoinAggregateTransformNode} from './joinaggregate'; - -export function makeJoinAggregateFromFacet( - parent: DataFlowNode, - facet: FacetMapping -): JoinAggregateTransformNode { - const {row, column} = facet; - if (row && column) { - let newParent = null; - // only need to make one for crossed facet - for (const fieldDef of [row, column]) { - if (isSortField(fieldDef.sort)) { - const {field, op = DEFAULT_SORT_OP} = fieldDef.sort; - parent = newParent = new JoinAggregateTransformNode(parent, { - joinaggregate: [ - { - op, - field, - as: facetSortFieldName(fieldDef, fieldDef.sort, {forAs: true}) - } - ], - groupby: [vgField(fieldDef)] - }); - } - } - return newParent; - } - return null; -} diff --git a/node_modules/vega-lite/src/compile/data/loess.ts b/node_modules/vega-lite/src/compile/data/loess.ts deleted file mode 100644 index 1d8d457..0000000 --- a/node_modules/vega-lite/src/compile/data/loess.ts +++ /dev/null @@ -1,43 +0,0 @@ -import {LoessTransform as VgLoessTransform} from 'vega'; -import {LoessTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for loess transform nodes - */ -export class LoessTransformNode extends DataFlowNode { - public clone() { - return new LoessTransformNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private transform: LoessTransform) { - super(parent); - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = this.transform.as ?? [undefined, undefined]; - this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.loess]; - } - - public dependentFields() { - return new Set([this.transform.loess, this.transform.on, ...(this.transform.groupby ?? [])]); - } - - public producedFields() { - return new Set(this.transform.as); - } - - public hash() { - return `LoessTransform ${hash(this.transform)}`; - } - - public assemble(): VgLoessTransform { - const {loess, on, ...rest} = this.transform; - const result: VgLoessTransform = { - type: 'loess', - x: on, - y: loess, - ...rest - }; - return result; - } -} diff --git a/node_modules/vega-lite/src/compile/data/lookup.ts b/node_modules/vega-lite/src/compile/data/lookup.ts deleted file mode 100644 index 878fbbe..0000000 --- a/node_modules/vega-lite/src/compile/data/lookup.ts +++ /dev/null @@ -1,97 +0,0 @@ -import {LookupTransform as VgLookupTransform} from 'vega'; -import {array, isString} from 'vega-util'; -import * as log from '../../log'; -import {isLookupData, isLookupSelection, LookupTransform} from '../../transform'; -import {duplicate, hash, varName} from '../../util'; -import {Model} from '../model'; -import {DataFlowNode, OutputNode} from './dataflow'; -import {findSource} from './parse'; -import {SourceNode} from './source'; -import {DataSourceType} from '../../data'; - -export class LookupNode extends DataFlowNode { - public clone() { - return new LookupNode(null, duplicate(this.transform), this.secondary); - } - - constructor(parent: DataFlowNode, public readonly transform: LookupTransform, public readonly secondary: string) { - super(parent); - } - - public static make(parent: DataFlowNode, model: Model, transform: LookupTransform, counter: number) { - const sources = model.component.data.sources; - const {from} = transform; - let fromOutputNode = null; - - if (isLookupData(from)) { - let fromSource = findSource(from.data, sources); - - if (!fromSource) { - fromSource = new SourceNode(from.data); - sources.push(fromSource); - } - - const fromOutputName = model.getName(`lookup_${counter}`); - fromOutputNode = new OutputNode( - fromSource, - fromOutputName, - DataSourceType.Lookup, - model.component.data.outputNodeRefCounts - ); - model.component.data.outputNodes[fromOutputName] = fromOutputNode; - } else if (isLookupSelection(from)) { - const selName = from.selection; - transform = {as: selName, ...transform}; - fromOutputNode = model.getSelectionComponent(varName(selName), selName).materialized; - if (!fromOutputNode) { - throw new Error(log.message.noSameUnitLookup(selName)); - } - } - - return new LookupNode(parent, transform, fromOutputNode.getSource()); - } - - public dependentFields() { - return new Set([this.transform.lookup]); - } - - public producedFields() { - return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields); - } - - public hash() { - return `Lookup ${hash({transform: this.transform, secondary: this.secondary})}`; - } - - public assemble(): VgLookupTransform { - let foreign: Partial; - - if (this.transform.from.fields) { - // lookup a few fields and add create a flat output - foreign = { - values: this.transform.from.fields, - ...(this.transform.as ? {as: array(this.transform.as)} : {}) - }; - } else { - // lookup full record and nest it - let asName = this.transform.as; - if (!isString(asName)) { - log.warn(log.message.NO_FIELDS_NEEDS_AS); - asName = '_lookup'; - } - - foreign = { - as: [asName] - }; - } - - return { - type: 'lookup', - from: this.secondary, - key: this.transform.from.key, - fields: [this.transform.lookup], - ...foreign, - ...(this.transform.default ? {default: this.transform.default} : {}) - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/optimize.ts b/node_modules/vega-lite/src/compile/data/optimize.ts deleted file mode 100644 index 0cfa8c5..0000000 --- a/node_modules/vega-lite/src/compile/data/optimize.ts +++ /dev/null @@ -1,141 +0,0 @@ -import {DataComponent} from '.'; -import * as log from '../../log'; -import {Model} from '../model'; -import {DataFlowNode} from './dataflow'; -import {BottomUpOptimizer, TopDownOptimizer} from './optimizer'; -import * as optimizers from './optimizers'; - -export const FACET_SCALE_PREFIX = 'scale_'; -export const MAX_OPTIMIZATION_RUNS = 5; - -/** - * Iterates over a dataflow graph and checks whether all links are consistent. - */ -export function checkLinks(nodes: readonly DataFlowNode[]): boolean { - for (const node of nodes) { - for (const child of node.children) { - if (child.parent !== node) { - // log.error('Dataflow graph is inconsistent.', node, child); - return false; - } - } - - if (!checkLinks(node.children)) { - return false; - } - } - - return true; -} - -/** - * Return all leaf nodes. - */ -function getLeaves(roots: DataFlowNode[]) { - const leaves: DataFlowNode[] = []; - function append(node: DataFlowNode) { - if (node.numChildren() === 0) { - leaves.push(node); - } else { - for (const child of node.children) { - append(child); - } - } - } - - for (const child of roots) { - append(child); - } - return leaves; -} - -export function isTrue(x: boolean) { - return x; -} - -/** - * Run the specified optimizer on the provided nodes. - * - * @param optimizer The optimizer instance to run. - * @param nodes A set of nodes to optimize. - * @param flag Flag that will be or'ed with return valued from optimization calls to the nodes. - */ -function runOptimizer(optimizer: BottomUpOptimizer | TopDownOptimizer, nodes: DataFlowNode[]): boolean { - const flags = nodes.map(node => { - if (optimizer instanceof BottomUpOptimizer) { - const runFlags = optimizer.optimizeNextFromLeaves(node); - optimizer.reset(); - return runFlags; - } else { - return optimizer.run(node); - } - }); - return flags.some(isTrue); -} - -function optimizationDataflowHelper(dataComponent: DataComponent, model: Model, firstPass: boolean) { - let roots = dataComponent.sources; - const mutatedFlags: Set = new Set(); - - mutatedFlags.add(runOptimizer(new optimizers.RemoveUnnecessaryOutputNodes(), roots)); - mutatedFlags.add(runOptimizer(new optimizers.RemoveUnnecessaryIdentifierNodes(model), roots)); - - // remove source nodes that don't have any children because they also don't have output nodes - roots = roots.filter(r => r.numChildren() > 0); - - mutatedFlags.add(runOptimizer(new optimizers.RemoveUnusedSubtrees(), getLeaves(roots))); - - roots = roots.filter(r => r.numChildren() > 0); - - if (!firstPass) { - // Only run these optimizations after the optimizer has moved down the facet node. - // With this change, we can be more aggressive in the optimizations. - mutatedFlags.add(runOptimizer(new optimizers.MoveParseUp(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeBins(model), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.RemoveDuplicateTimeUnits(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeParse(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeAggregates(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeTimeUnits(), getLeaves(roots))); - mutatedFlags.add(runOptimizer(new optimizers.MergeIdenticalNodes(), roots)); - mutatedFlags.add(runOptimizer(new optimizers.MergeOutputs(), getLeaves(roots))); - } - - dataComponent.sources = roots; - - return mutatedFlags.has(true); -} - -/** - * Optimizes the dataflow of the passed in data component. - */ -export function optimizeDataflow(data: DataComponent, model: Model) { - // check before optimizations - checkLinks(data.sources); - - let firstPassCounter = 0; - let secondPassCounter = 0; - - for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { - if (!optimizationDataflowHelper(data, model, true)) { - break; - } - firstPassCounter++; - } - - // move facets down and make a copy of the subtree so that we can have scales at the top level - data.sources.map(optimizers.moveFacetDown); - - for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { - if (!optimizationDataflowHelper(data, model, false)) { - break; - } - secondPassCounter++; - } - - // check after optimizations - checkLinks(data.sources); - - if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) { - log.warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`); - } -} diff --git a/node_modules/vega-lite/src/compile/data/optimizer.ts b/node_modules/vega-lite/src/compile/data/optimizer.ts deleted file mode 100644 index eb28cfe..0000000 --- a/node_modules/vega-lite/src/compile/data/optimizer.ts +++ /dev/null @@ -1,93 +0,0 @@ -import {DataFlowNode} from './dataflow'; -import {OptimizerFlags} from './optimizers'; -import {SourceNode} from './source'; -import {GraticuleNode} from './graticule'; -import {SequenceNode} from './sequence'; - -/** - * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator. - */ -export function isDataSourceNode(node: DataFlowNode) { - return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode; -} - -/** - * Abstract base class for BottomUpOptimizer and TopDownOptimizer. - * Contains only mutation handling logic. Subclasses need to implement iteration logic. - */ -abstract class OptimizerBase { - private _mutated: boolean; - constructor() { - this._mutated = false; - } - // Once true, _mutated is never set to false - public setMutated() { - this._mutated = true; - } - - get mutatedFlag() { - return this._mutated; - } -} - -/** - * Starts from a node and runs the optimization function(the "run" method) upwards to the root, - * depending on the continueFlag and mutatedFlag values returned by the optimization function. - */ -export abstract class BottomUpOptimizer extends OptimizerBase { - private _continue: boolean; - - constructor() { - super(); - this._continue = false; - } - - public setContinue() { - this._continue = true; - } - - get continueFlag() { - return this._continue; - } - - get flags(): OptimizerFlags { - return {continueFlag: this.continueFlag, mutatedFlag: this.mutatedFlag}; - } - - set flags({continueFlag, mutatedFlag}: OptimizerFlags) { - if (continueFlag) { - this.setContinue(); - } - if (mutatedFlag) { - this.setMutated(); - } - } - - public abstract run(node: DataFlowNode): OptimizerFlags; - - /** - * Reset the state of the optimizer after it has completed a run from the bottom of the tree to the top. - */ - public reset(): void { - // do nothing - } - - public optimizeNextFromLeaves(node: DataFlowNode): boolean { - if (isDataSourceNode(node)) { - return false; - } - const next = node.parent; - const {continueFlag} = this.run(node); - if (continueFlag) { - this.optimizeNextFromLeaves(next); - } - return this.mutatedFlag; - } -} - -/** - * The optimizer function( the "run" method), is invoked on the given node and then continues recursively. - */ -export abstract class TopDownOptimizer extends OptimizerBase { - public abstract run(node: DataFlowNode): boolean; -} diff --git a/node_modules/vega-lite/src/compile/data/optimizers.ts b/node_modules/vega-lite/src/compile/data/optimizers.ts deleted file mode 100644 index dc9e397..0000000 --- a/node_modules/vega-lite/src/compile/data/optimizers.ts +++ /dev/null @@ -1,530 +0,0 @@ -import {DataSourceType, Parse} from '../../data'; -import {Dict, fieldIntersection, hash, hasIntersection, isEmpty, keys, some} from '../../util'; -import {Model} from '../model'; -import {requiresSelectionId} from '../selection'; -import {AggregateNode} from './aggregate'; -import {BinNode} from './bin'; -import {DataFlowNode, OutputNode} from './dataflow'; -import {FacetNode} from './facet'; -import {FilterNode} from './filter'; -import {ParseNode} from './formatparse'; -import {IdentifierNode} from './identifier'; -import {JoinAggregateTransformNode} from './joinaggregate'; -import {FACET_SCALE_PREFIX} from './optimize'; -import {BottomUpOptimizer, isDataSourceNode, TopDownOptimizer} from './optimizer'; -import * as optimizers from './optimizers'; -import {StackNode} from './stack'; -import {TimeUnitNode} from './timeunit'; -import {WindowTransformNode} from './window'; - -export interface OptimizerFlags { - /** - * If true, iteration continues. - */ - continueFlag: boolean; - /** - * If true, the tree has been mutated by the function. - */ - mutatedFlag: boolean; -} - -/** - * Move parse nodes up to forks. - */ -export class MoveParseUp extends BottomUpOptimizer { - public run(node: DataFlowNode): OptimizerFlags { - const parent = node.parent; - // Move parse up by merging or swapping. - if (node instanceof ParseNode) { - if (isDataSourceNode(parent)) { - return this.flags; - } - - if (parent.numChildren() > 1) { - // Don't move parse further up but continue with parent. - this.setContinue(); - return this.flags; - } - - if (parent instanceof ParseNode) { - this.setMutated(); - parent.merge(node); - } else { - // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup). - if (fieldIntersection(parent.producedFields(), node.dependentFields())) { - this.setContinue(); - return this.flags; - } - this.setMutated(); - node.swapWithParent(); - } - } - this.setContinue(); - return this.flags; - } -} - -/** - * Merge identical nodes at forks by comparing hashes. - * - * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler. - */ -export class MergeIdenticalNodes extends TopDownOptimizer { - public mergeNodes(parent: DataFlowNode, nodes: DataFlowNode[]) { - const mergedNode = nodes.shift(); - for (const node of nodes) { - parent.removeChild(node); - node.parent = mergedNode; - node.remove(); - } - } - - public run(node: DataFlowNode): boolean { - const hashes = node.children.map(x => x.hash()); - const buckets: {hash?: DataFlowNode[]} = {}; - - for (let i = 0; i < hashes.length; i++) { - if (buckets[hashes[i]] === undefined) { - buckets[hashes[i]] = [node.children[i]]; - } else { - buckets[hashes[i]].push(node.children[i]); - } - } - - for (const k of keys(buckets)) { - if (buckets[k].length > 1) { - this.setMutated(); - this.mergeNodes(node, buckets[k]); - } - } - for (const child of node.children) { - this.run(child); - } - return this.mutatedFlag; - } -} - -/** - * Repeatedly remove leaf nodes that are not output or facet nodes. - * The reason is that we don't need subtrees that don't have any output nodes. - * Facet nodes are needed for the row or column domains. - */ -export class RemoveUnusedSubtrees extends BottomUpOptimizer { - public run(node: DataFlowNode): OptimizerFlags { - if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) { - // no need to continue with parent because it is output node or will have children (there was a fork) - return this.flags; - } else { - this.setMutated(); - node.remove(); - } - return this.flags; - } -} - -/** - * Removes duplicate time unit nodes (as determined by the name of the - * output field) that may be generated due to selections projected over - * time units. - * - * TODO: Try to make this a top down optimizer that keeps only the first - * insance of a time unit node. - * TODO: Try to make a generic version of this that only keeps one node per hash. - */ -export class RemoveDuplicateTimeUnits extends BottomUpOptimizer { - private fields = new Set(); - private prev: DataFlowNode = null; - public run(node: DataFlowNode): OptimizerFlags { - this.setContinue(); - if (node instanceof TimeUnitNode) { - const pfields = node.producedFields(); - if (hasIntersection(pfields, this.fields)) { - this.setMutated(); - this.prev.remove(); - } else { - this.fields = new Set([...this.fields, ...pfields]); - } - this.prev = node; - } - return this.flags; - } - - public reset(): void { - this.fields.clear(); - } -} - -/** - * Merge adjacent time unit nodes. - */ -export class MergeTimeUnits extends BottomUpOptimizer { - public run(node: DataFlowNode): OptimizerFlags { - this.setContinue(); - const parent = node.parent; - const timeUnitChildren = parent.children.filter(x => x instanceof TimeUnitNode) as TimeUnitNode[]; - const combination = timeUnitChildren.pop(); - for (const timeUnit of timeUnitChildren) { - this.setMutated(); - combination.merge(timeUnit); - } - return this.flags; - } -} - -/** - * Clones the subtree and ignores output nodes except for the leaves, which are renamed. - */ -function cloneSubtree(facet: FacetNode) { - function clone(node: DataFlowNode): DataFlowNode[] { - if (!(node instanceof FacetNode)) { - const copy = node.clone(); - - if (copy instanceof OutputNode) { - const newName = FACET_SCALE_PREFIX + copy.getSource(); - copy.setSource(newName); - - facet.model.component.data.outputNodes[newName] = copy; - } else if ( - copy instanceof AggregateNode || - copy instanceof StackNode || - copy instanceof WindowTransformNode || - copy instanceof JoinAggregateTransformNode - ) { - copy.addDimensions(facet.fields); - } - for (const n of node.children.flatMap(clone)) { - n.parent = copy; - } - - return [copy]; - } - - return node.children.flatMap(clone); - } - return clone; -} - -/** - * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node. - * After moving down the facet node, make a copy of the subtree and make it a child of the main output. - */ -export function moveFacetDown(node: DataFlowNode) { - if (node instanceof FacetNode) { - if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) { - // move down until we hit a fork or output node - const child = node.children[0]; - - if ( - child instanceof AggregateNode || - child instanceof StackNode || - child instanceof WindowTransformNode || - child instanceof JoinAggregateTransformNode - ) { - child.addDimensions(node.fields); - } - - child.swapWithParent(); - moveFacetDown(node); - } else { - // move main to facet - - const facetMain = node.model.component.data.main; - moveMainDownToFacet(facetMain); - - // replicate the subtree and place it before the facet's main node - const cloner = cloneSubtree(node); - const copy: DataFlowNode[] = node.children.map(cloner).flat(); - for (const c of copy) { - c.parent = facetMain; - } - } - } else { - node.children.map(moveFacetDown); - } -} - -function moveMainDownToFacet(node: DataFlowNode) { - if (node instanceof OutputNode && node.type === DataSourceType.Main) { - if (node.numChildren() === 1) { - const child = node.children[0]; - if (!(child instanceof FacetNode)) { - child.swapWithParent(); - moveMainDownToFacet(node); - } - } - } -} - -/** - * Remove output nodes that are not required. Starting from a root. - */ -export class RemoveUnnecessaryOutputNodes extends TopDownOptimizer { - constructor() { - super(); - } - - public run(node: DataFlowNode): boolean { - if (node instanceof OutputNode && !node.isRequired()) { - this.setMutated(); - node.remove(); - } - - for (const child of node.children) { - this.run(child); - } - - return this.mutatedFlag; - } -} - -export class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer { - private requiresSelectionId: boolean; - constructor(model: Model) { - super(); - this.requiresSelectionId = model && requiresSelectionId(model); - } - - public run(node: DataFlowNode): boolean { - if (node instanceof IdentifierNode) { - // Only preserve IdentifierNodes if we have default discrete selections - // in our model tree, and if the nodes come after tuple producing nodes. - if ( - !( - this.requiresSelectionId && - (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode) - ) - ) { - this.setMutated(); - node.remove(); - } - } - - for (const child of node.children) { - this.run(child); - } - - return this.mutatedFlag; - } -} - -/** - * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes. - * - * We assume that dependent paths that do not have a parse node can be just merged. - */ -export class MergeParse extends BottomUpOptimizer { - public run(node: DataFlowNode): optimizers.OptimizerFlags { - const parent = node.parent; - const originalChildren = [...parent.children]; - const parseChildren = parent.children.filter((child): child is ParseNode => child instanceof ParseNode); - - if (parent.numChildren() > 1 && parseChildren.length >= 1) { - const commonParse: Parse = {}; - const conflictingParse = new Set(); - for (const parseNode of parseChildren) { - const parse = parseNode.parse; - for (const k of keys(parse)) { - if (!(k in commonParse)) { - commonParse[k] = parse[k]; - } else if (commonParse[k] !== parse[k]) { - conflictingParse.add(k); - } - } - } - - for (const field of conflictingParse) { - delete commonParse[field]; - } - - if (!isEmpty(commonParse)) { - this.setMutated(); - const mergedParseNode = new ParseNode(parent, commonParse); - for (const childNode of originalChildren) { - if (childNode instanceof ParseNode) { - for (const key of keys(commonParse)) { - delete childNode.parse[key]; - } - } - - parent.removeChild(childNode); - childNode.parent = mergedParseNode; - - // remove empty parse nodes - if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) { - childNode.remove(); - } - } - } - } - - this.setContinue(); - return this.flags; - } -} - -export class MergeAggregates extends BottomUpOptimizer { - public run(node: DataFlowNode): optimizers.OptimizerFlags { - const parent = node.parent; - const aggChildren = parent.children.filter((child): child is AggregateNode => child instanceof AggregateNode); - - // Object which we'll use to map the fields which an aggregate is grouped by to - // the set of aggregates with that grouping. This is useful as only aggregates - // with the same group by can be merged - const groupedAggregates: Dict = {}; - - // Build groupedAggregates - for (const agg of aggChildren) { - const groupBys = hash(agg.groupBy); - if (!(groupBys in groupedAggregates)) { - groupedAggregates[groupBys] = []; - } - groupedAggregates[groupBys].push(agg); - } - - // Merge aggregateNodes with same key in groupedAggregates - for (const group of keys(groupedAggregates)) { - const mergeableAggs = groupedAggregates[group]; - if (mergeableAggs.length > 1) { - const mergedAggs = mergeableAggs.pop(); - for (const agg of mergeableAggs) { - if (mergedAggs.merge(agg)) { - parent.removeChild(agg); - agg.parent = mergedAggs; - agg.remove(); - - this.setMutated(); - } - } - } - } - - this.setContinue(); - return this.flags; - } -} - -/** - * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node. - */ -export class MergeBins extends BottomUpOptimizer { - constructor(private model: Model) { - super(); - } - public run(node: DataFlowNode): OptimizerFlags { - const parent = node.parent; - const moveBinsUp = !( - isDataSourceNode(parent) || - parent instanceof FilterNode || - parent instanceof ParseNode || - parent instanceof IdentifierNode - ); - - const promotableBins: BinNode[] = []; - const remainingBins: BinNode[] = []; - - for (const child of parent.children) { - if (child instanceof BinNode) { - if (moveBinsUp && !fieldIntersection(parent.producedFields(), child.dependentFields())) { - promotableBins.push(child); - } else { - remainingBins.push(child); - } - } - } - - if (promotableBins.length > 0) { - const promotedBin = promotableBins.pop(); - for (const bin of promotableBins) { - promotedBin.merge(bin, this.model.renameSignal.bind(this.model)); - } - this.setMutated(); - if (parent instanceof BinNode) { - parent.merge(promotedBin, this.model.renameSignal.bind(this.model)); - } else { - promotedBin.swapWithParent(); - } - } - if (remainingBins.length > 1) { - const remainingBin = remainingBins.pop(); - for (const bin of remainingBins) { - remainingBin.merge(bin, this.model.renameSignal.bind(this.model)); - } - this.setMutated(); - } - this.setContinue(); - return this.flags; - } -} - -/** - * This optimizer takes output nodes that are at a fork and moves them before the fork. - * - * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes. - * It then moves all output nodes before that main output node. All other children (and the children of the output nodes) - * are inserted after the main output node. - */ -export class MergeOutputs extends BottomUpOptimizer { - public run(node: DataFlowNode) { - const parent = node.parent; - const children = [...parent.children]; - const hasOutputChild = some(children, child => child instanceof OutputNode); - - if (!hasOutputChild || parent.numChildren() <= 1) { - this.setContinue(); - return this.flags; - } - - const otherChildren: DataFlowNode[] = []; - - // The output node we will connect all other nodes to. - // Output nodes will be added before the new node, other nodes after. - let mainOutput: OutputNode; - - for (const child of children) { - if (child instanceof OutputNode) { - let lastOutput = child; - - while (lastOutput.numChildren() === 1) { - const [theChild] = lastOutput.children; - if (theChild instanceof OutputNode) { - lastOutput = theChild; - } else { - break; - } - } - - otherChildren.push(...lastOutput.children); - - if (mainOutput) { - // Move the output nodes before the mainOutput. We do this by setting - // the parent of the first not to the parent of the main output and - // the main output's parent to the last output. - - // note: the child is the first output - parent.removeChild(child); - child.parent = mainOutput.parent; - - mainOutput.parent.removeChild(mainOutput); - mainOutput.parent = lastOutput; - - this.setMutated(); - } else { - mainOutput = lastOutput; - } - } else { - otherChildren.push(child); - } - } - - if (otherChildren.length) { - this.setMutated(); - for (const child of otherChildren) { - child.parent.removeChild(child); - child.parent = mainOutput; - } - } - - this.setContinue(); - return this.flags; - } -} diff --git a/node_modules/vega-lite/src/compile/data/parse.ts b/node_modules/vega-lite/src/compile/data/parse.ts deleted file mode 100644 index 2d9f489..0000000 --- a/node_modules/vega-lite/src/compile/data/parse.ts +++ /dev/null @@ -1,415 +0,0 @@ -import {AncestorParse, DataComponent} from '.'; -import { - Data, - isGenerator, - isGraticuleGenerator, - isInlineData, - isNamedData, - isSequenceGenerator, - isUrlData, - DataSourceType, - ParseValue -} from '../../data'; -import * as log from '../../log'; -import { - isAggregate, - isBin, - isCalculate, - isDensity, - isFilter, - isFlatten, - isFold, - isImpute, - isJoinAggregate, - isLoess, - isLookup, - isPivot, - isQuantile, - isRegression, - isSample, - isStack, - isTimeUnit, - isWindow -} from '../../transform'; -import {deepEqual, mergeDeep} from '../../util'; -import {isFacetModel, isLayerModel, isUnitModel, Model} from '../model'; -import {requiresSelectionId} from '../selection'; -import {materializeSelections} from '../selection/parse'; -import {AggregateNode} from './aggregate'; -import {BinNode} from './bin'; -import {CalculateNode} from './calculate'; -import {DataFlowNode, OutputNode} from './dataflow'; -import {DensityTransformNode} from './density'; -import {FacetNode} from './facet'; -import {FilterNode} from './filter'; -import {FilterInvalidNode} from './filterinvalid'; -import {FlattenTransformNode} from './flatten'; -import {FoldTransformNode} from './fold'; -import { - getImplicitFromEncoding, - getImplicitFromFilterTransform, - getImplicitFromSelection, - ParseNode -} from './formatparse'; -import {GeoJSONNode} from './geojson'; -import {GeoPointNode} from './geopoint'; -import {GraticuleNode} from './graticule'; -import {IdentifierNode} from './identifier'; -import {ImputeNode} from './impute'; -import {JoinAggregateTransformNode} from './joinaggregate'; -import {makeJoinAggregateFromFacet} from './joinaggregatefacet'; -import {LoessTransformNode} from './loess'; -import {LookupNode} from './lookup'; -import {PivotTransformNode} from './pivot'; -import {QuantileTransformNode} from './quantile'; -import {RegressionTransformNode} from './regression'; -import {SampleTransformNode} from './sample'; -import {SequenceNode} from './sequence'; -import {SourceNode} from './source'; -import {StackNode} from './stack'; -import {TimeUnitNode} from './timeunit'; -import {WindowTransformNode} from './window'; - -export function findSource(data: Data, sources: SourceNode[]) { - for (const other of sources) { - const otherData = other.data; - - // if both datasets have a name defined, we cannot merge - if (data.name && other.hasName() && data.name !== other.dataName) { - continue; - } - - // feature and mesh are mutually exclusive - if (data['format']?.mesh && otherData.format?.feature) { - continue; - } - - // we have to extract the same feature or mesh - if ( - (data['format']?.feature || otherData.format?.feature) && - data['format']?.feature !== otherData.format?.feature - ) { - continue; - } - if ((data['format']?.mesh || otherData.format?.mesh) && data['format']?.mesh !== otherData.format?.mesh) { - continue; - } - - if (isInlineData(data) && isInlineData(otherData)) { - if (deepEqual(data.values, otherData.values)) { - return other; - } - } else if (isUrlData(data) && isUrlData(otherData)) { - if (data.url === otherData.url) { - return other; - } - } else if (isNamedData(data)) { - if (data.name === other.dataName) { - return other; - } - } - } - return null; -} - -function parseRoot(model: Model, sources: SourceNode[]): DataFlowNode { - if (model.data || !model.parent) { - // if the model defines a data source or is the root, create a source node - - if (model.data === null) { - // data: null means we should ignore the parent's data so we just create a new data source - const source = new SourceNode({values: []}); - sources.push(source); - return source; - } - - const existingSource = findSource(model.data, sources); - - if (existingSource) { - if (!isGenerator(model.data)) { - existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format); - } - - // if the new source has a name but the existing one does not, we can set it - if (!existingSource.hasName() && model.data.name) { - existingSource.dataName = model.data.name; - } - - return existingSource; - } else { - const source = new SourceNode(model.data); - sources.push(source); - return source; - } - } else { - // If we don't have a source defined (overriding parent's data), use the parent's facet root or main. - return model.parent.component.data.facetRoot - ? model.parent.component.data.facetRoot - : model.parent.component.data.main; - } -} - -/** - * Parses a transform array into a chain of connected dataflow nodes. - */ -export function parseTransformArray(head: DataFlowNode, model: Model, ancestorParse: AncestorParse): DataFlowNode { - let lookupCounter = 0; - - for (const t of model.transforms) { - let derivedType: ParseValue = undefined; - let transformNode: DataFlowNode; - - if (isCalculate(t)) { - transformNode = head = new CalculateNode(head, t); - derivedType = 'derived'; - } else if (isFilter(t)) { - const implicit = getImplicitFromFilterTransform(t); - transformNode = head = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse) ?? head; - - head = new FilterNode(head, model, t.filter); - } else if (isBin(t)) { - transformNode = head = BinNode.makeFromTransform(head, t, model); - derivedType = 'number'; - } else if (isTimeUnit(t)) { - derivedType = 'date'; - const parsedAs = ancestorParse.getWithExplicit(t.field); - // Create parse node because the input to time unit is always date. - if (parsedAs.value === undefined) { - head = new ParseNode(head, {[t.field]: derivedType}); - ancestorParse.set(t.field, derivedType, false); - } - transformNode = head = TimeUnitNode.makeFromTransform(head, t); - } else if (isAggregate(t)) { - transformNode = head = AggregateNode.makeFromTransform(head, t); - derivedType = 'number'; - if (requiresSelectionId(model)) { - head = new IdentifierNode(head); - } - } else if (isLookup(t)) { - transformNode = head = LookupNode.make(head, model, t, lookupCounter++); - derivedType = 'derived'; - } else if (isWindow(t)) { - transformNode = head = new WindowTransformNode(head, t); - derivedType = 'number'; - } else if (isJoinAggregate(t)) { - transformNode = head = new JoinAggregateTransformNode(head, t); - derivedType = 'number'; - } else if (isStack(t)) { - transformNode = head = StackNode.makeFromTransform(head, t); - derivedType = 'derived'; - } else if (isFold(t)) { - transformNode = head = new FoldTransformNode(head, t); - derivedType = 'derived'; - } else if (isFlatten(t)) { - transformNode = head = new FlattenTransformNode(head, t); - derivedType = 'derived'; - } else if (isPivot(t)) { - transformNode = head = new PivotTransformNode(head, t); - derivedType = 'derived'; - } else if (isSample(t)) { - head = new SampleTransformNode(head, t); - } else if (isImpute(t)) { - transformNode = head = ImputeNode.makeFromTransform(head, t); - derivedType = 'derived'; - } else if (isDensity(t)) { - transformNode = head = new DensityTransformNode(head, t); - derivedType = 'derived'; - } else if (isQuantile(t)) { - transformNode = head = new QuantileTransformNode(head, t); - derivedType = 'derived'; - } else if (isRegression(t)) { - transformNode = head = new RegressionTransformNode(head, t); - derivedType = 'derived'; - } else if (isLoess(t)) { - transformNode = head = new LoessTransformNode(head, t); - derivedType = 'derived'; - } else { - log.warn(log.message.invalidTransformIgnored(t)); - continue; - } - - if (transformNode && derivedType !== undefined) { - for (const field of transformNode.producedFields() ?? []) { - ancestorParse.set(field, derivedType, false); - } - } - } - - return head; -} - -/* -Description of the dataflow (http://asciiflow.com/): - +--------+ - | Source | - +---+----+ - | - v - FormatParse - (explicit) - | - v - Transforms -(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...) - | - v - FormatParse - (implicit) - | - v - Binning (in `encoding`) - | - v - Timeunit (in `encoding`) - | - v -Formula From Sort Array - | - v - +--+--+ - | Raw | - +-----+ - | - v - Aggregate (in `encoding`) - | - v - Stack (in `encoding`) - | - v - Invalid Filter - | - v - +----------+ - | Main | - +----------+ - | - v - +-------+ - | Facet |----> "column", "column-layout", and "row" - +-------+ - | - v - ...Child data... -*/ - -export function parseData(model: Model): DataComponent { - let head = parseRoot(model, model.component.data.sources); - - const {outputNodes, outputNodeRefCounts} = model.component.data; - const ancestorParse = model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse(); - const data = model.data; - - if (isGenerator(data)) { - // insert generator transform - if (isSequenceGenerator(data)) { - head = new SequenceNode(head, data.sequence); - } else if (isGraticuleGenerator(data)) { - head = new GraticuleNode(head, data.graticule); - } - // no parsing necessary for generator - ancestorParse.parseNothing = true; - } else if (data?.format?.parse === null) { - // format.parse: null means disable parsing - ancestorParse.parseNothing = true; - } - - head = ParseNode.makeExplicit(head, model, ancestorParse) ?? head; - - // Default discrete selections require an identifer transform to - // uniquely identify data points. Add this transform at the head of - // the pipeline such that the identifier field is available for all - // subsequent datasets. During optimization, we will remove this - // transform if it proves to be unnecessary. Additional identifier - // transforms will be necessary when new tuples are constructed - // (e.g., post-aggregation). - head = new IdentifierNode(head); - - // HACK: This is equivalent for merging bin extent for union scale. - // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale - const parentIsLayer = model.parent && isLayerModel(model.parent); - if (isUnitModel(model) || isFacetModel(model)) { - if (parentIsLayer) { - head = BinNode.makeFromEncoding(head, model) ?? head; - } - } - - if (model.transforms.length > 0) { - head = parseTransformArray(head, model, ancestorParse); - } - - // create parse nodes for fields that need to be parsed (or flattened) implicitly - const implicitSelection = getImplicitFromSelection(model); - const implicitEncoding = getImplicitFromEncoding(model); - head = ParseNode.makeWithAncestors(head, {}, {...implicitSelection, ...implicitEncoding}, ancestorParse) ?? head; - - if (isUnitModel(model)) { - head = GeoJSONNode.parseAll(head, model); - head = GeoPointNode.parseAll(head, model); - } - - if (isUnitModel(model) || isFacetModel(model)) { - if (!parentIsLayer) { - head = BinNode.makeFromEncoding(head, model) ?? head; - } - - head = TimeUnitNode.makeFromEncoding(head, model) ?? head; - head = CalculateNode.parseAllForSortIndex(head, model); - } - - // add an output node pre aggregation - const rawName = model.getDataName(DataSourceType.Raw); - const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts); - outputNodes[rawName] = raw; - head = raw; - - if (isUnitModel(model)) { - const agg = AggregateNode.makeFromEncoding(head, model); - if (agg) { - head = agg; - - if (requiresSelectionId(model)) { - head = new IdentifierNode(head); - } - } - head = ImputeNode.makeFromEncoding(head, model) ?? head; - head = StackNode.makeFromEncoding(head, model) ?? head; - } - - if (isUnitModel(model)) { - head = FilterInvalidNode.make(head, model) ?? head; - } - - // output node for marks - const mainName = model.getDataName(DataSourceType.Main); - const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts); - outputNodes[mainName] = main; - head = main; - - if (isUnitModel(model)) { - materializeSelections(model, main); - } - - // add facet marker - let facetRoot = null; - if (isFacetModel(model)) { - const facetName = model.getName('facet'); - - // Derive new aggregate for facet's sort field - // augment data source with new fields for crossed facet - head = makeJoinAggregateFromFacet(head, model.facet) ?? head; - - facetRoot = new FacetNode(head, model, facetName, main.getSource()); - outputNodes[facetName] = facetRoot; - } - - return { - ...model.component.data, - outputNodes, - outputNodeRefCounts, - raw, - main, - facetRoot, - ancestorParse - }; -} diff --git a/node_modules/vega-lite/src/compile/data/pivot.ts b/node_modules/vega-lite/src/compile/data/pivot.ts deleted file mode 100644 index ca96dc1..0000000 --- a/node_modules/vega-lite/src/compile/data/pivot.ts +++ /dev/null @@ -1,45 +0,0 @@ -import {PivotTransform} from '../../transform'; -import {duplicate, hash, unique} from '../../util'; -import {PivotTransform as VgPivotTransform} from 'vega'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for pivot transform nodes. - */ -export class PivotTransformNode extends DataFlowNode { - public clone() { - return new PivotTransformNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private transform: PivotTransform) { - super(parent); - } - - public addDimensions(fields: readonly string[]) { - this.transform.groupby = unique((this.transform.groupby ?? []).concat(fields), d => d); - } - - public producedFields(): undefined { - return undefined; // return undefined so that potentially everything can depend on the pivot - } - - public dependentFields() { - return new Set([this.transform.pivot, this.transform.value, ...(this.transform.groupby ?? [])]); - } - - public hash() { - return `PivotTransform ${hash(this.transform)}`; - } - - public assemble(): VgPivotTransform { - const {pivot, value, groupby, limit, op} = this.transform; - return { - type: 'pivot', - field: pivot, - value, - ...(limit !== undefined ? {limit} : {}), - ...(op !== undefined ? {op} : {}), - ...(groupby !== undefined ? {groupby} : {}) - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/quantile.ts b/node_modules/vega-lite/src/compile/data/quantile.ts deleted file mode 100644 index bac3d28..0000000 --- a/node_modules/vega-lite/src/compile/data/quantile.ts +++ /dev/null @@ -1,42 +0,0 @@ -import {QuantileTransform as VgQuantileTransform} from 'vega'; -import {QuantileTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for quantile transform nodes - */ -export class QuantileTransformNode extends DataFlowNode { - public clone() { - return new QuantileTransformNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private transform: QuantileTransform) { - super(parent); - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = this.transform.as ?? [undefined, undefined]; - this.transform.as = [specifiedAs[0] ?? 'prob', specifiedAs[1] ?? 'value']; - } - - public dependentFields() { - return new Set([this.transform.quantile, ...(this.transform.groupby ?? [])]); - } - - public producedFields() { - return new Set(this.transform.as); - } - - public hash() { - return `QuantileTransform ${hash(this.transform)}`; - } - - public assemble(): VgQuantileTransform { - const {quantile, ...rest} = this.transform; - const result: VgQuantileTransform = { - type: 'quantile', - field: quantile, - ...rest - }; - return result; - } -} diff --git a/node_modules/vega-lite/src/compile/data/regression.ts b/node_modules/vega-lite/src/compile/data/regression.ts deleted file mode 100644 index 41e85f4..0000000 --- a/node_modules/vega-lite/src/compile/data/regression.ts +++ /dev/null @@ -1,43 +0,0 @@ -import {RegressionTransform as VgRegressionTransform} from 'vega'; -import {RegressionTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for regression transform nodes - */ -export class RegressionTransformNode extends DataFlowNode { - public clone() { - return new RegressionTransformNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private transform: RegressionTransform) { - super(parent); - this.transform = duplicate(transform); // duplicate to prevent side effects - const specifiedAs = this.transform.as ?? [undefined, undefined]; - this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.regression]; - } - - public dependentFields() { - return new Set([this.transform.regression, this.transform.on, ...(this.transform.groupby ?? [])]); - } - - public producedFields() { - return new Set(this.transform.as); - } - - public hash() { - return `RegressionTransform ${hash(this.transform)}`; - } - - public assemble(): VgRegressionTransform { - const {regression, on, ...rest} = this.transform; - const result: VgRegressionTransform = { - type: 'regression', - x: on, - y: regression, - ...rest - }; - return result; - } -} diff --git a/node_modules/vega-lite/src/compile/data/sample.ts b/node_modules/vega-lite/src/compile/data/sample.ts deleted file mode 100644 index 771544b..0000000 --- a/node_modules/vega-lite/src/compile/data/sample.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {SampleTransform as VgSampleTransform} from 'vega'; -import {SampleTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for the sample transform nodes - */ -export class SampleTransformNode extends DataFlowNode { - public clone() { - return new SampleTransformNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private transform: SampleTransform) { - super(parent); - } - - public dependentFields() { - return new Set(); - } - - public producedFields() { - return new Set(); - } - - public hash() { - return `SampleTransform ${hash(this.transform)}`; - } - - public assemble(): VgSampleTransform { - return { - type: 'sample', - size: this.transform.sample - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/sequence.ts b/node_modules/vega-lite/src/compile/data/sequence.ts deleted file mode 100644 index 9812e2d..0000000 --- a/node_modules/vega-lite/src/compile/data/sequence.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {SequenceParams} from '../../data'; -import {hash} from '../../util'; -import {SequenceTransform as VgSequenceTransform} from 'vega'; -import {DataFlowNode} from './dataflow'; - -export class SequenceNode extends DataFlowNode { - public clone() { - return new SequenceNode(null, this.params); - } - - constructor(parent: DataFlowNode, private params: SequenceParams) { - super(parent); - } - - public dependentFields() { - return new Set(); - } - - public producedFields() { - return new Set([this.params.as ?? 'data']); - } - - public hash() { - return `Hash ${hash(this.params)}`; - } - - public assemble(): VgSequenceTransform { - return { - type: 'sequence', - ...this.params - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/source.ts b/node_modules/vega-lite/src/compile/data/source.ts deleted file mode 100644 index 133a41d..0000000 --- a/node_modules/vega-lite/src/compile/data/source.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { - Data, - DataFormat, - DataFormatType, - isGenerator, - isInlineData, - isNamedData, - isSphereGenerator, - isUrlData -} from '../../data'; -import {contains, isEmpty, omit} from '../../util'; -import {VgData} from '../../vega.schema'; -import {DataFlowNode} from './dataflow'; - -export class SourceNode extends DataFlowNode { - private _data: Partial; - - private _name: string; - - private _generator: boolean; - - constructor(data: Data) { - super(null); // source cannot have parent - - data = data ?? {name: 'source'}; - let format; - - if (!isGenerator(data)) { - format = data.format ? {...omit(data.format, ['parse'])} : ({} as DataFormat); - } - - if (isInlineData(data)) { - this._data = {values: data.values}; - } else if (isUrlData(data)) { - this._data = {url: data.url}; - - if (!format.type) { - // Extract extension from URL using snippet from - // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript - let defaultExtension = /(?:\.([^.]+))?$/.exec(data.url)[1]; - if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) { - defaultExtension = 'json'; - } - - // defaultExtension has type string but we ensure that it is DataFormatType above - format.type = defaultExtension as DataFormatType; - } - } else if (isSphereGenerator(data)) { - // hardwire GeoJSON sphere data into output specification - this._data = {values: [{type: 'Sphere'}]}; - } else if (isNamedData(data) || isGenerator(data)) { - this._data = {}; - } - - // set flag to check if generator - this._generator = isGenerator(data); - - // any dataset can be named - if (data.name) { - this._name = data.name; - } - - if (format && !isEmpty(format)) { - this._data.format = format; - } - } - - public dependentFields() { - return new Set(); - } - - public producedFields(): undefined { - return undefined; // we don't know what this source produces - } - - get data() { - return this._data; - } - - public hasName(): boolean { - return !!this._name; - } - - get isGenerator() { - return this._generator; - } - get dataName() { - return this._name; - } - - set dataName(name: string) { - this._name = name; - } - - set parent(parent: DataFlowNode) { - throw new Error('Source nodes have to be roots.'); - } - - public remove() { - throw new Error('Source nodes are roots and cannot be removed.'); - } - - public hash(): string | number { - throw new Error('Cannot hash sources'); - } - - public assemble(): VgData { - return { - name: this._name, - ...this._data, - transform: [] - }; - } -} diff --git a/node_modules/vega-lite/src/compile/data/stack.ts b/node_modules/vega-lite/src/compile/data/stack.ts deleted file mode 100644 index 8ce08b9..0000000 --- a/node_modules/vega-lite/src/compile/data/stack.ts +++ /dev/null @@ -1,260 +0,0 @@ -import {Transforms as VgTransform} from 'vega'; -import {isArray, isString} from 'vega-util'; -import {FieldName, getFieldDef, isFieldDef, PositionFieldDef, vgField} from '../../channeldef'; -import {SortFields, SortOrder} from '../../sort'; -import {StackOffset} from '../../stack'; -import {StackTransform} from '../../transform'; -import {duplicate, getFirstDefined, hash} from '../../util'; -import {sortParams} from '../common'; -import {UnitModel} from '../unit'; -import {DataFlowNode} from './dataflow'; - -function getStackByFields(model: UnitModel): string[] { - return model.stack.stackBy.reduce((fields, by) => { - const fieldDef = by.fieldDef; - - const _field = vgField(fieldDef); - if (_field) { - fields.push(_field); - } - return fields; - }, [] as string[]); -} - -export interface StackComponent { - /** - * Faceted field. - */ - facetby: string[]; - - dimensionFieldDef?: PositionFieldDef; - - /** - * Stack measure's field. Used in makeFromEncoding. - */ - stackField: string; - - /** - * Level of detail fields for each level in the stacked charts such as color or detail. - * Used in makeFromEncoding. - */ - stackby?: string[]; - - /** - * Field that determines order of levels in the stacked charts. - * Used in both but optional in transform. - */ - sort: SortFields; - - /** Mode for stacking marks. - */ - offset: StackOffset; - - /** - * Whether to impute the data before stacking. Used only in makeFromEncoding. - */ - impute?: boolean; - - /** - * The data fields to group by. - */ - groupby?: FieldName[]; - /** - * Output field names of each stack field. - */ - as: [FieldName, FieldName]; -} - -function isValidAsArray(as: string[] | string): as is string[] { - return isArray(as) && as.every(s => isString(s)) && as.length > 1; -} - -export class StackNode extends DataFlowNode { - private _stack: StackComponent; - - public clone() { - return new StackNode(null, duplicate(this._stack)); - } - - constructor(parent: DataFlowNode, stack: StackComponent) { - super(parent); - - this._stack = stack; - } - - public static makeFromTransform(parent: DataFlowNode, stackTransform: StackTransform) { - const {stack, groupby, as, offset = 'zero'} = stackTransform; - - const sortFields: string[] = []; - const sortOrder: SortOrder[] = []; - if (stackTransform.sort !== undefined) { - for (const sortField of stackTransform.sort) { - sortFields.push(sortField.field); - sortOrder.push(getFirstDefined(sortField.order, 'ascending')); - } - } - const sort: SortFields = { - field: sortFields, - order: sortOrder - }; - let normalizedAs: [string, string]; - if (isValidAsArray(as)) { - normalizedAs = as; - } else if (isString(as)) { - normalizedAs = [as, as + '_end']; - } else { - normalizedAs = [stackTransform.stack + '_start', stackTransform.stack + '_end']; - } - - return new StackNode(parent, { - stackField: stack, - groupby, - offset, - sort, - facetby: [], - as: normalizedAs - }); - } - - public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) { - const stackProperties = model.stack; - const {encoding} = model; - - if (!stackProperties) { - return null; - } - - const {groupbyChannel, fieldChannel, offset, impute} = stackProperties; - - let dimensionFieldDef: PositionFieldDef; - if (groupbyChannel) { - const cDef = encoding[groupbyChannel]; - dimensionFieldDef = getFieldDef(cDef) as PositionFieldDef; // Fair to cast as groupByChannel is always either x or y - } - - const stackby = getStackByFields(model); - const orderDef = model.encoding.order; - - let sort: SortFields; - if (isArray(orderDef) || isFieldDef(orderDef)) { - sort = sortParams(orderDef); - } else { - // default = descending by stackFields - // FIXME is the default here correct for binned fields? - sort = stackby.reduce( - (s, field) => { - s.field.push(field); - s.order.push(fieldChannel === 'y' ? 'descending' : 'ascending'); - return s; - }, - {field: [], order: []} - ); - } - - return new StackNode(parent, { - dimensionFieldDef, - stackField: model.vgField(fieldChannel), - facetby: [], - stackby, - sort, - offset, - impute, - as: [ - model.vgField(fieldChannel, {suffix: 'start', forAs: true}), - model.vgField(fieldChannel, {suffix: 'end', forAs: true}) - ] - }); - } - - get stack(): StackComponent { - return this._stack; - } - - public addDimensions(fields: string[]) { - this._stack.facetby.push(...fields); - } - - public dependentFields() { - const out = new Set(); - - out.add(this._stack.stackField); - - this.getGroupbyFields().forEach(out.add, out); - this._stack.facetby.forEach(out.add, out); - this._stack.sort.field.forEach(out.add, out); - - return out; - } - - public producedFields() { - return new Set(this._stack.as); - } - - public hash() { - return `Stack ${hash(this._stack)}`; - } - - private getGroupbyFields() { - const {dimensionFieldDef, impute, groupby} = this._stack; - if (dimensionFieldDef) { - if (dimensionFieldDef.bin) { - if (impute) { - // For binned group by field with impute, we calculate bin_mid - // as we cannot impute two fields simultaneously - return [vgField(dimensionFieldDef, {binSuffix: 'mid'})]; - } - return [ - // For binned group by field without impute, we need both bin (start) and bin_end - vgField(dimensionFieldDef, {}), - vgField(dimensionFieldDef, {binSuffix: 'end'}) - ]; - } - return [vgField(dimensionFieldDef)]; - } - return groupby ?? []; - } - - public assemble(): VgTransform[] { - const transform: VgTransform[] = []; - const {facetby, dimensionFieldDef, stackField: field, stackby, sort, offset, impute, as} = this._stack; - - // Impute - if (impute && dimensionFieldDef) { - const {band = 0.5, bin} = dimensionFieldDef; - if (bin) { - // As we can only impute one field at a time, we need to calculate - // mid point for a binned field - transform.push({ - type: 'formula', - expr: - `${band}*` + - vgField(dimensionFieldDef, {expr: 'datum'}) + - `+${1 - band}*` + - vgField(dimensionFieldDef, {expr: 'datum', binSuffix: 'end'}), - as: vgField(dimensionFieldDef, {binSuffix: 'mid', forAs: true}) - }); - } - - transform.push({ - type: 'impute', - field, - groupby: [...stackby, ...facetby], - key: vgField(dimensionFieldDef, {binSuffix: 'mid'}), - method: 'value', - value: 0 - }); - } - - // Stack - transform.push({ - type: 'stack', - groupby: [...this.getGroupbyFields(), ...facetby], - field, - sort, - as, - offset - }); - - return transform; - } -} diff --git a/node_modules/vega-lite/src/compile/data/timeunit.ts b/node_modules/vega-lite/src/compile/data/timeunit.ts deleted file mode 100644 index 542cbd7..0000000 --- a/node_modules/vega-lite/src/compile/data/timeunit.ts +++ /dev/null @@ -1,127 +0,0 @@ -import {TimeUnitTransform as VgTimeUnitTransform} from 'vega'; -import {getSecondaryRangeChannel} from '../../channel'; -import {hasBand, vgField} from '../../channeldef'; -import {getTimeUnitParts, normalizeTimeUnit} from '../../timeunit'; -import {TimeUnitTransform} from '../../transform'; -import {Dict, duplicate, hash, isEmpty, replacePathInField, vals} from '../../util'; -import {isUnitModel, ModelWithField} from '../model'; -import {DataFlowNode} from './dataflow'; - -export type TimeUnitComponent = TimeUnitTransform & { - /** whether to output time unit as a band (generate two formula including start and end) */ - band?: boolean; -}; - -export class TimeUnitNode extends DataFlowNode { - public clone() { - return new TimeUnitNode(null, duplicate(this.formula)); - } - - constructor(parent: DataFlowNode, private formula: Dict) { - super(parent); - } - - public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) { - const formula = model.reduceFieldDef((timeUnitComponent: TimeUnitComponent, fieldDef, channel) => { - const {field, timeUnit} = fieldDef; - - const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; - - const band = - isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config); - - if (timeUnit) { - const as = vgField(fieldDef, {forAs: true}); - timeUnitComponent[ - hash({ - as, - field, - timeUnit - }) - ] = { - as, - field, - timeUnit, - ...(band ? {band: true} : {}) - }; - } - return timeUnitComponent; - }, {} as Dict); - - if (isEmpty(formula)) { - return null; - } - - return new TimeUnitNode(parent, formula); - } - - public static makeFromTransform(parent: DataFlowNode, t: TimeUnitTransform) { - const {timeUnit, ...other} = {...t}; - - const normalizedTimeUnit = normalizeTimeUnit(timeUnit); - - const component = { - ...other, - timeUnit: normalizedTimeUnit - }; - - return new TimeUnitNode(parent, { - [hash(component)]: component - }); - } - - /** - * Merge together TimeUnitNodes assigning the children of `other` to `this` - * and removing `other`. - */ - public merge(other: TimeUnitNode) { - this.formula = {...this.formula}; - - // if the same hash happen twice, merge "band" - for (const key in other.formula) { - if (!this.formula[key] || other.formula[key].band) { - // copy if it's not a duplicate or if we need to include copy band over - this.formula[key] = other.formula[key]; - } - } - - for (const child of other.children) { - other.removeChild(child); - child.parent = this; - } - - other.remove(); - } - - public producedFields() { - return new Set(vals(this.formula).map(f => f.as)); - } - - public dependentFields() { - return new Set(vals(this.formula).map(f => f.field)); - } - - public hash() { - return `TimeUnit ${hash(this.formula)}`; - } - - public assemble() { - const transforms: VgTimeUnitTransform[] = []; - - for (const f of vals(this.formula)) { - const {field, as, timeUnit} = f; - const {unit, utc, ...params} = normalizeTimeUnit(timeUnit); - - transforms.push({ - field: replacePathInField(field), - type: 'timeunit', - ...(unit ? {units: getTimeUnitParts(unit)} : {}), - ...(utc ? {timezone: 'utc'} : {}), - ...params, - as: [as, `${as}_end`] - }); - } - - return transforms; - } -} diff --git a/node_modules/vega-lite/src/compile/data/window.ts b/node_modules/vega-lite/src/compile/data/window.ts deleted file mode 100644 index 2923d03..0000000 --- a/node_modules/vega-lite/src/compile/data/window.ts +++ /dev/null @@ -1,106 +0,0 @@ -import {AggregateOp, WindowTransform as VgWindowTransform} from 'vega'; -import {isAggregateOp} from '../../aggregate'; -import {vgField} from '../../channeldef'; -import {SortOrder} from '../../sort'; -import {WindowFieldDef, WindowOnlyOp, WindowTransform} from '../../transform'; -import {duplicate, hash} from '../../util'; -import {VgComparator, VgJoinAggregateTransform} from '../../vega.schema'; -import {unique} from '../../util'; -import {DataFlowNode} from './dataflow'; - -/** - * A class for the window transform nodes - */ -export class WindowTransformNode extends DataFlowNode { - public clone() { - return new WindowTransformNode(null, duplicate(this.transform)); - } - - constructor(parent: DataFlowNode, private readonly transform: WindowTransform) { - super(parent); - } - - public addDimensions(fields: string[]) { - this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); - } - - public dependentFields() { - const out = new Set(); - - (this.transform.groupby ?? []).forEach(out.add, out); - (this.transform.sort ?? []).forEach(m => out.add(m.field)); - - this.transform.window - .map(w => w.field) - .filter(f => f !== undefined) - .forEach(out.add, out); - - return out; - } - - public producedFields() { - return new Set(this.transform.window.map(this.getDefaultName)); - } - - private getDefaultName(windowFieldDef: WindowFieldDef): string { - return windowFieldDef.as ?? vgField(windowFieldDef); - } - - public hash() { - return `WindowTransform ${hash(this.transform)}`; - } - - public assemble(): VgWindowTransform | VgJoinAggregateTransform { - const fields: string[] = []; - const ops: (AggregateOp | WindowOnlyOp)[] = []; - const as: string[] = []; - const params = []; - - for (const window of this.transform.window) { - ops.push(window.op); - as.push(this.getDefaultName(window)); - params.push(window.param === undefined ? null : window.param); - fields.push(window.field === undefined ? null : window.field); - } - - const frame = this.transform.frame; - const groupby = this.transform.groupby; - - if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) { - // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate - return { - type: 'joinaggregate', - as, - ops: ops as AggregateOp[], - fields, - ...(groupby !== undefined ? {groupby} : {}) - } as VgJoinAggregateTransform; - } - - const sortFields: string[] = []; - const sortOrder: SortOrder[] = []; - if (this.transform.sort !== undefined) { - for (const sortField of this.transform.sort) { - sortFields.push(sortField.field); - sortOrder.push(sortField.order ?? 'ascending'); - } - } - const sort: VgComparator = { - field: sortFields, - order: sortOrder - }; - const ignorePeers = this.transform.ignorePeers; - - return { - type: 'window', - params, - as, - ops, - fields, - sort, - ...(ignorePeers !== undefined ? {ignorePeers} : {}), - ...(groupby !== undefined ? {groupby} : {}), - ...(frame !== undefined ? {frame} : {}) - } as VgWindowTransform; - } -} diff --git a/node_modules/vega-lite/src/compile/facet.ts b/node_modules/vega-lite/src/compile/facet.ts deleted file mode 100644 index 255c7f6..0000000 --- a/node_modules/vega-lite/src/compile/facet.ts +++ /dev/null @@ -1,419 +0,0 @@ -import {AggregateOp, LayoutAlign, NewSignal} from 'vega'; -import {isArray} from 'vega-util'; -import {isBinning} from '../bin'; -import {COLUMN, ExtendedChannel, FacetChannel, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../channel'; -import {FieldName, FieldRefOption, initChannelDef, TypedFieldDef, vgField} from '../channeldef'; -import {Config} from '../config'; -import {reduce} from '../encoding'; -import * as log from '../log'; -import {hasDiscreteDomain} from '../scale'; -import {DEFAULT_SORT_OP, EncodingSortField, isSortField, SortOrder} from '../sort'; -import {NormalizedFacetSpec} from '../spec'; -import {EncodingFacetMapping, FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet'; -import {contains} from '../util'; -import {isVgRangeStep, VgData, VgLayout, VgMarkGroup} from '../vega.schema'; -import {buildModel} from './buildmodel'; -import {assembleFacetData} from './data/assemble'; -import {sortArrayIndexField} from './data/calculate'; -import {parseData} from './data/parse'; -import {assembleLabelTitle} from './header/assemble'; -import {getHeaderChannel, getHeaderProperty} from './header/common'; -import {HEADER_CHANNELS, HEADER_TYPES} from './header/component'; -import {parseFacetHeaders} from './header/parse'; -import {parseChildrenLayoutSize} from './layoutsize/parse'; -import {Model, ModelWithField} from './model'; -import {assembleDomain, getFieldFromDomain} from './scale/domain'; -import {assembleFacetSignals} from './selection/assemble'; - -export function facetSortFieldName( - fieldDef: FacetFieldDef, - sort: EncodingSortField, - opt?: FieldRefOption -) { - return vgField(sort, {suffix: `by_${vgField(fieldDef)}`, ...(opt ?? {})}); -} - -export class FacetModel extends ModelWithField { - public readonly facet: EncodingFacetMapping; - - public readonly child: Model; - - public readonly children: Model[]; - - constructor(spec: NormalizedFacetSpec, parent: Model, parentGivenName: string, config: Config) { - super(spec, 'facet', parent, parentGivenName, config, spec.resolve); - - this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config); - this.children = [this.child]; - - this.facet = this.initFacet(spec.facet, config); - } - - private initFacet( - facet: FacetFieldDef | FacetMapping, - config: Config - ): EncodingFacetMapping { - // clone to prevent side effect to the original spec - if (!isFacetMapping(facet)) { - return {facet: initChannelDef(facet, 'facet', config) as FacetFieldDef}; - } - - return reduce( - facet, - (normalizedFacet, fieldDef, channel) => { - if (!contains([ROW, COLUMN], channel)) { - // Drop unsupported channel - log.warn(log.message.incompatibleChannel(channel, 'facet')); - return normalizedFacet; - } - - if (fieldDef.field === undefined) { - log.warn(log.message.emptyFieldDef(fieldDef, channel)); - return normalizedFacet; - } - - // Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. - normalizedFacet[channel] = initChannelDef(fieldDef, channel, config); - return normalizedFacet; - }, - {} - ); - } - - public channelHasField(channel: ExtendedChannel): boolean { - return !!this.facet[channel]; - } - - public fieldDef(channel: ExtendedChannel): TypedFieldDef { - return this.facet[channel]; - } - - public parseData() { - this.component.data = parseData(this); - this.child.parseData(); - } - - public parseLayoutSize() { - parseChildrenLayoutSize(this); - } - - public parseSelections() { - // As a facet has a single child, the selection components are the same. - // The child maintains its selections to assemble signals, which remain - // within its unit. - this.child.parseSelections(); - this.component.selection = this.child.component.selection; - } - - public parseMarkGroup() { - this.child.parseMarkGroup(); - } - - public parseAxesAndHeaders() { - this.child.parseAxesAndHeaders(); - - parseFacetHeaders(this); - } - - public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] { - return this.child.assembleSelectionTopLevelSignals(signals); - } - - public assembleSignals(): NewSignal[] { - this.child.assembleSignals(); - return []; - } - - public assembleSelectionData(data: readonly VgData[]): readonly VgData[] { - return this.child.assembleSelectionData(data); - } - - private getHeaderLayoutMixins(): VgLayout { - const layoutMixins: VgLayout = {}; - - for (const channel of FACET_CHANNELS) { - for (const headerType of HEADER_TYPES) { - const layoutHeaderComponent = this.component.layoutHeaders[channel]; - const headerComponent = layoutHeaderComponent[headerType]; - - const {facetFieldDef} = layoutHeaderComponent; - if (facetFieldDef) { - const titleOrient = getHeaderProperty('titleOrient', facetFieldDef, this.config, channel); - - if (contains(['right', 'bottom'], titleOrient)) { - const headerChannel = getHeaderChannel(channel, titleOrient); - layoutMixins.titleAnchor = layoutMixins.titleAnchor ?? {}; - layoutMixins.titleAnchor[headerChannel] = 'end'; - } - } - - if (headerComponent?.[0]) { - // set header/footerBand - const sizeType = channel === 'row' ? 'height' : 'width'; - const bandType = headerType === 'header' ? 'headerBand' : 'footerBand'; - if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) { - // If facet child does not have size signal, then apply headerBand - layoutMixins[bandType] = layoutMixins[bandType] ?? {}; - layoutMixins[bandType][channel] = 0.5; - } - - if (layoutHeaderComponent.title) { - layoutMixins.offset = layoutMixins.offset ?? {}; - layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10; - } - } - } - } - return layoutMixins; - } - - protected assembleDefaultLayout(): VgLayout { - const {column, row} = this.facet; - - const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined; - - let align: LayoutAlign = 'all'; - - // Do not align the cells if the scale corresponding to the direction is indepent. - // We always align when we facet into both row and column. - if (!row && this.component.resolve.scale.x === 'independent') { - align = 'none'; - } else if (!column && this.component.resolve.scale.y === 'independent') { - align = 'none'; - } - - return { - ...this.getHeaderLayoutMixins(), - - ...(columns ? {columns} : {}), - bounds: 'full', - align - }; - } - - public assembleLayoutSignals(): NewSignal[] { - // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales. - return this.child.assembleLayoutSignals(); - } - - private columnDistinctSignal() { - if (this.parent && this.parent instanceof FacetModel) { - // For nested facet, we will add columns to group mark instead - // See discussion in https://github.com/vega/vega/issues/952 - // and https://github.com/vega/vega-view/releases/tag/v1.2.6 - return undefined; - } else { - // In facetNode.assemble(), the name is always this.getName('column') + '_layout'. - const facetLayoutDataName = this.getName('column_domain'); - return {signal: `length(data('${facetLayoutDataName}'))`}; - } - } - - public assembleGroup(signals: NewSignal[]) { - if (this.parent && this.parent instanceof FacetModel) { - // Provide number of columns for layout. - // See discussion in https://github.com/vega/vega/issues/952 - // and https://github.com/vega/vega-view/releases/tag/v1.2.6 - return { - ...(this.channelHasField('column') - ? { - encode: { - update: { - // TODO(https://github.com/vega/vega-lite/issues/2759): - // Correct the signal for facet of concat of facet_column - columns: {field: vgField(this.facet.column, {prefix: 'distinct'})} - } - } - } - : {}), - ...super.assembleGroup(signals) - }; - } - return super.assembleGroup(signals); - } - - /** - * Aggregate cardinality for calculating size - */ - private getCardinalityAggregateForChild() { - const fields: string[] = []; - const ops: AggregateOp[] = []; - const as: string[] = []; - - if (this.child instanceof FacetModel) { - if (this.child.channelHasField('column')) { - const field = vgField(this.child.facet.column); - fields.push(field); - ops.push('distinct'); - as.push(`distinct_${field}`); - } - } else { - for (const channel of POSITION_SCALE_CHANNELS) { - const childScaleComponent = this.child.component.scales[channel]; - if (childScaleComponent && !childScaleComponent.merged) { - const type = childScaleComponent.get('type'); - const range = childScaleComponent.get('range'); - - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const domain = assembleDomain(this.child, channel); - const field = getFieldFromDomain(domain); - if (field) { - fields.push(field); - ops.push('distinct'); - as.push(`distinct_${field}`); - } else { - log.warn(log.message.unknownField(channel)); - } - } - } - } - } - return {fields, ops, as}; - } - - private assembleFacet() { - const {name, data} = this.component.data.facetRoot; - const {row, column} = this.facet; - const {fields, ops, as} = this.getCardinalityAggregateForChild(); - const groupby: string[] = []; - - for (const channel of FACET_CHANNELS) { - const fieldDef = this.facet[channel]; - if (fieldDef) { - groupby.push(vgField(fieldDef)); - - const {bin, sort} = fieldDef; - - if (isBinning(bin)) { - groupby.push(vgField(fieldDef, {binSuffix: 'end'})); - } - - if (isSortField(sort)) { - const {field, op = DEFAULT_SORT_OP} = sort; - const outputName = facetSortFieldName(fieldDef, sort); - if (row && column) { - // For crossed facet, use pre-calculate field as it requires a different groupby - // For each calculated field, apply max and assign them to the same name as - // all values of the same group should be the same anyway. - fields.push(outputName); - ops.push('max'); - as.push(outputName); - } else { - fields.push(field); - ops.push(op); - as.push(outputName); - } - } else if (isArray(sort)) { - const outputName = sortArrayIndexField(fieldDef, channel); - fields.push(outputName); - ops.push('max'); - as.push(outputName); - } - } - } - - const cross = !!row && !!column; - - return { - name, - data, - groupby, - ...(cross || fields.length > 0 - ? { - aggregate: { - ...(cross ? {cross} : {}), - ...(fields.length ? {fields, ops, as} : {}) - } - } - : {}) - }; - } - - private facetSortFields(channel: FacetChannel): string[] { - const {facet} = this; - const fieldDef = facet[channel]; - - if (fieldDef) { - if (isSortField(fieldDef.sort)) { - return [facetSortFieldName(fieldDef, fieldDef.sort, {expr: 'datum'})]; - } else if (isArray(fieldDef.sort)) { - return [sortArrayIndexField(fieldDef, channel, {expr: 'datum'})]; - } - return [vgField(fieldDef, {expr: 'datum'})]; - } - return []; - } - - private facetSortOrder(channel: FacetChannel): SortOrder[] { - const {facet} = this; - const fieldDef = facet[channel]; - if (fieldDef) { - const {sort} = fieldDef; - const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending'; - return [order]; - } - return []; - } - - private assembleLabelTitle() { - const {facet, config} = this; - if (facet.facet) { - // Facet always uses title to display labels - return assembleLabelTitle(facet.facet, 'facet', config); - } - - const ORTHOGONAL_ORIENT = { - row: ['top', 'bottom'], - column: ['left', 'right'] - }; - - for (const channel of HEADER_CHANNELS) { - if (facet[channel]) { - const labelOrient = getHeaderProperty('labelOrient', facet[channel], config, channel); - if (contains(ORTHOGONAL_ORIENT[channel], labelOrient)) { - // Row/Column with orthogonal labelOrient must use title to display labels - return assembleLabelTitle(facet[channel], channel, config); - } - } - } - return undefined; - } - - public assembleMarks(): VgMarkGroup[] { - const {child} = this; - - // If we facet by two dimensions, we need to add a cross operator to the aggregation - // so that we create all groups - const facetRoot = this.component.data.facetRoot; - const data = assembleFacetData(facetRoot); - - const encodeEntry = child.assembleGroupEncodeEntry(false); - - const title = this.assembleLabelTitle() || child.assembleTitle(); - const style = child.assembleGroupStyle(); - - const markGroup = { - name: this.getName('cell'), - type: 'group', - ...(title ? {title} : {}), - ...(style ? {style} : {}), - from: { - facet: this.assembleFacet() - }, - // TODO: move this to after data - sort: { - field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(), - order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat() - }, - ...(data.length > 0 ? {data: data} : {}), - ...(encodeEntry ? {encode: {update: encodeEntry}} : {}), - ...child.assembleGroup(assembleFacetSignals(this, [])) - }; - - return [markGroup]; - } - - protected getMapping() { - return this.facet; - } -} diff --git a/node_modules/vega-lite/src/compile/format.ts b/node_modules/vega-lite/src/compile/format.ts deleted file mode 100644 index 505cc8e..0000000 --- a/node_modules/vega-lite/src/compile/format.ts +++ /dev/null @@ -1,242 +0,0 @@ -import {SignalRef} from 'vega-typings/types'; -import {isString} from 'vega-util'; -import {isBinning} from '../bin'; -import { - channelDefType, - DatumDef, - FieldDef, - isFieldDef, - isFieldOrDatumDefForTimeFormat, - isScaleFieldDef, - vgField -} from '../channeldef'; -import {Config} from '../config'; -import {fieldValidPredicate} from '../predicate'; -import {ScaleType} from '../scale'; -import {formatExpression, normalizeTimeUnit, timeUnitSpecifierExpression} from '../timeunit'; -import {QUANTITATIVE, Type} from '../type'; -import {Dict} from '../util'; -import {isSignalRef} from '../vega.schema'; -import {TimeUnit} from './../timeunit'; -import {datumDefToExpr} from './mark/encode/valueref'; - -export function isCustomFormatType(formatType: string) { - return formatType && formatType !== 'number' && formatType !== 'time'; -} - -function customFormatExpr(formatType: string, field: string, format: string | Dict) { - return `${formatType}(${field}${format ? `, ${JSON.stringify(format)}` : ''})`; -} - -export const BIN_RANGE_DELIMITER = ' \u2013 '; - -export function formatSignalRef({ - fieldOrDatumDef, - format, - formatType, - expr, - normalizeStack, - config -}: { - fieldOrDatumDef: FieldDef | DatumDef; - format: string | Dict; - formatType: string; - expr?: 'datum' | 'parent' | 'datum.datum'; - normalizeStack?: boolean; - config: Config; -}) { - if (isCustomFormatType(formatType)) { - return formatCustomType({ - fieldOrDatumDef, - format, - formatType, - expr, - config - }); - } - - const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack); - - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { - const signal = timeFormatExpression( - field, - isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined, - format, - config.timeFormat, - isScaleFieldDef(fieldOrDatumDef) && fieldOrDatumDef.scale?.type === ScaleType.UTC - ); - return signal ? {signal} : undefined; - } - - format = numberFormat(channelDefType(fieldOrDatumDef), format, config); - if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { - const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'}); - return { - signal: binFormatExpression(field, endField, format, formatType, config) - }; - } else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') { - return { - signal: `${formatExpr(field, format)}` - }; - } else { - return {signal: `isValid(${field}) ? ${field} : ""+${field}`}; - } -} - -function fieldToFormat( - fieldOrDatumDef: FieldDef | DatumDef, - expr: 'datum' | 'parent' | 'datum.datum', - normalizeStack: boolean -) { - if (isFieldDef(fieldOrDatumDef)) { - if (normalizeStack) { - return `${vgField(fieldOrDatumDef, {expr, suffix: 'end'})}-${vgField(fieldOrDatumDef, { - expr, - suffix: 'start' - })}`; - } else { - return vgField(fieldOrDatumDef, {expr}); - } - } else { - return datumDefToExpr(fieldOrDatumDef); - } -} - -export function formatCustomType({ - fieldOrDatumDef, - format, - formatType, - expr, - normalizeStack, - config, - field -}: { - fieldOrDatumDef: FieldDef | DatumDef; - format: string | Dict; - formatType: string; - expr?: 'datum' | 'parent' | 'datum.datum'; - normalizeStack?: boolean; - config: Config; - field?: string; // axis/legend "use datum.value" -}) { - field = field ?? fieldToFormat(fieldOrDatumDef, expr, normalizeStack); - - if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { - const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'}); - return { - signal: binFormatExpression(field, endField, format, formatType, config) - }; - } - return {signal: customFormatExpr(formatType, field, format)}; -} - -export function guideFormat( - fieldOrDatumDef: FieldDef | DatumDef, - type: Type, - format: string | Dict, - formatType: string, - config: Config, - omitTimeFormatConfig: boolean // axis doesn't use config.timeFormat -) { - if (isCustomFormatType(formatType)) { - return undefined; // handled in encode block - } - - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { - const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined; - - return timeFormat(format as string, timeUnit, config, omitTimeFormatConfig); - } - - return numberFormat(type, format, config); -} - -export function guideFormatType( - formatType: string | SignalRef, - fieldOrDatumDef: FieldDef | DatumDef, - scaleType: ScaleType -) { - if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) { - return formatType; - } - if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') { - return 'time'; - } - return undefined; -} - -/** - * Returns number format for a fieldDef. - */ -export function numberFormat(type: Type, specifiedFormat: string | Dict, config: Config) { - // Specified format in axis/legend has higher precedence than fieldDef.format - if (isString(specifiedFormat)) { - return specifiedFormat; - } - - if (type === QUANTITATIVE) { - // we only apply the default if the field is quantitative - return config.numberFormat; - } - return undefined; -} - -/** - * Returns time format for a fieldDef for use in guides. - */ -export function timeFormat(specifiedFormat: string, timeUnit: TimeUnit, config: Config, omitTimeFormatConfig: boolean) { - if (specifiedFormat) { - return specifiedFormat; - } - - if (timeUnit) { - return { - signal: timeUnitSpecifierExpression(timeUnit) - }; - } - - return omitTimeFormatConfig ? undefined : config.timeFormat; -} - -function formatExpr(field: string, format: string) { - return `format(${field}, "${format || ''}")`; -} - -function binNumberFormatExpr(field: string, format: string | Dict, formatType: string, config: Config) { - if (isCustomFormatType(formatType)) { - return customFormatExpr(formatType, field, format); - } - - return formatExpr(field, (isString(format) ? format : undefined) ?? config.numberFormat); -} - -export function binFormatExpression( - startField: string, - endField: string, - format: string | Dict, - formatType: string, - config: Config -) { - const start = binNumberFormatExpr(startField, format, formatType, config); - const end = binNumberFormatExpr(endField, format, formatType, config); - return `${fieldValidPredicate(startField, false)} ? "null" : ${start} + "${BIN_RANGE_DELIMITER}" + ${end}`; -} - -/** - * Returns the time expression used for axis/legend labels or text mark for a temporal field - */ -export function timeFormatExpression( - field: string, - timeUnit: TimeUnit, - format: string | Dict, - rawTimeFormat: string, // should be provided only for actual text and headers, not axis/legend labels - isUTCScale: boolean -): string { - if (!timeUnit || format) { - // If there is no time unit, or if user explicitly specifies format for axis/legend/text. - format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit. - return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`; - } else { - return formatExpression(timeUnit, field, isUTCScale); - } -} diff --git a/node_modules/vega-lite/src/compile/guide.ts b/node_modules/vega-lite/src/compile/guide.ts deleted file mode 100644 index 85c7983..0000000 --- a/node_modules/vega-lite/src/compile/guide.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {SignalRef} from 'vega'; -import {ValueDef} from '../channeldef'; -import {GuideEncodingEntry} from '../guide'; -import {keys} from '../util'; -import {isSignalRef, VgEncodeChannel} from '../vega.schema'; -import {wrapCondition} from './mark/encode'; -import {UnitModel} from './unit'; - -export function guideEncodeEntry(encoding: GuideEncodingEntry, model: UnitModel) { - return keys(encoding).reduce((encode, channel: VgEncodeChannel) => { - const valueDef = encoding[channel]; - return { - ...encode, - ...wrapCondition(model, valueDef, channel, (x: ValueDef | SignalRef) => (isSignalRef(x) ? x : {value: x.value})) - }; - }, {}); -} diff --git a/node_modules/vega-lite/src/compile/header/assemble.ts b/node_modules/vega-lite/src/compile/header/assemble.ts deleted file mode 100644 index fbb60b6..0000000 --- a/node_modules/vega-lite/src/compile/header/assemble.ts +++ /dev/null @@ -1,278 +0,0 @@ -/** - * Utility for generating row / column headers - */ - -import {TitleAnchor, TitleConfig} from 'vega'; -import {isArray} from 'vega-util'; -import {FacetChannel, FACET_CHANNELS} from '../../channel'; -import {vgField} from '../../channeldef'; -import {Config} from '../../config'; -import { - CoreHeader, - HEADER_LABEL_PROPERTIES, - HEADER_LABEL_PROPERTIES_MAP, - HEADER_TITLE_PROPERTIES, - HEADER_TITLE_PROPERTIES_MAP -} from '../../header'; -import {isSortField} from '../../sort'; -import {FacetFieldDef, isFacetMapping} from '../../spec/facet'; -import {contains, isEmpty, normalizeAngle, replaceAll} from '../../util'; -import {RowCol, VgComparator, VgMarkGroup, VgTitle} from '../../vega.schema'; -import {defaultLabelAlign, defaultLabelBaseline} from '../axis/properties'; -import {sortArrayIndexField} from '../data/calculate'; -import {formatSignalRef} from '../format'; -import {isFacetModel, Model} from '../model'; -import {getHeaderChannel, getHeaderProperties, getHeaderProperty} from './common'; -import { - HeaderChannel, - HeaderComponent, - HeaderType, - HEADER_TYPES, - LayoutHeaderComponent, - LayoutHeaderComponentIndex -} from './component'; - -// TODO: rename to assembleHeaderTitleGroup -export function assembleTitleGroup(model: Model, channel: FacetChannel) { - const title = model.component.layoutHeaders[channel].title; - const config = model.config ? model.config : undefined; - const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef - ? model.component.layoutHeaders[channel].facetFieldDef - : undefined; - - const {titleAnchor, titleAngle: ta, titleOrient} = getHeaderProperties( - ['titleAnchor', 'titleAngle', 'titleOrient'], - facetFieldDef, - config, - channel - ); - const headerChannel = getHeaderChannel(channel, titleOrient); - - const titleAngle = normalizeAngle(ta); - - return { - name: `${channel}-title`, - type: 'group', - role: `${headerChannel}-title`, - title: { - text: title, - ...(channel === 'row' ? {orient: 'left'} : {}), - style: 'guide-title', - ...defaultHeaderGuideBaseline(titleAngle, headerChannel), - ...defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor), - ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP) - } - }; -} - -export function defaultHeaderGuideAlign(headerChannel: HeaderChannel, angle: number, anchor: TitleAnchor = 'middle') { - switch (anchor) { - case 'start': - return {align: 'left'}; - case 'end': - return {align: 'right'}; - } - - const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x'); - return align ? {align} : {}; -} - -export function defaultHeaderGuideBaseline(angle: number, channel: FacetChannel) { - const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true); - return baseline ? {baseline} : {}; -} - -export function assembleHeaderGroups(model: Model, channel: HeaderChannel): VgMarkGroup[] { - const layoutHeader = model.component.layoutHeaders[channel]; - const groups = []; - for (const headerType of HEADER_TYPES) { - if (layoutHeader[headerType]) { - for (const headerComponent of layoutHeader[headerType]) { - const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent); - if (group != null) { - groups.push(group); - } - } - } - } - return groups; -} - -function getSort(facetFieldDef: FacetFieldDef, channel: HeaderChannel): VgComparator { - const {sort} = facetFieldDef; - if (isSortField(sort)) { - return { - field: vgField(sort, {expr: 'datum'}), - order: sort.order ?? 'ascending' - }; - } else if (isArray(sort)) { - return { - field: sortArrayIndexField(facetFieldDef, channel, {expr: 'datum'}), - order: 'ascending' - }; - } else { - return { - field: vgField(facetFieldDef, {expr: 'datum'}), - order: sort ?? 'ascending' - }; - } -} - -export function assembleLabelTitle(facetFieldDef: FacetFieldDef, channel: FacetChannel, config: Config) { - const {format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr} = getHeaderProperties( - ['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], - facetFieldDef, - config, - channel - ); - - const titleTextExpr = formatSignalRef({fieldOrDatumDef: facetFieldDef, format, formatType, expr: 'parent', config}) - .signal; - const headerChannel = getHeaderChannel(channel, labelOrient); - - return { - text: { - signal: labelExpr - ? replaceAll( - replaceAll(labelExpr, 'datum.label', titleTextExpr), - 'datum.value', - vgField(facetFieldDef, {expr: 'parent'}) - ) - : titleTextExpr - }, - ...(channel === 'row' ? {orient: 'left'} : {}), - style: 'guide-label', - frame: 'group', - ...defaultHeaderGuideBaseline(labelAngle, headerChannel), - ...defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor), - ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP) - }; -} - -export function assembleHeaderGroup( - model: Model, - channel: HeaderChannel, - headerType: HeaderType, - layoutHeader: LayoutHeaderComponent, - headerComponent: HeaderComponent -) { - if (headerComponent) { - let title = null; - const {facetFieldDef} = layoutHeader; - const config = model.config ? model.config : undefined; - if (facetFieldDef && headerComponent.labels) { - const {labelOrient} = getHeaderProperties(['labelOrient'], facetFieldDef, config, channel); - - // Include label title in the header if orient aligns with the channel - if ( - (channel === 'row' && !contains(['top', 'bottom'], labelOrient)) || - (channel === 'column' && !contains(['left', 'right'], labelOrient)) - ) { - title = assembleLabelTitle(facetFieldDef, channel, config); - } - } - - const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet); - - const axes = headerComponent.axes; - - const hasAxes = axes?.length > 0; - if (title || hasAxes) { - const sizeChannel = channel === 'row' ? 'height' : 'width'; - - return { - name: model.getName(`${channel}_${headerType}`), - type: 'group', - role: `${channel}-${headerType}`, - - ...(layoutHeader.facetFieldDef - ? { - from: {data: model.getName(channel + '_domain')}, - sort: getSort(facetFieldDef, channel) - } - : {}), - ...(hasAxes && isFacetWithoutRowCol - ? { - from: {data: model.getName(`facet_domain_${channel}`)} - } - : {}), - - ...(title ? {title} : {}), - ...(headerComponent.sizeSignal - ? { - encode: { - update: { - [sizeChannel]: headerComponent.sizeSignal - } - } - } - : {}), - ...(hasAxes ? {axes} : {}) - }; - } - } - return null; -} - -const LAYOUT_TITLE_BAND = { - column: { - start: 0, - end: 1 - }, - row: { - start: 1, - end: 0 - } -}; - -export function getLayoutTitleBand(titleAnchor: TitleAnchor, headerChannel: HeaderChannel) { - return LAYOUT_TITLE_BAND[headerChannel][titleAnchor]; -} - -export function assembleLayoutTitleBand( - headerComponentIndex: LayoutHeaderComponentIndex, - config: Config -): RowCol { - const titleBand = {}; - - for (const channel of FACET_CHANNELS) { - const headerComponent = headerComponentIndex[channel]; - if (headerComponent?.facetFieldDef) { - const {titleAnchor, titleOrient} = getHeaderProperties( - ['titleAnchor', 'titleOrient'], - headerComponent.facetFieldDef, - config, - channel - ); - - const headerChannel = getHeaderChannel(channel, titleOrient); - const band = getLayoutTitleBand(titleAnchor, headerChannel); - if (band !== undefined) { - titleBand[headerChannel] = band; - } - } - } - - return isEmpty(titleBand) ? undefined : titleBand; -} - -export function assembleHeaderProperties( - config: Config, - facetFieldDef: FacetFieldDef, - channel: FacetChannel, - properties: (keyof CoreHeader)[], - propertiesMap: Partial> -): Partial { - const props = {}; - for (const prop of properties) { - if (!propertiesMap[prop]) { - continue; - } - - const value = getHeaderProperty(prop, facetFieldDef, config, channel); - if (value !== undefined) { - props[propertiesMap[prop]] = value; - } - } - return props; -} diff --git a/node_modules/vega-lite/src/compile/header/common.ts b/node_modules/vega-lite/src/compile/header/common.ts deleted file mode 100644 index 48f35f2..0000000 --- a/node_modules/vega-lite/src/compile/header/common.ts +++ /dev/null @@ -1,47 +0,0 @@ -import {Orient} from 'vega'; -import {FacetChannel} from '../../channel'; -import {Config} from '../../config'; -import {Header} from '../../header'; -import {FacetFieldDef} from '../../spec/facet'; -import {contains, getFirstDefined} from '../../util'; -import {HeaderChannel} from './component'; - -/** - * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet. - */ -export function getHeaderChannel(channel: FacetChannel, orient: Orient): HeaderChannel { - if (contains(['top', 'bottom'], orient)) { - return 'column'; - } else if (contains(['left', 'right'], orient)) { - return 'row'; - } - return channel === 'row' ? 'row' : 'column'; -} - -export function getHeaderProperty

( - prop: P, - facetFieldDef: FacetFieldDef, - config: Config, - channel: FacetChannel -): Header[P] { - const headerSpecificConfig = - channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet; - - return getFirstDefined((facetFieldDef?.header || {})[prop], headerSpecificConfig[prop], config.header[prop]); -} - -export function getHeaderProperties( - properties: (keyof Header)[], - facetFieldDef: FacetFieldDef, - config: Config, - channel: FacetChannel -): Header { - const props = {}; - for (const prop of properties) { - const value = getHeaderProperty(prop, facetFieldDef, config, channel); - if (value !== undefined) { - props[prop] = value; - } - } - return props; -} diff --git a/node_modules/vega-lite/src/compile/header/component.ts b/node_modules/vega-lite/src/compile/header/component.ts deleted file mode 100644 index 2366bbe..0000000 --- a/node_modules/vega-lite/src/compile/header/component.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Utility for generating row / column headers - */ -import {Axis as VgAxis, SignalRef, Text} from 'vega'; -import {FacetFieldDef} from '../../spec/facet'; - -export type HeaderChannel = 'row' | 'column'; -export const HEADER_CHANNELS: HeaderChannel[] = ['row', 'column']; - -export type HeaderType = 'header' | 'footer'; -export const HEADER_TYPES: HeaderType[] = ['header', 'footer']; - -export interface LayoutHeaderComponentIndex { - row?: LayoutHeaderComponent; - column?: LayoutHeaderComponent; - facet?: LayoutHeaderComponent; -} - -/** - * A component that represents all header, footers and title of a Vega group with layout directive. - */ -export interface LayoutHeaderComponent { - title?: Text | SignalRef; - - // TODO: concat can have multiple header / footer. - // Need to redesign this part a bit. - - facetFieldDef?: FacetFieldDef; - - /** - * An array of header components for headers. - * For facet, there should be only one header component, which is data-driven. - * For concat, there can be multiple header components that explicitly list different axes. - */ - header?: HeaderComponent[]; - - /** - * An array of header components for footers. - * For facet, there should be only one header component, which is data-driven. - * For concat, there can be multiple header components that explicitly list different axes. - */ - footer?: HeaderComponent[]; -} - -/** - * A component that represents one group of row/column-header/footer. - */ -export interface HeaderComponent { - labels: boolean; - - sizeSignal: {signal: string}; - - axes: VgAxis[]; -} diff --git a/node_modules/vega-lite/src/compile/header/parse.ts b/node_modules/vega-lite/src/compile/header/parse.ts deleted file mode 100644 index a082ab0..0000000 --- a/node_modules/vega-lite/src/compile/header/parse.ts +++ /dev/null @@ -1,100 +0,0 @@ -import {AxisOrient, SignalRef} from 'vega'; -import {isArray} from 'vega-util'; -import {FacetChannel, FACET_CHANNELS} from '../../channel'; -import {title as fieldDefTitle} from '../../channeldef'; -import {contains, getFirstDefined} from '../../util'; -import {isSignalRef} from '../../vega.schema'; -import {assembleAxis} from '../axis/assemble'; -import {FacetModel} from '../facet'; -import {parseGuideResolve} from '../resolve'; -import {getHeaderProperty} from './common'; -import {HeaderChannel, HeaderComponent} from './component'; - -export function getHeaderType(orient: AxisOrient | SignalRef) { - if (orient === 'top' || orient === 'left' || isSignalRef(orient)) { - // we always use header for orient signal since we can't dynamically make header becomes footer - return 'header'; - } - return 'footer'; -} - -export function parseFacetHeaders(model: FacetModel) { - for (const channel of FACET_CHANNELS) { - parseFacetHeader(model, channel); - } - - mergeChildAxis(model, 'x'); - mergeChildAxis(model, 'y'); -} - -function parseFacetHeader(model: FacetModel, channel: FacetChannel) { - const {facet, config, child, component} = model; - if (model.channelHasField(channel)) { - const fieldDef = facet[channel]; - const titleConfig = getHeaderProperty('title', null, config, channel); - let title = fieldDefTitle(fieldDef, config, { - allowDisabling: true, - includeDefault: titleConfig === undefined || !!titleConfig - }); - - if (child.component.layoutHeaders[channel].title) { - // TODO: better handle multiline titles - title = isArray(title) ? title.join(', ') : title; - - // merge title with child to produce "Title / Subtitle / Sub-subtitle" - title += ' / ' + child.component.layoutHeaders[channel].title; - child.component.layoutHeaders[channel].title = null; - } - - const labelOrient = getHeaderProperty('labelOrient', fieldDef, config, channel); - - const header = fieldDef.header ?? {}; - const labels = getFirstDefined(header.labels, config.header.labels, true); - const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header'; - - component.layoutHeaders[channel] = { - title, - facetFieldDef: fieldDef, - [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)] - }; - } -} - -function makeHeaderComponent(model: FacetModel, channel: HeaderChannel, labels: boolean): HeaderComponent { - const sizeType = channel === 'row' ? 'height' : 'width'; - - return { - labels, - sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined, - axes: [] - }; -} - -function mergeChildAxis(model: FacetModel, channel: 'x' | 'y') { - const {child} = model; - if (child.component.axes[channel]) { - const {layoutHeaders, resolve} = model.component; - resolve.axis[channel] = parseGuideResolve(resolve, channel); - - if (resolve.axis[channel] === 'shared') { - // For shared axis, move the axes to facet's header or footer - const headerChannel = channel === 'x' ? 'column' : 'row'; - - const layoutHeader = layoutHeaders[headerChannel]; - for (const axisComponent of child.component.axes[channel]) { - const headerType = getHeaderType(axisComponent.get('orient')); - layoutHeader[headerType] = layoutHeader[headerType] ?? [makeHeaderComponent(model, headerChannel, false)]; - - // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes - const mainAxis = assembleAxis(axisComponent, 'main', model.config, {header: true}); - if (mainAxis) { - // LayoutHeader no longer keep track of property precedence, thus let's combine. - layoutHeader[headerType][0].axes.push(mainAxis); - } - axisComponent.mainExtracted = true; - } - } else { - // Otherwise do nothing for independent axes - } - } -} diff --git a/node_modules/vega-lite/src/compile/layer.ts b/node_modules/vega-lite/src/compile/layer.ts deleted file mode 100644 index b76a27e..0000000 --- a/node_modules/vega-lite/src/compile/layer.ts +++ /dev/null @@ -1,136 +0,0 @@ -import {Legend as VgLegend, NewSignal, Title as VgTitle} from 'vega'; -import {Config} from '../config'; -import * as log from '../log'; -import {isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedLayerSpec} from '../spec'; -import {keys} from '../util'; -import {VgData, VgLayout} from '../vega.schema'; -import {assembleAxisSignals} from './axis/assemble'; -import {parseLayerAxes} from './axis/parse'; -import {parseData} from './data/parse'; -import {assembleLayoutSignals} from './layoutsize/assemble'; -import {parseLayerLayoutSize} from './layoutsize/parse'; -import {assembleLegends} from './legend/assemble'; -import {Model} from './model'; -import {assembleLayerSelectionMarks} from './selection/assemble'; -import {UnitModel} from './unit'; - -export class LayerModel extends Model { - // HACK: This should be (LayerModel | UnitModel)[], but setting the correct type leads to weird error. - // So I'm just putting generic Model for now - public readonly children: Model[]; - - constructor( - spec: NormalizedLayerSpec, - parent: Model, - parentGivenName: string, - parentGivenSize: LayoutSizeMixins, - config: Config - ) { - super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view); - - const layoutSize = { - ...parentGivenSize, - ...(spec.width ? {width: spec.width} : {}), - ...(spec.height ? {height: spec.height} : {}) - }; - - this.children = spec.layer.map((layer, i) => { - if (isLayerSpec(layer)) { - return new LayerModel(layer, this, this.getName('layer_' + i), layoutSize, config); - } else if (isUnitSpec(layer)) { - return new UnitModel(layer, this, this.getName('layer_' + i), layoutSize, config); - } - - throw new Error(log.message.invalidSpec(layer)); - }); - } - - public parseData() { - this.component.data = parseData(this); - for (const child of this.children) { - child.parseData(); - } - } - - public parseLayoutSize() { - parseLayerLayoutSize(this); - } - - public parseSelections() { - // Merge selections up the hierarchy so that they may be referenced - // across unit specs. Persist their definitions within each child - // to assemble signals which remain within output Vega unit groups. - this.component.selection = {}; - for (const child of this.children) { - child.parseSelections(); - for (const key of keys(child.component.selection)) { - this.component.selection[key] = child.component.selection[key]; - } - } - } - - public parseMarkGroup() { - for (const child of this.children) { - child.parseMarkGroup(); - } - } - - public parseAxesAndHeaders() { - parseLayerAxes(this); - } - - public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] { - return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); - } - - // TODO: Support same named selections across children. - public assembleSignals(): NewSignal[] { - return this.children.reduce((signals, child) => { - return signals.concat(child.assembleSignals()); - }, assembleAxisSignals(this)); - } - - public assembleLayoutSignals(): NewSignal[] { - return this.children.reduce((signals, child) => { - return signals.concat(child.assembleLayoutSignals()); - }, assembleLayoutSignals(this)); - } - - public assembleSelectionData(data: readonly VgData[]): readonly VgData[] { - return this.children.reduce((db, child) => child.assembleSelectionData(db), data); - } - - public assembleTitle(): VgTitle { - let title = super.assembleTitle(); - if (title) { - return title; - } - // If title does not provide layer, look into children - for (const child of this.children) { - title = child.assembleTitle(); - if (title) { - return title; - } - } - return undefined; - } - - public assembleLayout(): VgLayout { - return null; - } - - public assembleMarks(): any[] { - return assembleLayerSelectionMarks( - this, - this.children.flatMap(child => { - return child.assembleMarks(); - }) - ); - } - - public assembleLegends(): VgLegend[] { - return this.children.reduce((legends, child) => { - return legends.concat(child.assembleLegends()); - }, assembleLegends(this)); - } -} diff --git a/node_modules/vega-lite/src/compile/layoutsize/assemble.ts b/node_modules/vega-lite/src/compile/layoutsize/assemble.ts deleted file mode 100644 index abf05e8..0000000 --- a/node_modules/vega-lite/src/compile/layoutsize/assemble.ts +++ /dev/null @@ -1,99 +0,0 @@ -import {InitSignal, NewSignal} from 'vega'; -import {getViewConfigContinuousSize} from '../../config'; -import {hasDiscreteDomain} from '../../scale'; -import {getFirstDefined} from '../../util'; -import {isVgRangeStep, VgRangeStep} from '../../vega.schema'; -import {isFacetModel, Model} from '../model'; -import {ScaleComponent} from '../scale/component'; -import {LayoutSizeType} from './component'; - -export function assembleLayoutSignals(model: Model): NewSignal[] { - return [ - ...sizeSignals(model, 'width'), - ...sizeSignals(model, 'height'), - ...sizeSignals(model, 'childWidth'), - ...sizeSignals(model, 'childHeight') - ]; -} - -export function sizeSignals(model: Model, sizeType: LayoutSizeType): (NewSignal | InitSignal)[] { - const channel = sizeType === 'width' ? 'x' : 'y'; - const size = model.component.layoutSize.get(sizeType); - if (!size || size === 'merged') { - return []; - } - - // Read size signal name from name map, just in case it is the top-level size signal that got renamed. - const name = model.getSizeSignalRef(sizeType).signal; - - if (size === 'step') { - const scaleComponent = model.getScaleComponent(channel); - - if (scaleComponent) { - const type = scaleComponent.get('type'); - const range = scaleComponent.get('range'); - - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const scaleName = model.scaleName(channel); - - if (isFacetModel(model.parent)) { - // If parent is facet and this is an independent scale, return only signal signal - // as the width/height will be calculated using the cardinality from - // facet's aggregate rather than reading from scale domain - const parentResolve = model.parent.component.resolve; - if (parentResolve.scale[channel] === 'independent') { - return [stepSignal(scaleName, range)]; - } - } - - return [ - stepSignal(scaleName, range), - { - name, - update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`) - } - ]; - } - } - /* istanbul ignore next: Condition should not happen -- only for warning in development. */ - throw new Error('layout size is step although width/height is not step.'); - } else if (size == 'container') { - const isWidth = name.endsWith('width'); - const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]'; - const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height'); - const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`; - return [{name, init: safeExpr, on: [{update: safeExpr, events: 'window:resize'}]}]; - } else { - return [ - { - name, - value: size - } - ]; - } -} - -function stepSignal(scaleName: string, range: VgRangeStep): NewSignal { - return { - name: scaleName + '_step', - value: range.step - }; -} - -export function sizeExpr(scaleName: string, scaleComponent: ScaleComponent, cardinality: string) { - const type = scaleComponent.get('type'); - const padding = scaleComponent.get('padding'); - const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding); - - let paddingInner = scaleComponent.get('paddingInner'); - paddingInner = - type === 'band' - ? // only band has real paddingInner - paddingInner !== undefined - ? paddingInner - : padding - : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128, - // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points. - 1; - return `bandspace(${cardinality}, ${paddingInner}, ${paddingOuter}) * ${scaleName}_step`; -} diff --git a/node_modules/vega-lite/src/compile/layoutsize/component.ts b/node_modules/vega-lite/src/compile/layoutsize/component.ts deleted file mode 100644 index ae3a746..0000000 --- a/node_modules/vega-lite/src/compile/layoutsize/component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {Split} from '../split'; - -export type LayoutSize = number | 'container' | 'step' | 'merged'; - -export interface LayoutSizeIndex { - width?: LayoutSize; - - childWidth?: LayoutSize; - - height?: LayoutSize; - - childHeight?: LayoutSize; -} - -export type LayoutSizeType = keyof LayoutSizeIndex; - -export type LayoutSizeComponent = Split; - -export function getSizeTypeFromLayoutSizeType(layoutSizeType: LayoutSizeType): 'width' | 'height' { - return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType; -} diff --git a/node_modules/vega-lite/src/compile/layoutsize/init.ts b/node_modules/vega-lite/src/compile/layoutsize/init.ts deleted file mode 100644 index 14fc166..0000000 --- a/node_modules/vega-lite/src/compile/layoutsize/init.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel'; -import {isContinuousFieldOrDatumDef} from '../../channeldef'; -import {Encoding} from '../../encoding'; -import * as log from '../../log'; -import {isStep, LayoutSizeMixins} from '../../spec/base'; - -export function initLayoutSize({encoding, size}: {encoding: Encoding; size: LayoutSizeMixins}) { - for (const channel of POSITION_SCALE_CHANNELS) { - const sizeType = getSizeChannel(channel); - if (isStep(size[sizeType])) { - if (isContinuousFieldOrDatumDef(encoding[channel])) { - delete size[sizeType]; - log.warn(log.message.stepDropped(sizeType)); - } - } - } - - return size; -} diff --git a/node_modules/vega-lite/src/compile/layoutsize/parse.ts b/node_modules/vega-lite/src/compile/layoutsize/parse.ts deleted file mode 100644 index c4b6ef7..0000000 --- a/node_modules/vega-lite/src/compile/layoutsize/parse.ts +++ /dev/null @@ -1,138 +0,0 @@ -import {getPositionScaleChannel, getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel'; -import {getViewConfigContinuousSize, getViewConfigDiscreteSize} from '../../config'; -import {hasDiscreteDomain} from '../../scale'; -import {isStep} from '../../spec/base'; -import {isVgRangeStep} from '../../vega.schema'; -import {ConcatModel} from '../concat'; -import {Model} from '../model'; -import {Explicit, mergeValuesWithExplicit} from '../split'; -import {UnitModel} from '../unit'; -import {getSizeTypeFromLayoutSizeType, LayoutSize, LayoutSizeIndex, LayoutSizeType} from './component'; - -export function parseLayerLayoutSize(model: Model) { - parseChildrenLayoutSize(model); - - parseNonUnitLayoutSizeForChannel(model, 'width'); - parseNonUnitLayoutSizeForChannel(model, 'height'); -} - -export const parseRepeatLayoutSize = parseConcatLayoutSize; - -export function parseConcatLayoutSize(model: ConcatModel) { - parseChildrenLayoutSize(model); - - // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth. - const widthType = model.layout.columns === 1 ? 'width' : 'childWidth'; - - // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight. - const heightType = model.layout.columns === undefined ? 'height' : 'childHeight'; - - parseNonUnitLayoutSizeForChannel(model, widthType); - parseNonUnitLayoutSizeForChannel(model, heightType); -} - -export function parseChildrenLayoutSize(model: Model) { - for (const child of model.children) { - child.parseLayoutSize(); - } -} - -/** - * Merge child layout size (width or height). - */ -function parseNonUnitLayoutSizeForChannel(model: Model, layoutSizeType: LayoutSizeType) { - /* - * For concat, the parent width or height might not be the same as the children's shared height. - * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width. - * - * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height) - * while the sizeType represents the properties of the child. - */ - const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); - const channel = getPositionScaleChannel(sizeType); - const resolve = model.component.resolve; - const layoutSizeCmpt = model.component.layoutSize; - - let mergedSize: Explicit; - // Try to merge layout size - for (const child of model.children) { - const childSize = child.component.layoutSize.getWithExplicit(sizeType); - const scaleResolve = resolve.scale[channel]; - if (scaleResolve === 'independent' && childSize.value === 'step') { - // Do not merge independent scales with range-step as their size depends - // on the scale domains, which can be different between scales. - mergedSize = undefined; - break; - } - - if (mergedSize) { - if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) { - // For independent scale, only merge if all the sizes are the same. - // If the values are different, abandon the merge! - mergedSize = undefined; - break; - } - mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, ''); - } else { - mergedSize = childSize; - } - } - - if (mergedSize) { - // If merged, rename size and set size of all children. - for (const child of model.children) { - model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType)); - child.component.layoutSize.set(sizeType, 'merged', false); - } - layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize); - } else { - layoutSizeCmpt.setWithExplicit(layoutSizeType, { - explicit: false, - value: undefined - }); - } -} - -export function parseUnitLayoutSize(model: UnitModel) { - const {size, component} = model; - for (const channel of POSITION_SCALE_CHANNELS) { - const sizeType = getSizeChannel(channel); - - if (size[sizeType]) { - const specifiedSize = size[sizeType]; - component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true); - } else { - const defaultSize = defaultUnitSize(model, sizeType); - component.layoutSize.set(sizeType, defaultSize, false); - } - } -} - -function defaultUnitSize(model: UnitModel, sizeType: 'width' | 'height'): LayoutSize { - const channel = sizeType === 'width' ? 'x' : 'y'; - const config = model.config; - const scaleComponent = model.getScaleComponent(channel); - - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const range = scaleComponent.get('range'); - - if (hasDiscreteDomain(scaleType)) { - const size = getViewConfigDiscreteSize(config.view, sizeType); - if (isVgRangeStep(range) || isStep(size)) { - // For discrete domain with range.step, use dynamic width/height - return 'step'; - } else { - return size; - } - } else { - return getViewConfigContinuousSize(config.view, sizeType); - } - } else if (model.hasProjection || model.mark === 'arc') { - // arc should use continuous size by default otherwise the pie is extremely small - return getViewConfigContinuousSize(config.view, sizeType); - } else { - const size = getViewConfigDiscreteSize(config.view, sizeType); - return isStep(size) ? size.step : size; - } -} diff --git a/node_modules/vega-lite/src/compile/legend/assemble.ts b/node_modules/vega-lite/src/compile/legend/assemble.ts deleted file mode 100644 index 5051a9f..0000000 --- a/node_modules/vega-lite/src/compile/legend/assemble.ts +++ /dev/null @@ -1,103 +0,0 @@ -import {Legend as VgLegend, LegendEncode} from 'vega'; -import {Config} from '../../config'; -import {LEGEND_SCALE_CHANNELS, SIGNAL_LEGEND_PROP_INDEX} from '../../legend'; -import {keys, replaceAll, stringify, vals} from '../../util'; -import {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema'; -import {Model} from '../model'; -import {LegendComponent} from './component'; -import {mergeLegendComponent} from './parse'; - -function setLegendEncode( - legend: VgLegend, - part: keyof LegendEncode, - vgProp: VgEncodeChannel, - vgRef: VgValueRef | VgValueRef[] -) { - legend.encode = legend.encode ?? {}; - legend.encode[part] = legend.encode[part] ?? {}; - legend.encode[part].update = legend.encode[part].update ?? {}; - // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 - (legend.encode[part].update[vgProp] as any) = vgRef; -} - -export function assembleLegends(model: Model): VgLegend[] { - const legendComponentIndex = model.component.legends; - const legendByDomain: Record = {}; - - for (const channel of keys(legendComponentIndex)) { - const scaleComponent = model.getScaleComponent(channel); - const domainHash = stringify(scaleComponent.get('domains')); - if (legendByDomain[domainHash]) { - for (const mergedLegendComponent of legendByDomain[domainHash]) { - const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]); - if (!merged) { - // If cannot merge, need to add this legend separately - legendByDomain[domainHash].push(legendComponentIndex[channel]); - } - } - } else { - legendByDomain[domainHash] = [legendComponentIndex[channel].clone()]; - } - } - - const legends = vals(legendByDomain) - .flat() - .map(l => assembleLegend(l, model.config)) - .filter(l => l !== undefined); - - return legends; -} - -export function assembleLegend(legendCmpt: LegendComponent, config: Config) { - const {disable, labelExpr, selections, ...legend} = legendCmpt.combine(); - - if (disable) { - return undefined; - } - - if (config.aria === false && legend.aria == undefined) { - legend.aria = false; - } - - if (legend.encode?.symbols) { - const out = legend.encode.symbols.update; - if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) { - // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used. - out.stroke = {value: 'transparent'}; - } - - // Remove properties that the legend is encoding. - for (const property of LEGEND_SCALE_CHANNELS) { - if (legend[property]) { - delete out[property]; - } - } - } - - if (!legend.title) { - // title schema doesn't include null, '' - delete legend.title; - } - - if (labelExpr !== undefined) { - let expr = labelExpr; - if (legend.encode?.labels?.update && isSignalRef(legend.encode.labels.update.text)) { - expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal); - } - setLegendEncode(legend, 'labels', 'text', {signal: expr}); - } - - for (const prop in legend) { - const propValue = legend[prop]; - if (isSignalRef(propValue)) { - const propIndex = SIGNAL_LEGEND_PROP_INDEX[prop]; - if (propIndex) { - const {vgProp, part} = propIndex; - setLegendEncode(legend, part, vgProp, propValue); - delete legend[prop]; - } - } - } - - return legend; -} diff --git a/node_modules/vega-lite/src/compile/legend/component.ts b/node_modules/vega-lite/src/compile/legend/component.ts deleted file mode 100644 index 315800f..0000000 --- a/node_modules/vega-lite/src/compile/legend/component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {Legend as VgLegend} from 'vega'; -import {NonPositionScaleChannel} from '../../channel'; -import {COMMON_LEGEND_PROPERTY_INDEX, Legend} from '../../legend'; -import {Flag, keys} from '../../util'; -import {Split} from '../split'; - -export type LegendComponentProps = VgLegend & { - labelExpr?: string; - selections?: string[]; - disable?: boolean; -}; - -const LEGEND_COMPONENT_PROPERTY_INDEX: Flag = { - ...COMMON_LEGEND_PROPERTY_INDEX, - disable: 1, - labelExpr: 1, - selections: 1, - // channel scales - opacity: 1, - shape: 1, - stroke: 1, - fill: 1, - size: 1, - strokeWidth: 1, - strokeDash: 1, - // encode - encode: 1 -}; - -export const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX); - -export class LegendComponent extends Split {} - -export type LegendComponentIndex = Partial>; - -export type LegendIndex = Partial>; diff --git a/node_modules/vega-lite/src/compile/legend/encode.ts b/node_modules/vega-lite/src/compile/legend/encode.ts deleted file mode 100644 index 180d875..0000000 --- a/node_modules/vega-lite/src/compile/legend/encode.ts +++ /dev/null @@ -1,212 +0,0 @@ -import {ColorValueRef, EncodeEntry, Gradient, LegendEncode, LegendType, SignalRef, SymbolEncodeEntry} from 'vega'; -import {array, isArray, stringValue} from 'vega-util'; -import {COLOR, NonPositionScaleChannel, OPACITY} from '../../channel'; -import { - Conditional, - DatumDef, - hasConditionalValueDef, - isFieldDef, - isValueDef, - TypedFieldDef, - Value, - ValueDef -} from '../../channeldef'; -import {Encoding} from '../../encoding'; -import {FILL_STROKE_CONFIG} from '../../mark'; -import {getFirstDefined, isEmpty, varName} from '../../util'; -import {applyMarkConfig, signalOrValueRef} from '../common'; -import {formatCustomType, isCustomFormatType} from '../format'; -import * as mixins from '../mark/encode'; -import {STORE} from '../selection'; -import {UnitModel} from '../unit'; -import {LegendComponent} from './component'; - -export interface LegendEncodeParams { - fieldOrDatumDef: TypedFieldDef | DatumDef; - model: UnitModel; - channel: NonPositionScaleChannel; - legendCmpt: LegendComponent; - legendType: LegendType; -} - -export const legendEncodeRules: { - [part in keyof LegendEncode]?: (spec: EncodeEntry, params: LegendEncodeParams) => EncodeEntry; -} = { - symbols, - gradient, - labels, - entries -}; - -export function symbols( - symbolsSpec: any, - {fieldOrDatumDef, model, channel, legendCmpt, legendType}: LegendEncodeParams -): SymbolEncodeEntry { - if (legendType !== 'symbol') { - return undefined; - } - - const {markDef, encoding, config, mark} = model; - const filled = markDef.filled && mark !== 'trail'; - - let out = { - ...applyMarkConfig({}, model, FILL_STROKE_CONFIG), - ...mixins.color(model, {filled}) - } as SymbolEncodeEntry; // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry - - const symbolOpacity = legendCmpt.get('symbolOpacity') ?? config.legend.symbolOpacity; - const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor; - const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor; - - const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined; - - if (out.fill) { - // for fill legend, we don't want any fill in symbol - if (channel === 'fill' || (filled && channel === COLOR)) { - delete out.fill; - } else { - if (out.fill['field']) { - // For others, set fill to some opaque value (or nothing if a color is already set) - if (symbolFillColor) { - delete out.fill; - } else { - out.fill = signalOrValueRef(config.legend.symbolBaseFillColor ?? 'black'); - out.fillOpacity = signalOrValueRef(opacity ?? 1); - } - } else if (isArray(out.fill)) { - const fill = - getFirstConditionValue(encoding.fill ?? encoding.color) ?? markDef.fill ?? (filled && markDef.color); - if (fill) { - out.fill = signalOrValueRef(fill) as ColorValueRef; - } - } - } - } - - if (out.stroke) { - if (channel === 'stroke' || (!filled && channel === COLOR)) { - delete out.stroke; - } else { - if (out.stroke['field'] || symbolStrokeColor) { - // For others, remove stroke field - delete out.stroke; - } else if (isArray(out.stroke)) { - const stroke = getFirstDefined( - getFirstConditionValue(encoding.stroke || encoding.color), - markDef.stroke, - filled ? markDef.color : undefined - ); - if (stroke) { - out.stroke = {value: stroke} as ColorValueRef; - } - } - } - } - - if (channel !== OPACITY) { - const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef); - - if (condition) { - out.opacity = [ - {test: condition, ...signalOrValueRef(opacity ?? 1)}, - signalOrValueRef(config.legend.unselectedOpacity) - ]; - } else if (opacity) { - out.opacity = signalOrValueRef(opacity); - } - } - - out = {...out, ...symbolsSpec}; - - return isEmpty(out) ? undefined : out; -} - -export function gradient(gradientSpec: any, {model, legendType, legendCmpt}: LegendEncodeParams) { - if (legendType !== 'gradient') { - return undefined; - } - - const {config, markDef, encoding} = model; - - let out: SymbolEncodeEntry = {}; - - const gradientOpacity = legendCmpt.get('gradientOpacity') ?? config.legend.gradientOpacity; - const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined; - if (opacity) { - // only apply opacity if it is neither zero or undefined - out.opacity = signalOrValueRef(opacity); - } - - out = {...out, ...gradientSpec}; - return isEmpty(out) ? undefined : out; -} - -export function labels(specifiedlabelsSpec: any, {fieldOrDatumDef, model, channel, legendCmpt}: LegendEncodeParams) { - const legend = model.legend(channel) || {}; - const config = model.config; - - const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined; - const opacity = condition ? [{test: condition, value: 1}, {value: config.legend.unselectedOpacity}] : undefined; - - const {format, formatType} = legend; - - const text = isCustomFormatType(formatType) - ? formatCustomType({ - fieldOrDatumDef, - field: 'datum.value', - format, - formatType, - config - }) - : undefined; - - const labelsSpec = { - ...(opacity ? {opacity} : {}), - ...(text ? {text} : {}), - ...specifiedlabelsSpec - }; - - return isEmpty(labelsSpec) ? undefined : labelsSpec; -} - -export function entries(entriesSpec: any, {legendCmpt}: LegendEncodeParams) { - const selections = legendCmpt.get('selections'); - return selections?.length ? {...entriesSpec, fill: {value: 'transparent'}} : entriesSpec; -} - -function getMaxValue(channelDef: Encoding['opacity']) { - return getConditionValue(channelDef, (v: number, conditionalDef) => Math.max(v, conditionalDef.value as any)); -} - -export function getFirstConditionValue( - channelDef: Encoding['fill' | 'stroke' | 'shape'] -): V { - return getConditionValue(channelDef, (v: V, conditionalDef: Conditional>) => { - return getFirstDefined(v, conditionalDef.value); - }); -} - -function getConditionValue( - channelDef: Encoding['fill' | 'stroke' | 'shape' | 'opacity'], - reducer: (val: V, conditionalDef: Conditional>) => V -): V { - if (hasConditionalValueDef(channelDef)) { - return array(channelDef.condition).reduce(reducer, channelDef.value as any); - } else if (isValueDef(channelDef)) { - return channelDef.value as any; - } - return undefined; -} - -function selectedCondition(model: UnitModel, legendCmpt: LegendComponent, fieldDef: TypedFieldDef) { - const selections = legendCmpt.get('selections'); - if (!selections?.length) return undefined; - - const field = stringValue(fieldDef.field); - return selections - .map(name => { - const store = stringValue(varName(name) + STORE); - return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`; - }) - .join(' || '); -} diff --git a/node_modules/vega-lite/src/compile/legend/parse.ts b/node_modules/vega-lite/src/compile/legend/parse.ts deleted file mode 100644 index ea19970..0000000 --- a/node_modules/vega-lite/src/compile/legend/parse.ts +++ /dev/null @@ -1,275 +0,0 @@ -import {Legend as VgLegend, LegendEncode} from 'vega'; -import {COLOR, NonPositionScaleChannel, SHAPE} from '../../channel'; -import {DatumDef, FieldDef, getFieldOrDatumDef, isFieldDef, MarkPropDatumDef, MarkPropFieldDef} from '../../channeldef'; -import {Legend, LEGEND_SCALE_CHANNELS} from '../../legend'; -import {normalizeTimeUnit} from '../../timeunit'; -import {GEOJSON} from '../../type'; -import {deleteNestedProperty, isEmpty, keys, varName} from '../../util'; -import {mergeTitleComponent} from '../common'; -import {guideEncodeEntry} from '../guide'; -import {isUnitModel, Model} from '../model'; -import {parseGuideResolve} from '../resolve'; -import {parseInteractiveLegend} from '../selection/transforms/legends'; -import {defaultTieBreaker, Explicit, makeImplicit, mergeValuesWithExplicit} from '../split'; -import {UnitModel} from '../unit'; -import {LegendComponent, LegendComponentIndex, LegendComponentProps, LEGEND_COMPONENT_PROPERTIES} from './component'; -import {LegendEncodeParams, legendEncodeRules} from './encode'; -import {getDirection, getLegendType, LegendRuleParams, legendRules} from './properties'; - -export function parseLegend(model: Model) { - const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model); - model.component.legends = legendComponent; - return legendComponent; -} - -function parseUnitLegend(model: UnitModel): LegendComponentIndex { - const {encoding} = model; - - const legendComponent: LegendComponentIndex = {}; - - for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) { - const def = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | MarkPropDatumDef; - - if (!def || !model.getScaleComponent(channel)) { - continue; - } - - if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) { - continue; - } - - legendComponent[channel] = parseLegendForChannel(model, channel); - } - - return legendComponent; -} - -function getLegendDefWithScale(model: UnitModel, channel: NonPositionScaleChannel): VgLegend { - const scale = model.scaleName(channel); - if (model.mark === 'trail') { - if (channel === 'color') { - // trail is a filled mark, but its default symbolType ("stroke") should use "stroke" - return {stroke: scale}; - } else if (channel === 'size') { - return {strokeWidth: scale}; - } - } - - if (channel === 'color') { - return model.markDef.filled ? {fill: scale} : {stroke: scale}; - } - return {[channel]: scale}; -} - -// eslint-disable-next-line @typescript-eslint/ban-types -function isExplicit( - value: T, - property: keyof LegendComponentProps, - legend: Legend, - fieldDef: FieldDef -) { - switch (property) { - case 'disable': - return legend !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit - case 'values': - // specified legend.values is already respected, but may get transformed. - return !!legend?.values; - case 'title': - // title can be explicit if fieldDef.title is set - if (property === 'title' && value === fieldDef?.title) { - return true; - } - } - // Otherwise, things are explicit if the returned value matches the specified property - return value === (legend || {})[property]; -} - -export function parseLegendForChannel(model: UnitModel, channel: NonPositionScaleChannel): LegendComponent { - let legend = model.legend(channel); - - const {markDef, encoding, config} = model; - const legendConfig = config.legend; - const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel)); - parseInteractiveLegend(model, channel, legendCmpt); - - const disable = legend !== undefined ? !legend : legendConfig.disable; - legendCmpt.set('disable', disable, legend !== undefined); - if (disable) { - return legendCmpt; - } - - legend = legend || {}; - - const scaleType = model.getScaleComponent(channel).get('type'); - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | DatumDef; - const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined; - - const orient = legend.orient || config.legend.orient || 'right'; - const legendType = getLegendType({legend, channel, timeUnit, scaleType}); - - const direction = getDirection({legend, legendType, orient, legendConfig}); - - const ruleParams: LegendRuleParams = { - legend, - channel, - model, - markDef, - encoding, - fieldOrDatumDef, - legendConfig, - config, - scaleType, - orient, - legendType, - direction - }; - - for (const property of LEGEND_COMPONENT_PROPERTIES) { - if ( - (legendType === 'gradient' && property.startsWith('symbol')) || - (legendType === 'symbol' && property.startsWith('gradient')) - ) { - continue; - } - - const value = property in legendRules ? legendRules[property](ruleParams) : legend[property]; - if (value !== undefined) { - const explicit = isExplicit(value, property, legend, model.fieldDef(channel)); - if (explicit || config.legend[property] === undefined) { - legendCmpt.set(property, value, explicit); - } - } - } - - const legendEncoding = legend?.encoding ?? {}; - const selections = legendCmpt.get('selections'); - const legendEncode: LegendEncode = {}; - - const legendEncodeParams: LegendEncodeParams = {fieldOrDatumDef, model, channel, legendCmpt, legendType}; - - for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) { - const legendEncodingPart = guideEncodeEntry(legendEncoding[part] ?? {}, model); - - const value = - part in legendEncodeRules - ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule - : legendEncodingPart; // no rule -- just default values - - if (value !== undefined && !isEmpty(value)) { - legendEncode[part] = { - ...(selections?.length && isFieldDef(fieldOrDatumDef) - ? {name: `${varName(fieldOrDatumDef.field)}_legend_${part}`} - : {}), - ...(selections?.length ? {interactive: !!selections} : {}), - update: value - }; - } - } - - if (!isEmpty(legendEncode)) { - legendCmpt.set('encode', legendEncode, !!legend?.encoding); - } - - return legendCmpt; -} - -function parseNonUnitLegend(model: Model) { - const {legends, resolve} = model.component; - - for (const child of model.children) { - parseLegend(child); - - for (const channel of keys(child.component.legends)) { - resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel); - - if (resolve.legend[channel] === 'shared') { - // If the resolve says shared (and has not been overridden) - // We will try to merge and see if there is a conflict - - legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]); - - if (!legends[channel]) { - // If merge returns nothing, there is a conflict so we cannot make the legend shared. - // Thus, mark legend as independent and remove the legend component. - resolve.legend[channel] = 'independent'; - delete legends[channel]; - } - } - } - } - - for (const channel of keys(legends)) { - for (const child of model.children) { - if (!child.component.legends[channel]) { - // skip if the child does not have a particular legend - continue; - } - - if (resolve.legend[channel] === 'shared') { - // After merging shared legend, make sure to remove legend from child - delete child.component.legends[channel]; - } - } - } - - return legends; -} - -export function mergeLegendComponent(mergedLegend: LegendComponent, childLegend: LegendComponent): LegendComponent { - if (!mergedLegend) { - return childLegend.clone(); - } - const mergedOrient = mergedLegend.getWithExplicit('orient'); - const childOrient = childLegend.getWithExplicit('orient'); - - if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { - // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) - // Cannot merge due to inconsistent orient - return undefined; - } - - let typeMerged = false; - // Otherwise, let's merge - for (const prop of LEGEND_COMPONENT_PROPERTIES) { - const mergedValueWithExplicit = mergeValuesWithExplicit( - mergedLegend.getWithExplicit(prop), - childLegend.getWithExplicit(prop), - prop, - 'legend', - - // Tie breaker function - (v1: Explicit, v2: Explicit): any => { - switch (prop) { - case 'symbolType': - return mergeSymbolType(v1, v2); - case 'title': - return mergeTitleComponent(v1, v2); - case 'type': - // There are only two types. If we have different types, then prefer symbol over gradient. - typeMerged = true; - return makeImplicit('symbol'); - } - return defaultTieBreaker(v1, v2, prop, 'legend'); - } - ); - mergedLegend.setWithExplicit(prop, mergedValueWithExplicit); - } - if (typeMerged) { - if (mergedLegend.implicit?.encode?.gradient) { - deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']); - } - if (mergedLegend.explicit?.encode?.gradient) { - deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']); - } - } - - return mergedLegend; -} - -function mergeSymbolType(st1: Explicit, st2: Explicit) { - if (st2.value === 'circle') { - // prefer "circle" over "stroke" - return st2; - } - return st1; -} diff --git a/node_modules/vega-lite/src/compile/legend/properties.ts b/node_modules/vega-lite/src/compile/legend/properties.ts deleted file mode 100644 index 910873a..0000000 --- a/node_modules/vega-lite/src/compile/legend/properties.ts +++ /dev/null @@ -1,244 +0,0 @@ -import {LabelOverlap, LegendOrient, LegendType, Orientation, SignalRef, SymbolShape} from 'vega'; -import {isArray} from 'vega-util'; -import {isColorChannel} from '../../channel'; -import {DatumDef, MarkPropFieldOrDatumDef, title as fieldDefTitle, TypedFieldDef, valueArray} from '../../channeldef'; -import {Config} from '../../config'; -import {Encoding} from '../../encoding'; -import {Legend, LegendConfig} from '../../legend'; -import {Mark, MarkDef} from '../../mark'; -import {isContinuousToContinuous, ScaleType} from '../../scale'; -import {TimeUnit} from '../../timeunit'; -import {contains, getFirstDefined} from '../../util'; -import {isSignalRef} from '../../vega.schema'; -import {guideFormat, guideFormatType} from '../format'; -import {Model} from '../model'; -import {UnitModel} from '../unit'; -import {NonPositionScaleChannel} from './../../channel'; -import {LegendComponentProps} from './component'; -import {getFirstConditionValue} from './encode'; - -export interface LegendRuleParams { - legend: Legend; - channel: NonPositionScaleChannel; - model: UnitModel; - markDef: MarkDef; - encoding: Encoding; - fieldOrDatumDef: MarkPropFieldOrDatumDef; - legendConfig: LegendConfig; - config: Config; - scaleType: ScaleType; - orient: LegendOrient; - legendType: LegendType; - direction: Orientation; -} - -export const legendRules: { - [k in keyof LegendComponentProps]?: (params: LegendRuleParams) => LegendComponentProps[k]; -} = { - direction: ({direction}) => direction, - - format: ({fieldOrDatumDef, legend, config}) => { - const {format, formatType} = legend; - return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false); - }, - - formatType: ({legend, fieldOrDatumDef, scaleType}) => { - const {formatType} = legend; - return guideFormatType(formatType, fieldOrDatumDef, scaleType); - }, - - gradientLength: params => { - const {legend, legendConfig} = params; - return legend.gradientLength ?? legendConfig.gradientLength ?? defaultGradientLength(params); - }, - - labelOverlap: ({legend, legendConfig, scaleType}) => - legend.labelOverlap ?? legendConfig.labelOverlap ?? defaultLabelOverlap(scaleType), - - symbolType: ({legend, markDef, channel, encoding}) => - legend.symbolType ?? defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape), - - title: ({fieldOrDatumDef, config}) => fieldDefTitle(fieldOrDatumDef, config, {allowDisabling: true}), - - type: ({legendType, scaleType, channel}) => { - if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) { - if (legendType === 'gradient') { - return undefined; - } - } else if (legendType === 'symbol') { - return undefined; - } - return legendType; - }, // depended by other property, let's define upfront - - values: ({fieldOrDatumDef, legend}) => values(legend, fieldOrDatumDef) -}; - -export function values(legend: Legend, fieldOrDatumDef: TypedFieldDef | DatumDef) { - const vals = legend.values; - - if (isArray(vals)) { - return valueArray(fieldOrDatumDef, vals); - } else if (isSignalRef(vals)) { - return vals; - } - return undefined; -} - -export function defaultSymbolType( - mark: Mark, - channel: NonPositionScaleChannel, - shapeChannelDef: Encoding['shape'], - markShape: SymbolShape | SignalRef -): SymbolShape | SignalRef { - if (channel !== 'shape') { - // use the value from the shape encoding or the mark config if they exist - const shape = getFirstConditionValue(shapeChannelDef) ?? markShape; - if (shape) { - return shape; - } - } - - switch (mark) { - case 'bar': - case 'rect': - case 'image': - case 'square': - return 'square'; - case 'line': - case 'trail': - case 'rule': - return 'stroke'; - case 'arc': - case 'point': - case 'circle': - case 'tick': - case 'geoshape': - case 'area': - case 'text': - return 'circle'; - } -} - -export function clipHeight(legendType: LegendType) { - if (legendType === 'gradient') { - return 20; - } - return undefined; -} - -export function getLegendType(params: { - legend: Legend; - channel: NonPositionScaleChannel; - timeUnit?: TimeUnit; - scaleType: ScaleType; -}): LegendType { - const {legend} = params; - - return getFirstDefined(legend.type, defaultType(params)); -} - -export function defaultType({ - channel, - timeUnit, - scaleType -}: { - channel: NonPositionScaleChannel; - timeUnit?: TimeUnit; - scaleType: ScaleType; -}): LegendType { - // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js - - if (isColorChannel(channel)) { - if (contains(['quarter', 'month', 'day'], timeUnit)) { - return 'symbol'; - } - - if (isContinuousToContinuous(scaleType)) { - return 'gradient'; - } - } - return 'symbol'; -} - -export function getDirection({ - legendConfig, - legendType, - orient, - legend -}: { - orient: LegendOrient; - legendConfig: LegendConfig; - legendType: LegendType; - legend: Legend; -}): Orientation { - return ( - legend.direction ?? - legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'] ?? - defaultDirection(orient, legendType) - ); -} - -export function defaultDirection(orient: LegendOrient, legendType: LegendType): 'horizontal' | undefined { - switch (orient) { - case 'top': - case 'bottom': - return 'horizontal'; - - case 'left': - case 'right': - case 'none': - case undefined: // undefined = "right" in Vega - return undefined; // vertical is Vega's default - default: - // top-left / ... - // For inner legend, uses compact layout like Tableau - return legendType === 'gradient' ? 'horizontal' : undefined; - } -} - -export function defaultGradientLength({ - legendConfig, - model, - direction, - orient, - scaleType -}: { - scaleType: ScaleType; - direction: Orientation; - orient: LegendOrient; - model: Model; - legendConfig: LegendConfig; -}) { - const { - gradientHorizontalMaxLength, - gradientHorizontalMinLength, - gradientVerticalMaxLength, - gradientVerticalMinLength - } = legendConfig; - if (isContinuousToContinuous(scaleType)) { - if (direction === 'horizontal') { - if (orient === 'top' || orient === 'bottom') { - return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength); - } else { - return gradientHorizontalMinLength; - } - } else { - // vertical / undefined (Vega uses vertical by default) - return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength); - } - } - return undefined; -} - -function gradientLengthSignal(model: Model, sizeType: 'width' | 'height', min: number, max: number) { - const sizeSignal = model.getSizeSignalRef(sizeType).signal; - return {signal: `clamp(${sizeSignal}, ${min}, ${max})`}; -} - -export function defaultLabelOverlap(scaleType: ScaleType): LabelOverlap { - if (contains(['quantile', 'threshold', 'log'], scaleType)) { - return 'greedy'; - } - return undefined; -} diff --git a/node_modules/vega-lite/src/compile/mark/arc.ts b/node_modules/vega-lite/src/compile/mark/arc.ts deleted file mode 100644 index a5dd135..0000000 --- a/node_modules/vega-lite/src/compile/mark/arc.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const arc: MarkCompiler = { - vgMark: 'arc', - encodeEntry: (model: UnitModel) => { - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - }), - ...encode.pointPosition('x', model, {defaultPos: 'mid'}), - ...encode.pointPosition('y', model, {defaultPos: 'mid'}), - - // arcs are rectangles in polar coordinates - ...encode.rectPosition(model, 'radius', 'arc'), - ...encode.rectPosition(model, 'theta', 'arc') - }; - } -}; diff --git a/node_modules/vega-lite/src/compile/mark/area.ts b/node_modules/vega-lite/src/compile/mark/area.ts deleted file mode 100644 index 25cf60d..0000000 --- a/node_modules/vega-lite/src/compile/mark/area.ts +++ /dev/null @@ -1,30 +0,0 @@ -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const area: MarkCompiler = { - vgMark: 'area', - encodeEntry: (model: UnitModel) => { - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'include', - size: 'ignore', - theta: 'ignore' - }), - ...encode.pointOrRangePosition('x', model, { - defaultPos: 'zeroOrMin', - defaultPos2: 'zeroOrMin', - range: model.markDef.orient === 'horizontal' - }), - ...encode.pointOrRangePosition('y', model, { - defaultPos: 'zeroOrMin', - defaultPos2: 'zeroOrMin', - range: model.markDef.orient === 'vertical' - }), - ...encode.defined(model) - }; - } -}; diff --git a/node_modules/vega-lite/src/compile/mark/bar.ts b/node_modules/vega-lite/src/compile/mark/bar.ts deleted file mode 100644 index e6454dc..0000000 --- a/node_modules/vega-lite/src/compile/mark/bar.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const bar: MarkCompiler = { - vgMark: 'rect', - encodeEntry: (model: UnitModel) => { - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - }), - ...encode.rectPosition(model, 'x', 'bar'), - ...encode.rectPosition(model, 'y', 'bar') - }; - } -}; diff --git a/node_modules/vega-lite/src/compile/mark/base.ts b/node_modules/vega-lite/src/compile/mark/base.ts deleted file mode 100644 index a62b9f3..0000000 --- a/node_modules/vega-lite/src/compile/mark/base.ts +++ /dev/null @@ -1,20 +0,0 @@ -import {Mark} from 'vega'; -import {VgEncodeEntry, VgPostEncodingTransform} from '../../vega.schema'; -import {UnitModel} from '../unit'; - -/** - * Abstract interface for compiling a Vega-Lite primitive mark type. - */ -export interface MarkCompiler { - /** - * Underlying Vega Mark type for the Vega-Lite mark. - */ - vgMark: Mark['type']; - - encodeEntry: (model: UnitModel) => VgEncodeEntry; - - /** - * Transform on a mark after render, used for layout and projections - */ - postEncodingTransform?: (model: UnitModel) => VgPostEncodingTransform[]; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/aria.ts b/node_modules/vega-lite/src/compile/mark/encode/aria.ts deleted file mode 100644 index ebbc770..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/aria.ts +++ /dev/null @@ -1,77 +0,0 @@ -import {entries, isEmpty} from '../../../util'; -import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; -import {VG_MARK_INDEX} from './../../../vega.schema'; -import {UnitModel} from './../../unit'; -import {wrapCondition} from './conditional'; -import {textRef} from './text'; -import {tooltipData} from './tooltip'; - -export function aria(model: UnitModel) { - const {markDef, config} = model; - - const enableAria = getMarkPropOrConfig('aria', markDef, config); - - // We can ignore other aria properties if ariaHidden is true. - if (enableAria === false) { - // getMarkGroups sets aria to false already so we don't have to set it in the encode block - return {}; - } - - return { - ...(enableAria ? {aria: enableAria} : {}), - ...ariaRoleDescription(model), - ...description(model) - }; -} - -function ariaRoleDescription(model: UnitModel) { - const {mark, markDef, config} = model; - - if (config.aria === false) { - return {}; - } - - const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config); - - if (ariaRoleDesc != null) { - return {ariaRoleDescription: {value: ariaRoleDesc}}; - } - - return mark in VG_MARK_INDEX ? {} : {ariaRoleDescription: {value: mark}}; -} - -export function description(model: UnitModel) { - const {encoding, markDef, config, stack} = model; - const channelDef = encoding.description; - - if (channelDef) { - return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config)); - } - - // Use default from mark def or config if defined. - // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here. - const descriptionValue = getMarkPropOrConfig('description', markDef, config); - if (descriptionValue != null) { - return { - description: signalOrValueRef(descriptionValue) - }; - } - - if (config.aria === false) { - return {}; - } - - const data = tooltipData(encoding, stack, config); - - if (isEmpty(data)) { - return undefined; - } - - return { - description: { - signal: entries(data) - .map(({key, value}, index) => `"${index > 0 ? '; ' : ''}${key}: " + (${value})`) - .join(' + ') - } - }; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/base.ts b/node_modules/vega-lite/src/compile/mark/encode/base.ts deleted file mode 100644 index 75b04b1..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/base.ts +++ /dev/null @@ -1,105 +0,0 @@ -import {array} from 'vega-util'; -import {Channel, ScaleChannel, SCALE_CHANNELS} from '../../../channel'; -import {isPathMark, MarkDef} from '../../../mark'; -import {hasContinuousDomain} from '../../../scale'; -import {Dict, keys} from '../../../util'; -import {VgEncodeEntry, VgValueRef, VG_MARK_CONFIGS} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; -import {UnitModel} from '../../unit'; -import {aria} from './aria'; -import {color} from './color'; -import {nonPosition} from './nonposition'; -import {text} from './text'; -import {tooltip} from './tooltip'; -import {fieldInvalidPredicate} from './valueref'; -import {zindex} from './zindex'; - -export {color} from './color'; -export {wrapCondition} from './conditional'; -export {nonPosition} from './nonposition'; -export {pointPosition} from './position-point'; -export {pointOrRangePosition, rangePosition} from './position-range'; -export {rectPosition} from './position-rect'; -export {text} from './text'; -export {tooltip} from './tooltip'; - -export type Ignore = Record<'color' | 'size' | 'orient' | 'align' | 'baseline' | 'theta', 'ignore' | 'include'>; - -const ALWAYS_IGNORE = new Set(['aria']); - -export function baseEncodeEntry(model: UnitModel, ignore: Ignore) { - const {fill = undefined, stroke = undefined} = ignore.color === 'include' ? color(model) : {}; - return { - ...markDefProperties(model.markDef, ignore), - ...wrapAllFieldsInvalid(model, 'fill', fill), - ...wrapAllFieldsInvalid(model, 'stroke', stroke), - ...nonPosition('opacity', model), - ...nonPosition('fillOpacity', model), - ...nonPosition('strokeOpacity', model), - ...nonPosition('strokeWidth', model), - ...nonPosition('strokeDash', model), - ...zindex(model), - ...tooltip(model), - ...text(model, 'href'), - ...aria(model) - }; -} - -// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987 -function wrapAllFieldsInvalid(model: UnitModel, channel: Channel, valueRef: VgValueRef | VgValueRef[]): VgEncodeEntry { - const {config, mark, markDef} = model; - - const invalid = getMarkPropOrConfig('invalid', markDef, config); - - if (invalid === 'hide' && valueRef && !isPathMark(mark)) { - // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains. - // For path marks, we will use "defined" property and skip these values instead. - const test = allFieldsInvalidPredicate(model, {invalid: true, channels: SCALE_CHANNELS}); - if (test) { - return { - [channel]: [ - // prepend the invalid case - // TODO: support custom value - {test, value: null}, - ...array(valueRef) - ] - }; - } - } - return valueRef ? {[channel]: valueRef} : {}; -} - -function markDefProperties(mark: MarkDef, ignore: Ignore) { - return VG_MARK_CONFIGS.reduce((m, prop) => { - if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') { - m[prop] = signalOrValueRef(mark[prop]); - } - return m; - }, {}); -} - -function allFieldsInvalidPredicate( - model: UnitModel, - {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]} -) { - const filterIndex = channels.reduce((aggregator: Dict, channel) => { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const field = model.vgField(channel, {expr: 'datum'}); - - // While discrete domain scales can handle invalid values, continuous scales can't. - if (field && hasContinuousDomain(scaleType)) { - aggregator[field] = true; - } - } - return aggregator; - }, {}); - - const fields = keys(filterIndex); - if (fields.length > 0) { - const op = invalid ? '||' : '&&'; - return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); - } - return undefined; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/color.ts b/node_modules/vega-lite/src/compile/mark/encode/color.ts deleted file mode 100644 index c01b388..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/color.ts +++ /dev/null @@ -1,58 +0,0 @@ -import * as log from '../../../log'; -import {contains} from '../../../util'; -import {VgEncodeEntry} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; -import {UnitModel} from '../../unit'; -import {nonPosition} from './nonposition'; - -export function color(model: UnitModel, opt: {filled: boolean | undefined} = {filled: undefined}): VgEncodeEntry { - const {markDef, encoding, config} = model; - const {type: markType} = markDef; - - // Allow filled to be overridden (for trail's "filled") - const filled = opt.filled ?? getMarkPropOrConfig('filled', markDef, config); - - const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType) - ? 'transparent' - : undefined; - - const defaultFill = - getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, {vgChannel: 'fill'}) ?? - // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified - config.mark[filled === true && 'color'] ?? - // If there is no fill, always fill symbols, bar, geoshape - // with transparent fills https://github.com/vega/vega-lite/issues/1316 - transparentIfNeeded; - - const defaultStroke = - getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, {vgChannel: 'stroke'}) ?? - // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified - config.mark[filled === false && 'color']; - - const colorVgChannel = filled ? 'fill' : 'stroke'; - - const fillStrokeMarkDefAndConfig: VgEncodeEntry = { - ...(defaultFill ? {fill: signalOrValueRef(defaultFill)} : {}), - ...(defaultStroke ? {stroke: signalOrValueRef(defaultStroke)} : {}) - }; - - if (markDef.color && (filled ? markDef.fill : markDef.stroke)) { - log.warn(log.message.droppingColor('property', {fill: 'fill' in markDef, stroke: 'stroke' in markDef})); - } - - return { - ...fillStrokeMarkDefAndConfig, - ...nonPosition('color', model, { - vgChannel: colorVgChannel, - defaultValue: filled ? defaultFill : defaultStroke - }), - ...nonPosition('fill', model, { - // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding - defaultValue: encoding.fill ? defaultFill : undefined - }), - ...nonPosition('stroke', model, { - // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding - defaultValue: encoding.stroke ? defaultStroke : undefined - }) - }; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/conditional.ts b/node_modules/vega-lite/src/compile/mark/encode/conditional.ts deleted file mode 100644 index c113485..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/conditional.ts +++ /dev/null @@ -1,46 +0,0 @@ -import {SignalRef} from 'vega'; -import {array} from 'vega-util'; -import { - ChannelDef, - ConditionalPredicate, - ConditionalSelection, - isConditionalDef, - isConditionalSelection -} from '../../../channeldef'; -import {GuideEncodingConditionalValueDef} from '../../../guide'; -import {VgEncodeEntry, VgValueRef} from '../../../vega.schema'; -import {expression} from '../../predicate'; -import {parseSelectionPredicate} from '../../selection/parse'; -import {UnitModel} from '../../unit'; - -/** - * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition - * or a simple mixin if channel def has no condition. - */ -export function wrapCondition( - model: UnitModel, - channelDef: CD, - vgChannel: string, - refFn: (cDef: CD) => VgValueRef -): VgEncodeEntry { - const condition = isConditionalDef(channelDef) && channelDef.condition; - const valueRef = refFn(channelDef); - if (condition) { - const conditions = array(condition); - const vgConditions = conditions.map(c => { - const conditionValueRef = refFn(c); - const test = isConditionalSelection(c) - ? parseSelectionPredicate(model, (c as ConditionalSelection).selection) // FIXME: remove casting once TS is no longer dumb about it - : expression(model, (c as ConditionalPredicate).test); // FIXME: remove casting once TS is no longer dumb about it - return { - test, - ...conditionValueRef - }; - }); - return { - [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])] - }; - } else { - return valueRef !== undefined ? {[vgChannel]: valueRef} : {}; - } -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/defined.ts b/node_modules/vega-lite/src/compile/mark/encode/defined.ts deleted file mode 100644 index 7b0f9bf..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/defined.ts +++ /dev/null @@ -1,56 +0,0 @@ -import {POSITION_SCALE_CHANNELS} from '../../../channel'; -import {ScaleChannel} from '../../../channel'; -import {Value} from '../../../channeldef'; -import {hasContinuousDomain} from '../../../scale'; -import {Dict, keys} from '../../../util'; -import {VgEncodeEntry} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; -import {UnitModel} from '../../unit'; -import {fieldInvalidPredicate} from './valueref'; - -export function defined(model: UnitModel): VgEncodeEntry { - const {config, markDef} = model; - - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid) { - const signal = allFieldsInvalidPredicate(model, {channels: POSITION_SCALE_CHANNELS}); - - if (signal) { - return {defined: {signal}}; - } - } - return {}; -} - -function allFieldsInvalidPredicate( - model: UnitModel, - {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]} -) { - const filterIndex = channels.reduce((aggregator: Dict, channel) => { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const field = model.vgField(channel, {expr: 'datum'}); - - // While discrete domain scales can handle invalid values, continuous scales can't. - if (field && hasContinuousDomain(scaleType)) { - aggregator[field] = true; - } - } - return aggregator; - }, {}); - - const fields = keys(filterIndex); - if (fields.length > 0) { - const op = invalid ? '||' : '&&'; - return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); - } - return undefined; -} - -export function valueIfDefined(prop: string, value: Value): VgEncodeEntry { - if (value !== undefined) { - return {[prop]: signalOrValueRef(value)}; - } - return undefined; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/index.ts b/node_modules/vega-lite/src/compile/mark/encode/index.ts deleted file mode 100644 index b64e6fe..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -export {baseEncodeEntry} from './base'; -export {color} from './color'; -export {wrapCondition} from './conditional'; -export {defined, valueIfDefined} from './defined'; -export {nonPosition} from './nonposition'; -export {pointPosition} from './position-point'; -export {pointOrRangePosition, rangePosition} from './position-range'; -export {rectBinPosition, rectPosition} from './position-rect'; -export {text} from './text'; -export {tooltip, tooltipRefForEncoding} from './tooltip'; -export {aria} from './aria'; diff --git a/node_modules/vega-lite/src/compile/mark/encode/nonposition.ts b/node_modules/vega-lite/src/compile/mark/encode/nonposition.ts deleted file mode 100644 index c341ca7..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/nonposition.ts +++ /dev/null @@ -1,49 +0,0 @@ -import {SignalRef} from 'vega'; -import {NonPositionScaleChannel} from '../../../channel'; -import {Value} from '../../../channeldef'; -import {VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; -import {UnitModel} from '../../unit'; -import {wrapCondition} from './conditional'; -import * as ref from './valueref'; - -/** - * Return encode for non-positional channels with scales. (Text doesn't have scale.) - */ -export function nonPosition( - channel: NonPositionScaleChannel, - model: UnitModel, - opt: { - defaultValue?: Value | SignalRef; - vgChannel?: VgEncodeChannel; - defaultRef?: VgValueRef; - } = {} -): VgEncodeEntry { - const {markDef, encoding, config} = model; - const {vgChannel} = opt; - let {defaultRef, defaultValue} = opt; - - if (defaultRef === undefined) { - // prettier-ignore - defaultValue = defaultValue ?? getMarkPropOrConfig(channel, markDef, config, {vgChannel, ignoreVgConfig: true}); - - if (defaultValue !== undefined) { - defaultRef = signalOrValueRef(defaultValue); - } - } - - const channelDef = encoding[channel]; - - return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => { - return ref.midPoint({ - channel, - channelDef: cDef, - markDef, - config, - scaleName: model.scaleName(channel), - scale: model.getScaleComponent(channel), - stack: null, // No need to provide stack for non-position as it does not affect mid point - defaultRef - }); - }); -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/offset.ts b/node_modules/vega-lite/src/compile/mark/encode/offset.ts deleted file mode 100644 index f8c55b5..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/offset.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Utility files for producing Vega ValueRef for marks - */ -import {SignalRef} from 'vega-typings/types'; -import {getOffsetChannel, PolarPositionChannel, PositionChannel} from '../../../channel'; -import {MarkDef} from '../../../mark'; - -export function getOffset(channel: PositionChannel | PolarPositionChannel, markDef: MarkDef): number | SignalRef { - const offsetChannel = getOffsetChannel(channel); - - // TODO: in the future read from encoding channel too - const markDefOffsetValue = markDef[offsetChannel]; - if (markDefOffsetValue) { - return markDefOffsetValue; - } - - return undefined; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/position-align.ts b/node_modules/vega-lite/src/compile/mark/encode/position-align.ts deleted file mode 100644 index c3e11b8..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/position-align.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {Align} from 'vega'; -import {getVgPositionChannel} from '../../../channel'; -import {Config} from '../../../config'; -import {MarkDef} from '../../../mark'; -import {VgEncodeChannel} from '../../../vega.schema'; -import {getMarkPropOrConfig} from '../../common'; - -const ALIGNED_X_CHANNEL: Record = { - left: 'x', - center: 'xc', - right: 'x2' -}; - -const BASELINED_Y_CHANNEL = { - top: 'y', - middle: 'yc', - bottom: 'y2' -}; - -export function vgAlignedPositionChannel( - channel: 'x' | 'y' | 'radius' | 'theta', - markDef: MarkDef, - config: Config, - defaultAlign: 'top' | 'middle' = 'middle' -) { - if (channel === 'radius' || channel === 'theta') { - return getVgPositionChannel(channel); - } - const alignChannel = channel === 'x' ? 'align' : 'baseline'; - const align = getMarkPropOrConfig(alignChannel, markDef, config); - if (channel === 'x') { - return ALIGNED_X_CHANNEL[align || (defaultAlign === 'top' ? 'left' : 'center')]; - } else { - return BASELINED_Y_CHANNEL[align || defaultAlign]; - } -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/position-point.ts b/node_modules/vega-lite/src/compile/mark/encode/position-point.ts deleted file mode 100644 index 066374a..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/position-point.ts +++ /dev/null @@ -1,187 +0,0 @@ -import { - getMainRangeChannel, - getSecondaryRangeChannel, - getSizeChannel, - getVgPositionChannel, - isXorY, - PolarPositionChannel, - PositionChannel -} from '../../../channel'; -import {getBand, isFieldDef, isFieldOrDatumDef, TypedFieldDef} from '../../../channeldef'; -import {ScaleType} from '../../../scale'; -import {contains} from '../../../util'; -import {VgValueRef} from '../../../vega.schema'; -import {getMarkPropOrConfig} from '../../common'; -import {ScaleComponent} from '../../scale/component'; -import {UnitModel} from '../../unit'; -import {getOffset} from './offset'; -import * as ref from './valueref'; - -/** - * Return encode for point (non-band) position channels. - */ -export function pointPosition( - channel: 'x' | 'y' | 'theta' | 'radius', - model: UnitModel, - { - defaultPos, - vgChannel, - isMidPoint - }: { - defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null; - vgChannel?: 'x' | 'y' | 'xc' | 'yc'; - isMidPoint?: boolean; - } -) { - const {encoding, markDef, config, stack} = model; - - const channelDef = encoding[channel]; - const channel2Def = encoding[getSecondaryRangeChannel(channel)]; - const scaleName = model.scaleName(channel); - const scale = model.getScaleComponent(channel); - - const offset = getOffset(channel, markDef); - - // Get default position or position from mark def - const defaultRef = pointPositionDefaultRef({ - model, - defaultPos, - channel, - scaleName, - scale - }); - - const valueRef = - !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude) - ? // use geopoint output if there are lat/long and there is no point position overriding lat/long. - {field: model.getName(channel)} - : positionRef({ - channel, - channelDef, - channel2Def, - markDef, - config, - isMidPoint, - scaleName, - scale, - stack, - offset, - defaultRef - }); - - return valueRef ? {[vgChannel || channel]: valueRef} : undefined; -} - -// TODO: we need to find a way to refactor these so that scaleName is a part of scale -// but that's complicated. For now, this is a huge step moving forward. - -/** - * @return Vega ValueRef for normal x- or y-position without projection - */ -export function positionRef( - params: ref.MidPointParams & { - channel: 'x' | 'y' | 'radius' | 'theta'; - isMidPoint?: boolean; - } -): VgValueRef | VgValueRef[] { - const {channel, channelDef, isMidPoint, scaleName, stack, offset, markDef, config} = params; - - // This isn't a part of midPoint because we use midPoint for non-position too - if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) { - if (isFieldDef(channelDef)) { - const band = getBand({ - channel, - fieldDef: channelDef, - isMidPoint, - markDef, - stack, - config - }); - if (band !== undefined) { - return ref.interpolatedSignalRef({ - scaleName, - fieldOrDatumDef: channelDef as TypedFieldDef, // positionRef always have type - startSuffix: 'start', - band, - offset - }); - } - } - // x or y use stack_end so that stacked line's point mark use stack_end too. - return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'end'}, {offset}); - } - - return ref.midPointRefWithPositionInvalidTest(params); -} - -export function pointPositionDefaultRef({ - model, - defaultPos, - channel, - scaleName, - scale -}: { - model: UnitModel; - defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null; - channel: PositionChannel | PolarPositionChannel; - scaleName: string; - scale: ScaleComponent; -}): () => VgValueRef { - const {markDef, config} = model; - return () => { - const mainChannel = getMainRangeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - - const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, {vgChannel}); - if (definedValueOrConfig !== undefined) { - return ref.widthHeightValueOrSignalRef(channel, definedValueOrConfig); - } - - switch (defaultPos) { - case 'zeroOrMin': - case 'zeroOrMax': - if (scaleName) { - const scaleType = scale.get('type'); - if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) { - // Log scales cannot have zero. - // Zero in time scale is arbitrary, and does not affect ratio. - // (Time is an interval level of measurement, not ratio). - // See https://en.wikipedia.org/wiki/Level_of_measurement for more info. - } else { - if (scale.domainDefinitelyIncludesZero()) { - return { - scale: scaleName, - value: 0 - }; - } - } - } - - if (defaultPos === 'zeroOrMin') { - return mainChannel === 'y' ? {field: {group: 'height'}} : {value: 0}; - } else { - // zeroOrMax - switch (mainChannel) { - case 'radius': - // max of radius is min(width, height) / 2 - return { - signal: `min(${model.width.signal},${model.height.signal})/2` - }; - case 'theta': - return {signal: '2*PI'}; - case 'x': - return {field: {group: 'width'}}; - case 'y': - return {value: 0}; - } - } - break; - case 'mid': { - const sizeRef = model[getSizeChannel(channel)]; - return {...sizeRef, mult: 0.5}; - } - } - // defaultPos === null - return undefined; - }; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/position-range.ts b/node_modules/vega-lite/src/compile/mark/encode/position-range.ts deleted file mode 100644 index d6f6eed..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/position-range.ts +++ /dev/null @@ -1,179 +0,0 @@ -import {getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel} from '../../../channel'; -import {isFieldOrDatumDef} from '../../../channeldef'; -import {MarkConfig} from '../../../mark'; -import {VgEncodeEntry, VgValueRef} from '../../../vega.schema'; -import {getMarkStyleConfig} from '../../common'; -import {UnitModel} from '../../unit'; -import {getOffset} from './offset'; -import {vgAlignedPositionChannel} from './position-align'; -import {pointPosition, pointPositionDefaultRef} from './position-point'; -import * as ref from './valueref'; - -/** - * Utility for area/rule position, which can be either point or range. (One of the axes should be point and the other should be range.) - */ -export function pointOrRangePosition( - channel: 'x' | 'y', - model: UnitModel, - { - defaultPos, - defaultPos2, - range - }: { - defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid'; - defaultPos2: 'zeroOrMin' | 'zeroOrMax'; - range: boolean; - } -) { - if (range) { - return rangePosition(channel, model, {defaultPos, defaultPos2}); - } - return pointPosition(channel, model, {defaultPos}); -} - -export function rangePosition( - channel: 'x' | 'y' | 'theta' | 'radius', - model: UnitModel, - { - defaultPos, - defaultPos2 - }: { - defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid'; - defaultPos2: 'zeroOrMin' | 'zeroOrMax'; - } -): VgEncodeEntry { - const {markDef, config} = model; - const channel2 = getSecondaryRangeChannel(channel); - const sizeChannel = getSizeChannel(channel); - - const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2); - - const vgChannel = pos2Mixins[sizeChannel] - ? // If there is width/height, we need to position the marks based on the alignment. - vgAlignedPositionChannel(channel, markDef, config) - : // Otherwise, make sure to apply to the right Vg Channel (for arc mark) - getVgPositionChannel(channel); - - return { - ...pointPosition(channel, model, {defaultPos, vgChannel}), - ...pos2Mixins - }; -} - -/** - * Return encode for x2, y2. - * If channel is not specified, return one channel based on orientation. - */ -function pointPosition2OrSize( - model: UnitModel, - defaultPos: 'zeroOrMin' | 'zeroOrMax', - channel: 'x2' | 'y2' | 'radius2' | 'theta2' -) { - const {encoding, mark, markDef, stack, config} = model; - - const baseChannel = getMainRangeChannel(channel); - const sizeChannel = getSizeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - - const channelDef = encoding[baseChannel]; - const scaleName = model.scaleName(baseChannel); - const scale = model.getScaleComponent(baseChannel); - - const offset = - channel in encoding || channel in markDef - ? getOffset(channel, model.markDef) - : getOffset(baseChannel, model.markDef); - - if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) { - // use geopoint output if there are lat2/long2 and there is no point position2 overriding lat2/long2. - return {[vgChannel]: {field: model.getName(channel)}}; - } - - const valueRef = position2Ref({ - channel, - channelDef, - channel2Def: encoding[channel], - markDef, - config, - scaleName, - scale, - stack, - offset, - defaultRef: undefined - }); - - if (valueRef !== undefined) { - return {[vgChannel]: valueRef}; - } - - // TODO: check width/height encoding here once we add them - - // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence: - // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark) - - return ( - position2orSize(channel, markDef) || - position2orSize(channel, { - [channel]: getMarkStyleConfig(channel, markDef, config.style), - [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style) - }) || - position2orSize(channel, config[mark]) || - position2orSize(channel, config.mark) || { - [vgChannel]: pointPositionDefaultRef({ - model, - defaultPos, - channel, - scaleName, - scale - })() - } - ); -} - -export function position2Ref({ - channel, - channelDef, - channel2Def, - markDef, - config, - scaleName, - scale, - stack, - offset, - defaultRef -}: ref.MidPointParams & { - channel: 'x2' | 'y2' | 'radius2' | 'theta2'; -}): VgValueRef | VgValueRef[] { - if ( - isFieldOrDatumDef(channelDef) && - stack && - // If fieldChannel is X and channel is X2 (or Y and Y2) - channel.charAt(0) === stack.fieldChannel.charAt(0) - ) { - return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'start'}, {offset}); - } - return ref.midPointRefWithPositionInvalidTest({ - channel, - channelDef: channel2Def, - scaleName, - scale, - stack, - markDef, - config, - offset, - defaultRef - }); -} - -function position2orSize(channel: 'x2' | 'y2' | 'radius2' | 'theta2', markDef: MarkConfig) { - const sizeChannel = getSizeChannel(channel); - const vgChannel = getVgPositionChannel(channel); - if (markDef[vgChannel] !== undefined) { - return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[vgChannel])}; - } else if (markDef[channel] !== undefined) { - return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel])}; - } else if (markDef[sizeChannel]) { - return {[sizeChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[sizeChannel])}; - } - return undefined; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/position-rect.ts b/node_modules/vega-lite/src/compile/mark/encode/position-rect.ts deleted file mode 100644 index 405b4e0..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/position-rect.ts +++ /dev/null @@ -1,358 +0,0 @@ -import {SignalRef} from 'vega'; -import {isArray, isNumber} from 'vega-util'; -import {isBinned, isBinning, isBinParams} from '../../../bin'; -import { - getSecondaryRangeChannel, - getSizeChannel, - getVgPositionChannel, - isPolarPositionChannel, - isXorY, - PolarPositionChannel, - PositionChannel -} from '../../../channel'; -import {getBand, isFieldDef, isFieldOrDatumDef, TypedFieldDef, vgField} from '../../../channeldef'; -import {Config, DEFAULT_STEP, getViewConfigDiscreteStep} from '../../../config'; -import {Encoding} from '../../../encoding'; -import * as log from '../../../log'; -import {Mark, MarkDef} from '../../../mark'; -import {hasDiscreteDomain, ScaleType} from '../../../scale'; -import {getFirstDefined} from '../../../util'; -import {isSignalRef, isVgRangeStep, VgEncodeEntry, VgValueRef} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrStringValue} from '../../common'; -import {ScaleComponent} from '../../scale/component'; -import {UnitModel} from '../../unit'; -import {nonPosition} from './nonposition'; -import {getOffset} from './offset'; -import {vgAlignedPositionChannel} from './position-align'; -import {pointPositionDefaultRef} from './position-point'; -import {rangePosition} from './position-range'; -import * as ref from './valueref'; - -export function rectPosition( - model: UnitModel, - channel: 'x' | 'y' | 'theta' | 'radius', - mark: 'bar' | 'rect' | 'image' | 'arc' -): VgEncodeEntry { - const {config, encoding, markDef, stack} = model; - - const channel2 = getSecondaryRangeChannel(channel); - const sizeChannel = getSizeChannel(channel); - const channelDef = encoding[channel]; - const channelDef2 = encoding[channel2]; - - const scale = model.getScaleComponent(channel); - const scaleType = scale ? scale.get('type') : undefined; - const scaleName = model.scaleName(channel); - - const orient = markDef.orient; - const hasSizeDef = - encoding[sizeChannel] ?? encoding.size ?? getMarkPropOrConfig('size', markDef, config, {vgChannel: sizeChannel}); - - const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal'); - - // x, x2, and width -- we must specify two of these in all conditions - if ( - isFieldDef(channelDef) && - (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) && - !hasSizeDef && - !hasDiscreteDomain(scaleType) - ) { - const band = getBand({channel, fieldDef: channelDef, stack, markDef, config}); - const axis = model.component.axes[channel]?.[0]; - const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5 - - return rectBinPosition({ - fieldDef: channelDef, - fieldDef2: channelDef2, - channel, - markDef, - scaleName, - band, - axisTranslate, - spacing: isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) : undefined, - reverse: scale.get('reverse'), - config - }); - } else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) { - return positionAndSize(mark, channelDef, channel, model); - } else { - return rangePosition(channel, model, {defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin'}); - } -} -function defaultSizeRef( - mark: 'bar' | 'rect' | 'image' | 'arc', - sizeChannel: 'width' | 'height', - scaleName: string, - scale: ScaleComponent, - config: Config, - band: number | true -): VgValueRef { - if (scale) { - const scaleType = scale.get('type'); - if (scaleType === 'point' || scaleType === 'band') { - if (config[mark].discreteBandSize !== undefined) { - return {value: config[mark].discreteBandSize}; - } - if (scaleType === ScaleType.POINT) { - const scaleRange = scale.get('range'); - if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { - return {value: scaleRange.step - 2}; - } - return {value: DEFAULT_STEP - 2}; - } else { - // BAND - return {scale: scaleName, band}; - } - } else { - // continuous scale - return {value: config[mark].continuousBandSize}; - } - } - // No Scale - - const step = getViewConfigDiscreteStep(config.view, sizeChannel); - - const value = getFirstDefined( - // No scale is like discrete bar (with one item) - config[mark].discreteBandSize, - step - 2 - ); - return value !== undefined ? {value} : undefined; -} - -/** - * Output position encoding and its size encoding for continuous, point, and band scales. - */ -function positionAndSize( - mark: 'bar' | 'rect' | 'image' | 'arc', - fieldDef: Encoding['x' | 'y' | 'theta' | 'radius'], - channel: 'x' | 'y' | 'theta' | 'radius', - model: UnitModel -) { - const {markDef, encoding, config, stack} = model; - const orient = markDef.orient; - - const scaleName = model.scaleName(channel); - const scale = model.getScaleComponent(channel); - const vgSizeChannel = getSizeChannel(channel); - const channel2 = getSecondaryRangeChannel(channel); - - // use "size" channel for bars, if there is orient and the channel matches the right orientation - const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x'); - - const sizeFromMarkOrConfig = getMarkPropOrConfig(useVlSizeChannel ? 'size' : vgSizeChannel, markDef, config, { - vgChannel: vgSizeChannel - }); - - // Use size encoding / mark property / config if it exists - let sizeMixins; - if (encoding.size || sizeFromMarkOrConfig !== undefined) { - if (useVlSizeChannel) { - sizeMixins = nonPosition('size', model, {vgChannel: vgSizeChannel, defaultValue: sizeFromMarkOrConfig}); - } else { - log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type)); - } - } - - // Otherwise, apply default value - const band = (isFieldOrDatumDef(fieldDef) ? getBand({channel, fieldDef, markDef, stack, config}) : undefined) ?? 1; - sizeMixins = sizeMixins || {[vgSizeChannel]: defaultSizeRef(mark, vgSizeChannel, scaleName, scale, config, band)}; - - /* - Band scales with size value and all point scales, use xc/yc + band=0.5 - - Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2. - In this case, size_band is the band specified in the x/y-encoding. - By default band is 1, so `(1 - band) / 2` = 0. - If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2 - */ - - const center = scale?.get('type') !== 'band' || !('band' in sizeMixins[vgSizeChannel]); - - const vgChannel = vgAlignedPositionChannel(channel, markDef, config, center ? 'middle' : 'top'); - const offset = getOffset(channel, markDef); - - const posRef = ref.midPointRefWithPositionInvalidTest({ - channel, - channelDef: fieldDef, - markDef, - config, - scaleName, - scale, - stack, - offset, - defaultRef: pointPositionDefaultRef({model, defaultPos: 'mid', channel, scaleName, scale}), - band: center ? 0.5 : (1 - band) / 2 - }); - - if (vgSizeChannel) { - return {[vgChannel]: posRef, ...sizeMixins}; - } else { - // otherwise, we must simulate size by setting position2 = position + size - // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth) - const vgChannel2 = getVgPositionChannel(channel2); - const sizeRef = sizeMixins[vgSizeChannel]; - const sizeOffset = offset ? {...sizeRef, offset} : sizeRef; - return { - [vgChannel]: posRef, - - // posRef might be an array that wraps position invalid test - [vgChannel2]: isArray(posRef) - ? [posRef[0], {...posRef[1], offset: sizeOffset}] - : { - ...posRef, - offset: sizeOffset - } - }; - } -} - -function getBinSpacing( - channel: PositionChannel | PolarPositionChannel, - spacing: number, - reverse: boolean | SignalRef, - translate: number | SignalRef, - offset: number | SignalRef -) { - if (isPolarPositionChannel(channel)) { - return 0; - } - - const spacingOffset = channel === 'x' || channel === 'y2' ? -spacing / 2 : spacing / 2; - - if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(translate)) { - const reverseExpr = signalOrStringValue(reverse); - const offsetExpr = signalOrStringValue(offset); - const translateExpr = signalOrStringValue(translate); - - const t = translateExpr ? `${translateExpr} + ` : ''; - const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : ''; - const o = offsetExpr ? `(${offsetExpr} + ${spacingOffset})` : spacingOffset; - - return { - signal: t + r + o - }; - } else { - offset = offset || 0; - return translate + (reverse ? -offset - spacingOffset : +offset + spacingOffset); - } -} - -export function rectBinPosition({ - fieldDef, - fieldDef2, - channel, - band, - scaleName, - markDef, - spacing = 0, - axisTranslate, - reverse, - config -}: { - fieldDef: TypedFieldDef; - fieldDef2?: Encoding['x2' | 'y2']; - channel: 'x' | 'y' | 'theta' | 'radius'; - band: number; - scaleName: string; - markDef: MarkDef; - spacing?: number; - axisTranslate: number | SignalRef; - reverse: boolean | SignalRef; - config: Config; -}) { - const channel2 = getSecondaryRangeChannel(channel); - - const vgChannel = getVgPositionChannel(channel); - const vgChannel2 = getVgPositionChannel(channel2); - - const offset = getOffset(channel, markDef); - - if (isBinning(fieldDef.bin) || fieldDef.timeUnit) { - return { - [vgChannel2]: rectBinRef({ - channel, - fieldDef, - scaleName, - markDef, - band: (1 - band) / 2, - offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset), - config - }), - [vgChannel]: rectBinRef({ - channel, - fieldDef, - scaleName, - markDef, - band: 1 - (1 - band) / 2, - offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset), - config - }) - }; - } else if (isBinned(fieldDef.bin)) { - const startRef = ref.valueRefForFieldOrDatumDef( - fieldDef, - scaleName, - {}, - {offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset)} - ); - - if (isFieldDef(fieldDef2)) { - return { - [vgChannel2]: startRef, - [vgChannel]: ref.valueRefForFieldOrDatumDef( - fieldDef2, - scaleName, - {}, - {offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset)} - ) - }; - } else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) { - return { - [vgChannel2]: startRef, - [vgChannel]: { - signal: `scale("${scaleName}", ${vgField(fieldDef, {expr: 'datum'})} + ${fieldDef.bin.step})`, - offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset) - } - }; - } - } - log.warn(log.message.channelRequiredForBinned(channel2)); - return undefined; -} - -/** - * Value Ref for binned fields - */ -export function rectBinRef({ - channel, - fieldDef, - scaleName, - markDef, - band, - offset, - config -}: { - channel: PositionChannel | PolarPositionChannel; - fieldDef: TypedFieldDef; - scaleName: string; - markDef: MarkDef; - band: number; - offset?: number | SignalRef; - config?: Config; -}) { - const r = ref.interpolatedSignalRef({ - scaleName, - fieldOrDatumDef: fieldDef, - band, - offset - }); - - return ref.wrapPositionInvalidTest({ - fieldDef, - channel, - markDef, - ref: r, - config - }); -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/text.ts b/node_modules/vega-lite/src/compile/mark/encode/text.ts deleted file mode 100644 index 8458372..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/text.ts +++ /dev/null @@ -1,31 +0,0 @@ -import {getFormatMixins, isFieldOrDatumDef, isValueDef} from '../../../channeldef'; -import {Config} from '../../../config'; -import {Encoding} from '../../../encoding'; -import {VgValueRef} from '../../../vega.schema'; -import {signalOrValueRef} from '../../common'; -import {formatSignalRef} from '../../format'; -import {UnitModel} from '../../unit'; -import {wrapCondition} from './conditional'; - -export function text(model: UnitModel, channel: 'text' | 'href' | 'url' | 'description' = 'text') { - const channelDef = model.encoding[channel]; - return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config)); -} - -export function textRef( - channelDef: Encoding['text' | 'tooltip'], - config: Config, - expr: 'datum' | 'datum.datum' = 'datum' -): VgValueRef { - // text - if (channelDef) { - if (isValueDef(channelDef)) { - return signalOrValueRef(channelDef.value); - } - if (isFieldOrDatumDef(channelDef)) { - const {format, formatType} = getFormatMixins(channelDef); - return formatSignalRef({fieldOrDatumDef: channelDef, format, formatType, expr, config}); - } - } - return undefined; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/tooltip.ts b/node_modules/vega-lite/src/compile/mark/encode/tooltip.ts deleted file mode 100644 index 9edc008..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/tooltip.ts +++ /dev/null @@ -1,144 +0,0 @@ -import {array, isArray, isObject, isString} from 'vega-util'; -import {isBinned} from '../../../bin'; -import {getMainRangeChannel, isXorY, Channel} from '../../../channel'; -import { - defaultTitle, - getFieldDef, - getFormatMixins, - hasConditionalFieldDef, - isFieldDef, - isTypedFieldDef, - SecondaryFieldDef, - TypedFieldDef, - vgField -} from '../../../channeldef'; -import {Config} from '../../../config'; -import {Encoding, forEach} from '../../../encoding'; -import {StackProperties} from '../../../stack'; -import {entries} from '../../../util'; -import {isSignalRef} from '../../../vega.schema'; -import {getMarkPropOrConfig} from '../../common'; -import {binFormatExpression, formatSignalRef} from '../../format'; -import {UnitModel} from '../../unit'; -import {wrapCondition} from './conditional'; -import {textRef} from './text'; - -export function tooltip(model: UnitModel, opt: {reactiveGeom?: boolean} = {}) { - const {encoding, markDef, config, stack} = model; - const channelDef = encoding.tooltip; - if (isArray(channelDef)) { - return {tooltip: tooltipRefForEncoding({tooltip: channelDef}, stack, config, opt)}; - } else { - const datum = opt.reactiveGeom ? 'datum.datum' : 'datum'; - return wrapCondition(model, channelDef, 'tooltip', cDef => { - // use valueRef based on channelDef first - const tooltipRefFromChannelDef = textRef(cDef, config, datum); - if (tooltipRefFromChannelDef) { - return tooltipRefFromChannelDef; - } - - if (cDef === null) { - // Allow using encoding.tooltip = null to disable tooltip - return undefined; - } - - let markTooltip = getMarkPropOrConfig('tooltip', markDef, config); - - if (markTooltip === true) { - markTooltip = {content: 'encoding'}; - } - - if (isString(markTooltip)) { - return {value: markTooltip}; - } else if (isObject(markTooltip)) { - // `tooltip` is `{fields: 'encodings' | 'fields'}` - if (isSignalRef(markTooltip)) { - return markTooltip; - } else if (markTooltip.content === 'encoding') { - return tooltipRefForEncoding(encoding, stack, config, opt); - } else { - return {signal: datum}; - } - } - - return undefined; - }); - } -} - -export function tooltipData( - encoding: Encoding, - stack: StackProperties, - config: Config, - {reactiveGeom}: {reactiveGeom?: boolean} = {} -) { - const toSkip = {}; - const expr = reactiveGeom ? 'datum.datum' : 'datum'; - const tuples: {channel: Channel; key: string; value: string}[] = []; - - function add(fDef: TypedFieldDef | SecondaryFieldDef, channel: Channel) { - const mainChannel = getMainRangeChannel(channel); - - const fieldDef: TypedFieldDef = isTypedFieldDef(fDef) - ? fDef - : { - ...fDef, - type: (encoding[mainChannel] as TypedFieldDef).type // for secondary field def, copy type from main channel - }; - - const title = fieldDef.title || defaultTitle(fieldDef, config); - const key = array(title).join(', '); - - let value: string; - - if (isXorY(channel)) { - const channel2 = channel === 'x' ? 'x2' : 'y2'; - const fieldDef2 = getFieldDef(encoding[channel2]); - - if (isBinned(fieldDef.bin) && fieldDef2) { - const startField = vgField(fieldDef, {expr}); - const endField = vgField(fieldDef2, {expr}); - const {format, formatType} = getFormatMixins(fieldDef); - value = binFormatExpression(startField, endField, format, formatType, config); - toSkip[channel2] = true; - } else if (stack && stack.fieldChannel === channel && stack.offset === 'normalize') { - const {format, formatType} = getFormatMixins(fieldDef); - value = formatSignalRef({fieldOrDatumDef: fieldDef, format, formatType, expr, config, normalizeStack: true}) - .signal; - } - } - - value = value ?? textRef(fieldDef, config, expr).signal; - - tuples.push({channel, key, value}); - } - - forEach(encoding, (channelDef, channel) => { - if (isFieldDef(channelDef)) { - add(channelDef, channel); - } else if (hasConditionalFieldDef(channelDef)) { - add(channelDef.condition, channel); - } - }); - - const out = {}; - for (const {channel, key, value} of tuples) { - if (!toSkip[channel] && !out[key]) { - out[key] = value; - } - } - - return out; -} - -export function tooltipRefForEncoding( - encoding: Encoding, - stack: StackProperties, - config: Config, - {reactiveGeom}: {reactiveGeom?: boolean} = {} -) { - const data = tooltipData(encoding, stack, config, {reactiveGeom}); - - const keyValues = entries(data).map(({key, value}) => `"${key}": ${value}`); - return keyValues.length > 0 ? {signal: `{${keyValues.join(', ')}}`} : undefined; -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/valueref.ts b/node_modules/vega-lite/src/compile/mark/encode/valueref.ts deleted file mode 100644 index f1a040e..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/valueref.ts +++ /dev/null @@ -1,340 +0,0 @@ -/** - * Utility files for producing Vega ValueRef for marks - */ -import {SignalRef} from 'vega'; -import {isFunction, isString} from 'vega-util'; -import {isCountingAggregateOp} from '../../../aggregate'; -import {isBinned, isBinning} from '../../../bin'; -import {Channel, getMainRangeChannel, PolarPositionChannel, PositionChannel, X, X2, Y2} from '../../../channel'; -import { - binRequiresRange, - ChannelDef, - DatumDef, - FieldDef, - FieldDefBase, - FieldName, - FieldRefOption, - getBand, - isDatumDef, - isFieldDef, - isFieldOrDatumDef, - isTypedFieldDef, - isValueDef, - SecondaryChannelDef, - SecondaryFieldDef, - TypedFieldDef, - Value, - vgField -} from '../../../channeldef'; -import {Config} from '../../../config'; -import {dateTimeToExpr, isDateTime} from '../../../datetime'; -import * as log from '../../../log'; -import {isPathMark, Mark, MarkDef} from '../../../mark'; -import {fieldValidPredicate} from '../../../predicate'; -import {hasDiscreteDomain, isContinuousToContinuous} from '../../../scale'; -import {StackProperties} from '../../../stack'; -import {TEMPORAL} from '../../../type'; -import {contains} from '../../../util'; -import {isSignalRef, VgValueRef} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; -import {ScaleComponent} from '../../scale/component'; - -export function midPointRefWithPositionInvalidTest( - params: MidPointParams & { - channel: PositionChannel | PolarPositionChannel; - } -) { - const {channel, channelDef, markDef, scale, config} = params; - const ref = midPoint(params); - - // Wrap to check if the positional value is invalid, if so, plot the point on the min value - if ( - // Only this for field def without counting aggregate (as count wouldn't be null) - isFieldDef(channelDef) && - !isCountingAggregateOp(channelDef.aggregate) && - // and only for continuous scale without zero (otherwise, null / invalid will be interpreted as zero, which doesn't cause layout problem) - scale && - isContinuousToContinuous(scale.get('type')) && - scale.get('zero') === false - ) { - return wrapPositionInvalidTest({ - fieldDef: channelDef, - channel, - markDef, - ref, - config - }); - } - return ref; -} - -export function wrapPositionInvalidTest({ - fieldDef, - channel, - markDef, - ref, - config -}: { - fieldDef: FieldDef; - channel: PositionChannel | PolarPositionChannel; - markDef: MarkDef; - ref: VgValueRef; - config: Config; -}): VgValueRef | VgValueRef[] { - if (isPathMark(markDef.type)) { - // path mark already use defined to skip points, no need to do it here. - return ref; - } - - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid === null) { - // if there is no invalid filter, don't do the invalid test - return ref; - } - - return [fieldInvalidTestValueRef(fieldDef, channel), ref]; -} - -export function fieldInvalidTestValueRef(fieldDef: FieldDef, channel: PositionChannel | PolarPositionChannel) { - const test = fieldInvalidPredicate(fieldDef, true); - - const mainChannel = getMainRangeChannel(channel) as PositionChannel | PolarPositionChannel; // we can cast here as the output can't be other things. - const zeroValueRef = - mainChannel === 'y' - ? {field: {group: 'height'}} - : // x / angle / radius can all use 0 - {value: 0}; - - return {test, ...zeroValueRef}; -} - -export function fieldInvalidPredicate(field: FieldName | FieldDef, invalid = true) { - return fieldValidPredicate(isString(field) ? field : vgField(field, {expr: 'datum'}), !invalid); -} - -export function datumDefToExpr(datumDef: DatumDef) { - const {datum} = datumDef; - if (isDateTime(datum)) { - return dateTimeToExpr(datum); - } - return `${JSON.stringify(datum)}`; -} - -export function valueRefForFieldOrDatumDef( - fieldDef: FieldDefBase | DatumDef, - scaleName: string, - opt: FieldRefOption, - encode: {offset?: number | VgValueRef; band?: number | boolean} -): VgValueRef { - const ref: VgValueRef = {}; - - if (scaleName) { - ref.scale = scaleName; - } - - if (isDatumDef(fieldDef)) { - const {datum} = fieldDef; - if (isDateTime(datum)) { - ref.signal = dateTimeToExpr(datum); - } else if (isSignalRef(datum)) { - ref.signal = datum.signal; - } else { - ref.value = datum; - } - } else { - ref.field = vgField(fieldDef, opt); - } - - if (encode) { - const {offset, band} = encode; - if (offset) { - ref.offset = offset; - } - if (band) { - ref.band = band; - } - } - return ref; -} - -/** - * Signal that returns the middle of a bin from start and end field. Should only be used with x and y. - */ -export function interpolatedSignalRef({ - scaleName, - fieldOrDatumDef, - fieldOrDatumDef2, - offset, - startSuffix, - band = 0.5 -}: { - scaleName: string; - fieldOrDatumDef: TypedFieldDef; - fieldOrDatumDef2?: SecondaryFieldDef; - startSuffix?: string; - offset: number | SignalRef; - band: number; -}): VgValueRef { - const expr = 0 < band && band < 1 ? 'datum' : undefined; - const start = vgField(fieldOrDatumDef, {expr, suffix: startSuffix}); - const end = - fieldOrDatumDef2 !== undefined - ? vgField(fieldOrDatumDef2, {expr}) - : vgField(fieldOrDatumDef, {suffix: 'end', expr}); - - const ref: VgValueRef = {}; - - if (band === 0 || band === 1) { - ref.scale = scaleName; - const val = band === 0 ? start : end; - ref.field = val; - } else { - const datum = `${band} * ${start} + ${1 - band} * ${end}`; - ref.signal = `scale("${scaleName}", ${datum})`; - } - - if (offset) { - ref.offset = offset; - } - return ref; -} - -export interface MidPointParams { - channel: Channel; - channelDef: ChannelDef; - channel2Def?: SecondaryChannelDef; - - markDef: MarkDef; - config: Config; - - scaleName: string; - scale: ScaleComponent; - stack?: StackProperties; - offset?: number | SignalRef; - defaultRef: VgValueRef | (() => VgValueRef); - - /** - * Allow overriding band instead of reading to field def since band is applied to size (width/height) instead of the position for x/y-position with band scales. - */ - band?: number; -} - -/** - * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels. - */ -export function midPoint({ - channel, - channelDef, - channel2Def, - markDef, - config, - scaleName, - scale, - stack, - offset, - defaultRef, - band -}: MidPointParams): VgValueRef { - // TODO: datum support - if (channelDef) { - /* istanbul ignore else */ - - if (isFieldOrDatumDef(channelDef)) { - if (isTypedFieldDef(channelDef)) { - band = - band ?? - getBand({ - channel, - fieldDef: channelDef, - fieldDef2: channel2Def, - markDef, - stack, - config, - isMidPoint: true - }); - const {bin, timeUnit, type} = channelDef; - - if (isBinning(bin) || (band && timeUnit && type === TEMPORAL)) { - // Use middle only for x an y to place marks in the center between start and end of the bin range. - // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match. - if (stack && stack.impute) { - // For stack, we computed bin_mid so we can impute. - return valueRefForFieldOrDatumDef(channelDef, scaleName, {binSuffix: 'mid'}, {offset}); - } - if (band) { - // if band = 0, no need to call interpolation - // For non-stack, we can just calculate bin mid on the fly using signal. - return interpolatedSignalRef({scaleName, fieldOrDatumDef: channelDef, band, offset}); - } - return valueRefForFieldOrDatumDef( - channelDef, - scaleName, - binRequiresRange(channelDef, channel) ? {binSuffix: 'range'} : {}, - { - offset - } - ); - } else if (isBinned(bin)) { - if (isFieldDef(channel2Def)) { - return interpolatedSignalRef({ - scaleName, - fieldOrDatumDef: channelDef, - fieldOrDatumDef2: channel2Def, - band, - offset - }); - } else { - const channel2 = channel === X ? X2 : Y2; - log.warn(log.message.channelRequiredForBinned(channel2)); - } - } - } - - const scaleType = scale?.get('type'); - return valueRefForFieldOrDatumDef( - channelDef, - scaleName, - hasDiscreteDomain(scaleType) ? {binSuffix: 'range'} : {}, // no need for bin suffix if there is no scale - { - offset, - // For band, to get mid point, need to offset by half of the band - band: scaleType === 'band' ? band ?? channelDef.band ?? 0.5 : undefined - } - ); - } else if (isValueDef(channelDef)) { - const value = channelDef.value; - const offsetMixins = offset ? {offset} : {}; - - return {...widthHeightValueOrSignalRef(channel, value), ...offsetMixins}; - } - - // If channelDef is neither field def or value def, it's a condition-only def. - // In such case, we will use default ref. - } - - if (isFunction(defaultRef)) { - defaultRef = defaultRef(); - } - - if (defaultRef) { - // for non-position, ref could be undefined. - return { - ...defaultRef, - // only include offset when it is non-zero (zero = no offset) - ...(offset ? {offset} : {}) - }; - } - return defaultRef; -} - -/** - * Convert special "width" and "height" values in Vega-Lite into Vega value ref. - */ -export function widthHeightValueOrSignalRef(channel: Channel, value: Value | SignalRef) { - if (contains(['x', 'x2'], channel) && value === 'width') { - return {field: {group: 'width'}}; - } else if (contains(['y', 'y2'], channel) && value === 'height') { - return {field: {group: 'height'}}; - } - return signalOrValueRef(value); -} diff --git a/node_modules/vega-lite/src/compile/mark/encode/zindex.ts b/node_modules/vega-lite/src/compile/mark/encode/zindex.ts deleted file mode 100644 index 12d6f12..0000000 --- a/node_modules/vega-lite/src/compile/mark/encode/zindex.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {isValueDef} from '../../../channeldef'; -import {isPathMark} from '../../../mark'; -import {UnitModel} from '../../unit'; -import {wrapCondition} from './conditional'; - -export function zindex(model: UnitModel) { - const {encoding, mark} = model; - const order = encoding.order; - - if (!isPathMark(mark) && isValueDef(order)) { - return wrapCondition(model, order, 'zindex', cd => cd); - } - return {}; -} diff --git a/node_modules/vega-lite/src/compile/mark/geoshape.ts b/node_modules/vega-lite/src/compile/mark/geoshape.ts deleted file mode 100644 index 6a1540b..0000000 --- a/node_modules/vega-lite/src/compile/mark/geoshape.ts +++ /dev/null @@ -1,37 +0,0 @@ -import {GeoShapeTransform as VgGeoShapeTransform} from 'vega'; -import {isFieldDef, vgField} from '../../channeldef'; -import {GEOJSON} from '../../type'; -import {VgPostEncodingTransform} from '../../vega.schema'; -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const geoshape: MarkCompiler = { - vgMark: 'shape', - encodeEntry: (model: UnitModel) => { - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - }) - }; - }, - postEncodingTransform: (model: UnitModel): VgPostEncodingTransform[] => { - const {encoding} = model; - const shapeDef = encoding.shape; - - const transform: VgGeoShapeTransform = { - type: 'geoshape', - projection: model.projectionName(), - // as: 'shape', - ...(shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON - ? {field: vgField(shapeDef, {expr: 'datum'})} - : {}) - }; - return [transform]; - } -}; diff --git a/node_modules/vega-lite/src/compile/mark/image.ts b/node_modules/vega-lite/src/compile/mark/image.ts deleted file mode 100644 index d1ed678..0000000 --- a/node_modules/vega-lite/src/compile/mark/image.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const image: MarkCompiler = { - vgMark: 'image', - encodeEntry: (model: UnitModel) => { - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'ignore', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - }), - ...encode.rectPosition(model, 'x', 'image'), - ...encode.rectPosition(model, 'y', 'image'), - ...encode.text(model, 'url') - }; - } -}; diff --git a/node_modules/vega-lite/src/compile/mark/init.ts b/node_modules/vega-lite/src/compile/mark/init.ts deleted file mode 100644 index 6313e55..0000000 --- a/node_modules/vega-lite/src/compile/mark/init.ts +++ /dev/null @@ -1,216 +0,0 @@ -import {Orientation} from 'vega'; -import {isBinned, isBinning} from '../../bin'; -import {isContinuousFieldOrDatumDef, isFieldDef, isNumericDataDef, TypedFieldDef} from '../../channeldef'; -import {Config} from '../../config'; -import {Encoding, isAggregate} from '../../encoding'; -import * as log from '../../log'; -import { - AREA, - BAR, - BAR_CORNER_RADIUS_INDEX as BAR_CORNER_RADIUS_END_INDEX, - CIRCLE, - IMAGE, - LINE, - Mark, - MarkDef, - POINT, - RECT, - RULE, - SQUARE, - TEXT, - TICK -} from '../../mark'; -import {QUANTITATIVE, TEMPORAL} from '../../type'; -import {contains, getFirstDefined} from '../../util'; -import {getMarkConfig, getMarkPropOrConfig} from '../common'; - -export function initMarkdef(markDef: MarkDef, encoding: Encoding, config: Config) { - // set orient, which can be overridden by rules as sometimes the specified orient is invalid. - const specifiedOrient = getMarkPropOrConfig('orient', markDef, config); - markDef.orient = orient(markDef.type, encoding, specifiedOrient); - if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) { - log.warn(log.message.orientOverridden(markDef.orient, specifiedOrient)); - } - - if (markDef.type === 'bar' && markDef.orient) { - const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config); - if (cornerRadiusEnd !== undefined) { - const newProps = - (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2) - ? ['cornerRadius'] - : BAR_CORNER_RADIUS_END_INDEX[markDef.orient]; - - for (const newProp of newProps) { - markDef[newProp] = cornerRadiusEnd; - } - - if (markDef.cornerRadiusEnd !== undefined) { - delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius - } - } - } - - // set opacity and filled if not specified in mark config - const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config); - if (specifiedOpacity === undefined) { - markDef.opacity = opacity(markDef.type, encoding); - } - - // set cursor, which should be pointer if href channel is present unless otherwise specified - const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config); - if (specifiedCursor === undefined) { - markDef.cursor = cursor(markDef, encoding, config); - } - - return markDef; -} - -function cursor(markDef: MarkDef, encoding: Encoding, config: Config) { - if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) { - return 'pointer'; - } - return markDef.cursor; -} - -function opacity(mark: Mark, encoding: Encoding) { - if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) { - // point-based marks - if (!isAggregate(encoding)) { - return 0.7; - } - } - return undefined; -} - -export function defaultFilled(markDef: MarkDef, config: Config, {graticule}: {graticule: boolean}) { - if (graticule) { - return false; - } - const filledConfig = getMarkConfig('filled', markDef, config); - const mark = markDef.type; - return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE); -} - -function orient(mark: Mark, encoding: Encoding, specifiedOrient: Orientation): Orientation { - switch (mark) { - case POINT: - case CIRCLE: - case SQUARE: - case TEXT: - case RECT: - case IMAGE: - // orient is meaningless for these marks. - return undefined; - } - - const {x, y, x2, y2} = encoding; - - switch (mark) { - case BAR: - if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) { - return 'vertical'; - } - if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) { - return 'horizontal'; - } - if (y2 || x2) { - // Ranged bar does not always have clear orientation, so we allow overriding - if (specifiedOrient) { - return specifiedOrient; - } - - // If y is range and x is non-range, non-bin Q, y is likely a prebinned field - if (!x2) { - if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) { - return 'horizontal'; - } - } - - // If x is range and y is non-range, non-bin Q, x is likely a prebinned field - if (!y2) { - if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) { - return 'vertical'; - } - } - } - - // falls through - case RULE: - // return undefined for line segment rule and bar with both axis ranged - // we have to ignore the case that the data are already binned - if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) { - return undefined; - } - - // falls through - case AREA: - // If there are range for both x and y, y (vertical) has higher precedence. - if (y2) { - if (isFieldDef(y) && isBinned(y.bin)) { - return 'horizontal'; - } else { - return 'vertical'; - } - } else if (x2) { - if (isFieldDef(x) && isBinned(x.bin)) { - return 'vertical'; - } else { - return 'horizontal'; - } - } else if (mark === RULE) { - if (x && !y) { - return 'vertical'; - } else if (y && !x) { - return 'horizontal'; - } - } - - // falls through - case LINE: - case TICK: { - // Tick is opposite to bar, line, area and never have ranged mark. - const xIsContinuous = isContinuousFieldOrDatumDef(x); - const yIsContinuous = isContinuousFieldOrDatumDef(y); - if (xIsContinuous && !yIsContinuous) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } else if (!xIsContinuous && yIsContinuous) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } else if (xIsContinuous && yIsContinuous) { - const xDef = x as TypedFieldDef; // we can cast here since they are surely fieldDef - const yDef = y as TypedFieldDef; - - const xIsTemporal = xDef.type === TEMPORAL; - const yIsTemporal = yDef.type === TEMPORAL; - - // temporal without timeUnit is considered continuous, but better serves as dimension - if (xIsTemporal && !yIsTemporal) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } else if (!xIsTemporal && yIsTemporal) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - - if (!xDef.aggregate && yDef.aggregate) { - return mark !== 'tick' ? 'vertical' : 'horizontal'; - } else if (xDef.aggregate && !yDef.aggregate) { - return mark !== 'tick' ? 'horizontal' : 'vertical'; - } - - if (specifiedOrient) { - // When ambiguous, use user specified one. - return specifiedOrient; - } - - return 'vertical'; - } else { - // Discrete x Discrete case - if (specifiedOrient) { - // When ambiguous, use user specified one. - return specifiedOrient; - } - - return undefined; - } - } - } - return 'vertical'; -} diff --git a/node_modules/vega-lite/src/compile/mark/line.ts b/node_modules/vega-lite/src/compile/mark/line.ts deleted file mode 100644 index 09e1b3a..0000000 --- a/node_modules/vega-lite/src/compile/mark/line.ts +++ /dev/null @@ -1,45 +0,0 @@ -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const line: MarkCompiler = { - vgMark: 'line', - encodeEntry: (model: UnitModel) => { - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'ignore' - }), - ...encode.pointPosition('x', model, {defaultPos: 'mid'}), - ...encode.pointPosition('y', model, {defaultPos: 'mid'}), - ...encode.nonPosition('size', model, { - vgChannel: 'strokeWidth' // VL's line size is strokeWidth - }), - ...encode.defined(model) - }; - } -}; - -export const trail: MarkCompiler = { - vgMark: 'trail', - encodeEntry: (model: UnitModel) => { - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'include', - orient: 'ignore', - theta: 'ignore' - }), - ...encode.pointPosition('x', model, {defaultPos: 'mid'}), - ...encode.pointPosition('y', model, {defaultPos: 'mid'}), - ...encode.nonPosition('size', model), - ...encode.defined(model) - }; - } -}; diff --git a/node_modules/vega-lite/src/compile/mark/mark.ts b/node_modules/vega-lite/src/compile/mark/mark.ts deleted file mode 100644 index 9b60b96..0000000 --- a/node_modules/vega-lite/src/compile/mark/mark.ts +++ /dev/null @@ -1,369 +0,0 @@ -import {isArray} from 'vega-util'; -import {FieldRefOption, isFieldDef, isValueDef, vgField} from '../../channeldef'; -import {DataSourceType} from '../../data'; -import {isAggregate, pathGroupingFields} from '../../encoding'; -import {AREA, BAR, isPathMark, LINE, Mark, TRAIL} from '../../mark'; -import {isSortByEncoding, isSortField} from '../../sort'; -import {contains, getFirstDefined, isNullOrFalse, keys, omit, pick} from '../../util'; -import {VgCompare, VgEncodeEntry, VG_CORNERRADIUS_CHANNELS} from '../../vega.schema'; -import {getMarkConfig, getMarkPropOrConfig, getStyles, signalOrValueRef, sortParams} from '../common'; -import {UnitModel} from '../unit'; -import {arc} from './arc'; -import {area} from './area'; -import {bar} from './bar'; -import {MarkCompiler} from './base'; -import {geoshape} from './geoshape'; -import {image} from './image'; -import {line, trail} from './line'; -import {circle, point, square} from './point'; -import {rect} from './rect'; -import {rule} from './rule'; -import {text} from './text'; -import {tick} from './tick'; - -const markCompiler: Record = { - arc, - area, - bar, - circle, - geoshape, - image, - line, - point, - rect, - rule, - square, - text, - tick, - trail -}; - -export function parseMarkGroups(model: UnitModel): any[] { - if (contains([LINE, AREA, TRAIL], model.mark)) { - const details = pathGroupingFields(model.mark, model.encoding); - if (details.length > 0) { - return getPathGroups(model, details); - } - // otherwise use standard mark groups - } else if (contains([BAR], model.mark)) { - const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop => - getMarkPropOrConfig(prop, model.markDef, model.config) - ); - if (model.stack && !model.fieldDef('size') && hasCornerRadius) { - return getGroupsForStackedBarWithCornerRadius(model); - } - } - - return getMarkGroup(model); -} - -const FACETED_PATH_PREFIX = 'faceted_path_'; - -function getPathGroups(model: UnitModel, details: string[]) { - // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?) - - return [ - { - name: model.getName('pathgroup'), - type: 'group', - from: { - facet: { - name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main), - data: model.requestDataName(DataSourceType.Main), - groupby: details - } - }, - encode: { - update: { - width: {field: {group: 'width'}}, - height: {field: {group: 'height'}} - } - }, - // With subfacet for line/area group, need to use faceted data from above. - marks: getMarkGroup(model, {fromPrefix: FACETED_PATH_PREFIX}) - } - ]; -} - -const STACK_GROUP_PREFIX = 'stack_group_'; - -/** - * We need to put stacked bars into groups in order to enable cornerRadius for stacks. - * If stack is used and the model doesn't have size encoding, we put the mark into groups, - * and apply cornerRadius properties at the group. - */ -function getGroupsForStackedBarWithCornerRadius(model: UnitModel) { - // Generate the mark - const [mark] = getMarkGroup(model, {fromPrefix: STACK_GROUP_PREFIX}); - - // Get the scale for the stacked field - const fieldScale = model.scaleName(model.stack.fieldChannel); - const stackField = (opt: FieldRefOption = {}) => model.vgField(model.stack.fieldChannel, opt); - // Find the min/max of the pixel value on the stacked direction - const stackFieldGroup = (func: 'min' | 'max', expr: 'datum' | 'parent') => { - const vgFieldMinMax = [ - stackField({prefix: 'min', suffix: 'start', expr}), - stackField({prefix: 'max', suffix: 'start', expr}), - stackField({prefix: 'min', suffix: 'end', expr}), - stackField({prefix: 'max', suffix: 'end', expr}) - ]; - return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`; - }; - - let groupUpdate: VgEncodeEntry; - let innerGroupUpdate: VgEncodeEntry; - - // Build the encoding for group and an inner group - if (model.stack.fieldChannel === 'x') { - // Move cornerRadius, y/yc/y2/height properties to group - // Group x/x2 should be the min/max of the marks within - groupUpdate = { - ...pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS]), - x: {signal: stackFieldGroup('min', 'datum')}, - x2: {signal: stackFieldGroup('max', 'datum')}, - clip: {value: true} - }; - // Inner group should revert the x translation, and pass height through - innerGroupUpdate = { - x: {field: {group: 'x'}, mult: -1}, - height: {field: {group: 'height'}} - }; - // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group) - // This is why size encoding is not supported yet - mark.encode.update = { - ...omit(mark.encode.update, ['y', 'yc', 'y2']), - height: {field: {group: 'height'}} - }; - } else { - groupUpdate = { - ...pick(mark.encode.update, ['x', 'xc', 'x2', 'width']), - y: {signal: stackFieldGroup('min', 'datum')}, - y2: {signal: stackFieldGroup('max', 'datum')}, - clip: {value: true} - }; - innerGroupUpdate = { - y: {field: {group: 'y'}, mult: -1}, - width: {field: {group: 'width'}} - }; - mark.encode.update = { - ...omit(mark.encode.update, ['x', 'xc', 'x2']), - width: {field: {group: 'width'}} - }; - } - - // Deal with cornerRadius properties - for (const key of VG_CORNERRADIUS_CHANNELS) { - const configValue = getMarkConfig(key, model.markDef, model.config); - // Move from mark to group - if (mark.encode.update[key]) { - groupUpdate[key] = mark.encode.update[key]; - delete mark.encode.update[key]; - } else if (configValue) { - groupUpdate[key] = signalOrValueRef(configValue); - } - // Overwrite any cornerRadius on mark set by config --- they are already moved to the group - if (configValue) { - mark.encode.update[key] = {value: 0}; - } - } - - // For bin and time unit, we have to add bin/timeunit -end channels. - const groupByField = model.fieldDef(model.stack.groupbyChannel); - const groupby: string[] = vgField(groupByField) ? [vgField(groupByField)] : []; - - if (groupByField?.bin || groupByField?.timeUnit) { - groupby.push(vgField(groupByField, {binSuffix: 'end'})); - } - - const strokeProperties = [ - 'stroke', - 'strokeWidth', - 'strokeJoin', - 'strokeCap', - 'strokeDash', - 'strokeDashOffset', - 'strokeMiterLimit', - 'strokeOpacity' - ] as const; - - // Generate stroke properties for the group - groupUpdate = strokeProperties.reduce((encode, prop) => { - if (mark.encode.update[prop]) { - return {...encode, [prop]: mark.encode.update[prop]}; - } else { - const configValue = getMarkConfig(prop, model.markDef, model.config); - if (configValue !== undefined) { - return {...encode, [prop]: signalOrValueRef(configValue)}; - } else { - return encode; - } - } - }, groupUpdate); - - // Apply strokeForeground and strokeOffset if stroke is used - if (groupUpdate.stroke) { - groupUpdate.strokeForeground = {value: true}; - groupUpdate.strokeOffset = {value: 0}; - } - - return [ - { - type: 'group', - from: { - facet: { - data: model.requestDataName(DataSourceType.Main), - name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main), - groupby, - aggregate: { - fields: [ - stackField({suffix: 'start'}), - stackField({suffix: 'start'}), - stackField({suffix: 'end'}), - stackField({suffix: 'end'}) - ], - ops: ['min', 'max', 'min', 'max'] - } - } - }, - encode: { - update: groupUpdate - }, - marks: [ - { - type: 'group', - encode: {update: innerGroupUpdate}, - marks: [mark] - } - ] - } - ]; -} - -export function getSort(model: UnitModel): VgCompare { - const {encoding, stack, mark, markDef, config} = model; - const order = encoding.order; - if ( - (!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) || - (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config))) - ) { - return undefined; - } else if ((isArray(order) || isFieldDef(order)) && !stack) { - // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.) - return sortParams(order, {expr: 'datum'}); - } else if (isPathMark(mark)) { - // For both line and area, we sort values based on dimension by default - const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; - const dimensionChannelDef = encoding[dimensionChannel]; - if (isFieldDef(dimensionChannelDef)) { - const s = dimensionChannelDef.sort; - - if (isArray(s)) { - return { - field: vgField(dimensionChannelDef, {prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum'}) - }; - } else if (isSortField(s)) { - return { - field: vgField( - { - // FIXME: this op might not already exist? - // FIXME: what if dimensionChannel (x or y) contains custom domain? - aggregate: isAggregate(model.encoding) ? s.op : undefined, - field: s.field - }, - {expr: 'datum'} - ) - }; - } else if (isSortByEncoding(s)) { - const fieldDefToSort = model.fieldDef(s.encoding); - return { - field: vgField(fieldDefToSort, {expr: 'datum'}), - order: s.order - }; - } else if (s === null) { - return undefined; - } else { - return { - field: vgField(dimensionChannelDef, { - // For stack with imputation, we only have bin_mid - binSuffix: model.stack && model.stack.impute ? 'mid' : undefined, - expr: 'datum' - }) - }; - } - } - return undefined; - } - return undefined; -} - -function getMarkGroup(model: UnitModel, opt: {fromPrefix: string} = {fromPrefix: ''}) { - const {mark, markDef, encoding, config} = model; - - const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model)); - const style = getStyles(markDef); - const key = encoding.key; - const sort = getSort(model); - const interactive = interactiveFlag(model); - const aria = getMarkPropOrConfig('aria', markDef, config); - - const postEncodingTransform = markCompiler[mark].postEncodingTransform - ? markCompiler[mark].postEncodingTransform(model) - : null; - - return [ - { - name: model.getName('marks'), - type: markCompiler[mark].vgMark, - ...(clip ? {clip: true} : {}), - ...(style ? {style} : {}), - ...(key ? {key: key.field} : {}), - ...(sort ? {sort} : {}), - ...(interactive ? interactive : {}), - ...(aria === false ? {aria} : {}), - from: {data: opt.fromPrefix + model.requestDataName(DataSourceType.Main)}, - encode: { - update: markCompiler[mark].encodeEntry(model) - }, - ...(postEncodingTransform - ? { - transform: postEncodingTransform - } - : {}) - } - ]; -} - -/** - * If scales are bound to interval selections, we want to automatically clip - * marks to account for panning/zooming interactions. We identify bound scales - * by the selectionExtent property, which gets added during scale parsing. - */ -function scaleClip(model: UnitModel) { - const xScale = model.getScaleComponent('x'); - const yScale = model.getScaleComponent('y'); - return (xScale && xScale.get('selectionExtent')) || (yScale && yScale.get('selectionExtent')) ? true : undefined; -} - -/** - * If we use a custom projection with auto-fitting to the geodata extent, - * we need to clip to ensure the chart size doesn't explode. - */ -function projectionClip(model: UnitModel) { - const projection = model.component.projection; - return projection && !projection.isFit ? true : undefined; -} - -/** - * Only output interactive flags if we have selections defined somewhere in our model hierarchy. - */ -function interactiveFlag(model: UnitModel) { - if (!model.component.selection) return null; - const unitCount = keys(model.component.selection).length; - let parentCount = unitCount; - let parent = model.parent; - while (parent && parentCount === 0) { - parentCount = keys(parent.component.selection).length; - parent = parent.parent; - } - return parentCount ? {interactive: unitCount > 0} : null; -} diff --git a/node_modules/vega-lite/src/compile/mark/point.ts b/node_modules/vega-lite/src/compile/mark/point.ts deleted file mode 100644 index 06d6744..0000000 --- a/node_modules/vega-lite/src/compile/mark/point.ts +++ /dev/null @@ -1,53 +0,0 @@ -import {Config} from '../../config'; -import {VgEncodeEntry} from '../../vega.schema'; -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -function encodeEntry(model: UnitModel, fixedShape?: 'circle' | 'square') { - const {config} = model; - - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - size: 'include', - orient: 'ignore', - theta: 'ignore' - }), - ...encode.pointPosition('x', model, {defaultPos: 'mid'}), - ...encode.pointPosition('y', model, {defaultPos: 'mid'}), - ...encode.nonPosition('size', model), - ...encode.nonPosition('angle', model), - ...shapeMixins(model, config, fixedShape) - }; -} - -export function shapeMixins(model: UnitModel, config: Config, fixedShape?: 'circle' | 'square'): VgEncodeEntry { - if (fixedShape) { - return {shape: {value: fixedShape}}; - } - return encode.nonPosition('shape', model); -} - -export const point: MarkCompiler = { - vgMark: 'symbol', - encodeEntry: (model: UnitModel) => { - return encodeEntry(model); - } -}; - -export const circle: MarkCompiler = { - vgMark: 'symbol', - encodeEntry: (model: UnitModel) => { - return encodeEntry(model, 'circle'); - } -}; - -export const square: MarkCompiler = { - vgMark: 'symbol', - encodeEntry: (model: UnitModel) => { - return encodeEntry(model, 'square'); - } -}; diff --git a/node_modules/vega-lite/src/compile/mark/rect.ts b/node_modules/vega-lite/src/compile/mark/rect.ts deleted file mode 100644 index 3199af0..0000000 --- a/node_modules/vega-lite/src/compile/mark/rect.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const rect: MarkCompiler = { - vgMark: 'rect', - encodeEntry: (model: UnitModel) => { - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - }), - ...encode.rectPosition(model, 'x', 'rect'), - ...encode.rectPosition(model, 'y', 'rect') - }; - } -}; diff --git a/node_modules/vega-lite/src/compile/mark/rule.ts b/node_modules/vega-lite/src/compile/mark/rule.ts deleted file mode 100644 index b93371f..0000000 --- a/node_modules/vega-lite/src/compile/mark/rule.ts +++ /dev/null @@ -1,40 +0,0 @@ -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const rule: MarkCompiler = { - vgMark: 'rule', - encodeEntry: (model: UnitModel) => { - const {markDef} = model; - const orient = markDef.orient; - - if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) { - // Show nothing if we have none of x, y, lat, and long. - return {}; - } - - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - }), - ...encode.pointOrRangePosition('x', model, { - defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid', - defaultPos2: 'zeroOrMin', - range: orient !== 'vertical' // include x2 for horizontal or line segment rule - }), - ...encode.pointOrRangePosition('y', model, { - defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid', - defaultPos2: 'zeroOrMin', - range: orient !== 'horizontal' // include y2 for vertical or line segment rule - }), - ...encode.nonPosition('size', model, { - vgChannel: 'strokeWidth' // VL's rule size is strokeWidth - }) - }; - } -}; diff --git a/node_modules/vega-lite/src/compile/mark/text.ts b/node_modules/vega-lite/src/compile/mark/text.ts deleted file mode 100644 index 2dc84db..0000000 --- a/node_modules/vega-lite/src/compile/mark/text.ts +++ /dev/null @@ -1,55 +0,0 @@ -import {Config} from '../../config'; -import {Encoding} from '../../encoding'; -import {MarkDef} from '../../mark'; -import {getMarkPropOrConfig} from '../common'; -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const text: MarkCompiler = { - vgMark: 'text', - - encodeEntry: (model: UnitModel) => { - const {config, encoding} = model; - - return { - ...encode.baseEncodeEntry(model, { - align: 'include', - baseline: 'include', - color: 'include', - size: 'ignore', - orient: 'ignore', - theta: 'include' - }), - ...encode.pointPosition('x', model, {defaultPos: 'mid'}), - ...encode.pointPosition('y', model, {defaultPos: 'mid'}), - ...encode.text(model), - ...encode.nonPosition('size', model, { - vgChannel: 'fontSize' // VL's text size is fontSize - }), - ...encode.nonPosition('angle', model), - ...encode.valueIfDefined('align', align(model.markDef, encoding, config)), - ...encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config)), - ...encode.pointPosition('radius', model, {defaultPos: null, isMidPoint: true}), - ...encode.pointPosition('theta', model, {defaultPos: null, isMidPoint: true}) - }; - } -}; - -function align(markDef: MarkDef, encoding: Encoding, config: Config) { - const a = getMarkPropOrConfig('align', markDef, config); - if (a === undefined) { - return 'center'; - } - // If there is a config, Vega-parser will process this already. - return undefined; -} - -function baseline(markDef: MarkDef, encoding: Encoding, config: Config) { - const b = getMarkPropOrConfig('baseline', markDef, config); - if (b === undefined) { - return 'middle'; - } - // If there is a config, Vega-parser will process this already. - return undefined; -} diff --git a/node_modules/vega-lite/src/compile/mark/tick.ts b/node_modules/vega-lite/src/compile/mark/tick.ts deleted file mode 100644 index 782b229..0000000 --- a/node_modules/vega-lite/src/compile/mark/tick.ts +++ /dev/null @@ -1,65 +0,0 @@ -import {SignalRef} from 'vega'; -import {isNumber} from 'vega-util'; -import {getViewConfigDiscreteStep} from '../../config'; -import {isVgRangeStep} from '../../vega.schema'; -import {getMarkPropOrConfig, signalOrValueRef} from '../common'; -import {UnitModel} from '../unit'; -import {MarkCompiler} from './base'; -import * as encode from './encode'; - -export const tick: MarkCompiler = { - vgMark: 'rect', - - encodeEntry: (model: UnitModel) => { - const {config, markDef} = model; - const orient = markDef.orient; - - const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; - const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width'; - - return { - ...encode.baseEncodeEntry(model, { - align: 'ignore', - baseline: 'ignore', - color: 'include', - orient: 'ignore', - size: 'ignore', - theta: 'ignore' - }), - - ...encode.pointPosition('x', model, {defaultPos: 'mid', vgChannel: 'xc'}), - ...encode.pointPosition('y', model, {defaultPos: 'mid', vgChannel: 'yc'}), - - // size / thickness => width / height - ...encode.nonPosition('size', model, { - defaultValue: defaultSize(model), - vgChannel: vgSizeChannel - }), - [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config)) - }; - } -}; - -function defaultSize(model: UnitModel): number | SignalRef { - const {config, markDef} = model; - const {orient} = markDef; - - const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; - const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y'); - - const markPropOrConfig = - getMarkPropOrConfig('size', markDef, config, {vgChannel: vgSizeChannel}) ?? config.tick.bandSize; - - if (markPropOrConfig !== undefined) { - return markPropOrConfig; - } else { - const scaleRange = scale ? scale.get('range') : undefined; - if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { - return (scaleRange.step * 3) / 4; - } - - const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel); - - return (defaultViewStep * 3) / 4; - } -} diff --git a/node_modules/vega-lite/src/compile/model.ts b/node_modules/vega-lite/src/compile/model.ts deleted file mode 100644 index d0bbc58..0000000 --- a/node_modules/vega-lite/src/compile/model.ts +++ /dev/null @@ -1,708 +0,0 @@ -import { - AnchorValue, - Axis as VgAxis, - Legend as VgLegend, - NewSignal, - Projection as VgProjection, - SignalRef, - Title as VgTitle -} from 'vega'; -import { - Channel, - FACET_CHANNELS, - getPositionScaleChannel, - isChannel, - isScaleChannel, - ScaleChannel, - SingleDefChannel, - ExtendedChannel -} from '../channel'; -import {ChannelDef, FieldDef, FieldRefOption, getFieldDef, vgField} from '../channeldef'; -import {Config} from '../config'; -import {Data, DataSourceType} from '../data'; -import {forEach, reduce} from '../encoding'; -import * as log from '../log'; -import {Resolve} from '../resolve'; -import {hasDiscreteDomain} from '../scale'; -import {isFacetSpec} from '../spec'; -import { - extractCompositionLayout, - GenericCompositionLayoutWithColumns, - LayoutSizeMixins, - SpecType, - ViewBackground -} from '../spec/base'; -import {NormalizedSpec} from '../spec/index'; -import {extractTitleConfig, isText, TitleParams} from '../title'; -import {normalizeTransform, Transform} from '../transform'; -import {contains, Dict, duplicate, keys, varName, isEmpty} from '../util'; -import {isVgRangeStep, VgData, VgEncodeEntry, VgLayout, VgMarkGroup} from '../vega.schema'; -import {assembleAxes} from './axis/assemble'; -import {AxisComponentIndex} from './axis/component'; -import {signalOrValueRef} from './common'; -import {ConcatModel} from './concat'; -import {DataComponent} from './data'; -import {FacetModel} from './facet'; -import {assembleHeaderGroups, assembleLayoutTitleBand, assembleTitleGroup} from './header/assemble'; -import {HEADER_CHANNELS, LayoutHeaderComponent} from './header/component'; -import {LayerModel} from './layer'; -import {sizeExpr} from './layoutsize/assemble'; -import { - getSizeTypeFromLayoutSizeType, - LayoutSizeComponent, - LayoutSizeIndex, - LayoutSizeType -} from './layoutsize/component'; -import {assembleLegends} from './legend/assemble'; -import {LegendComponentIndex} from './legend/component'; -import {parseLegend} from './legend/parse'; -import {assembleProjections} from './projection/assemble'; -import {ProjectionComponent} from './projection/component'; -import {parseProjection} from './projection/parse'; -import {assembleScales} from './scale/assemble'; -import {ScaleComponent, ScaleComponentIndex} from './scale/component'; -import {assembleDomain, getFieldFromDomain} from './scale/domain'; -import {parseScales} from './scale/parse'; -import {SelectionComponent} from './selection'; -import {Split} from './split'; -import {UnitModel} from './unit'; - -/** - * Composable Components that are intermediate results of the parsing phase of the - * compilations. The components represents parts of the specification in a form that - * can be easily merged (during parsing for composite specs). - * In addition, these components are easily transformed into Vega specifications - * during the "assemble" phase, which is the last phase of the compilation step. - */ -export interface Component { - data: DataComponent; - - layoutSize: LayoutSizeComponent; - - layoutHeaders: { - row?: LayoutHeaderComponent; - column?: LayoutHeaderComponent; - facet?: LayoutHeaderComponent; - }; - - mark: VgMarkGroup[]; - scales: ScaleComponentIndex; - projection: ProjectionComponent; - selection: Dict; - - /** Dictionary mapping channel to VgAxis definition */ - axes: AxisComponentIndex; - - /** Dictionary mapping channel to VgLegend definition */ - legends: LegendComponentIndex; - - resolve: Resolve; -} - -export interface NameMapInterface { - rename(oldname: string, newName: string): void; - has(name: string): boolean; - get(name: string): string; -} - -export class NameMap implements NameMapInterface { - private nameMap: Dict; - - constructor() { - this.nameMap = {}; - } - - public rename(oldName: string, newName: string) { - this.nameMap[oldName] = newName; - } - - public has(name: string): boolean { - return this.nameMap[name] !== undefined; - } - - public get(name: string): string { - // If the name appears in the _nameMap, we need to read its new name. - // We have to loop over the dict just in case the new name also gets renamed. - while (this.nameMap[name] && name !== this.nameMap[name]) { - name = this.nameMap[name]; - } - - return name; - } -} - -/* - We use type guards instead of `instanceof` as `instanceof` makes - different parts of the compiler depend on the actual implementation of - the model classes, which in turn depend on different parts of the compiler. - Thus, `instanceof` leads to circular dependency problems. - - On the other hand, type guards only make different parts of the compiler - depend on the type of the model classes, but not the actual implementation. -*/ - -export function isUnitModel(model: Model): model is UnitModel { - return model?.type === 'unit'; -} - -export function isFacetModel(model: Model): model is FacetModel { - return model?.type === 'facet'; -} - -export function isConcatModel(model: Model): model is ConcatModel { - return model?.type === 'concat'; -} - -export function isLayerModel(model: Model): model is LayerModel { - return model?.type === 'layer'; -} - -export abstract class Model { - public readonly name: string; - - public size: LayoutSizeMixins; - - public readonly title: TitleParams; - public readonly description: string; - - public readonly data: Data | null; - public readonly transforms: Transform[]; - public readonly layout: GenericCompositionLayoutWithColumns; - - /** Name map for scales, which can be renamed by a model's parent. */ - protected scaleNameMap: NameMapInterface; - - /** Name map for projections, which can be renamed by a model's parent. */ - protected projectionNameMap: NameMapInterface; - - /** Name map for signals, which can be renamed by a model's parent. */ - protected signalNameMap: NameMapInterface; - - public readonly component: Component; - - public abstract readonly children: Model[] = []; - - constructor( - spec: NormalizedSpec, - public readonly type: SpecType, - public readonly parent: Model, - parentGivenName: string, - public readonly config: Config, - resolve: Resolve, - public readonly view?: ViewBackground - ) { - this.parent = parent; - this.config = config; - - // If name is not provided, always use parent's givenName to avoid name conflicts. - this.name = spec.name ?? parentGivenName; - this.title = isText(spec.title) ? {text: spec.title} : (spec.title as TitleParams); - - // Shared name maps - this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap(); - this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap(); - this.signalNameMap = parent ? parent.signalNameMap : new NameMap(); - - this.data = spec.data; - - this.description = spec.description; - this.transforms = normalizeTransform(spec.transform ?? []); - this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config); - - this.component = { - data: { - sources: parent ? parent.component.data.sources : [], - outputNodes: parent ? parent.component.data.outputNodes : {}, - outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {}, - // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined - isFaceted: isFacetSpec(spec) || (parent && parent.component.data.isFaceted && spec.data === undefined) - }, - layoutSize: new Split(), - layoutHeaders: {row: {}, column: {}, facet: {}}, - mark: null, - resolve: { - scale: {}, - axis: {}, - legend: {}, - ...(resolve ? duplicate(resolve) : {}) - }, - selection: null, - scales: null, - projection: null, - axes: {}, - legends: {} - }; - } - - public get width(): SignalRef { - return this.getSizeSignalRef('width'); - } - - public get height(): SignalRef { - return this.getSizeSignalRef('height'); - } - - public parse() { - this.parseScale(); - - this.parseLayoutSize(); // depends on scale - this.renameTopLevelLayoutSizeSignal(); - - this.parseSelections(); - this.parseProjection(); - this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name. - this.parseAxesAndHeaders(); // depends on scale and layout size - this.parseLegends(); // depends on scale, markDef - this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark. - } - - public abstract parseData(): void; - - public abstract parseSelections(): void; - - public parseScale() { - parseScales(this); - } - - public parseProjection() { - parseProjection(this); - } - - public abstract parseLayoutSize(): void; - - /** - * Rename top-level spec's size to be just width / height, ignoring model name. - * This essentially merges the top-level spec's width/height signals with the width/height signals - * to help us reduce redundant signals declaration. - */ - private renameTopLevelLayoutSizeSignal() { - if (this.getName('width') !== 'width') { - this.renameSignal(this.getName('width'), 'width'); - } - if (this.getName('height') !== 'height') { - this.renameSignal(this.getName('height'), 'height'); - } - } - - public abstract parseMarkGroup(): void; - - public abstract parseAxesAndHeaders(): void; - - public parseLegends() { - parseLegend(this); - } - - public abstract assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[]; - public abstract assembleSignals(): NewSignal[]; - - public abstract assembleSelectionData(data: readonly VgData[]): readonly VgData[]; - - public assembleGroupStyle(): string | string[] { - if (this.type === 'unit' || this.type === 'layer') { - return this.view?.style ?? 'cell'; - } - return undefined; - } - - private assembleEncodeFromView(view: ViewBackground): VgEncodeEntry { - // Exclude "style" - const {style: _, ...baseView} = view; - - const e: VgEncodeEntry = {}; - for (const property of keys(baseView)) { - const value = baseView[property]; - if (value !== undefined) { - e[property] = signalOrValueRef(value); - } - } - - return e; - } - - public assembleGroupEncodeEntry(isTopLevel: boolean): VgEncodeEntry { - let encodeEntry: VgEncodeEntry = {}; - if (this.view) { - encodeEntry = this.assembleEncodeFromView(this.view); - } - - if (!isTopLevel) { - // Descriptions are already added to the top-level description so we only need to add them to the inner views. - if (this.description) { - encodeEntry['description'] = signalOrValueRef(this.description); - } - - // For top-level spec, we can set the global width and height signal to adjust the group size. - // For other child specs, we have to manually set width and height in the encode entry. - if (this.type === 'unit' || this.type === 'layer') { - return { - width: this.getSizeSignalRef('width'), - height: this.getSizeSignalRef('height'), - ...(encodeEntry ?? {}) - }; - } - } - - return isEmpty(encodeEntry) ? undefined : encodeEntry; - } - - public assembleLayout(): VgLayout { - if (!this.layout) { - return undefined; - } - - const {spacing, ...layout} = this.layout; - - const {component, config} = this; - const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config); - - return { - padding: spacing, - ...this.assembleDefaultLayout(), - ...layout, - ...(titleBand ? {titleBand} : {}) - }; - } - - protected assembleDefaultLayout(): VgLayout { - return {}; - } - - public abstract assembleLayoutSignals(): NewSignal[]; - - public assembleHeaderMarks(): VgMarkGroup[] { - const {layoutHeaders} = this.component; - let headerMarks = []; - - for (const channel of FACET_CHANNELS) { - if (layoutHeaders[channel].title) { - headerMarks.push(assembleTitleGroup(this, channel)); - } - } - - for (const channel of HEADER_CHANNELS) { - headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel)); - } - return headerMarks; - } - - public abstract assembleMarks(): VgMarkGroup[]; - - public assembleAxes(): VgAxis[] { - return assembleAxes(this.component.axes, this.config); - } - - public assembleLegends(): VgLegend[] { - return assembleLegends(this); - } - - public assembleProjections(): VgProjection[] { - return assembleProjections(this); - } - - public assembleTitle(): VgTitle { - const {encoding, ...titleNoEncoding} = this.title ?? ({} as TitleParams); - - const title: VgTitle = { - ...extractTitleConfig(this.config.title).nonMark, - ...titleNoEncoding, - ...(encoding ? {encode: {update: encoding}} : {}) - }; - - if (title.text) { - if (contains(['unit', 'layer'], this.type)) { - // Unit/Layer - if (contains(['middle', undefined], title.anchor)) { - title.frame = title.frame ?? 'group'; - } - } else { - // composition with Vega layout - - // Set title = "start" by default for composition as "middle" does not look nice - // https://github.com/vega/vega/issues/960#issuecomment-471360328 - title.anchor = title.anchor ?? 'start'; - } - - return isEmpty(title) ? undefined : title; - } - return undefined; - } - - /** - * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals. - */ - public assembleGroup(signals: NewSignal[] = []) { - const group: VgMarkGroup = {}; - - signals = signals.concat(this.assembleSignals()); - - if (signals.length > 0) { - group.signals = signals; - } - - const layout = this.assembleLayout(); - if (layout) { - group.layout = layout; - } - - group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks()); - - // Only include scales if this spec is top-level or if parent is facet. - // (Otherwise, it will be merged with upper-level's scope.) - const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : []; - if (scales.length > 0) { - group.scales = scales; - } - - const axes = this.assembleAxes(); - if (axes.length > 0) { - group.axes = axes; - } - - const legends = this.assembleLegends(); - if (legends.length > 0) { - group.legends = legends; - } - - return group; - } - - public getName(text: string) { - return varName((this.name ? this.name + '_' : '') + text); - } - - public getDataName(type: DataSourceType) { - return this.getName(DataSourceType[type].toLowerCase()); - } - - /** - * Request a data source name for the given data source type and mark that data source as required. - * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData(). - * You can lookup the correct dataset name in assemble with `lookupDataSource`. - */ - public requestDataName(name: DataSourceType) { - const fullName = this.getDataName(name); - - // Increase ref count. This is critical because otherwise we won't create a data source. - // We also increase the ref counts on OutputNode.getSource() calls. - const refCounts = this.component.data.outputNodeRefCounts; - refCounts[fullName] = (refCounts[fullName] || 0) + 1; - - return fullName; - } - - public getSizeSignalRef(layoutSizeType: LayoutSizeType): SignalRef { - if (isFacetModel(this.parent)) { - const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); - const channel = getPositionScaleChannel(sizeType); - const scaleComponent = this.component.scales[channel]; - - if (scaleComponent && !scaleComponent.merged) { - // independent scale - const type = scaleComponent.get('type'); - const range = scaleComponent.get('range'); - - if (hasDiscreteDomain(type) && isVgRangeStep(range)) { - const scaleName = scaleComponent.get('name'); - const domain = assembleDomain(this, channel); - const field = getFieldFromDomain(domain); - if (field) { - const fieldRef = vgField({aggregate: 'distinct', field}, {expr: 'datum'}); - return { - signal: sizeExpr(scaleName, scaleComponent, fieldRef) - }; - } else { - log.warn(log.message.unknownField(channel)); - return null; - } - } - } - } - - return { - signal: this.signalNameMap.get(this.getName(layoutSizeType)) - }; - } - - /** - * Lookup the name of the datasource for an output node. You probably want to call this in assemble. - */ - public lookupDataSource(name: string) { - const node = this.component.data.outputNodes[name]; - - if (!node) { - // Name not found in map so let's just return what we got. - // This can happen if we already have the correct name. - return name; - } - - return node.getSource(); - } - - public getSignalName(oldSignalName: string): string { - return this.signalNameMap.get(oldSignalName); - } - - public renameSignal(oldName: string, newName: string) { - this.signalNameMap.rename(oldName, newName); - } - - public renameScale(oldName: string, newName: string) { - this.scaleNameMap.rename(oldName, newName); - } - - public renameProjection(oldName: string, newName: string) { - this.projectionNameMap.rename(oldName, newName); - } - - /** - * @return scale name for a given channel after the scale has been parsed and named. - */ - public scaleName(originalScaleName: ScaleChannel | string, parse?: boolean): string { - if (parse) { - // During the parse phase always return a value - // No need to refer to rename map because a scale can't be renamed - // before it has the original name. - return this.getName(originalScaleName); - } - - // If there is a scale for the channel, it should either - // be in the scale component or exist in the name map - if ( - // If there is a scale for the channel, there should be a local scale component for it - (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) || - // in the scale name map (the scale get merged by its parent) - this.scaleNameMap.has(this.getName(originalScaleName)) - ) { - return this.scaleNameMap.get(this.getName(originalScaleName)); - } - return undefined; - } - - /** - * @return projection name after the projection has been parsed and named. - */ - public projectionName(parse?: boolean): string { - if (parse) { - // During the parse phase always return a value - // No need to refer to rename map because a projection can't be renamed - // before it has the original name. - return this.getName('projection'); - } - - if ( - (this.component.projection && !this.component.projection.merged) || - this.projectionNameMap.has(this.getName('projection')) - ) { - return this.projectionNameMap.get(this.getName('projection')); - } - return undefined; - } - - /** - * Corrects the data references in marks after assemble. - */ - public correctDataNames = (mark: VgMarkGroup) => { - // TODO: make this correct - - // for normal data references - if (mark.from && mark.from.data) { - mark.from.data = this.lookupDataSource(mark.from.data); - } - - // for access to facet data - if (mark.from && mark.from.facet && mark.from.facet.data) { - mark.from.facet.data = this.lookupDataSource(mark.from.facet.data); - } - - return mark; - }; - - /** - * Traverse a model's hierarchy to get the scale component for a particular channel. - */ - public getScaleComponent(channel: ScaleChannel): ScaleComponent { - /* istanbul ignore next: This is warning for debugging test */ - if (!this.component.scales) { - throw new Error( - 'getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().' - ); - } - - const localScaleComponent = this.component.scales[channel]; - if (localScaleComponent && !localScaleComponent.merged) { - return localScaleComponent; - } - return this.parent ? this.parent.getScaleComponent(channel) : undefined; - } - - /** - * Traverse a model's hierarchy to get a particular selection component. - */ - public getSelectionComponent(variableName: string, origName: string): SelectionComponent { - let sel = this.component.selection[variableName]; - if (!sel && this.parent) { - sel = this.parent.getSelectionComponent(variableName, origName); - } - if (!sel) { - throw new Error(log.message.selectionNotFound(origName)); - } - return sel; - } - - /** - * Returns true if the model has a signalRef for an axis orient. - */ - public hasAxisOrientSignalRef() { - return ( - this.component.axes.x?.some(a => a.hasOrientSignalRef()) || - this.component.axes.y?.some(a => a.hasOrientSignalRef()) - ); - } -} - -/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */ -export abstract class ModelWithField extends Model { - public abstract fieldDef(channel: SingleDefChannel): FieldDef; - - /** Get "field" reference for Vega */ - public vgField(channel: SingleDefChannel, opt: FieldRefOption = {}) { - const fieldDef = this.fieldDef(channel); - - if (!fieldDef) { - return undefined; - } - - return vgField(fieldDef, opt); - } - - protected abstract getMapping(): Partial>; - - public reduceFieldDef(f: (acc: U, fd: FieldDef, c: Channel) => U, init: T): T { - return reduce( - this.getMapping(), - (acc: U, cd: ChannelDef, c: Channel) => { - const fieldDef = getFieldDef(cd); - if (fieldDef) { - return f(acc, fieldDef, c); - } - return acc; - }, - init - ); - } - - public forEachFieldDef(f: (fd: FieldDef, c: ExtendedChannel) => void, t?: any) { - forEach( - this.getMapping(), - (cd, c) => { - const fieldDef = getFieldDef(cd); - if (fieldDef) { - f(fieldDef, c); - } - }, - t - ); - } - - public abstract channelHasField(channel: Channel): boolean; -} diff --git a/node_modules/vega-lite/src/compile/predicate.ts b/node_modules/vega-lite/src/compile/predicate.ts deleted file mode 100644 index cd84a26..0000000 --- a/node_modules/vega-lite/src/compile/predicate.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {isString} from 'vega-util'; -import {LogicalComposition} from '../logical'; -import {fieldFilterExpression, isSelectionPredicate, Predicate} from '../predicate'; -import {logicalExpr} from '../util'; -import {DataFlowNode} from './data/dataflow'; -import {Model} from './model'; -import {parseSelectionPredicate} from './selection/parse'; - -/** - * Converts a predicate into an expression. - */ -// model is only used for selection filters. -export function expression(model: Model, filterOp: LogicalComposition, node?: DataFlowNode): string { - return logicalExpr(filterOp, (predicate: Predicate) => { - if (isString(predicate)) { - return predicate; - } else if (isSelectionPredicate(predicate)) { - return parseSelectionPredicate(model, predicate.selection, node); - } else { - // Filter Object - return fieldFilterExpression(predicate); - } - }); -} diff --git a/node_modules/vega-lite/src/compile/projection/assemble.ts b/node_modules/vega-lite/src/compile/projection/assemble.ts deleted file mode 100644 index 74ab7fe..0000000 --- a/node_modules/vega-lite/src/compile/projection/assemble.ts +++ /dev/null @@ -1,70 +0,0 @@ -import {Projection as VgProjection, SignalRef} from 'vega'; -import {contains} from '../../util'; -import {isSignalRef} from '../../vega.schema'; -import {isConcatModel, isLayerModel, Model} from '../model'; - -export function assembleProjections(model: Model): VgProjection[] { - if (isLayerModel(model) || isConcatModel(model)) { - return assembleProjectionsForModelAndChildren(model); - } else { - return assembleProjectionForModel(model); - } -} - -export function assembleProjectionsForModelAndChildren(model: Model): VgProjection[] { - return model.children.reduce((projections, child) => { - return projections.concat(child.assembleProjections()); - }, assembleProjectionForModel(model)); -} - -export function assembleProjectionForModel(model: Model): VgProjection[] { - const component = model.component.projection; - if (!component || component.merged) { - return []; - } - - const projection = component.combine(); - const {name} = projection; // we need to extract name so that it is always present in the output and pass TS type validation - - if (!component.data) { - // generate custom projection, no automatic fitting - return [ - { - name, - // translate to center by default - ...{translate: {signal: '[width / 2, height / 2]'}}, - // parameters, overwrite default translate if specified - ...projection - } - ]; - } else { - // generate projection that uses extent fitting - const size: SignalRef = { - signal: `[${component.size.map(ref => ref.signal).join(', ')}]` - }; - - const fits: string[] = component.data.reduce((sources, data) => { - const source: string = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`; - if (!contains(sources, source)) { - // build a unique list of sources - sources.push(source); - } - return sources; - }, []); - - if (fits.length <= 0) { - throw new Error("Projection's fit didn't find any data sources"); - } - - return [ - { - name, - size, - fit: { - signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0] - }, - ...projection - } - ]; - } -} diff --git a/node_modules/vega-lite/src/compile/projection/component.ts b/node_modules/vega-lite/src/compile/projection/component.ts deleted file mode 100644 index 7373e46..0000000 --- a/node_modules/vega-lite/src/compile/projection/component.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {SignalRef} from 'vega'; -import {Projection} from '../../projection'; -import {Projection as VgProjection} from 'vega'; -import {Split} from '../split'; - -export class ProjectionComponent extends Split { - public merged = false; - - constructor( - name: string, - public specifiedProjection: Projection, - public size: SignalRef[], - public data: (string | SignalRef)[] - ) { - super( - {...specifiedProjection}, // all explicit properties of projection - {name} // name as initial implicit property - ); - } - - /** - * Whether the projection parameters should fit provided data. - */ - public get isFit() { - return !!this.data; - } -} diff --git a/node_modules/vega-lite/src/compile/projection/parse.ts b/node_modules/vega-lite/src/compile/projection/parse.ts deleted file mode 100644 index 0aaf013..0000000 --- a/node_modules/vega-lite/src/compile/projection/parse.ts +++ /dev/null @@ -1,159 +0,0 @@ -import {SignalRef} from 'vega'; -import {hasOwnProperty} from 'vega-util'; -import {LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel'; -import {getFieldOrDatumDef} from '../../channeldef'; -import {DataSourceType} from '../../data'; -import {PROJECTION_PROPERTIES} from '../../projection'; -import {GEOJSON} from '../../type'; -import {duplicate, every, stringify} from '../../util'; -import {isUnitModel, Model} from '../model'; -import {UnitModel} from '../unit'; -import {ProjectionComponent} from './component'; - -export function parseProjection(model: Model) { - model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model); -} - -function parseUnitProjection(model: UnitModel): ProjectionComponent { - if (model.hasProjection) { - const proj = model.specifiedProjection; - const fit = !(proj && (proj.scale != null || proj.translate != null)); - const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined; - const data = fit ? gatherFitData(model) : undefined; - - return new ProjectionComponent( - model.projectionName(true), - { - ...(model.config.projection ?? {}), - ...(proj ?? {}) - }, - size, - data - ); - } - - return undefined; -} - -function gatherFitData(model: UnitModel) { - const data: (SignalRef | string)[] = []; - - const {encoding} = model; - - for (const posssiblePair of [ - [LONGITUDE, LATITUDE], - [LONGITUDE2, LATITUDE2] - ]) { - if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) { - data.push({ - signal: model.getName(`geojson_${data.length}`) - }); - } - } - - if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) { - data.push({ - signal: model.getName(`geojson_${data.length}`) - }); - } - - if (data.length === 0) { - // main source is geojson, so we can just use that - data.push(model.requestDataName(DataSourceType.Main)); - } - - return data; -} - -function mergeIfNoConflict(first: ProjectionComponent, second: ProjectionComponent): ProjectionComponent { - const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => { - // neither has the property - if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) { - return true; - } - // both have property and an equal value for property - if ( - hasOwnProperty(first.explicit, prop) && - hasOwnProperty(second.explicit, prop) && - // some properties might be signals or objects and require hashing for comparison - stringify(first.get(prop)) === stringify(second.get(prop)) - ) { - return true; - } - return false; - }); - - const size = stringify(first.size) === stringify(second.size); - if (size) { - if (allPropertiesShared) { - return first; - } else if (stringify(first.explicit) === stringify({})) { - return second; - } else if (stringify(second.explicit) === stringify({})) { - return first; - } - } - - // if all properties don't match, let each unit spec have its own projection - return null; -} - -function parseNonUnitProjections(model: Model): ProjectionComponent { - if (model.children.length === 0) { - return undefined; - } - - let nonUnitProjection: ProjectionComponent; - - // parse all children first - for (const child of model.children) { - parseProjection(child); - } - - // analyze parsed projections, attempt to merge - const mergable = every(model.children, child => { - const projection = child.component.projection; - if (!projection) { - // child layer does not use a projection - return true; - } else if (!nonUnitProjection) { - // cached 'projection' is null, cache this one - nonUnitProjection = projection; - return true; - } else { - const merge = mergeIfNoConflict(nonUnitProjection, projection); - if (merge) { - nonUnitProjection = merge; - } - return !!merge; - } - }); - - // if cached one and all other children share the same projection, - if (nonUnitProjection && mergable) { - // so we can elevate it to the layer level - const name = model.projectionName(true); - const modelProjection = new ProjectionComponent( - name, - nonUnitProjection.specifiedProjection, - nonUnitProjection.size, - duplicate(nonUnitProjection.data) - ); - - // rename and assign all others as merged - for (const child of model.children) { - const projection = child.component.projection; - if (projection) { - if (projection.isFit) { - modelProjection.data.push(...child.component.projection.data); - } - child.renameProjection(projection.get('name'), name); - projection.merged = true; - } - } - - return modelProjection; - } - - return undefined; -} diff --git a/node_modules/vega-lite/src/compile/resolve.ts b/node_modules/vega-lite/src/compile/resolve.ts deleted file mode 100644 index 23de0f1..0000000 --- a/node_modules/vega-lite/src/compile/resolve.ts +++ /dev/null @@ -1,28 +0,0 @@ -import {isXorY, ScaleChannel} from '../channel'; -import * as log from '../log'; -import {Resolve, ResolveMode} from '../resolve'; -import {isConcatModel, isFacetModel, isLayerModel, Model} from './model'; - -export function defaultScaleResolve(channel: ScaleChannel, model: Model): ResolveMode { - if (isLayerModel(model) || isFacetModel(model)) { - return 'shared'; - } else if (isConcatModel(model)) { - return isXorY(channel) ? 'independent' : 'shared'; - } - /* istanbul ignore next: should never reach here. */ - throw new Error('invalid model type for resolve'); -} - -export function parseGuideResolve(resolve: Resolve, channel: ScaleChannel): ResolveMode { - const channelScaleResolve = resolve.scale[channel]; - const guide = isXorY(channel) ? 'axis' : 'legend'; - - if (channelScaleResolve === 'independent') { - if (resolve[guide][channel] === 'shared') { - log.warn(log.message.independentScaleMeansIndependentGuide(channel)); - } - return 'independent'; - } - - return resolve[guide][channel] || 'shared'; -} diff --git a/node_modules/vega-lite/src/compile/scale/assemble.ts b/node_modules/vega-lite/src/compile/scale/assemble.ts deleted file mode 100644 index 8e02567..0000000 --- a/node_modules/vega-lite/src/compile/scale/assemble.ts +++ /dev/null @@ -1,76 +0,0 @@ -import {isObject} from 'vega-util'; -import {isXorY, ScaleChannel} from '../../channel'; -import {keys} from '../../util'; -import {isDataRefDomain, isVgRangeStep, VgRange, VgScale} from '../../vega.schema'; -import {isConcatModel, isLayerModel, Model} from '../model'; -import {assembleSelectionScaleDomain} from '../selection/assemble'; -import {assembleDomain} from './domain'; - -export function assembleScales(model: Model): VgScale[] { - if (isLayerModel(model) || isConcatModel(model)) { - // For concat and layer, include scales of children too - return model.children.reduce((scales, child) => { - return scales.concat(assembleScales(child)); - }, assembleScalesForModel(model)); - } else { - // For facet, child scales would not be included in the parent's scope. - // For unit, there is no child. - return assembleScalesForModel(model); - } -} - -export function assembleScalesForModel(model: Model): VgScale[] { - return keys(model.component.scales).reduce((scales: VgScale[], channel: ScaleChannel) => { - const scaleComponent = model.component.scales[channel]; - if (scaleComponent.merged) { - // Skipped merged scales - return scales; - } - - const scale = scaleComponent.combine(); - const {name, type, selectionExtent, domains: _d, range: _r, reverse, ...otherScaleProps} = scale; - const range = assembleScaleRange(scale.range, name, channel, model); - - let domainRaw; - if (selectionExtent) { - domainRaw = assembleSelectionScaleDomain(model, selectionExtent); - } - - const domain = assembleDomain(model, channel); - - scales.push({ - name, - type, - ...(domain ? {domain} : {}), - ...(domainRaw ? {domainRaw} : {}), - range, - ...(reverse !== undefined ? {reverse: reverse as any} : {}), - ...otherScaleProps - }); - - return scales; - }, [] as VgScale[]); -} - -export function assembleScaleRange( - scaleRange: VgRange, - scaleName: string, - channel: ScaleChannel, - model?: Model -): VgRange { - // add signals to x/y range - if (isXorY(channel)) { - if (isVgRangeStep(scaleRange)) { - // For width/height step, use a signal created in layout assemble instead of a constant step. - return { - step: {signal: scaleName + '_step'} - }; - } - } else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) { - return { - ...scaleRange, - data: model.lookupDataSource(scaleRange.data) - }; - } - return scaleRange; -} diff --git a/node_modules/vega-lite/src/compile/scale/component.ts b/node_modules/vega-lite/src/compile/scale/component.ts deleted file mode 100644 index b1d8ceb..0000000 --- a/node_modules/vega-lite/src/compile/scale/component.ts +++ /dev/null @@ -1,46 +0,0 @@ -import {SignalRef} from 'vega'; -import {isArray} from 'vega-util'; -import {ScaleChannel} from '../../channel'; -import {Scale, ScaleType} from '../../scale'; -import {SelectionExtent} from '../../selection'; -import {some} from '../../util'; -import {VgNonUnionDomain, VgScale} from '../../vega.schema'; -import {Explicit, Split} from '../split'; - -/** - * All VgDomain property except domain. - * (We exclude domain as we have a special "domains" array that allow us merge them all at once in assemble.) - */ -export type ScaleComponentProps = Omit & { - domains: VgNonUnionDomain[]; - selectionExtent?: SelectionExtent; - reverse?: boolean | SignalRef; // Need override since Vega doesn't official support scale reverse yet (though it does in practice) -}; - -export type Range = ScaleComponentProps['range']; - -export class ScaleComponent extends Split { - public merged = false; - - constructor(name: string, typeWithExplicit: Explicit) { - super( - {}, // no initial explicit property - {name} // name as initial implicit property - ); - this.setWithExplicit('type', typeWithExplicit); - } - - /** - * Whether the scale definitely includes zero in the domain - */ - public domainDefinitelyIncludesZero() { - if (this.get('zero') !== false) { - return true; - } - return some(this.get('domains'), d => isArray(d) && d.length === 2 && d[0] <= 0 && d[1] >= 0); - } -} - -export type ScaleComponentIndex = Partial>; - -export type ScaleIndex = Partial>; diff --git a/node_modules/vega-lite/src/compile/scale/domain.ts b/node_modules/vega-lite/src/compile/scale/domain.ts deleted file mode 100644 index 573d1d2..0000000 --- a/node_modules/vega-lite/src/compile/scale/domain.ts +++ /dev/null @@ -1,700 +0,0 @@ -import {SignalRef} from 'vega'; -import {isObject, isString} from 'vega-util'; -import { - isAggregateOp, - isArgmaxDef, - isArgminDef, - MULTIDOMAIN_SORT_OP_INDEX as UNIONDOMAIN_SORT_OP_INDEX, - NonArgAggregateOp, - SHARED_DOMAIN_OP_INDEX -} from '../../aggregate'; -import {isBinning, isBinParams, isSelectionExtent} from '../../bin'; -import {getSecondaryRangeChannel, isScaleChannel, ScaleChannel} from '../../channel'; -import { - binRequiresRange, - getFieldOrDatumDef, - hasBand, - isDatumDef, - isFieldDef, - ScaleDatumDef, - ScaleFieldDef, - TypedFieldDef, - valueExpr, - vgField -} from '../../channeldef'; -import {DataSourceType} from '../../data'; -import {DateTime} from '../../datetime'; -import * as log from '../../log'; -import {Domain, hasDiscreteDomain, isDomainUnionWith, isSelectionDomain, ScaleConfig, ScaleType} from '../../scale'; -import {SelectionExtent} from '../../selection'; -import {DEFAULT_SORT_OP, EncodingSortField, isSortArray, isSortByEncoding, isSortField} from '../../sort'; -import {normalizeTimeUnit, TimeUnit, TimeUnitParams} from '../../timeunit'; -import {Type} from '../../type'; -import * as util from '../../util'; -import { - isDataRefDomain, - isDataRefUnionedDomain, - isFieldRefUnionDomain, - isSignalRef, - VgDomain, - VgMultiFieldsRefWithSort, - VgNonUnionDomain, - VgScaleDataRefWithSort, - VgSortField, - VgUnionSortField -} from '../../vega.schema'; -import {getBinSignalName} from '../data/bin'; -import {sortArrayIndexField} from '../data/calculate'; -import {FACET_SCALE_PREFIX} from '../data/optimize'; -import {isFacetModel, isUnitModel, Model} from '../model'; -import {SignalRefWrapper} from '../signal'; -import {Explicit, makeExplicit, makeImplicit, mergeValuesWithExplicit} from '../split'; -import {UnitModel} from '../unit'; -import {ScaleComponent, ScaleComponentIndex} from './component'; - -export function parseScaleDomain(model: Model) { - if (isUnitModel(model)) { - parseUnitScaleDomain(model); - } else { - parseNonUnitScaleDomain(model); - } -} - -function parseUnitScaleDomain(model: UnitModel) { - const localScaleComponents: ScaleComponentIndex = model.component.scales; - - for (const channel of util.keys(localScaleComponents)) { - const domains = parseDomainForChannel(model, channel); - const localScaleCmpt = localScaleComponents[channel]; - localScaleCmpt.setWithExplicit('domains', domains); - parseSelectionDomain(model, channel); - - if (model.component.data.isFaceted) { - // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not - let facetParent: Model = model; - while (!isFacetModel(facetParent) && facetParent.parent) { - facetParent = facetParent.parent; - } - - const resolve = facetParent.component.resolve.scale[channel]; - - if (resolve === 'shared') { - for (const domain of domains.value) { - // Replace the scale domain with data output from a cloned subtree after the facet. - if (isDataRefDomain(domain)) { - // use data from cloned subtree (which is the same as data but with a prefix added once) - domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, ''); - } - } - } - } - } -} - -function parseNonUnitScaleDomain(model: Model) { - for (const child of model.children) { - parseScaleDomain(child); - } - - const localScaleComponents: ScaleComponentIndex = model.component.scales; - - for (const channel of util.keys(localScaleComponents)) { - let domains: Explicit; - let selectionExtent: SelectionExtent = null; - - for (const child of model.children) { - const childComponent = child.component.scales[channel]; - if (childComponent) { - if (domains === undefined) { - domains = childComponent.getWithExplicit('domains'); - } else { - domains = mergeValuesWithExplicit( - domains, - childComponent.getWithExplicit('domains'), - 'domains', - 'scale', - domainsTieBreaker - ); - } - - const se = childComponent.get('selectionExtent'); - if (selectionExtent && se && selectionExtent.selection !== se.selection) { - log.warn(log.message.NEEDS_SAME_SELECTION); - } - selectionExtent = se; - } - } - - localScaleComponents[channel].setWithExplicit('domains', domains); - - if (selectionExtent) { - localScaleComponents[channel].set('selectionExtent', selectionExtent, true); - } - } -} - -/** - * Remove unaggregated domain if it is not applicable - * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true. - */ -function normalizeUnaggregatedDomain( - domain: Domain, - fieldDef: TypedFieldDef, - scaleType: ScaleType, - scaleConfig: ScaleConfig -) { - if (domain === 'unaggregated') { - const {valid, reason} = canUseUnaggregatedDomain(fieldDef, scaleType); - if (!valid) { - log.warn(reason); - return undefined; - } - } else if (domain === undefined && scaleConfig.useUnaggregatedDomain) { - // Apply config if domain is not specified. - const {valid} = canUseUnaggregatedDomain(fieldDef, scaleType); - if (valid) { - return 'unaggregated'; - } - } - - return domain; -} - -export function parseDomainForChannel(model: UnitModel, channel: ScaleChannel): Explicit { - const scaleType = model.getScaleComponent(channel).get('type'); - const {encoding} = model; - - const domain = normalizeUnaggregatedDomain( - model.scaleDomain(channel), - model.typedFieldDef(channel), - scaleType, - model.config.scale - ); - if (domain !== model.scaleDomain(channel)) { - model.specifiedScales[channel] = { - ...model.specifiedScales[channel], - domain - }; - } - - // If channel is either X or Y then union them with X2 & Y2 if they exist - if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) { - if (getFieldOrDatumDef(encoding.x)) { - return mergeValuesWithExplicit( - parseSingleChannelDomain(scaleType, domain, model, 'x'), - parseSingleChannelDomain(scaleType, domain, model, 'x2'), - 'domain', - 'scale', - domainsTieBreaker - ); - } else { - return parseSingleChannelDomain(scaleType, domain, model, 'x2'); - } - } else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) { - if (getFieldOrDatumDef(encoding.y)) { - return mergeValuesWithExplicit( - parseSingleChannelDomain(scaleType, domain, model, 'y'), - parseSingleChannelDomain(scaleType, domain, model, 'y2'), - 'domain', - 'scale', - domainsTieBreaker - ); - } else { - return parseSingleChannelDomain(scaleType, domain, model, 'y2'); - } - } - return parseSingleChannelDomain(scaleType, domain, model, channel); -} - -function mapDomainToDataSignal( - domain: (number | string | boolean | DateTime | SignalRef | number[])[], - type: Type, - timeUnit: TimeUnit -) { - return domain.map(v => { - const data = valueExpr(v, {timeUnit, type}); - return {signal: `{data: ${data}}`}; - }); -} - -function convertDomainIfItIsDateTime( - domain: (number | string | boolean | DateTime | SignalRef | number[])[], - type: Type, - timeUnit: TimeUnit | TimeUnitParams -): [number[]] | [string[]] | [boolean[]] | SignalRef[] { - // explicit value - const normalizedTimeUnit = normalizeTimeUnit(timeUnit)?.unit; - if (type === 'temporal' || normalizedTimeUnit) { - return mapDomainToDataSignal(domain, type, normalizedTimeUnit); - } - - return [domain] as [number[]] | [string[]] | [boolean[]]; // Date time won't make sense -} - -function parseSingleChannelDomain( - scaleType: ScaleType, - domain: Domain, - model: UnitModel, - channel: ScaleChannel | 'x2' | 'y2' -): Explicit { - const {encoding} = model; - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleDatumDef | ScaleFieldDef; - - const {type} = fieldOrDatumDef; - const timeUnit = fieldOrDatumDef['timeUnit']; - - if (isDomainUnionWith(domain)) { - const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel); - - const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit); - - return makeExplicit([...defaultDomain.value, ...unionWith]); - } else if (isSignalRef(domain)) { - return makeExplicit([domain]); - } else if (domain && domain !== 'unaggregated' && !isSelectionDomain(domain)) { - return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit)); - } - - const stack = model.stack; - if (stack && channel === stack.fieldChannel) { - if (stack.offset === 'normalize') { - return makeImplicit([[0, 1]]); - } - - const data = model.requestDataName(DataSourceType.Main); - return makeImplicit([ - { - data, - field: model.vgField(channel, {suffix: 'start'}) - }, - { - data, - field: model.vgField(channel, {suffix: 'end'}) - } - ]); - } - - const sort: undefined | true | VgSortField = - isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined; - - if (isDatumDef(fieldOrDatumDef)) { - const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit); - return makeImplicit(d); - } - - const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef - if (domain === 'unaggregated') { - const data = model.requestDataName(DataSourceType.Main); - const {field} = fieldOrDatumDef; - return makeImplicit([ - { - data, - field: vgField({field, aggregate: 'min'}) - }, - { - data, - field: vgField({field, aggregate: 'max'}) - } - ]); - } else if (isBinning(fieldDef.bin)) { - if (hasDiscreteDomain(scaleType)) { - if (scaleType === 'bin-ordinal') { - // we can omit the domain as it is inferred from the `bins` property - return makeImplicit([]); - } - - // ordinal bin scale takes domain from bin_range, ordered by bin start - // This is useful for both axis-based scale (x/y) and legend-based scale (other channels). - return makeImplicit([ - { - // If sort by aggregation of a specified sort field, we need to use RAW table, - // so we can aggregate values for the scale independently from the main aggregation. - data: util.isBoolean(sort) - ? model.requestDataName(DataSourceType.Main) - : model.requestDataName(DataSourceType.Raw), - // Use range if we added it and the scale does not support computing a range as a signal. - field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? {binSuffix: 'range'} : {}), - // we have to use a sort object if sort = true to make the sort correct by bin start - sort: - sort === true || !isObject(sort) - ? { - field: model.vgField(channel, {}), - op: 'min' // min or max doesn't matter since we sort by the start of the bin range - } - : sort - } - ]); - } else { - // continuous scales - const {bin} = fieldDef; - if (isBinning(bin)) { - const binSignal = getBinSignalName(model, fieldDef.field, bin); - return makeImplicit([ - new SignalRefWrapper(() => { - const signal = model.getSignalName(binSignal); - return `[${signal}.start, ${signal}.stop]`; - }) - ]); - } else { - return makeImplicit([ - { - data: model.requestDataName(DataSourceType.Main), - field: model.vgField(channel, {}) - } - ]); - } - } - } else if ( - fieldDef.timeUnit && - util.contains(['time', 'utc'], scaleType) && - hasBand( - channel, - fieldDef, - isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined, - model.stack, - model.markDef, - model.config - ) - ) { - const data = model.requestDataName(DataSourceType.Main); - return makeImplicit([ - { - data, - field: model.vgField(channel) - }, - { - data, - field: model.vgField(channel, {suffix: 'end'}) - } - ]); - } else if (sort) { - return makeImplicit([ - { - // If sort by aggregation of a specified sort field, we need to use RAW table, - // so we can aggregate values for the scale independently from the main aggregation. - data: util.isBoolean(sort) - ? model.requestDataName(DataSourceType.Main) - : model.requestDataName(DataSourceType.Raw), - field: model.vgField(channel), - sort: sort - } - ]); - } else { - return makeImplicit([ - { - data: model.requestDataName(DataSourceType.Main), - field: model.vgField(channel) - } - ]); - } -} - -function normalizeSortField(sort: EncodingSortField, isStackedMeasure: boolean): VgSortField { - const {op, field, order} = sort; - return { - // Apply default op - op: op ?? (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP), - // flatten nested fields - ...(field ? {field: util.replacePathInField(field)} : {}), - - ...(order ? {order} : {}) - }; -} - -function parseSelectionDomain(model: UnitModel, channel: ScaleChannel) { - const scale = model.component.scales[channel]; - const spec = model.specifiedScales[channel].domain; - const bin = model.fieldDef(channel)?.bin; - const domain = isSelectionDomain(spec) && spec; - const extent = isBinParams(bin) && isSelectionExtent(bin.extent) && bin.extent; - - if (domain || extent) { - // As scale parsing occurs before selection parsing, we cannot set - // domainRaw directly. So instead, we store the selectionExtent on - // the scale component, and then add domainRaw during scale assembly. - scale.set('selectionExtent', domain ?? extent, true); - } -} - -export function domainSort( - model: UnitModel, - channel: ScaleChannel, - scaleType: ScaleType -): undefined | true | VgSortField { - if (!hasDiscreteDomain(scaleType)) { - return undefined; - } - - // save to cast as the only exception is the geojson type for shape, which would not generate a scale - const fieldDef = model.fieldDef(channel) as ScaleFieldDef; - const sort = fieldDef.sort; - - // if the sort is specified with array, use the derived sort index field - if (isSortArray(sort)) { - return { - op: 'min', - field: sortArrayIndexField(fieldDef, channel), - order: 'ascending' - }; - } - - const {stack} = model; - const stackDimensions = stack - ? [...(stack.groupbyField ? [stack.groupbyField] : []), ...stack.stackBy.map(s => s.fieldDef.field)] - : undefined; - - // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale) - if (isSortField(sort)) { - const isStackedMeasure = stack && !util.contains(stackDimensions, sort.field); - return normalizeSortField(sort, isStackedMeasure); - } else if (isSortByEncoding(sort)) { - const {encoding, order} = sort; - const fieldDefToSortBy = model.fieldDef(encoding); - const {aggregate, field} = fieldDefToSortBy; - - const isStackedMeasure = stack && !util.contains(stackDimensions, field); - - if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { - return normalizeSortField( - { - field: vgField(fieldDefToSortBy), - order - }, - isStackedMeasure - ); - } else if (isAggregateOp(aggregate) || !aggregate) { - return normalizeSortField( - { - op: aggregate as NonArgAggregateOp, // can't be argmin/argmax since we don't support them in encoding field def - field, - order - }, - isStackedMeasure - ); - } - } else if (sort === 'descending') { - return { - op: 'min', - field: model.vgField(channel), - order: 'descending' - }; - } else if (util.contains(['ascending', undefined /* default =ascending*/], sort)) { - return true; - } - - // sort == null - return undefined; -} - -/** - * Determine if a scale can use unaggregated domain. - * @return {Boolean} Returns true if all of the following conditions apply: - * 1. `scale.domain` is `unaggregated` - * 2. Aggregation function is not `count` or `sum` - * 3. The scale is quantitative or time scale. - */ -export function canUseUnaggregatedDomain( - fieldDef: TypedFieldDef, - scaleType: ScaleType -): {valid: boolean; reason?: string} { - const {aggregate, type} = fieldDef; - - if (!aggregate) { - return { - valid: false, - reason: log.message.unaggregateDomainHasNoEffectForRawField(fieldDef) - }; - } - - if (isString(aggregate) && !SHARED_DOMAIN_OP_INDEX[aggregate]) { - return { - valid: false, - reason: log.message.unaggregateDomainWithNonSharedDomainOp(aggregate) - }; - } - - if (type === 'quantitative') { - if (scaleType === 'log') { - return { - valid: false, - reason: log.message.unaggregatedDomainWithLogScale(fieldDef) - }; - } - } - - return {valid: true}; -} - -/** - * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values. - */ -function domainsTieBreaker( - v1: Explicit, - v2: Explicit, - property: 'domains', - propertyOf: 'scale' -) { - if (v1.explicit && v2.explicit) { - log.warn(log.message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value)); - } - // If equal score, concat the domains so that we union them later. - return {explicit: v1.explicit, value: [...v1.value, ...v2.value]}; -} - -/** - * Converts an array of domains to a single Vega scale domain. - */ -export function mergeDomains(domains: VgNonUnionDomain[]): VgDomain { - const uniqueDomains = util.unique( - domains.map(domain => { - // ignore sort property when computing the unique domains - if (isDataRefDomain(domain)) { - const {sort: _s, ...domainWithoutSort} = domain; - return domainWithoutSort; - } - return domain; - }), - util.hash - ); - - const sorts: VgSortField[] = util.unique( - domains - .map(d => { - if (isDataRefDomain(d)) { - const s = d.sort; - if (s !== undefined && !util.isBoolean(s)) { - if ('op' in s && s.op === 'count') { - // let's make sure that if op is count, we don't use a field - delete s.field; - } - if (s.order === 'ascending') { - // drop order: ascending as it is the default - delete s.order; - } - } - return s; - } - return undefined; - }) - .filter(s => s !== undefined), - util.hash - ); - - if (uniqueDomains.length === 0) { - return undefined; - } else if (uniqueDomains.length === 1) { - const domain = domains[0]; - if (isDataRefDomain(domain) && sorts.length > 0) { - let sort = sorts[0]; - if (sorts.length > 1) { - log.warn(log.message.MORE_THAN_ONE_SORT); - sort = true; - } else { - // Simplify domain sort by removing field and op when the field is the same as the domain field. - if (isObject(sort) && 'field' in sort) { - const sortField = sort.field; - if (domain.field === sortField) { - sort = sort.order ? {order: sort.order} : true; - } - } - } - return { - ...domain, - sort - }; - } - return domain; - } - - // only keep sort properties that work with unioned domains - const unionDomainSorts = util.unique( - sorts.map(s => { - if (util.isBoolean(s) || !('op' in s) || s.op in UNIONDOMAIN_SORT_OP_INDEX) { - return s as VgUnionSortField; - } - log.warn(log.message.domainSortDropped(s)); - return true; - }), - util.hash - ) as VgUnionSortField[]; - - let sort: VgUnionSortField; - - if (unionDomainSorts.length === 1) { - sort = unionDomainSorts[0]; - } else if (unionDomainSorts.length > 1) { - log.warn(log.message.MORE_THAN_ONE_SORT); - sort = true; - } - - const allData = util.unique( - domains.map(d => { - if (isDataRefDomain(d)) { - return d.data; - } - return null; - }), - x => x - ); - - if (allData.length === 1 && allData[0] !== null) { - // create a union domain of different fields with a single data source - const domain: VgMultiFieldsRefWithSort = { - data: allData[0], - fields: uniqueDomains.map(d => (d as VgScaleDataRefWithSort).field), - ...(sort ? {sort} : {}) - }; - - return domain; - } - - return {fields: uniqueDomains, ...(sort ? {sort} : {})}; -} - -/** - * Return a field if a scale uses a single field. - * Return `undefined` otherwise. - */ -export function getFieldFromDomain(domain: VgDomain): string { - if (isDataRefDomain(domain) && isString(domain.field)) { - return domain.field; - } else if (isDataRefUnionedDomain(domain)) { - let field; - for (const nonUnionDomain of domain.fields) { - if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) { - if (!field) { - field = nonUnionDomain.field; - } else if (field !== nonUnionDomain.field) { - log.warn(log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES); - return field; - } - } - } - log.warn(log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES); - return field; - } else if (isFieldRefUnionDomain(domain)) { - log.warn(log.message.FACETED_INDEPENDENT_SAME_SOURCE); - const field = domain.fields[0]; - return isString(field) ? field : undefined; - } - - return undefined; -} - -export function assembleDomain(model: Model, channel: ScaleChannel) { - const scaleComponent: ScaleComponent = model.component.scales[channel]; - - const domains = scaleComponent.get('domains').map((domain: VgNonUnionDomain) => { - // Correct references to data as the original domain's data was determined - // in parseScale, which happens before parseData. Thus the original data - // reference can be incorrect. - if (isDataRefDomain(domain)) { - domain.data = model.lookupDataSource(domain.data); - } - - return domain; - }); - - // domains is an array that has to be merged into a single vega domain - return mergeDomains(domains); -} diff --git a/node_modules/vega-lite/src/compile/scale/parse.ts b/node_modules/vega-lite/src/compile/scale/parse.ts deleted file mode 100644 index 5b73b4b..0000000 --- a/node_modules/vega-lite/src/compile/scale/parse.ts +++ /dev/null @@ -1,135 +0,0 @@ -import {ScaleChannel, SCALE_CHANNELS, SHAPE} from '../../channel'; -import {getFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef'; -import {GEOSHAPE} from '../../mark'; -import { - NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES, - scaleCompatible, - ScaleType, - scaleTypePrecedence -} from '../../scale'; -import {GEOJSON} from '../../type'; -import {keys} from '../../util'; -import {VgScale} from '../../vega.schema'; -import {isUnitModel, Model} from '../model'; -import {defaultScaleResolve} from '../resolve'; -import {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split'; -import {UnitModel} from '../unit'; -import {ScaleComponent, ScaleComponentIndex} from './component'; -import {parseScaleDomain} from './domain'; -import {parseScaleProperty, parseScaleRange} from './properties'; -import {scaleType} from './type'; - -export function parseScales(model: Model, {ignoreRange}: {ignoreRange?: boolean} = {}) { - parseScaleCore(model); - parseScaleDomain(model); - for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) { - parseScaleProperty(model, prop); - } - if (!ignoreRange) { - // range depends on zero - parseScaleRange(model); - } -} - -export function parseScaleCore(model: Model) { - if (isUnitModel(model)) { - model.component.scales = parseUnitScaleCore(model); - } else { - model.component.scales = parseNonUnitScaleCore(model); - } -} - -/** - * Parse scales for all channels of a model. - */ -function parseUnitScaleCore(model: UnitModel): ScaleComponentIndex { - const {encoding, mark} = model; - - return SCALE_CHANNELS.reduce((scaleComponents: ScaleComponentIndex, channel: ScaleChannel) => { - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as TypedFieldDef | ScaleDatumDef; // must be typed def to have scale - - // Don't generate scale for shape of geoshape - if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) { - return scaleComponents; - } - let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale']; - - if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) { - specifiedScale = specifiedScale ?? {}; - - const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, mark); - scaleComponents[channel] = new ScaleComponent(model.scaleName(channel + '', true), { - value: sType, - explicit: specifiedScale.type === sType - }); - } - - return scaleComponents; - }, {}); -} - -const scaleTypeTieBreaker = tieBreakByComparing( - (st1: ScaleType, st2: ScaleType) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2) -); - -function parseNonUnitScaleCore(model: Model) { - const scaleComponents: ScaleComponentIndex = (model.component.scales = {}); - - const scaleTypeWithExplicitIndex: Partial>> = {}; - const resolve = model.component.resolve; - - // Parse each child scale and determine if a particular channel can be merged. - for (const child of model.children) { - parseScaleCore(child); - - // Instead of always merging right away -- check if it is compatible to merge first! - for (const channel of keys(child.component.scales)) { - // if resolve is undefined, set default first - resolve.scale[channel] = resolve.scale[channel] ?? defaultScaleResolve(channel, model); - - if (resolve.scale[channel] === 'shared') { - const explicitScaleType = scaleTypeWithExplicitIndex[channel]; - const childScaleType = child.component.scales[channel].getWithExplicit('type'); - - if (explicitScaleType) { - if (scaleCompatible(explicitScaleType.value, childScaleType.value)) { - // merge scale component if type are compatible - scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit( - explicitScaleType, - childScaleType, - 'type', - 'scale', - scaleTypeTieBreaker - ); - } else { - // Otherwise, update conflicting channel to be independent - resolve.scale[channel] = 'independent'; - // Remove from the index so they don't get merged - delete scaleTypeWithExplicitIndex[channel]; - } - } else { - scaleTypeWithExplicitIndex[channel] = childScaleType; - } - } - } - } - - // Merge each channel listed in the index - for (const channel of keys(scaleTypeWithExplicitIndex)) { - // Create new merged scale component - const name = model.scaleName(channel, true); - const typeWithExplicit = scaleTypeWithExplicitIndex[channel]; - scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit); - - // rename each child and mark them as merged - for (const child of model.children) { - const childScale = child.component.scales[channel]; - if (childScale) { - child.renameScale(childScale.get('name'), name); - childScale.merged = true; - } - } - } - - return scaleComponents; -} diff --git a/node_modules/vega-lite/src/compile/scale/properties.ts b/node_modules/vega-lite/src/compile/scale/properties.ts deleted file mode 100644 index db81791..0000000 --- a/node_modules/vega-lite/src/compile/scale/properties.ts +++ /dev/null @@ -1,407 +0,0 @@ -import {SignalRef, TimeInterval} from 'vega'; -import {isArray} from 'vega-util'; -import {isBinned, isBinning, isBinParams} from '../../bin'; -import { - COLOR, - FILL, - POLAR_POSITION_SCALE_CHANNELS, - POSITION_SCALE_CHANNELS, - POSITION_SCALE_CHANNEL_INDEX, - ScaleChannel, - STROKE -} from '../../channel'; -import { - getFieldDef, - getFieldOrDatumDef, - isFieldDef, - ScaleDatumDef, - ScaleFieldDef, - TypedFieldDef, - valueExpr -} from '../../channeldef'; -import {Config} from '../../config'; -import {isDateTime} from '../../datetime'; -import * as log from '../../log'; -import {Mark, MarkDef, RectConfig} from '../../mark'; -import { - channelScalePropertyIncompatability, - Domain, - hasContinuousDomain, - isContinuousToContinuous, - isContinuousToDiscrete, - Scale, - ScaleConfig, - ScaleType, - scaleTypeSupportProperty -} from '../../scale'; -import {Sort} from '../../sort'; -import {Type} from '../../type'; -import * as util from '../../util'; -import {contains, getFirstDefined, keys} from '../../util'; -import {isSignalRef, VgScale} from '../../vega.schema'; -import {getBinSignalName} from '../data/bin'; -import {isUnitModel, Model} from '../model'; -import {SignalRefWrapper} from '../signal'; -import {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split'; -import {UnitModel} from '../unit'; -import {ScaleComponentIndex, ScaleComponentProps} from './component'; -import {parseUnitScaleRange} from './range'; - -export function parseScaleProperty(model: Model, property: Exclude) { - if (isUnitModel(model)) { - parseUnitScaleProperty(model, property); - } else { - parseNonUnitScaleProperty(model, property); - } -} - -function parseUnitScaleProperty(model: UnitModel, property: Exclude) { - const localScaleComponents: ScaleComponentIndex = model.component.scales; - const {config, encoding, markDef, specifiedScales} = model; - - for (const channel of keys(localScaleComponents)) { - const specifiedScale = specifiedScales[channel]; - const localScaleCmpt = localScaleComponents[channel]; - const mergedScaleCmpt = model.getScaleComponent(channel); - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef; - - const specifiedValue = specifiedScale[property]; - const scaleType = mergedScaleCmpt.get('type'); - const scalePadding = mergedScaleCmpt.get('padding'); - const scalePaddingInner = mergedScaleCmpt.get('paddingInner'); - - const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); - const channelIncompatability = channelScalePropertyIncompatability(channel, property); - - if (specifiedValue !== undefined) { - // If there is a specified value, check if it is compatible with scale type and channel - if (!supportedByScaleType) { - log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel)); - } else if (channelIncompatability) { - // channel - log.warn(channelIncompatability); - } - } - if (supportedByScaleType && channelIncompatability === undefined) { - if (specifiedValue !== undefined) { - const timeUnit = fieldOrDatumDef['timeUnit']; - const type = fieldOrDatumDef.type; - - switch (property) { - // domainMax/Min to signal if the value is a datetime object - case 'domainMax': - case 'domainMin': - if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) { - localScaleCmpt.set(property, {signal: valueExpr(specifiedScale[property], {type, timeUnit})}, true); - } else { - localScaleCmpt.set(property, specifiedScale[property] as any, true); - } - break; - default: - localScaleCmpt.copyKeyFromObject>( - property, - specifiedScale - ); - } - } else { - const value = - property in scaleRules - ? scaleRules[property]({ - model, - channel, - fieldOrDatumDef, - scaleType, - scalePadding, - scalePaddingInner, - domain: specifiedScale.domain, - markDef, - config - }) - : config.scale[property]; - if (value !== undefined) { - localScaleCmpt.set(property, value, false); - } - } - } - } -} - -export interface ScaleRuleParams { - model: Model; - channel: ScaleChannel; - fieldOrDatumDef: ScaleFieldDef | ScaleDatumDef; - scaleType: ScaleType; - scalePadding: number | SignalRef; - scalePaddingInner: number | SignalRef; - domain: Scale['domain']; - markDef: MarkDef; - config: Config; -} - -export const scaleRules: { - [k in keyof Scale]?: (params: ScaleRuleParams) => Scale[k]; -} = { - bins: ({model, fieldOrDatumDef}) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined), - - interpolate: ({channel, fieldOrDatumDef}) => interpolate(channel, fieldOrDatumDef.type), - - nice: ({scaleType, channel, fieldOrDatumDef}) => nice(scaleType, channel, fieldOrDatumDef), - - padding: ({channel, scaleType, fieldOrDatumDef, markDef, config}) => - padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar), - - paddingInner: ({scalePadding, channel, markDef, config}) => - paddingInner(scalePadding, channel, markDef.type, config.scale), - - paddingOuter: ({scalePadding, channel, scaleType, markDef, scalePaddingInner, config}) => - paddingOuter(scalePadding, channel, scaleType, markDef.type, scalePaddingInner, config.scale), - - reverse: ({fieldOrDatumDef, scaleType, channel, config}) => { - const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined; - return reverse(scaleType, sort, channel, config.scale); - }, - zero: ({channel, fieldOrDatumDef, domain, markDef, scaleType}) => - zero(channel, fieldOrDatumDef, domain, markDef, scaleType) -}; - -// This method is here rather than in range.ts to avoid circular dependency. -export function parseScaleRange(model: Model) { - if (isUnitModel(model)) { - parseUnitScaleRange(model); - } else { - parseNonUnitScaleProperty(model, 'range'); - } -} - -export function parseNonUnitScaleProperty(model: Model, property: keyof (Scale | ScaleComponentProps)) { - const localScaleComponents: ScaleComponentIndex = model.component.scales; - - for (const child of model.children) { - if (property === 'range') { - parseScaleRange(child); - } else { - parseScaleProperty(child, property); - } - } - - for (const channel of keys(localScaleComponents)) { - let valueWithExplicit: Explicit; - - for (const child of model.children) { - const childComponent = child.component.scales[channel]; - if (childComponent) { - const childValueWithExplicit = childComponent.getWithExplicit(property); - valueWithExplicit = mergeValuesWithExplicit( - valueWithExplicit, - childValueWithExplicit, - property, - 'scale', - tieBreakByComparing((v1, v2) => { - switch (property) { - case 'range': - // For step, prefer larger step - if (v1.step && v2.step) { - return v1.step - v2.step; - } - return 0; - // TODO: precedence rule for other properties - } - return 0; - }) - ); - } - } - localScaleComponents[channel].setWithExplicit(property, valueWithExplicit); - } -} - -export function bins(model: Model, fieldDef: TypedFieldDef) { - const bin = fieldDef.bin; - if (isBinning(bin)) { - const binSignal = getBinSignalName(model, fieldDef.field, bin); - return new SignalRefWrapper(() => { - return model.getSignalName(binSignal); - }); - } else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) { - // start and stop will be determined from the scale domain - return { - step: bin.step - }; - } - return undefined; -} - -export function interpolate(channel: ScaleChannel, type: Type): Scale['interpolate'] { - if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') { - return 'hcl'; - } - return undefined; -} - -export function nice( - scaleType: ScaleType, - channel: ScaleChannel, - fieldOrDatumDef: TypedFieldDef | ScaleDatumDef -): boolean | TimeInterval { - if (getFieldDef(fieldOrDatumDef)?.bin || util.contains([ScaleType.TIME, ScaleType.UTC], scaleType)) { - return undefined; - } - return channel in POSITION_SCALE_CHANNEL_INDEX ? true : undefined; -} - -export function padding( - channel: ScaleChannel, - scaleType: ScaleType, - scaleConfig: ScaleConfig, - fieldOrDatumDef: TypedFieldDef | ScaleDatumDef, - markDef: MarkDef, - barConfig: RectConfig -) { - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - if (isContinuousToContinuous(scaleType)) { - if (scaleConfig.continuousPadding !== undefined) { - return scaleConfig.continuousPadding; - } - - const {type, orient} = markDef; - if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) { - if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) { - return barConfig.continuousBandSize; - } - } - } - - if (scaleType === ScaleType.POINT) { - return scaleConfig.pointPadding; - } - } - return undefined; -} - -export function paddingInner( - paddingValue: number | SignalRef, - channel: ScaleChannel, - mark: Mark, - scaleConfig: ScaleConfig -) { - if (paddingValue !== undefined) { - // If user has already manually specified "padding", no need to add default paddingInner. - return undefined; - } - - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - // Padding is only set for X and Y by default. - // Basically it doesn't make sense to add padding for color and size. - - // paddingOuter would only be called if it's a band scale, just return the default for bandScale. - - const {bandPaddingInner, barBandPaddingInner, rectBandPaddingInner} = scaleConfig; - - return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); - } - return undefined; -} - -export function paddingOuter( - paddingValue: number | SignalRef, - channel: ScaleChannel, - scaleType: ScaleType, - mark: Mark, - paddingInnerValue: number | SignalRef, - scaleConfig: ScaleConfig -) { - if (paddingValue !== undefined) { - // If user has already manually specified "padding", no need to add default paddingOuter. - return undefined; - } - - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - // Padding is only set for X and Y by default. - // Basically it doesn't make sense to add padding for color and size. - if (scaleType === ScaleType.BAND) { - const {bandPaddingOuter} = scaleConfig; - - return getFirstDefined( - bandPaddingOuter, - /* By default, paddingOuter is paddingInner / 2. The reason is that - size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter). - and we want the width/height to be integer by default. - Note that step (by default) and cardinality are integers.) */ - isSignalRef(paddingInnerValue) ? {signal: `${paddingInnerValue.signal}/2`} : paddingInnerValue / 2 - ); - } - } - return undefined; -} - -export function reverse(scaleType: ScaleType, sort: Sort, channel: ScaleChannel, scaleConfig: ScaleConfig) { - if (channel === 'x' && scaleConfig.xReverse !== undefined) { - if (hasContinuousDomain(scaleType) && sort === 'descending') { - if (isSignalRef(scaleConfig.xReverse)) { - return {signal: `!${scaleConfig.xReverse.signal}`}; - } else { - return !scaleConfig.xReverse; - } - } - return scaleConfig.xReverse; - } - - if (hasContinuousDomain(scaleType) && sort === 'descending') { - // For continuous domain scales, Vega does not support domain sort. - // Thus, we reverse range instead if sort is descending - return true; - } - return undefined; -} - -export function zero( - channel: ScaleChannel, - fieldDef: TypedFieldDef | ScaleDatumDef, - specifiedDomain: Domain, - markDef: MarkDef, - scaleType: ScaleType -) { - // If users explicitly provide a domain range, we should not augment zero as that will be unexpected. - const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated'; - if (hasCustomDomain) { - if (hasContinuousDomain(scaleType)) { - if (isArray(specifiedDomain)) { - const first = specifiedDomain[0]; - const last = specifiedDomain[specifiedDomain.length - 1]; - - if (first <= 0 && last >= 0) { - // if the domain includes zero, make zero remains true - return true; - } - } - return false; - } - } - - // If there is no custom domain, return true only for the following cases: - - // 1) using quantitative field with size - // While this can be either ratio or interval fields, our assumption is that - // ratio are more common. However, if the scaleType is discretizing scale, we want to return - // false so that range doesn't start at zero - if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) { - return true; - } - - // 2) non-binned, quantitative x-scale or y-scale - // (For binning, we should not include zero by default because binning are calculated without zero.) - if ( - !(isFieldDef(fieldDef) && fieldDef.bin) && - util.contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel) - ) { - const {orient, type} = markDef; - if (contains(['bar', 'area', 'line', 'trail'], type)) { - if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) { - return false; - } - } - - return true; - } - return false; -} diff --git a/node_modules/vega-lite/src/compile/scale/range.ts b/node_modules/vega-lite/src/compile/scale/range.ts deleted file mode 100644 index 020e34a..0000000 --- a/node_modules/vega-lite/src/compile/scale/range.ts +++ /dev/null @@ -1,450 +0,0 @@ -import {RangeScheme, SignalRef} from 'vega'; -import {isArray, isNumber, isObject} from 'vega-util'; -import {isBinning} from '../../bin'; -import { - ANGLE, - COLOR, - FILL, - FILLOPACITY, - isXorY, - OPACITY, - RADIUS, - ScaleChannel, - SCALE_CHANNELS, - SHAPE, - SIZE, - STROKE, - STROKEDASH, - STROKEOPACITY, - STROKEWIDTH, - THETA, - X, - Y -} from '../../channel'; -import {getFieldOrDatumDef, ScaleDatumDef, ScaleFieldDef} from '../../channeldef'; -import {Config, getViewConfigDiscreteSize, getViewConfigDiscreteStep, ViewConfig} from '../../config'; -import {DataSourceType} from '../../data'; -import * as log from '../../log'; -import {Mark} from '../../mark'; -import { - channelScalePropertyIncompatability, - Domain, - hasContinuousDomain, - hasDiscreteDomain, - isContinuousToDiscrete, - isExtendedScheme, - Scale, - scaleTypeSupportProperty, - Scheme -} from '../../scale'; -import {isStep, LayoutSizeMixins} from '../../spec/base'; -import * as util from '../../util'; -import {isSignalRef, VgRange} from '../../vega.schema'; -import {signalOrStringValue} from '../common'; -import {getBinSignalName} from '../data/bin'; -import {SignalRefWrapper} from '../signal'; -import {Explicit, makeExplicit, makeImplicit} from '../split'; -import {UnitModel} from '../unit'; -import {ScaleComponentIndex} from './component'; - -export const RANGE_PROPERTIES: (keyof Scale)[] = ['range', 'scheme']; - -function getSizeChannel(channel: ScaleChannel) { - return channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; -} - -export function parseUnitScaleRange(model: UnitModel) { - const localScaleComponents: ScaleComponentIndex = model.component.scales; - - // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first! - for (const channel of SCALE_CHANNELS) { - const localScaleCmpt = localScaleComponents[channel]; - if (!localScaleCmpt) { - continue; - } - - const rangeWithExplicit = parseRangeForChannel(channel, model); - - localScaleCmpt.setWithExplicit('range', rangeWithExplicit); - } -} - -function getBinStepSignal(model: UnitModel, channel: 'x' | 'y'): SignalRefWrapper { - const fieldDef = model.fieldDef(channel); - - if (fieldDef && fieldDef.bin && isBinning(fieldDef.bin)) { - const binSignal = getBinSignalName(model, fieldDef.field, fieldDef.bin); - - // TODO: extract this to be range step signal - const sizeType = getSizeChannel(channel); - const sizeSignal = model.getName(sizeType); - return new SignalRefWrapper(() => { - const updatedName = model.getSignalName(binSignal); - const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`; - return `${model.getSignalName(sizeSignal)} / (${binCount})`; - }); - } - return undefined; -} - -/** - * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme). - */ -export function parseRangeForChannel(channel: ScaleChannel, model: UnitModel): Explicit { - const specifiedScale = model.specifiedScales[channel]; - const {size} = model; - - const mergedScaleCmpt = model.getScaleComponent(channel); - const scaleType = mergedScaleCmpt.get('type'); - - // Check if any of the range properties is specified. - // If so, check if it is compatible and make sure that we only output one of the properties - for (const property of RANGE_PROPERTIES) { - if (specifiedScale[property] !== undefined) { - const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); - const channelIncompatability = channelScalePropertyIncompatability(channel, property); - if (!supportedByScaleType) { - log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel)); - } else if (channelIncompatability) { - // channel - log.warn(channelIncompatability); - } else { - switch (property) { - case 'range': { - const range = specifiedScale.range; - if (isArray(range)) { - if (isXorY(channel)) { - return makeExplicit( - range.map(v => { - if (v === 'width' || v === 'height') { - // get signal for width/height - - // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames. - - const sizeSignal = model.getName(v); - const getSignalName = model.getSignalName.bind(model); - return SignalRefWrapper.fromName(getSignalName, sizeSignal); - } - return v; - }) - ); - } - } else if (isObject(range)) { - return makeExplicit({ - data: model.requestDataName(DataSourceType.Main), - field: range.field, - sort: {op: 'min', field: model.vgField(channel)} - }); - } - - return makeExplicit(range); - } - case 'scheme': - return makeExplicit(parseScheme(specifiedScale[property])); - } - } - } - } - - if (channel === X || channel === Y) { - const sizeChannel = channel === X ? 'width' : 'height'; - const sizeValue = size[sizeChannel]; - if (isStep(sizeValue)) { - if (hasDiscreteDomain(scaleType)) { - return makeExplicit({step: sizeValue.step}); - } else { - log.warn(log.message.stepDropped(sizeChannel)); - } - } - } - - const {rangeMin, rangeMax} = specifiedScale; - const d = defaultRange(channel, model); - - if ( - (rangeMin !== undefined || rangeMax !== undefined) && - // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same - scaleTypeSupportProperty(scaleType, 'rangeMin') && - isArray(d) && - d.length === 2 - ) { - return makeExplicit([rangeMin ?? d[0], rangeMax ?? d[1]]); - } - - return makeImplicit(d); -} - -function parseScheme(scheme: Scheme | SignalRef): RangeScheme { - if (isExtendedScheme(scheme)) { - return { - scheme: scheme.name, - ...util.omit(scheme, ['name']) - }; - } - return {scheme: scheme}; -} - -function defaultRange(channel: ScaleChannel, model: UnitModel): VgRange { - const {size, config, mark, encoding} = model; - - const getSignalName = model.getSignalName.bind(model); - - const {type} = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef; - - const mergedScaleCmpt = model.getScaleComponent(channel); - const scaleType = mergedScaleCmpt.get('type'); - - const {domain, domainMid} = model.specifiedScales[channel]; - - switch (channel) { - case X: - case Y: { - // If there is no explicit width/height for discrete x/y scales - if (util.contains(['point', 'band'], scaleType)) { - if (channel === X && !size.width) { - const w = getViewConfigDiscreteSize(config.view, 'width'); - if (isStep(w)) { - return w; - } - } else if (channel === Y && !size.height) { - const h = getViewConfigDiscreteSize(config.view, 'height'); - if (isStep(h)) { - return h; - } - } - } - - // If step is null, use zero to width or height. - // Note that we use SignalRefWrapper to account for potential merges and renames. - - const sizeType = getSizeChannel(channel); - const sizeSignal = model.getName(sizeType); - - if (channel === Y && hasContinuousDomain(scaleType)) { - // For y continuous scale, we have to start from the height as the bottom part has the max value. - return [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0]; - } else { - return [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)]; - } - } - - case SIZE: { - // TODO: support custom rangeMin, rangeMax - const zero = model.component.scales[channel].get('zero'); - const rangeMin = sizeRangeMin(mark, zero, config); - const rangeMax = sizeRangeMax(mark, size, model, config); - if (isContinuousToDiscrete(scaleType)) { - return interpolateRange( - rangeMin, - rangeMax, - defaultContinuousToDiscreteCount(scaleType, config, domain, channel) - ); - } else { - return [rangeMin, rangeMax]; - } - } - - case THETA: - return [0, Math.PI * 2]; - - case ANGLE: - // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks. - // (It's weird to add just config.scale.min/maxAngleDegree for now) - return [0, 360]; - - case RADIUS: { - // max radius = half od min(width,height) - return [ - 0, - new SignalRefWrapper(() => { - const w = model.getSignalName('width'); - const h = model.getSignalName('height'); - return `min(${w},${h})/2`; - }) - ]; - } - - case STROKEWIDTH: - // TODO: support custom rangeMin, rangeMax - return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth]; - case STROKEDASH: - return [ - // TODO: add this to Vega's config.range? - [1, 0], - [4, 2], - [2, 1], - [1, 1], - [1, 2, 4, 2] - ]; - case SHAPE: - return 'symbol'; - case COLOR: - case FILL: - case STROKE: - if (scaleType === 'ordinal') { - // Only nominal data uses ordinal scale by default - return type === 'nominal' ? 'category' : 'ordinal'; - } else { - if (domainMid !== undefined) { - return 'diverging'; - } else { - return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp'; - } - } - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - // TODO: support custom rangeMin, rangeMax - return [config.scale.minOpacity, config.scale.maxOpacity]; - } - /* istanbul ignore next: should never reach here */ - throw new Error(`Scale range undefined for channel ${channel}`); -} - -export function defaultContinuousToDiscreteCount( - scaleType: 'quantile' | 'quantize' | 'threshold', - config: Config, - domain: Domain, - channel: ScaleChannel -) { - switch (scaleType) { - case 'quantile': - return config.scale.quantileCount; - case 'quantize': - return config.scale.quantizeCount; - case 'threshold': - if (domain !== undefined && isArray(domain)) { - return domain.length + 1; - } else { - log.warn(log.message.domainRequiredForThresholdScale(channel)); - // default threshold boundaries for threshold scale since domain has cardinality of 2 - return 3; - } - } -} - -/** - * Returns the linear interpolation of the range according to the cardinality - * - * @param rangeMin start of the range - * @param rangeMax end of the range - * @param cardinality number of values in the output range - */ -export function interpolateRange( - rangeMin: number | SignalRef, - rangeMax: number | SignalRef, - cardinality: number -): SignalRef { - // always return a signal since it's better to compute the sequence in Vega later - const f = () => { - const rMax = signalOrStringValue(rangeMax); - const rMin = signalOrStringValue(rangeMin); - const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`; - return `sequence(${rMin}, ${rMax} + ${step}, ${step})`; - }; - if (isSignalRef(rangeMax)) { - return new SignalRefWrapper(f); - } else { - return {signal: f()}; - } -} - -function sizeRangeMin(mark: Mark, zero: boolean | SignalRef, config: Config): number | SignalRef { - if (zero) { - if (isSignalRef(zero)) { - return {signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}`}; - } else { - return 0; - } - } - switch (mark) { - case 'bar': - case 'tick': - return config.scale.minBandSize; - case 'line': - case 'trail': - case 'rule': - return config.scale.minStrokeWidth; - case 'text': - return config.scale.minFontSize; - case 'point': - case 'square': - case 'circle': - return config.scale.minSize; - } - /* istanbul ignore next: should never reach here */ - // sizeRangeMin not implemented for the mark - throw new Error(log.message.incompatibleChannel('size', mark)); -} - -export const MAX_SIZE_RANGE_STEP_RATIO = 0.95; - -function sizeRangeMax(mark: Mark, size: LayoutSizeMixins, model: UnitModel, config: Config): number | SignalRef { - const xyStepSignals = { - x: getBinStepSignal(model, 'x'), - y: getBinStepSignal(model, 'y') - }; - - switch (mark) { - case 'bar': - case 'tick': { - if (config.scale.maxBandSize !== undefined) { - return config.scale.maxBandSize; - } - const min = minXYStep(size, xyStepSignals, config.view); - - if (isNumber(min)) { - return min - 1; - } else { - return new SignalRefWrapper(() => `${min.signal} - 1`); - } - } - case 'line': - case 'trail': - case 'rule': - return config.scale.maxStrokeWidth; - case 'text': - return config.scale.maxFontSize; - case 'point': - case 'square': - case 'circle': { - if (config.scale.maxSize) { - return config.scale.maxSize; - } - - const pointStep = minXYStep(size, xyStepSignals, config.view); - if (isNumber(pointStep)) { - return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2); - } else { - return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`); - } - } - } - /* istanbul ignore next: should never reach here */ - // sizeRangeMax not implemented for the mark - throw new Error(log.message.incompatibleChannel('size', mark)); -} - -/** - * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale. - */ -function minXYStep( - size: LayoutSizeMixins, - xyStepSignals: {x?: SignalRefWrapper; y?: SignalRefWrapper}, - viewConfig: ViewConfig -): number | SignalRef { - const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width'); - const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height'); - - if (xyStepSignals.x || xyStepSignals.y) { - return new SignalRefWrapper(() => { - const exprs = [ - xyStepSignals.x ? xyStepSignals.x.signal : widthStep, - xyStepSignals.y ? xyStepSignals.y.signal : heightStep - ]; - return `min(${exprs.join(', ')})`; - }); - } - - return Math.min(widthStep, heightStep); -} diff --git a/node_modules/vega-lite/src/compile/scale/type.ts b/node_modules/vega-lite/src/compile/scale/type.ts deleted file mode 100644 index ba9a90a..0000000 --- a/node_modules/vega-lite/src/compile/scale/type.ts +++ /dev/null @@ -1,114 +0,0 @@ -import {isBinning} from '../../bin'; -import {Channel, isColorChannel, isScaleChannel, rangeType} from '../../channel'; -import {DatumDef, isFieldDef, isPositionFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef'; -import * as log from '../../log'; -import {Mark} from '../../mark'; -import {channelSupportScaleType, Scale, ScaleType, scaleTypeSupportDataType} from '../../scale'; -import {normalizeTimeUnit} from '../../timeunit'; -import * as util from '../../util'; -import {POLAR_POSITION_SCALE_CHANNEL_INDEX, POSITION_SCALE_CHANNEL_INDEX} from './../../channel'; - -export type RangeType = 'continuous' | 'discrete' | 'flexible' | undefined; - -/** - * Determine if there is a specified scale type and if it is appropriate, - * or determine default type if type is unspecified or inappropriate. - */ -// NOTE: CompassQL uses this method. -export function scaleType( - specifiedScale: Scale, - channel: Channel, - fieldDef: TypedFieldDef | DatumDef, - mark: Mark -): ScaleType { - const defaultScaleType = defaultType(channel, fieldDef, mark); - const {type} = specifiedScale; - - if (!isScaleChannel(channel)) { - // There is no scale for these channels - return null; - } - if (type !== undefined) { - // Check if explicitly specified scale type is supported by the channel - if (!channelSupportScaleType(channel, type)) { - log.warn(log.message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType)); - return defaultScaleType; - } - - // Check if explicitly specified scale type is supported by the data type - if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) { - log.warn(log.message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType)); - return defaultScaleType; - } - - return type; - } - - return defaultScaleType; -} - -/** - * Determine appropriate default scale type. - */ -// NOTE: Voyager uses this method. -function defaultType(channel: Channel, fieldDef: TypedFieldDef | ScaleDatumDef, mark: Mark): ScaleType { - switch (fieldDef.type) { - case 'nominal': - case 'ordinal': - if (isColorChannel(channel) || rangeType(channel) === 'discrete') { - if (channel === 'shape' && fieldDef.type === 'ordinal') { - log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal')); - } - return 'ordinal'; - } - - if (channel in POSITION_SCALE_CHANNEL_INDEX) { - if (util.contains(['rect', 'bar', 'image', 'rule'], mark)) { - // The rect/bar mark should fit into a band. - // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429 - return 'band'; - } - } else if (mark === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) { - return 'band'; - } - - if (fieldDef.band !== undefined || (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand)) { - return 'band'; - } - // Otherwise, use ordinal point scale so we can easily get center positions of the marks. - return 'point'; - - case 'temporal': - if (isColorChannel(channel)) { - return 'time'; - } else if (rangeType(channel) === 'discrete') { - log.warn(log.message.discreteChannelCannotEncode(channel, 'temporal')); - // TODO: consider using quantize (equivalent to binning) once we have it - return 'ordinal'; - } else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) { - return 'utc'; - } - return 'time'; - - case 'quantitative': - if (isColorChannel(channel)) { - if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) { - return 'bin-ordinal'; - } - - return 'linear'; - } else if (rangeType(channel) === 'discrete') { - log.warn(log.message.discreteChannelCannotEncode(channel, 'quantitative')); - // TODO: consider using quantize (equivalent to binning) once we have it - return 'ordinal'; - } - - return 'linear'; - - case 'geojson': - return undefined; - } - - /* istanbul ignore next: should never reach this */ - throw new Error(log.message.invalidFieldType(fieldDef.type)); -} diff --git a/node_modules/vega-lite/src/compile/selection/assemble.ts b/node_modules/vega-lite/src/compile/selection/assemble.ts deleted file mode 100644 index 70b05c6..0000000 --- a/node_modules/vega-lite/src/compile/selection/assemble.ts +++ /dev/null @@ -1,182 +0,0 @@ -import {Signal, SignalRef} from 'vega'; -import {selector as parseSelector} from 'vega-event-selector'; -import {identity, isArray, stringValue} from 'vega-util'; -import {forEachSelection, MODIFY, STORE, unitName, VL_SELECTION_RESOLVE, TUPLE} from '.'; -import {dateTimeToExpr, isDateTime, dateTimeToTimestamp} from '../../datetime'; -import {SelectionInit, SelectionInitInterval, SelectionExtent} from '../../selection'; -import {keys, varName} from '../../util'; -import {VgData} from '../../vega.schema'; -import {FacetModel} from '../facet'; -import {LayerModel} from '../layer'; -import {isUnitModel, Model} from '../model'; -import {UnitModel} from '../unit'; -import {forEachTransform} from './transforms/transforms'; -import {parseSelectionBinExtent} from './parse'; - -export function assembleInit( - init: readonly (SelectionInit | readonly SelectionInit[] | SelectionInitInterval)[] | SelectionInit, - isExpr = true, - wrap: (str: string | number) => string | number = identity -): any { - if (isArray(init)) { - const assembled = init.map(v => assembleInit(v, isExpr, wrap)); - return isExpr ? `[${assembled.join(', ')}]` : assembled; - } else if (isDateTime(init)) { - if (isExpr) { - return wrap(dateTimeToExpr(init)); - } else { - return wrap(dateTimeToTimestamp(init)); - } - } - return isExpr ? wrap(JSON.stringify(init)) : init; -} - -export function assembleUnitSelectionSignals(model: UnitModel, signals: Signal[]) { - forEachSelection(model, (selCmpt, selCompiler) => { - const name = selCmpt.name; - let modifyExpr = selCompiler.modifyExpr(model, selCmpt); - - signals.push(...selCompiler.signals(model, selCmpt)); - - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.signals) { - signals = txCompiler.signals(model, selCmpt, signals); - } - if (txCompiler.modifyExpr) { - modifyExpr = txCompiler.modifyExpr(model, selCmpt, modifyExpr); - } - }); - - signals.push({ - name: name + MODIFY, - on: [ - { - events: {signal: selCmpt.name + TUPLE}, - update: `modify(${stringValue(selCmpt.name + STORE)}, ${modifyExpr})` - } - ] - }); - }); - - return cleanupEmptyOnArray(signals); -} - -export function assembleFacetSignals(model: FacetModel, signals: Signal[]) { - if (model.component.selection && keys(model.component.selection).length) { - const name = stringValue(model.getName('cell')); - signals.unshift({ - name: 'facet', - value: {}, - on: [ - { - events: parseSelector('mousemove', 'scope'), - update: `isTuple(facet) ? facet : group(${name}).datum` - } - ] - }); - } - - return cleanupEmptyOnArray(signals); -} - -export function assembleTopLevelSignals(model: UnitModel, signals: Signal[]) { - let hasSelections = false; - forEachSelection(model, (selCmpt, selCompiler) => { - const name = selCmpt.name; - const store = stringValue(name + STORE); - const hasSg = signals.filter(s => s.name === name); - if (hasSg.length === 0) { - const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve; - const isMulti = selCmpt.type === 'multi' ? ', true)' : ')'; - signals.push({ - name: selCmpt.name, - update: `${VL_SELECTION_RESOLVE}(${store}, ${stringValue(resolve)}${isMulti}` - }); - } - hasSelections = true; - - if (selCompiler.topLevelSignals) { - signals = selCompiler.topLevelSignals(model, selCmpt, signals); - } - - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.topLevelSignals) { - signals = txCompiler.topLevelSignals(model, selCmpt, signals); - } - }); - }); - - if (hasSelections) { - const hasUnit = signals.filter(s => s.name === 'unit'); - if (hasUnit.length === 0) { - signals.unshift({ - name: 'unit', - value: {}, - on: [{events: 'mousemove', update: 'isTuple(group()) ? group() : unit'}] - }); - } - } - - return cleanupEmptyOnArray(signals); -} - -export function assembleUnitSelectionData(model: UnitModel, data: readonly VgData[]): VgData[] { - const dataCopy = [...data]; - forEachSelection(model, selCmpt => { - const init: VgData = {name: selCmpt.name + STORE}; - if (selCmpt.init) { - const fields = selCmpt.project.items.map(proj => { - const {signals, ...rest} = proj; - return rest; - }); - - const insert = selCmpt.init.map(i => assembleInit(i, false)); - init.values = - selCmpt.type === 'interval' - ? [{unit: unitName(model, {escape: false}), fields, values: insert}] - : insert.map(i => ({unit: unitName(model, {escape: false}), fields, values: i})); - } - const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE); - if (!contains.length) { - dataCopy.push(init); - } - }); - - return dataCopy; -} - -export function assembleUnitSelectionMarks(model: UnitModel, marks: any[]): any[] { - forEachSelection(model, (selCmpt, selCompiler) => { - marks = selCompiler.marks ? selCompiler.marks(model, selCmpt, marks) : marks; - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.marks) { - marks = txCompiler.marks(model, selCmpt, marks); - } - }); - }); - - return marks; -} - -export function assembleLayerSelectionMarks(model: LayerModel, marks: any[]): any[] { - for (const child of model.children) { - if (isUnitModel(child)) { - marks = assembleUnitSelectionMarks(child, marks); - } - } - - return marks; -} - -export function assembleSelectionScaleDomain(model: Model, extent: SelectionExtent): SignalRef { - const name = extent.selection; - const selCmpt = model.getSelectionComponent(name, varName(name)); - return {signal: parseSelectionBinExtent(selCmpt, extent)}; -} - -function cleanupEmptyOnArray(signals: Signal[]) { - return signals.map(s => { - if (s.on && !s.on.length) delete s.on; - return s; - }); -} diff --git a/node_modules/vega-lite/src/compile/selection/index.ts b/node_modules/vega-lite/src/compile/selection/index.ts deleted file mode 100644 index cd69e0c..0000000 --- a/node_modules/vega-lite/src/compile/selection/index.ts +++ /dev/null @@ -1,111 +0,0 @@ -import {Binding, NewSignal, Stream} from 'vega'; -import {stringValue} from 'vega-util'; -import {FACET_CHANNELS} from '../../channel'; -import { - BrushConfig, - LegendBinding, - SelectionInit, - SelectionInitInterval, - SelectionResolution, - SelectionType, - SELECTION_ID -} from '../../selection'; -import {Dict, vals} from '../../util'; -import {OutputNode} from '../data/dataflow'; -import {FacetModel} from '../facet'; -import {isFacetModel, Model} from '../model'; -import {UnitModel} from '../unit'; -import interval from './interval'; -import multi from './multi'; -import single from './single'; -import {SelectionProjection, SelectionProjectionComponent} from './transforms/project'; - -export const STORE = '_store'; -export const TUPLE = '_tuple'; -export const MODIFY = '_modify'; -export const SELECTION_DOMAIN = '_selection_domain_'; -export const VL_SELECTION_RESOLVE = 'vlSelectionResolve'; - -export interface SelectionComponent { - name: string; - type: T; - // Use conditional types for stricter type of init (as the type of init depends on selection type). - init?: (T extends 'interval' - ? SelectionInitInterval - : T extends 'single' - ? SelectionInit - : T extends 'multi' - ? SelectionInit | SelectionInit[] - : never)[]; - events: Stream[]; - materialized: OutputNode; - bind?: 'scales' | Binding | Dict | LegendBinding; - resolve: SelectionResolution; - empty: 'all' | 'none'; - mark?: BrushConfig; - - // Transforms - project?: SelectionProjectionComponent; - scales?: SelectionProjection[]; - toggle?: any; - translate?: any; - zoom?: any; - nearest?: any; - clear?: any; -} - -export interface SelectionCompiler { - signals: (model: UnitModel, selCmpt: SelectionComponent) => NewSignal[]; - topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: NewSignal[]) => NewSignal[]; - modifyExpr: (model: UnitModel, selCmpt: SelectionComponent) => string; - marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[]; -} - -const compilers: Dict = {single, multi, interval}; - -export function forEachSelection( - model: Model, - cb: (selCmpt: SelectionComponent, selCompiler: SelectionCompiler) => void | boolean -) { - const selections = model.component.selection; - if (selections) { - for (const sel of vals(selections)) { - const success = cb(sel, compilers[sel.type]); - if (success === true) break; - } - } -} - -function getFacetModel(model: Model): FacetModel { - let parent = model.parent; - while (parent) { - if (isFacetModel(parent)) { - break; - } - parent = parent.parent; - } - - return parent as FacetModel; -} - -export function unitName(model: Model, {escape} = {escape: true}) { - let name = escape ? stringValue(model.name) : model.name; - const facetModel = getFacetModel(model); - if (facetModel) { - const {facet} = facetModel; - for (const channel of FACET_CHANNELS) { - if (facet[channel]) { - name += ` + '__facet_${channel}_' + (facet[${stringValue(facetModel.vgField(channel))}])`; - } - } - } - return name; -} - -export function requiresSelectionId(model: Model) { - let identifier = false; - forEachSelection(model, selCmpt => { - identifier = identifier || selCmpt.project.items.some(proj => proj.field === SELECTION_ID); - }); - return identifier; -} diff --git a/node_modules/vega-lite/src/compile/selection/interval.ts b/node_modules/vega-lite/src/compile/selection/interval.ts deleted file mode 100644 index 36ba030..0000000 --- a/node_modules/vega-lite/src/compile/selection/interval.ts +++ /dev/null @@ -1,252 +0,0 @@ -import {NewSignal, OnEvent, Stream} from 'vega'; -import {array, stringValue} from 'vega-util'; -import {SelectionCompiler, SelectionComponent, STORE, TUPLE, unitName} from '.'; -import {ScaleChannel, X, Y} from '../../channel'; -import {warn} from '../../log'; -import {hasContinuousDomain} from '../../scale'; -import {SelectionInitInterval} from '../../selection'; -import {keys} from '../../util'; -import {UnitModel} from '../unit'; -import {assembleInit} from './assemble'; -import {SelectionProjection, TUPLE_FIELDS} from './transforms/project'; -import scales from './transforms/scales'; - -export const BRUSH = '_brush'; -export const SCALE_TRIGGER = '_scale_trigger'; - -const interval: SelectionCompiler<'interval'> = { - signals: (model, selCmpt) => { - const name = selCmpt.name; - const fieldsSg = name + TUPLE_FIELDS; - const hasScales = scales.has(selCmpt); - const signals: NewSignal[] = []; - const dataSignals: string[] = []; - const scaleTriggers: { - scaleName: string; - expr: string; - }[] = []; - - if (selCmpt.translate && !hasScales) { - const filterExpr = `!event.item || event.item.mark.name !== ${stringValue(name + BRUSH)}`; - events(selCmpt, (on: OnEvent[], evt: Stream) => { - const filters = array(evt.between[0].filter ?? (evt.between[0].filter = [])); - if (filters.indexOf(filterExpr) < 0) { - filters.push(filterExpr); - } - return on; - }); - } - - selCmpt.project.items.forEach((proj, i) => { - const channel = proj.channel; - if (channel !== X && channel !== Y) { - warn('Interval selections only support x and y encoding channels.'); - return; - } - - const init = selCmpt.init ? selCmpt.init[i] : null; - const cs = channelSignals(model, selCmpt, proj, init); - const dname = proj.signals.data; - const vname = proj.signals.visual; - const scaleName = stringValue(model.scaleName(channel)); - const scaleType = model.getScaleComponent(channel).get('type'); - const toNum = hasContinuousDomain(scaleType) ? '+' : ''; - - signals.push(...cs); - dataSignals.push(dname); - - scaleTriggers.push({ - scaleName: model.scaleName(channel), - expr: - `(!isArray(${dname}) || ` + - `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` + - `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))` - }); - }); - - // Proxy scale reactions to ensure that an infinite loop doesn't occur - // when an interval selection filter touches the scale. - if (!hasScales) { - signals.push({ - name: name + SCALE_TRIGGER, - value: {}, - on: [ - { - events: scaleTriggers.map(t => ({scale: t.scaleName})), - update: scaleTriggers.map(t => t.expr).join(' && ') + ` ? ${name + SCALE_TRIGGER} : {}` - } - ] - }); - } - - // Only add an interval to the store if it has valid data extents. Data extents - // are set to null if pixel extents are equal to account for intervals over - // ordinal/nominal domains which, when inverted, will still produce a valid datum. - const init = selCmpt.init; - const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`; - return signals.concat({ - name: name + TUPLE, - ...(init ? {init: `{${update}: ${assembleInit(init)}}`} : {}), - on: [ - { - events: [{signal: dataSignals.join(' || ')}], // Prevents double invocation, see https://github.com/vega/vega#1672. - update: dataSignals.join(' && ') + ` ? {${update}: [${dataSignals}]} : null` - } - ] - }); - }, - - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`); - }, - - marks: (model, selCmpt, marks) => { - const name = selCmpt.name; - const {x, y} = selCmpt.project.hasChannel; - const xvname = x && x.signals.visual; - const yvname = y && y.signals.visual; - const store = `data(${stringValue(selCmpt.name + STORE)})`; - - // Do not add a brush if we're binding to scales. - if (scales.has(selCmpt)) { - return marks; - } - - const update: any = { - x: x !== undefined ? {signal: `${xvname}[0]`} : {value: 0}, - y: y !== undefined ? {signal: `${yvname}[0]`} : {value: 0}, - x2: x !== undefined ? {signal: `${xvname}[1]`} : {field: {group: 'width'}}, - y2: y !== undefined ? {signal: `${yvname}[1]`} : {field: {group: 'height'}} - }; - - // If the selection is resolved to global, only a single interval is in - // the store. Wrap brush mark's encodings with a production rule to test - // this based on the `unit` property. Hide the brush mark if it corresponds - // to a unit different from the one in the store. - if (selCmpt.resolve === 'global') { - for (const key of keys(update)) { - update[key] = [ - { - test: `${store}.length && ${store}[0].unit === ${unitName(model)}`, - ...update[key] - }, - {value: 0} - ]; - } - } - - // Two brush marks ensure that fill colors and other aesthetic choices do - // not interefere with the core marks, but that the brushed region can still - // be interacted with (e.g., dragging it around). - const {fill, fillOpacity, cursor, ...stroke} = selCmpt.mark; - const vgStroke = keys(stroke).reduce((def, k) => { - def[k] = [ - { - test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`] - .filter(t => t) - .join(' && '), - value: stroke[k] - }, - {value: null} - ]; - return def; - }, {}); - - return [ - { - name: name + BRUSH + '_bg', - type: 'rect', - clip: true, - encode: { - enter: { - fill: {value: fill}, - fillOpacity: {value: fillOpacity} - }, - update: update - } - }, - ...marks, - { - name: name + BRUSH, - type: 'rect', - clip: true, - encode: { - enter: { - ...(cursor ? {cursor: {value: cursor}} : {}), - fill: {value: 'transparent'} - }, - update: {...update, ...vgStroke} - } - } - ]; - } -}; -export default interval; - -/** - * Returns the visual and data signals for an interval selection. - */ -function channelSignals( - model: UnitModel, - selCmpt: SelectionComponent<'interval'>, - proj: SelectionProjection, - init?: SelectionInitInterval -): NewSignal[] { - const channel = proj.channel; - const vname = proj.signals.visual; - const dname = proj.signals.data; - const hasScales = scales.has(selCmpt); - const scaleName = stringValue(model.scaleName(channel)); - const scale = model.getScaleComponent(channel as ScaleChannel); - const scaleType = scale ? scale.get('type') : undefined; - const scaled = (str: string) => `scale(${scaleName}, ${str})`; - const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal; - const coord = `${channel}(unit)`; - - const on = events(selCmpt, (def: OnEvent[], evt: Stream) => { - return [ - ...def, - {events: evt.between[0], update: `[${coord}, ${coord}]`}, // Brush Start - {events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]`} // Brush End - ]; - }); - - // React to pan/zooms of continuous scales. Non-continuous scales - // (band, point) cannot be pan/zoomed and any other changes - // to their domains (e.g., filtering) should clear the brushes. - on.push({ - events: {signal: selCmpt.name + SCALE_TRIGGER}, - update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]` - }); - - return hasScales - ? [{name: dname, on: []}] - : [ - { - name: vname, - ...(init ? {init: assembleInit(init, true, scaled)} : {value: []}), - on: on - }, - { - name: dname, - ...(init ? {init: assembleInit(init)} : {}), // Cannot be `value` as `init` may require datetime exprs. - on: [ - { - events: {signal: vname}, - update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})` - } - ] - } - ]; -} - -function events(selCmpt: SelectionComponent<'interval'>, cb: (def: OnEvent[], evt: Stream) => OnEvent[]): OnEvent[] { - return selCmpt.events.reduce((on, evt) => { - if (!evt.between) { - warn(`${evt} is not an ordered event stream for interval selections.`); - return on; - } - return cb(on, evt); - }, [] as OnEvent[]); -} diff --git a/node_modules/vega-lite/src/compile/selection/multi.ts b/node_modules/vega-lite/src/compile/selection/multi.ts deleted file mode 100644 index aa8e33b..0000000 --- a/node_modules/vega-lite/src/compile/selection/multi.ts +++ /dev/null @@ -1,59 +0,0 @@ -import {Stream} from 'vega'; -import {stringValue} from 'vega-util'; -import {SelectionCompiler, SelectionComponent, TUPLE, unitName} from '.'; -import {UnitModel} from '../unit'; -import {TUPLE_FIELDS} from './transforms/project'; - -export function singleOrMultiSignals(model: UnitModel, selCmpt: SelectionComponent<'single' | 'multi'>) { - const name = selCmpt.name; - const fieldsSg = name + TUPLE_FIELDS; - const project = selCmpt.project; - const datum = '(item().isVoronoi ? datum.datum : datum)'; - const values = project.items - .map(p => { - const fieldDef = model.fieldDef(p.channel); - // Binned fields should capture extents, for a range test against the raw field. - return fieldDef && fieldDef.bin - ? `[${datum}[${stringValue(model.vgField(p.channel, {}))}], ` + - `${datum}[${stringValue(model.vgField(p.channel, {binSuffix: 'end'}))}]]` - : `${datum}[${stringValue(p.field)}]`; - }) - .join(', '); - - // Only add a discrete selection to the store if a datum is present _and_ - // the interaction isn't occurring on a group mark. This guards against - // polluting interactive state with invalid values in faceted displays - // as the group marks are also data-driven. We force the update to account - // for constant null states but varying toggles (e.g., shift-click in - // whitespace followed by a click in whitespace; the store should only - // be cleared on the second click). - const update = `unit: ${unitName(model)}, fields: ${fieldsSg}, values`; - - const events: Stream[] = selCmpt.events; - - return [ - { - name: name + TUPLE, - on: events - ? [ - { - events, - update: `datum && item().mark.marktype !== 'group' ? {${update}: [${values}]} : null`, - force: true - } - ] - : [] - } - ]; -} - -const multi: SelectionCompiler<'multi'> = { - signals: singleOrMultiSignals, - - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'null' : `{unit: ${unitName(model)}}`); - } -}; - -export default multi; diff --git a/node_modules/vega-lite/src/compile/selection/parse.ts b/node_modules/vega-lite/src/compile/selection/parse.ts deleted file mode 100644 index 842bbbf..0000000 --- a/node_modules/vega-lite/src/compile/selection/parse.ts +++ /dev/null @@ -1,137 +0,0 @@ -import {selector as parseSelector} from 'vega-event-selector'; -import {isString, stringValue} from 'vega-util'; -import {forEachSelection, SelectionComponent, STORE} from '.'; -import {warn} from '../../log'; -import {LogicalComposition} from '../../logical'; -import {SelectionDef, SelectionExtent} from '../../selection'; -import {Dict, duplicate, keys, logicalExpr, varName} from '../../util'; -import {DataFlowNode, OutputNode} from '../data/dataflow'; -import {FilterNode} from '../data/filter'; -import {Model} from '../model'; -import {UnitModel} from '../unit'; -import {forEachTransform} from './transforms/transforms'; -import {DataSourceType} from '../../data'; - -export function parseUnitSelection(model: UnitModel, selDefs: Dict) { - const selCmpts: Dict> = {}; - const selectionConfig = model.config.selection; - - for (const name of keys(selDefs ?? {})) { - const selDef = duplicate(selDefs[name]); - const {fields, encodings, ...cfg} = selectionConfig[selDef.type]; // Project transform applies its defaults. - - // Set default values from config if a property hasn't been specified, - // or if it is true. E.g., "translate": true should use the default - // event handlers for translate. However, true may be a valid value for - // a property (e.g., "nearest": true). - for (const key in cfg) { - // A selection should contain either `encodings` or `fields`, only use - // default values for these two values if neither of them is specified. - if ((key === 'encodings' && selDef.fields) || (key === 'fields' && selDef.encodings)) { - continue; - } - - if (key === 'mark') { - selDef[key] = {...cfg[key], ...selDef[key]}; - } - - if (selDef[key] === undefined || selDef[key] === true) { - selDef[key] = cfg[key] ?? selDef[key]; - } - } - - const safeName = varName(name); - const selCmpt = (selCmpts[safeName] = { - ...selDef, - name: safeName, - events: isString(selDef.on) ? parseSelector(selDef.on, 'scope') : duplicate(selDef.on) - } as any); - - forEachTransform(selCmpt, txCompiler => { - if (txCompiler.has(selCmpt) && txCompiler.parse) { - txCompiler.parse(model, selCmpt, selDef, selDefs[name]); - } - }); - } - - return selCmpts; -} - -export function parseSelectionPredicate( - model: Model, - selections: LogicalComposition, - dfnode?: DataFlowNode, - datum = 'datum' -): string { - const stores: string[] = []; - function expr(name: string): string { - const vname = varName(name); - const selCmpt = model.getSelectionComponent(vname, name); - const store = stringValue(vname + STORE); - - if (selCmpt.project.timeUnit) { - const child = dfnode ?? model.component.data.raw; - const tunode = selCmpt.project.timeUnit.clone(); - if (child.parent) { - tunode.insertAsParentOf(child); - } else { - child.parent = tunode; - } - } - - if (selCmpt.empty !== 'none') { - stores.push(store); - } - - return ( - `vlSelectionTest(${store}, ${datum}` + (selCmpt.resolve === 'global' ? ')' : `, ${stringValue(selCmpt.resolve)})`) - ); - } - - const predicateStr = logicalExpr(selections, expr); - return ( - (stores.length ? '!(' + stores.map(s => `length(data(${s}))`).join(' || ') + ') || ' : '') + `(${predicateStr})` - ); -} - -export function parseSelectionBinExtent(selCmpt: SelectionComponent, extent: SelectionExtent) { - const encoding = extent['encoding']; - let field = extent['field']; - - if (!encoding && !field) { - field = selCmpt.project.items[0].field; - if (selCmpt.project.items.length > 1) { - warn( - 'A "field" or "encoding" must be specified when using a selection as a scale domain. ' + - `Using "field": ${stringValue(field)}.` - ); - } - } else if (encoding && !field) { - const encodings = selCmpt.project.items.filter(p => p.channel === encoding); - if (!encodings.length || encodings.length > 1) { - field = selCmpt.project.items[0].field; - warn( - (!encodings.length ? 'No ' : 'Multiple ') + - `matching ${stringValue(encoding)} encoding found for selection ${stringValue(extent.selection)}. ` + - `Using "field": ${stringValue(field)}.` - ); - } else { - field = encodings[0].field; - } - } - - return `${selCmpt.name}[${stringValue(field)}]`; -} - -export function materializeSelections(model: UnitModel, main: OutputNode) { - forEachSelection(model, selCmpt => { - const selection = selCmpt.name; - const lookupName = model.getName(`lookup_${selection}`); - model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode( - new FilterNode(main, model, {selection}), - lookupName, - DataSourceType.Lookup, - model.component.data.outputNodeRefCounts - ); - }); -} diff --git a/node_modules/vega-lite/src/compile/selection/single.ts b/node_modules/vega-lite/src/compile/selection/single.ts deleted file mode 100644 index d045441..0000000 --- a/node_modules/vega-lite/src/compile/selection/single.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {SelectionCompiler, TUPLE, unitName} from '.'; -import {singleOrMultiSignals} from './multi'; - -const single: SelectionCompiler<'single'> = { - signals: singleOrMultiSignals, - - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`); - } -}; - -export default single; diff --git a/node_modules/vega-lite/src/compile/selection/transforms/clear.ts b/node_modules/vega-lite/src/compile/selection/transforms/clear.ts deleted file mode 100644 index 2a61457..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/clear.ts +++ /dev/null @@ -1,66 +0,0 @@ -import {Update} from 'vega'; -import {selector as parseSelector} from 'vega-event-selector'; -import {isString} from 'vega-util'; -import {TUPLE} from '..'; -import {varName} from '../../../util'; -import inputBindings from './inputs'; -import toggle, {TOGGLE} from './toggle'; -import {TransformCompiler} from './transforms'; - -const clear: TransformCompiler = { - has: selCmpt => { - return selCmpt.clear !== undefined && selCmpt.clear !== false; - }, - - parse: (model, selCmpt, selDef) => { - if (selDef.clear) { - selCmpt.clear = isString(selDef.clear) ? parseSelector(selDef.clear, 'scope') : selDef.clear; - } - }, - - topLevelSignals: (model, selCmpt, signals) => { - if (inputBindings.has(selCmpt)) { - for (const proj of selCmpt.project.items) { - const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`)); - if (idx !== -1) { - signals[idx].on.push({events: selCmpt.clear, update: 'null'}); - } - } - } - - return signals; - }, - - signals: (model, selCmpt, signals) => { - function addClear(idx: number, update: Update) { - if (idx !== -1 && signals[idx].on) { - signals[idx].on.push({events: selCmpt.clear, update}); - } - } - - // Be as minimalist as possible when adding clear triggers to minimize dataflow execution. - if (selCmpt.type === 'interval') { - for (const proj of selCmpt.project.items) { - const vIdx = signals.findIndex(n => n.name === proj.signals.visual); - addClear(vIdx, '[0, 0]'); - - if (vIdx === -1) { - const dIdx = signals.findIndex(n => n.name === proj.signals.data); - addClear(dIdx, 'null'); - } - } - } else { - let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE); - addClear(tIdx, 'null'); - - if (toggle.has(selCmpt)) { - tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE); - addClear(tIdx, 'false'); - } - } - - return signals; - } -}; - -export default clear; diff --git a/node_modules/vega-lite/src/compile/selection/transforms/inputs.ts b/node_modules/vega-lite/src/compile/selection/transforms/inputs.ts deleted file mode 100644 index ae87fec..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/inputs.ts +++ /dev/null @@ -1,78 +0,0 @@ -import {stringValue} from 'vega-util'; -import {TUPLE} from '..'; -import {varName} from '../../../util'; -import {assembleInit} from '../assemble'; -import nearest from './nearest'; -import {TUPLE_FIELDS} from './project'; -import {TransformCompiler} from './transforms'; -import {isLegendBinding} from '../../../selection'; - -const inputBindings: TransformCompiler = { - has: selCmpt => { - return ( - selCmpt.type === 'single' && - selCmpt.resolve === 'global' && - selCmpt.bind && - selCmpt.bind !== 'scales' && - !isLegendBinding(selCmpt.bind) - ); - }, - - parse: (model, selCmpt, selDef, origDef) => { - // Binding a selection to input widgets disables default direct manipulation interaction. - // A user can choose to re-enable it by explicitly specifying triggering input events. - if (!origDef.on) delete selCmpt.events; - if (!origDef.clear) delete selCmpt.clear; - }, - - topLevelSignals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const proj = selCmpt.project; - const bind = selCmpt.bind; - const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value). - const datum = nearest.has(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum'; - - proj.items.forEach((p, i) => { - const sgname = varName(`${name}_${p.field}`); - const hasSignal = signals.filter(s => s.name === sgname); - - if (!hasSignal.length) { - signals.unshift({ - name: sgname, - ...(init ? {init: assembleInit(init[i])} : {value: null}), - on: selCmpt.events - ? [ - { - events: selCmpt.events, - update: `datum && item().mark.marktype !== 'group' ? ${datum}[${stringValue(p.field)}] : null` - } - ] - : [], - bind: bind[p.field] ?? bind[p.channel] ?? bind - }); - } - }); - - return signals; - }, - - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const proj = selCmpt.project; - const signal = signals.filter(s => s.name === name + TUPLE)[0]; - const fields = name + TUPLE_FIELDS; - const values = proj.items.map(p => varName(`${name}_${p.field}`)); - const valid = values.map(v => `${v} !== null`).join(' && '); - - if (values.length) { - signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; - } - - delete signal.value; - delete signal.on; - - return signals; - } -}; - -export default inputBindings; diff --git a/node_modules/vega-lite/src/compile/selection/transforms/legends.ts b/node_modules/vega-lite/src/compile/selection/transforms/legends.ts deleted file mode 100644 index e96183e..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/legends.ts +++ /dev/null @@ -1,131 +0,0 @@ -import {MergedStream, Stream} from 'vega'; -import {selector as parseSelector} from 'vega-event-selector'; -import {array, isString} from 'vega-util'; -import {forEachSelection, SelectionComponent, TUPLE} from '..'; -import {NonPositionScaleChannel} from '../../../channel'; -import * as log from '../../../log'; -import {isLegendBinding, isLegendStreamBinding, SELECTION_ID} from '../../../selection'; -import {duplicate, varName} from '../../../util'; -import {LegendComponent} from '../../legend/component'; -import {UnitModel} from '../../unit'; -import {TUPLE_FIELDS} from './project'; -import {TOGGLE} from './toggle'; -import {TransformCompiler} from './transforms'; - -const legendBindings: TransformCompiler = { - has: (selCmpt: SelectionComponent<'single' | 'multi'>) => { - const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind); - const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID; - if (spec && !projLen) { - log.warn(log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION); - } - - return spec && projLen; - }, - - parse: (model, selCmpt, selDef, origDef) => { - // Binding a selection to a legend disables default direct manipulation interaction. - // A user can choose to re-enable it by explicitly specifying triggering input events. - if (!origDef.on) delete selCmpt.events; - if (!origDef.clear) delete selCmpt.clear; - - if (origDef.on || origDef.clear) { - const legendFilter = 'event.item && indexof(event.item.mark.role, "legend") < 0'; - for (const evt of selCmpt.events) { - evt.filter = array(evt.filter ?? []); - if (evt.filter.indexOf(legendFilter) < 0) { - evt.filter.push(legendFilter); - } - } - } - - const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click'; - const stream: Stream[] = isString(evt) ? parseSelector(evt, 'view') : array(evt); - selCmpt.bind = {legend: {merge: stream}}; - }, - - topLevelSignals: (model, selCmpt: SelectionComponent<'single' | 'multi'>, signals) => { - const selName = selCmpt.name; - const stream = isLegendStreamBinding(selCmpt.bind) && (selCmpt.bind.legend as MergedStream); - const markName = (name: string) => (s: Stream) => { - const ds = duplicate(s); - ds.markname = name; - return ds; - }; - - for (const proj of selCmpt.project.items) { - if (!proj.hasLegend) continue; - const prefix = `${varName(proj.field)}_legend`; - const sgName = `${selName}_${prefix}`; - const hasSignal = signals.filter(s => s.name === sgName); - - if (hasSignal.length === 0) { - const events = stream.merge - .map(markName(`${prefix}_symbols`)) - .concat(stream.merge.map(markName(`${prefix}_labels`))) - .concat(stream.merge.map(markName(`${prefix}_entries`))); - - signals.unshift({ - name: sgName, - ...(!selCmpt.init ? {value: null} : {}), - on: [ - // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum. - {events, update: 'datum.value || item().items[0].items[0].datum.value', force: true}, - {events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true} - ] - }); - } - } - - return signals; - }, - - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const proj = selCmpt.project; - const tuple = signals.find(s => s.name === name + TUPLE); - const fields = name + TUPLE_FIELDS; - const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`)); - const valid = values.map(v => `${v} !== null`).join(' && '); - const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; - - if (selCmpt.events && values.length > 0) { - tuple.on.push({ - events: values.map(signal => ({signal})), - update - }); - } else if (values.length > 0) { - tuple.update = update; - delete tuple.value; - delete tuple.on; - } - - const toggle = signals.find(s => s.name === name + TOGGLE); - const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; - if (toggle) { - if (!selCmpt.events) toggle.on[0].events = events; - else toggle.on.push({...toggle.on[0], events}); - } - - return signals; - } -}; - -export default legendBindings; - -export function parseInteractiveLegend( - model: UnitModel, - channel: NonPositionScaleChannel, - legendCmpt: LegendComponent -) { - const field = model.fieldDef(channel)?.field; - forEachSelection(model, selCmpt => { - const proj = selCmpt.project.hasField[field] ?? selCmpt.project.hasChannel[channel]; - if (proj && legendBindings.has(selCmpt)) { - const legendSelections = legendCmpt.get('selections') ?? []; - legendSelections.push(selCmpt.name); - legendCmpt.set('selections', legendSelections, false); - proj.hasLegend = true; - } - }); -} diff --git a/node_modules/vega-lite/src/compile/selection/transforms/nearest.ts b/node_modules/vega-lite/src/compile/selection/transforms/nearest.ts deleted file mode 100644 index aa86e38..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/nearest.ts +++ /dev/null @@ -1,74 +0,0 @@ -import * as log from '../../../log'; -import {isPathMark} from '../../../mark'; -import {tooltip} from '../../mark/encode'; -import {TransformCompiler} from './transforms'; - -const VORONOI = 'voronoi'; - -const nearest: TransformCompiler = { - has: selCmpt => { - return selCmpt.type !== 'interval' && selCmpt.nearest; - }, - - parse: (model, selCmpt) => { - // Scope selection events to the voronoi mark to prevent capturing - // events that occur on the group mark (https://github.com/vega/vega/issues/2112). - if (selCmpt.events) { - for (const s of selCmpt.events) { - s.markname = model.getName(VORONOI); - } - } - }, - - marks: (model, selCmpt, marks) => { - const {x, y} = selCmpt.project.hasChannel; - const markType = model.mark; - if (isPathMark(markType)) { - log.warn(log.message.nearestNotSupportForContinuous(markType)); - return marks; - } - - const cellDef = { - name: model.getName(VORONOI), - type: 'path', - interactive: true, - from: {data: model.getName('marks')}, - encode: { - update: { - fill: {value: 'transparent'}, - strokeWidth: {value: 0.35}, - stroke: {value: 'transparent'}, - isVoronoi: {value: true}, - ...tooltip(model, {reactiveGeom: true}) - } - }, - transform: [ - { - type: 'voronoi', - x: {expr: x || !y ? 'datum.datum.x || 0' : '0'}, - y: {expr: y || !x ? 'datum.datum.y || 0' : '0'}, - size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] - } - ] - }; - - let index = 0; - let exists = false; - marks.forEach((mark, i) => { - const name = mark.name ?? ''; - if (name === model.component.mark[0].name) { - index = i; - } else if (name.indexOf(VORONOI) >= 0) { - exists = true; - } - }); - - if (!exists) { - marks.splice(index + 1, 0, cellDef); - } - - return marks; - } -}; - -export default nearest; diff --git a/node_modules/vega-lite/src/compile/selection/transforms/project.ts b/node_modules/vega-lite/src/compile/selection/transforms/project.ts deleted file mode 100644 index d71f2e2..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/project.ts +++ /dev/null @@ -1,189 +0,0 @@ -import {array} from 'vega-util'; -import {isSingleDefUnitChannel, ScaleChannel, SingleDefUnitChannel} from '../../../channel'; -import * as log from '../../../log'; -import {hasContinuousDomain} from '../../../scale'; -import {SelectionInit, SelectionInitInterval} from '../../../selection'; -import {Dict, hash, keys, replacePathInField, varName, isEmpty} from '../../../util'; -import {TimeUnitComponent, TimeUnitNode} from '../../data/timeunit'; -import {TransformCompiler} from './transforms'; - -export const TUPLE_FIELDS = '_tuple_fields'; - -/** - * Whether the selection tuples hold enumerated or ranged values for a field. - */ -export type TupleStoreType = - // enumerated - | 'E' - // ranged, exclusive, left-right inclusive - | 'R' - // ranged, left-inclusive, right-exclusive - | 'R-RE'; - -export interface SelectionProjection { - type: TupleStoreType; - field: string; - channel?: SingleDefUnitChannel; - signals?: {data?: string; visual?: string}; - hasLegend?: boolean; -} - -export class SelectionProjectionComponent { - public hasChannel: Partial>; - public hasField: Record; - public timeUnit?: TimeUnitNode; - public items: SelectionProjection[]; - - constructor(...items: SelectionProjection[]) { - this.items = items; - this.hasChannel = {}; - this.hasField = {}; - } -} - -const project: TransformCompiler = { - has: () => { - return true; // This transform handles its own defaults, so always run parse. - }, - - parse: (model, selCmpt, selDef) => { - const name = selCmpt.name; - const proj = selCmpt.project ?? (selCmpt.project = new SelectionProjectionComponent()); - const parsed: Dict = {}; - const timeUnits: Dict = {}; - - const signals = new Set(); - const signalName = (p: SelectionProjection, range: 'data' | 'visual') => { - const suffix = range === 'visual' ? p.channel : p.field; - let sg = varName(`${name}_${suffix}`); - for (let counter = 1; signals.has(sg); counter++) { - sg = varName(`${name}_${suffix}_${counter}`); - } - signals.add(sg); - return {[range]: sg}; - }; - - // If no explicit projection (either fields or encodings) is specified, set some defaults. - // If an initial value is set, try to infer projections. - // Otherwise, use the default configuration. - if (!selDef.fields && !selDef.encodings) { - const cfg = model.config.selection[selDef.type]; - - if (selDef.init) { - for (const init of array(selDef.init)) { - for (const key of keys(init)) { - if (isSingleDefUnitChannel(key)) { - (selDef.encodings || (selDef.encodings = [])).push(key as SingleDefUnitChannel); - } else { - if (selDef.type === 'interval') { - log.warn(log.message.INTERVAL_INITIALIZED_WITH_X_Y); - selDef.encodings = cfg.encodings; - } else { - (selDef.fields || (selDef.fields = [])).push(key); - } - } - } - } - } else { - selDef.encodings = cfg.encodings; - selDef.fields = cfg.fields; - } - } - - // TODO: find a possible channel mapping for these fields. - for (const field of selDef.fields ?? []) { - const p: SelectionProjection = {type: 'E', field}; - p.signals = {...signalName(p, 'data')}; - proj.items.push(p); - proj.hasField[field] = p; - } - - for (const channel of selDef.encodings ?? []) { - const fieldDef = model.fieldDef(channel); - if (fieldDef) { - let field = fieldDef.field; - - if (fieldDef.aggregate) { - log.warn(log.message.cannotProjectAggregate(channel, fieldDef.aggregate)); - continue; - } else if (!field) { - log.warn(log.message.cannotProjectOnChannelWithoutField(channel)); - continue; - } - - if (fieldDef.timeUnit) { - field = model.vgField(channel); - // Construct TimeUnitComponents which will be combined into a - // TimeUnitNode. This node may need to be inserted into the - // dataflow if the selection is used across views that do not - // have these time units defined. - const component = { - timeUnit: fieldDef.timeUnit, - as: field, - field: fieldDef.field - }; - - timeUnits[hash(component)] = component; - } - - // Prevent duplicate projections on the same field. - // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag). - if (!parsed[field]) { - // Determine whether the tuple will store enumerated or ranged values. - // Interval selections store ranges for continuous scales, and enumerations otherwise. - // Single/multi selections store ranges for binned fields, and enumerations otherwise. - let type: TupleStoreType = 'E'; - if (selCmpt.type === 'interval') { - const scaleType = model.getScaleComponent(channel as ScaleChannel).get('type'); - if (hasContinuousDomain(scaleType)) { - type = 'R'; - } - } else if (fieldDef.bin) { - type = 'R-RE'; - } - - const p: SelectionProjection = {field, channel, type}; - p.signals = {...signalName(p, 'data'), ...signalName(p, 'visual')}; - proj.items.push((parsed[field] = p)); - proj.hasField[field] = proj.hasChannel[channel] = parsed[field]; - } - } else { - log.warn(log.message.cannotProjectOnChannelWithoutField(channel)); - } - } - - if (selDef.init) { - const parseInit = (i: Dict): T[] => { - return proj.items.map(p => (i[p.channel] !== undefined ? i[p.channel] : i[p.field])); - }; - - if (selDef.type === 'interval') { - selCmpt.init = parseInit(selDef.init); - } else { - const init = array(selDef.init); - selCmpt.init = init.map(parseInit); - } - } - - if (!isEmpty(timeUnits)) { - proj.timeUnit = new TimeUnitNode(null, timeUnits); - } - }, - - signals: (model, selCmpt, allSignals) => { - const name = selCmpt.name + TUPLE_FIELDS; - const hasSignal = allSignals.filter(s => s.name === name); - return hasSignal.length > 0 - ? allSignals - : allSignals.concat({ - name, - value: selCmpt.project.items.map(proj => { - const {signals, hasLegend, ...rest} = proj; - rest.field = replacePathInField(rest.field); - return rest; - }) - }); - } -}; - -export default project; diff --git a/node_modules/vega-lite/src/compile/selection/transforms/scales.ts b/node_modules/vega-lite/src/compile/selection/transforms/scales.ts deleted file mode 100644 index ddeb6f7..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/scales.ts +++ /dev/null @@ -1,96 +0,0 @@ -import {stringValue} from 'vega-util'; -import {VL_SELECTION_RESOLVE} from '..'; -import {isScaleChannel, ScaleChannel} from '../../../channel'; -import * as log from '../../../log'; -import {hasContinuousDomain} from '../../../scale'; -import {isLayerModel, Model} from '../../model'; -import {UnitModel} from '../../unit'; -import {SelectionProjection} from './project'; -import {TransformCompiler} from './transforms'; - -const scaleBindings: TransformCompiler = { - has: selCmpt => { - return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales'; - }, - - parse: (model, selCmpt) => { - const bound: SelectionProjection[] = (selCmpt.scales = []); - - for (const proj of selCmpt.project.items) { - const channel = proj.channel; - - if (!isScaleChannel(channel)) { - continue; - } - - const scale = model.getScaleComponent(channel); - const scaleType = scale ? scale.get('type') : undefined; - - if (!scale || !hasContinuousDomain(scaleType)) { - log.warn(log.message.SCALE_BINDINGS_CONTINUOUS); - continue; - } - - const extent = {selection: selCmpt.name, field: proj.field}; - scale.set('selectionExtent', extent, true); - bound.push(proj); - } - }, - - topLevelSignals: (model, selCmpt, signals) => { - const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0); - - // Top-level signals are only needed for multiview displays and if this - // view's top-level signals haven't already been generated. - if (!model.parent || isTopLevelLayer(model) || bound.length === 0) { - return signals; - } - - // vlSelectionResolve does not account for the behavior of bound scales in - // multiview displays. Each unit view adds a tuple to the store, but the - // state of the selection is the unit selection most recently updated. This - // state is captured by the top-level signals that we insert and "push - // outer" to from within the units. We need to reassemble this state into - // the top-level named signal, except no single selCmpt has a global view. - const namedSg = signals.filter(s => s.name === selCmpt.name)[0]; - let update = namedSg.update; - if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) { - namedSg.update = `{${bound.map(proj => `${stringValue(proj.field)}: ${proj.signals.data}`).join(', ')}}`; - } else { - for (const proj of bound) { - const mapping = `${stringValue(proj.field)}: ${proj.signals.data}`; - if (update.indexOf(mapping) < 0) { - update = `${update.substring(0, update.length - 1)}, ${mapping}}`; - } - } - namedSg.update = update; - } - - return signals.concat(bound.map(proj => ({name: proj.signals.data}))); - }, - - signals: (model, selCmpt, signals) => { - // Nested signals need only push to top-level signals with multiview displays. - if (model.parent && !isTopLevelLayer(model)) { - for (const proj of selCmpt.scales) { - const signal: any = signals.filter(s => s.name === proj.signals.data)[0]; - signal.push = 'outer'; - delete signal.value; - delete signal.update; - } - } - - return signals; - } -}; - -export default scaleBindings; - -export function domain(model: UnitModel, channel: ScaleChannel) { - const scale = stringValue(model.scaleName(channel)); - return `domain(${scale})`; -} - -function isTopLevelLayer(model: Model): boolean { - return model.parent && isLayerModel(model.parent) && (!model.parent.parent ?? isTopLevelLayer(model.parent.parent)); -} diff --git a/node_modules/vega-lite/src/compile/selection/transforms/toggle.ts b/node_modules/vega-lite/src/compile/selection/transforms/toggle.ts deleted file mode 100644 index 5adc514..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/toggle.ts +++ /dev/null @@ -1,31 +0,0 @@ -import {TUPLE, unitName} from '..'; -import {TransformCompiler} from './transforms'; - -export const TOGGLE = '_toggle'; - -const toggle: TransformCompiler = { - has: selCmpt => { - return selCmpt.type === 'multi' && !!selCmpt.toggle; - }, - - signals: (model, selCmpt, signals) => { - return signals.concat({ - name: selCmpt.name + TOGGLE, - value: false, - on: [{events: selCmpt.events, update: selCmpt.toggle}] - }); - }, - - modifyExpr: (model, selCmpt) => { - const tpl = selCmpt.name + TUPLE; - const signal = selCmpt.name + TOGGLE; - - return ( - `${signal} ? null : ${tpl}, ` + - (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) + - `${signal} ? ${tpl} : null` - ); - } -}; - -export default toggle; diff --git a/node_modules/vega-lite/src/compile/selection/transforms/transforms.ts b/node_modules/vega-lite/src/compile/selection/transforms/transforms.ts deleted file mode 100644 index fbf528b..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/transforms.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {NewSignal, Signal} from 'vega'; -import {SelectionComponent} from '..'; -import {SelectionDef} from '../../../selection'; -import {Model} from '../../model'; -import {UnitModel} from '../../unit'; -import clear from './clear'; -import inputs from './inputs'; -import nearest from './nearest'; -import project from './project'; -import scales from './scales'; -import legends from './legends'; -import toggle from './toggle'; -import translate from './translate'; -import zoom from './zoom'; - -export interface TransformCompiler { - has: (selCmpt: SelectionComponent) => boolean; - parse?: (model: UnitModel, selCmpt: SelectionComponent, def: SelectionDef, origDef: SelectionDef) => void; - signals?: (model: UnitModel, selCmpt: SelectionComponent, signals: NewSignal[]) => Signal[]; // the output can be a new or a push signal - topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: NewSignal[]) => NewSignal[]; - modifyExpr?: (model: UnitModel, selCmpt: SelectionComponent, expr: string) => string; - marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[]; -} - -const compilers: TransformCompiler[] = [project, toggle, scales, legends, translate, zoom, inputs, nearest, clear]; - -export function forEachTransform(selCmpt: SelectionComponent, cb: (tx: TransformCompiler) => void) { - for (const t of compilers) { - if (t.has(selCmpt)) { - cb(t); - } - } -} diff --git a/node_modules/vega-lite/src/compile/selection/transforms/translate.ts b/node_modules/vega-lite/src/compile/selection/transforms/translate.ts deleted file mode 100644 index 7ab0794..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/translate.ts +++ /dev/null @@ -1,106 +0,0 @@ -import {NewSignal} from 'vega'; -import {selector as parseSelector} from 'vega-event-selector'; -import {SelectionComponent} from '..'; -import {ScaleChannel, X, Y} from '../../../channel'; -import {UnitModel} from '../../unit'; -import {BRUSH as INTERVAL_BRUSH} from '../interval'; -import {SelectionProjection} from './project'; -import scalesCompiler, {domain} from './scales'; -import {TransformCompiler} from './transforms'; - -const ANCHOR = '_translate_anchor'; -const DELTA = '_translate_delta'; - -const translate: TransformCompiler = { - has: selCmpt => { - return selCmpt.type === 'interval' && selCmpt.translate; - }, - - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const hasScales = scalesCompiler.has(selCmpt); - const anchor = name + ANCHOR; - const {x, y} = selCmpt.project.hasChannel; - let events = parseSelector(selCmpt.translate, 'scope'); - - if (!hasScales) { - events = events.map(e => ((e.between[0].markname = name + INTERVAL_BRUSH), e)); - } - - signals.push( - { - name: anchor, - value: {}, - on: [ - { - events: events.map(e => e.between[0]), - update: - '{x: x(unit), y: y(unit)' + - (x !== undefined ? ', extent_x: ' + (hasScales ? domain(model, X) : `slice(${x.signals.visual})`) : '') + - (y !== undefined ? ', extent_y: ' + (hasScales ? domain(model, Y) : `slice(${y.signals.visual})`) : '') + - '}' - } - ] - }, - { - name: name + DELTA, - value: {}, - on: [ - { - events: events, - update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}` - } - ] - } - ); - - if (x !== undefined) { - onDelta(model, selCmpt, x, 'width', signals); - } - - if (y !== undefined) { - onDelta(model, selCmpt, y, 'height', signals); - } - - return signals; - } -}; - -export default translate; - -function onDelta( - model: UnitModel, - selCmpt: SelectionComponent, - proj: SelectionProjection, - size: 'width' | 'height', - signals: NewSignal[] -) { - const name = selCmpt.name; - const anchor = name + ANCHOR; - const delta = name + DELTA; - const channel = proj.channel as ScaleChannel; - const hasScales = scalesCompiler.has(selCmpt); - const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0]; - const sizeSg = model.getSizeSignalRef(size).signal; - const scaleCmpt = model.getScaleComponent(channel); - const scaleType = scaleCmpt.get('type'); - const sign = hasScales && channel === X ? '-' : ''; // Invert delta when panning x-scales. - const extent = `${anchor}.extent_${channel}`; - const offset = `${sign}${delta}.${channel} / ` + (hasScales ? `${sizeSg}` : `span(${extent})`); - const panFn = !hasScales - ? 'panLinear' - : scaleType === 'log' - ? 'panLog' - : scaleType === 'pow' - ? 'panPow' - : 'panLinear'; - const update = - `${panFn}(${extent}, ${offset}` + - (hasScales && scaleType === 'pow' ? `, ${scaleCmpt.get('exponent') ?? 1}` : '') + - ')'; - - signal.on.push({ - events: {signal: delta}, - update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})` - }); -} diff --git a/node_modules/vega-lite/src/compile/selection/transforms/zoom.ts b/node_modules/vega-lite/src/compile/selection/transforms/zoom.ts deleted file mode 100644 index 1fc4760..0000000 --- a/node_modules/vega-lite/src/compile/selection/transforms/zoom.ts +++ /dev/null @@ -1,108 +0,0 @@ -import {NewSignal} from 'vega'; -import {selector as parseSelector} from 'vega-event-selector'; -import {stringValue} from 'vega-util'; -import {SelectionComponent} from '..'; -import {ScaleChannel, X, Y} from '../../../channel'; -import {UnitModel} from '../../unit'; -import {BRUSH as INTERVAL_BRUSH} from '../interval'; -import {SelectionProjection} from './project'; -import {default as scalesCompiler, domain} from './scales'; -import {TransformCompiler} from './transforms'; - -const ANCHOR = '_zoom_anchor'; -const DELTA = '_zoom_delta'; - -const zoom: TransformCompiler = { - has: selCmpt => { - return selCmpt.type === 'interval' && selCmpt.zoom; - }, - - signals: (model, selCmpt, signals) => { - const name = selCmpt.name; - const hasScales = scalesCompiler.has(selCmpt); - const delta = name + DELTA; - const {x, y} = selCmpt.project.hasChannel; - const sx = stringValue(model.scaleName(X)); - const sy = stringValue(model.scaleName(Y)); - let events = parseSelector(selCmpt.zoom, 'scope'); - - if (!hasScales) { - events = events.map(e => ((e.markname = name + INTERVAL_BRUSH), e)); - } - - signals.push( - { - name: name + ANCHOR, - on: [ - { - events: events, - update: !hasScales - ? `{x: x(unit), y: y(unit)}` - : '{' + - [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : ''] - .filter(expr => !!expr) - .join(', ') + - '}' - } - ] - }, - { - name: delta, - on: [ - { - events: events, - force: true, - update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))' - } - ] - } - ); - - if (x !== undefined) { - onDelta(model, selCmpt, x, 'width', signals); - } - - if (y !== undefined) { - onDelta(model, selCmpt, y, 'height', signals); - } - - return signals; - } -}; - -export default zoom; - -function onDelta( - model: UnitModel, - selCmpt: SelectionComponent, - proj: SelectionProjection, - size: 'width' | 'height', - signals: NewSignal[] -) { - const name = selCmpt.name; - const channel = proj.channel as ScaleChannel; - const hasScales = scalesCompiler.has(selCmpt); - const signal = signals.filter(s => s.name === proj.signals[hasScales ? 'data' : 'visual'])[0]; - const sizeSg = model.getSizeSignalRef(size).signal; - const scaleCmpt = model.getScaleComponent(channel); - const scaleType = scaleCmpt.get('type'); - const base = hasScales ? domain(model, channel) : signal.name; - const delta = name + DELTA; - const anchor = `${name}${ANCHOR}.${channel}`; - const zoomFn = !hasScales - ? 'zoomLinear' - : scaleType === 'log' - ? 'zoomLog' - : scaleType === 'pow' - ? 'zoomPow' - : 'zoomLinear'; - const update = - `${zoomFn}(${base}, ${anchor}, ${delta}` + - (hasScales && scaleType === 'pow' ? `, ${scaleCmpt.get('exponent') ?? 1}` : '') + - ')'; - - signal.on.push({ - events: {signal: delta}, - update: hasScales ? update : `clampRange(${update}, 0, ${sizeSg})` - }); -} diff --git a/node_modules/vega-lite/src/compile/signal.ts b/node_modules/vega-lite/src/compile/signal.ts deleted file mode 100644 index 80c2071..0000000 --- a/node_modules/vega-lite/src/compile/signal.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {SignalRef} from 'vega'; - -export type Rename = (oldSignalName: string) => string; - -/** - * A class that behaves like a SignalRef but lazily generates the signal. - * The provided generator function should use `Model.getSignalName` to use the correct signal name. - */ -export class SignalRefWrapper implements SignalRef { - constructor(exprGenerator: () => string) { - Object.defineProperty(this, 'signal', { - enumerable: true, - get: exprGenerator - }); - } - - public signal: string; // for ts - - public static fromName(rename: Rename, signalName: string) { - return new SignalRefWrapper(() => rename(signalName)); - } -} diff --git a/node_modules/vega-lite/src/compile/split.ts b/node_modules/vega-lite/src/compile/split.ts deleted file mode 100644 index e6ce0df..0000000 --- a/node_modules/vega-lite/src/compile/split.ts +++ /dev/null @@ -1,158 +0,0 @@ -import * as log from '../log'; -import {deepEqual, duplicate, getFirstDefined, keys} from '../util'; - -/** - * Generic class for storing properties that are explicitly specified - * and implicitly determined by the compiler. - * This is important for scale/axis/legend merging as - * we want to prioritize properties that users explicitly specified. - */ -// eslint-disable-next-line @typescript-eslint/ban-types -export class Split { - constructor(public readonly explicit: Partial = {}, public readonly implicit: Partial = {}) {} - - public clone() { - return new Split(duplicate(this.explicit), duplicate(this.implicit)); - } - - public combine(): Partial { - // FIXME remove "as any". - // Add "as any" to avoid an error "Spread types may only be created from object types". - return { - ...(this.explicit as any), // Explicit properties comes first - ...(this.implicit as any) - }; - } - - public get(key: K): T[K] { - // Explicit has higher precedence - return getFirstDefined(this.explicit[key], this.implicit[key]); - } - - public getWithExplicit(key: K): Explicit { - // Explicit has higher precedence - if (this.explicit[key] !== undefined) { - return {explicit: true, value: this.explicit[key]}; - } else if (this.implicit[key] !== undefined) { - return {explicit: false, value: this.implicit[key]}; - } - return {explicit: false, value: undefined}; - } - - public setWithExplicit(key: K, value: Explicit) { - if (value.value !== undefined) { - this.set(key, value.value, value.explicit); - } - } - - public set(key: K, value: T[K], explicit: boolean) { - delete this[explicit ? 'implicit' : 'explicit'][key]; - this[explicit ? 'explicit' : 'implicit'][key] = value; - return this; - } - - public copyKeyFromSplit(key: keyof T, s: Split) { - // Explicit has higher precedence - if (s.explicit[key] !== undefined) { - this.set(key, s.explicit[key], true); - } else if (s.implicit[key] !== undefined) { - this.set(key, s.implicit[key], false); - } - } - public copyKeyFromObject(key: keyof T, s: Partial) { - // Explicit has higher precedence - if (s[key] !== undefined) { - this.set(key, s[key], true); - } - } - - /** - * Merge split object into this split object. Properties from the other split - * overwrite properties from this split. - */ - public copyAll(other: Split) { - for (const key of keys(other.combine())) { - const val = other.getWithExplicit(key); - this.setWithExplicit(key, val); - } - } -} - -export interface Explicit { - explicit: boolean; - value: T; -} - -export function makeExplicit(value: T): Explicit { - return { - explicit: true, - value - }; -} - -export function makeImplicit(value: T): Explicit { - return { - explicit: false, - value - }; -} - -export type SplitParentProperty = 'scale' | 'axis' | 'legend' | ''; - -export function tieBreakByComparing(compare: (v1: T, v2: T) => number) { - return ( - v1: Explicit, - v2: Explicit, - property: keyof S | never, - propertyOf: SplitParentProperty - ): Explicit => { - const diff = compare(v1.value, v2.value); - if (diff > 0) { - return v1; - } else if (diff < 0) { - return v2; - } - return defaultTieBreaker(v1, v2, property, propertyOf); - }; -} - -export function defaultTieBreaker( - v1: Explicit, - v2: Explicit, - property: keyof S, - propertyOf: SplitParentProperty -) { - if (v1.explicit && v2.explicit) { - log.warn(log.message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value)); - } - // If equal score, prefer v1. - return v1; -} - -export function mergeValuesWithExplicit( - v1: Explicit, - v2: Explicit, - property: keyof S, - propertyOf: SplitParentProperty, - tieBreaker: ( - v1: Explicit, - v2: Explicit, - property: keyof S, - propertyOf: string - ) => Explicit = defaultTieBreaker -) { - if (v1 === undefined || v1.value === undefined) { - // For first run - return v2; - } - - if (v1.explicit && !v2.explicit) { - return v1; - } else if (v2.explicit && !v1.explicit) { - return v2; - } else if (deepEqual(v1.value, v2.value)) { - return v1; - } else { - return tieBreaker(v1, v2, property, propertyOf); - } -} diff --git a/node_modules/vega-lite/src/compile/unit.ts b/node_modules/vega-lite/src/compile/unit.ts deleted file mode 100644 index 12be5b5..0000000 --- a/node_modules/vega-lite/src/compile/unit.ts +++ /dev/null @@ -1,269 +0,0 @@ -import {NewSignal} from 'vega'; -import {Axis} from '../axis'; -import { - Channel, - GEOPOSITION_CHANNELS, - NONPOSITION_SCALE_CHANNELS, - POSITION_SCALE_CHANNELS, - ScaleChannel, - SCALE_CHANNELS, - SingleDefChannel, - supportLegend, - X, - Y, - PositionChannel, - NonPositionScaleChannel -} from '../channel'; -import { - getFieldDef, - getFieldOrDatumDef, - isFieldOrDatumDef, - isTypedFieldDef, - MarkPropFieldOrDatumDef, - PositionFieldDef -} from '../channeldef'; -import {Config} from '../config'; -import {isGraticuleGenerator} from '../data'; -import * as vlEncoding from '../encoding'; -import {Encoding, initEncoding} from '../encoding'; -import {Legend} from '../legend'; -import {GEOSHAPE, isMarkDef, Mark, MarkDef} from '../mark'; -import {Projection} from '../projection'; -import {Domain} from '../scale'; -import {SelectionDef} from '../selection'; -import {LayoutSizeMixins, NormalizedUnitSpec} from '../spec'; -import {isFrameMixins} from '../spec/base'; -import {stack, StackProperties} from '../stack'; -import {Dict} from '../util'; -import {VgData, VgLayout} from '../vega.schema'; -import {assembleAxisSignals} from './axis/assemble'; -import {AxisIndex} from './axis/component'; -import {parseUnitAxes} from './axis/parse'; -import {parseData} from './data/parse'; -import {assembleLayoutSignals} from './layoutsize/assemble'; -import {initLayoutSize} from './layoutsize/init'; -import {parseUnitLayoutSize} from './layoutsize/parse'; -import {LegendIndex} from './legend/component'; -import {defaultFilled, initMarkdef} from './mark/init'; -import {parseMarkGroups} from './mark/mark'; -import {isLayerModel, Model, ModelWithField} from './model'; -import {ScaleIndex} from './scale/component'; -import { - assembleTopLevelSignals, - assembleUnitSelectionData, - assembleUnitSelectionMarks, - assembleUnitSelectionSignals -} from './selection/assemble'; -import {parseUnitSelection} from './selection/parse'; - -/** - * Internal model of Vega-Lite specification for the compiler. - */ -export class UnitModel extends ModelWithField { - public readonly markDef: MarkDef; - public readonly encoding: Encoding; - - public readonly specifiedScales: ScaleIndex = {}; - - public readonly stack: StackProperties; - - protected specifiedAxes: AxisIndex = {}; - - protected specifiedLegends: LegendIndex = {}; - - public specifiedProjection: Projection = {}; - - public readonly selection: Dict = {}; - public children: Model[] = []; - - constructor( - spec: NormalizedUnitSpec, - parent: Model, - parentGivenName: string, - parentGivenSize: LayoutSizeMixins = {}, - config: Config - ) { - super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined); - - const markDef = isMarkDef(spec.mark) ? {...spec.mark} : {type: spec.mark}; - const mark = markDef.type; - - // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding - if (markDef.filled === undefined) { - markDef.filled = defaultFilled(markDef, config, { - graticule: spec.data && isGraticuleGenerator(spec.data) - }); - } - - const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config)); - this.markDef = initMarkdef(markDef, encoding, config); - - this.size = initLayoutSize({ - encoding: encoding, - size: isFrameMixins(spec) - ? { - ...parentGivenSize, - ...(spec.width ? {width: spec.width} : {}), - ...(spec.height ? {height: spec.height} : {}) - } - : parentGivenSize - }); - - // calculate stack properties - this.stack = stack(mark, encoding); - this.specifiedScales = this.initScales(mark, encoding); - - this.specifiedAxes = this.initAxes(encoding); - this.specifiedLegends = this.initLegend(encoding); - this.specifiedProjection = spec.projection; - - // Selections will be initialized upon parse. - this.selection = spec.selection; - } - - public get hasProjection(): boolean { - const {encoding} = this; - const isGeoShapeMark = this.mark === GEOSHAPE; - const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel])); - return isGeoShapeMark || hasGeoPosition; - } - - /** - * Return specified Vega-Lite scale domain for a particular channel - * @param channel - */ - public scaleDomain(channel: ScaleChannel): Domain { - const scale = this.specifiedScales[channel]; - return scale ? scale.domain : undefined; - } - - public axis(channel: PositionChannel): Axis { - return this.specifiedAxes[channel]; - } - - public legend(channel: NonPositionScaleChannel): Legend { - return this.specifiedLegends[channel]; - } - - private initScales(mark: Mark, encoding: Encoding): ScaleIndex { - return SCALE_CHANNELS.reduce((scales, channel) => { - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as - | PositionFieldDef - | MarkPropFieldOrDatumDef; - if (fieldOrDatumDef) { - scales[channel] = fieldOrDatumDef.scale ?? {}; - } - return scales; - }, {} as ScaleIndex); - } - - private initAxes(encoding: Encoding): AxisIndex { - return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => { - // Position Axis - - // TODO: handle ConditionFieldDef - const channelDef = encoding[channel]; - if ( - isFieldOrDatumDef(channelDef) || - (channel === X && isFieldOrDatumDef(encoding.x2)) || - (channel === Y && isFieldOrDatumDef(encoding.y2)) - ) { - const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined; - - _axis[channel] = axisSpec ? {...axisSpec} : axisSpec; // convert truthy value to object - } - return _axis; - }, {}); - } - - private initLegend(encoding: Encoding): LegendIndex { - return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => { - const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldOrDatumDef; - - if (fieldOrDatumDef && supportLegend(channel)) { - const legend = fieldOrDatumDef.legend; - _legend[channel] = legend ? {...legend} : legend; // convert truthy value to object - } - - return _legend; - }, {}); - } - - public parseData() { - this.component.data = parseData(this); - } - - public parseLayoutSize() { - parseUnitLayoutSize(this); - } - - public parseSelections() { - this.component.selection = parseUnitSelection(this, this.selection); - } - - public parseMarkGroup() { - this.component.mark = parseMarkGroups(this); - } - - public parseAxesAndHeaders() { - this.component.axes = parseUnitAxes(this); - } - - public assembleSelectionTopLevelSignals(signals: any[]): NewSignal[] { - return assembleTopLevelSignals(this, signals); - } - - public assembleSignals(): NewSignal[] { - return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])]; - } - - public assembleSelectionData(data: readonly VgData[]): VgData[] { - return assembleUnitSelectionData(this, data); - } - - public assembleLayout(): VgLayout { - return null; - } - - public assembleLayoutSignals(): NewSignal[] { - return assembleLayoutSignals(this); - } - - public assembleMarks() { - let marks = this.component.mark ?? []; - - // If this unit is part of a layer, selections should augment - // all in concert rather than each unit individually. This - // ensures correct interleaving of clipping and brushed marks. - if (!this.parent || !isLayerModel(this.parent)) { - marks = assembleUnitSelectionMarks(this, marks); - } - - return marks.map(this.correctDataNames); - } - - protected getMapping() { - return this.encoding; - } - - public get mark(): Mark { - return this.markDef.type; - } - - public channelHasField(channel: Channel) { - return vlEncoding.channelHasField(this.encoding, channel); - } - - public fieldDef(channel: SingleDefChannel) { - const channelDef = this.encoding[channel]; - return getFieldDef(channelDef); - } - - public typedFieldDef(channel: SingleDefChannel) { - const fieldDef = this.fieldDef(channel); - if (isTypedFieldDef(fieldDef)) { - return fieldDef; - } - return null; - } -} diff --git a/node_modules/vega-lite/src/compositemark/base.ts b/node_modules/vega-lite/src/compositemark/base.ts deleted file mode 100644 index a9fab90..0000000 --- a/node_modules/vega-lite/src/compositemark/base.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {Encoding} from '../encoding'; -import {GenericMarkDef, getMarkType} from '../mark'; -import {NonFacetUnitNormalizer, Normalize, NormalizerParams} from '../normalize/base'; -import {GenericSpec} from '../spec'; -import {GenericLayerSpec, NormalizedLayerSpec} from '../spec/layer'; -import {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from '../spec/unit'; -import {FieldName} from '../channeldef'; - -// TODO: replace string with Mark -export type CompositeMarkUnitSpec = GenericUnitSpec>; - -export class CompositeMarkNormalizer implements NonFacetUnitNormalizer> { - constructor( - public name: string, - public run: ( - spec: CompositeMarkUnitSpec, - params: NormalizerParams, - normalize: Normalize< - // Input of the normalize method - GenericUnitSpec, M> | GenericLayerSpec, - // Output of the normalize method - NormalizedLayerSpec | NormalizedUnitSpec - > - ) => NormalizedLayerSpec | NormalizedUnitSpec - ) {} - - public hasMatchingType(spec: GenericSpec): spec is CompositeMarkUnitSpec { - if (isUnitSpec(spec)) { - return getMarkType(spec.mark) === this.name; - } - return false; - } -} diff --git a/node_modules/vega-lite/src/compositemark/boxplot.ts b/node_modules/vega-lite/src/compositemark/boxplot.ts deleted file mode 100644 index c281c98..0000000 --- a/node_modules/vega-lite/src/compositemark/boxplot.ts +++ /dev/null @@ -1,436 +0,0 @@ -import {Orientation} from 'vega'; -import {isNumber, isObject} from 'vega-util'; -import {getMarkPropOrConfig} from '../compile/common'; -import {Config} from '../config'; -import {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding'; -import * as log from '../log'; -import {isMarkDef, MarkDef} from '../mark'; -import {NormalizerParams} from '../normalize'; -import {GenericUnitSpec, NormalizedLayerSpec, NormalizedUnitSpec} from '../spec'; -import {AggregatedFieldDef, CalculateTransform, JoinAggregateTransform, Transform} from '../transform'; -import {isEmpty, omit} from '../util'; -import {CompositeMarkNormalizer} from './base'; -import { - compositeMarkContinuousAxis, - compositeMarkOrient, - filterTooltipWithAggregatedField, - GenericCompositeMarkDef, - getCompositeMarkTooltip, - getTitle, - makeCompositeAggregatePartFactory, - partLayerMixins, - PartsMixins -} from './common'; - -export const BOXPLOT = 'boxplot' as const; -export type BoxPlot = typeof BOXPLOT; - -export const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks'] as const; - -type BoxPlotPart = typeof BOXPLOT_PARTS[number]; - -export type BoxPlotPartsMixins = PartsMixins; - -export interface BoxPlotConfig extends BoxPlotPartsMixins { - /** Size of the box and median tick of a box plot */ - size?: number; - - /** - * The extent of the whiskers. Available options include: - * - `"min-max"`: min and max are the lower and upper whiskers respectively. - * - A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_). - * - * __Default value:__ `1.5`. - */ - extent?: 'min-max' | number; -} - -export type BoxPlotDef = GenericCompositeMarkDef & - BoxPlotConfig & { - /** - * Type of the mark. For box plots, this should always be `"boxplot"`. - * [boxplot](https://vega.github.io/vega-lite/docs/boxplot.html) - */ - type: BoxPlot; - - /** - * Orientation of the box plot. This is normally automatically determined based on types of fields on x and y channels. However, an explicit `orient` be specified when the orientation is ambiguous. - * - * __Default value:__ `"vertical"`. - */ - orient?: Orientation; - }; - -export interface BoxPlotConfigMixins { - /** - * Box Config - */ - boxplot?: BoxPlotConfig; -} - -export const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot); - -export function getBoxPlotType(extent: number | 'min-max') { - if (isNumber(extent)) { - return 'tukey'; - } - // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now. - return extent; -} - -export function normalizeBoxPlot( - spec: GenericUnitSpec, BoxPlot | BoxPlotDef>, - {config}: NormalizerParams -): NormalizedLayerSpec { - // Need to initEncoding first so we can infer type - spec = { - ...spec, - encoding: normalizeEncoding(spec.encoding, config) - }; - const {mark, encoding: _encoding, selection, projection: _p, ...outerSpec} = spec; - const markDef: BoxPlotDef = isMarkDef(mark) ? mark : {type: mark}; - - // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - if (selection) { - log.warn(log.message.selectionNotSupported('boxplot')); - } - - const extent = markDef.extent ?? config.boxplot.extent; - const sizeValue = getMarkPropOrConfig( - 'size', - markDef as any, // TODO: https://github.com/vega/vega-lite/issues/6245 - config - ); - - const boxPlotType = getBoxPlotType(extent); - const { - transform, - continuousAxisChannelDef, - continuousAxis, - groupby, - aggregate, - encodingWithoutContinuousAxis, - ticksOrient, - boxOrient, - customTooltipWithoutAggregatedField - } = boxParams(spec, extent, config); - - const {color, size, ...encodingWithoutSizeColorAndContinuousAxis} = encodingWithoutContinuousAxis; - - const makeBoxPlotPart = (sharedEncoding: Encoding) => { - return makeCompositeAggregatePartFactory( - markDef, - continuousAxis, - continuousAxisChannelDef, - sharedEncoding, - config.boxplot - ); - }; - - const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis); - const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis); - const makeBoxPlotMidTick = makeBoxPlotPart({...encodingWithoutSizeColorAndContinuousAxis, ...(size ? {size} : {})}); - - const fiveSummaryTooltipEncoding: Encoding = getCompositeMarkTooltip( - [ - {fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max'}, - {fieldPrefix: 'upper_box_', titlePrefix: 'Q3'}, - {fieldPrefix: 'mid_box_', titlePrefix: 'Median'}, - {fieldPrefix: 'lower_box_', titlePrefix: 'Q1'}, - {fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min'} - ], - continuousAxisChannelDef, - encodingWithoutContinuousAxis - ); - - // ## Whisker Layers - - const endTick: MarkDef = {type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid: null, aria: false}; - const whiskerTooltipEncoding: Encoding = - boxPlotType === 'min-max' - ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker - : // for tukey / k-IQR, just show upper/lower-whisker - getCompositeMarkTooltip( - [ - {fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker'}, - {fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker'} - ], - continuousAxisChannelDef, - encodingWithoutContinuousAxis - ); - - const whiskerLayers = [ - ...makeBoxPlotExtent({ - partName: 'rule', - mark: {type: 'rule', invalid: null, aria: false}, - positionPrefix: 'lower_whisker', - endPositionPrefix: 'lower_box', - extraEncoding: whiskerTooltipEncoding - }), - ...makeBoxPlotExtent({ - partName: 'rule', - mark: {type: 'rule', invalid: null, aria: false}, - positionPrefix: 'upper_box', - endPositionPrefix: 'upper_whisker', - extraEncoding: whiskerTooltipEncoding - }), - ...makeBoxPlotExtent({ - partName: 'ticks', - mark: endTick, - positionPrefix: 'lower_whisker', - extraEncoding: whiskerTooltipEncoding - }), - ...makeBoxPlotExtent({ - partName: 'ticks', - mark: endTick, - positionPrefix: 'upper_whisker', - extraEncoding: whiskerTooltipEncoding - }) - ]; - - // ## Box Layers - - // TODO: support hiding certain mark parts - const boxLayers: NormalizedUnitSpec[] = [ - ...(boxPlotType !== 'tukey' ? whiskerLayers : []), - ...makeBoxPlotBox({ - partName: 'box', - mark: { - type: 'bar', - ...(sizeValue ? {size: sizeValue} : {}), - orient: boxOrient, - invalid: null, - ariaRoleDescription: 'box' - }, - positionPrefix: 'lower_box', - endPositionPrefix: 'upper_box', - extraEncoding: fiveSummaryTooltipEncoding - }), - ...makeBoxPlotMidTick({ - partName: 'median', - mark: { - type: 'tick', - invalid: null, - ...(isObject(config.boxplot.median) && config.boxplot.median.color ? {color: config.boxplot.median.color} : {}), - ...(sizeValue ? {size: sizeValue} : {}), - orient: ticksOrient, - aria: false - }, - positionPrefix: 'mid_box', - extraEncoding: fiveSummaryTooltipEncoding - }) - ]; - - // ## Filtered Layers - - let filteredLayersMixins: NormalizedUnitSpec | NormalizedLayerSpec; - - if (boxPlotType !== 'min-max') { - const lowerBoxExpr = `datum["lower_box_${continuousAxisChannelDef.field}"]`; - const upperBoxExpr = `datum["upper_box_${continuousAxisChannelDef.field}"]`; - const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`; - const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`; - const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`; - const fieldExpr = `datum["${continuousAxisChannelDef.field}"]`; - - const joinaggregateTransform: JoinAggregateTransform = { - joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field), - groupby - }; - - let filteredWhiskerSpec: NormalizedLayerSpec = undefined; - if (boxPlotType === 'tukey') { - filteredWhiskerSpec = { - transform: [ - { - filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})` - }, - { - aggregate: [ - { - op: 'min', - field: continuousAxisChannelDef.field, - as: 'lower_whisker_' + continuousAxisChannelDef.field - }, - { - op: 'max', - field: continuousAxisChannelDef.field, - as: 'upper_whisker_' + continuousAxisChannelDef.field - }, - // preserve lower_box / upper_box - { - op: 'min', - field: 'lower_box_' + continuousAxisChannelDef.field, - as: 'lower_box_' + continuousAxisChannelDef.field - }, - { - op: 'max', - field: 'upper_box_' + continuousAxisChannelDef.field, - as: 'upper_box_' + continuousAxisChannelDef.field - }, - ...aggregate - ], - groupby - } - ], - layer: whiskerLayers - }; - } - - const {tooltip, ...encodingWithoutSizeColorContinuousAxisAndTooltip} = encodingWithoutSizeColorAndContinuousAxis; - - const {scale, axis} = continuousAxisChannelDef; - const title = getTitle(continuousAxisChannelDef); - const axisWithoutTitle = omit(axis, ['title']); - - const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, { - transform: [{filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})`}], - mark: 'point', - encoding: { - [continuousAxis]: { - field: continuousAxisChannelDef.field, - type: continuousAxisChannelDef.type, - ...(title !== undefined ? {title} : {}), - ...(scale !== undefined ? {scale} : {}), - // add axis without title since we already added the title above - ...(isEmpty(axisWithoutTitle) ? {} : {axis: axisWithoutTitle}) - }, - ...encodingWithoutSizeColorContinuousAxisAndTooltip, - ...(customTooltipWithoutAggregatedField ? {tooltip: customTooltipWithoutAggregatedField} : {}) - } - })[0]; - - if (outlierLayersMixins && filteredWhiskerSpec) { - filteredLayersMixins = { - transform: [joinaggregateTransform], - layer: [outlierLayersMixins, filteredWhiskerSpec] - }; - } else if (outlierLayersMixins) { - filteredLayersMixins = outlierLayersMixins; - filteredLayersMixins.transform.unshift(joinaggregateTransform); - } else if (filteredWhiskerSpec) { - filteredLayersMixins = filteredWhiskerSpec; - filteredLayersMixins.transform.unshift(joinaggregateTransform); - } - } - - if (filteredLayersMixins) { - // tukey box plot with outliers included - return { - ...outerSpec, - layer: [ - filteredLayersMixins, - { - // boxplot - transform, - layer: boxLayers - } - ] - }; - } - return { - ...outerSpec, - transform: (outerSpec.transform ?? []).concat(transform), - layer: boxLayers - }; -} - -function boxParamsQuartiles(continousAxisField: string): AggregatedFieldDef[] { - return [ - { - op: 'q1', - field: continousAxisField, - as: 'lower_box_' + continousAxisField - }, - { - op: 'q3', - field: continousAxisField, - as: 'upper_box_' + continousAxisField - } - ]; -} - -function boxParams( - spec: GenericUnitSpec, BoxPlot | BoxPlotDef>, - extent: 'min-max' | number, - config: Config -) { - const orient = compositeMarkOrient(spec, BOXPLOT); - const {continuousAxisChannelDef, continuousAxis} = compositeMarkContinuousAxis(spec, orient, BOXPLOT); - const continuousFieldName: string = continuousAxisChannelDef.field; - - const boxPlotType = getBoxPlotType(extent); - - const boxplotSpecificAggregate: AggregatedFieldDef[] = [ - ...boxParamsQuartiles(continuousFieldName), - { - op: 'median', - field: continuousFieldName, - as: 'mid_box_' + continuousFieldName - }, - { - op: 'min', - field: continuousFieldName, - as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName - }, - { - op: 'max', - field: continuousFieldName, - as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName - } - ]; - - const postAggregateCalculates: CalculateTransform[] = - boxPlotType === 'min-max' || boxPlotType === 'tukey' - ? [] - : [ - // This is for the original k-IQR, which we do not expose - { - calculate: `datum["upper_box_${continuousFieldName}"] - datum["lower_box_${continuousFieldName}"]`, - as: 'iqr_' + continuousFieldName - }, - { - calculate: `min(datum["upper_box_${continuousFieldName}"] + datum["iqr_${continuousFieldName}"] * ${extent}, datum["max_${continuousFieldName}"])`, - as: 'upper_whisker_' + continuousFieldName - }, - { - calculate: `max(datum["lower_box_${continuousFieldName}"] - datum["iqr_${continuousFieldName}"] * ${extent}, datum["min_${continuousFieldName}"])`, - as: 'lower_whisker_' + continuousFieldName - } - ]; - - const {[continuousAxis]: oldContinuousAxisChannelDef, ...oldEncodingWithoutContinuousAxis} = spec.encoding; - const {customTooltipWithoutAggregatedField, filteredEncoding} = filterTooltipWithAggregatedField( - oldEncodingWithoutContinuousAxis - ); - - const {bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis} = extractTransformsFromEncoding( - filteredEncoding, - config - ); - - const ticksOrient: Orientation = orient === 'vertical' ? 'horizontal' : 'vertical'; - const boxOrient: Orientation = orient; - - const transform: Transform[] = [ - ...bins, - ...timeUnits, - { - aggregate: [...aggregate, ...boxplotSpecificAggregate], - groupby - }, - ...postAggregateCalculates - ]; - - return { - transform, - groupby, - aggregate, - continuousAxisChannelDef, - continuousAxis, - encodingWithoutContinuousAxis, - ticksOrient, - boxOrient, - customTooltipWithoutAggregatedField - }; -} diff --git a/node_modules/vega-lite/src/compositemark/common.ts b/node_modules/vega-lite/src/compositemark/common.ts deleted file mode 100644 index bae20ff..0000000 --- a/node_modules/vega-lite/src/compositemark/common.ts +++ /dev/null @@ -1,306 +0,0 @@ -import {Orientation, SignalRef, Text} from 'vega'; -import {isArray, isBoolean, isString} from 'vega-util'; -import {CompositeMark, CompositeMarkDef} from '.'; -import { - Field, - FieldDefBase, - isContinuousFieldOrDatumDef, - isFieldDef, - isFieldOrDatumDefForTimeFormat, - PositionFieldDef, - SecondaryFieldDef, - StringFieldDef, - StringFieldDefWithCondition, - StringValueDefWithCondition -} from '../channeldef'; -import {Encoding, fieldDefs} from '../encoding'; -import * as log from '../log'; -import {ColorMixins, GenericMarkDef, isMarkDef, Mark, MarkConfig, MarkDef} from '../mark'; -import {GenericUnitSpec, NormalizedUnitSpec} from '../spec'; -import {getFirstDefined, hash, unique} from '../util'; -import {isSignalRef} from '../vega.schema'; -import {toStringFieldDef} from './../channeldef'; - -export type PartsMixins

= Partial>; - -export type GenericCompositeMarkDef = GenericMarkDef & - ColorMixins & { - /** - * The opacity (value between [0,1]) of the mark. - */ - opacity?: number; - - /** - * Whether a composite mark be clipped to the enclosing group’s width and height. - */ - clip?: boolean; - }; - -export interface CompositeMarkTooltipSummary { - /** - * The prefix of the field to be shown in tooltip - */ - fieldPrefix: string; - - /** - * The title prefix to show, corresponding to the field with field prefix `fieldPrefix` - */ - titlePrefix: Text | SignalRef; -} - -export function filterTooltipWithAggregatedField( - oldEncoding: Encoding -): { - customTooltipWithoutAggregatedField?: - | StringFieldDefWithCondition - | StringValueDefWithCondition - | StringFieldDef[]; - filteredEncoding: Encoding; -} { - const {tooltip, ...filteredEncoding} = oldEncoding; - if (!tooltip) { - return {filteredEncoding}; - } - - let customTooltipWithAggregatedField: - | StringFieldDefWithCondition - | StringValueDefWithCondition - | StringFieldDef[]; - let customTooltipWithoutAggregatedField: - | StringFieldDefWithCondition - | StringValueDefWithCondition - | StringFieldDef[]; - - if (isArray(tooltip)) { - for (const t of tooltip) { - if (t.aggregate) { - if (!customTooltipWithAggregatedField) { - customTooltipWithAggregatedField = []; - } - (customTooltipWithAggregatedField as StringFieldDef[]).push(t); - } else { - if (!customTooltipWithoutAggregatedField) { - customTooltipWithoutAggregatedField = []; - } - (customTooltipWithoutAggregatedField as StringFieldDef[]).push(t); - } - } - - if (customTooltipWithAggregatedField) { - (filteredEncoding as Encoding).tooltip = customTooltipWithAggregatedField; - } - } else { - if (tooltip['aggregate']) { - (filteredEncoding as Encoding).tooltip = tooltip; - } else { - customTooltipWithoutAggregatedField = tooltip; - } - } - - if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) { - customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0]; - } - return {customTooltipWithoutAggregatedField, filteredEncoding}; -} - -export function getCompositeMarkTooltip( - tooltipSummary: CompositeMarkTooltipSummary[], - continuousAxisChannelDef: PositionFieldDef, - encodingWithoutContinuousAxis: Encoding, - withFieldName = true -): Encoding { - if ('tooltip' in encodingWithoutContinuousAxis) { - return {tooltip: encodingWithoutContinuousAxis.tooltip}; - } - - const fiveSummaryTooltip: StringFieldDef[] = tooltipSummary.map( - ({fieldPrefix, titlePrefix}): StringFieldDef => { - const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : ''; - return { - field: fieldPrefix + continuousAxisChannelDef.field, - type: continuousAxisChannelDef.type, - title: isSignalRef(titlePrefix) ? {signal: titlePrefix + `"${escape(mainTitle)}"`} : titlePrefix + mainTitle - }; - } - ); - - const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef); - - return { - tooltip: [ - ...fiveSummaryTooltip, - // need to cast because TextFieldDef supports fewer types of bin - ...unique(tooltipFieldDefs, hash) - ] - }; -} - -export function getTitle(continuousAxisChannelDef: PositionFieldDef) { - const {title, field} = continuousAxisChannelDef; - return getFirstDefined(title, field); -} - -export function makeCompositeAggregatePartFactory

>( - compositeMarkDef: GenericCompositeMarkDef & P, - continuousAxis: 'x' | 'y', - continuousAxisChannelDef: PositionFieldDef, - sharedEncoding: Encoding, - compositeMarkConfig: P -) { - const {scale, axis} = continuousAxisChannelDef; - - return ({ - partName, - mark, - positionPrefix, - endPositionPrefix = undefined, - extraEncoding = {} - }: { - partName: keyof P; - mark: Mark | MarkDef; - positionPrefix: string; - endPositionPrefix?: string; - extraEncoding?: Encoding; - }) => { - const title = getTitle(continuousAxisChannelDef); - - return partLayerMixins

(compositeMarkDef, partName, compositeMarkConfig, { - mark, // TODO better remove this method and just have mark as a parameter of the method - encoding: { - [continuousAxis]: { - field: positionPrefix + '_' + continuousAxisChannelDef.field, - type: continuousAxisChannelDef.type, - ...(title !== undefined ? {title} : {}), - ...(scale !== undefined ? {scale} : {}), - ...(axis !== undefined ? {axis} : {}) - }, - ...(isString(endPositionPrefix) - ? { - [continuousAxis + '2']: { - field: endPositionPrefix + '_' + continuousAxisChannelDef.field - } - } - : {}), - ...sharedEncoding, - ...extraEncoding - } - }); - }; -} - -export function partLayerMixins

>( - markDef: GenericCompositeMarkDef & P, - part: keyof P, - compositeMarkConfig: P, - partBaseSpec: NormalizedUnitSpec -): NormalizedUnitSpec[] { - const {clip, color, opacity} = markDef; - - const mark = markDef.type; - - if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) { - return [ - { - ...partBaseSpec, - mark: { - ...(compositeMarkConfig[part] as MarkConfig), - ...(clip ? {clip} : {}), - ...(color ? {color} : {}), - ...(opacity ? {opacity} : {}), - ...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : {type: partBaseSpec.mark}), - style: `${mark}-${part}`, - ...(isBoolean(markDef[part]) ? {} : (markDef[part] as MarkConfig)) - } - } - ]; - } - return []; -} - -export function compositeMarkContinuousAxis( - spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>, - orient: Orientation, - compositeMark: M -): { - continuousAxisChannelDef: PositionFieldDef; - continuousAxisChannelDef2: SecondaryFieldDef; - continuousAxisChannelDefError: SecondaryFieldDef; - continuousAxisChannelDefError2: SecondaryFieldDef; - continuousAxis: 'x' | 'y'; -} { - const {encoding} = spec; - const continuousAxis: 'x' | 'y' = orient === 'vertical' ? 'y' : 'x'; - - const continuousAxisChannelDef = encoding[continuousAxis] as PositionFieldDef; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal. - const continuousAxisChannelDef2 = encoding[continuousAxis + '2'] as SecondaryFieldDef; - const continuousAxisChannelDefError = encoding[continuousAxis + 'Error'] as SecondaryFieldDef; - const continuousAxisChannelDefError2 = encoding[continuousAxis + 'Error2'] as SecondaryFieldDef; - - return { - continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark), - continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark), - continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark), - continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark), - continuousAxis - }; -} - -function filterAggregateFromChannelDef>( - continuousAxisChannelDef: F, - compositeMark: M -): F { - if (continuousAxisChannelDef && continuousAxisChannelDef.aggregate) { - const {aggregate, ...continuousAxisWithoutAggregate} = continuousAxisChannelDef; - if (aggregate !== compositeMark) { - log.warn(log.message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark)); - } - return continuousAxisWithoutAggregate as F; - } else { - return continuousAxisChannelDef; - } -} - -export function compositeMarkOrient( - spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>, - compositeMark: M -): Orientation { - const {mark, encoding} = spec; - const {x, y} = encoding; - - if (isMarkDef(mark) && mark.orient) { - return mark.orient; - } - - if (isContinuousFieldOrDatumDef(x)) { - // x is continuous - if (isContinuousFieldOrDatumDef(y)) { - // both x and y are continuous - const xAggregate = isFieldDef(x) && x.aggregate; - const yAggregate = isFieldDef(y) && y.aggregate; - - if (!xAggregate && yAggregate === compositeMark) { - return 'vertical'; - } else if (!yAggregate && xAggregate === compositeMark) { - return 'horizontal'; - } else if (xAggregate === compositeMark && yAggregate === compositeMark) { - throw new Error('Both x and y cannot have aggregate'); - } else { - if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) { - // y is temporal but x is not - return 'horizontal'; - } - - // default orientation for two continuous - return 'vertical'; - } - } - - return 'horizontal'; - } else if (isContinuousFieldOrDatumDef(y)) { - // y is continuous but x is not - return 'vertical'; - } else { - // Neither x nor y is continuous. - throw new Error(`Need a valid continuous axis for ${compositeMark}s`); - } -} diff --git a/node_modules/vega-lite/src/compositemark/errorband.ts b/node_modules/vega-lite/src/compositemark/errorband.ts deleted file mode 100644 index 16f790d..0000000 --- a/node_modules/vega-lite/src/compositemark/errorband.ts +++ /dev/null @@ -1,174 +0,0 @@ -import {Interpolate, Orientation} from 'vega'; -import {Field} from '../channeldef'; -import {Encoding, normalizeEncoding} from '../encoding'; -import * as log from '../log'; -import {MarkDef} from '../mark'; -import {NormalizerParams} from '../normalize'; -import {GenericUnitSpec, NormalizedLayerSpec} from '../spec'; -import {CompositeMarkNormalizer} from './base'; -import {GenericCompositeMarkDef, makeCompositeAggregatePartFactory, PartsMixins} from './common'; -import {ErrorBarCenter, ErrorBarExtent, errorBarParams, ErrorEncoding} from './errorbar'; - -export type ErrorBandUnitSpec< - EE = undefined // extra encoding parameter (for faceted composite unit spec) -> = GenericUnitSpec & EE, ErrorBand | ErrorBandDef>; - -export const ERRORBAND = 'errorband' as const; -export type ErrorBand = typeof ERRORBAND; - -export const ERRORBAND_PARTS = ['band', 'borders'] as const; - -type ErrorBandPart = typeof ERRORBAND_PARTS[number]; - -export type ErrorBandPartsMixins = PartsMixins; - -export interface ErrorBandConfig extends ErrorBandPartsMixins { - /** - * The center of the error band. Available options include: - * - `"mean"`: the mean of the data points. - * - `"median"`: the median of the data points. - * - * __Default value:__ `"mean"`. - * @hidden - */ - - // center is not needed right now but will be added back to the schema if future features require it. - center?: ErrorBarCenter; - - /** - * The extent of the band. Available options include: - * - `"ci"`: Extend the band to the confidence interval of the mean. - * - `"stderr"`: The size of band are set to the value of standard error, extending from the mean. - * - `"stdev"`: The size of band are set to the value of standard deviation, extending from the mean. - * - `"iqr"`: Extend the band to the q1 and q3. - * - * __Default value:__ `"stderr"`. - */ - extent?: ErrorBarExtent; - - /** - * The line interpolation method for the error band. One of the following: - * - `"linear"`: piecewise linear segments, as in a polyline. - * - `"linear-closed"`: close the linear segments to form a polygon. - * - `"step"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes at the midpoint of each pair of adjacent x-values. - * - `"step-before"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes before the x-value. - * - `"step-after"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes after the x-value. - * - `"basis"`: a B-spline, with control point duplication on the ends. - * - `"basis-open"`: an open B-spline; may not intersect the start or end. - * - `"basis-closed"`: a closed B-spline, as in a loop. - * - `"cardinal"`: a Cardinal spline, with control point duplication on the ends. - * - `"cardinal-open"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points. - * - `"cardinal-closed"`: a closed Cardinal spline, as in a loop. - * - `"bundle"`: equivalent to basis, except the tension parameter is used to straighten the spline. - * - `"monotone"`: cubic interpolation that preserves monotonicity in y. - */ - interpolate?: Interpolate; - - /** - * The tension parameter for the interpolation type of the error band. - * - * @minimum 0 - * @maximum 1 - */ - tension?: number; -} - -export type ErrorBandDef = GenericCompositeMarkDef & - ErrorBandConfig & { - /** - * Orientation of the error band. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined. - */ - orient?: Orientation; - }; - -export interface ErrorBandConfigMixins { - /** - * ErrorBand Config - */ - errorband?: ErrorBandConfig; -} - -export const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand); - -export function normalizeErrorBand( - spec: GenericUnitSpec, ErrorBand | ErrorBandDef>, - {config}: NormalizerParams -): NormalizedLayerSpec { - // Need to initEncoding first so we can infer type - spec = { - ...spec, - encoding: normalizeEncoding(spec.encoding, config) - }; - - const { - transform, - continuousAxisChannelDef, - continuousAxis, - encodingWithoutContinuousAxis, - markDef, - outerSpec, - tooltipEncoding - } = errorBarParams(spec, ERRORBAND, config); - const errorBandDef: ErrorBandDef = markDef; - - const makeErrorBandPart = makeCompositeAggregatePartFactory( - errorBandDef, - continuousAxis, - continuousAxisChannelDef, - encodingWithoutContinuousAxis, - config.errorband - ); - - const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined; - - let bandMark: MarkDef = {type: is2D ? 'area' : 'rect'}; - let bordersMark: MarkDef = {type: is2D ? 'line' : 'rule'}; - const interpolate = { - ...(errorBandDef.interpolate ? {interpolate: errorBandDef.interpolate} : {}), - ...(errorBandDef.tension && errorBandDef.interpolate ? {tension: errorBandDef.tension} : {}) - }; - - if (is2D) { - bandMark = { - ...bandMark, - ...interpolate, - ariaRoleDescription: 'errorband' - }; - bordersMark = { - ...bordersMark, - ...interpolate, - aria: false - }; - } else if (errorBandDef.interpolate) { - log.warn(log.message.errorBand1DNotSupport('interpolate')); - } else if (errorBandDef.tension) { - log.warn(log.message.errorBand1DNotSupport('tension')); - } - - return { - ...outerSpec, - transform, - layer: [ - ...makeErrorBandPart({ - partName: 'band', - mark: bandMark, - positionPrefix: 'lower', - endPositionPrefix: 'upper', - extraEncoding: tooltipEncoding - }), - ...makeErrorBandPart({ - partName: 'borders', - mark: bordersMark, - positionPrefix: 'lower', - - extraEncoding: tooltipEncoding - }), - ...makeErrorBandPart({ - partName: 'borders', - mark: bordersMark, - positionPrefix: 'upper', - extraEncoding: tooltipEncoding - }) - ] - }; -} diff --git a/node_modules/vega-lite/src/compositemark/errorbar.ts b/node_modules/vega-lite/src/compositemark/errorbar.ts deleted file mode 100644 index e5e57e7..0000000 --- a/node_modules/vega-lite/src/compositemark/errorbar.ts +++ /dev/null @@ -1,555 +0,0 @@ -import {AggregateOp, Orientation, Text} from 'vega'; -import {PositionChannel} from '../channel'; -import { - Field, - isContinuousFieldOrDatumDef, - isFieldOrDatumDef, - PositionFieldDef, - SecondaryFieldDef, - title, - ValueDef -} from '../channeldef'; -import {Config} from '../config'; -import {Data} from '../data'; -import {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding'; -import * as log from '../log'; -import {isMarkDef, MarkDef} from '../mark'; -import {NormalizerParams} from '../normalize'; -import {GenericUnitSpec, NormalizedLayerSpec} from '../spec'; -import {Step} from '../spec/base'; -import {NormalizedUnitSpec} from '../spec/unit'; -import {TitleParams} from '../title'; -import {AggregatedFieldDef, CalculateTransform, Transform} from '../transform'; -import {replaceAll, titleCase} from '../util'; -import {CompositeMarkNormalizer} from './base'; -import { - compositeMarkContinuousAxis, - compositeMarkOrient, - CompositeMarkTooltipSummary, - GenericCompositeMarkDef, - getCompositeMarkTooltip, - makeCompositeAggregatePartFactory, - PartsMixins -} from './common'; -import {ErrorBand, ErrorBandDef} from './errorband'; - -export const ERRORBAR = 'errorbar' as const; -export type ErrorBar = typeof ERRORBAR; - -export type ErrorBarExtent = 'ci' | 'iqr' | 'stderr' | 'stdev'; -export type ErrorBarCenter = 'mean' | 'median'; - -export type ErrorInputType = 'raw' | 'aggregated-upper-lower' | 'aggregated-error'; - -export const ERRORBAR_PARTS = ['ticks', 'rule'] as const; - -export type ErrorBarPart = typeof ERRORBAR_PARTS[number]; - -export interface ErrorExtraEncoding { - /** - * Error value of x coordinates for error specified `"errorbar"` and `"errorband"`. - */ - xError?: SecondaryFieldDef | ValueDef; - - /** - * Secondary error value of x coordinates for error specified `"errorbar"` and `"errorband"`. - */ - // `xError2` cannot have type as it should have the same type as `xError` - xError2?: SecondaryFieldDef | ValueDef; - - /** - * Error value of y coordinates for error specified `"errorbar"` and `"errorband"`. - */ - yError?: SecondaryFieldDef | ValueDef; - - /** - * Secondary error value of y coordinates for error specified `"errorbar"` and `"errorband"`. - */ - // `yError2` cannot have type as it should have the same type as `yError` - yError2?: SecondaryFieldDef | ValueDef; -} - -export type ErrorEncoding = Pick, PositionChannel | 'color' | 'detail' | 'opacity'> & - ErrorExtraEncoding; - -export type ErrorBarPartsMixins = PartsMixins; - -export interface ErrorBarConfig extends ErrorBarPartsMixins { - /** - * The center of the errorbar. Available options include: - * - `"mean"`: the mean of the data points. - * - `"median"`: the median of the data points. - * - * __Default value:__ `"mean"`. - * @hidden - */ - - // center is not needed right now but will be added back to the schema if future features require it. - center?: ErrorBarCenter; - - /** - * The extent of the rule. Available options include: - * - `"ci"`: Extend the rule to the confidence interval of the mean. - * - `"stderr"`: The size of rule are set to the value of standard error, extending from the mean. - * - `"stdev"`: The size of rule are set to the value of standard deviation, extending from the mean. - * - `"iqr"`: Extend the rule to the q1 and q3. - * - * __Default value:__ `"stderr"`. - */ - extent?: ErrorBarExtent; -} - -export type ErrorBarDef = GenericCompositeMarkDef & - ErrorBarConfig & { - /** - * Orientation of the error bar. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined. - */ - orient?: Orientation; - }; - -export interface ErrorBarConfigMixins { - /** - * ErrorBar Config - */ - errorbar?: ErrorBarConfig; -} - -export const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar); - -export function normalizeErrorBar( - spec: GenericUnitSpec, ErrorBar | ErrorBarDef>, - {config}: NormalizerParams -): NormalizedLayerSpec | NormalizedUnitSpec { - // Need to initEncoding first so we can infer type - spec = { - ...spec, - encoding: normalizeEncoding(spec.encoding, config) - }; - - const { - transform, - continuousAxisChannelDef, - continuousAxis, - encodingWithoutContinuousAxis, - ticksOrient, - markDef, - outerSpec, - tooltipEncoding - } = errorBarParams(spec, ERRORBAR, config); - - const makeErrorBarPart = makeCompositeAggregatePartFactory( - markDef, - continuousAxis, - continuousAxisChannelDef, - encodingWithoutContinuousAxis, - config.errorbar - ); - - const tick: MarkDef = {type: 'tick', orient: ticksOrient, aria: false}; - - const layer = [ - ...makeErrorBarPart({ - partName: 'ticks', - mark: tick, - positionPrefix: 'lower', - extraEncoding: tooltipEncoding - }), - ...makeErrorBarPart({ - partName: 'ticks', - mark: tick, - positionPrefix: 'upper', - extraEncoding: tooltipEncoding - }), - ...makeErrorBarPart({ - partName: 'rule', - mark: { - type: 'rule', - ariaRoleDescription: 'errorbar' - }, - positionPrefix: 'lower', - endPositionPrefix: 'upper', - extraEncoding: tooltipEncoding - }) - ]; - - return { - ...outerSpec, - transform, - ...(layer.length > 1 ? {layer} : {...layer[0]}) - }; -} - -function errorBarOrientAndInputType( - spec: GenericUnitSpec, ErrorBar | ErrorBand | ErrorBarDef | ErrorBandDef>, - compositeMark: ErrorBar | ErrorBand -): { - orient: Orientation; - inputType: ErrorInputType; -} { - const {encoding} = spec; - - if (errorBarIsInputTypeRaw(encoding)) { - return { - orient: compositeMarkOrient(spec, compositeMark), - inputType: 'raw' - }; - } - - const isTypeAggregatedUpperLower: boolean = errorBarIsInputTypeAggregatedUpperLower(encoding); - const isTypeAggregatedError: boolean = errorBarIsInputTypeAggregatedError(encoding); - const x = encoding.x; - const y = encoding.y; - - if (isTypeAggregatedUpperLower) { - // type is aggregated-upper-lower - - if (isTypeAggregatedError) { - throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`); - } - - const x2 = encoding.x2; - const y2 = encoding.y2; - - if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) { - // having both x, x2 and y, y2 - throw new Error(`${compositeMark} cannot have both x2 and y2`); - } else if (isFieldOrDatumDef(x2)) { - if (isContinuousFieldOrDatumDef(x)) { - // having x, x2 quantitative and field y, y2 are not specified - return {orient: 'horizontal', inputType: 'aggregated-upper-lower'}; - } else { - // having x, x2 that are not both quantitative - throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`); - } - } else if (isFieldOrDatumDef(y2)) { - // y2 is a FieldDef - if (isContinuousFieldOrDatumDef(y)) { - // having y, y2 quantitative and field x, x2 are not specified - return {orient: 'vertical', inputType: 'aggregated-upper-lower'}; - } else { - // having y, y2 that are not both quantitative - throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`); - } - } - throw new Error('No ranged axis'); - } else { - // type is aggregated-error - - const xError = encoding.xError; - const xError2 = encoding.xError2; - const yError = encoding.yError; - const yError2 = encoding.yError2; - - if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) { - // having xError2 without xError - throw new Error(`${compositeMark} cannot have xError2 without xError`); - } - - if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) { - // having yError2 without yError - throw new Error(`${compositeMark} cannot have yError2 without yError`); - } - - if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) { - // having both xError and yError - throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`); - } else if (isFieldOrDatumDef(xError)) { - if (isContinuousFieldOrDatumDef(x)) { - // having x and xError that are all quantitative - return {orient: 'horizontal', inputType: 'aggregated-error'}; - } else { - // having x, xError, and xError2 that are not all quantitative - throw new Error('All x, xError, and xError2 (if exist) have to be quantitative'); - } - } else if (isFieldOrDatumDef(yError)) { - if (isContinuousFieldOrDatumDef(y)) { - // having y and yError that are all quantitative - return {orient: 'vertical', inputType: 'aggregated-error'}; - } else { - // having y, yError, and yError2 that are not all quantitative - throw new Error('All y, yError, and yError2 (if exist) have to be quantitative'); - } - } - throw new Error('No ranged axis'); - } -} - -function errorBarIsInputTypeRaw(encoding: ErrorEncoding): boolean { - return ( - (isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) && - !isFieldOrDatumDef(encoding.x2) && - !isFieldOrDatumDef(encoding.y2) && - !isFieldOrDatumDef(encoding.xError) && - !isFieldOrDatumDef(encoding.xError2) && - !isFieldOrDatumDef(encoding.yError) && - !isFieldOrDatumDef(encoding.yError2) - ); -} - -function errorBarIsInputTypeAggregatedUpperLower(encoding: ErrorEncoding): boolean { - return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2); -} - -function errorBarIsInputTypeAggregatedError(encoding: ErrorEncoding): boolean { - return ( - isFieldOrDatumDef(encoding.xError) || - isFieldOrDatumDef(encoding.xError2) || - isFieldOrDatumDef(encoding.yError) || - isFieldOrDatumDef(encoding.yError2) - ); -} - -export function errorBarParams< - M extends ErrorBar | ErrorBand, - MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef) ->( - spec: GenericUnitSpec, M | MD>, - compositeMark: M, - config: Config -): { - transform: Transform[]; - groupby: string[]; - continuousAxisChannelDef: PositionFieldDef; - continuousAxis: 'x' | 'y'; - encodingWithoutContinuousAxis: ErrorEncoding; - ticksOrient: Orientation; - markDef: MD; - outerSpec: { - data?: Data; - title?: Text | TitleParams; - name?: string; - description?: string; - transform?: Transform[]; - width?: number | 'container' | Step; - height?: number | 'container' | Step; - }; - tooltipEncoding: ErrorEncoding; -} { - // TODO: use selection - const {mark, encoding, selection, projection: _p, ...outerSpec} = spec; - const markDef: MD = isMarkDef(mark) ? mark : ({type: mark} as MD); - - // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - if (selection) { - log.warn(log.message.selectionNotSupported(compositeMark)); - } - - const {orient, inputType} = errorBarOrientAndInputType(spec, compositeMark); - const { - continuousAxisChannelDef, - continuousAxisChannelDef2, - continuousAxisChannelDefError, - continuousAxisChannelDefError2, - continuousAxis - } = compositeMarkContinuousAxis(spec, orient, compositeMark); - - const { - errorBarSpecificAggregate, - postAggregateCalculates, - tooltipSummary, - tooltipTitleWithFieldName - } = errorBarAggregationAndCalculation( - markDef, - continuousAxisChannelDef, - continuousAxisChannelDef2, - continuousAxisChannelDefError, - continuousAxisChannelDefError2, - inputType, - compositeMark, - config - ); - - const { - [continuousAxis]: oldContinuousAxisChannelDef, - [continuousAxis === 'x' ? 'x2' : 'y2']: oldContinuousAxisChannelDef2, - [continuousAxis === 'x' ? 'xError' : 'yError']: oldContinuousAxisChannelDefError, - [continuousAxis === 'x' ? 'xError2' : 'yError2']: oldContinuousAxisChannelDefError2, - ...oldEncodingWithoutContinuousAxis - } = encoding; - - const { - bins, - timeUnits, - aggregate: oldAggregate, - groupby: oldGroupBy, - encoding: encodingWithoutContinuousAxis - } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config); - - const aggregate: AggregatedFieldDef[] = [...oldAggregate, ...errorBarSpecificAggregate]; - const groupby: string[] = inputType !== 'raw' ? [] : oldGroupBy; - - const tooltipEncoding: ErrorEncoding = getCompositeMarkTooltip( - tooltipSummary, - continuousAxisChannelDef, - encodingWithoutContinuousAxis, - tooltipTitleWithFieldName - ); - - return { - transform: [ - ...(outerSpec.transform ?? []), - ...bins, - ...timeUnits, - ...(aggregate.length === 0 ? [] : [{aggregate, groupby}]), - ...postAggregateCalculates - ], - groupby, - continuousAxisChannelDef, - continuousAxis, - encodingWithoutContinuousAxis, - ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical', - markDef, - outerSpec, - tooltipEncoding - }; -} - -function errorBarAggregationAndCalculation< - M extends ErrorBar | ErrorBand, - MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef) ->( - markDef: MD, - continuousAxisChannelDef: PositionFieldDef, - continuousAxisChannelDef2: SecondaryFieldDef, - continuousAxisChannelDefError: SecondaryFieldDef, - continuousAxisChannelDefError2: SecondaryFieldDef, - inputType: ErrorInputType, - compositeMark: M, - config: Config -): { - postAggregateCalculates: CalculateTransform[]; - errorBarSpecificAggregate: AggregatedFieldDef[]; - tooltipSummary: CompositeMarkTooltipSummary[]; - tooltipTitleWithFieldName: boolean; -} { - let errorBarSpecificAggregate: AggregatedFieldDef[] = []; - let postAggregateCalculates: CalculateTransform[] = []; - const continuousFieldName: string = continuousAxisChannelDef.field; - - let tooltipSummary: CompositeMarkTooltipSummary[]; - let tooltipTitleWithFieldName = false; - - if (inputType === 'raw') { - const center: ErrorBarCenter = markDef.center - ? markDef.center - : markDef.extent - ? markDef.extent === 'iqr' - ? 'median' - : 'mean' - : config.errorbar.center; - const extent: ErrorBarExtent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr'; - - if ((center === 'median') !== (extent === 'iqr')) { - log.warn(log.message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark)); - } - - if (extent === 'stderr' || extent === 'stdev') { - errorBarSpecificAggregate = [ - {op: extent, field: continuousFieldName, as: 'extent_' + continuousFieldName}, - {op: center, field: continuousFieldName, as: 'center_' + continuousFieldName} - ]; - - postAggregateCalculates = [ - { - calculate: `datum["center_${continuousFieldName}"] + datum["extent_${continuousFieldName}"]`, - as: 'upper_' + continuousFieldName - }, - { - calculate: `datum["center_${continuousFieldName}"] - datum["extent_${continuousFieldName}"]`, - as: 'lower_' + continuousFieldName - } - ]; - - tooltipSummary = [ - {fieldPrefix: 'center_', titlePrefix: titleCase(center)}, - {fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+')}, - {fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-')} - ]; - tooltipTitleWithFieldName = true; - } else { - let centerOp: AggregateOp; - let lowerExtentOp: AggregateOp; - let upperExtentOp: AggregateOp; - if (extent === 'ci') { - centerOp = 'mean'; - lowerExtentOp = 'ci0'; - upperExtentOp = 'ci1'; - } else { - centerOp = 'median'; - lowerExtentOp = 'q1'; - upperExtentOp = 'q3'; - } - - errorBarSpecificAggregate = [ - {op: lowerExtentOp, field: continuousFieldName, as: 'lower_' + continuousFieldName}, - {op: upperExtentOp, field: continuousFieldName, as: 'upper_' + continuousFieldName}, - {op: centerOp, field: continuousFieldName, as: 'center_' + continuousFieldName} - ]; - - tooltipSummary = [ - { - fieldPrefix: 'upper_', - titlePrefix: title({field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative'}, config, { - allowDisabling: false - }) - }, - { - fieldPrefix: 'lower_', - titlePrefix: title({field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative'}, config, { - allowDisabling: false - }) - }, - { - fieldPrefix: 'center_', - titlePrefix: title({field: continuousFieldName, aggregate: centerOp, type: 'quantitative'}, config, { - allowDisabling: false - }) - } - ]; - } - } else { - if (markDef.center || markDef.extent) { - log.warn(log.message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent)); - } - - if (inputType === 'aggregated-upper-lower') { - tooltipSummary = []; - postAggregateCalculates = [ - {calculate: `datum["${continuousAxisChannelDef2.field}"]`, as: 'upper_' + continuousFieldName}, - {calculate: `datum["${continuousFieldName}"]`, as: 'lower_' + continuousFieldName} - ]; - } else if (inputType === 'aggregated-error') { - tooltipSummary = [{fieldPrefix: '', titlePrefix: continuousFieldName}]; - postAggregateCalculates = [ - { - calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError.field}"]`, - as: 'upper_' + continuousFieldName - } - ]; - - if (continuousAxisChannelDefError2) { - postAggregateCalculates.push({ - calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError2.field}"]`, - as: 'lower_' + continuousFieldName - }); - } else { - postAggregateCalculates.push({ - calculate: `datum["${continuousFieldName}"] - datum["${continuousAxisChannelDefError.field}"]`, - as: 'lower_' + continuousFieldName - }); - } - } - - for (const postAggregateCalculate of postAggregateCalculates) { - tooltipSummary.push({ - fieldPrefix: postAggregateCalculate.as.substring(0, 6), - titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum["', ''), '"]', '') - }); - } - } - return {postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName}; -} - -function getTitlePrefix(center: ErrorBarCenter, extent: ErrorBarExtent, operation: '+' | '-'): string { - return titleCase(center) + ' ' + operation + ' ' + extent; -} diff --git a/node_modules/vega-lite/src/compositemark/index.ts b/node_modules/vega-lite/src/compositemark/index.ts deleted file mode 100644 index 25fc4ec..0000000 --- a/node_modules/vega-lite/src/compositemark/index.ts +++ /dev/null @@ -1,85 +0,0 @@ -import {Field} from '../channeldef'; -import {Encoding} from '../encoding'; -import {NormalizerParams} from '../normalize'; -import {GenericUnitSpec, NormalizedLayerSpec} from '../spec'; -import {EncodingFacetMapping} from '../spec/facet'; -import {NormalizedUnitSpec} from '../spec/unit'; -import {keys} from '../util'; -import {CompositeMarkNormalizer} from './base'; -import {BOXPLOT, BoxPlot, BoxPlotConfigMixins, BoxPlotDef, BOXPLOT_PARTS, normalizeBoxPlot} from './boxplot'; -import { - ERRORBAND, - ErrorBand, - ErrorBandConfigMixins, - ErrorBandDef, - ERRORBAND_PARTS, - normalizeErrorBand -} from './errorband'; -import { - ERRORBAR, - ErrorBar, - ErrorBarConfigMixins, - ErrorBarDef, - ERRORBAR_PARTS, - ErrorExtraEncoding, - normalizeErrorBar -} from './errorbar'; - -export {BoxPlotConfig} from './boxplot'; -export {ErrorBandConfigMixins} from './errorband'; -export {ErrorBarConfigMixins} from './errorbar'; - -export type CompositeMarkNormalizerRun = ( - spec: GenericUnitSpec, - params: NormalizerParams -) => NormalizedLayerSpec | NormalizedUnitSpec; - -/** - * Registry index for all composite mark's normalizer - */ -const compositeMarkRegistry: { - [mark: string]: { - normalizer: CompositeMarkNormalizer; - parts: readonly string[]; - }; -} = {}; - -export function add(mark: string, run: CompositeMarkNormalizerRun, parts: readonly string[]) { - const normalizer = new CompositeMarkNormalizer(mark, run); - compositeMarkRegistry[mark] = {normalizer, parts}; -} - -export function remove(mark: string) { - delete compositeMarkRegistry[mark]; -} - -export type CompositeEncoding = Encoding & ErrorExtraEncoding; - -export type PartialIndex> = { - [t in keyof T]?: Partial; -}; - -export type SharedCompositeEncoding = PartialIndex< - Omit, 'detail' | 'order' | 'tooltip'> // need to omit and cherry pick detail / order / tooltip since they allow array -> & - Pick, 'detail' | 'order' | 'tooltip'>; - -export type FacetedCompositeEncoding = Encoding & - ErrorExtraEncoding & - EncodingFacetMapping; - -export type CompositeMark = BoxPlot | ErrorBar | ErrorBand; - -export function getAllCompositeMarks() { - return keys(compositeMarkRegistry); -} - -export type CompositeMarkDef = BoxPlotDef | ErrorBarDef | ErrorBandDef; - -export type CompositeAggregate = BoxPlot | ErrorBar | ErrorBand; - -export interface CompositeMarkConfigMixins extends BoxPlotConfigMixins, ErrorBarConfigMixins, ErrorBandConfigMixins {} - -add(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS); -add(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS); -add(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS); diff --git a/node_modules/vega-lite/src/config.ts b/node_modules/vega-lite/src/config.ts deleted file mode 100644 index 18c47a2..0000000 --- a/node_modules/vega-lite/src/config.ts +++ /dev/null @@ -1,643 +0,0 @@ -import {Color, InitSignal, NewSignal, RangeConfig, RangeScheme, SignalRef} from 'vega'; -import {isObject, mergeConfig} from 'vega-util'; -import {Axis, AxisConfigMixins, isConditionalAxisValue} from './axis'; -import {CompositeMarkConfigMixins, getAllCompositeMarks} from './compositemark'; -import {VL_ONLY_LEGEND_CONFIG} from './guide'; -import {HeaderConfigMixins} from './header'; -import {defaultLegendConfig, LegendConfig} from './legend'; -import * as mark from './mark'; -import { - AnyMarkConfig, - Mark, - MarkConfig, - MarkConfigMixins, - PRIMITIVE_MARKS, - VL_ONLY_MARK_CONFIG_PROPERTIES, - VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX -} from './mark'; -import {ProjectionConfig} from './projection'; -import {defaultScaleConfig, ScaleConfig} from './scale'; -import {defaultConfig as defaultSelectionConfig, SelectionConfig} from './selection'; -import {BaseViewBackground, CompositionConfigMixins, DEFAULT_SPACING, isStep} from './spec/base'; -import {TopLevelProperties} from './spec/toplevel'; -import {extractTitleConfig, TitleConfig} from './title'; -import {duplicate, getFirstDefined, isEmpty} from './util'; - -export interface ViewConfig extends BaseViewBackground { - /** - * Default width - * - * __Deprecated:__ Since Vega-Lite 4.0. Please use continuousWidth and discreteWidth instead. - */ - width?: number; - - /** - * Default height - * - * __Deprecated:__ Since Vega-Lite 4.0. Please use continuousHeight and discreteHeight instead. - */ - height?: number; - - /** - * The default width when the plot has a continuous field for x or longitude, or has arc marks. - * - * __Default value:__ `200` - */ - continuousWidth?: number; - - /** - * The default width when the plot has non-arc marks and either a discrete x-field or no x-field. - * The width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. - * - * __Default value:__ a step size based on `config.view.step`. - */ - discreteWidth?: number | {step: number}; - /** - * The default height when the plot has a continuous y-field for x or latitude, or has arc marks. - * - * __Default value:__ `200` - */ - continuousHeight?: number; - - /** - * The default height when the plot has non arc marks and either a discrete y-field or no y-field. - * The height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. - * - * __Default value:__ a step size based on `config.view.step`. - */ - discreteHeight?: number | {step: number}; - - /** - * Default step size for x-/y- discrete fields. - */ - step?: number; - - /** - * Whether the view should be clipped. - */ - clip?: boolean; -} - -export function getViewConfigContinuousSize(viewConfig: ViewConfig, channel: 'width' | 'height') { - return viewConfig[channel] ?? viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility -} - -export function getViewConfigDiscreteStep(viewConfig: ViewConfig, channel: 'width' | 'height') { - const size = getViewConfigDiscreteSize(viewConfig, channel); - return isStep(size) ? size.step : DEFAULT_STEP; -} - -export function getViewConfigDiscreteSize(viewConfig: ViewConfig, channel: 'width' | 'height') { - const size = viewConfig[channel] ?? viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility - return getFirstDefined(size, {step: viewConfig.step}); -} - -export const DEFAULT_STEP = 20; - -export const defaultViewConfig: ViewConfig = { - continuousWidth: 200, - continuousHeight: 200, - step: DEFAULT_STEP -}; - -export function isVgScheme(rangeScheme: string[] | RangeScheme): rangeScheme is RangeScheme { - return rangeScheme && !!rangeScheme['scheme']; -} - -export type ColorConfig = Record; - -export type FontSizeConfig = Record; - -export interface VLOnlyConfig { - /** - * Default font for all text marks, titles, and labels. - */ - font?: string; - - /** - * Default color signals. - * - * @hidden - */ - color?: boolean | ColorConfig; - - /** - * Default font size signals. - * - * @hidden - */ - fontSize?: boolean | FontSizeConfig; - - /** - * Default axis and legend title for count fields. - * - * __Default value:__ `'Count of Records`. - * - * @type {string} - */ - countTitle?: string; - - /** - * Defines how Vega-Lite generates title for fields. There are three possible styles: - * - `"verbal"` (Default) - displays function in a verbal style (e.g., "Sum of field", "Year-month of date", "field (binned)"). - * - `"function"` - displays function using parentheses and capitalized texts (e.g., "SUM(field)", "YEARMONTH(date)", "BIN(field)"). - * - `"plain"` - displays only the field name without functions (e.g., "field", "date", "field"). - */ - fieldTitle?: 'verbal' | 'functional' | 'plain'; - - /** - * D3 Number format for guide labels and text marks. For example `"s"` for SI units. Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format). - */ - numberFormat?: string; - - /** - * Default time format for raw time values (without time units) in text marks, legend labels and header labels. - * - * __Default value:__ `"%b %d, %Y"` - * __Note:__ Axes automatically determine the format for each label automatically so this config does not affect axes. - */ - timeFormat?: string; - - /** - * Allow the `formatType` property for text marks and guides to accept a custom formatter function [registered as a Vega expression](https://vega.github.io/vega-lite/usage/compile.html#format-type). - */ - customFormatTypes?: boolean; - - /** Default properties for [single view plots](https://vega.github.io/vega-lite/docs/spec.html#single). */ - view?: ViewConfig; - - /** - * Scale configuration determines default properties for all [scales](https://vega.github.io/vega-lite/docs/scale.html). For a full list of scale configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config). - */ - scale?: ScaleConfig; - - /** An object hash for defining default properties for each type of selections. */ - selection?: SelectionConfig; -} - -export type StyleConfigIndex = Partial> & - MarkConfigMixins & { - /** - * Default style for axis, legend, and header titles. - */ - 'guide-title'?: MarkConfig; - - /** - * Default style for axis, legend, and header labels. - */ - 'guide-label'?: MarkConfig; - - /** - * Default style for chart titles - */ - 'group-title'?: MarkConfig; - - /** - * Default style for chart subtitles - */ - 'group-subtitle'?: MarkConfig; - }; - -export interface Config - extends TopLevelProperties, - VLOnlyConfig, - MarkConfigMixins, - CompositeMarkConfigMixins, - AxisConfigMixins, - HeaderConfigMixins, - CompositionConfigMixins { - /** - * An object hash that defines default range arrays or schemes for using with scales. - * For a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config). - */ - range?: RangeConfig; - - /** - * Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config). - */ - legend?: LegendConfig; - - /** - * Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config). - */ - title?: TitleConfig; - - /** - * Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config). - */ - projection?: ProjectionConfig; - - /** An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config). */ - style?: StyleConfigIndex; - - /** - * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid. - */ - lineBreak?: string | SignalRef; - - /** - * A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the `"aria-hidden"` attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks. - * - * __Default value:__ `true`. - */ - aria?: boolean; - - /** - * @hidden - */ - signals?: (InitSignal | NewSignal)[]; -} - -export const defaultConfig: Config = { - background: 'white', - - padding: 5, - timeFormat: '%b %d, %Y', - countTitle: 'Count of Records', - - view: defaultViewConfig, - - mark: mark.defaultMarkConfig, - - arc: {}, - area: {}, - bar: mark.defaultBarConfig, - circle: {}, - geoshape: {}, - image: {}, - line: {}, - point: {}, - rect: mark.defaultRectConfig, - rule: {color: 'black'}, // Need this to override default color in mark config - square: {}, - text: {color: 'black'}, // Need this to override default color in mark config - tick: mark.defaultTickConfig, - trail: {}, - - boxplot: { - size: 14, - extent: 1.5, - box: {}, - median: {color: 'white'}, - outliers: {}, - rule: {}, - ticks: null - }, - - errorbar: { - center: 'mean', - rule: true, - ticks: false - }, - - errorband: { - band: { - opacity: 0.3 - }, - borders: false - }, - - scale: defaultScaleConfig, - - projection: {}, - - legend: defaultLegendConfig, - header: {titlePadding: 10, labelPadding: 10}, - headerColumn: {}, - headerRow: {}, - headerFacet: {}, - - selection: defaultSelectionConfig, - style: {}, - - title: {}, - - facet: {spacing: DEFAULT_SPACING}, - concat: {spacing: DEFAULT_SPACING} -}; - -// Tableau10 color palette, copied from `vegaScale.scheme('tableau10')` -const tab10 = [ - '#4c78a8', - '#f58518', - '#e45756', - '#72b7b2', - '#54a24b', - '#eeca3b', - '#b279a2', - '#ff9da6', - '#9d755d', - '#bab0ac' -]; - -export const DEFAULT_FONT_SIZE = { - text: 11, - guideLabel: 10, - guideTitle: 11, - groupTitle: 13, - groupSubtitle: 12 -}; - -export const DEFAULT_COLOR = { - blue: tab10[0], - orange: tab10[1], - red: tab10[2], - teal: tab10[3], - green: tab10[4], - yellow: tab10[5], - purple: tab10[6], - pink: tab10[7], - brown: tab10[8], - gray0: '#000', - gray1: '#111', - gray2: '#222', - gray3: '#333', - gray4: '#444', - gray5: '#555', - gray6: '#666', - gray7: '#777', - gray8: '#888', - gray9: '#999', - gray10: '#aaa', - gray11: '#bbb', - gray12: '#ccc', - gray13: '#ddd', - gray14: '#eee', - gray15: '#fff' -}; - -export function colorSignalConfig(color: boolean | ColorConfig = {}): Config { - return { - signals: [ - { - name: 'color', - value: isObject(color) ? {...DEFAULT_COLOR, ...color} : DEFAULT_COLOR - } - ], - mark: {color: {signal: 'color.blue'}}, - rule: {color: {signal: 'color.gray0'}}, - text: { - color: {signal: 'color.gray0'} - }, - style: { - 'guide-label': { - fill: {signal: 'color.gray0'} - }, - 'guide-title': { - fill: {signal: 'color.gray0'} - }, - 'group-title': { - fill: {signal: 'color.gray0'} - }, - 'group-subtitle': { - fill: {signal: 'color.gray0'} - }, - cell: { - stroke: {signal: 'color.gray8'} - } - }, - axis: { - domainColor: {signal: 'color.gray13'}, - gridColor: {signal: 'color.gray8'}, - tickColor: {signal: 'color.gray13'} - }, - range: { - category: [ - {signal: 'color.blue'}, - {signal: 'color.orange'}, - {signal: 'color.red'}, - {signal: 'color.teal'}, - {signal: 'color.green'}, - {signal: 'color.yellow'}, - {signal: 'color.purple'}, - {signal: 'color.pink'}, - {signal: 'color.brown'}, - {signal: 'color.grey8'} - ] - } - }; -} - -export function fontSizeSignalConfig(fontSize: boolean | FontSizeConfig): Config { - return { - signals: [ - { - name: 'fontSize', - value: isObject(fontSize) ? {...DEFAULT_FONT_SIZE, ...fontSize} : DEFAULT_FONT_SIZE - } - ], - text: { - fontSize: {signal: 'fontSize.text'} - }, - style: { - 'guide-label': { - fontSize: {signal: 'fontSize.guideLabel'} - }, - 'guide-title': { - fontSize: {signal: 'fontSize.guideTitle'} - }, - 'group-title': { - fontSize: {signal: 'fontSize.groupTitle'} - }, - 'group-subtitle': { - fontSize: {signal: 'fontSize.groupSubtitle'} - } - } - }; -} - -export function fontConfig(font: string): Config { - return { - text: {font}, - style: { - 'guide-label': {font}, - 'guide-title': {font}, - 'group-title': {font}, - 'group-subtitle': {font} - } - }; -} - -export function initConfig(config: Config = {}) { - const {color, font, fontSize, ...restConfig} = config; - - return mergeConfig( - {}, - defaultConfig, - font ? fontConfig(font) : {}, - color ? colorSignalConfig(color) : {}, - fontSize ? fontSizeSignalConfig(fontSize) : {}, - restConfig || {} - ); -} - -const MARK_STYLES = ['view', ...PRIMITIVE_MARKS] as ('view' | Mark)[]; - -const VL_ONLY_CONFIG_PROPERTIES: (keyof Config)[] = [ - 'color', - 'fontSize', - 'background', // We apply background to the spec directly. - 'padding', - 'facet', - 'concat', - 'numberFormat', - 'timeFormat', - 'countTitle', - 'header', - - 'axisQuantitative', - 'axisTemporal', - 'axisDiscrete', - 'axisPoint', - - 'axisXBand', - 'axisXPoint', - 'axisXDiscrete', - 'axisXQuantitative', - 'axisXTemporal', - - 'axisYBand', - 'axisYPoint', - 'axisYDiscrete', - 'axisYQuantitative', - 'axisYTemporal', - - 'scale', - 'selection', - 'overlay' as keyof Config // FIXME: Redesign and unhide this -]; - -const VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = { - view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'], - ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX -}; - -export function stripAndRedirectConfig(config: Config) { - config = duplicate(config); - - for (const prop of VL_ONLY_CONFIG_PROPERTIES) { - delete config[prop]; - } - - if (config.axis) { - // delete condition axis config - for (const prop in config.axis) { - if (isConditionalAxisValue(config.axis[prop])) { - delete config.axis[prop]; - } - } - } - - if (config.legend) { - for (const prop of VL_ONLY_LEGEND_CONFIG) { - delete config.legend[prop]; - } - } - - // Remove Vega-Lite only generic mark config - if (config.mark) { - for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { - delete config.mark[prop]; - } - - if (config.mark.tooltip && isObject(config.mark.tooltip)) { - delete config.mark.tooltip; - } - } - - for (const markType of MARK_STYLES) { - // Remove Vega-Lite-only mark config - for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { - delete config[markType][prop]; - } - - // Remove Vega-Lite only mark-specific config - const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType]; - if (vlOnlyMarkSpecificConfigs) { - for (const prop of vlOnlyMarkSpecificConfigs) { - delete config[markType][prop]; - } - } - - // Redirect mark config to config.style so that mark config only affect its own mark type - // without affecting other marks that share the same underlying Vega marks. - // For example, config.rect should not affect bar marks. - redirectConfigToStyleConfig(config, markType); - } - - for (const m of getAllCompositeMarks()) { - // Clean up the composite mark config as we don't need them in the output specs anymore - delete config[m]; - } - - redirectTitleConfig(config); - - // Remove empty config objects. - for (const prop in config) { - if (isObject(config[prop]) && isEmpty(config[prop])) { - delete config[prop]; - } - } - - return isEmpty(config) ? undefined : config; -} - -/** - * - * Redirect config.title -- so that title config do not affect header labels, - * which also uses `title` directive to implement. - * - * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles. - */ -function redirectTitleConfig(config: Config) { - const {titleMarkConfig, subtitleMarkConfig, subtitle} = extractTitleConfig(config.title); - - // set config.style if title/subtitleMarkConfig is not an empty object - if (!isEmpty(titleMarkConfig)) { - config.style['group-title'] = { - ...config.style['group-title'], - ...titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega - }; - } - if (!isEmpty(subtitleMarkConfig)) { - config.style['group-subtitle'] = { - ...config.style['group-subtitle'], - ...subtitleMarkConfig - }; - } - - // subtitle part can stay in config.title since header titles do not use subtitle - if (!isEmpty(subtitle)) { - config.title = subtitle; - } else { - delete config.title; - } -} - -function redirectConfigToStyleConfig( - config: Config, - prop: Mark | 'view' | string, // string = composite mark - toProp?: string, - compositeMarkPart?: string -) { - const propConfig: MarkConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop]; - - if (prop === 'view') { - toProp = 'cell'; // View's default style is "cell" - } - - const style: MarkConfig = { - ...propConfig, - ...(config.style[toProp ?? prop] as MarkConfig) - }; - - // set config.style if it is not an empty object - if (!isEmpty(style)) { - config.style[toProp ?? prop] = style; - } - - if (!compositeMarkPart) { - // For composite mark, so don't delete the whole config yet as we have to do multiple redirections. - delete config[prop]; - } -} diff --git a/node_modules/vega-lite/src/data.ts b/node_modules/vega-lite/src/data.ts deleted file mode 100644 index 8156fa6..0000000 --- a/node_modules/vega-lite/src/data.ts +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Constants and utilities for data. - */ -import {Vector2} from 'vega'; -import {FieldName} from './channeldef'; -import {VgData} from './vega.schema'; - -export type ParseValue = null | string | 'string' | 'boolean' | 'date' | 'number'; - -export interface Parse { - [field: string]: ParseValue; -} - -export interface DataFormatBase { - /** - * If set to `null`, disable type inference based on the spec and only use type inference based on the data. - * Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `"number"`, `"boolean"`, `"date"`, or null (do not parse the field)). - * For example, `"parse": {"modified_on": "date"}` parses the `modified_on` field in each input record a Date value. - * - * For `"date"`, we parse data based using Javascript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse). - * For Specific date formats can be provided (e.g., `{foo: "date:'%m%d%Y'"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: "utc:'%m%d%Y'"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc) - */ - parse?: Parse | null; - - /** - * Type of input data: `"json"`, `"csv"`, `"tsv"`, `"dsv"`. - * - * __Default value:__ The default format type is determined by the extension of the file URL. - * If no extension is detected, `"json"` will be used by default. - */ - type?: 'csv' | 'tsv' | 'dsv' | 'json' | 'topojson'; -} - -export interface CsvDataFormat extends DataFormatBase { - type?: 'csv' | 'tsv'; -} - -export interface DsvDataFormat extends DataFormatBase { - type?: 'dsv'; - - /** - * The delimiter between records. The delimiter must be a single character (i.e., a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not. - * - * @minLength 1 - * @maxLength 1 - */ - delimiter: string; -} - -export interface JsonDataFormat extends DataFormatBase { - type?: 'json'; - /** - * The JSON property containing the desired data. - * This parameter can be used when the loaded JSON file may have surrounding structure or meta-data. - * For example `"property": "values.features"` is equivalent to retrieving `json.values.features` - * from the loaded JSON object. - */ - property?: string; -} - -export interface TopoDataFormat extends DataFormatBase { - type?: 'topojson'; - /** - * The name of the TopoJSON object set to convert to a GeoJSON feature collection. - * For example, in a map of the world, there may be an object set named `"countries"`. - * Using the feature property, we can extract this set and generate a GeoJSON feature object for each country. - */ - feature?: string; - /** - * The name of the TopoJSON object set to convert to mesh. - * Similar to the `feature` option, `mesh` extracts a named TopoJSON object set. - * Unlike the `feature` option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features. - * Extracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties. - */ - mesh?: string; -} - -export type DataFormat = CsvDataFormat | DsvDataFormat | JsonDataFormat | TopoDataFormat; - -export type DataFormatType = 'json' | 'csv' | 'tsv' | 'dsv' | 'topojson'; - -export type DataSource = UrlData | InlineData | NamedData; - -export type Data = DataSource | Generator; - -// eslint-disable-next-line @typescript-eslint/ban-types -export type InlineDataset = number[] | string[] | boolean[] | object[] | string | object; - -export interface DataBase { - /** - * An object that specifies the format for parsing the data. - */ - format?: DataFormat; - /** - * Provide a placeholder name and bind data at runtime. - */ - name?: string; -} - -export interface UrlData extends DataBase { - /** - * An URL from which to load the data set. Use the `format.type` property - * to ensure the loaded data is correctly parsed. - */ - url: string; -} - -export interface InlineData extends DataBase { - /** - * The full data set, included inline. This can be an array of objects or primitive values, an object, or a string. - * Arrays of primitive values are ingested as objects with a `data` property. Strings are parsed according to the specified format type. - */ - values: InlineDataset; -} - -export interface NamedData extends DataBase { - /** - * Provide a placeholder name and bind data at runtime. - */ - name: string; -} - -export function isUrlData(data: Partial | Partial): data is UrlData { - return 'url' in data; -} - -export function isInlineData(data: Partial | Partial): data is InlineData { - return 'values' in data; -} - -export function isNamedData(data: Partial | Partial): data is NamedData { - return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data); -} - -export function isGenerator(data: Partial | Partial): data is Generator { - return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data)); -} - -export function isSequenceGenerator(data: Partial | Partial): data is SequenceGenerator { - return 'sequence' in data; -} - -export function isSphereGenerator(data: Partial | Partial): data is SphereGenerator { - return 'sphere' in data; -} - -export function isGraticuleGenerator(data: Partial | Partial): data is GraticuleGenerator { - return 'graticule' in data; -} - -export enum DataSourceType { - Raw, - Main, - Row, - Column, - Lookup -} - -export type Generator = SequenceGenerator | SphereGenerator | GraticuleGenerator; - -export interface GeneratorBase { - /** - * Provide a placeholder name and bind data at runtime. - */ - name?: string; -} - -export interface SequenceGenerator extends GeneratorBase { - /** - * Generate a sequence of numbers. - */ - sequence: SequenceParams; -} - -export interface SequenceParams { - /** - * The starting value of the sequence (inclusive). - */ - start: number; - /** - * The ending value of the sequence (exclusive). - */ - stop: number; - /** - * The step value between sequence entries. - * - * __Default value:__ `1` - */ - step?: number; - - /** - * The name of the generated sequence field. - * - * __Default value:__ `"data"` - */ - as?: FieldName; -} - -export interface SphereGenerator extends GeneratorBase { - /** - * Generate sphere GeoJSON data for the full globe. - */ - // eslint-disable-next-line @typescript-eslint/ban-types - sphere: true | {}; -} - -export interface GraticuleGenerator extends GeneratorBase { - /** - * Generate graticule GeoJSON data for geographic reference lines. - */ - graticule: true | GraticuleParams; -} - -export interface GraticuleParams { - /** - * The major extent of the graticule as a two-element array of coordinates. - */ - extentMajor?: Vector2>; - - /** - * The minor extent of the graticule as a two-element array of coordinates. - */ - extentMinor?: Vector2>; - - /** - * Sets both the major and minor extents to the same values. - */ - extent?: Vector2>; - - /** - * The major step angles of the graticule. - * - * - * __Default value:__ `[90, 360]` - */ - stepMajor?: Vector2; - - /** - * The minor step angles of the graticule. - * - * __Default value:__ `[10, 10]` - */ - stepMinor?: Vector2; - - /** - * Sets both the major and minor step angles to the same values. - */ - step?: Vector2; - - /** - * The precision of the graticule in degrees. - * - * __Default value:__ `2.5` - */ - precision?: number; -} diff --git a/node_modules/vega-lite/src/datetime.ts b/node_modules/vega-lite/src/datetime.ts deleted file mode 100644 index e43d858..0000000 --- a/node_modules/vega-lite/src/datetime.ts +++ /dev/null @@ -1,325 +0,0 @@ -// DateTime definition object - -import {isNumber, isObject} from 'vega-util'; -import * as log from './log'; -import {TIMEUNIT_PARTS} from './timeunit'; -import {duplicate, isNumeric, keys} from './util'; - -/** - * @minimum 1 - * @maximum 12 - * @TJS-type integer - */ -export type Month = number; - -/** - * @minimum 1 - * @maximum 7 - */ -export type Day = number; - -/** - * Object for defining datetime in Vega-Lite Filter. - * If both month and quarter are provided, month has higher precedence. - * `day` cannot be combined with other date. - * We accept string for month and day names. - */ -export interface DateTime { - /** - * Integer value representing the year. - * @TJS-type integer - */ - year?: number; - - /** - * Integer value representing the quarter of the year (from 1-4). - * @minimum 1 - * @maximum 4 - * @TJS-type integer - */ - quarter?: number; - - /** - * One of: - * (1) integer value representing the month from `1`-`12`. `1` represents January; - * (2) case-insensitive month name (e.g., `"January"`); - * (3) case-insensitive, 3-character short month name (e.g., `"Jan"`). - */ - month?: Month | string; - - /** - * Integer value representing the date (day of the month) from 1-31. - * @minimum 1 - * @maximum 31 - * @TJS-type integer - */ - date?: number; - - /** - * Value representing the day of a week. This can be one of: - * (1) integer value -- `1` represents Monday; - * (2) case-insensitive day name (e.g., `"Monday"`); - * (3) case-insensitive, 3-character short day name (e.g., `"Mon"`). - * - * **Warning:** A DateTime definition object with `day`** should not be combined with `year`, `quarter`, `month`, or `date`. - */ - day?: Day | string; - - /** - * Integer value representing the hour of a day from 0-23. - * @minimum 0 - * @maximum 24 - * @TJS-type integer - */ - hours?: number; - - /** - * Integer value representing the minute segment of time from 0-59. - * @minimum 0 - * @maximum 60 - * @TJS-type integer - */ - minutes?: number; - - /** - * Integer value representing the second segment (0-59) of a time value - * @minimum 0 - * @maximum 60 - * @TJS-type integer - */ - seconds?: number; - - /** - * Integer value representing the millisecond segment of time. - * @minimum 0 - * @maximum 1000 - * @TJS-type integer - */ - milliseconds?: number; - - /** - * A boolean flag indicating if date time is in utc time. If false, the date time is in local time - */ - utc?: boolean; -} - -/** - * Internal Object for defining datetime expressions. - * This is an expression version of DateTime. - * If both month and quarter are provided, month has higher precedence. - * `day` cannot be combined with other date. - */ -export interface DateTimeExpr { - year?: string; - quarter?: string; - month?: string; - date?: string; - day?: string; - hours?: string; - minutes?: string; - seconds?: string; - milliseconds?: string; - utc?: boolean; -} - -export function isDateTime(o: any): o is DateTime { - if (o && isObject(o)) { - for (const part of TIMEUNIT_PARTS) { - if (part in o) { - return true; - } - } - } - return false; -} - -export const MONTHS = [ - 'january', - 'february', - 'march', - 'april', - 'may', - 'june', - 'july', - 'august', - 'september', - 'october', - 'november', - 'december' -]; -export const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3)); - -export const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; -export const SHORT_DAYS = DAYS.map(d => d.substr(0, 3)); - -function normalizeQuarter(q: number | string): number { - if (isNumeric(q)) { - q = +q; - } - - if (isNumber(q)) { - if (q > 4) { - log.warn(log.message.invalidTimeUnit('quarter', q)); - } - // We accept 1-based quarter, so need to readjust to 0-based quarter - return q - 1; - } else { - // Invalid quarter - throw new Error(log.message.invalidTimeUnit('quarter', q)); - } -} - -function normalizeMonth(m: string | number): number { - if (isNumeric(m)) { - m = +m; - } - - if (isNumber(m)) { - // We accept 1-based month, so need to readjust to 0-based month - return m - 1; - } else { - const lowerM = m.toLowerCase(); - const monthIndex = MONTHS.indexOf(lowerM); - if (monthIndex !== -1) { - return monthIndex; // 0 for january, ... - } - const shortM = lowerM.substr(0, 3); - const shortMonthIndex = SHORT_MONTHS.indexOf(shortM); - if (shortMonthIndex !== -1) { - return shortMonthIndex; - } - - // Invalid month - throw new Error(log.message.invalidTimeUnit('month', m)); - } -} - -function normalizeDay(d: string | number): number { - if (isNumeric(d)) { - d = +d; - } - - if (isNumber(d)) { - // mod so that this can be both 0-based where 0 = sunday - // and 1-based where 7=sunday - return d % 7; - } else { - const lowerD = d.toLowerCase(); - const dayIndex = DAYS.indexOf(lowerD); - if (dayIndex !== -1) { - return dayIndex; // 0 for january, ... - } - const shortD = lowerD.substr(0, 3); - const shortDayIndex = SHORT_DAYS.indexOf(shortD); - if (shortDayIndex !== -1) { - return shortDayIndex; - } - // Invalid day - throw new Error(log.message.invalidTimeUnit('day', d)); - } -} - -/** - * @param d the date. - * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime. - * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds] - */ -function dateTimeParts(d: DateTime | DateTimeExpr, normalize: boolean) { - const parts: (string | number)[] = []; - - if (normalize && d.day !== undefined) { - if (keys(d).length > 1) { - log.warn(log.message.droppedDay(d)); - d = duplicate(d); - delete d.day; - } - } - - if (d.year !== undefined) { - parts.push(d.year); - } else { - // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega - // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year). - parts.push(2012); - } - - if (d.month !== undefined) { - const month = normalize ? normalizeMonth(d.month) : d.month; - parts.push(month); - } else if (d.quarter !== undefined) { - const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter; - parts.push(isNumber(quarter) ? quarter * 3 : quarter + '*3'); - } else { - parts.push(0); // months start at zero in JS - } - - if (d.date !== undefined) { - parts.push(d.date); - } else if (d.day !== undefined) { - // HACK: Day only works as a standalone unit - // This is only correct because we always set year to 2006 for day - const day = normalize ? normalizeDay(d.day) : d.day; - parts.push(isNumber(day) ? day + 1 : day + '+1'); - } else { - parts.push(1); // Date starts at 1 in JS - } - - // Note: can't use TimeUnit enum here as importing it will create - // circular dependency problem! - for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds'] as const) { - const unit = d[timeUnit]; - parts.push(typeof unit === 'undefined' ? 0 : unit); - } - - return parts; -} - -/** - * Return Vega expression for a date time. - * - * @param d the date time. - * @returns the Vega expression. - */ -export function dateTimeToExpr(d: DateTime) { - const parts: (string | number)[] = dateTimeParts(d, true); - - const string = parts.join(', '); - - if (d.utc) { - return `utc(${string})`; - } else { - return `datetime(${string})`; - } -} - -/** - * Return Vega expression for a date time expression. - * - * @param d the internal date time object with expression. - * @returns the Vega expression. - */ -export function dateTimeExprToExpr(d: DateTimeExpr) { - const parts: (string | number)[] = dateTimeParts(d, false); - - const string = parts.join(', '); - - if (d.utc) { - return `utc(${string})`; - } else { - return `datetime(${string})`; - } -} - -/** - * @param d the date time. - * @returns the timestamp. - */ -export function dateTimeToTimestamp(d: DateTime) { - const parts: (string | number)[] = dateTimeParts(d, true); - - if (d.utc) { - return +new Date(Date.UTC(...(parts as [any, any]))); - } else { - return +new Date(...(parts as [any])); - } -} diff --git a/node_modules/vega-lite/src/encoding.ts b/node_modules/vega-lite/src/encoding.ts deleted file mode 100644 index 8e19a3f..0000000 --- a/node_modules/vega-lite/src/encoding.ts +++ /dev/null @@ -1,711 +0,0 @@ -import {AggregateOp} from 'vega'; -import {array, isArray} from 'vega-util'; -import {isArgmaxDef, isArgminDef} from './aggregate'; -import {isBinned, isBinning} from './bin'; -import { - ANGLE, - CHANNELS, - COLOR, - DESCRIPTION, - DETAIL, - FILL, - FILLOPACITY, - HREF, - isChannel, - isNonPositionScaleChannel, - isSecondaryRangeChannel, - isXorY, - KEY, - LATITUDE, - LATITUDE2, - LONGITUDE, - LONGITUDE2, - OPACITY, - ORDER, - RADIUS, - RADIUS2, - SHAPE, - SIZE, - STROKE, - STROKEDASH, - STROKEOPACITY, - STROKEWIDTH, - supportMark, - TEXT, - THETA, - THETA2, - TOOLTIP, - URL, - X, - X2, - Y, - Y2, - Channel -} from './channel'; -import { - binRequiresRange, - ChannelDef, - ColorDef, - Field, - FieldDef, - FieldDefWithoutScale, - getFieldDef, - getGuide, - hasConditionalFieldDef, - initChannelDef, - initFieldDef, - isConditionalDef, - isDatumDef, - isFieldDef, - isTypedFieldDef, - isValueDef, - LatLongDef, - NumericArrayMarkPropDef, - NumericMarkPropDef, - OrderFieldDef, - OrderValueDef, - PolarDef, - Position2Def, - PositionDef, - SecondaryFieldDef, - ShapeDef, - StringFieldDef, - StringFieldDefWithCondition, - StringValueDefWithCondition, - TextDef, - title, - TypedFieldDef, - vgField -} from './channeldef'; -import {Config} from './config'; -import * as log from './log'; -import {Mark} from './mark'; -import {EncodingFacetMapping} from './spec/facet'; -import {AggregatedFieldDef, BinTransform, TimeUnitTransform} from './transform'; -import {QUANTITATIVE, TEMPORAL} from './type'; -import {keys, some} from './util'; -import {isSignalRef} from './vega.schema'; - -export interface Encoding { - /** - * X coordinates of the marks, or width of horizontal `"bar"` and `"area"` without specified `x2` or `width`. - * - * The `value` of this channel can be a number or a string `"width"` for the width of the plot. - */ - x?: PositionDef; - - /** - * Y coordinates of the marks, or height of vertical `"bar"` and `"area"` without specified `y2` or `height`. - * - * The `value` of this channel can be a number or a string `"height"` for the height of the plot. - */ - y?: PositionDef; - - /** - * X2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - * - * The `value` of this channel can be a number or a string `"width"` for the width of the plot. - */ - // TODO: Ham need to add default behavior - // `x2` cannot have type as it should have the same type as `x` - x2?: Position2Def; - - /** - * Y2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - * - * The `value` of this channel can be a number or a string `"height"` for the height of the plot. - */ - // TODO: Ham need to add default behavior - // `y2` cannot have type as it should have the same type as `y` - y2?: Position2Def; - - /** - * Longitude position of geographically projected marks. - */ - longitude?: LatLongDef; - - /** - * Latitude position of geographically projected marks. - */ - latitude?: LatLongDef; - - /** - * Longitude-2 position for geographically projected ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - */ - // `longitude2` cannot have type as it should have the same type as `longitude` - longitude2?: Position2Def; - - /** - * Latitude-2 position for geographically projected ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - */ - // `latitude2` cannot have type as it should have the same type as `latitude` - latitude2?: Position2Def; - - /** - * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.) - * - * - For text marks, polar coordinate angle in radians. - */ - theta?: PolarDef; - - /** - * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise. - */ - theta2?: Position2Def; - - /** - * The outer radius in pixels of arc marks. - */ - - radius?: PolarDef; - - /** - * The inner radius in pixels of arc marks. - */ - radius2?: Position2Def; - - /** - * Color of the marks – either fill or stroke color based on the `filled` property of mark definition. - * By default, `color` represents fill color for `"area"`, `"bar"`, `"tick"`, - * `"text"`, `"trail"`, `"circle"`, and `"square"` / stroke color for `"line"` and `"point"`. - * - * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property. - * - * _Note:_ - * 1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified. - * 2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme). - */ - color?: ColorDef; - - /** - * Fill color of the marks. - * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property. - * - * _Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified. - */ - fill?: ColorDef; - - /** - * Stroke color of the marks. - * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property. - * - * _Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified. - */ - - stroke?: ColorDef; - - /** - * Opacity of the marks. - * - * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `opacity` property. - */ - opacity?: NumericMarkPropDef; - - /** - * Fill opacity of the marks. - * - * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `fillOpacity` property. - */ - fillOpacity?: NumericMarkPropDef; - - /** - * Stroke opacity of the marks. - * - * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeOpacity` property. - */ - strokeOpacity?: NumericMarkPropDef; - - /** - * Stroke width of the marks. - * - * __Default value:__ If undefined, the default stroke width depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeWidth` property. - */ - strokeWidth?: NumericMarkPropDef; - - /** - * Stroke dash of the marks. - * - * __Default value:__ `[1,0]` (No dash). - */ - strokeDash?: NumericArrayMarkPropDef; - - /** - * Size of the mark. - * - For `"point"`, `"square"` and `"circle"`, – the symbol size, or pixel area of the mark. - * - For `"bar"` and `"tick"` – the bar and tick's size. - * - For `"text"` – the text's font size. - * - Size is unsupported for `"line"`, `"area"`, and `"rect"`. (Use `"trail"` instead of line with varying size) - */ - size?: NumericMarkPropDef; - - /** - * Rotation angle of point and text marks. - */ - angle?: NumericMarkPropDef; - - /** - * Shape of the mark. - * - * 1. For `point` marks the supported values include: - * - plotting shapes: `"circle"`, `"square"`, `"cross"`, `"diamond"`, `"triangle-up"`, `"triangle-down"`, `"triangle-right"`, or `"triangle-left"`. - * - the line symbol `"stroke"` - * - centered directional shapes `"arrow"`, `"wedge"`, or `"triangle"` - * - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.) - * - * 2. For `geoshape` marks it should be a field definition of the geojson data - * - * __Default value:__ If undefined, the default shape depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#point-config)'s `shape` property. (`"circle"` if unset.) - */ - shape?: ShapeDef; - /** - * Additional levels of detail for grouping data in aggregate views and - * in line, trail, and area marks without mapping data to a specific visual channel. - */ - detail?: FieldDefWithoutScale | FieldDefWithoutScale[]; - - /** - * A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data. - */ - key?: FieldDefWithoutScale; - - /** - * Text of the `text` mark. - */ - text?: TextDef; - - /** - * The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def). - * - * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite. - */ - tooltip?: StringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[] | null; - - /** - * A URL to load upon mouse click. - */ - href?: StringFieldDefWithCondition | StringValueDefWithCondition; - - /** - * The URL of an image mark. - */ - url?: StringFieldDefWithCondition | StringValueDefWithCondition; - - /** - * A text description of this mark for ARIA accessibility (SVG output only). For SVG output the `"aria-label"` attribute will be set to this description. - */ - description?: StringFieldDefWithCondition | StringValueDefWithCondition; - - /** - * Order of the marks. - * - For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order). - * - For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{"value": null}` makes the line marks use the original order in the data sources. - * - Otherwise, this `order` channel encodes layer order of the marks. - * - * __Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping. - */ - order?: OrderFieldDef | OrderFieldDef[] | OrderValueDef; -} - -export interface EncodingWithFacet extends Encoding, EncodingFacetMapping {} - -export function channelHasField( - encoding: EncodingWithFacet, - channel: keyof EncodingWithFacet -): boolean { - const channelDef = encoding && encoding[channel]; - if (channelDef) { - if (isArray(channelDef)) { - return some(channelDef, fieldDef => !!fieldDef.field); - } else { - return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef); - } - } - return false; -} - -export function isAggregate(encoding: EncodingWithFacet) { - return some(CHANNELS, channel => { - if (channelHasField(encoding, channel)) { - const channelDef = encoding[channel]; - if (isArray(channelDef)) { - return some(channelDef, fieldDef => !!fieldDef.aggregate); - } else { - const fieldDef = getFieldDef(channelDef); - return fieldDef && !!fieldDef.aggregate; - } - } - return false; - }); -} - -export function extractTransformsFromEncoding(oldEncoding: Encoding, config: Config) { - const groupby: string[] = []; - const bins: BinTransform[] = []; - const timeUnits: TimeUnitTransform[] = []; - const aggregate: AggregatedFieldDef[] = []; - const encoding: Encoding = {}; - - forEach(oldEncoding, (channelDef, channel) => { - // Extract potential embedded transformations along with remaining properties - if (isFieldDef(channelDef)) { - const {field, aggregate: aggOp, bin, timeUnit, ...remaining} = channelDef; - if (aggOp || timeUnit || bin) { - const guide = getGuide(channelDef); - const isTitleDefined = guide && guide.title; - let newField = vgField(channelDef, {forAs: true}); - const newFieldDef: FieldDef = { - // Only add title if it doesn't exist - ...(isTitleDefined ? [] : {title: title(channelDef, config, {allowDisabling: true})}), - ...remaining, - // Always overwrite field - field: newField - }; - - if (aggOp) { - let op: AggregateOp; - - if (isArgmaxDef(aggOp)) { - op = 'argmax'; - newField = vgField({op: 'argmax', field: aggOp.argmax}, {forAs: true}); - newFieldDef.field = `${newField}.${field}`; - } else if (isArgminDef(aggOp)) { - op = 'argmin'; - newField = vgField({op: 'argmin', field: aggOp.argmin}, {forAs: true}); - newFieldDef.field = `${newField}.${field}`; - } else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') { - op = aggOp; - } - - if (op) { - const aggregateEntry: AggregatedFieldDef = { - op, - as: newField - }; - if (field) { - aggregateEntry.field = field; - } - aggregate.push(aggregateEntry); - } - } else { - groupby.push(newField); - if (isTypedFieldDef(channelDef) && isBinning(bin)) { - bins.push({bin, field, as: newField}); - // Add additional groupbys for range and end of bins - groupby.push(vgField(channelDef, {binSuffix: 'end'})); - if (binRequiresRange(channelDef, channel)) { - groupby.push(vgField(channelDef, {binSuffix: 'range'})); - } - // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively - if (isXorY(channel)) { - const secondaryChannel: SecondaryFieldDef = { - field: newField + '_end' - }; - encoding[channel + '2'] = secondaryChannel; - } - newFieldDef.bin = 'binned'; - if (!isSecondaryRangeChannel(channel)) { - newFieldDef['type'] = QUANTITATIVE; - } - } else if (timeUnit) { - timeUnits.push({ - timeUnit, - field, - as: newField - }); - - // define the format type for later compilation - const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time'; - if (formatType) { - if (channel === TEXT || channel === TOOLTIP) { - newFieldDef['formatType'] = formatType; - } else if (isNonPositionScaleChannel(channel)) { - newFieldDef['legend'] = { - formatType, - ...newFieldDef['legend'] - }; - } else if (isXorY(channel)) { - newFieldDef['axis'] = { - formatType, - ...newFieldDef['axis'] - }; - } - } - } - } - - // now the field should refer to post-transformed field instead - encoding[channel as any] = newFieldDef; - } else { - groupby.push(field); - encoding[channel as any] = oldEncoding[channel]; - } - } else { - // For value def / signal ref / datum def, just copy - encoding[channel as any] = oldEncoding[channel]; - } - }); - - return { - bins, - timeUnits, - aggregate, - groupby, - encoding - }; -} - -export function markChannelCompatible(encoding: Encoding, channel: Channel, mark: Mark) { - const markSupported = supportMark(channel, mark); - if (!markSupported) { - return false; - } else if (markSupported === 'binned') { - const primaryFieldDef = encoding[channel === X2 ? X : Y]; - - // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef - // has "binned" data and thus need x2/y2 to specify the bin-end field. - if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) { - return true; - } else { - return false; - } - } - return true; -} - -export function initEncoding( - encoding: Encoding, - mark: Mark, - filled: boolean, - config: Config -): Encoding { - return keys(encoding).reduce((normalizedEncoding: Encoding, channel: Channel) => { - if (!isChannel(channel)) { - // Drop invalid channel - log.warn(log.message.invalidEncodingChannel(channel)); - return normalizedEncoding; - } - - const channelDef = encoding[channel]; - if (channel === 'angle' && mark === 'arc' && !encoding.theta) { - log.warn(log.message.REPLACE_ANGLE_WITH_THETA); - channel = THETA; - } - - if (!markChannelCompatible(encoding, channel, mark)) { - // Drop unsupported channel - log.warn(log.message.incompatibleChannel(channel, mark)); - return normalizedEncoding; - } - - // Drop line's size if the field is aggregated. - if (channel === SIZE && mark === 'line') { - const fieldDef = getFieldDef(encoding[channel]); - if (fieldDef?.aggregate) { - log.warn(log.message.LINE_WITH_VARYING_SIZE); - return normalizedEncoding; - } - } - // Drop color if either fill or stroke is specified - - if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) { - log.warn(log.message.droppingColor('encoding', {fill: 'fill' in encoding, stroke: 'stroke' in encoding})); - return normalizedEncoding; - } - - if ( - channel === DETAIL || - (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) || - (channel === TOOLTIP && isArray(channelDef)) - ) { - if (channelDef) { - // Array of fieldDefs for detail channel (or production rule) - (normalizedEncoding[channel] as any) = array(channelDef).reduce( - (defs: FieldDef[], fieldDef: FieldDef) => { - if (!isFieldDef(fieldDef)) { - log.warn(log.message.emptyFieldDef(fieldDef, channel)); - } else { - defs.push(initFieldDef(fieldDef, channel)); - } - return defs; - }, - [] - ); - } - } else { - if (channel === TOOLTIP && channelDef === null) { - // Preserve null so we can use it to disable tooltip - normalizedEncoding[channel] = null; - } else if ( - !isFieldDef(channelDef) && - !isDatumDef(channelDef) && - !isValueDef(channelDef) && - !isConditionalDef(channelDef) && - !isSignalRef(channelDef) - ) { - log.warn(log.message.emptyFieldDef(channelDef, channel)); - return normalizedEncoding; - } - - normalizedEncoding[channel as any] = initChannelDef(channelDef as ChannelDef, channel, config); - } - return normalizedEncoding; - }, {}); -} - -/** - * For composite marks, we have to call initChannelDef during init so we can infer types earlier. - */ -export function normalizeEncoding(encoding: Encoding, config: Config): Encoding { - return keys(encoding).reduce((normalizedEncoding: Encoding, channel) => { - const newChannelDef = initChannelDef(encoding[channel], channel, config, {compositeMark: true}); - - normalizedEncoding[channel as any] = newChannelDef; - return normalizedEncoding; - }, {}); -} - -export function fieldDefs(encoding: EncodingWithFacet): FieldDef[] { - const arr: FieldDef[] = []; - for (const channel of keys(encoding)) { - if (channelHasField(encoding, channel)) { - const channelDef = encoding[channel]; - const channelDefArray = array(channelDef); - for (const def of channelDefArray) { - if (isFieldDef(def)) { - arr.push(def); - } else if (hasConditionalFieldDef(def)) { - arr.push(def.condition); - } - } - } - } - return arr; -} - -export function forEach>( - mapping: U, - f: (cd: ChannelDef, c: keyof U) => void, - thisArg?: any -) { - if (!mapping) { - return; - } - - for (const channel of keys(mapping)) { - const el = mapping[channel]; - if (isArray(el)) { - for (const channelDef of el as unknown[]) { - f.call(thisArg, channelDef, channel); - } - } else { - f.call(thisArg, el, channel); - } - } -} - -export function reduce>( - mapping: U, - f: (acc: any, fd: TypedFieldDef, c: keyof U) => U, - init: T, - thisArg?: any -) { - if (!mapping) { - return init; - } - - return keys(mapping).reduce((r, channel) => { - const map = mapping[channel]; - if (isArray(map)) { - return map.reduce((r1: T, channelDef: ChannelDef) => { - return f.call(thisArg, r1, channelDef, channel); - }, r); - } else { - return f.call(thisArg, r, map, channel); - } - }, init); -} - -/** - * Returns list of path grouping fields for the given encoding - */ -export function pathGroupingFields(mark: Mark, encoding: Encoding): string[] { - return keys(encoding).reduce((details, channel) => { - switch (channel) { - // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group - case X: - case Y: - case HREF: - case DESCRIPTION: - case URL: - case X2: - case Y2: - case THETA: - case THETA2: - case RADIUS: - case RADIUS2: - // falls through - - case LATITUDE: - case LONGITUDE: - case LATITUDE2: - case LONGITUDE2: - // TODO: case 'cursor': - - // text, shape, shouldn't be a part of line/trail/area [falls through] - case TEXT: - case SHAPE: - case ANGLE: - // falls through - - // tooltip fields should not be added to group by [falls through] - case TOOLTIP: - return details; - - case ORDER: - // order should not group line / trail - if (mark === 'line' || mark === 'trail') { - return details; - } - // but order should group area for stacking (falls through) - - case DETAIL: - case KEY: { - const channelDef = encoding[channel]; - if (isArray(channelDef) || isFieldDef(channelDef)) { - for (const fieldDef of array(channelDef)) { - if (!fieldDef.aggregate) { - details.push(vgField(fieldDef, {})); - } - } - } - return details; - } - - case SIZE: - if (mark === 'trail') { - // For trail, size should not group trail lines. - return details; - } - // For line, size should group lines. - - // falls through - case COLOR: - case FILL: - case STROKE: - case OPACITY: - case FILLOPACITY: - case STROKEOPACITY: - case STROKEDASH: - case STROKEWIDTH: { - // TODO strokeDashOffset: - // falls through - - const fieldDef = getFieldDef(encoding[channel]); - if (fieldDef && !fieldDef.aggregate) { - details.push(vgField(fieldDef, {})); - } - return details; - } - } - }, []); -} diff --git a/node_modules/vega-lite/src/guide.ts b/node_modules/vega-lite/src/guide.ts deleted file mode 100644 index 896af5d..0000000 --- a/node_modules/vega-lite/src/guide.ts +++ /dev/null @@ -1,73 +0,0 @@ -import {SignalRef, Text} from 'vega'; -import {ConditionValueDefMixins, ValueDef} from './channeldef'; -import {LegendConfig} from './legend'; -import {Dict} from './util'; -import {VgEncodeChannel} from './vega.schema'; - -export interface TitleMixins { - /** - * A title for the field. If `null`, the title will be removed. - * - * __Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `"Sum of Profit"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `"Profit (binned)"`, `"Transaction Date (year-month)"`). Otherwise, the title is simply the field name. - * - * __Notes__: - * - * 1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/docs/compile.html#field-title). - * - * 2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used. - */ - title?: Text | null | SignalRef; -} - -export interface FormatMixins { - /** - * When used with the default `"number"` and `"time"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks. - * - * - If the format type is `"number"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format). - * - If the format type is `"time"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format). - * - * See the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples. - * - * When used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function. - * - * __Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format. - */ - format?: string | Dict; - - /** - * The format type for labels. One of `"number"`, `"time"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type). - * - * __Default value:__ - * - `"time"` for temporal fields and ordinal and nominal fields with `timeUnit`. - * - `"number"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`. - */ - formatType?: 'number' | 'time' | string; - - /** - * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels text. - * - * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object. - */ - labelExpr?: string; -} - -export interface Guide extends TitleMixins, FormatMixins {} - -export interface VlOnlyGuideConfig { - /** - * Set to null to disable title for the axis, legend, or header. - */ - title?: null; -} - -export type GuideEncodingConditionalValueDef = ValueDef & ConditionValueDefMixins; - -export type GuideEncodingEntry = Partial>; - -export const VL_ONLY_LEGEND_CONFIG: (keyof LegendConfig)[] = [ - 'gradientHorizontalMaxLength', - 'gradientHorizontalMinLength', - 'gradientVerticalMaxLength', - 'gradientVerticalMinLength', - 'unselectedOpacity' -]; diff --git a/node_modules/vega-lite/src/header.ts b/node_modules/vega-lite/src/header.ts deleted file mode 100644 index 493021e..0000000 --- a/node_modules/vega-lite/src/header.ts +++ /dev/null @@ -1,258 +0,0 @@ -import {Align, Color, FontStyle, FontWeight, Orient, SignalRef, TextBaseline, TitleAnchor, TitleConfig} from 'vega'; -import {FormatMixins, Guide, VlOnlyGuideConfig} from './guide'; -import {keys} from './util'; - -export const HEADER_TITLE_PROPERTIES_MAP: Partial> = { - titleAlign: 'align', - titleAnchor: 'anchor', - titleAngle: 'angle', - titleBaseline: 'baseline', - titleColor: 'color', - titleFont: 'font', - titleFontSize: 'fontSize', - titleFontStyle: 'fontStyle', - titleFontWeight: 'fontWeight', - titleLimit: 'limit', - titleLineHeight: 'lineHeight', - titleOrient: 'orient', - titlePadding: 'offset' -}; - -export const HEADER_LABEL_PROPERTIES_MAP: Partial> = { - labelAlign: 'align', - labelAnchor: 'anchor', - labelAngle: 'angle', - labelBaseline: 'baseline', - labelColor: 'color', - labelFont: 'font', - labelFontSize: 'fontSize', - labelFontStyle: 'fontStyle', - labelFontWeight: 'fontWeight', - labelLimit: 'limit', - labelLineHeight: 'lineHeight', - labelOrient: 'orient', - labelPadding: 'offset' -}; - -export const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP); - -export const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP); - -export interface CoreHeader extends FormatMixins { - // ---------- Title ---------- - /** - * The anchor position for placing the title. One of `"start"`, `"middle"`, or `"end"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title. - */ - titleAnchor?: TitleAnchor; // We don't allow signal for titleAnchor since there is a dependent logic - - /** - * Horizontal text alignment (to the anchor) of header titles. - */ - titleAlign?: Align | SignalRef; - - /** - * The rotation angle of the header title. - * - * __Default value:__ `0`. - * - * @minimum -360 - * @maximum 360 - */ - titleAngle?: number; // We don't allow signal for titleAngle since there is a dependent logic - - /** - * The vertical text baseline for the header title. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. - * The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone. - * - * __Default value:__ `"middle"` - */ - titleBaseline?: TextBaseline | SignalRef; - - /** - * Color of the header title, can be in hex color code or regular color name. - */ - titleColor?: Color | SignalRef; - - /** - * Font of the header title. (e.g., `"Helvetica Neue"`). - */ - titleFont?: string | SignalRef; - - /** - * Font size of the header title. - * - * @minimum 0 - */ - titleFontSize?: number | SignalRef; - - /** - * The font style of the header title. - */ - titleFontStyle?: FontStyle | SignalRef; - - /** - * Font weight of the header title. - * This can be either a string (e.g `"bold"`, `"normal"`) or a number (`100`, `200`, `300`, ..., `900` where `"normal"` = `400` and `"bold"` = `700`). - */ - titleFontWeight?: FontWeight | SignalRef; - - /** - * The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. - * - * __Default value:__ `0`, indicating no limit - */ - titleLimit?: number | SignalRef; - - /** - * Line height in pixels for multi-line header title text or title text with `"line-top"` or `"line-bottom"` baseline. - */ - titleLineHeight?: number | SignalRef; - - /** - * The orientation of the header title. One of `"top"`, `"bottom"`, `"left"` or `"right"`. - */ - titleOrient?: Orient; - - /** - * The padding, in pixel, between facet header's title and the label. - * - * __Default value:__ `10` - */ - titlePadding?: number | SignalRef; - - // ---------- Label ---------- - - /** - * A boolean flag indicating if labels should be included as part of the header. - * - * __Default value:__ `true`. - */ - labels?: boolean; - - /** - * Horizontal text alignment of header labels. One of `"left"`, `"center"`, or `"right"`. - */ - labelAlign?: Align | SignalRef; - - /** - * The vertical text baseline for the header labels. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. - * The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone. - * - */ - labelBaseline?: TextBaseline | SignalRef; - - /** - * The anchor position for placing the labels. One of `"start"`, `"middle"`, or `"end"`. For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label. - */ - labelAnchor?: TitleAnchor; - - /** - * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels. - * - * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the header's backing `datum` object. - */ - labelExpr?: string; - - /** - * The rotation angle of the header labels. - * - * __Default value:__ `0` for column header, `-90` for row header. - * - * @minimum -360 - * @maximum 360 - */ - labelAngle?: number; // no signal ref since there is a dependent logic - - /** - * The color of the header label, can be in hex color code or regular color name. - */ - labelColor?: Color | SignalRef; - - /** - * The font of the header label. - */ - labelFont?: string | SignalRef; - - /** - * The font size of the header label, in pixels. - * - * @minimum 0 - */ - labelFontSize?: number | SignalRef; - - /** - * The font style of the header label. - */ - labelFontStyle?: FontStyle | SignalRef; - - /** - * The font weight of the header label. - */ - labelFontWeight?: FontWeight | SignalRef; - - /** - * The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. - * - * __Default value:__ `0`, indicating no limit - */ - labelLimit?: number | SignalRef; - - /** - * Line height in pixels for multi-line header labels or title text with `"line-top"` or `"line-bottom"` baseline. - */ - labelLineHeight?: number | SignalRef; - - /** - * The orientation of the header label. One of `"top"`, `"bottom"`, `"left"` or `"right"`. - */ - labelOrient?: Orient; // no signal ref since there is a dependent logic - - /** - * The padding, in pixel, between facet header's label and the plot. - * - * __Default value:__ `10` - */ - labelPadding?: number | SignalRef; - - /** - * Shortcut for setting both labelOrient and titleOrient. - */ - orient?: Orient; // no signal ref since there is a dependent logic -} - -export interface HeaderConfig extends CoreHeader, VlOnlyGuideConfig {} - -/** - * Headers of row / column channels for faceted plots. - */ -export interface Header extends CoreHeader, Guide {} - -export interface HeaderConfigMixins { - /** - * Header configuration, which determines default properties for all [headers](https://vega.github.io/vega-lite/docs/header.html). - * - * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). - */ - header?: HeaderConfig; - - /** - * Header configuration, which determines default properties for row [headers](https://vega.github.io/vega-lite/docs/header.html). - * - * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). - */ - headerRow?: HeaderConfig; - - /** - * Header configuration, which determines default properties for column [headers](https://vega.github.io/vega-lite/docs/header.html). - * - * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). - */ - headerColumn?: HeaderConfig; - - /** - * Header configuration, which determines default properties for non-row/column facet [headers](https://vega.github.io/vega-lite/docs/header.html). - * - * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). - */ - headerFacet?: HeaderConfig; -} diff --git a/node_modules/vega-lite/src/impute.ts b/node_modules/vega-lite/src/impute.ts deleted file mode 100644 index 0417f31..0000000 --- a/node_modules/vega-lite/src/impute.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {ImputeSequence} from './transform'; -import {ImputeMethod} from 'vega'; - -export interface ImputeParams { - /** - * The imputation method to use for the field value of imputed data objects. - * One of `"value"`, `"mean"`, `"median"`, `"max"` or `"min"`. - * - * __Default value:__ `"value"` - */ - method?: ImputeMethod; - - /** - * The field value to use when the imputation `method` is `"value"`. - */ - value?: any; - - /** - * Defines the key values that should be considered for imputation. - * An array of key values or an object defining a [number sequence](https://vega.github.io/vega-lite/docs/impute.html#sequence-def). - * - * If provided, this will be used in addition to the key values observed within the input data. If not provided, the values will be derived from all unique values of the `key` field. For `impute` in `encoding`, the key field is the x-field if the y-field is imputed, or vice versa. - * - * If there is no impute grouping, this property _must_ be specified. - */ - keyvals?: any[] | ImputeSequence; - - /** - * A frame specification as a two-element array used to control the window over which the specified method is applied. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. For example, the value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. - * - * __Default value:__: `[null, null]` indicating that the window includes all objects. - */ - frame?: [null | number, null | number]; -} diff --git a/node_modules/vega-lite/src/index.ts b/node_modules/vega-lite/src/index.ts deleted file mode 100644 index c6c6c76..0000000 --- a/node_modules/vega-lite/src/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import {version} from '../package.json'; -import {normalize} from './normalize'; - -export {compile} from './compile/compile'; -export {Config} from './config'; -export {TopLevelSpec} from './spec'; -export {normalize, version}; diff --git a/node_modules/vega-lite/src/legend.ts b/node_modules/vega-lite/src/legend.ts deleted file mode 100644 index 8991ba1..0000000 --- a/node_modules/vega-lite/src/legend.ts +++ /dev/null @@ -1,325 +0,0 @@ -import { - BaseLegend, - LabelOverlap, - Legend as VgLegend, - LegendConfig as VgLegendConfig, - LegendEncode, - LegendOrient, - Orientation, - SignalRef -} from 'vega'; -import {DateTime} from './datetime'; -import {Guide, GuideEncodingEntry, VlOnlyGuideConfig} from './guide'; -import {Flag, keys} from './util'; -import {ExcludeMappedValueRefButKeepSignal, VgEncodeChannel} from './vega.schema'; - -export const LEGEND_SCALE_CHANNELS = [ - 'size', - 'shape', - 'fill', - 'stroke', - 'strokeDash', - 'strokeWidth', - 'opacity' -] as const; - -export type SignalLegendProp = - | 'fillColor' - | 'gradientStrokeColor' - | 'labelColor' - | 'strokeColor' - | 'symbolFillColor' - | 'symbolStrokeColor' - | 'titleColor'; - -export const SIGNAL_LEGEND_PROP_INDEX: Record< - SignalLegendProp, - { - part: keyof LegendEncode; - vgProp: VgEncodeChannel; - } | null // null if we need to convert condition to signal -> = { - fillColor: { - part: 'legend', - vgProp: 'fill' - }, - gradientStrokeColor: { - part: 'gradient', - vgProp: 'stroke' - }, - labelColor: { - part: 'labels', - vgProp: 'fill' - }, - strokeColor: { - part: 'legend', - vgProp: 'stroke' - }, - symbolFillColor: { - part: 'symbols', - vgProp: 'fill' - }, - symbolStrokeColor: { - part: 'symbols', - vgProp: 'stroke' - }, - titleColor: { - part: 'title', - vgProp: 'fill' - } -}; - -type BaseLegendNoValueRefs = ExcludeMappedValueRefButKeepSignal; - -export interface LegendPropsWithSignal { - fillColor?: BaseLegendNoValueRefs['fillColor'] | SignalRef; - gradientStrokeColor?: BaseLegendNoValueRefs['gradientStrokeColor'] | SignalRef; - labelColor?: BaseLegendNoValueRefs['labelColor'] | SignalRef; - strokeColor?: BaseLegendNoValueRefs['strokeColor'] | SignalRef; - symbolFillColor?: BaseLegendNoValueRefs['symbolFillColor'] | SignalRef; - symbolStrokeColor?: BaseLegendNoValueRefs['symbolStrokeColor'] | SignalRef; - titleColor?: BaseLegendNoValueRefs['titleColor'] | SignalRef; -} - -export type LegendConfig = LegendMixins & - VlOnlyGuideConfig & - Omit & - LegendPropsWithSignal & { - /** - * Max legend length for a vertical gradient when `config.legend.gradientLength` is undefined. - * - * __Default value:__ `200` - */ - gradientVerticalMaxLength?: number; - - /** - * Min legend length for a vertical gradient when `config.legend.gradientLength` is undefined. - * - * __Default value:__ `100` - */ - gradientVerticalMinLength?: number; - - /** - * Max legend length for a horizontal gradient when `config.legend.gradientLength` is undefined. - * - * __Default value:__ `200` - */ - gradientHorizontalMaxLength?: number; - - /** - * Min legend length for a horizontal gradient when `config.legend.gradientLength` is undefined. - * - * __Default value:__ `100` - */ - gradientHorizontalMinLength?: number; - - /** - * The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient. - * - * __Default value:__ `undefined`. If `undefined`, the default gradient will be determined based on the following rules: - * - For vertical gradients, `clamp(plot_height, gradientVerticalMinLength, gradientVerticalMaxLength)` - * - For top-`orient`ed or bottom-`orient`ed horizontal gradients, `clamp(plot_width, gradientHorizontalMinLength, gradientHorizontalMaxLength)` - * - For other horizontal gradients, `gradientHorizontalMinLength` - * - * where `clamp(value, min, max)` restricts _value_ to be between the specified _min_ and _max_. - * @minimum 0 - */ - gradientLength?: number; - - /** - * The opacity of unselected legend entries. - * - * __Default value:__ 0.35. - */ - unselectedOpacity?: number; - - /** - * Disable legend by default - */ - disable?: boolean; - }; - -/** - * Properties of a legend or boolean flag for determining whether to show it. - */ -export interface Legend - extends Omit, - LegendPropsWithSignal, - LegendMixins, - Guide { - /** - * Mark definitions for custom legend encoding. - * - * @hidden - */ - encoding?: LegendEncoding; - - /** - * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels. - * - * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the legend's backing `datum` object. - */ - labelExpr?: string; - - /** - * The minimum desired step between legend ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value. - * - * __Default value__: `undefined` - */ - tickMinStep?: number | SignalRef; - - /** - * Explicitly set the visible legend values. - */ - values?: number[] | string[] | boolean[] | DateTime[] | SignalRef; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega. - - /** - * The type of the legend. Use `"symbol"` to create a discrete legend and `"gradient"` for a continuous color gradient. - * - * __Default value:__ `"gradient"` for non-binned quantitative fields and temporal fields; `"symbol"` otherwise. - */ - type?: 'symbol' | 'gradient'; - - /** - * A non-negative integer indicating the z-index of the legend. - * If zindex is 0, legend should be drawn behind all chart elements. - * To put them in front, use zindex = 1. - * - * @TJS-type integer - * @minimum 0 - */ - zindex?: number; -} - -// Change comments to be Vega-Lite specific -interface LegendMixins { - /** - * The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` or `"parity"`, a strategy of removing every other label is used. If set to `"greedy"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes). - * - * __Default value:__ `"greedy"` for `log scales otherwise `true`. - */ - labelOverlap?: LabelOverlap | SignalRef; // override comment since our default differs from Vega - - /** - * The direction of the legend, one of `"vertical"` or `"horizontal"`. - * - * __Default value:__ - * - For top-/bottom-`orient`ed legends, `"horizontal"` - * - For left-/right-`orient`ed legends, `"vertical"` - * - For top/bottom-left/right-`orient`ed legends, `"horizontal"` for gradient legends and `"vertical"` for symbol legends. - */ - direction?: Orientation; // Omit SignalRef - - /** - * The orientation of the legend, which determines how the legend is positioned within the scene. One of `"left"`, `"right"`, `"top"`, `"bottom"`, `"top-left"`, `"top-right"`, `"bottom-left"`, `"bottom-right"`, `"none"`. - * - * __Default value:__ `"right"` - */ - orient?: LegendOrient; // Omit SignalRef -} - -export interface LegendEncoding { - /** - * Custom encoding for the legend container. - * This can be useful for creating legend with custom x, y position. - */ - legend?: GuideEncodingEntry; - - /** - * Custom encoding for the legend title text mark. - */ - title?: GuideEncodingEntry; - - /** - * Custom encoding for legend label text marks. - */ - labels?: GuideEncodingEntry; - - /** - * Custom encoding for legend symbol marks. - */ - symbols?: GuideEncodingEntry; - - /** - * Custom encoding for legend gradient filled rect marks. - */ - gradient?: GuideEncodingEntry; -} - -export const defaultLegendConfig: LegendConfig = { - gradientHorizontalMaxLength: 200, - gradientHorizontalMinLength: 100, - gradientVerticalMaxLength: 200, - gradientVerticalMinLength: 64, // This is Vega's minimum. - unselectedOpacity: 0.35 -}; - -export const COMMON_LEGEND_PROPERTY_INDEX: Flag = { - aria: 1, - clipHeight: 1, - columnPadding: 1, - columns: 1, - cornerRadius: 1, - description: 1, - direction: 1, - fillColor: 1, - format: 1, - formatType: 1, - gradientLength: 1, - gradientOpacity: 1, - gradientStrokeColor: 1, - gradientStrokeWidth: 1, - gradientThickness: 1, - gridAlign: 1, - labelAlign: 1, - labelBaseline: 1, - labelColor: 1, - labelFont: 1, - labelFontSize: 1, - labelFontStyle: 1, - labelFontWeight: 1, - labelLimit: 1, - labelOffset: 1, - labelOpacity: 1, - labelOverlap: 1, - labelPadding: 1, - labelSeparation: 1, - legendX: 1, - legendY: 1, - offset: 1, - orient: 1, - padding: 1, - rowPadding: 1, - strokeColor: 1, - symbolDash: 1, - symbolDashOffset: 1, - symbolFillColor: 1, - symbolLimit: 1, - symbolOffset: 1, - symbolOpacity: 1, - symbolSize: 1, - symbolStrokeColor: 1, - symbolStrokeWidth: 1, - symbolType: 1, - tickCount: 1, - tickMinStep: 1, - title: 1, - titleAlign: 1, - titleAnchor: 1, - titleBaseline: 1, - titleColor: 1, - titleFont: 1, - titleFontSize: 1, - titleFontStyle: 1, - titleFontWeight: 1, - titleLimit: 1, - titleLineHeight: 1, - titleOpacity: 1, - titleOrient: 1, - titlePadding: 1, - type: 1, - values: 1, - zindex: 1 -}; - -export const LEGEND_PROPERTIES = keys(COMMON_LEGEND_PROPERTY_INDEX); diff --git a/node_modules/vega-lite/src/log/index.ts b/node_modules/vega-lite/src/log/index.ts deleted file mode 100644 index a33c496..0000000 --- a/node_modules/vega-lite/src/log/index.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Vega-Lite's singleton logger utility. - */ - -import {Debug, Error as ErrorLevel, Info, logger, LoggerInterface, Warn} from 'vega-util'; -export * as message from './message'; - -/** - * Main (default) Vega Logger instance for Vega-Lite. - */ -const main = logger(Warn); -let current: LoggerInterface = main; - -/** - * Logger tool for checking if the code throws correct warning. - */ -export class LocalLogger implements LoggerInterface { - public warns: any[] = []; - public infos: any[] = []; - public debugs: any[] = []; - - #level: number = Warn; - - public level(): number; - public level(_: number): this; - public level(_?: number) { - if (_) { - this.#level = _; - return this; - } - return this.#level; - } - - public warn(...args: readonly any[]) { - if (this.#level >= Warn) this.warns.push(...args); - return this; - } - - public info(...args: readonly any[]) { - if (this.#level >= Info) this.infos.push(...args); - return this; - } - - public debug(...args: readonly any[]) { - if (this.#level >= Debug) this.debugs.push(...args); - return this; - } - - public error(...args: readonly any[]): this { - if (this.#level >= ErrorLevel) throw Error(...args); - return this; - } -} - -export function wrap(f: (logger: LocalLogger) => void) { - return () => { - current = new LocalLogger(); - f(current as LocalLogger); - reset(); - }; -} - -/** - * Set the singleton logger to be a custom logger. - */ -export function set(newLogger: LoggerInterface) { - current = newLogger; - return current; -} - -/** - * Reset the main logger to use the default Vega Logger. - */ -export function reset() { - current = main; - return current; -} - -export function error(...args: readonly any[]) { - current.error(...args); -} - -export function warn(...args: readonly any[]) { - current.warn(...args); -} - -export function info(...args: readonly any[]) { - current.info(...args); -} - -export function debug(...args: readonly any[]) { - current.debug(...args); -} diff --git a/node_modules/vega-lite/src/log/message.ts b/node_modules/vega-lite/src/log/message.ts deleted file mode 100644 index 3416ece..0000000 --- a/node_modules/vega-lite/src/log/message.ts +++ /dev/null @@ -1,368 +0,0 @@ -/** - * Collection of all Vega-Lite Error Messages - */ -import {AggregateOp} from 'vega'; -import {Aggregate} from '../aggregate'; -import { - Channel, - FacetChannel, - GeoPositionChannel, - getSizeChannel, - PositionScaleChannel, - ScaleChannel, - ExtendedChannel -} from '../channel'; -import {HiddenCompositeAggregate, TypedFieldDef, Value} from '../channeldef'; -import {SplitParentProperty} from '../compile/split'; -import {CompositeMark} from '../compositemark'; -import {ErrorBarCenter, ErrorBarExtent} from '../compositemark/errorbar'; -import {DateTime, DateTimeExpr} from '../datetime'; -import {Mark} from '../mark'; -import {Projection} from '../projection'; -import {ScaleType} from '../scale'; -import {GenericSpec} from '../spec'; -import {Type} from '../type'; -import {stringify} from '../util'; -import {VgSortField} from '../vega.schema'; - -export function invalidSpec(spec: GenericSpec) { - return `Invalid specification ${JSON.stringify( - spec - )}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`; -} - -// FIT -export const FIT_NON_SINGLE = 'Autosize "fit" only works for single views and layered views.'; - -export function containerSizeNonSingle(name: 'width' | 'height') { - const uName = name == 'width' ? 'Width' : 'Height'; - return `${uName} "container" only works for single views and layered views.`; -} - -export function containerSizeNotCompatibleWithAutosize(name: 'width' | 'height') { - const uName = name == 'width' ? 'Width' : 'Height'; - const fitDirection = name == 'width' ? 'x' : 'y'; - return `${uName} "container" only works well with autosize "fit" or "fit-${fitDirection}".`; -} - -export function droppingFit(channel?: PositionScaleChannel) { - return channel - ? `Dropping "fit-${channel}" because spec has discrete ${getSizeChannel(channel)}.` - : `Dropping "fit" because spec has discrete size.`; -} - -// VIEW SIZE - -export function unknownField(channel: Channel) { - return `Unknown field for ${channel}. Cannot calculate view size.`; -} - -// SELECTION -export function cannotProjectOnChannelWithoutField(channel: Channel) { - return `Cannot project a selection on encoding channel "${channel}", which has no field.`; -} - -export function cannotProjectAggregate(channel: Channel, aggregate: Aggregate | HiddenCompositeAggregate) { - return `Cannot project a selection on encoding channel "${channel}" as it uses an aggregate function ("${aggregate}").`; -} - -export function nearestNotSupportForContinuous(mark: string) { - return `The "nearest" transform is not supported for ${mark} marks.`; -} - -export function selectionNotSupported(mark: CompositeMark) { - return `Selection not supported for ${mark} yet.`; -} - -export function selectionNotFound(name: string) { - return `Cannot find a selection named "${name}".`; -} - -export const SCALE_BINDINGS_CONTINUOUS = - 'Scale bindings are currently only supported for scales with unbinned, continuous domains.'; - -export const LEGEND_BINDINGS_MUST_HAVE_PROJECTION = - 'Legend bindings are only supported for selections over an individual field or encoding channel.'; -export function noSameUnitLookup(name: string) { - return ( - `Cannot define and lookup the "${name}" selection in the same view. ` + - `Try moving the lookup into a second, layered view?` - ); -} - -export const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.'; - -export const INTERVAL_INITIALIZED_WITH_X_Y = 'Interval selections should be initialized using "x" and/or "y" keys.'; - -// REPEAT -export function noSuchRepeatedValue(field: string) { - return `Unknown repeated value "${field}".`; -} - -export function columnsNotSupportByRowCol(type: 'facet' | 'repeat') { - return `The "columns" property cannot be used when "${type}" has nested row/column.`; -} - -// CONCAT / REPEAT -export const CONCAT_CANNOT_SHARE_AXIS = - 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).'; - -// DATA -export function unrecognizedParse(p: string) { - return `Unrecognized parse "${p}".`; -} - -export function differentParse(field: string, local: string, ancestor: string) { - return `An ancestor parsed field "${field}" as ${ancestor} but a child wants to parse the field as ${local}.`; -} - -export const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.'; - -// TRANSFORMS -export function invalidTransformIgnored(transform: any) { - return `Ignoring an invalid transform: ${stringify(transform)}.`; -} - -export const NO_FIELDS_NEEDS_AS = - 'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'; - -// ENCODING & FACET - -export function customFormatTypeNotAllowed(channel: ExtendedChannel) { - return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`; -} - -export function projectionOverridden(opt: {parentProjection: Projection; projection: Projection}) { - const {parentProjection, projection} = opt; - return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify( - projection - )}.`; -} - -export const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.'; - -export function primitiveChannelDef( - channel: ExtendedChannel, - type: 'string' | 'number' | 'boolean', - value: Exclude -) { - return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`; -} - -export function invalidFieldType(type: Type) { - return `Invalid field type "${type}".`; -} - -export function invalidFieldTypeForCountAggregate(type: Type, aggregate: Aggregate | string) { - return `Invalid field type "${type}" for aggregate: "${aggregate}", using "quantitative" instead.`; -} - -export function invalidAggregate(aggregate: AggregateOp | string) { - return `Invalid aggregation operator "${aggregate}".`; -} - -export function missingFieldType(channel: Channel, newType: Type) { - return `Missing type for channel "${channel}", using "${newType}" instead.`; -} -export function droppingColor(type: 'encoding' | 'property', opt: {fill?: boolean; stroke?: boolean}) { - const {fill, stroke} = opt; - return `Dropping color ${type} as the plot also has ${ - fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke' - }.`; -} - -export function emptyFieldDef(fieldDef: unknown, channel: ExtendedChannel) { - return `Dropping ${stringify( - fieldDef - )} from channel "${channel}" since it does not contain any data field, datum, value, or signal.`; -} -export function latLongDeprecated(channel: Channel, type: Type, newChannel: GeoPositionChannel) { - return `${channel}-encoding with type ${type} is deprecated. Replacing with ${newChannel}-encoding.`; -} - -export const LINE_WITH_VARYING_SIZE = - 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.'; - -export function incompatibleChannel( - channel: ExtendedChannel, - markOrFacet: Mark | 'facet' | CompositeMark, - when?: string -) { - return `${channel} dropped as it is incompatible with "${markOrFacet}"${when ? ` when ${when}` : ''}.`; -} - -export function invalidEncodingChannel(channel: ExtendedChannel) { - return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`; -} - -export function facetChannelShouldBeDiscrete(channel: FacetChannel) { - return `${channel} encoding should be discrete (ordinal / nominal / binned).`; -} - -export function facetChannelDropped(channels: FacetChannel[]) { - return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`; -} - -export function discreteChannelCannotEncode(channel: Channel, type: Type) { - return `Using discrete channel "${channel}" to encode "${type}" field can be misleading as it does not encode ${ - type === 'ordinal' ? 'order' : 'magnitude' - }.`; -} - -// MARK -export function lineWithRange(hasX2: boolean, hasY2: boolean) { - const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2'; - return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`; -} - -export function orientOverridden(original: string, actual: string) { - return `Specified orient "${original}" overridden with "${actual}".`; -} - -// SCALE -export const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN = - 'Custom domain scale cannot be unioned with default field-based domain.'; - -export const RANGE_STEP_DEPRECATED = `Scale's "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.`; - -export function cannotUseScalePropertyWithNonColor(prop: string) { - return `Cannot use the scale property "${prop}" with non-color channel.`; -} - -export function unaggregateDomainHasNoEffectForRawField(fieldDef: TypedFieldDef) { - return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`; -} - -export function unaggregateDomainWithNonSharedDomainOp(aggregate: Aggregate | string) { - return `Unaggregated domain not applicable for "${aggregate}" since it produces values outside the origin domain of the source data.`; -} - -export function unaggregatedDomainWithLogScale(fieldDef: TypedFieldDef) { - return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`; -} - -export function cannotApplySizeToNonOrientedMark(mark: Mark) { - return `Cannot apply size to non-oriented mark "${mark}".`; -} - -export function scaleTypeNotWorkWithChannel(channel: Channel, scaleType: ScaleType, defaultScaleType: ScaleType) { - return `Channel "${channel}" does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; -} - -export function scaleTypeNotWorkWithFieldDef(scaleType: ScaleType, defaultScaleType: ScaleType) { - return `FieldDef does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; -} - -export function scalePropertyNotWorkWithScaleType(scaleType: ScaleType, propName: string, channel: Channel) { - return `${channel}-scale's "${propName}" is dropped as it does not work with ${scaleType} scale.`; -} - -export function scaleTypeNotWorkWithMark(mark: Mark, scaleType: ScaleType) { - return `Scale type "${scaleType}" does not work with mark "${mark}".`; -} - -export function stepDropped(channel: 'width' | 'height') { - return `The step for "${channel}" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`; -} - -export function mergeConflictingProperty( - property: string | number | symbol, - propertyOf: SplitParentProperty, - v1: T, - v2: T -) { - return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify( - v2 - )}). Using ${stringify(v1)}.`; -} - -export function mergeConflictingDomainProperty(property: 'domains', propertyOf: SplitParentProperty, v1: T, v2: T) { - return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify( - v2 - )}). Using the union of the two domains.`; -} - -export function independentScaleMeansIndependentGuide(channel: Channel) { - return `Setting the scale to be independent for "${channel}" means we also have to set the guide (axis or legend) to be independent.`; -} - -export function domainSortDropped(sort: VgSortField) { - return `Dropping sort property ${stringify( - sort - )} as unioned domains only support boolean or op "count", "min", and "max".`; -} - -export const MORE_THAN_ONE_SORT = - 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.'; - -export const FACETED_INDEPENDENT_DIFFERENT_SOURCES = - 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.'; - -export const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = - 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.'; - -export const FACETED_INDEPENDENT_SAME_SOURCE = - 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.'; - -// AXIS -export const INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.'; - -// STACK -export function cannotStackRangedMark(channel: Channel) { - return `Cannot stack "${channel}" if there is already "${channel}2".`; -} - -export function cannotStackNonLinearScale(scaleType: ScaleType) { - return `Cannot stack non-linear scale (${scaleType}).`; -} - -export function stackNonSummativeAggregate(aggregate: Aggregate | string) { - return `Stacking is applied even though the aggregate function is non-summative ("${aggregate}").`; -} - -// TIMEUNIT -export function invalidTimeUnit(unitName: string, value: string | number) { - return `Invalid ${unitName}: ${stringify(value)}.`; -} - -export function droppedDay(d: DateTime | DateTimeExpr) { - return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`; -} - -export function errorBarCenterAndExtentAreNotNeeded(center: ErrorBarCenter, extent: ErrorBarExtent) { - return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${ - extent && center ? 'are ' : 'is ' - }not needed when data are aggregated.`; -} - -export function errorBarCenterIsUsedWithWrongExtent( - center: ErrorBarCenter, - extent: ErrorBarExtent, - mark: 'errorbar' | 'errorband' -) { - return `${center} is not usually used with ${extent} for ${mark}.`; -} - -export function errorBarContinuousAxisHasCustomizedAggregate( - aggregate: Aggregate | string, - compositeMark: CompositeMark -) { - return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`; -} - -export function errorBand1DNotSupport(property: 'interpolate' | 'tension') { - return `1D error band does not support ${property}.`; -} - -// CHANNEL -export function channelRequiredForBinned(channel: Channel) { - return `Channel ${channel} is required for "binned" bin.`; -} - -export function channelShouldNotBeUsedForBinned(channel: ExtendedChannel) { - return `Channel ${channel} should not be used with "binned" bin.`; -} - -export function domainRequiredForThresholdScale(channel: ScaleChannel) { - return `Domain for ${channel} is required for threshold scale.`; -} diff --git a/node_modules/vega-lite/src/logical.ts b/node_modules/vega-lite/src/logical.ts deleted file mode 100644 index 80f57c4..0000000 --- a/node_modules/vega-lite/src/logical.ts +++ /dev/null @@ -1,56 +0,0 @@ -export type LogicalComposition = LogicalNot | LogicalAnd | LogicalOr | T; - -export interface LogicalOr { - or: LogicalComposition[]; -} - -export interface LogicalAnd { - and: LogicalComposition[]; -} - -export interface LogicalNot { - not: LogicalComposition; -} - -export function isLogicalOr(op: LogicalComposition): op is LogicalOr { - return !!op.or; -} - -export function isLogicalAnd(op: LogicalComposition): op is LogicalAnd { - return !!op.and; -} - -export function isLogicalNot(op: LogicalComposition): op is LogicalNot { - return !!op.not; -} - -export function forEachLeaf(op: LogicalComposition, fn: (op: T) => void) { - if (isLogicalNot(op)) { - forEachLeaf(op.not, fn); - } else if (isLogicalAnd(op)) { - for (const subop of op.and) { - forEachLeaf(subop, fn); - } - } else if (isLogicalOr(op)) { - for (const subop of op.or) { - forEachLeaf(subop, fn); - } - } else { - fn(op); - } -} - -export function normalizeLogicalComposition( - op: LogicalComposition, - normalizer: (o: T) => T -): LogicalComposition { - if (isLogicalNot(op)) { - return {not: normalizeLogicalComposition(op.not, normalizer)}; - } else if (isLogicalAnd(op)) { - return {and: op.and.map(o => normalizeLogicalComposition(o, normalizer))}; - } else if (isLogicalOr(op)) { - return {or: op.or.map(o => normalizeLogicalComposition(o, normalizer))}; - } else { - return normalizer(op); - } -} diff --git a/node_modules/vega-lite/src/mark.ts b/node_modules/vega-lite/src/mark.ts deleted file mode 100644 index 3164c32..0000000 --- a/node_modules/vega-lite/src/mark.ts +++ /dev/null @@ -1,597 +0,0 @@ -import {Align, Color, Gradient, MarkConfig as VgMarkConfig, Orientation, SignalRef, TextBaseline} from 'vega'; -import {toSet} from 'vega-util'; -import {CompositeMark, CompositeMarkDef} from './compositemark'; -import {contains, Flag, keys} from './util'; - -/** - * All types of primitive marks. - */ -export const Mark = { - arc: 'arc', - area: 'area', - bar: 'bar', - image: 'image', - line: 'line', - point: 'point', - rect: 'rect', - rule: 'rule', - text: 'text', - tick: 'tick', - trail: 'trail', - circle: 'circle', - square: 'square', - geoshape: 'geoshape' -} as const; - -export const ARC = Mark.arc; -export const AREA = Mark.area; -export const BAR = Mark.bar; -export const IMAGE = Mark.image; -export const LINE = Mark.line; -export const POINT = Mark.point; -export const RECT = Mark.rect; -export const RULE = Mark.rule; -export const TEXT = Mark.text; -export const TICK = Mark.tick; -export const TRAIL = Mark.trail; -export const CIRCLE = Mark.circle; -export const SQUARE = Mark.square; -export const GEOSHAPE = Mark.geoshape; - -export type Mark = keyof typeof Mark; - -export function isMark(m: string): m is Mark { - return m in Mark; -} - -export function isPathMark(m: Mark | CompositeMark): m is 'line' | 'area' | 'trail' { - return contains(['line', 'area', 'trail'], m); -} - -export function isRectBasedMark(m: Mark | CompositeMark): m is 'rect' | 'bar' | 'image' | 'arc' { - return contains(['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */], m); -} - -export const PRIMITIVE_MARKS = keys(Mark); - -export interface ColorMixins { - /** - * Default color. - * - * __Default value:__ `"#4682b4"` - * - * __Note:__ - * - This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config). - * - The `fill` and `stroke` properties have higher precedence than `color` and will override `color`. - */ - color?: Color | Gradient | SignalRef; -} - -export interface TooltipContent { - content: 'encoding' | 'data'; -} - -/** @hidden */ -export type Hide = 'hide'; - -export interface VLOnlyMarkConfig extends ColorMixins { - /** - * Whether the mark's color should be used as fill color instead of stroke color. - * - * __Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`. - * - * __Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config). - * - */ - filled?: boolean; - - /** - * Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`). - * - If set to `"filter"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks). - * - If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes. - */ - invalid?: 'filter' | Hide | null; - - /** - * For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources. - */ - order?: null | boolean; - - /** - * Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. - * If set to `0.5`, the marks will be positioned in the middle of the time unit band step. - */ - timeUnitBandPosition?: number; - - /** - * Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. - * If set to `0.5`, bandwidth of the marks will be half of the time unit band step. - */ - timeUnitBand?: number; - - /** - * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise. - */ - theta2?: number | SignalRef; // In Vega, this is called endAngle - - /** - * The secondary (inner) radius in pixels of arc marks. - * - * @minimum 0 - * __Default value:__ `0` - */ - radius2?: number | SignalRef; // In Vega, this is called innerRadius -} - -export interface MarkConfig extends VLOnlyMarkConfig, Omit { - // ========== Overriding Vega ========== - - /** - * The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from. - * - * - If `tooltip` is `true` or `{"content": "encoding"}`, then all fields from `encoding` will be used. - * - If `tooltip` is `{"content": "data"}`, then all fields that appear in the highlighted data point will be used. - * - If set to `null` or `false`, then no tooltip will be used. - * - * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite. - * - * __Default value:__ `null` - */ - tooltip?: number | string | boolean | TooltipContent | SignalRef | null; // VL has a special object form for tooltip content - - /** - * Default size for marks. - * - For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value. - * - For `bar`, this represents the band size of the bar, in pixels. - * - For `text`, this represents the font size, in pixels. - * - * __Default value:__ - * - `30` for point, circle, square marks; width/height's `step` - * - `2` for bar marks with discrete dimensions; - * - `5` for bar marks with continuous dimensions; - * - `11` for text marks. - * - * @minimum 0 - */ - size?: number | SignalRef; // size works beyond symbol marks in VL - - /** - * X coordinates of the marks, or width of horizontal `"bar"` and `"area"` without specified `x2` or `width`. - * - * The `value` of this channel can be a number or a string `"width"` for the width of the plot. - */ - x?: number | 'width' | SignalRef; // Vega doesn't have 'width' - - /** - * Y coordinates of the marks, or height of vertical `"bar"` and `"area"` without specified `y2` or `height`. - * - * The `value` of this channel can be a number or a string `"height"` for the height of the plot. - */ - y?: number | 'height' | SignalRef; // Vega doesn't have 'height' - - /** - * X2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - * - * The `value` of this channel can be a number or a string `"width"` for the width of the plot. - */ - x2?: number | 'width' | SignalRef; // Vega doesn't have 'width' - - /** - * Y2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. - * - * The `value` of this channel can be a number or a string `"height"` for the height of the plot. - */ - y2?: number | 'height' | SignalRef; // Vega doesn't have 'height' - - /** - * Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill. - * - * __Default value:__ (None) - * - */ - fill?: Color | Gradient | null | SignalRef; // docs: Vega doesn't have config.color - - /** - * Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke. - * - * __Default value:__ (None) - * - */ - stroke?: Color | Gradient | null | SignalRef; // docs: Vega doesn't have config.color - - /** - * The overall opacity (value between [0,1]). - * - * __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise. - * - * @minimum 0 - * @maximum 1 - */ - opacity?: number | SignalRef; // docs (different defaults) - - /** - * The orientation of a non-stacked bar, tick, area, and line charts. - * The value is either horizontal (default) or vertical. - * - For bar, rule and tick, this determines whether the size of the bar and tick - * should be applied to x or y dimension. - * - For area, this property determines the orient property of the Vega output. - * - For line and trail marks, this property determines the sort order of the points in the line - * if `config.sortLineBy` is not specified. - * For stacked charts, this is always determined by the orientation of the stack; - * therefore explicitly specified value will be ignored. - */ - orient?: Orientation; // Vega orient doesn't apply to bar/tick/line. Since some logic depends on this property, Vega-Lite does NOT allow signal for orient. - - /** - * The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `"left"`, `"right"`, `"center"`. - */ - align?: Align; // Vega doesn't apply align to ranged marks. Since some logic depends on this property, Vega-Lite does NOT allow signal for align. - - /** - * The vertical text baseline. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the `lineHeight` rather than `fontSize` alone. - */ - baseline?: TextBaseline; // Vega doesn't apply align to ranged marks. Since some logic depends on this property, Vega-Lite does NOT allow signal for baseline. - - /** - * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.) - * - * - For text marks, polar coordinate angle in radians. - * - * @minimum 0 - * @maximum 360 - */ - theta?: number | SignalRef; // overriding VG - - /** - * - * For arc mark, the primary (outer) radius in pixels. - * - * For text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties. - * - * @minimum 0 - * - * __Default value:__ `min(plot_width, plot_height)/2` - */ - radius?: number | SignalRef; // overriding VG - - /** - * The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`. - * - * @minimum 0 - * __Default value:__ `0` - */ - innerRadius?: number | SignalRef; - - /** - * The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`. - * - * @minimum 0 - * __Default value:__ `0` - */ - outerRadius?: number | SignalRef; -} - -export interface RectBinSpacingMixins { - /** - * Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style). - * - * __Default value:__ `1` - * - * @minimum 0 - */ - binSpacing?: number; -} - -export type AnyMark = CompositeMark | CompositeMarkDef | Mark | MarkDef; - -export function isMarkDef(mark: string | GenericMarkDef): mark is GenericMarkDef { - return mark['type']; -} - -const PRIMITIVE_MARK_INDEX = toSet(PRIMITIVE_MARKS); - -export function isPrimitiveMark(mark: AnyMark): mark is Mark { - const markType = isMarkDef(mark) ? mark.type : mark; - return markType in PRIMITIVE_MARK_INDEX; -} - -export const STROKE_CONFIG = [ - 'stroke', - 'strokeWidth', - 'strokeDash', - 'strokeDashOffset', - 'strokeOpacity', - 'strokeJoin', - 'strokeMiterLimit' -] as const; - -export const FILL_CONFIG = ['fill', 'fillOpacity'] as const; - -export const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG]; - -const VL_ONLY_MARK_CONFIG_INDEX: Flag = { - color: 1, - filled: 1, - invalid: 1, - order: 1, - radius2: 1, - theta2: 1, - timeUnitBand: 1, - timeUnitBandPosition: 1 -}; - -export const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX); - -export const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: { - [k in Mark]?: (keyof Required[k])[]; -} = { - area: ['line', 'point'], - bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize'], - rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize'], - line: ['point'], - tick: ['bandSize', 'thickness'] -}; - -export const defaultMarkConfig: MarkConfig = { - color: '#4c78a8', - invalid: 'filter', - timeUnitBand: 1 -}; - -// TODO: replace with MarkConfigMixins[Mark] once https://github.com/vega/ts-json-schema-generator/issues/344 is fixed -export type AnyMarkConfig = MarkConfig | AreaConfig | BarConfig | RectConfig | LineConfig | TickConfig; - -export interface MarkConfigMixins { - /** Mark Config */ - mark?: MarkConfig; - - // MARK-SPECIFIC CONFIGS - - /** Arc-specific Config */ - arc?: RectConfig; - - /** Area-Specific Config */ - area?: AreaConfig; - - /** Bar-Specific Config */ - bar?: BarConfig; - - /** Circle-Specific Config */ - circle?: MarkConfig; - - /** Image-specific Config */ - image?: RectConfig; - - /** Line-Specific Config */ - line?: LineConfig; - - /** Point-Specific Config */ - point?: MarkConfig; - - /** Rect-Specific Config */ - rect?: RectConfig; - - /** Rule-Specific Config */ - rule?: MarkConfig; - - /** Square-Specific Config */ - square?: MarkConfig; - - /** Text-Specific Config */ - text?: MarkConfig; - - /** Tick-Specific Config */ - tick?: TickConfig; - - /** Trail-Specific Config */ - trail?: LineConfig; - - /** Geoshape-Specific Config */ - geoshape?: MarkConfig; -} - -export interface RectConfig extends RectBinSpacingMixins, MarkConfig { - /** - * The default size of the bars on continuous scales. - * - * __Default value:__ `5` - * - * @minimum 0 - */ - continuousBandSize?: number; - - /** - * The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars. - * @minimum 0 - */ - discreteBandSize?: number; -} - -export const BAR_CORNER_RADIUS_INDEX: Partial> = { - horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'], - vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight'] -}; - -export interface BarCornerRadiusMixins { - /** - * - For vertical bars, top-left and top-right corner radius. - * - For horizontal bars, top-right and bottom-right corner radius. - */ - cornerRadiusEnd?: number | SignalRef; -} - -export type BarConfig = RectConfig & BarCornerRadiusMixins; - -export type OverlayMarkDef = MarkConfig & MarkDefMixins; - -export interface PointOverlayMixins { - /** - * A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points. - * - * - If this property is `"transparent"`, transparent points will be used (for enhancing tooltips and selections). - * - * - If this property is an empty object (`{}`) or `true`, filled points with default properties will be used. - * - * - If this property is `false`, no points would be automatically added to line or area marks. - * - * __Default value:__ `false`. - */ - point?: boolean | OverlayMarkDef | 'transparent'; -} - -export interface LineConfig extends MarkConfig, PointOverlayMixins {} - -export interface LineOverlayMixins { - /** - * A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines. - * - * - If this value is an empty object (`{}`) or `true`, lines with default properties will be used. - * - * - If this value is `false`, no lines would be automatically added to area marks. - * - * __Default value:__ `false`. - */ - line?: boolean | OverlayMarkDef; -} - -export interface AreaConfig extends MarkConfig, PointOverlayMixins, LineOverlayMixins {} - -export interface TickThicknessMixins { - /** - * Thickness of the tick mark. - * - * __Default value:__ `1` - * - * @minimum 0 - */ - thickness?: number | SignalRef; -} - -export interface GenericMarkDef { - /** - * The mark type. This could a primitive mark type - * (one of `"bar"`, `"circle"`, `"square"`, `"tick"`, `"line"`, - * `"area"`, `"point"`, `"geoshape"`, `"rule"`, and `"text"`) - * or a composite mark type (`"boxplot"`, `"errorband"`, `"errorbar"`). - */ - type: M; -} - -export interface MarkDefMixins { - /** - * A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](https://vega.github.io/vega-lite/docs/encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default. - * - * __Default value:__ The mark's name. For example, a bar mark will have style `"bar"` by default. - * __Note:__ Any specified style will augment the default style. For example, a bar mark with `"style": "foo"` will receive from `config.style.bar` and `config.style.foo` (the specified style `"foo"` has higher precedence). - */ - style?: string | string[]; - - /** - * Whether a mark be clipped to the enclosing group’s width and height. - */ - clip?: boolean; - - // Offset properties should not be a part of config - - /** - * Offset for x-position. - */ - xOffset?: number | SignalRef; - - /** - * Offset for y-position. - */ - yOffset?: number | SignalRef; - - /** - * Offset for x2-position. - */ - x2Offset?: number | SignalRef; - - /** - * Offset for y2-position. - */ - y2Offset?: number | SignalRef; - - /** - * Offset for theta. - */ - thetaOffset?: number | SignalRef; - - /** - * Offset for theta2. - */ - theta2Offset?: number | SignalRef; - - /** - * Offset for radius. - */ - radiusOffset?: number | SignalRef; - - /** - * Offset for radius2. - */ - radius2Offset?: number | SignalRef; -} - -// Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef - -// Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef -export interface MarkDef - extends GenericMarkDef, - Omit< - MarkConfig & - AreaConfig & - BarConfig & // always extends RectConfig - LineConfig & - TickConfig, - 'startAngle' | 'endAngle' - >, - MarkDefMixins { - // Omit startAngle/endAngle since we use theta/theta2 from Vega-Lite schema to avoid confusion - // We still support start/endAngle only in config, just in case people use Vega config with Vega-Lite. - - /** - * @hidden - */ - startAngle?: number | SignalRef; - /** - * @hidden - */ - endAngle?: number | SignalRef; -} - -const DEFAULT_RECT_BAND_SIZE = 5; - -export const defaultBarConfig: RectConfig = { - binSpacing: 1, - continuousBandSize: DEFAULT_RECT_BAND_SIZE, - timeUnitBandPosition: 0.5 -}; - -export const defaultRectConfig: RectConfig = { - binSpacing: 0, - continuousBandSize: DEFAULT_RECT_BAND_SIZE, - timeUnitBandPosition: 0.5 -}; - -export interface TickConfig extends MarkConfig, TickThicknessMixins { - /** - * The width of the ticks. - * - * __Default value:__ 3/4 of step (width step for horizontal ticks and height step for vertical ticks). - * @minimum 0 - */ - bandSize?: number; -} - -export const defaultTickConfig: TickConfig = { - thickness: 1 -}; - -export function getMarkType(m: string | GenericMarkDef) { - return isMarkDef(m) ? m.type : m; -} diff --git a/node_modules/vega-lite/src/normalize/base.ts b/node_modules/vega-lite/src/normalize/base.ts deleted file mode 100644 index 1fc6a08..0000000 --- a/node_modules/vega-lite/src/normalize/base.ts +++ /dev/null @@ -1,43 +0,0 @@ -import {Config} from '../config'; -import {Encoding} from '../encoding'; -import {Projection} from '../projection'; -import {GenericSpec, NormalizedSpec} from '../spec'; -import {GenericLayerSpec, NormalizedLayerSpec} from '../spec/layer'; -import {GenericUnitSpec, NormalizedUnitSpec} from '../spec/unit'; -import {FieldName} from '../channeldef'; -import {RepeaterValue} from './repeater'; - -export type Normalize, NS extends NormalizedSpec> = ( - spec: S, - params: NormalizerParams -) => NS; - -export interface ExtraNormalizer< - S extends GenericSpec, // Input type - O extends NormalizedSpec, // Output Type - SN extends GenericSpec = S // input to additional normalization -> { - name: string; - hasMatchingType: (spec: GenericSpec, config: Config) => spec is S; - - run(spec: S, params: NormalizerParams, normalize: Normalize): O; -} - -export type NonFacetUnitNormalizer> = ExtraNormalizer< - S, - NormalizedUnitSpec | NormalizedLayerSpec, - GenericUnitSpec | GenericLayerSpec ->; - -export type NormalizeLayerOrUnit = Normalize< - GenericUnitSpec | GenericLayerSpec, - NormalizedUnitSpec | NormalizedLayerSpec ->; - -export interface NormalizerParams { - config: Config; - parentEncoding?: Encoding; - parentProjection?: Projection; - repeater?: RepeaterValue; - repeaterPrefix?: string; -} diff --git a/node_modules/vega-lite/src/normalize/core.ts b/node_modules/vega-lite/src/normalize/core.ts deleted file mode 100644 index 5f8e3ae..0000000 --- a/node_modules/vega-lite/src/normalize/core.ts +++ /dev/null @@ -1,388 +0,0 @@ -import {isArray} from 'vega-util'; -import {COLUMN, FACET, ROW} from '../channel'; -import {Field, FieldName, hasConditionalFieldOrDatumDef, isFieldOrDatumDef, isValueDef} from '../channeldef'; -import {SharedCompositeEncoding} from '../compositemark'; -import {boxPlotNormalizer} from '../compositemark/boxplot'; -import {errorBandNormalizer} from '../compositemark/errorband'; -import {errorBarNormalizer} from '../compositemark/errorbar'; -import {channelHasField, Encoding} from '../encoding'; -import * as log from '../log'; -import {Projection} from '../projection'; -import {FacetedUnitSpec, GenericSpec, LayerSpec, UnitSpec} from '../spec'; -import {GenericCompositionLayoutWithColumns} from '../spec/base'; -import {GenericConcatSpec} from '../spec/concat'; -import { - FacetEncodingFieldDef, - FacetFieldDef, - FacetMapping, - GenericFacetSpec, - isFacetMapping, - NormalizedFacetSpec -} from '../spec/facet'; -import {NormalizedSpec} from '../spec/index'; -import {NormalizedLayerSpec} from '../spec/layer'; -import {SpecMapper} from '../spec/map'; -import {isLayerRepeatSpec, LayerRepeatSpec, NonLayerRepeatSpec, RepeatSpec} from '../spec/repeat'; -import {isUnitSpec, NormalizedUnitSpec} from '../spec/unit'; -import {isEmpty, keys, omit, varName} from '../util'; -import {isSignalRef} from '../vega.schema'; -import {NonFacetUnitNormalizer, NormalizerParams} from './base'; -import {PathOverlayNormalizer} from './pathoverlay'; -import {RangeStepNormalizer} from './rangestep'; -import {replaceRepeaterInEncoding, replaceRepeaterInFacet} from './repeater'; -import {RuleForRangedLineNormalizer} from './ruleforrangedline'; - -export class CoreNormalizer extends SpecMapper { - private nonFacetUnitNormalizers: NonFacetUnitNormalizer[] = [ - boxPlotNormalizer, - errorBarNormalizer, - errorBandNormalizer, - new PathOverlayNormalizer(), - new RuleForRangedLineNormalizer(), - new RangeStepNormalizer() - ]; - - public map(spec: GenericSpec, params: NormalizerParams) { - // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec. - if (isUnitSpec(spec)) { - const hasRow = channelHasField(spec.encoding, ROW); - const hasColumn = channelHasField(spec.encoding, COLUMN); - const hasFacet = channelHasField(spec.encoding, FACET); - - if (hasRow || hasColumn || hasFacet) { - return this.mapFacetedUnit(spec, params); - } - } - - return super.map(spec, params); - } - - // This is for normalizing non-facet unit - public mapUnit(spec: UnitSpec, params: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec { - const {parentEncoding, parentProjection} = params; - - const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater); - - const specWithReplacedEncoding = { - ...spec, - ...(encoding ? {encoding} : {}) - }; - - if (parentEncoding || parentProjection) { - return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params); - } - - const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this); - - for (const unitNormalizer of this.nonFacetUnitNormalizers) { - if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) { - return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit); - } - } - - return specWithReplacedEncoding as NormalizedUnitSpec; - } - - protected mapRepeat( - spec: RepeatSpec, - params: NormalizerParams - ): GenericConcatSpec | NormalizedLayerSpec { - if (isLayerRepeatSpec(spec)) { - return this.mapLayerRepeat(spec, params); - } else { - return this.mapNonLayerRepeat(spec, params); - } - } - - private mapLayerRepeat( - spec: LayerRepeatSpec, - params: NormalizerParams - ): GenericConcatSpec | NormalizedLayerSpec { - const {repeat, spec: childSpec, ...rest} = spec; - const {row, column, layer} = repeat; - - const {repeater = {}, repeaterPrefix = ''} = params; - - if (row || column) { - return this.mapRepeat( - { - ...spec, - repeat: { - ...(row ? {row} : {}), - ...(column ? {column} : {}) - }, - spec: { - repeat: {layer}, - spec: childSpec - } - }, - params - ); - } else { - return { - ...rest, - layer: layer.map(layerValue => { - const childRepeater = { - ...repeater, - layer: layerValue - }; - - const childName = (childSpec.name || '') + repeaterPrefix + `child__layer_${varName(layerValue)}`; - - const child = this.mapLayerOrUnit(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName}); - child.name = childName; - - return child; - }) - }; - } - } - - private mapNonLayerRepeat(spec: NonLayerRepeatSpec, params: NormalizerParams): GenericConcatSpec { - const {repeat, spec: childSpec, data, ...remainingProperties} = spec; - - if (!isArray(repeat) && spec.columns) { - // is repeat with row/column - spec = omit(spec, ['columns']); - log.warn(log.message.columnsNotSupportByRowCol('repeat')); - } - - const concat: NormalizedSpec[] = []; - - const {repeater = {}, repeaterPrefix = ''} = params; - - const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null]; - const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null]; - - const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null]; - - // cross product - for (const repeatValue of repeatValues) { - for (const rowValue of row) { - for (const columnValue of column) { - const childRepeater = { - repeat: repeatValue, - row: rowValue, - column: columnValue, - layer: repeater.layer - }; - - const childName = - (childSpec.name || '') + - repeaterPrefix + - 'child__' + - (isArray(repeat) - ? `${varName(repeatValue)}` - : (repeat.row ? `row_${varName(rowValue)}` : '') + - (repeat.column ? `column_${varName(columnValue)}` : '')); - - const child = this.map(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName}); - child.name = childName; - - // we move data up - concat.push(omit(child, ['data']) as NormalizedSpec); - } - } - } - - const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1; - return { - data: childSpec.data ?? data, // data from child spec should have precedence - align: 'all', - ...remainingProperties, - columns, - concat - }; - } - - protected mapFacet( - spec: GenericFacetSpec, - params: NormalizerParams - ): GenericFacetSpec { - const {facet} = spec; - - if (isFacetMapping(facet) && spec.columns) { - // is facet with row/column - spec = omit(spec, ['columns']); - log.warn(log.message.columnsNotSupportByRowCol('facet')); - } - - return super.mapFacet(spec, params); - } - - private mapUnitWithParentEncodingOrProjection( - spec: FacetedUnitSpec, - params: NormalizerParams - ): NormalizedUnitSpec | NormalizedLayerSpec { - const {encoding, projection} = spec; - const {parentEncoding, parentProjection, config} = params; - const mergedProjection = mergeProjection({parentProjection, projection}); - const mergedEncoding = mergeEncoding({ - parentEncoding, - encoding: replaceRepeaterInEncoding(encoding, params.repeater) - }); - - return this.mapUnit( - { - ...spec, - ...(mergedProjection ? {projection: mergedProjection} : {}), - ...(mergedEncoding ? {encoding: mergedEncoding} : {}) - }, - {config} - ); - } - - private mapFacetedUnit(spec: FacetedUnitSpec, params: NormalizerParams): NormalizedFacetSpec { - // New encoding in the inside spec should not contain row / column - // as row/column should be moved to facet - const {row, column, facet, ...encoding} = spec.encoding; - - // Mark and encoding should be moved into the inner spec - const {mark, width, projection, height, view, selection, encoding: _, ...outerSpec} = spec; - - const {facetMapping, layout} = this.getFacetMappingAndLayout({row, column, facet}, params); - - const newEncoding = replaceRepeaterInEncoding(encoding, params.repeater); - - return this.mapFacet( - { - ...outerSpec, - ...layout, - - // row / column has higher precedence than facet - facet: facetMapping, - spec: { - ...(width ? {width} : {}), - ...(height ? {height} : {}), - ...(view ? {view} : {}), - ...(projection ? {projection} : {}), - mark, - encoding: newEncoding, - ...(selection ? {selection} : {}) - } - }, - params - ); - } - - private getFacetMappingAndLayout( - facets: { - row: FacetEncodingFieldDef; - column: FacetEncodingFieldDef; - facet: FacetEncodingFieldDef; - }, - params: NormalizerParams - ): {facetMapping: FacetMapping | FacetFieldDef; layout: GenericCompositionLayoutWithColumns} { - const {row, column, facet} = facets; - - if (row || column) { - if (facet) { - log.warn(log.message.facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])])); - } - - const facetMapping = {}; - const layout = {}; - - for (const channel of [ROW, COLUMN]) { - const def = facets[channel]; - if (def) { - const {align, center, spacing, columns, ...defWithoutLayout} = def; - facetMapping[channel] = defWithoutLayout; - - for (const prop of ['align', 'center', 'spacing'] as const) { - if (def[prop] !== undefined) { - layout[prop] = layout[prop] ?? {}; - layout[prop][channel] = def[prop]; - } - } - } - } - - return {facetMapping, layout}; - } else { - const {align, center, spacing, columns, ...facetMapping} = facet; - return { - facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater), - layout: { - ...(align ? {align} : {}), - ...(center ? {center} : {}), - ...(spacing ? {spacing} : {}), - ...(columns ? {columns} : {}) - } - }; - } - } - - public mapLayer( - spec: LayerSpec, - {parentEncoding, parentProjection, ...otherParams}: NormalizerParams - ): NormalizedLayerSpec { - // Special handling for extended layer spec - - const {encoding, projection, ...rest} = spec; - const params: NormalizerParams = { - ...otherParams, - parentEncoding: mergeEncoding({parentEncoding, encoding, layer: true}), - parentProjection: mergeProjection({parentProjection, projection}) - }; - return super.mapLayer(rest, params); - } -} - -function mergeEncoding({ - parentEncoding, - encoding = {}, - layer -}: { - parentEncoding: SharedCompositeEncoding; - encoding: SharedCompositeEncoding | Encoding; - layer?: boolean; -}): Encoding { - let merged: any = {}; - if (parentEncoding) { - const channels = new Set([...keys(parentEncoding), ...keys(encoding)]); - for (const channel of channels) { - const channelDef = encoding[channel]; - const parentChannelDef = parentEncoding[channel]; - - if (isFieldOrDatumDef(channelDef)) { - // Field/Datum Def can inherit properties from its parent - // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one. - const mergedChannelDef = { - ...parentChannelDef, - ...channelDef - }; - merged[channel] = mergedChannelDef; - } else if (hasConditionalFieldOrDatumDef(channelDef)) { - merged[channel] = { - ...channelDef, - condition: { - ...parentChannelDef, - ...channelDef.condition - } - }; - } else if (channelDef) { - merged[channel] = channelDef; - } else if ( - layer || - isValueDef(parentChannelDef) || - isSignalRef(parentChannelDef) || - isFieldOrDatumDef(parentChannelDef) || - isArray(parentChannelDef) - ) { - merged[channel] = parentChannelDef; - } - } - } else { - merged = encoding; - } - return !merged || isEmpty(merged) ? undefined : merged; -} - -function mergeProjection(opt: {parentProjection: Projection; projection: Projection}) { - const {parentProjection, projection} = opt; - if (parentProjection && projection) { - log.warn(log.message.projectionOverridden({parentProjection, projection})); - } - return projection ?? parentProjection; -} diff --git a/node_modules/vega-lite/src/normalize/index.ts b/node_modules/vega-lite/src/normalize/index.ts deleted file mode 100644 index fa45291..0000000 --- a/node_modules/vega-lite/src/normalize/index.ts +++ /dev/null @@ -1,121 +0,0 @@ -import {Field} from '../channeldef'; -import {isString} from 'vega-util'; -import {Config, initConfig} from '../config'; -import * as log from '../log'; -import { - LayerSpec, - FacetedUnitSpec, - GenericSpec, - isLayerSpec, - isUnitSpec, - LayoutSizeMixins, - NormalizedSpec, - TopLevelSpec, - UnitSpec, - RepeatSpec -} from '../spec'; -import {AutoSizeParams, AutosizeType, TopLevel} from '../spec/toplevel'; -import {deepEqual} from '../util'; -import {NormalizerParams} from './base'; -import {CoreNormalizer} from './core'; - -export function normalize( - spec: TopLevelSpec & LayoutSizeMixins, - config?: Config -): TopLevel & LayoutSizeMixins { - if (config === undefined) { - config = initConfig(spec.config); - } - - const normalizedSpec = normalizeGenericSpec(spec, config); - - const {width, height} = spec; - const autosize = normalizeAutoSize(normalizedSpec, {width, height, autosize: spec.autosize}, config); - - return { - ...normalizedSpec, - ...(autosize ? {autosize} : {}) - }; -} - -const normalizer = new CoreNormalizer(); - -/** - * Decompose extended unit specs into composition of pure unit specs. - */ -function normalizeGenericSpec( - spec: GenericSpec | FacetedUnitSpec | RepeatSpec, - config: Config = {} -) { - return normalizer.map(spec, {config}); -} - -function _normalizeAutoSize(autosize: AutosizeType | AutoSizeParams) { - return isString(autosize) ? {type: autosize} : autosize ?? {}; -} - -/** - * Normalize autosize and deal with width or height == "container". - */ -export function normalizeAutoSize( - spec: TopLevel, - sizeInfo: {autosize: AutosizeType | AutoSizeParams} & LayoutSizeMixins, - config?: Config -) { - let {width, height} = sizeInfo; - - const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec); - const autosizeDefault: AutoSizeParams = {}; - - if (!isFitCompatible) { - // If spec is not compatible with autosize == "fit", discard width/height == container - if (width == 'container') { - log.warn(log.message.containerSizeNonSingle('width')); - width = undefined; - } - if (height == 'container') { - log.warn(log.message.containerSizeNonSingle('height')); - height = undefined; - } - } else { - // Default autosize parameters to fit when width/height is "container" - if (width == 'container' && height == 'container') { - autosizeDefault.type = 'fit'; - autosizeDefault.contains = 'padding'; - } else if (width == 'container') { - autosizeDefault.type = 'fit-x'; - autosizeDefault.contains = 'padding'; - } else if (height == 'container') { - autosizeDefault.type = 'fit-y'; - autosizeDefault.contains = 'padding'; - } - } - - const autosize: AutoSizeParams = { - type: 'pad', - ...autosizeDefault, - ...(config ? _normalizeAutoSize(config.autosize) : {}), - ..._normalizeAutoSize(spec.autosize) - }; - - if (autosize.type === 'fit' && !isFitCompatible) { - log.warn(log.message.FIT_NON_SINGLE); - autosize.type = 'pad'; - } - - if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) { - log.warn(log.message.containerSizeNotCompatibleWithAutosize('width')); - } - if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) { - log.warn(log.message.containerSizeNotCompatibleWithAutosize('height')); - } - - // Delete autosize property if it's Vega's default - if (deepEqual(autosize, {type: 'pad'})) { - return undefined; - } - - return autosize; -} - -export {NormalizerParams}; diff --git a/node_modules/vega-lite/src/normalize/pathoverlay.ts b/node_modules/vega-lite/src/normalize/pathoverlay.ts deleted file mode 100644 index 54ab8c8..0000000 --- a/node_modules/vega-lite/src/normalize/pathoverlay.ts +++ /dev/null @@ -1,173 +0,0 @@ -import {isObject} from 'vega-util'; -import {Config} from '../config'; -import {Encoding, normalizeEncoding} from '../encoding'; -import {AreaConfig, isMarkDef, LineConfig, Mark, MarkConfig, MarkDef} from '../mark'; -import {GenericUnitSpec, NormalizedUnitSpec} from '../spec'; -import {isUnitSpec} from '../spec/unit'; -import {stack} from '../stack'; -import {keys, omit, pick} from '../util'; -import {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base'; - -type UnitSpecWithPathOverlay = GenericUnitSpec, Mark | MarkDef<'line' | 'area' | 'rule' | 'trail'>>; - -function dropLineAndPoint(markDef: MarkDef): MarkDef | Mark { - const {point: _point, line: _line, ...mark} = markDef; - - return keys(mark).length > 1 ? mark : mark.type; -} - -function dropLineAndPointFromConfig(config: Config) { - for (const mark of ['line', 'area', 'rule', 'trail'] as const) { - if (config[mark]) { - config = { - ...config, - // TODO: remove as any - [mark]: omit(config[mark], ['point', 'line'] as any) - }; - } - } - return config; -} - -function getPointOverlay(markDef: MarkDef, markConfig: LineConfig = {}, encoding: Encoding): MarkConfig { - if (markDef.point === 'transparent') { - return {opacity: 0}; - } else if (markDef.point) { - // truthy : true or object - return isObject(markDef.point) ? markDef.point : {}; - } else if (markDef.point !== undefined) { - // false or null - return null; - } else { - // undefined (not disabled) - if (markConfig.point || encoding.shape) { - // enable point overlay if config[mark].point is truthy or if encoding.shape is provided - return isObject(markConfig.point) ? markConfig.point : {}; - } - // markDef.point is defined as falsy - return undefined; - } -} - -function getLineOverlay(markDef: MarkDef, markConfig: AreaConfig = {}): MarkConfig { - if (markDef.line) { - // true or object - return markDef.line === true ? {} : markDef.line; - } else if (markDef.line !== undefined) { - // false or null - return null; - } else { - // undefined (not disabled) - if (markConfig.line) { - // enable line overlay if config[mark].line is truthy - return markConfig.line === true ? {} : markConfig.line; - } - // markDef.point is defined as falsy - return undefined; - } -} - -export class PathOverlayNormalizer implements NonFacetUnitNormalizer { - public name = 'path-overlay'; - - public hasMatchingType(spec: GenericUnitSpec, config: Config): spec is UnitSpecWithPathOverlay { - if (isUnitSpec(spec)) { - const {mark, encoding} = spec; - const markDef = isMarkDef(mark) ? mark : {type: mark}; - switch (markDef.type) { - case 'line': - case 'rule': - case 'trail': - return !!getPointOverlay(markDef, config[markDef.type], encoding); - case 'area': - return ( - // false / null are also included as we want to remove the properties - !!getPointOverlay(markDef, config[markDef.type], encoding) || - !!getLineOverlay(markDef, config[markDef.type]) - ); - } - } - return false; - } - - public run(spec: UnitSpecWithPathOverlay, params: NormalizerParams, normalize: NormalizeLayerOrUnit) { - const {config} = params; - const {selection, projection, mark, encoding: e, ...outerSpec} = spec; - - // Need to call normalizeEncoding because we need the inferred types to correctly determine stack - const encoding = normalizeEncoding(e, config); - - const markDef: MarkDef = isMarkDef(mark) ? mark : {type: mark}; - - const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding); - const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]); - - const layer: NormalizedUnitSpec[] = [ - { - ...(selection ? {selection} : {}), - mark: dropLineAndPoint({ - // TODO: extract this 0.7 to be shared with default opacity for point/tick/... - ...(markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined - ? {opacity: 0.7} - : {}), - ...markDef - }), - // drop shape from encoding as this might be used to trigger point overlay - encoding: omit(encoding, ['shape']) - } - ]; - - // FIXME: determine rules for applying selections. - - // Need to copy stack config to overlayed layer - const stackProps = stack(markDef, encoding); - - let overlayEncoding = encoding; - if (stackProps) { - const {fieldChannel: stackFieldChannel, offset} = stackProps; - overlayEncoding = { - ...encoding, - [stackFieldChannel]: { - ...encoding[stackFieldChannel], - ...(offset ? {stack: offset} : {}) - } - }; - } - - if (lineOverlay) { - layer.push({ - ...(projection ? {projection} : {}), - mark: { - type: 'line', - ...pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip']), - ...lineOverlay - }, - encoding: overlayEncoding - }); - } - if (pointOverlay) { - layer.push({ - ...(projection ? {projection} : {}), - mark: { - type: 'point', - opacity: 1, - filled: true, - ...pick(markDef, ['clip', 'tooltip']), - ...pointOverlay - }, - encoding: overlayEncoding - }); - } - - return normalize( - { - ...outerSpec, - layer - }, - { - ...params, - config: dropLineAndPointFromConfig(config) - } - ); - } -} diff --git a/node_modules/vega-lite/src/normalize/rangestep.ts b/node_modules/vega-lite/src/normalize/rangestep.ts deleted file mode 100644 index 332ddb3..0000000 --- a/node_modules/vega-lite/src/normalize/rangestep.ts +++ /dev/null @@ -1,62 +0,0 @@ -import {getSizeChannel, POSITION_SCALE_CHANNELS} from '../channel'; -import {isFieldOrDatumDef} from '../channeldef'; -import {Encoding} from '../encoding'; -import * as log from '../log'; -import {Scale} from '../scale'; -import {GenericSpec} from '../spec'; -import {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from '../spec/unit'; -import {isEmpty} from '../util'; -import {NonFacetUnitNormalizer} from './base'; - -type UnitSpecWithRangeStep = GenericUnitSpec, any>; // this is not accurate, but it's not worth making it accurate - -export class RangeStepNormalizer implements NonFacetUnitNormalizer { - public name = 'RangeStep'; - - public hasMatchingType(spec: GenericSpec): spec is UnitSpecWithRangeStep { - if (isUnitSpec(spec) && spec.encoding) { - for (const channel of POSITION_SCALE_CHANNELS) { - const def = spec.encoding[channel]; - if (def && isFieldOrDatumDef(def)) { - if (def?.scale?.['rangeStep']) { - return true; - } - } - } - } - return false; - } - - public run(spec: UnitSpecWithRangeStep): NormalizedUnitSpec { - const sizeMixins = {}; - let encoding = {...spec.encoding}; - - for (const channel of POSITION_SCALE_CHANNELS) { - const sizeType = getSizeChannel(channel); - const def = encoding[channel]; - if (def && isFieldOrDatumDef(def)) { - if (def?.scale?.['rangeStep']) { - const {scale, ...defWithoutScale} = def; - - const {rangeStep, ...scaleWithoutRangeStep} = scale as Scale & {rangeStep: number}; - sizeMixins[sizeType] = {step: scale['rangeStep']}; - - log.warn(log.message.RANGE_STEP_DEPRECATED); - - encoding = { - ...encoding, - [channel]: { - ...defWithoutScale, - ...(isEmpty(scaleWithoutRangeStep) ? {} : {scale: scaleWithoutRangeStep}) - } - }; - } - } - } - return { - ...sizeMixins, - ...spec, - encoding - }; - } -} diff --git a/node_modules/vega-lite/src/normalize/repeater.ts b/node_modules/vega-lite/src/normalize/repeater.ts deleted file mode 100644 index 4034174..0000000 --- a/node_modules/vega-lite/src/normalize/repeater.ts +++ /dev/null @@ -1,160 +0,0 @@ -import {hasOwnProperty, isArray} from 'vega-util'; -import { - ChannelDef, - DatumDef, - Field, - FieldDef, - FieldName, - hasConditionalFieldOrDatumDef, - isConditionalDef, - isFieldDef, - isFieldOrDatumDef, - isRepeatRef, - isSortableFieldDef, - ScaleFieldDef, - ValueDef -} from '../channeldef'; -import {Encoding} from '../encoding'; -import * as log from '../log'; -import {isSortField} from '../sort'; -import {FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet'; - -export interface RepeaterValue { - row?: string; - column?: string; - - repeat?: string; - - layer?: string; -} - -export function replaceRepeaterInFacet( - facet: FacetFieldDef | FacetMapping, - repeater: RepeaterValue -): FacetFieldDef | FacetMapping { - if (!repeater) { - return facet as FacetFieldDef; - } - - if (isFacetMapping(facet)) { - return replaceRepeaterInMapping(facet, repeater) as FacetMapping; - } - return replaceRepeaterInFieldDef(facet, repeater) as FacetFieldDef; -} - -export function replaceRepeaterInEncoding>( - encoding: E, - repeater: RepeaterValue -): Encoding { - if (!repeater) { - return encoding as Encoding; - } - - return replaceRepeaterInMapping(encoding, repeater) as Encoding; -} - -/** - * Replaces repeated value and returns if the repeated value is valid. - */ -function replaceRepeatInProp(prop: keyof T, o: T, repeater: RepeaterValue): T { - const val = o[prop]; - if (isRepeatRef(val)) { - if (val.repeat in repeater) { - return {...o, [prop]: repeater[val.repeat]}; - } else { - log.warn(log.message.noSuchRepeatedValue(val.repeat)); - return undefined; - } - } - return o; -} - -/** - * Replace repeater values in a field def with the concrete field name. - */ - -function replaceRepeaterInFieldDef(fieldDef: FieldDef, repeater: RepeaterValue) { - fieldDef = replaceRepeatInProp('field', fieldDef, repeater); - - if (fieldDef === undefined) { - // the field def should be ignored - return undefined; - } else if (fieldDef === null) { - return null; - } - - if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) { - const sort = replaceRepeatInProp('field', fieldDef.sort, repeater); - fieldDef = { - ...fieldDef, - ...(sort ? {sort} : {}) - }; - } - - return fieldDef as ScaleFieldDef; -} - -function replaceRepeaterInFieldOrDatumDef(def: FieldDef | DatumDef, repeater: RepeaterValue) { - if (isFieldDef(def)) { - return replaceRepeaterInFieldDef(def, repeater); - } else { - const datumDef = replaceRepeatInProp('datum', def, repeater); - if (datumDef !== def && !datumDef.type) { - datumDef.type = 'nominal'; - } - return datumDef; - } -} - -function replaceRepeaterInChannelDef(channelDef: ChannelDef, repeater: RepeaterValue) { - if (isFieldOrDatumDef(channelDef)) { - const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater); - if (fd) { - return fd; - } else if (isConditionalDef>(channelDef)) { - return {condition: channelDef.condition}; - } - } else { - if (hasConditionalFieldOrDatumDef(channelDef)) { - const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater); - if (fd) { - return { - ...channelDef, - condition: fd - } as ChannelDef; - } else { - const {condition, ...channelDefWithoutCondition} = channelDef; - return channelDefWithoutCondition as ChannelDef; - } - } - return channelDef as ValueDef; - } - return undefined; -} - -type EncodingOrFacet = Encoding | FacetMapping; - -function replaceRepeaterInMapping( - mapping: EncodingOrFacet, - repeater: RepeaterValue -): EncodingOrFacet { - const out: EncodingOrFacet = {}; - for (const channel in mapping) { - if (hasOwnProperty(mapping, channel)) { - const channelDef: ChannelDef | ChannelDef[] = mapping[channel]; - - if (isArray(channelDef)) { - // array cannot have condition - out[channel] = (channelDef as ChannelDef[]) // somehow we need to cast it here - .map(cd => replaceRepeaterInChannelDef(cd, repeater)) - .filter(cd => cd); - } else { - const cd = replaceRepeaterInChannelDef(channelDef, repeater); - if (cd !== undefined) { - out[channel] = cd; - } - } - } - } - return out; -} diff --git a/node_modules/vega-lite/src/normalize/ruleforrangedline.ts b/node_modules/vega-lite/src/normalize/ruleforrangedline.ts deleted file mode 100644 index b28ffa6..0000000 --- a/node_modules/vega-lite/src/normalize/ruleforrangedline.ts +++ /dev/null @@ -1,54 +0,0 @@ -import {isBinned} from '../bin'; -import {getMainRangeChannel, SECONDARY_RANGE_CHANNEL} from '../channel'; -import {Field, isDatumDef, isFieldDef} from '../channeldef'; -import {Encoding} from '../encoding'; -import * as log from '../log'; -import {GenericSpec} from '../spec'; -import {GenericUnitSpec, isUnitSpec} from '../spec/unit'; -import {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base'; - -interface EncodingX2Mixins { - x2: Encoding['x2']; -} - -interface EncodingY2Mixins { - y2: Encoding['y2']; -} - -type RangedLineSpec = GenericUnitSpec & (EncodingX2Mixins | EncodingY2Mixins), 'line'>; - -export class RuleForRangedLineNormalizer implements NonFacetUnitNormalizer { - public name = 'RuleForRangedLine'; - - public hasMatchingType(spec: GenericSpec): spec is RangedLineSpec { - if (isUnitSpec(spec)) { - const {encoding, mark} = spec; - if (mark === 'line') { - for (const channel of SECONDARY_RANGE_CHANNEL) { - const mainChannel = getMainRangeChannel(channel); - const mainChannelDef = encoding[mainChannel]; - - if (encoding[channel]) { - if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) { - return true; - } - } - } - } - } - return false; - } - - public run(spec: RangedLineSpec, params: NormalizerParams, normalize: NormalizeLayerOrUnit) { - const {encoding} = spec; - log.warn(log.message.lineWithRange(!!encoding.x2, !!encoding.y2)); - - return normalize( - { - ...spec, - mark: 'rule' - }, - params - ); - } -} diff --git a/node_modules/vega-lite/src/predicate.ts b/node_modules/vega-lite/src/predicate.ts deleted file mode 100644 index a76fe10..0000000 --- a/node_modules/vega-lite/src/predicate.ts +++ /dev/null @@ -1,267 +0,0 @@ -import {SignalRef} from 'vega'; -import {isArray} from 'vega-util'; -import {FieldName, valueExpr, vgField} from './channeldef'; -import {DateTime} from './datetime'; -import {LogicalComposition} from './logical'; -import {fieldExpr as timeUnitFieldExpr, normalizeTimeUnit, TimeUnit, TimeUnitParams} from './timeunit'; -import {isSignalRef} from './vega.schema'; - -export type Predicate = - // a) FieldPredicate (but we don't type FieldFilter here so the schema has no nesting - // and thus the documentation shows all of the types clearly) - | FieldEqualPredicate - | FieldRangePredicate - | FieldOneOfPredicate - | FieldLTPredicate - | FieldGTPredicate - | FieldLTEPredicate - | FieldGTEPredicate - | FieldValidPredicate - // b) Selection Predicate - | SelectionPredicate - // c) Vega Expression string - | string; - -export type FieldPredicate = - | FieldEqualPredicate - | FieldLTPredicate - | FieldGTPredicate - | FieldLTEPredicate - | FieldGTEPredicate - | FieldRangePredicate - | FieldOneOfPredicate - | FieldValidPredicate; - -export interface SelectionPredicate { - /** - * Filter using a selection name or a logical composition of selection names. - */ - selection: LogicalComposition; -} - -export function isSelectionPredicate(predicate: LogicalComposition): predicate is SelectionPredicate { - return predicate?.['selection']; -} - -export interface FieldPredicateBase { - // TODO: support aggregate - - /** - * Time unit for the field to be tested. - */ - timeUnit?: TimeUnit | TimeUnitParams; - - /** - * Field to be tested. - */ - field: FieldName; -} - -export interface FieldEqualPredicate extends FieldPredicateBase { - /** - * The value that the field should be equal to. - */ - equal: string | number | boolean | DateTime | SignalRef; -} - -export function isFieldEqualPredicate(predicate: any): predicate is FieldEqualPredicate { - return predicate && !!predicate.field && predicate.equal !== undefined; -} - -export interface FieldLTPredicate extends FieldPredicateBase { - /** - * The value that the field should be less than. - */ - lt: string | number | DateTime | SignalRef; -} - -export function isFieldLTPredicate(predicate: any): predicate is FieldLTPredicate { - return predicate && !!predicate.field && predicate.lt !== undefined; -} - -export interface FieldLTEPredicate extends FieldPredicateBase { - /** - * The value that the field should be less than or equals to. - */ - lte: string | number | DateTime | SignalRef; -} - -export function isFieldLTEPredicate(predicate: any): predicate is FieldLTEPredicate { - return predicate && !!predicate.field && predicate.lte !== undefined; -} - -export interface FieldGTPredicate extends FieldPredicateBase { - /** - * The value that the field should be greater than. - */ - gt: string | number | DateTime | SignalRef; -} - -export function isFieldGTPredicate(predicate: any): predicate is FieldGTPredicate { - return predicate && !!predicate.field && predicate.gt !== undefined; -} - -export interface FieldGTEPredicate extends FieldPredicateBase { - /** - * The value that the field should be greater than or equals to. - */ - gte: string | number | DateTime | SignalRef; -} - -export function isFieldGTEPredicate(predicate: any): predicate is FieldGTEPredicate { - return predicate && !!predicate.field && predicate.gte !== undefined; -} - -export interface FieldRangePredicate extends FieldPredicateBase { - /** - * An array of inclusive minimum and maximum values - * for a field value of a data item to be included in the filtered data. - * @maxItems 2 - * @minItems 2 - */ - range: (number | DateTime | null | SignalRef)[] | SignalRef; -} - -export function isFieldRangePredicate(predicate: any): predicate is FieldRangePredicate { - if (predicate && predicate.field) { - if (isArray(predicate.range) && predicate.range.length === 2) { - return true; - } else if (isSignalRef(predicate.range)) { - return true; - } - } - return false; -} - -export interface FieldOneOfPredicate extends FieldPredicateBase { - /** - * A set of values that the `field`'s value should be a member of, - * for a data item included in the filtered data. - */ - oneOf: string[] | number[] | boolean[] | DateTime[]; -} - -export interface FieldValidPredicate extends FieldPredicateBase { - /** - * If set to true the field's value has to be valid, meaning both not `null` and not [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN). - */ - valid: boolean; -} - -export function isFieldOneOfPredicate(predicate: any): predicate is FieldOneOfPredicate { - return ( - predicate && !!predicate.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility - ); -} - -export function isFieldValidPredicate(predicate: any): predicate is FieldValidPredicate { - return predicate && !!predicate.field && predicate.valid !== undefined; -} - -export function isFieldPredicate( - predicate: Predicate -): predicate is - | FieldOneOfPredicate - | FieldEqualPredicate - | FieldRangePredicate - | FieldLTPredicate - | FieldGTPredicate - | FieldLTEPredicate - | FieldGTEPredicate { - return ( - isFieldOneOfPredicate(predicate) || - isFieldEqualPredicate(predicate) || - isFieldRangePredicate(predicate) || - isFieldLTPredicate(predicate) || - isFieldGTPredicate(predicate) || - isFieldLTEPredicate(predicate) || - isFieldGTEPredicate(predicate) - ); -} - -function predicateValueExpr(v: number | string | boolean | DateTime | SignalRef, timeUnit: TimeUnit) { - return valueExpr(v, {timeUnit, wrapTime: true}); -} - -function predicateValuesExpr(vals: (number | string | boolean | DateTime)[], timeUnit: TimeUnit) { - return vals.map(v => predicateValueExpr(v, timeUnit)); -} - -// This method is used by Voyager. Do not change its behavior without changing Voyager. -export function fieldFilterExpression(predicate: FieldPredicate, useInRange = true) { - const {field} = predicate; - const timeUnit = normalizeTimeUnit(predicate.timeUnit)?.unit; - const fieldExpr = timeUnit - ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly. - // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline - // TODO: support utc - 'time(' + timeUnitFieldExpr(timeUnit, field) + ')' - : vgField(predicate, {expr: 'datum'}); - - if (isFieldEqualPredicate(predicate)) { - return fieldExpr + '===' + predicateValueExpr(predicate.equal, timeUnit); - } else if (isFieldLTPredicate(predicate)) { - const upper = predicate.lt; - return `${fieldExpr}<${predicateValueExpr(upper, timeUnit)}`; - } else if (isFieldGTPredicate(predicate)) { - const lower = predicate.gt; - return `${fieldExpr}>${predicateValueExpr(lower, timeUnit)}`; - } else if (isFieldLTEPredicate(predicate)) { - const upper = predicate.lte; - return `${fieldExpr}<=${predicateValueExpr(upper, timeUnit)}`; - } else if (isFieldGTEPredicate(predicate)) { - const lower = predicate.gte; - return `${fieldExpr}>=${predicateValueExpr(lower, timeUnit)}`; - } else if (isFieldOneOfPredicate(predicate)) { - return `indexof([${predicateValuesExpr(predicate.oneOf, timeUnit).join(',')}], ${fieldExpr}) !== -1`; - } else if (isFieldValidPredicate(predicate)) { - return fieldValidPredicate(fieldExpr, predicate.valid); - } else if (isFieldRangePredicate(predicate)) { - const {range} = predicate; - const lower = isSignalRef(range) ? {signal: `${range.signal}[0]`} : range[0]; - const upper = isSignalRef(range) ? {signal: `${range.signal}[1]`} : range[1]; - - if (lower !== null && upper !== null && useInRange) { - return ( - 'inrange(' + - fieldExpr + - ', [' + - predicateValueExpr(lower, timeUnit) + - ', ' + - predicateValueExpr(upper, timeUnit) + - '])' - ); - } - - const exprs = []; - if (lower !== null) { - exprs.push(`${fieldExpr} >= ${predicateValueExpr(lower, timeUnit)}`); - } - if (upper !== null) { - exprs.push(`${fieldExpr} <= ${predicateValueExpr(upper, timeUnit)}`); - } - - return exprs.length > 0 ? exprs.join(' && ') : 'true'; - } - - /* istanbul ignore next: it should never reach here */ - throw new Error(`Invalid field predicate: ${JSON.stringify(predicate)}`); -} - -export function fieldValidPredicate(fieldExpr: string, valid = true) { - if (valid) { - return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`; - } else { - return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`; - } -} - -export function normalizePredicate(f: Predicate): Predicate { - if (isFieldPredicate(f) && f.timeUnit) { - return { - ...f, - timeUnit: normalizeTimeUnit(f.timeUnit)?.unit - }; - } - return f; -} diff --git a/node_modules/vega-lite/src/projection.ts b/node_modules/vega-lite/src/projection.ts deleted file mode 100644 index 547ec69..0000000 --- a/node_modules/vega-lite/src/projection.ts +++ /dev/null @@ -1,46 +0,0 @@ -import {BaseProjection, SignalRef, Vector2} from 'vega'; -import {ProjectionType} from './vega.schema'; - -export interface Projection extends BaseProjection { - /** - * The cartographic projection to use. This value is case-insensitive, for example `"albers"` and `"Albers"` indicate the same projection type. You can find all valid projection types [in the documentation](https://vega.github.io/vega-lite/docs/projection.html#projection-types). - * - * __Default value:__ `mercator` - */ - type?: ProjectionType | SignalRef; // Re-declare to override docs - - /** - * The projection’s scale (zoom) factor, overriding automatic fitting. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections. - */ - scale?: number | SignalRef; // Re-declare to override docs - - /** - * The projection’s translation offset as a two-element array `[tx, ty]`. - */ - translate?: Vector2 | SignalRef; // TODO: figure what's VL default value -} - -/** - * Any property of Projection can be in config - */ -export type ProjectionConfig = Projection; - -export const PROJECTION_PROPERTIES: (keyof Projection)[] = [ - 'type', - 'clipAngle', - 'clipExtent', - 'center', - 'rotate', - 'precision', - 'reflectX', - 'reflectY', - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' -]; diff --git a/node_modules/vega-lite/src/resolve.ts b/node_modules/vega-lite/src/resolve.ts deleted file mode 100644 index f616970..0000000 --- a/node_modules/vega-lite/src/resolve.ts +++ /dev/null @@ -1,20 +0,0 @@ -import {NonPositionScaleChannel, PositionScaleChannel, ScaleChannel} from './channel'; - -export type ResolveMode = 'independent' | 'shared'; - -/** - * Defines how scales, axes, and legends from different specs should be combined. Resolve is a mapping from `scale`, `axis`, and `legend` to a mapping from channels to resolutions. Scales and guides can be resolved to be `"independent"` or `"shared"`. - */ -export interface Resolve { - scale?: ScaleResolveMap; - - axis?: AxisResolveMap; - - legend?: LegendResolveMap; -} - -export type ScaleResolveMap = Partial>; - -export type AxisResolveMap = Partial>; - -export type LegendResolveMap = Partial>; diff --git a/node_modules/vega-lite/src/scale.ts b/node_modules/vega-lite/src/scale.ts deleted file mode 100644 index ec8f3ed..0000000 --- a/node_modules/vega-lite/src/scale.ts +++ /dev/null @@ -1,854 +0,0 @@ -import { - RangeEnum, - ScaleBins, - ScaleInterpolateEnum, - ScaleInterpolateParams, - SignalRef, - TimeInterval, - TimeIntervalStep -} from 'vega'; -import {isString, toSet} from 'vega-util'; -import * as CHANNEL from './channel'; -import {Channel, isColorChannel} from './channel'; -import {DateTime} from './datetime'; -import * as log from './log'; -import {SelectionExtent} from './selection'; -import {NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL, Type} from './type'; -import {contains, Flag, keys} from './util'; - -export const ScaleType = { - // Continuous - Quantitative - LINEAR: 'linear', - LOG: 'log', - POW: 'pow', - SQRT: 'sqrt', - SYMLOG: 'symlog', - - IDENTITY: 'identity', - SEQUENTIAL: 'sequential', - - // Continuous - Time - TIME: 'time', - UTC: 'utc', - - // Discretizing scales - QUANTILE: 'quantile', - QUANTIZE: 'quantize', - THRESHOLD: 'threshold', - BIN_ORDINAL: 'bin-ordinal', - - // Discrete scales - ORDINAL: 'ordinal', - POINT: 'point', - BAND: 'band' -} as const; - -type ValueOf = T[keyof T]; -export type ScaleType = ValueOf; - -/** - * Index for scale categories -- only scale of the same categories can be merged together. - * Current implementation is trying to be conservative and avoid merging scale type that might not work together - */ -export const SCALE_CATEGORY_INDEX: Record = { - linear: 'numeric', - log: 'numeric', - pow: 'numeric', - sqrt: 'numeric', - symlog: 'numeric', - identity: 'numeric', - sequential: 'numeric', - time: 'time', - utc: 'time', - ordinal: 'ordinal', - 'bin-ordinal': 'bin-ordinal', // TODO: should bin-ordinal support merging with other - point: 'ordinal-position', - band: 'ordinal-position', - quantile: 'discretizing', - quantize: 'discretizing', - threshold: 'discretizing' -}; - -export const SCALE_TYPES = keys(SCALE_CATEGORY_INDEX) as ScaleType[]; - -/** - * Whether the two given scale types can be merged together. - */ -export function scaleCompatible(scaleType1: ScaleType, scaleType2: ScaleType) { - const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1]; - const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2]; - return ( - scaleCategory1 === scaleCategory2 || - (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') || - (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time') - ); -} - -/** - * Index for scale precedence -- high score = higher priority for merging. - */ -const SCALE_PRECEDENCE_INDEX: Record = { - // numeric - linear: 0, - log: 1, - pow: 1, - sqrt: 1, - symlog: 1, - identity: 1, - sequential: 1, - // time - time: 0, - utc: 0, - // ordinal-position -- these have higher precedence than continuous scales as they support more types of data - point: 10, - band: 11, // band has higher precedence as it is better for interaction - // non grouped types - ordinal: 0, - 'bin-ordinal': 0, - quantile: 0, - quantize: 0, - threshold: 0 -}; - -/** - * Return scale categories -- only scale of the same categories can be merged together. - */ -export function scaleTypePrecedence(scaleType: ScaleType): number { - return SCALE_PRECEDENCE_INDEX[scaleType]; -} - -export const CONTINUOUS_TO_CONTINUOUS_SCALES: ScaleType[] = ['linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc']; -const CONTINUOUS_TO_CONTINUOUS_INDEX = toSet(CONTINUOUS_TO_CONTINUOUS_SCALES); - -export const QUANTITATIVE_SCALES: ScaleType[] = ['linear', 'log', 'pow', 'sqrt', 'symlog']; - -const QUANTITATIVE_SCALES_INDEX = toSet(QUANTITATIVE_SCALES); - -export function isQuantitative(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' { - return type in QUANTITATIVE_SCALES_INDEX; -} - -export const CONTINUOUS_TO_DISCRETE_SCALES: ScaleType[] = ['quantile', 'quantize', 'threshold']; -const CONTINUOUS_TO_DISCRETE_INDEX = toSet(CONTINUOUS_TO_DISCRETE_SCALES); - -export const CONTINUOUS_DOMAIN_SCALES: ScaleType[] = CONTINUOUS_TO_CONTINUOUS_SCALES.concat([ - 'quantile', - 'quantize', - 'threshold', - 'sequential', - 'identity' -]); -const CONTINUOUS_DOMAIN_INDEX = toSet(CONTINUOUS_DOMAIN_SCALES); - -export const DISCRETE_DOMAIN_SCALES: ScaleType[] = ['ordinal', 'bin-ordinal', 'point', 'band']; -const DISCRETE_DOMAIN_INDEX = toSet(DISCRETE_DOMAIN_SCALES); - -export const TIME_SCALE_TYPES: ScaleType[] = ['time', 'utc']; - -export function hasDiscreteDomain(type: ScaleType): type is 'ordinal' | 'bin-ordinal' | 'point' | 'band' { - return type in DISCRETE_DOMAIN_INDEX; -} - -export function hasContinuousDomain( - type: ScaleType -): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' | 'quantile' | 'quantize' | 'threshold' { - return type in CONTINUOUS_DOMAIN_INDEX; -} - -export function isContinuousToContinuous( - type: ScaleType -): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' { - return type in CONTINUOUS_TO_CONTINUOUS_INDEX; -} - -export function isContinuousToDiscrete(type: ScaleType): type is 'quantile' | 'quantize' | 'threshold' { - return type in CONTINUOUS_TO_DISCRETE_INDEX; -} - -export interface ScaleConfig { - /** - * If true, rounds numeric output values to integers. - * This can be helpful for snapping to the pixel grid. - * (Only available for `x`, `y`, and `size` scales.) - */ - round?: boolean | SignalRef; - - /** - * If true, values that exceed the data domain are clamped to either the minimum or maximum range value - */ - clamp?: boolean | SignalRef; - - /** - * Default inner padding for `x` and `y` band-ordinal scales. - * - * __Default value:__ - * - `barBandPaddingInner` for bar marks (`0.1` by default) - * - `rectBandPaddingInner` for rect and other marks (`0` by default) - * - * @minimum 0 - * @maximum 1 - */ - bandPaddingInner?: number | SignalRef; - - /** - * Default outer padding for `x` and `y` band-ordinal scales. - * - * __Default value:__ `paddingInner/2` (which makes _width/height = number of unique values * step_) - * - * @minimum 0 - * @maximum 1 - */ - bandPaddingOuter?: number | SignalRef; - - /** - * Default inner padding for `x` and `y` band-ordinal scales of `"bar"` marks. - * - * __Default value:__ `0.1` - * - * @minimum 0 - * @maximum 1 - */ - barBandPaddingInner?: number | SignalRef; - - /** - * Default inner padding for `x` and `y` band-ordinal scales of `"rect"` marks. - * - * __Default value:__ `0` - * - * @minimum 0 - * @maximum 1 - */ - rectBandPaddingInner?: number | SignalRef; - - /** - * Default padding for continuous scales. - * - * __Default:__ `5` for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.; `0` otherwise. - * - * @minimum 0 - */ - continuousPadding?: number | SignalRef; - - /** - * Default outer padding for `x` and `y` point-ordinal scales. - * - * __Default value:__ `0.5` (which makes _width/height = number of unique values * step_) - * - * @minimum 0 - * @maximum 1 - */ - pointPadding?: number | SignalRef; - - /** - * Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis. - * - * This is equivalent to setting `domain` to `"unaggregate"` for aggregated _quantitative_ fields by default. - * - * This property only works with aggregate functions that produce values within the raw data domain (`"mean"`, `"average"`, `"median"`, `"q1"`, `"q3"`, `"min"`, `"max"`). For other aggregations that produce values outside of the raw data domain (e.g. `"count"`, `"sum"`), this property is ignored. - * - * __Default value:__ `false` - */ - useUnaggregatedDomain?: boolean; - - // nice should depends on type (quantitative or temporal), so - // let's not make a config. - - // Configs for Range - - /** - * The default max value for mapping quantitative fields to bar's size/bandSize. - * - * If undefined (default), we will use the axis's size (width or height) - 1. - * @minimum 0 - */ - maxBandSize?: number; - - /** - * The default min value for mapping quantitative fields to bar and tick's size/bandSize scale with zero=false. - * - * __Default value:__ `2` - * - * @minimum 0 - */ - minBandSize?: number; - - /** - * The default max value for mapping quantitative fields to text's size/fontSize. - * - * __Default value:__ `40` - * - * @minimum 0 - */ - maxFontSize?: number; - - /** - * The default min value for mapping quantitative fields to tick's size/fontSize scale with zero=false - * - * __Default value:__ `8` - * - * @minimum 0 - */ - minFontSize?: number; - - /** - * Default minimum opacity for mapping a field to opacity. - * - * __Default value:__ `0.3` - * - * @minimum 0 - * @maximum 1 - */ - minOpacity?: number; - - /** - * Default max opacity for mapping a field to opacity. - * - * __Default value:__ `0.8` - * - * @minimum 0 - * @maximum 1 - */ - maxOpacity?: number; - - /** - * Default minimum value for point size scale with zero=false. - * - * __Default value:__ `9` - * - * @minimum 0 - */ - minSize?: number; - - /** - * Default max value for point size scale. - * @minimum 0 - */ - maxSize?: number; - - /** - * Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks with zero=false. - * - * __Default value:__ `1` - * - * @minimum 0 - */ - minStrokeWidth?: number; - - /** - * Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks. - * - * __Default value:__ `4` - * - * @minimum 0 - */ - maxStrokeWidth?: number; - - /** - * Default range cardinality for [`quantile`](https://vega.github.io/vega-lite/docs/scale.html#quantile) scale. - * - * __Default value:__ `4` - * - * @minimum 0 - */ - quantileCount?: number; - - /** - * Default range cardinality for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale. - * - * __Default value:__ `4` - * - * @minimum 0 - */ - quantizeCount?: number; - - /** - * Reverse x-scale by default (useful for right-to-left charts). - */ - xReverse?: boolean | SignalRef; -} - -export const defaultScaleConfig: ScaleConfig = { - pointPadding: 0.5, - - barBandPaddingInner: 0.1, - rectBandPaddingInner: 0, - - minBandSize: 2, - - minFontSize: 8, - maxFontSize: 40, - - minOpacity: 0.3, - maxOpacity: 0.8, - - // FIXME: revise if these *can* become ratios of width/height step - minSize: 9, // Point size is area. For square point, 9 = 3 pixel ^ 2, not too small! - - minStrokeWidth: 1, - maxStrokeWidth: 4, - quantileCount: 4, - quantizeCount: 4 -}; - -export interface SchemeParams { - /** - * A color scheme name for ordinal scales (e.g., `"category10"` or `"blues"`). - * - * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference. - */ - name: string | SignalRef; - - /** - * The extent of the color range to use. For example `[0.2, 1]` will rescale the color scheme such that color values in the range _[0, 0.2)_ are excluded from the scheme. - */ - extent?: (number | SignalRef)[] | SignalRef; - - /** - * The number of colors to use in the scheme. This can be useful for scale types such as `"quantize"`, which use the length of the scale range to determine the number of discrete bins for the scale domain. - */ - count?: number | SignalRef; -} - -export type Domain = - | (null | string | number | boolean | DateTime | SignalRef)[] - | 'unaggregated' - | SelectionExtent - | SignalRef - | DomainUnionWith; - -export type Scheme = string | SchemeParams; - -export function isExtendedScheme(scheme: Scheme | SignalRef): scheme is SchemeParams { - return !isString(scheme) && !!scheme['name']; -} - -export function isSelectionDomain(domain: Domain): domain is SelectionExtent { - return domain?.['selection']; -} - -export interface DomainUnionWith { - /** - * Customized domain values to be union with the field's values. - * - * 1) `domain` for _quantitative_ fields can take one of the following forms: - * - * - a two-element array with minimum and maximum values. - * - an array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). (Alternatively, the `domainMid` property can be set for a diverging scale.) - * - a string value `"unaggregated"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation. - * - * 2) `domain` for _temporal_ fields can be a two-element array minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime). - * - * 3) `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values. - */ - unionWith: number[] | string[] | boolean[] | DateTime[]; -} - -export function isDomainUnionWith(domain: Domain): domain is DomainUnionWith { - return domain && domain['unionWith']; -} - -export interface Scale { - /** - * The type of scale. Vega-Lite supports the following categories of scale types: - * - * 1) [**Continuous Scales**](https://vega.github.io/vega-lite/docs/scale.html#continuous) -- mapping continuous domains to continuous output ranges ([`"linear"`](https://vega.github.io/vega-lite/docs/scale.html#linear), [`"pow"`](https://vega.github.io/vega-lite/docs/scale.html#pow), [`"sqrt"`](https://vega.github.io/vega-lite/docs/scale.html#sqrt), [`"symlog"`](https://vega.github.io/vega-lite/docs/scale.html#symlog), [`"log"`](https://vega.github.io/vega-lite/docs/scale.html#log), [`"time"`](https://vega.github.io/vega-lite/docs/scale.html#time), [`"utc"`](https://vega.github.io/vega-lite/docs/scale.html#utc). - * - * 2) [**Discrete Scales**](https://vega.github.io/vega-lite/docs/scale.html#discrete) -- mapping discrete domains to discrete ([`"ordinal"`](https://vega.github.io/vega-lite/docs/scale.html#ordinal)) or continuous ([`"band"`](https://vega.github.io/vega-lite/docs/scale.html#band) and [`"point"`](https://vega.github.io/vega-lite/docs/scale.html#point)) output ranges. - * - * 3) [**Discretizing Scales**](https://vega.github.io/vega-lite/docs/scale.html#discretizing) -- mapping continuous domains to discrete output ranges [`"bin-ordinal"`](https://vega.github.io/vega-lite/docs/scale.html#bin-ordinal), [`"quantile"`](https://vega.github.io/vega-lite/docs/scale.html#quantile), [`"quantize"`](https://vega.github.io/vega-lite/docs/scale.html#quantize) and [`"threshold"`](https://vega.github.io/vega-lite/docs/scale.html#threshold). - * - * __Default value:__ please see the [scale type table](https://vega.github.io/vega-lite/docs/scale.html#type). - */ - type?: ScaleType; - - /** - * Customized domain values in the form of constant values or dynamic values driven by a selection. - * - * 1) Constant `domain` for _quantitative_ fields can take one of the following forms: - * - * - A two-element array with minimum and maximum values. To create a diverging scale, this two-element array can be combined with the `domainMid` property. - * - An array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). - * - A string value `"unaggregated"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation. - * - * 2) Constant `domain` for _temporal_ fields can be a two-element array with minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime). - * - * 3) Constant `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values. - * - * 4) To combine (union) specified constant domain with the field's values, `domain` can be an object with a `unionWith` property that specify constant domain to be combined. For example, `domain: {unionWith: [0, 100]}` for a quantitative scale means that the scale domain always includes `[0, 100]`, but will include other values in the fields beyond `[0, 100]`. - * - * 5) Domain can also takes an object defining a field or encoding of a selection that [interactively determines](https://vega.github.io/vega-lite/docs/selection.html#scale-domains) the scale domain. - */ - domain?: - | (null | string | number | boolean | DateTime | SignalRef)[] - | 'unaggregated' - | SelectionExtent - | DomainUnionWith - | SignalRef; - - /** - * Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint for [diverging color scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). The domainMid property is only intended for use with scales supporting continuous, piecewise domains. - */ - domainMid?: number | SignalRef; - - /** - * Sets the maximum value in the scale domain, overriding the `domain` property. This property is only intended for use with scales having continuous domains. - */ - domainMax?: number | DateTime | SignalRef; - - /** - * Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains. - */ - domainMin?: number | DateTime | SignalRef; - - /** - * If true, reverses the order of the scale range. - * __Default value:__ `false`. - */ - reverse?: boolean | SignalRef; - - /** - * The range of the scale. One of: - * - * - A string indicating a [pre-defined named scale range](https://vega.github.io/vega-lite/docs/scale.html#range-config) (e.g., example, `"symbol"`, or `"diverging"`). - * - * - For [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous), two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a [piecewise scale](https://vega.github.io/vega-lite/docs/scale.html#piecewise). - * - * - For [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) and [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales, an array of desired output values or an object with a `field` property representing the range values. For example, if a field `color` contains CSS color names, we can set `range` to `{field: "color"}`. - * - * __Notes:__ - * - * 1) For color scales you can also specify a color [`scheme`](https://vega.github.io/vega-lite/docs/scale.html#scheme) instead of `range`. - * - * 2) Any directly specified `range` for `x` and `y` channels will be ignored. Range can be customized via the view's corresponding [size](https://vega.github.io/vega-lite/docs/size.html) (`width` and `height`). - */ - range?: RangeEnum | (number | string | number[] | SignalRef)[] | {field: string}; - - /** - * Sets the maximum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges. - */ - rangeMax?: number | string | SignalRef; - - /** - * Sets the minimum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges. - */ - rangeMin?: number | string | SignalRef; - - // ordinal - - /** - * A string indicating a color [scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme) name (e.g., `"category10"` or `"blues"`) or a [scheme parameter object](https://vega.github.io/vega-lite/docs/scale.html#scheme-params). - * - * Discrete color schemes may be used with [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) or [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales. Continuous color schemes are intended for use with color scales. - * - * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference. - */ - scheme?: string | SchemeParams | SignalRef; - - /** - * The alignment of the steps within the scale range. - * - * This value must lie in the range `[0,1]`. A value of `0.5` indicates that the steps should be centered within the range. A value of `0` or `1` may be used to shift the bands to one side, say to position them adjacent to an axis. - * - * __Default value:__ `0.5` - */ - align?: number | SignalRef; - - /** - * Bin boundaries can be provided to scales as either an explicit array of bin boundaries or as a bin specification object. The legal values are: - * - An [array](../types/#Array) literal of bin boundary values. For example, `[0, 5, 10, 15, 20]`. The array must include both starting and ending boundaries. The previous example uses five values to indicate a total of four bin intervals: [0-5), [5-10), [10-15), [15-20]. Array literals may include signal references as elements. - * - A [bin specification object](https://vega.github.io/vega-lite/docs/scale.html#bins) that indicates the bin _step_ size, and optionally the _start_ and _stop_ boundaries. - * - An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels. - */ - // TODO: add - A [signal reference](../types/#Signal) that resolves to either an array or bin specification object. - bins?: ScaleBins; - - /** - * If `true`, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid. - * - * __Default value:__ `false`. - */ - round?: boolean | SignalRef; - - /** - * For _[continuous](https://vega.github.io/vega-lite/docs/scale.html#continuous)_ scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the `zero`, `nice`, `domainMin`, and `domainMax` properties. - * - * For _[band](https://vega.github.io/vega-lite/docs/scale.html#band)_ scales, shortcut for setting `paddingInner` and `paddingOuter` to the same value. - * - * For _[point](https://vega.github.io/vega-lite/docs/scale.html#point)_ scales, alias for `paddingOuter`. - * - * __Default value:__ For _continuous_ scales, derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `continuousPadding`. - * For _band and point_ scales, see `paddingInner` and `paddingOuter`. By default, Vega-Lite sets padding such that _width/height = number of unique values * step_. - * - * @minimum 0 - */ - padding?: number | SignalRef; - - /** - * The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1]. - * - * For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands). - * - * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingInner`. - * - * @minimum 0 - * @maximum 1 - */ - paddingInner?: number | SignalRef; - - /** - * The outer padding (spacing) at the ends of the range of band and point scales, - * as a fraction of the step size. This value must lie in the range [0,1]. - * - * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingOuter` for band scales and `pointPadding` for point scales. - * By default, Vega-Lite sets outer padding such that _width/height = number of unique values * step_. - * - * @minimum 0 - * @maximum 1 - */ - paddingOuter?: number | SignalRef; - - // typical - /** - * If `true`, values that exceed the data domain are clamped to either the minimum or maximum range value - * - * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/config.html#scale-config)'s `clamp` (`true` by default). - */ - clamp?: boolean | SignalRef; - - /** - * Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of _[0.201479…, 0.996679…]_, a nice domain might be _[0.2, 1.0]_. - * - * For quantitative scales such as linear, `nice` can be either a boolean flag or a number. If `nice` is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain. - * - * For temporal fields with time and utc scales, the `nice` value can be a string indicating the desired time interval. Legal values are `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and `"year"`. Alternatively, `time` and `utc` scales can accept an object-valued interval specifier of the form `{"interval": "month", "step": 3}`, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries. - * - * __Default value:__ `true` for unbinned _quantitative_ fields; `false` otherwise. - * - */ - nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef; - - /** - * The logarithm base of the `log` scale (default `10`). - */ - base?: number | SignalRef; - - /** - * The exponent of the `pow` scale. - */ - exponent?: number | SignalRef; - - /** - * A constant determining the slope of the symlog function around zero. Only used for `symlog` scales. - * - * __Default value:__ `1` - */ - constant?: number | SignalRef; - - /** - * If `true`, ensures that a zero baseline value is included in the scale domain. - * - * __Default value:__ `true` for x and y channels if the quantitative field is not binned and no custom `domain` is provided; `false` otherwise. - * - * __Note:__ Log, time, and utc scales do not support `zero`. - */ - zero?: boolean | SignalRef; - - /** - * The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include `rgb`, `hsl`, `hsl-long`, `lab`, `hcl`, `hcl-long`, `cubehelix` and `cubehelix-long` ('-long' variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued _type_ property and an optional numeric _gamma_ property applicable to rgb and cubehelix interpolators. For more, see the [d3-interpolate documentation](https://github.com/d3/d3-interpolate). - * - * * __Default value:__ `hcl` - */ - interpolate?: ScaleInterpolateEnum | SignalRef | ScaleInterpolateParams; -} - -const SCALE_PROPERTY_INDEX: Flag = { - type: 1, - domain: 1, - domainMax: 1, - domainMin: 1, - domainMid: 1, - align: 1, - range: 1, - rangeMax: 1, - rangeMin: 1, - scheme: 1, - bins: 1, - // Other properties - reverse: 1, - round: 1, - // quantitative / time - clamp: 1, - nice: 1, - // quantitative - base: 1, - exponent: 1, - constant: 1, - interpolate: 1, - zero: 1, // zero depends on domain - // band/point - padding: 1, - paddingInner: 1, - paddingOuter: 1 -}; - -export const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX); - -const { - type, - domain, - range, - rangeMax, - rangeMin, - scheme, - ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX -} = SCALE_PROPERTY_INDEX; - -export const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX); - -export function scaleTypeSupportProperty(scaleType: ScaleType, propName: keyof Scale): boolean { - switch (propName) { - case 'type': - case 'domain': - case 'reverse': - case 'range': - return true; - case 'scheme': - case 'interpolate': - return !contains(['point', 'band', 'identity'], scaleType); - case 'bins': - return !contains(['point', 'band', 'identity', 'ordinal'], scaleType); - case 'round': - return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point'; - case 'padding': - case 'rangeMin': - case 'rangeMax': - return isContinuousToContinuous(scaleType) || contains(['point', 'band'], scaleType); - case 'paddingOuter': - case 'align': - return contains(['point', 'band'], scaleType); - case 'paddingInner': - return scaleType === 'band'; - case 'domainMax': - case 'domainMid': - case 'domainMin': - case 'clamp': - return isContinuousToContinuous(scaleType); - case 'nice': - return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold'; - case 'exponent': - return scaleType === 'pow'; - case 'base': - return scaleType === 'log'; - case 'constant': - return scaleType === 'symlog'; - case 'zero': - return ( - hasContinuousDomain(scaleType) && - !contains( - [ - 'log', // log scale cannot have zero value - 'time', - 'utc', // zero is not meaningful for time - 'threshold', // threshold requires custom domain so zero does not matter - 'quantile' // quantile depends on distribution so zero does not matter - ], - scaleType - ) - ); - } -} - -/** - * Returns undefined if the input channel supports the input scale property name - */ -export function channelScalePropertyIncompatability(channel: Channel, propName: keyof Scale): string { - switch (propName) { - case 'interpolate': - case 'scheme': - case 'domainMid': - if (!isColorChannel(channel)) { - return log.message.cannotUseScalePropertyWithNonColor(channel); - } - return undefined; - case 'align': - case 'type': - case 'bins': - case 'domain': - case 'domainMax': - case 'domainMin': - case 'range': - case 'base': - case 'exponent': - case 'constant': - case 'nice': - case 'padding': - case 'paddingInner': - case 'paddingOuter': - case 'rangeMax': - case 'rangeMin': - case 'reverse': - case 'round': - case 'clamp': - case 'zero': - return undefined; // GOOD! - } -} - -export function scaleTypeSupportDataType(specifiedType: ScaleType, fieldDefType: Type): boolean { - if (contains([ORDINAL, NOMINAL], fieldDefType)) { - return specifiedType === undefined || hasDiscreteDomain(specifiedType); - } else if (fieldDefType === TEMPORAL) { - return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType); - } else if (fieldDefType === QUANTITATIVE) { - return contains( - [ - ScaleType.LOG, - ScaleType.POW, - ScaleType.SQRT, - ScaleType.SYMLOG, - ScaleType.QUANTILE, - ScaleType.QUANTIZE, - ScaleType.THRESHOLD, - ScaleType.LINEAR, - undefined - ], - specifiedType - ); - } - - return true; -} - -export function channelSupportScaleType(channel: Channel, scaleType: ScaleType): boolean { - if (!CHANNEL.isScaleChannel(channel)) { - return false; - } - switch (channel) { - case CHANNEL.X: - case CHANNEL.Y: - case CHANNEL.THETA: - case CHANNEL.RADIUS: - return isContinuousToContinuous(scaleType) || contains(['band', 'point'], scaleType); - case CHANNEL.SIZE: // TODO: size and opacity can support ordinal with more modification - case CHANNEL.STROKEWIDTH: - case CHANNEL.OPACITY: - case CHANNEL.FILLOPACITY: - case CHANNEL.STROKEOPACITY: - case CHANNEL.ANGLE: - // Although it generally doesn't make sense to use band with size and opacity, - // it can also work since we use band: 0.5 to get midpoint. - return ( - isContinuousToContinuous(scaleType) || - isContinuousToDiscrete(scaleType) || - contains(['band', 'point', 'ordinal'], scaleType) - ); - case CHANNEL.COLOR: - case CHANNEL.FILL: - case CHANNEL.STROKE: - return scaleType !== 'band'; // band does not make sense with color - case CHANNEL.STROKEDASH: - return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType); - case CHANNEL.SHAPE: - return scaleType === 'ordinal'; // shape = lookup only - } -} diff --git a/node_modules/vega-lite/src/selection.ts b/node_modules/vega-lite/src/selection.ts deleted file mode 100644 index 405e6f1..0000000 --- a/node_modules/vega-lite/src/selection.ts +++ /dev/null @@ -1,344 +0,0 @@ -import {Binding, Color, Cursor, Stream, Vector2} from 'vega'; -import {isObject} from 'vega-util'; -import {SingleDefUnitChannel} from './channel'; -import {FieldName, PrimitiveValue} from './channeldef'; -import {DateTime} from './datetime'; -import {Dict} from './util'; - -export const SELECTION_ID = '_vgsid_'; -export type SelectionType = 'single' | 'multi' | 'interval'; -export type SelectionResolution = 'global' | 'union' | 'intersect'; - -export type SelectionInit = PrimitiveValue | DateTime; -export type SelectionInitInterval = Vector2 | Vector2 | Vector2 | Vector2; - -export type SelectionInitMapping = Dict; -export type SelectionInitIntervalMapping = Dict; - -export type LegendStreamBinding = {legend: string | Stream}; -export type LegendBinding = 'legend' | LegendStreamBinding; - -export interface BaseSelectionConfig { - /** - * Clears the selection, emptying it of all values. Can be a - * [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable. - * - * __Default value:__ `dblclick`. - * - * __See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation. - */ - clear?: Stream | string | boolean; - - /** - * A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection. - * For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters). - */ - on?: Stream | string; - /** - * With layered and multi-view displays, a strategy that determines how - * selections' data queries are resolved when applied in a filter transform, - * conditional encoding rule, or scale domain. - * - * __See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation. - */ - resolve?: SelectionResolution; - - // TODO(https://github.com/vega/vega-lite/issues/2596). - // predicate?: string; - // domain?: SelectionDomain; - - /** - * An array of encoding channels. The corresponding data field values - * must match for a data tuple to fall within the selection. - * - * __See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation. - */ - encodings?: SingleDefUnitChannel[]; - - /** - * An array of field names whose values must match for a data tuple to - * fall within the selection. - * - * __See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation. - */ - fields?: FieldName[]; - - /** - * By default, `all` data values are considered to lie within an empty selection. - * When set to `none`, empty selections contain no data values. - */ - empty?: 'all' | 'none'; -} - -export interface SingleSelectionConfig extends BaseSelectionConfig { - /** - * When set, a selection is populated by input elements (also known as dynamic query widgets) - * or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; - * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property. - * - * Legend bindings are restricted to selections that only specify a single field or encoding. - * - * Query widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind) - * or can be a mapping between projected field/encodings and binding definitions. - * - * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation. - */ - bind?: Binding | Record | LegendBinding; - - /** - * When true, an invisible voronoi diagram is computed to accelerate discrete - * selection. The data value _nearest_ the mouse cursor is added to the selection. - * - * __See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation. - */ - nearest?: boolean; - - /** - * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and initial values. - * - * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation. - */ - init?: SelectionInitMapping; -} - -export interface MultiSelectionConfig extends BaseSelectionConfig { - /** - * Controls whether data values should be toggled or only ever inserted into - * multi selections. Can be `true`, `false` (for insertion only), or a - * [Vega expression](https://vega.github.io/vega/docs/expressions/). - * - * __Default value:__ `true`, which corresponds to `event.shiftKey` (i.e., - * data values are toggled when a user interacts with the shift-key pressed). - * - * Setting the value to the Vega expression `"true"` will toggle data values - * without the user pressing the shift-key. - * - * __See also:__ [`toggle`](https://vega.github.io/vega-lite/docs/toggle.html) documentation. - */ - toggle?: string | boolean; - - /** - * When true, an invisible voronoi diagram is computed to accelerate discrete - * selection. The data value _nearest_ the mouse cursor is added to the selection. - * - * __See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation. - */ - nearest?: boolean; - - /** - * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and an initial - * value (or array of values). - * - * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation. - */ - init?: SelectionInitMapping[]; - - /** - * When set, a selection is populated by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; - * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property. - * - * Legend bindings are restricted to selections that only specify a single field or encoding. - */ - bind?: LegendBinding; -} - -// Similar to BaseMarkConfig but the field documentations are specificly for an interval mark. -export interface BrushConfig { - /** - * The fill color of the interval mark. - * - * __Default value:__ `"#333333"` - * - */ - fill?: Color; - /** - * The fill opacity of the interval mark (a value between `0` and `1`). - * - * __Default value:__ `0.125` - */ - fillOpacity?: number; - /** - * The stroke color of the interval mark. - * - * __Default value:__ `"#ffffff"` - */ - stroke?: Color; - /** - * The stroke opacity of the interval mark (a value between `0` and `1`). - */ - strokeOpacity?: number; - /** - * The stroke width of the interval mark. - */ - strokeWidth?: number; - /** - * An array of alternating stroke and space lengths, for creating dashed or dotted lines. - */ - strokeDash?: number[]; - /** - * The offset (in pixels) with which to begin drawing the stroke dash array. - */ - strokeDashOffset?: number; - /** - * The mouse cursor used over the interval mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used. - */ - cursor?: Cursor; -} - -export interface IntervalSelectionConfig extends BaseSelectionConfig { - /** - * When truthy, allows a user to interactively move an interval selection - * back-and-forth. Can be `true`, `false` (to disable panning), or a - * [Vega event stream definition](https://vega.github.io/vega/docs/event-streams/) - * which must include a start and end event to trigger continuous panning. - * - * __Default value:__ `true`, which corresponds to - * `[mousedown, window:mouseup] > window:mousemove!` which corresponds to - * clicks and dragging within an interval selection to reposition it. - * - * __See also:__ [`translate`](https://vega.github.io/vega-lite/docs/translate.html) documentation. - */ - translate?: string | boolean; - - /** - * When truthy, allows a user to interactively resize an interval selection. - * Can be `true`, `false` (to disable zooming), or a [Vega event stream - * definition](https://vega.github.io/vega/docs/event-streams/). Currently, - * only `wheel` events are supported. - * - * __Default value:__ `true`, which corresponds to `wheel!`. - * - * __See also:__ [`zoom`](https://vega.github.io/vega-lite/docs/zoom.html) documentation. - */ - zoom?: string | boolean; - - /** - * Establishes a two-way binding between the interval selection and the scales - * used within the same view. This allows a user to interactively pan and - * zoom the view. - * - * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation. - */ - bind?: 'scales'; - - /** - * An interval selection also adds a rectangle mark to depict the - * extents of the interval. The `mark` property can be used to customize the - * appearance of the mark. - * - * __See also:__ [`mark`](https://vega.github.io/vega-lite/docs/selection-mark.html) documentation. - */ - mark?: BrushConfig; - - /** - * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and arrays of - * initial values. - * - * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation. - */ - init?: SelectionInitIntervalMapping; -} - -export interface BaseSelectionDef { - /** - * Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types: - * - * - `"single"` -- to select a single discrete data value on `click`. - * - `"multi"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`. - * - `"interval"` -- to select a continuous range of data values on `drag`. - */ - type: T; -} - -export interface SingleSelection extends BaseSelectionDef<'single'>, SingleSelectionConfig {} - -export interface MultiSelection extends BaseSelectionDef<'multi'>, MultiSelectionConfig {} - -export interface IntervalSelection extends BaseSelectionDef<'interval'>, IntervalSelectionConfig {} - -export type SelectionDef = SingleSelection | MultiSelection | IntervalSelection; - -export type SelectionExtent = - | { - /** - * The name of a selection. - */ - selection: string; - /** - * The field name to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html) - * over multiple fields or encodings. - */ - field?: FieldName; - } - | { - /** - * The name of a selection. - */ - selection: string; - /** - * The encoding channel to extract selected values for, when a selection is [projected](https://vega.github.io/vega-lite/docs/project.html) - * over multiple fields or encodings. - */ - encoding?: SingleDefUnitChannel; - }; - -export interface SelectionConfig { - /** - * The default definition for a [`single`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations - * for a single selection definition (except `type`) may be specified here. - * - * For instance, setting `single` to `{"on": "dblclick"}` populates single selections on double-click by default. - */ - single?: SingleSelectionConfig; - /** - * The default definition for a [`multi`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations - * for a multi selection definition (except `type`) may be specified here. - * - * For instance, setting `multi` to `{"toggle": "event.altKey"}` adds additional values to - * multi selections when clicking with the alt-key pressed by default. - */ - multi?: MultiSelectionConfig; - /** - * The default definition for an [`interval`](https://vega.github.io/vega-lite/docs/selection.html#type) selection. All properties and transformations - * for an interval selection definition (except `type`) may be specified here. - * - * For instance, setting `interval` to `{"translate": false}` disables the ability to move - * interval selections by default. - */ - interval?: IntervalSelectionConfig; -} - -export const defaultConfig: SelectionConfig = { - single: { - on: 'click', - fields: [SELECTION_ID], - resolve: 'global', - empty: 'all', - clear: 'dblclick' - }, - multi: { - on: 'click', - fields: [SELECTION_ID], - toggle: 'event.shiftKey', - resolve: 'global', - empty: 'all', - clear: 'dblclick' - }, - interval: { - on: '[mousedown, window:mouseup] > window:mousemove!', - encodings: ['x', 'y'], - translate: '[mousedown, window:mouseup] > window:mousemove!', - zoom: 'wheel!', - mark: {fill: '#333', fillOpacity: 0.125, stroke: 'white'}, - resolve: 'global', - clear: 'dblclick' - } -}; - -export function isLegendBinding(bind: any): bind is LegendBinding { - return !!bind && (bind === 'legend' || !!bind.legend); -} - -export function isLegendStreamBinding(bind: any): bind is LegendStreamBinding { - return isLegendBinding(bind) && isObject(bind); -} diff --git a/node_modules/vega-lite/src/sort.ts b/node_modules/vega-lite/src/sort.ts deleted file mode 100644 index e3d6937..0000000 --- a/node_modules/vega-lite/src/sort.ts +++ /dev/null @@ -1,121 +0,0 @@ -import {isArray} from 'vega-util'; -import {NonArgAggregateOp} from './aggregate'; -import {FieldName} from './channeldef'; -import {DateTime} from './datetime'; - -export type SortOrder = 'ascending' | 'descending'; - -/** - * A sort definition for transform - */ -export interface SortField { - /** - * The name of the field to sort. - */ - field: FieldName; - - /** - * Whether to sort the field in ascending or descending order. One of `"ascending"` (default), `"descending"`, or `null` (no not sort). - */ - order?: SortOrder | null; -} - -export interface SortFields { - field: FieldName[]; - order?: SortOrder[]; -} - -export const DEFAULT_SORT_OP = 'min'; - -/** - * A sort definition for sorting a discrete scale in an encoding field definition. - */ - -export interface EncodingSortField { - /** - * The data [field](https://vega.github.io/vega-lite/docs/field.html) to sort by. - * - * __Default value:__ If unspecified, defaults to the field specified in the outer data reference. - */ - field?: F; // Field is optional because `"op": "count"` does not require a field. - /** - * An [aggregate operation](https://vega.github.io/vega-lite/docs/aggregate.html#ops) to perform on the field prior to sorting (e.g., `"count"`, `"mean"` and `"median"`). - * An aggregation is required when there are multiple values of the sort field for each encoded data field. - * The input data objects will be aggregated, grouped by the encoded data field. - * - * For a full list of operations, please see the documentation for [aggregate](https://vega.github.io/vega-lite/docs/aggregate.html#ops). - * - * __Default value:__ `"sum"` for stacked plots. Otherwise, `"min"`. - */ - op?: NonArgAggregateOp; - - /** - * The sort order. One of `"ascending"` (default), `"descending"`, or `null` (no not sort). - */ - order?: SortOrder | null; -} - -export interface SortByEncoding { - /** - * The [encoding channel](https://vega.github.io/vega-lite/docs/encoding.html#channels) to sort by (e.g., `"x"`, `"y"`) - */ - encoding: SortByChannel; - - /** - * The sort order. One of `"ascending"` (default), `"descending"`, or `null` (no not sort). - */ - order?: SortOrder | null; -} - -export type SortArray = number[] | string[] | boolean[] | DateTime[]; - -const SORT_BY_CHANNEL_INDEX = { - x: 1, - y: 1, - color: 1, - fill: 1, - stroke: 1, - strokeWidth: 1, - size: 1, - shape: 1, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - text: 1 -} as const; - -export type SortByChannel = keyof typeof SORT_BY_CHANNEL_INDEX; - -export function isSortByChannel(c: string): c is SortByChannel { - return c in SORT_BY_CHANNEL_INDEX; -} - -export type SortByChannelDesc = - | '-x' - | '-y' - | '-color' - | '-fill' - | '-stroke' - | '-strokeWidth' - | '-size' - | '-shape' - | '-fillOpacity' - | '-strokeOpacity' - | '-opacity' - | '-text'; - -export type AllSortString = SortOrder | SortByChannel | SortByChannelDesc; - -export type Sort = SortArray | AllSortString | EncodingSortField | SortByEncoding | null; - -export function isSortByEncoding(sort: Sort): sort is SortByEncoding { - return !!sort && !!sort['encoding']; -} - -export function isSortField(sort: Sort): sort is EncodingSortField { - return !!sort && (sort['op'] === 'count' || !!sort['field']); -} - -export function isSortArray(sort: Sort): sort is SortArray { - return !!sort && isArray(sort); -} diff --git a/node_modules/vega-lite/src/spec/base.ts b/node_modules/vega-lite/src/spec/base.ts deleted file mode 100644 index af0eb41..0000000 --- a/node_modules/vega-lite/src/spec/base.ts +++ /dev/null @@ -1,331 +0,0 @@ -import {Color, Cursor, SignalRef, Text} from 'vega'; -import {isNumber, isObject} from 'vega-util'; -import {NormalizedSpec} from '.'; -import {Data} from '../data'; -import {MarkConfig} from '../mark'; -import {Resolve} from '../resolve'; -import {TitleParams} from '../title'; -import {Transform} from '../transform'; -import {Flag, keys} from '../util'; -import {LayoutAlign, RowCol} from '../vega.schema'; -import {isConcatSpec, isVConcatSpec} from './concat'; -import {isFacetMapping, isFacetSpec} from './facet'; - -export {TopLevel} from './toplevel'; - -/** - * Common properties for all types of specification - */ -export interface BaseSpec { - /** - * Title for the plot. - */ - title?: Text | TitleParams; - - /** - * Name of the visualization for later reference. - */ - name?: string; - - /** - * Description of this mark for commenting purpose. - */ - description?: string; - - /** - * An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent. - */ - data?: Data | null; - - /** - * An array of data transformations such as filter and new field calculation. - */ - transform?: Transform[]; -} - -export interface DataMixins { - /** - * An object describing the data source. - */ - data: Data; -} - -export interface Step { - /** - * The size (width/height) per discrete step. - */ - step: number; -} - -export function isStep(size: number | Step | 'container' | 'merged'): size is Step { - return isObject(size) && size['step'] !== undefined; -} - -// TODO(https://github.com/vega/vega-lite/issues/2503): Make this generic so we can support some form of top-down sizing. -/** - * Common properties for specifying width and height of unit and layer specifications. - */ -export interface LayoutSizeMixins { - /** - * The width of a visualization. - * - * - For a plot with a continuous x-field, width should be a number. - * - For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.) - * - To enable responsive sizing on width, it should be set to `"container"`. - * - * __Default value:__ - * Based on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise. - * - * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `"container"` option cannot be used. - * - * __See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation. - */ - width?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here. - - /** - * The height of a visualization. - * - * - For a plot with a continuous y-field, height should be a number. - * - For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.) - * - To enable responsive sizing on height, it should be set to `"container"`. - * - * __Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise. - * - * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `"container"` option cannot be used. - * - * __See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation. - */ - height?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here. -} - -export function isFrameMixins(o: any): o is FrameMixins { - return o['view'] || o['width'] || o['height']; -} - -export interface FrameMixins extends LayoutSizeMixins { - /** - * An object defining the view background's fill and stroke. - * - * __Default value:__ none (transparent) - */ - view?: ViewBackground; -} - -export type DeprecatedFrameMixins = { - /** - * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec. - */ - width?: FrameMixins['width']; - - /** - * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec. - */ - height?: FrameMixins['height']; - - /** - * __Deprecated:__ Please avoid using width in a unit spec that's a part of a layer spec. - */ - view?: FrameMixins['view']; -}; - -export interface ResolveMixins { - /** - * Scale, axis, and legend resolutions for view composition specifications. - */ - resolve?: Resolve; -} - -export interface BaseViewBackground - extends Partial< - Pick< - MarkConfig, - | 'cornerRadius' - | 'fillOpacity' - | 'opacity' - | 'strokeCap' - | 'strokeDash' - | 'strokeDashOffset' - | 'strokeJoin' - | 'strokeMiterLimit' - | 'strokeOpacity' - | 'strokeWidth' - > - > { - // Override documentations for fill, stroke, and cursor - /** - * The fill color. - * - * __Default value:__ `undefined` - */ - fill?: Color | null | SignalRef; - - /** - * The stroke color. - * - * __Default value:__ `"#ddd"` - */ - stroke?: Color | null | SignalRef; - - /** - * The mouse cursor used over the view. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used. - */ - cursor?: Cursor; -} - -export interface ViewBackground extends BaseViewBackground { - /** - * A string or array of strings indicating the name of custom styles to apply to the view background. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. - * - * __Default value:__ `"cell"` - * __Note:__ Any specified view background properties will augment the default style. - */ - style?: string | string[]; -} - -export interface BoundsMixins { - /** - * The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`. - * - * - If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used. - * - If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. - * - * __Default value:__ `"full"` - */ - - bounds?: 'full' | 'flush'; -} - -/** - * Base layout for FacetSpec and RepeatSpec. - * This is named "GenericComposition" layout as ConcatLayout is a GenericCompositionLayout too - * (but _not_ vice versa). - */ -export interface GenericCompositionLayout extends BoundsMixins { - /** - * The alignment to apply to grid rows and columns. - * The supported string values are `"all"`, `"each"`, and `"none"`. - * - * - For `"none"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other. - * - For `"each"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size. - * - For `"all"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns. - * - * Alternatively, an object value of the form `{"row": string, "column": string}` can be used to supply different alignments for rows and columns. - * - * __Default value:__ `"all"`. - */ - align?: LayoutAlign | RowCol; - - /** - * Boolean flag indicating if subviews should be centered relative to their respective rows or columns. - * - * An object value of the form `{"row": boolean, "column": boolean}` can be used to supply different centering values for rows and columns. - * - * __Default value:__ `false` - */ - center?: boolean | RowCol; - - /** - * The spacing in pixels between sub-views of the composition operator. - * An object of the form `{"row": number, "column": number}` can be used to set - * different spacing values for rows and columns. - * - * __Default value__: Depends on `"spacing"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default) - */ - spacing?: number | RowCol; -} - -export const DEFAULT_SPACING = 20; - -export interface ColumnMixins { - /** - * The number of columns to include in the view composition layout. - * - * __Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to - * `hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`). - * - * __Note__: - * - * 1) This property is only for: - * - the general (wrappable) `concat` operator (not `hconcat`/`vconcat`) - * - the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting) - * - * 2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`). - */ - columns?: number; -} - -export type GenericCompositionLayoutWithColumns = GenericCompositionLayout & ColumnMixins; - -export type CompositionConfig = ColumnMixins & { - /** - * The default spacing in pixels between composed sub-views. - * - * __Default value__: `20` - */ - spacing?: number; -}; - -export interface CompositionConfigMixins { - /** Default configuration for the `facet` view composition operator */ - facet?: CompositionConfig; - - /** Default configuration for all concatenation and repeat view composition operators (`concat`, `hconcat`, `vconcat`, and `repeat`) */ - concat?: CompositionConfig; -} - -const COMPOSITION_LAYOUT_INDEX: Flag = { - align: 1, - bounds: 1, - center: 1, - columns: 1, - spacing: 1 -}; - -const COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX); - -export type SpecType = 'unit' | 'facet' | 'layer' | 'concat'; - -export function extractCompositionLayout( - spec: NormalizedSpec, - specType: keyof CompositionConfigMixins, - config: CompositionConfigMixins -): GenericCompositionLayoutWithColumns { - const compositionConfig = config[specType]; - const layout: GenericCompositionLayoutWithColumns = {}; - - // Apply config first - const {spacing: spacingConfig, columns} = compositionConfig; - if (spacingConfig !== undefined) { - layout.spacing = spacingConfig; - } - - if (columns !== undefined) { - if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) { - layout.columns = columns; - } - } - - if (isVConcatSpec(spec)) { - layout.columns = 1; - } - - // Then copy properties from the spec - for (const prop of COMPOSITION_LAYOUT_PROPERTIES) { - if (spec[prop] !== undefined) { - if (prop === 'spacing') { - const spacing: number | RowCol = spec[prop]; - - layout[prop] = isNumber(spacing) - ? spacing - : { - row: spacing.row ?? spacingConfig, - column: spacing.column ?? spacingConfig - }; - } else { - (layout[prop] as any) = spec[prop]; - } - } - } - - return layout; -} diff --git a/node_modules/vega-lite/src/spec/concat.ts b/node_modules/vega-lite/src/spec/concat.ts deleted file mode 100644 index 63d1132..0000000 --- a/node_modules/vega-lite/src/spec/concat.ts +++ /dev/null @@ -1,80 +0,0 @@ -import {GenericSpec, NormalizedSpec} from '.'; -import {BaseSpec, BoundsMixins, GenericCompositionLayoutWithColumns, ResolveMixins} from './base'; - -/** - * Base layout mixins for V/HConcatSpec, which should not have RowCol generic fo its property. - */ -export interface OneDirectionalConcatLayout extends BoundsMixins, ResolveMixins { - /** - * Boolean flag indicating if subviews should be centered relative to their respective rows or columns. - * - * __Default value:__ `false` - */ - center?: boolean; - - /** - * The spacing in pixels between sub-views of the concat operator. - * - * __Default value__: `10` - */ - spacing?: number; -} - -/** - * Base interface for a generalized concatenation specification. - */ -export interface GenericConcatSpec> - extends BaseSpec, - GenericCompositionLayoutWithColumns, - ResolveMixins { - /** - * A list of views to be concatenated. - */ - concat: S[]; -} - -/** - * Base interface for a vertical concatenation specification. - */ -export interface GenericVConcatSpec> - extends BaseSpec, - OneDirectionalConcatLayout { - /** - * A list of views to be concatenated and put into a column. - */ - vconcat: S[]; -} - -/** - * Base interface for a horizontal concatenation specification. - */ -export interface GenericHConcatSpec> - extends BaseSpec, - OneDirectionalConcatLayout { - /** - * A list of views to be concatenated and put into a row. - */ - hconcat: S[]; -} - -/** A concat spec without any shortcut/expansion syntax */ -export type NormalizedConcatSpec = - | GenericConcatSpec - | GenericVConcatSpec - | GenericHConcatSpec; - -export function isAnyConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec | GenericHConcatSpec { - return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec); -} - -export function isConcatSpec(spec: BaseSpec): spec is GenericConcatSpec { - return 'concat' in spec; -} - -export function isVConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec { - return 'vconcat' in spec; -} - -export function isHConcatSpec(spec: BaseSpec): spec is GenericHConcatSpec { - return 'hconcat' in spec; -} diff --git a/node_modules/vega-lite/src/spec/facet.ts b/node_modules/vega-lite/src/spec/facet.ts deleted file mode 100644 index 471bb27..0000000 --- a/node_modules/vega-lite/src/spec/facet.ts +++ /dev/null @@ -1,130 +0,0 @@ -import {LayoutAlign} from 'vega'; -import {BinParams} from '../bin'; -import {ChannelDef, Field, FieldName, TypedFieldDef} from '../channeldef'; -import {Header} from '../header'; -import {EncodingSortField, SortArray, SortOrder} from '../sort'; -import {StandardType} from '../type'; -import {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base'; -import {GenericLayerSpec, NormalizedLayerSpec} from './layer'; -import {GenericUnitSpec, NormalizedUnitSpec} from './unit'; - -export interface FacetFieldDef extends TypedFieldDef { - /** - * An object defining properties of a facet's header. - */ - header?: Header; - - // Note: `"sort"` for facet field def is different from encoding field def as it does not support `SortByEncoding` - - /** - * Sort order for the encoded field. - * - * For continuous fields (quantitative or temporal), `sort` can be either `"ascending"` or `"descending"`. - * - * For discrete fields, `sort` can be one of the following: - * - `"ascending"` or `"descending"` -- for sorting by the values' natural order in JavaScript. - * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field. - * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `"month"` and `"day"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `"Mon"`, `"Tue"`). - * - `null` indicating no sort. - * - * __Default value:__ `"ascending"` - * - * __Note:__ `null` is not supported for `row` and `column`. - */ - sort?: SortArray | SortOrder | EncodingSortField | null; -} - -export type FacetEncodingFieldDef = FacetFieldDef & GenericCompositionLayoutWithColumns; - -export interface RowColumnEncodingFieldDef extends FacetFieldDef { - // Manually declarae this separated from GenericCompositionLayout as we don't support RowCol object in RowColumnEncodingFieldDef - - /** - * The alignment to apply to row/column facet's subplot. - * The supported string values are `"all"`, `"each"`, and `"none"`. - * - * - For `"none"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other. - * - For `"each"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size. - * - For `"all"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns. - * - * __Default value:__ `"all"`. - */ - align?: LayoutAlign; - - /** - * Boolean flag indicating if facet's subviews should be centered relative to their respective rows or columns. - * - * __Default value:__ `false` - */ - center?: boolean; - - /** - * The spacing in pixels between facet's sub-views. - * - * __Default value__: Depends on `"spacing"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default) - */ - spacing?: number; -} - -export interface FacetMapping = FacetFieldDef> { - /** - * A field definition for the vertical facet of trellis plots. - */ - row?: FD; - - /** - * A field definition for the horizontal facet of trellis plots. - */ - column?: FD; -} - -export function isFacetMapping(f: FacetFieldDef | FacetMapping): f is FacetMapping { - return 'row' in f || 'column' in f; -} - -/** - * Facet mapping for encoding macro - */ -export interface EncodingFacetMapping extends FacetMapping> { - /** - * A field definition for the (flexible) facet of trellis plots. - * - * If either `row` or `column` is specified, this channel will be ignored. - */ - facet?: FacetEncodingFieldDef; -} - -export function isFacetFieldDef(channelDef: ChannelDef): channelDef is FacetFieldDef { - return !!channelDef && 'header' in channelDef; -} - -/** - * Base interface for a facet specification. - */ -export interface GenericFacetSpec< - U extends GenericUnitSpec, - L extends GenericLayerSpec, - F extends Field -> extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { - /** - * Definition for how to facet the data. One of: - * 1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def) - * 2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping) - */ - facet: FacetFieldDef | FacetMapping; - - /** - * A specification of the view that gets faceted. - */ - spec: L | U; - // TODO: replace this with GenericSpec once we support all cases; -} - -/** - * A facet specification without any shortcut / expansion syntax - */ -export type NormalizedFacetSpec = GenericFacetSpec; - -export function isFacetSpec(spec: BaseSpec): spec is GenericFacetSpec { - return 'facet' in spec; -} diff --git a/node_modules/vega-lite/src/spec/index.ts b/node_modules/vega-lite/src/spec/index.ts deleted file mode 100644 index bb000ef..0000000 --- a/node_modules/vega-lite/src/spec/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Definition for specifications in Vega-Lite. In general, there are 3 variants of specs for each type of specs: - * - Generic specs are generic versions of specs and they are parameterized differently for internal and external specs. - * - The external specs (no prefix) would allow composite marks, row/column encodings, and mark macros like point/line overlay. - * - The internal specs (with `Normalized` prefix) would only support primitive marks and support no macros/shortcuts. - */ -import {Field} from '../channeldef'; -import {FieldName} from '../channeldef'; -import {DataMixins} from './base'; -import {GenericConcatSpec, GenericHConcatSpec, GenericVConcatSpec} from './concat'; -import {GenericFacetSpec} from './facet'; -import {GenericLayerSpec, LayerSpec, NormalizedLayerSpec} from './layer'; -import {RepeatSpec} from './repeat'; -import {TopLevel} from './toplevel'; -import {FacetedUnitSpec, GenericUnitSpec, NormalizedUnitSpec, TopLevelUnitSpec, UnitSpecWithFrame} from './unit'; - -export {BaseSpec, LayoutSizeMixins} from './base'; -export { - GenericHConcatSpec, - GenericVConcatSpec, - isAnyConcatSpec, - isHConcatSpec, - isVConcatSpec, - NormalizedConcatSpec -} from './concat'; -export {GenericFacetSpec, isFacetSpec, NormalizedFacetSpec} from './facet'; -export {GenericLayerSpec, isLayerSpec, LayerSpec, NormalizedLayerSpec} from './layer'; -export {isRepeatSpec, RepeatSpec} from './repeat'; -export {TopLevel} from './toplevel'; -export {FacetedUnitSpec, GenericUnitSpec, isUnitSpec, NormalizedUnitSpec, UnitSpec} from './unit'; - -/** - * Any specification in Vega-Lite. - */ -export type GenericSpec< - U extends GenericUnitSpec, - L extends GenericLayerSpec, - R extends RepeatSpec, - F extends Field -> = - | U - | L - | R - | GenericFacetSpec - | GenericConcatSpec> - | GenericVConcatSpec> - | GenericHConcatSpec>; - -/** - * Specs with only primitive marks and without other macros. - */ -export type NormalizedSpec = GenericSpec; - -export type TopLevelFacetSpec = TopLevel> & DataMixins; - -/** - * A Vega-Lite top-level specification. - * This is the root class for all Vega-Lite specifications. - * (The json schema is generated from this type.) - */ -export type TopLevelSpec = - | TopLevelUnitSpec - | TopLevelFacetSpec - | TopLevel - | TopLevel - | TopLevel>> - | TopLevel>> - | TopLevel>>; diff --git a/node_modules/vega-lite/src/spec/layer.ts b/node_modules/vega-lite/src/spec/layer.ts deleted file mode 100644 index 089e5dd..0000000 --- a/node_modules/vega-lite/src/spec/layer.ts +++ /dev/null @@ -1,47 +0,0 @@ -import {SharedCompositeEncoding} from '../compositemark'; -import {Projection} from '../projection'; -import {BaseSpec, FrameMixins, ResolveMixins} from './base'; -import {GenericUnitSpec, NormalizedUnitSpec, UnitSpec} from './unit'; - -/** - * Base interface for a layer specification. - */ -export interface GenericLayerSpec> extends BaseSpec, FrameMixins, ResolveMixins { - /** - * Layer or single view specifications to be layered. - * - * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet. - */ - layer: (GenericLayerSpec | U)[]; -} - -/** - * A full layered plot specification, which may contains `encoding` and `projection` properties that will be applied to underlying unit (single-view) specifications. - */ -export interface LayerSpec extends BaseSpec, FrameMixins, ResolveMixins { - /** - * Layer or single view specifications to be layered. - * - * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet. - */ - layer: (LayerSpec | UnitSpec)[]; - - /** - * A shared key-value mapping between encoding channels and definition of fields in the underlying layers. - */ - encoding?: SharedCompositeEncoding; - - /** - * An object defining properties of the geographic projection shared by underlying layers. - */ - projection?: Projection; -} - -/** - * A layered specification without any shortcut/expansion syntax. - */ -export type NormalizedLayerSpec = GenericLayerSpec; - -export function isLayerSpec(spec: BaseSpec): spec is GenericLayerSpec { - return 'layer' in spec; -} diff --git a/node_modules/vega-lite/src/spec/map.ts b/node_modules/vega-lite/src/spec/map.ts deleted file mode 100644 index a1098bb..0000000 --- a/node_modules/vega-lite/src/spec/map.ts +++ /dev/null @@ -1,107 +0,0 @@ -import {GenericSpec} from '.'; -import * as log from '../log'; -import {Field, FieldName} from '../channeldef'; -import { - GenericConcatSpec, - GenericHConcatSpec, - GenericVConcatSpec, - isConcatSpec, - isHConcatSpec, - isVConcatSpec -} from './concat'; -import {GenericFacetSpec, isFacetSpec} from './facet'; -import {GenericLayerSpec, isLayerSpec} from './layer'; -import {isRepeatSpec, RepeatSpec} from './repeat'; -import {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from './unit'; - -export abstract class SpecMapper< - P, - UI extends GenericUnitSpec, - LI extends GenericLayerSpec = GenericLayerSpec, - UO extends GenericUnitSpec = NormalizedUnitSpec, - RO extends RepeatSpec = never, - FO extends Field = FieldName -> { - public map(spec: GenericSpec, params: P): GenericSpec, RO, FO> { - if (isFacetSpec(spec)) { - return this.mapFacet(spec, params); - } else if (isRepeatSpec(spec)) { - return this.mapRepeat(spec, params); - } else if (isHConcatSpec(spec)) { - return this.mapHConcat(spec, params); - } else if (isVConcatSpec(spec)) { - return this.mapVConcat(spec, params); - } else if (isConcatSpec(spec)) { - return this.mapConcat(spec, params); - } else { - return this.mapLayerOrUnit(spec, params); - } - } - - public mapLayerOrUnit(spec: UI | LI, params: P): UO | GenericLayerSpec { - if (isLayerSpec(spec)) { - return this.mapLayer(spec, params); - } else if (isUnitSpec(spec)) { - return this.mapUnit(spec, params); - } - throw new Error(log.message.invalidSpec(spec)); - } - - public abstract mapUnit(spec: UI, params: P): UO | GenericLayerSpec; - - protected mapLayer(spec: LI, params: P): GenericLayerSpec { - return { - ...spec, - layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params)) - }; - } - - protected mapHConcat( - spec: GenericHConcatSpec>, - params: P - ): GenericHConcatSpec, RO, FO>> { - return { - ...spec, - hconcat: spec.hconcat.map(subspec => this.map(subspec, params)) - }; - } - - protected mapVConcat( - spec: GenericVConcatSpec>, - params: P - ): GenericVConcatSpec, RO, FO>> { - return { - ...spec, - vconcat: spec.vconcat.map(subspec => this.map(subspec, params)) - }; - } - - protected mapConcat( - spec: GenericConcatSpec>, - params: P - ): GenericConcatSpec, RO, FO>> { - const {concat, ...rest} = spec; - - return { - ...rest, - concat: concat.map(subspec => this.map(subspec, params)) - }; - } - - protected mapFacet(spec: GenericFacetSpec, params: P): GenericFacetSpec, FO> { - return { - // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef - ...(spec as any), - // TODO: remove "any" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760 - spec: this.map(spec.spec, params) as any - }; - } - - protected mapRepeat(spec: RepeatSpec, params: P): GenericSpec { - return { - ...spec, - // as any is required here since TS cannot infer that the output type satisfies the input type - spec: this.map(spec.spec as any, params) - }; - } -} diff --git a/node_modules/vega-lite/src/spec/repeat.ts b/node_modules/vega-lite/src/spec/repeat.ts deleted file mode 100644 index 405f7e0..0000000 --- a/node_modules/vega-lite/src/spec/repeat.ts +++ /dev/null @@ -1,65 +0,0 @@ -import {isArray} from 'vega-util'; -import {GenericSpec, LayerSpec} from '.'; -import {FieldName} from '../channeldef'; -import {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base'; -import {FacetedUnitSpec, UnitSpec} from './unit'; - -export interface RepeatMapping { - /** - * An array of fields to be repeated vertically. - */ - row?: string[]; - - /** - * An array of fields to be repeated horizontally. - */ - column?: string[]; -} - -export interface LayerRepeatMapping extends RepeatMapping { - /** - * An array of fields to be repeated as layers. - */ - layer: string[]; -} - -export type RepeatSpec = NonLayerRepeatSpec | LayerRepeatSpec; - -/** - * Base interface for a repeat specification. - */ -export interface NonLayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { - /** - * Definition for fields to be repeated. One of: - * 1) An array of fields to be repeated. If `"repeat"` is an array, the field can be referred to as `{"repeat": "repeat"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping. - * 2) An object that maps `"row"` and/or `"column"` to the listed fields to be repeated along the particular orientations. The objects `{"repeat": "row"}` and `{"repeat": "column"}` can be used to refer to the repeated field respectively. - */ - repeat: string[] | RepeatMapping; - - /** - * A specification of the view that gets repeated. - */ - spec: GenericSpec; -} - -export interface LayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { - /** - * Definition for fields to be repeated. One of: - * 1) An array of fields to be repeated. If `"repeat"` is an array, the field can be referred to as `{"repeat": "repeat"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping. - * 2) An object that maps `"row"` and/or `"column"` to the listed fields to be repeated along the particular orientations. The objects `{"repeat": "row"}` and `{"repeat": "column"}` can be used to refer to the repeated field respectively. - */ - repeat: LayerRepeatMapping; - - /** - * A specification of the view that gets repeated. - */ - spec: LayerSpec | UnitSpec; -} - -export function isRepeatSpec(spec: BaseSpec): spec is RepeatSpec { - return 'repeat' in spec; -} - -export function isLayerRepeatSpec(spec: RepeatSpec): spec is LayerRepeatSpec { - return !isArray(spec.repeat) && spec.repeat['layer']; -} diff --git a/node_modules/vega-lite/src/spec/toplevel.ts b/node_modules/vega-lite/src/spec/toplevel.ts deleted file mode 100644 index 35cbd47..0000000 --- a/node_modules/vega-lite/src/spec/toplevel.ts +++ /dev/null @@ -1,114 +0,0 @@ -import {Color, SignalRef} from 'vega'; -import {BaseSpec} from '.'; -import {getPositionScaleChannel} from '../channel'; -import {Config} from '../config'; -import {InlineDataset} from '../data'; -import {Dict} from '../util'; - -/** - * @minimum 0 - */ -export type Padding = number | {top?: number; bottom?: number; left?: number; right?: number}; - -export type Datasets = Dict; - -export type TopLevel = S & - TopLevelProperties & { - /** - * URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v4.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema. - * @format uri - */ - $schema?: string; - - /** - * Vega-Lite configuration object. This property can only be defined at the top-level of a specification. - */ - config?: Config; - - /** - * A global data store for named datasets. This is a mapping from names to inline datasets. - * This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property. - */ - datasets?: Datasets; - - /** - * Optional metadata that will be passed to Vega. - * This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata. - */ - usermeta?: Dict; - }; - -export interface TopLevelProperties { - /** - * CSS color property to use as the background of the entire view. - * - * __Default value:__ `"white"` - */ - background?: Color | SignalRef; - - /** - * The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. - * If an object, the value should have the format `{"left": 5, "top": 5, "right": 5, "bottom": 5}` to specify padding for each side of the visualization. - * - * __Default value__: `5` - */ - padding?: Padding | SignalRef; - - /** - * How the visualization size should be determined. If a string, should be one of `"pad"`, `"fit"` or `"none"`. - * Object values can additionally specify parameters for content sizing and automatic resizing. - * - * __Default value__: `pad` - */ - autosize?: AutosizeType | AutoSizeParams; // Vega actually supports signal for autosize. However, we need to check autosize at compile time to infer the rest of the spec. Thus VL's autosize won't support SignalRef for now. -} - -export type FitType = 'fit' | 'fit-x' | 'fit-y'; - -export function isFitType(autoSizeType: AutosizeType): autoSizeType is FitType { - return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y'; -} - -export function getFitType(sizeType?: 'width' | 'height'): FitType { - return sizeType ? (`fit-${getPositionScaleChannel(sizeType)}` as FitType) : 'fit'; -} - -export type AutosizeType = 'pad' | 'none' | 'fit' | 'fit-x' | 'fit-y'; - -export interface AutoSizeParams { - /** - * The sizing format type. One of `"pad"`, `"fit"`, `"fit-x"`, `"fit-y"`, or `"none"`. See the [autosize type](https://vega.github.io/vega-lite/docs/size.html#autosize) documentation for descriptions of each. - * - * __Default value__: `"pad"` - */ - type?: AutosizeType; - - /** - * A boolean flag indicating if autosize layout should be re-calculated on every view update. - * - * __Default value__: `false` - */ - resize?: boolean; - - /** - * Determines how size calculation should be performed, one of `"content"` or `"padding"`. The default setting (`"content"`) interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the `"padding"` setting includes the padding within the view size calculations, such that the width and height settings indicate the **total** intended size of the view. - * - * __Default value__: `"content"` - */ - contains?: 'content' | 'padding'; -} - -const TOP_LEVEL_PROPERTIES: (keyof TopLevelProperties)[] = [ - 'background', - 'padding' - // We do not include "autosize" here as it is supported by only unit and layer specs and thus need to be normalized -]; - -export function extractTopLevelProperties(t: T) { - return TOP_LEVEL_PROPERTIES.reduce((o, p) => { - if (t && t[p] !== undefined) { - o[p] = t[p]; - } - return o; - }, {}); -} diff --git a/node_modules/vega-lite/src/spec/unit.ts b/node_modules/vega-lite/src/spec/unit.ts deleted file mode 100644 index 3745833..0000000 --- a/node_modules/vega-lite/src/spec/unit.ts +++ /dev/null @@ -1,68 +0,0 @@ -import {FieldName} from '../channeldef'; -import {CompositeEncoding, FacetedCompositeEncoding} from '../compositemark'; -import {Encoding} from '../encoding'; -import {AnyMark, Mark, MarkDef} from '../mark'; -import {Projection} from '../projection'; -import {SelectionDef} from '../selection'; -import { - BaseSpec, - DataMixins, - DeprecatedFrameMixins, - FrameMixins, - GenericCompositionLayout, - ResolveMixins -} from './base'; -import {TopLevel} from './toplevel'; - -/** - * Base interface for a unit (single-view) specification. - */ -export interface GenericUnitSpec, M> extends BaseSpec { - /** - * A string describing the mark type (one of `"bar"`, `"circle"`, `"square"`, `"tick"`, `"line"`, - * `"area"`, `"point"`, `"rule"`, `"geoshape"`, and `"text"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def). - */ - mark: M; - - /** - * A key-value mapping between encoding channels and definition of fields. - */ - encoding?: E; - - /** - * An object defining properties of geographic projection, which will be applied to `shape` path for `"geoshape"` marks - * and to `latitude` and `"longitude"` channels for other marks. - */ - projection?: Projection; - - /** - * A key-value mapping between selection names and definitions. - */ - selection?: Record; -} - -/** - * A unit specification without any shortcut/expansion syntax. - */ -export type NormalizedUnitSpec = GenericUnitSpec, Mark | MarkDef>; - -/** - * A unit specification, which can contain either [primitive marks or composite marks](https://vega.github.io/vega-lite/docs/mark.html#types). - */ -export type UnitSpec = GenericUnitSpec & DeprecatedFrameMixins; - -export type UnitSpecWithFrame = GenericUnitSpec & FrameMixins; - -/** - * Unit spec that can have a composite mark and row or column channels (shorthand for a facet spec). - */ -export type FacetedUnitSpec = GenericUnitSpec & - ResolveMixins & - GenericCompositionLayout & - FrameMixins; - -export type TopLevelUnitSpec = TopLevel & DataMixins; - -export function isUnitSpec(spec: BaseSpec): spec is FacetedUnitSpec | NormalizedUnitSpec { - return 'mark' in spec; -} diff --git a/node_modules/vega-lite/src/stack.ts b/node_modules/vega-lite/src/stack.ts deleted file mode 100644 index 83128bb..0000000 --- a/node_modules/vega-lite/src/stack.ts +++ /dev/null @@ -1,253 +0,0 @@ -import {array, isBoolean} from 'vega-util'; -import {SUM_OPS} from './aggregate'; -import {getSecondaryRangeChannel, NonPositionChannel, NONPOSITION_CHANNELS} from './channel'; -import { - channelDefType, - FieldName, - getFieldDef, - isFieldDef, - isFieldOrDatumDef, - PositionDatumDef, - PositionFieldDef, - TypedFieldDef, - vgField -} from './channeldef'; -import {channelHasField, Encoding, isAggregate} from './encoding'; -import * as log from './log'; -import { - ARC, - AREA, - BAR, - CIRCLE, - isMarkDef, - isPathMark, - LINE, - Mark, - MarkDef, - POINT, - RULE, - SQUARE, - TEXT, - TICK -} from './mark'; -import {ScaleType} from './scale'; -import {contains} from './util'; - -const STACK_OFFSET_INDEX = { - zero: 1, - center: 1, - normalize: 1 -} as const; - -export type StackOffset = keyof typeof STACK_OFFSET_INDEX; - -export function isStackOffset(s: string): s is StackOffset { - return s in STACK_OFFSET_INDEX; -} - -export interface StackProperties { - /** Dimension axis of the stack. */ - groupbyChannel?: 'x' | 'y' | 'theta' | 'radius'; - - /** Field for groupbyChannel. */ - groupbyField?: FieldName; - - /** Measure axis of the stack. */ - fieldChannel: 'x' | 'y' | 'theta' | 'radius'; - - /** Stack-by fields e.g., color, detail */ - stackBy: { - fieldDef: TypedFieldDef; - channel: NonPositionChannel; - }[]; - - /** - * See `stack` property of Position Field Def. - */ - offset: StackOffset; - - /** - * Whether this stack will produce impute transform - */ - impute: boolean; -} - -export const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]); -export const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]); - -function potentialStackedChannel( - encoding: Encoding, - x: 'x' | 'theta' -): 'x' | 'y' | 'theta' | 'radius' | undefined { - const y = x === 'x' ? 'y' : 'radius'; - - const xDef = encoding[x]; - const yDef = encoding[y]; - - if (isFieldDef(xDef) && isFieldDef(yDef)) { - if (channelDefType(xDef) === 'quantitative' && channelDefType(yDef) === 'quantitative') { - if (xDef.stack) { - return x; - } else if (yDef.stack) { - return y; - } - const xAggregate = isFieldDef(xDef) && !!xDef.aggregate; - const yAggregate = isFieldDef(yDef) && !!yDef.aggregate; - // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y - if (xAggregate !== yAggregate) { - return xAggregate ? x : y; - } else { - const xScale = xDef.scale?.type; - const yScale = yDef.scale?.type; - - if (xScale && xScale !== 'linear') { - return y; - } else if (yScale && yScale !== 'linear') { - return x; - } - } - } else if (channelDefType(xDef) === 'quantitative') { - return x; - } else if (channelDefType(yDef) === 'quantitative') { - return y; - } - } else if (channelDefType(xDef) === 'quantitative') { - return x; - } else if (channelDefType(yDef) === 'quantitative') { - return y; - } - return undefined; -} - -function getDimensionChannel(channel: 'x' | 'y' | 'theta' | 'radius') { - switch (channel) { - case 'x': - return 'y'; - case 'y': - return 'x'; - case 'theta': - return 'radius'; - case 'radius': - return 'theta'; - } -} - -// Note: CompassQL uses this method and only pass in required properties of each argument object. -// If required properties change, make sure to update CompassQL. -export function stack( - m: Mark | MarkDef, - encoding: Encoding, - opt: { - disallowNonLinearStack?: boolean; // This option is for CompassQL - } = {} -): StackProperties { - const mark = isMarkDef(m) ? m.type : m; - // Should have stackable mark - if (!STACKABLE_MARKS.has(mark)) { - return null; - } - - // Run potential stacked twice, one for Cartesian and another for Polar, - // so text marks can be stacked in any of the coordinates. - - // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking. - // However, since we probably never want to do that, let's just note the limitation here. - const fieldChannel = potentialStackedChannel(encoding, 'x') || potentialStackedChannel(encoding, 'theta'); - - if (!fieldChannel) { - return null; - } - - const stackedFieldDef = encoding[fieldChannel] as PositionFieldDef | PositionDatumDef; - const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined; - - let dimensionChannel: 'x' | 'y' | 'theta' | 'radius' = getDimensionChannel(fieldChannel); - let dimensionDef = encoding[dimensionChannel]; - - let dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined; - - // avoid grouping by the stacked field - if (dimensionField === stackedField) { - dimensionField = undefined; - dimensionDef = undefined; - dimensionChannel = undefined; - } - - // Should have grouping level of detail that is different from the dimension field - const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => { - // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001) - if (channel !== 'tooltip' && channelHasField(encoding, channel)) { - const channelDef = encoding[channel]; - for (const cDef of array(channelDef)) { - const fieldDef = getFieldDef(cDef); - if (fieldDef.aggregate) { - continue; - } - - // Check whether the channel's field is identical to x/y's field or if the channel is a repeat - const f = vgField(fieldDef, {}); - if ( - // if fielddef is a repeat, just include it in the stack by - !f || - // otherwise, the field must be different from x and y fields. - f !== dimensionField - ) { - sc.push({channel, fieldDef}); - } - } - } - return sc; - }, []); - - // Automatically determine offset - let offset: StackOffset; - if (stackedFieldDef.stack !== undefined) { - if (isBoolean(stackedFieldDef.stack)) { - offset = stackedFieldDef.stack ? 'zero' : null; - } else { - offset = stackedFieldDef.stack; - } - } else if (stackBy.length > 0 && STACK_BY_DEFAULT_MARKS.has(mark)) { - // Bar and Area with sum ops are automatically stacked by default - offset = 'zero'; - } - - if (!offset || !isStackOffset(offset)) { - return null; - } - - if (isAggregate(encoding) && stackBy.length === 0) { - return null; - } - - // warn when stacking non-linear - if (stackedFieldDef.scale && stackedFieldDef.scale.type && stackedFieldDef.scale.type !== ScaleType.LINEAR) { - if (opt.disallowNonLinearStack) { - return null; - } else { - log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type)); - } - } - - // Check if it is a ranged mark - if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) { - if (stackedFieldDef.stack !== undefined) { - log.warn(log.message.cannotStackRangedMark(fieldChannel)); - } - return null; - } - - // Warn if stacking non-summative aggregate - if (isFieldDef(stackedFieldDef) && stackedFieldDef.aggregate && !contains(SUM_OPS, stackedFieldDef.aggregate)) { - log.warn(log.message.stackNonSummativeAggregate(stackedFieldDef.aggregate)); - } - - return { - groupbyChannel: dimensionDef ? dimensionChannel : undefined, - groupbyField: dimensionField, - fieldChannel, - impute: stackedFieldDef.impute === null ? false : isPathMark(mark), - stackBy, - offset - }; -} diff --git a/node_modules/vega-lite/src/timeunit.ts b/node_modules/vega-lite/src/timeunit.ts deleted file mode 100644 index 3fc096b..0000000 --- a/node_modules/vega-lite/src/timeunit.ts +++ /dev/null @@ -1,340 +0,0 @@ -import stringify from 'fast-json-stable-stringify'; -import {isObject, isString} from 'vega-util'; -import {DateTimeExpr, dateTimeExprToExpr} from './datetime'; -import {accessPathWithDatum, keys, varName} from './util'; - -/** Time Unit that only corresponds to only one part of Date objects. */ -export const LOCAL_SINGLE_TIMEUNIT_INDEX = { - year: 1, - quarter: 1, - month: 1, - week: 1, - day: 1, - dayofyear: 1, - date: 1, - hours: 1, - minutes: 1, - seconds: 1, - milliseconds: 1 -} as const; - -export type LocalSingleTimeUnit = keyof typeof LOCAL_SINGLE_TIMEUNIT_INDEX; - -export const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX); - -export function isLocalSingleTimeUnit(timeUnit: string): timeUnit is LocalSingleTimeUnit { - return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit]; -} - -export const UTC_SINGLE_TIMEUNIT_INDEX = { - utcyear: 1, - utcquarter: 1, - utcmonth: 1, - utcweek: 1, - utcday: 1, - utcdayofyear: 1, - utcdate: 1, - utchours: 1, - utcminutes: 1, - utcseconds: 1, - utcmilliseconds: 1 -} as const; - -export type UtcSingleTimeUnit = keyof typeof UTC_SINGLE_TIMEUNIT_INDEX; - -export type SingleTimeUnit = LocalSingleTimeUnit | UtcSingleTimeUnit; - -export const LOCAL_MULTI_TIMEUNIT_INDEX = { - yearquarter: 1, - yearquartermonth: 1, - - yearmonth: 1, - yearmonthdate: 1, - yearmonthdatehours: 1, - yearmonthdatehoursminutes: 1, - yearmonthdatehoursminutesseconds: 1, - - yearweek: 1, - yearweekday: 1, - yearweekdayhours: 1, - yearweekdayhoursminutes: 1, - yearweekdayhoursminutesseconds: 1, - - yeardayofyear: 1, - - quartermonth: 1, - - monthdate: 1, - monthdatehours: 1, - monthdatehoursminutes: 1, - monthdatehoursminutesseconds: 1, - - weekday: 1, - weeksdayhours: 1, - weekdayhoursminutes: 1, - weekdayhoursminutesseconds: 1, - - dayhours: 1, - dayhoursminutes: 1, - dayhoursminutesseconds: 1, - - hoursminutes: 1, - hoursminutesseconds: 1, - - minutesseconds: 1, - - secondsmilliseconds: 1 -} as const; - -export type LocalMultiTimeUnit = keyof typeof LOCAL_MULTI_TIMEUNIT_INDEX; - -export const UTC_MULTI_TIMEUNIT_INDEX = { - utcyearquarter: 1, - utcyearquartermonth: 1, - - utcyearmonth: 1, - utcyearmonthdate: 1, - utcyearmonthdatehours: 1, - utcyearmonthdatehoursminutes: 1, - utcyearmonthdatehoursminutesseconds: 1, - - utcyearweek: 1, - utcyearweekday: 1, - utcyearweekdayhours: 1, - utcyearweekdayhoursminutes: 1, - utcyearweekdayhoursminutesseconds: 1, - - utcyeardayofyear: 1, - - utcquartermonth: 1, - - utcmonthdate: 1, - utcmonthdatehours: 1, - utcmonthdatehoursminutes: 1, - utcmonthdatehoursminutesseconds: 1, - - utcweekday: 1, - utcweeksdayhours: 1, - utcweekdayhoursminutes: 1, - utcweekdayhoursminutesseconds: 1, - - utcdayhours: 1, - utcdayhoursminutes: 1, - utcdayhoursminutesseconds: 1, - - utchoursminutes: 1, - utchoursminutesseconds: 1, - - utcminutesseconds: 1, - - utcsecondsmilliseconds: 1 -} as const; - -export type UtcMultiTimeUnit = keyof typeof UTC_MULTI_TIMEUNIT_INDEX; - -export type MultiTimeUnit = LocalMultiTimeUnit | UtcMultiTimeUnit; - -export type LocalTimeUnit = LocalSingleTimeUnit | LocalMultiTimeUnit; -export type UtcTimeUnit = UtcSingleTimeUnit | UtcMultiTimeUnit; - -export function isUTCTimeUnit(t: string): t is UtcTimeUnit { - return t.startsWith('utc'); -} - -export function getLocalTimeUnit(t: UtcTimeUnit): LocalTimeUnit { - return t.substr(3) as LocalTimeUnit; -} - -export type TimeUnit = SingleTimeUnit | MultiTimeUnit; - -export type TimeUnitFormat = - | 'year' - | 'year-month' - | 'year-month-date' - | 'quarter' - | 'month' - | 'date' - | 'week' - | 'day' - | 'hours' - | 'hours-minutes' - | 'minutes' - | 'seconds' - | 'milliseconds'; - -export interface TimeUnitParams { - /** - * Defines how date-time values should be binned. - */ - unit?: TimeUnit; - - /** - * If no `unit` is specified, maxbins is used to infer time units. - */ - maxbins?: number; - - /** - * The number of steps between bins, in terms of the least - * significant unit provided. - */ - step?: number; - - /** - * True to use UTC timezone. Equivalent to using a `utc` prefixed `TimeUnit`. - */ - utc?: boolean; -} - -// matches vega time unit format specifier -export type TimeFormatConfig = Partial>; - -// In order of increasing specificity -export const VEGALITE_TIMEFORMAT: TimeFormatConfig = { - 'year-month': '%b %Y ', - 'year-month-date': '%b %d, %Y ' -}; - -export function getTimeUnitParts(timeUnit: TimeUnit) { - const parts: LocalSingleTimeUnit[] = []; - - for (const part of TIMEUNIT_PARTS) { - if (containsTimeUnit(timeUnit, part)) { - parts.push(part); - } - } - - return parts; -} - -/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */ -export function containsTimeUnit(fullTimeUnit: TimeUnit, timeUnit: TimeUnit) { - const index = fullTimeUnit.indexOf(timeUnit); - - if (index < 0) { - return false; - } - - // exclude milliseconds - if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') { - return false; - } - - // exclude dayofyear - if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') { - return false; - } - if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') { - return false; - } - - return true; -} - -/** - * Returns Vega expression for a given timeUnit and fieldRef - */ -export function fieldExpr(fullTimeUnit: TimeUnit, field: string, {end}: {end: boolean} = {end: false}): string { - const fieldRef = accessPathWithDatum(field); - - const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : ''; - - function func(timeUnit: TimeUnit) { - if (timeUnit === 'quarter') { - // quarter starting at 0 (0,3,6,9). - return `(${utc}quarter(${fieldRef})-1)`; - } else { - return `${utc}${timeUnit}(${fieldRef})`; - } - } - - let lastTimeUnit: TimeUnit; - - const dateExpr: DateTimeExpr = {}; - - for (const part of TIMEUNIT_PARTS) { - if (containsTimeUnit(fullTimeUnit, part)) { - dateExpr[part] = func(part); - lastTimeUnit = part; - } - } - - if (end) { - dateExpr[lastTimeUnit] += '+1'; - } - - return dateTimeExprToExpr(dateExpr); -} - -export function timeUnitSpecifierExpression(timeUnit: TimeUnit) { - if (!timeUnit) { - return undefined; - } - - const timeUnitParts = getTimeUnitParts(timeUnit); - return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`; -} - -/** - * Returns the signal expression used for axis labels for a time unit. - */ -export function formatExpression(timeUnit: TimeUnit, field: string, isUTCScale: boolean): string { - if (!timeUnit) { - return undefined; - } - - const expr = timeUnitSpecifierExpression(timeUnit); - - // We only use utcFormat for utc scale - // For utc time units, the data is already converted as a part of timeUnit transform. - // Thus, utc time units should use timeFormat to avoid shifting the time twice. - const utc = isUTCScale || isUTCTimeUnit(timeUnit); - - return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`; -} - -export function normalizeTimeUnit(timeUnit: TimeUnit | TimeUnitParams): TimeUnitParams { - if (!timeUnit) { - return undefined; - } - - let params: TimeUnitParams; - if (isString(timeUnit)) { - params = { - unit: timeUnit - }; - } else if (isObject(timeUnit)) { - params = { - ...timeUnit, - ...(timeUnit.unit ? {unit: timeUnit.unit} : {}) - }; - } - - if (isUTCTimeUnit(params.unit)) { - params.utc = true; - params.unit = getLocalTimeUnit(params.unit); - } - - return params; -} - -export function timeUnitToString(tu: TimeUnit | TimeUnitParams) { - const {utc, ...rest} = normalizeTimeUnit(tu); - - if (rest.unit) { - return ( - (utc ? 'utc' : '') + - keys(rest) - .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`)) - .join('') - ); - } else { - // when maxbins is specified instead of units - return ( - (utc ? 'utc' : '') + - 'timeunit' + - keys(rest) - .map(p => varName(`_${p}_${rest[p]}`)) - .join('') - ); - } -} diff --git a/node_modules/vega-lite/src/title.ts b/node_modules/vega-lite/src/title.ts deleted file mode 100644 index effecbd..0000000 --- a/node_modules/vega-lite/src/title.ts +++ /dev/null @@ -1,123 +0,0 @@ -import {BaseTitle, Text, TextEncodeEntry, TitleAnchor} from 'vega'; -import {isArray, isString} from 'vega-util'; -import {MarkConfig} from './mark'; -import {pick} from './util'; -import {ExcludeMappedValueRef, ExcludeMappedValueRefButKeepSignal} from './vega.schema'; - -export type BaseTitleNoValueRefs = ExcludeMappedValueRefButKeepSignal> & - // Since some logic depends on align/baseline, Vega-Lite does NOT allow signal for them. - ExcludeMappedValueRef>; - -export type TitleConfig = BaseTitleNoValueRefs; - -export interface TitleBase extends BaseTitleNoValueRefs { - /** - * The anchor position for placing the title. One of `"start"`, `"middle"`, or `"end"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title. - * - * __Default value:__ `"middle"` for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. - * `"start"` for other composite views. - * - * __Note:__ [For now](https://github.com/vega/vega-lite/issues/2875), `anchor` is only customizable only for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. For other composite views, `anchor` is always `"start"`. - */ - anchor?: TitleAnchor; - - /** - * A [mark style property](https://vega.github.io/vega-lite/docs/config.html#style) to apply to the title text mark. - * - * __Default value:__ `"group-title"`. - */ - style?: string | string[]; - - /** - * The integer z-index indicating the layering of the title group relative to other axis, mark and legend groups. - * - * __Default value:__ `0`. - * - * @TJS-type integer - * @minimum 0 - */ - zindex?: number; - - /** - * Mark definitions for custom encoding. - * - * @hidden - */ - encoding?: TextEncodeEntry; -} - -export interface TitleParams extends TitleBase { - /** - * The title text. - */ - text: Text; - - /** - * The subtitle Text. - */ - subtitle?: Text; -} - -export function extractTitleConfig( - titleConfig: TitleConfig -): { - titleMarkConfig: MarkConfig; - subtitleMarkConfig: MarkConfig; - nonMark: BaseTitleNoValueRefs; - subtitle: BaseTitleNoValueRefs; -} { - const { - // These are non-mark title config that need to be hardcoded - anchor, - frame, - offset, - orient, - - // color needs to be redirect to fill - color, - - // subtitle properties - subtitleColor, - subtitleFont, - subtitleFontSize, - subtitleFontStyle, - subtitleFontWeight, - subtitleLineHeight, - subtitlePadding, - - // The rest are mark config. - ...rest - } = titleConfig; - - const titleMarkConfig: MarkConfig = { - ...rest, - ...(color ? {fill: color} : {}) - }; - - // These are non-mark title config that need to be hardcoded - const nonMark: BaseTitleNoValueRefs = { - ...(anchor ? {anchor} : {}), - ...(frame ? {frame} : {}), - ...(offset ? {offset} : {}), - ...(orient ? {orient} : {}) - }; - - // subtitle part can stay in config.title since header titles do not use subtitle - const subtitle: BaseTitleNoValueRefs = { - ...(subtitleColor ? {subtitleColor} : {}), - ...(subtitleFont ? {subtitleFont} : {}), - ...(subtitleFontSize ? {subtitleFontSize} : {}), - ...(subtitleFontStyle ? {subtitleFontStyle} : {}), - ...(subtitleFontWeight ? {subtitleFontWeight} : {}), - ...(subtitleLineHeight ? {subtitleLineHeight} : {}), - ...(subtitlePadding ? {subtitlePadding} : {}) - }; - - const subtitleMarkConfig = pick(titleMarkConfig, ['align', 'baseline', 'dx', 'dy', 'limit']); - - return {titleMarkConfig, subtitleMarkConfig, nonMark, subtitle}; -} - -export function isText(v: any): v is Text { - return isString(v) || (isArray(v) && isString(v[0])); -} diff --git a/node_modules/vega-lite/src/transform.ts b/node_modules/vega-lite/src/transform.ts deleted file mode 100644 index 48da8d8..0000000 --- a/node_modules/vega-lite/src/transform.ts +++ /dev/null @@ -1,688 +0,0 @@ -import {AggregateOp} from 'vega'; -import {BinParams} from './bin'; -import {FieldName} from './channeldef'; -import {Data} from './data'; -import {ImputeParams} from './impute'; -import {LogicalComposition, normalizeLogicalComposition} from './logical'; -import {normalizePredicate, Predicate} from './predicate'; -import {SortField} from './sort'; -import {TimeUnit, TimeUnitParams} from './timeunit'; - -export interface FilterTransform { - /** - * The `filter` property must be a predication definition, which can takes one of the following forms: - * - * 1) an [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string, - * where `datum` can be used to refer to the current data object. - * For example, `{filter: "datum.b2 > 60"}` would make the output data includes only items that have values in the field `b2` over 60. - * - * 2) one of the [field predicates](https://vega.github.io/vega-lite/docs/predicate.html#field-predicate): - * [`equal`](https://vega.github.io/vega-lite/docs/predicate.html#field-equal-predicate), - * [`lt`](https://vega.github.io/vega-lite/docs/predicate.html#lt-predicate), - * [`lte`](https://vega.github.io/vega-lite/docs/predicate.html#lte-predicate), - * [`gt`](https://vega.github.io/vega-lite/docs/predicate.html#gt-predicate), - * [`gte`](https://vega.github.io/vega-lite/docs/predicate.html#gte-predicate), - * [`range`](https://vega.github.io/vega-lite/docs/predicate.html#range-predicate), - * [`oneOf`](https://vega.github.io/vega-lite/docs/predicate.html#one-of-predicate), - * or [`valid`](https://vega.github.io/vega-lite/docs/predicate.html#valid-predicate), - - * 3) a [selection predicate](https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate), which define the names of a selection that the data point should belong to (or a logical composition of selections). - * - * 4) a [logical composition](https://vega.github.io/vega-lite/docs/predicate.html#composition) of (1), (2), or (3). - */ - filter: LogicalComposition; -} - -export function isFilter(t: Transform): t is FilterTransform { - return 'filter' in t; -} - -export interface CalculateTransform { - /** - * A [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string. Use the variable `datum` to refer to the current data object. - */ - calculate: string; - - /** - * The field for storing the computed formula value. - */ - as: FieldName; -} - -export interface BinTransform { - /** - * An object indicating bin properties, or simply `true` for using default bin parameters. - */ - bin: true | BinParams; - - /** - * The data field to bin. - */ - field: FieldName; - - /** - * The output fields at which to write the start and end bin values. - * This can be either a string or an array of strings with two elements denoting the name for the fields for bin start and bin end respectively. - * If a single string (e.g., `"val"`) is provided, the end field will be `"val_end"`. - */ - as: FieldName | FieldName[]; -} - -export interface TimeUnitTransform { - /** - * The timeUnit. - */ - timeUnit: TimeUnit | TimeUnitParams; - - /** - * The data field to apply time unit. - */ - field: FieldName; - - /** - * The output field to write the timeUnit value. - */ - as: FieldName; -} - -export interface AggregateTransform { - /** - * Array of objects that define fields to aggregate. - */ - aggregate: AggregatedFieldDef[]; - - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; -} - -export interface AggregatedFieldDef { - /** - * The aggregation operation to apply to the fields (e.g., `"sum"`, `"average"`, or `"count"`). - * See the [full list of supported aggregation operations](https://vega.github.io/vega-lite/docs/aggregate.html#ops) - * for more information. - */ - op: AggregateOp; - - /** - * The data field for which to compute aggregate function. This is required for all aggregation operations except `"count"`. - */ - field?: FieldName; - - /** - * The output field names to use for each aggregated field. - */ - as: FieldName; -} - -export interface StackTransform { - /** - * The field which is stacked. - */ - stack: FieldName; - /** - * The data fields to group by. - */ - groupby: FieldName[]; - /** - * Mode for stacking marks. One of `"zero"` (default), `"center"`, or `"normalize"`. - * The `"zero"` offset will stack starting at `0`. The `"center"` offset will center the stacks. The `"normalize"` offset will compute percentage values for each stack point, with output values in the range `[0,1]`. - * - * __Default value:__ `"zero"` - */ - offset?: 'zero' | 'center' | 'normalize'; - /** - * Field that determines the order of leaves in the stacked charts. - */ - sort?: SortField[]; - /** - * Output field names. This can be either a string or an array of strings with two elements denoting the name for the fields for stack start and stack end respectively. - * If a single string(e.g., `"val"`) is provided, the end field will be `"val_end"`. - */ - as: FieldName | [FieldName, FieldName]; -} - -export type WindowOnlyOp = - | 'row_number' - | 'rank' - | 'dense_rank' - | 'percent_rank' - | 'cume_dist' - | 'ntile' - | 'lag' - | 'lead' - | 'first_value' - | 'last_value' - | 'nth_value'; - -export interface WindowFieldDef { - /** - * The window or aggregation operation to apply within a window (e.g., `"rank"`, `"lead"`, `"sum"`, `"average"` or `"count"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/window.html#ops). - */ - op: AggregateOp | WindowOnlyOp; - - /** - * Parameter values for the window functions. Parameter values can be omitted for operations that do not accept a parameter. - * - * See the list of all supported operations and their parameters [here](https://vega.github.io/vega-lite/docs/transforms/window.html). - */ - param?: number; - - /** - * The data field for which to compute the aggregate or window function. This can be omitted for window functions that do not operate over a field such as `"count"`, `"rank"`, `"dense_rank"`. - */ - field?: FieldName; - - /** - * The output name for the window operation. - */ - as: FieldName; -} - -export interface WindowTransform { - /** - * The definition of the fields in the window, and what calculations to use. - */ - window: WindowFieldDef[]; - - /** - * A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is `[null, 0]`, indicating that the sliding window includes the current object and all preceding objects. The value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. Finally, `[null, null]` indicates that the window frame should always include all data objects. If you this frame and want to assign the same value to add objects, you can use the simpler [join aggregate transform](https://vega.github.io/vega-lite/docs/joinaggregate.html). The only operators affected are the aggregation operations and the `first_value`, `last_value`, and `nth_value` window operations. The other window operations are not affected by this. - * - * __Default value:__: `[null, 0]` (includes the current object and all preceding objects) - */ - frame?: (null | number)[]; - - /** - * Indicates if the sliding window frame should ignore peer values (data that are considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations. - * - * __Default value:__ `false` - */ - ignorePeers?: boolean; - - /** - * The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single window. - */ - groupby?: FieldName[]; - - /** - * A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered "peer" values of equal rank. If sort is not specified, the order is undefined: data objects are processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to `true`). - */ - sort?: SortField[]; -} - -export interface JoinAggregateFieldDef { - /** - * The aggregation operation to apply (e.g., `"sum"`, `"average"` or `"count"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/aggregate.html#ops). - */ - op: AggregateOp; - - /** - * The data field for which to compute the aggregate function. This can be omitted for functions that do not operate over a field such as `"count"`. - */ - field?: FieldName; - - /** - * The output name for the join aggregate operation. - */ - as: FieldName; -} - -export interface JoinAggregateTransform { - /** - * The definition of the fields in the join aggregate, and what calculations to use. - */ - joinaggregate: JoinAggregateFieldDef[]; - - /** - * The data fields for partitioning the data objects into separate groups. If unspecified, all data points will be in a single group. - */ - groupby?: FieldName[]; -} - -export interface ImputeSequence { - /** - * The starting value of the sequence. - * __Default value:__ `0` - */ - start?: number; - /** - * The ending value(exclusive) of the sequence. - */ - stop: number; - /** - * The step value between sequence entries. - * __Default value:__ `1` or `-1` if `stop < start` - */ - step?: number; -} - -export function isImputeSequence(t: ImputeSequence | any[] | undefined): t is ImputeSequence { - return t?.['stop'] !== undefined; -} - -export interface ImputeTransform extends ImputeParams { - /** - * The data field for which the missing values should be imputed. - */ - impute: FieldName; - - /** - * A key field that uniquely identifies data objects within a group. - * Missing key values (those occurring in the data but not in the current group) will be imputed. - */ - key: FieldName; - - /** - * An optional array of fields by which to group the values. - * Imputation will then be performed on a per-group basis. - */ - groupby?: FieldName[]; -} - -export interface FlattenTransform { - /** - * An array of one or more data fields containing arrays to flatten. - * If multiple fields are specified, their array values should have a parallel structure, ideally with the same length. - * If the lengths of parallel arrays do not match, - * the longest array will be used with `null` values added for missing entries. - */ - flatten: FieldName[]; - - /** - * The output field names for extracted array values. - * - * __Default value:__ The field name of the corresponding array field - */ - as?: FieldName[]; -} - -export interface SampleTransform { - /** - * The maximum number of data objects to include in the sample. - * - * __Default value:__ `1000` - */ - sample: number; -} - -export interface LookupBase { - /** - * Key in data to lookup. - */ - key: FieldName; - /** - * Fields in foreign data or selection to lookup. - * If not specified, the entire object is queried. - */ - fields?: FieldName[]; -} - -export interface LookupData extends LookupBase { - /** - * Secondary data source to lookup in. - */ - data: Data; -} - -export interface LookupSelection extends LookupBase { - /** - * Selection name to look up. - */ - selection: string; -} - -export interface LookupTransform { - /** - * Key in primary data source. - */ - lookup: string; - - /** - * The output fields on which to store the looked up data values. - * - * For data lookups, this property may be left blank if `from.fields` - * has been specified (those field names will be used); if `from.fields` - * has not been specified, `as` must be a string. - * - * For selection lookups, this property is optional: if unspecified, - * looked up values will be stored under a property named for the selection; - * and if specified, it must correspond to `from.fields`. - */ - as?: FieldName | FieldName[]; - - /** - * The default value to use if lookup fails. - * - * __Default value:__ `null` - */ - default?: string; - - /** - * Data source or selection for secondary data reference. - */ - from: LookupData | LookupSelection; -} - -export function isLookup(t: Transform): t is LookupTransform { - return 'lookup' in t; -} - -export function isLookupData(from: LookupData | LookupSelection): from is LookupData { - return 'data' in from; -} - -export function isLookupSelection(from: LookupData | LookupSelection): from is LookupData { - return 'selection' in from; -} - -export interface FoldTransform { - /** - * An array of data fields indicating the properties to fold. - */ - fold: FieldName[]; - - /** - * The output field names for the key and value properties produced by the fold transform. - * __Default value:__ `["key", "value"]` - */ - as?: [FieldName, FieldName]; -} - -export interface PivotTransform { - /** - * The data field to pivot on. The unique values of this field become new field names in the output stream. - */ - pivot: FieldName; - - /** - * The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields. - */ - value: FieldName; - - /** - * The optional data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - - /** - * An optional parameter indicating the maximum number of pivoted fields to generate. - * The default (`0`) applies no limit. The pivoted `pivot` names are sorted in ascending order prior to enforcing the limit. - * __Default value:__ `0` - */ - limit?: number; - - /** - * The aggregation operation to apply to grouped `value` field values. - * __Default value:__ `sum` - */ - op?: string; -} - -export function isPivot(t: Transform): t is PivotTransform { - return 'pivot' in t; -} - -export interface DensityTransform { - /** - * The data field for which to perform density estimation. - */ - density: FieldName; - - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - - /** - * A boolean flag indicating whether to produce density estimates (false) or cumulative density estimates (true). - * - * __Default value:__ `false` - */ - cumulative?: boolean; - - /** - * A boolean flag indicating if the output values should be probability estimates (false) or smoothed counts (true). - * - * __Default value:__ `false` - */ - counts?: boolean; - - /** - * The bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott’s rule. - */ - bandwidth?: number; - - /** - * A [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field. - */ - extent?: [number, number]; - - /** - * The minimum number of samples to take along the extent domain for plotting the density. - * - * __Default value:__ `25` - */ - minsteps?: number; - - /** - * The maximum number of samples to take along the extent domain for plotting the density. - * - * __Default value:__ `200` - */ - maxsteps?: number; - - /** - * The exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities. - */ - steps?: number; - - /** - * The output fields for the sample value and corresponding density estimate. - * - * __Default value:__ `["value", "density"]` - */ - as?: [FieldName, FieldName]; -} - -export function isDensity(t: Transform): t is DensityTransform { - return 'density' in t; -} - -export interface QuantileTransform { - /** - * The data field for which to perform quantile estimation. - */ - quantile: FieldName; - - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - - /** - * An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the *step* parameter will be used. - */ - probs?: number[]; - - /** - * A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the *probs* parameter is not provided. - */ - step?: number; - - /** - * The output field names for the probability and quantile values. - * - * __Default value:__ `["prob", "value"]` - */ - as?: [FieldName, FieldName]; -} - -export function isQuantile(t: Transform): t is QuantileTransform { - return 'quantile' in t; -} - -export interface RegressionTransform { - /** - * The data field of the dependent variable to predict. - */ - regression: FieldName; - - /** - * The data field of the independent variable to use a predictor. - */ - on: FieldName; - - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - - /** - * The functional form of the regression model. One of `"linear"`, `"log"`, `"exp"`, `"pow"`, `"quad"`, or `"poly"`. - * - * __Default value:__ `"linear"` - */ - method?: 'linear' | 'log' | 'exp' | 'pow' | 'quad' | 'poly'; - - /** - * The polynomial order (number of coefficients) for the 'poly' method. - * - * __Default value:__ `3` - */ - order?: number; - - /** - * A [min, max] domain over the independent (x) field for the starting and ending points of the generated trend line. - */ - extent?: [number, number]; - - /** - * A boolean flag indicating if the transform should return the regression model parameters (one object per group), rather than trend line points. - * The resulting objects include a `coef` array of fitted coefficient values (starting with the intercept term and then including terms of increasing order) - * and an `rSquared` value (indicating the total variance explained by the model). - * - * __Default value:__ `false` - */ - params?: boolean; - - /** - * The output field names for the smoothed points generated by the regression transform. - * - * __Default value:__ The field names of the input x and y values. - */ - as?: [FieldName, FieldName]; -} - -export function isRegression(t: Transform): t is RegressionTransform { - return 'regression' in t; -} - -export interface LoessTransform { - /** - * The data field of the dependent variable to smooth. - */ - loess: FieldName; - - /** - * The data field of the independent variable to use a predictor. - */ - on: FieldName; - - /** - * The data fields to group by. If not specified, a single group containing all data objects will be used. - */ - groupby?: FieldName[]; - - /** - * A bandwidth parameter in the range `[0, 1]` that determines the amount of smoothing. - * - * __Default value:__ `0.3` - */ - bandwidth?: number; - - /** - * The output field names for the smoothed points generated by the loess transform. - * - * __Default value:__ The field names of the input x and y values. - */ - as?: [FieldName, FieldName]; -} - -export function isLoess(t: Transform): t is LoessTransform { - return 'loess' in t; -} - -export function isSample(t: Transform): t is SampleTransform { - return 'sample' in t; -} - -export function isWindow(t: Transform): t is WindowTransform { - return 'window' in t; -} - -export function isJoinAggregate(t: Transform): t is JoinAggregateTransform { - return 'joinaggregate' in t; -} - -export function isFlatten(t: Transform): t is FlattenTransform { - return 'flatten' in t; -} -export function isCalculate(t: Transform): t is CalculateTransform { - return 'calculate' in t; -} - -export function isBin(t: Transform): t is BinTransform { - return 'bin' in t; -} - -export function isImpute(t: Transform): t is ImputeTransform { - return 'impute' in t; -} - -export function isTimeUnit(t: Transform): t is TimeUnitTransform { - return 'timeUnit' in t; -} - -export function isAggregate(t: Transform): t is AggregateTransform { - return 'aggregate' in t; -} - -export function isStack(t: Transform): t is StackTransform { - return 'stack' in t; -} - -export function isFold(t: Transform): t is FoldTransform { - return 'fold' in t; -} - -export type Transform = - | AggregateTransform - | BinTransform - | CalculateTransform - | DensityTransform - | FilterTransform - | FlattenTransform - | FoldTransform - | ImputeTransform - | JoinAggregateTransform - | LoessTransform - | LookupTransform - | QuantileTransform - | RegressionTransform - | TimeUnitTransform - | SampleTransform - | StackTransform - | WindowTransform - | PivotTransform; - -export function normalizeTransform(transform: Transform[]) { - return transform.map(t => { - if (isFilter(t)) { - return { - filter: normalizeLogicalComposition(t.filter, normalizePredicate) - }; - } - return t; - }); -} diff --git a/node_modules/vega-lite/src/tsconfig.src.json b/node_modules/vega-lite/src/tsconfig.src.json deleted file mode 100644 index c9ebabe..0000000 --- a/node_modules/vega-lite/src/tsconfig.src.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "composite": true, - "outDir": "../build", - "rootDir": ".." - }, - "files": ["index.ts"], - "include": ["**/*", "../package.json"] -} diff --git a/node_modules/vega-lite/src/type.ts b/node_modules/vega-lite/src/type.ts deleted file mode 100644 index 8e041df..0000000 --- a/node_modules/vega-lite/src/type.ts +++ /dev/null @@ -1,58 +0,0 @@ -import {keys} from './util'; - -/** - * Data type based on level of measurement - */ -export const Type = { - quantitative: 'quantitative', - ordinal: 'ordinal', - temporal: 'temporal', - nominal: 'nominal', - geojson: 'geojson' -} as const; - -export type Type = keyof typeof Type; - -export function isType(t: any): t is Type { - return t in Type; -} - -export const QUANTITATIVE = Type.quantitative; -export const ORDINAL = Type.ordinal; -export const TEMPORAL = Type.temporal; -export const NOMINAL = Type.nominal; - -export const GEOJSON = Type.geojson; - -export type StandardType = 'quantitative' | 'ordinal' | 'temporal' | 'nominal'; - -export const TYPES = keys(Type); - -/** - * Get full, lowercase type name for a given type. - * @param type - * @return Full type name. - */ -export function getFullName(type: Type | string): Type | undefined { - if (type) { - type = type.toLowerCase(); - switch (type) { - case 'q': - case QUANTITATIVE: - return 'quantitative'; - case 't': - case TEMPORAL: - return 'temporal'; - case 'o': - case ORDINAL: - return 'ordinal'; - case 'n': - case NOMINAL: - return 'nominal'; - case GEOJSON: - return 'geojson'; - } - } - // If we get invalid input, return undefined type. - return undefined; -} diff --git a/node_modules/vega-lite/src/util.ts b/node_modules/vega-lite/src/util.ts deleted file mode 100644 index f7d7ab9..0000000 --- a/node_modules/vega-lite/src/util.ts +++ /dev/null @@ -1,410 +0,0 @@ -import 'array-flat-polyfill'; -import {default as clone_} from 'clone'; -import deepEqual_ from 'fast-deep-equal'; -import stableStringify from 'fast-json-stable-stringify'; -import {hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig} from 'vega-util'; -import {isLogicalAnd, isLogicalNot, isLogicalOr, LogicalComposition} from './logical'; - -export const deepEqual = deepEqual_; -export const duplicate = clone_; - -/** - * Creates an object composed of the picked object properties. - * - * var object = {'a': 1, 'b': '2', 'c': 3}; - * pick(object, ['a', 'c']); - * // → {'a': 1, 'c': 3} - */ -// eslint-disable-next-line @typescript-eslint/ban-types -export function pick(obj: T, props: readonly K[]): Pick { - const copy: any = {}; - for (const prop of props) { - if (hasOwnProperty(obj, prop)) { - copy[prop] = obj[prop]; - } - } - return copy; -} - -/** - * The opposite of _.pick; this method creates an object composed of the own - * and inherited enumerable string keyed properties of object that are not omitted. - */ -// eslint-disable-next-line @typescript-eslint/ban-types -export function omit(obj: T, props: readonly K[]): Omit { - const copy = {...(obj as any)}; - for (const prop of props) { - delete copy[prop]; - } - return copy; -} - -/** - * Monkey patch Set so that `stringify` produces a string representation of sets. - */ -Set.prototype['toJSON'] = function () { - return `Set(${[...this].map(x => stableStringify(x)).join(',')})`; -}; - -/** - * Converts any object to a string representation that can be consumed by humans. - */ -export const stringify = stableStringify; - -/** - * Converts any object to a string of limited size, or a number. - */ -export function hash(a: any): string | number { - if (isNumber(a)) { - return a; - } - - const str = isString(a) ? a : stableStringify(a); - - // short strings can be used as hash directly, longer strings are hashed to reduce memory usage - if (str.length < 250) { - return str; - } - - // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ - let h = 0; - for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - h = (h << 5) - h + char; - h = h & h; // Convert to 32bit integer - } - return h; -} - -export function isNullOrFalse(x: any): x is false | null { - return x === false || x === null; -} - -export function contains(array: readonly T[], item: T) { - return array.indexOf(item) > -1; -} - -/** - * Returns true if any item returns true. - */ -export function some(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) { - let i = 0; - for (const [k, a] of arr.entries()) { - if (f(a, k, i++)) { - return true; - } - } - return false; -} - -/** - * Returns true if all items return true. - */ -export function every(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) { - let i = 0; - for (const [k, a] of arr.entries()) { - if (!f(a, k, i++)) { - return false; - } - } - return true; -} - -/** - * Like TS Partial but applies recursively to all properties. - */ -export type DeepPartial = {[P in keyof T]?: DeepPartial}; - -/** - * recursively merges src into dest - */ -export function mergeDeep(dest: T, ...src: readonly DeepPartial[]): T { - for (const s of src) { - deepMerge_(dest, s ?? {}); - } - return dest; -} - -function deepMerge_(dest: any, src: any) { - for (const property of keys(src)) { - writeConfig(dest, property, src[property], true); - } -} - -export function unique(values: readonly T[], f: (item: T) => string | number): T[] { - const results: T[] = []; - const u = {}; - let v: string | number; - for (const val of values) { - v = f(val); - if (v in u) { - continue; - } - u[v] = 1; - results.push(val); - } - return results; -} - -export type Dict = Record; - -/** - * Returns true if the two dictionaries disagree. Applies only to defined values. - */ -export function isEqual(dict: Dict, other: Dict) { - const dictKeys = keys(dict); - const otherKeys = keys(other); - if (dictKeys.length !== otherKeys.length) { - return false; - } - for (const key of dictKeys) { - if (dict[key] !== other[key]) { - return false; - } - } - return true; -} - -export function setEqual(a: Set, b: Set) { - if (a.size !== b.size) { - return false; - } - for (const e of a) { - if (!b.has(e)) { - return false; - } - } - return true; -} - -export function hasIntersection(a: ReadonlySet, b: ReadonlySet) { - for (const key of a) { - if (b.has(key)) { - return true; - } - } - return false; -} - -export function prefixGenerator(a: ReadonlySet): ReadonlySet { - const prefixes = new Set(); - for (const x of a) { - const splitField = splitAccessPath(x); - // Wrap every element other than the first in `[]` - const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`)); - const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join('')); - for (const y of computedPrefixes) { - prefixes.add(y); - } - } - return prefixes; -} - -/** - * Returns true if a and b have an intersection. Also return true if a or b are undefined - * since this means we don't know what fields a node produces or depends on. - */ -export function fieldIntersection(a: ReadonlySet, b: ReadonlySet): boolean { - if (a === undefined || b === undefined) { - return true; - } - return hasIntersection(prefixGenerator(a), prefixGenerator(b)); -} - -// eslint-disable-next-line @typescript-eslint/ban-types -export function isEmpty(obj: object) { - return keys(obj).length === 0; -} - -// This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 -export const keys = Object.keys as (o: T) => Extract[]; - -export const vals = Object.values; - -export function entries(x: {[key: string]: T}): {key: string; value: T}[] { - const _entries: {key: string; value: T}[] = []; - for (const k in x) { - if (hasOwnProperty(x, k)) { - _entries.push({ - key: k, - value: x[k] - }); - } - } - return _entries; -} - -// Using mapped type to declare a collect of flags for a string literal type S -// https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types -export type Flag = {[K in S]: 1}; - -export function isBoolean(b: any): b is boolean { - return b === true || b === false; -} - -/** - * Convert a string into a valid variable name - */ -export function varName(s: string): string { - // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _ - const alphanumericS = s.replace(/\W/g, '_'); - - // Add _ if the string has leading numbers. - return (s.match(/^\d+/) ? '_' : '') + alphanumericS; -} - -export function logicalExpr(op: LogicalComposition, cb: (...args: readonly any[]) => string): string { - if (isLogicalNot(op)) { - return '!(' + logicalExpr(op.not, cb) + ')'; - } else if (isLogicalAnd(op)) { - return '(' + op.and.map((and: LogicalComposition) => logicalExpr(and, cb)).join(') && (') + ')'; - } else if (isLogicalOr(op)) { - return '(' + op.or.map((or: LogicalComposition) => logicalExpr(or, cb)).join(') || (') + ')'; - } else { - return cb(op); - } -} - -/** - * Delete nested property of an object, and delete the ancestors of the property if they become empty. - */ -export function deleteNestedProperty(obj: any, orderedProps: string[]) { - if (orderedProps.length === 0) { - return true; - } - const prop = orderedProps.shift()!; // eslint-disable-line @typescript-eslint/no-non-null-assertion - if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) { - delete obj[prop]; - } - return isEmpty(obj); -} - -export function titleCase(s: string) { - return s.charAt(0).toUpperCase() + s.substr(1); -} - -/** - * Converts a path to an access path with datum. - * @param path The field name. - * @param datum The string to use for `datum`. - */ -export function accessPathWithDatum(path: string, datum = 'datum') { - const pieces = splitAccessPath(path); - const prefixes = []; - for (let i = 1; i <= pieces.length; i++) { - const prefix = `[${pieces.slice(0, i).map(stringValue).join('][')}]`; - prefixes.push(`${datum}${prefix}`); - } - return prefixes.join(' && '); -} - -/** - * Return access with datum to the flattened field. - * - * @param path The field name. - * @param datum The string to use for `datum`. - */ -export function flatAccessWithDatum(path: string, datum: 'datum' | 'parent' | 'datum.datum' = 'datum') { - return `${datum}[${stringValue(splitAccessPath(path).join('.'))}]`; -} - -function escapePathAccess(string: string) { - return string.replace(/(\[|\]|\.|'|")/g, '\\$1'); -} - -/** - * Replaces path accesses with access to non-nested field. - * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`. - */ -export function replacePathInField(path: string) { - return `${splitAccessPath(path).map(escapePathAccess).join('\\.')}`; -} - -/** - * Replace all occurrences of a string with another string. - * - * @param string the string to replace in - * @param find the string to replace - * @param replacement the replacement - */ -export function replaceAll(string: string, find: string, replacement: string) { - return string.replace(new RegExp(find.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replacement); -} - -/** - * Remove path accesses with access from field. - * For example, `foo["bar"].baz` becomes `foo.bar.baz`. - */ -export function removePathFromField(path: string) { - return `${splitAccessPath(path).join('.')}`; -} - -/** - * Count the depth of the path. Returns 1 for fields that are not nested. - */ -export function accessPathDepth(path: string) { - if (!path) { - return 0; - } - return splitAccessPath(path).length; -} - -/** - * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included. - */ -export function getFirstDefined(...args: readonly T[]): T | undefined { - for (const arg of args) { - if (arg !== undefined) { - return arg; - } - } - return undefined; -} - -// variable used to generate id -let idCounter = 42; - -/** - * Returns a new random id every time it gets called. - * - * Has side effect! - */ -export function uniqueId(prefix?: string) { - const id = ++idCounter; - return prefix ? String(prefix) + id : id; -} - -/** - * Resets the id counter used in uniqueId. This can be useful for testing. - */ -export function resetIdCounter() { - idCounter = 42; -} - -export function internalField(name: string) { - return isInternalField(name) ? name : `__${name}`; -} - -export function isInternalField(name: string) { - return name.indexOf('__') === 0; -} - -/** - * Normalize angle to be within [0,360). - */ -export function normalizeAngle(angle: number) { - if (angle === undefined) { - return undefined; - } - return ((angle % 360) + 360) % 360; -} - -/** - * Returns whether the passed in value is a valid number. - */ -export function isNumeric(value: number | string): boolean { - if (isNumber(value)) { - return true; - } - return !isNaN(value as any) && !isNaN(parseFloat(value)); -} diff --git a/node_modules/vega-lite/src/vega.schema.ts b/node_modules/vega-lite/src/vega.schema.ts deleted file mode 100644 index e64a78c..0000000 --- a/node_modules/vega-lite/src/vega.schema.ts +++ /dev/null @@ -1,393 +0,0 @@ -import { - AggregateOp, - BandScale, - BaseScale, - BinOrdinalScale, - ColorValueRef, - Compare as VgCompare, - ExprRef as VgExprRef, - GeoShapeTransform as VgGeoShapeTransform, - IdentityScale, - LayoutAlign, - LinearScale, - LogScale, - MarkConfig, - NumericValueRef, - OrdinalScale, - PointScale, - PowScale, - ProjectionType, - QuantileScale, - QuantizeScale, - RangeBand, - RangeRaw, - RangeScheme, - ScaleData, - ScaleDataRef, - ScaledValueRef, - ScaleMultiDataRef, - ScaleMultiFieldsRef, - SequentialScale, - SignalRef, - SortField as VgSortField, - SqrtScale, - SymLogScale, - ThresholdScale, - TimeInterval, - TimeIntervalStep, - TimeScale, - Title as VgTitle, - Transforms as VgTransform, - UnionSortField as VgUnionSortField, - Mark -} from 'vega'; -import {isArray} from 'vega-util'; -import {Value} from './channeldef'; -import {SortOrder} from './sort'; -import {Flag, keys, Dict} from './util'; - -export {VgSortField, VgUnionSortField, VgCompare, VgTitle, LayoutAlign, ProjectionType, VgExprRef}; - -// TODO: make recursive -type ExcludeMapped = { - [P in keyof T]: Exclude; -}; - -type ExcludeMappedButKeepSignals = { - [P in keyof T]: SignalRef extends T[P] ? Exclude | SignalRef : Exclude; -}; - -// Remove ValueRefs from mapped types -export type ExcludeMappedValueRef = ExcludeMapped | NumericValueRef | ColorValueRef>; - -export type ExcludeMappedValueRefButKeepSignal = ExcludeMappedButKeepSignals< - T, - ScaledValueRef | NumericValueRef | ColorValueRef ->; - -export interface VgData { - name: string; - source?: string; - values?: any; - format?: { - type?: string; - parse?: string | Dict; - property?: string; - feature?: string; - mesh?: string; - }; - url?: string; - transform?: VgTransform[]; -} - -export type VgScaleDataRefWithSort = ScaleDataRef & { - sort?: VgSortField; -}; - -export function isSignalRef(o: any): o is SignalRef { - return o && !!o['signal']; -} - -// TODO: add type of value (Make it VgValueRef {value?:V ...}) -export interface VgValueRef { - value?: Value | number[]; - field?: - | string - | { - datum?: string; - group?: string; - parent?: string; - }; - signal?: string; - scale?: string; // TODO: object - mult?: number; - offset?: number | VgValueRef; - band?: boolean | number | VgValueRef; - test?: string; -} - -// TODO: add vg prefix -export type VgScaleMultiDataRefWithSort = ScaleMultiDataRef & { - fields: (any[] | VgScaleDataRefWithSort | SignalRef)[]; - sort?: VgUnionSortField; -}; - -export type VgMultiFieldsRefWithSort = ScaleMultiFieldsRef & { - sort?: VgUnionSortField; -}; - -export type VgRange = RangeScheme | ScaleData | RangeBand | RangeRaw; - -export function isVgRangeStep(range: VgRange): range is VgRangeStep { - return !!range['step']; -} - -export interface VgRangeStep { - step: number | SignalRef; -} -// Domains that are not a union of domains -export type VgNonUnionDomain = (null | string | number | boolean | SignalRef)[] | VgScaleDataRefWithSort | SignalRef; - -export type VgDomain = BaseScale['domain']; - -export type VgMarkGroup = any; - -/** - * A combined type for any Vega scales that Vega-Lite can generate - */ -export type VgScale = Pick & { - range?: RangeScheme | RangeBand | ScaleData; // different Vega scales have conflicting range, need to union them here - nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef; // different Vega scales have conflicting range, need to union them here - zero?: boolean | SignalRef; // LogScale only allow false, making the intersection type overly strict -} & Omit< - // Continuous - Omit & - Omit & - Omit & - Omit, 'type'> & // use partial so exponent is not required - Omit & - Omit & - Omit & - // Discretizing - Omit & - Omit & - Omit & - Omit & - // Sequential - Omit & - // Discrete - Omit & - Omit & - Omit, - 'range' | 'nice' | 'zero' - >; - -export interface RowCol { - row?: T; - column?: T; -} - -export interface VgLayout { - center?: boolean | RowCol; - padding?: number | RowCol; - headerBand?: number | RowCol; - footerBand?: number | RowCol; - - titleAnchor?: 'start' | 'end' | RowCol<'start' | 'end'>; - offset?: - | number - | { - rowHeader?: number; - rowFooter?: number; - rowTitle?: number; - columnHeader?: number; - columnFooter?: number; - columnTitle?: number; - }; - bounds?: 'full' | 'flush'; - columns?: number | {signal: string}; - align?: LayoutAlign | RowCol; -} - -export function isDataRefUnionedDomain(domain: VgDomain): domain is VgScaleMultiDataRefWithSort { - if (!isArray(domain)) { - return 'fields' in domain && !('data' in domain); - } - return false; -} - -export function isFieldRefUnionDomain(domain: VgDomain): domain is VgMultiFieldsRefWithSort { - if (!isArray(domain)) { - return 'fields' in domain && 'data' in domain; - } - return false; -} - -export function isDataRefDomain(domain: VgDomain | any): domain is VgScaleDataRefWithSort { - if (!isArray(domain)) { - return 'field' in domain && 'data' in domain; - } - return false; -} - -export type VgEncodeChannel = - | 'x' - | 'x2' - | 'xc' - | 'width' - | 'y' - | 'y2' - | 'yc' - | 'height' - | 'opacity' - | 'fill' - | 'fillOpacity' - | 'stroke' - | 'strokeWidth' - | 'strokeCap' - | 'strokeOpacity' - | 'strokeDash' - | 'strokeDashOffset' - | 'strokeMiterLimit' - | 'strokeJoin' - | 'strokeOffset' - | 'strokeForeground' - | 'cursor' - | 'clip' - | 'size' - | 'shape' - | 'path' - | 'innerRadius' - | 'outerRadius' - | 'startAngle' - | 'endAngle' - | 'interpolate' - | 'tension' - | 'orient' - | 'url' - | 'align' - | 'baseline' - | 'text' - | 'dir' - | 'ellipsis' - | 'limit' - | 'dx' - | 'dy' - | 'radius' - | 'theta' - | 'angle' - | 'font' - | 'fontSize' - | 'fontWeight' - | 'fontStyle' - | 'tooltip' - | 'href' - | 'cursor' - | 'defined' - | 'cornerRadius' - | 'cornerRadiusTopLeft' - | 'cornerRadiusTopRight' - | 'cornerRadiusBottomRight' - | 'cornerRadiusBottomLeft' - | 'scaleX' - | 'scaleY'; - -export type VgEncodeEntry = Partial>; - -// TODO: make export interface VgEncodeEntry { -// x?: VgValueRef -// y?: VgValueRef -// ... -// color?: VgValueRef -// ... -// } - -export type VgPostEncodingTransform = VgGeoShapeTransform; - -const VG_MARK_CONFIG_INDEX: Flag = { - aria: 1, - description: 1, - ariaRole: 1, - ariaRoleDescription: 1, - blend: 1, - opacity: 1, - fill: 1, - fillOpacity: 1, - stroke: 1, - strokeCap: 1, - strokeWidth: 1, - strokeOpacity: 1, - strokeDash: 1, - strokeDashOffset: 1, - strokeJoin: 1, - strokeOffset: 1, - strokeMiterLimit: 1, - startAngle: 1, - endAngle: 1, - padAngle: 1, - innerRadius: 1, - outerRadius: 1, - size: 1, - shape: 1, - interpolate: 1, - tension: 1, - orient: 1, - align: 1, - baseline: 1, - text: 1, - dir: 1, - dx: 1, - dy: 1, - ellipsis: 1, - limit: 1, - radius: 1, - theta: 1, - angle: 1, - font: 1, - fontSize: 1, - fontWeight: 1, - fontStyle: 1, - lineBreak: 1, - lineHeight: 1, - cursor: 1, - href: 1, - tooltip: 1, - cornerRadius: 1, - cornerRadiusTopLeft: 1, - cornerRadiusTopRight: 1, - cornerRadiusBottomLeft: 1, - cornerRadiusBottomRight: 1, - aspect: 1, - width: 1, - height: 1 - - // commented below are vg channel that do not have mark config. - // x: 1, - // y: 1, - // x2: 1, - // y2: 1, - - // xc'|'yc' - // clip: 1, - // path: 1, - // url: 1, -}; - -export const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX); - -export const VG_MARK_INDEX: Flag = { - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 -}; - -// Vega's cornerRadius channels. -export const VG_CORNERRADIUS_CHANNELS = [ - 'cornerRadius', - 'cornerRadiusTopLeft', - 'cornerRadiusTopRight', - 'cornerRadiusBottomLeft', - 'cornerRadiusBottomRight' -] as const; - -export interface VgComparator { - field?: string | string[]; - order?: SortOrder | SortOrder[]; -} - -export interface VgJoinAggregateTransform { - type: 'joinaggregate'; - as?: string[]; - ops?: AggregateOp[]; - fields?: string[]; - groupby?: string[]; -} diff --git a/node_modules/vega-loader/LICENSE b/node_modules/vega-loader/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-loader/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-loader/README.md b/node_modules/vega-loader/README.md deleted file mode 100644 index 53783e3..0000000 --- a/node_modules/vega-loader/README.md +++ /dev/null @@ -1,153 +0,0 @@ -# vega-loader - -Network request and file loading utilities. - -## API Reference - -* [File Loading](#file-loading) -* [Data Format Parsing](#data-format-parsing) - -### File Loading - -# -vega.loader([options]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/loader.js "Source") - -Creates a new loader instance with default *options*. A loader object provides methods for loading files from the network or disk, and for sanitizing requested URLs and filenames. If provided, the key-value pairs in the *options* object will be passed as default options to the various loader methods. - -The *options* object can include the following entries: - -- *baseURL*: A base URL prefix to append to provided *uri* values. This can -be useful for applications that load multiple data sets from the same domain. -- *mode*: A string explicitly indicating the loading mode. One of `'file'` (server-side only) or `'http'`. If set to `'file'` mode, later *uri* parameters may safely omit a `'file://'` prefix. -- *defaultProtocol*: The default protocol to use for protocol-relative *uri* values (e.g., `'//vega.github.io'`). Defaults to `'http'`. -- *target*: The browser `target` attribute for hyperlinks. Only applies when sanitizing *uri* values for use as a hyperlink. -- *rel*: The browser `rel` attribute for hyperlinks. Only applies when sanitizing *uri* values for use as a hyperlink. -- *http*: HTTP request parameters passed to underlying calls to [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed properties. -- *crossOrigin*: Specifies the [`crossOrigin` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image) to apply to an Image. Only applies when [sanitize](#load_sanitize) is invoked with the option `"context": "image"`. If this property is defined and maps to a value of `null` or `undefined`, then a `no-cors` fetch will be performed for the Image. This property can be used to override Vega's default behavior of using `crossOrigin="anonymous"`, which allows images loaded from a different host to be included in exported visualization images (and thereby avoid "tainted canvas errors"), so long as the server provides permission via proper CORS headers. - -# -loader.load(uri[, options]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/loader.js "Source") - -Loads a file from either the network or disk, and returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for asyncronously accessing the loaded content. This method does not perform any parsing, it simply returns the loaded data as either a Buffer or String instance, depending on the execution environment. To subsequently parse loaded data, use the [read](#read) method. - -The *uri* argument is a value indicating the file to load. This is typically either an absolute or relative URL string. If running server-side via node.js, this argument might also be a file path (e.g., `'file:///path/to/file.txt'`). - -If provided, the *options* argument will be combined with any default options passed to the [loader](#loader) constructor. In the case of identical property names, values from the *options* argument for this method will be used. - -```js -var loader = vega.loader(); -loader.load('data.json').then(function(data) { - // do something with loaded data -}).catch(function(error) { - // error handling here -}); -``` - -# -loader.sanitize(uri, options) -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/loader.js "Source") - -URI sanitizer function, which takes a *uri* and *options* object as input, and returns a Promise that resolves to a return object that includes a sanitized URL under the *href* property. This method is used internally by [load](#load) to ensure the URL is valid and to add additional protocol and hostname information, if needed. This method accepts the same *options* object accepted by [load](#load) and returns a Promise. If sanitization is successful, the Promise resolves to a return object containing the URL string as (_href_), along with a non-enumerable boolean _localFile_ flag, indicating if the file should be loaded from the local filesystem. The Promise rejects if the *uri* is invalid or disallowed. This method is over-writable for clients who wish to implement custom sanitization. - -If provided, the *options* argument will be combined with any default options passed to the [loader](#loader) constructor. In the case of identical property names, values from the *options* argument for this method will be used. - -# -loader.http(url, options) -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/loader.js "Source") - -Function used internally by [load](#load) for servicing HTTP requests. Uses [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) by default. Clients may overwrite this method to perform custom HTTP request handling. - -If provided, the *options* argument may include any valid fetch [RequestInit](https://fetch.spec.whatwg.org/#requestinit) properties. The provided *options* will be combined with any default options passed to the [loader](#loader) constructor under the *http* property. In the case of identical property names, values from the *options* argument for this method will be used. - -# -loader.file(filename) -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/loader.js "Source") - -Function used internally by [load](#load) for local file system requests. This method is over-writable for clients who wish to implement custom file loading. Uses the node.js [fs](https://nodejs.org/api/fs.html) module by default. - -### Data Format Parsing - -# -vega.read(data, schema[, dateParse]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/read.js "Source") - -Parse loaded *data* according to a given format *schema*. The *data* argument should be either a String or Buffer instance, typically the result of calling [load](#load). - -The *schema* object contents may depend on the data format (see below). Common options include: - -- *type*: The data format type, such as `json`, `csv`, `tsv`, or `topojson`. -- *property*: For JSON types, specifies a property of the loaded JSON to reference. This is useful if a loaded JSON file contains multiple data sets and one would like to parse data under a specific property. -- *parse*: When set to `'auto'`, the method will perform type inference (using the [inferTypes](#inferTypes) method) to determine data types of each field. Alternatively, callers can specify parsing rules by providing an object mapping field names to data types (for example: `{'timestamp': 'date', 'price': 'number'}`). The valid data type options are `'boolean'`, `'integer'`, `'number'`, `'date'`, and `'string'`. - -The `'date'` data type also accepts an optional format string (`'date:format'`). If provided, the optional *dateParse* function is used to generate date-time parsers for a date format string. If *dateParse* is unspecified, the [d3-time-format](https://github.com/d3/d3-time-format) library is used by default. Date-time format strings may be quoted (`date:'%A'`), but quoting is not required. In addition, parsing of date-time format strings to UTC time is supported (`'utc:format'`). - -```js -// read loaded csv data, automatically infer value types -var data = null; -loader.load('data/stocks.csv').then(function(data) { - data = vega.read(csv_data, {type: 'csv', parse: 'auto'}); -}); -``` - -```js -// read loaded csv data, using provided value types -var data = null; -loader.load('data/stocks.csv').then(function(data) { - data = vega.read(data, { - type: 'csv', - parse: {'date': 'date', 'price': 'number'} - }); -}); -``` - -```js -// read loaded topojson data, extract mesh of countries -var topojson = null; -loader.load('data/world-110m.json').then(function(data) { - topojson = vega.read(data, {type: 'topojson', mesh: 'countries'}); -}); -``` - -# -vega.inferType(values[, field]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/type.js "Source") - -Given an array of *values*, infers their data type as one of `'boolean'`, `'integer'`, `'number'`, `'date'`, or `'string'`. An optional *field* accessor can be used to first extract values from the input array, and is equivalent to first calling `values.map(field)`. - -# -vega.inferTypes(data, fields) -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/type.js "Source") - -Given an array of *data* objects and a list of string-typed field names (*fields*), infers the data type for each field. Returns an object that maps field names to inferred types, determined using the [inferType](#inferType) method. - -# -vega.typeParsers -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/type.js "Source") - -An object containing a set of parsing functions for converting input values to a specified data type. All parsing functions return `null` if the input is `null`, `undefined` or the empty string (`''`). - -The supported functions are: - -- typeParsers.boolean(value): Parse the input *value* to a Boolean. -- typeParsers.integer(value): Parse the input *value* to an integer Number. -- typeParsers.number(value): Parse the input *value* to a Number. -- typeParsers.date(value[, parser]): Parse the input *value* to a Date. If provided, the *parser* function is used to interpret the *value*; otherwise `Date.parse` is used. -- typeParsers.string(value): Parse the input *value* to a String. If *value* is not already string-typed, it is coerced to a String. - -# -vega.formats(name[, format]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-loader/src/formats/index.js "Source") - -Registry function for data format parsers. If invoked with two arguments, adds a new *format* parser with the provided *name*. Otherwise, returns an existing parser with the given *name*. The method signature of a format parser is: - -- format(data, options) - -A format parser that accepts two arguments, the input *data* to parse (e.g., a block of CSV text) and a set of format-specific *options*. The following data formats are registered by default: - -- *dsv*: Delimiter-separated values format. Each line of text is a record, with each field separated by a delimiter string. Accepts a *delimiter* option indicating the delimiter string used to separate field values. -- *csv*: Comma-separated values format. A *dsv* instance with a comma (`,`) delimiter. -- *tsv*: Tab-separated values format. A *dsv* instance with a tab (`\t`) delimiter. -- *json*: [JavaScript Object Notation (JSON)](https://en.wikipedia.org/wiki/JSON) format. Accepts a *property* option, indicating a sub-property of the parsed JSON to return; useful if a data array is nested within a larger object. Also accepts a *copy* option (default `false`), which will defensively copy a JSON Object that was passed to Vega directly, rather than parsed from a string. -- *topojson*: [TopoJSON](https://github.com/mbostock/topojson/wiki) format for compressed encoding of geographic data. Requires either a *feature* option indicating the name of the geographic feature to extract (e.g., extracts individual paths for all countries), or a *mesh* option indicating a feature name for which a single mesh should be extracted (e.g., all country boundaries in a single path). Please see the [TopoJSON documentation](https://github.com/mbostock/topojson/wiki) for more. diff --git a/node_modules/vega-loader/build/vega-loader.js b/node_modules/vega-loader/build/vega-loader.js deleted file mode 100644 index 64f6268..0000000 --- a/node_modules/vega-loader/build/vega-loader.js +++ /dev/null @@ -1,443 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('d3-dsv'), require('topojson-client'), require('vega-format')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'd3-dsv', 'topojson-client', 'vega-format'], factory) : - (global = global || self, factory(global.vega = {}, global.vega, global.d3, global.topojson, global.vega)); -}(this, (function (exports, vegaUtil, d3Dsv, topojsonClient, vegaFormat) { 'use strict'; - - // Matches absolute URLs with optional protocol - // https://... file://... //... - const protocol_re = /^([A-Za-z]+:)?\/\//; - - // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// - const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape - const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex - - - // Special treatment in node.js for the file: protocol - const fileProtocol = 'file://'; - - /** - * Factory for a loader constructor that provides methods for requesting - * files from either the network or disk, and for sanitizing request URIs. - * @param {function} fetch - The Fetch API for HTTP network requests. - * If null or undefined, HTTP loading will be disabled. - * @param {object} fs - The file system interface for file loading. - * If null or undefined, local file loading will be disabled. - * @return {function} A loader constructor with the following signature: - * param {object} [options] - Optional default loading options to use. - * return {object} - A new loader instance. - */ - function loaderFactory(fetch, fs) { - return function(options) { - return { - options: options || {}, - sanitize: sanitize, - load: load, - fileAccess: !!fs, - file: fileLoader(fs), - http: httpLoader(fetch) - }; - }; - } - - /** - * Load an external resource, typically either from the web or from the local - * filesystem. This function uses {@link sanitize} to first sanitize the uri, - * then calls either {@link http} (for web requests) or {@link file} (for - * filesystem loading). - * @param {string} uri - The resource indicator (e.g., URL or filename). - * @param {object} [options] - Optional loading options. These options will - * override any existing default options. - * @return {Promise} - A promise that resolves to the loaded content. - */ - async function load(uri, options) { - const opt = await this.sanitize(uri, options), - url = opt.href; - - return opt.localFile - ? this.file(url) - : this.http(url, options); - } - - /** - * URI sanitizer function. - * @param {string} uri - The uri (url or filename) to sanity check. - * @param {object} options - An options hash. - * @return {Promise} - A promise that resolves to an object containing - * sanitized uri data, or rejects it the input uri is deemed invalid. - * The properties of the resolved object are assumed to be - * valid attributes for an HTML 'a' tag. The sanitized uri *must* be - * provided by the 'href' property of the returned object. - */ - async function sanitize(uri, options) { - options = vegaUtil.extend({}, this.options, options); - - const fileAccess = this.fileAccess, - result = {href: null}; - - let isFile, loadFile, base; - - const isAllowed = allowed_re.test(uri.replace(whitespace_re, '')); - - if (uri == null || typeof uri !== 'string' || !isAllowed) { - vegaUtil.error('Sanitize failure, invalid URI: ' + vegaUtil.stringValue(uri)); - } - - const hasProtocol = protocol_re.test(uri); - - // if relative url (no protocol/host), prepend baseURL - if ((base = options.baseURL) && !hasProtocol) { - // Ensure that there is a slash between the baseURL (e.g. hostname) and url - if (!uri.startsWith('/') && base[base.length-1] !== '/') { - uri = '/' + uri; - } - uri = base + uri; - } - - // should we load from file system? - loadFile = (isFile = uri.startsWith(fileProtocol)) - || options.mode === 'file' - || options.mode !== 'http' && !hasProtocol && fileAccess; - - if (isFile) { - // strip file protocol - uri = uri.slice(fileProtocol.length); - } else if (uri.startsWith('//')) { - if (options.defaultProtocol === 'file') { - // if is file, strip protocol and set loadFile flag - uri = uri.slice(2); - loadFile = true; - } else { - // if relative protocol (starts with '//'), prepend default protocol - uri = (options.defaultProtocol || 'http') + ':' + uri; - } - } - - // set non-enumerable mode flag to indicate local file load - Object.defineProperty(result, 'localFile', {value: !!loadFile}); - - // set uri - result.href = uri; - - // set default result target, if specified - if (options.target) { - result.target = options.target + ''; - } - - // set default result rel, if specified (#1542) - if (options.rel) { - result.rel = options.rel + ''; - } - - // provide control over cross-origin image handling (#2238) - // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image - if (options.context === 'image' && options.crossOrigin) { - result.crossOrigin = options.crossOrigin + ''; - } - - // return - return result; - } - - /** - * File system loader factory. - * @param {object} fs - The file system interface. - * @return {function} - A file loader with the following signature: - * param {string} filename - The file system path to load. - * param {string} filename - The file system path to load. - * return {Promise} A promise that resolves to the file contents. - */ - function fileLoader(fs) { - return fs - ? function(filename) { - return new Promise(function(accept, reject) { - fs.readFile(filename, function(error, data) { - if (error) reject(error); - else accept(data); - }); - }); - } - : fileReject; - } - - /** - * Default file system loader that simply rejects. - */ - async function fileReject() { - vegaUtil.error('No file system access.'); - } - - /** - * HTTP request handler factory. - * @param {function} fetch - The Fetch API method. - * @return {function} - An http loader with the following signature: - * param {string} url - The url to request. - * param {object} options - An options hash. - * return {Promise} - A promise that resolves to the file contents. - */ - function httpLoader(fetch) { - return fetch - ? async function(url, options) { - const opt = vegaUtil.extend({}, this.options.http, options), - type = options && options.response, - response = await fetch(url, opt); - - return !response.ok - ? vegaUtil.error(response.status + '' + response.statusText) - : vegaUtil.isFunction(response[type]) ? response[type]() - : response.text(); - } - : httpReject; - } - - /** - * Default http request handler that simply rejects. - */ - async function httpReject() { - vegaUtil.error('No HTTP fetch method available.'); - } - - var typeParsers = { - boolean: vegaUtil.toBoolean, - integer: vegaUtil.toNumber, - number: vegaUtil.toNumber, - date: vegaUtil.toDate, - string: vegaUtil.toString, - unknown: vegaUtil.identity - }; - - var typeTests = [ - isBoolean, - isInteger, - isNumber, - isDate - ]; - - var typeList = [ - 'boolean', - 'integer', - 'number', - 'date' - ]; - - function inferType(values, field) { - if (!values || !values.length) return 'unknown'; - - const n = values.length, - m = typeTests.length, - a = typeTests.map((_, i) => i + 1); - - for (let i = 0, t = 0, j, value; i < n; ++i) { - value = field ? values[i][field] : values[i]; - for (j = 0; j < m; ++j) { - if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - } - - return typeList[ - a.reduce((u, v) => u === 0 ? v : u, 0) - 1 - ]; - } - - function inferTypes(data, fields) { - return fields.reduce(function(types, field) { - types[field] = inferType(data, field); - return types; - }, {}); - } - - // -- Type Checks ---- - - function isValid(_) { - return _ != null && _ === _; - } - - function isBoolean(_) { - return _ === 'true' || _ === 'false' || _ === true || _ === false; - } - - function isDate(_) { - return !Number.isNaN(Date.parse(_)); - } - - function isNumber(_) { - return !Number.isNaN(+_) && !(_ instanceof Date); - } - - function isInteger(_) { - return isNumber(_) && Number.isInteger(+_); - } - - function delimitedFormat(delimiter) { - const parse = function(data, format) { - const delim = {delimiter: delimiter}; - return dsv(data, format ? vegaUtil.extend(format, delim) : delim); - }; - - parse.responseType = 'text'; - - return parse; - } - - function dsv(data, format) { - if (format.header) { - data = format.header - .map(vegaUtil.stringValue) - .join(format.delimiter) + '\n' + data; - } - return d3Dsv.dsvFormat(format.delimiter).parse(data + ''); - } - - dsv.responseType = 'text'; - - function isBuffer(_) { - return (typeof Buffer === 'function' && vegaUtil.isFunction(Buffer.isBuffer)) - ? Buffer.isBuffer(_) : false; - } - - function json(data, format) { - const prop = (format && format.property) ? vegaUtil.field(format.property) : vegaUtil.identity; - return vegaUtil.isObject(data) && !isBuffer(data) - ? parseJSON(prop(data)) - : prop(JSON.parse(data)); - } - - json.responseType = 'json'; - - function parseJSON(data, format) { - return (format && format.copy) - ? JSON.parse(JSON.stringify(data)) - : data; - } - - const filters = { - interior: (a, b) => a !== b, - exterior: (a, b) => a === b - }; - - function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - - if (format && format.feature) { - method = topojsonClient.feature; - property = format.feature; - } else if (format && format.mesh) { - method = topojsonClient.mesh; - property = format.mesh; - filter = filters[format.filter]; - } else { - vegaUtil.error('Missing TopoJSON feature or mesh parameter.'); - } - - object = (object = data.objects[property]) - ? method(data, object, filter) - : vegaUtil.error('Invalid TopoJSON object: ' + property); - - return object && object.features || [object]; - } - - topojson.responseType = 'json'; - - const format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson - }; - - function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else { - return vegaUtil.hasOwnProperty(format, name) ? format[name] : null; - } - } - - function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; - } - - function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - - const reader = formats(schema.type || 'json'); - if (!reader) vegaUtil.error('Unknown data format type: ' + schema.type); - - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - - if (vegaUtil.hasOwnProperty(data, 'columns')) delete data.columns; - return data; - } - - function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - - const locale = vegaFormat.timeFormatDefaultLocale(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - - var fields = data.columns || Object.keys(data[0]), - parsers, datum, field, i, j, n, m; - - if (types === 'auto') types = inferTypes(data, fields); - - fields = Object.keys(types); - parsers = fields.map(function(field) { - var type = types[field], - parts, pattern; - - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - - if ((pattern[0] === '\'' && pattern[pattern.length-1] === '\'') || - (pattern[0] === '"' && pattern[pattern.length-1] === '"')) { - pattern = pattern.slice(1, -1); - } - - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - - if (!typeParsers[type]) { - throw Error('Illegal format pattern: ' + field + ':' + type); - } - - return typeParsers[type]; - }); - - for (i=0, n=data.length, m=fields.length; it+1);for(let s,u,a=0,f=0;a0===e?t:e,0)-1]}function v(e,t){return t.reduce((function(t,n){return t[n]=y(e,n),t}),{})}function b(e){return!(Number.isNaN(+e)||e instanceof Date)}function j(e){const n=function(n,r){const o={delimiter:e};return N(n,r?t.extend(r,o):o)};return n.responseType="text",n}function N(e,r){return r.header&&(e=r.header.map(t.stringValue).join(r.delimiter)+"\n"+e),n.dsvFormat(r.delimiter).parse(e+"")}function O(e,n){const r=n&&n.property?t.field(n.property):t.identity;return!t.isObject(e)||(o=e,"function"==typeof Buffer&&t.isFunction(Buffer.isBuffer)&&Buffer.isBuffer(o))?r(JSON.parse(e)):function(e,t){return t&&t.copy?JSON.parse(JSON.stringify(e)):e}(r(e));var o}N.responseType="text",O.responseType="json";const x={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function T(e,n){let o,i,s,u;return e=O(e,n),n&&n.feature?(o=r.feature,s=n.feature):n&&n.mesh?(o=r.mesh,s=n.mesh,u=x[n.filter]):t.error("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[s])?o(e,i,u):t.error("Invalid TopoJSON object: "+s),i&&i.features||[i]}T.responseType="json";const P={dsv:N,csv:j(","),tsv:j("\t"),json:O,topojson:T};function w(e,n){return arguments.length>1?(P[e]=n,this):t.hasOwnProperty(P,e)?P[e]:null}var z=function(e,t){return function(n){return{options:n||{},sanitize:f,load:a,fileAccess:!!t,file:c(t),http:p(e)}}}("undefined"!=typeof fetch&&fetch,null);e.format=P,e.formats=w,e.inferType=y,e.inferTypes=v,e.loader=z,e.read=function(e,n,r,i){const s=w((n=n||{}).type||"json");return s||t.error("Unknown data format type: "+n.type),e=s(e,n),n.parse&&function(e,t,n,r){if(!e.length)return;const i=o.timeFormatDefaultLocale();n=n||i.timeParse,r=r||i.utcParse;var s,u,a,f,c,l,p,d=e.columns||Object.keys(e[0]);"auto"===t&&(t=v(e,d));for(d=Object.keys(t),s=d.map((function(e){var o,i,s=t[e];if(s&&(s.startsWith("date:")||s.startsWith("utc:"))){return("'"===(i=(o=s.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),("utc"===o[0]?r:n)(i)}if(!h[s])throw Error("Illegal format pattern: "+e+":"+s);return h[s]})),f=0,l=e.length,p=d.length;f i + 1); - - for (let i = 0, t = 0, j, value; i < n; ++i) { - value = field ? values[i][field] : values[i]; - for (j = 0; j < m; ++j) { - if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - } - - return typeList[ - a.reduce((u, v) => u === 0 ? v : u, 0) - 1 - ]; -} - -function inferTypes(data, fields) { - return fields.reduce(function(types, field) { - types[field] = inferType(data, field); - return types; - }, {}); -} - -// -- Type Checks ---- - -function isValid(_) { - return _ != null && _ === _; -} - -function isBoolean(_) { - return _ === 'true' || _ === 'false' || _ === true || _ === false; -} - -function isDate(_) { - return !Number.isNaN(Date.parse(_)); -} - -function isNumber(_) { - return !Number.isNaN(+_) && !(_ instanceof Date); -} - -function isInteger(_) { - return isNumber(_) && Number.isInteger(+_); -} - -function delimitedFormat(delimiter) { - const parse = function(data, format) { - const delim = {delimiter: delimiter}; - return dsv(data, format ? vegaUtil.extend(format, delim) : delim); - }; - - parse.responseType = 'text'; - - return parse; -} - -function dsv(data, format) { - if (format.header) { - data = format.header - .map(vegaUtil.stringValue) - .join(format.delimiter) + '\n' + data; - } - return d3Dsv.dsvFormat(format.delimiter).parse(data + ''); -} - -dsv.responseType = 'text'; - -function isBuffer(_) { - return (typeof Buffer === 'function' && vegaUtil.isFunction(Buffer.isBuffer)) - ? Buffer.isBuffer(_) : false; -} - -function json(data, format) { - const prop = (format && format.property) ? vegaUtil.field(format.property) : vegaUtil.identity; - return vegaUtil.isObject(data) && !isBuffer(data) - ? parseJSON(prop(data)) - : prop(JSON.parse(data)); -} - -json.responseType = 'json'; - -function parseJSON(data, format) { - return (format && format.copy) - ? JSON.parse(JSON.stringify(data)) - : data; -} - -const filters = { - interior: (a, b) => a !== b, - exterior: (a, b) => a === b -}; - -function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - - if (format && format.feature) { - method = topojsonClient.feature; - property = format.feature; - } else if (format && format.mesh) { - method = topojsonClient.mesh; - property = format.mesh; - filter = filters[format.filter]; - } else { - vegaUtil.error('Missing TopoJSON feature or mesh parameter.'); - } - - object = (object = data.objects[property]) - ? method(data, object, filter) - : vegaUtil.error('Invalid TopoJSON object: ' + property); - - return object && object.features || [object]; -} - -topojson.responseType = 'json'; - -const format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson -}; - -function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else { - return vegaUtil.hasOwnProperty(format, name) ? format[name] : null; - } -} - -function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; -} - -function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - - const reader = formats(schema.type || 'json'); - if (!reader) vegaUtil.error('Unknown data format type: ' + schema.type); - - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - - if (vegaUtil.hasOwnProperty(data, 'columns')) delete data.columns; - return data; -} - -function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - - const locale = vegaFormat.timeFormatDefaultLocale(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - - var fields = data.columns || Object.keys(data[0]), - parsers, datum, field, i, j, n, m; - - if (types === 'auto') types = inferTypes(data, fields); - - fields = Object.keys(types); - parsers = fields.map(function(field) { - var type = types[field], - parts, pattern; - - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - - if ((pattern[0] === '\'' && pattern[pattern.length-1] === '\'') || - (pattern[0] === '"' && pattern[pattern.length-1] === '"')) { - pattern = pattern.slice(1, -1); - } - - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - - if (!typeParsers[type]) { - throw Error('Illegal format pattern: ' + field + ':' + type); - } - - return typeParsers[type]; - }); - - for (i=0, n=data.length, m=fields.length; i 1) { - format[name] = reader; - return this; - } else { - return hasOwnProperty(format, name) ? format[name] : null; - } -} - -export function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; -} diff --git a/node_modules/vega-loader/src/formats/json.js b/node_modules/vega-loader/src/formats/json.js deleted file mode 100644 index cda9477..0000000 --- a/node_modules/vega-loader/src/formats/json.js +++ /dev/null @@ -1,21 +0,0 @@ -import {field, identity, isFunction, isObject} from 'vega-util'; - -function isBuffer(_) { - return (typeof Buffer === 'function' && isFunction(Buffer.isBuffer)) - ? Buffer.isBuffer(_) : false; -} - -export default function json(data, format) { - const prop = (format && format.property) ? field(format.property) : identity; - return isObject(data) && !isBuffer(data) - ? parseJSON(prop(data)) - : prop(JSON.parse(data)); -} - -json.responseType = 'json'; - -function parseJSON(data, format) { - return (format && format.copy) - ? JSON.parse(JSON.stringify(data)) - : data; -} diff --git a/node_modules/vega-loader/src/formats/topojson.js b/node_modules/vega-loader/src/formats/topojson.js deleted file mode 100644 index 2e0b930..0000000 --- a/node_modules/vega-loader/src/formats/topojson.js +++ /dev/null @@ -1,32 +0,0 @@ -import json from './json'; -import {feature, mesh} from 'topojson-client'; -import {error} from 'vega-util'; - -const filters = { - interior: (a, b) => a !== b, - exterior: (a, b) => a === b -}; - -export default function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - - if (format && format.feature) { - method = feature; - property = format.feature; - } else if (format && format.mesh) { - method = mesh; - property = format.mesh; - filter = filters[format.filter]; - } else { - error('Missing TopoJSON feature or mesh parameter.'); - } - - object = (object = data.objects[property]) - ? method(data, object, filter) - : error('Invalid TopoJSON object: ' + property); - - return object && object.features || [object]; -} - -topojson.responseType = 'json'; diff --git a/node_modules/vega-loader/src/loader.js b/node_modules/vega-loader/src/loader.js deleted file mode 100644 index 211587f..0000000 --- a/node_modules/vega-loader/src/loader.js +++ /dev/null @@ -1,194 +0,0 @@ -import {error, extend, isFunction, stringValue} from 'vega-util'; - -// Matches absolute URLs with optional protocol -// https://... file://... //... -const protocol_re = /^([A-Za-z]+:)?\/\//; - -// Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// -const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape -const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex - - -// Special treatment in node.js for the file: protocol -const fileProtocol = 'file://'; - -/** - * Factory for a loader constructor that provides methods for requesting - * files from either the network or disk, and for sanitizing request URIs. - * @param {function} fetch - The Fetch API for HTTP network requests. - * If null or undefined, HTTP loading will be disabled. - * @param {object} fs - The file system interface for file loading. - * If null or undefined, local file loading will be disabled. - * @return {function} A loader constructor with the following signature: - * param {object} [options] - Optional default loading options to use. - * return {object} - A new loader instance. - */ -export default function(fetch, fs) { - return function(options) { - return { - options: options || {}, - sanitize: sanitize, - load: load, - fileAccess: !!fs, - file: fileLoader(fs), - http: httpLoader(fetch) - }; - }; -} - -/** - * Load an external resource, typically either from the web or from the local - * filesystem. This function uses {@link sanitize} to first sanitize the uri, - * then calls either {@link http} (for web requests) or {@link file} (for - * filesystem loading). - * @param {string} uri - The resource indicator (e.g., URL or filename). - * @param {object} [options] - Optional loading options. These options will - * override any existing default options. - * @return {Promise} - A promise that resolves to the loaded content. - */ -async function load(uri, options) { - const opt = await this.sanitize(uri, options), - url = opt.href; - - return opt.localFile - ? this.file(url) - : this.http(url, options); -} - -/** - * URI sanitizer function. - * @param {string} uri - The uri (url or filename) to sanity check. - * @param {object} options - An options hash. - * @return {Promise} - A promise that resolves to an object containing - * sanitized uri data, or rejects it the input uri is deemed invalid. - * The properties of the resolved object are assumed to be - * valid attributes for an HTML 'a' tag. The sanitized uri *must* be - * provided by the 'href' property of the returned object. - */ -async function sanitize(uri, options) { - options = extend({}, this.options, options); - - const fileAccess = this.fileAccess, - result = {href: null}; - - let isFile, loadFile, base; - - const isAllowed = allowed_re.test(uri.replace(whitespace_re, '')); - - if (uri == null || typeof uri !== 'string' || !isAllowed) { - error('Sanitize failure, invalid URI: ' + stringValue(uri)); - } - - const hasProtocol = protocol_re.test(uri); - - // if relative url (no protocol/host), prepend baseURL - if ((base = options.baseURL) && !hasProtocol) { - // Ensure that there is a slash between the baseURL (e.g. hostname) and url - if (!uri.startsWith('/') && base[base.length-1] !== '/') { - uri = '/' + uri; - } - uri = base + uri; - } - - // should we load from file system? - loadFile = (isFile = uri.startsWith(fileProtocol)) - || options.mode === 'file' - || options.mode !== 'http' && !hasProtocol && fileAccess; - - if (isFile) { - // strip file protocol - uri = uri.slice(fileProtocol.length); - } else if (uri.startsWith('//')) { - if (options.defaultProtocol === 'file') { - // if is file, strip protocol and set loadFile flag - uri = uri.slice(2); - loadFile = true; - } else { - // if relative protocol (starts with '//'), prepend default protocol - uri = (options.defaultProtocol || 'http') + ':' + uri; - } - } - - // set non-enumerable mode flag to indicate local file load - Object.defineProperty(result, 'localFile', {value: !!loadFile}); - - // set uri - result.href = uri; - - // set default result target, if specified - if (options.target) { - result.target = options.target + ''; - } - - // set default result rel, if specified (#1542) - if (options.rel) { - result.rel = options.rel + ''; - } - - // provide control over cross-origin image handling (#2238) - // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image - if (options.context === 'image' && options.crossOrigin) { - result.crossOrigin = options.crossOrigin + ''; - } - - // return - return result; -} - -/** - * File system loader factory. - * @param {object} fs - The file system interface. - * @return {function} - A file loader with the following signature: - * param {string} filename - The file system path to load. - * param {string} filename - The file system path to load. - * return {Promise} A promise that resolves to the file contents. - */ -function fileLoader(fs) { - return fs - ? function(filename) { - return new Promise(function(accept, reject) { - fs.readFile(filename, function(error, data) { - if (error) reject(error); - else accept(data); - }); - }); - } - : fileReject; -} - -/** - * Default file system loader that simply rejects. - */ -async function fileReject() { - error('No file system access.'); -} - -/** - * HTTP request handler factory. - * @param {function} fetch - The Fetch API method. - * @return {function} - An http loader with the following signature: - * param {string} url - The url to request. - * param {object} options - An options hash. - * return {Promise} - A promise that resolves to the file contents. - */ -function httpLoader(fetch) { - return fetch - ? async function(url, options) { - const opt = extend({}, this.options.http, options), - type = options && options.response, - response = await fetch(url, opt); - - return !response.ok - ? error(response.status + '' + response.statusText) - : isFunction(response[type]) ? response[type]() - : response.text(); - } - : httpReject; -} - -/** - * Default http request handler that simply rejects. - */ -async function httpReject() { - error('No HTTP fetch method available.'); -} diff --git a/node_modules/vega-loader/src/read.js b/node_modules/vega-loader/src/read.js deleted file mode 100644 index dd1e907..0000000 --- a/node_modules/vega-loader/src/read.js +++ /dev/null @@ -1,63 +0,0 @@ -import {inferTypes, typeParsers} from './type'; -import {formats} from './formats/index'; -import {timeFormatDefaultLocale} from 'vega-format'; -import {error, hasOwnProperty} from 'vega-util'; - -export default function(data, schema, timeParser, utcParser) { - schema = schema || {}; - - const reader = formats(schema.type || 'json'); - if (!reader) error('Unknown data format type: ' + schema.type); - - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - - if (hasOwnProperty(data, 'columns')) delete data.columns; - return data; -} - -function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - - const locale = timeFormatDefaultLocale(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - - var fields = data.columns || Object.keys(data[0]), - parsers, datum, field, i, j, n, m; - - if (types === 'auto') types = inferTypes(data, fields); - - fields = Object.keys(types); - parsers = fields.map(function(field) { - var type = types[field], - parts, pattern; - - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - - if ((pattern[0] === '\'' && pattern[pattern.length-1] === '\'') || - (pattern[0] === '"' && pattern[pattern.length-1] === '"')) { - pattern = pattern.slice(1, -1); - } - - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - - if (!typeParsers[type]) { - throw Error('Illegal format pattern: ' + field + ':' + type); - } - - return typeParsers[type]; - }); - - for (i=0, n=data.length, m=fields.length; i i + 1); - - for (let i = 0, t = 0, j, value; i < n; ++i) { - value = field ? values[i][field] : values[i]; - for (j = 0; j < m; ++j) { - if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - } - - return typeList[ - a.reduce((u, v) => u === 0 ? v : u, 0) - 1 - ]; -} - -export function inferTypes(data, fields) { - return fields.reduce(function(types, field) { - types[field] = inferType(data, field); - return types; - }, {}); -} - -// -- Type Checks ---- - -function isValid(_) { - return _ != null && _ === _; -} - -function isBoolean(_) { - return _ === 'true' || _ === 'false' || _ === true || _ === false; -} - -function isDate(_) { - return !Number.isNaN(Date.parse(_)); -} - -function isNumber(_) { - return !Number.isNaN(+_) && !(_ instanceof Date); -} - -function isInteger(_) { - return isNumber(_) && Number.isInteger(+_); -} diff --git a/node_modules/vega-parser/LICENSE b/node_modules/vega-parser/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-parser/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-parser/README.md b/node_modules/vega-parser/README.md deleted file mode 100644 index 2400c67..0000000 --- a/node_modules/vega-parser/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# vega-parser - -Parse Vega specifications to runtime dataflow descriptions. - -## API Reference - -# -vega.parse(specification[, config]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-parser/src/parse.js "Source") - -Parses a Vega JSON *specification* as input and produces a reactive dataflow graph description for a visualization. The output description uses the format of the [vega-runtime](https://github.com/vega/vega/tree/master/packages/vega-runtime) module. To create a visualization, use the runtime dataflow description as the input to a Vega [View](https://github.com/vega/vega/tree/master/packages/vega-view) instance. - -The optional *config* object provides visual encoding defaults for marks, scales, axes and legends. Different configuration settings can be used to change choices of layout, color, type faces, font sizes and more to realize different chart themes. For more, see the configuration documentation below or view the source code defining Vega's [default configuration](https://github.com/vega/vega/blob/master/packages/vega-parser/src/config.js). - -In addition to passing configuration options to this [parse](#parse) method, Vega JSON specifications may also include a top-level `"config"` block specifying configuration properties. Configuration options defined within a Vega JSON file take precedence over those provided to the parse method. - -## Configuration - -The Vega parser accepts a configuration file that defines default settings for a variety of visual encoding choices. Different configuration files can be used to "theme" charts with a customized look and feel. A configuration file is simply a JavaScript object with a set of named properties, grouped by type. - -For more information regarding the supported configuration options, please see the [Vega config documentation](https://vega.github.io/vega/docs/config/). diff --git a/node_modules/vega-parser/build/vega-parser.js b/node_modules/vega-parser/build/vega-parser.js deleted file mode 100644 index 0b34bd8..0000000 --- a/node_modules/vega-parser/build/vega-parser.js +++ /dev/null @@ -1,4109 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('vega-functions'), require('vega-event-selector'), require('vega-scale'), require('vega-dataflow')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'vega-functions', 'vega-event-selector', 'vega-scale', 'vega-dataflow'], factory) : - (global = global || self, factory(global.vega = {}, global.vega, global.vega, global.vega, global.vega, global.vega)); -}(this, (function (exports, vegaUtil, vegaFunctions, vegaEventSelector, vegaScale, vegaDataflow) { 'use strict'; - - function parseAutosize(spec) { - return vegaUtil.isObject(spec) ? spec : {type: spec || 'pad'}; - } - - const number = _ => +_ || 0; - - const paddingObject = _ => ({top: _, bottom: _, left: _, right: _}); - - function parsePadding(spec) { - return !vegaUtil.isObject(spec) ? paddingObject(number(spec)) - : spec.signal ? spec - : { - top: number(spec.top), - bottom: number(spec.bottom), - left: number(spec.left), - right: number(spec.right) - }; - } - - const encoder = _ => vegaUtil.isObject(_) && !vegaUtil.isArray(_) - ? vegaUtil.extend({}, _) - : {value: _}; - - function addEncode(object, name, value, set) { - if (value != null) { - // Always assign signal to update, even if the signal is from the enter block - if (vegaUtil.isObject(value) && !vegaUtil.isArray(value)) { - object.update[name] = value; - } else { - object[set || 'enter'][name] = {value: value}; - } - return 1; - } else { - return 0; - } - } - - function addEncoders(object, enter, update) { - for (const name in enter) { - addEncode(object, name, enter[name]); - } - for (const name in update) { - addEncode(object, name, update[name], 'update'); - } - } - - function extendEncode(encode, extra, skip) { - for (const name in extra) { - if (skip && vegaUtil.hasOwnProperty(skip, name)) continue; - encode[name] = vegaUtil.extend(encode[name] || {}, extra[name]); - } - return encode; - } - - function has(key, encode) { - return encode && ( - (encode.enter && encode.enter[key]) || - (encode.update && encode.update[key]) - ); - } - - var MarkRole = 'mark'; - var FrameRole = 'frame'; - var ScopeRole = 'scope'; - - var AxisRole = 'axis'; - var AxisDomainRole = 'axis-domain'; - var AxisGridRole = 'axis-grid'; - var AxisLabelRole = 'axis-label'; - var AxisTickRole = 'axis-tick'; - var AxisTitleRole = 'axis-title'; - - var LegendRole = 'legend'; - var LegendBandRole = 'legend-band'; - var LegendEntryRole = 'legend-entry'; - var LegendGradientRole = 'legend-gradient'; - var LegendLabelRole = 'legend-label'; - var LegendSymbolRole = 'legend-symbol'; - var LegendTitleRole = 'legend-title'; - - var TitleRole = 'title'; - var TitleTextRole = 'title-text'; - var TitleSubtitleRole = 'title-subtitle'; - - function applyDefaults(encode, type, role, style, config) { - const defaults = {}, enter = {}; - let update, key, skip, props; - - // if text mark, apply global lineBreak settings (#2370) - key = 'lineBreak'; - if (type === 'text' && config[key] != null && !has(key, encode)) { - applyDefault(defaults, key, config[key]); - } - - // ignore legend and axis roles - if (role == 'legend' || String(role).startsWith('axis')) { - role = null; - } - - // resolve mark config - props = role === FrameRole ? config.group - : (role === MarkRole) ? vegaUtil.extend({}, config.mark, config[type]) - : null; - - for (key in props) { - // do not apply defaults if relevant fields are defined - skip = has(key, encode) - || (key === 'fill' || key === 'stroke') - && (has('fill', encode) || has('stroke', encode)); - - if (!skip) applyDefault(defaults, key, props[key]); - } - - // resolve styles, apply with increasing precedence - vegaUtil.array(style).forEach(name => { - const props = config.style && config.style[name]; - for (const key in props) { - if (!has(key, encode)) { - applyDefault(defaults, key, props[key]); - } - } - }); - - encode = vegaUtil.extend({}, encode); // defensive copy - for (key in defaults) { - props = defaults[key]; - if (props.signal) { - (update = update || {})[key] = props; - } else { - enter[key] = props; - } - } - - encode.enter = vegaUtil.extend(enter, encode.enter); - if (update) encode.update = vegaUtil.extend(update, encode.update); - - return encode; - } - - function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal - ? {signal: value.signal} - : {value: value}; - } - - const scaleRef = scale => vegaUtil.isString(scale) ? vegaUtil.stringValue(scale) - : scale.signal ? `(${scale.signal})` - : field(scale); - - function entry(enc) { - if (enc.gradient != null) { - return gradient(enc); - } - - let value = enc.signal ? `(${enc.signal})` - : enc.color ? color(enc.color) - : enc.field != null ? field(enc.field) - : enc.value !== undefined ? vegaUtil.stringValue(enc.value) - : undefined; - - if (enc.scale != null) { - value = scale(enc, value); - } - - if (value === undefined) { - value = null; - } - - if (enc.exponent != null) { - value = `pow(${value},${property(enc.exponent)})`; - } - - if (enc.mult != null) { - value += `*${property(enc.mult)}`; - } - - if (enc.offset != null) { - value += `+${property(enc.offset)}`; - } - - if (enc.round) { - value = `round(${value})`; - } - - return value; - } - - const _color = (type, x, y, z) => - `(${type}(${[x, y, z].map(entry).join(',')})+'')`; - - function color(enc) { - return (enc.c) ? _color('hcl', enc.h, enc.c, enc.l) - : (enc.h || enc.s) ? _color('hsl', enc.h, enc.s, enc.l) - : (enc.l || enc.a) ? _color('lab', enc.l, enc.a, enc.b) - : (enc.r || enc.g || enc.b) ? _color('rgb', enc.r, enc.g, enc.b) - : null; - } - - function gradient(enc) { - // map undefined to null; expression lang does not allow undefined - const args = [enc.start, enc.stop, enc.count] - .map(_ => _ == null ? null : vegaUtil.stringValue(_)); - - // trim null inputs from the end - while (args.length && vegaUtil.peek(args) == null) args.pop(); - - args.unshift(scaleRef(enc.gradient)); - return `gradient(${args.join(',')})`; - } - - function property(property) { - return vegaUtil.isObject(property) ? '(' + entry(property) + ')' : property; - } - - function field(ref) { - return resolveField(vegaUtil.isObject(ref) ? ref : {datum: ref}); - } - - function resolveField(ref) { - let object, level, field; - - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - - while (level-- > 0) { - object += '.mark.group'; - } - - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else { - field = ref.group; - } - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else { - vegaUtil.error('Invalid field reference: ' + vegaUtil.stringValue(ref)); - } - - if (!ref.signal) { - field = vegaUtil.isString(field) - ? vegaUtil.splitAccessPath(field).map(vegaUtil.stringValue).join('][') - : resolveField(field); - } - - return object + '[' + field + ']'; - } - - function scale(enc, value) { - const scale = scaleRef(enc.scale); - - if (enc.range != null) { - // pull value from scale range - value = `lerp(_range(${scale}), ${+enc.range})`; - } else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = `_scale(${scale}, ${value})`; - - if (enc.band) { - value = (value ? value + '+' : '') - + `_bandwidth(${scale})` - + (+enc.band === 1 ? '' : '*' + property(enc.band)); - - if (enc.extra) { - // include logic to handle extraneous elements - value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`; - } - } - - if (value == null) value = '0'; - } - - return value; - } - - function rule(enc) { - let code = ''; - - enc.forEach(rule => { - const value = entry(rule); - code += rule.test ? `(${rule.test})?${value}:` : value; - }); - - // if no else clause, terminate with null (#1366) - if (vegaUtil.peek(code) === ':') { - code += 'null'; - } - - return code; - } - - function parseEncode(encode, type, role, style, scope, params) { - const enc = {}; - params = params || {}; - params.encoders = {$encode: enc}; - - encode = applyDefaults(encode, type, role, style, scope.config); - for (const key in encode) { - enc[key] = parseBlock(encode[key], type, params, scope); - } - - return params; - } - - function parseBlock(block, marktype, params, scope) { - const channels = {}, - fields = {}; - - for (const name in block) { - if (block[name] != null) { // skip any null entries - channels[name] = parse(expr(block[name]), scope, params, fields); - } - } - - return { - $expr: {marktype, channels}, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; - } - - function expr(enc) { - return vegaUtil.isArray(enc) ? rule(enc) : entry(enc); - } - - function parse(code, scope, params, fields) { - const expr = vegaFunctions.parseExpression(code, scope); - expr.$fields.forEach(name => fields[name] = 1); - vegaUtil.extend(params, expr.$params); - return expr.$expr; - } - - var OUTER = 'outer', - OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind']; - - function outerError(prefix, name) { - vegaUtil.error(prefix + ' for "outer" push: ' + vegaUtil.stringValue(name)); - } - - function parseSignal(signal, scope) { - var name = signal.name; - - if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); - // signal push must not use properties reserved for standard definition - OUTER_INVALID.forEach(function(prop) { - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); - } else { - // define a new signal in the current scope - var op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); - } - } - - function Entry(type, value, params, parent) { - this.id = -1; - this.type = type; - this.value = value; - this.params = params; - if (parent) this.parent = parent; - } - - function entry$1(type, value, params, parent) { - return new Entry(type, value, params, parent); - } - - function operator(value, params) { - return entry$1('operator', value, params); - } - - // ----- - - function ref(op) { - var ref = {$ref: op.id}; - // if operator not yet registered, cache ref to resolve later - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; - } - - function fieldRef(field, name) { - return name ? {$field: field, $name: name} : {$field: field}; - } - - var keyFieldRef = fieldRef('key'); - - function compareRef(fields, orders) { - return {$compare: fields, $order: orders}; - } - - function keyRef(fields, flat) { - var ref = {$key: fields}; - if (flat) ref.$flat = true; - return ref; - } - - // ----- - - var Ascending = 'ascending'; - - var Descending = 'descending'; - - function sortKey(sort) { - return !vegaUtil.isObject(sort) ? '' - : (sort.order === Descending ? '-' : '+') - + aggrField(sort.op, sort.field); - } - - function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') - + (op && field ? '_' : '') - + (field && field.signal ? '$' + field.signal : field || ''); - } - - // ----- - - var Scope = 'scope'; - - var View = 'view'; - - function isSignal(_) { - return _ && _.signal; - } - - function isExpr(_) { - return _ && _.expr; - } - - function hasSignal(_) { - if (isSignal(_)) return true; - if (vegaUtil.isObject(_)) for (var key in _) { - if (hasSignal(_[key])) return true; - } - return false; - } - - function value(specValue, defaultValue) { - return specValue != null ? specValue : defaultValue; - } - - function deref(v) { - return v && v.signal || v; - } - - var Timer = 'timer'; - - function parseStream(stream, scope) { - var method = stream.merge ? mergeStream - : stream.stream ? nestedStream - : stream.type ? eventStream - : vegaUtil.error('Invalid stream specification: ' + vegaUtil.stringValue(stream)); - - return method(stream, scope); - } - - function eventSource(source) { - return source === Scope ? View : (source || View); - } - - function mergeStream(stream, scope) { - var list = stream.merge.map(s => parseStream(s, scope)), - entry = streamParameters({merge: list}, stream, scope); - return scope.addStream(entry).id; - } - - function nestedStream(stream, scope) { - var id = parseStream(stream.stream, scope), - entry = streamParameters({stream: id}, stream, scope); - return scope.addStream(entry).id; - } - - function eventStream(stream, scope) { - var id, entry; - - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = {between: stream.between, filter: stream.filter}; - } else { - id = scope.event(eventSource(stream.source), stream.type); - } - - entry = streamParameters({stream: id}, stream, scope); - return Object.keys(entry).length === 1 - ? id - : scope.addStream(entry).id; - } - - function streamParameters(entry, stream, scope) { - var param = stream.between; - - if (param) { - if (param.length !== 2) { - vegaUtil.error('Stream "between" parameter must have 2 entries: ' + vegaUtil.stringValue(stream)); - } - entry.between = [ - parseStream(param[0], scope), - parseStream(param[1], scope) - ]; - } - - param = stream.filter ? [].concat(stream.filter) : []; - if (stream.marktype || stream.markname || stream.markrole) { - // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - } - if (stream.source === Scope) { - // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - } - if (param.length) { - entry.filter = vegaFunctions.parseExpression('(' + param.join(')&&(') + ')', scope).$expr; - } - - if ((param = stream.throttle) != null) { - entry.throttle = +param; - } - - if ((param = stream.debounce) != null) { - entry.debounce = +param; - } - - if (stream.consume) { - entry.consume = true; - } - - return entry; - } - - function filterMark(type, name, role) { - var item = 'event.item'; - return item - + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') - + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') - + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); - } - - // bypass expression parser for internal operator references - const OP_VALUE_EXPR = { - code: '_.$value', - ast: {type: 'Identifier', value: 'value'} - }; - - function parseUpdate(spec, scope, target) { - var events = spec.events, - update = spec.update, - encode = spec.encode, - sources = [], - entry = {target: target}; - - if (!events) { - vegaUtil.error('Signal update missing events specification.'); - } - - // interpret as an event selector string - if (vegaUtil.isString(events)) { - events = vegaEventSelector.selector(events, scope.isSubscope() ? Scope : View); - } - - // separate event streams from signal updates - events = vegaUtil.array(events) - .filter(s => s.signal || s.scale ? (sources.push(s), 0) : 1); - - // merge internal operator listeners - if (sources.length > 1) { - sources = [mergeSources(sources)]; - } - - // merge event streams, include as source - if (events.length) { - sources.push(events.length > 1 ? {merge: events} : events[0]); - } - - if (encode != null) { - if (update) vegaUtil.error('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + vegaUtil.stringValue(encode) + ')'; - } - - // resolve update value - entry.update = vegaUtil.isString(update) ? vegaFunctions.parseExpression(update, scope) - : update.expr != null ? vegaFunctions.parseExpression(update.expr, scope) - : update.value != null ? update.value - : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: {$value: scope.signalRef(update.signal)} - } - : vegaUtil.error('Invalid signal update specification.'); - - if (spec.force) { - entry.options = {force: true}; - } - - sources.forEach(function(source) { - scope.addUpdate(vegaUtil.extend(streamSource(source, scope), entry)); - }); - } - - function streamSource(stream, scope) { - return { - source: stream.signal ? scope.signalRef(stream.signal) - : stream.scale ? scope.scaleRef(stream.scale) - : parseStream(stream, scope) - }; - } - - function mergeSources(sources) { - return { - signal: '[' - + sources.map(s => s.scale ? 'scale("' + s.scale + '")' : s.signal) - + ']' - }; - } - - function parseSignalUpdates(signal, scope) { - var op = scope.getSignal(signal.name), - expr = signal.update; - - if (signal.init) { - if (expr) { - vegaUtil.error('Signals can not include both init and update expressions.'); - } else { - expr = signal.init; - op.initonly = true; - } - } - - if (expr) { - expr = vegaFunctions.parseExpression(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - if (signal.on) { - signal.on.forEach(function(_) { - parseUpdate(_, scope, op.id); - }); - } - } - - const transform = name => (params, value, parent) => - entry$1(name, value, params || undefined, parent); - - var Aggregate = transform('aggregate'); - var AxisTicks = transform('axisticks'); - var Bound = transform('bound'); - var Collect = transform('collect'); - var Compare = transform('compare'); - var DataJoin = transform('datajoin'); - var Encode = transform('encode'); - var Expression = transform('expression'); - var Facet = transform('facet'); - var Field = transform('field'); - var Key = transform('key'); - var LegendEntries = transform('legendentries'); - var Load = transform('load'); - var Mark = transform('mark'); - var MultiExtent = transform('multiextent'); - var MultiValues = transform('multivalues'); - var Overlap = transform('overlap'); - var Params = transform('params'); - var PreFacet = transform('prefacet'); - var Projection = transform('projection'); - var Proxy = transform('proxy'); - var Relay = transform('relay'); - var Render = transform('render'); - var Scale = transform('scale'); - var Sieve = transform('sieve'); - var SortItems = transform('sortitems'); - var ViewLayout = transform('viewlayout'); - var Values = transform('values'); - - var FIELD_REF_ID = 0; - - var MULTIDOMAIN_SORT_OPS = {min: 'min', max: 'max', count: 'sum'}; - - function initScale(spec, scope) { - var type = spec.type || 'linear'; - - if (!vegaScale.isValidScaleType(type)) { - vegaUtil.error('Unrecognized scale type: ' + vegaUtil.stringValue(type)); - } - - scope.addScale(spec.name, { - type: type, - domain: undefined - }); - } - - function parseScale(spec, scope) { - var params = scope.getScale(spec.name).params, - key; - - params.domain = parseScaleDomain(spec.domain, spec, scope); - - if (spec.range != null) { - params.range = parseScaleRange(spec, scope, params); - } - - if (spec.interpolate != null) { - parseScaleInterpolate(spec.interpolate, params); - } - - if (spec.nice != null) { - params.nice = parseScaleNice(spec.nice); - } - - if (spec.bins != null) { - params.bins = parseScaleBins(spec.bins, scope); - } - - for (key in spec) { - if (vegaUtil.hasOwnProperty(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } - } - - function parseLiteral(v, scope) { - return !vegaUtil.isObject(v) ? v - : v.signal ? scope.signalRef(v.signal) - : vegaUtil.error('Unsupported object: ' + vegaUtil.stringValue(v)); - } - - function parseArray(v, scope) { - return v.signal - ? scope.signalRef(v.signal) - : v.map(v => parseLiteral(v, scope)); - } - - function dataLookupError(name) { - vegaUtil.error('Can not find data set: ' + vegaUtil.stringValue(name)); - } - - // -- SCALE DOMAIN ---- - - function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) { - vegaUtil.error('No scale domain defined for domainMin/domainMax to override.'); - } - return; // default domain - } - - return domain.signal ? scope.signalRef(domain.signal) - : (vegaUtil.isArray(domain) ? explicitDomain - : domain.fields ? multipleDomain - : singularDomain)(domain, spec, scope); - } - - function explicitDomain(domain, spec, scope) { - return domain.map(function(v) { - return parseLiteral(v, scope); - }); - } - - function singularDomain(domain, spec, scope) { - var data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - - return vegaScale.isDiscrete(spec.type) - ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) - : vegaScale.isQuantile(spec.type) ? data.domainRef(scope, domain.field) - : data.extentRef(scope, domain.field); - } - - function multipleDomain(domain, spec, scope) { - var data = domain.data, - fields = domain.fields.reduce(function(dom, d) { - d = vegaUtil.isString(d) ? {data: data, field: d} - : (vegaUtil.isArray(d) || d.signal) ? fieldRef$1(d, scope) - : d; - dom.push(d); - return dom; - }, []); - - return (vegaScale.isDiscrete(spec.type) ? ordinalMultipleDomain - : vegaScale.isQuantile(spec.type) ? quantileMultipleDomain - : numericMultipleDomain)(domain, scope, fields); - } - - function fieldRef$1(data, scope) { - var name = '_:vega:_' + (FIELD_REF_ID++), - coll = Collect({}); - - if (vegaUtil.isArray(data)) { - coll.value = {$ingest: data}; - } else if (data.signal) { - var code = 'setdata(' + vegaUtil.stringValue(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - scope.addDataPipeline(name, [coll, Sieve({})]); - return {data: name, field: 'data'}; - } - - function ordinalMultipleDomain(domain, scope, fields) { - var sort = parseSort(domain.sort, true), - counts, p, a, c, v; - - // get value counts for each domain field - counts = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); - }); - - // aggregate the results from each domain field - p = {groupby: keyFieldRef, pulse: counts}; - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [MULTIDOMAIN_SORT_OPS[a]]; - p.fields = [scope.fieldRef(v)]; - p.as = [v]; - } - a = scope.add(Aggregate(p)); - - // collect aggregate output - c = scope.add(Collect({pulse: ref(a)})); - - // extract values for combined domain - v = scope.add(Values({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) - })); - - return ref(v); - } - - function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if (vegaUtil.isObject(sort)) sort.field = 'key'; - else sort = {field: 'key'}; - } else if (!sort.field && sort.op !== 'count') { - vegaUtil.error('No field provided for sort aggregate op: ' + sort.op); - } else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) { - vegaUtil.error('Multiple domain scales can not be sorted using ' + sort.op); - } - } - } - return sort; - } - - function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - var values = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); - }); - - // combine value arrays - return ref(scope.add(MultiValues({values: values}))); - } - - function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - var extents = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); - }); - - // combine extents - return ref(scope.add(MultiExtent({extents: extents}))); - } - - // -- SCALE BINS ----- - - function parseScaleBins(v, scope) { - return v.signal || vegaUtil.isArray(v) - ? parseArray(v, scope) - : scope.objectProperty(v); - } - - // -- SCALE NICE ----- - - function parseScaleNice(nice) { - return vegaUtil.isObject(nice) - ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } - : parseLiteral(nice); - } - - // -- SCALE INTERPOLATION ----- - - function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - if (interpolate.gamma != null) { - params.interpolateGamma = parseLiteral(interpolate.gamma); - } - } - - // -- SCALE RANGE ----- - - function parseScaleRange(spec, scope, params) { - var range = spec.range, - config = scope.config.range; - - if (range.signal) { - return scope.signalRef(range.signal); - } else if (vegaUtil.isString(range)) { - if (config && vegaUtil.hasOwnProperty(config, range)) { - spec = vegaUtil.extend({}, spec, {range: config[range]}); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') { - range = [0, {signal: 'width'}]; - } else if (range === 'height') { - range = vegaScale.isDiscrete(spec.type) - ? [0, {signal: 'height'}] - : [{signal: 'height'}, 0]; - } else { - vegaUtil.error('Unrecognized scale range value: ' + vegaUtil.stringValue(range)); - } - } else if (range.scheme) { - params.scheme = vegaUtil.isArray(range.scheme) - ? parseArray(range.scheme, scope) - : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if (vegaScale.isDiscrete(spec.type) && !vegaUtil.isArray(range)) { - return parseScaleDomain(range, spec, scope); - } else if (!vegaUtil.isArray(range)) { - vegaUtil.error('Unsupported range type: ' + vegaUtil.stringValue(range)); - } - - return range.map(v => (vegaUtil.isArray(v) ? parseArray : parseLiteral)(v, scope)); - } - - function parseProjection(proj, scope) { - var config = scope.config.projection || {}, - params = {}; - - for (var name in proj) { - if (name === 'name') continue; - params[name] = parseParameter(proj[name], name, scope); - } - - // apply projection defaults from config - for (name in config) { - if (params[name] == null) { - params[name] = parseParameter(config[name], name, scope); - } - } - - scope.addProjection(proj.name, params); - } - - function parseParameter(_, name, scope) { - return vegaUtil.isArray(_) ? _.map(function(_) { return parseParameter(_, name, scope); }) - : !vegaUtil.isObject(_) ? _ - : _.signal ? scope.signalRef(_.signal) - : name === 'fit' ? _ - : vegaUtil.error('Unsupported parameter object: ' + vegaUtil.stringValue(_)); - } - - const Top = 'top'; - const Left = 'left'; - const Right = 'right'; - const Bottom = 'bottom'; - const Center = 'center'; - - const Vertical = 'vertical'; - - const Start = 'start'; - const Middle = 'middle'; - const End = 'end'; - - const Index = 'index'; - const Label = 'label'; - const Offset = 'offset'; - const Perc = 'perc'; - const Perc2 = 'perc2'; - const Value = 'value'; - - const GuideLabelStyle = 'guide-label'; - const GuideTitleStyle = 'guide-title'; - const GroupTitleStyle = 'group-title'; - const GroupSubtitleStyle = 'group-subtitle'; - - const Symbols = 'symbol'; - const Gradient = 'gradient'; - const Discrete = 'discrete'; - - const Size = 'size'; - const Shape = 'shape'; - const Fill = 'fill'; - const Stroke = 'stroke'; - const StrokeWidth = 'strokeWidth'; - const StrokeDash = 'strokeDash'; - const Opacity = 'opacity'; - - // Encoding channels supported by legends - // In priority order of 'canonical' scale - const LegendScales = [ - Size, - Shape, - Fill, - Stroke, - StrokeWidth, - StrokeDash, - Opacity - ]; - - const Skip = { - name: 1, - style: 1, - interactive: 1 - }; - - const zero = {value: 0}; - const one = {value: 1}; - - var GroupMark = 'group'; - var RectMark = 'rect'; - var RuleMark = 'rule'; - var SymbolMark = 'symbol'; - var TextMark = 'text'; - - function guideGroup(mark) { - mark.type = GroupMark; - mark.interactive = mark.interactive || false; - return mark; - } - - function lookup(spec, config) { - const _ = (name, dflt) => value(spec[name], value(config[name], dflt)); - - _.isVertical = s => Vertical === value( - spec.direction, - config.direction || (s ? config.symbolDirection : config.gradientDirection) - ); - - _.gradientLength = () => value( - spec.gradientLength, - config.gradientLength || config.gradientWidth - ); - - _.gradientThickness = () => value( - spec.gradientThickness, - config.gradientThickness || config.gradientHeight - ); - - _.entryColumns = () => value( - spec.columns, - value(config.columns, +_.isVertical(true)) - ); - - return _; - } - - function getEncoding(name, encode) { - var v = encode && ( - (encode.update && encode.update[name]) || - (encode.enter && encode.enter[name]) - ); - return v && v.signal ? v : v ? v.value : null; - } - - function getStyle(name, scope, style) { - var s = scope.config.style[style]; - return s && s[name]; - } - - function anchorExpr(s, e, m) { - return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m}`; - } - - const alignExpr = anchorExpr( - vegaUtil.stringValue(Left), - vegaUtil.stringValue(Right), - vegaUtil.stringValue(Center) - ); - - function tickBand(_) { - let v = _('tickBand'), - offset = _('tickOffset'), - band, extra; - - if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); - } else if (v.signal) { - // if signal, augment code to interpret values - band = {signal: `(${v.signal}) === 'extent' ? 1 : 0.5`}; - extra = {signal: `(${v.signal}) === 'extent'`}; - if (!vegaUtil.isObject(offset)) { - offset = {signal: `(${v.signal}) === 'extent' ? 0 : ${offset}`}; - } - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; - } else { - band = 0.5; - extra = false; - } - - return {extra, band, offset}; - } - - function extendOffset(value, offset) { - return !offset ? value - : !value ? offset - : !vegaUtil.isObject(value) ? { value, offset } - : Object.assign({}, value, { offset: extendOffset(value.offset, offset) }); - } - - function guideMark(mark, extras) { - if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip); - } else { - mark.interactive = false; - } - return mark; - } - - function legendGradient(spec, scale, config, userEncode) { - var _ = lookup(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, start, stop, width, height; - - if (vertical) { - start = [0, 1]; - stop = [0, 0]; - width = thickness; - height = length; - } else { - start = [0, 0]; - stop = [1, 0]; - width = length; - height = thickness; - } - - encode = { - enter: enter = { - opacity: zero, - x: zero, - y: zero, - width: encoder(width), - height: encoder(height) - }, - update: vegaUtil.extend({}, enter, { - opacity: one, - fill: {gradient: scale, start: start, stop: stop} - }), - exit: { - opacity: zero - } - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode - }, userEncode); - } - - function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - var _ = lookup(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, u, v, uu, vv, adjust = ''; - - vertical - ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') - : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); - - enter = { - opacity: zero, - fill: {scale: scale, field: Value} - }; - enter[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - enter[v] = zero; - enter[uu] = {signal: adjust + 'datum.' + Perc2, mult: length}; - enter[vv] = encoder(thickness); - - encode = { - enter: enter, - update: vegaUtil.extend({}, enter, {opacity: one}), - exit: {opacity: zero} - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode - }, userEncode); - } - - const alignExpr$1 = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, - baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; - - function legendGradientLabels(spec, config, userEncode, dataRef) { - var _ = lookup(spec, config), - vertical = _.isVertical(), - thickness = encoder(_.gradientThickness()), - length = _.gradientLength(), - overlap = _('labelOverlap'), - encode, enter, update, u, v, adjust = ''; - - encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one, - text: {field: Label} - }, - exit: { - opacity: zero - } - }; - - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value(spec.labelLimit, config.gradientLabelLimit) - }); - - if (vertical) { - enter.align = {value: 'left'}; - enter.baseline = update.baseline = {signal: baselineExpr}; - u = 'y'; v = 'x'; adjust = '1-'; - } else { - enter.align = update.align = {signal: alignExpr$1}; - enter.baseline = {value: 'top'}; - u = 'x'; v = 'y'; - } - - enter[u] = update[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - - enter[v] = update[v] = thickness; - thickness.offset = value(spec.labelOffset, config.gradientLabelOffset) || 0; - - overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; - - // type, role, style, key, dataRef, encode, extras - return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); - } - - // userEncode is top-level, includes entries, symbols, labels - function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - var _ = lookup(spec, config), - entries = userEncode.entries, - interactive = !!(entries && entries.interactive), - name = entries ? entries.name : undefined, - height = _('clipHeight'), - symbolOffset = _('symbolOffset'), - valueRef = {data: 'value'}, - encode = {}, - xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, - yEncode = height ? encoder(height) : {field: Size}, - index = `datum.${Index}`, - ncols = `max(1, ${columns})`, - enter, update, labelOffset, symbols, labels, nrows, sort; - - yEncode.mult = 0.5; - - // -- LEGEND SYMBOLS -- - encode = { - enter: enter = { - opacity: zero, - x: {signal: xSignal, mult: 0.5, offset: symbolOffset}, - y: yEncode - }, - update: update = { - opacity: one, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero - } - }; - - var baseFill = null, - baseStroke = null; - if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') - }, { // update - opacity: _('symbolOpacity') - }); - - LegendScales.forEach(function(scale) { - if (spec[scale]) { - update[scale] = enter[scale] = {scale: spec[scale], field: Value}; - } - }); - - symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode - }, userEncode.symbols); - - // -- LEGEND LABELS -- - labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - - encode = { - enter: enter = { - opacity: zero, - x: {signal: xSignal, offset: labelOffset}, - y: yEncode - }, - update: update = { - opacity: one, - text: {field: Label}, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero - } - }; - - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') - }); - - labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode - }, userEncode.labels); - - // -- LEGEND ENTRY GROUPS -- - encode = { - enter: { - noBound: {value: !height}, // ignore width/height in bounds calc - width: zero, - height: height ? encoder(height) : zero, - opacity: zero - }, - exit: {opacity: zero}, - update: update = { - opacity: one, - row: {signal: null}, - column: {signal: null} - } - }; - - // annotate and sort groups to ensure correct ordering - if (_.isVertical(true)) { - nrows = `ceil(item.mark.items.length / ${ncols})`; - update.row.signal = `${index}%${nrows}`; - update.column.signal = `floor(${index} / ${nrows})`; - sort = {field: ['row', index]}; - } else { - update.row.signal = `floor(${index} / ${ncols})`; - update.column.signal = `${index} % ${ncols}`; - sort = {field: index}; - } - // handle zero column case (implies infinite columns) - update.column.signal = `(${columns})?${update.column.signal}:${index}`; - - // facet legend entries into sub-groups - dataRef = {facet: {data: dataRef, name: 'value', groupby: Index}}; - - return guideGroup({ - role: ScopeRole, - from: dataRef, - encode: extendEncode(encode, entries, Skip), - marks: [symbols, labels], - name, - interactive, - sort - }); - } - - function legendSymbolLayout(spec, config) { - const _ = lookup(spec, config); - - // layout parameters for legend entries - return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } - }; - } - - // expression logic for align, anchor, angle, and baseline calculation - const isL = 'item.orient === "left"', - isR = 'item.orient === "right"', - isLR = `(${isL} || ${isR})`, - isVG = `datum.vgrad && ${isLR}`, - baseline = anchorExpr('"top"', '"bottom"', '"middle"'), - alignFlip = anchorExpr('"right"', '"left"', '"center"'), - exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr}`, - exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, - exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, - exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; - - function legendTitle(spec, config, userEncode, dataRef) { - var _ = lookup(spec, config), encode; - - encode = { - enter: {opacity: zero}, - update: { - opacity: one, - x: {field: {group: 'padding'}}, - y: {field: {group: 'padding'}} - }, - exit: {opacity: zero} - }; - - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: {signal: exprAnchor}, - angle: {signal: exprAngle}, - align: {signal: exprAlign}, - baseline: {signal: exprBaseline}, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - baseline: _('titleBaseline') - }); - - return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function clip(clip, scope) { - var expr; - - if (vegaUtil.isObject(clip)) { - if (clip.signal) { - expr = clip.signal; - } else if (clip.path) { - expr = 'pathShape(' + param(clip.path) + ')'; - } else if (clip.sphere) { - expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - } - - return expr - ? scope.signalRef(expr) - : !!clip; - } - - function param(value) { - return vegaUtil.isObject(value) && value.signal - ? value.signal - : vegaUtil.stringValue(value); - } - - function getRole(spec) { - var role = spec.role || ''; - return (!role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title')) - ? role - : spec.type === GroupMark ? ScopeRole : (role || MarkRole); - } - - function definition(spec) { - return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; - } - - function interactive(spec, scope) { - return spec && spec.signal ? scope.signalRef(spec.signal) - : spec === false ? false - : true; - } - - /** - * Parse a data transform specification. - */ - function parseTransform(spec, scope) { - var def = vegaDataflow.definition(spec.type); - if (!def) vegaUtil.error('Unrecognized transform type: ' + vegaUtil.stringValue(spec.type)); - - var t = entry$1(def.type.toLowerCase(), null, parseParameters(def, spec, scope)); - if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; - - return t; - } - - /** - * Parse all parameters of a data transform. - */ - function parseParameters(def, spec, scope) { - var params = {}, pdef, i, n; - for (i=0, n=def.params.length; i spec[s] - ? (scales[s] = spec[s], scale = scale || spec[s]) : 0 - ); - if (!scale) vegaUtil.error('Missing valid scale for legend.'); - - // resolve legend type (symbol, gradient, or discrete gradient) - type = legendType(spec, scope.scaleType(scale)); - - // single-element data source for legend group - datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - dataRef = ref(scope.add(Collect(null, [datum]))); - - // encoding properties for legend group - legendEncode = extendEncode( - buildLegendEncode(_, spec, config), legendEncode, Skip - ); - - // encoding properties for legend entry sub-group - entryEncode = {enter: {x: {value: 0}, y: {value: 0}}}; - - // data source for legend values - entryRef = ref(scope.add(LegendEntries(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // continuous gradient legend - if (type === Gradient) { - children = [ - legendGradient(spec, scale, config, encode.gradient), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - // adjust default tick count based on the gradient length - params.count = params.count || scope.signalRef( - `max(2,2*floor((${deref(_.gradientLength())})/100))` - ); - } - - // discrete gradient legend - else if (type === Discrete) { - children = [ - legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - } - - // symbol legend - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [ - legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns)) - ]; - // pass symbol size information to legend entry generator - params.size = sizeExpression(spec, scope, children[0].marks); - } - - // generate legend marks - children = [ - guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive - }) - ]; - - // include legend title if defined - if (datum.title) { - children.push(legendTitle(spec, config, encode.title, dataRef)); - } - - // parse legend specification - return parseMark( - guideGroup({ - role: LegendRole, - from: dataRef, - encode: legendEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); - } - - function legendType(spec, scaleType) { - var type = spec.type || Symbols; - - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { - type = vegaScale.isContinuous(scaleType) ? Gradient - : vegaScale.isDiscretizing(scaleType) ? Discrete - : Symbols; - } - - return type !== Gradient ? type - : vegaScale.isDiscretizing(scaleType) ? Discrete - : Gradient; - } - - function scaleCount(spec) { - return LegendScales.reduce(function(count, type) { - return count + (spec[type] ? 1 : 0); - }, 0); - } - - function buildLegendEncode(_, spec, config) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; - } - - function sizeExpression(spec, scope, marks) { - var size = deref(getChannel('size', spec, marks)), - strokeWidth = deref(getChannel('strokeWidth', spec, marks)), - fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - - return vegaFunctions.parseExpression( - `max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, - scope - ); - } - - function getChannel(name, spec, marks) { - return spec[name] - ? `scale("${spec[name]}",datum)` - : getEncoding(name, marks[0].encode); - } - - function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); - } - - const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; - - function parseTitle(spec, scope) { - spec = vegaUtil.isString(spec) ? {text: spec} : spec; - - var _ = lookup(spec, scope.config.title), - encode = spec.encode || {}, - userEncode = encode.group || {}, - name = userEncode.name || undefined, - interactive = userEncode.interactive, - style = userEncode.style, - children = [], - datum, dataRef; - - // single-element data source for group title - datum = {}; - dataRef = ref(scope.add(Collect(null, [datum]))); - - // include title text - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); - - // include subtitle text - if (spec.subtitle) { - children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - } - - // parse title specification - return parseMark( - guideGroup({ - role: TitleRole, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); - } - - // provide backwards-compatibility for title custom encode; - // the top-level encode block has been *deprecated*. - function titleEncode(spec) { - const encode = spec.encode; - return (encode && encode.title) || vegaUtil.extend({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); - } - - function groupEncode(_, userEncode) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: {signal: alignExpr}, - angle: {signal: angleExpr}, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') - }); - - return extendEncode(encode, userEncode, Skip); - } - - function buildTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.text, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function buildSubTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.subtitle, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function parseData$1(data, scope) { - var transforms = []; - - if (data.transform) { - data.transform.forEach(function(tx) { - transforms.push(parseTransform(tx, scope)); - }); - } - - if (data.on) { - data.on.forEach(function(on) { - parseTrigger(on, scope, data.name); - }); - } - - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); - } - - /** - * Analyze a data pipeline, add needed operators. - */ - function analyze(data, scope, ops) { - var output = [], - source = null, - modify = false, - generate = false, - upstream, i, n, t, m; - - if (data.values) { - // hard-wired input data set - if (hasSignal(data.values) || hasSignal(data.format)) { - // if either values or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else { - // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format - })); - } - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else { - // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format - })); - } - } else if (data.source) { - // derives from one or more other data sets - source = upstream = vegaUtil.array(data.source).map(function(d) { - return ref(scope.getData(d).output); - }); - output.push(null); // populate later - } - - // scan data transforms, add collectors as needed - for (i=0, n=ops.length; i orient === Bottom || orient === Top; - - // get sign coefficient based on axis orient - const getSign = (orient, a, b) => isSignal(orient) - ? ifLeftTopExpr(orient.signal, a, b) - : orient === Left || orient === Top ? a : b; - - // condition on axis x-direction - const ifX = (orient, a, b) => isSignal(orient) - ? ifXEnc(orient.signal, a, b) - : isX(orient) ? a : b; - - // condition on axis y-direction - const ifY = (orient, a, b) => isSignal(orient) - ? ifYEnc(orient.signal, a, b) - : isX(orient) ? b : a; - - const ifTop = (orient, a, b) => isSignal(orient) - ? ifTopExpr(orient.signal, a, b) - : orient === Top ? {value: a} : {value: b}; - - const ifRight = (orient, a, b) => isSignal(orient) - ? ifRightExpr(orient.signal, a, b) - : orient === Right ? {value: a} : {value: b}; - - const ifXEnc = ($orient, a, b) => ifEnc( - `${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a, b - ); - - const ifYEnc = ($orient, a, b) => ifEnc( - `${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a, b - ); - - const ifLeftTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Left}' || ${$orient} === '${Top}'`, a, b - ); - - const ifTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Top}'`, a, b - ); - - const ifRightExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Right}'`, a, b - ); - - const ifEnc = (test, a, b) => { - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? (a.signal || vegaUtil.stringValue(a.value)) : null; - b = b ? (b.signal || vegaUtil.stringValue(b.value)) : null; - return {signal: `${test} ? (${a}) : (${b})`}; - } else { - // otherwise generate rule set - return [vegaUtil.extend({test}, a)].concat(b || []); - } - }; - - const isSimple = enc => ( - enc == null || Object.keys(enc).length === 1 - ); - - const ifExpr = (test, a, b) => ({ - signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})` - }); - - const ifOrient = ($orient, t, b, l, r) => ({ - signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : '') - + (b != null ? `${$orient} === '${Bottom}' ? (${toExpr(b)}) : ` : '') - + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : '') - + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : '') - + '(null)' - }); - - const toExpr = v => isSignal(v) - ? v.signal - : v == null ? null : vegaUtil.stringValue(v); - - const mult = (sign, value) => value === 0 ? 0 : isSignal(sign) - ? {signal: `(${sign.signal}) * ${value}`} - : {value: sign * value}; - - const patch = (value, base) => { - const s = value.signal; - return s && s.endsWith('(null)') - ? {signal: s.slice(0, -6) + base.signal} - : value; - }; - - function fallback(prop, config, axisConfig, style) { - let styleProp; - - if (config && vegaUtil.hasOwnProperty(config, prop)) { - return config[prop]; - } - else if (vegaUtil.hasOwnProperty(axisConfig, prop)) { - return axisConfig[prop]; - } - else if (prop.startsWith('title')) { - switch (prop) { - case 'titleColor': - styleProp = 'fill'; - break; - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideTitleStyle][styleProp]; - } - else if (prop.startsWith('label')) { - switch (prop) { - case 'labelColor': - styleProp = 'fill'; - break; - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideLabelStyle][styleProp]; - } - - return null; - } - - function keys(objects) { - const map = {}; - for (const obj of objects) { - if (!obj) continue; - for (const key in obj) map[key] = 1; - } - return Object.keys(map); - } - - function axisConfig(spec, scope) { - var config = scope.config, - style = config.style, - axis = config.axis, - band = scope.scaleType(spec.scale) === 'band' && config.axisBand, - orient = spec.orient, - xy, or, key; - - if (isSignal(orient)) { - const xyKeys = keys([ - config.axisX, config.axisY - ]), - orientKeys = keys([ - config.axisTop, config.axisBottom, - config.axisLeft, config.axisRight - ]); - - xy = {}; - for (key of xyKeys) { - xy[key] = ifX( - orient, - fallback(key, config.axisX, axis, style), - fallback(key, config.axisY, axis, style) - ); - } - - or = {}; - for (key of orientKeys) { - or[key] = ifOrient( - orient.signal, - fallback(key, config.axisTop, axis, style), - fallback(key, config.axisBottom, axis, style), - fallback(key, config.axisLeft, axis, style), - fallback(key, config.axisRight, axis, style) - ); - } - } else { - xy = (orient === Top || orient === Bottom) ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; - } - - var result = (xy || or || band) - ? vegaUtil.extend({}, axis, xy, or, band) - : axis; - - return result; - } - - function axisDomain(spec, config, userEncode, dataRef) { - var _ = lookup(spec, config), - orient = spec.orient, - encode, enter, update; - - encode = { - enter: enter = {opacity: zero}, - update: update = {opacity: one}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') - }); - - const pos0 = position(spec, 0); - const pos1 = position(spec, 1); - - enter.x = update.x = ifX(orient, pos0, zero); - enter.x2 = update.x2 = ifX(orient, pos1); - - enter.y = update.y = ifY(orient, pos0, zero); - enter.y2 = update.y2 = ifY(orient, pos1); - - return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode - }, userEncode); - } - - function position(spec, pos) { - return {scale: spec.scale, range: pos}; - } - - function axisGrid(spec, config, userEncode, dataRef, band) { - var _ = lookup(spec, config), - orient = spec.orient, - vscale = spec.gridScale, - sign = getSign(orient, 1, -1), - offset = offsetValue(spec.offset, sign), - encode, enter, exit, update, - tickPos, gridStart, gridEnd, sz; - - encode = { - enter: enter = {opacity: zero}, - update: update = {opacity: one}, - exit: exit = {opacity: zero} - }; - - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') - }); - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - sz = ifX(orient, {signal: 'height'}, {signal: 'width'}); - - gridStart = vscale - ? {scale: vscale, range: 0, mult: sign, offset: offset} - : {value: 0, offset: offset}; - - gridEnd = vscale - ? {scale: vscale, range: 1, mult: sign, offset: offset} - : vegaUtil.extend(sz, {mult: sign, offset: offset}); - - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); - exit.x = ifX(orient, tickPos); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode - }, userEncode); - } - - function offsetValue(offset, sign) { - if (sign === 1) ; else if (!vegaUtil.isObject(offset)) { - offset = isSignal(sign) - ? {signal: `(${sign.signal}) * (${offset || 0})`} - : sign * (offset || 0); - } else { - let entry = offset = vegaUtil.extend({}, offset); - while (entry.mult != null) { - if (!vegaUtil.isObject(entry.mult)) { - entry.mult = isSignal(sign) // no offset if sign === 1 - ? {signal: `(${entry.mult}) * (${sign.signal})`} - : entry.mult * sign; - return offset; - } else { - entry = entry.mult = vegaUtil.extend({}, entry.mult); - } - } - entry.mult = sign; - } - - return offset; - } - - function axisTicks(spec, config, userEncode, dataRef, size, band) { - var _ = lookup(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, exit, update, tickSize, tickPos; - - encode = { - enter: enter = {opacity: zero}, - update: update = {opacity: one}, - exit: exit = {opacity: zero} - }; - - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') - }); - - tickSize = encoder(size); - tickSize.mult = sign; - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - update.y = enter.y = ifX(orient, zero, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); - exit.x = ifX(orient, tickPos); - - update.x = enter.x = ifY(orient, zero, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode - }, userEncode); - } - - function flushExpr(scale, threshold, a, b, c) { - return { - signal: 'flush(range("' + scale + '"), ' - + 'scale("' + scale + '", datum.value), ' - + threshold + ',' + a + ',' + b + ',' + c + ')' - }; - } - - function axisLabels(spec, config, userEncode, dataRef, size, band) { - var _ = lookup(spec, config), - orient = spec.orient, - scale = spec.scale, - sign = getSign(orient, -1, 1), - flush = deref(_('labelFlush')), - flushOffset = deref(_('labelFlushOffset')), - flushOn = flush === 0 || !!flush, - labelAlign = _('labelAlign'), - labelBaseline = _('labelBaseline'), - encode, enter, update, tickSize, tickPos, - align, baseline, bound, overlap, offsetExpr; - - tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; - - tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - - align = ifX(orient, - flushOn - ? flushExpr(scale, flush, '"left"', '"right"', '"center"') - : {value: 'center'}, - ifRight(orient, 'left', 'right') - ); - - baseline = ifX(orient, - ifTop(orient, 'bottom', 'top'), - flushOn - ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') - : {value: 'middle'} - ); - - offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0); - flushOn = flushOn && flushOffset; - - enter = { - opacity: zero, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - - encode = { - enter: enter, - update: update = { - opacity: one, - text: {field: Label}, - x: enter.x, - y: enter.y, - align, - baseline - }, - exit: { - opacity: zero, - x: enter.x, - y: enter.y - } - }; - - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') - }, { - align: labelAlign, - baseline: labelBaseline - }); - - bound = _('labelBound'); - overlap = _('labelOverlap'); - - // if overlap method or bound defined, request label overlap removal - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? {scale, orient, tolerance: bound} : null - } : undefined; - - if (update.align !== align) { - update.align = patch(update.align, align); - } - if (update.baseline !== baseline) { - update.baseline = patch(update.baseline, baseline); - } - - return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); - } - - function axisTitle(spec, config, userEncode, dataRef) { - var _ = lookup(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, update, titlePos; - - encode = { - enter: enter = { - opacity: zero, - anchor: encoder(_('titleAnchor', null)), - align: {signal: alignExpr} - }, - update: update = vegaUtil.extend({}, enter, { - opacity: one, - text: encoder(spec.title) - }), - exit: { - opacity: zero - } - }; - - titlePos = { - signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` - }; - - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero, mult(sign, 90)); - enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), {value: Bottom}); - update.angle = enter.angle; - update.baseline = enter.baseline; - - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); - - return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function autoLayout(_, orient, encode, userEncode) { - const auto = (value, dim) => value != null - ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) - : !has(dim, userEncode) ? true : false; - - const autoY = auto(_('titleX'), 'x'), - autoX = auto(_('titleY'), 'y'); - - encode.enter.auto = autoX === autoY - ? encoder(autoX) - : ifX(orient, encoder(autoX), encoder(autoY)); - } - - function parseAxis(spec, scope) { - var config = axisConfig(spec, scope), - encode = spec.encode || {}, - axisEncode = encode.axis || {}, - name = axisEncode.name || undefined, - interactive = axisEncode.interactive, - style = axisEncode.style, - _ = lookup(spec, config), - band = tickBand(_), - datum, dataRef, ticksRef, size, children; - - // single-element data source for axis group - datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - dataRef = ref(scope.add(Collect({}, [datum]))); - - // encoding properties for axis group item - axisEncode = extendEncode( - buildAxisEncode(_, spec), axisEncode, Skip - ); - - // data source for axis ticks - ticksRef = ref(scope.add(AxisTicks({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // generate axis marks - children = []; - - // include axis gridlines if requested - if (datum.grid) { - children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - } - - // include axis ticks if requested - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } - - // include axis labels if requested - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } - - // include axis domain path if requested - if (datum.domain) { - children.push(axisDomain(spec, config, encode.domain, dataRef)); - } - - // include axis title if defined - if (datum.title) { - children.push(axisTitle(spec, config, encode.title, dataRef)); - } - - // parse axis specification - return parseMark( - guideGroup({ - role: AxisRole, - from: dataRef, - encode: axisEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); - } - - function buildAxisEncode(_, spec) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: {signal: `abs(span(range("${spec.scale}")))`}, - translate: _('translate'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; - } - - function parseScope(spec, scope, preprocessed) { - var signals = vegaUtil.array(spec.signals), - scales = vegaUtil.array(spec.scales); - - // parse signal definitions, if not already preprocessed - if (!preprocessed) signals.forEach(_ => parseSignal(_, scope)); - - // parse cartographic projection definitions - vegaUtil.array(spec.projections).forEach(_ => parseProjection(_, scope)); - - // initialize scale references - scales.forEach(_ => initScale(_, scope)); - - // parse data sources - vegaUtil.array(spec.data).forEach(_ => parseData$1(_, scope)); - - // parse scale definitions - scales.forEach(_ => parseScale(_, scope)); - - // parse signal updates - (preprocessed || signals).forEach(_ => parseSignalUpdates(_, scope)); - - // parse axis definitions - vegaUtil.array(spec.axes).forEach(_ => parseAxis(_, scope)); - - // parse mark definitions - vegaUtil.array(spec.marks).forEach(_ => parseMark(_, scope)); - - // parse legend definitions - vegaUtil.array(spec.legends).forEach(_ => parseLegend(_, scope)); - - // parse title, if defined - if (spec.title) parseTitle(spec.title, scope); - - // parse collected lambda (anonymous) expressions - scope.parseLambdas(); - - return scope; - } - - const rootEncode = spec => extendEncode( - { - enter: { - x: {value: 0}, - y: {value: 0} - }, - update: { - width: {signal: 'width'}, - height: {signal: 'height'} - } - }, - spec - ); - - function parseView(spec, scope) { - const config = scope.config; - - // add scenegraph root - const root = ref(scope.root = scope.add(operator())); - - // parse top-level signal definitions - const signals = collectSignals(spec, config); - signals.forEach(_ => parseSignal(_, scope)); - - // assign description, event, legend, and locale configuration - scope.description = spec.description || config.description; - scope.eventConfig = config.events; - scope.legends = scope.objectProperty(config.legend && config.legend.layout); - scope.locale = config.locale; - - // store root group item - const input = scope.add(Collect()); - - // encode root group item - const encode = scope.add(Encode(parseEncode( - rootEncode(spec.encode), GroupMark, FrameRole, - spec.style, scope, {pulse: ref(input)} - ))); - - // perform view layout - const parent = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) - })); - scope.operators.pop(); - - // parse remainder of specification - scope.pushState(ref(encode), ref(parent), null); - parseScope(spec, scope, signals); - scope.operators.push(parent); - - // bound / render / sieve root item - let op = scope.add(Bound({mark: root, pulse: ref(parent)})); - op = scope.add(Render({pulse: ref(op)})); - op = scope.add(Sieve({pulse: ref(op)})); - - // track metadata for root item - scope.addData('root', new DataScope(scope, input, input, op)); - - return scope; - } - - function signalObject(name, value) { - return value && value.signal - ? { name, update: value.signal } - : { name, value }; - } - - /** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ - function collectSignals(spec, config) { - const _ = name => value(spec[name], config[name]), - signals = [ - signalObject('background', _('background')), - signalObject('autosize', parseAutosize(_('autosize'))), - signalObject('padding', parsePadding(_('padding'))), - signalObject('width', _('width') || 0), - signalObject('height', _('height') || 0) - ], - pre = signals.reduce((p, s) => (p[s.name] = s, p), {}), - map = {}; - - // add spec signal array - vegaUtil.array(spec.signals).forEach(s => { - if (vegaUtil.hasOwnProperty(pre, s.name)) { - // merge if built-in signal - s = vegaUtil.extend(pre[s.name], s); - } else { - // otherwise add to signal list - signals.push(s); - } - map[s.name] = s; - }); - - // add config signal array - vegaUtil.array(config.signals).forEach(s => { - if (!vegaUtil.hasOwnProperty(map, s.name) && !vegaUtil.hasOwnProperty(pre, s.name)) { - // add to signal list if not already defined - signals.push(s); - } - }); - - return signals; - } - - function Scope$1(config, options) { - this.config = config || {}; - this.options = options || {}; - - this.bindings = []; - this.field = {}; - this.signals = {}; - this.lambdas = {}; - this.scales = {}; - this.events = {}; - this.data = {}; - - this.streams = []; - this.updates = []; - this.operators = []; - this.eventConfig = null; - this.locale = null; - - this._id = 0; - this._subid = 0; - this._nextsub = [0]; - - this._parent = []; - this._encode = []; - this._lookup = []; - this._markpath = []; - } - - function Subscope(scope) { - this.config = scope.config; - this.options = scope.options; - this.legends = scope.legends; - - this.field = Object.create(scope.field); - this.signals = Object.create(scope.signals); - this.lambdas = Object.create(scope.lambdas); - this.scales = Object.create(scope.scales); - this.events = Object.create(scope.events); - this.data = Object.create(scope.data); - - this.streams = []; - this.updates = []; - this.operators = []; - - this._id = 0; - this._subid = ++scope._nextsub[0]; - this._nextsub = scope._nextsub; - - this._parent = scope._parent.slice(); - this._encode = scope._encode.slice(); - this._lookup = scope._lookup.slice(); - this._markpath = scope._markpath; - } - - var prototype$1 = Scope$1.prototype = Subscope.prototype; - - // ---- - - prototype$1.parse = function(spec) { - return parseScope(spec, this); - }; - - prototype$1.fork = function() { - return new Subscope(this); - }; - - prototype$1.isSubscope = function() { - return this._subid > 0; - }; - - prototype$1.toRuntime = function() { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; - }; - - prototype$1.id = function() { - return (this._subid ? this._subid + ':' : 0) + this._id++; - }; - - prototype$1.add = function(op) { - this.operators.push(op); - op.id = this.id(); - // if pre-registration references exist, resolve them now - if (op.refs) { - op.refs.forEach(function(ref) { ref.$ref = op.id; }); - op.refs = null; - } - return op; - }; - - prototype$1.proxy = function(op) { - var vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy({value: vref})); - }; - - prototype$1.addStream = function(stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; - }; - - prototype$1.addUpdate = function(update) { - this.updates.push(update); - return update; - }; - - // Apply metadata - prototype$1.finish = function() { - var name, ds; - - // annotate root - if (this.root) this.root.root = true; - - // annotate signals - for (name in this.signals) { - this.signals[name].signal = name; - } - - // annotate scales - for (name in this.scales) { - this.scales[name].scale = name; - } - - // annotate data sets - function annotate(op, name, type) { - var data, list; - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } - } - for (name in this.data) { - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - for (var field in ds.index) { - annotate(ds.index[field], name, 'index:' + field); - } - } - - return this; - }; - - // ---- - - prototype$1.pushState = function(encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve({pulse: encode})))); - this._parent.push(parent); - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - this._markpath.push(-1); - }; - - prototype$1.popState = function() { - this._encode.pop(); - this._parent.pop(); - this._lookup.pop(); - this._markpath.pop(); - }; - - prototype$1.parent = function() { - return vegaUtil.peek(this._parent); - }; - - prototype$1.encode = function() { - return vegaUtil.peek(this._encode); - }; - - prototype$1.lookup = function() { - return vegaUtil.peek(this._lookup); - }; - - prototype$1.markpath = function() { - var p = this._markpath; - return ++p[p.length-1]; - }; - - // ---- - - prototype$1.fieldRef = function(field, name) { - if (vegaUtil.isString(field)) return fieldRef(field, name); - if (!field.signal) { - vegaUtil.error('Unsupported field reference: ' + vegaUtil.stringValue(field)); - } - - var s = field.signal, - f = this.field[s], - params; - - if (!f) { - params = {name: this.signalRef(s)}; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field(params))); - } - return f; - }; - - prototype$1.compareRef = function(cmp) { - function check(_) { - if (isSignal(_)) { - signal = true; - return scope.signalRef(_.signal); - } else if (isExpr(_)) { - signal = true; - return scope.exprRef(_.expr); - } else { - return _; - } - } - - var scope = this, - signal = false, - fields = vegaUtil.array(cmp.field).map(check), - orders = vegaUtil.array(cmp.order).map(check); - - return signal - ? ref(this.add(Compare({fields: fields, orders: orders}))) - : compareRef(fields, orders); - }; - - prototype$1.keyRef = function(fields, flat) { - function check(_) { - if (isSignal(_)) { - signal = true; - return ref(sig[_.signal]); - } else { - return _; - } - } - - var sig = this.signals, - signal = false; - fields = vegaUtil.array(fields).map(check); - - return signal - ? ref(this.add(Key({fields: fields, flat: flat}))) - : keyRef(fields, flat); - }; - - prototype$1.sortRef = function(sort) { - if (!sort) return sort; - - // including id ensures stable sorting - var a = aggrField(sort.op, sort.field), - o = sort.order || Ascending; - - return o.signal - ? ref(this.add(Compare({ - fields: a, - orders: this.signalRef(o.signal) - }))) - : compareRef(a, o); - }; - - // ---- - - prototype$1.event = function(source, type) { - var key = source + ':' + type; - if (!this.events[key]) { - var id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - return this.events[key]; - }; - - // ---- - - prototype$1.hasOwnSignal = function(name) { - return vegaUtil.hasOwnProperty(this.signals, name); - }; - - prototype$1.addSignal = function(name, value) { - if (this.hasOwnSignal(name)) { - vegaUtil.error('Duplicate signal name: ' + vegaUtil.stringValue(name)); - } - var op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; - }; - - prototype$1.getSignal = function(name) { - if (!this.signals[name]) { - vegaUtil.error('Unrecognized signal name: ' + vegaUtil.stringValue(name)); - } - return this.signals[name]; - }; - - prototype$1.signalRef = function(s) { - if (this.signals[s]) { - return ref(this.signals[s]); - } else if (!vegaUtil.hasOwnProperty(this.lambdas, s)) { - this.lambdas[s] = this.add(operator(null)); - } - return ref(this.lambdas[s]); - }; - - prototype$1.parseLambdas = function() { - var code = Object.keys(this.lambdas); - for (var i=0, n=code.length; i 0 ? ',' : '') - + (vegaUtil.isObject(value) - ? (value.signal || propertyLambda(value)) - : vegaUtil.stringValue(value)); - } - return code + ']'; - } - - function objectLambda(obj) { - var code = '{', - i = 0, - key, value; - - for (key in obj) { - value = obj[key]; - code += (++i > 1 ? ',' : '') - + vegaUtil.stringValue(key) + ':' - + (vegaUtil.isObject(value) - ? (value.signal || propertyLambda(value)) - : vegaUtil.stringValue(value)); - } - return code + '}'; - } - - prototype$1.exprRef = function(code, name) { - var params = {expr: vegaFunctions.parseExpression(code, this)}; - if (name) params.expr.$name = name; - return ref(this.add(Expression(params))); - }; - - prototype$1.addBinding = function(name, bind) { - if (!this.bindings) { - vegaUtil.error('Nested signals do not support binding: ' + vegaUtil.stringValue(name)); - } - this.bindings.push(vegaUtil.extend({signal: name}, bind)); - }; - - // ---- - - prototype$1.addScaleProj = function(name, transform) { - if (vegaUtil.hasOwnProperty(this.scales, name)) { - vegaUtil.error('Duplicate scale or projection name: ' + vegaUtil.stringValue(name)); - } - this.scales[name] = this.add(transform); - }; - - prototype$1.addScale = function(name, params) { - this.addScaleProj(name, Scale(params)); - }; - - prototype$1.addProjection = function(name, params) { - this.addScaleProj(name, Projection(params)); - }; - - prototype$1.getScale = function(name) { - if (!this.scales[name]) { - vegaUtil.error('Unrecognized scale name: ' + vegaUtil.stringValue(name)); - } - return this.scales[name]; - }; - - prototype$1.projectionRef = - prototype$1.scaleRef = function(name) { - return ref(this.getScale(name)); - }; - - prototype$1.projectionType = - prototype$1.scaleType = function(name) { - return this.getScale(name).params.type; - }; - - // ---- - - prototype$1.addData = function(name, dataScope) { - if (vegaUtil.hasOwnProperty(this.data, name)) { - vegaUtil.error('Duplicate data set name: ' + vegaUtil.stringValue(name)); - } - return (this.data[name] = dataScope); - }; - - prototype$1.getData = function(name) { - if (!this.data[name]) { - vegaUtil.error('Undefined data set name: ' + vegaUtil.stringValue(name)); - } - return this.data[name]; - }; - - prototype$1.addDataPipeline = function(name, entries) { - if (vegaUtil.hasOwnProperty(this.data, name)) { - vegaUtil.error('Duplicate data set name: ' + vegaUtil.stringValue(name)); - } - return this.addData(name, DataScope.fromEntries(this, entries)); - }; - - /** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ - function defaults() { - const defaultFont = 'sans-serif', - defaultSymbolSize = 30, - defaultStrokeWidth = 2, - defaultColor = '#4c78a8', - black = '#000', - gray = '#888', - lightGray = '#ddd'; - - return { - // default visualization description - description: 'Vega visualization', - - // default padding around visualization - padding: 0, - - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - - // default view background color - // covers the entire view component - background: null, - - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: {allow: ['wheel']} - }, - - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - } - }, - - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 - }, - - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 - }, - - // correction for centering bias - axisBand: { - tickOffset: -0.5 - }, - - // defaults for cartographic projection - projection: { - type: 'mercator' - }, - - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { direction: 'vertical' }, - right: { direction: 'vertical' } - } - }, - - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [1, 0] - }, - symbol: [ - 'circle', - 'square', - 'triangle-up', - 'cross', - 'diamond', - 'triangle-right', - 'triangle-down', - 'triangle-left' - ] - } - }; - } - - function parse$1(spec, config, options) { - if (!vegaUtil.isObject(spec)) { - vegaUtil.error('Input Vega specification must be an object.'); - } - - config = vegaUtil.mergeConfig(defaults(), config, spec.config); - return parseView(spec, new Scope$1(config, options)).toRuntime(); - } - - exports.AxisDomainRole = AxisDomainRole; - exports.AxisGridRole = AxisGridRole; - exports.AxisLabelRole = AxisLabelRole; - exports.AxisRole = AxisRole; - exports.AxisTickRole = AxisTickRole; - exports.AxisTitleRole = AxisTitleRole; - exports.DataScope = DataScope; - exports.FrameRole = FrameRole; - exports.LegendEntryRole = LegendEntryRole; - exports.LegendLabelRole = LegendLabelRole; - exports.LegendRole = LegendRole; - exports.LegendSymbolRole = LegendSymbolRole; - exports.LegendTitleRole = LegendTitleRole; - exports.MarkRole = MarkRole; - exports.Scope = Scope$1; - exports.ScopeRole = ScopeRole; - exports.config = defaults; - exports.parse = parse$1; - exports.signal = parseSignal; - exports.signalUpdates = parseSignalUpdates; - exports.stream = parseStream; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-parser/build/vega-parser.min.js b/node_modules/vega-parser/build/vega-parser.min.js deleted file mode 100644 index 50e8e9d..0000000 --- a/node_modules/vega-parser/build/vega-parser.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-functions"),require("vega-event-selector"),require("vega-scale"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-functions","vega-event-selector","vega-scale","vega-dataflow"],t):t((e=e||self).vega={},e.vega,e.vega,e.vega,e.vega,e.vega)}(this,(function(e,t,n,i,a,r){"use strict";function l(e){return t.isObject(e)?e:{type:e||"pad"}}const o=e=>+e||0;function s(e){return t.isObject(e)?e.signal?e:{top:o(e.top),bottom:o(e.bottom),left:o(e.left),right:o(e.right)}:{top:n=o(e),bottom:n,left:n,right:n};var n}const u=e=>t.isObject(e)&&!t.isArray(e)?t.extend({},e):{value:e};function d(e,n,i,a){return null!=i?(t.isObject(i)&&!t.isArray(i)?e.update[n]=i:e[a||"enter"][n]={value:i},1):0}function c(e,t,n){for(const n in t)d(e,n,t[n]);for(const t in n)d(e,t,n[t],"update")}function f(e,n,i){for(const a in n)i&&t.hasOwnProperty(i,a)||(e[a]=t.extend(e[a]||{},n[a]));return e}function p(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function g(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const m=e=>t.isString(e)?t.stringValue(e):e.signal?`(${e.signal})`:v(e);function h(e){if(null!=e.gradient)return function(e){const n=[e.start,e.stop,e.count].map(e=>null==e?null:t.stringValue(e));for(;n.length&&null==t.peek(n);)n.pop();return n.unshift(m(e.gradient)),`gradient(${n.join(",")})`}(e);let n=e.signal?`(${e.signal})`:e.color?function(e){return e.c?y("hcl",e.h,e.c,e.l):e.h||e.s?y("hsl",e.h,e.s,e.l):e.l||e.a?y("lab",e.l,e.a,e.b):e.r||e.g||e.b?y("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?v(e.field):void 0!==e.value?t.stringValue(e.value):void 0;return null!=e.scale&&(n=function(e,t){const n=m(e.scale);null!=e.range?t=`lerp(_range(${n}), ${+e.range})`:(void 0!==t&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(1==+e.band?"":"*"+b(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0"));return t}(e,n)),void 0===n&&(n=null),null!=e.exponent&&(n=`pow(${n},${b(e.exponent)})`),null!=e.mult&&(n+="*"+b(e.mult)),null!=e.offset&&(n+="+"+b(e.offset)),e.round&&(n=`round(${n})`),n}const y=(e,t,n,i)=>`(${e}(${[t,n,i].map(h).join(",")})+'')`;function b(e){return t.isObject(e)?"("+h(e)+")":e}function v(e){return function e(n){let i,a,r;if(n.signal)i="datum",r=n.signal;else if(n.group||n.parent){for(a=Math.max(1,n.level||1),i="item";a-- >0;)i+=".mark.group";n.parent?(r=n.parent,i+=".datum"):r=n.group}else n.datum?(i="datum",r=n.datum):t.error("Invalid field reference: "+t.stringValue(n));n.signal||(r=t.isString(r)?t.splitAccessPath(r).map(t.stringValue).join("]["):e(r));return i+"["+r+"]"}(t.isObject(e)?e:{datum:e})}function x(e,n,i,a,r,l){const o={};(l=l||{}).encoders={$encode:o},e=function(e,n,i,a,r){const l={},o={};let s,u,d,c;for(u in u="lineBreak","text"!==n||null==r[u]||p(u,e)||g(l,u,r[u]),("legend"==i||String(i).startsWith("axis"))&&(i=null),c="frame"===i?r.group:"mark"===i?t.extend({},r.mark,r[n]):null,c)d=p(u,e)||("fill"===u||"stroke"===u)&&(p("fill",e)||p("stroke",e)),d||g(l,u,c[u]);for(u in t.array(a).forEach(t=>{const n=r.style&&r.style[t];for(const t in n)p(t,e)||g(l,t,n[t])}),e=t.extend({},e),l)c=l[u],c.signal?(s=s||{})[u]=c:o[u]=c;return e.enter=t.extend(o,e.enter),s&&(e.update=t.extend(s,e.update)),e}(e,n,i,a,r.config);for(const t in e)o[t]=k(e[t],n,l,r);return l}function k(e,n,i,a){const r={},l={};for(const n in e)null!=e[n]&&(r[n]=$((o=e[n],t.isArray(o)?function(e){let n="";return e.forEach(e=>{const t=h(e);n+=e.test?`(${e.test})?${t}:`:t}),":"===t.peek(n)&&(n+="null"),n}(o):h(o)),a,i,l));var o;return{$expr:{marktype:n,channels:r},$fields:Object.keys(l),$output:Object.keys(e)}}function $(e,i,a,r){const l=n.parseExpression(e,i);return l.$fields.forEach(e=>r[e]=1),t.extend(a,l.$params),l.$expr}var S=["value","update","init","react","bind"];function O(e,n){t.error(e+' for "outer" push: '+t.stringValue(n))}function R(e,t){var n=e.name;if("outer"===e.push)t.signals[n]||O("No prior signal definition",n),S.forEach((function(t){void 0!==e[t]&&O("Invalid property ",t)}));else{var i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function z(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function w(e,t,n,i){return new z(e,t,n,i)}function j(e,t){return w("operator",e,t)}function W(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function P(e,t){return t?{$field:e,$name:t}:{$field:e}}var D=P("key");function V(e,t){return{$compare:e,$order:t}}function C(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function E(e){return e&&e.signal}function _(e){if(E(e))return!0;if(t.isObject(e))for(var n in e)if(_(e[n]))return!0;return!1}function L(e,t){return null!=e?e:t}function F(e){return e&&e.signal||e}function A(e,n){return(e.merge?T:e.stream?B:e.type?q:t.error("Invalid stream specification: "+t.stringValue(e)))(e,n)}function T(e,t){var n=U({merge:e.merge.map(e=>A(e,t))},e,t);return t.addStream(n).id}function B(e,t){var n=U({stream:A(e.stream,t)},e,t);return t.addStream(n).id}function q(e,t){var n,i,a;return"timer"===e.type?(n=t.event("timer",e.throttle),e={between:e.between,filter:e.filter}):n=t.event("scope"===(a=e.source)?"view":a||"view",e.type),i=U({stream:n},e,t),1===Object.keys(i).length?n:t.addStream(i).id}function U(e,i,a){var r,l,o,s,u=i.between;return u&&(2!==u.length&&t.error('Stream "between" parameter must have 2 entries: '+t.stringValue(i)),e.between=[A(u[0],a),A(u[1],a)]),u=i.filter?[].concat(i.filter):[],(i.marktype||i.markname||i.markrole)&&u.push((r=i.marktype,l=i.markname,o=i.markrole,(s="event.item")+(r&&"*"!==r?"&&"+s+".mark.marktype==='"+r+"'":"")+(o?"&&"+s+".mark.role==='"+o+"'":"")+(l?"&&"+s+".mark.name==='"+l+"'":""))),"scope"===i.source&&u.push("inScope(event.item)"),u.length&&(e.filter=n.parseExpression("("+u.join(")&&(")+")",a).$expr),null!=(u=i.throttle)&&(e.throttle=+u),null!=(u=i.debounce)&&(e.debounce=+u),i.consume&&(e.consume=!0),e}const M={code:"_.$value",ast:{type:"Identifier",value:"value"}};function H(e,a,r){var l=e.events,o=e.update,s=e.encode,u=[],d={target:r};l||t.error("Signal update missing events specification."),t.isString(l)&&(l=i.selector(l,a.isSubscope()?"scope":"view")),l=t.array(l).filter(e=>e.signal||e.scale?(u.push(e),0):1),u.length>1&&(u=[I(u)]),l.length&&u.push(l.length>1?{merge:l}:l[0]),null!=s&&(o&&t.error("Signal encode and update are mutually exclusive."),o="encode(item(),"+t.stringValue(s)+")"),d.update=t.isString(o)?n.parseExpression(o,a):null!=o.expr?n.parseExpression(o.expr,a):null!=o.value?o.value:null!=o.signal?{$expr:M,$params:{$value:a.signalRef(o.signal)}}:t.error("Invalid signal update specification."),e.force&&(d.options={force:!0}),u.forEach((function(e){a.addUpdate(t.extend(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):A(e,t)}}(e,a),d))}))}function I(e){return{signal:"["+e.map(e=>e.scale?'scale("'+e.scale+'")':e.signal)+"]"}}function X(e,i){var a=i.getSignal(e.name),r=e.update;e.init&&(r?t.error("Signals can not include both init and update expressions."):(r=e.init,a.initonly=!0)),r&&(r=n.parseExpression(r,i),a.update=r.$expr,a.params=r.$params),e.on&&e.on.forEach((function(e){H(e,i,a.id)}))}const Y=e=>(t,n,i)=>w(e,n,t||void 0,i);var N=Y("aggregate"),G=Y("axisticks"),Q=Y("bound"),J=Y("collect"),K=Y("compare"),Z=Y("datajoin"),ee=Y("encode"),te=Y("expression"),ne=Y("facet"),ie=Y("field"),ae=Y("key"),re=Y("legendentries"),le=Y("load"),oe=Y("mark"),se=Y("multiextent"),ue=Y("multivalues"),de=Y("overlap"),ce=Y("params"),fe=Y("prefacet"),pe=Y("projection"),ge=Y("proxy"),me=Y("relay"),he=Y("render"),ye=Y("scale"),be=Y("sieve"),ve=Y("sortitems"),xe=Y("viewlayout"),ke=Y("values"),$e=0,Se={min:"min",max:"max",count:"sum"};function Oe(e,n){var i,r,l=n.getScale(e.name).params;for(i in l.domain=je(e.domain,e,n),null!=e.range&&(l.range=function e(n,i,r){var l=n.range,o=i.config.range;if(l.signal)return i.signalRef(l.signal);if(t.isString(l)){if(o&&t.hasOwnProperty(o,l))return n=t.extend({},n,{range:o[l]}),e(n,i,r);"width"===l?l=[0,{signal:"width"}]:"height"===l?l=a.isDiscrete(n.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+t.stringValue(l))}else{if(l.scheme)return r.scheme=t.isArray(l.scheme)?ze(l.scheme,i):Re(l.scheme,i),l.extent&&(r.schemeExtent=ze(l.extent,i)),void(l.count&&(r.schemeCount=Re(l.count,i)));if(l.step)return void(r.rangeStep=Re(l.step,i));if(a.isDiscrete(n.type)&&!t.isArray(l))return je(l,n,i);t.isArray(l)||t.error("Unsupported range type: "+t.stringValue(l))}return l.map(e=>(t.isArray(e)?ze:Re)(e,i))}(e,n,l)),null!=e.interpolate&&function(e,t){t.interpolate=Re(e.type||e),null!=e.gamma&&(t.interpolateGamma=Re(e.gamma))}(e.interpolate,l),null!=e.nice&&(l.nice=(r=e.nice,t.isObject(r)?{interval:Re(r.interval),step:Re(r.step)}:Re(r))),null!=e.bins&&(l.bins=function(e,n){return e.signal||t.isArray(e)?ze(e,n):n.objectProperty(e)}(e.bins,n)),e)t.hasOwnProperty(l,i)||"name"===i||(l[i]=Re(e[i],n))}function Re(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+t.stringValue(e)):e}function ze(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>Re(e,t))}function we(e){t.error("Can not find data set: "+t.stringValue(e))}function je(e,n,i){if(e)return e.signal?i.signalRef(e.signal):(t.isArray(e)?We:e.fields?De:Pe)(e,n,i);null==n.domainMin&&null==n.domainMax||t.error("No scale domain defined for domainMin/domainMax to override.")}function We(e,t,n){return e.map((function(e){return Re(e,n)}))}function Pe(e,t,n){var i=n.getData(e.data);return i||we(e.data),a.isDiscrete(t.type)?i.valuesRef(n,e.field,Ce(e.sort,!1)):a.isQuantile(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function De(e,n,i){var r=e.data,l=e.fields.reduce((function(e,n){return n=t.isString(n)?{data:r,field:n}:t.isArray(n)||n.signal?function(e,n){var i="_:vega:_"+$e++,a=J({});if(t.isArray(e))a.value={$ingest:e};else if(e.signal){var r="setdata("+t.stringValue(i)+","+e.signal+")";a.params.input=n.signalRef(r)}return n.addDataPipeline(i,[a,be({})]),{data:i,field:"data"}}(n,i):n,e.push(n),e}),[]);return(a.isDiscrete(n.type)?Ve:a.isQuantile(n.type)?Ee:_e)(e,i,l)}function Ve(e,t,n){var i,a,r,l,o,s=Ce(e.sort,!0);return i=n.map((function(e){var n=t.getData(e.data);return n||we(e.data),n.countsRef(t,e.field,s)})),a={groupby:D,pulse:i},s&&(r=s.op||"count",o=s.field?C(r,s.field):"count",a.ops=[Se[r]],a.fields=[t.fieldRef(o)],a.as=[o]),r=t.add(N(a)),l=t.add(J({pulse:W(r)})),o=t.add(ke({field:D,sort:t.sortRef(s),pulse:W(l)})),W(o)}function Ce(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field&&e.op&&!Se[e.op]&&t.error("Multiple domain scales can not be sorted using "+e.op):t.error("No field provided for sort aggregate op: "+e.op):t.isObject(e)?e.field="key":e={field:"key"}),e}function Ee(e,t,n){var i=n.map((function(e){var n=t.getData(e.data);return n||we(e.data),n.domainRef(t,e.field)}));return W(t.add(ue({values:i})))}function _e(e,t,n){var i=n.map((function(e){var n=t.getData(e.data);return n||we(e.data),n.extentRef(t,e.field)}));return W(t.add(se({extents:i})))}function Le(e,n,i){return t.isArray(e)?e.map((function(e){return Le(e,n,i)})):t.isObject(e)?e.signal?i.signalRef(e.signal):"fit"===n?e:t.error("Unsupported parameter object: "+t.stringValue(e)):e}const Fe="top",Ae="value",Te=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],Be={name:1,style:1,interactive:1},qe={value:0},Ue={value:1};function Me(e){return e.type="group",e.interactive=e.interactive||!1,e}function He(e,t){const n=(n,i)=>L(e[n],L(t[n],i));return n.isVertical=n=>"vertical"===L(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>L(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>L(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>L(e.columns,L(t.columns,+n.isVertical(!0))),n}function Ie(e,t){var n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function Xe(e,t,n){return`item.anchor === 'start' ? ${e} : item.anchor === 'end' ? ${t} : ${n}`}const Ye=Xe(t.stringValue("left"),t.stringValue("right"),t.stringValue("center"));function Ne(e,n){return n?e?t.isObject(e)?Object.assign({},e,{offset:Ne(e.offset,n)}):{value:e,offset:n}:n:e}function Ge(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=f(e.encode,t,Be)):e.interactive=!1,e}function Qe(e,n,i,a){var r,l,o,s,d,f,p=He(e,i),g=p.isVertical(),m=p.gradientThickness(),h=p.gradientLength();return g?(o=[0,1],s=[0,0],d=m,f=h):(o=[0,0],s=[1,0],d=h,f=m),c(r={enter:l={opacity:qe,x:qe,y:qe,width:u(d),height:u(f)},update:t.extend({},l,{opacity:Ue,fill:{gradient:n,start:o,stop:s}}),exit:{opacity:qe}},{stroke:p("gradientStrokeColor"),strokeWidth:p("gradientStrokeWidth")},{opacity:p("gradientOpacity")}),Ge({type:"rect",role:"legend-gradient",encode:r},a)}function Je(e,n,i,a,r){var l,o,s,d,f,p,g=He(e,i),m=g.isVertical(),h=g.gradientThickness(),y=g.gradientLength(),b="";return m?(s="y",f="y2",d="x",p="width",b="1-"):(s="x",f="x2",d="y",p="height"),(o={opacity:qe,fill:{scale:n,field:Ae}})[s]={signal:b+"datum.perc",mult:y},o[d]=qe,o[f]={signal:b+"datum.perc2",mult:y},o[p]=u(h),c(l={enter:o,update:t.extend({},o,{opacity:Ue}),exit:{opacity:qe}},{stroke:g("gradientStrokeColor"),strokeWidth:g("gradientStrokeWidth")},{opacity:g("gradientOpacity")}),Ge({type:"rect",role:"legend-band",key:Ae,from:r,encode:l},a)}function Ke(e,t,n,i){var a,r,l,o,s,d=He(e,t),f=d.isVertical(),p=u(d.gradientThickness()),g=d.gradientLength(),m=d("labelOverlap"),h="";return c(a={enter:r={opacity:qe},update:l={opacity:Ue,text:{field:"label"}},exit:{opacity:qe}},{fill:d("labelColor"),fillOpacity:d("labelOpacity"),font:d("labelFont"),fontSize:d("labelFontSize"),fontStyle:d("labelFontStyle"),fontWeight:d("labelFontWeight"),limit:L(e.labelLimit,t.gradientLabelLimit)}),f?(r.align={value:"left"},r.baseline=l.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},o="y",s="x",h="1-"):(r.align=l.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},r.baseline={value:"top"},o="x",s="y"),r[o]=l[o]={signal:h+"datum.perc",mult:g},r[s]=l[s]=p,p.offset=L(e.labelOffset,t.gradientLabelOffset)||0,m=m?{separation:d("labelSeparation"),method:m,order:"datum.index"}:void 0,Ge({type:"text",role:"legend-label",style:"guide-label",key:Ae,from:i,encode:a,overlap:m},n)}function Ze(e,t,n,i,a){var r,l,o,s,d,p,g,m=He(e,t),h=n.entries,y=!(!h||!h.interactive),b=h?h.name:void 0,v=m("clipHeight"),x=m("symbolOffset"),k={data:"value"},$={},S=`(${a}) ? datum.offset : datum.size`,O=v?u(v):{field:"size"},R="datum.index",z=`max(1, ${a})`;O.mult=.5,$={enter:r={opacity:qe,x:{signal:S,mult:.5,offset:x},y:O},update:l={opacity:Ue,x:r.x,y:r.y},exit:{opacity:qe}};var w=null,j=null;return e.fill||(w=t.symbolBaseFillColor,j=t.symbolBaseStrokeColor),c($,{fill:m("symbolFillColor",w),shape:m("symbolType"),size:m("symbolSize"),stroke:m("symbolStrokeColor",j),strokeDash:m("symbolDash"),strokeDashOffset:m("symbolDashOffset"),strokeWidth:m("symbolStrokeWidth")},{opacity:m("symbolOpacity")}),Te.forEach((function(t){e[t]&&(l[t]=r[t]={scale:e[t],field:Ae})})),s=Ge({type:"symbol",role:"legend-symbol",key:Ae,from:k,clip:!!v||void 0,encode:$},n.symbols),(o=u(x)).offset=m("labelOffset"),c($={enter:r={opacity:qe,x:{signal:S,offset:o},y:O},update:l={opacity:Ue,text:{field:"label"},x:r.x,y:r.y},exit:{opacity:qe}},{align:m("labelAlign"),baseline:m("labelBaseline"),fill:m("labelColor"),fillOpacity:m("labelOpacity"),font:m("labelFont"),fontSize:m("labelFontSize"),fontStyle:m("labelFontStyle"),fontWeight:m("labelFontWeight"),limit:m("labelLimit")}),d=Ge({type:"text",role:"legend-label",style:"guide-label",key:Ae,from:k,encode:$},n.labels),$={enter:{noBound:{value:!v},width:qe,height:v?u(v):qe,opacity:qe},exit:{opacity:qe},update:l={opacity:Ue,row:{signal:null},column:{signal:null}}},m.isVertical(!0)?(p=`ceil(item.mark.items.length / ${z})`,l.row.signal=`${R}%${p}`,l.column.signal=`floor(${R} / ${p})`,g={field:["row",R]}):(l.row.signal=`floor(${R} / ${z})`,l.column.signal=`${R} % ${z}`,g={field:R}),l.column.signal=`(${a})?${l.column.signal}:${R}`,Me({role:"scope",from:i={facet:{data:i,name:"value",groupby:"index"}},encode:f($,h,Be),marks:[s,d],name:b,interactive:y,sort:g})}const et='item.orient === "left"',tt='item.orient === "right"',nt=`(${et} || ${tt})`,it="datum.vgrad && "+nt,at=Xe('"top"','"bottom"','"middle"'),rt=`datum.vgrad && ${tt} ? (${Xe('"right"','"left"','"center"')}) : (${nt} && !(datum.vgrad && ${et})) ? "left" : ${Ye}`,lt=`item._anchor || (${nt} ? "middle" : "start")`,ot=`${it} ? (${et} ? -90 : 90) : 0`,st=`${nt} ? (datum.vgrad ? (${tt} ? "bottom" : "top") : ${at}) : "top"`;function ut(e,n){var i;return t.isObject(e)&&(e.signal?i=e.signal:e.path?i="pathShape("+dt(e.path)+")":e.sphere&&(i="geoShape("+dt(e.sphere)+', {type: "Sphere"})')),i?n.signalRef(i):!!e}function dt(e){return t.isObject(e)&&e.signal?e.signal:t.stringValue(e)}function ct(e){var t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?"group"===e.type?"scope":t||"mark":t}function ft(e){return{marktype:e.type,name:e.name||void 0,role:e.role||ct(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function pt(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function gt(e,n){var i=r.definition(e.type);i||t.error("Unrecognized transform type: "+t.stringValue(e.type));var a=w(i.type.toLowerCase(),null,mt(i,e,n));return e.signal&&n.addSignal(e.signal,n.proxy(a)),a.metadata=i.metadata||{},a}function mt(e,t,n){var i,a,r,l={};for(a=0,r=e.params.length;ae[t]?($[t]=e[t],S=S||e[t]):0),S||t.error("Missing valid scale for legend."),u=function(e,t){var n=e.type||"symbol";e.type||1!==function(e){return Te.reduce((function(t,n){return t+(e[n]?1:0)}),0)}(e)||!e.fill&&!e.stroke||(n=a.isContinuous(t)?"gradient":a.isDiscretizing(t)?"discrete":"symbol");return"gradient"!==n?n:a.isDiscretizing(t)?"discrete":"gradient"}(e,i.scaleType(S)),d={title:null!=e.title,scales:$,type:u,vgrad:"symbol"!==u&&k.isVertical()},p=W(i.add(J(null,[d]))),y=f(function(e,t,n){var i={enter:{},update:{}};return c(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}(k,e,m),y,Be),r={enter:{x:{value:0},y:{value:0}}},g=W(i.add(re(o={type:u,scale:i.scaleRef(S),count:i.objectProperty(k("tickCount")),limit:i.property(k("symbolLimit")),values:i.objectProperty(e.values),minstep:i.property(e.tickMinStep),formatType:i.property(e.formatType),formatSpecifier:i.property(e.format)}))),"gradient"===u?(s=[Qe(e,S,m,h.gradient),Ke(e,m,h.labels,g)],o.count=o.count||i.signalRef(`max(2,2*floor((${F(k.gradientLength())})/100))`)):"discrete"===u?s=[Je(e,S,m,h.gradient,g),Ke(e,m,h.labels,g)]:(l=function(e,t){const n=He(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,m),s=[Ze(e,m,h,g,F(l.columns))],o.size=function(e,t,i){var a=F(Dt("size",e,i)),r=F(Dt("strokeWidth",e,i)),l=F(function(e,t,n){return Ie("fontSize",e)||function(e,t,n){var i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(i[1].encode,t,"guide-label"));return n.parseExpression(`max(ceil(sqrt(${a})+${r}),${l})`,t)}(e,i,s[0].marks)),s=[Me({role:"legend-entry",from:p,encode:r,marks:s,layout:l,interactive:v})],d.title&&s.push(function(e,t,n,i){var a,r=He(e,t);return c(a={enter:{opacity:qe},update:{opacity:Ue,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:qe}},{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:lt},angle:{signal:ot},align:{signal:rt},baseline:{signal:st},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),Ge({type:"text",role:"legend-title",style:"guide-title",from:i,encode:a},n)}(e,m,h.title,p)),Wt(Me({role:"legend",from:p,encode:y,marks:s,aria:k("aria"),description:k("description"),zindex:k("zindex"),name:b,interactive:v,style:x}),i)}function Dt(e,t,n){return t[e]?`scale("${t[e]}",datum)`:Ie(e,n[0].encode)}Ot.countsRef=function(e,t,n){var i,a,r,l=this.counts||(this.counts={}),o=Rt(t);return null!=o&&(e=this.scope,i=l[o]),i?n&&n.field&&zt(e,i.agg.params,n):(r={groupby:e.fieldRef(t,"key"),pulse:W(this.output)},n&&n.field&&zt(e,r,n),a=e.add(N(r)),i=e.add(J({pulse:W(a)})),i={agg:a,ref:W(i)},null!=o&&(l[o]=i)),i.ref},Ot.tuplesRef=function(){return W(this.values)},Ot.extentRef=function(e,t){return wt(e,this,"extent","extent",t,!1)},Ot.domainRef=function(e,t){return wt(e,this,"domain","values",t,!1)},Ot.valuesRef=function(e,t,n){return wt(e,this,"vals","values",t,n||!0)},Ot.lookupRef=function(e,t){return wt(e,this,"lookup","tupleindex",t,!1)},Ot.indataRef=function(e,t){return wt(e,this,"indata","tupleindex",t,!0,!0)};function Vt(e,n){var i,a,r=He(e=t.isString(e)?{text:e}:e,n.config.title),l=e.encode||{},o=l.group||{},s=o.name||void 0,u=o.interactive,d=o.style,f=[];return i={},a=W(n.add(J(null,[i]))),f.push(function(e,t,n,i){var a={value:0},r=e.text,l={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return c(l,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Ge({type:"text",role:"title-text",style:"group-title",from:i,encode:l},n)}(e,r,function(e){const n=e.encode;return n&&n.title||t.extend({name:e.name,interactive:e.interactive,style:e.style},n)}(e),a)),e.subtitle&&f.push(function(e,t,n,i){var a={value:0},r=e.subtitle,l={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return c(l,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Ge({type:"text",role:"title-subtitle",style:"group-subtitle",from:i,encode:l},n)}(e,r,l.subtitle,a)),Wt(Me({role:"title",from:a,encode:Ct(r,o),marks:f,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:s,interactive:u,style:d}),n)}function Ct(e,t){var n={enter:{},update:{}};return c(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:Ye},angle:{signal:'item.orient==="left"?-90:item.orient==="right"?90:0'},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),f(n,t,Be)}function Et(e,n){var i=[];e.transform&&e.transform.forEach((function(e){i.push(gt(e,n))})),e.on&&e.on.forEach((function(t){jt(t,n,e.name)})),n.addDataPipeline(e.name,function(e,n,i){var a,r,l,o,s,u=[],d=null,c=!1,f=!1;e.values?_(e.values)||_(e.format)?(u.push(Lt(n,e)),u.push(d=_t())):u.push(d=_t({$ingest:e.values,$format:e.format})):e.url?_(e.url)||_(e.format)?(u.push(Lt(n,e)),u.push(d=_t())):u.push(d=_t({$request:e.url,$format:e.format})):e.source&&(d=a=t.array(e.source).map((function(e){return W(n.getData(e).output)})),u.push(null));for(r=0,l=i.length;r"bottom"===e||e===Fe,At=(e,t,n)=>E(e)?Ht(e.signal,t,n):"left"===e||e===Fe?t:n,Tt=(e,t,n)=>E(e)?Ut(e.signal,t,n):Ft(e)?t:n,Bt=(e,t,n)=>E(e)?Mt(e.signal,t,n):Ft(e)?n:t,qt=(e,t,n)=>E(e)?It(e.signal,t,n):e===Fe?{value:t}:{value:n},Ut=(e,t,n)=>Yt(`${e} === 'top' || ${e} === 'bottom'`,t,n),Mt=(e,t,n)=>Yt(`${e} !== 'top' && ${e} !== 'bottom'`,t,n),Ht=(e,t,n)=>Gt(`${e} === 'left' || ${e} === 'top'`,t,n),It=(e,t,n)=>Gt(e+" === 'top'",t,n),Xt=(e,t,n)=>Gt(e+" === 'right'",t,n),Yt=(e,n,i)=>(n=null!=n?u(n):n,i=null!=i?u(i):i,Nt(n)&&Nt(i)?{signal:`${e} ? (${n=n?n.signal||t.stringValue(n.value):null}) : (${i=i?i.signal||t.stringValue(i.value):null})`}:[t.extend({test:e},n)].concat(i||[])),Nt=e=>null==e||1===Object.keys(e).length,Gt=(e,t,n)=>({signal:`${e} ? (${Qt(t)}) : (${Qt(n)})`}),Qt=e=>E(e)?e.signal:null==e?null:t.stringValue(e),Jt=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function Kt(e,n,i,a){let r;if(n&&t.hasOwnProperty(n,e))return n[e];if(t.hasOwnProperty(i,e))return i[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return a["guide-title"][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return a["guide-label"][r]}return null}function Zt(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function en(e,t){return{scale:e.scale,range:t}}function tn(e,n,i,a,r){var l,o,s,u,d,f,p,g,m=He(e,n),h=e.orient,y=e.gridScale,b=At(h,1,-1),v=function(e,n){if(1===n);else if(t.isObject(e)){let i=e=t.extend({},e);for(;null!=i.mult;){if(!t.isObject(i.mult))return i.mult=E(n)?{signal:`(${i.mult}) * (${n.signal})`}:i.mult*n,e;i=i.mult=t.extend({},i.mult)}i.mult=n}else e=E(n)?{signal:`(${n.signal}) * (${e||0})`}:n*(e||0);return e}(e.offset,b);return c(l={enter:o={opacity:qe},update:u={opacity:Ue},exit:s={opacity:qe}},{stroke:m("gridColor"),strokeCap:m("gridCap"),strokeDash:m("gridDash"),strokeDashOffset:m("gridDashOffset"),strokeOpacity:m("gridOpacity"),strokeWidth:m("gridWidth")}),d={scale:e.scale,field:Ae,band:r.band,extra:r.extra,offset:r.offset,round:m("tickRound")},g=Tt(h,{signal:"height"},{signal:"width"}),f=y?{scale:y,range:0,mult:b,offset:v}:{value:0,offset:v},p=y?{scale:y,range:1,mult:b,offset:v}:t.extend(g,{mult:b,offset:v}),o.x=u.x=Tt(h,d,f),o.y=u.y=Bt(h,d,f),o.x2=u.x2=Bt(h,p),o.y2=u.y2=Tt(h,p),s.x=Tt(h,d),s.y=Bt(h,d),Ge({type:"rule",role:"axis-grid",key:Ae,from:a,encode:l},i)}function nn(e,t,n,i,a){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+a+")"}}function an(e,t,n,i,a,r){var l,o,s,d,f,p,g,m,h,y,b=He(e,t),v=e.orient,x=e.scale,k=At(v,-1,1),$=F(b("labelFlush")),S=F(b("labelFlushOffset")),O=0===$||!!$,R=b("labelAlign"),z=b("labelBaseline");return(d=u(a)).mult=k,d.offset=u(b("labelPadding")||0),d.offset.mult=k,f={scale:x,field:Ae,band:.5,offset:Ne(r.offset,b("labelOffset"))},p=Tt(v,O?nn(x,$,'"left"','"right"','"center"'):{value:"center"},((e,t,n)=>E(e)?Xt(e.signal,t,n):"right"===e?{value:t}:{value:n})(v,"left","right")),g=Tt(v,qt(v,"bottom","top"),O?nn(x,$,'"top"','"bottom"','"middle"'):{value:"middle"}),y=nn(x,$,`-(${S})`,S,0),O=O&&S,c(l={enter:o={opacity:qe,x:Tt(v,f,d),y:Bt(v,f,d)},update:s={opacity:Ue,text:{field:"label"},x:o.x,y:o.y,align:p,baseline:g},exit:{opacity:qe,x:o.x,y:o.y}},{dx:!R&&O?Tt(v,y):null,dy:!z&&O?Bt(v,y):null}),c(l,{angle:b("labelAngle"),fill:b("labelColor"),fillOpacity:b("labelOpacity"),font:b("labelFont"),fontSize:b("labelFontSize"),fontWeight:b("labelFontWeight"),fontStyle:b("labelFontStyle"),limit:b("labelLimit"),lineHeight:b("labelLineHeight")},{align:R,baseline:z}),m=b("labelBound"),h=(h=b("labelOverlap"))||m?{separation:b("labelSeparation"),method:h,order:"datum.index",bound:m?{scale:x,orient:v,tolerance:m}:null}:void 0,s.align!==p&&(s.align=Jt(s.align,p)),s.baseline!==g&&(s.baseline=Jt(s.baseline,g)),Ge({type:"text",role:"axis-label",style:"guide-label",key:Ae,from:i,encode:l,overlap:h},n)}function rn(e,n,i,a){var r,l,o,s,d=He(e,n),f=e.orient,g=At(f,-1,1);return r={enter:l={opacity:qe,anchor:u(d("titleAnchor",null)),align:{signal:Ye}},update:o=t.extend({},l,{opacity:Ue,text:u(e.title)}),exit:{opacity:qe}},s={signal:`lerp(range("${e.scale}"), ${Xe(0,1,.5)})`},o.x=Tt(f,s),o.y=Bt(f,s),l.angle=Tt(f,qe,((e,t)=>0===t?0:E(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t})(g,90)),l.baseline=Tt(f,qt(f,"bottom",Fe),{value:"bottom"}),o.angle=l.angle,o.baseline=l.baseline,c(r,{fill:d("titleColor"),fillOpacity:d("titleOpacity"),font:d("titleFont"),fontSize:d("titleFontSize"),fontStyle:d("titleFontStyle"),fontWeight:d("titleFontWeight"),limit:d("titleLimit"),lineHeight:d("titleLineHeight")},{align:d("titleAlign"),angle:d("titleAngle"),baseline:d("titleBaseline")}),function(e,t,n,i){const a=(e,t)=>null!=e?(n.update[t]=Jt(u(e),n.update[t]),!1):!p(t,i),r=a(e("titleX"),"x"),l=a(e("titleY"),"y");n.enter.auto=l===r?u(l):Tt(t,u(l),u(r))}(d,f,r,i),r.update.align=Jt(r.update.align,l.align),r.update.angle=Jt(r.update.angle,l.angle),r.update.baseline=Jt(r.update.baseline,l.baseline),Ge({type:"text",role:"axis-title",style:"guide-title",from:a,encode:r},i)}function ln(e,n){var i,a,r,l,o,s=function(e,n){var i,a,r,l,o,s,u,d,c=n.config,f=c.style,p=c.axis,g="band"===n.scaleType(e.scale)&&c.axisBand,m=e.orient;if(E(m)){const e=Zt([c.axisX,c.axisY]),t=Zt([c.axisTop,c.axisBottom,c.axisLeft,c.axisRight]);for(r of(i={},e))i[r]=Tt(m,Kt(r,c.axisX,p,f),Kt(r,c.axisY,p,f));for(r of(a={},t))a[r]=(l=m.signal,o=Kt(r,c.axisTop,p,f),s=Kt(r,c.axisBottom,p,f),u=Kt(r,c.axisLeft,p,f),d=Kt(r,c.axisRight,p,f),{signal:(null!=u?`${l} === 'left' ? (${Qt(u)}) : `:"")+(null!=s?`${l} === 'bottom' ? (${Qt(s)}) : `:"")+(null!=d?`${l} === 'right' ? (${Qt(d)}) : `:"")+(null!=o?`${l} === 'top' ? (${Qt(o)}) : `:"")+"(null)"})}else i=m===Fe||"bottom"===m?c.axisX:c.axisY,a=c["axis"+m[0].toUpperCase()+m.slice(1)];return i||a||g?t.extend({},p,i,a,g):p}(e,n),d=e.encode||{},p=d.axis||{},g=p.name||void 0,m=p.interactive,h=p.style,y=He(e,s),b=function(e){let n,i,a=e("tickBand"),r=e("tickOffset");return a?a.signal?(n={signal:`(${a.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${a.signal}) === 'extent'`},t.isObject(r)||(r={signal:`(${a.signal}) === 'extent' ? 0 : ${r}`})):"extent"===a?(n=1,i=!0,r=0):(n=.5,i=!1):(n=e("bandPosition"),i=e("tickExtra")),{extra:i,band:n,offset:r}}(y);return i={scale:e.scale,ticks:!!y("ticks"),labels:!!y("labels"),grid:!!y("grid"),domain:!!y("domain"),title:null!=e.title},a=W(n.add(J({},[i]))),p=f(function(e,t){var n={enter:{},update:{}};return c(n,{orient:e("orient"),offset:e("offset")||0,position:L(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}(y,e),p,Be),r=W(n.add(G({scale:n.scaleRef(e.scale),extra:n.property(b.extra),count:n.objectProperty(e.tickCount),values:n.objectProperty(e.values),minstep:n.property(e.tickMinStep),formatType:n.property(e.formatType),formatSpecifier:n.property(e.format)}))),o=[],i.grid&&o.push(tn(e,s,d.grid,r,b)),i.ticks&&(l=y("tickSize"),o.push(function(e,t,n,i,a,r){var l,o,s,d,f,p,g=He(e,t),m=e.orient,h=At(m,-1,1);return c(l={enter:o={opacity:qe},update:d={opacity:Ue},exit:s={opacity:qe}},{stroke:g("tickColor"),strokeCap:g("tickCap"),strokeDash:g("tickDash"),strokeDashOffset:g("tickDashOffset"),strokeOpacity:g("tickOpacity"),strokeWidth:g("tickWidth")}),(f=u(a)).mult=h,p={scale:e.scale,field:Ae,band:r.band,extra:r.extra,offset:r.offset,round:g("tickRound")},d.y=o.y=Tt(m,qe,p),d.y2=o.y2=Tt(m,f),s.x=Tt(m,p),d.x=o.x=Bt(m,qe,p),d.x2=o.x2=Bt(m,f),s.y=Bt(m,p),Ge({type:"rule",role:"axis-tick",key:Ae,from:i,encode:l},n)}(e,s,d.ticks,r,l,b))),i.labels&&(l=i.ticks?l:0,o.push(an(e,s,d.labels,r,l,b))),i.domain&&o.push(function(e,t,n,i){var a,r,l,o=He(e,t),s=e.orient;c(a={enter:r={opacity:qe},update:l={opacity:Ue},exit:{opacity:qe}},{stroke:o("domainColor"),strokeCap:o("domainCap"),strokeDash:o("domainDash"),strokeDashOffset:o("domainDashOffset"),strokeWidth:o("domainWidth"),strokeOpacity:o("domainOpacity")});const u=en(e,0),d=en(e,1);return r.x=l.x=Tt(s,u,qe),r.x2=l.x2=Tt(s,d),r.y=l.y=Bt(s,u,qe),r.y2=l.y2=Bt(s,d),Ge({type:"rule",role:"axis-domain",from:i,encode:a},n)}(e,s,d.domain,a)),i.title&&o.push(rn(e,s,d.title,a)),Wt(Me({role:"axis",from:a,encode:p,marks:o,aria:y("aria"),description:y("description"),zindex:y("zindex"),name:g,interactive:m,style:h}),n)}function on(e,n,i){var r=t.array(e.signals),l=t.array(e.scales);return i||r.forEach(e=>R(e,n)),t.array(e.projections).forEach(e=>function(e,t){var n=t.config.projection||{},i={};for(var a in e)"name"!==a&&(i[a]=Le(e[a],a,t));for(a in n)null==i[a]&&(i[a]=Le(n[a],a,t));t.addProjection(e.name,i)}(e,n)),l.forEach(e=>function(e,n){var i=e.type||"linear";a.isValidScaleType(i)||t.error("Unrecognized scale type: "+t.stringValue(i)),n.addScale(e.name,{type:i,domain:void 0})}(e,n)),t.array(e.data).forEach(e=>Et(e,n)),l.forEach(e=>Oe(e,n)),(i||r).forEach(e=>X(e,n)),t.array(e.axes).forEach(e=>ln(e,n)),t.array(e.marks).forEach(e=>Wt(e,n)),t.array(e.legends).forEach(e=>Pt(e,n)),e.title&&Vt(e.title,n),n.parseLambdas(),n}function sn(e,n){const i=n.config,a=W(n.root=n.add(j())),r=function(e,n){const i=t=>L(e[t],n[t]),a=[un("background",i("background")),un("autosize",l(i("autosize"))),un("padding",s(i("padding"))),un("width",i("width")||0),un("height",i("height")||0)],r=a.reduce((e,t)=>(e[t.name]=t,e),{}),o={};return t.array(e.signals).forEach(e=>{t.hasOwnProperty(r,e.name)?e=t.extend(r[e.name],e):a.push(e),o[e.name]=e}),t.array(n.signals).forEach(e=>{t.hasOwnProperty(o,e.name)||t.hasOwnProperty(r,e.name)||a.push(e)}),a}(e,i);r.forEach(e=>R(e,n)),n.description=e.description||i.description,n.eventConfig=i.events,n.legends=n.objectProperty(i.legend&&i.legend.layout),n.locale=i.locale;const o=n.add(J()),u=n.add(ee(x((e=>f({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e))(e.encode),"group","frame",e.style,n,{pulse:W(o)}))),d=n.add(xe({layout:n.objectProperty(e.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:a,pulse:W(u)}));n.operators.pop(),n.pushState(W(u),W(d),null),on(e,n,r),n.operators.push(d);let c=n.add(Q({mark:a,pulse:W(d)}));return c=n.add(he({pulse:W(c)})),c=n.add(be({pulse:W(c)})),n.addData("root",new St(n,o,o,c)),n}function un(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function dn(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function cn(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}var fn=dn.prototype=cn.prototype;function pn(e){return(t.isArray(e)?gn:mn)(e)}function gn(e){for(var n,i="[",a=0,r=e.length;a0?",":"")+(t.isObject(n)?n.signal||pn(n):t.stringValue(n));return i+"]"}function mn(e){var n,i,a="{",r=0;for(n in e)i=e[n],a+=(++r>1?",":"")+t.stringValue(n)+":"+(t.isObject(i)?i.signal||pn(i):t.stringValue(i));return a+"}"}function hn(){return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:"#4c78a8"},area:{fill:"#4c78a8"},image:null,line:{stroke:"#4c78a8",strokeWidth:2},path:{stroke:"#4c78a8"},rect:{fill:"#4c78a8"},rule:{stroke:"#000"},shape:{stroke:"#4c78a8"},symbol:{fill:"#4c78a8",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11},trail:{fill:"#4c78a8",size:2},style:{"guide-label":{fill:"#000",font:"sans-serif",fontSize:10},"guide-title":{fill:"#000",font:"sans-serif",fontSize:11,fontWeight:"bold"},"group-title":{fill:"#000",font:"sans-serif",fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:"#000",font:"sans-serif",fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:"#ddd"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:"#888",grid:!1,gridWidth:1,gridColor:"#ddd",labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:"#888",tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:"#888",titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}fn.parse=function(e){return on(e,this)},fn.fork=function(){return new cn(this)},fn.isSubscope=function(){return this._subid>0},fn.toRuntime=function(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},fn.id=function(){return(this._subid?this._subid+":":0)+this._id++},fn.add=function(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((function(t){t.$ref=e.id})),e.refs=null),e},fn.proxy=function(e){var t=e instanceof z?W(e):e;return this.add(ge({value:t}))},fn.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},fn.addUpdate=function(e){return this.updates.push(e),e},fn.finish=function(){var e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){var i;e&&((i=e.data||(e.data={}))[t]||(i[t]=[])).push(n)}for(e in this.data)for(var i in n((t=this.data[e]).input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values"),t.index)n(t.index[i],e,"index:"+i);return this},fn.pushState=function(e,t,n){this._encode.push(W(this.add(be({pulse:e})))),this._parent.push(t),this._lookup.push(n?W(this.proxy(n)):null),this._markpath.push(-1)},fn.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},fn.parent=function(){return t.peek(this._parent)},fn.encode=function(){return t.peek(this._encode)},fn.lookup=function(){return t.peek(this._lookup)},fn.markpath=function(){var e=this._markpath;return++e[e.length-1]},fn.fieldRef=function(e,n){if(t.isString(e))return P(e,n);e.signal||t.error("Unsupported field reference: "+t.stringValue(e));var i,a=e.signal,r=this.field[a];return r||(i={name:this.signalRef(a)},n&&(i.as=n),this.field[a]=r=W(this.add(ie(i)))),r},fn.compareRef=function(e){function n(e){return E(e)?(a=!0,i.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(a=!0,i.exprRef(e.expr)):e}var i=this,a=!1,r=t.array(e.field).map(n),l=t.array(e.order).map(n);return a?W(this.add(K({fields:r,orders:l}))):V(r,l)},fn.keyRef=function(e,n){var i=this.signals,a=!1;return e=t.array(e).map((function(e){return E(e)?(a=!0,W(i[e.signal])):e})),a?W(this.add(ae({fields:e,flat:n}))):function(e,t){var n={$key:e};return t&&(n.$flat=!0),n}(e,n)},fn.sortRef=function(e){if(!e)return e;var t=C(e.op,e.field),n=e.order||"ascending";return n.signal?W(this.add(K({fields:t,orders:this.signalRef(n.signal)}))):V(t,n)},fn.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},fn.hasOwnSignal=function(e){return t.hasOwnProperty(this.signals,e)},fn.addSignal=function(e,n){this.hasOwnSignal(e)&&t.error("Duplicate signal name: "+t.stringValue(e));var i=n instanceof z?n:this.add(j(n));return this.signals[e]=i},fn.getSignal=function(e){return this.signals[e]||t.error("Unrecognized signal name: "+t.stringValue(e)),this.signals[e]},fn.signalRef=function(e){return this.signals[e]?W(this.signals[e]):(t.hasOwnProperty(this.lambdas,e)||(this.lambdas[e]=this.add(j(null))),W(this.lambdas[e]))},fn.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,i=e.length;t 0; -}; - -prototype.toRuntime = function() { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; -}; - -prototype.id = function() { - return (this._subid ? this._subid + ':' : 0) + this._id++; -}; - -prototype.add = function(op) { - this.operators.push(op); - op.id = this.id(); - // if pre-registration references exist, resolve them now - if (op.refs) { - op.refs.forEach(function(ref) { ref.$ref = op.id; }); - op.refs = null; - } - return op; -}; - -prototype.proxy = function(op) { - var vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy({value: vref})); -}; - -prototype.addStream = function(stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; -}; - -prototype.addUpdate = function(update) { - this.updates.push(update); - return update; -}; - -// Apply metadata -prototype.finish = function() { - var name, ds; - - // annotate root - if (this.root) this.root.root = true; - - // annotate signals - for (name in this.signals) { - this.signals[name].signal = name; - } - - // annotate scales - for (name in this.scales) { - this.scales[name].scale = name; - } - - // annotate data sets - function annotate(op, name, type) { - var data, list; - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } - } - for (name in this.data) { - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - for (var field in ds.index) { - annotate(ds.index[field], name, 'index:' + field); - } - } - - return this; -}; - -// ---- - -prototype.pushState = function(encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve({pulse: encode})))); - this._parent.push(parent); - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - this._markpath.push(-1); -}; - -prototype.popState = function() { - this._encode.pop(); - this._parent.pop(); - this._lookup.pop(); - this._markpath.pop(); -}; - -prototype.parent = function() { - return peek(this._parent); -}; - -prototype.encode = function() { - return peek(this._encode); -}; - -prototype.lookup = function() { - return peek(this._lookup); -}; - -prototype.markpath = function() { - var p = this._markpath; - return ++p[p.length-1]; -}; - -// ---- - -prototype.fieldRef = function(field, name) { - if (isString(field)) return fieldRef(field, name); - if (!field.signal) { - error('Unsupported field reference: ' + stringValue(field)); - } - - var s = field.signal, - f = this.field[s], - params; - - if (!f) { - params = {name: this.signalRef(s)}; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field(params))); - } - return f; -}; - -prototype.compareRef = function(cmp) { - function check(_) { - if (isSignal(_)) { - signal = true; - return scope.signalRef(_.signal); - } else if (isExpr(_)) { - signal = true; - return scope.exprRef(_.expr); - } else { - return _; - } - } - - var scope = this, - signal = false, - fields = array(cmp.field).map(check), - orders = array(cmp.order).map(check); - - return signal - ? ref(this.add(Compare({fields: fields, orders: orders}))) - : compareRef(fields, orders); -}; - -prototype.keyRef = function(fields, flat) { - function check(_) { - if (isSignal(_)) { - signal = true; - return ref(sig[_.signal]); - } else { - return _; - } - } - - var sig = this.signals, - signal = false; - fields = array(fields).map(check); - - return signal - ? ref(this.add(Key({fields: fields, flat: flat}))) - : keyRef(fields, flat); -}; - -prototype.sortRef = function(sort) { - if (!sort) return sort; - - // including id ensures stable sorting - var a = aggrField(sort.op, sort.field), - o = sort.order || Ascending; - - return o.signal - ? ref(this.add(Compare({ - fields: a, - orders: this.signalRef(o.signal) - }))) - : compareRef(a, o); -}; - -// ---- - -prototype.event = function(source, type) { - var key = source + ':' + type; - if (!this.events[key]) { - var id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - return this.events[key]; -}; - -// ---- - -prototype.hasOwnSignal = function(name) { - return hasOwnProperty(this.signals, name); -}; - -prototype.addSignal = function(name, value) { - if (this.hasOwnSignal(name)) { - error('Duplicate signal name: ' + stringValue(name)); - } - var op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; -}; - -prototype.getSignal = function(name) { - if (!this.signals[name]) { - error('Unrecognized signal name: ' + stringValue(name)); - } - return this.signals[name]; -}; - -prototype.signalRef = function(s) { - if (this.signals[s]) { - return ref(this.signals[s]); - } else if (!hasOwnProperty(this.lambdas, s)) { - this.lambdas[s] = this.add(operator(null)); - } - return ref(this.lambdas[s]); -}; - -prototype.parseLambdas = function() { - var code = Object.keys(this.lambdas); - for (var i=0, n=code.length; i 0 ? ',' : '') - + (isObject(value) - ? (value.signal || propertyLambda(value)) - : stringValue(value)); - } - return code + ']'; -} - -function objectLambda(obj) { - var code = '{', - i = 0, - key, value; - - for (key in obj) { - value = obj[key]; - code += (++i > 1 ? ',' : '') - + stringValue(key) + ':' - + (isObject(value) - ? (value.signal || propertyLambda(value)) - : stringValue(value)); - } - return code + '}'; -} - -prototype.exprRef = function(code, name) { - var params = {expr: parseExpression(code, this)}; - if (name) params.expr.$name = name; - return ref(this.add(Expression(params))); -}; - -prototype.addBinding = function(name, bind) { - if (!this.bindings) { - error('Nested signals do not support binding: ' + stringValue(name)); - } - this.bindings.push(extend({signal: name}, bind)); -}; - -// ---- - -prototype.addScaleProj = function(name, transform) { - if (hasOwnProperty(this.scales, name)) { - error('Duplicate scale or projection name: ' + stringValue(name)); - } - this.scales[name] = this.add(transform); -}; - -prototype.addScale = function(name, params) { - this.addScaleProj(name, Scale(params)); -}; - -prototype.addProjection = function(name, params) { - this.addScaleProj(name, Projection(params)); -}; - -prototype.getScale = function(name) { - if (!this.scales[name]) { - error('Unrecognized scale name: ' + stringValue(name)); - } - return this.scales[name]; -}; - -prototype.projectionRef = -prototype.scaleRef = function(name) { - return ref(this.getScale(name)); -}; - -prototype.projectionType = -prototype.scaleType = function(name) { - return this.getScale(name).params.type; -}; - -// ---- - -prototype.addData = function(name, dataScope) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + stringValue(name)); - } - return (this.data[name] = dataScope); -}; - -prototype.getData = function(name) { - if (!this.data[name]) { - error('Undefined data set name: ' + stringValue(name)); - } - return this.data[name]; -}; - -prototype.addDataPipeline = function(name, entries) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + stringValue(name)); - } - return this.addData(name, DataScope.fromEntries(this, entries)); -}; diff --git a/node_modules/vega-parser/src/config.js b/node_modules/vega-parser/src/config.js deleted file mode 100644 index 8f069a2..0000000 --- a/node_modules/vega-parser/src/config.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ -export default function() { - const defaultFont = 'sans-serif', - defaultSymbolSize = 30, - defaultStrokeWidth = 2, - defaultColor = '#4c78a8', - black = '#000', - gray = '#888', - lightGray = '#ddd'; - - return { - // default visualization description - description: 'Vega visualization', - - // default padding around visualization - padding: 0, - - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - - // default view background color - // covers the entire view component - background: null, - - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: {allow: ['wheel']} - }, - - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - } - }, - - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 - }, - - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 - }, - - // correction for centering bias - axisBand: { - tickOffset: -0.5 - }, - - // defaults for cartographic projection - projection: { - type: 'mercator' - }, - - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { direction: 'vertical' }, - right: { direction: 'vertical' } - } - }, - - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [1, 0] - }, - symbol: [ - 'circle', - 'square', - 'triangle-up', - 'cross', - 'diamond', - 'triangle-right', - 'triangle-down', - 'triangle-left' - ] - } - }; -} diff --git a/node_modules/vega-parser/src/parse.js b/node_modules/vega-parser/src/parse.js deleted file mode 100644 index f13702d..0000000 --- a/node_modules/vega-parser/src/parse.js +++ /dev/null @@ -1,13 +0,0 @@ -import parseView from './parsers/view'; -import Scope from './Scope'; -import defaults from './config'; -import {error, isObject, mergeConfig} from 'vega-util'; - -export default function(spec, config, options) { - if (!isObject(spec)) { - error('Input Vega specification must be an object.'); - } - - config = mergeConfig(defaults(), config, spec.config); - return parseView(spec, new Scope(config, options)).toRuntime(); -} diff --git a/node_modules/vega-parser/src/parsers/autosize.js b/node_modules/vega-parser/src/parsers/autosize.js deleted file mode 100644 index 58ddec0..0000000 --- a/node_modules/vega-parser/src/parsers/autosize.js +++ /dev/null @@ -1,5 +0,0 @@ -import {isObject} from 'vega-util'; - -export default function(spec) { - return isObject(spec) ? spec : {type: spec || 'pad'}; -} diff --git a/node_modules/vega-parser/src/parsers/axis.js b/node_modules/vega-parser/src/parsers/axis.js deleted file mode 100644 index efd436f..0000000 --- a/node_modules/vega-parser/src/parsers/axis.js +++ /dev/null @@ -1,121 +0,0 @@ -import {addEncoders, extendEncode} from './encode/util'; -import axisConfig from './guides/axis-config'; -import axisDomain from './guides/axis-domain'; -import axisGrid from './guides/axis-grid'; -import axisTicks from './guides/axis-ticks'; -import axisLabels from './guides/axis-labels'; -import axisTitle from './guides/axis-title'; -import {Skip} from './guides/constants'; -import guideGroup from './guides/guide-group'; -import {lookup, tickBand} from './guides/guide-util'; -import {AxisRole} from './marks/roles'; -import parseMark from './mark'; -import {AxisTicks, Collect} from '../transforms'; -import {ref, value} from '../util'; - -export default function(spec, scope) { - var config = axisConfig(spec, scope), - encode = spec.encode || {}, - axisEncode = encode.axis || {}, - name = axisEncode.name || undefined, - interactive = axisEncode.interactive, - style = axisEncode.style, - _ = lookup(spec, config), - band = tickBand(_), - datum, dataRef, ticksRef, size, children; - - // single-element data source for axis group - datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - dataRef = ref(scope.add(Collect({}, [datum]))); - - // encoding properties for axis group item - axisEncode = extendEncode( - buildAxisEncode(_, spec), axisEncode, Skip - ); - - // data source for axis ticks - ticksRef = ref(scope.add(AxisTicks({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // generate axis marks - children = []; - - // include axis gridlines if requested - if (datum.grid) { - children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - } - - // include axis ticks if requested - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } - - // include axis labels if requested - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } - - // include axis domain path if requested - if (datum.domain) { - children.push(axisDomain(spec, config, encode.domain, dataRef)); - } - - // include axis title if defined - if (datum.title) { - children.push(axisTitle(spec, config, encode.title, dataRef)); - } - - // parse axis specification - return parseMark( - guideGroup({ - role: AxisRole, - from: dataRef, - encode: axisEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); -} - -function buildAxisEncode(_, spec) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: {signal: `abs(span(range("${spec.scale}")))`}, - translate: _('translate'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; -} diff --git a/node_modules/vega-parser/src/parsers/data.js b/node_modules/vega-parser/src/parsers/data.js deleted file mode 100644 index d0cf8ad..0000000 --- a/node_modules/vega-parser/src/parsers/data.js +++ /dev/null @@ -1,116 +0,0 @@ -import parseTransform from './transform'; -import parseTrigger from './trigger'; -import {Collect, Load, Relay, Sieve} from '../transforms'; -import {hasSignal, ref} from '../util'; -import {array} from 'vega-util'; - -export default function parseData(data, scope) { - var transforms = []; - - if (data.transform) { - data.transform.forEach(function(tx) { - transforms.push(parseTransform(tx, scope)); - }); - } - - if (data.on) { - data.on.forEach(function(on) { - parseTrigger(on, scope, data.name); - }); - } - - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); -} - -/** - * Analyze a data pipeline, add needed operators. - */ -function analyze(data, scope, ops) { - var output = [], - source = null, - modify = false, - generate = false, - upstream, i, n, t, m; - - if (data.values) { - // hard-wired input data set - if (hasSignal(data.values) || hasSignal(data.format)) { - // if either values or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else { - // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format - })); - } - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else { - // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format - })); - } - } else if (data.source) { - // derives from one or more other data sets - source = upstream = array(data.source).map(function(d) { - return ref(scope.getData(d).output); - }); - output.push(null); // populate later - } - - // scan data transforms, add collectors as needed - for (i=0, n=ops.length; i fields[name] = 1); - extend(params, expr.$params); - return expr.$expr; -} diff --git a/node_modules/vega-parser/src/parsers/encode/defaults.js b/node_modules/vega-parser/src/parsers/encode/defaults.js deleted file mode 100644 index 49ea49e..0000000 --- a/node_modules/vega-parser/src/parsers/encode/defaults.js +++ /dev/null @@ -1,64 +0,0 @@ -import {has} from './util'; -import {FrameRole, MarkRole} from '../marks/roles'; -import {array, extend} from 'vega-util'; - -export default function(encode, type, role, style, config) { - const defaults = {}, enter = {}; - let update, key, skip, props; - - // if text mark, apply global lineBreak settings (#2370) - key = 'lineBreak'; - if (type === 'text' && config[key] != null && !has(key, encode)) { - applyDefault(defaults, key, config[key]); - } - - // ignore legend and axis roles - if (role == 'legend' || String(role).startsWith('axis')) { - role = null; - } - - // resolve mark config - props = role === FrameRole ? config.group - : (role === MarkRole) ? extend({}, config.mark, config[type]) - : null; - - for (key in props) { - // do not apply defaults if relevant fields are defined - skip = has(key, encode) - || (key === 'fill' || key === 'stroke') - && (has('fill', encode) || has('stroke', encode)); - - if (!skip) applyDefault(defaults, key, props[key]); - } - - // resolve styles, apply with increasing precedence - array(style).forEach(name => { - const props = config.style && config.style[name]; - for (const key in props) { - if (!has(key, encode)) { - applyDefault(defaults, key, props[key]); - } - } - }); - - encode = extend({}, encode); // defensive copy - for (key in defaults) { - props = defaults[key]; - if (props.signal) { - (update = update || {})[key] = props; - } else { - enter[key] = props; - } - } - - encode.enter = extend(enter, encode.enter); - if (update) encode.update = extend(update, encode.update); - - return encode; -} - -function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal - ? {signal: value.signal} - : {value: value}; -} diff --git a/node_modules/vega-parser/src/parsers/encode/entry.js b/node_modules/vega-parser/src/parsers/encode/entry.js deleted file mode 100644 index 2d960e8..0000000 --- a/node_modules/vega-parser/src/parsers/encode/entry.js +++ /dev/null @@ -1,137 +0,0 @@ -import {error, isObject, isString, peek, splitAccessPath, stringValue} from 'vega-util'; - -const scaleRef = scale => isString(scale) ? stringValue(scale) - : scale.signal ? `(${scale.signal})` - : field(scale); - -export default function entry(enc) { - if (enc.gradient != null) { - return gradient(enc); - } - - let value = enc.signal ? `(${enc.signal})` - : enc.color ? color(enc.color) - : enc.field != null ? field(enc.field) - : enc.value !== undefined ? stringValue(enc.value) - : undefined; - - if (enc.scale != null) { - value = scale(enc, value); - } - - if (value === undefined) { - value = null; - } - - if (enc.exponent != null) { - value = `pow(${value},${property(enc.exponent)})`; - } - - if (enc.mult != null) { - value += `*${property(enc.mult)}`; - } - - if (enc.offset != null) { - value += `+${property(enc.offset)}`; - } - - if (enc.round) { - value = `round(${value})`; - } - - return value; -} - -const _color = (type, x, y, z) => - `(${type}(${[x, y, z].map(entry).join(',')})+'')`; - -function color(enc) { - return (enc.c) ? _color('hcl', enc.h, enc.c, enc.l) - : (enc.h || enc.s) ? _color('hsl', enc.h, enc.s, enc.l) - : (enc.l || enc.a) ? _color('lab', enc.l, enc.a, enc.b) - : (enc.r || enc.g || enc.b) ? _color('rgb', enc.r, enc.g, enc.b) - : null; -} - -function gradient(enc) { - // map undefined to null; expression lang does not allow undefined - const args = [enc.start, enc.stop, enc.count] - .map(_ => _ == null ? null : stringValue(_)); - - // trim null inputs from the end - while (args.length && peek(args) == null) args.pop(); - - args.unshift(scaleRef(enc.gradient)); - return `gradient(${args.join(',')})`; -} - -function property(property) { - return isObject(property) ? '(' + entry(property) + ')' : property; -} - -function field(ref) { - return resolveField(isObject(ref) ? ref : {datum: ref}); -} - -function resolveField(ref) { - let object, level, field; - - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - - while (level-- > 0) { - object += '.mark.group'; - } - - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else { - field = ref.group; - } - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else { - error('Invalid field reference: ' + stringValue(ref)); - } - - if (!ref.signal) { - field = isString(field) - ? splitAccessPath(field).map(stringValue).join('][') - : resolveField(field); - } - - return object + '[' + field + ']'; -} - -function scale(enc, value) { - const scale = scaleRef(enc.scale); - - if (enc.range != null) { - // pull value from scale range - value = `lerp(_range(${scale}), ${+enc.range})`; - } else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = `_scale(${scale}, ${value})`; - - if (enc.band) { - value = (value ? value + '+' : '') - + `_bandwidth(${scale})` - + (+enc.band === 1 ? '' : '*' + property(enc.band)); - - if (enc.extra) { - // include logic to handle extraneous elements - value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`; - } - } - - if (value == null) value = '0'; - } - - return value; -} diff --git a/node_modules/vega-parser/src/parsers/encode/rule.js b/node_modules/vega-parser/src/parsers/encode/rule.js deleted file mode 100644 index da0b655..0000000 --- a/node_modules/vega-parser/src/parsers/encode/rule.js +++ /dev/null @@ -1,18 +0,0 @@ -import entry from './entry'; -import {peek} from 'vega-util'; - -export default function(enc) { - let code = ''; - - enc.forEach(rule => { - const value = entry(rule); - code += rule.test ? `(${rule.test})?${value}:` : value; - }); - - // if no else clause, terminate with null (#1366) - if (peek(code) === ':') { - code += 'null'; - } - - return code; -} diff --git a/node_modules/vega-parser/src/parsers/encode/util.js b/node_modules/vega-parser/src/parsers/encode/util.js deleted file mode 100644 index d395f01..0000000 --- a/node_modules/vega-parser/src/parsers/encode/util.js +++ /dev/null @@ -1,43 +0,0 @@ -import {extend, hasOwnProperty, isArray, isObject} from 'vega-util'; - -export const encoder = _ => isObject(_) && !isArray(_) - ? extend({}, _) - : {value: _}; - -export function addEncode(object, name, value, set) { - if (value != null) { - // Always assign signal to update, even if the signal is from the enter block - if (isObject(value) && !isArray(value)) { - object.update[name] = value; - } else { - object[set || 'enter'][name] = {value: value}; - } - return 1; - } else { - return 0; - } -} - -export function addEncoders(object, enter, update) { - for (const name in enter) { - addEncode(object, name, enter[name]); - } - for (const name in update) { - addEncode(object, name, update[name], 'update'); - } -} - -export function extendEncode(encode, extra, skip) { - for (const name in extra) { - if (skip && hasOwnProperty(skip, name)) continue; - encode[name] = extend(encode[name] || {}, extra[name]); - } - return encode; -} - -export function has(key, encode) { - return encode && ( - (encode.enter && encode.enter[key]) || - (encode.update && encode.update[key]) - ); -} diff --git a/node_modules/vega-parser/src/parsers/guides/axis-config.js b/node_modules/vega-parser/src/parsers/guides/axis-config.js deleted file mode 100644 index d27a4ee..0000000 --- a/node_modules/vega-parser/src/parsers/guides/axis-config.js +++ /dev/null @@ -1,97 +0,0 @@ -import {ifOrient, ifX} from './axis-util'; -import {Bottom, GuideLabelStyle, GuideTitleStyle, Top} from './constants'; -import {isSignal} from '../../util'; -import {extend, hasOwnProperty} from 'vega-util'; - -function fallback(prop, config, axisConfig, style) { - let styleProp; - - if (config && hasOwnProperty(config, prop)) { - return config[prop]; - } - else if (hasOwnProperty(axisConfig, prop)) { - return axisConfig[prop]; - } - else if (prop.startsWith('title')) { - switch (prop) { - case 'titleColor': - styleProp = 'fill'; - break; - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideTitleStyle][styleProp]; - } - else if (prop.startsWith('label')) { - switch (prop) { - case 'labelColor': - styleProp = 'fill'; - break; - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideLabelStyle][styleProp]; - } - - return null; -} - -function keys(objects) { - const map = {}; - for (const obj of objects) { - if (!obj) continue; - for (const key in obj) map[key] = 1; - } - return Object.keys(map); -} - -export default function(spec, scope) { - var config = scope.config, - style = config.style, - axis = config.axis, - band = scope.scaleType(spec.scale) === 'band' && config.axisBand, - orient = spec.orient, - xy, or, key; - - if (isSignal(orient)) { - const xyKeys = keys([ - config.axisX, config.axisY - ]), - orientKeys = keys([ - config.axisTop, config.axisBottom, - config.axisLeft, config.axisRight - ]); - - xy = {}; - for (key of xyKeys) { - xy[key] = ifX( - orient, - fallback(key, config.axisX, axis, style), - fallback(key, config.axisY, axis, style) - ); - } - - or = {}; - for (key of orientKeys) { - or[key] = ifOrient( - orient.signal, - fallback(key, config.axisTop, axis, style), - fallback(key, config.axisBottom, axis, style), - fallback(key, config.axisLeft, axis, style), - fallback(key, config.axisRight, axis, style) - ); - } - } else { - xy = (orient === Top || orient === Bottom) ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; - } - - var result = (xy || or || band) - ? extend({}, axis, xy, or, band) - : axis; - - return result; -} diff --git a/node_modules/vega-parser/src/parsers/guides/axis-domain.js b/node_modules/vega-parser/src/parsers/guides/axis-domain.js deleted file mode 100644 index 53d96c7..0000000 --- a/node_modules/vega-parser/src/parsers/guides/axis-domain.js +++ /dev/null @@ -1,48 +0,0 @@ -import {ifX, ifY} from './axis-util'; -import {one, zero} from './constants'; -import guideMark from './guide-mark'; -import {lookup} from './guide-util'; -import {addEncoders} from '../encode/util'; -import {RuleMark} from '../marks/marktypes'; -import {AxisDomainRole} from '../marks/roles'; - -export default function(spec, config, userEncode, dataRef) { - var _ = lookup(spec, config), - orient = spec.orient, - encode, enter, update; - - encode = { - enter: enter = {opacity: zero}, - update: update = {opacity: one}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') - }); - - const pos0 = position(spec, 0); - const pos1 = position(spec, 1); - - enter.x = update.x = ifX(orient, pos0, zero); - enter.x2 = update.x2 = ifX(orient, pos1); - - enter.y = update.y = ifY(orient, pos0, zero); - enter.y2 = update.y2 = ifY(orient, pos1); - - return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode - }, userEncode); -} - -function position(spec, pos) { - return {scale: spec.scale, range: pos}; -} diff --git a/node_modules/vega-parser/src/parsers/guides/axis-grid.js b/node_modules/vega-parser/src/parsers/guides/axis-grid.js deleted file mode 100644 index cec2848..0000000 --- a/node_modules/vega-parser/src/parsers/guides/axis-grid.js +++ /dev/null @@ -1,93 +0,0 @@ -import {getSign, ifX, ifY} from './axis-util'; -import {Value, one, zero} from './constants'; -import guideMark from './guide-mark'; -import {lookup} from './guide-util'; -import {addEncoders} from '../encode/util'; -import {RuleMark} from '../marks/marktypes'; -import {AxisGridRole} from '../marks/roles'; -import {isSignal} from '../../util'; -import {extend, isObject} from 'vega-util'; - -export default function(spec, config, userEncode, dataRef, band) { - var _ = lookup(spec, config), - orient = spec.orient, - vscale = spec.gridScale, - sign = getSign(orient, 1, -1), - offset = offsetValue(spec.offset, sign), - encode, enter, exit, update, - tickPos, gridStart, gridEnd, sz; - - encode = { - enter: enter = {opacity: zero}, - update: update = {opacity: one}, - exit: exit = {opacity: zero} - }; - - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') - }); - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - sz = ifX(orient, {signal: 'height'}, {signal: 'width'}); - - gridStart = vscale - ? {scale: vscale, range: 0, mult: sign, offset: offset} - : {value: 0, offset: offset}; - - gridEnd = vscale - ? {scale: vscale, range: 1, mult: sign, offset: offset} - : extend(sz, {mult: sign, offset: offset}); - - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); - exit.x = ifX(orient, tickPos); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode - }, userEncode); -} - -function offsetValue(offset, sign) { - if (sign === 1) { - // no further adjustment needed, just return offset - } else if (!isObject(offset)) { - offset = isSignal(sign) - ? {signal: `(${sign.signal}) * (${offset || 0})`} - : sign * (offset || 0); - } else { - let entry = offset = extend({}, offset); - while (entry.mult != null) { - if (!isObject(entry.mult)) { - entry.mult = isSignal(sign) // no offset if sign === 1 - ? {signal: `(${entry.mult}) * (${sign.signal})`} - : entry.mult * sign; - return offset; - } else { - entry = entry.mult = extend({}, entry.mult); - } - } - entry.mult = sign; - } - - return offset; -} diff --git a/node_modules/vega-parser/src/parsers/guides/axis-labels.js b/node_modules/vega-parser/src/parsers/guides/axis-labels.js deleted file mode 100644 index 756736c..0000000 --- a/node_modules/vega-parser/src/parsers/guides/axis-labels.js +++ /dev/null @@ -1,130 +0,0 @@ -import {getSign, ifRight, ifTop, ifX, ifY, patch} from './axis-util'; -import {GuideLabelStyle, Label, Value, one, zero} from './constants'; -import guideMark from './guide-mark'; -import {extendOffset, lookup} from './guide-util'; -import {addEncoders, encoder} from '../encode/util'; -import {TextMark} from '../marks/marktypes'; -import {AxisLabelRole} from '../marks/roles'; -import {deref} from '../../util'; - -function flushExpr(scale, threshold, a, b, c) { - return { - signal: 'flush(range("' + scale + '"), ' - + 'scale("' + scale + '", datum.value), ' - + threshold + ',' + a + ',' + b + ',' + c + ')' - }; -} - -export default function(spec, config, userEncode, dataRef, size, band) { - var _ = lookup(spec, config), - orient = spec.orient, - scale = spec.scale, - sign = getSign(orient, -1, 1), - flush = deref(_('labelFlush')), - flushOffset = deref(_('labelFlushOffset')), - flushOn = flush === 0 || !!flush, - labelAlign = _('labelAlign'), - labelBaseline = _('labelBaseline'), - encode, enter, update, tickSize, tickPos, - align, baseline, bound, overlap, offsetExpr; - - tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; - - tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - - align = ifX(orient, - flushOn - ? flushExpr(scale, flush, '"left"', '"right"', '"center"') - : {value: 'center'}, - ifRight(orient, 'left', 'right') - ); - - baseline = ifX(orient, - ifTop(orient, 'bottom', 'top'), - flushOn - ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') - : {value: 'middle'} - ); - - offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0); - flushOn = flushOn && flushOffset; - - enter = { - opacity: zero, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - - encode = { - enter: enter, - update: update = { - opacity: one, - text: {field: Label}, - x: enter.x, - y: enter.y, - align, - baseline - }, - exit: { - opacity: zero, - x: enter.x, - y: enter.y - } - }; - - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') - }, { - align: labelAlign, - baseline: labelBaseline - }); - - bound = _('labelBound'); - overlap = _('labelOverlap'); - - // if overlap method or bound defined, request label overlap removal - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? {scale, orient, tolerance: bound} : null - } : undefined; - - if (update.align !== align) { - update.align = patch(update.align, align); - } - if (update.baseline !== baseline) { - update.baseline = patch(update.baseline, baseline); - } - - return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); -} diff --git a/node_modules/vega-parser/src/parsers/guides/axis-ticks.js b/node_modules/vega-parser/src/parsers/guides/axis-ticks.js deleted file mode 100644 index e4066f8..0000000 --- a/node_modules/vega-parser/src/parsers/guides/axis-ticks.js +++ /dev/null @@ -1,57 +0,0 @@ -import {getSign, ifX, ifY} from './axis-util'; -import {Value, one, zero} from './constants'; -import guideMark from './guide-mark'; -import {lookup} from './guide-util'; -import {addEncoders, encoder} from '../encode/util'; -import {RuleMark} from '../marks/marktypes'; -import {AxisTickRole} from '../marks/roles'; - -export default function(spec, config, userEncode, dataRef, size, band) { - var _ = lookup(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, exit, update, tickSize, tickPos; - - encode = { - enter: enter = {opacity: zero}, - update: update = {opacity: one}, - exit: exit = {opacity: zero} - }; - - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') - }); - - tickSize = encoder(size); - tickSize.mult = sign; - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - update.y = enter.y = ifX(orient, zero, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); - exit.x = ifX(orient, tickPos); - - update.x = enter.x = ifY(orient, zero, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode - }, userEncode); -} diff --git a/node_modules/vega-parser/src/parsers/guides/axis-title.js b/node_modules/vega-parser/src/parsers/guides/axis-title.js deleted file mode 100644 index e05a5c2..0000000 --- a/node_modules/vega-parser/src/parsers/guides/axis-title.js +++ /dev/null @@ -1,82 +0,0 @@ -import {getSign, ifTop, ifX, ifY, mult, patch} from './axis-util'; -import {Bottom, GuideTitleStyle, Top, one, zero} from './constants'; -import guideMark from './guide-mark'; -import {alignExpr, anchorExpr, lookup} from './guide-util'; -import {addEncoders, encoder, has} from '../encode/util'; -import {TextMark} from '../marks/marktypes'; -import {AxisTitleRole} from '../marks/roles'; -import {extend} from 'vega-util'; - -export default function(spec, config, userEncode, dataRef) { - var _ = lookup(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, update, titlePos; - - encode = { - enter: enter = { - opacity: zero, - anchor: encoder(_('titleAnchor', null)), - align: {signal: alignExpr} - }, - update: update = extend({}, enter, { - opacity: one, - text: encoder(spec.title) - }), - exit: { - opacity: zero - } - }; - - titlePos = { - signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` - }; - - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero, mult(sign, 90)); - enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), {value: Bottom}); - update.angle = enter.angle; - update.baseline = enter.baseline; - - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); - - return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); -} - -function autoLayout(_, orient, encode, userEncode) { - const auto = (value, dim) => value != null - ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) - : !has(dim, userEncode) ? true : false; - - const autoY = auto(_('titleX'), 'x'), - autoX = auto(_('titleY'), 'y'); - - encode.enter.auto = autoX === autoY - ? encoder(autoX) - : ifX(orient, encoder(autoX), encoder(autoY)); -} diff --git a/node_modules/vega-parser/src/parsers/guides/axis-util.js b/node_modules/vega-parser/src/parsers/guides/axis-util.js deleted file mode 100644 index 6373d96..0000000 --- a/node_modules/vega-parser/src/parsers/guides/axis-util.js +++ /dev/null @@ -1,96 +0,0 @@ -import {extend, stringValue} from 'vega-util'; -import {Bottom, Left, Right, Top} from './constants'; -import {encoder} from '../encode/util'; -import {isSignal} from '../../util'; - -const isX = orient => orient === Bottom || orient === Top; - -// get sign coefficient based on axis orient -export const getSign = (orient, a, b) => isSignal(orient) - ? ifLeftTopExpr(orient.signal, a, b) - : orient === Left || orient === Top ? a : b; - -// condition on axis x-direction -export const ifX = (orient, a, b) => isSignal(orient) - ? ifXEnc(orient.signal, a, b) - : isX(orient) ? a : b; - -// condition on axis y-direction -export const ifY = (orient, a, b) => isSignal(orient) - ? ifYEnc(orient.signal, a, b) - : isX(orient) ? b : a; - -export const ifTop = (orient, a, b) => isSignal(orient) - ? ifTopExpr(orient.signal, a, b) - : orient === Top ? {value: a} : {value: b}; - -export const ifRight = (orient, a, b) => isSignal(orient) - ? ifRightExpr(orient.signal, a, b) - : orient === Right ? {value: a} : {value: b}; - -const ifXEnc = ($orient, a, b) => ifEnc( - `${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a, b -); - -const ifYEnc = ($orient, a, b) => ifEnc( - `${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a, b -); - -const ifLeftTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Left}' || ${$orient} === '${Top}'`, a, b -); - -const ifTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Top}'`, a, b -); - -const ifRightExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Right}'`, a, b -); - -const ifEnc = (test, a, b) => { - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? (a.signal || stringValue(a.value)) : null; - b = b ? (b.signal || stringValue(b.value)) : null; - return {signal: `${test} ? (${a}) : (${b})`}; - } else { - // otherwise generate rule set - return [extend({test}, a)].concat(b || []); - } -}; - -const isSimple = enc => ( - enc == null || Object.keys(enc).length === 1 -); - -const ifExpr = (test, a, b) => ({ - signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})` -}); - -export const ifOrient = ($orient, t, b, l, r) => ({ - signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : '') - + (b != null ? `${$orient} === '${Bottom}' ? (${toExpr(b)}) : ` : '') - + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : '') - + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : '') - + '(null)' -}); - -const toExpr = v => isSignal(v) - ? v.signal - : v == null ? null : stringValue(v); - -export const mult = (sign, value) => value === 0 ? 0 : isSignal(sign) - ? {signal: `(${sign.signal}) * ${value}`} - : {value: sign * value}; - -export const patch = (value, base) => { - const s = value.signal; - return s && s.endsWith('(null)') - ? {signal: s.slice(0, -6) + base.signal} - : value; -}; diff --git a/node_modules/vega-parser/src/parsers/guides/constants.js b/node_modules/vega-parser/src/parsers/guides/constants.js deleted file mode 100644 index c4a5d57..0000000 --- a/node_modules/vega-parser/src/parsers/guides/constants.js +++ /dev/null @@ -1,56 +0,0 @@ -export const Top = 'top'; -export const Left = 'left'; -export const Right = 'right'; -export const Bottom = 'bottom'; -export const Center = 'center'; - -export const Vertical = 'vertical'; - -export const Start = 'start'; -export const Middle = 'middle'; -export const End = 'end'; - -export const Index = 'index'; -export const Label = 'label'; -export const Offset = 'offset'; -export const Perc = 'perc'; -export const Perc2 = 'perc2'; -export const Value = 'value'; - -export const GuideLabelStyle = 'guide-label'; -export const GuideTitleStyle = 'guide-title'; -export const GroupTitleStyle = 'group-title'; -export const GroupSubtitleStyle = 'group-subtitle'; - -export const Symbols = 'symbol'; -export const Gradient = 'gradient'; -export const Discrete = 'discrete'; - -export const Size = 'size'; -export const Shape = 'shape'; -export const Fill = 'fill'; -export const Stroke = 'stroke'; -export const StrokeWidth = 'strokeWidth'; -export const StrokeDash = 'strokeDash'; -export const Opacity = 'opacity'; - -// Encoding channels supported by legends -// In priority order of 'canonical' scale -export const LegendScales = [ - Size, - Shape, - Fill, - Stroke, - StrokeWidth, - StrokeDash, - Opacity -]; - -export const Skip = { - name: 1, - style: 1, - interactive: 1 -}; - -export const zero = {value: 0}; -export const one = {value: 1}; diff --git a/node_modules/vega-parser/src/parsers/guides/guide-group.js b/node_modules/vega-parser/src/parsers/guides/guide-group.js deleted file mode 100644 index b76baee..0000000 --- a/node_modules/vega-parser/src/parsers/guides/guide-group.js +++ /dev/null @@ -1,7 +0,0 @@ -import {GroupMark} from '../marks/marktypes'; - -export default function(mark) { - mark.type = GroupMark; - mark.interactive = mark.interactive || false; - return mark; -} diff --git a/node_modules/vega-parser/src/parsers/guides/guide-mark.js b/node_modules/vega-parser/src/parsers/guides/guide-mark.js deleted file mode 100644 index c5aeafb..0000000 --- a/node_modules/vega-parser/src/parsers/guides/guide-mark.js +++ /dev/null @@ -1,14 +0,0 @@ -import {Skip} from './constants'; -import {extendEncode} from '../encode/util'; - -export default function(mark, extras) { - if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip); - } else { - mark.interactive = false; - } - return mark; -} diff --git a/node_modules/vega-parser/src/parsers/guides/guide-util.js b/node_modules/vega-parser/src/parsers/guides/guide-util.js deleted file mode 100644 index ca7064f..0000000 --- a/node_modules/vega-parser/src/parsers/guides/guide-util.js +++ /dev/null @@ -1,88 +0,0 @@ -import {Center, End, Left, Right, Start, Vertical} from './constants'; -import {value} from '../../util'; -import {isObject, stringValue} from 'vega-util'; - -export function lookup(spec, config) { - const _ = (name, dflt) => value(spec[name], value(config[name], dflt)); - - _.isVertical = s => Vertical === value( - spec.direction, - config.direction || (s ? config.symbolDirection : config.gradientDirection) - ); - - _.gradientLength = () => value( - spec.gradientLength, - config.gradientLength || config.gradientWidth - ); - - _.gradientThickness = () => value( - spec.gradientThickness, - config.gradientThickness || config.gradientHeight - ); - - _.entryColumns = () => value( - spec.columns, - value(config.columns, +_.isVertical(true)) - ); - - return _; -} - -export function getEncoding(name, encode) { - var v = encode && ( - (encode.update && encode.update[name]) || - (encode.enter && encode.enter[name]) - ); - return v && v.signal ? v : v ? v.value : null; -} - -export function getStyle(name, scope, style) { - var s = scope.config.style[style]; - return s && s[name]; -} - -export function anchorExpr(s, e, m) { - return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m}`; -} - -export const alignExpr = anchorExpr( - stringValue(Left), - stringValue(Right), - stringValue(Center) -); - -export function tickBand(_) { - let v = _('tickBand'), - offset = _('tickOffset'), - band, extra; - - if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); - } else if (v.signal) { - // if signal, augment code to interpret values - band = {signal: `(${v.signal}) === 'extent' ? 1 : 0.5`}; - extra = {signal: `(${v.signal}) === 'extent'`}; - if (!isObject(offset)) { - offset = {signal: `(${v.signal}) === 'extent' ? 0 : ${offset}`}; - } - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; - } else { - band = 0.5; - extra = false; - } - - return {extra, band, offset}; -} - -export function extendOffset(value, offset) { - return !offset ? value - : !value ? offset - : !isObject(value) ? { value, offset } - : Object.assign({}, value, { offset: extendOffset(value.offset, offset) }); -} diff --git a/node_modules/vega-parser/src/parsers/guides/legend-gradient-discrete.js b/node_modules/vega-parser/src/parsers/guides/legend-gradient-discrete.js deleted file mode 100644 index 303a1a6..0000000 --- a/node_modules/vega-parser/src/parsers/guides/legend-gradient-discrete.js +++ /dev/null @@ -1,49 +0,0 @@ -import {Perc, Perc2, Value, one, zero} from './constants'; -import guideMark from './guide-mark'; -import {lookup} from './guide-util'; -import {addEncoders, encoder} from '../encode/util'; -import {RectMark} from '../marks/marktypes'; -import {LegendBandRole} from '../marks/roles'; -import {extend} from 'vega-util'; - -export default function(spec, scale, config, userEncode, dataRef) { - var _ = lookup(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, u, v, uu, vv, adjust = ''; - - vertical - ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') - : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); - - enter = { - opacity: zero, - fill: {scale: scale, field: Value} - }; - enter[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - enter[v] = zero; - enter[uu] = {signal: adjust + 'datum.' + Perc2, mult: length}; - enter[vv] = encoder(thickness); - - encode = { - enter: enter, - update: extend({}, enter, {opacity: one}), - exit: {opacity: zero} - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode - }, userEncode); -} diff --git a/node_modules/vega-parser/src/parsers/guides/legend-gradient-labels.js b/node_modules/vega-parser/src/parsers/guides/legend-gradient-labels.js deleted file mode 100644 index 1f257f7..0000000 --- a/node_modules/vega-parser/src/parsers/guides/legend-gradient-labels.js +++ /dev/null @@ -1,77 +0,0 @@ -import { - Bottom, Center, GuideLabelStyle, Index, Label, Left, Middle, - Perc, Right, Top, Value, one, zero -} from './constants'; -import guideMark from './guide-mark'; -import {lookup} from './guide-util'; -import {addEncoders, encoder} from '../encode/util'; -import {TextMark} from '../marks/marktypes'; -import {LegendLabelRole} from '../marks/roles'; -import {value} from '../../util'; - -const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, - baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; - -export default function(spec, config, userEncode, dataRef) { - var _ = lookup(spec, config), - vertical = _.isVertical(), - thickness = encoder(_.gradientThickness()), - length = _.gradientLength(), - overlap = _('labelOverlap'), - encode, enter, update, u, v, adjust = ''; - - encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one, - text: {field: Label} - }, - exit: { - opacity: zero - } - }; - - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value(spec.labelLimit, config.gradientLabelLimit) - }); - - if (vertical) { - enter.align = {value: 'left'}; - enter.baseline = update.baseline = {signal: baselineExpr}; - u = 'y'; v = 'x'; adjust = '1-'; - } else { - enter.align = update.align = {signal: alignExpr}; - enter.baseline = {value: 'top'}; - u = 'x'; v = 'y'; - } - - enter[u] = update[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - - enter[v] = update[v] = thickness; - thickness.offset = value(spec.labelOffset, config.gradientLabelOffset) || 0; - - overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; - - // type, role, style, key, dataRef, encode, extras - return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); -} diff --git a/node_modules/vega-parser/src/parsers/guides/legend-gradient.js b/node_modules/vega-parser/src/parsers/guides/legend-gradient.js deleted file mode 100644 index cd7eb23..0000000 --- a/node_modules/vega-parser/src/parsers/guides/legend-gradient.js +++ /dev/null @@ -1,57 +0,0 @@ -import {one, zero} from './constants'; -import guideMark from './guide-mark'; -import {lookup} from './guide-util'; -import {addEncoders, encoder} from '../encode/util'; -import {RectMark} from '../marks/marktypes'; -import {LegendGradientRole} from '../marks/roles'; -import {extend} from 'vega-util'; - -export default function(spec, scale, config, userEncode) { - var _ = lookup(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, start, stop, width, height; - - if (vertical) { - start = [0, 1]; - stop = [0, 0]; - width = thickness; - height = length; - } else { - start = [0, 0]; - stop = [1, 0]; - width = length; - height = thickness; - } - - encode = { - enter: enter = { - opacity: zero, - x: zero, - y: zero, - width: encoder(width), - height: encoder(height) - }, - update: extend({}, enter, { - opacity: one, - fill: {gradient: scale, start: start, stop: stop} - }), - exit: { - opacity: zero - } - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode - }, userEncode); -} diff --git a/node_modules/vega-parser/src/parsers/guides/legend-symbol-groups.js b/node_modules/vega-parser/src/parsers/guides/legend-symbol-groups.js deleted file mode 100644 index dca3781..0000000 --- a/node_modules/vega-parser/src/parsers/guides/legend-symbol-groups.js +++ /dev/null @@ -1,183 +0,0 @@ -import { - GuideLabelStyle, Index, Label, LegendScales, Offset, Size, Skip, - Value, one, zero -} from './constants'; -import guideGroup from './guide-group'; -import guideMark from './guide-mark'; -import {lookup} from './guide-util'; -import {addEncoders, encoder, extendEncode} from '../encode/util'; -import {SymbolMark, TextMark} from '../marks/marktypes'; -import {LegendLabelRole, LegendSymbolRole, ScopeRole} from '../marks/roles'; - -// userEncode is top-level, includes entries, symbols, labels -export default function(spec, config, userEncode, dataRef, columns) { - var _ = lookup(spec, config), - entries = userEncode.entries, - interactive = !!(entries && entries.interactive), - name = entries ? entries.name : undefined, - height = _('clipHeight'), - symbolOffset = _('symbolOffset'), - valueRef = {data: 'value'}, - encode = {}, - xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, - yEncode = height ? encoder(height) : {field: Size}, - index = `datum.${Index}`, - ncols = `max(1, ${columns})`, - enter, update, labelOffset, symbols, labels, nrows, sort; - - yEncode.mult = 0.5; - - // -- LEGEND SYMBOLS -- - encode = { - enter: enter = { - opacity: zero, - x: {signal: xSignal, mult: 0.5, offset: symbolOffset}, - y: yEncode - }, - update: update = { - opacity: one, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero - } - }; - - var baseFill = null, - baseStroke = null; - if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') - }, { // update - opacity: _('symbolOpacity') - }); - - LegendScales.forEach(function(scale) { - if (spec[scale]) { - update[scale] = enter[scale] = {scale: spec[scale], field: Value}; - } - }); - - symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode - }, userEncode.symbols); - - // -- LEGEND LABELS -- - labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - - encode = { - enter: enter = { - opacity: zero, - x: {signal: xSignal, offset: labelOffset}, - y: yEncode - }, - update: update = { - opacity: one, - text: {field: Label}, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero - } - }; - - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') - }); - - labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode - }, userEncode.labels); - - // -- LEGEND ENTRY GROUPS -- - encode = { - enter: { - noBound: {value: !height}, // ignore width/height in bounds calc - width: zero, - height: height ? encoder(height) : zero, - opacity: zero - }, - exit: {opacity: zero}, - update: update = { - opacity: one, - row: {signal: null}, - column: {signal: null} - } - }; - - // annotate and sort groups to ensure correct ordering - if (_.isVertical(true)) { - nrows = `ceil(item.mark.items.length / ${ncols})`; - update.row.signal = `${index}%${nrows}`; - update.column.signal = `floor(${index} / ${nrows})`; - sort = {field: ['row', index]}; - } else { - update.row.signal = `floor(${index} / ${ncols})`; - update.column.signal = `${index} % ${ncols}`; - sort = {field: index}; - } - // handle zero column case (implies infinite columns) - update.column.signal = `(${columns})?${update.column.signal}:${index}`; - - // facet legend entries into sub-groups - dataRef = {facet: {data: dataRef, name: 'value', groupby: Index}}; - - return guideGroup({ - role: ScopeRole, - from: dataRef, - encode: extendEncode(encode, entries, Skip), - marks: [symbols, labels], - name, - interactive, - sort - }); -} - -export function legendSymbolLayout(spec, config) { - const _ = lookup(spec, config); - - // layout parameters for legend entries - return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } - }; -} diff --git a/node_modules/vega-parser/src/parsers/guides/legend-title.js b/node_modules/vega-parser/src/parsers/guides/legend-title.js deleted file mode 100644 index d20f7d0..0000000 --- a/node_modules/vega-parser/src/parsers/guides/legend-title.js +++ /dev/null @@ -1,61 +0,0 @@ -import {GuideTitleStyle, one, zero} from './constants'; -import guideMark from './guide-mark'; -import {alignExpr, anchorExpr, lookup} from './guide-util'; -import {addEncoders} from '../encode/util'; -import {TextMark} from '../marks/marktypes'; -import {LegendTitleRole} from '../marks/roles'; - -// expression logic for align, anchor, angle, and baseline calculation -const isL = 'item.orient === "left"', - isR = 'item.orient === "right"', - isLR = `(${isL} || ${isR})`, - isVG = `datum.vgrad && ${isLR}`, - baseline = anchorExpr('"top"', '"bottom"', '"middle"'), - alignFlip = anchorExpr('"right"', '"left"', '"center"'), - exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr}`, - exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, - exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, - exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; - -export default function(spec, config, userEncode, dataRef) { - var _ = lookup(spec, config), encode; - - encode = { - enter: {opacity: zero}, - update: { - opacity: one, - x: {field: {group: 'padding'}}, - y: {field: {group: 'padding'}} - }, - exit: {opacity: zero} - }; - - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: {signal: exprAnchor}, - angle: {signal: exprAngle}, - align: {signal: exprAlign}, - baseline: {signal: exprBaseline}, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - baseline: _('titleBaseline') - }); - - return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); -} diff --git a/node_modules/vega-parser/src/parsers/legend.js b/node_modules/vega-parser/src/parsers/legend.js deleted file mode 100644 index 15e502b..0000000 --- a/node_modules/vega-parser/src/parsers/legend.js +++ /dev/null @@ -1,202 +0,0 @@ -import {addEncoders, extendEncode} from './encode/util'; -import { - Discrete, Gradient, - GuideLabelStyle, LegendScales, Skip, Symbols -} from './guides/constants'; -import guideGroup from './guides/guide-group'; -import {getEncoding, getStyle, lookup} from './guides/guide-util'; -import legendGradient from './guides/legend-gradient'; -import legendGradientDiscrete from './guides/legend-gradient-discrete'; -import legendGradientLabels from './guides/legend-gradient-labels'; -import legendSymbolGroups, {legendSymbolLayout} from './guides/legend-symbol-groups'; -import legendTitle from './guides/legend-title'; -import parseMark from './mark'; -import {LegendEntryRole, LegendRole} from './marks/roles'; - -import {deref, ref} from '../util'; -import {Collect, LegendEntries} from '../transforms'; - -import {parseExpression} from 'vega-functions'; -import {isContinuous, isDiscretizing} from 'vega-scale'; -import {error} from 'vega-util'; - -export default function(spec, scope) { - var config = scope.config.legend, - encode = spec.encode || {}, - legendEncode = encode.legend || {}, - name = legendEncode.name || undefined, - interactive = legendEncode.interactive, - style = legendEncode.style, - _ = lookup(spec, config), - scales = {}, scale = 0, - entryEncode, entryLayout, params, children, - type, datum, dataRef, entryRef; - - // resolve scales and 'canonical' scale name - LegendScales.forEach(s => spec[s] - ? (scales[s] = spec[s], scale = scale || spec[s]) : 0 - ); - if (!scale) error('Missing valid scale for legend.'); - - // resolve legend type (symbol, gradient, or discrete gradient) - type = legendType(spec, scope.scaleType(scale)); - - // single-element data source for legend group - datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - dataRef = ref(scope.add(Collect(null, [datum]))); - - // encoding properties for legend group - legendEncode = extendEncode( - buildLegendEncode(_, spec, config), legendEncode, Skip - ); - - // encoding properties for legend entry sub-group - entryEncode = {enter: {x: {value: 0}, y: {value: 0}}}; - - // data source for legend values - entryRef = ref(scope.add(LegendEntries(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // continuous gradient legend - if (type === Gradient) { - children = [ - legendGradient(spec, scale, config, encode.gradient), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - // adjust default tick count based on the gradient length - params.count = params.count || scope.signalRef( - `max(2,2*floor((${deref(_.gradientLength())})/100))` - ); - } - - // discrete gradient legend - else if (type === Discrete) { - children = [ - legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - } - - // symbol legend - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [ - legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns)) - ]; - // pass symbol size information to legend entry generator - params.size = sizeExpression(spec, scope, children[0].marks); - } - - // generate legend marks - children = [ - guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive - }) - ]; - - // include legend title if defined - if (datum.title) { - children.push(legendTitle(spec, config, encode.title, dataRef)); - } - - // parse legend specification - return parseMark( - guideGroup({ - role: LegendRole, - from: dataRef, - encode: legendEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); -} - -function legendType(spec, scaleType) { - var type = spec.type || Symbols; - - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { - type = isContinuous(scaleType) ? Gradient - : isDiscretizing(scaleType) ? Discrete - : Symbols; - } - - return type !== Gradient ? type - : isDiscretizing(scaleType) ? Discrete - : Gradient; -} - -function scaleCount(spec) { - return LegendScales.reduce(function(count, type) { - return count + (spec[type] ? 1 : 0); - }, 0); -} - -function buildLegendEncode(_, spec, config) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; -} - -function sizeExpression(spec, scope, marks) { - var size = deref(getChannel('size', spec, marks)), - strokeWidth = deref(getChannel('strokeWidth', spec, marks)), - fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - - return parseExpression( - `max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, - scope - ); -} - -function getChannel(name, spec, marks) { - return spec[name] - ? `scale("${spec[name]}",datum)` - : getEncoding(name, marks[0].encode); -} - -function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); -} diff --git a/node_modules/vega-parser/src/parsers/mark.js b/node_modules/vega-parser/src/parsers/mark.js deleted file mode 100644 index b4a238e..0000000 --- a/node_modules/vega-parser/src/parsers/mark.js +++ /dev/null @@ -1,163 +0,0 @@ -import parseEncode from './encode'; -import clip from './marks/clip'; -import definition from './marks/definition'; -import interactive from './marks/interactive'; -import parseData from './marks/data'; -import parseFacet from './marks/facet'; -import parseSubflow from './marks/subflow'; -import getRole from './marks/role'; -import {GroupMark} from './marks/marktypes'; -import {FrameRole, MarkRole, ScopeRole} from './marks/roles'; -import parseTransform from './transform'; -import parseTrigger from './trigger'; -import DataScope from '../DataScope'; -import {fieldRef, isSignal, ref} from '../util'; -import {error} from 'vega-util'; -import {Bound, Collect, DataJoin, Encode, Mark, Overlap, Render, Sieve, SortItems, ViewLayout} from '../transforms'; - -export default function(spec, scope) { - var role = getRole(spec), - group = spec.type === GroupMark, - facet = spec.from && spec.from.facet, - layout = spec.layout || role === ScopeRole || role === FrameRole, - nested = role === MarkRole || layout || facet, - overlap = spec.overlap, - ops, op, input, store, enc, bound, render, sieve, name, - joinRef, markRef, encodeRef, layoutRef, boundRef; - - // resolve input data - input = parseData(spec.from, group, scope); - - // data join to map tuples to visual items - op = scope.add(DataJoin({ - key: input.key || (spec.key ? fieldRef(spec.key) : undefined), - pulse: input.pulse, - clean: !group - })); - joinRef = ref(op); - - // collect visual items - op = store = scope.add(Collect({pulse: joinRef})); - - // connect visual items to scenegraph - op = scope.add(Mark({ - markdef: definition(spec), - interactive: interactive(spec.interactive, scope), - clip: clip(spec.clip, scope), - context: {$context: true}, - groups: scope.lookup(), - parent: scope.signals.parent ? scope.signalRef('parent') : null, - index: scope.markpath(), - pulse: ref(op) - })); - markRef = ref(op); - - // add visual encoders - op = enc = scope.add(Encode(parseEncode( - spec.encode, spec.type, role, spec.style, scope, - {mod: false, pulse: markRef} - ))); - - // monitor parent marks to propagate changes - op.params.parent = scope.encode(); - - // add post-encoding transforms, if defined - if (spec.transform) { - spec.transform.forEach(function(_) { - const tx = parseTransform(_, scope), - md = tx.metadata; - if (md.generates || md.changes) { - error('Mark transforms should not generate new data.'); - } - if (!md.nomod) enc.params.mod = true; // update encode mod handling - tx.params.pulse = ref(op); - scope.add(op = tx); - }); - } - - // if item sort specified, perform post-encoding - if (spec.sort) { - op = scope.add(SortItems({ - sort: scope.compareRef(spec.sort), - pulse: ref(op) - })); - } - - encodeRef = ref(op); - - // add view layout operator if needed - if (facet || layout) { - layout = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - mark: markRef, - pulse: encodeRef - })); - layoutRef = ref(layout); - } - - // compute bounding boxes - bound = scope.add(Bound({mark: markRef, pulse: layoutRef || encodeRef})); - boundRef = ref(bound); - - // if group mark, recurse to parse nested content - if (group) { - // juggle layout & bounds to ensure they run *after* any faceting transforms - if (nested) { ops = scope.operators; ops.pop(); if (layout) ops.pop(); } - - scope.pushState(encodeRef, layoutRef || boundRef, joinRef); - facet ? parseFacet(spec, scope, input) // explicit facet - : nested ? parseSubflow(spec, scope, input) // standard mark group - : scope.parse(spec); // guide group, we can avoid nested scopes - scope.popState(); - - if (nested) { if (layout) ops.push(layout); ops.push(bound); } - } - - // if requested, add overlap removal transform - if (overlap) { - boundRef = parseOverlap(overlap, boundRef, scope); - } - - // render / sieve items - render = scope.add(Render({pulse: boundRef})); - sieve = scope.add(Sieve({pulse: ref(render)}, undefined, scope.parent())); - - // if mark is named, make accessible as reactive geometry - // add trigger updates if defined - if (spec.name != null) { - name = spec.name; - scope.addData(name, new DataScope(scope, store, render, sieve)); - if (spec.on) spec.on.forEach(function(on) { - if (on.insert || on.remove || on.toggle) { - error('Marks only support modify triggers.'); - } - parseTrigger(on, scope, name); - }); - } -} - -function parseOverlap(overlap, source, scope) { - var method = overlap.method, - bound = overlap.bound, - sep = overlap.separation, tol; - - var params = { - separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, - method: isSignal(method) ? scope.signalRef(method.signal) : method, - pulse: source - }; - - if (overlap.order) { - params.sort = scope.compareRef({field: overlap.order}); - } - - if (bound) { - tol = bound.tolerance; - params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; - params.boundScale = scope.scaleRef(bound.scale); - params.boundOrient = bound.orient; - } - - return ref(scope.add(Overlap(params))); -} diff --git a/node_modules/vega-parser/src/parsers/marks/clip.js b/node_modules/vega-parser/src/parsers/marks/clip.js deleted file mode 100644 index c94025d..0000000 --- a/node_modules/vega-parser/src/parsers/marks/clip.js +++ /dev/null @@ -1,25 +0,0 @@ -import {isObject, stringValue} from 'vega-util'; - -export default function(clip, scope) { - var expr; - - if (isObject(clip)) { - if (clip.signal) { - expr = clip.signal; - } else if (clip.path) { - expr = 'pathShape(' + param(clip.path) + ')'; - } else if (clip.sphere) { - expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - } - - return expr - ? scope.signalRef(expr) - : !!clip; -} - -function param(value) { - return isObject(value) && value.signal - ? value.signal - : stringValue(value); -} \ No newline at end of file diff --git a/node_modules/vega-parser/src/parsers/marks/data.js b/node_modules/vega-parser/src/parsers/marks/data.js deleted file mode 100644 index 21a378c..0000000 --- a/node_modules/vega-parser/src/parsers/marks/data.js +++ /dev/null @@ -1,55 +0,0 @@ -import parseTransform from '../transform'; -import {Collect} from '../../transforms'; -import {ref} from '../../util'; -import {array, error, extend} from 'vega-util'; - -export default function(from, group, scope) { - var facet, key, op, dataRef, parent; - - // if no source data, generate singleton datum - if (!from) { - dataRef = ref(scope.add(Collect(null, [{}]))); - } - - // if faceted, process facet specification - else if (facet = from.facet) { - if (!group) error('Only group marks can be faceted.'); - - // use pre-faceted source data, if available - if (facet.field != null) { - dataRef = parent = getDataRef(facet, scope); - } else { - // generate facet aggregates if no direct data specification - if (!from.data) { - op = parseTransform(extend({ - type: 'aggregate', - groupby: array(facet.groupby) - }, facet.aggregate), scope); - op.params.key = scope.keyRef(facet.groupby); - op.params.pulse = getDataRef(facet, scope); - dataRef = parent = ref(scope.add(op)); - } else { - parent = ref(scope.getData(from.data).aggregate); - } - - key = scope.keyRef(facet.groupby, true); - } - } - - // if not yet defined, get source data reference - if (!dataRef) { - dataRef = getDataRef(from, scope); - } - - return { - key: key, - pulse: dataRef, - parent: parent - }; -} - -export function getDataRef(from, scope) { - return from.$ref ? from - : from.data && from.data.$ref ? from.data - : ref(scope.getData(from.data).output); -} \ No newline at end of file diff --git a/node_modules/vega-parser/src/parsers/marks/definition.js b/node_modules/vega-parser/src/parsers/marks/definition.js deleted file mode 100644 index e7f91b5..0000000 --- a/node_modules/vega-parser/src/parsers/marks/definition.js +++ /dev/null @@ -1,12 +0,0 @@ -import role from './role'; - -export default function(spec) { - return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || role(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; -} diff --git a/node_modules/vega-parser/src/parsers/marks/facet.js b/node_modules/vega-parser/src/parsers/marks/facet.js deleted file mode 100644 index d00a329..0000000 --- a/node_modules/vega-parser/src/parsers/marks/facet.js +++ /dev/null @@ -1,46 +0,0 @@ -import {getDataRef} from './data'; -import DataScope from '../../DataScope'; -import {Collect, Facet, PreFacet, Sieve} from '../../transforms'; -import {ref} from '../../util'; -import {error, stringValue} from 'vega-util'; - -export default function(spec, scope, group) { - var facet = spec.from.facet, - name = facet.name, - data = getDataRef(facet, scope), - subscope, source, values, op; - - if (!facet.name) { - error('Facet must have a name: ' + stringValue(facet)); - } - if (!facet.data) { - error('Facet must reference a data set: ' + stringValue(facet)); - } - - if (facet.field) { - op = scope.add(PreFacet({ - field: scope.fieldRef(facet.field), - pulse: data - })); - } else if (facet.groupby) { - op = scope.add(Facet({ - key: scope.keyRef(facet.groupby), - group: ref(scope.proxy(group.parent)), - pulse: data - })); - } else { - error('Facet must specify groupby or field: ' + stringValue(facet)); - } - - // initialize facet subscope - subscope = scope.fork(); - source = subscope.add(Collect()); - values = subscope.add(Sieve({pulse: ref(source)})); - subscope.addData(name, new DataScope(subscope, source, source, values)); - subscope.addSignal('parent', null); - - // parse faceted subflow - op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; -} diff --git a/node_modules/vega-parser/src/parsers/marks/interactive.js b/node_modules/vega-parser/src/parsers/marks/interactive.js deleted file mode 100644 index 42ddcd4..0000000 --- a/node_modules/vega-parser/src/parsers/marks/interactive.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(spec, scope) { - return spec && spec.signal ? scope.signalRef(spec.signal) - : spec === false ? false - : true; -} diff --git a/node_modules/vega-parser/src/parsers/marks/marktypes.js b/node_modules/vega-parser/src/parsers/marks/marktypes.js deleted file mode 100644 index cee06fc..0000000 --- a/node_modules/vega-parser/src/parsers/marks/marktypes.js +++ /dev/null @@ -1,5 +0,0 @@ -export var GroupMark = 'group'; -export var RectMark = 'rect'; -export var RuleMark = 'rule'; -export var SymbolMark = 'symbol'; -export var TextMark = 'text'; diff --git a/node_modules/vega-parser/src/parsers/marks/role.js b/node_modules/vega-parser/src/parsers/marks/role.js deleted file mode 100644 index c89b1e1..0000000 --- a/node_modules/vega-parser/src/parsers/marks/role.js +++ /dev/null @@ -1,9 +0,0 @@ -import {GroupMark} from './marktypes'; -import {MarkRole, ScopeRole} from './roles'; - -export default function(spec) { - var role = spec.role || ''; - return (!role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title')) - ? role - : spec.type === GroupMark ? ScopeRole : (role || MarkRole); -} diff --git a/node_modules/vega-parser/src/parsers/marks/roles.js b/node_modules/vega-parser/src/parsers/marks/roles.js deleted file mode 100644 index 97c3330..0000000 --- a/node_modules/vega-parser/src/parsers/marks/roles.js +++ /dev/null @@ -1,22 +0,0 @@ -export var MarkRole = 'mark'; -export var FrameRole = 'frame'; -export var ScopeRole = 'scope'; - -export var AxisRole = 'axis'; -export var AxisDomainRole = 'axis-domain'; -export var AxisGridRole = 'axis-grid'; -export var AxisLabelRole = 'axis-label'; -export var AxisTickRole = 'axis-tick'; -export var AxisTitleRole = 'axis-title'; - -export var LegendRole = 'legend'; -export var LegendBandRole = 'legend-band'; -export var LegendEntryRole = 'legend-entry'; -export var LegendGradientRole = 'legend-gradient'; -export var LegendLabelRole = 'legend-label'; -export var LegendSymbolRole = 'legend-symbol'; -export var LegendTitleRole = 'legend-title'; - -export var TitleRole = 'title'; -export var TitleTextRole = 'title-text'; -export var TitleSubtitleRole = 'title-subtitle'; diff --git a/node_modules/vega-parser/src/parsers/marks/subflow.js b/node_modules/vega-parser/src/parsers/marks/subflow.js deleted file mode 100644 index 75c8c9a..0000000 --- a/node_modules/vega-parser/src/parsers/marks/subflow.js +++ /dev/null @@ -1,14 +0,0 @@ -import {PreFacet, Sieve} from '../../transforms'; - -export default function(spec, scope, input) { - var op = scope.add(PreFacet({pulse: input.pulse})), - subscope = scope.fork(); - - subscope.add(Sieve()); - subscope.addSignal('parent', null); - - // parse group mark subflow - op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; -} diff --git a/node_modules/vega-parser/src/parsers/padding.js b/node_modules/vega-parser/src/parsers/padding.js deleted file mode 100644 index 8e4e708..0000000 --- a/node_modules/vega-parser/src/parsers/padding.js +++ /dev/null @@ -1,16 +0,0 @@ -import {isObject} from 'vega-util'; - -const number = _ => +_ || 0; - -const paddingObject = _ => ({top: _, bottom: _, left: _, right: _}); - -export default function(spec) { - return !isObject(spec) ? paddingObject(number(spec)) - : spec.signal ? spec - : { - top: number(spec.top), - bottom: number(spec.bottom), - left: number(spec.left), - right: number(spec.right) - }; -} diff --git a/node_modules/vega-parser/src/parsers/projection.js b/node_modules/vega-parser/src/parsers/projection.js deleted file mode 100644 index b4d52ea..0000000 --- a/node_modules/vega-parser/src/parsers/projection.js +++ /dev/null @@ -1,28 +0,0 @@ -import {error, isArray, isObject, stringValue} from 'vega-util'; - -export default function(proj, scope) { - var config = scope.config.projection || {}, - params = {}; - - for (var name in proj) { - if (name === 'name') continue; - params[name] = parseParameter(proj[name], name, scope); - } - - // apply projection defaults from config - for (name in config) { - if (params[name] == null) { - params[name] = parseParameter(config[name], name, scope); - } - } - - scope.addProjection(proj.name, params); -} - -function parseParameter(_, name, scope) { - return isArray(_) ? _.map(function(_) { return parseParameter(_, name, scope); }) - : !isObject(_) ? _ - : _.signal ? scope.signalRef(_.signal) - : name === 'fit' ? _ - : error('Unsupported parameter object: ' + stringValue(_)); -} diff --git a/node_modules/vega-parser/src/parsers/scale.js b/node_modules/vega-parser/src/parsers/scale.js deleted file mode 100644 index 94b0354..0000000 --- a/node_modules/vega-parser/src/parsers/scale.js +++ /dev/null @@ -1,274 +0,0 @@ -import { - Aggregate, Collect, MultiExtent, MultiValues, Sieve, Values -} from '../transforms'; -import {aggrField, keyFieldRef, ref} from '../util'; - -import {isDiscrete, isQuantile, isValidScaleType} from 'vega-scale'; -import { - error, extend, hasOwnProperty, isArray, isObject, isString, stringValue -} from 'vega-util'; - -var FIELD_REF_ID = 0; - -var MULTIDOMAIN_SORT_OPS = {min: 'min', max: 'max', count: 'sum'}; - -export function initScale(spec, scope) { - var type = spec.type || 'linear'; - - if (!isValidScaleType(type)) { - error('Unrecognized scale type: ' + stringValue(type)); - } - - scope.addScale(spec.name, { - type: type, - domain: undefined - }); -} - -export function parseScale(spec, scope) { - var params = scope.getScale(spec.name).params, - key; - - params.domain = parseScaleDomain(spec.domain, spec, scope); - - if (spec.range != null) { - params.range = parseScaleRange(spec, scope, params); - } - - if (spec.interpolate != null) { - parseScaleInterpolate(spec.interpolate, params); - } - - if (spec.nice != null) { - params.nice = parseScaleNice(spec.nice); - } - - if (spec.bins != null) { - params.bins = parseScaleBins(spec.bins, scope); - } - - for (key in spec) { - if (hasOwnProperty(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } -} - -function parseLiteral(v, scope) { - return !isObject(v) ? v - : v.signal ? scope.signalRef(v.signal) - : error('Unsupported object: ' + stringValue(v)); -} - -function parseArray(v, scope) { - return v.signal - ? scope.signalRef(v.signal) - : v.map(v => parseLiteral(v, scope)); -} - -function dataLookupError(name) { - error('Can not find data set: ' + stringValue(name)); -} - -// -- SCALE DOMAIN ---- - -function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) { - error('No scale domain defined for domainMin/domainMax to override.'); - } - return; // default domain - } - - return domain.signal ? scope.signalRef(domain.signal) - : (isArray(domain) ? explicitDomain - : domain.fields ? multipleDomain - : singularDomain)(domain, spec, scope); -} - -function explicitDomain(domain, spec, scope) { - return domain.map(function(v) { - return parseLiteral(v, scope); - }); -} - -function singularDomain(domain, spec, scope) { - var data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - - return isDiscrete(spec.type) - ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) - : isQuantile(spec.type) ? data.domainRef(scope, domain.field) - : data.extentRef(scope, domain.field); -} - -function multipleDomain(domain, spec, scope) { - var data = domain.data, - fields = domain.fields.reduce(function(dom, d) { - d = isString(d) ? {data: data, field: d} - : (isArray(d) || d.signal) ? fieldRef(d, scope) - : d; - dom.push(d); - return dom; - }, []); - - return (isDiscrete(spec.type) ? ordinalMultipleDomain - : isQuantile(spec.type) ? quantileMultipleDomain - : numericMultipleDomain)(domain, scope, fields); -} - -function fieldRef(data, scope) { - var name = '_:vega:_' + (FIELD_REF_ID++), - coll = Collect({}); - - if (isArray(data)) { - coll.value = {$ingest: data}; - } else if (data.signal) { - var code = 'setdata(' + stringValue(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - scope.addDataPipeline(name, [coll, Sieve({})]); - return {data: name, field: 'data'}; -} - -function ordinalMultipleDomain(domain, scope, fields) { - var sort = parseSort(domain.sort, true), - counts, p, a, c, v; - - // get value counts for each domain field - counts = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); - }); - - // aggregate the results from each domain field - p = {groupby: keyFieldRef, pulse: counts}; - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [MULTIDOMAIN_SORT_OPS[a]]; - p.fields = [scope.fieldRef(v)]; - p.as = [v]; - } - a = scope.add(Aggregate(p)); - - // collect aggregate output - c = scope.add(Collect({pulse: ref(a)})); - - // extract values for combined domain - v = scope.add(Values({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) - })); - - return ref(v); -} - -function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if (isObject(sort)) sort.field = 'key'; - else sort = {field: 'key'}; - } else if (!sort.field && sort.op !== 'count') { - error('No field provided for sort aggregate op: ' + sort.op); - } else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) { - error('Multiple domain scales can not be sorted using ' + sort.op); - } - } - } - return sort; -} - -function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - var values = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); - }); - - // combine value arrays - return ref(scope.add(MultiValues({values: values}))); -} - -function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - var extents = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); - }); - - // combine extents - return ref(scope.add(MultiExtent({extents: extents}))); -} - -// -- SCALE BINS ----- - -function parseScaleBins(v, scope) { - return v.signal || isArray(v) - ? parseArray(v, scope) - : scope.objectProperty(v); -} - -// -- SCALE NICE ----- - -function parseScaleNice(nice) { - return isObject(nice) - ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } - : parseLiteral(nice); -} - -// -- SCALE INTERPOLATION ----- - -function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - if (interpolate.gamma != null) { - params.interpolateGamma = parseLiteral(interpolate.gamma); - } -} - -// -- SCALE RANGE ----- - -function parseScaleRange(spec, scope, params) { - var range = spec.range, - config = scope.config.range; - - if (range.signal) { - return scope.signalRef(range.signal); - } else if (isString(range)) { - if (config && hasOwnProperty(config, range)) { - spec = extend({}, spec, {range: config[range]}); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') { - range = [0, {signal: 'width'}]; - } else if (range === 'height') { - range = isDiscrete(spec.type) - ? [0, {signal: 'height'}] - : [{signal: 'height'}, 0]; - } else { - error('Unrecognized scale range value: ' + stringValue(range)); - } - } else if (range.scheme) { - params.scheme = isArray(range.scheme) - ? parseArray(range.scheme, scope) - : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if (isDiscrete(spec.type) && !isArray(range)) { - return parseScaleDomain(range, spec, scope); - } else if (!isArray(range)) { - error('Unsupported range type: ' + stringValue(range)); - } - - return range.map(v => (isArray(v) ? parseArray : parseLiteral)(v, scope)); -} diff --git a/node_modules/vega-parser/src/parsers/scope.js b/node_modules/vega-parser/src/parsers/scope.js deleted file mode 100644 index fd9332b..0000000 --- a/node_modules/vega-parser/src/parsers/scope.js +++ /dev/null @@ -1,50 +0,0 @@ -import parseSignalUpdates from './signal-updates'; -import {initScale, parseScale} from './scale'; -import parseProjection from './projection'; -import parseLegend from './legend'; -import parseSignal from './signal'; -import parseTitle from './title'; -import parseData from './data'; -import parseMark from './mark'; -import parseAxis from './axis'; -import {array} from 'vega-util'; - -export default function(spec, scope, preprocessed) { - var signals = array(spec.signals), - scales = array(spec.scales); - - // parse signal definitions, if not already preprocessed - if (!preprocessed) signals.forEach(_ => parseSignal(_, scope)); - - // parse cartographic projection definitions - array(spec.projections).forEach(_ => parseProjection(_, scope)); - - // initialize scale references - scales.forEach(_ => initScale(_, scope)); - - // parse data sources - array(spec.data).forEach(_ => parseData(_, scope)); - - // parse scale definitions - scales.forEach(_ => parseScale(_, scope)); - - // parse signal updates - (preprocessed || signals).forEach(_ => parseSignalUpdates(_, scope)); - - // parse axis definitions - array(spec.axes).forEach(_ => parseAxis(_, scope)); - - // parse mark definitions - array(spec.marks).forEach(_ => parseMark(_, scope)); - - // parse legend definitions - array(spec.legends).forEach(_ => parseLegend(_, scope)); - - // parse title, if defined - if (spec.title) parseTitle(spec.title, scope); - - // parse collected lambda (anonymous) expressions - scope.parseLambdas(); - - return scope; -} diff --git a/node_modules/vega-parser/src/parsers/signal-updates.js b/node_modules/vega-parser/src/parsers/signal-updates.js deleted file mode 100644 index f9f9348..0000000 --- a/node_modules/vega-parser/src/parsers/signal-updates.js +++ /dev/null @@ -1,29 +0,0 @@ -import parseUpdate from './update'; -import {parseExpression} from 'vega-functions'; -import {error} from 'vega-util'; - -export default function(signal, scope) { - var op = scope.getSignal(signal.name), - expr = signal.update; - - if (signal.init) { - if (expr) { - error('Signals can not include both init and update expressions.'); - } else { - expr = signal.init; - op.initonly = true; - } - } - - if (expr) { - expr = parseExpression(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - if (signal.on) { - signal.on.forEach(function(_) { - parseUpdate(_, scope, op.id); - }); - } -} diff --git a/node_modules/vega-parser/src/parsers/signal.js b/node_modules/vega-parser/src/parsers/signal.js deleted file mode 100644 index 16bc71d..0000000 --- a/node_modules/vega-parser/src/parsers/signal.js +++ /dev/null @@ -1,26 +0,0 @@ -import {error, stringValue} from 'vega-util'; - -var OUTER = 'outer', - OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind']; - -function outerError(prefix, name) { - error(prefix + ' for "outer" push: ' + stringValue(name)); -} - -export default function(signal, scope) { - var name = signal.name; - - if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); - // signal push must not use properties reserved for standard definition - OUTER_INVALID.forEach(function(prop) { - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); - } else { - // define a new signal in the current scope - var op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); - } -} diff --git a/node_modules/vega-parser/src/parsers/stream.js b/node_modules/vega-parser/src/parsers/stream.js deleted file mode 100644 index 6a3fc57..0000000 --- a/node_modules/vega-parser/src/parsers/stream.js +++ /dev/null @@ -1,95 +0,0 @@ -import {Scope, View} from '../util'; -import {parseExpression} from 'vega-functions'; -import {error, stringValue} from 'vega-util'; - -var Timer = 'timer'; - -export default function parseStream(stream, scope) { - var method = stream.merge ? mergeStream - : stream.stream ? nestedStream - : stream.type ? eventStream - : error('Invalid stream specification: ' + stringValue(stream)); - - return method(stream, scope); -} - -function eventSource(source) { - return source === Scope ? View : (source || View); -} - -function mergeStream(stream, scope) { - var list = stream.merge.map(s => parseStream(s, scope)), - entry = streamParameters({merge: list}, stream, scope); - return scope.addStream(entry).id; -} - -function nestedStream(stream, scope) { - var id = parseStream(stream.stream, scope), - entry = streamParameters({stream: id}, stream, scope); - return scope.addStream(entry).id; -} - -function eventStream(stream, scope) { - var id, entry; - - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = {between: stream.between, filter: stream.filter}; - } else { - id = scope.event(eventSource(stream.source), stream.type); - } - - entry = streamParameters({stream: id}, stream, scope); - return Object.keys(entry).length === 1 - ? id - : scope.addStream(entry).id; -} - -function streamParameters(entry, stream, scope) { - var param = stream.between; - - if (param) { - if (param.length !== 2) { - error('Stream "between" parameter must have 2 entries: ' + stringValue(stream)); - } - entry.between = [ - parseStream(param[0], scope), - parseStream(param[1], scope) - ]; - } - - param = stream.filter ? [].concat(stream.filter) : []; - if (stream.marktype || stream.markname || stream.markrole) { - // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - } - if (stream.source === Scope) { - // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - } - if (param.length) { - entry.filter = parseExpression('(' + param.join(')&&(') + ')', scope).$expr; - } - - if ((param = stream.throttle) != null) { - entry.throttle = +param; - } - - if ((param = stream.debounce) != null) { - entry.debounce = +param; - } - - if (stream.consume) { - entry.consume = true; - } - - return entry; -} - -function filterMark(type, name, role) { - var item = 'event.item'; - return item - + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') - + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') - + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); -} diff --git a/node_modules/vega-parser/src/parsers/title.js b/node_modules/vega-parser/src/parsers/title.js deleted file mode 100644 index de2dd04..0000000 --- a/node_modules/vega-parser/src/parsers/title.js +++ /dev/null @@ -1,159 +0,0 @@ -import {addEncoders, extendEncode} from './encode/util'; -import {GroupSubtitleStyle, GroupTitleStyle, Left, Right, Skip} from './guides/constants'; -import guideGroup from './guides/guide-group'; -import guideMark from './guides/guide-mark'; -import {alignExpr, lookup} from './guides/guide-util'; -import parseMark from './mark'; -import {TextMark} from './marks/marktypes'; -import {TitleRole, TitleSubtitleRole, TitleTextRole} from './marks/roles'; -import {Collect} from '../transforms'; -import {ref} from '../util'; -import {extend, isString} from 'vega-util'; - -const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; - -export default function(spec, scope) { - spec = isString(spec) ? {text: spec} : spec; - - var _ = lookup(spec, scope.config.title), - encode = spec.encode || {}, - userEncode = encode.group || {}, - name = userEncode.name || undefined, - interactive = userEncode.interactive, - style = userEncode.style, - children = [], - datum, dataRef; - - // single-element data source for group title - datum = {}; - dataRef = ref(scope.add(Collect(null, [datum]))); - - // include title text - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); - - // include subtitle text - if (spec.subtitle) { - children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - } - - // parse title specification - return parseMark( - guideGroup({ - role: TitleRole, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); -} - -// provide backwards-compatibility for title custom encode; -// the top-level encode block has been *deprecated*. -function titleEncode(spec) { - const encode = spec.encode; - return (encode && encode.title) || extend({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); -} - -function groupEncode(_, userEncode) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: {signal: alignExpr}, - angle: {signal: angleExpr}, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') - }); - - return extendEncode(encode, userEncode, Skip); -} - -function buildTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.text, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode - }, userEncode); -} - -function buildSubTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.subtitle, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode - }, userEncode); -} diff --git a/node_modules/vega-parser/src/parsers/transform.js b/node_modules/vega-parser/src/parsers/transform.js deleted file mode 100644 index c90aae7..0000000 --- a/node_modules/vega-parser/src/parsers/transform.js +++ /dev/null @@ -1,156 +0,0 @@ -import {Params} from '../transforms'; -import {entry, fieldRef, isSignal, ref} from '../util'; -import {definition} from 'vega-dataflow'; -import {parseExpression} from 'vega-functions'; -import {error, extend, isArray, isString, stringValue} from 'vega-util'; - -/** - * Parse a data transform specification. - */ -export default function(spec, scope) { - var def = definition(spec.type); - if (!def) error('Unrecognized transform type: ' + stringValue(spec.type)); - - var t = entry(def.type.toLowerCase(), null, parseParameters(def, spec, scope)); - if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; - - return t; -} - -/** - * Parse all parameters of a data transform. - */ -function parseParameters(def, spec, scope) { - var params = {}, pdef, i, n; - for (i=0, n=def.params.length; i s.signal || s.scale ? (sources.push(s), 0) : 1); - - // merge internal operator listeners - if (sources.length > 1) { - sources = [mergeSources(sources)]; - } - - // merge event streams, include as source - if (events.length) { - sources.push(events.length > 1 ? {merge: events} : events[0]); - } - - if (encode != null) { - if (update) error('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + stringValue(encode) + ')'; - } - - // resolve update value - entry.update = isString(update) ? parseExpression(update, scope) - : update.expr != null ? parseExpression(update.expr, scope) - : update.value != null ? update.value - : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: {$value: scope.signalRef(update.signal)} - } - : error('Invalid signal update specification.'); - - if (spec.force) { - entry.options = {force: true}; - } - - sources.forEach(function(source) { - scope.addUpdate(extend(streamSource(source, scope), entry)); - }); -} - -function streamSource(stream, scope) { - return { - source: stream.signal ? scope.signalRef(stream.signal) - : stream.scale ? scope.scaleRef(stream.scale) - : parseStream(stream, scope) - }; -} - -function mergeSources(sources) { - return { - signal: '[' - + sources.map(s => s.scale ? 'scale("' + s.scale + '")' : s.signal) - + ']' - }; -} diff --git a/node_modules/vega-parser/src/parsers/view.js b/node_modules/vega-parser/src/parsers/view.js deleted file mode 100644 index 63dde7b..0000000 --- a/node_modules/vega-parser/src/parsers/view.js +++ /dev/null @@ -1,132 +0,0 @@ -import parseAutosize from './autosize'; -import parsePadding from './padding'; -import parseEncode from './encode'; -import parseSignal from './signal'; -import parseSpec from './scope'; -import {extendEncode} from './encode/util'; -import {GroupMark} from './marks/marktypes'; -import {FrameRole} from './marks/roles'; -import {operator, ref, value} from '../util'; -import DataScope from '../DataScope'; -import {Bound, Collect, Encode, Render, Sieve, ViewLayout} from '../transforms'; -import {array, extend, hasOwnProperty} from 'vega-util'; - -const rootEncode = spec => extendEncode( - { - enter: { - x: {value: 0}, - y: {value: 0} - }, - update: { - width: {signal: 'width'}, - height: {signal: 'height'} - } - }, - spec -); - -export default function parseView(spec, scope) { - const config = scope.config; - - // add scenegraph root - const root = ref(scope.root = scope.add(operator())); - - // parse top-level signal definitions - const signals = collectSignals(spec, config); - signals.forEach(_ => parseSignal(_, scope)); - - // assign description, event, legend, and locale configuration - scope.description = spec.description || config.description; - scope.eventConfig = config.events; - scope.legends = scope.objectProperty(config.legend && config.legend.layout); - scope.locale = config.locale; - - // store root group item - const input = scope.add(Collect()); - - // encode root group item - const encode = scope.add(Encode(parseEncode( - rootEncode(spec.encode), GroupMark, FrameRole, - spec.style, scope, {pulse: ref(input)} - ))); - - // perform view layout - const parent = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) - })); - scope.operators.pop(); - - // parse remainder of specification - scope.pushState(ref(encode), ref(parent), null); - parseSpec(spec, scope, signals); - scope.operators.push(parent); - - // bound / render / sieve root item - let op = scope.add(Bound({mark: root, pulse: ref(parent)})); - op = scope.add(Render({pulse: ref(op)})); - op = scope.add(Sieve({pulse: ref(op)})); - - // track metadata for root item - scope.addData('root', new DataScope(scope, input, input, op)); - - return scope; -} - -function signalObject(name, value) { - return value && value.signal - ? { name, update: value.signal } - : { name, value }; -} - -/** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ -function collectSignals(spec, config) { - const _ = name => value(spec[name], config[name]), - signals = [ - signalObject('background', _('background')), - signalObject('autosize', parseAutosize(_('autosize'))), - signalObject('padding', parsePadding(_('padding'))), - signalObject('width', _('width') || 0), - signalObject('height', _('height') || 0) - ], - pre = signals.reduce((p, s) => (p[s.name] = s, p), {}), - map = {}; - - // add spec signal array - array(spec.signals).forEach(s => { - if (hasOwnProperty(pre, s.name)) { - // merge if built-in signal - s = extend(pre[s.name], s); - } else { - // otherwise add to signal list - signals.push(s); - } - map[s.name] = s; - }); - - // add config signal array - array(config.signals).forEach(s => { - if (!hasOwnProperty(map, s.name) && !hasOwnProperty(pre, s.name)) { - // add to signal list if not already defined - signals.push(s); - } - }); - - return signals; -} diff --git a/node_modules/vega-parser/src/transforms.js b/node_modules/vega-parser/src/transforms.js deleted file mode 100644 index 1c88546..0000000 --- a/node_modules/vega-parser/src/transforms.js +++ /dev/null @@ -1,34 +0,0 @@ -import {entry} from './util'; - -const transform = name => (params, value, parent) => - entry(name, value, params || undefined, parent); - -export var Aggregate = transform('aggregate'); -export var AxisTicks = transform('axisticks'); -export var Bound = transform('bound'); -export var Collect = transform('collect'); -export var Compare = transform('compare'); -export var DataJoin = transform('datajoin'); -export var Encode = transform('encode'); -export var Expression = transform('expression'); -export var Extent = transform('extent'); -export var Facet = transform('facet'); -export var Field = transform('field'); -export var Key = transform('key'); -export var LegendEntries = transform('legendentries'); -export var Load = transform('load'); -export var Mark = transform('mark'); -export var MultiExtent = transform('multiextent'); -export var MultiValues = transform('multivalues'); -export var Overlap = transform('overlap'); -export var Params = transform('params'); -export var PreFacet = transform('prefacet'); -export var Projection = transform('projection'); -export var Proxy = transform('proxy'); -export var Relay = transform('relay'); -export var Render = transform('render'); -export var Scale = transform('scale'); -export var Sieve = transform('sieve'); -export var SortItems = transform('sortitems'); -export var ViewLayout = transform('viewlayout'); -export var Values = transform('values'); diff --git a/node_modules/vega-parser/src/util.js b/node_modules/vega-parser/src/util.js deleted file mode 100644 index 37e5e0e..0000000 --- a/node_modules/vega-parser/src/util.js +++ /dev/null @@ -1,95 +0,0 @@ -import {isObject} from 'vega-util'; - -export function Entry(type, value, params, parent) { - this.id = -1; - this.type = type; - this.value = value; - this.params = params; - if (parent) this.parent = parent; -} - -export function entry(type, value, params, parent) { - return new Entry(type, value, params, parent); -} - -export function operator(value, params) { - return entry('operator', value, params); -} - -// ----- - -export function ref(op) { - var ref = {$ref: op.id}; - // if operator not yet registered, cache ref to resolve later - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; -} - -export var tupleidRef = { - $tupleid: 1, - toString: function() { return ':_tupleid_:'; } -}; - -export function fieldRef(field, name) { - return name ? {$field: field, $name: name} : {$field: field}; -} - -export var keyFieldRef = fieldRef('key'); - -export function compareRef(fields, orders) { - return {$compare: fields, $order: orders}; -} - -export function keyRef(fields, flat) { - var ref = {$key: fields}; - if (flat) ref.$flat = true; - return ref; -} - -// ----- - -export var Ascending = 'ascending'; - -export var Descending = 'descending'; - -export function sortKey(sort) { - return !isObject(sort) ? '' - : (sort.order === Descending ? '-' : '+') - + aggrField(sort.op, sort.field); -} - -export function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') - + (op && field ? '_' : '') - + (field && field.signal ? '$' + field.signal : field || ''); -} - -// ----- - -export var Scope = 'scope'; - -export var View = 'view'; - -export function isSignal(_) { - return _ && _.signal; -} - -export function isExpr(_) { - return _ && _.expr; -} - -export function hasSignal(_) { - if (isSignal(_)) return true; - if (isObject(_)) for (var key in _) { - if (hasSignal(_[key])) return true; - } - return false; -} - -export function value(specValue, defaultValue) { - return specValue != null ? specValue : defaultValue; -} - -export function deref(v) { - return v && v.signal || v; -} diff --git a/node_modules/vega-projection/LICENSE b/node_modules/vega-projection/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-projection/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-projection/README.md b/node_modules/vega-projection/README.md deleted file mode 100644 index 23f5e91..0000000 --- a/node_modules/vega-projection/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# vega-projection - -Projections for cartographic mapping. - -This package provides a [projection](#projection) method for managing registered cartographic projections. By default, the projection registry includes all projection types provided by the [d3-geo](https://github.com/d3/d3-geo) module. - -## API Reference - -# -vega.projection(type[, projection]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-projection/src/projections.js "Source") - -Registry function for adding and accessing projection constructor functions. The *type* argument is a String indicating the name of the projection type. If the *projection* argument is not specified, this method returns the matching projection constructor in the registry, or `null` if not found. If the *projection* argument is provided, it must be a projection constructor function to add to the registry under the given *type* name. - -By default, the projection registry includes entries for all projection types provided by the [d3-geo](https://github.com/d3/d3-geo) module. Projections created using the constructor returned by this method are augmented with the following additional properties: - -- `type`: A string value indicating the projection type. -- `path`: A D3 [geoPath](https://github.com/d3/d3-geo#geoPath) instance configured to use the projection. When using this path instance, be sure to set the [path context](https://github.com/d3/d3-geo#path_context) as needed. -- `copy`: A zero-argument function the produces a copy of the projection. - - -```js -// mercator projection -var mercator = vega.projection('mercator'); -var proj = mercator().translate([400, 200]); -scale.type; // 'mercator' -scale([0, 0]); // [400, 200] center point -``` diff --git a/node_modules/vega-projection/build/vega-projection.js b/node_modules/vega-projection/build/vega-projection.js deleted file mode 100644 index 6e6d251..0000000 --- a/node_modules/vega-projection/build/vega-projection.js +++ /dev/null @@ -1,106 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-geo'), require('d3-geo-projection')) : - typeof define === 'function' && define.amd ? define(['exports', 'd3-geo', 'd3-geo-projection'], factory) : - (global = global || self, factory(global.vega = {}, global.d3, global.d3)); -}(this, (function (exports, d3Geo, d3GeoProjection) { 'use strict'; - - var defaultPath = d3Geo.geoPath(); - - var projectionProperties = [ - // standard properties in d3-geo - 'clipAngle', - 'clipExtent', - 'scale', - 'translate', - 'center', - 'rotate', - 'parallels', - 'precision', - 'reflectX', - 'reflectY', - - // extended properties in d3-geo-projections - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' - ]; - - /** - * Augment projections with their type and a copy method. - */ - function create(type, constructor) { - return function projection() { - var p = constructor(); - - p.type = type; - - p.path = d3Geo.geoPath().projection(p); - - p.copy = p.copy || function() { - var c = projection(); - projectionProperties.forEach(function(prop) { - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - - return p; - }; - } - - function projection(type, proj) { - if (!type || typeof type !== 'string') { - throw new Error('Projection type must be a name string.'); - } - type = type.toLowerCase(); - if (arguments.length > 1) { - projections[type] = create(type, proj); - return this; - } else { - return projections[type] || null; - } - } - - function getProjectionPath(proj) { - return (proj && proj.path) || defaultPath; - } - - var projections = { - // base d3-geo projection types - albers: d3Geo.geoAlbers, - albersusa: d3Geo.geoAlbersUsa, - azimuthalequalarea: d3Geo.geoAzimuthalEqualArea, - azimuthalequidistant: d3Geo.geoAzimuthalEquidistant, - conicconformal: d3Geo.geoConicConformal, - conicequalarea: d3Geo.geoConicEqualArea, - conicequidistant: d3Geo.geoConicEquidistant, - equalEarth: d3Geo.geoEqualEarth, - equirectangular: d3Geo.geoEquirectangular, - gnomonic: d3Geo.geoGnomonic, - identity: d3Geo.geoIdentity, - mercator: d3Geo.geoMercator, - mollweide: d3GeoProjection.geoMollweide, - naturalEarth1: d3Geo.geoNaturalEarth1, - orthographic: d3Geo.geoOrthographic, - stereographic: d3Geo.geoStereographic, - transversemercator: d3Geo.geoTransverseMercator - }; - - for (var key in projections) { - projection(key, projections[key]); - } - - exports.getProjectionPath = getProjectionPath; - exports.projection = projection; - exports.projectionProperties = projectionProperties; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-projection/build/vega-projection.min.js b/node_modules/vega-projection/build/vega-projection.min.js deleted file mode 100644 index 909c91b..0000000 --- a/node_modules/vega-projection/build/vega-projection.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-geo"),require("d3-geo-projection")):"function"==typeof define&&define.amd?define(["exports","d3-geo","d3-geo-projection"],t):t((e=e||self).vega={},e.d3,e.d3)}(this,(function(e,t,o){"use strict";var r=t.geoPath(),a=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function i(e,o){return function r(){var i=o();return i.type=e,i.path=t.geoPath().projection(i),i.copy=i.copy||function(){var e=r();return a.forEach((function(t){i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},i}}function n(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(c[e]=i(e,t),this):c[e]||null}var c={albers:t.geoAlbers,albersusa:t.geoAlbersUsa,azimuthalequalarea:t.geoAzimuthalEqualArea,azimuthalequidistant:t.geoAzimuthalEquidistant,conicconformal:t.geoConicConformal,conicequalarea:t.geoConicEqualArea,conicequidistant:t.geoConicEquidistant,equalEarth:t.geoEqualEarth,equirectangular:t.geoEquirectangular,gnomonic:t.geoGnomonic,identity:t.geoIdentity,mercator:t.geoMercator,mollweide:o.geoMollweide,naturalEarth1:t.geoNaturalEarth1,orthographic:t.geoOrthographic,stereographic:t.geoStereographic,transversemercator:t.geoTransverseMercator};for(var u in c)n(u,c[u]);e.getProjectionPath=function(e){return e&&e.path||r},e.projection=n,e.projectionProperties=a,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-projection/index.js b/node_modules/vega-projection/index.js deleted file mode 100644 index d1e9574..0000000 --- a/node_modules/vega-projection/index.js +++ /dev/null @@ -1,5 +0,0 @@ -export { - projection, - projectionProperties, - getProjectionPath -} from './src/projections'; diff --git a/node_modules/vega-projection/package.json b/node_modules/vega-projection/package.json deleted file mode 100644 index e9628ae..0000000 --- a/node_modules/vega-projection/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "_from": "vega-projection@~1.4.2", - "_id": "vega-projection@1.4.2", - "_inBundle": false, - "_integrity": "sha512-eULwc/8TMVjFkGtIVF5IGpJzEksnS0ccbaaCH9QjHtQTyBaR2CA679r5/98x6ur7ZLaYgcm2o082kjReUoyncA==", - "_location": "/vega-projection", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-projection@~1.4.2", - "name": "vega-projection", - "escapedName": "vega-projection", - "rawSpec": "~1.4.2", - "saveSpec": null, - "fetchSpec": "~1.4.2" - }, - "_requiredBy": [ - "/vega", - "/vega-geo" - ], - "_resolved": "https://registry.npmjs.org/vega-projection/-/vega-projection-1.4.2.tgz", - "_shasum": "2e5edfffac54e8ba8ab56fba29f174dab0bc98d1", - "_spec": "vega-projection@~1.4.2", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-geo": "^1.12.1", - "d3-geo-projection": "^2.9.0" - }, - "deprecated": false, - "description": "Projections for cartographic mapping.", - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "geo", - "projection" - ], - "license": "BSD-3-Clause", - "main": "build/vega-projection.js", - "module": "index", - "name": "vega-projection", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-projection.js -c -m -o build/vega-projection.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g d3-geo:d3,d3-geo-projection:d3 -f umd -n vega -o build/vega-projection.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "1.4.2" -} diff --git a/node_modules/vega-projection/src/projections.js b/node_modules/vega-projection/src/projections.js deleted file mode 100644 index 81e0a40..0000000 --- a/node_modules/vega-projection/src/projections.js +++ /dev/null @@ -1,116 +0,0 @@ -import { - geoAlbers, - geoAlbersUsa, - geoAzimuthalEqualArea, - geoAzimuthalEquidistant, - geoConicConformal, - geoConicEqualArea, - geoConicEquidistant, - geoEqualEarth, - geoEquirectangular, - geoGnomonic, - geoIdentity, - geoMercator, - geoNaturalEarth1, - geoOrthographic, - geoPath, - geoStereographic, - geoTransverseMercator -} from 'd3-geo'; - -import { - geoMollweide -} from 'd3-geo-projection'; - -var defaultPath = geoPath(); - -export var projectionProperties = [ - // standard properties in d3-geo - 'clipAngle', - 'clipExtent', - 'scale', - 'translate', - 'center', - 'rotate', - 'parallels', - 'precision', - 'reflectX', - 'reflectY', - - // extended properties in d3-geo-projections - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' -]; - -/** - * Augment projections with their type and a copy method. - */ -function create(type, constructor) { - return function projection() { - var p = constructor(); - - p.type = type; - - p.path = geoPath().projection(p); - - p.copy = p.copy || function() { - var c = projection(); - projectionProperties.forEach(function(prop) { - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - - return p; - }; -} - -export function projection(type, proj) { - if (!type || typeof type !== 'string') { - throw new Error('Projection type must be a name string.'); - } - type = type.toLowerCase(); - if (arguments.length > 1) { - projections[type] = create(type, proj); - return this; - } else { - return projections[type] || null; - } -} - -export function getProjectionPath(proj) { - return (proj && proj.path) || defaultPath; -} - -var projections = { - // base d3-geo projection types - albers: geoAlbers, - albersusa: geoAlbersUsa, - azimuthalequalarea: geoAzimuthalEqualArea, - azimuthalequidistant: geoAzimuthalEquidistant, - conicconformal: geoConicConformal, - conicequalarea: geoConicEqualArea, - conicequidistant: geoConicEquidistant, - equalEarth: geoEqualEarth, - equirectangular: geoEquirectangular, - gnomonic: geoGnomonic, - identity: geoIdentity, - mercator: geoMercator, - mollweide: geoMollweide, - naturalEarth1: geoNaturalEarth1, - orthographic: geoOrthographic, - stereographic: geoStereographic, - transversemercator: geoTransverseMercator -}; - -for (var key in projections) { - projection(key, projections[key]); -} diff --git a/node_modules/vega-regression/LICENSE b/node_modules/vega-regression/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-regression/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-regression/README.md b/node_modules/vega-regression/README.md deleted file mode 100644 index 35ee8b0..0000000 --- a/node_modules/vega-regression/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# vega-regression - -Regression model fitting for Vega dataflows. - -This package provides the following Vega data transforms: - -- [**Loess**](https://vega.github.io/vega/docs/transforms/loess/) [<>](https://github.com/vega/vega/blob/master/packages/vega-regression/src/Loess.js "Source") -- [**Regression**](https://vega.github.io/vega/docs/transforms/regression/) [<>](https://github.com/vega/vega/blob/master/packages/vega-regression/src/Regression.js "Source") diff --git a/node_modules/vega-regression/build/vega-regression.js b/node_modules/vega-regression/build/vega-regression.js deleted file mode 100644 index 30b9599..0000000 --- a/node_modules/vega-regression/build/vega-regression.js +++ /dev/null @@ -1,212 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-statistics'), require('vega-dataflow'), require('vega-util')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-statistics', 'vega-dataflow', 'vega-util'], factory) : - (global = global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.vega, global.vega, global.vega)); -}(this, (function (exports, vegaStatistics, vegaDataflow, vegaUtil) { 'use strict'; - - function partition(data, groupby) { - var groups = [], - get = function(f) { return f(t); }, - map, i, n, t, k, g; - - // partition data points into stack groups - if (groupby == null) { - groups.push(data); - } else { - for (map={}, i=0, n=data.length; i} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ - function Loess(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Loess.Definition = { - 'type': 'Loess', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0.3 }, - { 'name': 'as', 'type': 'string', 'array': true } - ] - }; - - var prototype = vegaUtil.inherits(Loess, vegaDataflow.Transform); - - prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby), - names = (_.groupby || []).map(vegaUtil.accessorName), - m = names.length, - as = _.as || [vegaUtil.accessorName(_.x), vegaUtil.accessorName(_.y)], - values = []; - - groups.forEach(g => { - vegaStatistics.regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(p => { - const t = {}; - for (let i=0; i} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ - function Regression(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Regression.Definition = { - 'type': 'Regression', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'string', 'default': 'linear', 'values': Object.keys(Methods) }, - { 'name': 'order', 'type': 'number', 'default': 3 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'params', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true } - ] - }; - - var prototype$1 = vegaUtil.inherits(Regression, vegaDataflow.Transform); - - prototype$1.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby), - names = (_.groupby || []).map(vegaUtil.accessorName), - method = _.method || 'linear', - order = _.order || 3, - dof = degreesOfFreedom(method, order), - as = _.as || [vegaUtil.accessorName(_.x), vegaUtil.accessorName(_.y)], - fit = Methods[method], - values = []; - - let domain = _.extent; - - if (!vegaUtil.hasOwnProperty(Methods, method)) { - vegaUtil.error('Invalid regression method: ' + method); - } - - if (domain != null) { - if (method === 'log' && domain[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - domain = null; - } - } - - groups.forEach(g => { - const n = g.length; - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - - const model = fit(g, _.x, _.y, order); - - if (_.params) { - // if parameter vectors requested return those - values.push(vegaDataflow.ingest({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - return; - } - - const dom = domain || vegaUtil.extent(g, _.x), - add = p => { - const t = {}; - for (let i=0; i add([x, model.predict(x)])); - } else { - // otherwise return trend line sample points - vegaStatistics.sampleCurve(model.predict, dom, 25, 200).forEach(add); - } - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; - }; - - exports.loess = Loess; - exports.regression = Regression; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-regression/build/vega-regression.min.js b/node_modules/vega-regression/build/vega-regression.min.js deleted file mode 100644 index 63b38bd..0000000 --- a/node_modules/vega-regression/build/vega-regression.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("vega-statistics"),require("vega-dataflow"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-statistics","vega-dataflow","vega-util"],r):r(((e=e||self).vega=e.vega||{},e.vega.transforms={}),e.vega,e.vega,e.vega)}(this,(function(e,r,a,t){"use strict";function n(e,r){var a,t,n,s,i,o,u=[],l=function(e){return e(s)};if(null==r)u.push(e);else for(a={},t=0,n=e.length;t{r.regressionLoess(t,e.x,e.y,e.bandwidth||.3).forEach(e=>{const r={};for(let e=0;e{if(n.length<=m)return void s.dataflow.warn("Skipping regression with more parameters than data points.");const i=c(n,e.x,e.y,f);if(e.params)return void g.push(a.ingest({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const o=y||t.extent(n,e.x),u=e=>{const r={};for(let e=0;eu([e,i.predict(e)])):r.sampleCurve(i.predict,o,25,200).forEach(u)}),this.value&&(o.rem=this.value),this.value=o.add=o.source=g}return o},e.loess=s,e.regression=o,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-regression/index.js b/node_modules/vega-regression/index.js deleted file mode 100644 index 5396919..0000000 --- a/node_modules/vega-regression/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export {default as loess} from './src/Loess'; -export {default as regression} from './src/Regression'; diff --git a/node_modules/vega-regression/package.json b/node_modules/vega-regression/package.json deleted file mode 100644 index dd3565e..0000000 --- a/node_modules/vega-regression/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "_from": "vega-regression@~1.0.6", - "_id": "vega-regression@1.0.6", - "_inBundle": false, - "_integrity": "sha512-s4kjsKp23WvDJDHkpIrGNUaLI3/95k6nTURj9RDtM4C6CbUgO2snIaEfki4JfOCnBYtvotwDuZgXKmJInu9hVw==", - "_location": "/vega-regression", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-regression@~1.0.6", - "name": "vega-regression", - "escapedName": "vega-regression", - "rawSpec": "~1.0.6", - "saveSpec": null, - "fetchSpec": "~1.0.6" - }, - "_requiredBy": [ - "/vega" - ], - "_resolved": "https://registry.npmjs.org/vega-regression/-/vega-regression-1.0.6.tgz", - "_shasum": "0081a91328e933c826813c06afe7041915532d4f", - "_spec": "vega-regression@~1.0.6", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "^2.4.0", - "vega-dataflow": "^5.5.1", - "vega-statistics": "^1.7.4", - "vega-util": "^1.13.2" - }, - "deprecated": false, - "description": "Regression transform for Vega dataflows.", - "devDependencies": { - "vega-transforms": "*" - }, - "gitHead": "35e31c5c6b54db9dc3a577b5adad8d15ec274d32", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "regression", - "loess" - ], - "license": "BSD-3-Clause", - "main": "build/vega-regression.js", - "module": "index", - "name": "vega-regression", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-regression.js -c -m -o build/vega-regression.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g d3-array:d3,vega-dataflow:vega,vega-statistics:vega,vega-util:vega -f umd -n vega.transforms -o build/vega-regression.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "1.0.6" -} diff --git a/node_modules/vega-regression/src/Loess.js b/node_modules/vega-regression/src/Loess.js deleted file mode 100644 index 5bc7b72..0000000 --- a/node_modules/vega-regression/src/Loess.js +++ /dev/null @@ -1,61 +0,0 @@ -import partition from './partition'; -import {regressionLoess} from 'vega-statistics'; -import {Transform, ingest} from 'vega-dataflow'; -import {accessorName, inherits} from 'vega-util'; - -/** - * Compute locally-weighted regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ -export default function Loess(params) { - Transform.call(this, null, params); -} - -Loess.Definition = { - 'type': 'Loess', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0.3 }, - { 'name': 'as', 'type': 'string', 'array': true } - ] -}; - -var prototype = inherits(Loess, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby), - names = (_.groupby || []).map(accessorName), - m = names.length, - as = _.as || [accessorName(_.x), accessorName(_.y)], - values = []; - - groups.forEach(g => { - regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(p => { - const t = {}; - for (let i=0; i} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ -export default function Regression(params) { - Transform.call(this, null, params); -} - -Regression.Definition = { - 'type': 'Regression', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'string', 'default': 'linear', 'values': Object.keys(Methods) }, - { 'name': 'order', 'type': 'number', 'default': 3 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'params', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true } - ] -}; - -var prototype = inherits(Regression, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby), - names = (_.groupby || []).map(accessorName), - method = _.method || 'linear', - order = _.order || 3, - dof = degreesOfFreedom(method, order), - as = _.as || [accessorName(_.x), accessorName(_.y)], - fit = Methods[method], - values = []; - - let domain = _.extent; - - if (!hasOwnProperty(Methods, method)) { - error('Invalid regression method: ' + method); - } - - if (domain != null) { - if (method === 'log' && domain[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - domain = null; - } - } - - groups.forEach(g => { - const n = g.length; - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - - const model = fit(g, _.x, _.y, order); - - if (_.params) { - // if parameter vectors requested return those - values.push(ingest({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - return; - } - - const dom = domain || extent(g, _.x), - add = p => { - const t = {}; - for (let i=0; i add([x, model.predict(x)])); - } else { - // otherwise return trend line sample points - sampleCurve(model.predict, dom, 25, 200).forEach(add); - } - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; -}; diff --git a/node_modules/vega-regression/src/partition.js b/node_modules/vega-regression/src/partition.js deleted file mode 100644 index 317a1f8..0000000 --- a/node_modules/vega-regression/src/partition.js +++ /dev/null @@ -1,24 +0,0 @@ -export default function(data, groupby) { - var groups = [], - get = function(f) { return f(t); }, - map, i, n, t, k, g; - - // partition data points into stack groups - if (groupby == null) { - groups.push(data); - } else { - for (map={}, i=0, n=data.length; i ctx.parseOperator(entry)); - - // parse operator parameters - operators.forEach(entry => ctx.parseOperatorParameters(entry)); - - // parse streams - (spec.streams || []).forEach(entry => ctx.parseStream(entry)); - - // parse updates - (spec.updates || []).forEach(entry => ctx.parseUpdate(entry)); - - return ctx.resolve(); - } - - const Skip = vegaUtil.toSet(['rule']), - Swap = vegaUtil.toSet(['group', 'image', 'rect']); - - function adjustSpatial(encode, marktype) { - let code = ''; - - if (Skip[marktype]) return code; - - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) { - code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - } - code += 'o.width=o.x2-o.x;'; - } else { - code += 'o.x=o.x2-(o.width||0);'; - } - } - - if (encode.xc) { - code += 'o.x=o.xc-(o.width||0)/2;'; - } - - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) { - code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - } - code += 'o.height=o.y2-o.y;'; - } else { - code += 'o.y=o.y2-(o.height||0);'; - } - } - - if (encode.yc) { - code += 'o.y=o.yc-(o.height||0)/2;'; - } - - return code; - } - - function canonicalType(type) { - return (type + '').toLowerCase(); - } - - function isOperator(type) { - return canonicalType(type) === 'operator'; - } - - function isCollect(type) { - return canonicalType(type) === 'collect'; - } - - function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (code[code.length-1] !== ';') { - code = 'return(' + code + ');'; - } - var fn = Function.apply(null, args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; - } - - // generate code for comparing a single field - function _compare(u, v, lt, gt) { - return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt} - : (u > v || v == null) && u != null ? ${gt} - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} - : v !== v && u === u ? ${gt} : `; - } - - var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ - operator: (ctx, expr) => expression(ctx, ['_'], expr.code), - - /** - * Parse an expression provided as an operator parameter value. - */ - parameter: (ctx, expr) => expression(ctx, ['datum', '_'], expr.code), - - /** - * Parse an expression applied to an event stream. - */ - event: (ctx, expr) => expression(ctx, ['event'], expr.code), - - /** - * Parse an expression used to handle an event-driven operator update. - */ - handler: (ctx, expr) => { - const code = `var datum=event.item&&event.item.datum;return ${expr.code};`; - return expression(ctx, ['_', 'event'], code); - }, - - /** - * Parse an expression that performs visual encoding. - */ - encode: (ctx, encode) => { - const {marktype, channels} = encode; - - let code = 'var o=item,datum=o.datum,m=0,$;'; - for (const name in channels) { - const o ='o[' + vegaUtil.stringValue(name) + ']'; - code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; - } - code += adjustSpatial(channels, marktype); - code += 'return m;'; - - return expression(ctx, ['item', '_'], code); - }, - - /** - * Optimized code generators for access and comparison. - */ - codegen: { - get(path) { - const ref = `[${path.map(vegaUtil.stringValue).join('][')}]`; - const get = Function('_', `return _${ref};`); - get.path = ref; - return get; - }, - comparator(fields, orders) { - let t; - const map = (f, i) => { - const o = orders[i]; - let u, v; - if (f.path) { - u = `a${f.path}`; - v = `b${f.path}`; - } else { - (t = t || {})['f'+i] = f; - u = `this.f${i}(a)`; - v = `this.f${i}(b)`; - } - return _compare(u, v, -o, o); - }; - - const fn = Function('a', 'b', 'var u, v; return ' - + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } - }; - - /** - * Parse a dataflow operator. - */ - function parseOperator(spec) { - const ctx = this; - if (isOperator(spec.type) || !spec.type) { - ctx.operator( - spec, - spec.update ? ctx.operatorExpression(spec.update) : null - ); - } else { - ctx.transform(spec, spec.type); - } - } - - /** - * Parse and assign operator parameters. - */ - function parseOperatorParameters(spec) { - const ctx = this; - if (spec.params) { - const op = ctx.get(spec.id); - if (!op) vegaUtil.error('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters( - ctx.parseParameters(spec.params), - spec.react, - spec.initonly - )); - } - } - - /** - * Parse a set of operator parameters. - */ - function parseParameters(spec, params) { - params = params || {}; - const ctx = this; - - for (const key in spec) { - const value = spec[key]; - params[key] = vegaUtil.isArray(value) - ? value.map(v => parseParameter(v, ctx, params)) - : parseParameter(value, ctx, params); - } - - return params; - } - - /** - * Parse a single parameter. - */ - function parseParameter(spec, ctx, params) { - if (!spec || !vegaUtil.isObject(spec)) return spec; - - for (let i=0, n=PARSERS.length, p; i (_ && _.$tupleid) ? vegaDataflow.tupleid : _); - return ctx.fn[k] || (ctx.fn[k] = vegaUtil.compare(c, _.$order, ctx.expr.codegen)); - } - - /** - * Resolve an encode operator reference. - */ - function getEncode(_, ctx) { - const spec = _.$encode, - encode = {}; - - for (const name in spec) { - const enc = spec[name]; - encode[name] = vegaUtil.accessor(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - return encode; - } - - /** - * Resolve a context reference. - */ - function getContext(_, ctx) { - return ctx; - } - - /** - * Resolve a recursive subflow specification. - */ - function getSubflow(_, ctx) { - const spec = _.$subflow; - return function(dataflow, key, parent) { - const subctx = ctx.fork().parse(spec), - op = subctx.get(spec.operators[0].id), - p = subctx.signals.parent; - if (p) p.set(parent); - op.detachSubflow = () => ctx.detach(subctx); - return op; - }; - } - - /** - * Resolve a tuple id reference. - */ - function getTupleId() { - return vegaDataflow.tupleid; - } - - /** - * Parse an event stream specification. - */ - function parseStream(spec) { - var ctx = this, - filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, - stream = spec.stream != null ? ctx.get(spec.stream) : undefined, - args; - - if (spec.source) { - stream = ctx.events(spec.source, spec.type, filter); - } - else if (spec.merge) { - args = spec.merge.map(_ => ctx.get(_)); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - - if (spec.between) { - args = spec.between.map(_ => ctx.get(_)); - stream = stream.between(args[0], args[1]); - } - - if (spec.filter) { - stream = stream.filter(filter); - } - - if (spec.throttle != null) { - stream = stream.throttle(+spec.throttle); - } - - if (spec.debounce != null) { - stream = stream.debounce(+spec.debounce); - } - - if (stream == null) { - vegaUtil.error('Invalid stream definition: ' + JSON.stringify(spec)); - } - - if (spec.consume) stream.consume(true); - - ctx.stream(spec, stream); - } - - /** - * Parse an event-driven operator update. - */ - function parseUpdate(spec) { - var ctx = this, - srcid = vegaUtil.isObject(srcid = spec.source) ? srcid.$ref : srcid, - source = ctx.get(srcid), - target = null, - update = spec.update, - params = undefined; - - if (!source) vegaUtil.error('Source not defined: ' + spec.source); - - target = spec.target && spec.target.$expr - ? ctx.eventExpression(spec.target.$expr) - : ctx.get(spec.target); - - if (update && update.$expr) { - if (update.$params) { - params = ctx.parseParameters(update.$params); - } - update = ctx.handlerExpression(update.$expr); - } - - ctx.update(spec, source, target, update, params); - } - - var SKIP = {skip: true}; - - function getState(options) { - var ctx = this, - state = {}; - - if (options.signals) { - var signals = (state.signals = {}); - Object.keys(ctx.signals).forEach(key => { - var op = ctx.signals[key]; - if (options.signals(key, op)) { - signals[key] = op.value; - } - }); - } - - if (options.data) { - var data = (state.data = {}); - Object.keys(ctx.data).forEach(key => { - var dataset = ctx.data[key]; - if (options.data(key, dataset)) { - data[key] = dataset.input.value; - } - }); - } - - if (ctx.subcontext && options.recurse !== false) { - state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options)); - } - - return state; - } - - function setState(state) { - var ctx = this, - df = ctx.dataflow, - data = state.data, - signals = state.signals; - - Object.keys(signals || {}).forEach(key => { - df.update(ctx.signals[key], signals[key], SKIP); - }); - - Object.keys(data || {}).forEach(key => { - df.pulse( - ctx.data[key].input, - df.changeset().remove(vegaUtil.truthy).insert(data[key]) - ); - }); - - (state.subcontext || []).forEach((substate, i) => { - var subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); - } - - /** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ - function context(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); - } - - function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, - this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } - } - - function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } - } - - Context.prototype = Subcontext.prototype = { - fork() { - const ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; - }, - detach(ctx) { - this.subcontext = this.subcontext.filter(c => c !== ctx); - - // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - const keys = Object.keys(ctx.nodes); - for (const key of keys) ctx.nodes[key]._targets = null; - for (const key of keys) ctx.nodes[key].detach(); - ctx.nodes = null; - }, - get(id) { - return this.nodes[id]; - }, - set(id, node) { - return this.nodes[id] = node; - }, - add(spec, op) { - const ctx = this, - df = ctx.dataflow, - data = spec.value; - - ctx.set(spec.id, op); - - if (isCollect(spec.type) && data) { - if (data.$ingest) { - df.ingest(op, data.$ingest, data.$format); - } else if (data.$request) { - df.preload(op, data.$request, data.$format); - } else { - df.pulse(op, df.changeset().insert(data)); - } - } - - if (spec.root) { - ctx.root = op; - } - - if (spec.parent) { - var p = ctx.get(spec.parent.$ref); - if (p) { - df.connect(p, [op]); - op.targets().add(p); - } else { - (ctx.unresolved = ctx.unresolved || []).push(() => { - p = ctx.get(spec.parent.$ref); - df.connect(p, [op]); - op.targets().add(p); - }); - } - } - - if (spec.signal) { - ctx.signals[spec.signal] = op; - } - - if (spec.scale) { - ctx.scales[spec.scale] = op; - } - - if (spec.data) { - for (const name in spec.data) { - const data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach(role => data[role] = op); - } - } - }, - resolve() { - (this.unresolved || []).forEach(fn => fn()); - delete this.unresolved; - return this; - }, - operator(spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); - }, - transform(spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); - }, - stream(spec, stream) { - this.set(spec.id, stream); - }, - update(spec, stream, target, update, params) { - this.dataflow.on(stream, target, update, params, spec.options); - }, - - // expression parsing - operatorExpression(expr) { - return this.expr.operator(this, expr); - }, - parameterExpression(expr) { - return this.expr.parameter(this, expr); - }, - eventExpression(expr) { - return this.expr.event(this, expr); - }, - handlerExpression(expr) { - return this.expr.handler(this, expr); - }, - encodeExpression(encode) { - return this.expr.encode(this, encode); - }, - - // parse methods - parse, - parseOperator, - parseOperatorParameters, - parseParameters, - parseStream, - parseUpdate, - - // state methods - getState, - setState - }; - - exports.context = context; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-runtime/build/vega-runtime.min.js b/node_modules/vega-runtime/build/vega-runtime.min.js deleted file mode 100644 index fc2b7b7..0000000 --- a/node_modules/vega-runtime/build/vega-runtime.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-dataflow"],t):t((e=e||self).vega={},e.vega,e.vega)}(this,(function(e,t,r){"use strict";const n=t.toSet(["rule"]),s=t.toSet(["group","image","rect"]);function a(e){return(e+"").toLowerCase()}function o(e,t,r){";"!==r[r.length-1]&&(r="return("+r+");");var n=Function.apply(null,t.concat(r));return e&&e.functions?n.bind(e.functions):n}var i={operator:(e,t)=>o(e,["_"],t.code),parameter:(e,t)=>o(e,["datum","_"],t.code),event:(e,t)=>o(e,["event"],t.code),handler:(e,t)=>o(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,r)=>{const{marktype:a,channels:i}=r;let c="var o=item,datum=o.datum,m=0,$;";for(const e in i){const r="o["+t.stringValue(e)+"]";c+=`$=${i[e].code};if(${r}!==$)${r}=$,m=1;`}return c+=function(e,t){let r="";return n[t]||(e.x2&&(e.x?(s[t]&&(r+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),r+="o.width=o.x2-o.x;"):r+="o.x=o.x2-(o.width||0);"),e.xc&&(r+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(s[t]&&(r+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),r+="o.height=o.y2-o.y;"):r+="o.y=o.y2-(o.height||0);"),e.yc&&(r+="o.y=o.yc-(o.height||0)/2;")),r}(i,a),c+="return m;",o(e,["item","_"],c)},codegen:{get(e){const r=`[${e.map(t.stringValue).join("][")}]`,n=Function("_",`return _${r};`);return n.path=r,n},comparator(e,t){let r;const n=Function("a","b","var u, v; return "+e.map((e,n)=>{const s=t[n];let a,o;return e.path?(a="a"+e.path,o="b"+e.path):((r=r||{})["f"+n]=e,a=`this.f${n}(a)`,o=`this.f${n}(b)`),function(e,t,r,n){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${r}\n : (u > v || v == null) && u != null ? ${n}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${r}\n : v !== v && u === u ? ${n} : `}(a,o,-s,s)}).join("")+"0;");return r?n.bind(r):n}}};function c(e,r,n){if(!e||!t.isObject(e))return e;for(let s,a=0,o=u.length;ae&&e.$tupleid?r.tupleid:e);return n.fn[s]||(n.fn[s]=t.compare(a,e.$order,n.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const r=e.$subflow;return function(e,n,s){const a=t.fork().parse(r),o=a.get(r.operators[0].id),i=a.signals.parent;return i&&i.set(s),o.detachSubflow=()=>t.detach(a),o}}},{key:"$tupleid",parse:function(){return r.tupleid}}];var p={skip:!0};function f(e,t,r,n){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=n||i,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},r&&(this.functions=Object.create(r),this.functions.context=this)}function d(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}f.prototype=d.prototype={fork(){const e=new d(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(t=>t!==e);const t=Object.keys(e.nodes);for(const r of t)e.nodes[r]._targets=null;for(const r of t)e.nodes[r].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const r=this,n=r.dataflow,s=e.value;if(r.set(e.id,t),"collect"===a(e.type)&&s&&(s.$ingest?n.ingest(t,s.$ingest,s.$format):s.$request?n.preload(t,s.$request,s.$format):n.pulse(t,n.changeset().insert(s))),e.root&&(r.root=t),e.parent){var o=r.get(e.parent.$ref);o?(n.connect(o,[t]),t.targets().add(o)):(r.unresolved=r.unresolved||[]).push(()=>{o=r.get(e.parent.$ref),n.connect(o,[t]),t.targets().add(o)})}if(e.signal&&(r.signals[e.signal]=t),e.scale&&(r.scales[e.scale]=t),e.data)for(const n in e.data){const s=r.data[n]||(r.data[n]={});e.data[n].forEach(e=>s[e]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[a(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,r,n,s){this.dataflow.on(t,r,n,s,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,r=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),r.forEach(e=>t.parseOperator(e)),r.forEach(e=>t.parseOperatorParameters(e)),(e.streams||[]).forEach(e=>t.parseStream(e)),(e.updates||[]).forEach(e=>t.parseUpdate(e)),t.resolve()},parseOperator:function(e){const t=this;"operator"!==a(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const r=this;if(e.params){const n=r.get(e.id);n||t.error("Invalid operator id: "+e.id),r.dataflow.connect(n,n.parameters(r.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,r){r=r||{};const n=this;for(const s in e){const a=e[s];r[s]=t.isArray(a)?a.map(e=>c(e,n,r)):c(a,n,r)}return r},parseStream:function(e){var r,n=this,s=null!=e.filter?n.eventExpression(e.filter):void 0,a=null!=e.stream?n.get(e.stream):void 0;e.source?a=n.events(e.source,e.type,s):e.merge&&(a=(r=e.merge.map(e=>n.get(e)))[0].merge.apply(r[0],r.slice(1))),e.between&&(r=e.between.map(e=>n.get(e)),a=a.between(r[0],r[1])),e.filter&&(a=a.filter(s)),null!=e.throttle&&(a=a.throttle(+e.throttle)),null!=e.debounce&&(a=a.debounce(+e.debounce)),null==a&&t.error("Invalid stream definition: "+JSON.stringify(e)),e.consume&&a.consume(!0),n.stream(e,a)},parseUpdate:function(e){var r,n=t.isObject(n=e.source)?n.$ref:n,s=this.get(n),a=e.update,o=void 0;s||t.error("Source not defined: "+e.source),r=e.target&&e.target.$expr?this.eventExpression(e.target.$expr):this.get(e.target),a&&a.$expr&&(a.$params&&(o=this.parseParameters(a.$params)),a=this.handlerExpression(a.$expr)),this.update(e,s,r,a,o)},getState:function(e){var t=this,r={};if(e.signals){var n=r.signals={};Object.keys(t.signals).forEach(r=>{var s=t.signals[r];e.signals(r,s)&&(n[r]=s.value)})}if(e.data){var s=r.data={};Object.keys(t.data).forEach(r=>{var n=t.data[r];e.data(r,n)&&(s[r]=n.input.value)})}return t.subcontext&&!1!==e.recurse&&(r.subcontext=t.subcontext.map(t=>t.getState(e))),r},setState:function(e){var r=this,n=r.dataflow,s=e.data,a=e.signals;Object.keys(a||{}).forEach(e=>{n.update(r.signals[e],a[e],p)}),Object.keys(s||{}).forEach(e=>{n.pulse(r.data[e].input,n.changeset().remove(t.truthy).insert(s[e]))}),(e.subcontext||[]).forEach((e,t)=>{var n=r.subcontext[t];n&&n.setState(e)})}},e.context=function(e,t,r,n){return new f(e,t,r,n)},Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-runtime/index.js b/node_modules/vega-runtime/index.js deleted file mode 100644 index d6e3023..0000000 --- a/node_modules/vega-runtime/index.js +++ /dev/null @@ -1 +0,0 @@ -export {default as context} from './src/context'; diff --git a/node_modules/vega-runtime/package.json b/node_modules/vega-runtime/package.json deleted file mode 100644 index 8e51bef..0000000 --- a/node_modules/vega-runtime/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "_from": "vega-runtime@~6.1.0", - "_id": "vega-runtime@6.1.0", - "_inBundle": false, - "_integrity": "sha512-wKzymOtUsselAIJZbiC/88zVgeuhB1lHZTdPN7IrB2o1qgxF50DdDa7eNUpKrkFJ2DK6gCJ8JlqLtM3QVr3iXQ==", - "_location": "/vega-runtime", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-runtime@~6.1.0", - "name": "vega-runtime", - "escapedName": "vega-runtime", - "rawSpec": "~6.1.0", - "saveSpec": null, - "fetchSpec": "~6.1.0" - }, - "_requiredBy": [ - "/vega", - "/vega-view" - ], - "_resolved": "https://registry.npmjs.org/vega-runtime/-/vega-runtime-6.1.0.tgz", - "_shasum": "7b3016e616bcea779f971e242065b03e8d3ea6b5", - "_spec": "vega-runtime@~6.1.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "vega-dataflow": "^5.7.0", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "Runtime support for Vega dataflows.", - "devDependencies": { - "vega-encode": "*", - "vega-transforms": "*" - }, - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "runtime", - "dataflow", - "reactive" - ], - "license": "BSD-3-Clause", - "main": "build/vega-runtime.js", - "module": "index", - "name": "vega-runtime", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-runtime.js -c -m -o build/vega-runtime.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -f umd -g vega-dataflow:vega,vega-util:vega -n vega -o build/vega-runtime.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "6.1.0" -} diff --git a/node_modules/vega-runtime/src/context.js b/node_modules/vega-runtime/src/context.js deleted file mode 100644 index 5e31f29..0000000 --- a/node_modules/vega-runtime/src/context.js +++ /dev/null @@ -1,173 +0,0 @@ -import parse from './dataflow'; -import expressionCodegen from './expression'; -import { - parseOperator, - parseOperatorParameters -} from './operator'; -import parseParameters from './parameters'; -import parseStream from './stream'; -import parseUpdate from './update'; - -import {getState, setState} from './state'; -import {canonicalType, isCollect} from './util'; - -/** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ -export default function(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); -} - -function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, - this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } -} - -function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } -} - -Context.prototype = Subcontext.prototype = { - fork() { - const ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; - }, - detach(ctx) { - this.subcontext = this.subcontext.filter(c => c !== ctx); - - // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - const keys = Object.keys(ctx.nodes); - for (const key of keys) ctx.nodes[key]._targets = null; - for (const key of keys) ctx.nodes[key].detach(); - ctx.nodes = null; - }, - get(id) { - return this.nodes[id]; - }, - set(id, node) { - return this.nodes[id] = node; - }, - add(spec, op) { - const ctx = this, - df = ctx.dataflow, - data = spec.value; - - ctx.set(spec.id, op); - - if (isCollect(spec.type) && data) { - if (data.$ingest) { - df.ingest(op, data.$ingest, data.$format); - } else if (data.$request) { - df.preload(op, data.$request, data.$format); - } else { - df.pulse(op, df.changeset().insert(data)); - } - } - - if (spec.root) { - ctx.root = op; - } - - if (spec.parent) { - var p = ctx.get(spec.parent.$ref); - if (p) { - df.connect(p, [op]); - op.targets().add(p); - } else { - (ctx.unresolved = ctx.unresolved || []).push(() => { - p = ctx.get(spec.parent.$ref); - df.connect(p, [op]); - op.targets().add(p); - }); - } - } - - if (spec.signal) { - ctx.signals[spec.signal] = op; - } - - if (spec.scale) { - ctx.scales[spec.scale] = op; - } - - if (spec.data) { - for (const name in spec.data) { - const data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach(role => data[role] = op); - } - } - }, - resolve() { - (this.unresolved || []).forEach(fn => fn()); - delete this.unresolved; - return this; - }, - operator(spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); - }, - transform(spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); - }, - stream(spec, stream) { - this.set(spec.id, stream); - }, - update(spec, stream, target, update, params) { - this.dataflow.on(stream, target, update, params, spec.options); - }, - - // expression parsing - operatorExpression(expr) { - return this.expr.operator(this, expr); - }, - parameterExpression(expr) { - return this.expr.parameter(this, expr); - }, - eventExpression(expr) { - return this.expr.event(this, expr); - }, - handlerExpression(expr) { - return this.expr.handler(this, expr); - }, - encodeExpression(encode) { - return this.expr.encode(this, encode); - }, - - // parse methods - parse, - parseOperator, - parseOperatorParameters, - parseParameters, - parseStream, - parseUpdate, - - // state methods - getState, - setState -}; diff --git a/node_modules/vega-runtime/src/dataflow.js b/node_modules/vega-runtime/src/dataflow.js deleted file mode 100644 index 9a1d99a..0000000 --- a/node_modules/vega-runtime/src/dataflow.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Parse a serialized dataflow specification. - */ -export default function(spec) { - const ctx = this, - operators = spec.operators || []; - - // parse background - if (spec.background) { - ctx.background = spec.background; - } - - // parse event configuration - if (spec.eventConfig) { - ctx.eventConfig = spec.eventConfig; - } - - // parse locale configuration - if (spec.locale) { - ctx.locale = spec.locale; - } - - // parse operators - operators.forEach(entry => ctx.parseOperator(entry)); - - // parse operator parameters - operators.forEach(entry => ctx.parseOperatorParameters(entry)); - - // parse streams - (spec.streams || []).forEach(entry => ctx.parseStream(entry)); - - // parse updates - (spec.updates || []).forEach(entry => ctx.parseUpdate(entry)); - - return ctx.resolve(); -} diff --git a/node_modules/vega-runtime/src/expression.js b/node_modules/vega-runtime/src/expression.js deleted file mode 100644 index 3f6758d..0000000 --- a/node_modules/vega-runtime/src/expression.js +++ /dev/null @@ -1,93 +0,0 @@ -import {adjustSpatial} from './util'; -import {stringValue} from 'vega-util'; - -function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (code[code.length-1] !== ';') { - code = 'return(' + code + ');'; - } - var fn = Function.apply(null, args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; -} - -// generate code for comparing a single field -function _compare(u, v, lt, gt) { - return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt} - : (u > v || v == null) && u != null ? ${gt} - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} - : v !== v && u === u ? ${gt} : `; -} - -export default { - /** - * Parse an expression used to update an operator value. - */ - operator: (ctx, expr) => expression(ctx, ['_'], expr.code), - - /** - * Parse an expression provided as an operator parameter value. - */ - parameter: (ctx, expr) => expression(ctx, ['datum', '_'], expr.code), - - /** - * Parse an expression applied to an event stream. - */ - event: (ctx, expr) => expression(ctx, ['event'], expr.code), - - /** - * Parse an expression used to handle an event-driven operator update. - */ - handler: (ctx, expr) => { - const code = `var datum=event.item&&event.item.datum;return ${expr.code};`; - return expression(ctx, ['_', 'event'], code); - }, - - /** - * Parse an expression that performs visual encoding. - */ - encode: (ctx, encode) => { - const {marktype, channels} = encode; - - let code = 'var o=item,datum=o.datum,m=0,$;'; - for (const name in channels) { - const o ='o[' + stringValue(name) + ']'; - code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; - } - code += adjustSpatial(channels, marktype); - code += 'return m;'; - - return expression(ctx, ['item', '_'], code); - }, - - /** - * Optimized code generators for access and comparison. - */ - codegen: { - get(path) { - const ref = `[${path.map(stringValue).join('][')}]`; - const get = Function('_', `return _${ref};`); - get.path = ref; - return get; - }, - comparator(fields, orders) { - let t; - const map = (f, i) => { - const o = orders[i]; - let u, v; - if (f.path) { - u = `a${f.path}`; - v = `b${f.path}`; - } else { - (t = t || {})['f'+i] = f; - u = `this.f${i}(a)`; - v = `this.f${i}(b)`; - } - return _compare(u, v, -o, o); - }; - - const fn = Function('a', 'b', 'var u, v; return ' - + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } -}; diff --git a/node_modules/vega-runtime/src/operator.js b/node_modules/vega-runtime/src/operator.js deleted file mode 100644 index 9bf91eb..0000000 --- a/node_modules/vega-runtime/src/operator.js +++ /dev/null @@ -1,33 +0,0 @@ -import {isOperator} from './util'; -import {error} from 'vega-util'; - -/** - * Parse a dataflow operator. - */ -export function parseOperator(spec) { - const ctx = this; - if (isOperator(spec.type) || !spec.type) { - ctx.operator( - spec, - spec.update ? ctx.operatorExpression(spec.update) : null - ); - } else { - ctx.transform(spec, spec.type); - } -} - -/** - * Parse and assign operator parameters. - */ -export function parseOperatorParameters(spec) { - const ctx = this; - if (spec.params) { - const op = ctx.get(spec.id); - if (!op) error('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters( - ctx.parseParameters(spec.params), - spec.react, - spec.initonly - )); - } -} diff --git a/node_modules/vega-runtime/src/parameters.js b/node_modules/vega-runtime/src/parameters.js deleted file mode 100644 index 20418e7..0000000 --- a/node_modules/vega-runtime/src/parameters.js +++ /dev/null @@ -1,145 +0,0 @@ -import {tupleid} from 'vega-dataflow'; -import { - accessor, array, compare, error, field, - hasOwnProperty, isArray, isObject, key -} from 'vega-util'; - -/** - * Parse a set of operator parameters. - */ -export default function parseParameters(spec, params) { - params = params || {}; - const ctx = this; - - for (const key in spec) { - const value = spec[key]; - params[key] = isArray(value) - ? value.map(v => parseParameter(v, ctx, params)) - : parseParameter(value, ctx, params); - } - - return params; -} - -/** - * Parse a single parameter. - */ -function parseParameter(spec, ctx, params) { - if (!spec || !isObject(spec)) return spec; - - for (let i=0, n=PARSERS.length, p; i (_ && _.$tupleid) ? tupleid : _); - return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen)); -} - -/** - * Resolve an encode operator reference. - */ -function getEncode(_, ctx) { - const spec = _.$encode, - encode = {}; - - for (const name in spec) { - const enc = spec[name]; - encode[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - return encode; -} - -/** - * Resolve a context reference. - */ -function getContext(_, ctx) { - return ctx; -} - -/** - * Resolve a recursive subflow specification. - */ -function getSubflow(_, ctx) { - const spec = _.$subflow; - return function(dataflow, key, parent) { - const subctx = ctx.fork().parse(spec), - op = subctx.get(spec.operators[0].id), - p = subctx.signals.parent; - if (p) p.set(parent); - op.detachSubflow = () => ctx.detach(subctx); - return op; - }; -} - -/** - * Resolve a tuple id reference. - */ -function getTupleId() { - return tupleid; -} diff --git a/node_modules/vega-runtime/src/state.js b/node_modules/vega-runtime/src/state.js deleted file mode 100644 index ba74185..0000000 --- a/node_modules/vega-runtime/src/state.js +++ /dev/null @@ -1,57 +0,0 @@ -import {truthy} from 'vega-util'; - -var SKIP = {skip: true}; - -export function getState(options) { - var ctx = this, - state = {}; - - if (options.signals) { - var signals = (state.signals = {}); - Object.keys(ctx.signals).forEach(key => { - var op = ctx.signals[key]; - if (options.signals(key, op)) { - signals[key] = op.value; - } - }); - } - - if (options.data) { - var data = (state.data = {}); - Object.keys(ctx.data).forEach(key => { - var dataset = ctx.data[key]; - if (options.data(key, dataset)) { - data[key] = dataset.input.value; - } - }); - } - - if (ctx.subcontext && options.recurse !== false) { - state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options)); - } - - return state; -} - -export function setState(state) { - var ctx = this, - df = ctx.dataflow, - data = state.data, - signals = state.signals; - - Object.keys(signals || {}).forEach(key => { - df.update(ctx.signals[key], signals[key], SKIP); - }); - - Object.keys(data || {}).forEach(key => { - df.pulse( - ctx.data[key].input, - df.changeset().remove(truthy).insert(data[key]) - ); - }); - - (state.subcontext || []).forEach((substate, i) => { - var subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); -} diff --git a/node_modules/vega-runtime/src/stream.js b/node_modules/vega-runtime/src/stream.js deleted file mode 100644 index 32bbc26..0000000 --- a/node_modules/vega-runtime/src/stream.js +++ /dev/null @@ -1,44 +0,0 @@ -import {error} from 'vega-util'; - -/** - * Parse an event stream specification. - */ -export default function(spec) { - var ctx = this, - filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, - stream = spec.stream != null ? ctx.get(spec.stream) : undefined, - args; - - if (spec.source) { - stream = ctx.events(spec.source, spec.type, filter); - } - else if (spec.merge) { - args = spec.merge.map(_ => ctx.get(_)); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - - if (spec.between) { - args = spec.between.map(_ => ctx.get(_)); - stream = stream.between(args[0], args[1]); - } - - if (spec.filter) { - stream = stream.filter(filter); - } - - if (spec.throttle != null) { - stream = stream.throttle(+spec.throttle); - } - - if (spec.debounce != null) { - stream = stream.debounce(+spec.debounce); - } - - if (stream == null) { - error('Invalid stream definition: ' + JSON.stringify(spec)); - } - - if (spec.consume) stream.consume(true); - - ctx.stream(spec, stream); -} diff --git a/node_modules/vega-runtime/src/update.js b/node_modules/vega-runtime/src/update.js deleted file mode 100644 index a9e2639..0000000 --- a/node_modules/vega-runtime/src/update.js +++ /dev/null @@ -1,28 +0,0 @@ -import {error, isObject} from 'vega-util'; - -/** - * Parse an event-driven operator update. - */ -export default function(spec) { - var ctx = this, - srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid, - source = ctx.get(srcid), - target = null, - update = spec.update, - params = undefined; - - if (!source) error('Source not defined: ' + spec.source); - - target = spec.target && spec.target.$expr - ? ctx.eventExpression(spec.target.$expr) - : ctx.get(spec.target); - - if (update && update.$expr) { - if (update.$params) { - params = ctx.parseParameters(update.$params); - } - update = ctx.handlerExpression(update.$expr); - } - - ctx.update(spec, source, target, update, params); -} diff --git a/node_modules/vega-runtime/src/util.js b/node_modules/vega-runtime/src/util.js deleted file mode 100644 index 1ee5b99..0000000 --- a/node_modules/vega-runtime/src/util.js +++ /dev/null @@ -1,54 +0,0 @@ -import {toSet} from 'vega-util'; - -const Skip = toSet(['rule']), - Swap = toSet(['group', 'image', 'rect']); - -export function adjustSpatial(encode, marktype) { - let code = ''; - - if (Skip[marktype]) return code; - - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) { - code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - } - code += 'o.width=o.x2-o.x;'; - } else { - code += 'o.x=o.x2-(o.width||0);'; - } - } - - if (encode.xc) { - code += 'o.x=o.xc-(o.width||0)/2;'; - } - - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) { - code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - } - code += 'o.height=o.y2-o.y;'; - } else { - code += 'o.y=o.y2-(o.height||0);'; - } - } - - if (encode.yc) { - code += 'o.y=o.yc-(o.height||0)/2;'; - } - - return code; -} - -export function canonicalType(type) { - return (type + '').toLowerCase(); -} - -export function isOperator(type) { - return canonicalType(type) === 'operator'; -} - -export function isCollect(type) { - return canonicalType(type) === 'collect'; -} diff --git a/node_modules/vega-scale/LICENSE b/node_modules/vega-scale/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-scale/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-scale/README.md b/node_modules/vega-scale/README.md deleted file mode 100644 index f41ba89..0000000 --- a/node_modules/vega-scale/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# vega-scale - -Scales and color schemes for visual encoding. - -This pacakge provides [scale](#scale) and [scheme](#scheme) methods for managing scale mappings and color schemes. By default, the scale and scheme registries include all scale types and color schemes provided by the [d3-scale](https://github.com/d3/d3-scale) and [d3-scale-chromatic](https://github.com/d3/d3-scale-chromatic) modules. - -This module also provides augmented implementations of `'band'`, `'point'`, and `'sequential'` scales in order to provide improved layout and inversion support for band/point scales, and multi-domain and color range array support for sequential scales. - -## API Reference - -# -vega.scale(type[, scale, metadata]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/scales.js "Source") - -Registry function for adding and accessing scale constructor functions. The *type* argument is a String indicating the name of the scale type. If the *scale* argument is not specified, this method returns the matching scale constructor in the registry, or `null` if not found. If the *scale* argument is provided, it must be a scale constructor function to add to the registry under the given *type* name. - -The *metadata* argument provides additional information to guide appropriate use of scales within Vega. The *metadata* can be either a string or string array. The valid string values are: - -* `"continuous"` - the scale is defined over a continuous-valued domain. -* `"discrete"` - the scale is defined over a discrete domain and range. -* `"discretizing"` - the scale discretizes a continuous domain to a discrete range. -* `"interpolating"` - the scale range is defined using a color interpolator. -* `"log"` - the scale performs a logarithmic transform of the continuous domain. -* `"temporal"` - the scale domain is defined over date-time values. - -By default, the scale registry includes entries for all scale types provided by the [d3-scale](https://github.com/d3/d3-scale) module. Scales created using the constructor returned by this method have an additional `type` property indicating the scale type. All scales supporting either an `invert` or `invertExtent` method are augmented with an additional `invertRange` function that returns an array of corresponding domain values for a given interval in the scale's output range. - -```js -// linear scale -var linear = vega.scale('linear'); -var scale = linear().domain([0, 10]).range([0, 100]); -scale.type; // 'linear' -scale.invertRange([0, 100]); // [0, 10] -``` - -```js -var ordinal = vega.scale('ordinal'); - -// ordinal scale -var scale1 = ordinal().domain(['a', 'b', 'c']).range([0, 1, 2]); -scale1.type; // 'ordinal' - -// ordinal scale with range set to the 'category20' color palette -var scale2 = ordinal().range(vega.scheme('category20')); -``` - -```js -var seq = vega.scale('sequential'); - -// sequential scale, using the plasma color palette -var scale1 = seq().interpolator(vega.scheme('plasma')); -scale1.type; // 'sequential' -``` - -# -vega.scheme(name[, scheme]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/schemes.js "Source") - -Registry function for adding and accessing color schemes. The *name* argument is a String indicating the name of the color scheme. If the *scheme* argument is not specified, this method returns the matching scheme value in the registry, or `null` if not found. If the *scheme* argument is provided, it must be a valid color array or [interpolator](https://github.com/d3/d3-scale#sequential_interpolator) to add to the registry under the given *name*. - -By default, the scheme registry includes entries for all scheme types provided by the -[d3-scale-chromatic](https://github.com/d3/d3-scale-chromatic) module. Valid schemes are either arrays of color values (e.g., applicable to `'ordinal'` scales) or [interpolator](https://github.com/d3/d3-scale#sequential_interpolator) functions (e.g., applicable to `'sequential'` scales.) - -# -vega.interpolate(name[, gamma]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/interpolate.js "Source") - -Returns the D3 interpolator factory with the given *name* and optional *gamma*. All interpolator types provided by the [d3-interpolate](https://github.com/d3/d3-interpolate) module are supported. However, Vega uses hyphenated rather than camelCase names. - -```js -var rgbBasis = vega.interpolate('rgb-basis'); // d3.interpolateRgbBasis -var rgbGamma = vega.interpolate('rgb', 2.2); // d3.interpolateRgb.gamma(2.2) -``` - -# -vega.interpolateColors(colors[, type, gamma]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/interpolate.js "Source") - -Given an array of discrete *colors*, returns an interpolator function that maps the domain [0, 1] to a continuous spectrum of colors using piecewise linear interpolation. The optional parameters *type* and *gamma* specify an interpolation type (default `"rgb"`) and gamma correction (default `1`) supported by the [interpolate](#interpolate) method. - -# -vega.interpolateRange(interpolator, range]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/interpolate.js "Source") - -Given a D3 *interpolator* instance, return a new interpolator with a modified interpolation *range*. The *range* argument should be a two element array whose entries lie in the range [0, 1]. This method is convenient for transforming the range of values over which interpolation is performed. - -```js -var number = d3.interpolateNumber(0, 10); -number(0); // 0 -number(0.5); // 5 -number(1); // 10 - -var range = vega.interpolateRange(number, [0.2, 0.8]); -range(0); // 2 -range(0.5); // 5 -range(1); // 8 -``` - -# -vega.quantizeInterpolator(interpolator, count]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/interpolate.js "Source") - -Given an *interpolator* function, returns *count* evenly-spaced samples. This method is useful for generating a discrete color scheme from a continuous color interpolator. diff --git a/node_modules/vega-scale/build/vega-scale.js b/node_modules/vega-scale/build/vega-scale.js deleted file mode 100644 index 543493b..0000000 --- a/node_modules/vega-scale/build/vega-scale.js +++ /dev/null @@ -1,956 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('d3-array'), require('d3-scale'), require('d3-interpolate'), require('vega-time')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'd3-array', 'd3-scale', 'd3-interpolate', 'vega-time'], factory) : - (global = global || self, factory(global.vega = {}, global.vega, global.d3, global.d3, global.d3, global.vega)); -}(this, (function (exports, vegaUtil, d3Array, $, $$1, vegaTime) { 'use strict'; - - function bandSpace(count, paddingInner, paddingOuter) { - var space = count - paddingInner + paddingOuter * 2; - return count ? (space > 0 ? space : 1) : 0; - } - - const Identity = 'identity'; - - const Linear = 'linear'; - const Log = 'log'; - const Pow = 'pow'; - const Sqrt = 'sqrt'; - const Symlog = 'symlog'; - - const Time = 'time'; - const UTC = 'utc'; - - const Sequential = 'sequential'; - const Diverging = 'diverging'; - - const Quantile = 'quantile'; - const Quantize = 'quantize'; - const Threshold = 'threshold'; - - const Ordinal = 'ordinal'; - const Point = 'point'; - const Band = 'band'; - const BinOrdinal = 'bin-ordinal'; - - // categories - const Continuous = 'continuous'; - const Discrete = 'discrete'; - const Discretizing = 'discretizing'; - const Interpolating = 'interpolating'; - const Temporal = 'temporal'; - - function invertRange(scale) { - return function(_) { - var lo = _[0], - hi = _[1], - t; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - return [ - scale.invert(lo), - scale.invert(hi) - ]; - }; - } - - function invertRangeExtent(scale) { - return function(_) { - var range = scale.range(), - lo = _[0], - hi = _[1], - min = -1, max, t, i, n; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - for (i=0, n=range.length; i= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - } - - if (min < 0) return undefined; - - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - - return [ - lo[0] === undefined ? lo[1] : lo[0], - hi[1] === undefined ? hi[0] : hi[1] - ]; - }; - } - - function band() { - var scale = $.scaleOrdinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - range = [0, 1], - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = range[1] < range[0], - start = range[reverse - 0], - stop = range[1 - reverse], - space = bandSpace(n, paddingInner, paddingOuter); - - step = (stop - start) / (space || 1); - if (round) { - step = Math.floor(step); - } - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - var values = d3Array.range(n).map(function(i) { return start + step * i; }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function(_) { - if (arguments.length) { - domain(_); - return rescale(); - } else { - return domain(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = [+_[0], +_[1]]; - return rescale(); - } else { - return range.slice(); - } - }; - - scale.rangeRound = function(_) { - range = [+_[0], +_[1]]; - round = true; - return rescale(); - }; - - scale.bandwidth = function() { - return bandwidth; - }; - - scale.step = function() { - return step; - }; - - scale.round = function(_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else { - return round; - } - }; - - scale.padding = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingInner = function(_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingOuter = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingOuter; - } - }; - - scale.align = function(_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return align; - } - }; - - scale.invertRange = function(_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - - var lo = +_[0], - hi = +_[1], - reverse = range[1] < range[0], - values = reverse ? ordinalRange().reverse() : ordinalRange(), - n = values.length - 1, a, b, t; - - // bail if either range endpoint is invalid - if (lo !== lo || hi !== hi) return; - - // order range inputs, bail if outside of scale range - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - if (hi < values[0] || lo > range[1-reverse]) return; - - // binary search to index into scale range - a = Math.max(0, d3Array.bisectRight(values, lo) - 1); - b = lo===hi ? a : d3Array.bisectRight(values, hi) - 1; - - // increment index a if lo is within padding gap - if (lo - values[a] > bandwidth + 1e-10) ++a; - - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - return (a > b) ? undefined : domain().slice(a, b+1); - }; - - scale.invert = function(_) { - var value = scale.invertRange([_, _]); - return value ? value[0] : value; - }; - - scale.copy = function() { - return band() - .domain(domain()) - .range(range) - .round(round) - .paddingInner(paddingInner) - .paddingOuter(paddingOuter) - .align(align); - }; - - return rescale(); - } - - function pointish(scale) { - var copy = scale.copy; - - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - - scale.copy = function() { - return pointish(copy()); - }; - - return scale; - } - - function point() { - return pointish(band().paddingInner(1)); - } - - var map = Array.prototype.map; - - function numbers(_) { - return map.call(_, function(x) { return +x; }); - } - - var slice = Array.prototype.slice; - - function scaleBinOrdinal() { - var domain = [], - range = []; - - function scale(x) { - return x == null || x !== x - ? undefined - : range[(d3Array.bisect(domain, x) - 1) % range.length]; - } - - scale.domain = function(_) { - if (arguments.length) { - domain = numbers(_); - return scale; - } else { - return domain.slice(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else { - return range.slice(); - } - }; - - scale.tickFormat = function(count, specifier) { - return $.tickFormat(domain[0], vegaUtil.peek(domain), count == null ? 10 : count, specifier); - }; - - scale.copy = function() { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - - return scale; - } - - // scale registry - const scales = {}; - - /** - * Augment scales with their type and needed inverse methods. - */ - function create(type, constructor, metadata) { - const ctr = function scale() { - var s = constructor(); - - if (!s.invertRange) { - s.invertRange = s.invert ? invertRange(s) - : s.invertExtent ? invertRangeExtent(s) - : undefined; - } - - s.type = type; - return s; - }; - - ctr.metadata = vegaUtil.toSet(vegaUtil.array(metadata)); - - return ctr; - } - - function scale(type, scale, metadata) { - if (arguments.length > 1) { - scales[type] = create(type, scale, metadata); - return this; - } else { - return isValidScaleType(type) ? scales[type] : undefined; - } - } - - // identity scale - scale(Identity, $.scaleIdentity); - - // continuous scales - scale(Linear, $.scaleLinear, Continuous); - scale(Log, $.scaleLog, [Continuous, Log]); - scale(Pow, $.scalePow, Continuous); - scale(Sqrt, $.scaleSqrt, Continuous); - scale(Symlog, $.scaleSymlog, Continuous); - scale(Time, $.scaleTime, [Continuous, Temporal]); - scale(UTC, $.scaleUtc, [Continuous, Temporal]); - - // sequential scales - scale(Sequential, $.scaleSequential, [Continuous, Interpolating]); // backwards compat - scale(`${Sequential}-${Linear}`, $.scaleSequential, [Continuous, Interpolating]); - scale(`${Sequential}-${Log}`, $.scaleSequentialLog, [Continuous, Interpolating, Log]); - scale(`${Sequential}-${Pow}`, $.scaleSequentialPow, [Continuous, Interpolating]); - scale(`${Sequential}-${Sqrt}`, $.scaleSequentialSqrt, [Continuous, Interpolating]); - scale(`${Sequential}-${Symlog}`, $.scaleSequentialSymlog, [Continuous, Interpolating]); - - // diverging scales - scale(`${Diverging}-${Linear}`, $.scaleDiverging, [Continuous, Interpolating]); - scale(`${Diverging}-${Log}`, $.scaleDivergingLog, [Continuous, Interpolating, Log]); - scale(`${Diverging}-${Pow}`, $.scaleDivergingPow, [Continuous, Interpolating]); - scale(`${Diverging}-${Sqrt}`, $.scaleDivergingSqrt, [Continuous, Interpolating]); - scale(`${Diverging}-${Symlog}`, $.scaleDivergingSymlog, [Continuous, Interpolating]); - - // discretizing scales - scale(Quantile, $.scaleQuantile, [Discretizing, Quantile]); - scale(Quantize, $.scaleQuantize, Discretizing); - scale(Threshold, $.scaleThreshold, Discretizing); - - // discrete scales - scale(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]); - scale(Ordinal, $.scaleOrdinal, Discrete); - scale(Band, band, Discrete); - scale(Point, point, Discrete); - - function isValidScaleType(type) { - return vegaUtil.hasOwnProperty(scales, type); - } - - function hasType(key, type) { - const s = scales[key]; - return s && s.metadata[type]; - } - - function isContinuous(key) { - return hasType(key, Continuous); - } - - function isDiscrete(key) { - return hasType(key, Discrete); - } - - function isDiscretizing(key) { - return hasType(key, Discretizing); - } - - function isLogarithmic(key) { - return hasType(key, Log); - } - - function isTemporal(key) { - return hasType(key, Temporal); - } - - function isInterpolating(key) { - return hasType(key, Interpolating); - } - - function isQuantile(key) { - return hasType(key, Quantile); - } - - const scaleProps = ['clamp', 'base', 'constant', 'exponent']; - - function interpolateRange(interpolator, range) { - var start = range[0], - span = vegaUtil.peek(range) - start; - return function(i) { return interpolator(start + i * span); }; - } - - function interpolateColors(colors, type, gamma) { - return $$1.piecewise(interpolate(type || 'rgb', gamma), colors); - } - - function quantizeInterpolator(interpolator, count) { - var samples = new Array(count), - n = count + 1; - for (var i = 0; i < count;) samples[i] = interpolator(++i / n); - return samples; - } - - function scaleCopy(scale) { - const t = scale.type, - s = scale.copy(); - s.type = t; - return s; - } - - function scaleFraction(scale$1, min, max) { - var delta = max - min, i, t, s; - - if (!delta || !Number.isFinite(delta)) { - return vegaUtil.constant(0.5); - } else { - i = (t = scale$1.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale(t)().domain([min, max]).range([0, 1]); - scaleProps.forEach(m => scale$1[m] ? s[m](scale$1[m]()) : 0); - return s; - } - } - - function interpolate(type, gamma) { - var interp = $$1[method(type)]; - return (gamma != null && interp && interp.gamma) - ? interp.gamma(gamma) - : interp; - } - - function method(type) { - return 'interpolate' + type.toLowerCase() - .split('-') - .map(function(s) { return s[0].toUpperCase() + s.slice(1); }) - .join(''); - } - - const continuous = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' - }; - - const discrete = { - category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', - accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', - dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', - paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', - pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', - pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', - set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', - set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', - set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' - }; - - function colors(palette) { - var n = palette.length / 6 | 0, c = new Array(n), i = 0; - while (i < n) c[i] = '#' + palette.slice(i * 6, ++i * 6); - return c; - } - - function apply(_, f) { - for (let k in _) scheme(k, f(_[k])); - } - - const schemes = {}; - apply(discrete, colors); - apply(continuous, _ => interpolateColors(colors(_))); - - function scheme(name, scheme) { - name = name && name.toLowerCase(); - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else { - return schemes[name]; - } - } - - var SymbolLegend = 'symbol'; - var DiscreteLegend = 'discrete'; - var GradientLegend = 'gradient'; - - const defaultFormatter = value => vegaUtil.isArray(value) - ? value.map(v => String(v)) - : String(value); - - const ascending = (a, b) => a[1] - b[1]; - const descending = (a, b) => b[1] - a[1]; - - /** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ - function tickCount(scale, count, minStep) { - var step; - - if (vegaUtil.isNumber(count)) { - if (scale.bins) { - count = Math.max(count, scale.bins.length); - } - if (minStep != null) { - count = Math.min( - count, - Math.floor((vegaUtil.span(scale.domain()) / minStep) || 1) - ); - } - } - - if (vegaUtil.isObject(count)) { - step = count.step; - count = count.interval; - } - - if (vegaUtil.isString(count)) { - count = scale.type === Time ? vegaTime.timeInterval(count) - : scale.type == UTC ? vegaTime.utcInterval(count) - : vegaUtil.error('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - - return count; - } - - /** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ - function validTicks(scale, ticks, count) { - let range = scale.range(), - lo = range[0], - hi = vegaUtil.peek(range), - cmp = ascending; - - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - - lo = Math.floor(lo); - hi = Math.ceil(hi); - - // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - ticks = ticks.map(v => [v, scale(v)]) - .filter(_ => lo <= _[1] && _[1] <= hi) - .sort(cmp) - .map(_ => _[0]); - - if (count > 0 && ticks.length > 1) { - const endpoints = [ticks[0], vegaUtil.peek(ticks)]; - while (ticks.length > count && ticks.length >= 3) { - ticks = ticks.filter((_, i) => !(i % 2)); - } - if (ticks.length < 3) { - ticks = endpoints; - } - } - - return ticks; - } - - /** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ - function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins) - : scale.ticks ? scale.ticks(count) - : scale.domain(); - } - - /** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ - function tickFormat(locale, scale, count, specifier, formatType, noSkip) { - var type = scale.type; - let format = defaultFormatter; - - if (type === Time || formatType === Time) { - format = locale.timeFormat(specifier); - } - else if (type === UTC || formatType === UTC) { - format = locale.utcFormat(specifier); - } - else if (isLogarithmic(type)) { - const varfmt = locale.formatFloat(specifier); - if (noSkip || scale.bins) { - format = varfmt; - } else { - const test = tickLog(scale, count, false); - format = _ => test(_) ? varfmt(_) : ''; - } - } - else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - const d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } - else if (specifier) { - format = locale.format(specifier); - } - - return format; - } - - function tickLog(scale, count, values) { - const ticks = tickValues(scale, count), - base = scale.base(), - logb = Math.log(base), - k = Math.max(1, base * count / ticks.length); - - // apply d3-scale's log format filter criteria - const test = d => { - let i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - - return values ? ticks.filter(test) : test; - } - - const symbols = { - [Quantile]: 'quantiles', - [Quantize]: 'thresholds', - [Threshold]: 'domain' - }; - - const formats = { - [Quantile]: 'quantiles', - [Quantize]: 'domain' - }; - - function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) - : scale.type === Log ? tickLog(scale, count, true) - : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) - : tickValues(scale, count); - } - - function thresholdFormat(locale, scale, specifier) { - var _ = scale[formats[scale.type]](), - n = _.length, - d = n > 1 ? _[1] - _[0] : _[0], i; - - for (i=1; i { - var limit = get(array[index + 1], get(array.max, +Infinity)), - lo = formatValue(value, format), - hi = formatValue(limit, format); - return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo; - }; - } - - function get(value, dflt) { - return value != null ? value : dflt; - } - - function formatDiscrete(format) { - return (value, index) => index ? format(value) : null; - } - - function formatPoint(format) { - return value => format(value); - } - - function formatValue(value, format) { - return Number.isFinite(value) ? format(value) : null; - } - - function labelFraction(scale) { - var domain = scale.domain(), - count = domain.length - 1, - lo = +domain[0], - hi = +vegaUtil.peek(domain), - span = hi - lo; - - if (scale.type === Threshold) { - const adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - - return value => (value - lo) / span; - } - - function format(locale, scale, specifier, formatType) { - const type = formatType || scale.type; - - // replace abbreviated time specifiers to improve screen reader experience - if (vegaUtil.isString(specifier) && isTemporal(type)) { - specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - } - - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') - : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') - : labelFormat(locale, scale, 5, null, specifier, formatType, true); - } - - function domainCaption(locale, scale, opt) { - opt = opt || {}; - const max = Math.max(3, opt.maxlen || 7), - fmt = format(locale, scale, opt.format, opt.formatType); - - // if scale breaks domain into bins, describe boundaries - if (isDiscretizing(scale.type)) { - const v = labelValues(scale).slice(1).map(fmt), - n = v.length; - return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`; - } - - // if scale domain is discrete, list values - else if (isDiscrete(scale.type)) { - const d = scale.domain(), - n = d.length, - v = n > max - ? d.slice(0, max - 2).map(fmt).join(', ') - + ', ending with ' + d.slice(-1).map(fmt) - : d.map(fmt).join(', '); - return `${n} value${n === 1 ? '' : 's'}: ${v}`; - } - - // if scale domain is continuous, describe value range - else { - const d = scale.domain(); - return `values from ${fmt(d[0])} to ${fmt(vegaUtil.peek(d))}`; - } - } - - Object.defineProperty(exports, 'scaleImplicit', { - enumerable: true, - get: function () { - return $.scaleImplicit; - } - }); - exports.Band = Band; - exports.BinOrdinal = BinOrdinal; - exports.DiscreteLegend = DiscreteLegend; - exports.Diverging = Diverging; - exports.GradientLegend = GradientLegend; - exports.Identity = Identity; - exports.Linear = Linear; - exports.Log = Log; - exports.Ordinal = Ordinal; - exports.Point = Point; - exports.Pow = Pow; - exports.Quantile = Quantile; - exports.Quantize = Quantize; - exports.Sequential = Sequential; - exports.Sqrt = Sqrt; - exports.SymbolLegend = SymbolLegend; - exports.Symlog = Symlog; - exports.Threshold = Threshold; - exports.Time = Time; - exports.UTC = UTC; - exports.bandSpace = bandSpace; - exports.domainCaption = domainCaption; - exports.interpolate = interpolate; - exports.interpolateColors = interpolateColors; - exports.interpolateRange = interpolateRange; - exports.isContinuous = isContinuous; - exports.isDiscrete = isDiscrete; - exports.isDiscretizing = isDiscretizing; - exports.isInterpolating = isInterpolating; - exports.isLogarithmic = isLogarithmic; - exports.isQuantile = isQuantile; - exports.isTemporal = isTemporal; - exports.isValidScaleType = isValidScaleType; - exports.labelFormat = labelFormat; - exports.labelFraction = labelFraction; - exports.labelValues = labelValues; - exports.quantizeInterpolator = quantizeInterpolator; - exports.scale = scale; - exports.scaleCopy = scaleCopy; - exports.scaleFraction = scaleFraction; - exports.scheme = scheme; - exports.tickCount = tickCount; - exports.tickFormat = tickFormat; - exports.tickValues = tickValues; - exports.validTicks = validTicks; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-scale/build/vega-scale.min.js b/node_modules/vega-scale/build/vega-scale.min.js deleted file mode 100644 index 236b728..0000000 --- a/node_modules/vega-scale/build/vega-scale.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("vega-util"),require("d3-array"),require("d3-scale"),require("d3-interpolate"),require("vega-time")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-array","d3-scale","d3-interpolate","vega-time"],a):a((e=e||self).vega={},e.vega,e.d3,e.d3,e.d3,e.vega)}(this,(function(e,a,n,c,f,t){"use strict";function d(e,a,n){var c=e-a+2*n;return e?c>0?c:1:0}const r="log",i="time",b="utc",o="continuous";function l(){var e,a,f=c.scaleOrdinal().unknown(void 0),t=f.domain,r=f.range,i=[0,1],b=!1,o=0,u=0,s=.5;function g(){var c=t().length,f=i[1]i[1-l])))return c=Math.max(0,n.bisectRight(u,b)-1),f=b===o?c:n.bisectRight(u,o)-1,b-u[c]>a+1e-10&&++c,l&&(d=c,c=s-f,f=s-d),c>f?void 0:t().slice(c,f+1)}},f.invert=function(e){var a=f.invertRange([e,e]);return a?a[0]:a},f.copy=function(){return l().domain(t()).range(i).round(b).paddingInner(o).paddingOuter(u).align(s)},g()}var u=Array.prototype.map;function s(e){return u.call(e,(function(e){return+e}))}var g=Array.prototype.slice;const p={};function m(e,n,c){const f=function(){var a=n();return a.invertRange||(a.invertRange=a.invert?function(e){return function(a){var n,c=a[0],f=a[1];return f=r&&d[f]<=i&&(b<0&&(b=f),n=f);if(!(b<0))return r=e.invertExtent(d[b]),i=e.invertExtent(d[n]),[void 0===r[0]?r[1]:r[0],void 0===i[1]?i[0]:i[1]]}}(a):void 0),a.type=e,a};return f.metadata=a.toSet(a.array(c)),f}function h(e,a,n){return arguments.length>1?(p[e]=m(e,a,n),this):v(e)?p[e]:void 0}function v(e){return a.hasOwnProperty(p,e)}function y(e,a){const n=p[e];return n&&n.metadata[a]}function q(e){return y(e,"discrete")}function w(e){return y(e,"discretizing")}function M(e){return y(e,r)}function k(e){return y(e,"temporal")}h("identity",c.scaleIdentity),h("linear",c.scaleLinear,o),h(r,c.scaleLog,[o,r]),h("pow",c.scalePow,o),h("sqrt",c.scaleSqrt,o),h("symlog",c.scaleSymlog,o),h(i,c.scaleTime,[o,"temporal"]),h(b,c.scaleUtc,[o,"temporal"]),h("sequential",c.scaleSequential,[o,"interpolating"]),h("sequential-linear",c.scaleSequential,[o,"interpolating"]),h("sequential-log",c.scaleSequentialLog,[o,"interpolating",r]),h("sequential-pow",c.scaleSequentialPow,[o,"interpolating"]),h("sequential-sqrt",c.scaleSequentialSqrt,[o,"interpolating"]),h("sequential-symlog",c.scaleSequentialSymlog,[o,"interpolating"]),h("diverging-linear",c.scaleDiverging,[o,"interpolating"]),h("diverging-log",c.scaleDivergingLog,[o,"interpolating",r]),h("diverging-pow",c.scaleDivergingPow,[o,"interpolating"]),h("diverging-sqrt",c.scaleDivergingSqrt,[o,"interpolating"]),h("diverging-symlog",c.scaleDivergingSymlog,[o,"interpolating"]),h("quantile",c.scaleQuantile,["discretizing","quantile"]),h("quantize",c.scaleQuantize,"discretizing"),h("threshold",c.scaleThreshold,"discretizing"),h("bin-ordinal",(function e(){var f=[],t=[];function d(e){return null==e||e!=e?void 0:t[(n.bisect(f,e)-1)%t.length]}return d.domain=function(e){return arguments.length?(f=s(e),d):f.slice()},d.range=function(e){return arguments.length?(t=g.call(e),d):t.slice()},d.tickFormat=function(e,n){return c.tickFormat(f[0],a.peek(f),null==e?10:e,n)},d.copy=function(){return e().domain(d.domain()).range(d.range())},d}),["discrete","discretizing"]),h("ordinal",c.scaleOrdinal,"discrete"),h("band",l,"discrete"),h("point",(function(){return function e(a){var n=a.copy;return a.padding=a.paddingOuter,delete a.paddingInner,a.copy=function(){return e(n())},a}(l().paddingInner(1))}),"discrete");const S=["clamp","base","constant","exponent"];function x(e,a,n){return f.piecewise(O(a||"rgb",n),e)}function O(e,a){var n=f[function(e){return"interpolate"+e.toLowerCase().split("-").map((function(e){return e[0].toUpperCase()+e.slice(1)})).join("")}(e)];return null!=a&&n&&n.gamma?n.gamma(a):n}function B(e){for(var a=e.length/6|0,n=new Array(a),c=0;c1?(F[e]=a,this):F[e]}G({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},B),G({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},e=>x(B(e)));const z=e=>a.isArray(e)?e.map(e=>String(e)):String(e),I=(e,a)=>e[1]-a[1],L=(e,a)=>a[1]-e[1];function T(e,n,c){let f=e.range(),t=f[0],d=a.peek(f),r=I;if(t>d&&(f=d,d=t,t=f,r=L),t=Math.floor(t),d=Math.ceil(d),n=n.map(a=>[a,e(a)]).filter(e=>t<=e[1]&&e[1]<=d).sort(r).map(e=>e[0]),c>0&&n.length>1){const e=[n[0],a.peek(n)];for(;n.length>c&&n.length>=3;)n=n.filter((e,a)=>!(a%2));n.length<3&&(n=e)}return n}function C(e,a){return e.bins?T(e,e.bins):e.ticks?e.ticks(a):e.domain()}function P(e,a,n,c,f,t){var d=a.type;let r=z;if(d===i||f===i)r=e.timeFormat(c);else if(d===b||f===b)r=e.utcFormat(c);else if(M(d)){const f=e.formatFloat(c);if(t||a.bins)r=f;else{const e=D(a,n,!1);r=a=>e(a)?f(a):""}}else if(a.tickFormat){const f=a.domain();r=e.formatSpan(f[0],f[f.length-1],n,c)}else c&&(r=e.format(c));return r}function D(e,a,n){const c=C(e,a),f=e.base(),t=Math.log(f),d=Math.max(1,f*a/c.length),r=e=>{let a=e/Math.pow(f,Math.round(Math.log(e)/t));return a*f1?f[1]-f[0]:f[0];for(c=1;c{var f=Y(c[n+1],Y(c.max,1/0)),t=E(a,e),d=E(f,e);return t&&d?t+" – "+d:d?"< "+d:"≥ "+t}}(r):"discrete"===c?function(e){return(a,n)=>n?e(a):null}(r):function(e){return a=>e(a)}(r)}function Y(e,a){return null!=e?e:a}function E(e,a){return Number.isFinite(e)?a(e):null}Object.defineProperty(e,"scaleImplicit",{enumerable:!0,get:function(){return c.scaleImplicit}}),e.Band="band",e.BinOrdinal="bin-ordinal",e.DiscreteLegend="discrete",e.Diverging="diverging",e.GradientLegend="gradient",e.Identity="identity",e.Linear="linear",e.Log=r,e.Ordinal="ordinal",e.Point="point",e.Pow="pow",e.Quantile="quantile",e.Quantize="quantize",e.Sequential="sequential",e.Sqrt="sqrt",e.SymbolLegend="symbol",e.Symlog="symlog",e.Threshold="threshold",e.Time=i,e.UTC=b,e.bandSpace=d,e.domainCaption=function(e,n,c){c=c||{};const f=Math.max(3,c.maxlen||7),t=function(e,n,c,f){const t=f||n.type;return a.isString(c)&&k(t)&&(c=c.replace(/%a/g,"%A").replace(/%b/g,"%B")),c||t!==i?c||t!==b?Q(e,n,5,null,c,f,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}(e,n,c.format,c.formatType);if(w(n.type)){const e=$(n).slice(1).map(t),a=e.length;return`${a} boundar${1===a?"y":"ies"}: ${e.join(", ")}`}if(q(n.type)){const e=n.domain(),a=e.length;return`${a} value${1===a?"":"s"}: ${a>f?e.slice(0,f-2).map(t).join(", ")+", ending with "+e.slice(-1).map(t):e.map(t).join(", ")}`}{const e=n.domain();return`values from ${t(e[0])} to ${t(a.peek(e))}`}},e.interpolate=O,e.interpolateColors=x,e.interpolateRange=function(e,n){var c=n[0],f=a.peek(n)-c;return function(a){return e(c+a*f)}},e.isContinuous=function(e){return y(e,o)},e.isDiscrete=q,e.isDiscretizing=w,e.isInterpolating=function(e){return y(e,"interpolating")},e.isLogarithmic=M,e.isQuantile=function(e){return y(e,"quantile")},e.isTemporal=k,e.isValidScaleType=v,e.labelFormat=Q,e.labelFraction=function(e){var n=e.domain(),c=n.length-1,f=+n[0],t=+a.peek(n),d=t-f;if("threshold"===e.type){const e=c?d/c:.1;d=(t+=e)-(f-=e)}return e=>(e-f)/d},e.labelValues=$,e.quantizeInterpolator=function(e,a){for(var n=new Array(a),c=a+1,f=0;fe[a]?d[a](e[a]()):0),d):a.constant(.5)},e.scheme=R,e.tickCount=function(e,n,c){var f;return a.isNumber(n)&&(e.bins&&(n=Math.max(n,e.bins.length)),null!=c&&(n=Math.min(n,Math.floor(a.span(e.domain())/c||1)))),a.isObject(n)&&(f=n.step,n=n.interval),a.isString(n)&&(n=e.type===i?t.timeInterval(n):e.type==b?t.utcInterval(n):a.error("Only time and utc scales accept interval strings."),f&&(n=n.every(f))),n},e.tickFormat=P,e.tickValues=C,e.validTicks=T,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-scale/index.d.ts b/node_modules/vega-scale/index.d.ts deleted file mode 100644 index f187c1d..0000000 --- a/node_modules/vega-scale/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -// TODO: add missing types - -export function scheme(name: string, scheme?: any): any; diff --git a/node_modules/vega-scale/index.js b/node_modules/vega-scale/index.js deleted file mode 100644 index 9aab5f3..0000000 --- a/node_modules/vega-scale/index.js +++ /dev/null @@ -1,75 +0,0 @@ -export { - default as bandSpace -} from './src/scales/bandSpace'; - -export { - Identity, - Linear, - Log, - Pow, - Sqrt, - Symlog, - Time, - UTC, - Sequential, - Diverging, - Quantile, - Quantize, - Threshold, - BinOrdinal, - Ordinal, - Band, - Point -} from './src/scales/types'; - -export { - interpolate, - interpolateColors, - interpolateRange, - scaleCopy, - scaleFraction, - quantizeInterpolator -} from './src/interpolate'; - -export { - scale, - isValidScaleType, - isContinuous, - isDiscrete, - isDiscretizing, - isInterpolating, - isLogarithmic, - isQuantile, - isTemporal -} from './src/scales'; - -export { - scheme -} from './src/schemes'; - -export { - SymbolLegend, - DiscreteLegend, - GradientLegend -} from './src/legend-types'; - -export { - tickCount, - tickFormat, - tickValues, - validTicks -} from './src/ticks'; - -export { - labelFormat, - labelFraction, - labelValues -} from './src/labels'; - -export { - domainCaption -} from './src/caption'; - -export { - scaleImplicit -} from 'd3-scale'; diff --git a/node_modules/vega-scale/package.json b/node_modules/vega-scale/package.json deleted file mode 100644 index a915f44..0000000 --- a/node_modules/vega-scale/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "vega-scale@~7.0.0", - "_id": "vega-scale@7.0.0", - "_inBundle": false, - "_integrity": "sha512-3oQAQYLRk+PIs6aF6kdb7tbhm5IpxNiwdFVM9fNS+SSsii6v8kFC681EuUMqLVZOHELiklWIE1rZIHaB5dNRXg==", - "_location": "/vega-scale", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-scale@~7.0.0", - "name": "vega-scale", - "escapedName": "vega-scale", - "rawSpec": "~7.0.0", - "saveSpec": null, - "fetchSpec": "~7.0.0" - }, - "_requiredBy": [ - "/vega", - "/vega-encode", - "/vega-functions", - "/vega-parser", - "/vega-scenegraph", - "/vega-wordcloud" - ], - "_resolved": "https://registry.npmjs.org/vega-scale/-/vega-scale-7.0.0.tgz", - "_shasum": "0101802c6da29e2e903887160a269d57d6da479e", - "_spec": "vega-scale@~7.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "^2.4.0", - "d3-interpolate": "^1.4.0", - "d3-scale": "^3.2.1", - "vega-time": "^2.0.0", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "Scales and color schemes for visual encoding.", - "gitHead": "48c85218f2202242171aa569f2dca0f53cf2b51f", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "scale", - "color", - "palette" - ], - "license": "BSD-3-Clause", - "main": "build/vega-scale.js", - "module": "index", - "name": "vega-scale", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-scale.js -c -m -o build/vega-scale.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g d3-array:d3,d3-interpolate:d3,d3-scale:d3,vega-time:vega,vega-util:vega -f umd -n vega -o build/vega-scale.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "types": "index.d.ts", - "version": "7.0.0" -} diff --git a/node_modules/vega-scale/src/caption.js b/node_modules/vega-scale/src/caption.js deleted file mode 100644 index 72d46d0..0000000 --- a/node_modules/vega-scale/src/caption.js +++ /dev/null @@ -1,47 +0,0 @@ -import {labelFormat, labelValues} from './labels'; -import {Time, UTC} from './scales/types'; -import {isDiscrete, isDiscretizing, isTemporal} from './scales'; -import {isString, peek} from 'vega-util'; - -function format(locale, scale, specifier, formatType) { - const type = formatType || scale.type; - - // replace abbreviated time specifiers to improve screen reader experience - if (isString(specifier) && isTemporal(type)) { - specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - } - - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') - : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') - : labelFormat(locale, scale, 5, null, specifier, formatType, true); -} - -export function domainCaption(locale, scale, opt) { - opt = opt || {}; - const max = Math.max(3, opt.maxlen || 7), - fmt = format(locale, scale, opt.format, opt.formatType); - - // if scale breaks domain into bins, describe boundaries - if (isDiscretizing(scale.type)) { - const v = labelValues(scale).slice(1).map(fmt), - n = v.length; - return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`; - } - - // if scale domain is discrete, list values - else if (isDiscrete(scale.type)) { - const d = scale.domain(), - n = d.length, - v = n > max - ? d.slice(0, max - 2).map(fmt).join(', ') - + ', ending with ' + d.slice(-1).map(fmt) - : d.map(fmt).join(', '); - return `${n} value${n === 1 ? '' : 's'}: ${v}`; - } - - // if scale domain is continuous, describe value range - else { - const d = scale.domain(); - return `values from ${fmt(d[0])} to ${fmt(peek(d))}`; - } -} diff --git a/node_modules/vega-scale/src/interpolate.js b/node_modules/vega-scale/src/interpolate.js deleted file mode 100644 index d86c7e6..0000000 --- a/node_modules/vega-scale/src/interpolate.js +++ /dev/null @@ -1,57 +0,0 @@ -import {scale as getScale} from './scales'; -import {constant, peek} from 'vega-util'; -import * as $ from 'd3-interpolate'; - -const scaleProps = ['clamp', 'base', 'constant', 'exponent']; - -export function interpolateRange(interpolator, range) { - var start = range[0], - span = peek(range) - start; - return function(i) { return interpolator(start + i * span); }; -} - -export function interpolateColors(colors, type, gamma) { - return $.piecewise(interpolate(type || 'rgb', gamma), colors); -} - -export function quantizeInterpolator(interpolator, count) { - var samples = new Array(count), - n = count + 1; - for (var i = 0; i < count;) samples[i] = interpolator(++i / n); - return samples; -} - -export function scaleCopy(scale) { - const t = scale.type, - s = scale.copy(); - s.type = t; - return s; -} - -export function scaleFraction(scale, min, max) { - var delta = max - min, i, t, s; - - if (!delta || !Number.isFinite(delta)) { - return constant(0.5); - } else { - i = (t = scale.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = getScale(t)().domain([min, max]).range([0, 1]); - scaleProps.forEach(m => scale[m] ? s[m](scale[m]()) : 0); - return s; - } -} - -export function interpolate(type, gamma) { - var interp = $[method(type)]; - return (gamma != null && interp && interp.gamma) - ? interp.gamma(gamma) - : interp; -} - -function method(type) { - return 'interpolate' + type.toLowerCase() - .split('-') - .map(function(s) { return s[0].toUpperCase() + s.slice(1); }) - .join(''); -} diff --git a/node_modules/vega-scale/src/labels.js b/node_modules/vega-scale/src/labels.js deleted file mode 100644 index acb8492..0000000 --- a/node_modules/vega-scale/src/labels.js +++ /dev/null @@ -1,103 +0,0 @@ -import {DiscreteLegend, SymbolLegend} from './legend-types'; -import {Log, Quantile, Quantize, Threshold, Time, UTC} from './scales/types'; -import {tickFormat, tickLog, tickValues} from './ticks'; -import {peek} from 'vega-util'; - -const symbols = { - [Quantile]: 'quantiles', - [Quantize]: 'thresholds', - [Threshold]: 'domain' -}; - -const formats = { - [Quantile]: 'quantiles', - [Quantize]: 'domain' -}; - -export function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) - : scale.type === Log ? tickLog(scale, count, true) - : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) - : tickValues(scale, count); -} - -export function thresholdFormat(locale, scale, specifier) { - var _ = scale[formats[scale.type]](), - n = _.length, - d = n > 1 ? _[1] - _[0] : _[0], i; - - for (i=1; i { - var limit = get(array[index + 1], get(array.max, +Infinity)), - lo = formatValue(value, format), - hi = formatValue(limit, format); - return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo; - }; -} - -function get(value, dflt) { - return value != null ? value : dflt; -} - -function formatDiscrete(format) { - return (value, index) => index ? format(value) : null; -} - -function formatPoint(format) { - return value => format(value); -} - -function formatValue(value, format) { - return Number.isFinite(value) ? format(value) : null; -} - -export function labelFraction(scale) { - var domain = scale.domain(), - count = domain.length - 1, - lo = +domain[0], - hi = +peek(domain), - span = hi - lo; - - if (scale.type === Threshold) { - const adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - - return value => (value - lo) / span; -} diff --git a/node_modules/vega-scale/src/legend-types.js b/node_modules/vega-scale/src/legend-types.js deleted file mode 100644 index 418d203..0000000 --- a/node_modules/vega-scale/src/legend-types.js +++ /dev/null @@ -1,3 +0,0 @@ -export var SymbolLegend = 'symbol'; -export var DiscreteLegend = 'discrete'; -export var GradientLegend = 'gradient'; diff --git a/node_modules/vega-scale/src/palettes.js b/node_modules/vega-scale/src/palettes.js deleted file mode 100644 index 0844a66..0000000 --- a/node_modules/vega-scale/src/palettes.js +++ /dev/null @@ -1,78 +0,0 @@ -export const continuous = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' -}; - -export const discrete = { - category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', - accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', - dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', - paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', - pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', - pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', - set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', - set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', - set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' -}; diff --git a/node_modules/vega-scale/src/scales.js b/node_modules/vega-scale/src/scales.js deleted file mode 100644 index e09f869..0000000 --- a/node_modules/vega-scale/src/scales.js +++ /dev/null @@ -1,136 +0,0 @@ -import {array, hasOwnProperty, toSet} from 'vega-util'; -import invertRange from './scales/invertRange'; -import invertRangeExtent from './scales/invertRangeExtent'; - -import { - Band, - BinOrdinal, Continuous as C, Discrete as D, Diverging, Interpolating as I, - Identity, Linear, Log, Ordinal, - Point, Pow, Quantile, - Quantize, Sequential, Sqrt, Symlog, - Temporal as T, - Threshold, - Time, - UTC, - Discretizing as Z -} from './scales/types'; - -import { - band as scaleBand, - point as scalePoint -} from './scales/scaleBand'; - -import { - scaleBinOrdinal -} from './scales/scaleBinOrdinal'; - -import * as $ from 'd3-scale'; - -// scale registry -const scales = {}; - -/** - * Augment scales with their type and needed inverse methods. - */ -function create(type, constructor, metadata) { - const ctr = function scale() { - var s = constructor(); - - if (!s.invertRange) { - s.invertRange = s.invert ? invertRange(s) - : s.invertExtent ? invertRangeExtent(s) - : undefined; - } - - s.type = type; - return s; - }; - - ctr.metadata = toSet(array(metadata)); - - return ctr; -} - -export function scale(type, scale, metadata) { - if (arguments.length > 1) { - scales[type] = create(type, scale, metadata); - return this; - } else { - return isValidScaleType(type) ? scales[type] : undefined; - } -} - -// identity scale -scale(Identity, $.scaleIdentity); - -// continuous scales -scale(Linear, $.scaleLinear, C); -scale(Log, $.scaleLog, [C, Log]); -scale(Pow, $.scalePow, C); -scale(Sqrt, $.scaleSqrt, C); -scale(Symlog, $.scaleSymlog, C); -scale(Time, $.scaleTime, [C, T]); -scale(UTC, $.scaleUtc, [C, T]); - -// sequential scales -scale(Sequential, $.scaleSequential, [C, I]); // backwards compat -scale(`${Sequential}-${Linear}`, $.scaleSequential, [C, I]); -scale(`${Sequential}-${Log}`, $.scaleSequentialLog, [C, I, Log]); -scale(`${Sequential}-${Pow}`, $.scaleSequentialPow, [C, I]); -scale(`${Sequential}-${Sqrt}`, $.scaleSequentialSqrt, [C, I]); -scale(`${Sequential}-${Symlog}`, $.scaleSequentialSymlog, [C, I]); - -// diverging scales -scale(`${Diverging}-${Linear}`, $.scaleDiverging, [C, I]); -scale(`${Diverging}-${Log}`, $.scaleDivergingLog, [C, I, Log]); -scale(`${Diverging}-${Pow}`, $.scaleDivergingPow, [C, I]); -scale(`${Diverging}-${Sqrt}`, $.scaleDivergingSqrt, [C, I]); -scale(`${Diverging}-${Symlog}`, $.scaleDivergingSymlog, [C, I]); - -// discretizing scales -scale(Quantile, $.scaleQuantile, [Z, Quantile]); -scale(Quantize, $.scaleQuantize, Z); -scale(Threshold, $.scaleThreshold, Z); - -// discrete scales -scale(BinOrdinal, scaleBinOrdinal, [D, Z]); -scale(Ordinal, $.scaleOrdinal, D); -scale(Band, scaleBand, D); -scale(Point, scalePoint, D); - -export function isValidScaleType(type) { - return hasOwnProperty(scales, type); -} - -function hasType(key, type) { - const s = scales[key]; - return s && s.metadata[type]; -} - -export function isContinuous(key) { - return hasType(key, C); -} - -export function isDiscrete(key) { - return hasType(key, D); -} - -export function isDiscretizing(key) { - return hasType(key, Z); -} - -export function isLogarithmic(key) { - return hasType(key, Log); -} - -export function isTemporal(key) { - return hasType(key, T); -} - -export function isInterpolating(key) { - return hasType(key, I); -} - -export function isQuantile(key) { - return hasType(key, Quantile); -} diff --git a/node_modules/vega-scale/src/scales/bandSpace.js b/node_modules/vega-scale/src/scales/bandSpace.js deleted file mode 100644 index c9e256d..0000000 --- a/node_modules/vega-scale/src/scales/bandSpace.js +++ /dev/null @@ -1,4 +0,0 @@ -export default function(count, paddingInner, paddingOuter) { - var space = count - paddingInner + paddingOuter * 2; - return count ? (space > 0 ? space : 1) : 0; -} diff --git a/node_modules/vega-scale/src/scales/invertRange.js b/node_modules/vega-scale/src/scales/invertRange.js deleted file mode 100644 index 55771ed..0000000 --- a/node_modules/vega-scale/src/scales/invertRange.js +++ /dev/null @@ -1,18 +0,0 @@ -export default function(scale) { - return function(_) { - var lo = _[0], - hi = _[1], - t; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - return [ - scale.invert(lo), - scale.invert(hi) - ]; - }; -} diff --git a/node_modules/vega-scale/src/scales/invertRangeExtent.js b/node_modules/vega-scale/src/scales/invertRangeExtent.js deleted file mode 100644 index 0312acc..0000000 --- a/node_modules/vega-scale/src/scales/invertRangeExtent.js +++ /dev/null @@ -1,31 +0,0 @@ -export default function(scale) { - return function(_) { - var range = scale.range(), - lo = _[0], - hi = _[1], - min = -1, max, t, i, n; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - for (i=0, n=range.length; i= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - } - - if (min < 0) return undefined; - - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - - return [ - lo[0] === undefined ? lo[1] : lo[0], - hi[1] === undefined ? hi[0] : hi[1] - ]; - }; -} diff --git a/node_modules/vega-scale/src/scales/numbers.js b/node_modules/vega-scale/src/scales/numbers.js deleted file mode 100644 index 22022dc..0000000 --- a/node_modules/vega-scale/src/scales/numbers.js +++ /dev/null @@ -1,5 +0,0 @@ -var map = Array.prototype.map; - -export function numbers(_) { - return map.call(_, function(x) { return +x; }); -} diff --git a/node_modules/vega-scale/src/scales/scaleBand.js b/node_modules/vega-scale/src/scales/scaleBand.js deleted file mode 100644 index aa629ef..0000000 --- a/node_modules/vega-scale/src/scales/scaleBand.js +++ /dev/null @@ -1,188 +0,0 @@ -import bandSpace from './bandSpace'; -import {bisectRight, range as sequence} from 'd3-array'; -import {scaleOrdinal as ordinal} from 'd3-scale'; - -export function band() { - var scale = ordinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - range = [0, 1], - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = range[1] < range[0], - start = range[reverse - 0], - stop = range[1 - reverse], - space = bandSpace(n, paddingInner, paddingOuter); - - step = (stop - start) / (space || 1); - if (round) { - step = Math.floor(step); - } - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - var values = sequence(n).map(function(i) { return start + step * i; }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function(_) { - if (arguments.length) { - domain(_); - return rescale(); - } else { - return domain(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = [+_[0], +_[1]]; - return rescale(); - } else { - return range.slice(); - } - }; - - scale.rangeRound = function(_) { - range = [+_[0], +_[1]]; - round = true; - return rescale(); - }; - - scale.bandwidth = function() { - return bandwidth; - }; - - scale.step = function() { - return step; - }; - - scale.round = function(_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else { - return round; - } - }; - - scale.padding = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingInner = function(_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingOuter = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingOuter; - } - }; - - scale.align = function(_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return align; - } - }; - - scale.invertRange = function(_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - - var lo = +_[0], - hi = +_[1], - reverse = range[1] < range[0], - values = reverse ? ordinalRange().reverse() : ordinalRange(), - n = values.length - 1, a, b, t; - - // bail if either range endpoint is invalid - if (lo !== lo || hi !== hi) return; - - // order range inputs, bail if outside of scale range - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - if (hi < values[0] || lo > range[1-reverse]) return; - - // binary search to index into scale range - a = Math.max(0, bisectRight(values, lo) - 1); - b = lo===hi ? a : bisectRight(values, hi) - 1; - - // increment index a if lo is within padding gap - if (lo - values[a] > bandwidth + 1e-10) ++a; - - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - return (a > b) ? undefined : domain().slice(a, b+1); - }; - - scale.invert = function(_) { - var value = scale.invertRange([_, _]); - return value ? value[0] : value; - }; - - scale.copy = function() { - return band() - .domain(domain()) - .range(range) - .round(round) - .paddingInner(paddingInner) - .paddingOuter(paddingOuter) - .align(align); - }; - - return rescale(); -} - -function pointish(scale) { - var copy = scale.copy; - - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - - scale.copy = function() { - return pointish(copy()); - }; - - return scale; -} - -export function point() { - return pointish(band().paddingInner(1)); -} diff --git a/node_modules/vega-scale/src/scales/scaleBinOrdinal.js b/node_modules/vega-scale/src/scales/scaleBinOrdinal.js deleted file mode 100644 index 013b1db..0000000 --- a/node_modules/vega-scale/src/scales/scaleBinOrdinal.js +++ /dev/null @@ -1,44 +0,0 @@ -import {bisect} from 'd3-array'; -import {tickFormat} from 'd3-scale'; -import {peek} from 'vega-util'; -import {numbers} from './numbers'; -import {slice} from './slice'; - -export function scaleBinOrdinal() { - var domain = [], - range = []; - - function scale(x) { - return x == null || x !== x - ? undefined - : range[(bisect(domain, x) - 1) % range.length]; - } - - scale.domain = function(_) { - if (arguments.length) { - domain = numbers(_); - return scale; - } else { - return domain.slice(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else { - return range.slice(); - } - }; - - scale.tickFormat = function(count, specifier) { - return tickFormat(domain[0], peek(domain), count == null ? 10 : count, specifier); - }; - - scale.copy = function() { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - - return scale; -} \ No newline at end of file diff --git a/node_modules/vega-scale/src/scales/slice.js b/node_modules/vega-scale/src/scales/slice.js deleted file mode 100644 index 8eeac16..0000000 --- a/node_modules/vega-scale/src/scales/slice.js +++ /dev/null @@ -1 +0,0 @@ -export var slice = Array.prototype.slice; diff --git a/node_modules/vega-scale/src/scales/types.js b/node_modules/vega-scale/src/scales/types.js deleted file mode 100644 index 24f973c..0000000 --- a/node_modules/vega-scale/src/scales/types.js +++ /dev/null @@ -1,29 +0,0 @@ -export const Identity = 'identity'; - -export const Linear = 'linear'; -export const Log = 'log'; -export const Pow = 'pow'; -export const Sqrt = 'sqrt'; -export const Symlog = 'symlog'; - -export const Time = 'time'; -export const UTC = 'utc'; - -export const Sequential = 'sequential'; -export const Diverging = 'diverging'; - -export const Quantile = 'quantile'; -export const Quantize = 'quantize'; -export const Threshold = 'threshold'; - -export const Ordinal = 'ordinal'; -export const Point = 'point'; -export const Band = 'band'; -export const BinOrdinal = 'bin-ordinal'; - -// categories -export const Continuous = 'continuous'; -export const Discrete = 'discrete'; -export const Discretizing = 'discretizing'; -export const Interpolating = 'interpolating'; -export const Temporal = 'temporal'; diff --git a/node_modules/vega-scale/src/schemes.js b/node_modules/vega-scale/src/schemes.js deleted file mode 100644 index db951f4..0000000 --- a/node_modules/vega-scale/src/schemes.js +++ /dev/null @@ -1,26 +0,0 @@ -import {continuous, discrete} from './palettes'; -import {interpolateColors} from './interpolate'; - -function colors(palette) { - var n = palette.length / 6 | 0, c = new Array(n), i = 0; - while (i < n) c[i] = '#' + palette.slice(i * 6, ++i * 6); - return c; -} - -function apply(_, f) { - for (let k in _) scheme(k, f(_[k])); -} - -const schemes = {}; -apply(discrete, colors); -apply(continuous, _ => interpolateColors(colors(_))); - -export function scheme(name, scheme) { - name = name && name.toLowerCase(); - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else { - return schemes[name]; - } -} diff --git a/node_modules/vega-scale/src/ticks.js b/node_modules/vega-scale/src/ticks.js deleted file mode 100644 index 6d42869..0000000 --- a/node_modules/vega-scale/src/ticks.js +++ /dev/null @@ -1,169 +0,0 @@ -import {isLogarithmic} from './scales'; -import {Time, UTC} from './scales/types'; -import {timeInterval, utcInterval} from 'vega-time'; -import {error, isArray, isNumber, isObject, isString, peek, span} from 'vega-util'; - -const defaultFormatter = value => isArray(value) - ? value.map(v => String(v)) - : String(value); - -const ascending = (a, b) => a[1] - b[1]; -const descending = (a, b) => b[1] - a[1]; - -/** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ -export function tickCount(scale, count, minStep) { - var step; - - if (isNumber(count)) { - if (scale.bins) { - count = Math.max(count, scale.bins.length); - } - if (minStep != null) { - count = Math.min( - count, - Math.floor((span(scale.domain()) / minStep) || 1) - ); - } - } - - if (isObject(count)) { - step = count.step; - count = count.interval; - } - - if (isString(count)) { - count = scale.type === Time ? timeInterval(count) - : scale.type == UTC ? utcInterval(count) - : error('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - - return count; -} - -/** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ -export function validTicks(scale, ticks, count) { - let range = scale.range(), - lo = range[0], - hi = peek(range), - cmp = ascending; - - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - - lo = Math.floor(lo); - hi = Math.ceil(hi); - - // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - ticks = ticks.map(v => [v, scale(v)]) - .filter(_ => lo <= _[1] && _[1] <= hi) - .sort(cmp) - .map(_ => _[0]); - - if (count > 0 && ticks.length > 1) { - const endpoints = [ticks[0], peek(ticks)]; - while (ticks.length > count && ticks.length >= 3) { - ticks = ticks.filter((_, i) => !(i % 2)); - } - if (ticks.length < 3) { - ticks = endpoints; - } - } - - return ticks; -} - -/** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ -export function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins) - : scale.ticks ? scale.ticks(count) - : scale.domain(); -} - -/** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ -export function tickFormat(locale, scale, count, specifier, formatType, noSkip) { - var type = scale.type; - let format = defaultFormatter; - - if (type === Time || formatType === Time) { - format = locale.timeFormat(specifier); - } - else if (type === UTC || formatType === UTC) { - format = locale.utcFormat(specifier); - } - else if (isLogarithmic(type)) { - const varfmt = locale.formatFloat(specifier); - if (noSkip || scale.bins) { - format = varfmt; - } else { - const test = tickLog(scale, count, false); - format = _ => test(_) ? varfmt(_) : ''; - } - } - else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - const d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } - else if (specifier) { - format = locale.format(specifier); - } - - return format; -} - -export function tickLog(scale, count, values) { - const ticks = tickValues(scale, count), - base = scale.base(), - logb = Math.log(base), - k = Math.max(1, base * count / ticks.length); - - // apply d3-scale's log format filter criteria - const test = d => { - let i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - - return values ? ticks.filter(test) : test; -} diff --git a/node_modules/vega-scenegraph/LICENSE b/node_modules/vega-scenegraph/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-scenegraph/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-scenegraph/README.md b/node_modules/vega-scenegraph/README.md deleted file mode 100644 index b839055..0000000 --- a/node_modules/vega-scenegraph/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# vega-scenegraph - -[Vega](https://github.com/vega/vega) scenegraph and renderers. - -Renderers and event handlers for Vega's mark-based scenegraph. This package supports both pixel-based (canvas) and vector graphics (SVG) output. Renderers can either (re-)draw a complete scene or perform incremental re-rendering for a set of provided "dirty" items. A fast SVG string renderer is also provided to generate static SVG for export. - -The [node-canvas](https://github.com/Automattic/node-canvas) library is used for server-side canvas rendering and bounds calculation. Node-canvas requires the native Cairo graphics library and may attempt to compile native code as part of the installation process. In some instances this may result in installation hiccups. Should you run into issues, you are likely to resolve them more quickly if you first search for help regarding node-canvas (as opposed to vega-scenegraph) installation. However, node-canvas is not a strict dependency, and is not needed for SVG rendering. Bounds calculation can be performed without node-canvas, though in the case of text marks the resulting bounds may be inaccurate due to approximate text size calculations. - -## Scenegraph Definition - -The Vega scenegraph is a hierarchical (tree) data structure. The levels of the tree alternate between an enclosing *mark* definition and contained sets of mark instances called *items*. - -For example, here is a simple scenegraph containing three rectangles: - -```json -{ - "marktype": "rect", - "items": [ - {"x": 0, "y": 0, "width": 50, "height": 50, "fill": "steelblue"}, - {"x": 100, "y": 50, "width": 50, "height": 50, "fill": "firebrick"}, - {"x": 50, "y": 100, "width": 50, "height": 50, "fill": "forestgreen"} - ] -} -``` - -The supported mark types are rectangles (`rect`), plotting symbols (`symbol`), general paths or polygons (`path`), circular arcs (`arc`), filled areas (`area`), lines (`line`), images (`image`), text labels (`text`), and chart gridlines or rules (`rule`). Each item has a set of supported properties (`x`, `y`, `width`, `fill`, and so on) appropriate to the mark type. - -Scenegraphs may also contain `group` marks, which serve as containers for other marks. For example, a top-level group mark may look like: - -```json -{ - "marktype": "group", - "items": [ - { - "x": 0, - "y": 0, - "width": 200, - "height": 200, - "items": [...] // array of contained mark instances - } - ] -} -``` - -In this example, the group *mark* contains only a single group *item*. In practice, a group mark may contain any number of group items, for example to describe a scene with multiple layers or sub-plots. - -For more information regarding supported mark properties, please see the [Vega marks documentation](https://vega.github.io/vega/docs/marks/). - -## Scenegraph Serialization - -The top-level export of this package includes `fromJSON` and `toJSON` methods to support scenegraph serialization. The `fromJSON` method expects a JSON string as input (similar to the examples listed above). It will then add additional parent pointers to the tree structure. For example, each item will have a `mark` property pointing to its parent mark, and each mark will have a `group` property pointing to its parent group (if any). The `toJSON` method maps a scenegraph instance to a JSON string, stripping any parent pointers or other non-standard properties. - -## Test Suite - -The vega-scengraph test suite compares rendered output for both Canvas (PNG) and SVG (text) renderers. Due to differences among platforms, pixel-level rendering by node-canvas can differ across operating systems. As a result, some test cases may break when running on a system other than Mac OS X (our standard platform for testing). If you are running on Linux or Windows and experience test failures, it does not necessarily indicate an issue with vega-scenegraph. In such cases, we recommend running the node-canvas test-server (`npm run test-server` from the node-canvas repository) to compare server-side and client-side rendering. diff --git a/node_modules/vega-scenegraph/build/vega-scenegraph-schema.json b/node_modules/vega-scenegraph/build/vega-scenegraph-schema.json deleted file mode 100644 index 62c9b2d..0000000 --- a/node_modules/vega-scenegraph/build/vega-scenegraph-schema.json +++ /dev/null @@ -1,2150 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-06/schema#", - "title": "Vega scenegraph", - "description": "Vega scenegraph model.", - "oneOf": [ - { - "$ref": "#/refs/mark" - } - ], - "refs": { - "mark": { - "oneOf": [ - { - "$ref": "#/refs/mark-group" - }, - { - "$ref": "#/refs/mark-arc" - }, - { - "$ref": "#/refs/mark-area" - }, - { - "$ref": "#/refs/mark-image" - }, - { - "$ref": "#/refs/mark-line" - }, - { - "$ref": "#/refs/mark-path" - }, - { - "$ref": "#/refs/mark-rect" - }, - { - "$ref": "#/refs/mark-rule" - }, - { - "$ref": "#/refs/mark-symbol" - }, - { - "$ref": "#/refs/mark-text" - }, - { - "$ref": "#/refs/mark-trail" - } - ] - }, - "path": { - "type": "string", - "pattern": "^[ \t\r\f]*([Mm][ \t\r\f]*[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?(([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)*[ \t\r\f]*(([Zz]|[LlTt][ \t\r\f]*[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?(([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)*|[HhVv][ \t\r\f]*[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?(([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)*|[Cc][ \t\r\f]*[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?(([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?([ \t\r\f]+,?[ \t\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([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?([ \t\r\f]+,?[ \t\r\f]*|,[ \t\r\f]*)??[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)*))*)?)*)?[ \t\r\f]*$" - }, - "paint": { - "oneOf": [ - { - "$ref": "#/refs/color" - }, - { - "$ref": "#/refs/linearGradient" - }, - { - "$ref": "#/refs/radialGradient" - } - ] - }, - "color": { - "oneOf": [ - { - "type": "string", - "pattern": "^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$" - }, - { - "type": "string", - "pattern": "^rgb\\([ \t\f]*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(,[ \t\f]*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){2}[ \t\f]*\\)$" - }, - { - "type": "string", - "pattern": "^rgb\\([ \t\f]*([0-9]|[1-9][0-9]|100)%(,[ \t\f]*([0-9]|[1-9][0-9]|100)%){2}[ \t\f]*\\)$" - }, - { - "type": "string", - "pattern": "^hsl\\([ \t\f]*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9]|360)(,[ \t\f]*([0-9]|[1-9][0-9]|100)%){2}[ \t\f]*\\)$" - }, - { - "type": "string", - "pattern": "^([Aa][Ll][Ii][Cc][Ee][Bb][Ll][Uu][Ee]|[Aa][Nn][Tt][Ii][Qq][Uu][Ee][Ww][Hh][Ii][Tt][Ee]|[Aa][Qq][Uu][Aa]|[Aa][Qq][Uu][Aa][Mm][Aa][Rr][Ii][Nn][Ee]|[Aa][Zz][Uu][Rr][Ee]|[Bb][Ee][Ii][Gg][Ee]|[Bb][Ii][Ss][Qq][Uu][Ee]|[Bb][Ll][Aa][Cc][Kk]|[Bb][Ll][Aa][Nn][Cc][Hh][Ee][Dd][Aa][Ll][Mm][Oo][Nn][Dd]|[Bb][Ll][Uu][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][Ll][Ee]|[Rr][Ee][Bb][Ee][Cc][Cc][Aa][Pp][Uu][Rr][Pp][Ll][Ee]|[Rr][Ee][Dd]|[Rr][Oo][Ss][Yy][Bb][Rr][Oo][Ww][Nn]|[Rr][Oo][Yy][Aa][Ll][Bb][Ll][Uu][Ee]|[Ss][Aa][Dd][Dd][Ll][Ee][Bb][Rr][Oo][Ww][Nn]|[Ss][Aa][Ll][Mm][Oo][Nn]|[Ss][Aa][Nn][Dd][Yy][Bb][Rr][Oo][Ww][Nn]|[Ss][Ee][Aa][Gg][Rr][Ee][Ee][Nn]|[Ss][Ee][Aa][Ss][Hh][Ee][Ll][Ll]|[Ss][Ii][Ee][Nn][Nn][Aa]|[Ss][Ii][Ll][Vv][Ee][Rr]|[Ss][Kk][Yy][Bb][Ll][Uu][Ee]|[Ss][Ll][Aa][Tt][Ee][Bb][Ll][Uu][Ee]|[Ss][Ll][Aa][Tt][Ee][Gg][Rr][Aa][Yy]|[Ss][Nn][Oo][Ww]|[Ss][Pp][Rr][Ii][Nn][Gg][Gg][Rr][Ee][Ee][Nn]|[Ss][Tt][Ee][Ee][Ll][Bb][Ll][Uu][Ee]|[Tt][Aa][Nn]|[Tt][Ee][Aa][Ll]|[Tt][Hh][Ii][Ss][Tt][Ll][Ee]|[Tt][Oo][Mm][Aa][Tt][Oo]|[Tt][Uu][Rr][Qq][Uu][Oo][Ii][Ss][Ee]|[Vv][Ii][Oo][Ll][Ee][Tt]|[Ww][Hh][Ee][Aa][Tt]|[Ww][Hh][Ii][Tt][Ee]|[Ww][Hh][Ii][Tt][Ee][Ss][Mm][Oo][Kk][Ee]|[Yy][Ee][Ll][Ll][Oo][Ww]|[Yy][Ee][Ll][Ll][Oo][Ww][Gg][Rr][Ee][Ee][Nn])$" - } - ] - }, - "gradientStop": { - "type": "object", - "properties": { - "offset": { - "type": "number" - }, - "color": { - "$ref": "#/refs/color" - } - }, - "required": [ - "offset", - "color" - ] - }, - "linearGradient": { - "type": "object", - "properties": { - "gradient": { - "enum": [ - "linear" - ] - }, - "id": { - "type": "string" - }, - "x1": { - "type": "number" - }, - "y1": { - "type": "number" - }, - "x2": { - "type": "number" - }, - "y2": { - "type": "number" - }, - "stops": { - "type": "array", - "items": { - "$ref": "#/refs/gradientStop" - } - } - }, - "required": [ - "gradient", - "stops" - ], - "additionalProperties": false - }, - "radialGradient": { - "type": "object", - "properties": { - "gradient": { - "enum": [ - "radial" - ] - }, - "id": { - "type": "string" - }, - "x1": { - "type": "number" - }, - "y1": { - "type": "number" - }, - "r1": { - "type": "number" - }, - "x2": { - "type": "number" - }, - "y2": { - "type": "number" - }, - "r2": { - "type": "number" - }, - "stops": { - "type": "array", - "items": { - "$ref": "#/refs/gradientStop" - } - } - }, - "required": [ - "gradient", - "stops" - ], - "additionalProperties": false - }, - "mark-group": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "group" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-group" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-group": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "clip": { - "type": "boolean" - }, - "cornerRadius": { - "type": "number" - }, - "cornerRadiusTopLeft": { - "type": "number" - }, - "cornerRadiusTopRight": { - "type": "number" - }, - "cornerRadiusBottomRight": { - "type": "number" - }, - "cornerRadiusBottomLeft": { - "type": "number" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/mark" - } - }, - "strokeForeground": { - "type": "boolean" - }, - "strokeOffset": { - "type": "number" - } - }, - "additionalProperties": false - }, - "mark-arc": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "arc" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-arc" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-arc": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "startAngle": { - "type": "number" - }, - "endAngle": { - "type": "number" - }, - "padAngle": { - "type": "number" - }, - "innerRadius": { - "type": "number" - }, - "outerRadius": { - "type": "number" - }, - "cornerRadius": { - "type": "number" - } - }, - "additionalProperties": false - }, - "mark-area": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "area" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-area" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-area": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "defined": { - "type": "boolean" - }, - "interpolate": { - "enum": [ - "basis", - "cardinal", - "catmull-rom", - "linear", - "monotone", - "natural", - "step", - "step-after", - "step-before" - ] - }, - "tension": { - "type": "number" - }, - "orient": { - "enum": [ - "horizontal", - "vertical" - ] - } - }, - "additionalProperties": false - }, - "mark-image": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "image" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-image" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-image": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri-reference" - }, - "aspect": { - "type": "boolean", - "default": true - }, - "smooth": { - "type": "boolean", - "default": true - }, - "align": { - "enum": [ - "left", - "center", - "right" - ], - "default": "left" - }, - "baseline": { - "enum": [ - "top", - "middle", - "bottom" - ], - "default": "top" - } - }, - "additionalProperties": false - }, - "mark-line": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "line" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-line" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-line": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "defined": { - "type": "boolean" - }, - "interpolate": { - "enum": [ - "basis", - "basis-closed", - "basis-open", - "bundle", - "cardinal", - "cardinal-closed", - "cardinal-open", - "catmull-rom", - "catmull-rom-closed", - "catmull-rom-open", - "linear", - "linear-closed", - "monotone", - "natural", - "step", - "step-after", - "step-before" - ] - }, - "tension": { - "type": "number" - }, - "orient": { - "enum": [ - "horizontal", - "vertical" - ] - }, - "size": { - "type": "number" - } - }, - "additionalProperties": false - }, - "mark-path": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "path" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-path" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-path": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "angle": { - "type": "number" - }, - "path": { - "$ref": "#/refs/path" - }, - "scaleX": { - "type": "number" - }, - "scaleY": { - "type": "number" - } - }, - "additionalProperties": false - }, - "mark-rect": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "rect" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-rect" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-rect": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "cornerRadius": { - "type": "number" - }, - "cornerRadiusTopLeft": { - "type": "number" - }, - "cornerRadiusTopRight": { - "type": "number" - }, - "cornerRadiusBottomRight": { - "type": "number" - }, - "cornerRadiusBottomLeft": { - "type": "number" - } - }, - "additionalProperties": false - }, - "mark-rule": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "rule" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-rule" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-rule": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "x2": { - "type": "number" - }, - "y2": { - "type": "number" - } - }, - "additionalProperties": false - }, - "mark-symbol": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "symbol" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-symbol" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-symbol": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "angle": { - "type": "number", - "default": 0 - }, - "size": { - "type": "number", - "default": 100 - }, - "shape": { - "type": "string" - } - }, - "additionalProperties": false - }, - "mark-text": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "text" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-text" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-text": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "text": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "limit": { - "type": "number", - "default": 0 - }, - "lineHeight": { - "type": "number" - }, - "dir": { - "type": "string", - "default": "ltr" - }, - "ellipsis": { - "type": "string", - "default": "…" - }, - "align": { - "enum": [ - "left", - "center", - "right" - ], - "default": "left" - }, - "baseline": { - "enum": [ - "alphabetic", - "top", - "middle", - "bottom", - "line-top", - "line-bottom" - ], - "default": "alphabetic" - }, - "angle": { - "type": "number", - "default": 0 - }, - "theta": { - "type": "number", - "default": 0 - }, - "radius": { - "type": "number", - "default": 0 - }, - "dx": { - "type": "number", - "default": 0 - }, - "dy": { - "type": "number", - "default": 0 - }, - "font": { - "type": "string", - "default": "sans-serif" - }, - "fontSize": { - "type": "number" - }, - "fontStyle": { - "enum": [ - "normal", - "italic", - "oblique" - ], - "default": "normal" - }, - "fontWeight": { - "enum": [ - "normal", - "bold", - "bolder", - "lighter", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ], - "default": "normal" - }, - "fontVariant": { - "enum": [ - "normal", - "small-caps" - ], - "default": "normal" - } - }, - "additionalProperties": false - }, - "mark-trail": { - "type": "object", - "properties": { - "marktype": { - "enum": [ - "trail" - ] - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "interactive": { - "type": "boolean", - "default": true - }, - "items": { - "type": "array", - "items": { - "$ref": "#/refs/item-trail" - } - }, - "zindex": { - "type": "number" - } - }, - "required": [ - "marktype" - ], - "additionalProperties": false - }, - "item-trail": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "blend": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ], - "default": null - }, - "opacity": { - "type": "number", - "default": 1 - }, - "fill": { - "$ref": "#/refs/paint" - }, - "fillOpacity": { - "type": "number", - "default": 1 - }, - "stroke": { - "$ref": "#/refs/paint" - }, - "strokeOpacity": { - "type": "number", - "default": 1 - }, - "strokeWidth": { - "type": "number", - "default": 1 - }, - "strokeCap": { - "enum": [ - "butt", - "cap", - "round" - ], - "default": "butt" - }, - "strokeJoin": { - "enum": [ - "miter", - "round", - "bevel" - ], - "default": "miter" - }, - "strokeMiterLimit": { - "type": "number" - }, - "strokeDash": { - "type": "array", - "items": { - "type": "number" - } - }, - "strokeDashOffset": { - "type": "number", - "default": 0 - }, - "zindex": { - "type": "number" - }, - "cursor": { - "type": "string" - }, - "href": { - "type": "string", - "format": "uri-reference" - }, - "tooltip": {}, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "ariaRole": { - "type": "string" - }, - "ariaRoleDescription": { - "type": "string" - }, - "defined": { - "type": "boolean" - }, - "size": { - "type": "number", - "default": 1 - } - }, - "additionalProperties": false - } - } -} \ No newline at end of file diff --git a/node_modules/vega-scenegraph/build/vega-scenegraph.js b/node_modules/vega-scenegraph/build/vega-scenegraph.js deleted file mode 100644 index a1e5b84..0000000 --- a/node_modules/vega-scenegraph/build/vega-scenegraph.js +++ /dev/null @@ -1,5340 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('d3-shape'), require('d3-path'), require('vega-canvas'), require('vega-loader'), require('vega-scale')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'd3-shape', 'd3-path', 'vega-canvas', 'vega-loader', 'vega-scale'], factory) : - (global = global || self, factory(global.vega = {}, global.vega, global.d3, global.d3, global.vega, global.vega, global.vega)); -}(this, (function (exports, vegaUtil, d3Shape, d3Path, vegaCanvas, vegaLoader, vegaScale) { 'use strict'; - - var gradient_id = 0; - - function resetSVGGradientId() { - gradient_id = 0; - } - - const patternPrefix = 'p_'; - - function isGradient(value) { - return value && value.gradient; - } - - function gradientRef(g, defs, base) { - let id = g.id, - type = g.gradient, - prefix = type === 'radial' ? patternPrefix : ''; - - // check id, assign default values as needed - if (!id) { - id = g.id = 'gradient_' + (gradient_id++); - if (type === 'radial') { - g.x1 = get(g.x1, 0.5); - g.y1 = get(g.y1, 0.5); - g.r1 = get(g.r1, 0); - g.x2 = get(g.x2, 0.5); - g.y2 = get(g.y2, 0.5); - g.r2 = get(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get(g.x1, 0); - g.y1 = get(g.y1, 0); - g.x2 = get(g.x2, 1); - g.y2 = get(g.y2, 0); - } - } - - // register definition - defs[id] = g; - - // return url reference - return 'url(' + (base || '') + '#' + prefix + id + ')'; - } - - function get(val, def) { - return val != null ? val : def; - } - - function Gradient(p0, p1) { - var stops = [], gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function(offset, color) { - stops.push({offset: offset, color: color}); - return gradient; - } - }; - } - - var lookup = { - 'basis': { - curve: d3Shape.curveBasis - }, - 'basis-closed': { - curve: d3Shape.curveBasisClosed - }, - 'basis-open': { - curve: d3Shape.curveBasisOpen - }, - 'bundle': { - curve: d3Shape.curveBundle, - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: d3Shape.curveCardinal, - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: d3Shape.curveCardinalOpen, - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: d3Shape.curveCardinalClosed, - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: d3Shape.curveCatmullRom, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: d3Shape.curveCatmullRomClosed, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: d3Shape.curveCatmullRomOpen, - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: d3Shape.curveLinear - }, - 'linear-closed': { - curve: d3Shape.curveLinearClosed - }, - 'monotone': { - horizontal: d3Shape.curveMonotoneY, - vertical: d3Shape.curveMonotoneX - }, - 'natural': { - curve: d3Shape.curveNatural - }, - 'step': { - curve: d3Shape.curveStep - }, - 'step-after': { - curve: d3Shape.curveStepAfter - }, - 'step-before': { - curve: d3Shape.curveStepBefore - } - }; - - function curves(type, orientation, tension) { - var entry = vegaUtil.hasOwnProperty(lookup, type) && lookup[type], - curve = null; - - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - if (entry.tension && tension != null) { - curve = curve[entry.tension](tension); - } - } - - return curve; - } - - // Path parsing and rendering code adapted from fabric.js -- Thanks! - var cmdlen = { m:2, l:2, h:1, v:1, c:6, s:4, q:4, t:2, a:7 }, - regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\d)([-+])/g, /\s|,|###/]; - - function pathParse(pathstr) { - var result = [], - path, - curr, - chunks, - parsed, param, - cmd, len, i, j, n, m; - - // First, break path into command sequence - path = pathstr - .slice() - .replace(regexp[0], '###$1') - .split(regexp[1]) - .slice(1); - - // Next, parse each command in turn - for (i=0, n=path.length; i len) { - for (j=1, m=parsed.length; j 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - - var a00 = cos_th / rx; - var a01 = sin_th / rx; - var a10 = (-sin_th) / ry; - var a11 = (cos_th) / ry; - var x0 = a00 * ox + a01 * oy; - var y0 = a10 * ox + a11 * oy; - var x1 = a00 * x + a01 * y; - var y1 = a10 * x + a11 * y; - - var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0); - var sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - var sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0); - var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0); - - var th0 = Math.atan2(y0-yc, x0-xc); - var th1 = Math.atan2(y1-yc, x1-xc); - - var th_arc = th1-th0; - if (th_arc < 0 && sweep === 1) { - th_arc += Tau; - } else if (th_arc > 0 && sweep === 0) { - th_arc -= Tau; - } - - var segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - var result = []; - for (var i=0; i +_; - } - - function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); - } - - function vg_rect() { - var x = rectangleX, - y = rectangleY, - width = rectangleWidth, - height = rectangleHeight, - crTL = number(0), - crTR = crTL, - crBL = crTL, - crBR = crTL, - context = null; - - function rectangle(_, x0, y0) { - var buffer, - x1 = x0 != null ? x0 : +x.call(this, _), - y1 = y0 != null ? y0 : +y.call(this, _), - w = +width.call(this, _), - h = +height.call(this, _), - s = Math.min(w, h) / 2, - tl = clamp(+crTL.call(this, _), 0, s), - tr = clamp(+crTR.call(this, _), 0, s), - bl = clamp(+crBL.call(this, _), 0, s), - br = clamp(+crBR.call(this, _), 0, s); - - if (!context) context = buffer = d3Path.path(); - - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) { - context.rect(x1, y1, w, h); - } else { - var x2 = x1 + w, - y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - rectangle.x = function(_) { - if (arguments.length) { - x = number(_); - return rectangle; - } else { - return x; - } - }; - - rectangle.y = function(_) { - if (arguments.length) { - y = number(_); - return rectangle; - } else { - return y; - } - }; - - rectangle.width = function(_) { - if (arguments.length) { - width = number(_); - return rectangle; - } else { - return width; - } - }; - - rectangle.height = function(_) { - if (arguments.length) { - height = number(_); - return rectangle; - } else { - return height; - } - }; - - rectangle.cornerRadius = function(tl, tr, br, bl) { - if (arguments.length) { - crTL = number(tl); - crTR = tr != null ? number(tr) : crTL; - crBR = br != null ? number(br) : crTL; - crBL = bl != null ? number(bl) : crTR; - return rectangle; - } else { - return crTL; - } - }; - - rectangle.context = function(_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else { - return context; - } - }; - - return rectangle; - } - - function vg_trail() { - var x, - y, - size, - defined, - context = null, - ready, x1, y1, r1; - - function point(x2, y2, w2) { - var r2 = w2 / 2; - - if (ready) { - var ux = y1 - y2, - uy = x2 - x1; - - if (ux || uy) { - // get normal vector - var ud = Math.sqrt(ux * ux + uy * uy), - rx = (ux /= ud) * r1, - ry = (uy /= ud) * r1, - t = Math.atan2(uy, ux); - - // draw segment - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else { - context.arc(x2, y2, r2, 0, Tau); - } - context.closePath(); - } else { - ready = 1; - } - x1 = x2; - y1 = y2; - r1 = r2; - } - - function trail(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - - if (context == null) context = buffer = d3Path.path(); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - trail.x = function(_) { - if (arguments.length) { - x = _; - return trail; - } else { - return x; - } - }; - - trail.y = function(_) { - if (arguments.length) { - y = _; - return trail; - } else { - return y; - } - }; - - trail.size = function(_) { - if (arguments.length) { - size = _; - return trail; - } else { - return size; - } - }; - - trail.defined = function(_) { - if (arguments.length) { - defined = _; - return trail; - } else { - return defined; - } - }; - - trail.context = function(_) { - if (arguments.length) { - if (_ == null) { - context = null; - } else { - context = _; - } - return trail; - } else { - return context; - } - }; - - return trail; - } - - function value(a, b) { - return a != null ? a : b; - } - - const x = item => item.x || 0, - y = item => item.y || 0, - w = item => item.width || 0, - h = item => item.height || 0, - xw = item => (item.x || 0) + (item.width || 0), - yh = item => (item.y || 0) + (item.height || 0), - sa = item => item.startAngle || 0, - ea = item => item.endAngle || 0, - pa = item => item.padAngle || 0, - ir = item => item.innerRadius || 0, - or = item => item.outerRadius || 0, - cr = item => item.cornerRadius || 0, - tl = item => value(item.cornerRadiusTopLeft, item.cornerRadius) || 0, - tr = item => value(item.cornerRadiusTopRight, item.cornerRadius) || 0, - br = item => value(item.cornerRadiusBottomRight, item.cornerRadius) || 0, - bl = item => value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, - sz = item => value(item.size, 64), - ts = item => item.size || 1, - def = item => !(item.defined === false), - type = item => symbols(item.shape || 'circle'); - - const arcShape = d3Shape.arc().startAngle(sa).endAngle(ea).padAngle(pa) - .innerRadius(ir).outerRadius(or).cornerRadius(cr), - areavShape = d3Shape.area().x(x).y1(y).y0(yh).defined(def), - areahShape = d3Shape.area().y(y).x1(x).x0(xw).defined(def), - lineShape = d3Shape.line().x(x).y(y).defined(def), - rectShape = vg_rect().x(x).y(y).width(w).height(h) - .cornerRadius(tl, tr, br, bl), - symbolShape = d3Shape.symbol().type(type).size(sz), - trailShape = vg_trail().x(x).y(y).defined(def).size(ts); - - function hasCornerRadius(item) { - return item.cornerRadius - || item.cornerRadiusTopLeft - || item.cornerRadiusTopRight - || item.cornerRadiusBottomRight - || item.cornerRadiusBottomLeft; - } - - function arc(context, item) { - return arcShape.context(context)(item); - } - - function area(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape) - .curve(curves(interp, item.orient, item.tension)) - .context(context)(items); - } - - function line(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)) - .context(context)(items); - } - - function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); - } - - function shape(context, item) { - return (item.mark.shape || item.shape) - .context(context)(item); - } - - function symbol(context, item) { - return symbolShape.context(context)(item); - } - - function trail(context, items) { - return trailShape.context(context)(items); - } - - var clip_id = 1; - - function resetSVGClipId() { - clip_id = 1; - } - - function clip(renderer, item, size) { - var clip = item.clip, - defs = renderer._defs, - id = item.clip_id || (item.clip_id = 'clip' + clip_id++), - c = defs.clipping[id] || (defs.clipping[id] = {id: id}); - - if (vegaUtil.isFunction(clip)) { - c.path = clip(null); - } else if (hasCornerRadius(size)) { - c.path = rectangle(null, size, 0, 0); - } else { - c.width = size.width || 0; - c.height = size.height || 0; - } - - return 'url(#' + id + ')'; - } - - function Bounds(b) { - this.clear(); - if (b) this.union(b); - } - - var prototype = Bounds.prototype; - - prototype.clone = function() { - return new Bounds(this); - }; - - prototype.clear = function() { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; - }; - - prototype.empty = function() { - return ( - this.x1 === +Number.MAX_VALUE && - this.y1 === +Number.MAX_VALUE && - this.x2 === -Number.MAX_VALUE && - this.y2 === -Number.MAX_VALUE - ); - }; - - prototype.equals = function(b) { - return ( - this.x1 === b.x1 && - this.y1 === b.y1 && - this.x2 === b.x2 && - this.y2 === b.y2 - ); - }; - - prototype.set = function(x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; - } - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; - } - return this; - }; - - prototype.add = function(x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; - }; - - prototype.expand = function(d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; - }; - - prototype.round = function() { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; - }; - - prototype.scale = function(s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; - }; - - prototype.translate = function(dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; - }; - - prototype.rotate = function(angle, x, y) { - const p = this.rotatedPoints(angle, x, y); - return this.clear() - .add(p[0], p[1]) - .add(p[2], p[3]) - .add(p[4], p[5]) - .add(p[6], p[7]); - }; - - prototype.rotatedPoints = function(angle, x, y) { - var {x1, y1, x2, y2} = this, - cos = Math.cos(angle), - sin = Math.sin(angle), - cx = x - x*cos + y*sin, - cy = y - x*sin - y*cos; - - return [ - cos*x1 - sin*y1 + cx, sin*x1 + cos*y1 + cy, - cos*x1 - sin*y2 + cx, sin*x1 + cos*y2 + cy, - cos*x2 - sin*y1 + cx, sin*x2 + cos*y1 + cy, - cos*x2 - sin*y2 + cx, sin*x2 + cos*y2 + cy - ]; - }; - - prototype.union = function(b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; - }; - - prototype.intersect = function(b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; - }; - - prototype.encloses = function(b) { - return b && ( - this.x1 <= b.x1 && - this.x2 >= b.x2 && - this.y1 <= b.y1 && - this.y2 >= b.y2 - ); - }; - - prototype.alignsWith = function(b) { - return b && ( - this.x1 == b.x1 || - this.x2 == b.x2 || - this.y1 == b.y1 || - this.y2 == b.y2 - ); - }; - - prototype.intersects = function(b) { - return b && !( - this.x2 < b.x1 || - this.x1 > b.x2 || - this.y2 < b.y1 || - this.y1 > b.y2 - ); - }; - - prototype.contains = function(x, y) { - return !( - x < this.x1 || - x > this.x2 || - y < this.y1 || - y > this.y2 - ); - }; - - prototype.width = function() { - return this.x2 - this.x1; - }; - - prototype.height = function() { - return this.y2 - this.y1; - }; - - function Item(mark) { - this.mark = mark; - this.bounds = (this.bounds || new Bounds()); - } - - function GroupItem(mark) { - Item.call(this, mark); - this.items = (this.items || []); - } - - vegaUtil.inherits(GroupItem, Item); - - function ResourceLoader(customLoader) { - this._pending = 0; - this._loader = customLoader || vegaLoader.loader(); - } - - var prototype$1 = ResourceLoader.prototype; - - prototype$1.pending = function() { - return this._pending; - }; - - function increment(loader) { - loader._pending += 1; - } - - function decrement(loader) { - loader._pending -= 1; - } - - prototype$1.sanitizeURL = function(uri) { - var loader = this; - increment(loader); - - return loader._loader.sanitize(uri, {context:'href'}) - .then(function(opt) { - decrement(loader); - return opt; - }) - .catch(function() { - decrement(loader); - return null; - }); - }; - - prototype$1.loadImage = function(uri) { - const loader = this, - Image = vegaCanvas.image(); - increment(loader); - - return loader._loader - .sanitize(uri, {context: 'image'}) - .then(function(opt) { - const url = opt.href; - if (!url || !Image) throw {url: url}; - - const img = new Image(); - - // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - const cors = vegaUtil.hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; - - // attempt to load image resource - img.onload = () => decrement(loader); - img.onerror = () => decrement(loader); - img.src = url; - - return img; - }) - .catch(function(e) { - decrement(loader); - return {complete: false, width: 0, height: 0, src: e && e.url || ''}; - }); - }; - - prototype$1.ready = function() { - var loader = this; - return new Promise(function(accept) { - function poll(value) { - if (!loader.pending()) accept(value); - else setTimeout(function() { poll(true); }, 10); - } - poll(false); - }); - }; - - function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - const sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - return bounds; - } - - function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; - } - - var bounds, lx, ly, - circleThreshold = Tau - 1e-8; - - function context(_) { - bounds = _; - return context; - } - - function noop() {} - - function add(x, y) { bounds.add(x, y); } - - function addL(x, y) { add(lx = x, ly = y); } - - function addX(x) { add(x, bounds.y1); } - - function addY(y) { add(bounds.x1, y); } - - context.beginPath = noop; - - context.closePath = noop; - - context.moveTo = addL; - - context.lineTo = addL; - - context.rect = function(x, y, w, h) { - add(x + w, y + h); - addL(x, y); - }; - - context.quadraticCurveTo = function(x1, y1, x2, y2) { - quadExtrema(lx, x1, x2, addX); - quadExtrema(ly, y1, y2, addY); - addL(x2, y2); - }; - - function quadExtrema(x0, x1, x2, cb) { - const t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); - } - - context.bezierCurveTo = function(x1, y1, x2, y2, x3, y3) { - cubicExtrema(lx, x1, x2, x3, addX); - cubicExtrema(ly, y1, y2, y3, addY); - addL(x3, y3); - }; - - function cubicExtrema(x0, x1, x2, x3, cb) { - const a = x3 - x0 + 3 * x1 - 3 * x2, - b = x0 + x2 - 2 * x1, - c = x0 - x1; - - let t0 = 0, t1 = 0, r; - - // solve for parameter t - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else { - // linear equation - t0 = 0.5 * c / b; - } - - // calculate position - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); - } - - function cubic(t, x0, x1, x2, x3) { - const s = 1 - t, s2 = s * s, t2 = t * t; - return (s2 * s * x0) + (3 * s2 * t * x1) + (3 * s * t2 * x2) + (t2 * t * x3); - } - - context.arc = function(cx, cy, r, sa, ea, ccw) { - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add(cx - r, cy - r); - add(cx + r, cy + r); - } else { - const update = a => add(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - let s, i; - - // sample end points - update(sa); - update(ea); - - // sample interior points aligned with 90 degrees - if (ea !== sa) { - sa = sa % Tau; if (sa < 0) sa += Tau; - ea = ea % Tau; if (ea < 0) ea += Tau; - - if (ea < sa) { - ccw = !ccw; // flip direction - s = sa; sa = ea; ea = s; // swap end-points - } - - if (ccw) { - ea -= Tau; - s = sa - (sa % HalfPi); - for (i=0; i<4 && s>ea; ++i, s-=HalfPi) update(s); - } else { - s = sa - (sa % HalfPi) + HalfPi; - for (i=0; i<4 && s t1) return false; - else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false; - else if (r < t1) t1 = r; - } - } - - return true; - } - - function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; - } - - function value$1(value, dflt) { - return value == null ? dflt : value; - } - - function addStops(gradient, stops) { - const n = stops.length; - for (let i=0; i 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else { - return false; - } - } - - var Empty = []; - - function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - - if (lw <= 0) return false; - - opacity *= (item.strokeOpacity==null ? 1 : item.strokeOpacity); - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty); - context.lineDashOffset = item.strokeDashOffset || 0; - } - return true; - } else { - return false; - } - } - - function compare(a, b) { - return a.zindex - b.zindex || a.index - b.index; - } - - function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - - var items = scene.items, - output = [], item, i, n; - - for (i=0, n=items.length; i= 0;) { - if (hit = visitor(items[i])) return hit; - } - - if (items === zitems) { - for (items=scene.items, i=items.length; --i >= 0;) { - if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; - } - } - } - - return null; - } - - function drawAll(path) { - return function(context, scene, bounds) { - visit(scene, function(item) { - if (!bounds || bounds.intersects(item.bounds)) { - drawPath(path, context, item, item); - } - }); - }; - } - - function drawOne(path) { - return function(context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) { - drawPath(path, context, scene.items[0], scene.items); - } - }; - } - - function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - - if (path(context, items)) return; - - blend(context, item); - - if (item.fill && fill(context, item, opacity)) { - context.fill(); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.stroke(); - } - } - - function pick(test) { - test = test || vegaUtil.truthy; - - return function(context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - - return pickVisit(scene, function(item) { - var b = item.bounds; - // first hit test against bounding box - if ((b && !b.contains(gx, gy)) || !b) return; - // if in bounding box, perform more careful test - if (test(context, item, x, y, gx, gy)) return item; - }); - }; - } - - function hitPath(path, filled) { - return function(context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, - fill = (filled == null) ? item.fill : filled, - stroke = item.stroke && context.isPointInStroke, lw, lc; - - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - - return path(context, o) ? false : - (fill && context.isPointInPath(x, y)) || - (stroke && context.isPointInStroke(x, y)); - }; - } - - function pickPath(path) { - return pick(hitPath(path)); - } - - function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; - } - - function rotate(a) { - return 'rotate(' + a + ')'; - } - - function scale$1(scaleX, scaleY){ - return 'scale('+ scaleX + ',' + scaleY+')'; - } - - function translateItem(item) { - return translate(item.x || 0, item.y || 0); - } - - function transformItem(item) { - return translate(item.x || 0, item.y || 0) - + (item.angle ? ' ' + rotate(item.angle) : '') - + (item.scaleX || item.scaleY ? ' ' + scale$1(item.scaleX || 1, item.scaleY || 1) : ''); - } - - function markItemPath(type, shape, isect) { - - function attr(emit, item) { - emit('transform', transformItem(item)); - emit('d', shape(null, item)); - } - - function bound(bounds, item) { - var x = item.x || 0, - y = item.y || 0; - - shape(context(bounds), item); - boundStroke(bounds, item).translate(x, y); - if (item.angle) { - bounds.rotate(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw(context, item) { - var x = item.x || 0, - y = item.y || 0, - a = item.angle || 0; - - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); - } - - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; - - } - - var arc$1 = markItemPath('arc', arc); - - function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], - z = a[0].orient === 'horizontal' ? 'y' : 'x', - i = a.length, - min = +Infinity, hit, d; - - while (--i >= 0) { - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - if (d < min) { - min = d; - hit = a[i]; - } - } - - return hit; - } - - function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), - i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - - return null; - } - - function pickTrail(a, p) { - var i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx*dx) return a[i]; - } - - return null; - } - - function markMultiItemPath(type, shape, tip) { - - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - - function bound(bounds, mark) { - var items = mark.items; - if (items.length === 0) { - return bounds; - } else { - shape(context(bounds), items); - return boundStroke(bounds, items[0]); - } - } - - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - - var hit = hitPath(draw); - - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, - b = scene.bounds; - - if (!items || !items.length || b && !b.contains(gx, gy)) { - return null; - } - - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; - } - - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; - - } - - var area$1 = markMultiItemPath('area', area, pickArea); - - function clip$1(context, scene) { - var clip = scene.clip; - - context.save(); - - if (vegaUtil.isFunction(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else { - clipGroup(context, scene.group); - } - } - - function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) - ? rectangle(context, group, 0, 0) - : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); - } - - function offset(item) { - const sw = value$1(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset - : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) - : 0; - } - - function attr(emit, item) { - emit('transform', translateItem(item)); - } - - function emitRectangle(emit, item) { - const off = offset(item); - emit('d', rectangle(null, item, off, off)); - } - - function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); - } - - function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - if (item.strokeForeground) { - emitRectangle(emit, item); - } else { - emit('d', ''); - } - } - - function content(emit, item, renderer) { - const url = item.clip ? clip(renderer, item, item) : null; - emit('clip-path', url); - } - - function bound(bounds, group) { - if (!group.clip && group.items) { - const items = group.items, m = items.length; - for (let j=0; j { - const gx = group.x || 0, - gy = group.y || 0, - fore = group.strokeForeground, - opacity = group.opacity == null ? 1 : group.opacity; - - // draw group background - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (group.fill && fill(context, group, opacity)) { - context.fill(); - } - if (group.stroke && !fore && stroke(context, group, opacity)) { - context.stroke(); - } - } - - // setup graphics context, set clip and bounds - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); - - // draw group contents - visit(group, item => { - this.draw(context, item, bounds); - }); - - // restore graphics context - if (bounds) bounds.translate(gx, gy); - context.restore(); - - // draw group foreground - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (stroke(context, group, opacity)) { - context.stroke(); - } - } - }); - } - - function pick$1(context, scene, x, y, gx, gy) { - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { - return null; - } - - const cx = x * context.pixelRatio, - cy = y * context.pixelRatio; - - return pickVisit(scene, group => { - let hit, fore, ix, dx, dy, dw, dh, b, c; - - // first hit test bounding box - b = group.bounds; - if (b && !b.contains(gx, gy)) return; - - // passed bounds check, test rectangular clip - dx = group.x || 0; - dy = group.y || 0; - dw = dx + (group.width || 0); - dh = dy + (group.height || 0); - c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; - - // adjust coordinate system - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; - - // test background for rounded corner clip - if (c && hasCornerRadius(group) && !hitBackground(context, group, cx, cy)) { - context.restore(); - return null; - } - - fore = group.strokeForeground; - ix = scene.interactive !== false; - - // hit test against group foreground - if (ix && fore && group.stroke - && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } - - // hit test against contained marks - hit = pickVisit(group, mark => pickMark(mark, dx, dy) - ? this.pick(mark, x, y, dx, dy) - : null - ); - - // hit test against group background - if (!hit && ix && (group.fill || (!fore && group.stroke)) - && hitBackground(context, group, cx, cy)) { - hit = group; - } - - // restore state and return - context.restore(); - return hit || null; - }); - } - - function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') - && mark.bounds && mark.bounds.contains(x, y); - } - - var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1, - isect: intersectRect, - content: content, - background: background, - foreground: foreground - }; - - var metadata = { - 'version': '1.1', - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink' - }; - - function getImage(item, renderer) { - var image = item.image; - if (!image || item.url && item.url !== image.url) { - image = {complete: false, width: 0, height: 0}; - renderer.loadImage(item.url).then(image => { - item.image = image; - item.image.url = item.url; - }); - } - return image; - } - - function imageWidth(item, image) { - return item.width != null ? item.width - : !image || !image.width ? 0 - : item.aspect !== false && item.height ? item.height * image.width / image.height - : image.width; - } - - function imageHeight(item, image) { - return item.height != null ? item.height - : !image || !image.height ? 0 - : item.aspect !== false && item.width ? item.width * image.height / image.width - : image.height; - } - - function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; - } - - function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; - } - - function attr$1(emit, item, renderer) { - const img = getImage(item, renderer), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); - } - - function bound$1(bounds, item) { - const img = item.image, - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h); - - return bounds.set(x, y, x + w, y + h); - } - - function draw$1(context, scene, bounds) { - visit(scene, item => { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - let img = getImage(item, this), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - opacity, ar0, ar1, t; - - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); - } - - var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick(), - isect: vegaUtil.truthy, // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset - }; - - var line$1 = markMultiItemPath('line', line, pickLine); - - function attr$2(emit, item) { - var sx = item.scaleX || 1, - sy = item.scaleY || 1; - if (sx !== 1 || sy !== 1) { - emit('vector-effect', 'non-scaling-stroke'); - } - emit('transform', transformItem(item)); - emit('d', item.path); - } - - function path(context, item) { - var path = item.path; - if (path == null) return true; - - var x = item.x || 0, - y = item.y || 0, - sx = item.scaleX || 1, - sy = item.scaleY || 1, - a = (item.angle || 0) * DegToRad, - cache = item.pathCache; - - if (!cache || cache.path !== path) { - (item.pathCache = cache = pathParse(path)).path = path; - } - - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else { - pathRender(context, cache, x, y, sx, sy); - } - } - - function bound$2(bounds, item) { - path(context(bounds), item) - ? bounds.set(0, 0, 0, 0) - : boundStroke(bounds, item, true); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, item.x || 0, item.y || 0); - } - - return bounds; - } - - var path$1 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(path), - pick: pickPath(path), - isect: intersectPath(path) - }; - - function attr$3(emit, item) { - emit('d', rectangle(null, item)); - } - - function bound$3(bounds, item) { - var x, y; - return boundStroke(bounds.set( - x = item.x || 0, - y = item.y || 0, - (x + item.width) || 0, - (y + item.height) || 0 - ), item); - } - - function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); - } - - var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect - }; - - function attr$4(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); - } - - function bound$4(bounds, item) { - var x1, y1; - return boundStroke(bounds.set( - x1 = item.x || 0, - y1 = item.y || 0, - item.x2 != null ? item.x2 : x1, - item.y2 != null ? item.y2 : y1 - ), item); - } - - function path$2(context, item, opacity) { - var x1, y1, x2, y2; - - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - return false; - } - - function draw$3(context, scene, bounds) { - visit(scene, function(item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity && path$2(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); - } - - function hit(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path$2(context, item, 1) && context.isPointInStroke(x, y); - } - - var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick(hit), - isect: intersectRule - }; - - var shape$1 = markItemPath('shape', shape); - - var symbol$1 = markItemPath('symbol', symbol, intersectPoint); - - // memoize text width measurement - const widthCache = vegaUtil.lruCache(); - - var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas - }; - - useCanvas(true); - - function useCanvas(use) { - textMetrics.width = (use && context$1) ? measureWidth : estimateWidth; - } - - // make dumb, simple estimate if no canvas is available - function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); - } - - function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); - } - - // measure text width if canvas is available - function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 - : _measureWidth(text, font(item)); - } - - function _measureWidth(text, currentFont) { - const key = `(${currentFont}) ${text}`; - let width = widthCache.get(key); - if (width === undefined) { - context$1.font = currentFont; - width = context$1.measureText(text).width; - widthCache.set(key, width); - } - return width; - } - - function fontSize(item) { - return item.fontSize != null ? (+item.fontSize || 0) : 11; - } - - function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : (fontSize(item) + 2); - } - - function lineArray(_) { - return vegaUtil.isArray(_) ? _.length > 1 ? _ : _[0] : _; - } - - function textLines(item) { - return lineArray( - item.lineBreak && item.text && !vegaUtil.isArray(item.text) - ? item.text.split(item.lineBreak) - : item.text - ); - } - - function multiLineOffset(item) { - const tl = textLines(item); - return (vegaUtil.isArray(tl) ? (tl.length - 1) : 0) * lineHeight(item); - } - - function textValue(item, line) { - const text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate(item, text) : text; - } - - function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - const currentFont = font(item); - return text => _measureWidth(text, currentFont); - } else { - // we are relying on estimates - const currentFontHeight = fontSize(item); - return text => _estimateWidth(text, currentFontHeight); - } - } - - function truncate(item, text) { - var limit = +item.limit, - width = widthGetter(item); - - if (width(text) < limit) return text; - - var ellipsis = item.ellipsis || '\u2026', - rtl = item.dir === 'rtl', - lo = 0, - hi = text.length, mid; - - limit -= width(ellipsis); - - if (rtl) { - while (lo < hi) { - mid = (lo + hi >>> 1); - if (width(text.slice(mid)) > limit) lo = mid + 1; - else hi = mid; - } - return ellipsis + text.slice(lo); - } else { - while (lo < hi) { - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid; - else hi = mid - 1; - } - return text.slice(0, lo) + ellipsis; - } - } - - function fontFamily(item, quote) { - var font = item.font; - return (quote && font - ? String(font).replace(/"/g, '\'') - : font) || 'sans-serif'; - } - - function font(item, quote) { - return '' + - (item.fontStyle ? item.fontStyle + ' ' : '') + - (item.fontVariant ? item.fontVariant + ' ' : '') + - (item.fontWeight ? item.fontWeight + ' ' : '') + - fontSize(item) + 'px ' + - fontFamily(item, quote); - } - - function offset$1(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, - h = fontSize(item); - - return Math.round( - baseline === 'top' ? 0.79 * h : - baseline === 'middle' ? 0.30 * h : - baseline === 'bottom' ? -0.21 * h : - baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : - baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0 - ); - } - - var textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' - }; - - var tempBounds = new Bounds(); - - function anchorPoint(item) { - var x = item.x || 0, - y = item.y || 0, - r = item.radius || 0, t; - - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; - } - - function attr$5(emit, item) { - var dx = item.dx || 0, - dy = (item.dy || 0) + offset$1(item), - p = anchorPoint(item), - x = p.x1, - y = p.y1, - a = item.angle || 0, t; - - emit('text-anchor', textAlign[item.align] || 'start'); - - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else { - t = translate(x + dx, y + dy); - } - emit('transform', t); - } - - function bound$5(bounds, item, mode) { - var h = textMetrics.height(item), - a = item.align, - p = anchorPoint(item), - x = p.x1, - y = p.y1, - dx = item.dx || 0, - dy = (item.dy || 0) + offset$1(item) - Math.round(0.8*h), // use 4/5 offset - tl = textLines(item), - w; - - // get dimensions - if (vegaUtil.isArray(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce((w, t) => Math.max(w, textMetrics.width(item, t)), 0); - } else { - // single-line text - w = textMetrics.width(item, tl); - } - - // horizontal alignment - if (a === 'center') { - dx -= (w / 2); - } else if (a === 'right') { - dx -= w; - } - - bounds.set(dx+=x, dy+=y, dx+w, dy+h); - - if (item.angle && !mode) { - bounds.rotate(item.angle * DegToRad, x, y); - } else if (mode === 2) { - return bounds.rotatedPoints(item.angle * DegToRad, x, y); - } - return bounds; - } - - function draw$4(context, scene, bounds) { - visit(scene, function(item) { - var opacity = item.opacity == null ? 1 : item.opacity, - p, x, y, i, lh, tl, str; - - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || - item.text == null || item.text.length === 0) return; - - context.font = font(item); - context.textAlign = item.align || 'left'; - - p = anchorPoint(item); - x = p.x1, - y = p.y1; - - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - x += (item.dx || 0); - y += (item.dy || 0) + offset$1(item); - - tl = textLines(item); - blend(context, item); - if (vegaUtil.isArray(tl)) { - lh = lineHeight(item); - for (i=0; i index) el.removeChild(nodes[--curr]); - return el; - } - - // generate css class name for mark - function cssClass(mark) { - return 'mark-' + mark.marktype - + (mark.role ? ' role-' + mark.role : '') - + (mark.name ? ' ' + mark.name : ''); - } - - function point(event, el) { - var rect = el.getBoundingClientRect(); - return [ - event.clientX - rect.left - (el.clientLeft || 0), - event.clientY - rect.top - (el.clientTop || 0) - ]; - } - - function resolveItem(item, event, el, origin) { - var mark = item && item.mark, - mdef, p; - - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - while (item = item.mark.group) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - item = mdef.tip(mark.items, p); - } - - return item; - } - - /** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ - function Handler(customLoader, customTooltip) { - this._active = null; - this._handlers = {}; - this._loader = customLoader || vegaLoader.loader(); - this._tooltip = customTooltip || defaultTooltip; - } - - // The default tooltip display handler. - // Sets the HTML title attribute on the visualization container. - function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); - } - - const prototype$3 = Handler.prototype; - - /** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ - prototype$3.initialize = function(el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); - }; - - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - prototype$3.element = function() { - return this._el; - }; - - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - prototype$3.canvas = function() { - return this._el && this._el.firstChild; - }; - - /** - * Get / set the origin coordinates of the visualization. - */ - prototype$3.origin = function(origin) { - if (arguments.length) { - this._origin = origin || [0, 0]; - return this; - } else { - return this._origin.slice(); - } - }; - - /** - * Get / set the scenegraph root. - */ - prototype$3.scene = function(scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; - }; - - /** - * Add an event handler. Subclasses should override this method. - */ - prototype$3.on = function(/*type, handler*/) {}; - - /** - * Remove an event handler. Subclasses should override this method. - */ - prototype$3.off = function(/*type, handler*/) {}; - - /** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ - prototype$3._handlerIndex = function(h, type, handler) { - for (let i = h ? h.length : 0; --i>=0;) { - if (h[i].type === type && (!handler || h[i].handler === handler)) { - return i; - } - } - return -1; - }; - - /** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ - prototype$3.handlers = function(type) { - const h = this._handlers, a = []; - if (type) { - a.push.apply(a, h[this.eventName(type)]); - } else { - for (const k in h) { a.push.apply(a, h[k]); } - } - return a; - }; - - /** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ - prototype$3.eventName = function(name) { - const i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); - }; - - /** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ - prototype$3.handleHref = function(event, item, href) { - this._loader - .sanitize(href, {context:'href'}) - .then(opt => { - const e = new MouseEvent(event.type, event), - a = domCreate(null, 'a'); - for (const name in opt) a.setAttribute(name, opt[name]); - a.dispatchEvent(e); - }) - .catch(function() { /* do nothing */ }); - }; - - /** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ - prototype$3.handleTooltip = function(event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - const value = (show && item && item.tooltip) || null; - this._tooltip.call(this._obj, this, event, item, value); - } - }; - - /** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ - prototype$3.getItemBoundingClientRect = function(item) { - const el = this.canvas(); - if (!el) return; - - const rect = el.getBoundingClientRect(), - origin = this._origin, - bounds = item.bounds, - width = bounds.width(), - height = bounds.height(); - - let x = bounds.x1 + origin[0] + rect.left, - y = bounds.y1 + origin[1] + rect.top; - - // translate coordinate for each parent group - while (item.mark && (item = item.mark.group)) { - x += item.x || 0; - y += item.y || 0; - } - - // return DOMRect-compatible bounding box - return { - x, y, width, height, - left: x, top: y, right: x + width, bottom: y + height - }; - }; - - /** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ - function Renderer(loader) { - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); - } - - var prototype$4 = Renderer.prototype; - - /** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ - prototype$4.initialize = function(el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); - }; - - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - prototype$4.element = function() { - return this._el; - }; - - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - prototype$4.canvas = function() { - return this._el && this._el.firstChild; - }; - - /** - * Get / set the background color. - */ - prototype$4.background = function(bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; - }; - - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ - prototype$4.resize = function(width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [0, 0]; - this._scale = scaleFactor || 1; - return this; - }; - - /** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ - prototype$4.dirty = function(/*item*/) { - }; - - /** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Renderer} - This renderer instance. - */ - prototype$4.render = function(scene) { - var r = this; - - // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - r._call = function() { r._render(scene); }; - - // invoke the renderer - r._call(); - - // clear the cached call for garbage collection - // async redraws will stash their own copy - r._call = null; - - return r; - }; - - /** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - */ - prototype$4._render = function(/*scene*/) { - // subclasses to override - }; - - /** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Promise} - A Promise that resolves when rendering is complete. - */ - prototype$4.renderAsync = function(scene) { - var r = this.render(scene); - return this._ready - ? this._ready.then(function() { return r; }) - : Promise.resolve(r); - }; - - /** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ - prototype$4._load = function(method, uri) { - var r = this, - p = r._loader[method](uri); - - if (!r._ready) { - // re-render the scene when loading completes - var call = r._call; - r._ready = r._loader.ready() - .then(function(redraw) { - if (redraw) call(); - r._ready = null; - }); - } - - return p; - }; - - /** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ - prototype$4.sanitizeURL = function(uri) { - return this._load('sanitizeURL', uri); - }; - - /** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ - prototype$4.loadImage = function(uri) { - return this._load('loadImage', uri); - }; - - const KeyDownEvent = 'keydown'; - const KeyPressEvent = 'keypress'; - const KeyUpEvent = 'keyup'; - const DragEnterEvent = 'dragenter'; - const DragLeaveEvent = 'dragleave'; - const DragOverEvent = 'dragover'; - const MouseDownEvent = 'mousedown'; - const MouseUpEvent = 'mouseup'; - const MouseMoveEvent = 'mousemove'; - const MouseOutEvent = 'mouseout'; - const MouseOverEvent = 'mouseover'; - const ClickEvent = 'click'; - const DoubleClickEvent = 'dblclick'; - const WheelEvent = 'wheel'; - const MouseWheelEvent = 'mousewheel'; - const TouchStartEvent = 'touchstart'; - const TouchMoveEvent = 'touchmove'; - const TouchEndEvent = 'touchend'; - - const Events = [ - KeyDownEvent, - KeyPressEvent, - KeyUpEvent, - DragEnterEvent, - DragLeaveEvent, - DragOverEvent, - MouseDownEvent, - MouseUpEvent, - MouseMoveEvent, - MouseOutEvent, - MouseOverEvent, - ClickEvent, - DoubleClickEvent, - WheelEvent, - MouseWheelEvent, - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent - ]; - - const TooltipShowEvent = MouseMoveEvent; - - const TooltipHideEvent = MouseOutEvent; - - const HrefEvent = ClickEvent; - - function CanvasHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; - } - - const prototype$5 = vegaUtil.inherits(CanvasHandler, Handler); - - prototype$5.initialize = function(el, origin, obj) { - this._canvas = el && domFind(el, 'canvas'); - - // add minimal events required for proper state management - [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent] - .forEach(type => eventListenerCheck(this, type)); - - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - const eventBundle = type => ( - type === TouchStartEvent || - type === TouchMoveEvent || - type === TouchEndEvent - ) - ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] - : [type]; - - // lazily add listeners to the canvas as needed - function eventListenerCheck(handler, type) { - eventBundle(type).forEach(_ => addEventListener(handler, _)); - } - - function addEventListener(handler, type) { - const canvas = handler.canvas(); - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] - ? evt => handler[type](evt) - : evt => handler.fire(type, evt) - ); - } - } - - // return the backing canvas instance - prototype$5.canvas = function() { - return this._canvas; - }; - - // retrieve the current canvas context - prototype$5.context = function() { - return this._canvas.getContext('2d'); - }; - - // supported events - prototype$5.events = Events; - - function move(moveEvent, overEvent, outEvent) { - return function(evt) { - const a = this._active, - p = this.pickEvent(evt); - - if (p === a) { - // active item and picked item are the same - this.fire(moveEvent, evt); // fire move - } else { - // active item and picked item are different - if (!a || !a.exit) { - // fire out for prior active item - // suppress if active item was removed from scene - this.fire(outEvent, evt); - } - this._active = p; // set new active item - this.fire(overEvent, evt); // fire over for new active item - this.fire(moveEvent, evt); // fire move for new active item - } - }; - } - - function inactive(type) { - return function(evt) { - this.fire(type, evt); - this._active = null; - }; - } - - // to keep old versions of firefox happy - prototype$5.DOMMouseScroll = function(evt) { - this.fire(MouseWheelEvent, evt); - }; - - prototype$5.mousemove = move(MouseMoveEvent, MouseOverEvent, MouseOutEvent); - prototype$5.dragover = move(DragOverEvent, DragEnterEvent, DragLeaveEvent); - - prototype$5.mouseout = inactive(MouseOutEvent); - prototype$5.dragleave = inactive(DragLeaveEvent); - - prototype$5.mousedown = function(evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); - }; - - prototype$5.click = function(evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } - }; - - prototype$5.touchstart = function(evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - - if (this._first) { - this._active = this._touch; - this._first = false; - } - - this.fire(TouchStartEvent, evt, true); - }; - - prototype$5.touchmove = function(evt) { - this.fire(TouchMoveEvent, evt, true); - }; - - prototype$5.touchend = function(evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; - }; - - // fire an event - prototype$5.fire = function(type, evt, touch) { - const a = touch ? this._touch : this._active, - h = this._handlers[type]; - - // set event type relative to scenegraph items - evt.vegaType = type; - - // handle hyperlinks and tooltips first - if (type === HrefEvent && a && a.href) { - this.handleHref(evt, a, a.href); - } else if (type === TooltipShowEvent || type === TooltipHideEvent) { - this.handleTooltip(evt, a, type !== TooltipHideEvent); - } - - // invoke all registered handlers - if (h) { - for (let i=0, len=h.length; i= 0) { - h.splice(i, 1); - } - - return this; - }; - - prototype$5.pickEvent = function(evt) { - const p = point(evt, this._canvas), - o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); - }; - - // find the scenegraph item at the current mouse position - // x, y -- the absolute x, y mouse coordinates on the canvas element - // gx, gy -- the relative coordinates within the current group - prototype$5.pick = function(scene, x, y, gx, gy) { - const g = this.context(), - mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); - }; - - function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; - } - - var pixelRatio = devicePixelRatio(); - - function resize(canvas, width, height, origin, scaleFactor, opt) { - const inDOM = typeof HTMLElement !== 'undefined' - && canvas instanceof HTMLElement - && canvas.parentNode != null, - context = canvas.getContext('2d'), - ratio = inDOM ? pixelRatio : scaleFactor; - - canvas.width = width * ratio; - canvas.height = height * ratio; - - for (const key in opt) { - context[key] = opt[key]; - } - - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - } - - context.pixelRatio = ratio; - context.setTransform( - ratio, 0, 0, ratio, - ratio * origin[0], - ratio * origin[1] - ); - - return canvas; - } - - function CanvasRenderer(loader) { - Renderer.call(this, loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); - } - - const prototype$6 = vegaUtil.inherits(CanvasRenderer, Renderer), - base = Renderer.prototype; - - prototype$6.initialize = function(el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - - this._canvas = this._options.externalContext - ? null - : vegaCanvas.canvas(1, 1, this._options.type); // instantiate a small canvas - - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - this._canvas.setAttribute('class', 'marks'); - } - - // this method will invoke resize to size the canvas appropriately - return base.initialize.call(this, el, width, height, origin, scaleFactor); - }; - - prototype$6.resize = function(width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - - if (this._canvas) { - // configure canvas size and transform - resize(this._canvas, this._width, this._height, - this._origin, this._scale, this._options.context); - } else { - // external context needs to be scaled and positioned to origin - const ctx = this._options.externalContext; - if (!ctx) vegaUtil.error('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - - this._redraw = true; - return this; - }; - - prototype$6.canvas = function() { - return this._canvas; - }; - - prototype$6.context = function() { - return this._options.externalContext - || (this._canvas ? this._canvas.getContext('2d') : null); - }; - - prototype$6.dirty = function(item) { - let b = this._tempb.clear().union(item.bounds), - g = item.mark.group; - - while (g) { - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; - } - - this._dirty.union(b); - }; - - function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); - - // align to base pixel grid in case of non-integer scaling (#2425) - if (g.pixelRatio % 1) { - b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - } - - // to avoid artifacts translate if origin has fractional pixels - b.translate(-(origin[0] % 1), -(origin[1] % 1)); - - // set clip path - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - - return b; - } - - const viewBounds = (origin, width, height) => new Bounds() - .set(0, 0, width, height) - .translate(-origin[0], -origin[1]); - - prototype$6._render = function(scene) { - const g = this.context(), - o = this._origin, - w = this._width, - h = this._height, - db = this._dirty, - vb = viewBounds(o, w, h); - - // setup - g.save(); - const b = this._redraw || db.empty() - ? (this._redraw = false, vb.expand(1)) - : clipToBounds(g, vb.intersect(db), o); - - this.clear(-o[0], -o[1], w, h); - - // render - this.draw(g, scene, b); - - // takedown - g.restore(); - db.clear(); - - return this; - }; - - prototype$6.draw = function(ctx, scene, bounds) { - const mark = Marks[scene.marktype]; - if (scene.clip) clip$1(ctx, scene); - mark.draw.call(this, ctx, scene, bounds); - if (scene.clip) ctx.restore(); - }; - - prototype$6.clear = function(x, y, w, h) { - const opt = this._options, - g = this.context(); - - if (opt.type !== 'pdf' && !opt.externalContext) { - // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - } - - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } - }; - - function SVGHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - const h = this; - h._hrefHandler = listener(h, (evt, item) => { - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, (evt, item) => { - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); - }); - } - - const prototype$7 = vegaUtil.inherits(SVGHandler, Handler); - - prototype$7.initialize = function(el, origin, obj) { - let svg = this._svg; - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - this._svg = svg = el && domFind(el, 'svg'); - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - prototype$7.canvas = function() { - return this._svg; - }; - - // wrap an event listener for the SVG DOM - const listener = (context, handler) => evt => { - let item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; - - // add an event handler - prototype$7.on = function(type, handler) { - const name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - const x = { - type, - handler, - listener: listener(this, handler) - }; - - (h[name] || (h[name] = [])).push(x); - if (this._svg) { - this._svg.addEventListener(name, x.listener); - } - } - - return this; - }; - - // remove an event handler - prototype$7.off = function(type, handler) { - const name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - if (this._svg) { - this._svg.removeEventListener(name, h[i].listener); - } - h.splice(i, 1); - } - - return this; - }; - - const ARIA_HIDDEN = 'aria-hidden'; - const ARIA_LABEL = 'aria-label'; - const ARIA_ROLE = 'role'; - const ARIA_ROLEDESCRIPTION = 'aria-roledescription'; - const GRAPHICS_OBJECT = 'graphics-object'; - const GRAPHICS_SYMBOL = 'graphics-symbol'; - - const bundle = (role, roledesc, label) => ({ - [ARIA_ROLE]: role, - [ARIA_ROLEDESCRIPTION]: roledesc, - [ARIA_LABEL]: label || undefined - }); - - // these roles are covered by related roles - // we can ignore them, no need to generate attributes - const AriaIgnore = vegaUtil.toSet([ - 'axis-domain', - 'axis-grid', - 'axis-label', - 'axis-tick', - 'axis-title', - 'legend-band', - 'legend-entry', - 'legend-gradient', - 'legend-label', - 'legend-title', - 'legend-symbol', - 'title' - ]); - - // aria attribute generators for guide roles - const AriaGuides = { - 'axis': {desc: 'axis', caption: axisCaption}, - 'legend': {desc: 'legend', caption: legendCaption}, - 'title-text': { - desc: 'title', - caption: item => `Title text '${titleCaption(item)}'` - }, - 'title-subtitle': { - desc: 'subtitle', - caption: item => `Subtitle text '${titleCaption(item)}'` - } - }; - - // aria properties generated for mark item encoding channels - const AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL - }; - - function ariaItemAttributes(emit, item) { - const hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - - if (hide || item.description == null) { - for (const prop in AriaEncode) { - emit(AriaEncode[prop], undefined); - } - } else { - const type = item.mark.marktype; - emit( - ARIA_LABEL, - item.description - ); - emit( - ARIA_ROLE, - item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL) - ); - emit( - ARIA_ROLEDESCRIPTION, - item.ariaRoleDescription || `${type} mark` - ); - } - } - - function ariaMarkAttributes(mark) { - return mark.aria === false ? { [ARIA_HIDDEN]: true } - : AriaIgnore[mark.role] ? null - : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) - : ariaMark(mark); - } - - function ariaMark(mark) { - const type = mark.marktype; - const recurse = ( - type === 'group' || - type === 'text' || - mark.items.some(_ => _.description != null && _.aria !== false) - ); - return bundle( - recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, - `${type} mark container`, - mark.description - ); - } - - function ariaGuide(mark, opt) { - try { - const item = mark.items[0], - caption = opt.caption || (() => ''); - return bundle( - opt.role || GRAPHICS_SYMBOL, - opt.desc, - item.description || caption(item) - ); - } catch (err) { - return null; - } - } - - function titleCaption(item) { - return vegaUtil.array(item.text).join(' '); - } - - function axisCaption(item) { - const datum = item.datum, - orient = item.orient, - title = datum.title ? extractTitle(item) : null, - ctx = item.context, - scale = ctx.scales[datum.scale].value, - locale = ctx.dataflow.locale(), - type = scale.type, - xy = (orient === 'left' || orient === 'right') ? 'Y' : 'X'; - - return `${xy}-axis` - + (title ? ` titled '${title}'` : '') - + ` for a ${vegaScale.isDiscrete(type) ? 'discrete' : type} scale` - + ` with ${vegaScale.domainCaption(locale, scale, item)}`; - } - - function legendCaption(item) { - const datum = item.datum, - title = datum.title ? extractTitle(item) : null, - type = `${datum.type || ''} legend`.trim(), - scales = datum.scales, - props = Object.keys(scales), - ctx = item.context, - scale = ctx.scales[scales[props[0]]].value, - locale = ctx.dataflow.locale(); - - return capitalize(type) - + (title ? ` titled '${title}'` : '') - + ` for ${channelCaption(props)}` - + ` with ${vegaScale.domainCaption(locale, scale, item)}`; - } - - function extractTitle(item) { - try { - return vegaUtil.array(vegaUtil.peek(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } - } - - function channelCaption(props) { - props = props.map(p => p + (p === 'fill' || p === 'stroke' ? ' color' : '')); - return props.length < 2 ? props[0] - : props.slice(0, -1).join(', ') + ' and ' + vegaUtil.peek(props); - } - - function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; - } - - const attrText = val => (val + '') - .replace(/&/g, '&') - .replace(/"/g, '"'); - - /** - * Generate string for an opening xml tag. - * @param tag the name of the xml tag - * @param attr hash of attribute name-value pairs to include - * @param raw additional raw string to include in tag markup - */ - function openTag(tag, attr, raw) { - var s = '<' + tag, key, val; - if (attr) { - for (key in attr) { - val = attr[key]; - if (val != null) { - s += ' ' + key + '="' + attrText(val) + '"'; - } - } - } - if (raw) s += ' ' + raw; - return s + '>'; - } - - /** - * Generate string for closing xml tag. - * @param tag the name of the xml tag - */ - function closeTag(tag) { - return ''; - } - - const styles = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity', - blend: 'mix-blend-mode' - }; - - // ensure miter limit default is consistent with canvas (#2498) - const rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 - }; - - const RootIndex = 0, - ns = metadata.xmlns; - - function SVGRenderer(loader) { - Renderer.call(this, loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; - } - - var prototype$8 = vegaUtil.inherits(SVGRenderer, Renderer); - var base$1 = Renderer.prototype; - - prototype$8.initialize = function(el, width, height, padding) { - // create the svg definitions cache - this._defs = { - gradient: {}, - clipping: {} - }; - - if (el) { - this._svg = domChild(el, 0, 'svg', ns); - this._svg.setAttribute('class', 'marks'); - domClear(el, 1); - - // set the svg root group - this._root = domChild(this._svg, RootIndex, 'g', ns); - for (const attr in rootAttributes) { - this._root.setAttribute(attr, rootAttributes[attr]); - } - - // ensure no additional child elements - domClear(this._svg, RootIndex + 1); - } - - // set background color if defined - this.background(this._bgcolor); - - return base$1.initialize.call(this, el, width, height, padding); - }; - - prototype$8.background = function(bgcolor) { - if (arguments.length && this._svg) { - this._svg.style.setProperty('background-color', bgcolor); - } - return base$1.background.apply(this, arguments); - }; - - prototype$8.resize = function(width, height, origin, scaleFactor) { - base$1.resize.call(this, width, height, origin, scaleFactor); - - if (this._svg) { - this._svg.setAttribute('width', this._width * this._scale); - this._svg.setAttribute('height', this._height * this._scale); - this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height); - this._root.setAttribute('transform', 'translate(' + this._origin + ')'); - } - - this._dirty = []; - - return this; - }; - - prototype$8.canvas = function() { - return this._svg; - }; - - prototype$8.svg = function() { - if (!this._svg) return null; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - var bg = !this._bgcolor ? '' - : (openTag('rect', { - width: this._width, - height: this._height, - fill: this._bgcolor - }) + closeTag('rect')); - - return openTag('svg', attr) - + (this._defs.el ? this._defs.el.outerHTML : '') - + bg - + this._root.outerHTML - + closeTag('svg'); - }; - - - // -- Render entry point -- - - prototype$8._render = function(scene) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._resetDefs(); - this.draw(this._root, scene); - domClear(this._root, 1); - } - - this.updateDefs(); - - this._dirty = []; - ++this._dirtyID; - - return this; - }; - - // -- Manage SVG definitions ('defs') block -- - - prototype$8.updateDefs = function() { - const svg = this._svg, - defs = this._defs; - - let el = defs.el, - index = 0; - - for (const id in defs.gradient) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateGradient(el, defs.gradient[id], index); - } - - for (const id in defs.clipping) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateClipping(el, defs.clipping[id], index); - } - - // clean-up - if (el) { - index === 0 - ? (svg.removeChild(el), defs.el = null) - : domClear(el, index); - } - }; - - function updateGradient(el, grad, index) { - var i, n, stop; - - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - var pt = domChild(el, index++, 'pattern', ns); - pt.setAttribute('id', patternPrefix + grad.id); - pt.setAttribute('viewBox', '0,0,1,1'); - pt.setAttribute('width', '100%'); - pt.setAttribute('height', '100%'); - pt.setAttribute('preserveAspectRatio', 'xMidYMid slice'); - - pt = domChild(pt, 0, 'rect', ns); - pt.setAttribute('width', '1'); - pt.setAttribute('height', '1'); - pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')'); - - el = domChild(el, index++, 'radialGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('fx', grad.x1); - el.setAttribute('fy', grad.y1); - el.setAttribute('fr', grad.r1); - el.setAttribute('cx', grad.x2); - el.setAttribute('cy', grad.y2); - el.setAttribute( 'r', grad.r2); - } else { - el = domChild(el, index++, 'linearGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('x1', grad.x1); - el.setAttribute('x2', grad.x2); - el.setAttribute('y1', grad.y1); - el.setAttribute('y2', grad.y2); - } - - for (i=0, n=grad.stops.length; i { - const dirty = this.isDirty(item), - node = bind(item, parent, sibling, mdef.tag, svg); - - if (dirty) { - this._update(mdef, node, item); - if (isGroup) recurse(this, node, item); - } - - sibling = node; - ++i; - }; - - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } - - domClear(parent, i); - return parent; - }; - - // Recursively process group contents. - function recurse(renderer, el, group) { - el = el.lastChild.previousSibling; - let prev, idx = 0; - - visit(group, item => { - prev = renderer.draw(el, item, prev); - ++idx; - }); - - // remove any extraneous DOM elements - domClear(el, 1 + idx); - } - - // Bind a scenegraph item to an SVG DOM element. - // Create new SVG elements as needed. - function bind(item, el, sibling, tag, svg) { - let node = item._svg, doc; - - // create a new dom node if needed - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, ns); - item._svg = node; - - if (item.mark) { - node.__data__ = item; - node.__values__ = {fill: 'default'}; - - // if group, create background, content, and foreground elements - if (tag === 'g') { - const bg = domCreate(doc, 'path', ns); - node.appendChild(bg); - bg.__data__ = item; - - const cg = domCreate(doc, 'g', ns); - node.appendChild(cg); - cg.__data__ = item; - - const fg = domCreate(doc, 'path', ns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = {fill: 'default'}; - } - } - } - - // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { - el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - } - - return node; - } - - function siblingCheck(node, sibling) { - return node.parentNode - && node.parentNode.childNodes.length > 1 - && node.previousSibling != sibling; // treat null/undefined the same - } - - - // -- Set attributes & styles on SVG elements --- - - var element = null, // temp var for current SVG element - values = null; // temp var for current values hash - - // Extra configuration for certain mark types - var mark_extras = { - group: function(mdef, el, item) { - const fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - - values = el.__values__; // use parent's values hash - element = el.childNodes[1]; - mdef.content(emit, item, this); - - const bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - - const value = item.mark.interactive === false ? 'none' : null; - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - - if (item.strokeForeground && item.stroke) { - const fill = item.fill; - setAttribute(fg, 'display', null); - - // set style of background - this.style(bg, item); - setAttribute(bg, 'stroke', null); - - // set style of foreground - if (fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (fill) item.fill = fill; - - // leave element null to prevent downstream styling - element = null; - } else { - // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - } - }, - image: function(mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else { - setStyle(el, 'image-rendering', null); - } - }, - text: function(mdef, el, item) { - let tl = textLines(item), - key, value, doc, lh; - - if (vegaUtil.isArray(tl)) { - // multi-line text - value = tl.map(_ => textValue(item, _)); - key = value.join('\n'); // content cache key - - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach((t, i) => { - const ts = domCreate(doc, 'tspan', ns); - ts.__data__ = item; // data binding - ts.textContent = t; - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } - }; - - function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) { - el.style.removeProperty(name); - } else { - el.style.setProperty(name, value + ''); - } - values[name] = value; - } - } - - prototype$8._update = function(mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; - - // apply aria-specific properties - ariaItemAttributes(emit, item); - - // apply svg attributes - mdef.attr(emit, item, this); - - // some marks need special treatment - const extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); - - // apply svg style attributes - // note: element may be modified by 'extra' method - if (element) this.style(element, item); - }; - - function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; - - // use appropriate method given namespace (ns) - if (ns) { - setAttributeNS(element, name, value, ns); - } else { - setAttribute(element, name, value); - } - - // note current value for future comparison - values[name] = value; - } - - function setAttribute(el, name, value) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttribute(name, value); - } else { - // else remove DOM attribute - el.removeAttribute(name); - } - } - - function setAttributeNS(el, name, value, ns) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - } else { - // else remove DOM attribute - el.removeAttributeNS(ns, name); - } - } - - prototype$8.style = function(el, o) { - if (o == null) return; - - for (const prop in styles) { - let value = prop === 'font' ? fontFamily(o) : o[prop]; - if (value === values[prop]) continue; - - const name = styles[prop]; - if (value == null) { - el.removeAttribute(name); - } else { - if (isGradient(value)) { - value = gradientRef(value, this._defs.gradient, href()); - } - el.setAttribute(name, value + ''); - } - - values[prop] = value; - } - }; - - function href() { - let loc; - return typeof window === 'undefined' ? '' - : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) - : loc.href; - } - - function SVGStringRenderer(loader) { - Renderer.call(this, loader); - - this._text = { - head: '', - bg: '', - root: '', - foot: '', - defs: '', - body: '' - }; - - this._defs = { - gradient: {}, - clipping: {} - }; - } - - var prototype$9 = vegaUtil.inherits(SVGStringRenderer, Renderer); - var base$2 = Renderer.prototype; - - prototype$9.resize = function(width, height, origin, scaleFactor) { - base$2.resize.call(this, width, height, origin, scaleFactor); - var o = this._origin, - t = this._text; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - t.head = openTag('svg', attr); - - var bg = this._bgcolor; - if (bg === 'transparent' || bg === 'none') bg = null; - - if (bg) { - t.bg = openTag('rect', { - width: this._width, - height: this._height, - fill: bg - }) + closeTag('rect'); - } else { - t.bg = ''; - } - - t.root = openTag('g', vegaUtil.extend( - {}, rootAttributes, {transform: 'translate(' + o + ')'} - )); - - t.foot = closeTag('g') + closeTag('svg'); - - return this; - }; - - prototype$9.background = function() { - var rv = base$2.background.apply(this, arguments); - if (arguments.length && this._text.head) { - this.resize(this._width, this._height, this._origin, this._scale); - } - return rv; - }; - - prototype$9.svg = function() { - var t = this._text; - return t.head + t.defs + t.bg + t.root + t.body + t.foot; - }; - - prototype$9._render = function(scene) { - this._text.body = this.mark(scene); - this._text.defs = this.buildDefs(); - return this; - }; - - prototype$9.buildDefs = function() { - let defs = '', tag; - - for (const id in this._defs.gradient) { - const def = this._defs.gradient[id], - stops = def.stops; - - if (def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - - defs += openTag(tag = 'pattern', { - id: patternPrefix + id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - - defs += openTag('rect', { - width: '1', - height: '1', - fill: 'url(#' + id + ')' - }) + closeTag('rect'); - - defs += closeTag(tag); - - defs += openTag(tag = 'radialGradient', { - id: id, - fx: def.x1, - fy: def.y1, - fr: def.r1, - cx: def.x2, - cy: def.y2, - r: def.r2 - }); - } else { - defs += openTag(tag = 'linearGradient', { - id: id, - x1: def.x1, - x2: def.x2, - y1: def.y1, - y2: def.y2 - }); - } - - for (let i = 0; i < stops.length; ++i) { - defs += openTag('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }) + closeTag('stop'); - } - - defs += closeTag(tag); - } - - for (const id in this._defs.clipping) { - const def = this._defs.clipping[id]; - - defs += openTag('clipPath', {id: id}); - - if (def.path) { - defs += openTag('path', { - d: def.path - }) + closeTag('path'); - } else { - defs += openTag('rect', { - x: 0, - y: 0, - width: def.width, - height: def.height - }) + closeTag('rect'); - } - - defs += closeTag('clipPath'); - } - - return defs ? (openTag('defs') + defs + closeTag('defs')) : ''; - }; - - prototype$9.attr = function(scene, item, attrs, tag) { - const object = {}, - emit = (name, value, ns, prefixed) => { - object[prefixed || name] = value; - }; - - // apply mark specific attributes - if (Array.isArray(attrs)) { - attrs.forEach(fn => fn(emit, item, this)); - } else { - attrs(emit, item, this); - } - - // apply style attributes - if (tag) { - applyStyles(object, item, scene, tag, this._defs); - } - - return object; - }; - - prototype$9.href = function(item) { - var that = this, - href = item.href, - attr; - - if (href) { - if (attr = that._hrefs && that._hrefs[href]) { - return attr; - } else { - that.sanitizeURL(href).then(attr => { - // rewrite to use xlink namespace - // note that this will be deprecated in SVG 2.0 - attr['xlink:href'] = attr.href; - attr.href = null; - (that._hrefs || (that._hrefs = {}))[href] = attr; - }); - } - } - return null; - }; - - prototype$9.mark = function(scene) { - const mdef = Marks[scene.marktype], - tag = mdef.tag, - attrList = [ariaItemAttributes, mdef.attr]; - - let str = ''; - - // render opening group tag - str += openTag('g', vegaUtil.extend( - { - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip(this, scene, scene.group) : null - }, - ariaMarkAttributes(scene), - { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - } - )); - - // render contained elements - const process = item => { - const href = this.href(item); - if (href) str += openTag('a', href); - - str += openTag( - tag, - this.attr(scene, item, attrList, tag !== 'g' ? tag : null) - ); - - if (tag === 'text') { - const tl = textLines(item); - if (vegaUtil.isArray(tl)) { - // multi-line text - const attrs = {x: 0, dy: lineHeight(item)}; - for (let i=0; i { str += this.mark(item); }); - return str; - }; - - function applyStyles(s, item, scene, tag, defs) { - if (item == null) return s; - - if (tag === 'bgrect' && scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - if (tag === 'bgfore') { - if (scene.interactive === false) { - s['pointer-events'] = 'none'; - } - s.display = 'none'; - if (item.fill !== null) return s; - } - - if (tag === 'image' && item.smooth === false) { - s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;'; - } - - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - if (item.fontStyle) s['font-style'] = item.fontStyle; - if (item.fontVariant) s['font-variant'] = item.fontVariant; - if (item.fontWeight) s['font-weight'] = item.fontWeight; - } - - for (const prop in styles) { - let value = item[prop]; - const name = styles[prop]; - - if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; else if (value != null) { - if (isGradient(value)) { - value = gradientRef(value, defs.gradient, ''); - } - s[name] = value; - } - } - - return s; - } - - function escape_text(s) { - return s.replace(/&/g, '&') - .replace(//g, '>'); - } - - var Canvas = 'canvas'; - var PNG = 'png'; - var SVG = 'svg'; - var None = 'none'; - - var RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - None: None - }; - - var modules = {}; - - modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler - }; - - modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler - }; - - modules[None] = {}; - - function renderModule(name, _) { - name = String(name || '').toLowerCase(); - if (arguments.length > 1) { - modules[name] = _; - return this; - } else { - return modules[name]; - } - } - - function intersect(scene, bounds, filter) { - const hits = [], // intersection results - box = new Bounds().union(bounds), // defensive copy - type = scene.marktype; - - return type ? intersectMark(scene, box, filter, hits) - : type === 'group' ? intersectGroup(scene, box, filter, hits) - : vegaUtil.error('Intersect scene must be mark node or group item.'); - } - - function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - const items = mark.items, - type = mark.marktype, - n = items.length; - - let i = 0; - - if (type === 'group') { - for (; i= 0; i--) { - if (ka[i] != kb[i]) return false; - } - - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; - } - - return typeof a === typeof b; - } - - function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); - } - - exports.Bounds = Bounds; - exports.CanvasHandler = CanvasHandler; - exports.CanvasRenderer = CanvasRenderer; - exports.Gradient = Gradient; - exports.GroupItem = GroupItem; - exports.Handler = Handler; - exports.Item = Item; - exports.Marks = Marks; - exports.RenderType = RenderType; - exports.Renderer = Renderer; - exports.ResourceLoader = ResourceLoader; - exports.SVGHandler = SVGHandler; - exports.SVGRenderer = SVGRenderer; - exports.SVGStringRenderer = SVGStringRenderer; - exports.Scenegraph = Scenegraph; - exports.boundClip = boundClip; - exports.boundContext = context; - exports.boundItem = boundItem; - exports.boundMark = boundMark; - exports.boundStroke = boundStroke; - exports.closeTag = closeTag; - exports.domChild = domChild; - exports.domClear = domClear; - exports.domCreate = domCreate; - exports.domFind = domFind; - exports.font = font; - exports.fontFamily = fontFamily; - exports.fontSize = fontSize; - exports.intersect = intersect; - exports.intersectBoxLine = intersectBoxLine; - exports.intersectPath = intersectPath; - exports.intersectPoint = intersectPoint; - exports.intersectRule = intersectRule; - exports.lineHeight = lineHeight; - exports.multiLineOffset = multiLineOffset; - exports.openTag = openTag; - exports.pathCurves = curves; - exports.pathEqual = pathEqual; - exports.pathParse = pathParse; - exports.pathRectangle = vg_rect; - exports.pathRender = pathRender; - exports.pathSymbols = symbols; - exports.pathTrail = vg_trail; - exports.point = point; - exports.renderModule = renderModule; - exports.resetSVGClipId = resetSVGClipId; - exports.resetSVGDefIds = resetSVGDefIds; - exports.sceneEqual = sceneEqual; - exports.sceneFromJSON = sceneFromJSON; - exports.scenePickVisit = pickVisit; - exports.sceneToJSON = sceneToJSON; - exports.sceneVisit = visit; - exports.sceneZOrder = zorder; - exports.textMetrics = textMetrics; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-scenegraph/build/vega-scenegraph.min.js b/node_modules/vega-scenegraph/build/vega-scenegraph.min.js deleted file mode 100644 index c6f79aa..0000000 --- a/node_modules/vega-scenegraph/build/vega-scenegraph.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util"),require("d3-shape"),require("d3-path"),require("vega-canvas"),require("vega-loader"),require("vega-scale")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-shape","d3-path","vega-canvas","vega-loader","vega-scale"],e):e((t=t||self).vega={},t.vega,t.d3,t.d3,t.vega,t.vega,t.vega)}(this,(function(t,e,n,i,r,o,s){"use strict";var a=0;function l(t){return t&&t.gradient}function u(t,e,n){let i=t.id,r=t.gradient,o="radial"===r?"p_":"";return i||(i=t.id="gradient_"+a++,"radial"===r?(t.x1=c(t.x1,.5),t.y1=c(t.y1,.5),t.r1=c(t.r1,0),t.x2=c(t.x2,.5),t.y2=c(t.y2,.5),t.r2=c(t.r2,.5),o="p_"):(t.x1=c(t.x1,0),t.y1=c(t.y1,0),t.x2=c(t.x2,1),t.y2=c(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function c(t,e){return null!=t?t:e}var h={basis:{curve:n.curveBasis},"basis-closed":{curve:n.curveBasisClosed},"basis-open":{curve:n.curveBasisOpen},bundle:{curve:n.curveBundle,tension:"beta",value:.85},cardinal:{curve:n.curveCardinal,tension:"tension",value:0},"cardinal-open":{curve:n.curveCardinalOpen,tension:"tension",value:0},"cardinal-closed":{curve:n.curveCardinalClosed,tension:"tension",value:0},"catmull-rom":{curve:n.curveCatmullRom,tension:"alpha",value:.5},"catmull-rom-closed":{curve:n.curveCatmullRomClosed,tension:"alpha",value:.5},"catmull-rom-open":{curve:n.curveCatmullRomOpen,tension:"alpha",value:.5},linear:{curve:n.curveLinear},"linear-closed":{curve:n.curveLinearClosed},monotone:{horizontal:n.curveMonotoneY,vertical:n.curveMonotoneX},natural:{curve:n.curveNatural},step:{curve:n.curveStep},"step-after":{curve:n.curveStepAfter},"step-before":{curve:n.curveStepBefore}};function f(t,n,i){var r=e.hasOwnProperty(h,t)&&h[t],o=null;return r&&(o=r.curve||r[n||"vertical"],r.tension&&null!=i&&(o=o[r.tension](i))),o}var d={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},g=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function p(t){var e,n,i,r,o,s,a,l,u,c,h,f=[];for(l=0,c=(e=t.slice().replace(g[0],"###$1").split(g[1]).slice(1)).length;la)for(u=1,h=r.length;u1&&(n*=p=Math.sqrt(p),i*=p);var m=f/n,b=h/n,w=-h/i,T=f/i,A=m*a+b*l,M=w*a+T*l,C=m*t+b*e,R=w*t+T*e,z=(C-A)*(C-A)+(R-M)*(R-M),P=1/z-.25;P<0&&(P=0);var S=Math.sqrt(P);o==r&&(S=-S);var L=.5*(A+C)-S*(R-M),O=.5*(M+R)+S*(C-A),N=Math.atan2(M-O,A-L),q=Math.atan2(R-O,C-L),D=q-N;D<0&&1===o?D+=_:D>0&&0===o&&(D-=_);for(var E=Math.ceil(Math.abs(D/(y+.001))),I=[],B=0;B+t}function I(t,e,n){return Math.max(e,Math.min(t,n))}function B(){var t=O,e=N,n=q,r=D,o=E(0),s=o,a=o,l=o,u=null;function c(c,h,f){var d,g=null!=h?h:+t.call(this,c),p=null!=f?f:+e.call(this,c),v=+n.call(this,c),y=+r.call(this,c),_=Math.min(v,y)/2,m=I(+o.call(this,c),0,_),x=I(+s.call(this,c),0,_),b=I(+a.call(this,c),0,_),k=I(+l.call(this,c),0,_);if(u||(u=d=i.path()),m<=0&&x<=0&&b<=0&&k<=0)u.rect(g,p,v,y);else{var w=g+v,T=p+y;u.moveTo(g+m,p),u.lineTo(w-x,p),u.bezierCurveTo(w-L*x,p,w,p+L*x,w,p+x),u.lineTo(w,T-k),u.bezierCurveTo(w,T-L*k,w-L*k,T,w-k,T),u.lineTo(g+b,T),u.bezierCurveTo(g+L*b,T,g,T-L*b,g,T-b),u.lineTo(g,p+m),u.bezierCurveTo(g,p+L*m,g+L*m,p,g+m,p),u.closePath()}if(d)return u=null,d+""||null}return c.x=function(e){return arguments.length?(t=E(e),c):t},c.y=function(t){return arguments.length?(e=E(t),c):e},c.width=function(t){return arguments.length?(n=E(t),c):n},c.height=function(t){return arguments.length?(r=E(t),c):r},c.cornerRadius=function(t,e,n,i){return arguments.length?(o=E(t),s=null!=e?E(e):o,l=null!=n?E(n):o,a=null!=i?E(i):s,c):o},c.context=function(t){return arguments.length?(u=null==t?null:t,c):u},c}function V(){var t,e,n,r,o,s,a,l,u=null;function c(t,e,n){var i=n/2;if(o){var r=a-e,c=t-s;if(r||c){var h=Math.sqrt(r*r+c*c),f=(r/=h)*l,d=(c/=h)*l,g=Math.atan2(c,r);u.moveTo(s-f,a-d),u.lineTo(t-r*i,e-c*i),u.arc(t,e,i,g-Math.PI,g),u.lineTo(s+f,a+d),u.arc(s,a,l,g,g+Math.PI)}else u.arc(t,e,i,0,_);u.closePath()}else o=1;s=t,a=e,l=i}function h(s){var a,l,h,f=s.length,d=!1;for(null==u&&(u=h=i.path()),a=0;a<=f;++a)!(at.x||0,j=t=>t.y||0,W=t=>!(!1===t.defined),U=n.arc().startAngle(t=>t.startAngle||0).endAngle(t=>t.endAngle||0).padAngle(t=>t.padAngle||0).innerRadius(t=>t.innerRadius||0).outerRadius(t=>t.outerRadius||0).cornerRadius(t=>t.cornerRadius||0),X=n.area().x(G).y1(j).y0(t=>(t.y||0)+(t.height||0)).defined(W),F=n.area().y(j).x1(G).x0(t=>(t.x||0)+(t.width||0)).defined(W),Y=n.line().x(G).y(j).defined(W),J=B().x(G).y(j).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>H(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>H(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>H(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>H(t.cornerRadiusBottomLeft,t.cornerRadius)||0),$=n.symbol().type(t=>P(t.shape||"circle")).size(t=>H(t.size,64)),Q=V().x(G).y(j).defined(W).size(t=>t.size||1);function Z(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function K(t,e,n,i){return J.context(t)(e,n,i)}var tt=1;function et(){tt=1}function nt(t,n,i){var r=n.clip,o=t._defs,s=n.clip_id||(n.clip_id="clip"+tt++),a=o.clipping[s]||(o.clipping[s]={id:s});return e.isFunction(r)?a.path=r(null):Z(i)?a.path=K(null,i,0,0):(a.width=i.width||0,a.height=i.height||0),"url(#"+s+")"}function it(t){this.clear(),t&&this.union(t)}var rt=it.prototype;function ot(t){this.mark=t,this.bounds=this.bounds||new it}function st(t){ot.call(this,t),this.items=this.items||[]}function at(t){this._pending=0,this._loader=t||o.loader()}rt.clone=function(){return new it(this)},rt.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},rt.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},rt.equals=function(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},rt.set=function(t,e,n,i){return nthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},rt.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},rt.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},rt.scale=function(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},rt.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},rt.rotate=function(t,e,n){const i=this.rotatedPoints(t,e,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rt.rotatedPoints=function(t,e,n){var{x1:i,y1:r,x2:o,y2:s}=this,a=Math.cos(t),l=Math.sin(t),u=e-e*a+n*l,c=n-e*l-n*a;return[a*i-l*r+u,l*i+a*r+c,a*i-l*s+u,l*i+a*s+c,a*o-l*r+u,l*o+a*r+c,a*o-l*s+u,l*o+a*s+c]},rt.union=function(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},rt.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},rt.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},rt.intersects=function(t){return t&&!(this.x2t.x2||this.y2t.y2)},rt.contains=function(t,e){return!(tthis.x2||ethis.y2)},rt.width=function(){return this.x2-this.x1},rt.height=function(){return this.y2-this.y1},e.inherits(st,ot);var lt=at.prototype;function ut(t){t._pending+=1}function ct(t){t._pending-=1}function ht(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const i=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(i+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,i):0))}return t}lt.pending=function(){return this._pending},lt.sanitizeURL=function(t){var e=this;return ut(e),e._loader.sanitize(t,{context:"href"}).then((function(t){return ct(e),t})).catch((function(){return ct(e),null}))},lt.loadImage=function(t){const n=this,i=r.image();return ut(n),n._loader.sanitize(t,{context:"image"}).then((function(t){const r=t.href;if(!r||!i)throw{url:r};const o=new i,s=e.hasOwnProperty(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=s&&(o.crossOrigin=s),o.onload=()=>ct(n),o.onerror=()=>ct(n),o.src=r,o})).catch((function(t){return ct(n),{complete:!1,width:0,height:0,src:t&&t.url||""}}))},lt.ready=function(){var t=this;return new Promise((function(e){!function n(i){t.pending()?setTimeout((function(){n(!0)}),10):e(i)}(!1)}))};var ft,dt,gt,pt=_-1e-8;function vt(t){return ft=t,vt}function yt(){}function _t(t,e){ft.add(t,e)}function mt(t,e){_t(dt=t,gt=e)}function xt(t){_t(t,ft.y1)}function bt(t){_t(ft.x1,t)}function kt(t,e,n,i){const r=(t-e)/(t+n-2*e);01e-14?(l=s*s+a*o,l>=0&&(l=Math.sqrt(l),u=(-s+l)/o,c=(-s-l)/o)):u=.5*a/s,0pt)_t(t-n,e-n),_t(t+n,e+n);else{const s=i=>_t(n*Math.cos(i)+t,n*Math.sin(i)+e);let a,l;if(s(i),s(r),r!==i)if((i%=_)<0&&(i+=_),(r%=_)<0&&(r+=_),rr;++l,a-=y)s(a);else for(a=i-i%y+y,l=0;l<4&&av)return!1;d>p&&(p=d)}else if(h>0){if(d0&&(t.globalAlpha=n,t.fillStyle=qt(t,e,e.fill),!0)}var Et=[];function It(t,e,n){var i=null!=(i=e.strokeWidth)?i:1;return!(i<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=qt(t,e,e.stroke),t.lineWidth=i,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||Et),t.lineDashOffset=e.strokeDashOffset||0),!0))}function Bt(t,e){return t.zindex-e.zindex||t.index-e.index}function Vt(t){if(!t.zdirty)return t.zitems;var e,n,i,r=t.items,o=[];for(n=0,i=r.length;n=0;)if(n=e(r[i]))return n;if(r===o)for(i=(r=t.items).length;--i>=0;)if(!r[i].zindex&&(n=e(r[i])))return n;return null}function jt(t){return function(e,n,i){Ht(n,(function(n){i&&!i.intersects(n.bounds)||Ut(t,e,n,n)}))}}function Wt(t){return function(e,n,i){!n.items.length||i&&!i.intersects(n.bounds)||Ut(t,e,n.items[0],n.items)}}function Ut(t,e,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(t(e,i)||(Lt(e,n),n.fill&&Dt(e,n,r)&&e.fill(),n.stroke&&It(e,n,r)&&e.stroke()))}function Xt(t){return t=t||e.truthy,function(e,n,i,r,o,s){return i*=e.pixelRatio,r*=e.pixelRatio,Gt(n,(function(n){var a=n.bounds;if((!a||a.contains(o,s))&&a)return t(e,n,i,r,o,s)?n:void 0}))}}function Ft(t,e){return function(n,i,r,o){var s,a,l=Array.isArray(i)?i[0]:i,u=null==e?l.fill:e,c=l.stroke&&n.isPointInStroke;return c&&(s=l.strokeWidth,a=l.strokeCap,n.lineWidth=null!=s?s:1,n.lineCap=null!=a?a:"butt"),!t(n,i)&&(u&&n.isPointInPath(r,o)||c&&n.isPointInStroke(r,o))}}function Yt(t){return Xt(Ft(t))}function Jt(t,e){return"translate("+t+","+e+")"}function $t(t){return"rotate("+t+")"}function Qt(t){return Jt(t.x||0,t.y||0)}function Zt(t){return Jt(t.x||0,t.y||0)+(t.angle?" "+$t(t.angle):"")+(t.scaleX||t.scaleY?" "+(e=t.scaleX||1,n=t.scaleY||1,"scale("+e+","+n+")"):"");var e,n}function Kt(t,e,n){function i(t,n){var i=n.x||0,r=n.y||0,o=n.angle||0;t.translate(i,r),o&&t.rotate(o*=v),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-i,-r)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",Zt(n)),t("d",e(null,n))},bound:function(t,n){var i=n.x||0,r=n.y||0;return e(vt(t),n),ht(t,n).translate(i,r),n.angle&&t.rotate(n.angle*v,i,r),t},draw:jt(i),pick:Yt(i),isect:n||Ct(i)}}var te=Kt("arc",(function(t,e){return U.context(t)(e)}));function ee(t,e,n){function i(t,n){t.beginPath(),e(t,n)}var r=Ft(i);return{type:t,tag:"path",nested:!0,attr:function(t,n){var i=n.mark.items;i.length&&t("d",e(null,i))},bound:function(t,n){var i=n.items;return 0===i.length?t:(e(vt(t),i),ht(t,i[0]))},draw:Wt(i),pick:function(t,e,n,i,o,s){var a=e.items,l=e.bounds;return!a||!a.length||l&&!l.contains(o,s)?null:(n*=t.pixelRatio,i*=t.pixelRatio,r(t,a,n,i)?a[0]:null)},isect:Rt,tip:n}}var ne=ee("area",(function(t,e){var n=e[0],i=n.interpolate||"linear";return("horizontal"===n.orient?F:X).curve(f(i,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,i,r="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",s=t.length,a=1/0;--s>=0;)!1!==t[s].defined&&(i=Math.abs(t[s][o]-r)).5&&e<1.5?.5-Math.abs(e-1):0}function oe(t,e){const n=re(e);t("d",K(null,e,n,n))}function se(t,e,n,i){const r=re(e);t.beginPath(),K(t,e,(n||0)+r,(i||0)+r)}const ae=Ft(se),le=Ft(se,!1);var ue={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Qt(e))},bound:function(t,e){if(!e.clip&&e.items){const n=e.items,i=n.length;for(let e=0;e{const i=e.x||0,r=e.y||0,o=e.strokeForeground,s=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&s&&(se(t,e,i,r),Lt(t,e),e.fill&&Dt(t,e,s)&&t.fill(),e.stroke&&!o&&It(t,e,s)&&t.stroke()),t.save(),t.translate(i,r),e.clip&&ie(t,e),n&&n.translate(-i,-r),Ht(e,e=>{this.draw(t,e,n)}),n&&n.translate(i,r),t.restore(),o&&e.stroke&&s&&(se(t,e,i,r),Lt(t,e),It(t,e,s)&&t.stroke())})},pick:function(t,e,n,i,r,o){if(e.bounds&&!e.bounds.contains(r,o)||!e.items)return null;const s=n*t.pixelRatio,a=i*t.pixelRatio;return Gt(e,l=>{let u,c,h,f,d,g,p,v,y;if(v=l.bounds,(!v||v.contains(r,o))&&(f=l.x||0,d=l.y||0,g=f+(l.width||0),p=d+(l.height||0),y=l.clip,!y||!(rg||op)))return t.save(),t.translate(f,d),f=r-f,d=o-d,y&&Z(l)&&!ae(t,l,s,a)?(t.restore(),null):(c=l.strokeForeground,h=!1!==e.interactive,h&&c&&l.stroke&&le(t,l,s,a)?(t.restore(),l):(u=Gt(l,t=>function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,f,d)?this.pick(t,n,i,f,d):null),!u&&h&&(l.fill||!c&&l.stroke)&&ae(t,l,s,a)&&(u=l),t.restore(),u||null))})},isect:zt,content:function(t,e,n){t("clip-path",e.clip?nt(n,e,e):null)},background:function(t,e){t("class","background"),t("aria-hidden",!0),oe(t,e)},foreground:function(t,e){t("class","foreground"),t("aria-hidden",!0),e.strokeForeground?oe(t,e):t("d","")}},ce={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function he(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then(e=>{t.image=e,t.image.url=t.url})),n}function fe(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function de(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function ge(t,e){return"center"===t?e/2:"right"===t?e:0}function pe(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var ve={type:"image",tag:"image",nested:!1,attr:function(t,e,n){const i=he(e,n),r=fe(e,i),o=de(e,i),s=(e.x||0)-ge(e.align,r),a=(e.y||0)-pe(e.baseline,o);t("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",ce["xmlns:xlink"],"xlink:href"),t("transform",Jt(s,a)),t("width",r),t("height",o),t("preserveAspectRatio",!1===e.aspect?"none":"xMidYMid")},bound:function(t,e){const n=e.image,i=fe(e,n),r=de(e,n),o=(e.x||0)-ge(e.align,i),s=(e.y||0)-pe(e.baseline,r);return t.set(o,s,o+i,s+r)},draw:function(t,e,n){Ht(e,e=>{if(n&&!n.intersects(e.bounds))return;let i,r,o,s,a=he(e,this),l=fe(e,a),u=de(e,a),c=(e.x||0)-ge(e.align,l),h=(e.y||0)-pe(e.baseline,u);!1!==e.aspect&&(r=a.width/a.height,o=e.width/e.height,r==r&&o==o&&r!==o&&(o=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(i=t[o].y-e[1])*i1?n:n[0]:n;var n}function De(t,e){const n=null==e?"":(e+"").trim();return t.limit>0&&n.length?function(t,e){var n=+t.limit,i=function(t){if(Ce.width===Se){const e=Ie(t);return t=>Le(t,e)}{const e=Oe(t);return t=>Pe(t,e)}}(t);if(i(e)>>1,i(e.slice(r))>n?a=r+1:l=r;return o+e.slice(a)}for(;a>>1),i(e.slice(0,r))Math.max(t,Ce.width(n,e)),0)):r=Ce.width(n,f),"center"===s?c-=r/2:"right"===s&&(c-=r),t.set(c+=l,h+=u,c+r,h+o),n.angle&&!i)t.rotate(n.angle*v,l,u);else if(2===i)return t.rotatedPoints(n.angle*v,l,u);return t}var We={arc:te,area:ne,group:ue,image:ve,line:ye,path:me,rect:be,rule:we,shape:Te,symbol:Ae,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,i=e.dx||0,r=(e.dy||0)+Be(e),o=Ge(e),s=o.x1,a=o.y1,l=e.angle||0;t("text-anchor",Ve[e.align]||"start"),l?(n=Jt(s,a)+" "+$t(l),(i||r)&&(n+=" "+Jt(i,r))):n=Jt(s+i,a+r),t("transform",n)},bound:je,draw:function(t,n,i){Ht(n,(function(n){var r,o,s,a,l,u,c,h=null==n.opacity?1:n.opacity;if(!(i&&!i.intersects(n.bounds)||0===h||n.fontSize<=0||null==n.text||0===n.text.length)){if(t.font=Ie(n),t.textAlign=n.align||"left",o=(r=Ge(n)).x1,s=r.y1,n.angle&&(t.save(),t.translate(o,s),t.rotate(n.angle*v),o=s=0),o+=n.dx||0,s+=(n.dy||0)+Be(n),u=qe(n),Lt(t,n),e.isArray(u))for(l=Ne(n),a=0;a=0;)if(!1!==t[r].defined&&(n=t[r].x-e[0])*n+(i=t[r].y-e[1])*i<(n=t[r].size||1)*n)return t[r];return null}))};function Ue(t,e,n){var i=We[t.mark.marktype],r=e||i.bound;return i.nested&&(t=t.mark),r(t.bounds||(t.bounds=new it),t,n)}var Xe={mark:null};function Fe(t,e,n){var i,r,o,s,a=We[t.marktype],l=a.bound,u=t.items,c=u&&u.length;if(a.nested)return c?o=u[0]:(Xe.mark=t,o=Xe),s=Ue(o,l,n),e=e&&e.union(s)||s;if(e=e||t.bounds&&t.bounds.clear()||new it,c)for(i=0,r=u.length;ie;)t.removeChild(n[--i]);return t}function on(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function sn(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function an(t,e){this._active=null,this._handlers={},this._loader=t||o.loader(),this._tooltip=e||ln}function ln(t,e,n,i){t.element().setAttribute("title",i||"")}Ze.toJSON=function(t){return Je(this.root,t||0)},Ze.mark=function(t,e,n){var i=Ke(t,e=e||this.root.items[0]);return e.items[n]=i,i.zindex&&(i.group.zdirty=!0),i};const un=an.prototype;function cn(t){this._el=null,this._bgcolor=null,this._loader=new at(t)}un.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},un.element=function(){return this._el},un.canvas=function(){return this._el&&this._el.firstChild},un.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},un.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},un.on=function(){},un.off=function(){},un._handlerIndex=function(t,e,n){for(let i=t?t.length:0;--i>=0;)if(t[i].type===e&&(!n||t[i].handler===n))return i;return-1},un.handlers=function(t){const e=this._handlers,n=[];if(t)n.push.apply(n,e[this.eventName(t)]);else for(const t in e)n.push.apply(n,e[t]);return n},un.eventName=function(t){const e=t.indexOf(".");return e<0?t:t.slice(0,e)},un.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then(e=>{const n=new MouseEvent(t.type,t),i=tn(null,"a");for(const t in e)i.setAttribute(t,e[t]);i.dispatchEvent(n)}).catch((function(){}))},un.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,i){var r,o,s=t&&t.mark;if(s&&(r=We[s.marktype]).tip){for((o=sn(e,n))[0]-=i[0],o[1]-=i[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=r.tip(s.items,o)}return t}(e,t,this.canvas(),this._origin);const i=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,i)}},un.getItemBoundingClientRect=function(t){const e=this.canvas();if(!e)return;const n=e.getBoundingClientRect(),i=this._origin,r=t.bounds,o=r.width(),s=r.height();let a=r.x1+i[0]+n.left,l=r.y1+i[1]+n.top;for(;t.mark&&(t=t.mark.group);)a+=t.x||0,l+=t.y||0;return{x:a,y:l,width:o,height:s,left:a,top:l,right:a+o,bottom:l+s}};var hn=cn.prototype;hn.initialize=function(t,e,n,i,r){return this._el=t,this.resize(e,n,i,r)},hn.element=function(){return this._el},hn.canvas=function(){return this._el&&this._el.firstChild},hn.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},hn.resize=function(t,e,n,i){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=i||1,this},hn.dirty=function(){},hn.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},hn._render=function(){},hn.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then((function(){return e})):Promise.resolve(e)},hn._load=function(t,e){var n=this,i=n._loader[t](e);if(!n._ready){var r=n._call;n._ready=n._loader.ready().then((function(t){t&&r(),n._ready=null}))}return i},hn.sanitizeURL=function(t){return this._load("sanitizeURL",t)},hn.loadImage=function(t){return this._load("loadImage",t)};const fn="dragleave",dn="mousedown",gn="mousemove",pn="mouseout",vn="click",yn=["keydown","keypress","keyup","dragenter",fn,"dragover",dn,"mouseup",gn,pn,"mouseover",vn,"dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],_n=gn,mn=pn,xn=vn;function bn(t,e){an.call(this,t,e),this._down=null,this._touch=null,this._first=!0,this._events={}}const kn=e.inherits(bn,an);kn.initialize=function(t,e,n){return this._canvas=t&&en(t,"canvas"),[vn,dn,gn,pn,fn].forEach(t=>wn(this,t)),an.prototype.initialize.call(this,t,e,n)};function wn(t,e){(t=>"touchstart"===t||"touchmove"===t||"touchend"===t?["touchstart","touchmove","touchend"]:[t])(e).forEach(e=>function(t,e){const n=t.canvas();n&&!t._events[e]&&(t._events[e]=1,n.addEventListener(e,t[e]?n=>t[e](n):n=>t.fire(e,n)))}(t,e))}function Tn(t,e,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r||(r&&r.exit||this.fire(n,i),this._active=o,this.fire(e,i)),this.fire(t,i)}}function An(t){return function(e){this.fire(t,e),this._active=null}}kn.canvas=function(){return this._canvas},kn.context=function(){return this._canvas.getContext("2d")},kn.events=yn,kn.DOMMouseScroll=function(t){this.fire("mousewheel",t)},kn.mousemove=Tn(gn,"mouseover",pn),kn.dragover=Tn("dragover","dragenter",fn),kn.mouseout=An(pn),kn.dragleave=An(fn),kn.mousedown=function(t){this._down=this._active,this.fire(dn,t)},kn.click=function(t){this._down===this._active&&(this.fire(vn,t),this._down=null)},kn.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},kn.touchmove=function(t){this.fire("touchmove",t,!0)},kn.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},kn.fire=function(t,e,n){const i=n?this._touch:this._active,r=this._handlers[t];if(e.vegaType=t,t===xn&&i&&i.href?this.handleHref(e,i,i.href):t!==_n&&t!==mn||this.handleTooltip(e,i,t!==mn),r)for(let t=0,n=r.length;t=0&&i.splice(r,1),this},kn.pickEvent=function(t){const e=sn(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},kn.pick=function(t,e,n,i,r){const o=this.context();return We[t.marktype].pick.call(this,o,t,e,n,i,r)};var Mn="undefined"!=typeof window&&window.devicePixelRatio||1;function Cn(t){cn.call(this,t),this._options={},this._redraw=!1,this._dirty=new it,this._tempb=new it}const Rn=e.inherits(Cn,cn),zn=cn.prototype;Rn.initialize=function(t,e,n,i,o,s){return this._options=s||{},this._canvas=this._options.externalContext?null:r.canvas(1,1,this._options.type),t&&this._canvas&&(rn(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),zn.initialize.call(this,t,e,n,i,o)},Rn.resize=function(t,n,i,r){if(zn.resize.call(this,t,n,i,r),this._canvas)!function(t,e,n,i,r,o){const s="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,a=t.getContext("2d"),l=s?Mn:r;t.width=e*l,t.height=n*l;for(const t in o)a[t]=o[t];s&&1!==l&&(t.style.width=e+"px",t.style.height=n+"px"),a.pixelRatio=l,a.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||e.error("CanvasRenderer is missing a valid canvas or context"),t.scale(this._scale,this._scale),t.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},Rn.canvas=function(){return this._canvas},Rn.context=function(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},Rn.dirty=function(t){let e=this._tempb.clear().union(t.bounds),n=t.mark.group;for(;n;)e.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(e)};function Pn(t,e){an.call(this,t,e);const n=this;n._hrefHandler=Ln(n,(t,e)=>{e&&e.href&&n.handleHref(t,e,e.href)}),n._tooltipHandler=Ln(n,(t,e)=>{n.handleTooltip(t,e,t.type!==mn)})}Rn._render=function(t){const e=this.context(),n=this._origin,i=this._width,r=this._height,o=this._dirty,s=(a=n,l=i,u=r,(new it).set(0,0,l,u).translate(-a[0],-a[1]));var a,l,u;e.save();const c=this._redraw||o.empty()?(this._redraw=!1,s.expand(1)):function(t,e,n){return e.expand(1).round(),t.pixelRatio%1&&e.scale(t.pixelRatio).round().scale(1/t.pixelRatio),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,s.intersect(o),n);return this.clear(-n[0],-n[1],i,r),this.draw(e,t,c),e.restore(),o.clear(),this},Rn.draw=function(t,n,i){const r=We[n.marktype];n.clip&&function(t,n){var i=n.clip;t.save(),e.isFunction(i)?(t.beginPath(),i(t),t.clip()):ie(t,n.group)}(t,n),r.draw.call(this,t,n,i),n.clip&&t.restore()},Rn.clear=function(t,e,n,i){const r=this._options,o=this.context();"pdf"===r.type||r.externalContext||o.clearRect(t,e,n,i),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,e,n,i))};const Sn=e.inherits(Pn,an);Sn.initialize=function(t,e,n){let i=this._svg;return i&&(i.removeEventListener(xn,this._hrefHandler),i.removeEventListener(_n,this._tooltipHandler),i.removeEventListener(mn,this._tooltipHandler)),this._svg=i=t&&en(t,"svg"),i&&(i.addEventListener(xn,this._hrefHandler),i.addEventListener(_n,this._tooltipHandler),i.addEventListener(mn,this._tooltipHandler)),an.prototype.initialize.call(this,t,e,n)},Sn.canvas=function(){return this._svg};const Ln=(t,e)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,e.call(t._obj,n,i)};Sn.on=function(t,e){const n=this.eventName(t),i=this._handlers;if(this._handlerIndex(i[n],t,e)<0){const r={type:t,handler:e,listener:Ln(this,e)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},Sn.off=function(t,e){const n=this.eventName(t),i=this._handlers[n],r=this._handlerIndex(i,t,e);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this};const On=(t,e,n)=>({role:t,"aria-roledescription":e,"aria-label":n||void 0}),Nn=e.toSet(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),qn={axis:{desc:"axis",caption:function(t){const e=t.datum,n=t.orient,i=e.title?Vn(t):null,r=t.context,o=r.scales[e.scale].value,a=r.dataflow.locale(),l=o.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(i?` titled '${i}'`:"")+` for a ${s.isDiscrete(l)?"discrete":l} scale with `+s.domainCaption(a,o,t)}},legend:{desc:"legend",caption:function(t){const n=t.datum,i=n.title?Vn(t):null,r=((n.type||"")+" legend").trim(),o=n.scales,a=Object.keys(o),l=t.context,u=l.scales[o[a[0]]].value,c=l.dataflow.locale();return h=r,(h.length?h[0].toUpperCase()+h.slice(1):h)+(i?` titled '${i}'`:"")+" for "+function(t){return(t=t.map(t=>t+("fill"===t||"stroke"===t?" color":""))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+e.peek(t)}(a)+" with "+s.domainCaption(c,u,t);var h}},"title-text":{desc:"title",caption:t=>`Title text '${Bn(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${Bn(t)}'`}},Dn={ariaRole:"role",ariaRoleDescription:"aria-roledescription",description:"aria-label"};function En(t,e){const n=!1===e.aria;if(t("aria-hidden",n||void 0),n||null==e.description)for(const e in Dn)t(Dn[e],void 0);else{const n=e.mark.marktype;t("aria-label",e.description),t("role",e.ariaRole||("group"===n?"graphics-object":"graphics-symbol")),t("aria-roledescription",e.ariaRoleDescription||n+" mark")}}function In(t){return!1===t.aria?{"aria-hidden":!0}:Nn[t.role]?null:qn[t.role]?function(t,e){try{const n=t.items[0],i=e.caption||(()=>"");return On(e.role||"graphics-symbol",e.desc,n.description||i(n))}catch(t){return null}}(t,qn[t.role]):function(t){const e=t.marktype,n="group"===e||"text"===e||t.items.some(t=>null!=t.description&&!1!==t.aria);return On(n?"graphics-object":"graphics-symbol",e+" mark container",t.description)}(t)}function Bn(t){return e.array(t.text).join(" ")}function Vn(t){try{return e.array(e.peek(t.items).items[0].text).join(" ")}catch(t){return null}}const Hn=t=>(t+"").replace(/&/g,"&").replace(/"/g,""");function Gn(t,e,n){var i,r,o="<"+t;if(e)for(i in e)null!=(r=e[i])&&(o+=" "+i+'="'+Hn(r)+'"');return n&&(o+=" "+n),o+">"}function jn(t){return""}const Wn={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity",blend:"mix-blend-mode"},Un={fill:"none","stroke-miterlimit":10},Xn=ce.xmlns;function Fn(t){cn.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var Yn=e.inherits(Fn,cn),Jn=cn.prototype;function $n(t,e,n){var i,r,o;if("radial"===e.gradient){var s=nn(t,n++,"pattern",Xn);s.setAttribute("id","p_"+e.id),s.setAttribute("viewBox","0,0,1,1"),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("preserveAspectRatio","xMidYMid slice"),(s=nn(s,0,"rect",Xn)).setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","url("+si()+"#"+e.id+")"),(t=nn(t,n++,"radialGradient",Xn)).setAttribute("id",e.id),t.setAttribute("fx",e.x1),t.setAttribute("fy",e.y1),t.setAttribute("fr",e.r1),t.setAttribute("cx",e.x2),t.setAttribute("cy",e.y2),t.setAttribute("r",e.r2)}else(t=nn(t,n++,"linearGradient",Xn)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2);for(i=0,r=e.stops.length;i1&&t.previousSibling!=e}(s,n))&&e.insertBefore(s,n?n.nextSibling:e.firstChild),s}Yn.initialize=function(t,e,n,i){if(this._defs={gradient:{},clipping:{}},t){this._svg=nn(t,0,"svg",Xn),this._svg.setAttribute("class","marks"),rn(t,1),this._root=nn(this._svg,0,"g",Xn);for(const t in Un)this._root.setAttribute(t,Un[t]);rn(this._svg,1)}return this.background(this._bgcolor),Jn.initialize.call(this,t,e,n,i)},Yn.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),Jn.background.apply(this,arguments)},Yn.resize=function(t,e,n,i){return Jn.resize.call(this,t,e,n,i),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},Yn.canvas=function(){return this._svg},Yn.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in ce)t[e]=ce[e];var n=this._bgcolor?Gn("rect",{width:this._width,height:this._height,fill:this._bgcolor})+jn("rect"):"";return Gn("svg",t)+(this._defs.el?this._defs.el.outerHTML:"")+n+this._root.outerHTML+jn("svg")},Yn._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),rn(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},Yn.updateDefs=function(){const t=this._svg,e=this._defs;let n=e.el,i=0;for(const r in e.gradient)n||(e.el=n=nn(t,0,"defs",Xn)),i=$n(n,e.gradient[r],i);for(const r in e.clipping)n||(e.el=n=nn(t,0,"defs",Xn)),i=Qn(n,e.clipping[r],i);n&&(0===i?(t.removeChild(n),e.el=null):rn(n,i))},Yn._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},Yn.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},Yn.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},Yn._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length||!this._dirtyID)return!0;var e,n,i,r,o,s,a,l=++this._dirtyID;for(o=0,s=t.length;o{const e=this.isDirty(t),n=Kn(t,i,l,o.tag,r);e&&(this._update(o,n,t),a&&function(t,e,n){e=e.lastChild.previousSibling;let i,r=0;Ht(n,n=>{i=t.draw(e,n,i),++r}),rn(e,1+r)}(this,n,t)),l=n,++u};return o.nested?e.items.length&&h(e.items[0]):Ht(e,h),rn(i,u),i};var ti=null,ei=null,ni={group:function(t,e,n){const i=ti=e.childNodes[2];ei=i.__values__,t.foreground(ri,n,this),ei=e.__values__,ti=e.childNodes[1],t.content(ri,n,this);const r=ti=e.childNodes[0];t.background(ri,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==ei.events&&(oi(i,"pointer-events",o),oi(r,"pointer-events",o),ei.events=o),n.strokeForeground&&n.stroke){const t=n.fill;oi(i,"display",null),this.style(r,n),oi(r,"stroke",null),t&&(n.fill=null),ei=i.__values__,this.style(i,n),t&&(n.fill=t),ti=null}else oi(i,"display","none")},image:function(t,e,n){!1===n.smooth?(ii(e,"image-rendering","optimizeSpeed"),ii(e,"image-rendering","pixelated")):ii(e,"image-rendering",null)},text:function(t,n,i){let r,o,s,a,l=qe(i);e.isArray(l)?(o=l.map(t=>De(i,t)),r=o.join("\n"),r!==ei.text&&(rn(n,0),s=n.ownerDocument,a=Ne(i),o.forEach((t,e)=>{const r=tn(s,"tspan",Xn);r.__data__=i,r.textContent=t,e&&(r.setAttribute("x",0),r.setAttribute("dy",a)),n.appendChild(r)}),ei.text=r)):(o=De(i,l),o!==ei.text&&(n.textContent=o,ei.text=o)),oi(n,"font-family",Ee(i)),oi(n,"font-size",Oe(i)+"px"),oi(n,"font-style",i.fontStyle),oi(n,"font-variant",i.fontVariant),oi(n,"font-weight",i.fontWeight)}};function ii(t,e,n){n!==ei[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),ei[e]=n)}function ri(t,e,n){e!==ei[t]&&(n?function(t,e,n,i){null!=n?t.setAttributeNS(i,e,n):t.removeAttributeNS(i,e)}(ti,t,e,n):oi(ti,t,e),ei[t]=e)}function oi(t,e,n){null!=n?t.setAttribute(e,n):t.removeAttribute(e)}function si(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function ai(t){cn.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}Yn._update=function(t,e,n){ti=e,ei=e.__values__,En(ri,n),t.attr(ri,n,this);const i=ni[t.type];i&&i.call(this,t,e,n),ti&&this.style(ti,n)},Yn.style=function(t,e){if(null!=e)for(const n in Wn){let i="font"===n?Ee(e):e[n];if(i===ei[n])continue;const r=Wn[n];null==i?t.removeAttribute(r):(l(i)&&(i=u(i,this._defs.gradient,si())),t.setAttribute(r,i+"")),ei[n]=i}};var li=e.inherits(ai,cn),ui=cn.prototype;function ci(t){return t.replace(/&/g,"&").replace(//g,">")}li.resize=function(t,n,i,r){ui.resize.call(this,t,n,i,r);var o=this._origin,s=this._text,a={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var l in ce)a[l]=ce[l];s.head=Gn("svg",a);var u=this._bgcolor;return"transparent"!==u&&"none"!==u||(u=null),s.bg=u?Gn("rect",{width:this._width,height:this._height,fill:u})+jn("rect"):"",s.root=Gn("g",e.extend({},Un,{transform:"translate("+o+")"})),s.foot=jn("g")+jn("svg"),this},li.background=function(){var t=ui.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},li.svg=function(){var t=this._text;return t.head+t.defs+t.bg+t.root+t.body+t.foot},li._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},li.buildDefs=function(){let t,e="";for(const n in this._defs.gradient){const i=this._defs.gradient[n],r=i.stops;"radial"===i.gradient?(e+=Gn(t="pattern",{id:"p_"+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e+=Gn("rect",{width:"1",height:"1",fill:"url(#"+n+")"})+jn("rect"),e+=jn(t),e+=Gn(t="radialGradient",{id:n,fx:i.x1,fy:i.y1,fr:i.r1,cx:i.x2,cy:i.y2,r:i.r2})):e+=Gn(t="linearGradient",{id:n,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2});for(let t=0;t{r[i||t]=e};return Array.isArray(n)?n.forEach(t=>t(o,e,this)):n(o,e,this),i&&function(t,e,n,i,r){if(null==e)return t;"bgrect"===i&&!1===n.interactive&&(t["pointer-events"]="none");if("bgfore"===i&&(!1===n.interactive&&(t["pointer-events"]="none"),t.display="none",null!==e.fill))return t;"image"===i&&!1===e.smooth&&(t.style="image-rendering: optimizeSpeed; image-rendering: pixelated;");"text"===i&&(t["font-family"]=Ee(e),t["font-size"]=Oe(e)+"px",e.fontStyle&&(t["font-style"]=e.fontStyle),e.fontVariant&&(t["font-variant"]=e.fontVariant),e.fontWeight&&(t["font-weight"]=e.fontWeight));for(const n in Wn){let i=e[n];const o=Wn[n];("transparent"!==i||"fill"!==o&&"stroke"!==o)&&null!=i&&(l(i)&&(i=u(i,r.gradient,"")),t[o]=i)}}(r,e,t,i,this._defs),r},li.href=function(t){var e,n=this,i=t.href;if(i){if(e=n._hrefs&&n._hrefs[i])return e;n.sanitizeURL(i).then(t=>{t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[i]=t})}return null},li.mark=function(t){const n=We[t.marktype],i=n.tag,r=[En,n.attr];let o="";o+=Gn("g",e.extend({class:on(t),"clip-path":t.clip?nt(this,t,t.group):null},In(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null}));const s=s=>{const a=this.href(s);if(a&&(o+=Gn("a",a)),o+=Gn(i,this.attr(t,s,r,"g"!==i?i:null)),"text"===i){const t=qe(s);if(e.isArray(t)){const e={x:0,dy:Ne(s)};for(let n=0;n{e+=this.mark(t)}),e};var hi={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},fi={};function di(t,e,n,i){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const r=t.items,o=t.marktype,s=r.length;let a=0;if("group"===o)for(;a=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(n=r[i],!yi(t[n],e[n],n))return!1;return typeof t==typeof e}(t,n):t==n)}function _i(t,e){return yi(p(t),p(e))}t.Bounds=it,t.CanvasHandler=bn,t.CanvasRenderer=Cn,t.Gradient=function(t,e){var n,i=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:i,stop:function(t,e){return i.push({offset:t,color:e}),n}}},t.GroupItem=st,t.Handler=an,t.Item=ot,t.Marks=We,t.RenderType=hi,t.Renderer=cn,t.ResourceLoader=at,t.SVGHandler=Pn,t.SVGRenderer=Fn,t.SVGStringRenderer=ai,t.Scenegraph=Qe,t.boundClip=function(t){var n=t.clip;if(e.isFunction(n))n(vt(vi.clear()));else{if(!n)return;vi.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(vi)},t.boundContext=vt,t.boundItem=Ue,t.boundMark=Fe,t.boundStroke=ht,t.closeTag=jn,t.domChild=nn,t.domClear=rn,t.domCreate=tn,t.domFind=en,t.font=Ie,t.fontFamily=Ee,t.fontSize=Oe,t.intersect=function(t,n,i){const r=[],o=(new it).union(n),s=t.marktype;return s?di(t,o,i,r):"group"===s?gi(t,o,i,r):e.error("Intersect scene must be mark node or group item.")},t.intersectBoxLine=St,t.intersectPath=Ct,t.intersectPoint=Rt,t.intersectRule=Pt,t.lineHeight=Ne,t.multiLineOffset=function(t){const n=qe(t);return(e.isArray(n)?n.length-1:0)*Ne(t)},t.openTag=Gn,t.pathCurves=f,t.pathEqual=_i,t.pathParse=p,t.pathRectangle=B,t.pathRender=M,t.pathSymbols=P,t.pathTrail=V,t.point=sn,t.renderModule=function(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(fi[t]=e,this):fi[t]},t.resetSVGClipId=et,t.resetSVGDefIds=function(){et(),a=0},t.sceneEqual=yi,t.sceneFromJSON=$e,t.scenePickVisit=Gt,t.sceneToJSON=Je,t.sceneVisit=Ht,t.sceneZOrder=Vt,t.textMetrics=Ce,Object.defineProperty(t,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-scenegraph/index.js b/node_modules/vega-scenegraph/index.js deleted file mode 100644 index ea9b23d..0000000 --- a/node_modules/vega-scenegraph/index.js +++ /dev/null @@ -1,68 +0,0 @@ -import {resetSVGGradientId} from './src/Gradient'; -import {resetSVGClipId} from './src/util/svg/clip'; - -export {default as Bounds} from './src/Bounds'; -export {default as Gradient} from './src/Gradient'; -export {default as GroupItem} from './src/GroupItem'; -export {default as ResourceLoader} from './src/ResourceLoader'; -export {default as Item} from './src/Item'; -export {default as Scenegraph} from './src/Scenegraph'; - -export {default as Handler} from './src/Handler'; -export {default as Renderer} from './src/Renderer'; -export {default as CanvasHandler} from './src/CanvasHandler'; -export {default as CanvasRenderer} from './src/CanvasRenderer'; -export {default as SVGHandler} from './src/SVGHandler'; -export {default as SVGRenderer} from './src/SVGRenderer'; -export {default as SVGStringRenderer} from './src/SVGStringRenderer'; -export {RenderType, renderModule} from './src/modules'; -export {intersect} from './src/intersect'; - -export {default as Marks} from './src/marks/index'; - -export {default as boundClip} from './src/bound/boundClip'; -export {default as boundContext} from './src/bound/boundContext'; -export {default as boundStroke} from './src/bound/boundStroke'; -export {default as boundItem} from './src/bound/boundItem'; -export {default as boundMark} from './src/bound/boundMark'; - -export {default as pathCurves} from './src/path/curves'; -export {default as pathSymbols} from './src/path/symbols'; -export {default as pathRectangle} from './src/path/rectangle'; -export {default as pathTrail} from './src/path/trail'; -export {default as pathParse} from './src/path/parse'; -export {default as pathRender} from './src/path/render'; - -export {default as point} from './src/util/point'; -export {domCreate, domFind, domChild, domClear} from './src/util/dom'; -export {openTag, closeTag} from './src/util/tags'; -export { - font, - fontFamily, - fontSize, - lineHeight, - multiLineOffset, - textMetrics -} from './src/util/text'; - -export {sceneEqual, pathEqual} from './src/util/equal'; -export {sceneToJSON, sceneFromJSON} from './src/util/serialize'; -export { - intersectPath, - intersectPoint, - intersectRule, - intersectBoxLine -} from './src/util/intersect'; -export { - zorder as sceneZOrder, - visit as sceneVisit, - pickVisit as scenePickVisit -} from './src/util/visit'; - -// deprecated, remove in next major version -export {resetSVGClipId} from './src/util/svg/clip'; - -export function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); -} diff --git a/node_modules/vega-scenegraph/package.json b/node_modules/vega-scenegraph/package.json deleted file mode 100644 index 1a53a80..0000000 --- a/node_modules/vega-scenegraph/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "_from": "vega-scenegraph@~4.8.3", - "_id": "vega-scenegraph@4.8.3", - "_inBundle": false, - "_integrity": "sha512-2GznqXm/py7/XX9juohFbLYQTKxHY5VNRZLHc0bL35Nd7lShKeOlHY9uVkHw2FoLLCz78UcXFminWM8lddvGxw==", - "_location": "/vega-scenegraph", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-scenegraph@~4.8.3", - "name": "vega-scenegraph", - "escapedName": "vega-scenegraph", - "rawSpec": "~4.8.3", - "saveSpec": null, - "fetchSpec": "~4.8.3" - }, - "_requiredBy": [ - "/vega", - "/vega-functions", - "/vega-view", - "/vega-view-transforms" - ], - "_resolved": "https://registry.npmjs.org/vega-scenegraph/-/vega-scenegraph-4.8.3.tgz", - "_shasum": "11b557019175ec5ddc258c3a5eb7371e64cec5e1", - "_spec": "vega-scenegraph@~4.8.3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-path": "^1.0.9", - "d3-shape": "^1.3.7", - "vega-canvas": "^1.2.2", - "vega-loader": "^4.3.0", - "vega-scale": "^7.0.0", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "Vega scenegraph and renderers.", - "gitHead": "8fe8d36961c128df8300e6bc4fe6aac1e537bbe0", - "homepage": "https://github.com/vega/vega#readme", - "license": "BSD-3-Clause", - "main": "build/vega-scenegraph.js", - "module": "index", - "name": "vega-scenegraph", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup && yarn schema", - "postbuild": "terser build/vega-scenegraph.js -c -m -o build/vega-scenegraph.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup && yarn schema", - "rollup": "rollup -f umd -g d3-path:d3,d3-shape:d3,vega-canvas:vega,vega-loader:vega,vega-scale:vega,vega-util:vega -n vega -o build/vega-scenegraph.js -- index.js", - "schema": "node schema > build/vega-scenegraph-schema.json", - "test": "tape -r ./test/__init__ 'test/**/*-test.js'" - }, - "version": "4.8.3" -} diff --git a/node_modules/vega-scenegraph/schema.js b/node_modules/vega-scenegraph/schema.js deleted file mode 100644 index 3c84d5b..0000000 --- a/node_modules/vega-scenegraph/schema.js +++ /dev/null @@ -1,421 +0,0 @@ -function duplicate(_) { - return JSON.parse(JSON.stringify(_)); -} - -function extend(_) { - for (var x, k, i=1, len=arguments.length; i name.split('') - .map(c => `[${c.toUpperCase()}${c.toLowerCase()}]`) - .join('') - ).join('|'); -} - -const BASE = { - '$schema': 'http://json-schema.org/draft-06/schema#', - 'title': 'Vega scenegraph', - 'description': 'Vega scenegraph model.', - 'oneOf': [ { '$ref': '#/refs/mark' } ], - 'refs': { - 'mark': { 'oneOf': [] }, - 'path': { - 'type': 'string', - 'pattern': '^' + svg_path() + '$' - }, - 'paint': { - 'oneOf': [ - { '$ref': '#/refs/color' }, - { '$ref': '#/refs/linearGradient' }, - { '$ref': '#/refs/radialGradient' } - ] - }, - 'color': { - 'oneOf': [ - { - 'type': 'string', - 'pattern': '^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$' - }, - { - 'type': 'string', - 'pattern': '^rgb\\([ \t\f]*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(,[ \t\f]*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){2}[ \t\f]*\\)$' - }, - { - 'type': 'string', - 'pattern': '^rgb\\([ \t\f]*([0-9]|[1-9][0-9]|100)%(,[ \t\f]*([0-9]|[1-9][0-9]|100)%){2}[ \t\f]*\\)$' - }, - { - 'type': 'string', - 'pattern': '^hsl\\([ \t\f]*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9]|360)(,[ \t\f]*([0-9]|[1-9][0-9]|100)%){2}[ \t\f]*\\)$' - }, - { - 'type': 'string', - 'pattern': '^(' + css_color_names() + ')$' - } - ] - }, - 'gradientStop': { - 'type': 'object', - 'properties': { - 'offset': { 'type': 'number' }, - 'color': { '$ref': '#/refs/color' } - }, - 'required': ['offset', 'color'] - }, - 'linearGradient': { - 'type': 'object', - 'properties': { - 'gradient': { 'enum': [ 'linear' ] }, - 'id': { 'type': 'string' }, - 'x1': { 'type': 'number' }, - 'y1': { 'type': 'number' }, - 'x2': { 'type': 'number' }, - 'y2': { 'type': 'number' }, - 'stops': { - 'type': 'array', - 'items': { '$ref': '#/refs/gradientStop' } - } - }, - 'required': ['gradient', 'stops'], - 'additionalProperties': false - }, - 'radialGradient': { - 'type': 'object', - 'properties': { - 'gradient': { 'enum': [ 'radial' ] }, - 'id': { 'type': 'string' }, - 'x1': { 'type': 'number' }, - 'y1': { 'type': 'number' }, - 'r1': { 'type': 'number' }, - 'x2': { 'type': 'number' }, - 'y2': { 'type': 'number' }, - 'r2': { 'type': 'number' }, - 'stops': { - 'type': 'array', - 'items': { '$ref': '#/refs/gradientStop' } - } - }, - 'required': ['gradient', 'stops'], - 'additionalProperties': false - } - } -}; - -const MARK_BASE = { - 'type': 'object', - 'properties': { - 'marktype': { 'enum': null }, - 'name': { 'type': 'string' }, - 'role': { 'type': 'string' }, - 'description': { 'type': 'string' }, - 'aria': { 'type': 'boolean' }, - 'interactive': { 'type': 'boolean', 'default': true }, - 'items': { - 'type': 'array', - 'items': { '$ref': '#/refs/item-' } - }, - 'zindex': { 'type': 'number' } - }, - 'required': [ 'marktype' ] -}; - -const BLEND_MODE = [ - null, - 'multiply', - 'screen', - 'overlay', - 'darken', - 'lighten', - 'color-dodge', - 'color-burn', - 'hard-light', - 'soft-light', - 'difference', - 'exclusion', - 'hue', - 'saturation', - 'color', - 'luminosity' -]; - -const ITEM_BASE = { - 'type': 'object', - 'properties': { - 'x': { 'type': 'number' }, - 'y': { 'type': 'number' }, - 'width': { 'type': 'number' }, - 'height': { 'type': 'number' }, - 'blend': { 'enum': BLEND_MODE, 'default': null }, - 'opacity': { 'type': 'number', 'default': 1 }, - 'fill': { '$ref': '#/refs/paint' }, - 'fillOpacity': { 'type': 'number', 'default': 1 }, - 'stroke': { '$ref': '#/refs/paint' }, - 'strokeOpacity': { 'type': 'number', 'default': 1 }, - 'strokeWidth': { 'type': 'number', 'default': 1 }, - 'strokeCap': { 'enum': [ 'butt', 'cap', 'round' ], 'default': 'butt' }, - 'strokeJoin': { 'enum': [ 'miter', 'round', 'bevel' ], 'default': 'miter' }, - 'strokeMiterLimit': { 'type': 'number' }, - 'strokeDash': { 'type': 'array', 'items': { 'type': 'number' } }, - 'strokeDashOffset': { 'type': 'number', 'default': 0 }, - 'zindex': { 'type': 'number' }, - 'cursor': { 'type': 'string' }, - 'href': { 'type': 'string', 'format': 'uri-reference' }, - 'tooltip': {}, - 'description': { 'type': 'string' }, - 'aria': { 'type': 'boolean' }, - 'ariaRole': { 'type': 'string' }, - 'ariaRoleDescription': { 'type': 'string' } - } -}; - -const AREA_INTERPOLATE = [ - 'basis', - 'cardinal', - 'catmull-rom', - 'linear', - 'monotone', - 'natural', - 'step', - 'step-after', - 'step-before' -]; - -const LINE_INTERPOLATE = [ - 'basis', - 'basis-closed', - 'basis-open', - 'bundle', - 'cardinal', - 'cardinal-closed', - 'cardinal-open', - 'catmull-rom', - 'catmull-rom-closed', - 'catmull-rom-open', - 'linear', - 'linear-closed', - 'monotone', - 'natural', - 'step', - 'step-after', - 'step-before' -]; - -const TEXT_BASELINE = [ - 'alphabetic', - 'top', - 'middle', - 'bottom', - 'line-top', - 'line-bottom' -]; - -const TEXT_FONT_WEIGHT = [ - 'normal', - 'bold', - 'bolder', - 'lighter', - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 -]; - -const MARKS = { - 'group': { - 'properties': { - 'clip': { 'type': 'boolean' }, - 'cornerRadius': { 'type': 'number' }, - 'cornerRadiusTopLeft': { 'type': 'number' }, - 'cornerRadiusTopRight': { 'type': 'number' }, - 'cornerRadiusBottomRight': { 'type': 'number' }, - 'cornerRadiusBottomLeft': { 'type': 'number' }, - 'items': { 'type': 'array', 'items': { '$ref': '#/refs/mark' } }, - 'strokeForeground': { 'type': 'boolean' }, - 'strokeOffset': { 'type': 'number' } - } - }, - 'arc': { - 'properties': { - 'startAngle': { 'type': 'number' }, - 'endAngle': { 'type': 'number' }, - 'padAngle': { 'type': 'number' }, - 'innerRadius': { 'type': 'number' }, - 'outerRadius': { 'type': 'number' }, - 'cornerRadius': { 'type': 'number' } - } - }, - 'area': { - 'properties': { - 'defined': { 'type': 'boolean' }, - 'interpolate': { 'enum': AREA_INTERPOLATE }, - 'tension': { 'type': 'number' }, - 'orient': { 'enum': [ 'horizontal', 'vertical' ] } - } - }, - 'image': { - 'properties': { - 'url': { 'type': 'string', 'format': 'uri-reference' }, - 'aspect': { 'type': 'boolean', 'default': true }, - 'smooth': { 'type': 'boolean', 'default': true }, - 'align': { - 'enum': [ 'left', 'center', 'right' ], - 'default': 'left' - }, - 'baseline': { - 'enum': [ 'top', 'middle', 'bottom' ], - 'default': 'top' - } - } - }, - 'line': { - 'properties': { - 'defined': { 'type': 'boolean' }, - 'interpolate': { 'enum': LINE_INTERPOLATE }, - 'tension': { 'type': 'number' }, - 'orient': { 'enum': [ 'horizontal', 'vertical' ] }, - 'size': { 'type': 'number' } - } - }, - 'path': { - 'properties': { - 'angle': { 'type': 'number' }, - 'path': { '$ref': '#/refs/path' }, - 'scaleX': { 'type': 'number' }, - 'scaleY': { 'type': 'number' } - } - }, - 'rect': { - 'properties': { - 'cornerRadius': { 'type': 'number' }, - 'cornerRadiusTopLeft': { 'type': 'number' }, - 'cornerRadiusTopRight': { 'type': 'number' }, - 'cornerRadiusBottomRight': { 'type': 'number' }, - 'cornerRadiusBottomLeft': { 'type': 'number' } - } - }, - 'rule': { - 'properties': { - 'x2': { 'type': 'number' }, - 'y2': { 'type': 'number' } - } - }, - 'symbol': { - 'properties': { - 'angle': { 'type': 'number', 'default': 0 }, - 'size': { 'type': 'number', 'default': 100 }, - 'shape': { 'type': 'string' } - } - }, - 'text': { - 'properties': { - 'text': { - 'oneOf': [ - { 'type': 'string' }, - { 'type': 'array', 'items': { 'type': 'string' } } - ] - }, - 'limit': { 'type': 'number', 'default': 0 }, - 'lineHeight': { 'type': 'number' }, - 'dir': { 'type': 'string', 'default': 'ltr' }, - 'ellipsis': { 'type': 'string', 'default': '\u2026' }, - 'align': { - 'enum': [ 'left', 'center', 'right' ], - 'default': 'left' - }, - 'baseline': { - 'enum': TEXT_BASELINE, - 'default': 'alphabetic' - }, - 'angle': { 'type': 'number', 'default': 0 }, - 'theta': { 'type': 'number', 'default': 0 }, - 'radius': { 'type': 'number', 'default': 0 }, - 'dx': { 'type': 'number', 'default': 0 }, - 'dy': { 'type': 'number', 'default': 0 }, - 'font': { 'type': 'string', 'default': 'sans-serif' }, - 'fontSize': { 'type': 'number' }, - 'fontStyle': { - 'enum': [ 'normal', 'italic', 'oblique' ], - 'default': 'normal' - }, - 'fontWeight': { - 'enum': TEXT_FONT_WEIGHT, - 'default': 'normal' - }, - 'fontVariant': { - 'enum': [ 'normal', 'small-caps' ], - 'default': 'normal' - } - } - }, - 'trail': { - 'properties': { - 'defined': { 'type': 'boolean' }, - 'size': { 'type': 'number', 'default': 1 } - } - } -}; - -const schema = build(true); -process.stdout.write(JSON.stringify(schema, null, 2)); diff --git a/node_modules/vega-scenegraph/src/Bounds.js b/node_modules/vega-scenegraph/src/Bounds.js deleted file mode 100644 index f48c7f0..0000000 --- a/node_modules/vega-scenegraph/src/Bounds.js +++ /dev/null @@ -1,178 +0,0 @@ -export default function Bounds(b) { - this.clear(); - if (b) this.union(b); -} - -var prototype = Bounds.prototype; - -prototype.clone = function() { - return new Bounds(this); -}; - -prototype.clear = function() { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; -}; - -prototype.empty = function() { - return ( - this.x1 === +Number.MAX_VALUE && - this.y1 === +Number.MAX_VALUE && - this.x2 === -Number.MAX_VALUE && - this.y2 === -Number.MAX_VALUE - ); -}; - -prototype.equals = function(b) { - return ( - this.x1 === b.x1 && - this.y1 === b.y1 && - this.x2 === b.x2 && - this.y2 === b.y2 - ); -}; - -prototype.set = function(x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; - } - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; - } - return this; -}; - -prototype.add = function(x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; -}; - -prototype.expand = function(d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; -}; - -prototype.round = function() { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; -}; - -prototype.scale = function(s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; -}; - -prototype.translate = function(dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; -}; - -prototype.rotate = function(angle, x, y) { - const p = this.rotatedPoints(angle, x, y); - return this.clear() - .add(p[0], p[1]) - .add(p[2], p[3]) - .add(p[4], p[5]) - .add(p[6], p[7]); -}; - -prototype.rotatedPoints = function(angle, x, y) { - var {x1, y1, x2, y2} = this, - cos = Math.cos(angle), - sin = Math.sin(angle), - cx = x - x*cos + y*sin, - cy = y - x*sin - y*cos; - - return [ - cos*x1 - sin*y1 + cx, sin*x1 + cos*y1 + cy, - cos*x1 - sin*y2 + cx, sin*x1 + cos*y2 + cy, - cos*x2 - sin*y1 + cx, sin*x2 + cos*y1 + cy, - cos*x2 - sin*y2 + cx, sin*x2 + cos*y2 + cy - ]; -}; - -prototype.union = function(b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; -}; - -prototype.intersect = function(b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; -}; - -prototype.encloses = function(b) { - return b && ( - this.x1 <= b.x1 && - this.x2 >= b.x2 && - this.y1 <= b.y1 && - this.y2 >= b.y2 - ); -}; - -prototype.alignsWith = function(b) { - return b && ( - this.x1 == b.x1 || - this.x2 == b.x2 || - this.y1 == b.y1 || - this.y2 == b.y2 - ); -}; - -prototype.intersects = function(b) { - return b && !( - this.x2 < b.x1 || - this.x1 > b.x2 || - this.y2 < b.y1 || - this.y1 > b.y2 - ); -}; - -prototype.contains = function(x, y) { - return !( - x < this.x1 || - x > this.x2 || - y < this.y1 || - y > this.y2 - ); -}; - -prototype.width = function() { - return this.x2 - this.x1; -}; - -prototype.height = function() { - return this.y2 - this.y1; -}; diff --git a/node_modules/vega-scenegraph/src/CanvasHandler.js b/node_modules/vega-scenegraph/src/CanvasHandler.js deleted file mode 100644 index c856ecd..0000000 --- a/node_modules/vega-scenegraph/src/CanvasHandler.js +++ /dev/null @@ -1,208 +0,0 @@ -import Handler from './Handler'; -import Marks from './marks/index'; -import { - ClickEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, Events, - HrefEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, - MouseWheelEvent, TooltipHideEvent, TooltipShowEvent, - TouchEndEvent, TouchMoveEvent, TouchStartEvent -} from './util/events'; -import point from './util/point'; -import {domFind} from './util/dom'; -import {inherits} from 'vega-util'; - -export default function CanvasHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; -} - -const prototype = inherits(CanvasHandler, Handler); - -prototype.initialize = function(el, origin, obj) { - this._canvas = el && domFind(el, 'canvas'); - - // add minimal events required for proper state management - [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent] - .forEach(type => eventListenerCheck(this, type)); - - return Handler.prototype.initialize.call(this, el, origin, obj); -}; - -const eventBundle = type => ( - type === TouchStartEvent || - type === TouchMoveEvent || - type === TouchEndEvent -) -? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] -: [type]; - -// lazily add listeners to the canvas as needed -function eventListenerCheck(handler, type) { - eventBundle(type).forEach(_ => addEventListener(handler, _)); -} - -function addEventListener(handler, type) { - const canvas = handler.canvas(); - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] - ? evt => handler[type](evt) - : evt => handler.fire(type, evt) - ); - } -} - -// return the backing canvas instance -prototype.canvas = function() { - return this._canvas; -}; - -// retrieve the current canvas context -prototype.context = function() { - return this._canvas.getContext('2d'); -}; - -// supported events -prototype.events = Events; - -function move(moveEvent, overEvent, outEvent) { - return function(evt) { - const a = this._active, - p = this.pickEvent(evt); - - if (p === a) { - // active item and picked item are the same - this.fire(moveEvent, evt); // fire move - } else { - // active item and picked item are different - if (!a || !a.exit) { - // fire out for prior active item - // suppress if active item was removed from scene - this.fire(outEvent, evt); - } - this._active = p; // set new active item - this.fire(overEvent, evt); // fire over for new active item - this.fire(moveEvent, evt); // fire move for new active item - } - }; -} - -function inactive(type) { - return function(evt) { - this.fire(type, evt); - this._active = null; - }; -} - -// to keep old versions of firefox happy -prototype.DOMMouseScroll = function(evt) { - this.fire(MouseWheelEvent, evt); -}; - -prototype.mousemove = move(MouseMoveEvent, MouseOverEvent, MouseOutEvent); -prototype.dragover = move(DragOverEvent, DragEnterEvent, DragLeaveEvent); - -prototype.mouseout = inactive(MouseOutEvent); -prototype.dragleave = inactive(DragLeaveEvent); - -prototype.mousedown = function(evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); -}; - -prototype.click = function(evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } -}; - -prototype.touchstart = function(evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - - if (this._first) { - this._active = this._touch; - this._first = false; - } - - this.fire(TouchStartEvent, evt, true); -}; - -prototype.touchmove = function(evt) { - this.fire(TouchMoveEvent, evt, true); -}; - -prototype.touchend = function(evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; -}; - -// fire an event -prototype.fire = function(type, evt, touch) { - const a = touch ? this._touch : this._active, - h = this._handlers[type]; - - // set event type relative to scenegraph items - evt.vegaType = type; - - // handle hyperlinks and tooltips first - if (type === HrefEvent && a && a.href) { - this.handleHref(evt, a, a.href); - } else if (type === TooltipShowEvent || type === TooltipHideEvent) { - this.handleTooltip(evt, a, type !== TooltipHideEvent); - } - - // invoke all registered handlers - if (h) { - for (let i=0, len=h.length; i= 0) { - h.splice(i, 1); - } - - return this; -}; - -prototype.pickEvent = function(evt) { - const p = point(evt, this._canvas), - o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); -}; - -// find the scenegraph item at the current mouse position -// x, y -- the absolute x, y mouse coordinates on the canvas element -// gx, gy -- the relative coordinates within the current group -prototype.pick = function(scene, x, y, gx, gy) { - const g = this.context(), - mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); -}; diff --git a/node_modules/vega-scenegraph/src/CanvasRenderer.js b/node_modules/vega-scenegraph/src/CanvasRenderer.js deleted file mode 100644 index 9646d07..0000000 --- a/node_modules/vega-scenegraph/src/CanvasRenderer.js +++ /dev/null @@ -1,149 +0,0 @@ -import Renderer from './Renderer'; -import Bounds from './Bounds'; -import marks from './marks/index'; - -import {domClear} from './util/dom'; -import clip from './util/canvas/clip'; -import resize from './util/canvas/resize'; -import {canvas} from 'vega-canvas'; -import {error, inherits} from 'vega-util'; - -export default function CanvasRenderer(loader) { - Renderer.call(this, loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); -} - -const prototype = inherits(CanvasRenderer, Renderer), - base = Renderer.prototype; - -prototype.initialize = function(el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - - this._canvas = this._options.externalContext - ? null - : canvas(1, 1, this._options.type); // instantiate a small canvas - - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - this._canvas.setAttribute('class', 'marks'); - } - - // this method will invoke resize to size the canvas appropriately - return base.initialize.call(this, el, width, height, origin, scaleFactor); -}; - -prototype.resize = function(width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - - if (this._canvas) { - // configure canvas size and transform - resize(this._canvas, this._width, this._height, - this._origin, this._scale, this._options.context); - } else { - // external context needs to be scaled and positioned to origin - const ctx = this._options.externalContext; - if (!ctx) error('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - - this._redraw = true; - return this; -}; - -prototype.canvas = function() { - return this._canvas; -}; - -prototype.context = function() { - return this._options.externalContext - || (this._canvas ? this._canvas.getContext('2d') : null); -}; - -prototype.dirty = function(item) { - let b = this._tempb.clear().union(item.bounds), - g = item.mark.group; - - while (g) { - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; - } - - this._dirty.union(b); -}; - -function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); - - // align to base pixel grid in case of non-integer scaling (#2425) - if (g.pixelRatio % 1) { - b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - } - - // to avoid artifacts translate if origin has fractional pixels - b.translate(-(origin[0] % 1), -(origin[1] % 1)); - - // set clip path - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - - return b; -} - -const viewBounds = (origin, width, height) => new Bounds() - .set(0, 0, width, height) - .translate(-origin[0], -origin[1]); - -prototype._render = function(scene) { - const g = this.context(), - o = this._origin, - w = this._width, - h = this._height, - db = this._dirty, - vb = viewBounds(o, w, h); - - // setup - g.save(); - const b = this._redraw || db.empty() - ? (this._redraw = false, vb.expand(1)) - : clipToBounds(g, vb.intersect(db), o); - - this.clear(-o[0], -o[1], w, h); - - // render - this.draw(g, scene, b); - - // takedown - g.restore(); - db.clear(); - - return this; -}; - -prototype.draw = function(ctx, scene, bounds) { - const mark = marks[scene.marktype]; - if (scene.clip) clip(ctx, scene); - mark.draw.call(this, ctx, scene, bounds); - if (scene.clip) ctx.restore(); -}; - -prototype.clear = function(x, y, w, h) { - const opt = this._options, - g = this.context(); - - if (opt.type !== 'pdf' && !opt.externalContext) { - // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - } - - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } -}; diff --git a/node_modules/vega-scenegraph/src/Gradient.js b/node_modules/vega-scenegraph/src/Gradient.js deleted file mode 100644 index 5e3b74e..0000000 --- a/node_modules/vega-scenegraph/src/Gradient.js +++ /dev/null @@ -1,62 +0,0 @@ -var gradient_id = 0; - -export function resetSVGGradientId() { - gradient_id = 0; -} - -export const patternPrefix = 'p_'; - -export function isGradient(value) { - return value && value.gradient; -} - -export function gradientRef(g, defs, base) { - let id = g.id, - type = g.gradient, - prefix = type === 'radial' ? patternPrefix : ''; - - // check id, assign default values as needed - if (!id) { - id = g.id = 'gradient_' + (gradient_id++); - if (type === 'radial') { - g.x1 = get(g.x1, 0.5); - g.y1 = get(g.y1, 0.5); - g.r1 = get(g.r1, 0); - g.x2 = get(g.x2, 0.5); - g.y2 = get(g.y2, 0.5); - g.r2 = get(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get(g.x1, 0); - g.y1 = get(g.y1, 0); - g.x2 = get(g.x2, 1); - g.y2 = get(g.y2, 0); - } - } - - // register definition - defs[id] = g; - - // return url reference - return 'url(' + (base || '') + '#' + prefix + id + ')'; -} - -function get(val, def) { - return val != null ? val : def; -} - -export default function(p0, p1) { - var stops = [], gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function(offset, color) { - stops.push({offset: offset, color: color}); - return gradient; - } - }; -} diff --git a/node_modules/vega-scenegraph/src/GroupItem.js b/node_modules/vega-scenegraph/src/GroupItem.js deleted file mode 100644 index 2fe51d9..0000000 --- a/node_modules/vega-scenegraph/src/GroupItem.js +++ /dev/null @@ -1,9 +0,0 @@ -import Item from './Item'; -import {inherits} from 'vega-util'; - -export default function GroupItem(mark) { - Item.call(this, mark); - this.items = (this.items || []); -} - -inherits(GroupItem, Item); diff --git a/node_modules/vega-scenegraph/src/Handler.js b/node_modules/vega-scenegraph/src/Handler.js deleted file mode 100644 index 2dd16bd..0000000 --- a/node_modules/vega-scenegraph/src/Handler.js +++ /dev/null @@ -1,202 +0,0 @@ -import {domCreate} from './util/dom'; -import resolveItem from './util/resolveItem'; -import {loader} from 'vega-loader'; - -/** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ -export default function Handler(customLoader, customTooltip) { - this._active = null; - this._handlers = {}; - this._loader = customLoader || loader(); - this._tooltip = customTooltip || defaultTooltip; -} - -// The default tooltip display handler. -// Sets the HTML title attribute on the visualization container. -function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); -} - -const prototype = Handler.prototype; - -/** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ -prototype.initialize = function(el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); -}; - -/** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ -prototype.element = function() { - return this._el; -}; - -/** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ -prototype.canvas = function() { - return this._el && this._el.firstChild; -}; - -/** - * Get / set the origin coordinates of the visualization. - */ -prototype.origin = function(origin) { - if (arguments.length) { - this._origin = origin || [0, 0]; - return this; - } else { - return this._origin.slice(); - } -}; - -/** - * Get / set the scenegraph root. - */ -prototype.scene = function(scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; -}; - -/** - * Add an event handler. Subclasses should override this method. - */ -prototype.on = function(/*type, handler*/) {}; - -/** - * Remove an event handler. Subclasses should override this method. - */ -prototype.off = function(/*type, handler*/) {}; - -/** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ -prototype._handlerIndex = function(h, type, handler) { - for (let i = h ? h.length : 0; --i>=0;) { - if (h[i].type === type && (!handler || h[i].handler === handler)) { - return i; - } - } - return -1; -}; - -/** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ -prototype.handlers = function(type) { - const h = this._handlers, a = []; - if (type) { - a.push.apply(a, h[this.eventName(type)]); - } else { - for (const k in h) { a.push.apply(a, h[k]); } - } - return a; -}; - -/** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ -prototype.eventName = function(name) { - const i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); -}; - -/** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ -prototype.handleHref = function(event, item, href) { - this._loader - .sanitize(href, {context:'href'}) - .then(opt => { - const e = new MouseEvent(event.type, event), - a = domCreate(null, 'a'); - for (const name in opt) a.setAttribute(name, opt[name]); - a.dispatchEvent(e); - }) - .catch(function() { /* do nothing */ }); -}; - -/** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ -prototype.handleTooltip = function(event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - const value = (show && item && item.tooltip) || null; - this._tooltip.call(this._obj, this, event, item, value); - } -}; - -/** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ -prototype.getItemBoundingClientRect = function(item) { - const el = this.canvas(); - if (!el) return; - - const rect = el.getBoundingClientRect(), - origin = this._origin, - bounds = item.bounds, - width = bounds.width(), - height = bounds.height(); - - let x = bounds.x1 + origin[0] + rect.left, - y = bounds.y1 + origin[1] + rect.top; - - // translate coordinate for each parent group - while (item.mark && (item = item.mark.group)) { - x += item.x || 0; - y += item.y || 0; - } - - // return DOMRect-compatible bounding box - return { - x, y, width, height, - left: x, top: y, right: x + width, bottom: y + height - }; -}; diff --git a/node_modules/vega-scenegraph/src/Item.js b/node_modules/vega-scenegraph/src/Item.js deleted file mode 100644 index b5d8e19..0000000 --- a/node_modules/vega-scenegraph/src/Item.js +++ /dev/null @@ -1,6 +0,0 @@ -import Bounds from './Bounds'; - -export default function Item(mark) { - this.mark = mark; - this.bounds = (this.bounds || new Bounds()); -} diff --git a/node_modules/vega-scenegraph/src/Renderer.js b/node_modules/vega-scenegraph/src/Renderer.js deleted file mode 100644 index 56344ee..0000000 --- a/node_modules/vega-scenegraph/src/Renderer.js +++ /dev/null @@ -1,183 +0,0 @@ -import ResourceLoader from './ResourceLoader'; - -/** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ -export default function Renderer(loader) { - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); -} - -var prototype = Renderer.prototype; - -/** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ -prototype.initialize = function(el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); -}; - -/** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ -prototype.element = function() { - return this._el; -}; - -/** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ -prototype.canvas = function() { - return this._el && this._el.firstChild; -}; - -/** - * Get / set the background color. - */ -prototype.background = function(bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; -}; - -/** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ -prototype.resize = function(width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [0, 0]; - this._scale = scaleFactor || 1; - return this; -}; - -/** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ -prototype.dirty = function(/*item*/) { -}; - -/** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Renderer} - This renderer instance. - */ -prototype.render = function(scene) { - var r = this; - - // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - r._call = function() { r._render(scene); }; - - // invoke the renderer - r._call(); - - // clear the cached call for garbage collection - // async redraws will stash their own copy - r._call = null; - - return r; -}; - -/** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - */ -prototype._render = function(/*scene*/) { - // subclasses to override -}; - -/** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Promise} - A Promise that resolves when rendering is complete. - */ -prototype.renderAsync = function(scene) { - var r = this.render(scene); - return this._ready - ? this._ready.then(function() { return r; }) - : Promise.resolve(r); -}; - -/** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ -prototype._load = function(method, uri) { - var r = this, - p = r._loader[method](uri); - - if (!r._ready) { - // re-render the scene when loading completes - var call = r._call; - r._ready = r._loader.ready() - .then(function(redraw) { - if (redraw) call(); - r._ready = null; - }); - } - - return p; -}; - -/** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ -prototype.sanitizeURL = function(uri) { - return this._load('sanitizeURL', uri); -}; - -/** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ -prototype.loadImage = function(uri) { - return this._load('loadImage', uri); -}; diff --git a/node_modules/vega-scenegraph/src/ResourceLoader.js b/node_modules/vega-scenegraph/src/ResourceLoader.js deleted file mode 100644 index 4030f74..0000000 --- a/node_modules/vega-scenegraph/src/ResourceLoader.js +++ /dev/null @@ -1,79 +0,0 @@ -import {image} from 'vega-canvas'; -import {loader} from 'vega-loader'; -import {hasOwnProperty} from 'vega-util'; - -export default function ResourceLoader(customLoader) { - this._pending = 0; - this._loader = customLoader || loader(); -} - -var prototype = ResourceLoader.prototype; - -prototype.pending = function() { - return this._pending; -}; - -function increment(loader) { - loader._pending += 1; -} - -function decrement(loader) { - loader._pending -= 1; -} - -prototype.sanitizeURL = function(uri) { - var loader = this; - increment(loader); - - return loader._loader.sanitize(uri, {context:'href'}) - .then(function(opt) { - decrement(loader); - return opt; - }) - .catch(function() { - decrement(loader); - return null; - }); -}; - -prototype.loadImage = function(uri) { - const loader = this, - Image = image(); - increment(loader); - - return loader._loader - .sanitize(uri, {context: 'image'}) - .then(function(opt) { - const url = opt.href; - if (!url || !Image) throw {url: url}; - - const img = new Image(); - - // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - const cors = hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; - - // attempt to load image resource - img.onload = () => decrement(loader); - img.onerror = () => decrement(loader); - img.src = url; - - return img; - }) - .catch(function(e) { - decrement(loader); - return {complete: false, width: 0, height: 0, src: e && e.url || ''}; - }); -}; - -prototype.ready = function() { - var loader = this; - return new Promise(function(accept) { - function poll(value) { - if (!loader.pending()) accept(value); - else setTimeout(function() { poll(true); }, 10); - } - poll(false); - }); -}; diff --git a/node_modules/vega-scenegraph/src/SVGHandler.js b/node_modules/vega-scenegraph/src/SVGHandler.js deleted file mode 100644 index f401db0..0000000 --- a/node_modules/vega-scenegraph/src/SVGHandler.js +++ /dev/null @@ -1,83 +0,0 @@ -import Handler from './Handler'; -import {domFind} from './util/dom'; -import {HrefEvent, TooltipHideEvent, TooltipShowEvent} from './util/events'; -import {inherits} from 'vega-util'; - -export default function SVGHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - const h = this; - h._hrefHandler = listener(h, (evt, item) => { - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, (evt, item) => { - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); - }); -} - -const prototype = inherits(SVGHandler, Handler); - -prototype.initialize = function(el, origin, obj) { - let svg = this._svg; - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - this._svg = svg = el && domFind(el, 'svg'); - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - return Handler.prototype.initialize.call(this, el, origin, obj); -}; - -prototype.canvas = function() { - return this._svg; -}; - -// wrap an event listener for the SVG DOM -const listener = (context, handler) => evt => { - let item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); -}; - -// add an event handler -prototype.on = function(type, handler) { - const name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - const x = { - type, - handler, - listener: listener(this, handler) - }; - - (h[name] || (h[name] = [])).push(x); - if (this._svg) { - this._svg.addEventListener(name, x.listener); - } - } - - return this; -}; - -// remove an event handler -prototype.off = function(type, handler) { - const name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - if (this._svg) { - this._svg.removeEventListener(name, h[i].listener); - } - h.splice(i, 1); - } - - return this; -}; diff --git a/node_modules/vega-scenegraph/src/SVGRenderer.js b/node_modules/vega-scenegraph/src/SVGRenderer.js deleted file mode 100644 index 4b35c46..0000000 --- a/node_modules/vega-scenegraph/src/SVGRenderer.js +++ /dev/null @@ -1,613 +0,0 @@ -import Renderer from './Renderer'; -import {gradientRef, isGradient, patternPrefix} from './Gradient'; -import marks from './marks/index'; -import {ariaItemAttributes, ariaMarkAttributes} from './util/aria'; -import {cssClass, domChild, domClear, domCreate} from './util/dom'; -import {closeTag, openTag} from './util/tags'; -import {fontFamily, fontSize, lineHeight, textLines, textValue} from './util/text'; -import {visit} from './util/visit'; -import clip from './util/svg/clip'; -import metadata from './util/svg/metadata'; -import {rootAttributes, styles} from './util/svg/styles'; -import {inherits, isArray} from 'vega-util'; - -const RootIndex = 0, - ns = metadata.xmlns; - -export default function SVGRenderer(loader) { - Renderer.call(this, loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; -} - -var prototype = inherits(SVGRenderer, Renderer); -var base = Renderer.prototype; - -prototype.initialize = function(el, width, height, padding) { - // create the svg definitions cache - this._defs = { - gradient: {}, - clipping: {} - }; - - if (el) { - this._svg = domChild(el, 0, 'svg', ns); - this._svg.setAttribute('class', 'marks'); - domClear(el, 1); - - // set the svg root group - this._root = domChild(this._svg, RootIndex, 'g', ns); - for (const attr in rootAttributes) { - this._root.setAttribute(attr, rootAttributes[attr]); - } - - // ensure no additional child elements - domClear(this._svg, RootIndex + 1); - } - - // set background color if defined - this.background(this._bgcolor); - - return base.initialize.call(this, el, width, height, padding); -}; - -prototype.background = function(bgcolor) { - if (arguments.length && this._svg) { - this._svg.style.setProperty('background-color', bgcolor); - } - return base.background.apply(this, arguments); -}; - -prototype.resize = function(width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - - if (this._svg) { - this._svg.setAttribute('width', this._width * this._scale); - this._svg.setAttribute('height', this._height * this._scale); - this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height); - this._root.setAttribute('transform', 'translate(' + this._origin + ')'); - } - - this._dirty = []; - - return this; -}; - -prototype.canvas = function() { - return this._svg; -}; - -prototype.svg = function() { - if (!this._svg) return null; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - var bg = !this._bgcolor ? '' - : (openTag('rect', { - width: this._width, - height: this._height, - fill: this._bgcolor - }) + closeTag('rect')); - - return openTag('svg', attr) - + (this._defs.el ? this._defs.el.outerHTML : '') - + bg - + this._root.outerHTML - + closeTag('svg'); -}; - - -// -- Render entry point -- - -prototype._render = function(scene) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._resetDefs(); - this.draw(this._root, scene); - domClear(this._root, 1); - } - - this.updateDefs(); - - this._dirty = []; - ++this._dirtyID; - - return this; -}; - -// -- Manage SVG definitions ('defs') block -- - -prototype.updateDefs = function() { - const svg = this._svg, - defs = this._defs; - - let el = defs.el, - index = 0; - - for (const id in defs.gradient) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateGradient(el, defs.gradient[id], index); - } - - for (const id in defs.clipping) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateClipping(el, defs.clipping[id], index); - } - - // clean-up - if (el) { - index === 0 - ? (svg.removeChild(el), defs.el = null) - : domClear(el, index); - } -}; - -function updateGradient(el, grad, index) { - var i, n, stop; - - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - var pt = domChild(el, index++, 'pattern', ns); - pt.setAttribute('id', patternPrefix + grad.id); - pt.setAttribute('viewBox', '0,0,1,1'); - pt.setAttribute('width', '100%'); - pt.setAttribute('height', '100%'); - pt.setAttribute('preserveAspectRatio', 'xMidYMid slice'); - - pt = domChild(pt, 0, 'rect', ns); - pt.setAttribute('width', '1'); - pt.setAttribute('height', '1'); - pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')'); - - el = domChild(el, index++, 'radialGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('fx', grad.x1); - el.setAttribute('fy', grad.y1); - el.setAttribute('fr', grad.r1); - el.setAttribute('cx', grad.x2); - el.setAttribute('cy', grad.y2); - el.setAttribute( 'r', grad.r2); - } else { - el = domChild(el, index++, 'linearGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('x1', grad.x1); - el.setAttribute('x2', grad.x2); - el.setAttribute('y1', grad.y1); - el.setAttribute('y2', grad.y2); - } - - for (i=0, n=grad.stops.length; i { - const dirty = this.isDirty(item), - node = bind(item, parent, sibling, mdef.tag, svg); - - if (dirty) { - this._update(mdef, node, item); - if (isGroup) recurse(this, node, item); - } - - sibling = node; - ++i; - }; - - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } - - domClear(parent, i); - return parent; -}; - -// Recursively process group contents. -function recurse(renderer, el, group) { - el = el.lastChild.previousSibling; - let prev, idx = 0; - - visit(group, item => { - prev = renderer.draw(el, item, prev); - ++idx; - }); - - // remove any extraneous DOM elements - domClear(el, 1 + idx); -} - -// Bind a scenegraph item to an SVG DOM element. -// Create new SVG elements as needed. -function bind(item, el, sibling, tag, svg) { - let node = item._svg, doc; - - // create a new dom node if needed - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, ns); - item._svg = node; - - if (item.mark) { - node.__data__ = item; - node.__values__ = {fill: 'default'}; - - // if group, create background, content, and foreground elements - if (tag === 'g') { - const bg = domCreate(doc, 'path', ns); - node.appendChild(bg); - bg.__data__ = item; - - const cg = domCreate(doc, 'g', ns); - node.appendChild(cg); - cg.__data__ = item; - - const fg = domCreate(doc, 'path', ns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = {fill: 'default'}; - } - } - } - - // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { - el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - } - - return node; -} - -function siblingCheck(node, sibling) { - return node.parentNode - && node.parentNode.childNodes.length > 1 - && node.previousSibling != sibling; // treat null/undefined the same -} - - -// -- Set attributes & styles on SVG elements --- - -var element = null, // temp var for current SVG element - values = null; // temp var for current values hash - -// Extra configuration for certain mark types -var mark_extras = { - group: function(mdef, el, item) { - const fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - - values = el.__values__; // use parent's values hash - element = el.childNodes[1]; - mdef.content(emit, item, this); - - const bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - - const value = item.mark.interactive === false ? 'none' : null; - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - - if (item.strokeForeground && item.stroke) { - const fill = item.fill; - setAttribute(fg, 'display', null); - - // set style of background - this.style(bg, item); - setAttribute(bg, 'stroke', null); - - // set style of foreground - if (fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (fill) item.fill = fill; - - // leave element null to prevent downstream styling - element = null; - } else { - // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - } - }, - image: function(mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else { - setStyle(el, 'image-rendering', null); - } - }, - text: function(mdef, el, item) { - let tl = textLines(item), - key, value, doc, lh; - - if (isArray(tl)) { - // multi-line text - value = tl.map(_ => textValue(item, _)); - key = value.join('\n'); // content cache key - - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach((t, i) => { - const ts = domCreate(doc, 'tspan', ns); - ts.__data__ = item; // data binding - ts.textContent = t; - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } -}; - -function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) { - el.style.removeProperty(name); - } else { - el.style.setProperty(name, value + ''); - } - values[name] = value; - } -} - -prototype._update = function(mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; - - // apply aria-specific properties - ariaItemAttributes(emit, item); - - // apply svg attributes - mdef.attr(emit, item, this); - - // some marks need special treatment - const extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); - - // apply svg style attributes - // note: element may be modified by 'extra' method - if (element) this.style(element, item); -}; - -function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; - - // use appropriate method given namespace (ns) - if (ns) { - setAttributeNS(element, name, value, ns); - } else { - setAttribute(element, name, value); - } - - // note current value for future comparison - values[name] = value; -} - -function setAttribute(el, name, value) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttribute(name, value); - } else { - // else remove DOM attribute - el.removeAttribute(name); - } -} - -function setAttributeNS(el, name, value, ns) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - } else { - // else remove DOM attribute - el.removeAttributeNS(ns, name); - } -} - -prototype.style = function(el, o) { - if (o == null) return; - - for (const prop in styles) { - let value = prop === 'font' ? fontFamily(o) : o[prop]; - if (value === values[prop]) continue; - - const name = styles[prop]; - if (value == null) { - el.removeAttribute(name); - } else { - if (isGradient(value)) { - value = gradientRef(value, this._defs.gradient, href()); - } - el.setAttribute(name, value + ''); - } - - values[prop] = value; - } -}; - -function href() { - let loc; - return typeof window === 'undefined' ? '' - : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) - : loc.href; -} diff --git a/node_modules/vega-scenegraph/src/SVGStringRenderer.js b/node_modules/vega-scenegraph/src/SVGStringRenderer.js deleted file mode 100644 index e6f3dfa..0000000 --- a/node_modules/vega-scenegraph/src/SVGStringRenderer.js +++ /dev/null @@ -1,365 +0,0 @@ -import Renderer from './Renderer'; -import {gradientRef, isGradient, patternPrefix} from './Gradient'; -import marks from './marks/index'; -import {ariaItemAttributes, ariaMarkAttributes} from './util/aria'; -import {cssClass} from './util/dom'; -import {closeTag, openTag} from './util/tags'; -import {fontFamily, fontSize, lineHeight, textLines, textValue} from './util/text'; -import {visit} from './util/visit'; -import clip from './util/svg/clip'; -import metadata from './util/svg/metadata'; -import {rootAttributes, styles} from './util/svg/styles'; -import {extend, inherits, isArray} from 'vega-util'; - -export default function SVGStringRenderer(loader) { - Renderer.call(this, loader); - - this._text = { - head: '', - bg: '', - root: '', - foot: '', - defs: '', - body: '' - }; - - this._defs = { - gradient: {}, - clipping: {} - }; -} - -var prototype = inherits(SVGStringRenderer, Renderer); -var base = Renderer.prototype; - -prototype.resize = function(width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - var o = this._origin, - t = this._text; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - t.head = openTag('svg', attr); - - var bg = this._bgcolor; - if (bg === 'transparent' || bg === 'none') bg = null; - - if (bg) { - t.bg = openTag('rect', { - width: this._width, - height: this._height, - fill: bg - }) + closeTag('rect'); - } else { - t.bg = ''; - } - - t.root = openTag('g', extend( - {}, rootAttributes, {transform: 'translate(' + o + ')'} - )); - - t.foot = closeTag('g') + closeTag('svg'); - - return this; -}; - -prototype.background = function() { - var rv = base.background.apply(this, arguments); - if (arguments.length && this._text.head) { - this.resize(this._width, this._height, this._origin, this._scale); - } - return rv; -}; - -prototype.svg = function() { - var t = this._text; - return t.head + t.defs + t.bg + t.root + t.body + t.foot; -}; - -prototype._render = function(scene) { - this._text.body = this.mark(scene); - this._text.defs = this.buildDefs(); - return this; -}; - -prototype.buildDefs = function() { - let defs = '', tag; - - for (const id in this._defs.gradient) { - const def = this._defs.gradient[id], - stops = def.stops; - - if (def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - - defs += openTag(tag = 'pattern', { - id: patternPrefix + id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - - defs += openTag('rect', { - width: '1', - height: '1', - fill: 'url(#' + id + ')' - }) + closeTag('rect'); - - defs += closeTag(tag); - - defs += openTag(tag = 'radialGradient', { - id: id, - fx: def.x1, - fy: def.y1, - fr: def.r1, - cx: def.x2, - cy: def.y2, - r: def.r2 - }); - } else { - defs += openTag(tag = 'linearGradient', { - id: id, - x1: def.x1, - x2: def.x2, - y1: def.y1, - y2: def.y2 - }); - } - - for (let i = 0; i < stops.length; ++i) { - defs += openTag('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }) + closeTag('stop'); - } - - defs += closeTag(tag); - } - - for (const id in this._defs.clipping) { - const def = this._defs.clipping[id]; - - defs += openTag('clipPath', {id: id}); - - if (def.path) { - defs += openTag('path', { - d: def.path - }) + closeTag('path'); - } else { - defs += openTag('rect', { - x: 0, - y: 0, - width: def.width, - height: def.height - }) + closeTag('rect'); - } - - defs += closeTag('clipPath'); - } - - return defs ? (openTag('defs') + defs + closeTag('defs')) : ''; -}; - -prototype.attr = function(scene, item, attrs, tag) { - const object = {}, - emit = (name, value, ns, prefixed) => { - object[prefixed || name] = value; - }; - - // apply mark specific attributes - if (Array.isArray(attrs)) { - attrs.forEach(fn => fn(emit, item, this)); - } else { - attrs(emit, item, this); - } - - // apply style attributes - if (tag) { - applyStyles(object, item, scene, tag, this._defs); - } - - return object; -}; - -prototype.href = function(item) { - var that = this, - href = item.href, - attr; - - if (href) { - if (attr = that._hrefs && that._hrefs[href]) { - return attr; - } else { - that.sanitizeURL(href).then(attr => { - // rewrite to use xlink namespace - // note that this will be deprecated in SVG 2.0 - attr['xlink:href'] = attr.href; - attr.href = null; - (that._hrefs || (that._hrefs = {}))[href] = attr; - }); - } - } - return null; -}; - -prototype.mark = function(scene) { - const mdef = marks[scene.marktype], - tag = mdef.tag, - attrList = [ariaItemAttributes, mdef.attr]; - - let str = ''; - - // render opening group tag - str += openTag('g', extend( - { - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip(this, scene, scene.group) : null - }, - ariaMarkAttributes(scene), - { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - } - )); - - // render contained elements - const process = item => { - const href = this.href(item); - if (href) str += openTag('a', href); - - str += openTag( - tag, - this.attr(scene, item, attrList, tag !== 'g' ? tag : null) - ); - - if (tag === 'text') { - const tl = textLines(item); - if (isArray(tl)) { - // multi-line text - const attrs = {x: 0, dy: lineHeight(item)}; - for (let i=0; i { str += this.mark(item); }); - return str; -}; - -function applyStyles(s, item, scene, tag, defs) { - if (item == null) return s; - - if (tag === 'bgrect' && scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - if (tag === 'bgfore') { - if (scene.interactive === false) { - s['pointer-events'] = 'none'; - } - s.display = 'none'; - if (item.fill !== null) return s; - } - - if (tag === 'image' && item.smooth === false) { - s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;'; - } - - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - if (item.fontStyle) s['font-style'] = item.fontStyle; - if (item.fontVariant) s['font-variant'] = item.fontVariant; - if (item.fontWeight) s['font-weight'] = item.fontWeight; - } - - for (const prop in styles) { - let value = item[prop]; - const name = styles[prop]; - - if (value === 'transparent' && (name === 'fill' || name === 'stroke')) { - // transparent is not a legal SVG value - // we can skip it to rely on default 'none' instead - } else if (value != null) { - if (isGradient(value)) { - value = gradientRef(value, defs.gradient, ''); - } - s[name] = value; - } - } - - return s; -} - -function escape_text(s) { - return s.replace(/&/g, '&') - .replace(//g, '>'); -} diff --git a/node_modules/vega-scenegraph/src/Scenegraph.js b/node_modules/vega-scenegraph/src/Scenegraph.js deleted file mode 100644 index 4a887b2..0000000 --- a/node_modules/vega-scenegraph/src/Scenegraph.js +++ /dev/null @@ -1,54 +0,0 @@ -import Bounds from './Bounds'; -import GroupItem from './GroupItem'; -import {sceneFromJSON, sceneToJSON} from './util/serialize'; - -export default function Scenegraph(scene) { - if (arguments.length) { - this.root = sceneFromJSON(scene); - } else { - this.root = createMark({ - marktype: 'group', - name: 'root', - role: 'frame' - }); - this.root.items = [new GroupItem(this.root)]; - } -} - -var prototype = Scenegraph.prototype; - -prototype.toJSON = function(indent) { - return sceneToJSON(this.root, indent || 0); -}; - -prototype.mark = function(markdef, group, index) { - group = group || this.root.items[0]; - var mark = createMark(markdef, group); - group.items[index] = mark; - if (mark.zindex) mark.group.zdirty = true; - return mark; -}; - -function createMark(def, group) { - const mark = { - bounds: new Bounds(), - clip: !!def.clip, - group: group, - interactive: def.interactive === false ? false : true, - items: [], - marktype: def.marktype, - name: def.name || undefined, - role: def.role || undefined, - zindex: def.zindex || 0 - }; - - // add accessibility properties if defined - if (def.aria != null) { - mark.aria = def.aria; - } - if (def.description) { - mark.description = def.description; - } - - return mark; -} diff --git a/node_modules/vega-scenegraph/src/bound/boundClip.js b/node_modules/vega-scenegraph/src/bound/boundClip.js deleted file mode 100644 index 62e5dd5..0000000 --- a/node_modules/vega-scenegraph/src/bound/boundClip.js +++ /dev/null @@ -1,17 +0,0 @@ -import Bounds from '../Bounds'; -import boundContext from './boundContext'; -import {isFunction} from 'vega-util'; - -var clipBounds = new Bounds(); - -export default function(mark) { - var clip = mark.clip; - - if (isFunction(clip)) { - clip(boundContext(clipBounds.clear())); - } else if (clip) { - clipBounds.set(0, 0, mark.group.width, mark.group.height); - } else return; - - mark.bounds.intersect(clipBounds); -} diff --git a/node_modules/vega-scenegraph/src/bound/boundContext.js b/node_modules/vega-scenegraph/src/bound/boundContext.js deleted file mode 100644 index 8ff6ce3..0000000 --- a/node_modules/vega-scenegraph/src/bound/boundContext.js +++ /dev/null @@ -1,119 +0,0 @@ -import {Epsilon, HalfPi, Tau} from '../util/constants'; - -var bounds, lx, ly, - circleThreshold = Tau - 1e-8; - -export default function context(_) { - bounds = _; - return context; -} - -function noop() {} - -function add(x, y) { bounds.add(x, y); } - -function addL(x, y) { add(lx = x, ly = y); } - -function addX(x) { add(x, bounds.y1); } - -function addY(y) { add(bounds.x1, y); } - -context.beginPath = noop; - -context.closePath = noop; - -context.moveTo = addL; - -context.lineTo = addL; - -context.rect = function(x, y, w, h) { - add(x + w, y + h); - addL(x, y); -}; - -context.quadraticCurveTo = function(x1, y1, x2, y2) { - quadExtrema(lx, x1, x2, addX); - quadExtrema(ly, y1, y2, addY); - addL(x2, y2); -}; - -function quadExtrema(x0, x1, x2, cb) { - const t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); -} - -context.bezierCurveTo = function(x1, y1, x2, y2, x3, y3) { - cubicExtrema(lx, x1, x2, x3, addX); - cubicExtrema(ly, y1, y2, y3, addY); - addL(x3, y3); -}; - -function cubicExtrema(x0, x1, x2, x3, cb) { - const a = x3 - x0 + 3 * x1 - 3 * x2, - b = x0 + x2 - 2 * x1, - c = x0 - x1; - - let t0 = 0, t1 = 0, r; - - // solve for parameter t - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else { - // linear equation - t0 = 0.5 * c / b; - } - - // calculate position - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); -} - -function cubic(t, x0, x1, x2, x3) { - const s = 1 - t, s2 = s * s, t2 = t * t; - return (s2 * s * x0) + (3 * s2 * t * x1) + (3 * s * t2 * x2) + (t2 * t * x3); -} - -context.arc = function(cx, cy, r, sa, ea, ccw) { - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add(cx - r, cy - r); - add(cx + r, cy + r); - } else { - const update = a => add(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - let s, i; - - // sample end points - update(sa); - update(ea); - - // sample interior points aligned with 90 degrees - if (ea !== sa) { - sa = sa % Tau; if (sa < 0) sa += Tau; - ea = ea % Tau; if (ea < 0) ea += Tau; - - if (ea < sa) { - ccw = !ccw; // flip direction - s = sa; sa = ea; ea = s; // swap end-points - } - - if (ccw) { - ea -= Tau; - s = sa - (sa % HalfPi); - for (i=0; i<4 && s>ea; ++i, s-=HalfPi) update(s); - } else { - s = sa - (sa % HalfPi) + HalfPi; - for (i=0; i<4 && s 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) - : 0; -} - -function attr(emit, item) { - emit('transform', translateItem(item)); -} - -function emitRectangle(emit, item) { - const off = offset(item); - emit('d', rectangle(null, item, off, off)); -} - -function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); -} - -function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - if (item.strokeForeground) { - emitRectangle(emit, item); - } else { - emit('d', ''); - } -} - -function content(emit, item, renderer) { - const url = item.clip ? clip(renderer, item, item) : null; - emit('clip-path', url); -} - -function bound(bounds, group) { - if (!group.clip && group.items) { - const items = group.items, m = items.length; - for (let j=0; j { - const gx = group.x || 0, - gy = group.y || 0, - fore = group.strokeForeground, - opacity = group.opacity == null ? 1 : group.opacity; - - // draw group background - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (group.fill && fill(context, group, opacity)) { - context.fill(); - } - if (group.stroke && !fore && stroke(context, group, opacity)) { - context.stroke(); - } - } - - // setup graphics context, set clip and bounds - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); - - // draw group contents - visit(group, item => { - this.draw(context, item, bounds); - }); - - // restore graphics context - if (bounds) bounds.translate(gx, gy); - context.restore(); - - // draw group foreground - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (stroke(context, group, opacity)) { - context.stroke(); - } - } - }); -} - -function pick(context, scene, x, y, gx, gy) { - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { - return null; - } - - const cx = x * context.pixelRatio, - cy = y * context.pixelRatio; - - return pickVisit(scene, group => { - let hit, fore, ix, dx, dy, dw, dh, b, c; - - // first hit test bounding box - b = group.bounds; - if (b && !b.contains(gx, gy)) return; - - // passed bounds check, test rectangular clip - dx = group.x || 0; - dy = group.y || 0; - dw = dx + (group.width || 0); - dh = dy + (group.height || 0); - c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; - - // adjust coordinate system - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; - - // test background for rounded corner clip - if (c && hasCornerRadius(group) && !hitBackground(context, group, cx, cy)) { - context.restore(); - return null; - } - - fore = group.strokeForeground; - ix = scene.interactive !== false; - - // hit test against group foreground - if (ix && fore && group.stroke - && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } - - // hit test against contained marks - hit = pickVisit(group, mark => pickMark(mark, dx, dy) - ? this.pick(mark, x, y, dx, dy) - : null - ); - - // hit test against group background - if (!hit && ix && (group.fill || (!fore && group.stroke)) - && hitBackground(context, group, cx, cy)) { - hit = group; - } - - // restore state and return - context.restore(); - return hit || null; - }); -} - -function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') - && mark.bounds && mark.bounds.contains(x, y); -} - -export default { - type: 'group', - tag: 'g', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick, - isect: intersectRect, - content: content, - background: background, - foreground: foreground -}; diff --git a/node_modules/vega-scenegraph/src/marks/image.js b/node_modules/vega-scenegraph/src/marks/image.js deleted file mode 100644 index a2c7dd2..0000000 --- a/node_modules/vega-scenegraph/src/marks/image.js +++ /dev/null @@ -1,115 +0,0 @@ -import {visit} from '../util/visit'; -import blend from '../util/canvas/blend'; -import {pick} from '../util/canvas/pick'; -import metadata from '../util/svg/metadata'; -import {translate} from '../util/svg/transform'; -import {truthy} from 'vega-util'; - -function getImage(item, renderer) { - var image = item.image; - if (!image || item.url && item.url !== image.url) { - image = {complete: false, width: 0, height: 0}; - renderer.loadImage(item.url).then(image => { - item.image = image; - item.image.url = item.url; - }); - } - return image; -} - -function imageWidth(item, image) { - return item.width != null ? item.width - : !image || !image.width ? 0 - : item.aspect !== false && item.height ? item.height * image.width / image.height - : image.width; -} - -function imageHeight(item, image) { - return item.height != null ? item.height - : !image || !image.height ? 0 - : item.aspect !== false && item.width ? item.width * image.height / image.width - : image.height; -} - -function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; -} - -function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; -} - -function attr(emit, item, renderer) { - const img = getImage(item, renderer), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); -} - -function bound(bounds, item) { - const img = item.image, - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h); - - return bounds.set(x, y, x + w, y + h); -} - -function draw(context, scene, bounds) { - visit(scene, item => { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - let img = getImage(item, this), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - opacity, ar0, ar1, t; - - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); -} - -export default { - type: 'image', - tag: 'image', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick(), - isect: truthy, // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset -}; diff --git a/node_modules/vega-scenegraph/src/marks/index.js b/node_modules/vega-scenegraph/src/marks/index.js deleted file mode 100644 index 532408a..0000000 --- a/node_modules/vega-scenegraph/src/marks/index.js +++ /dev/null @@ -1,27 +0,0 @@ -import arc from './arc'; -import area from './area'; -import group from './group'; -import image from './image'; -import line from './line'; -import path from './path'; -import rect from './rect'; -import rule from './rule'; -import shape from './shape'; -import symbol from './symbol'; -import text from './text'; -import trail from './trail'; - -export default { - arc: arc, - area: area, - group: group, - image: image, - line: line, - path: path, - rect: rect, - rule: rule, - shape: shape, - symbol: symbol, - text: text, - trail: trail -}; diff --git a/node_modules/vega-scenegraph/src/marks/line.js b/node_modules/vega-scenegraph/src/marks/line.js deleted file mode 100644 index 9f3552b..0000000 --- a/node_modules/vega-scenegraph/src/marks/line.js +++ /dev/null @@ -1,5 +0,0 @@ -import {line} from '../path/shapes'; -import {pickLine} from '../util/pickPath'; -import markMultiItemPath from './markMultiItemPath'; - -export default markMultiItemPath('line', line, pickLine); diff --git a/node_modules/vega-scenegraph/src/marks/markItemPath.js b/node_modules/vega-scenegraph/src/marks/markItemPath.js deleted file mode 100644 index 0712c0a..0000000 --- a/node_modules/vega-scenegraph/src/marks/markItemPath.js +++ /dev/null @@ -1,53 +0,0 @@ -import boundStroke from '../bound/boundStroke'; -import context from '../bound/boundContext'; -import {intersectPath} from '../util/intersect'; -import {drawAll} from '../util/canvas/draw'; -import {pickPath} from '../util/canvas/pick'; -import {transformItem} from '../util/svg/transform'; -import {DegToRad} from '../util/constants'; - -export default function(type, shape, isect) { - - function attr(emit, item) { - emit('transform', transformItem(item)); - emit('d', shape(null, item)); - } - - function bound(bounds, item) { - var x = item.x || 0, - y = item.y || 0; - - shape(context(bounds), item); - boundStroke(bounds, item).translate(x, y); - if (item.angle) { - bounds.rotate(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw(context, item) { - var x = item.x || 0, - y = item.y || 0, - a = item.angle || 0; - - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); - } - - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; - -} diff --git a/node_modules/vega-scenegraph/src/marks/markMultiItemPath.js b/node_modules/vega-scenegraph/src/marks/markMultiItemPath.js deleted file mode 100644 index 1078056..0000000 --- a/node_modules/vega-scenegraph/src/marks/markMultiItemPath.js +++ /dev/null @@ -1,58 +0,0 @@ -import boundStroke from '../bound/boundStroke'; -import context from '../bound/boundContext'; -import {intersectPoint} from '../util/intersect'; -import {drawOne} from '../util/canvas/draw'; -import {hitPath} from '../util/canvas/pick'; - -export default function(type, shape, tip) { - - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - - function bound(bounds, mark) { - var items = mark.items; - if (items.length === 0) { - return bounds; - } else { - shape(context(bounds), items); - return boundStroke(bounds, items[0]); - } - } - - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - - var hit = hitPath(draw); - - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, - b = scene.bounds; - - if (!items || !items.length || b && !b.contains(gx, gy)) { - return null; - } - - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; - } - - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; - -} - - diff --git a/node_modules/vega-scenegraph/src/marks/path.js b/node_modules/vega-scenegraph/src/marks/path.js deleted file mode 100644 index 0346f9f..0000000 --- a/node_modules/vega-scenegraph/src/marks/path.js +++ /dev/null @@ -1,68 +0,0 @@ -import boundStroke from '../bound/boundStroke'; -import context from '../bound/boundContext'; -import pathParse from '../path/parse'; -import pathRender from '../path/render'; -import {intersectPath} from '../util/intersect'; -import {drawAll} from '../util/canvas/draw'; -import {pickPath} from '../util/canvas/pick'; -import {transformItem} from '../util/svg/transform'; -import {DegToRad} from '../util/constants'; - -function attr(emit, item) { - var sx = item.scaleX || 1, - sy = item.scaleY || 1; - if (sx !== 1 || sy !== 1) { - emit('vector-effect', 'non-scaling-stroke'); - } - emit('transform', transformItem(item)); - emit('d', item.path); -} - -function path(context, item) { - var path = item.path; - if (path == null) return true; - - var x = item.x || 0, - y = item.y || 0, - sx = item.scaleX || 1, - sy = item.scaleY || 1, - a = (item.angle || 0) * DegToRad, - cache = item.pathCache; - - if (!cache || cache.path !== path) { - (item.pathCache = cache = pathParse(path)).path = path; - } - - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else { - pathRender(context, cache, x, y, sx, sy); - } -} - -function bound(bounds, item) { - path(context(bounds), item) - ? bounds.set(0, 0, 0, 0) - : boundStroke(bounds, item, true); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, item.x || 0, item.y || 0); - } - - return bounds; -} - -export default { - type: 'path', - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(path), - pick: pickPath(path), - isect: intersectPath(path) -}; diff --git a/node_modules/vega-scenegraph/src/marks/rect.js b/node_modules/vega-scenegraph/src/marks/rect.js deleted file mode 100644 index 7999adc..0000000 --- a/node_modules/vega-scenegraph/src/marks/rect.js +++ /dev/null @@ -1,35 +0,0 @@ -import boundStroke from '../bound/boundStroke'; -import {rectangle} from '../path/shapes'; -import {intersectRect} from '../util/intersect'; -import {drawAll} from '../util/canvas/draw'; -import {pickPath} from '../util/canvas/pick'; - -function attr(emit, item) { - emit('d', rectangle(null, item)); -} - -function bound(bounds, item) { - var x, y; - return boundStroke(bounds.set( - x = item.x || 0, - y = item.y || 0, - (x + item.width) || 0, - (y + item.height) || 0 - ), item); -} - -function draw(context, item) { - context.beginPath(); - rectangle(context, item); -} - -export default { - type: 'rect', - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: intersectRect -}; diff --git a/node_modules/vega-scenegraph/src/marks/rule.js b/node_modules/vega-scenegraph/src/marks/rule.js deleted file mode 100644 index d4df24f..0000000 --- a/node_modules/vega-scenegraph/src/marks/rule.js +++ /dev/null @@ -1,66 +0,0 @@ -import boundStroke from '../bound/boundStroke'; -import {intersectRule} from '../util/intersect'; -import {visit} from '../util/visit'; -import blend from '../util/canvas/blend'; -import {pick} from '../util/canvas/pick'; -import stroke from '../util/canvas/stroke'; -import {translateItem} from '../util/svg/transform'; - -function attr(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); -} - -function bound(bounds, item) { - var x1, y1; - return boundStroke(bounds.set( - x1 = item.x || 0, - y1 = item.y || 0, - item.x2 != null ? item.x2 : x1, - item.y2 != null ? item.y2 : y1 - ), item); -} - -function path(context, item, opacity) { - var x1, y1, x2, y2; - - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - return false; -} - -function draw(context, scene, bounds) { - visit(scene, function(item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity && path(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); -} - -function hit(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path(context, item, 1) && context.isPointInStroke(x, y); -} - -export default { - type: 'rule', - tag: 'line', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick(hit), - isect: intersectRule -}; diff --git a/node_modules/vega-scenegraph/src/marks/shape.js b/node_modules/vega-scenegraph/src/marks/shape.js deleted file mode 100644 index f22f368..0000000 --- a/node_modules/vega-scenegraph/src/marks/shape.js +++ /dev/null @@ -1,4 +0,0 @@ -import {shape} from '../path/shapes'; -import markItemPath from './markItemPath'; - -export default markItemPath('shape', shape); diff --git a/node_modules/vega-scenegraph/src/marks/symbol.js b/node_modules/vega-scenegraph/src/marks/symbol.js deleted file mode 100644 index 597698b..0000000 --- a/node_modules/vega-scenegraph/src/marks/symbol.js +++ /dev/null @@ -1,5 +0,0 @@ -import {symbol} from '../path/shapes'; -import {intersectPoint} from '../util/intersect'; -import markItemPath from './markItemPath'; - -export default markItemPath('symbol', symbol, intersectPoint); diff --git a/node_modules/vega-scenegraph/src/marks/text.js b/node_modules/vega-scenegraph/src/marks/text.js deleted file mode 100644 index 2735708..0000000 --- a/node_modules/vega-scenegraph/src/marks/text.js +++ /dev/null @@ -1,184 +0,0 @@ -import Bounds from '../Bounds'; -import {DegToRad, HalfPi} from '../util/constants'; -import {font, lineHeight, offset, textLines, textMetrics, textValue} from '../util/text'; -import {intersectBoxLine} from '../util/intersect'; -import {visit} from '../util/visit'; -import blend from '../util/canvas/blend'; -import fill from '../util/canvas/fill'; -import {pick} from '../util/canvas/pick'; -import stroke from '../util/canvas/stroke'; -import {rotate, translate} from '../util/svg/transform'; -import {isArray} from 'vega-util'; - -var textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' -}; - -var tempBounds = new Bounds(); - -function anchorPoint(item) { - var x = item.x || 0, - y = item.y || 0, - r = item.radius || 0, t; - - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; -} - -function attr(emit, item) { - var dx = item.dx || 0, - dy = (item.dy || 0) + offset(item), - p = anchorPoint(item), - x = p.x1, - y = p.y1, - a = item.angle || 0, t; - - emit('text-anchor', textAlign[item.align] || 'start'); - - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else { - t = translate(x + dx, y + dy); - } - emit('transform', t); -} - -function bound(bounds, item, mode) { - var h = textMetrics.height(item), - a = item.align, - p = anchorPoint(item), - x = p.x1, - y = p.y1, - dx = item.dx || 0, - dy = (item.dy || 0) + offset(item) - Math.round(0.8*h), // use 4/5 offset - tl = textLines(item), - w; - - // get dimensions - if (isArray(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce((w, t) => Math.max(w, textMetrics.width(item, t)), 0); - } else { - // single-line text - w = textMetrics.width(item, tl); - } - - // horizontal alignment - if (a === 'center') { - dx -= (w / 2); - } else if (a === 'right') { - dx -= w; - } else { - // left by default, do nothing - } - - bounds.set(dx+=x, dy+=y, dx+w, dy+h); - - if (item.angle && !mode) { - bounds.rotate(item.angle * DegToRad, x, y); - } else if (mode === 2) { - return bounds.rotatedPoints(item.angle * DegToRad, x, y); - } - return bounds; -} - -function draw(context, scene, bounds) { - visit(scene, function(item) { - var opacity = item.opacity == null ? 1 : item.opacity, - p, x, y, i, lh, tl, str; - - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || - item.text == null || item.text.length === 0) return; - - context.font = font(item); - context.textAlign = item.align || 'left'; - - p = anchorPoint(item); - x = p.x1, - y = p.y1; - - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - x += (item.dx || 0); - y += (item.dy || 0) + offset(item); - - tl = textLines(item); - blend(context, item); - if (isArray(tl)) { - lh = lineHeight(item); - for (i=0; i 1) { - modules[name] = _; - return this; - } else { - return modules[name]; - } -} diff --git a/node_modules/vega-scenegraph/src/path/arc.js b/node_modules/vega-scenegraph/src/path/arc.js deleted file mode 100644 index 7745ac8..0000000 --- a/node_modules/vega-scenegraph/src/path/arc.js +++ /dev/null @@ -1,107 +0,0 @@ -import {DegToRad, HalfPi, Tau} from '../util/constants'; - -export var segmentCache = {}; -export var bezierCache = {}; - -var join = [].join; - -// Copied from Inkscape svgtopdf, thanks! -export function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) { - var key = join.call(arguments); - if (segmentCache[key]) { - return segmentCache[key]; - } - - var th = rotateX * DegToRad; - var sin_th = Math.sin(th); - var cos_th = Math.cos(th); - rx = Math.abs(rx); - ry = Math.abs(ry); - var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5; - var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5; - var pl = (px*px) / (rx*rx) + (py*py) / (ry*ry); - if (pl > 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - - var a00 = cos_th / rx; - var a01 = sin_th / rx; - var a10 = (-sin_th) / ry; - var a11 = (cos_th) / ry; - var x0 = a00 * ox + a01 * oy; - var y0 = a10 * ox + a11 * oy; - var x1 = a00 * x + a01 * y; - var y1 = a10 * x + a11 * y; - - var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0); - var sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - var sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0); - var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0); - - var th0 = Math.atan2(y0-yc, x0-xc); - var th1 = Math.atan2(y1-yc, x1-xc); - - var th_arc = th1-th0; - if (th_arc < 0 && sweep === 1) { - th_arc += Tau; - } else if (th_arc > 0 && sweep === 0) { - th_arc -= Tau; - } - - var segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - var result = []; - for (var i=0; i len) { - for (j=1, m=parsed.length; j +_; -} - -function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); -} - -export default function() { - var x = rectangleX, - y = rectangleY, - width = rectangleWidth, - height = rectangleHeight, - crTL = number(0), - crTR = crTL, - crBL = crTL, - crBR = crTL, - context = null; - - function rectangle(_, x0, y0) { - var buffer, - x1 = x0 != null ? x0 : +x.call(this, _), - y1 = y0 != null ? y0 : +y.call(this, _), - w = +width.call(this, _), - h = +height.call(this, _), - s = Math.min(w, h) / 2, - tl = clamp(+crTL.call(this, _), 0, s), - tr = clamp(+crTR.call(this, _), 0, s), - bl = clamp(+crBL.call(this, _), 0, s), - br = clamp(+crBR.call(this, _), 0, s); - - if (!context) context = buffer = path(); - - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) { - context.rect(x1, y1, w, h); - } else { - var x2 = x1 + w, - y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - rectangle.x = function(_) { - if (arguments.length) { - x = number(_); - return rectangle; - } else { - return x; - } - }; - - rectangle.y = function(_) { - if (arguments.length) { - y = number(_); - return rectangle; - } else { - return y; - } - }; - - rectangle.width = function(_) { - if (arguments.length) { - width = number(_); - return rectangle; - } else { - return width; - } - }; - - rectangle.height = function(_) { - if (arguments.length) { - height = number(_); - return rectangle; - } else { - return height; - } - }; - - rectangle.cornerRadius = function(tl, tr, br, bl) { - if (arguments.length) { - crTL = number(tl); - crTR = tr != null ? number(tr) : crTL; - crBR = br != null ? number(br) : crTL; - crBL = bl != null ? number(bl) : crTR; - return rectangle; - } else { - return crTL; - } - }; - - rectangle.context = function(_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else { - return context; - } - }; - - return rectangle; -} diff --git a/node_modules/vega-scenegraph/src/path/render.js b/node_modules/vega-scenegraph/src/path/render.js deleted file mode 100644 index 6ea0535..0000000 --- a/node_modules/vega-scenegraph/src/path/render.js +++ /dev/null @@ -1,323 +0,0 @@ -import {bezier, segments} from './arc'; - -var temp = ['l', 0, 0, 0, 0, 0, 0, 0]; - -function scale(current, sX, sY) { - var c = (temp[0] = current[0]); - if (c === 'a' || c === 'A') { - temp[1] = sX * current[1]; - temp[2] = sY * current[2]; - temp[3] = current[3]; - temp[4] = current[4]; - temp[5] = current[5]; - temp[6] = sX * current[6]; - temp[7] = sY * current[7]; - } else if (c === 'h' || c === 'H') { - temp[1] = sX * current[1]; - } else if (c === 'v' || c === 'V') { - temp[1] = sY * current[1]; - } else { - for (var i=1, n=current.length; i item.x || 0, - y = item => item.y || 0, - w = item => item.width || 0, - h = item => item.height || 0, - xw = item => (item.x || 0) + (item.width || 0), - yh = item => (item.y || 0) + (item.height || 0), - sa = item => item.startAngle || 0, - ea = item => item.endAngle || 0, - pa = item => item.padAngle || 0, - ir = item => item.innerRadius || 0, - or = item => item.outerRadius || 0, - cr = item => item.cornerRadius || 0, - tl = item => value(item.cornerRadiusTopLeft, item.cornerRadius) || 0, - tr = item => value(item.cornerRadiusTopRight, item.cornerRadius) || 0, - br = item => value(item.cornerRadiusBottomRight, item.cornerRadius) || 0, - bl = item => value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, - sz = item => value(item.size, 64), - ts = item => item.size || 1, - def = item => !(item.defined === false), - type = item => symbols(item.shape || 'circle'); - -const arcShape = d3_arc().startAngle(sa).endAngle(ea).padAngle(pa) - .innerRadius(ir).outerRadius(or).cornerRadius(cr), - areavShape = d3_area().x(x).y1(y).y0(yh).defined(def), - areahShape = d3_area().y(y).x1(x).x0(xw).defined(def), - lineShape = d3_line().x(x).y(y).defined(def), - rectShape = vg_rect().x(x).y(y).width(w).height(h) - .cornerRadius(tl, tr, br, bl), - symbolShape = d3_symbol().type(type).size(sz), - trailShape = vg_trail().x(x).y(y).defined(def).size(ts); - -export function hasCornerRadius(item) { - return item.cornerRadius - || item.cornerRadiusTopLeft - || item.cornerRadiusTopRight - || item.cornerRadiusBottomRight - || item.cornerRadiusBottomLeft; -} - -export function arc(context, item) { - return arcShape.context(context)(item); -} - -export function area(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape) - .curve(curves(interp, item.orient, item.tension)) - .context(context)(items); -} - -export function line(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)) - .context(context)(items); -} - -export function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); -} - -export function shape(context, item) { - return (item.mark.shape || item.shape) - .context(context)(item); -} - -export function symbol(context, item) { - return symbolShape.context(context)(item); -} - -export function trail(context, items) { - return trailShape.context(context)(items); -} diff --git a/node_modules/vega-scenegraph/src/path/symbols.js b/node_modules/vega-scenegraph/src/path/symbols.js deleted file mode 100644 index 55910d3..0000000 --- a/node_modules/vega-scenegraph/src/path/symbols.js +++ /dev/null @@ -1,156 +0,0 @@ -import pathParse from './parse'; -import pathRender from './render'; -import {HalfSqrt3, Tau} from '../util/constants'; -import {hasOwnProperty} from 'vega-util'; - -var Tan30 = 0.5773502691896257; - -var builtins = { - 'circle': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(r, 0); - context.arc(0, 0, r, 0, Tau); - } - }, - 'cross': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, - s = r / 2.5; - context.moveTo(-r, -s); - context.lineTo(-r, s); - context.lineTo(-s, s); - context.lineTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, s); - context.lineTo(r, s); - context.lineTo(r, -s); - context.lineTo(s, -s); - context.lineTo(s, -r); - context.lineTo(-s, -r); - context.lineTo(-s, -s); - context.closePath(); - } - }, - 'diamond': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.closePath(); - } - }, - 'square': { - draw: function(context, size) { - var w = Math.sqrt(size), - x = -w / 2; - context.rect(x, x, w, w); - } - }, - 'arrow': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, - s = r / 7, - t = r / 2.5, - v = r / 8; - context.moveTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, -v); - context.lineTo(t, -v); - context.lineTo(0, -r); - context.lineTo(-t, -v); - context.lineTo(-s, -v); - context.closePath(); - } - }, - 'wedge': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r, - o = (h - r * Tan30), - b = r / 4; - context.moveTo(0, -h - o); - context.lineTo(-b, h - o); - context.lineTo(b, h - o); - context.closePath(); - } - }, - 'triangle': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r, - o = (h - r * Tan30); - context.moveTo(0, -h - o); - context.lineTo(-r, h - o); - context.lineTo(r, h - o); - context.closePath(); - } - }, - 'triangle-up': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(0, -h); - context.lineTo(-r, h); - context.lineTo(r, h); - context.closePath(); - } - }, - 'triangle-down': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(0, h); - context.lineTo(-r, -h); - context.lineTo(r, -h); - context.closePath(); - } - }, - 'triangle-right': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(h, 0); - context.lineTo(-h, -r); - context.lineTo(-h, r); - context.closePath(); - } - }, - 'triangle-left': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(-h, 0); - context.lineTo(h, -r); - context.lineTo(h, r); - context.closePath(); - } - }, - 'stroke': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(r, 0); - } - } -}; - -export default function symbols(_) { - return hasOwnProperty(builtins, _) ? builtins[_] : customSymbol(_); -} - -var custom = {}; - -function customSymbol(path) { - if (!hasOwnProperty(custom, path)) { - var parsed = pathParse(path); - custom[path] = { - draw: function(context, size) { - pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2); - } - }; - } - return custom[path]; -} diff --git a/node_modules/vega-scenegraph/src/path/trail.js b/node_modules/vega-scenegraph/src/path/trail.js deleted file mode 100644 index bf488cf..0000000 --- a/node_modules/vega-scenegraph/src/path/trail.js +++ /dev/null @@ -1,116 +0,0 @@ -import {Tau} from '../util/constants'; -import {path} from 'd3-path'; - -export default function() { - var x, - y, - size, - defined, - context = null, - ready, x1, y1, r1; - - function point(x2, y2, w2) { - var r2 = w2 / 2; - - if (ready) { - var ux = y1 - y2, - uy = x2 - x1; - - if (ux || uy) { - // get normal vector - var ud = Math.sqrt(ux * ux + uy * uy), - rx = (ux /= ud) * r1, - ry = (uy /= ud) * r1, - t = Math.atan2(uy, ux); - - // draw segment - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else { - context.arc(x2, y2, r2, 0, Tau); - } - context.closePath(); - } else { - ready = 1; - } - x1 = x2; - y1 = y2; - r1 = r2; - } - - function trail(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - - if (context == null) context = buffer = path(); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - trail.x = function(_) { - if (arguments.length) { - x = _; - return trail; - } else { - return x; - } - }; - - trail.y = function(_) { - if (arguments.length) { - y = _; - return trail; - } else { - return y; - } - }; - - trail.size = function(_) { - if (arguments.length) { - size = _; - return trail; - } else { - return size; - } - }; - - trail.defined = function(_) { - if (arguments.length) { - defined = _; - return trail; - } else { - return defined; - } - }; - - trail.context = function(_) { - if (arguments.length) { - if (_ == null) { - context = null; - } else { - context = _; - } - return trail; - } else { - return context; - } - }; - - return trail; -} diff --git a/node_modules/vega-scenegraph/src/util/aria.js b/node_modules/vega-scenegraph/src/util/aria.js deleted file mode 100644 index c92a066..0000000 --- a/node_modules/vega-scenegraph/src/util/aria.js +++ /dev/null @@ -1,167 +0,0 @@ -import {domainCaption, isDiscrete} from 'vega-scale'; -import {array, peek, toSet} from 'vega-util'; - -const ARIA_HIDDEN = 'aria-hidden'; -const ARIA_LABEL = 'aria-label'; -const ARIA_ROLE = 'role'; -const ARIA_ROLEDESCRIPTION = 'aria-roledescription'; -const GRAPHICS_OBJECT = 'graphics-object'; -const GRAPHICS_SYMBOL = 'graphics-symbol'; - -const bundle = (role, roledesc, label) => ({ - [ARIA_ROLE]: role, - [ARIA_ROLEDESCRIPTION]: roledesc, - [ARIA_LABEL]: label || undefined -}); - -// these roles are covered by related roles -// we can ignore them, no need to generate attributes -const AriaIgnore = toSet([ - 'axis-domain', - 'axis-grid', - 'axis-label', - 'axis-tick', - 'axis-title', - 'legend-band', - 'legend-entry', - 'legend-gradient', - 'legend-label', - 'legend-title', - 'legend-symbol', - 'title' -]); - -// aria attribute generators for guide roles -const AriaGuides = { - 'axis': {desc: 'axis', caption: axisCaption}, - 'legend': {desc: 'legend', caption: legendCaption}, - 'title-text': { - desc: 'title', - caption: item => `Title text '${titleCaption(item)}'` - }, - 'title-subtitle': { - desc: 'subtitle', - caption: item => `Subtitle text '${titleCaption(item)}'` - } -}; - -// aria properties generated for mark item encoding channels -export const AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL -}; - -export function ariaItemAttributes(emit, item) { - const hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - - if (hide || item.description == null) { - for (const prop in AriaEncode) { - emit(AriaEncode[prop], undefined); - } - } else { - const type = item.mark.marktype; - emit( - ARIA_LABEL, - item.description - ); - emit( - ARIA_ROLE, - item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL) - ); - emit( - ARIA_ROLEDESCRIPTION, - item.ariaRoleDescription || `${type} mark` - ); - } -} - -export function ariaMarkAttributes(mark) { - return mark.aria === false ? { [ARIA_HIDDEN]: true } - : AriaIgnore[mark.role] ? null - : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) - : ariaMark(mark); -} - -function ariaMark(mark) { - const type = mark.marktype; - const recurse = ( - type === 'group' || - type === 'text' || - mark.items.some(_ => _.description != null && _.aria !== false) - ); - return bundle( - recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, - `${type} mark container`, - mark.description - ); -} - -function ariaGuide(mark, opt) { - try { - const item = mark.items[0], - caption = opt.caption || (() => ''); - return bundle( - opt.role || GRAPHICS_SYMBOL, - opt.desc, - item.description || caption(item) - ); - } catch (err) { - return null; - } -} - -function titleCaption(item) { - return array(item.text).join(' '); -} - -function axisCaption(item) { - const datum = item.datum, - orient = item.orient, - title = datum.title ? extractTitle(item) : null, - ctx = item.context, - scale = ctx.scales[datum.scale].value, - locale = ctx.dataflow.locale(), - type = scale.type, - xy = (orient === 'left' || orient === 'right') ? 'Y' : 'X'; - - return `${xy}-axis` - + (title ? ` titled '${title}'` : '') - + ` for a ${isDiscrete(type) ? 'discrete' : type} scale` - + ` with ${domainCaption(locale, scale, item)}`; -} - -function legendCaption(item) { - const datum = item.datum, - title = datum.title ? extractTitle(item) : null, - type = `${datum.type || ''} legend`.trim(), - scales = datum.scales, - props = Object.keys(scales), - ctx = item.context, - scale = ctx.scales[scales[props[0]]].value, - locale = ctx.dataflow.locale(); - - return capitalize(type) - + (title ? ` titled '${title}'` : '') - + ` for ${channelCaption(props)}` - + ` with ${domainCaption(locale, scale, item)}`; -} - -function extractTitle(item) { - try { - return array(peek(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } -} - -function channelCaption(props) { - props = props.map(p => p + (p === 'fill' || p === 'stroke' ? ' color' : '')); - return props.length < 2 ? props[0] - : props.slice(0, -1).join(', ') + ' and ' + peek(props); -} - -function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; -} diff --git a/node_modules/vega-scenegraph/src/util/canvas/blend.js b/node_modules/vega-scenegraph/src/util/canvas/blend.js deleted file mode 100644 index da84f95..0000000 --- a/node_modules/vega-scenegraph/src/util/canvas/blend.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; -} diff --git a/node_modules/vega-scenegraph/src/util/canvas/clip.js b/node_modules/vega-scenegraph/src/util/canvas/clip.js deleted file mode 100644 index 73f5c30..0000000 --- a/node_modules/vega-scenegraph/src/util/canvas/clip.js +++ /dev/null @@ -1,24 +0,0 @@ -import {hasCornerRadius, rectangle} from '../../path/shapes'; -import {isFunction} from 'vega-util'; - -export default function(context, scene) { - var clip = scene.clip; - - context.save(); - - if (isFunction(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else { - clipGroup(context, scene.group); - } -} - -export function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) - ? rectangle(context, group, 0, 0) - : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); -} diff --git a/node_modules/vega-scenegraph/src/util/canvas/color.js b/node_modules/vega-scenegraph/src/util/canvas/color.js deleted file mode 100644 index 86b8b23..0000000 --- a/node_modules/vega-scenegraph/src/util/canvas/color.js +++ /dev/null @@ -1,8 +0,0 @@ -import {isGradient} from '../../Gradient'; -import gradient from './gradient'; - -export default function(context, item, value) { - return isGradient(value) - ? gradient(context, value, item.bounds) - : value; -} diff --git a/node_modules/vega-scenegraph/src/util/canvas/context.js b/node_modules/vega-scenegraph/src/util/canvas/context.js deleted file mode 100644 index af14730..0000000 --- a/node_modules/vega-scenegraph/src/util/canvas/context.js +++ /dev/null @@ -1,5 +0,0 @@ -import {canvas} from 'vega-canvas'; - -export var context = (context = canvas(1,1)) - ? context.getContext('2d') - : null; diff --git a/node_modules/vega-scenegraph/src/util/canvas/draw.js b/node_modules/vega-scenegraph/src/util/canvas/draw.js deleted file mode 100644 index 97dcf92..0000000 --- a/node_modules/vega-scenegraph/src/util/canvas/draw.js +++ /dev/null @@ -1,39 +0,0 @@ -import blend from './blend'; -import fill from './fill'; -import stroke from './stroke'; -import {visit} from '../visit'; - -export function drawAll(path) { - return function(context, scene, bounds) { - visit(scene, function(item) { - if (!bounds || bounds.intersects(item.bounds)) { - drawPath(path, context, item, item); - } - }); - }; -} - -export function drawOne(path) { - return function(context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) { - drawPath(path, context, scene.items[0], scene.items); - } - }; -} - -function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - - if (path(context, items)) return; - - blend(context, item); - - if (item.fill && fill(context, item, opacity)) { - context.fill(); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.stroke(); - } -} diff --git a/node_modules/vega-scenegraph/src/util/canvas/fill.js b/node_modules/vega-scenegraph/src/util/canvas/fill.js deleted file mode 100644 index ea5bdb3..0000000 --- a/node_modules/vega-scenegraph/src/util/canvas/fill.js +++ /dev/null @@ -1,12 +0,0 @@ -import color from './color'; - -export default function(context, item, opacity) { - opacity *= (item.fillOpacity==null ? 1 : item.fillOpacity); - if (opacity > 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else { - return false; - } -} diff --git a/node_modules/vega-scenegraph/src/util/canvas/gradient.js b/node_modules/vega-scenegraph/src/util/canvas/gradient.js deleted file mode 100644 index 34e8301..0000000 --- a/node_modules/vega-scenegraph/src/util/canvas/gradient.js +++ /dev/null @@ -1,59 +0,0 @@ -import value from '../value'; -import {canvas} from 'vega-canvas'; - -function addStops(gradient, stops) { - const n = stops.length; - for (let i=0; i 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty); - context.lineDashOffset = item.strokeDashOffset || 0; - } - return true; - } else { - return false; - } -} diff --git a/node_modules/vega-scenegraph/src/util/constants.js b/node_modules/vega-scenegraph/src/util/constants.js deleted file mode 100644 index 84180e2..0000000 --- a/node_modules/vega-scenegraph/src/util/constants.js +++ /dev/null @@ -1,5 +0,0 @@ -export const DegToRad = Math.PI / 180; -export const Epsilon = 1e-14; -export const HalfPi = Math.PI / 2; -export const Tau = Math.PI * 2; -export const HalfSqrt3 = Math.sqrt(3) / 2; diff --git a/node_modules/vega-scenegraph/src/util/dom.js b/node_modules/vega-scenegraph/src/util/dom.js deleted file mode 100644 index a6f85b0..0000000 --- a/node_modules/vega-scenegraph/src/util/dom.js +++ /dev/null @@ -1,45 +0,0 @@ -// create a new DOM element -export function domCreate(doc, tag, ns) { - if (!doc && typeof document !== 'undefined' && document.createElement) { - doc = document; - } - return doc - ? (ns ? doc.createElementNS(ns, tag) : doc.createElement(tag)) - : null; -} - -// find first child element with matching tag -export function domFind(el, tag) { - tag = tag.toLowerCase(); - var nodes = el.childNodes, i = 0, n = nodes.length; - for (; i index) el.removeChild(nodes[--curr]); - return el; -} - -// generate css class name for mark -export function cssClass(mark) { - return 'mark-' + mark.marktype - + (mark.role ? ' role-' + mark.role : '') - + (mark.name ? ' ' + mark.name : ''); -} diff --git a/node_modules/vega-scenegraph/src/util/equal.js b/node_modules/vega-scenegraph/src/util/equal.js deleted file mode 100644 index f100d61..0000000 --- a/node_modules/vega-scenegraph/src/util/equal.js +++ /dev/null @@ -1,40 +0,0 @@ -import pathParse from '../path/parse'; -import {isNumber, isObject} from 'vega-util'; - -var TOLERANCE = 1e-9; - -export function sceneEqual(a, b, key) { - return (a === b) ? true - : (key === 'path') ? pathEqual(a, b) - : (a instanceof Date && b instanceof Date) ? +a === +b - : (isNumber(a) && isNumber(b)) ? Math.abs(a - b) <= TOLERANCE - : (!a || !b || !isObject(a) && !isObject(b)) ? a == b - : (a == null || b == null) ? false - : objectEqual(a, b); -} - -export function pathEqual(a, b) { - return sceneEqual(pathParse(a), pathParse(b)); -} - -function objectEqual(a, b) { - var ka = Object.keys(a), - kb = Object.keys(b), - key, i; - - if (ka.length !== kb.length) return false; - - ka.sort(); - kb.sort(); - - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) return false; - } - - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; - } - - return typeof a === typeof b; -} diff --git a/node_modules/vega-scenegraph/src/util/events.js b/node_modules/vega-scenegraph/src/util/events.js deleted file mode 100644 index 81a45b6..0000000 --- a/node_modules/vega-scenegraph/src/util/events.js +++ /dev/null @@ -1,45 +0,0 @@ -export const KeyDownEvent = 'keydown'; -export const KeyPressEvent = 'keypress'; -export const KeyUpEvent = 'keyup'; -export const DragEnterEvent = 'dragenter'; -export const DragLeaveEvent = 'dragleave'; -export const DragOverEvent = 'dragover'; -export const MouseDownEvent = 'mousedown'; -export const MouseUpEvent = 'mouseup'; -export const MouseMoveEvent = 'mousemove'; -export const MouseOutEvent = 'mouseout'; -export const MouseOverEvent = 'mouseover'; -export const ClickEvent = 'click'; -export const DoubleClickEvent = 'dblclick'; -export const WheelEvent = 'wheel'; -export const MouseWheelEvent = 'mousewheel'; -export const TouchStartEvent = 'touchstart'; -export const TouchMoveEvent = 'touchmove'; -export const TouchEndEvent = 'touchend'; - -export const Events = [ - KeyDownEvent, - KeyPressEvent, - KeyUpEvent, - DragEnterEvent, - DragLeaveEvent, - DragOverEvent, - MouseDownEvent, - MouseUpEvent, - MouseMoveEvent, - MouseOutEvent, - MouseOverEvent, - ClickEvent, - DoubleClickEvent, - WheelEvent, - MouseWheelEvent, - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent -]; - -export const TooltipShowEvent = MouseMoveEvent; - -export const TooltipHideEvent = MouseOutEvent; - -export const HrefEvent = ClickEvent; diff --git a/node_modules/vega-scenegraph/src/util/intersect.js b/node_modules/vega-scenegraph/src/util/intersect.js deleted file mode 100644 index 3063703..0000000 --- a/node_modules/vega-scenegraph/src/util/intersect.js +++ /dev/null @@ -1,80 +0,0 @@ -import {context} from './canvas/context'; -import Bounds from '../Bounds'; - -const b = new Bounds(); - -export function intersectPath(draw) { - return function(item, brush) { - // rely on (inaccurate) bounds intersection if no context - if (!context) return true; - - // add path to offscreen graphics context - draw(context, item); - - // get bounds intersection region - b.clear().union(item.bounds).intersect(brush).round(); - const {x1, y1, x2, y2} = b; - - // iterate over intersection region - // perform fine grained inclusion test - for (let y = y1; y <= y2; ++y) { - for (let x = x1; x <= x2; ++x) { - if (context.isPointInPath(x, y)) { - return true; - } - } - } - - // false if no hits in intersection region - return false; - }; -} - -export function intersectPoint(item, box) { - return box.contains(item.x || 0, item.y || 0); -} - -export function intersectRect(item, box) { - const x = item.x || 0, - y = item.y || 0, - w = item.width || 0, - h = item.height || 0; - return box.intersects(b.set(x, y, x + w, y + h)); -} - -export function intersectRule(item, box) { - const x = item.x || 0, - y = item.y || 0, - x2 = item.x2 != null ? item.x2 : x, - y2 = item.y2 != null ? item.y2 : y; - return intersectBoxLine(box, x, y, x2, y2); -} - -export function intersectBoxLine(box, x, y, u, v) { - const {x1, y1, x2, y2} = box, - dx = u - x, - dy = v - y; - - let t0 = 0, t1 = 1, p, q, r, e; - - for (e=0; e<4; ++e) { - if (e === 0) { p = -dx; q = -(x1 - x); } - if (e === 1) { p = dx; q = (x2 - x); } - if (e === 2) { p = -dy; q = -(y1 - y); } - if (e === 3) { p = dy; q = (y2 - y); } - - if (Math.abs(p) < 1e-10 && q < 0) return false; - - r = q / p; - - if (p < 0) { - if (r > t1) return false; - else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false; - else if (r < t1) t1 = r; - } - } - - return true; -} diff --git a/node_modules/vega-scenegraph/src/util/pickPath.js b/node_modules/vega-scenegraph/src/util/pickPath.js deleted file mode 100644 index 9041d79..0000000 --- a/node_modules/vega-scenegraph/src/util/pickPath.js +++ /dev/null @@ -1,47 +0,0 @@ -export function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], - z = a[0].orient === 'horizontal' ? 'y' : 'x', - i = a.length, - min = +Infinity, hit, d; - - while (--i >= 0) { - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - if (d < min) { - min = d; - hit = a[i]; - } - } - - return hit; -} - -export function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), - i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - - return null; -} - -export function pickTrail(a, p) { - var i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx*dx) return a[i]; - } - - return null; -} diff --git a/node_modules/vega-scenegraph/src/util/point.js b/node_modules/vega-scenegraph/src/util/point.js deleted file mode 100644 index 20dea8c..0000000 --- a/node_modules/vega-scenegraph/src/util/point.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function(event, el) { - var rect = el.getBoundingClientRect(); - return [ - event.clientX - rect.left - (el.clientLeft || 0), - event.clientY - rect.top - (el.clientTop || 0) - ]; -} diff --git a/node_modules/vega-scenegraph/src/util/resolveItem.js b/node_modules/vega-scenegraph/src/util/resolveItem.js deleted file mode 100644 index d088245..0000000 --- a/node_modules/vega-scenegraph/src/util/resolveItem.js +++ /dev/null @@ -1,20 +0,0 @@ -import marks from '../marks/index'; -import point from './point'; - -export default function(item, event, el, origin) { - var mark = item && item.mark, - mdef, p; - - if (mark && (mdef = marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - while (item = item.mark.group) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - item = mdef.tip(mark.items, p); - } - - return item; -} diff --git a/node_modules/vega-scenegraph/src/util/serialize.js b/node_modules/vega-scenegraph/src/util/serialize.js deleted file mode 100644 index 7302d96..0000000 --- a/node_modules/vega-scenegraph/src/util/serialize.js +++ /dev/null @@ -1,50 +0,0 @@ -import boundMark from '../bound/boundMark'; - -var keys = [ - 'marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', - 'x', 'y', 'width', 'height', 'align', 'baseline', // layout - 'fill', 'fillOpacity', 'opacity', 'blend', // fill - 'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap', // stroke - 'strokeDash', 'strokeDashOffset', // stroke dash - 'strokeForeground', 'strokeOffset', // group - 'startAngle', 'endAngle', 'innerRadius', 'outerRadius', // arc - 'cornerRadius', 'padAngle', // arc, rect - 'cornerRadiusTopLeft', 'cornerRadiusTopRight', // rect, group - 'cornerRadiusBottomLeft', 'cornerRadiusBottomRight', - 'interpolate', 'tension', 'orient', 'defined', // area, line - 'url', 'aspect', 'smooth', // image - 'path', 'scaleX', 'scaleY', // path - 'x2', 'y2', // rule - 'size', 'shape', // symbol - 'text', 'angle', 'theta', 'radius', 'dir', 'dx', 'dy', // text - 'ellipsis', 'limit', 'lineBreak', 'lineHeight', - 'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant', // font - 'description', 'aria', 'ariaRole', 'ariaRoleDescription' // aria -]; - -export function sceneToJSON(scene, indent) { - return JSON.stringify(scene, keys, indent); -} - -export function sceneFromJSON(json) { - var scene = (typeof json === 'string' ? JSON.parse(json) : json); - return initialize(scene); -} - -function initialize(scene) { - var type = scene.marktype, - items = scene.items, - parent, i, n; - - if (items) { - for (i=0, n=items.length; i (val + '') - .replace(/&/g, '&') - .replace(/"/g, '"'); - -/** - * Generate string for an opening xml tag. - * @param tag the name of the xml tag - * @param attr hash of attribute name-value pairs to include - * @param raw additional raw string to include in tag markup - */ -export function openTag(tag, attr, raw) { - var s = '<' + tag, key, val; - if (attr) { - for (key in attr) { - val = attr[key]; - if (val != null) { - s += ' ' + key + '="' + attrText(val) + '"'; - } - } - } - if (raw) s += ' ' + raw; - return s + '>'; -} - -/** - * Generate string for closing xml tag. - * @param tag the name of the xml tag - */ -export function closeTag(tag) { - return ''; -} diff --git a/node_modules/vega-scenegraph/src/util/text.js b/node_modules/vega-scenegraph/src/util/text.js deleted file mode 100644 index 0615a97..0000000 --- a/node_modules/vega-scenegraph/src/util/text.js +++ /dev/null @@ -1,149 +0,0 @@ -import {context} from './canvas/context'; -import {isArray, lruCache} from 'vega-util'; - -// memoize text width measurement -const widthCache = lruCache(); - -export var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas -}; - -useCanvas(true); - -function useCanvas(use) { - textMetrics.width = (use && context) ? measureWidth : estimateWidth; -} - -// make dumb, simple estimate if no canvas is available -function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); -} - -function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); -} - -// measure text width if canvas is available -function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 - : _measureWidth(text, font(item)); -} - -function _measureWidth(text, currentFont) { - const key = `(${currentFont}) ${text}`; - let width = widthCache.get(key); - if (width === undefined) { - context.font = currentFont; - width = context.measureText(text).width; - widthCache.set(key, width); - } - return width; -} - -export function fontSize(item) { - return item.fontSize != null ? (+item.fontSize || 0) : 11; -} - -export function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : (fontSize(item) + 2); -} - -function lineArray(_) { - return isArray(_) ? _.length > 1 ? _ : _[0] : _; -} - -export function textLines(item) { - return lineArray( - item.lineBreak && item.text && !isArray(item.text) - ? item.text.split(item.lineBreak) - : item.text - ); -} - -export function multiLineOffset(item) { - const tl = textLines(item); - return (isArray(tl) ? (tl.length - 1) : 0) * lineHeight(item); -} - -export function textValue(item, line) { - const text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate(item, text) : text; -} - -function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - const currentFont = font(item); - return text => _measureWidth(text, currentFont); - } else { - // we are relying on estimates - const currentFontHeight = fontSize(item); - return text => _estimateWidth(text, currentFontHeight); - } -} - -function truncate(item, text) { - var limit = +item.limit, - width = widthGetter(item); - - if (width(text) < limit) return text; - - var ellipsis = item.ellipsis || '\u2026', - rtl = item.dir === 'rtl', - lo = 0, - hi = text.length, mid; - - limit -= width(ellipsis); - - if (rtl) { - while (lo < hi) { - mid = (lo + hi >>> 1); - if (width(text.slice(mid)) > limit) lo = mid + 1; - else hi = mid; - } - return ellipsis + text.slice(lo); - } else { - while (lo < hi) { - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid; - else hi = mid - 1; - } - return text.slice(0, lo) + ellipsis; - } -} - -export function fontFamily(item, quote) { - var font = item.font; - return (quote && font - ? String(font).replace(/"/g, '\'') - : font) || 'sans-serif'; -} - -export function font(item, quote) { - return '' + - (item.fontStyle ? item.fontStyle + ' ' : '') + - (item.fontVariant ? item.fontVariant + ' ' : '') + - (item.fontWeight ? item.fontWeight + ' ' : '') + - fontSize(item) + 'px ' + - fontFamily(item, quote); -} - -export function offset(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, - h = fontSize(item); - - return Math.round( - baseline === 'top' ? 0.79 * h : - baseline === 'middle' ? 0.30 * h : - baseline === 'bottom' ? -0.21 * h : - baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : - baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0 - ); -} diff --git a/node_modules/vega-scenegraph/src/util/value.js b/node_modules/vega-scenegraph/src/util/value.js deleted file mode 100644 index b6a3e28..0000000 --- a/node_modules/vega-scenegraph/src/util/value.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(value, dflt) { - return value == null ? dflt : value; -} diff --git a/node_modules/vega-scenegraph/src/util/visit.js b/node_modules/vega-scenegraph/src/util/visit.js deleted file mode 100644 index b92441d..0000000 --- a/node_modules/vega-scenegraph/src/util/visit.js +++ /dev/null @@ -1,59 +0,0 @@ -function compare(a, b) { - return a.zindex - b.zindex || a.index - b.index; -} - -export function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - - var items = scene.items, - output = [], item, i, n; - - for (i=0, n=items.length; i= 0;) { - if (hit = visitor(items[i])) return hit; - } - - if (items === zitems) { - for (items=scene.items, i=items.length; --i >= 0;) { - if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; - } - } - } - - return null; -} diff --git a/node_modules/vega-selections/LICENSE b/node_modules/vega-selections/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-selections/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-selections/README.md b/node_modules/vega-selections/README.md deleted file mode 100644 index c3c1f8b..0000000 --- a/node_modules/vega-selections/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# vega-selections - -[Vega expression language](https://vega.github.io/vega/docs/expressions/) functions for implementing Vega-Lite selections. diff --git a/node_modules/vega-selections/build/vega-selections.js b/node_modules/vega-selections/build/vega-selections.js deleted file mode 100644 index 66307ad..0000000 --- a/node_modules/vega-selections/build/vega-selections.js +++ /dev/null @@ -1,249 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('vega-expression')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'vega-expression'], factory) : - (global = global || self, factory(global.vega = {}, global.vega, global.vega)); -}(this, (function (exports, vegaUtil, vegaExpression) { 'use strict'; - - const Intersect = 'intersect'; - const Union = 'union'; - const VlMulti = 'vlMulti'; - const Or = 'or'; - const And = 'and'; - - var TYPE_ENUM = 'E', - TYPE_RANGE_INC = 'R', - TYPE_RANGE_EXC = 'R-E', - TYPE_RANGE_LE = 'R-LE', - TYPE_RANGE_RE = 'R-RE', - UNIT_INDEX = 'index:unit'; - - // TODO: revisit date coercion? - function testPoint(datum, entry) { - var fields = entry.fields, - values = entry.values, - n = fields.length, - i = 0, dval, f; - - for (; i, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ - function selectionTest(name, datum, op) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, - intersect = op === Intersect, - n = entries.length, - i = 0, - entry, miss, count, unit, b; - - for (; i (obj[fields[j].field] = curr, obj), {})); - } - } - - // Then resolve fields across units as per the op. - op = op || Union; - Object.keys(resolved).forEach(function (field) { - resolved[field] = Object.keys(resolved[field]) - .map(unit => resolved[field][unit]) - .reduce((acc, curr) => acc === undefined ? curr : ops[types[field] + '_' + op](acc, curr)); - }); - - entries = Object.keys(multiRes); - if (isMulti && entries.length) { - resolved[VlMulti] = op === Union - ? {[Or]: entries.reduce((acc, k) => (acc.push.apply(acc, multiRes[k]), acc), [])} - : {[And]: entries.map(k => ({[Or]: multiRes[k]}))}; - } - - return resolved; - } - - var ops = { - E_union: function(base, value) { - if (!base.length) return value; - - var i = 0, n = value.length; - for (; i= 0; }); - }, - - R_union: function(base, value) { - var lo = vegaUtil.toNumber(value[0]), hi = vegaUtil.toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; - }, - - R_intersect: function(base, value) { - var lo = vegaUtil.toNumber(value[0]), hi = vegaUtil.toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (hi < base[0] || base[1] < lo) { - return []; - } else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - return base; - } - }; - - const DataPrefix = ':', - IndexPrefix = '@'; - - function selectionVisitor(name, args, scope, params) { - if (args[0].type !== vegaExpression.Literal) vegaUtil.error('First argument to selection functions must be a string literal.'); - - const data = args[0].value, - op = args.length >= 2 && vegaUtil.peek(args).value, - field = 'unit', - indexName = IndexPrefix + field, - dataName = DataPrefix + data; - - // eslint-disable-next-line no-prototype-builtins - if (op === Intersect && !vegaUtil.hasOwnProperty(params, indexName)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - - // eslint-disable-next-line no-prototype-builtins - if (!vegaUtil.hasOwnProperty(params, dataName)) { - params[dataName] = scope.getData(data).tuplesRef(); - } - } - - exports.selectionResolve = selectionResolve; - exports.selectionTest = selectionTest; - exports.selectionVisitor = selectionVisitor; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-selections/build/vega-selections.min.js b/node_modules/vega-selections/build/vega-selections.min.js deleted file mode 100644 index f62a164..0000000 --- a/node_modules/vega-selections/build/vega-selections.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression"],t):t((e=e||self).vega={},e.vega,e.vega)}(this,(function(e,t,n){"use strict";function r(e,n){for(var r,i,u=n.fields,o=n.values,a=u.length,f=0;f=0})):t},R_union:function(e,n){var r=t.toNumber(n[0]),i=t.toNumber(n[1]);return r>i&&(r=n[1],i=n[0]),e.length?(e[0]>r&&(e[0]=r),e[1]i&&(r=n[1],i=n[0]),e.length?ii&&(e[1]=i),e):[r,i]}};e.selectionResolve=function(e,n,r){for(var u,o,a,f,s,l,c,d,g,p,v,h=this.context.data[e],y=h?h.values.value:[],m={},b={},x={},R=y.length,O=0;O(e[o[n].field]=t,e),{}))}return n=n||"union",Object.keys(m).forEach((function(e){m[e]=Object.keys(m[e]).map(t=>m[e][t]).reduce((t,r)=>void 0===t?r:i[x[e]+"_"+n](t,r))})),y=Object.keys(b),r&&y.length&&(m.vlMulti="union"===n?{or:y.reduce((e,t)=>(e.push.apply(e,b[t]),e),[])}:{and:y.map(e=>({or:b[e]}))}),m},e.selectionTest=function(e,t,n){for(var i,u,o,a,f,s=this.context.data[e],l=s?s.values.value:[],c=s?s["index:unit"]&&s["index:unit"].value:void 0,d="intersect"===n,g=l.length,p=0;p=2&&t.peek(r).value)||t.hasOwnProperty(u,"@unit")||(u["@unit"]=i.getData(o).indataRef(i,"unit")),t.hasOwnProperty(u,a)||(u[a]=i.getData(o).tuplesRef())},Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-selections/index.js b/node_modules/vega-selections/index.js deleted file mode 100644 index 2a13d9c..0000000 --- a/node_modules/vega-selections/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export {selectionTest} from './src/selectionTest'; -export {selectionResolve} from './src/selectionResolve'; -export {selectionVisitor} from './src/selectionVisitor'; diff --git a/node_modules/vega-selections/package.json b/node_modules/vega-selections/package.json deleted file mode 100644 index dc215bd..0000000 --- a/node_modules/vega-selections/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_from": "vega-selections@^5.1.1", - "_id": "vega-selections@5.1.1", - "_inBundle": false, - "_integrity": "sha512-ztZUMfDicuIGJHZimSdVvMGzMvaa37ICzUHHvwxS51OhYv096dzKgoSypjx+tsmR7wnhY7ZL+iQgpT1/O29jlA==", - "_location": "/vega-selections", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-selections@^5.1.1", - "name": "vega-selections", - "escapedName": "vega-selections", - "rawSpec": "^5.1.1", - "saveSpec": null, - "fetchSpec": "^5.1.1" - }, - "_requiredBy": [ - "/vega-functions" - ], - "_resolved": "https://registry.npmjs.org/vega-selections/-/vega-selections-5.1.1.tgz", - "_shasum": "5ea3931bbf7bc13f2ab7c5c5ebf39aed98e4c114", - "_spec": "vega-selections@^5.1.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-functions", - "author": { - "name": "Arvind Satyanarayan", - "url": "http://arvindsatya.com" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "vega-expression": "^2.6.4", - "vega-util": "^1.13.2" - }, - "deprecated": false, - "description": "Vega expression functions for Vega-Lite selections.", - "gitHead": "35e31c5c6b54db9dc3a577b5adad8d15ec274d32", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "expression", - "selections" - ], - "license": "BSD-3-Clause", - "main": "build/vega-selections.js", - "module": "index", - "name": "vega-selections", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-selections.js -c -m -o build/vega-selections.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g vega-expression:vega,vega-util:vega -f umd -n vega -o build/vega-selections.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "5.1.1" -} diff --git a/node_modules/vega-selections/src/constants.js b/node_modules/vega-selections/src/constants.js deleted file mode 100644 index be751ee..0000000 --- a/node_modules/vega-selections/src/constants.js +++ /dev/null @@ -1,5 +0,0 @@ -export const Intersect = 'intersect'; -export const Union = 'union'; -export const VlMulti = 'vlMulti'; -export const Or = 'or'; -export const And = 'and'; diff --git a/node_modules/vega-selections/src/selectionResolve.js b/node_modules/vega-selections/src/selectionResolve.js deleted file mode 100644 index 6908d9f..0000000 --- a/node_modules/vega-selections/src/selectionResolve.js +++ /dev/null @@ -1,107 +0,0 @@ -import {And, Or, Union, VlMulti} from './constants'; -import {array, toNumber} from 'vega-util'; - -/** - * Resolves selection for use as a scale domain or reads via the API. - * @param {string} name - The name of the dataset representing the selection - * @param {string} [op='union'] - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @returns {object} An object of selected fields and values. - */ -export function selectionResolve(name, op, isMulti) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - resolved = {}, multiRes = {}, types = {}, - entry, fields, values, unit, field, res, resUnit, type, union, - n = entries.length, i = 0, j, m; - - // First union all entries within the same unit. - for (; i < n; ++i) { - entry = entries[i]; - unit = entry.unit; - fields = entry.fields; - values = entry.values; - - for (j = 0, m = fields.length; j < m; ++j) { - field = fields[j]; - res = resolved[field.field] || (resolved[field.field] = {}); - resUnit = res[unit] || (res[unit] = []); - types[field.field] = type = field.type.charAt(0); - union = ops[type + '_union']; - res[unit] = union(resUnit, array(values[j])); - } - - // If the same multi-selection is repeated over views and projected over - // an encoding, it may operate over different fields making it especially - // tricky to reliably resolve it. At best, we can de-dupe identical entries - // but doing so may be more computationally expensive than it is worth. - // Instead, for now, we simply transform our store representation into - // a more human-friendly one. - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push(array(values).reduce((obj, curr, j) => (obj[fields[j].field] = curr, obj), {})); - } - } - - // Then resolve fields across units as per the op. - op = op || Union; - Object.keys(resolved).forEach(function (field) { - resolved[field] = Object.keys(resolved[field]) - .map(unit => resolved[field][unit]) - .reduce((acc, curr) => acc === undefined ? curr : ops[types[field] + '_' + op](acc, curr)); - }); - - entries = Object.keys(multiRes); - if (isMulti && entries.length) { - resolved[VlMulti] = op === Union - ? {[Or]: entries.reduce((acc, k) => (acc.push.apply(acc, multiRes[k]), acc), [])} - : {[And]: entries.map(k => ({[Or]: multiRes[k]}))}; - } - - return resolved; -} - -var ops = { - E_union: function(base, value) { - if (!base.length) return value; - - var i = 0, n = value.length; - for (; i= 0; }); - }, - - R_union: function(base, value) { - var lo = toNumber(value[0]), hi = toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; - }, - - R_intersect: function(base, value) { - var lo = toNumber(value[0]), hi = toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (hi < base[0] || base[1] < lo) { - return []; - } else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - return base; - } -}; diff --git a/node_modules/vega-selections/src/selectionTest.js b/node_modules/vega-selections/src/selectionTest.js deleted file mode 100644 index 2a20a17..0000000 --- a/node_modules/vega-selections/src/selectionTest.js +++ /dev/null @@ -1,104 +0,0 @@ -import {Intersect} from './constants'; -import {field, inrange, isArray, isDate, toNumber} from 'vega-util'; - -var TYPE_ENUM = 'E', - TYPE_RANGE_INC = 'R', - TYPE_RANGE_EXC = 'R-E', - TYPE_RANGE_LE = 'R-LE', - TYPE_RANGE_RE = 'R-RE', - UNIT_INDEX = 'index:unit'; - -// TODO: revisit date coercion? -function testPoint(datum, entry) { - var fields = entry.fields, - values = entry.values, - n = fields.length, - i = 0, dval, f; - - for (; i, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ -export function selectionTest(name, datum, op) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, - intersect = op === Intersect, - n = entries.length, - i = 0, - entry, miss, count, unit, b; - - for (; i= 2 && peek(args).value, - field = 'unit', - indexName = IndexPrefix + field, - dataName = DataPrefix + data; - - // eslint-disable-next-line no-prototype-builtins - if (op === Intersect && !hasOwnProperty(params, indexName)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - - // eslint-disable-next-line no-prototype-builtins - if (!hasOwnProperty(params, dataName)) { - params[dataName] = scope.getData(data).tuplesRef(); - } -} \ No newline at end of file diff --git a/node_modules/vega-statistics/LICENSE b/node_modules/vega-statistics/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-statistics/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-statistics/README.md b/node_modules/vega-statistics/README.md deleted file mode 100644 index 242ddb5..0000000 --- a/node_modules/vega-statistics/README.md +++ /dev/null @@ -1,302 +0,0 @@ -# vega-statistics - -Statistical routines and probability distributions. - -## API Reference - -- [Random Number Generation](#random-number-generation) -- [Distribution Methods](#distribution-methods) -- [Distribution Objects](#distribution-objects) -- [Regression](#regression) -- [Statistics](#statistics) - -### Random Number Generation - -# -vega.random() -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/random.js "Source") - -Returns a uniform pseudo-random number in the domain [0, 1). By default this is simply a call to JavaScript's built-in `Math.random` function. All Vega routines that require random numbers should use this function. - -# -vega.setRandom(randfunc) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/random.js "Source") - -Sets the random number generator to the provided function _randfunc_. Subsequent calls to random will invoke the new function to generate random numbers. Setting a custom generator can be helpful if one wishes to use an alternative source of randomness or replace the default generator with a deterministic function for testing purposes. - -# -vega.randomLCG(seed) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/lcg.js "Source") - -Returns a new random number generator with the given random _seed_. The returned function takes zero arguments and generates random values in the domain [0, 1) using a [linear congruential generator (LCG)](https://en.wikipedia.org/wiki/Linear_congruential_generator). This method is helpful in conjunction with [setRandom](#setRandom) to provide seeded random numbers for stable outputs and testing. - -### Distribution Methods - -Methods for sampling and calculating values for probability distributions. - -# -vega.sampleNormal([mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/normal.js "Source") - -Returns a sample from a univariate [normal (Gaussian) probability distribution](https://en.wikipedia.org/wiki/Normal_distribution) with specified *mean* and standard deviation *stdev*. If unspecified, the mean defaults to `0` and the standard deviation defaults to `1`. - -# -vega.cumulativeNormal(value[, mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/normal.js "Source") - -Returns the value of the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) at the given input domain *value* for a normal distribution with specified *mean* and standard deviation *stdev*. If unspecified, the mean defaults to `0` and the standard deviation defaults to `1`. - -# -vega.densityNormal(value[, mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/normal.js "Source") - -Returns the value of the [probability density function](https://en.wikipedia.org/wiki/Probability_density_function) at the given input domain *value*, for a normal distribution with specified *mean* and standard deviation *stdev*. If unspecified, the mean defaults to `0` and the standard deviation defaults to `1`. - -# -vega.quantileNormal(probability[, mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/normal.js "Source") - -Returns the quantile value (the inverse of the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function)) for the given input *probability*, for a normal distribution with specified *mean* and standard deviation *stdev*. If unspecified, the mean defaults to `0` and the standard deviation defaults to `1`. - -# -vega.sampleLogNormal([mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/lognormal.js "Source") - -Returns a sample from a univariate [log-normal probability distribution](https://en.wikipedia.org/wiki/Log-normal_distribution) with specified log *mean* and log standard deviation *stdev*. If unspecified, the log mean defaults to `0` and the log standard deviation defaults to `1`. - -# -vega.cumulativeLogNormal(value[, mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/lognormal.js "Source") - -Returns the value of the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) at the given input domain *value* for a log-normal distribution with specified log *mean* and log standard deviation *stdev*. If unspecified, the log mean defaults to `0` and the log standard deviation defaults to `1`. - -# -vega.densityLogNormal(value[, mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/lognormal.js "Source") - -Returns the value of the [probability density function](https://en.wikipedia.org/wiki/Probability_density_function) at the given input domain *value*, for a log-normal distribution with specified log *mean* and log standard deviation *stdev*. If unspecified, the log mean defaults to `0` and the log standard deviation defaults to `1`. - -# -vega.quantileLogNormal(probability[, mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/lognormal.js "Source") - -Returns the quantile value (the inverse of the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function)) for the given input *probability*, for a log-normal distribution with specified log *mean* and log standard deviation *stdev*. If unspecified, the log mean defaults to `0` and the log standard deviation defaults to `1`. - -# -vega.sampleUniform([min, max]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/uniform.js "Source") - -Returns a sample from a univariate [continuous uniform probability distribution](https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)) over the interval [*min*, *max*). If unspecified, *min* defaults to `0` and *max* defaults to `1`. If only one argument is provided, it is interpreted as the *max* value. - -# -vega.cumulativeUniform(value[, min, max]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/uniform.js "Source") - -Returns the value of the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) at the given input domain *value* for a uniform distribution over the interval [*min*, *max*). If unspecified, *min* defaults to `0` and *max* defaults to `1`. If only one argument is provided, it is interpreted as the *max* value. - -# -vega.densityUniform(value[, min, max]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/uniform.js "Source") - -Returns the value of the [probability density function](https://en.wikipedia.org/wiki/Probability_density_function) at the given input domain *value*, for a uniform distribution over the interval [*min*, *max*). If unspecified, *min* defaults to `0` and *max* defaults to `1`. If only one argument is provided, it is interpreted as the *max* value. - -# -vega.quantileUniform(probability[, min, max]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/uniform.js "Source") - -Returns the quantile value (the inverse of the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function)) for the given input *probability*, for a uniform distribution over the interval [*min*, *max*). If unspecified, *min* defaults to `0` and *max* defaults to `1`. If only one argument is provided, it is interpreted as the *max* value. - -### Distribution Objects - -Objects representing probability distributions, with methods for sampling and calculating values. Each method takes a set of distributional parameters and returns a distribution object representing a random variable. - -Distribution objects expose the following methods: - -- dist.sample(): Samples a random value drawn from this distribution. -- dist.pdf(value): Calculates the value of the [probability density function](https://en.wikipedia.org/wiki/Probability_density_function) at the given input domain *value*. -- dist.cdf(value): Calculates the value of the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) at the given input domain *value*. -- dist.icdf(probability): Calculates the inverse of the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) for the given input *probability*. - -# -vega.randomNormal([mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/normal.js "Source") - -Creates a distribution object representing a [normal (Gaussian) probability distribution](https://en.wikipedia.org/wiki/Normal_distribution) with specified *mean* and standard deviation *stdev*. If unspecified, the mean defaults to `0` and the standard deviation defaults to `1`. - -Once created, *mean* and *stdev* values can be accessed or modified using the `mean` and `stdev` getter/setter methods. - -# -vega.randomLogNormal([mean, stdev]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/lognormal.js "Source") - -Creates a distribution object representing a [log-normal probability distribution](https://en.wikipedia.org/wiki/Log-normal_distribution) with specified log *mean* and log standard deviation *stdev*. If unspecified, the log mean defaults to `0` and the log standard deviation defaults to `1`. - -Once created, *mean* and *stdev* values can be accessed or modified using the `mean` and `stdev` getter/setter methods. - -# -vega.randomUniform([min, max]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/uniform.js "Source") - -Creates a distribution object representing a [continuous uniform probability distribution](https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)) over the interval [*min*, *max*). If unspecified, *min* defaults to `0` and *max* defaults to `1`. If only one argument is provided, it is interpreted as the *max* value. - -Once created, *min* and *max* values can be accessed or modified using the `min` and `max` getter/setter methods. - -# -vega.randomInteger([min,] max) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/integer.js "Source") - -Creates a distribution object representing a [discrete uniform probability distribution](https://en.wikipedia.org/wiki/Discrete_uniform_distribution) over the integer domain [*min*, *max*). If only one argument is provided, it is interpreted as the *max* value. If unspecified, *min* defaults to `0`. - -Once created, *min* and *max* values can be accessed or modified using the `min` and `max` getter/setter methods. - -# -vega.randomMixture(distributions[, weights]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/mixture.js "Source") - -Creates a distribution object representing a (weighted) mixture of probability distributions. The *distributions* argument should be an array of distribution objects. The optional *weights* array provides proportional numerical weights for each distribution. If provided, the values in the *weights* array will be normalized to ensure that weights sum to 1. Any unspecified weight values default to `1` (prior to normalization). Mixture distributions do **not** support the `icdf` method: calling `icdf` will result in an error. - -Once created, the *distributions* and *weights* arrays can be accessed or modified using the `distributions` and `weights` getter/setter methods. - -# -vega.randomKDE(values[, bandwidth]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/kde.js "Source") - -Creates a distribution object representing a [kernel density estimate](https://en.wikipedia.org/wiki/Kernel_density_estimation) for an array of numerical *values*. This method uses a Gaussian kernel to estimate a smoothed, continuous probability distribution. The optional *bandwidth* parameter determines the width of the Gaussian kernel. If the *bandwidth* is either `0` or unspecified, a default bandwidth value will be automatically estimated based on the input data. KDE distributions do **not** support the `icdf` method: calling `icdf` will result in an error. - -Once created, *data* and *bandwidth* values can be accessed or modified using the `data` and `bandwidth` getter/setter methods. - -### Regression - -Two-dimensional regression methods to predict one variable given another. - -# -vega.regressionLinear(data, x, y) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/regression/linear.js "Source") - -Fit a linear regression model with functional form _y = a + b * x_ for the input *data* array and corresponding *x* and *y* accessor functions. Returns an object for the fit model parameters with the following properties: - -- _coef_: An array of fitted coefficients of the form _[a, b]_. -- _predict_: A function that returns a regression prediction for an input _x_ value. -- _rSquared_: The R2 [coefficient of determination](https://en.wikipedia.org/wiki/Coefficient_of_determination), indicating the amount of total variance of _y_ accounted for by the model. - -# -vega.regressionLog(data, x, y) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/regression/log.js "Source") - -Fit a logarithmic regression model with functional form _y = a + b * log(x)_ for the input input *data* array and corresponding *x* and *y* accessor functions. - -Returns an object for the fit model parameters with the following properties: - -- _coef_: An array of fitted coefficients of the form _[a, b]_. -- _predict_: A function that returns a regression prediction for an input _x_ value. -- _rSquared_: The R2 [coefficient of determination](https://en.wikipedia.org/wiki/Coefficient_of_determination), indicating the amount of total variance of _y_ accounted for by the model. - -# -vega.regressionExp(data, x, y) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/regression/exp.js "Source") - -Fit an exponential regression model with functional form _y = a + eb * x_ for the input *data* array and corresponding *x* and *y* accessor functions. Returns an object for the fit model parameters with the following properties: - -- _coef_: An array of fitted coefficients of the form _[a, b]_. -- _predict_: A function that returns a regression prediction for an input _x_ value. -- _rSquared_: The R2 [coefficient of determination](https://en.wikipedia.org/wiki/Coefficient_of_determination), indicating the amount of total variance of _y_ accounted for by the model. - -# -vega.regressionPow(data, x, y) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/regression/pow.js "Source") - -Fit a power law regression model with functional form _y = a * xb_ for the input *data* array and corresponding *x* and *y* accessor functions. Returns an object for the fit model parameters with the following properties: - -- _coef_: An array of fitted coefficients of the form _[a, b]_. -- _predict_: A function that returns a regression prediction for an input _x_ value. -- _rSquared_: The R2 [coefficient of determination](https://en.wikipedia.org/wiki/Coefficient_of_determination), indicating the amount of total variance of _y_ accounted for by the model. - -# -vega.regressionLinear(data, x, y) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/regression/quad.js "Source") - -Fit a quadratic regression model with functional form _y = a + b * x + c * x2_ for the input *data* array and corresponding *x* and *y* accessor functions. Returns an object for the fit model parameters with the following properties: - -- _coef_: An array of fitted coefficients of the form _[a, b, c]_, -- _predict_: A function that returns a regression prediction for an input _x_ value. -- _rSquared_: The R2 [coefficient of determination](https://en.wikipedia.org/wiki/Coefficient_of_determination), indicating the amount of total variance of _y_ accounted for by the model. - -# -vega.regressionPoly(data, x, y, order) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/regression/poly.js "Source") - -Fit a polynomial regression model of specified _order_ with functional form _y = a + b * x + ... + k * xorder_ for the input *data* array and corresponding *x* and *y* accessor functions. Returns an object for the fit model parameters with the following properties: - -- _coef_: An _(order + 1)_-length array of polynomial coefficients of the form _[a, b, c, d, ...]_. -- _predict_: A function that returns a regression prediction for an input _x_ value. -- _rSquared_: The R2 [coefficient of determination](https://en.wikipedia.org/wiki/Coefficient_of_determination), indicating the amount of total variance of _y_ accounted for by the model. - -# -vega.regressionLoess(data, x, y, bandwidth) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/regression/loess.js "Source") - -Fit a smoothed, non-parametric trend line the input *data* array and corresponding *x* and *y* accessor functions using _loess_ (locally-estimated scatterplot smoothing). Loess performs a sequence of local weighted regressions over a sliding window of nearest-neighbor points. The _bandwidth_ argument determines the size of the sliding window, expressed as a [0, 1] fraction of the total number of data points included. - -# -vega.sampleCurve(f, extent[, minSteps, maxSteps]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/sampleCurve.js "Source") - -Generate sample points from an interpolation function _f_ for the provided domain _extent_ and return an array of _[x, y]_ points. Performs adaptive subdivision to dynamically sample more points in regions of higher curvature. Subdivision stops when the difference in angles between the current samples and a proposed subdivision falls below one-quarter of a degree. The optional _minSteps_ argument (default 25), determines the minimal number of initial, uniformly-spaced sample points to draw. The optional _maxSteps_ argument (default 200), indicates the maximum resolution at which adaptive sampling will stop, defined relative to a uniform grid of size _maxSteps_. If _minSteps_ and _maxSteps_ are identical, no adaptive sampling will be performed and only the initial, uniformly-spaced samples will be returned. - -### Statistics - -Statistical methods for bandwidth estimation, bin calculation, bootstrapped confidence intervals, and quartile boundaries. - -# -vega.bandwidthNRD(array[, accessor]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/bandwidth.js "Source") - -Given an *array* of numeric values, estimates a bandwidth value for use in Gaussian kernel density estimation, assuming a normal reference distribution. The underlying formula (from Scott 1992) is 1.06 times the minimum of the standard deviation and the interquartile range divided by 1.34 times the sample size to the negative one-fifth power, along with special case handling in case of zero values for the interquartile range or deviation. An optional *accessor* function can be used to first extract numerical values from an array of input objects, and is equivalent to first calling `array.map(accessor)`. - -# -vega.bin(options) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/bin.js "Source") - -Determine a quantitative binning scheme, for example to create a histogram. Based on the options provided given, this method will search over a space of possible bins, aligning step sizes with a given number base and applying constraints such as the maximum number of allowable bins. Given a set of options (see below), returns an object describing the binning scheme, in terms of `start`, `stop`, and `step` properties. - -The supported options properties are: - -- _extent_: (required) A two-element (`[min, max]`) array indicating the range over which the bin values are defined. -- _base_: The number base to use for automatic bin determination (default base `10`). -- _maxbins_: The maximum number of allowable bins (default `20`). -- _span_: The value span over which to generate bin boundaries. The default is `extent[1] - extent[0]`. This parameter allows automatic step size determination over custom spans (for example, a zoomed-in region) while retaining the overall _extent_. -- _step_: An exact step size to use between bins. If provided, the _maxbins_, _span_, and _steps_ options will be ignored. -- _steps_: An array of allowable step sizes to choose from. If provided, the _maxbins_ option will be ignored. -- _minstep_: A minimum allowable step size (particularly useful for integer values, default `0`). -- _divide_: An array of scale factors indicating allowable subdivisions. The default value is `[5, 2]`, which indicates that the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints. -- _nice_: Boolean indicating if the start and stop values should be nicely-rounded relative to the step size (default `true`). - -```js -vega.bin({extent:[0, 1], maxbins:10}); // {start:0, stop:1, step:0.1} -vega.bin({extent:[0, 1], maxbins:5}); // {start:0, stop:10, step:2} -vega.bin({extent:[5, 10], maxbins:5}); // {start:5, stop:10, step:1} -``` - -# -vega.bootstrapCI(array, samples, alpha[, accessor]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/bootstrapCI.js "Source") - -Calculates a [bootstrapped](https://en.wikipedia.org/wiki/Bootstrapping_(statistics)) [confidence interval](https://en.wikipedia.org/wiki/Confidence_interval) for an input *array* of values, based on a given number of *samples* iterations and a target *alpha* value. For example, an *alpha* value of `0.05` corresponds to a 95% confidence interval An optional *accessor* function can be used to first extract numerical values from an array of input objects, and is equivalent to first calling `array.map(accessor)`. This method ignores null, undefined, and NaN values. - -# -vega.dotbin(sortedArray, step[, smooth, accessor]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/dotbin.js "Source") - -Calculates [dot plot](https://en.wikipedia.org/wiki/Dot_plot_%28statistics%29) bin locations for an input *sortedArray* of numerical values, and returns an array of bin locations with indices matching the input *sortedArray*. This method implements the ["dot density" algorithm of Wilkinson, 1999](https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf). The *step* parameter determines the bin width: points within *step* values of an anchor point will be assigned the same bin location. The optional *smooth* parameter is a boolean value indicating if the bin locations should additionally be smoothed to reduce variance. An optional *accessor* function can be used to first extract numerical values from an array of input objects, and is equivalent to first calling `array.map(accessor)`. Any null, undefined, or NaN values should be removed prior to calling this method. - -# -vega.quantiles(array, p[, accessor]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/quartiles.js "Source") - -Given an *array* of numeric values and array *p* of probability thresholds in the range [0, 1], returns an array of p-[quantiles](https://en.wikipedia.org/wiki/Quantile). The return value is a array the same length as the input *p*. An optional *accessor* function can be used to first extract numerical values from an array of input objects, and is equivalent to first calling `array.map(accessor)`. This method ignores null, undefined and NaN values. - -# -vega.quartiles(array[, accessor]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-statistics/src/quartiles.js "Source") - -Given an *array* of numeric values, returns an array of [quartile](https://en.wikipedia.org/wiki/Quartile) boundaries. The return value is a 3-element array consisting of the first, second (median), and third quartile boundaries. An optional *accessor* function can be used to first extract numerical values from an array of input objects, and is equivalent to first calling `array.map(accessor)`. This method ignores null, undefined and NaN values. diff --git a/node_modules/vega-statistics/build/vega-statistics.js b/node_modules/vega-statistics/build/vega-statistics.js deleted file mode 100644 index b146607..0000000 --- a/node_modules/vega-statistics/build/vega-statistics.js +++ /dev/null @@ -1,1215 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array')) : - typeof define === 'function' && define.amd ? define(['exports', 'd3-array'], factory) : - (global = global || self, factory(global.vega = {}, global.d3)); -}(this, (function (exports, d3Array) { 'use strict'; - - function* numbers(values, valueof) { - if (valueof == null) { - for (let value of values) { - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - value = valueof(value, ++index, values); - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } - } - - function quantiles(array, p, f) { - var values = Float64Array.from(numbers(array, f)); - - // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - values.sort(d3Array.ascending); - - return p.map(_ => d3Array.quantileSorted(values, _)); - } - - function quartiles(array, f) { - return quantiles(array, [0.25, 0.50, 0.75], f); - } - - // Scott, D. W. (1992) Multivariate Density Estimation: - // Theory, Practice, and Visualization. Wiley. - function estimateBandwidth(array, f) { - var n = array.length, - v = d3Array.deviation(array, f), - q = quartiles(array, f), - h = (q[2] - q[0]) / 1.34; - - v = Math.min(v, h) || v || Math.abs(q[0]) || 1; - - return 1.06 * v * Math.pow(n, -0.2); - } - - function bin(_) { - // determine range - var maxb = _.maxbins || 20, - base = _.base || 10, - logb = Math.log(base), - div = _.divide || [5, 2], - min = _.extent[0], - max = _.extent[1], - span = _.span || (max - min) || Math.abs(min) || 1, - step, level, minstep, precision, v, i, n, eps; - - if (_.step) { - // if step size is explicitly given, use that - step = _.step; - } else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - for (i=0, n=_.steps.length; i < n && _.steps[i] < v; ++i); - step = _.steps[Math.max(0, i-1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max( - minstep, - Math.pow(base, Math.round(Math.log(span) / logb) - level) - ); - - // increase step size if too many bins - while (Math.ceil(span/step) > maxb) { step *= base; } - - // decrease step size if allowed - for (i=0, n=div.length; i= minstep && span / v <= maxb) step = v; - } - } - - // update precision, min and max - v = Math.log(step); - precision = v >= 0 ? 0 : ~~(-v / logb) + 1; - eps = Math.pow(base, -precision - 1); - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; - } - - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; - } - - exports.random = Math.random; - - function setRandom(r) { - exports.random = r; - } - - function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [undefined, undefined]; - - var values = Float64Array.from(numbers(array, f)), - n = values.length, - m = samples, - a, i, j, mu; - - for (j=0, mu=Array(m); j _); - - let i = 0, j = 1, - n = array.length, - v = new Float64Array(n), - a = f(array[0]), - b = a, - w = a + step, - x; - - for (; j= w) { - b = (a + b) / 2; - for (; i> 1); - while (d < b) v[d++] = v[b]; - while (d > b) v[d--] = v[a]; - } - - // update left stack indices - a = b; - b = c; - } - - return v; - } - - function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function() { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; - } - - function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - - var dist = {}, - a, b, d; - - dist.min = function(_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else { - return a; - } - }; - - dist.max = function(_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else { - return b; - } - }; - - dist.sample = function() { - return a + Math.floor(d * exports.random()); - }; - - dist.pdf = function(x) { - return (x === Math.floor(x) && x >= a && x < b) ? 1 / d : 0; - }; - - dist.cdf = function(x) { - var v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }; - - dist.icdf = function(p) { - return (p >= 0 && p <= 1) ? a - 1 + Math.floor(p * d) : NaN; - }; - - return dist.min(min).max(max); - } - - const SQRT2PI = Math.sqrt(2 * Math.PI); - const SQRT2 = Math.SQRT2; - - let nextSample = NaN; - - function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - - let x = 0, y = 0, rds, c; - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = exports.random() * 2 - 1; - y = exports.random() * 2 - 1; - rds = x * x + y * y; - } while (rds === 0 || rds > 1); - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - x *= c; - nextSample = y * c; - } - return mean + x * stdev; - } - - function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - const z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); - } - - // Approximation from West (2009) - // Better Approximations to Cumulative Normal Functions - function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - - let cd, - z = (value - mean) / stdev, - Z = Math.abs(z); - - if (Z > 37) { - cd = 0; - } else { - let sum, exp = Math.exp(-Z * Z / 2); - if (Z < 7.07106781186547) { - sum = 3.52624965998911e-02 * Z + 0.700383064443688; - sum = sum * Z + 6.37396220353165; - sum = sum * Z + 33.912866078383; - sum = sum * Z + 112.079291497871; - sum = sum * Z + 221.213596169931; - sum = sum * Z + 220.206867912376; - cd = exp * sum; - sum = 8.83883476483184e-02 * Z + 1.75566716318264; - sum = sum * Z + 16.064177579207; - sum = sum * Z + 86.7807322029461; - sum = sum * Z + 296.564248779674; - sum = sum * Z + 637.333633378831; - sum = sum * Z + 793.826512519948; - sum = sum * Z + 440.413735824752; - cd = cd / sum; - } else { - sum = Z + 0.65; - sum = Z + 4 / sum; - sum = Z + 3 / sum; - sum = Z + 2 / sum; - sum = Z + 1 / sum; - cd = exp / sum / 2.506628274631; - } - } - return z > 0 ? 1 - cd : cd; - } - - // Approximation of Probit function using inverse error function. - function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); - } - - // Approximate inverse error function. Implementation from "Approximating - // the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. - // Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 - function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - let w = - Math.log((1 - x) * (1 + x)), p; - - if (w < 6.25) { - w -= 3.125; - p = -3.6444120640178196996e-21; - p = -1.685059138182016589e-19 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -1.333171662854620906e-16 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -4.0545662729752068639e-14 + p * w; - p = -8.1519341976054721522e-14 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -1.2975133253453532498e-11 + p * w; - p = -5.4154120542946279317e-11 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -4.1126339803469836976e-09 + p * w; - p = -2.9070369957882005086e-08 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -1.3654692000834678645e-06 + p * w; - p = -1.3882523362786468719e-05 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.00074070253416626697512 + p * w; - p = -0.0060336708714301490533 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -2.7517406297064545428e-07 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -4.013867526981545969e-06 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -4.7318229009055733981e-05 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628474796 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047313 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.0037512085075692412107 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -2.7109920616438573243e-11; - p = -2.5556418169965252055e-10 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -3.7894654401267369937e-09 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -1.4960026627149240478e-08 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -6.7711997758452339498e-08 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -9.9298272942317002539e-07 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -1.9681778105531670567e-05 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477347 + p * w; - p = -0.00013871931833623122026 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else { - p = Infinity; - } - - return p * x; - } - - function gaussian(mean, stdev) { - var mu, - sigma, - dist = { - mean: function(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: () => sampleNormal(mu, sigma), - pdf: value => densityNormal(value, mu, sigma), - cdf: value => cumulativeNormal(value, mu, sigma), - icdf: p => quantileNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); - } - - // TODO: support for additional kernels? - function kde(support, bandwidth) { - var kernel = gaussian(), - dist = {}, - n = 0; - - dist.data = function(_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else { - return support; - } - }; - - dist.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = estimateBandwidth(support); - return dist; - }; - - dist.sample = function() { - return support[~~(exports.random() * n)] + bandwidth * kernel.sample(); - }; - - dist.pdf = function(x) { - for (var y=0, i=0; i sampleLogNormal(mu, sigma), - pdf: value => densityLogNormal(value, mu, sigma), - cdf: value => cumulativeLogNormal(value, mu, sigma), - icdf: p => quantileLogNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); - } - - function mixture(dists, weights) { - var dist = {}, m = 0, w; - - function normalize(x) { - var w = [], sum = 0, i; - for (i=0; i= min && value <= max) ? 1 / (max - min) : 0; - } - - function cumulativeUniform(value, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); - } - - function quantileUniform(p, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return (p >= 0 && p <= 1) ? min + p * (max - min) : NaN; - } - - function uniform(min, max) { - var a, b, - dist = { - min: function(_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else { - return a; - } - }, - max: function(_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else { - return b; - } - }, - sample: () => sampleUniform(a, b), - pdf: value => densityUniform(value, a, b), - cdf: value => cumulativeUniform(value, a, b), - icdf: p => quantileUniform(p, a, b) - }; - - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return dist.min(min).max(max); - } - - // Ordinary Least Squares - function ols(uX, uY, uXY, uX2) { - const delta = uX2 - uX * uX, - slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, - intercept = uY - slope * uX; - - return [intercept, slope]; - } - - function points(data, x, y, sort) { - data = data.filter(d => { - let u = x(d), v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - - if (sort) { - data.sort((a, b) => x(a) - x(b)); - } - - const n = data.length, - X = new Float64Array(n), - Y = new Float64Array(n); - - // extract values, calculate means - let i = 0, ux = 0, uy = 0, xv, yv, d; - for (d of data) { - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } - - // mean center the data - for (i=0; i= u && v != null && (v = +v) >= v) { - callback(u, v, ++i); - } - } - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function rSquared(data, x, y, uY, predict) { - let SSE = 0, SST = 0; - - visitPoints(data, x, y, (dx, dy) => { - const sse = dy - predict(dx), - sst = dy - uY; - - SSE += sse * sse; - SST += sst * sst; - }); - - return 1 - SSE / SST; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function linear(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * x; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function log(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * Math.log(x); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } - - function exp(data, x, y) { - // eslint-disable-next-line no-unused-vars - const [xv, yv, ux, uy] = points(data, x, y); - let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly, xy; - - visitPoints(data, x, y, (_, dy) => { - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - - const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), - predict = x => Math.exp(c0 + c1 * (x - ux)); - - return { - coef: [Math.exp(c0 - c1 * ux), c1], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function pow(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, YS = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - const lx = Math.log(dx), - ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] * Math.pow(x, coef[1]); - - coef[0] = Math.exp(coef[0]); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; - } - - function quad(data, x, y) { - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length; - - let X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, - i, dx, dy, x2; - - for (i=0; i { - x = x - ux; - return a * x * x + b * x + c + uy; - }; - - // transform coefficients back from mean-centered space - return { - coef: [ - c - b * ux + a * ux * ux + uy, - b - 2 * a * ux, - a - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - // ... which was adapted from regression-js by Tom Alexander - // Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 - // License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE - function poly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 1) return linear(data, x, y); - if (order === 2) return quad(data, x, y); - - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length, - lhs = [], - rhs = [], - k = order + 1; - - let i, j, l, v, c; - - for (i=0; i { - x -= ux; - let y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - for (i=3; i=0; --i) { - v = a[i]; - c = 1; - z[i] += v; - for (j=1; j<=i; ++j) { - c *= (i + 1 - j) / j; // binomial coefficent - z[i-j] += v * Math.pow(x, j) * c; - } - } - - // bias term - z[0] += y; - - return z; - } - - // Given an array for a two-dimensional matrix and the polynomial order, - // solve A * x = b using Gaussian elimination. - function gaussianElimination(matrix) { - const n = matrix.length - 1, - coef = []; - - let i, j, k, r, t; - - for (i = 0; i < n; ++i) { - r = i; // max row - for (j = i + 1; j < n; ++j) { - if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { - r = j; - } - } - - for (k = i; k < n + 1; ++k) { - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - - for (j = i + 1; j < n; ++j) { - for (k = n; k >= i; k--) { - matrix[k][j] -= (matrix[k][i] * matrix[i][j]) / matrix[i][i]; - } - } - } - - for (j = n - 1; j >= 0; --j) { - t = 0; - for (k = j + 1; k < n; ++k) { - t += matrix[k][j] * coef[k]; - } - coef[j] = (matrix[n][j] - t) / matrix[j][j]; - } - - return coef; - } - - const maxiters = 2, - epsilon = 1e-12; - - // Adapted from science.js by Jason Davies - // Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js - // License: https://github.com/jasondavies/science.js/blob/master/LICENSE - function loess(data, x, y, bandwidth) { - const [xv, yv, ux, uy] = points(data, x, y, true), - n = xv.length, - bw = Math.max(2, ~~(bandwidth * n)), // # nearest neighbors - yhat = new Float64Array(n), - residuals = new Float64Array(n), - robustWeights = new Float64Array(n).fill(1); - - for (let iter = -1; ++iter <= maxiters; ) { - const interval = [0, bw - 1]; - - for (let i = 0; i < n; ++i) { - const dx = xv[i], - i0 = interval[0], - i1 = interval[1], - edge = (dx - xv[i0]) > (xv[i1] - dx) ? i0 : i1; - - let W = 0, X = 0, Y = 0, XY = 0, X2 = 0, - denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - - for (let k = i0; k <= i1; ++k) { - const xk = xv[k], - yk = yv[k], - w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], - xkw = xk * w; - - W += w; - X += xkw; - Y += yk * w; - XY += yk * xkw; - X2 += xk * xkw; - } - - // linear regression fit - const [a, b] = ols(X / W, Y / W, XY / W, X2 / W); - yhat[i] = a + b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - - updateInterval(xv, i + 1, interval); - } - - if (iter === maxiters) { - break; - } - - const medianResidual = d3Array.median(residuals); - if (Math.abs(medianResidual) < epsilon) break; - - for (let i = 0, arg, w; i < n; ++i){ - arg = residuals[i] / (6 * medianResidual); - // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - robustWeights[i] = (arg >= 1) ? epsilon : ((w = 1 - arg * arg) * w); - } - } - - return output(xv, yhat, ux, uy); - } - - // weighting kernel for local regression - function tricube(x) { - return (x = 1 - x * x * x) * x * x; - } - - // advance sliding window interval of nearest neighbors - function updateInterval(xv, i, interval) { - let val = xv[i], - left = interval[0], - right = interval[1] + 1; - - if (right >= xv.length) return; - - // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - while (i > left && (xv[right] - val) <= (val - xv[left])) { - interval[0] = ++left; - interval[1] = right; - ++right; - } - } - - // generate smoothed output points - // average points with repeated x values - function output(xv, yhat, ux, uy) { - const n = xv.length, out = []; - let i = 0, cnt = 0, prev = [], v; - - for (; i [x, f(x)], - minX = extent[0], - maxX = extent[1], - span = maxX - minX, - stop = span / maxSteps, - prev = [point(minX)], - next = []; - - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for (let i = 1; i < maxSteps; ++i) { - prev.push(point(minX + (i / minSteps) * span)); - } - prev.push(point(maxX)); - return prev; - } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - for (let i = minSteps; --i > 0;) { - next.push(point(minX + (i / minSteps) * span)); - } - } - - let p0 = prev[0], - p1 = next[next.length - 1]; - - while (p1) { - // midpoint for potential curve subdivision - const pm = point((p0[0] + p1[0]) / 2); - - if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) { - // maximum resolution has not yet been met, and - // subdivision midpoint sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - } else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - p1 = next[next.length - 1]; - } - - return prev; - } - - function angleDelta(p, q, r) { - const a0 = Math.atan2(r[1] - p[1], r[0] - p[0]), - a1 = Math.atan2(q[1] - p[1], q[0] - p[0]); - return Math.abs(a0 - a1); - } - - exports.bandwidthNRD = estimateBandwidth; - exports.bin = bin; - exports.bootstrapCI = bootstrapCI; - exports.cumulativeLogNormal = cumulativeLogNormal; - exports.cumulativeNormal = cumulativeNormal; - exports.cumulativeUniform = cumulativeUniform; - exports.densityLogNormal = densityLogNormal; - exports.densityNormal = densityNormal; - exports.densityUniform = densityUniform; - exports.dotbin = dotbin; - exports.quantileLogNormal = quantileLogNormal; - exports.quantileNormal = quantileNormal; - exports.quantileUniform = quantileUniform; - exports.quantiles = quantiles; - exports.quartiles = quartiles; - exports.randomInteger = integer; - exports.randomKDE = kde; - exports.randomLCG = lcg; - exports.randomLogNormal = lognormal; - exports.randomMixture = mixture; - exports.randomNormal = gaussian; - exports.randomUniform = uniform; - exports.regressionExp = exp; - exports.regressionLinear = linear; - exports.regressionLoess = loess; - exports.regressionLog = log; - exports.regressionPoly = poly; - exports.regressionPow = pow; - exports.regressionQuad = quad; - exports.sampleCurve = sampleCurve; - exports.sampleLogNormal = sampleLogNormal; - exports.sampleNormal = sampleNormal; - exports.sampleUniform = sampleUniform; - exports.setRandom = setRandom; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-statistics/build/vega-statistics.min.js b/node_modules/vega-statistics/build/vega-statistics.min.js deleted file mode 100644 index afe237b..0000000 --- a/node_modules/vega-statistics/build/vega-statistics.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],n):n((t=t||self).vega={},t.d3)}(this,(function(t,n){"use strict";function*r(t,n){if(null==n)for(let n of t)null!=n&&""!==n&&(n=+n)>=n&&(yield n);else{let r=-1;for(let e of t)e=n(e,++r,t),null!=e&&""!==e&&(e=+e)>=e&&(yield e)}}function e(t,e,o){var u=Float64Array.from(r(t,o));return u.sort(n.ascending),e.map(t=>n.quantileSorted(u,t))}function o(t,n){return e(t,[.25,.5,.75],n)}function u(t,r){var e=t.length,u=n.deviation(t,r),a=o(t,r),f=(a[2]-a[0])/1.34;return 1.06*(u=Math.min(u,f)||u||Math.abs(a[0])||1)*Math.pow(e,-.2)}t.random=Math.random;const a=Math.sqrt(2*Math.PI),f=Math.SQRT2;let l=NaN;function i(n,r){n=n||0,r=null==r?1:r;let e,o,u=0,a=0;if(l==l)u=l,l=NaN;else{do{u=2*t.random()-1,a=2*t.random()-1,e=u*u+a*a}while(0===e||e>1);o=Math.sqrt(-2*Math.log(e)/e),u*=o,l=a*o}return n+u*r}function c(t,n,r){const e=(t-(n||0))/(r=null==r?1:r);return Math.exp(-.5*e*e)/(r*a)}function s(t,n,r){let e,o=(t-(n=n||0))/(r=null==r?1:r),u=Math.abs(o);if(u>37)e=0;else{let t,n=Math.exp(-u*u/2);u<7.07106781186547?(t=.0352624965998911*u+.700383064443688,t=t*u+6.37396220353165,t=t*u+33.912866078383,t=t*u+112.079291497871,t=t*u+221.213596169931,t=t*u+220.206867912376,e=n*t,t=.0883883476483184*u+1.75566716318264,t=t*u+16.064177579207,t=t*u+86.7807322029461,t=t*u+296.564248779674,t=t*u+637.333633378831,t=t*u+793.826512519948,t=t*u+440.413735824752,e/=t):(t=u+.65,t=u+4/t,t=u+3/t,t=u+2/t,t=u+1/t,e=n/t/2.506628274631)}return o>0?1-e:e}function h(t,n,r){return t<0||t>1?NaN:(n||0)+(null==r?1:r)*f*function(t){let n,r=-Math.log((1-t)*(1+t));r<6.25?(r-=3.125,n=-364441206401782e-35,n=n*r-16850591381820166e-35,n=128584807152564e-32+n*r,n=11157877678025181e-33+n*r,n=n*r-1333171662854621e-31,n=20972767875968562e-33+n*r,n=6637638134358324e-30+n*r,n=n*r-4054566272975207e-29,n=n*r-8151934197605472e-29,n=26335093153082323e-28+n*r,n=n*r-12975133253453532e-27,n=n*r-5415412054294628e-26,n=1.0512122733215323e-9+n*r,n=n*r-4.112633980346984e-9,n=n*r-2.9070369957882005e-8,n=4.2347877827932404e-7+n*r,n=n*r-13654692000834679e-22,n=n*r-13882523362786469e-21,n=.00018673420803405714+n*r,n=n*r-.000740702534166267,n=n*r-.006033670871430149,n=.24015818242558962+n*r,n=1.6536545626831027+n*r):r<16?(r=Math.sqrt(r)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*r,n=n*r-2.7517406297064545e-7,n=1.8239629214389228e-8+n*r,n=15027403968909828e-22+n*r,n=n*r-4013867526981546e-21,n=29234449089955446e-22+n*r,n=12475304481671779e-21+n*r,n=n*r-47318229009055734e-21,n=6828485145957318e-20+n*r,n=24031110387097894e-21+n*r,n=n*r-.0003550375203628475,n=.0009532893797373805+n*r,n=n*r-.0016882755560235047,n=.002491442096107851+n*r,n=n*r-.003751208507569241,n=.005370914553590064+n*r,n=1.0052589676941592+n*r,n=3.0838856104922208+n*r):Number.isFinite(r)?(r=Math.sqrt(r)-5,n=-27109920616438573e-27,n=n*r-2.555641816996525e-10,n=1.5076572693500548e-9+n*r,n=n*r-3.789465440126737e-9,n=7.61570120807834e-9+n*r,n=n*r-1.496002662714924e-8,n=2.914795345090108e-8+n*r,n=n*r-6.771199775845234e-8,n=2.2900482228026655e-7+n*r,n=n*r-9.9298272942317e-7,n=4526062597223154e-21+n*r,n=n*r-1968177810553167e-20,n=7599527703001776e-20+n*r,n=n*r-.00021503011930044477,n=n*r-.00013871931833623122,n=1.0103004648645344+n*r,n=4.849906401408584+n*r):n=1/0;return n*t}(2*t-1)}function d(t,n){var r,e,o={mean:function(t){return arguments.length?(r=t||0,o):r},stdev:function(t){return arguments.length?(e=null==t?1:t,o):e},sample:()=>i(r,e),pdf:t=>c(t,r,e),cdf:t=>s(t,r,e),icdf:t=>h(t,r,e)};return o.mean(t).stdev(n)}function p(t,n){return t=t||0,n=null==n?1:n,Math.exp(t+i()*n)}function m(t,n,r){if(t<=0)return 0;n=n||0,r=null==r?1:r;const e=(Math.log(t)-n)/r;return Math.exp(-.5*e*e)/(r*a*t)}function M(t,n,r){return s(Math.log(t),n,r)}function g(t,n,r){return Math.exp(h(t,n,r))}function v(n,r){return null==r&&(r=null==n?1:n,n=0),n+(r-n)*t.random()}function b(t,n,r){return null==r&&(r=null==n?1:n,n=0),t>=n&&t<=r?1/(r-n):0}function w(t,n,r){return null==r&&(r=null==n?1:n,n=0),tr?1:(t-n)/(r-n)}function x(t,n,r){return null==r&&(r=null==n?1:n,n=0),t>=0&&t<=1?n+t*(r-n):NaN}function y(t,n,r,e){const o=e-t*t,u=Math.abs(o)<1e-24?0:(r-t*n)/o;return[n-u*t,u]}function N(t,n,r,e){t=t.filter(t=>{let e=n(t),o=r(t);return null!=e&&(e=+e)>=e&&null!=o&&(o=+o)>=o}),e&&t.sort((t,r)=>n(t)-n(r));const o=t.length,u=new Float64Array(o),a=new Float64Array(o);let f,l,i,c=0,s=0,h=0;for(i of t)u[c]=f=+n(i),a[c]=l=+r(i),++c,s+=(f-s)/c,h+=(l-h)/c;for(c=0;c=o&&null!=u&&(u=+u)>=u&&e(o,u,++a)}function A(t,n,r,e,o){let u=0,a=0;return q(t,n,r,(t,n)=>{const r=n-o(t),f=n-e;u+=r*r,a+=f*f}),1-u/a}function F(t,n,r){let e=0,o=0,u=0,a=0,f=0;q(t,n,r,(t,n)=>{++f,e+=(t-e)/f,o+=(n-o)/f,u+=(t*n-u)/f,a+=(t*t-a)/f});const l=y(e,o,u,a),i=t=>l[0]+l[1]*t;return{coef:l,predict:i,rSquared:A(t,n,r,o,i)}}function L(t,n,r){const[e,o,u,a]=N(t,n,r),f=e.length;let l,i,c,s,h=0,d=0,p=0,m=0,M=0;for(l=0;lb*(t-=u)*t+w*t+x+a;return{coef:[x-w*u+b*u*u+a,w-2*b*u,b],predict:y,rSquared:A(t,n,r,a,y)}}function S(t,n,r,e){const o=Array(t);let u,a,f,l;for(u=0;u=0;--u)for(f=n[u],l=1,o[u]+=f,a=1;a<=u;++a)l*=(u+1-a)/a,o[u-a]+=f*Math.pow(r,a)*l;return o[0]+=e,o}function E(t){return(t=1-t*t*t)*t*t}function P(t,n,r){let e=t[n],o=r[0],u=r[1]+1;if(!(u>=t.length))for(;n>o&&t[u]-e<=e-t[o];)r[0]=++o,r[1]=u,++u}const U=.1*Math.PI/180;function I(t,n,r){const e=Math.atan2(r[1]-t[1],r[0]-t[0]),o=Math.atan2(n[1]-t[1],n[0]-t[0]);return Math.abs(e-o)}t.bandwidthNRD=u,t.bin=function(t){var n,r,e,o,u,a,f,l,i=t.maxbins||20,c=t.base||10,s=Math.log(c),h=t.divide||[5,2],d=t.extent[0],p=t.extent[1],m=t.span||p-d||Math.abs(d)||1;if(t.step)n=t.step;else if(t.steps){for(u=m/i,a=0,f=t.steps.length;ai;)n*=c;for(a=0,f=h.length;a=e&&m/u<=i&&(n=u)}return o=(u=Math.log(n))>=0?0:1+~~(-u/s),l=Math.pow(c,-o-1),(t.nice||void 0===t.nice)&&(d=d<(u=Math.floor(d/n+l)*n)?u-n:u,p=Math.ceil(p/n)*n),{start:d,stop:p===d?d+n:p,step:n}},t.bootstrapCI=function(e,o,u,a){if(!e.length)return[void 0,void 0];var f,l,i,c,s=Float64Array.from(r(e,a)),h=s.length,d=o;for(i=0,c=Array(d);it);let o,u=0,a=1,f=t.length,l=new Float64Array(f),i=e(t[0]),c=i,s=i+n;for(;a=s){for(c=(i+c)/2;u>1);ea;)t[e--]=t[u]}u=a,a=r}return t}(l,n+n/4):l},t.quantileLogNormal=g,t.quantileNormal=h,t.quantileUniform=x,t.quantiles=e,t.quartiles=o,t.randomInteger=function(n,r){null==r&&(r=n,n=0);var e,o,u,a={};return a.min=function(t){return arguments.length?(u=o-(e=t||0),a):e},a.max=function(t){return arguments.length?(u=(o=t||0)-e,a):o},a.sample=function(){return e+Math.floor(u*t.random())},a.pdf=function(t){return t===Math.floor(t)&&t>=e&&t=o?1:(n-e+1)/u},a.icdf=function(t){return t>=0&&t<=1?e-1+Math.floor(t*u):NaN},a.min(n).max(r)},t.randomKDE=function(n,r){var e=d(),o={},a=0;return o.data=function(t){return arguments.length?(n=t,a=t?t.length:0,o.bandwidth(r)):n},o.bandwidth=function(t){return arguments.length?(!(r=t)&&n&&(r=u(n)),o):r},o.sample=function(){return n[~~(t.random()*a)]+r*e.sample()},o.pdf=function(t){for(var o=0,u=0;up(r,e),pdf:t=>m(t,r,e),cdf:t=>M(t,r,e),icdf:t=>g(t,r,e)};return o.mean(t).stdev(n)},t.randomMixture=function(n,r){var e,o={},u=0;function a(t){var n,r=[],e=0;for(n=0;nv(r,e),pdf:t=>b(t,r,e),cdf:t=>w(t,r,e),icdf:t=>x(t,r,e)};return null==n&&(n=null==t?1:t,t=0),o.min(t).max(n)},t.regressionExp=function(t,n,r){const[e,o,u,a]=N(t,n,r);let f,l,i,c=0,s=0,h=0,d=0,p=0;q(t,n,r,(t,n)=>{f=e[p++],l=Math.log(n),i=f*n,c+=(n*l-c)/p,s+=(i-s)/p,h+=(i*l-h)/p,d+=(f*i-d)/p});const[m,M]=y(s/a,c/a,h/a,d/a),g=t=>Math.exp(m+M*(t-u));return{coef:[Math.exp(m-M*u),M],predict:g,rSquared:A(t,n,r,a,g)}},t.regressionLinear=F,t.regressionLoess=function(t,r,e,o){const[u,a,f,l]=N(t,r,e,!0),i=u.length,c=Math.max(2,~~(o*i)),s=new Float64Array(i),h=new Float64Array(i),d=new Float64Array(i).fill(1);for(let t=-1;++t<=2;){const r=[0,c-1];for(let t=0;tu[o]-n?e:o;let l=0,i=0,c=0,p=0,m=0,M=1/Math.abs(u[f]-n||1);for(let t=e;t<=o;++t){const r=u[t],e=a[t],o=E(Math.abs(n-r)*M)*d[t],f=r*o;l+=o,i+=f,c+=e*o,p+=e*f,m+=r*f}const[g,v]=y(i/l,c/l,p/l,m/l);s[t]=g+v*n,h[t]=Math.abs(a[t]-s[t]),P(u,t+1,r)}if(2===t)break;const e=n.median(h);if(Math.abs(e)<1e-12)break;for(let t,n,r=0;r=1?1e-12:(n=1-t*t)*n}return function(t,n,r,e){const o=t.length,u=[];let a,f=0,l=0,i=[];for(;f{++f,t=Math.log(t),e+=(t-e)/f,o+=(n-o)/f,u+=(t*n-u)/f,a+=(t*t-a)/f});const l=y(e,o,u,a),i=t=>l[0]+l[1]*Math.log(t);return{coef:l,predict:i,rSquared:A(t,n,r,o,i)}},t.regressionPoly=function(t,n,r,e){if(1===e)return F(t,n,r);if(2===e)return L(t,n,r);const[o,u,a,f]=N(t,n,r),l=o.length,i=[],c=[],s=e+1;let h,d,p,m,M;for(h=0;hMath.abs(t[e][a])&&(a=o);for(u=e;u=e;u--)t[u][o]-=t[u][e]*t[e][o]/t[e][e]}for(o=n-1;o>=0;--o){for(f=0,u=o+1;u{t-=a;let n=f+g[0]+g[1]*t+g[2]*t*t;for(h=3;h{const r=Math.log(t),i=Math.log(n);++l,e+=(r-e)/l,o+=(i-o)/l,u+=(r*i-u)/l,a+=(r*r-a)/l,f+=(n-f)/l});const i=y(e,o,u,a),c=t=>i[0]*Math.pow(t,i[1]);return i[0]=Math.exp(i[0]),{coef:i,predict:c,rSquared:A(t,n,r,f,c)}},t.regressionQuad=L,t.sampleCurve=function(t,n,r,e){r=r||25,e=Math.max(r,e||200);const o=n=>[n,t(n)],u=n[0],a=n[1],f=a-u,l=f/e,i=[o(u)],c=[];if(r===e){for(let t=1;t0;)c.push(o(u+t/r*f));let s=i[0],h=c[c.length-1];for(;h;){const t=o((s[0]+h[0])/2);t[0]-s[0]>=l&&I(s,t,h)>U?c.push(t):(s=h,i.push(h),c.pop()),h=c[c.length-1]}return i},t.sampleLogNormal=p,t.sampleNormal=i,t.sampleUniform=v,t.setRandom=function(n){t.random=n},Object.defineProperty(t,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-statistics/index.js b/node_modules/vega-statistics/index.js deleted file mode 100644 index fc75217..0000000 --- a/node_modules/vega-statistics/index.js +++ /dev/null @@ -1,40 +0,0 @@ -export {default as bandwidthNRD} from './src/bandwidth'; -export {default as bin} from './src/bin'; -export {default as bootstrapCI} from './src/bootstrapCI'; -export {default as dotbin} from './src/dotbin'; -export {default as quantiles} from './src/quantiles'; -export {default as quartiles} from './src/quartiles'; -export {random, setRandom} from './src/random'; -export {default as randomLCG} from './src/lcg'; -export {default as randomInteger} from './src/integer'; -export {default as randomKDE} from './src/kde'; -export { - default as randomLogNormal, - sampleLogNormal, - densityLogNormal, - cumulativeLogNormal, - quantileLogNormal -} from './src/lognormal'; -export {default as randomMixture} from './src/mixture'; -export { - default as randomNormal, - sampleNormal, - densityNormal, - cumulativeNormal, - quantileNormal -} from './src/normal'; -export { - default as randomUniform, - sampleUniform, - densityUniform, - cumulativeUniform, - quantileUniform -} from './src/uniform'; -export {default as regressionLinear} from './src/regression/linear'; -export {default as regressionLog} from './src/regression/log'; -export {default as regressionExp} from './src/regression/exp'; -export {default as regressionPow} from './src/regression/pow'; -export {default as regressionQuad} from './src/regression/quad'; -export {default as regressionPoly} from './src/regression/poly'; -export {default as regressionLoess} from './src/regression/loess'; -export {default as sampleCurve} from './src/sampleCurve'; diff --git a/node_modules/vega-statistics/package.json b/node_modules/vega-statistics/package.json deleted file mode 100644 index 095498e..0000000 --- a/node_modules/vega-statistics/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "_from": "vega-statistics@~1.7.6", - "_id": "vega-statistics@1.7.6", - "_inBundle": false, - "_integrity": "sha512-w6z5t4p1zYNSvsg3lln4TZakxXlH/tM0w5WAP1EXLYrCYRw0F/SvxqLQ+WqEZVnI/WGQDq2v5xMAn0WvHJ/kUg==", - "_location": "/vega-statistics", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-statistics@~1.7.6", - "name": "vega-statistics", - "escapedName": "vega-statistics", - "rawSpec": "~1.7.6", - "saveSpec": null, - "fetchSpec": "~1.7.6" - }, - "_requiredBy": [ - "/vega", - "/vega-functions", - "/vega-geo", - "/vega-regression", - "/vega-transforms", - "/vega-wordcloud" - ], - "_resolved": "https://registry.npmjs.org/vega-statistics/-/vega-statistics-1.7.6.tgz", - "_shasum": "6f920c83adbec9a25087ca60c41af272838f85bd", - "_spec": "vega-statistics@~1.7.6", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "^2.4.0" - }, - "deprecated": false, - "description": "Statistical routines and probability distributions.", - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "statistics", - "probability", - "distribution" - ], - "license": "BSD-3-Clause", - "main": "build/vega-statistics.js", - "module": "index", - "name": "vega-statistics", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-statistics.js -c -m -o build/vega-statistics.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g d3-array:d3 -f umd -n vega -o build/vega-statistics.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "1.7.6" -} diff --git a/node_modules/vega-statistics/src/bandwidth.js b/node_modules/vega-statistics/src/bandwidth.js deleted file mode 100644 index 6a4acf5..0000000 --- a/node_modules/vega-statistics/src/bandwidth.js +++ /dev/null @@ -1,15 +0,0 @@ -import quartiles from './quartiles'; -import {deviation} from 'd3-array'; - -// Scott, D. W. (1992) Multivariate Density Estimation: -// Theory, Practice, and Visualization. Wiley. -export default function(array, f) { - var n = array.length, - v = deviation(array, f), - q = quartiles(array, f), - h = (q[2] - q[0]) / 1.34; - - v = Math.min(v, h) || v || Math.abs(q[0]) || 1; - - return 1.06 * v * Math.pow(n, -0.2); -} diff --git a/node_modules/vega-statistics/src/bin.js b/node_modules/vega-statistics/src/bin.js deleted file mode 100644 index c75ee95..0000000 --- a/node_modules/vega-statistics/src/bin.js +++ /dev/null @@ -1,54 +0,0 @@ -export default function(_) { - // determine range - var maxb = _.maxbins || 20, - base = _.base || 10, - logb = Math.log(base), - div = _.divide || [5, 2], - min = _.extent[0], - max = _.extent[1], - span = _.span || (max - min) || Math.abs(min) || 1, - step, level, minstep, precision, v, i, n, eps; - - if (_.step) { - // if step size is explicitly given, use that - step = _.step; - } else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - for (i=0, n=_.steps.length; i < n && _.steps[i] < v; ++i); - step = _.steps[Math.max(0, i-1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max( - minstep, - Math.pow(base, Math.round(Math.log(span) / logb) - level) - ); - - // increase step size if too many bins - while (Math.ceil(span/step) > maxb) { step *= base; } - - // decrease step size if allowed - for (i=0, n=div.length; i= minstep && span / v <= maxb) step = v; - } - } - - // update precision, min and max - v = Math.log(step); - precision = v >= 0 ? 0 : ~~(-v / logb) + 1; - eps = Math.pow(base, -precision - 1); - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; - } - - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; -} diff --git a/node_modules/vega-statistics/src/bootstrapCI.js b/node_modules/vega-statistics/src/bootstrapCI.js deleted file mode 100644 index 2cd0508..0000000 --- a/node_modules/vega-statistics/src/bootstrapCI.js +++ /dev/null @@ -1,26 +0,0 @@ -import numbers from './numbers'; -import {random} from './random'; -import {ascending, quantile} from 'd3-array'; - -export default function(array, samples, alpha, f) { - if (!array.length) return [undefined, undefined]; - - var values = Float64Array.from(numbers(array, f)), - n = values.length, - m = samples, - a, i, j, mu; - - for (j=0, mu=Array(m); j _); - - let i = 0, j = 1, - n = array.length, - v = new Float64Array(n), - a = f(array[0]), - b = a, - w = a + step, - x; - - for (; j= w) { - b = (a + b) / 2; - for (; i> 1); - while (d < b) v[d++] = v[b]; - while (d > b) v[d--] = v[a]; - } - - // update left stack indices - a = b; - b = c; - } - - return v; -} diff --git a/node_modules/vega-statistics/src/integer.js b/node_modules/vega-statistics/src/integer.js deleted file mode 100644 index 89f30b9..0000000 --- a/node_modules/vega-statistics/src/integer.js +++ /dev/null @@ -1,50 +0,0 @@ -import {random} from './random'; - -export default function(min, max) { - if (max == null) { - max = min; - min = 0; - } - - var dist = {}, - a, b, d; - - dist.min = function(_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else { - return a; - } - }; - - dist.max = function(_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else { - return b; - } - }; - - dist.sample = function() { - return a + Math.floor(d * random()); - }; - - dist.pdf = function(x) { - return (x === Math.floor(x) && x >= a && x < b) ? 1 / d : 0; - }; - - dist.cdf = function(x) { - var v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }; - - dist.icdf = function(p) { - return (p >= 0 && p <= 1) ? a - 1 + Math.floor(p * d) : NaN; - }; - - return dist.min(min).max(max); -} diff --git a/node_modules/vega-statistics/src/kde.js b/node_modules/vega-statistics/src/kde.js deleted file mode 100644 index 12f1a6b..0000000 --- a/node_modules/vega-statistics/src/kde.js +++ /dev/null @@ -1,51 +0,0 @@ -import estimateBandwidth from './bandwidth'; -import gaussian from './normal'; -import {random} from './random'; - -// TODO: support for additional kernels? -export default function(support, bandwidth) { - var kernel = gaussian(), - dist = {}, - n = 0; - - dist.data = function(_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else { - return support; - } - }; - - dist.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = estimateBandwidth(support); - return dist; - }; - - dist.sample = function() { - return support[~~(random() * n)] + bandwidth * kernel.sample(); - }; - - dist.pdf = function(x) { - for (var y=0, i=0; i sampleLogNormal(mu, sigma), - pdf: value => densityLogNormal(value, mu, sigma), - cdf: value => cumulativeLogNormal(value, mu, sigma), - icdf: p => quantileLogNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); -} diff --git a/node_modules/vega-statistics/src/mixture.js b/node_modules/vega-statistics/src/mixture.js deleted file mode 100644 index 8f7c91e..0000000 --- a/node_modules/vega-statistics/src/mixture.js +++ /dev/null @@ -1,68 +0,0 @@ -import {random} from './random'; - -export default function(dists, weights) { - var dist = {}, m = 0, w; - - function normalize(x) { - var w = [], sum = 0, i; - for (i=0; i 1); - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - x *= c; - nextSample = y * c; - } - return mean + x * stdev; -} - -export function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - const z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); -} - -// Approximation from West (2009) -// Better Approximations to Cumulative Normal Functions -export function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - - let cd, - z = (value - mean) / stdev, - Z = Math.abs(z); - - if (Z > 37) { - cd = 0; - } else { - let sum, exp = Math.exp(-Z * Z / 2); - if (Z < 7.07106781186547) { - sum = 3.52624965998911e-02 * Z + 0.700383064443688; - sum = sum * Z + 6.37396220353165; - sum = sum * Z + 33.912866078383; - sum = sum * Z + 112.079291497871; - sum = sum * Z + 221.213596169931; - sum = sum * Z + 220.206867912376; - cd = exp * sum; - sum = 8.83883476483184e-02 * Z + 1.75566716318264; - sum = sum * Z + 16.064177579207; - sum = sum * Z + 86.7807322029461; - sum = sum * Z + 296.564248779674; - sum = sum * Z + 637.333633378831; - sum = sum * Z + 793.826512519948; - sum = sum * Z + 440.413735824752; - cd = cd / sum; - } else { - sum = Z + 0.65; - sum = Z + 4 / sum; - sum = Z + 3 / sum; - sum = Z + 2 / sum; - sum = Z + 1 / sum; - cd = exp / sum / 2.506628274631; - } - } - return z > 0 ? 1 - cd : cd; -} - -// Approximation of Probit function using inverse error function. -export function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); -} - -// Approximate inverse error function. Implementation from "Approximating -// the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. -// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 -function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - let w = - Math.log((1 - x) * (1 + x)), p; - - if (w < 6.25) { - w -= 3.125; - p = -3.6444120640178196996e-21; - p = -1.685059138182016589e-19 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -1.333171662854620906e-16 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -4.0545662729752068639e-14 + p * w; - p = -8.1519341976054721522e-14 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -1.2975133253453532498e-11 + p * w; - p = -5.4154120542946279317e-11 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -4.1126339803469836976e-09 + p * w; - p = -2.9070369957882005086e-08 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -1.3654692000834678645e-06 + p * w; - p = -1.3882523362786468719e-05 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.00074070253416626697512 + p * w; - p = -0.0060336708714301490533 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -2.7517406297064545428e-07 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -4.013867526981545969e-06 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -4.7318229009055733981e-05 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628474796 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047313 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.0037512085075692412107 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -2.7109920616438573243e-11; - p = -2.5556418169965252055e-10 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -3.7894654401267369937e-09 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -1.4960026627149240478e-08 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -6.7711997758452339498e-08 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -9.9298272942317002539e-07 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -1.9681778105531670567e-05 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477347 + p * w; - p = -0.00013871931833623122026 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else { - p = Infinity; - } - - return p * x; -} - -export default function(mean, stdev) { - var mu, - sigma, - dist = { - mean: function(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: () => sampleNormal(mu, sigma), - pdf: value => densityNormal(value, mu, sigma), - cdf: value => cumulativeNormal(value, mu, sigma), - icdf: p => quantileNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); -} diff --git a/node_modules/vega-statistics/src/numbers.js b/node_modules/vega-statistics/src/numbers.js deleted file mode 100644 index 8e3b68a..0000000 --- a/node_modules/vega-statistics/src/numbers.js +++ /dev/null @@ -1,17 +0,0 @@ -export default function*(values, valueof) { - if (valueof == null) { - for (let value of values) { - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - value = valueof(value, ++index, values); - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } -} diff --git a/node_modules/vega-statistics/src/quantiles.js b/node_modules/vega-statistics/src/quantiles.js deleted file mode 100644 index bda0596..0000000 --- a/node_modules/vega-statistics/src/quantiles.js +++ /dev/null @@ -1,12 +0,0 @@ -import numbers from './numbers'; -import {ascending, quantileSorted} from 'd3-array'; - -export default function(array, p, f) { - var values = Float64Array.from(numbers(array, f)); - - // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - values.sort(ascending); - - return p.map(_ => quantileSorted(values, _)); -} diff --git a/node_modules/vega-statistics/src/quartiles.js b/node_modules/vega-statistics/src/quartiles.js deleted file mode 100644 index a031ddd..0000000 --- a/node_modules/vega-statistics/src/quartiles.js +++ /dev/null @@ -1,5 +0,0 @@ -import quantiles from './quantiles'; - -export default function(array, f) { - return quantiles(array, [0.25, 0.50, 0.75], f); -} diff --git a/node_modules/vega-statistics/src/random.js b/node_modules/vega-statistics/src/random.js deleted file mode 100644 index 01712ce..0000000 --- a/node_modules/vega-statistics/src/random.js +++ /dev/null @@ -1,5 +0,0 @@ -export var random = Math.random; - -export function setRandom(r) { - random = r; -} diff --git a/node_modules/vega-statistics/src/regression/exp.js b/node_modules/vega-statistics/src/regression/exp.js deleted file mode 100644 index 1562b42..0000000 --- a/node_modules/vega-statistics/src/regression/exp.js +++ /dev/null @@ -1,29 +0,0 @@ -import ols from './ols'; -import {points, visitPoints} from './points'; -import rSquared from './r-squared'; - -export default function(data, x, y) { - // eslint-disable-next-line no-unused-vars - const [xv, yv, ux, uy] = points(data, x, y); - let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly, xy; - - visitPoints(data, x, y, (_, dy) => { - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - - const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), - predict = x => Math.exp(c0 + c1 * (x - ux)); - - return { - coef: [Math.exp(c0 - c1 * ux), c1], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} diff --git a/node_modules/vega-statistics/src/regression/linear.js b/node_modules/vega-statistics/src/regression/linear.js deleted file mode 100644 index 7d65749..0000000 --- a/node_modules/vega-statistics/src/regression/linear.js +++ /dev/null @@ -1,26 +0,0 @@ -import ols from './ols'; -import {visitPoints} from './points'; -import rSquared from './r-squared'; - -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -export default function(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * x; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} diff --git a/node_modules/vega-statistics/src/regression/loess.js b/node_modules/vega-statistics/src/regression/loess.js deleted file mode 100644 index 7110e0a..0000000 --- a/node_modules/vega-statistics/src/regression/loess.js +++ /dev/null @@ -1,114 +0,0 @@ -import ols from './ols'; -import {points} from './points'; -import {median} from 'd3-array'; - -const maxiters = 2, - epsilon = 1e-12; - -// Adapted from science.js by Jason Davies -// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js -// License: https://github.com/jasondavies/science.js/blob/master/LICENSE -export default function(data, x, y, bandwidth) { - const [xv, yv, ux, uy] = points(data, x, y, true), - n = xv.length, - bw = Math.max(2, ~~(bandwidth * n)), // # nearest neighbors - yhat = new Float64Array(n), - residuals = new Float64Array(n), - robustWeights = new Float64Array(n).fill(1); - - for (let iter = -1; ++iter <= maxiters; ) { - const interval = [0, bw - 1]; - - for (let i = 0; i < n; ++i) { - const dx = xv[i], - i0 = interval[0], - i1 = interval[1], - edge = (dx - xv[i0]) > (xv[i1] - dx) ? i0 : i1; - - let W = 0, X = 0, Y = 0, XY = 0, X2 = 0, - denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - - for (let k = i0; k <= i1; ++k) { - const xk = xv[k], - yk = yv[k], - w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], - xkw = xk * w; - - W += w; - X += xkw; - Y += yk * w; - XY += yk * xkw; - X2 += xk * xkw; - } - - // linear regression fit - const [a, b] = ols(X / W, Y / W, XY / W, X2 / W); - yhat[i] = a + b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - - updateInterval(xv, i + 1, interval); - } - - if (iter === maxiters) { - break; - } - - const medianResidual = median(residuals); - if (Math.abs(medianResidual) < epsilon) break; - - for (let i = 0, arg, w; i < n; ++i){ - arg = residuals[i] / (6 * medianResidual); - // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - robustWeights[i] = (arg >= 1) ? epsilon : ((w = 1 - arg * arg) * w); - } - } - - return output(xv, yhat, ux, uy); -} - -// weighting kernel for local regression -function tricube(x) { - return (x = 1 - x * x * x) * x * x; -} - -// advance sliding window interval of nearest neighbors -function updateInterval(xv, i, interval) { - let val = xv[i], - left = interval[0], - right = interval[1] + 1; - - if (right >= xv.length) return; - - // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - while (i > left && (xv[right] - val) <= (val - xv[left])) { - interval[0] = ++left; - interval[1] = right; - ++right; - } -} - -// generate smoothed output points -// average points with repeated x values -function output(xv, yhat, ux, uy) { - const n = xv.length, out = []; - let i = 0, cnt = 0, prev = [], v; - - for (; i { - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * Math.log(x); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} diff --git a/node_modules/vega-statistics/src/regression/ols.js b/node_modules/vega-statistics/src/regression/ols.js deleted file mode 100644 index e26f1f7..0000000 --- a/node_modules/vega-statistics/src/regression/ols.js +++ /dev/null @@ -1,8 +0,0 @@ -// Ordinary Least Squares -export default function(uX, uY, uXY, uX2) { - const delta = uX2 - uX * uX, - slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, - intercept = uY - slope * uX; - - return [intercept, slope]; -} diff --git a/node_modules/vega-statistics/src/regression/points.js b/node_modules/vega-statistics/src/regression/points.js deleted file mode 100644 index 31c2a64..0000000 --- a/node_modules/vega-statistics/src/regression/points.js +++ /dev/null @@ -1,44 +0,0 @@ -export function points(data, x, y, sort) { - data = data.filter(d => { - let u = x(d), v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - - if (sort) { - data.sort((a, b) => x(a) - x(b)); - } - - const n = data.length, - X = new Float64Array(n), - Y = new Float64Array(n); - - // extract values, calculate means - let i = 0, ux = 0, uy = 0, xv, yv, d; - for (d of data) { - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } - - // mean center the data - for (i=0; i= u && v != null && (v = +v) >= v) { - callback(u, v, ++i); - } - } -} diff --git a/node_modules/vega-statistics/src/regression/poly.js b/node_modules/vega-statistics/src/regression/poly.js deleted file mode 100644 index 34b5e18..0000000 --- a/node_modules/vega-statistics/src/regression/poly.js +++ /dev/null @@ -1,118 +0,0 @@ -import linear from './linear'; -import {points} from './points'; -import quad from './quad'; -import rSquared from './r-squared'; - -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -// ... which was adapted from regression-js by Tom Alexander -// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 -// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE -export default function(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 1) return linear(data, x, y); - if (order === 2) return quad(data, x, y); - - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length, - lhs = [], - rhs = [], - k = order + 1; - - let i, j, l, v, c; - - for (i=0; i { - x -= ux; - let y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - for (i=3; i=0; --i) { - v = a[i]; - c = 1; - z[i] += v; - for (j=1; j<=i; ++j) { - c *= (i + 1 - j) / j; // binomial coefficent - z[i-j] += v * Math.pow(x, j) * c; - } - } - - // bias term - z[0] += y; - - return z; -} - -// Given an array for a two-dimensional matrix and the polynomial order, -// solve A * x = b using Gaussian elimination. -function gaussianElimination(matrix) { - const n = matrix.length - 1, - coef = []; - - let i, j, k, r, t; - - for (i = 0; i < n; ++i) { - r = i; // max row - for (j = i + 1; j < n; ++j) { - if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { - r = j; - } - } - - for (k = i; k < n + 1; ++k) { - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - - for (j = i + 1; j < n; ++j) { - for (k = n; k >= i; k--) { - matrix[k][j] -= (matrix[k][i] * matrix[i][j]) / matrix[i][i]; - } - } - } - - for (j = n - 1; j >= 0; --j) { - t = 0; - for (k = j + 1; k < n; ++k) { - t += matrix[k][j] * coef[k]; - } - coef[j] = (matrix[n][j] - t) / matrix[j][j]; - } - - return coef; -} \ No newline at end of file diff --git a/node_modules/vega-statistics/src/regression/pow.js b/node_modules/vega-statistics/src/regression/pow.js deleted file mode 100644 index a44e55d..0000000 --- a/node_modules/vega-statistics/src/regression/pow.js +++ /dev/null @@ -1,31 +0,0 @@ -import ols from './ols'; -import {visitPoints} from './points'; -import rSquared from './r-squared'; - -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -export default function(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, YS = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - const lx = Math.log(dx), - ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] * Math.pow(x, coef[1]); - - coef[0] = Math.exp(coef[0]); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; -} \ No newline at end of file diff --git a/node_modules/vega-statistics/src/regression/quad.js b/node_modules/vega-statistics/src/regression/quad.js deleted file mode 100644 index 0ab3717..0000000 --- a/node_modules/vega-statistics/src/regression/quad.js +++ /dev/null @@ -1,42 +0,0 @@ -import {points} from './points'; -import rSquared from './r-squared'; - -export default function(data, x, y) { - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length; - - let X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, - i, dx, dy, x2; - - for (i=0; i { - x = x - ux; - return a * x * x + b * x + c + uy; - }; - - // transform coefficients back from mean-centered space - return { - coef: [ - c - b * ux + a * ux * ux + uy, - b - 2 * a * ux, - a - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} diff --git a/node_modules/vega-statistics/src/regression/r-squared.js b/node_modules/vega-statistics/src/regression/r-squared.js deleted file mode 100644 index fa1f6e0..0000000 --- a/node_modules/vega-statistics/src/regression/r-squared.js +++ /dev/null @@ -1,17 +0,0 @@ -import {visitPoints} from './points'; - -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -export default function(data, x, y, uY, predict) { - let SSE = 0, SST = 0; - - visitPoints(data, x, y, (dx, dy) => { - const sse = dy - predict(dx), - sst = dy - uY; - - SSE += sse * sse; - SST += sst * sst; - }); - - return 1 - SSE / SST; -} diff --git a/node_modules/vega-statistics/src/sampleCurve.js b/node_modules/vega-statistics/src/sampleCurve.js deleted file mode 100644 index f7f0d59..0000000 --- a/node_modules/vega-statistics/src/sampleCurve.js +++ /dev/null @@ -1,62 +0,0 @@ -// subdivide up to accuracy of 0.1 degrees -const MIN_RADIANS = 0.1 * Math.PI / 180; - -// Adaptively sample an interpolated function over a domain extent -export default function(f, extent, minSteps, maxSteps) { - minSteps = minSteps || 25; - maxSteps = Math.max(minSteps, maxSteps || 200); - - const point = x => [x, f(x)], - minX = extent[0], - maxX = extent[1], - span = maxX - minX, - stop = span / maxSteps, - prev = [point(minX)], - next = []; - - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for (let i = 1; i < maxSteps; ++i) { - prev.push(point(minX + (i / minSteps) * span)); - } - prev.push(point(maxX)); - return prev; - } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - for (let i = minSteps; --i > 0;) { - next.push(point(minX + (i / minSteps) * span)); - } - } - - let p0 = prev[0], - p1 = next[next.length - 1]; - - while (p1) { - // midpoint for potential curve subdivision - const pm = point((p0[0] + p1[0]) / 2); - - if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) { - // maximum resolution has not yet been met, and - // subdivision midpoint sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - } else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - p1 = next[next.length - 1]; - } - - return prev; -} - -function angleDelta(p, q, r) { - const a0 = Math.atan2(r[1] - p[1], r[0] - p[0]), - a1 = Math.atan2(q[1] - p[1], q[0] - p[0]); - return Math.abs(a0 - a1); -} diff --git a/node_modules/vega-statistics/src/uniform.js b/node_modules/vega-statistics/src/uniform.js deleted file mode 100644 index 21b08d6..0000000 --- a/node_modules/vega-statistics/src/uniform.js +++ /dev/null @@ -1,65 +0,0 @@ -import {random} from './random'; - -export function sampleUniform(min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return min + (max - min) * random(); -} - -export function densityUniform(value, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return (value >= min && value <= max) ? 1 / (max - min) : 0; -} - -export function cumulativeUniform(value, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); -} - -export function quantileUniform(p, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return (p >= 0 && p <= 1) ? min + p * (max - min) : NaN; -} - -export default function(min, max) { - var a, b, - dist = { - min: function(_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else { - return a; - } - }, - max: function(_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else { - return b; - } - }, - sample: () => sampleUniform(a, b), - pdf: value => densityUniform(value, a, b), - cdf: value => cumulativeUniform(value, a, b), - icdf: p => quantileUniform(p, a, b) - }; - - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return dist.min(min).max(max); -} diff --git a/node_modules/vega-time/LICENSE b/node_modules/vega-time/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-time/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-time/README.md b/node_modules/vega-time/README.md deleted file mode 100644 index c4c5edd..0000000 --- a/node_modules/vega-time/README.md +++ /dev/null @@ -1,148 +0,0 @@ -# vega-time - -JavaScript date-time utilities for Vega. Provides a set of helper methods for working with date objects (or, equivalently, with [UNIX timestamps](https://en.wikipedia.org/wiki/Unix_time)). - -## API Reference - -- [Time Units](#time-units) -- [Local Time Utilities](#local-time-utilities) -- [UTC Time Utilities](#utc-time-utilities) - -### Time Units - -The date-time utilities support a set of pre-defined time units. A single _unit_ value is one of the following strings: - -- `'year'` - [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian_calendar) years. -- `'quarter'` - Three-month intervals, starting in one of January, April, July, and October. -- `'month'` - Calendar months (January, February, _etc._). -- `'date'` - Calendar day of the month (January 1, January 2, _etc._). -- `'week'` - Sunday-based weeks. Days before the first Sunday of the year are considered to be in week 0, the first Sunday of the year is the start of week 1, the second Sunday week 2, _etc._. -- `'day'` - Day of the week (Sunday, Monday, _etc._). -- `'dayofyear'` - Day of the year (1, 2, ..., 365, _etc._). -- `'hours'` - Hours of the day (12:00am, 1:00am, _etc_.). -- `'minutes'` - Minutes in an hour (12:00, 12:01, _etc_.). -- `'seconds'` - Seconds in a minute (12:00:00, 12:00:01, _etc_.). -- `'milliseconds'` - Milliseconds in a second. - -Multiple _units_ can be listed in an array to indicate desired intervals of time. For example, `['year', 'month', 'date']` indicates chronological time sensitive to year, month, and date (but not to hours, minutes, or seconds). The specifier `['month', 'date']` is sensitive to month and date, but not year, which can be useful for binning time values to look at seasonal patterns only. - -# -vega.timeUnits(units) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/units.js "Source") - -Returns a standardized and sorted specifier for the given _units_, which must be an array of one or more valid time unit strings. The returned array contains the same units, sorted in decreasing over of unit size, such that the most granular unit is last (for example, `['year', 'month', 'date']`). This method throws an error if the _units_ array is empty, contains an invalid unit, or contains incompatible units. Specifically, the `'quarter'`, `'month'`, and `'date'` units can not be used in conjunction with the `'week'` or `'day'` units. - -# -vega.timeUnitSpecifier(units[, specifiers]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/format.js "Source") - -Returns a time format specifier string for the given time _units_. The optional _specifiers_ object provides a set of desired specifier sub-strings for customizing the resulting time formats. The _specifiers_ object may contain keys for both single time units (`"year"`) and time unit sequences (`"year-month-date"`). This method will first standardize the input time units using the [timeUnits](#timeUnits) method. It will then search, starting from the beginning of the units array, for the largest matching sequence defined in the specifiers object. Matching entries are then concatenated together, and the resulting string is whitespace-trimmed and returned. - -If no _specifiers_ object is provided, the following defaults are used: - -```json -{ - "year": "%Y ", - "year-month": "%Y-%m ", - "year-month-date": "%Y-%m-%d ", - "quarter": "Q%q ", - "month": "%b ", - "date": "%d ", - "week": "W%U ", - "day": "%a ", - "hours": "%H:00", - "hours-minutes": "%H:%M", - "minutes": "00:%M", - "seconds": ":%S", - "milliseconds": ".%L" -} -``` - -If a _specifiers_ object is provided, its values are merged with the defaults above. As a result, for complete control callees may wish to override the multi-unit `"year-month"`, `"year-month-date"`, and `"hours-minutes"` entries in addition to any individual unit entries. The input _specifiers_ object can use a `null` value to invalidate an entry in the defaults. - -# -vega.timeBin(options) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/bin.js "Source") - -Determine a temporal binning scheme, for example to create a histogram. Based on the options provided given, this method will search over a space of possible time unit bins, applying constraints such as the maximum number of allowable bins. Given a set of options (see below), returns an object describing the binning scheme, in terms of `units` and `step` properties. These values can then be used as input to the [timeFloor](#timeFloor) or [utcFloor](#utcFloor) methods. - -The supported options properties are: - -- _extent_: (required) A two-element (`[min, max]`) array indicating the date range over which the bin values are defined. -- _maxbins_: The maximum number of allowable bins (default `40`). - -### Local Time Utilities - -# -vega.timeFloor(units[, step]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/floor.js "Source") - -Returns a function that performs flooring (truncation) of input dates to given time _units_ in the local timezone. The _units_ argument must be an array of valid time unit strings, for example `['year', 'month']` or `['week', 'date']`. The optional _step_ argument (default 1) indicates the number of time unit steps (of the smallest provided unit) to include as part of the truncation scheme. For example, `utcFloor(['quarter'])` is equivalent to `utcFloor(['month'], 3)`. - -# -vega.timeInterval(unit) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/interval.js "Source") - -Returns a [d3-time interval](https://github.com/d3/d3-time#_interval) for the given time _unit_ in the local timezone. - -# -vega.timeOffset(unit, date[, step]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/interval.js "Source") - -Returns a new Date instance that offsets the given _date_ by the specified time _unit_ in the local timezone. The optional _step_ argument indicates the number of time unit steps to offset by (default 1). - -# -vega.timeSequence(unit, start, stop[, step]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/interval.js "Source") - -Returns an array of Date instances from _start_ (inclusive) to _stop_ (exclusive), with each entry separated by the given time _unit_ in the local timezone. The optional _step_ argument indicates the number of time unit steps to take between each sequence entry (default 1). - -# -vega.dayofyear(date) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/util.js "Source") - -Returns the one-based day of the year for the given _date_, which should be either a `Date` object or timestamp value. - -# -vega.week(date) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/util.js "Source") - -Returns the week number of the year for the given _date_, which should be either a `Date` object or timestamp value. This function assumes Sunday-based weeks. Days before the first Sunday of the year are considered to be in week 0, the first Sunday of the year is the start of week 1, the second Sunday week 2, _etc._. - -### UTC Time Utilities - -# -vega.utcFloor(units[, step]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/floor.js "Source") - -Returns a function that performs flooring (truncation) of input dates to given time _units_ in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC). The _units_ argument must be an array of valid time unit strings, for example `['year', 'month']` or `['week', 'date']`. The optional _step_ argument (default 1) indicates the number of time unit steps (of the smallest provided unit) to include as part of the truncation scheme. For example, `utcFloor(['quarter'])` is equivalent to `utcFloor(['month'], 3)`. - -# -vega.utcInterval(unit) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/interval.js "Source") - -Returns a [d3-time interval](https://github.com/d3/d3-time#_interval) for the given time _unit_ in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC). - -# -vega.utcOffset(unit, date[, step]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/interval.js "Source") - -Returns a new Date instance that offsets the given _date_ by the specified time _unit_ in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC). The optional _step_ argument indicates the number of time unit steps to offset by (default 1). - -# -vega.utcSequence(unit, start, stop[, step]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/interval.js "Source") - -Returns an array of Date instances from _start_ (inclusive) to _stop_ (exclusive), with each entry separated by the given time _unit_ in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC). The optional _step_ argument indicates the number of time unit steps to take between each sequence entry (default 1). - -# -vega.utcdayofyear(date) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/util.js "Source") - -Returns the one-based day of the year for the given _date_ in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC), which should be either a `Date` object or timestamp value. - -# -vega.utcweek(date) -[<>](https://github.com/vega/vega/blob/master/packages/vega-time/src/util.js "Source") - -Returns the week number of the year for the given _date_ in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC), which should be either a `Date` object or timestamp value. This function assumes Sunday-based weeks. Days before the first Sunday of the year are considered to be in week 0, the first Sunday of the year is the start of week 1, the second Sunday week 2, _etc._. diff --git a/node_modules/vega-time/build/vega-time.js b/node_modules/vega-time/build/vega-time.js deleted file mode 100644 index 83c1a95..0000000 --- a/node_modules/vega-time/build/vega-time.js +++ /dev/null @@ -1,422 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('d3-time'), require('d3-array')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'd3-time', 'd3-array'], factory) : - (global = global || self, factory(global.vega = {}, global.vega, global.d3, global.d3)); -}(this, (function (exports, vegaUtil, d3Time, d3Array) { 'use strict'; - - const YEAR = 'year'; - const QUARTER = 'quarter'; - const MONTH = 'month'; - const WEEK = 'week'; - const DATE = 'date'; - const DAY = 'day'; - const DAYOFYEAR = 'dayofyear'; - const HOURS = 'hours'; - const MINUTES = 'minutes'; - const SECONDS = 'seconds'; - const MILLISECONDS = 'milliseconds'; - - const TIME_UNITS = [ - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS - ]; - - const UNITS = TIME_UNITS.reduce((o, u, i) => (o[u] = 1 + i, o), {}); - - function timeUnits(units) { - const u = vegaUtil.array(units).slice(), - m = {}; - - // check validity - if (!u.length) vegaUtil.error('Missing time unit.'); - - u.forEach(unit => { - if (vegaUtil.hasOwnProperty(UNITS, unit)) { - m[unit] = 1; - } else { - vegaUtil.error(`Invalid time unit: ${unit}.`); - } - }); - - const numTypes = ( - (m[WEEK] || m[DAY] ? 1 : 0) + - (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + - (m[DAYOFYEAR] ? 1 : 0) - ); - - if (numTypes > 1) { - vegaUtil.error(`Incompatible time units: ${units}`); - } - - // ensure proper sort order - u.sort((a, b) => UNITS[a] - UNITS[b]); - - return u; - } - - const defaultSpecifiers = { - [YEAR]: '%Y ', - [QUARTER]: 'Q%q ', - [MONTH]: '%b ', - [DATE]: '%d ', - [WEEK]: 'W%U ', - [DAY]: '%a ', - [DAYOFYEAR]: '%j ', - [HOURS]: '%H:00', - [MINUTES]: '00:%M', - [SECONDS]: ':%S', - [MILLISECONDS]: '.%L', - [`${YEAR}-${MONTH}`]: '%Y-%m ', - [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ', - [`${HOURS}-${MINUTES}`]: '%H:%M' - }; - - function timeUnitSpecifier(units, specifiers) { - const s = vegaUtil.extend({}, defaultSpecifiers, specifiers), - u = timeUnits(units), - n = u.length; - - let fmt = '', start = 0, end, key; - - for (start=0; start start; --end) { - key = u.slice(start, end).join('-'); - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - } - - return fmt.trim(); - } - - const t0 = new Date; - - function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; - } - - function dayofyear(d) { - return localDayOfYear(new Date(d)); - } - - function week(d) { - return localWeekNum(new Date(d)); - } - - function localDayOfYear(d) { - return d3Time.timeDay.count(localYear(d.getFullYear()) - 1, d); - } - - function localWeekNum(d) { - return d3Time.timeWeek.count(localYear(d.getFullYear()) - 1, d); - } - - function localFirst(y) { - return localYear(y).getDay(); - } - - function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - return new Date(y, m, d, H, M, S, L); - } - - function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); - } - - function utcweek(d) { - return utcWeekNum(new Date(d)); - } - - function utcDayOfYear(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return d3Time.utcDay.count(y - 1, d); - } - - function utcWeekNum(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return d3Time.utcWeek.count(y - 1, d); - } - - function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); - } - - function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(y, m, d, H, M, S, L)); - } - - function floor(units, step, get, inv, newDate) { - const s = step || 1, - b = vegaUtil.peek(units), - _ = (unit, p, key) => { - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - - const t = new Date, - u = vegaUtil.toSet(units), - y = u[YEAR] ? _(YEAR) : vegaUtil.constant(2012), - m = u[MONTH] ? _(MONTH) - : u[QUARTER] ? _(QUARTER) - : vegaUtil.zero, - d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) - : u[WEEK] ? _(WEEK, 1) - : u[DAY] ? _(DAY, 1) - : u[DATE] ? _(DATE, 1) - : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) - : vegaUtil.one, - H = u[HOURS] ? _(HOURS) : vegaUtil.zero, - M = u[MINUTES] ? _(MINUTES) : vegaUtil.zero, - S = u[SECONDS] ? _(SECONDS) : vegaUtil.zero, - L = u[MILLISECONDS] ? _(MILLISECONDS) : vegaUtil.zero; - - return function(v) { - t.setTime(+v); - const year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; - } - - function getUnit(f, inv, step, phase) { - const u = step <= 1 ? f - : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) - : (d, y) => step * Math.floor(f(d, y) / step); - return inv ? (d, y) => inv(u(d, y), y) : u; - } - - // returns the day of the year based on week number, day of week, - // and the day of the week for the first day of the year - function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; - } - - // -- LOCAL TIME -- - - const localGet = { - [YEAR]: d => d.getFullYear(), - [QUARTER]: d => Math.floor(d.getMonth() / 3), - [MONTH]: d => d.getMonth(), - [DATE]: d => d.getDate(), - [HOURS]: d => d.getHours(), - [MINUTES]: d => d.getMinutes(), - [SECONDS]: d => d.getSeconds(), - [MILLISECONDS]: d => d.getMilliseconds(), - [DAYOFYEAR]: d => localDayOfYear(d), - [WEEK]: d => localWeekNum(d), - [WEEK + DAY]: (d, y) => weekday(localWeekNum(d), d.getDay(), localFirst(y)), - [DAY]: (d, y) => weekday(1, d.getDay(), localFirst(y)) - }; - - const localInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday(w, 0, localFirst(y)) - }; - - function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); - } - - // -- UTC TIME -- - - const utcGet = { - [YEAR]: d => d.getUTCFullYear(), - [QUARTER]: d => Math.floor(d.getUTCMonth() / 3), - [MONTH]: d => d.getUTCMonth(), - [DATE]: d => d.getUTCDate(), - [HOURS]: d => d.getUTCHours(), - [MINUTES]: d => d.getUTCMinutes(), - [SECONDS]: d => d.getUTCSeconds(), - [MILLISECONDS]: d => d.getUTCMilliseconds(), - [DAYOFYEAR]: d => utcDayOfYear(d), - [WEEK]: d => utcWeekNum(d), - [DAY]: (d, y) => weekday(1, d.getUTCDay(), utcFirst(y)), - [WEEK + DAY]: (d, y) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)) - }; - - const utcInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday(w, 0, utcFirst(y)) - }; - - function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); - } - - const timeIntervals = { - [YEAR]: d3Time.timeYear, - [QUARTER]: d3Time.timeMonth.every(3), - [MONTH]: d3Time.timeMonth, - [WEEK]: d3Time.timeWeek, - [DATE]: d3Time.timeDay, - [DAY]: d3Time.timeDay, - [DAYOFYEAR]: d3Time.timeDay, - [HOURS]: d3Time.timeHour, - [MINUTES]: d3Time.timeMinute, - [SECONDS]: d3Time.timeSecond, - [MILLISECONDS]: d3Time.timeMillisecond - }; - - const utcIntervals = { - [YEAR]: d3Time.utcYear, - [QUARTER]: d3Time.utcMonth.every(3), - [MONTH]: d3Time.utcMonth, - [WEEK]: d3Time.utcWeek, - [DATE]: d3Time.utcDay, - [DAY]: d3Time.utcDay, - [DAYOFYEAR]: d3Time.utcDay, - [HOURS]: d3Time.utcHour, - [MINUTES]: d3Time.utcMinute, - [SECONDS]: d3Time.utcSecond, - [MILLISECONDS]: d3Time.utcMillisecond - }; - - function timeInterval(unit) { - return timeIntervals[unit]; - } - - function utcInterval(unit) { - return utcIntervals[unit]; - } - - function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; - } - - function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); - } - - function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); - } - - function sequence(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; - } - - function timeSequence(unit, start, stop, step) { - return sequence(timeInterval(unit), start, stop, step); - } - - function utcSequence(unit, start, stop, step) { - return sequence(utcInterval(unit), start, stop, step); - } - - const durationSecond = 1000, - durationMinute = durationSecond * 60, - durationHour = durationMinute * 60, - durationDay = durationHour * 24, - durationWeek = durationDay * 7, - durationMonth = durationDay * 30, - durationYear = durationDay * 365; - - const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], - Seconds = Milli.slice(0, -1), - Minutes = Seconds.slice(0, -1), - Hours = Minutes.slice(0, -1), - Day = Hours.slice(0, -1), - Week = [YEAR, WEEK], - Month = [YEAR, MONTH], - Year = [YEAR]; - - const intervals = [ - [Seconds, 1, durationSecond], - [Seconds, 5, 5 * durationSecond], - [Seconds, 15, 15 * durationSecond], - [Seconds, 30, 30 * durationSecond], - [Minutes, 1, durationMinute], - [Minutes, 5, 5 * durationMinute], - [Minutes, 15, 15 * durationMinute], - [Minutes, 30, 30 * durationMinute], - [ Hours, 1, durationHour ], - [ Hours, 3, 3 * durationHour ], - [ Hours, 6, 6 * durationHour ], - [ Hours, 12, 12 * durationHour ], - [ Day, 1, durationDay ], - [ Week, 1, durationWeek ], - [ Month, 1, durationMonth ], - [ Month, 3, 3 * durationMonth ], - [ Year, 1, durationYear ] - ]; - - function bin(opt) { - const ext = opt.extent, - max = opt.maxbins || 40, - target = Math.abs(vegaUtil.span(ext)) / max; - - let i = d3Array.bisector(i => i[2]).right(intervals, target), - units, step; - - if (i === intervals.length) { - units = Year, - step = d3Array.tickStep(ext[0] / durationYear, ext[1] / durationYear, max); - } else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max(d3Array.tickStep(ext[0], ext[1], max), 1); - } - - return {units, step}; - } - - exports.DATE = DATE; - exports.DAY = DAY; - exports.DAYOFYEAR = DAYOFYEAR; - exports.HOURS = HOURS; - exports.MILLISECONDS = MILLISECONDS; - exports.MINUTES = MINUTES; - exports.MONTH = MONTH; - exports.QUARTER = QUARTER; - exports.SECONDS = SECONDS; - exports.TIME_UNITS = TIME_UNITS; - exports.WEEK = WEEK; - exports.YEAR = YEAR; - exports.dayofyear = dayofyear; - exports.timeBin = bin; - exports.timeFloor = timeFloor; - exports.timeInterval = timeInterval; - exports.timeOffset = timeOffset; - exports.timeSequence = timeSequence; - exports.timeUnitSpecifier = timeUnitSpecifier; - exports.timeUnits = timeUnits; - exports.utcFloor = utcFloor; - exports.utcInterval = utcInterval; - exports.utcOffset = utcOffset; - exports.utcSequence = utcSequence; - exports.utcdayofyear = utcdayofyear; - exports.utcweek = utcweek; - exports.week = week; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-time/build/vega-time.min.js b/node_modules/vega-time/build/vega-time.min.js deleted file mode 100644 index 2985694..0000000 --- a/node_modules/vega-time/build/vega-time.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("d3-time"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-time","d3-array"],t):t((e=e||self).vega={},e.vega,e.d3,e.d3)}(this,(function(e,t,n,r){"use strict";const o="year",i="quarter",u="month",a="week",c="date",s="day",l="hours",f="minutes",d="seconds",y=[o,i,u,a,c,s,"dayofyear",l,f,d,"milliseconds"],m=y.reduce((e,t,n)=>(e[t]=1+n,e),{});function g(e){const n=t.array(e).slice(),r={};n.length||t.error("Missing time unit."),n.forEach(e=>{t.hasOwnProperty(m,e)?r[e]=1:t.error(`Invalid time unit: ${e}.`)});return(r[a]||r.day?1:0)+(r[i]||r[u]||r[c]?1:0)+(r.dayofyear?1:0)>1&&t.error("Incompatible time units: "+e),n.sort((e,t)=>m[e]-m[t]),n}const D={[o]:"%Y ",[i]:"Q%q ",[u]:"%b ",[c]:"%d ",[a]:"W%U ",[s]:"%a ",dayofyear:"%j ",[l]:"%H:00",[f]:"00:%M",[d]:":%S",milliseconds:".%L","year-month":"%Y-%m ","year-month-date":"%Y-%m-%d ",["hours-"+f]:"%H:%M"};const M=new Date;function h(e){return M.setFullYear(e),M.setMonth(0),M.setDate(1),M.setHours(0,0,0,0),M}function T(e){return n.timeDay.count(h(e.getFullYear())-1,e)}function U(e){return n.timeWeek.count(h(e.getFullYear())-1,e)}function C(e){return h(e).getDay()}function S(e,t,n,r,o,i,u){if(0<=e&&e<100){var a=new Date(-1,t,n,r,o,i,u);return a.setFullYear(e),a}return new Date(e,t,n,r,o,i,u)}function Y(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return n.utcDay.count(t-1,e)}function p(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return n.utcWeek.count(t-1,e)}function v(e){return M.setTime(Date.UTC(e,0,1)),M.getUTCDay()}function w(e,t,n,r,o,i,u){if(0<=e&&e<100){var a=new Date(Date.UTC(-1,t,n,r,o,i,u));return a.setUTCFullYear(n.y),a}return new Date(Date.UTC(e,t,n,r,o,i,u))}function F(e,n,r,y,m){const g=n||1,D=t.peek(e),M=(e,t,n)=>function(e,t,n,r){const o=n<=1?e:r?(t,o)=>r+n*Math.floor((e(t,o)-r)/n):(t,r)=>n*Math.floor(e(t,r)/n);return t?(e,n)=>t(o(e,n),n):o}(r[n=n||e],y[n],e===D&&g,t),h=new Date,T=t.toSet(e),U=T[o]?M(o):t.constant(2012),C=T[u]?M(u):T[i]?M(i):t.zero,S=T[a]&&T.day?M(s,1,a+s):T[a]?M(a,1):T.day?M(s,1):T[c]?M(c,1):T.dayofyear?M("dayofyear",1):t.one,Y=T[l]?M(l):t.zero,p=T[f]?M(f):t.zero,v=T[d]?M(d):t.zero,w=T.milliseconds?M("milliseconds"):t.zero;return function(e){h.setTime(+e);const t=U(h);return m(t,C(h),S(h,t),Y(h),p(h),v(h),w(h))}}function k(e,t,n){return t+7*e-(n+6)%7}const E={[o]:e=>e.getFullYear(),[i]:e=>Math.floor(e.getMonth()/3),[u]:e=>e.getMonth(),[c]:e=>e.getDate(),[l]:e=>e.getHours(),[f]:e=>e.getMinutes(),[d]:e=>e.getSeconds(),milliseconds:e=>e.getMilliseconds(),dayofyear:e=>T(e),[a]:e=>U(e),[a+s]:(e,t)=>k(U(e),e.getDay(),C(t)),[s]:(e,t)=>k(1,e.getDay(),C(t))},H={[i]:e=>3*e,[a]:(e,t)=>k(e,0,C(t))};const I={[o]:e=>e.getUTCFullYear(),[i]:e=>Math.floor(e.getUTCMonth()/3),[u]:e=>e.getUTCMonth(),[c]:e=>e.getUTCDate(),[l]:e=>e.getUTCHours(),[f]:e=>e.getUTCMinutes(),[d]:e=>e.getUTCSeconds(),milliseconds:e=>e.getUTCMilliseconds(),dayofyear:e=>Y(e),[a]:e=>p(e),[s]:(e,t)=>k(1,e.getUTCDay(),v(t)),[a+s]:(e,t)=>k(p(e),e.getUTCDay(),v(t))},O={[i]:e=>3*e,[a]:(e,t)=>k(e,0,v(t))};const b={[o]:n.timeYear,[i]:n.timeMonth.every(3),[u]:n.timeMonth,[a]:n.timeWeek,[c]:n.timeDay,[s]:n.timeDay,dayofyear:n.timeDay,[l]:n.timeHour,[f]:n.timeMinute,[d]:n.timeSecond,milliseconds:n.timeMillisecond},q={[o]:n.utcYear,[i]:n.utcMonth.every(3),[u]:n.utcMonth,[a]:n.utcWeek,[c]:n.utcDay,[s]:n.utcDay,dayofyear:n.utcDay,[l]:n.utcHour,[f]:n.utcMinute,[d]:n.utcSecond,milliseconds:n.utcMillisecond};function x(e){return b[e]}function A(e){return q[e]}function W(e,t,n){return e?e.offset(t,n):void 0}function z(e,t,n,r){return e?e.range(t,n,r):void 0}const N=[o,u,c,l,f,d,"milliseconds"],R=N.slice(0,-1),j=R.slice(0,-1),L=j.slice(0,-1),_=L.slice(0,-1),P=[o,u],Q=[o],B=[[R,1,1e3],[R,5,5e3],[R,15,15e3],[R,30,3e4],[j,1,6e4],[j,5,3e5],[j,15,9e5],[j,30,18e5],[L,1,36e5],[L,3,108e5],[L,6,216e5],[L,12,432e5],[_,1,864e5],[[o,a],1,6048e5],[P,1,2592e6],[P,3,7776e6],[Q,1,31536e6]];e.DATE=c,e.DAY=s,e.DAYOFYEAR="dayofyear",e.HOURS=l,e.MILLISECONDS="milliseconds",e.MINUTES=f,e.MONTH=u,e.QUARTER=i,e.SECONDS=d,e.TIME_UNITS=y,e.WEEK=a,e.YEAR=o,e.dayofyear=function(e){return T(new Date(e))},e.timeBin=function(e){const n=e.extent,o=e.maxbins||40,i=Math.abs(t.span(n))/o;let u,a,c=r.bisector(e=>e[2]).right(B,i);return c===B.length?(u=Q,a=r.tickStep(n[0]/31536e6,n[1]/31536e6,o)):c?(c=B[i/B[c-1][2]s;--u)if(a=o.slice(s,u).join("-"),null!=r[a]){c+=r[a],s=u;break}return c.trim()},e.timeUnits=g,e.utcFloor=function(e,t){return F(e,t||1,I,O,w)},e.utcInterval=A,e.utcOffset=function(e,t,n){return W(A(e),t,n)},e.utcSequence=function(e,t,n,r){return z(A(e),t,n,r)},e.utcdayofyear=function(e){return Y(new Date(e))},e.utcweek=function(e){return p(new Date(e))},e.week=function(e){return U(new Date(e))},Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-time/index.js b/node_modules/vega-time/index.js deleted file mode 100644 index 5272f1f..0000000 --- a/node_modules/vega-time/index.js +++ /dev/null @@ -1,41 +0,0 @@ -export { - TIME_UNITS, - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS, - timeUnitSpecifier, - timeUnits -} from './src/units'; - -export { - dayofyear, - week, - utcdayofyear, - utcweek -} from './src/util'; - -export { - timeFloor, - utcFloor -} from './src/floor'; - -export { - timeInterval, - timeOffset, - timeSequence, - utcInterval, - utcOffset, - utcSequence -} from './src/interval'; - -export { - default as timeBin -} from './src/bin'; diff --git a/node_modules/vega-time/package.json b/node_modules/vega-time/package.json deleted file mode 100644 index 602b179..0000000 --- a/node_modules/vega-time/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "_from": "vega-time@~2.0.1", - "_id": "vega-time@2.0.1", - "_inBundle": false, - "_integrity": "sha512-Ij0gmABKDRKAMUTh/1AGSSkU6ocWiteLkIK/cmcnt98u8LiuVcFT5w7gusd0+ibO9EooeMKazn5xPmjvQs0qEg==", - "_location": "/vega-time", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-time@~2.0.1", - "name": "vega-time", - "escapedName": "vega-time", - "rawSpec": "~2.0.1", - "saveSpec": null, - "fetchSpec": "~2.0.1" - }, - "_requiredBy": [ - "/vega", - "/vega-format", - "/vega-functions", - "/vega-scale", - "/vega-transforms" - ], - "_resolved": "https://registry.npmjs.org/vega-time/-/vega-time-2.0.1.tgz", - "_shasum": "2a91c3acafd091e6724063dea26e4b3fe6061d2f", - "_spec": "vega-time@~2.0.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "^2.4.0", - "d3-time": "^1.1.0", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "JavaScript date/time utilities for Vega.", - "gitHead": "8fe8d36961c128df8300e6bc4fe6aac1e537bbe0", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "date", - "time", - "utilities" - ], - "license": "BSD-3-Clause", - "main": "build/vega-time.js", - "module": "index", - "name": "vega-time", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-time.js -c -m -o build/vega-time.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g d3-array:d3,d3-time:d3,vega-util:vega -f umd -n vega -o build/vega-time.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "types": "index.d.ts", - "version": "2.0.1" -} diff --git a/node_modules/vega-time/src/bin.js b/node_modules/vega-time/src/bin.js deleted file mode 100644 index 58b0bde..0000000 --- a/node_modules/vega-time/src/bin.js +++ /dev/null @@ -1,63 +0,0 @@ -import {DATE, HOURS, MILLISECONDS, MINUTES, MONTH, SECONDS, WEEK, YEAR} from './units'; -import {span} from 'vega-util'; -import {bisector, tickStep} from 'd3-array'; - -const durationSecond = 1000, - durationMinute = durationSecond * 60, - durationHour = durationMinute * 60, - durationDay = durationHour * 24, - durationWeek = durationDay * 7, - durationMonth = durationDay * 30, - durationYear = durationDay * 365; - -const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], - Seconds = Milli.slice(0, -1), - Minutes = Seconds.slice(0, -1), - Hours = Minutes.slice(0, -1), - Day = Hours.slice(0, -1), - Week = [YEAR, WEEK], - Month = [YEAR, MONTH], - Year = [YEAR]; - -const intervals = [ - [Seconds, 1, durationSecond], - [Seconds, 5, 5 * durationSecond], - [Seconds, 15, 15 * durationSecond], - [Seconds, 30, 30 * durationSecond], - [Minutes, 1, durationMinute], - [Minutes, 5, 5 * durationMinute], - [Minutes, 15, 15 * durationMinute], - [Minutes, 30, 30 * durationMinute], - [ Hours, 1, durationHour ], - [ Hours, 3, 3 * durationHour ], - [ Hours, 6, 6 * durationHour ], - [ Hours, 12, 12 * durationHour ], - [ Day, 1, durationDay ], - [ Week, 1, durationWeek ], - [ Month, 1, durationMonth ], - [ Month, 3, 3 * durationMonth ], - [ Year, 1, durationYear ] -]; - -export default function(opt) { - const ext = opt.extent, - max = opt.maxbins || 40, - target = Math.abs(span(ext)) / max; - - let i = bisector(i => i[2]).right(intervals, target), - units, step; - - if (i === intervals.length) { - units = Year, - step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max); - } else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max(tickStep(ext[0], ext[1], max), 1); - } - - return {units, step}; -} diff --git a/node_modules/vega-time/src/floor.js b/node_modules/vega-time/src/floor.js deleted file mode 100644 index b73b116..0000000 --- a/node_modules/vega-time/src/floor.js +++ /dev/null @@ -1,115 +0,0 @@ -import { - DATE, - DAY, - DAYOFYEAR, - HOURS, - MILLISECONDS, - MINUTES, - MONTH, - QUARTER, - SECONDS, - WEEK, - YEAR -} from './units'; -import { - localDate, localDayOfYear, localFirst, localWeekNum, - utcDate, utcDayOfYear, utcFirst, utcWeekNum -} from './util'; -import {constant, one, peek, toSet, zero} from 'vega-util'; - -function floor(units, step, get, inv, newDate) { - const s = step || 1, - b = peek(units), - _ = (unit, p, key) => { - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - - const t = new Date, - u = toSet(units), - y = u[YEAR] ? _(YEAR) : constant(2012), - m = u[MONTH] ? _(MONTH) - : u[QUARTER] ? _(QUARTER) - : zero, - d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) - : u[WEEK] ? _(WEEK, 1) - : u[DAY] ? _(DAY, 1) - : u[DATE] ? _(DATE, 1) - : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) - : one, - H = u[HOURS] ? _(HOURS) : zero, - M = u[MINUTES] ? _(MINUTES) : zero, - S = u[SECONDS] ? _(SECONDS) : zero, - L = u[MILLISECONDS] ? _(MILLISECONDS) : zero; - - return function(v) { - t.setTime(+v); - const year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; -} - -function getUnit(f, inv, step, phase) { - const u = step <= 1 ? f - : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) - : (d, y) => step * Math.floor(f(d, y) / step); - return inv ? (d, y) => inv(u(d, y), y) : u; -} - -// returns the day of the year based on week number, day of week, -// and the day of the week for the first day of the year -function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; -} - -// -- LOCAL TIME -- - -const localGet = { - [YEAR]: d => d.getFullYear(), - [QUARTER]: d => Math.floor(d.getMonth() / 3), - [MONTH]: d => d.getMonth(), - [DATE]: d => d.getDate(), - [HOURS]: d => d.getHours(), - [MINUTES]: d => d.getMinutes(), - [SECONDS]: d => d.getSeconds(), - [MILLISECONDS]: d => d.getMilliseconds(), - [DAYOFYEAR]: d => localDayOfYear(d), - [WEEK]: d => localWeekNum(d), - [WEEK + DAY]: (d, y) => weekday(localWeekNum(d), d.getDay(), localFirst(y)), - [DAY]: (d, y) => weekday(1, d.getDay(), localFirst(y)) -}; - -const localInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday(w, 0, localFirst(y)) -}; - -export function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); -} - -// -- UTC TIME -- - -const utcGet = { - [YEAR]: d => d.getUTCFullYear(), - [QUARTER]: d => Math.floor(d.getUTCMonth() / 3), - [MONTH]: d => d.getUTCMonth(), - [DATE]: d => d.getUTCDate(), - [HOURS]: d => d.getUTCHours(), - [MINUTES]: d => d.getUTCMinutes(), - [SECONDS]: d => d.getUTCSeconds(), - [MILLISECONDS]: d => d.getUTCMilliseconds(), - [DAYOFYEAR]: d => utcDayOfYear(d), - [WEEK]: d => utcWeekNum(d), - [DAY]: (d, y) => weekday(1, d.getUTCDay(), utcFirst(y)), - [WEEK + DAY]: (d, y) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)) -}; - -const utcInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday(w, 0, utcFirst(y)) -}; - -export function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); -} diff --git a/node_modules/vega-time/src/interval.js b/node_modules/vega-time/src/interval.js deleted file mode 100644 index f56ce12..0000000 --- a/node_modules/vega-time/src/interval.js +++ /dev/null @@ -1,92 +0,0 @@ -import { - DATE, - DAY, - DAYOFYEAR, - HOURS, - MILLISECONDS, - MINUTES, - MONTH, - QUARTER, - SECONDS, - WEEK, - YEAR -} from './units'; - -import { - timeDay, - timeHour, - timeMillisecond, - timeMinute, - timeMonth, - timeSecond, - timeWeek, - timeYear, - utcDay, - utcHour, - utcMillisecond, - utcMinute, - utcMonth, - utcSecond, - utcWeek, - utcYear -} from 'd3-time'; - -const timeIntervals = { - [YEAR]: timeYear, - [QUARTER]: timeMonth.every(3), - [MONTH]: timeMonth, - [WEEK]: timeWeek, - [DATE]: timeDay, - [DAY]: timeDay, - [DAYOFYEAR]: timeDay, - [HOURS]: timeHour, - [MINUTES]: timeMinute, - [SECONDS]: timeSecond, - [MILLISECONDS]: timeMillisecond -}; - -const utcIntervals = { - [YEAR]: utcYear, - [QUARTER]: utcMonth.every(3), - [MONTH]: utcMonth, - [WEEK]: utcWeek, - [DATE]: utcDay, - [DAY]: utcDay, - [DAYOFYEAR]: utcDay, - [HOURS]: utcHour, - [MINUTES]: utcMinute, - [SECONDS]: utcSecond, - [MILLISECONDS]: utcMillisecond -}; - -export function timeInterval(unit) { - return timeIntervals[unit]; -} - -export function utcInterval(unit) { - return utcIntervals[unit]; -} - -function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; -} - -export function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); -} - -export function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); -} - -function sequence(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; -} - -export function timeSequence(unit, start, stop, step) { - return sequence(timeInterval(unit), start, stop, step); -} - -export function utcSequence(unit, start, stop, step) { - return sequence(utcInterval(unit), start, stop, step); -} diff --git a/node_modules/vega-time/src/units.js b/node_modules/vega-time/src/units.js deleted file mode 100644 index 548f688..0000000 --- a/node_modules/vega-time/src/units.js +++ /dev/null @@ -1,98 +0,0 @@ -import {array, error, extend, hasOwnProperty} from 'vega-util'; - -export const YEAR = 'year'; -export const QUARTER = 'quarter'; -export const MONTH = 'month'; -export const WEEK = 'week'; -export const DATE = 'date'; -export const DAY = 'day'; -export const DAYOFYEAR = 'dayofyear'; -export const HOURS = 'hours'; -export const MINUTES = 'minutes'; -export const SECONDS = 'seconds'; -export const MILLISECONDS = 'milliseconds'; - -export const TIME_UNITS = [ - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -]; - -const UNITS = TIME_UNITS.reduce((o, u, i) => (o[u] = 1 + i, o), {}); - -export function timeUnits(units) { - const u = array(units).slice(), - m = {}; - - // check validity - if (!u.length) error('Missing time unit.'); - - u.forEach(unit => { - if (hasOwnProperty(UNITS, unit)) { - m[unit] = 1; - } else { - error(`Invalid time unit: ${unit}.`); - } - }); - - const numTypes = ( - (m[WEEK] || m[DAY] ? 1 : 0) + - (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + - (m[DAYOFYEAR] ? 1 : 0) - ); - - if (numTypes > 1) { - error(`Incompatible time units: ${units}`); - } - - // ensure proper sort order - u.sort((a, b) => UNITS[a] - UNITS[b]); - - return u; -} - -const defaultSpecifiers = { - [YEAR]: '%Y ', - [QUARTER]: 'Q%q ', - [MONTH]: '%b ', - [DATE]: '%d ', - [WEEK]: 'W%U ', - [DAY]: '%a ', - [DAYOFYEAR]: '%j ', - [HOURS]: '%H:00', - [MINUTES]: '00:%M', - [SECONDS]: ':%S', - [MILLISECONDS]: '.%L', - [`${YEAR}-${MONTH}`]: '%Y-%m ', - [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ', - [`${HOURS}-${MINUTES}`]: '%H:%M' -}; - -export function timeUnitSpecifier(units, specifiers) { - const s = extend({}, defaultSpecifiers, specifiers), - u = timeUnits(units), - n = u.length; - - let fmt = '', start = 0, end, key; - - for (start=0; start start; --end) { - key = u.slice(start, end).join('-'); - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - } - - return fmt.trim(); -} diff --git a/node_modules/vega-time/src/util.js b/node_modules/vega-time/src/util.js deleted file mode 100644 index 7d9a4e3..0000000 --- a/node_modules/vega-time/src/util.js +++ /dev/null @@ -1,72 +0,0 @@ -import {timeDay, timeWeek, utcDay, utcWeek} from 'd3-time'; - -const t0 = new Date; - -function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; -} - -export function dayofyear(d) { - return localDayOfYear(new Date(d)); -} - -export function week(d) { - return localWeekNum(new Date(d)); -} - -export function localDayOfYear(d) { - return timeDay.count(localYear(d.getFullYear()) - 1, d); -} - -export function localWeekNum(d) { - return timeWeek.count(localYear(d.getFullYear()) - 1, d); -} - -export function localFirst(y) { - return localYear(y).getDay(); -} - -export function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - return new Date(y, m, d, H, M, S, L); -} - -export function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); -} - -export function utcweek(d) { - return utcWeekNum(new Date(d)); -} - -export function utcDayOfYear(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return utcDay.count(y - 1, d); -} - -export function utcWeekNum(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return utcWeek.count(y - 1, d); -} - -export function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); -} - -export function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(y, m, d, H, M, S, L)); -} diff --git a/node_modules/vega-transforms/LICENSE b/node_modules/vega-transforms/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-transforms/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-transforms/README.md b/node_modules/vega-transforms/README.md deleted file mode 100644 index 629ab10..0000000 --- a/node_modules/vega-transforms/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# vega-transforms - -Data processing transforms for Vega dataflows. - -This package provides the following Vega data transforms: - -- [**Aggregate**](https://vega.github.io/vega/docs/transforms/aggregate/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Aggregate.js "Source") -- [**Bin**](https://vega.github.io/vega/docs/transforms/bin/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Bin.js "Source") -- [**Collect**](https://vega.github.io/vega/docs/transforms/collect/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Collect.js "Source") -- [**CountPattern**](https://vega.github.io/vega/docs/transforms/countpattern/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/CountPattern.js "Source") -- [**Cross**](https://vega.github.io/vega/docs/transforms/cross/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Cross.js "Source") -- [**Density**](https://vega.github.io/vega/docs/transforms/density/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Density.js "Source") -- [**DotBin**](https://vega.github.io/vega/docs/transforms/dotbin/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/DotBin.js "Source") -- [**Extent**](https://vega.github.io/vega/docs/transforms/extent/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Extent.js "Source") -- [**Filter**](https://vega.github.io/vega/docs/transforms/filter/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Filter.js "Source") -- [**Flatten**](https://vega.github.io/vega/docs/transforms/flatten/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Flatten.js "Source") -- [**Fold**](https://vega.github.io/vega/docs/transforms/fold/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Fold.js "Source") -- [**Formula**](https://vega.github.io/vega/docs/transforms/formula/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Formula.js "Source") -- [**Impute**](https://vega.github.io/vega/docs/transforms/Impute/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Impute.js "Source") -- [**JoinAggregate**](https://vega.github.io/vega/docs/transforms/joinaggregate/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/JoinAggregate.js "Source") -- [**KDE**](https://vega.github.io/vega/docs/transforms/kde/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/KDE.js "Source") -- [**Lookup**](https://vega.github.io/vega/docs/transforms/lookup/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Lookup.js "Source") -- [**Pivot**](https://vega.github.io/vega/docs/transforms/pivot/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Pivot.js "Source") -- [**Project**](https://vega.github.io/vega/docs/transforms/project/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Project.js "Source") -- [**Quantile**](https://vega.github.io/vega/docs/transforms/quantile/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Quantile.js "Source") -- [**Sample**](https://vega.github.io/vega/docs/transforms/sample/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Sample.js "Source") -- [**Sequence**](https://vega.github.io/vega/docs/transforms/sequence/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Sequence.js "Source") -- [**TimeUnit**](https://vega.github.io/vega/docs/transforms/timeunit/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/TimeUnit.js "Source") -- [**Window**](https://vega.github.io/vega/docs/transforms/window/) [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Window.js "Source") - -And provides the following internal transforms: - -- **Compare** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Compare.js "Source") -- **Expression** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Expression.js "Source") -- **Facet** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Facet.js "Source") -- **Field** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Field.js "Source") -- **Generate** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Generate.js "Source") -- **Key** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Key.js "Source") -- **MultiExtent** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/MultiExtent.js "Source") -- **MultiValues** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/MultiValues.js "Source") -- **Params** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Params.js "Source") -- **PreFacet** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/PreFacet.js "Source") -- **Proxy** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Proxy.js "Source") -- **Relay** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Relay.js "Source") -- **Sieve** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Sieve.js "Source") -- **Subflow** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Subflow.js "Source") -- **TupleIndex** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/TupleIndex.js "Source") -- **Values** [<>](https://github.com/vega/vega/blob/master/packages/vega-transforms/src/Values.js "Source") - -For more information about data stream transforms, see the [Vega transform documentation](https://vega.github.io/vega/docs/transforms/). diff --git a/node_modules/vega-transforms/build/vega-transforms.js b/node_modules/vega-transforms/build/vega-transforms.js deleted file mode 100644 index 3312fe3..0000000 --- a/node_modules/vega-transforms/build/vega-transforms.js +++ /dev/null @@ -1,3676 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('vega-dataflow'), require('vega-statistics'), require('d3-array'), require('vega-time')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'vega-dataflow', 'vega-statistics', 'd3-array', 'vega-time'], factory) : - (global = global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.vega, global.vega, global.vega, global.d3, global.vega)); -}(this, (function (exports, vegaUtil, vegaDataflow, vegaStatistics, d3Array, vegaTime) { 'use strict'; - - function multikey(f) { - return function(x) { - var n = f.length, - i = 1, - k = String(f[0](x)); - - for (; i {}; - - const base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 - }; - - const AggregateOps = { - values: { - init: m => m.cell.store = true, - value: m => m.cell.data.values(), - idx: -1 - }, - count: { - value: m => m.cell.num - }, - __count__: { - value: m => m.missing + m.valid - }, - missing: { - value: m => m.missing - }, - valid: { - value: m => m.valid - }, - sum: { - init: m => m.sum = 0, - value: m => m.sum, - add: (m, v) => m.sum += +v, - rem: (m, v) => m.sum -= v - }, - product: { - init: m => m.product = 1, - value: m => m.valid ? m.product : undefined, - add: (m, v) => m.product *= v, - rem: (m, v) => m.product /= v - }, - mean: { - init: m => m.mean = 0, - value: m => m.valid ? m.mean : undefined, - add: (m, v) => (m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid), - rem: (m, v) => (m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean) - }, - average: { - value: m => m.valid ? m.mean : undefined, - req: ['mean'], idx: 1 - }, - variance: { - init: m => m.dev = 0, - value: m => m.valid > 1 ? m.dev / (m.valid - 1) : undefined, - add: (m, v) => m.dev += m.mean_d * (v - m.mean), - rem: (m, v) => m.dev -= m.mean_d * (v - m.mean), - req: ['mean'], idx: 1 - }, - variancep: { - value: m => m.valid > 1 ? m.dev / m.valid : undefined, - req: ['variance'], idx: 2 - }, - stdev: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined, - req: ['variance'], idx: 2 - }, - stdevp: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined, - req: ['variance'], idx: 2 - }, - stderr: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined, - req: ['variance'], idx: 2 - }, - distinct: { - value: m => m.cell.data.distinct(m.get), - req: ['values'], idx: 3 - }, - ci0: { - value: m => m.cell.data.ci0(m.get), - req: ['values'], idx: 3 - }, - ci1: { - value: m => m.cell.data.ci1(m.get), - req: ['values'], idx: 3 - }, - median: { - value: m => m.cell.data.q2(m.get), - req: ['values'], idx: 3 - }, - q1: { - value: m => m.cell.data.q1(m.get), - req: ['values'], idx: 3 - }, - q3: { - value: m => m.cell.data.q3(m.get), - req: ['values'], idx: 3 - }, - min: { - init: m => m.min = undefined, - value: m => m.min = (Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min), - add: (m, v) => { if (v < m.min || m.min === undefined) m.min = v; }, - rem: (m, v) => { if (v <= m.min) m.min = NaN; }, - req: ['values'], idx: 4 - }, - max: { - init: m => m.max = undefined, - value: m => m.max = (Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max), - add: (m, v) => { if (v > m.max || m.max === undefined) m.max = v; }, - rem: (m, v) => { if (v >= m.max) m.max = NaN; }, - req: ['values'], idx: 4 - }, - argmin: { - init: m => m.argmin = undefined, - value: m => m.argmin || m.cell.data.argmin(m.get), - add: (m, v, t) => { if (v < m.min) m.argmin = t; }, - rem: (m, v) => { if (v <= m.min) m.argmin = undefined; }, - req: ['min', 'values'], idx: 3 - }, - argmax: { - init: m => m.argmax = undefined, - value: m => m.argmax || m.cell.data.argmax(m.get), - add: (m, v, t) => { if (v > m.max) m.argmax = t; }, - rem: (m, v) => { if (v >= m.max) m.argmax = undefined; }, - req: ['max', 'values'], idx: 3 - } - }; - - const ValidAggregateOps = Object.keys(AggregateOps); - - function measure(key, value) { - return out => vegaUtil.extend({ - name: key, - out: out || key - }, base_op, value); - } - - ValidAggregateOps.forEach(key => { - AggregateOps[key] = measure(key, AggregateOps[key]); - }); - - function createMeasure(op, name) { - return AggregateOps[op](name); - } - - function compareIndex(a, b) { - return a.idx - b.idx; - } - - function resolve(agg) { - const map = {}; - agg.forEach(a => map[a.name] = a); - - const getreqs = a => { - if (!a.req) return; - a.req.forEach(key => { - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - agg.forEach(getreqs); - - return Object.values(map).sort(compareIndex); - } - - function init() { - this.valid = 0; - this.missing = 0; - this._ops.forEach(op => op.init(this)); - } - - function add(v, t) { - if (v == null || v === '') { ++this.missing; return; } - if (v !== v) return; - ++this.valid; - this._ops.forEach(op => op.add(this, v, t)); - } - - function rem(v, t) { - if (v == null || v === '') { --this.missing; return; } - if (v !== v) return; - --this.valid; - this._ops.forEach(op => op.rem(this, v, t)); - } - - function set(t) { - this._out.forEach(op => t[op.out] = op.value(this)); - return t; - } - - function compileMeasures(agg, field) { - var get = field || vegaUtil.identity, - ops = resolve(agg), - out = agg.slice().sort(compareIndex); - - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - - ctr.prototype.init = init; - ctr.prototype.add = add; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map(op => op.out); - - return ctr; - } - - function TupleStore(key) { - this._key = key ? vegaUtil.field(key) : vegaDataflow.tupleid; - this.reset(); - } - - var prototype = TupleStore.prototype; - - prototype.reset = function() { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; - }; - - prototype.add = function(v) { - this._add.push(v); - }; - - prototype.rem = function(v) { - this._rem.push(v); - }; - - prototype.values = function() { - this._get = null; - if (this._rem.length === 0) return this._add; - - var a = this._add, - r = this._rem, - k = this._key, - n = a.length, - m = r.length, - x = Array(n - m), - map = {}, i, j, v; - - // use unique key field to clear removed values - for (i=0; i= 0) { - s = get(v[n]) + ''; - if (!vegaUtil.hasOwnProperty(map, s)) { - map[s] = 1; - ++count; - } - } - - return count; - }; - - prototype.extent = function(get) { - if (this._get !== get || !this._ext) { - var v = this.values(), - i = vegaUtil.extentIndex(v, get); - this._ext = [v[i[0]], v[i[1]]]; - this._get = get; - } - return this._ext; - }; - - prototype.argmin = function(get) { - return this.extent(get)[0] || {}; - }; - - prototype.argmax = function(get) { - return this.extent(get)[1] || {}; - }; - - prototype.min = function(get) { - var m = this.extent(get)[0]; - return m != null ? get(m) : undefined; - }; - - prototype.max = function(get) { - var m = this.extent(get)[1]; - return m != null ? get(m) : undefined; - }; - - prototype.quartile = function(get) { - if (this._get !== get || !this._q) { - this._q = vegaStatistics.quartiles(this.values(), get); - this._get = get; - } - return this._q; - }; - - prototype.q1 = function(get) { - return this.quartile(get)[0]; - }; - - prototype.q2 = function(get) { - return this.quartile(get)[1]; - }; - - prototype.q3 = function(get) { - return this.quartile(get)[2]; - }; - - prototype.ci = function(get) { - if (this._get !== get || !this._ci) { - this._ci = vegaStatistics.bootstrapCI(this.values(), 1000, 0.05, get); - this._get = get; - } - return this._ci; - }; - - prototype.ci0 = function(get) { - return this.ci(get)[0]; - }; - - prototype.ci1 = function(get) { - return this.ci(get)[1]; - }; - - /** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.fields] - An array of accessors to aggregate. - * @param {Array} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ - function Aggregate(params) { - vegaDataflow.Transform.call(this, null, params); - - this._adds = []; // array of added output tuples - this._mods = []; // array of modified output tuples - this._alen = 0; // number of active added tuples - this._mlen = 0; // number of active modified tuples - this._drop = true; // should empty aggregation cells be removed - this._cross = false; // produce full cross-product of group-by values - - this._dims = []; // group-by dimension accessors - this._dnames = []; // group-by dimension names - - this._measures = []; // collection of aggregation monoids - this._countOnly = false; // flag indicating only count aggregation - this._counts = null; // collection of count fields - this._prev = null; // previous aggregation cells - - this._inputs = null; // array of dependent input tuple field names - this._outputs = null; // array of output tuple field names - } - - Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidAggregateOps }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'drop', 'type': 'boolean', 'default': true }, - { 'name': 'cross', 'type': 'boolean', 'default': false }, - { 'name': 'key', 'type': 'field' } - ] - }; - - var prototype$1 = vegaUtil.inherits(Aggregate, vegaDataflow.Transform); - - prototype$1.transform = function(_, pulse) { - var aggr = this, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - mod = _.modified(); - - aggr.stamp = out.stamp; - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, t => aggr.add(t)); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, t => aggr.rem(t)); - pulse.visit(pulse.ADD, t => aggr.add(t)); - } - - // Indicate output fields and return aggregate tuples. - out.modifies(aggr._outputs); - - // Should empty cells be dropped? - aggr._drop = _.drop !== false; - - // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - - if (pulse.clean() && aggr._drop) { - out.clean(true).runAfter(() => this.clean()); - } - - return aggr.changes(out); - }; - - prototype$1.cross = function() { - var aggr = this, - curr = aggr.value, - dims = aggr._dnames, - vals = dims.map(function() { return {}; }), - n = dims.length; - - // collect all group-by domain values - function collect(cells) { - var key, i, t, v; - for (key in cells) { - t = cells[key].tuple; - for (i=0; i stop ? +Infinity - : ( - v = Math.max(start, Math.min(v, stop - step)), - start + step * Math.floor(EPSILON + (v - start) / step) - ); - }; - - f.start = start; - f.stop = bins.stop; - f.step = step; - - return this.value = vegaUtil.accessor( - f, - vegaUtil.accessorFields(field), - _.name || 'bin_' + vegaUtil.accessorName(field) - ); - }; - - function SortedList(idFunc, source, input) { - var $ = idFunc, - data = source || [], - add = input || [], - rem = {}, - cnt = 0; - - return { - add: function(t) { add.push(t); }, - remove: function(t) { rem[$(t)] = ++cnt; }, - size: function() { return data.length; }, - data: function(compare, resort) { - if (cnt) { - data = data.filter(function(t) { return !rem[$(t)]; }); - rem = {}; - cnt = 0; - } - if (resort && compare) { - data.sort(compare); - } - if (add.length) { - data = compare - ? vegaUtil.merge(compare, data, add.sort(compare)) - : data.concat(add); - add = []; - } - return data; - } - }; - } - - /** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ - function Collect(params) { - vegaDataflow.Transform.call(this, [], params); - } - - Collect.Definition = { - 'type': 'Collect', - 'metadata': {'source': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' } - ] - }; - - var prototype$3 = vegaUtil.inherits(Collect, vegaDataflow.Transform); - - prototype$3.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - list = SortedList(vegaDataflow.tupleid, this.value, out.materialize(out.ADD).add), - sort = _.sort, - mod = pulse.changed() || (sort && - (_.modified('sort') || pulse.modified(sort.fields))); - - out.visit(out.REM, list.remove); - - this.modified(mod); - this.value = out.source = list.data(vegaDataflow.stableCompare(sort), mod); - - // propagate tree root if defined - if (pulse.source && pulse.source.root) { - this.value.root = pulse.source.root; - } - - return out; - }; - - /** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The fields to compare. - * @param {Array} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ - function Compare(params) { - vegaDataflow.Operator.call(this, null, update, params); - } - - vegaUtil.inherits(Compare, vegaDataflow.Operator); - - function update(_) { - return (this.value && !_.modified()) - ? this.value - : vegaUtil.compare(_.fields, _.orders); - } - - /** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ - function CountPattern(params) { - vegaDataflow.Transform.call(this, null, params); - } - - CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'case', 'type': 'enum', 'values': ['upper', 'lower', 'mixed'], 'default': 'mixed' }, - { 'name': 'pattern', 'type': 'string', 'default': '[\\w"]+' }, - { 'name': 'stopwords', 'type': 'string', 'default': '' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['text', 'count'] } - ] - }; - - function tokenize(text, tcase, match) { - switch (tcase) { - case 'upper': text = text.toUpperCase(); break; - case 'lower': text = text.toLowerCase(); break; - } - return text.match(match); - } - - var prototype$4 = vegaUtil.inherits(CountPattern, vegaDataflow.Transform); - - prototype$4.transform = function(_, pulse) { - function process(update) { - return function(tuple) { - var tokens = tokenize(get(tuple), _.case, match) || [], t; - for (var i=0, n=tokens.length; i} [params.as] - The names of the output fields. - */ - function Cross(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Cross.Definition = { - 'type': 'Cross', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'filter', 'type': 'expr' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['a', 'b'] } - ] - }; - - var prototype$5 = vegaUtil.inherits(Cross, vegaDataflow.Transform); - - prototype$5.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - data = this.value, - as = _.as || ['a', 'b'], - a = as[0], b = as[1], - reset = !data - || pulse.changed(pulse.ADD_REM) - || _.modified('as') - || _.modified('filter'); - - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || vegaUtil.truthy); - } else { - out.mod = data; - } - - out.source = this.value; - return out.modifies(as); - }; - - function cross(input, a, b, filter) { - var data = [], - t = {}, - n = input.length, - i = 0, - j, left; - - for (; i} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ - function parse(def, data) { - var func = def[FUNCTION]; - if (!vegaUtil.hasOwnProperty(Distributions, func)) { - vegaUtil.error('Unknown distribution function: ' + func); - } - - var d = Distributions[func](); - - for (var name in def) { - // if data field, extract values - if (name === FIELD) { - d.data((def.from || data()).map(def[name])); - } - - // if distribution mixture, recurse to parse each definition - else if (name === DISTRIBUTIONS) { - d[name](def[name].map(function(_) { return parse(_, data); })); - } - - // otherwise, simply set the parameter - else if (typeof d[name] === FUNCTION) { - d[name](def[name]); - } - } - - return d; - } - - /** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - function Density(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var distributions = [ - { - 'key': {'function': 'normal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'lognormal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'uniform'}, - 'params': [ - { 'name': 'min', 'type': 'number', 'default': 0 }, - { 'name': 'max', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'kde'}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'from', 'type': 'data' }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 } - ] - } - ]; - - var mixture = { - 'key': {'function': 'mixture'}, - 'params': [ - { 'name': 'distributions', 'type': 'param', 'array': true, - 'params': distributions }, - { 'name': 'weights', 'type': 'number', 'array': true } - ] - }; - - Density.Definition = { - 'type': 'Density', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'method', 'type': 'string', 'default': 'pdf', - 'values': ['pdf', 'cdf'] }, - { 'name': 'distribution', 'type': 'param', - 'params': distributions.concat(mixture) }, - { 'name': 'as', 'type': 'string', 'array': true, - 'default': ['value', 'density'] } - ] - }; - - var prototype$6 = vegaUtil.inherits(Density, vegaDataflow.Transform); - - prototype$6.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var dist = parse(_.distribution, source(pulse)), - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200, - method = _.method || 'pdf'; - - if (method !== 'pdf' && method !== 'cdf') { - vegaUtil.error('Invalid density method: ' + method); - } - if (!_.extent && !dist.data) { - vegaUtil.error('Missing density extent parameter.'); - } - method = dist[method]; - - var as = _.as || ['value', 'density'], - domain = _.extent || vegaUtil.extent(dist.data()), - values = vegaStatistics.sampleCurve(method, domain, minsteps, maxsteps).map(v => { - var tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return vegaDataflow.ingest(tuple); - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; - }; - - function source(pulse) { - return function() { return pulse.materialize(pulse.SOURCE).source; }; - } - - // use either provided alias or accessor field name - function fieldNames(fields, as) { - if (!fields) return null; - return fields.map(function(f, i) { - return as[i] || vegaUtil.accessorName(f); - }); - } - - function partition(data, groupby, field) { - var groups = [], - get = function(f) { return f(t); }, - map, i, n, t, k, g; - - // partition data points into groups - if (groupby == null) { - groups.push(data.map(field)); - } else { - for (map={}, i=0, n=data.length; i} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ - function DotBin(params) { - vegaDataflow.Transform.call(this, null, params); - } - - DotBin.Definition = { - 'type': 'DotBin', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'step', 'type': 'number' }, - { 'name': 'smooth', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': Output } - ] - }; - - const prototype$7 = vegaUtil.inherits(DotBin, vegaDataflow.Transform); - - prototype$7.transform = function(_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) { - return pulse; // early exit - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(pulse.source, _.groupby, vegaUtil.identity), - smooth = _.smooth || false, - field = _.field, - step = _.step || autostep(source, field), - sort = vegaDataflow.stableCompare((a, b) => field(a) - field(b)), - as = _.as || Output, - n = groups.length; - - // compute dotplot bins per group - let min = Infinity, max = -Infinity, i = 0, j; - for (; i max) max = v; - g[++j][as] = v; - } - } - - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); - }; - - function autostep(data, field) { - return vegaUtil.span(vegaUtil.extent(data, field)) / 30; - } - - /** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ - function Expression(params) { - vegaDataflow.Operator.call(this, null, update$1, params); - this.modified(true); - } - - vegaUtil.inherits(Expression, vegaDataflow.Operator); - - function update$1(_) { - var expr = _.expr; - return this.value && !_.modified('expr') - ? this.value - : vegaUtil.accessor( - datum => expr(datum, _), - vegaUtil.accessorFields(expr), - vegaUtil.accessorName(expr) - ); - } - - /** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ - function Extent(params) { - vegaDataflow.Transform.call(this, [undefined, undefined], params); - } - - Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true } - ] - }; - - var prototype$8 = vegaUtil.inherits(Extent, vegaDataflow.Transform); - - prototype$8.transform = function(_, pulse) { - var extent = this.value, - field = _.field, - min = extent[0], - max = extent[1], - mod; - - mod = pulse.changed() - || pulse.modified(field.fields) - || _.modified('field'); - - if (mod || min == null) { - min = +Infinity; - max = -Infinity; - } - - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, function(t) { - var v = vegaUtil.toNumber(field(t)); - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - - if (!Number.isFinite(min) || !Number.isFinite(max)) { - let name = vegaUtil.accessorName(field); - if (name) name = ` for field "${name}"`; - pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`); - min = max = undefined; - } - this.value = [min, max]; - }; - - /** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ - function Subflow(pulse, parent) { - vegaDataflow.Operator.call(this, pulse); - this.parent = parent; - this.count = 0; - } - - var prototype$9 = vegaUtil.inherits(Subflow, vegaDataflow.Operator); - - /** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ - prototype$9.connect = function(target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return (target.source = this); - }; - - /** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ - prototype$9.add = function(t) { - this.count += 1; - this.value.add.push(t); - }; - - /** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ - prototype$9.rem = function(t) { - this.count -= 1; - this.value.rem.push(t); - }; - - /** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ - prototype$9.mod = function(t) { - this.value.mod.push(t); - }; - - /** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ - prototype$9.init = function(pulse) { - this.value.init(pulse, pulse.NO_SOURCE); - }; - - /** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ - prototype$9.evaluate = function() { - // assert: this.value.stamp === pulse.stamp - return this.value; - }; - - /** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ - function Facet(params) { - vegaDataflow.Transform.call(this, {}, params); - this._keys = vegaUtil.fastmap(); // cache previously calculated key values - - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - const a = this._targets = []; - a.active = 0; - a.forEach = f => { - for (let i=0, n=a.active; i this.subflow(key, flow, pulse); - - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - - pulse.visit(pulse.REM, t => { - const id = vegaDataflow.tupleid(t), - k = cache.get(id); - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - - pulse.visit(pulse.ADD, t => { - const k = key(t); - cache.set(vegaDataflow.tupleid(t), k); - subflow(k).add(t); - }); - - if (rekey || pulse.modified(key.fields)) { - pulse.visit(pulse.MOD, t => { - const id = vegaDataflow.tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 === k1) { - subflow(k1).mod(t); - } else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } else if (pulse.changed(pulse.MOD)) { - pulse.visit(pulse.MOD, t => { - subflow(cache.get(vegaDataflow.tupleid(t))).mod(t); - }); - } - - if (rekey) { - pulse.visit(pulse.REFLOW, t => { - const id = vegaDataflow.tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } - - if (pulse.clean()) { - df.runAfter(() => { this.clean(); cache.clean(); }); - } else if (cache.empty > df.cleanThreshold) { - df.runAfter(cache.clean); - } - - return pulse; - }; - - /** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ - function Field(params) { - vegaDataflow.Operator.call(this, null, update$2, params); - } - - vegaUtil.inherits(Field, vegaDataflow.Operator); - - function update$2(_) { - return (this.value && !_.modified()) ? this.value - : vegaUtil.isArray(_.name) ? vegaUtil.array(_.name).map(function(f) { return vegaUtil.field(f); }) - : vegaUtil.field(_.name, _.as); - } - - /** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ - function Filter(params) { - vegaDataflow.Transform.call(this, vegaUtil.fastmap(), params); - } - - Filter.Definition = { - 'type': 'Filter', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'expr', 'type': 'expr', 'required': true } - ] - }; - - var prototype$b = vegaUtil.inherits(Filter, vegaDataflow.Transform); - - prototype$b.transform = function(_, pulse) { - var df = pulse.dataflow, - cache = this.value, // cache ids of filtered tuples - output = pulse.fork(), - add = output.add, - rem = output.rem, - mod = output.mod, - test = _.expr, - isMod = true; - - pulse.visit(pulse.REM, function(t) { - var id = vegaDataflow.tupleid(t); - if (!cache.has(id)) rem.push(t); - else cache.delete(id); - }); - - pulse.visit(pulse.ADD, function(t) { - if (test(t, _)) add.push(t); - else cache.set(vegaDataflow.tupleid(t), 1); - }); - - function revisit(t) { - var id = vegaDataflow.tupleid(t), - b = test(t, _), - s = cache.get(id); - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) { - mod.push(t); - } - } - - pulse.visit(pulse.MOD, revisit); - - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; - }; - - /** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ - function Flatten(params) { - vegaDataflow.Transform.call(this, [], params); - } - - Flatten.Definition = { - 'type': 'Flatten', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'index', 'type': 'string' }, - { 'name': 'as', 'type': 'string', 'array': true } - ] - }; - - var prototype$c = vegaUtil.inherits(Flatten, vegaDataflow.Transform); - - prototype$c.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - as = fieldNames(fields, _.as || []), - index = _.index || null, - m = as.length; - - // remove any previous results - out.rem = this.value; - - // generate flattened tuples - pulse.visit(pulse.SOURCE, function(t) { - var arrays = fields.map(f => f(t)), - maxlen = arrays.reduce((l, a) => Math.max(l, a.length), 0), - i = 0, j, d, v; - - for (; i} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ - function Fold(params) { - vegaDataflow.Transform.call(this, [], params); - } - - Fold.Definition = { - 'type': 'Fold', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['key', 'value'] } - ] - }; - - var prototype$d = vegaUtil.inherits(Fold, vegaDataflow.Transform); - - prototype$d.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - fnames = fields.map(vegaUtil.accessorName), - as = _.as || ['key', 'value'], - k = as[0], - v = as[1], - n = fields.length; - - out.rem = this.value; - - pulse.visit(pulse.SOURCE, function(t) { - for (var i=0, d; i t[as] = func(t, _)); - }; - - /** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ - function Generate(params) { - vegaDataflow.Transform.call(this, [], params); - } - - var prototype$f = vegaUtil.inherits(Generate, vegaDataflow.Transform); - - prototype$f.transform = function(_, pulse) { - var data = this.value, - out = pulse.fork(pulse.ALL), - num = _.size - data.length, - gen = _.generator, - add, rem, t; - - if (num > 0) { - // need more tuples, generate and add - for (add=[]; --num >= 0;) { - add.push(t = vegaDataflow.ingest(gen(_))); - data.push(t); - } - out.add = out.add.length - ? out.materialize(out.ADD).add.concat(add) - : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length - ? out.materialize(out.REM).rem.concat(rem) - : rem; - data = data.slice(-num); - } - - out.source = this.value = data; - return out; - }; - - var Methods = { - value: 'value', - median: d3Array.median, - mean: d3Array.mean, - min: d3Array.min, - max: d3Array.max - }; - - var Empty = []; - - /** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ - function Impute(params) { - vegaDataflow.Transform.call(this, [], params); - } - - Impute.Definition = { - 'type': 'Impute', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'key', 'type': 'field', 'required': true }, - { 'name': 'keyvals', 'array': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'enum', 'default': 'value', - 'values': ['value', 'mean', 'median', 'max', 'min'] }, - { 'name': 'value', 'default': 0 } - ] - }; - - var prototype$g = vegaUtil.inherits(Impute, vegaDataflow.Transform); - - function getValue(_) { - var m = _.method || Methods.value, v; - - if (Methods[m] == null) { - vegaUtil.error('Unrecognized imputation method: ' + m); - } else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return function() { return v; }; - } else { - return Methods[m]; - } - } - - function getField(_) { - var f = _.field; - return function(t) { return t ? f(t) : NaN; }; - } - - prototype$g.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - impute = getValue(_), - field = getField(_), - fName = vegaUtil.accessorName(_.field), - kName = vegaUtil.accessorName(_.key), - gNames = (_.groupby || []).map(vegaUtil.accessorName), - groups = partition$1(pulse.source, _.groupby, _.key, _.keyvals), - curr = [], - prev = this.value, - m = groups.domain.length, - group, value, gVals, kVal, g, i, j, l, n, t; - - for (g=0, l=groups.length; g} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - function KDE(params) { - vegaDataflow.Transform.call(this, null, params); - } - - KDE.Definition = { - 'type': 'KDE', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'cumulative', 'type': 'boolean', 'default': false }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['value', 'density'] } - ] - }; - - var prototype$i = vegaUtil.inherits(KDE, vegaDataflow.Transform); - - prototype$i.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(vegaUtil.accessorName), - bandwidth = _.bandwidth, - method = _.cumulative ? 'cdf' : 'pdf', - as = _.as || ['value', 'density'], - values = []; - - let domain = _.extent, - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200; - - if (method !== 'pdf' && method !== 'cdf') { - vegaUtil.error('Invalid density method: ' + method); - } - - if (_.resolve === 'shared') { - if (!domain) domain = vegaUtil.extent(source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - - groups.forEach(g => { - const density = vegaStatistics.randomKDE(g, bandwidth)[method], - scale = _.counts ? g.length : 1, - local = domain || vegaUtil.extent(g); - - vegaStatistics.sampleCurve(density, local, minsteps, maxsteps).forEach(v => { - const t = {}; - for (let i=0; i} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ - function Key(params) { - vegaDataflow.Operator.call(this, null, update$3, params); - } - - vegaUtil.inherits(Key, vegaDataflow.Operator); - - function update$3(_) { - return (this.value && !_.modified()) ? this.value : vegaUtil.key(_.fields, _.flat); - } - - /** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ - function Load(params) { - vegaDataflow.Transform.call(this, [], params); - this._pending = null; - } - - var prototype$j = vegaUtil.inherits(Load, vegaDataflow.Transform); - - prototype$j.transform = function(_, pulse) { - const df = pulse.dataflow; - - if (this._pending) { - // update state and return pulse - return output(this, pulse, this._pending); - } - - if (stop(_)) return pulse.StopPropagation; - - if (_.values) { - // parse and ingest values, return output pulse - return output(this, pulse, df.parse(_.values, _.format)); - } else if (_.async) { - // return promise for non-blocking async loading - const p = df.request(_.url, _.format).then(res => { - this._pending = vegaUtil.array(res.data); - return df => df.touch(this); - }); - return {async: p}; - } else { - // return promise for synchronous loading - return df.request(_.url, _.format) - .then(res => output(this, pulse, vegaUtil.array(res.data))); - } - }; - - function stop(_) { - return _.modified('async') && !( - _.modified('values') || _.modified('url') || _.modified('format') - ); - } - - function output(op, pulse, data) { - data.forEach(vegaDataflow.ingest); - const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; - } - - /** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ - function Lookup(params) { - vegaDataflow.Transform.call(this, {}, params); - } - - Lookup.Definition = { - 'type': 'Lookup', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'index', 'type': 'index', 'params': [ - {'name': 'from', 'type': 'data', 'required': true }, - {'name': 'key', 'type': 'field', 'required': true } - ] }, - { 'name': 'values', 'type': 'field', 'array': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true }, - { 'name': 'default', 'default': null } - ] - }; - - var prototype$k = vegaUtil.inherits(Lookup, vegaDataflow.Transform); - - prototype$k.transform = function(_, pulse) { - var out = pulse, - as = _.as, - keys = _.fields, - index = _.index, - values = _.values, - defaultValue = _.default==null ? null : _.default, - reset = _.modified(), - flag = reset ? pulse.SOURCE : pulse.ADD, - n = keys.length, - set, m, mods; - - if (values) { - m = values.length; - - if (n > 1 && !as) { - vegaUtil.error('Multi-field lookup requires explicit "as" parameter.'); - } - if (as && as.length !== n * m) { - vegaUtil.error('The "as" parameter has too few output field names.'); - } - as = as || values.map(vegaUtil.accessorName); - - set = function(t) { - for (var i=0, k=0, j, v; i>} params.extents - The input extents. - */ - function MultiExtent(params) { - vegaDataflow.Operator.call(this, null, update$4, params); - } - - vegaUtil.inherits(MultiExtent, vegaDataflow.Operator); - - function update$4(_) { - if (this.value && !_.modified()) { - return this.value; - } - - var min = +Infinity, - max = -Infinity, - ext = _.extents, - i, n, e; - - for (i=0, n=ext.length; i max) max = e[1]; - } - return [min, max]; - } - - /** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.values - The input value arrrays. - */ - function MultiValues(params) { - vegaDataflow.Operator.call(this, null, update$5, params); - } - - vegaUtil.inherits(MultiValues, vegaDataflow.Operator); - - function update$5(_) { - return (this.value && !_.modified()) - ? this.value - : _.values.reduce(function(data, _) { return data.concat(_); }, []); - } - - /** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ - function Params(params) { - vegaDataflow.Transform.call(this, null, params); - } - - vegaUtil.inherits(Params, vegaDataflow.Transform); - - Params.prototype.transform = function(_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples - }; - - /** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ - function Pivot(params) { - Aggregate.call(this, params); - } - - Pivot.Definition = { - 'type': 'Pivot', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'value', 'type': 'field', 'required': true }, - { 'name': 'op', 'type': 'enum', 'values': ValidAggregateOps, 'default': 'sum' }, - { 'name': 'limit', 'type': 'number', 'default': 0 }, - { 'name': 'key', 'type': 'field' } - ] - }; - - var prototype$l = vegaUtil.inherits(Pivot, Aggregate); - - prototype$l._transform = prototype$l.transform; - - prototype$l.transform = function(_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); - }; - - // Shoehorn a pivot transform into an aggregate transform! - // First collect all unique pivot field values. - // Then generate aggregate fields for each output pivot field. - function aggregateParams(_, pulse) { - var key = _.field, - value = _.value, - op = (_.op === 'count' ? '__count__' : _.op) || 'sum', - fields = vegaUtil.accessorFields(key).concat(vegaUtil.accessorFields(value)), - keys = pivotKeys(key, _.limit || 0, pulse); - - // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - if (pulse.changed()) _.set('__pivot__', null, null, true); - - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(function() { return op; }), - fields: keys.map(function(k) { return get(k, key, value, fields); }), - as: keys.map(function(k) { return k + ''; }), - modified: _.modified.bind(_) - }; - } - - // Generate aggregate field accessor. - // Output NaN for non-existent values; aggregator will ignore! - function get(k, key, value, fields) { - return vegaUtil.accessor( - function(d) { return key(d) === k ? value(d) : NaN; }, - fields, - k + '' - ); - } - - // Collect (and optionally limit) all unique pivot values. - function pivotKeys(key, limit, pulse) { - var map = {}, - list = []; - - pulse.visit(pulse.SOURCE, function(t) { - var k = key(t); - if (!map[k]) { - map[k] = 1; - list.push(k); - } - }); - - // TODO? Move this comparator to vega-util? - list.sort(function(u, v) { - return (uv||v==null) && u!=null ? 1 - : ((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))!==u && v===v ? -1 - : v!==v && u===u ? 1 : 0; - }); - - return limit ? list.slice(0, limit) : list; - } - - /** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array} params.field - The field - * accessor for an array of subflow tuple objects. - */ - function PreFacet(params) { - Facet.call(this, params); - } - - const prototype$m = vegaUtil.inherits(PreFacet, Facet); - - prototype$m.transform = function(_, pulse) { - const flow = _.subflow, - field = _.field, - subflow = t => this.subflow(vegaDataflow.tupleid(t), flow, pulse, t); - - if (_.modified('field') || field && pulse.modified(vegaUtil.accessorFields(field))) { - vegaUtil.error('PreFacet does not support field modification.'); - } - - this.initTargets(); // reset list of active subflows - - if (field) { - pulse.visit(pulse.MOD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.mod(_)); - }); - - pulse.visit(pulse.ADD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.add(vegaDataflow.ingest(_))); - }); - - pulse.visit(pulse.REM, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.rem(_)); - }); - } else { - pulse.visit(pulse.MOD, t => subflow(t).mod(t)); - pulse.visit(pulse.ADD, t => subflow(t).add(t)); - pulse.visit(pulse.REM, t => subflow(t).rem(t)); - } - - if (pulse.clean()) { - pulse.runAfter(() => this.clean()); - } - - return pulse; - }; - - /** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ - function Project(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Project.Definition = { - 'type': 'Project', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true } - ] - }; - - var prototype$n = vegaUtil.inherits(Project, vegaDataflow.Transform); - - prototype$n.transform = function(_, pulse) { - var fields = _.fields, - as = fieldNames(_.fields, _.as || []), - derive = fields - ? function(s, t) { return project(s, t, fields, as); } - : vegaDataflow.rederive, - out, lut; - - if (this.value) { - lut = this.value; - } else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - - out = pulse.fork(pulse.NO_SOURCE); - - pulse.visit(pulse.REM, function(t) { - var id = vegaDataflow.tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, function(t) { - var dt = derive(t, vegaDataflow.ingest({})); - lut[vegaDataflow.tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, function(t) { - out.mod.push(derive(t, lut[vegaDataflow.tupleid(t)])); - }); - - return out; - }; - - function project(s, t, fields, as) { - for (var i=0, n=fields.length; i} [params.groupby] - An array of accessors - * to groupby. - * @param {Array} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ - function Quantile(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Quantile.Definition = { - 'type': 'Quantile', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'probs', 'type': 'number', 'array': true }, - { 'name': 'step', 'type': 'number', 'default': 0.01 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['prob', 'value'] } - ] - }; - - var prototype$p = vegaUtil.inherits(Quantile, vegaDataflow.Transform); - - var EPSILON$1 = 1e-14; - - prototype$p.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - as = _.as || ['prob', 'value']; - - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(vegaUtil.accessorName), - values = [], - step = _.step || 0.01, - p = _.probs || d3Array.range(step/2, 1 - EPSILON$1, step), - n = p.length; - - groups.forEach(g => { - const q = vegaStatistics.quantiles(g, p); - - for (let i=0; i { - var id = vegaDataflow.tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, t => { - var dt = vegaDataflow.derive(t); - lut[vegaDataflow.tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, t => { - var dt = lut[vegaDataflow.tupleid(t)], k; - for (k in t) { - dt[k] = t[k]; - // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - out.modifies(k); - } - out.mod.push(dt); - }); - } - - return out; - }; - - /** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ - function Sample(params) { - vegaDataflow.Transform.call(this, [], params); - this.count = 0; - } - - Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [ - { 'name': 'size', 'type': 'number', 'default': 1000 } - ] - }; - - var prototype$r = vegaUtil.inherits(Sample, vegaDataflow.Transform); - - prototype$r.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - mod = _.modified('size'), - num = _.size, - res = this.value, - cnt = this.count, - cap = 0, - map = res.reduce(function(m, t) { - m[vegaDataflow.tupleid(t)] = 1; - return m; - }, {}); - - // sample reservoir update function - function update(t) { - var p, idx; - - if (res.length < num) { - res.push(t); - } else { - idx = ~~((cnt + 1) * vegaStatistics.random()); - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[vegaDataflow.tupleid(p)]) out.rem.push(p); // eviction - res[idx] = t; - } - } - ++cnt; - } - - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, function(t) { - var id = vegaDataflow.tupleid(t); - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - --cnt; - }); - - // filter removed tuples out of the sample reservoir - res = res.filter(function(t) { return map[vegaDataflow.tupleid(t)] !== -1; }); - } - - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, function(t) { - // update, but skip previously sampled tuples - if (!map[vegaDataflow.tupleid(t)]) update(t); - }); - cap = -1; - } - - if (mod && res.length > num) { - for (var i=0, n=res.length-num; i max) max = b; - } - }); - - floor.start = min; - floor.stop = max; - - return pulse.modifies(band ? as : u0); - }; - - prototype$u._floor = function(_, pulse) { - const utc = _.timezone === 'utc'; - - // get parameters - let {units, step} = _.units - ? {units: _.units, step: _.step || 1} - : vegaTime.timeBin({ - extent: _.extent || vegaUtil.extent(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }); - - // check / standardize time units - units = vegaTime.timeUnits(units); - - const prev = this.value || {}, - floor = (utc ? vegaTime.utcFloor : vegaTime.timeFloor)(units, step); - - floor.unit = vegaUtil.peek(units); - floor.units = units; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; - }; - - /** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ - function TupleIndex(params) { - vegaDataflow.Transform.call(this, vegaUtil.fastmap(), params); - } - - var prototype$v = vegaUtil.inherits(TupleIndex, vegaDataflow.Transform); - - prototype$v.transform = function(_, pulse) { - var df = pulse.dataflow, - field = _.field, - index = this.value, - mod = true; - - function set(t) { index.set(field(t), t); } - - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, function(t) { index.delete(field(t)); }); - pulse.visit(pulse.ADD, set); - } else { - mod = false; - } - - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); - }; - - /** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ - function Values(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype$w = vegaUtil.inherits(Values, vegaDataflow.Transform); - - prototype$w.transform = function(_, pulse) { - var run = !this.value - || _.modified('field') - || _.modified('sort') - || pulse.changed() - || (_.sort && pulse.modified(_.sort.fields)); - - if (run) { - this.value = (_.sort - ? pulse.source.slice().sort(vegaDataflow.stableCompare(_.sort)) - : pulse.source).map(_.field); - } - }; - - function WindowOp(op, field, param, as) { - let fn = WindowOps[op](field, param); - return { - init: fn.init || vegaUtil.zero, - update: function(w, t) { t[as] = fn.next(w); } - }; - } - - const WindowOps = { - row_number: function() { - return { - next: w => w.index + 1 - }; - }, - rank: function() { - let rank; - return { - init: () => rank = 1, - next: w => { - let i = w.index, - data = w.data; - return (i && w.compare(data[i - 1], data[i])) ? (rank = i + 1) : rank; - } - }; - }, - dense_rank: function() { - let drank; - return { - init: () => drank = 1, - next: w => { - let i = w.index, - d = w.data; - return (i && w.compare(d[i - 1], d[i])) ? ++drank : drank; - } - }; - }, - percent_rank: function() { - let rank = WindowOps.rank(), - next = rank.next; - return { - init: rank.init, - next: w => (next(w) - 1) / (w.data.length - 1) - }; - }, - cume_dist: function() { - let cume; - return { - init: () => cume = 0, - next: w => { - let i = w.index, - d = w.data, - c = w.compare; - if (cume < i) { - while (i + 1 < d.length && !c(d[i], d[i + 1])) ++i; - cume = i; - } - return (1 + cume) / d.length; - } - }; - }, - ntile: function(field, num) { - num = +num; - if (!(num > 0)) vegaUtil.error('ntile num must be greater than zero.'); - let cume = WindowOps.cume_dist(), - next = cume.next; - return { - init: cume.init, - next: w => Math.ceil(num * next(w)) - }; - }, - - lag: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index + offset, - d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - - first_value: function(field) { - return { - next: w => field(w.data[w.i0]) - }; - }, - last_value: function(field) { - return { - next: w => field(w.data[w.i1 - 1]) - }; - }, - nth_value: function(field, nth) { - nth = +nth; - if (!(nth > 0)) vegaUtil.error('nth_value nth must be greater than zero.'); - return { - next: w => { - let i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - - prev_value: function(field) { - let prev; - return { - init: () => prev = null, - next: w => { - let v = field(w.data[w.index]); - return v != null ? (prev = v) : prev; - } - }; - }, - next_value: function(field) { - let v, i; - return { - init: () => (v = null, i = -1), - next: w => { - let d = w.data; - return w.index <= i ? v - : (i = find(field, d, w.index)) < 0 - ? (i = d.length, v = null) - : (v = field(d[i])); - } - }; - } - }; - - function find(field, data, index) { - for (let n = data.length; index < n; ++index) { - let v = field(data[index]); - if (v != null) return index; - } - return -1; - } - - var ValidWindowOps = Object.keys(WindowOps); - - function WindowState(_) { - let self = this, - ops = vegaUtil.array(_.ops), - fields = vegaUtil.array(_.fields), - params = vegaUtil.array(_.params), - as = vegaUtil.array(_.as), - outputs = self.outputs = [], - windows = self.windows = [], - inputs = {}, - map = {}, - countOnly = true, - counts = [], - measures = []; - - function visitInputs(f) { - vegaUtil.array(vegaUtil.accessorFields(f)).forEach(_ => inputs[_] = 1); - } - visitInputs(_.sort); - - ops.forEach(function(op, i) { - let field = fields[i], - mname = vegaUtil.accessorName(field), - name = measureName(op, mname, as[i]); - - visitInputs(field); - outputs.push(name); - - // Window operation - if (vegaUtil.hasOwnProperty(WindowOps, op)) { - windows.push(WindowOp(op, fields[i], params[i], name)); - } - - // Aggregate operation - else { - if (field == null && op !== 'count') { - vegaUtil.error('Null aggregate field specified.'); - } - if (op === 'count') { - counts.push(name); - return; - } - - countOnly = false; - let m = map[mname]; - if (!m) { - m = (map[mname] = []); - m.field = field; - measures.push(m); - } - m.push(createMeasure(op, name)); - } - }); - - if (counts.length || measures.length) { - self.cell = cell(measures, counts, countOnly); - } - - self.inputs = Object.keys(inputs); - } - - const prototype$x = WindowState.prototype; - - prototype$x.init = function() { - this.windows.forEach(_ => _.init()); - if (this.cell) this.cell.init(); - }; - - prototype$x.update = function(w, t) { - let self = this, - cell = self.cell, - wind = self.windows, - data = w.data, - m = wind && wind.length, - j; - - if (cell) { - for (j=w.p0; j compileMeasures(m, m.field)); - - let cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - - if (!countOnly) { - var n = measures.length, - a = cell.agg = Array(n), - i = 0; - for (; i} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array} params.ops - An array of strings indicating window operations to perform. - * @param {Array} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array} [params.as] - An array of output field names for window operations. - * @param {Array} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ - function Window(params) { - vegaDataflow.Transform.call(this, {}, params); - this._mlen = 0; - this._mods = []; - } - - Window.Definition = { - 'type': 'Window', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidWindowOps.concat(ValidAggregateOps) }, - { 'name': 'params', 'type': 'number', 'null': true, 'array': true }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'frame', 'type': 'number', 'null': true, 'array': true, 'length': 2, 'default': [null, 0] }, - { 'name': 'ignorePeers', 'type': 'boolean', 'default': false } - ] - }; - - var prototype$y = vegaUtil.inherits(Window, vegaDataflow.Transform); - - prototype$y.transform = function(_, pulse) { - var self = this, - state = self.state, - mod = _.modified(), - cmp = vegaDataflow.stableCompare(_.sort), - i, n; - - this.stamp = pulse.stamp; - - // initialize window state - if (!state || mod) { - state = self.state = new WindowState(_); - } - - // retrieve group for a tuple - var key = groupkey(_.groupby); - function group(t) { return self.group(key(t)); } - - // partition input tuples - if (mod || pulse.modified(state.inputs)) { - self.value = {}; - pulse.visit(pulse.SOURCE, function(t) { group(t).add(t); }); - } else { - pulse.visit(pulse.REM, function(t) { group(t).remove(t); }); - pulse.visit(pulse.ADD, function(t) { group(t).add(t); }); - } - - // perform window calculations for each modified partition - for (i=0, n=self._mlen; i 0 && !c(d[r0], d[r0-1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1+1])) w.i1 = bisect.right(d, d[r1]); - } - - exports.aggregate = Aggregate; - exports.bin = Bin; - exports.collect = Collect; - exports.compare = Compare; - exports.countpattern = CountPattern; - exports.cross = Cross; - exports.density = Density; - exports.dotbin = DotBin; - exports.expression = Expression; - exports.extent = Extent; - exports.facet = Facet; - exports.field = Field; - exports.filter = Filter; - exports.flatten = Flatten; - exports.fold = Fold; - exports.formula = Formula; - exports.generate = Generate; - exports.impute = Impute; - exports.joinaggregate = JoinAggregate; - exports.kde = KDE; - exports.key = Key; - exports.load = Load; - exports.lookup = Lookup; - exports.multiextent = MultiExtent; - exports.multivalues = MultiValues; - exports.params = Params; - exports.pivot = Pivot; - exports.prefacet = PreFacet; - exports.project = Project; - exports.proxy = Proxy; - exports.quantile = Quantile; - exports.relay = Relay; - exports.sample = Sample; - exports.sequence = Sequence; - exports.sieve = Sieve; - exports.subflow = Subflow; - exports.timeunit = TimeUnit; - exports.tupleindex = TupleIndex; - exports.values = Values; - exports.window = Window; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-transforms/build/vega-transforms.min.js b/node_modules/vega-transforms/build/vega-transforms.min.js deleted file mode 100644 index 259c5f9..0000000 --- a/node_modules/vega-transforms/build/vega-transforms.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-dataflow"),require("vega-statistics"),require("d3-array"),require("vega-time")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-dataflow","vega-statistics","d3-array","vega-time"],t):t(((e=e||self).vega=e.vega||{},e.vega.transforms={}),e.vega,e.vega,e.vega,e.d3,e.vega)}(this,(function(e,t,n,i,a,r){"use strict";function s(e){return e&&e.length?1===e.length?e[0]:(t=e,function(e){for(var n=t.length,i=1,a=String(t[0](e));i{},l={init:o,add:o,rem:o,idx:0},d={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.sum,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||void 0===e.max)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3}},f=Object.keys(d);function m(e,t){return d[e](t)}function c(e,t){return e.idx-t.idx}function h(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.init(this))}function p(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t))):++this.missing}function v(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t))):--this.missing}function g(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function y(e,n){var i=n||t.identity,a=function(e){const t={};e.forEach(e=>t[e.name]=e);const n=e=>{e.req&&e.req.forEach(e=>{t[e]||n(t[e]=d[e]())})};return e.forEach(n),Object.values(t).sort(c)}(e),r=e.slice().sort(c);function s(e){this._ops=a,this._out=r,this.cell=e,this.init()}return s.prototype.init=h,s.prototype.add=p,s.prototype.rem=v,s.prototype.set=g,s.prototype.get=i,s.fields=e.map(e=>e.out),s}function _(e){this._key=e?t.field(e):n.tupleid,this.reset()}f.forEach(e=>{d[e]=function(e,n){return i=>t.extend({name:e,out:i||e},l,n)}(e,d[e])});var x=_.prototype;function b(e){n.Transform.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}x.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},x.add=function(e){this._add.push(e)},x.rem=function(e){this._rem.push(e)},x.values=function(){if(this._get=null,0===this._rem.length)return this._add;var e,t,n,i=this._add,a=this._rem,r=this._key,s=i.length,u=a.length,o=Array(s-u),l={};for(e=0;e=0;)n=e(i[a])+"",t.hasOwnProperty(r,n)||(r[n]=1,++s);return s},x.extent=function(e){if(this._get!==e||!this._ext){var n=this.values(),i=t.extentIndex(n,e);this._ext=[n[i[0]],n[i[1]]],this._get=e}return this._ext},x.argmin=function(e){return this.extent(e)[0]||{}},x.argmax=function(e){return this.extent(e)[1]||{}},x.min=function(e){var t=this.extent(e)[0];return null!=t?e(t):void 0},x.max=function(e){var t=this.extent(e)[1];return null!=t?e(t):void 0},x.quartile=function(e){return this._get===e&&this._q||(this._q=i.quartiles(this.values(),e),this._get=e),this._q},x.q1=function(e){return this.quartile(e)[0]},x.q2=function(e){return this.quartile(e)[1]},x.q3=function(e){return this.quartile(e)[2]},x.ci=function(e){return this._get===e&&this._ci||(this._ci=i.bootstrapCI(this.values(),1e3,.05,e),this._get=e),this._ci},x.ci0=function(e){return this.ci(e)[0]},x.ci1=function(e){return this.ci(e)[1]},b.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:f},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};var O=t.inherits(b,n.Transform);O.transform=function(e,t){var n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),a=e.modified();return n.stamp=i.stamp,n.value&&(a||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=a?n.init(e):{},t.visit(t.SOURCE,e=>n.add(e))):(n.value=n.value||n.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),i.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter(()=>this.clean()),n.changes(i)},O.cross=function(){var e=this,t=e.value,n=e._dnames,i=n.map((function(){return{}})),a=n.length;function r(e){var t,r,s,u;for(t in e)for(s=e[t].tuple,r=0;rl?1/0:(n=Math.max(o,Math.min(n,l-u)),o+u*Math.floor(1e-14+(n-o)/u))};return d.start=o,d.stop=s.stop,d.step=u,this.value=t.accessor(d,t.accessorFields(r),e.name||"bin_"+t.accessorName(r))},q.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},t.inherits(q,n.Transform).transform=function(e,t){var i=t.fork(t.ALL),a=k(n.tupleid,this.value,i.materialize(i.ADD).add),r=e.sort,s=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return i.visit(i.REM,a.remove),this.modified(s),this.value=i.source=a.data(n.stableCompare(r),s),t.source&&t.source.root&&(this.value.root=t.source.root),i},t.inherits(T,n.Operator),w.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};var R=t.inherits(w,n.Transform);function S(e){n.Transform.call(this,null,e)}R.transform=function(e,t){function n(t){return function(n){for(var i,a=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(u(n),e.case,r)||[],o=0,l=a.length;o{var t={};return t[d[0]]=e[0],t[d[1]]=e[1],n.ingest(t)});this.value&&(r.rem=this.value),this.value=r.add=r.source=m}return r};function L(e){n.Transform.call(this,null,e)}L.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function I(e){n.Operator.call(this,null,P,e),this.modified(!0)}function P(e){var n=e.expr;return this.value&&!e.modified("expr")?this.value:t.accessor(t=>n(t,e),t.accessorFields(n),t.accessorName(n))}function j(e){n.Transform.call(this,[void 0,void 0],e)}function $(e,t){n.Operator.call(this,e),this.parent=t,this.count=0}t.inherits(L,n.Transform).transform=function(e,a){if(this.value&&!e.modified()&&!a.changed())return a;const r=a.materialize(a.SOURCE).source,s=z(a.source,e.groupby,t.identity),u=e.smooth||!1,o=e.field,l=e.step||function(e,n){return t.span(t.extent(e,n))/30}(r,o),d=n.stableCompare((e,t)=>o(e)-o(t)),f=e.as||"bin",m=s.length;let c,h=1/0,p=-1/0,v=0;for(;vp&&(p=t),e[++c][f]=t}return this.value={start:h,stop:p,step:l},a.reflow(!0).modifies(f)},t.inherits(I,n.Operator),j.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},t.inherits(j,n.Transform).transform=function(e,n){var i,a=this.value,r=e.field,s=a[0],u=a[1];if(((i=n.changed()||n.modified(r.fields)||e.modified("field"))||null==s)&&(s=1/0,u=-1/0),n.visit(i?n.SOURCE:n.ADD,(function(e){var n=t.toNumber(r(e));null!=n&&(nu&&(u=n))})),!Number.isFinite(s)||!Number.isFinite(u)){let e=t.accessorName(r);e&&(e=` for field "${e}"`),n.dataflow.warn(`Infinite extent${e}: [${s}, ${u}]`),s=u=void 0}this.value=[s,u]};var B=t.inherits($,n.Operator);function K(e){n.Transform.call(this,{},e),this._keys=t.fastmap();const i=this._targets=[];i.active=0,i.forEach=e=>{for(let t=0,n=i.active;tthis.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,e=>{const t=n.tupleid(e),i=s.get(t);void 0!==i&&(s.delete(t),o(i).rem(e))}),t.visit(t.ADD,e=>{const t=a(e);s.set(n.tupleid(e),t),o(t).add(e)}),u||t.modified(a.fields)?t.visit(t.MOD,e=>{const t=n.tupleid(e),i=s.get(t),r=a(e);i===r?o(r).mod(e):(s.set(t,r),o(i).rem(e),o(r).add(e))}):t.changed(t.MOD)&&t.visit(t.MOD,e=>{o(s.get(n.tupleid(e))).mod(e)}),u&&t.visit(t.REFLOW,e=>{const t=n.tupleid(e),i=s.get(t),r=a(e);i!==r&&(s.set(t,r),o(i).rem(e),o(r).add(e))}),t.clean()?i.runAfter(()=>{this.clean(),s.clean()}):s.empty>i.cleanThreshold&&i.runAfter(s.clean),t},t.inherits(J,n.Operator),G.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},t.inherits(G,n.Transform).transform=function(e,t){var i=t.dataflow,a=this.value,r=t.fork(),s=r.add,u=r.rem,o=r.mod,l=e.expr,d=!0;function f(t){var i=n.tupleid(t),r=l(t,e),f=a.get(i);r&&f?(a.delete(i),s.push(t)):r||f?d&&r&&!f&&o.push(t):(a.set(i,1),u.push(t))}return t.visit(t.REM,(function(e){var t=n.tupleid(e);a.has(t)?a.delete(t):u.push(e)})),t.visit(t.ADD,(function(t){l(t,e)?s.push(t):a.set(n.tupleid(t),1)})),t.visit(t.MOD,f),e.modified()&&(d=!1,t.visit(t.REFLOW,f)),a.empty>i.cleanThreshold&&i.runAfter(a.clean),r},H.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},t.inherits(H,n.Transform).transform=function(e,t){var i=t.fork(t.NO_SOURCE),a=e.fields,r=F(a,e.as||[]),s=e.index||null,u=r.length;return i.rem=this.value,t.visit(t.SOURCE,(function(e){for(var t,o,l,d=a.map(t=>t(e)),f=d.reduce((e,t)=>Math.max(e,t.length),0),m=0;mt[i]=n(t,e))},t.inherits(Y,n.Transform).transform=function(e,t){var i,a,r,s=this.value,u=t.fork(t.ALL),o=e.size-s.length,l=e.generator;if(o>0){for(i=[];--o>=0;)i.push(r=n.ingest(l(e))),s.push(r);u.add=u.add.length?u.materialize(u.ADD).add.concat(i):i}else a=s.slice(0,-o),u.rem=u.rem.length?u.materialize(u.REM).rem.concat(a):a,s=s.slice(-o);return u.source=this.value=s,u};var Z={value:"value",median:a.median,mean:a.mean,min:a.min,max:a.max},ee=[];function te(e){n.Transform.call(this,[],e)}function ne(e){b.call(this,e)}te.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},t.inherits(te,n.Transform).transform=function(e,i){var a,r,s,u,o,l,d,f,m,c,h=i.fork(i.ALL),p=function(e){var n,i=e.method||Z.value;if(null!=Z[i])return i===Z.value?(n=void 0!==e.value?e.value:0,function(){return n}):Z[i];t.error("Unrecognized imputation method: "+i)}(e),v=function(e){var t=e.field;return function(e){return e?t(e):NaN}}(e),g=t.accessorName(e.field),y=t.accessorName(e.key),_=(e.groupby||[]).map(t.accessorName),x=function(e,t,n,i){var a,r,s,u,o,l,d,f,m=function(e){return e(f)},c=[],h=i?i.slice():[],p={},v={};for(h.forEach((function(e,t){p[e]=t+1})),u=0,d=e.length;ur&&(r=i[1]);return[a,r]}function me(e){n.Operator.call(this,null,ce,e)}function ce(e){return this.value&&!e.modified()?this.value:e.values.reduce((function(e,t){return e.concat(t)}),[])}function he(e){n.Transform.call(this,null,e)}function pe(e){b.call(this,e)}ie.transform=function(e,n){var i,a=this,r=e.modified();return a.value&&(r||n.modified(a._inputs,!0))?(i=a.value=r?a.init(e):{},n.visit(n.SOURCE,(function(e){a.add(e)}))):(i=a.value=a.value||this.init(e),n.visit(n.REM,(function(e){a.rem(e)})),n.visit(n.ADD,(function(e){a.add(e)}))),a.changes(),n.visit(n.SOURCE,(function(e){t.extend(e,i[a.cellkey(e)].tuple)})),n.reflow(r).modifies(this._outputs)},ie.changes=function(){var e,t,n=this._adds,i=this._mods;for(e=0,t=this._alen;e{const r=i.randomKDE(a,l)[d],s=e.counts?a.length:1,u=c||t.extent(a);i.sampleCurve(r,u,h,p).forEach(e=>{const t={};for(let e=0;e(this._pending=t.array(e.data),e=>e.touch(this)))}}return i.request(e.url,e.format).then(e=>oe(this,n,t.array(e.data)))},le.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},t.inherits(le,n.Transform).transform=function(e,n){var i,a,r=n,s=e.as,u=e.fields,o=e.index,l=e.values,d=null==e.default?null:e.default,f=e.modified(),m=f?n.SOURCE:n.ADD,c=u.length;return l?(a=l.length,c>1&&!s&&t.error('Multi-field lookup requires explicit "as" parameter.'),s&&s.length!==c*a&&t.error('The "as" parameter has too few output field names.'),s=s||l.map(t.accessorName),i=function(e){for(var t,n,i=0,r=0;it||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0)})),t?a.slice(0,t):a}(i,e.limit||0,n);n.changed()&&e.set("__pivot__",null,null,!0);return{key:e.key,groupby:e.groupby,ops:u.map((function(){return r})),fields:u.map((function(e){return function(e,n,i,a){return t.accessor((function(t){return n(t)===e?i(t):NaN}),a,e+"")}(e,i,a,s)})),as:u.map((function(e){return e+""})),modified:e.modified.bind(e)}}(e,n),n)};function ye(e){n.Transform.call(this,null,e)}function _e(e){n.Transform.call(this,null,e)}function xe(e){n.Transform.call(this,null,e)}t.inherits(ge,K).transform=function(e,i){const a=e.subflow,r=e.field,s=e=>this.subflow(n.tupleid(e),a,i,e);return(e.modified("field")||r&&i.modified(t.accessorFields(r)))&&t.error("PreFacet does not support field modification."),this.initTargets(),r?(i.visit(i.MOD,e=>{const t=s(e);r(e).forEach(e=>t.mod(e))}),i.visit(i.ADD,e=>{const t=s(e);r(e).forEach(e=>t.add(n.ingest(e)))}),i.visit(i.REM,e=>{const t=s(e);r(e).forEach(e=>t.rem(e))})):(i.visit(i.MOD,e=>s(e).mod(e)),i.visit(i.ADD,e=>s(e).add(e)),i.visit(i.REM,e=>s(e).rem(e))),i.clean()&&i.runAfter(()=>this.clean()),i},ye.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},t.inherits(ye,n.Transform).transform=function(e,t){var i,a,r=e.fields,s=F(e.fields,e.as||[]),u=r?function(e,t){return function(e,t,n,i){for(var a=0,r=n.length;a{const t=i.quantiles(e,m);for(let i=0;i{var t=n.tupleid(e);i.rem.push(a[t]),a[t]=null}),t.visit(t.ADD,e=>{var t=n.derive(e);a[n.tupleid(e)]=t,i.add.push(t)}),t.visit(t.MOD,e=>{var t,r=a[n.tupleid(e)];for(t in e)r[t]=e[t],i.modifies(t);i.mod.push(r)})),i},De.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},t.inherits(De,n.Transform).transform=function(e,t){var a=t.fork(t.NO_SOURCE),r=e.modified("size"),s=e.size,u=this.value,o=this.count,l=0,d=u.reduce((function(e,t){return e[n.tupleid(t)]=1,e}),{});function f(e){var t,r;u.length=l&&(t=u[r],d[n.tupleid(t)]&&a.rem.push(t),u[r]=e),++o}if(t.rem.length&&(t.visit(t.REM,(function(e){var t=n.tupleid(e);d[t]&&(d[t]=-1,a.rem.push(e)),--o})),u=u.filter((function(e){return-1!==d[n.tupleid(e)]}))),(t.rem.length||r)&&u.lengths){for(var m=0,c=u.length-s;mc&&(c=n))})),u.start=m,u.stop=c,n.modifies(a?l:d)},Ne._floor=function(e,n){const i="utc"===e.timezone;let{units:a,step:s}=e.units?{units:e.units,step:e.step||1}:r.timeBin({extent:e.extent||t.extent(n.materialize(n.SOURCE).source,e.field),maxbins:e.maxbins});a=r.timeUnits(a);const u=this.value||{},o=(i?r.utcFloor:r.timeFloor)(a,s);return o.unit=t.peek(a),o.units=a,o.step=s,o.start=u.start,o.stop=u.stop,this.value=o},t.inherits(we,n.Transform).transform=function(e,t){var n=t.dataflow,i=e.field,a=this.value,r=!0;function s(e){a.set(i(e),e)}return e.modified("field")||t.modified(i.fields)?(a.clear(),t.visit(t.SOURCE,s)):t.changed()?(t.visit(t.REM,(function(e){a.delete(i(e))})),t.visit(t.ADD,s)):r=!1,this.modified(r),a.empty>n.cleanThreshold&&n.runAfter(a.clean),t.fork()},t.inherits(Re,n.Transform).transform=function(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(n.stableCompare(e.sort)):t.source).map(e.field))};const Se={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){let e=Se.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{let n=t.index,i=t.data,a=t.compare;if(e0||t.error("ntile num must be greater than zero.");let i=Se.cume_dist(),a=i.next;return{init:i.init,next:e=>Math.ceil(n*a(e))}},lag:function(e,t){return t=+t||1,{next:n=>{let i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{let i=n.index+t,a=n.data;return ie(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,n){return(n=+n)>0||t.error("nth_value nth must be greater than zero."),{next:t=>{let i=t.i0+(n-1);return it=null,next:n=>{let i=e(n.data[n.index]);return null!=i?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{let a=i.data;return i.index<=n?t:(n=function(e,t,n){for(let i=t.length;nd[e]=1)}v(e.sort),i.forEach((function(e,n){let i=a[n],d=t.accessorName(i),g=u(e,d,s[n]);if(v(i),o.push(g),t.hasOwnProperty(Se,e))l.push(function(e,n,i,a){let r=Se[e](n,i);return{init:r.init||t.zero,update:function(e,t){t[a]=r.next(e)}}}(e,a[n],r[n],g));else{if(null==i&&"count"!==e&&t.error("Null aggregate field specified."),"count"===e)return void h.push(g);c=!1;let n=f[d];n||(n=f[d]=[],n.field=i,p.push(n)),n.push(m(e,g))}})),(h.length||p.length)&&(n.cell=function(e,t,n){e=e.map(e=>y(e,e.field));let i={num:0,agg:null,store:!1,count:t};if(!n)for(var a=e.length,r=i.agg=Array(a),s=0;se.init()),this.cell&&this.cell.init()},Ue.update=function(e,t){let n,i=this.cell,a=this.windows,r=e.data,s=a&&a.length;if(i){for(n=e.p0;n0&&!a(r[n],r[n-1])&&(e.i0=t.left(r,r[n])),i} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.fields] - An array of accessors to aggregate. - * @param {Array} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ -export default function Aggregate(params) { - Transform.call(this, null, params); - - this._adds = []; // array of added output tuples - this._mods = []; // array of modified output tuples - this._alen = 0; // number of active added tuples - this._mlen = 0; // number of active modified tuples - this._drop = true; // should empty aggregation cells be removed - this._cross = false; // produce full cross-product of group-by values - - this._dims = []; // group-by dimension accessors - this._dnames = []; // group-by dimension names - - this._measures = []; // collection of aggregation monoids - this._countOnly = false; // flag indicating only count aggregation - this._counts = null; // collection of count fields - this._prev = null; // previous aggregation cells - - this._inputs = null; // array of dependent input tuple field names - this._outputs = null; // array of output tuple field names -} - -Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidAggregateOps }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'drop', 'type': 'boolean', 'default': true }, - { 'name': 'cross', 'type': 'boolean', 'default': false }, - { 'name': 'key', 'type': 'field' } - ] -}; - -var prototype = inherits(Aggregate, Transform); - -prototype.transform = function(_, pulse) { - var aggr = this, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - mod = _.modified(); - - aggr.stamp = out.stamp; - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, t => aggr.add(t)); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, t => aggr.rem(t)); - pulse.visit(pulse.ADD, t => aggr.add(t)); - } - - // Indicate output fields and return aggregate tuples. - out.modifies(aggr._outputs); - - // Should empty cells be dropped? - aggr._drop = _.drop !== false; - - // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - - if (pulse.clean() && aggr._drop) { - out.clean(true).runAfter(() => this.clean()); - } - - return aggr.changes(out); -}; - -prototype.cross = function() { - var aggr = this, - curr = aggr.value, - dims = aggr._dnames, - vals = dims.map(function() { return {}; }), - n = dims.length; - - // collect all group-by domain values - function collect(cells) { - var key, i, t, v; - for (key in cells) { - t = cells[key].tuple; - for (i=0; i stop ? +Infinity - : ( - v = Math.max(start, Math.min(v, stop - step)), - start + step * Math.floor(EPSILON + (v - start) / step) - ); - }; - - f.start = start; - f.stop = bins.stop; - f.step = step; - - return this.value = accessor( - f, - accessorFields(field), - _.name || 'bin_' + accessorName(field) - ); -}; diff --git a/node_modules/vega-transforms/src/Collect.js b/node_modules/vega-transforms/src/Collect.js deleted file mode 100644 index c2490bf..0000000 --- a/node_modules/vega-transforms/src/Collect.js +++ /dev/null @@ -1,44 +0,0 @@ -import SortedList from './util/SortedList'; -import {Transform, stableCompare, tupleid} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ -export default function Collect(params) { - Transform.call(this, [], params); -} - -Collect.Definition = { - 'type': 'Collect', - 'metadata': {'source': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' } - ] -}; - -var prototype = inherits(Collect, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), - sort = _.sort, - mod = pulse.changed() || (sort && - (_.modified('sort') || pulse.modified(sort.fields))); - - out.visit(out.REM, list.remove); - - this.modified(mod); - this.value = out.source = list.data(stableCompare(sort), mod); - - // propagate tree root if defined - if (pulse.source && pulse.source.root) { - this.value.root = pulse.source.root; - } - - return out; -}; diff --git a/node_modules/vega-transforms/src/Compare.js b/node_modules/vega-transforms/src/Compare.js deleted file mode 100644 index 7bf6969..0000000 --- a/node_modules/vega-transforms/src/Compare.js +++ /dev/null @@ -1,22 +0,0 @@ -import {Operator} from 'vega-dataflow'; -import {compare, inherits} from 'vega-util'; - -/** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The fields to compare. - * @param {Array} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ -export default function Compare(params) { - Operator.call(this, null, update, params); -} - -inherits(Compare, Operator); - -function update(_) { - return (this.value && !_.modified()) - ? this.value - : compare(_.fields, _.orders); -} diff --git a/node_modules/vega-transforms/src/CountPattern.js b/node_modules/vega-transforms/src/CountPattern.js deleted file mode 100644 index 93b12cc..0000000 --- a/node_modules/vega-transforms/src/CountPattern.js +++ /dev/null @@ -1,116 +0,0 @@ -import {Transform, ingest} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ -export default function CountPattern(params) { - Transform.call(this, null, params); -} - -CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'case', 'type': 'enum', 'values': ['upper', 'lower', 'mixed'], 'default': 'mixed' }, - { 'name': 'pattern', 'type': 'string', 'default': '[\\w"]+' }, - { 'name': 'stopwords', 'type': 'string', 'default': '' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['text', 'count'] } - ] -}; - -function tokenize(text, tcase, match) { - switch (tcase) { - case 'upper': text = text.toUpperCase(); break; - case 'lower': text = text.toLowerCase(); break; - } - return text.match(match); -} - -var prototype = inherits(CountPattern, Transform); - -prototype.transform = function(_, pulse) { - function process(update) { - return function(tuple) { - var tokens = tokenize(get(tuple), _.case, match) || [], t; - for (var i=0, n=tokens.length; i} [params.as] - The names of the output fields. - */ -export default function Cross(params) { - Transform.call(this, null, params); -} - -Cross.Definition = { - 'type': 'Cross', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'filter', 'type': 'expr' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['a', 'b'] } - ] -}; - -var prototype = inherits(Cross, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - data = this.value, - as = _.as || ['a', 'b'], - a = as[0], b = as[1], - reset = !data - || pulse.changed(pulse.ADD_REM) - || _.modified('as') - || _.modified('filter'); - - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || truthy); - } else { - out.mod = data; - } - - out.source = this.value; - return out.modifies(as); -}; - -function cross(input, a, b, filter) { - var data = [], - t = {}, - n = input.length, - i = 0, - j, left; - - for (; i} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ -export default function Density(params) { - Transform.call(this, null, params); -} - -var distributions = [ - { - 'key': {'function': 'normal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'lognormal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'uniform'}, - 'params': [ - { 'name': 'min', 'type': 'number', 'default': 0 }, - { 'name': 'max', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'kde'}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'from', 'type': 'data' }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 } - ] - } -]; - -var mixture = { - 'key': {'function': 'mixture'}, - 'params': [ - { 'name': 'distributions', 'type': 'param', 'array': true, - 'params': distributions }, - { 'name': 'weights', 'type': 'number', 'array': true } - ] -}; - -Density.Definition = { - 'type': 'Density', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'method', 'type': 'string', 'default': 'pdf', - 'values': ['pdf', 'cdf'] }, - { 'name': 'distribution', 'type': 'param', - 'params': distributions.concat(mixture) }, - { 'name': 'as', 'type': 'string', 'array': true, - 'default': ['value', 'density'] } - ] -}; - -var prototype = inherits(Density, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var dist = parseDist(_.distribution, source(pulse)), - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200, - method = _.method || 'pdf'; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - if (!_.extent && !dist.data) { - error('Missing density extent parameter.'); - } - method = dist[method]; - - var as = _.as || ['value', 'density'], - domain = _.extent || extent(dist.data()), - values = sampleCurve(method, domain, minsteps, maxsteps).map(v => { - var tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return ingest(tuple); - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; -}; - -function source(pulse) { - return function() { return pulse.materialize(pulse.SOURCE).source; }; -} diff --git a/node_modules/vega-transforms/src/DotBin.js b/node_modules/vega-transforms/src/DotBin.js deleted file mode 100644 index 99a591b..0000000 --- a/node_modules/vega-transforms/src/DotBin.js +++ /dev/null @@ -1,75 +0,0 @@ -import {partition} from './util/util'; -import {Transform, stableCompare} from 'vega-dataflow'; -import {dotbin} from 'vega-statistics'; -import {extent, identity, inherits, span} from 'vega-util'; - -const Output = 'bin'; - -/** - * Dot density binning for dot plot construction. - * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to bin. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ -export default function DotBin(params) { - Transform.call(this, null, params); -} - -DotBin.Definition = { - 'type': 'DotBin', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'step', 'type': 'number' }, - { 'name': 'smooth', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': Output } - ] -}; - -const prototype = inherits(DotBin, Transform); - -prototype.transform = function(_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) { - return pulse; // early exit - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(pulse.source, _.groupby, identity), - smooth = _.smooth || false, - field = _.field, - step = _.step || autostep(source, field), - sort = stableCompare((a, b) => field(a) - field(b)), - as = _.as || Output, - n = groups.length; - - // compute dotplot bins per group - let min = Infinity, max = -Infinity, i = 0, j; - for (; i max) max = v; - g[++j][as] = v; - } - } - - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); -}; - -function autostep(data, field) { - return span(extent(data, field)) / 30; -} diff --git a/node_modules/vega-transforms/src/Expression.js b/node_modules/vega-transforms/src/Expression.js deleted file mode 100644 index 43ed8c1..0000000 --- a/node_modules/vega-transforms/src/Expression.js +++ /dev/null @@ -1,29 +0,0 @@ -import {Operator} from 'vega-dataflow'; -import {accessor, accessorFields, accessorName, inherits} from 'vega-util'; - -/** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ -export default function Expression(params) { - Operator.call(this, null, update, params); - this.modified(true); -} - -inherits(Expression, Operator); - -function update(_) { - var expr = _.expr; - return this.value && !_.modified('expr') - ? this.value - : accessor( - datum => expr(datum, _), - accessorFields(expr), - accessorName(expr) - ); -} diff --git a/node_modules/vega-transforms/src/Extent.js b/node_modules/vega-transforms/src/Extent.js deleted file mode 100644 index eaa3527..0000000 --- a/node_modules/vega-transforms/src/Extent.js +++ /dev/null @@ -1,56 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {accessorName, inherits, toNumber} from 'vega-util'; - -/** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ -export default function Extent(params) { - Transform.call(this, [undefined, undefined], params); -} - -Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true } - ] -}; - -var prototype = inherits(Extent, Transform); - -prototype.transform = function(_, pulse) { - var extent = this.value, - field = _.field, - min = extent[0], - max = extent[1], - mod; - - mod = pulse.changed() - || pulse.modified(field.fields) - || _.modified('field'); - - if (mod || min == null) { - min = +Infinity; - max = -Infinity; - } - - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, function(t) { - var v = toNumber(field(t)); - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - - if (!Number.isFinite(min) || !Number.isFinite(max)) { - let name = accessorName(field); - if (name) name = ` for field "${name}"`; - pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`); - min = max = undefined; - } - this.value = [min, max]; -}; diff --git a/node_modules/vega-transforms/src/Facet.js b/node_modules/vega-transforms/src/Facet.js deleted file mode 100644 index 6f773bf..0000000 --- a/node_modules/vega-transforms/src/Facet.js +++ /dev/null @@ -1,140 +0,0 @@ -import Subflow from './Subflow'; -import {Transform, tupleid} from 'vega-dataflow'; -import {fastmap, hasOwnProperty, inherits} from 'vega-util'; - -/** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ -export default function Facet(params) { - Transform.call(this, {}, params); - this._keys = fastmap(); // cache previously calculated key values - - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - const a = this._targets = []; - a.active = 0; - a.forEach = f => { - for (let i=0, n=a.active; i this.subflow(key, flow, pulse); - - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - - pulse.visit(pulse.REM, t => { - const id = tupleid(t), - k = cache.get(id); - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - - pulse.visit(pulse.ADD, t => { - const k = key(t); - cache.set(tupleid(t), k); - subflow(k).add(t); - }); - - if (rekey || pulse.modified(key.fields)) { - pulse.visit(pulse.MOD, t => { - const id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 === k1) { - subflow(k1).mod(t); - } else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } else if (pulse.changed(pulse.MOD)) { - pulse.visit(pulse.MOD, t => { - subflow(cache.get(tupleid(t))).mod(t); - }); - } - - if (rekey) { - pulse.visit(pulse.REFLOW, t => { - const id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } - - if (pulse.clean()) { - df.runAfter(() => { this.clean(); cache.clean(); }); - } else if (cache.empty > df.cleanThreshold) { - df.runAfter(cache.clean); - } - - return pulse; -}; diff --git a/node_modules/vega-transforms/src/Field.js b/node_modules/vega-transforms/src/Field.js deleted file mode 100644 index 4629b01..0000000 --- a/node_modules/vega-transforms/src/Field.js +++ /dev/null @@ -1,23 +0,0 @@ -import {Operator} from 'vega-dataflow'; -import {array, field, inherits, isArray} from 'vega-util'; - -/** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ -export default function Field(params) { - Operator.call(this, null, update, params); -} - -inherits(Field, Operator); - -function update(_) { - return (this.value && !_.modified()) ? this.value - : isArray(_.name) ? array(_.name).map(function(f) { return field(f); }) - : field(_.name, _.as); -} diff --git a/node_modules/vega-transforms/src/Filter.js b/node_modules/vega-transforms/src/Filter.js deleted file mode 100644 index ae496e1..0000000 --- a/node_modules/vega-transforms/src/Filter.js +++ /dev/null @@ -1,70 +0,0 @@ -import {Transform, tupleid} from 'vega-dataflow'; -import {fastmap, inherits} from 'vega-util'; - -/** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ -export default function Filter(params) { - Transform.call(this, fastmap(), params); -} - -Filter.Definition = { - 'type': 'Filter', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'expr', 'type': 'expr', 'required': true } - ] -}; - -var prototype = inherits(Filter, Transform); - -prototype.transform = function(_, pulse) { - var df = pulse.dataflow, - cache = this.value, // cache ids of filtered tuples - output = pulse.fork(), - add = output.add, - rem = output.rem, - mod = output.mod, - test = _.expr, - isMod = true; - - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - if (!cache.has(id)) rem.push(t); - else cache.delete(id); - }); - - pulse.visit(pulse.ADD, function(t) { - if (test(t, _)) add.push(t); - else cache.set(tupleid(t), 1); - }); - - function revisit(t) { - var id = tupleid(t), - b = test(t, _), - s = cache.get(id); - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) { - mod.push(t); - } - } - - pulse.visit(pulse.MOD, revisit); - - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; -}; diff --git a/node_modules/vega-transforms/src/Flatten.js b/node_modules/vega-transforms/src/Flatten.js deleted file mode 100644 index b5a818d..0000000 --- a/node_modules/vega-transforms/src/Flatten.js +++ /dev/null @@ -1,66 +0,0 @@ -import {fieldNames} from './util/util'; -import {Transform, derive} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ -export default function Flatten(params) { - Transform.call(this, [], params); -} - -Flatten.Definition = { - 'type': 'Flatten', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'index', 'type': 'string' }, - { 'name': 'as', 'type': 'string', 'array': true } - ] -}; - -var prototype = inherits(Flatten, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - as = fieldNames(fields, _.as || []), - index = _.index || null, - m = as.length; - - // remove any previous results - out.rem = this.value; - - // generate flattened tuples - pulse.visit(pulse.SOURCE, function(t) { - var arrays = fields.map(f => f(t)), - maxlen = arrays.reduce((l, a) => Math.max(l, a.length), 0), - i = 0, j, d, v; - - for (; i} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ -export default function Fold(params) { - Transform.call(this, [], params); -} - -Fold.Definition = { - 'type': 'Fold', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['key', 'value'] } - ] -}; - -var prototype = inherits(Fold, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - fnames = fields.map(accessorName), - as = _.as || ['key', 'value'], - k = as[0], - v = as[1], - n = fields.length; - - out.rem = this.value; - - pulse.visit(pulse.SOURCE, function(t) { - for (var i=0, d; i t[as] = func(t, _)); -}; diff --git a/node_modules/vega-transforms/src/Generate.js b/node_modules/vega-transforms/src/Generate.js deleted file mode 100644 index 477c127..0000000 --- a/node_modules/vega-transforms/src/Generate.js +++ /dev/null @@ -1,47 +0,0 @@ -import {Transform, ingest} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ -export default function Generate(params) { - Transform.call(this, [], params); -} - -var prototype = inherits(Generate, Transform); - -prototype.transform = function(_, pulse) { - var data = this.value, - out = pulse.fork(pulse.ALL), - num = _.size - data.length, - gen = _.generator, - add, rem, t; - - if (num > 0) { - // need more tuples, generate and add - for (add=[]; --num >= 0;) { - add.push(t = ingest(gen(_))); - data.push(t); - } - out.add = out.add.length - ? out.materialize(out.ADD).add.concat(add) - : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length - ? out.materialize(out.REM).rem.concat(rem) - : rem; - data = data.slice(-num); - } - - out.source = this.value = data; - return out; -}; diff --git a/node_modules/vega-transforms/src/Impute.js b/node_modules/vega-transforms/src/Impute.js deleted file mode 100644 index 2b2c30a..0000000 --- a/node_modules/vega-transforms/src/Impute.js +++ /dev/null @@ -1,138 +0,0 @@ -import {Transform, ingest} from 'vega-dataflow'; -import {accessorName, error, inherits} from 'vega-util'; -import {max, mean, median, min} from 'd3-array'; - -var Methods = { - value: 'value', - median: median, - mean: mean, - min: min, - max: max -}; - -var Empty = []; - -/** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ -export default function Impute(params) { - Transform.call(this, [], params); -} - -Impute.Definition = { - 'type': 'Impute', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'key', 'type': 'field', 'required': true }, - { 'name': 'keyvals', 'array': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'enum', 'default': 'value', - 'values': ['value', 'mean', 'median', 'max', 'min'] }, - { 'name': 'value', 'default': 0 } - ] -}; - -var prototype = inherits(Impute, Transform); - -function getValue(_) { - var m = _.method || Methods.value, v; - - if (Methods[m] == null) { - error('Unrecognized imputation method: ' + m); - } else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return function() { return v; }; - } else { - return Methods[m]; - } -} - -function getField(_) { - var f = _.field; - return function(t) { return t ? f(t) : NaN; }; -} - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - impute = getValue(_), - field = getField(_), - fName = accessorName(_.field), - kName = accessorName(_.key), - gNames = (_.groupby || []).map(accessorName), - groups = partition(pulse.source, _.groupby, _.key, _.keyvals), - curr = [], - prev = this.value, - m = groups.domain.length, - group, value, gVals, kVal, g, i, j, l, n, t; - - for (g=0, l=groups.length; g} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ -export default function KDE(params) { - Transform.call(this, null, params); -} - -KDE.Definition = { - 'type': 'KDE', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'cumulative', 'type': 'boolean', 'default': false }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['value', 'density'] } - ] -}; - -var prototype = inherits(KDE, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - bandwidth = _.bandwidth, - method = _.cumulative ? 'cdf' : 'pdf', - as = _.as || ['value', 'density'], - values = []; - - let domain = _.extent, - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - - if (_.resolve === 'shared') { - if (!domain) domain = extent(source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - - groups.forEach(g => { - const density = randomKDE(g, bandwidth)[method], - scale = _.counts ? g.length : 1, - local = domain || extent(g); - - sampleCurve(density, local, minsteps, maxsteps).forEach(v => { - const t = {}; - for (let i=0; i} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ -export default function Key(params) { - Operator.call(this, null, update, params); -} - -inherits(Key, Operator); - -function update(_) { - return (this.value && !_.modified()) ? this.value : key(_.fields, _.flat); -} diff --git a/node_modules/vega-transforms/src/Load.js b/node_modules/vega-transforms/src/Load.js deleted file mode 100644 index 87c3143..0000000 --- a/node_modules/vega-transforms/src/Load.js +++ /dev/null @@ -1,60 +0,0 @@ -import {Transform, ingest} from 'vega-dataflow'; -import {array, inherits} from 'vega-util'; - -/** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ -export default function Load(params) { - Transform.call(this, [], params); - this._pending = null; -} - -var prototype = inherits(Load, Transform); - -prototype.transform = function(_, pulse) { - const df = pulse.dataflow; - - if (this._pending) { - // update state and return pulse - return output(this, pulse, this._pending); - } - - if (stop(_)) return pulse.StopPropagation; - - if (_.values) { - // parse and ingest values, return output pulse - return output(this, pulse, df.parse(_.values, _.format)); - } else if (_.async) { - // return promise for non-blocking async loading - const p = df.request(_.url, _.format).then(res => { - this._pending = array(res.data); - return df => df.touch(this); - }); - return {async: p}; - } else { - // return promise for synchronous loading - return df.request(_.url, _.format) - .then(res => output(this, pulse, array(res.data))); - } -}; - -function stop(_) { - return _.modified('async') && !( - _.modified('values') || _.modified('url') || _.modified('format') - ); -} - -function output(op, pulse, data) { - data.forEach(ingest); - const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; -} diff --git a/node_modules/vega-transforms/src/Lookup.js b/node_modules/vega-transforms/src/Lookup.js deleted file mode 100644 index 6da9324..0000000 --- a/node_modules/vega-transforms/src/Lookup.js +++ /dev/null @@ -1,86 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {accessorName, error, inherits} from 'vega-util'; - -/** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ -export default function Lookup(params) { - Transform.call(this, {}, params); -} - -Lookup.Definition = { - 'type': 'Lookup', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'index', 'type': 'index', 'params': [ - {'name': 'from', 'type': 'data', 'required': true }, - {'name': 'key', 'type': 'field', 'required': true } - ] }, - { 'name': 'values', 'type': 'field', 'array': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true }, - { 'name': 'default', 'default': null } - ] -}; - -var prototype = inherits(Lookup, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse, - as = _.as, - keys = _.fields, - index = _.index, - values = _.values, - defaultValue = _.default==null ? null : _.default, - reset = _.modified(), - flag = reset ? pulse.SOURCE : pulse.ADD, - n = keys.length, - set, m, mods; - - if (values) { - m = values.length; - - if (n > 1 && !as) { - error('Multi-field lookup requires explicit "as" parameter.'); - } - if (as && as.length !== n * m) { - error('The "as" parameter has too few output field names.'); - } - as = as || values.map(accessorName); - - set = function(t) { - for (var i=0, k=0, j, v; i>} params.extents - The input extents. - */ -export default function MultiExtent(params) { - Operator.call(this, null, update, params); -} - -inherits(MultiExtent, Operator); - -function update(_) { - if (this.value && !_.modified()) { - return this.value; - } - - var min = +Infinity, - max = -Infinity, - ext = _.extents, - i, n, e; - - for (i=0, n=ext.length; i max) max = e[1]; - } - return [min, max]; -} diff --git a/node_modules/vega-transforms/src/MultiValues.js b/node_modules/vega-transforms/src/MultiValues.js deleted file mode 100644 index ed69f43..0000000 --- a/node_modules/vega-transforms/src/MultiValues.js +++ /dev/null @@ -1,20 +0,0 @@ -import {Operator} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.values - The input value arrrays. - */ -export default function MultiValues(params) { - Operator.call(this, null, update, params); -} - -inherits(MultiValues, Operator); - -function update(_) { - return (this.value && !_.modified()) - ? this.value - : _.values.reduce(function(data, _) { return data.concat(_); }, []); -} diff --git a/node_modules/vega-transforms/src/Params.js b/node_modules/vega-transforms/src/Params.js deleted file mode 100644 index 58d86f4..0000000 --- a/node_modules/vega-transforms/src/Params.js +++ /dev/null @@ -1,20 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ -export default function Params(params) { - Transform.call(this, null, params); -} - -inherits(Params, Transform); - -Params.prototype.transform = function(_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples -}; diff --git a/node_modules/vega-transforms/src/Pivot.js b/node_modules/vega-transforms/src/Pivot.js deleted file mode 100644 index ee40865..0000000 --- a/node_modules/vega-transforms/src/Pivot.js +++ /dev/null @@ -1,102 +0,0 @@ -import Aggregate from './Aggregate'; -import {ValidAggregateOps} from './util/AggregateOps'; -import {accessor, accessorFields, inherits} from 'vega-util'; - -/** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ -export default function Pivot(params) { - Aggregate.call(this, params); -} - -Pivot.Definition = { - 'type': 'Pivot', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'value', 'type': 'field', 'required': true }, - { 'name': 'op', 'type': 'enum', 'values': ValidAggregateOps, 'default': 'sum' }, - { 'name': 'limit', 'type': 'number', 'default': 0 }, - { 'name': 'key', 'type': 'field' } - ] -}; - -var prototype = inherits(Pivot, Aggregate); - -prototype._transform = prototype.transform; - -prototype.transform = function(_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); -}; - -// Shoehorn a pivot transform into an aggregate transform! -// First collect all unique pivot field values. -// Then generate aggregate fields for each output pivot field. -function aggregateParams(_, pulse) { - var key = _.field, - value = _.value, - op = (_.op === 'count' ? '__count__' : _.op) || 'sum', - fields = accessorFields(key).concat(accessorFields(value)), - keys = pivotKeys(key, _.limit || 0, pulse); - - // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - if (pulse.changed()) _.set('__pivot__', null, null, true); - - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(function() { return op; }), - fields: keys.map(function(k) { return get(k, key, value, fields); }), - as: keys.map(function(k) { return k + ''; }), - modified: _.modified.bind(_) - }; -} - -// Generate aggregate field accessor. -// Output NaN for non-existent values; aggregator will ignore! -function get(k, key, value, fields) { - return accessor( - function(d) { return key(d) === k ? value(d) : NaN; }, - fields, - k + '' - ); -} - -// Collect (and optionally limit) all unique pivot values. -function pivotKeys(key, limit, pulse) { - var map = {}, - list = []; - - pulse.visit(pulse.SOURCE, function(t) { - var k = key(t); - if (!map[k]) { - map[k] = 1; - list.push(k); - } - }); - - // TODO? Move this comparator to vega-util? - list.sort(function(u, v) { - return (uv||v==null) && u!=null ? 1 - : ((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))!==u && v===v ? -1 - : v!==v && u===u ? 1 : 0; - }); - - return limit ? list.slice(0, limit) : list; -} diff --git a/node_modules/vega-transforms/src/PreFacet.js b/node_modules/vega-transforms/src/PreFacet.js deleted file mode 100644 index 532c6bb..0000000 --- a/node_modules/vega-transforms/src/PreFacet.js +++ /dev/null @@ -1,57 +0,0 @@ -import Facet from './Facet'; -import {ingest, tupleid} from 'vega-dataflow'; -import {accessorFields, error, inherits} from 'vega-util'; - -/** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array} params.field - The field - * accessor for an array of subflow tuple objects. - */ -export default function PreFacet(params) { - Facet.call(this, params); -} - -const prototype = inherits(PreFacet, Facet); - -prototype.transform = function(_, pulse) { - const flow = _.subflow, - field = _.field, - subflow = t => this.subflow(tupleid(t), flow, pulse, t); - - if (_.modified('field') || field && pulse.modified(accessorFields(field))) { - error('PreFacet does not support field modification.'); - } - - this.initTargets(); // reset list of active subflows - - if (field) { - pulse.visit(pulse.MOD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.mod(_)); - }); - - pulse.visit(pulse.ADD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.add(ingest(_))); - }); - - pulse.visit(pulse.REM, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.rem(_)); - }); - } else { - pulse.visit(pulse.MOD, t => subflow(t).mod(t)); - pulse.visit(pulse.ADD, t => subflow(t).add(t)); - pulse.visit(pulse.REM, t => subflow(t).rem(t)); - } - - if (pulse.clean()) { - pulse.runAfter(() => this.clean()); - } - - return pulse; -}; diff --git a/node_modules/vega-transforms/src/Project.js b/node_modules/vega-transforms/src/Project.js deleted file mode 100644 index d9e2752..0000000 --- a/node_modules/vega-transforms/src/Project.js +++ /dev/null @@ -1,73 +0,0 @@ -import {fieldNames} from './util/util'; -import {Transform, ingest, rederive, tupleid} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ -export default function Project(params) { - Transform.call(this, null, params); -} - -Project.Definition = { - 'type': 'Project', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true } - ] -}; - -var prototype = inherits(Project, Transform); - -prototype.transform = function(_, pulse) { - var fields = _.fields, - as = fieldNames(_.fields, _.as || []), - derive = fields - ? function(s, t) { return project(s, t, fields, as); } - : rederive, - out, lut; - - if (this.value) { - lut = this.value; - } else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - - out = pulse.fork(pulse.NO_SOURCE); - - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, function(t) { - var dt = derive(t, ingest({})); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, function(t) { - out.mod.push(derive(t, lut[tupleid(t)])); - }); - - return out; -}; - -function project(s, t, fields, as) { - for (var i=0, n=fields.length; i} [params.groupby] - An array of accessors - * to groupby. - * @param {Array} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ -export default function Quantile(params) { - Transform.call(this, null, params); -} - -Quantile.Definition = { - 'type': 'Quantile', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'probs', 'type': 'number', 'array': true }, - { 'name': 'step', 'type': 'number', 'default': 0.01 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['prob', 'value'] } - ] -}; - -var prototype = inherits(Quantile, Transform); - -var EPSILON = 1e-14; - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - as = _.as || ['prob', 'value']; - - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - values = [], - step = _.step || 0.01, - p = _.probs || range(step/2, 1 - EPSILON, step), - n = p.length; - - groups.forEach(g => { - const q = quantiles(g, p); - - for (let i=0; i { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, t => { - var dt = derive(t); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, t => { - var dt = lut[tupleid(t)], k; - for (k in t) { - dt[k] = t[k]; - // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - out.modifies(k); - } - out.mod.push(dt); - }); - } - - return out; -}; diff --git a/node_modules/vega-transforms/src/Sample.js b/node_modules/vega-transforms/src/Sample.js deleted file mode 100644 index 9d40257..0000000 --- a/node_modules/vega-transforms/src/Sample.js +++ /dev/null @@ -1,109 +0,0 @@ -import {Transform, tupleid} from 'vega-dataflow'; -import {random} from 'vega-statistics'; -import {inherits} from 'vega-util'; - -/** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ -export default function Sample(params) { - Transform.call(this, [], params); - this.count = 0; -} - -Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [ - { 'name': 'size', 'type': 'number', 'default': 1000 } - ] -}; - -var prototype = inherits(Sample, Transform); - -prototype.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - mod = _.modified('size'), - num = _.size, - res = this.value, - cnt = this.count, - cap = 0, - map = res.reduce(function(m, t) { - m[tupleid(t)] = 1; - return m; - }, {}); - - // sample reservoir update function - function update(t) { - var p, idx; - - if (res.length < num) { - res.push(t); - } else { - idx = ~~((cnt + 1) * random()); - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[tupleid(p)]) out.rem.push(p); // eviction - res[idx] = t; - } - } - ++cnt; - } - - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - --cnt; - }); - - // filter removed tuples out of the sample reservoir - res = res.filter(function(t) { return map[tupleid(t)] !== -1; }); - } - - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, function(t) { - // update, but skip previously sampled tuples - if (!map[tupleid(t)]) update(t); - }); - cap = -1; - } - - if (mod && res.length > num) { - for (var i=0, n=res.length-num; i max) max = b; - } - }); - - floor.start = min; - floor.stop = max; - - return pulse.modifies(band ? as : u0); -}; - -prototype._floor = function(_, pulse) { - const utc = _.timezone === 'utc'; - - // get parameters - let {units, step} = _.units - ? {units: _.units, step: _.step || 1} - : timeBin({ - extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }); - - // check / standardize time units - units = timeUnits(units); - - const prev = this.value || {}, - floor = (utc ? utcFloor : timeFloor)(units, step); - - floor.unit = peek(units); - floor.units = units; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; -}; diff --git a/node_modules/vega-transforms/src/TupleIndex.js b/node_modules/vega-transforms/src/TupleIndex.js deleted file mode 100644 index 110cff4..0000000 --- a/node_modules/vega-transforms/src/TupleIndex.js +++ /dev/null @@ -1,38 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {fastmap, inherits} from 'vega-util'; - -/** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ -export default function TupleIndex(params) { - Transform.call(this, fastmap(), params); -} - -var prototype = inherits(TupleIndex, Transform); - -prototype.transform = function(_, pulse) { - var df = pulse.dataflow, - field = _.field, - index = this.value, - mod = true; - - function set(t) { index.set(field(t), t); } - - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, function(t) { index.delete(field(t)); }); - pulse.visit(pulse.ADD, set); - } else { - mod = false; - } - - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); -}; diff --git a/node_modules/vega-transforms/src/Values.js b/node_modules/vega-transforms/src/Values.js deleted file mode 100644 index 54905ef..0000000 --- a/node_modules/vega-transforms/src/Values.js +++ /dev/null @@ -1,32 +0,0 @@ -import {Transform, stableCompare} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ -export default function Values(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(Values, Transform); - -prototype.transform = function(_, pulse) { - var run = !this.value - || _.modified('field') - || _.modified('sort') - || pulse.changed() - || (_.sort && pulse.modified(_.sort.fields)); - - if (run) { - this.value = (_.sort - ? pulse.source.slice().sort(stableCompare(_.sort)) - : pulse.source).map(_.field); - } -}; diff --git a/node_modules/vega-transforms/src/Window.js b/node_modules/vega-transforms/src/Window.js deleted file mode 100644 index 29803b0..0000000 --- a/node_modules/vega-transforms/src/Window.js +++ /dev/null @@ -1,142 +0,0 @@ -import {groupkey} from './util/AggregateKeys'; -import {ValidAggregateOps} from './util/AggregateOps'; -import SortedList from './util/SortedList'; -import {ValidWindowOps} from './util/WindowOps'; -import WindowState from './util/WindowState'; -import {Transform, stableCompare, tupleid} from 'vega-dataflow'; -import {constant, inherits} from 'vega-util'; -import {bisector} from 'd3-array'; - -/** - * Perform window calculations and write results to the input stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window. - * @param {Array} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array} params.ops - An array of strings indicating window operations to perform. - * @param {Array} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array} [params.as] - An array of output field names for window operations. - * @param {Array} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ -export default function Window(params) { - Transform.call(this, {}, params); - this._mlen = 0; - this._mods = []; -} - -Window.Definition = { - 'type': 'Window', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidWindowOps.concat(ValidAggregateOps) }, - { 'name': 'params', 'type': 'number', 'null': true, 'array': true }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'frame', 'type': 'number', 'null': true, 'array': true, 'length': 2, 'default': [null, 0] }, - { 'name': 'ignorePeers', 'type': 'boolean', 'default': false } - ] -}; - -var prototype = inherits(Window, Transform); - -prototype.transform = function(_, pulse) { - var self = this, - state = self.state, - mod = _.modified(), - cmp = stableCompare(_.sort), - i, n; - - this.stamp = pulse.stamp; - - // initialize window state - if (!state || mod) { - state = self.state = new WindowState(_); - } - - // retrieve group for a tuple - var key = groupkey(_.groupby); - function group(t) { return self.group(key(t)); } - - // partition input tuples - if (mod || pulse.modified(state.inputs)) { - self.value = {}; - pulse.visit(pulse.SOURCE, function(t) { group(t).add(t); }); - } else { - pulse.visit(pulse.REM, function(t) { group(t).remove(t); }); - pulse.visit(pulse.ADD, function(t) { group(t).add(t); }); - } - - // perform window calculations for each modified partition - for (i=0, n=self._mlen; i 0 && !c(d[r0], d[r0-1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1+1])) w.i1 = bisect.right(d, d[r1]); -} diff --git a/node_modules/vega-transforms/src/util/AggregateKeys.js b/node_modules/vega-transforms/src/util/AggregateKeys.js deleted file mode 100644 index e380899..0000000 --- a/node_modules/vega-transforms/src/util/AggregateKeys.js +++ /dev/null @@ -1,19 +0,0 @@ -export function multikey(f) { - return function(x) { - var n = f.length, - i = 1, - k = String(f[0](x)); - - for (; i {}; - -const base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 -}; - -export const AggregateOps = { - values: { - init: m => m.cell.store = true, - value: m => m.cell.data.values(), - idx: -1 - }, - count: { - value: m => m.cell.num - }, - __count__: { - value: m => m.missing + m.valid - }, - missing: { - value: m => m.missing - }, - valid: { - value: m => m.valid - }, - sum: { - init: m => m.sum = 0, - value: m => m.sum, - add: (m, v) => m.sum += +v, - rem: (m, v) => m.sum -= v - }, - product: { - init: m => m.product = 1, - value: m => m.valid ? m.product : undefined, - add: (m, v) => m.product *= v, - rem: (m, v) => m.product /= v - }, - mean: { - init: m => m.mean = 0, - value: m => m.valid ? m.mean : undefined, - add: (m, v) => (m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid), - rem: (m, v) => (m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean) - }, - average: { - value: m => m.valid ? m.mean : undefined, - req: ['mean'], idx: 1 - }, - variance: { - init: m => m.dev = 0, - value: m => m.valid > 1 ? m.dev / (m.valid - 1) : undefined, - add: (m, v) => m.dev += m.mean_d * (v - m.mean), - rem: (m, v) => m.dev -= m.mean_d * (v - m.mean), - req: ['mean'], idx: 1 - }, - variancep: { - value: m => m.valid > 1 ? m.dev / m.valid : undefined, - req: ['variance'], idx: 2 - }, - stdev: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined, - req: ['variance'], idx: 2 - }, - stdevp: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined, - req: ['variance'], idx: 2 - }, - stderr: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined, - req: ['variance'], idx: 2 - }, - distinct: { - value: m => m.cell.data.distinct(m.get), - req: ['values'], idx: 3 - }, - ci0: { - value: m => m.cell.data.ci0(m.get), - req: ['values'], idx: 3 - }, - ci1: { - value: m => m.cell.data.ci1(m.get), - req: ['values'], idx: 3 - }, - median: { - value: m => m.cell.data.q2(m.get), - req: ['values'], idx: 3 - }, - q1: { - value: m => m.cell.data.q1(m.get), - req: ['values'], idx: 3 - }, - q3: { - value: m => m.cell.data.q3(m.get), - req: ['values'], idx: 3 - }, - min: { - init: m => m.min = undefined, - value: m => m.min = (Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min), - add: (m, v) => { if (v < m.min || m.min === undefined) m.min = v; }, - rem: (m, v) => { if (v <= m.min) m.min = NaN; }, - req: ['values'], idx: 4 - }, - max: { - init: m => m.max = undefined, - value: m => m.max = (Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max), - add: (m, v) => { if (v > m.max || m.max === undefined) m.max = v; }, - rem: (m, v) => { if (v >= m.max) m.max = NaN; }, - req: ['values'], idx: 4 - }, - argmin: { - init: m => m.argmin = undefined, - value: m => m.argmin || m.cell.data.argmin(m.get), - add: (m, v, t) => { if (v < m.min) m.argmin = t; }, - rem: (m, v) => { if (v <= m.min) m.argmin = undefined; }, - req: ['min', 'values'], idx: 3 - }, - argmax: { - init: m => m.argmax = undefined, - value: m => m.argmax || m.cell.data.argmax(m.get), - add: (m, v, t) => { if (v > m.max) m.argmax = t; }, - rem: (m, v) => { if (v >= m.max) m.argmax = undefined; }, - req: ['max', 'values'], idx: 3 - } -}; - -export const ValidAggregateOps = Object.keys(AggregateOps); - -function measure(key, value) { - return out => extend({ - name: key, - out: out || key - }, base_op, value); -} - -ValidAggregateOps.forEach(key => { - AggregateOps[key] = measure(key, AggregateOps[key]); -}); - -export function createMeasure(op, name) { - return AggregateOps[op](name); -} - -function compareIndex(a, b) { - return a.idx - b.idx; -} - -function resolve(agg) { - const map = {}; - agg.forEach(a => map[a.name] = a); - - const getreqs = a => { - if (!a.req) return; - a.req.forEach(key => { - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - agg.forEach(getreqs); - - return Object.values(map).sort(compareIndex); -} - -function init() { - this.valid = 0; - this.missing = 0; - this._ops.forEach(op => op.init(this)); -} - -function add(v, t) { - if (v == null || v === '') { ++this.missing; return; } - if (v !== v) return; - ++this.valid; - this._ops.forEach(op => op.add(this, v, t)); -} - -function rem(v, t) { - if (v == null || v === '') { --this.missing; return; } - if (v !== v) return; - --this.valid; - this._ops.forEach(op => op.rem(this, v, t)); -} - -function set(t) { - this._out.forEach(op => t[op.out] = op.value(this)); - return t; -} - -export function compileMeasures(agg, field) { - var get = field || identity, - ops = resolve(agg), - out = agg.slice().sort(compareIndex); - - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - - ctr.prototype.init = init; - ctr.prototype.add = add; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map(op => op.out); - - return ctr; -} diff --git a/node_modules/vega-transforms/src/util/Distributions.js b/node_modules/vega-transforms/src/util/Distributions.js deleted file mode 100644 index 83b1f65..0000000 --- a/node_modules/vega-transforms/src/util/Distributions.js +++ /dev/null @@ -1,60 +0,0 @@ -import { - randomKDE, - randomLogNormal, - randomMixture, - randomNormal, - randomUniform -} from 'vega-statistics'; - -import {error, hasOwnProperty} from 'vega-util'; - -var Distributions = { - kde: randomKDE, - mixture: randomMixture, - normal: randomNormal, - lognormal: randomLogNormal, - uniform: randomUniform -}; - -var DISTRIBUTIONS = 'distributions', - FUNCTION = 'function', - FIELD = 'field'; - -/** - * Parse a parameter object for a probability distribution. - * @param {object} def - The distribution parameter object. - * @param {function():Array} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ -export default function parse(def, data) { - var func = def[FUNCTION]; - if (!hasOwnProperty(Distributions, func)) { - error('Unknown distribution function: ' + func); - } - - var d = Distributions[func](); - - for (var name in def) { - // if data field, extract values - if (name === FIELD) { - d.data((def.from || data()).map(def[name])); - } - - // if distribution mixture, recurse to parse each definition - else if (name === DISTRIBUTIONS) { - d[name](def[name].map(function(_) { return parse(_, data); })); - } - - // otherwise, simply set the parameter - else if (typeof d[name] === FUNCTION) { - d[name](def[name]); - } - } - - return d; -} diff --git a/node_modules/vega-transforms/src/util/SortedList.js b/node_modules/vega-transforms/src/util/SortedList.js deleted file mode 100644 index c14ae9c..0000000 --- a/node_modules/vega-transforms/src/util/SortedList.js +++ /dev/null @@ -1,32 +0,0 @@ -import {merge} from 'vega-util'; - -export default function(idFunc, source, input) { - var $ = idFunc, - data = source || [], - add = input || [], - rem = {}, - cnt = 0; - - return { - add: function(t) { add.push(t); }, - remove: function(t) { rem[$(t)] = ++cnt; }, - size: function() { return data.length; }, - data: function(compare, resort) { - if (cnt) { - data = data.filter(function(t) { return !rem[$(t)]; }); - rem = {}; - cnt = 0; - } - if (resort && compare) { - data.sort(compare); - } - if (add.length) { - data = compare - ? merge(compare, data, add.sort(compare)) - : data.concat(add); - add = []; - } - return data; - } - }; -} \ No newline at end of file diff --git a/node_modules/vega-transforms/src/util/TupleStore.js b/node_modules/vega-transforms/src/util/TupleStore.js deleted file mode 100644 index 8b14fd7..0000000 --- a/node_modules/vega-transforms/src/util/TupleStore.js +++ /dev/null @@ -1,137 +0,0 @@ -import {tupleid} from 'vega-dataflow'; -import {bootstrapCI, quartiles} from 'vega-statistics'; -import {extentIndex, field, hasOwnProperty} from 'vega-util'; - -export default function TupleStore(key) { - this._key = key ? field(key) : tupleid; - this.reset(); -} - -var prototype = TupleStore.prototype; - -prototype.reset = function() { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; -}; - -prototype.add = function(v) { - this._add.push(v); -}; - -prototype.rem = function(v) { - this._rem.push(v); -}; - -prototype.values = function() { - this._get = null; - if (this._rem.length === 0) return this._add; - - var a = this._add, - r = this._rem, - k = this._key, - n = a.length, - m = r.length, - x = Array(n - m), - map = {}, i, j, v; - - // use unique key field to clear removed values - for (i=0; i= 0) { - s = get(v[n]) + ''; - if (!hasOwnProperty(map, s)) { - map[s] = 1; - ++count; - } - } - - return count; -}; - -prototype.extent = function(get) { - if (this._get !== get || !this._ext) { - var v = this.values(), - i = extentIndex(v, get); - this._ext = [v[i[0]], v[i[1]]]; - this._get = get; - } - return this._ext; -}; - -prototype.argmin = function(get) { - return this.extent(get)[0] || {}; -}; - -prototype.argmax = function(get) { - return this.extent(get)[1] || {}; -}; - -prototype.min = function(get) { - var m = this.extent(get)[0]; - return m != null ? get(m) : undefined; -}; - -prototype.max = function(get) { - var m = this.extent(get)[1]; - return m != null ? get(m) : undefined; -}; - -prototype.quartile = function(get) { - if (this._get !== get || !this._q) { - this._q = quartiles(this.values(), get); - this._get = get; - } - return this._q; -}; - -prototype.q1 = function(get) { - return this.quartile(get)[0]; -}; - -prototype.q2 = function(get) { - return this.quartile(get)[1]; -}; - -prototype.q3 = function(get) { - return this.quartile(get)[2]; -}; - -prototype.ci = function(get) { - if (this._get !== get || !this._ci) { - this._ci = bootstrapCI(this.values(), 1000, 0.05, get); - this._get = get; - } - return this._ci; -}; - -prototype.ci0 = function(get) { - return this.ci(get)[0]; -}; - -prototype.ci1 = function(get) { - return this.ci(get)[1]; -}; diff --git a/node_modules/vega-transforms/src/util/WindowOps.js b/node_modules/vega-transforms/src/util/WindowOps.js deleted file mode 100644 index dbe97e0..0000000 --- a/node_modules/vega-transforms/src/util/WindowOps.js +++ /dev/null @@ -1,148 +0,0 @@ -import {error, zero} from 'vega-util'; - -export function WindowOp(op, field, param, as) { - let fn = WindowOps[op](field, param); - return { - init: fn.init || zero, - update: function(w, t) { t[as] = fn.next(w); } - }; -} - -export const WindowOps = { - row_number: function() { - return { - next: w => w.index + 1 - }; - }, - rank: function() { - let rank; - return { - init: () => rank = 1, - next: w => { - let i = w.index, - data = w.data; - return (i && w.compare(data[i - 1], data[i])) ? (rank = i + 1) : rank; - } - }; - }, - dense_rank: function() { - let drank; - return { - init: () => drank = 1, - next: w => { - let i = w.index, - d = w.data; - return (i && w.compare(d[i - 1], d[i])) ? ++drank : drank; - } - }; - }, - percent_rank: function() { - let rank = WindowOps.rank(), - next = rank.next; - return { - init: rank.init, - next: w => (next(w) - 1) / (w.data.length - 1) - }; - }, - cume_dist: function() { - let cume; - return { - init: () => cume = 0, - next: w => { - let i = w.index, - d = w.data, - c = w.compare; - if (cume < i) { - while (i + 1 < d.length && !c(d[i], d[i + 1])) ++i; - cume = i; - } - return (1 + cume) / d.length; - } - }; - }, - ntile: function(field, num) { - num = +num; - if (!(num > 0)) error('ntile num must be greater than zero.'); - let cume = WindowOps.cume_dist(), - next = cume.next; - return { - init: cume.init, - next: w => Math.ceil(num * next(w)) - }; - }, - - lag: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index + offset, - d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - - first_value: function(field) { - return { - next: w => field(w.data[w.i0]) - }; - }, - last_value: function(field) { - return { - next: w => field(w.data[w.i1 - 1]) - }; - }, - nth_value: function(field, nth) { - nth = +nth; - if (!(nth > 0)) error('nth_value nth must be greater than zero.'); - return { - next: w => { - let i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - - prev_value: function(field) { - let prev; - return { - init: () => prev = null, - next: w => { - let v = field(w.data[w.index]); - return v != null ? (prev = v) : prev; - } - }; - }, - next_value: function(field) { - let v, i; - return { - init: () => (v = null, i = -1), - next: w => { - let d = w.data; - return w.index <= i ? v - : (i = find(field, d, w.index)) < 0 - ? (i = d.length, v = null) - : (v = field(d[i])); - } - }; - } -}; - -function find(field, data, index) { - for (let n = data.length; index < n; ++index) { - let v = field(data[index]); - if (v != null) return index; - } - return -1; -} - -export var ValidWindowOps = Object.keys(WindowOps); diff --git a/node_modules/vega-transforms/src/util/WindowState.js b/node_modules/vega-transforms/src/util/WindowState.js deleted file mode 100644 index 873eca7..0000000 --- a/node_modules/vega-transforms/src/util/WindowState.js +++ /dev/null @@ -1,146 +0,0 @@ -import {compileMeasures, createMeasure, measureName} from './AggregateOps'; -import TupleStore from './TupleStore'; -import {WindowOp, WindowOps} from './WindowOps'; -import {accessorFields, accessorName, array, error, hasOwnProperty} from 'vega-util'; - -export default function WindowState(_) { - let self = this, - ops = array(_.ops), - fields = array(_.fields), - params = array(_.params), - as = array(_.as), - outputs = self.outputs = [], - windows = self.windows = [], - inputs = {}, - map = {}, - countOnly = true, - counts = [], - measures = []; - - function visitInputs(f) { - array(accessorFields(f)).forEach(_ => inputs[_] = 1); - } - visitInputs(_.sort); - - ops.forEach(function(op, i) { - let field = fields[i], - mname = accessorName(field), - name = measureName(op, mname, as[i]); - - visitInputs(field); - outputs.push(name); - - // Window operation - if (hasOwnProperty(WindowOps, op)) { - windows.push(WindowOp(op, fields[i], params[i], name)); - } - - // Aggregate operation - else { - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - if (op === 'count') { - counts.push(name); - return; - } - - countOnly = false; - let m = map[mname]; - if (!m) { - m = (map[mname] = []); - m.field = field; - measures.push(m); - } - m.push(createMeasure(op, name)); - } - }); - - if (counts.length || measures.length) { - self.cell = cell(measures, counts, countOnly); - } - - self.inputs = Object.keys(inputs); -} - -const prototype = WindowState.prototype; - -prototype.init = function() { - this.windows.forEach(_ => _.init()); - if (this.cell) this.cell.init(); -}; - -prototype.update = function(w, t) { - let self = this, - cell = self.cell, - wind = self.windows, - data = w.data, - m = wind && wind.length, - j; - - if (cell) { - for (j=w.p0; j compileMeasures(m, m.field)); - - let cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - - if (!countOnly) { - var n = measures.length, - a = cell.agg = Array(n), - i = 0; - for (; i any, params?: any, react?: boolean); - targets(): any; - set(value: any): 1 | 0; - skip(): (state: any) => any; - modified(): (state: any) => any; - parameters(params: object, react?: boolean, initonly?: boolean): Operator[]; - marshall(stamp: number): any; - evaluate(pulse: any): any; - run(pulse: any): any; -} - -export class Transform extends Operator { - constructor(init?: any, params?: any); - transform(pulse: any, params?: any): any; -} - -export function isTuple(t: any): boolean; -export function tupleid(t: any): number; -export function ingest(datum: any): any; diff --git a/node_modules/vega-typings/types/runtime/index.d.ts b/node_modules/vega-typings/types/runtime/index.d.ts deleted file mode 100644 index c43e5e2..0000000 --- a/node_modules/vega-typings/types/runtime/index.d.ts +++ /dev/null @@ -1,219 +0,0 @@ -import { - Color, - Config, - DataType, - EncodeEntryName, - Format, - NumberLocale, - Padding, - SignalValue, - Spec, - TimeLocale, -} from '../spec'; -import { Renderers } from './renderer'; -import { Changeset, Transform } from './dataflow'; -import { Scene } from './scene'; -import { LoggerInterface } from 'vega-util'; - -// TODO -export type Runtime = any; - -export const version: string; - -// Locale API -export function formatLocale(definition: object): void; -export function timeFormatLocale(definition: object): void; - -// Parser -export function parse(spec: Spec, config?: Config, opt?: { ast?: boolean }): Runtime; - -export interface Loader { - load: (uri: string, options?: any) => Promise; - sanitize: (uri: string, options: any) => Promise<{ href: string }>; - http: (uri: string, options: any) => Promise; - file: (filename: string) => Promise; -} - -export type NumberFormat = (number: number) => string; -export type TimeFormat = (date: Date | number) => string; -export type TimeParse = (dateString: string) => Date; - -export interface LocaleFormatters { - format: (spec: string) => NumberFormat; - formatPrefix: (spec: string, value: number) => NumberFormat; - formatFloat: (spec: string) => NumberFormat; - formatSpan: (start: number, stop: number, count: number, spec: string) => NumberFormat; - timeFormat: (spec: string) => TimeFormat; - utcFormat: (spec: string) => TimeFormat; - timeParse: (spec: string) => TimeParse; - utcParse: (spec: string) => TimeParse; -} - -export interface ToCanvasOptions { - type?: string; - context?: any; - externalContext?: any; -} - -export class View { - constructor( - runtime: Runtime, - opt?: { - background?: Color; - bind?: Element | string; - container?: Element | string; - hover?: boolean; - loader?: Loader; - logger?: LoggerInterface; - logLevel?: number; - renderer?: Renderers; - tooltip?: TooltipHandler; - locale?: LocaleFormatters; - expr?: any; - }, - ); - - initialize(container?: Element | string, bindContainer?: Element | string): this; - finalize(): this; - - logLevel(level: number): this; - logLevel(): number; - logger(logger: LoggerInterface): this; - logger(): LoggerInterface; - - renderer(renderer: Renderers): this; - renderer(): Renderers; - - loader(loader: Loader): this; - loader(): Loader; - - locale(locale: LocaleFormatters): this; - locale(): LocaleFormatters; - - hover(hoverSet?: EncodeEntryName, leaveSet?: EncodeEntryName): this; - run(encode?: string): this; - runAfter(callback: (view: this) => void, enqueue?: boolean, priority?: number): this; - runAsync(): Promise; - insert(name: string, tuples: any): this; - remove(name: string, tuples: any): this; - change(name: string, changeset: Changeset): this; - changeset(): any; - data(name: string): any[]; - data(name: string, tuples: any): this; - - description(s: string): this; - description(): string; - - width(w: number): this; - width(): number; - height(h: number): this; - height(): number; - - origin(): [number, number]; - - padding(p: Padding): this; - padding(): Padding; - - resize(): this; - - toImageURL(type: string, scaleFactor?: number): Promise; - toSVG(scaleFactor?: number): Promise; - toCanvas(scaleFactor?: number, options?: ToCanvasOptions): Promise; - - signal(name: string, value: SignalValue): this; - signal(name: string): SignalValue; - container(): HTMLElement | null; - scenegraph(): Scene; - addEventListener(type: string, handler: EventListenerHandler): this; - removeEventListener(type: string, handler: EventListenerHandler): this; - addSignalListener(name: string, handler: SignalListenerHandler): this; - removeSignalListener(name: string, handler: SignalListenerHandler): this; - addDataListener(name: string, handler: DataListenerHandler): this; - removeDataListener(name: string, handler: DataListenerHandler): this; - addResizeListener(handler: ResizeHandler): this; - removeResizeListener(handler: ResizeHandler): this; - tooltip(handler: TooltipHandler): this; - - getState(options?: { - signals?: (name?: string, operator?: any) => boolean; - data?: (name?: string, object?: any) => boolean; - recurse?: boolean; - }): { signals?: any; data?: any }; - setState(state: { signals?: any; data?: any }): this; -} - -export type ScenegraphEvent = MouseEvent | TouchEvent | KeyboardEvent; - -export interface LoaderOptions { - baseURL?: string; - mode?: 'file' | 'http'; - defaultProtocol?: 'http' | 'https' | string; - target?: string; - http?: RequestInit; -} -export function loader(opt?: LoaderOptions): Loader; -export function read( - data: string, - schema: Format, - dateParse?: (dateString: string) => Date, -): object[]; - -export type TypeInference = DataType | 'integer'; -export function inferType(values: readonly any[], field?: string): TypeInference; -export function inferTypes( - values: readonly any[], - fields: readonly string[], -): { [field: string]: TypeInference }; - -export type EventListenerHandler = (event: ScenegraphEvent, item?: Item) => void; -export type SignalListenerHandler = (name: string, value: SignalValue) => void; -export type DataListenerHandler = (name: string, value: any) => void; -export type ResizeHandler = (width: number, height: number) => void; -export type TooltipHandler = (handler: any, event: MouseEvent, item: Item, value: any) => void; - -export interface Item { - /** - * The underlying data element to which this item corresponds. - */ - datum: T; - /** - * The mark to which this item belongs. - */ - mark: RuntimeMark; -} - -export type RuntimeMark = - | DefineMark<'group'> - | DefineMark<'rect', { x: number; y: number; width: number; height: number; fill: number }> - | DefineMark<'symbol', {}, 'legend-symbol'> - | DefineMark<'path'> - | DefineMark<'arc'> - | DefineMark<'area'> - | DefineMark<'line'> - | DefineMark<'image'> - | DefineMark<'text', {}, 'axis-label' | 'legend-label'>; - -export interface DefineMark { - marktype: T; - role: 'mark' | R; - items: Item[]; - group: any; -} - -// Extensibility: https://vega.github.io/vega/docs/api/extensibility/ - -export function projection(type: string, projection: any): View; - -export function scale(type: string, scale?: any): any; - -export function scheme(name: string, scheme?: any): any; -export function schemeDiscretized(name: string, scheme?: any, interpolator?: any): any; - -export function expressionFunction(name: string, fn?: any, visitor?: any): any; - -export const transforms: { [name: string]: Transform }; - -export * from 'vega-util'; -export * from './dataflow'; -export * from './renderer'; -export * from './scene'; diff --git a/node_modules/vega-typings/types/runtime/renderer.d.ts b/node_modules/vega-typings/types/runtime/renderer.d.ts deleted file mode 100644 index 2710825..0000000 --- a/node_modules/vega-typings/types/runtime/renderer.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Scene, SceneItem } from './scene'; -import { Loader } from '.'; - -export type Renderers = 'canvas' | 'svg' | 'none'; - -export class Renderer { - constructor(loader: Loader); - initialize(el: HTMLElement, width: number, height: number, origin: readonly number[]): this; - resize(width: number, height: number, origin: readonly number[]): this; -} - -export interface RenderModule { - renderer: typeof Renderer; - headless?: Renderer; - handler: Handler; -} - -export function renderModule(moduleName: string, renderModule: RenderModule): RenderModule; - -export class Handler {} - -export class CanvasHandler extends Handler {} diff --git a/node_modules/vega-typings/types/runtime/scene.d.ts b/node_modules/vega-typings/types/runtime/scene.d.ts deleted file mode 100644 index 768130b..0000000 --- a/node_modules/vega-typings/types/runtime/scene.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -export interface Scene { - bounds: Bounds; - clip: boolean; - interactive: boolean; - items: SceneGroup[]; - marktype: string; - name: string; - role: string; -} - -export class Bounds { - x1: number; - y1: number; - x2: number; - y2: number; - clone: () => Bounds; - clear: () => Bounds; - empty: () => void; - equals: (b: Bounds) => boolean; - set: (x1: number, y1: number, x2: number, y2: number) => Bounds; - add: (x: number, y: number) => Bounds; - expand: (d: number) => Bounds; - round: () => Bounds; - translate: (dx: number, dy: number) => Bounds; - rotate: (angle: number, x: number, y: number) => Bounds; - rotatedPoints: (angle: number, x: number, y: number) => number[]; - union: (b: Bounds) => Bounds; - encloses: (b: Bounds) => boolean; - alignsWith: (b: Bounds) => boolean; - intersects: (b: Bounds) => boolean; - contains: (x: number, y: number) => boolean; - width: () => number; - height: () => number; -} - -export interface SceneItem { - bounds: Bounds; - datum?: object; - mark: { role: string }; - x: number; - y: number; -} - -export type SceneRect = SceneItem & { - fill: string; - height: number; - width: number; -}; - -export type SceneLine = SceneItem & { - opacity: number; - stroke: string; - strokeWidth: number; - x2: number; - y2: number; -}; - -export interface SceneContext { - background?: string; -} - -export type SceneGroup = SceneItem & { - context: SceneContext; - items: SceneItem[]; - height: number; - width: number; - stroke?: string; -}; - -export type SceneSymbol = SceneItem & { - fill: string; - shape: string; - size: number; - strokeWidth: number; -}; - -export type SceneTextBaseline = 'top' | 'middle' | 'bottom'; -export type SceneTextAlign = 'left' | 'center' | 'right'; - -export type SceneText = SceneItem & { - align?: SceneTextAlign; - angle?: number; - baseline: SceneTextBaseline; - dir?: 'rtl' | 'ltr'; - dx?: number; - dy: number; - ellipsis?: string; - fill: string; - font: string; - fontSize: number; - fontStyle?: string; - fontWeight?: number | string; - limit?: number; - lineBreak?: string; - lineHeight?: number; - radius?: number; - text: string; - theta?: number; -}; - -export interface SceneLegendItem { - datum: { - index: number; - }; -} - -export function sceneVisit( - scene: Scene | SceneGroup, - itemCallback: (item: Scene | SceneGroup | SceneItem) => void, -): void; diff --git a/node_modules/vega-typings/types/spec/autosize.d.ts b/node_modules/vega-typings/types/spec/autosize.d.ts deleted file mode 100644 index 6eb8ce1..0000000 --- a/node_modules/vega-typings/types/spec/autosize.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export type AutoSizeType = 'pad' | 'fit' | 'fit-x' | 'fit-y' | 'none'; -export type AutoSize = - | AutoSizeType - | { - type: AutoSizeType; - resize?: boolean; - contains?: 'content' | 'padding'; - }; diff --git a/node_modules/vega-typings/types/spec/axis.d.ts b/node_modules/vega-typings/types/spec/axis.d.ts deleted file mode 100644 index 83b4faf..0000000 --- a/node_modules/vega-typings/types/spec/axis.d.ts +++ /dev/null @@ -1,559 +0,0 @@ -import { - GroupEncodeEntry, - GuideEncodeEntry, - RuleEncodeEntry, - SignalRef, - TextEncodeEntry, - TimeInterval, -} from '.'; -import { Text } from './encode'; -import { TimeIntervalStep } from './scale'; -import { - AlignValue, - AnchorValue, - BooleanValue, - ColorValue, - DashArrayValue, - FontStyleValue, - FontWeightValue, - NumberValue, - StringValue, - StrokeCapValue, - TextBaselineValue, -} from './values'; - -export type AxisOrient = 'top' | 'bottom' | 'left' | 'right'; - -export type LabelOverlap = boolean | 'parity' | 'greedy'; - -export type TickCount = number | TimeInterval | TimeIntervalStep | SignalRef; - -export type FormatType = 'number' | 'time' | 'utc'; - -export interface TimeFormatSpecifier { - year?: string; - quarter?: string; - month?: string; - date?: string; - week?: string; - day?: string; - hours?: string; - minutes?: string; - seconds?: string; - milliseconds?: string; -} - -export interface Axis extends BaseAxis { - /** - * The orientation of the axis. One of `"top"`, `"bottom"`, `"left"` or `"right"`. The orientation can be used to further specialize the axis type (e.g., a y axis oriented for the right edge of the chart). - * - * __Default value:__ `"bottom"` for x-axes and `"left"` for y-axes. - */ - orient: AxisOrient | SignalRef; - - /** - * The name of the scale backing the axis component. - */ - scale: string; - - /** - * The name of the scale to use for including grid lines. By default grid lines are driven by the same scale as the ticks and labels. - */ - gridScale?: string; - - /** - * The format specifier pattern for axis labels. For numerical values, must be a legal [d3-format](https://github.com/d3/d3-format#locale_format) specifier. For date-time values, must be a legal [d3-time-format](https://github.com/d3/d3-time-format#locale_format) specifier or multi-format object. - */ - format?: string | TimeFormatSpecifier | SignalRef; - - /** - * The format type for axis labels (number, time, or utc). - */ - formatType?: FormatType | SignalRef; - - /** - * A title for the axis (none by default). - */ - title?: Text | SignalRef; - - /** - * The orthogonal offset in pixels by which to displace the axis from its position along the edge of the chart. - */ - offset?: NumberValue; - - /** - * The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate. - * - * __Default value__: `0` - */ - position?: NumberValue; - - /** - * A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are "nice" (multiples of `2`, `5`, `10`) and lie within the underlying scale's range. - * - * For scales of type `"time"` or `"utc"`, the tick count can instead be a time interval specifier. Legal string values are `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and "year". Alternatively, an object-valued interval specifier of the form `{"interval": "month", "step": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary. - * - * @minimum 0 - */ - tickCount?: TickCount; - - /** - * The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value. - */ - tickMinStep?: number | SignalRef; - - /** - * Explicitly set the visible axis tick and label values. - */ - values?: any[] | SignalRef; - - /** - * Mark definitions for custom axis encoding. - */ - encode?: AxisEncode; -} - -export interface AxisEncode { - /** - * Custom encoding for the axis container. - */ - axis?: GuideEncodeEntry; - /** - * Custom encoding for axis tick rule marks. - */ - ticks?: GuideEncodeEntry; - /** - * Custom encoding for axis label text marks. - */ - labels?: GuideEncodeEntry; - /** - * Custom encoding for the axis title text mark. - */ - title?: GuideEncodeEntry; - /** - * Custom encoding for axis gridline rule marks. - */ - grid?: GuideEncodeEntry; - /** - * Custom encoding for the axis domain rule mark. - */ - domain?: GuideEncodeEntry; -} - -export interface BaseAxis { - /** - * Coordinate space translation offset for axis layout. By default, axes are translated by a 0.5 pixel offset for both the x and y coordinates in order to align stroked lines with the pixel grid. However, for vector graphics output these pixel-specific adjustments may be undesirable, in which case translate can be changed (for example, to zero). - * - * __Default value:__ `0.5` - */ - translate?: NumberValue; - - /** - * The minimum extent in pixels that axis ticks and labels should use. This determines a minimum offset value for axis titles. - * - * __Default value:__ `30` for y-axis; `undefined` for x-axis. - */ - minExtent?: NumberValue; - - /** - * The maximum extent in pixels that axis ticks and labels should use. This determines a maximum offset value for axis titles. - * - * __Default value:__ `undefined`. - */ - maxExtent?: NumberValue; - - /** - * An interpolation fraction indicating where, for `band` scales, axis ticks should be positioned. A value of `0` places ticks at the left edge of their bands. A value of `0.5` places ticks in the middle of their bands. - * - * __Default value:__ `0.5` - */ - bandPosition?: NumberValue; - - // ---------- ARIA ---------- - /** - * A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only). - * If `false`, the "aria-hidden" attribute will be set on the output SVG group, removing the axis from the ARIA accessibility tree. - * - * __Default value:__ `true` - */ - aria?: boolean; - - /** - * A text description of this axis for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only). - * If the `aria` property is true, for SVG output the ["aria-label" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute) will be set to this description. - * If the description is unspecified it will be automatically generated. - */ - description?: string; - - // ---------- Title ---------- - /** - * The padding, in pixels, between title and axis. - */ - titlePadding?: NumberValue; - - /** - * Horizontal text alignment of axis titles. - */ - titleAlign?: AlignValue; - - /** - * Text anchor position for placing axis titles. - */ - titleAnchor?: AnchorValue; - - /** - * Angle in degrees of axis titles. - */ - titleAngle?: NumberValue; - - /** - * X-coordinate of the axis title relative to the axis group. - */ - titleX?: NumberValue; - - /** - * Y-coordinate of the axis title relative to the axis group. - */ - titleY?: NumberValue; - - /** - * Vertical text baseline for axis titles. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone. - */ - titleBaseline?: TextBaselineValue; - - /** - * Color of the title, can be in hex color code or regular color name. - */ - titleColor?: ColorValue; - - /** - * Font of the title. (e.g., `"Helvetica Neue"`). - */ - titleFont?: StringValue; - - /** - * Font size of the title. - * - * @minimum 0 - */ - titleFontSize?: NumberValue; - - /** - * Font style of the title. - */ - titleFontStyle?: FontStyleValue; - - /** - * Font weight of the title. - * This can be either a string (e.g `"bold"`, `"normal"`) or a number (`100`, `200`, `300`, ..., `900` where `"normal"` = `400` and `"bold"` = `700`). - */ - titleFontWeight?: FontWeightValue; - - /** - * Maximum allowed pixel width of axis titles. - * - * @minimum 0 - */ - titleLimit?: NumberValue; - - /** - * Line height in pixels for multi-line title text or title text with `"line-top"` or `"line-bottom"` baseline. - */ - titleLineHeight?: NumberValue; - - /** - * Opacity of the axis title. - */ - titleOpacity?: NumberValue; - - // ---------- Domain ---------- - /** - * A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis. - * - * __Default value:__ `true` - */ - domain?: boolean; - - /** - * The stroke cap for the domain line's ending style. One of `"butt"`, `"round"` or `"square"`. - * - * __Default value:__ `"butt"` - */ - domainCap?: StrokeCapValue; - - /** - * An array of alternating [stroke, space] lengths for dashed domain lines. - */ - domainDash?: DashArrayValue; - - /** - * The pixel offset at which to start drawing with the domain dash array. - */ - domainDashOffset?: NumberValue; - - /** - * Color of axis domain line. - * - * __Default value:__ `"gray"`. - */ - domainColor?: ColorValue; - - /** - * Opacity of the axis domain line. - */ - domainOpacity?: NumberValue; - - /** - * Stroke width of axis domain line - * - * __Default value:__ `1` - */ - domainWidth?: NumberValue; - - // ---------- Ticks ---------- - /** - * Boolean value that determines whether the axis should include ticks. - * - * __Default value:__ `true` - */ - ticks?: BooleanValue; - - /** - * For band scales, indicates if ticks and grid lines should be placed at the `"center"` of a band (default) or at the band `"extent"`s to indicate intervals - */ - tickBand?: 'center' | 'extent' | SignalRef; - - /** - * The stroke cap for the tick lines' ending style. One of `"butt"`, `"round"` or `"square"`. - * - * __Default value:__ `"butt"` - */ - - tickCap?: StrokeCapValue; - - /** - * The color of the axis's tick. - * - * __Default value:__ `"gray"` - */ - tickColor?: ColorValue; - - /** - * An array of alternating [stroke, space] lengths for dashed tick mark lines. - */ - tickDash?: DashArrayValue; - - /** - * The pixel offset at which to start drawing with the tick mark dash array. - */ - tickDashOffset?: NumberValue; - - /** - * Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `"bandPosition": 1` and an axis `"padding"` value of `0`. - */ - tickExtra?: BooleanValue; - - /** - * Position offset in pixels to apply to ticks, labels, and gridlines. - */ - tickOffset?: NumberValue; - - /** - * Opacity of the ticks. - */ - tickOpacity?: NumberValue; - - /** - * Boolean flag indicating if pixel position values should be rounded to the nearest integer. - * - * __Default value:__ `true` - */ - tickRound?: BooleanValue; - - /** - * The size in pixels of axis ticks. - * - * __Default value:__ `5` - * @minimum 0 - */ - tickSize?: NumberValue; - - /** - * The width, in pixels, of ticks. - * - * __Default value:__ `1` - * @minimum 0 - */ - tickWidth?: NumberValue; - - // ---------- Grid ---------- - /** - * A boolean flag indicating if grid lines should be included as part of the axis. - */ - grid?: boolean; - - /** - * The stroke cap for grid lines' ending style. One of `"butt"`, `"round"` or `"square"`. - * - * __Default value:__ `"butt"` - */ - gridCap?: StrokeCapValue; - - /** - * Color of gridlines. - * - * __Default value:__ `"lightGray"`. - */ - gridColor?: ColorValue; - - /** - * An array of alternating [stroke, space] lengths for dashed grid lines. - */ - gridDash?: DashArrayValue; - - /** - * The pixel offset at which to start drawing with the grid dash array. - */ - gridDashOffset?: NumberValue; - - /** - * The stroke opacity of grid (value between [0,1]) - * - * __Default value:__ `1` - * @minimum 0 - * @maximum 1 - */ - gridOpacity?: NumberValue; - - /** - * The grid width, in pixels. - * - * __Default value:__ `1` - * @minimum 0 - */ - gridWidth?: NumberValue; - - // ---------- Labels ---------- - /** - * A boolean flag indicating if labels should be included as part of the axis. - * - * __Default value:__ `true`. - */ - labels?: boolean; - - /** - * Horizontal text alignment of axis tick labels, overriding the default setting for the current axis orientation. - */ - labelAlign?: AlignValue; - - /** - * Vertical text baseline of axis tick labels, overriding the default setting for the current axis orientation. - * One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone. - */ - labelBaseline?: TextBaselineValue; - - /** - * Indicates if labels should be hidden if they exceed the axis range. If `false` (the default) no bounds overlap analysis is performed. If `true`, labels will be hidden if they exceed the axis range by more than 1 pixel. If this property is a number, it specifies the pixel tolerance: the maximum amount by which a label bounding box may exceed the axis range. - * - * __Default value:__ `false`. - */ - labelBound?: number | boolean | SignalRef; - - /** - * Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks. - */ - labelFlush?: number | boolean | SignalRef; - - /** - * Indicates the number of pixels by which to offset flush-adjusted labels. For example, a value of `2` will push flush-adjusted labels 2 pixels outward from the center of the axis. Offsets can help the labels better visually group with corresponding axis ticks. - * - * __Default value:__ `0`. - */ - labelFlushOffset?: number | SignalRef; - - /** - * Line height in pixels for multi-line label text or label text with `"line-top"` or `"line-bottom"` baseline. - */ - labelLineHeight?: NumberValue; - - /** - * The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `"parity"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `"greedy"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes). - */ - labelOverlap?: LabelOverlap | SignalRef; - - /** - * The minimum separation that must be between label bounding boxes for them to be considered non-overlapping (default `0`). This property is ignored if *labelOverlap* resolution is not enabled. - */ - labelSeparation?: number | SignalRef; - - /** - * The rotation angle of the axis labels. - * - * __Default value:__ `-90` for nominal and ordinal fields; `0` otherwise. - * - * @minimum -360 - * @maximum 360 - */ - labelAngle?: NumberValue; - - /** - * The color of the tick label, can be in hex color code or regular color name. - */ - labelColor?: ColorValue; - - /** - * The font of the tick label. - */ - labelFont?: StringValue; - - /** - * The font size of the label, in pixels. - * - * @minimum 0 - */ - labelFontSize?: NumberValue; - - /** - * Font style of the title. - */ - labelFontStyle?: FontStyleValue; - - /** - * Font weight of axis tick labels. - */ - labelFontWeight?: FontWeightValue; - - /** - * Maximum allowed pixel width of axis tick labels. - * - * __Default value:__ `180` - */ - labelLimit?: NumberValue; - - /** - * The opacity of the labels. - */ - labelOpacity?: NumberValue; - - /** - * Position offset in pixels to apply to labels, in addition to tickOffset. - * - * __Default value:__ `0` - */ - labelOffset?: NumberValue; - - /** - * The padding in pixels between labels and ticks. - * - * __Default value:__ `2` - */ - labelPadding?: NumberValue; - - /** - * The integer z-index indicating the layering of the axis group relative to other axis, mark, and legend groups. - * - * @TJS-type integer - * @minimum 0 - */ - zindex?: number; -} diff --git a/node_modules/vega-typings/types/spec/bind.d.ts b/node_modules/vega-typings/types/spec/bind.d.ts deleted file mode 100644 index 6da8e60..0000000 --- a/node_modules/vega-typings/types/spec/bind.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -export type Element = string; -export interface BaseBinding { - type?: string; - element?: Element; - debounce?: number; - name?: string; -} -export interface InputBinding extends BaseBinding { - input?: string; - placeholder?: string; - autocomplete?: string; -} -export interface BindCheckbox extends BaseBinding { - input: 'checkbox'; -} -export interface BindRadioSelect extends BaseBinding { - input: 'radio' | 'select'; - options: any[]; - labels?: string[]; -} -export interface BindRange extends BaseBinding { - input: 'range'; - min?: number; - max?: number; - step?: number; -} -export type Binding = BindCheckbox | BindRadioSelect | BindRange | InputBinding; diff --git a/node_modules/vega-typings/types/spec/color.d.ts b/node_modules/vega-typings/types/spec/color.d.ts deleted file mode 100644 index d86b8db..0000000 --- a/node_modules/vega-typings/types/spec/color.d.ts +++ /dev/null @@ -1,162 +0,0 @@ -/** - * @format color-hex - */ -export type HexColor = string; - -export type ColorName = - | 'black' - | 'silver' - | 'gray' - | 'white' - | 'maroon' - | 'red' - | 'purple' - | 'fuchsia' - | 'green' - | 'lime' - | 'olive' - | 'yellow' - | 'navy' - | 'blue' - | 'teal' - | 'aqua' - | 'orange' - | 'aliceblue' - | 'antiquewhite' - | 'aquamarine' - | 'azure' - | 'beige' - | 'bisque' - | 'blanchedalmond' - | 'blueviolet' - | 'brown' - | 'burlywood' - | 'cadetblue' - | 'chartreuse' - | 'chocolate' - | 'coral' - | 'cornflowerblue' - | 'cornsilk' - | 'crimson' - | 'cyan' - | 'aqua' - | 'darkblue' - | 'darkcyan' - | 'darkgoldenrod' - | 'darkgray' - | 'darkgreen' - | 'darkgrey' - | 'darkkhaki' - | 'darkmagenta' - | 'darkolivegreen' - | 'darkorange' - | 'darkorchid' - | 'darkred' - | 'darksalmon' - | 'darkseagreen' - | 'darkslateblue' - | 'darkslategray' - | 'darkslategrey' - | 'darkturquoise' - | 'darkviolet' - | 'deeppink' - | 'deepskyblue' - | 'dimgray' - | 'dimgrey' - | 'dodgerblue' - | 'firebrick' - | 'floralwhite' - | 'forestgreen' - | 'gainsboro' - | 'ghostwhite' - | 'gold' - | 'goldenrod' - | 'greenyellow' - | 'grey' - | 'honeydew' - | 'hotpink' - | 'indianred' - | 'indigo' - | 'ivory' - | 'khaki' - | 'lavender' - | 'lavenderblush' - | 'lawngreen' - | 'lemonchiffon' - | 'lightblue' - | 'lightcoral' - | 'lightcyan' - | 'lightgoldenrodyellow' - | 'lightgray' - | 'lightgreen' - | 'lightgrey' - | 'lightpink' - | 'lightsalmon' - | 'lightseagreen' - | 'lightskyblue' - | 'lightslategray' - | 'lightslategrey' - | 'lightsteelblue' - | 'lightyellow' - | 'limegreen' - | 'linen' - | 'magenta' - | 'fuchsia' - | 'mediumaquamarine' - | 'mediumblue' - | 'mediumorchid' - | 'mediumpurple' - | 'mediumseagreen' - | 'mediumslateblue' - | 'mediumspringgreen' - | 'mediumturquoise' - | 'mediumvioletred' - | 'midnightblue' - | 'mintcream' - | 'mistyrose' - | 'moccasin' - | 'navajowhite' - | 'oldlace' - | 'olivedrab' - | 'orangered' - | 'orchid' - | 'palegoldenrod' - | 'palegreen' - | 'paleturquoise' - | 'palevioletred' - | 'papayawhip' - | 'peachpuff' - | 'peru' - | 'pink' - | 'plum' - | 'powderblue' - | 'rosybrown' - | 'royalblue' - | 'saddlebrown' - | 'salmon' - | 'sandybrown' - | 'seagreen' - | 'seashell' - | 'sienna' - | 'skyblue' - | 'slateblue' - | 'slategray' - | 'slategrey' - | 'snow' - | 'springgreen' - | 'steelblue' - | 'tan' - | 'thistle' - | 'tomato' - | 'turquoise' - | 'violet' - | 'wheat' - | 'whitesmoke' - | 'yellowgreen' - | 'rebeccapurple'; - -export type Color = - | ColorName - | HexColor - // RGB, HSL, HSV, HWB, CMYK colors - | string; diff --git a/node_modules/vega-typings/types/spec/config.d.ts b/node_modules/vega-typings/types/spec/config.d.ts deleted file mode 100644 index 9cae6a2..0000000 --- a/node_modules/vega-typings/types/spec/config.d.ts +++ /dev/null @@ -1,651 +0,0 @@ -import { - Align, - AutoSize, - EventType, - FontStyle, - FontWeight, - Interpolate, - Mark, - Orientation, - Padding, - RangeScheme, - SymbolShape, - TextBaseline, -} from '.'; -import { BaseAxis } from './axis'; -import { Color } from './color'; -import { - Blend, - ColorValueRef, - Gradient, - NumericValueRef, - ScaledValueRef, - Text, - TextDirection, -} from './encode.d'; -import { LayoutBounds } from './layout'; -import { BaseLegend } from './legend'; -import { Locale } from './locale'; -import { BaseProjection } from './projection'; -import { InitSignal, NewSignal, SignalRef } from './signal'; -import { BaseTitle, TitleAnchor } from './title'; - -export type KeepSignal = T extends SignalRef ? SignalRef : never; - -/** - * Config properties cannot be scaled or reference fields but they can reference signals. - */ -export type ExcludeMappedValueRef = { - [P in keyof T]: - | Exclude | NumericValueRef | ColorValueRef> - | KeepSignal; -}; - -export interface Config - extends Partial>, - Partial> { - autosize?: AutoSize | SignalRef; - background?: null | Color | SignalRef; - padding?: Padding | SignalRef; - group?: any; // TODO - events?: { - bind?: 'any' | 'container' | 'none'; - defaults?: DefaultsConfig; - globalCursor?: boolean; - selector?: boolean | string[]; - timer?: boolean; - view?: boolean | string[]; - window?: boolean | string[]; - }; - locale?: Locale; - - /** - * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the "lineBreak" mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid. - */ - lineBreak?: string | SignalRef; - style?: { - [style: string]: MarkConfig; - }; - legend?: LegendConfig; - title?: TitleConfig; - projection?: ProjectionConfig; - range?: RangeConfig; - signals?: (InitSignal | NewSignal)[]; -} - -/** - * The defaults object should have a single property: either "prevent" (to indicate which events should have default behavior suppressed) or "allow" (to indicate only those events whose default behavior should be allowed). - */ -export type DefaultsConfig = - | Record<'prevent', boolean | EventType[]> - | Record<'allow', boolean | EventType[]>; - -export type MarkConfigKeys = 'mark' | Mark['type']; - -export type StrokeCap = 'butt' | 'round' | 'square'; -export type StrokeJoin = 'miter' | 'round' | 'bevel'; - -export interface MarkConfig { - /** - * A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only). - * If `false`, the "aria-hidden" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree. - */ - aria?: boolean | SignalRef; - - /** - * Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only). - * If specified, this property determines the "role" attribute. - * Warning: this property is experimental and may be changed in the future. - */ - ariaRole?: string | SignalRef; - - /** - * A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only). - * If specified, this property determines the "aria-roledescription" attribute. - * Warning: this property is experimental and may be changed in the future. - */ - ariaRoleDescription?: string | SignalRef; - - /** - * A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only). - * If specified, this property determines the ["aria-label" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute). - */ - description?: string | SignalRef; - - /** - * Width of the marks. - */ - width?: number | SignalRef; - - /** - * Height of the marks. - */ - height?: number | SignalRef; - - /** - * Whether to keep aspect ratio of image marks. - */ - aspect?: boolean; - - /** - * Default fill color. - * - * __Default value:__ (None) - * - */ - fill?: Color | Gradient | null | SignalRef; - - /** - * Default stroke color. - * - * __Default value:__ (None) - * - */ - stroke?: Color | Gradient | null | SignalRef; - - // ---------- Opacity ---------- - /** - * The overall opacity (value between [0,1]). - * - * @minimum 0 - * @maximum 1 - */ - opacity?: number | SignalRef; - - /** - * The fill opacity (value between [0,1]). - * - * __Default value:__ `1` - * - * @minimum 0 - * @maximum 1 - */ - fillOpacity?: number | SignalRef; - - /** - * The stroke opacity (value between [0,1]). - * - * __Default value:__ `1` - * - * @minimum 0 - * @maximum 1 - */ - strokeOpacity?: number | SignalRef; - - /** - * The color blend mode for drawing an item on its current background. Any valid [CSS mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) value can be used. - * - * __Default value: `"source-over"` - */ - blend?: Blend; - - // ---------- Stroke Style ---------- - /** - * The stroke width, in pixels. - * - * @minimum 0 - */ - strokeWidth?: number | SignalRef; - - /** - * An array of alternating stroke, space lengths for creating dashed or dotted lines. - */ - strokeDash?: number[] | SignalRef; - - /** - * The offset (in pixels) into which to begin drawing with the stroke dash array. - */ - strokeDashOffset?: number | SignalRef; - - /** - * The offset in pixels at which to draw the group stroke and fill. If unspecified, the default behavior is to dynamically offset stroked groups such that 1 pixel stroke widths align with the pixel grid. - */ - strokeOffset?: number | SignalRef; - - /** - * The stroke cap for line ending style. One of `"butt"`, `"round"`, or `"square"`. - * - * __Default value:__ `"butt"` - * - */ - strokeCap?: StrokeCap | SignalRef; - - /** - * The stroke line join method. One of `"miter"`, `"round"` or `"bevel"`. - * - * __Default value:__ `"miter"` - * - */ - strokeJoin?: StrokeJoin | SignalRef; - - /** - * The miter limit at which to bevel a line join. - */ - strokeMiterLimit?: number | SignalRef; - - /** - * The orientation of the area mark. One of `horizontal` or `vertical` (the default). With a vertical orientation, an area mark is defined by the `x`, `y`, and (`y2` or `height`) properties; with a horizontal orientation, the `y`, `x` and (`x2` or `width`) properties must be specified instead. - */ - orient?: Orientation | SignalRef; - - // ---------- Interpolation: Line / area ---------- - /** - * The line interpolation method to use for line and area marks. One of the following: - * - `"linear"`: piecewise linear segments, as in a polyline. - * - `"linear-closed"`: close the linear segments to form a polygon. - * - `"step"`: alternate between horizontal and vertical segments, as in a step function. - * - `"step-before"`: alternate between vertical and horizontal segments, as in a step function. - * - `"step-after"`: alternate between horizontal and vertical segments, as in a step function. - * - `"basis"`: a B-spline, with control point duplication on the ends. - * - `"basis-open"`: an open B-spline; may not intersect the start or end. - * - `"basis-closed"`: a closed B-spline, as in a loop. - * - `"cardinal"`: a Cardinal spline, with control point duplication on the ends. - * - `"cardinal-open"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points. - * - `"cardinal-closed"`: a closed Cardinal spline, as in a loop. - * - `"bundle"`: equivalent to basis, except the tension parameter is used to straighten the spline. - * - `"monotone"`: cubic interpolation that preserves monotonicity in y. - */ - interpolate?: Interpolate | SignalRef; - - /** - * Depending on the interpolation type, sets the tension parameter (for line and area marks). - */ - tension?: number | SignalRef; - - /** - * Shape of the point marks. Supported values include: - * - plotting shapes: `"circle"`, `"square"`, `"cross"`, `"diamond"`, `"triangle-up"`, `"triangle-down"`, `"triangle-right"`, or `"triangle-left"`. - * - the line symbol `"stroke"` - * - centered directional shapes `"arrow"`, `"wedge"`, or `"triangle"` - * - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.) - * - * __Default value:__ `"circle"` - */ - shape?: SymbolShape | string | SignalRef; - - /** - * The area in pixels of the symbols bounding box. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value. - * - * __Default value:__ `30` - * - * @minimum 0 - */ - size?: number | SignalRef; - - // Text / Label Mark Config - /** - * The horizontal alignment of the text. One of `"left"`, `"right"`, `"center"`. - */ - align?: Align | SignalRef; - - /** - * The rotation angle of the text, in degrees. - * - * @minimum 0 - * @maximum 360 - */ - angle?: number | SignalRef; - - /** - * The start angle in radians for arc marks. - * A value of `0` indicates up (north), increasing values proceed clockwise. - */ - startAngle?: number | SignalRef; - - /** - * The end angle in radians for arc marks. - * A value of `0` indicates up (north), increasing values proceed clockwise. - */ - endAngle?: number | SignalRef; - - /** - * The angular padding applied to sides of the arc, in radians. - */ - padAngle?: number | SignalRef; - - /** - * The inner radius in pixels of arc marks. - * - * @minimum 0 - * __Default value:__ `0` - */ - innerRadius?: number | SignalRef; - - /** - * The outer radius in pixels of arc marks. - * - * @minimum 0 - * __Default value:__ `0` - */ - outerRadius?: number | SignalRef; - - /** - * The vertical alignment of the text. One of `"top"`, `"bottom"`, `"middle"`, `"alphabetic"`. - * - * __Default value:__ `"middle"` - * - */ - baseline?: TextBaseline | SignalRef; - - /** - * The direction of the text. One of `"ltr"` (left-to-right) or `"rtl"` (right-to-left). This property determines on which side is truncated in response to the limit parameter. - * - * __Default value:__ `"ltr"` - */ - dir?: TextDirection | SignalRef; - - /** - * The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property. - */ - dx?: number | SignalRef; - - /** - * The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property. - */ - dy?: number | SignalRef; - - /** - * The ellipsis string for text truncated in response to the limit parameter. - * - * __Default value:__ `"…"` - */ - ellipsis?: string; - - /** - * Polar coordinate radial offset, in pixels, of the text label from the origin determined by the `x` and `y` properties. - * - * @minimum 0 - */ - radius?: number | SignalRef; - - /** - * The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. - * - * __Default value:__ `0` -- indicating no limit - */ - limit?: number | SignalRef; - - /** - * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property is ignored if the text is array-valued. - */ - lineBreak?: string | SignalRef; - - /** - * The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks. - */ - lineHeight?: number | SignalRef; - - /** - * Polar coordinate angle, in radians, of the text label from the origin determined by the `x` and `y` properties. Values for `theta` follow the same convention of `arc` mark `startAngle` and `endAngle` properties: angles are measured in radians, with `0` indicating "north". - */ - theta?: number | SignalRef; - - /** - * The typeface to set the text in (e.g., `"Helvetica Neue"`). - */ - font?: string | SignalRef; - - /** - * The font size, in pixels. - * - * __Default value:__ `11` - * - * @minimum 0 - */ - fontSize?: number | SignalRef; - - /** - * The font style (e.g., `"italic"`). - */ - fontStyle?: FontStyle | SignalRef; - /** - * The font weight. - * This can be either a string (e.g `"bold"`, `"normal"`) or a number (`100`, `200`, `300`, ..., `900` where `"normal"` = `400` and `"bold"` = `700`). - */ - fontWeight?: FontWeight | SignalRef; - - /** - * Placeholder text if the `text` channel is not specified - */ - text?: Text | SignalRef; - - /** - * A URL to load upon mouse click. If defined, the mark acts as a hyperlink. - * - * @format uri - */ - href?: string | SignalRef; - - /** - * The tooltip text to show upon mouse hover. - */ - tooltip?: string | SignalRef; - - /** - * The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used. - */ - cursor?: Cursor | SignalRef; - - // ---------- Corner Radius: Bar, Tick, Rect ---------- - - /** - * The radius in pixels of rounded rectangles or arcs' corners. - * - * __Default value:__ `0` - */ - cornerRadius?: number | SignalRef; - - /** - * The radius in pixels of rounded rectangles' top right corner. - * - * __Default value:__ `0` - */ - cornerRadiusTopLeft?: number | SignalRef; - - /** - * The radius in pixels of rounded rectangles' top left corner. - * - * __Default value:__ `0` - */ - cornerRadiusTopRight?: number | SignalRef; - - /** - * The radius in pixels of rounded rectangles' bottom right corner. - * - * __Default value:__ `0` - */ - cornerRadiusBottomRight?: number | SignalRef; - - /** - * The radius in pixels of rounded rectangles' bottom left corner. - * - * __Default value:__ `0` - */ - cornerRadiusBottomLeft?: number | SignalRef; -} - -export type Cursor = - | 'auto' - | 'default' - | 'none' - | 'context-menu' - | 'help' - | 'pointer' - | 'progress' - | 'wait' - | 'cell' - | 'crosshair' - | 'text' - | 'vertical-text' - | 'alias' - | 'copy' - | 'move' - | 'no-drop' - | 'not-allowed' - | 'e-resize' - | 'n-resize' - | 'ne-resize' - | 'nw-resize' - | 's-resize' - | 'se-resize' - | 'sw-resize' - | 'w-resize' - | 'ew-resize' - | 'ns-resize' - | 'nesw-resize' - | 'nwse-resize' - | 'col-resize' - | 'row-resize' - | 'all-scroll' - | 'zoom-in' - | 'zoom-out' - | 'grab' - | 'grabbing'; - -export type AxisConfigKeys = - | 'axis' - | 'axisX' - | 'axisY' - | 'axisTop' - | 'axisRight' - | 'axisBottom' - | 'axisLeft' - | 'axisBand'; - -export type AxisConfig = ExcludeMappedValueRef; - -/** - * Legend config without signals so we can use it in Vega-Lite. - */ -export interface LegendConfig extends ExcludeMappedValueRef { - /** - * The default direction (`"horizontal"` or `"vertical"`) for gradient legends. - * - * __Default value:__ `"vertical"`. - */ - gradientDirection?: Orientation; - - /** - * The maximum allowed length in pixels of color ramp gradient labels. - */ - gradientLabelLimit?: number | SignalRef; - - /** - * Vertical offset in pixels for color ramp gradient labels. - * - * __Default value:__ `2`. - */ - gradientLabelOffset?: number | SignalRef; - - /** - * Default fill color for legend symbols. Only applied if there is no `"fill"` scale color encoding for the legend. - * - * __Default value:__ `"transparent"`. - */ - symbolBaseFillColor?: null | Color | SignalRef; - - /** - * Default stroke color for legend symbols. Only applied if there is no `"fill"` scale color encoding for the legend. - * - * __Default value:__ `"gray"`. - */ - symbolBaseStrokeColor?: null | Color | SignalRef; - - /** - * The default direction (`"horizontal"` or `"vertical"`) for symbol legends. - * - * __Default value:__ `"vertical"`. - */ - symbolDirection?: Orientation; - - /** - * Border stroke dash pattern for the full legend. - */ - strokeDash?: number[] | SignalRef; - - /** - * Border stroke width for the full legend. - */ - strokeWidth?: number | SignalRef; - - /** - * Legend orient group layout parameters. - */ - layout?: LegendLayout; -} - -export interface BaseLegendLayout { - /** - * The anchor point for legend orient group layout. - */ - anchor?: TitleAnchor | SignalRef; - - /** - * The bounds calculation to use for legend orient group layout. - */ - bounds?: LayoutBounds; - - /** - * A flag to center legends within a shared orient group. - */ - center?: boolean | SignalRef; - - /** - * The layout direction for legend orient group layout. - */ - direction?: Orientation | SignalRef; - - /** - * The pixel margin between legends within a orient group. - */ - margin?: number | SignalRef; - - /** - * The pixel offset from the chart body for a legend orient group. - */ - offset?: number | SignalRef; -} - -export interface LegendLayout extends BaseLegendLayout { - left?: BaseLegendLayout; - right?: BaseLegendLayout; - top?: BaseLegendLayout; - bottom?: BaseLegendLayout; - 'top-left'?: BaseLegendLayout; - 'top-right'?: BaseLegendLayout; - 'bottom-left'?: BaseLegendLayout; - 'bottom-right'?: BaseLegendLayout; -} - -export type TitleConfig = ExcludeMappedValueRef; - -export type ProjectionConfig = ExcludeMappedValueRef; - -export type RangeConfig = { - /** - * Default [color scheme](https://vega.github.io/vega/docs/schemes/) for categorical data. - */ - category?: RangeScheme | string[]; - /** - * Default [color scheme](https://vega.github.io/vega/docs/schemes/) for diverging quantitative ramps. - */ - diverging?: RangeScheme | string[]; - /** - * Default [color scheme](https://vega.github.io/vega/docs/schemes/) for quantitative heatmaps. - */ - heatmap?: RangeScheme | string[]; - /** - * Default [color scheme](https://vega.github.io/vega/docs/schemes/) for rank-ordered data. - */ - ordinal?: RangeScheme | string[]; - /** - * Default [color scheme](https://vega.github.io/vega/docs/schemes/) for sequential quantitative ramps. - */ - ramp?: RangeScheme | string[]; - /** - * Array of [symbol](https://vega.github.io/vega/docs/marks/symbol/) names or paths for the default shape palette. - */ - symbol?: SymbolShape[]; -} & { - [name: string]: RangeScheme | number[] | boolean[] | string[] | SymbolShape[]; -}; diff --git a/node_modules/vega-typings/types/spec/data.d.ts b/node_modules/vega-typings/types/spec/data.d.ts deleted file mode 100644 index 8cb28db..0000000 --- a/node_modules/vega-typings/types/spec/data.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { OnTrigger, Transforms, SignalRef } from '.'; - -export type DataType = 'boolean' | 'number' | 'date' | 'string'; -export type Parse = - | 'auto' - | { - [f: string]: DataType | string; - }; -export interface FormatJSON { - type: 'json'; - parse?: Parse; - property?: string | SignalRef; - copy?: boolean; -} -export interface FormatSV { - type: 'csv' | 'tsv'; - header?: string[]; - parse?: Parse; -} -export interface FormatDSV { - type: 'dsv'; - header?: string[]; - parse?: Parse; - delimiter: string; -} -export type FormatTopoJSON = { - type: 'topojson'; - property?: string; -} & ( - | { - feature: string; - } - | { - mesh: string; - filter: 'interior' | 'exterior' | null; - } -); -export type Format = FormatJSON | FormatSV | FormatDSV | FormatTopoJSON | { parse: Parse }; - -export interface BaseData { - name: string; - on?: OnTrigger[]; - transform?: Transforms[]; -} - -export type SourceData = { - source: string | string[]; -} & BaseData; - -export type ValuesData = { - values: Datum[] | object; - format?: Format | SignalRef; - async?: boolean | SignalRef; -} & BaseData; - -export type UrlData = { - url: string | SignalRef; - format?: Format | SignalRef; - async?: boolean | SignalRef; -} & BaseData; - -export type Data = SourceData | ValuesData | UrlData | BaseData; -export type Datum = any; diff --git a/node_modules/vega-typings/types/spec/encode.d.ts b/node_modules/vega-typings/types/spec/encode.d.ts deleted file mode 100644 index bf9765b..0000000 --- a/node_modules/vega-typings/types/spec/encode.d.ts +++ /dev/null @@ -1,459 +0,0 @@ -import { SignalRef } from '.'; -import { Color } from './color'; -import { Cursor, StrokeCap, StrokeJoin } from './config.d'; -import { TitleAnchor } from './title'; - -export type Field = string | SignalRef | DatumFieldRef | GroupFieldRef | ParentFieldRef; - -export interface DatumFieldRef { - datum: Field; -} - -export interface GroupFieldRef { - group: Field; - level?: number; -} - -export interface ParentFieldRef { - parent: Field; - level?: number; -} - -export type BaseValueRef = - | SignalRef - | { - value: T | null; - } - | { - field: Field; - }; - -export type ScaledValueRef = - | BaseValueRef - | { - scale: Field; - value: boolean | number | string | null; - } - | { - scale: Field; - field: Field; - } - | { - scale: Field; - band: boolean | number; - } - | { - scale: Field; - range: number | boolean; - }; - -export type NumericValueRef = (ScaledValueRef | {}) & { - exponent?: number | NumericValueRef; - mult?: number | NumericValueRef; - offset?: number | NumericValueRef; - round?: boolean; - extra?: boolean; -}; - -export type StringValueRef = ScaledValueRef; -export type SymbolShapeValueRef = ScaledValueRef; -export type FontWeightValueRef = ScaledValueRef; -export type FontStyleValueRef = ScaledValueRef; -export type AlignValueRef = ScaledValueRef; - -export type StrokeCapValueRef = ScaledValueRef; -export type AnchorValueRef = ScaledValueRef; -export type OrientValueRef = ScaledValueRef; -export type TextBaselineValueRef = ScaledValueRef; -export type TextValueRef = ScaledValueRef; -export type BooleanValueRef = ScaledValueRef; -export type ArrayValueRef = ScaledValueRef; -export type ArbitraryValueRef = NumericValueRef | ColorValueRef | ScaledValueRef; - -export interface ColorRGB { - r: NumericValueRef; - g: NumericValueRef; - b: NumericValueRef; -} -export interface ColorHSL { - h: NumericValueRef; - s: NumericValueRef; - l: NumericValueRef; -} -export interface ColorLAB { - l: NumericValueRef; - a: NumericValueRef; - b: NumericValueRef; -} -export interface ColorHCL { - h: NumericValueRef; - c: NumericValueRef; - l: NumericValueRef; -} - -export interface BaseGradient { - /** - * The type of gradient. - */ - gradient: 'linear' | 'radial'; -} - -export interface GradientStop { - /** - * The offset fraction for the color stop, indicating its position within the gradient. - */ - offset: number; - /** - * The color value at this point in the gradient. - */ - color: Color; -} - -export type Gradient = LinearGradient | RadialGradient; - -export interface LinearGradient extends BaseGradient { - /** - * The type of gradient. Use `"linear"` for a linear gradient. - */ - gradient: 'linear'; - /** - * An array of gradient stops defining the gradient color sequence. - */ - stops: GradientStop[]; - id?: string; - /** - * The starting x-coordinate, in normalized [0, 1] coordinates, of the linear gradient. - * - * __Default value:__ `0` - */ - x1?: number; - /** - * The starting y-coordinate, in normalized [0, 1] coordinates, of the linear gradient. - * - * __Default value:__ `0` - */ - y1?: number; - /** - * The ending x-coordinate, in normalized [0, 1] coordinates, of the linear gradient. - * - * __Default value:__ `1` - */ - x2?: number; - /** - * The ending y-coordinate, in normalized [0, 1] coordinates, of the linear gradient. - * - * __Default value:__ `0` - */ - y2?: number; -} - -export interface RadialGradient extends BaseGradient { - /** - * The type of gradient. Use `"radial"` for a radial gradient. - */ - gradient: 'radial'; - /** - * An array of gradient stops defining the gradient color sequence. - */ - stops: GradientStop[]; - id?: string; - /** - * The x-coordinate, in normalized [0, 1] coordinates, for the center of the inner circle for the gradient. - * - * __Default value:__ `0.5` - */ - x1?: number; - /** - * The y-coordinate, in normalized [0, 1] coordinates, for the center of the inner circle for the gradient. - * - * __Default value:__ `0.5` - */ - y1?: number; - /** - * The radius length, in normalized [0, 1] coordinates, of the inner circle for the gradient. - * - * __Default value:__ `0` - */ - r1?: number; - /** - * The x-coordinate, in normalized [0, 1] coordinates, for the center of the outer circle for the gradient. - * - * __Default value:__ `0.5` - */ - x2?: number; - /** - * The y-coordinate, in normalized [0, 1] coordinates, for the center of the outer circle for the gradient. - * - * __Default value:__ `0.5` - */ - y2?: number; - /** - * The radius length, in normalized [0, 1] coordinates, of the outer circle for the gradient. - * - * __Default value:__ `0.5` - */ - r2?: number; -} - -export type ColorValueRef = - | ScaledValueRef - | { value: LinearGradient | RadialGradient } - | { - gradient: Field; - start?: number[]; - stop?: number[]; - count?: number; - } - | { - color: ColorRGB | ColorHSL | ColorLAB | ColorHCL; - }; - -export type ProductionRule = - | T - | ({ - test?: string; - } & T)[]; - -export type Blend = - | null - | 'multiply' - | 'screen' - | 'overlay' - | 'darken' - | 'lighten' - | 'color-dodge' - | 'color-burn' - | 'hard-light' - | 'soft-light' - | 'difference' - | 'exclusion' - | 'hue' - | 'saturation' - | 'color' - | 'luminosity'; - -export interface EncodeEntry { - x?: ProductionRule; - x2?: ProductionRule; - xc?: ProductionRule; - width?: ProductionRule; - y?: ProductionRule; - y2?: ProductionRule; - yc?: ProductionRule; - height?: ProductionRule; - opacity?: ProductionRule; - fill?: ProductionRule; - fillOpacity?: ProductionRule; - stroke?: ProductionRule; - strokeWidth?: ProductionRule; - strokeOpacity?: ProductionRule; - strokeDash?: ProductionRule>; - strokeDashOffset?: ProductionRule; - strokeCap?: ProductionRule>; - strokeJoin?: ProductionRule>; - strokeMiterLimit?: ProductionRule; - blend?: ProductionRule>; - cursor?: ProductionRule>; - tooltip?: ProductionRule; - zindex?: ProductionRule; - /** - * A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only). - * If `false`, the "aria-hidden" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree. - */ - aria?: ProductionRule; - /** - * Sets the type of user interface element of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only). - * If specified, this property determines the "role" attribute. - * Warning: this property is experimental and may be changed in the future. - */ - ariaRole?: ProductionRule; - /** - * A human-readable, author-localized description for the role of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only). - * If specified, this property determines the "aria-roledescription" attribute. - * Warning: this property is experimental and may be changed in the future. - */ - ariaRoleDescription?: ProductionRule; - /** - * A text description of the mark item for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only). - * If specified, this property determines the ["aria-label" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute). - */ - description?: ProductionRule; - [k: string]: ProductionRule | undefined; -} - -export type Align = 'left' | 'center' | 'right'; -export interface AlignProperty { - align?: ProductionRule>; -} - -export type Orient = 'left' | 'right' | 'top' | 'bottom'; - -export interface DefinedProperty { - defined?: ProductionRule; -} - -export interface ThetaProperty { - theta?: ProductionRule; -} - -export interface ArcEncodeEntry extends EncodeEntry { - startAngle?: ProductionRule; - endAngle?: ProductionRule; - padAngle?: ProductionRule; - innerRadius?: ProductionRule; - outerRadius?: ProductionRule; - cornerRadius?: ProductionRule; -} - -export type Orientation = 'horizontal' | 'vertical'; - -export interface AreaEncodeEntry extends LineEncodeEntry { - orient?: ProductionRule>; -} - -export interface GroupEncodeEntry extends RectEncodeEntry { - clip?: ProductionRule; - strokeForeground?: ProductionRule; - strokeOffset?: ProductionRule; -} - -export type Baseline = 'top' | 'middle' | 'bottom'; - -export interface ImageEncodeEntry extends EncodeEntry, AlignProperty { - url?: ProductionRule; - aspect?: ProductionRule; - baseline?: ProductionRule>; - smooth?: ProductionRule; -} - -/** - * @TJS-type integer - * @minimum 100 - * @maximum 900 - */ -export type Interpolate = - | 'basis' - | 'basis-open' - | 'basis-closed' - | 'bundle' - | 'cardinal' - | 'cardinal-open' - | 'cardinal-closed' - | 'catmull-rom' - | 'linear' - | 'linear-closed' - | 'monotone' - | 'natural' - | 'step' - | 'step-before' - | 'step-after'; - -export interface LineEncodeEntry extends EncodeEntry, DefinedProperty { - interpolate?: ProductionRule>; - tension?: ProductionRule; -} - -export interface PathEncodeEntry extends EncodeEntry { - path?: ProductionRule; - angle?: ProductionRule; - scaleX?: ProductionRule; - scaleY?: ProductionRule; -} - -export interface RectEncodeEntry extends EncodeEntry { - cornerRadius?: ProductionRule; - cornerRadiusTopLeft?: ProductionRule; - cornerRadiusTopRight?: ProductionRule; - cornerRadiusBottomRight?: ProductionRule; - cornerRadiusBottomLeft?: ProductionRule; -} - -export type RuleEncodeEntry = EncodeEntry; - -export interface ShapeEncodeEntry extends EncodeEntry { - shape?: ProductionRule; -} - -export type SymbolShape = - | 'circle' - | 'square' - | 'cross' - | 'diamond' - | 'triangle-up' - | 'triangle-down' - | 'triangle-right' - | 'triangle-left' - | 'arrow' - | 'triangle' - | 'wedge' - | 'stroke' - | string; - -export interface SymbolEncodeEntry extends EncodeEntry { - size?: ProductionRule; - shape?: ProductionRule>; - angle?: ProductionRule; -} - -export type Text = string | string[]; - -export type TextBaseline = 'alphabetic' | Baseline | 'line-top' | 'line-bottom'; - -export type TextDirection = 'ltr' | 'rtl'; - -export type FontWeight = - | 'normal' - | 'bold' - | 'lighter' - | 'bolder' - | 100 - | 200 - | 300 - | 400 - | 500 - | 600 - | 700 - | 800 - | 900; - -// see https://developer.mozilla.org/en-US/docs/Web/CSS/font-style#Values -export type FontStyle = 'normal' | 'italic' | 'oblique' | string; - -export interface TextEncodeEntry extends EncodeEntry, AlignProperty, ThetaProperty { - text?: ProductionRule; - angle?: ProductionRule; - baseline?: ProductionRule; - dir?: ProductionRule>; - dx?: ProductionRule; - dy?: ProductionRule; - ellipsis?: ProductionRule; - font?: ProductionRule; - fontSize?: ProductionRule; - fontWeight?: ProductionRule; - fontStyle?: ProductionRule; - limit?: ProductionRule; - lineBreak?: ProductionRule; - - /** - * The height, in pixels, of each line of text in a multi-line text mark or a text mark with `"line-top"` or `"line-bottom"` baseline. - */ - lineHeight?: ProductionRule; - radius?: ProductionRule; -} - -export interface TrailEncodeEntry extends EncodeEntry, DefinedProperty {} - -export interface Encodable { - encode?: Encode; -} - -export type Encode = Partial>; - -export type EncodeEntryName = - | 'enter' - | 'update' - | 'exit' - | 'hover' - | 'leave' - | 'select' - | 'release'; diff --git a/node_modules/vega-typings/types/spec/expr.d.ts b/node_modules/vega-typings/types/spec/expr.d.ts deleted file mode 100644 index 07694a7..0000000 --- a/node_modules/vega-typings/types/spec/expr.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type Expr = string; -export interface ExprRef { - expr: Expr; -} diff --git a/node_modules/vega-typings/types/spec/index.d.ts b/node_modules/vega-typings/types/spec/index.d.ts deleted file mode 100644 index e4ea775..0000000 --- a/node_modules/vega-typings/types/spec/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { AutoSize } from './autosize'; -import { Color } from './color'; -import { Config } from './config'; -import { Encodable, EncodeEntry } from './encode'; -import { Padding } from './padding'; -import { Scope } from './scope'; -import { SignalRef } from './signal'; - -export interface Spec extends Scope, Encodable { - $schema?: string; - config?: Config; - description?: string; - width?: number | SignalRef; - height?: number | SignalRef; - padding?: Padding | SignalRef; - autosize?: AutoSize | SignalRef; - background?: Color | SignalRef; - style?: string | string[]; -} - -export * from './autosize'; -export * from './axis'; -export * from './bind'; -export * from './color'; -export * from './config'; -export * from './data'; -export * from './encode'; -export * from './expr'; -export * from './layout'; -export * from './legend'; -export * from './locale'; -export * from './mark'; -export * from './marktype'; -export * from './on-events'; -export * from './on-trigger'; -export * from './padding'; -export * from './projection'; -export * from './scale'; -export * from './scheme'; -export * from './scope'; -export * from './selector'; -export * from './signal'; -export * from './stream'; -export * from './title'; -export * from './transform'; -export * from './util'; -export * from './values'; diff --git a/node_modules/vega-typings/types/spec/layout.d.ts b/node_modules/vega-typings/types/spec/layout.d.ts deleted file mode 100644 index 38d319d..0000000 --- a/node_modules/vega-typings/types/spec/layout.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { SignalRef } from '.'; - -export type LayoutAlign = 'all' | 'each' | 'none'; -export type LayoutTitleAnchor = 'start' | 'end'; -export type LayoutBounds = 'full' | 'flush' | SignalRef; -export type LayoutOffset = - | number - | SignalRef - | { - rowHeader?: number | SignalRef; - rowFooter?: number | SignalRef; - rowTitle?: number | SignalRef; - columnHeader?: number | SignalRef; - columnFooter?: number | SignalRef; - columnTitle?: number | SignalRef; - }; - -export interface RowColumn { - row?: T | SignalRef; - column?: T | SignalRef; -} - -export interface LayoutParams { - align?: LayoutAlign | SignalRef | RowColumn; - bounds?: LayoutBounds; - columns?: number | SignalRef; - padding?: number | SignalRef | RowColumn; - offset?: LayoutOffset; - - headerBand?: number | SignalRef | RowColumn; - footerBand?: number | SignalRef | RowColumn; - - titleAnchor?: LayoutTitleAnchor | SignalRef | RowColumn; - titleBand?: number | SignalRef | RowColumn; -} - -export type Layout = SignalRef | LayoutParams; diff --git a/node_modules/vega-typings/types/spec/legend.d.ts b/node_modules/vega-typings/types/spec/legend.d.ts deleted file mode 100644 index bf40bdb..0000000 --- a/node_modules/vega-typings/types/spec/legend.d.ts +++ /dev/null @@ -1,483 +0,0 @@ -import { - GroupEncodeEntry, - Orientation, - RectEncodeEntry, - SignalRef, - SymbolEncodeEntry, - TextEncodeEntry, -} from '.'; -import { FormatType, LabelOverlap, TickCount, TimeFormatSpecifier } from './axis'; -import { Text } from './encode'; -import { LayoutAlign } from './layout'; -import { - AlignValue, - AnchorValue, - BooleanValue, - ColorValue, - DashArrayValue, - FontStyleValue, - FontWeightValue, - NumberValue, - OrientValue, - StringValue, - SymbolShapeValue, - TextBaselineValue, -} from './values'; - -export interface GuideEncodeEntry { - name?: string; - /** - * A boolean flag indicating if the guide element should respond to input events such as mouse hover. - */ - interactive?: boolean; - - /** - * A mark style property to apply to the guide group mark. - */ - style?: string | string[]; - enter?: T; - update?: T; - exit?: T; - hover?: T; -} - -export type LegendType = 'gradient' | 'symbol'; - -export type LegendOrient = - | 'none' - | 'left' - | 'right' - | 'top' - | 'bottom' - | 'top-left' - | 'top-right' - | 'bottom-left' - | 'bottom-right'; - -export interface Legend extends BaseLegend { - size?: string; - shape?: string; - fill?: string; - stroke?: string; - strokeDash?: string; - strokeWidth?: string; - opacity?: string; - - /** - * The type of legend to include. One of `"symbol"` for discrete symbol legends, or `"gradient"` for a continuous color gradient. If gradient is used only the fill or stroke scale parameters are considered. If unspecified, the type will be inferred based on the scale parameters used and their backing scale types. - */ - type?: LegendType; - - /** - * The direction of the legend, one of `"vertical"` (default) or `"horizontal"`. - * - * __Default value:__ `"vertical"` - */ - direction?: Orientation; - - /** - * The format specifier pattern for legend labels. For numerical values, must be a legal [d3-format](https://github.com/d3/d3-format#locale_format) specifier. For date-time values, must be a legal [d3-time-format](https://github.com/d3/d3-time-format#locale_format) specifier or multi-format object. - */ - format?: string | TimeFormatSpecifier | SignalRef; - - /** - * The format type for legend labels (number, time, or utc). - */ - formatType?: FormatType | SignalRef; - - /** - * The title for the legend. - */ - title?: Text | SignalRef; - - /** - * The minimum desired step between tick values for quantitative legends, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value. - */ - tickMinStep?: number | SignalRef; - - /** - * Explicitly set the visible legend values. - */ - values?: any[] | SignalRef; - - /** - * Mark definitions for custom legend encoding. - */ - encode?: LegendEncode; -} - -export interface LegendEncode { - title?: GuideEncodeEntry; - labels?: GuideEncodeEntry; - legend?: GuideEncodeEntry; - entries?: GuideEncodeEntry; - symbols?: GuideEncodeEntry; - gradient?: GuideEncodeEntry; -} - -/** - * Properties shared between legends and legend configs. - */ -export interface BaseLegend { - /** - * The orientation of the legend, which determines how the legend is positioned within the scene. One of "left", "right", "top-left", "top-right", "bottom-left", "bottom-right", "none". - * - * __Default value:__ `"right"` - */ - orient?: LegendOrient | SignalRef; - - /** - * The maximum number of allowed entries for a symbol legend. Additional entries will be dropped. - */ - symbolLimit?: NumberValue; - - /** - * The desired number of tick values for quantitative legends. - */ - tickCount?: TickCount; - - // ---------- ARIA ---------- - /** - * A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only). - * If `false`, the "aria-hidden" attribute will be set on the output SVG group, removing the legend from the ARIA accessibility tree. - * - * __Default value:__ `true` - */ - aria?: boolean; - - /** - * A text description of this legend for [ARIA accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) (SVG output only). - * If the `aria` property is true, for SVG output the ["aria-label" attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute) will be set to this description. - * If the description is unspecified it will be automatically generated. - */ - description?: string; - - // ---------- Legend Group ---------- - /** - * Corner radius for the full legend. - */ - cornerRadius?: NumberValue; - - /** - * Background fill color for the full legend. - */ - fillColor?: ColorValue; - - /** - * The offset in pixels by which to displace the legend from the data rectangle and axes. - * - * __Default value:__ `18`. - */ - offset?: NumberValue; - - /** - * The padding between the border and content of the legend group. - * - * __Default value:__ `0`. - */ - padding?: NumberValue; - - /** - * Border stroke color for the full legend. - */ - strokeColor?: ColorValue; - - /** - * Custom x-position for legend with orient "none". - */ - legendX?: NumberValue; - - /** - * Custom y-position for legend with orient "none". - */ - legendY?: NumberValue; - - // ---------- Title ---------- - /** - * Horizontal text alignment for legend titles. - * - * __Default value:__ `"left"`. - */ - titleAlign?: AlignValue; - - /** - * Text anchor position for placing legend titles. - */ - titleAnchor?: AnchorValue; - - /** - * Vertical text baseline for legend titles. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone. - * - * __Default value:__ `"top"`. - */ - titleBaseline?: TextBaselineValue; - - /** - * The color of the legend title, can be in hex color code or regular color name. - */ - titleColor?: ColorValue; - - /** - * The font of the legend title. - */ - titleFont?: StringValue; - - /** - * The font size of the legend title. - */ - titleFontSize?: NumberValue; - - /** - * The font style of the legend title. - */ - titleFontStyle?: FontStyleValue; - - /** - * The font weight of the legend title. - * This can be either a string (e.g `"bold"`, `"normal"`) or a number (`100`, `200`, `300`, ..., `900` where `"normal"` = `400` and `"bold"` = `700`). - */ - titleFontWeight?: FontWeightValue; - - /** - * Maximum allowed pixel width of legend titles. - * - * __Default value:__ `180`. - * @minimum 0 - */ - titleLimit?: NumberValue; - - /** - * Line height in pixels for multi-line title text or title text with `"line-top"` or `"line-bottom"` baseline. - */ - titleLineHeight?: NumberValue; - - /** - * Opacity of the legend title. - */ - titleOpacity?: NumberValue; - - /** - * Orientation of the legend title. - */ - titleOrient?: OrientValue; - - /** - * The padding, in pixels, between title and legend. - * - * __Default value:__ `5`. - */ - titlePadding?: NumberValue; - - // ---------- Gradient ---------- - - /** - * The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient. - * - * __Default value:__ `200`. - * @minimum 0 - */ - gradientLength?: number | SignalRef; - - /** - * Opacity of the color gradient. - */ - gradientOpacity?: NumberValue; - - /** - * The thickness in pixels of the color gradient. This value corresponds to the width of a vertical gradient or the height of a horizontal gradient. - * - * __Default value:__ `16`. - * @minimum 0 - */ - gradientThickness?: number | SignalRef; - - /** - * The color of the gradient stroke, can be in hex color code or regular color name. - * - * __Default value:__ `"lightGray"`. - */ - gradientStrokeColor?: ColorValue; - - /** - * The width of the gradient stroke, in pixels. - * - * __Default value:__ `0`. - * @minimum 0 - */ - gradientStrokeWidth?: NumberValue; - - // ---------- Symbol Layout ---------- - /** - * The height in pixels to clip symbol legend entries and limit their size. - */ - clipHeight?: number | SignalRef; - - /** - * The number of columns in which to arrange symbol legend entries. A value of `0` or lower indicates a single row with one column per entry. - */ - columns?: number | SignalRef; - - /** - * The horizontal padding in pixels between symbol legend entries. - * - * __Default value:__ `10`. - */ - columnPadding?: number | SignalRef; - - /** - * The vertical padding in pixels between symbol legend entries. - * - * __Default value:__ `2`. - */ - rowPadding?: number | SignalRef; - - /** - * The alignment to apply to symbol legends rows and columns. The supported string values are `"all"`, `"each"` (the default), and `none`. For more information, see the [grid layout documentation](https://vega.github.io/vega/docs/layout). - * - * __Default value:__ `"each"`. - */ - gridAlign?: LayoutAlign | SignalRef; - - // ---------- Symbols ---------- - /** - * An array of alternating [stroke, space] lengths for dashed symbol strokes. - */ - symbolDash?: DashArrayValue; - - /** - * The pixel offset at which to start drawing with the symbol stroke dash array. - */ - symbolDashOffset?: NumberValue; - - /** - * The color of the legend symbol, - */ - symbolFillColor?: ColorValue; - - /** - * Horizontal pixel offset for legend symbols. - * - * __Default value:__ `0`. - */ - symbolOffset?: NumberValue; - - /** - * Opacity of the legend symbols. - */ - symbolOpacity?: NumberValue; - - /** - * The size of the legend symbol, in pixels. - * - * __Default value:__ `100`. - * @minimum 0 - */ - symbolSize?: NumberValue; - - /** - * Stroke color for legend symbols. - */ - symbolStrokeColor?: ColorValue; - - /** - * The width of the symbol's stroke. - * - * __Default value:__ `1.5`. - * @minimum 0 - */ - symbolStrokeWidth?: NumberValue; - - /** - * The symbol shape. One of the plotting shapes `circle` (default), `square`, `cross`, `diamond`, `triangle-up`, `triangle-down`, `triangle-right`, or `triangle-left`, the line symbol `stroke`, or one of the centered directional shapes `arrow`, `wedge`, or `triangle`. Alternatively, a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) can be provided. For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions. - * - * __Default value:__ `"circle"`. - */ - symbolType?: SymbolShapeValue | SignalRef; - - // ---------- Label ---------- - /** - * The alignment of the legend label, can be left, center, or right. - */ - labelAlign?: AlignValue; - - /** - * The position of the baseline of legend label, can be `"top"`, `"middle"`, `"bottom"`, or `"alphabetic"`. - * - * __Default value:__ `"middle"`. - */ - labelBaseline?: TextBaselineValue; - - /** - * The color of the legend label, can be in hex color code or regular color name. - */ - labelColor?: ColorValue; - - /** - * The font of the legend label. - */ - labelFont?: StringValue; - - /** - * The font size of legend label. - * - * __Default value:__ `10`. - * - * @minimum 0 - */ - labelFontSize?: NumberValue; - - /** - * The font style of legend label. - */ - labelFontStyle?: FontStyleValue; - - /** - * The font weight of legend label. - */ - labelFontWeight?: FontWeightValue; - - /** - * Maximum allowed pixel width of legend tick labels. - * - * __Default value:__ `160`. - */ - labelLimit?: NumberValue; - - /** - * Opacity of labels. - */ - labelOpacity?: NumberValue; - - /** - * Padding in pixels between the legend and legend labels. - */ - labelPadding?: NumberValue; - - /** - * The offset of the legend label. - * @minimum 0 - * - * __Default value:__ `4`. - */ - labelOffset?: NumberValue; - - /** - * The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` (default) or `"parity"`, a strategy of removing every other label is used. If set to `"greedy"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes). - * - * __Default value:__ `true`. - */ - labelOverlap?: LabelOverlap | SignalRef; - - /** - * The minimum separation that must be between label bounding boxes for them to be considered non-overlapping (default `0`). This property is ignored if *labelOverlap* resolution is not enabled. - */ - labelSeparation?: number | SignalRef; - - /** - * The integer z-index indicating the layering of the legend group relative to other axis, mark, and legend groups. - * - * @TJS-type integer - * @minimum 0 - */ - zindex?: number; -} diff --git a/node_modules/vega-typings/types/spec/locale.d.ts b/node_modules/vega-typings/types/spec/locale.d.ts deleted file mode 100644 index a29f5b8..0000000 --- a/node_modules/vega-typings/types/spec/locale.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Vector2, Vector7, Vector10, Vector12 } from '.'; - -export interface Locale { - number?: NumberLocale; - time?: TimeLocale; -} - -/** - * Locale definition for formatting numbers. - */ -export interface NumberLocale { - /** - * The decimal point (e.g., "."). - */ - decimal: string; - /** - * The group separator (e.g., ","). - */ - thousands: string; - /** - * The array of group sizes (e.g., [3]), cycled as needed. - */ - grouping: number[]; - /** - * The currency prefix and suffix (e.g., ["$", ""]). - */ - currency: Vector2; - /** - * An array of ten strings to replace the numerals 0-9. - */ - numerals?: Vector10; - /** - * The percent sign (defaults to "%"). - */ - percent?: string; - /** - * The minus sign (defaults to hyphen-minus, "-"). - */ - minus?: string; - /** - * The not-a-number value (defaults to "NaN"). - */ - nan?: string; -} - -/** - * Locale definition for formatting dates and times. - */ -export interface TimeLocale { - /** - * The date and time (%c) format specifier (e.g., "%a %b %e %X %Y"). - */ - dateTime: string; - /** - * The date (%x) format specifier (e.g., "%m/%d/%Y"). - */ - date: string; - /** - * The time (%X) format specifier (e.g., "%H:%M:%S"). - */ - time: string; - /** - * The A.M. and P.M. equivalents (e.g., ["AM", "PM"]). - */ - periods: Vector2; - /** - * The full names of the weekdays, starting with Sunday. - */ - days: Vector7; - /** - * The abbreviated names of the weekdays, starting with Sunday. - */ - shortDays: Vector7; - /** - * The full names of the months (starting with January). - */ - months: Vector12; - /** - * The abbreviated names of the months (starting with January). - */ - shortMonths: Vector12; -} diff --git a/node_modules/vega-typings/types/spec/mark.d.ts b/node_modules/vega-typings/types/spec/mark.d.ts deleted file mode 100644 index 999daa3..0000000 --- a/node_modules/vega-typings/types/spec/mark.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -import * as Encode from './encode'; -import { ExprRef } from './expr'; -import { SortOrder, Scope, SignalRef, Transforms, OnMarkTrigger } from '.'; - -export type Facet = - | { - name: string; - data: string; - field: string; - } - | { - name: string; - data: string; - groupby: string | string[]; - aggregate?: { - cross?: boolean; - fields: string[]; - ops: string[]; - as: string[]; - }; - }; -export interface From { - data?: string; -} -export type FromFacet = - | From - | (From & { - facet: Facet; - }); -export type Clip = - | boolean - | { - path: string | SignalRef; - } - | { - sphere: string | SignalRef; - }; -export type Compare = - | { - field: string | ExprRef | SignalRef; - order?: SortOrder; - } - | { - field: (string | ExprRef | SignalRef)[]; - order?: SortOrder[]; - }; -export interface BaseMark { - role?: string; - name?: string; - description?: string; - aria?: boolean; - key?: string; - clip?: Clip; - sort?: Compare; - interactive?: boolean | SignalRef; - from?: From; - transform?: Transforms[]; - zindex?: number; - on?: OnMarkTrigger[]; - style?: string | string[]; -} -export interface ArcMark extends BaseMark, Encode.Encodable { - type: 'arc'; -} -export interface AreaMark extends BaseMark, Encode.Encodable { - type: 'area'; -} -export interface ImageMark extends BaseMark, Encode.Encodable { - type: 'image'; -} -export interface GroupMark extends BaseMark, Scope, Encode.Encodable { - type: 'group'; - from?: FromFacet; -} -export interface LineMark extends BaseMark, Encode.Encodable { - type: 'line'; -} -export interface PathMark extends BaseMark, Encode.Encodable { - type: 'path'; -} -export interface RectMark extends BaseMark, Encode.Encodable { - type: 'rect'; -} -export interface RuleMark extends BaseMark, Encode.Encodable { - type: 'rule'; -} -export interface ShapeMark extends BaseMark, Encode.Encodable { - type: 'shape'; -} -export interface SymbolMark extends BaseMark, Encode.Encodable { - type: 'symbol'; -} -export interface TextMark extends BaseMark, Encode.Encodable { - type: 'text'; -} -export interface TrailMark extends BaseMark, Encode.Encodable { - type: 'trail'; -} -export type Mark = - | ArcMark - | AreaMark - | ImageMark - | GroupMark - | LineMark - | PathMark - | RectMark - | RuleMark - | ShapeMark - | SymbolMark - | TextMark - | TrailMark; diff --git a/node_modules/vega-typings/types/spec/marktype.d.ts b/node_modules/vega-typings/types/spec/marktype.d.ts deleted file mode 100644 index 941da58..0000000 --- a/node_modules/vega-typings/types/spec/marktype.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export type MarkType = - | 'arc' - | 'area' - | 'image' - | 'group' - | 'line' - | 'path' - | 'rect' - | 'rule' - | 'shape' - | 'symbol' - | 'text' - | 'trail'; diff --git a/node_modules/vega-typings/types/spec/on-events.d.ts b/node_modules/vega-typings/types/spec/on-events.d.ts deleted file mode 100644 index 5aafcd8..0000000 --- a/node_modules/vega-typings/types/spec/on-events.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Expr, ExprRef, EventSelector, SignalRef, SignalValue, Stream } from '.'; - -export type EventListener = - | SignalRef - | { - scale: string; - } - | Stream; - -export type Events = EventSelector | EventListener; -export type Update = - | Expr - | ExprRef - | SignalRef - | { - value: SignalValue; - }; -export type OnEvent = ( - | { - encode: string; - } - | { - update: Update; - } -) & { - events: Events | EventListener[]; - force?: boolean; -}; diff --git a/node_modules/vega-typings/types/spec/on-trigger.d.ts b/node_modules/vega-typings/types/spec/on-trigger.d.ts deleted file mode 100644 index 7c61c63..0000000 --- a/node_modules/vega-typings/types/spec/on-trigger.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Expr } from '.'; - -export interface OnTrigger { - trigger: Expr; - insert?: Expr; - remove?: boolean | Expr; - toggle?: Expr; - modify?: Expr; - values?: Expr; -} -export interface OnMarkTrigger { - trigger: Expr; - modify?: Expr; - values?: Expr; -} diff --git a/node_modules/vega-typings/types/spec/padding.d.ts b/node_modules/vega-typings/types/spec/padding.d.ts deleted file mode 100644 index 05a79d6..0000000 --- a/node_modules/vega-typings/types/spec/padding.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export type Padding = - | number - | { - top?: number; - bottom?: number; - left?: number; - right?: number; - }; diff --git a/node_modules/vega-typings/types/spec/projection.d.ts b/node_modules/vega-typings/types/spec/projection.d.ts deleted file mode 100644 index c197dc9..0000000 --- a/node_modules/vega-typings/types/spec/projection.d.ts +++ /dev/null @@ -1,122 +0,0 @@ -import { SignalRef, Vector2, Vector3 } from '.'; - -export type GeoJsonFeature = any; // TODO -export type GeoJsonFeatureCollection = any; // TODO -export type Fit = GeoJsonFeature | GeoJsonFeatureCollection | GeoJsonFeature[]; -export type ProjectionType = - | 'albers' - | 'albersUsa' - | 'azimuthalEqualArea' - | 'azimuthalEquidistant' - | 'conicConformal' - | 'conicEqualArea' - | 'conicEquidistant' - | 'equalEarth' - | 'equirectangular' - | 'gnomonic' - | 'identity' - | 'mercator' - | 'naturalEarth1' - | 'orthographic' - | 'stereographic' - | 'transverseMercator'; -export interface BaseProjection { - /* - * The cartographic projection to use. This value is case-insensitive, for example `"albers"` and `"Albers"` indicate the same projection type. - * - * __Default value:__ `mercator` - */ - type?: ProjectionType | SignalRef; - - /** - * The projection's clipping circle radius to the specified angle in degrees. If `null`, switches to [antimeridian](http://bl.ocks.org/mbostock/3788999) cutting rather than small-circle clipping. - */ - clipAngle?: number | SignalRef; - - /** - * The projection's viewport clip extent to the specified bounds in pixels. The extent bounds are specified as an array `[[x0, y0], [x1, y1]]`, where `x0` is the left-side of the viewport, `y0` is the top, `x1` is the right and `y1` is the bottom. If `null`, no viewport clipping is performed. - */ - clipExtent?: Vector2> | SignalRef; - - /** - * The projection’s scale factor. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections. - */ - scale?: number | SignalRef; - - /* - * The projection's translation offset as a two-element array `[tx, ty]`, defaults to `[480, 250]`. The translation offset determines the pixel coordinates of the projection's center. The default translation offset places (0°,0°) at the center of a 960×500 area. - */ - translate?: Vector2 | SignalRef; - - /** - * The projection's center, a two-element array of longitude and latitude in degrees. - * - * __Default value:__ `[0, 0]` - */ - center?: Vector2 | SignalRef; - - /** - * The projection's three-axis rotation to the specified angles, which must be a two- or three-element array of numbers [`lambda`, `phi`, `gamma`] specifying the rotation angles in degrees about each spherical axis. (These correspond to yaw, pitch and roll.) - * - * __Default value:__ `[0, 0, 0]` - */ - rotate?: Vector2 | Vector3 | SignalRef; - - /** - * For conic projections, the [two standard parallels](https://en.wikipedia.org/wiki/Map_projection#Conic) that define the map layout. The default depends on the specific conic projection used. - */ - parallels?: (number | SignalRef)[] | SignalRef; - - /** - * The default radius (in pixels) to use when drawing GeoJSON `Point` and `MultiPoint` geometries. This parameter sets a constant default value. To modify the point radius in response to data, see the corresponding parameter of the GeoPath and GeoShape transforms. - * - * __Default value:__ `4.5` - */ - pointRadius?: number | SignalRef; - - /** - * The threshold for the projection's [adaptive resampling](http://bl.ocks.org/mbostock/3795544) to the specified value in pixels. This value corresponds to the [Douglas–Peucker distance](http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm). If precision is not specified, returns the projection's current resampling precision which defaults to `√0.5 ≅ 0.70710…`. - */ - precision?: number | SignalRef; - - /* - * GeoJSON data to which the projection should attempt to automatically fit the `translate` and `scale` parameters. If object-valued, this parameter should be a GeoJSON Feature or FeatureCollection. If array-valued, each array member may be a GeoJSON Feature, FeatureCollection, or a sub-array of GeoJSON Features. - */ - fit?: Fit | Fit[] | SignalRef; - /* - * Used in conjunction with fit, provides the pixel area to which the projection should be automatically fit. - */ - extent?: Vector2> | SignalRef; - /* - * Used in conjunction with fit, provides the width and height in pixels of the area to which the projection should be automatically fit. - */ - size?: Vector2 | SignalRef; - - // TODO: use a union tagged by the projection type to determine which of the following is applicable - /* The following properties are all supported for specific types of projections. Consult the d3-geo-projection library for more information: https://github.com/d3/d3-geo-projection */ - coefficient?: number | SignalRef; - distance?: number | SignalRef; - fraction?: number | SignalRef; - lobes?: number | SignalRef; - parallel?: number | SignalRef; - radius?: number | SignalRef; - ratio?: number | SignalRef; - spacing?: number | SignalRef; - tilt?: number | SignalRef; - - /* - * Sets whether or not the x-dimension is reflected (negated) in the output. - */ - reflectX?: boolean | SignalRef; - - /* - * Sets whether or not the y-dimension is reflected (negated) in the output. - */ - reflectY?: boolean | SignalRef; -} -export interface Projection extends BaseProjection { - /* - * The name of the projection. - */ - name: string; -} diff --git a/node_modules/vega-typings/types/spec/scale.d.ts b/node_modules/vega-typings/types/spec/scale.d.ts deleted file mode 100644 index 47a3cbc..0000000 --- a/node_modules/vega-typings/types/spec/scale.d.ts +++ /dev/null @@ -1,260 +0,0 @@ -import { SignalRef } from '.'; -import { ColorScheme } from './scheme'; - -export type RangeEnum = - | 'width' - | 'height' - | 'symbol' - | 'category' - | 'ordinal' - | 'ramp' - | 'diverging' - | 'heatmap'; - -export type RangeRawArray = (number | SignalRef)[]; -export type RangeRaw = (null | boolean | string | number | SignalRef | RangeRawArray)[]; -export type RangeScheme = - | RangeEnum - | RangeRaw - | SignalRef - | { - scheme: string | string[] | SignalRef | ColorScheme; - count?: number | SignalRef; - extent?: (number | SignalRef)[] | SignalRef; - }; -export type RangeBand = - | RangeEnum - | RangeRaw - | { - step: number | SignalRef; - }; -export type SortOrder = 'ascending' | 'descending' | SignalRef; -export type SortField = - | boolean - | { - order: SortOrder; - } - | { - field?: ScaleField; - op: ScaleField; - order?: SortOrder; - }; - -/** - * Unioned domains can only be sorted by count, min, or max aggregates. - */ -export type UnionSortField = - | boolean - | { - op: 'count'; - order?: SortOrder; - } - | { - field: ScaleField; - op: 'count' | 'min' | 'max'; - order?: SortOrder; - }; -export type ScaleField = string | SignalRef; - -export interface ScaleBinParams { - /** - * The step size defining the bin interval width. - */ - step: number | SignalRef; - - /** - * The starting (lowest-valued) bin boundary. - * - * __Default value:__ The lowest value of the scale domain will be used. - */ - start?: number | SignalRef; - - /** - * The stopping (highest-valued) bin boundary. - * - * __Default value:__ The highest value of the scale domain will be used. - * - */ - stop?: number | SignalRef; -} - -export type ScaleBins = (number | SignalRef)[] | SignalRef | ScaleBinParams; - -export type ScaleInterpolateEnum = - | 'rgb' - | 'lab' - | 'hcl' - | 'hsl' - | 'hsl-long' - | 'hcl-long' - | 'cubehelix' - | 'cubehelix-long'; - -export interface ScaleInterpolateParams { - type: 'rgb' | 'cubehelix' | 'cubehelix-long' | SignalRef; - gamma?: number | SignalRef; -} - -export type ScaleInterpolate = ScaleInterpolateEnum | SignalRef | ScaleInterpolateParams; - -export interface ScaleDataRef { - data: string; - field: ScaleField; -} - -export interface ScaleMultiDataRef { - fields: ((string | number | boolean)[] | ScaleDataRef | SignalRef)[]; -} - -export interface ScaleMultiFieldsRef { - data: string; - fields: ScaleField[]; -} - -export type ScaleData = (ScaleDataRef | ScaleMultiDataRef | ScaleMultiFieldsRef) & { - sort?: SortField; -}; -export type QuantScaleType = - | 'linear' - | 'pow' - | 'sqrt' - | 'log' - | 'symlog' - | 'time' - | 'utc' - | 'sequential'; -export type DiscreteScaleType = 'ordinal' | 'band' | 'point'; -export type DiscretizingScaleType = 'quantile' | 'quantize' | 'threshold' | 'bin-ordinal'; -export type ScaleType = QuantScaleType | DiscreteScaleType | DiscretizingScaleType | 'identity'; -export interface BaseScale { - name: string; - type?: ScaleType; - domain?: (null | string | number | boolean | SignalRef)[] | ScaleData | SignalRef; - domainMin?: number | SignalRef; - domainMax?: number | SignalRef; - domainMid?: number | SignalRef; - domainRaw?: null | any[] | SignalRef; - reverse?: boolean | SignalRef; - round?: boolean | SignalRef; -} -export interface ContinuousScale extends BaseScale { - range?: RangeScheme; - bins?: ScaleBins; - interpolate?: ScaleInterpolate; - clamp?: boolean | SignalRef; - padding?: number | SignalRef; -} -export interface NumericScale extends ContinuousScale { - nice?: boolean | number | SignalRef; - zero?: boolean | SignalRef; -} -export interface BaseBandScale extends BaseScale { - range?: RangeBand; - padding?: number | SignalRef; - paddingOuter?: number | SignalRef; - align?: number | SignalRef; -} -// concrete scales -export interface OrdinalScale extends BaseScale { - type: 'ordinal'; - range?: RangeScheme | ScaleData; - interpolate?: ScaleInterpolate; - domainImplicit?: boolean | SignalRef; -} -export interface BandScale extends BaseBandScale { - type: 'band'; - paddingInner?: number | SignalRef; -} -export interface PointScale extends BaseBandScale { - type: 'point'; -} - -// note: deprecated -export interface SequentialScale extends NumericScale { - type: 'sequential'; -} -export type TimeInterval = - | 'millisecond' - | 'second' - | 'minute' - | 'hour' - | 'day' - | 'week' - | 'month' - | 'year'; - -export interface TimeIntervalStep { - interval: TimeInterval; - step: number; -} - -export interface TimeScale extends ContinuousScale { - type: 'time' | 'utc'; - nice?: boolean | TimeInterval | TimeIntervalStep | SignalRef; -} -export interface IdentityScale extends BaseScale { - type: 'identity'; - nice?: boolean | SignalRef; -} -export interface LinearScale extends NumericScale { - type?: 'linear'; // optional because it's the default -} -export interface LogScale extends ContinuousScale { - type: 'log'; - base?: number | SignalRef; - nice?: boolean | number | SignalRef; - zero?: false; // zero has to be false or undefined -} - -export interface SymLogScale extends NumericScale { - type: 'symlog'; - constant?: number | SignalRef; -} -export interface PowScale extends NumericScale { - type: 'pow'; - exponent: number | SignalRef; -} -export interface SqrtScale extends NumericScale { - type: 'sqrt'; -} -export interface QuantizeScale extends BaseScale { - type?: 'quantize'; - range?: RangeScheme; - padding?: number | SignalRef; - nice?: boolean | number | SignalRef; - zero?: boolean | SignalRef; -} -export interface ThresholdScale extends BaseScale { - type?: 'threshold'; - range?: RangeScheme; - padding?: number | SignalRef; - nice?: boolean | number | SignalRef; - zero?: boolean | SignalRef; -} -export interface QuantileScale extends BaseScale { - type?: 'quantile'; - range?: RangeScheme; - interpolate?: ScaleInterpolate; -} -export interface BinOrdinalScale extends BaseScale { - type: 'bin-ordinal'; - bins?: ScaleBins; - range?: RangeScheme | ScaleData; - interpolate?: ScaleInterpolate; -} -export type Scale = - | OrdinalScale - | BandScale - | PointScale - | SequentialScale - | TimeScale - | IdentityScale - | LinearScale - | LogScale - | SymLogScale - | PowScale - | SqrtScale - | QuantileScale - | QuantizeScale - | ThresholdScale - | BinOrdinalScale; diff --git a/node_modules/vega-typings/types/spec/scheme.d.ts b/node_modules/vega-typings/types/spec/scheme.d.ts deleted file mode 100644 index ad7c0b7..0000000 --- a/node_modules/vega-typings/types/spec/scheme.d.ts +++ /dev/null @@ -1,344 +0,0 @@ -export type Categorical = - | 'accent' - | 'category10' - | 'category20' - | 'category20b' - | 'category20c' - | 'dark2' - | 'paired' - | 'pastel1' - | 'pastel2' - | 'set1' - | 'set2' - | 'set3' - | 'tableau10' - | 'tableau20'; - -export type SequentialSingleHue = - | 'blues' - | 'tealblues' - | 'teals' - | 'greens' - | 'browns' - | 'greys' - | 'purples' - | 'warmgreys' - | 'reds' - | 'oranges'; - -export type SequentialMultiHue = - | 'viridis' - | 'inferno' - | 'magma' - | 'plasma' - | 'bluegreen' - | 'bluegreen-3' - | 'bluegreen-4' - | 'bluegreen-5' - | 'bluegreen-6' - | 'bluegreen-7' - | 'bluegreen-8' - | 'bluegreen-9' - | 'bluepurple' - | 'bluepurple-3' - | 'bluepurple-4' - | 'bluepurple-5' - | 'bluepurple-6' - | 'bluepurple-7' - | 'bluepurple-8' - | 'bluepurple-9' - | 'goldgreen' - | 'goldgreen-3' - | 'goldgreen-4' - | 'goldgreen-5' - | 'goldgreen-6' - | 'goldgreen-7' - | 'goldgreen-8' - | 'goldgreen-9' - | 'goldorange' - | 'goldorange-3' - | 'goldorange-4' - | 'goldorange-5' - | 'goldorange-6' - | 'goldorange-7' - | 'goldorange-8' - | 'goldorange-9' - | 'goldred' - | 'goldred-3' - | 'goldred-4' - | 'goldred-5' - | 'goldred-6' - | 'goldred-7' - | 'goldred-8' - | 'goldred-9' - | 'greenblue' - | 'greenblue-3' - | 'greenblue-4' - | 'greenblue-5' - | 'greenblue-6' - | 'greenblue-7' - | 'greenblue-8' - | 'greenblue-9' - | 'orangered' - | 'orangered-3' - | 'orangered-4' - | 'orangered-5' - | 'orangered-6' - | 'orangered-7' - | 'orangered-8' - | 'orangered-9' - | 'purplebluegreen' - | 'purplebluegreen-3' - | 'purplebluegreen-4' - | 'purplebluegreen-5' - | 'purplebluegreen-6' - | 'purplebluegreen-7' - | 'purplebluegreen-8' - | 'purplebluegreen-9' - | 'purpleblue' - | 'purpleblue-3' - | 'purpleblue-4' - | 'purpleblue-5' - | 'purpleblue-6' - | 'purpleblue-7' - | 'purpleblue-8' - | 'purpleblue-9' - | 'purplered' - | 'purplered-3' - | 'purplered-4' - | 'purplered-5' - | 'purplered-6' - | 'purplered-7' - | 'purplered-8' - | 'purplered-9' - | 'redpurple' - | 'redpurple-3' - | 'redpurple-4' - | 'redpurple-5' - | 'redpurple-6' - | 'redpurple-7' - | 'redpurple-8' - | 'redpurple-9' - | 'yellowgreenblue' - | 'yellowgreenblue-3' - | 'yellowgreenblue-4' - | 'yellowgreenblue-5' - | 'yellowgreenblue-6' - | 'yellowgreenblue-7' - | 'yellowgreenblue-8' - | 'yellowgreenblue-9' - | 'yellowgreen' - | 'yellowgreen-3' - | 'yellowgreen-4' - | 'yellowgreen-5' - | 'yellowgreen-6' - | 'yellowgreen-7' - | 'yellowgreen-8' - | 'yellowgreen-9' - | 'yelloworangebrown' - | 'yelloworangebrown-3' - | 'yelloworangebrown-4' - | 'yelloworangebrown-5' - | 'yelloworangebrown-6' - | 'yelloworangebrown-7' - | 'yelloworangebrown-8' - | 'yelloworangebrown-9' - | 'yelloworangered' - | 'yelloworangered-3' - | 'yelloworangered-4' - | 'yelloworangered-5' - | 'yelloworangered-6' - | 'yelloworangered-7' - | 'yelloworangered-8' - | 'yelloworangered-9' - | 'darkblue' - | 'darkblue-3' - | 'darkblue-4' - | 'darkblue-5' - | 'darkblue-6' - | 'darkblue-7' - | 'darkblue-8' - | 'darkblue-9' - | 'darkgold' - | 'darkgold-3' - | 'darkgold-4' - | 'darkgold-5' - | 'darkgold-6' - | 'darkgold-7' - | 'darkgold-8' - | 'darkgold-9' - | 'darkgreen' - | 'darkgreen-3' - | 'darkgreen-4' - | 'darkgreen-5' - | 'darkgreen-6' - | 'darkgreen-7' - | 'darkgreen-8' - | 'darkgreen-9' - | 'darkmulti' - | 'darkmulti-3' - | 'darkmulti-4' - | 'darkmulti-5' - | 'darkmulti-6' - | 'darkmulti-7' - | 'darkmulti-8' - | 'darkmulti-9' - | 'darkred' - | 'darkred-3' - | 'darkred-4' - | 'darkred-5' - | 'darkred-6' - | 'darkred-7' - | 'darkred-8' - | 'darkred-9' - | 'lightgreyred' - | 'lightgreyred-3' - | 'lightgreyred-4' - | 'lightgreyred-5' - | 'lightgreyred-6' - | 'lightgreyred-7' - | 'lightgreyred-8' - | 'lightgreyred-9' - | 'lightgreyteal' - | 'lightgreyteal-3' - | 'lightgreyteal-4' - | 'lightgreyteal-5' - | 'lightgreyteal-6' - | 'lightgreyteal-7' - | 'lightgreyteal-8' - | 'lightgreyteal-9' - | 'lightmulti' - | 'lightmulti-3' - | 'lightmulti-4' - | 'lightmulti-5' - | 'lightmulti-6' - | 'lightmulti-7' - | 'lightmulti-8' - | 'lightmulti-9' - | 'lightorange' - | 'lightorange-3' - | 'lightorange-4' - | 'lightorange-5' - | 'lightorange-6' - | 'lightorange-7' - | 'lightorange-8' - | 'lightorange-9' - | 'lighttealblue' - | 'lighttealblue-3' - | 'lighttealblue-4' - | 'lighttealblue-5' - | 'lighttealblue-6' - | 'lighttealblue-7' - | 'lighttealblue-8' - | 'lighttealblue-9'; - -export type Diverging = - | 'blueorange' - | 'blueorange-3' - | 'blueorange-4' - | 'blueorange-5' - | 'blueorange-6' - | 'blueorange-7' - | 'blueorange-8' - | 'blueorange-9' - | 'blueorange-10' - | 'blueorange-11' - | 'brownbluegreen' - | 'brownbluegreen-3' - | 'brownbluegreen-4' - | 'brownbluegreen-5' - | 'brownbluegreen-6' - | 'brownbluegreen-7' - | 'brownbluegreen-8' - | 'brownbluegreen-9' - | 'brownbluegreen-10' - | 'brownbluegreen-11' - | 'purplegreen' - | 'purplegreen-3' - | 'purplegreen-4' - | 'purplegreen-5' - | 'purplegreen-6' - | 'purplegreen-7' - | 'purplegreen-8' - | 'purplegreen-9' - | 'purplegreen-10' - | 'purplegreen-11' - | 'pinkyellowgreen' - | 'pinkyellowgreen-3' - | 'pinkyellowgreen-4' - | 'pinkyellowgreen-5' - | 'pinkyellowgreen-6' - | 'pinkyellowgreen-7' - | 'pinkyellowgreen-8' - | 'pinkyellowgreen-9' - | 'pinkyellowgreen-10' - | 'pinkyellowgreen-11' - | 'purpleorange' - | 'purpleorange-3' - | 'purpleorange-4' - | 'purpleorange-5' - | 'purpleorange-6' - | 'purpleorange-7' - | 'purpleorange-8' - | 'purpleorange-9' - | 'purpleorange-10' - | 'purpleorange-11' - | 'redblue' - | 'redblue-3' - | 'redblue-4' - | 'redblue-5' - | 'redblue-6' - | 'redblue-7' - | 'redblue-8' - | 'redblue-9' - | 'redblue-10' - | 'redblue-11' - | 'redgrey' - | 'redgrey-3' - | 'redgrey-4' - | 'redgrey-5' - | 'redgrey-6' - | 'redgrey-7' - | 'redgrey-8' - | 'redgrey-9' - | 'redgrey-10' - | 'redgrey-11' - | 'redyellowblue' - | 'redyellowblue-3' - | 'redyellowblue-4' - | 'redyellowblue-5' - | 'redyellowblue-6' - | 'redyellowblue-7' - | 'redyellowblue-8' - | 'redyellowblue-9' - | 'redyellowblue-10' - | 'redyellowblue-11' - | 'redyellowgreen' - | 'redyellowgreen-3' - | 'redyellowgreen-4' - | 'redyellowgreen-5' - | 'redyellowgreen-6' - | 'redyellowgreen-7' - | 'redyellowgreen-8' - | 'redyellowgreen-9' - | 'redyellowgreen-10' - | 'redyellowgreen-11' - | 'spectral' - | 'spectral-3' - | 'spectral-4' - | 'spectral-5' - | 'spectral-6' - | 'spectral-7' - | 'spectral-8' - | 'spectral-9' - | 'spectral-10' - | 'spectral-11'; - -export type Cyclical = 'rainbow' | 'sinebow'; - -export type ColorScheme = - | Categorical - | SequentialSingleHue - | SequentialMultiHue - | Diverging - | Cyclical; diff --git a/node_modules/vega-typings/types/spec/scope.d.ts b/node_modules/vega-typings/types/spec/scope.d.ts deleted file mode 100644 index 962c5ab..0000000 --- a/node_modules/vega-typings/types/spec/scope.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Axis, Data, Layout, Legend, Mark, Projection, Scale, Signal, Title } from '.'; - -export interface Scope { - title?: string | Title; - layout?: Layout; - signals?: Signal[]; - projections?: Projection[]; - data?: Data[]; - scales?: Scale[]; - axes?: Axis[]; - legends?: Legend[]; - marks?: Mark[]; - usermeta?: object; -} diff --git a/node_modules/vega-typings/types/spec/selector.d.ts b/node_modules/vega-typings/types/spec/selector.d.ts deleted file mode 100644 index e8ff8f4..0000000 --- a/node_modules/vega-typings/types/spec/selector.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type EventSelector = string; diff --git a/node_modules/vega-typings/types/spec/signal.d.ts b/node_modules/vega-typings/types/spec/signal.d.ts deleted file mode 100644 index 63285ec..0000000 --- a/node_modules/vega-typings/types/spec/signal.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Binding, Expr, OnEvent } from '.'; - -// Hide from Vega-Lite schema (Since @hidden isn't used by Vega, we can just add it here for now.) -/** - * @hidden - */ -export interface SignalRef { - signal: string; -} -export interface BaseSignal { - name: string; - description?: string; - on?: OnEvent[]; -} -export interface PushSignal extends BaseSignal { - push: 'outer'; -} -export interface NewSignal extends BaseSignal { - value?: SignalValue; - react?: boolean; - update?: Expr; - bind?: Binding; -} -export interface InitSignal extends BaseSignal { - value?: SignalValue; - init: Expr; - bind?: Binding; -} -export type Signal = NewSignal | InitSignal | PushSignal; -export type SignalValue = any; diff --git a/node_modules/vega-typings/types/spec/stream.d.ts b/node_modules/vega-typings/types/spec/stream.d.ts deleted file mode 100644 index 5985f0e..0000000 --- a/node_modules/vega-typings/types/spec/stream.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Expr, MarkType } from '.'; - -export type EventSource = EventStream['source'] & {}; -export type EventType = - | 'click' - | 'dblclick' - | 'dragenter' - | 'dragleave' - | 'dragover' - | 'keydown' - | 'keypress' - | 'keyup' - | 'mousedown' - | 'mousemove' - | 'mouseout' - | 'mouseover' - | 'mouseup' - | 'mousewheel' - | 'timer' - | 'touchend' - | 'touchmove' - | 'touchstart' - | 'wheel'; -export type WindowEventType = - | EventType - // TODO: change to `keyof HTMLBodyElementEventMap` after vega/ts-json-schema-generator#192 - | string; -export interface StreamParameters { - between?: Stream[]; - marktype?: MarkType; - markname?: string; - filter?: Expr | Expr[]; - throttle?: number; - debounce?: number; - consume?: boolean; -} -export type EventStream = StreamParameters & - ( - | { - source?: 'view' | 'scope'; - type: EventType; - } - | { - source: 'window'; - type: WindowEventType; - } - ); -export interface DerivedStream extends StreamParameters { - stream: Stream; -} -export interface MergedStream extends StreamParameters { - merge: Stream[]; -} -export type Stream = EventStream | DerivedStream | MergedStream; diff --git a/node_modules/vega-typings/types/spec/title.d.ts b/node_modules/vega-typings/types/spec/title.d.ts deleted file mode 100644 index 23556ed..0000000 --- a/node_modules/vega-typings/types/spec/title.d.ts +++ /dev/null @@ -1,211 +0,0 @@ -import { GroupEncodeEntry, GuideEncodeEntry, SignalRef, TextEncodeEntry } from '.'; -import { Encode, Text } from './encode'; -import { - AlignValue, - AnchorValue, - BooleanValue, - ColorValue, - FontStyleValue, - FontWeightValue, - NumberValue, - StringValue, - TextBaselineValue, -} from './values'; - -export type TitleOrient = 'none' | 'left' | 'right' | 'top' | 'bottom'; -export type TitleAnchor = null | 'start' | 'middle' | 'end'; -export type TitleFrame = 'bounds' | 'group'; - -export interface Title extends BaseTitle { - /** - * The title text. - */ - text: Text | SignalRef; - - /** - * The subtitle text. - */ - subtitle?: Text | SignalRef; - - /** - * A mark name property to apply to the title text mark. (**Deprecated.**) - */ - name?: string; - - /** - * A boolean flag indicating if the title element should respond to input events such as mouse hover. (**Deprecated.**) - */ - interactive?: boolean; - - /** - * A mark style property to apply to the title text mark. If not specified, a default style of `"group-title"` is applied. (**Deprecated**) - */ - style?: string | string[]; - - /** - * Mark definitions for custom title encoding. - */ - encode?: TitleEncode | Encode; // second entry is **deprecated** -} - -export interface TitleEncode { - /** - * Custom encoding for the title container group. - */ - group?: GuideEncodeEntry; - /** - * Custom encoding for the title text. - */ - title?: GuideEncodeEntry; - /** - * Custom encoding for the subtitle text. - */ - subtitle?: GuideEncodeEntry; -} - -export interface BaseTitle { - /** - * The anchor position for placing the title and subtitle text. One of `"start"`, `"middle"`, or `"end"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title. - */ - anchor?: AnchorValue; - - /** - * The reference frame for the anchor position, one of `"bounds"` (to anchor relative to the full bounding box) or `"group"` (to anchor relative to the group width or height). - */ - frame?: TitleFrame | StringValue; - - /** - * The orthogonal offset in pixels by which to displace the title group from its position along the edge of the chart. - */ - offset?: NumberValue; - - /** - * Default title orientation (`"top"`, `"bottom"`, `"left"`, or `"right"`) - */ - orient?: TitleOrient | SignalRef; - - // ---------- ARIA ---------- - /** - * A boolean flag indicating if [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) should be included (SVG output only). - * If `false`, the "aria-hidden" attribute will be set on the output SVG group, removing the title from the ARIA accessibility tree. - * - * __Default value:__ `true` - */ - aria?: boolean; - - // ---------- Shared Text Properties ---------- - /** - * Horizontal text alignment for title text. One of `"left"`, `"center"`, or `"right"`. - */ - align?: AlignValue; - - /** - * Angle in degrees of title and subtitle text. - */ - angle?: NumberValue; - - /** - * Vertical text baseline for title and subtitle text. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the *lineHeight* rather than *fontSize* alone. - */ - baseline?: TextBaselineValue; - - /** - * Delta offset for title and subtitle text x-coordinate. - */ - dx?: NumberValue; - - /** - * Delta offset for title and subtitle text y-coordinate. - */ - dy?: NumberValue; - - /** - * The maximum allowed length in pixels of title and subtitle text. - * - * @minimum 0 - */ - limit?: NumberValue; - - // ---------- Title Text ---------- - /** - * Text color for title text. - */ - color?: ColorValue; - - /** - * Font name for title text. - */ - font?: StringValue; - - /** - * Font size in pixels for title text. - * - * @minimum 0 - */ - fontSize?: NumberValue; - - /** - * Font style for title text. - */ - fontStyle?: FontStyleValue; - - /** - * Font weight for title text. - * This can be either a string (e.g `"bold"`, `"normal"`) or a number (`100`, `200`, `300`, ..., `900` where `"normal"` = `400` and `"bold"` = `700`). - */ - fontWeight?: FontWeightValue; - - /** - * Line height in pixels for multi-line title text or title text with `"line-top"` or `"line-bottom"` baseline. - */ - lineHeight?: NumberValue; - - // ---------- Subtitle Text ---------- - /** - * Text color for subtitle text. - */ - subtitleColor?: ColorValue; - - /** - * Font name for subtitle text. - */ - subtitleFont?: StringValue; - - /** - * Font size in pixels for subtitle text. - * - * @minimum 0 - */ - subtitleFontSize?: NumberValue; - - /** - * Font style for subtitle text. - */ - subtitleFontStyle?: FontStyleValue; - - /** - * Font weight for subtitle text. - * This can be either a string (e.g `"bold"`, `"normal"`) or a number (`100`, `200`, `300`, ..., `900` where `"normal"` = `400` and `"bold"` = `700`). - */ - subtitleFontWeight?: FontWeightValue; - - /** - * Line height in pixels for multi-line subtitle text. - */ - subtitleLineHeight?: NumberValue; - - /** - * The padding in pixels between title and subtitle text. - */ - subtitlePadding?: NumberValue; - - /** - * The integer z-index indicating the layering of the title group relative to other axis, mark, and legend groups. - * - * __Default value:__ `0`. - * - * @TJS-type integer - * @minimum 0 - */ - zindex?: number; -} diff --git a/node_modules/vega-typings/types/spec/transform.d.ts b/node_modules/vega-typings/types/spec/transform.d.ts deleted file mode 100644 index 3ec3838..0000000 --- a/node_modules/vega-typings/types/spec/transform.d.ts +++ /dev/null @@ -1,738 +0,0 @@ -import { - Compare, - ExprRef, - FontStyle, - FontWeight, - SignalRef, - Vector2, - Vector4, - Vector5, - Vector6, - Vector7, -} from '.'; - -export type DataName = string; - -export type ProjectionName = string; - -export type SignalName = string; - -export type ExprString = string; - -export interface FieldParam { - field: string; -} - -export type TransformField = SignalRef | FieldParam | ExprRef; - -export type FieldRef = string | TransformField; - -export type Transforms = - | AggregateTransform - | BinTransform - | CollectTransform - | CountPatternTransform - | ContourTransform - | CrossTransform - | CrossFilterTransform - | DensityTransform - | DotBinTransform - | ExtentTransform - | FilterTransform - | FlattenTransform - | FoldTransform - | ForceTransform - | FormulaTransform - | HeatmapTransform - | GeoJSONTransform - | GeoPathTransform - | GeoPointTransform - | GeoShapeTransform - | GraticuleTransform - | IdentifierTransform - | ImputeTransform - | IsocontourTransform - | JoinAggregateTransform - | KDETransform - | KDE2DTransform - | LabelTransform - | LinkPathTransform - | LoessTransform - | LookupTransform - | NestTransform - | PackTransform - | PartitionTransform - | PieTransform - | PivotTransform - | ProjectTransform - | QuantileTransform - | RegressionTransform - | ResolveFilterTransform - | SampleTransform - | SequenceTransform - | StackTransform - | StratifyTransform - | TimeUnitTransform - | TreeTransform - | TreeLinksTransform - | TreemapTransform - | VoronoiTransform - | WindowTransform - | WordcloudTransform; - -export interface AggregateTransform { - type: 'aggregate'; - signal?: string; - groupby?: FieldRef[] | SignalRef; - fields?: (FieldRef | null)[] | SignalRef; - ops?: (AggregateOp | SignalRef)[] | SignalRef; - as?: (string | SignalRef | null)[] | SignalRef; - drop?: boolean | SignalRef; - cross?: boolean | SignalRef; - key?: string | TransformField; -} -export type AggregateOp = - | 'argmax' - | 'argmin' - | 'average' - | 'count' - | 'distinct' - | 'max' - | 'mean' - | 'median' - | 'min' - | 'missing' - | 'product' - | 'q1' - | 'q3' - | 'ci0' - | 'ci1' - | 'stderr' - | 'stdev' - | 'stdevp' - | 'sum' - | 'valid' - | 'values' - | 'variance' - | 'variancep'; - -export interface BinTransform extends BaseBin { - type: 'bin'; - field: FieldRef; - interval?: boolean | SignalRef; - anchor?: number | SignalRef; - extent: Vector2 | SignalRef; - span?: number | SignalRef; - signal?: SignalName; - name?: string | SignalRef; - as?: Vector2 | SignalRef; -} -export interface BaseBin { - /** - * The number base to use for automatic bin determination (default is base 10). - * - * __Default value:__ `10` - * - */ - base?: number | SignalRef; - /** - * An exact step size to use between bins. - * - * __Note:__ If provided, options such as maxbins will be ignored. - */ - step?: number | SignalRef; - /** - * An array of allowable step sizes to choose from. - * @minItems 1 - */ - steps?: (number | SignalRef)[] | SignalRef; - /** - * A minimum allowable step size (particularly useful for integer values). - */ - minstep?: number | SignalRef; - /** - * Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints. - * - * __Default value:__ `[5, 2]` - * - * @minItems 1 - */ - divide?: Vector2 | SignalRef; - /** - * Maximum number of bins. - * - * __Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels - * - * @minimum 2 - */ - maxbins?: number | SignalRef; - /** - * If true (the default), attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten. - */ - nice?: boolean | SignalRef; -} - -export interface CollectTransform { - type: 'collect'; - sort: Compare; -} - -export interface CountPatternTransform { - type: 'countpattern'; - field: FieldRef; - case?: string | SignalRef; - pattern?: string | SignalRef; - stopwords?: string | SignalRef; - as?: Vector2 | SignalRef; -} - -export type ContourTransform = { - type: 'contour'; - signal?: string; - size: (number | SignalRef)[] | SignalRef; // TODO: change to Vector2 after https://github.com/Microsoft/TypeScript/issues/28017 has been fixed - values?: (number | SignalRef)[] | SignalRef; - x?: FieldRef; - y?: FieldRef; - cellSize?: number | SignalRef; - bandwidth?: number | SignalRef; -} & ( - | { - count?: number | SignalRef; - nice?: number | SignalRef; - } - | { - thresholds?: (number | SignalRef)[] | SignalRef; - } -); - -export interface CrossTransform { - type: 'cross'; - filter?: ExprString; - as?: Vector2 | SignalRef; -} - -export interface CrossFilterTransform { - type: 'crossfilter'; - fields: (string | TransformField)[] | SignalRef; - query: (Vector2 | SignalRef)[] | SignalRef; - signal?: SignalName; -} - -export interface DensityTransform { - type: 'density'; - extent?: Vector2 | SignalRef; - steps?: number | SignalRef; - minsteps?: number | SignalRef; - maxsteps?: number | SignalRef; - method?: DensityMethod | SignalRef; - distribution?: Distribution | SignalRef; - as?: Vector2 | SignalRef; -} -export type DensityMethod = 'pdf' | 'cdf'; -export interface DistributionNormal { - function: 'normal'; - mean?: number | SignalRef; - stdev?: number | SignalRef; -} -export interface DistributionLogNormal { - function: 'lognormal'; - mean?: number | SignalRef; - stdev?: number | SignalRef; -} -export interface DistributionUniform { - function: 'uniform'; - min?: number | SignalRef; - max?: number | SignalRef; -} -export interface DistributionKDE { - function: 'kde'; - field: string | TransformField; - from?: DataName; - bandwidth?: number | SignalRef; -} -export interface DistributionMixture { - function: 'mixture'; - field: string | TransformField; - distributions?: (Distribution | SignalRef)[] | SignalRef; - weights?: (number | SignalRef)[] | SignalRef; -} -export type Distribution = - | DistributionNormal - | DistributionLogNormal - | DistributionUniform - | DistributionKDE - | DistributionMixture; - -export interface DotBinTransform { - type: 'dotbin'; - field: FieldRef; - groupby?: FieldRef[] | SignalRef; - step?: number | SignalRef; - smooth?: boolean | SignalRef; - as?: string | SignalRef; - signal?: SignalName; -} - -export interface ExtentTransform { - type: 'extent'; - field: FieldRef; - signal?: string; -} - -export interface FilterTransform { - type: 'filter'; - expr: ExprString; -} - -export interface FlattenTransform { - type: 'flatten'; - fields: FieldRef[] | SignalRef; - index?: string | SignalRef; - as?: (string | SignalRef)[] | SignalRef; -} - -export interface FoldTransform { - type: 'fold'; - fields: FieldRef[] | SignalRef; - as?: Vector2 | SignalRef; -} - -export interface ForceTransform { - type: 'force'; - static?: boolean | SignalRef; - restart?: boolean | SignalRef; - iterations?: number | SignalRef; - alpha?: number | SignalRef; - alphaMin?: number | SignalRef; - alphaTarget?: number | SignalRef; - velocityDecay?: number | SignalRef; - forces?: (Force | SignalRef)[] | SignalRef; - signal?: SignalName; -} -export interface ForceCenter { - force: 'center'; - x?: number | SignalRef; - y?: number | SignalRef; -} -export interface ForceCollide { - force: 'collide'; - radius?: number | SignalRef | ExprRef; - strength?: number | SignalRef; - iterations?: number | SignalRef; -} -export interface ForceLink { - force: 'link'; - links?: DataName; - id?: FieldRef; - distance?: number | SignalRef | ExprRef; - strength?: number | SignalRef | ExprRef; - iterations?: number | SignalRef; -} -export interface ForceNBody { - force: 'nbody'; - strength?: number | SignalRef; - theta?: number | SignalRef; - distanceMin?: number | SignalRef; - distanceMax?: number | SignalRef; -} -export interface ForceX { - force: 'x'; - strength?: number | SignalRef; - x?: FieldRef; -} -export interface ForceY { - force: 'y'; - strength?: number | SignalRef; - y?: FieldRef; -} -export type Force = ForceCenter | ForceCollide | ForceLink | ForceNBody | ForceX | ForceY; - -export interface FormulaTransform { - type: 'formula'; - expr: ExprString; - initonly?: boolean; - as: string | SignalRef; -} - -export interface GeoJSONTransform { - type: 'geojson'; - fields?: Vector2 | SignalRef; - geojson?: FieldRef; - signal?: SignalName; -} - -export interface GeoPointTransform { - type: 'geopoint'; - projection: ProjectionName; - fields: Vector2 | SignalRef; - as?: Vector2 | SignalRef; -} - -export interface GeoPathTransform { - type: 'geopath'; - projection?: ProjectionName; - field?: FieldRef; - pointRadius?: number | SignalRef | ExprRef; - as?: string | SignalRef; -} - -export interface GeoShapeTransform { - type: 'geoshape'; - projection?: ProjectionName; - field?: FieldRef; - pointRadius?: number | SignalRef | ExprRef; - as?: string | SignalRef; -} - -export interface GraticuleTransform { - type: 'graticule'; - signal?: SignalName; - extent?: Vector2 | SignalRef> | SignalRef; - extentMajor?: Vector2 | SignalRef> | SignalRef; - extentMinor?: Vector2 | SignalRef> | SignalRef; - step?: Vector2 | SignalRef; - stepMajor?: Vector2 | SignalRef; - stepMinor?: Vector2 | SignalRef; - precision?: number | SignalRef; -} - -export interface HeatmapTransform { - type: 'heatmap'; - field?: string | TransformField; - color?: string | TransformField; - opacity?: number | TransformField; - resolve?: 'independent' | 'shared' | SignalRef; - as?: string | SignalRef; -} - -export interface IdentifierTransform { - type: 'identifier'; - as: string | SignalRef; -} - -export interface ImputeTransform { - type: 'impute'; - field: FieldRef; - key: FieldRef; - keyvals?: any[] | SignalRef; - groupby?: FieldRef[] | SignalRef; - method?: ImputeMethod | SignalRef; - value?: any; // includes SignalRef -} -export type ImputeMethod = 'value' | 'median' | 'max' | 'min' | 'mean'; - -export interface IsocontourTransform { - type: 'isocontour'; - field?: string | TransformField; - scale?: number | TransformField; - translate?: number[] | TransformField; - levels?: number | SignalRef; - smooth?: boolean | SignalRef; - nice?: boolean | SignalRef; - zero?: boolean | SignalRef; - resolve?: 'shared' | 'independent' | SignalRef; - thresholds?: (number | SignalRef)[] | SignalRef; - as?: string | null | SignalRef; -} - -export interface JoinAggregateTransform { - type: 'joinaggregate'; - groupby?: FieldRef[] | SignalRef; - ops?: (AggregateOp | SignalRef)[] | SignalRef; - fields?: (FieldRef | null)[] | SignalRef; - as?: (string | SignalRef | null)[] | SignalRef; -} - -export interface KDETransform { - type: 'kde'; - field: FieldRef; - groupby?: FieldRef[] | SignalRef; - cumulative?: boolean | SignalRef; - counts?: boolean | SignalRef; - bandwidth?: number | SignalRef; - extent?: Vector2 | SignalRef; - resolve?: KDEResolve | SignalRef; - steps?: number | SignalRef; - minsteps?: number | SignalRef; - maxsteps?: number | SignalRef; - as?: Vector2 | SignalRef; -} -export type KDEResolve = 'shared' | 'independent'; - -export interface LinkPathTransform { - type: 'linkpath'; - sourceX?: FieldRef; - sourceY?: FieldRef; - targetX?: FieldRef; - targetY?: FieldRef; - orient?: LinkPathOrient | SignalRef; - shape?: LinkPathShape | SignalRef; - require?: SignalRef; - as?: string | SignalRef; -} -export type LinkPathOrient = 'horizontal' | 'vertical' | 'radial'; -export type LinkPathShape = 'line' | 'arc' | 'curve' | 'diagonal' | 'orthogonal'; - -export interface KDE2DTransform { - type: 'kde2d'; - size: (number | SignalRef)[] | SignalRef; // TODO: change to Vector2 after https://github.com/Microsoft/TypeScript/issues/28017 has been fixed - x: string | TransformField; - y: string | TransformField; - groupby?: (string | TransformField)[] | SignalRef; - weight?: string | TransformField; - cellSize?: number | SignalRef; - bandwidth?: (number | SignalRef)[] | SignalRef; // TODO: change to Vector2 after https://github.com/Microsoft/TypeScript/issues/28017 has been fixed - counts?: boolean | SignalRef; - as?: string | SignalRef; -} - -export interface LoessTransform { - type: 'loess'; - x: FieldRef; - y: FieldRef; - groupby?: FieldRef[] | SignalRef; - bandwidth?: number | SignalRef; - as?: Vector2 | SignalRef; -} - -export interface LabelTransform { - type: 'label'; - size: Vector2 | SignalRef; - sort?: Compare; - offset?: number[] | number | SignalRef; - anchor?: string[] | string | SignalRef; - padding?: number | SignalRef; - markIndex?: number; - lineAnchor?: 'begin' | 'end' | SignalRef; - avoidBaseMark?: boolean | SignalRef; - avoidMarks?: string[]; - as?: Vector7 | SignalRef; -} - -export interface LookupTransform { - type: 'lookup'; - from: DataName; - key: FieldRef; - fields: FieldRef[] | SignalRef; - values?: FieldRef[] | SignalRef; - as?: (string | SignalRef)[] | SignalRef; - default?: any; // includes SignalRef -} - -export interface NestTransform { - type: 'nest'; - keys?: FieldRef[] | SignalRef; - generate?: boolean | SignalRef; -} - -export interface PackTransform { - type: 'pack'; - field?: FieldRef; - sort?: Compare; - padding?: number | SignalRef; - radius?: FieldRef; - size?: Vector2 | SignalRef; - as?: Vector5 | SignalRef; -} - -export interface PartitionTransform { - type: 'partition'; - field?: FieldRef; - sort?: Compare; - padding?: number | SignalRef; - round?: boolean | SignalRef; - size?: Vector2 | SignalRef; - as?: Vector6 | SignalRef; -} - -export interface PieTransform { - type: 'pie'; - field?: FieldRef; - startAngle?: number | SignalRef; - endAngle?: number | SignalRef; - sort?: boolean | SignalRef; - as?: Vector2 | SignalRef; -} - -export interface PivotTransform { - type: 'pivot'; - field: FieldRef; - value: FieldRef; - groupby?: FieldRef[] | SignalRef; - limit?: number | SignalRef; - op?: string | SignalRef; - key?: string | TransformField; -} - -export interface ProjectTransform { - type: 'project'; - fields?: FieldRef[] | SignalRef; - as?: (string | SignalRef | null)[] | SignalRef; -} - -export interface QuantileTransform { - type: 'quantile'; - field: FieldRef; - groupby?: FieldRef[] | SignalRef; - step?: number | SignalRef; - probs?: number[] | SignalRef; - as?: (string | SignalRef)[] | SignalRef; -} - -export interface RegressionTransform { - type: 'regression'; - x: FieldRef; - y: FieldRef; - groupby?: FieldRef[] | SignalRef; - method?: RegressionMethod | SignalRef; - order?: number | SignalRef; - extent?: [number, number] | SignalRef; - params?: boolean | SignalRef; - as?: Vector2 | SignalRef; -} -export type RegressionMethod = 'linear' | 'exp' | 'log' | 'quad' | 'poly' | 'pow'; - -export interface ResolveFilterTransform { - type: 'resolvefilter'; - ignore: number | SignalRef; - filter: SignalRef; -} - -export interface SampleTransform { - type: 'sample'; - size: number | SignalRef; -} - -export interface SequenceTransform { - type: 'sequence'; - start: number | SignalRef; - stop: number | SignalRef; - step?: number | SignalRef; - as?: string | SignalRef; -} - -export interface StackTransform { - type: 'stack'; - field?: FieldRef; - groupby?: FieldRef[]; - sort?: Compare; - offset?: StackOffset | SignalRef; - as?: Vector2 | SignalRef; -} -export type StackOffset = 'zero' | 'center' | 'normalize'; - -export interface StratifyTransform { - type: 'stratify'; - key: FieldRef; - parentKey: FieldRef; -} - -export interface TimeUnitTransform { - type: 'timeunit'; - field: FieldRef; - interval?: boolean | SignalRef; - units?: (TimeUnit | SignalRef)[] | SignalRef; - step?: number | SignalRef; - timezone?: TimeZone | SignalRef; - as?: Vector2 | SignalRef; - signal?: SignalName; -} -export type TimeZone = 'local' | 'utc'; -export type TimeUnit = - | 'year' - | 'quarter' - | 'month' - | 'week' - | 'day' - | 'date' - | 'dayofyear' - | 'hours' - | 'minutes' - | 'seconds' - | 'milliseconds'; - -export interface TreeTransform { - type: 'tree'; - field?: FieldRef; - sort?: Compare; - method?: TreeMethod | SignalRef; - size?: Vector2 | SignalRef; - nodeSize?: Vector2 | SignalRef; - separation?: boolean | SignalRef; - as?: Vector4 | SignalRef; -} -export type TreeMethod = 'tidy' | 'cluster'; - -export interface TreeLinksTransform { - type: 'treelinks'; -} - -export interface TreemapTransform { - type: 'treemap'; - field?: FieldRef; - sort?: Compare; - method?: TreemapMethod | SignalRef; - padding?: number | SignalRef; - paddingInner?: number | SignalRef; - paddingOuter?: number | SignalRef; - paddingTop?: number | SignalRef; - paddingRight?: number | SignalRef; - paddingBottom?: number | SignalRef; - paddingLeft?: number | SignalRef; - ratio?: number | SignalRef; - round?: boolean | SignalRef; - size?: Vector2 | SignalRef; - as?: Vector6 | SignalRef; -} -export type TreemapMethod = 'squarify' | 'resquarify' | 'binary' | 'dice' | 'slice' | 'slicedice'; - -export interface VoronoiTransform { - type: 'voronoi'; - x: FieldRef; - y: FieldRef; - size?: Vector2 | SignalRef; - extent?: Vector2 | SignalRef> | SignalRef; - as?: string | SignalRef; -} - -export interface WindowTransform { - type: 'window'; - sort?: Compare; - groupby?: FieldRef[] | SignalRef; - ops?: (AggregateOp | WindowOnlyOp | SignalRef)[]; - params?: (number | SignalRef | null)[] | SignalRef; - fields?: (FieldRef | null)[] | SignalRef; - as?: (string | SignalRef | null)[] | SignalRef; - frame?: Vector2 | SignalRef; - ignorePeers?: boolean | SignalRef; -} -export type WindowOnlyOp = - | 'row_number' - | 'rank' - | 'dense_rank' - | 'percent_rank' - | 'cume_dist' - | 'ntile' - | 'lag' - | 'lead' - | 'first_value' - | 'last_value' - | 'nth_value' - | 'prev_value' - | 'next_value'; - -export interface WordcloudTransform { - type: 'wordcloud'; - size?: Vector2 | SignalRef; - font?: string | TransformField; - fontStyle?: FontStyle | TransformField; - fontWeight?: FontWeight | TransformField; - fontSize?: number | TransformField; - fontSizeRange?: Vector2 | SignalRef; - rotate?: number | TransformField; - text?: string | TransformField; - spiral?: WordcloudSpiral | SignalRef; - padding?: number | TransformField; - as?: Vector7 | SignalRef; -} -export type WordcloudSpiral = 'archimedian' | 'rectangular'; diff --git a/node_modules/vega-typings/types/spec/util.d.ts b/node_modules/vega-typings/types/spec/util.d.ts deleted file mode 100644 index 8b5c43c..0000000 --- a/node_modules/vega-typings/types/spec/util.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export type Vector2 = [T, T]; -export type Vector3 = [T, T, T]; -export type Vector4 = [T, T, T, T]; -export type Vector5 = [T, T, T, T, T]; -export type Vector6 = [T, T, T, T, T, T]; -export type Vector7 = [T, T, T, T, T, T, T]; -export type Vector10 = [T, T, T, T, T, T, T, T, T, T]; -export type Vector12 = [T, T, T, T, T, T, T, T, T, T, T, T]; diff --git a/node_modules/vega-typings/types/spec/values.d.ts b/node_modules/vega-typings/types/spec/values.d.ts deleted file mode 100644 index 9833cbf..0000000 --- a/node_modules/vega-typings/types/spec/values.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Color } from './color'; -import { StrokeCap } from './config'; -import { - Align, - AlignValueRef, - AnchorValueRef, - ArrayValueRef, - BooleanValueRef, - ColorValueRef, - FontStyle, - FontStyleValueRef, - FontWeight, - FontWeightValueRef, - NumericValueRef, - Orient, - OrientValueRef, - StringValueRef, - StrokeCapValueRef, - SymbolShape, - SymbolShapeValueRef, - TextBaseline, - TextBaselineValueRef, -} from './encode'; -import { TitleAnchor } from './title'; - -export type NumberValue = number | NumericValueRef; - -export type FontWeightValue = FontWeight | FontWeightValueRef; - -export type FontStyleValue = FontStyle | FontStyleValueRef; - -export type StringValue = string | StringValueRef; - -export type ColorValue = null | Color | ColorValueRef; - -export type AlignValue = Align | AlignValueRef; - -export type StrokeCapValue = StrokeCap | StrokeCapValueRef; - -export type TextBaselineValue = TextBaseline | TextBaselineValueRef; - -export type SymbolShapeValue = SymbolShape | SymbolShapeValueRef; - -export type BooleanValue = boolean | BooleanValueRef; - -export type DashArrayValue = number[] | ArrayValueRef; - -export type AnchorValue = TitleAnchor | AnchorValueRef; - -export type OrientValue = Orient | OrientValueRef; diff --git a/node_modules/vega-util/LICENSE b/node_modules/vega-util/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-util/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-util/README.md b/node_modules/vega-util/README.md deleted file mode 100644 index 30a4802..0000000 --- a/node_modules/vega-util/README.md +++ /dev/null @@ -1,555 +0,0 @@ -# vega-util - -JavaScript utilities for Vega. Provides a set of helper methods used throughout Vega modules, including function generators, type checkers, log messages, and additional utilities for Object, Array and String values. - -## API Reference - -- [Functions](#functions) -- [Type Checkers](#type-checkers) -- [Type Coercion](#type-coercion) -- [Objects](#objects) -- [Arrays](#arrays) -- [Dates](#dates) -- [Logging](#logging) -- [Errors](#errors) - -### Functions - -Functions and function generators for accessing and comparing values. - -# -vega.accessor(function[, fields, name]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/accessor.js "Source") - -Annotates a *function* instance with a string array of dependent data *fields* and a string *name*, and returns the input *function*. Assumes the input function takes an object (data tuple) as input, and that strings in the *fields* array correspond to object properties accessed by the function. Once annotated, Vega dataflows can track data field dependencies and generate appropriate output names (e.g., when computing aggregations) if the function is used as an accessor. - -Internally, this method assigns the field array to the `fields` property of the input *function*, and the name to the `fname` property. To be future-proof, clients should not access these properties directly. Instead, use the [accessorFields](#accessorFields) and [accessorName](#accessorName) methods. - -# -vega.accessorFields(accessor) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/accessor.js "Source") - -Returns the array of dependent field names for a given *accessor* function. Returns null if no field names have been set. - -# -vega.accessorName(accessor) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/accessor.js "Source") - -Returns the name string for a given *accessor* function. Returns null if no name has been set. - -# -vega.compare(fields[, orders]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/compare.js "Source") - -Generates a comparator function for sorting data values, based on the given set of *fields* and optional sort *orders*. The *fields* argument must be either a string, an accessor function, or an array of either. Strings indicate the name of object properties to sort by, in precedence order. Field strings may include nested properties (e.g., `foo.bar.baz`). The *orders* argument must be either a string or an array of strings; the valid string values are `'ascending'` (for ascending sort order of the corresponding field) or `'descending'` (for descending sort order of the corresponding field). If the *orders* argument is omitted, is shorter than the *fields* array, or includes values other than `'ascending'` or `'descending'`, corresponding fields will default to ascending order. - -# -vega.constant(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/constant.js "Source") - -Given an input *value*, returns a function that simply returns that value. If the input *value* is itself a function, that function is returned directly. - -# -vega.debounce(delay, func) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/debounce.js "Source") - -Generates a "debounced" function that delays invoking *func* until after *delay* milliseconds have elapsed since the last time the debounced function was invoked. Invocation passes up to one argument from the debounced function to *func* and does not preserve the *this* context. - -# -vega.field(field[, name]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/field.js "Source") - -Generates an accessor function for retrieving the specified *field* value. The input *field* string may include nested properties (e.g., `foo.bar.baz`). An optional *name* argument indicates the accessor name for the generated function; if excluded the field string will be used as the name (see the [accessor](#accessor) method for more details). - -```js -var fooField = vega.field('foo'); -fooField({foo: 5}); // 5 -vega.accessorName(fooField); // 'foo' -vega.accessorFields(fooField); // ['foo'] - -var pathField = vega.field('foo.bar', 'path'); -pathField({foo: {bar: 'vega'}}); // 'vega' -pathField({foo: 5}); // undefined -vega.accessorName(pathField); // 'path' -vega.accessorFields(pathField); // ['foo.bar'] -``` - -# -vega.id(object) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/accessors.js "Source") - -An accessor function that returns the value of the `id` property of an input *object*. - -# -vega.identity(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/accessors.js "Source") - -An accessor function that simply returns its *value* argument. - -# -vega.key(fields[, flat]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/key.js "Source") - -Generates an accessor function that returns a key string (suitable for using as an object property name) for a set of object *fields*. The *fields* argument must be either a string or string array, with each entry indicating a property of an input object to be used to produce representative key values. The resulting key function is an [accessor](#accessor) instance with the accessor name `'key'`. The optional *flat* argument is a boolean flag indicating if the field names should be treated as flat property names, side-stepping nested field lookups normally indicated by dot or bracket notation. By default, *flat* is `false` and nested property lookup is performed. - -```js -var keyf = vega.key(['foo', 'bar']); -keyf({foo:'hi', bar:5}); // 'hi|5' -vega.accessorName(keyf); // 'key' -vega.accessorFields(keyf); // ['foo', 'bar'] -``` - -# -vega.one() -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/accessors.js "Source") - -An accessor function that simply returns the value one (`1`). - -# -vega.zero() -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/accessors.js "Source") - -An accessor function that simply returns the value zero (`0`). - -# -vega.truthy() -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/accessors.js "Source") - -An accessor function that simply returns the boolean `true` value. - -# -vega.falsy() -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/accessors.js "Source") - -An accessor function that simply returns the boolean `false` value. - -### Type Checkers - -Functions for checking the type of JavaScript values. - -# -vega.isArray(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/isArray.js "Source") - -Returns `true` if the input *value* is an Array instance, `false` otherwise. - -# -vega.isBoolean(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/isBoolean.js "Source") - -Returns `true` if the input *value* is a Boolean instance, `false` otherwise. - -# -vega.isDate(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/isDate.js "Source") - -Returns `true` if the input *value* is a Date instance, `false` otherwise. - -# -vega.isFunction(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/isFunction.js "Source") - -Returns `true` if the input *value* is a Function instance, `false` otherwise. - -# -vega.isNumber(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/isNumber.js "Source") - -Returns `true` if the input *value* is a Number instance, `false` otherwise. - -# -vega.isObject(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/isObject.js "Source") - -Returns `true` if the input *value* is an Object instance, `false` otherwise. - -# -vega.isRegExp(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/isRegExp.js "Source") - -Returns `true` if the input *value* is a RegExp instance, `false` otherwise. - -# -vega.isString(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/isString.js "Source") - -Returns `true` if the input *value* is a String instance, `false` otherwise. - -### Type Coercion - -Functions for coercing values to a desired type. - -# -vega.toBoolean(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/toBoolean.js "Source") - -Coerces the input _value_ to a boolean. The strings `"true"` and `"1"` map to `true`; the strings `"false"` and `"0"` map to `false`. Null values and empty strings are mapped to `null`. - -# -vega.toDate(value[, parser]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/toDate.js "Source") - -Coerces the input _value_ to a Date timestamp. Null values and empty strings are mapped to `null`. Date objects are passed through unchanged. If an optional _parser_ function is provided, it is used to perform date parsing. By default, numbers (timestamps) are passed through unchanged and otherwise `Date.parse` is used. Be aware that `Date.parse` has different implementations across browsers! - -# -vega.toNumber(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/toNumber.js "Source") - -Coerces the input _value_ to a number. Null values and empty strings are mapped to `null`. - -# -vega.toString(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/toString.js "Source") - -Coerces the input _value_ to a string. Null values and empty strings are mapped to `null`. - -### Objects - -Functions for manipulating JavaScript Object values. - -# -vega.extend(target[, source1, source2, …]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/extend.js "Source") - -Extends a *target* object by copying (in order) all enumerable properties of the input *source* objects. - -# -vega.inherits(child, parent) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/inherits.js "Source") - -A convenience method for setting up object-oriented inheritance. Assigns the `prototype` property of the input *child* function, such that the *child* inherits the properties of the *parent* function's prototype via prototypal inheritance. Returns the new child prototype object. - -# -vega.lruCache([maxsize]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/lruCache.js "Source") - -Provides a key/value cache, keyed by string, that evicts least recently used (LRU) entries. Supports *has*, *get*, *set*, and *clear* methods. The optional *maxsize* argument (default 10,000) determines the maximum number of elements that can be added before items are evicted. - -In the internal implementation two caches are used: a current cache and a previous cache. When then current cache fills, it becomes the previous cache and a new, empty current cache is created. Subsequent *get* calls will promote elements in the previous cache to the current cache. Once the current cache fills, the caches are again turned over and all LRU items still residing in the previous cache are dropped. - -```js -var cache = vega.lruCache(1); // use 1-element cache to demonstrate -cache.set('a', 1); // current cache has a->1 -cache.set('b', 2); // current cache has b->2, previous cache has a->1 -cache.get('a'); // -> 1 (a now in current cache, b in previous cache) -cache.set('c', 3); // current cache has c->3, previous cache has a->1 -cache.has('c'); // -> true (c is in the current cache) -cache.has('b'); // -> false (b has been evicted) -cache.has('a'); // -> true (a is in the previous cache) -cache.get('c'); // -> 3 -cache.clear(); -``` - -# -vega.fastmap([object]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/fastmap.js "Source") - -Provides a key/value map data structure, keyed by string. Supports a subset of the [ES6 Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) API, including *has*, *get*, *set*, *delete* and *clear* methods and a *size* property. If the optional *object* argument is provided, all key/values on the input object will be added to the new map instance. - -```js -var map = vega.fastmap({foo:1, bar:2}); -map.has('foo'); // -> true -map.get('foo'); // -> 1 -map.delete('bar'); -map.has('bar'); // -> false -map.set('baz', 0); -map.get('baz'); // -> 0 -map.size; // -> 2 -map.empty; // -> 1 (number of empty entries) -map.clean(); // invoke garbage collection, clears empty entries -``` - -By using basic JavaScript objects to hash values and avoiding calls to the built-in JavaScript `delete` operator, fastmaps provide good performance. However, this speed comes at the cost of some object bloat, requiring periodic garbage collection in the case of many deletions. The fastmap object provides a *clean* method for requesting garbage collection of empty map entries. The *test* method is a getter/setter for providing an optional boolean-valued function that indicates additional objects (not just empty entries from deleted keys) that should be removed during garbage collection. - -# -vega.hasOwnProperty(object, property) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/hasOwnProperty.js "Source") - -Returns `true` if the input *object* has a named *property* defined on it, otherwise `false`. This method concerns the input object only, ignoring properties defined up the prototype chain. The method is equivalent to [`Object.hasOwnProperty`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty), but improves security by guarding against overridden Object prototype built-ins. - -# -vega.mergeConfig(...config) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/mergeConfig.js "Source") - -Merges a collection of Vega configuration objects into a single combined object. Configuration objects with higher index positions in the arguments list have higher precedence, and so may override settings provided by earlier objects. - -# -vega.writeConfig(config, key, value[, recurse]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/mergeConfig.js "Source") - -Writes a value to a Vega configuration object. Given a *config* object and a configuration property *key* and *value*, appropriately assign the value to the config object. The *recurse* parameter controls if recursive merging (as opposed to overwriting) is performed: if `false` or undefined, no recursion is performed; if `true` one level of recursive merge is performed; if *recurse* is object-valued, one level of recursive merge is performed for keys that the *recurse* object maps to a truthy value. This method is a helper method used within *mergeConfig*. - -### Arrays - -Functions for manipulating JavaScript Array values. - -# -vega.array(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/array.js "Source") - -Ensures that the input *value* is an Array instance. If so, the *value* is simply returned. If not, the *value* is wrapped within a new single-element an array, returning `[value]`. - -# -vega.clampRange(range, min, max) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/clampRange.js "Source") - -Span-preserving range clamp. If the span of the input *range* is less than (*max* - *min*) and an endpoint exceeds either the *min* or *max* value, the range is translated such that the span is preserved and one endpoint touches the boundary of the min/max range. If the span exceeds (*max* - *min*), returns the range `[min, max]`. - -# -vega.extent(array[, accessor]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/extent.js "Source") - -Returns an array with the minimum and maximum values in the input *array*, in the form `[min, max]`. Ignores null, undefined, and NaN values. The optional *accessor* argument provides a function that is first applied to each array value prior to comparison. - -# -vega.extentIndex(array[, accessor]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/extentIndex.js "Source") - -Returns the array indices for the minimum and maximum values in the input *array* (as a `[minIndex, maxIndex]` array), according to natural ordering. The optional *accessor* argument provides a function that is first applied to each array value prior to comparison. - -```js -vega.extentIndex([1,5,3,0,4,2]); // [3, 1] -vega.extentIndex([ - {a: 3, b:2}, - {a: 2, b:1}, - {a: 1, b:3} -], vega.field('b')); // [1, 2] -``` - -# -vega.flush(range, value, threshold, left, right, center) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/inrange.js "Source") - -Selects among potential return values if the provided *value* is flush with the input numeric *range*. Returns *left* if *value is within the *threshold* distance of the minimum element of the *range*. Returns *right* if *value is within the *threshold* distance of the maximum element of the *range*. Otherwise, returns *center*. - -# -vega.inrange(value, range[, left, right]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/inrange.js "Source") - -Returns `true` if the input *value* lies within the span of the given *range* array. The *left* and *right* boolean flags control the use of inclusive (true) or exclusive (false) comparisons; if unspecified, inclusive tests are used. - -# -vega.lerp(array, fraction) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/lerp.js "Source") - -Returns the linearly interpolated value between the first and last entries in the *array* for the provided interpolation *fraction* (typically between 0 and 1). For example, *lerp([0, 50], 0.5)* returns 25. - -# -vega.merge(compare, array1, array2[, output]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/merge.js "Source") - -Merge two sorted arrays into a single sorted array. The input *compare* function is a comparator for sorting elements and should correspond to the pre-sorted orders of the *array1* and *array2* source arrays. The merged array contents are written to the *output* array, if provided. If *output* is not specified, a new array is generated and returned. - -# -vega.panLinear(domain, delta) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/transform.js "Source") - -Given an input numeric _domain_ (sorted in increasing order), returns a new domain array that translates the domain by a _delta_ using a linear transform. The _delta_ value is expressed as a fraction of the current domain span, and may be positive or negative to indicate the translation direction. The return value is a two-element array indicating the starting and ending value of the translated (panned) domain. - -# -vega.panLog(domain, delta) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/transform.js "Source") - -Given an input numeric _domain_ (sorted in increasing order), returns a new domain array that translates the domain by a _delta_ using a logarithmic transform. The _delta_ value is expressed as a fraction of the current domain span, and may be positive or negative to indicate the translation direction. The return value is a two-element array indicating the starting and ending value of the translated (panned) domain. - -# -vega.panPow(domain, delta, exponent) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/transform.js "Source") - -Given an input numeric _domain_ (sorted in increasing order), returns a new domain array that translates the domain by a _delta_ using a power scale transform parameterized by the provided _exponent_. The _delta_ value is expressed as a fraction of the current domain span, and may be positive or negative to indicate the translation direction. The return value is a two-element array indicating the starting and ending value of the translated (panned) domain. - -# -vega.panSymlog(domain, delta, constant) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/transform.js "Source") - -Given an input numeric _domain_ (sorted in increasing order), returns a new domain array that translates the domain by a _delta_ using a symlog (symmetric log) scale transform parameterized by the provided _constant_. The _delta_ value is expressed as a fraction of the current domain span, and may be positive or negative to indicate the translation direction. The return value is a two-element array indicating the starting and ending value of the translated (panned) domain. - -# -vega.peek(array) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/peek.js "Source") - -Returns the last element in the input *array*. Similar to the built-in `Array.pop` method, except that it does not remove the last element. This method is a convenient shorthand for `array[array.length - 1]`. - -# -vega.span(array) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/span.js "Source") - -Returns the numerical span of the input *array*: the difference between the last and first values. - -# -vega.toSet(array) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/toSet.js "Source") - -Given an input *array* of values, returns a new Object instance whose property keys are the values in *array*, each assigned a property value of `1`. Each value in *array* is coerced to a String value and so should map to a reasonable string key value. - -```js -vega.toSet([1, 2, 3]); // {'1':1, '2':1, '3':1} -``` - -# -vega.visitArray(array, [filter,] visitor) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/visitArray.js "Source") - -Vists the values in an input *array*, invoking the *visitor* function for each array value that passes an optional *filter*. If specified, the *filter* function is called with each individual array value. If the *filter* function return value is truthy, the returned value is then passed as input to the *visitor* function. Thus, the *filter* not only performs filtering, it can serve as a value transformer. If the *filter* function is not specified, all values in the *array* are passed to the *visitor* function. Similar to the built-in `Array.forEach` method, the *visitor* function is invoked with three arguments: the value to visit, the current index into the source *array*, and a reference to the soure *array*. - -```js -// console output: 1 0; 3 2 -vega.visitArray([0, -1, 2], - function(x) { return x + 1; }, - function(v, i, array) { console.log(v, i); }); -``` - -# -vega.zoomLinear(domain, anchor, scale) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/transform.js "Source") - -Given an input numeric _domain_ (sorted in increasing order), returns a new domain array that scales (zooms) the domain by a _scale_ factor using a linear transform, centered on the given _anchor_ value. If _anchor_ is `null`, the midpoint of the domain is used instead. The return value is a two-element array indicating the starting and ending value of the scaled (zoomed) domain. - -# -vega.zoomLog(domain, anchor, scale) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/transform.js "Source") - -Given an input numeric _domain_ (sorted in increasing order), returns a new domain array that scales (zooms) the domain by a _scale_ factor using a logarithmic transform, centered on the given _anchor_ value. If _anchor_ is `null`, the midpoint of the domain is used instead. The return value is a two-element array indicating the starting and ending value of the scaled (zoomed) domain. - -# -vega.zoomPow(domain, anchor, scale, exponent) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/transform.js "Source") - -Given an input numeric _domain_ (sorted in increasing order), returns a new domain array that scales (zooms) the domain by a _scale_ factor using a power scale transform parameterized by the provided _exponent_, centered on the given _anchor_ value. If _anchor_ is `null`, the midpoint of the domain is used instead. The return value is a two-element array indicating the starting and ending value of the scaled (zoomed) domain. - -# -vega.zoomSymlog(domain, anchor, scale, constant) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/transform.js "Source") - -Given an input numeric _domain_ (sorted in increasing order), returns a new domain array that scales (zooms) the domain by a _scale_ factor using a symlog (symmetric log) scale transform parameterized by the provided _constant_, centered on the given _anchor_ value. If _anchor_ is `null`, the midpoint of the domain is used instead. The return value is a two-element array indicating the starting and ending value of the scaled (zoomed) domain. - -### Dates - -Functions for manipulating JavaScript Date values. - -# -vega.quarter(date) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/quarter.js "Source") - -Returns the quarter of the year (an integer between 1 and 4) for an input *date* object or timestamp for the local timezone. - -# -vega.utcquarter(date) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/quarter.js "Source") - -Returns the quarter of the year (an integer between 1 and 4) for an input *date* object or timestamp for Coordinated Universal Time (UTC). - - -### Strings - -Functions for generating and manipulating JavaScript String values. - -# -vega.pad(string, length[, character, align]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/pad.js "Source") - -Pads a *string* value with repeated instances of a *character* up to a specified *length*. If *character* is not specified, a space (`' '`) is used. By default, padding is added to the end of a string. An optional *align* parameter specifies if padding should be added to the `'left'` (beginning), `'center'`, or `'right'` (end) of the input string. - -```js -vega.pad('15', 5, '0', 'left'); // '00015' -``` - -# -vega.repeat(string, count) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/repeat.js "Source") - -Given an input *string*, returns a new string that repeats the input *count* times. - -```js -vega.repeat('0', 5); // '00000' -``` - -# -vega.splitAccessPath(path) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/splitAccessPath.js "Source") - -Splits an input string representing an access *path* for JavaScript object properties into an array of constituent path elements. - -```js -vega.splitAccessPath('foo'); // ['foo'] -vega.splitAccessPath('foo.bar'); // ['foo', 'bar'] -vega.splitAccessPath('foo["bar"]'); // ['foo', 'bar'] -vega.splitAccessPath('foo[0].bar'); // ['foo', '0', 'bar'] -``` - -# -vega.stringValue(value) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/stringValue.js "Source") - -Returns an output representation of an input value that is both JSON and JavaScript compliant. For Object and String values, `JSON.stringify` is used to generate the output string. Primitive types such as Number or Boolean are returned as-is. This method can be used to generate values that can then be included in runtime-compiled code snippets (for example, via the Function constructor). - -# -vega.truncate(string, length[, align, ellipsis]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/truncate.js "Source") - -Truncates an input *string* to a target *length*. The optional *align* argument indicates what part of the string should be truncated: `'left'` (the beginning), `'center'`, or `'right'` (the end). By default, the `'right'` end of the string is truncated. The optional *ellipsis* argument indicates the string to use to indicate truncated content; by default the ellipsis character (`…`, same as `\u2026`) is used. - - -### Logging - -# -vega.logger([level, method]) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/logger.js "Source") - -Generates a new logger instance for selectively writing log messages to the JavaScript console. The optional *level* argument indicates the initial log level to use (one of [None](#none), [Warn](#warn), [Info](#info), or [Debug](#debug)), and defaults to [None](#none) if not specified. - -The generated logger instance provides the following methods: - -- level(value): Sets the current logging level. Only messages with a log level less than or equal to *value* will be written to the console. -- error(message1[, message2, …]): Logs an error message. The messages will be written to the console using the `console.error` method if the current log level is [Error](#error) or higher. -- warn(message1[, message2, …]): Logs a warning message. The messages will be written to the console using the `console.warn` method if the current log level is [Warn](#warn) or higher. -- info(message1[, message2, …]): Logs an informative message. The messages will be written to the console using the `console.log` method if the current log level is [Info](#info) or higher. -- debug(message1[, message2, …]): Logs a debugging message. The messages will be written to the console using the `console.log` method if the current log level is [Debug](#debug) or higher. - -To override the choice of console method invoked (`console.log`, `console.warn`, or `console.error`), use the optional *method* argument (one of `"log"`, `"warn"`, or `"error"`) to route all log messages through the same method. - -# -vega.None -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/logger.js "Source") - -Constant value indicating a log level of 'None'. If set as the log level of a [logger](#logger) instance, all log messages will be suppressed. - -# -vega.Error -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/logger.js "Source") - -Constant value indicating a log level of 'Error'. If set as the log level of a [logger](#logger) instance, only error messages will be presented. - -# -vega.Warn -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/logger.js "Source") - -Constant value indicating a log level of 'Warn'. If set as the log level of a [logger](#logger) instance, both error and warning messages will be presented. - -# -vega.Info -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/logger.js "Source") - -Constant value indicating a log level of 'Info'. If set as the log level of a [logger](#logger) instance, error, warning and info messages will be presented. - -# -vega.Debug -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/logger.js "Source") - -Constant value indicating a log level of 'Debug'. If set as the log level of a [logger](#logger) instance, all log messages (error, warning, info and debug) will be presented. - - -### Errors - -# -vega.error(message) -[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/error.js "Source") - -Throws a new error with the provided error *message*. This is a convenience method adding a layer of indirection for error handling, for example allowing error conditions to be included in expression chains. - -```js -vega.error('Uh oh'); // equivalent to: throw Error('Uh oh') - -// embed error in an expression -return isOk ? returnValue : vega.error('Not OK'); -``` diff --git a/node_modules/vega-util/build/vega-util.js b/node_modules/vega-util/build/vega-util.js deleted file mode 100644 index 09d0e2a..0000000 --- a/node_modules/vega-util/build/vega-util.js +++ /dev/null @@ -1,931 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.vega = {})); -}(this, (function (exports) { 'use strict'; - - function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; - } - - function accessorName(fn) { - return fn == null ? null : fn.fname; - } - - function accessorFields(fn) { - return fn == null ? null : fn.fields; - } - - function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); - } - - const get1 = field => function(obj) { - return obj[field]; - }; - - const getN = path => { - const len = path.length; - return function(obj) { - for (let i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - return obj; - }; - }; - - function error(message) { - throw Error(message); - } - - function splitAccessPath(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, j, c; - - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i=j=0; j i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; - } - - function field(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor( - (opt && opt.get || getter)(path), - [field], - name || field - ); - } - - var empty = []; - - var id = field('id'); - - var identity = accessor(function(_) { return _; }, empty, 'identity'); - - var zero = accessor(function() { return 0; }, empty, 'zero'); - - var one = accessor(function() { return 1; }, empty, 'one'); - - var truthy = accessor(function() { return true; }, empty, 'true'); - - var falsy = accessor(function() { return false; }, empty, 'false'); - - function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console - } - - var None = 0; - var Error$1 = 1; - var Warn = 2; - var Info = 3; - var Debug = 4; - - function logger(_, method) { - var level = _ || None; - return { - level: function(_) { - if (arguments.length) { - level = +_; - return this; - } else { - return level; - } - }, - error: function() { - if (level >= Error$1) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function() { - if (level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function() { - if (level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function() { - if (level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; - } - - var isArray = Array.isArray; - - function isObject(_) { - return _ === Object(_); - } - - const isLegalKey = key => key !== '__proto__'; - - function mergeConfig(...configs) { - return configs.reduce((out, source) => { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? {layout: 1} - : key === 'style' ? true - : null; - writeConfig(out, key, source[key], r); - } - } - return out; - }, {}); - } - - function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - - var k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : (output[key] = {}); - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } - } - - function mergeNamed(a, b) { - if (a == null) return b; - - const map = {}, out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; - } - - function peek(array) { - return array[array.length - 1]; - } - - function toNumber(_) { - return _ == null || _ === '' ? null : +_; - } - - function exp(sign) { - return function(x) { return sign * Math.exp(x); }; - } - - function log$1(sign) { - return function(x) { return Math.log(sign * x); }; - } - - function symlog(c) { - return function(x) { return Math.sign(x) * Math.log1p(Math.abs(x / c)); }; - } - - function symexp(c) { - return function(x) { return Math.sign(x) * Math.expm1(Math.abs(x)) * c; }; - } - - function pow(exponent) { - return function(x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; - } - - function pan(domain, delta, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - dd = (d1 - d0) * delta; - - return [ - ground(d0 - dd), - ground(d1 - dd) - ]; - } - - function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); - } - - function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log$1(sign), exp(sign)); - } - - function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1/exponent)); - } - - function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); - } - - function zoom(domain, anchor, scale, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - - return [ - ground(da + (d0 - da) * scale), - ground(da + (d1 - da) * scale) - ]; - } - - function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); - } - - function zoomLog(domain, anchor, scale) { - var sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log$1(sign), exp(sign)); - } - - function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1/exponent)); - } - - function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); - } - - function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); - } - - function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); - } - - function array(_) { - return _ != null ? (isArray(_) ? _ : [_]) : []; - } - - /** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ - function clampRange(range, min, max) { - var lo = range[0], - hi = range[1], - span; - - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - span = hi - lo; - - return span >= (max - min) - ? [min, max] - : [ - (lo = Math.min(Math.max(lo, min), max - span)), - lo + span - ]; - } - - function isFunction(_) { - return typeof _ === 'function'; - } - - const DESCENDING = 'descending'; - - function compare(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - - const ord = [], get = [], fmap = {}, - gen = opt.comparator || comparator; - - array(fields).forEach((f, i) => { - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach(_ => fmap[_] = 1); - }); - - return get.length === 0 - ? null - : accessor(gen(get, ord), Object.keys(fmap)); - } - - const compare$1 = (u, v) => (u < v || u == null) && v != null ? -1 - : (u > v || v == null) && u != null ? 1 - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? -1 - : v !== v && u === u ? 1 - : 0; - - const comparator = (fields, orders) => fields.length === 1 - ? compare1(fields[0], orders[0]) - : compareN(fields, orders, fields.length); - - const compare1 = (field, order) => function(a, b) { - return compare$1(field(a), field(b)) * order; - }; - - const compareN = (fields, orders, n) => { - orders.push(0); // pad zero for convenient lookup - return function(a, b) { - let f, c = 0, i = -1; - while (c === 0 && ++i < n) { - f = fields[i]; - c = compare$1(f(a), f(b)); - } - return c * orders[i]; - }; - }; - - function constant(_) { - return isFunction(_) ? _ : function() { return _; }; - } - - function debounce(delay, handler) { - var tid, evt; - - function callback() { - handler(evt); - tid = evt = null; - } - - return function(e) { - evt = e; - if (tid) clearTimeout(tid); - tid = setTimeout(callback, delay); - }; - } - - function extend(_) { - for (var x, k, i=1, len=arguments.length; i max) max = v; - } - } - } else { - // find first valid value - for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])); - min = max = v; - - // visit all other values - for (; i max) max = v; - } - } - } - } - - return [min, max]; - } - - function extentIndex(array, f) { - var i = -1, - n = array.length, - a, b, c, u, v; - - if (f == null) { - while (++i < n) { - b = array[i]; - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = array[i]; - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while (++i < n) { - b = f(array[i], i, array); - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = f(array[i], i, array); - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } - - return [u, v]; - } - - const hop = Object.prototype.hasOwnProperty; - - function has(object, property) { - return hop.call(object, property); - } - - var NULL = {}; - - function fastmap(input) { - var obj = {}, - map, - test; - - function has$1(key) { - return has(obj, key) && obj[key] !== NULL; - } - - map = { - size: 0, - empty: 0, - object: obj, - has: has$1, - get(key) { - return has$1(key) ? obj[key] : undefined; - }, - set(key, value) { - if (!has$1(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - obj[key] = value; - return this; - }, - delete(key) { - if (has$1(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - return this; - }, - clear() { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test(_) { - if (arguments.length) { - test = _; - return map; - } else { - return test; - } - }, - clean() { - var next = {}, - size = 0, - key, value; - for (key in obj) { - value = obj[key]; - if (value !== NULL && (!test || !test(value))) { - next[key] = value; - ++size; - } - } - map.size = size; - map.empty = 0; - map.object = (obj = next); - } - }; - - if (input) Object.keys(input).forEach(function(key) { - map.set(key, input[key]); - }); - - return map; - } - - function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - - var a = range[0], - b = peek(range), - t = +threshold, - l, r; - - // swap endpoints if range is reversed - if (b < a) { - l = a; a = b; b = l; - } - - // compare value to endpoints - l = Math.abs(value - a); - r = Math.abs(b - value); - - // adjust if value is within threshold distance of endpoint - return l < r && l <= t ? left : r <= t ? right : center; - } - - function inherits(child, parent) { - var proto = (child.prototype = Object.create(parent.prototype)); - proto.constructor = child; - return proto; - } - - /** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ - function inrange(value, range, left, right) { - var r0 = range[0], r1 = range[range.length-1], t; - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - left = left === undefined || left; - right = right === undefined || right; - - return (left ? r0 <= value : r0 < value) && - (right ? value <= r1 : value < r1); - } - - function isBoolean(_) { - return typeof _ === 'boolean'; - } - - function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; - } - - function isNumber(_) { - return typeof _ === 'number'; - } - - function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; - } - - function isString(_) { - return typeof _ === 'string'; - } - - function key(fields, flat, opt) { - if (fields) { - fields = flat - ? array(fields).map(f => f.replace(/\\(.)/g, '$1')) - : array(fields); - } - - const len = fields && fields.length, - gen = opt && opt.get || getter, - map = f => gen(flat ? [f] : splitAccessPath(f)); - let fn; - - if (!len) { - fn = function() { return ''; }; - } else if (len === 1) { - const get = map(fields[0]); - fn = function(_) { return '' + get(_); }; - } else { - const get = fields.map(map); - fn = function(_) { - let s = '' + get[0](_), i = 0; - while (++i < len) s += '|' + get[i](_); - return s; - }; - } - - return accessor(fn, fields, 'key'); - } - - function lerp(array, frac) { - const lo = array[0], - hi = peek(array), - f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); - } - - const DEFAULT_MAX_SIZE = 10000; - - // adapted from https://github.com/dominictarr/hashlru/ (MIT License) - function lruCache(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - - let curr, prev, size; - - const clear = () => { - curr = {}; - prev = {}; - size = 0; - }; - - const update = (key, value) => { - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - return (curr[key] = value); - }; - - clear(); - - return { - clear, - has: key => has(curr, key) || has(prev, key), - get: key => has(curr, key) ? curr[key] - : has(prev, key) ? update(key, prev[key]) - : undefined, - set: (key, value) => has(curr, key) - ? (curr[key] = value) - : update(key, value) - }; - } - - function merge(compare, array0, array1, output) { - var n0 = array0.length, - n1 = array1.length; - - if (!n1) return array0; - if (!n0) return array1; - - var merged = output || new array0.constructor(n0 + n1), - i0 = 0, i1 = 0, i = 0; - - for (; i0 0 - ? array1[i1++] - : array0[i0++]; - } - - for (; i0= 0) s += str; - return s; - } - - function pad(str, length, padchar, align) { - var c = padchar || ' ', - s = str + '', - n = length - s.length; - - return n <= 0 ? s - : align === 'left' ? repeat(c, n) + s - : align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2)) - : s + repeat(c, n); - } - - /** - * Return the numerical span of an array: the difference between - * the last and first values. - */ - function span(array) { - return array && (peek(array) - array[0]) || 0; - } - - function $(x) { - return isArray(x) ? '[' + x.map($) + ']' - : isObject(x) || isString(x) ? - // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029') - : x; - } - - function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; - } - - function defaultParser(_) { - return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); - } - - function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); - } - - function toString(_) { - return _ == null || _ === '' ? null : _ + ''; - } - - function toSet(_) { - for (var s={}, i=0, n=_.length; ifunction(t){return t[n]},o=n=>{const t=n.length;return function(r){for(let e=0;et&&a(),c=t=r+1):"]"===e&&(c||i("Access path missing open bracket: "+n),c>0&&a(),c=0,t=r+1):r>t?a():t=r+1}return c&&i("Access path missing closing bracket: "+n),o&&i("Access path missing closing quote: "+n),r>t&&(r++,a()),u}function f(n,r,u){const o=c(n);return n=1===o.length?o[0]:n,t((u&&u.get||e)(o),[n],r||n)}var l=[],a=f("id"),s=t((function(n){return n}),l,"identity"),g=t((function(){return 0}),l,"zero"),h=t((function(){return 1}),l,"one"),p=t((function(){return!0}),l,"true"),m=t((function(){return!1}),l,"false");function y(n,t,r){var e=[t].concat([].slice.call(r));console[n].apply(console,e)}var v=Array.isArray;function b(n){return n===Object(n)}const d=n=>"__proto__"!==n;function M(n,t,r,e){var u,o;if(d(t))if(b(r)&&!v(r))for(u in o=b(n[t])?n[t]:n[t]={},r)e&&(!0===e||e[u])?M(o,u,r[u]):d(u)&&(o[u]=r[u]);else n[t]=r}function j(n,t){if(null==n)return t;const r={},e=[];function u(n){r[n.name]||(r[n.name]=1,e.push(n))}return t.forEach(u),n.forEach(u),e}function O(n){return n[n.length-1]}function w(n){return null==n||""===n?null:+n}function x(n){return function(t){return n*Math.exp(t)}}function E(n){return function(t){return Math.log(n*t)}}function z(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function D(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function k(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function A(n,t,r,e){var u=r(n[0]),o=r(O(n)),i=(o-u)*t;return[e(u-i),e(o-i)]}function S(n,t,r,e,u){var o=e(n[0]),i=e(O(n)),c=null!=t?e(t):(o+i)/2;return[u(c+(o-c)*r),u(c+(i-c)*r)]}function N(n){return null!=n?v(n)?n:[n]:[]}function R(n){return"function"==typeof n}const P=(n,t)=>(nt||null==t)&&null!=n?1:(t=t instanceof Date?+t:t,(n=n instanceof Date?+n:n)!==n&&t==t?-1:t!=t&&n==n?1:0),_=(n,t)=>1===n.length?C(n[0],t[0]):L(n,t,n.length),C=(n,t)=>function(r,e){return P(n(r),n(e))*t},L=(n,t,r)=>(t.push(0),function(e,u){let o,i=0,c=-1;for(;0===i&&++c=0;)r+=n;return r}function G(n){return T(n)||I(n)?n:Date.parse(n)}n.Debug=4,n.Error=1,n.Info=3,n.None=0,n.Warn=2,n.accessor=t,n.accessorFields=r,n.accessorName=function(n){return null==n?null:n.fname},n.array=N,n.clampRange=function(n,t,r){var e,u=n[0],o=n[1];return o=r-t?[t,r]:[u=Math.min(Math.max(u,t),r-e),u+e]},n.compare=function(n,e,u){u=u||{},e=N(e)||[];const o=[],i=[],c={},l=u.comparator||_;return N(n).forEach((n,t)=>{null!=n&&(o.push("descending"===e[t]?-1:1),i.push(n=R(n)?n:f(n,null,u)),(r(n)||[]).forEach(n=>c[n]=1))}),0===i.length?null:t(l(i,o),Object.keys(c))},n.constant=function(n){return R(n)?n:function(){return n}},n.debounce=function(n,t){var r,e;function u(){t(e),r=e=null}return function(t){e=t,r&&clearTimeout(r),r=setTimeout(u,n)}},n.error=i,n.extend=function(n){for(var t,r,e=1,u=arguments.length;eo&&(o=e))}else{for(e=t(n[i]);io&&(o=e))}return[u,o]},n.extentIndex=function(n,t){var r,e,u,o,i,c=-1,f=n.length;if(null==t){for(;++c=e){r=u=e;break}if(c===f)return[-1,-1];for(o=i=c;++ce&&(r=e,o=c),u=e){r=u=e;break}if(c===f)return[-1,-1];for(o=i=c;++ce&&(r=e,o=c),uu(n)?e[n]:void 0,set(n,r){return u(n)||(++t.size,e[n]===F&&--t.empty),e[n]=r,this},delete(n){return u(n)&&(--t.size,++t.empty,e[n]=F),this},clear(){t.size=t.empty=0,t.object=e={}},test(n){return arguments.length?(r=n,t):r},clean(){var n,u,o={},i=0;for(n in e)(u=e[n])===F||r&&r(u)||(o[n]=u,++i);t.size=i,t.empty=0,t.object=e=o}},n&&Object.keys(n).forEach((function(r){t.set(r,n[r])})),t},n.field=f,n.flush=function(n,t,r,e,u,o){if(!r&&0!==r)return o;var i,c,f=n[0],l=O(n),a=+r;return li&&(u=o,o=i,i=u),e=void 0===e||e,((r=void 0===r||r)?o<=n:on.replace(/\\(.)/g,"$1")):N(n));const o=n&&n.length,i=u&&u.get||e,f=n=>i(r?[n]:c(n));let l;if(o)if(1===o){const t=f(n[0]);l=function(n){return""+t(n)}}else{const t=n.map(f);l=function(n){let r=""+t[0](n),e=0;for(;++e=1&&y(t||"error","ERROR",arguments),this},warn:function(){return r>=2&&y(t||"warn","WARN",arguments),this},info:function(){return r>=3&&y(t||"log","INFO",arguments),this},debug:function(){return r>=4&&y(t||"log","DEBUG",arguments),this}}},n.lruCache=function(n){let t,r,e;n=+n||1e4;const u=()=>{t={},r={},e=0},o=(u,o)=>(++e>n&&(r=t,t={},e=1),t[u]=o);return u(),{clear:u,has:n=>B(t,n)||B(r,n),get:n=>B(t,n)?t[n]:B(r,n)?o(n,r[n]):void 0,set:(n,r)=>B(t,n)?t[n]=r:o(n,r)}},n.merge=function(n,t,r,e){var u=t.length,o=r.length;if(!o)return t;if(!u)return r;for(var i=e||new t.constructor(u+o),c=0,f=0,l=0;c0?r[f++]:t[c++];for(;c{for(var r in t)if("signals"===r)n.signals=j(n.signals,t.signals);else{var e="legend"===r?{layout:1}:"style"===r||null;M(n,r,t[r],e)}return n},{})},n.one=h,n.pad=function(n,t,r,e){var u=r||" ",o=n+"",i=t-o.length;return i<=0?o:"left"===e?W(u,i)+o:"center"===e?W(u,~~(i/2))+o+W(u,Math.ceil(i/2)):o+W(u,i)},n.panLinear=function(n,t){return A(n,t,w,s)},n.panLog=function(n,t){var r=Math.sign(n[0]);return A(n,t,E(r),x(r))},n.panPow=function(n,t,r){return A(n,t,k(r),k(1/r))},n.panSymlog=function(n,t,r){return A(n,t,z(r),D(r))},n.peek=O,n.quarter=function(n){return 1+~~(new Date(n).getMonth()/3)},n.repeat=W,n.span=function(n){return n&&O(n)-n[0]||0},n.splitAccessPath=c,n.stringValue=function n(t){return v(t)?"["+t.map(n)+"]":b(t)||U(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t},n.toBoolean=function(n){return null==n||""===n?null:!(!n||"false"===n||"0"===n)&&!!n},n.toDate=function(n,t){return t=t||G,null==n||""===n?null:t(n)},n.toNumber=w,n.toSet=function(n){for(var t={},r=0,e=n.length;r = (...args: readonly any[]) => R; -export type AccessorFn = Fn & { fname?: string; fields: readonly string[] }; - -export function accessor(fn: Fn, fields?: readonly string[], name?: string): AccessorFn; -export function accessorFields(fn: AccessorFn): string[]; -export function accessorName(fn: AccessorFn): string; - -export type Order = 'ascending' | 'descending'; - -export function compare(fields: string | readonly string[] | AccessorFn | readonly AccessorFn[], orders?: Order | readonly Order[]): (a: any, b: any) => number; - -export function constant(v: V): () => V; - -export function debounce(delay: number, func: F): F; - -export function field(field: string, name?: string): AccessorFn; - -export function id(_: object): symbol; - -export function identity(v: V): V; - -export function key(fields: readonly string[], flat?: boolean): (_: object) => string; - -export function one(): 1; -export function zero(): 0; -export function truthy(): true; -export function falsy(): false; - -// Type Checkers - -export function isArray(a: any | T[]): a is T[]; -export function isArray(a: any | readonly T[]): a is readonly T[]; -export function isBoolean(a: any): a is boolean; -export function isDate(a: any): a is Date; -export function isFunction(a: any): a is Function; -export function isNumber(a: any): a is number; -export function isObject(a: any): a is object; -export function isRegExp(a: any): a is RegExp; -export function isString(a: any): a is string; - -// Type Coercion - -export function toBoolean(a: any): boolean; -export function toDate(a: any, parser?: (_: any) => number): number; -export function toNumber(a: any): number; -export function toString(a: any): string; - -// Objects - -export function extend(target: T, ...source: readonly Partial[]): T; -export function inherits( - child: C, - parent: P -): C & P; - -export function hasOwnProperty(object: object, property: PropertyKey): boolean; - -export interface FastMap { - size: number; - empty: number; - has: (f: string) => boolean; - get: (f: string) => any; - set: (f: string, v: any) => void; - delete: (f: string) => void; - clean: () => void; -} -export function fastmap(_?: object): FastMap; - -export function mergeConfig(...c: C[]): C; -export function writeConfig(c: C, key: string, value: any, recurse?: boolean | object): void; - -// Arrays - -export function array(v: T | T[]): T[]; -export function array(v: T | readonly T[]): readonly T[]; - -export function clampRange(range: readonly number[], min: number, max: number): number[]; - -export function extent(array: readonly number[], accessor?: AccessorFn): number[]; -export function extentIndex(array: readonly number[], accessor?: AccessorFn): number[]; - -export function flush(range: readonly number[], value: number, threshold: number, left: T, right: T, center: T): T; - -export function inrange(value: number, range: readonly number[], left: boolean, right: boolean): boolean; - -export function lerp(array: readonly number[], fraction: number): number; - -export function merge(compare: (a: any, b: any) => number, - array1: any[], array2: any[]): any[]; -export function merge(compare: (a: any, b: any) => number, - array1: any[], array2: any[], output?: any[]): void; - -export function panLinear(domain: readonly number[], delta: number): number[]; -export function panLog(domain: readonly number[], delta: number): number[]; -export function panPow(domain: readonly number[], delta: number, exponent: number): number[]; -export function panSymlog(domain: readonly number[], delta: number, constant: number): number[]; - -export function peek(array: readonly any[]): any; - -export function span(array: readonly number[]): number; - -export function toSet(array: readonly T[]): { [T: string]: true } - -export function visitArray(array: readonly any[] | undefined, - filter: (any: any) => boolean | undefined, - visitor: (v: any, i: number, arr: readonly any[]) => void): void; - -export function zoomLinear(domain: readonly number[], - anchor: number | null, scale: number): number[]; - -export function zoomLog(domain: readonly number[], - anchor: number | null, scale: number): number[]; - -export function zoomPow(domain: readonly number[], - anchor: number | null, scale: number, exponent: number): number[]; - -export function zoomSymlog(domain: readonly number[], - anchor: number | null, scale: number, constant: number): number[]; - -// Dates - -export function quarter(date: number): number; -export function quarter(date: Date): number; - -export function utcquarter(date: number): number; -export function utcquarter(date: Date): number; - -// Strings - -export function pad(str: string, len: number, - char?: string, align?: 'left' | 'center' | 'right'): string; - -export function repeat(str: string, count: number): string; - -export function splitAccessPath(path: string): string[]; -export function stringValue(a: any): string; - -export function truncate(a: string, length: number, - align?: 'left' | 'center' | 'right', ellipsis?: string): string; - -// Logging - -export interface LoggerInterface { - level(_: number): this; - level(): number; - error(...args: readonly any[]): this; - warn(...args: readonly any[]): this; - info(...args: readonly any[]): this; - debug(...args: readonly any[]): this; -} - -export const None: number; -export const Error: number; -export const Warn: number; -export const Info: number; -export const Debug: number; - -export function logger(_?: number, method?: string): LoggerInterface; -export function log(...args: readonly any[]): void; -export function error(msg: string): Error; diff --git a/node_modules/vega-util/index.js b/node_modules/vega-util/index.js deleted file mode 100644 index 34160d3..0000000 --- a/node_modules/vega-util/index.js +++ /dev/null @@ -1,85 +0,0 @@ -export { - default as accessor, - accessorName, - accessorFields -} from './src/accessor'; - -export { - id, - identity, - zero, - one, - truthy, - falsy -} from './src/accessors'; - -export { - default as logger, - None, - Error, - Warn, - Info, - Debug -} from './src/logger'; - -export { - mergeConfig, - writeConfig -} from './src/mergeConfig'; - -export { - panLinear, - panLog, - panPow, - panSymlog, - zoomLinear, - zoomLog, - zoomPow, - zoomSymlog -} from './src/transform'; - -export { - quarter, - utcquarter -} from './src/quarter'; - -export {default as array} from './src/array'; -export {default as clampRange} from './src/clampRange'; -export {default as compare} from './src/compare'; -export {default as constant} from './src/constant'; -export {default as debounce} from './src/debounce'; -export {default as error} from './src/error'; -export {default as extend} from './src/extend'; -export {default as extent} from './src/extent'; -export {default as extentIndex} from './src/extentIndex'; -export {default as fastmap} from './src/fastmap'; -export {default as field} from './src/field'; -export {default as flush} from './src/flush'; -export {default as hasOwnProperty} from './src/hasOwnProperty'; -export {default as inherits} from './src/inherits'; -export {default as inrange} from './src/inrange'; -export {default as isArray} from './src/isArray'; -export {default as isBoolean} from './src/isBoolean'; -export {default as isDate} from './src/isDate'; -export {default as isFunction} from './src/isFunction'; -export {default as isNumber} from './src/isNumber'; -export {default as isObject} from './src/isObject'; -export {default as isRegExp} from './src/isRegExp'; -export {default as isString} from './src/isString'; -export {default as key} from './src/key'; -export {default as lerp} from './src/lerp'; -export {default as lruCache} from './src/lruCache'; -export {default as merge} from './src/merge'; -export {default as pad} from './src/pad'; -export {default as peek} from './src/peek'; -export {default as repeat} from './src/repeat'; -export {default as span} from './src/span'; -export {default as splitAccessPath} from './src/splitAccessPath'; -export {default as stringValue} from './src/stringValue'; -export {default as toBoolean} from './src/toBoolean'; -export {default as toDate} from './src/toDate'; -export {default as toNumber} from './src/toNumber'; -export {default as toString} from './src/toString'; -export {default as toSet} from './src/toSet'; -export {default as truncate} from './src/truncate'; -export {default as visitArray} from './src/visitArray'; diff --git a/node_modules/vega-util/package.json b/node_modules/vega-util/package.json deleted file mode 100644 index 133310c..0000000 --- a/node_modules/vega-util/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "_from": "vega-util@~1.14.1", - "_id": "vega-util@1.14.1", - "_inBundle": false, - "_integrity": "sha512-pSKJ8OCkgfgHZDTljyj+gmGltgulceWbk1BV6LWrXqp6P3J8qPA/oZA8+a93YNApYxXZ3yzIVUDOo5O27xk0jw==", - "_location": "/vega-util", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-util@~1.14.1", - "name": "vega-util", - "escapedName": "vega-util", - "rawSpec": "~1.14.1", - "saveSpec": null, - "fetchSpec": "~1.14.1" - }, - "_requiredBy": [ - "/vega", - "/vega-crossfilter", - "/vega-dataflow", - "/vega-encode", - "/vega-expression", - "/vega-force", - "/vega-format", - "/vega-functions", - "/vega-geo", - "/vega-hierarchy", - "/vega-lite", - "/vega-loader", - "/vega-parser", - "/vega-regression", - "/vega-runtime", - "/vega-scale", - "/vega-scenegraph", - "/vega-selections", - "/vega-time", - "/vega-transforms", - "/vega-typings", - "/vega-view", - "/vega-view-transforms", - "/vega-voronoi", - "/vega-wordcloud" - ], - "_resolved": "https://registry.npmjs.org/vega-util/-/vega-util-1.14.1.tgz", - "_shasum": "0fb614277764f98738ba0b80e5cdfbe663426183", - "_spec": "vega-util@~1.14.1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "JavaScript utilities for Vega.", - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "utilities" - ], - "license": "BSD-3-Clause", - "main": "build/vega-util.js", - "module": "index", - "name": "vega-util", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-util.js -c -m -o build/vega-util.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -f umd -n vega -o build/vega-util.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "types": "index.d.ts", - "version": "1.14.1" -} diff --git a/node_modules/vega-util/src/accessor.js b/node_modules/vega-util/src/accessor.js deleted file mode 100644 index b569185..0000000 --- a/node_modules/vega-util/src/accessor.js +++ /dev/null @@ -1,13 +0,0 @@ -export default function(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; -} - -export function accessorName(fn) { - return fn == null ? null : fn.fname; -} - -export function accessorFields(fn) { - return fn == null ? null : fn.fields; -} diff --git a/node_modules/vega-util/src/accessors.js b/node_modules/vega-util/src/accessors.js deleted file mode 100644 index be7c117..0000000 --- a/node_modules/vega-util/src/accessors.js +++ /dev/null @@ -1,16 +0,0 @@ -import accessor from './accessor'; -import field from './field'; - -var empty = []; - -export var id = field('id'); - -export var identity = accessor(function(_) { return _; }, empty, 'identity'); - -export var zero = accessor(function() { return 0; }, empty, 'zero'); - -export var one = accessor(function() { return 1; }, empty, 'one'); - -export var truthy = accessor(function() { return true; }, empty, 'true'); - -export var falsy = accessor(function() { return false; }, empty, 'false'); diff --git a/node_modules/vega-util/src/array.js b/node_modules/vega-util/src/array.js deleted file mode 100644 index 6d00d8b..0000000 --- a/node_modules/vega-util/src/array.js +++ /dev/null @@ -1,5 +0,0 @@ -import isArray from './isArray'; - -export default function(_) { - return _ != null ? (isArray(_) ? _ : [_]) : []; -} diff --git a/node_modules/vega-util/src/clampRange.js b/node_modules/vega-util/src/clampRange.js deleted file mode 100644 index 8dfca37..0000000 --- a/node_modules/vega-util/src/clampRange.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ -export default function(range, min, max) { - var lo = range[0], - hi = range[1], - span; - - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - span = hi - lo; - - return span >= (max - min) - ? [min, max] - : [ - (lo = Math.min(Math.max(lo, min), max - span)), - lo + span - ]; -} diff --git a/node_modules/vega-util/src/compare.js b/node_modules/vega-util/src/compare.js deleted file mode 100644 index d54f6e0..0000000 --- a/node_modules/vega-util/src/compare.js +++ /dev/null @@ -1,51 +0,0 @@ -import {default as accessor, accessorFields} from './accessor'; -import array from './array'; -import field from './field'; -import isFunction from './isFunction'; - -const DESCENDING = 'descending'; - -export default function(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - - const ord = [], get = [], fmap = {}, - gen = opt.comparator || comparator; - - array(fields).forEach((f, i) => { - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach(_ => fmap[_] = 1); - }); - - return get.length === 0 - ? null - : accessor(gen(get, ord), Object.keys(fmap)); -} - -const compare = (u, v) => (u < v || u == null) && v != null ? -1 - : (u > v || v == null) && u != null ? 1 - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? -1 - : v !== v && u === u ? 1 - : 0; - -const comparator = (fields, orders) => fields.length === 1 - ? compare1(fields[0], orders[0]) - : compareN(fields, orders, fields.length); - -const compare1 = (field, order) => function(a, b) { - return compare(field(a), field(b)) * order; -}; - -const compareN = (fields, orders, n) => { - orders.push(0); // pad zero for convenient lookup - return function(a, b) { - let f, c = 0, i = -1; - while (c === 0 && ++i < n) { - f = fields[i]; - c = compare(f(a), f(b)); - } - return c * orders[i]; - }; -}; diff --git a/node_modules/vega-util/src/constant.js b/node_modules/vega-util/src/constant.js deleted file mode 100644 index cdeda82..0000000 --- a/node_modules/vega-util/src/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -import isFunction from './isFunction'; - -export default function(_) { - return isFunction(_) ? _ : function() { return _; }; -} diff --git a/node_modules/vega-util/src/debounce.js b/node_modules/vega-util/src/debounce.js deleted file mode 100644 index 19e98bd..0000000 --- a/node_modules/vega-util/src/debounce.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function(delay, handler) { - var tid, evt; - - function callback() { - handler(evt); - tid = evt = null; - } - - return function(e) { - evt = e; - if (tid) clearTimeout(tid); - tid = setTimeout(callback, delay); - }; -} diff --git a/node_modules/vega-util/src/error.js b/node_modules/vega-util/src/error.js deleted file mode 100644 index 50d8b19..0000000 --- a/node_modules/vega-util/src/error.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(message) { - throw Error(message); -} diff --git a/node_modules/vega-util/src/extend.js b/node_modules/vega-util/src/extend.js deleted file mode 100644 index 8f00167..0000000 --- a/node_modules/vega-util/src/extend.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function(_) { - for (var x, k, i=1, len=arguments.length; i max) max = v; - } - } - } else { - // find first valid value - for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])); - min = max = v; - - // visit all other values - for (; i max) max = v; - } - } - } - } - - return [min, max]; -} diff --git a/node_modules/vega-util/src/extentIndex.js b/node_modules/vega-util/src/extentIndex.js deleted file mode 100644 index 3015705..0000000 --- a/node_modules/vega-util/src/extentIndex.js +++ /dev/null @@ -1,55 +0,0 @@ -export default function(array, f) { - var i = -1, - n = array.length, - a, b, c, u, v; - - if (f == null) { - while (++i < n) { - b = array[i]; - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = array[i]; - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while (++i < n) { - b = f(array[i], i, array); - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = f(array[i], i, array); - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } - - return [u, v]; -} diff --git a/node_modules/vega-util/src/fastmap.js b/node_modules/vega-util/src/fastmap.js deleted file mode 100644 index a4c4ebe..0000000 --- a/node_modules/vega-util/src/fastmap.js +++ /dev/null @@ -1,72 +0,0 @@ -import hasOwnProperty from './hasOwnProperty'; - -var NULL = {}; - -export default function(input) { - var obj = {}, - map, - test; - - function has(key) { - return hasOwnProperty(obj, key) && obj[key] !== NULL; - } - - map = { - size: 0, - empty: 0, - object: obj, - has: has, - get(key) { - return has(key) ? obj[key] : undefined; - }, - set(key, value) { - if (!has(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - obj[key] = value; - return this; - }, - delete(key) { - if (has(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - return this; - }, - clear() { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test(_) { - if (arguments.length) { - test = _; - return map; - } else { - return test; - } - }, - clean() { - var next = {}, - size = 0, - key, value; - for (key in obj) { - value = obj[key]; - if (value !== NULL && (!test || !test(value))) { - next[key] = value; - ++size; - } - } - map.size = size; - map.empty = 0; - map.object = (obj = next); - } - }; - - if (input) Object.keys(input).forEach(function(key) { - map.set(key, input[key]); - }); - - return map; -} diff --git a/node_modules/vega-util/src/field.js b/node_modules/vega-util/src/field.js deleted file mode 100644 index 1729c60..0000000 --- a/node_modules/vega-util/src/field.js +++ /dev/null @@ -1,13 +0,0 @@ -import accessor from './accessor'; -import getter from './getter'; -import splitAccessPath from './splitAccessPath'; - -export default function(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor( - (opt && opt.get || getter)(path), - [field], - name || field - ); -} diff --git a/node_modules/vega-util/src/flush.js b/node_modules/vega-util/src/flush.js deleted file mode 100644 index 191de1c..0000000 --- a/node_modules/vega-util/src/flush.js +++ /dev/null @@ -1,22 +0,0 @@ -import peek from './peek'; - -export default function(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - - var a = range[0], - b = peek(range), - t = +threshold, - l, r; - - // swap endpoints if range is reversed - if (b < a) { - l = a; a = b; b = l; - } - - // compare value to endpoints - l = Math.abs(value - a); - r = Math.abs(b - value); - - // adjust if value is within threshold distance of endpoint - return l < r && l <= t ? left : r <= t ? right : center; -} diff --git a/node_modules/vega-util/src/getter.js b/node_modules/vega-util/src/getter.js deleted file mode 100644 index 7e53e4a..0000000 --- a/node_modules/vega-util/src/getter.js +++ /dev/null @@ -1,18 +0,0 @@ -export default function(path) { - return path.length === 1 ? get1(path[0]) : getN(path); -} - -const get1 = field => function(obj) { - return obj[field]; -}; - -const getN = path => { - const len = path.length; - return function(obj) { - for (let i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - return obj; - }; -}; - diff --git a/node_modules/vega-util/src/hasOwnProperty.js b/node_modules/vega-util/src/hasOwnProperty.js deleted file mode 100644 index 4c0043e..0000000 --- a/node_modules/vega-util/src/hasOwnProperty.js +++ /dev/null @@ -1,5 +0,0 @@ -const hop = Object.prototype.hasOwnProperty; - -export default function(object, property) { - return hop.call(object, property); -} diff --git a/node_modules/vega-util/src/inherits.js b/node_modules/vega-util/src/inherits.js deleted file mode 100644 index 2817856..0000000 --- a/node_modules/vega-util/src/inherits.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(child, parent) { - var proto = (child.prototype = Object.create(parent.prototype)); - proto.constructor = child; - return proto; -} diff --git a/node_modules/vega-util/src/inrange.js b/node_modules/vega-util/src/inrange.js deleted file mode 100644 index c15a70e..0000000 --- a/node_modules/vega-util/src/inrange.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ -export default function(value, range, left, right) { - var r0 = range[0], r1 = range[range.length-1], t; - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - left = left === undefined || left; - right = right === undefined || right; - - return (left ? r0 <= value : r0 < value) && - (right ? value <= r1 : value < r1); -} diff --git a/node_modules/vega-util/src/isArray.js b/node_modules/vega-util/src/isArray.js deleted file mode 100644 index cc2cea0..0000000 --- a/node_modules/vega-util/src/isArray.js +++ /dev/null @@ -1 +0,0 @@ -export default Array.isArray; diff --git a/node_modules/vega-util/src/isBoolean.js b/node_modules/vega-util/src/isBoolean.js deleted file mode 100644 index 74a8aec..0000000 --- a/node_modules/vega-util/src/isBoolean.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(_) { - return typeof _ === 'boolean'; -} diff --git a/node_modules/vega-util/src/isDate.js b/node_modules/vega-util/src/isDate.js deleted file mode 100644 index 7142abf..0000000 --- a/node_modules/vega-util/src/isDate.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(_) { - return Object.prototype.toString.call(_) === '[object Date]'; -} diff --git a/node_modules/vega-util/src/isFunction.js b/node_modules/vega-util/src/isFunction.js deleted file mode 100644 index e20391b..0000000 --- a/node_modules/vega-util/src/isFunction.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(_) { - return typeof _ === 'function'; -} diff --git a/node_modules/vega-util/src/isNumber.js b/node_modules/vega-util/src/isNumber.js deleted file mode 100644 index 2d2a126..0000000 --- a/node_modules/vega-util/src/isNumber.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(_) { - return typeof _ === 'number'; -} diff --git a/node_modules/vega-util/src/isObject.js b/node_modules/vega-util/src/isObject.js deleted file mode 100644 index 3b51784..0000000 --- a/node_modules/vega-util/src/isObject.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(_) { - return _ === Object(_); -} diff --git a/node_modules/vega-util/src/isRegExp.js b/node_modules/vega-util/src/isRegExp.js deleted file mode 100644 index c458d22..0000000 --- a/node_modules/vega-util/src/isRegExp.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; -} diff --git a/node_modules/vega-util/src/isString.js b/node_modules/vega-util/src/isString.js deleted file mode 100644 index 99a16dd..0000000 --- a/node_modules/vega-util/src/isString.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(_) { - return typeof _ === 'string'; -} diff --git a/node_modules/vega-util/src/key.js b/node_modules/vega-util/src/key.js deleted file mode 100644 index 60d27eb..0000000 --- a/node_modules/vega-util/src/key.js +++ /dev/null @@ -1,33 +0,0 @@ -import accessor from './accessor'; -import array from './array'; -import getter from './getter'; -import splitAccessPath from './splitAccessPath'; - -export default function(fields, flat, opt) { - if (fields) { - fields = flat - ? array(fields).map(f => f.replace(/\\(.)/g, '$1')) - : array(fields); - } - - const len = fields && fields.length, - gen = opt && opt.get || getter, - map = f => gen(flat ? [f] : splitAccessPath(f)); - let fn; - - if (!len) { - fn = function() { return ''; }; - } else if (len === 1) { - const get = map(fields[0]); - fn = function(_) { return '' + get(_); }; - } else { - const get = fields.map(map); - fn = function(_) { - let s = '' + get[0](_), i = 0; - while (++i < len) s += '|' + get[i](_); - return s; - }; - } - - return accessor(fn, fields, 'key'); -} diff --git a/node_modules/vega-util/src/lerp.js b/node_modules/vega-util/src/lerp.js deleted file mode 100644 index af06082..0000000 --- a/node_modules/vega-util/src/lerp.js +++ /dev/null @@ -1,8 +0,0 @@ -import peek from './peek'; - -export default function(array, frac) { - const lo = array[0], - hi = peek(array), - f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); -} diff --git a/node_modules/vega-util/src/logger.js b/node_modules/vega-util/src/logger.js deleted file mode 100644 index 64e0c50..0000000 --- a/node_modules/vega-util/src/logger.js +++ /dev/null @@ -1,40 +0,0 @@ -function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console -} - -export var None = 0; -export var Error = 1; -export var Warn = 2; -export var Info = 3; -export var Debug = 4; - -export default function(_, method) { - var level = _ || None; - return { - level: function(_) { - if (arguments.length) { - level = +_; - return this; - } else { - return level; - } - }, - error: function() { - if (level >= Error) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function() { - if (level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function() { - if (level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function() { - if (level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; -} diff --git a/node_modules/vega-util/src/lruCache.js b/node_modules/vega-util/src/lruCache.js deleted file mode 100644 index c1b27c1..0000000 --- a/node_modules/vega-util/src/lruCache.js +++ /dev/null @@ -1,38 +0,0 @@ -import has from './hasOwnProperty'; - -const DEFAULT_MAX_SIZE = 10000; - -// adapted from https://github.com/dominictarr/hashlru/ (MIT License) -export default function(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - - let curr, prev, size; - - const clear = () => { - curr = {}; - prev = {}; - size = 0; - }; - - const update = (key, value) => { - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - return (curr[key] = value); - }; - - clear(); - - return { - clear, - has: key => has(curr, key) || has(prev, key), - get: key => has(curr, key) ? curr[key] - : has(prev, key) ? update(key, prev[key]) - : undefined, - set: (key, value) => has(curr, key) - ? (curr[key] = value) - : update(key, value) - }; -} diff --git a/node_modules/vega-util/src/merge.js b/node_modules/vega-util/src/merge.js deleted file mode 100644 index 17b9272..0000000 --- a/node_modules/vega-util/src/merge.js +++ /dev/null @@ -1,26 +0,0 @@ -export default function(compare, array0, array1, output) { - var n0 = array0.length, - n1 = array1.length; - - if (!n1) return array0; - if (!n0) return array1; - - var merged = output || new array0.constructor(n0 + n1), - i0 = 0, i1 = 0, i = 0; - - for (; i0 0 - ? array1[i1++] - : array0[i0++]; - } - - for (; i0 key !== '__proto__'; - -export function mergeConfig(...configs) { - return configs.reduce((out, source) => { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? {layout: 1} - : key === 'style' ? true - : null; - writeConfig(out, key, source[key], r); - } - } - return out; - }, {}); -} - -export function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - - var k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : (output[key] = {}); - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } -} - -function mergeNamed(a, b) { - if (a == null) return b; - - const map = {}, out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; -} diff --git a/node_modules/vega-util/src/pad.js b/node_modules/vega-util/src/pad.js deleted file mode 100644 index 11515e2..0000000 --- a/node_modules/vega-util/src/pad.js +++ /dev/null @@ -1,12 +0,0 @@ -import repeat from './repeat'; - -export default function(str, length, padchar, align) { - var c = padchar || ' ', - s = str + '', - n = length - s.length; - - return n <= 0 ? s - : align === 'left' ? repeat(c, n) + s - : align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2)) - : s + repeat(c, n); -} diff --git a/node_modules/vega-util/src/peek.js b/node_modules/vega-util/src/peek.js deleted file mode 100644 index 8b4ca10..0000000 --- a/node_modules/vega-util/src/peek.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(array) { - return array[array.length - 1]; -} diff --git a/node_modules/vega-util/src/quarter.js b/node_modules/vega-util/src/quarter.js deleted file mode 100644 index 523a310..0000000 --- a/node_modules/vega-util/src/quarter.js +++ /dev/null @@ -1,7 +0,0 @@ -export function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); -} - -export function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); -} diff --git a/node_modules/vega-util/src/repeat.js b/node_modules/vega-util/src/repeat.js deleted file mode 100644 index 76544ee..0000000 --- a/node_modules/vega-util/src/repeat.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function(str, reps) { - var s = ''; - while (--reps >= 0) s += str; - return s; -} diff --git a/node_modules/vega-util/src/span.js b/node_modules/vega-util/src/span.js deleted file mode 100644 index 713343e..0000000 --- a/node_modules/vega-util/src/span.js +++ /dev/null @@ -1,9 +0,0 @@ -import peek from './peek'; - -/** - * Return the numerical span of an array: the difference between - * the last and first values. - */ -export default function(array) { - return array && (peek(array) - array[0]) || 0; -} diff --git a/node_modules/vega-util/src/splitAccessPath.js b/node_modules/vega-util/src/splitAccessPath.js deleted file mode 100644 index b230bc6..0000000 --- a/node_modules/vega-util/src/splitAccessPath.js +++ /dev/null @@ -1,63 +0,0 @@ -import error from './error'; - -export default function(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, j, c; - - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i=j=0; j i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; -} diff --git a/node_modules/vega-util/src/stringValue.js b/node_modules/vega-util/src/stringValue.js deleted file mode 100644 index 24ebd86..0000000 --- a/node_modules/vega-util/src/stringValue.js +++ /dev/null @@ -1,12 +0,0 @@ -import isArray from './isArray'; -import isObject from './isObject'; -import isString from './isString'; - -export default function $(x) { - return isArray(x) ? '[' + x.map($) + ']' - : isObject(x) || isString(x) ? - // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029') - : x; -} diff --git a/node_modules/vega-util/src/toBoolean.js b/node_modules/vega-util/src/toBoolean.js deleted file mode 100644 index d0a2eb6..0000000 --- a/node_modules/vega-util/src/toBoolean.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; -} diff --git a/node_modules/vega-util/src/toDate.js b/node_modules/vega-util/src/toDate.js deleted file mode 100644 index c442bca..0000000 --- a/node_modules/vega-util/src/toDate.js +++ /dev/null @@ -1,11 +0,0 @@ -import isDate from './isDate'; -import isNumber from './isNumber'; - -function defaultParser(_) { - return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); -} - -export default function(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); -} diff --git a/node_modules/vega-util/src/toNumber.js b/node_modules/vega-util/src/toNumber.js deleted file mode 100644 index 544a02a..0000000 --- a/node_modules/vega-util/src/toNumber.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function(_) { - return _ == null || _ === '' ? null : +_; -} diff --git a/node_modules/vega-util/src/toSet.js b/node_modules/vega-util/src/toSet.js deleted file mode 100644 index 80abb95..0000000 --- a/node_modules/vega-util/src/toSet.js +++ /dev/null @@ -1,4 +0,0 @@ -export default function(_) { - for (var s={}, i=0, n=_.length; i re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, item => view.dirty(item)); - markBounds.clear(); - mark.items.forEach(item => markBounds.union(boundItem(item, bound))); - - // force reflow for axes/legends/titles to propagate any layout changes - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } - - else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - - pulse.visit(pulse.ADD, item => { - markBounds.union(boundItem(item, bound)); - }); - - pulse.visit(pulse.MOD, item => { - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem(item, bound)); - }); - - if (rebound) { - markBounds.clear(); - mark.items.forEach(item => markBounds.union(item.bounds)); - } - } - - // ensure mark bounds do not exceed any clipping region - vegaScenegraph.boundClip(mark); - - return pulse.modifies('bounds'); - }; - - function boundItem(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); - } - - var COUNTER_NAME = ':vega_identifier:'; - - /** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ - function Identifier(params) { - vegaDataflow.Transform.call(this, 0, params); - } - - Identifier.Definition = { - 'type': 'Identifier', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'as', 'type': 'string', 'required': true } - ] - }; - - var prototype$1 = vegaUtil.inherits(Identifier, vegaDataflow.Transform); - - prototype$1.transform = function(_, pulse) { - var counter = getCounter(pulse.dataflow), - id = counter.value, - as = _.as; - - pulse.visit(pulse.ADD, t => { - if (!t[as]) t[as] = ++id; - }); - - counter.set(this.value = id); - return pulse; - }; - - function getCounter(view) { - var counter = view._signals[COUNTER_NAME]; - if (!counter) { - view._signals[COUNTER_NAME] = (counter = view.add(0)); - } - return counter; - } - - /** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ - function Mark(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype$2 = vegaUtil.inherits(Mark, vegaDataflow.Transform); - - prototype$2.transform = function(_, pulse) { - var mark = this.value; - - // acquire mark on first invocation, bind context and group - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } - - // initialize entering items - var Init = mark.marktype === Group ? vegaScenegraph.GroupItem : vegaScenegraph.Item; - pulse.visit(pulse.ADD, item => Init.call(item, mark)); - - // update clipping and/or interactive status - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - pulse.reflow(); - } - - // bind items array to scenegraph mark - mark.items = pulse.source; - return pulse; - }; - - function lookup(_) { - var g = _.groups, p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) - : g && p ? g.lookup(p) - : null; - } - - /** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ - function Overlap(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype$3 = vegaUtil.inherits(Overlap, vegaDataflow.Transform); - - var methods = { - parity: items => { - return items.filter((item, i) => i % 2 ? (item.opacity = 0) : 1); - }, - greedy: (items, sep) => { - var a; - return items.filter((b, i) => { - if (!i || !intersect(a.bounds, b.bounds, sep)) { - a = b; - return 1; - } else { - return b.opacity = 0; - } - }); - } - }; - - // compute bounding box intersection - // including padding pixels of separation - function intersect(a, b, sep) { - return sep > Math.max( - b.x1 - a.x2, - a.x1 - b.x2, - b.y1 - a.y2, - a.y1 - b.y2 - ); - } - - function hasOverlap(items, pad) { - for (var i=1, n=items.length, a=items[0].bounds, b; i 1 && b.height() > 1; - } - - function boundTest(scale, orient, tolerance) { - var range = scale.range(), - b = new vegaScenegraph.Bounds(); - - if (orient === Top || orient === Bottom) { - b.set(range[0], -Infinity, range[1], +Infinity); - } else { - b.set(-Infinity, range[0], +Infinity, range[1]); - } - b.expand(tolerance || 1); - - return item => b.encloses(item.bounds); - } - - // reset all items to be fully opaque - function reset(source) { - source.forEach(item => item.opacity = 1); - return source; - } - - // add all tuples to mod, fork pulse if parameters were modified - // fork prevents cross-stream tuple pollution (e.g., pulse from scale) - function reflow(pulse, _) { - return pulse.reflow(_.modified()).modifies('opacity'); - } - - prototype$3.transform = function(_, pulse) { - var reduce = methods[_.method] || methods.parity, - source = pulse.materialize(pulse.SOURCE).source, - sep = _.separation || 0, - items, test, bounds; - - if (!source || !source.length) return; - - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - return pulse; - } - - // skip labels with no content - source = source.filter(hasBounds); - - // early exit, nothing to do - if (!source.length) return; - - if (_.sort) { - source = source.slice().sort(_.sort); - } - - items = reset(source); - pulse = reflow(pulse, _); - - if (items.length >= 3 && hasOverlap(items, sep)) { - do { - items = reduce(items, sep); - } while (items.length >= 3 && hasOverlap(items, sep)); - - if (items.length < 3 && !vegaUtil.peek(source).opacity) { - if (items.length > 1) vegaUtil.peek(items).opacity = 0; - vegaUtil.peek(source).opacity = 1; - } - } - - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach(item => { - if (!test(item)) item.opacity = 0; - }); - } - - // re-calculate mark bounds - bounds = items[0].mark.bounds.clear(); - source.forEach(item => { - if (item.opacity) bounds.union(item.bounds); - }); - - return pulse; - }; - - /** - * Queue modified scenegraph items for rendering. - * @constructor - */ - function Render(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype$4 = vegaUtil.inherits(Render, vegaDataflow.Transform); - - prototype$4.transform = function(_, pulse) { - var view = pulse.dataflow; - - pulse.visit(pulse.ALL, item => view.dirty(item)); - - // set z-index dirty flag as needed - if (pulse.fields && pulse.fields['zindex']) { - var item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } - }; - - const tempBounds = new vegaScenegraph.Bounds(); - - function set(item, property, value) { - return item[property] === value ? 0 - : (item[property] = value, 1); - } - - function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; - } - - function axisIndices(datum) { - var index = +datum.grid; - return [ - datum.ticks ? index++ : -1, // ticks index - datum.labels ? index++ : -1, // labels index - index + (+datum.domain) // title index - ]; - } - - function axisLayout(view, axis, width, height) { - var item = axis.items[0], - datum = item.datum, - delta = item.translate != null ? item.translate : 0.5, - orient = item.orient, - indices = axisIndices(datum), - range = item.range, - offset = item.offset, - position = item.position, - minExtent = item.minExtent, - maxExtent = item.maxExtent, - title = datum.title && item.items[indices[2]].items[0], - titlePadding = item.titlePadding, - bounds = item.bounds, - dl = title && vegaScenegraph.multiLineOffset(title), - x = 0, y = 0, i, s; - - tempBounds.clear().union(bounds); - bounds.clear(); - if ((i=indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i=indices[1]) > -1) bounds.union(item.items[i].bounds); - - // position axis group and title - switch (orient) { - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - default: - x = item.x; - y = item.y; - } - - // update bounds - vegaScenegraph.boundStroke(bounds.translate(x, y), item); - - if (set(item, 'x', x + delta) | set(item, 'y', y + delta)) { - item.bounds = tempBounds; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - - return item.mark.bounds.clear().union(bounds); - } - - function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - const b = title.bounds; - - if (title.auto) { - const v = sign * (offset + dl + pad); - let dx = 0, dy = 0; - - view.dirty(title); - isYAxis - ? dx = (title.x || 0) - (title.x = v) - : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - - bounds.union(b); - } - - // aggregation functions for grid margin determination - const min = (a, b) => Math.floor(Math.min(a, b)); - const max = (a, b) => Math.ceil(Math.max(a, b)); - - function gridLayoutGroups(group) { - var groups = group.items, - n = groups.length, - i = 0, mark, items; - - var views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; - - // layout axes, gather legends, collect bounds - for (; i 1) { - for (i=0; i 0) dx[i] += x / 2; - } - } - - // perform vertical centering - if (alignRow && get(opt.center, Row) && ncols !== 1) { - for (i=0; i 0) dy[i] += y / 2; - } - } - - // position grid relative to anchor - for (i=0; i limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } - - // apply offset - init += offset; - - // clear mark bounds for all headers - for (j=0, m=headers.length; j= 0 && (g = groups[k]) == null; k-=back); - - // assign coordinates and update bounds - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); - - // update current edge of layout bounds - edge = agg(edge, b[bf]); - } - - return edge; - } - - function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); - - // compute title coordinates - var x = offset, y = offset; - isX - ? (x = Math.round(bounds.x1 + band * bounds.width())) - : (y = Math.round(bounds.y1 + band * bounds.height())); - - // assign coordinates and update bounds - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; - - // queue title for redraw - view.dirty(g); - } - - // utility for looking up legend layout configuration - function lookup$1(config, orient) { - const opt = config[orient] || {}; - return (key, d) => opt[key] != null ? opt[key] - : config[key] != null ? config[key] - : d; - } - - // if legends specify offset directly, use the maximum specified value - function offsets(legends, value) { - var max = -Infinity; - legends.forEach(item => { - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; - } - - function legendParams(g, orient, config, xb, yb, w, h) { - const _ = lookup$1(config, orient), - offset = offsets(g, _('offset', 0)), - anchor = _('anchor', Start), - mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - - const p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - - switch (orient) { - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, column: End, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, row: End, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case TopLeft: - p.anchor = {x: offset, y: offset}; - break; - case TopRight: - p.anchor = {x: w - offset, y: offset, column: End}; - break; - case BottomLeft: - p.anchor = {x: offset, y: h - offset, row: End}; - break; - case BottomRight: - p.anchor = {x: w - offset, y: h - offset, column: End, row: End}; - break; - } - - return p; - } - - function legendLayout(view, legend) { - var item = legend.items[0], - datum = item.datum, - orient = item.orient, - bounds = item.bounds, - x = item.x, y = item.y, w, h; - - // cache current bounds for later comparison - item._bounds - ? item._bounds.clear().union(bounds) - : item._bounds = bounds.clone(); - bounds.clear(); - - // adjust legend to accommodate padding and title - legendGroupLayout(view, item, item.items[0].items[0]); - - // aggregate bounds to determine size, and include origin - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - - if (datum.type === Symbols) { - legendEntryLayout(item.items[0].items[0].items[0].items); - } - - if (orient !== None) { - item.x = x = 0; - item.y = y = 0; - } - item.width = w; - item.height = h; - vegaScenegraph.boundStroke(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - - return item; - } - - function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach(_ => b.union(_.bounds)); - - // anchor to legend origin - b.x1 = item.padding; - b.y1 = item.padding; - - return b; - } - - function legendGroupLayout(view, item, entry) { - var pad = item.padding, - ex = pad - entry.x, - ey = pad - entry.y; - - if (!item.datum.title) { - if (ex || ey) translate(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], - anchor = title.anchor, - tpad = item.titlePadding || 0, - tx = pad - title.x, - ty = pad - title.y; - - switch (title.orient) { - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - case Right: - case Bottom: - break; - default: - ey += title.bounds.height() + tpad; - } - if (ex || ey) translate(view, entry, ex, ey); - - switch (title.orient) { - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - if (tx || ty) translate(view, title, tx, ty); - - // translate legend if title pushes into negative coordinates - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate(view, entry, -tx, 0); - translate(view, title, -tx, 0); - } - } - } - - function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - const grad = item.datum.type !== 'symbol', - vgrad = title.datum.vgrad, - e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, - s = e.bounds[y ? 'y2' : 'x2'] - item.padding, - u = vgrad && lr ? s : 0, - v = vgrad && lr ? 0 : s, - o = y <= 0 ? 0 : vegaScenegraph.multiLineOffset(title); - - return Math.round(anchor === Start ? u - : anchor === End ? (v - o) - : 0.5 * (s - o)); - } - - function translate(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); - } - - function legendEntryLayout(entries) { - // get max widths for each column - var widths = entries.reduce((w, g) => { - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); - - // set dimensions of legend entry groups - entries.forEach(g => { - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); - } - - function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], - frame = group.frame, - orient = group.orient, - anchor = group.anchor, - offset = group.offset, - padding = group.padding, - title = group.items[0].items[0], - subtitle = group.items[1] && group.items[1].items[0], - end = (orient === Left || orient === Right) ? height : width, - start = 0, x = 0, y = 0, sx = 0, sy = 0, pos; - - if (frame !== Group) { - orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) - : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) - : (start = viewBounds.x1, end = viewBounds.x2); - } else if (orient === Left) { - start = height, end = 0; - } - - pos = (anchor === Start) ? start - : (anchor === End) ? end - : (start + end) / 2; - - if (subtitle && subtitle.text) { - // position subtitle - switch (orient) { - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - case Left: - sx = title.bounds.width() + padding; - break; - case Right: - sx = -title.bounds.width() - padding; - break; - } - - tempBounds.clear().union(subtitle.bounds); - tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - if (set(subtitle, 'x', sx) | set(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds); - subtitle.mark.bounds.clear().union(tempBounds); - view.dirty(subtitle); - } - - tempBounds.clear().union(subtitle.bounds); - } else { - tempBounds.clear(); - } - tempBounds.union(title.bounds); - - // position title group - switch (orient) { - case Top: - x = pos; - y = viewBounds.y1 - tempBounds.height() - offset; - break; - case Left: - x = viewBounds.x1 - tempBounds.width() - offset; - y = pos; - break; - case Right: - x = viewBounds.x2 + tempBounds.width() + offset; - y = pos; - break; - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - default: - x = group.x; - y = group.y; - } - - if (set(group, 'x', x) | set(group, 'y', y)) { - tempBounds.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds); - mark.bounds.clear().union(tempBounds); - view.dirty(group); - } - return group.bounds; - } - - /** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ - function ViewLayout(params) { - vegaDataflow.Transform.call(this, null, params); - } - - var prototype$5 = vegaUtil.inherits(ViewLayout, vegaDataflow.Transform); - - prototype$5.transform = function(_, pulse) { - var view = pulse.dataflow; - _.mark.items.forEach(group => { - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; - }; - - function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; - } - - function layoutGroup(view, group, _) { - var items = group.items, - width = Math.max(0, group.width || 0), - height = Math.max(0, group.height || 0), - viewBounds = new vegaScenegraph.Bounds().set(0, 0, width, height), - xBounds = viewBounds.clone(), - yBounds = viewBounds.clone(), - legends = [], title, - mark, orient, b, i, n; - - // layout axes, gather legends, collect bounds - for (i=0, n=items.length; i { - orient = item.orient || Right; - if (orient !== None) (l[orient] || (l[orient] = [])).push(item); - }); - - // perform grid layout for each orient group - for (let orient in l) { - const g = l[orient]; - gridLayout(view, g, legendParams( - g, orient, _.legends, xBounds, yBounds, width, height - )); - } - - // update view bounds - legends.forEach(item => { - const b = item.bounds; - - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - item.bounds = b; - view.dirty(item); - } - - if (_.autosize && _.autosize.type === Fit) { - // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch(item.orient) { - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - } else { - viewBounds.union(b); - } - }); - } - - // combine bounding boxes - viewBounds.union(xBounds).union(yBounds); - - // layout title, adjust bounds - if (title) { - viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - } - - // override aggregated view bounds if content is clipped - if (group.clip) { - viewBounds.set(0, 0, group.width || 0, group.height || 0); - } - - // perform size adjustment - viewSizeLayout(view, group, viewBounds, _); - } - - function viewSizeLayout(view, group, viewBounds, _) { - const auto = _.autosize || {}, - type = auto.type; - - if (view._autosize < 1 || !type) return; - - let viewWidth = view._width, - viewHeight = view._height, - width = Math.max(0, group.width || 0), - left = Math.max(0, Math.ceil(-viewBounds.x1)), - right = Math.max(0, Math.ceil(viewBounds.x2 - width)), - height = Math.max(0, group.height || 0), - top = Math.max(0, Math.ceil(-viewBounds.y1)), - bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - - if (auto.contains === Padding) { - const padding = view.padding(); - viewWidth -= padding.left + padding.right; - viewHeight -= padding.top + padding.bottom; - } - - if (type === None) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } - - else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } - - else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - - view._resizeView( - viewWidth, viewHeight, - width, height, - [left, top], - auto.resize - ); - } - - exports.bound = Bound; - exports.identifier = Identifier; - exports.mark = Mark; - exports.overlap = Overlap; - exports.render = Render; - exports.viewlayout = ViewLayout; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-view-transforms/build/vega-view-transforms.min.js b/node_modules/vega-view-transforms/build/vega-view-transforms.min.js deleted file mode 100644 index ffa305d..0000000 --- a/node_modules/vega-view-transforms/build/vega-view-transforms.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-scenegraph"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-scenegraph","vega-util"],t):t(((e=e||self).vega=e.vega||{},e.vega.transforms={}),e.vega,e.vega,e.vega)}(this,(function(e,t,n,o){"use strict";const r="top",a="left",i="right",s="end",u="row";function c(e){t.Transform.call(this,null,e)}function l(e,t,n){return t(e.bounds.clear(),e,n)}o.inherits(c,t.Transform).transform=function(e,t){var o,r=t.dataflow,a=e.mark,i=a.marktype,s=n.Marks[i],u=s.bound,c=a.bounds;if(s.nested)a.items.length&&r.dirty(a.items[0]),c=l(a,u),a.items.forEach((function(e){e.bounds.clear().union(c)}));else if("group"===i||e.modified())switch(t.visit(t.MOD,e=>r.dirty(e)),c.clear(),a.items.forEach(e=>c.union(l(e,u))),a.role){case"axis":case"legend":case"title":t.reflow()}else o=t.changed(t.REM),t.visit(t.ADD,e=>{c.union(l(e,u))}),t.visit(t.MOD,e=>{o=o||c.alignsWith(e.bounds),r.dirty(e),c.union(l(e,u))}),o&&(c.clear(),a.items.forEach(e=>c.union(e.bounds)));return n.boundClip(a),t.modifies("bounds")};function d(e){t.Transform.call(this,0,e)}function h(e){t.Transform.call(this,null,e)}function f(e){t.Transform.call(this,null,e)}d.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},o.inherits(d,t.Transform).transform=function(e,t){var n=function(e){var t=e._signals[":vega_identifier:"];t||(e._signals[":vega_identifier:"]=t=e.add(0));return t}(t.dataflow),o=n.value,r=e.as;return t.visit(t.ADD,e=>{e[r]||(e[r]=++o)}),n.set(this.value=o),t},o.inherits(h,t.Transform).transform=function(e,t){var o=this.value;o||((o=t.dataflow.scenegraph().mark(e.markdef,function(e){var t=e.groups,n=e.parent;return t&&1===t.size?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}(e),e.index)).group.context=e.context,e.context.group||(e.context.group=o.group),o.source=this.source,o.clip=e.clip,o.interactive=e.interactive,this.value=o);var r="group"===o.marktype?n.GroupItem:n.Item;return t.visit(t.ADD,e=>r.call(e,o)),(e.modified("clip")||e.modified("interactive"))&&(o.clip=e.clip,o.interactive=!!e.interactive,o.zdirty=!0,t.reflow()),o.items=t.source,t};var m=o.inherits(f,t.Transform),b={parity:e=>e.filter((e,t)=>t%2?e.opacity=0:1),greedy:(e,t)=>{var n;return e.filter((e,o)=>o&&y(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1))}};function y(e,t,n){return n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2)}function x(e,t){for(var n,o=1,r=e.length,a=e[0].bounds;o1&&t.height()>1}function p(e){return e.forEach(e=>e.opacity=1),e}function w(e,t){return e.reflow(t.modified()).modifies("opacity")}function k(e){t.Transform.call(this,null,e)}m.transform=function(e,t){var a,i,s,u=b[e.method]||b.parity,c=t.materialize(t.SOURCE).source,l=e.separation||0;if(c&&c.length){if(!e.method)return e.modified("method")&&(p(c),t=w(t,e)),t;if((c=c.filter(g)).length){if(e.sort&&(c=c.slice().sort(e.sort)),a=p(c),t=w(t,e),a.length>=3&&x(a,l)){do{a=u(a,l)}while(a.length>=3&&x(a,l));a.length<3&&!o.peek(c).opacity&&(a.length>1&&(o.peek(a).opacity=0),o.peek(c).opacity=1)}var d,h,f,m,y;return e.boundScale&&e.boundTolerance>=0&&(d=e.boundScale,h=e.boundOrient,f=+e.boundTolerance,m=d.range(),y=new n.Bounds,h===r||"bottom"===h?y.set(m[0],-1/0,m[1],1/0):y.set(-1/0,m[0],1/0,m[1]),y.expand(f||1),i=e=>y.encloses(e.bounds),c.forEach(e=>{i(e)||(e.opacity=0)})),s=a[0].mark.bounds.clear(),c.forEach(e=>{e.opacity&&s.union(e.bounds)}),t}}},o.inherits(k,t.Transform).transform=function(e,t){var n=t.dataflow;if(t.visit(t.ALL,e=>n.dirty(e)),t.fields&&t.fields.zindex){var o=t.source&&t.source[0];o&&(o.mark.zdirty=!0)}};const v=new n.Bounds;function M(e,t,n){return e[t]===n?0:(e[t]=n,1)}function E(e){var t=e.items[0].orient;return t===a||t===i}function T(e,t,o,s){var u,c,l=t.items[0],d=l.datum,h=null!=l.translate?l.translate:.5,f=l.orient,m=function(e){var t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(d),b=l.range,y=l.offset,x=l.position,g=l.minExtent,p=l.maxExtent,w=d.title&&l.items[m[2]].items[0],k=l.titlePadding,E=l.bounds,T=w&&n.multiLineOffset(w),A=0,z=0;switch(v.clear().union(E),E.clear(),(u=m[0])>-1&&E.union(l.items[u].bounds),(u=m[1])>-1&&E.union(l.items[u].bounds),f){case r:A=x||0,z=-y,c=Math.max(g,Math.min(p,-E.y1)),E.add(0,-c).add(b,0),w&&_(e,w,c,k,T,0,-1,E);break;case a:A=-y,z=x||0,c=Math.max(g,Math.min(p,-E.x1)),E.add(-c,0).add(0,b),w&&_(e,w,c,k,T,1,-1,E);break;case i:A=o+y,z=x||0,c=Math.max(g,Math.min(p,E.x2)),E.add(0,0).add(c,b),w&&_(e,w,c,k,T,1,1,E);break;case"bottom":A=x||0,z=s+y,c=Math.max(g,Math.min(p,E.y2)),E.add(0,0).add(b,c),w&&_(e,w,c,k,0,0,1,E);break;default:A=l.x,z=l.y}return n.boundStroke(E.translate(A,z),l),M(l,"x",A+h)|M(l,"y",z+h)&&(l.bounds=v,e.dirty(l),l.bounds=E,e.dirty(l)),l.mark.bounds.clear().union(E)}function _(e,t,n,o,r,a,i,s){const u=t.bounds;if(t.auto){const s=i*(n+r+o);let c=0,l=0;e.dirty(t),a?c=(t.x||0)-(t.x=s):l=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(u.translate(-c,-l)),e.dirty(t)}s.union(u)}const A=(e,t)=>Math.floor(Math.min(e,t)),z=(e,t)=>Math.ceil(Math.max(e,t));function B(e){return(new n.Bounds).set(0,0,e.width||0,e.height||0)}function D(e){var t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function O(e,t,n){var r=o.isObject(e)?e[t]:e;return null!=r?r:void 0!==n?n:0}function j(e){return e<0?Math.ceil(-e):0}function q(e,t,n){var o,r,a,i,c,l,d,h,f,m,b,y=!n.nodirty,x="flush"===n.bounds?B:D,g=v.set(0,0,0,0),p=O(n.align,"column"),w=O(n.align,u),k=O(n.padding,"column"),M=O(n.padding,u),E=n.columns||t.length,T=E<=0?1:Math.ceil(t.length/E),_=t.length,A=Array(_),z=Array(E),q=0,S=Array(_),L=Array(T),I=0,P=Array(_),C=Array(_),F=Array(_);for(r=0;r1)for(r=0;r<_;++r)(f=(c="all"===p?q:z[r%E])-F[r].x2-t[r].x-P[r])>0&&(P[r]+=f/2);if(w&&O(n.center,u)&&1!==E)for(r=0;r<_;++r)(m=(c="all"===w?I:L[~~(r/E)])-F[r].y2-t[r].y-C[r])>0&&(C[r]+=m/2);for(r=0;r<_;++r)g.union(F[r].translate(P[r],C[r]));switch(f=O(n.anchor,"x"),m=O(n.anchor,"y"),O(n.anchor,"column")){case s:f-=g.width();break;case"middle":f-=g.width()/2}switch(O(n.anchor,u)){case s:m-=g.height();break;case"middle":m-=g.height()/2}for(f=Math.round(f),m=Math.round(m),g.clear(),r=0;r<_;++r)t[r].mark.bounds.clear();for(r=0;r<_;++r)(l=t[r]).x+=P[r]+=f,l.y+=C[r]+=m,g.union(l.mark.bounds.union(l.bounds.translate(P[r],C[r]))),y&&e.dirty(l);return g}function S(e,t){return"x1"===t?e.x||0:"y1"===t?e.y||0:"x2"===t?(e.x||0)+(e.width||0):"y2"===t?(e.y||0)+(e.height||0):void 0}function L(e,t){return e.bounds[t]}function I(e,t,n,o,r,a,i,s,u,c,l,d,h,f){var m,b,y,x,g,p,w,k,v,M=n.length,E=0,T=0;if(!M)return E;for(m=l;mr&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),E+=a,b=0,x=t.length;b=0&&null==(w=n[y]);y-=h);s?(k=null==f?w.x:Math.round(w.bounds.x1+f*w.bounds.width()),v=E):(k=E,v=null==f?w.y:Math.round(w.bounds.y1+f*w.bounds.height())),g.union(p.bounds.translate(k-(p.x||0),v-(p.y||0))),p.x=k,p.y=v,e.dirty(p),T=i(T,g[c])}return T}function P(e,t,n,o,r,a){if(t){e.dirty(t);var i=n,s=n;o?i=Math.round(r.x1+a*r.width()):s=Math.round(r.y1+a*r.height()),t.bounds.translate(i-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=i,t.y=s,e.dirty(t)}}function C(e,t,n,o,u,c,l){const d=function(e,t){const n=e[t]||{};return(t,o)=>null!=n[t]?n[t]:null!=e[t]?e[t]:o}(n,t),h=function(e,t){var n=-1/0;return e.forEach(e=>{null!=e.offset&&(n=Math.max(n,e.offset))}),n>-1/0?n:t}(e,d("offset",0)),f=d("anchor","start"),m=f===s?1:"middle"===f?.5:0,b={align:"each",bounds:d("bounds","flush"),columns:"vertical"===d("direction")?1:e.length,padding:d("margin",8),center:d("center"),nodirty:!0};switch(t){case a:b.anchor={x:Math.floor(o.x1)-h,column:s,y:m*(l||o.height()+2*o.y1),row:f};break;case i:b.anchor={x:Math.ceil(o.x2)+h,y:m*(l||o.height()+2*o.y1),row:f};break;case r:b.anchor={y:Math.floor(u.y1)-h,row:s,x:m*(c||u.width()+2*u.x1),column:f};break;case"bottom":b.anchor={y:Math.ceil(u.y2)+h,x:m*(c||u.width()+2*u.x1),column:f};break;case"top-left":b.anchor={x:h,y:h};break;case"top-right":b.anchor={x:c-h,y:h,column:s};break;case"bottom-left":b.anchor={x:h,y:l-h,row:s};break;case"bottom-right":b.anchor={x:c-h,y:l-h,column:s,row:s}}return b}function F(e,t){var o,r,u,c,l=t.items[0],d=l.datum,h=l.orient,f=l.bounds,m=l.x,b=l.y;return l._bounds?l._bounds.clear().union(f):l._bounds=f.clone(),f.clear(),function(e,t,n){var o=t.padding,r=o-n.x,u=o-n.y;if(t.datum.title){var c=t.items[1].items[0],l=c.anchor,d=t.titlePadding||0,h=o-c.x,f=o-c.y;switch(c.orient){case a:r+=Math.ceil(c.bounds.width())+d;break;case i:case"bottom":break;default:u+=c.bounds.height()+d}switch((r||u)&&H(e,n,r,u),c.orient){case a:f+=G(t,n,c,l,1,1);break;case i:h+=G(t,n,c,s,0,0)+d,f+=G(t,n,c,l,1,1);break;case"bottom":h+=G(t,n,c,l,0,0),f+=G(t,n,c,s,-1,0,1)+d;break;default:h+=G(t,n,c,l,0,0)}(h||f)&&H(e,c,h,f),(h=Math.round(c.bounds.x1-o))<0&&(H(e,n,-h,0),H(e,c,-h,0))}else(r||u)&&H(e,n,r,u)}(e,l,l.items[0].items[0]),f=function(e,t){return e.items.forEach(e=>t.union(e.bounds)),t.x1=e.padding,t.y1=e.padding,t}(l,f),o=2*l.padding,r=2*l.padding,f.empty()||(o=Math.ceil(f.width()+o),r=Math.ceil(f.height()+r)),"symbol"===d.type&&(u=l.items[0].items[0].items[0].items,c=u.reduce((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e),{}),u.forEach(e=>{e.width=c[e.column],e.height=e.bounds.y2-e.y})),"none"!==h&&(l.x=m=0,l.y=b=0),l.width=o,l.height=r,n.boundStroke(f.set(m,b,m+o,b+r),l),l.mark.bounds.clear().union(f),l}function G(e,t,o,r,a,i,u){const c="symbol"!==e.datum.type,l=o.datum.vgrad,d=(!c||!i&&l||u?t:t.items[0]).bounds[a?"y2":"x2"]-e.padding,h=l&&i?d:0,f=l&&i?0:d,m=a<=0?0:n.multiLineOffset(o);return Math.round("start"===r?h:r===s?f-m:.5*(d-m))}function H(e,t,n,o){t.x+=n,t.y+=o,t.bounds.translate(n,o),t.mark.bounds.translate(n,o),e.dirty(t)}function R(e){t.Transform.call(this,null,e)}o.inherits(R,t.Transform).transform=function(e,t){var o,c=t.dataflow;return e.mark.items.forEach(t=>{e.layout&&function(e,t,n){var o,r,a,i,c,l,d,h=function(e){for(var t,n,o=e.items,r=o.length,a=0,i={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a{"none"!==(l=e.orient||i)&&(t[l]||(t[l]=[])).push(e)});for(let n in t){const r=t[n];q(e,r,C(r,n,o.legends,x,g,m,b))}p.forEach(t=>{const n=t.bounds;if(n.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=n,e.dirty(t)),o.autosize&&"fit"===o.autosize.type)switch(t.orient){case a:case i:y.add(n.x1,0).add(n.x2,0);break;case r:case"bottom":y.add(0,n.y1).add(0,n.y2)}else y.union(n)})}y.union(x).union(g),u&&y.union(function(e,t,n,o,u){var c,l=t.items[0],d=l.frame,h=l.orient,f=l.anchor,m=l.offset,b=l.padding,y=l.items[0].items[0],x=l.items[1]&&l.items[1].items[0],g=h===a||h===i?o:n,p=0,w=0,k=0,E=0,T=0;if("group"!==d?h===a?(p=u.y2,g=u.y1):h===i?(p=u.y1,g=u.y2):(p=u.x1,g=u.x2):h===a&&(p=o,g=0),c="start"===f?p:f===s?g:(p+g)/2,x&&x.text){switch(h){case r:case"bottom":T=y.bounds.height()+b;break;case a:E=y.bounds.width()+b;break;case i:E=-y.bounds.width()-b}v.clear().union(x.bounds),v.translate(E-(x.x||0),T-(x.y||0)),M(x,"x",E)|M(x,"y",T)&&(e.dirty(x),x.bounds.clear().union(v),x.mark.bounds.clear().union(v),e.dirty(x)),v.clear().union(x.bounds)}else v.clear();switch(v.union(y.bounds),h){case r:w=c,k=u.y1-v.height()-m;break;case a:w=u.x1-v.width()-m,k=c;break;case i:w=u.x2+v.width()+m,k=c;break;case"bottom":w=c,k=u.y2+m;break;default:w=l.x,k=l.y}return M(l,"x",w)|M(l,"y",k)&&(v.translate(w,k),e.dirty(l),l.bounds.clear().union(v),t.bounds.clear().union(v),e.dirty(l)),l.bounds}(e,u,m,b,y));t.clip&&y.set(0,0,t.width||0,t.height||0);!function(e,t,n,o){const r=o.autosize||{},a=r.type;if(e._autosize<1||!a)return;let i=e._width,s=e._height,u=Math.max(0,t.width||0),c=Math.max(0,Math.ceil(-n.x1)),l=Math.max(0,Math.ceil(n.x2-u)),d=Math.max(0,t.height||0),h=Math.max(0,Math.ceil(-n.y1)),f=Math.max(0,Math.ceil(n.y2-d));if("padding"===r.contains){const t=e.padding();i-=t.left+t.right,s-=t.top+t.bottom}"none"===a?(c=0,h=0,u=i,d=s):"fit"===a?(u=Math.max(0,i-c-l),d=Math.max(0,s-h-f)):"fit-x"===a?(u=Math.max(0,i-c-l),s=d+h+f):"fit-y"===a?(i=u+c+l,d=Math.max(0,s-h-f)):"pad"===a&&(i=u+c+l,s=d+h+f);e._resizeView(i,s,u,d,[c,h],r.resize)}(e,t,y,o)}(c,t,e)}),(o=e.mark.group)&&"legend-entry"!==o.mark.role?t.reflow():t},e.bound=c,e.identifier=d,e.mark=h,e.overlap=f,e.render=k,e.viewlayout=R,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-view-transforms/index.js b/node_modules/vega-view-transforms/index.js deleted file mode 100644 index c93aff6..0000000 --- a/node_modules/vega-view-transforms/index.js +++ /dev/null @@ -1,6 +0,0 @@ -export {default as bound} from './src/Bound'; -export {default as identifier} from './src/Identifier'; -export {default as mark} from './src/Mark'; -export {default as overlap} from './src/Overlap'; -export {default as render} from './src/Render'; -export {default as viewlayout} from './src/ViewLayout'; diff --git a/node_modules/vega-view-transforms/package.json b/node_modules/vega-view-transforms/package.json deleted file mode 100644 index f60baf3..0000000 --- a/node_modules/vega-view-transforms/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_from": "vega-view-transforms@~4.5.5", - "_id": "vega-view-transforms@4.5.5", - "_inBundle": false, - "_integrity": "sha512-HFTA6j2zFKRlfBlS6b9tmLLDNt7g78ZoyKFAT9fCm3X0KLT6FTn13PiiB4KppMg40nwgm0c2KUQmjnC6fGgIdQ==", - "_location": "/vega-view-transforms", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-view-transforms@~4.5.5", - "name": "vega-view-transforms", - "escapedName": "vega-view-transforms", - "rawSpec": "~4.5.5", - "saveSpec": null, - "fetchSpec": "~4.5.5" - }, - "_requiredBy": [ - "/vega" - ], - "_resolved": "https://registry.npmjs.org/vega-view-transforms/-/vega-view-transforms-4.5.5.tgz", - "_shasum": "b934da0fc1b41c10039300c036cfa38a56c83631", - "_spec": "vega-view-transforms@~4.5.5", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "vega-dataflow": "^5.6.0", - "vega-scenegraph": "^4.8.0", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "View-specific transforms for Vega dataflows.", - "devDependencies": { - "vega-transforms": "*" - }, - "gitHead": "48c85218f2202242171aa569f2dca0f53cf2b51f", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "view", - "layout" - ], - "license": "BSD-3-Clause", - "main": "build/vega-view-transforms.js", - "module": "index", - "name": "vega-view-transforms", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-view-transforms.js -c -m -o build/vega-view-transforms.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g vega-dataflow:vega,vega-scenegraph:vega,vega-util:vega -f umd -n vega.transforms -o build/vega-view-transforms.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "4.5.5" -} diff --git a/node_modules/vega-view-transforms/src/Bound.js b/node_modules/vega-view-transforms/src/Bound.js deleted file mode 100644 index 4313be6..0000000 --- a/node_modules/vega-view-transforms/src/Bound.js +++ /dev/null @@ -1,79 +0,0 @@ -import {AxisRole, Group, LegendRole, TitleRole} from './constants'; -import {Transform} from 'vega-dataflow'; -import {Marks, boundClip} from 'vega-scenegraph'; -import {inherits} from 'vega-util'; - -/** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ -export default function Bound(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(Bound, Transform); - -prototype.transform = function(_, pulse) { - var view = pulse.dataflow, - mark = _.mark, - type = mark.marktype, - entry = Marks[type], - bound = entry.bound, - markBounds = mark.bounds, rebound; - - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem(mark, bound); - mark.items.forEach(function(item) { - item.bounds.clear().union(markBounds); - }); - } - - else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, item => view.dirty(item)); - markBounds.clear(); - mark.items.forEach(item => markBounds.union(boundItem(item, bound))); - - // force reflow for axes/legends/titles to propagate any layout changes - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } - - else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - - pulse.visit(pulse.ADD, item => { - markBounds.union(boundItem(item, bound)); - }); - - pulse.visit(pulse.MOD, item => { - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem(item, bound)); - }); - - if (rebound) { - markBounds.clear(); - mark.items.forEach(item => markBounds.union(item.bounds)); - } - } - - // ensure mark bounds do not exceed any clipping region - boundClip(mark); - - return pulse.modifies('bounds'); -}; - -function boundItem(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); -} diff --git a/node_modules/vega-view-transforms/src/Identifier.js b/node_modules/vega-view-transforms/src/Identifier.js deleted file mode 100644 index 3d2edc1..0000000 --- a/node_modules/vega-view-transforms/src/Identifier.js +++ /dev/null @@ -1,50 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -var COUNTER_NAME = ':vega_identifier:'; - -/** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ -export default function Identifier(params) { - Transform.call(this, 0, params); -} - -Identifier.Definition = { - 'type': 'Identifier', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'as', 'type': 'string', 'required': true } - ] -}; - -var prototype = inherits(Identifier, Transform); - -prototype.transform = function(_, pulse) { - var counter = getCounter(pulse.dataflow), - id = counter.value, - as = _.as; - - pulse.visit(pulse.ADD, t => { - if (!t[as]) t[as] = ++id; - }); - - counter.set(this.value = id); - return pulse; -}; - -function getCounter(view) { - var counter = view._signals[COUNTER_NAME]; - if (!counter) { - view._signals[COUNTER_NAME] = (counter = view.add(0)); - } - return counter; -} diff --git a/node_modules/vega-view-transforms/src/Mark.js b/node_modules/vega-view-transforms/src/Mark.js deleted file mode 100644 index 0aed2d2..0000000 --- a/node_modules/vega-view-transforms/src/Mark.js +++ /dev/null @@ -1,56 +0,0 @@ -import {Group} from './constants'; -import {Transform} from 'vega-dataflow'; -import {GroupItem, Item} from 'vega-scenegraph'; -import {inherits} from 'vega-util'; - -/** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ -export default function Mark(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(Mark, Transform); - -prototype.transform = function(_, pulse) { - var mark = this.value; - - // acquire mark on first invocation, bind context and group - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } - - // initialize entering items - var Init = mark.marktype === Group ? GroupItem : Item; - pulse.visit(pulse.ADD, item => Init.call(item, mark)); - - // update clipping and/or interactive status - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - pulse.reflow(); - } - - // bind items array to scenegraph mark - mark.items = pulse.source; - return pulse; -}; - -function lookup(_) { - var g = _.groups, p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) - : g && p ? g.lookup(p) - : null; -} diff --git a/node_modules/vega-view-transforms/src/Overlap.js b/node_modules/vega-view-transforms/src/Overlap.js deleted file mode 100644 index bbd636a..0000000 --- a/node_modules/vega-view-transforms/src/Overlap.js +++ /dev/null @@ -1,155 +0,0 @@ -import {Bottom, Top} from './constants'; -import {Transform} from 'vega-dataflow'; -import {Bounds} from 'vega-scenegraph'; -import {inherits, peek} from 'vega-util'; - -/** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ -export default function Overlap(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(Overlap, Transform); - -var methods = { - parity: items => { - return items.filter((item, i) => i % 2 ? (item.opacity = 0) : 1); - }, - greedy: (items, sep) => { - var a; - return items.filter((b, i) => { - if (!i || !intersect(a.bounds, b.bounds, sep)) { - a = b; - return 1; - } else { - return b.opacity = 0; - } - }); - } -}; - -// compute bounding box intersection -// including padding pixels of separation -function intersect(a, b, sep) { - return sep > Math.max( - b.x1 - a.x2, - a.x1 - b.x2, - b.y1 - a.y2, - a.y1 - b.y2 - ); -} - -function hasOverlap(items, pad) { - for (var i=1, n=items.length, a=items[0].bounds, b; i 1 && b.height() > 1; -} - -function boundTest(scale, orient, tolerance) { - var range = scale.range(), - b = new Bounds(); - - if (orient === Top || orient === Bottom) { - b.set(range[0], -Infinity, range[1], +Infinity); - } else { - b.set(-Infinity, range[0], +Infinity, range[1]); - } - b.expand(tolerance || 1); - - return item => b.encloses(item.bounds); -} - -// reset all items to be fully opaque -function reset(source) { - source.forEach(item => item.opacity = 1); - return source; -} - -// add all tuples to mod, fork pulse if parameters were modified -// fork prevents cross-stream tuple pollution (e.g., pulse from scale) -function reflow(pulse, _) { - return pulse.reflow(_.modified()).modifies('opacity'); -} - -prototype.transform = function(_, pulse) { - var reduce = methods[_.method] || methods.parity, - source = pulse.materialize(pulse.SOURCE).source, - sep = _.separation || 0, - items, test, bounds; - - if (!source || !source.length) return; - - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - return pulse; - } - - // skip labels with no content - source = source.filter(hasBounds); - - // early exit, nothing to do - if (!source.length) return; - - if (_.sort) { - source = source.slice().sort(_.sort); - } - - items = reset(source); - pulse = reflow(pulse, _); - - if (items.length >= 3 && hasOverlap(items, sep)) { - do { - items = reduce(items, sep); - } while (items.length >= 3 && hasOverlap(items, sep)); - - if (items.length < 3 && !peek(source).opacity) { - if (items.length > 1) peek(items).opacity = 0; - peek(source).opacity = 1; - } - } - - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach(item => { - if (!test(item)) item.opacity = 0; - }); - } - - // re-calculate mark bounds - bounds = items[0].mark.bounds.clear(); - source.forEach(item => { - if (item.opacity) bounds.union(item.bounds); - }); - - return pulse; -}; diff --git a/node_modules/vega-view-transforms/src/Render.js b/node_modules/vega-view-transforms/src/Render.js deleted file mode 100644 index 4bf426a..0000000 --- a/node_modules/vega-view-transforms/src/Render.js +++ /dev/null @@ -1,24 +0,0 @@ -import {Transform} from 'vega-dataflow'; -import {inherits} from 'vega-util'; - -/** - * Queue modified scenegraph items for rendering. - * @constructor - */ -export default function Render(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(Render, Transform); - -prototype.transform = function(_, pulse) { - var view = pulse.dataflow; - - pulse.visit(pulse.ALL, item => view.dirty(item)); - - // set z-index dirty flag as needed - if (pulse.fields && pulse.fields['zindex']) { - var item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } -}; diff --git a/node_modules/vega-view-transforms/src/ViewLayout.js b/node_modules/vega-view-transforms/src/ViewLayout.js deleted file mode 100644 index fa7751b..0000000 --- a/node_modules/vega-view-transforms/src/ViewLayout.js +++ /dev/null @@ -1,206 +0,0 @@ -import { - AxisRole, Bottom, ColFooter, ColHeader, ColTitle, - Fit, FitX, FitY, FrameRole, Left, LegendRole, - None, Pad, Padding, Right, - RowFooter, RowHeader, RowTitle, ScopeRole, TitleRole, Top -} from './constants'; - -import {axisLayout, isYAxis} from './layout/axis'; -import {gridLayout, trellisLayout} from './layout/grid'; -import {legendLayout, legendParams} from './layout/legend'; -import {titleLayout} from './layout/title'; - -import {Transform} from 'vega-dataflow'; -import {Bounds} from 'vega-scenegraph'; -import {inherits} from 'vega-util'; - -/** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ -export default function ViewLayout(params) { - Transform.call(this, null, params); -} - -var prototype = inherits(ViewLayout, Transform); - -prototype.transform = function(_, pulse) { - var view = pulse.dataflow; - _.mark.items.forEach(group => { - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; -}; - -function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; -} - -function layoutGroup(view, group, _) { - var items = group.items, - width = Math.max(0, group.width || 0), - height = Math.max(0, group.height || 0), - viewBounds = new Bounds().set(0, 0, width, height), - xBounds = viewBounds.clone(), - yBounds = viewBounds.clone(), - legends = [], title, - mark, orient, b, i, n; - - // layout axes, gather legends, collect bounds - for (i=0, n=items.length; i { - orient = item.orient || Right; - if (orient !== None) (l[orient] || (l[orient] = [])).push(item); - }); - - // perform grid layout for each orient group - for (let orient in l) { - const g = l[orient]; - gridLayout(view, g, legendParams( - g, orient, _.legends, xBounds, yBounds, width, height - )); - } - - // update view bounds - legends.forEach(item => { - const b = item.bounds; - - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - item.bounds = b; - view.dirty(item); - } - - if (_.autosize && _.autosize.type === Fit) { - // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch(item.orient) { - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - } else { - viewBounds.union(b); - } - }); - } - - // combine bounding boxes - viewBounds.union(xBounds).union(yBounds); - - // layout title, adjust bounds - if (title) { - viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - } - - // override aggregated view bounds if content is clipped - if (group.clip) { - viewBounds.set(0, 0, group.width || 0, group.height || 0); - } - - // perform size adjustment - viewSizeLayout(view, group, viewBounds, _); -} - -function viewSizeLayout(view, group, viewBounds, _) { - const auto = _.autosize || {}, - type = auto.type; - - if (view._autosize < 1 || !type) return; - - let viewWidth = view._width, - viewHeight = view._height, - width = Math.max(0, group.width || 0), - left = Math.max(0, Math.ceil(-viewBounds.x1)), - right = Math.max(0, Math.ceil(viewBounds.x2 - width)), - height = Math.max(0, group.height || 0), - top = Math.max(0, Math.ceil(-viewBounds.y1)), - bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - - if (auto.contains === Padding) { - const padding = view.padding(); - viewWidth -= padding.left + padding.right; - viewHeight -= padding.top + padding.bottom; - } - - if (type === None) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } - - else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } - - else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - - view._resizeView( - viewWidth, viewHeight, - width, height, - [left, top], - auto.resize - ); -} diff --git a/node_modules/vega-view-transforms/src/constants.js b/node_modules/vega-view-transforms/src/constants.js deleted file mode 100644 index 52cf62d..0000000 --- a/node_modules/vega-view-transforms/src/constants.js +++ /dev/null @@ -1,48 +0,0 @@ -export const Top = 'top'; -export const Left = 'left'; -export const Right = 'right'; -export const Bottom = 'bottom'; - -export const TopLeft = 'top-left'; -export const TopRight = 'top-right'; -export const BottomLeft = 'bottom-left'; -export const BottomRight = 'bottom-right'; - -export const Start = 'start'; -export const Middle = 'middle'; -export const End = 'end'; - -export const X = 'x'; -export const Y = 'y'; - -export const Group = 'group'; - -export const AxisRole = 'axis'; -export const TitleRole = 'title'; -export const FrameRole = 'frame'; -export const ScopeRole = 'scope'; -export const LegendRole = 'legend'; - -export const RowHeader = 'row-header'; -export const RowFooter = 'row-footer'; -export const RowTitle = 'row-title'; -export const ColHeader = 'column-header'; -export const ColFooter = 'column-footer'; -export const ColTitle = 'column-title'; - -export const Padding = 'padding'; - -export const Symbols = 'symbol'; - -export const Fit = 'fit'; -export const FitX = 'fit-x'; -export const FitY = 'fit-y'; -export const Pad = 'pad'; -export const None = 'none'; - -export const All = 'all'; -export const Each = 'each'; -export const Flush = 'flush'; - -export const Column = 'column'; -export const Row = 'row'; diff --git a/node_modules/vega-view-transforms/src/layout/axis.js b/node_modules/vega-view-transforms/src/layout/axis.js deleted file mode 100644 index e804328..0000000 --- a/node_modules/vega-view-transforms/src/layout/axis.js +++ /dev/null @@ -1,105 +0,0 @@ -import {Bottom, Left, Right, Top} from '../constants'; -import {set, tempBounds} from './util'; -import {boundStroke, multiLineOffset} from 'vega-scenegraph'; - -export function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; -} - -function axisIndices(datum) { - var index = +datum.grid; - return [ - datum.ticks ? index++ : -1, // ticks index - datum.labels ? index++ : -1, // labels index - index + (+datum.domain) // title index - ]; -} - -export function axisLayout(view, axis, width, height) { - var item = axis.items[0], - datum = item.datum, - delta = item.translate != null ? item.translate : 0.5, - orient = item.orient, - indices = axisIndices(datum), - range = item.range, - offset = item.offset, - position = item.position, - minExtent = item.minExtent, - maxExtent = item.maxExtent, - title = datum.title && item.items[indices[2]].items[0], - titlePadding = item.titlePadding, - bounds = item.bounds, - dl = title && multiLineOffset(title), - x = 0, y = 0, i, s; - - tempBounds.clear().union(bounds); - bounds.clear(); - if ((i=indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i=indices[1]) > -1) bounds.union(item.items[i].bounds); - - // position axis group and title - switch (orient) { - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - default: - x = item.x; - y = item.y; - } - - // update bounds - boundStroke(bounds.translate(x, y), item); - - if (set(item, 'x', x + delta) | set(item, 'y', y + delta)) { - item.bounds = tempBounds; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - - return item.mark.bounds.clear().union(bounds); -} - -function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - const b = title.bounds; - - if (title.auto) { - const v = sign * (offset + dl + pad); - let dx = 0, dy = 0; - - view.dirty(title); - isYAxis - ? dx = (title.x || 0) - (title.x = v) - : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - - bounds.union(b); -} diff --git a/node_modules/vega-view-transforms/src/layout/grid.js b/node_modules/vega-view-transforms/src/layout/grid.js deleted file mode 100644 index e098053..0000000 --- a/node_modules/vega-view-transforms/src/layout/grid.js +++ /dev/null @@ -1,381 +0,0 @@ -import { - All, AxisRole, ColFooter, ColHeader, ColTitle, Column, Each, End, Flush, - Group, LegendRole, Middle, Row, - RowFooter, RowHeader, RowTitle, - TitleRole, X, Y -} from '../constants'; -import {tempBounds} from './util'; -import {Bounds} from 'vega-scenegraph'; -import {isObject} from 'vega-util'; - -// aggregation functions for grid margin determination -const min = (a, b) => Math.floor(Math.min(a, b)); -const max = (a, b) => Math.ceil(Math.max(a, b)); - -function gridLayoutGroups(group) { - var groups = group.items, - n = groups.length, - i = 0, mark, items; - - var views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; - - // layout axes, gather legends, collect bounds - for (; i 1) { - for (i=0; i 0) dx[i] += x / 2; - } - } - - // perform vertical centering - if (alignRow && get(opt.center, Row) && ncols !== 1) { - for (i=0; i 0) dy[i] += y / 2; - } - } - - // position grid relative to anchor - for (i=0; i limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } - - // apply offset - init += offset; - - // clear mark bounds for all headers - for (j=0, m=headers.length; j= 0 && (g = groups[k]) == null; k-=back); - - // assign coordinates and update bounds - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); - - // update current edge of layout bounds - edge = agg(edge, b[bf]); - } - - return edge; -} - -function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); - - // compute title coordinates - var x = offset, y = offset; - isX - ? (x = Math.round(bounds.x1 + band * bounds.width())) - : (y = Math.round(bounds.y1 + band * bounds.height())); - - // assign coordinates and update bounds - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; - - // queue title for redraw - view.dirty(g); -} diff --git a/node_modules/vega-view-transforms/src/layout/legend.js b/node_modules/vega-view-transforms/src/layout/legend.js deleted file mode 100644 index 870b5ef..0000000 --- a/node_modules/vega-view-transforms/src/layout/legend.js +++ /dev/null @@ -1,219 +0,0 @@ -import { - Bottom, BottomLeft, BottomRight, Each, End, Flush, Left, Middle, - None, Right, Start, Symbols, Top, - TopLeft, TopRight -} from '../constants'; -import {boundStroke, multiLineOffset} from 'vega-scenegraph'; - -// utility for looking up legend layout configuration -function lookup(config, orient) { - const opt = config[orient] || {}; - return (key, d) => opt[key] != null ? opt[key] - : config[key] != null ? config[key] - : d; -} - -// if legends specify offset directly, use the maximum specified value -function offsets(legends, value) { - var max = -Infinity; - legends.forEach(item => { - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; -} - -export function legendParams(g, orient, config, xb, yb, w, h) { - const _ = lookup(config, orient), - offset = offsets(g, _('offset', 0)), - anchor = _('anchor', Start), - mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - - const p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - - switch (orient) { - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, column: End, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, row: End, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case TopLeft: - p.anchor = {x: offset, y: offset}; - break; - case TopRight: - p.anchor = {x: w - offset, y: offset, column: End}; - break; - case BottomLeft: - p.anchor = {x: offset, y: h - offset, row: End}; - break; - case BottomRight: - p.anchor = {x: w - offset, y: h - offset, column: End, row: End}; - break; - } - - return p; -} - -export function legendLayout(view, legend) { - var item = legend.items[0], - datum = item.datum, - orient = item.orient, - bounds = item.bounds, - x = item.x, y = item.y, w, h; - - // cache current bounds for later comparison - item._bounds - ? item._bounds.clear().union(bounds) - : item._bounds = bounds.clone(); - bounds.clear(); - - // adjust legend to accommodate padding and title - legendGroupLayout(view, item, item.items[0].items[0]); - - // aggregate bounds to determine size, and include origin - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - - if (datum.type === Symbols) { - legendEntryLayout(item.items[0].items[0].items[0].items); - } - - if (orient !== None) { - item.x = x = 0; - item.y = y = 0; - } - item.width = w; - item.height = h; - boundStroke(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - - return item; -} - -function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach(_ => b.union(_.bounds)); - - // anchor to legend origin - b.x1 = item.padding; - b.y1 = item.padding; - - return b; -} - -function legendGroupLayout(view, item, entry) { - var pad = item.padding, - ex = pad - entry.x, - ey = pad - entry.y; - - if (!item.datum.title) { - if (ex || ey) translate(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], - anchor = title.anchor, - tpad = item.titlePadding || 0, - tx = pad - title.x, - ty = pad - title.y; - - switch (title.orient) { - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - case Right: - case Bottom: - break; - default: - ey += title.bounds.height() + tpad; - } - if (ex || ey) translate(view, entry, ex, ey); - - switch (title.orient) { - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - if (tx || ty) translate(view, title, tx, ty); - - // translate legend if title pushes into negative coordinates - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate(view, entry, -tx, 0); - translate(view, title, -tx, 0); - } - } -} - -function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - const grad = item.datum.type !== 'symbol', - vgrad = title.datum.vgrad, - e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, - s = e.bounds[y ? 'y2' : 'x2'] - item.padding, - u = vgrad && lr ? s : 0, - v = vgrad && lr ? 0 : s, - o = y <= 0 ? 0 : multiLineOffset(title); - - return Math.round(anchor === Start ? u - : anchor === End ? (v - o) - : 0.5 * (s - o)); -} - -function translate(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); -} - -function legendEntryLayout(entries) { - // get max widths for each column - var widths = entries.reduce((w, g) => { - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); - - // set dimensions of legend entry groups - entries.forEach(g => { - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); -} diff --git a/node_modules/vega-view-transforms/src/layout/title.js b/node_modules/vega-view-transforms/src/layout/title.js deleted file mode 100644 index 7111aae..0000000 --- a/node_modules/vega-view-transforms/src/layout/title.js +++ /dev/null @@ -1,89 +0,0 @@ -import {Bottom, End, Group, Left, Right, Start, Top} from '../constants'; -import {set, tempBounds} from './util'; - -export function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], - frame = group.frame, - orient = group.orient, - anchor = group.anchor, - offset = group.offset, - padding = group.padding, - title = group.items[0].items[0], - subtitle = group.items[1] && group.items[1].items[0], - end = (orient === Left || orient === Right) ? height : width, - start = 0, x = 0, y = 0, sx = 0, sy = 0, pos; - - if (frame !== Group) { - orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) - : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) - : (start = viewBounds.x1, end = viewBounds.x2); - } else if (orient === Left) { - start = height, end = 0; - } - - pos = (anchor === Start) ? start - : (anchor === End) ? end - : (start + end) / 2; - - if (subtitle && subtitle.text) { - // position subtitle - switch (orient) { - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - case Left: - sx = title.bounds.width() + padding; - break; - case Right: - sx = -title.bounds.width() - padding; - break; - } - - tempBounds.clear().union(subtitle.bounds); - tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - if (set(subtitle, 'x', sx) | set(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds); - subtitle.mark.bounds.clear().union(tempBounds); - view.dirty(subtitle); - } - - tempBounds.clear().union(subtitle.bounds); - } else { - tempBounds.clear(); - } - tempBounds.union(title.bounds); - - // position title group - switch (orient) { - case Top: - x = pos; - y = viewBounds.y1 - tempBounds.height() - offset; - break; - case Left: - x = viewBounds.x1 - tempBounds.width() - offset; - y = pos; - break; - case Right: - x = viewBounds.x2 + tempBounds.width() + offset; - y = pos; - break; - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - default: - x = group.x; - y = group.y; - } - - if (set(group, 'x', x) | set(group, 'y', y)) { - tempBounds.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds); - mark.bounds.clear().union(tempBounds); - view.dirty(group); - } - return group.bounds; -} diff --git a/node_modules/vega-view-transforms/src/layout/util.js b/node_modules/vega-view-transforms/src/layout/util.js deleted file mode 100644 index 1846217..0000000 --- a/node_modules/vega-view-transforms/src/layout/util.js +++ /dev/null @@ -1,8 +0,0 @@ -import {Bounds} from 'vega-scenegraph'; - -export const tempBounds = new Bounds(); - -export function set(item, property, value) { - return item[property] === value ? 0 - : (item[property] = value, 1); -} \ No newline at end of file diff --git a/node_modules/vega-view/LICENSE b/node_modules/vega-view/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-view/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-view/README.md b/node_modules/vega-view/README.md deleted file mode 100644 index 8d6650a..0000000 --- a/node_modules/vega-view/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# vega-view - -View component for Vega visualizations. A **View** instantiates an underlying dataflow graph and provides a component for rendering and interacting with a visualization. When initialized with a container DOM element, the View adds a Canvas or SVG-based visualization to a web page. Alternatively, a View can be used either client-side or server-side to export static SVG or PNG (Canvas) images. - -For the API reference, see the [Vega View API documentation](https://vega.github.io/vega/docs/api/view/). diff --git a/node_modules/vega-view/build/vega-view.js b/node_modules/vega-view/build/vega-view.js deleted file mode 100644 index a133910..0000000 --- a/node_modules/vega-view/build/vega-view.js +++ /dev/null @@ -1,1386 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('vega-dataflow'), require('vega-scenegraph'), require('d3-array'), require('vega-functions'), require('vega-runtime'), require('d3-timer'), require('vega-format')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'vega-dataflow', 'vega-scenegraph', 'd3-array', 'vega-functions', 'vega-runtime', 'd3-timer', 'vega-format'], factory) : - (global = global || self, factory(global.vega = {}, global.vega, global.vega, global.vega, global.d3, global.vega, global.vega, global.d3, global.vega)); -}(this, (function (exports, vegaUtil, vegaDataflow, vegaScenegraph, d3Array, vegaFunctions, vegaRuntime, d3Timer, vegaFormat) { 'use strict'; - - // initialize aria role and label attributes - function initializeAria(view) { - const el = view.container(); - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } - } - - // update aria-label if we have a DOM container element - function ariaLabel(el, desc) { - if (el) desc == null - ? el.removeAttribute('aria-label') - : el.setAttribute('aria-label', desc); - } - - function background(view) { - // respond to background signal - view.add(null, _ => { - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { bg: view._signals.background }); - } - - const Default = 'default'; - - function cursor(view) { - // get cursor signal, add to dataflow if needed - const cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); - - // evaluate cursor on each mousemove event - view.on(view.events('view', 'mousemove'), cursor, - function(_, event) { - const value = cursor.value, - user = value ? (vegaUtil.isString(value) ? value : value.user) : Default, - item = event.item && event.item.cursor || null; - - return (value && user === value.user && item == value.item) - ? value - : {user: user, item: item}; - } - ); - - // when cursor signal updates, set visible cursor - view.add(null, function(_) { - let user = _.cursor, - item = this.value; - - if (!vegaUtil.isString(user)) { - item = user.item; - user = user.user; - } - - setCursor(view, user && user !== Default ? user : (item || user)); - - return item; - }, {cursor: cursor}); - } - - function setCursor(view, cursor) { - const el = view.globalCursor() - ? (typeof document !== 'undefined' && document.body) - : view.container(); - - if (el) { - return cursor == null - ? el.style.removeProperty('cursor') - : (el.style.cursor = cursor); - } - } - - function dataref(view, name) { - var data = view._runtime.data; - if (!vegaUtil.hasOwnProperty(data, name)) { - vegaUtil.error('Unrecognized data set: ' + name); - } - return data[name]; - } - - function data(name, values) { - return arguments.length < 2 - ? dataref(this, name).values.value - : change.call(this, name, vegaDataflow.changeset().remove(vegaUtil.truthy).insert(values)); - } - - function change(name, changes) { - if (!vegaDataflow.isChangeSet(changes)) { - vegaUtil.error('Second argument to changes must be a changeset.'); - } - var dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); - } - - function insert(name, _) { - return change.call(this, name, vegaDataflow.changeset().insert(_)); - } - - function remove(name, _) { - return change.call(this, name, vegaDataflow.changeset().remove(_)); - } - - function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); - } - - function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); - } - - function offset(view) { - var padding = view.padding(), - origin = view._origin; - return [ - padding.left + origin[0], - padding.top + origin[1] - ]; - } - - function resizeRenderer(view) { - var origin = offset(view), - w = width(view), - h = height(view); - - view._renderer.background(view.background()); - view._renderer.resize(w, h, origin); - view._handler.origin(origin); - - view._resizeListeners.forEach(function(handler) { - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); - } - - /** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ - function eventExtend(view, event, item) { - var r = view._renderer, - el = r && r.canvas(), - p, e, translate; - - if (el) { - translate = offset(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = vegaScenegraph.point(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; - } - - function extension(view, item, point) { - var itemGroup = item - ? item.mark.marktype === 'group' ? item : item.mark.group - : null; - - function group(name) { - var g = itemGroup, i; - if (name) for (i = item; i; i = i.mark.group) { - if (i.mark.name === name) { g = i; break; } - } - return g && g.mark && g.mark.interactive ? g : {}; - } - - function xy(item) { - if (!item) return point; - if (vegaUtil.isString(item)) item = group(item); - - var p = point.slice(); - while (item) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - return p; - } - - return { - view: vegaUtil.constant(view), - item: vegaUtil.constant(item || {}), - group: group, - xy: xy, - x: function(item) { return xy(item)[0]; }, - y: function(item) { return xy(item)[1]; } - }; - } - - const VIEW = 'view', - TIMER = 'timer', - WINDOW = 'window', - NO_TRAP = {trap: false}; - - /** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ - function initializeEventConfig(config) { - const events = vegaUtil.extend({defaults: {}}, config); - - const unpack = (obj, keys) => { - keys.forEach(k => { - if (vegaUtil.isArray(obj[k])) obj[k] = vegaUtil.toSet(obj[k]); - }); - }; - - unpack(events.defaults, ['prevent', 'allow']); - unpack(events, ['view', 'window', 'selector']); - - return events; - } - - function prevent(view, type) { - var def = view._eventConfig.defaults, - prevent = def.prevent, - allow = def.allow; - - return prevent === false || allow === true ? false - : prevent === true || allow === false ? true - : prevent ? prevent[type] - : allow ? !allow[type] - : view.preventDefault(); - } - - function permit(view, key, type) { - const rule = view._eventConfig && view._eventConfig[key]; - - if (rule === false || (vegaUtil.isObject(rule) && !rule[type])) { - view.warn(`Blocked ${key} ${type} event listener.`); - return false; - } - - return true; - } - - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ - function events(source, type, filter) { - var view = this, - s = new vegaDataflow.EventStream(filter), - send = function(e, item) { - view.runAsync(null, () => { - if (source === VIEW && prevent(view, type)) { - e.preventDefault(); - } - s.receive(eventExtend(view, e, item)); - }); - }, - sources; - - if (source === TIMER) { - if (permit(view, 'timer', type)) { - view.timer(send, type); - } - } - - else if (source === VIEW) { - if (permit(view, 'view', type)) { - // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } - } - - else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') { - sources = [window]; - } - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) { - sources = document.querySelectorAll(source); - } - } - - if (!sources) { - view.warn('Can not resolve event source: ' + source); - } else { - for (var i=0, n=sources.length; i= 0) { - timers[n].stop(); - } - - n = listeners.length; - while (--n >= 0) { - e = listeners[n]; - m = e.sources.length; - while (--m >= 0) { - e.sources[m].removeEventListener(e.type, e.handler); - } - } - - if (tooltip) { - tooltip.call(this, this._handler, null, null, null); - } - - return this; - } - - function element(tag, attr, text) { - var el = document.createElement(tag); - for (var key in attr) el.setAttribute(key, attr[key]); - if (text != null) el.textContent = text; - return el; - } - - const BindClass = 'vega-bind', - NameClass = 'vega-bind-name', - RadioClass = 'vega-bind-radio'; - - /** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ - function bind(view, el, binding) { - if (!el) return; - - const param = binding.param; - let bind = binding.state; - - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: value => { - if (value !== view.signal(param.signal)) { - view.runAsync(null, function() { - bind.source = true; - view.signal(param.signal, value); - }); - } - } - }; - if (param.debounce) { - bind.update = vegaUtil.debounce(param.debounce, bind.update); - } - } - - generate(bind, el, param, view.signal(param.signal)); - - if (!bind.active) { - view.on(view._signals[param.signal], null, () => { - bind.source - ? (bind.source = false) - : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - - return bind; - } - - /** - * Generate an HTML input form element and bind it to a signal. - */ - function generate(bind, el, param, value) { - const div = element('div', {'class': BindClass}); - - const wrapper = param.input === 'radio' - ? div - : div.appendChild(element('label')); - - wrapper.appendChild(element('span', - {'class': NameClass}, - (param.name || param.signal) - )); - - el.appendChild(div); - - let input = form; - switch (param.input) { - case 'checkbox': input = checkbox; break; - case 'select': input = select; break; - case 'radio': input = radio; break; - case 'range': input = range; break; - } - - input(bind, wrapper, param, value); - } - - /** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ - function form(bind, el, param, value) { - const node = element('input'); - - for (const key in param) { - if (key !== 'signal' && key !== 'element') { - node.setAttribute(key === 'input' ? 'type' : key, param[key]); - } - } - node.setAttribute('name', param.signal); - node.value = value; - - el.appendChild(node); - node.addEventListener('input', () => bind.update(node.value)); - - bind.elements = [node]; - bind.set = value => node.value = value; - } - - /** - * Generates a checkbox input element. - */ - function checkbox(bind, el, param, value) { - const attr = {type: 'checkbox', name: param.signal}; - if (value) attr.checked = true; - const node = element('input', attr); - - el.appendChild(node); - node.addEventListener('change', () => bind.update(node.checked)); - - bind.elements = [node]; - bind.set = value => node.checked = !!value || null; - } - - /** - * Generates a selection list input element. - */ - function select(bind, el, param, value) { - const node = element('select', {name: param.signal}), - labels = param.labels || []; - - param.options.forEach((option, i) => { - const attr = {value: option}; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element('option', attr, (labels[i] || option)+'')); - }); - - el.appendChild(node); - - node.addEventListener('change', () => { - bind.update(param.options[node.selectedIndex]); - }); - - bind.elements = [node]; - bind.set = value => { - for (let i = 0, n = param.options.length; i < n; ++i) { - if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; return; - } - } - }; - } - - /** - * Generates a radio button group. - */ - function radio(bind, el, param, value) { - const group = element('span', {'class': RadioClass}), - labels = param.labels || []; - - el.appendChild(group); - - bind.elements = param.options.map((option, i) => { - const attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - - const input = element('input', attr); - input.addEventListener('change', () => bind.update(option)); - - const label = element('label', {}, (labels[i] || option)+''); - label.prepend(input); - group.appendChild(label); - - return input; - }); - - bind.set = value => { - const nodes = bind.elements, - n = nodes.length; - for (let i = 0; i < n; ++i) { - if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - } - }; - } - - /** - * Generates a slider input element. - */ - function range(bind, el, param, value) { - value = value !== undefined ? value : ((+param.max) + (+param.min)) / 2; - - const max = param.max != null ? param.max : Math.max(100, +value) || 100, - min = param.min || Math.min(0, max, +value) || 0, - step = param.step || d3Array.tickStep(min, max, 100); - - const node = element('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - - const span = element('span', {}, +value); - - el.appendChild(node); - el.appendChild(span); - - const update = () => { - span.textContent = node.value; - bind.update(+node.value); - }; - - // subscribe to both input and change - node.addEventListener('input', update); - node.addEventListener('change', update); - - bind.elements = [node]; - bind.set = value => { - node.value = value; - span.textContent = value; - }; - } - - function valuesEqual(a, b) { - return a === b || (a+'' === b+''); - } - - function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r - .initialize(el, width(view), height(view), offset(view), scaleFactor, opt) - .background(view.background()); - } - - function trap(view, fn) { - return !fn ? null : function() { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; - } - - function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - var handler = new constructor(view.loader(), trap(view, view.tooltip())) - .scene(view.scenegraph().root) - .initialize(el, offset(view), view); - - // transfer event handlers - if (prevHandler) { - prevHandler.handlers().forEach(function(h) { - handler.on(h.type, h.handler); - }); - } - - return handler; - } - - function initialize(el, elBind) { - const view = this, - type = view._renderType, - config = view._eventConfig.bind, - module = vegaScenegraph.renderModule(type); - - // containing dom element - el = view._el = el ? lookup(view, el) : null; - - // initialize aria attributes - initializeAria(view); - - // select appropriate renderer & handler - if (!module) view.error('Unrecognized renderer type: ' + type); - const Handler = module.handler || vegaScenegraph.CanvasHandler, - Renderer = (el ? module.renderer : module.headless); - - // initialize renderer and input handler - view._renderer = !Renderer ? null - : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; - - // initialize signal bindings - if (el && config !== 'none') { - elBind = elBind ? (view._elBind = lookup(view, elBind)) - : el.appendChild(element('form', {'class': 'vega-bindings'})); - - view._bind.forEach(function(_) { - if (_.param.element && config !== 'container') { - _.element = lookup(view, _.param.element); - } - }); - - view._bind.forEach(function(_) { - bind(view, _.element || elBind, _); - }); - } - - return view; - } - - function lookup(view, el) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; - } - } - if (el) { - try { - el.innerHTML = ''; - } catch (e) { - el = null; - view.error(e); - } - } - return el; - } - - const number = _ => +_ || 0; - - const paddingObject = _ => ({top: _, bottom: _, left: _, right: _}); - - function padding(_) { - return vegaUtil.isObject(_) - ? { - top: number(_.top), - bottom: number(_.bottom), - left: number(_.left), - right: number(_.right) - } - : paddingObject(number(_)); - } - - /** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ - async function renderHeadless(view, type, scaleFactor, opt) { - const module = vegaScenegraph.renderModule(type), - ctr = module && module.headless; - - if (!ctr) vegaUtil.error('Unrecognized renderer type: ' + type); - - await view.runAsync(); - return initializeRenderer(view, null, null, ctr, scaleFactor, opt) - .renderAsync(view._scenegraph.root); - } - - /** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ - async function renderToImageURL(type, scaleFactor) { - if (type !== vegaScenegraph.RenderType.Canvas && type !== vegaScenegraph.RenderType.SVG && type !== vegaScenegraph.RenderType.PNG) { - vegaUtil.error('Unrecognized image type: ' + type); - } - - const r = await renderHeadless(this, type, scaleFactor); - return type === vegaScenegraph.RenderType.SVG - ? toBlobURL(r.svg(), 'image/svg+xml') - : r.canvas().toDataURL('image/png'); - } - - function toBlobURL(data, mime) { - var blob = new Blob([data], {type: mime}); - return window.URL.createObjectURL(blob); - } - - /** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ - async function renderToCanvas(scaleFactor, opt) { - const r = await renderHeadless(this, vegaScenegraph.RenderType.Canvas, scaleFactor, opt); - return r.canvas(); - } - - /** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ - async function renderToSVG(scaleFactor) { - const r = await renderHeadless(this, vegaScenegraph.RenderType.SVG, scaleFactor); - return r.svg(); - } - - function runtime(view, spec, expr) { - return vegaRuntime.context(view, vegaDataflow.transforms, vegaFunctions.functionContext, expr).parse(spec); - } - - function scale(name) { - var scales = this._runtime.scales; - if (!vegaUtil.hasOwnProperty(scales, name)) { - vegaUtil.error('Unrecognized scale or projection: ' + name); - } - return scales[name].value; - } - - var Width = 'width', - Height = 'height', - Padding = 'padding', - Skip = {skip: true}; - - function viewWidth(view, width) { - var a = view.autosize(), - p = view.padding(); - return width - (a && a.contains === Padding ? p.left + p.right : 0); - } - - function viewHeight(view, height) { - var a = view.autosize(), - p = view.padding(); - return height - (a && a.contains === Padding ? p.top + p.bottom : 0); - } - - function initializeResize(view) { - var s = view._signals, - w = s[Width], - h = s[Height], - p = s[Padding]; - - function resetSize() { - view._autosize = view._resize = 1; - } - - // respond to width signal - view._resizeWidth = view.add(null, - function(_) { - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, - {size: w} - ); - - // respond to height signal - view._resizeHeight = view.add(null, - function(_) { - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, - {size: h} - ); - - // respond to padding signal - var resizePadding = view.add(null, resetSize, {pad: p}); - - // set rank to run immediately after source signal - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; - } - - function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter(function(view) { - var rerun = 0; - - // reset autosize flag - view._autosize = 0; - - // width value changed: update signal, skip resize op - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip); // set width, skip update calc - view._resizeWidth.skip(true); // skip width resize handler - } - - // height value changed: update signal, skip resize op - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip); // set height, skip update calc - view._resizeHeight.skip(true); // skip height resize handler - } - - // view width changed: update view property, set resize flag - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } - - // view height changed: update view property, set resize flag - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } - - // origin changed: update view property, set resize flag - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } - - // run dataflow on width/height signal change - if (rerun) view.run('enter'); - if (auto) view.runAfter(v => v.resize()); - }, false, 1); - } - - /** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ - function getState(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); - } - - function dataTest(name, data) { - return data.modified - && vegaUtil.isArray(data.input.value) - && name.indexOf('_:vega:_'); - } - - function signalTest(name, op) { - return !(name === 'parent' || op instanceof vegaDataflow.transforms.proxy); - } - - /** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ - function setState(state) { - this.runAsync(null, - v => { v._trigger = false; v._runtime.setState(state); }, - v => { v._trigger = true; } - ); - return this; - } - - function timer(callback, delay) { - function tick(elapsed) { - callback({timestamp: Date.now(), elapsed: elapsed}); - } - this._timers.push(d3Timer.interval(tick, delay)); - } - - function defaultTooltip(handler, event, item, value) { - var el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); - } - - function formatTooltip(value) { - return value == null ? '' - : vegaUtil.isArray(value) ? formatArray(value) - : vegaUtil.isObject(value) && !vegaUtil.isDate(value) ? formatObject(value) - : value + ''; - } - - function formatObject(obj) { - return Object.keys(obj).map(function(key) { - var v = obj[key]; - return key + ': ' + (vegaUtil.isArray(v) ? formatArray(v) : formatValue(v)); - }).join('\n'); - } - - function formatArray(value) { - return '[' + value.map(formatValue).join(', ') + ']'; - } - - function formatValue(value) { - return vegaUtil.isArray(value) ? '[\u2026]' - : vegaUtil.isObject(value) && !vegaUtil.isDate(value) ? '{\u2026}' - : value; - } - - /** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ - function View(spec, options) { - const view = this; - options = options || {}; - - vegaDataflow.Dataflow.call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - if (options.locale || spec.locale) { - const loc = vegaUtil.extend({}, spec.locale, options.locale); - view.locale(vegaFormat.locale(loc.number, loc.time)); - } - - view._el = null; - view._elBind = null; - view._renderType = options.renderer || vegaScenegraph.RenderType.Canvas; - view._scenegraph = new vegaScenegraph.Scenegraph(); - const root = view._scenegraph.root; - - // initialize renderer, handler and event management - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip, - view._redraw = true; - view._handler = new vegaScenegraph.CanvasHandler().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; - - // initialize event configuration - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); - - // initialize dataflow graph - const ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map(_ => ({ - state: null, - param: vegaUtil.extend({}, _) - })); - - // initialize scenegraph - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse( - ctx.data.root.input, - view.changeset().insert(root.items) - ); - - // initialize view size - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [0, 0]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); - - // initialize background color - background(view); - - // initialize cursor - cursor(view); - - // initialize view description - view.description(spec.description); - - // initialize hover proessing, if requested - if (options.hover) view.hover(); - - // initialize DOM container(s) and renderer - if (options.container) view.initialize(options.container, options.bind); - } - - var prototype = vegaUtil.inherits(View, vegaDataflow.Dataflow); - - // -- DATAFLOW / RENDERING ---- - - prototype.evaluate = async function(encode, prerun, postrun) { - // evaluate dataflow and prerun - await vegaDataflow.Dataflow.prototype.evaluate.call(this, encode, prerun); - - // render as needed - if (this._redraw || this._resize) { - try { - if (this._renderer) { - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - await this._renderer.renderAsync(this._scenegraph.root); - } - this._redraw = false; - } catch (e) { - this.error(e); - } - } - - // evaluate postrun - if (postrun) vegaDataflow.asyncCallback(this, postrun); - - return this; - }; - - prototype.dirty = function(item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); - }; - - // -- GET / SET ---- - - prototype.description = function(text) { - if (arguments.length) { - const desc = text != null ? (text + '') : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - return this._desc; - }; - - prototype.container = function() { - return this._el; - }; - - prototype.scenegraph = function() { - return this._scenegraph; - }; - - prototype.origin = function() { - return this._origin.slice(); - }; - - function lookupSignal(view, name) { - return vegaUtil.hasOwnProperty(view._signals, name) - ? view._signals[name] - : vegaUtil.error('Unrecognized signal name: ' + vegaUtil.stringValue(name)); - } - - prototype.signal = function(name, value, options) { - var op = lookupSignal(this, name); - return arguments.length === 1 - ? op.value - : this.update(op, value, options); - }; - - prototype.width = function(_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); - }; - - prototype.height = function(_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); - }; - - prototype.padding = function(_) { - return arguments.length - ? this.signal('padding', padding(_)) - : padding(this.signal('padding')); - }; - - prototype.autosize = function(_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); - }; - - prototype.background = function(_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); - }; - - prototype.renderer = function(type) { - if (!arguments.length) return this._renderType; - if (!vegaScenegraph.renderModule(type)) vegaUtil.error('Unrecognized renderer type: ' + type); - if (type !== this._renderType) { - this._renderType = type; - this._resetRenderer(); - } - return this; - }; - - prototype.tooltip = function(handler) { - if (!arguments.length) return this._tooltip; - if (handler !== this._tooltip) { - this._tooltip = handler; - this._resetRenderer(); - } - return this; - }; - - prototype.loader = function(loader) { - if (!arguments.length) return this._loader; - if (loader !== this._loader) { - vegaDataflow.Dataflow.prototype.loader.call(this, loader); - this._resetRenderer(); - } - return this; - }; - - prototype.resize = function() { - // set flag to perform autosize - this._autosize = 1; - // touch autosize signal to ensure top-level ViewLayout runs - return this.touch(lookupSignal(this, 'autosize')); - }; - - prototype._resetRenderer = function() { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } - }; - - // -- SIZING ---- - prototype._resizeView = resizeView; - - // -- EVENT HANDLING ---- - - prototype.addEventListener = function(type, handler, options) { - var callback = handler; - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - this._handler.on(type, callback); - return this; - }; - - prototype.removeEventListener = function(type, handler) { - var handlers = this._handler.handlers(type), - i = handlers.length, h, t; - - // search registered handlers, remove if match found - while (--i >= 0) { - t = handlers[i].type; - h = handlers[i].handler; - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - break; - } - } - return this; - }; - - prototype.addResizeListener = function(handler) { - var l = this._resizeListeners; - if (l.indexOf(handler) < 0) { - // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - } - return this; - }; - - prototype.removeResizeListener = function(handler) { - var l = this._resizeListeners, - i = l.indexOf(handler); - if (i >= 0) { - l.splice(i, 1); - } - return this; - }; - - function findOperatorHandler(op, handler) { - const h = (op._targets || []) - .filter(op => op._update && op._update.handler === handler); - return h.length ? h[0] : null; - } - - function addOperatorListener(view, name, op, handler) { - var h = findOperatorHandler(op, handler); - if (!h) { - h = trap(view, () => handler(name, op.value)); - h.handler = handler; - view.on(op, null, h); - } - return view; - } - - function removeOperatorListener(view, op, handler) { - var h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; - } - - prototype.addSignalListener = function(name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); - }; - - prototype.removeSignalListener = function(name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); - }; - - prototype.addDataListener = function(name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); - }; - - prototype.removeDataListener = function(name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); - }; - - prototype.globalCursor = function(_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - const prev = setCursor(this, null); // clear previous cursor - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - return this; - } else { - return this._globalCursor; - } - }; - - prototype.preventDefault = function(_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else { - return this._preventDefault; - } - }; - - prototype.timer = timer; - prototype.events = events; - prototype.finalize = finalize; - prototype.hover = hover; - - // -- DATA ---- - prototype.data = data; - prototype.change = change; - prototype.insert = insert; - prototype.remove = remove; - - // -- SCALES -- - prototype.scale = scale; - - // -- INITIALIZATION ---- - prototype.initialize = initialize; - - // -- HEADLESS RENDERING ---- - prototype.toImageURL = renderToImageURL; - prototype.toCanvas = renderToCanvas; - prototype.toSVG = renderToSVG; - - // -- SAVE / RESTORE STATE ---- - prototype.getState = getState; - prototype.setState = setState; - - exports.View = View; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega-view/build/vega-view.min.js b/node_modules/vega-view/build/vega-view.min.js deleted file mode 100644 index ab5680c..0000000 --- a/node_modules/vega-view/build/vega-view.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-util"),require("vega-dataflow"),require("vega-scenegraph"),require("d3-array"),require("vega-functions"),require("vega-runtime"),require("d3-timer"),require("vega-format")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-dataflow","vega-scenegraph","d3-array","vega-functions","vega-runtime","d3-timer","vega-format"],n):n((e=e||self).vega={},e.vega,e.vega,e.vega,e.d3,e.vega,e.vega,e.d3,e.vega)}(this,(function(e,n,t,r,i,a,s,o,u){"use strict";function l(e,n){e&&(null==n?e.removeAttribute("aria-label"):e.setAttribute("aria-label",n))}function c(e,n){const t=e.globalCursor()?"undefined"!=typeof document&&document.body:e.container();if(t)return null==n?t.style.removeProperty("cursor"):t.style.cursor=n}function d(e,t){var r=e._runtime.data;return n.hasOwnProperty(r,t)||n.error("Unrecognized data set: "+t),r[t]}function h(e,r){t.isChangeSet(r)||n.error("Second argument to changes must be a changeset.");var i=d(this,e);return i.modified=!0,this.pulse(i.input,r)}function g(e){var n=e.padding();return Math.max(0,e._viewWidth+n.left+n.right)}function f(e){var n=e.padding();return Math.max(0,e._viewHeight+n.top+n.bottom)}function p(e){var n=e.padding(),t=e._origin;return[n.left+t[0],n.top+t[1]]}function v(e,t,i){var a,s,o,u=e._renderer,l=u&&u.canvas();return l&&(o=p(e),s=t.changedTouches?t.changedTouches[0]:t,(a=r.point(s,l))[0]-=o[0],a[1]-=o[1]),t.dataflow=e,t.item=i,t.vega=function(e,t,r){var i=t?"group"===t.mark.marktype?t:t.mark.group:null;function a(e){var n,r=i;if(e)for(n=t;n;n=n.mark.group)if(n.mark.name===e){r=n;break}return r&&r.mark&&r.mark.interactive?r:{}}function s(e){if(!e)return r;n.isString(e)&&(e=a(e));for(var t=r.slice();e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:n.constant(e),item:n.constant(t||{}),group:a,xy:s,x:function(e){return s(e)[0]},y:function(e){return s(e)[1]}}}(e,i,a),t}const _={trap:!1};function m(e,t,r){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||n.isObject(i)&&!i[r])||(e.warn(`Blocked ${t} ${r} event listener.`),!1)}function w(e){return e.item}function y(e){return e.item.mark.source}function b(e){return function(n,t){return t.vega.view().changeset().encode(t.item,e)}}function z(e,n,t){var r=document.createElement(e);for(var i in n)r.setAttribute(i,n[i]);return null!=t&&(r.textContent=t),r}function k(e,t,r){if(!t)return;const i=r.param;let a=r.state;return a||(a=r.state={elements:null,active:!1,set:null,update:n=>{n!==e.signal(i.signal)&&e.runAsync(null,(function(){a.source=!0,e.signal(i.signal,n)}))}},i.debounce&&(a.update=n.debounce(i.debounce,a.update))),function(e,n,t,r){const i=z("div",{class:"vega-bind"}),a="radio"===t.input?i:i.appendChild(z("label"));a.appendChild(z("span",{class:"vega-bind-name"},t.name||t.signal)),n.appendChild(i);let s=C;switch(t.input){case"checkbox":s=L;break;case"select":s=x;break;case"radio":s=A;break;case"range":s=S}s(e,a,t,r)}(a,t,i,e.signal(i.signal)),a.active||(e.on(e._signals[i.signal],null,()=>{a.source?a.source=!1:a.set(e.signal(i.signal))}),a.active=!0),a}function C(e,n,t,r){const i=z("input");for(const e in t)"signal"!==e&&"element"!==e&&i.setAttribute("input"===e?"type":e,t[e]);i.setAttribute("name",t.signal),i.value=r,n.appendChild(i),i.addEventListener("input",()=>e.update(i.value)),e.elements=[i],e.set=e=>i.value=e}function L(e,n,t,r){const i={type:"checkbox",name:t.signal};r&&(i.checked=!0);const a=z("input",i);n.appendChild(a),a.addEventListener("change",()=>e.update(a.checked)),e.elements=[a],e.set=e=>a.checked=!!e||null}function x(e,n,t,r){const i=z("select",{name:t.signal}),a=t.labels||[];t.options.forEach((e,n)=>{const t={value:e};E(e,r)&&(t.selected=!0),i.appendChild(z("option",t,(a[n]||e)+""))}),n.appendChild(i),i.addEventListener("change",()=>{e.update(t.options[i.selectedIndex])}),e.elements=[i],e.set=e=>{for(let n=0,r=t.options.length;n{const o={type:"radio",name:t.signal,value:n};E(n,r)&&(o.checked=!0);const u=z("input",o);u.addEventListener("change",()=>e.update(n));const l=z("label",{},(a[s]||n)+"");return l.prepend(u),i.appendChild(l),u}),e.set=n=>{const t=e.elements,r=t.length;for(let e=0;e{l.textContent=u.value,e.update(+u.value)};u.addEventListener("input",c),u.addEventListener("change",c),e.elements=[u],e.set=e=>{u.value=e,l.textContent=e}}function E(e,n){return e===n||e+""==n+""}function D(e,n,t,r,i,a){return(n=n||new r(e.loader())).initialize(t,g(e),f(e),p(e),i,a).background(e.background())}function R(e,n){return n?function(){try{n.apply(this,arguments)}catch(n){e.error(n)}}:null}function T(e,n){if("string"==typeof n){if("undefined"==typeof document)return e.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return e.error("Signal bind element not found: "+n),null}if(n)try{n.innerHTML=""}catch(t){n=null,e.error(t)}return n}const O=e=>+e||0;function j(e){return n.isObject(e)?{top:O(e.top),bottom:O(e.bottom),left:O(e.left),right:O(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(O(e))}async function H(e,t,i,a){const s=r.renderModule(t),o=s&&s.headless;return o||n.error("Unrecognized renderer type: "+t),await e.runAsync(),D(e,null,null,o,i,a).renderAsync(e._scenegraph.root)}var U={skip:!0};function q(e,n){var t=e.autosize(),r=e.padding();return n-(t&&"padding"===t.contains?r.left+r.right:0)}function M(e,n){var t=e.autosize(),r=e.padding();return n-(t&&"padding"===t.contains?r.top+r.bottom:0)}function W(e,t){return t.modified&&n.isArray(t.input.value)&&e.indexOf("_:vega:_")}function V(e,n){return!("parent"===e||n instanceof t.transforms.proxy)}function P(e,t,r,i){var a=e.element();a&&a.setAttribute("title",function(e){return null==e?"":n.isArray(e)?B(e):n.isObject(e)&&!n.isDate(e)?(t=e,Object.keys(t).map((function(e){var r=t[e];return e+": "+(n.isArray(r)?B(r):G(r))})).join("\n")):e+"";var t}(i))}function B(e){return"["+e.map(G).join(", ")+"]"}function G(e){return n.isArray(e)?"[…]":n.isObject(e)&&!n.isDate(e)?"{…}":e}function I(e,i){const o=this;if(i=i||{},t.Dataflow.call(o),i.loader&&o.loader(i.loader),i.logger&&o.logger(i.logger),null!=i.logLevel&&o.logLevel(i.logLevel),i.locale||e.locale){const t=n.extend({},e.locale,i.locale);o.locale(u.locale(t.number,t.time))}o._el=null,o._elBind=null,o._renderType=i.renderer||r.RenderType.Canvas,o._scenegraph=new r.Scenegraph;const l=o._scenegraph.root;o._renderer=null,o._tooltip=i.tooltip||P,o._redraw=!0,o._handler=(new r.CanvasHandler).scene(l),o._globalCursor=!1,o._preventDefault=!1,o._timers=[],o._eventListeners=[],o._resizeListeners=[],o._eventConfig=function(e){const t=n.extend({defaults:{}},e),r=(e,t)=>{t.forEach(t=>{n.isArray(e[t])&&(e[t]=n.toSet(e[t]))})};return r(t.defaults,["prevent","allow"]),r(t,["view","window","selector"]),t}(e.eventConfig),o.globalCursor(o._eventConfig.globalCursor);const d=function(e,n,r){return s.context(e,t.transforms,a.functionContext,r).parse(n)}(o,e,i.expr);o._runtime=d,o._signals=d.signals,o._bind=(e.bindings||[]).map(e=>({state:null,param:n.extend({},e)})),d.root&&d.root.set(l),l.source=d.data.root.input,o.pulse(d.data.root.input,o.changeset().insert(l.items)),o._width=o.width(),o._height=o.height(),o._viewWidth=q(o,o._width),o._viewHeight=M(o,o._height),o._origin=[0,0],o._resize=0,o._autosize=1,function(e){var n=e._signals,t=n.width,r=n.height,i=n.padding;function a(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(function(n){e._width=n.size,e._viewWidth=q(e,n.size),a()}),{size:t}),e._resizeHeight=e.add(null,(function(n){e._height=n.size,e._viewHeight=M(e,n.size),a()}),{size:r});var s=e.add(null,a,{pad:i});e._resizeWidth.rank=t.rank+1,e._resizeHeight.rank=r.rank+1,s.rank=i.rank+1}(o),function(e){e.add(null,n=>(e._background=n.bg,e._resize=1,n.bg),{bg:e._signals.background})}(o),function(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:"default",item:null}));e.on(e.events("view","mousemove"),t,(function(e,r){const i=t.value,a=i?n.isString(i)?i:i.user:"default",s=r.item&&r.item.cursor||null;return i&&a===i.user&&s==i.item?i:{user:a,item:s}})),e.add(null,(function(t){let r=t.cursor,i=this.value;return n.isString(r)||(i=r.item,r=r.user),c(e,r&&"default"!==r?r:i||r),i}),{cursor:t})}(o),o.description(e.description),i.hover&&o.hover(),i.container&&o.initialize(i.container,i.bind)}var $=n.inherits(I,t.Dataflow);function N(e,t){return n.hasOwnProperty(e._signals,t)?e._signals[t]:n.error("Unrecognized signal name: "+n.stringValue(t))}function F(e,n){const t=(e._targets||[]).filter(e=>e._update&&e._update.handler===n);return t.length?t[0]:null}function J(e,n,t,r){var i=F(t,r);return i||((i=R(e,()=>r(n,t.value))).handler=r,e.on(t,null,i)),e}function K(e,n,t){var r=F(n,t);return r&&n._targets.remove(r),e}$.evaluate=async function(e,n,r){if(await t.Dataflow.prototype.evaluate.call(this,e,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,a=p(i=this),s=g(i),o=f(i),i._renderer.background(i.background()),i._renderer.resize(s,o,a),i._handler.origin(a),i._resizeListeners.forEach((function(e){try{e(s,o)}catch(e){i.error(e)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}var i,a,s,o;return r&&t.asyncCallback(this,r),this},$.dirty=function(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},$.description=function(e){if(arguments.length){const n=null!=e?e+"":null;return n!==this._desc&&l(this._el,this._desc=n),this}return this._desc},$.container=function(){return this._el},$.scenegraph=function(){return this._scenegraph},$.origin=function(){return this._origin.slice()},$.signal=function(e,n,t){var r=N(this,e);return 1===arguments.length?r.value:this.update(r,n,t)},$.width=function(e){return arguments.length?this.signal("width",e):this.signal("width")},$.height=function(e){return arguments.length?this.signal("height",e):this.signal("height")},$.padding=function(e){return arguments.length?this.signal("padding",j(e)):j(this.signal("padding"))},$.autosize=function(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},$.background=function(e){return arguments.length?this.signal("background",e):this.signal("background")},$.renderer=function(e){return arguments.length?(r.renderModule(e)||n.error("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},$.tooltip=function(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},$.loader=function(e){return arguments.length?(e!==this._loader&&(t.Dataflow.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},$.resize=function(){return this._autosize=1,this.touch(N(this,"autosize"))},$._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},$._resizeView=function(e,n,t,r,i,a){this.runAfter((function(s){var o=0;s._autosize=0,s.width()!==t&&(o=1,s.signal("width",t,U),s._resizeWidth.skip(!0)),s.height()!==r&&(o=1,s.signal("height",r,U),s._resizeHeight.skip(!0)),s._viewWidth!==e&&(s._resize=1,s._viewWidth=e),s._viewHeight!==n&&(s._resize=1,s._viewHeight=n),s._origin[0]===i[0]&&s._origin[1]===i[1]||(s._resize=1,s._origin=i),o&&s.run("enter"),a&&s.runAfter(e=>e.resize())}),!1,1)},$.addEventListener=function(e,n,t){var r=n;return t&&!1===t.trap||((r=R(this,n)).raw=n),this._handler.on(e,r),this},$.removeEventListener=function(e,n){for(var t,r,i=this._handler.handlers(e),a=i.length;--a>=0;)if(r=i[a].type,t=i[a].handler,e===r&&(n===t||n===t.raw)){this._handler.off(r,t);break}return this},$.addResizeListener=function(e){var n=this._resizeListeners;return n.indexOf(e)<0&&n.push(e),this},$.removeResizeListener=function(e){var n=this._resizeListeners,t=n.indexOf(e);return t>=0&&n.splice(t,1),this},$.addSignalListener=function(e,n){return J(this,e,N(this,e),n)},$.removeSignalListener=function(e,n){return K(this,N(this,e),n)},$.addDataListener=function(e,n){return J(this,e,d(this,e).values,n)},$.removeDataListener=function(e,n){return K(this,d(this,e).values,n)},$.globalCursor=function(e){if(arguments.length){if(this._globalCursor!==!!e){const n=c(this,null);this._globalCursor=!!e,n&&c(this,n)}return this}return this._globalCursor},$.preventDefault=function(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},$.timer=function(e,n){this._timers.push(o.interval((function(n){e({timestamp:Date.now(),elapsed:n})}),n))},$.events=function(e,n,r){var i,a=this,s=new t.EventStream(r),o=function(t,r){a.runAsync(null,()=>{"view"===e&&function(e,n){var t=e._eventConfig.defaults,r=t.prevent,i=t.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[n]:i?!i[n]:e.preventDefault()))}(a,n)&&t.preventDefault(),s.receive(v(a,t,r))})};if("timer"===e)m(a,"timer",n)&&a.timer(o,n);else if("view"===e)m(a,"view",n)&&a.addEventListener(n,o,_);else if("window"===e?m(a,"window",n)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&m(a,"selector",n)&&(i=document.querySelectorAll(e)),i){for(var u=0,l=i.length;u=0;)i[e].stop();for(e=a.length;--e>=0;)for(n=(t=a[e]).sources.length;--n>=0;)t.sources[n].removeEventListener(t.type,t.handler);return r&&r.call(this,this._handler,null,null,null),this},$.hover=function(e,n){return n=[n||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",w),y,b(e)),this.on(this.events("view","mouseout",w),y,b(n)),this},$.data=function(e,r){return arguments.length<2?d(this,e).values.value:h.call(this,e,t.changeset().remove(n.truthy).insert(r))},$.change=h,$.insert=function(e,n){return h.call(this,e,t.changeset().insert(n))},$.remove=function(e,n){return h.call(this,e,t.changeset().remove(n))},$.scale=function(e){var t=this._runtime.scales;return n.hasOwnProperty(t,e)||n.error("Unrecognized scale or projection: "+e),t[e].value},$.initialize=function(e,n){const t=this,i=t._renderType,a=t._eventConfig.bind,s=r.renderModule(i);e=t._el=e?T(t,e):null,function(e){const n=e.container();n&&(n.setAttribute("role","graphics-document"),n.setAttribute("aria-roleDescription","visualization"),l(n,e.description()))}(t),s||t.error("Unrecognized renderer type: "+i);const o=s.handler||r.CanvasHandler,u=e?s.renderer:s.headless;return t._renderer=u?D(t,t._renderer,e,u):null,t._handler=function(e,n,t,r){var i=new r(e.loader(),R(e,e.tooltip())).scene(e.scenegraph().root).initialize(t,p(e),e);return n&&n.handlers().forEach((function(e){i.on(e.type,e.handler)})),i}(t,t._handler,e,o),t._redraw=!0,e&&"none"!==a&&(n=n?t._elBind=T(t,n):e.appendChild(z("form",{class:"vega-bindings"})),t._bind.forEach((function(e){e.param.element&&"container"!==a&&(e.element=T(t,e.param.element))})),t._bind.forEach((function(e){k(t,e.element||n,e)}))),t},$.toImageURL=async function(e,t){e!==r.RenderType.Canvas&&e!==r.RenderType.SVG&&e!==r.RenderType.PNG&&n.error("Unrecognized image type: "+e);const i=await H(this,e,t);return e===r.RenderType.SVG?function(e,n){var t=new Blob([e],{type:n});return window.URL.createObjectURL(t)}(i.svg(),"image/svg+xml"):i.canvas().toDataURL("image/png")},$.toCanvas=async function(e,n){return(await H(this,r.RenderType.Canvas,e,n)).canvas()},$.toSVG=async function(e){return(await H(this,r.RenderType.SVG,e)).svg()},$.getState=function(e){return this._runtime.getState(e||{data:W,signals:V,recurse:!0})},$.setState=function(e){return this.runAsync(null,n=>{n._trigger=!1,n._runtime.setState(e)},e=>{e._trigger=!0}),this},e.View=I,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega-view/index.js b/node_modules/vega-view/index.js deleted file mode 100644 index 81d7061..0000000 --- a/node_modules/vega-view/index.js +++ /dev/null @@ -1 +0,0 @@ -export {default as View} from './src/View'; diff --git a/node_modules/vega-view/package.json b/node_modules/vega-view/package.json deleted file mode 100644 index 046d1cf..0000000 --- a/node_modules/vega-view/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "_from": "vega-view@~5.8.0", - "_id": "vega-view@5.8.0", - "_inBundle": false, - "_integrity": "sha512-0H+m0olEYpadUq+3z35t6g6ozbr9AzpGqg8KOklHpe+rSmmaaItEF8B+eGr3Ut5i/+u0c7PKa6jEdVG61xbpGA==", - "_location": "/vega-view", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "vega-view@~5.8.0", - "name": "vega-view", - "escapedName": "vega-view", - "rawSpec": "~5.8.0", - "saveSpec": null, - "fetchSpec": "~5.8.0" - }, - "_requiredBy": [ - "/vega" - ], - "_resolved": "https://registry.npmjs.org/vega-view/-/vega-view-5.8.0.tgz", - "_shasum": "64ff5acd32855c16b4799cdb4b657d9f3e15b7f9", - "_spec": "vega-view@~5.8.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega", - "author": { - "name": "Jeffrey Heer", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "d3-array": "^2.4.0", - "d3-timer": "^1.0.10", - "vega-dataflow": "^5.7.0", - "vega-format": "^1.0.1", - "vega-functions": "^5.7.1", - "vega-runtime": "^6.1.0", - "vega-scenegraph": "^4.8.3", - "vega-util": "^1.14.0" - }, - "deprecated": false, - "description": "View component and transforms for Vega visualizations.", - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "keywords": [ - "vega", - "view", - "layout" - ], - "license": "BSD-3-Clause", - "main": "build/vega-view.js", - "module": "index", - "name": "vega-view", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup", - "postbuild": "terser build/vega-view.js -c -m -o build/vega-view.min.js", - "postpublish": "git push && git push --tags", - "prebuild": "rimraf build && mkdir build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "rollup -g d3-array:d3,d3-timer:d3,vega-dataflow:vega,vega-format:vega,vega-functions:vega,vega-runtime:vega,vega-scenegraph:vega,vega-util:vega -f umd -n vega -o build/vega-view.js -- index.js", - "test": "tape 'test/**/*-test.js'" - }, - "version": "5.8.0" -} diff --git a/node_modules/vega-view/src/View.js b/node_modules/vega-view/src/View.js deleted file mode 100644 index bd20082..0000000 --- a/node_modules/vega-view/src/View.js +++ /dev/null @@ -1,389 +0,0 @@ -import {ariaLabel} from './aria'; -import background from './background'; -import cursor, {setCursor} from './cursor'; -import {change, data, dataref, insert, remove} from './data'; -import {events, initializeEventConfig} from './events'; -import hover from './hover'; -import finalize from './finalize'; -import initialize from './initialize'; -import padding from './padding'; -import renderToImageURL from './render-to-image-url'; -import renderToCanvas from './render-to-canvas'; -import renderToSVG from './render-to-svg'; -import {resizeRenderer} from './render-size'; -import runtime from './runtime'; -import {scale} from './scale'; -import {initializeResize, resizeView, viewHeight, viewWidth} from './size'; -import {getState, setState} from './state'; -import timer from './timer'; -import defaultTooltip from './tooltip'; -import trap from './trap'; - -import {Dataflow, asyncCallback} from 'vega-dataflow'; -import {locale} from 'vega-format'; -import { - CanvasHandler, RenderType, Scenegraph, renderModule -} from 'vega-scenegraph'; -import { - error, extend, hasOwnProperty, inherits, stringValue -} from 'vega-util'; - -/** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ -export default function View(spec, options) { - const view = this; - options = options || {}; - - Dataflow.call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - if (options.locale || spec.locale) { - const loc = extend({}, spec.locale, options.locale); - view.locale(locale(loc.number, loc.time)); - } - - view._el = null; - view._elBind = null; - view._renderType = options.renderer || RenderType.Canvas; - view._scenegraph = new Scenegraph(); - const root = view._scenegraph.root; - - // initialize renderer, handler and event management - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip, - view._redraw = true; - view._handler = new CanvasHandler().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; - - // initialize event configuration - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); - - // initialize dataflow graph - const ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map(_ => ({ - state: null, - param: extend({}, _) - })); - - // initialize scenegraph - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse( - ctx.data.root.input, - view.changeset().insert(root.items) - ); - - // initialize view size - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [0, 0]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); - - // initialize background color - background(view); - - // initialize cursor - cursor(view); - - // initialize view description - view.description(spec.description); - - // initialize hover proessing, if requested - if (options.hover) view.hover(); - - // initialize DOM container(s) and renderer - if (options.container) view.initialize(options.container, options.bind); -} - -var prototype = inherits(View, Dataflow); - -// -- DATAFLOW / RENDERING ---- - -prototype.evaluate = async function(encode, prerun, postrun) { - // evaluate dataflow and prerun - await Dataflow.prototype.evaluate.call(this, encode, prerun); - - // render as needed - if (this._redraw || this._resize) { - try { - if (this._renderer) { - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - await this._renderer.renderAsync(this._scenegraph.root); - } - this._redraw = false; - } catch (e) { - this.error(e); - } - } - - // evaluate postrun - if (postrun) asyncCallback(this, postrun); - - return this; -}; - -prototype.dirty = function(item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); -}; - -// -- GET / SET ---- - -prototype.description = function(text) { - if (arguments.length) { - const desc = text != null ? (text + '') : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - return this._desc; -}; - -prototype.container = function() { - return this._el; -}; - -prototype.scenegraph = function() { - return this._scenegraph; -}; - -prototype.origin = function() { - return this._origin.slice(); -}; - -function lookupSignal(view, name) { - return hasOwnProperty(view._signals, name) - ? view._signals[name] - : error('Unrecognized signal name: ' + stringValue(name)); -} - -prototype.signal = function(name, value, options) { - var op = lookupSignal(this, name); - return arguments.length === 1 - ? op.value - : this.update(op, value, options); -}; - -prototype.width = function(_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); -}; - -prototype.height = function(_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); -}; - -prototype.padding = function(_) { - return arguments.length - ? this.signal('padding', padding(_)) - : padding(this.signal('padding')); -}; - -prototype.autosize = function(_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); -}; - -prototype.background = function(_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); -}; - -prototype.renderer = function(type) { - if (!arguments.length) return this._renderType; - if (!renderModule(type)) error('Unrecognized renderer type: ' + type); - if (type !== this._renderType) { - this._renderType = type; - this._resetRenderer(); - } - return this; -}; - -prototype.tooltip = function(handler) { - if (!arguments.length) return this._tooltip; - if (handler !== this._tooltip) { - this._tooltip = handler; - this._resetRenderer(); - } - return this; -}; - -prototype.loader = function(loader) { - if (!arguments.length) return this._loader; - if (loader !== this._loader) { - Dataflow.prototype.loader.call(this, loader); - this._resetRenderer(); - } - return this; -}; - -prototype.resize = function() { - // set flag to perform autosize - this._autosize = 1; - // touch autosize signal to ensure top-level ViewLayout runs - return this.touch(lookupSignal(this, 'autosize')); -}; - -prototype._resetRenderer = function() { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } -}; - -// -- SIZING ---- -prototype._resizeView = resizeView; - -// -- EVENT HANDLING ---- - -prototype.addEventListener = function(type, handler, options) { - var callback = handler; - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - this._handler.on(type, callback); - return this; -}; - -prototype.removeEventListener = function(type, handler) { - var handlers = this._handler.handlers(type), - i = handlers.length, h, t; - - // search registered handlers, remove if match found - while (--i >= 0) { - t = handlers[i].type; - h = handlers[i].handler; - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - break; - } - } - return this; -}; - -prototype.addResizeListener = function(handler) { - var l = this._resizeListeners; - if (l.indexOf(handler) < 0) { - // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - } - return this; -}; - -prototype.removeResizeListener = function(handler) { - var l = this._resizeListeners, - i = l.indexOf(handler); - if (i >= 0) { - l.splice(i, 1); - } - return this; -}; - -function findOperatorHandler(op, handler) { - const h = (op._targets || []) - .filter(op => op._update && op._update.handler === handler); - return h.length ? h[0] : null; -} - -function addOperatorListener(view, name, op, handler) { - var h = findOperatorHandler(op, handler); - if (!h) { - h = trap(view, () => handler(name, op.value)); - h.handler = handler; - view.on(op, null, h); - } - return view; -} - -function removeOperatorListener(view, op, handler) { - var h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; -} - -prototype.addSignalListener = function(name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); -}; - -prototype.removeSignalListener = function(name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); -}; - -prototype.addDataListener = function(name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); -}; - -prototype.removeDataListener = function(name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); -}; - -prototype.globalCursor = function(_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - const prev = setCursor(this, null); // clear previous cursor - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - return this; - } else { - return this._globalCursor; - } -}; - -prototype.preventDefault = function(_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else { - return this._preventDefault; - } -}; - -prototype.timer = timer; -prototype.events = events; -prototype.finalize = finalize; -prototype.hover = hover; - -// -- DATA ---- -prototype.data = data; -prototype.change = change; -prototype.insert = insert; -prototype.remove = remove; - -// -- SCALES -- -prototype.scale = scale; - -// -- INITIALIZATION ---- -prototype.initialize = initialize; - -// -- HEADLESS RENDERING ---- -prototype.toImageURL = renderToImageURL; -prototype.toCanvas = renderToCanvas; -prototype.toSVG = renderToSVG; - -// -- SAVE / RESTORE STATE ---- -prototype.getState = getState; -prototype.setState = setState; diff --git a/node_modules/vega-view/src/aria.js b/node_modules/vega-view/src/aria.js deleted file mode 100644 index a96d08b..0000000 --- a/node_modules/vega-view/src/aria.js +++ /dev/null @@ -1,16 +0,0 @@ -// initialize aria role and label attributes -export function initializeAria(view) { - const el = view.container(); - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } -} - -// update aria-label if we have a DOM container element -export function ariaLabel(el, desc) { - if (el) desc == null - ? el.removeAttribute('aria-label') - : el.setAttribute('aria-label', desc); -} diff --git a/node_modules/vega-view/src/background.js b/node_modules/vega-view/src/background.js deleted file mode 100644 index 9b05c7b..0000000 --- a/node_modules/vega-view/src/background.js +++ /dev/null @@ -1,8 +0,0 @@ -export default function(view) { - // respond to background signal - view.add(null, _ => { - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { bg: view._signals.background }); -} diff --git a/node_modules/vega-view/src/bind.js b/node_modules/vega-view/src/bind.js deleted file mode 100644 index b862187..0000000 --- a/node_modules/vega-view/src/bind.js +++ /dev/null @@ -1,233 +0,0 @@ -import element from './element'; -import {debounce} from 'vega-util'; -import {tickStep} from 'd3-array'; - -const BindClass = 'vega-bind', - NameClass = 'vega-bind-name', - RadioClass = 'vega-bind-radio'; - -/** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ -export default function(view, el, binding) { - if (!el) return; - - const param = binding.param; - let bind = binding.state; - - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: value => { - if (value !== view.signal(param.signal)) { - view.runAsync(null, function() { - bind.source = true; - view.signal(param.signal, value); - }); - } - } - }; - if (param.debounce) { - bind.update = debounce(param.debounce, bind.update); - } - } - - generate(bind, el, param, view.signal(param.signal)); - - if (!bind.active) { - view.on(view._signals[param.signal], null, () => { - bind.source - ? (bind.source = false) - : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - - return bind; -} - -/** - * Generate an HTML input form element and bind it to a signal. - */ -function generate(bind, el, param, value) { - const div = element('div', {'class': BindClass}); - - const wrapper = param.input === 'radio' - ? div - : div.appendChild(element('label')); - - wrapper.appendChild(element('span', - {'class': NameClass}, - (param.name || param.signal) - )); - - el.appendChild(div); - - let input = form; - switch (param.input) { - case 'checkbox': input = checkbox; break; - case 'select': input = select; break; - case 'radio': input = radio; break; - case 'range': input = range; break; - } - - input(bind, wrapper, param, value); -} - -/** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ -function form(bind, el, param, value) { - const node = element('input'); - - for (const key in param) { - if (key !== 'signal' && key !== 'element') { - node.setAttribute(key === 'input' ? 'type' : key, param[key]); - } - } - node.setAttribute('name', param.signal); - node.value = value; - - el.appendChild(node); - node.addEventListener('input', () => bind.update(node.value)); - - bind.elements = [node]; - bind.set = value => node.value = value; -} - -/** - * Generates a checkbox input element. - */ -function checkbox(bind, el, param, value) { - const attr = {type: 'checkbox', name: param.signal}; - if (value) attr.checked = true; - const node = element('input', attr); - - el.appendChild(node); - node.addEventListener('change', () => bind.update(node.checked)); - - bind.elements = [node]; - bind.set = value => node.checked = !!value || null; -} - -/** - * Generates a selection list input element. - */ -function select(bind, el, param, value) { - const node = element('select', {name: param.signal}), - labels = param.labels || []; - - param.options.forEach((option, i) => { - const attr = {value: option}; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element('option', attr, (labels[i] || option)+'')); - }); - - el.appendChild(node); - - node.addEventListener('change', () => { - bind.update(param.options[node.selectedIndex]); - }); - - bind.elements = [node]; - bind.set = value => { - for (let i = 0, n = param.options.length; i < n; ++i) { - if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; return; - } - } - }; -} - -/** - * Generates a radio button group. - */ -function radio(bind, el, param, value) { - const group = element('span', {'class': RadioClass}), - labels = param.labels || []; - - el.appendChild(group); - - bind.elements = param.options.map((option, i) => { - const attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - - const input = element('input', attr); - input.addEventListener('change', () => bind.update(option)); - - const label = element('label', {}, (labels[i] || option)+''); - label.prepend(input); - group.appendChild(label); - - return input; - }); - - bind.set = value => { - const nodes = bind.elements, - n = nodes.length; - for (let i = 0; i < n; ++i) { - if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - } - }; -} - -/** - * Generates a slider input element. - */ -function range(bind, el, param, value) { - value = value !== undefined ? value : ((+param.max) + (+param.min)) / 2; - - const max = param.max != null ? param.max : Math.max(100, +value) || 100, - min = param.min || Math.min(0, max, +value) || 0, - step = param.step || tickStep(min, max, 100); - - const node = element('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - - const span = element('span', {}, +value); - - el.appendChild(node); - el.appendChild(span); - - const update = () => { - span.textContent = node.value; - bind.update(+node.value); - }; - - // subscribe to both input and change - node.addEventListener('input', update); - node.addEventListener('change', update); - - bind.elements = [node]; - bind.set = value => { - node.value = value; - span.textContent = value; - }; -} - -function valuesEqual(a, b) { - return a === b || (a+'' === b+''); -} diff --git a/node_modules/vega-view/src/cursor.js b/node_modules/vega-view/src/cursor.js deleted file mode 100644 index 4e4fdbd..0000000 --- a/node_modules/vega-view/src/cursor.js +++ /dev/null @@ -1,51 +0,0 @@ -import {isString} from 'vega-util'; - -const Default = 'default'; - -export default function(view) { - // get cursor signal, add to dataflow if needed - const cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); - - // evaluate cursor on each mousemove event - view.on(view.events('view', 'mousemove'), cursor, - function(_, event) { - const value = cursor.value, - user = value ? (isString(value) ? value : value.user) : Default, - item = event.item && event.item.cursor || null; - - return (value && user === value.user && item == value.item) - ? value - : {user: user, item: item}; - } - ); - - // when cursor signal updates, set visible cursor - view.add(null, function(_) { - let user = _.cursor, - item = this.value; - - if (!isString(user)) { - item = user.item; - user = user.user; - } - - setCursor(view, user && user !== Default ? user : (item || user)); - - return item; - }, {cursor: cursor}); -} - -export function setCursor(view, cursor) { - const el = view.globalCursor() - ? (typeof document !== 'undefined' && document.body) - : view.container(); - - if (el) { - return cursor == null - ? el.style.removeProperty('cursor') - : (el.style.cursor = cursor); - } -} diff --git a/node_modules/vega-view/src/data.js b/node_modules/vega-view/src/data.js deleted file mode 100644 index e95f7a7..0000000 --- a/node_modules/vega-view/src/data.js +++ /dev/null @@ -1,33 +0,0 @@ -import {changeset, isChangeSet} from 'vega-dataflow'; -import {error, hasOwnProperty, truthy} from 'vega-util'; - -export function dataref(view, name) { - var data = view._runtime.data; - if (!hasOwnProperty(data, name)) { - error('Unrecognized data set: ' + name); - } - return data[name]; -} - -export function data(name, values) { - return arguments.length < 2 - ? dataref(this, name).values.value - : change.call(this, name, changeset().remove(truthy).insert(values)); -} - -export function change(name, changes) { - if (!isChangeSet(changes)) { - error('Second argument to changes must be a changeset.'); - } - var dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); -} - -export function insert(name, _) { - return change.call(this, name, changeset().insert(_)); -} - -export function remove(name, _) { - return change.call(this, name, changeset().remove(_)); -} diff --git a/node_modules/vega-view/src/element.js b/node_modules/vega-view/src/element.js deleted file mode 100644 index 1cb303d..0000000 --- a/node_modules/vega-view/src/element.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function(tag, attr, text) { - var el = document.createElement(tag); - for (var key in attr) el.setAttribute(key, attr[key]); - if (text != null) el.textContent = text; - return el; -} diff --git a/node_modules/vega-view/src/events-extend.js b/node_modules/vega-view/src/events-extend.js deleted file mode 100644 index 8ce461a..0000000 --- a/node_modules/vega-view/src/events-extend.js +++ /dev/null @@ -1,84 +0,0 @@ -import {offset} from './render-size'; -import {constant, isString} from 'vega-util'; -import {point} from 'vega-scenegraph'; - -/** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ -export default function(view, event, item) { - var r = view._renderer, - el = r && r.canvas(), - p, e, translate; - - if (el) { - translate = offset(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = point(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; -} - -function extension(view, item, point) { - var itemGroup = item - ? item.mark.marktype === 'group' ? item : item.mark.group - : null; - - function group(name) { - var g = itemGroup, i; - if (name) for (i = item; i; i = i.mark.group) { - if (i.mark.name === name) { g = i; break; } - } - return g && g.mark && g.mark.interactive ? g : {}; - } - - function xy(item) { - if (!item) return point; - if (isString(item)) item = group(item); - - var p = point.slice(); - while (item) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - return p; - } - - return { - view: constant(view), - item: constant(item || {}), - group: group, - xy: xy, - x: function(item) { return xy(item)[0]; }, - y: function(item) { return xy(item)[1]; } - }; -} diff --git a/node_modules/vega-view/src/events.js b/node_modules/vega-view/src/events.js deleted file mode 100644 index 6dda673..0000000 --- a/node_modules/vega-view/src/events.js +++ /dev/null @@ -1,113 +0,0 @@ -import eventExtend from './events-extend'; -import {EventStream} from 'vega-dataflow'; -import {extend, isArray, isObject, toSet} from 'vega-util'; - -const VIEW = 'view', - TIMER = 'timer', - WINDOW = 'window', - NO_TRAP = {trap: false}; - -/** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ -export function initializeEventConfig(config) { - const events = extend({defaults: {}}, config); - - const unpack = (obj, keys) => { - keys.forEach(k => { - if (isArray(obj[k])) obj[k] = toSet(obj[k]); - }); - }; - - unpack(events.defaults, ['prevent', 'allow']); - unpack(events, ['view', 'window', 'selector']); - - return events; -} - -function prevent(view, type) { - var def = view._eventConfig.defaults, - prevent = def.prevent, - allow = def.allow; - - return prevent === false || allow === true ? false - : prevent === true || allow === false ? true - : prevent ? prevent[type] - : allow ? !allow[type] - : view.preventDefault(); -} - -function permit(view, key, type) { - const rule = view._eventConfig && view._eventConfig[key]; - - if (rule === false || (isObject(rule) && !rule[type])) { - view.warn(`Blocked ${key} ${type} event listener.`); - return false; - } - - return true; -} - -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ -export function events(source, type, filter) { - var view = this, - s = new EventStream(filter), - send = function(e, item) { - view.runAsync(null, () => { - if (source === VIEW && prevent(view, type)) { - e.preventDefault(); - } - s.receive(eventExtend(view, e, item)); - }); - }, - sources; - - if (source === TIMER) { - if (permit(view, 'timer', type)) { - view.timer(send, type); - } - } - - else if (source === VIEW) { - if (permit(view, 'view', type)) { - // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } - } - - else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') { - sources = [window]; - } - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) { - sources = document.querySelectorAll(source); - } - } - - if (!sources) { - view.warn('Can not resolve event source: ' + source); - } else { - for (var i=0, n=sources.length; i= 0) { - timers[n].stop(); - } - - n = listeners.length; - while (--n >= 0) { - e = listeners[n]; - m = e.sources.length; - while (--m >= 0) { - e.sources[m].removeEventListener(e.type, e.handler); - } - } - - if (tooltip) { - tooltip.call(this, this._handler, null, null, null); - } - - return this; -} diff --git a/node_modules/vega-view/src/hover.js b/node_modules/vega-view/src/hover.js deleted file mode 100644 index 7f39f47..0000000 --- a/node_modules/vega-view/src/hover.js +++ /dev/null @@ -1,37 +0,0 @@ -function itemFilter(event) { - return event.item; -} - -function markTarget(event) { - // grab upstream collector feeding the mark operator - return event.item.mark.source; -} - -function invoke(name) { - return function(_, event) { - return event.vega.view() - .changeset() - .encode(event.item, name); - }; -} - -export default function(hoverSet, leaveSet) { - hoverSet = [hoverSet || 'hover']; - leaveSet = [leaveSet || 'update', hoverSet[0]]; - - // invoke hover set upon mouseover - this.on( - this.events('view', 'mouseover', itemFilter), - markTarget, - invoke(hoverSet) - ); - - // invoke leave set upon mouseout - this.on( - this.events('view', 'mouseout', itemFilter), - markTarget, - invoke(leaveSet) - ); - - return this; -} diff --git a/node_modules/vega-view/src/initialize-handler.js b/node_modules/vega-view/src/initialize-handler.js deleted file mode 100644 index 0a23730..0000000 --- a/node_modules/vega-view/src/initialize-handler.js +++ /dev/null @@ -1,18 +0,0 @@ -import {offset} from './render-size'; -import trap from './trap'; - -export default function(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - var handler = new constructor(view.loader(), trap(view, view.tooltip())) - .scene(view.scenegraph().root) - .initialize(el, offset(view), view); - - // transfer event handlers - if (prevHandler) { - prevHandler.handlers().forEach(function(h) { - handler.on(h.type, h.handler); - }); - } - - return handler; -} diff --git a/node_modules/vega-view/src/initialize-renderer.js b/node_modules/vega-view/src/initialize-renderer.js deleted file mode 100644 index 6fd7008..0000000 --- a/node_modules/vega-view/src/initialize-renderer.js +++ /dev/null @@ -1,8 +0,0 @@ -import {height, offset, width} from './render-size'; - -export default function(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r - .initialize(el, width(view), height(view), offset(view), scaleFactor, opt) - .background(view.background()); -} diff --git a/node_modules/vega-view/src/initialize.js b/node_modules/vega-view/src/initialize.js deleted file mode 100644 index 8e4faac..0000000 --- a/node_modules/vega-view/src/initialize.js +++ /dev/null @@ -1,72 +0,0 @@ -import {initializeAria} from './aria'; -import bind from './bind'; -import element from './element'; -import initializeRenderer from './initialize-renderer'; -import initializeHandler from './initialize-handler'; -import {CanvasHandler, renderModule} from 'vega-scenegraph'; - -export default function(el, elBind) { - const view = this, - type = view._renderType, - config = view._eventConfig.bind, - module = renderModule(type); - - // containing dom element - el = view._el = el ? lookup(view, el) : null; - - // initialize aria attributes - initializeAria(view); - - // select appropriate renderer & handler - if (!module) view.error('Unrecognized renderer type: ' + type); - const Handler = module.handler || CanvasHandler, - Renderer = (el ? module.renderer : module.headless); - - // initialize renderer and input handler - view._renderer = !Renderer ? null - : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; - - // initialize signal bindings - if (el && config !== 'none') { - elBind = elBind ? (view._elBind = lookup(view, elBind)) - : el.appendChild(element('form', {'class': 'vega-bindings'})); - - view._bind.forEach(function(_) { - if (_.param.element && config !== 'container') { - _.element = lookup(view, _.param.element); - } - }); - - view._bind.forEach(function(_) { - bind(view, _.element || elBind, _); - }); - } - - return view; -} - -function lookup(view, el) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; - } - } - if (el) { - try { - el.innerHTML = ''; - } catch (e) { - el = null; - view.error(e); - } - } - return el; -} diff --git a/node_modules/vega-view/src/padding.js b/node_modules/vega-view/src/padding.js deleted file mode 100644 index 21f0e9d..0000000 --- a/node_modules/vega-view/src/padding.js +++ /dev/null @@ -1,16 +0,0 @@ -import {isObject} from 'vega-util'; - -const number = _ => +_ || 0; - -const paddingObject = _ => ({top: _, bottom: _, left: _, right: _}); - -export default function(_) { - return isObject(_) - ? { - top: number(_.top), - bottom: number(_.bottom), - left: number(_.left), - right: number(_.right) - } - : paddingObject(number(_)); -} diff --git a/node_modules/vega-view/src/render-headless.js b/node_modules/vega-view/src/render-headless.js deleted file mode 100644 index fd6757b..0000000 --- a/node_modules/vega-view/src/render-headless.js +++ /dev/null @@ -1,19 +0,0 @@ -import initializeRenderer from './initialize-renderer'; -import {renderModule} from 'vega-scenegraph'; -import {error} from 'vega-util'; - -/** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ -export default async function(view, type, scaleFactor, opt) { - const module = renderModule(type), - ctr = module && module.headless; - - if (!ctr) error('Unrecognized renderer type: ' + type); - - await view.runAsync(); - return initializeRenderer(view, null, null, ctr, scaleFactor, opt) - .renderAsync(view._scenegraph.root); -} diff --git a/node_modules/vega-view/src/render-size.js b/node_modules/vega-view/src/render-size.js deleted file mode 100644 index cc21395..0000000 --- a/node_modules/vega-view/src/render-size.js +++ /dev/null @@ -1,36 +0,0 @@ -export function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); -} - -export function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); -} - -export function offset(view) { - var padding = view.padding(), - origin = view._origin; - return [ - padding.left + origin[0], - padding.top + origin[1] - ]; -} - -export function resizeRenderer(view) { - var origin = offset(view), - w = width(view), - h = height(view); - - view._renderer.background(view.background()); - view._renderer.resize(w, h, origin); - view._handler.origin(origin); - - view._resizeListeners.forEach(function(handler) { - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); -} diff --git a/node_modules/vega-view/src/render-to-canvas.js b/node_modules/vega-view/src/render-to-canvas.js deleted file mode 100644 index 1ffdecf..0000000 --- a/node_modules/vega-view/src/render-to-canvas.js +++ /dev/null @@ -1,12 +0,0 @@ -import renderHeadless from './render-headless'; -import {RenderType} from 'vega-scenegraph'; - -/** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ -export default async function(scaleFactor, opt) { - const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt); - return r.canvas(); -} diff --git a/node_modules/vega-view/src/render-to-image-url.js b/node_modules/vega-view/src/render-to-image-url.js deleted file mode 100644 index 5d395dc..0000000 --- a/node_modules/vega-view/src/render-to-image-url.js +++ /dev/null @@ -1,28 +0,0 @@ -import renderHeadless from './render-headless'; -import {RenderType as Type} from 'vega-scenegraph'; -import {error} from 'vega-util'; - -/** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ -export default async function(type, scaleFactor) { - if (type !== Type.Canvas && type !== Type.SVG && type !== Type.PNG) { - error('Unrecognized image type: ' + type); - } - - const r = await renderHeadless(this, type, scaleFactor); - return type === Type.SVG - ? toBlobURL(r.svg(), 'image/svg+xml') - : r.canvas().toDataURL('image/png'); -} - -function toBlobURL(data, mime) { - var blob = new Blob([data], {type: mime}); - return window.URL.createObjectURL(blob); -} diff --git a/node_modules/vega-view/src/render-to-svg.js b/node_modules/vega-view/src/render-to-svg.js deleted file mode 100644 index 36300f4..0000000 --- a/node_modules/vega-view/src/render-to-svg.js +++ /dev/null @@ -1,12 +0,0 @@ -import renderHeadless from './render-headless'; -import {RenderType} from 'vega-scenegraph'; - -/** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ -export default async function(scaleFactor) { - const r = await renderHeadless(this, RenderType.SVG, scaleFactor); - return r.svg(); -} diff --git a/node_modules/vega-view/src/runtime.js b/node_modules/vega-view/src/runtime.js deleted file mode 100644 index 5b156fc..0000000 --- a/node_modules/vega-view/src/runtime.js +++ /dev/null @@ -1,7 +0,0 @@ -import {transforms} from 'vega-dataflow'; -import {functionContext} from 'vega-functions'; -import {context} from 'vega-runtime'; - -export default function(view, spec, expr) { - return context(view, transforms, functionContext, expr).parse(spec); -} diff --git a/node_modules/vega-view/src/scale.js b/node_modules/vega-view/src/scale.js deleted file mode 100644 index 96240fd..0000000 --- a/node_modules/vega-view/src/scale.js +++ /dev/null @@ -1,9 +0,0 @@ -import {error, hasOwnProperty} from 'vega-util'; - -export function scale(name) { - var scales = this._runtime.scales; - if (!hasOwnProperty(scales, name)) { - error('Unrecognized scale or projection: ' + name); - } - return scales[name].value; -} diff --git a/node_modules/vega-view/src/size.js b/node_modules/vega-view/src/size.js deleted file mode 100644 index 6ee9d95..0000000 --- a/node_modules/vega-view/src/size.js +++ /dev/null @@ -1,100 +0,0 @@ -var Width = 'width', - Height = 'height', - Padding = 'padding', - Skip = {skip: true}; - -export function viewWidth(view, width) { - var a = view.autosize(), - p = view.padding(); - return width - (a && a.contains === Padding ? p.left + p.right : 0); -} - -export function viewHeight(view, height) { - var a = view.autosize(), - p = view.padding(); - return height - (a && a.contains === Padding ? p.top + p.bottom : 0); -} - -export function initializeResize(view) { - var s = view._signals, - w = s[Width], - h = s[Height], - p = s[Padding]; - - function resetSize() { - view._autosize = view._resize = 1; - } - - // respond to width signal - view._resizeWidth = view.add(null, - function(_) { - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, - {size: w} - ); - - // respond to height signal - view._resizeHeight = view.add(null, - function(_) { - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, - {size: h} - ); - - // respond to padding signal - var resizePadding = view.add(null, resetSize, {pad: p}); - - // set rank to run immediately after source signal - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; -} - -export function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter(function(view) { - var rerun = 0; - - // reset autosize flag - view._autosize = 0; - - // width value changed: update signal, skip resize op - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip); // set width, skip update calc - view._resizeWidth.skip(true); // skip width resize handler - } - - // height value changed: update signal, skip resize op - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip); // set height, skip update calc - view._resizeHeight.skip(true); // skip height resize handler - } - - // view width changed: update view property, set resize flag - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } - - // view height changed: update view property, set resize flag - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } - - // origin changed: update view property, set resize flag - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } - - // run dataflow on width/height signal change - if (rerun) view.run('enter'); - if (auto) view.runAfter(v => v.resize()); - }, false, 1); -} diff --git a/node_modules/vega-view/src/state.js b/node_modules/vega-view/src/state.js deleted file mode 100644 index c00550b..0000000 --- a/node_modules/vega-view/src/state.js +++ /dev/null @@ -1,50 +0,0 @@ -import {transforms} from 'vega-dataflow'; -import {isArray} from 'vega-util'; - -/** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ -export function getState(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); -} - -function dataTest(name, data) { - return data.modified - && isArray(data.input.value) - && name.indexOf('_:vega:_'); -} - -function signalTest(name, op) { - return !(name === 'parent' || op instanceof transforms.proxy); -} - -/** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ -export function setState(state) { - this.runAsync(null, - v => { v._trigger = false; v._runtime.setState(state); }, - v => { v._trigger = true; } - ); - return this; -} diff --git a/node_modules/vega-view/src/timer.js b/node_modules/vega-view/src/timer.js deleted file mode 100644 index 2875472..0000000 --- a/node_modules/vega-view/src/timer.js +++ /dev/null @@ -1,8 +0,0 @@ -import {interval} from 'd3-timer'; - -export default function(callback, delay) { - function tick(elapsed) { - callback({timestamp: Date.now(), elapsed: elapsed}); - } - this._timers.push(interval(tick, delay)); -} diff --git a/node_modules/vega-view/src/tooltip.js b/node_modules/vega-view/src/tooltip.js deleted file mode 100644 index 80369a8..0000000 --- a/node_modules/vega-view/src/tooltip.js +++ /dev/null @@ -1,30 +0,0 @@ -import {isArray, isDate, isObject} from 'vega-util'; - -export default function(handler, event, item, value) { - var el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); -} - -function formatTooltip(value) { - return value == null ? '' - : isArray(value) ? formatArray(value) - : isObject(value) && !isDate(value) ? formatObject(value) - : value + ''; -} - -function formatObject(obj) { - return Object.keys(obj).map(function(key) { - var v = obj[key]; - return key + ': ' + (isArray(v) ? formatArray(v) : formatValue(v)); - }).join('\n'); -} - -function formatArray(value) { - return '[' + value.map(formatValue).join(', ') + ']'; -} - -function formatValue(value) { - return isArray(value) ? '[\u2026]' - : isObject(value) && !isDate(value) ? '{\u2026}' - : value; -} diff --git a/node_modules/vega-view/src/trap.js b/node_modules/vega-view/src/trap.js deleted file mode 100644 index cef9794..0000000 --- a/node_modules/vega-view/src/trap.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function(view, fn) { - return !fn ? null : function() { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; -} diff --git a/node_modules/vega-voronoi/LICENSE b/node_modules/vega-voronoi/LICENSE deleted file mode 100644 index 4b32a1e..0000000 --- a/node_modules/vega-voronoi/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015-2018, University of Washington Interactive Data Lab -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its contributors - may 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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/node_modules/vega-voronoi/README.md b/node_modules/vega-voronoi/README.md deleted file mode 100644 index 002ba7c..0000000 --- a/node_modules/vega-voronoi/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# vega-voronoi - -Voronoi diagram transform for Vega dataflows. - -This package provides the following Vega data transform: - -- [**Voronoi**](https://vega.github.io/vega/docs/transforms/voronoi/) [<>](https://github.com/vega/vega/blob/master/packages/vega-voronoi/src/Voronoi.js "Source") diff --git a/node_modules/vega-voronoi/build/vega-voronoi.js b/node_modules/vega-voronoi/build/vega-voronoi.js deleted file mode 100644 index a12820f..0000000 --- a/node_modules/vega-voronoi/build/vega-voronoi.js +++ /dev/null @@ -1,68 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-dataflow'), require('vega-util'), require('d3-delaunay')) : - typeof define === 'function' && define.amd ? define(['exports', 'vega-dataflow', 'vega-util', 'd3-delaunay'], factory) : - (global = global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.vega, global.vega, global.d3)); -}(this, (function (exports, vegaDataflow, vegaUtil, d3Delaunay) { 'use strict'; - - function Voronoi(params) { - vegaDataflow.Transform.call(this, null, params); - } - - Voronoi.Definition = { - 'type': 'Voronoi', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'extent', 'type': 'array', 'array': true, 'length': 2, - 'default': [[-1e5, -1e5], [1e5, 1e5]], - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] - }; - - const prototype = vegaUtil.inherits(Voronoi, vegaDataflow.Transform); - - const defaultExtent = [-1e5, -1e5, 1e5, 1e5]; - - prototype.transform = function(_, pulse) { - const as = _.as || 'path', - data = pulse.source; - - // nothing to do if no data - if (!data || !data.length) return pulse; - - // configure and construct voronoi diagram - let s = _.size; - s = s ? [0, 0, s[0], s[1]] - : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] - : defaultExtent; - - const voronoi = this.value = d3Delaunay.Delaunay.from(data, _.x, _.y).voronoi(s); - - // map polygons to paths - for (let i=0, n=data.length; i> 5, - ch = 1 << 11; - - function cloud() { - var size = [256, 256], - text, - font, - fontSize, - fontStyle, - fontWeight, - rotate, - padding, - spiral = archimedeanSpiral, - words = [], - random = Math.random, - cloud = {}; - - cloud.layout = function() { - var contextAndRatio = getContext(vegaCanvas.canvas()), - board = zeroArray((size[0] >> 5) * size[1]), - bounds = null, - n = words.length, - i = -1, - tags = [], - data = words.map(function(d) { - return { - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - }; - }).sort(function(a, b) { return b.size - a.size; }); - - while (++i < n) { - var d = data[i]; - d.x = (size[0] * (random() + .5)) >> 1; - d.y = (size[1] * (random() + .5)) >> 1; - cloudSprite(contextAndRatio, d, data, i); - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d); - else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}]; - // Temporary hack - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - - return tags; - }; - - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - - return {context: context, ratio: ratio}; - } - - function place(board, tag, bounds) { - var startX = tag.x, - startY = tag.y, - maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), - s = spiral(size), - dt = random() < .5 ? 1 : -1, - t = -dt, - dxdy, - dx, - dy; - - while (dxdy = s(t += dt)) { - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - - tag.x = startX + dx; - tag.y = startY + dy; - - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || - tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; - // TODO only check for collisions within current bounds. - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, - w = tag.width >> 5, - sw = size[0] >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - } - x += sw; - } - tag.sprite = null; - return true; - } - } - } - return false; - } - - cloud.words = function(_) { - if (arguments.length) { - words = _; - return cloud; - } else { - return words; - } - }; - - cloud.size = function(_) { - if (arguments.length) { - size = [+_[0], +_[1]]; - return cloud; - } else { - return size; - } - }; - - cloud.font = function(_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else { - return font; - } - }; - - cloud.fontStyle = function(_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else { - return fontStyle; - } - }; - - cloud.fontWeight = function(_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else { - return fontWeight; - } - }; - - cloud.rotate = function(_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else { - return rotate; - } - }; - - cloud.text = function(_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else { - return text; - } - }; - - cloud.spiral = function(_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else { - return spiral; - } - }; - - cloud.fontSize = function(_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else { - return fontSize; - } - }; - - cloud.padding = function(_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else { - return padding; - } - }; - - cloud.random = function(_) { - if (arguments.length) { - random = _; - return cloud; - } else { - return random; - } - }; - - return cloud; - } - - // Fetches a monochrome sprite bitmap for the specified text. - // Load in batches for speed. - function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, - ratio = contextAndRatio.ratio; - - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, - y = 0, - maxh = 0, - n = data.length, - w, w32, h, i, j; - --di; - while (++di < n) { - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), - cr = Math.cos(d.rotate * cloudRadians), - wcr = w * cr, - wsr = w * sr, - hcr = h * cr, - hsr = h * sr; - w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else { - w = (w + 0x1f) >> 5 << 5; - } - if (h > maxh) maxh = h; - if (x + w >= (cw << 5)) { - x = 0; - y += maxh; - maxh = 0; - } - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, - sprite = []; - while (--di >= 0) { - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; - // Zero the buffer - for (i = 0; i < h * w32; i++) sprite[i] = 0; - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, - seenRow = -1; - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - var k = w32 * j + (i >> 5), - m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0; - sprite[k] |= m; - seen |= m; - } - if (seen) seenRow = j; - else { - d.y0++; - h--; - j--; - y++; - } - } - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); - } - } - - // Use mask-based collision detection. - function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, - w = tag.width >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) - & board[x + i]) return true; - } - x += sw; - } - return false; - } - - function cloudBounds(bounds, d) { - var b0 = bounds[0], - b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; - } - - function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; - } - - function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function(t) { - return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)]; - }; - } - - function rectangularSpiral(size) { - var dy = 4, - dx = dy * size[0] / size[1], - x = 0, - y = 0; - return function(t) { - var sign = t < 0 ? -1 : 1; - // See triangular numbers: T_n = n * (n + 1) / 2. - switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) { - case 0: x += dx; break; - case 1: y += dy; break; - case 2: x -= dx; break; - default: y -= dy; break; - } - return [x, y]; - }; - } - - // TODO reuse arrays? - function zeroArray(n) { - var a = [], - i = -1; - while (++i < n) a[i] = 0; - return a; - } - - function functor(d) { - return typeof d === 'function' ? d : function() { return d; }; - } - - var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral - }; - - var Output = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle']; - - var Params = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight']; - - function Wordcloud(params) { - vegaDataflow.Transform.call(this, cloud(), params); - } - - Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'font', 'type': 'string', 'expr': true, 'default': 'sans-serif' }, - { 'name': 'fontStyle', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontWeight', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontSize', 'type': 'number', 'expr': true, 'default': 14 }, - { 'name': 'fontSizeRange', 'type': 'number', 'array': 'nullable', 'default': [10, 50] }, - { 'name': 'rotate', 'type': 'number', 'expr': true, 'default': 0 }, - { 'name': 'text', 'type': 'field' }, - { 'name': 'spiral', 'type': 'string', 'values': ['archimedean', 'rectangular'] }, - { 'name': 'padding', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 7, 'default': Output } - ] - }; - - var prototype = vegaUtil.inherits(Wordcloud, vegaDataflow.Transform); - - prototype.transform = function(_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) { - vegaUtil.error('Wordcloud size dimensions must be non-zero.'); - } - - function modp(param) { - var p = _[param]; - return vegaUtil.isFunction(p) && pulse.modified(p.fields); - } - - var mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || Params.some(modp))) return; - - var data = pulse.materialize(pulse.SOURCE).source, - layout = this.value, - as = _.as || Output, - fontSize = _.fontSize || 14, - range; - - vegaUtil.isFunction(fontSize) - ? (range = _.fontSizeRange) - : (fontSize = vegaUtil.constant(fontSize)); - - // create font size scaling function as needed - if (range) { - var fsize = fontSize, - sizeScale = vegaScale.scale('sqrt')() - .domain(vegaUtil.extent(data, fsize)) - .range(range); - fontSize = function(x) { return sizeScale(fsize(x)); }; - } - - data.forEach(function(t) { - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); - - // configure layout - var words = layout - .words(data) - .text(_.text) - .size(_.size || [500, 500]) - .padding(_.padding || 1) - .spiral(_.spiral || 'archimedean') - .rotate(_.rotate || 0) - .font(_.font || 'sans-serif') - .fontStyle(_.fontStyle || 'normal') - .fontWeight(_.fontWeight || 'normal') - .fontSize(fontSize) - .random(vegaStatistics.random) - .layout(); - - var size = layout.size(), - dx = size[0] >> 1, - dy = size[1] >> 1, - i = 0, - n = words.length, - w, t; - - for (; i=y));)if(e.x=s+a,e.y=l+i,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>c[0]||e.y+e.y1>c[1]||n&&u(e,t,c[0])||n&&(f=n,!((o=e).x+o.x1>f[0].x&&o.x+o.x0f[0].y&&o.y+o.y0>5,M=c[0]>>5,b=e.x-(z<<4),w=127&b,S=32-w,q=e.y1-e.y0,T=(e.y+e.y0)*M+(b>>5),W=0;W>>w:0);T+=M}return e.sprite=null,!0}return!1}return v.layout=function(){for(var u=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=2048/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(e.canvas()),y=function(t){var e=[],n=-1;for(;++n>5)*c[1]),x=null,d=h.length,g=-1,v=[],z=h.map((function(e){return{text:t(e),font:n(e),style:a(e),weight:i(e),rotate:o(e),size:~~(r(e)+1e-14),padding:f(e),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:e}})).sort((function(t,e){return e.size-t.size}));++g>1,M.y=c[1]*(m()+.5)>>1,s(u,M,z,g),M.hasText&&p(y,M,x)&&(v.push(M),x?l(x,M):x=[{x:M.x+M.x0,y:M.y+M.y0},{x:M.x+M.x1,y:M.y+M.y1}],M.x-=c[0]>>1,M.y-=c[1]>>1)}return v},v.words=function(t){return arguments.length?(h=t,v):h},v.size=function(t){return arguments.length?(c=[+t[0],+t[1]],v):c},v.font=function(t){return arguments.length?(n=x(t),v):n},v.fontStyle=function(t){return arguments.length?(a=x(t),v):a},v.fontWeight=function(t){return arguments.length?(i=x(t),v):i},v.rotate=function(t){return arguments.length?(o=x(t),v):o},v.text=function(e){return arguments.length?(t=x(e),v):t},v.spiral=function(t){return arguments.length?(g=d[t]||t,v):g},v.fontSize=function(t){return arguments.length?(r=x(t),v):r},v.padding=function(t){return arguments.length?(f=x(t),v):f},v.random=function(t){return arguments.length?(m=t,v):m},v}function s(t,e,n,r){if(!e.sprite){var a=t.context,i=t.ratio;a.clearRect(0,0,2048/i,2048/i);var f,s,u,l,y,x=0,d=0,c=0,g=n.length;for(--r;++r>5<<5,u=~~Math.max(Math.abs(p+z),Math.abs(p-z))}else f=f+31>>5<<5;if(u>c&&(c=u),x+f>=2048&&(x=0,d+=c,c=0),d+u>=2048)break;a.translate((x+(f>>1))/i,(d+(u>>1))/i),e.rotate&&a.rotate(e.rotate*o),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=f,e.height=u,e.xoff=x,e.yoff=d,e.x1=f>>1,e.y1=u>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,x+=f}for(var b=a.getImageData(0,0,2048/i,2048/i).data,w=[];--r>=0;)if((e=n[r]).hasText){for(s=(f=e.width)>>5,u=e.y1-e.y0,l=0;l>5),W=b[2048*(d+y)+(x+l)<<2]?1<<31-l%32:0;w[T]|=W,S|=W}S?q=y:(e.y0++,u--,y--,d++)}e.y1=e.y0+q,e.sprite=w.slice(0,(e.y1-e.y0)*s)}}}function u(t,e,n){n>>=5;for(var r,a=t.sprite,i=t.width>>5,o=t.x-(i<<4),f=127&o,s=32-f,u=t.y1-t.y0,l=(t.y+t.y0)*n+(o>>5),y=0;y>>f:0))&e[l+x])return!0;l+=n}return!1}function l(t,e){var n=t[0],r=t[1];e.x+e.x0r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function y(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function x(t){return"function"==typeof t?t:function(){return t}}var d={archimedean:y,rectangular:function(t){var e=4*t[0]/t[1],n=0,r=0;return function(t){var a=t<0?-1:1;switch(Math.sqrt(1+4*a*t)-a&3){case 0:n+=e;break;case 1:r+=4;break;case 2:n-=e;break;default:r-=4}return[n,r]}}},c=["x","y","font","fontSize","fontStyle","fontWeight","angle"],g=["text","font","rotate","fontSize","fontStyle","fontWeight"];function h(t){n.Transform.call(this,f(),t)}h.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:c}]},r.inherits(h,n.Transform).transform=function(t,e){!t.size||t.size[0]&&t.size[1]||r.error("Wordcloud size dimensions must be non-zero.");var n=t.modified();if(n||e.changed(e.ADD_REM)||g.some((function(n){var a=t[n];return r.isFunction(a)&&e.modified(a.fields)}))){var o,f=e.materialize(e.SOURCE).source,s=this.value,u=t.as||c,l=t.fontSize||14;if(r.isFunction(l)?o=t.fontSizeRange:l=r.constant(l),o){var y=l,x=a.scale("sqrt")().domain(r.extent(f,y)).range(o);l=function(t){return x(y(t))}}f.forEach((function(t){t[u[0]]=NaN,t[u[1]]=NaN,t[u[3]]=0}));for(var d,h,m=s.words(f).text(t.text).size(t.size||[500,500]).padding(t.padding||1).spiral(t.spiral||"archimedean").rotate(t.rotate||0).font(t.font||"sans-serif").fontStyle(t.fontStyle||"normal").fontWeight(t.fontWeight||"normal").fontSize(l).random(i.random).layout(),v=s.size(),p=v[0]>>1,z=v[1]>>1,M=0,b=m.length;M> 5, - ch = 1 << 11; - -export default function() { - var size = [256, 256], - text, - font, - fontSize, - fontStyle, - fontWeight, - rotate, - padding, - spiral = archimedeanSpiral, - words = [], - random = Math.random, - cloud = {}; - - cloud.layout = function() { - var contextAndRatio = getContext(canvas()), - board = zeroArray((size[0] >> 5) * size[1]), - bounds = null, - n = words.length, - i = -1, - tags = [], - data = words.map(function(d) { - return { - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - }; - }).sort(function(a, b) { return b.size - a.size; }); - - while (++i < n) { - var d = data[i]; - d.x = (size[0] * (random() + .5)) >> 1; - d.y = (size[1] * (random() + .5)) >> 1; - cloudSprite(contextAndRatio, d, data, i); - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d); - else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}]; - // Temporary hack - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - - return tags; - }; - - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - - return {context: context, ratio: ratio}; - } - - function place(board, tag, bounds) { - var startX = tag.x, - startY = tag.y, - maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), - s = spiral(size), - dt = random() < .5 ? 1 : -1, - t = -dt, - dxdy, - dx, - dy; - - while (dxdy = s(t += dt)) { - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - - tag.x = startX + dx; - tag.y = startY + dy; - - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || - tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; - // TODO only check for collisions within current bounds. - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, - w = tag.width >> 5, - sw = size[0] >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - } - x += sw; - } - tag.sprite = null; - return true; - } - } - } - return false; - } - - cloud.words = function(_) { - if (arguments.length) { - words = _; - return cloud; - } else { - return words; - } - }; - - cloud.size = function(_) { - if (arguments.length) { - size = [+_[0], +_[1]]; - return cloud; - } else { - return size; - } - }; - - cloud.font = function(_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else { - return font; - } - }; - - cloud.fontStyle = function(_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else { - return fontStyle; - } - }; - - cloud.fontWeight = function(_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else { - return fontWeight; - } - }; - - cloud.rotate = function(_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else { - return rotate; - } - }; - - cloud.text = function(_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else { - return text; - } - }; - - cloud.spiral = function(_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else { - return spiral; - } - }; - - cloud.fontSize = function(_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else { - return fontSize; - } - }; - - cloud.padding = function(_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else { - return padding; - } - }; - - cloud.random = function(_) { - if (arguments.length) { - random = _; - return cloud; - } else { - return random; - } - }; - - return cloud; -} - -// Fetches a monochrome sprite bitmap for the specified text. -// Load in batches for speed. -function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, - ratio = contextAndRatio.ratio; - - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, - y = 0, - maxh = 0, - n = data.length, - w, w32, h, i, j; - --di; - while (++di < n) { - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), - cr = Math.cos(d.rotate * cloudRadians), - wcr = w * cr, - wsr = w * sr, - hcr = h * cr, - hsr = h * sr; - w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else { - w = (w + 0x1f) >> 5 << 5; - } - if (h > maxh) maxh = h; - if (x + w >= (cw << 5)) { - x = 0; - y += maxh; - maxh = 0; - } - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, - sprite = []; - while (--di >= 0) { - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; - // Zero the buffer - for (i = 0; i < h * w32; i++) sprite[i] = 0; - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, - seenRow = -1; - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - var k = w32 * j + (i >> 5), - m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0; - sprite[k] |= m; - seen |= m; - } - if (seen) seenRow = j; - else { - d.y0++; - h--; - j--; - y++; - } - } - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); - } -} - -// Use mask-based collision detection. -function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, - w = tag.width >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) - & board[x + i]) return true; - } - x += sw; - } - return false; -} - -function cloudBounds(bounds, d) { - var b0 = bounds[0], - b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; -} - -function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; -} - -function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function(t) { - return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)]; - }; -} - -function rectangularSpiral(size) { - var dy = 4, - dx = dy * size[0] / size[1], - x = 0, - y = 0; - return function(t) { - var sign = t < 0 ? -1 : 1; - // See triangular numbers: T_n = n * (n + 1) / 2. - switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) { - case 0: x += dx; break; - case 1: y += dy; break; - case 2: x -= dx; break; - default: y -= dy; break; - } - return [x, y]; - }; -} - -// TODO reuse arrays? -function zeroArray(n) { - var a = [], - i = -1; - while (++i < n) a[i] = 0; - return a; -} - -function functor(d) { - return typeof d === 'function' ? d : function() { return d; }; -} - -var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral -}; diff --git a/node_modules/vega-wordcloud/src/Wordcloud.js b/node_modules/vega-wordcloud/src/Wordcloud.js deleted file mode 100644 index 72252ca..0000000 --- a/node_modules/vega-wordcloud/src/Wordcloud.js +++ /dev/null @@ -1,108 +0,0 @@ -import cloud from './CloudLayout'; -import {Transform} from 'vega-dataflow'; -import {constant, error, extent, inherits, isFunction} from 'vega-util'; -import {scale} from 'vega-scale'; -import {random} from 'vega-statistics'; - -var Output = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle']; - -var Params = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight']; - -export default function Wordcloud(params) { - Transform.call(this, cloud(), params); -} - -Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'font', 'type': 'string', 'expr': true, 'default': 'sans-serif' }, - { 'name': 'fontStyle', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontWeight', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontSize', 'type': 'number', 'expr': true, 'default': 14 }, - { 'name': 'fontSizeRange', 'type': 'number', 'array': 'nullable', 'default': [10, 50] }, - { 'name': 'rotate', 'type': 'number', 'expr': true, 'default': 0 }, - { 'name': 'text', 'type': 'field' }, - { 'name': 'spiral', 'type': 'string', 'values': ['archimedean', 'rectangular'] }, - { 'name': 'padding', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 7, 'default': Output } - ] -}; - -var prototype = inherits(Wordcloud, Transform); - -prototype.transform = function(_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) { - error('Wordcloud size dimensions must be non-zero.'); - } - - function modp(param) { - var p = _[param]; - return isFunction(p) && pulse.modified(p.fields); - } - - var mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || Params.some(modp))) return; - - var data = pulse.materialize(pulse.SOURCE).source, - layout = this.value, - as = _.as || Output, - fontSize = _.fontSize || 14, - range; - - isFunction(fontSize) - ? (range = _.fontSizeRange) - : (fontSize = constant(fontSize)); - - // create font size scaling function as needed - if (range) { - var fsize = fontSize, - sizeScale = scale('sqrt')() - .domain(extent(data, fsize)) - .range(range); - fontSize = function(x) { return sizeScale(fsize(x)); }; - } - - data.forEach(function(t) { - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); - - // configure layout - var words = layout - .words(data) - .text(_.text) - .size(_.size || [500, 500]) - .padding(_.padding || 1) - .spiral(_.spiral || 'archimedean') - .rotate(_.rotate || 0) - .font(_.font || 'sans-serif') - .fontStyle(_.fontStyle || 'normal') - .fontWeight(_.fontWeight || 'normal') - .fontSize(fontSize) - .random(random) - .layout(); - - var size = layout.size(), - dx = size[0] >> 1, - dy = size[1] >> 1, - i = 0, - n = words.length, - w, t; - - for (; i - - -Vega Examples - - -**Vega** is a *visualization grammar*, a declarative format for creating, saving, and sharing interactive visualization designs. With Vega you can describe data visualizations in a JSON format, and generate interactive views using either HTML5 Canvas or SVG. - -For documentation, tutorials, and examples, see the [Vega website](https://vega.github.io/vega). For a description of changes between Vega 2 and later versions, please refer to the [Vega Porting Guide](https://vega.github.io/vega/docs/porting-guide/). - -## Install - -Use npm or yarn to install Vega for use in third-party libraries or applications. - -Using npm: - -```sh -npm install vega -``` - -or using yarn: - -```sh -yarn add vega -``` - -If you would like to install the Vega command line utilities (`vg2pdf`, `vg2png`, `vg2svg`), see the [`vega-cli` package](https://github.com/vega/vega/tree/master/packages/vega-cli). - -## Contributions, Development, and Support - -Interested in contributing to Vega? Please see our [contribution and development guidelines](CONTRIBUTING.md), subject to our [code of conduct](CODE_OF_CONDUCT.md). - -Looking for support, or interested in sharing examples and tips? Post to the [Vega discussion forum](https://groups.google.com/forum/#!forum/vega-js) or join the [Vega slack organization](https://bit.ly/join-vega-slack-2020)! - -Read about future plans in [our roadmap](https://docs.google.com/document/d/1fscSxSJtfkd1m027r1ONCc7O8RdZp1oGABwca2pgV_E/edit#). - -## Package Development - -This package builds the bundled Vega library files and the JSON schema. It also includes a high-level test suite. If performing local development: - -- Run `yarn build` to build both browser and node.js bundles. -- Run `yarn test` to run the test suite. diff --git a/node_modules/vega/build-es5/vega-core.js b/node_modules/vega/build-es5/vega-core.js deleted file mode 100644 index 7bebe12..0000000 --- a/node_modules/vega/build-es5/vega-core.js +++ /dev/null @@ -1,36547 +0,0 @@ -"use strict"; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e4) { throw _e4; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e5) { didErr = true; err = _e5; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -(function (global, factory) { - (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dsv'), require('topojson-client'), require('d3-format'), require('d3-time'), require('d3-time-format'), require('d3-shape'), require('d3-path'), require('d3-interpolate'), require('d3-geo'), require('d3-color'), require('d3-force'), require('d3-hierarchy'), require('d3-timer')) : typeof define === 'function' && define.amd ? define(['exports', 'd3-dsv', 'topojson-client', 'd3-format', 'd3-time', 'd3-time-format', 'd3-shape', 'd3-path', 'd3-interpolate', 'd3-geo', 'd3-color', 'd3-force', 'd3-hierarchy', 'd3-timer'], factory) : (global = global || self, factory(global.vega = {}, global.d3, global.topojson, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3)); -})(void 0, function (exports, d3Dsv, topojsonClient, d3Format, d3Time, d3TimeFormat, d3Shape, d3Path, $$1, d3Geo, d3Color, d3Force, d3Hierarchy, d3Timer) { - 'use strict'; - - var _defaultSpecifiers, _localGet, _localInv, _utcGet, _utcInv, _timeIntervals, _utcIntervals, _symbols$, _formats$; - - var _marked = /*#__PURE__*/regeneratorRuntime.mark(numbers), - _marked2 = /*#__PURE__*/regeneratorRuntime.mark(numbers$1), - _marked3 = /*#__PURE__*/regeneratorRuntime.mark(flatIterable); - - function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; - } - - function accessorName(fn) { - return fn == null ? null : fn.fname; - } - - function accessorFields(fn) { - return fn == null ? null : fn.fields; - } - - function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); - } - - var get1 = function get1(field) { - return function (obj) { - return obj[field]; - }; - }; - - var getN = function getN(path) { - var len = path.length; - return function (obj) { - for (var i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - - return obj; - }; - }; - - function error(message) { - throw Error(message); - } - - function splitAccessPath(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, - j, - c; - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i = j = 0; j < n; ++j) { - c = p[j]; - - if (c === '\\') { - s += p.substring(i, j); - s += p.substring(++j, ++j); - i = j; - } else if (c === q) { - push(); - q = null; - b = -1; - } else if (q) { - continue; - } else if (i === b && c === '"') { - i = j + 1; - q = c; - } else if (i === b && c === "'") { - i = j + 1; - q = c; - } else if (c === '.' && !b) { - if (j > i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; - } - - function field(field, name, opt) { - var path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor((opt && opt.get || getter)(path), [field], name || field); - } - - var empty = []; - var id = field('id'); - var identity = accessor(function (_) { - return _; - }, empty, 'identity'); - var zero = accessor(function () { - return 0; - }, empty, 'zero'); - var one = accessor(function () { - return 1; - }, empty, 'one'); - var truthy = accessor(function () { - return true; - }, empty, 'true'); - var falsy = accessor(function () { - return false; - }, empty, 'false'); - - function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console - } - - var None = 0; - var Error$1 = 1; - var Warn = 2; - var Info = 3; - var Debug = 4; - - function logger(_, method) { - var _level = _ || None; - - return { - level: function level(_) { - if (arguments.length) { - _level = +_; - return this; - } else { - return _level; - } - }, - error: function error() { - if (_level >= Error$1) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function warn() { - if (_level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function info() { - if (_level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function debug() { - if (_level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; - } - - var isArray = Array.isArray; - - function isObject(_) { - return _ === Object(_); - } - - var isLegalKey = function isLegalKey(key) { - return key !== '__proto__'; - }; - - function mergeConfig() { - for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) { - configs[_key] = arguments[_key]; - } - - return configs.reduce(function (out, source) { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? { - layout: 1 - } : key === 'style' ? true : null; - writeConfig(out, key, source[key], r); - } - } - - return out; - }, {}); - } - - function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - var k, o; - - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : output[key] = {}; - - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } - } - - function mergeNamed(a, b) { - if (a == null) return b; - var map = {}, - out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; - } - - function peek(array) { - return array[array.length - 1]; - } - - function toNumber(_) { - return _ == null || _ === '' ? null : +_; - } - - function exp(sign) { - return function (x) { - return sign * Math.exp(x); - }; - } - - function log$1(sign) { - return function (x) { - return Math.log(sign * x); - }; - } - - function symlog(c) { - return function (x) { - return Math.sign(x) * Math.log1p(Math.abs(x / c)); - }; - } - - function symexp(c) { - return function (x) { - return Math.sign(x) * Math.expm1(Math.abs(x)) * c; - }; - } - - function pow(exponent) { - return function (x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; - } - - function pan(domain, delta, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - dd = (d1 - d0) * delta; - return [ground(d0 - dd), ground(d1 - dd)]; - } - - function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); - } - - function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log$1(sign), exp(sign)); - } - - function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1 / exponent)); - } - - function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); - } - - function zoom(domain, anchor, scale, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)]; - } - - function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); - } - - function zoomLog(domain, anchor, scale) { - var sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log$1(sign), exp(sign)); - } - - function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent)); - } - - function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); - } - - function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); - } - - function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); - } - - function array(_) { - return _ != null ? isArray(_) ? _ : [_] : []; - } - /** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ - - - function clampRange(range, min, max) { - var lo = range[0], - hi = range[1], - span; - - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - - span = hi - lo; - return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span]; - } - - function isFunction(_) { - return typeof _ === 'function'; - } - - var DESCENDING = 'descending'; - - function compare(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - var ord = [], - get = [], - fmap = {}, - gen = opt.comparator || comparator; - array(fields).forEach(function (f, i) { - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach(function (_) { - return fmap[_] = 1; - }); - }); - return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap)); - } - - var compare$1 = function compare$1(u, v) { - return (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; - }; - - var comparator = function comparator(fields, orders) { - return fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); - }; - - var compare1 = function compare1(field, order) { - return function (a, b) { - return compare$1(field(a), field(b)) * order; - }; - }; - - var compareN = function compareN(fields, orders, n) { - orders.push(0); // pad zero for convenient lookup - - return function (a, b) { - var f, - c = 0, - i = -1; - - while (c === 0 && ++i < n) { - f = fields[i]; - c = compare$1(f(a), f(b)); - } - - return c * orders[i]; - }; - }; - - function constant(_) { - return isFunction(_) ? _ : function () { - return _; - }; - } - - function debounce(delay, handler) { - var tid, evt; - - function callback() { - handler(evt); - tid = evt = null; - } - - return function (e) { - evt = e; - if (tid) clearTimeout(tid); - tid = setTimeout(callback, delay); - }; - } - - function extend(_) { - for (var x, k, i = 1, len = arguments.length; i < len; ++i) { - x = arguments[i]; - - for (k in x) { - _[k] = x[k]; - } - } - - return _; - } - /** - * Return an array with minimum and maximum values, in the - * form [min, max]. Ignores null, undefined, and NaN values. - */ - - - function extent(array, f) { - var i = 0, - n, - v, - min, - max; - - if (array && (n = array.length)) { - if (f == null) { - // find first valid value - for (v = array[i]; i < n && (v == null || v !== v); v = array[++i]) { - ; - } - - min = max = v; // visit all other values - - for (; i < n; ++i) { - v = array[i]; // skip null/undefined; NaN will fail all comparisons - - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } else { - // find first valid value - for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])) { - ; - } - - min = max = v; // visit all other values - - for (; i < n; ++i) { - v = f(array[i]); // skip null/undefined; NaN will fail all comparisons - - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } - } - - return [min, max]; - } - - function extentIndex(array, f) { - var i = -1, - n = array.length, - a, - b, - c, - u, - v; - - if (f == null) { - while (++i < n) { - b = array[i]; - - if (b != null && b >= b) { - a = c = b; - break; - } - } - - if (i === n) return [-1, -1]; - u = v = i; - - while (++i < n) { - b = array[i]; - - if (b != null) { - if (a > b) { - a = b; - u = i; - } - - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while (++i < n) { - b = f(array[i], i, array); - - if (b != null && b >= b) { - a = c = b; - break; - } - } - - if (i === n) return [-1, -1]; - u = v = i; - - while (++i < n) { - b = f(array[i], i, array); - - if (b != null) { - if (a > b) { - a = b; - u = i; - } - - if (c < b) { - c = b; - v = i; - } - } - } - } - - return [u, v]; - } - - var hop = Object.prototype.hasOwnProperty; - - function hasOwnProperty(object, property) { - return hop.call(object, property); - } - - var NULL = {}; - - function fastmap(input) { - var obj = {}, - map, - _test; - - function has(key) { - return hasOwnProperty(obj, key) && obj[key] !== NULL; - } - - map = { - size: 0, - empty: 0, - object: obj, - has: has, - get: function get(key) { - return has(key) ? obj[key] : undefined; - }, - set: function set(key, value) { - if (!has(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - - obj[key] = value; - return this; - }, - delete: function _delete(key) { - if (has(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - - return this; - }, - clear: function clear() { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test: function test(_) { - if (arguments.length) { - _test = _; - return map; - } else { - return _test; - } - }, - clean: function clean() { - var next = {}, - size = 0, - key, - value; - - for (key in obj) { - value = obj[key]; - - if (value !== NULL && (!_test || !_test(value))) { - next[key] = value; - ++size; - } - } - - map.size = size; - map.empty = 0; - map.object = obj = next; - } - }; - if (input) Object.keys(input).forEach(function (key) { - map.set(key, input[key]); - }); - return map; - } - - function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - var a = range[0], - b = peek(range), - t = +threshold, - l, - r; // swap endpoints if range is reversed - - if (b < a) { - l = a; - a = b; - b = l; - } // compare value to endpoints - - - l = Math.abs(value - a); - r = Math.abs(b - value); // adjust if value is within threshold distance of endpoint - - return l < r && l <= t ? left : r <= t ? right : center; - } - - function inherits(child, parent) { - var proto = child.prototype = Object.create(parent.prototype); - proto.constructor = child; - return proto; - } - /** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ - - - function inrange(value, range, left, right) { - var r0 = range[0], - r1 = range[range.length - 1], - t; - - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - - left = left === undefined || left; - right = right === undefined || right; - return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1); - } - - function isBoolean(_) { - return typeof _ === 'boolean'; - } - - function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; - } - - function isNumber(_) { - return typeof _ === 'number'; - } - - function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; - } - - function isString(_) { - return typeof _ === 'string'; - } - - function key(fields, flat, opt) { - if (fields) { - fields = flat ? array(fields).map(function (f) { - return f.replace(/\\(.)/g, '$1'); - }) : array(fields); - } - - var len = fields && fields.length, - gen = opt && opt.get || getter, - map = function map(f) { - return gen(flat ? [f] : splitAccessPath(f)); - }; - - var fn; - - if (!len) { - fn = function fn() { - return ''; - }; - } else if (len === 1) { - var _get = map(fields[0]); - - fn = function fn(_) { - return '' + _get(_); - }; - } else { - var _get2 = fields.map(map); - - fn = function fn(_) { - var s = '' + _get2[0](_), - i = 0; - - while (++i < len) { - s += '|' + _get2[i](_); - } - - return s; - }; - } - - return accessor(fn, fields, 'key'); - } - - function lerp(array, frac) { - var lo = array[0], - hi = peek(array), - f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); - } - - var DEFAULT_MAX_SIZE = 10000; // adapted from https://github.com/dominictarr/hashlru/ (MIT License) - - function lruCache(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - var curr, prev, size; - - var clear = function clear() { - curr = {}; - prev = {}; - size = 0; - }; - - var update = function update(key, value) { - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - - return curr[key] = value; - }; - - clear(); - return { - clear: clear, - has: function has(key) { - return hasOwnProperty(curr, key) || hasOwnProperty(prev, key); - }, - get: function get(key) { - return hasOwnProperty(curr, key) ? curr[key] : hasOwnProperty(prev, key) ? update(key, prev[key]) : undefined; - }, - set: function set(key, value) { - return hasOwnProperty(curr, key) ? curr[key] = value : update(key, value); - } - }; - } - - function merge(compare, array0, array1, output) { - var n0 = array0.length, - n1 = array1.length; - if (!n1) return array0; - if (!n0) return array1; - var merged = output || new array0.constructor(n0 + n1), - i0 = 0, - i1 = 0, - i = 0; - - for (; i0 < n0 && i1 < n1; ++i) { - merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; - } - - for (; i0 < n0; ++i0, ++i) { - merged[i] = array0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - merged[i] = array1[i1]; - } - - return merged; - } - - function repeat(str, reps) { - var s = ''; - - while (--reps >= 0) { - s += str; - } - - return s; - } - - function pad(str, length, padchar, align) { - var c = padchar || ' ', - s = str + '', - n = length - s.length; - return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n); - } - /** - * Return the numerical span of an array: the difference between - * the last and first values. - */ - - - function span(array) { - return array && peek(array) - array[0] || 0; - } - - function $(x) { - return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace("\u2028", "\\u2028").replace("\u2029", "\\u2029") : x; - } - - function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; - } - - function defaultParser(_) { - return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); - } - - function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); - } - - function toString(_) { - return _ == null || _ === '' ? null : _ + ''; - } - - function toSet(_) { - for (var s = {}, i = 0, n = _.length; i < n; ++i) { - s[_[i]] = true; - } - - return s; - } - - function truncate(str, length, align, ellipsis) { - var e = ellipsis != null ? ellipsis : "\u2026", - s = str + '', - n = s.length, - l = Math.max(0, length - e.length); - return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e; - } - - function visitArray(array, filter, visitor) { - if (array) { - if (filter) { - var i = 0, - n = array.length, - t; - - for (; i < n; ++i) { - if (t = filter(array[i])) visitor(t, i, array); - } - } else { - array.forEach(visitor); - } - } - } - - function UniqueList(idFunc) { - var $ = idFunc || identity, - list = [], - ids = {}; - - list.add = function (_) { - var id = $(_); - - if (!ids[id]) { - ids[id] = 1; - list.push(_); - } - - return list; - }; - - list.remove = function (_) { - var id = $(_), - idx; - - if (ids[id]) { - ids[id] = 0; - - if ((idx = list.indexOf(_)) >= 0) { - list.splice(idx, 1); - } - } - - return list; - }; - - return list; - } - /** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ - - - function asyncCallback(_x, _x2) { - return _asyncCallback.apply(this, arguments); - } - - function _asyncCallback() { - _asyncCallback = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(df, callback) { - return regeneratorRuntime.wrap(function _callee3$(_context10) { - while (1) { - switch (_context10.prev = _context10.next) { - case 0: - _context10.prev = 0; - _context10.next = 3; - return callback(df); - - case 3: - _context10.next = 8; - break; - - case 5: - _context10.prev = 5; - _context10.t0 = _context10["catch"](0); - df.error(_context10.t0); - - case 8: - case "end": - return _context10.stop(); - } - } - }, _callee3, null, [[0, 5]]); - })); - return _asyncCallback.apply(this, arguments); - } - - var TUPLE_ID_KEY = Symbol('vega_id'), - TUPLE_ID = 1; - /** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ - - function isTuple(t) { - return !!(t && tupleid(t)); - } - /** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ - - - function tupleid(t) { - return t[TUPLE_ID_KEY]; - } - /** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ - - - function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; - } - /** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ - - - function ingest(datum) { - var t = datum === Object(datum) ? datum : { - data: datum - }; - return tupleid(t) ? t : setid(t, TUPLE_ID++); - } - /** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ - - - function derive(t) { - return rederive(t, ingest({})); - } - /** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ - - - function rederive(t, d) { - for (var k in t) { - d[k] = t[k]; - } - - return d; - } - /** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ - - - function replace(t, d) { - return setid(d, tupleid(t)); - } - /** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ - - - function stableCompare(cmp, f) { - return !cmp ? null : f ? function (a, b) { - return cmp(a, b) || tupleid(f(a)) - tupleid(f(b)); - } : function (a, b) { - return cmp(a, b) || tupleid(a) - tupleid(b); - }; - } - - function isChangeSet(v) { - return v && v.constructor === changeset; - } - - function changeset() { - var add = [], - // insert tuples - rem = [], - // remove tuples - mod = [], - // modify tuples - remp = [], - // remove by predicate - modp = [], - // modify by predicate - _clean = null, - _reflow = false; - return { - constructor: changeset, - insert: function insert(t) { - var d = array(t), - i = 0, - n = d.length; - - for (; i < n; ++i) { - add.push(d[i]); - } - - return this; - }, - remove: function remove(t) { - var a = isFunction(t) ? remp : rem, - d = array(t), - i = 0, - n = d.length; - - for (; i < n; ++i) { - a.push(d[i]); - } - - return this; - }, - modify: function modify(t, field, value) { - var m = { - field: field, - value: constant(value) - }; - - if (isFunction(t)) { - m.filter = t; - modp.push(m); - } else { - m.tuple = t; - mod.push(m); - } - - return this; - }, - encode: function encode(t, set) { - if (isFunction(t)) modp.push({ - filter: t, - field: set - });else mod.push({ - tuple: t, - field: set - }); - return this; - }, - clean: function clean(value) { - _clean = value; - return this; - }, - reflow: function reflow() { - _reflow = true; - return this; - }, - pulse: function pulse(_pulse, tuples) { - var cur = {}, - out = {}, - i, - n, - m, - f, - t, - id; // build lookup table of current tuples - - for (i = 0, n = tuples.length; i < n; ++i) { - cur[tupleid(tuples[i])] = 1; - } // process individual tuples to remove - - - for (i = 0, n = rem.length; i < n; ++i) { - t = rem[i]; - cur[tupleid(t)] = -1; - } // process predicate-based removals - - - for (i = 0, n = remp.length; i < n; ++i) { - f = remp[i]; - tuples.forEach(function (t) { - if (f(t)) cur[tupleid(t)] = -1; - }); - } // process all add tuples - - - for (i = 0, n = add.length; i < n; ++i) { - t = add[i]; - id = tupleid(t); - - if (cur[id]) { - // tuple already resides in dataset - // if flagged for both add and remove, cancel - cur[id] = 1; - } else { - // tuple does not reside in dataset, add - _pulse.add.push(ingest(add[i])); - } - } // populate pulse rem list - - - for (i = 0, n = tuples.length; i < n; ++i) { - t = tuples[i]; - if (cur[tupleid(t)] < 0) _pulse.rem.push(t); - } // modify helper method - - - function modify(t, f, v) { - if (v) { - t[f] = v(t); - } else { - _pulse.encode = f; - } - - if (!_reflow) out[tupleid(t)] = t; - } // process individual tuples to modify - - - for (i = 0, n = mod.length; i < n; ++i) { - m = mod[i]; - t = m.tuple; - f = m.field; - id = cur[tupleid(t)]; - - if (id > 0) { - modify(t, f, m.value); - - _pulse.modifies(f); - } - } // process predicate-based modifications - - - for (i = 0, n = modp.length; i < n; ++i) { - m = modp[i]; - f = m.filter; - tuples.forEach(function (t) { - if (f(t) && cur[tupleid(t)] > 0) { - modify(t, m.field, m.value); - } - }); - - _pulse.modifies(m.field); - } // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - - - if (_reflow) { - _pulse.mod = rem.length || remp.length ? tuples.filter(function (t) { - return cur[tupleid(t)] > 0; - }) : tuples.slice(); - } else { - for (id in out) { - _pulse.mod.push(out[id]); - } - } // set pulse garbage collection request - - - if (_clean || _clean == null && (rem.length || remp.length)) { - _pulse.clean(true); - } - - return _pulse; - } - }; - } - - var CACHE = '_:mod:_'; - /** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ - - function Parameters() { - Object.defineProperty(this, CACHE, { - writable: true, - value: {} - }); - } - - var prototype = Parameters.prototype; - /** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ - - prototype.set = function (name, index, value, force) { - var o = this, - v = o[name], - mod = o[CACHE]; - - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = isArray(value) ? 1 + value.length : -1; - } - - return o; - }; - /** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ - - - prototype.modified = function (name, index) { - var mod = this[CACHE], - k; - - if (!arguments.length) { - for (k in mod) { - if (mod[k]) return true; - } - - return false; - } else if (isArray(name)) { - for (k = 0; k < name.length; ++k) { - if (mod[name[k]]) return true; - } - - return false; - } - - return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name]; - }; - /** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ - - - prototype.clear = function () { - this[CACHE] = {}; - return this; - }; - - var OP_ID = 0; - var PULSE = 'pulse'; - var NO_PARAMS = new Parameters(); // Boolean Flags - - var SKIP = 1, - MODIFIED = 2; - /** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ - - function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - - if (update) { - this._update = update; - } - - if (params) this.parameters(params, react); - } - - var prototype$1 = Operator.prototype; - /** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ - - prototype$1.targets = function () { - return this._targets || (this._targets = UniqueList(id)); - }; - /** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ - - - prototype$1.set = function (value) { - if (this.value !== value) { - this.value = value; - return 1; - } else { - return 0; - } - }; - - function flag(bit) { - return function (state) { - var f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? f | bit : f & ~bit; - return this; - }; - } - /** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ - - - prototype$1.skip = flag(SKIP); - /** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ - - prototype$1.modified = flag(MODIFIED); - /** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initiatal evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ - - prototype$1.parameters = function (params, react, initonly) { - react = react !== false; - var self = this, - argval = self._argval = self._argval || new Parameters(), - argops = self._argops = self._argops || [], - deps = [], - name, - value, - n, - i; - - function add(name, index, value) { - if (value instanceof Operator) { - if (value !== self) { - if (react) value.targets().add(self); - deps.push(value); - } - - argops.push({ - op: value, - name: name, - index: index - }); - } else { - argval.set(name, index, value); - } - } - - for (name in params) { - value = params[name]; - - if (name === PULSE) { - array(value).forEach(function (op) { - if (!(op instanceof Operator)) { - error('Pulse parameters must be operator instances.'); - } else if (op !== self) { - op.targets().add(self); - deps.push(op); - } - }); - self.source = value; - } else if (isArray(value)) { - argval.set(name, -1, Array(n = value.length)); - - for (i = 0; i < n; ++i) { - add(name, i, value[i]); - } - } else { - add(name, -1, value); - } - } - - this.marshall().clear(); // initialize values - - if (initonly) argops.initonly = true; - return deps; - }; - /** - * Internal method for marshalling parameter values. - * Visits each operator dependency to pull the latest value. - * @return {Parameters} A Parameters object to pass to the update function. - */ - - - prototype$1.marshall = function (stamp) { - var argval = this._argval || NO_PARAMS, - argops = this._argops, - item, - i, - n, - op, - mod; - - if (argops) { - for (i = 0, n = argops.length; i < n; ++i) { - item = argops[i]; - op = item.op; - mod = op.modified() && op.stamp === stamp; - argval.set(item.name, item.index, op.value, mod); - } - - if (argops.initonly) { - for (i = 0; i < n; ++i) { - item = argops[i]; - item.op.targets().remove(this); - } - - this._argops = null; - this._update = null; - } - } - - return argval; - }; - /** - * Detach this operator from the dataflow. - * Unregisters listeners on upstream dependencies. - */ - - - prototype$1.detach = function () { - var argops = this._argops, - i, - n, - item, - op; - - if (argops) { - for (i = 0, n = argops.length; i < n; ++i) { - item = argops[i]; - op = item.op; - - if (op._targets) { - op._targets.remove(this); - } - } - } - }; - /** - * Delegate method to perform operator processing. - * Subclasses can override this method to perform custom processing. - * By default, it marshalls parameters and calls the update function - * if that function is defined. If the update function does not - * change the operator value then StopPropagation is returned. - * If no update function is defined, this method does nothing. - * @param {Pulse} pulse - the current dataflow pulse. - * @return The output pulse or StopPropagation. A falsy return value - * (including undefined) will let the input pulse pass through. - */ - - - prototype$1.evaluate = function (pulse) { - var update = this._update; - - if (update) { - var params = this.marshall(pulse.stamp), - v = update.call(this, params, pulse); - params.clear(); - - if (v !== this.value) { - this.value = v; - } else if (!this.modified()) { - return pulse.StopPropagation; - } - } - }; - /** - * Run this operator for the current pulse. If this operator has already - * been run at (or after) the pulse timestamp, returns StopPropagation. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ - - - prototype$1.run = function (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - var rv; - - if (this.skip()) { - this.skip(false); - rv = 0; - } else { - rv = this.evaluate(pulse); - } - - return this.pulse = rv || pulse; - }; - /** - * Add an operator to the dataflow graph. This function accepts a - * variety of input argument types. The basic signature supports an - * initial value, update function and parameters. If the first parameter - * is an Operator instance, it will be added directly. If it is a - * constructor for an Operator subclass, a new instance will be instantiated. - * Otherwise, if the first parameter is a function instance, it will be used - * as the update function and a null initial value is assumed. - * @param {*} init - One of: the operator to add, the initial value of - * the operator, an operator class to instantiate, or an update function. - * @param {function} [update] - The operator update function. - * @param {object} [params] - The operator parameters. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @return {Operator} - The added operator. - */ - - - function add(init, update, params, react) { - var shift = 1, - op; - - if (init instanceof Operator) { - op = init; - } else if (init && init.prototype instanceof Operator) { - op = new init(); - } else if (isFunction(init)) { - op = new Operator(null, init); - } else { - shift = 0; - op = new Operator(init, update); - } - - this.rank(op); - - if (shift) { - react = params; - params = update; - } - - if (params) this.connect(op, op.parameters(params, react)); - this.touch(op); - return op; - } - /** - * Connect a target operator as a dependent of source operators. - * If necessary, this method will rerank the target operator and its - * dependents to ensure propagation proceeds in a topologically sorted order. - * @param {Operator} target - The target operator. - * @param {Array} - The source operators that should propagate - * to the target operator. - */ - - - function connect(target, sources) { - var targetRank = target.rank, - i, - n; - - for (i = 0, n = sources.length; i < n; ++i) { - if (targetRank < sources[i].rank) { - this.rerank(target); - return; - } - } - } - - var STREAM_ID = 0; - /** - * Models an event stream. - * @constructor - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @param {function(Object)} [receive] - Event callback function to invoke - * upon receipt of a new event. Use to override standard event processing. - */ - - function EventStream(filter, apply, receive) { - this.id = ++STREAM_ID; - this.value = null; - if (receive) this.receive = receive; - if (filter) this._filter = filter; - if (apply) this._apply = apply; - } - /** - * Creates a new event stream instance with the provided - * (optional) filter, apply and receive functions. - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @see EventStream - */ - - - function stream(filter, apply, receive) { - return new EventStream(filter, apply, receive); - } - - var prototype$2 = EventStream.prototype; - prototype$2._filter = truthy; - prototype$2._apply = identity; - - prototype$2.targets = function () { - return this._targets || (this._targets = UniqueList(id)); - }; - - prototype$2.consume = function (_) { - if (!arguments.length) return !!this._consume; - this._consume = !!_; - return this; - }; - - prototype$2.receive = function (evt) { - if (this._filter(evt)) { - var val = this.value = this._apply(evt), - trg = this._targets, - n = trg ? trg.length : 0, - i = 0; - - for (; i < n; ++i) { - trg[i].receive(val); - } - - if (this._consume) { - evt.preventDefault(); - evt.stopPropagation(); - } - } - }; - - prototype$2.filter = function (filter) { - var s = stream(filter); - this.targets().add(s); - return s; - }; - - prototype$2.apply = function (apply) { - var s = stream(null, apply); - this.targets().add(s); - return s; - }; - - prototype$2.merge = function () { - var s = stream(); - this.targets().add(s); - - for (var i = 0, n = arguments.length; i < n; ++i) { - arguments[i].targets().add(s); - } - - return s; - }; - - prototype$2.throttle = function (pause) { - var t = -1; - return this.filter(function () { - var now = Date.now(); - - if (now - t > pause) { - t = now; - return 1; - } else { - return 0; - } - }); - }; - - prototype$2.debounce = function (delay) { - var s = stream(); - this.targets().add(stream(null, null, debounce(delay, function (e) { - var df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }))); - return s; - }; - - prototype$2.between = function (a, b) { - var active = false; - a.targets().add(stream(null, null, function () { - active = true; - })); - b.targets().add(stream(null, null, function () { - active = false; - })); - return this.filter(function () { - return active; - }); - }; - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ - - - function events(source, type, filter, apply) { - var df = this, - s = stream(filter, apply), - send = function send(e) { - e.dataflow = df; - - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally { - df.run(); - } - }, - sources; - - if (typeof source === 'string' && typeof document !== 'undefined') { - sources = document.querySelectorAll(source); - } else { - sources = array(source); - } - - for (var i = 0, n = sources.length; i < n; ++i) { - sources[i].addEventListener(type, send); - } - - return s; - } // Matches absolute URLs with optional protocol - // https://... file://... //... - - - var protocol_re = /^([A-Za-z]+:)?\/\//; // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// - - var allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape - - var whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex - // Special treatment in node.js for the file: protocol - - var fileProtocol = 'file://'; - /** - * Factory for a loader constructor that provides methods for requesting - * files from either the network or disk, and for sanitizing request URIs. - * @param {function} fetch - The Fetch API for HTTP network requests. - * If null or undefined, HTTP loading will be disabled. - * @param {object} fs - The file system interface for file loading. - * If null or undefined, local file loading will be disabled. - * @return {function} A loader constructor with the following signature: - * param {object} [options] - Optional default loading options to use. - * return {object} - A new loader instance. - */ - - function loaderFactory(fetch, fs) { - return function (options) { - return { - options: options || {}, - sanitize: sanitize, - load: load, - fileAccess: !!fs, - file: fileLoader(fs), - http: httpLoader(fetch) - }; - }; - } - /** - * Load an external resource, typically either from the web or from the local - * filesystem. This function uses {@link sanitize} to first sanitize the uri, - * then calls either {@link http} (for web requests) or {@link file} (for - * filesystem loading). - * @param {string} uri - The resource indicator (e.g., URL or filename). - * @param {object} [options] - Optional loading options. These options will - * override any existing default options. - * @return {Promise} - A promise that resolves to the loaded content. - */ - - - function load(_x3, _x4) { - return _load.apply(this, arguments); - } - /** - * URI sanitizer function. - * @param {string} uri - The uri (url or filename) to sanity check. - * @param {object} options - An options hash. - * @return {Promise} - A promise that resolves to an object containing - * sanitized uri data, or rejects it the input uri is deemed invalid. - * The properties of the resolved object are assumed to be - * valid attributes for an HTML 'a' tag. The sanitized uri *must* be - * provided by the 'href' property of the returned object. - */ - - - function _load() { - _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(uri, options) { - var opt, url; - return regeneratorRuntime.wrap(function _callee4$(_context11) { - while (1) { - switch (_context11.prev = _context11.next) { - case 0: - _context11.next = 2; - return this.sanitize(uri, options); - - case 2: - opt = _context11.sent; - url = opt.href; - return _context11.abrupt("return", opt.localFile ? this.file(url) : this.http(url, options)); - - case 5: - case "end": - return _context11.stop(); - } - } - }, _callee4, this); - })); - return _load.apply(this, arguments); - } - - function sanitize(_x5, _x6) { - return _sanitize.apply(this, arguments); - } - /** - * File system loader factory. - * @param {object} fs - The file system interface. - * @return {function} - A file loader with the following signature: - * param {string} filename - The file system path to load. - * param {string} filename - The file system path to load. - * return {Promise} A promise that resolves to the file contents. - */ - - - function _sanitize() { - _sanitize = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(uri, options) { - var fileAccess, result, isFile, loadFile, base, isAllowed, hasProtocol; - return regeneratorRuntime.wrap(function _callee5$(_context12) { - while (1) { - switch (_context12.prev = _context12.next) { - case 0: - options = extend({}, this.options, options); - fileAccess = this.fileAccess, result = { - href: null - }; - isAllowed = allowed_re.test(uri.replace(whitespace_re, '')); - - if (uri == null || typeof uri !== 'string' || !isAllowed) { - error('Sanitize failure, invalid URI: ' + $(uri)); - } - - hasProtocol = protocol_re.test(uri); // if relative url (no protocol/host), prepend baseURL - - if ((base = options.baseURL) && !hasProtocol) { - // Ensure that there is a slash between the baseURL (e.g. hostname) and url - if (!uri.startsWith('/') && base[base.length - 1] !== '/') { - uri = '/' + uri; - } - - uri = base + uri; - } // should we load from file system? - - - loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess; - - if (isFile) { - // strip file protocol - uri = uri.slice(fileProtocol.length); - } else if (uri.startsWith('//')) { - if (options.defaultProtocol === 'file') { - // if is file, strip protocol and set loadFile flag - uri = uri.slice(2); - loadFile = true; - } else { - // if relative protocol (starts with '//'), prepend default protocol - uri = (options.defaultProtocol || 'http') + ':' + uri; - } - } // set non-enumerable mode flag to indicate local file load - - - Object.defineProperty(result, 'localFile', { - value: !!loadFile - }); // set uri - - result.href = uri; // set default result target, if specified - - if (options.target) { - result.target = options.target + ''; - } // set default result rel, if specified (#1542) - - - if (options.rel) { - result.rel = options.rel + ''; - } // provide control over cross-origin image handling (#2238) - // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image - - - if (options.context === 'image' && options.crossOrigin) { - result.crossOrigin = options.crossOrigin + ''; - } // return - - - return _context12.abrupt("return", result); - - case 14: - case "end": - return _context12.stop(); - } - } - }, _callee5, this); - })); - return _sanitize.apply(this, arguments); - } - - function fileLoader(fs) { - return fs ? function (filename) { - return new Promise(function (accept, reject) { - fs.readFile(filename, function (error, data) { - if (error) reject(error);else accept(data); - }); - }); - } : fileReject; - } - /** - * Default file system loader that simply rejects. - */ - - - function fileReject() { - return _fileReject.apply(this, arguments); - } - /** - * HTTP request handler factory. - * @param {function} fetch - The Fetch API method. - * @return {function} - An http loader with the following signature: - * param {string} url - The url to request. - * param {object} options - An options hash. - * return {Promise} - A promise that resolves to the file contents. - */ - - - function _fileReject() { - _fileReject = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { - return regeneratorRuntime.wrap(function _callee6$(_context13) { - while (1) { - switch (_context13.prev = _context13.next) { - case 0: - error('No file system access.'); - - case 1: - case "end": - return _context13.stop(); - } - } - }, _callee6); - })); - return _fileReject.apply(this, arguments); - } - - function httpLoader(fetch) { - return fetch ? /*#__PURE__*/function () { - var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, options) { - var opt, type, response; - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - opt = extend({}, this.options.http, options); - type = options && options.response; - _context.next = 4; - return fetch(url, opt); - - case 4: - response = _context.sent; - return _context.abrupt("return", !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text()); - - case 6: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - return function (_x7, _x8) { - return _ref.apply(this, arguments); - }; - }() : httpReject; - } - /** - * Default http request handler that simply rejects. - */ - - - function httpReject() { - return _httpReject.apply(this, arguments); - } - - function _httpReject() { - _httpReject = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { - return regeneratorRuntime.wrap(function _callee7$(_context14) { - while (1) { - switch (_context14.prev = _context14.next) { - case 0: - error('No HTTP fetch method available.'); - - case 1: - case "end": - return _context14.stop(); - } - } - }, _callee7); - })); - return _httpReject.apply(this, arguments); - } - - var typeParsers = { - boolean: toBoolean, - integer: toNumber, - number: toNumber, - date: toDate, - string: toString, - unknown: identity - }; - var typeTests = [isBoolean$1, isInteger, isNumber$1, isDate$1]; - var typeList = ['boolean', 'integer', 'number', 'date']; - - function inferType(values, field) { - if (!values || !values.length) return 'unknown'; - var n = values.length, - m = typeTests.length, - a = typeTests.map(function (_, i) { - return i + 1; - }); - - for (var i = 0, t = 0, j, _value; i < n; ++i) { - _value = field ? values[i][field] : values[i]; - - for (j = 0; j < m; ++j) { - if (a[j] && isValid(_value) && !typeTests[j](_value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - } - - return typeList[a.reduce(function (u, v) { - return u === 0 ? v : u; - }, 0) - 1]; - } - - function inferTypes(data, fields) { - return fields.reduce(function (types, field) { - types[field] = inferType(data, field); - return types; - }, {}); - } // -- Type Checks ---- - - - function isValid(_) { - return _ != null && _ === _; - } - - function isBoolean$1(_) { - return _ === 'true' || _ === 'false' || _ === true || _ === false; - } - - function isDate$1(_) { - return !Number.isNaN(Date.parse(_)); - } - - function isNumber$1(_) { - return !Number.isNaN(+_) && !(_ instanceof Date); - } - - function isInteger(_) { - return isNumber$1(_) && Number.isInteger(+_); - } - - function delimitedFormat(delimiter) { - var parse = function parse(data, format) { - var delim = { - delimiter: delimiter - }; - return dsv(data, format ? extend(format, delim) : delim); - }; - - parse.responseType = 'text'; - return parse; - } - - function dsv(data, format) { - if (format.header) { - data = format.header.map($).join(format.delimiter) + '\n' + data; - } - - return d3Dsv.dsvFormat(format.delimiter).parse(data + ''); - } - - dsv.responseType = 'text'; - - function isBuffer(_) { - return typeof Buffer === 'function' && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; - } - - function json(data, format) { - var prop = format && format.property ? field(format.property) : identity; - return isObject(data) && !isBuffer(data) ? parseJSON(prop(data)) : prop(JSON.parse(data)); - } - - json.responseType = 'json'; - - function parseJSON(data, format) { - return format && format.copy ? JSON.parse(JSON.stringify(data)) : data; - } - - var filters = { - interior: function interior(a, b) { - return a !== b; - }, - exterior: function exterior(a, b) { - return a === b; - } - }; - - function topojson(data, format) { - var method, object, property, filter; - data = json(data, format); - - if (format && format.feature) { - method = topojsonClient.feature; - property = format.feature; - } else if (format && format.mesh) { - method = topojsonClient.mesh; - property = format.mesh; - filter = filters[format.filter]; - } else { - error('Missing TopoJSON feature or mesh parameter.'); - } - - object = (object = data.objects[property]) ? method(data, object, filter) : error('Invalid TopoJSON object: ' + property); - return object && object.features || [object]; - } - - topojson.responseType = 'json'; - var format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson - }; - - function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else { - return hasOwnProperty(format, name) ? format[name] : null; - } - } - - function responseType(type) { - var f = formats(type); - return f && f.responseType || 'text'; - } - - function memoize(method) { - var cache = {}; - return function (spec) { - return cache[spec] || (cache[spec] = method(spec)); - }; - } - - function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; - } - - function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function left(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 right(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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; - } - }; - } - - function ascendingComparator(f) { - return function (d, x) { - return ascending(f(d), x); - }; - } - - var ascendingBisect = bisector(ascending); - var bisectRight = ascendingBisect.right; - var bisectLeft = ascendingBisect.left; - - function variance(values, valueof) { - var count = 0; - var delta; - var mean = 0; - var sum = 0; - - if (valueof === undefined) { - var _iterator = _createForOfIteratorHelper(values), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var _value2 = _step.value; - - if (_value2 != null && (_value2 = +_value2) >= _value2) { - delta = _value2 - mean; - mean += delta / ++count; - sum += delta * (_value2 - mean); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } else { - var _index = -1; - - var _iterator2 = _createForOfIteratorHelper(values), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var _value3 = _step2.value; - - if ((_value3 = valueof(_value3, ++_index, values)) != null && (_value3 = +_value3) >= _value3) { - delta = _value3 - mean; - mean += delta / ++count; - sum += delta * (_value3 - mean); - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - - if (count > 1) return sum / (count - 1); - } - - function deviation(values, valueof) { - var v = variance(values, valueof); - return v ? Math.sqrt(v) : v; - } - - function sequence(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; - } - - var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - - function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - - while (++i < n) { - ticks[i] = (start + i) * step; - } - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - - while (++i < n) { - ticks[i] = (start - i) / step; - } - } - - if (reverse) ticks.reverse(); - return ticks; - } - - function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); - } - - function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10;else if (error >= e5) step1 *= 5;else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; - } - - function max(values, valueof) { - var max; - - if (valueof === undefined) { - var _iterator3 = _createForOfIteratorHelper(values), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var _value4 = _step3.value; - - if (_value4 != null && (max < _value4 || max === undefined && _value4 >= _value4)) { - max = _value4; - } - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - } else { - var _index2 = -1; - - var _iterator4 = _createForOfIteratorHelper(values), - _step4; - - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { - var _value5 = _step4.value; - - if ((_value5 = valueof(_value5, ++_index2, values)) != null && (max < _value5 || max === undefined && _value5 >= _value5)) { - max = _value5; - } - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - } - - return max; - } - - function min(values, valueof) { - var min; - - if (valueof === undefined) { - var _iterator5 = _createForOfIteratorHelper(values), - _step5; - - try { - for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { - var _value6 = _step5.value; - - if (_value6 != null && (min > _value6 || min === undefined && _value6 >= _value6)) { - min = _value6; - } - } - } catch (err) { - _iterator5.e(err); - } finally { - _iterator5.f(); - } - } else { - var _index3 = -1; - - var _iterator6 = _createForOfIteratorHelper(values), - _step6; - - try { - for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { - var _value7 = _step6.value; - - if ((_value7 = valueof(_value7, ++_index3, values)) != null && (min > _value7 || min === undefined && _value7 >= _value7)) { - min = _value7; - } - } - } catch (err) { - _iterator6.e(err); - } finally { - _iterator6.f(); - } - } - - return min; - } // Based on https://github.com/mourner/quickselect - // ISC license, Copyright 2018 Vladimir Agafonkin. - - - function quickselect(array, k) { - var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : array.length - 1; - var compare = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ascending; - - while (right > left) { - if (right - left > 600) { - var n = right - left + 1; - var m = k - left + 1; - var z = Math.log(n); - var s = 0.5 * Math.exp(2 * z / 3); - var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - - var t = array[k]; - var i = left; - var j = right; - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - - while (i < j) { - swap(array, i, j), ++i, --j; - - while (compare(array[i], t) < 0) { - ++i; - } - - while (compare(array[j], t) > 0) { - --j; - } - } - - if (compare(array[left], t) === 0) swap(array, left, j);else ++j, swap(array, j, right); - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - - return array; - } - - function swap(array, i, j) { - var t = array[i]; - array[i] = array[j]; - array[j] = t; - } - - function number(x) { - return x === null ? NaN : +x; - } - - function numbers(values, valueof) { - var _iterator7, _step7, _value8, _index4, _iterator8, _step8, _value9; - - return regeneratorRuntime.wrap(function numbers$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (!(valueof === undefined)) { - _context2.next = 21; - break; - } - - _iterator7 = _createForOfIteratorHelper(values); - _context2.prev = 2; - - _iterator7.s(); - - case 4: - if ((_step7 = _iterator7.n()).done) { - _context2.next = 11; - break; - } - - _value8 = _step7.value; - - if (!(_value8 != null && (_value8 = +_value8) >= _value8)) { - _context2.next = 9; - break; - } - - _context2.next = 9; - return _value8; - - case 9: - _context2.next = 4; - break; - - case 11: - _context2.next = 16; - break; - - case 13: - _context2.prev = 13; - _context2.t0 = _context2["catch"](2); - - _iterator7.e(_context2.t0); - - case 16: - _context2.prev = 16; - - _iterator7.f(); - - return _context2.finish(16); - - case 19: - _context2.next = 40; - break; - - case 21: - _index4 = -1; - _iterator8 = _createForOfIteratorHelper(values); - _context2.prev = 23; - - _iterator8.s(); - - case 25: - if ((_step8 = _iterator8.n()).done) { - _context2.next = 32; - break; - } - - _value9 = _step8.value; - - if (!((_value9 = valueof(_value9, ++_index4, values)) != null && (_value9 = +_value9) >= _value9)) { - _context2.next = 30; - break; - } - - _context2.next = 30; - return _value9; - - case 30: - _context2.next = 25; - break; - - case 32: - _context2.next = 37; - break; - - case 34: - _context2.prev = 34; - _context2.t1 = _context2["catch"](23); - - _iterator8.e(_context2.t1); - - case 37: - _context2.prev = 37; - - _iterator8.f(); - - return _context2.finish(37); - - case 40: - case "end": - return _context2.stop(); - } - } - }, _marked, null, [[2, 13, 16, 19], [23, 34, 37, 40]]); - } - - function quantile(values, p, valueof) { - values = Float64Array.from(numbers(values, valueof)); - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return min(values); - if (p >= 1) return max(values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), - value1 = min(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); - } - - function quantileSorted(values, p) { - var valueof = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : number; - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); - } - - function mean(values, valueof) { - var count = 0; - var sum = 0; - - if (valueof === undefined) { - var _iterator9 = _createForOfIteratorHelper(values), - _step9; - - try { - for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { - var _value10 = _step9.value; - - if (_value10 != null && (_value10 = +_value10) >= _value10) { - ++count, sum += _value10; - } - } - } catch (err) { - _iterator9.e(err); - } finally { - _iterator9.f(); - } - } else { - var _index5 = -1; - - var _iterator10 = _createForOfIteratorHelper(values), - _step10; - - try { - for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { - var _value11 = _step10.value; - - if ((_value11 = valueof(_value11, ++_index5, values)) != null && (_value11 = +_value11) >= _value11) { - ++count, sum += _value11; - } - } - } catch (err) { - _iterator10.e(err); - } finally { - _iterator10.f(); - } - } - - if (count) return sum / count; - } - - function median(values, valueof) { - return quantile(values, 0.5, valueof); - } - - function permute(source, keys) { - return Array.from(keys, function (key) { - return source[key]; - }); - } - - function sum(values, valueof) { - var sum = 0; - - if (valueof === undefined) { - var _iterator11 = _createForOfIteratorHelper(values), - _step11; - - try { - for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { - var _value12 = _step11.value; - - if (_value12 = +_value12) { - sum += _value12; - } - } - } catch (err) { - _iterator11.e(err); - } finally { - _iterator11.f(); - } - } else { - var _index6 = -1; - - var _iterator12 = _createForOfIteratorHelper(values), - _step12; - - try { - for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) { - var _value13 = _step12.value; - - if (_value13 = +valueof(_value13, ++_index6, values)) { - sum += _value13; - } - } - } catch (err) { - _iterator12.e(err); - } finally { - _iterator12.f(); - } - } - - return sum; - } - - function trimZeroes(numberFormat, decimalChar) { - return function (x) { - var str = numberFormat(x), - dec = str.indexOf(decimalChar), - idx, - end; - if (dec < 0) return str; - idx = rightmostDigit(str, dec); - end = idx < str.length ? str.slice(idx) : ''; - - while (--idx > dec) { - if (str[idx] !== '0') { - ++idx; - break; - } - } - - return str.slice(0, idx) + end; - }; - } - - function rightmostDigit(str, dec) { - var i = str.lastIndexOf('e'), - c; - if (i > 0) return i; - - for (i = str.length; --i > dec;) { - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit - } - } - - function numberLocale(locale) { - var format = memoize(locale.format), - formatPrefix = locale.formatPrefix; - return { - format: format, - formatPrefix: formatPrefix, - formatFloat: function formatFloat(spec) { - var s = d3Format.formatSpecifier(spec || ','); - - if (s.precision == null) { - s.precision = 12; - - switch (s.type) { - case '%': - s.precision -= 2; - break; - - case 'e': - s.precision -= 1; - break; - } - - return trimZeroes(format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else { - return format(s); - } - }, - formatSpan: function formatSpan(start, stop, count, specifier) { - specifier = d3Format.formatSpecifier(specifier == null ? ',f' : specifier); - var step = tickStep(start, stop, count), - value = Math.max(Math.abs(start), Math.abs(stop)); - var precision; - - if (specifier.precision == null) { - switch (specifier.type) { - case 's': - { - if (!isNaN(precision = d3Format.precisionPrefix(step, value))) { - specifier.precision = precision; - } - - return formatPrefix(specifier, value); - } - - case '': - case 'e': - case 'g': - case 'p': - case 'r': - { - if (!isNaN(precision = d3Format.precisionRound(step, value))) { - specifier.precision = precision - (specifier.type === 'e'); - } - - break; - } - - case 'f': - case '%': - { - if (!isNaN(precision = d3Format.precisionFixed(step))) { - specifier.precision = precision - (specifier.type === '%') * 2; - } - - break; - } - } - } - - return format(specifier); - } - }; - } - - var defaultNumberLocale; - resetNumberFormatDefaultLocale(); - - function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: d3Format.format, - formatPrefix: d3Format.formatPrefix - }); - } - - function numberFormatLocale(definition) { - return numberLocale(d3Format.formatLocale(definition)); - } - - function numberFormatDefaultLocale(definition) { - return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale; - } - - var YEAR = 'year'; - var QUARTER = 'quarter'; - var MONTH = 'month'; - var WEEK = 'week'; - var DATE = 'date'; - var DAY = 'day'; - var DAYOFYEAR = 'dayofyear'; - var HOURS = 'hours'; - var MINUTES = 'minutes'; - var SECONDS = 'seconds'; - var MILLISECONDS = 'milliseconds'; - var TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS]; - var UNITS = TIME_UNITS.reduce(function (o, u, i) { - return o[u] = 1 + i, o; - }, {}); - - function timeUnits(units) { - var u = array(units).slice(), - m = {}; // check validity - - if (!u.length) error('Missing time unit.'); - u.forEach(function (unit) { - if (hasOwnProperty(UNITS, unit)) { - m[unit] = 1; - } else { - error("Invalid time unit: ".concat(unit, ".")); - } - }); - var numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0); - - if (numTypes > 1) { - error("Incompatible time units: ".concat(units)); - } // ensure proper sort order - - - u.sort(function (a, b) { - return UNITS[a] - UNITS[b]; - }); - return u; - } - - var defaultSpecifiers = (_defaultSpecifiers = {}, _defineProperty(_defaultSpecifiers, YEAR, '%Y '), _defineProperty(_defaultSpecifiers, QUARTER, 'Q%q '), _defineProperty(_defaultSpecifiers, MONTH, '%b '), _defineProperty(_defaultSpecifiers, DATE, '%d '), _defineProperty(_defaultSpecifiers, WEEK, 'W%U '), _defineProperty(_defaultSpecifiers, DAY, '%a '), _defineProperty(_defaultSpecifiers, DAYOFYEAR, '%j '), _defineProperty(_defaultSpecifiers, HOURS, '%H:00'), _defineProperty(_defaultSpecifiers, MINUTES, '00:%M'), _defineProperty(_defaultSpecifiers, SECONDS, ':%S'), _defineProperty(_defaultSpecifiers, MILLISECONDS, '.%L'), _defineProperty(_defaultSpecifiers, "".concat(YEAR, "-").concat(MONTH), '%Y-%m '), _defineProperty(_defaultSpecifiers, "".concat(YEAR, "-").concat(MONTH, "-").concat(DATE), '%Y-%m-%d '), _defineProperty(_defaultSpecifiers, "".concat(HOURS, "-").concat(MINUTES), '%H:%M'), _defaultSpecifiers); - - function timeUnitSpecifier(units, specifiers) { - var s = extend({}, defaultSpecifiers, specifiers), - u = timeUnits(units), - n = u.length; - var fmt = '', - start = 0, - end, - key; - - for (start = 0; start < n;) { - for (end = u.length; end > start; --end) { - key = u.slice(start, end).join('-'); - - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - } - - return fmt.trim(); - } - - var t0 = new Date(); - - function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; - } - - function dayofyear(d) { - return localDayOfYear(new Date(d)); - } - - function week(d) { - return localWeekNum(new Date(d)); - } - - function localDayOfYear(d) { - return d3Time.timeDay.count(localYear(d.getFullYear()) - 1, d); - } - - function localWeekNum(d) { - return d3Time.timeWeek.count(localYear(d.getFullYear()) - 1, d); - } - - function localFirst(y) { - return localYear(y).getDay(); - } - - function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - - return new Date(y, m, d, H, M, S, L); - } - - function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); - } - - function utcweek(d) { - return utcWeekNum(new Date(d)); - } - - function utcDayOfYear(d) { - var y = Date.UTC(d.getUTCFullYear(), 0, 1); - return d3Time.utcDay.count(y - 1, d); - } - - function utcWeekNum(d) { - var y = Date.UTC(d.getUTCFullYear(), 0, 1); - return d3Time.utcWeek.count(y - 1, d); - } - - function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); - } - - function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - - return new Date(Date.UTC(y, m, d, H, M, S, L)); - } - - function floor(units, step, get, inv, newDate) { - var s = step || 1, - b = peek(units), - _ = function _(unit, p, key) { - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - - var t = new Date(), - u = toSet(units), - y = u[YEAR] ? _(YEAR) : constant(2012), - m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : zero, - d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one, - H = u[HOURS] ? _(HOURS) : zero, - M = u[MINUTES] ? _(MINUTES) : zero, - S = u[SECONDS] ? _(SECONDS) : zero, - L = u[MILLISECONDS] ? _(MILLISECONDS) : zero; - return function (v) { - t.setTime(+v); - var year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; - } - - function getUnit(f, inv, step, phase) { - var u = step <= 1 ? f : phase ? function (d, y) { - return phase + step * Math.floor((f(d, y) - phase) / step); - } : function (d, y) { - return step * Math.floor(f(d, y) / step); - }; - return inv ? function (d, y) { - return inv(u(d, y), y); - } : u; - } // returns the day of the year based on week number, day of week, - // and the day of the week for the first day of the year - - - function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; - } // -- LOCAL TIME -- - - - var localGet = (_localGet = {}, _defineProperty(_localGet, YEAR, function (d) { - return d.getFullYear(); - }), _defineProperty(_localGet, QUARTER, function (d) { - return Math.floor(d.getMonth() / 3); - }), _defineProperty(_localGet, MONTH, function (d) { - return d.getMonth(); - }), _defineProperty(_localGet, DATE, function (d) { - return d.getDate(); - }), _defineProperty(_localGet, HOURS, function (d) { - return d.getHours(); - }), _defineProperty(_localGet, MINUTES, function (d) { - return d.getMinutes(); - }), _defineProperty(_localGet, SECONDS, function (d) { - return d.getSeconds(); - }), _defineProperty(_localGet, MILLISECONDS, function (d) { - return d.getMilliseconds(); - }), _defineProperty(_localGet, DAYOFYEAR, function (d) { - return localDayOfYear(d); - }), _defineProperty(_localGet, WEEK, function (d) { - return localWeekNum(d); - }), _defineProperty(_localGet, WEEK + DAY, function (d, y) { - return weekday(localWeekNum(d), d.getDay(), localFirst(y)); - }), _defineProperty(_localGet, DAY, function (d, y) { - return weekday(1, d.getDay(), localFirst(y)); - }), _localGet); - var localInv = (_localInv = {}, _defineProperty(_localInv, QUARTER, function (q) { - return 3 * q; - }), _defineProperty(_localInv, WEEK, function (w, y) { - return weekday(w, 0, localFirst(y)); - }), _localInv); - - function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); - } // -- UTC TIME -- - - - var utcGet = (_utcGet = {}, _defineProperty(_utcGet, YEAR, function (d) { - return d.getUTCFullYear(); - }), _defineProperty(_utcGet, QUARTER, function (d) { - return Math.floor(d.getUTCMonth() / 3); - }), _defineProperty(_utcGet, MONTH, function (d) { - return d.getUTCMonth(); - }), _defineProperty(_utcGet, DATE, function (d) { - return d.getUTCDate(); - }), _defineProperty(_utcGet, HOURS, function (d) { - return d.getUTCHours(); - }), _defineProperty(_utcGet, MINUTES, function (d) { - return d.getUTCMinutes(); - }), _defineProperty(_utcGet, SECONDS, function (d) { - return d.getUTCSeconds(); - }), _defineProperty(_utcGet, MILLISECONDS, function (d) { - return d.getUTCMilliseconds(); - }), _defineProperty(_utcGet, DAYOFYEAR, function (d) { - return utcDayOfYear(d); - }), _defineProperty(_utcGet, WEEK, function (d) { - return utcWeekNum(d); - }), _defineProperty(_utcGet, DAY, function (d, y) { - return weekday(1, d.getUTCDay(), utcFirst(y)); - }), _defineProperty(_utcGet, WEEK + DAY, function (d, y) { - return weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)); - }), _utcGet); - var utcInv = (_utcInv = {}, _defineProperty(_utcInv, QUARTER, function (q) { - return 3 * q; - }), _defineProperty(_utcInv, WEEK, function (w, y) { - return weekday(w, 0, utcFirst(y)); - }), _utcInv); - - function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); - } - - var timeIntervals = (_timeIntervals = {}, _defineProperty(_timeIntervals, YEAR, d3Time.timeYear), _defineProperty(_timeIntervals, QUARTER, d3Time.timeMonth.every(3)), _defineProperty(_timeIntervals, MONTH, d3Time.timeMonth), _defineProperty(_timeIntervals, WEEK, d3Time.timeWeek), _defineProperty(_timeIntervals, DATE, d3Time.timeDay), _defineProperty(_timeIntervals, DAY, d3Time.timeDay), _defineProperty(_timeIntervals, DAYOFYEAR, d3Time.timeDay), _defineProperty(_timeIntervals, HOURS, d3Time.timeHour), _defineProperty(_timeIntervals, MINUTES, d3Time.timeMinute), _defineProperty(_timeIntervals, SECONDS, d3Time.timeSecond), _defineProperty(_timeIntervals, MILLISECONDS, d3Time.timeMillisecond), _timeIntervals); - var utcIntervals = (_utcIntervals = {}, _defineProperty(_utcIntervals, YEAR, d3Time.utcYear), _defineProperty(_utcIntervals, QUARTER, d3Time.utcMonth.every(3)), _defineProperty(_utcIntervals, MONTH, d3Time.utcMonth), _defineProperty(_utcIntervals, WEEK, d3Time.utcWeek), _defineProperty(_utcIntervals, DATE, d3Time.utcDay), _defineProperty(_utcIntervals, DAY, d3Time.utcDay), _defineProperty(_utcIntervals, DAYOFYEAR, d3Time.utcDay), _defineProperty(_utcIntervals, HOURS, d3Time.utcHour), _defineProperty(_utcIntervals, MINUTES, d3Time.utcMinute), _defineProperty(_utcIntervals, SECONDS, d3Time.utcSecond), _defineProperty(_utcIntervals, MILLISECONDS, d3Time.utcMillisecond), _utcIntervals); - - function timeInterval(unit) { - return timeIntervals[unit]; - } - - function utcInterval(unit) { - return utcIntervals[unit]; - } - - function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; - } - - function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); - } - - function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); - } - - function sequence$1(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; - } - - function timeSequence(unit, start, stop, step) { - return sequence$1(timeInterval(unit), start, stop, step); - } - - function utcSequence(unit, start, stop, step) { - return sequence$1(utcInterval(unit), start, stop, step); - } - - var durationSecond = 1000, - durationMinute = durationSecond * 60, - durationHour = durationMinute * 60, - durationDay = durationHour * 24, - durationWeek = durationDay * 7, - durationMonth = durationDay * 30, - durationYear = durationDay * 365; - var Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], - Seconds = Milli.slice(0, -1), - Minutes = Seconds.slice(0, -1), - Hours = Minutes.slice(0, -1), - Day = Hours.slice(0, -1), - Week = [YEAR, WEEK], - Month = [YEAR, MONTH], - Year = [YEAR]; - var intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]]; - - function timeBin(opt) { - var ext = opt.extent, - max = opt.maxbins || 40, - target = Math.abs(span(ext)) / max; - var i = bisector(function (i) { - return i[2]; - }).right(intervals, target), - units, - step; - - if (i === intervals.length) { - units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max); - } else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max(tickStep(ext[0], ext[1], max), 1); - } - - return { - units: units, - step: step - }; - } - - function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - - if (!isObject(spec)) { - error("Invalid time multi-format specifier: ".concat(spec)); - } - - var second = interval(SECONDS), - minute = interval(MINUTES), - hour = interval(HOURS), - day = interval(DATE), - week = interval(WEEK), - month = interval(MONTH), - quarter = interval(QUARTER), - year = interval(YEAR), - L = format(spec[MILLISECONDS] || '.%L'), - S = format(spec[SECONDS] || ':%S'), - M = format(spec[MINUTES] || '%I:%M'), - H = format(spec[HOURS] || '%I %p'), - d = format(spec[DATE] || spec[DAY] || '%a %d'), - w = format(spec[WEEK] || '%b %d'), - m = format(spec[MONTH] || '%B'), - q = format(spec[QUARTER] || '%B'), - y = format(spec[YEAR] || '%Y'); - return function (date) { - return (second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date); - }; - } - - function timeLocale(locale) { - var _timeFormat = memoize(locale.format), - _utcFormat = memoize(locale.utcFormat); - - return { - timeFormat: function timeFormat(spec) { - return isString(spec) ? _timeFormat(spec) : timeMultiFormat(_timeFormat, timeInterval, spec); - }, - utcFormat: function utcFormat(spec) { - return isString(spec) ? _utcFormat(spec) : timeMultiFormat(_utcFormat, utcInterval, spec); - }, - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; - } - - var defaultTimeLocale; - resetTimeFormatDefaultLocale(); - - function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: d3TimeFormat.timeFormat, - parse: d3TimeFormat.timeParse, - utcFormat: d3TimeFormat.utcFormat, - utcParse: d3TimeFormat.utcParse - }); - } - - function timeFormatLocale(definition) { - return timeLocale(d3TimeFormat.timeFormatLocale(definition)); - } - - function timeFormatDefaultLocale(definition) { - return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale; - } - - var createLocale = function createLocale(number, time) { - return extend({}, number, time); - }; - - function locale(numberSpec, timeSpec) { - var number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); - var time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); - return createLocale(number, time); - } - - function defaultLocale(numberSpec, timeSpec) { - var args = arguments.length; - - if (args && args !== 2) { - error('defaultLocale expects either zero or two arguments.'); - } - - return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); - } - - function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); - } - - function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - var reader = formats(schema.type || 'json'); - if (!reader) error('Unknown data format type: ' + schema.type); - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - if (hasOwnProperty(data, 'columns')) delete data.columns; - return data; - } - - function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - - var locale = timeFormatDefaultLocale(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - var fields = data.columns || Object.keys(data[0]), - parsers, - datum, - field, - i, - j, - n, - m; - if (types === 'auto') types = inferTypes(data, fields); - fields = Object.keys(types); - parsers = fields.map(function (field) { - var type = types[field], - parts, - pattern; - - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - - pattern = parts[1]; - - if (pattern[0] === '\'' && pattern[pattern.length - 1] === '\'' || pattern[0] === '"' && pattern[pattern.length - 1] === '"') { - pattern = pattern.slice(1, -1); - } - - var _parse = parts[0] === 'utc' ? utcParser : timeParser; - - return _parse(pattern); - } - - if (!typeParsers[type]) { - throw Error('Illegal format pattern: ' + field + ':' + type); - } - - return typeParsers[type]; - }); - - for (i = 0, n = data.length, m = fields.length; i < n; ++i) { - datum = data[i]; - - for (j = 0; j < m; ++j) { - field = fields[j]; - datum[field] = parsers[j](datum[field]); - } - } - } - - var loader = loaderFactory(typeof fetch !== 'undefined' && fetch, // use built-in fetch API - null // no file system access - ); - - function parse$1(data, format) { - var locale = this.locale(); - return read(data, format, locale.timeParse, locale.utcParse); - } - /** - * Ingests new data into the dataflow. First parses the data using the - * vega-loader read method, then pulses a changeset to the target operator. - * @param {Operator} target - The Operator to target with ingested data, - * typically a Collect transform instance. - * @param {*} data - The input data, prior to parsing. For JSON this may - * be a string or an object. For CSV, TSV, etc should be a string. - * @param {object} format - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @returns {Dataflow} - */ - - - function ingest$1(target, data, format) { - data = this.parse(data, format); - return this.pulse(target, this.changeset().insert(data)); - } - /** - * Request data from an external source, parse it, and return a Promise. - * @param {string} url - The URL from which to load the data. This string - * is passed to the vega-loader load method. - * @param {object} [format] - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @return {Promise} A Promise that resolves upon completion of the request. - * The resolved object contains the following properties: - * - data: an array of parsed data (or null upon error) - * - status: a code for success (0), load fail (-1), or parse fail (-2) - */ - - - function request(_x9, _x10) { - return _request.apply(this, arguments); - } - - function _request() { - _request = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(url, format) { - var df, status, data; - return regeneratorRuntime.wrap(function _callee8$(_context15) { - while (1) { - switch (_context15.prev = _context15.next) { - case 0: - df = this; - status = 0; - _context15.prev = 2; - _context15.next = 5; - return df.loader().load(url, { - context: 'dataflow', - response: responseType(format && format.type) - }); - - case 5: - data = _context15.sent; - - try { - data = df.parse(data, format); - } catch (err) { - status = -2; - df.warn('Data ingestion failed', url, err); - } - - _context15.next = 13; - break; - - case 9: - _context15.prev = 9; - _context15.t0 = _context15["catch"](2); - status = -1; - df.warn('Loading failed', url, _context15.t0); - - case 13: - return _context15.abrupt("return", { - data: data, - status: status - }); - - case 14: - case "end": - return _context15.stop(); - } - } - }, _callee8, this, [[2, 9]]); - })); - return _request.apply(this, arguments); - } - - function preload(_x11, _x12, _x13) { - return _preload.apply(this, arguments); - } - - function _preload() { - _preload = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(target, url, format) { - var df, pending, res; - return regeneratorRuntime.wrap(function _callee9$(_context16) { - while (1) { - switch (_context16.prev = _context16.next) { - case 0: - df = this, pending = df._pending || loadPending(df); - pending.requests += 1; - _context16.next = 4; - return df.request(url, format); - - case 4: - res = _context16.sent; - df.pulse(target, df.changeset().remove(truthy).insert(res.data || [])); - pending.done(); - return _context16.abrupt("return", res); - - case 8: - case "end": - return _context16.stop(); - } - } - }, _callee9, this); - })); - return _preload.apply(this, arguments); - } - - function loadPending(df) { - var pending = new Promise(function (a) { - accept = a; - }), - accept; - pending.requests = 0; - - pending.done = function () { - if (--pending.requests === 0) { - df._pending = null; - accept(df); - } - }; - - return df._pending = pending; - } - - var SKIP$1 = { - skip: true - }; - /** - * Perform operator updates in response to events. Applies an - * update function to compute a new operator value. If the update function - * returns a {@link ChangeSet}, the operator will be pulsed with those tuple - * changes. Otherwise, the operator value will be updated to the return value. - * @param {EventStream|Operator} source - The event source to react to. - * This argument can be either an EventStream or an Operator. - * @param {Operator|function(object):Operator} target - The operator to update. - * This argument can either be an Operator instance or (if the source - * argument is an EventStream), a function that accepts an event object as - * input and returns an Operator to target. - * @param {function(Parameters,Event): *} [update] - Optional update function - * to compute the new operator value, or a literal value to set. Update - * functions expect to receive a parameter object and event as arguments. - * This function can either return a new operator value or (if the source - * argument is an EventStream) a {@link ChangeSet} instance to pulse - * the target operator with tuple changes. - * @param {object} [params] - The update function parameters. - * @param {object} [options] - Additional options hash. If not overridden, - * updated operators will be skipped by default. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @return {Dataflow} - */ - - function on(source, target, update, params, options) { - var fn = source instanceof Operator ? onOperator : onStream; - fn(this, source, target, update, params, options); - return this; - } - - function onStream(df, stream, target, update, params, options) { - var opt = extend({}, options, SKIP$1), - func, - op; - if (!isFunction(target)) target = constant(target); - - if (update === undefined) { - func = function func(e) { - return df.touch(target(e)); - }; - } else if (isFunction(update)) { - op = new Operator(null, update, params, false); - - func = function func(e) { - op.evaluate(e); - var t = target(e), - v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else { - func = function func(e) { - return df.update(target(e), update, opt); - }; - } - - stream.apply(func); - } - - function onOperator(df, source, target, update, params, options) { - if (update === undefined) { - source.targets().add(target); - } else { - var opt = options || {}, - op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - - source.targets().add(op); // add dependency - - if (target) { - op.skip(true); // skip first invocation - - op.value = target.value; // initialize value - - op.targets().add(target); // chain dependencies - - df.connect(target, [op]); // rerank as needed, #1672 - } - } - } - - function updater(target, update) { - update = isFunction(update) ? update : constant(update); - return target ? function (_, pulse) { - var value = update(_, pulse); - - if (!target.skip()) { - target.skip(value !== this.value).value = value; - } - - return value; - } : update; - } - /** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ - - - function rank(op) { - op.rank = ++this._rank; - } - /** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ - - - function rerank(op) { - var queue = [op], - cur, - list, - i; - - while (queue.length) { - this.rank(cur = queue.pop()); - - if (list = cur._targets) { - for (i = list.length; --i >= 0;) { - queue.push(cur = list[i]); - if (cur === op) error('Cycle detected in dataflow graph.'); - } - } - } - } - /** - * Sentinel value indicating pulse propagation should stop. - */ - - - var StopPropagation = {}; // Pulse visit type flags - - var ADD = 1 << 0, - REM = 1 << 1, - MOD = 1 << 2, - ADD_REM = ADD | REM, - ADD_MOD = ADD | MOD, - ALL = ADD | REM | MOD, - REFLOW = 1 << 3, - SOURCE = 1 << 4, - NO_SOURCE = 1 << 5, - NO_FIELDS = 1 << 6; - /** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ - - function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; - } - - var prototype$3 = Pulse.prototype; - /** - * Sentinel value indicating pulse propagation should stop. - */ - - prototype$3.StopPropagation = StopPropagation; - /** - * Boolean flag indicating ADD (added) tuples. - */ - - prototype$3.ADD = ADD; - /** - * Boolean flag indicating REM (removed) tuples. - */ - - prototype$3.REM = REM; - /** - * Boolean flag indicating MOD (modified) tuples. - */ - - prototype$3.MOD = MOD; - /** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ - - prototype$3.ADD_REM = ADD_REM; - /** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ - - prototype$3.ADD_MOD = ADD_MOD; - /** - * Boolean flag indicating ADD, REM and MOD tuples. - */ - - prototype$3.ALL = ALL; - /** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ - - prototype$3.REFLOW = REFLOW; - /** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ - - prototype$3.SOURCE = SOURCE; - /** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ - - prototype$3.NO_SOURCE = NO_SOURCE; - /** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ - - prototype$3.NO_FIELDS = NO_FIELDS; - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ - - prototype$3.fork = function (flags) { - return new Pulse(this.dataflow).init(this, flags); - }; - /** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ - - - prototype$3.clone = function () { - var p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); - }; - /** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ - - - prototype$3.addAll = function () { - var p = this; - - if (!p.source || p.source.length === p.add.length) { - return p; - } else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - return p; - } - }; - /** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ - - - prototype$3.init = function (src, flags) { - var p = this; - p.stamp = src.stamp; - p.encode = src.encode; - - if (src.fields && !(flags & NO_FIELDS)) { - p.fields = src.fields; - } - - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - - return p; - }; - /** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ - - - prototype$3.runAfter = function (func) { - this.dataflow.runAfter(func); - }; - /** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ - - - prototype$3.changed = function (flags) { - var f = flags || ALL; - return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length; - }; - /** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ - - - prototype$3.reflow = function (fork) { - if (fork) return this.fork(ALL).reflow(); - var len = this.add.length, - src = this.source && this.source.length; - - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); - } - - return this; - }; - /** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ - - - prototype$3.clean = function (value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else { - return this.cleans; - } - }; - /** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ - - - prototype$3.modifies = function (_) { - var hash = this.fields || (this.fields = {}); - - if (isArray(_)) { - _.forEach(function (f) { - return hash[f] = true; - }); - } else { - hash[_] = true; - } - - return this; - }; - /** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ - - - prototype$3.modified = function (_, nomod) { - var fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : isArray(_) ? _.some(function (f) { - return fields[f]; - }) : fields[_]; - }; - /** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ - - - prototype$3.filter = function (flags, filter) { - var p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; - }; - - function addFilter(a, b) { - return a ? function (t, i) { - return a(t, i) && b(t, i); - } : b; - } - /** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ - - - prototype$3.materialize = function (flags) { - flags = flags || ALL; - var p = this; - - if (flags & ADD && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - - if (flags & REM && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - - if (flags & MOD && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - - if (flags & SOURCE && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - - return p; - }; - - function materialize(data, filter) { - var out = []; - visitArray(data, filter, function (_) { - return out.push(_); - }); - return out; - } - - function filter(pulse, flags) { - var map = {}; - pulse.visit(flags, function (t) { - map[tupleid(t)] = 1; - }); - return function (t) { - return map[tupleid(t)] ? null : t; - }; - } - /** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ - - - prototype$3.visit = function (flags, visitor) { - var p = this, - v = visitor, - src, - sum; - - if (flags & SOURCE) { - visitArray(p.source, p.srcF, v); - return p; - } - - if (flags & ADD) visitArray(p.add, p.addF, v); - if (flags & REM) visitArray(p.rem, p.remF, v); - if (flags & MOD) visitArray(p.mod, p.modF, v); - - if (flags & REFLOW && (src = p.source)) { - sum = p.add.length + p.mod.length; - if (sum === src.length) ;else if (sum) { - visitArray(src, filter(p, ADD_MOD), v); - } else { - // if no add/rem/mod tuples, visit source - visitArray(src, p.srcF, v); - } - } - - return p; - }; - /** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array} pulses - The sub-pulses for this multi-pulse. - */ - - - function MultiPulse(dataflow, stamp, pulses, encode) { - var p = this, - c = 0, - pulse, - hash, - i, - n, - f; - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - - for (i = 0, n = pulses.length; i < n; ++i) { - pulse = pulses[i]; - if (pulse.stamp !== stamp) continue; - - if (pulse.fields) { - hash = p.fields || (p.fields = {}); - - for (f in pulse.fields) { - hash[f] = 1; - } - } - - if (pulse.changed(p.ADD)) c |= p.ADD; - if (pulse.changed(p.REM)) c |= p.REM; - if (pulse.changed(p.MOD)) c |= p.MOD; - } - - this.changes = c; - } - - var prototype$4 = inherits(MultiPulse, Pulse); - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - */ - - prototype$4.fork = function (flags) { - var p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); - - if (flags !== undefined) { - if (flags & p.ADD) { - this.visit(p.ADD, function (t) { - return p.add.push(t); - }); - } - - if (flags & p.REM) { - this.visit(p.REM, function (t) { - return p.rem.push(t); - }); - } - - if (flags & p.MOD) { - this.visit(p.MOD, function (t) { - return p.mod.push(t); - }); - } - } - - return p; - }; - - prototype$4.changed = function (flags) { - return this.changes & flags; - }; - - prototype$4.modified = function (_) { - var p = this, - fields = p.fields; - return !(fields && p.changes & p.MOD) ? 0 : isArray(_) ? _.some(function (f) { - return fields[f]; - }) : fields[_]; - }; - - prototype$4.filter = function () { - error('MultiPulse does not support filtering.'); - }; - - prototype$4.materialize = function () { - error('MultiPulse does not support materialization.'); - }; - - prototype$4.visit = function (flags, visitor) { - var p = this, - pulses = p.pulses, - n = pulses.length, - i = 0; - - if (flags & p.SOURCE) { - for (; i < n; ++i) { - pulses[i].visit(flags, visitor); - } - } else { - for (; i < n; ++i) { - if (pulses[i].stamp === p.stamp) { - pulses[i].visit(flags, visitor); - } - } - } - - return p; - }; - /* eslint-disable require-atomic-updates */ - - /** - * Evaluates the dataflow and returns a Promise that resolves when pulse - * propagation completes. This method will increment the current timestamp - * and process all updated, pulsed and touched operators. When invoked for - * the first time, all registered operators will be processed. This method - * should not be invoked by third-party clients, use {@link runAsync} or - * {@link run} instead. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ - - - function evaluate(_x14, _x15, _x16) { - return _evaluate.apply(this, arguments); - } - /** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ - - - function _evaluate() { - _evaluate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(encode, prerun, postrun) { - var df, async, stamp, count, op, next, error, pr, i; - return regeneratorRuntime.wrap(function _callee10$(_context17) { - while (1) { - switch (_context17.prev = _context17.next) { - case 0: - df = this, async = []; // if the pulse value is set, this is a re-entrant call - - if (!df._pulse) { - _context17.next = 3; - break; - } - - return _context17.abrupt("return", reentrant(df)); - - case 3: - if (!df._pending) { - _context17.next = 6; - break; - } - - _context17.next = 6; - return df._pending; - - case 6: - if (!prerun) { - _context17.next = 9; - break; - } - - _context17.next = 9; - return asyncCallback(df, prerun); - - case 9: - if (df._touched.length) { - _context17.next = 12; - break; - } - - df.debug('Dataflow invoked, but nothing to do.'); - return _context17.abrupt("return", df); - - case 12: - // increment timestamp clock - stamp = ++df._clock; // set the current pulse - - df._pulse = new Pulse(df, stamp, encode); // initialize priority queue, reset touched operators - - df._touched.forEach(function (op) { - return df._enqueue(op, true); - }); - - df._touched = UniqueList(id); - count = 0; - _context17.prev = 17; - - case 18: - if (!(df._heap.size() > 0)) { - _context17.next = 35; - break; - } - - // dequeue operator with highest priority - op = df._heap.pop(); // re-queue if rank changed - - if (!(op.rank !== op.qrank)) { - _context17.next = 23; - break; - } - - df._enqueue(op, true); - - return _context17.abrupt("continue", 18); - - case 23: - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - - if (!next.then) { - _context17.next = 30; - break; - } - - _context17.next = 27; - return next; - - case 27: - next = _context17.sent; - _context17.next = 31; - break; - - case 30: - if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - - case 31: - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach(function (op) { - return df._enqueue(op); - }); - } // increment visit counter - - - ++count; - _context17.next = 18; - break; - - case 35: - _context17.next = 41; - break; - - case 37: - _context17.prev = 37; - _context17.t0 = _context17["catch"](17); - - df._heap.clear(); - - error = _context17.t0; - - case 41: - // reset pulse map - df._input = {}; - df._pulse = null; - df.debug("Pulse ".concat(stamp, ": ").concat(count, " operators")); - - if (error) { - df._postrun = []; - df.error(error); - } // invoke callbacks queued via runAfter - - - if (!df._postrun.length) { - _context17.next = 55; - break; - } - - pr = df._postrun.sort(function (a, b) { - return b.priority - a.priority; - }); - df._postrun = []; - i = 0; - - case 49: - if (!(i < pr.length)) { - _context17.next = 55; - break; - } - - _context17.next = 52; - return asyncCallback(df, pr[i].callback); - - case 52: - ++i; - _context17.next = 49; - break; - - case 55: - if (!postrun) { - _context17.next = 58; - break; - } - - _context17.next = 58; - return asyncCallback(df, postrun); - - case 58: - // handle non-blocking asynchronous callbacks - if (async.length) { - Promise.all(async).then(function (cb) { - return df.runAsync(null, function () { - cb.forEach(function (f) { - try { - f(df); - } catch (err) { - df.error(err); - } - }); - }); - }); - } - - return _context17.abrupt("return", df); - - case 60: - case "end": - return _context17.stop(); - } - } - }, _callee10, this, [[17, 37]]); - })); - return _evaluate.apply(this, arguments); - } - - function runAsync(_x17, _x18, _x19) { - return _runAsync.apply(this, arguments); - } - /** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ - - - function _runAsync() { - _runAsync = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(encode, prerun, postrun) { - var _this18 = this; - - var clear; - return regeneratorRuntime.wrap(function _callee11$(_context18) { - while (1) { - switch (_context18.prev = _context18.next) { - case 0: - if (!this._running) { - _context18.next = 5; - break; - } - - _context18.next = 3; - return this._running; - - case 3: - _context18.next = 0; - break; - - case 5: - // run dataflow, manage running promise - clear = function clear() { - return _this18._running = null; - }; - - (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear); - return _context18.abrupt("return", this._running); - - case 8: - case "end": - return _context18.stop(); - } - } - }, _callee11, this); - })); - return _runAsync.apply(this, arguments); - } - - function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this); - } - /** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ - - - function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) { - // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - } else { - // pulse propagation already complete, invoke immediately - try { - callback(this); - } catch (err) { - this.error(err); - } - } - } - /** - * Raise an error for re-entrant dataflow evaluation. - */ - - - function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; - } - /** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ - - - function enqueue(op, force) { - var q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - - if (q || force) { - op.qrank = op.rank; - - this._heap.push(op); - } - } - /** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ - - - function getPulse(op, encode) { - var s = op.source, - stamp = this._clock; - return s && isArray(s) ? new MultiPulse(this, stamp, s.map(function (_) { - return _.pulse; - }), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); - } - - function singlePulse(p, s) { - if (s && s.stamp === p.stamp) { - return s; - } - - p = p.fork(); - - if (s && s !== StopPropagation) { - p.source = s.source; - } - - return p; - } - - var NO_OPT = { - skip: false, - force: false - }; - /** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - - function touch(op, options) { - var opt = options || NO_OPT; - - if (this._pulse) { - // if in midst of propagation, add to priority queue - this._enqueue(op); - } else { - // otherwise, queue for next propagation - this._touched.add(op); - } - - if (opt.skip) op.skip(true); - return this; - } - /** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - - - function update(op, value, options) { - var opt = options || NO_OPT; - - if (op.set(value) || opt.force) { - this.touch(op, opt); - } - - return this; - } - /** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - - - function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - var p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), - t = op.pulse && op.pulse.source || []; - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - return this; - } - - function Heap(cmp) { - var nodes = []; - return { - clear: function clear() { - return nodes = []; - }, - size: function size() { - return nodes.length; - }, - peek: function peek() { - return nodes[0]; - }, - push: function push(x) { - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: function pop() { - var last = nodes.pop(), - item; - - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else { - item = last; - } - - return item; - } - }; - } - - function siftdown(array, start, idx, cmp) { - var item, parent, pidx; - item = array[idx]; - - while (idx > start) { - pidx = idx - 1 >> 1; - parent = array[pidx]; - - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - - break; - } - - return array[idx] = item; - } - - function siftup(array, idx, cmp) { - var start = idx, - end = array.length, - item = array[idx], - cidx = (idx << 1) + 1, - ridx; - - while (cidx < end) { - ridx = cidx + 1; - - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) { - cidx = ridx; - } - - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - - array[idx] = item; - return siftdown(array, start, idx, cmp); - } - /** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ - - - function Dataflow() { - this.logger(logger()); - this.logLevel(Error$1); - this._clock = 0; - this._rank = 0; - this._locale = defaultLocale(); - - try { - this._loader = loader(); - } catch (e) {// do nothing if loader module is unavailable - } - - this._touched = UniqueList(id); - this._input = {}; - this._pulse = null; - this._heap = Heap(function (a, b) { - return a.qrank - b.qrank; - }); - this._postrun = []; - } - - var prototype$5 = Dataflow.prototype; - /** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ - - prototype$5.stamp = function () { - return this._clock; - }; - /** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ - - - prototype$5.loader = function (_) { - if (arguments.length) { - this._loader = _; - return this; - } else { - return this._loader; - } - }; - /** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ - - - prototype$5.locale = function (_) { - if (arguments.length) { - this._locale = _; - return this; - } else { - return this._locale; - } - }; - /** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ - - - prototype$5.cleanThreshold = 1e4; // OPERATOR REGISTRATION - - prototype$5.add = add; - prototype$5.connect = connect; - prototype$5.rank = rank; - prototype$5.rerank = rerank; // OPERATOR UPDATES - - prototype$5.pulse = pulse; - prototype$5.touch = touch; - prototype$5.update = update; - prototype$5.changeset = changeset; // DATA LOADING - - prototype$5.ingest = ingest$1; - prototype$5.parse = parse$1; - prototype$5.preload = preload; - prototype$5.request = request; // EVENT HANDLING - - prototype$5.events = events; - prototype$5.on = on; // PULSE PROPAGATION - - prototype$5.evaluate = evaluate; - prototype$5.run = run; - prototype$5.runAsync = runAsync; - prototype$5.runAfter = runAfter; - prototype$5._enqueue = enqueue; - prototype$5._getPulse = getPulse; // LOGGING AND ERROR HANDLING - - function logMethod(method) { - return function () { - return this._log[method].apply(this, arguments); - }; - } - /** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ - - - prototype$5.logger = function (logger) { - if (arguments.length) { - this._log = logger; - return this; - } else { - return this._log; - } - }; - /** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ - - - prototype$5.error = logMethod('error'); - /** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ - - prototype$5.warn = logMethod('warn'); - /** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ - - prototype$5.info = logMethod('info'); - /** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ - - prototype$5.debug = logMethod('debug'); - /** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ - - prototype$5.logLevel = logMethod('level'); - /** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ - - function Transform(init, params) { - Operator.call(this, init, null, params); - } - - var prototype$6 = inherits(Transform, Operator); - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ - - prototype$6.run = function (pulse) { - var _this = this; - - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - var rv; - - if (this.skip()) { - this.skip(false); - } else { - rv = this.evaluate(pulse); - } - - rv = rv || pulse; - - if (rv.then) { - rv = rv.then(function (_) { - return _this.pulse = _; - }); - } else if (rv !== pulse.StopPropagation) { - this.pulse = rv; - } - - return rv; - }; - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ - - - prototype$6.evaluate = function (pulse) { - var params = this.marshall(pulse.stamp), - out = this.transform(params, pulse); - params.clear(); - return out; - }; - /** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ - - - prototype$6.transform = function () {}; - - var transforms = {}; - - function definition(type) { - var t = transform(type); - return t && t.Definition || null; - } - - function transform(type) { - type = type && type.toLowerCase(); - return hasOwnProperty(transforms, type) ? transforms[type] : null; - } - - function multikey(f) { - return function (x) { - var n = f.length, - i = 1, - k = String(f[0](x)); - - for (; i < n; ++i) { - k += '|' + f[i](x); - } - - return k; - }; - } - - function groupkey(fields) { - return !fields || !fields.length ? function () { - return ''; - } : fields.length === 1 ? fields[0] : multikey(fields); - } - - function measureName(op, field, as) { - return as || op + (!field ? '' : '_' + field); - } - - var noop = function noop() {}; - - var base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 - }; - var AggregateOps = { - values: { - init: function init(m) { - return m.cell.store = true; - }, - value: function value(m) { - return m.cell.data.values(); - }, - idx: -1 - }, - count: { - value: function value(m) { - return m.cell.num; - } - }, - __count__: { - value: function value(m) { - return m.missing + m.valid; - } - }, - missing: { - value: function value(m) { - return m.missing; - } - }, - valid: { - value: function value(m) { - return m.valid; - } - }, - sum: { - init: function init(m) { - return m.sum = 0; - }, - value: function value(m) { - return m.sum; - }, - add: function add(m, v) { - return m.sum += +v; - }, - rem: function rem(m, v) { - return m.sum -= v; - } - }, - product: { - init: function init(m) { - return m.product = 1; - }, - value: function value(m) { - return m.valid ? m.product : undefined; - }, - add: function add(m, v) { - return m.product *= v; - }, - rem: function rem(m, v) { - return m.product /= v; - } - }, - mean: { - init: function init(m) { - return m.mean = 0; - }, - value: function value(m) { - return m.valid ? m.mean : undefined; - }, - add: function add(m, v) { - return m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid; - }, - rem: function rem(m, v) { - return m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean; - } - }, - average: { - value: function value(m) { - return m.valid ? m.mean : undefined; - }, - req: ['mean'], - idx: 1 - }, - variance: { - init: function init(m) { - return m.dev = 0; - }, - value: function value(m) { - return m.valid > 1 ? m.dev / (m.valid - 1) : undefined; - }, - add: function add(m, v) { - return m.dev += m.mean_d * (v - m.mean); - }, - rem: function rem(m, v) { - return m.dev -= m.mean_d * (v - m.mean); - }, - req: ['mean'], - idx: 1 - }, - variancep: { - value: function value(m) { - return m.valid > 1 ? m.dev / m.valid : undefined; - }, - req: ['variance'], - idx: 2 - }, - stdev: { - value: function value(m) { - return m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined; - }, - req: ['variance'], - idx: 2 - }, - stdevp: { - value: function value(m) { - return m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined; - }, - req: ['variance'], - idx: 2 - }, - stderr: { - value: function value(m) { - return m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined; - }, - req: ['variance'], - idx: 2 - }, - distinct: { - value: function value(m) { - return m.cell.data.distinct(m.get); - }, - req: ['values'], - idx: 3 - }, - ci0: { - value: function value(m) { - return m.cell.data.ci0(m.get); - }, - req: ['values'], - idx: 3 - }, - ci1: { - value: function value(m) { - return m.cell.data.ci1(m.get); - }, - req: ['values'], - idx: 3 - }, - median: { - value: function value(m) { - return m.cell.data.q2(m.get); - }, - req: ['values'], - idx: 3 - }, - q1: { - value: function value(m) { - return m.cell.data.q1(m.get); - }, - req: ['values'], - idx: 3 - }, - q3: { - value: function value(m) { - return m.cell.data.q3(m.get); - }, - req: ['values'], - idx: 3 - }, - min: { - init: function init(m) { - return m.min = undefined; - }, - value: function value(m) { - return m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min; - }, - add: function add(m, v) { - if (v < m.min || m.min === undefined) m.min = v; - }, - rem: function rem(m, v) { - if (v <= m.min) m.min = NaN; - }, - req: ['values'], - idx: 4 - }, - max: { - init: function init(m) { - return m.max = undefined; - }, - value: function value(m) { - return m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max; - }, - add: function add(m, v) { - if (v > m.max || m.max === undefined) m.max = v; - }, - rem: function rem(m, v) { - if (v >= m.max) m.max = NaN; - }, - req: ['values'], - idx: 4 - }, - argmin: { - init: function init(m) { - return m.argmin = undefined; - }, - value: function value(m) { - return m.argmin || m.cell.data.argmin(m.get); - }, - add: function add(m, v, t) { - if (v < m.min) m.argmin = t; - }, - rem: function rem(m, v) { - if (v <= m.min) m.argmin = undefined; - }, - req: ['min', 'values'], - idx: 3 - }, - argmax: { - init: function init(m) { - return m.argmax = undefined; - }, - value: function value(m) { - return m.argmax || m.cell.data.argmax(m.get); - }, - add: function add(m, v, t) { - if (v > m.max) m.argmax = t; - }, - rem: function rem(m, v) { - if (v >= m.max) m.argmax = undefined; - }, - req: ['max', 'values'], - idx: 3 - } - }; - var ValidAggregateOps = Object.keys(AggregateOps); - - function measure(key, value) { - return function (out) { - return extend({ - name: key, - out: out || key - }, base_op, value); - }; - } - - ValidAggregateOps.forEach(function (key) { - AggregateOps[key] = measure(key, AggregateOps[key]); - }); - - function createMeasure(op, name) { - return AggregateOps[op](name); - } - - function compareIndex(a, b) { - return a.idx - b.idx; - } - - function resolve(agg) { - var map = {}; - agg.forEach(function (a) { - return map[a.name] = a; - }); - - var getreqs = function getreqs(a) { - if (!a.req) return; - a.req.forEach(function (key) { - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - - agg.forEach(getreqs); - return Object.values(map).sort(compareIndex); - } - - function init() { - var _this2 = this; - - this.valid = 0; - this.missing = 0; - - this._ops.forEach(function (op) { - return op.init(_this2); - }); - } - - function add$1(v, t) { - var _this3 = this; - - if (v == null || v === '') { - ++this.missing; - return; - } - - if (v !== v) return; - ++this.valid; - - this._ops.forEach(function (op) { - return op.add(_this3, v, t); - }); - } - - function rem(v, t) { - var _this4 = this; - - if (v == null || v === '') { - --this.missing; - return; - } - - if (v !== v) return; - --this.valid; - - this._ops.forEach(function (op) { - return op.rem(_this4, v, t); - }); - } - - function set(t) { - var _this5 = this; - - this._out.forEach(function (op) { - return t[op.out] = op.value(_this5); - }); - - return t; - } - - function compileMeasures(agg, field) { - var get = field || identity, - ops = resolve(agg), - out = agg.slice().sort(compareIndex); - - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - - ctr.prototype.init = init; - ctr.prototype.add = add$1; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map(function (op) { - return op.out; - }); - return ctr; - } - - function numbers$1(values, valueof) { - var _iterator13, _step13, _value14, _index7, _iterator14, _step14, _value15; - - return regeneratorRuntime.wrap(function numbers$1$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - if (!(valueof == null)) { - _context3.next = 21; - break; - } - - _iterator13 = _createForOfIteratorHelper(values); - _context3.prev = 2; - - _iterator13.s(); - - case 4: - if ((_step13 = _iterator13.n()).done) { - _context3.next = 11; - break; - } - - _value14 = _step13.value; - - if (!(_value14 != null && _value14 !== '' && (_value14 = +_value14) >= _value14)) { - _context3.next = 9; - break; - } - - _context3.next = 9; - return _value14; - - case 9: - _context3.next = 4; - break; - - case 11: - _context3.next = 16; - break; - - case 13: - _context3.prev = 13; - _context3.t0 = _context3["catch"](2); - - _iterator13.e(_context3.t0); - - case 16: - _context3.prev = 16; - - _iterator13.f(); - - return _context3.finish(16); - - case 19: - _context3.next = 41; - break; - - case 21: - _index7 = -1; - _iterator14 = _createForOfIteratorHelper(values); - _context3.prev = 23; - - _iterator14.s(); - - case 25: - if ((_step14 = _iterator14.n()).done) { - _context3.next = 33; - break; - } - - _value15 = _step14.value; - _value15 = valueof(_value15, ++_index7, values); - - if (!(_value15 != null && _value15 !== '' && (_value15 = +_value15) >= _value15)) { - _context3.next = 31; - break; - } - - _context3.next = 31; - return _value15; - - case 31: - _context3.next = 25; - break; - - case 33: - _context3.next = 38; - break; - - case 35: - _context3.prev = 35; - _context3.t1 = _context3["catch"](23); - - _iterator14.e(_context3.t1); - - case 38: - _context3.prev = 38; - - _iterator14.f(); - - return _context3.finish(38); - - case 41: - case "end": - return _context3.stop(); - } - } - }, _marked2, null, [[2, 13, 16, 19], [23, 35, 38, 41]]); - } - - function quantiles(array, p, f) { - var values = Float64Array.from(numbers$1(array, f)); // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - - values.sort(ascending); - return p.map(function (_) { - return quantileSorted(values, _); - }); - } - - function quartiles(array, f) { - return quantiles(array, [0.25, 0.50, 0.75], f); - } // Scott, D. W. (1992) Multivariate Density Estimation: - // Theory, Practice, and Visualization. Wiley. - - - function bandwidthNRD(array, f) { - var n = array.length, - v = deviation(array, f), - q = quartiles(array, f), - h = (q[2] - q[0]) / 1.34; - v = Math.min(v, h) || v || Math.abs(q[0]) || 1; - return 1.06 * v * Math.pow(n, -0.2); - } - - function bin(_) { - // determine range - var maxb = _.maxbins || 20, - base = _.base || 10, - logb = Math.log(base), - div = _.divide || [5, 2], - min = _.extent[0], - max = _.extent[1], - span = _.span || max - min || Math.abs(min) || 1, - step, - level, - minstep, - precision, - v, - i, - n, - eps; - - if (_.step) { - // if step size is explicitly given, use that - step = _.step; - } else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - - for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i) { - ; - } - - step = _.steps[Math.max(0, i - 1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level)); // increase step size if too many bins - - while (Math.ceil(span / step) > maxb) { - step *= base; - } // decrease step size if allowed - - - for (i = 0, n = div.length; i < n; ++i) { - v = step / div[i]; - if (v >= minstep && span / v <= maxb) step = v; - } - } // update precision, min and max - - - v = Math.log(step); - precision = v >= 0 ? 0 : ~~(-v / logb) + 1; - eps = Math.pow(base, -precision - 1); - - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; - } - - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; - } - - exports.random = Math.random; - - function setRandom(r) { - exports.random = r; - } - - function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [undefined, undefined]; - var values = Float64Array.from(numbers$1(array, f)), - n = values.length, - m = samples, - a, - i, - j, - mu; - - for (j = 0, mu = Array(m); j < m; ++j) { - for (a = 0, i = 0; i < n; ++i) { - a += values[~~(exports.random() * n)]; - } - - mu[j] = a / n; - } - - mu.sort(ascending); - return [quantile(mu, alpha / 2), quantile(mu, 1 - alpha / 2)]; - } // Dot density binning for dot plot construction. - // Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - // https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - - - function dotbin(array, step, smooth, f) { - f = f || function (_) { - return _; - }; - - var i = 0, - j = 1, - n = array.length, - v = new Float64Array(n), - a = f(array[0]), - b = a, - w = a + step, - x; - - for (; j < n; ++j) { - x = f(array[j]); - - if (x >= w) { - b = (a + b) / 2; - - for (; i < j; ++i) { - v[i] = b; - } - - w = x + step; - a = x; - } - - b = x; - } - - b = (a + b) / 2; - - for (; i < j; ++i) { - v[i] = b; - } - - return smooth ? smoothing(v, step + step / 4) : v; - } // perform smoothing to reduce variance - // swap points between "adjacent" stacks - // Wilkinson defines adjacent as within step/4 units - - - function smoothing(v, thresh) { - var n = v.length, - a = 0, - b = 1, - c, - d; // get left stack - - while (v[a] === v[b]) { - ++b; - } - - while (b < n) { - // get right stack - c = b + 1; - - while (v[b] === v[c]) { - ++c; - } // are stacks adjacent? - // if so, compare sizes and swap as needed - - - if (v[b] - v[b - 1] < thresh) { - d = b + (a + c - b - b >> 1); - - while (d < b) { - v[d++] = v[b]; - } - - while (d > b) { - v[d--] = v[a]; - } - } // update left stack indices - - - a = b; - b = c; - } - - return v; - } - - function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function () { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; - } - - function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - - var dist = {}, - a, - b, - d; - - dist.min = function (_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else { - return a; - } - }; - - dist.max = function (_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else { - return b; - } - }; - - dist.sample = function () { - return a + Math.floor(d * exports.random()); - }; - - dist.pdf = function (x) { - return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0; - }; - - dist.cdf = function (x) { - var v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }; - - dist.icdf = function (p) { - return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN; - }; - - return dist.min(min).max(max); - } - - var SQRT2PI = Math.sqrt(2 * Math.PI); - var SQRT2 = Math.SQRT2; - var nextSample = NaN; - - function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - var x = 0, - y = 0, - rds, - c; - - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = exports.random() * 2 - 1; - y = exports.random() * 2 - 1; - rds = x * x + y * y; - } while (rds === 0 || rds > 1); - - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - - x *= c; - nextSample = y * c; - } - - return mean + x * stdev; - } - - function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - var z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); - } // Approximation from West (2009) - // Better Approximations to Cumulative Normal Functions - - - function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - var cd, - z = (value - mean) / stdev, - Z = Math.abs(z); - - if (Z > 37) { - cd = 0; - } else { - var _sum, - _exp = Math.exp(-Z * Z / 2); - - if (Z < 7.07106781186547) { - _sum = 3.52624965998911e-02 * Z + 0.700383064443688; - _sum = _sum * Z + 6.37396220353165; - _sum = _sum * Z + 33.912866078383; - _sum = _sum * Z + 112.079291497871; - _sum = _sum * Z + 221.213596169931; - _sum = _sum * Z + 220.206867912376; - cd = _exp * _sum; - _sum = 8.83883476483184e-02 * Z + 1.75566716318264; - _sum = _sum * Z + 16.064177579207; - _sum = _sum * Z + 86.7807322029461; - _sum = _sum * Z + 296.564248779674; - _sum = _sum * Z + 637.333633378831; - _sum = _sum * Z + 793.826512519948; - _sum = _sum * Z + 440.413735824752; - cd = cd / _sum; - } else { - _sum = Z + 0.65; - _sum = Z + 4 / _sum; - _sum = Z + 3 / _sum; - _sum = Z + 2 / _sum; - _sum = Z + 1 / _sum; - cd = _exp / _sum / 2.506628274631; - } - } - - return z > 0 ? 1 - cd : cd; - } // Approximation of Probit function using inverse error function. - - - function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); - } // Approximate inverse error function. Implementation from "Approximating - // the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. - // Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 - - - function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - var w = -Math.log((1 - x) * (1 + x)), - p; - - if (w < 6.25) { - w -= 3.125; - p = -3.6444120640178196996e-21; - p = -1.685059138182016589e-19 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -1.333171662854620906e-16 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -4.0545662729752068639e-14 + p * w; - p = -8.1519341976054721522e-14 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -1.2975133253453532498e-11 + p * w; - p = -5.4154120542946279317e-11 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -4.1126339803469836976e-09 + p * w; - p = -2.9070369957882005086e-08 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -1.3654692000834678645e-06 + p * w; - p = -1.3882523362786468719e-05 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.00074070253416626697512 + p * w; - p = -0.0060336708714301490533 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -2.7517406297064545428e-07 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -4.013867526981545969e-06 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -4.7318229009055733981e-05 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628474796 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047313 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.0037512085075692412107 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -2.7109920616438573243e-11; - p = -2.5556418169965252055e-10 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -3.7894654401267369937e-09 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -1.4960026627149240478e-08 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -6.7711997758452339498e-08 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -9.9298272942317002539e-07 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -1.9681778105531670567e-05 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477347 + p * w; - p = -0.00013871931833623122026 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else { - p = Infinity; - } - - return p * x; - } - - function randomNormal(mean, stdev) { - var mu, - sigma, - dist = { - mean: function mean(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function stdev(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: function sample() { - return sampleNormal(mu, sigma); - }, - pdf: function pdf(value) { - return densityNormal(value, mu, sigma); - }, - cdf: function cdf(value) { - return cumulativeNormal(value, mu, sigma); - }, - icdf: function icdf(p) { - return quantileNormal(p, mu, sigma); - } - }; - return dist.mean(mean).stdev(stdev); - } // TODO: support for additional kernels? - - - function randomKDE(support, bandwidth) { - var kernel = randomNormal(), - dist = {}, - n = 0; - - dist.data = function (_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else { - return support; - } - }; - - dist.bandwidth = function (_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = bandwidthNRD(support); - return dist; - }; - - dist.sample = function () { - return support[~~(exports.random() * n)] + bandwidth * kernel.sample(); - }; - - dist.pdf = function (x) { - for (var y = 0, i = 0; i < n; ++i) { - y += kernel.pdf((x - support[i]) / bandwidth); - } - - return y / bandwidth / n; - }; - - dist.cdf = function (x) { - for (var y = 0, i = 0; i < n; ++i) { - y += kernel.cdf((x - support[i]) / bandwidth); - } - - return y / n; - }; - - dist.icdf = function () { - throw Error('KDE icdf not supported.'); - }; - - return dist.data(support); - } - - function sampleLogNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - return Math.exp(mean + sampleNormal() * stdev); - } - - function densityLogNormal(value, mean, stdev) { - if (value <= 0) return 0; - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - var z = (Math.log(value) - mean) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value); - } - - function cumulativeLogNormal(value, mean, stdev) { - return cumulativeNormal(Math.log(value), mean, stdev); - } - - function quantileLogNormal(p, mean, stdev) { - return Math.exp(quantileNormal(p, mean, stdev)); - } - - function randomLogNormal(mean, stdev) { - var mu, - sigma, - dist = { - mean: function mean(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function stdev(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: function sample() { - return sampleLogNormal(mu, sigma); - }, - pdf: function pdf(value) { - return densityLogNormal(value, mu, sigma); - }, - cdf: function cdf(value) { - return cumulativeLogNormal(value, mu, sigma); - }, - icdf: function icdf(p) { - return quantileLogNormal(p, mu, sigma); - } - }; - return dist.mean(mean).stdev(stdev); - } - - function randomMixture(dists, weights) { - var dist = {}, - m = 0, - w; - - function normalize(x) { - var w = [], - sum = 0, - i; - - for (i = 0; i < m; ++i) { - sum += w[i] = x[i] == null ? 1 : +x[i]; - } - - for (i = 0; i < m; ++i) { - w[i] /= sum; - } - - return w; - } - - dist.weights = function (_) { - if (arguments.length) { - w = normalize(weights = _ || []); - return dist; - } - - return weights; - }; - - dist.distributions = function (_) { - if (arguments.length) { - if (_) { - m = _.length; - dists = _; - } else { - m = 0; - dists = []; - } - - return dist.weights(weights); - } - - return dists; - }; - - dist.sample = function () { - var r = exports.random(), - d = dists[m - 1], - v = w[0], - i = 0; // first select distribution - - for (; i < m - 1; v += w[++i]) { - if (r < v) { - d = dists[i]; - break; - } - } // then sample from it - - - return d.sample(); - }; - - dist.pdf = function (x) { - for (var p = 0, i = 0; i < m; ++i) { - p += w[i] * dists[i].pdf(x); - } - - return p; - }; - - dist.cdf = function (x) { - for (var p = 0, i = 0; i < m; ++i) { - p += w[i] * dists[i].cdf(x); - } - - return p; - }; - - dist.icdf = function () { - throw Error('Mixture icdf not supported.'); - }; - - return dist.distributions(dists).weights(weights); - } - - function sampleUniform(min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return min + (max - min) * exports.random(); - } - - function densityUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return value >= min && value <= max ? 1 / (max - min) : 0; - } - - function cumulativeUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); - } - - function quantileUniform(p, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return p >= 0 && p <= 1 ? min + p * (max - min) : NaN; - } - - function randomUniform(min, max) { - var a, - b, - dist = { - min: function min(_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else { - return a; - } - }, - max: function max(_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else { - return b; - } - }, - sample: function sample() { - return sampleUniform(a, b); - }, - pdf: function pdf(value) { - return densityUniform(value, a, b); - }, - cdf: function cdf(value) { - return cumulativeUniform(value, a, b); - }, - icdf: function icdf(p) { - return quantileUniform(p, a, b); - } - }; - - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return dist.min(min).max(max); - } // Ordinary Least Squares - - - function ols(uX, uY, uXY, uX2) { - var delta = uX2 - uX * uX, - slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, - intercept = uY - slope * uX; - return [intercept, slope]; - } - - function points(data, x, y, sort) { - data = data.filter(function (d) { - var u = x(d), - v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - - if (sort) { - data.sort(function (a, b) { - return x(a) - x(b); - }); - } - - var n = data.length, - X = new Float64Array(n), - Y = new Float64Array(n); // extract values, calculate means - - var i = 0, - ux = 0, - uy = 0, - xv, - yv, - d; - - var _iterator15 = _createForOfIteratorHelper(data), - _step15; - - try { - for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) { - d = _step15.value; - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } // mean center the data - - } catch (err) { - _iterator15.e(err); - } finally { - _iterator15.f(); - } - - for (i = 0; i < n; ++i) { - X[i] -= ux; - Y[i] -= uy; - } - - return [X, Y, ux, uy]; - } - - function visitPoints(data, x, y, callback) { - var i = -1, - u, - v; - - var _iterator16 = _createForOfIteratorHelper(data), - _step16; - - try { - for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) { - var d = _step16.value; - u = x(d); - v = y(d); - - if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) { - callback(u, v, ++i); - } - } - } catch (err) { - _iterator16.e(err); - } finally { - _iterator16.f(); - } - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - - function rSquared(data, x, y, uY, predict) { - var SSE = 0, - SST = 0; - visitPoints(data, x, y, function (dx, dy) { - var sse = dy - predict(dx), - sst = dy - uY; - SSE += sse * sse; - SST += sst * sst; - }); - return 1 - SSE / SST; - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - - function regressionLinear(data, x, y) { - var X = 0, - Y = 0, - XY = 0, - X2 = 0, - n = 0; - visitPoints(data, x, y, function (dx, dy) { - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - var coef = ols(X, Y, XY, X2), - predict = function predict(x) { - return coef[0] + coef[1] * x; - }; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - - function regressionLog(data, x, y) { - var X = 0, - Y = 0, - XY = 0, - X2 = 0, - n = 0; - visitPoints(data, x, y, function (dx, dy) { - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - var coef = ols(X, Y, XY, X2), - predict = function predict(x) { - return coef[0] + coef[1] * Math.log(x); - }; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } - - function regressionExp(data, x, y) { - // eslint-disable-next-line no-unused-vars - var _points = points(data, x, y), - _points2 = _slicedToArray(_points, 4), - xv = _points2[0], - yv = _points2[1], - ux = _points2[2], - uy = _points2[3]; - - var YL = 0, - XY = 0, - XYL = 0, - X2Y = 0, - n = 0, - dx, - ly, - xy; - visitPoints(data, x, y, function (_, dy) { - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - - var _ols = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), - _ols2 = _slicedToArray(_ols, 2), - c0 = _ols2[0], - c1 = _ols2[1], - predict = function predict(x) { - return Math.exp(c0 + c1 * (x - ux)); - }; - - return { - coef: [Math.exp(c0 - c1 * ux), c1], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - - function regressionPow(data, x, y) { - var X = 0, - Y = 0, - XY = 0, - X2 = 0, - YS = 0, - n = 0; - visitPoints(data, x, y, function (dx, dy) { - var lx = Math.log(dx), - ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - - var coef = ols(X, Y, XY, X2), - predict = function predict(x) { - return coef[0] * Math.pow(x, coef[1]); - }; - - coef[0] = Math.exp(coef[0]); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; - } - - function regressionQuad(data, x, y) { - var _points3 = points(data, x, y), - _points4 = _slicedToArray(_points3, 4), - xv = _points4[0], - yv = _points4[1], - ux = _points4[2], - uy = _points4[3], - n = xv.length; - - var X2 = 0, - X3 = 0, - X4 = 0, - XY = 0, - X2Y = 0, - i, - dx, - dy, - x2; - - for (i = 0; i < n;) { - dx = xv[i]; - dy = yv[i++]; - x2 = dx * dx; - X2 += (x2 - X2) / i; - X3 += (x2 * dx - X3) / i; - X4 += (x2 * x2 - X4) / i; - XY += (dx * dy - XY) / i; - X2Y += (x2 * dy - X2Y) / i; - } - - var X2X2 = X4 - X2 * X2, - d = X2 * X2X2 - X3 * X3, - a = (X2Y * X2 - XY * X3) / d, - b = (XY * X2X2 - X2Y * X3) / d, - c = -a * X2, - predict = function predict(x) { - x = x - ux; - return a * x * x + b * x + c + uy; - }; // transform coefficients back from mean-centered space - - - return { - coef: [c - b * ux + a * ux * ux + uy, b - 2 * a * ux, a], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - // ... which was adapted from regression-js by Tom Alexander - // Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 - // License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE - - - function regressionPoly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 1) return regressionLinear(data, x, y); - if (order === 2) return regressionQuad(data, x, y); - - var _points5 = points(data, x, y), - _points6 = _slicedToArray(_points5, 4), - xv = _points6[0], - yv = _points6[1], - ux = _points6[2], - uy = _points6[3], - n = xv.length, - lhs = [], - rhs = [], - k = order + 1; - - var i, j, l, v, c; - - for (i = 0; i < k; ++i) { - for (l = 0, v = 0; l < n; ++l) { - v += Math.pow(xv[l], i) * yv[l]; - } - - lhs.push(v); - c = new Float64Array(k); - - for (j = 0; j < k; ++j) { - for (l = 0, v = 0; l < n; ++l) { - v += Math.pow(xv[l], i + j); - } - - c[j] = v; - } - - rhs.push(c); - } - - rhs.push(lhs); - - var coef = gaussianElimination(rhs), - predict = function predict(x) { - x -= ux; - var y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - - for (i = 3; i < k; ++i) { - y += coef[i] * Math.pow(x, i); - } - - return y; - }; - - return { - coef: uncenter(k, coef, -ux, uy), - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } - - function uncenter(k, a, x, y) { - var z = Array(k); - var i, j, v, c; // initialize to zero - - for (i = 0; i < k; ++i) { - z[i] = 0; - } // polynomial expansion - - - for (i = k - 1; i >= 0; --i) { - v = a[i]; - c = 1; - z[i] += v; - - for (j = 1; j <= i; ++j) { - c *= (i + 1 - j) / j; // binomial coefficent - - z[i - j] += v * Math.pow(x, j) * c; - } - } // bias term - - - z[0] += y; - return z; - } // Given an array for a two-dimensional matrix and the polynomial order, - // solve A * x = b using Gaussian elimination. - - - function gaussianElimination(matrix) { - var n = matrix.length - 1, - coef = []; - var i, j, k, r, t; - - for (i = 0; i < n; ++i) { - r = i; // max row - - for (j = i + 1; j < n; ++j) { - if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { - r = j; - } - } - - for (k = i; k < n + 1; ++k) { - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - - for (j = i + 1; j < n; ++j) { - for (k = n; k >= i; k--) { - matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; - } - } - } - - for (j = n - 1; j >= 0; --j) { - t = 0; - - for (k = j + 1; k < n; ++k) { - t += matrix[k][j] * coef[k]; - } - - coef[j] = (matrix[n][j] - t) / matrix[j][j]; - } - - return coef; - } - - var maxiters = 2, - epsilon = 1e-12; // Adapted from science.js by Jason Davies - // Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js - // License: https://github.com/jasondavies/science.js/blob/master/LICENSE - - function regressionLoess(data, x, y, bandwidth) { - var _points7 = points(data, x, y, true), - _points8 = _slicedToArray(_points7, 4), - xv = _points8[0], - yv = _points8[1], - ux = _points8[2], - uy = _points8[3], - n = xv.length, - bw = Math.max(2, ~~(bandwidth * n)), - yhat = new Float64Array(n), - residuals = new Float64Array(n), - robustWeights = new Float64Array(n).fill(1); - - for (var iter = -1; ++iter <= maxiters;) { - var interval = [0, bw - 1]; - - for (var i = 0; i < n; ++i) { - var dx = xv[i], - i0 = interval[0], - i1 = interval[1], - edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; - var W = 0, - _X = 0, - _Y = 0, - XY = 0, - X2 = 0, - denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - - for (var k = i0; k <= i1; ++k) { - var xk = xv[k], - yk = yv[k], - _w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], - xkw = xk * _w; - - W += _w; - _X += xkw; - _Y += yk * _w; - XY += yk * xkw; - X2 += xk * xkw; - } // linear regression fit - - - var _ols3 = ols(_X / W, _Y / W, XY / W, X2 / W), - _ols4 = _slicedToArray(_ols3, 2), - a = _ols4[0], - _b = _ols4[1]; - - yhat[i] = a + _b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - updateInterval(xv, i + 1, interval); - } - - if (iter === maxiters) { - break; - } - - var medianResidual = median(residuals); - if (Math.abs(medianResidual) < epsilon) break; - - for (var _i2 = 0, arg, _w2; _i2 < n; ++_i2) { - arg = residuals[_i2] / (6 * medianResidual); // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - - robustWeights[_i2] = arg >= 1 ? epsilon : (_w2 = 1 - arg * arg) * _w2; - } - } - - return output(xv, yhat, ux, uy); - } // weighting kernel for local regression - - - function tricube(x) { - return (x = 1 - x * x * x) * x * x; - } // advance sliding window interval of nearest neighbors - - - function updateInterval(xv, i, interval) { - var val = xv[i], - left = interval[0], - right = interval[1] + 1; - if (right >= xv.length) return; // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - - while (i > left && xv[right] - val <= val - xv[left]) { - interval[0] = ++left; - interval[1] = right; - ++right; - } - } // generate smoothed output points - // average points with repeated x values - - - function output(xv, yhat, ux, uy) { - var n = xv.length, - out = []; - var i = 0, - cnt = 0, - prev = [], - v; - - for (; i < n; ++i) { - v = xv[i] + ux; - - if (prev[0] === v) { - // average output values via online update - prev[1] += (yhat[i] - prev[1]) / ++cnt; - } else { - // add new output point - cnt = 0; - prev[1] += uy; - prev = [v, yhat[i]]; - out.push(prev); - } - } - - prev[1] += uy; - return out; - } // subdivide up to accuracy of 0.1 degrees - - - var MIN_RADIANS = 0.1 * Math.PI / 180; // Adaptively sample an interpolated function over a domain extent - - function sampleCurve(f, extent, minSteps, maxSteps) { - minSteps = minSteps || 25; - maxSteps = Math.max(minSteps, maxSteps || 200); - - var point = function point(x) { - return [x, f(x)]; - }, - minX = extent[0], - maxX = extent[1], - span = maxX - minX, - stop = span / maxSteps, - prev = [point(minX)], - next = []; - - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for (var i = 1; i < maxSteps; ++i) { - prev.push(point(minX + i / minSteps * span)); - } - - prev.push(point(maxX)); - return prev; - } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - - for (var _i3 = minSteps; --_i3 > 0;) { - next.push(point(minX + _i3 / minSteps * span)); - } - } - - var p0 = prev[0], - p1 = next[next.length - 1]; - - while (p1) { - // midpoint for potential curve subdivision - var pm = point((p0[0] + p1[0]) / 2); - - if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) { - // maximum resolution has not yet been met, and - // subdivision midpoint sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - } else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - - p1 = next[next.length - 1]; - } - - return prev; - } - - function angleDelta(p, q, r) { - var a0 = Math.atan2(r[1] - p[1], r[0] - p[0]), - a1 = Math.atan2(q[1] - p[1], q[0] - p[0]); - return Math.abs(a0 - a1); - } - - function TupleStore(key) { - this._key = key ? field(key) : tupleid; - this.reset(); - } - - var prototype$7 = TupleStore.prototype; - - prototype$7.reset = function () { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; - }; - - prototype$7.add = function (v) { - this._add.push(v); - }; - - prototype$7.rem = function (v) { - this._rem.push(v); - }; - - prototype$7.values = function () { - this._get = null; - if (this._rem.length === 0) return this._add; - var a = this._add, - r = this._rem, - k = this._key, - n = a.length, - m = r.length, - x = Array(n - m), - map = {}, - i, - j, - v; // use unique key field to clear removed values - - for (i = 0; i < m; ++i) { - map[k(r[i])] = 1; - } - - for (i = 0, j = 0; i < n; ++i) { - if (map[k(v = a[i])]) { - map[k(v)] = 0; - } else { - x[j++] = v; - } - } - - this._rem = []; - return this._add = x; - }; // memoizing statistics methods - - - prototype$7.distinct = function (get) { - var v = this.values(), - n = v.length, - map = {}, - count = 0, - s; - - while (--n >= 0) { - s = get(v[n]) + ''; - - if (!hasOwnProperty(map, s)) { - map[s] = 1; - ++count; - } - } - - return count; - }; - - prototype$7.extent = function (get) { - if (this._get !== get || !this._ext) { - var v = this.values(), - i = extentIndex(v, get); - this._ext = [v[i[0]], v[i[1]]]; - this._get = get; - } - - return this._ext; - }; - - prototype$7.argmin = function (get) { - return this.extent(get)[0] || {}; - }; - - prototype$7.argmax = function (get) { - return this.extent(get)[1] || {}; - }; - - prototype$7.min = function (get) { - var m = this.extent(get)[0]; - return m != null ? get(m) : undefined; - }; - - prototype$7.max = function (get) { - var m = this.extent(get)[1]; - return m != null ? get(m) : undefined; - }; - - prototype$7.quartile = function (get) { - if (this._get !== get || !this._q) { - this._q = quartiles(this.values(), get); - this._get = get; - } - - return this._q; - }; - - prototype$7.q1 = function (get) { - return this.quartile(get)[0]; - }; - - prototype$7.q2 = function (get) { - return this.quartile(get)[1]; - }; - - prototype$7.q3 = function (get) { - return this.quartile(get)[2]; - }; - - prototype$7.ci = function (get) { - if (this._get !== get || !this._ci) { - this._ci = bootstrapCI(this.values(), 1000, 0.05, get); - this._get = get; - } - - return this._ci; - }; - - prototype$7.ci0 = function (get) { - return this.ci(get)[0]; - }; - - prototype$7.ci1 = function (get) { - return this.ci(get)[1]; - }; - /** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.fields] - An array of accessors to aggregate. - * @param {Array} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ - - - function Aggregate(params) { - Transform.call(this, null, params); - this._adds = []; // array of added output tuples - - this._mods = []; // array of modified output tuples - - this._alen = 0; // number of active added tuples - - this._mlen = 0; // number of active modified tuples - - this._drop = true; // should empty aggregation cells be removed - - this._cross = false; // produce full cross-product of group-by values - - this._dims = []; // group-by dimension accessors - - this._dnames = []; // group-by dimension names - - this._measures = []; // collection of aggregation monoids - - this._countOnly = false; // flag indicating only count aggregation - - this._counts = null; // collection of count fields - - this._prev = null; // previous aggregation cells - - this._inputs = null; // array of dependent input tuple field names - - this._outputs = null; // array of output tuple field names - } - - Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, { - 'name': 'drop', - 'type': 'boolean', - 'default': true - }, { - 'name': 'cross', - 'type': 'boolean', - 'default': false - }, { - 'name': 'key', - 'type': 'field' - }] - }; - var prototype$8 = inherits(Aggregate, Transform); - - prototype$8.transform = function (_, pulse) { - var _this6 = this; - - var aggr = this, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - mod = _.modified(); - - aggr.stamp = out.stamp; - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, function (t) { - return aggr.add(t); - }); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, function (t) { - return aggr.rem(t); - }); - pulse.visit(pulse.ADD, function (t) { - return aggr.add(t); - }); - } // Indicate output fields and return aggregate tuples. - - - out.modifies(aggr._outputs); // Should empty cells be dropped? - - aggr._drop = _.drop !== false; // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - - if (pulse.clean() && aggr._drop) { - out.clean(true).runAfter(function () { - return _this6.clean(); - }); - } - - return aggr.changes(out); - }; - - prototype$8.cross = function () { - var aggr = this, - curr = aggr.value, - dims = aggr._dnames, - vals = dims.map(function () { - return {}; - }), - n = dims.length; // collect all group-by domain values - - function collect(cells) { - var key, i, t, v; - - for (key in cells) { - t = cells[key].tuple; - - for (i = 0; i < n; ++i) { - vals[i][v = t[dims[i]]] = v; - } - } - } - - collect(aggr._prev); - collect(curr); // iterate over key cross-product, create cells as needed - - function generate(base, tuple, index) { - var name = dims[index], - v = vals[index++], - k, - key; - - for (k in v) { - tuple[name] = v[k]; - key = base ? base + '|' + k : k; - if (index < n) generate(key, tuple, index);else if (!curr[key]) aggr.cell(key, tuple); - } - } - - generate('', {}, 0); - }; - - prototype$8.init = function (_) { - // initialize input and output fields - var inputs = this._inputs = [], - outputs = this._outputs = [], - inputMap = {}; - - function inputVisit(get) { - var fields = array(accessorFields(get)), - i = 0, - n = fields.length, - f; - - for (; i < n; ++i) { - if (!inputMap[f = fields[i]]) { - inputMap[f] = 1; - inputs.push(f); - } - } - } // initialize group-by dimensions - - - this._dims = array(_.groupby); - this._dnames = this._dims.map(function (d) { - var dname = accessorName(d); - inputVisit(d); - outputs.push(dname); - return dname; - }); - this.cellkey = _.key ? _.key : groupkey(this._dims); // initialize aggregate measures - - this._countOnly = true; - this._counts = []; - this._measures = []; - var fields = _.fields || [null], - ops = _.ops || ['count'], - as = _.as || [], - n = fields.length, - map = {}, - field, - op, - m, - mname, - outname, - i; - - if (n !== ops.length) { - error('Unmatched number of fields and aggregate ops.'); - } - - for (i = 0; i < n; ++i) { - field = fields[i]; - op = ops[i]; - - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - - mname = accessorName(field); - outname = measureName(op, mname, as[i]); - outputs.push(outname); - - if (op === 'count') { - this._counts.push(outname); - - continue; - } - - m = map[mname]; - - if (!m) { - inputVisit(field); - m = map[mname] = []; - m.field = field; - - this._measures.push(m); - } - - if (op !== 'count') this._countOnly = false; - m.push(createMeasure(op, outname)); - } - - this._measures = this._measures.map(function (m) { - return compileMeasures(m, m.field); - }); - return {}; // aggregation cells (this.value) - }; // -- Cell Management ----- - - - prototype$8.cellkey = groupkey(); - - prototype$8.cell = function (key, t) { - var cell = this.value[key]; - - if (!cell) { - cell = this.value[key] = this.newcell(key, t); - this._adds[this._alen++] = cell; - } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._adds[this._alen++] = cell; - } else if (cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._mods[this._mlen++] = cell; - } - - return cell; - }; - - prototype$8.newcell = function (key, t) { - var cell = { - key: key, - num: 0, - agg: null, - tuple: this.newtuple(t, this._prev && this._prev[key]), - stamp: this.stamp, - store: false - }; - - if (!this._countOnly) { - var measures = this._measures, - n = measures.length, - i; - cell.agg = Array(n); - - for (i = 0; i < n; ++i) { - cell.agg[i] = new measures[i](cell); - } - } - - if (cell.store) { - cell.data = new TupleStore(); - } - - return cell; - }; - - prototype$8.newtuple = function (t, p) { - var names = this._dnames, - dims = this._dims, - x = {}, - i, - n; - - for (i = 0, n = dims.length; i < n; ++i) { - x[names[i]] = dims[i](t); - } - - return p ? replace(p.tuple, x) : ingest(x); - }; - - prototype$8.clean = function () { - var cells = this.value; - - for (var _key2 in cells) { - if (cells[_key2].num === 0) { - delete cells[_key2]; - } - } - }; // -- Process Tuples ----- - - - prototype$8.add = function (t) { - var key = this.cellkey(t), - cell = this.cell(key, t), - agg, - i, - n; - cell.num += 1; - if (this._countOnly) return; - if (cell.store) cell.data.add(t); - agg = cell.agg; - - for (i = 0, n = agg.length; i < n; ++i) { - agg[i].add(agg[i].get(t), t); - } - }; - - prototype$8.rem = function (t) { - var key = this.cellkey(t), - cell = this.cell(key, t), - agg, - i, - n; - cell.num -= 1; - if (this._countOnly) return; - if (cell.store) cell.data.rem(t); - agg = cell.agg; - - for (i = 0, n = agg.length; i < n; ++i) { - agg[i].rem(agg[i].get(t), t); - } - }; - - prototype$8.celltuple = function (cell) { - var tuple = cell.tuple, - counts = this._counts, - agg, - i, - n; // consolidate stored values - - if (cell.store) { - cell.data.values(); - } // update tuple properties - - - for (i = 0, n = counts.length; i < n; ++i) { - tuple[counts[i]] = cell.num; - } - - if (!this._countOnly) { - agg = cell.agg; - - for (i = 0, n = agg.length; i < n; ++i) { - agg[i].set(tuple); - } - } - - return tuple; - }; - - prototype$8.changes = function (out) { - var adds = this._adds, - mods = this._mods, - prev = this._prev, - drop = this._drop, - add = out.add, - rem = out.rem, - mod = out.mod, - cell, - key, - i, - n; - if (prev) for (key in prev) { - cell = prev[key]; - if (!drop || cell.num) rem.push(cell.tuple); - } - - for (i = 0, n = this._alen; i < n; ++i) { - add.push(this.celltuple(adds[i])); - adds[i] = null; // for garbage collection - } - - for (i = 0, n = this._mlen; i < n; ++i) { - cell = mods[i]; - (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell)); - mods[i] = null; // for garbage collection - } - - this._alen = this._mlen = 0; // reset list of active cells - - this._prev = null; - return out; - }; // epsilon bias to offset floating point error (#1737) - - - var EPSILON = 1e-14; - /** - * Generates a binning function for discretizing data. - * @constructor - * @param {object} params - The parameters for this operator. The - * provided values should be valid options for the {@link bin} function. - * @param {function(object): *} params.field - The data field to bin. - */ - - function Bin(params) { - Transform.call(this, null, params); - } - - Bin.Definition = { - 'type': 'Bin', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, { - 'name': 'anchor', - 'type': 'number' - }, { - 'name': 'maxbins', - 'type': 'number', - 'default': 20 - }, { - 'name': 'base', - 'type': 'number', - 'default': 10 - }, { - 'name': 'divide', - 'type': 'number', - 'array': true, - 'default': [5, 2] - }, { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, { - 'name': 'span', - 'type': 'number' - }, { - 'name': 'step', - 'type': 'number' - }, { - 'name': 'steps', - 'type': 'number', - 'array': true - }, { - 'name': 'minstep', - 'type': 'number', - 'default': 0 - }, { - 'name': 'nice', - 'type': 'boolean', - 'default': true - }, { - 'name': 'name', - 'type': 'string' - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['bin0', 'bin1'] - }] - }; - var prototype$9 = inherits(Bin, Transform); - - prototype$9.transform = function (_, pulse) { - var band = _.interval !== false, - bins = this._bins(_), - start = bins.start, - step = bins.step, - as = _.as || ['bin0', 'bin1'], - b0 = as[0], - b1 = as[1], - flag; - - if (_.modified()) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - } else { - flag = pulse.modified(accessorFields(_.field)) ? pulse.ADD_MOD : pulse.ADD; - } - - pulse.visit(flag, band ? function (t) { - var v = bins(t); // minimum bin value (inclusive) - - t[b0] = v; // maximum bin value (exclusive) - // use convoluted math for better floating point agreement - // see https://github.com/vega/vega/issues/830 - // infinite values propagate through this formula! #2227 - - t[b1] = v == null ? null : start + step * (1 + (v - start) / step); - } : function (t) { - t[b0] = bins(t); - }); - return pulse.modifies(band ? as : b0); - }; - - prototype$9._bins = function (_) { - if (this.value && !_.modified()) { - return this.value; - } - - var field = _.field, - bins = bin(_), - step = bins.step, - start = bins.start, - stop = start + Math.ceil((bins.stop - start) / step) * step, - a, - d; - - if ((a = _.anchor) != null) { - d = a - (start + step * Math.floor((a - start) / step)); - start += d; - stop += d; - } - - var f = function f(t) { - var v = toNumber(field(t)); - return v == null ? null : v < start ? -Infinity : v > stop ? +Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON + (v - start) / step)); - }; - - f.start = start; - f.stop = bins.stop; - f.step = step; - return this.value = accessor(f, accessorFields(field), _.name || 'bin_' + accessorName(field)); - }; - - function SortedList(idFunc, source, input) { - var $ = idFunc, - _data = source || [], - _add = input || [], - rem = {}, - cnt = 0; - - return { - add: function add(t) { - _add.push(t); - }, - remove: function remove(t) { - rem[$(t)] = ++cnt; - }, - size: function size() { - return _data.length; - }, - data: function data(compare, resort) { - if (cnt) { - _data = _data.filter(function (t) { - return !rem[$(t)]; - }); - rem = {}; - cnt = 0; - } - - if (resort && compare) { - _data.sort(compare); - } - - if (_add.length) { - _data = compare ? merge(compare, _data, _add.sort(compare)) : _data.concat(_add); - _add = []; - } - - return _data; - } - }; - } - /** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ - - - function Collect(params) { - Transform.call(this, [], params); - } - - Collect.Definition = { - 'type': 'Collect', - 'metadata': { - 'source': true - }, - 'params': [{ - 'name': 'sort', - 'type': 'compare' - }] - }; - var prototype$a = inherits(Collect, Transform); - - prototype$a.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), - sort = _.sort, - mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields)); - out.visit(out.REM, list.remove); - this.modified(mod); - this.value = out.source = list.data(stableCompare(sort), mod); // propagate tree root if defined - - if (pulse.source && pulse.source.root) { - this.value.root = pulse.source.root; - } - - return out; - }; - /** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The fields to compare. - * @param {Array} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ - - - function Compare(params) { - Operator.call(this, null, update$1, params); - } - - inherits(Compare, Operator); - - function update$1(_) { - return this.value && !_.modified() ? this.value : compare(_.fields, _.orders); - } - /** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ - - - function CountPattern(params) { - Transform.call(this, null, params); - } - - CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'case', - 'type': 'enum', - 'values': ['upper', 'lower', 'mixed'], - 'default': 'mixed' - }, { - 'name': 'pattern', - 'type': 'string', - 'default': '[\\w"]+' - }, { - 'name': 'stopwords', - 'type': 'string', - 'default': '' - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['text', 'count'] - }] - }; - - function tokenize(text, tcase, match) { - switch (tcase) { - case 'upper': - text = text.toUpperCase(); - break; - - case 'lower': - text = text.toLowerCase(); - break; - } - - return text.match(match); - } - - var prototype$b = inherits(CountPattern, Transform); - - prototype$b.transform = function (_, pulse) { - function process(update) { - return function (tuple) { - var tokens = tokenize(get(tuple), _.case, match) || [], - t; - - for (var i = 0, n = tokens.length; i < n; ++i) { - if (!stop.test(t = tokens[i])) update(t); - } - }; - } - - var init = this._parameterCheck(_, pulse), - counts = this._counts, - match = this._match, - stop = this._stop, - get = _.field, - as = _.as || ['text', 'count'], - add = process(function (t) { - counts[t] = 1 + (counts[t] || 0); - }), - rem = process(function (t) { - counts[t] -= 1; - }); - - if (init) { - pulse.visit(pulse.SOURCE, add); - } else { - pulse.visit(pulse.ADD, add); - pulse.visit(pulse.REM, rem); - } - - return this._finish(pulse, as); // generate output tuples - }; - - prototype$b._parameterCheck = function (_, pulse) { - var init = false; - - if (_.modified('stopwords') || !this._stop) { - this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i'); - init = true; - } - - if (_.modified('pattern') || !this._match) { - this._match = new RegExp(_.pattern || '[\\w\']+', 'g'); - init = true; - } - - if (_.modified('field') || pulse.modified(_.field.fields)) { - init = true; - } - - if (init) this._counts = {}; - return init; - }; - - prototype$b._finish = function (pulse, as) { - var counts = this._counts, - tuples = this._tuples || (this._tuples = {}), - text = as[0], - count = as[1], - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - w, - t, - c; - - for (w in counts) { - t = tuples[w]; - c = counts[w] || 0; - - if (!t && c) { - tuples[w] = t = ingest({}); - t[text] = w; - t[count] = c; - out.add.push(t); - } else if (c === 0) { - if (t) out.rem.push(t); - counts[w] = null; - tuples[w] = null; - } else if (t[count] !== c) { - t[count] = c; - out.mod.push(t); - } - } - - return out.modifies(as); - }; - /** - * Perform a cross-product of a tuple stream with itself. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object):boolean} [params.filter] - An optional filter - * function for selectively including tuples in the cross product. - * @param {Array} [params.as] - The names of the output fields. - */ - - - function Cross(params) { - Transform.call(this, null, params); - } - - Cross.Definition = { - 'type': 'Cross', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'filter', - 'type': 'expr' - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['a', 'b'] - }] - }; - var prototype$c = inherits(Cross, Transform); - - prototype$c.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - data = this.value, - as = _.as || ['a', 'b'], - a = as[0], - b = as[1], - reset = !data || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter'); - - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || truthy); - } else { - out.mod = data; - } - - out.source = this.value; - return out.modifies(as); - }; - - function cross(input, a, b, filter) { - var data = [], - t = {}, - n = input.length, - i = 0, - j, - left; - - for (; i < n; ++i) { - t[a] = left = input[i]; - - for (j = 0; j < n; ++j) { - t[b] = input[j]; - - if (filter(t)) { - data.push(ingest(t)); - t = {}; - t[a] = left; - } - } - } - - return data; - } - - var Distributions = { - kde: randomKDE, - mixture: randomMixture, - normal: randomNormal, - lognormal: randomLogNormal, - uniform: randomUniform - }; - var DISTRIBUTIONS = 'distributions', - FUNCTION = 'function', - FIELD = 'field'; - /** - * Parse a parameter object for a probability distribution. - * @param {object} def - The distribution parameter object. - * @param {function():Array} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ - - function parse$2(def, data) { - var func = def[FUNCTION]; - - if (!hasOwnProperty(Distributions, func)) { - error('Unknown distribution function: ' + func); - } - - var d = Distributions[func](); - - for (var name in def) { - // if data field, extract values - if (name === FIELD) { - d.data((def.from || data()).map(def[name])); - } // if distribution mixture, recurse to parse each definition - else if (name === DISTRIBUTIONS) { - d[name](def[name].map(function (_) { - return parse$2(_, data); - })); - } // otherwise, simply set the parameter - else if (_typeof(d[name]) === FUNCTION) { - d[name](def[name]); - } - } - - return d; - } - /** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - - - function Density(params) { - Transform.call(this, null, params); - } - - var distributions = [{ - 'key': { - 'function': 'normal' - }, - 'params': [{ - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'function': 'lognormal' - }, - 'params': [{ - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'function': 'uniform' - }, - 'params': [{ - 'name': 'min', - 'type': 'number', - 'default': 0 - }, { - 'name': 'max', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'function': 'kde' - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'from', - 'type': 'data' - }, { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }] - }]; - var mixture = { - 'key': { - 'function': 'mixture' - }, - 'params': [{ - 'name': 'distributions', - 'type': 'param', - 'array': true, - 'params': distributions - }, { - 'name': 'weights', - 'type': 'number', - 'array': true - }] - }; - Density.Definition = { - 'type': 'Density', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'steps', - 'type': 'number' - }, { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, { - 'name': 'method', - 'type': 'string', - 'default': 'pdf', - 'values': ['pdf', 'cdf'] - }, { - 'name': 'distribution', - 'type': 'param', - 'params': distributions.concat(mixture) - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': ['value', 'density'] - }] - }; - var prototype$d = inherits(Density, Transform); - - prototype$d.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var dist = parse$2(_.distribution, source(pulse)), - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200, - method = _.method || 'pdf'; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - - if (!_.extent && !dist.data) { - error('Missing density extent parameter.'); - } - - method = dist[method]; - var as = _.as || ['value', 'density'], - domain = _.extent || extent(dist.data()), - values = sampleCurve(method, domain, minsteps, maxsteps).map(function (v) { - var tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return ingest(tuple); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; - }; - - function source(pulse) { - return function () { - return pulse.materialize(pulse.SOURCE).source; - }; - } // use either provided alias or accessor field name - - - function fieldNames(fields, as) { - if (!fields) return null; - return fields.map(function (f, i) { - return as[i] || accessorName(f); - }); - } - - function partition(data, groupby, field) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - t, - k, - g; // partition data points into groups - - - if (groupby == null) { - groups.push(data.map(field)); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - - g.push(field(t)); - } - } - - return groups; - } - - var Output = 'bin'; - /** - * Dot density binning for dot plot construction. - * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to bin. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ - - function DotBin(params) { - Transform.call(this, null, params); - } - - DotBin.Definition = { - 'type': 'DotBin', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'step', - 'type': 'number' - }, { - 'name': 'smooth', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'default': Output - }] - }; - var prototype$e = inherits(DotBin, Transform); - - prototype$e.transform = function (_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) { - return pulse; // early exit - } - - var source = pulse.materialize(pulse.SOURCE).source, - groups = partition(pulse.source, _.groupby, identity), - smooth = _.smooth || false, - field = _.field, - step = _.step || autostep(source, field), - sort = stableCompare(function (a, b) { - return field(a) - field(b); - }), - as = _.as || Output, - n = groups.length; // compute dotplot bins per group - - var min = Infinity, - max = -Infinity, - i = 0, - j; - - for (; i < n; ++i) { - var g = groups[i].sort(sort); - j = -1; - - var _iterator17 = _createForOfIteratorHelper(dotbin(g, step, smooth, field)), - _step17; - - try { - for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) { - var v = _step17.value; - if (v < min) min = v; - if (v > max) max = v; - g[++j][as] = v; - } - } catch (err) { - _iterator17.e(err); - } finally { - _iterator17.f(); - } - } - - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); - }; - - function autostep(data, field) { - return span(extent(data, field)) / 30; - } - /** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ - - - function Expression(params) { - Operator.call(this, null, update$2, params); - this.modified(true); - } - - inherits(Expression, Operator); - - function update$2(_) { - var expr = _.expr; - return this.value && !_.modified('expr') ? this.value : accessor(function (datum) { - return expr(datum, _); - }, accessorFields(expr), accessorName(expr)); - } - /** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ - - - function Extent(params) { - Transform.call(this, [undefined, undefined], params); - } - - Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }] - }; - var prototype$f = inherits(Extent, Transform); - - prototype$f.transform = function (_, pulse) { - var extent = this.value, - field = _.field, - min = extent[0], - max = extent[1], - mod; - mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field'); - - if (mod || min == null) { - min = +Infinity; - max = -Infinity; - } - - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, function (t) { - var v = toNumber(field(t)); - - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - - if (!Number.isFinite(min) || !Number.isFinite(max)) { - var name = accessorName(field); - if (name) name = " for field \"".concat(name, "\""); - pulse.dataflow.warn("Infinite extent".concat(name, ": [").concat(min, ", ").concat(max, "]")); - min = max = undefined; - } - - this.value = [min, max]; - }; - /** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ - - - function Subflow(pulse, parent) { - Operator.call(this, pulse); - this.parent = parent; - this.count = 0; - } - - var prototype$g = inherits(Subflow, Operator); - /** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ - - prototype$g.connect = function (target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return target.source = this; - }; - /** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ - - - prototype$g.add = function (t) { - this.count += 1; - this.value.add.push(t); - }; - /** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ - - - prototype$g.rem = function (t) { - this.count -= 1; - this.value.rem.push(t); - }; - /** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ - - - prototype$g.mod = function (t) { - this.value.mod.push(t); - }; - /** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ - - - prototype$g.init = function (pulse) { - this.value.init(pulse, pulse.NO_SOURCE); - }; - /** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ - - - prototype$g.evaluate = function () { - // assert: this.value.stamp === pulse.stamp - return this.value; - }; - /** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ - - - function Facet(params) { - Transform.call(this, {}, params); - this._keys = fastmap(); // cache previously calculated key values - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - - var a = this._targets = []; - a.active = 0; - - a.forEach = function (f) { - for (var i = 0, n = a.active; i < n; ++i) { - f(a[i], i, a); - } - }; - } - - var prototype$h = inherits(Facet, Transform); - - prototype$h.activate = function (flow) { - this._targets[this._targets.active++] = flow; - }; // parent argument provided by PreFacet subclass - - - prototype$h.subflow = function (key, flow, pulse, parent) { - var flows = this.value, - sf = hasOwnProperty(flows, key) && flows[key], - df, - p; - - if (!sf) { - p = parent || (p = this._group[key]) && p.tuple; - df = pulse.dataflow; - sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this); - df.add(sf).connect(flow(df, key, p)); - flows[key] = sf; - this.activate(sf); - } else if (sf.value.stamp < pulse.stamp) { - sf.init(pulse); - this.activate(sf); - } - - return sf; - }; - - prototype$h.clean = function () { - var flows = this.value; - - for (var _key3 in flows) { - if (flows[_key3].count === 0) { - var detach = flows[_key3].detachSubflow; - if (detach) detach(); - delete flows[_key3]; - } - } - }; - - prototype$h.initTargets = function () { - var a = this._targets, - n = a.length; - - for (var i = 0; i < n && a[i] != null; ++i) { - a[i] = null; // ensure old flows can be garbage collected - } - - a.active = 0; - }; - - prototype$h.transform = function (_, pulse) { - var _this7 = this; - - var df = pulse.dataflow, - key = _.key, - flow = _.subflow, - cache = this._keys, - rekey = _.modified('key'), - subflow = function subflow(key) { - return _this7.subflow(key, flow, pulse); - }; - - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t), - k = cache.get(id); - - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - pulse.visit(pulse.ADD, function (t) { - var k = key(t); - cache.set(tupleid(t), k); - subflow(k).add(t); - }); - - if (rekey || pulse.modified(key.fields)) { - pulse.visit(pulse.MOD, function (t) { - var id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - - if (k0 === k1) { - subflow(k1).mod(t); - } else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } else if (pulse.changed(pulse.MOD)) { - pulse.visit(pulse.MOD, function (t) { - subflow(cache.get(tupleid(t))).mod(t); - }); - } - - if (rekey) { - pulse.visit(pulse.REFLOW, function (t) { - var id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } - - if (pulse.clean()) { - df.runAfter(function () { - _this7.clean(); - - cache.clean(); - }); - } else if (cache.empty > df.cleanThreshold) { - df.runAfter(cache.clean); - } - - return pulse; - }; - /** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ - - - function Field(params) { - Operator.call(this, null, update$3, params); - } - - inherits(Field, Operator); - - function update$3(_) { - return this.value && !_.modified() ? this.value : isArray(_.name) ? array(_.name).map(function (f) { - return field(f); - }) : field(_.name, _.as); - } - /** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ - - - function Filter(params) { - Transform.call(this, fastmap(), params); - } - - Filter.Definition = { - 'type': 'Filter', - 'metadata': { - 'changes': true - }, - 'params': [{ - 'name': 'expr', - 'type': 'expr', - 'required': true - }] - }; - var prototype$i = inherits(Filter, Transform); - - prototype$i.transform = function (_, pulse) { - var df = pulse.dataflow, - cache = this.value, - // cache ids of filtered tuples - output = pulse.fork(), - add = output.add, - rem = output.rem, - mod = output.mod, - test = _.expr, - isMod = true; - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - if (!cache.has(id)) rem.push(t);else cache.delete(id); - }); - pulse.visit(pulse.ADD, function (t) { - if (test(t, _)) add.push(t);else cache.set(tupleid(t), 1); - }); - - function revisit(t) { - var id = tupleid(t), - b = test(t, _), - s = cache.get(id); - - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) { - mod.push(t); - } - } - - pulse.visit(pulse.MOD, revisit); - - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; - }; - /** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ - - - function Flatten(params) { - Transform.call(this, [], params); - } - - Flatten.Definition = { - 'type': 'Flatten', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'index', - 'type': 'string' - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }] - }; - var prototype$j = inherits(Flatten, Transform); - - prototype$j.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - as = fieldNames(fields, _.as || []), - index = _.index || null, - m = as.length; // remove any previous results - - out.rem = this.value; // generate flattened tuples - - pulse.visit(pulse.SOURCE, function (t) { - var arrays = fields.map(function (f) { - return f(t); - }), - maxlen = arrays.reduce(function (l, a) { - return Math.max(l, a.length); - }, 0), - i = 0, - j, - d, - v; - - for (; i < maxlen; ++i) { - d = derive(t); - - for (j = 0; j < m; ++j) { - d[as[j]] = (v = arrays[j][i]) == null ? null : v; - } - - if (index) { - d[index] = i; - } - - out.add.push(d); - } - }); - this.value = out.source = out.add; - if (index) out.modifies(index); - return out.modifies(as); - }; - /** - * Folds one more tuple fields into multiple tuples in which the field - * name and values are available under new 'key' and 'value' fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.fields - An array of field accessors - * for the tuple fields that should be folded. - * @param {Array} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ - - - function Fold(params) { - Transform.call(this, [], params); - } - - Fold.Definition = { - 'type': 'Fold', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['key', 'value'] - }] - }; - var prototype$k = inherits(Fold, Transform); - - prototype$k.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - fnames = fields.map(accessorName), - as = _.as || ['key', 'value'], - k = as[0], - v = as[1], - n = fields.length; - out.rem = this.value; - pulse.visit(pulse.SOURCE, function (t) { - for (var i = 0, d; i < n; ++i) { - d = derive(t); - d[k] = fnames[i]; - d[v] = fields[i](t); - out.add.push(d); - } - }); - this.value = out.source = out.add; - return out.modifies(as); - }; - /** - * Invokes a function for each data tuple and saves the results as a new field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The formula function to invoke for each tuple. - * @param {string} params.as - The field name under which to save the result. - * @param {boolean} [params.initonly=false] - If true, the formula is applied to - * added tuples only, and does not update in response to modifications. - */ - - - function Formula(params) { - Transform.call(this, null, params); - } - - Formula.Definition = { - 'type': 'Formula', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'expr', - 'type': 'expr', - 'required': true - }, { - 'name': 'as', - 'type': 'string', - 'required': true - }, { - 'name': 'initonly', - 'type': 'boolean' - }] - }; - var prototype$l = inherits(Formula, Transform); - - prototype$l.transform = function (_, pulse) { - var func = _.expr, - as = _.as, - mod = _.modified(), - flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD; - - if (mod) { - // parameters updated, need to reflow - pulse = pulse.materialize().reflow(true); - } - - if (!_.initonly) { - pulse.modifies(as); - } - - return pulse.visit(flag, function (t) { - return t[as] = func(t, _); - }); - }; - /** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ - - - function Generate(params) { - Transform.call(this, [], params); - } - - var prototype$m = inherits(Generate, Transform); - - prototype$m.transform = function (_, pulse) { - var data = this.value, - out = pulse.fork(pulse.ALL), - num = _.size - data.length, - gen = _.generator, - add, - rem, - t; - - if (num > 0) { - // need more tuples, generate and add - for (add = []; --num >= 0;) { - add.push(t = ingest(gen(_))); - data.push(t); - } - - out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem; - data = data.slice(-num); - } - - out.source = this.value = data; - return out; - }; - - var Methods = { - value: 'value', - median: median, - mean: mean, - min: min, - max: max - }; - var Empty = []; - /** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ - - function Impute(params) { - Transform.call(this, [], params); - } - - Impute.Definition = { - 'type': 'Impute', - 'metadata': { - 'changes': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'key', - 'type': 'field', - 'required': true - }, { - 'name': 'keyvals', - 'array': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'method', - 'type': 'enum', - 'default': 'value', - 'values': ['value', 'mean', 'median', 'max', 'min'] - }, { - 'name': 'value', - 'default': 0 - }] - }; - var prototype$n = inherits(Impute, Transform); - - function getValue(_) { - var m = _.method || Methods.value, - v; - - if (Methods[m] == null) { - error('Unrecognized imputation method: ' + m); - } else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return function () { - return v; - }; - } else { - return Methods[m]; - } - } - - function getField(_) { - var f = _.field; - return function (t) { - return t ? f(t) : NaN; - }; - } - - prototype$n.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - impute = getValue(_), - field = getField(_), - fName = accessorName(_.field), - kName = accessorName(_.key), - gNames = (_.groupby || []).map(accessorName), - groups = partition$1(pulse.source, _.groupby, _.key, _.keyvals), - curr = [], - prev = this.value, - m = groups.domain.length, - group, - value, - gVals, - kVal, - g, - i, - j, - l, - n, - t; - - for (g = 0, l = groups.length; g < l; ++g) { - group = groups[g]; - gVals = group.values; - value = NaN; // add tuples for missing values - - for (j = 0; j < m; ++j) { - if (group[j] != null) continue; - kVal = groups.domain[j]; - t = { - _impute: true - }; - - for (i = 0, n = gVals.length; i < n; ++i) { - t[gNames[i]] = gVals[i]; - } - - t[kName] = kVal; - t[fName] = Number.isNaN(value) ? value = impute(group, field) : value; - curr.push(ingest(t)); - } - } // update pulse with imputed tuples - - - if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); - if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); - this.value = curr; - return out; - }; - - function partition$1(data, groupby, key, keyvals) { - var get = function get(f) { - return f(t); - }, - groups = [], - domain = keyvals ? keyvals.slice() : [], - kMap = {}, - gMap = {}, - gVals, - gKey, - group, - i, - j, - k, - n, - t; - - domain.forEach(function (k, i) { - kMap[k] = i + 1; - }); - - for (i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = key(t); - j = kMap[k] || (kMap[k] = domain.push(k)); - gKey = (gVals = groupby ? groupby.map(get) : Empty) + ''; - - if (!(group = gMap[gKey])) { - group = gMap[gKey] = []; - groups.push(group); - group.values = gVals; - } - - group[j - 1] = t; - } - - groups.domain = domain; - return groups; - } - /** - * Extend input tuples with aggregate values. - * Calcuates aggregate values and joins them with the input stream. - * @constructor - */ - - - function JoinAggregate(params) { - Aggregate.call(this, params); - } - - JoinAggregate.Definition = { - 'type': 'JoinAggregate', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, { - 'name': 'key', - 'type': 'field' - }] - }; - var prototype$o = inherits(JoinAggregate, Aggregate); - - prototype$o.transform = function (_, pulse) { - var aggr = this, - mod = _.modified(), - cells; // process all input tuples to calculate aggregates - - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - cells = aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, function (t) { - aggr.add(t); - }); - } else { - cells = aggr.value = aggr.value || this.init(_); - pulse.visit(pulse.REM, function (t) { - aggr.rem(t); - }); - pulse.visit(pulse.ADD, function (t) { - aggr.add(t); - }); - } // update aggregation cells - - - aggr.changes(); // write aggregate values to input tuples - - pulse.visit(pulse.SOURCE, function (t) { - extend(t, cells[aggr.cellkey(t)].tuple); - }); - return pulse.reflow(mod).modifies(this._outputs); - }; - - prototype$o.changes = function () { - var adds = this._adds, - mods = this._mods, - i, - n; - - for (i = 0, n = this._alen; i < n; ++i) { - this.celltuple(adds[i]); - adds[i] = null; // for garbage collection - } - - for (i = 0, n = this._mlen; i < n; ++i) { - this.celltuple(mods[i]); - mods[i] = null; // for garbage collection - } - - this._alen = this._mlen = 0; // reset list of active cells - }; - /** - * Compute kernel density estimates (KDE) for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - - - function KDE(params) { - Transform.call(this, null, params); - } - - KDE.Definition = { - 'type': 'KDE', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'cumulative', - 'type': 'boolean', - 'default': false - }, { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }, { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'resolve', - 'type': 'enum', - 'values': ['shared', 'independent'], - 'default': 'independent' - }, { - 'name': 'steps', - 'type': 'number' - }, { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': ['value', 'density'] - }] - }; - var prototype$p = inherits(KDE, Transform); - - prototype$p.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var _source = pulse.materialize(pulse.SOURCE).source, - groups = partition(_source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - _bandwidth = _.bandwidth, - _method = _.cumulative ? 'cdf' : 'pdf', - as = _.as || ['value', 'density'], - _values = []; - - var _domain = _.extent, - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200; - - if (_method !== 'pdf' && _method !== 'cdf') { - error('Invalid density method: ' + _method); - } - - if (_.resolve === 'shared') { - if (!_domain) _domain = extent(_source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - - groups.forEach(function (g) { - var density = randomKDE(g, _bandwidth)[_method], - scale = _.counts ? g.length : 1, - local = _domain || extent(g); - - sampleCurve(density, local, minsteps, maxsteps).forEach(function (v) { - var t = {}; - - for (var i = 0; i < names.length; ++i) { - t[names[i]] = g.dims[i]; - } - - t[as[0]] = v[0]; - t[as[1]] = v[1] * scale; - - _values.push(ingest(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = _values; - } - - return out; - }; - /** - * Generates a key function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ - - - function Key(params) { - Operator.call(this, null, update$4, params); - } - - inherits(Key, Operator); - - function update$4(_) { - return this.value && !_.modified() ? this.value : key(_.fields, _.flat); - } - /** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ - - - function Load(params) { - Transform.call(this, [], params); - this._pending = null; - } - - var prototype$q = inherits(Load, Transform); - - prototype$q.transform = function (_, pulse) { - var _this8 = this; - - var df = pulse.dataflow; - - if (this._pending) { - // update state and return pulse - return output$1(this, pulse, this._pending); - } - - if (stop(_)) return pulse.StopPropagation; - - if (_.values) { - // parse and ingest values, return output pulse - return output$1(this, pulse, df.parse(_.values, _.format)); - } else if (_.async) { - // return promise for non-blocking async loading - var p = df.request(_.url, _.format).then(function (res) { - _this8._pending = array(res.data); - return function (df) { - return df.touch(_this8); - }; - }); - return { - async: p - }; - } else { - // return promise for synchronous loading - return df.request(_.url, _.format).then(function (res) { - return output$1(_this8, pulse, array(res.data)); - }); - } - }; - - function stop(_) { - return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format')); - } - - function output$1(op, pulse, data) { - data.forEach(ingest); - var out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; - } - /** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ - - - function Lookup(params) { - Transform.call(this, {}, params); - } - - Lookup.Definition = { - 'type': 'Lookup', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'index', - 'type': 'index', - 'params': [{ - 'name': 'from', - 'type': 'data', - 'required': true - }, { - 'name': 'key', - 'type': 'field', - 'required': true - }] - }, { - 'name': 'values', - 'type': 'field', - 'array': true - }, { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }, { - 'name': 'default', - 'default': null - }] - }; - var prototype$r = inherits(Lookup, Transform); - - prototype$r.transform = function (_, pulse) { - var out = pulse, - as = _.as, - keys = _.fields, - index = _.index, - values = _.values, - defaultValue = _.default == null ? null : _.default, - reset = _.modified(), - flag = reset ? pulse.SOURCE : pulse.ADD, - n = keys.length, - set, - m, - mods; - - if (values) { - m = values.length; - - if (n > 1 && !as) { - error('Multi-field lookup requires explicit "as" parameter.'); - } - - if (as && as.length !== n * m) { - error('The "as" parameter has too few output field names.'); - } - - as = as || values.map(accessorName); - - set = function set(t) { - for (var i = 0, k = 0, j, v; i < n; ++i) { - v = index.get(keys[i](t)); - if (v == null) for (j = 0; j < m; ++j, ++k) { - t[as[k]] = defaultValue; - } else for (j = 0; j < m; ++j, ++k) { - t[as[k]] = values[j](v); - } - } - }; - } else { - if (!as) { - error('Missing output field names.'); - } - - set = function set(t) { - for (var i = 0, v; i < n; ++i) { - v = index.get(keys[i](t)); - t[as[i]] = v == null ? defaultValue : v; - } - }; - } - - if (reset) { - out = pulse.reflow(true); - } else { - mods = keys.some(function (k) { - return pulse.modified(k.fields); - }); - flag |= mods ? pulse.MOD : 0; - } - - pulse.visit(flag, set); - return out.modifies(as); - }; - /** - * Computes global min/max extents over a collection of extents. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.extents - The input extents. - */ - - - function MultiExtent(params) { - Operator.call(this, null, update$5, params); - } - - inherits(MultiExtent, Operator); - - function update$5(_) { - if (this.value && !_.modified()) { - return this.value; - } - - var min = +Infinity, - max = -Infinity, - ext = _.extents, - i, - n, - e; - - for (i = 0, n = ext.length; i < n; ++i) { - e = ext[i]; - if (e[0] < min) min = e[0]; - if (e[1] > max) max = e[1]; - } - - return [min, max]; - } - /** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.values - The input value arrrays. - */ - - - function MultiValues(params) { - Operator.call(this, null, update$6, params); - } - - inherits(MultiValues, Operator); - - function update$6(_) { - return this.value && !_.modified() ? this.value : _.values.reduce(function (data, _) { - return data.concat(_); - }, []); - } - /** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - - function Params(params) { - Transform.call(this, null, params); - } - - inherits(Params, Transform); - - Params.prototype.transform = function (_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples - }; - /** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ - - - function Pivot(params) { - Aggregate.call(this, params); - } - - Pivot.Definition = { - 'type': 'Pivot', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'value', - 'type': 'field', - 'required': true - }, { - 'name': 'op', - 'type': 'enum', - 'values': ValidAggregateOps, - 'default': 'sum' - }, { - 'name': 'limit', - 'type': 'number', - 'default': 0 - }, { - 'name': 'key', - 'type': 'field' - }] - }; - var prototype$s = inherits(Pivot, Aggregate); - prototype$s._transform = prototype$s.transform; - - prototype$s.transform = function (_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); - }; // Shoehorn a pivot transform into an aggregate transform! - // First collect all unique pivot field values. - // Then generate aggregate fields for each output pivot field. - - - function aggregateParams(_, pulse) { - var key = _.field, - value = _.value, - op = (_.op === 'count' ? '__count__' : _.op) || 'sum', - fields = accessorFields(key).concat(accessorFields(value)), - keys = pivotKeys(key, _.limit || 0, pulse); // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - - if (pulse.changed()) _.set('__pivot__', null, null, true); - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(function () { - return op; - }), - fields: keys.map(function (k) { - return get(k, key, value, fields); - }), - as: keys.map(function (k) { - return k + ''; - }), - modified: _.modified.bind(_) - }; - } // Generate aggregate field accessor. - // Output NaN for non-existent values; aggregator will ignore! - - - function get(k, key, value, fields) { - return accessor(function (d) { - return key(d) === k ? value(d) : NaN; - }, fields, k + ''); - } // Collect (and optionally limit) all unique pivot values. - - - function pivotKeys(key, limit, pulse) { - var map = {}, - list = []; - pulse.visit(pulse.SOURCE, function (t) { - var k = key(t); - - if (!map[k]) { - map[k] = 1; - list.push(k); - } - }); // TODO? Move this comparator to vega-util? - - list.sort(function (u, v) { - return (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; - }); - return limit ? list.slice(0, limit) : list; - } - /** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array} params.field - The field - * accessor for an array of subflow tuple objects. - */ - - - function PreFacet(params) { - Facet.call(this, params); - } - - var prototype$t = inherits(PreFacet, Facet); - - prototype$t.transform = function (_, pulse) { - var _this9 = this; - - var flow = _.subflow, - field = _.field, - subflow = function subflow(t) { - return _this9.subflow(tupleid(t), flow, pulse, t); - }; - - if (_.modified('field') || field && pulse.modified(accessorFields(field))) { - error('PreFacet does not support field modification.'); - } - - this.initTargets(); // reset list of active subflows - - if (field) { - pulse.visit(pulse.MOD, function (t) { - var sf = subflow(t); - field(t).forEach(function (_) { - return sf.mod(_); - }); - }); - pulse.visit(pulse.ADD, function (t) { - var sf = subflow(t); - field(t).forEach(function (_) { - return sf.add(ingest(_)); - }); - }); - pulse.visit(pulse.REM, function (t) { - var sf = subflow(t); - field(t).forEach(function (_) { - return sf.rem(_); - }); - }); - } else { - pulse.visit(pulse.MOD, function (t) { - return subflow(t).mod(t); - }); - pulse.visit(pulse.ADD, function (t) { - return subflow(t).add(t); - }); - pulse.visit(pulse.REM, function (t) { - return subflow(t).rem(t); - }); - } - - if (pulse.clean()) { - pulse.runAfter(function () { - return _this9.clean(); - }); - } - - return pulse; - }; - /** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ - - - function Project(params) { - Transform.call(this, null, params); - } - - Project.Definition = { - 'type': 'Project', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }] - }; - var prototype$u = inherits(Project, Transform); - - prototype$u.transform = function (_, pulse) { - var fields = _.fields, - as = fieldNames(_.fields, _.as || []), - derive = fields ? function (s, t) { - return project(s, t, fields, as); - } : rederive, - out, - lut; - - if (this.value) { - lut = this.value; - } else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, function (t) { - var dt = derive(t, ingest({})); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, function (t) { - out.mod.push(derive(t, lut[tupleid(t)])); - }); - return out; - }; - - function project(s, t, fields, as) { - for (var i = 0, n = fields.length; i < n; ++i) { - t[as[i]] = fields[i](s); - } - - return t; - } - /** - * Proxy the value of another operator as a pure signal value. - * Ensures no tuples are propagated. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {*} params.value - The value to proxy, becomes the value of this operator. - */ - - - function Proxy(params) { - Transform.call(this, null, params); - } - - var prototype$v = inherits(Proxy, Transform); - - prototype$v.transform = function (_, pulse) { - this.value = _.value; - return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - }; - /** - * Generates sample quantile values from an input data stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the data field - * over which to calculate quantile values. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {Array} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ - - - function Quantile(params) { - Transform.call(this, null, params); - } - - Quantile.Definition = { - 'type': 'Quantile', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'probs', - 'type': 'number', - 'array': true - }, { - 'name': 'step', - 'type': 'number', - 'default': 0.01 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': ['prob', 'value'] - }] - }; - var prototype$w = inherits(Quantile, Transform); - var EPSILON$1 = 1e-14; - - prototype$w.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - as = _.as || ['prob', 'value']; - - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - - var source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - values = [], - step = _.step || 0.01, - p = _.probs || sequence(step / 2, 1 - EPSILON$1, step), - n = p.length; - groups.forEach(function (g) { - var q = quantiles(g, p); - - for (var i = 0; i < n; ++i) { - var t = {}; - - for (var _i4 = 0; _i4 < names.length; ++_i4) { - t[names[_i4]] = g.dims[_i4]; - } - - t[as[0]] = p[i]; - t[as[1]] = q[i]; - values.push(ingest(t)); - } - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - return out; - }; - /** - * Relays a data stream between data processing pipelines. - * If the derive parameter is set, this transform will create derived - * copies of observed tuples. This provides derived data streams in which - * modifications to the tuples do not pollute an upstream data source. - * @param {object} params - The parameters for this operator. - * @param {number} [params.derive=false] - Boolean flag indicating if - * the transform should make derived copies of incoming tuples. - * @constructor - */ - - - function Relay(params) { - Transform.call(this, null, params); - } - - var prototype$x = inherits(Relay, Transform); - - prototype$x.transform = function (_, pulse) { - var out, lut; - - if (this.value) { - lut = this.value; - } else { - out = pulse = pulse.addAll(); - lut = this.value = {}; - } - - if (_.derive) { - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, function (t) { - var dt = derive(t); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, function (t) { - var dt = lut[tupleid(t)], - k; - - for (k in t) { - dt[k] = t[k]; // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - - out.modifies(k); - } - - out.mod.push(dt); - }); - } - - return out; - }; - /** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ - - - function Sample(params) { - Transform.call(this, [], params); - this.count = 0; - } - - Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'default': 1000 - }] - }; - var prototype$y = inherits(Sample, Transform); - - prototype$y.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - mod = _.modified('size'), - num = _.size, - res = this.value, - cnt = this.count, - cap = 0, - map = res.reduce(function (m, t) { - m[tupleid(t)] = 1; - return m; - }, {}); // sample reservoir update function - - - function update(t) { - var p, idx; - - if (res.length < num) { - res.push(t); - } else { - idx = ~~((cnt + 1) * exports.random()); - - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[tupleid(p)]) out.rem.push(p); // eviction - - res[idx] = t; - } - } - - ++cnt; - } - - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - - --cnt; - }); // filter removed tuples out of the sample reservoir - - res = res.filter(function (t) { - return map[tupleid(t)] !== -1; - }); - } - - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, function (t) { - // update, but skip previously sampled tuples - if (!map[tupleid(t)]) update(t); - }); - cap = -1; - } - - if (mod && res.length > num) { - for (var i = 0, n = res.length - num; i < n; ++i) { - map[tupleid(res[i])] = -1; - out.rem.push(res[i]); - } - - res = res.slice(n); - } - - if (pulse.mod.length) { - // propagate modified tuples in the sample reservoir - pulse.visit(pulse.MOD, function (t) { - if (map[tupleid(t)]) out.mod.push(t); - }); - } - - if (pulse.add.length) { - // update sample reservoir - pulse.visit(pulse.ADD, update); - } - - if (pulse.add.length || cap < 0) { - // output newly added tuples - out.add = res.filter(function (t) { - return !map[tupleid(t)]; - }); - } - - this.count = cnt; - this.value = out.source = res; - return out; - }; - /** - * Generates data tuples for a specified sequence range of numbers. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} params.start - The first number in the sequence. - * @param {number} params.stop - The last number (exclusive) in the sequence. - * @param {number} [params.step=1] - The step size between numbers in the sequence. - */ - - - function Sequence(params) { - Transform.call(this, null, params); - } - - Sequence.Definition = { - 'type': 'Sequence', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'start', - 'type': 'number', - 'required': true - }, { - 'name': 'stop', - 'type': 'number', - 'required': true - }, { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, { - 'name': 'as', - 'type': 'string', - 'default': 'data' - }] - }; - var prototype$z = inherits(Sequence, Transform); - - prototype$z.transform = function (_, pulse) { - if (this.value && !_.modified()) return; - var out = pulse.materialize().fork(pulse.MOD), - as = _.as || 'data'; - out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem; - this.value = sequence(_.start, _.stop, _.step || 1).map(function (v) { - var t = {}; - t[as] = v; - return ingest(t); - }); - out.add = pulse.add.concat(this.value); - return out; - }; - /** - * Propagates a new pulse without any tuples so long as the input - * pulse contains some added, removed or modified tuples. - * @param {object} params - The parameters for this operator. - * @constructor - */ - - - function Sieve(params) { - Transform.call(this, null, params); - this.modified(true); // always treat as modified - } - - var prototype$A = inherits(Sieve, Transform); - - prototype$A.transform = function (_, pulse) { - this.value = pulse.source; - return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - }; - /** - * Discretize dates to specific time units. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The data field containing date/time values. - */ - - - function TimeUnit(params) { - Transform.call(this, null, params); - } - - var OUTPUT = ['unit0', 'unit1']; - TimeUnit.Definition = { - 'type': 'TimeUnit', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, { - 'name': 'units', - 'type': 'enum', - 'values': TIME_UNITS, - 'array': true - }, { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, { - 'name': 'maxbins', - 'type': 'number', - 'default': 40 - }, { - 'name': 'extent', - 'type': 'date', - 'array': true - }, { - 'name': 'timezone', - 'type': 'enum', - 'default': 'local', - 'values': ['local', 'utc'] - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': OUTPUT - }] - }; - var prototype$B = inherits(TimeUnit, Transform); - - prototype$B.transform = function (_, pulse) { - var field = _.field, - band = _.interval !== false, - utc = _.timezone === 'utc', - floor = this._floor(_, pulse), - offset = (utc ? utcInterval : timeInterval)(floor.unit).offset, - as = _.as || OUTPUT, - u0 = as[0], - u1 = as[1], - min = floor.start || Infinity, - max = floor.stop || -Infinity, - step = floor.step, - flag = pulse.ADD; - - if (_.modified() || pulse.modified(accessorFields(field))) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - min = Infinity; - max = -Infinity; - } - - pulse.visit(flag, function (t) { - var v = field(t), - a, - b; - - if (v == null) { - t[u0] = null; - if (band) t[u1] = null; - } else { - t[u0] = a = b = floor(v); - if (band) t[u1] = b = offset(a, step); - if (a < min) min = a; - if (b > max) max = b; - } - }); - floor.start = min; - floor.stop = max; - return pulse.modifies(band ? as : u0); - }; - - prototype$B._floor = function (_, pulse) { - var utc = _.timezone === 'utc'; // get parameters - - var _ref2 = _.units ? { - units: _.units, - step: _.step || 1 - } : timeBin({ - extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }), - units = _ref2.units, - step = _ref2.step; // check / standardize time units - - - units = timeUnits(units); - var prev = this.value || {}, - floor = (utc ? utcFloor : timeFloor)(units, step); - floor.unit = peek(units); - floor.units = units; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; - }; - /** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ - - - function TupleIndex(params) { - Transform.call(this, fastmap(), params); - } - - var prototype$C = inherits(TupleIndex, Transform); - - prototype$C.transform = function (_, pulse) { - var df = pulse.dataflow, - field = _.field, - index = this.value, - mod = true; - - function set(t) { - index.set(field(t), t); - } - - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, function (t) { - index.delete(field(t)); - }); - pulse.visit(pulse.ADD, set); - } else { - mod = false; - } - - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); - }; - /** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ - - - function Values(params) { - Transform.call(this, null, params); - } - - var prototype$D = inherits(Values, Transform); - - prototype$D.transform = function (_, pulse) { - var run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields); - - if (run) { - this.value = (_.sort ? pulse.source.slice().sort(stableCompare(_.sort)) : pulse.source).map(_.field); - } - }; - - function WindowOp(op, field, param, as) { - var fn = WindowOps[op](field, param); - return { - init: fn.init || zero, - update: function update(w, t) { - t[as] = fn.next(w); - } - }; - } - - var WindowOps = { - row_number: function row_number() { - return { - next: function next(w) { - return w.index + 1; - } - }; - }, - rank: function rank() { - var rank; - return { - init: function init() { - return rank = 1; - }, - next: function next(w) { - var i = w.index, - data = w.data; - return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank; - } - }; - }, - dense_rank: function dense_rank() { - var drank; - return { - init: function init() { - return drank = 1; - }, - next: function next(w) { - var i = w.index, - d = w.data; - return i && w.compare(d[i - 1], d[i]) ? ++drank : drank; - } - }; - }, - percent_rank: function percent_rank() { - var rank = WindowOps.rank(), - _next2 = rank.next; - return { - init: rank.init, - next: function next(w) { - return (_next2(w) - 1) / (w.data.length - 1); - } - }; - }, - cume_dist: function cume_dist() { - var cume; - return { - init: function init() { - return cume = 0; - }, - next: function next(w) { - var i = w.index, - d = w.data, - c = w.compare; - - if (cume < i) { - while (i + 1 < d.length && !c(d[i], d[i + 1])) { - ++i; - } - - cume = i; - } - - return (1 + cume) / d.length; - } - }; - }, - ntile: function ntile(field, num) { - num = +num; - if (!(num > 0)) error('ntile num must be greater than zero.'); - var cume = WindowOps.cume_dist(), - _next3 = cume.next; - return { - init: cume.init, - next: function next(w) { - return Math.ceil(num * _next3(w)); - } - }; - }, - lag: function lag(field, offset) { - offset = +offset || 1; - return { - next: function next(w) { - var i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function lead(field, offset) { - offset = +offset || 1; - return { - next: function next(w) { - var i = w.index + offset, - d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - first_value: function first_value(field) { - return { - next: function next(w) { - return field(w.data[w.i0]); - } - }; - }, - last_value: function last_value(field) { - return { - next: function next(w) { - return field(w.data[w.i1 - 1]); - } - }; - }, - nth_value: function nth_value(field, nth) { - nth = +nth; - if (!(nth > 0)) error('nth_value nth must be greater than zero.'); - return { - next: function next(w) { - var i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - prev_value: function prev_value(field) { - var prev; - return { - init: function init() { - return prev = null; - }, - next: function next(w) { - var v = field(w.data[w.index]); - return v != null ? prev = v : prev; - } - }; - }, - next_value: function next_value(field) { - var v, i; - return { - init: function init() { - return v = null, i = -1; - }, - next: function next(w) { - var d = w.data; - return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]); - } - }; - } - }; - - function find(field, data, index) { - for (var n = data.length; index < n; ++index) { - var v = field(data[index]); - if (v != null) return index; - } - - return -1; - } - - var ValidWindowOps = Object.keys(WindowOps); - - function WindowState(_) { - var self = this, - ops = array(_.ops), - fields = array(_.fields), - params = array(_.params), - as = array(_.as), - outputs = self.outputs = [], - windows = self.windows = [], - inputs = {}, - map = {}, - countOnly = true, - counts = [], - measures = []; - - function visitInputs(f) { - array(accessorFields(f)).forEach(function (_) { - return inputs[_] = 1; - }); - } - - visitInputs(_.sort); - ops.forEach(function (op, i) { - var field = fields[i], - mname = accessorName(field), - name = measureName(op, mname, as[i]); - visitInputs(field); - outputs.push(name); // Window operation - - if (hasOwnProperty(WindowOps, op)) { - windows.push(WindowOp(op, fields[i], params[i], name)); - } // Aggregate operation - else { - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - - if (op === 'count') { - counts.push(name); - return; - } - - countOnly = false; - var m = map[mname]; - - if (!m) { - m = map[mname] = []; - m.field = field; - measures.push(m); - } - - m.push(createMeasure(op, name)); - } - }); - - if (counts.length || measures.length) { - self.cell = cell(measures, counts, countOnly); - } - - self.inputs = Object.keys(inputs); - } - - var prototype$E = WindowState.prototype; - - prototype$E.init = function () { - this.windows.forEach(function (_) { - return _.init(); - }); - if (this.cell) this.cell.init(); - }; - - prototype$E.update = function (w, t) { - var self = this, - cell = self.cell, - wind = self.windows, - data = w.data, - m = wind && wind.length, - j; - - if (cell) { - for (j = w.p0; j < w.i0; ++j) { - cell.rem(data[j]); - } - - for (j = w.p1; j < w.i1; ++j) { - cell.add(data[j]); - } - - cell.set(t); - } - - for (j = 0; j < m; ++j) { - wind[j].update(w, t); - } - }; - - function cell(measures, counts, countOnly) { - measures = measures.map(function (m) { - return compileMeasures(m, m.field); - }); - var cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - - if (!countOnly) { - var n = measures.length, - a = cell.agg = Array(n), - i = 0; - - for (; i < n; ++i) { - a[i] = new measures[i](cell); - } - } - - if (cell.store) { - var store = cell.data = new TupleStore(); - } - - cell.add = function (t) { - cell.num += 1; - if (countOnly) return; - if (store) store.add(t); - - for (var _i5 = 0; _i5 < n; ++_i5) { - a[_i5].add(a[_i5].get(t), t); - } - }; - - cell.rem = function (t) { - cell.num -= 1; - if (countOnly) return; - if (store) store.rem(t); - - for (var _i6 = 0; _i6 < n; ++_i6) { - a[_i6].rem(a[_i6].get(t), t); - } - }; - - cell.set = function (t) { - var i, n; // consolidate stored values - - if (store) store.values(); // update tuple properties - - for (i = 0, n = counts.length; i < n; ++i) { - t[counts[i]] = cell.num; - } - - if (!countOnly) for (i = 0, n = a.length; i < n; ++i) { - a[i].set(t); - } - }; - - cell.init = function () { - cell.num = 0; - if (store) store.reset(); - - for (var _i7 = 0; _i7 < n; ++_i7) { - a[_i7].init(); - } - }; - - return cell; - } - /** - * Perform window calculations and write results to the input stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window. - * @param {Array} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array} params.ops - An array of strings indicating window operations to perform. - * @param {Array} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array} [params.as] - An array of output field names for window operations. - * @param {Array} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ - - - function Window(params) { - Transform.call(this, {}, params); - this._mlen = 0; - this._mods = []; - } - - Window.Definition = { - 'type': 'Window', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidWindowOps.concat(ValidAggregateOps) - }, { - 'name': 'params', - 'type': 'number', - 'null': true, - 'array': true - }, { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, { - 'name': 'frame', - 'type': 'number', - 'null': true, - 'array': true, - 'length': 2, - 'default': [null, 0] - }, { - 'name': 'ignorePeers', - 'type': 'boolean', - 'default': false - }] - }; - var prototype$F = inherits(Window, Transform); - - prototype$F.transform = function (_, pulse) { - var self = this, - state = self.state, - mod = _.modified(), - cmp = stableCompare(_.sort), - i, - n; - - this.stamp = pulse.stamp; // initialize window state - - if (!state || mod) { - state = self.state = new WindowState(_); - } // retrieve group for a tuple - - - var key = groupkey(_.groupby); - - function group(t) { - return self.group(key(t)); - } // partition input tuples - - - if (mod || pulse.modified(state.inputs)) { - self.value = {}; - pulse.visit(pulse.SOURCE, function (t) { - group(t).add(t); - }); - } else { - pulse.visit(pulse.REM, function (t) { - group(t).remove(t); - }); - pulse.visit(pulse.ADD, function (t) { - group(t).add(t); - }); - } // perform window calculations for each modified partition - - - for (i = 0, n = self._mlen; i < n; ++i) { - processPartition(self._mods[i], state, cmp, _); - } - - self._mlen = 0; - self._mods = []; // TODO don't reflow everything? - - return pulse.reflow(mod).modifies(state.outputs); - }; - - prototype$F.group = function (key) { - var self = this, - group = self.value[key]; - - if (!group) { - group = self.value[key] = SortedList(tupleid); - group.stamp = -1; - } - - if (group.stamp < self.stamp) { - group.stamp = self.stamp; - self._mods[self._mlen++] = group; - } - - return group; - }; - - function processPartition(list, state, cmp, _) { - var sort = _.sort, - range = sort && !_.ignorePeers, - frame = _.frame || [null, 0], - data = list.data(cmp), - // use cmp for stable sort - n = data.length, - i = 0, - b = range ? bisector(sort) : null, - w = { - i0: 0, - i1: 0, - p0: 0, - p1: 0, - index: 0, - data: data, - compare: sort || constant(-1) - }; - - for (state.init(); i < n; ++i) { - setWindow(w, frame, i, n); - if (range) adjustRange(w, b); - state.update(w, data[i]); - } - } - - function setWindow(w, f, i, n) { - w.p0 = w.i0; - w.p1 = w.i1; - w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); - w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); - w.index = i; - } // if frame type is 'range', adjust window for peer values - - - function adjustRange(w, bisect) { - var r0 = w.i0, - r1 = w.i1 - 1, - c = w.compare, - d = w.data, - n = d.length - 1; - if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]); - } - - var tx = /*#__PURE__*/Object.freeze({ - __proto__: null, - aggregate: Aggregate, - bin: Bin, - collect: Collect, - compare: Compare, - countpattern: CountPattern, - cross: Cross, - density: Density, - dotbin: DotBin, - expression: Expression, - extent: Extent, - facet: Facet, - field: Field, - filter: Filter, - flatten: Flatten, - fold: Fold, - formula: Formula, - generate: Generate, - impute: Impute, - joinaggregate: JoinAggregate, - kde: KDE, - key: Key, - load: Load, - lookup: Lookup, - multiextent: MultiExtent, - multivalues: MultiValues, - params: Params, - pivot: Pivot, - prefacet: PreFacet, - project: Project, - proxy: Proxy, - quantile: Quantile, - relay: Relay, - sample: Sample, - sequence: Sequence, - sieve: Sieve, - subflow: Subflow, - timeunit: TimeUnit, - tupleindex: TupleIndex, - values: Values, - window: Window - }); - var Top = 'top'; - var Left = 'left'; - var Right = 'right'; - var Bottom = 'bottom'; - var TopLeft = 'top-left'; - var TopRight = 'top-right'; - var BottomLeft = 'bottom-left'; - var BottomRight = 'bottom-right'; - var Start = 'start'; - var Middle = 'middle'; - var End = 'end'; - var X = 'x'; - var Y = 'y'; - var Group = 'group'; - var AxisRole = 'axis'; - var TitleRole = 'title'; - var FrameRole = 'frame'; - var ScopeRole = 'scope'; - var LegendRole = 'legend'; - var RowHeader = 'row-header'; - var RowFooter = 'row-footer'; - var RowTitle = 'row-title'; - var ColHeader = 'column-header'; - var ColFooter = 'column-footer'; - var ColTitle = 'column-title'; - var Padding = 'padding'; - var Symbols = 'symbol'; - var Fit = 'fit'; - var FitX = 'fit-x'; - var FitY = 'fit-y'; - var Pad = 'pad'; - var None$1 = 'none'; - var All = 'all'; - var Each = 'each'; - var Flush = 'flush'; - var Column = 'column'; - var Row = 'row'; - var gradient_id = 0; - - function resetSVGGradientId() { - gradient_id = 0; - } - - var patternPrefix = 'p_'; - - function isGradient(value) { - return value && value.gradient; - } - - function gradientRef(g, defs, base) { - var id = g.id, - type = g.gradient, - prefix = type === 'radial' ? patternPrefix : ''; // check id, assign default values as needed - - if (!id) { - id = g.id = 'gradient_' + gradient_id++; - - if (type === 'radial') { - g.x1 = get$1(g.x1, 0.5); - g.y1 = get$1(g.y1, 0.5); - g.r1 = get$1(g.r1, 0); - g.x2 = get$1(g.x2, 0.5); - g.y2 = get$1(g.y2, 0.5); - g.r2 = get$1(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get$1(g.x1, 0); - g.y1 = get$1(g.y1, 0); - g.x2 = get$1(g.x2, 1); - g.y2 = get$1(g.y2, 0); - } - } // register definition - - - defs[id] = g; // return url reference - - return 'url(' + (base || '') + '#' + prefix + id + ')'; - } - - function get$1(val, def) { - return val != null ? val : def; - } - - function Gradient(p0, p1) { - var stops = [], - gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function stop(offset, color) { - stops.push({ - offset: offset, - color: color - }); - return gradient; - } - }; - } - - var lookup = { - 'basis': { - curve: d3Shape.curveBasis - }, - 'basis-closed': { - curve: d3Shape.curveBasisClosed - }, - 'basis-open': { - curve: d3Shape.curveBasisOpen - }, - 'bundle': { - curve: d3Shape.curveBundle, - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: d3Shape.curveCardinal, - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: d3Shape.curveCardinalOpen, - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: d3Shape.curveCardinalClosed, - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: d3Shape.curveCatmullRom, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: d3Shape.curveCatmullRomClosed, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: d3Shape.curveCatmullRomOpen, - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: d3Shape.curveLinear - }, - 'linear-closed': { - curve: d3Shape.curveLinearClosed - }, - 'monotone': { - horizontal: d3Shape.curveMonotoneY, - vertical: d3Shape.curveMonotoneX - }, - 'natural': { - curve: d3Shape.curveNatural - }, - 'step': { - curve: d3Shape.curveStep - }, - 'step-after': { - curve: d3Shape.curveStepAfter - }, - 'step-before': { - curve: d3Shape.curveStepBefore - } - }; - - function curves(type, orientation, tension) { - var entry = hasOwnProperty(lookup, type) && lookup[type], - curve = null; - - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - - if (entry.tension && tension != null) { - curve = curve[entry.tension](tension); - } - } - - return curve; - } // Path parsing and rendering code adapted from fabric.js -- Thanks! - - - var cmdlen = { - m: 2, - l: 2, - h: 1, - v: 1, - c: 6, - s: 4, - q: 4, - t: 2, - a: 7 - }, - regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\d)([-+])/g, /\s|,|###/]; - - function pathParse(pathstr) { - var result = [], - path, - curr, - chunks, - parsed, - param, - cmd, - len, - i, - j, - n, - m; // First, break path into command sequence - - path = pathstr.slice().replace(regexp[0], '###$1').split(regexp[1]).slice(1); // Next, parse each command in turn - - for (i = 0, n = path.length; i < n; ++i) { - curr = path[i]; - chunks = curr.slice(1).trim().replace(regexp[2], '$1###$2').split(regexp[3]); - cmd = curr.charAt(0); - parsed = [cmd]; - - for (j = 0, m = chunks.length; j < m; ++j) { - if ((param = +chunks[j]) === param) { - // not NaN - parsed.push(param); - } - } - - len = cmdlen[cmd.toLowerCase()]; - - if (parsed.length - 1 > len) { - for (j = 1, m = parsed.length; j < m; j += len) { - result.push([cmd].concat(parsed.slice(j, j + len))); - } - } else { - result.push(parsed); - } - } - - return result; - } - - var DegToRad = Math.PI / 180; - var Epsilon = 1e-14; - var HalfPi = Math.PI / 2; - var Tau = Math.PI * 2; - var HalfSqrt3 = Math.sqrt(3) / 2; - var segmentCache = {}; - var bezierCache = {}; - var join = [].join; // Copied from Inkscape svgtopdf, thanks! - - function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) { - var key = join.call(arguments); - - if (segmentCache[key]) { - return segmentCache[key]; - } - - var th = rotateX * DegToRad; - var sin_th = Math.sin(th); - var cos_th = Math.cos(th); - rx = Math.abs(rx); - ry = Math.abs(ry); - var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5; - var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5; - var pl = px * px / (rx * rx) + py * py / (ry * ry); - - if (pl > 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - - var a00 = cos_th / rx; - var a01 = sin_th / rx; - var a10 = -sin_th / ry; - var a11 = cos_th / ry; - var x0 = a00 * ox + a01 * oy; - var y0 = a10 * ox + a11 * oy; - var x1 = a00 * x + a01 * y; - var y1 = a10 * x + a11 * y; - var d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - var sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - var sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - var xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); - var yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); - var th0 = Math.atan2(y0 - yc, x0 - xc); - var th1 = Math.atan2(y1 - yc, x1 - xc); - var th_arc = th1 - th0; - - if (th_arc < 0 && sweep === 1) { - th_arc += Tau; - } else if (th_arc > 0 && sweep === 0) { - th_arc -= Tau; - } - - var segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - var result = []; - - for (var i = 0; i < segs; ++i) { - var th2 = th0 + i * th_arc / segs; - var th3 = th0 + (i + 1) * th_arc / segs; - result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th]; - } - - return segmentCache[key] = result; - } - - function bezier(params) { - var key = join.call(params); - - if (bezierCache[key]) { - return bezierCache[key]; - } - - var cx = params[0], - cy = params[1], - th0 = params[2], - th1 = params[3], - rx = params[4], - ry = params[5], - sin_th = params[6], - cos_th = params[7]; - var a00 = cos_th * rx; - var a01 = -sin_th * ry; - var a10 = sin_th * rx; - var a11 = cos_th * ry; - var cos_th0 = Math.cos(th0); - var sin_th0 = Math.sin(th0); - var cos_th1 = Math.cos(th1); - var sin_th1 = Math.sin(th1); - var th_half = 0.5 * (th1 - th0); - var sin_th_h2 = Math.sin(th_half * 0.5); - var t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); - var x1 = cx + cos_th0 - t * sin_th0; - var y1 = cy + sin_th0 + t * cos_th0; - var x3 = cx + cos_th1; - var y3 = cy + sin_th1; - var x2 = x3 + t * sin_th1; - var y2 = y3 - t * cos_th1; - return bezierCache[key] = [a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3]; - } - - var temp = ['l', 0, 0, 0, 0, 0, 0, 0]; - - function scale(current, sX, sY) { - var c = temp[0] = current[0]; - - if (c === 'a' || c === 'A') { - temp[1] = sX * current[1]; - temp[2] = sY * current[2]; - temp[3] = current[3]; - temp[4] = current[4]; - temp[5] = current[5]; - temp[6] = sX * current[6]; - temp[7] = sY * current[7]; - } else if (c === 'h' || c === 'H') { - temp[1] = sX * current[1]; - } else if (c === 'v' || c === 'V') { - temp[1] = sY * current[1]; - } else { - for (var i = 1, n = current.length; i < n; ++i) { - temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; - } - } - - return temp; - } - - function pathRender(context, path, l, t, sX, sY) { - var current, - // current instruction - previous = null, - x = 0, - // current x - y = 0, - // current y - controlX = 0, - // current control point x - controlY = 0, - // current control point y - tempX, - tempY, - tempControlX, - tempControlY; - if (l == null) l = 0; - if (t == null) t = 0; - if (sX == null) sX = 1; - if (sY == null) sY = sX; - if (context.beginPath) context.beginPath(); - - for (var i = 0, len = path.length; i < len; ++i) { - current = path[i]; - - if (sX !== 1 || sY !== 1) { - current = scale(current, sX, sY); - } - - switch (current[0]) { - // first letter - case 'l': - // lineto, relative - x += current[1]; - y += current[2]; - context.lineTo(x + l, y + t); - break; - - case 'L': - // lineto, absolute - x = current[1]; - y = current[2]; - context.lineTo(x + l, y + t); - break; - - case 'h': - // horizontal lineto, relative - x += current[1]; - context.lineTo(x + l, y + t); - break; - - case 'H': - // horizontal lineto, absolute - x = current[1]; - context.lineTo(x + l, y + t); - break; - - case 'v': - // vertical lineto, relative - y += current[1]; - context.lineTo(x + l, y + t); - break; - - case 'V': - // verical lineto, absolute - y = current[1]; - context.lineTo(x + l, y + t); - break; - - case 'm': - // moveTo, relative - x += current[1]; - y += current[2]; - context.moveTo(x + l, y + t); - break; - - case 'M': - // moveTo, absolute - x = current[1]; - y = current[2]; - context.moveTo(x + l, y + t); - break; - - case 'c': - // bezierCurveTo, relative - tempX = x + current[5]; - tempY = y + current[6]; - controlX = x + current[3]; - controlY = y + current[4]; - context.bezierCurveTo(x + current[1] + l, // x1 - y + current[2] + t, // y1 - controlX + l, // x2 - controlY + t, // y2 - tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - - case 'C': - // bezierCurveTo, absolute - x = current[5]; - y = current[6]; - controlX = current[3]; - controlY = current[4]; - context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t); - break; - - case 's': - // shorthand cubic bezierCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; // calculate reflection of previous control points - - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t); // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - - controlX = x + current[1]; - controlY = y + current[2]; - x = tempX; - y = tempY; - break; - - case 'S': - // shorthand cubic bezierCurveTo, absolute - tempX = current[3]; - tempY = current[4]; // calculate reflection of previous control points - - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - - controlX = current[1]; - controlY = current[2]; - break; - - case 'q': - // quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - controlX = x + current[1]; - controlY = y + current[2]; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - - case 'Q': - // quadraticCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = current[1]; - controlY = current[2]; - break; - - case 't': - // shorthand quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[1]; - tempY = y + current[2]; - - if (previous[0].match(/[QqTt]/) === null) { - // If there is no previous command or if the previous command was not a Q, q, T or t, - // assume the control point is coincident with the current point - controlX = x; - controlY = y; - } else if (previous[0] === 't') { - // calculate reflection of previous control points for t - controlX = 2 * x - tempControlX; - controlY = 2 * y - tempControlY; - } else if (previous[0] === 'q') { - // calculate reflection of previous control points for q - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - } - - tempControlX = controlX; - tempControlY = controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = x + current[1]; - controlY = y + current[2]; - break; - - case 'T': - tempX = current[1]; - tempY = current[2]; // calculate reflection of previous control points - - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - - case 'a': - drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x + l, current[7] + y + t]); - x += current[6]; - y += current[7]; - break; - - case 'A': - drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]); - x = current[6]; - y = current[7]; - break; - - case 'z': - case 'Z': - context.closePath(); - break; - } - - previous = current; - } - } - - function drawArc(context, x, y, coords) { - var seg = segments(coords[5], // end x - coords[6], // end y - coords[0], // radius x - coords[1], // radius y - coords[3], // large flag - coords[4], // sweep flag - coords[2], // rotation - x, y); - - for (var i = 0; i < seg.length; ++i) { - var bez = bezier(seg[i]); - context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); - } - } - - var Tan30 = 0.5773502691896257; - var builtins = { - 'circle': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(r, 0); - context.arc(0, 0, r, 0, Tau); - } - }, - 'cross': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - s = r / 2.5; - context.moveTo(-r, -s); - context.lineTo(-r, s); - context.lineTo(-s, s); - context.lineTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, s); - context.lineTo(r, s); - context.lineTo(r, -s); - context.lineTo(s, -s); - context.lineTo(s, -r); - context.lineTo(-s, -r); - context.lineTo(-s, -s); - context.closePath(); - } - }, - 'diamond': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.closePath(); - } - }, - 'square': { - draw: function draw(context, size) { - var w = Math.sqrt(size), - x = -w / 2; - context.rect(x, x, w, w); - } - }, - 'arrow': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - s = r / 7, - t = r / 2.5, - v = r / 8; - context.moveTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, -v); - context.lineTo(t, -v); - context.lineTo(0, -r); - context.lineTo(-t, -v); - context.lineTo(-s, -v); - context.closePath(); - } - }, - 'wedge': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r, - o = h - r * Tan30, - b = r / 4; - context.moveTo(0, -h - o); - context.lineTo(-b, h - o); - context.lineTo(b, h - o); - context.closePath(); - } - }, - 'triangle': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r, - o = h - r * Tan30; - context.moveTo(0, -h - o); - context.lineTo(-r, h - o); - context.lineTo(r, h - o); - context.closePath(); - } - }, - 'triangle-up': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(0, -h); - context.lineTo(-r, h); - context.lineTo(r, h); - context.closePath(); - } - }, - 'triangle-down': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(0, h); - context.lineTo(-r, -h); - context.lineTo(r, -h); - context.closePath(); - } - }, - 'triangle-right': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(h, 0); - context.lineTo(-h, -r); - context.lineTo(-h, r); - context.closePath(); - } - }, - 'triangle-left': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(-h, 0); - context.lineTo(h, -r); - context.lineTo(h, r); - context.closePath(); - } - }, - 'stroke': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(r, 0); - } - } - }; - - function symbols(_) { - return hasOwnProperty(builtins, _) ? builtins[_] : customSymbol(_); - } - - var custom = {}; - - function customSymbol(path) { - if (!hasOwnProperty(custom, path)) { - var parsed = pathParse(path); - custom[path] = { - draw: function draw(context, size) { - pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2); - } - }; - } - - return custom[path]; - } // See http://spencermortensen.com/articles/bezier-circle/ - - - var C = 0.448084975506; // C = 1 - c - - function rectangleX(d) { - return d.x; - } - - function rectangleY(d) { - return d.y; - } - - function rectangleWidth(d) { - return d.width; - } - - function rectangleHeight(d) { - return d.height; - } - - function number$1(_) { - return typeof _ === 'function' ? _ : function () { - return +_; - }; - } - - function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); - } - - function vg_rect() { - var x = rectangleX, - y = rectangleY, - width = rectangleWidth, - height = rectangleHeight, - crTL = number$1(0), - crTR = crTL, - crBL = crTL, - crBR = crTL, - context = null; - - function rectangle(_, x0, y0) { - var buffer, - x1 = x0 != null ? x0 : +x.call(this, _), - y1 = y0 != null ? y0 : +y.call(this, _), - w = +width.call(this, _), - h = +height.call(this, _), - s = Math.min(w, h) / 2, - tl = clamp(+crTL.call(this, _), 0, s), - tr = clamp(+crTR.call(this, _), 0, s), - bl = clamp(+crBL.call(this, _), 0, s), - br = clamp(+crBR.call(this, _), 0, s); - if (!context) context = buffer = d3Path.path(); - - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) { - context.rect(x1, y1, w, h); - } else { - var x2 = x1 + w, - y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - rectangle.x = function (_) { - if (arguments.length) { - x = number$1(_); - return rectangle; - } else { - return x; - } - }; - - rectangle.y = function (_) { - if (arguments.length) { - y = number$1(_); - return rectangle; - } else { - return y; - } - }; - - rectangle.width = function (_) { - if (arguments.length) { - width = number$1(_); - return rectangle; - } else { - return width; - } - }; - - rectangle.height = function (_) { - if (arguments.length) { - height = number$1(_); - return rectangle; - } else { - return height; - } - }; - - rectangle.cornerRadius = function (tl, tr, br, bl) { - if (arguments.length) { - crTL = number$1(tl); - crTR = tr != null ? number$1(tr) : crTL; - crBR = br != null ? number$1(br) : crTL; - crBL = bl != null ? number$1(bl) : crTR; - return rectangle; - } else { - return crTL; - } - }; - - rectangle.context = function (_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else { - return context; - } - }; - - return rectangle; - } - - function vg_trail() { - var x, - y, - size, - defined, - context = null, - ready, - x1, - y1, - r1; - - function point(x2, y2, w2) { - var r2 = w2 / 2; - - if (ready) { - var ux = y1 - y2, - uy = x2 - x1; - - if (ux || uy) { - // get normal vector - var ud = Math.sqrt(ux * ux + uy * uy), - rx = (ux /= ud) * r1, - ry = (uy /= ud) * r1, - t = Math.atan2(uy, ux); // draw segment - - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else { - context.arc(x2, y2, r2, 0, Tau); - } - - context.closePath(); - } else { - ready = 1; - } - - x1 = x2; - y1 = y2; - r1 = r2; - } - - function trail(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - if (context == null) context = buffer = d3Path.path(); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - trail.x = function (_) { - if (arguments.length) { - x = _; - return trail; - } else { - return x; - } - }; - - trail.y = function (_) { - if (arguments.length) { - y = _; - return trail; - } else { - return y; - } - }; - - trail.size = function (_) { - if (arguments.length) { - size = _; - return trail; - } else { - return size; - } - }; - - trail.defined = function (_) { - if (arguments.length) { - defined = _; - return trail; - } else { - return defined; - } - }; - - trail.context = function (_) { - if (arguments.length) { - if (_ == null) { - context = null; - } else { - context = _; - } - - return trail; - } else { - return context; - } - }; - - return trail; - } - - function value(a, b) { - return a != null ? a : b; - } - - var x = function x(item) { - return item.x || 0; - }, - y = function y(item) { - return item.y || 0; - }, - w = function w(item) { - return item.width || 0; - }, - h = function h(item) { - return item.height || 0; - }, - xw = function xw(item) { - return (item.x || 0) + (item.width || 0); - }, - yh = function yh(item) { - return (item.y || 0) + (item.height || 0); - }, - sa = function sa(item) { - return item.startAngle || 0; - }, - ea = function ea(item) { - return item.endAngle || 0; - }, - pa = function pa(item) { - return item.padAngle || 0; - }, - ir = function ir(item) { - return item.innerRadius || 0; - }, - or = function or(item) { - return item.outerRadius || 0; - }, - cr = function cr(item) { - return item.cornerRadius || 0; - }, - tl = function tl(item) { - return value(item.cornerRadiusTopLeft, item.cornerRadius) || 0; - }, - tr = function tr(item) { - return value(item.cornerRadiusTopRight, item.cornerRadius) || 0; - }, - br = function br(item) { - return value(item.cornerRadiusBottomRight, item.cornerRadius) || 0; - }, - bl = function bl(item) { - return value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0; - }, - sz = function sz(item) { - return value(item.size, 64); - }, - ts = function ts(item) { - return item.size || 1; - }, - def = function def(item) { - return !(item.defined === false); - }, - type = function type(item) { - return symbols(item.shape || 'circle'); - }; - - var arcShape = d3Shape.arc().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), - areavShape = d3Shape.area().x(x).y1(y).y0(yh).defined(def), - areahShape = d3Shape.area().y(y).x1(x).x0(xw).defined(def), - lineShape = d3Shape.line().x(x).y(y).defined(def), - rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(tl, tr, br, bl), - symbolShape = d3Shape.symbol().type(type).size(sz), - trailShape = vg_trail().x(x).y(y).defined(def).size(ts); - - function hasCornerRadius(item) { - return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; - } - - function arc(context, item) { - return arcShape.context(context)(item); - } - - function area(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items); - } - - function line(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items); - } - - function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); - } - - function shape(context, item) { - return (item.mark.shape || item.shape).context(context)(item); - } - - function symbol(context, item) { - return symbolShape.context(context)(item); - } - - function trail(context, items) { - return trailShape.context(context)(items); - } - - var clip_id = 1; - - function resetSVGClipId() { - clip_id = 1; - } - - function clip(renderer, item, size) { - var clip = item.clip, - defs = renderer._defs, - id = item.clip_id || (item.clip_id = 'clip' + clip_id++), - c = defs.clipping[id] || (defs.clipping[id] = { - id: id - }); - - if (isFunction(clip)) { - c.path = clip(null); - } else if (hasCornerRadius(size)) { - c.path = rectangle(null, size, 0, 0); - } else { - c.width = size.width || 0; - c.height = size.height || 0; - } - - return 'url(#' + id + ')'; - } - - function Bounds(b) { - this.clear(); - if (b) this.union(b); - } - - var prototype$G = Bounds.prototype; - - prototype$G.clone = function () { - return new Bounds(this); - }; - - prototype$G.clear = function () { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; - }; - - prototype$G.empty = function () { - return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; - }; - - prototype$G.equals = function (b) { - return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2; - }; - - prototype$G.set = function (x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; - } - - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; - } - - return this; - }; - - prototype$G.add = function (x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; - }; - - prototype$G.expand = function (d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; - }; - - prototype$G.round = function () { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; - }; - - prototype$G.scale = function (s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; - }; - - prototype$G.translate = function (dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; - }; - - prototype$G.rotate = function (angle, x, y) { - var p = this.rotatedPoints(angle, x, y); - return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); - }; - - prototype$G.rotatedPoints = function (angle, x, y) { - var x1 = this.x1, - y1 = this.y1, - x2 = this.x2, - y2 = this.y2, - cos = Math.cos(angle), - sin = Math.sin(angle), - cx = x - x * cos + y * sin, - cy = y - x * sin - y * cos; - return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy]; - }; - - prototype$G.union = function (b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; - }; - - prototype$G.intersect = function (b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; - }; - - prototype$G.encloses = function (b) { - return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2; - }; - - prototype$G.alignsWith = function (b) { - return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2); - }; - - prototype$G.intersects = function (b) { - return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2); - }; - - prototype$G.contains = function (x, y) { - return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2); - }; - - prototype$G.width = function () { - return this.x2 - this.x1; - }; - - prototype$G.height = function () { - return this.y2 - this.y1; - }; - - function Item(mark) { - this.mark = mark; - this.bounds = this.bounds || new Bounds(); - } - - function GroupItem(mark) { - Item.call(this, mark); - this.items = this.items || []; - } - - inherits(GroupItem, Item); - - function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - var c = document.createElement('canvas'); - - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } - } - - return null; - } - - function domImage() { - return typeof Image !== 'undefined' ? Image : null; - } - - function ResourceLoader(customLoader) { - this._pending = 0; - this._loader = customLoader || loader(); - } - - var prototype$H = ResourceLoader.prototype; - - prototype$H.pending = function () { - return this._pending; - }; - - function increment(loader) { - loader._pending += 1; - } - - function decrement(loader) { - loader._pending -= 1; - } - - prototype$H.sanitizeURL = function (uri) { - var loader = this; - increment(loader); - return loader._loader.sanitize(uri, { - context: 'href' - }).then(function (opt) { - decrement(loader); - return opt; - }).catch(function () { - decrement(loader); - return null; - }); - }; - - prototype$H.loadImage = function (uri) { - var loader = this, - Image = domImage(); - increment(loader); - return loader._loader.sanitize(uri, { - context: 'image' - }).then(function (opt) { - var url = opt.href; - if (!url || !Image) throw { - url: url - }; - var img = new Image(); // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - - var cors = hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; // attempt to load image resource - - img.onload = function () { - return decrement(loader); - }; - - img.onerror = function () { - return decrement(loader); - }; - - img.src = url; - return img; - }).catch(function (e) { - decrement(loader); - return { - complete: false, - width: 0, - height: 0, - src: e && e.url || '' - }; - }); - }; - - prototype$H.ready = function () { - var loader = this; - return new Promise(function (accept) { - function poll(value) { - if (!loader.pending()) accept(value);else setTimeout(function () { - poll(true); - }, 10); - } - - poll(false); - }); - }; - - function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - var sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - - return bounds; - } - - function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; - } - - var bounds, - lx, - ly, - circleThreshold = Tau - 1e-8; - - function context(_) { - bounds = _; - return context; - } - - function noop$1() {} - - function add$2(x, y) { - bounds.add(x, y); - } - - function addL(x, y) { - add$2(lx = x, ly = y); - } - - function addX(x) { - add$2(x, bounds.y1); - } - - function addY(y) { - add$2(bounds.x1, y); - } - - context.beginPath = noop$1; - context.closePath = noop$1; - context.moveTo = addL; - context.lineTo = addL; - - context.rect = function (x, y, w, h) { - add$2(x + w, y + h); - addL(x, y); - }; - - context.quadraticCurveTo = function (x1, y1, x2, y2) { - quadExtrema(lx, x1, x2, addX); - quadExtrema(ly, y1, y2, addY); - addL(x2, y2); - }; - - function quadExtrema(x0, x1, x2, cb) { - var t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); - } - - context.bezierCurveTo = function (x1, y1, x2, y2, x3, y3) { - cubicExtrema(lx, x1, x2, x3, addX); - cubicExtrema(ly, y1, y2, y3, addY); - addL(x3, y3); - }; - - function cubicExtrema(x0, x1, x2, x3, cb) { - var a = x3 - x0 + 3 * x1 - 3 * x2, - b = x0 + x2 - 2 * x1, - c = x0 - x1; - var t0 = 0, - t1 = 0, - r; // solve for parameter t - - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else { - // linear equation - t0 = 0.5 * c / b; - } // calculate position - - - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); - } - - function cubic(t, x0, x1, x2, x3) { - var s = 1 - t, - s2 = s * s, - t2 = t * t; - return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3; - } - - context.arc = function (cx, cy, r, sa, ea, ccw) { - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add$2(cx - r, cy - r); - add$2(cx + r, cy + r); - } else { - var _update = function _update(a) { - return add$2(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - }; - - var s, i; // sample end points - - _update(sa); - - _update(ea); // sample interior points aligned with 90 degrees - - - if (ea !== sa) { - sa = sa % Tau; - if (sa < 0) sa += Tau; - ea = ea % Tau; - if (ea < 0) ea += Tau; - - if (ea < sa) { - ccw = !ccw; // flip direction - - s = sa; - sa = ea; - ea = s; // swap end-points - } - - if (ccw) { - ea -= Tau; - s = sa - sa % HalfPi; - - for (i = 0; i < 4 && s > ea; ++i, s -= HalfPi) { - _update(s); - } - } else { - s = sa - sa % HalfPi + HalfPi; - - for (i = 0; i < 4 && s < ea; ++i, s = s + HalfPi) { - _update(s); - } - } - } - } - }; - - var context$1 = (context$1 = domCanvas(1, 1)) ? context$1.getContext('2d') : null; - var b = new Bounds(); - - function intersectPath(draw) { - return function (item, brush) { - // rely on (inaccurate) bounds intersection if no context - if (!context$1) return true; // add path to offscreen graphics context - - draw(context$1, item); // get bounds intersection region - - b.clear().union(item.bounds).intersect(brush).round(); - var x1 = b.x1, - y1 = b.y1, - x2 = b.x2, - y2 = b.y2; // iterate over intersection region - // perform fine grained inclusion test - - for (var _y = y1; _y <= y2; ++_y) { - for (var _x20 = x1; _x20 <= x2; ++_x20) { - if (context$1.isPointInPath(_x20, _y)) { - return true; - } - } - } // false if no hits in intersection region - - - return false; - }; - } - - function intersectPoint(item, box) { - return box.contains(item.x || 0, item.y || 0); - } - - function intersectRect(item, box) { - var x = item.x || 0, - y = item.y || 0, - w = item.width || 0, - h = item.height || 0; - return box.intersects(b.set(x, y, x + w, y + h)); - } - - function intersectRule(item, box) { - var x = item.x || 0, - y = item.y || 0, - x2 = item.x2 != null ? item.x2 : x, - y2 = item.y2 != null ? item.y2 : y; - return intersectBoxLine(box, x, y, x2, y2); - } - - function intersectBoxLine(box, x, y, u, v) { - var x1 = box.x1, - y1 = box.y1, - x2 = box.x2, - y2 = box.y2, - dx = u - x, - dy = v - y; - var t0 = 0, - t1 = 1, - p, - q, - r, - e; - - for (e = 0; e < 4; ++e) { - if (e === 0) { - p = -dx; - q = -(x1 - x); - } - - if (e === 1) { - p = dx; - q = x2 - x; - } - - if (e === 2) { - p = -dy; - q = -(y1 - y); - } - - if (e === 3) { - p = dy; - q = y2 - y; - } - - if (Math.abs(p) < 1e-10 && q < 0) return false; - r = q / p; - - if (p < 0) { - if (r > t1) return false;else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false;else if (r < t1) t1 = r; - } - } - - return true; - } - - function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; - } - - function value$1(value, dflt) { - return value == null ? dflt : value; - } - - function addStops(gradient, stops) { - var n = stops.length; - - for (var i = 0; i < n; ++i) { - gradient.addColorStop(stops[i].offset, stops[i].color); - } - - return gradient; - } - - function gradient(context, spec, bounds) { - var w = bounds.width(), - h = bounds.height(); - var gradient; - - if (spec.gradient === 'radial') { - gradient = context.createRadialGradient(bounds.x1 + value$1(spec.x1, 0.5) * w, bounds.y1 + value$1(spec.y1, 0.5) * h, Math.max(w, h) * value$1(spec.r1, 0), bounds.x1 + value$1(spec.x2, 0.5) * w, bounds.y1 + value$1(spec.y2, 0.5) * h, Math.max(w, h) * value$1(spec.r2, 0.5)); - } else { - // linear gradient - var x1 = value$1(spec.x1, 0), - y1 = value$1(spec.y1, 0), - x2 = value$1(spec.x2, 1), - y2 = value$1(spec.y2, 0); - - if (x1 === x2 || y1 === y2 || w === h) { - // axis aligned: use normal gradient - gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h); - } else { - // not axis aligned: render gradient into a pattern (#2365) - // this allows us to use normalized bounding box coordinates - var _image = domCanvas(Math.ceil(w), Math.ceil(h)), - ictx = _image.getContext('2d'); - - ictx.scale(w, h); - ictx.fillStyle = addStops(ictx.createLinearGradient(x1, y1, x2, y2), spec.stops); - ictx.fillRect(0, 0, w, h); - return context.createPattern(_image, 'no-repeat'); - } - } - - return addStops(gradient, spec.stops); - } - - function color(context, item, value) { - return isGradient(value) ? gradient(context, value, item.bounds) : value; - } - - function fill(context, item, opacity) { - opacity *= item.fillOpacity == null ? 1 : item.fillOpacity; - - if (opacity > 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else { - return false; - } - } - - var Empty$1 = []; - - function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - if (lw <= 0) return false; - opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity; - - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty$1); - context.lineDashOffset = item.strokeDashOffset || 0; - } - - return true; - } else { - return false; - } - } - - function compare$2(a, b) { - return a.zindex - b.zindex || a.index - b.index; - } - - function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - var items = scene.items, - output = [], - item, - i, - n; - - for (i = 0, n = items.length; i < n; ++i) { - item = items[i]; - item.index = i; - if (item.zindex) output.push(item); - } - - scene.zdirty = false; - return scene.zitems = output.sort(compare$2); - } - - function visit(scene, visitor) { - var items = scene.items, - i, - n; - if (!items || !items.length) return; - var zitems = zorder(scene); - - if (zitems && zitems.length) { - for (i = 0, n = items.length; i < n; ++i) { - if (!items[i].zindex) visitor(items[i]); - } - - items = zitems; - } - - for (i = 0, n = items.length; i < n; ++i) { - visitor(items[i]); - } - } - - function pickVisit(scene, visitor) { - var items = scene.items, - hit, - i; - if (!items || !items.length) return null; - var zitems = zorder(scene); - if (zitems && zitems.length) items = zitems; - - for (i = items.length; --i >= 0;) { - if (hit = visitor(items[i])) return hit; - } - - if (items === zitems) { - for (items = scene.items, i = items.length; --i >= 0;) { - if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; - } - } - } - - return null; - } - - function drawAll(path) { - return function (context, scene, bounds) { - visit(scene, function (item) { - if (!bounds || bounds.intersects(item.bounds)) { - drawPath(path, context, item, item); - } - }); - }; - } - - function drawOne(path) { - return function (context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) { - drawPath(path, context, scene.items[0], scene.items); - } - }; - } - - function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - if (path(context, items)) return; - blend(context, item); - - if (item.fill && fill(context, item, opacity)) { - context.fill(); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.stroke(); - } - } - - function pick(test) { - test = test || truthy; - return function (context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - return pickVisit(scene, function (item) { - var b = item.bounds; // first hit test against bounding box - - if (b && !b.contains(gx, gy) || !b) return; // if in bounding box, perform more careful test - - if (test(context, item, x, y, gx, gy)) return item; - }); - }; - } - - function hitPath(path, filled) { - return function (context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, - fill = filled == null ? item.fill : filled, - stroke = item.stroke && context.isPointInStroke, - lw, - lc; - - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - - return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y); - }; - } - - function pickPath(path) { - return pick(hitPath(path)); - } - - function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; - } - - function rotate(a) { - return 'rotate(' + a + ')'; - } - - function scale$1(scaleX, scaleY) { - return 'scale(' + scaleX + ',' + scaleY + ')'; - } - - function translateItem(item) { - return translate(item.x || 0, item.y || 0); - } - - function transformItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale$1(item.scaleX || 1, item.scaleY || 1) : ''); - } - - function markItemPath(type, shape, isect) { - function attr(emit, item) { - emit('transform', transformItem(item)); - emit('d', shape(null, item)); - } - - function bound(bounds, item) { - var x = item.x || 0, - y = item.y || 0; - shape(context(bounds), item); - boundStroke(bounds, item).translate(x, y); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw(context, item) { - var x = item.x || 0, - y = item.y || 0, - a = item.angle || 0; - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); - } - - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; - } - - var arc$1 = markItemPath('arc', arc); - - function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], - z = a[0].orient === 'horizontal' ? 'y' : 'x', - i = a.length, - min = +Infinity, - hit, - d; - - while (--i >= 0) { - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - - if (d < min) { - min = d; - hit = a[i]; - } - } - - return hit; - } - - function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), - i = a.length, - dx, - dy, - dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - - return null; - } - - function pickTrail(a, p) { - var i = a.length, - dx, - dy, - dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx * dx) return a[i]; - } - - return null; - } - - function markMultiItemPath(type, shape, tip) { - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - - function bound(bounds, mark) { - var items = mark.items; - - if (items.length === 0) { - return bounds; - } else { - shape(context(bounds), items); - return boundStroke(bounds, items[0]); - } - } - - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - - var hit = hitPath(draw); - - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, - b = scene.bounds; - - if (!items || !items.length || b && !b.contains(gx, gy)) { - return null; - } - - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; - } - - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; - } - - var area$1 = markMultiItemPath('area', area, pickArea); - - function clip$1(context, scene) { - var clip = scene.clip; - context.save(); - - if (isFunction(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else { - clipGroup(context, scene.group); - } - } - - function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); - } - - function offset$1(item) { - var sw = value$1(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; - } - - function attr(emit, item) { - emit('transform', translateItem(item)); - } - - function emitRectangle(emit, item) { - var off = offset$1(item); - emit('d', rectangle(null, item, off, off)); - } - - function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); - } - - function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - - if (item.strokeForeground) { - emitRectangle(emit, item); - } else { - emit('d', ''); - } - } - - function content(emit, item, renderer) { - var url = item.clip ? clip(renderer, item, item) : null; - emit('clip-path', url); - } - - function bound(bounds, group) { - if (!group.clip && group.items) { - var items = group.items, - m = items.length; - - for (var j = 0; j < m; ++j) { - bounds.union(items[j].bounds); - } - } - - if ((group.clip || group.width || group.height) && !group.noBound) { - bounds.add(0, 0).add(group.width || 0, group.height || 0); - } - - boundStroke(bounds, group); - return bounds.translate(group.x || 0, group.y || 0); - } - - function rectanglePath(context, group, x, y) { - var off = offset$1(group); - context.beginPath(); - rectangle(context, group, (x || 0) + off, (y || 0) + off); - } - - var hitBackground = hitPath(rectanglePath); - var hitForeground = hitPath(rectanglePath, false); - - function draw(context, scene, bounds) { - var _this10 = this; - - visit(scene, function (group) { - var gx = group.x || 0, - gy = group.y || 0, - fore = group.strokeForeground, - opacity = group.opacity == null ? 1 : group.opacity; // draw group background - - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - - if (group.fill && fill(context, group, opacity)) { - context.fill(); - } - - if (group.stroke && !fore && stroke(context, group, opacity)) { - context.stroke(); - } - } // setup graphics context, set clip and bounds - - - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); // draw group contents - - visit(group, function (item) { - _this10.draw(context, item, bounds); - }); // restore graphics context - - if (bounds) bounds.translate(gx, gy); - context.restore(); // draw group foreground - - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - - if (stroke(context, group, opacity)) { - context.stroke(); - } - } - }); - } - - function pick$1(context, scene, x, y, gx, gy) { - var _this11 = this; - - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { - return null; - } - - var cx = x * context.pixelRatio, - cy = y * context.pixelRatio; - return pickVisit(scene, function (group) { - var hit, fore, ix, dx, dy, dw, dh, b, c; // first hit test bounding box - - b = group.bounds; - if (b && !b.contains(gx, gy)) return; // passed bounds check, test rectangular clip - - dx = group.x || 0; - dy = group.y || 0; - dw = dx + (group.width || 0); - dh = dy + (group.height || 0); - c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; // adjust coordinate system - - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; // test background for rounded corner clip - - if (c && hasCornerRadius(group) && !hitBackground(context, group, cx, cy)) { - context.restore(); - return null; - } - - fore = group.strokeForeground; - ix = scene.interactive !== false; // hit test against group foreground - - if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } // hit test against contained marks - - - hit = pickVisit(group, function (mark) { - return pickMark(mark, dx, dy) ? _this11.pick(mark, x, y, dx, dy) : null; - }); // hit test against group background - - if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) { - hit = group; - } // restore state and return - - - context.restore(); - return hit || null; - }); - } - - function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y); - } - - var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1, - isect: intersectRect, - content: content, - background: background, - foreground: foreground - }; - var metadata = { - 'version': '1.1', - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink' - }; - - function getImage(item, renderer) { - var image = item.image; - - if (!image || item.url && item.url !== image.url) { - image = { - complete: false, - width: 0, - height: 0 - }; - renderer.loadImage(item.url).then(function (image) { - item.image = image; - item.image.url = item.url; - }); - } - - return image; - } - - function imageWidth(item, image) { - return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width; - } - - function imageHeight(item, image) { - return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height; - } - - function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; - } - - function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; - } - - function attr$1(emit, item, renderer) { - var img = getImage(item, renderer), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); - } - - function bound$1(bounds, item) { - var img = item.image, - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h); - return bounds.set(x, y, x + w, y + h); - } - - function draw$1(context, scene, bounds) { - var _this12 = this; - - visit(scene, function (item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - var img = getImage(item, _this12), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - opacity, - ar0, - ar1, - t; - - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); - } - - var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick(), - isect: truthy, - // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset - }; - var line$1 = markMultiItemPath('line', line, pickLine); - - function attr$2(emit, item) { - var sx = item.scaleX || 1, - sy = item.scaleY || 1; - - if (sx !== 1 || sy !== 1) { - emit('vector-effect', 'non-scaling-stroke'); - } - - emit('transform', transformItem(item)); - emit('d', item.path); - } - - function path(context, item) { - var path = item.path; - if (path == null) return true; - var x = item.x || 0, - y = item.y || 0, - sx = item.scaleX || 1, - sy = item.scaleY || 1, - a = (item.angle || 0) * DegToRad, - cache = item.pathCache; - - if (!cache || cache.path !== path) { - (item.pathCache = cache = pathParse(path)).path = path; - } - - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else { - pathRender(context, cache, x, y, sx, sy); - } - } - - function bound$2(bounds, item) { - path(context(bounds), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, item.x || 0, item.y || 0); - } - - return bounds; - } - - var path$1 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(path), - pick: pickPath(path), - isect: intersectPath(path) - }; - - function attr$3(emit, item) { - emit('d', rectangle(null, item)); - } - - function bound$3(bounds, item) { - var x, y; - return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item); - } - - function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); - } - - var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect - }; - - function attr$4(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); - } - - function bound$4(bounds, item) { - var x1, y1; - return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item); - } - - function path$2(context, item, opacity) { - var x1, y1, x2, y2; - - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - - return false; - } - - function draw$3(context, scene, bounds) { - visit(scene, function (item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - var opacity = item.opacity == null ? 1 : item.opacity; - - if (opacity && path$2(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); - } - - function hit(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path$2(context, item, 1) && context.isPointInStroke(x, y); - } - - var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick(hit), - isect: intersectRule - }; - var shape$1 = markItemPath('shape', shape); - var symbol$1 = markItemPath('symbol', symbol, intersectPoint); // memoize text width measurement - - var widthCache = lruCache(); - var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas - }; - useCanvas(true); - - function useCanvas(use) { - textMetrics.width = use && context$1 ? measureWidth : estimateWidth; - } // make dumb, simple estimate if no canvas is available - - - function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); - } - - function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); - } // measure text width if canvas is available - - - function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item)); - } - - function _measureWidth(text, currentFont) { - var key = "(".concat(currentFont, ") ").concat(text); - var width = widthCache.get(key); - - if (width === undefined) { - context$1.font = currentFont; - width = context$1.measureText(text).width; - widthCache.set(key, width); - } - - return width; - } - - function fontSize(item) { - return item.fontSize != null ? +item.fontSize || 0 : 11; - } - - function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; - } - - function lineArray(_) { - return isArray(_) ? _.length > 1 ? _ : _[0] : _; - } - - function textLines(item) { - return lineArray(item.lineBreak && item.text && !isArray(item.text) ? item.text.split(item.lineBreak) : item.text); - } - - function multiLineOffset(item) { - var tl = textLines(item); - return (isArray(tl) ? tl.length - 1 : 0) * lineHeight(item); - } - - function textValue(item, line) { - var text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate$1(item, text) : text; - } - - function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - var currentFont = font(item); - return function (text) { - return _measureWidth(text, currentFont); - }; - } else { - // we are relying on estimates - var currentFontHeight = fontSize(item); - return function (text) { - return _estimateWidth(text, currentFontHeight); - }; - } - } - - function truncate$1(item, text) { - var limit = +item.limit, - width = widthGetter(item); - if (width(text) < limit) return text; - var ellipsis = item.ellipsis || "\u2026", - rtl = item.dir === 'rtl', - lo = 0, - hi = text.length, - mid; - limit -= width(ellipsis); - - if (rtl) { - while (lo < hi) { - mid = lo + hi >>> 1; - if (width(text.slice(mid)) > limit) lo = mid + 1;else hi = mid; - } - - return ellipsis + text.slice(lo); - } else { - while (lo < hi) { - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid;else hi = mid - 1; - } - - return text.slice(0, lo) + ellipsis; - } - } - - function fontFamily(item, quote) { - var font = item.font; - return (quote && font ? String(font).replace(/"/g, '\'') : font) || 'sans-serif'; - } - - function font(item, quote) { - return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote); - } - - function offset$2(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, - h = fontSize(item); - return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0); - } - - var textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' - }; - var tempBounds = new Bounds(); - - function anchorPoint(item) { - var x = item.x || 0, - y = item.y || 0, - r = item.radius || 0, - t; - - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; - } - - function attr$5(emit, item) { - var dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item), - p = anchorPoint(item), - x = p.x1, - y = p.y1, - a = item.angle || 0, - t; - emit('text-anchor', textAlign[item.align] || 'start'); - - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else { - t = translate(x + dx, y + dy); - } - - emit('transform', t); - } - - function bound$5(bounds, item, mode) { - var h = textMetrics.height(item), - a = item.align, - p = anchorPoint(item), - x = p.x1, - y = p.y1, - dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item) - Math.round(0.8 * h), - // use 4/5 offset - tl = textLines(item), - w; // get dimensions - - if (isArray(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce(function (w, t) { - return Math.max(w, textMetrics.width(item, t)); - }, 0); - } else { - // single-line text - w = textMetrics.width(item, tl); - } // horizontal alignment - - - if (a === 'center') { - dx -= w / 2; - } else if (a === 'right') { - dx -= w; - } - - bounds.set(dx += x, dy += y, dx + w, dy + h); - - if (item.angle && !mode) { - bounds.rotate(item.angle * DegToRad, x, y); - } else if (mode === 2) { - return bounds.rotatedPoints(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw$4(context, scene, bounds) { - visit(scene, function (item) { - var opacity = item.opacity == null ? 1 : item.opacity, - p, - x, - y, - i, - lh, - tl, - str; - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; - context.font = font(item); - context.textAlign = item.align || 'left'; - p = anchorPoint(item); - x = p.x1, y = p.y1; - - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - - x += item.dx || 0; - y += (item.dy || 0) + offset$2(item); - tl = textLines(item); - blend(context, item); - - if (isArray(tl)) { - lh = lineHeight(item); - - for (i = 0; i < tl.length; ++i) { - str = textValue(item, tl[i]); - - if (item.fill && fill(context, item, opacity)) { - context.fillText(str, x, y); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.strokeText(str, x, y); - } - - y += lh; - } - } else { - str = textValue(item, tl); - - if (item.fill && fill(context, item, opacity)) { - context.fillText(str, x, y); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.strokeText(str, x, y); - } - } - - if (item.angle) context.restore(); - }); - } - - function hit$1(context, item, x, y, gx, gy) { - if (item.fontSize <= 0) return false; - if (!item.angle) return true; // bounds sufficient if no rotation - // project point into space of unrotated bounds - - var p = anchorPoint(item), - ax = p.x1, - ay = p.y1, - b = bound$5(tempBounds, item, 1), - a = -item.angle * DegToRad, - cos = Math.cos(a), - sin = Math.sin(a), - px = cos * gx - sin * gy + (ax - cos * ax + sin * ay), - py = sin * gx + cos * gy + (ay - sin * ax - cos * ay); - return b.contains(px, py); - } - - function intersectText(item, box) { - var p = bound$5(tempBounds, item, 2); - return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]); - } - - var text = { - type: 'text', - tag: 'text', - nested: false, - attr: attr$5, - bound: bound$5, - draw: draw$4, - pick: pick(hit$1), - isect: intersectText - }; - var trail$1 = markMultiItemPath('trail', trail, pickTrail); - var Marks = { - arc: arc$1, - area: area$1, - group: group, - image: image, - line: line$1, - path: path$1, - rect: rect, - rule: rule, - shape: shape$1, - symbol: symbol$1, - text: text, - trail: trail$1 - }; - - function boundItem(item, func, opt) { - var type = Marks[item.mark.marktype], - bound = func || type.bound; - if (type.nested) item = item.mark; - return bound(item.bounds || (item.bounds = new Bounds()), item, opt); - } - - var DUMMY = { - mark: null - }; - - function boundMark(mark, bounds, opt) { - var type = Marks[mark.marktype], - bound = type.bound, - items = mark.items, - hasItems = items && items.length, - i, - n, - item, - b; - - if (type.nested) { - if (hasItems) { - item = items[0]; - } else { - // no items, fake it - DUMMY.mark = mark; - item = DUMMY; - } - - b = boundItem(item, bound, opt); - bounds = bounds && bounds.union(b) || b; - return bounds; - } - - bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds(); - - if (hasItems) { - for (i = 0, n = items.length; i < n; ++i) { - bounds.union(boundItem(items[i], bound, opt)); - } - } - - return mark.bounds = bounds; - } - - var keys = ['marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', 'x', 'y', 'width', 'height', 'align', 'baseline', // layout - 'fill', 'fillOpacity', 'opacity', 'blend', // fill - 'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap', // stroke - 'strokeDash', 'strokeDashOffset', // stroke dash - 'strokeForeground', 'strokeOffset', // group - 'startAngle', 'endAngle', 'innerRadius', 'outerRadius', // arc - 'cornerRadius', 'padAngle', // arc, rect - 'cornerRadiusTopLeft', 'cornerRadiusTopRight', // rect, group - 'cornerRadiusBottomLeft', 'cornerRadiusBottomRight', 'interpolate', 'tension', 'orient', 'defined', // area, line - 'url', 'aspect', 'smooth', // image - 'path', 'scaleX', 'scaleY', // path - 'x2', 'y2', // rule - 'size', 'shape', // symbol - 'text', 'angle', 'theta', 'radius', 'dir', 'dx', 'dy', // text - 'ellipsis', 'limit', 'lineBreak', 'lineHeight', 'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant', // font - 'description', 'aria', 'ariaRole', 'ariaRoleDescription' // aria - ]; - - function sceneToJSON(scene, indent) { - return JSON.stringify(scene, keys, indent); - } - - function sceneFromJSON(json) { - var scene = typeof json === 'string' ? JSON.parse(json) : json; - return initialize(scene); - } - - function initialize(scene) { - var type = scene.marktype, - items = scene.items, - parent, - i, - n; - - if (items) { - for (i = 0, n = items.length; i < n; ++i) { - parent = type ? 'mark' : 'group'; - items[i][parent] = scene; - if (items[i].zindex) items[i][parent].zdirty = true; - if ('group' === (type || parent)) initialize(items[i]); - } - } - - if (type) boundMark(scene); - return scene; - } - - function Scenegraph(scene) { - if (arguments.length) { - this.root = sceneFromJSON(scene); - } else { - this.root = createMark({ - marktype: 'group', - name: 'root', - role: 'frame' - }); - this.root.items = [new GroupItem(this.root)]; - } - } - - var prototype$I = Scenegraph.prototype; - - prototype$I.toJSON = function (indent) { - return sceneToJSON(this.root, indent || 0); - }; - - prototype$I.mark = function (markdef, group, index) { - group = group || this.root.items[0]; - var mark = createMark(markdef, group); - group.items[index] = mark; - if (mark.zindex) mark.group.zdirty = true; - return mark; - }; - - function createMark(def, group) { - var mark = { - bounds: new Bounds(), - clip: !!def.clip, - group: group, - interactive: def.interactive === false ? false : true, - items: [], - marktype: def.marktype, - name: def.name || undefined, - role: def.role || undefined, - zindex: def.zindex || 0 - }; // add accessibility properties if defined - - if (def.aria != null) { - mark.aria = def.aria; - } - - if (def.description) { - mark.description = def.description; - } - - return mark; - } // create a new DOM element - - - function domCreate(doc, tag, ns) { - if (!doc && typeof document !== 'undefined' && document.createElement) { - doc = document; - } - - return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; - } // find first child element with matching tag - - - function domFind(el, tag) { - tag = tag.toLowerCase(); - var nodes = el.childNodes, - i = 0, - n = nodes.length; - - for (; i < n; ++i) { - if (nodes[i].tagName.toLowerCase() === tag) { - return nodes[i]; - } - } - } // retrieve child element at given index - // create & insert if doesn't exist or if tags do not match - - - function domChild(el, index, tag, ns) { - var a = el.childNodes[index], - b; - - if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) { - b = a || null; - a = domCreate(el.ownerDocument, tag, ns); - el.insertBefore(a, b); - } - - return a; - } // remove all child elements at or above the given index - - - function domClear(el, index) { - var nodes = el.childNodes, - curr = nodes.length; - - while (curr > index) { - el.removeChild(nodes[--curr]); - } - - return el; - } // generate css class name for mark - - - function cssClass(mark) { - return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : ''); - } - - function point(event, el) { - var rect = el.getBoundingClientRect(); - return [event.clientX - rect.left - (el.clientLeft || 0), event.clientY - rect.top - (el.clientTop || 0)]; - } - - function resolveItem(item, event, el, origin) { - var mark = item && item.mark, - mdef, - p; - - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - - while (item = item.mark.group) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - - item = mdef.tip(mark.items, p); - } - - return item; - } - /** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ - - - function Handler(customLoader, customTooltip) { - this._active = null; - this._handlers = {}; - this._loader = customLoader || loader(); - this._tooltip = customTooltip || defaultTooltip; - } // The default tooltip display handler. - // Sets the HTML title attribute on the visualization container. - - - function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); - } - - var prototype$J = Handler.prototype; - /** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ - - prototype$J.initialize = function (el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); - }; - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - - - prototype$J.element = function () { - return this._el; - }; - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - - - prototype$J.canvas = function () { - return this._el && this._el.firstChild; - }; - /** - * Get / set the origin coordinates of the visualization. - */ - - - prototype$J.origin = function (origin) { - if (arguments.length) { - this._origin = origin || [0, 0]; - return this; - } else { - return this._origin.slice(); - } - }; - /** - * Get / set the scenegraph root. - */ - - - prototype$J.scene = function (scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; - }; - /** - * Add an event handler. Subclasses should override this method. - */ - - - prototype$J.on = function () - /*type, handler*/ - {}; - /** - * Remove an event handler. Subclasses should override this method. - */ - - - prototype$J.off = function () - /*type, handler*/ - {}; - /** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ - - - prototype$J._handlerIndex = function (h, type, handler) { - for (var i = h ? h.length : 0; --i >= 0;) { - if (h[i].type === type && (!handler || h[i].handler === handler)) { - return i; - } - } - - return -1; - }; - /** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ - - - prototype$J.handlers = function (type) { - var h = this._handlers, - a = []; - - if (type) { - a.push.apply(a, h[this.eventName(type)]); - } else { - for (var k in h) { - a.push.apply(a, h[k]); - } - } - - return a; - }; - /** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ - - - prototype$J.eventName = function (name) { - var i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); - }; - /** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ - - - prototype$J.handleHref = function (event, item, href) { - this._loader.sanitize(href, { - context: 'href' - }).then(function (opt) { - var e = new MouseEvent(event.type, event), - a = domCreate(null, 'a'); - - for (var name in opt) { - a.setAttribute(name, opt[name]); - } - - a.dispatchEvent(e); - }).catch(function () { - /* do nothing */ - }); - }; - /** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ - - - prototype$J.handleTooltip = function (event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - - var _value16 = show && item && item.tooltip || null; - - this._tooltip.call(this._obj, this, event, item, _value16); - } - }; - /** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ - - - prototype$J.getItemBoundingClientRect = function (item) { - var el = this.canvas(); - if (!el) return; - var rect = el.getBoundingClientRect(), - origin = this._origin, - bounds = item.bounds, - width = bounds.width(), - height = bounds.height(); - var x = bounds.x1 + origin[0] + rect.left, - y = bounds.y1 + origin[1] + rect.top; // translate coordinate for each parent group - - while (item.mark && (item = item.mark.group)) { - x += item.x || 0; - y += item.y || 0; - } // return DOMRect-compatible bounding box - - - return { - x: x, - y: y, - width: width, - height: height, - left: x, - top: y, - right: x + width, - bottom: y + height - }; - }; - /** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ - - - function Renderer(loader) { - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); - } - - var prototype$K = Renderer.prototype; - /** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ - - prototype$K.initialize = function (el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); - }; - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - - - prototype$K.element = function () { - return this._el; - }; - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - - - prototype$K.canvas = function () { - return this._el && this._el.firstChild; - }; - /** - * Get / set the background color. - */ - - - prototype$K.background = function (bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; - }; - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ - - - prototype$K.resize = function (width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [0, 0]; - this._scale = scaleFactor || 1; - return this; - }; - /** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ - - - prototype$K.dirty = function () - /*item*/ - {}; - /** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Renderer} - This renderer instance. - */ - - - prototype$K.render = function (scene) { - var r = this; // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - - r._call = function () { - r._render(scene); - }; // invoke the renderer - - - r._call(); // clear the cached call for garbage collection - // async redraws will stash their own copy - - - r._call = null; - return r; - }; - /** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - */ - - - prototype$K._render = function () - /*scene*/ - {// subclasses to override - }; - /** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Promise} - A Promise that resolves when rendering is complete. - */ - - - prototype$K.renderAsync = function (scene) { - var r = this.render(scene); - return this._ready ? this._ready.then(function () { - return r; - }) : Promise.resolve(r); - }; - /** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ - - - prototype$K._load = function (method, uri) { - var r = this, - p = r._loader[method](uri); - - if (!r._ready) { - // re-render the scene when loading completes - var call = r._call; - r._ready = r._loader.ready().then(function (redraw) { - if (redraw) call(); - r._ready = null; - }); - } - - return p; - }; - /** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ - - - prototype$K.sanitizeURL = function (uri) { - return this._load('sanitizeURL', uri); - }; - /** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ - - - prototype$K.loadImage = function (uri) { - return this._load('loadImage', uri); - }; - - var KeyDownEvent = 'keydown'; - var KeyPressEvent = 'keypress'; - var KeyUpEvent = 'keyup'; - var DragEnterEvent = 'dragenter'; - var DragLeaveEvent = 'dragleave'; - var DragOverEvent = 'dragover'; - var MouseDownEvent = 'mousedown'; - var MouseUpEvent = 'mouseup'; - var MouseMoveEvent = 'mousemove'; - var MouseOutEvent = 'mouseout'; - var MouseOverEvent = 'mouseover'; - var ClickEvent = 'click'; - var DoubleClickEvent = 'dblclick'; - var WheelEvent = 'wheel'; - var MouseWheelEvent = 'mousewheel'; - var TouchStartEvent = 'touchstart'; - var TouchMoveEvent = 'touchmove'; - var TouchEndEvent = 'touchend'; - var Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent]; - var TooltipShowEvent = MouseMoveEvent; - var TooltipHideEvent = MouseOutEvent; - var HrefEvent = ClickEvent; - - function CanvasHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; - } - - var prototype$L = inherits(CanvasHandler, Handler); - - prototype$L.initialize = function (el, origin, obj) { - var _this13 = this; - - this._canvas = el && domFind(el, 'canvas'); // add minimal events required for proper state management - - [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent].forEach(function (type) { - return eventListenerCheck(_this13, type); - }); - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - var eventBundle = function eventBundle(type) { - return type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type]; - }; // lazily add listeners to the canvas as needed - - - function eventListenerCheck(handler, type) { - eventBundle(type).forEach(function (_) { - return addEventListener(handler, _); - }); - } - - function addEventListener(handler, type) { - var canvas = handler.canvas(); - - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] ? function (evt) { - return handler[type](evt); - } : function (evt) { - return handler.fire(type, evt); - }); - } - } // return the backing canvas instance - - - prototype$L.canvas = function () { - return this._canvas; - }; // retrieve the current canvas context - - - prototype$L.context = function () { - return this._canvas.getContext('2d'); - }; // supported events - - - prototype$L.events = Events; - - function move(moveEvent, overEvent, outEvent) { - return function (evt) { - var a = this._active, - p = this.pickEvent(evt); - - if (p === a) { - // active item and picked item are the same - this.fire(moveEvent, evt); // fire move - } else { - // active item and picked item are different - if (!a || !a.exit) { - // fire out for prior active item - // suppress if active item was removed from scene - this.fire(outEvent, evt); - } - - this._active = p; // set new active item - - this.fire(overEvent, evt); // fire over for new active item - - this.fire(moveEvent, evt); // fire move for new active item - } - }; - } - - function inactive(type) { - return function (evt) { - this.fire(type, evt); - this._active = null; - }; - } // to keep old versions of firefox happy - - - prototype$L.DOMMouseScroll = function (evt) { - this.fire(MouseWheelEvent, evt); - }; - - prototype$L.mousemove = move(MouseMoveEvent, MouseOverEvent, MouseOutEvent); - prototype$L.dragover = move(DragOverEvent, DragEnterEvent, DragLeaveEvent); - prototype$L.mouseout = inactive(MouseOutEvent); - prototype$L.dragleave = inactive(DragLeaveEvent); - - prototype$L.mousedown = function (evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); - }; - - prototype$L.click = function (evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } - }; - - prototype$L.touchstart = function (evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - - if (this._first) { - this._active = this._touch; - this._first = false; - } - - this.fire(TouchStartEvent, evt, true); - }; - - prototype$L.touchmove = function (evt) { - this.fire(TouchMoveEvent, evt, true); - }; - - prototype$L.touchend = function (evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; - }; // fire an event - - - prototype$L.fire = function (type, evt, touch) { - var a = touch ? this._touch : this._active, - h = this._handlers[type]; // set event type relative to scenegraph items - - evt.vegaType = type; // handle hyperlinks and tooltips first - - if (type === HrefEvent && a && a.href) { - this.handleHref(evt, a, a.href); - } else if (type === TooltipShowEvent || type === TooltipHideEvent) { - this.handleTooltip(evt, a, type !== TooltipHideEvent); - } // invoke all registered handlers - - - if (h) { - for (var i = 0, len = h.length; i < len; ++i) { - h[i].handler.call(this._obj, evt, a); - } - } - }; // add an event handler - - - prototype$L.on = function (type, handler) { - var name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - eventListenerCheck(this, type); - (h[name] || (h[name] = [])).push({ - type: type, - handler: handler - }); - } - - return this; - }; // remove an event handler - - - prototype$L.off = function (type, handler) { - var name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - h.splice(i, 1); - } - - return this; - }; - - prototype$L.pickEvent = function (evt) { - var p = point(evt, this._canvas), - o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); - }; // find the scenegraph item at the current mouse position - // x, y -- the absolute x, y mouse coordinates on the canvas element - // gx, gy -- the relative coordinates within the current group - - - prototype$L.pick = function (scene, x, y, gx, gy) { - var g = this.context(), - mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); - }; - - function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; - } - - var pixelRatio = devicePixelRatio(); - - function resize(canvas, width, height, origin, scaleFactor, opt) { - var inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null, - context = canvas.getContext('2d'), - ratio = inDOM ? pixelRatio : scaleFactor; - canvas.width = width * ratio; - canvas.height = height * ratio; - - for (var _key4 in opt) { - context[_key4] = opt[_key4]; - } - - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - } - - context.pixelRatio = ratio; - context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); - return canvas; - } - - function CanvasRenderer(loader) { - Renderer.call(this, loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); - } - - var prototype$M = inherits(CanvasRenderer, Renderer), - base = Renderer.prototype; - - prototype$M.initialize = function (el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - this._canvas = this._options.externalContext ? null : domCanvas(1, 1, this._options.type); // instantiate a small canvas - - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - - this._canvas.setAttribute('class', 'marks'); - } // this method will invoke resize to size the canvas appropriately - - - return base.initialize.call(this, el, width, height, origin, scaleFactor); - }; - - prototype$M.resize = function (width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - - if (this._canvas) { - // configure canvas size and transform - resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); - } else { - // external context needs to be scaled and positioned to origin - var ctx = this._options.externalContext; - if (!ctx) error('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - - this._redraw = true; - return this; - }; - - prototype$M.canvas = function () { - return this._canvas; - }; - - prototype$M.context = function () { - return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null); - }; - - prototype$M.dirty = function (item) { - var b = this._tempb.clear().union(item.bounds), - g = item.mark.group; - - while (g) { - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; - } - - this._dirty.union(b); - }; - - function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); // align to base pixel grid in case of non-integer scaling (#2425) - - if (g.pixelRatio % 1) { - b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - } // to avoid artifacts translate if origin has fractional pixels - - - b.translate(-(origin[0] % 1), -(origin[1] % 1)); // set clip path - - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - return b; - } - - var viewBounds = function viewBounds(origin, width, height) { - return new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]); - }; - - prototype$M._render = function (scene) { - var g = this.context(), - o = this._origin, - w = this._width, - h = this._height, - db = this._dirty, - vb = viewBounds(o, w, h); // setup - - g.save(); - var b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); - this.clear(-o[0], -o[1], w, h); // render - - this.draw(g, scene, b); // takedown - - g.restore(); - db.clear(); - return this; - }; - - prototype$M.draw = function (ctx, scene, bounds) { - var mark = Marks[scene.marktype]; - if (scene.clip) clip$1(ctx, scene); - mark.draw.call(this, ctx, scene, bounds); - if (scene.clip) ctx.restore(); - }; - - prototype$M.clear = function (x, y, w, h) { - var opt = this._options, - g = this.context(); - - if (opt.type !== 'pdf' && !opt.externalContext) { - // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - } - - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } - }; - - function SVGHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - var h = this; - h._hrefHandler = listener(h, function (evt, item) { - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, function (evt, item) { - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); - }); - } - - var prototype$N = inherits(SVGHandler, Handler); - - prototype$N.initialize = function (el, origin, obj) { - var svg = this._svg; - - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - - this._svg = svg = el && domFind(el, 'svg'); - - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - prototype$N.canvas = function () { - return this._svg; - }; // wrap an event listener for the SVG DOM - - - var listener = function listener(context, handler) { - return function (evt) { - var item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; - }; // add an event handler - - - prototype$N.on = function (type, handler) { - var name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - var _x21 = { - type: type, - handler: handler, - listener: listener(this, handler) - }; - (h[name] || (h[name] = [])).push(_x21); - - if (this._svg) { - this._svg.addEventListener(name, _x21.listener); - } - } - - return this; - }; // remove an event handler - - - prototype$N.off = function (type, handler) { - var name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - if (this._svg) { - this._svg.removeEventListener(name, h[i].listener); - } - - h.splice(i, 1); - } - - return this; - }; - - function bandSpace(count, paddingInner, paddingOuter) { - var space = count - paddingInner + paddingOuter * 2; - return count ? space > 0 ? space : 1 : 0; - } - - var Identity = 'identity'; - var Linear = 'linear'; - var Log = 'log'; - var Pow = 'pow'; - var Sqrt = 'sqrt'; - var Symlog = 'symlog'; - var Time = 'time'; - var UTC = 'utc'; - var Sequential = 'sequential'; - var Diverging = 'diverging'; - var Quantile$1 = 'quantile'; - var Quantize = 'quantize'; - var Threshold = 'threshold'; - var Ordinal = 'ordinal'; - var Point = 'point'; - var Band = 'band'; - var BinOrdinal = 'bin-ordinal'; // categories - - var Continuous = 'continuous'; - var Discrete = 'discrete'; - var Discretizing = 'discretizing'; - var Interpolating = 'interpolating'; - var Temporal = 'temporal'; - - function invertRange(scale) { - return function (_) { - var lo = _[0], - hi = _[1], - t; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - return [scale.invert(lo), scale.invert(hi)]; - }; - } - - function invertRangeExtent(scale) { - return function (_) { - var range = scale.range(), - lo = _[0], - hi = _[1], - min = -1, - max, - t, - i, - n; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - for (i = 0, n = range.length; i < n; ++i) { - if (range[i] >= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - } - - if (min < 0) return undefined; - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - return [lo[0] === undefined ? lo[1] : lo[0], hi[1] === undefined ? hi[0] : hi[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: - { - if (typeof domain === "function") this.interpolator(domain);else this.range(domain); - break; - } - - default: - { - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator);else this.range(interpolator); - break; - } - } - - return this; - } - - var implicit = Symbol("implicit"); - - function ordinal() { - var index = new Map(), - domain = [], - range = [], - unknown = implicit; - - function scale(d) { - var key = d + "", - i = index.get(key); - - if (!i) { - if (unknown !== implicit) return unknown; - index.set(key, i = domain.push(d)); - } - - return range[(i - 1) % range.length]; - } - - scale.domain = function (_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new Map(); - - var _iterator18 = _createForOfIteratorHelper(_), - _step18; - - try { - for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) { - var _value17 = _step18.value; - - var _key5 = _value17 + ""; - - if (index.has(_key5)) continue; - index.set(_key5, domain.push(_value17)); - } - } catch (err) { - _iterator18.e(err); - } finally { - _iterator18.f(); - } - - return scale; - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function () { - return ordinal(domain, range).unknown(unknown); - }; - - initRange.apply(scale, arguments); - return scale; - } - - function constant$1(x) { - return function () { - return x; - }; - } - - function number$2(x) { - return +x; - } - - var unit = [0, 1]; - - function identity$1(x) { - return x; - } - - function normalize(a, b) { - return (b -= a = +a) ? function (x) { - return (x - a) / b; - } : constant$1(isNaN(b) ? NaN : 0.5); - } - - function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = 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 corresponding parameter t in [0,1]. - // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. - - - function bimap(domain, range, interpolate) { - var d0 = domain[0], - d1 = domain[1], - r0 = range[0], - r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function (x) { - return r0(d0(x)); - }; - } - - function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, - d = new Array(j), - r = new Array(j), - i = -1; // Reverse descending domains. - - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - - while (++i < j) { - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - - return function (x) { - var i = 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() { - var domain = unit, - range = unit, - interpolate = $$1.interpolate, - transform, - untransform, - unknown, - clamp = identity$1, - piecewise, - output, - input; - - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); - } - - scale.invert = function (y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), $$1.interpolateNumber)))(y))); - }; - - scale.domain = function (_) { - return arguments.length ? (domain = Array.from(_, number$2), rescale()) : domain.slice(); - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.rangeRound = function (_) { - return range = Array.from(_), interpolate = $$1.interpolateRound, rescale(); - }; - - scale.clamp = function (_) { - return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1; - }; - - scale.interpolate = function (_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function (t, u) { - transform = t, untransform = u; - return rescale(); - }; - } - - function continuous() { - return transformer()(identity$1, identity$1); - } - - function tickFormat(start, stop, count, specifier) { - var step = tickStep(start, stop, count), - precision; - specifier = d3Format.formatSpecifier(specifier == null ? ",f" : specifier); - - switch (specifier.type) { - case "s": - { - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = d3Format.precisionPrefix(step, value))) specifier.precision = precision; - return d3Format.formatPrefix(specifier, value); - } - - case "": - case "e": - case "g": - case "p": - case "r": - { - if (specifier.precision == null && !isNaN(precision = d3Format.precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - } - - case "f": - case "%": - { - if (specifier.precision == null && !isNaN(precision = d3Format.precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - - return d3Format.format(specifier); - } - - function linearish(scale) { - var domain = scale.domain; - - scale.ticks = function (count) { - var d = domain(); - return ticks(d[0], d[d.length - 1], count == null ? 10 : count); - }; - - scale.tickFormat = function (count, specifier) { - var d = domain(); - return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - - scale.nice = function (count) { - if (count == null) count = 10; - var d = domain(), - i0 = 0, - i1 = d.length - 1, - start = d[i0], - stop = d[i1], - step; - - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - - step = tickIncrement(start, stop, count); - - if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - step = tickIncrement(start, stop, count); - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - step = tickIncrement(start, stop, count); - } - - if (step > 0) { - d[i0] = Math.floor(start / step) * step; - d[i1] = Math.ceil(stop / step) * step; - domain(d); - } else if (step < 0) { - d[i0] = Math.ceil(start * step) / step; - d[i1] = Math.floor(stop * step) / step; - domain(d); - } - - return scale; - }; - - return scale; - } - - function linear() { - var scale = continuous(); - - scale.copy = function () { - return copy(scale, linear()); - }; - - initRange.apply(scale, arguments); - return linearish(scale); - } - - function identity$2(domain) { - var unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : x; - } - - scale.invert = scale; - - scale.domain = scale.range = function (_) { - return arguments.length ? (domain = Array.from(_, number$2), scale) : domain.slice(); - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function () { - return identity$2(domain).unknown(unknown); - }; - - domain = arguments.length ? Array.from(domain, number$2) : [0, 1]; - return linearish(scale); - } - - function nice(domain, interval) { - domain = domain.slice(); - var i0 = 0, - i1 = domain.length - 1, - x0 = domain[i0], - x1 = domain[i1], - t; - - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - - domain[i0] = interval.floor(x0); - domain[i1] = 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 === 10 ? pow10 : base === Math.E ? Math.exp : function (x) { - return Math.pow(base, x); - }; - } - - function logp(base) { - return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), function (x) { - return Math.log(x) / base; - }); - } - - function reflect(f) { - return function (x) { - return -f(-x); - }; - } - - function loggish(transform) { - var scale = transform(transformLog, transformExp), - domain = scale.domain, - base = 10, - logs, - pows; - - function rescale() { - logs = logp(base), pows = powp(base); - - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else { - transform(transformLog, transformExp); - } - - return scale; - } - - scale.base = function (_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - - scale.domain = function (_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.ticks = function (count) { - var d = domain(), - u = d[0], - v = d[d.length - 1], - r; - if (r = v < u) i = u, u = v, v = i; - var i = logs(u), - j = logs(v), - p, - k, - t, - n = count == null ? 10 : +count, - z = []; - - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for (; i <= j; ++i) { - for (k = 1, p = pows(i); k < base; ++k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } else for (; i <= j; ++i) { - for (k = base - 1, p = pows(i); k >= 1; --k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } - if (z.length * 2 < n) z = ticks(u, v, n); - } else { - z = ticks(i, j, Math.min(j - i, n)).map(pows); - } - - return r ? z.reverse() : z; - }; - - scale.tickFormat = function (count, specifier) { - if (specifier == null) specifier = base === 10 ? ".0e" : ","; - if (typeof specifier !== "function") specifier = d3Format.format(specifier); - if (count === Infinity) return specifier; - if (count == null) count = 10; - var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - - return function (d) { - var i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; - }; - - scale.nice = function () { - return domain(nice(domain(), { - floor: function floor(x) { - return pows(Math.floor(logs(x))); - }, - ceil: function ceil(x) { - return pows(Math.ceil(logs(x))); - } - })); - }; - - return scale; - } - - function log$2() { - var scale = loggish(transformer()).domain([1, 10]); - - scale.copy = function () { - return copy(scale, log$2()).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 = 1, - scale = transform(transformSymlog(c), transformSymexp(c)); - - scale.constant = function (_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - - return linearish(scale); - } - - function symlog$1() { - var scale = symlogish(transformer()); - - scale.copy = function () { - return copy(scale, symlog$1()).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 = transform(identity$1, identity$1), - exponent = 1; - - function rescale() { - return exponent === 1 ? transform(identity$1, identity$1) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); - } - - scale.exponent = function (_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - - return linearish(scale); - } - - function pow$1() { - var scale = powish(transformer()); - - scale.copy = function () { - return copy(scale, pow$1()).exponent(scale.exponent()); - }; - - initRange.apply(scale, arguments); - return scale; - } - - function sqrt() { - return pow$1.apply(null, arguments).exponent(0.5); - } - - function quantile$1() { - var domain = [], - range = [], - thresholds = [], - unknown; - - function rescale() { - var i = 0, - n = Math.max(1, range.length); - thresholds = new Array(n - 1); - - while (++i < n) { - thresholds[i - 1] = quantile(domain, i / n); - } - - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : range[bisectRight(thresholds, x)]; - } - - scale.invertExtent = function (y) { - var i = 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 = function (_) { - if (!arguments.length) return domain.slice(); - domain = []; - - var _iterator19 = _createForOfIteratorHelper(_), - _step19; - - try { - for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) { - var d = _step19.value; - if (d != null && !isNaN(d = +d)) domain.push(d); - } - } catch (err) { - _iterator19.e(err); - } finally { - _iterator19.f(); - } - - domain.sort(ascending); - return rescale(); - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.quantiles = function () { - return thresholds.slice(); - }; - - scale.copy = function () { - return quantile$1().domain(domain).range(range).unknown(unknown); - }; - - return initRange.apply(scale, arguments); - } - - function quantize() { - var x0 = 0, - x1 = 1, - n = 1, - domain = [0.5], - range = [0, 1], - unknown; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - function rescale() { - var i = -1; - domain = new Array(n); - - while (++i < n) { - domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - } - - return scale; - } - - scale.domain = function (_) { - var _ref3, _ref4; - - return arguments.length ? ((_ref3 = _, _ref4 = _slicedToArray(_ref3, 2), x0 = _ref4[0], x1 = _ref4[1], _ref3), x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; - }; - - scale.range = function (_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - - scale.invertExtent = function (y) { - var i = range.indexOf(y); - return i < 0 ? [NaN, NaN] : i < 1 ? [x0, domain[0]] : i >= n ? [domain[n - 1], x1] : [domain[i - 1], domain[i]]; - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - - scale.thresholds = function () { - return domain.slice(); - }; - - scale.copy = function () { - return quantize().domain([x0, x1]).range(range).unknown(unknown); - }; - - return initRange.apply(linearish(scale), arguments); - } - - function threshold() { - var domain = [0.5], - range = [0, 1], - unknown, - n = 1; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - scale.domain = function (_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - - scale.invertExtent = function (y) { - var i = range.indexOf(y); - return [domain[i - 1], domain[i]]; - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function () { - return threshold().domain(domain).range(range).unknown(unknown); - }; - - return initRange.apply(scale, arguments); - } - - var durationSecond$1 = 1000, - durationMinute$1 = durationSecond$1 * 60, - durationHour$1 = durationMinute$1 * 60, - durationDay$1 = durationHour$1 * 24, - durationWeek$1 = durationDay$1 * 7, - durationMonth$1 = durationDay$1 * 30, - durationYear$1 = durationDay$1 * 365; - - function date(t) { - return new Date(t); - } - - function number$3(t) { - return t instanceof Date ? +t : +new Date(+t); - } - - function calendar(year, month, week, day, hour, minute, second, millisecond, format) { - var scale = continuous(), - invert = scale.invert, - domain = scale.domain; - var formatMillisecond = format(".%L"), - formatSecond = format(":%S"), - formatMinute = format("%I:%M"), - formatHour = format("%I %p"), - formatDay = format("%a %d"), - formatWeek = format("%b %d"), - formatMonth = format("%B"), - formatYear = format("%Y"); - var tickIntervals = [[second, 1, durationSecond$1], [second, 5, 5 * durationSecond$1], [second, 15, 15 * durationSecond$1], [second, 30, 30 * durationSecond$1], [minute, 1, durationMinute$1], [minute, 5, 5 * durationMinute$1], [minute, 15, 15 * durationMinute$1], [minute, 30, 30 * durationMinute$1], [hour, 1, durationHour$1], [hour, 3, 3 * durationHour$1], [hour, 6, 6 * durationHour$1], [hour, 12, 12 * durationHour$1], [day, 1, durationDay$1], [day, 2, 2 * durationDay$1], [week, 1, durationWeek$1], [month, 1, durationMonth$1], [month, 3, 3 * durationMonth$1], [year, 1, durationYear$1]]; - - function tickFormat(date) { - return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? week(date) < date ? formatDay : formatWeek : year(date) < date ? formatMonth : formatYear)(date); - } - - function tickInterval(interval, start, stop) { - if (interval == null) interval = 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 === "number") { - var target = Math.abs(stop - start) / interval, - i = bisector(function (i) { - return i[2]; - }).right(tickIntervals, target), - step; - - if (i === tickIntervals.length) { - step = tickStep(start / durationYear$1, stop / durationYear$1, interval); - interval = year; - } else if (i) { - i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - step = i[1]; - interval = i[0]; - } else { - step = Math.max(tickStep(start, stop, interval), 1); - interval = millisecond; - } - - return interval.every(step); - } - - return interval; - } - - scale.invert = function (y) { - return new Date(invert(y)); - }; - - scale.domain = function (_) { - return arguments.length ? domain(Array.from(_, number$3)) : domain().map(date); - }; - - scale.ticks = function (interval) { - var d = domain(), - t0 = d[0], - t1 = d[d.length - 1], - r = t1 < t0, - t; - if (r) t = t0, t0 = t1, t1 = t; - t = tickInterval(interval, t0, t1); - t = t ? t.range(t0, t1 + 1) : []; // inclusive stop - - return r ? t.reverse() : t; - }; - - scale.tickFormat = function (count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - - scale.nice = function (interval) { - var d = domain(); - return (interval = tickInterval(interval, d[0], d[d.length - 1])) ? domain(nice(d, interval)) : scale; - }; - - scale.copy = function () { - return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); - }; - - return scale; - } - - function time() { - return initRange.apply(calendar(d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3Time.timeMillisecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); - } - - function utcTime() { - return initRange.apply(calendar(d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3Time.utcMillisecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); - } - - function transformer$1() { - var x0 = 0, - x1 = 1, - t0, - t1, - k10, - transform, - interpolator = identity$1, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function (_) { - var _ref5, _ref6; - - return arguments.length ? ((_ref5 = _, _ref6 = _slicedToArray(_ref5, 2), x0 = _ref6[0], x1 = _ref6[1], _ref5), t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; - }; - - scale.clamp = function (_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function (_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function (_) { - var _ref7, _ref8; - - var r0, r1; - return arguments.length ? ((_ref7 = _, _ref8 = _slicedToArray(_ref7, 2), r0 = _ref8[0], r1 = _ref8[1], _ref7), interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; - }; - } - - scale.range = range($$1.interpolate); - scale.rangeRound = range($$1.interpolateRound); - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function (t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === 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 = linearish(transformer$1()(identity$1)); - - scale.copy = function () { - return copy$1(scale, sequential()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialLog() { - var scale = loggish(transformer$1()).domain([1, 10]); - - scale.copy = function () { - return copy$1(scale, sequentialLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialSymlog() { - var scale = symlogish(transformer$1()); - - scale.copy = function () { - return copy$1(scale, sequentialSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialPow() { - var scale = powish(transformer$1()); - - scale.copy = 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 transformer$2() { - var x0 = 0, - x1 = 0.5, - x2 = 1, - s = 1, - t0, - t1, - t2, - k10, - k21, - interpolator = identity$1, - transform, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function (_) { - var _ref9, _ref10; - - return arguments.length ? ((_ref9 = _, _ref10 = _slicedToArray(_ref9, 3), x0 = _ref10[0], x1 = _ref10[1], x2 = _ref10[2], _ref9), t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2]; - }; - - scale.clamp = function (_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function (_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function (_) { - var _ref11, _ref12; - - var r0, r1, r2; - return arguments.length ? ((_ref11 = _, _ref12 = _slicedToArray(_ref11, 3), r0 = _ref12[0], r1 = _ref12[1], r2 = _ref12[2], _ref11), interpolator = $$1.piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - - scale.range = range($$1.interpolate); - scale.rangeRound = range($$1.interpolateRound); - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function (t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; - } - - function diverging() { - var scale = linearish(transformer$2()(identity$1)); - - scale.copy = function () { - return copy$1(scale, diverging()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingLog() { - var scale = loggish(transformer$2()).domain([0.1, 1, 10]); - - scale.copy = function () { - return copy$1(scale, divergingLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingSymlog() { - var scale = symlogish(transformer$2()); - - scale.copy = function () { - return copy$1(scale, divergingSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingPow() { - var scale = powish(transformer$2()); - - scale.copy = 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 band() { - var scale = ordinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - range = [0, 1], - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = range[1] < range[0], - start = range[reverse - 0], - stop = range[1 - reverse], - space = bandSpace(n, paddingInner, paddingOuter); - step = (stop - start) / (space || 1); - - if (round) { - step = Math.floor(step); - } - - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - - var values = sequence(n).map(function (i) { - return start + step * i; - }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function (_) { - if (arguments.length) { - domain(_); - return rescale(); - } else { - return domain(); - } - }; - - scale.range = function (_) { - if (arguments.length) { - range = [+_[0], +_[1]]; - return rescale(); - } else { - return range.slice(); - } - }; - - scale.rangeRound = function (_) { - range = [+_[0], +_[1]]; - round = true; - return rescale(); - }; - - scale.bandwidth = function () { - return bandwidth; - }; - - scale.step = function () { - return step; - }; - - scale.round = function (_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else { - return round; - } - }; - - scale.padding = function (_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingInner = function (_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingOuter = function (_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingOuter; - } - }; - - scale.align = function (_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return align; - } - }; - - scale.invertRange = function (_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - var lo = +_[0], - hi = +_[1], - reverse = range[1] < range[0], - values = reverse ? ordinalRange().reverse() : ordinalRange(), - n = values.length - 1, - a, - b, - t; // bail if either range endpoint is invalid - - if (lo !== lo || hi !== hi) return; // order range inputs, bail if outside of scale range - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - if (hi < values[0] || lo > range[1 - reverse]) return; // binary search to index into scale range - - a = Math.max(0, bisectRight(values, lo) - 1); - b = lo === hi ? a : bisectRight(values, hi) - 1; // increment index a if lo is within padding gap - - if (lo - values[a] > bandwidth + 1e-10) ++a; - - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - - return a > b ? undefined : domain().slice(a, b + 1); - }; - - scale.invert = function (_) { - var value = scale.invertRange([_, _]); - return value ? value[0] : value; - }; - - scale.copy = function () { - return band().domain(domain()).range(range).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); - }; - - return rescale(); - } - - function pointish(scale) { - var copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - - scale.copy = function () { - return pointish(copy()); - }; - - return scale; - } - - function point$1() { - return pointish(band().paddingInner(1)); - } - - var map = Array.prototype.map; - - function numbers$2(_) { - return map.call(_, function (x) { - return +x; - }); - } - - var slice = Array.prototype.slice; - - function scaleBinOrdinal() { - var domain = [], - range = []; - - function scale(x) { - return x == null || x !== x ? undefined : range[(bisectRight(domain, x) - 1) % range.length]; - } - - scale.domain = function (_) { - if (arguments.length) { - domain = numbers$2(_); - return scale; - } else { - return domain.slice(); - } - }; - - scale.range = function (_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else { - return range.slice(); - } - }; - - scale.tickFormat = function (count, specifier) { - return tickFormat(domain[0], peek(domain), count == null ? 10 : count, specifier); - }; - - scale.copy = function () { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - - return scale; - } // scale registry - - - var scales = {}; - /** - * Augment scales with their type and needed inverse methods. - */ - - function create(type, constructor, metadata) { - var ctr = function scale() { - var s = constructor(); - - if (!s.invertRange) { - s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined; - } - - s.type = type; - return s; - }; - - ctr.metadata = toSet(array(metadata)); - return ctr; - } - - function scale$2(type, scale, metadata) { - if (arguments.length > 1) { - scales[type] = create(type, scale, metadata); - return this; - } else { - return isValidScaleType(type) ? scales[type] : undefined; - } - } // identity scale - - - scale$2(Identity, identity$2); // continuous scales - - scale$2(Linear, linear, Continuous); - scale$2(Log, log$2, [Continuous, Log]); - scale$2(Pow, pow$1, Continuous); - scale$2(Sqrt, sqrt, Continuous); - scale$2(Symlog, symlog$1, Continuous); - scale$2(Time, time, [Continuous, Temporal]); - scale$2(UTC, utcTime, [Continuous, Temporal]); // sequential scales - - scale$2(Sequential, sequential, [Continuous, Interpolating]); // backwards compat - - scale$2("".concat(Sequential, "-").concat(Linear), sequential, [Continuous, Interpolating]); - scale$2("".concat(Sequential, "-").concat(Log), sequentialLog, [Continuous, Interpolating, Log]); - scale$2("".concat(Sequential, "-").concat(Pow), sequentialPow, [Continuous, Interpolating]); - scale$2("".concat(Sequential, "-").concat(Sqrt), sequentialSqrt, [Continuous, Interpolating]); - scale$2("".concat(Sequential, "-").concat(Symlog), sequentialSymlog, [Continuous, Interpolating]); // diverging scales - - scale$2("".concat(Diverging, "-").concat(Linear), diverging, [Continuous, Interpolating]); - scale$2("".concat(Diverging, "-").concat(Log), divergingLog, [Continuous, Interpolating, Log]); - scale$2("".concat(Diverging, "-").concat(Pow), divergingPow, [Continuous, Interpolating]); - scale$2("".concat(Diverging, "-").concat(Sqrt), divergingSqrt, [Continuous, Interpolating]); - scale$2("".concat(Diverging, "-").concat(Symlog), divergingSymlog, [Continuous, Interpolating]); // discretizing scales - - scale$2(Quantile$1, quantile$1, [Discretizing, Quantile$1]); - scale$2(Quantize, quantize, Discretizing); - scale$2(Threshold, threshold, Discretizing); // discrete scales - - scale$2(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]); - scale$2(Ordinal, ordinal, Discrete); - scale$2(Band, band, Discrete); - scale$2(Point, point$1, Discrete); - - function isValidScaleType(type) { - return hasOwnProperty(scales, type); - } - - function hasType(key, type) { - var s = scales[key]; - return s && s.metadata[type]; - } - - function isContinuous(key) { - return hasType(key, Continuous); - } - - function isDiscrete(key) { - return hasType(key, Discrete); - } - - function isDiscretizing(key) { - return hasType(key, Discretizing); - } - - function isLogarithmic(key) { - return hasType(key, Log); - } - - function isTemporal(key) { - return hasType(key, Temporal); - } - - function isInterpolating(key) { - return hasType(key, Interpolating); - } - - function isQuantile(key) { - return hasType(key, Quantile$1); - } - - var scaleProps = ['clamp', 'base', 'constant', 'exponent']; - - function interpolateRange(interpolator, range) { - var start = range[0], - span = peek(range) - start; - return function (i) { - return interpolator(start + i * span); - }; - } - - function interpolateColors(colors, type, gamma) { - return $$1.piecewise(interpolate(type || 'rgb', gamma), colors); - } - - function quantizeInterpolator(interpolator, count) { - var samples = new Array(count), - n = count + 1; - - for (var i = 0; i < count;) { - samples[i] = interpolator(++i / n); - } - - return samples; - } - - function scaleFraction(scale, min, max) { - var delta = max - min, - i, - t, - s; - - if (!delta || !Number.isFinite(delta)) { - return constant(0.5); - } else { - i = (t = scale.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale$2(t)().domain([min, max]).range([0, 1]); - scaleProps.forEach(function (m) { - return scale[m] ? s[m](scale[m]()) : 0; - }); - return s; - } - } - - function interpolate(type, gamma) { - var interp = $$1[method(type)]; - return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp; - } - - function method(type) { - return 'interpolate' + type.toLowerCase().split('-').map(function (s) { - return s[0].toUpperCase() + s.slice(1); - }).join(''); - } - - var continuous$1 = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' - }; - var discrete = { - category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', - accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', - dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', - paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', - pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', - pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', - set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', - set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', - set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' - }; - - function colors(palette) { - var n = palette.length / 6 | 0, - c = new Array(n), - i = 0; - - while (i < n) { - c[i] = '#' + palette.slice(i * 6, ++i * 6); - } - - return c; - } - - function apply(_, f) { - for (var k in _) { - scheme(k, f(_[k])); - } - } - - var schemes = {}; - apply(discrete, colors); - apply(continuous$1, function (_) { - return interpolateColors(colors(_)); - }); - - function scheme(name, scheme) { - name = name && name.toLowerCase(); - - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else { - return schemes[name]; - } - } - - var SymbolLegend = 'symbol'; - var DiscreteLegend = 'discrete'; - var GradientLegend = 'gradient'; - - var defaultFormatter = function defaultFormatter(value) { - return isArray(value) ? value.map(function (v) { - return String(v); - }) : String(value); - }; - - var ascending$1 = function ascending$1(a, b) { - return a[1] - b[1]; - }; - - var descending = function descending(a, b) { - return b[1] - a[1]; - }; - /** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ - - - function tickCount(scale, count, minStep) { - var step; - - if (isNumber(count)) { - if (scale.bins) { - count = Math.max(count, scale.bins.length); - } - - if (minStep != null) { - count = Math.min(count, Math.floor(span(scale.domain()) / minStep || 1)); - } - } - - if (isObject(count)) { - step = count.step; - count = count.interval; - } - - if (isString(count)) { - count = scale.type === Time ? timeInterval(count) : scale.type == UTC ? utcInterval(count) : error('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - - return count; - } - /** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ - - - function validTicks(scale, ticks, count) { - var range = scale.range(), - lo = range[0], - hi = peek(range), - cmp = ascending$1; - - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - - lo = Math.floor(lo); - hi = Math.ceil(hi); // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - - ticks = ticks.map(function (v) { - return [v, scale(v)]; - }).filter(function (_) { - return lo <= _[1] && _[1] <= hi; - }).sort(cmp).map(function (_) { - return _[0]; - }); - - if (count > 0 && ticks.length > 1) { - var endpoints = [ticks[0], peek(ticks)]; - - while (ticks.length > count && ticks.length >= 3) { - ticks = ticks.filter(function (_, i) { - return !(i % 2); - }); - } - - if (ticks.length < 3) { - ticks = endpoints; - } - } - - return ticks; - } - /** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ - - - function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins) : scale.ticks ? scale.ticks(count) : scale.domain(); - } - /** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ - - - function tickFormat$1(locale, scale, count, specifier, formatType, noSkip) { - var type = scale.type; - var format = defaultFormatter; - - if (type === Time || formatType === Time) { - format = locale.timeFormat(specifier); - } else if (type === UTC || formatType === UTC) { - format = locale.utcFormat(specifier); - } else if (isLogarithmic(type)) { - var varfmt = locale.formatFloat(specifier); - - if (noSkip || scale.bins) { - format = varfmt; - } else { - var test = tickLog(scale, count, false); - - format = function format(_) { - return test(_) ? varfmt(_) : ''; - }; - } - } else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - var d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } else if (specifier) { - format = locale.format(specifier); - } - - return format; - } - - function tickLog(scale, count, values) { - var ticks = tickValues(scale, count), - base = scale.base(), - logb = Math.log(base), - k = Math.max(1, base * count / ticks.length); // apply d3-scale's log format filter criteria - - var test = function test(d) { - var i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - - return values ? ticks.filter(test) : test; - } - - var symbols$1 = (_symbols$ = {}, _defineProperty(_symbols$, Quantile$1, 'quantiles'), _defineProperty(_symbols$, Quantize, 'thresholds'), _defineProperty(_symbols$, Threshold, 'domain'), _symbols$); - var formats$1 = (_formats$ = {}, _defineProperty(_formats$, Quantile$1, 'quantiles'), _defineProperty(_formats$, Quantize, 'domain'), _formats$); - - function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols$1[scale.type] ? thresholdValues(scale[symbols$1[scale.type]]()) : tickValues(scale, count); - } - - function thresholdFormat(locale, scale, specifier) { - var _ = scale[formats$1[scale.type]](), - n = _.length, - d = n > 1 ? _[1] - _[0] : _[0], - i; - - for (i = 1; i < n; ++i) { - d = Math.min(d, _[i] - _[i - 1]); - } // tickCount = 3 ticks times 10 for increased resolution - - - return locale.formatSpan(0, d, 3 * 10, specifier); - } - - function thresholdValues(thresholds) { - var values = [-Infinity].concat(thresholds); - values.max = +Infinity; - return values; - } - - function binValues(bins) { - var values = bins.slice(0, -1); - values.max = peek(bins); - return values; - } - - function isDiscreteRange(scale) { - return symbols$1[scale.type] || scale.bins; - } - - function labelFormat(locale, scale, count, type, specifier, formatType, noSkip) { - var format = formats$1[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat$1(locale, scale, count, specifier, formatType, noSkip); - return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format); - } - - function formatRange(format) { - return function (value, index, array) { - var limit = get$2(array[index + 1], get$2(array.max, +Infinity)), - lo = formatValue(value, format), - hi = formatValue(limit, format); - return lo && hi ? lo + " \u2013 " + hi : hi ? '< ' + hi : "\u2265 " + lo; - }; - } - - function get$2(value, dflt) { - return value != null ? value : dflt; - } - - function formatDiscrete(format) { - return function (value, index) { - return index ? format(value) : null; - }; - } - - function formatPoint(format) { - return function (value) { - return format(value); - }; - } - - function formatValue(value, format) { - return Number.isFinite(value) ? format(value) : null; - } - - function labelFraction(scale) { - var domain = scale.domain(), - count = domain.length - 1, - lo = +domain[0], - hi = +peek(domain), - span = hi - lo; - - if (scale.type === Threshold) { - var adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - - return function (value) { - return (value - lo) / span; - }; - } - - function format$1(locale, scale, specifier, formatType) { - var type = formatType || scale.type; // replace abbreviated time specifiers to improve screen reader experience - - if (isString(specifier) && isTemporal(type)) { - specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - } - - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true); - } - - function domainCaption(locale, scale, opt) { - opt = opt || {}; - var max = Math.max(3, opt.maxlen || 7), - fmt = format$1(locale, scale, opt.format, opt.formatType); // if scale breaks domain into bins, describe boundaries - - if (isDiscretizing(scale.type)) { - var v = labelValues(scale).slice(1).map(fmt), - n = v.length; - return "".concat(n, " boundar").concat(n === 1 ? 'y' : 'ies', ": ").concat(v.join(', ')); - } // if scale domain is discrete, list values - else if (isDiscrete(scale.type)) { - var d = scale.domain(), - _n2 = d.length, - _v = _n2 > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', '); - - return "".concat(_n2, " value").concat(_n2 === 1 ? '' : 's', ": ").concat(_v); - } // if scale domain is continuous, describe value range - else { - var _d2 = scale.domain(); - - return "values from ".concat(fmt(_d2[0]), " to ").concat(fmt(peek(_d2))); - } - } - - var ARIA_HIDDEN = 'aria-hidden'; - var ARIA_LABEL = 'aria-label'; - var ARIA_ROLE = 'role'; - var ARIA_ROLEDESCRIPTION = 'aria-roledescription'; - var GRAPHICS_OBJECT = 'graphics-object'; - var GRAPHICS_SYMBOL = 'graphics-symbol'; - - var bundle = function bundle(role, roledesc, label) { - var _ref13; - - return _ref13 = {}, _defineProperty(_ref13, ARIA_ROLE, role), _defineProperty(_ref13, ARIA_ROLEDESCRIPTION, roledesc), _defineProperty(_ref13, ARIA_LABEL, label || undefined), _ref13; - }; // these roles are covered by related roles - // we can ignore them, no need to generate attributes - - - var AriaIgnore = toSet(['axis-domain', 'axis-grid', 'axis-label', 'axis-tick', 'axis-title', 'legend-band', 'legend-entry', 'legend-gradient', 'legend-label', 'legend-title', 'legend-symbol', 'title']); // aria attribute generators for guide roles - - var AriaGuides = { - 'axis': { - desc: 'axis', - caption: axisCaption - }, - 'legend': { - desc: 'legend', - caption: legendCaption - }, - 'title-text': { - desc: 'title', - caption: function caption(item) { - return "Title text '".concat(titleCaption(item), "'"); - } - }, - 'title-subtitle': { - desc: 'subtitle', - caption: function caption(item) { - return "Subtitle text '".concat(titleCaption(item), "'"); - } - } - }; // aria properties generated for mark item encoding channels - - var AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL - }; - - function ariaItemAttributes(emit, item) { - var hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - - if (hide || item.description == null) { - for (var prop in AriaEncode) { - emit(AriaEncode[prop], undefined); - } - } else { - var _type = item.mark.marktype; - emit(ARIA_LABEL, item.description); - emit(ARIA_ROLE, item.ariaRole || (_type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); - emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || "".concat(_type, " mark")); - } - } - - function ariaMarkAttributes(mark) { - return mark.aria === false ? _defineProperty({}, ARIA_HIDDEN, true) : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); - } - - function ariaMark(mark) { - var type = mark.marktype; - var recurse = type === 'group' || type === 'text' || mark.items.some(function (_) { - return _.description != null && _.aria !== false; - }); - return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, "".concat(type, " mark container"), mark.description); - } - - function ariaGuide(mark, opt) { - try { - var item = mark.items[0], - caption = opt.caption || function () { - return ''; - }; - - return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); - } catch (err) { - return null; - } - } - - function titleCaption(item) { - return array(item.text).join(' '); - } - - function axisCaption(item) { - var datum = item.datum, - orient = item.orient, - title = datum.title ? extractTitle(item) : null, - ctx = item.context, - scale = ctx.scales[datum.scale].value, - locale = ctx.dataflow.locale(), - type = scale.type, - xy = orient === 'left' || orient === 'right' ? 'Y' : 'X'; - return "".concat(xy, "-axis") + (title ? " titled '".concat(title, "'") : '') + " for a ".concat(isDiscrete(type) ? 'discrete' : type, " scale") + " with ".concat(domainCaption(locale, scale, item)); - } - - function legendCaption(item) { - var datum = item.datum, - title = datum.title ? extractTitle(item) : null, - type = "".concat(datum.type || '', " legend").trim(), - scales = datum.scales, - props = Object.keys(scales), - ctx = item.context, - scale = ctx.scales[scales[props[0]]].value, - locale = ctx.dataflow.locale(); - return capitalize(type) + (title ? " titled '".concat(title, "'") : '') + " for ".concat(channelCaption(props)) + " with ".concat(domainCaption(locale, scale, item)); - } - - function extractTitle(item) { - try { - return array(peek(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } - } - - function channelCaption(props) { - props = props.map(function (p) { - return p + (p === 'fill' || p === 'stroke' ? ' color' : ''); - }); - return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + peek(props); - } - - function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; - } - - var attrText = function attrText(val) { - return (val + '').replace(/&/g, '&').replace(/"/g, '"'); - }; - /** - * Generate string for an opening xml tag. - * @param tag the name of the xml tag - * @param attr hash of attribute name-value pairs to include - * @param raw additional raw string to include in tag markup - */ - - - function openTag(tag, attr, raw) { - var s = '<' + tag, - key, - val; - - if (attr) { - for (key in attr) { - val = attr[key]; - - if (val != null) { - s += ' ' + key + '="' + attrText(val) + '"'; - } - } - } - - if (raw) s += ' ' + raw; - return s + '>'; - } - /** - * Generate string for closing xml tag. - * @param tag the name of the xml tag - */ - - - function closeTag(tag) { - return ''; - } - - var styles = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity', - blend: 'mix-blend-mode' - }; // ensure miter limit default is consistent with canvas (#2498) - - var rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 - }; - var RootIndex = 0, - ns = metadata.xmlns; - - function SVGRenderer(loader) { - Renderer.call(this, loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; - } - - var prototype$O = inherits(SVGRenderer, Renderer); - var base$1 = Renderer.prototype; - - prototype$O.initialize = function (el, width, height, padding) { - // create the svg definitions cache - this._defs = { - gradient: {}, - clipping: {} - }; - - if (el) { - this._svg = domChild(el, 0, 'svg', ns); - - this._svg.setAttribute('class', 'marks'); - - domClear(el, 1); // set the svg root group - - this._root = domChild(this._svg, RootIndex, 'g', ns); - - for (var _attr in rootAttributes) { - this._root.setAttribute(_attr, rootAttributes[_attr]); - } // ensure no additional child elements - - - domClear(this._svg, RootIndex + 1); - } // set background color if defined - - - this.background(this._bgcolor); - return base$1.initialize.call(this, el, width, height, padding); - }; - - prototype$O.background = function (bgcolor) { - if (arguments.length && this._svg) { - this._svg.style.setProperty('background-color', bgcolor); - } - - return base$1.background.apply(this, arguments); - }; - - prototype$O.resize = function (width, height, origin, scaleFactor) { - base$1.resize.call(this, width, height, origin, scaleFactor); - - if (this._svg) { - this._svg.setAttribute('width', this._width * this._scale); - - this._svg.setAttribute('height', this._height * this._scale); - - this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height); - - this._root.setAttribute('transform', 'translate(' + this._origin + ')'); - } - - this._dirty = []; - return this; - }; - - prototype$O.canvas = function () { - return this._svg; - }; - - prototype$O.svg = function () { - if (!this._svg) return null; - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - - for (var key in metadata) { - attr[key] = metadata[key]; - } - - var bg = !this._bgcolor ? '' : openTag('rect', { - width: this._width, - height: this._height, - fill: this._bgcolor - }) + closeTag('rect'); - return openTag('svg', attr) + (this._defs.el ? this._defs.el.outerHTML : '') + bg + this._root.outerHTML + closeTag('svg'); - }; // -- Render entry point -- - - - prototype$O._render = function (scene) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._resetDefs(); - this.draw(this._root, scene); - domClear(this._root, 1); - } - - this.updateDefs(); - this._dirty = []; - ++this._dirtyID; - return this; - }; // -- Manage SVG definitions ('defs') block -- - - - prototype$O.updateDefs = function () { - var svg = this._svg, - defs = this._defs; - var el = defs.el, - index = 0; - - for (var _id in defs.gradient) { - if (!el) defs.el = el = domChild(svg, RootIndex, 'defs', ns); - index = updateGradient(el, defs.gradient[_id], index); - } - - for (var _id2 in defs.clipping) { - if (!el) defs.el = el = domChild(svg, RootIndex, 'defs', ns); - index = updateClipping(el, defs.clipping[_id2], index); - } // clean-up - - - if (el) { - index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index); - } - }; - - function updateGradient(el, grad, index) { - var i, n, stop; - - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - var pt = domChild(el, index++, 'pattern', ns); - pt.setAttribute('id', patternPrefix + grad.id); - pt.setAttribute('viewBox', '0,0,1,1'); - pt.setAttribute('width', '100%'); - pt.setAttribute('height', '100%'); - pt.setAttribute('preserveAspectRatio', 'xMidYMid slice'); - pt = domChild(pt, 0, 'rect', ns); - pt.setAttribute('width', '1'); - pt.setAttribute('height', '1'); - pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')'); - el = domChild(el, index++, 'radialGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('fx', grad.x1); - el.setAttribute('fy', grad.y1); - el.setAttribute('fr', grad.r1); - el.setAttribute('cx', grad.x2); - el.setAttribute('cy', grad.y2); - el.setAttribute('r', grad.r2); - } else { - el = domChild(el, index++, 'linearGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('x1', grad.x1); - el.setAttribute('x2', grad.x2); - el.setAttribute('y1', grad.y1); - el.setAttribute('y2', grad.y2); - } - - for (i = 0, n = grad.stops.length; i < n; ++i) { - stop = domChild(el, i, 'stop', ns); - stop.setAttribute('offset', grad.stops[i].offset); - stop.setAttribute('stop-color', grad.stops[i].color); - } - - domClear(el, i); - return index; - } - - function updateClipping(el, clip, index) { - var mask; - el = domChild(el, index, 'clipPath', ns); - el.setAttribute('id', clip.id); - - if (clip.path) { - mask = domChild(el, 0, 'path', ns); - mask.setAttribute('d', clip.path); - } else { - mask = domChild(el, 0, 'rect', ns); - mask.setAttribute('x', 0); - mask.setAttribute('y', 0); - mask.setAttribute('width', clip.width); - mask.setAttribute('height', clip.height); - } - - domClear(el, 1); - return index + 1; - } - - prototype$O._resetDefs = function () { - var def = this._defs; - def.gradient = {}; - def.clipping = {}; - }; // -- Manage rendering of items marked as dirty -- - - - prototype$O.dirty = function (item) { - if (item.dirty !== this._dirtyID) { - item.dirty = this._dirtyID; - - this._dirty.push(item); - } - }; - - prototype$O.isDirty = function (item) { - return this._dirtyAll || !item._svg || item.dirty === this._dirtyID; - }; - - prototype$O._dirtyCheck = function () { - this._dirtyAll = true; - var items = this._dirty; - if (!items.length || !this._dirtyID) return true; - var id = ++this._dirtyID, - item, - mark, - type, - mdef, - i, - n, - o; - - for (i = 0, n = items.length; i < n; ++i) { - item = items[i]; - mark = item.mark; - - if (mark.marktype !== type) { - // memoize mark instance lookup - type = mark.marktype; - mdef = Marks[type]; - } - - if (mark.zdirty && mark.dirty !== id) { - this._dirtyAll = false; - dirtyParents(item, id); - mark.items.forEach(function (i) { - i.dirty = id; - }); - } - - if (mark.zdirty) continue; // handle in standard drawing pass - - if (item.exit) { - // EXIT - if (mdef.nested && mark.items.length) { - // if nested mark with remaining points, update instead - o = mark.items[0]; - if (o._svg) this._update(mdef, o._svg, o); - } else if (item._svg) { - // otherwise remove from DOM - o = item._svg.parentNode; - if (o) o.removeChild(item._svg); - } - - item._svg = null; - continue; - } - - item = mdef.nested ? mark.items[0] : item; - if (item._update === id) continue; // already visited - - if (!item._svg || !item._svg.ownerSVGElement) { - // ENTER - this._dirtyAll = false; - dirtyParents(item, id); - } else { - // IN-PLACE UPDATE - this._update(mdef, item._svg, item); - } - - item._update = id; - } - - return !this._dirtyAll; - }; - - function dirtyParents(item, id) { - for (; item && item.dirty !== id; item = item.mark.group) { - item.dirty = id; - - if (item.mark && item.mark.dirty !== id) { - item.mark.dirty = id; - } else return; - } - } // -- Construct & maintain scenegraph to SVG mapping --- - // Draw a mark container. - - - prototype$O.draw = function (el, scene, prev) { - var _this14 = this; - - if (!this.isDirty(scene)) return scene._svg; - var svg = this._svg, - mdef = Marks[scene.marktype], - events = scene.interactive === false ? 'none' : null, - isGroup = mdef.tag === 'g', - sibling = null, - i = 0, - parent; - parent = bind(scene, el, prev, 'g', svg); - parent.setAttribute('class', cssClass(scene)); // apply aria attributes to parent container element - - var aria = ariaMarkAttributes(scene); - - for (var _key6 in aria) { - setAttribute(parent, _key6, aria[_key6]); - } - - if (!isGroup) { - setAttribute(parent, 'pointer-events', events); - } - - setAttribute(parent, 'clip-path', scene.clip ? clip(this, scene, scene.group) : null); - - var process = function process(item) { - var dirty = _this14.isDirty(item), - node = bind(item, parent, sibling, mdef.tag, svg); - - if (dirty) { - _this14._update(mdef, node, item); - - if (isGroup) recurse(_this14, node, item); - } - - sibling = node; - ++i; - }; - - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } - - domClear(parent, i); - return parent; - }; // Recursively process group contents. - - - function recurse(renderer, el, group) { - el = el.lastChild.previousSibling; - var prev, - idx = 0; - visit(group, function (item) { - prev = renderer.draw(el, item, prev); - ++idx; - }); // remove any extraneous DOM elements - - domClear(el, 1 + idx); - } // Bind a scenegraph item to an SVG DOM element. - // Create new SVG elements as needed. - - - function bind(item, el, sibling, tag, svg) { - var node = item._svg, - doc; // create a new dom node if needed - - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, ns); - item._svg = node; - - if (item.mark) { - node.__data__ = item; - node.__values__ = { - fill: 'default' - }; // if group, create background, content, and foreground elements - - if (tag === 'g') { - var bg = domCreate(doc, 'path', ns); - node.appendChild(bg); - bg.__data__ = item; - var cg = domCreate(doc, 'g', ns); - node.appendChild(cg); - cg.__data__ = item; - var fg = domCreate(doc, 'path', ns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = { - fill: 'default' - }; - } - } - } // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - - - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { - el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - } - - return node; - } - - function siblingCheck(node, sibling) { - return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same - } // -- Set attributes & styles on SVG elements --- - - - var element = null, - // temp var for current SVG element - values = null; // temp var for current values hash - // Extra configuration for certain mark types - - var mark_extras = { - group: function group(mdef, el, item) { - var fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - values = el.__values__; // use parent's values hash - - element = el.childNodes[1]; - mdef.content(emit, item, this); - var bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - var value = item.mark.interactive === false ? 'none' : null; - - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - - if (item.strokeForeground && item.stroke) { - var _fill = item.fill; - setAttribute(fg, 'display', null); // set style of background - - this.style(bg, item); - setAttribute(bg, 'stroke', null); // set style of foreground - - if (_fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (_fill) item.fill = _fill; // leave element null to prevent downstream styling - - element = null; - } else { - // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - } - }, - image: function image(mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else { - setStyle(el, 'image-rendering', null); - } - }, - text: function text(mdef, el, item) { - var tl = textLines(item), - key, - value, - doc, - lh; - - if (isArray(tl)) { - // multi-line text - value = tl.map(function (_) { - return textValue(item, _); - }); - key = value.join('\n'); // content cache key - - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach(function (t, i) { - var ts = domCreate(doc, 'tspan', ns); - ts.__data__ = item; // data binding - - ts.textContent = t; - - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } - }; - - function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) { - el.style.removeProperty(name); - } else { - el.style.setProperty(name, value + ''); - } - - values[name] = value; - } - } - - prototype$O._update = function (mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; // apply aria-specific properties - - ariaItemAttributes(emit, item); // apply svg attributes - - mdef.attr(emit, item, this); // some marks need special treatment - - var extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); // apply svg style attributes - // note: element may be modified by 'extra' method - - if (element) this.style(element, item); - }; - - function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; // use appropriate method given namespace (ns) - - if (ns) { - setAttributeNS(element, name, value, ns); - } else { - setAttribute(element, name, value); - } // note current value for future comparison - - - values[name] = value; - } - - function setAttribute(el, name, value) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttribute(name, value); - } else { - // else remove DOM attribute - el.removeAttribute(name); - } - } - - function setAttributeNS(el, name, value, ns) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - } else { - // else remove DOM attribute - el.removeAttributeNS(ns, name); - } - } - - prototype$O.style = function (el, o) { - if (o == null) return; - - for (var prop in styles) { - var _value18 = prop === 'font' ? fontFamily(o) : o[prop]; - - if (_value18 === values[prop]) continue; - var name = styles[prop]; - - if (_value18 == null) { - el.removeAttribute(name); - } else { - if (isGradient(_value18)) { - _value18 = gradientRef(_value18, this._defs.gradient, href()); - } - - el.setAttribute(name, _value18 + ''); - } - - values[prop] = _value18; - } - }; - - function href() { - var loc; - return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; - } - - function SVGStringRenderer(loader) { - Renderer.call(this, loader); - this._text = { - head: '', - bg: '', - root: '', - foot: '', - defs: '', - body: '' - }; - this._defs = { - gradient: {}, - clipping: {} - }; - } - - var prototype$P = inherits(SVGStringRenderer, Renderer); - var base$2 = Renderer.prototype; - - prototype$P.resize = function (width, height, origin, scaleFactor) { - base$2.resize.call(this, width, height, origin, scaleFactor); - var o = this._origin, - t = this._text; - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - - for (var key in metadata) { - attr[key] = metadata[key]; - } - - t.head = openTag('svg', attr); - var bg = this._bgcolor; - if (bg === 'transparent' || bg === 'none') bg = null; - - if (bg) { - t.bg = openTag('rect', { - width: this._width, - height: this._height, - fill: bg - }) + closeTag('rect'); - } else { - t.bg = ''; - } - - t.root = openTag('g', extend({}, rootAttributes, { - transform: 'translate(' + o + ')' - })); - t.foot = closeTag('g') + closeTag('svg'); - return this; - }; - - prototype$P.background = function () { - var rv = base$2.background.apply(this, arguments); - - if (arguments.length && this._text.head) { - this.resize(this._width, this._height, this._origin, this._scale); - } - - return rv; - }; - - prototype$P.svg = function () { - var t = this._text; - return t.head + t.defs + t.bg + t.root + t.body + t.foot; - }; - - prototype$P._render = function (scene) { - this._text.body = this.mark(scene); - this._text.defs = this.buildDefs(); - return this; - }; - - prototype$P.buildDefs = function () { - var defs = '', - tag; - - for (var _id3 in this._defs.gradient) { - var _def = this._defs.gradient[_id3], - stops = _def.stops; - - if (_def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - defs += openTag(tag = 'pattern', { - id: patternPrefix + _id3, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - defs += openTag('rect', { - width: '1', - height: '1', - fill: 'url(#' + _id3 + ')' - }) + closeTag('rect'); - defs += closeTag(tag); - defs += openTag(tag = 'radialGradient', { - id: _id3, - fx: _def.x1, - fy: _def.y1, - fr: _def.r1, - cx: _def.x2, - cy: _def.y2, - r: _def.r2 - }); - } else { - defs += openTag(tag = 'linearGradient', { - id: _id3, - x1: _def.x1, - x2: _def.x2, - y1: _def.y1, - y2: _def.y2 - }); - } - - for (var i = 0; i < stops.length; ++i) { - defs += openTag('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }) + closeTag('stop'); - } - - defs += closeTag(tag); - } - - for (var _id4 in this._defs.clipping) { - var _def2 = this._defs.clipping[_id4]; - defs += openTag('clipPath', { - id: _id4 - }); - - if (_def2.path) { - defs += openTag('path', { - d: _def2.path - }) + closeTag('path'); - } else { - defs += openTag('rect', { - x: 0, - y: 0, - width: _def2.width, - height: _def2.height - }) + closeTag('rect'); - } - - defs += closeTag('clipPath'); - } - - return defs ? openTag('defs') + defs + closeTag('defs') : ''; - }; - - prototype$P.attr = function (scene, item, attrs, tag) { - var _this15 = this; - - var object = {}, - emit = function emit(name, value, ns, prefixed) { - object[prefixed || name] = value; - }; // apply mark specific attributes - - - if (Array.isArray(attrs)) { - attrs.forEach(function (fn) { - return fn(emit, item, _this15); - }); - } else { - attrs(emit, item, this); - } // apply style attributes - - - if (tag) { - applyStyles(object, item, scene, tag, this._defs); - } - - return object; - }; - - prototype$P.href = function (item) { - var that = this, - href = item.href, - attr; - - if (href) { - if (attr = that._hrefs && that._hrefs[href]) { - return attr; - } else { - that.sanitizeURL(href).then(function (attr) { - // rewrite to use xlink namespace - // note that this will be deprecated in SVG 2.0 - attr['xlink:href'] = attr.href; - attr.href = null; - (that._hrefs || (that._hrefs = {}))[href] = attr; - }); - } - } - - return null; - }; - - prototype$P.mark = function (scene) { - var _this16 = this; - - var mdef = Marks[scene.marktype], - tag = mdef.tag, - attrList = [ariaItemAttributes, mdef.attr]; - var str = ''; // render opening group tag - - str += openTag('g', extend({ - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip(this, scene, scene.group) : null - }, ariaMarkAttributes(scene), { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - })); // render contained elements - - var process = function process(item) { - var href = _this16.href(item); - - if (href) str += openTag('a', href); - str += openTag(tag, _this16.attr(scene, item, attrList, tag !== 'g' ? tag : null)); - - if (tag === 'text') { - var _tl = textLines(item); - - if (isArray(_tl)) { - // multi-line text - var attrs = { - x: 0, - dy: lineHeight(item) - }; - - for (var i = 0; i < _tl.length; ++i) { - str += openTag('tspan', i ? attrs : null) + escape_text(textValue(item, _tl[i])) + closeTag('tspan'); - } - } else { - // single-line text - str += escape_text(textValue(item, _tl)); - } - } else if (tag === 'g') { - var fore = item.strokeForeground, - _fill2 = item.fill, - _stroke = item.stroke; - - if (fore && _stroke) { - item.stroke = null; - } - - str += openTag('path', _this16.attr(scene, item, mdef.background, 'bgrect')) + closeTag('path'); - str += openTag('g', _this16.attr(scene, item, mdef.content)) + _this16.markGroup(item) + closeTag('g'); - - if (fore && _stroke) { - if (_fill2) item.fill = null; - item.stroke = _stroke; - str += openTag('path', _this16.attr(scene, item, mdef.foreground, 'bgrect')) + closeTag('path'); - if (_fill2) item.fill = _fill2; - } else { - str += openTag('path', _this16.attr(scene, item, mdef.foreground, 'bgfore')) + closeTag('path'); - } - } - - str += closeTag(tag); - if (href) str += closeTag('a'); - }; - - if (mdef.nested) { - if (scene.items && scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } // render closing group tag - - - return str + closeTag('g'); - }; - - prototype$P.markGroup = function (scene) { - var _this17 = this; - - var str = ''; - visit(scene, function (item) { - str += _this17.mark(item); - }); - return str; - }; - - function applyStyles(s, item, scene, tag, defs) { - if (item == null) return s; - - if (tag === 'bgrect' && scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - if (tag === 'bgfore') { - if (scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - s.display = 'none'; - if (item.fill !== null) return s; - } - - if (tag === 'image' && item.smooth === false) { - s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;'; - } - - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - if (item.fontStyle) s['font-style'] = item.fontStyle; - if (item.fontVariant) s['font-variant'] = item.fontVariant; - if (item.fontWeight) s['font-weight'] = item.fontWeight; - } - - for (var prop in styles) { - var _value19 = item[prop]; - var name = styles[prop]; - if (_value19 === 'transparent' && (name === 'fill' || name === 'stroke')) ;else if (_value19 != null) { - if (isGradient(_value19)) { - _value19 = gradientRef(_value19, defs.gradient, ''); - } - - s[name] = _value19; - } - } - - return s; - } - - function escape_text(s) { - return s.replace(/&/g, '&').replace(//g, '>'); - } - - var Canvas = 'canvas'; - var PNG = 'png'; - var SVG = 'svg'; - var None$2 = 'none'; - var RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - None: None$2 - }; - var modules = {}; - modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler - }; - modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler - }; - modules[None$2] = {}; - - function renderModule(name, _) { - name = String(name || '').toLowerCase(); - - if (arguments.length > 1) { - modules[name] = _; - return this; - } else { - return modules[name]; - } - } - - function intersect(scene, bounds, filter) { - var hits = [], - // intersection results - box = new Bounds().union(bounds), - // defensive copy - type = scene.marktype; - return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : error('Intersect scene must be mark node or group item.'); - } - - function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - var items = mark.items, - _type2 = mark.marktype, - n = items.length; - var i = 0; - - if (_type2 === 'group') { - for (; i < n; ++i) { - intersectGroup(items[i], box, filter, hits); - } - } else { - for (var test = Marks[_type2].isect; i < n; ++i) { - var item = items[i]; - if (intersectItem(item, box, test)) hits.push(item); - } - } - } - - return hits; - } - - function visitMark(mark, box, filter) { - // process if bounds intersect and if - // (1) mark is a group mark (so we must recurse), or - // (2) mark is interactive and passes filter - return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark))); - } - - function intersectGroup(group, box, filter, hits) { - // test intersect against group - // skip groups by default unless filter says otherwise - if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) { - hits.push(group); - } // recursively test children marks - // translate box to group coordinate space - - - var marks = group.items, - n = marks && marks.length; - - if (n) { - var _x22 = group.x || 0, - _y2 = group.y || 0; - - box.translate(-_x22, -_y2); - - for (var i = 0; i < n; ++i) { - intersectMark(marks[i], box, filter, hits); - } - - box.translate(_x22, _y2); - } - - return hits; - } - - function intersectItem(item, box, test) { - // test bounds enclosure, bounds intersection, then detailed test - var bounds = item.bounds; - return box.encloses(bounds) || box.intersects(bounds) && test(item, box); - } - - var clipBounds = new Bounds(); - - function boundClip(mark) { - var clip = mark.clip; - - if (isFunction(clip)) { - clip(context(clipBounds.clear())); - } else if (clip) { - clipBounds.set(0, 0, mark.group.width, mark.group.height); - } else return; - - mark.bounds.intersect(clipBounds); - } - - var TOLERANCE = 1e-9; - - function sceneEqual(a, b, key) { - return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : isNumber(a) && isNumber(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !isObject(a) && !isObject(b) ? a == b : a == null || b == null ? false : objectEqual(a, b); - } - - function pathEqual(a, b) { - return sceneEqual(pathParse(a), pathParse(b)); - } - - function objectEqual(a, b) { - var ka = Object.keys(a), - kb = Object.keys(b), - key, - i; - if (ka.length !== kb.length) return false; - ka.sort(); - kb.sort(); - - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) return false; - } - - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; - } - - return _typeof(a) === _typeof(b); - } - - function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); - } - /** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ - - - function Bound(params) { - Transform.call(this, null, params); - } - - var prototype$Q = inherits(Bound, Transform); - - prototype$Q.transform = function (_, pulse) { - var view = pulse.dataflow, - mark = _.mark, - type = mark.marktype, - entry = Marks[type], - bound = entry.bound, - markBounds = mark.bounds, - rebound; - - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem$1(mark, bound); - mark.items.forEach(function (item) { - item.bounds.clear().union(markBounds); - }); - } else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, function (item) { - return view.dirty(item); - }); - markBounds.clear(); - mark.items.forEach(function (item) { - return markBounds.union(boundItem$1(item, bound)); - }); // force reflow for axes/legends/titles to propagate any layout changes - - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - pulse.visit(pulse.ADD, function (item) { - markBounds.union(boundItem$1(item, bound)); - }); - pulse.visit(pulse.MOD, function (item) { - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem$1(item, bound)); - }); - - if (rebound) { - markBounds.clear(); - mark.items.forEach(function (item) { - return markBounds.union(item.bounds); - }); - } - } // ensure mark bounds do not exceed any clipping region - - - boundClip(mark); - return pulse.modifies('bounds'); - }; - - function boundItem$1(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); - } - - var COUNTER_NAME = ':vega_identifier:'; - /** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ - - function Identifier(params) { - Transform.call(this, 0, params); - } - - Identifier.Definition = { - 'type': 'Identifier', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'as', - 'type': 'string', - 'required': true - }] - }; - var prototype$R = inherits(Identifier, Transform); - - prototype$R.transform = function (_, pulse) { - var counter = getCounter(pulse.dataflow), - id = counter.value, - as = _.as; - pulse.visit(pulse.ADD, function (t) { - if (!t[as]) t[as] = ++id; - }); - counter.set(this.value = id); - return pulse; - }; - - function getCounter(view) { - var counter = view._signals[COUNTER_NAME]; - - if (!counter) { - view._signals[COUNTER_NAME] = counter = view.add(0); - } - - return counter; - } - /** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ - - - function Mark(params) { - Transform.call(this, null, params); - } - - var prototype$S = inherits(Mark, Transform); - - prototype$S.transform = function (_, pulse) { - var mark = this.value; // acquire mark on first invocation, bind context and group - - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } // initialize entering items - - - var Init = mark.marktype === Group ? GroupItem : Item; - pulse.visit(pulse.ADD, function (item) { - return Init.call(item, mark); - }); // update clipping and/or interactive status - - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - - pulse.reflow(); - } // bind items array to scenegraph mark - - - mark.items = pulse.source; - return pulse; - }; - - function lookup$1(_) { - var g = _.groups, - p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; - } - /** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ - - - function Overlap(params) { - Transform.call(this, null, params); - } - - var prototype$T = inherits(Overlap, Transform); - var methods = { - parity: function parity(items) { - return items.filter(function (item, i) { - return i % 2 ? item.opacity = 0 : 1; - }); - }, - greedy: function greedy(items, sep) { - var a; - return items.filter(function (b, i) { - if (!i || !intersect$1(a.bounds, b.bounds, sep)) { - a = b; - return 1; - } else { - return b.opacity = 0; - } - }); - } - }; // compute bounding box intersection - // including padding pixels of separation - - function intersect$1(a, b, sep) { - return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2); - } - - function hasOverlap(items, pad) { - for (var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i) { - if (intersect$1(a, b = items[i].bounds, pad)) return true; - } - } - - function hasBounds(item) { - var b = item.bounds; - return b.width() > 1 && b.height() > 1; - } - - function boundTest(scale, orient, tolerance) { - var range = scale.range(), - b = new Bounds(); - - if (orient === Top || orient === Bottom) { - b.set(range[0], -Infinity, range[1], +Infinity); - } else { - b.set(-Infinity, range[0], +Infinity, range[1]); - } - - b.expand(tolerance || 1); - return function (item) { - return b.encloses(item.bounds); - }; - } // reset all items to be fully opaque - - - function reset(source) { - source.forEach(function (item) { - return item.opacity = 1; - }); - return source; - } // add all tuples to mod, fork pulse if parameters were modified - // fork prevents cross-stream tuple pollution (e.g., pulse from scale) - - - function reflow(pulse, _) { - return pulse.reflow(_.modified()).modifies('opacity'); - } - - prototype$T.transform = function (_, pulse) { - var reduce = methods[_.method] || methods.parity, - source = pulse.materialize(pulse.SOURCE).source, - sep = _.separation || 0, - items, - test, - bounds; - if (!source || !source.length) return; - - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - - return pulse; - } // skip labels with no content - - - source = source.filter(hasBounds); // early exit, nothing to do - - if (!source.length) return; - - if (_.sort) { - source = source.slice().sort(_.sort); - } - - items = reset(source); - pulse = reflow(pulse, _); - - if (items.length >= 3 && hasOverlap(items, sep)) { - do { - items = reduce(items, sep); - } while (items.length >= 3 && hasOverlap(items, sep)); - - if (items.length < 3 && !peek(source).opacity) { - if (items.length > 1) peek(items).opacity = 0; - peek(source).opacity = 1; - } - } - - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach(function (item) { - if (!test(item)) item.opacity = 0; - }); - } // re-calculate mark bounds - - - bounds = items[0].mark.bounds.clear(); - source.forEach(function (item) { - if (item.opacity) bounds.union(item.bounds); - }); - return pulse; - }; - /** - * Queue modified scenegraph items for rendering. - * @constructor - */ - - - function Render(params) { - Transform.call(this, null, params); - } - - var prototype$U = inherits(Render, Transform); - - prototype$U.transform = function (_, pulse) { - var view = pulse.dataflow; - pulse.visit(pulse.ALL, function (item) { - return view.dirty(item); - }); // set z-index dirty flag as needed - - if (pulse.fields && pulse.fields['zindex']) { - var item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } - }; - - var tempBounds$1 = new Bounds(); - - function set$1(item, property, value) { - return item[property] === value ? 0 : (item[property] = value, 1); - } - - function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; - } - - function axisIndices(datum) { - var index = +datum.grid; - return [datum.ticks ? index++ : -1, // ticks index - datum.labels ? index++ : -1, // labels index - index + +datum.domain // title index - ]; - } - - function axisLayout(view, axis, width, height) { - var item = axis.items[0], - datum = item.datum, - delta = item.translate != null ? item.translate : 0.5, - orient = item.orient, - indices = axisIndices(datum), - range = item.range, - offset = item.offset, - position = item.position, - minExtent = item.minExtent, - maxExtent = item.maxExtent, - title = datum.title && item.items[indices[2]].items[0], - titlePadding = item.titlePadding, - bounds = item.bounds, - dl = title && multiLineOffset(title), - x = 0, - y = 0, - i, - s; - tempBounds$1.clear().union(bounds); - bounds.clear(); - if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds); // position axis group and title - - switch (orient) { - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - - default: - x = item.x; - y = item.y; - } // update bounds - - - boundStroke(bounds.translate(x, y), item); - - if (set$1(item, 'x', x + delta) | set$1(item, 'y', y + delta)) { - item.bounds = tempBounds$1; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - - return item.mark.bounds.clear().union(bounds); - } - - function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - var b = title.bounds; - - if (title.auto) { - var v = sign * (offset + dl + pad); - var dx = 0, - dy = 0; - view.dirty(title); - isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - - bounds.union(b); - } // aggregation functions for grid margin determination - - - var min$1 = function min$1(a, b) { - return Math.floor(Math.min(a, b)); - }; - - var max$1 = function max$1(a, b) { - return Math.ceil(Math.max(a, b)); - }; - - function gridLayoutGroups(group) { - var _views$rowheaders, _views$rowfooters, _views$colheaders, _views$colfooters, _views$marks; - - var groups = group.items, - n = groups.length, - i = 0, - mark, - items; - var views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; // layout axes, gather legends, collect bounds - - for (; i < n; ++i) { - mark = groups[i]; - items = mark.items; - - if (mark.marktype === Group) { - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - break; - - case RowHeader: - (_views$rowheaders = views.rowheaders).push.apply(_views$rowheaders, _toConsumableArray(items)); - - break; - - case RowFooter: - (_views$rowfooters = views.rowfooters).push.apply(_views$rowfooters, _toConsumableArray(items)); - - break; - - case ColHeader: - (_views$colheaders = views.colheaders).push.apply(_views$colheaders, _toConsumableArray(items)); - - break; - - case ColFooter: - (_views$colfooters = views.colfooters).push.apply(_views$colfooters, _toConsumableArray(items)); - - break; - - case RowTitle: - views.rowtitle = items[0]; - break; - - case ColTitle: - views.coltitle = items[0]; - break; - - default: - (_views$marks = views.marks).push.apply(_views$marks, _toConsumableArray(items)); - - } - } - } - - return views; - } - - function bboxFlush(item) { - return new Bounds().set(0, 0, item.width || 0, item.height || 0); - } - - function bboxFull(item) { - var b = item.bounds.clone(); - return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0)); - } - - function get$3(opt, key, d) { - var v = isObject(opt) ? opt[key] : opt; - return v != null ? v : d !== undefined ? d : 0; - } - - function offsetValue(v) { - return v < 0 ? Math.ceil(-v) : 0; - } - - function gridLayout(view, groups, opt) { - var dirty = !opt.nodirty, - bbox = opt.bounds === Flush ? bboxFlush : bboxFull, - bounds = tempBounds$1.set(0, 0, 0, 0), - alignCol = get$3(opt.align, Column), - alignRow = get$3(opt.align, Row), - padCol = get$3(opt.padding, Column), - padRow = get$3(opt.padding, Row), - ncols = opt.columns || groups.length, - nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), - n = groups.length, - xOffset = Array(n), - xExtent = Array(ncols), - xMax = 0, - yOffset = Array(n), - yExtent = Array(nrows), - yMax = 0, - dx = Array(n), - dy = Array(n), - boxes = Array(n), - m, - i, - c, - r, - b, - g, - px, - py, - x, - y, - offset; - - for (i = 0; i < ncols; ++i) { - xExtent[i] = 0; - } - - for (i = 0; i < nrows; ++i) { - yExtent[i] = 0; - } // determine offsets for each group - - - for (i = 0; i < n; ++i) { - g = groups[i]; - b = boxes[i] = bbox(g); - g.x = g.x || 0; - dx[i] = 0; - g.y = g.y || 0; - dy[i] = 0; - c = i % ncols; - r = ~~(i / ncols); - xMax = Math.max(xMax, px = Math.ceil(b.x2)); - yMax = Math.max(yMax, py = Math.ceil(b.y2)); - xExtent[c] = Math.max(xExtent[c], px); - yExtent[r] = Math.max(yExtent[r], py); - xOffset[i] = padCol + offsetValue(b.x1); - yOffset[i] = padRow + offsetValue(b.y1); - if (dirty) view.dirty(groups[i]); - } // set initial alignment offsets - - - for (i = 0; i < n; ++i) { - if (i % ncols === 0) xOffset[i] = 0; - if (i < ncols) yOffset[i] = 0; - } // enforce column alignment constraints - - - if (alignCol === Each) { - for (c = 1; c < ncols; ++c) { - for (offset = 0, i = c; i < n; i += ncols) { - if (offset < xOffset[i]) offset = xOffset[i]; - } - - for (i = c; i < n; i += ncols) { - xOffset[i] = offset + xExtent[c - 1]; - } - } - } else if (alignCol === All) { - for (offset = 0, i = 0; i < n; ++i) { - if (i % ncols && offset < xOffset[i]) offset = xOffset[i]; - } - - for (i = 0; i < n; ++i) { - if (i % ncols) xOffset[i] = offset + xMax; - } - } else { - for (alignCol = false, c = 1; c < ncols; ++c) { - for (i = c; i < n; i += ncols) { - xOffset[i] += xExtent[c - 1]; - } - } - } // enforce row alignment constraints - - - if (alignRow === Each) { - for (r = 1; r < nrows; ++r) { - for (offset = 0, i = r * ncols, m = i + ncols; i < m; ++i) { - if (offset < yOffset[i]) offset = yOffset[i]; - } - - for (i = r * ncols; i < m; ++i) { - yOffset[i] = offset + yExtent[r - 1]; - } - } - } else if (alignRow === All) { - for (offset = 0, i = ncols; i < n; ++i) { - if (offset < yOffset[i]) offset = yOffset[i]; - } - - for (i = ncols; i < n; ++i) { - yOffset[i] = offset + yMax; - } - } else { - for (alignRow = false, r = 1; r < nrows; ++r) { - for (i = r * ncols, m = i + ncols; i < m; ++i) { - yOffset[i] += yExtent[r - 1]; - } - } - } // perform horizontal grid layout - - - for (x = 0, i = 0; i < n; ++i) { - x = xOffset[i] + (i % ncols ? x : 0); - dx[i] += x - groups[i].x; - } // perform vertical grid layout - - - for (c = 0; c < ncols; ++c) { - for (y = 0, i = c; i < n; i += ncols) { - y += yOffset[i]; - dy[i] += y - groups[i].y; - } - } // perform horizontal centering - - - if (alignCol && get$3(opt.center, Column) && nrows > 1) { - for (i = 0; i < n; ++i) { - b = alignCol === All ? xMax : xExtent[i % ncols]; - x = b - boxes[i].x2 - groups[i].x - dx[i]; - if (x > 0) dx[i] += x / 2; - } - } // perform vertical centering - - - if (alignRow && get$3(opt.center, Row) && ncols !== 1) { - for (i = 0; i < n; ++i) { - b = alignRow === All ? yMax : yExtent[~~(i / ncols)]; - y = b - boxes[i].y2 - groups[i].y - dy[i]; - if (y > 0) dy[i] += y / 2; - } - } // position grid relative to anchor - - - for (i = 0; i < n; ++i) { - bounds.union(boxes[i].translate(dx[i], dy[i])); - } - - x = get$3(opt.anchor, X); - y = get$3(opt.anchor, Y); - - switch (get$3(opt.anchor, Column)) { - case End: - x -= bounds.width(); - break; - - case Middle: - x -= bounds.width() / 2; - } - - switch (get$3(opt.anchor, Row)) { - case End: - y -= bounds.height(); - break; - - case Middle: - y -= bounds.height() / 2; - } - - x = Math.round(x); - y = Math.round(y); // update mark positions, bounds, dirty - - bounds.clear(); - - for (i = 0; i < n; ++i) { - groups[i].mark.bounds.clear(); - } - - for (i = 0; i < n; ++i) { - g = groups[i]; - g.x += dx[i] += x; - g.y += dy[i] += y; - bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); - if (dirty) view.dirty(g); - } - - return bounds; - } - - function trellisLayout(view, group, opt) { - var views = gridLayoutGroups(group), - groups = views.marks, - bbox = opt.bounds === Flush ? boundFlush : boundFull, - off = opt.offset, - ncols = opt.columns || groups.length, - nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), - cells = nrows * ncols, - x, - y, - x2, - y2, - anchor, - band, - offset; // -- initial grid layout - - var bounds = gridLayout(view, groups, opt); - if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid - // -- layout grid headers and footers -- - // perform row header layout - - if (views.rowheaders) { - band = get$3(opt.headerBand, Row, null); - x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get$3(off, 'rowHeader'), min$1, 0, bbox, 'x1', 0, ncols, 1, band); - } // perform column header layout - - - if (views.colheaders) { - band = get$3(opt.headerBand, Column, null); - y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get$3(off, 'columnHeader'), min$1, 1, bbox, 'y1', 0, 1, ncols, band); - } // perform row footer layout - - - if (views.rowfooters) { - band = get$3(opt.footerBand, Row, null); - x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get$3(off, 'rowFooter'), max$1, 0, bbox, 'x2', ncols - 1, ncols, 1, band); - } // perform column footer layout - - - if (views.colfooters) { - band = get$3(opt.footerBand, Column, null); - y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get$3(off, 'columnFooter'), max$1, 1, bbox, 'y2', cells - ncols, 1, ncols, band); - } // perform row title layout - - - if (views.rowtitle) { - anchor = get$3(opt.titleAnchor, Row); - offset = get$3(off, 'rowTitle'); - offset = anchor === End ? x2 + offset : x - offset; - band = get$3(opt.titleBand, Row, 0.5); - layoutTitle(view, views.rowtitle, offset, 0, bounds, band); - } // perform column title layout - - - if (views.coltitle) { - anchor = get$3(opt.titleAnchor, Column); - offset = get$3(off, 'columnTitle'); - offset = anchor === End ? y2 + offset : y - offset; - band = get$3(opt.titleBand, Column, 0.5); - layoutTitle(view, views.coltitle, offset, 1, bounds, band); - } - } - - function boundFlush(item, field) { - return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined; - } - - function boundFull(item, field) { - return item.bounds[field]; - } - - function layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) { - var n = groups.length, - init = 0, - edge = 0, - i, - j, - k, - m, - b, - h, - g, - x, - y; // if no groups, early exit and return 0 - - if (!n) return init; // compute margin - - for (i = start; i < n; i += stride) { - if (groups[i]) init = agg(init, bound(groups[i], bf)); - } // if no headers, return margin calculation - - - if (!headers.length) return init; // check if number of headers exceeds number of rows or columns - - if (headers.length > limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } // apply offset - - - init += offset; // clear mark bounds for all headers - - for (j = 0, m = headers.length; j < m; ++j) { - view.dirty(headers[j]); - headers[j].mark.bounds.clear(); - } // layout each header - - - for (i = start, j = 0, m = headers.length; j < m; ++j, i += stride) { - h = headers[j]; - b = h.mark.bounds; // search for nearest group to align to - // necessary if table has empty cells - - for (k = i; k >= 0 && (g = groups[k]) == null; k -= back) { - ; - } // assign coordinates and update bounds - - - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); // update current edge of layout bounds - - edge = agg(edge, b[bf]); - } - - return edge; - } - - function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); // compute title coordinates - - var x = offset, - y = offset; - isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height()); // assign coordinates and update bounds - - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; // queue title for redraw - - view.dirty(g); - } // utility for looking up legend layout configuration - - - function lookup$2(config, orient) { - var opt = config[orient] || {}; - return function (key, d) { - return opt[key] != null ? opt[key] : config[key] != null ? config[key] : d; - }; - } // if legends specify offset directly, use the maximum specified value - - - function offsets(legends, value) { - var max = -Infinity; - legends.forEach(function (item) { - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; - } - - function legendParams(g, orient, config, xb, yb, w, h) { - var _ = lookup$2(config, orient), - offset = offsets(g, _('offset', 0)), - anchor = _('anchor', Start), - mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - - var p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - - switch (orient) { - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, - column: End, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, - row: End, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - - case TopLeft: - p.anchor = { - x: offset, - y: offset - }; - break; - - case TopRight: - p.anchor = { - x: w - offset, - y: offset, - column: End - }; - break; - - case BottomLeft: - p.anchor = { - x: offset, - y: h - offset, - row: End - }; - break; - - case BottomRight: - p.anchor = { - x: w - offset, - y: h - offset, - column: End, - row: End - }; - break; - } - - return p; - } - - function legendLayout(view, legend) { - var item = legend.items[0], - datum = item.datum, - orient = item.orient, - bounds = item.bounds, - x = item.x, - y = item.y, - w, - h; // cache current bounds for later comparison - - item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone(); - bounds.clear(); // adjust legend to accommodate padding and title - - legendGroupLayout(view, item, item.items[0].items[0]); // aggregate bounds to determine size, and include origin - - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - - if (datum.type === Symbols) { - legendEntryLayout(item.items[0].items[0].items[0].items); - } - - if (orient !== None$1) { - item.x = x = 0; - item.y = y = 0; - } - - item.width = w; - item.height = h; - boundStroke(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - return item; - } - - function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach(function (_) { - return b.union(_.bounds); - }); // anchor to legend origin - - b.x1 = item.padding; - b.y1 = item.padding; - return b; - } - - function legendGroupLayout(view, item, entry) { - var pad = item.padding, - ex = pad - entry.x, - ey = pad - entry.y; - - if (!item.datum.title) { - if (ex || ey) translate$1(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], - anchor = title.anchor, - tpad = item.titlePadding || 0, - tx = pad - title.x, - ty = pad - title.y; - - switch (title.orient) { - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - - case Right: - case Bottom: - break; - - default: - ey += title.bounds.height() + tpad; - } - - if (ex || ey) translate$1(view, entry, ex, ey); - - switch (title.orient) { - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - - if (tx || ty) translate$1(view, title, tx, ty); // translate legend if title pushes into negative coordinates - - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate$1(view, entry, -tx, 0); - translate$1(view, title, -tx, 0); - } - } - } - - function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - var grad = item.datum.type !== 'symbol', - vgrad = title.datum.vgrad, - e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, - s = e.bounds[y ? 'y2' : 'x2'] - item.padding, - u = vgrad && lr ? s : 0, - v = vgrad && lr ? 0 : s, - o = y <= 0 ? 0 : multiLineOffset(title); - return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o)); - } - - function translate$1(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); - } - - function legendEntryLayout(entries) { - // get max widths for each column - var widths = entries.reduce(function (w, g) { - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); // set dimensions of legend entry groups - - entries.forEach(function (g) { - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); - } - - function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], - frame = group.frame, - orient = group.orient, - anchor = group.anchor, - offset = group.offset, - padding = group.padding, - title = group.items[0].items[0], - subtitle = group.items[1] && group.items[1].items[0], - end = orient === Left || orient === Right ? height : width, - start = 0, - x = 0, - y = 0, - sx = 0, - sy = 0, - pos; - - if (frame !== Group) { - orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2); - } else if (orient === Left) { - start = height, end = 0; - } - - pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2; - - if (subtitle && subtitle.text) { - // position subtitle - switch (orient) { - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - - case Left: - sx = title.bounds.width() + padding; - break; - - case Right: - sx = -title.bounds.width() - padding; - break; - } - - tempBounds$1.clear().union(subtitle.bounds); - tempBounds$1.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - - if (set$1(subtitle, 'x', sx) | set$1(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds$1); - subtitle.mark.bounds.clear().union(tempBounds$1); - view.dirty(subtitle); - } - - tempBounds$1.clear().union(subtitle.bounds); - } else { - tempBounds$1.clear(); - } - - tempBounds$1.union(title.bounds); // position title group - - switch (orient) { - case Top: - x = pos; - y = viewBounds.y1 - tempBounds$1.height() - offset; - break; - - case Left: - x = viewBounds.x1 - tempBounds$1.width() - offset; - y = pos; - break; - - case Right: - x = viewBounds.x2 + tempBounds$1.width() + offset; - y = pos; - break; - - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - - default: - x = group.x; - y = group.y; - } - - if (set$1(group, 'x', x) | set$1(group, 'y', y)) { - tempBounds$1.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds$1); - mark.bounds.clear().union(tempBounds$1); - view.dirty(group); - } - - return group.bounds; - } - /** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ - - - function ViewLayout(params) { - Transform.call(this, null, params); - } - - var prototype$V = inherits(ViewLayout, Transform); - - prototype$V.transform = function (_, pulse) { - var view = pulse.dataflow; - - _.mark.items.forEach(function (group) { - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; - }; - - function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; - } - - function layoutGroup(view, group, _) { - var items = group.items, - width = Math.max(0, group.width || 0), - height = Math.max(0, group.height || 0), - viewBounds = new Bounds().set(0, 0, width, height), - xBounds = viewBounds.clone(), - yBounds = viewBounds.clone(), - legends = [], - title, - mark, - orient, - b, - i, - n; // layout axes, gather legends, collect bounds - - for (i = 0, n = items.length; i < n; ++i) { - mark = items[i]; - - switch (mark.role) { - case AxisRole: - b = isYAxis(mark) ? xBounds : yBounds; - b.union(axisLayout(view, mark, width, height)); - break; - - case TitleRole: - title = mark; - break; - - case LegendRole: - legends.push(legendLayout(view, mark)); - break; - - case FrameRole: - case ScopeRole: - case RowHeader: - case RowFooter: - case RowTitle: - case ColHeader: - case ColFooter: - case ColTitle: - xBounds.union(mark.bounds); - yBounds.union(mark.bounds); - break; - - default: - viewBounds.union(mark.bounds); - } - } // layout legends, adjust viewBounds - - - if (legends.length) { - // group legends by orient - var l = {}; - legends.forEach(function (item) { - orient = item.orient || Right; - if (orient !== None$1) (l[orient] || (l[orient] = [])).push(item); - }); // perform grid layout for each orient group - - for (var _orient in l) { - var g = l[_orient]; - gridLayout(view, g, legendParams(g, _orient, _.legends, xBounds, yBounds, width, height)); - } // update view bounds - - - legends.forEach(function (item) { - var b = item.bounds; - - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - - item.bounds = b; - view.dirty(item); - } - - if (_.autosize && _.autosize.type === Fit) { - // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch (item.orient) { - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - } else { - viewBounds.union(b); - } - }); - } // combine bounding boxes - - - viewBounds.union(xBounds).union(yBounds); // layout title, adjust bounds - - if (title) { - viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - } // override aggregated view bounds if content is clipped - - - if (group.clip) { - viewBounds.set(0, 0, group.width || 0, group.height || 0); - } // perform size adjustment - - - viewSizeLayout(view, group, viewBounds, _); - } - - function viewSizeLayout(view, group, viewBounds, _) { - var auto = _.autosize || {}, - type = auto.type; - if (view._autosize < 1 || !type) return; - var viewWidth = view._width, - viewHeight = view._height, - width = Math.max(0, group.width || 0), - left = Math.max(0, Math.ceil(-viewBounds.x1)), - right = Math.max(0, Math.ceil(viewBounds.x2 - width)), - height = Math.max(0, group.height || 0), - top = Math.max(0, Math.ceil(-viewBounds.y1)), - bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - - if (auto.contains === Padding) { - var _padding = view.padding(); - - viewWidth -= _padding.left + _padding.right; - viewHeight -= _padding.top + _padding.bottom; - } - - if (type === None$1) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - - view._resizeView(viewWidth, viewHeight, width, height, [left, top], auto.resize); - } - - var vtx = /*#__PURE__*/Object.freeze({ - __proto__: null, - bound: Bound, - identifier: Identifier, - mark: Mark, - overlap: Overlap, - render: Render, - viewlayout: ViewLayout - }); - /** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - - function AxisTicks(params) { - Transform.call(this, null, params); - } - - var prototype$W = inherits(AxisTicks, Transform); - - prototype$W.transform = function (_, pulse) { - if (this.value && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - ticks = this.value, - scale = _.scale, - tally = _.count == null ? _.values ? _.values.length : 10 : _.count, - count = tickCount(scale, tally, _.minstep), - format = _.format || tickFormat$1(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), - values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count); - if (ticks) out.rem = ticks; - ticks = values.map(function (value, i) { - return ingest({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - }); - }); - - if (_.extra && ticks.length) { - // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push(ingest({ - index: -1, - extra: { - value: ticks[0].value - }, - label: '' - })); - } - - out.source = ticks; - out.add = ticks; - this.value = ticks; - return out; - }; - /** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ - - - function DataJoin(params) { - Transform.call(this, null, params); - } - - var prototype$X = inherits(DataJoin, Transform); - - function defaultItemCreate() { - return ingest({}); - } - - function newMap(key) { - var map = fastmap().test(function (t) { - return t.exit; - }); - - map.lookup = function (t) { - return map.get(key(t)); - }; - - return map; - } - - prototype$X.transform = function (_, pulse) { - var df = pulse.dataflow, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - item = _.item || defaultItemCreate, - key = _.key || tupleid, - map = this.value; // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - - if (isArray(out.encode)) { - out.encode = null; - } - - if (map && (_.modified('key') || pulse.modified(key))) { - error('DataJoin does not support modified key function or fields.'); - } - - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - - pulse.visit(pulse.ADD, function (t) { - var k = key(t); - var x = map.get(k); - - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else { - out.mod.push(x); - } - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - - x.datum = t; - x.exit = false; - }); - pulse.visit(pulse.MOD, function (t) { - var k = key(t), - x = map.get(k); - - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - pulse.visit(pulse.REM, function (t) { - var k = key(t), - x = map.get(k); - - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) { - df.runAfter(map.clean); - } - - return out; - }; - /** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ - - - function Encode(params) { - Transform.call(this, null, params); - } - - var prototype$Y = inherits(Encode, Transform); - - prototype$Y.transform = function (_, pulse) { - var out = pulse.fork(pulse.ADD_REM), - fmod = _.mod || false, - encoders = _.encoders, - encode = pulse.encode; // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - - if (isArray(encode)) { - if (out.changed() || encode.every(function (e) { - return encoders[e]; - })) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else { - return pulse.StopPropagation; - } - } // marshall encoder functions - - - var reenter = encode === 'enter', - update = encoders.update || falsy, - enter = encoders.enter || falsy, - exit = encoders.exit || falsy, - set = (encode && !reenter ? encoders[encode] : update) || falsy; - - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, function (t) { - enter(t, _); - update(t, _); - }); - out.modifies(enter.output); - out.modifies(update.output); - - if (set !== falsy && set !== update) { - pulse.visit(pulse.ADD, function (t) { - set(t, _); - }); - out.modifies(set.output); - } - } - - if (pulse.changed(pulse.REM) && exit !== falsy) { - pulse.visit(pulse.REM, function (t) { - exit(t, _); - }); - out.modifies(exit.output); - } - - if (reenter || set !== falsy) { - var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - - if (reenter) { - pulse.visit(flag, function (t) { - var mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else { - pulse.visit(flag, function (t) { - if (set(t, _) || fmod) out.mod.push(t); - }); - } - - if (out.mod.length) out.modifies(set.output); - } - - return out.changed() ? out : pulse.StopPropagation; - }; - /** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - - - function LegendEntries(params) { - Transform.call(this, [], params); - } - - var prototype$Z = inherits(LegendEntries, Transform); - - prototype$Z.transform = function (_, pulse) { - if (this.value != null && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - items = this.value, - type = _.type || SymbolLegend, - scale = _.scale, - limit = +_.limit, - count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep), - lskip = !!_.values || type === SymbolLegend, - format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), - values = _.values || labelValues(scale, count), - domain, - fraction, - size, - offset, - ellipsis; - if (items) out.rem = items; - - if (type === SymbolLegend) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else { - items = values; - } - - if (isFunction(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) { - items = items.slice(1); - } // compute size offset for legend entries - - - offset = items.reduce(function (max, value) { - return Math.max(max, size(value, _)); - }, 0); - } else { - size = constant(offset = size || 8); - } - - items = items.map(function (value, index) { - return ingest({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - }); - }); - - if (ellipsis) { - ellipsis = values[items.length]; - items.push(ingest({ - index: items.length, - label: "\u2026".concat(values.length - items.length, " entries"), - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } else if (type === GradientLegend) { - domain = scale.domain(), fraction = scaleFraction(scale, domain[0], peek(domain)); // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - - if (values.length < 3 && !_.values && domain[0] !== peek(domain)) { - values = [domain[0], peek(domain)]; - } - - items = values.map(function (value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - }); - }); - } else { - size = values.length - 1; - fraction = labelFraction(scale); - items = values.map(function (value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index + 1]) - }); - }); - } - - out.source = items; - out.add = items; - this.value = items; - return out; - }; - - var Paths = fastmap({ - 'line': line$2, - 'line-radial': lineR, - 'arc': arc$2, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR - }); - - function sourceX(t) { - return t.source.x; - } - - function sourceY(t) { - return t.source.y; - } - - function targetX(t) { - return t.target.x; - } - - function targetY(t) { - return t.target.y; - } - /** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - - function LinkPath(params) { - Transform.call(this, {}, params); - } - - LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'sourceX', - 'type': 'field', - 'default': 'source.x' - }, { - 'name': 'sourceY', - 'type': 'field', - 'default': 'source.y' - }, { - 'name': 'targetX', - 'type': 'field', - 'default': 'target.x' - }, { - 'name': 'targetY', - 'type': 'field', - 'default': 'target.y' - }, { - 'name': 'orient', - 'type': 'enum', - 'default': 'vertical', - 'values': ['horizontal', 'vertical', 'radial'] - }, { - 'name': 'shape', - 'type': 'enum', - 'default': 'line', - 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal'] - }, { - 'name': 'require', - 'type': 'signal' - }, { - 'name': 'as', - 'type': 'string', - 'default': 'path' - }] - }; - var prototype$_ = inherits(LinkPath, Transform); - - prototype$_.transform = function (_, pulse) { - var sx = _.sourceX || sourceX, - sy = _.sourceY || sourceY, - tx = _.targetX || targetX, - ty = _.targetY || targetY, - as = _.as || 'path', - orient = _.orient || 'vertical', - shape = _.shape || 'line', - path = Paths.get(shape + '-' + orient) || Paths.get(shape); - - if (!path) { - error('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : '')); - } - - pulse.visit(pulse.SOURCE, function (t) { - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - return pulse.reflow(_.modified()).modifies(as); - }; // -- Link Path Generation Methods ----- - - - function line$2(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + 'L' + tx + ',' + ty; - } - - function lineR(sa, sr, ta, tr) { - return line$2(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); - } - - function arc$2(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - rr = Math.sqrt(dx * dx + dy * dy) / 2, - ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty; - } - - function arcR(sa, sr, ta, tr) { - return arc$2(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); - } - - function curve(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - ix = 0.2 * (dx + dy), - iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty; - } - - function curveR(sa, sr, ta, tr) { - return curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); - } - - function orthoX(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + 'V' + ty + 'H' + tx; - } - - function orthoY(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + 'H' + tx + 'V' + ty; - } - - function orthoR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts; - } - - function diagonalX(sx, sy, tx, ty) { - var m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty; - } - - function diagonalY(sx, sy, tx, ty) { - var m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty; - } - - function diagonalR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - mr = (sr + tr) / 2; - return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts; - } - /** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ - - - function Pie(params) { - Transform.call(this, null, params); - } - - Pie.Definition = { - 'type': 'Pie', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'startAngle', - 'type': 'number', - 'default': 0 - }, { - 'name': 'endAngle', - 'type': 'number', - 'default': 6.283185307179586 - }, { - 'name': 'sort', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['startAngle', 'endAngle'] - }] - }; - var prototype$$ = inherits(Pie, Transform); - - prototype$$.transform = function (_, pulse) { - var as = _.as || ['startAngle', 'endAngle'], - startAngle = as[0], - endAngle = as[1], - field = _.field || one, - start = _.startAngle || 0, - stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, - data = pulse.source, - values = data.map(field), - n = values.length, - a = start, - k = (stop - start) / sum(values), - index = sequence(n), - i, - t, - v; - - if (_.sort) { - index.sort(function (a, b) { - return values[a] - values[b]; - }); - } - - for (i = 0; i < n; ++i) { - v = values[index[i]]; - t = data[index[i]]; - t[startAngle] = a; - t[endAngle] = a += v * k; - } - - this.value = values; - return pulse.reflow(_.modified()).modifies(as); - }; - - var DEFAULT_COUNT = 5; - - function includeZero(scale) { - var type = scale.type; - return !scale.bins && (type === Linear || type === Pow || type === Sqrt); - } - - function includePad(type) { - return isContinuous(type) && type !== Sequential; - } - - var SKIP$2 = toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']); - /** - * Maintains a scale function mapping data values to visual channels. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - function Scale(params) { - Transform.call(this, null, params); - this.modified(true); // always treat as modified - } - - var prototype$10 = inherits(Scale, Transform); - - prototype$10.transform = function (_, pulse) { - var df = pulse.dataflow, - scale = this.value, - key = scaleKey(_); - - if (!scale || key !== scale.type) { - this.value = scale = scale$2(key)(); - } - - for (key in _) { - if (!SKIP$2[key]) { - // padding is a scale property for band/point but not others - if (key === 'padding' && includePad(scale.type)) continue; // invoke scale property setter, raise warning if not found - - isFunction(scale[key]) ? scale[key](_[key]) : df.warn('Unsupported scale property: ' + key); - } - } - - configureRange(scale, _, configureBins(scale, _, configureDomain(scale, _, df))); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - }; - - function scaleKey(_) { - var t = _.type, - d = '', - n; // backwards compatibility pre Vega 5. - - if (t === Sequential) return Sequential + '-' + Linear; - - if (isContinuousColor(_)) { - n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; - d = n === 2 ? Sequential + '-' : n === 3 ? Diverging + '-' : ''; - } - - return (d + t || Linear).toLowerCase(); - } - - function isContinuousColor(_) { - var t = _.type; - return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString)); - } - - function configureDomain(scale, _, df) { - // check raw domain, if provided use that and exit early - var raw = rawDomain(scale, _.domainRaw, df); - if (raw > -1) return raw; - var domain = _.domain, - type = scale.type, - zero = _.zero || _.zero === undefined && includeZero(scale), - n, - mid; - if (!domain) return 0; // adjust continuous domain for minimum pixel padding - - if (includePad(type) && _.padding && domain[0] !== peek(domain)) { - domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - } // adjust domain based on zero, min, max settings - - - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = (domain = domain.slice()).length - 1 || 1; - - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - - if (_.domainMid != null) { - mid = _.domainMid; - var i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } // set the scale domain - - - scale.domain(domainCheck(type, domain, df)); // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - - if (type === Ordinal) { - scale.unknown(_.domainImplicit ? implicit : undefined); - } // perform 'nice' adjustment as requested - - - if (_.nice && scale.nice) { - scale.nice(_.nice !== true && tickCount(scale, _.nice) || null); - } // return the cardinality of the domain - - - return domain.length; - } - - function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else { - return -1; - } - } - - function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs(peek(range) - range[0]), - frac = span / (span - 2 * pad), - d = type === Log ? zoomLog(domain, null, frac) : type === Sqrt ? zoomPow(domain, null, frac, 0.5) : type === Pow ? zoomPow(domain, null, frac, exponent || 1) : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) : zoomLinear(domain, null, frac); - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length - 1] = d[1]; - return domain; - } - - function domainCheck(type, domain, df) { - if (isLogarithmic(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce(function (s, v) { - return s + (v < 0 ? -1 : v > 0 ? 1 : 0); - }, 0)); - - if (s !== domain.length) { - df.warn('Log scale domain includes zero: ' + $(domain)); - } - } - - return domain; - } - - function configureBins(scale, _, count) { - var bins = _.bins; - - if (bins && !isArray(bins)) { - // generate bin boundary array - var _domain2 = scale.domain(), - lo = _domain2[0], - hi = peek(_domain2), - start = bins.start == null ? lo : bins.start, - _stop = bins.stop == null ? hi : bins.stop, - step = bins.step; - - if (!step) error('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (_stop > hi) _stop = step * Math.floor(hi / step); - bins = sequence(start, _stop + step / 2, step); - } - - if (bins) { - // assign bin boundaries to scale instance - scale.bins = bins; - } else if (scale.bins) { - // no current bins, remove bins if previously set - delete scale.bins; - } // special handling for bin-ordinal scales - - - if (scale.type === BinOrdinal) { - if (!bins) { - // the domain specifies the bins - scale.bins = scale.domain(); - } else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } // return domain cardinality - - - return count; - } - - function configureRange(scale, _, count) { - var type = scale.type, - round = _.round || false, - range = _.range; // if range step specified, calculate full range extent - - if (_.rangeStep != null) { - range = configureRangeStep(type, _, count); - } // else if a range scheme is defined, use that - else if (_.scheme) { - range = configureScheme(type, _, count); - - if (isFunction(range)) { - if (scale.interpolator) { - return scale.interpolator(range); - } else { - error("Scale type ".concat(type, " does not support interpolating color schemes.")); - } - } - } // given a range array for an interpolating scale, convert to interpolator - - - if (range && isInterpolating(type)) { - return scale.interpolator(interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma)); - } // configure rounding / interpolation - - - if (range && _.interpolate && scale.interpolate) { - scale.interpolate(interpolate(_.interpolate, _.interpolateGamma)); - } else if (isFunction(scale.round)) { - scale.round(round); - } else if (isFunction(scale.rangeRound)) { - scale.interpolate(round ? $$1.interpolateRound : $$1.interpolate); - } - - if (range) scale.range(flip(range, _.reverse)); - } - - function configureRangeStep(type, _, count) { - if (type !== Band && type !== Point) { - error('Only band and point scales support rangeStep.'); - } // calculate full range based on requested step size and padding - - - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, - inner = type === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; - return [0, _.rangeStep * bandSpace(count, inner, outer)]; - } - - function configureScheme(type, _, count) { - var extent = _.schemeExtent, - name, - scheme$1; - - if (isArray(_.scheme)) { - scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); - } else { - name = _.scheme.toLowerCase(); - scheme$1 = scheme(name); - if (!scheme$1) error("Unrecognized scheme name: ".concat(_.scheme)); - } // determine size for potential discrete range - - - count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === Quantile$1 || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate - - return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) : type === Ordinal ? scheme$1 : scheme$1.slice(0, count); - } - - function adjustScheme(scheme, extent, reverse) { - return isFunction(scheme) && (extent || reverse) ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) : scheme; - } - - function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; - } - /** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ - - - function SortItems(params) { - Transform.call(this, null, params); - } - - var prototype$11 = inherits(SortItems, Transform); - - prototype$11.transform = function (_, pulse) { - var mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum'); - if (mod) pulse.source.sort(stableCompare(_.sort)); - this.modified(mod); - return pulse; - }; - - var Zero = 'zero', - Center = 'center', - Normalize = 'normalize', - DefOutput = ['y0', 'y1']; - /** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ - - function Stack(params) { - Transform.call(this, null, params); - } - - Stack.Definition = { - 'type': 'Stack', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'offset', - 'type': 'enum', - 'default': Zero, - 'values': [Zero, Center, Normalize] - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': DefOutput - }] - }; - var prototype$12 = inherits(Stack, Transform); - - prototype$12.transform = function (_, pulse) { - var as = _.as || DefOutput, - y0 = as[0], - y1 = as[1], - sort = stableCompare(_.sort), - field = _.field || one, - stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, - groups, - i, - n, - max; // partition, sum, and sort the stack groups - - groups = partition$2(pulse.source, _.groupby, sort, field); // compute stack layouts per group - - for (i = 0, n = groups.length, max = groups.max; i < n; ++i) { - stack(groups[i], max, field, y0, y1); - } - - return pulse.reflow(_.modified()).modifies(as); - }; - - function stackCenter(group, max, field, y0, y1) { - var last = (max - group.sum) / 2, - m = group.length, - j = 0, - t; - - for (; j < m; ++j) { - t = group[j]; - t[y0] = last; - t[y1] = last += Math.abs(field(t)); - } - } - - function stackNormalize(group, max, field, y0, y1) { - var scale = 1 / group.sum, - last = 0, - m = group.length, - j = 0, - v = 0, - t; - - for (; j < m; ++j) { - t = group[j]; - t[y0] = last; - t[y1] = last = scale * (v += Math.abs(field(t))); - } - } - - function stackZero(group, max, field, y0, y1) { - var lastPos = 0, - lastNeg = 0, - m = group.length, - j = 0, - v, - t; - - for (; j < m; ++j) { - t = group[j]; - v = +field(t); - - if (v < 0) { - t[y0] = lastNeg; - t[y1] = lastNeg += v; - } else { - t[y0] = lastPos; - t[y1] = lastPos += v; - } - } - } - - function partition$2(data, groupby, sort, field) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - m, - t, - k, - g, - s, - max; // partition data points into stack groups - - - if (groupby == null) { - groups.push(data.slice()); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - groups.push(g); - } - - g.push(t); - } - } // compute sums of groups, sort groups as needed - - - for (k = 0, max = 0, m = groups.length; k < m; ++k) { - g = groups[k]; - - for (i = 0, s = 0, n = g.length; i < n; ++i) { - s += Math.abs(field(g[i])); - } - - g.sum = s; - if (s > max) max = s; - if (sort) g.sort(sort); - } - - groups.max = max; - return groups; - } - - var encode = /*#__PURE__*/Object.freeze({ - __proto__: null, - axisticks: AxisTicks, - datajoin: DataJoin, - encode: Encode, - legendentries: LegendEntries, - linkpath: LinkPath, - pie: Pie, - scale: Scale, - sortitems: SortItems, - stack: Stack - }); - - function noop$2() {} - - var cases = [[], [[[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]]], []]; // Implementation adapted from d3/d3-contour. Thanks! - - function contours() { - var dx = 1, - dy = 1, - smooth = smoothLinear; - - function contours(values, tz) { - 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.js - - - function contour(values, value) { - var polygons = [], - holes = []; - isorings(values, value, function (ring) { - smooth(ring, values, value); - if (area$2(ring) > 0) polygons.push([ring]);else holes.push(ring); - }); - holes.forEach(function (hole) { - for (var i = 0, n = polygons.length, polygon; i < n; ++i) { - if (contains((polygon = polygons[i])[0], hole) !== -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/stitch.js - - - function isorings(values, value, callback) { - var fragmentByStart = new Array(), - fragmentByEnd = new Array(), - x, - y, - t0, - t1, - t2, - t3; // Special case for the first row (y = -1, t2 = t3 = 0). - - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - - while (++x < dx - 1) { - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - - cases[t1 << 0].forEach(stitch); // General case for the intermediate rows. - - while (++y < dy - 1) { - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - - while (++x < dx - 1) { - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - - cases[t1 | t2 << 3].forEach(stitch); - } // Special case for the last row (y = dy - 1, t0 = t1 = 0). - - - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - - while (++x < dx - 1) { - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - - cases[t2 << 3].forEach(stitch); - - function stitch(line) { - var start = [line[0][0] + x, line[0][1] + y], - end = [line[1][0] + x, line[1][1] + y], - startIndex = index(start), - endIndex = index(end), - f, - g; - - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[f.start] = fragmentByEnd[g.end] = { - start: f.start, - end: g.end, - ring: f.ring.concat(g.ring) - }; - } - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[g.start] = fragmentByEnd[f.end] = { - start: g.start, - end: f.end, - ring: g.ring.concat(f.ring) - }; - } - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else { - fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { - 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 = point[0], - y = point[1], - xt = x | 0, - yt = y | 0, - v0, - v1 = values[yt * dx + xt]; - - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); - } - - contours.contour = contour; - - contours.size = function (_) { - if (!arguments.length) return [dx, dy]; - - var _0 = Math.floor(_[0]), - _1 = Math.floor(_[1]); - - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, contours; - }; - - contours.smooth = function (_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop$2, contours) : smooth === smoothLinear; - }; - - return contours; - } - - function area$2(ring) { - var i = 0, - n = ring.length, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - - while (++i < n) { - area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - } - - return area; - } - - function contains(ring, hole) { - var i = -1, - n = hole.length, - c; - - while (++i < n) { - if (c = ringContains(ring, hole[i])) return c; - } - - return 0; - } - - function ringContains(ring, point) { - var x = point[0], - y = point[1], - contains = -1; - - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], - xi = pi[0], - yi = pi[1], - pj = ring[j], - xj = pj[0], - yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains; - } - - return contains; - } - - function segmentContains(a, b, c) { - var i; - return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); - } - - function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); - } - - function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; - } - - function quantize$1(k, nice, zero) { - return function (values) { - var ex = extent(values), - start = zero ? Math.min(ex[0], 0) : ex[0], - stop = ex[1], - span = stop - start, - step = nice ? tickStep(start, stop, k) : span / (k + 1); - return sequence(step, stop, step); - }; - } - /** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ - - - function Isocontour(params) { - Transform.call(this, null, params); - } - - Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, { - 'name': 'levels', - 'type': 'number' - }, { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, { - 'name': 'resolve', - 'type': 'enum', - 'values': ['shared', 'independent'], - 'default': 'independent' - }, { - 'name': 'zero', - 'type': 'boolean', - 'default': true - }, { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }, { - 'name': 'scale', - 'type': 'number', - 'expr': true - }, { - 'name': 'translate', - 'type': 'number', - 'array': true, - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'default': 'contour' - }] - }; - var prototype$13 = inherits(Isocontour, Transform); - - prototype$13.transform = function (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - field = _.field || identity, - contour = contours().smooth(_.smooth !== false), - tz = _.thresholds || levels(source, field, _), - as = _.as === null ? null : _.as || 'contour', - values = []; - source.forEach(function (t) { - var grid = field(t); // generate contour paths in GeoJSON format - - var paths = contour.size([grid.width, grid.height])(grid.values, isArray(tz) ? tz : tz(grid.values)); // adjust contour path coordinates as needed - - transformPaths(paths, grid, t, _); // ingest; copy source data properties to output - - paths.forEach(function (p) { - values.push(rederive(t, ingest(as != null ? _defineProperty({}, as, p) : p))); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; - }; - - function levels(values, f, _) { - var q = quantize$1(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' ? q : q(values.map(function (t) { - return max(f(t).values); - })); - } - - function transformPaths(paths, grid, datum, _) { - var s = _.scale || grid.scale, - t = _.translate || grid.translate; - if (isFunction(s)) s = s(datum, _); - if (isFunction(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - var sx = (isNumber(s) ? s : s[0]) || 1, - sy = (isNumber(s) ? s : s[1]) || 1, - tx = t && t[0] || 0, - ty = t && t[1] || 0; - paths.forEach(transform$1(grid, sx, sy, tx, ty)); - } - - function transform$1(grid, sx, sy, tx, ty) { - var x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - flip = sx * sy < 0; - - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); - } - - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - - coordinates.forEach(transformPoint); - } - - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; - } - - return function (geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; - }; - } - - function radius(bw, data, f) { - var v = bw >= 0 ? bw : bandwidthNRD(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); - } - - function number$4(_) { - return isFunction(_) ? _ : constant(+_); - } // Implementation adapted from d3/d3-contour. Thanks! - - - function density2D() { - var x = function x(d) { - return d[0]; - }, - y = function y(d) { - return d[1]; - }, - weight = one, - bandwidth = [-1, -1], - dx = 960, - dy = 500, - k = 2; // log2(cellSize) - - - function density(data, counts) { - var rx = radius(bandwidth[0], data, x) >> k, - // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, - // blur y-radius - ox = rx ? rx + 2 : 0, - // x-offset padding for blur - oy = ry ? ry + 2 : 0, - // y-offset padding for blur - n = 2 * ox + (dx >> k), - // grid width - m = 2 * oy + (dy >> k), - // grid height - values0 = new Float32Array(n * m), - values1 = new Float32Array(n * m); - var values = values0; - data.forEach(function (d) { - var xi = ox + (+x(d) >> k), - yi = oy + (+y(d) >> k); - - if (xi >= 0 && xi < n && yi >= 0 && yi < m) { - values0[xi + yi * n] += +weight(d); - } - }); - - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } // scale density estimates - // density in points per square pixel or probability density - - - var s = counts ? Math.pow(2, -2 * k) : 1 / sum(values); - - for (var i = 0, _sz = n * m; i < _sz; ++i) { - values[i] *= s; - } - - return { - values: values, - scale: 1 << k, - width: n, - height: m, - x1: ox, - y1: oy, - x2: ox + (dx >> k), - y2: oy + (dy >> k) - }; - } - - density.x = function (_) { - return arguments.length ? (x = number$4(_), density) : x; - }; - - density.y = function (_) { - return arguments.length ? (y = number$4(_), density) : y; - }; - - density.weight = function (_) { - return arguments.length ? (weight = number$4(_), density) : weight; - }; - - density.size = function (_) { - if (!arguments.length) return [dx, dy]; - - var _0 = +_[0], - _1 = +_[1]; - - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, density; - }; - - density.cellSize = function (_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) error('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - - density.bandwidth = function (_) { - if (!arguments.length) return bandwidth; - _ = array(_); - if (_.length === 1) _ = [+_[0], +_[0]]; - if (_.length !== 2) error('invalid bandwidth'); - return bandwidth = _, density; - }; - - return density; - } - - function blurX(n, m, source, target, r) { - var w = (r << 1) + 1; - - for (var j = 0; j < m; ++j) { - for (var i = 0, sr = 0; i < n + r; ++i) { - if (i < n) { - sr += source[i + j * n]; - } - - if (i >= r) { - if (i >= w) { - sr -= source[i - w + j * n]; - } - - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } - } - } - - function blurY(n, m, source, target, r) { - var w = (r << 1) + 1; - - for (var i = 0; i < n; ++i) { - for (var j = 0, sr = 0; j < m + r; ++j) { - if (j < m) { - sr += source[i + j * n]; - } - - if (j >= r) { - if (j >= w) { - sr -= source[i + (j - w) * n]; - } - - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } - } - } - /** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ - - - function KDE2D(params) { - Transform.call(this, null, params); - } - - KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, { - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'weight', - 'type': 'field' - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'cellSize', - 'type': 'number' - }, { - 'name': 'bandwidth', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'default': 'grid' - }] - }; - var prototype$14 = inherits(KDE2D, Transform); - var PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth']; - - function params(obj, _) { - PARAMS.forEach(function (param) { - return _[param] != null ? obj[param](_[param]) : 0; - }); - return obj; - } - - prototype$14.transform = function (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - groups = partition$3(source, _.groupby), - names = (_.groupby || []).map(accessorName), - kde = params(density2D(), _), - as = _.as || 'grid', - values = []; - - function set(t, vals) { - for (var i = 0; i < names.length; ++i) { - t[names[i]] = vals[i]; - } - - return t; - } // generate density raster grids - - - values = groups.map(function (g) { - return ingest(set(_defineProperty({}, as, kde(g, _.counts)), g.dims)); - }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; - }; - - function partition$3(data, groupby) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - t, - k, - g; // partition data points into groups - - - if (groupby == null) { - groups.push(data); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - - g.push(t); - } - } - - return groups; - } - /** - * Generate contours based on kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ - - - function Contour(params) { - Transform.call(this, null, params); - } - - Contour.Definition = { - 'type': 'Contour', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, { - 'name': 'values', - 'type': 'number', - 'array': true - }, { - 'name': 'x', - 'type': 'field' - }, { - 'name': 'y', - 'type': 'field' - }, { - 'name': 'weight', - 'type': 'field' - }, { - 'name': 'cellSize', - 'type': 'number' - }, { - 'name': 'bandwidth', - 'type': 'number' - }, { - 'name': 'count', - 'type': 'number' - }, { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }] - }; - var prototype$15 = inherits(Contour, Transform); - - prototype$15.transform = function (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - contour = contours().smooth(_.smooth !== false), - values = _.values, - thresh = _.thresholds || quantize$1(_.count || 10, _.nice, !!values), - size = _.size, - grid, - post; - - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform$1(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [grid.width, grid.height]; - values = grid.values; - } - - thresh = isArray(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map(ingest); - return out; - }; - - var Feature = 'Feature'; - var FeatureCollection = 'FeatureCollection'; - var MultiPoint = 'MultiPoint'; - /** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ - - function GeoJSON(params) { - Transform.call(this, null, params); - } - - GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'length': 2 - }, { - 'name': 'geojson', - 'type': 'field' - }] - }; - var prototype$16 = inherits(GeoJSON, Transform); - - prototype$16.transform = function (_, pulse) { - var features = this._features, - points = this._points, - fields = _.fields, - lon = fields && fields[0], - lat = fields && fields[1], - geojson = _.geojson || !fields && identity, - flag = pulse.ADD, - mod; - mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified(accessorFields(geojson)) || lon && pulse.modified(accessorFields(lon)) || lat && pulse.modified(accessorFields(lat)); - - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = features = []; - this._points = points = []; - } - - if (geojson) { - pulse.visit(flag, function (t) { - features.push(geojson(t)); - }); - } - - if (lon && lat) { - pulse.visit(flag, function (t) { - var x = lon(t), - y = lat(t); - - if (x != null && y != null && (x = +x) === x && (y = +y) === y) { - points.push([x, y]); - } - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - - this.value = { - type: FeatureCollection, - features: features - }; - }; - - var abs = Math.abs; - var cos = Math.cos; - var sin = Math.sin; - var epsilon$1 = 1e-6; - var pi = Math.PI; - var halfPi = pi / 2; - var sqrt2 = sqrt$1(2); - - function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); - } - - function sqrt$1(x) { - return x > 0 ? Math.sqrt(x) : 0; - } - - function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * sin(phi), - i = 30, - delta; - - do { - phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi)); - } while (abs(delta) > epsilon$1 && --i > 0); - - return phi / 2; - } - - function mollweideBromleyRaw(cx, cy, cp) { - function forward(lambda, phi) { - return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)]; - } - - forward.invert = function (x, y) { - return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)]; - }; - - return forward; - } - - var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); - - function geoMollweide() { - return d3Geo.geoProjection(mollweideRaw).scale(169.529); - } - - var defaultPath = d3Geo.geoPath(); - var projectionProperties = [// standard properties in d3-geo - 'clipAngle', 'clipExtent', 'scale', 'translate', 'center', 'rotate', 'parallels', 'precision', 'reflectX', 'reflectY', // extended properties in d3-geo-projections - 'coefficient', 'distance', 'fraction', 'lobes', 'parallel', 'radius', 'ratio', 'spacing', 'tilt']; - /** - * Augment projections with their type and a copy method. - */ - - function create$1(type, constructor) { - return function projection() { - var p = constructor(); - p.type = type; - p.path = d3Geo.geoPath().projection(p); - - p.copy = p.copy || function () { - var c = projection(); - projectionProperties.forEach(function (prop) { - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - - return p; - }; - } - - function projection(type, proj) { - if (!type || typeof type !== 'string') { - throw new Error('Projection type must be a name string.'); - } - - type = type.toLowerCase(); - - if (arguments.length > 1) { - projections[type] = create$1(type, proj); - return this; - } else { - return projections[type] || null; - } - } - - function getProjectionPath(proj) { - return proj && proj.path || defaultPath; - } - - var projections = { - // base d3-geo projection types - albers: d3Geo.geoAlbers, - albersusa: d3Geo.geoAlbersUsa, - azimuthalequalarea: d3Geo.geoAzimuthalEqualArea, - azimuthalequidistant: d3Geo.geoAzimuthalEquidistant, - conicconformal: d3Geo.geoConicConformal, - conicequalarea: d3Geo.geoConicEqualArea, - conicequidistant: d3Geo.geoConicEquidistant, - equalEarth: d3Geo.geoEqualEarth, - equirectangular: d3Geo.geoEquirectangular, - gnomonic: d3Geo.geoGnomonic, - identity: d3Geo.geoIdentity, - mercator: d3Geo.geoMercator, - mollweide: geoMollweide, - naturalEarth1: d3Geo.geoNaturalEarth1, - orthographic: d3Geo.geoOrthographic, - stereographic: d3Geo.geoStereographic, - transversemercator: d3Geo.geoTransverseMercator - }; - - for (var key$1 in projections) { - projection(key$1, projections[key$1]); - } - /** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ - - - function GeoPath(params) { - Transform.call(this, null, params); - } - - GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'projection', - 'type': 'projection' - }, { - 'name': 'field', - 'type': 'field' - }, { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'default': 'path' - }] - }; - var prototype$17 = inherits(GeoPath, Transform); - - prototype$17.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - path = this.value, - field = _.field || identity, - as = _.as || 'path', - flag = out.SOURCE; - - function set(t) { - t[as] = path(field(t)); - } - - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = getProjectionPath(_.projection); - out.materialize().reflow(); - } else { - flag = field === identity || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD; - } - - var prev = initPath(path, _.pointRadius); - out.visit(flag, set); - path.pointRadius(prev); - return out.modifies(as); - }; - - function initPath(path, pointRadius) { - var prev = path.pointRadius(); - path.context(null); - - if (pointRadius != null) { - path.pointRadius(pointRadius); - } - - return prev; - } - /** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ - - - function GeoPoint(params) { - Transform.call(this, null, params); - } - - GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'projection', - 'type': 'projection', - 'required': true - }, { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['x', 'y'] - }] - }; - var prototype$18 = inherits(GeoPoint, Transform); - - prototype$18.transform = function (_, pulse) { - var proj = _.projection, - lon = _.fields[0], - lat = _.fields[1], - as = _.as || ['x', 'y'], - x = as[0], - y = as[1], - mod; - - function set(t) { - var xy = proj([lon(t), lat(t)]); - - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - - if (_.modified()) { - // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - } else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - - return pulse.modifies(as); - }; - /** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ - - - function GeoShape(params) { - Transform.call(this, null, params); - } - - GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': { - 'modifies': true, - 'nomod': true - }, - 'params': [{ - 'name': 'projection', - 'type': 'projection' - }, { - 'name': 'field', - 'type': 'field', - 'default': 'datum' - }, { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'default': 'shape' - }] - }; - var prototype$19 = inherits(GeoShape, Transform); - - prototype$19.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - shape = this.value, - as = _.as || 'shape', - flag = out.ADD; - - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator(getProjectionPath(_.projection), _.field || field('datum'), _.pointRadius); - out.materialize().reflow(); - flag = out.SOURCE; - } - - out.visit(flag, function (t) { - t[as] = shape; - }); - return out.modifies(as); - }; - - function shapeGenerator(path, field, pointRadius) { - var shape = pointRadius == null ? function (_) { - return path(field(_)); - } : function (_) { - var prev = path.pointRadius(), - value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - - shape.context = function (_) { - path.context(_); - return shape; - }; - - return shape; - } - /** - * GeoJSON feature generator for creating graticules. - * @constructor - */ - - - function Graticule(params) { - Transform.call(this, [], params); - this.generator = d3Geo.geoGraticule(); - } - - Graticule.Definition = { - 'type': 'Graticule', - 'metadata': { - 'changes': true, - 'generates': true - }, - 'params': [{ - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'extentMajor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'extentMinor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'step', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'stepMajor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [90, 360] - }, { - 'name': 'stepMinor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [10, 10] - }, { - 'name': 'precision', - 'type': 'number', - 'default': 2.5 - }] - }; - var prototype$1a = inherits(Graticule, Transform); - - prototype$1a.transform = function (_, pulse) { - var src = this.value, - gen = this.generator, - t; - - if (!src.length || _.modified()) { - for (var prop in _) { - if (isFunction(gen[prop])) { - gen[prop](_[prop]); - } - } - } - - t = gen(); - - if (src.length) { - pulse.mod.push(replace(src[0], t)); - } else { - pulse.add.push(ingest(t)); - } - - src[0] = t; - return pulse; - }; - /** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ - - - function Heatmap(params) { - Transform.call(this, null, params); - } - - Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'color', - 'type': 'string', - 'expr': true - }, { - 'name': 'opacity', - 'type': 'number', - 'expr': true - }, { - 'name': 'resolve', - 'type': 'enum', - 'values': ['shared', 'independent'], - 'default': 'independent' - }, { - 'name': 'as', - 'type': 'string', - 'default': 'image' - }] - }; - var prototype$1b = inherits(Heatmap, Transform); - - prototype$1b.transform = function (_, pulse) { - if (!pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var source = pulse.materialize(pulse.SOURCE).source, - shared = _.resolve === 'shared', - field = _.field || identity, - opacity = opacity_(_.opacity, _), - color = color_(_.color, _), - as = _.as || 'image', - obj = { - $x: 0, - $y: 0, - $value: 0, - $max: shared ? max(source.map(function (t) { - return max(field(t).values); - })) : 0 - }; - source.forEach(function (t) { - var v = field(t); // build proxy data object - - var o = extend({}, t, obj); // set maximum value if not globally shared - - if (!shared) o.$max = max(v.values || []); // generate canvas image - // optimize color/opacity if not pixel-dependent - - t[as] = toCanvas(v, o, color.dep ? color : constant(color(o)), opacity.dep ? opacity : constant(opacity(o))); - }); - return pulse.reflow(true).modifies(as); - }; // get image color function - - - function color_(color, _) { - var f; - - if (isFunction(color)) { - f = function f(obj) { - return d3Color.rgb(color(obj, _)); - }; - - f.dep = dependency(color); - } else { - // default to mid-grey - f = constant(d3Color.rgb(color || '#888')); - } - - return f; - } // get image opacity function - - - function opacity_(opacity, _) { - var f; - - if (isFunction(opacity)) { - f = function f(obj) { - return opacity(obj, _); - }; - - f.dep = dependency(opacity); - } else if (opacity) { - f = constant(opacity); - } else { - // default to [0, max] opacity gradient - f = function f(obj) { - return obj.$value / obj.$max || 0; - }; - - f.dep = true; - } - - return f; - } // check if function depends on individual pixel data - - - function dependency(f) { - if (!isFunction(f)) return false; - var set = toSet(accessorFields(f)); - return set.$x || set.$y || set.$value || set.$max; - } // render raster grid to canvas - - - function toCanvas(grid, obj, color, opacity) { - var n = grid.width, - m = grid.height, - x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - x2 = grid.x2 || n, - y2 = grid.y2 || m, - val = grid.values, - value = val ? function (i) { - return val[i]; - } : zero, - can = domCanvas(x2 - x1, y2 - y1), - ctx = can.getContext('2d'), - img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), - pix = img.data; - - for (var j = y1, k = 0; j < y2; ++j) { - obj.$y = j - y1; - - for (var i = x1, r = j * n; i < x2; ++i, k += 4) { - obj.$x = i - x1; - obj.$value = value(i + r); - var v = color(obj); - pix[k + 0] = v.r; - pix[k + 1] = v.g; - pix[k + 2] = v.b; - pix[k + 3] = ~~(255 * opacity(obj)); - } - } - - ctx.putImageData(img, 0, 0); - return can; - } - /** - * Maintains a cartographic projection. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - - function Projection(params) { - Transform.call(this, null, params); - this.modified(true); // always treat as modified - } - - var prototype$1c = inherits(Projection, Transform); - - prototype$1c.transform = function (_, pulse) { - var proj = this.value; - - if (!proj || _.modified('type')) { - this.value = proj = create$2(_.type); - projectionProperties.forEach(function (prop) { - if (_[prop] != null) set$2(proj, prop, _[prop]); - }); - } else { - projectionProperties.forEach(function (prop) { - if (_.modified(prop)) set$2(proj, prop, _[prop]); - }); - } - - if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); - if (_.fit) fit(proj, _); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - }; - - function fit(proj, _) { - var data = collectGeoJSON(_.fit); - _.extent ? proj.fitExtent(_.extent, data) : _.size ? proj.fitSize(_.size, data) : 0; - } - - function create$2(type) { - var constructor = projection((type || 'mercator').toLowerCase()); - if (!constructor) error('Unrecognized projection type: ' + type); - return constructor(); - } - - function set$2(proj, key, value) { - if (isFunction(proj[key])) proj[key](value); - } - - function collectGeoJSON(data) { - data = array(data); - return data.length === 1 ? data[0] : { - type: FeatureCollection, - features: data.reduce(function (a, f) { - return a.concat(featurize(f)); - }, []) - }; - } - - function featurize(f) { - return f.type === FeatureCollection ? f.features : array(f).filter(function (d) { - return d != null; - }).map(function (d) { - return d.type === Feature ? d : { - type: Feature, - geometry: d - }; - }); - } - - var geo = /*#__PURE__*/Object.freeze({ - __proto__: null, - contour: Contour, - geojson: GeoJSON, - geopath: GeoPath, - geopoint: GeoPoint, - geoshape: GeoShape, - graticule: Graticule, - heatmap: Heatmap, - isocontour: Isocontour, - kde2d: KDE2D, - projection: Projection - }); - var ForceMap = { - center: d3Force.forceCenter, - collide: d3Force.forceCollide, - nbody: d3Force.forceManyBody, - link: d3Force.forceLink, - x: d3Force.forceX, - y: d3Force.forceY - }; - var Forces = 'forces', - ForceParams = ['alpha', 'alphaMin', 'alphaTarget', 'velocityDecay', 'forces'], - ForceConfig = ['static', 'iterations'], - ForceOutput = ['x', 'y', 'vx', 'vy']; - /** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.forces - The forces to apply. - */ - - function Force(params) { - Transform.call(this, null, params); - } - - Force.Definition = { - 'type': 'Force', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'static', - 'type': 'boolean', - 'default': false - }, { - 'name': 'restart', - 'type': 'boolean', - 'default': false - }, { - 'name': 'iterations', - 'type': 'number', - 'default': 300 - }, { - 'name': 'alpha', - 'type': 'number', - 'default': 1 - }, { - 'name': 'alphaMin', - 'type': 'number', - 'default': 0.001 - }, { - 'name': 'alphaTarget', - 'type': 'number', - 'default': 0 - }, { - 'name': 'velocityDecay', - 'type': 'number', - 'default': 0.4 - }, { - 'name': 'forces', - 'type': 'param', - 'array': true, - 'params': [{ - 'key': { - 'force': 'center' - }, - 'params': [{ - 'name': 'x', - 'type': 'number', - 'default': 0 - }, { - 'name': 'y', - 'type': 'number', - 'default': 0 - }] - }, { - 'key': { - 'force': 'collide' - }, - 'params': [{ - 'name': 'radius', - 'type': 'number', - 'expr': true - }, { - 'name': 'strength', - 'type': 'number', - 'default': 0.7 - }, { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'force': 'nbody' - }, - 'params': [{ - 'name': 'strength', - 'type': 'number', - 'default': -30 - }, { - 'name': 'theta', - 'type': 'number', - 'default': 0.9 - }, { - 'name': 'distanceMin', - 'type': 'number', - 'default': 1 - }, { - 'name': 'distanceMax', - 'type': 'number' - }] - }, { - 'key': { - 'force': 'link' - }, - 'params': [{ - 'name': 'links', - 'type': 'data' - }, { - 'name': 'id', - 'type': 'field' - }, { - 'name': 'distance', - 'type': 'number', - 'default': 30, - 'expr': true - }, { - 'name': 'strength', - 'type': 'number', - 'expr': true - }, { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'force': 'x' - }, - 'params': [{ - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, { - 'name': 'x', - 'type': 'field' - }] - }, { - 'key': { - 'force': 'y' - }, - 'params': [{ - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, { - 'name': 'y', - 'type': 'field' - }] - }] - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'modify': false, - 'default': ForceOutput - }] - }; - var prototype$1d = inherits(Force, Transform); - - prototype$1d.transform = function (_, pulse) { - var sim = this.value, - change = pulse.changed(pulse.ADD_REM), - params = _.modified(ForceParams), - iters = _.iterations || 300; // configure simulation - - - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - - pulse.modifies('index'); - } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - - if (params || pulse.changed(pulse.MOD)) { - setup(sim, _, 0, pulse); - } - } // run simulation - - - if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - - if (_.static) { - for (sim.stop(); --iters >= 0;) { - sim.tick(); - } - } else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } - } - - return this.finish(_, pulse); - }; - - prototype$1d.finish = function (_, pulse) { - var dataflow = pulse.dataflow; // inspect dependencies, touch link source data - - for (var args = this._argops, j = 0, m = args.length, arg; j < m; ++j) { - arg = args[j]; - - if (arg.name !== Forces || arg.op._argval.force !== 'link') { - continue; - } - - for (var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i) { - if (ops[i].name === 'links' && (op = ops[i].op.source)) { - dataflow.pulse(op, dataflow.changeset().reflow()); - break; - } - } - } // reflow all nodes - - - return pulse.reflow(_.modified()).modifies(ForceOutput); - }; - - function rerun(df, op) { - return function () { - df.touch(op).run(); - }; - } - - function simulation(nodes, _) { - var sim = d3Force.forceSimulation(nodes), - stopped = false, - stop = sim.stop, - restart = sim.restart; - - sim.stopped = function () { - return stopped; - }; - - sim.restart = function () { - stopped = false; - return restart(); - }; - - sim.stop = function () { - stopped = true; - return stop(); - }; - - return setup(sim, _, true).on('end', function () { - stopped = true; - }); - } - - function setup(sim, _, init, pulse) { - var f = array(_.forces), - i, - n, - p, - name; - - for (i = 0, n = ForceParams.length; i < n; ++i) { - p = ForceParams[i]; - if (p !== Forces && _.modified(p)) sim[p](_[p]); - } - - for (i = 0, n = f.length; i < n; ++i) { - name = Forces + i; - p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null; - if (p) sim.force(name, p); - } - - for (n = sim.numForces || 0; i < n; ++i) { - sim.force(Forces + i, null); // remove - } - - sim.numForces = f.length; - return sim; - } - - function modified(f, pulse) { - var k, v; - - for (k in f) { - if (isFunction(v = f[k]) && pulse.modified(accessorFields(v))) return 1; - } - - return 0; - } - - function getForce(_) { - var f, p; - - if (!hasOwnProperty(ForceMap, _.force)) { - error('Unrecognized force: ' + _.force); - } - - f = ForceMap[_.force](); - - for (p in _) { - if (isFunction(f[p])) setForceParam(f[p], _[p], _); - } - - return f; - } - - function setForceParam(f, v, _) { - f(isFunction(v) ? function (d) { - return v(d, _); - } : v); - } - - var force = /*#__PURE__*/Object.freeze({ - __proto__: null, - force: Force - }); // Build lookup table mapping tuple keys to tree node instances - - function lookup$3(tree, key, filter) { - var map = {}; - tree.each(function (node) { - var t = node.data; - if (filter(t)) map[key(t)] = node; - }); - tree.lookup = map; - return tree; - } - /** - * Nest tuples into a tree structure, grouped by key values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ - - - function Nest(params) { - Transform.call(this, null, params); - } - - Nest.Definition = { - 'type': 'Nest', - 'metadata': { - 'treesource': true, - 'changes': true - }, - 'params': [{ - 'name': 'keys', - 'type': 'field', - 'array': true - }, { - 'name': 'generate', - 'type': 'boolean' - }] - }; - var prototype$1e = inherits(Nest, Transform); - - function children(n) { - return n.values; - } - - prototype$1e.transform = function (_, pulse) { - if (!pulse.source) { - error('Nest transform requires an upstream data source.'); - } - - var gen = _.generate, - mod = _.modified(), - out = pulse.clone(), - tree = this.value; - - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) { - tree.each(function (node) { - if (node.children && isTuple(node.data)) { - out.rem.push(node.data); - } - }); - } // generate new tree structure - - - this.value = tree = d3Hierarchy.hierarchy({ - values: array(_.keys).reduce(function (n, k) { - n.key(k); - return n; - }, nest()).entries(out.source) - }, children); // collect nodes to add - - if (gen) { - tree.each(function (node) { - if (node.children) { - node = ingest(node.data); - out.add.push(node); - out.source.push(node); - } - }); - } // build lookup table - - - lookup$3(tree, tupleid, tupleid); - } - - out.source.root = tree; - return out; - }; - - function nest() { - var keys = [], - nest; - - function apply(array, depth) { - if (depth >= keys.length) { - return array; - } - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - value, - valuesByKey = {}, - values, - result = {}; - - while (++i < n) { - keyValue = key(value = array[i]) + ''; - - if (values = valuesByKey[keyValue]) { - values.push(value); - } else { - valuesByKey[keyValue] = [value]; - } - } - - for (keyValue in valuesByKey) { - result[keyValue] = apply(valuesByKey[keyValue], depth); - } - - return result; - } - - function _entries(map, depth) { - if (++depth > keys.length) return map; - var array = [], - k; - - for (k in map) { - array.push({ - key: k, - values: _entries(map[k], depth) - }); - } - - return array; - } - - return nest = { - entries: function entries(array) { - return _entries(apply(array, 0), 0); - }, - key: function key(d) { - keys.push(d); - return nest; - } - }; - } - /** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - - function HierarchyLayout(params) { - Transform.call(this, null, params); - } - - var prototype$1f = inherits(HierarchyLayout, Transform); - - prototype$1f.transform = function (_, pulse) { - if (!pulse.source || !pulse.source.root) { - error(this.constructor.name + ' transform requires a backing tree data source.'); - } - - var layout = this.layout(_.method), - fields = this.fields, - root = pulse.source.root, - as = _.as || fields; - if (_.field) root.sum(_.field);else root.count(); - if (_.sort) root.sort(stableCompare(_.sort, function (d) { - return d.data; - })); - setParams(layout, this.params, _); - - if (layout.separation) { - layout.separation(_.separation !== false ? defaultSeparation : one); - } - - try { - this.value = layout(root); - } catch (err) { - error(err); - } - - root.each(function (node) { - setFields(node, fields, as); - }); - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); - }; - - function setParams(layout, params, _) { - for (var p, i = 0, n = params.length; i < n; ++i) { - p = params[i]; - if (p in _) layout[p](_[p]); - } - } - - function setFields(node, fields, as) { - var t = node.data; - - for (var i = 0, n = fields.length - 1; i < n; ++i) { - t[as[i]] = node[fields[i]]; - } - - t[as[n]] = node.children ? node.children.length : 0; - } - - function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; - } - - var Output$1 = ['x', 'y', 'r', 'depth', 'children']; - /** - * Packed circle tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ - - function Pack(params) { - HierarchyLayout.call(this, params); - } - - Pack.Definition = { - 'type': 'Pack', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, { - 'name': 'radius', - 'type': 'field', - 'default': null - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$1.length, - 'default': Output$1 - }] - }; - var prototype$1g = inherits(Pack, HierarchyLayout); - prototype$1g.layout = d3Hierarchy.pack; - prototype$1g.params = ['radius', 'size', 'padding']; - prototype$1g.fields = Output$1; - var Output$2 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children']; - /** - * Partition tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ - - function Partition(params) { - HierarchyLayout.call(this, params); - } - - Partition.Definition = { - 'type': 'Partition', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$2.length, - 'default': Output$2 - }] - }; - var prototype$1h = inherits(Partition, HierarchyLayout); - prototype$1h.layout = d3Hierarchy.partition; - prototype$1h.params = ['size', 'round', 'padding']; - prototype$1h.fields = Output$2; - /** - * Stratify a collection of tuples into a tree structure based on - * id and parent id fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.key - Unique key field for each tuple. - * @param {function(object): *} params.parentKey - Field with key for parent tuple. - */ - - function Stratify(params) { - Transform.call(this, null, params); - } - - Stratify.Definition = { - 'type': 'Stratify', - 'metadata': { - 'treesource': true - }, - 'params': [{ - 'name': 'key', - 'type': 'field', - 'required': true - }, { - 'name': 'parentKey', - 'type': 'field', - 'required': true - }] - }; - var prototype$1i = inherits(Stratify, Transform); - - prototype$1i.transform = function (_, pulse) { - if (!pulse.source) { - error('Stratify transform requires an upstream data source.'); - } - - var tree = this.value, - mod = _.modified(), - out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE), - run = !this.value || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields); // prevent upstream source pollution - - - out.source = out.source.slice(); - - if (run) { - if (out.source.length) { - tree = lookup$3(d3Hierarchy.stratify().id(_.key).parentId(_.parentKey)(out.source), _.key, truthy); - } else { - tree = lookup$3(d3Hierarchy.stratify()([{}]), _.key, _.key); - } - } - - out.source.root = this.value = tree; - return out; - }; - - var Layouts = { - tidy: d3Hierarchy.tree, - cluster: d3Hierarchy.cluster - }; - var Output$3 = ['x', 'y', 'depth', 'children']; - /** - * Tree layout. Depending on the method parameter, performs either - * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - function Tree(params) { - HierarchyLayout.call(this, params); - } - - Tree.Definition = { - 'type': 'Tree', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'method', - 'type': 'enum', - 'default': 'tidy', - 'values': ['tidy', 'cluster'] - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'nodeSize', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'separation', - 'type': 'boolean', - 'default': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$3.length, - 'default': Output$3 - }] - }; - var prototype$1j = inherits(Tree, HierarchyLayout); - /** - * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. - */ - - prototype$1j.layout = function (method) { - var m = method || 'tidy'; - if (hasOwnProperty(Layouts, m)) return Layouts[m]();else error('Unrecognized Tree layout method: ' + m); - }; - - prototype$1j.params = ['size', 'nodeSize']; - prototype$1j.fields = Output$3; - /** - * Generate tuples representing links between tree nodes. - * The resulting tuples will contain 'source' and 'target' fields, - * which point to parent and child node tuples, respectively. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - function TreeLinks(params) { - Transform.call(this, [], params); - } - - TreeLinks.Definition = { - 'type': 'TreeLinks', - 'metadata': { - 'tree': true, - 'generates': true, - 'changes': true - }, - 'params': [] - }; - var prototype$1k = inherits(TreeLinks, Transform); - - prototype$1k.transform = function (_, pulse) { - var links = this.value, - tree = pulse.source && pulse.source.root, - out = pulse.fork(pulse.NO_SOURCE), - lut = {}; - if (!tree) error('TreeLinks transform requires a tree data source.'); - - if (pulse.changed(pulse.ADD_REM)) { - // remove previous links - out.rem = links; // build lookup table of valid tuples - - pulse.visit(pulse.SOURCE, function (t) { - lut[tupleid(t)] = 1; - }); // generate links for all edges incident on valid tuples - - tree.each(function (node) { - var t = node.data, - p = node.parent && node.parent.data; - - if (p && lut[tupleid(t)] && lut[tupleid(p)]) { - out.add.push(ingest({ - source: p, - target: t - })); - } - }); - this.value = out.add; - } else if (pulse.changed(pulse.MOD)) { - // build lookup table of modified tuples - pulse.visit(pulse.MOD, function (t) { - lut[tupleid(t)] = 1; - }); // gather links incident on modified tuples - - links.forEach(function (link) { - if (lut[tupleid(link.source)] || lut[tupleid(link.target)]) { - out.mod.push(link); - } - }); - } - - return out; - }; - - var Tiles = { - binary: d3Hierarchy.treemapBinary, - dice: d3Hierarchy.treemapDice, - slice: d3Hierarchy.treemapSlice, - slicedice: d3Hierarchy.treemapSliceDice, - squarify: d3Hierarchy.treemapSquarify, - resquarify: d3Hierarchy.treemapResquarify - }; - var Output$4 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children']; - /** - * Treemap layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ - - function Treemap(params) { - HierarchyLayout.call(this, params); - } - - Treemap.Definition = { - 'type': 'Treemap', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'method', - 'type': 'enum', - 'default': 'squarify', - 'values': ['squarify', 'resquarify', 'binary', 'dice', 'slice', 'slicedice'] - }, { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingInner', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingOuter', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingTop', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingRight', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingBottom', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingLeft', - 'type': 'number', - 'default': 0 - }, { - 'name': 'ratio', - 'type': 'number', - 'default': 1.618033988749895 - }, { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$4.length, - 'default': Output$4 - }] - }; - var prototype$1l = inherits(Treemap, HierarchyLayout); - /** - * Treemap layout generator. Adds 'method' and 'ratio' parameters - * to configure the underlying tile method. - */ - - prototype$1l.layout = function () { - var x = d3Hierarchy.treemap(); - - x.ratio = function (_) { - var t = x.tile(); - if (t.ratio) x.tile(t.ratio(_)); - }; - - x.method = function (_) { - if (hasOwnProperty(Tiles, _)) x.tile(Tiles[_]);else error('Unrecognized Treemap layout method: ' + _); - }; - - return x; - }; - - prototype$1l.params = ['method', 'ratio', 'size', 'round', 'padding', 'paddingInner', 'paddingOuter', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft']; - prototype$1l.fields = Output$4; - var tree = /*#__PURE__*/Object.freeze({ - __proto__: null, - nest: Nest, - pack: Pack, - partition: Partition, - stratify: Stratify, - tree: Tree, - treelinks: TreeLinks, - treemap: Treemap - }); - - function partition$4(data, groupby) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - t, - k, - g; // partition data points into stack groups - - - if (groupby == null) { - groups.push(data); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - - g.push(t); - } - } - - return groups; - } - /** - * Compute locally-weighted regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ - - - function Loess(params) { - Transform.call(this, null, params); - } - - Loess.Definition = { - 'type': 'Loess', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0.3 - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }] - }; - var prototype$1m = inherits(Loess, Transform); - - prototype$1m.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var _source2 = pulse.materialize(pulse.SOURCE).source, - groups = partition$4(_source2, _.groupby), - names = (_.groupby || []).map(accessorName), - m = names.length, - as = _.as || [accessorName(_.x), accessorName(_.y)], - _values2 = []; - groups.forEach(function (g) { - regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(function (p) { - var t = {}; - - for (var i = 0; i < m; ++i) { - t[names[i]] = g.dims[i]; - } - - t[as[0]] = p[0]; - t[as[1]] = p[1]; - - _values2.push(ingest(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = _values2; - } - - return out; - }; - - var Methods$1 = { - linear: regressionLinear, - log: regressionLog, - exp: regressionExp, - pow: regressionPow, - quad: regressionQuad, - poly: regressionPoly - }; - - function degreesOfFreedom(method, order) { - return method === 'poly' ? order : method === 'quad' ? 2 : 1; - } - /** - * Compute regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {string} [params.method='linear'] - The regression method to apply. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ - - - function Regression(params) { - Transform.call(this, null, params); - } - - Regression.Definition = { - 'type': 'Regression', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'method', - 'type': 'string', - 'default': 'linear', - 'values': Object.keys(Methods$1) - }, { - 'name': 'order', - 'type': 'number', - 'default': 3 - }, { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'params', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }] - }; - var prototype$1n = inherits(Regression, Transform); - - prototype$1n.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var _source3 = pulse.materialize(pulse.SOURCE).source, - groups = partition$4(_source3, _.groupby), - names = (_.groupby || []).map(accessorName), - _method2 = _.method || 'linear', - order = _.order || 3, - dof = degreesOfFreedom(_method2, order), - as = _.as || [accessorName(_.x), accessorName(_.y)], - _fit = Methods$1[_method2], - _values3 = []; - - var _domain3 = _.extent; - - if (!hasOwnProperty(Methods$1, _method2)) { - error('Invalid regression method: ' + _method2); - } - - if (_domain3 != null) { - if (_method2 === 'log' && _domain3[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - _domain3 = null; - } - } - - groups.forEach(function (g) { - var n = g.length; - - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - - var model = _fit(g, _.x, _.y, order); - - if (_.params) { - // if parameter vectors requested return those - _values3.push(ingest({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - - return; - } - - var dom = _domain3 || extent(g, _.x), - add = function add(p) { - var t = {}; - - for (var i = 0; i < names.length; ++i) { - t[names[i]] = g.dims[i]; - } - - t[as[0]] = p[0]; - t[as[1]] = p[1]; - - _values3.push(ingest(t)); - }; - - if (_method2 === 'linear') { - // for linear regression we only need the end points - dom.forEach(function (x) { - return add([x, model.predict(x)]); - }); - } else { - // otherwise return trend line sample points - sampleCurve(model.predict, dom, 25, 200).forEach(add); - } - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = _values3; - } - - return out; - }; - - var reg = /*#__PURE__*/Object.freeze({ - __proto__: null, - loess: Loess, - regression: Regression - }); - var EPSILON$2 = Math.pow(2, -52); - var EDGE_STACK = new Uint32Array(512); - - var Delaunator = /*#__PURE__*/function () { - _createClass(Delaunator, null, [{ - key: "from", - value: function from(points) { - var getX = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetX; - var getY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultGetY; - var n = points.length; - var coords = new Float64Array(n * 2); - - for (var i = 0; i < n; i++) { - var p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - - return new Delaunator(coords); - } - }]); - - function Delaunator(coords) { - _classCallCheck(this, Delaunator); - - var n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - this.coords = coords; // arrays that will store the triangulation graph - - var maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); // temporary arrays for tracking the edges of the advancing convex hull - - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - - this._hullNext = new Uint32Array(n); // edge to next edge - - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - - this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash - // temporary arrays for sorting points - - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - this.update(); - } - - _createClass(Delaunator, [{ - key: "update", - value: function update() { - var coords = this.coords, - hullPrev = this._hullPrev, - hullNext = this._hullNext, - hullTri = this._hullTri, - hullHash = this._hullHash; - var n = coords.length >> 1; // populate an array of point indices; calculate input data bbox - - var minX = Infinity; - var minY = Infinity; - var maxX = -Infinity; - var maxY = -Infinity; - - for (var i = 0; i < n; i++) { - var _x23 = coords[2 * i]; - var _y3 = coords[2 * i + 1]; - if (_x23 < minX) minX = _x23; - if (_y3 < minY) minY = _y3; - if (_x23 > maxX) maxX = _x23; - if (_y3 > maxY) maxY = _y3; - this._ids[i] = i; - } - - var cx = (minX + maxX) / 2; - var cy = (minY + maxY) / 2; - var minDist = Infinity; - var i0, i1, i2; // pick a seed point close to the center - - for (var _i8 = 0; _i8 < n; _i8++) { - var d = dist(cx, cy, coords[2 * _i8], coords[2 * _i8 + 1]); - - if (d < minDist) { - i0 = _i8; - minDist = d; - } - } - - var i0x = coords[2 * i0]; - var i0y = coords[2 * i0 + 1]; - minDist = Infinity; // find the point closest to the seed - - for (var _i9 = 0; _i9 < n; _i9++) { - if (_i9 === i0) continue; - - var _d3 = dist(i0x, i0y, coords[2 * _i9], coords[2 * _i9 + 1]); - - if (_d3 < minDist && _d3 > 0) { - i1 = _i9; - minDist = _d3; - } - } - - var i1x = coords[2 * i1]; - var i1y = coords[2 * i1 + 1]; - var minRadius = Infinity; // find the third point which forms the smallest circumcircle with the first two - - for (var _i10 = 0; _i10 < n; _i10++) { - if (_i10 === i0 || _i10 === i1) continue; - var r = circumradius(i0x, i0y, i1x, i1y, coords[2 * _i10], coords[2 * _i10 + 1]); - - if (r < minRadius) { - i2 = _i10; - minRadius = r; - } - } - - var i2x = coords[2 * i2]; - var i2y = coords[2 * i2 + 1]; - - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for (var _i11 = 0; _i11 < n; _i11++) { - this._dists[_i11] = coords[2 * _i11] - coords[0] || coords[2 * _i11 + 1] - coords[1]; - } - - quicksort(this._ids, this._dists, 0, n - 1); - var hull = new Uint32Array(n); - var j = 0; - - for (var _i12 = 0, d0 = -Infinity; _i12 < n; _i12++) { - var _id5 = this._ids[_i12]; - - if (this._dists[_id5] > d0) { - hull[j++] = _id5; - d0 = this._dists[_id5]; - } - } - - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } // swap the order of the seed points for counter-clockwise orientation - - - if (orient(i0x, i0y, i1x, i1y, i2x, i2y)) { - var _i13 = i1; - var _x24 = i1x; - var _y4 = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = _i13; - i2x = _x24; - i2y = _y4; - } - - var center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - - for (var _i14 = 0; _i14 < n; _i14++) { - this._dists[_i14] = dist(coords[2 * _i14], coords[2 * _i14 + 1], center.x, center.y); - } // sort the points by distance from the seed triangle circumcenter - - - quicksort(this._ids, this._dists, 0, n - 1); // set up the seed triangle as the starting hull - - this._hullStart = i0; - var hullSize = 3; - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - this.trianglesLen = 0; - - this._addTriangle(i0, i1, i2, -1, -1, -1); - - for (var k = 0, xp, yp; k < this._ids.length; k++) { - var _i15 = this._ids[k]; - var _x25 = coords[2 * _i15]; - var _y5 = coords[2 * _i15 + 1]; // skip near-duplicate points - - if (k > 0 && Math.abs(_x25 - xp) <= EPSILON$2 && Math.abs(_y5 - yp) <= EPSILON$2) continue; - xp = _x25; - yp = _y5; // skip seed triangle points - - if (_i15 === i0 || _i15 === i1 || _i15 === i2) continue; // find a visible edge on the convex hull using edge hash - - var start = 0; - - for (var _j = 0, _key7 = this._hashKey(_x25, _y5); _j < this._hashSize; _j++) { - start = hullHash[(_key7 + _j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - - start = hullPrev[start]; - var e = start, - q = void 0; - - while (q = hullNext[e], !orient(_x25, _y5, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) { - e = q; - - if (e === start) { - e = -1; - break; - } - } - - if (e === -1) continue; // likely a near-duplicate point; skip it - // add the first triangle from the point - - var t = this._addTriangle(e, _i15, hullNext[e], -1, -1, hullTri[e]); // recursively flip triangles from the point until they satisfy the Delaunay condition - - - hullTri[_i15] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - - hullSize++; // walk forward through the hull, adding more triangles and flipping recursively - - var _n3 = hullNext[e]; - - while (q = hullNext[_n3], orient(_x25, _y5, coords[2 * _n3], coords[2 * _n3 + 1], coords[2 * q], coords[2 * q + 1])) { - t = this._addTriangle(_n3, _i15, q, hullTri[_i15], -1, hullTri[_n3]); - hullTri[_i15] = this._legalize(t + 2); - hullNext[_n3] = _n3; // mark as removed - - hullSize--; - _n3 = q; - } // walk backward from the other side, adding more triangles and flipping - - - if (e === start) { - while (q = hullPrev[e], orient(_x25, _y5, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) { - t = this._addTriangle(q, _i15, e, -1, hullTri[e], hullTri[q]); - - this._legalize(t + 2); - - hullTri[q] = t; - hullNext[e] = e; // mark as removed - - hullSize--; - e = q; - } - } // update the hull indices - - - this._hullStart = hullPrev[_i15] = e; - hullNext[e] = hullPrev[_n3] = _i15; - hullNext[_i15] = _n3; // save the two new edges in the hash table - - hullHash[this._hashKey(_x25, _y5)] = _i15; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - - this.hull = new Uint32Array(hullSize); - - for (var _i16 = 0, _e2 = this._hullStart; _i16 < hullSize; _i16++) { - this.hull[_i16] = _e2; - _e2 = hullNext[_e2]; - } // trim typed triangle mesh arrays - - - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - }, { - key: "_hashKey", - value: function _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - }, { - key: "_legalize", - value: function _legalize(a) { - var triangles = this._triangles, - halfedges = this._halfedges, - coords = this.coords; - var i = 0; - var ar = 0; // recursion eliminated with a fixed-size stack - - while (true) { - var _b2 = halfedges[a]; - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ - - var a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - - if (_b2 === -1) { - // convex hull edge - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - - var b0 = _b2 - _b2 % 3; - var al = a0 + (a + 1) % 3; - - var _bl = b0 + (_b2 + 2) % 3; - - var p0 = triangles[ar]; - var pr = triangles[a]; - var pl = triangles[al]; - var p1 = triangles[_bl]; - var illegal = inCircle(coords[2 * p0], coords[2 * p0 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1]); - - if (illegal) { - triangles[a] = p1; - triangles[_b2] = p0; - var hbl = halfedges[_bl]; // edge swapped on the other side of the hull (rare); fix the halfedge reference - - if (hbl === -1) { - var e = this._hullStart; - - do { - if (this._hullTri[e] === _bl) { - this._hullTri[e] = a; - break; - } - - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - - this._link(a, hbl); - - this._link(_b2, halfedges[ar]); - - this._link(ar, _bl); - - var _br = b0 + (_b2 + 1) % 3; // don't worry about hitting the cap: it can only happen on extremely degenerate input - - - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = _br; - } - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - - return ar; - } - }, { - key: "_link", - value: function _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } // add a new triangle given vertex indices and adjacent half-edge ids - - }, { - key: "_addTriangle", - value: function _addTriangle(i0, i1, i2, a, b, c) { - var t = this.trianglesLen; - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - - this._link(t, a); - - this._link(t + 1, b); - - this._link(t + 2, c); - - this.trianglesLen += 3; - return t; - } - }]); - - return Delaunator; - }(); // monotonically increases with real angle, but doesn't need expensive trigonometry - - - function pseudoAngle(dx, dy) { - var p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] - } - - function dist(ax, ay, bx, by) { - var dx = ax - bx; - var dy = ay - by; - return dx * dx + dy * dy; - } // return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check - - - function orientIfSure(px, py, rx, ry, qx, qy) { - var l = (ry - py) * (qx - px); - var r = (rx - px) * (qy - py); - return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0; - } // a more robust orientation test that's stable in a given triangle (to fix robustness issues) - - - function orient(rx, ry, qx, qy, px, py) { - var sign = orientIfSure(px, py, rx, ry, qx, qy) || orientIfSure(rx, ry, qx, qy, px, py) || orientIfSure(qx, qy, px, py, rx, ry); - return sign < 0; - } - - function inCircle(ax, ay, bx, by, cx, cy, px, py) { - var dx = ax - px; - var dy = ay - py; - var ex = bx - px; - var ey = by - py; - var fx = cx - px; - var fy = cy - py; - var ap = dx * dx + dy * dy; - var bp = ex * ex + ey * ey; - var cp = fx * fx + fy * fy; - return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; - } - - function circumradius(ax, ay, bx, by, cx, cy) { - var dx = bx - ax; - var dy = by - ay; - var ex = cx - ax; - var ey = cy - ay; - var bl = dx * dx + dy * dy; - var cl = ex * ex + ey * ey; - var d = 0.5 / (dx * ey - dy * ex); - var x = (ey * bl - dy * cl) * d; - var y = (dx * cl - ex * bl) * d; - return x * x + y * y; - } - - function circumcenter(ax, ay, bx, by, cx, cy) { - var dx = bx - ax; - var dy = by - ay; - var ex = cx - ax; - var ey = cy - ay; - var bl = dx * dx + dy * dy; - var cl = ex * ex + ey * ey; - var d = 0.5 / (dx * ey - dy * ex); - var x = ax + (ey * bl - dy * cl) * d; - var y = ay + (dx * cl - ex * bl) * d; - return { - x: x, - y: y - }; - } - - function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (var i = left + 1; i <= right; i++) { - var _temp = ids[i]; - var tempDist = dists[_temp]; - var j = i - 1; - - while (j >= left && dists[ids[j]] > tempDist) { - ids[j + 1] = ids[j--]; - } - - ids[j + 1] = _temp; - } - } else { - var _median = left + right >> 1; - - var _i17 = left + 1; - - var _j2 = right; - swap$1(ids, _median, _i17); - if (dists[ids[left]] > dists[ids[right]]) swap$1(ids, left, right); - if (dists[ids[_i17]] > dists[ids[right]]) swap$1(ids, _i17, right); - if (dists[ids[left]] > dists[ids[_i17]]) swap$1(ids, left, _i17); - var _temp2 = ids[_i17]; - var _tempDist = dists[_temp2]; - - while (true) { - do { - _i17++; - } while (dists[ids[_i17]] < _tempDist); - - do { - _j2--; - } while (dists[ids[_j2]] > _tempDist); - - if (_j2 < _i17) break; - swap$1(ids, _i17, _j2); - } - - ids[left + 1] = ids[_j2]; - ids[_j2] = _temp2; - - if (right - _i17 + 1 >= _j2 - left) { - quicksort(ids, dists, _i17, right); - quicksort(ids, dists, left, _j2 - 1); - } else { - quicksort(ids, dists, left, _j2 - 1); - quicksort(ids, dists, _i17, right); - } - } - } - - function swap$1(arr, i, j) { - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; - } - - function defaultGetX(p) { - return p[0]; - } - - function defaultGetY(p) { - return p[1]; - } - - var epsilon$2 = 1e-6; - - var Path = /*#__PURE__*/function () { - function Path() { - _classCallCheck(this, Path); - - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - - this._ = ""; - } - - _createClass(Path, [{ - key: "moveTo", - value: function moveTo(x, y) { - this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y); - } - }, { - key: "closePath", - value: function closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - } - }, { - key: "lineTo", - value: function lineTo(x, y) { - this._ += "L".concat(this._x1 = +x, ",").concat(this._y1 = +y); - } - }, { - key: "arc", - value: function arc(x, y, r) { - x = +x, y = +y, r = +r; - var x0 = x + r; - var y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += "M".concat(x0, ",").concat(y0);else if (Math.abs(this._x1 - x0) > epsilon$2 || Math.abs(this._y1 - y0) > epsilon$2) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += "A".concat(r, ",").concat(r, ",0,1,1,").concat(x - r, ",").concat(y, "A").concat(r, ",").concat(r, ",0,1,1,").concat(this._x1 = x0, ",").concat(this._y1 = y0); - } - }, { - key: "rect", - value: function rect(x, y, w, h) { - this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y, "h").concat(+w, "v").concat(+h, "h").concat(-w, "Z"); - } - }, { - key: "value", - value: function value() { - return this._ || null; - } - }]); - - return Path; - }(); - - var Polygon = /*#__PURE__*/function () { - function Polygon() { - _classCallCheck(this, Polygon); - - this._ = []; - } - - _createClass(Polygon, [{ - key: "moveTo", - value: function moveTo(x, y) { - this._.push([x, y]); - } - }, { - key: "closePath", - value: function closePath() { - this._.push(this._[0].slice()); - } - }, { - key: "lineTo", - value: function lineTo(x, y) { - this._.push([x, y]); - } - }, { - key: "value", - value: function value() { - return this._.length ? this._ : null; - } - }]); - - return Polygon; - }(); - - var Voronoi = /*#__PURE__*/function () { - function Voronoi(delaunay) { - var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 960, 500], - _ref17 = _slicedToArray(_ref16, 4), - xmin = _ref17[0], - ymin = _ref17[1], - xmax = _ref17[2], - ymax = _ref17[3]; - - _classCallCheck(this, Voronoi); - - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - - this._init(); - } - - _createClass(Voronoi, [{ - key: "update", - value: function update() { - this.delaunay.update(); - - this._init(); - - return this; - } - }, { - key: "_init", - value: function _init() { - var _this$delaunay = this.delaunay, - points = _this$delaunay.points, - hull = _this$delaunay.hull, - triangles = _this$delaunay.triangles, - vectors = this.vectors; // Compute circumcenters. - - var circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - - for (var i = 0, j = 0, n = triangles.length, _x26, _y6; i < n; i += 3, j += 2) { - var t1 = triangles[i] * 2; - var t2 = triangles[i + 1] * 2; - var t3 = triangles[i + 2] * 2; - var _x27 = points[t1]; - var _y7 = points[t1 + 1]; - var x2 = points[t2]; - var y2 = points[t2 + 1]; - var x3 = points[t3]; - var y3 = points[t3 + 1]; - var dx = x2 - _x27; - var dy = y2 - _y7; - var ex = x3 - _x27; - var ey = y3 - _y7; - - var _bl2 = dx * dx + dy * dy; - - var cl = ex * ex + ey * ey; - var ab = (dx * ey - dy * ex) * 2; - - if (!ab) { - // degenerate case (collinear diagram) - _x26 = (_x27 + x3) / 2 - 1e8 * ey; - _y6 = (_y7 + y3) / 2 + 1e8 * ex; - } else if (Math.abs(ab) < 1e-8) { - // almost equal points (degenerate triangle) - _x26 = (_x27 + x3) / 2; - _y6 = (_y7 + y3) / 2; - } else { - var d = 1 / ab; - _x26 = _x27 + (ey * _bl2 - dy * cl) * d; - _y6 = _y7 + (dx * cl - ex * _bl2) * d; - } - - circumcenters[j] = _x26; - circumcenters[j + 1] = _y6; - } // Compute exterior cell rays. - - - var h = hull[hull.length - 1]; - var p0, - p1 = h * 4; - var x0, - x1 = points[2 * h]; - var y0, - y1 = points[2 * h + 1]; - vectors.fill(0); - - for (var _i18 = 0; _i18 < hull.length; ++_i18) { - h = hull[_i18]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - }, { - key: "render", - value: function render(context) { - var buffer = context == null ? context = new Path() : undefined; - var _this$delaunay2 = this.delaunay, - halfedges = _this$delaunay2.halfedges, - inedges = _this$delaunay2.inedges, - hull = _this$delaunay2.hull, - circumcenters = this.circumcenters, - vectors = this.vectors; - if (hull.length <= 1) return null; - - for (var i = 0, n = halfedges.length; i < n; ++i) { - var j = halfedges[i]; - if (j < i) continue; - var ti = Math.floor(i / 3) * 2; - var tj = Math.floor(j / 3) * 2; - var xi = circumcenters[ti]; - var yi = circumcenters[ti + 1]; - var xj = circumcenters[tj]; - var yj = circumcenters[tj + 1]; - - this._renderSegment(xi, yi, xj, yj, context); - } - - var h0, - h1 = hull[hull.length - 1]; - - for (var _i19 = 0; _i19 < hull.length; ++_i19) { - h0 = h1, h1 = hull[_i19]; - var t = Math.floor(inedges[h1] / 3) * 2; - var _x28 = circumcenters[t]; - var _y8 = circumcenters[t + 1]; - var v = h0 * 4; - - var p = this._project(_x28, _y8, vectors[v + 2], vectors[v + 3]); - - if (p) this._renderSegment(_x28, _y8, p[0], p[1], context); - } - - return buffer && buffer.value(); - } - }, { - key: "renderBounds", - value: function renderBounds(context) { - var buffer = context == null ? context = new Path() : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - }, { - key: "renderCell", - value: function renderCell(i, context) { - var buffer = context == null ? context = new Path() : undefined; - - var points = this._clip(i); - - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - var n = points.length; - - while (points[0] === points[n - 2] && points[1] === points[n - 1] && n > 1) { - n -= 2; - } - - for (var _i20 = 2; _i20 < n; _i20 += 2) { - if (points[_i20] !== points[_i20 - 2] || points[_i20 + 1] !== points[_i20 - 1]) context.lineTo(points[_i20], points[_i20 + 1]); - } - - context.closePath(); - return buffer && buffer.value(); - } - }, { - key: "cellPolygons", - value: /*#__PURE__*/regeneratorRuntime.mark(function cellPolygons() { - var points, i, n, _cell2; - - return regeneratorRuntime.wrap(function cellPolygons$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - points = this.delaunay.points; - i = 0, n = points.length / 2; - - case 2: - if (!(i < n)) { - _context4.next = 11; - break; - } - - _cell2 = this.cellPolygon(i); - - if (!_cell2) { - _context4.next = 8; - break; - } - - _cell2.index = i; - _context4.next = 8; - return _cell2; - - case 8: - ++i; - _context4.next = 2; - break; - - case 11: - case "end": - return _context4.stop(); - } - } - }, cellPolygons, this); - }) - }, { - key: "cellPolygon", - value: function cellPolygon(i) { - var polygon = new Polygon(); - this.renderCell(i, polygon); - return polygon.value(); - } - }, { - key: "_renderSegment", - value: function _renderSegment(x0, y0, x1, y1, context) { - var S; - - var c0 = this._regioncode(x0, y0); - - var c1 = this._regioncode(x1, y1); - - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } - } - }, { - key: "contains", - value: function contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; - } - }, { - key: "neighbors", - value: /*#__PURE__*/regeneratorRuntime.mark(function neighbors(i) { - var ci, _iterator20, _step20, j, cj, ai, li, aj, lj; - - return regeneratorRuntime.wrap(function neighbors$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - ci = this._clip(i); - - if (!ci) { - _context5.next = 33; - break; - } - - _iterator20 = _createForOfIteratorHelper(this.delaunay.neighbors(i)); - _context5.prev = 3; - - _iterator20.s(); - - case 5: - if ((_step20 = _iterator20.n()).done) { - _context5.next = 25; - break; - } - - j = _step20.value; - cj = this._clip(j); // find the common edge - - if (!cj) { - _context5.next = 23; - break; - } - - ai = 0, li = ci.length; - - case 10: - if (!(ai < li)) { - _context5.next = 23; - break; - } - - aj = 0, lj = cj.length; - - case 12: - if (!(aj < lj)) { - _context5.next = 20; - break; - } - - if (!(ci[ai] == cj[aj] && ci[ai + 1] == cj[aj + 1] && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj])) { - _context5.next = 17; - break; - } - - _context5.next = 16; - return j; - - case 16: - return _context5.abrupt("break", 23); - - case 17: - aj += 2; - _context5.next = 12; - break; - - case 20: - ai += 2; - _context5.next = 10; - break; - - case 23: - _context5.next = 5; - break; - - case 25: - _context5.next = 30; - break; - - case 27: - _context5.prev = 27; - _context5.t0 = _context5["catch"](3); - - _iterator20.e(_context5.t0); - - case 30: - _context5.prev = 30; - - _iterator20.f(); - - return _context5.finish(30); - - case 33: - case "end": - return _context5.stop(); - } - } - }, neighbors, this, [[3, 27, 30, 33]]); - }) - }, { - key: "_cell", - value: function _cell(i) { - var circumcenters = this.circumcenters, - _this$delaunay3 = this.delaunay, - inedges = _this$delaunay3.inedges, - halfedges = _this$delaunay3.halfedges, - triangles = _this$delaunay3.triangles; - var e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - - var points = []; - var e = e0; - - do { - var t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - - e = halfedges[e]; - } while (e !== e0 && e !== -1); - - return points; - } - }, { - key: "_clip", - value: function _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - - var points = this._cell(i); - - if (points === null) return null; - var V = this.vectors; - var v = i * 4; - return V[v] || V[v + 1] ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points); - } - }, { - key: "_clipFinite", - value: function _clipFinite(i, points) { - var n = points.length; - var P = null; - var x0, - y0, - x1 = points[n - 2], - y1 = points[n - 1]; - - var c0, - c1 = this._regioncode(x1, y1); - - var e0, e1; - - for (var j = 0; j < n; j += 2) { - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1);else P = [x1, y1]; - } else { - var S = void 0, - sx0 = void 0, - sy0 = void 0, - sx1 = void 0, - sy1 = void 0; - - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - var _S = S; - - var _S2 = _slicedToArray(_S, 4); - - sx0 = _S2[0]; - sy0 = _S2[1]; - sx1 = _S2[2]; - sy1 = _S2[3]; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - var _S3 = S; - - var _S4 = _slicedToArray(_S3, 4); - - sx1 = _S4[0]; - sy1 = _S4[1]; - sx0 = _S4[2]; - sy0 = _S4[3]; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0);else P = [sx0, sy0]; - } - - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1);else P = [sx1, sy1]; - } - } - - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - - return P; - } - }, { - key: "_clipSegment", - value: function _clipSegment(x0, y0, x1, y1, c0, c1) { - while (true) { - if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1]; - if (c0 & c1) return null; - - var _x29 = void 0, - _y9 = void 0, - c = c0 || c1; - - if (c & 8) _x29 = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), _y9 = this.ymax;else if (c & 4) _x29 = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), _y9 = this.ymin;else if (c & 2) _y9 = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), _x29 = this.xmax;else _y9 = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), _x29 = this.xmin; - if (c0) x0 = _x29, y0 = _y9, c0 = this._regioncode(x0, y0);else x1 = _x29, y1 = _y9, c1 = this._regioncode(x1, y1); - } - } - }, { - key: "_clipInfinite", - value: function _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - var P = Array.from(points), - p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - - if (P = this._clipFinite(i, P)) { - for (var j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; - } - - return P; - } - }, { - key: "_edge", - value: function _edge(i, e0, e1, P, j) { - while (e0 !== e1) { - var _x30 = void 0, - _y10 = void 0; - - switch (e0) { - case 5: - e0 = 4; - continue; - // top-left - - case 4: - e0 = 6, _x30 = this.xmax, _y10 = this.ymin; - break; - // top - - case 6: - e0 = 2; - continue; - // top-right - - case 2: - e0 = 10, _x30 = this.xmax, _y10 = this.ymax; - break; - // right - - case 10: - e0 = 8; - continue; - // bottom-right - - case 8: - e0 = 9, _x30 = this.xmin, _y10 = this.ymax; - break; - // bottom - - case 9: - e0 = 1; - continue; - // bottom-left - - case 1: - e0 = 5, _x30 = this.xmin, _y10 = this.ymin; - break; - // left - } - - if ((P[j] !== _x30 || P[j + 1] !== _y10) && this.contains(i, _x30, _y10)) { - P.splice(j, 0, _x30, _y10), j += 2; - } - } - - if (P.length > 4) { - for (var _i21 = 0; _i21 < P.length; _i21 += 2) { - var _j3 = (_i21 + 2) % P.length, - k = (_i21 + 4) % P.length; - - if (P[_i21] === P[_j3] && P[_j3] === P[k] || P[_i21 + 1] === P[_j3 + 1] && P[_j3 + 1] === P[k + 1]) P.splice(_j3, 2), _i21 -= 2; - } - } - - return j; - } - }, { - key: "_project", - value: function _project(x0, y0, vx, vy) { - var t = Infinity, - c, - x, - y; - - if (vy < 0) { - // top - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { - // bottom - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - - if (vx > 0) { - // right - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { - // left - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - - return [x, y]; - } - }, { - key: "_edgecode", - value: function _edgecode(x, y) { - return (x === this.xmin ? 1 : x === this.xmax ? 2 : 0) | (y === this.ymin ? 4 : y === this.ymax ? 8 : 0); - } - }, { - key: "_regioncode", - value: function _regioncode(x, y) { - return (x < this.xmin ? 1 : x > this.xmax ? 2 : 0) | (y < this.ymin ? 4 : y > this.ymax ? 8 : 0); - } - }]); - - return Voronoi; - }(); - - var tau = 2 * Math.PI, - pow$2 = Math.pow; - - function pointX(p) { - return p[0]; - } - - function pointY(p) { - return p[1]; - } // A triangulation is collinear if all its triangles have a non-null area - - - function collinear$1(d) { - var triangles = d.triangles, - coords = d.coords; - - for (var i = 0; i < triangles.length; i += 3) { - var a = 2 * triangles[i], - _b3 = 2 * triangles[i + 1], - c = 2 * triangles[i + 2], - _cross = (coords[c] - coords[a]) * (coords[_b3 + 1] - coords[a + 1]) - (coords[_b3] - coords[a]) * (coords[c + 1] - coords[a + 1]); - - if (_cross > 1e-10) return false; - } - - return true; - } - - function jitter(x, y, r) { - return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r]; - } - - var Delaunay = /*#__PURE__*/function () { - _createClass(Delaunay, null, [{ - key: "from", - value: function from(points) { - var fx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : pointX; - var fy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : pointY; - var that = arguments.length > 3 ? arguments[3] : undefined; - return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that))); - } - }]); - - function Delaunay(points) { - _classCallCheck(this, Delaunay); - - this._delaunator = new Delaunator(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - - this._init(); - } - - _createClass(Delaunay, [{ - key: "update", - value: function update() { - this._delaunator.update(); - - this._init(); - - return this; - } - }, { - key: "_init", - value: function _init() { - var d = this._delaunator, - points = this.points; // check for collinear - - if (d.hull && d.hull.length > 2 && collinear$1(d)) { - this.collinear = Int32Array.from({ - length: points.length / 2 - }, function (_, i) { - return i; - }).sort(function (i, j) { - return points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]; - }); // for exact neighbors - - var e = this.collinear[0], - f = this.collinear[this.collinear.length - 1], - _bounds = [points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1]], - r = 1e-8 * Math.hypot(_bounds[3] - _bounds[1], _bounds[2] - _bounds[0]); - - for (var i = 0, n = points.length / 2; i < n; ++i) { - var p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - - this._delaunator = new Delaunator(points); - } else { - delete this.collinear; - } - - var halfedges = this.halfedges = this._delaunator.halfedges; - var hull = this.hull = this._delaunator.hull; - var triangles = this.triangles = this._delaunator.triangles; - var inedges = this.inedges.fill(-1); - - var hullIndex = this._hullIndex.fill(-1); // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - - - for (var _e3 = 0, _n4 = halfedges.length; _e3 < _n4; ++_e3) { - var _p = triangles[_e3 % 3 === 2 ? _e3 - 2 : _e3 + 1]; - if (halfedges[_e3] === -1 || inedges[_p] === -1) inedges[_p] = _e3; - } - - for (var _i22 = 0, _n5 = hull.length; _i22 < _n5; ++_i22) { - hullIndex[hull[_i22]] = _i22; - } // degenerate case: 1 or 2 (distinct) points - - - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - inedges[hull[0]] = 1; - if (hull.length === 2) inedges[hull[1]] = 0; - } - } - }, { - key: "voronoi", - value: function voronoi(bounds) { - return new Voronoi(this, bounds); - } - }, { - key: "neighbors", - value: /*#__PURE__*/regeneratorRuntime.mark(function neighbors(i) { - var inedges, hull, _hullIndex, halfedges, triangles, collinear, l, e0, e, p0, p; - - return regeneratorRuntime.wrap(function neighbors$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - inedges = this.inedges, hull = this.hull, _hullIndex = this._hullIndex, halfedges = this.halfedges, triangles = this.triangles, collinear = this.collinear; // degenerate case with several collinear points - - if (!collinear) { - _context6.next = 10; - break; - } - - l = collinear.indexOf(i); - - if (!(l > 0)) { - _context6.next = 6; - break; - } - - _context6.next = 6; - return collinear[l - 1]; - - case 6: - if (!(l < collinear.length - 1)) { - _context6.next = 9; - break; - } - - _context6.next = 9; - return collinear[l + 1]; - - case 9: - return _context6.abrupt("return"); - - case 10: - e0 = inedges[i]; - - if (!(e0 === -1)) { - _context6.next = 13; - break; - } - - return _context6.abrupt("return"); - - case 13: - // coincident point - e = e0, p0 = -1; - - case 14: - _context6.next = 16; - return p0 = triangles[e]; - - case 16: - e = e % 3 === 2 ? e - 2 : e + 1; - - if (!(triangles[e] !== i)) { - _context6.next = 19; - break; - } - - return _context6.abrupt("return"); - - case 19: - // bad triangulation - e = halfedges[e]; - - if (!(e === -1)) { - _context6.next = 26; - break; - } - - p = hull[(_hullIndex[i] + 1) % hull.length]; - - if (!(p !== p0)) { - _context6.next = 25; - break; - } - - _context6.next = 25; - return p; - - case 25: - return _context6.abrupt("return"); - - case 26: - if (e !== e0) { - _context6.next = 14; - break; - } - - case 27: - case "end": - return _context6.stop(); - } - } - }, neighbors, this); - }) - }, { - key: "find", - value: function find(x, y) { - var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - var i0 = i; - var c; - - while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) { - i = c; - } - - return c; - } - }, { - key: "_step", - value: function _step(i, x, y) { - var inedges = this.inedges, - hull = this.hull, - _hullIndex = this._hullIndex, - halfedges = this.halfedges, - triangles = this.triangles, - points = this.points; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - var c = i; - var dc = pow$2(x - points[i * 2], 2) + pow$2(y - points[i * 2 + 1], 2); - var e0 = inedges[i]; - var e = e0; - - do { - var t = triangles[e]; - var dt = pow$2(x - points[t * 2], 2) + pow$2(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - - e = halfedges[e]; - - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - - if (e !== t) { - if (pow$2(x - points[e * 2], 2) + pow$2(y - points[e * 2 + 1], 2) < dc) return e; - } - - break; - } - } while (e !== e0); - - return c; - } - }, { - key: "render", - value: function render(context) { - var buffer = context == null ? context = new Path() : undefined; - var points = this.points, - halfedges = this.halfedges, - triangles = this.triangles; - - for (var i = 0, n = halfedges.length; i < n; ++i) { - var j = halfedges[i]; - if (j < i) continue; - var ti = triangles[i] * 2; - var tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - - this.renderHull(context); - return buffer && buffer.value(); - } - }, { - key: "renderPoints", - value: function renderPoints(context) { - var r = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; - var buffer = context == null ? context = new Path() : undefined; - var points = this.points; - - for (var i = 0, n = points.length; i < n; i += 2) { - var _x31 = points[i], - _y11 = points[i + 1]; - context.moveTo(_x31 + r, _y11); - context.arc(_x31, _y11, r, 0, tau); - } - - return buffer && buffer.value(); - } - }, { - key: "renderHull", - value: function renderHull(context) { - var buffer = context == null ? context = new Path() : undefined; - var hull = this.hull, - points = this.points; - var h = hull[0] * 2, - n = hull.length; - context.moveTo(points[h], points[h + 1]); - - for (var i = 1; i < n; ++i) { - var _h = 2 * hull[i]; - - context.lineTo(points[_h], points[_h + 1]); - } - - context.closePath(); - return buffer && buffer.value(); - } - }, { - key: "hullPolygon", - value: function hullPolygon() { - var polygon = new Polygon(); - this.renderHull(polygon); - return polygon.value(); - } - }, { - key: "renderTriangle", - value: function renderTriangle(i, context) { - var buffer = context == null ? context = new Path() : undefined; - var points = this.points, - triangles = this.triangles; - var t0 = triangles[i *= 3] * 2; - var t1 = triangles[i + 1] * 2; - var t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); - } - }, { - key: "trianglePolygons", - value: /*#__PURE__*/regeneratorRuntime.mark(function trianglePolygons() { - var triangles, i, n; - return regeneratorRuntime.wrap(function trianglePolygons$(_context7) { - while (1) { - switch (_context7.prev = _context7.next) { - case 0: - triangles = this.triangles; - i = 0, n = triangles.length / 3; - - case 2: - if (!(i < n)) { - _context7.next = 8; - break; - } - - _context7.next = 5; - return this.trianglePolygon(i); - - case 5: - ++i; - _context7.next = 2; - break; - - case 8: - case "end": - return _context7.stop(); - } - } - }, trianglePolygons, this); - }) - }, { - key: "trianglePolygon", - value: function trianglePolygon(i) { - var polygon = new Polygon(); - this.renderTriangle(i, polygon); - return polygon.value(); - } - }]); - - return Delaunay; - }(); - - function flatArray(points, fx, fy, that) { - var n = points.length; - var array = new Float64Array(n * 2); - - for (var i = 0; i < n; ++i) { - var p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - - return array; - } - - function flatIterable(points, fx, fy, that) { - var i, _iterator21, _step21, p; - - return regeneratorRuntime.wrap(function flatIterable$(_context8) { - while (1) { - switch (_context8.prev = _context8.next) { - case 0: - i = 0; - _iterator21 = _createForOfIteratorHelper(points); - _context8.prev = 2; - - _iterator21.s(); - - case 4: - if ((_step21 = _iterator21.n()).done) { - _context8.next = 13; - break; - } - - p = _step21.value; - _context8.next = 8; - return fx.call(that, p, i, points); - - case 8: - _context8.next = 10; - return fy.call(that, p, i, points); - - case 10: - ++i; - - case 11: - _context8.next = 4; - break; - - case 13: - _context8.next = 18; - break; - - case 15: - _context8.prev = 15; - _context8.t0 = _context8["catch"](2); - - _iterator21.e(_context8.t0); - - case 18: - _context8.prev = 18; - - _iterator21.f(); - - return _context8.finish(18); - - case 21: - case "end": - return _context8.stop(); - } - } - }, _marked3, null, [[2, 15, 18, 21]]); - } - - function Voronoi$1(params) { - Transform.call(this, null, params); - } - - Voronoi$1.Definition = { - 'type': 'Voronoi', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'default': [[-1e5, -1e5], [1e5, 1e5]], - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'as', - 'type': 'string', - 'default': 'path' - }] - }; - var prototype$1o = inherits(Voronoi$1, Transform); - var defaultExtent = [-1e5, -1e5, 1e5, 1e5]; - - prototype$1o.transform = function (_, pulse) { - var as = _.as || 'path', - data = pulse.source; // nothing to do if no data - - if (!data || !data.length) return pulse; // configure and construct voronoi diagram - - var s = _.size; - s = s ? [0, 0, s[0], s[1]] : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] : defaultExtent; - var voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s); // map polygons to paths - - for (var i = 0, n = data.length; i < n; ++i) { - var polygon = voronoi.cellPolygon(i); - data[i][as] = polygon ? toPathString(polygon) : null; - } - - return pulse.reflow(_.modified()).modifies(as); - }; // suppress duplicated end point vertices - - - function toPathString(p) { - var x = p[0][0], - y = p[0][1]; - var n = p.length - 1; - - for (; p[n][0] === x && p[n][1] === y; --n) { - ; - } - - return 'M' + p.slice(0, n + 1).join('L') + 'Z'; - } - - var voronoi = /*#__PURE__*/Object.freeze({ - __proto__: null, - voronoi: Voronoi$1 - }); - /* - Copyright (c) 2013, Jason Davies. - 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 Jason Davies 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 JASON DAVIES 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. - */ - // Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/ - // Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf - - var cloudRadians = Math.PI / 180, - cw = 1 << 11 >> 5, - ch = 1 << 11; - - function cloud() { - var size = [256, 256], - text, - font, - fontSize, - fontStyle, - fontWeight, - rotate, - padding, - spiral = archimedeanSpiral, - words = [], - random = Math.random, - cloud = {}; - - cloud.layout = function () { - var contextAndRatio = getContext(domCanvas()), - board = zeroArray((size[0] >> 5) * size[1]), - bounds = null, - n = words.length, - i = -1, - tags = [], - data = words.map(function (d) { - return { - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - }; - }).sort(function (a, b) { - return b.size - a.size; - }); - - while (++i < n) { - var d = data[i]; - d.x = size[0] * (random() + .5) >> 1; - d.y = size[1] * (random() + .5) >> 1; - cloudSprite(contextAndRatio, d, data, i); - - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d);else bounds = [{ - x: d.x + d.x0, - y: d.y + d.y0 - }, { - x: d.x + d.x1, - y: d.y + d.y1 - }]; // Temporary hack - - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - - return tags; - }; - - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - return { - context: context, - ratio: ratio - }; - } - - function place(board, tag, bounds) { - var startX = tag.x, - startY = tag.y, - maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), - s = spiral(size), - dt = random() < .5 ? 1 : -1, - t = -dt, - dxdy, - dx, - dy; - - while (dxdy = s(t += dt)) { - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - tag.x = startX + dx; - tag.y = startY + dy; - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; // TODO only check for collisions within current bounds. - - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, - w = tag.width >> 5, - sw = size[0] >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - - for (var j = 0; j < h; j++) { - last = 0; - - for (var i = 0; i <= w; i++) { - board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - } - - x += sw; - } - - tag.sprite = null; - return true; - } - } - } - - return false; - } - - cloud.words = function (_) { - if (arguments.length) { - words = _; - return cloud; - } else { - return words; - } - }; - - cloud.size = function (_) { - if (arguments.length) { - size = [+_[0], +_[1]]; - return cloud; - } else { - return size; - } - }; - - cloud.font = function (_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else { - return font; - } - }; - - cloud.fontStyle = function (_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else { - return fontStyle; - } - }; - - cloud.fontWeight = function (_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else { - return fontWeight; - } - }; - - cloud.rotate = function (_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else { - return rotate; - } - }; - - cloud.text = function (_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else { - return text; - } - }; - - cloud.spiral = function (_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else { - return spiral; - } - }; - - cloud.fontSize = function (_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else { - return fontSize; - } - }; - - cloud.padding = function (_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else { - return padding; - } - }; - - cloud.random = function (_) { - if (arguments.length) { - random = _; - return cloud; - } else { - return random; - } - }; - - return cloud; - } // Fetches a monochrome sprite bitmap for the specified text. - // Load in batches for speed. - - - function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, - ratio = contextAndRatio.ratio; - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, - y = 0, - maxh = 0, - n = data.length, - w, - w32, - h, - i, - j; - --di; - - while (++di < n) { - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), - cr = Math.cos(d.rotate * cloudRadians), - wcr = w * cr, - wsr = w * sr, - hcr = h * cr, - hsr = h * sr; - w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else { - w = w + 0x1f >> 5 << 5; - } - - if (h > maxh) maxh = h; - - if (x + w >= cw << 5) { - x = 0; - y += maxh; - maxh = 0; - } - - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, - sprite = []; - - while (--di >= 0) { - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; // Zero the buffer - - for (i = 0; i < h * w32; i++) { - sprite[i] = 0; - } - - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, - seenRow = -1; - - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - var k = w32 * j + (i >> 5), - m = pixels[(y + j) * (cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0; - sprite[k] |= m; - seen |= m; - } - - if (seen) seenRow = j;else { - d.y0++; - h--; - j--; - y++; - } - } - - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); - } - } // Use mask-based collision detection. - - - function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, - w = tag.width >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - - for (var j = 0; j < h; j++) { - last = 0; - - for (var i = 0; i <= w; i++) { - if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true; - } - - x += sw; - } - - return false; - } - - function cloudBounds(bounds, d) { - var b0 = bounds[0], - b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; - } - - function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; - } - - function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function (t) { - return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)]; - }; - } - - function rectangularSpiral(size) { - var dy = 4, - dx = dy * size[0] / size[1], - x = 0, - y = 0; - return function (t) { - var sign = t < 0 ? -1 : 1; // See triangular numbers: T_n = n * (n + 1) / 2. - - switch (Math.sqrt(1 + 4 * sign * t) - sign & 3) { - case 0: - x += dx; - break; - - case 1: - y += dy; - break; - - case 2: - x -= dx; - break; - - default: - y -= dy; - break; - } - - return [x, y]; - }; - } // TODO reuse arrays? - - - function zeroArray(n) { - var a = [], - i = -1; - - while (++i < n) { - a[i] = 0; - } - - return a; - } - - function functor(d) { - return typeof d === 'function' ? d : function () { - return d; - }; - } - - var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral - }; - var Output$5 = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle']; - var Params$1 = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight']; - - function Wordcloud(params) { - Transform.call(this, cloud(), params); - } - - Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'font', - 'type': 'string', - 'expr': true, - 'default': 'sans-serif' - }, { - 'name': 'fontStyle', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, { - 'name': 'fontWeight', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, { - 'name': 'fontSize', - 'type': 'number', - 'expr': true, - 'default': 14 - }, { - 'name': 'fontSizeRange', - 'type': 'number', - 'array': 'nullable', - 'default': [10, 50] - }, { - 'name': 'rotate', - 'type': 'number', - 'expr': true, - 'default': 0 - }, { - 'name': 'text', - 'type': 'field' - }, { - 'name': 'spiral', - 'type': 'string', - 'values': ['archimedean', 'rectangular'] - }, { - 'name': 'padding', - 'type': 'number', - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 7, - 'default': Output$5 - }] - }; - var prototype$1p = inherits(Wordcloud, Transform); - - prototype$1p.transform = function (_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) { - error('Wordcloud size dimensions must be non-zero.'); - } - - function modp(param) { - var p = _[param]; - return isFunction(p) && pulse.modified(p.fields); - } - - var mod = _.modified(); - - if (!(mod || pulse.changed(pulse.ADD_REM) || Params$1.some(modp))) return; - var data = pulse.materialize(pulse.SOURCE).source, - layout = this.value, - as = _.as || Output$5, - fontSize = _.fontSize || 14, - range; - isFunction(fontSize) ? range = _.fontSizeRange : fontSize = constant(fontSize); // create font size scaling function as needed - - if (range) { - var fsize = fontSize, - sizeScale = scale$2('sqrt')().domain(extent(data, fsize)).range(range); - - fontSize = function fontSize(x) { - return sizeScale(fsize(x)); - }; - } - - data.forEach(function (t) { - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); // configure layout - - var words = layout.words(data).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random(exports.random).layout(); - var size = layout.size(), - dx = size[0] >> 1, - dy = size[1] >> 1, - i = 0, - n = words.length, - w, - t; - - for (; i < n; ++i) { - w = words[i]; - t = w.datum; - t[as[0]] = w.x + dx; - t[as[1]] = w.y + dy; - t[as[2]] = w.font; - t[as[3]] = w.size; - t[as[4]] = w.style; - t[as[5]] = w.weight; - t[as[6]] = w.rotate; - } - - return pulse.reflow(mod).modifies(as); - }; - - var wordcloud = /*#__PURE__*/Object.freeze({ - __proto__: null, - wordcloud: Wordcloud - }); - - function array8(n) { - return new Uint8Array(n); - } - - function array16(n) { - return new Uint16Array(n); - } - - function array32(n) { - return new Uint32Array(n); - } - /** - * Maintains CrossFilter state. - */ - - - function Bitmaps() { - var width = 8, - _data2 = [], - _seen = array32(0), - _curr = array$1(0, width), - _prev = array$1(0, width); - - return { - data: function data() { - return _data2; - }, - seen: function seen() { - return _seen = lengthen(_seen, _data2.length); - }, - add: function add(array) { - for (var i = 0, j = _data2.length, n = array.length, t; i < n; ++i) { - t = array[i]; - t._index = j++; - - _data2.push(t); - } - }, - remove: function remove(num, map) { - // map: index -> boolean (true => remove) - var n = _data2.length, - copy = Array(n - num), - reindex = _data2, - // reuse old data array for index map - t, - i, - j; // seek forward to first removal - - for (i = 0; !map[i] && i < n; ++i) { - copy[i] = _data2[i]; - reindex[i] = i; - } // condense arrays - - - for (j = i; i < n; ++i) { - t = _data2[i]; - - if (!map[i]) { - reindex[i] = j; - _curr[j] = _curr[i]; - _prev[j] = _prev[i]; - copy[j] = t; - t._index = j++; - } else { - reindex[i] = -1; - } - - _curr[i] = 0; // clear unused bits - } - - _data2 = copy; - return reindex; - }, - size: function size() { - return _data2.length; - }, - curr: function curr() { - return _curr; - }, - prev: function prev() { - return _prev; - }, - reset: function reset(k) { - _prev[k] = _curr[k]; - }, - all: function all() { - return width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff; - }, - set: function set(k, one) { - _curr[k] |= one; - }, - clear: function clear(k, one) { - _curr[k] &= ~one; - }, - resize: function resize(n, m) { - var k = _curr.length; - - if (n > k || m > width) { - width = Math.max(m, width); - _curr = array$1(n, width, _curr); - _prev = array$1(n, width); - } - } - }; - } - - function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; - } - - function array$1(n, m, array) { - var copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; - } - - function Dimension(index, i, query) { - var bit = 1 << i; - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - onAdd: function onAdd(added, curr) { - var dim = this, - range = dim.bisect(dim.range, added.value), - idx = added.index, - lo = range[0], - hi = range[1], - n1 = idx.length, - i; - - for (i = 0; i < lo; ++i) { - curr[idx[i]] |= bit; - } - - for (i = hi; i < n1; ++i) { - curr[idx[i]] |= bit; - } - - return dim; - } - }; - } - /** - * Maintains a list of values, sorted by key. - */ - - - function SortedIndex() { - var _index8 = array32(0), - value = [], - _size = 0; - - function insert(key, data, base) { - if (!data.length) return []; - var n0 = _size, - n1 = data.length, - addv = Array(n1), - addi = array32(n1), - oldv, - oldi, - i; - - for (i = 0; i < n1; ++i) { - addv[i] = key(data[i]); - addi[i] = i; - } - - addv = sort(addv, addi); - - if (n0) { - oldv = value; - oldi = _index8; - value = Array(n0 + n1); - _index8 = array32(n0 + n1); - merge$1(base, oldv, oldi, n0, addv, addi, n1, value, _index8); - } else { - if (base > 0) for (i = 0; i < n1; ++i) { - addi[i] += base; - } - value = addv; - _index8 = addi; - } - - _size = n0 + n1; - return { - index: addi, - value: addv - }; - } - - function remove(num, map) { - // map: index -> remove - var n = _size, - idx, - i, - j; // seek forward to first removal - - for (i = 0; !map[_index8[i]] && i < n; ++i) { - ; - } // condense index and value arrays - - - for (j = i; i < n; ++i) { - if (!map[idx = _index8[i]]) { - _index8[j] = idx; - value[j] = value[i]; - ++j; - } - } - - _size = n - num; - } - - function reindex(map) { - for (var i = 0, n = _size; i < n; ++i) { - _index8[i] = map[_index8[i]]; - } - } - - function bisect(range, array) { - var n; - - if (array) { - n = array.length; - } else { - array = value; - n = _size; - } - - return [bisectLeft(array, range[0], 0, n), bisectRight(array, range[1], 0, n)]; - } - - return { - insert: insert, - remove: remove, - bisect: bisect, - reindex: reindex, - index: function index() { - return _index8; - }, - size: function size() { - return _size; - } - }; - } - - function sort(values, index) { - values.sort.call(index, function (a, b) { - var x = values[a], - y = values[b]; - return x < y ? -1 : x > y ? 1 : 0; - }); - return permute(values, index); - } - - function merge$1(base, value0, index0, n0, value1, index1, n1, value, index) { - var i0 = 0, - i1 = 0, - i; - - for (i = 0; i0 < n0 && i1 < n1; ++i) { - if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - } - - for (; i0 < n0; ++i0, ++i) { - value[i] = value0[i0]; - index[i] = index0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } - } - /** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ - - - function CrossFilter(params) { - Transform.call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; - } - - CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'query', - 'type': 'array', - 'array': true, - 'required': true, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }] - }; - var prototype$1q = inherits(CrossFilter, Transform); - - prototype$1q.transform = function (_, pulse) { - if (!this._dims) { - return this.init(_, pulse); - } else { - var init = _.modified('fields') || _.fields.some(function (f) { - return pulse.modified(f.fields); - }); - - return init ? this.reinit(_, pulse) : this.eval(_, pulse); - } - }; - - prototype$1q.init = function (_, pulse) { - var fields = _.fields, - query = _.query, - indices = this._indices = {}, - dims = this._dims = [], - m = query.length, - i = 0, - key, - index; // instantiate indices and dimensions - - for (; i < m; ++i) { - key = fields[i].fname; - index = indices[key] || (indices[key] = SortedIndex()); - dims.push(Dimension(index, i, query[i])); - } - - return this.eval(_, pulse); - }; - - prototype$1q.reinit = function (_, pulse) { - var output = pulse.materialize().fork(), - fields = _.fields, - query = _.query, - indices = this._indices, - dims = this._dims, - bits = this.value, - curr = bits.curr(), - prev = bits.prev(), - all = bits.all(), - out = output.rem = output.add, - mod = output.mod, - m = query.length, - adds = {}, - add, - index, - key, - mods, - remMap, - modMap, - i, - n, - f; // set prev to current state - - prev.set(curr); // if pulse has remove tuples, process them first - - if (pulse.rem.length) { - remMap = this.remove(_, pulse, output); - } // if pulse has added tuples, add them to state - - - if (pulse.add.length) { - bits.add(pulse.add); - } // if pulse has modified tuples, create an index map - - - if (pulse.mod.length) { - modMap = {}; - - for (mods = pulse.mod, i = 0, n = mods.length; i < n; ++i) { - modMap[mods[i]._index] = 1; - } - } // re-initialize indices as needed, update curr bitmap - - - for (i = 0; i < m; ++i) { - f = fields[i]; - - if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) { - key = f.fname; - - if (!(add = adds[key])) { - indices[key] = index = SortedIndex(); - adds[key] = add = index.insert(f, pulse.source, 0); - } - - dims[i] = Dimension(index, i, query[i]).onAdd(add, curr); - } - } // visit each tuple - // if filter state changed, push index to add/rem - // else if in mod and passes a filter, push index to mod - - - for (i = 0, n = bits.data().length; i < n; ++i) { - if (remMap[i]) { - // skip if removed tuple - continue; - } else if (prev[i] !== curr[i]) { - // add if state changed - out.push(i); - } else if (modMap[i] && curr[i] !== all) { - // otherwise, pass mods through - mod.push(i); - } - } - - bits.mask = (1 << m) - 1; - return output; - }; - - prototype$1q.eval = function (_, pulse) { - var output = pulse.materialize().fork(), - m = this._dims.length, - mask = 0; - - if (pulse.rem.length) { - this.remove(_, pulse, output); - mask |= (1 << m) - 1; - } - - if (_.modified('query') && !_.modified('fields')) { - mask |= this.update(_, pulse, output); - } - - if (pulse.add.length) { - this.insert(_, pulse, output); - mask |= (1 << m) - 1; - } - - if (pulse.mod.length) { - this.modify(pulse, output); - mask |= (1 << m) - 1; - } - - this.value.mask = mask; - return output; - }; - - prototype$1q.insert = function (_, pulse, output) { - var tuples = pulse.add, - bits = this.value, - dims = this._dims, - indices = this._indices, - fields = _.fields, - adds = {}, - out = output.add, - k = bits.size(), - n = k + tuples.length, - m = dims.length, - j, - key, - add; // resize bitmaps and add tuples as needed - - bits.resize(n, m); - bits.add(tuples); - var curr = bits.curr(), - prev = bits.prev(), - all = bits.all(); // add to dimensional indices - - for (j = 0; j < m; ++j) { - key = fields[j].fname; - add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k)); - dims[j].onAdd(add, curr); - } // set previous filters, output if passes at least one filter - - - for (; k < n; ++k) { - prev[k] = all; - if (curr[k] !== all) out.push(k); - } - }; - - prototype$1q.modify = function (pulse, output) { - var out = output.mod, - bits = this.value, - curr = bits.curr(), - all = bits.all(), - tuples = pulse.mod, - i, - n, - k; - - for (i = 0, n = tuples.length; i < n; ++i) { - k = tuples[i]._index; - if (curr[k] !== all) out.push(k); - } - }; - - prototype$1q.remove = function (_, pulse, output) { - var indices = this._indices, - bits = this.value, - curr = bits.curr(), - prev = bits.prev(), - all = bits.all(), - map = {}, - out = output.rem, - tuples = pulse.rem, - i, - n, - k, - f; // process tuples, output if passes at least one filter - - for (i = 0, n = tuples.length; i < n; ++i) { - k = tuples[i]._index; - map[k] = 1; // build index map - - prev[k] = f = curr[k]; - curr[k] = all; - if (f !== all) out.push(k); - } // remove from dimensional indices - - - for (k in indices) { - indices[k].remove(n, map); - } - - this.reindex(pulse, n, map); - return map; - }; // reindex filters and indices after propagation completes - - - prototype$1q.reindex = function (pulse, num, map) { - var indices = this._indices, - bits = this.value; - pulse.runAfter(function () { - var indexMap = bits.remove(num, map); - - for (var key in indices) { - indices[key].reindex(indexMap); - } - }); - }; - - prototype$1q.update = function (_, pulse, output) { - var dims = this._dims, - query = _.query, - stamp = pulse.stamp, - m = dims.length, - mask = 0, - i, - q; // survey how many queries have changed - - output.filters = 0; - - for (q = 0; q < m; ++q) { - if (_.modified('query', q)) { - i = q; - ++mask; - } - } - - if (mask === 1) { - // only one query changed, use more efficient update - mask = dims[i].one; - this.incrementOne(dims[i], query[i], output.add, output.rem); - } else { - // multiple queries changed, perform full record keeping - for (q = 0, mask = 0; q < m; ++q) { - if (!_.modified('query', q)) continue; - mask |= dims[q].one; - this.incrementAll(dims[q], query[q], stamp, output.add); - output.rem = output.add; // duplicate add/rem for downstream resolve - } - } - - return mask; - }; - - prototype$1q.incrementAll = function (dim, query, stamp, out) { - var bits = this.value, - seen = bits.seen(), - curr = bits.curr(), - prev = bits.prev(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, - j, - k; // Fast incremental update based on previous lo index. - - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } // Fast incremental update based on previous hi index. - - - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } - - dim.range = query.slice(); - }; - - prototype$1q.incrementOne = function (dim, query, add, rem) { - var bits = this.value, - curr = bits.curr(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, - j, - k; // Fast incremental update based on previous lo index. - - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } // Fast incremental update based on previous hi index. - - - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - dim.range = query.slice(); - }; - /** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ - - - function ResolveFilter(params) { - Transform.call(this, null, params); - } - - ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [{ - 'name': 'ignore', - 'type': 'number', - 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' - }, { - 'name': 'filter', - 'type': 'object', - 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' - }] - }; - var prototype$1r = inherits(ResolveFilter, Transform); - - prototype$1r.transform = function (_, pulse) { - var ignore = ~(_.ignore || 0), - // bit mask where zeros -> dims to ignore - bitmap = _.filter, - mask = bitmap.mask; // exit early if no relevant filter changes - - if ((mask & ignore) === 0) return pulse.StopPropagation; - - var output = pulse.fork(pulse.ALL), - data = bitmap.data(), - curr = bitmap.curr(), - prev = bitmap.prev(), - pass = function pass(k) { - return !(curr[k] & ignore) ? data[k] : null; - }; // propagate all mod tuples that pass the filter - - - output.filter(output.MOD, pass); // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - - if (!(mask & mask - 1)) { - // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, function (k) { - return (curr[k] & ignore) === mask ? data[k] : null; - }); - } else { - // multiple filters changed - output.filter(output.ADD, function (k) { - var c = curr[k] & ignore, - f = !c && c ^ prev[k] & ignore; - return f ? data[k] : null; - }); - output.filter(output.REM, function (k) { - var c = curr[k] & ignore, - f = c && !(c ^ (c ^ prev[k] & ignore)); - return f ? data[k] : null; - }); - } // add filter to source data in case of reflow... - - - return output.filter(output.SOURCE, function (t) { - return pass(t._index); - }); - }; - - var xf = /*#__PURE__*/Object.freeze({ - __proto__: null, - crossfilter: CrossFilter, - resolvefilter: ResolveFilter - }); - var version = "5.13.0"; // initialize aria role and label attributes - - function initializeAria(view) { - var el = view.container(); - - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } - } // update aria-label if we have a DOM container element - - - function ariaLabel(el, desc) { - if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc); - } - - function background$1(view) { - // respond to background signal - view.add(null, function (_) { - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { - bg: view._signals.background - }); - } - - var Default = 'default'; - - function cursor(view) { - // get cursor signal, add to dataflow if needed - var cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); // evaluate cursor on each mousemove event - - view.on(view.events('view', 'mousemove'), cursor, function (_, event) { - var value = cursor.value, - user = value ? isString(value) ? value : value.user : Default, - item = event.item && event.item.cursor || null; - return value && user === value.user && item == value.item ? value : { - user: user, - item: item - }; - }); // when cursor signal updates, set visible cursor - - view.add(null, function (_) { - var user = _.cursor, - item = this.value; - - if (!isString(user)) { - item = user.item; - user = user.user; - } - - setCursor(view, user && user !== Default ? user : item || user); - return item; - }, { - cursor: cursor - }); - } - - function setCursor(view, cursor) { - var el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container(); - - if (el) { - return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor; - } - } - - function dataref(view, name) { - var data = view._runtime.data; - - if (!hasOwnProperty(data, name)) { - error('Unrecognized data set: ' + name); - } - - return data[name]; - } - - function data(name, values) { - return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values)); - } - - function change(name, changes) { - if (!isChangeSet(changes)) { - error('Second argument to changes must be a changeset.'); - } - - var dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); - } - - function insert(name, _) { - return change.call(this, name, changeset().insert(_)); - } - - function remove(name, _) { - return change.call(this, name, changeset().remove(_)); - } - - function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); - } - - function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); - } - - function offset$3(view) { - var padding = view.padding(), - origin = view._origin; - return [padding.left + origin[0], padding.top + origin[1]]; - } - - function resizeRenderer(view) { - var origin = offset$3(view), - w = width(view), - h = height(view); - - view._renderer.background(view.background()); - - view._renderer.resize(w, h, origin); - - view._handler.origin(origin); - - view._resizeListeners.forEach(function (handler) { - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); - } - /** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ - - - function eventExtend(view, event, item) { - var r = view._renderer, - el = r && r.canvas(), - p, - e, - translate; - - if (el) { - translate = offset$3(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = point(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; - } - - function extension(view, item, point) { - var itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null; - - function group(name) { - var g = itemGroup, - i; - if (name) for (i = item; i; i = i.mark.group) { - if (i.mark.name === name) { - g = i; - break; - } - } - return g && g.mark && g.mark.interactive ? g : {}; - } - - function xy(item) { - if (!item) return point; - if (isString(item)) item = group(item); - var p = point.slice(); - - while (item) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - - return p; - } - - return { - view: constant(view), - item: constant(item || {}), - group: group, - xy: xy, - x: function x(item) { - return xy(item)[0]; - }, - y: function y(item) { - return xy(item)[1]; - } - }; - } - - var VIEW = 'view', - TIMER = 'timer', - WINDOW = 'window', - NO_TRAP = { - trap: false - }; - /** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ - - function initializeEventConfig(config) { - var events = extend({ - defaults: {} - }, config); - - var unpack = function unpack(obj, keys) { - keys.forEach(function (k) { - if (isArray(obj[k])) obj[k] = toSet(obj[k]); - }); - }; - - unpack(events.defaults, ['prevent', 'allow']); - unpack(events, ['view', 'window', 'selector']); - return events; - } - - function prevent(view, type) { - var def = view._eventConfig.defaults, - prevent = def.prevent, - allow = def.allow; - return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault(); - } - - function permit(view, key, type) { - var rule = view._eventConfig && view._eventConfig[key]; - - if (rule === false || isObject(rule) && !rule[type]) { - view.warn("Blocked ".concat(key, " ").concat(type, " event listener.")); - return false; - } - - return true; - } - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ - - - function events$1(source, type, filter) { - var view = this, - s = new EventStream(filter), - send = function send(e, item) { - view.runAsync(null, function () { - if (source === VIEW && prevent(view, type)) { - e.preventDefault(); - } - - s.receive(eventExtend(view, e, item)); - }); - }, - sources; - - if (source === TIMER) { - if (permit(view, 'timer', type)) { - view.timer(send, type); - } - } else if (source === VIEW) { - if (permit(view, 'view', type)) { - // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } - } else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') { - sources = [window]; - } - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) { - sources = document.querySelectorAll(source); - } - } - - if (!sources) { - view.warn('Can not resolve event source: ' + source); - } else { - for (var i = 0, n = sources.length; i < n; ++i) { - sources[i].addEventListener(type, send); - } - - view._eventListeners.push({ - type: type, - sources: sources, - handler: send - }); - } - } - - return s; - } - - function itemFilter(event) { - return event.item; - } - - function markTarget(event) { - // grab upstream collector feeding the mark operator - return event.item.mark.source; - } - - function invoke(name) { - return function (_, event) { - return event.vega.view().changeset().encode(event.item, name); - }; - } - - function hover(hoverSet, leaveSet) { - hoverSet = [hoverSet || 'hover']; - leaveSet = [leaveSet || 'update', hoverSet[0]]; // invoke hover set upon mouseover - - this.on(this.events('view', 'mouseover', itemFilter), markTarget, invoke(hoverSet)); // invoke leave set upon mouseout - - this.on(this.events('view', 'mouseout', itemFilter), markTarget, invoke(leaveSet)); - return this; - } - /** - * Finalize a View instance that is being removed. - * Cancel any running timers. - * Remove all external event listeners. - * Remove any currently displayed tooltip. - */ - - - function finalize() { - var tooltip = this._tooltip, - timers = this._timers, - listeners = this._eventListeners, - n, - m, - e; - n = timers.length; - - while (--n >= 0) { - timers[n].stop(); - } - - n = listeners.length; - - while (--n >= 0) { - e = listeners[n]; - m = e.sources.length; - - while (--m >= 0) { - e.sources[m].removeEventListener(e.type, e.handler); - } - } - - if (tooltip) { - tooltip.call(this, this._handler, null, null, null); - } - - return this; - } - - function element$1(tag, attr, text) { - var el = document.createElement(tag); - - for (var key in attr) { - el.setAttribute(key, attr[key]); - } - - if (text != null) el.textContent = text; - return el; - } - - var BindClass = 'vega-bind', - NameClass = 'vega-bind-name', - RadioClass = 'vega-bind-radio'; - /** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ - - function bind$1(view, el, binding) { - if (!el) return; - var param = binding.param; - var bind = binding.state; - - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: function update(value) { - if (value !== view.signal(param.signal)) { - view.runAsync(null, function () { - bind.source = true; - view.signal(param.signal, value); - }); - } - } - }; - - if (param.debounce) { - bind.update = debounce(param.debounce, bind.update); - } - } - - generate(bind, el, param, view.signal(param.signal)); - - if (!bind.active) { - view.on(view._signals[param.signal], null, function () { - bind.source ? bind.source = false : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - - return bind; - } - /** - * Generate an HTML input form element and bind it to a signal. - */ - - - function generate(bind, el, param, value) { - var div = element$1('div', { - 'class': BindClass - }); - var wrapper = param.input === 'radio' ? div : div.appendChild(element$1('label')); - wrapper.appendChild(element$1('span', { - 'class': NameClass - }, param.name || param.signal)); - el.appendChild(div); - var input = form; - - switch (param.input) { - case 'checkbox': - input = checkbox; - break; - - case 'select': - input = select; - break; - - case 'radio': - input = radio; - break; - - case 'range': - input = range; - break; - } - - input(bind, wrapper, param, value); - } - /** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ - - - function form(bind, el, param, value) { - var node = element$1('input'); - - for (var _key8 in param) { - if (_key8 !== 'signal' && _key8 !== 'element') { - node.setAttribute(_key8 === 'input' ? 'type' : _key8, param[_key8]); - } - } - - node.setAttribute('name', param.signal); - node.value = value; - el.appendChild(node); - node.addEventListener('input', function () { - return bind.update(node.value); - }); - bind.elements = [node]; - - bind.set = function (value) { - return node.value = value; - }; - } - /** - * Generates a checkbox input element. - */ - - - function checkbox(bind, el, param, value) { - var attr = { - type: 'checkbox', - name: param.signal - }; - if (value) attr.checked = true; - var node = element$1('input', attr); - el.appendChild(node); - node.addEventListener('change', function () { - return bind.update(node.checked); - }); - bind.elements = [node]; - - bind.set = function (value) { - return node.checked = !!value || null; - }; - } - /** - * Generates a selection list input element. - */ - - - function select(bind, el, param, value) { - var node = element$1('select', { - name: param.signal - }), - labels = param.labels || []; - param.options.forEach(function (option, i) { - var attr = { - value: option - }; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element$1('option', attr, (labels[i] || option) + '')); - }); - el.appendChild(node); - node.addEventListener('change', function () { - bind.update(param.options[node.selectedIndex]); - }); - bind.elements = [node]; - - bind.set = function (value) { - for (var i = 0, n = param.options.length; i < n; ++i) { - if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; - return; - } - } - }; - } - /** - * Generates a radio button group. - */ - - - function radio(bind, el, param, value) { - var group = element$1('span', { - 'class': RadioClass - }), - labels = param.labels || []; - el.appendChild(group); - bind.elements = param.options.map(function (option, i) { - var attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - var input = element$1('input', attr); - input.addEventListener('change', function () { - return bind.update(option); - }); - var label = element$1('label', {}, (labels[i] || option) + ''); - label.prepend(input); - group.appendChild(label); - return input; - }); - - bind.set = function (value) { - var nodes = bind.elements, - n = nodes.length; - - for (var i = 0; i < n; ++i) { - if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - } - }; - } - /** - * Generates a slider input element. - */ - - - function range(bind, el, param, value) { - value = value !== undefined ? value : (+param.max + +param.min) / 2; - var max = param.max != null ? param.max : Math.max(100, +value) || 100, - min = param.min || Math.min(0, max, +value) || 0, - step = param.step || tickStep(min, max, 100); - var node = element$1('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - var span = element$1('span', {}, +value); - el.appendChild(node); - el.appendChild(span); - - var update = function update() { - span.textContent = node.value; - bind.update(+node.value); - }; // subscribe to both input and change - - - node.addEventListener('input', update); - node.addEventListener('change', update); - bind.elements = [node]; - - bind.set = function (value) { - node.value = value; - span.textContent = value; - }; - } - - function valuesEqual(a, b) { - return a === b || a + '' === b + ''; - } - - function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r.initialize(el, width(view), height(view), offset$3(view), scaleFactor, opt).background(view.background()); - } - - function trap(view, fn) { - return !fn ? null : function () { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; - } - - function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - var handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset$3(view), view); // transfer event handlers - - if (prevHandler) { - prevHandler.handlers().forEach(function (h) { - handler.on(h.type, h.handler); - }); - } - - return handler; - } - - function initialize$1(el, elBind) { - var view = this, - type = view._renderType, - config = view._eventConfig.bind, - module = renderModule(type); // containing dom element - - el = view._el = el ? lookup$4(view, el) : null; // initialize aria attributes - - initializeAria(view); // select appropriate renderer & handler - - if (!module) view.error('Unrecognized renderer type: ' + type); - var Handler = module.handler || CanvasHandler, - Renderer = el ? module.renderer : module.headless; // initialize renderer and input handler - - view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; // initialize signal bindings - - if (el && config !== 'none') { - elBind = elBind ? view._elBind = lookup$4(view, elBind) : el.appendChild(element$1('form', { - 'class': 'vega-bindings' - })); - - view._bind.forEach(function (_) { - if (_.param.element && config !== 'container') { - _.element = lookup$4(view, _.param.element); - } - }); - - view._bind.forEach(function (_) { - bind$1(view, _.element || elBind, _); - }); - } - - return view; - } - - function lookup$4(view, el) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; - } - } - - if (el) { - try { - el.innerHTML = ''; - } catch (e) { - el = null; - view.error(e); - } - } - - return el; - } - - var number$5 = function number$5(_) { - return +_ || 0; - }; - - var paddingObject = function paddingObject(_) { - return { - top: _, - bottom: _, - left: _, - right: _ - }; - }; - - function padding(_) { - return isObject(_) ? { - top: number$5(_.top), - bottom: number$5(_.bottom), - left: number$5(_.left), - right: number$5(_.right) - } : paddingObject(number$5(_)); - } - /** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ - - - function renderHeadless(_x32, _x33, _x34, _x35) { - return _renderHeadless.apply(this, arguments); - } - /** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ - - - function _renderHeadless() { - _renderHeadless = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(view, type, scaleFactor, opt) { - var module, ctr; - return regeneratorRuntime.wrap(function _callee12$(_context19) { - while (1) { - switch (_context19.prev = _context19.next) { - case 0: - module = renderModule(type), ctr = module && module.headless; - if (!ctr) error('Unrecognized renderer type: ' + type); - _context19.next = 4; - return view.runAsync(); - - case 4: - return _context19.abrupt("return", initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root)); - - case 5: - case "end": - return _context19.stop(); - } - } - }, _callee12); - })); - return _renderHeadless.apply(this, arguments); - } - - function renderToImageURL(_x36, _x37) { - return _renderToImageURL.apply(this, arguments); - } - - function _renderToImageURL() { - _renderToImageURL = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(type, scaleFactor) { - var r; - return regeneratorRuntime.wrap(function _callee13$(_context20) { - while (1) { - switch (_context20.prev = _context20.next) { - case 0: - if (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG) { - error('Unrecognized image type: ' + type); - } - - _context20.next = 3; - return renderHeadless(this, type, scaleFactor); - - case 3: - r = _context20.sent; - return _context20.abrupt("return", type === RenderType.SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png')); - - case 5: - case "end": - return _context20.stop(); - } - } - }, _callee13, this); - })); - return _renderToImageURL.apply(this, arguments); - } - - function toBlobURL(data, mime) { - var blob = new Blob([data], { - type: mime - }); - return window.URL.createObjectURL(blob); - } - /** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ - - - function renderToCanvas(_x38, _x39) { - return _renderToCanvas.apply(this, arguments); - } - /** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ - - - function _renderToCanvas() { - _renderToCanvas = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(scaleFactor, opt) { - var r; - return regeneratorRuntime.wrap(function _callee14$(_context21) { - while (1) { - switch (_context21.prev = _context21.next) { - case 0: - _context21.next = 2; - return renderHeadless(this, RenderType.Canvas, scaleFactor, opt); - - case 2: - r = _context21.sent; - return _context21.abrupt("return", r.canvas()); - - case 4: - case "end": - return _context21.stop(); - } - } - }, _callee14, this); - })); - return _renderToCanvas.apply(this, arguments); - } - - function renderToSVG(_x40) { - return _renderToSVG.apply(this, arguments); - } - - function _renderToSVG() { - _renderToSVG = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(scaleFactor) { - var r; - return regeneratorRuntime.wrap(function _callee15$(_context22) { - while (1) { - switch (_context22.prev = _context22.next) { - case 0: - _context22.next = 2; - return renderHeadless(this, RenderType.SVG, scaleFactor); - - case 2: - r = _context22.sent; - return _context22.abrupt("return", r.svg()); - - case 4: - case "end": - return _context22.stop(); - } - } - }, _callee15, this); - })); - return _renderToSVG.apply(this, arguments); - } - - function data$1(name) { - var data = this.context.data[name]; - return data ? data.values.value : []; - } - - function indata(name, field, value) { - var index = this.context.data[name]['index:' + field], - entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; - } - - function setdata(name, tuples) { - var df = this.context.dataflow, - data = this.context.data[name], - input = data.input; - df.pulse(input, df.changeset().remove(truthy).insert(tuples)); - return 1; - } - - function encode$1(item, name, retval) { - if (item) { - var df = this.context.dataflow, - target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - - return retval !== undefined ? retval : item; - } - - var wrap = function wrap(method) { - return function (value, spec) { - var locale = this.context.dataflow.locale(); - return locale[method](spec)(value); - }; - }; - - var format$2 = wrap('format'); - var timeFormat = wrap('timeFormat'); - var utcFormat = wrap('utcFormat'); - var timeParse = wrap('timeParse'); - var utcParse = wrap('utcParse'); - var dateObj = new Date(2000, 0, 1); - - function time$1(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); - dateObj.setMonth(month); - dateObj.setDate(day); - return timeFormat.call(this, dateObj, specifier); - } - - function monthFormat(month) { - return time$1.call(this, month, 1, '%B'); - } - - function monthAbbrevFormat(month) { - return time$1.call(this, month, 1, '%b'); - } - - function dayFormat(day) { - return time$1.call(this, 0, 2 + day, '%A'); - } - - function dayAbbrevFormat(day) { - return time$1.call(this, 0, 2 + day, '%a'); - } - - var DataPrefix = ':'; - var IndexPrefix = '@'; - var ScalePrefix = '%'; - var SignalPrefix = '$'; - var RawCode = 'RawCode'; - var Literal = 'Literal'; - var Property = 'Property'; - var Identifier$1 = 'Identifier'; - var ArrayExpression = 'ArrayExpression'; - var BinaryExpression = 'BinaryExpression'; - var CallExpression = 'CallExpression'; - var ConditionalExpression = 'ConditionalExpression'; - var LogicalExpression = 'LogicalExpression'; - var MemberExpression = 'MemberExpression'; - var ObjectExpression = 'ObjectExpression'; - var UnaryExpression = 'UnaryExpression'; - - function ASTNode(type) { - this.type = type; - } - - ASTNode.prototype.visit = function (visitor) { - var node = this, - c, - i, - n; - if (visitor(node)) return 1; - - for (c = children$1(node), i = 0, n = c.length; i < n; ++i) { - if (c[i].visit(visitor)) return 1; - } - }; - - function children$1(node) { - switch (node.type) { - case ArrayExpression: - return node.elements; - - case BinaryExpression: - case LogicalExpression: - return [node.left, node.right]; - - case CallExpression: - var args = node.arguments.slice(); - args.unshift(node.callee); - return args; - - case ConditionalExpression: - return [node.test, node.consequent, node.alternate]; - - case MemberExpression: - return [node.object, node.property]; - - case ObjectExpression: - return node.properties; - - case Property: - return [node.key, node.value]; - - case UnaryExpression: - return [node.argument]; - - case Identifier$1: - case Literal: - case RawCode: - default: - return []; - } - } - /* - The following expression parser is based on Esprima (http://esprima.org/). - Original header comment and license for Esprima is included here: - Copyright (C) 2013 Ariya Hidayat - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - 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. - 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 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. - */ - - - var TokenName, source$1, index, length, lookahead; - var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; - TokenName = {}; - TokenName[TokenBooleanLiteral] = 'Boolean'; - TokenName[TokenEOF] = ''; - TokenName[TokenIdentifier] = 'Identifier'; - TokenName[TokenKeyword] = 'Keyword'; - TokenName[TokenNullLiteral] = 'Null'; - TokenName[TokenNumericLiteral] = 'Numeric'; - TokenName[TokenPunctuator] = 'Punctuator'; - TokenName[TokenStringLiteral] = 'String'; - TokenName[TokenRegularExpression] = 'RegularExpression'; - var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; // Error messages should be identical to V8. - - var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; - var ILLEGAL = 'ILLEGAL', - DISABLED = 'Disabled.'; // See also tools/generate-unicode-regex.py. - - var RegexNonAsciiIdentifierStart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\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F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), - // eslint-disable-next-line no-misleading-character-class - RegexNonAsciiIdentifierPart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\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-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"); // Ensure the condition is true, otherwise throw an error. - // This is only to have a better contract semantic, i.e. another safety net - // to catch a logic error. The condition shall be fulfilled in normal case. - // Do NOT use this to enforce a certain condition on any user input. - - function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - - function isDecimalDigit(ch) { - return ch >= 0x30 && ch <= 0x39; // 0..9 - } - - function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; - } - - function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; - } // 7.2 White Space - - - function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0; - } // 7.3 Line Terminators - - - function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; - } // 7.6 Identifier Names and Identifiers - - - function isIdentifierStart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)); - } - - function isIdentifierPart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)); - } // 7.6.1.1 Keywords - - - var keywords = { - 'if': 1, - 'in': 1, - 'do': 1, - 'var': 1, - 'for': 1, - 'new': 1, - 'try': 1, - 'let': 1, - 'this': 1, - 'else': 1, - 'case': 1, - 'void': 1, - 'with': 1, - 'enum': 1, - 'while': 1, - 'break': 1, - 'catch': 1, - 'throw': 1, - 'const': 1, - 'yield': 1, - 'class': 1, - 'super': 1, - 'return': 1, - 'typeof': 1, - 'delete': 1, - 'switch': 1, - 'export': 1, - 'import': 1, - 'public': 1, - 'static': 1, - 'default': 1, - 'finally': 1, - 'extends': 1, - 'package': 1, - 'private': 1, - 'function': 1, - 'continue': 1, - 'debugger': 1, - 'interface': 1, - 'protected': 1, - 'instanceof': 1, - 'implements': 1 - }; - - function skipComment() { - var ch; - - while (index < length) { - ch = source$1.charCodeAt(index); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index; - } else { - break; - } - } - } - - function scanHexEscape(prefix) { - var i, - len, - ch, - code = 0; - len = prefix === 'u' ? 4 : 2; - - for (i = 0; i < len; ++i) { - if (index < length && isHexDigit(source$1[index])) { - ch = source$1[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - return String.fromCharCode(code); - } - - function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - ch = source$1[index]; - code = 0; // At least, one hex digit is required. - - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - while (index < length) { - ch = source$1[index++]; - - if (!isHexDigit(ch)) { - break; - } - - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } // UTF-16 Encoding - - - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - - cu1 = (code - 0x10000 >> 10) + 0xD800; - cu2 = (code - 0x10000 & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); - } - - function getEscapedIdentifier() { - var ch, id; - ch = source$1.charCodeAt(index++); - id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character. - - if (ch === 0x5C) { - if (source$1.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - ++index; - ch = scanHexEscape('u'); - - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - id = ch; - } - - while (index < length) { - ch = source$1.charCodeAt(index); - - if (!isIdentifierPart(ch)) { - break; - } - - ++index; - id += String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character. - - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - - if (source$1.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - ++index; - ch = scanHexEscape('u'); - - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - id += ch; - } - } - - return id; - } - - function getIdentifier() { - var start, ch; - start = index++; - - while (index < length) { - ch = source$1.charCodeAt(index); - - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); - } - - if (isIdentifierPart(ch)) { - ++index; - } else { - break; - } - } - - return source$1.slice(start, index); - } - - function scanIdentifier() { - var start, id, type; - start = index; // Backslash (U+005C) starts an escaped character. - - id = source$1.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { - // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index - }; - } // 7.7 Punctuators - - - function scanPunctuator() { - var start = index, - code = source$1.charCodeAt(index), - code2, - ch1 = source$1[index], - ch2, - ch3, - ch4; - - switch (code) { - // Check for most common single-character punctuators. - case 0x2E: // . dot - - case 0x28: // ( open bracket - - case 0x29: // ) close bracket - - case 0x3B: // ; semicolon - - case 0x2C: // , comma - - case 0x7B: // { open curly brace - - case 0x7D: // } close curly brace - - case 0x5B: // [ - - case 0x5D: // ] - - case 0x3A: // : - - case 0x3F: // ? - - case 0x7E: - // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - - default: - code2 = source$1.charCodeAt(index + 1); // '=' (U+003D) marks an assignment or comparison operator. - - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - - case 0x2D: // - - - case 0x2F: // / - - case 0x3C: // < - - case 0x3E: // > - - case 0x5E: // ^ - - case 0x7C: // | - - case 0x25: // % - - case 0x26: // & - - case 0x2A: - // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - - case 0x21: // ! - - case 0x3D: - // = - index += 2; // !== and === - - if (source$1.charCodeAt(index) === 0x3D) { - ++index; - } - - return { - type: TokenPunctuator, - value: source$1.slice(start, index), - start: start, - end: index - }; - } - } - - } // 4-character punctuator: >>>= - - - ch4 = source$1.substr(index, 4); - - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } // 3-character punctuators: === !== >>> <<= >>= - - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } // Other 2-character punctuators: ++ -- << >> && || - - - ch2 = ch3.substr(0, 2); - - if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } // 1-character punctuators: < > = ! + - * % & | ^ / - - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL); - } // 7.8.3 Numeric Literals - - - function scanHexLiteral(start) { - var number = ''; - - while (index < length) { - if (!isHexDigit(source$1[index])) { - break; - } - - number += source$1[index++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - if (isIdentifierStart(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index - }; - } - - function scanOctalLiteral(start) { - var number = '0' + source$1[index++]; - - while (index < length) { - if (!isOctalDigit(source$1[index])) { - break; - } - - number += source$1[index++]; - } - - if (isIdentifierStart(source$1.charCodeAt(index)) || isDecimalDigit(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; - } - - function scanNumericLiteral() { - var number, start, ch; - ch = source$1[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point'); - start = index; - number = ''; - - if (ch !== '.') { - number = source$1[index++]; - ch = source$1[index]; // Hex number starts with '0x'. - // Octal number starts with '0'. - - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } // decimal number starts with '0' such as '09' is illegal. - - - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - - ch = source$1[index]; - } - - if (ch === '.') { - number += source$1[index++]; - - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - - ch = source$1[index]; - } - - if (ch === 'e' || ch === 'E') { - number += source$1[index++]; - ch = source$1[index]; - - if (ch === '+' || ch === '-') { - number += source$1[index++]; - } - - if (isDecimalDigit(source$1.charCodeAt(index))) { - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - if (isIdentifierStart(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; - } // 7.8.4 String Literals - - - function scanStringLiteral() { - var str = '', - quote, - start, - ch, - code, - octal = false; - quote = source$1[index]; - assert(quote === '\'' || quote === '"', 'String literal must starts with a quote'); - start = index; - ++index; - - while (index < length) { - ch = source$1[index++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source$1[index++]; - - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source$1[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - - break; - - case 'n': - str += '\n'; - break; - - case 'r': - str += '\r'; - break; - - case 't': - str += '\t'; - break; - - case 'b': - str += '\b'; - break; - - case 'f': - str += '\f'; - break; - - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); // \0 is not octal escape sequence - - if (code !== 0) { - octal = true; - } - - if (index < length && isOctalDigit(source$1[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source$1[index++]); // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - - if ('0123'.indexOf(ch) >= 0 && index < length && isOctalDigit(source$1[index])) { - code = code * 8 + '01234567'.indexOf(source$1[index++]); - } - } - - str += String.fromCharCode(code); - } else { - str += ch; - } - - break; - } - } else { - if (ch === '\r' && source$1[index] === '\n') { - ++index; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index - }; - } - - function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - - throwError({}, MessageInvalidRegExp); - }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } // First, detect invalid regular expressions. - - - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - - - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } - } - - function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - ch = source$1[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source$1[index++]; - classMarker = false; - terminated = false; - - while (index < length) { - ch = source$1[index++]; - str += ch; - - if (ch === '\\') { - ch = source$1[index++]; // ECMA-262 7.8.5 - - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } // Exclude leading and trailing slash. - - - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; - } - - function scanRegExpFlags() { - var ch, str, flags; - str = ''; - flags = ''; - - while (index < length) { - ch = source$1[index]; - - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index; - - if (ch === '\\' && index < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; - } - - function scanRegExp() { - var start, body, flags, value; - lookahead = null; - skipComment(); - start = index; - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index - }; - } - - function isIdentifierName(token) { - return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; - } - - function advance() { - var ch; - skipComment(); - - if (index >= length) { - return { - type: TokenEOF, - start: index, - end: index - }; - } - - ch = source$1.charCodeAt(index); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } // Very common: ( and ) and ; - - - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } // String literal starts with single quote (U+0027) or double quote (U+0022). - - - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - - - if (ch === 0x2E) { - if (isDecimalDigit(source$1.charCodeAt(index + 1))) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - function lex() { - var token; - token = lookahead; - index = token.end; - lookahead = advance(); - index = token.end; - return token; - } - - function peek$1() { - var pos; - pos = index; - lookahead = advance(); - index = pos; - } - - function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; - } - - function finishBinaryExpression(operator, left, right) { - var node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; - } - - function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; - } - - function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; - } - - function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; - } - - function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source$1.slice(token.start, token.end); - - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - - node.regex = token.regex; - } - - return node; - } - - function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; - } - - function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; - } - - function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; - } - - function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; - } // Throw an exception - - - function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace(/%(\d)/g, function (whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - }); - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; - } // Throw an exception because of the token. - - - function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } // BooleanLiteral, NullLiteral, or Punctuator. - - - throwError(token, MessageUnexpectedToken, token.value); - } // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - - - function expect(value) { - var token = lex(); - - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } - } // Return true if the next token matches the specified punctuator. - - - function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; - } // Return true if the next token matches the specified keyword - - - function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; - } // 11.1.4 Array Initialiser - - - function parseArrayInitialiser() { - var elements = []; - index = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - return finishArrayExpression(elements); - } // 11.1.5 Object Initialiser - - - function parseObjectPropertyKey() { - var token; - index = lookahead.start; - token = lex(); // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - - return finishLiteral(token); - } - - return finishIdentifier(token.value); - } - - function parseObjectProperty() { - var token, key, id, value; - index = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } - } - - function parseObjectInitialiser() { - var properties = [], - property, - name, - key, - map = {}, - toString = String; - index = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - return finishObjectExpression(properties); - } // 11.1.6 The Grouping Operator - - - function parseGroupExpression() { - var expr; - expect('('); - expr = parseExpression(); - expect(')'); - return expr; - } // 11.1 Primary Expressions - - - var legalKeywords = { - 'if': 1 - }; - - function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index = lookahead.start; - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = token.value === 'true'; - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek$1(); - } else { - throwUnexpected(lex()); - } - - return expr; - } // 11.2 Left-Hand-Side Expressions - - - function parseArguments() { - var args = []; - expect('('); - - if (!match(')')) { - while (index < length) { - args.push(parseConditionalExpression()); - - if (match(')')) { - break; - } - - expect(','); - } - } - - expect(')'); - return args; - } - - function parseNonComputedProperty() { - var token; - index = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); - } - - function parseNonComputedMember() { - expect('.'); - return parseNonComputedProperty(); - } - - function parseComputedMember() { - var expr; - expect('['); - expr = parseExpression(); - expect(']'); - return expr; - } - - function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; - } // 11.3 Postfix Expressions - - - function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if (match('++') || match('--')) { - throw new Error(DISABLED); - } - } - - return expr; - } // 11.4 Unary Operators - - - function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; - } - - function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - } - - return prec; - } // 11.5 Multiplicative Operators - // 11.6 Additive Operators - // 11.7 Bitwise Shift Operators - // 11.8 Relational Operators - // 11.9 Equality Operators - // 11.10 Binary Bitwise Operators - // 11.11 Binary Logical Operators - - - function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - marker = lookahead; - left = parseUnaryExpression(); - token = lookahead; - prec = binaryPrecedence(token); - - if (prec === 0) { - return left; - } - - token.prec = prec; - lex(); - markers = [marker, lookahead]; - right = parseUnaryExpression(); - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - // Reduce: make a binary expression from the three topmost entries. - while (stack.length > 2 && prec <= stack[stack.length - 2].prec) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } // Shift. - - - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } // Final reduce to clean-up the stack. - - - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; - } // 11.12 Conditional Operator - - - function parseConditionalExpression() { - var expr, consequent, alternate; - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; - } // 11.14 Comma Operator - - - function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; - } - - function parse$3(code) { - source$1 = code; - index = 0; - length = source$1.length; - lookahead = null; - peek$1(); - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - - return expr; - } - - var constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' - }; - - function functions(codegen) { - function fncall(name, args, cast, type) { - var obj = codegen(args[0]); - - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - - return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')'); - } - - function fn(name, cast, type) { - return function (args) { - return fncall(name, args, cast, type); - }; - } - - var DATE = 'new Date', - STRING = 'String', - REGEXP = 'RegExp'; - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - clamp: function clamp(args) { - if (args.length < 3) error('Missing arguments to clamp function.'); - if (args.length > 3) error('Too many arguments to clamp function.'); - var a = args.map(codegen); - return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))'; - }, - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - // sequence functions - length: fn('length', null, -1), - join: fn('join', null), - indexof: fn('indexOf', null), - lastindexof: fn('lastIndexOf', null), - slice: fn('slice', null), - reverse: function reverse(args) { - return '(' + codegen(args[0]) + ').slice().reverse()'; - }, - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - replace: fn('replace', STRING), - trim: fn('trim', STRING, 0), - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - // Control Flow functions - if: function _if(args) { - if (args.length < 3) error('Missing arguments to if function.'); - if (args.length > 3) error('Too many arguments to if function.'); - var a = args.map(codegen); - return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')'; - } - }; - } - - function stripQuotes(s) { - var n = s && s.length - 1; - return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s; - } - - function codegen(opt) { - opt = opt || {}; - var whitelist = opt.whitelist ? toSet(opt.whitelist) : {}, - blacklist = opt.blacklist ? toSet(opt.blacklist) : {}, - constants$1 = opt.constants || constants, - functions$1 = (opt.functions || functions)(visit), - globalvar = opt.globalvar, - fieldvar = opt.fieldvar, - globals = {}, - fields = {}, - memberDepth = 0; - var outputGlobal = isFunction(globalvar) ? globalvar : function (id) { - return globalvar + '["' + id + '"]'; - }; - - function visit(ast) { - if (isString(ast)) return ast; - var generator = Generators[ast.type]; - if (generator == null) error('Unsupported type: ' + ast.type); - return generator(ast); - } - - var Generators = { - Literal: function Literal(n) { - return n.raw; - }, - Identifier: function Identifier(n) { - var id = n.name; - - if (memberDepth > 0) { - return id; - } else if (hasOwnProperty(blacklist, id)) { - return error('Illegal identifier: ' + id); - } else if (hasOwnProperty(constants$1, id)) { - return constants$1[id]; - } else if (hasOwnProperty(whitelist, id)) { - return id; - } else { - globals[id] = 1; - return outputGlobal(id); - } - }, - MemberExpression: function MemberExpression(n) { - var d = !n.computed; - var o = visit(n.object); - if (d) memberDepth += 1; - var p = visit(n.property); - - if (o === fieldvar) { - // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - } - - if (d) memberDepth -= 1; - return o + (d ? '.' + p : '[' + p + ']'); - }, - CallExpression: function CallExpression(n) { - if (n.callee.type !== 'Identifier') { - error('Illegal callee type: ' + n.callee.type); - } - - var callee = n.callee.name; - var args = n.arguments; - var fn = hasOwnProperty(functions$1, callee) && functions$1[callee]; - if (!fn) error('Unrecognized function: ' + callee); - return isFunction(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')'; - }, - ArrayExpression: function ArrayExpression(n) { - return '[' + n.elements.map(visit).join(',') + ']'; - }, - BinaryExpression: function BinaryExpression(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - UnaryExpression: function UnaryExpression(n) { - return '(' + n.operator + visit(n.argument) + ')'; - }, - ConditionalExpression: function ConditionalExpression(n) { - return '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')'; - }, - LogicalExpression: function LogicalExpression(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - ObjectExpression: function ObjectExpression(n) { - return '{' + n.properties.map(visit).join(',') + '}'; - }, - Property: function Property(n) { - memberDepth += 1; - var k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - - function codegen(ast) { - var result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; - } - - codegen.functions = functions$1; - codegen.constants = constants$1; - return codegen; - } - - function dataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) { - error('First argument to data functions must be a string literal.'); - } - - var data = args[0].value, - dataName = DataPrefix + data; - - if (!hasOwnProperty(dataName, params)) { - try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) {// if data set does not exist, there's nothing to track - } - } - } - - function indataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to indata must be a string literal.'); - if (args[1].type !== Literal) error('Second argument to indata must be a string literal.'); - var data = args[0].value, - field = args[1].value, - indexName = IndexPrefix + field; - - if (!hasOwnProperty(indexName, params)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - } - - function scaleVisitor(name, args, scope, params) { - if (args[0].type === Literal) { - // add scale dependency - addScaleDependency(scope, params, args[0].value); - } else { - // indirect scale lookup; add all scales as parameters - for (name in scope.scales) { - addScaleDependency(scope, params, name); - } - } - } - - function addScaleDependency(scope, params, name) { - var scaleName = ScalePrefix + name; - - if (!hasOwnProperty(params, scaleName)) { - try { - params[scaleName] = scope.scaleRef(name); - } catch (err) {// TODO: error handling? warning? - } - } - } - - function getScale(name, ctx) { - var s; - return isFunction(name) ? name : isString(name) ? (s = ctx.scales[name]) && s.value : undefined; - } - - function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = function (s) { - return s && s.bandwidth ? s.bandwidth() : 0; - }; // register AST visitors for internal scale functions - - - visitors._bandwidth = scaleVisitor; - visitors._range = scaleVisitor; - visitors._scale = scaleVisitor; // resolve scale reference directly to the signal hash argument - - var ref = function ref(arg) { - return '_[' + (arg.type === Literal ? $(ScalePrefix + arg.value) : $(ScalePrefix) + '+' + codegen(arg)) + ']'; - }; // define and return internal scale function code generators - // these internal functions are called by mark encoders - - - return { - _bandwidth: function _bandwidth(args) { - return "this.__bandwidth(".concat(ref(args[0]), ")"); - }, - _range: function _range(args) { - return "".concat(ref(args[0]), ".range()"); - }, - _scale: function _scale(args) { - return "".concat(ref(args[0]), "(").concat(codegen(args[1]), ")"); - } - }; - } - - function geoMethod(methodName, globalMethod) { - return function (projection, geojson, group) { - if (projection) { - // projection defined, use it - var p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else { - // projection undefined, use global method - return globalMethod(geojson); - } - }; - } - - var geoArea = geoMethod('area', d3Geo.geoArea); - var geoBounds = geoMethod('bounds', d3Geo.geoBounds); - var geoCentroid = geoMethod('centroid', d3Geo.geoCentroid); - - function inScope(item) { - var group = this.context.group, - value = false; - if (group) while (item) { - if (item === group) { - value = true; - break; - } - - item = item.mark.group; - } - return value; - } - - function log$3(df, method, args) { - try { - df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args))); - } catch (err) { - df.warn(err); - } - - return args[args.length - 1]; - } - - function warn() { - return log$3(this.context.dataflow, 'warn', arguments); - } - - function info() { - return log$3(this.context.dataflow, 'info', arguments); - } - - function debug() { - return log$3(this.context.dataflow, 'debug', arguments); - } // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - - - function channel_luminance_value(channelValue) { - var val = channelValue / 255; - - if (val <= 0.03928) { - return val / 12.92; - } - - return Math.pow((val + 0.055) / 1.055, 2.4); - } - - function luminance(color) { - var c = d3Color.rgb(color), - r = channel_luminance_value(c.r), - g = channel_luminance_value(c.g), - b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; - } // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef - - - function contrast(color1, color2) { - var lum1 = luminance(color1), - lum2 = luminance(color2), - lumL = Math.max(lum1, lum2), - lumD = Math.min(lum1, lum2); - return (lumL + 0.05) / (lumD + 0.05); - } - - function merge$2() { - var args = [].slice.call(arguments); - args.unshift({}); - return extend.apply(null, args); - } - - function equal(a, b) { - return a === b || a !== a && b !== b ? true : isArray(a) ? isArray(b) && a.length === b.length ? equalArray(a, b) : false : isObject(a) && isObject(b) ? equalObject(a, b) : false; - } - - function equalArray(a, b) { - for (var i = 0, n = a.length; i < n; ++i) { - if (!equal(a[i], b[i])) return false; - } - - return true; - } - - function equalObject(a, b) { - for (var _key9 in a) { - if (!equal(a[_key9], b[_key9])) return false; - } - - return true; - } - - function removePredicate(props) { - return function (_) { - return equalObject(props, _); - }; - } - - function modify(name, insert, remove, toggle, modify, values) { - var df = this.context.dataflow, - data = this.context.data[name], - input = data.input, - changes = data.changes, - stamp = df.stamp(), - predicate, - key; - - if (df._trigger === false || !(input.value.length || insert || toggle)) { - // nothing to do! - return 0; - } - - if (!changes || changes.stamp < stamp) { - data.changes = changes = df.changeset(); - changes.stamp = stamp; - df.runAfter(function () { - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - - if (remove) { - predicate = remove === true ? truthy : isArray(remove) || isTuple(remove) ? remove : removePredicate(remove); - changes.remove(predicate); - } - - if (insert) { - changes.insert(insert); - } - - if (toggle) { - predicate = removePredicate(toggle); - - if (input.value.some(predicate)) { - changes.remove(predicate); - } else { - changes.insert(toggle); - } - } - - if (modify) { - for (key in values) { - changes.modify(modify, key, values[key]); - } - } - - return 1; - } - - function pinchDistance(event) { - var t = event.touches, - dx = t[0].clientX - t[1].clientX, - dy = t[0].clientY - t[1].clientY; - return Math.sqrt(dx * dx + dy * dy); - } - - function pinchAngle(event) { - var t = event.touches; - return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); - } - - function bandspace(count, paddingInner, paddingOuter) { - return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0); - } - - function bandwidth(name, group) { - var s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; - } - - function copy$2(name, group) { - var s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; - } - - function domain(name, group) { - var s = getScale(name, (group || this).context); - return s ? s.domain() : []; - } - - function invert(name, range, group) { - var s = getScale(name, (group || this).context); - return !s ? undefined : isArray(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range); - } - - function range$1(name, group) { - var s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; - } - - function scale$3(name, value, group) { - var s = getScale(name, (group || this).context); - return s ? s(value) : undefined; - } - - function scaleGradient(scale, p0, p1, count, group) { - scale = getScale(scale, (group || this).context); - var gradient = Gradient(p0, p1); - var stops = scale.domain(), - min = stops[0], - max = peek(stops), - fraction = identity; - - if (!(max - min)) { - // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator ? scale$2('sequential')().interpolator(scale.interpolator()) : scale$2('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([min = 0, max = 1]); - } else { - fraction = scaleFraction(scale, min, max); - } - - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== peek(stops)) stops.push(max); - } - - stops.forEach(function (_) { - return gradient.stop(fraction(_), scale(_)); - }); - return gradient; - } - - function geoShape(projection, geojson, group) { - var p = getScale(projection, (group || this).context); - return function (context) { - return p ? p.path.context(context)(geojson) : ''; - }; - } - - function pathShape(path) { - var p = null; - return function (context) { - return context ? pathRender(context, p = p || pathParse(path)) : path; - }; - } - - var datum = function datum(d) { - return d.data; - }; - - function treeNodes(name, context) { - var tree = data$1.call(context, name); - return tree.root && tree.root.lookup || {}; - } - - function treePath(name, source, target) { - var nodes = treeNodes(name, this), - s = nodes[source], - t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; - } - - function treeAncestors(name, node) { - var n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; - } - - var _window = function _window() { - return typeof window !== 'undefined' && window || null; - }; - - function screen() { - var w = _window(); - - return w ? w.screen : {}; - } - - function windowSize() { - var w = _window(); - - return w ? [w.innerWidth, w.innerHeight] : [undefined, undefined]; - } - - function containerSize() { - var view = this.context.dataflow, - el = view.container && view.container(); - return el ? [el.clientWidth, el.clientHeight] : [undefined, undefined]; - } - - var Intersect = 'intersect'; - var Union = 'union'; - var VlMulti = 'vlMulti'; - var Or = 'or'; - var And = 'and'; - var TYPE_ENUM = 'E', - TYPE_RANGE_INC = 'R', - TYPE_RANGE_EXC = 'R-E', - TYPE_RANGE_LE = 'R-LE', - TYPE_RANGE_RE = 'R-RE', - UNIT_INDEX = 'index:unit'; // TODO: revisit date coercion? - - function testPoint(datum, entry) { - var fields = entry.fields, - values = entry.values, - n = fields.length, - i = 0, - dval, - f; - - for (; i < n; ++i) { - f = fields[i]; - f.getter = field.getter || field(f.field); - dval = f.getter(datum); - if (isDate(dval)) dval = toNumber(dval); - if (isDate(values[i])) values[i] = toNumber(values[i]); - if (isDate(values[i][0])) values[i] = values[i].map(toNumber); - - if (f.type === TYPE_ENUM) { - // Enumerated fields can either specify individual values (single/multi selections) - // or an array of values (interval selections). - if (isArray(values[i]) ? values[i].indexOf(dval) < 0 : dval !== values[i]) { - return false; - } - } else { - if (f.type === TYPE_RANGE_INC) { - if (!inrange(dval, values[i])) return false; - } else if (f.type === TYPE_RANGE_RE) { - // Discrete selection of bins test within the range [bin_start, bin_end). - if (!inrange(dval, values[i], true, false)) return false; - } else if (f.type === TYPE_RANGE_EXC) { - // 'R-E'/'R-LE' included for completeness. - if (!inrange(dval, values[i], false, false)) return false; - } else if (f.type === TYPE_RANGE_LE) { - if (!inrange(dval, values[i], false, true)) return false; - } - } - } - - return true; - } - /** - * Tests if a tuple is contained within an interactive selection. - * @param {string} name - The name of the data set representing the selection. - * Tuples in the dataset are of the form - * {unit: string, fields: array, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ - - - function selectionTest(name, datum, op) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, - intersect = op === Intersect, - n = entries.length, - i = 0, - entry, - miss, - count, - unit, - b; - - for (; i < n; ++i) { - entry = entries[i]; - - if (unitIdx && intersect) { - // multi selections union within the same unit and intersect across units. - miss = miss || {}; - count = miss[unit = entry.unit] || 0; // if we've already matched this unit, skip. - - if (count === -1) continue; - b = testPoint(datum, entry); - miss[unit] = b ? -1 : ++count; // if we match and there are no other units return true - // if we've missed against all tuples in this unit return false - - if (b && unitIdx.size === 1) return true; - if (!b && count === unitIdx.get(unit).count) return false; - } else { - b = testPoint(datum, entry); // if we find a miss and we do require intersection return false - // if we find a match and we don't require intersection return true - - if (intersect ^ b) return b; - } - } // if intersecting and we made it here, then we saw no misses - // if not intersecting, then we saw no matches - // if no active selections, return false - - - return n && intersect; - } - /** - * Resolves selection for use as a scale domain or reads via the API. - * @param {string} name - The name of the dataset representing the selection - * @param {string} [op='union'] - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @returns {object} An object of selected fields and values. - */ - - - function selectionResolve(name, op, isMulti) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - resolved = {}, - multiRes = {}, - types = {}, - entry, - fields, - values, - unit, - field, - res, - resUnit, - type, - union, - n = entries.length, - i = 0, - j, - m; // First union all entries within the same unit. - - for (; i < n; ++i) { - entry = entries[i]; - unit = entry.unit; - fields = entry.fields; - values = entry.values; - - for (j = 0, m = fields.length; j < m; ++j) { - field = fields[j]; - res = resolved[field.field] || (resolved[field.field] = {}); - resUnit = res[unit] || (res[unit] = []); - types[field.field] = type = field.type.charAt(0); - union = ops[type + '_union']; - res[unit] = union(resUnit, array(values[j])); - } // If the same multi-selection is repeated over views and projected over - // an encoding, it may operate over different fields making it especially - // tricky to reliably resolve it. At best, we can de-dupe identical entries - // but doing so may be more computationally expensive than it is worth. - // Instead, for now, we simply transform our store representation into - // a more human-friendly one. - - - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push(array(values).reduce(function (obj, curr, j) { - return obj[fields[j].field] = curr, obj; - }, {})); - } - } // Then resolve fields across units as per the op. - - - op = op || Union; - Object.keys(resolved).forEach(function (field) { - resolved[field] = Object.keys(resolved[field]).map(function (unit) { - return resolved[field][unit]; - }).reduce(function (acc, curr) { - return acc === undefined ? curr : ops[types[field] + '_' + op](acc, curr); - }); - }); - entries = Object.keys(multiRes); - - if (isMulti && entries.length) { - resolved[VlMulti] = op === Union ? _defineProperty({}, Or, entries.reduce(function (acc, k) { - return acc.push.apply(acc, multiRes[k]), acc; - }, [])) : _defineProperty({}, And, entries.map(function (k) { - return _defineProperty({}, Or, multiRes[k]); - })); - } - - return resolved; - } - - var ops = { - E_union: function E_union(base, value) { - if (!base.length) return value; - var i = 0, - n = value.length; - - for (; i < n; ++i) { - if (base.indexOf(value[i]) < 0) base.push(value[i]); - } - - return base; - }, - E_intersect: function E_intersect(base, value) { - return !base.length ? value : base.filter(function (v) { - return value.indexOf(v) >= 0; - }); - }, - R_union: function R_union(base, value) { - var lo = toNumber(value[0]), - hi = toNumber(value[1]); - - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; - }, - R_intersect: function R_intersect(base, value) { - var lo = toNumber(value[0]), - hi = toNumber(value[1]); - - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - - if (hi < base[0] || base[1] < lo) { - return []; - } else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - - return base; - } - }; - var DataPrefix$1 = ':', - IndexPrefix$1 = '@'; - - function selectionVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to selection functions must be a string literal.'); - var data = args[0].value, - op = args.length >= 2 && peek(args).value, - field = 'unit', - indexName = IndexPrefix$1 + field, - dataName = DataPrefix$1 + data; // eslint-disable-next-line no-prototype-builtins - - if (op === Intersect && !hasOwnProperty(params, indexName)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } // eslint-disable-next-line no-prototype-builtins - - - if (!hasOwnProperty(params, dataName)) { - params[dataName] = scope.getData(data).tuplesRef(); - } - } - - function intersect$2(b, opt, group) { - if (!b) return []; - - var _b4 = _slicedToArray(b, 2), - u = _b4[0], - v = _b4[1], - box = new Bounds().set(u[0], u[1], v[0], v[1]), - scene = group || this.context.dataflow.scenegraph().root; - - return intersect(scene, box, filter$1(opt)); - } - - function filter$1(opt) { - var p = null; - - if (opt) { - var types = array(opt.marktype), - names = array(opt.markname); - - p = function p(_) { - return (!types.length || types.some(function (t) { - return _.marktype === t; - })) && (!names.length || names.some(function (s) { - return _.name === s; - })); - }; - } - - return p; - } // Expression function context object - - - var functionContext = { - random: function random() { - return exports.random(); - }, - // override default - cumulativeNormal: cumulativeNormal, - cumulativeLogNormal: cumulativeLogNormal, - cumulativeUniform: cumulativeUniform, - densityNormal: densityNormal, - densityLogNormal: densityLogNormal, - densityUniform: densityUniform, - quantileNormal: quantileNormal, - quantileLogNormal: quantileLogNormal, - quantileUniform: quantileUniform, - sampleNormal: sampleNormal, - sampleLogNormal: sampleLogNormal, - sampleUniform: sampleUniform, - isArray: isArray, - isBoolean: isBoolean, - isDate: isDate, - isDefined: function isDefined(_) { - return _ !== undefined; - }, - isNumber: isNumber, - isObject: isObject, - isRegExp: isRegExp, - isString: isString, - isTuple: isTuple, - isValid: function isValid(_) { - return _ != null && _ === _; - }, - toBoolean: toBoolean, - toDate: toDate, - toNumber: toNumber, - toString: toString, - flush: flush, - lerp: lerp, - merge: merge$2, - pad: pad, - peek: peek, - span: span, - inrange: inrange, - truncate: truncate, - rgb: d3Color.rgb, - lab: d3Color.lab, - hcl: d3Color.hcl, - hsl: d3Color.hsl, - luminance: luminance, - contrast: contrast, - sequence: sequence, - format: format$2, - utcFormat: utcFormat, - utcParse: utcParse, - utcOffset: utcOffset, - utcSequence: utcSequence, - timeFormat: timeFormat, - timeParse: timeParse, - timeOffset: timeOffset, - timeSequence: timeSequence, - timeUnitSpecifier: timeUnitSpecifier, - monthFormat: monthFormat, - monthAbbrevFormat: monthAbbrevFormat, - dayFormat: dayFormat, - dayAbbrevFormat: dayAbbrevFormat, - quarter: quarter, - utcquarter: utcquarter, - week: week, - utcweek: utcweek, - dayofyear: dayofyear, - utcdayofyear: utcdayofyear, - warn: warn, - info: info, - debug: debug, - extent: extent, - inScope: inScope, - intersect: intersect$2, - clampRange: clampRange, - pinchDistance: pinchDistance, - pinchAngle: pinchAngle, - screen: screen, - containerSize: containerSize, - windowSize: windowSize, - bandspace: bandspace, - setdata: setdata, - pathShape: pathShape, - panLinear: panLinear, - panLog: panLog, - panPow: panPow, - panSymlog: panSymlog, - zoomLinear: zoomLinear, - zoomLog: zoomLog, - zoomPow: zoomPow, - zoomSymlog: zoomSymlog, - encode: encode$1, - modify: modify - }; - var eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'], - // event functions - eventPrefix = 'event.vega.', - // event function prefix - thisPrefix = 'this.', - // function context prefix - astVisitors = {}; // AST visitors for dependency analysis - // Build expression function registry - - function buildFunctions(codegen) { - var fn = functions(codegen); - eventFunctions.forEach(function (name) { - return fn[name] = eventPrefix + name; - }); - - for (var name in functionContext) { - fn[name] = thisPrefix + name; - } - - extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; - } // Register an expression function - - - function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) { - return functionContext[name]; - } // register with the functionContext - - - functionContext[name] = fn; // if there is an astVisitor register that, too - - if (visitor) astVisitors[name] = visitor; // if the code generator has already been initialized, - // we need to also register the function with it - - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; - } // register expression functions with ast visitors - - - expressionFunction('bandwidth', bandwidth, scaleVisitor); - expressionFunction('copy', copy$2, scaleVisitor); - expressionFunction('domain', domain, scaleVisitor); - expressionFunction('range', range$1, scaleVisitor); - expressionFunction('invert', invert, scaleVisitor); - expressionFunction('scale', scale$3, scaleVisitor); - expressionFunction('gradient', scaleGradient, scaleVisitor); - expressionFunction('geoArea', geoArea, scaleVisitor); - expressionFunction('geoBounds', geoBounds, scaleVisitor); - expressionFunction('geoCentroid', geoCentroid, scaleVisitor); - expressionFunction('geoShape', geoShape, scaleVisitor); - expressionFunction('indata', indata, indataVisitor); - expressionFunction('data', data$1, dataVisitor); - expressionFunction('treePath', treePath, dataVisitor); - expressionFunction('treeAncestors', treeAncestors, dataVisitor); // register Vega-Lite selection functions - - expressionFunction('vlSelectionTest', selectionTest, selectionVisitor); - expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor); // Export code generator and parameters - - var codegenParams = { - blacklist: ['_'], - whitelist: ['datum', 'event', 'item'], - fieldvar: 'datum', - globalvar: function globalvar(id) { - return '_[' + $(SignalPrefix + id) + ']'; - }, - functions: buildFunctions, - constants: constants, - visitors: astVisitors - }; - var codeGenerator = codegen(codegenParams); - - function parseExpression$1(expr, scope) { - var params = {}, - ast, - gen; // parse the expression to an abstract syntax tree (ast) - - try { - expr = isString(expr) ? expr : $(expr) + ''; - ast = parse$3(expr); - } catch (err) { - error('Expression parse error: ' + expr); - } // analyze ast function calls for dependencies - - - ast.visit(function (node) { - if (node.type !== CallExpression) return; - var name = node.callee.name, - visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); - }); // perform code generation - - gen = codeGenerator(ast); // collect signal dependencies - - gen.globals.forEach(function (name) { - var signalName = SignalPrefix + name; - - if (!hasOwnProperty(params, signalName) && scope.getSignal(name)) { - params[signalName] = scope.signalRef(name); - } - }); // return generated expression code and dependencies - - return { - $expr: extend({ - code: gen.code - }, scope.options.ast ? { - ast: ast - } : null), - $fields: gen.fields, - $params: params - }; - } - /** - * Parse a serialized dataflow specification. - */ - - - function parse$4(spec) { - var ctx = this, - operators = spec.operators || []; // parse background - - if (spec.background) { - ctx.background = spec.background; - } // parse event configuration - - - if (spec.eventConfig) { - ctx.eventConfig = spec.eventConfig; - } // parse locale configuration - - - if (spec.locale) { - ctx.locale = spec.locale; - } // parse operators - - - operators.forEach(function (entry) { - return ctx.parseOperator(entry); - }); // parse operator parameters - - operators.forEach(function (entry) { - return ctx.parseOperatorParameters(entry); - }); // parse streams - - (spec.streams || []).forEach(function (entry) { - return ctx.parseStream(entry); - }); // parse updates - - (spec.updates || []).forEach(function (entry) { - return ctx.parseUpdate(entry); - }); - return ctx.resolve(); - } - - var Skip = toSet(['rule']), - Swap = toSet(['group', 'image', 'rect']); - - function adjustSpatial(encode, marktype) { - var code = ''; - if (Skip[marktype]) return code; - - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) { - code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - } - - code += 'o.width=o.x2-o.x;'; - } else { - code += 'o.x=o.x2-(o.width||0);'; - } - } - - if (encode.xc) { - code += 'o.x=o.xc-(o.width||0)/2;'; - } - - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) { - code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - } - - code += 'o.height=o.y2-o.y;'; - } else { - code += 'o.y=o.y2-(o.height||0);'; - } - } - - if (encode.yc) { - code += 'o.y=o.yc-(o.height||0)/2;'; - } - - return code; - } - - function canonicalType(type) { - return (type + '').toLowerCase(); - } - - function isOperator(type) { - return canonicalType(type) === 'operator'; - } - - function isCollect(type) { - return canonicalType(type) === 'collect'; - } - - function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (code[code.length - 1] !== ';') { - code = 'return(' + code + ');'; - } - - var fn = Function.apply(null, args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; - } // generate code for comparing a single field - - - function _compare(u, v, lt, gt) { - return "((u = ".concat(u, ") < (v = ").concat(v, ") || u == null) && v != null ? ").concat(lt, "\n : (u > v || v == null) && u != null ? ").concat(gt, "\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(lt, "\n : v !== v && u === u ? ").concat(gt, " : "); - } - - var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ - operator: function operator(ctx, expr) { - return expression(ctx, ['_'], expr.code); - }, - - /** - * Parse an expression provided as an operator parameter value. - */ - parameter: function parameter(ctx, expr) { - return expression(ctx, ['datum', '_'], expr.code); - }, - - /** - * Parse an expression applied to an event stream. - */ - event: function event(ctx, expr) { - return expression(ctx, ['event'], expr.code); - }, - - /** - * Parse an expression used to handle an event-driven operator update. - */ - handler: function handler(ctx, expr) { - var code = "var datum=event.item&&event.item.datum;return ".concat(expr.code, ";"); - return expression(ctx, ['_', 'event'], code); - }, - - /** - * Parse an expression that performs visual encoding. - */ - encode: function encode(ctx, _encode) { - var marktype = _encode.marktype, - channels = _encode.channels; - var code = 'var o=item,datum=o.datum,m=0,$;'; - - for (var name in channels) { - var o = 'o[' + $(name) + ']'; - code += "$=".concat(channels[name].code, ";if(").concat(o, "!==$)").concat(o, "=$,m=1;"); - } - - code += adjustSpatial(channels, marktype); - code += 'return m;'; - return expression(ctx, ['item', '_'], code); - }, - - /** - * Optimized code generators for access and comparison. - */ - codegen: { - get: function get(path) { - var ref = "[".concat(path.map($).join(']['), "]"); - var get = Function('_', "return _".concat(ref, ";")); - get.path = ref; - return get; - }, - comparator: function comparator(fields, orders) { - var t; - - var map = function map(f, i) { - var o = orders[i]; - var u, v; - - if (f.path) { - u = "a".concat(f.path); - v = "b".concat(f.path); - } else { - (t = t || {})['f' + i] = f; - u = "this.f".concat(i, "(a)"); - v = "this.f".concat(i, "(b)"); - } - - return _compare(u, v, -o, o); - }; - - var fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } - }; - /** - * Parse a dataflow operator. - */ - - function parseOperator(spec) { - var ctx = this; - - if (isOperator(spec.type) || !spec.type) { - ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); - } else { - ctx.transform(spec, spec.type); - } - } - /** - * Parse and assign operator parameters. - */ - - - function parseOperatorParameters(spec) { - var ctx = this; - - if (spec.params) { - var op = ctx.get(spec.id); - if (!op) error('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); - } - } - /** - * Parse a set of operator parameters. - */ - - - function parseParameters(spec, params) { - params = params || {}; - var ctx = this; - - for (var _key10 in spec) { - var _value20 = spec[_key10]; - params[_key10] = isArray(_value20) ? _value20.map(function (v) { - return parseParameter(v, ctx, params); - }) : parseParameter(_value20, ctx, params); - } - - return params; - } - /** - * Parse a single parameter. - */ - - - function parseParameter(spec, ctx, params) { - if (!spec || !isObject(spec)) return spec; - - for (var i = 0, n = PARSERS.length, p; i < n; ++i) { - p = PARSERS[i]; - - if (hasOwnProperty(spec, p.key)) { - return p.parse(spec, ctx, params); - } - } - - return spec; - } - /** Reference parsers. */ - - - var PARSERS = [{ - key: '$ref', - parse: getOperator - }, { - key: '$key', - parse: getKey - }, { - key: '$expr', - parse: getExpression - }, { - key: '$field', - parse: getField$1 - }, { - key: '$encode', - parse: getEncode - }, { - key: '$compare', - parse: getCompare - }, { - key: '$context', - parse: getContext - }, { - key: '$subflow', - parse: getSubflow - }, { - key: '$tupleid', - parse: getTupleId - }]; - /** - * Resolve an operator reference. - */ - - function getOperator(_, ctx) { - return ctx.get(_.$ref) || error('Operator not defined: ' + _.$ref); - } - /** - * Resolve an expression reference. - */ - - - function getExpression(_, ctx, params) { - if (_.$params) { - // parse expression parameters - ctx.parseParameters(_.$params, params); - } - - var k = 'e:' + _.$expr.code + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields, _.$name)); - } - /** - * Resolve a key accessor reference. - */ - - - function getKey(_, ctx) { - var k = 'k:' + _.$key + '_' + !!_.$flat; - return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat, ctx.expr.codegen)); - } - /** - * Resolve a field accessor reference. - */ - - - function getField$1(_, ctx) { - if (!_.$field) return null; - var k = 'f:' + _.$field + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name, ctx.expr.codegen)); - } - /** - * Resolve a comparator function reference. - */ - - - function getCompare(_, ctx) { - // As of Vega 5.5.3, $tupleid sort is no longer used. - // Keep here for now for backwards compatibility. - var k = 'c:' + _.$compare + '_' + _.$order, - c = array(_.$compare).map(function (_) { - return _ && _.$tupleid ? tupleid : _; - }); - return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen)); - } - /** - * Resolve an encode operator reference. - */ - - - function getEncode(_, ctx) { - var spec = _.$encode, - encode = {}; - - for (var name in spec) { - var enc = spec[name]; - encode[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - - return encode; - } - /** - * Resolve a context reference. - */ - - - function getContext(_, ctx) { - return ctx; - } - /** - * Resolve a recursive subflow specification. - */ - - - function getSubflow(_, ctx) { - var spec = _.$subflow; - return function (dataflow, key, parent) { - var subctx = ctx.fork().parse(spec), - op = subctx.get(spec.operators[0].id), - p = subctx.signals.parent; - if (p) p.set(parent); - - op.detachSubflow = function () { - return ctx.detach(subctx); - }; - - return op; - }; - } - /** - * Resolve a tuple id reference. - */ - - - function getTupleId() { - return tupleid; - } - /** - * Parse an event stream specification. - */ - - - function parseStream(spec) { - var ctx = this, - filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, - stream = spec.stream != null ? ctx.get(spec.stream) : undefined, - args; - - if (spec.source) { - stream = ctx.events(spec.source, spec.type, filter); - } else if (spec.merge) { - args = spec.merge.map(function (_) { - return ctx.get(_); - }); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - - if (spec.between) { - args = spec.between.map(function (_) { - return ctx.get(_); - }); - stream = stream.between(args[0], args[1]); - } - - if (spec.filter) { - stream = stream.filter(filter); - } - - if (spec.throttle != null) { - stream = stream.throttle(+spec.throttle); - } - - if (spec.debounce != null) { - stream = stream.debounce(+spec.debounce); - } - - if (stream == null) { - error('Invalid stream definition: ' + JSON.stringify(spec)); - } - - if (spec.consume) stream.consume(true); - ctx.stream(spec, stream); - } - /** - * Parse an event-driven operator update. - */ - - - function parseUpdate(spec) { - var ctx = this, - srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid, - source = ctx.get(srcid), - target = null, - update = spec.update, - params = undefined; - if (!source) error('Source not defined: ' + spec.source); - target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); - - if (update && update.$expr) { - if (update.$params) { - params = ctx.parseParameters(update.$params); - } - - update = ctx.handlerExpression(update.$expr); - } - - ctx.update(spec, source, target, update, params); - } - - var SKIP$3 = { - skip: true - }; - - function getState(options) { - var ctx = this, - state = {}; - - if (options.signals) { - var signals = state.signals = {}; - Object.keys(ctx.signals).forEach(function (key) { - var op = ctx.signals[key]; - - if (options.signals(key, op)) { - signals[key] = op.value; - } - }); - } - - if (options.data) { - var data = state.data = {}; - Object.keys(ctx.data).forEach(function (key) { - var dataset = ctx.data[key]; - - if (options.data(key, dataset)) { - data[key] = dataset.input.value; - } - }); - } - - if (ctx.subcontext && options.recurse !== false) { - state.subcontext = ctx.subcontext.map(function (ctx) { - return ctx.getState(options); - }); - } - - return state; - } - - function setState(state) { - var ctx = this, - df = ctx.dataflow, - data = state.data, - signals = state.signals; - Object.keys(signals || {}).forEach(function (key) { - df.update(ctx.signals[key], signals[key], SKIP$3); - }); - Object.keys(data || {}).forEach(function (key) { - df.pulse(ctx.data[key].input, df.changeset().remove(truthy).insert(data[key])); - }); - (state.subcontext || []).forEach(function (substate, i) { - var subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); - } - /** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ - - - function context$2(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); - } - - function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } - } - - function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } - } - - Context.prototype = Subcontext.prototype = { - fork: function fork() { - var ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; - }, - detach: function detach(ctx) { - this.subcontext = this.subcontext.filter(function (c) { - return c !== ctx; - }); // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - - var keys = Object.keys(ctx.nodes); - - for (var _i23 = 0, _keys = keys; _i23 < _keys.length; _i23++) { - var _key11 = _keys[_i23]; - ctx.nodes[_key11]._targets = null; - } - - for (var _i24 = 0, _keys2 = keys; _i24 < _keys2.length; _i24++) { - var _key12 = _keys2[_i24]; - - ctx.nodes[_key12].detach(); - } - - ctx.nodes = null; - }, - get: function get(id) { - return this.nodes[id]; - }, - set: function set(id, node) { - return this.nodes[id] = node; - }, - add: function add(spec, op) { - var ctx = this, - df = ctx.dataflow, - data = spec.value; - ctx.set(spec.id, op); - - if (isCollect(spec.type) && data) { - if (data.$ingest) { - df.ingest(op, data.$ingest, data.$format); - } else if (data.$request) { - df.preload(op, data.$request, data.$format); - } else { - df.pulse(op, df.changeset().insert(data)); - } - } - - if (spec.root) { - ctx.root = op; - } - - if (spec.parent) { - var p = ctx.get(spec.parent.$ref); - - if (p) { - df.connect(p, [op]); - op.targets().add(p); - } else { - (ctx.unresolved = ctx.unresolved || []).push(function () { - p = ctx.get(spec.parent.$ref); - df.connect(p, [op]); - op.targets().add(p); - }); - } - } - - if (spec.signal) { - ctx.signals[spec.signal] = op; - } - - if (spec.scale) { - ctx.scales[spec.scale] = op; - } - - if (spec.data) { - var _loop = function _loop(name) { - var data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach(function (role) { - return data[role] = op; - }); - }; - - for (var name in spec.data) { - _loop(name); - } - } - }, - resolve: function resolve() { - (this.unresolved || []).forEach(function (fn) { - return fn(); - }); - delete this.unresolved; - return this; - }, - operator: function operator(spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); - }, - transform: function transform(spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); - }, - stream: function stream(spec, _stream) { - this.set(spec.id, _stream); - }, - update: function update(spec, stream, target, _update2, params) { - this.dataflow.on(stream, target, _update2, params, spec.options); - }, - // expression parsing - operatorExpression: function operatorExpression(expr) { - return this.expr.operator(this, expr); - }, - parameterExpression: function parameterExpression(expr) { - return this.expr.parameter(this, expr); - }, - eventExpression: function eventExpression(expr) { - return this.expr.event(this, expr); - }, - handlerExpression: function handlerExpression(expr) { - return this.expr.handler(this, expr); - }, - encodeExpression: function encodeExpression(encode) { - return this.expr.encode(this, encode); - }, - // parse methods - parse: parse$4, - parseOperator: parseOperator, - parseOperatorParameters: parseOperatorParameters, - parseParameters: parseParameters, - parseStream: parseStream, - parseUpdate: parseUpdate, - // state methods - getState: getState, - setState: setState - }; - - function runtime(view, spec, expr) { - return context$2(view, transforms, functionContext, expr).parse(spec); - } - - function scale$4(name) { - var scales = this._runtime.scales; - - if (!hasOwnProperty(scales, name)) { - error('Unrecognized scale or projection: ' + name); - } - - return scales[name].value; - } - - var Width = 'width', - Height = 'height', - Padding$1 = 'padding', - Skip$1 = { - skip: true - }; - - function viewWidth(view, width) { - var a = view.autosize(), - p = view.padding(); - return width - (a && a.contains === Padding$1 ? p.left + p.right : 0); - } - - function viewHeight(view, height) { - var a = view.autosize(), - p = view.padding(); - return height - (a && a.contains === Padding$1 ? p.top + p.bottom : 0); - } - - function initializeResize(view) { - var s = view._signals, - w = s[Width], - h = s[Height], - p = s[Padding$1]; - - function resetSize() { - view._autosize = view._resize = 1; - } // respond to width signal - - - view._resizeWidth = view.add(null, function (_) { - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, { - size: w - }); // respond to height signal - - view._resizeHeight = view.add(null, function (_) { - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, { - size: h - }); // respond to padding signal - - var resizePadding = view.add(null, resetSize, { - pad: p - }); // set rank to run immediately after source signal - - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; - } - - function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter(function (view) { - var rerun = 0; // reset autosize flag - - view._autosize = 0; // width value changed: update signal, skip resize op - - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip$1); // set width, skip update calc - - view._resizeWidth.skip(true); // skip width resize handler - - } // height value changed: update signal, skip resize op - - - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip$1); // set height, skip update calc - - view._resizeHeight.skip(true); // skip height resize handler - - } // view width changed: update view property, set resize flag - - - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } // view height changed: update view property, set resize flag - - - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } // origin changed: update view property, set resize flag - - - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } // run dataflow on width/height signal change - - - if (rerun) view.run('enter'); - if (auto) view.runAfter(function (v) { - return v.resize(); - }); - }, false, 1); - } - /** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ - - - function getState$1(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); - } - - function dataTest(name, data) { - return data.modified && isArray(data.input.value) && name.indexOf('_:vega:_'); - } - - function signalTest(name, op) { - return !(name === 'parent' || op instanceof transforms.proxy); - } - /** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ - - - function setState$1(state) { - this.runAsync(null, function (v) { - v._trigger = false; - - v._runtime.setState(state); - }, function (v) { - v._trigger = true; - }); - return this; - } - - function timer(callback, delay) { - function tick(elapsed) { - callback({ - timestamp: Date.now(), - elapsed: elapsed - }); - } - - this._timers.push(d3Timer.interval(tick, delay)); - } - - function defaultTooltip$1(handler, event, item, value) { - var el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); - } - - function formatTooltip(value) { - return value == null ? '' : isArray(value) ? formatArray(value) : isObject(value) && !isDate(value) ? formatObject(value) : value + ''; - } - - function formatObject(obj) { - return Object.keys(obj).map(function (key) { - var v = obj[key]; - return key + ': ' + (isArray(v) ? formatArray(v) : formatValue$1(v)); - }).join('\n'); - } - - function formatArray(value) { - return '[' + value.map(formatValue$1).join(', ') + ']'; - } - - function formatValue$1(value) { - return isArray(value) ? "[\u2026]" : isObject(value) && !isDate(value) ? "{\u2026}" : value; - } - /** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ - - - function View(spec, options) { - var view = this; - options = options || {}; - Dataflow.call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - - if (options.locale || spec.locale) { - var loc = extend({}, spec.locale, options.locale); - view.locale(locale(loc.number, loc.time)); - } - - view._el = null; - view._elBind = null; - view._renderType = options.renderer || RenderType.Canvas; - view._scenegraph = new Scenegraph(); - var root = view._scenegraph.root; // initialize renderer, handler and event management - - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip$1, view._redraw = true; - view._handler = new CanvasHandler().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; // initialize event configuration - - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); // initialize dataflow graph - - var ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map(function (_) { - return { - state: null, - param: extend({}, _) - }; - }); // initialize scenegraph - - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); // initialize view size - - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [0, 0]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); // initialize background color - - background$1(view); // initialize cursor - - cursor(view); // initialize view description - - view.description(spec.description); // initialize hover proessing, if requested - - if (options.hover) view.hover(); // initialize DOM container(s) and renderer - - if (options.container) view.initialize(options.container, options.bind); - } - - var prototype$1s = inherits(View, Dataflow); // -- DATAFLOW / RENDERING ---- - - prototype$1s.evaluate = /*#__PURE__*/function () { - var _ref21 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(encode, prerun, postrun) { - return regeneratorRuntime.wrap(function _callee2$(_context9) { - while (1) { - switch (_context9.prev = _context9.next) { - case 0: - _context9.next = 2; - return Dataflow.prototype.evaluate.call(this, encode, prerun); - - case 2: - if (!(this._redraw || this._resize)) { - _context9.next = 14; - break; - } - - _context9.prev = 3; - - if (!this._renderer) { - _context9.next = 8; - break; - } - - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - - _context9.next = 8; - return this._renderer.renderAsync(this._scenegraph.root); - - case 8: - this._redraw = false; - _context9.next = 14; - break; - - case 11: - _context9.prev = 11; - _context9.t0 = _context9["catch"](3); - this.error(_context9.t0); - - case 14: - // evaluate postrun - if (postrun) asyncCallback(this, postrun); - return _context9.abrupt("return", this); - - case 16: - case "end": - return _context9.stop(); - } - } - }, _callee2, this, [[3, 11]]); - })); - - return function (_x41, _x42, _x43) { - return _ref21.apply(this, arguments); - }; - }(); - - prototype$1s.dirty = function (item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); - }; // -- GET / SET ---- - - - prototype$1s.description = function (text) { - if (arguments.length) { - var desc = text != null ? text + '' : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - - return this._desc; - }; - - prototype$1s.container = function () { - return this._el; - }; - - prototype$1s.scenegraph = function () { - return this._scenegraph; - }; - - prototype$1s.origin = function () { - return this._origin.slice(); - }; - - function lookupSignal(view, name) { - return hasOwnProperty(view._signals, name) ? view._signals[name] : error('Unrecognized signal name: ' + $(name)); - } - - prototype$1s.signal = function (name, value, options) { - var op = lookupSignal(this, name); - return arguments.length === 1 ? op.value : this.update(op, value, options); - }; - - prototype$1s.width = function (_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); - }; - - prototype$1s.height = function (_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); - }; - - prototype$1s.padding = function (_) { - return arguments.length ? this.signal('padding', padding(_)) : padding(this.signal('padding')); - }; - - prototype$1s.autosize = function (_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); - }; - - prototype$1s.background = function (_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); - }; - - prototype$1s.renderer = function (type) { - if (!arguments.length) return this._renderType; - if (!renderModule(type)) error('Unrecognized renderer type: ' + type); - - if (type !== this._renderType) { - this._renderType = type; - - this._resetRenderer(); - } - - return this; - }; - - prototype$1s.tooltip = function (handler) { - if (!arguments.length) return this._tooltip; - - if (handler !== this._tooltip) { - this._tooltip = handler; - - this._resetRenderer(); - } - - return this; - }; - - prototype$1s.loader = function (loader) { - if (!arguments.length) return this._loader; - - if (loader !== this._loader) { - Dataflow.prototype.loader.call(this, loader); - - this._resetRenderer(); - } - - return this; - }; - - prototype$1s.resize = function () { - // set flag to perform autosize - this._autosize = 1; // touch autosize signal to ensure top-level ViewLayout runs - - return this.touch(lookupSignal(this, 'autosize')); - }; - - prototype$1s._resetRenderer = function () { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } - }; // -- SIZING ---- - - - prototype$1s._resizeView = resizeView; // -- EVENT HANDLING ---- - - prototype$1s.addEventListener = function (type, handler, options) { - var callback = handler; - - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - - this._handler.on(type, callback); - - return this; - }; - - prototype$1s.removeEventListener = function (type, handler) { - var handlers = this._handler.handlers(type), - i = handlers.length, - h, - t; // search registered handlers, remove if match found - - - while (--i >= 0) { - t = handlers[i].type; - h = handlers[i].handler; - - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - - break; - } - } - - return this; - }; - - prototype$1s.addResizeListener = function (handler) { - var l = this._resizeListeners; - - if (l.indexOf(handler) < 0) { - // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - } - - return this; - }; - - prototype$1s.removeResizeListener = function (handler) { - var l = this._resizeListeners, - i = l.indexOf(handler); - - if (i >= 0) { - l.splice(i, 1); - } - - return this; - }; - - function findOperatorHandler(op, handler) { - var h = (op._targets || []).filter(function (op) { - return op._update && op._update.handler === handler; - }); - return h.length ? h[0] : null; - } - - function addOperatorListener(view, name, op, handler) { - var h = findOperatorHandler(op, handler); - - if (!h) { - h = trap(view, function () { - return handler(name, op.value); - }); - h.handler = handler; - view.on(op, null, h); - } - - return view; - } - - function removeOperatorListener(view, op, handler) { - var h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; - } - - prototype$1s.addSignalListener = function (name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); - }; - - prototype$1s.removeSignalListener = function (name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); - }; - - prototype$1s.addDataListener = function (name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); - }; - - prototype$1s.removeDataListener = function (name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); - }; - - prototype$1s.globalCursor = function (_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - var prev = setCursor(this, null); // clear previous cursor - - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - - return this; - } else { - return this._globalCursor; - } - }; - - prototype$1s.preventDefault = function (_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else { - return this._preventDefault; - } - }; - - prototype$1s.timer = timer; - prototype$1s.events = events$1; - prototype$1s.finalize = finalize; - prototype$1s.hover = hover; // -- DATA ---- - - prototype$1s.data = data; - prototype$1s.change = change; - prototype$1s.insert = insert; - prototype$1s.remove = remove; // -- SCALES -- - - prototype$1s.scale = scale$4; // -- INITIALIZATION ---- - - prototype$1s.initialize = initialize$1; // -- HEADLESS RENDERING ---- - - prototype$1s.toImageURL = renderToImageURL; - prototype$1s.toCanvas = renderToCanvas; - prototype$1s.toSVG = renderToSVG; // -- SAVE / RESTORE STATE ---- - - prototype$1s.getState = getState$1; - prototype$1s.setState = setState$1; - - function parseAutosize(spec) { - return isObject(spec) ? spec : { - type: spec || 'pad' - }; - } - - var number$6 = function number$6(_) { - return +_ || 0; - }; - - var paddingObject$1 = function paddingObject$1(_) { - return { - top: _, - bottom: _, - left: _, - right: _ - }; - }; - - function parsePadding(spec) { - return !isObject(spec) ? paddingObject$1(number$6(spec)) : spec.signal ? spec : { - top: number$6(spec.top), - bottom: number$6(spec.bottom), - left: number$6(spec.left), - right: number$6(spec.right) - }; - } - - var encoder = function encoder(_) { - return isObject(_) && !isArray(_) ? extend({}, _) : { - value: _ - }; - }; - - function addEncode(object, name, value, set) { - if (value != null) { - // Always assign signal to update, even if the signal is from the enter block - if (isObject(value) && !isArray(value)) { - object.update[name] = value; - } else { - object[set || 'enter'][name] = { - value: value - }; - } - - return 1; - } else { - return 0; - } - } - - function addEncoders(object, enter, update) { - for (var name in enter) { - addEncode(object, name, enter[name]); - } - - for (var _name in update) { - addEncode(object, _name, update[_name], 'update'); - } - } - - function extendEncode(encode, extra, skip) { - for (var name in extra) { - if (skip && hasOwnProperty(skip, name)) continue; - encode[name] = extend(encode[name] || {}, extra[name]); - } - - return encode; - } - - function has(key, encode) { - return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]); - } - - var MarkRole = 'mark'; - var FrameRole$1 = 'frame'; - var ScopeRole$1 = 'scope'; - var AxisRole$1 = 'axis'; - var AxisDomainRole = 'axis-domain'; - var AxisGridRole = 'axis-grid'; - var AxisLabelRole = 'axis-label'; - var AxisTickRole = 'axis-tick'; - var AxisTitleRole = 'axis-title'; - var LegendRole$1 = 'legend'; - var LegendBandRole = 'legend-band'; - var LegendEntryRole = 'legend-entry'; - var LegendGradientRole = 'legend-gradient'; - var LegendLabelRole = 'legend-label'; - var LegendSymbolRole = 'legend-symbol'; - var LegendTitleRole = 'legend-title'; - var TitleRole$1 = 'title'; - var TitleTextRole = 'title-text'; - var TitleSubtitleRole = 'title-subtitle'; - - function applyDefaults(encode, type, role, style, config) { - var defaults = {}, - enter = {}; - var update, key, skip, props; // if text mark, apply global lineBreak settings (#2370) - - key = 'lineBreak'; - - if (type === 'text' && config[key] != null && !has(key, encode)) { - applyDefault(defaults, key, config[key]); - } // ignore legend and axis roles - - - if (role == 'legend' || String(role).startsWith('axis')) { - role = null; - } // resolve mark config - - - props = role === FrameRole$1 ? config.group : role === MarkRole ? extend({}, config.mark, config[type]) : null; - - for (key in props) { - // do not apply defaults if relevant fields are defined - skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode)); - if (!skip) applyDefault(defaults, key, props[key]); - } // resolve styles, apply with increasing precedence - - - array(style).forEach(function (name) { - var props = config.style && config.style[name]; - - for (var _key13 in props) { - if (!has(_key13, encode)) { - applyDefault(defaults, _key13, props[_key13]); - } - } - }); - encode = extend({}, encode); // defensive copy - - for (key in defaults) { - props = defaults[key]; - - if (props.signal) { - (update = update || {})[key] = props; - } else { - enter[key] = props; - } - } - - encode.enter = extend(enter, encode.enter); - if (update) encode.update = extend(update, encode.update); - return encode; - } - - function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal ? { - signal: value.signal - } : { - value: value - }; - } - - var scaleRef = function scaleRef(scale) { - return isString(scale) ? $(scale) : scale.signal ? "(".concat(scale.signal, ")") : field$1(scale); - }; - - function entry(enc) { - if (enc.gradient != null) { - return gradient$1(enc); - } - - var value = enc.signal ? "(".concat(enc.signal, ")") : enc.color ? color$1(enc.color) : enc.field != null ? field$1(enc.field) : enc.value !== undefined ? $(enc.value) : undefined; - - if (enc.scale != null) { - value = scale$5(enc, value); - } - - if (value === undefined) { - value = null; - } - - if (enc.exponent != null) { - value = "pow(".concat(value, ",").concat(property(enc.exponent), ")"); - } - - if (enc.mult != null) { - value += "*".concat(property(enc.mult)); - } - - if (enc.offset != null) { - value += "+".concat(property(enc.offset)); - } - - if (enc.round) { - value = "round(".concat(value, ")"); - } - - return value; - } - - var _color = function _color(type, x, y, z) { - return "(".concat(type, "(").concat([x, y, z].map(entry).join(','), ")+'')"); - }; - - function color$1(enc) { - return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null; - } - - function gradient$1(enc) { - // map undefined to null; expression lang does not allow undefined - var args = [enc.start, enc.stop, enc.count].map(function (_) { - return _ == null ? null : $(_); - }); // trim null inputs from the end - - while (args.length && peek(args) == null) { - args.pop(); - } - - args.unshift(scaleRef(enc.gradient)); - return "gradient(".concat(args.join(','), ")"); - } - - function property(property) { - return isObject(property) ? '(' + entry(property) + ')' : property; - } - - function field$1(ref) { - return resolveField(isObject(ref) ? ref : { - datum: ref - }); - } - - function resolveField(ref) { - var object, level, field; - - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - - while (level-- > 0) { - object += '.mark.group'; - } - - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else { - field = ref.group; - } - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else { - error('Invalid field reference: ' + $(ref)); - } - - if (!ref.signal) { - field = isString(field) ? splitAccessPath(field).map($).join('][') : resolveField(field); - } - - return object + '[' + field + ']'; - } - - function scale$5(enc, value) { - var scale = scaleRef(enc.scale); - - if (enc.range != null) { - // pull value from scale range - value = "lerp(_range(".concat(scale, "), ").concat(+enc.range, ")"); - } else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = "_scale(".concat(scale, ", ").concat(value, ")"); - - if (enc.band) { - value = (value ? value + '+' : '') + "_bandwidth(".concat(scale, ")") + (+enc.band === 1 ? '' : '*' + property(enc.band)); - - if (enc.extra) { - // include logic to handle extraneous elements - value = "(datum.extra ? _scale(".concat(scale, ", datum.extra.value) : ").concat(value, ")"); - } - } - - if (value == null) value = '0'; - } - - return value; - } - - function rule$1(enc) { - var code = ''; - enc.forEach(function (rule) { - var value = entry(rule); - code += rule.test ? "(".concat(rule.test, ")?").concat(value, ":") : value; - }); // if no else clause, terminate with null (#1366) - - if (peek(code) === ':') { - code += 'null'; - } - - return code; - } - - function parseEncode(encode, type, role, style, scope, params) { - var enc = {}; - params = params || {}; - params.encoders = { - $encode: enc - }; - encode = applyDefaults(encode, type, role, style, scope.config); - - for (var _key14 in encode) { - enc[_key14] = parseBlock(encode[_key14], type, params, scope); - } - - return params; - } - - function parseBlock(block, marktype, params, scope) { - var channels = {}, - fields = {}; - - for (var name in block) { - if (block[name] != null) { - // skip any null entries - channels[name] = parse$5(expr(block[name]), scope, params, fields); - } - } - - return { - $expr: { - marktype: marktype, - channels: channels - }, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; - } - - function expr(enc) { - return isArray(enc) ? rule$1(enc) : entry(enc); - } - - function parse$5(code, scope, params, fields) { - var expr = parseExpression$1(code, scope); - expr.$fields.forEach(function (name) { - return fields[name] = 1; - }); - extend(params, expr.$params); - return expr.$expr; - } - - var OUTER = 'outer', - OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind']; - - function outerError(prefix, name) { - error(prefix + ' for "outer" push: ' + $(name)); - } - - function parseSignal(signal, scope) { - var name = signal.name; - - if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); // signal push must not use properties reserved for standard definition - - OUTER_INVALID.forEach(function (prop) { - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); - } else { - // define a new signal in the current scope - var op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); - } - } - - function Entry(type, value, params, parent) { - this.id = -1; - this.type = type; - this.value = value; - this.params = params; - if (parent) this.parent = parent; - } - - function entry$1(type, value, params, parent) { - return new Entry(type, value, params, parent); - } - - function operator(value, params) { - return entry$1('operator', value, params); - } // ----- - - - function ref(op) { - var ref = { - $ref: op.id - }; // if operator not yet registered, cache ref to resolve later - - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; - } - - function fieldRef(field, name) { - return name ? { - $field: field, - $name: name - } : { - $field: field - }; - } - - var keyFieldRef = fieldRef('key'); - - function compareRef(fields, orders) { - return { - $compare: fields, - $order: orders - }; - } - - function keyRef(fields, flat) { - var ref = { - $key: fields - }; - if (flat) ref.$flat = true; - return ref; - } // ----- - - - var Ascending = 'ascending'; - var Descending = 'descending'; - - function sortKey(sort) { - return !isObject(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field); - } - - function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || ''); - } // ----- - - - var Scope = 'scope'; - var View$1 = 'view'; - - function isSignal(_) { - return _ && _.signal; - } - - function isExpr(_) { - return _ && _.expr; - } - - function hasSignal(_) { - if (isSignal(_)) return true; - if (isObject(_)) for (var key in _) { - if (hasSignal(_[key])) return true; - } - return false; - } - - function value$2(specValue, defaultValue) { - return specValue != null ? specValue : defaultValue; - } - - function deref(v) { - return v && v.signal || v; - } - - var Timer = 'timer'; - - function parseStream$1(stream, scope) { - var method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : error('Invalid stream specification: ' + $(stream)); - return method(stream, scope); - } - - function eventSource(source) { - return source === Scope ? View$1 : source || View$1; - } - - function mergeStream(stream, scope) { - var list = stream.merge.map(function (s) { - return parseStream$1(s, scope); - }), - entry = streamParameters({ - merge: list - }, stream, scope); - return scope.addStream(entry).id; - } - - function nestedStream(stream, scope) { - var id = parseStream$1(stream.stream, scope), - entry = streamParameters({ - stream: id - }, stream, scope); - return scope.addStream(entry).id; - } - - function eventStream(stream, scope) { - var id, entry; - - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = { - between: stream.between, - filter: stream.filter - }; - } else { - id = scope.event(eventSource(stream.source), stream.type); - } - - entry = streamParameters({ - stream: id - }, stream, scope); - return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id; - } - - function streamParameters(entry, stream, scope) { - var param = stream.between; - - if (param) { - if (param.length !== 2) { - error('Stream "between" parameter must have 2 entries: ' + $(stream)); - } - - entry.between = [parseStream$1(param[0], scope), parseStream$1(param[1], scope)]; - } - - param = stream.filter ? [].concat(stream.filter) : []; - - if (stream.marktype || stream.markname || stream.markrole) { - // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - } - - if (stream.source === Scope) { - // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - } - - if (param.length) { - entry.filter = parseExpression$1('(' + param.join(')&&(') + ')', scope).$expr; - } - - if ((param = stream.throttle) != null) { - entry.throttle = +param; - } - - if ((param = stream.debounce) != null) { - entry.debounce = +param; - } - - if (stream.consume) { - entry.consume = true; - } - - return entry; - } - - function filterMark(type, name, role) { - var item = 'event.item'; - return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); - } - /** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ - - - function selector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW$1; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); - } - - var VIEW$1 = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL$1 = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - - function isMarkType(type) { - return MARKS[type]; - } - - function find$1(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - - for (; i < n; ++i) { - c = s[i]; - if (!count && c === endChar) return i;else if (popChar && popChar.indexOf(c) >= 0) --count;else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - - return i; - } - - function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find$1(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - - return output; - } - - function parseSelector(s) { - return s[0] === '[' ? parseBetween(s) : parseStream$2(s); - } - - function parseBetween(s) { - var n = s.length, - i = 1, - b, - stream; - i = find$1(s, i, RBRACK, LBRACK, RBRACK); - - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector); - stream = parseSelector(s.slice(1).trim()); - - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; - } - - function parseStream$2(s) { - var stream = { - source: DEFAULT_SOURCE - }, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, - j, - filter; // extract throttle from end - - if (s[n - 1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i + 1, n - 1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - - i = 0; - } - - if (!n) throw s; // set name flag based on first char - - if (s[0] === NAME) markname = ++i; // extract first part of multi-part stream selector - - j = find$1(s, i, COLON); - - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } // extract remaining part of stream selector - - - i = find$1(s, i, LBRACK); - - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } // extract filters - - - while (i < n) { - i = find$1(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } // marshall event stream specification - - - if (!(n = source.length) || ILLEGAL$1.test(source[n - 1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - return stream; - } - - function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function (_) { - var x = +_; - if (x !== x) throw s; - return x; - }); - } // bypass expression parser for internal operator references - - - var OP_VALUE_EXPR = { - code: '_.$value', - ast: { - type: 'Identifier', - value: 'value' - } - }; - - function parseUpdate$1(spec, scope, target) { - var events = spec.events, - update = spec.update, - encode = spec.encode, - sources = [], - entry = { - target: target - }; - - if (!events) { - error('Signal update missing events specification.'); - } // interpret as an event selector string - - - if (isString(events)) { - events = selector(events, scope.isSubscope() ? Scope : View$1); - } // separate event streams from signal updates - - - events = array(events).filter(function (s) { - return s.signal || s.scale ? (sources.push(s), 0) : 1; - }); // merge internal operator listeners - - if (sources.length > 1) { - sources = [mergeSources(sources)]; - } // merge event streams, include as source - - - if (events.length) { - sources.push(events.length > 1 ? { - merge: events - } : events[0]); - } - - if (encode != null) { - if (update) error('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + $(encode) + ')'; - } // resolve update value - - - entry.update = isString(update) ? parseExpression$1(update, scope) : update.expr != null ? parseExpression$1(update.expr, scope) : update.value != null ? update.value : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: { - $value: scope.signalRef(update.signal) - } - } : error('Invalid signal update specification.'); - - if (spec.force) { - entry.options = { - force: true - }; - } - - sources.forEach(function (source) { - scope.addUpdate(extend(streamSource(source, scope), entry)); - }); - } - - function streamSource(stream, scope) { - return { - source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream$1(stream, scope) - }; - } - - function mergeSources(sources) { - return { - signal: '[' + sources.map(function (s) { - return s.scale ? 'scale("' + s.scale + '")' : s.signal; - }) + ']' - }; - } - - function parseSignalUpdates(signal, scope) { - var op = scope.getSignal(signal.name), - expr = signal.update; - - if (signal.init) { - if (expr) { - error('Signals can not include both init and update expressions.'); - } else { - expr = signal.init; - op.initonly = true; - } - } - - if (expr) { - expr = parseExpression$1(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - if (signal.on) { - signal.on.forEach(function (_) { - parseUpdate$1(_, scope, op.id); - }); - } - } - - var transform$2 = function transform$2(name) { - return function (params, value, parent) { - return entry$1(name, value, params || undefined, parent); - }; - }; - - var Aggregate$1 = transform$2('aggregate'); - var AxisTicks$1 = transform$2('axisticks'); - var Bound$1 = transform$2('bound'); - var Collect$1 = transform$2('collect'); - var Compare$1 = transform$2('compare'); - var DataJoin$1 = transform$2('datajoin'); - var Encode$1 = transform$2('encode'); - var Expression$1 = transform$2('expression'); - var Facet$1 = transform$2('facet'); - var Field$1 = transform$2('field'); - var Key$1 = transform$2('key'); - var LegendEntries$1 = transform$2('legendentries'); - var Load$1 = transform$2('load'); - var Mark$1 = transform$2('mark'); - var MultiExtent$1 = transform$2('multiextent'); - var MultiValues$1 = transform$2('multivalues'); - var Overlap$1 = transform$2('overlap'); - var Params$2 = transform$2('params'); - var PreFacet$1 = transform$2('prefacet'); - var Projection$1 = transform$2('projection'); - var Proxy$1 = transform$2('proxy'); - var Relay$1 = transform$2('relay'); - var Render$1 = transform$2('render'); - var Scale$1 = transform$2('scale'); - var Sieve$1 = transform$2('sieve'); - var SortItems$1 = transform$2('sortitems'); - var ViewLayout$1 = transform$2('viewlayout'); - var Values$1 = transform$2('values'); - var FIELD_REF_ID = 0; - var MULTIDOMAIN_SORT_OPS = { - min: 'min', - max: 'max', - count: 'sum' - }; - - function initScale(spec, scope) { - var type = spec.type || 'linear'; - - if (!isValidScaleType(type)) { - error('Unrecognized scale type: ' + $(type)); - } - - scope.addScale(spec.name, { - type: type, - domain: undefined - }); - } - - function parseScale(spec, scope) { - var params = scope.getScale(spec.name).params, - key; - params.domain = parseScaleDomain(spec.domain, spec, scope); - - if (spec.range != null) { - params.range = parseScaleRange(spec, scope, params); - } - - if (spec.interpolate != null) { - parseScaleInterpolate(spec.interpolate, params); - } - - if (spec.nice != null) { - params.nice = parseScaleNice(spec.nice); - } - - if (spec.bins != null) { - params.bins = parseScaleBins(spec.bins, scope); - } - - for (key in spec) { - if (hasOwnProperty(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } - } - - function parseLiteral(v, scope) { - return !isObject(v) ? v : v.signal ? scope.signalRef(v.signal) : error('Unsupported object: ' + $(v)); - } - - function parseArray(v, scope) { - return v.signal ? scope.signalRef(v.signal) : v.map(function (v) { - return parseLiteral(v, scope); - }); - } - - function dataLookupError(name) { - error('Can not find data set: ' + $(name)); - } // -- SCALE DOMAIN ---- - - - function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) { - error('No scale domain defined for domainMin/domainMax to override.'); - } - - return; // default domain - } - - return domain.signal ? scope.signalRef(domain.signal) : (isArray(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope); - } - - function explicitDomain(domain, spec, scope) { - return domain.map(function (v) { - return parseLiteral(v, scope); - }); - } - - function singularDomain(domain, spec, scope) { - var data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - return isDiscrete(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : isQuantile(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field); - } - - function multipleDomain(domain, spec, scope) { - var data = domain.data, - fields = domain.fields.reduce(function (dom, d) { - d = isString(d) ? { - data: data, - field: d - } : isArray(d) || d.signal ? fieldRef$1(d, scope) : d; - dom.push(d); - return dom; - }, []); - return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields); - } - - function fieldRef$1(data, scope) { - var name = '_:vega:_' + FIELD_REF_ID++, - coll = Collect$1({}); - - if (isArray(data)) { - coll.value = { - $ingest: data - }; - } else if (data.signal) { - var code = 'setdata(' + $(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - - scope.addDataPipeline(name, [coll, Sieve$1({})]); - return { - data: name, - field: 'data' - }; - } - - function ordinalMultipleDomain(domain, scope, fields) { - var sort = parseSort(domain.sort, true), - counts, - p, - a, - c, - v; // get value counts for each domain field - - counts = fields.map(function (f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); - }); // aggregate the results from each domain field - - p = { - groupby: keyFieldRef, - pulse: counts - }; - - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [MULTIDOMAIN_SORT_OPS[a]]; - p.fields = [scope.fieldRef(v)]; - p.as = [v]; - } - - a = scope.add(Aggregate$1(p)); // collect aggregate output - - c = scope.add(Collect$1({ - pulse: ref(a) - })); // extract values for combined domain - - v = scope.add(Values$1({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) - })); - return ref(v); - } - - function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if (isObject(sort)) sort.field = 'key';else sort = { - field: 'key' - }; - } else if (!sort.field && sort.op !== 'count') { - error('No field provided for sort aggregate op: ' + sort.op); - } else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) { - error('Multiple domain scales can not be sorted using ' + sort.op); - } - } - } - - return sort; - } - - function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - var values = fields.map(function (f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); - }); // combine value arrays - - return ref(scope.add(MultiValues$1({ - values: values - }))); - } - - function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - var extents = fields.map(function (f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); - }); // combine extents - - return ref(scope.add(MultiExtent$1({ - extents: extents - }))); - } // -- SCALE BINS ----- - - - function parseScaleBins(v, scope) { - return v.signal || isArray(v) ? parseArray(v, scope) : scope.objectProperty(v); - } // -- SCALE NICE ----- - - - function parseScaleNice(nice) { - return isObject(nice) ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } : parseLiteral(nice); - } // -- SCALE INTERPOLATION ----- - - - function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - - if (interpolate.gamma != null) { - params.interpolateGamma = parseLiteral(interpolate.gamma); - } - } // -- SCALE RANGE ----- - - - function parseScaleRange(spec, scope, params) { - var range = spec.range, - config = scope.config.range; - - if (range.signal) { - return scope.signalRef(range.signal); - } else if (isString(range)) { - if (config && hasOwnProperty(config, range)) { - spec = extend({}, spec, { - range: config[range] - }); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') { - range = [0, { - signal: 'width' - }]; - } else if (range === 'height') { - range = isDiscrete(spec.type) ? [0, { - signal: 'height' - }] : [{ - signal: 'height' - }, 0]; - } else { - error('Unrecognized scale range value: ' + $(range)); - } - } else if (range.scheme) { - params.scheme = isArray(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if (isDiscrete(spec.type) && !isArray(range)) { - return parseScaleDomain(range, spec, scope); - } else if (!isArray(range)) { - error('Unsupported range type: ' + $(range)); - } - - return range.map(function (v) { - return (isArray(v) ? parseArray : parseLiteral)(v, scope); - }); - } - - function parseProjection(proj, scope) { - var config = scope.config.projection || {}, - params = {}; - - for (var name in proj) { - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } // apply projection defaults from config - - - for (name in config) { - if (params[name] == null) { - params[name] = parseParameter$1(config[name], name, scope); - } - } - - scope.addProjection(proj.name, params); - } - - function parseParameter$1(_, name, scope) { - return isArray(_) ? _.map(function (_) { - return parseParameter$1(_, name, scope); - }) : !isObject(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : error('Unsupported parameter object: ' + $(_)); - } - - var Top$1 = 'top'; - var Left$1 = 'left'; - var Right$1 = 'right'; - var Bottom$1 = 'bottom'; - var Center$1 = 'center'; - var Vertical = 'vertical'; - var Start$1 = 'start'; - var Middle$1 = 'middle'; - var End$1 = 'end'; - var Index = 'index'; - var Label = 'label'; - var Offset = 'offset'; - var Perc = 'perc'; - var Perc2 = 'perc2'; - var Value = 'value'; - var GuideLabelStyle = 'guide-label'; - var GuideTitleStyle = 'guide-title'; - var GroupTitleStyle = 'group-title'; - var GroupSubtitleStyle = 'group-subtitle'; - var Symbols$1 = 'symbol'; - var Gradient$1 = 'gradient'; - var Discrete$1 = 'discrete'; - var Size = 'size'; - var Shape = 'shape'; - var Fill = 'fill'; - var Stroke = 'stroke'; - var StrokeWidth = 'strokeWidth'; - var StrokeDash = 'strokeDash'; - var Opacity = 'opacity'; // Encoding channels supported by legends - // In priority order of 'canonical' scale - - var LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity]; - var Skip$2 = { - name: 1, - style: 1, - interactive: 1 - }; - var zero$1 = { - value: 0 - }; - var one$1 = { - value: 1 - }; - var GroupMark = 'group'; - var RectMark = 'rect'; - var RuleMark = 'rule'; - var SymbolMark = 'symbol'; - var TextMark = 'text'; - - function guideGroup(mark) { - mark.type = GroupMark; - mark.interactive = mark.interactive || false; - return mark; - } - - function lookup$5(spec, config) { - var _ = function _(name, dflt) { - return value$2(spec[name], value$2(config[name], dflt)); - }; - - _.isVertical = function (s) { - return Vertical === value$2(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection)); - }; - - _.gradientLength = function () { - return value$2(spec.gradientLength, config.gradientLength || config.gradientWidth); - }; - - _.gradientThickness = function () { - return value$2(spec.gradientThickness, config.gradientThickness || config.gradientHeight); - }; - - _.entryColumns = function () { - return value$2(spec.columns, value$2(config.columns, +_.isVertical(true))); - }; - - return _; - } - - function getEncoding(name, encode) { - var v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]); - return v && v.signal ? v : v ? v.value : null; - } - - function getStyle(name, scope, style) { - var s = scope.config.style[style]; - return s && s[name]; - } - - function anchorExpr(s, e, m) { - return "item.anchor === '".concat(Start$1, "' ? ").concat(s, " : item.anchor === '").concat(End$1, "' ? ").concat(e, " : ").concat(m); - } - - var alignExpr = anchorExpr($(Left$1), $(Right$1), $(Center$1)); - - function tickBand(_) { - var v = _('tickBand'), - offset = _('tickOffset'), - band, - extra; - - if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); - } else if (v.signal) { - // if signal, augment code to interpret values - band = { - signal: "(".concat(v.signal, ") === 'extent' ? 1 : 0.5") - }; - extra = { - signal: "(".concat(v.signal, ") === 'extent'") - }; - - if (!isObject(offset)) { - offset = { - signal: "(".concat(v.signal, ") === 'extent' ? 0 : ").concat(offset) - }; - } - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; - } else { - band = 0.5; - extra = false; - } - - return { - extra: extra, - band: band, - offset: offset - }; - } - - function extendOffset(value, offset) { - return !offset ? value : !value ? offset : !isObject(value) ? { - value: value, - offset: offset - } : Object.assign({}, value, { - offset: extendOffset(value.offset, offset) - }); - } - - function guideMark(mark, extras) { - if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip$2); - } else { - mark.interactive = false; - } - - return mark; - } - - function legendGradient(spec, scale, config, userEncode) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, - enter, - start, - stop, - width, - height; - - if (vertical) { - start = [0, 1]; - stop = [0, 0]; - width = thickness; - height = length; - } else { - start = [0, 0]; - stop = [1, 0]; - width = length; - height = thickness; - } - - encode = { - enter: enter = { - opacity: zero$1, - x: zero$1, - y: zero$1, - width: encoder(width), - height: encoder(height) - }, - update: extend({}, enter, { - opacity: one$1, - fill: { - gradient: scale, - start: start, - stop: stop - } - }), - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { - // update - opacity: _('gradientOpacity') - }); - return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode: encode - }, userEncode); - } - - function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, - enter, - u, - v, - uu, - vv, - adjust = ''; - - vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); - enter = { - opacity: zero$1, - fill: { - scale: scale, - field: Value - } - }; - enter[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = zero$1; - enter[uu] = { - signal: adjust + 'datum.' + Perc2, - mult: length - }; - enter[vv] = encoder(thickness); - encode = { - enter: enter, - update: extend({}, enter, { - opacity: one$1 - }), - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { - // update - opacity: _('gradientOpacity') - }); - return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode: encode - }, userEncode); - } - - var alignExpr$1 = "datum.".concat(Perc, "<=0?\"").concat(Left$1, "\":datum.").concat(Perc, ">=1?\"").concat(Right$1, "\":\"").concat(Center$1, "\""), - baselineExpr = "datum.".concat(Perc, "<=0?\"").concat(Bottom$1, "\":datum.").concat(Perc, ">=1?\"").concat(Top$1, "\":\"").concat(Middle$1, "\""); - - function legendGradientLabels(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = encoder(_.gradientThickness()), - length = _.gradientLength(), - overlap = _('labelOverlap'), - encode, - enter, - update, - u, - v, - adjust = ''; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1, - text: { - field: Label - } - }, - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value$2(spec.labelLimit, config.gradientLabelLimit) - }); - - if (vertical) { - enter.align = { - value: 'left' - }; - enter.baseline = update.baseline = { - signal: baselineExpr - }; - u = 'y'; - v = 'x'; - adjust = '1-'; - } else { - enter.align = update.align = { - signal: alignExpr$1 - }; - enter.baseline = { - value: 'top' - }; - u = 'x'; - v = 'y'; - } - - enter[u] = update[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = update[v] = thickness; - thickness.offset = value$2(spec.labelOffset, config.gradientLabelOffset) || 0; - overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; // type, role, style, key, dataRef, encode, extras - - return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode: encode, - overlap: overlap - }, userEncode); - } // userEncode is top-level, includes entries, symbols, labels - - - function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - var _ = lookup$5(spec, config), - entries = userEncode.entries, - interactive = !!(entries && entries.interactive), - name = entries ? entries.name : undefined, - height = _('clipHeight'), - symbolOffset = _('symbolOffset'), - valueRef = { - data: 'value' - }, - encode = {}, - xSignal = "(".concat(columns, ") ? datum.").concat(Offset, " : datum.").concat(Size), - yEncode = height ? encoder(height) : { - field: Size - }, - index = "datum.".concat(Index), - ncols = "max(1, ".concat(columns, ")"), - enter, - update, - labelOffset, - symbols, - labels, - nrows, - sort; - - yEncode.mult = 0.5; // -- LEGEND SYMBOLS -- - - encode = { - enter: enter = { - opacity: zero$1, - x: { - signal: xSignal, - mult: 0.5, - offset: symbolOffset - }, - y: yEncode - }, - update: update = { - opacity: one$1, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$1 - } - }; - var baseFill = null, - baseStroke = null; - - if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') - }, { - // update - opacity: _('symbolOpacity') - }); - LegendScales.forEach(function (scale) { - if (spec[scale]) { - update[scale] = enter[scale] = { - scale: spec[scale], - field: Value - }; - } - }); - symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode: encode - }, userEncode.symbols); // -- LEGEND LABELS -- - - labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - encode = { - enter: enter = { - opacity: zero$1, - x: { - signal: xSignal, - offset: labelOffset - }, - y: yEncode - }, - update: update = { - opacity: one$1, - text: { - field: Label - }, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') - }); - labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode: encode - }, userEncode.labels); // -- LEGEND ENTRY GROUPS -- - - encode = { - enter: { - noBound: { - value: !height - }, - // ignore width/height in bounds calc - width: zero$1, - height: height ? encoder(height) : zero$1, - opacity: zero$1 - }, - exit: { - opacity: zero$1 - }, - update: update = { - opacity: one$1, - row: { - signal: null - }, - column: { - signal: null - } - } - }; // annotate and sort groups to ensure correct ordering - - if (_.isVertical(true)) { - nrows = "ceil(item.mark.items.length / ".concat(ncols, ")"); - update.row.signal = "".concat(index, "%").concat(nrows); - update.column.signal = "floor(".concat(index, " / ").concat(nrows, ")"); - sort = { - field: ['row', index] - }; - } else { - update.row.signal = "floor(".concat(index, " / ").concat(ncols, ")"); - update.column.signal = "".concat(index, " % ").concat(ncols); - sort = { - field: index - }; - } // handle zero column case (implies infinite columns) - - - update.column.signal = "(".concat(columns, ")?").concat(update.column.signal, ":").concat(index); // facet legend entries into sub-groups - - dataRef = { - facet: { - data: dataRef, - name: 'value', - groupby: Index - } - }; - return guideGroup({ - role: ScopeRole$1, - from: dataRef, - encode: extendEncode(encode, entries, Skip$2), - marks: [symbols, labels], - name: name, - interactive: interactive, - sort: sort - }); - } - - function legendSymbolLayout(spec, config) { - var _ = lookup$5(spec, config); // layout parameters for legend entries - - - return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } - }; - } // expression logic for align, anchor, angle, and baseline calculation - - - var isL = 'item.orient === "left"', - isR = 'item.orient === "right"', - isLR = "(".concat(isL, " || ").concat(isR, ")"), - isVG = "datum.vgrad && ".concat(isLR), - baseline = anchorExpr('"top"', '"bottom"', '"middle"'), - alignFlip = anchorExpr('"right"', '"left"', '"center"'), - exprAlign = "datum.vgrad && ".concat(isR, " ? (").concat(alignFlip, ") : (").concat(isLR, " && !(datum.vgrad && ").concat(isL, ")) ? \"left\" : ").concat(alignExpr), - exprAnchor = "item._anchor || (".concat(isLR, " ? \"middle\" : \"start\")"), - exprAngle = "".concat(isVG, " ? (").concat(isL, " ? -90 : 90) : 0"), - exprBaseline = "".concat(isLR, " ? (datum.vgrad ? (").concat(isR, " ? \"bottom\" : \"top\") : ").concat(baseline, ") : \"top\""); - - function legendTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - encode; - - encode = { - enter: { - opacity: zero$1 - }, - update: { - opacity: one$1, - x: { - field: { - group: 'padding' - } - }, - y: { - field: { - group: 'padding' - } - } - }, - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: { - signal: exprAnchor - }, - angle: { - signal: exprAngle - }, - align: { - signal: exprAlign - }, - baseline: { - signal: exprBaseline - }, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { - // require update - align: _('titleAlign'), - baseline: _('titleBaseline') - }); - return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode: encode - }, userEncode); - } - - function clip$2(clip, scope) { - var expr; - - if (isObject(clip)) { - if (clip.signal) { - expr = clip.signal; - } else if (clip.path) { - expr = 'pathShape(' + param(clip.path) + ')'; - } else if (clip.sphere) { - expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - } - - return expr ? scope.signalRef(expr) : !!clip; - } - - function param(value) { - return isObject(value) && value.signal ? value.signal : $(value); - } - - function getRole(spec) { - var role = spec.role || ''; - return !role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title') ? role : spec.type === GroupMark ? ScopeRole$1 : role || MarkRole; - } - - function definition$1(spec) { - return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; - } - - function interactive(spec, scope) { - return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true; - } - /** - * Parse a data transform specification. - */ - - - function parseTransform(spec, scope) { - var def = definition(spec.type); - if (!def) error('Unrecognized transform type: ' + $(spec.type)); - var t = entry$1(def.type.toLowerCase(), null, parseParameters$1(def, spec, scope)); - if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; - return t; - } - /** - * Parse all parameters of a data transform. - */ - - - function parseParameters$1(def, spec, scope) { - var params = {}, - pdef, - i, - n; - - for (i = 0, n = def.params.length; i < n; ++i) { - pdef = def.params[i]; - params[pdef.name] = parseParameter$2(pdef, spec, scope); - } - - return params; - } - /** - * Parse a data transform parameter. - */ - - - function parseParameter$2(def, spec, scope) { - var type = def.type, - value = spec[def.name]; - - if (type === 'index') { - return parseIndexParameter(def, spec, scope); - } else if (value === undefined) { - if (def.required) { - error('Missing required ' + $(spec.type) + ' parameter: ' + $(def.name)); - } - - return; - } else if (type === 'param') { - return parseSubParameters(def, spec, scope); - } else if (type === 'projection') { - return scope.projectionRef(spec[def.name]); - } - - return def.array && !isSignal(value) ? value.map(function (v) { - return parameterValue(def, v, scope); - }) : parameterValue(def, value, scope); - } - /** - * Parse a single parameter value. - */ - - - function parameterValue(def, value, scope) { - var type = def.type; - - if (isSignal(value)) { - return isExpr$1(type) ? error('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal); - } else { - var expr = def.expr || isField(type); - return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef(value.field, value.as) : isExpr$1(type) ? parseExpression$1(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef(value) : isCompare(type) ? scope.compareRef(value) : value; - } - } - /** - * Parse parameter for accessing an index of another data set. - */ - - - function parseIndexParameter(def, spec, scope) { - if (!isString(spec.from)) { - error('Lookup "from" parameter must be a string literal.'); - } - - return scope.getData(spec.from).lookupRef(scope, spec.key); - } - /** - * Parse a parameter that contains one or more sub-parameter objects. - */ - - - function parseSubParameters(def, spec, scope) { - var value = spec[def.name]; - - if (def.array) { - if (!isArray(value)) { - // signals not allowed! - error('Expected an array of sub-parameters. Instead: ' + $(value)); - } - - return value.map(function (v) { - return parseSubParameter(def, v, scope); - }); - } else { - return parseSubParameter(def, value, scope); - } - } - /** - * Parse a sub-parameter object. - */ - - - function parseSubParameter(def, value, scope) { - var params, pdef, k, i, n; // loop over defs to find matching key - - for (i = 0, n = def.params.length; i < n; ++i) { - pdef = def.params[i]; - - for (k in pdef.key) { - if (pdef.key[k] !== value[k]) { - pdef = null; - break; - } - } - - if (pdef) break; - } // raise error if matching key not found - - - if (!pdef) error('Unsupported parameter: ' + $(value)); // parse params, create Params transform, return ref - - params = extend(parseParameters$1(pdef, value, scope), pdef.key); - return ref(scope.add(Params$2(params))); - } // -- Utilities ----- - - - function outerExpr(_) { - return _ && _.expr; - } - - function outerField(_) { - return _ && _.field; - } - - function isData(_) { - return _ === 'data'; - } - - function isExpr$1(_) { - return _ === 'expr'; - } - - function isField(_) { - return _ === 'field'; - } - - function isCompare(_) { - return _ === 'compare'; - } - - function parseData(from, group, scope) { - var facet, key, op, dataRef, parent; // if no source data, generate singleton datum - - if (!from) { - dataRef = ref(scope.add(Collect$1(null, [{}]))); - } // if faceted, process facet specification - else if (facet = from.facet) { - if (!group) error('Only group marks can be faceted.'); // use pre-faceted source data, if available - - if (facet.field != null) { - dataRef = parent = getDataRef(facet, scope); - } else { - // generate facet aggregates if no direct data specification - if (!from.data) { - op = parseTransform(extend({ - type: 'aggregate', - groupby: array(facet.groupby) - }, facet.aggregate), scope); - op.params.key = scope.keyRef(facet.groupby); - op.params.pulse = getDataRef(facet, scope); - dataRef = parent = ref(scope.add(op)); - } else { - parent = ref(scope.getData(from.data).aggregate); - } - - key = scope.keyRef(facet.groupby, true); - } - } // if not yet defined, get source data reference - - - if (!dataRef) { - dataRef = getDataRef(from, scope); - } - - return { - key: key, - pulse: dataRef, - parent: parent - }; - } - - function getDataRef(from, scope) { - return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output); - } - - function DataScope(scope, input, output, values, aggr) { - this.scope = scope; // parent scope object - - this.input = input; // first operator in pipeline (tuple input) - - this.output = output; // last operator in pipeline (tuple output) - - this.values = values; // operator for accessing tuples (but not tuple flow) - // last aggregate in transform pipeline - - this.aggregate = aggr; // lookup table of field indices - - this.index = {}; - } - - DataScope.fromEntries = function (scope, entries) { - var n = entries.length, - i = 1, - input = entries[0], - values = entries[n - 1], - output = entries[n - 2], - aggr = null; - - if (input && input.type === 'load') { - input = entries[1]; - } // add operator entries to this scope, wire up pulse chain - - - scope.add(entries[0]); - - for (; i < n; ++i) { - entries[i].params.pulse = ref(entries[i - 1]); - scope.add(entries[i]); - if (entries[i].type === 'aggregate') aggr = entries[i]; - } - - return new DataScope(scope, input, output, values, aggr); - }; - - var prototype$1t = DataScope.prototype; - - prototype$1t.countsRef = function (scope, field, sort) { - var ds = this, - cache = ds.counts || (ds.counts = {}), - k = fieldKey(field), - v, - a, - p; - - if (k != null) { - scope = ds.scope; - v = cache[k]; - } - - if (!v) { - p = { - groupby: scope.fieldRef(field, 'key'), - pulse: ref(ds.output) - }; - if (sort && sort.field) addSortField(scope, p, sort); - a = scope.add(Aggregate$1(p)); - v = scope.add(Collect$1({ - pulse: ref(a) - })); - v = { - agg: a, - ref: ref(v) - }; - if (k != null) cache[k] = v; - } else if (sort && sort.field) { - addSortField(scope, v.agg.params, sort); - } - - return v.ref; - }; - - function fieldKey(field) { - return isString(field) ? field : null; - } - - function addSortField(scope, p, sort) { - var as = aggrField(sort.op, sort.field), - s; - - if (p.ops) { - for (var i = 0, n = p.as.length; i < n; ++i) { - if (p.as[i] === as) return; - } - } else { - p.ops = ['count']; - p.fields = [null]; - p.as = ['count']; - } - - if (sort.op) { - p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op); - p.fields.push(scope.fieldRef(sort.field)); - p.as.push(as); - } - } - - function cache(scope, ds, name, optype, field, counts, index) { - var cache = ds[name] || (ds[name] = {}), - sort = sortKey(counts), - k = fieldKey(field), - v, - op; - - if (k != null) { - scope = ds.scope; - k = k + (sort ? '|' + sort : ''); - v = cache[k]; - } - - if (!v) { - var params = counts ? { - field: keyFieldRef, - pulse: ds.countsRef(scope, field, counts) - } : { - field: scope.fieldRef(field), - pulse: ref(ds.output) - }; - if (sort) params.sort = scope.sortRef(counts); - op = scope.add(entry$1(optype, undefined, params)); - if (index) ds.index[field] = op; - v = ref(op); - if (k != null) cache[k] = v; - } - - return v; - } - - prototype$1t.tuplesRef = function () { - return ref(this.values); - }; - - prototype$1t.extentRef = function (scope, field) { - return cache(scope, this, 'extent', 'extent', field, false); - }; - - prototype$1t.domainRef = function (scope, field) { - return cache(scope, this, 'domain', 'values', field, false); - }; - - prototype$1t.valuesRef = function (scope, field, sort) { - return cache(scope, this, 'vals', 'values', field, sort || true); - }; - - prototype$1t.lookupRef = function (scope, field) { - return cache(scope, this, 'lookup', 'tupleindex', field, false); - }; - - prototype$1t.indataRef = function (scope, field) { - return cache(scope, this, 'indata', 'tupleindex', field, true, true); - }; - - function parseFacet(spec, scope, group) { - var facet = spec.from.facet, - name = facet.name, - data = getDataRef(facet, scope), - subscope, - source, - values, - op; - - if (!facet.name) { - error('Facet must have a name: ' + $(facet)); - } - - if (!facet.data) { - error('Facet must reference a data set: ' + $(facet)); - } - - if (facet.field) { - op = scope.add(PreFacet$1({ - field: scope.fieldRef(facet.field), - pulse: data - })); - } else if (facet.groupby) { - op = scope.add(Facet$1({ - key: scope.keyRef(facet.groupby), - group: ref(scope.proxy(group.parent)), - pulse: data - })); - } else { - error('Facet must specify groupby or field: ' + $(facet)); - } // initialize facet subscope - - - subscope = scope.fork(); - source = subscope.add(Collect$1()); - values = subscope.add(Sieve$1({ - pulse: ref(source) - })); - subscope.addData(name, new DataScope(subscope, source, source, values)); - subscope.addSignal('parent', null); // parse faceted subflow - - op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; - } - - function parseSubflow(spec, scope, input) { - var op = scope.add(PreFacet$1({ - pulse: input.pulse - })), - subscope = scope.fork(); - subscope.add(Sieve$1()); - subscope.addSignal('parent', null); // parse group mark subflow - - op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; - } - - function parseTrigger(spec, scope, name) { - var remove = spec.remove, - insert = spec.insert, - toggle = spec.toggle, - modify = spec.modify, - values = spec.values, - op = scope.add(operator()), - update, - expr; - update = 'if(' + spec.trigger + ',modify("' + name + '",' + [insert, remove, toggle, modify, values].map(function (_) { - return _ == null ? 'null' : _; - }).join(',') + '),0)'; - expr = parseExpression$1(update, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - function parseMark(spec, scope) { - var role = getRole(spec), - group = spec.type === GroupMark, - facet = spec.from && spec.from.facet, - layout = spec.layout || role === ScopeRole$1 || role === FrameRole$1, - nested = role === MarkRole || layout || facet, - overlap = spec.overlap, - ops, - op, - input, - store, - enc, - bound, - render, - sieve, - name, - joinRef, - markRef, - encodeRef, - layoutRef, - boundRef; // resolve input data - - input = parseData(spec.from, group, scope); // data join to map tuples to visual items - - op = scope.add(DataJoin$1({ - key: input.key || (spec.key ? fieldRef(spec.key) : undefined), - pulse: input.pulse, - clean: !group - })); - joinRef = ref(op); // collect visual items - - op = store = scope.add(Collect$1({ - pulse: joinRef - })); // connect visual items to scenegraph - - op = scope.add(Mark$1({ - markdef: definition$1(spec), - interactive: interactive(spec.interactive, scope), - clip: clip$2(spec.clip, scope), - context: { - $context: true - }, - groups: scope.lookup(), - parent: scope.signals.parent ? scope.signalRef('parent') : null, - index: scope.markpath(), - pulse: ref(op) - })); - markRef = ref(op); // add visual encoders - - op = enc = scope.add(Encode$1(parseEncode(spec.encode, spec.type, role, spec.style, scope, { - mod: false, - pulse: markRef - }))); // monitor parent marks to propagate changes - - op.params.parent = scope.encode(); // add post-encoding transforms, if defined - - if (spec.transform) { - spec.transform.forEach(function (_) { - var tx = parseTransform(_, scope), - md = tx.metadata; - - if (md.generates || md.changes) { - error('Mark transforms should not generate new data.'); - } - - if (!md.nomod) enc.params.mod = true; // update encode mod handling - - tx.params.pulse = ref(op); - scope.add(op = tx); - }); - } // if item sort specified, perform post-encoding - - - if (spec.sort) { - op = scope.add(SortItems$1({ - sort: scope.compareRef(spec.sort), - pulse: ref(op) - })); - } - - encodeRef = ref(op); // add view layout operator if needed - - if (facet || layout) { - layout = scope.add(ViewLayout$1({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - mark: markRef, - pulse: encodeRef - })); - layoutRef = ref(layout); - } // compute bounding boxes - - - bound = scope.add(Bound$1({ - mark: markRef, - pulse: layoutRef || encodeRef - })); - boundRef = ref(bound); // if group mark, recurse to parse nested content - - if (group) { - // juggle layout & bounds to ensure they run *after* any faceting transforms - if (nested) { - ops = scope.operators; - ops.pop(); - if (layout) ops.pop(); - } - - scope.pushState(encodeRef, layoutRef || boundRef, joinRef); - facet ? parseFacet(spec, scope, input) // explicit facet - : nested ? parseSubflow(spec, scope, input) // standard mark group - : scope.parse(spec); // guide group, we can avoid nested scopes - - scope.popState(); - - if (nested) { - if (layout) ops.push(layout); - ops.push(bound); - } - } // if requested, add overlap removal transform - - - if (overlap) { - boundRef = parseOverlap(overlap, boundRef, scope); - } // render / sieve items - - - render = scope.add(Render$1({ - pulse: boundRef - })); - sieve = scope.add(Sieve$1({ - pulse: ref(render) - }, undefined, scope.parent())); // if mark is named, make accessible as reactive geometry - // add trigger updates if defined - - if (spec.name != null) { - name = spec.name; - scope.addData(name, new DataScope(scope, store, render, sieve)); - if (spec.on) spec.on.forEach(function (on) { - if (on.insert || on.remove || on.toggle) { - error('Marks only support modify triggers.'); - } - - parseTrigger(on, scope, name); - }); - } - } - - function parseOverlap(overlap, source, scope) { - var method = overlap.method, - bound = overlap.bound, - sep = overlap.separation, - tol; - var params = { - separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, - method: isSignal(method) ? scope.signalRef(method.signal) : method, - pulse: source - }; - - if (overlap.order) { - params.sort = scope.compareRef({ - field: overlap.order - }); - } - - if (bound) { - tol = bound.tolerance; - params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; - params.boundScale = scope.scaleRef(bound.scale); - params.boundOrient = bound.orient; - } - - return ref(scope.add(Overlap$1(params))); - } - - function parseLegend(spec, scope) { - var config = scope.config.legend, - encode = spec.encode || {}, - legendEncode = encode.legend || {}, - name = legendEncode.name || undefined, - interactive = legendEncode.interactive, - style = legendEncode.style, - _ = lookup$5(spec, config), - scales = {}, - scale = 0, - entryEncode, - entryLayout, - params, - children, - type, - datum, - dataRef, - entryRef; // resolve scales and 'canonical' scale name - - - LegendScales.forEach(function (s) { - return spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0; - }); - if (!scale) error('Missing valid scale for legend.'); // resolve legend type (symbol, gradient, or discrete gradient) - - type = legendType(spec, scope.scaleType(scale)); // single-element data source for legend group - - datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - dataRef = ref(scope.add(Collect$1(null, [datum]))); // encoding properties for legend group - - legendEncode = extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip$2); // encoding properties for legend entry sub-group - - entryEncode = { - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - } - }; // data source for legend values - - entryRef = ref(scope.add(LegendEntries$1(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); // continuous gradient legend - - if (type === Gradient$1) { - children = [legendGradient(spec, scale, config, encode.gradient), legendGradientLabels(spec, config, encode.labels, entryRef)]; // adjust default tick count based on the gradient length - - params.count = params.count || scope.signalRef("max(2,2*floor((".concat(deref(_.gradientLength()), ")/100))")); - } // discrete gradient legend - else if (type === Discrete$1) { - children = [legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), legendGradientLabels(spec, config, encode.labels, entryRef)]; - } // symbol legend - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns))]; // pass symbol size information to legend entry generator - - params.size = sizeExpression(spec, scope, children[0].marks); - } // generate legend marks - - - children = [guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive: interactive - })]; // include legend title if defined - - if (datum.title) { - children.push(legendTitle(spec, config, encode.title, dataRef)); - } // parse legend specification - - - return parseMark(guideGroup({ - role: LegendRole$1, - from: dataRef, - encode: legendEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name: name, - interactive: interactive, - style: style - }), scope); - } - - function legendType(spec, scaleType) { - var type = spec.type || Symbols$1; - - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { - type = isContinuous(scaleType) ? Gradient$1 : isDiscretizing(scaleType) ? Discrete$1 : Symbols$1; - } - - return type !== Gradient$1 ? type : isDiscretizing(scaleType) ? Discrete$1 : Gradient$1; - } - - function scaleCount(spec) { - return LegendScales.reduce(function (count, type) { - return count + (spec[type] ? 1 : 0); - }, 0); - } - - function buildLegendEncode(_, spec, config) { - var encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - return encode; - } - - function sizeExpression(spec, scope, marks) { - var size = deref(getChannel('size', spec, marks)), - strokeWidth = deref(getChannel('strokeWidth', spec, marks)), - fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - return parseExpression$1("max(ceil(sqrt(".concat(size, ")+").concat(strokeWidth, "),").concat(fontSize, ")"), scope); - } - - function getChannel(name, spec, marks) { - return spec[name] ? "scale(\"".concat(spec[name], "\",datum)") : getEncoding(name, marks[0].encode); - } - - function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); - } - - var angleExpr = "item.orient===\"".concat(Left$1, "\"?-90:item.orient===\"").concat(Right$1, "\"?90:0"); - - function parseTitle(spec, scope) { - spec = isString(spec) ? { - text: spec - } : spec; - - var _ = lookup$5(spec, scope.config.title), - encode = spec.encode || {}, - userEncode = encode.group || {}, - name = userEncode.name || undefined, - interactive = userEncode.interactive, - style = userEncode.style, - children = [], - datum, - dataRef; // single-element data source for group title - - - datum = {}; - dataRef = ref(scope.add(Collect$1(null, [datum]))); // include title text - - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); // include subtitle text - - if (spec.subtitle) { - children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - } // parse title specification - - - return parseMark(guideGroup({ - role: TitleRole$1, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name: name, - interactive: interactive, - style: style - }), scope); - } // provide backwards-compatibility for title custom encode; - // the top-level encode block has been *deprecated*. - - - function titleEncode(spec) { - var encode = spec.encode; - return encode && encode.title || extend({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); - } - - function groupEncode(_, userEncode) { - var encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: { - signal: alignExpr - }, - angle: { - signal: angleExpr - }, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') - }); - return extendEncode(encode, userEncode, Skip$2); - } - - function buildTitle(spec, _, userEncode, dataRef) { - var zero = { - value: 0 - }, - text = spec.text, - encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') - }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode: encode - }, userEncode); - } - - function buildSubTitle(spec, _, userEncode, dataRef) { - var zero = { - value: 0 - }, - text = spec.subtitle, - encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') - }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode: encode - }, userEncode); - } - - function parseData$1(data, scope) { - var transforms = []; - - if (data.transform) { - data.transform.forEach(function (tx) { - transforms.push(parseTransform(tx, scope)); - }); - } - - if (data.on) { - data.on.forEach(function (on) { - parseTrigger(on, scope, data.name); - }); - } - - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); - } - /** - * Analyze a data pipeline, add needed operators. - */ - - - function analyze(data, scope, ops) { - var output = [], - source = null, - modify = false, - generate = false, - upstream, - i, - n, - t, - m; - - if (data.values) { - // hard-wired input data set - if (hasSignal(data.values) || hasSignal(data.format)) { - // if either values or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format - })); - } - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format - })); - } - } else if (data.source) { - // derives from one or more other data sets - source = upstream = array(data.source).map(function (d) { - return ref(scope.getData(d).output); - }); - output.push(null); // populate later - } // scan data transforms, add collectors as needed - - - for (i = 0, n = ops.length; i < n; ++i) { - t = ops[i]; - m = t.metadata; - - if (!source && !m.source) { - output.push(source = collect()); - } - - output.push(t); - if (m.generates) generate = true; - if (m.modifies && !generate) modify = true; - if (m.source) source = t;else if (m.changes) source = null; - } - - if (upstream) { - n = upstream.length - 1; - output[0] = Relay$1({ - derive: modify, - pulse: n ? upstream : upstream[0] - }); - - if (modify || n) { - // collect derived and multi-pulse tuples - output.splice(1, 0, collect()); - } - } - - if (!source) output.push(collect()); - output.push(Sieve$1({})); - return output; - } - - function collect(values) { - var s = Collect$1({}, values); - s.metadata = { - source: true - }; - return s; - } - - function load$1(scope, data) { - return Load$1({ - url: data.url ? scope.property(data.url) : undefined, - async: data.async ? scope.property(data.async) : undefined, - values: data.values ? scope.property(data.values) : undefined, - format: scope.objectProperty(data.format) - }); - } - - var isX = function isX(orient) { - return orient === Bottom$1 || orient === Top$1; - }; // get sign coefficient based on axis orient - - - var getSign = function getSign(orient, a, b) { - return isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left$1 || orient === Top$1 ? a : b; - }; // condition on axis x-direction - - - var ifX = function ifX(orient, a, b) { - return isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b; - }; // condition on axis y-direction - - - var ifY = function ifY(orient, a, b) { - return isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a; - }; - - var ifTop = function ifTop(orient, a, b) { - return isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top$1 ? { - value: a - } : { - value: b - }; - }; - - var ifRight = function ifRight(orient, a, b) { - return isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right$1 ? { - value: a - } : { - value: b - }; - }; - - var ifXEnc = function ifXEnc($orient, a, b) { - return ifEnc("".concat($orient, " === '").concat(Top$1, "' || ").concat($orient, " === '").concat(Bottom$1, "'"), a, b); - }; - - var ifYEnc = function ifYEnc($orient, a, b) { - return ifEnc("".concat($orient, " !== '").concat(Top$1, "' && ").concat($orient, " !== '").concat(Bottom$1, "'"), a, b); - }; - - var ifLeftTopExpr = function ifLeftTopExpr($orient, a, b) { - return ifExpr("".concat($orient, " === '").concat(Left$1, "' || ").concat($orient, " === '").concat(Top$1, "'"), a, b); - }; - - var ifTopExpr = function ifTopExpr($orient, a, b) { - return ifExpr("".concat($orient, " === '").concat(Top$1, "'"), a, b); - }; - - var ifRightExpr = function ifRightExpr($orient, a, b) { - return ifExpr("".concat($orient, " === '").concat(Right$1, "'"), a, b); - }; - - var ifEnc = function ifEnc(test, a, b) { - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? a.signal || $(a.value) : null; - b = b ? b.signal || $(b.value) : null; - return { - signal: "".concat(test, " ? (").concat(a, ") : (").concat(b, ")") - }; - } else { - // otherwise generate rule set - return [extend({ - test: test - }, a)].concat(b || []); - } - }; - - var isSimple = function isSimple(enc) { - return enc == null || Object.keys(enc).length === 1; - }; - - var ifExpr = function ifExpr(test, a, b) { - return { - signal: "".concat(test, " ? (").concat(toExpr(a), ") : (").concat(toExpr(b), ")") - }; - }; - - var ifOrient = function ifOrient($orient, t, b, l, r) { - return { - signal: (l != null ? "".concat($orient, " === '").concat(Left$1, "' ? (").concat(toExpr(l), ") : ") : '') + (b != null ? "".concat($orient, " === '").concat(Bottom$1, "' ? (").concat(toExpr(b), ") : ") : '') + (r != null ? "".concat($orient, " === '").concat(Right$1, "' ? (").concat(toExpr(r), ") : ") : '') + (t != null ? "".concat($orient, " === '").concat(Top$1, "' ? (").concat(toExpr(t), ") : ") : '') + '(null)' - }; - }; - - var toExpr = function toExpr(v) { - return isSignal(v) ? v.signal : v == null ? null : $(v); - }; - - var mult = function mult(sign, value) { - return value === 0 ? 0 : isSignal(sign) ? { - signal: "(".concat(sign.signal, ") * ").concat(value) - } : { - value: sign * value - }; - }; - - var patch = function patch(value, base) { - var s = value.signal; - return s && s.endsWith('(null)') ? { - signal: s.slice(0, -6) + base.signal - } : value; - }; - - function fallback(prop, config, axisConfig, style) { - var styleProp; - - if (config && hasOwnProperty(config, prop)) { - return config[prop]; - } else if (hasOwnProperty(axisConfig, prop)) { - return axisConfig[prop]; - } else if (prop.startsWith('title')) { - switch (prop) { - case 'titleColor': - styleProp = 'fill'; - break; - - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - - return style[GuideTitleStyle][styleProp]; - } else if (prop.startsWith('label')) { - switch (prop) { - case 'labelColor': - styleProp = 'fill'; - break; - - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - - return style[GuideLabelStyle][styleProp]; - } - - return null; - } - - function keys$1(objects) { - var map = {}; - - var _iterator22 = _createForOfIteratorHelper(objects), - _step22; - - try { - for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) { - var obj = _step22.value; - if (!obj) continue; - - for (var _key15 in obj) { - map[_key15] = 1; - } - } - } catch (err) { - _iterator22.e(err); - } finally { - _iterator22.f(); - } - - return Object.keys(map); - } - - function axisConfig(spec, scope) { - var config = scope.config, - style = config.style, - axis = config.axis, - band = scope.scaleType(spec.scale) === 'band' && config.axisBand, - orient = spec.orient, - xy, - or, - key; - - if (isSignal(orient)) { - var xyKeys = keys$1([config.axisX, config.axisY]), - orientKeys = keys$1([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]); - xy = {}; - - var _iterator23 = _createForOfIteratorHelper(xyKeys), - _step23; - - try { - for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) { - key = _step23.value; - xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style)); - } - } catch (err) { - _iterator23.e(err); - } finally { - _iterator23.f(); - } - - or = {}; - - var _iterator24 = _createForOfIteratorHelper(orientKeys), - _step24; - - try { - for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) { - key = _step24.value; - or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style)); - } - } catch (err) { - _iterator24.e(err); - } finally { - _iterator24.f(); - } - } else { - xy = orient === Top$1 || orient === Bottom$1 ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; - } - - var result = xy || or || band ? extend({}, axis, xy, or, band) : axis; - return result; - } - - function axisDomain(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - encode, - enter, - update; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1 - }, - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') - }); - var pos0 = position(spec, 0); - var pos1 = position(spec, 1); - enter.x = update.x = ifX(orient, pos0, zero$1); - enter.x2 = update.x2 = ifX(orient, pos1); - enter.y = update.y = ifY(orient, pos0, zero$1); - enter.y2 = update.y2 = ifY(orient, pos1); - return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode: encode - }, userEncode); - } - - function position(spec, pos) { - return { - scale: spec.scale, - range: pos - }; - } - - function axisGrid(spec, config, userEncode, dataRef, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - vscale = spec.gridScale, - sign = getSign(orient, 1, -1), - offset = offsetValue$1(spec.offset, sign), - encode, - enter, - exit, - update, - tickPos, - gridStart, - gridEnd, - sz; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1 - }, - exit: exit = { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') - }); - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - sz = ifX(orient, { - signal: 'height' - }, { - signal: 'width' - }); - gridStart = vscale ? { - scale: vscale, - range: 0, - mult: sign, - offset: offset - } : { - value: 0, - offset: offset - }; - gridEnd = vscale ? { - scale: vscale, - range: 1, - mult: sign, - offset: offset - } : extend(sz, { - mult: sign, - offset: offset - }); - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); - exit.x = ifX(orient, tickPos); - exit.y = ifY(orient, tickPos); - return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode: encode - }, userEncode); - } - - function offsetValue$1(offset, sign) { - if (sign === 1) ;else if (!isObject(offset)) { - offset = isSignal(sign) ? { - signal: "(".concat(sign.signal, ") * (").concat(offset || 0, ")") - } : sign * (offset || 0); - } else { - var _entry = offset = extend({}, offset); - - while (_entry.mult != null) { - if (!isObject(_entry.mult)) { - _entry.mult = isSignal(sign) // no offset if sign === 1 - ? { - signal: "(".concat(_entry.mult, ") * (").concat(sign.signal, ")") - } : _entry.mult * sign; - return offset; - } else { - _entry = _entry.mult = extend({}, _entry.mult); - } - } - - _entry.mult = sign; - } - return offset; - } - - function axisTicks(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, - enter, - exit, - update, - tickSize, - tickPos; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1 - }, - exit: exit = { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') - }); - tickSize = encoder(size); - tickSize.mult = sign; - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - update.y = enter.y = ifX(orient, zero$1, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); - exit.x = ifX(orient, tickPos); - update.x = enter.x = ifY(orient, zero$1, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); - exit.y = ifY(orient, tickPos); - return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode: encode - }, userEncode); - } - - function flushExpr(scale, threshold, a, b, c) { - return { - signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')' - }; - } - - function axisLabels(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - scale = spec.scale, - sign = getSign(orient, -1, 1), - flush = deref(_('labelFlush')), - flushOffset = deref(_('labelFlushOffset')), - flushOn = flush === 0 || !!flush, - labelAlign = _('labelAlign'), - labelBaseline = _('labelBaseline'), - encode, - enter, - update, - tickSize, - tickPos, - align, - baseline, - bound, - overlap, - offsetExpr; - - tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; - tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - align = ifX(orient, flushOn ? flushExpr(scale, flush, '"left"', '"right"', '"center"') : { - value: 'center' - }, ifRight(orient, 'left', 'right')); - baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : { - value: 'middle' - }); - offsetExpr = flushExpr(scale, flush, "-(".concat(flushOffset, ")"), flushOffset, 0); - flushOn = flushOn && flushOffset; - enter = { - opacity: zero$1, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - encode = { - enter: enter, - update: update = { - opacity: one$1, - text: { - field: Label - }, - x: enter.x, - y: enter.y, - align: align, - baseline: baseline - }, - exit: { - opacity: zero$1, - x: enter.x, - y: enter.y - } - }; - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') - }, { - align: labelAlign, - baseline: labelBaseline - }); - bound = _('labelBound'); - overlap = _('labelOverlap'); // if overlap method or bound defined, request label overlap removal - - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? { - scale: scale, - orient: orient, - tolerance: bound - } : null - } : undefined; - - if (update.align !== align) { - update.align = patch(update.align, align); - } - - if (update.baseline !== baseline) { - update.baseline = patch(update.baseline, baseline); - } - - return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode: encode, - overlap: overlap - }, userEncode); - } - - function axisTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, - enter, - update, - titlePos; - - encode = { - enter: enter = { - opacity: zero$1, - anchor: encoder(_('titleAnchor', null)), - align: { - signal: alignExpr - } - }, - update: update = extend({}, enter, { - opacity: one$1, - text: encoder(spec.title) - }), - exit: { - opacity: zero$1 - } - }; - titlePos = { - signal: "lerp(range(\"".concat(spec.scale, "\"), ").concat(anchorExpr(0, 1, 0.5), ")") - }; - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero$1, mult(sign, 90)); - enter.baseline = ifX(orient, ifTop(orient, Bottom$1, Top$1), { - value: Bottom$1 - }); - update.angle = enter.angle; - update.baseline = enter.baseline; - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { - // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); - return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode: encode - }, userEncode); - } - - function autoLayout(_, orient, encode, userEncode) { - var auto = function auto(value, dim) { - return value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false; - }; - - var autoY = auto(_('titleX'), 'x'), - autoX = auto(_('titleY'), 'y'); - encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); - } - - function parseAxis(spec, scope) { - var config = axisConfig(spec, scope), - encode = spec.encode || {}, - axisEncode = encode.axis || {}, - name = axisEncode.name || undefined, - interactive = axisEncode.interactive, - style = axisEncode.style, - _ = lookup$5(spec, config), - band = tickBand(_), - datum, - dataRef, - ticksRef, - size, - children; // single-element data source for axis group - - - datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - dataRef = ref(scope.add(Collect$1({}, [datum]))); // encoding properties for axis group item - - axisEncode = extendEncode(buildAxisEncode(_, spec), axisEncode, Skip$2); // data source for axis ticks - - ticksRef = ref(scope.add(AxisTicks$1({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); // generate axis marks - - children = []; // include axis gridlines if requested - - if (datum.grid) { - children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - } // include axis ticks if requested - - - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } // include axis labels if requested - - - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } // include axis domain path if requested - - - if (datum.domain) { - children.push(axisDomain(spec, config, encode.domain, dataRef)); - } // include axis title if defined - - - if (datum.title) { - children.push(axisTitle(spec, config, encode.title, dataRef)); - } // parse axis specification - - - return parseMark(guideGroup({ - role: AxisRole$1, - from: dataRef, - encode: axisEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name: name, - interactive: interactive, - style: style - }), scope); - } - - function buildAxisEncode(_, spec) { - var encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value$2(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: { - signal: "abs(span(range(\"".concat(spec.scale, "\")))") - }, - translate: _('translate'), - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - return encode; - } - - function parseScope(spec, scope, preprocessed) { - var signals = array(spec.signals), - scales = array(spec.scales); // parse signal definitions, if not already preprocessed - - if (!preprocessed) signals.forEach(function (_) { - return parseSignal(_, scope); - }); // parse cartographic projection definitions - - array(spec.projections).forEach(function (_) { - return parseProjection(_, scope); - }); // initialize scale references - - scales.forEach(function (_) { - return initScale(_, scope); - }); // parse data sources - - array(spec.data).forEach(function (_) { - return parseData$1(_, scope); - }); // parse scale definitions - - scales.forEach(function (_) { - return parseScale(_, scope); - }); // parse signal updates - - (preprocessed || signals).forEach(function (_) { - return parseSignalUpdates(_, scope); - }); // parse axis definitions - - array(spec.axes).forEach(function (_) { - return parseAxis(_, scope); - }); // parse mark definitions - - array(spec.marks).forEach(function (_) { - return parseMark(_, scope); - }); // parse legend definitions - - array(spec.legends).forEach(function (_) { - return parseLegend(_, scope); - }); // parse title, if defined - - if (spec.title) parseTitle(spec.title, scope); // parse collected lambda (anonymous) expressions - - scope.parseLambdas(); - return scope; - } - - var rootEncode = function rootEncode(spec) { - return extendEncode({ - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - }, - update: { - width: { - signal: 'width' - }, - height: { - signal: 'height' - } - } - }, spec); - }; - - function parseView(spec, scope) { - var config = scope.config; // add scenegraph root - - var root = ref(scope.root = scope.add(operator())); // parse top-level signal definitions - - var signals = collectSignals(spec, config); - signals.forEach(function (_) { - return parseSignal(_, scope); - }); // assign description, event, legend, and locale configuration - - scope.description = spec.description || config.description; - scope.eventConfig = config.events; - scope.legends = scope.objectProperty(config.legend && config.legend.layout); - scope.locale = config.locale; // store root group item - - var input = scope.add(Collect$1()); // encode root group item - - var encode = scope.add(Encode$1(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole$1, spec.style, scope, { - pulse: ref(input) - }))); // perform view layout - - var parent = scope.add(ViewLayout$1({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) - })); - scope.operators.pop(); // parse remainder of specification - - scope.pushState(ref(encode), ref(parent), null); - parseScope(spec, scope, signals); - scope.operators.push(parent); // bound / render / sieve root item - - var op = scope.add(Bound$1({ - mark: root, - pulse: ref(parent) - })); - op = scope.add(Render$1({ - pulse: ref(op) - })); - op = scope.add(Sieve$1({ - pulse: ref(op) - })); // track metadata for root item - - scope.addData('root', new DataScope(scope, input, input, op)); - return scope; - } - - function signalObject(name, value) { - return value && value.signal ? { - name: name, - update: value.signal - } : { - name: name, - value: value - }; - } - /** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ - - - function collectSignals(spec, config) { - var _ = function _(name) { - return value$2(spec[name], config[name]); - }, - signals = [signalObject('background', _('background')), signalObject('autosize', parseAutosize(_('autosize'))), signalObject('padding', parsePadding(_('padding'))), signalObject('width', _('width') || 0), signalObject('height', _('height') || 0)], - pre = signals.reduce(function (p, s) { - return p[s.name] = s, p; - }, {}), - map = {}; // add spec signal array - - - array(spec.signals).forEach(function (s) { - if (hasOwnProperty(pre, s.name)) { - // merge if built-in signal - s = extend(pre[s.name], s); - } else { - // otherwise add to signal list - signals.push(s); - } - - map[s.name] = s; - }); // add config signal array - - array(config.signals).forEach(function (s) { - if (!hasOwnProperty(map, s.name) && !hasOwnProperty(pre, s.name)) { - // add to signal list if not already defined - signals.push(s); - } - }); - return signals; - } - - function Scope$1(config, options) { - this.config = config || {}; - this.options = options || {}; - this.bindings = []; - this.field = {}; - this.signals = {}; - this.lambdas = {}; - this.scales = {}; - this.events = {}; - this.data = {}; - this.streams = []; - this.updates = []; - this.operators = []; - this.eventConfig = null; - this.locale = null; - this._id = 0; - this._subid = 0; - this._nextsub = [0]; - this._parent = []; - this._encode = []; - this._lookup = []; - this._markpath = []; - } - - function Subscope(scope) { - this.config = scope.config; - this.options = scope.options; - this.legends = scope.legends; - this.field = Object.create(scope.field); - this.signals = Object.create(scope.signals); - this.lambdas = Object.create(scope.lambdas); - this.scales = Object.create(scope.scales); - this.events = Object.create(scope.events); - this.data = Object.create(scope.data); - this.streams = []; - this.updates = []; - this.operators = []; - this._id = 0; - this._subid = ++scope._nextsub[0]; - this._nextsub = scope._nextsub; - this._parent = scope._parent.slice(); - this._encode = scope._encode.slice(); - this._lookup = scope._lookup.slice(); - this._markpath = scope._markpath; - } - - var prototype$1u = Scope$1.prototype = Subscope.prototype; // ---- - - prototype$1u.parse = function (spec) { - return parseScope(spec, this); - }; - - prototype$1u.fork = function () { - return new Subscope(this); - }; - - prototype$1u.isSubscope = function () { - return this._subid > 0; - }; - - prototype$1u.toRuntime = function () { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; - }; - - prototype$1u.id = function () { - return (this._subid ? this._subid + ':' : 0) + this._id++; - }; - - prototype$1u.add = function (op) { - this.operators.push(op); - op.id = this.id(); // if pre-registration references exist, resolve them now - - if (op.refs) { - op.refs.forEach(function (ref) { - ref.$ref = op.id; - }); - op.refs = null; - } - - return op; - }; - - prototype$1u.proxy = function (op) { - var vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy$1({ - value: vref - })); - }; - - prototype$1u.addStream = function (stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; - }; - - prototype$1u.addUpdate = function (update) { - this.updates.push(update); - return update; - }; // Apply metadata - - - prototype$1u.finish = function () { - var name, ds; // annotate root - - if (this.root) this.root.root = true; // annotate signals - - for (name in this.signals) { - this.signals[name].signal = name; - } // annotate scales - - - for (name in this.scales) { - this.scales[name].scale = name; - } // annotate data sets - - - function annotate(op, name, type) { - var data, list; - - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } - } - - for (name in this.data) { - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - - for (var field in ds.index) { - annotate(ds.index[field], name, 'index:' + field); - } - } - - return this; - }; // ---- - - - prototype$1u.pushState = function (encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve$1({ - pulse: encode - })))); - - this._parent.push(parent); - - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - - this._markpath.push(-1); - }; - - prototype$1u.popState = function () { - this._encode.pop(); - - this._parent.pop(); - - this._lookup.pop(); - - this._markpath.pop(); - }; - - prototype$1u.parent = function () { - return peek(this._parent); - }; - - prototype$1u.encode = function () { - return peek(this._encode); - }; - - prototype$1u.lookup = function () { - return peek(this._lookup); - }; - - prototype$1u.markpath = function () { - var p = this._markpath; - return ++p[p.length - 1]; - }; // ---- - - - prototype$1u.fieldRef = function (field, name) { - if (isString(field)) return fieldRef(field, name); - - if (!field.signal) { - error('Unsupported field reference: ' + $(field)); - } - - var s = field.signal, - f = this.field[s], - params; - - if (!f) { - params = { - name: this.signalRef(s) - }; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field$1(params))); - } - - return f; - }; - - prototype$1u.compareRef = function (cmp) { - function check(_) { - if (isSignal(_)) { - signal = true; - return scope.signalRef(_.signal); - } else if (isExpr(_)) { - signal = true; - return scope.exprRef(_.expr); - } else { - return _; - } - } - - var scope = this, - signal = false, - fields = array(cmp.field).map(check), - orders = array(cmp.order).map(check); - return signal ? ref(this.add(Compare$1({ - fields: fields, - orders: orders - }))) : compareRef(fields, orders); - }; - - prototype$1u.keyRef = function (fields, flat) { - function check(_) { - if (isSignal(_)) { - signal = true; - return ref(sig[_.signal]); - } else { - return _; - } - } - - var sig = this.signals, - signal = false; - fields = array(fields).map(check); - return signal ? ref(this.add(Key$1({ - fields: fields, - flat: flat - }))) : keyRef(fields, flat); - }; - - prototype$1u.sortRef = function (sort) { - if (!sort) return sort; // including id ensures stable sorting - - var a = aggrField(sort.op, sort.field), - o = sort.order || Ascending; - return o.signal ? ref(this.add(Compare$1({ - fields: a, - orders: this.signalRef(o.signal) - }))) : compareRef(a, o); - }; // ---- - - - prototype$1u.event = function (source, type) { - var key = source + ':' + type; - - if (!this.events[key]) { - var id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - - return this.events[key]; - }; // ---- - - - prototype$1u.hasOwnSignal = function (name) { - return hasOwnProperty(this.signals, name); - }; - - prototype$1u.addSignal = function (name, value) { - if (this.hasOwnSignal(name)) { - error('Duplicate signal name: ' + $(name)); - } - - var op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; - }; - - prototype$1u.getSignal = function (name) { - if (!this.signals[name]) { - error('Unrecognized signal name: ' + $(name)); - } - - return this.signals[name]; - }; - - prototype$1u.signalRef = function (s) { - if (this.signals[s]) { - return ref(this.signals[s]); - } else if (!hasOwnProperty(this.lambdas, s)) { - this.lambdas[s] = this.add(operator(null)); - } - - return ref(this.lambdas[s]); - }; - - prototype$1u.parseLambdas = function () { - var code = Object.keys(this.lambdas); - - for (var i = 0, n = code.length; i < n; ++i) { - var s = code[i], - e = parseExpression$1(s, this), - op = this.lambdas[s]; - op.params = e.$params; - op.update = e.$expr; - } - }; - - prototype$1u.property = function (spec) { - return spec && spec.signal ? this.signalRef(spec.signal) : spec; - }; - - prototype$1u.objectProperty = function (spec) { - return !spec || !isObject(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); - }; - - function propertyLambda(spec) { - return (isArray(spec) ? arrayLambda : objectLambda)(spec); - } - - function arrayLambda(array) { - var code = '[', - i = 0, - n = array.length, - value; - - for (; i < n; ++i) { - value = array[i]; - code += (i > 0 ? ',' : '') + (isObject(value) ? value.signal || propertyLambda(value) : $(value)); - } - - return code + ']'; - } - - function objectLambda(obj) { - var code = '{', - i = 0, - key, - value; - - for (key in obj) { - value = obj[key]; - code += (++i > 1 ? ',' : '') + $(key) + ':' + (isObject(value) ? value.signal || propertyLambda(value) : $(value)); - } - - return code + '}'; - } - - prototype$1u.exprRef = function (code, name) { - var params = { - expr: parseExpression$1(code, this) - }; - if (name) params.expr.$name = name; - return ref(this.add(Expression$1(params))); - }; - - prototype$1u.addBinding = function (name, bind) { - if (!this.bindings) { - error('Nested signals do not support binding: ' + $(name)); - } - - this.bindings.push(extend({ - signal: name - }, bind)); - }; // ---- - - - prototype$1u.addScaleProj = function (name, transform) { - if (hasOwnProperty(this.scales, name)) { - error('Duplicate scale or projection name: ' + $(name)); - } - - this.scales[name] = this.add(transform); - }; - - prototype$1u.addScale = function (name, params) { - this.addScaleProj(name, Scale$1(params)); - }; - - prototype$1u.addProjection = function (name, params) { - this.addScaleProj(name, Projection$1(params)); - }; - - prototype$1u.getScale = function (name) { - if (!this.scales[name]) { - error('Unrecognized scale name: ' + $(name)); - } - - return this.scales[name]; - }; - - prototype$1u.projectionRef = prototype$1u.scaleRef = function (name) { - return ref(this.getScale(name)); - }; - - prototype$1u.projectionType = prototype$1u.scaleType = function (name) { - return this.getScale(name).params.type; - }; // ---- - - - prototype$1u.addData = function (name, dataScope) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - - return this.data[name] = dataScope; - }; - - prototype$1u.getData = function (name) { - if (!this.data[name]) { - error('Undefined data set name: ' + $(name)); - } - - return this.data[name]; - }; - - prototype$1u.addDataPipeline = function (name, entries) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - - return this.addData(name, DataScope.fromEntries(this, entries)); - }; - /** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ - - - function defaults() { - var defaultFont = 'sans-serif', - defaultSymbolSize = 30, - defaultStrokeWidth = 2, - defaultColor = '#4c78a8', - black = '#000', - gray = '#888', - lightGray = '#ddd'; - return { - // default visualization description - description: 'Vega visualization', - // default padding around visualization - padding: 0, - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - // default view background color - // covers the entire view component - background: null, - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: { - allow: ['wheel'] - } - }, - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - } - }, - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 - }, - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 - }, - // correction for centering bias - axisBand: { - tickOffset: -0.5 - }, - // defaults for cartographic projection - projection: { - type: 'mercator' - }, - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { - direction: 'vertical' - }, - right: { - direction: 'vertical' - } - } - }, - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [1, 0] - }, - symbol: ['circle', 'square', 'triangle-up', 'cross', 'diamond', 'triangle-right', 'triangle-down', 'triangle-left'] - } - }; - } - - function parse$6(spec, config, options) { - if (!isObject(spec)) { - error('Input Vega specification must be an object.'); - } - - config = mergeConfig(defaults(), config, spec.config); - return parseView(spec, new Scope$1(config, options)).toRuntime(); - } // -- Transforms ----- - - - extend(transforms, tx, vtx, encode, geo, force, tree, reg, voronoi, wordcloud, xf); - exports.Bounds = Bounds; - exports.CanvasHandler = CanvasHandler; - exports.CanvasRenderer = CanvasRenderer; - exports.DATE = DATE; - exports.DAY = DAY; - exports.DAYOFYEAR = DAYOFYEAR; - exports.Dataflow = Dataflow; - exports.Debug = Debug; - exports.Error = Error$1; - exports.EventStream = EventStream; - exports.Gradient = Gradient; - exports.GroupItem = GroupItem; - exports.HOURS = HOURS; - exports.Handler = Handler; - exports.Info = Info; - exports.Item = Item; - exports.MILLISECONDS = MILLISECONDS; - exports.MINUTES = MINUTES; - exports.MONTH = MONTH; - exports.Marks = Marks; - exports.MultiPulse = MultiPulse; - exports.None = None; - exports.Operator = Operator; - exports.Parameters = Parameters; - exports.Pulse = Pulse; - exports.QUARTER = QUARTER; - exports.RenderType = RenderType; - exports.Renderer = Renderer; - exports.ResourceLoader = ResourceLoader; - exports.SECONDS = SECONDS; - exports.SVGHandler = SVGHandler; - exports.SVGRenderer = SVGRenderer; - exports.SVGStringRenderer = SVGStringRenderer; - exports.Scenegraph = Scenegraph; - exports.TIME_UNITS = TIME_UNITS; - exports.Transform = Transform; - exports.View = View; - exports.WEEK = WEEK; - exports.Warn = Warn; - exports.YEAR = YEAR; - exports.accessor = accessor; - exports.accessorFields = accessorFields; - exports.accessorName = accessorName; - exports.array = array; - exports.bandwidthNRD = bandwidthNRD; - exports.bin = bin; - exports.bootstrapCI = bootstrapCI; - exports.boundClip = boundClip; - exports.boundContext = context; - exports.boundItem = boundItem; - exports.boundMark = boundMark; - exports.boundStroke = boundStroke; - exports.changeset = changeset; - exports.clampRange = clampRange; - exports.closeTag = closeTag; - exports.compare = compare; - exports.constant = constant; - exports.cumulativeLogNormal = cumulativeLogNormal; - exports.cumulativeNormal = cumulativeNormal; - exports.cumulativeUniform = cumulativeUniform; - exports.dayofyear = dayofyear; - exports.debounce = debounce; - exports.defaultLocale = defaultLocale; - exports.definition = definition; - exports.densityLogNormal = densityLogNormal; - exports.densityNormal = densityNormal; - exports.densityUniform = densityUniform; - exports.domChild = domChild; - exports.domClear = domClear; - exports.domCreate = domCreate; - exports.domFind = domFind; - exports.dotbin = dotbin; - exports.error = error; - exports.expressionFunction = expressionFunction; - exports.extend = extend; - exports.extent = extent; - exports.extentIndex = extentIndex; - exports.falsy = falsy; - exports.fastmap = fastmap; - exports.field = field; - exports.flush = flush; - exports.font = font; - exports.fontFamily = fontFamily; - exports.fontSize = fontSize; - exports.format = format; - exports.formatLocale = numberFormatDefaultLocale; - exports.formats = formats; - exports.hasOwnProperty = hasOwnProperty; - exports.id = id; - exports.identity = identity; - exports.inferType = inferType; - exports.inferTypes = inferTypes; - exports.ingest = ingest; - exports.inherits = inherits; - exports.inrange = inrange; - exports.interpolate = interpolate; - exports.interpolateColors = interpolateColors; - exports.interpolateRange = interpolateRange; - exports.intersect = intersect; - exports.intersectBoxLine = intersectBoxLine; - exports.intersectPath = intersectPath; - exports.intersectPoint = intersectPoint; - exports.intersectRule = intersectRule; - exports.isArray = isArray; - exports.isBoolean = isBoolean; - exports.isDate = isDate; - exports.isFunction = isFunction; - exports.isNumber = isNumber; - exports.isObject = isObject; - exports.isRegExp = isRegExp; - exports.isString = isString; - exports.isTuple = isTuple; - exports.key = key; - exports.lerp = lerp; - exports.lineHeight = lineHeight; - exports.loader = loader; - exports.locale = locale; - exports.logger = logger; - exports.lruCache = lruCache; - exports.merge = merge; - exports.mergeConfig = mergeConfig; - exports.multiLineOffset = multiLineOffset; - exports.one = one; - exports.openTag = openTag; - exports.pad = pad; - exports.panLinear = panLinear; - exports.panLog = panLog; - exports.panPow = panPow; - exports.panSymlog = panSymlog; - exports.parse = parse$6; - exports.pathCurves = curves; - exports.pathEqual = pathEqual; - exports.pathParse = pathParse; - exports.pathRectangle = vg_rect; - exports.pathRender = pathRender; - exports.pathSymbols = symbols; - exports.pathTrail = vg_trail; - exports.peek = peek; - exports.point = point; - exports.projection = projection; - exports.quantileLogNormal = quantileLogNormal; - exports.quantileNormal = quantileNormal; - exports.quantileUniform = quantileUniform; - exports.quantiles = quantiles; - exports.quantizeInterpolator = quantizeInterpolator; - exports.quarter = quarter; - exports.quartiles = quartiles; - exports.randomInteger = integer; - exports.randomKDE = randomKDE; - exports.randomLCG = lcg; - exports.randomLogNormal = randomLogNormal; - exports.randomMixture = randomMixture; - exports.randomNormal = randomNormal; - exports.randomUniform = randomUniform; - exports.read = read; - exports.regressionExp = regressionExp; - exports.regressionLinear = regressionLinear; - exports.regressionLoess = regressionLoess; - exports.regressionLog = regressionLog; - exports.regressionPoly = regressionPoly; - exports.regressionPow = regressionPow; - exports.regressionQuad = regressionQuad; - exports.renderModule = renderModule; - exports.repeat = repeat; - exports.resetDefaultLocale = resetDefaultLocale; - exports.resetSVGClipId = resetSVGClipId; - exports.resetSVGDefIds = resetSVGDefIds; - exports.responseType = responseType; - exports.runtimeContext = context$2; - exports.sampleCurve = sampleCurve; - exports.sampleLogNormal = sampleLogNormal; - exports.sampleNormal = sampleNormal; - exports.sampleUniform = sampleUniform; - exports.scale = scale$2; - exports.sceneEqual = sceneEqual; - exports.sceneFromJSON = sceneFromJSON; - exports.scenePickVisit = pickVisit; - exports.sceneToJSON = sceneToJSON; - exports.sceneVisit = visit; - exports.sceneZOrder = zorder; - exports.scheme = scheme; - exports.setRandom = setRandom; - exports.span = span; - exports.splitAccessPath = splitAccessPath; - exports.stringValue = $; - exports.textMetrics = textMetrics; - exports.timeBin = timeBin; - exports.timeFloor = timeFloor; - exports.timeFormatLocale = timeFormatDefaultLocale; - exports.timeInterval = timeInterval; - exports.timeOffset = timeOffset; - exports.timeSequence = timeSequence; - exports.timeUnitSpecifier = timeUnitSpecifier; - exports.timeUnits = timeUnits; - exports.toBoolean = toBoolean; - exports.toDate = toDate; - exports.toNumber = toNumber; - exports.toSet = toSet; - exports.toString = toString; - exports.transform = transform; - exports.transforms = transforms; - exports.truncate = truncate; - exports.truthy = truthy; - exports.tupleid = tupleid; - exports.typeParsers = typeParsers; - exports.utcFloor = utcFloor; - exports.utcInterval = utcInterval; - exports.utcOffset = utcOffset; - exports.utcSequence = utcSequence; - exports.utcdayofyear = utcdayofyear; - exports.utcquarter = utcquarter; - exports.utcweek = utcweek; - exports.version = version; - exports.visitArray = visitArray; - exports.week = week; - exports.writeConfig = writeConfig; - exports.zero = zero; - exports.zoomLinear = zoomLinear; - exports.zoomLog = zoomLog; - exports.zoomPow = zoomPow; - exports.zoomSymlog = zoomSymlog; - Object.defineProperty(exports, '__esModule', { - value: true - }); -}); \ No newline at end of file diff --git a/node_modules/vega/build-es5/vega-core.min.js b/node_modules/vega/build-es5/vega-core.min.js deleted file mode 100644 index 2c9b0bc..0000000 --- a/node_modules/vega/build-es5/vega-core.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,o=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return u=e.done,e},e:function(e){o=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(o)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nt&&l(),u=t=n+1):"]"===r&&(u||O("Access path missing open bracket: "+e),u>0&&l(),u=0,t=n+1):n>t?l():t=n+1}return u&&O("Access path missing closing bracket: "+e),a&&O("Access path missing closing quote: "+e),n>t&&(n++,l()),i}function z(e,t,n){var r=R(e);return e=1===r.length?r[0]:e,C((n&&n.get||F)(r),[e],t||e)}var T=[],P=z("id"),q=C((function(e){return e}),T,"identity"),L=C((function(){return 0}),T,"zero"),N=C((function(){return 1}),T,"one"),U=C((function(){return!0}),T,"true"),I=C((function(){return!1}),T,"false");function j(e,t,n){var r=[t].concat([].slice.call(n));console[e].apply(console,r)}function $(e,t){var n=e||0;return{level:function(e){return arguments.length?(n=+e,this):n},error:function(){return n>=1&&j(t||"error","ERROR",arguments),this},warn:function(){return n>=2&&j(t||"warn","WARN",arguments),this},info:function(){return n>=3&&j(t||"log","INFO",arguments),this},debug:function(){return n>=4&&j(t||"log","DEBUG",arguments),this}}}var W=Array.isArray;function H(e){return e===Object(e)}var G=function(e){return"__proto__"!==e};function Y(){for(var e=arguments.length,t=new Array(e),n=0;n=n-t?[t,n]:[i=Math.min(Math.max(i,t),n-r),i+r]}function ge(e){return"function"==typeof e}function ye(e,t,n){n=n||{},t=me(t)||[];var r=[],i=[],a={},u=n.comparator||xe;return me(e).forEach((function(e,u){null!=e&&(r.push("descending"===t[u]?-1:1),i.push(e=ge(e)?e:z(e,null,n)),(E(e)||[]).forEach((function(e){return a[e]=1})))})),0===i.length?null:C(u(i,r),Object.keys(a))}var be=function(e,t){return(et||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0)},xe=function(e,t){return 1===e.length?_e(e[0],t[0]):ke(e,t,e.length)},_e=function(e,t){return function(n,r){return be(e(n),e(r))*t}},ke=function(e,t,n){return t.push(0),function(r,i){for(var a,u=0,o=-1;0===u&&++oa&&(a=r))}else{for(r=t(e[u]);ua&&(a=r))}return[i,a]}function Me(e,t){var n,r,i,a,u,o=-1,s=e.length;if(null==t){for(;++o=r){n=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++or&&(n=r,a=o),i=r){n=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++or&&(n=r,a=o),iu&&(i=a,a=u,u=i),r=void 0===r||r,((n=void 0===n||n)?a<=e:ae&&(n=t,t={},r=1),t[i]=a};return i(),{clear:i,has:function(e){return Fe(t,e)||Fe(n,e)},get:function(e){return Fe(t,e)?t[e]:Fe(n,e)?a(e,n[e]):void 0},set:function(e,n){return Fe(t,e)?t[e]=n:a(e,n)}}}function $e(e,t,n,r){var i=t.length,a=n.length;if(!a)return t;if(!i)return n;for(var u=r||new t.constructor(i+a),o=0,s=0,l=0;o0?n[s++]:t[o++];for(;o=0;)n+=e;return n}function He(e,t,n,r){var i=n||" ",a=e+"",u=t-a.length;return u<=0?a:"left"===r?We(i,u)+a:"center"===r?We(i,~~(u/2))+a+We(i,Math.ceil(u/2)):a+We(i,u)}function Ge(e){return e&&J(e)-e[0]||0}function Ye(e){return W(e)?"["+e.map(Ye)+"]":H(e)||Ne(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function Ve(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e)&&!!e}function Xe(e){return qe(e)||Pe(e)?e:Date.parse(e)}function Je(e,t){return t=t||Xe,null==e||""===e?null:t(e)}function Ke(e){return null==e||""===e?null:e+""}function Qe(e){for(var t={},n=0,r=e.length;n=0&&n.splice(i,1)),n},n}function nt(e,t){return rt.apply(this,arguments)}function rt(){return(rt=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n(t);case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),t.error(e.t0);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})))).apply(this,arguments)}var it=Symbol("vega_id"),at=1;function ut(e){return!(!e||!ot(e))}function ot(e){return e[it]}function st(e,t){return e[it]=t,e}function lt(e){var t=e===Object(e)?e:{data:e};return ot(t)?t:st(t,at++)}function ct(e){return ft(e,lt({}))}function ft(e,t){for(var n in e)t[n]=e[n];return t}function dt(e,t){return st(t,ot(e))}function ht(e,t){return e?t?function(n,r){return e(n,r)||ot(t(n))-ot(t(r))}:function(t,n){return e(t,n)||ot(t)-ot(n)}:null}function pt(e){return e&&e.constructor===mt}function mt(){var e=[],t=[],n=[],r=[],i=[],a=null,u=!1;return{constructor:mt,insert:function(t){for(var n=me(t),r=0,i=n.length;r0&&(g(h,d,f.value),o.modifies(d));for(l=0,c=i.length;l0&&g(e,f.field,f.value)})),o.modifies(f.field);if(u)o.mod=t.length||r.length?s.filter((function(e){return m[ot(e)]>0})):s.slice();else for(p in v)o.mod.push(v[p]);return(a||null==a&&(t.length||r.length))&&o.clean(!0),o}}}var vt="_:mod:_";function gt(){Object.defineProperty(this,vt,{writable:!0,value:{}})}var yt=gt.prototype;yt.set=function(e,t,n,r){var i=this,a=i[e],u=i[vt];return null!=t&&t>=0?(a[t]!==n||r)&&(a[t]=n,u[t+":"+e]=-1,u[e]=-1):(a!==n||r)&&(i[e]=n,u[e]=W(n)?1+n.length:-1),i},yt.modified=function(e,t){var n,r=this[vt];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(W(e)){for(n=0;n=0?t+1e?(t=n,1):0}))},Mt.debounce=function(e){var t=Ct();return this.targets().add(Ct(null,null,we(e,(function(e){var n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},Mt.between=function(e,t){var n=!1;return e.targets().add(Ct(null,null,(function(){n=!0}))),t.targets().add(Ct(null,null,(function(){n=!1}))),this.filter((function(){return n}))};var Et=/^([A-Za-z]+:)?\/\//,Ft=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,St=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;function Bt(e,t){return Ot.apply(this,arguments)}function Ot(){return(Ot=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sanitize(t,n);case 2:return r=e.sent,i=r.href,e.abrupt("return",r.localFile?this.file(i):this.http(i,n));case 5:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}function Rt(e,t){return zt.apply(this,arguments)}function zt(){return(zt=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n){var r,i,a,u,o,s,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=De({},this.options,n),r=this.fileAccess,i={href:null},s=Ft.test(t.replace(St,"")),null!=t&&"string"==typeof t&&s||O("Sanitize failure, invalid URI: "+Ye(t)),l=Et.test(t),(o=n.baseURL)&&!l&&(t.startsWith("/")||"/"===o[o.length-1]||(t="/"+t),t=o+t),u=(a=t.startsWith("file://"))||"file"===n.mode||"http"!==n.mode&&!l&&r,a?t=t.slice("file://".length):t.startsWith("//")&&("file"===n.defaultProtocol?(t=t.slice(2),u=!0):t=(n.defaultProtocol||"http")+":"+t),Object.defineProperty(i,"localFile",{value:!!u}),i.href=t,n.target&&(i.target=n.target+""),n.rel&&(i.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(i.crossOrigin=n.crossOrigin+""),e.abrupt("return",i);case 14:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}function Tt(e){return e?function(t){return new Promise((function(n,r){e.readFile(t,(function(e,t){e?r(e):n(t)}))}))}:Pt}function Pt(){return qt.apply(this,arguments)}function qt(){return(qt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:O("No file system access.");case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lt(e){return e?function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function t(n,r){var i,a,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=De({},this.options.http,r),a=r&&r.response,t.next=4,e(n,i);case 4:return u=t.sent,t.abrupt("return",u.ok?ge(u[a])?u[a]():u.text():O(u.status+""+u.statusText));case 6:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}():Nt}function Nt(){return Ut.apply(this,arguments)}function Ut(){return(Ut=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:O("No HTTP fetch method available.");case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var It={boolean:Ve,integer:K,number:K,date:Je,string:Ke,unknown:q},jt=[function(e){return"true"===e||"false"===e||!0===e||!1===e},function(e){return Gt(e)&&Number.isInteger(+e)},Gt,function(e){return!Number.isNaN(Date.parse(e))}],$t=["boolean","integer","number","date"];function Wt(e,t){if(!e||!e.length)return"unknown";for(var n,r,i,a=e.length,u=jt.length,o=jt.map((function(e,t){return t+1})),s=0,l=0;s1?(Qt[e]=t,this):Fe(Qt,e)?Qt[e]:null}function en(e){var t=Zt(e);return t&&t.responseType||"text"}function tn(e){var t={};return function(n){return t[n]||(t[n]=e(n))}}function nn(e,t){return et?1:e>=t?0:NaN}function rn(e){var t;return 1===e.length&&(t=e,e=function(e,n){return nn(t(e),n)}),{left:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[a],n)<0?r=a+1:i=a}return r},right:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[a],n)>0?i=a:r=a+1}return r}}}var an=rn(nn),un=an.right,on=an.left;function sn(e,t){var n=function(e,t){var n,r=0,i=0,a=0;if(void 0===t){var u,o=_createForOfIteratorHelper(e);try{for(o.s();!(u=o.n()).done;){var s=u.value;null!=s&&(s=+s)>=s&&(a+=(n=s-i)*(s-(i+=n/++r)))}}catch(e){o.e(e)}finally{o.f()}}else{var l,c=-1,f=_createForOfIteratorHelper(e);try{for(f.s();!(l=f.n()).done;){var d=l.value;null!=(d=t(d,++c,e))&&(d=+d)>=d&&(a+=(n=d-i)*(d-(i+=n/++r)))}}catch(e){f.e(e)}finally{f.f()}}if(r>1)return a/(r-1)}(e,t);return n?Math.sqrt(n):n}function ln(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=new Array(i);++r0)return[e];if((r=t0)for(e=Math.ceil(e/u),t=Math.floor(t/u),a=new Array(i=Math.ceil(t-e+1));++o=0?(a>=fn?10:a>=dn?5:a>=hn?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=fn?10:a>=dn?5:a>=hn?2:1)}function vn(e,t,n){var r=Math.abs(t-e)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=fn?i*=10:a>=dn?i*=5:a>=hn&&(i*=2),t=a)&&(n=a)}}catch(e){i.e(e)}finally{i.f()}}else{var u,o=-1,s=_createForOfIteratorHelper(e);try{for(s.s();!(u=s.n()).done;){var l=u.value;null!=(l=t(l,++o,e))&&(n=l)&&(n=l)}}catch(e){s.e(e)}finally{s.f()}}return n}function yn(e,t){var n;if(void 0===t){var r,i=_createForOfIteratorHelper(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;null!=a&&(n>a||void 0===n&&a>=a)&&(n=a)}}catch(e){i.e(e)}finally{i.f()}}else{var u,o=-1,s=_createForOfIteratorHelper(e);try{for(s.s();!(u=s.n()).done;){var l=u.value;null!=(l=t(l,++o,e))&&(n>l||void 0===n&&l>=l)&&(n=l)}}catch(e){s.e(e)}finally{s.f()}}return n}function bn(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function xn(e){return null===e?NaN:+e}function _n(e,t){var n,r,i,a,u,o,s;return regeneratorRuntime.wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(void 0!==t){l.next=21;break}n=_createForOfIteratorHelper(e),l.prev=2,n.s();case 4:if((r=n.n()).done){l.next=11;break}if(!(null!=(i=r.value)&&(i=+i)>=i)){l.next=9;break}return l.next=9,i;case 9:l.next=4;break;case 11:l.next=16;break;case 13:l.prev=13,l.t0=l.catch(2),n.e(l.t0);case 16:return l.prev=16,n.f(),l.finish(16);case 19:l.next=40;break;case 21:a=-1,u=_createForOfIteratorHelper(e),l.prev=23,u.s();case 25:if((o=u.n()).done){l.next=32;break}if(s=o.value,!(null!=(s=t(s,++a,e))&&(s=+s)>=s)){l.next=30;break}return l.next=30,s;case 30:l.next=25;break;case 32:l.next=37;break;case 34:l.prev=34,l.t1=l.catch(23),u.e(l.t1);case 37:return l.prev=37,u.f(),l.finish(37);case 40:case"end":return l.stop()}}),A,null,[[2,13,16,19],[23,34,37,40]])}function kn(e,t,n){if(r=(e=Float64Array.from(_n(e,n))).length){if((t=+t)<=0||r<2)return yn(e);if(t>=1)return gn(e);var r,i=(r-1)*t,a=Math.floor(i),u=gn(function e(t,n){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:nn;i>r;){if(i-r>600){var u=i-r+1,o=n-r+1,s=Math.log(u),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(u-l)/u)*(o-u/2<0?-1:1),f=Math.max(r,Math.floor(n-o*l/u+c)),d=Math.min(i,Math.floor(n+(u-o)*l/u+c));e(t,n,f,d,a)}var h=t[n],p=r,m=i;for(bn(t,r,n),a(t[i],h)>0&&bn(t,r,i);p0;)--m}0===a(t[r],h)?bn(t,r,m):bn(t,++m,i),m<=n&&(r=m+1),n<=m&&(i=m-1)}return t}(e,a).subarray(0,a+1));return u+(yn(e.subarray(a+1))-u)*(i-a)}}function An(e,t){return kn(e,.5,t)}function wn(e,t){var n=0;if(void 0===t){var r,i=_createForOfIteratorHelper(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;(a=+a)&&(n+=a)}}catch(e){i.e(e)}finally{i.f()}}else{var u,o=-1,s=_createForOfIteratorHelper(e);try{for(s.s();!(u=s.n()).done;){var l=u.value;(l=+t(l,++o,e))&&(n+=l)}}catch(e){s.e(e)}finally{s.f()}}return n}function Dn(e){var t=tn(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat:function(e){var n,i,a=r.formatSpecifier(e||",");if(null==a.precision){switch(a.precision=12,a.type){case"%":a.precision-=2;break;case"e":a.precision-=1}return n=t(a),i=t(".1f")(1)[1],function(e){var t,r,a=n(e),u=a.indexOf(i);if(u<0)return a;for(r=(t=function(e,t){var n,r=e.lastIndexOf("e");if(r>0)return r;for(r=e.length;--r>t;)if((n=e.charCodeAt(r))>=48&&n<=57)return r+1}(a,u))u;)if("0"!==a[t]){++t;break}return a.slice(0,t)+r}}return t(a)},formatSpan:function(e,i,a,u){u=r.formatSpecifier(null==u?",f":u);var o,s=vn(e,i,a),l=Math.max(Math.abs(e),Math.abs(i));if(null==u.precision)switch(u.type){case"s":return isNaN(o=r.precisionPrefix(s,l))||(u.precision=o),n(u,l);case"":case"e":case"g":case"p":case"r":isNaN(o=r.precisionRound(s,l))||(u.precision=o-("e"===u.type));break;case"f":case"%":isNaN(o=r.precisionFixed(s))||(u.precision=o-2*("%"===u.type))}return t(u)}}}function Cn(){return cn=Dn({format:r.format,formatPrefix:r.formatPrefix})}function Mn(e){return Dn(r.formatLocale(e))}function En(e){return arguments.length?cn=Mn(e):cn}Cn();var Fn="year",Sn="quarter",Bn="month",On="week",Rn="date",zn="day",Tn="hours",Pn="minutes",qn="seconds",Ln=[Fn,Sn,Bn,On,Rn,zn,"dayofyear",Tn,Pn,qn,"milliseconds"],Nn=Ln.reduce((function(e,t,n){return e[t]=1+n,e}),{});function Un(e){var t=me(e).slice(),n={};return t.length||O("Missing time unit."),t.forEach((function(e){Fe(Nn,e)?n[e]=1:O("Invalid time unit: ".concat(e,"."))})),(n[On]||n.day?1:0)+(n[Sn]||n[Bn]||n[Rn]?1:0)+(n.dayofyear?1:0)>1&&O("Incompatible time units: ".concat(e)),t.sort((function(e,t){return Nn[e]-Nn[t]})),t}var In=(_defineProperty(p={},Fn,"%Y "),_defineProperty(p,Sn,"Q%q "),_defineProperty(p,Bn,"%b "),_defineProperty(p,Rn,"%d "),_defineProperty(p,On,"W%U "),_defineProperty(p,zn,"%a "),_defineProperty(p,"dayofyear","%j "),_defineProperty(p,Tn,"%H:00"),_defineProperty(p,Pn,"00:%M"),_defineProperty(p,qn,":%S"),_defineProperty(p,"milliseconds",".%L"),_defineProperty(p,"".concat(Fn,"-").concat(Bn),"%Y-%m "),_defineProperty(p,"".concat(Fn,"-").concat(Bn,"-").concat(Rn),"%Y-%m-%d "),_defineProperty(p,"".concat(Tn,"-").concat(Pn),"%H:%M"),p);function jn(e,t){var n,r,i=De({},In,t),a=Un(e),u=a.length,o="",s=0;for(s=0;ss;--n)if(null!=i[r=a.slice(s,n).join("-")]){o+=i[r],s=n;break}return o.trim()}var $n=new Date;function Wn(e){return $n.setFullYear(e),$n.setMonth(0),$n.setDate(1),$n.setHours(0,0,0,0),$n}function Hn(e){return Yn(new Date(e))}function Gn(e){return Vn(new Date(e))}function Yn(e){return i.timeDay.count(Wn(e.getFullYear())-1,e)}function Vn(e){return i.timeWeek.count(Wn(e.getFullYear())-1,e)}function Xn(e){return Wn(e).getDay()}function Jn(e,t,n,r,i,a,u){if(0<=e&&e<100){var o=new Date(-1,t,n,r,i,a,u);return o.setFullYear(e),o}return new Date(e,t,n,r,i,a,u)}function Kn(e){return Zn(new Date(e))}function Qn(e){return er(new Date(e))}function Zn(e){var t=Date.UTC(e.getUTCFullYear(),0,1);return i.utcDay.count(t-1,e)}function er(e){var t=Date.UTC(e.getUTCFullYear(),0,1);return i.utcWeek.count(t-1,e)}function tr(e){return $n.setTime(Date.UTC(e,0,1)),$n.getUTCDay()}function nr(e,t,n,r,i,a,u){if(0<=e&&e<100){var o=new Date(Date.UTC(-1,t,n,r,i,a,u));return o.setUTCFullYear(n.y),o}return new Date(Date.UTC(e,t,n,r,i,a,u))}function rr(e,t,n,r,i){var a=t||1,u=J(e),o=function(e,t,i){return function(e,t,n,r){var i=n<=1?e:r?function(t,i){return r+n*Math.floor((e(t,i)-r)/n)}:function(t,r){return n*Math.floor(e(t,r)/n)};return t?function(e,n){return t(i(e,n),n)}:i}(n[i=i||e],r[i],e===u&&a,t)},s=new Date,l=Qe(e),c=l[Fn]?o(Fn):Ae(2012),f=l[Bn]?o(Bn):l[Sn]?o(Sn):L,d=l[On]&&l.day?o(zn,1,On+zn):l[On]?o(On,1):l.day?o(zn,1):l[Rn]?o(Rn,1):l.dayofyear?o("dayofyear",1):N,h=l[Tn]?o(Tn):L,p=l[Pn]?o(Pn):L,m=l[qn]?o(qn):L,v=l.milliseconds?o("milliseconds"):L;return function(e){s.setTime(+e);var t=c(s);return i(t,f(s),d(s,t),h(s),p(s),m(s),v(s))}}function ir(e,t,n){return t+7*e-(n+6)%7}var ar=(_defineProperty(m={},Fn,(function(e){return e.getFullYear()})),_defineProperty(m,Sn,(function(e){return Math.floor(e.getMonth()/3)})),_defineProperty(m,Bn,(function(e){return e.getMonth()})),_defineProperty(m,Rn,(function(e){return e.getDate()})),_defineProperty(m,Tn,(function(e){return e.getHours()})),_defineProperty(m,Pn,(function(e){return e.getMinutes()})),_defineProperty(m,qn,(function(e){return e.getSeconds()})),_defineProperty(m,"milliseconds",(function(e){return e.getMilliseconds()})),_defineProperty(m,"dayofyear",(function(e){return Yn(e)})),_defineProperty(m,On,(function(e){return Vn(e)})),_defineProperty(m,On+zn,(function(e,t){return ir(Vn(e),e.getDay(),Xn(t))})),_defineProperty(m,zn,(function(e,t){return ir(1,e.getDay(),Xn(t))})),m),ur=(_defineProperty(v={},Sn,(function(e){return 3*e})),_defineProperty(v,On,(function(e,t){return ir(e,0,Xn(t))})),v);function or(e,t){return rr(e,t||1,ar,ur,Jn)}var sr=(_defineProperty(g={},Fn,(function(e){return e.getUTCFullYear()})),_defineProperty(g,Sn,(function(e){return Math.floor(e.getUTCMonth()/3)})),_defineProperty(g,Bn,(function(e){return e.getUTCMonth()})),_defineProperty(g,Rn,(function(e){return e.getUTCDate()})),_defineProperty(g,Tn,(function(e){return e.getUTCHours()})),_defineProperty(g,Pn,(function(e){return e.getUTCMinutes()})),_defineProperty(g,qn,(function(e){return e.getUTCSeconds()})),_defineProperty(g,"milliseconds",(function(e){return e.getUTCMilliseconds()})),_defineProperty(g,"dayofyear",(function(e){return Zn(e)})),_defineProperty(g,On,(function(e){return er(e)})),_defineProperty(g,zn,(function(e,t){return ir(1,e.getUTCDay(),tr(t))})),_defineProperty(g,On+zn,(function(e,t){return ir(er(e),e.getUTCDay(),tr(t))})),g),lr=(_defineProperty(y={},Sn,(function(e){return 3*e})),_defineProperty(y,On,(function(e,t){return ir(e,0,tr(t))})),y);function cr(e,t){return rr(e,t||1,sr,lr,nr)}var fr=(_defineProperty(b={},Fn,i.timeYear),_defineProperty(b,Sn,i.timeMonth.every(3)),_defineProperty(b,Bn,i.timeMonth),_defineProperty(b,On,i.timeWeek),_defineProperty(b,Rn,i.timeDay),_defineProperty(b,zn,i.timeDay),_defineProperty(b,"dayofyear",i.timeDay),_defineProperty(b,Tn,i.timeHour),_defineProperty(b,Pn,i.timeMinute),_defineProperty(b,qn,i.timeSecond),_defineProperty(b,"milliseconds",i.timeMillisecond),b),dr=(_defineProperty(x={},Fn,i.utcYear),_defineProperty(x,Sn,i.utcMonth.every(3)),_defineProperty(x,Bn,i.utcMonth),_defineProperty(x,On,i.utcWeek),_defineProperty(x,Rn,i.utcDay),_defineProperty(x,zn,i.utcDay),_defineProperty(x,"dayofyear",i.utcDay),_defineProperty(x,Tn,i.utcHour),_defineProperty(x,Pn,i.utcMinute),_defineProperty(x,qn,i.utcSecond),_defineProperty(x,"milliseconds",i.utcMillisecond),x);function hr(e){return fr[e]}function pr(e){return dr[e]}function mr(e,t,n){return e?e.offset(t,n):void 0}function vr(e,t,n){return mr(hr(e),t,n)}function gr(e,t,n){return mr(pr(e),t,n)}function yr(e,t,n,r){return e?e.range(t,n,r):void 0}function br(e,t,n,r){return yr(hr(e),t,n,r)}function xr(e,t,n,r){return yr(pr(e),t,n,r)}var _r,kr=[Fn,Bn,Rn,Tn,Pn,qn,"milliseconds"],Ar=kr.slice(0,-1),wr=Ar.slice(0,-1),Dr=wr.slice(0,-1),Cr=Dr.slice(0,-1),Mr=[Fn,Bn],Er=[Fn],Fr=[[Ar,1,1e3],[Ar,5,5e3],[Ar,15,15e3],[Ar,30,3e4],[wr,1,6e4],[wr,5,3e5],[wr,15,9e5],[wr,30,18e5],[Dr,1,36e5],[Dr,3,108e5],[Dr,6,216e5],[Dr,12,432e5],[Cr,1,864e5],[[Fn,On],1,6048e5],[Mr,1,2592e6],[Mr,3,7776e6],[Er,1,31536e6]];function Sr(e){var t,n,r=e.extent,i=e.maxbins||40,a=Math.abs(Ge(r))/i,u=rn((function(e){return e[2]})).right(Fr,a);return u===Fr.length?(t=Er,n=vn(r[0]/31536e6,r[1]/31536e6,i)):u?(t=(u=Fr[a/Fr[u-1][2]0)){e.next=35;break}if((s=i._heap.pop()).rank===s.qrank){e.next=23;break}return i._enqueue(s,!0),e.abrupt("continue",18);case 23:if(!(l=s.run(i._getPulse(s,t))).then){e.next=30;break}return e.next=27,l;case 27:l=e.sent,e.next=31;break;case 30:l.async&&(a.push(l.async),l=Yr);case 31:l!==Yr&&s._targets&&s._targets.forEach((function(e){return i._enqueue(e)})),++o,e.next=18;break;case 35:e.next=41;break;case 37:e.prev=37,e.t0=e.catch(17),i._heap.clear(),c=e.t0;case 41:if(i._input={},i._pulse=null,i.debug("Pulse ".concat(u,": ").concat(o," operators")),c&&(i._postrun=[],i.error(c)),!i._postrun.length){e.next=55;break}f=i._postrun.sort((function(e,t){return t.priority-e.priority})),i._postrun=[],d=0;case 49:if(!(d=0&&(o=r),e[t]=e[o],o=1+((t=o)<<1);e[t]=u,ui(e,i,t,n)}(t,0,e)):n=r,n}}}function ui(e,t,n,r){var i,a,u;for(i=e[n];n>t&&r(i,a=e[u=n-1>>1])<0;)e[n]=a,n=u;return e[n]=i}function oi(){this.logger($()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Lr();try{this._loader=Ur()}catch(e){}this._touched=tt(P),this._input={},this._pulse=null,this._heap=ai((function(e,t){return e.qrank-t.qrank})),this._postrun=[]}var si=oi.prototype;function li(e){return function(){return this._log[e].apply(this,arguments)}}function ci(e,t){_t.call(this,e,null,t)}si.stamp=function(){return this._clock},si.loader=function(e){return arguments.length?(this._loader=e,this):this._loader},si.locale=function(e){return arguments.length?(this._locale=e,this):this._locale},si.cleanThreshold=1e4,si.add=function(e,t,n,r){var i,a=1;return e instanceof _t?i=e:e&&e.prototype instanceof _t?i=new e:ge(e)?i=new _t(null,e):(a=0,i=new _t(e,t)),this.rank(i),a&&(r=n,n=t),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},si.connect=function(e,t){var n,r,i=e.rank;for(n=0,r=t.length;n=0;)i.push(t=n[r]),t===e&&O("Cycle detected in dataflow graph.")},si.pulse=function(e,t,n){this.touch(e,n||ii);var r=new Vr(this,this._clock+(this._pulse?0:1)),i=e.pulse&&e.pulse.source||[];return r.target=e,this._input[e.id]=t.pulse(r,i),this},si.touch=function(e,t){var n=t||ii;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},si.update=function(e,t,n){var r=n||ii;return(e.set(t)||r.force)&&this.touch(e,r),this},si.changeset=mt,si.ingest=function(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))},si.parse=function(e,t){var n=this.locale();return Nr(e,t,n.timeParse,n.utcParse)},si.preload=function(e,t,n){return jr.apply(this,arguments)},si.request=function(e,t){return Ir.apply(this,arguments)},si.events=function(e,t,n,r){for(var i,a=this,u=Ct(n,r),o=function(e){e.dataflow=a;try{u.receive(e)}catch(e){a.error(e)}finally{a.run()}},s=0,l=(i="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):me(e)).length;s1?e.dev/(e.valid-1):void 0},add:function(e,t){return e.dev+=e.mean_d*(t-e.mean)},rem:function(e,t){return e.dev-=e.mean_d*(t-e.mean)},req:["mean"],idx:1},variancep:{value:function(e){return e.valid>1?e.dev/e.valid:void 0},req:["variance"],idx:2},stdev:{value:function(e){return e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0},req:["variance"],idx:2},stdevp:{value:function(e){return e.valid>1?Math.sqrt(e.dev/e.valid):void 0},req:["variance"],idx:2},stderr:{value:function(e){return e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0},req:["variance"],idx:2},distinct:{value:function(e){return e.cell.data.distinct(e.get)},req:["values"],idx:3},ci0:{value:function(e){return e.cell.data.ci0(e.get)},req:["values"],idx:3},ci1:{value:function(e){return e.cell.data.ci1(e.get)},req:["values"],idx:3},median:{value:function(e){return e.cell.data.q2(e.get)},req:["values"],idx:3},q1:{value:function(e){return e.cell.data.q1(e.get)},req:["values"],idx:3},q3:{value:function(e){return e.cell.data.q3(e.get)},req:["values"],idx:3},min:{init:function(e){return e.min=void 0},value:function(e){return e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min},add:function(e,t){(te.max||void 0===e.max)&&(e.max=t)},rem:function(e,t){t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:function(e){return e.argmin=void 0},value:function(e){return e.argmin||e.cell.data.argmin(e.get)},add:function(e,t,n){te.max&&(e.argmax=n)},rem:function(e,t){t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3}},xi=Object.keys(bi);function _i(e,t){return bi[e](t)}function ki(e,t){return e.idx-t.idx}function Ai(){var e=this;this.valid=0,this.missing=0,this._ops.forEach((function(t){return t.init(e)}))}function wi(e,t){var n=this;null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((function(r){return r.add(n,e,t)}))):++this.missing}function Di(e,t){var n=this;null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((function(r){return r.rem(n,e,t)}))):--this.missing}function Ci(e){var t=this;return this._out.forEach((function(n){return e[n.out]=n.value(t)})),e}function Mi(e,t){var n=t||q,r=function(e){var t={};return e.forEach((function(e){return t[e.name]=e})),e.forEach((function e(n){n.req&&n.req.forEach((function(n){t[n]||e(t[n]=bi[n]())}))})),Object.values(t).sort(ki)}(e),i=e.slice().sort(ki);function a(e){this._ops=r,this._out=i,this.cell=e,this.init()}return a.prototype.init=Ai,a.prototype.add=wi,a.prototype.rem=Di,a.prototype.set=Ci,a.prototype.get=n,a.fields=e.map((function(e){return e.out})),a}function Ei(e,t){var n,r,i,a,u,o,s;return regeneratorRuntime.wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(null!=t){l.next=21;break}n=_createForOfIteratorHelper(e),l.prev=2,n.s();case 4:if((r=n.n()).done){l.next=11;break}if(!(null!=(i=r.value)&&""!==i&&(i=+i)>=i)){l.next=9;break}return l.next=9,i;case 9:l.next=4;break;case 11:l.next=16;break;case 13:l.prev=13,l.t0=l.catch(2),n.e(l.t0);case 16:return l.prev=16,n.f(),l.finish(16);case 19:l.next=41;break;case 21:a=-1,u=_createForOfIteratorHelper(e),l.prev=23,u.s();case 25:if((o=u.n()).done){l.next=33;break}if(s=o.value,!(null!=(s=t(s,++a,e))&&""!==s&&(s=+s)>=s)){l.next=31;break}return l.next=31,s;case 31:l.next=25;break;case 33:l.next=38;break;case 35:l.prev=35,l.t1=l.catch(23),u.e(l.t1);case 38:return l.prev=38,u.f(),l.finish(38);case 41:case"end":return l.stop()}}),w,null,[[2,13,16,19],[23,35,38,41]])}function Fi(e,t,n){var r=Float64Array.from(Ei(e,n));return r.sort(nn),t.map((function(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xn;if(r=e.length){if((t=+t)<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),u=+n(e[a],a,e),o=+n(e[a+1],a+1,e);return u+(o-u)*(i-a)}}(r,e)}))}function Si(e,t){return Fi(e,[.25,.5,.75],t)}function Bi(e,t){var n=e.length,r=sn(e,t),i=Si(e,t),a=(i[2]-i[0])/1.34;return 1.06*(r=Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function Oi(e){var t,n,r,i,a,u,o,s,l=e.maxbins||20,c=e.base||10,f=Math.log(c),d=e.divide||[5,2],h=e.extent[0],p=e.extent[1],m=e.span||p-h||Math.abs(h)||1;if(e.step)t=e.step;else if(e.steps){for(a=m/l,u=0,o=e.steps.length;ul;)t*=c;for(u=0,o=d.length;u=r&&m/a<=l&&(t=a)}return i=(a=Math.log(t))>=0?0:1+~~(-a/f),s=Math.pow(c,-i-1),(e.nice||void 0===e.nice)&&(h=h<(a=Math.floor(h/t+s)*t)?a-t:a,p=Math.ceil(p/t)*t),{start:h,stop:p===h?h+t:p,step:t}}function Ri(t,n,r,i){if(!t.length)return[void 0,void 0];var a,u,o,s,l=Float64Array.from(Ei(t,i)),c=l.length,f=n;for(o=0,s=Array(f);o=f){for(c=(l+c)/2;a>1);ru;)e[r--]=e[a]}a=u,u=n}return e}(s,t+t/4):s}xi.forEach((function(e){bi[e]=function(e,t){return function(n){return De({name:e,out:n||e},yi,t)}}(e,bi[e])})),e.random=Math.random;var Ti=Math.sqrt(2*Math.PI),Pi=Math.SQRT2,qi=NaN;function Li(t,n){t=t||0,n=null==n?1:n;var r,i,a=0,u=0;if(qi==qi)a=qi,qi=NaN;else{do{r=(a=2*e.random()-1)*a+(u=2*e.random()-1)*u}while(0===r||r>1);a*=i=Math.sqrt(-2*Math.log(r)/r),qi=u*i}return t+a*n}function Ni(e,t,n){var r=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*Ti)}function Ui(e,t,n){var r,i=(e-(t=t||0))/(n=null==n?1:n),a=Math.abs(i);if(a>37)r=0;else{var u=Math.exp(-a*a/2);a<7.07106781186547?(r=u*((((((.0352624965998911*a+.700383064443688)*a+6.37396220353165)*a+33.912866078383)*a+112.079291497871)*a+221.213596169931)*a+220.206867912376),r/=((((((.0883883476483184*a+1.75566716318264)*a+16.064177579207)*a+86.7807322029461)*a+296.564248779674)*a+637.333633378831)*a+793.826512519948)*a+440.413735824752):r=u/(a+1/(a+2/(a+3/(a+4/(a+.65)))))/2.506628274631}return i>0?1-r:r}function Ii(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*Pi*function(e){var t,n=-Math.log((1-e)*(1+e));n<6.25?t=1.6536545626831027+(t=.24015818242558962+(t=(t=(t=.00018673420803405714+(t=(t=(t=4.2347877827932404e-7+(t=(t=(t=1.0512122733215323e-9+(t=(t=(t=26335093153082323e-28+(t=(t=(t=6637638134358324e-30+(t=20972767875968562e-33+(t=(t=11157877678025181e-33+(t=128584807152564e-32+(t=(t=-364441206401782e-35)*(n-=3.125)-16850591381820166e-35)*n)*n)*n-1333171662854621e-31)*n)*n)*n-4054566272975207e-29)*n-8151934197605472e-29)*n)*n-12975133253453532e-27)*n-5415412054294628e-26)*n)*n-4.112633980346984e-9)*n-2.9070369957882005e-8)*n)*n-13654692000834679e-22)*n-13882523362786469e-21)*n)*n-.000740702534166267)*n-.006033670871430149)*n)*n:n<16?(n=Math.sqrt(n)-3.25,t=3.0838856104922208+(t=1.0052589676941592+(t=.005370914553590064+(t=(t=.002491442096107851+(t=(t=.0009532893797373805+(t=(t=24031110387097894e-21+(t=6828485145957318e-20+(t=(t=12475304481671779e-21+(t=29234449089955446e-22+(t=(t=15027403968909828e-22+(t=1.8239629214389228e-8+(t=(t=9.075656193888539e-8+(t=2.2137376921775787e-9)*n)*n-2.7517406297064545e-7)*n)*n)*n-4013867526981546e-21)*n)*n)*n-47318229009055734e-21)*n)*n)*n-.0003550375203628475)*n)*n-.0016882755560235047)*n)*n-.003751208507569241)*n)*n)*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,t=4.849906401408584+(t=1.0103004648645344+(t=(t=(t=7599527703001776e-20+(t=(t=4526062597223154e-21+(t=(t=2.2900482228026655e-7+(t=(t=2.914795345090108e-8+(t=(t=7.61570120807834e-9+(t=(t=1.5076572693500548e-9+(t=(t=-27109920616438573e-27)*n-2.555641816996525e-10)*n)*n-3.789465440126737e-9)*n)*n-1.496002662714924e-8)*n)*n-6.771199775845234e-8)*n)*n-9.9298272942317e-7)*n)*n-1968177810553167e-20)*n)*n-.00021503011930044477)*n-.00013871931833623122)*n)*n):t=1/0;return t*e}(2*e-1)}function ji(e,t){var n,r,i={mean:function(e){return arguments.length?(n=e||0,i):n},stdev:function(e){return arguments.length?(r=null==e?1:e,i):r},sample:function(){return Li(n,r)},pdf:function(e){return Ni(e,n,r)},cdf:function(e){return Ui(e,n,r)},icdf:function(e){return Ii(e,n,r)}};return i.mean(e).stdev(t)}function $i(t,n){var r=ji(),i={},a=0;return i.data=function(e){return arguments.length?(t=e,a=e?e.length:0,i.bandwidth(n)):t},i.bandwidth=function(e){return arguments.length?(!(n=e)&&t&&(n=Bi(t)),i):n},i.sample=function(){return t[~~(e.random()*a)]+n*r.sample()},i.pdf=function(e){for(var i=0,u=0;u=t&&e<=n?1/(n-t):0}function Qi(e,t,n){return null==n&&(n=null==t?1:t,t=0),en?1:(e-t)/(n-t)}function Zi(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function ea(e,t){var n,r,i={min:function(e){return arguments.length?(n=e||0,i):n},max:function(e){return arguments.length?(r=null==e?1:e,i):r},sample:function(){return Ji(n,r)},pdf:function(e){return Ki(e,n,r)},cdf:function(e){return Qi(e,n,r)},icdf:function(e){return Zi(e,n,r)}};return null==t&&(t=null==e?1:e,e=0),i.min(e).max(t)}function ta(e,t,n,r){var i=r-e*e,a=Math.abs(i)<1e-24?0:(n-e*t)/i;return[t-a*e,a]}function na(e,t,n,r){e=e.filter((function(e){var r=t(e),i=n(e);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&e.sort((function(e,n){return t(e)-t(n)}));var i,a,u,o,s=e.length,l=new Float64Array(s),c=new Float64Array(s),f=0,d=0,h=0,p=_createForOfIteratorHelper(e);try{for(p.s();!(o=p.n()).done;)u=o.value,l[f]=i=+t(u),c[f]=a=+n(u),d+=(i-d)/++f,h+=(a-h)/f}catch(e){p.e(e)}finally{p.f()}for(f=0;f=i&&null!=a&&(a=+a)>=a&&r(i,a,++o)}}catch(e){s.e(e)}finally{s.f()}}function ia(e,t,n,r,i){var a=0,u=0;return ra(e,t,n,(function(e,t){var n=t-i(e),o=t-r;a+=n*n,u+=o*o})),1-a/u}function aa(e,t,n){var r=0,i=0,a=0,u=0,o=0;ra(e,t,n,(function(e,t){++o,r+=(e-r)/o,i+=(t-i)/o,a+=(e*t-a)/o,u+=(e*e-u)/o}));var s=ta(r,i,a,u),l=function(e){return s[0]+s[1]*e};return{coef:s,predict:l,rSquared:ia(e,t,n,i,l)}}function ua(e,t,n){var r=0,i=0,a=0,u=0,o=0;ra(e,t,n,(function(e,t){++o,e=Math.log(e),r+=(e-r)/o,i+=(t-i)/o,a+=(e*t-a)/o,u+=(e*e-u)/o}));var s=ta(r,i,a,u),l=function(e){return s[0]+s[1]*Math.log(e)};return{coef:s,predict:l,rSquared:ia(e,t,n,i,l)}}function oa(e,t,n){var r,i,a,u=_slicedToArray(na(e,t,n),4),o=u[0],s=(u[1],u[2]),l=u[3],c=0,f=0,d=0,h=0,p=0;ra(e,t,n,(function(e,t){r=o[p++],i=Math.log(t),c+=(t*i-c)/p,f+=((a=r*t)-f)/p,d+=(a*i-d)/p,h+=(r*a-h)/p}));var m=_slicedToArray(ta(f/l,c/l,d/l,h/l),2),v=m[0],g=m[1],y=function(e){return Math.exp(v+g*(e-s))};return{coef:[Math.exp(v-g*s),g],predict:y,rSquared:ia(e,t,n,l,y)}}function sa(e,t,n){var r=0,i=0,a=0,u=0,o=0,s=0;ra(e,t,n,(function(e,t){var n=Math.log(e),l=Math.log(t);++s,r+=(n-r)/s,i+=(l-i)/s,a+=(n*l-a)/s,u+=(n*n-u)/s,o+=(t-o)/s}));var l=ta(r,i,a,u),c=function(e){return l[0]*Math.pow(e,l[1])};return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:ia(e,t,n,o,c)}}function la(e,t,n){var r,i,a,u,o=_slicedToArray(na(e,t,n),4),s=o[0],l=o[1],c=o[2],f=o[3],d=s.length,h=0,p=0,m=0,v=0,g=0;for(r=0;rMath.abs(e[t][i])&&(i=n);for(r=t;r=t;r--)e[r][n]-=e[r][t]*e[t][n]/e[t][t]}for(n=u-1;n>=0;--n){for(a=0,r=n+1;r=0;--i)for(u=t[i],o=1,s[i]+=u,a=1;a<=i;++a)o*=(i+1-a)/a,s[i-a]+=u*Math.pow(n,a)*o;return s[0]+=r,s}function da(e,t,n,r){for(var i=_slicedToArray(na(e,t,n,!0),4),a=i[0],u=i[1],o=i[2],s=i[3],l=a.length,c=Math.max(2,~~(r*l)),f=new Float64Array(l),d=new Float64Array(l),h=new Float64Array(l).fill(1),p=-1;++p<=2;){for(var m=[0,c-1],v=0;va[b]-g?y:b,_=0,k=0,A=0,w=0,D=0,C=1/Math.abs(a[x]-g||1),M=y;M<=b;++M){var E=a[M],F=u[M],S=ha(Math.abs(g-E)*C)*h[M],B=E*S;_+=S,k+=B,A+=F*S,w+=F*B,D+=E*B}var O=_slicedToArray(ta(k/_,A/_,w/_,D/_),2),R=O[0],z=O[1];f[v]=R+z*g,d[v]=Math.abs(u[v]-f[v]),pa(a,v+1,m)}if(2===p)break;var T=An(d);if(Math.abs(T)<1e-12)break;for(var P,q,L=0;L=1?1e-12:(q=1-P*P)*q}return function(e,t,n,r){for(var i,a=e.length,u=[],o=0,s=0,l=[];o=e.length))for(;t>i&&e[a]-r<=r-e[i];)n[0]=++i,n[1]=a,++a}var ma=.1*Math.PI/180;function va(e,t,n,r){n=n||25,r=Math.max(n,r||200);var i=function(t){return[t,e(t)]},a=t[0],u=t[1],o=u-a,s=o/r,l=[i(a)],c=[];if(n===r){for(var f=1;f0;)c.push(i(a+d/n*o));for(var h,p,m,v,g,y=l[0],b=c[c.length-1];b;){var x=i((y[0]+b[0])/2);x[0]-y[0]>=s&&(h=y,p=x,m=b,v=void 0,g=void 0,v=Math.atan2(m[1]-h[1],m[0]-h[0]),g=Math.atan2(p[1]-h[1],p[0]-h[0]),Math.abs(v-g)>ma)?c.push(x):(y=b,l.push(b),c.pop()),b=c[c.length-1]}return l}function ga(e){this._key=e?z(e):ot,this.reset()}var ya=ga.prototype;function ba(e){ci.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}ya.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},ya.add=function(e){this._add.push(e)},ya.rem=function(e){this._rem.push(e)},ya.values=function(){if(this._get=null,0===this._rem.length)return this._add;var e,t,n,r=this._add,i=this._rem,a=this._key,u=r.length,o=i.length,s=Array(u-o),l={};for(e=0;e=0;)Fe(i,t=e(n[r])+"")||(i[t]=1,++a);return a},ya.extent=function(e){if(this._get!==e||!this._ext){var t=this.values(),n=Me(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},ya.argmin=function(e){return this.extent(e)[0]||{}},ya.argmax=function(e){return this.extent(e)[1]||{}},ya.min=function(e){var t=this.extent(e)[0];return null!=t?e(t):void 0},ya.max=function(e){var t=this.extent(e)[1];return null!=t?e(t):void 0},ya.quartile=function(e){return this._get===e&&this._q||(this._q=Si(this.values(),e),this._get=e),this._q},ya.q1=function(e){return this.quartile(e)[0]},ya.q2=function(e){return this.quartile(e)[1]},ya.q3=function(e){return this.quartile(e)[2]},ya.ci=function(e){return this._get===e&&this._ci||(this._ci=Ri(this.values(),1e3,.05,e),this._get=e),this._ci},ya.ci0=function(e){return this.ci(e)[0]},ya.ci1=function(e){return this.ci(e)[1]},ba.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:xi},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};var xa=Re(ba,ci);xa.transform=function(e,t){var n=this,r=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),a=e.modified();return r.stamp=i.stamp,r.value&&(a||t.modified(r._inputs,!0))?(r._prev=r.value,r.value=a?r.init(e):{},t.visit(t.SOURCE,(function(e){return r.add(e)}))):(r.value=r.value||r.init(e),t.visit(t.REM,(function(e){return r.rem(e)})),t.visit(t.ADD,(function(e){return r.add(e)}))),i.modifies(r._outputs),r._drop=!1!==e.drop,e.cross&&r._dims.length>1&&(r._drop=!1,r.cross()),t.clean()&&r._drop&&i.clean(!0).runAfter((function(){return n.clean()})),r.changes(i)},xa.cross=function(){var e=this,t=e.value,n=e._dnames,r=n.map((function(){return{}})),i=n.length;function a(e){var t,a,u,o;for(t in e)for(u=e[t].tuple,a=0;ao?1/0:(t=Math.max(u,Math.min(t,o-a)),u+a*Math.floor(1e-14+(t-u)/a))};return s.start=u,s.stop=i.stop,s.step=a,this.value=C(s,E(r),e.name||"bin_"+M(r))},wa.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},Re(wa,ci).transform=function(e,t){var n=t.fork(t.ALL),r=Aa(ot,this.value,n.materialize(n.ADD).add),i=e.sort,a=t.changed()||i&&(e.modified("sort")||t.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(ht(i),a),t.source&&t.source.root&&(this.value.root=t.source.root),n},Re(Da,_t),Ma.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};var Ea=Re(Ma,ci);function Fa(e){ci.call(this,null,e)}Ea.transform=function(e,t){function n(t){return function(n){for(var r,i=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(o(n),e.case,a)||[],s=0,l=i.length;sd&&(d=g),p[++n][l]=g}}catch(e){v.e(e)}finally{v.f()}}return this.value={start:f,stop:d,step:o},t.reflow(!0).modifies(l)},Re(qa,_t),Na.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},Re(Na,ci).transform=function(e,t){var n,r=this.value,i=e.field,a=r[0],u=r[1];if(((n=t.changed()||t.modified(i.fields)||e.modified("field"))||null==a)&&(a=1/0,u=-1/0),t.visit(n?t.SOURCE:t.ADD,(function(e){var t=K(i(e));null!=t&&(tu&&(u=t))})),!Number.isFinite(a)||!Number.isFinite(u)){var o=M(i);o&&(o=' for field "'.concat(o,'"')),t.dataflow.warn("Infinite extent".concat(o,": [").concat(a,", ").concat(u,"]")),a=u=void 0}this.value=[a,u]};var Ia=Re(Ua,_t);function ja(e){ci.call(this,{},e),this._keys=Be();var t=this._targets=[];t.active=0,t.forEach=function(e){for(var n=0,r=t.active;nr.cleanThreshold&&r.runAfter(u.clean),t},Re(Wa,_t),Ga.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},Re(Ga,ci).transform=function(e,t){var n=t.dataflow,r=this.value,i=t.fork(),a=i.add,u=i.rem,o=i.mod,s=e.expr,l=!0;function c(t){var n=ot(t),i=s(t,e),c=r.get(n);i&&c?(r.delete(n),a.push(t)):i||c?l&&i&&!c&&o.push(t):(r.set(n,1),u.push(t))}return t.visit(t.REM,(function(e){var t=ot(e);r.has(t)?r.delete(t):u.push(e)})),t.visit(t.ADD,(function(t){s(t,e)?a.push(t):r.set(ot(t),1)})),t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i},Ya.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},Re(Ya,ci).transform=function(e,t){var n=t.fork(t.NO_SOURCE),r=e.fields,i=za(r,e.as||[]),a=e.index||null,u=i.length;return n.rem=this.value,t.visit(t.SOURCE,(function(e){for(var t,o,s,l=r.map((function(t){return t(e)})),c=l.reduce((function(e,t){return Math.max(e,t.length)}),0),f=0;f0){for(n=[];--o>=0;)n.push(i=lt(s(e))),a.push(i);u.add=u.add.length?u.materialize(u.ADD).add.concat(n):n}else r=a.slice(0,-o),u.rem=u.rem.length?u.materialize(u.REM).rem.concat(r):r,a=a.slice(-o);return u.source=this.value=a,u};var Ka={value:"value",median:An,mean:function(e,t){var n=0,r=0;if(void 0===t){var i,a=_createForOfIteratorHelper(e);try{for(a.s();!(i=a.n()).done;){var u=i.value;null!=u&&(u=+u)>=u&&(++n,r+=u)}}catch(e){a.e(e)}finally{a.f()}}else{var o,s=-1,l=_createForOfIteratorHelper(e);try{for(l.s();!(o=l.n()).done;){var c=o.value;null!=(c=t(c,++s,e))&&(c=+c)>=c&&(++n,r+=c)}}catch(e){l.e(e)}finally{l.f()}}if(n)return r/n},min:yn,max:gn},Qa=[];function Za(e){ci.call(this,[],e)}function eu(e){ba.call(this,e)}Za.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},Re(Za,ci).transform=function(e,t){var n,r,i,a,u,o,s,l,c,f,d=t.fork(t.ALL),h=function(e){var t,n=e.method||Ka.value;if(null!=Ka[n])return n===Ka.value?(t=void 0!==e.value?e.value:0,function(){return t}):Ka[n];O("Unrecognized imputation method: "+n)}(e),p=function(e){var t=e.field;return function(e){return e?t(e):NaN}}(e),m=M(e.field),v=M(e.key),g=(e.groupby||[]).map(M),y=function(e,t,n,r){var i,a,u,o,s,l,c,f,d=function(e){return e(f)},h=[],p=r?r.slice():[],m={},v={};for(p.forEach((function(e,t){m[e]=t+1})),o=0,c=e.length;oa&&(a=r[1]);return[i,a]}function cu(e){_t.call(this,null,fu,e)}function fu(e){return this.value&&!e.modified()?this.value:e.values.reduce((function(e,t){return e.concat(t)}),[])}function du(e){ci.call(this,null,e)}function hu(e){ba.call(this,e)}tu.transform=function(e,t){var n,r=this,i=e.modified();return r.value&&(i||t.modified(r._inputs,!0))?(n=r.value=i?r.init(e):{},t.visit(t.SOURCE,(function(e){r.add(e)}))):(n=r.value=r.value||this.init(e),t.visit(t.REM,(function(e){r.rem(e)})),t.visit(t.ADD,(function(e){r.add(e)}))),r.changes(),t.visit(t.SOURCE,(function(e){De(e,n[r.cellkey(e)].tuple)})),t.reflow(i).modifies(this._outputs)},tu.changes=function(){var e,t,n=this._adds,r=this._mods;for(e=0,t=this._alen;e1&&!a&&O('Multi-field lookup requires explicit "as" parameter.'),a&&a.length!==d*r&&O('The "as" parameter has too few output field names.'),a=a||s.map(M),n=function(e){for(var t,n,i=0,c=0;it||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0)})),t?i.slice(0,t):i}(n,e.limit||0,t);t.changed()&&e.set("__pivot__",null,null,!0);return{key:e.key,groupby:e.groupby,ops:u.map((function(){return i})),fields:u.map((function(e){return function(e,t,n,r){return C((function(r){return t(r)===e?n(r):NaN}),r,e+"")}(e,n,r,a)})),as:u.map((function(e){return e+""})),modified:e.modified.bind(e)}}(e,t),t)},Re(mu,ja).transform=function(e,t){var n=this,r=e.subflow,i=e.field,a=function(e){return n.subflow(ot(e),r,t,e)};return(e.modified("field")||i&&t.modified(E(i)))&&O("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,(function(e){var t=a(e);i(e).forEach((function(e){return t.mod(e)}))})),t.visit(t.ADD,(function(e){var t=a(e);i(e).forEach((function(e){return t.add(lt(e))}))})),t.visit(t.REM,(function(e){var t=a(e);i(e).forEach((function(e){return t.rem(e)}))}))):(t.visit(t.MOD,(function(e){return a(e).mod(e)})),t.visit(t.ADD,(function(e){return a(e).add(e)})),t.visit(t.REM,(function(e){return a(e).rem(e)}))),t.clean()&&t.runAfter((function(){return n.clean()})),t},vu.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},Re(vu,ci).transform=function(e,t){var n,r,i=e.fields,a=za(e.fields,e.as||[]),u=i?function(e,t){return function(e,t,n,r){for(var i=0,a=n.length;i=s&&(n=u[i],l[ot(n)]&&r.rem.push(n),u[i]=t),++o}if(n.rem.length&&(n.visit(n.REM,(function(e){var t=ot(e);l[t]&&(l[t]=-1,r.rem.push(e)),--o})),u=u.filter((function(e){return-1!==l[ot(e)]}))),(n.rem.length||i)&&u.lengtha){for(var f=0,d=u.length-a;ff&&(f=i))})),a.start=c,a.stop=f,t.modifies(r?o:s)},Cu._floor=function(e,t){var n="utc"===e.timezone,r=e.units?{units:e.units,step:e.step||1}:Sr({extent:e.extent||Ce(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),i=r.units,a=r.step;i=Un(i);var u=this.value||{},o=(n?cr:or)(i,a);return o.unit=J(i),o.units=i,o.step=a,o.start=u.start,o.stop=u.stop,this.value=o},Re(Mu,ci).transform=function(e,t){var n=t.dataflow,r=e.field,i=this.value,a=!0;function u(e){i.set(r(e),e)}return e.modified("field")||t.modified(r.fields)?(i.clear(),t.visit(t.SOURCE,u)):t.changed()?(t.visit(t.REM,(function(e){i.delete(r(e))})),t.visit(t.ADD,u)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),t.fork()},Re(Eu,ci).transform=function(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(ht(e.sort)):t.source).map(e.field))};var Fu={row_number:function(){return{next:function(e){return e.index+1}}},rank:function(){var e;return{init:function(){return e=1},next:function(t){var n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?e=n+1:e}}},dense_rank:function(){var e;return{init:function(){return e=1},next:function(t){var n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?++e:e}}},percent_rank:function(){var e=Fu.rank(),t=e.next;return{init:e.init,next:function(e){return(t(e)-1)/(e.data.length-1)}}},cume_dist:function(){var e;return{init:function(){return e=0},next:function(t){var n=t.index,r=t.data,i=t.compare;if(e0||O("ntile num must be greater than zero.");var n=Fu.cume_dist(),r=n.next;return{init:n.init,next:function(e){return Math.ceil(t*r(e))}}},lag:function(e,t){return t=+t||1,{next:function(n){var r=n.index-t;return r>=0?e(n.data[r]):null}}},lead:function(e,t){return t=+t||1,{next:function(n){var r=n.index+t,i=n.data;return r0||O("nth_value nth must be greater than zero."),{next:function(n){var r=n.i0+(t-1);return r0&&!i(a[n],a[n-1])&&(e.i0=t.left(a,a[n])),ro)for(l=1,f=i.length;l1&&(n*=m=Math.sqrt(m),r*=m);var v=d/n,g=f/n,y=-f/r,b=d/r,x=v*o+g*s,_=y*o+b*s,k=v*e+g*t,A=y*e+b*t,w=(k-x)*(k-x)+(A-_)*(A-_),D=1/w-.25;D<0&&(D=0);var C=Math.sqrt(D);a==i&&(C=-C);var M=.5*(x+k)-C*(A-_),E=.5*(_+A)+C*(k-x),F=Math.atan2(_-E,x-M),S=Math.atan2(A-E,k-M),B=S-F;B<0&&1===a?B+=no:B>0&&0===a&&(B-=no);for(var O=Math.ceil(Math.abs(B/(to+.001))),R=[],z=0;zthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},$o.expand=function(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},$o.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},$o.scale=function(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},$o.translate=function(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},$o.rotate=function(e,t,n){var r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},$o.rotatedPoints=function(e,t,n){var r=this.x1,i=this.y1,a=this.x2,u=this.y2,o=Math.cos(e),s=Math.sin(e),l=t-t*o+n*s,c=n-t*s-n*o;return[o*r-s*i+l,s*r+o*i+c,o*r-s*u+l,s*r+o*u+c,o*a-s*i+l,s*a+o*i+c,o*a-s*u+l,s*a+o*u+c]},$o.union=function(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},$o.intersect=function(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},$o.alignsWith=function(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},$o.intersects=function(e){return e&&!(this.x2e.x2||this.y2e.y2)},$o.contains=function(e,t){return!(ethis.x2||tthis.y2)},$o.width=function(){return this.x2-this.x1},$o.height=function(){return this.y2-this.y1},Re(Ho,Wo);var Xo=Vo.prototype;function Jo(e){e._pending+=1}function Ko(e){e._pending-=1}function Qo(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){var r=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(r+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,r):0))}return e}Xo.pending=function(){return this._pending},Xo.sanitizeURL=function(e){var t=this;return Jo(t),t._loader.sanitize(e,{context:"href"}).then((function(e){return Ko(t),e})).catch((function(){return Ko(t),null}))},Xo.loadImage=function(e){var t=this,n=Yo();return Jo(t),t._loader.sanitize(e,{context:"image"}).then((function(e){var r=e.href;if(!r||!n)throw{url:r};var i=new n,a=Fe(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=a&&(i.crossOrigin=a),i.onload=function(){return Ko(t)},i.onerror=function(){return Ko(t)},i.src=r,i})).catch((function(e){return Ko(t),{complete:!1,width:0,height:0,src:e&&e.url||""}}))},Xo.ready=function(){var e=this;return new Promise((function(t){!function n(r){e.pending()?setTimeout((function(){n(!0)}),10):t(r)}(!1)}))};var Zo,es,ts,ns=no-1e-8;function rs(e){return Zo=e,rs}function is(){}function as(e,t){Zo.add(e,t)}function us(e,t){as(es=e,ts=t)}function os(e){as(e,Zo.y1)}function ss(e){as(Zo.x1,e)}function ls(e,t,n,r){var i=(e-t)/(e+n-2*t);01e-14?(a=o*o+s*u)>=0&&(l=(-o+(a=Math.sqrt(a)))/u,c=(-o-a)/u):l=.5*s/o,0ns)as(e-n,t-n),as(e+n,t+n);else{var u,o,s=function(r){return as(n*Math.cos(r)+e,n*Math.sin(r)+t)};if(s(r),s(i),i!==r)if((r%=no)<0&&(r+=no),(i%=no)<0&&(i+=no),ii;++o,u-=to)s(u);else for(u=r-r%to+to,o=0;o<4&&uv)return!1;o>m&&(m=o)}else if(a>0){if(o0&&(e.globalAlpha=n,e.fillStyle=ks(e,t,t.fill),!0)}var ws=[];function Ds(e,t,n){var r=null!=(r=t.strokeWidth)?r:1;return!(r<=0)&&((n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=ks(e,t,t.stroke),e.lineWidth=r,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||ws),e.lineDashOffset=t.strokeDashOffset||0),!0))}function Cs(e,t){return e.zindex-t.zindex||e.index-t.index}function Ms(e){if(!e.zdirty)return e.zitems;var t,n,r,i=e.items,a=[];for(n=0,r=i.length;n=0;)if(n=t(i[r]))return n;if(i===a)for(r=(i=e.items).length;--r>=0;)if(!i[r].zindex&&(n=t(i[r])))return n;return null}function Ss(e){return function(t,n,r){Es(n,(function(n){r&&!r.intersects(n.bounds)||Os(e,t,n,n)}))}}function Bs(e){return function(t,n,r){!n.items.length||r&&!r.intersects(n.bounds)||Os(e,t,n.items[0],n.items)}}function Os(e,t,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(e(t,r)||(bs(t,n),n.fill&&As(t,n,i)&&t.fill(),n.stroke&&Ds(t,n,i)&&t.stroke()))}function Rs(e){return e=e||U,function(t,n,r,i,a,u){return r*=t.pixelRatio,i*=t.pixelRatio,Fs(n,(function(n){var o=n.bounds;if((!o||o.contains(a,u))&&o)return e(t,n,r,i,a,u)?n:void 0}))}}function zs(e,t){return function(n,r,i,a){var u,o,s=Array.isArray(r)?r[0]:r,l=null==t?s.fill:t,c=s.stroke&&n.isPointInStroke;return c&&(u=s.strokeWidth,o=s.strokeCap,n.lineWidth=null!=u?u:1,n.lineCap=null!=o?o:"butt"),!e(n,r)&&(l&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a))}}function Ts(e){return Rs(zs(e))}function Ps(e,t){return"translate("+e+","+t+")"}function qs(e){return"rotate("+e+")"}function Ls(e){return Ps(e.x||0,e.y||0)}function Ns(e){return Ps(e.x||0,e.y||0)+(e.angle?" "+qs(e.angle):"")+(e.scaleX||e.scaleY?" "+(t=e.scaleX||1,n=e.scaleY||1,"scale("+t+","+n+")"):"");var t,n}function Us(e,t,n){function r(e,n){var r=n.x||0,i=n.y||0,a=n.angle||0;e.translate(r,i),a&&e.rotate(a*=eo),e.beginPath(),t(e,n),a&&e.rotate(-a),e.translate(-r,-i)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",Ns(n)),e("d",t(null,n))},bound:function(e,n){var r=n.x||0,i=n.y||0;return t(rs(e),n),Qo(e,n).translate(r,i),n.angle&&e.rotate(n.angle*eo,r,i),e},draw:Ss(r),pick:Ts(r),isect:n||ps(r)}}var Is=Us("arc",(function(e,t){return So.context(e)(t)}));function js(e,t,n){function r(e,n){e.beginPath(),t(e,n)}var i=zs(r);return{type:e,tag:"path",nested:!0,attr:function(e,n){var r=n.mark.items;r.length&&e("d",t(null,r))},bound:function(e,n){var r=n.items;return 0===r.length?e:(t(rs(e),r),Qo(e,r[0]))},draw:Bs(r),pick:function(e,t,n,r,a,u){var o=t.items,s=t.bounds;return!o||!o.length||s&&!s.contains(a,u)?null:(n*=e.pixelRatio,r*=e.pixelRatio,i(e,o,n,r)?o[0]:null)},isect:ms,tip:n}}var $s=js("area",(function(e,t){var n=t[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Oo:Bo).curve(Ju(r,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,r,i="horizontal"===e[0].orient?t[1]:t[0],a="horizontal"===e[0].orient?"y":"x",u=e.length,o=1/0;--u>=0;)!1!==e[u].defined&&(r=Math.abs(e[u][a]-i)).5&&t<1.5?.5-Math.abs(t-1):0}function Gs(e,t){var n=Hs(t);e("d",Lo(null,t,n,n))}function Ys(e,t,n,r){var i=Hs(t);e.beginPath(),Lo(e,t,(n||0)+i,(r||0)+i)}var Vs=zs(Ys),Xs=zs(Ys,!1);var Js={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",Ls(t))},bound:function(e,t){if(!t.clip&&t.items)for(var n=t.items,r=n.length,i=0;im||av)))return e.save(),e.translate(h,p),h=i-h,p=a-p,y&&qo(l)&&!Vs(e,l,o,s)?(e.restore(),null):(f=l.strokeForeground,(d=!1!==t.interactive)&&f&&l.stroke&&Xs(e,l,o,s)?(e.restore(),l):(!(c=Fs(l,(function(e){return function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,h,p)?u.pick(e,n,r,h,p):null})))&&d&&(l.fill||!f&&l.stroke)&&Vs(e,l,o,s)&&(c=l),e.restore(),c||null))}))},isect:vs,content:function(e,t,n){e("clip-path",t.clip?Io(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Gs(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Gs(e,t):e("d","")}},Ks={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function Qs(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then((function(t){e.image=t,e.image.url=e.url}))),n}function Zs(e,t){return null!=e.width?e.width:t&&t.width?!1!==e.aspect&&e.height?e.height*t.width/t.height:t.width:0}function el(e,t){return null!=e.height?e.height:t&&t.height?!1!==e.aspect&&e.width?e.width*t.height/t.width:t.height:0}function tl(e,t){return"center"===e?t/2:"right"===e?t:0}function nl(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var rl={type:"image",tag:"image",nested:!1,attr:function(e,t,n){var r=Qs(t,n),i=Zs(t,r),a=el(t,r),u=(t.x||0)-tl(t.align,i),o=(t.y||0)-nl(t.baseline,a);e("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",Ks["xmlns:xlink"],"xlink:href"),e("transform",Ps(u,o)),e("width",i),e("height",a),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){var n=t.image,r=Zs(t,n),i=el(t,n),a=(t.x||0)-tl(t.align,r),u=(t.y||0)-nl(t.baseline,i);return e.set(a,u,a+r,u+i)},draw:function(e,t,n){var r=this;Es(t,(function(t){if(!n||n.intersects(t.bounds)){var i,a,u,o,s=Qs(t,r),l=Zs(t,s),c=el(t,s),f=(t.x||0)-tl(t.align,l),d=(t.y||0)-nl(t.baseline,c);!1!==t.aspect&&(a=s.width/s.height,u=t.width/t.height,a==a&&u==u&&a!==u&&(u=0;)if(!1!==e[a].defined&&(n=e[a].x-t[0])*n+(r=e[a].y-t[1])*r1?t:t[0]:t;var t}function Al(e){var t=kl(e);return(W(t)?t.length-1:0)*_l(e)}function wl(e,t){var n=null==t?"":(t+"").trim();return e.limit>0&&n.length?function(e,t){var n=+e.limit,r=function(e){if(pl.width===yl){var t=Cl(e);return function(e){return bl(e,t)}}var n=xl(e);return function(e){return gl(e,n)}}(e);if(r(t)>>1,r(t.slice(i))>n?o=i+1:s=i;return a+t.slice(o)}for(;o>>1),r(t.slice(0,i))=0;)if(!1!==e[i].defined&&(n=e[i].x-t[0])*n+(r=e[i].y-t[1])*r<(n=e[i].size||1)*n)return e[i];return null}))};function Rl(e,t,n){var r=Ol[e.mark.marktype],i=t||r.bound;return r.nested&&(e=e.mark),i(e.bounds||(e.bounds=new jo),e,n)}var zl={mark:null};function Tl(e,t,n){var r,i,a,u,o=Ol[e.marktype],s=o.bound,l=e.items,c=l&&l.length;if(o.nested)return c?a=l[0]:(zl.mark=e,a=zl),u=Rl(a,s,n),t=t&&t.union(u)||u;if(t=t||e.bounds&&e.bounds.clear()||new jo,c)for(r=0,i=l.length;rt;)e.removeChild(n[--r]);return e}function Gl(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Yl(e,t){var n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function Vl(e,t){this._active=null,this._handlers={},this._loader=e||Ur(),this._tooltip=t||Xl}function Xl(e,t,n,r){e.element().setAttribute("title",r||"")}Ul.toJSON=function(e){return ql(this.root,e||0)},Ul.mark=function(e,t,n){var r=Il(e,t=t||this.root.items[0]);return t.items[n]=r,r.zindex&&(r.group.zdirty=!0),r};var Jl=Vl.prototype;function Kl(e){this._el=null,this._bgcolor=null,this._loader=new Vo(e)}Jl.initialize=function(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)},Jl.element=function(){return this._el},Jl.canvas=function(){return this._el&&this._el.firstChild},Jl.origin=function(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},Jl.scene=function(e){return arguments.length?(this._scene=e,this):this._scene},Jl.on=function(){},Jl.off=function(){},Jl._handlerIndex=function(e,t,n){for(var r=e?e.length:0;--r>=0;)if(e[r].type===t&&(!n||e[r].handler===n))return r;return-1},Jl.handlers=function(e){var t=this._handlers,n=[];if(e)n.push.apply(n,t[this.eventName(e)]);else for(var r in t)n.push.apply(n,t[r]);return n},Jl.eventName=function(e){var t=e.indexOf(".");return t<0?e:e.slice(0,t)},Jl.handleHref=function(e,t,n){this._loader.sanitize(n,{context:"href"}).then((function(t){var n=new MouseEvent(e.type,e),r=jl(null,"a");for(var i in t)r.setAttribute(i,t[i]);r.dispatchEvent(n)})).catch((function(){}))},Jl.handleTooltip=function(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,r){var i,a,u=e&&e.mark;if(u&&(i=Ol[u.marktype]).tip){for((a=Yl(t,n))[0]-=r[0],a[1]-=r[1];e=e.mark.group;)a[0]-=e.x||0,a[1]-=e.y||0;e=i.tip(u.items,a)}return e}(t,e,this.canvas(),this._origin);var r=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,r)}},Jl.getItemBoundingClientRect=function(e){var t=this.canvas();if(t){for(var n=t.getBoundingClientRect(),r=this._origin,i=e.bounds,a=i.width(),u=i.height(),o=i.x1+r[0]+n.left,s=i.y1+r[1]+n.top;e.mark&&(e=e.mark.group);)o+=e.x||0,s+=e.y||0;return{x:o,y:s,width:a,height:u,left:o,top:s,right:o+a,bottom:s+u}}};var Ql=Kl.prototype;Ql.initialize=function(e,t,n,r,i){return this._el=e,this.resize(t,n,r,i)},Ql.element=function(){return this._el},Ql.canvas=function(){return this._el&&this._el.firstChild},Ql.background=function(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)},Ql.resize=function(e,t,n,r){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=r||1,this},Ql.dirty=function(){},Ql.render=function(e){var t=this;return t._call=function(){t._render(e)},t._call(),t._call=null,t},Ql._render=function(){},Ql.renderAsync=function(e){var t=this.render(e);return this._ready?this._ready.then((function(){return t})):Promise.resolve(t)},Ql._load=function(e,t){var n=this,r=n._loader[e](t);if(!n._ready){var i=n._call;n._ready=n._loader.ready().then((function(e){e&&i(),n._ready=null}))}return r},Ql.sanitizeURL=function(e){return this._load("sanitizeURL",e)},Ql.loadImage=function(e){return this._load("loadImage",e)};var Zl="dragleave",ec="mousedown",tc="mousemove",nc="mouseout",rc="click",ic=["keydown","keypress","keyup","dragenter",Zl,"dragover",ec,"mouseup",tc,nc,"mouseover",rc,"dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],ac=tc,uc=nc,oc=rc;function sc(e,t){Vl.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}var lc=Re(sc,Vl);lc.initialize=function(e,t,n){var r=this;return this._canvas=e&&$l(e,"canvas"),[rc,ec,tc,nc,Zl].forEach((function(e){return cc(r,e)})),Vl.prototype.initialize.call(this,e,t,n)};function cc(e,t){(function(e){return"touchstart"===e||"touchmove"===e||"touchend"===e?["touchstart","touchmove","touchend"]:[e]})(t).forEach((function(t){return function(e,t){var n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?function(n){return e[t](n)}:function(n){return e.fire(t,n)}))}(e,t)}))}function fc(e,t,n){return function(r){var i=this._active,a=this.pickEvent(r);a===i||(i&&i.exit||this.fire(n,r),this._active=a,this.fire(t,r)),this.fire(e,r)}}function dc(e){return function(t){this.fire(e,t),this._active=null}}lc.canvas=function(){return this._canvas},lc.context=function(){return this._canvas.getContext("2d")},lc.events=ic,lc.DOMMouseScroll=function(e){this.fire("mousewheel",e)},lc.mousemove=fc(tc,"mouseover",nc),lc.dragover=fc("dragover","dragenter",Zl),lc.mouseout=dc(nc),lc.dragleave=dc(Zl),lc.mousedown=function(e){this._down=this._active,this.fire(ec,e)},lc.click=function(e){this._down===this._active&&(this.fire(rc,e),this._down=null)},lc.touchstart=function(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",e,!0)},lc.touchmove=function(e){this.fire("touchmove",e,!0)},lc.touchend=function(e){this.fire("touchend",e,!0),this._touch=null},lc.fire=function(e,t,n){var r=n?this._touch:this._active,i=this._handlers[e];if(t.vegaType=e,e===oc&&r&&r.href?this.handleHref(t,r,r.href):e!==ac&&e!==uc||this.handleTooltip(t,r,e!==uc),i)for(var a=0,u=i.length;a=0&&r.splice(i,1),this},lc.pickEvent=function(e){var t=Yl(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])},lc.pick=function(e,t,n,r,i){var a=this.context();return Ol[e.marktype].pick.call(this,a,e,t,n,r,i)};var hc="undefined"!=typeof window&&window.devicePixelRatio||1;function pc(e){Kl.call(this,e),this._options={},this._redraw=!1,this._dirty=new jo,this._tempb=new jo}var mc=Re(pc,Kl),vc=Kl.prototype;mc.initialize=function(e,t,n,r,i,a){return this._options=a||{},this._canvas=this._options.externalContext?null:Go(1,1,this._options.type),e&&this._canvas&&(Hl(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),vc.initialize.call(this,e,t,n,r,i)},mc.resize=function(e,t,n,r){if(vc.resize.call(this,e,t,n,r),this._canvas)!function(e,t,n,r,i,a){var u="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,o=e.getContext("2d"),s=u?hc:i;for(var l in e.width=t*s,e.height=n*s,a)o[l]=a[l];u&&1!==s&&(e.style.width=t+"px",e.style.height=n+"px"),o.pixelRatio=s,o.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{var i=this._options.externalContext;i||O("CanvasRenderer is missing a valid canvas or context"),i.scale(this._scale,this._scale),i.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},mc.canvas=function(){return this._canvas},mc.context=function(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},mc.dirty=function(e){for(var t=this._tempb.clear().union(e.bounds),n=e.mark.group;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)};function gc(e,t){Vl.call(this,e,t);var n=this;n._hrefHandler=bc(n,(function(e,t){t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=bc(n,(function(e,t){n.handleTooltip(e,t,e.type!==uc)}))}mc._render=function(e){var t=this.context(),n=this._origin,r=this._width,i=this._height,a=this._dirty,u=function(e,t,n){return(new jo).set(0,0,t,n).translate(-e[0],-e[1])}(n,r,i);t.save();var o=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):function(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(t,u.intersect(a),n);return this.clear(-n[0],-n[1],r,i),this.draw(t,e,o),t.restore(),a.clear(),this},mc.draw=function(e,t,n){var r=Ol[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),ge(n)?(e.beginPath(),n(e),e.clip()):Ws(e,t.group)}(e,t),r.draw.call(this,e,t,n),t.clip&&e.restore()},mc.clear=function(e,t,n,r){var i=this._options,a=this.context();"pdf"===i.type||i.externalContext||a.clearRect(e,t,n,r),null!=this._bgcolor&&(a.fillStyle=this._bgcolor,a.fillRect(e,t,n,r))};var yc=Re(gc,Vl);yc.initialize=function(e,t,n){var r=this._svg;return r&&(r.removeEventListener(oc,this._hrefHandler),r.removeEventListener(ac,this._tooltipHandler),r.removeEventListener(uc,this._tooltipHandler)),this._svg=r=e&&$l(e,"svg"),r&&(r.addEventListener(oc,this._hrefHandler),r.addEventListener(ac,this._tooltipHandler),r.addEventListener(uc,this._tooltipHandler)),Vl.prototype.initialize.call(this,e,t,n)},yc.canvas=function(){return this._svg};var bc=function(e,t){return function(n){var r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,t.call(e._obj,n,r)}};function xc(e,t,n){var r=e-t+2*n;return e?r>0?r:1:0}yc.on=function(e,t){var n=this.eventName(e),r=this._handlers;if(this._handlerIndex(r[n],e,t)<0){var i={type:e,handler:t,listener:bc(this,t)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},yc.off=function(e,t){var n=this.eventName(e),r=this._handlers[n],i=this._handlerIndex(r,e,t);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this};var _c="log",kc="time",Ac="utc",wc="continuous";function Dc(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Cc(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}var Mc=Symbol("implicit");function Ec(){var e=new Map,t=[],n=[],r=Mc;function i(i){var a=i+"",u=e.get(a);if(!u){if(r!==Mc)return r;e.set(a,u=t.push(i))}return n[(u-1)%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Map;var r,a=_createForOfIteratorHelper(n);try{for(a.s();!(r=a.n()).done;){var u=r.value,o=u+"";e.has(o)||e.set(o,t.push(u))}}catch(e){a.e(e)}finally{a.f()}return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Ec(t,n).unknown(r)},Dc.apply(i,arguments),i}function Fc(e){return+e}var Sc=[0,1];function Bc(e){return e}function Oc(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function Rc(e,t,n){var r=e[0],i=e[1],a=t[0],u=t[1];return it&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(u[0],u[e-1])),r=e>2?zc:Rc,i=a=null,d}function d(t){return isNaN(t=+t)?n:(i||(i=r(u.map(e),o,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(o,u.map(e),s.interpolateNumber)))(n)))},d.domain=function(e){return arguments.length?(u=Array.from(e,Fc),f()):u.slice()},d.range=function(e){return arguments.length?(o=Array.from(e),f()):o.slice()},d.rangeRound=function(e){return o=Array.from(e),l=s.interpolateRound,f()},d.clamp=function(e){return arguments.length?(c=!!e||Bc,f()):c!==Bc},d.interpolate=function(e){return arguments.length?(l=e,f()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,f()}}function qc(){return Pc()(Bc,Bc)}function Lc(e,t,n,i){var a,u=vn(e,t,n);switch((i=r.formatSpecifier(null==i?",f":i)).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(a=r.precisionPrefix(u,o))||(i.precision=a),r.formatPrefix(i,o);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(a=r.precisionRound(u,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=a-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(a=r.precisionFixed(u))||(i.precision=a-2*("%"===i.type))}return r.format(i)}function Nc(e){var t=e.domain;return e.ticks=function(e){var n=t();return pn(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return Lc(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i=t(),a=0,u=i.length-1,o=i[a],s=i[u];return s0?r=mn(o=Math.floor(o/r)*r,s=Math.ceil(s/r)*r,n):r<0&&(r=mn(o=Math.ceil(o*r)/r,s=Math.floor(s*r)/r,n)),r>0?(i[a]=Math.floor(o/r)*r,i[u]=Math.ceil(s/r)*r,t(i)):r<0&&(i[a]=Math.ceil(o*r)/r,i[u]=Math.floor(s*r)/r,t(i)),e},e}function Uc(e,t){var n,r=0,i=(e=e.slice()).length-1,a=e[r],u=e[i];return u0){for(;d<=h;++d)for(c=1,l=n(d);cs)break;m.push(f)}}else for(;d<=h;++d)for(c=u-1,l=n(d);c>=1;--c)if(!((f=l*c)s)break;m.push(f)}2*m.lengtha[1-c])))return n=Math.max(0,un(f,s)-1),u=s===l?n:un(f,l)-1,s-f[n]>t+1e-10&&++n,c&&(o=n,n=d-u,u=d-o),n>u?void 0:r().slice(n,u+1)}},n.invert=function(e){var t=n.invertRange([e,e]);return t?t[0]:t},n.copy=function(){return df().domain(r()).range(a).round(u).paddingInner(o).paddingOuter(s).align(l)},c()}var hf=Array.prototype.map;function pf(e){return hf.call(e,(function(e){return+e}))}var mf=Array.prototype.slice;var vf={};function gf(e,t,n){var r=function(){var n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){var n,r=t[0],i=t[1];return i=o&&u[i]<=s&&(l<0&&(l=i),n=i);if(!(l<0))return o=e.invertExtent(u[l]),s=e.invertExtent(u[n]),[void 0===o[0]?o[1]:o[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=e,n};return r.metadata=Qe(me(n)),r}function yf(e,t,n){return arguments.length>1?(vf[e]=gf(e,t,n),this):bf(e)?vf[e]:void 0}function bf(e){return Fe(vf,e)}function xf(e,t){var n=vf[e];return n&&n.metadata[t]}function _f(e){return xf(e,wc)}function kf(e){return xf(e,"discrete")}function Af(e){return xf(e,"discretizing")}function wf(e){return xf(e,_c)}function Df(e){return xf(e,"interpolating")}function Cf(e){return xf(e,"quantile")}yf("identity",(function e(t){var n;function r(e){return isNaN(e=+e)?n:e}return r.invert=r,r.domain=r.range=function(e){return arguments.length?(t=Array.from(e,Fc),r):t.slice()},r.unknown=function(e){return arguments.length?(n=e,r):n},r.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,Fc):[0,1],Nc(r)})),yf("linear",(function e(){var t=qc();return t.copy=function(){return Tc(t,e())},Dc.apply(t,arguments),Nc(t)}),wc),yf(_c,(function e(){var t=Yc(Pc()).domain([1,10]);return t.copy=function(){return Tc(t,e()).base(t.base())},Dc.apply(t,arguments),t}),[wc,_c]),yf("pow",tf,wc),yf("sqrt",(function(){return tf.apply(null,arguments).exponent(.5)}),wc),yf("symlog",(function e(){var t=Jc(Pc());return t.copy=function(){return Tc(t,e()).constant(t.constant())},Dc.apply(t,arguments)}),wc),yf(kc,(function(){return Dc.apply(af(i.timeYear,i.timeMonth,i.timeWeek,i.timeDay,i.timeHour,i.timeMinute,i.timeSecond,i.timeMillisecond,a.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[wc,"temporal"]),yf(Ac,(function(){return Dc.apply(af(i.utcYear,i.utcMonth,i.utcWeek,i.utcDay,i.utcHour,i.utcMinute,i.utcSecond,i.utcMillisecond,a.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[wc,"temporal"]),yf("sequential",sf,[wc,"interpolating"]),yf("".concat("sequential","-").concat("linear"),sf,[wc,"interpolating"]),yf("".concat("sequential","-").concat(_c),(function e(){var t=Yc(uf()).domain([1,10]);return t.copy=function(){return of(t,e()).base(t.base())},Cc.apply(t,arguments)}),[wc,"interpolating",_c]),yf("".concat("sequential","-").concat("pow"),lf,[wc,"interpolating"]),yf("".concat("sequential","-").concat("sqrt"),(function(){return lf.apply(null,arguments).exponent(.5)}),[wc,"interpolating"]),yf("".concat("sequential","-").concat("symlog"),(function e(){var t=Jc(uf());return t.copy=function(){return of(t,e()).constant(t.constant())},Cc.apply(t,arguments)}),[wc,"interpolating"]),yf("".concat("diverging","-").concat("linear"),(function e(){var t=Nc(cf()(Bc));return t.copy=function(){return of(t,e())},Cc.apply(t,arguments)}),[wc,"interpolating"]),yf("".concat("diverging","-").concat(_c),(function e(){var t=Yc(cf()).domain([.1,1,10]);return t.copy=function(){return of(t,e()).base(t.base())},Cc.apply(t,arguments)}),[wc,"interpolating",_c]),yf("".concat("diverging","-").concat("pow"),ff,[wc,"interpolating"]),yf("".concat("diverging","-").concat("sqrt"),(function(){return ff.apply(null,arguments).exponent(.5)}),[wc,"interpolating"]),yf("".concat("diverging","-").concat("symlog"),(function e(){var t=Jc(cf());return t.copy=function(){return of(t,e()).constant(t.constant())},Cc.apply(t,arguments)}),[wc,"interpolating"]),yf("quantile",(function e(){var t,n=[],r=[],i=[];function a(){var e=0,t=Math.max(1,r.length);for(i=new Array(t-1);++e0?i[t-1]:n[0],t=i?[a[i-1],r]:[a[t-1],a[t]]},o.unknown=function(e){return arguments.length?(t=e,o):o},o.thresholds=function(){return a.slice()},o.copy=function(){return e().domain([n,r]).range(u).unknown(t)},Dc.apply(Nc(o),arguments)}),"discretizing"),yf("threshold",(function e(){var t,n=[.5],r=[0,1],i=1;function a(e){return e<=e?r[un(n,e,0,i)]:t}return a.domain=function(e){return arguments.length?(n=Array.from(e),i=Math.min(n.length,r.length-1),a):n.slice()},a.range=function(e){return arguments.length?(r=Array.from(e),i=Math.min(n.length,r.length-1),a):r.slice()},a.invertExtent=function(e){var t=r.indexOf(e);return[n[t-1],n[t]]},a.unknown=function(e){return arguments.length?(t=e,a):t},a.copy=function(){return e().domain(n).range(r).unknown(t)},Dc.apply(a,arguments)}),"discretizing"),yf("bin-ordinal",(function e(){var t=[],n=[];function r(e){return null==e||e!=e?void 0:n[(un(t,e)-1)%n.length]}return r.domain=function(e){return arguments.length?(t=pf(e),r):t.slice()},r.range=function(e){return arguments.length?(n=mf.call(e),r):n.slice()},r.tickFormat=function(e,n){return Lc(t[0],J(t),null==e?10:e,n)},r.copy=function(){return e().domain(r.domain()).range(r.range())},r}),["discrete","discretizing"]),yf("ordinal",Ec,"discrete"),yf("band",df,"discrete"),yf("point",(function(){return function e(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return e(n())},t}(df().paddingInner(1))}),"discrete");var Mf=["clamp","base","constant","exponent"];function Ef(e,t){var n=t[0],r=J(t)-n;return function(t){return e(n+t*r)}}function Ff(e,t,n){return s.piecewise(Of(t||"rgb",n),e)}function Sf(e,t){for(var n=new Array(t),r=t+1,i=0;i1?(Tf[e]=t,this):Tf[e]}zf({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},Rf),zf({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(function(e){return Ff(Rf(e))}));var qf=function(e){return W(e)?e.map((function(e){return String(e)})):String(e)},Lf=function(e,t){return e[1]-t[1]},Nf=function(e,t){return t[1]-e[1]};function Uf(e,t,n){var r;return qe(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor(Ge(e.domain())/n||1)))),H(t)&&(r=t.step,t=t.interval),Ne(t)&&(t=e.type===kc?hr(t):e.type==Ac?pr(t):O("Only time and utc scales accept interval strings."),r&&(t=t.every(r))),t}function If(e,t,n){var r=e.range(),i=r[0],a=J(r),u=Lf;if(i>a&&(r=a,a=i,i=r,u=Nf),i=Math.floor(i),a=Math.ceil(a),t=t.map((function(t){return[t,e(t)]})).filter((function(e){return i<=e[1]&&e[1]<=a})).sort(u).map((function(e){return e[0]})),n>0&&t.length>1){for(var o=[t[0],J(t)];t.length>n&&t.length>=3;)t=t.filter((function(e,t){return!(t%2)}));t.length<3&&(t=o)}return t}function jf(e,t){return e.bins?If(e,e.bins):e.ticks?e.ticks(t):e.domain()}function $f(e,t,n,r,i,a){var u=t.type,o=qf;if(u===kc||i===kc)o=e.timeFormat(r);else if(u===Ac||i===Ac)o=e.utcFormat(r);else if(wf(u)){var s=e.formatFloat(r);if(a||t.bins)o=s;else{var l=Wf(t,n,!1);o=function(e){return l(e)?s(e):""}}}else if(t.tickFormat){var c=t.domain();o=e.formatSpan(c[0],c[c.length-1],n,r)}else r&&(o=e.format(r));return o}function Wf(e,t,n){var r=jf(e,t),i=e.base(),a=Math.log(i),u=Math.max(1,i*t/r.length),o=function(e){var t=e/Math.pow(i,Math.round(Math.log(e)/a));return t*i1?i[1]-i[0]:i[0];for(r=1;rr?o.slice(0,r-2).map(i).join(", ")+", ending with "+o.slice(-1).map(i):o.map(i).join(", ");return"".concat(s," value").concat(1===s?"":"s",": ").concat(l)}var c=t.domain();return"values from ".concat(i(c[0])," to ").concat(i(J(c)))}var Zf=function(e,t,n){var r;return _defineProperty(r={},"role",e),_defineProperty(r,"aria-roledescription",t),_defineProperty(r,"aria-label",n||void 0),r},ed=Qe(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),td={axis:{desc:"axis",caption:function(e){var t=e.datum,n=e.orient,r=t.title?ud(e):null,i=e.context,a=i.scales[t.scale].value,u=i.dataflow.locale(),o=a.type;return"".concat("left"===n||"right"===n?"Y":"X","-axis")+(r?" titled '".concat(r,"'"):"")+" for a ".concat(kf(o)?"discrete":o," scale")+" with ".concat(Qf(u,a,e))}},legend:{desc:"legend",caption:function(e){var t=e.datum,n=t.title?ud(e):null,r="".concat(t.type||""," legend").trim(),i=t.scales,a=Object.keys(i),u=e.context,o=u.scales[i[a[0]]].value,s=u.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?" titled '".concat(n,"'"):"")+" for ".concat(function(e){return(e=e.map((function(e){return e+("fill"===e||"stroke"===e?" color":"")}))).length<2?e[0]:e.slice(0,-1).join(", ")+" and "+J(e)}(a))+" with ".concat(Qf(s,o,e));var l}},"title-text":{desc:"title",caption:function(e){return"Title text '".concat(ad(e),"'")}},"title-subtitle":{desc:"subtitle",caption:function(e){return"Subtitle text '".concat(ad(e),"'")}}},nd={ariaRole:"role",ariaRoleDescription:"aria-roledescription",description:"aria-label"};function rd(e,t){var n=!1===t.aria;if(e("aria-hidden",n||void 0),n||null==t.description)for(var r in nd)e(nd[r],void 0);else{var i=t.mark.marktype;e("aria-label",t.description),e("role",t.ariaRole||("group"===i?"graphics-object":"graphics-symbol")),e("aria-roledescription",t.ariaRoleDescription||"".concat(i," mark"))}}function id(e){return!1===e.aria?_defineProperty({},"aria-hidden",!0):ed[e.role]?null:td[e.role]?function(e,t){try{var n=e.items[0],r=t.caption||function(){return""};return Zf(t.role||"graphics-symbol",t.desc,n.description||r(n))}catch(e){return null}}(e,td[e.role]):function(e){var t=e.marktype,n="group"===t||"text"===t||e.items.some((function(e){return null!=e.description&&!1!==e.aria}));return Zf(n?"graphics-object":"graphics-symbol","".concat(t," mark container"),e.description)}(e)}function ad(e){return me(e.text).join(" ")}function ud(e){try{return me(J(e.items).items[0].text).join(" ")}catch(e){return null}}var od=function(e){return(e+"").replace(/&/g,"&").replace(/"/g,""")};function sd(e,t,n){var r,i,a="<"+e;if(t)for(r in t)null!=(i=t[r])&&(a+=" "+r+'="'+od(i)+'"');return n&&(a+=" "+n),a+">"}function ld(e){return""}var cd={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity",blend:"mix-blend-mode"},fd={fill:"none","stroke-miterlimit":10},dd=Ks.xmlns;function hd(e){Kl.call(this,e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var pd=Re(hd,Kl),md=Kl.prototype;function vd(e,t,n){var r,i,a;if("radial"===t.gradient){var u=Wl(e,n++,"pattern",dd);u.setAttribute("id","p_"+t.id),u.setAttribute("viewBox","0,0,1,1"),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("preserveAspectRatio","xMidYMid slice"),(u=Wl(u,0,"rect",dd)).setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","url("+Cd()+"#"+t.id+")"),(e=Wl(e,n++,"radialGradient",dd)).setAttribute("id",t.id),e.setAttribute("fx",t.x1),e.setAttribute("fy",t.y1),e.setAttribute("fr",t.r1),e.setAttribute("cx",t.x2),e.setAttribute("cy",t.y2),e.setAttribute("r",t.r2)}else(e=Wl(e,n++,"linearGradient",dd)).setAttribute("id",t.id),e.setAttribute("x1",t.x1),e.setAttribute("x2",t.x2),e.setAttribute("y1",t.y1),e.setAttribute("y2",t.y2);for(r=0,i=t.stops.length;r1&&e.previousSibling!=t}(u,n))&&t.insertBefore(u,n?n.nextSibling:t.firstChild),u}pd.initialize=function(e,t,n,r){if(this._defs={gradient:{},clipping:{}},e){for(var i in this._svg=Wl(e,0,"svg",dd),this._svg.setAttribute("class","marks"),Hl(e,1),this._root=Wl(this._svg,0,"g",dd),fd)this._root.setAttribute(i,fd[i]);Hl(this._svg,1)}return this.background(this._bgcolor),md.initialize.call(this,e,t,n,r)},pd.background=function(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),md.background.apply(this,arguments)},pd.resize=function(e,t,n,r){return md.resize.call(this,e,t,n,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},pd.canvas=function(){return this._svg},pd.svg=function(){if(!this._svg)return null;var e={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var t in Ks)e[t]=Ks[t];var n=this._bgcolor?sd("rect",{width:this._width,height:this._height,fill:this._bgcolor})+ld("rect"):"";return sd("svg",e)+(this._defs.el?this._defs.el.outerHTML:"")+n+this._root.outerHTML+ld("svg")},pd._render=function(e){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,e),Hl(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},pd.updateDefs=function(){var e=this._svg,t=this._defs,n=t.el,r=0;for(var i in t.gradient)n||(t.el=n=Wl(e,0,"defs",dd)),r=vd(n,t.gradient[i],r);for(var a in t.clipping)n||(t.el=n=Wl(e,0,"defs",dd)),r=gd(n,t.clipping[a],r);n&&(0===r?(e.removeChild(n),t.el=null):Hl(n,r))},pd._resetDefs=function(){var e=this._defs;e.gradient={},e.clipping={}},pd.dirty=function(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},pd.isDirty=function(e){return this._dirtyAll||!e._svg||e.dirty===this._dirtyID},pd._dirtyCheck=function(){this._dirtyAll=!0;var e=this._dirty;if(!e.length||!this._dirtyID)return!0;var t,n,r,i,a,u,o,s=++this._dirtyID;for(a=0,u=e.length;a/g,">")}Ed.resize=function(e,t,n,r){Fd.resize.call(this,e,t,n,r);var i=this._origin,a=this._text,u={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var o in Ks)u[o]=Ks[o];a.head=sd("svg",u);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),a.bg=s?sd("rect",{width:this._width,height:this._height,fill:s})+ld("rect"):"",a.root=sd("g",De({},fd,{transform:"translate("+i+")"})),a.foot=ld("g")+ld("svg"),this},Ed.background=function(){var e=Fd.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),e},Ed.svg=function(){var e=this._text;return e.head+e.defs+e.bg+e.root+e.body+e.foot},Ed._render=function(e){return this._text.body=this.mark(e),this._text.defs=this.buildDefs(),this},Ed.buildDefs=function(){var e,t="";for(var n in this._defs.gradient){var r=this._defs.gradient[n],i=r.stops;"radial"===r.gradient?(t+=sd(e="pattern",{id:"p_"+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t+=sd("rect",{width:"1",height:"1",fill:"url(#"+n+")"})+ld("rect"),t+=ld(e),t+=sd(e="radialGradient",{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t+=sd(e="linearGradient",{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(var a=0;a1?(Od[e]=t,this):Od[e]}function zd(e,t,n){var r=[],i=(new jo).union(t),a=e.marktype;return a?Td(e,i,n,r):"group"===a?Pd(e,i,n,r):O("Intersect scene must be mark node or group item.")}function Td(e,t,n,r){if(function(e,t,n){return e.bounds&&t.intersects(e.bounds)&&("group"===e.marktype||!1!==e.interactive&&(!n||n(e)))}(e,t,n)){var i=e.items,a=e.marktype,u=i.length,o=0;if("group"===a)for(;o=0;r--)if(i[r]!=a[r])return!1;for(r=i.length-1;r>=0;r--)if(n=i[r],!Ud(e[n],t[n],n))return!1;return _typeof(e)===_typeof(t)}(e,t):e==t)}function Id(e,t){return Ud(Zu(e),Zu(t))}function jd(e){ci.call(this,null,e)}function $d(e,t,n){return t(e.bounds.clear(),e,n)}Re(jd,ci).transform=function(e,t){var n,r=t.dataflow,i=e.mark,a=i.marktype,u=Ol[a],o=u.bound,s=i.bounds;if(u.nested)i.items.length&&r.dirty(i.items[0]),s=$d(i,o),i.items.forEach((function(e){e.bounds.clear().union(s)}));else if("group"===a||e.modified())switch(t.visit(t.MOD,(function(e){return r.dirty(e)})),s.clear(),i.items.forEach((function(e){return s.union($d(e,o))})),i.role){case"axis":case"legend":case"title":t.reflow()}else n=t.changed(t.REM),t.visit(t.ADD,(function(e){s.union($d(e,o))})),t.visit(t.MOD,(function(e){n=n||s.alignsWith(e.bounds),r.dirty(e),s.union($d(e,o))})),n&&(s.clear(),i.items.forEach((function(e){return s.union(e.bounds)})));return Nd(i),t.modifies("bounds")};function Wd(e){ci.call(this,0,e)}function Hd(e){ci.call(this,null,e)}function Gd(e){ci.call(this,null,e)}Wd.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},Re(Wd,ci).transform=function(e,t){var n=function(e){var t=e._signals[":vega_identifier:"];t||(e._signals[":vega_identifier:"]=t=e.add(0));return t}(t.dataflow),r=n.value,i=e.as;return t.visit(t.ADD,(function(e){e[i]||(e[i]=++r)})),n.set(this.value=r),t},Re(Hd,ci).transform=function(e,t){var n=this.value;n||((n=t.dataflow.scenegraph().mark(e.markdef,function(e){var t=e.groups,n=e.parent;return t&&1===t.size?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}(e),e.index)).group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);var r="group"===n.marktype?Ho:Wo;return t.visit(t.ADD,(function(e){return r.call(e,n)})),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t};var Yd=Re(Gd,ci),Vd={parity:function(e){return e.filter((function(e,t){return t%2?e.opacity=0:1}))},greedy:function(e,t){var n;return e.filter((function(e,r){return r&&Xd(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)}))}};function Xd(e,t,n){return n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2)}function Jd(e,t){for(var n,r=1,i=e.length,a=e[0].bounds;r1&&t.height()>1}function Qd(e){return e.forEach((function(e){return e.opacity=1})),e}function Zd(e,t){return e.reflow(t.modified()).modifies("opacity")}function eh(e){ci.call(this,null,e)}Yd.transform=function(e,t){var n,r,i,a=Vd[e.method]||Vd.parity,u=t.materialize(t.SOURCE).source,o=e.separation||0;if(u&&u.length){if(!e.method)return e.modified("method")&&(Qd(u),t=Zd(t,e)),t;if((u=u.filter(Kd)).length){if(e.sort&&(u=u.slice().sort(e.sort)),n=Qd(u),t=Zd(t,e),n.length>=3&&Jd(n,o)){do{n=a(n,o)}while(n.length>=3&&Jd(n,o));n.length<3&&!J(u).opacity&&(n.length>1&&(J(n).opacity=0),J(u).opacity=1)}return e.boundScale&&e.boundTolerance>=0&&(r=function(e,t,n){var r=e.range(),i=new jo;return t===Nu||"bottom"===t?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),function(e){return i.encloses(e.bounds)}}(e.boundScale,e.boundOrient,+e.boundTolerance),u.forEach((function(e){r(e)||(e.opacity=0)}))),i=n[0].mark.bounds.clear(),u.forEach((function(e){e.opacity&&i.union(e.bounds)})),t}}},Re(eh,ci).transform=function(e,t){var n=t.dataflow;if(t.visit(t.ALL,(function(e){return n.dirty(e)})),t.fields&&t.fields.zindex){var r=t.source&&t.source[0];r&&(r.mark.zdirty=!0)}};var th=new jo;function nh(e,t,n){return e[t]===n?0:(e[t]=n,1)}function rh(e){var t=e.items[0].orient;return t===Uu||t===Iu}function ih(e,t,n,r){var i,a,u=t.items[0],o=u.datum,s=null!=u.translate?u.translate:.5,l=u.orient,c=function(e){var t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(o),f=u.range,d=u.offset,h=u.position,p=u.minExtent,m=u.maxExtent,v=o.title&&u.items[c[2]].items[0],g=u.titlePadding,y=u.bounds,b=v&&Al(v),x=0,_=0;switch(th.clear().union(y),y.clear(),(i=c[0])>-1&&y.union(u.items[i].bounds),(i=c[1])>-1&&y.union(u.items[i].bounds),l){case Nu:x=h||0,_=-d,a=Math.max(p,Math.min(m,-y.y1)),y.add(0,-a).add(f,0),v&&ah(e,v,a,g,b,0,-1,y);break;case Uu:x=-d,_=h||0,a=Math.max(p,Math.min(m,-y.x1)),y.add(-a,0).add(0,f),v&&ah(e,v,a,g,b,1,-1,y);break;case Iu:x=n+d,_=h||0,a=Math.max(p,Math.min(m,y.x2)),y.add(0,0).add(a,f),v&&ah(e,v,a,g,b,1,1,y);break;case"bottom":x=h||0,_=r+d,a=Math.max(p,Math.min(m,y.y2)),y.add(0,0).add(f,a),v&&ah(e,v,a,g,0,0,1,y);break;default:x=u.x,_=u.y}return Qo(y.translate(x,_),u),nh(u,"x",x+s)|nh(u,"y",_+s)&&(u.bounds=th,e.dirty(u),u.bounds=y,e.dirty(u)),u.mark.bounds.clear().union(y)}function ah(e,t,n,r,i,a,u,o){var s=t.bounds;if(t.auto){var l=u*(n+i+r),c=0,f=0;e.dirty(t),a?c=(t.x||0)-(t.x=l):f=(t.y||0)-(t.y=l),t.mark.bounds.clear().union(s.translate(-c,-f)),e.dirty(t)}o.union(s)}var uh=function(e,t){return Math.floor(Math.min(e,t))},oh=function(e,t){return Math.ceil(Math.max(e,t))};function sh(e){return(new jo).set(0,0,e.width||0,e.height||0)}function lh(e){var t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function ch(e,t,n){var r=H(e)?e[t]:e;return null!=r?r:void 0!==n?n:0}function fh(e){return e<0?Math.ceil(-e):0}function dh(e,t,n){var r,i,a,u,o,s,l,c,f,d,h,p=!n.nodirty,m="flush"===n.bounds?sh:lh,v=th.set(0,0,0,0),g=ch(n.align,"column"),y=ch(n.align,$u),b=ch(n.padding,"column"),x=ch(n.padding,$u),_=n.columns||t.length,k=_<=0?1:Math.ceil(t.length/_),A=t.length,w=Array(A),D=Array(_),C=0,M=Array(A),E=Array(k),F=0,S=Array(A),B=Array(A),O=Array(A);for(i=0;i<_;++i)D[i]=0;for(i=0;i1)for(i=0;i0&&(S[i]+=f/2);if(y&&ch(n.center,$u)&&1!==_)for(i=0;i0&&(B[i]+=d/2);for(i=0;ii&&(e.warn("Grid headers exceed limit: "+i),t=t.slice(0,i)),w+=a,m=0,g=t.length;m=0&&null==(x=n[v]);v-=d);o?(_=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),k=w):(_=w,k=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),y.union(b.bounds.translate(_-(b.x||0),k-(b.y||0))),b.x=_,b.y=k,e.dirty(b),D=u(D,y[l])}return D}function gh(e,t,n,r,i,a){if(t){e.dirty(t);var u=n,o=n;r?u=Math.round(i.x1+a*i.width()):o=Math.round(i.y1+a*i.height()),t.bounds.translate(u-(t.x||0),o-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=u,t.y=o,e.dirty(t)}}function yh(e,t,n,r,i,a,u){var o=function(e,t){var n=e[t]||{};return function(t,r){return null!=n[t]?n[t]:null!=e[t]?e[t]:r}}(n,t),s=function(e,t){var n=-1/0;return e.forEach((function(e){null!=e.offset&&(n=Math.max(n,e.offset))})),n>-1/0?n:t}(e,o("offset",0)),l=o("anchor","start"),c=l===ju?1:"middle"===l?.5:0,f={align:"each",bounds:o("bounds","flush"),columns:"vertical"===o("direction")?1:e.length,padding:o("margin",8),center:o("center"),nodirty:!0};switch(t){case Uu:f.anchor={x:Math.floor(r.x1)-s,column:ju,y:c*(u||r.height()+2*r.y1),row:l};break;case Iu:f.anchor={x:Math.ceil(r.x2)+s,y:c*(u||r.height()+2*r.y1),row:l};break;case Nu:f.anchor={y:Math.floor(i.y1)-s,row:ju,x:c*(a||i.width()+2*i.x1),column:l};break;case"bottom":f.anchor={y:Math.ceil(i.y2)+s,x:c*(a||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:a-s,y:s,column:ju};break;case"bottom-left":f.anchor={x:s,y:u-s,row:ju};break;case"bottom-right":f.anchor={x:a-s,y:u-s,column:ju,row:ju}}return f}function bh(e,t){var n,r,i,a,u=t.items[0],o=u.datum,s=u.orient,l=u.bounds,c=u.x,f=u.y;return u._bounds?u._bounds.clear().union(l):u._bounds=l.clone(),l.clear(),function(e,t,n){var r=t.padding,i=r-n.x,a=r-n.y;if(t.datum.title){var u=t.items[1].items[0],o=u.anchor,s=t.titlePadding||0,l=r-u.x,c=r-u.y;switch(u.orient){case Uu:i+=Math.ceil(u.bounds.width())+s;break;case Iu:case"bottom":break;default:a+=u.bounds.height()+s}switch((i||a)&&_h(e,n,i,a),u.orient){case Uu:c+=xh(t,n,u,o,1,1);break;case Iu:l+=xh(t,n,u,ju,0,0)+s,c+=xh(t,n,u,o,1,1);break;case"bottom":l+=xh(t,n,u,o,0,0),c+=xh(t,n,u,ju,-1,0,1)+s;break;default:l+=xh(t,n,u,o,0,0)}(l||c)&&_h(e,u,l,c),(l=Math.round(u.bounds.x1-r))<0&&(_h(e,n,-l,0),_h(e,u,-l,0))}else(i||a)&&_h(e,n,i,a)}(e,u,u.items[0].items[0]),l=function(e,t){return e.items.forEach((function(e){return t.union(e.bounds)})),t.x1=e.padding,t.y1=e.padding,t}(u,l),n=2*u.padding,r=2*u.padding,l.empty()||(n=Math.ceil(l.width()+n),r=Math.ceil(l.height()+r)),"symbol"===o.type&&(i=u.items[0].items[0].items[0].items,a=i.reduce((function(e,t){return e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e}),{}),i.forEach((function(e){e.width=a[e.column],e.height=e.bounds.y2-e.y}))),"none"!==s&&(u.x=c=0,u.y=f=0),u.width=n,u.height=r,Qo(l.set(c,f,c+n,f+r),u),u.mark.bounds.clear().union(l),u}function xh(e,t,n,r,i,a,u){var o="symbol"!==e.datum.type,s=n.datum.vgrad,l=(!o||!a&&s||u?t:t.items[0]).bounds[i?"y2":"x2"]-e.padding,c=s&&a?l:0,f=s&&a?0:l,d=i<=0?0:Al(n);return Math.round("start"===r?c:r===ju?f-d:.5*(l-d))}function _h(e,t,n,r){t.x+=n,t.y+=r,t.bounds.translate(n,r),t.mark.bounds.translate(n,r),e.dirty(t)}function kh(e){ci.call(this,null,e)}Re(kh,ci).transform=function(e,t){var n=t.dataflow;return e.mark.items.forEach((function(t){e.layout&&hh(n,t,e.layout),function(e,t,n){var r,i,a,u,o,s=t.items,l=Math.max(0,t.width||0),c=Math.max(0,t.height||0),f=(new jo).set(0,0,l,c),d=f.clone(),h=f.clone(),p=[];for(u=0,o=s.length;un.cleanThreshold)&&n.runAfter(u.clean),r},Re(Mh,ci).transform=function(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,a=t.encode;if(W(a)){if(!n.changed()&&!a.every((function(e){return i[e]})))return t.StopPropagation;a=a[0],n.encode=null}var u="enter"===a,o=i.update||I,s=i.enter||I,l=i.exit||I,c=(a&&!u?i[a]:o)||I;if(t.changed(t.ADD)&&(t.visit(t.ADD,(function(t){s(t,e),o(t,e)})),n.modifies(s.output),n.modifies(o.output),c!==I&&c!==o&&(t.visit(t.ADD,(function(t){c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&l!==I&&(t.visit(t.REM,(function(t){l(t,e)})),n.modifies(l.output)),u||c!==I){var f=t.MOD|(e.modified()?t.REFLOW:0);u?(t.visit(f,(function(t){var i=s(t,e)||r;(c(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(s.output)):t.visit(f,(function(t){(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation},Re(Eh,ci).transform=function(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,r,i,a,u,o=t.dataflow.locale(),s=t.fork(t.NO_SOURCE|t.NO_FIELDS),l=this.value,c=e.type||"symbol",f=e.scale,d=+e.limit,h=Uf(f,null==e.count?5:e.count,e.minstep),p=!!e.values||"symbol"===c,m=e.format||Vf(o,f,h,c,e.formatSpecifier,e.formatType,p),v=e.values||Yf(f,h);return l&&(s.rem=l),"symbol"===c?(d&&v.length>d?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=v.slice(0,d-1),u=!0):l=v,ge(i=e.size)?(e.values||0!==f(l[0])||(l=l.slice(1)),a=l.reduce((function(t,n){return Math.max(t,i(n,e))}),0)):i=Ae(a=i||8),l=l.map((function(t,n){return lt({index:n,label:m(t,n,l),value:t,offset:a,size:i(t,e)})})),u&&(u=v[l.length],l.push(lt({index:l.length,label:"…".concat(v.length-l.length," entries"),value:u,offset:a,size:i(u,e)})))):"gradient"===c?(n=f.domain(),r=Bf(f,n[0],J(n)),v.length<3&&!e.values&&n[0]!==J(n)&&(v=[n[0],J(n)]),l=v.map((function(e,t){return lt({index:t,label:m(e,t,v),value:e,perc:r(e)})}))):(i=v.length-1,r=function(e){var t=e.domain(),n=t.length-1,r=+t[0],i=+J(t),a=i-r;if("threshold"===e.type){var u=n?a/n:.1;a=(i+=u)-(r-=u)}return function(e){return(e-r)/a}}(f),l=v.map((function(e,t){return lt({index:t,label:m(e,t,v),value:e,perc:t?r(e):0,perc2:t===i?1:r(v[t+1])})}))),s.source=l,s.add=l,this.value=l,s};var Fh=Be({line:Th,"line-radial":function(e,t,n,r){return Th(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n))},arc:Ph,"arc-radial":function(e,t,n,r){return Ph(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n))},curve:qh,"curve-radial":function(e,t,n,r){return qh(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n))},"orthogonal-horizontal":function(e,t,n,r){return"M"+e+","+t+"V"+r+"H"+n},"orthogonal-vertical":function(e,t,n,r){return"M"+e+","+t+"H"+n+"V"+r},"orthogonal-radial":function(e,t,n,r){var i=Math.cos(e),a=Math.sin(e),u=Math.cos(n),o=Math.sin(n),s=Math.abs(n-e)>Math.PI?n<=e:n>e;return"M"+t*i+","+t*a+"A"+t+","+t+" 0 0,"+(s?1:0)+" "+t*u+","+t*o+"L"+r*u+","+r*o},"diagonal-horizontal":function(e,t,n,r){var i=(e+n)/2;return"M"+e+","+t+"C"+i+","+t+" "+i+","+r+" "+n+","+r},"diagonal-vertical":function(e,t,n,r){var i=(t+r)/2;return"M"+e+","+t+"C"+e+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":function(e,t,n,r){var i=Math.cos(e),a=Math.sin(e),u=Math.cos(n),o=Math.sin(n),s=(t+r)/2;return"M"+t*i+","+t*a+"C"+s*i+","+s*a+" "+s*u+","+s*o+" "+r*u+","+r*o}});function Sh(e){return e.source.x}function Bh(e){return e.source.y}function Oh(e){return e.target.x}function Rh(e){return e.target.y}function zh(e){ci.call(this,{},e)}function Th(e,t,n,r){return"M"+e+","+t+"L"+n+","+r}function Ph(e,t,n,r){var i=n-e,a=r-t,u=Math.sqrt(i*i+a*a)/2;return"M"+e+","+t+"A"+u+","+u+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+n+","+r}function qh(e,t,n,r){var i=n-e,a=r-t,u=.2*(i+a),o=.2*(a-i);return"M"+e+","+t+"C"+(e+u)+","+(t+o)+" "+(n+o)+","+(r-u)+" "+n+","+r}function Lh(e){ci.call(this,null,e)}zh.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},Re(zh,ci).transform=function(e,t){var n=e.sourceX||Sh,r=e.sourceY||Bh,i=e.targetX||Oh,a=e.targetY||Rh,u=e.as||"path",o=e.orient||"vertical",s=e.shape||"line",l=Fh.get(s+"-"+o)||Fh.get(s);return l||O("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(function(e){e[u]=l(n(e),r(e),i(e),a(e))})),t.reflow(e.modified()).modifies(u)},Lh.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},Re(Lh,ci).transform=function(e,t){var n,r,i,a=e.as||["startAngle","endAngle"],u=a[0],o=a[1],s=e.field||N,l=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(s),h=d.length,p=l,m=(c-l)/wn(d),v=ln(h);for(e.sort&&v.sort((function(e,t){return d[e]-d[t]})),n=0;n0?1:0)}),0))!==t.length&&n.warn("Log scale domain includes zero: "+Ye(t)));return t}function $h(e,t,n){return ge(e)&&(t||n)?Ef(e,Wh(t||[0,1],n)):e}function Wh(e,t){return t?e.slice().reverse():e}function Hh(e){ci.call(this,null,e)}Re(Ih,ci).transform=function(e,t){var n=t.dataflow,r=this.value,i=function(e){var t,n=e.type,r="";if("sequential"===n)return"sequential-linear";(function(e){var t=e.type;return _f(t)&&t!==kc&&t!==Ac&&(e.scheme||e.range&&e.range.length&&e.range.every(Ne))})(e)&&(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0,r=2===t?"sequential-":3===t?"diverging-":"");return(r+n||"linear").toLowerCase()}(e);for(i in r&&i===r.type||(this.value=r=yf(i)()),e)if(!Uh[i]){if("padding"===i&&Nh(r.type))continue;ge(r[i])?r[i](e[i]):n.warn("Unsupported scale property: "+i)}return function(e,t,n){var r=e.type,i=t.round||!1,a=t.range;if(null!=t.rangeStep)a=function(e,t,n){"band"!==e&&"point"!==e&&O("Only band and point scales support rangeStep.");var r=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,i="point"===e?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*xc(n,i,r)]}(r,t,n);else if(t.scheme&&(a=function(e,t,n){var r,i,a=t.schemeExtent;W(t.scheme)?i=Ff(t.scheme,t.interpolate,t.interpolateGamma):(r=t.scheme.toLowerCase(),(i=Pf(r))||O("Unrecognized scheme name: ".concat(t.scheme)));return n="threshold"===e?n+1:"bin-ordinal"===e?n-1:"quantile"===e||"quantize"===e?+t.schemeCount||5:n,Df(e)?$h(i,a,t.reverse):ge(i)?Sf($h(i,a),n):"ordinal"===e?i:i.slice(0,n)}(r,t,n),ge(a))){if(e.interpolator)return e.interpolator(a);O("Scale type ".concat(r," does not support interpolating color schemes."))}if(a&&Df(r))return e.interpolator(Ff(Wh(a,t.reverse),t.interpolate,t.interpolateGamma));a&&t.interpolate&&e.interpolate?e.interpolate(Of(t.interpolate,t.interpolateGamma)):ge(e.round)?e.round(i):ge(e.rangeRound)&&e.interpolate(i?s.interpolateRound:s.interpolate);a&&e.range(Wh(a,t.reverse))}(r,e,function(e,t,n){var r=t.bins;if(r&&!W(r)){var i=e.domain(),a=i[0],u=J(i),o=null==r.start?a:r.start,s=null==r.stop?u:r.stop,l=r.step;l||O("Scale bins parameter missing step property."),ou&&(s=l*Math.floor(u/l)),r=ln(o,s+l/2,l)}r?e.bins=r:e.bins&&delete e.bins;"bin-ordinal"===e.type&&(r?t.domain||t.domainRaw||(e.domain(r),n=r.length):e.bins=e.domain());return n}(r,e,function(e,t,n){var r=function(e,t,n){return t?(e.domain(jh(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(r>-1)return r;var i,a,u=t.domain,o=e.type,s=t.zero||void 0===t.zero&&function(e){var t=e.type;return!e.bins&&("linear"===t||"pow"===t||"sqrt"===t)}(e);if(!u)return 0;Nh(o)&&t.padding&&u[0]!==J(u)&&(u=function(e,t,n,r,i,a){var u=Math.abs(J(n)-n[0]),o=u/(u-2*r),s=e===_c?ce(t,null,o):"sqrt"===e?fe(t,null,o,.5):"pow"===e?fe(t,null,o,i||1):"symlog"===e?de(t,null,o,a||1):le(t,null,o);return(t=t.slice())[0]=s[0],t[t.length-1]=s[1],t}(o,u,t.range,t.padding,t.exponent,t.constant));if((s||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(i=(u=u.slice()).length-1||1,s&&(u[0]>0&&(u[0]=0),u[i]<0&&(u[i]=0)),null!=t.domainMin&&(u[0]=t.domainMin),null!=t.domainMax&&(u[i]=t.domainMax),null!=t.domainMid)){var l=(a=t.domainMid)>u[i]?i+1:ad&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,l,c),r=0,i=n.length,a=n.max;r=r,Zh[l<<1].forEach(p);for(;++u=r,Zh[s|l<<1].forEach(p);Zh[l<<0].forEach(p);for(;++o=r,c=n[o*e]>=r,Zh[l<<1|c<<2].forEach(p);++u=r,f=c,c=n[o*e+u+1]>=r,Zh[s|l<<1|c<<2|f<<3].forEach(p);Zh[l|c<<3].forEach(p)}u=-1,c=n[o*e]>=r,Zh[c<<2].forEach(p);for(;++u=r,Zh[c<<2|f<<3].forEach(p);function p(e){var t,n,r=[e[0][0]+u,e[0][1]+o],s=[e[1][0]+u,e[1][1]+o],l=a(r),c=a(s);(t=h[l])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(s),i(t.ring)):d[t.start]=h[n.end]={start:t.start,end:n.end,ring:t.ring.concat(n.ring)}):(delete h[t.end],t.ring.push(s),h[t.end=c]=t):(t=d[c])?(n=h[l])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(s),i(t.ring)):d[n.start]=h[t.end]={start:n.start,end:t.end,ring:n.ring.concat(t.ring)}):(delete d[t.start],t.ring.unshift(r),d[t.start=l]=t):d[l]=h[c]={start:l,end:c,ring:[r,s]}}Zh[c<<3].forEach(p)}(r,i,(function(e){n(e,r,i),function(e){var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];for(;++t0?u.push([e]):o.push(e)})),o.forEach((function(e){for(var t,n=0,r=u.length;n0&&u0&&o=0&&a>=0||O("invalid size"),e=i,t=a,r},r.smooth=function(e){return arguments.length?(n=e?u:Qh,r):n===u},r}function tp(e,t){for(var n,r=-1,i=t.length;++rr!=h>r&&n<(d-l)*(r-c)/(h-c)+l&&(i=-i)}return i}function rp(e,t,n){var r,i,a,u;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])==(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&(i=e[r=+(e[0]===t[0])],a=n[r],u=t[r],i<=a&&a<=u||u<=a&&a<=i)}function ip(e,t,n){return function(r){var i=Ce(r),a=n?Math.min(i[0],0):i[0],u=i[1],o=u-a,s=t?vn(a,u,e):o/(e+1);return ln(s,u,s)}}function ap(e){ci.call(this,null,e)}function up(e,t,n,r,i){var a=e.x1||0,u=e.y1||0,o=t*n<0;function s(e){e.forEach(l)}function l(e){o&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-a)*t+r,e[1]=(e[1]-u)*n+i}return function(e){return e.coordinates.forEach(s),e}}function op(e,t,n){var r=e>=0?e:Bi(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function sp(e){return ge(e)?e:Ae(+e)}function lp(){var e=function(e){return e[0]},t=function(e){return e[1]},n=N,r=[-1,-1],i=960,a=500,u=2;function o(o,s){var l=op(r[0],o,e)>>u,c=op(r[1],o,t)>>u,f=l?l+2:0,d=c?c+2:0,h=2*f+(i>>u),p=2*d+(a>>u),m=new Float32Array(h*p),v=new Float32Array(h*p),g=m;o.forEach((function(r){var i=f+(+e(r)>>u),a=d+(+t(r)>>u);i>=0&&i=0&&a0&&c>0?(cp(h,p,m,v,l),fp(h,p,v,m,c),cp(h,p,m,v,l),fp(h,p,v,m,c),cp(h,p,m,v,l),fp(h,p,v,m,c)):l>0?(cp(h,p,m,v,l),cp(h,p,v,m,l),cp(h,p,m,v,l),g=v):c>0&&(fp(h,p,m,v,c),fp(h,p,v,m,c),fp(h,p,m,v,c),g=v);for(var y=s?Math.pow(2,-2*u):1/wn(g),b=0,x=h*p;b>u),y2:d+(a>>u)}}return o.x=function(t){return arguments.length?(e=sp(t),o):e},o.y=function(e){return arguments.length?(t=sp(e),o):t},o.weight=function(e){return arguments.length?(n=sp(e),o):n},o.size=function(e){if(!arguments.length)return[i,a];var t=+e[0],n=+e[1];return t>=0&&n>=0||O("invalid size"),i=t,a=n,o},o.cellSize=function(e){return arguments.length?((e=+e)>=1||O("invalid cell size"),u=Math.floor(Math.log(e)/Math.LN2),o):1<=i&&(o>=a&&(s-=n[o-a+u*e]),r[o-i+u*e]=s/Math.min(o+1,e-1+a-o,a))}function fp(e,t,n,r,i){for(var a=1+(i<<1),u=0;u=i&&(o>=a&&(s-=n[u+(o-a)*e]),r[u+(o-i)*e]=s/Math.min(o+1,t-1+a-o,a))}function dp(e){ci.call(this,null,e)}ap.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},Re(ap,ci).transform=function(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=e.field||q,a=ep().smooth(!1!==e.smooth),u=e.thresholds||function(e,t,n){var r=ip(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(e.map((function(e){return gn(t(e).values)})))}(r,i,e),o=null===e.as?null:e.as||"contour",s=[];return r.forEach((function(t){var n=i(t),r=a.size([n.width,n.height])(n.values,W(u)?u:u(n.values));!function(e,t,n,r){var i=r.scale||t.scale,a=r.translate||t.translate;ge(i)&&(i=i(n,r));ge(a)&&(a=a(n,r));if((1===i||null==i)&&!a)return;var u=(qe(i)?i:i[0])||1,o=(qe(i)?i:i[1])||1,s=a&&a[0]||0,l=a&&a[1]||0;e.forEach(up(t,u,o,s,l))}(r,n,t,e),r.forEach((function(e){s.push(ft(t,lt(null!=o?_defineProperty({},o,e):e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=s,n},dp.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};var hp=Re(dp,ci),pp=["x","y","weight","size","cellSize","bandwidth"];function mp(e,t){return pp.forEach((function(n){return null!=t[n]?e[n](t[n]):0})),e}function vp(e){ci.call(this,null,e)}hp.transform=function(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=function(e,t){var n,r,i,a,u,o,s=[],l=function(e){return e(a)};if(null==t)s.push(e);else for(n={},r=0,i=e.length;r0?Math.sqrt(e):0}(2);function wp(e){return e>1?kp:e<-1?-kp:Math.asin(e)}function Dp(e,t){var n,r=e*xp(t),i=30;do{t-=n=(t+xp(t)-r)/(1+bp(t))}while(yp(n)>1e-6&&--i>0);return t/2}var Cp=function(e,t,n){function r(r,i){return[e*r*bp(i=Dp(n,i)),t*xp(i)]}return r.invert=function(r,i){return i=wp(i/t),[r/(e*bp(i)),wp((2*i+xp(2*i))/n)]},r}(Ap/kp,Ap,_p);var Mp=l.geoPath(),Ep=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Fp(e,t){return function n(){var r=t();return r.type=e,r.path=l.geoPath().projection(r),r.copy=r.copy||function(){var e=n();return Ep.forEach((function(t){r[t]&&e[t](r[t]())})),e.path.pointRadius(r.path.pointRadius()),e},r}}function Sp(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(Op[e]=Fp(e,t),this):Op[e]||null}function Bp(e){return e&&e.path||Mp}var Op={albers:l.geoAlbers,albersusa:l.geoAlbersUsa,azimuthalequalarea:l.geoAzimuthalEqualArea,azimuthalequidistant:l.geoAzimuthalEquidistant,conicconformal:l.geoConicConformal,conicequalarea:l.geoConicEqualArea,conicequidistant:l.geoConicEquidistant,equalEarth:l.geoEqualEarth,equirectangular:l.geoEquirectangular,gnomonic:l.geoGnomonic,identity:l.geoIdentity,mercator:l.geoMercator,mollweide:function(){return l.geoProjection(Cp).scale(169.529)},naturalEarth1:l.geoNaturalEarth1,orthographic:l.geoOrthographic,stereographic:l.geoStereographic,transversemercator:l.geoTransverseMercator};for(var Rp in Op)Sp(Rp,Op[Rp]);function zp(e){ci.call(this,null,e)}function Tp(e){ci.call(this,null,e)}function Pp(e){ci.call(this,null,e)}function qp(e){ci.call(this,[],e),this.generator=l.geoGraticule()}function Lp(e){ci.call(this,null,e)}function Np(e){if(!ge(e))return!1;var t=Qe(E(e));return t.$x||t.$y||t.$value||t.$max}function Up(e){ci.call(this,null,e),this.modified(!0)}function Ip(e,t,n){ge(e[t])&&e[t](n)}zp.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},Re(zp,ci).transform=function(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||q,a=e.as||"path",u=n.SOURCE;!r||e.modified()?(this.value=r=Bp(e.projection),n.materialize().reflow()):u=i===q||t.modified(i.fields)?n.ADD_MOD:n.ADD;var o=function(e,t){var n=e.pointRadius();e.context(null),null!=t&&e.pointRadius(t);return n}(r,e.pointRadius);return n.visit(u,(function(e){e[a]=r(i(e))})),r.pointRadius(o),n.modifies(a)},Tp.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},Re(Tp,ci).transform=function(e,t){var n,r=e.projection,i=e.fields[0],a=e.fields[1],u=e.as||["x","y"],o=u[0],s=u[1];function l(e){var t=r([i(e),a(e)]);t?(e[o]=t[0],e[s]=t[1]):(e[o]=void 0,e[s]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(n=t.modified(i.fields)||t.modified(a.fields),t.visit(n?t.ADD_MOD:t.ADD,l)),t.modifies(u)},Pp.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},Re(Pp,ci).transform=function(e,t){var n=t.fork(t.ALL),r=this.value,i=e.as||"shape",a=n.ADD;return r&&!e.modified()||(this.value=r=function(e,t,n){var r=null==n?function(n){return e(t(n))}:function(r){var i=e.pointRadius(),a=e.pointRadius(n)(t(r));return e.pointRadius(i),a};return r.context=function(t){return e.context(t),r},r}(Bp(e.projection),e.field||z("datum"),e.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,(function(e){e[i]=r})),n.modifies(i)},qp.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},Re(qp,ci).transform=function(e,t){var n,r=this.value,i=this.generator;if(!r.length||e.modified())for(var a in e)ge(i[a])&&i[a](e[a]);return n=i(),r.length?t.mod.push(dt(r[0],n)):t.add.push(lt(n)),r[0]=n,t},Lp.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},Re(Lp,ci).transform=function(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,r="shared"===e.resolve,i=e.field||q,a=function(e,t){var n;ge(e)?(n=function(n){return e(n,t)}).dep=Np(e):e?n=Ae(e):(n=function(e){return e.$value/e.$max||0}).dep=!0;return n}(e.opacity,e),u=function(e,t){var n;ge(e)?(n=function(n){return c.rgb(e(n,t))}).dep=Np(e):n=Ae(c.rgb(e||"#888"));return n}(e.color,e),o=e.as||"image",s={$x:0,$y:0,$value:0,$max:r?gn(n.map((function(e){return gn(i(e).values)}))):0};return n.forEach((function(e){var t=i(e),n=De({},e,s);r||(n.$max=gn(t.values||[])),e[o]=function(e,t,n,r){for(var i=e.width,a=e.height,u=e.x1||0,o=e.y1||0,s=e.x2||i,l=e.y2||a,c=e.values,f=c?function(e){return c[e]}:L,d=Go(s-u,l-o),h=d.getContext("2d"),p=h.getImageData(0,0,s-u,l-o),m=p.data,v=o,g=0;v=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return t.StopPropagation;return this.finish(e,t)},Vp.finish=function(e,t){for(var n,r=t.dataflow,i=this._argops,a=0,u=i.length;at.length)return n;var i,a=[];for(i in n)a.push({key:i,values:e(n[i],r)});return a}(function e(n,r){if(r>=t.length)return n;for(var i,a,u,o=-1,s=n.length,l=t[r++],c={},f={};++o>1;if(n>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;var r=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}return _createClass(e,null,[{key:"from",value:function(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qm,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Lm,i=t.length,a=new Float64Array(2*i),u=0;u>1,u=1/0,o=1/0,s=-1/0,l=-1/0,c=0;cs&&(s=f),d>l&&(l=d),this._ids[c]=c}for(var h,p,m,v=(u+s)/2,g=(o+l)/2,y=1/0,b=0;b0&&(p=A,y=w)}for(var D=e[2*p],C=e[2*p+1],M=1/0,E=0;EP&&(R[z++]=q,P=this._dists[q])}return this.hull=R.subarray(0,z),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Rm(_,k,D,C,S,B)){var L=p,N=D,U=C;p=m,D=S,C=B,m=L,S=N,B=U}var I=function(e,t,n,r,i,a){var u=n-e,o=r-t,s=i-e,l=a-t,c=u*u+o*o,f=s*s+l*l,d=.5/(u*l-o*s);return{x:e+(l*c-o*f)*d,y:t+(u*f-s*c)*d}}(_,k,D,C,S,B);this._cx=I.x,this._cy=I.y;for(var j=0;j0&&Math.abs(V-W)<=Em&&Math.abs(X-H)<=Em)&&(W=V,H=X,Y!==h&&Y!==p&&Y!==m)){for(var J=0,K=0,Q=this._hashKey(V,X);K0?3-i:1+i)/4*this._hashSize))%this._hashSize;var n,r,i}},{key:"_legalize",value:function(e){for(var t,n,r,i,a,u,o,s,l,c,f,d,h,p,m,v,g=this._triangles,y=this._halfedges,b=this.coords,x=0,_=0;;){var k=y[e],A=e-e%3;if(_=A+(e+2)%3,-1!==k){var w=k-k%3,D=A+(e+1)%3,C=w+(k+2)%3,M=g[_],E=g[e],F=g[D],S=g[C];if(t=b[2*M],n=b[2*M+1],r=b[2*E],i=b[2*E+1],a=b[2*F],u=b[2*F+1],o=b[2*S],s=b[2*S+1],l=void 0,c=void 0,f=void 0,d=void 0,h=void 0,p=void 0,void 0,m=void 0,v=void 0,(l=t-o)*((d=i-s)*(v=(h=a-o)*h+(p=u-s)*p)-(m=(f=r-o)*f+d*d)*p)-(c=n-s)*(f*v-m*h)+(l*l+c*c)*(f*p-d*h)<0){g[e]=S,g[k]=M;var B=y[C];if(-1===B){var O=this._hullStart;do{if(this._hullTri[O]===C){this._hullTri[O]=e;break}O=this._hullPrev[O]}while(O!==this._hullStart)}this._link(e,B),this._link(k,y[_]),this._link(_,C);var R=w+(k+1)%3;x=33306690738754716e-32*Math.abs(u+o)?u-o:0}function Rm(e,t,n,r,i,a){return(Om(i,a,e,t,n,r)||Om(e,t,n,r,i,a)||Om(n,r,i,a,e,t))<0}function zm(e,t,n,r,i,a){var u=n-e,o=r-t,s=i-e,l=a-t,c=u*u+o*o,f=s*s+l*l,d=.5/(u*l-o*s),h=(l*c-o*f)*d,p=(u*f-s*c)*d;return h*h+p*p}function Tm(e,t,n,r){if(r-n<=20)for(var i=n+1;i<=r;i++){for(var a=e[i],u=t[a],o=i-1;o>=n&&t[e[o]]>u;)e[o+1]=e[o--];e[o+1]=a}else{var s=n+1,l=r;Pm(e,n+r>>1,s),t[e[n]]>t[e[r]]&&Pm(e,n,r),t[e[s]]>t[e[r]]&&Pm(e,s,r),t[e[n]]>t[e[s]]&&Pm(e,n,s);for(var c=e[s],f=t[c];;){do{s++}while(t[e[s]]f);if(l=l-n?(Tm(e,t,s,r),Tm(e,t,n,l-1)):(Tm(e,t,n,l-1),Tm(e,t,s,r))}}function Pm(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function qm(e){return e[0]}function Lm(e){return e[1]}var Nm=function(){function e(){_classCallCheck(this,e),this._x0=this._y0=this._x1=this._y1=null,this._=""}return _createClass(e,[{key:"moveTo",value:function(e,t){this._+="M".concat(this._x0=this._x1=+e,",").concat(this._y0=this._y1=+t)}},{key:"closePath",value:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}},{key:"lineTo",value:function(e,t){this._+="L".concat(this._x1=+e,",").concat(this._y1=+t)}},{key:"arc",value:function(e,t,n){var r=(e=+e)+(n=+n),i=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+="M".concat(r,",").concat(i):(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+r+","+i),n&&(this._+="A".concat(n,",").concat(n,",0,1,1,").concat(e-n,",").concat(t,"A").concat(n,",").concat(n,",0,1,1,").concat(this._x1=r,",").concat(this._y1=i))}},{key:"rect",value:function(e,t,n,r){this._+="M".concat(this._x0=this._x1=+e,",").concat(this._y0=this._y1=+t,"h").concat(+n,"v").concat(+r,"h").concat(-n,"Z")}},{key:"value",value:function(){return this._||null}}]),e}(),Um=function(){function e(){_classCallCheck(this,e),this._=[]}return _createClass(e,[{key:"moveTo",value:function(e,t){this._.push([e,t])}},{key:"closePath",value:function(){this._.push(this._[0].slice())}},{key:"lineTo",value:function(e,t){this._.push([e,t])}},{key:"value",value:function(){return this._.length?this._:null}}]),e}(),Im=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,960,500],r=_slicedToArray(n,4),i=r[0],a=r[1],u=r[2],o=r[3];if(_classCallCheck(this,e),!((u=+u)>=(i=+i)&&(o=+o)>=(a=+a)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=u,this.xmin=i,this.ymax=o,this.ymin=a,this._init()}return _createClass(e,[{key:"update",value:function(){return this.delaunay.update(),this._init(),this}},{key:"_init",value:function(){for(var e,t,n=this.delaunay,r=n.points,i=n.hull,a=n.triangles,u=this.vectors,o=this.circumcenters=this._circumcenters.subarray(0,a.length/3*2),s=0,l=0,c=a.length;s1;)i-=2;for(var a=2;a4)for(var o=0;o0){if(t>=this.ymax)return null;(i=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(i=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}}]),e}(),jm=2*Math.PI,$m=Math.pow;function Wm(e){return e[0]}function Hm(e){return e[1]}function Gm(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var Ym=function(){function e(t){_classCallCheck(this,e),this._delaunator=new Sm(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}return _createClass(e,null,[{key:"from",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wm,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Hm,i=arguments.length>3?arguments[3]:void 0;return new e("length"in t?Vm(t,n,r,i):Float64Array.from(Xm(t,n,r,i)))}}]),_createClass(e,[{key:"update",value:function(){return this._delaunator.update(),this._init(),this}},{key:"_init",value:function(){var e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&function(e){for(var t=e.triangles,n=e.coords,r=0;r1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},(function(e,t){return t})).sort((function(e,n){return t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]}));for(var n=this.collinear[0],r=this.collinear[this.collinear.length-1],i=[t[2*n],t[2*n+1],t[2*r],t[2*r+1]],a=1e-8*Math.hypot(i[3]-i[1],i[2]-i[0]),u=0,o=t.length/2;u0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=c[0],this.triangles[1]=c[1],this.triangles[2]=c[1],d[c[0]]=1,2===c.length&&(d[c[1]]=0))}},{key:"voronoi",value:function(e){return new Im(this,e)}},{key:"neighbors",value:regeneratorRuntime.mark((function e(t){var n,r,i,a,u,o,s,l,c,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.inedges,r=this.hull,i=this._hullIndex,a=this.halfedges,u=this.triangles,!(o=this.collinear)){e.next=10;break}if(!((s=o.indexOf(t))>0)){e.next=6;break}return e.next=6,o[s-1];case 6:if(!(s2&&void 0!==arguments[2]?arguments[2]:0;if((e=+e)!=e||(t=+t)!=t)return-1;for(var r,i=n;(r=this._step(n,e,t))>=0&&r!==n&&r!==i;)n=r;return r}},{key:"_step",value:function(e,t,n){var r=this.inedges,i=this.hull,a=this._hullIndex,u=this.halfedges,o=this.triangles,s=this.points;if(-1===r[e]||!s.length)return(e+1)%(s.length>>1);var l=e,c=$m(t-s[2*e],2)+$m(n-s[2*e+1],2),f=r[e],d=f;do{var h=o[d],p=$m(t-s[2*h],2)+$m(n-s[2*h+1],2);if(p1&&void 0!==arguments[1]?arguments[1]:2,n=null==e?e=new Nm:void 0,r=this.points,i=0,a=r.length;i=f));)if(t.x=u+i,t.y=l+a,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>o[0]||t.y+t.y1>o[1])&&(!n||!iv(t,e,o[0]))&&(!n||uv(t,n))){for(var m,v=t.sprite,g=t.width>>5,y=o[0]>>5,b=t.x-(g<<4),x=127&b,_=32-x,k=t.y1-t.y0,A=(t.y+t.y0)*y+(b>>5),w=0;w>>x:0);A+=y}return t.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=2048/t,e.height=2048/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(Go()),f=function(e){var t=[],n=-1;for(;++n>5)*o[1]),h=null,p=l.length,m=-1,v=[],g=l.map((function(o){return{text:e(o),font:t(o),style:r(o),weight:i(o),rotate:a(o),size:~~(n(o)+1e-14),padding:u(o),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:o}})).sort((function(e,t){return t.size-e.size}));++m>1,y.y=o[1]*(c()+.5)>>1,rv(s,y,g,m),y.hasText&&d(f,y,h)&&(v.push(y),h?av(h,y):h=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=o[0]>>1,y.y-=o[1]>>1)}return v},f.words=function(e){return arguments.length?(l=e,f):l},f.size=function(e){return arguments.length?(o=[+e[0],+e[1]],f):o},f.font=function(e){return arguments.length?(t=sv(e),f):t},f.fontStyle=function(e){return arguments.length?(r=sv(e),f):r},f.fontWeight=function(e){return arguments.length?(i=sv(e),f):i},f.rotate=function(e){return arguments.length?(a=sv(e),f):a},f.text=function(t){return arguments.length?(e=sv(t),f):e},f.spiral=function(e){return arguments.length?(s=lv[e]||e,f):s},f.fontSize=function(e){return arguments.length?(n=sv(e),f):n},f.padding=function(e){return arguments.length?(u=sv(e),f):u},f.random=function(e){return arguments.length?(c=e,f):c},f}function rv(e,t,n,r){if(!t.sprite){var i=e.context,a=e.ratio;i.clearRect(0,0,2048/a,2048/a);var u,o,s,l,c,f=0,d=0,h=0,p=n.length;for(--r;++r>5<<5,s=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else u=u+31>>5<<5;if(s>h&&(h=s),f+u>=2048&&(f=0,d+=h,h=0),d+s>=2048)break;i.translate((f+(u>>1))/a,(d+(s>>1))/a),t.rotate&&i.rotate(t.rotate*tv),i.fillText(t.text,0,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,0,0)),i.restore(),t.width=u,t.height=s,t.xoff=f,t.yoff=d,t.x1=u>>1,t.y1=s>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=u}for(var _=i.getImageData(0,0,2048/a,2048/a).data,k=[];--r>=0;)if((t=n[r]).hasText){for(o=(u=t.width)>>5,s=t.y1-t.y0,l=0;l>5),C=_[2048*(d+c)+(f+l)<<2]?1<<31-l%32:0;k[D]|=C,A|=C}A?w=c:(t.y0++,s--,c--,d++)}t.y1=t.y0+w,t.sprite=k.slice(0,(t.y1-t.y0)*o)}}}function iv(e,t,n){n>>=5;for(var r,i=e.sprite,a=e.width>>5,u=e.x-(a<<4),o=127&u,s=32-o,l=e.y1-e.y0,c=(e.y+e.y0)*n+(u>>5),f=0;f>>o:0))&t[c+d])return!0;c+=n}return!1}function av(e,t){var n=e[0],r=e[1];t.x+t.x0r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function uv(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0>1,v=p[1]>>1,g=0,y=h.length;gi?1:0})),function(e,t){return Array.from(t,(function(t){return e[t]}))}(e,t)}(f,d),l)u=t,o=e,t=Array(l+c),e=vv(l+c),function(e,t,n,r,i,a,u,o,s){var l,c=0,f=0;for(l=0;c0)for(s=0;s=t?e:((n=n||new e.constructor(t)).set(e),n)}(n,t.length)},add:function(e){for(var n,r=0,i=t.length,a=e.length;rr.length||n>e)&&(e=Math.max(n,e),r=gv(t,e,r),i=gv(t,e))}}}(),e),this._indices=null,this._dims=null}xv.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]};var _v=Re(xv,ci);function kv(e){ci.call(this,null,e)}_v.transform=function(e,t){return this._dims?e.modified("fields")||e.fields.some((function(e){return t.modified(e.fields)}))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},_v.init=function(e,t){for(var n,r,i=e.fields,a=e.query,u=this._indices={},o=this._dims=[],s=a.length,l=0;lv)for(i=v,a=Math.min(p,g);ig)for(i=Math.max(p,g),a=m;ih)for(i=h,a=Math.min(f,p);ip)for(i=Math.max(f,p),a=d;i",dg[3]="Identifier",dg[4]="Keyword",dg[5]="Null",dg[6]="Numeric",dg[7]="Punctuator",dg[8]="String",dg[9]="RegularExpression";var yg="ILLEGAL",bg=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),xg=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09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318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function _g(e,t){if(!e)throw new Error("ASSERT: "+t)}function kg(e){return e>=48&&e<=57}function Ag(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function wg(e){return"01234567".indexOf(e)>=0}function Dg(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function Cg(e){return 10===e||13===e||8232===e||8233===e}function Mg(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&bg.test(String.fromCharCode(e))}function Eg(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&xg.test(String.fromCharCode(e))}var Fg={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function Sg(){for(var e;pg1114111||"}"!==e)&&Yg({},"Unexpected token %0",yg),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),r=56320+(t-65536&1023),String.fromCharCode(n,r))}function Rg(){var e,t;for(e=hg.charCodeAt(pg++),t=String.fromCharCode(e),92===e&&(117!==hg.charCodeAt(pg)&&Yg({},"Unexpected token %0",yg),++pg,(e=Bg("u"))&&"\\"!==e&&Mg(e.charCodeAt(0))||Yg({},"Unexpected token %0",yg),t=e);pg>>="===(r=hg.substr(pg,4))?{type:7,value:r,start:i,end:pg+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:pg+=3}:u===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(u)>=0||"=>"===t?{type:7,value:t,start:i,end:pg+=2}:"<>=!+-*%&|^/".indexOf(u)>=0?{type:7,value:u,start:i,end:++pg}:void Yg({},"Unexpected token %0",yg)}function Pg(){var e,t,n;if(_g(kg((n=hg[pg]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=pg,e="","."!==n){if(e=hg[pg++],n=hg[pg],"0"===e){if("x"===n||"X"===n)return++pg,function(e){for(var t="";pg=0&&Yg({},"Invalid regular expression",n),{value:n,literal:t}}(),r=function(e,t){var n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(e,t){if(parseInt(t,16)<=1114111)return"x";Yg({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){Yg({},"Invalid regular expression")}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:pg}}function Lg(){var e;return Sg(),pg>=mg?{type:2,start:pg,end:pg}:Mg(e=hg.charCodeAt(pg))?zg():40===e||41===e||59===e?Tg():39===e||34===e?function(){var e,t,n,r,i="",a=!1;for(_g("'"===(e=hg[pg])||'"'===e,"String literal must starts with a quote"),t=pg,++pg;pg=0&&pg":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function cy(){var e,t;return e=function(){var e,t,n,r,i,a,u,o,s,l;if(e=vg,s=sy(),0===(i=ly(r=vg)))return s;for(r.prec=i,Ng(),t=[e,vg],a=[s,r,u=sy()];(i=ly(vg))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)u=a.pop(),o=a.pop().value,s=a.pop(),t.pop(),n=Ig(o,s,u),a.push(n);(r=Ng()).prec=i,a.push(r),t.push(vg),n=sy(),a.push(n)}for(n=a[l=a.length-1],t.pop();l>1;)t.pop(),n=Ig(a[l-1].value,a[l-2],n),l-=2;return n}(),Jg("?")&&(Ng(),t=cy(),Xg(":"),e=function(e,t,n){var r=new gg("ConditionalExpression");return r.test=e,r.consequent=t,r.alternate=n,r}(e,t,cy())),e}function fy(){var e=cy();if(Jg(","))throw new Error("Disabled.");return e}var dy={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function hy(e){function t(t,n,r){return function(i){return function(t,n,r,i){var a=e(n[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+t+(i<0?"":0===i?"()":"("+n.slice(1).map(e).join(",")+")")}(t,i,n,r)}}var n="new Date";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&O("Missing arguments to clamp function."),t.length>3&&O("Too many arguments to clamp function.");var n=t.map(e);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),join:t("join",null),indexof:t("indexOf",null),lastindexof:t("lastIndexOf",null),slice:t("slice",null),reverse:function(t){return"("+e(t[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase","String",0),lower:t("toLowerCase","String",0),substring:t("substring","String"),split:t("split","String"),replace:t("replace","String"),trim:t("trim","String",0),regexp:"RegExp",test:t("test","RegExp"),if:function(t){t.length<3&&O("Missing arguments to if function."),t.length>3&&O("Too many arguments to if function.");var n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function py(e,t,n,r){"Literal"!==t[0].type&&O("First argument to data functions must be a string literal.");var i=t[0].value,a=":"+i;if(!Fe(a,r))try{r[a]=n.getData(i).tuplesRef()}catch(e){}}function my(e,t,n,r){if("Literal"===t[0].type)vy(n,r,t[0].value);else for(e in n.scales)vy(n,r,e)}function vy(e,t,n){var r="%"+n;if(!Fe(t,r))try{t[r]=e.scaleRef(n)}catch(e){}}function gy(e,t){var n;return ge(e)?e:Ne(e)?(n=t.scales[e])&&n.value:void 0}function yy(e,t){return function(n,r,i){if(n){var a=gy(n,(i||this).context);return a&&a.path[e](r)}return t(r)}}var by=yy("area",l.geoArea),xy=yy("bounds",l.geoBounds),_y=yy("centroid",l.geoCentroid);function ky(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function Ay(e){var t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function wy(e){var t=c.rgb(e);return.2126*Ay(t.r)+.7152*Ay(t.g)+.0722*Ay(t.b)}function Dy(e,t){return e===t||e!=e&&t!=t||(W(e)?!(!W(t)||e.length!==t.length)&&function(e,t){for(var n=0,r=e.length;n=0})):t},R_union:function(e,t){var n=K(t[0]),r=K(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]r&&(n=t[1],r=t[0]),e.length?rr&&(e[1]=r),e):[n,r]}};function Ry(e,t,n,r){"Literal"!==t[0].type&&O("First argument to selection functions must be a string literal.");var i=t[0].value,a=":"+i;"intersect"!==(t.length>=2&&J(t).value)||Fe(r,"@unit")||(r["@unit"]=n.getData(i).indataRef(n,"unit")),Fe(r,a)||(r[a]=n.getData(i).tuplesRef())}var zy={random:function(){return e.random()},cumulativeNormal:Ui,cumulativeLogNormal:Gi,cumulativeUniform:Qi,densityNormal:Ni,densityLogNormal:Hi,densityUniform:Ki,quantileNormal:Ii,quantileLogNormal:Yi,quantileUniform:Zi,sampleNormal:Li,sampleLogNormal:Wi,sampleUniform:Ji,isArray:W,isBoolean:Te,isDate:Pe,isDefined:function(e){return void 0!==e},isNumber:qe,isObject:H,isRegExp:Le,isString:Ne,isTuple:ut,isValid:function(e){return null!=e&&e==e},toBoolean:Ve,toDate:Je,toNumber:K,toString:Ke,flush:Oe,lerp:Ie,merge:function(){var e=[].slice.call(arguments);return e.unshift({}),De.apply(null,e)},pad:He,peek:J,span:Ge,inrange:ze,truncate:Ze,rgb:c.rgb,lab:c.lab,hcl:c.hcl,hsl:c.hsl,luminance:wy,contrast:function(e,t){var n=wy(e),r=wy(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:ln,format:ag,utcFormat:og,utcParse:lg,utcOffset:gr,utcSequence:xr,timeFormat:ug,timeParse:sg,timeOffset:vr,timeSequence:br,timeUnitSpecifier:jn,monthFormat:function(e){return fg.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return fg.call(this,e,1,"%b")},dayFormat:function(e){return fg.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return fg.call(this,0,2+e,"%a")},quarter:he,utcquarter:pe,week:Gn,utcweek:Qn,dayofyear:Hn,utcdayofyear:Kn,warn:function(){return ky(this.context.dataflow,"warn",arguments)},info:function(){return ky(this.context.dataflow,"info",arguments)},debug:function(){return ky(this.context.dataflow,"debug",arguments)},extent:Ce,inScope:function(e){var t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:function(e,t,n){if(!e)return[];var r=_slicedToArray(e,2),i=r[0],a=r[1],u=(new jo).set(i[0],i[1],a[0],a[1]);return zd(n||this.context.dataflow.scenegraph().root,u,function(e){var t=null;if(e){var n=me(e.marktype),r=me(e.markname);t=function(e){return(!n.length||n.some((function(t){return e.marktype===t})))&&(!r.length||r.some((function(t){return e.name===t})))}}return t}(t))},clampRange:ve,pinchDistance:function(e){var t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(e){var t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){var e=Sy();return e?e.screen:{}},containerSize:function(){var e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){var e=Sy();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return xc(e||0,t||0,n||0)},setdata:function(e,t){var n=this.context.dataflow,r=this.context.data[e].input;return n.pulse(r,n.changeset().remove(U).insert(t)),1},pathShape:function(e){var t=null;return function(n){return n?co(n,t=t||Zu(e)):e}},panLinear:ie,panLog:ae,panPow:ue,panSymlog:oe,zoomLinear:le,zoomLog:ce,zoomPow:fe,zoomSymlog:de,encode:function(e,t,n){if(e){var r=this.context.dataflow,i=e.mark.source;r.pulse(i,r.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,r,i,a){var u,o,s=this.context.dataflow,l=this.context.data[e],c=l.input,f=l.changes,d=s.stamp();if(!1===s._trigger||!(c.value.length||t||r))return 0;if((!f||f.stamp0?i:Fe(n,i)?O("Illegal identifier: "+i):Fe(r,i)?r[i]:Fe(t,i)?i:(o[i]=1,c(i))},MemberExpression:function(e){var t=!e.computed,n=f(e.object);t&&(l+=1);var r=f(e.property);return n===u&&(s[function(e){var t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(r)]=1),t&&(l-=1),n+(t?"."+r:"["+r+"]")},CallExpression:function(e){"Identifier"!==e.callee.type&&O("Illegal callee type: "+e.callee.type);var t=e.callee.name,n=e.arguments,r=Fe(i,t)&&i[t];return r||O("Unrecognized function: "+t),ge(r)?r(n):r+"("+n.map(f).join(",")+")"},ArrayExpression:function(e){return"["+e.elements.map(f).join(",")+"]"},BinaryExpression:function(e){return"("+f(e.left)+e.operator+f(e.right)+")"},UnaryExpression:function(e){return"("+e.operator+f(e.argument)+")"},ConditionalExpression:function(e){return"("+f(e.test)+"?"+f(e.consequent)+":"+f(e.alternate)+")"},LogicalExpression:function(e){return"("+f(e.left)+e.operator+f(e.right)+")"},ObjectExpression:function(e){return"{"+e.properties.map(f).join(",")+"}"},Property:function(e){l+=1;var t=f(e.key);return l-=1,t+":"+f(e.value)}};function h(e){var t={code:f(e),globals:Object.keys(o),fields:Object.keys(s)};return o={},s={},t}return h.functions=i,h.constants=r,h}(Ly);function Uy(e,t){var n,r,i={};try{n=function(e){pg=0,mg=(hg=e).length,vg=null,Ug();var t=fy();if(2!==vg.type)throw new Error("Unexpect token after expression.");return t}(e=Ne(e)?e:Ye(e)+"")}catch(t){O("Expression parse error: "+e)}return n.visit((function(e){if("CallExpression"===e.type){var n=e.callee.name,r=Ly.visitors[n];r&&r(n,e.arguments,t,i)}})),(r=Ny(n)).globals.forEach((function(e){var n="$"+e;!Fe(i,n)&&t.getSignal(e)&&(i[n]=t.signalRef(e))})),{$expr:De({code:r.code},t.options.ast?{ast:n}:null),$fields:r.fields,$params:i}}var Iy=Qe(["rule"]),jy=Qe(["group","image","rect"]);function $y(e){return(e+"").toLowerCase()}function Wy(e,t,n){";"!==n[n.length-1]&&(n="return("+n+");");var r=Function.apply(null,t.concat(n));return e&&e.functions?r.bind(e.functions):r}var Hy={operator:function(e,t){return Wy(e,["_"],t.code)},parameter:function(e,t){return Wy(e,["datum","_"],t.code)},event:function(e,t){return Wy(e,["event"],t.code)},handler:function(e,t){return Wy(e,["_","event"],"var datum=event.item&&event.item.datum;return ".concat(t.code,";"))},encode:function(e,t){var n=t.marktype,r=t.channels,i="var o=item,datum=o.datum,m=0,$;";for(var a in r){var u="o["+Ye(a)+"]";i+="$=".concat(r[a].code,";if(").concat(u,"!==$)").concat(u,"=$,m=1;")}return i+=function(e,t){var n="";return Iy[t]||(e.x2&&(e.x?(jy[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(jy[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(r,n),Wy(e,["item","_"],i+="return m;")},codegen:{get:function(e){var t="[".concat(e.map(Ye).join("]["),"]"),n=Function("_","return _".concat(t,";"));return n.path=t,n},comparator:function(e,t){var n,r=Function("a","b","var u, v; return "+e.map((function(e,r){var i,a,u=t[r];return e.path?(i="a".concat(e.path),a="b".concat(e.path)):((n=n||{})["f"+r]=e,i="this.f".concat(r,"(a)"),a="this.f".concat(r,"(b)")),function(e,t,n,r){return"((u = ".concat(e,") < (v = ").concat(t,") || u == null) && v != null ? ").concat(n,"\n : (u > v || v == null) && u != null ? ").concat(r,"\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(n,"\n : v !== v && u === u ? ").concat(r," : ")}(i,a,-u,u)})).join("")+"0;");return n?r.bind(n):r}}};function Gy(e,t,n){if(!e||!H(e))return e;for(var r,i=0,a=Yy.length;i=0;)if(r=i[a].type,n=i[a].handler,e===r&&(t===n||t===n.raw)){this._handler.off(r,n);break}return this},ob.addResizeListener=function(e){var t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this},ob.removeResizeListener=function(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},ob.addSignalListener=function(e,t){return cb(this,e,sb(this,e),t)},ob.removeSignalListener=function(e,t){return fb(this,sb(this,e),t)},ob.addDataListener=function(e,t){return cb(this,e,Cv(this,e).values,t)},ob.removeDataListener=function(e,t){return fb(this,Cv(this,e).values,t)},ob.globalCursor=function(e){if(arguments.length){if(this._globalCursor!==!!e){var t=Dv(this,null);this._globalCursor=!!e,t&&Dv(this,t)}return this}return this._globalCursor},ob.preventDefault=function(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},ob.timer=function(e,t){this._timers.push(h.interval((function(t){e({timestamp:Date.now(),elapsed:t})}),t))},ob.events=function(e,t,n){var r,i=this,a=new Dt(n),u=function(n,r){i.runAsync(null,(function(){"view"===e&&function(e,t){var n=e._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[t]:i?!i[t]:e.preventDefault()))}(i,t)&&n.preventDefault(),a.receive(Ov(i,n,r))}))};if("timer"===e)zv(i,"timer",t)&&i.timer(u,t);else if("view"===e)zv(i,"view",t)&&i.addEventListener(t,u,Rv);else if("window"===e?zv(i,"window",t)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&zv(i,"selector",t)&&(r=document.querySelectorAll(e)),r){for(var o=0,s=r.length;o=0;)i[e].stop();for(e=a.length;--e>=0;)for(t=(n=a[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);return r&&r.call(this,this._handler,null,null,null),this},ob.hover=function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",Tv),Pv,qv(e)),this.on(this.events("view","mouseout",Tv),Pv,qv(t)),this},ob.data=function(e,t){return arguments.length<2?Cv(this,e).values.value:Mv.call(this,e,mt().remove(U).insert(t))},ob.change=Mv,ob.insert=function(e,t){return Mv.call(this,e,mt().insert(t))},ob.remove=function(e,t){return Mv.call(this,e,mt().remove(t))},ob.scale=function(e){var t=this._runtime.scales;return Fe(t,e)||O("Unrecognized scale or projection: "+e),t[e].value},ob.initialize=function(e,t){var n=this,r=n._renderType,i=n._eventConfig.bind,a=Rd(r);e=n._el=e?Vv(n,e):null,function(e){var t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),wv(t,e.description()))}(n),a||n.error("Unrecognized renderer type: "+r);var u=a.handler||sc,o=e?a.renderer:a.headless;return n._renderer=o?Gv(n,n._renderer,e,o):null,n._handler=function(e,t,n,r){var i=new r(e.loader(),Yv(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,Sv(e),e);return t&&t.handlers().forEach((function(e){i.on(e.type,e.handler)})),i}(n,n._handler,e,u),n._redraw=!0,e&&"none"!==i&&(t=t?n._elBind=Vv(n,t):e.appendChild(Lv("form",{class:"vega-bindings"})),n._bind.forEach((function(e){e.param.element&&"container"!==i&&(e.element=Vv(n,e.param.element))})),n._bind.forEach((function(e){Nv(n,e.element||t,e)}))),n},ob.toImageURL=function(e,t){return Zv.apply(this,arguments)},ob.toCanvas=function(e,t){return tg.apply(this,arguments)},ob.toSVG=function(e){return ng.apply(this,arguments)},ob.getState=function(e){return this._runtime.getState(e||{data:tb,signals:nb,recurse:!0})},ob.setState=function(e){return this.runAsync(null,(function(t){t._trigger=!1,t._runtime.setState(e)}),(function(e){e._trigger=!0})),this};var hb=function(e){return+e||0};function pb(e){return H(e)?e.signal?e:{top:hb(e.top),bottom:hb(e.bottom),left:hb(e.left),right:hb(e.right)}:{top:t=hb(e),bottom:t,left:t,right:t};var t}var mb=function(e){return H(e)&&!W(e)?De({},e):{value:e}};function vb(e,t,n,r){return null!=n?(H(n)&&!W(n)?e.update[t]=n:e[r||"enter"][t]={value:n},1):0}function gb(e,t,n){for(var r in t)vb(e,r,t[r]);for(var i in n)vb(e,i,n[i],"update")}function yb(e,t,n){for(var r in t)n&&Fe(n,r)||(e[r]=De(e[r]||{},t[r]));return e}function bb(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function xb(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}var _b=function(e){return Ne(e)?Ye(e):e.signal?"(".concat(e.signal,")"):Db(e)};function kb(e){if(null!=e.gradient)return function(e){var t=[e.start,e.stop,e.count].map((function(e){return null==e?null:Ye(e)}));for(;t.length&&null==J(t);)t.pop();return t.unshift(_b(e.gradient)),"gradient(".concat(t.join(","),")")}(e);var t=e.signal?"(".concat(e.signal,")"):e.color?function(e){return e.c?Ab("hcl",e.h,e.c,e.l):e.h||e.s?Ab("hsl",e.h,e.s,e.l):e.l||e.a?Ab("lab",e.l,e.a,e.b):e.r||e.g||e.b?Ab("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?Db(e.field):void 0!==e.value?Ye(e.value):void 0;return null!=e.scale&&(t=function(e,t){var n=_b(e.scale);null!=e.range?t="lerp(_range(".concat(n,"), ").concat(+e.range,")"):(void 0!==t&&(t="_scale(".concat(n,", ").concat(t,")")),e.band&&(t=(t?t+"+":"")+"_bandwidth(".concat(n,")")+(1==+e.band?"":"*"+wb(e.band)),e.extra&&(t="(datum.extra ? _scale(".concat(n,", datum.extra.value) : ").concat(t,")"))),null==t&&(t="0"));return t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t="pow(".concat(t,",").concat(wb(e.exponent),")")),null!=e.mult&&(t+="*".concat(wb(e.mult))),null!=e.offset&&(t+="+".concat(wb(e.offset))),e.round&&(t="round(".concat(t,")")),t}var Ab=function(e,t,n,r){return"(".concat(e,"(").concat([t,n,r].map(kb).join(","),")+'')")};function wb(e){return H(e)?"("+kb(e)+")":e}function Db(e){return function e(t){var n,r,i;if(t.signal)n="datum",i=t.signal;else if(t.group||t.parent){for(r=Math.max(1,t.level||1),n="item";r-- >0;)n+=".mark.group";t.parent?(i=t.parent,n+=".datum"):i=t.group}else t.datum?(n="datum",i=t.datum):O("Invalid field reference: "+Ye(t));t.signal||(i=Ne(i)?R(i).map(Ye).join("]["):e(i));return n+"["+i+"]"}(H(e)?e:{datum:e})}function Cb(e,t,n,r,i,a){var u={};for(var o in(a=a||{}).encoders={$encode:u},e=function(e,t,n,r,i){var a,u,o,s={},l={};for(u in u="lineBreak","text"!==t||null==i[u]||bb(u,e)||xb(s,u,i[u]),("legend"==n||String(n).startsWith("axis"))&&(n=null),o="frame"===n?i.group:"mark"===n?De({},i.mark,i[t]):null)bb(u,e)||("fill"===u||"stroke"===u)&&(bb("fill",e)||bb("stroke",e))||xb(s,u,o[u]);for(u in me(r).forEach((function(t){var n=i.style&&i.style[t];for(var r in n)bb(r,e)||xb(s,r,n[r])})),e=De({},e),s)(o=s[u]).signal?(a=a||{})[u]=o:l[u]=o;return e.enter=De(l,e.enter),a&&(e.update=De(a,e.update)),e}(e,t,n,r,i.config))u[o]=Mb(e[o],t,a,i);return a}function Mb(e,t,n,r){var i,a={},u={};for(var o in e)null!=e[o]&&(a[o]=Eb((i=e[o],W(i)?function(e){var t="";return e.forEach((function(e){var n=kb(e);t+=e.test?"(".concat(e.test,")?").concat(n,":"):n})),":"===J(t)&&(t+="null"),t}(i):kb(i)),r,n,u));return{$expr:{marktype:t,channels:a},$fields:Object.keys(u),$output:Object.keys(e)}}function Eb(e,t,n,r){var i=Uy(e,t);return i.$fields.forEach((function(e){return r[e]=1})),De(n,i.$params),i.$expr}var Fb=["value","update","init","react","bind"];function Sb(e,t){O(e+' for "outer" push: '+Ye(t))}function Bb(e,t){var n=e.name;if("outer"===e.push)t.signals[n]||Sb("No prior signal definition",n),Fb.forEach((function(t){void 0!==e[t]&&Sb("Invalid property ",t)}));else{var r=t.addSignal(n,e.value);!1===e.react&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}}function Ob(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function Rb(e,t,n,r){return new Ob(e,t,n,r)}function zb(e,t){return Rb("operator",e,t)}function Tb(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Pb(e,t){return t?{$field:e,$name:t}:{$field:e}}var qb=Pb("key");function Lb(e,t){return{$compare:e,$order:t}}function Nb(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function Ub(e){return e&&e.signal}function Ib(e){if(Ub(e))return!0;if(H(e))for(var t in e)if(Ib(e[t]))return!0;return!1}function jb(e,t){return null!=e?e:t}function $b(e){return e&&e.signal||e}function Wb(e,t){return(e.merge?Hb:e.stream?Gb:e.type?Yb:O("Invalid stream specification: "+Ye(e)))(e,t)}function Hb(e,t){var n=Vb({merge:e.merge.map((function(e){return Wb(e,t)}))},e,t);return t.addStream(n).id}function Gb(e,t){var n=Vb({stream:Wb(e.stream,t)},e,t);return t.addStream(n).id}function Yb(e,t){var n,r;return"timer"===e.type?(n=t.event("timer",e.throttle),e={between:e.between,filter:e.filter}):n=t.event(function(e){return"scope"===e?"view":e||"view"}(e.source),e.type),r=Vb({stream:n},e,t),1===Object.keys(r).length?n:t.addStream(r).id}function Vb(e,t,n){var r=t.between;return r&&(2!==r.length&&O('Stream "between" parameter must have 2 entries: '+Ye(t)),e.between=[Wb(r[0],n),Wb(r[1],n)]),r=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&r.push(function(e,t,n){var r="event.item";return r+(e&&"*"!==e?"&&"+r+".mark.marktype==='"+e+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(t?"&&"+r+".mark.name==='"+t+"'":"")}(t.marktype,t.markname,t.markrole)),"scope"===t.source&&r.push("inScope(event.item)"),r.length&&(e.filter=Uy("("+r.join(")&&(")+")",n).$expr),null!=(r=t.throttle)&&(e.throttle=+r),null!=(r=t.debounce)&&(e.debounce=+r),t.consume&&(e.consume=!0),e}var Xb,Jb,Kb="view",Qb=/[[\]{}]/,Zb={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function ex(e,t,n,r,i){for(var a,u=0,o=e.length;t=0?--u:r&&r.indexOf(a)>=0&&++u}return t}function tx(e){for(var t=[],n=0,r=e.length,i=0;i"!==(e=e.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+e;if(t=t.map(nx),(n=nx(e.slice(1).trim())).between)return{between:t,stream:n};n.between=t;return n}(e):function(e){var t,n,r={source:Xb},i=[],a=[0,0],u=0,o=0,s=e.length,l=0;if("}"===e[s-1]){if(!((l=e.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+e;try{a=function(e){var t=e.split(",");if(!e.length||t.length>2)throw e;return t.map((function(t){var n=+t;if(n!=n)throw e;return n}))}(e.substring(l+1,s-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,l).trim(),s=e.length,l=0}if(!s)throw e;"@"===e[0]&&(u=++l);(t=ex(e,l,":"))1?(r.type=i[1],u?r.markname=i[0].slice(1):!function(e){return Jb[e]}(i[0])?r.source=i[0]:r.marktype=i[0]):r.type=i[0];"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=n&&(r.filter=n);a[0]&&(r.throttle=a[0]);a[1]&&(r.debounce=a[1]);return r}(e)}var rx={code:"_.$value",ast:{type:"Identifier",value:"value"}};function ix(e,t,n){var r=e.events,i=e.update,a=e.encode,u=[],o={target:n};r||O("Signal update missing events specification."),Ne(r)&&(r=function(e,t,n){return Xb=t||Kb,Jb=n||Zb,tx(e.trim()).map(nx)}(r,t.isSubscope()?"scope":"view")),r=me(r).filter((function(e){return e.signal||e.scale?(u.push(e),0):1})),u.length>1&&(u=[ax(u)]),r.length&&u.push(r.length>1?{merge:r}:r[0]),null!=a&&(i&&O("Signal encode and update are mutually exclusive."),i="encode(item(),"+Ye(a)+")"),o.update=Ne(i)?Uy(i,t):null!=i.expr?Uy(i.expr,t):null!=i.value?i.value:null!=i.signal?{$expr:rx,$params:{$value:t.signalRef(i.signal)}}:O("Invalid signal update specification."),e.force&&(o.options={force:!0}),u.forEach((function(e){t.addUpdate(De(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):Wb(e,t)}}(e,t),o))}))}function ax(e){return{signal:"["+e.map((function(e){return e.scale?'scale("'+e.scale+'")':e.signal}))+"]"}}var ux=function(e){return function(t,n,r){return Rb(e,n,t||void 0,r)}},ox=ux("aggregate"),sx=ux("axisticks"),lx=ux("bound"),cx=ux("collect"),fx=ux("compare"),dx=ux("datajoin"),hx=ux("encode"),px=ux("expression"),mx=ux("facet"),vx=ux("field"),gx=ux("key"),yx=ux("legendentries"),bx=ux("load"),xx=ux("mark"),_x=ux("multiextent"),kx=ux("multivalues"),Ax=ux("overlap"),wx=ux("params"),Dx=ux("prefacet"),Cx=ux("projection"),Mx=ux("proxy"),Ex=ux("relay"),Fx=ux("render"),Sx=ux("scale"),Bx=ux("sieve"),Ox=ux("sortitems"),Rx=ux("viewlayout"),zx=ux("values"),Tx=0,Px={min:"min",max:"max",count:"sum"};function qx(e,t){var n,r=t.getScale(e.name).params;for(n in r.domain=Ix(e.domain,e,t),null!=e.range&&(r.range=function e(t,n,r){var i=t.range,a=n.config.range;if(i.signal)return n.signalRef(i.signal);if(Ne(i)){if(a&&Fe(a,i))return t=De({},t,{range:a[i]}),e(t,n,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=kf(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:O("Unrecognized scale range value: "+Ye(i))}else{if(i.scheme)return r.scheme=W(i.scheme)?Nx(i.scheme,n):Lx(i.scheme,n),i.extent&&(r.schemeExtent=Nx(i.extent,n)),void(i.count&&(r.schemeCount=Lx(i.count,n)));if(i.step)return void(r.rangeStep=Lx(i.step,n));if(kf(t.type)&&!W(i))return Ix(i,t,n);W(i)||O("Unsupported range type: "+Ye(i))}return i.map((function(e){return(W(e)?Nx:Lx)(e,n)}))}(e,t,r)),null!=e.interpolate&&function(e,t){t.interpolate=Lx(e.type||e),null!=e.gamma&&(t.interpolateGamma=Lx(e.gamma))}(e.interpolate,r),null!=e.nice&&(r.nice=function(e){return H(e)?{interval:Lx(e.interval),step:Lx(e.step)}:Lx(e)}(e.nice)),null!=e.bins&&(r.bins=function(e,t){return e.signal||W(e)?Nx(e,t):t.objectProperty(e)}(e.bins,t)),e)Fe(r,n)||"name"===n||(r[n]=Lx(e[n],t))}function Lx(e,t){return H(e)?e.signal?t.signalRef(e.signal):O("Unsupported object: "+Ye(e)):e}function Nx(e,t){return e.signal?t.signalRef(e.signal):e.map((function(e){return Lx(e,t)}))}function Ux(e){O("Can not find data set: "+Ye(e))}function Ix(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(W(e)?jx:e.fields?Wx:$x)(e,t,n);null==t.domainMin&&null==t.domainMax||O("No scale domain defined for domainMin/domainMax to override.")}function jx(e,t,n){return e.map((function(e){return Lx(e,n)}))}function $x(e,t,n){var r=n.getData(e.data);return r||Ux(e.data),kf(t.type)?r.valuesRef(n,e.field,Gx(e.sort,!1)):Cf(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function Wx(e,t,n){var r=e.data,i=e.fields.reduce((function(e,t){return t=Ne(t)?{data:r,field:t}:W(t)||t.signal?function(e,t){var n="_:vega:_"+Tx++,r=cx({});if(W(e))r.value={$ingest:e};else if(e.signal){var i="setdata("+Ye(n)+","+e.signal+")";r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,Bx({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e}),[]);return(kf(t.type)?Hx:Cf(t.type)?Yx:Vx)(e,n,i)}function Hx(e,t,n){var r,i,a,u,o,s=Gx(e.sort,!0);return r=n.map((function(e){var n=t.getData(e.data);return n||Ux(e.data),n.countsRef(t,e.field,s)})),i={groupby:qb,pulse:r},s&&(a=s.op||"count",o=s.field?Nb(a,s.field):"count",i.ops=[Px[a]],i.fields=[t.fieldRef(o)],i.as=[o]),a=t.add(ox(i)),u=t.add(cx({pulse:Tb(a)})),o=t.add(zx({field:qb,sort:t.sortRef(s),pulse:Tb(u)})),Tb(o)}function Gx(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!Px[e.op]&&O("Multiple domain scales can not be sorted using "+e.op):O("No field provided for sort aggregate op: "+e.op):H(e)?e.field="key":e={field:"key"}),e}function Yx(e,t,n){var r=n.map((function(e){var n=t.getData(e.data);return n||Ux(e.data),n.domainRef(t,e.field)}));return Tb(t.add(kx({values:r})))}function Vx(e,t,n){var r=n.map((function(e){var n=t.getData(e.data);return n||Ux(e.data),n.extentRef(t,e.field)}));return Tb(t.add(_x({extents:r})))}function Xx(e,t,n){return W(e)?e.map((function(e){return Xx(e,t,n)})):H(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:O("Unsupported parameter object: "+Ye(e)):e}var Jx="value",Kx=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],Qx={name:1,style:1,interactive:1},Zx={value:0},e_={value:1};function t_(e){return e.type="group",e.interactive=e.interactive||!1,e}function n_(e,t){var n=function(n,r){return jb(e[n],jb(t[n],r))};return n.isVertical=function(n){return"vertical"===jb(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection))},n.gradientLength=function(){return jb(e.gradientLength,t.gradientLength||t.gradientWidth)},n.gradientThickness=function(){return jb(e.gradientThickness,t.gradientThickness||t.gradientHeight)},n.entryColumns=function(){return jb(e.columns,jb(t.columns,+n.isVertical(!0)))},n}function r_(e,t){var n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function i_(e,t,n){return"item.anchor === '".concat("start","' ? ").concat(e," : item.anchor === '").concat("end","' ? ").concat(t," : ").concat(n)}var a_=i_(Ye("left"),Ye("right"),Ye("center"));function u_(e,t){return t?e?H(e)?Object.assign({},e,{offset:u_(e.offset,t)}):{value:e,offset:t}:t:e}function o_(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=yb(e.encode,t,Qx)):e.interactive=!1,e}function s_(e,t,n,r){var i,a,u,o,s,l,c=n_(e,n),f=c.isVertical(),d=c.gradientThickness(),h=c.gradientLength();return f?(u=[0,1],o=[0,0],s=d,l=h):(u=[0,0],o=[1,0],s=h,l=d),gb(i={enter:a={opacity:Zx,x:Zx,y:Zx,width:mb(s),height:mb(l)},update:De({},a,{opacity:e_,fill:{gradient:t,start:u,stop:o}}),exit:{opacity:Zx}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),o_({type:"rect",role:"legend-gradient",encode:i},r)}function l_(e,t,n,r,i){var a,u,o,s,l,c,f=n_(e,n),d=f.isVertical(),h=f.gradientThickness(),p=f.gradientLength(),m="";return d?(o="y",l="y2",s="x",c="width",m="1-"):(o="x",l="x2",s="y",c="height"),(u={opacity:Zx,fill:{scale:t,field:Jx}})[o]={signal:m+"datum.perc",mult:p},u[s]=Zx,u[l]={signal:m+"datum.perc2",mult:p},u[c]=mb(h),gb(a={enter:u,update:De({},u,{opacity:e_}),exit:{opacity:Zx}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),o_({type:"rect",role:"legend-band",key:Jx,from:i,encode:a},r)}var c_="datum.".concat("perc",'<=0?"').concat("left",'":datum.').concat("perc",'>=1?"').concat("right",'":"').concat("center",'"'),f_="datum.".concat("perc",'<=0?"').concat("bottom",'":datum.').concat("perc",'>=1?"').concat("top",'":"').concat("middle",'"');function d_(e,t,n,r){var i,a,u,o,s,l=n_(e,t),c=l.isVertical(),f=mb(l.gradientThickness()),d=l.gradientLength(),h=l("labelOverlap"),p="";return gb(i={enter:a={opacity:Zx},update:u={opacity:e_,text:{field:"label"}},exit:{opacity:Zx}},{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:jb(e.labelLimit,t.gradientLabelLimit)}),c?(a.align={value:"left"},a.baseline=u.baseline={signal:f_},o="y",s="x",p="1-"):(a.align=u.align={signal:c_},a.baseline={value:"top"},o="x",s="y"),a[o]=u[o]={signal:p+"datum.perc",mult:d},a[s]=u[s]=f,f.offset=jb(e.labelOffset,t.gradientLabelOffset)||0,h=h?{separation:l("labelSeparation"),method:h,order:"datum.index"}:void 0,o_({type:"text",role:"legend-label",style:"guide-label",key:Jx,from:r,encode:i,overlap:h},n)}function h_(e,t,n,r,i){var a,u,o,s,l,c,f,d=n_(e,t),h=n.entries,p=!(!h||!h.interactive),m=h?h.name:void 0,v=d("clipHeight"),g=d("symbolOffset"),y={data:"value"},b={},x="(".concat(i,") ? datum.").concat("offset"," : datum.").concat("size"),_=v?mb(v):{field:"size"},k="datum.".concat("index"),A="max(1, ".concat(i,")");_.mult=.5,b={enter:a={opacity:Zx,x:{signal:x,mult:.5,offset:g},y:_},update:u={opacity:e_,x:a.x,y:a.y},exit:{opacity:Zx}};var w=null,D=null;return e.fill||(w=t.symbolBaseFillColor,D=t.symbolBaseStrokeColor),gb(b,{fill:d("symbolFillColor",w),shape:d("symbolType"),size:d("symbolSize"),stroke:d("symbolStrokeColor",D),strokeDash:d("symbolDash"),strokeDashOffset:d("symbolDashOffset"),strokeWidth:d("symbolStrokeWidth")},{opacity:d("symbolOpacity")}),Kx.forEach((function(t){e[t]&&(u[t]=a[t]={scale:e[t],field:Jx})})),s=o_({type:"symbol",role:"legend-symbol",key:Jx,from:y,clip:!!v||void 0,encode:b},n.symbols),(o=mb(g)).offset=d("labelOffset"),gb(b={enter:a={opacity:Zx,x:{signal:x,offset:o},y:_},update:u={opacity:e_,text:{field:"label"},x:a.x,y:a.y},exit:{opacity:Zx}},{align:d("labelAlign"),baseline:d("labelBaseline"),fill:d("labelColor"),fillOpacity:d("labelOpacity"),font:d("labelFont"),fontSize:d("labelFontSize"),fontStyle:d("labelFontStyle"),fontWeight:d("labelFontWeight"),limit:d("labelLimit")}),l=o_({type:"text",role:"legend-label",style:"guide-label",key:Jx,from:y,encode:b},n.labels),b={enter:{noBound:{value:!v},width:Zx,height:v?mb(v):Zx,opacity:Zx},exit:{opacity:Zx},update:u={opacity:e_,row:{signal:null},column:{signal:null}}},d.isVertical(!0)?(c="ceil(item.mark.items.length / ".concat(A,")"),u.row.signal="".concat(k,"%").concat(c),u.column.signal="floor(".concat(k," / ").concat(c,")"),f={field:["row",k]}):(u.row.signal="floor(".concat(k," / ").concat(A,")"),u.column.signal="".concat(k," % ").concat(A),f={field:k}),u.column.signal="(".concat(i,")?").concat(u.column.signal,":").concat(k),t_({role:"scope",from:r={facet:{data:r,name:"value",groupby:"index"}},encode:yb(b,h,Qx),marks:[s,l],name:m,interactive:p,sort:f})}var p_='item.orient === "left"',m_='item.orient === "right"',v_="(".concat(p_," || ").concat(m_,")"),g_="datum.vgrad && ".concat(v_),y_=i_('"top"','"bottom"','"middle"'),b_=i_('"right"','"left"','"center"'),x_="datum.vgrad && ".concat(m_," ? (").concat(b_,") : (").concat(v_," && !(datum.vgrad && ").concat(p_,')) ? "left" : ').concat(a_),__="item._anchor || (".concat(v_,' ? "middle" : "start")'),k_="".concat(g_," ? (").concat(p_," ? -90 : 90) : 0"),A_="".concat(v_," ? (datum.vgrad ? (").concat(m_,' ? "bottom" : "top") : ').concat(y_,') : "top"');function w_(e,t){var n;return H(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+D_(e.path)+")":e.sphere&&(n="geoShape("+D_(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function D_(e){return H(e)&&e.signal?e.signal:Ye(e)}function C_(e){var t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?"group"===e.type?"scope":t||"mark":t}function M_(e){return{marktype:e.type,name:e.name||void 0,role:e.role||C_(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function E_(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function F_(e,t){var n=hi(e.type);n||O("Unrecognized transform type: "+Ye(e.type));var r=Rb(n.type.toLowerCase(),null,S_(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function S_(e,t,n){var r,i,a,u={};for(i=0,a=e.params.length;i0?",":"")+(H(t=e[r])?t.signal||Fk(t):Ye(t));return n+"]"}function Bk(e){var t,n,r="{",i=0;for(t in e)n=e[t],r+=(++i>1?",":"")+Ye(t)+":"+(H(n)?n.signal||Fk(n):Ye(n));return r+"}"}Ek.parse=function(e){return Ak(e,this)},Ek.fork=function(){return new Mk(this)},Ek.isSubscope=function(){return this._subid>0},Ek.toRuntime=function(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},Ek.id=function(){return(this._subid?this._subid+":":0)+this._id++},Ek.add=function(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((function(t){t.$ref=e.id})),e.refs=null),e},Ek.proxy=function(e){var t=e instanceof Ob?Tb(e):e;return this.add(Mx({value:t}))},Ek.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},Ek.addUpdate=function(e){return this.updates.push(e),e},Ek.finish=function(){var e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){var r;e&&((r=e.data||(e.data={}))[t]||(r[t]=[])).push(n)}for(e in this.data)for(var r in n((t=this.data[e]).input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values"),t.index)n(t.index[r],e,"index:"+r);return this},Ek.pushState=function(e,t,n){this._encode.push(Tb(this.add(Bx({pulse:e})))),this._parent.push(t),this._lookup.push(n?Tb(this.proxy(n)):null),this._markpath.push(-1)},Ek.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},Ek.parent=function(){return J(this._parent)},Ek.encode=function(){return J(this._encode)},Ek.lookup=function(){return J(this._lookup)},Ek.markpath=function(){var e=this._markpath;return++e[e.length-1]},Ek.fieldRef=function(e,t){if(Ne(e))return Pb(e,t);e.signal||O("Unsupported field reference: "+Ye(e));var n,r=e.signal,i=this.field[r];return i||(n={name:this.signalRef(r)},t&&(n.as=t),this.field[r]=i=Tb(this.add(vx(n)))),i},Ek.compareRef=function(e){function t(e){return Ub(e)?(r=!0,n.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(r=!0,n.exprRef(e.expr)):e}var n=this,r=!1,i=me(e.field).map(t),a=me(e.order).map(t);return r?Tb(this.add(fx({fields:i,orders:a}))):Lb(i,a)},Ek.keyRef=function(e,t){var n=this.signals,r=!1;return e=me(e).map((function(e){return Ub(e)?(r=!0,Tb(n[e.signal])):e})),r?Tb(this.add(gx({fields:e,flat:t}))):function(e,t){var n={$key:e};return t&&(n.$flat=!0),n}(e,t)},Ek.sortRef=function(e){if(!e)return e;var t=Nb(e.op,e.field),n=e.order||"ascending";return n.signal?Tb(this.add(fx({fields:t,orders:this.signalRef(n.signal)}))):Lb(t,n)},Ek.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},Ek.hasOwnSignal=function(e){return Fe(this.signals,e)},Ek.addSignal=function(e,t){this.hasOwnSignal(e)&&O("Duplicate signal name: "+Ye(e));var n=t instanceof Ob?t:this.add(zb(t));return this.signals[e]=n},Ek.getSignal=function(e){return this.signals[e]||O("Unrecognized signal name: "+Ye(e)),this.signals[e]},Ek.signalRef=function(e){return this.signals[e]?Tb(this.signals[e]):(Fe(this.lambdas,e)||(this.lambdas[e]=this.add(zb(null))),Tb(this.lambdas[e]))},Ek.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,n=e.length;t=r&&e=i?1:(t-r+1)/a},u.icdf=function(e){return e>=0&&e<=1?r-1+Math.floor(e*a):NaN},u.min(t).max(n)},e.randomKDE=$i,e.randomLCG=function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},e.randomLogNormal=Vi,e.randomMixture=Xi,e.randomNormal=ji,e.randomUniform=ea,e.read=Nr,e.regressionExp=oa,e.regressionLinear=aa,e.regressionLoess=da,e.regressionLog=ua,e.regressionPoly=ca,e.regressionPow=sa,e.regressionQuad=la,e.renderModule=Rd,e.repeat=We,e.resetDefaultLocale=function(){return Cn(),Rr(),Lr()},e.resetSVGClipId=Uo,e.resetSVGDefIds=function(){Uo(),Wu=0},e.responseType=en,e.runtimeContext=Xy,e.sampleCurve=va,e.sampleLogNormal=Wi,e.sampleNormal=Li,e.sampleUniform=Ji,e.scale=yf,e.sceneEqual=Ud,e.sceneFromJSON=Ll,e.scenePickVisit=Fs,e.sceneToJSON=ql,e.sceneVisit=Es,e.sceneZOrder=Ms,e.scheme=Pf,e.setRandom=function(t){e.random=t},e.span=Ge,e.splitAccessPath=R,e.stringValue=Ye,e.textMetrics=pl,e.timeBin=Sr,e.timeFloor=or,e.timeFormatLocale=Tr,e.timeInterval=hr,e.timeOffset=vr,e.timeSequence=br,e.timeUnitSpecifier=jn,e.timeUnits=Un,e.toBoolean=Ve,e.toDate=Je,e.toNumber=K,e.toSet=Qe,e.toString=Ke,e.transform=pi,e.transforms=di,e.truncate=Ze,e.truthy=U,e.tupleid=ot,e.typeParsers=It,e.utcFloor=cr,e.utcInterval=pr,e.utcOffset=gr,e.utcSequence=xr,e.utcdayofyear=Kn,e.utcquarter=pe,e.utcweek=Qn,e.version="5.13.0",e.visitArray=et,e.week=Gn,e.writeConfig=V,e.zero=L,e.zoomLinear=le,e.zoomLog=ce,e.zoomPow=fe,e.zoomSymlog=de,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega/build-es5/vega-module.js b/node_modules/vega/build-es5/vega-module.js deleted file mode 100644 index 2d4bc2b..0000000 --- a/node_modules/vega/build-es5/vega-module.js +++ /dev/null @@ -1,36585 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Bounds = Bounds; -exports.CanvasHandler = CanvasHandler; -exports.CanvasRenderer = CanvasRenderer; -exports.Dataflow = Dataflow; -exports.EventStream = EventStream; -exports.Gradient = Gradient; -exports.GroupItem = GroupItem; -exports.Handler = Handler; -exports.Item = Item; -exports.MultiPulse = MultiPulse; -exports.Operator = Operator; -exports.Parameters = Parameters; -exports.Pulse = Pulse; -exports.Renderer = Renderer; -exports.ResourceLoader = ResourceLoader; -exports.SVGHandler = SVGHandler; -exports.SVGRenderer = SVGRenderer; -exports.SVGStringRenderer = SVGStringRenderer; -exports.Scenegraph = Scenegraph; -exports.Transform = Transform; -exports.View = View; -exports.accessor = accessor; -exports.accessorFields = accessorFields; -exports.accessorName = accessorName; -exports.array = array; -exports.bandwidthNRD = bandwidthNRD; -exports.bin = bin; -exports.bootstrapCI = bootstrapCI; -exports.boundClip = boundClip; -exports.boundContext = context; -exports.boundItem = boundItem; -exports.boundMark = boundMark; -exports.boundStroke = boundStroke; -exports.changeset = changeset; -exports.clampRange = clampRange; -exports.closeTag = closeTag; -exports.compare = compare; -exports.constant = constant; -exports.cumulativeLogNormal = cumulativeLogNormal; -exports.cumulativeNormal = cumulativeNormal; -exports.cumulativeUniform = cumulativeUniform; -exports.dayofyear = dayofyear; -exports.debounce = debounce; -exports.defaultLocale = defaultLocale; -exports.definition = definition; -exports.densityLogNormal = densityLogNormal; -exports.densityNormal = densityNormal; -exports.densityUniform = densityUniform; -exports.domChild = domChild; -exports.domClear = domClear; -exports.domCreate = domCreate; -exports.domFind = domFind; -exports.dotbin = dotbin; -exports.error = error; -exports.expressionFunction = expressionFunction; -exports.extend = extend; -exports.extent = extent; -exports.extentIndex = extentIndex; -exports.fastmap = fastmap; -exports.field = field; -exports.flush = flush; -exports.font = font; -exports.fontFamily = fontFamily; -exports.fontSize = fontSize; -exports.formatLocale = numberFormatDefaultLocale; -exports.formats = formats; -exports.hasOwnProperty = hasOwnProperty; -exports.inferType = inferType; -exports.inferTypes = inferTypes; -exports.ingest = ingest; -exports.inherits = inherits; -exports.inrange = inrange; -exports.interpolate = interpolate; -exports.interpolateColors = interpolateColors; -exports.interpolateRange = interpolateRange; -exports.intersect = intersect; -exports.intersectBoxLine = intersectBoxLine; -exports.intersectPath = intersectPath; -exports.intersectPoint = intersectPoint; -exports.intersectRule = intersectRule; -exports.isBoolean = isBoolean; -exports.isDate = isDate; -exports.isFunction = isFunction; -exports.isNumber = isNumber; -exports.isObject = isObject; -exports.isRegExp = isRegExp; -exports.isString = isString; -exports.isTuple = isTuple; -exports.key = key; -exports.lerp = lerp; -exports.lineHeight = lineHeight; -exports.locale = locale; -exports.logger = logger; -exports.lruCache = lruCache; -exports.merge = merge; -exports.mergeConfig = mergeConfig; -exports.multiLineOffset = multiLineOffset; -exports.openTag = openTag; -exports.pad = pad; -exports.panLinear = panLinear; -exports.panLog = panLog; -exports.panPow = panPow; -exports.panSymlog = panSymlog; -exports.parse = parse$6; -exports.pathCurves = curves; -exports.pathEqual = pathEqual; -exports.pathParse = pathParse; -exports.pathRectangle = vg_rect; -exports.pathRender = pathRender; -exports.pathSymbols = symbols; -exports.pathTrail = vg_trail; -exports.peek = peek; -exports.point = point; -exports.projection = projection; -exports.quantileLogNormal = quantileLogNormal; -exports.quantileNormal = quantileNormal; -exports.quantileUniform = quantileUniform; -exports.quantiles = quantiles; -exports.quantizeInterpolator = quantizeInterpolator; -exports.quarter = quarter; -exports.quartiles = quartiles; -exports.randomInteger = integer; -exports.randomKDE = randomKDE; -exports.randomLCG = lcg; -exports.randomLogNormal = randomLogNormal; -exports.randomMixture = randomMixture; -exports.randomNormal = randomNormal; -exports.randomUniform = randomUniform; -exports.read = read; -exports.regressionExp = regressionExp; -exports.regressionLinear = regressionLinear; -exports.regressionLoess = regressionLoess; -exports.regressionLog = regressionLog; -exports.regressionPoly = regressionPoly; -exports.regressionPow = regressionPow; -exports.regressionQuad = regressionQuad; -exports.renderModule = renderModule; -exports.repeat = repeat; -exports.resetDefaultLocale = resetDefaultLocale; -exports.resetSVGClipId = resetSVGClipId; -exports.resetSVGDefIds = resetSVGDefIds; -exports.responseType = responseType; -exports.runtimeContext = context$2; -exports.sampleCurve = sampleCurve; -exports.sampleLogNormal = sampleLogNormal; -exports.sampleNormal = sampleNormal; -exports.sampleUniform = sampleUniform; -exports.scale = scale$2; -exports.sceneEqual = sceneEqual; -exports.sceneFromJSON = sceneFromJSON; -exports.scenePickVisit = pickVisit; -exports.sceneToJSON = sceneToJSON; -exports.sceneVisit = visit; -exports.sceneZOrder = zorder; -exports.scheme = scheme; -exports.setRandom = setRandom; -exports.span = span; -exports.splitAccessPath = splitAccessPath; -exports.stringValue = $; -exports.timeBin = timeBin; -exports.timeFloor = timeFloor; -exports.timeFormatLocale = timeFormatDefaultLocale; -exports.timeInterval = timeInterval; -exports.timeOffset = timeOffset; -exports.timeSequence = timeSequence; -exports.timeUnitSpecifier = timeUnitSpecifier; -exports.timeUnits = timeUnits; -exports.toBoolean = toBoolean; -exports.toDate = toDate; -exports.toNumber = toNumber; -exports.toSet = toSet; -exports.toString = toString; -exports.transform = transform; -exports.truncate = truncate; -exports.tupleid = tupleid; -exports.utcFloor = utcFloor; -exports.utcInterval = utcInterval; -exports.utcOffset = utcOffset; -exports.utcSequence = utcSequence; -exports.utcdayofyear = utcdayofyear; -exports.utcquarter = utcquarter; -exports.utcweek = utcweek; -exports.visitArray = visitArray; -exports.week = week; -exports.writeConfig = writeConfig; -exports.zoomLinear = zoomLinear; -exports.zoomLog = zoomLog; -exports.zoomPow = zoomPow; -exports.zoomSymlog = zoomSymlog; -exports.zero = exports.version = exports.typeParsers = exports.truthy = exports.transforms = exports.textMetrics = exports.random = exports.one = exports.loader = exports.isArray = exports.identity = exports.id = exports.format = exports.falsy = exports.YEAR = exports.Warn = exports.WEEK = exports.TIME_UNITS = exports.SECONDS = exports.RenderType = exports.QUARTER = exports.None = exports.Marks = exports.MONTH = exports.MINUTES = exports.MILLISECONDS = exports.Info = exports.HOURS = exports.Error = exports.Debug = exports.DAYOFYEAR = exports.DAY = exports.DATE = void 0; - -var _d3Dsv = require("d3-dsv"); - -var _topojsonClient = require("topojson-client"); - -var _d3Format = require("d3-format"); - -var _d3Time = require("d3-time"); - -var _d3TimeFormat = require("d3-time-format"); - -var _d3Shape = require("d3-shape"); - -var _d3Path = require("d3-path"); - -var $$1 = _interopRequireWildcard(require("d3-interpolate")); - -var _d3Geo = require("d3-geo"); - -var _d3Color = require("d3-color"); - -var _d3Force = require("d3-force"); - -var _d3Hierarchy = require("d3-hierarchy"); - -var _d3Timer = require("d3-timer"); - -var _defaultSpecifiers, _localGet, _localInv, _utcGet, _utcInv, _timeIntervals, _utcIntervals, _symbols$, _formats$; - -function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var _marked = /*#__PURE__*/regeneratorRuntime.mark(numbers), - _marked2 = /*#__PURE__*/regeneratorRuntime.mark(numbers$1), - _marked3 = /*#__PURE__*/regeneratorRuntime.mark(flatIterable); - -function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e4) { throw _e4; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e5) { didErr = true; err = _e5; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - -function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; -} - -function accessorName(fn) { - return fn == null ? null : fn.fname; -} - -function accessorFields(fn) { - return fn == null ? null : fn.fields; -} - -function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); -} - -var get1 = function get1(field) { - return function (obj) { - return obj[field]; - }; -}; - -var getN = function getN(path) { - var len = path.length; - return function (obj) { - for (var i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - - return obj; - }; -}; - -function error(message) { - throw Error(message); -} - -function splitAccessPath(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, - j, - c; - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i = j = 0; j < n; ++j) { - c = p[j]; - - if (c === '\\') { - s += p.substring(i, j); - s += p.substring(++j, ++j); - i = j; - } else if (c === q) { - push(); - q = null; - b = -1; - } else if (q) { - continue; - } else if (i === b && c === '"') { - i = j + 1; - q = c; - } else if (i === b && c === "'") { - i = j + 1; - q = c; - } else if (c === '.' && !b) { - if (j > i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; -} - -function field(field, name, opt) { - var path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor((opt && opt.get || getter)(path), [field], name || field); -} - -var empty = []; -var id = field('id'); -exports.id = id; -var identity = accessor(function (_) { - return _; -}, empty, 'identity'); -exports.identity = identity; -var zero = accessor(function () { - return 0; -}, empty, 'zero'); -exports.zero = zero; -var one = accessor(function () { - return 1; -}, empty, 'one'); -exports.one = one; -var truthy = accessor(function () { - return true; -}, empty, 'true'); -exports.truthy = truthy; -var falsy = accessor(function () { - return false; -}, empty, 'false'); -exports.falsy = falsy; - -function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console -} - -var None = 0; -exports.None = None; -var Error$1 = 1; -exports.Error = Error$1; -var Warn = 2; -exports.Warn = Warn; -var Info = 3; -exports.Info = Info; -var Debug = 4; -exports.Debug = Debug; - -function logger(_, method) { - var _level = _ || None; - - return { - level: function level(_) { - if (arguments.length) { - _level = +_; - return this; - } else { - return _level; - } - }, - error: function error() { - if (_level >= Error$1) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function warn() { - if (_level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function info() { - if (_level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function debug() { - if (_level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; -} - -var isArray = Array.isArray; -exports.isArray = isArray; - -function isObject(_) { - return _ === Object(_); -} - -var isLegalKey = function isLegalKey(key) { - return key !== '__proto__'; -}; - -function mergeConfig() { - for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) { - configs[_key] = arguments[_key]; - } - - return configs.reduce(function (out, source) { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? { - layout: 1 - } : key === 'style' ? true : null; - writeConfig(out, key, source[key], r); - } - } - - return out; - }, {}); -} - -function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - var k, o; - - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : output[key] = {}; - - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } -} - -function mergeNamed(a, b) { - if (a == null) return b; - var map = {}, - out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; -} - -function peek(array) { - return array[array.length - 1]; -} - -function toNumber(_) { - return _ == null || _ === '' ? null : +_; -} - -function exp(sign) { - return function (x) { - return sign * Math.exp(x); - }; -} - -function log$1(sign) { - return function (x) { - return Math.log(sign * x); - }; -} - -function symlog(c) { - return function (x) { - return Math.sign(x) * Math.log1p(Math.abs(x / c)); - }; -} - -function symexp(c) { - return function (x) { - return Math.sign(x) * Math.expm1(Math.abs(x)) * c; - }; -} - -function pow(exponent) { - return function (x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; -} - -function pan(domain, delta, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - dd = (d1 - d0) * delta; - return [ground(d0 - dd), ground(d1 - dd)]; -} - -function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); -} - -function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log$1(sign), exp(sign)); -} - -function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1 / exponent)); -} - -function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); -} - -function zoom(domain, anchor, scale, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)]; -} - -function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); -} - -function zoomLog(domain, anchor, scale) { - var sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log$1(sign), exp(sign)); -} - -function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent)); -} - -function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); -} - -function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); -} - -function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); -} - -function array(_) { - return _ != null ? isArray(_) ? _ : [_] : []; -} -/** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ - - -function clampRange(range, min, max) { - var lo = range[0], - hi = range[1], - span; - - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - - span = hi - lo; - return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span]; -} - -function isFunction(_) { - return typeof _ === 'function'; -} - -var DESCENDING = 'descending'; - -function compare(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - var ord = [], - get = [], - fmap = {}, - gen = opt.comparator || comparator; - array(fields).forEach(function (f, i) { - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach(function (_) { - return fmap[_] = 1; - }); - }); - return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap)); -} - -var compare$1 = function compare$1(u, v) { - return (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; -}; - -var comparator = function comparator(fields, orders) { - return fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); -}; - -var compare1 = function compare1(field, order) { - return function (a, b) { - return compare$1(field(a), field(b)) * order; - }; -}; - -var compareN = function compareN(fields, orders, n) { - orders.push(0); // pad zero for convenient lookup - - return function (a, b) { - var f, - c = 0, - i = -1; - - while (c === 0 && ++i < n) { - f = fields[i]; - c = compare$1(f(a), f(b)); - } - - return c * orders[i]; - }; -}; - -function constant(_) { - return isFunction(_) ? _ : function () { - return _; - }; -} - -function debounce(delay, handler) { - var tid, evt; - - function callback() { - handler(evt); - tid = evt = null; - } - - return function (e) { - evt = e; - if (tid) clearTimeout(tid); - tid = setTimeout(callback, delay); - }; -} - -function extend(_) { - for (var x, k, i = 1, len = arguments.length; i < len; ++i) { - x = arguments[i]; - - for (k in x) { - _[k] = x[k]; - } - } - - return _; -} -/** - * Return an array with minimum and maximum values, in the - * form [min, max]. Ignores null, undefined, and NaN values. - */ - - -function extent(array, f) { - var i = 0, - n, - v, - min, - max; - - if (array && (n = array.length)) { - if (f == null) { - // find first valid value - for (v = array[i]; i < n && (v == null || v !== v); v = array[++i]) { - ; - } - - min = max = v; // visit all other values - - for (; i < n; ++i) { - v = array[i]; // skip null/undefined; NaN will fail all comparisons - - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } else { - // find first valid value - for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])) { - ; - } - - min = max = v; // visit all other values - - for (; i < n; ++i) { - v = f(array[i]); // skip null/undefined; NaN will fail all comparisons - - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } - } - - return [min, max]; -} - -function extentIndex(array, f) { - var i = -1, - n = array.length, - a, - b, - c, - u, - v; - - if (f == null) { - while (++i < n) { - b = array[i]; - - if (b != null && b >= b) { - a = c = b; - break; - } - } - - if (i === n) return [-1, -1]; - u = v = i; - - while (++i < n) { - b = array[i]; - - if (b != null) { - if (a > b) { - a = b; - u = i; - } - - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while (++i < n) { - b = f(array[i], i, array); - - if (b != null && b >= b) { - a = c = b; - break; - } - } - - if (i === n) return [-1, -1]; - u = v = i; - - while (++i < n) { - b = f(array[i], i, array); - - if (b != null) { - if (a > b) { - a = b; - u = i; - } - - if (c < b) { - c = b; - v = i; - } - } - } - } - - return [u, v]; -} - -var hop = Object.prototype.hasOwnProperty; - -function hasOwnProperty(object, property) { - return hop.call(object, property); -} - -var NULL = {}; - -function fastmap(input) { - var obj = {}, - map, - _test; - - function has(key) { - return hasOwnProperty(obj, key) && obj[key] !== NULL; - } - - map = { - size: 0, - empty: 0, - object: obj, - has: has, - get: function get(key) { - return has(key) ? obj[key] : undefined; - }, - set: function set(key, value) { - if (!has(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - - obj[key] = value; - return this; - }, - delete: function _delete(key) { - if (has(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - - return this; - }, - clear: function clear() { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test: function test(_) { - if (arguments.length) { - _test = _; - return map; - } else { - return _test; - } - }, - clean: function clean() { - var next = {}, - size = 0, - key, - value; - - for (key in obj) { - value = obj[key]; - - if (value !== NULL && (!_test || !_test(value))) { - next[key] = value; - ++size; - } - } - - map.size = size; - map.empty = 0; - map.object = obj = next; - } - }; - if (input) Object.keys(input).forEach(function (key) { - map.set(key, input[key]); - }); - return map; -} - -function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - var a = range[0], - b = peek(range), - t = +threshold, - l, - r; // swap endpoints if range is reversed - - if (b < a) { - l = a; - a = b; - b = l; - } // compare value to endpoints - - - l = Math.abs(value - a); - r = Math.abs(b - value); // adjust if value is within threshold distance of endpoint - - return l < r && l <= t ? left : r <= t ? right : center; -} - -function inherits(child, parent) { - var proto = child.prototype = Object.create(parent.prototype); - proto.constructor = child; - return proto; -} -/** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ - - -function inrange(value, range, left, right) { - var r0 = range[0], - r1 = range[range.length - 1], - t; - - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - - left = left === undefined || left; - right = right === undefined || right; - return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1); -} - -function isBoolean(_) { - return typeof _ === 'boolean'; -} - -function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; -} - -function isNumber(_) { - return typeof _ === 'number'; -} - -function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; -} - -function isString(_) { - return typeof _ === 'string'; -} - -function key(fields, flat, opt) { - if (fields) { - fields = flat ? array(fields).map(function (f) { - return f.replace(/\\(.)/g, '$1'); - }) : array(fields); - } - - var len = fields && fields.length, - gen = opt && opt.get || getter, - map = function map(f) { - return gen(flat ? [f] : splitAccessPath(f)); - }; - - var fn; - - if (!len) { - fn = function fn() { - return ''; - }; - } else if (len === 1) { - var _get = map(fields[0]); - - fn = function fn(_) { - return '' + _get(_); - }; - } else { - var _get2 = fields.map(map); - - fn = function fn(_) { - var s = '' + _get2[0](_), - i = 0; - - while (++i < len) { - s += '|' + _get2[i](_); - } - - return s; - }; - } - - return accessor(fn, fields, 'key'); -} - -function lerp(array, frac) { - var lo = array[0], - hi = peek(array), - f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); -} - -var DEFAULT_MAX_SIZE = 10000; // adapted from https://github.com/dominictarr/hashlru/ (MIT License) - -function lruCache(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - var curr, prev, size; - - var clear = function clear() { - curr = {}; - prev = {}; - size = 0; - }; - - var update = function update(key, value) { - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - - return curr[key] = value; - }; - - clear(); - return { - clear: clear, - has: function has(key) { - return hasOwnProperty(curr, key) || hasOwnProperty(prev, key); - }, - get: function get(key) { - return hasOwnProperty(curr, key) ? curr[key] : hasOwnProperty(prev, key) ? update(key, prev[key]) : undefined; - }, - set: function set(key, value) { - return hasOwnProperty(curr, key) ? curr[key] = value : update(key, value); - } - }; -} - -function merge(compare, array0, array1, output) { - var n0 = array0.length, - n1 = array1.length; - if (!n1) return array0; - if (!n0) return array1; - var merged = output || new array0.constructor(n0 + n1), - i0 = 0, - i1 = 0, - i = 0; - - for (; i0 < n0 && i1 < n1; ++i) { - merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; - } - - for (; i0 < n0; ++i0, ++i) { - merged[i] = array0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - merged[i] = array1[i1]; - } - - return merged; -} - -function repeat(str, reps) { - var s = ''; - - while (--reps >= 0) { - s += str; - } - - return s; -} - -function pad(str, length, padchar, align) { - var c = padchar || ' ', - s = str + '', - n = length - s.length; - return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n); -} -/** - * Return the numerical span of an array: the difference between - * the last and first values. - */ - - -function span(array) { - return array && peek(array) - array[0] || 0; -} - -function $(x) { - return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace("\u2028", "\\u2028").replace("\u2029", "\\u2029") : x; -} - -function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; -} - -function defaultParser(_) { - return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); -} - -function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); -} - -function toString(_) { - return _ == null || _ === '' ? null : _ + ''; -} - -function toSet(_) { - for (var s = {}, i = 0, n = _.length; i < n; ++i) { - s[_[i]] = true; - } - - return s; -} - -function truncate(str, length, align, ellipsis) { - var e = ellipsis != null ? ellipsis : "\u2026", - s = str + '', - n = s.length, - l = Math.max(0, length - e.length); - return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e; -} - -function visitArray(array, filter, visitor) { - if (array) { - if (filter) { - var i = 0, - n = array.length, - t; - - for (; i < n; ++i) { - if (t = filter(array[i])) visitor(t, i, array); - } - } else { - array.forEach(visitor); - } - } -} - -function UniqueList(idFunc) { - var $ = idFunc || identity, - list = [], - ids = {}; - - list.add = function (_) { - var id = $(_); - - if (!ids[id]) { - ids[id] = 1; - list.push(_); - } - - return list; - }; - - list.remove = function (_) { - var id = $(_), - idx; - - if (ids[id]) { - ids[id] = 0; - - if ((idx = list.indexOf(_)) >= 0) { - list.splice(idx, 1); - } - } - - return list; - }; - - return list; -} -/** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ - - -function asyncCallback(_x, _x2) { - return _asyncCallback.apply(this, arguments); -} - -function _asyncCallback() { - _asyncCallback = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(df, callback) { - return regeneratorRuntime.wrap(function _callee3$(_context10) { - while (1) { - switch (_context10.prev = _context10.next) { - case 0: - _context10.prev = 0; - _context10.next = 3; - return callback(df); - - case 3: - _context10.next = 8; - break; - - case 5: - _context10.prev = 5; - _context10.t0 = _context10["catch"](0); - df.error(_context10.t0); - - case 8: - case "end": - return _context10.stop(); - } - } - }, _callee3, null, [[0, 5]]); - })); - return _asyncCallback.apply(this, arguments); -} - -var TUPLE_ID_KEY = Symbol('vega_id'), - TUPLE_ID = 1; -/** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ - -function isTuple(t) { - return !!(t && tupleid(t)); -} -/** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ - - -function tupleid(t) { - return t[TUPLE_ID_KEY]; -} -/** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ - - -function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; -} -/** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ - - -function ingest(datum) { - var t = datum === Object(datum) ? datum : { - data: datum - }; - return tupleid(t) ? t : setid(t, TUPLE_ID++); -} -/** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ - - -function derive(t) { - return rederive(t, ingest({})); -} -/** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ - - -function rederive(t, d) { - for (var k in t) { - d[k] = t[k]; - } - - return d; -} -/** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ - - -function replace(t, d) { - return setid(d, tupleid(t)); -} -/** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ - - -function stableCompare(cmp, f) { - return !cmp ? null : f ? function (a, b) { - return cmp(a, b) || tupleid(f(a)) - tupleid(f(b)); - } : function (a, b) { - return cmp(a, b) || tupleid(a) - tupleid(b); - }; -} - -function isChangeSet(v) { - return v && v.constructor === changeset; -} - -function changeset() { - var add = [], - // insert tuples - rem = [], - // remove tuples - mod = [], - // modify tuples - remp = [], - // remove by predicate - modp = [], - // modify by predicate - _clean = null, - _reflow = false; - return { - constructor: changeset, - insert: function insert(t) { - var d = array(t), - i = 0, - n = d.length; - - for (; i < n; ++i) { - add.push(d[i]); - } - - return this; - }, - remove: function remove(t) { - var a = isFunction(t) ? remp : rem, - d = array(t), - i = 0, - n = d.length; - - for (; i < n; ++i) { - a.push(d[i]); - } - - return this; - }, - modify: function modify(t, field, value) { - var m = { - field: field, - value: constant(value) - }; - - if (isFunction(t)) { - m.filter = t; - modp.push(m); - } else { - m.tuple = t; - mod.push(m); - } - - return this; - }, - encode: function encode(t, set) { - if (isFunction(t)) modp.push({ - filter: t, - field: set - });else mod.push({ - tuple: t, - field: set - }); - return this; - }, - clean: function clean(value) { - _clean = value; - return this; - }, - reflow: function reflow() { - _reflow = true; - return this; - }, - pulse: function pulse(_pulse, tuples) { - var cur = {}, - out = {}, - i, - n, - m, - f, - t, - id; // build lookup table of current tuples - - for (i = 0, n = tuples.length; i < n; ++i) { - cur[tupleid(tuples[i])] = 1; - } // process individual tuples to remove - - - for (i = 0, n = rem.length; i < n; ++i) { - t = rem[i]; - cur[tupleid(t)] = -1; - } // process predicate-based removals - - - for (i = 0, n = remp.length; i < n; ++i) { - f = remp[i]; - tuples.forEach(function (t) { - if (f(t)) cur[tupleid(t)] = -1; - }); - } // process all add tuples - - - for (i = 0, n = add.length; i < n; ++i) { - t = add[i]; - id = tupleid(t); - - if (cur[id]) { - // tuple already resides in dataset - // if flagged for both add and remove, cancel - cur[id] = 1; - } else { - // tuple does not reside in dataset, add - _pulse.add.push(ingest(add[i])); - } - } // populate pulse rem list - - - for (i = 0, n = tuples.length; i < n; ++i) { - t = tuples[i]; - if (cur[tupleid(t)] < 0) _pulse.rem.push(t); - } // modify helper method - - - function modify(t, f, v) { - if (v) { - t[f] = v(t); - } else { - _pulse.encode = f; - } - - if (!_reflow) out[tupleid(t)] = t; - } // process individual tuples to modify - - - for (i = 0, n = mod.length; i < n; ++i) { - m = mod[i]; - t = m.tuple; - f = m.field; - id = cur[tupleid(t)]; - - if (id > 0) { - modify(t, f, m.value); - - _pulse.modifies(f); - } - } // process predicate-based modifications - - - for (i = 0, n = modp.length; i < n; ++i) { - m = modp[i]; - f = m.filter; - tuples.forEach(function (t) { - if (f(t) && cur[tupleid(t)] > 0) { - modify(t, m.field, m.value); - } - }); - - _pulse.modifies(m.field); - } // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - - - if (_reflow) { - _pulse.mod = rem.length || remp.length ? tuples.filter(function (t) { - return cur[tupleid(t)] > 0; - }) : tuples.slice(); - } else { - for (id in out) { - _pulse.mod.push(out[id]); - } - } // set pulse garbage collection request - - - if (_clean || _clean == null && (rem.length || remp.length)) { - _pulse.clean(true); - } - - return _pulse; - } - }; -} - -var CACHE = '_:mod:_'; -/** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ - -function Parameters() { - Object.defineProperty(this, CACHE, { - writable: true, - value: {} - }); -} - -var prototype = Parameters.prototype; -/** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ - -prototype.set = function (name, index, value, force) { - var o = this, - v = o[name], - mod = o[CACHE]; - - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = isArray(value) ? 1 + value.length : -1; - } - - return o; -}; -/** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ - - -prototype.modified = function (name, index) { - var mod = this[CACHE], - k; - - if (!arguments.length) { - for (k in mod) { - if (mod[k]) return true; - } - - return false; - } else if (isArray(name)) { - for (k = 0; k < name.length; ++k) { - if (mod[name[k]]) return true; - } - - return false; - } - - return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name]; -}; -/** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ - - -prototype.clear = function () { - this[CACHE] = {}; - return this; -}; - -var OP_ID = 0; -var PULSE = 'pulse'; -var NO_PARAMS = new Parameters(); // Boolean Flags - -var SKIP = 1, - MODIFIED = 2; -/** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ - -function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - - if (update) { - this._update = update; - } - - if (params) this.parameters(params, react); -} - -var prototype$1 = Operator.prototype; -/** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ - -prototype$1.targets = function () { - return this._targets || (this._targets = UniqueList(id)); -}; -/** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ - - -prototype$1.set = function (value) { - if (this.value !== value) { - this.value = value; - return 1; - } else { - return 0; - } -}; - -function flag(bit) { - return function (state) { - var f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? f | bit : f & ~bit; - return this; - }; -} -/** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ - - -prototype$1.skip = flag(SKIP); -/** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ - -prototype$1.modified = flag(MODIFIED); -/** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initiatal evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ - -prototype$1.parameters = function (params, react, initonly) { - react = react !== false; - var self = this, - argval = self._argval = self._argval || new Parameters(), - argops = self._argops = self._argops || [], - deps = [], - name, - value, - n, - i; - - function add(name, index, value) { - if (value instanceof Operator) { - if (value !== self) { - if (react) value.targets().add(self); - deps.push(value); - } - - argops.push({ - op: value, - name: name, - index: index - }); - } else { - argval.set(name, index, value); - } - } - - for (name in params) { - value = params[name]; - - if (name === PULSE) { - array(value).forEach(function (op) { - if (!(op instanceof Operator)) { - error('Pulse parameters must be operator instances.'); - } else if (op !== self) { - op.targets().add(self); - deps.push(op); - } - }); - self.source = value; - } else if (isArray(value)) { - argval.set(name, -1, Array(n = value.length)); - - for (i = 0; i < n; ++i) { - add(name, i, value[i]); - } - } else { - add(name, -1, value); - } - } - - this.marshall().clear(); // initialize values - - if (initonly) argops.initonly = true; - return deps; -}; -/** - * Internal method for marshalling parameter values. - * Visits each operator dependency to pull the latest value. - * @return {Parameters} A Parameters object to pass to the update function. - */ - - -prototype$1.marshall = function (stamp) { - var argval = this._argval || NO_PARAMS, - argops = this._argops, - item, - i, - n, - op, - mod; - - if (argops) { - for (i = 0, n = argops.length; i < n; ++i) { - item = argops[i]; - op = item.op; - mod = op.modified() && op.stamp === stamp; - argval.set(item.name, item.index, op.value, mod); - } - - if (argops.initonly) { - for (i = 0; i < n; ++i) { - item = argops[i]; - item.op.targets().remove(this); - } - - this._argops = null; - this._update = null; - } - } - - return argval; -}; -/** - * Detach this operator from the dataflow. - * Unregisters listeners on upstream dependencies. - */ - - -prototype$1.detach = function () { - var argops = this._argops, - i, - n, - item, - op; - - if (argops) { - for (i = 0, n = argops.length; i < n; ++i) { - item = argops[i]; - op = item.op; - - if (op._targets) { - op._targets.remove(this); - } - } - } -}; -/** - * Delegate method to perform operator processing. - * Subclasses can override this method to perform custom processing. - * By default, it marshalls parameters and calls the update function - * if that function is defined. If the update function does not - * change the operator value then StopPropagation is returned. - * If no update function is defined, this method does nothing. - * @param {Pulse} pulse - the current dataflow pulse. - * @return The output pulse or StopPropagation. A falsy return value - * (including undefined) will let the input pulse pass through. - */ - - -prototype$1.evaluate = function (pulse) { - var update = this._update; - - if (update) { - var params = this.marshall(pulse.stamp), - v = update.call(this, params, pulse); - params.clear(); - - if (v !== this.value) { - this.value = v; - } else if (!this.modified()) { - return pulse.StopPropagation; - } - } -}; -/** - * Run this operator for the current pulse. If this operator has already - * been run at (or after) the pulse timestamp, returns StopPropagation. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ - - -prototype$1.run = function (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - var rv; - - if (this.skip()) { - this.skip(false); - rv = 0; - } else { - rv = this.evaluate(pulse); - } - - return this.pulse = rv || pulse; -}; -/** - * Add an operator to the dataflow graph. This function accepts a - * variety of input argument types. The basic signature supports an - * initial value, update function and parameters. If the first parameter - * is an Operator instance, it will be added directly. If it is a - * constructor for an Operator subclass, a new instance will be instantiated. - * Otherwise, if the first parameter is a function instance, it will be used - * as the update function and a null initial value is assumed. - * @param {*} init - One of: the operator to add, the initial value of - * the operator, an operator class to instantiate, or an update function. - * @param {function} [update] - The operator update function. - * @param {object} [params] - The operator parameters. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @return {Operator} - The added operator. - */ - - -function add(init, update, params, react) { - var shift = 1, - op; - - if (init instanceof Operator) { - op = init; - } else if (init && init.prototype instanceof Operator) { - op = new init(); - } else if (isFunction(init)) { - op = new Operator(null, init); - } else { - shift = 0; - op = new Operator(init, update); - } - - this.rank(op); - - if (shift) { - react = params; - params = update; - } - - if (params) this.connect(op, op.parameters(params, react)); - this.touch(op); - return op; -} -/** - * Connect a target operator as a dependent of source operators. - * If necessary, this method will rerank the target operator and its - * dependents to ensure propagation proceeds in a topologically sorted order. - * @param {Operator} target - The target operator. - * @param {Array} - The source operators that should propagate - * to the target operator. - */ - - -function connect(target, sources) { - var targetRank = target.rank, - i, - n; - - for (i = 0, n = sources.length; i < n; ++i) { - if (targetRank < sources[i].rank) { - this.rerank(target); - return; - } - } -} - -var STREAM_ID = 0; -/** - * Models an event stream. - * @constructor - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @param {function(Object)} [receive] - Event callback function to invoke - * upon receipt of a new event. Use to override standard event processing. - */ - -function EventStream(filter, apply, receive) { - this.id = ++STREAM_ID; - this.value = null; - if (receive) this.receive = receive; - if (filter) this._filter = filter; - if (apply) this._apply = apply; -} -/** - * Creates a new event stream instance with the provided - * (optional) filter, apply and receive functions. - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @see EventStream - */ - - -function stream(filter, apply, receive) { - return new EventStream(filter, apply, receive); -} - -var prototype$2 = EventStream.prototype; -prototype$2._filter = truthy; -prototype$2._apply = identity; - -prototype$2.targets = function () { - return this._targets || (this._targets = UniqueList(id)); -}; - -prototype$2.consume = function (_) { - if (!arguments.length) return !!this._consume; - this._consume = !!_; - return this; -}; - -prototype$2.receive = function (evt) { - if (this._filter(evt)) { - var val = this.value = this._apply(evt), - trg = this._targets, - n = trg ? trg.length : 0, - i = 0; - - for (; i < n; ++i) { - trg[i].receive(val); - } - - if (this._consume) { - evt.preventDefault(); - evt.stopPropagation(); - } - } -}; - -prototype$2.filter = function (filter) { - var s = stream(filter); - this.targets().add(s); - return s; -}; - -prototype$2.apply = function (apply) { - var s = stream(null, apply); - this.targets().add(s); - return s; -}; - -prototype$2.merge = function () { - var s = stream(); - this.targets().add(s); - - for (var i = 0, n = arguments.length; i < n; ++i) { - arguments[i].targets().add(s); - } - - return s; -}; - -prototype$2.throttle = function (pause) { - var t = -1; - return this.filter(function () { - var now = Date.now(); - - if (now - t > pause) { - t = now; - return 1; - } else { - return 0; - } - }); -}; - -prototype$2.debounce = function (delay) { - var s = stream(); - this.targets().add(stream(null, null, debounce(delay, function (e) { - var df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }))); - return s; -}; - -prototype$2.between = function (a, b) { - var active = false; - a.targets().add(stream(null, null, function () { - active = true; - })); - b.targets().add(stream(null, null, function () { - active = false; - })); - return this.filter(function () { - return active; - }); -}; -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ - - -function events(source, type, filter, apply) { - var df = this, - s = stream(filter, apply), - send = function send(e) { - e.dataflow = df; - - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally { - df.run(); - } - }, - sources; - - if (typeof source === 'string' && typeof document !== 'undefined') { - sources = document.querySelectorAll(source); - } else { - sources = array(source); - } - - for (var i = 0, n = sources.length; i < n; ++i) { - sources[i].addEventListener(type, send); - } - - return s; -} // Matches absolute URLs with optional protocol -// https://... file://... //... - - -var protocol_re = /^([A-Za-z]+:)?\/\//; // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// - -var allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape - -var whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex -// Special treatment in node.js for the file: protocol - -var fileProtocol = 'file://'; -/** - * Factory for a loader constructor that provides methods for requesting - * files from either the network or disk, and for sanitizing request URIs. - * @param {function} fetch - The Fetch API for HTTP network requests. - * If null or undefined, HTTP loading will be disabled. - * @param {object} fs - The file system interface for file loading. - * If null or undefined, local file loading will be disabled. - * @return {function} A loader constructor with the following signature: - * param {object} [options] - Optional default loading options to use. - * return {object} - A new loader instance. - */ - -function loaderFactory(fetch, fs) { - return function (options) { - return { - options: options || {}, - sanitize: sanitize, - load: load, - fileAccess: !!fs, - file: fileLoader(fs), - http: httpLoader(fetch) - }; - }; -} -/** - * Load an external resource, typically either from the web or from the local - * filesystem. This function uses {@link sanitize} to first sanitize the uri, - * then calls either {@link http} (for web requests) or {@link file} (for - * filesystem loading). - * @param {string} uri - The resource indicator (e.g., URL or filename). - * @param {object} [options] - Optional loading options. These options will - * override any existing default options. - * @return {Promise} - A promise that resolves to the loaded content. - */ - - -function load(_x3, _x4) { - return _load.apply(this, arguments); -} -/** - * URI sanitizer function. - * @param {string} uri - The uri (url or filename) to sanity check. - * @param {object} options - An options hash. - * @return {Promise} - A promise that resolves to an object containing - * sanitized uri data, or rejects it the input uri is deemed invalid. - * The properties of the resolved object are assumed to be - * valid attributes for an HTML 'a' tag. The sanitized uri *must* be - * provided by the 'href' property of the returned object. - */ - - -function _load() { - _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(uri, options) { - var opt, url; - return regeneratorRuntime.wrap(function _callee4$(_context11) { - while (1) { - switch (_context11.prev = _context11.next) { - case 0: - _context11.next = 2; - return this.sanitize(uri, options); - - case 2: - opt = _context11.sent; - url = opt.href; - return _context11.abrupt("return", opt.localFile ? this.file(url) : this.http(url, options)); - - case 5: - case "end": - return _context11.stop(); - } - } - }, _callee4, this); - })); - return _load.apply(this, arguments); -} - -function sanitize(_x5, _x6) { - return _sanitize.apply(this, arguments); -} -/** - * File system loader factory. - * @param {object} fs - The file system interface. - * @return {function} - A file loader with the following signature: - * param {string} filename - The file system path to load. - * param {string} filename - The file system path to load. - * return {Promise} A promise that resolves to the file contents. - */ - - -function _sanitize() { - _sanitize = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(uri, options) { - var fileAccess, result, isFile, loadFile, base, isAllowed, hasProtocol; - return regeneratorRuntime.wrap(function _callee5$(_context12) { - while (1) { - switch (_context12.prev = _context12.next) { - case 0: - options = extend({}, this.options, options); - fileAccess = this.fileAccess, result = { - href: null - }; - isAllowed = allowed_re.test(uri.replace(whitespace_re, '')); - - if (uri == null || typeof uri !== 'string' || !isAllowed) { - error('Sanitize failure, invalid URI: ' + $(uri)); - } - - hasProtocol = protocol_re.test(uri); // if relative url (no protocol/host), prepend baseURL - - if ((base = options.baseURL) && !hasProtocol) { - // Ensure that there is a slash between the baseURL (e.g. hostname) and url - if (!uri.startsWith('/') && base[base.length - 1] !== '/') { - uri = '/' + uri; - } - - uri = base + uri; - } // should we load from file system? - - - loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess; - - if (isFile) { - // strip file protocol - uri = uri.slice(fileProtocol.length); - } else if (uri.startsWith('//')) { - if (options.defaultProtocol === 'file') { - // if is file, strip protocol and set loadFile flag - uri = uri.slice(2); - loadFile = true; - } else { - // if relative protocol (starts with '//'), prepend default protocol - uri = (options.defaultProtocol || 'http') + ':' + uri; - } - } // set non-enumerable mode flag to indicate local file load - - - Object.defineProperty(result, 'localFile', { - value: !!loadFile - }); // set uri - - result.href = uri; // set default result target, if specified - - if (options.target) { - result.target = options.target + ''; - } // set default result rel, if specified (#1542) - - - if (options.rel) { - result.rel = options.rel + ''; - } // provide control over cross-origin image handling (#2238) - // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image - - - if (options.context === 'image' && options.crossOrigin) { - result.crossOrigin = options.crossOrigin + ''; - } // return - - - return _context12.abrupt("return", result); - - case 14: - case "end": - return _context12.stop(); - } - } - }, _callee5, this); - })); - return _sanitize.apply(this, arguments); -} - -function fileLoader(fs) { - return fs ? function (filename) { - return new Promise(function (accept, reject) { - fs.readFile(filename, function (error, data) { - if (error) reject(error);else accept(data); - }); - }); - } : fileReject; -} -/** - * Default file system loader that simply rejects. - */ - - -function fileReject() { - return _fileReject.apply(this, arguments); -} -/** - * HTTP request handler factory. - * @param {function} fetch - The Fetch API method. - * @return {function} - An http loader with the following signature: - * param {string} url - The url to request. - * param {object} options - An options hash. - * return {Promise} - A promise that resolves to the file contents. - */ - - -function _fileReject() { - _fileReject = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { - return regeneratorRuntime.wrap(function _callee6$(_context13) { - while (1) { - switch (_context13.prev = _context13.next) { - case 0: - error('No file system access.'); - - case 1: - case "end": - return _context13.stop(); - } - } - }, _callee6); - })); - return _fileReject.apply(this, arguments); -} - -function httpLoader(fetch) { - return fetch ? /*#__PURE__*/function () { - var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, options) { - var opt, type, response; - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - opt = extend({}, this.options.http, options); - type = options && options.response; - _context.next = 4; - return fetch(url, opt); - - case 4: - response = _context.sent; - return _context.abrupt("return", !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text()); - - case 6: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - return function (_x7, _x8) { - return _ref.apply(this, arguments); - }; - }() : httpReject; -} -/** - * Default http request handler that simply rejects. - */ - - -function httpReject() { - return _httpReject.apply(this, arguments); -} - -function _httpReject() { - _httpReject = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { - return regeneratorRuntime.wrap(function _callee7$(_context14) { - while (1) { - switch (_context14.prev = _context14.next) { - case 0: - error('No HTTP fetch method available.'); - - case 1: - case "end": - return _context14.stop(); - } - } - }, _callee7); - })); - return _httpReject.apply(this, arguments); -} - -var typeParsers = { - boolean: toBoolean, - integer: toNumber, - number: toNumber, - date: toDate, - string: toString, - unknown: identity -}; -exports.typeParsers = typeParsers; -var typeTests = [isBoolean$1, isInteger, isNumber$1, isDate$1]; -var typeList = ['boolean', 'integer', 'number', 'date']; - -function inferType(values, field) { - if (!values || !values.length) return 'unknown'; - var n = values.length, - m = typeTests.length, - a = typeTests.map(function (_, i) { - return i + 1; - }); - - for (var i = 0, t = 0, j, _value; i < n; ++i) { - _value = field ? values[i][field] : values[i]; - - for (j = 0; j < m; ++j) { - if (a[j] && isValid(_value) && !typeTests[j](_value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - } - - return typeList[a.reduce(function (u, v) { - return u === 0 ? v : u; - }, 0) - 1]; -} - -function inferTypes(data, fields) { - return fields.reduce(function (types, field) { - types[field] = inferType(data, field); - return types; - }, {}); -} // -- Type Checks ---- - - -function isValid(_) { - return _ != null && _ === _; -} - -function isBoolean$1(_) { - return _ === 'true' || _ === 'false' || _ === true || _ === false; -} - -function isDate$1(_) { - return !Number.isNaN(Date.parse(_)); -} - -function isNumber$1(_) { - return !Number.isNaN(+_) && !(_ instanceof Date); -} - -function isInteger(_) { - return isNumber$1(_) && Number.isInteger(+_); -} - -function delimitedFormat(delimiter) { - var parse = function parse(data, format) { - var delim = { - delimiter: delimiter - }; - return dsv(data, format ? extend(format, delim) : delim); - }; - - parse.responseType = 'text'; - return parse; -} - -function dsv(data, format) { - if (format.header) { - data = format.header.map($).join(format.delimiter) + '\n' + data; - } - - return (0, _d3Dsv.dsvFormat)(format.delimiter).parse(data + ''); -} - -dsv.responseType = 'text'; - -function isBuffer(_) { - return typeof Buffer === 'function' && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; -} - -function json(data, format) { - var prop = format && format.property ? field(format.property) : identity; - return isObject(data) && !isBuffer(data) ? parseJSON(prop(data)) : prop(JSON.parse(data)); -} - -json.responseType = 'json'; - -function parseJSON(data, format) { - return format && format.copy ? JSON.parse(JSON.stringify(data)) : data; -} - -var filters = { - interior: function interior(a, b) { - return a !== b; - }, - exterior: function exterior(a, b) { - return a === b; - } -}; - -function topojson(data, format) { - var method, object, property, filter; - data = json(data, format); - - if (format && format.feature) { - method = _topojsonClient.feature; - property = format.feature; - } else if (format && format.mesh) { - method = _topojsonClient.mesh; - property = format.mesh; - filter = filters[format.filter]; - } else { - error('Missing TopoJSON feature or mesh parameter.'); - } - - object = (object = data.objects[property]) ? method(data, object, filter) : error('Invalid TopoJSON object: ' + property); - return object && object.features || [object]; -} - -topojson.responseType = 'json'; -var format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson -}; -exports.format = format; - -function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else { - return hasOwnProperty(format, name) ? format[name] : null; - } -} - -function responseType(type) { - var f = formats(type); - return f && f.responseType || 'text'; -} - -function memoize(method) { - var cache = {}; - return function (spec) { - return cache[spec] || (cache[spec] = method(spec)); - }; -} - -function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function left(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 right(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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; - } - }; -} - -function ascendingComparator(f) { - return function (d, x) { - return ascending(f(d), x); - }; -} - -var ascendingBisect = bisector(ascending); -var bisectRight = ascendingBisect.right; -var bisectLeft = ascendingBisect.left; - -function variance(values, valueof) { - var count = 0; - var delta; - var mean = 0; - var sum = 0; - - if (valueof === undefined) { - var _iterator = _createForOfIteratorHelper(values), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var _value2 = _step.value; - - if (_value2 != null && (_value2 = +_value2) >= _value2) { - delta = _value2 - mean; - mean += delta / ++count; - sum += delta * (_value2 - mean); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } else { - var _index = -1; - - var _iterator2 = _createForOfIteratorHelper(values), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var _value3 = _step2.value; - - if ((_value3 = valueof(_value3, ++_index, values)) != null && (_value3 = +_value3) >= _value3) { - delta = _value3 - mean; - mean += delta / ++count; - sum += delta * (_value3 - mean); - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - - if (count > 1) return sum / (count - 1); -} - -function deviation(values, valueof) { - var v = variance(values, valueof); - return v ? Math.sqrt(v) : v; -} - -function sequence(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} - -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - - while (++i < n) { - ticks[i] = (start + i) * step; - } - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - - while (++i < n) { - ticks[i] = (start - i) / step; - } - } - - if (reverse) ticks.reverse(); - return ticks; -} - -function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10;else if (error >= e5) step1 *= 5;else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} - -function max(values, valueof) { - var max; - - if (valueof === undefined) { - var _iterator3 = _createForOfIteratorHelper(values), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var _value4 = _step3.value; - - if (_value4 != null && (max < _value4 || max === undefined && _value4 >= _value4)) { - max = _value4; - } - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - } else { - var _index2 = -1; - - var _iterator4 = _createForOfIteratorHelper(values), - _step4; - - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { - var _value5 = _step4.value; - - if ((_value5 = valueof(_value5, ++_index2, values)) != null && (max < _value5 || max === undefined && _value5 >= _value5)) { - max = _value5; - } - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - } - - return max; -} - -function min(values, valueof) { - var min; - - if (valueof === undefined) { - var _iterator5 = _createForOfIteratorHelper(values), - _step5; - - try { - for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { - var _value6 = _step5.value; - - if (_value6 != null && (min > _value6 || min === undefined && _value6 >= _value6)) { - min = _value6; - } - } - } catch (err) { - _iterator5.e(err); - } finally { - _iterator5.f(); - } - } else { - var _index3 = -1; - - var _iterator6 = _createForOfIteratorHelper(values), - _step6; - - try { - for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { - var _value7 = _step6.value; - - if ((_value7 = valueof(_value7, ++_index3, values)) != null && (min > _value7 || min === undefined && _value7 >= _value7)) { - min = _value7; - } - } - } catch (err) { - _iterator6.e(err); - } finally { - _iterator6.f(); - } - } - - return min; -} // Based on https://github.com/mourner/quickselect -// ISC license, Copyright 2018 Vladimir Agafonkin. - - -function quickselect(array, k) { - var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : array.length - 1; - var compare = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ascending; - - while (right > left) { - if (right - left > 600) { - var n = right - left + 1; - var m = k - left + 1; - var z = Math.log(n); - var s = 0.5 * Math.exp(2 * z / 3); - var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - - var t = array[k]; - var i = left; - var j = right; - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - - while (i < j) { - swap(array, i, j), ++i, --j; - - while (compare(array[i], t) < 0) { - ++i; - } - - while (compare(array[j], t) > 0) { - --j; - } - } - - if (compare(array[left], t) === 0) swap(array, left, j);else ++j, swap(array, j, right); - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - - return array; -} - -function swap(array, i, j) { - var t = array[i]; - array[i] = array[j]; - array[j] = t; -} - -function number(x) { - return x === null ? NaN : +x; -} - -function numbers(values, valueof) { - var _iterator7, _step7, _value8, _index4, _iterator8, _step8, _value9; - - return regeneratorRuntime.wrap(function numbers$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (!(valueof === undefined)) { - _context2.next = 21; - break; - } - - _iterator7 = _createForOfIteratorHelper(values); - _context2.prev = 2; - - _iterator7.s(); - - case 4: - if ((_step7 = _iterator7.n()).done) { - _context2.next = 11; - break; - } - - _value8 = _step7.value; - - if (!(_value8 != null && (_value8 = +_value8) >= _value8)) { - _context2.next = 9; - break; - } - - _context2.next = 9; - return _value8; - - case 9: - _context2.next = 4; - break; - - case 11: - _context2.next = 16; - break; - - case 13: - _context2.prev = 13; - _context2.t0 = _context2["catch"](2); - - _iterator7.e(_context2.t0); - - case 16: - _context2.prev = 16; - - _iterator7.f(); - - return _context2.finish(16); - - case 19: - _context2.next = 40; - break; - - case 21: - _index4 = -1; - _iterator8 = _createForOfIteratorHelper(values); - _context2.prev = 23; - - _iterator8.s(); - - case 25: - if ((_step8 = _iterator8.n()).done) { - _context2.next = 32; - break; - } - - _value9 = _step8.value; - - if (!((_value9 = valueof(_value9, ++_index4, values)) != null && (_value9 = +_value9) >= _value9)) { - _context2.next = 30; - break; - } - - _context2.next = 30; - return _value9; - - case 30: - _context2.next = 25; - break; - - case 32: - _context2.next = 37; - break; - - case 34: - _context2.prev = 34; - _context2.t1 = _context2["catch"](23); - - _iterator8.e(_context2.t1); - - case 37: - _context2.prev = 37; - - _iterator8.f(); - - return _context2.finish(37); - - case 40: - case "end": - return _context2.stop(); - } - } - }, _marked, null, [[2, 13, 16, 19], [23, 34, 37, 40]]); -} - -function quantile(values, p, valueof) { - values = Float64Array.from(numbers(values, valueof)); - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return min(values); - if (p >= 1) return max(values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), - value1 = min(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); -} - -function quantileSorted(values, p) { - var valueof = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : number; - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} - -function mean(values, valueof) { - var count = 0; - var sum = 0; - - if (valueof === undefined) { - var _iterator9 = _createForOfIteratorHelper(values), - _step9; - - try { - for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { - var _value10 = _step9.value; - - if (_value10 != null && (_value10 = +_value10) >= _value10) { - ++count, sum += _value10; - } - } - } catch (err) { - _iterator9.e(err); - } finally { - _iterator9.f(); - } - } else { - var _index5 = -1; - - var _iterator10 = _createForOfIteratorHelper(values), - _step10; - - try { - for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { - var _value11 = _step10.value; - - if ((_value11 = valueof(_value11, ++_index5, values)) != null && (_value11 = +_value11) >= _value11) { - ++count, sum += _value11; - } - } - } catch (err) { - _iterator10.e(err); - } finally { - _iterator10.f(); - } - } - - if (count) return sum / count; -} - -function median(values, valueof) { - return quantile(values, 0.5, valueof); -} - -function permute(source, keys) { - return Array.from(keys, function (key) { - return source[key]; - }); -} - -function sum(values, valueof) { - var sum = 0; - - if (valueof === undefined) { - var _iterator11 = _createForOfIteratorHelper(values), - _step11; - - try { - for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { - var _value12 = _step11.value; - - if (_value12 = +_value12) { - sum += _value12; - } - } - } catch (err) { - _iterator11.e(err); - } finally { - _iterator11.f(); - } - } else { - var _index6 = -1; - - var _iterator12 = _createForOfIteratorHelper(values), - _step12; - - try { - for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) { - var _value13 = _step12.value; - - if (_value13 = +valueof(_value13, ++_index6, values)) { - sum += _value13; - } - } - } catch (err) { - _iterator12.e(err); - } finally { - _iterator12.f(); - } - } - - return sum; -} - -function trimZeroes(numberFormat, decimalChar) { - return function (x) { - var str = numberFormat(x), - dec = str.indexOf(decimalChar), - idx, - end; - if (dec < 0) return str; - idx = rightmostDigit(str, dec); - end = idx < str.length ? str.slice(idx) : ''; - - while (--idx > dec) { - if (str[idx] !== '0') { - ++idx; - break; - } - } - - return str.slice(0, idx) + end; - }; -} - -function rightmostDigit(str, dec) { - var i = str.lastIndexOf('e'), - c; - if (i > 0) return i; - - for (i = str.length; --i > dec;) { - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit - } -} - -function numberLocale(locale) { - var format = memoize(locale.format), - formatPrefix = locale.formatPrefix; - return { - format: format, - formatPrefix: formatPrefix, - formatFloat: function formatFloat(spec) { - var s = (0, _d3Format.formatSpecifier)(spec || ','); - - if (s.precision == null) { - s.precision = 12; - - switch (s.type) { - case '%': - s.precision -= 2; - break; - - case 'e': - s.precision -= 1; - break; - } - - return trimZeroes(format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else { - return format(s); - } - }, - formatSpan: function formatSpan(start, stop, count, specifier) { - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ',f' : specifier); - var step = tickStep(start, stop, count), - value = Math.max(Math.abs(start), Math.abs(stop)); - var precision; - - if (specifier.precision == null) { - switch (specifier.type) { - case 's': - { - if (!isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) { - specifier.precision = precision; - } - - return formatPrefix(specifier, value); - } - - case '': - case 'e': - case 'g': - case 'p': - case 'r': - { - if (!isNaN(precision = (0, _d3Format.precisionRound)(step, value))) { - specifier.precision = precision - (specifier.type === 'e'); - } - - break; - } - - case 'f': - case '%': - { - if (!isNaN(precision = (0, _d3Format.precisionFixed)(step))) { - specifier.precision = precision - (specifier.type === '%') * 2; - } - - break; - } - } - } - - return format(specifier); - } - }; -} - -var defaultNumberLocale; -resetNumberFormatDefaultLocale(); - -function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: _d3Format.format, - formatPrefix: _d3Format.formatPrefix - }); -} - -function numberFormatLocale(definition) { - return numberLocale((0, _d3Format.formatLocale)(definition)); -} - -function numberFormatDefaultLocale(definition) { - return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale; -} - -var YEAR = 'year'; -exports.YEAR = YEAR; -var QUARTER = 'quarter'; -exports.QUARTER = QUARTER; -var MONTH = 'month'; -exports.MONTH = MONTH; -var WEEK = 'week'; -exports.WEEK = WEEK; -var DATE = 'date'; -exports.DATE = DATE; -var DAY = 'day'; -exports.DAY = DAY; -var DAYOFYEAR = 'dayofyear'; -exports.DAYOFYEAR = DAYOFYEAR; -var HOURS = 'hours'; -exports.HOURS = HOURS; -var MINUTES = 'minutes'; -exports.MINUTES = MINUTES; -var SECONDS = 'seconds'; -exports.SECONDS = SECONDS; -var MILLISECONDS = 'milliseconds'; -exports.MILLISECONDS = MILLISECONDS; -var TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS]; -exports.TIME_UNITS = TIME_UNITS; -var UNITS = TIME_UNITS.reduce(function (o, u, i) { - return o[u] = 1 + i, o; -}, {}); - -function timeUnits(units) { - var u = array(units).slice(), - m = {}; // check validity - - if (!u.length) error('Missing time unit.'); - u.forEach(function (unit) { - if (hasOwnProperty(UNITS, unit)) { - m[unit] = 1; - } else { - error("Invalid time unit: ".concat(unit, ".")); - } - }); - var numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0); - - if (numTypes > 1) { - error("Incompatible time units: ".concat(units)); - } // ensure proper sort order - - - u.sort(function (a, b) { - return UNITS[a] - UNITS[b]; - }); - return u; -} - -var defaultSpecifiers = (_defaultSpecifiers = {}, _defineProperty(_defaultSpecifiers, YEAR, '%Y '), _defineProperty(_defaultSpecifiers, QUARTER, 'Q%q '), _defineProperty(_defaultSpecifiers, MONTH, '%b '), _defineProperty(_defaultSpecifiers, DATE, '%d '), _defineProperty(_defaultSpecifiers, WEEK, 'W%U '), _defineProperty(_defaultSpecifiers, DAY, '%a '), _defineProperty(_defaultSpecifiers, DAYOFYEAR, '%j '), _defineProperty(_defaultSpecifiers, HOURS, '%H:00'), _defineProperty(_defaultSpecifiers, MINUTES, '00:%M'), _defineProperty(_defaultSpecifiers, SECONDS, ':%S'), _defineProperty(_defaultSpecifiers, MILLISECONDS, '.%L'), _defineProperty(_defaultSpecifiers, "".concat(YEAR, "-").concat(MONTH), '%Y-%m '), _defineProperty(_defaultSpecifiers, "".concat(YEAR, "-").concat(MONTH, "-").concat(DATE), '%Y-%m-%d '), _defineProperty(_defaultSpecifiers, "".concat(HOURS, "-").concat(MINUTES), '%H:%M'), _defaultSpecifiers); - -function timeUnitSpecifier(units, specifiers) { - var s = extend({}, defaultSpecifiers, specifiers), - u = timeUnits(units), - n = u.length; - var fmt = '', - start = 0, - end, - key; - - for (start = 0; start < n;) { - for (end = u.length; end > start; --end) { - key = u.slice(start, end).join('-'); - - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - } - - return fmt.trim(); -} - -var t0 = new Date(); - -function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; -} - -function dayofyear(d) { - return localDayOfYear(new Date(d)); -} - -function week(d) { - return localWeekNum(new Date(d)); -} - -function localDayOfYear(d) { - return _d3Time.timeDay.count(localYear(d.getFullYear()) - 1, d); -} - -function localWeekNum(d) { - return _d3Time.timeWeek.count(localYear(d.getFullYear()) - 1, d); -} - -function localFirst(y) { - return localYear(y).getDay(); -} - -function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - - return new Date(y, m, d, H, M, S, L); -} - -function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); -} - -function utcweek(d) { - return utcWeekNum(new Date(d)); -} - -function utcDayOfYear(d) { - var y = Date.UTC(d.getUTCFullYear(), 0, 1); - return _d3Time.utcDay.count(y - 1, d); -} - -function utcWeekNum(d) { - var y = Date.UTC(d.getUTCFullYear(), 0, 1); - return _d3Time.utcWeek.count(y - 1, d); -} - -function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); -} - -function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - - return new Date(Date.UTC(y, m, d, H, M, S, L)); -} - -function floor(units, step, get, inv, newDate) { - var s = step || 1, - b = peek(units), - _ = function _(unit, p, key) { - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - - var t = new Date(), - u = toSet(units), - y = u[YEAR] ? _(YEAR) : constant(2012), - m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : zero, - d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one, - H = u[HOURS] ? _(HOURS) : zero, - M = u[MINUTES] ? _(MINUTES) : zero, - S = u[SECONDS] ? _(SECONDS) : zero, - L = u[MILLISECONDS] ? _(MILLISECONDS) : zero; - return function (v) { - t.setTime(+v); - var year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; -} - -function getUnit(f, inv, step, phase) { - var u = step <= 1 ? f : phase ? function (d, y) { - return phase + step * Math.floor((f(d, y) - phase) / step); - } : function (d, y) { - return step * Math.floor(f(d, y) / step); - }; - return inv ? function (d, y) { - return inv(u(d, y), y); - } : u; -} // returns the day of the year based on week number, day of week, -// and the day of the week for the first day of the year - - -function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; -} // -- LOCAL TIME -- - - -var localGet = (_localGet = {}, _defineProperty(_localGet, YEAR, function (d) { - return d.getFullYear(); -}), _defineProperty(_localGet, QUARTER, function (d) { - return Math.floor(d.getMonth() / 3); -}), _defineProperty(_localGet, MONTH, function (d) { - return d.getMonth(); -}), _defineProperty(_localGet, DATE, function (d) { - return d.getDate(); -}), _defineProperty(_localGet, HOURS, function (d) { - return d.getHours(); -}), _defineProperty(_localGet, MINUTES, function (d) { - return d.getMinutes(); -}), _defineProperty(_localGet, SECONDS, function (d) { - return d.getSeconds(); -}), _defineProperty(_localGet, MILLISECONDS, function (d) { - return d.getMilliseconds(); -}), _defineProperty(_localGet, DAYOFYEAR, function (d) { - return localDayOfYear(d); -}), _defineProperty(_localGet, WEEK, function (d) { - return localWeekNum(d); -}), _defineProperty(_localGet, WEEK + DAY, function (d, y) { - return weekday(localWeekNum(d), d.getDay(), localFirst(y)); -}), _defineProperty(_localGet, DAY, function (d, y) { - return weekday(1, d.getDay(), localFirst(y)); -}), _localGet); -var localInv = (_localInv = {}, _defineProperty(_localInv, QUARTER, function (q) { - return 3 * q; -}), _defineProperty(_localInv, WEEK, function (w, y) { - return weekday(w, 0, localFirst(y)); -}), _localInv); - -function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); -} // -- UTC TIME -- - - -var utcGet = (_utcGet = {}, _defineProperty(_utcGet, YEAR, function (d) { - return d.getUTCFullYear(); -}), _defineProperty(_utcGet, QUARTER, function (d) { - return Math.floor(d.getUTCMonth() / 3); -}), _defineProperty(_utcGet, MONTH, function (d) { - return d.getUTCMonth(); -}), _defineProperty(_utcGet, DATE, function (d) { - return d.getUTCDate(); -}), _defineProperty(_utcGet, HOURS, function (d) { - return d.getUTCHours(); -}), _defineProperty(_utcGet, MINUTES, function (d) { - return d.getUTCMinutes(); -}), _defineProperty(_utcGet, SECONDS, function (d) { - return d.getUTCSeconds(); -}), _defineProperty(_utcGet, MILLISECONDS, function (d) { - return d.getUTCMilliseconds(); -}), _defineProperty(_utcGet, DAYOFYEAR, function (d) { - return utcDayOfYear(d); -}), _defineProperty(_utcGet, WEEK, function (d) { - return utcWeekNum(d); -}), _defineProperty(_utcGet, DAY, function (d, y) { - return weekday(1, d.getUTCDay(), utcFirst(y)); -}), _defineProperty(_utcGet, WEEK + DAY, function (d, y) { - return weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)); -}), _utcGet); -var utcInv = (_utcInv = {}, _defineProperty(_utcInv, QUARTER, function (q) { - return 3 * q; -}), _defineProperty(_utcInv, WEEK, function (w, y) { - return weekday(w, 0, utcFirst(y)); -}), _utcInv); - -function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); -} - -var timeIntervals = (_timeIntervals = {}, _defineProperty(_timeIntervals, YEAR, _d3Time.timeYear), _defineProperty(_timeIntervals, QUARTER, _d3Time.timeMonth.every(3)), _defineProperty(_timeIntervals, MONTH, _d3Time.timeMonth), _defineProperty(_timeIntervals, WEEK, _d3Time.timeWeek), _defineProperty(_timeIntervals, DATE, _d3Time.timeDay), _defineProperty(_timeIntervals, DAY, _d3Time.timeDay), _defineProperty(_timeIntervals, DAYOFYEAR, _d3Time.timeDay), _defineProperty(_timeIntervals, HOURS, _d3Time.timeHour), _defineProperty(_timeIntervals, MINUTES, _d3Time.timeMinute), _defineProperty(_timeIntervals, SECONDS, _d3Time.timeSecond), _defineProperty(_timeIntervals, MILLISECONDS, _d3Time.timeMillisecond), _timeIntervals); -var utcIntervals = (_utcIntervals = {}, _defineProperty(_utcIntervals, YEAR, _d3Time.utcYear), _defineProperty(_utcIntervals, QUARTER, _d3Time.utcMonth.every(3)), _defineProperty(_utcIntervals, MONTH, _d3Time.utcMonth), _defineProperty(_utcIntervals, WEEK, _d3Time.utcWeek), _defineProperty(_utcIntervals, DATE, _d3Time.utcDay), _defineProperty(_utcIntervals, DAY, _d3Time.utcDay), _defineProperty(_utcIntervals, DAYOFYEAR, _d3Time.utcDay), _defineProperty(_utcIntervals, HOURS, _d3Time.utcHour), _defineProperty(_utcIntervals, MINUTES, _d3Time.utcMinute), _defineProperty(_utcIntervals, SECONDS, _d3Time.utcSecond), _defineProperty(_utcIntervals, MILLISECONDS, _d3Time.utcMillisecond), _utcIntervals); - -function timeInterval(unit) { - return timeIntervals[unit]; -} - -function utcInterval(unit) { - return utcIntervals[unit]; -} - -function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; -} - -function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); -} - -function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); -} - -function sequence$1(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; -} - -function timeSequence(unit, start, stop, step) { - return sequence$1(timeInterval(unit), start, stop, step); -} - -function utcSequence(unit, start, stop, step) { - return sequence$1(utcInterval(unit), start, stop, step); -} - -var durationSecond = 1000, - durationMinute = durationSecond * 60, - durationHour = durationMinute * 60, - durationDay = durationHour * 24, - durationWeek = durationDay * 7, - durationMonth = durationDay * 30, - durationYear = durationDay * 365; -var Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], - Seconds = Milli.slice(0, -1), - Minutes = Seconds.slice(0, -1), - Hours = Minutes.slice(0, -1), - Day = Hours.slice(0, -1), - Week = [YEAR, WEEK], - Month = [YEAR, MONTH], - Year = [YEAR]; -var intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]]; - -function timeBin(opt) { - var ext = opt.extent, - max = opt.maxbins || 40, - target = Math.abs(span(ext)) / max; - var i = bisector(function (i) { - return i[2]; - }).right(intervals, target), - units, - step; - - if (i === intervals.length) { - units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max); - } else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max(tickStep(ext[0], ext[1], max), 1); - } - - return { - units: units, - step: step - }; -} - -function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - - if (!isObject(spec)) { - error("Invalid time multi-format specifier: ".concat(spec)); - } - - var second = interval(SECONDS), - minute = interval(MINUTES), - hour = interval(HOURS), - day = interval(DATE), - week = interval(WEEK), - month = interval(MONTH), - quarter = interval(QUARTER), - year = interval(YEAR), - L = format(spec[MILLISECONDS] || '.%L'), - S = format(spec[SECONDS] || ':%S'), - M = format(spec[MINUTES] || '%I:%M'), - H = format(spec[HOURS] || '%I %p'), - d = format(spec[DATE] || spec[DAY] || '%a %d'), - w = format(spec[WEEK] || '%b %d'), - m = format(spec[MONTH] || '%B'), - q = format(spec[QUARTER] || '%B'), - y = format(spec[YEAR] || '%Y'); - return function (date) { - return (second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date); - }; -} - -function timeLocale(locale) { - var _timeFormat = memoize(locale.format), - _utcFormat = memoize(locale.utcFormat); - - return { - timeFormat: function timeFormat(spec) { - return isString(spec) ? _timeFormat(spec) : timeMultiFormat(_timeFormat, timeInterval, spec); - }, - utcFormat: function utcFormat(spec) { - return isString(spec) ? _utcFormat(spec) : timeMultiFormat(_utcFormat, utcInterval, spec); - }, - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; -} - -var defaultTimeLocale; -resetTimeFormatDefaultLocale(); - -function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: _d3TimeFormat.timeFormat, - parse: _d3TimeFormat.timeParse, - utcFormat: _d3TimeFormat.utcFormat, - utcParse: _d3TimeFormat.utcParse - }); -} - -function timeFormatLocale(definition) { - return timeLocale((0, _d3TimeFormat.timeFormatLocale)(definition)); -} - -function timeFormatDefaultLocale(definition) { - return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale; -} - -var createLocale = function createLocale(number, time) { - return extend({}, number, time); -}; - -function locale(numberSpec, timeSpec) { - var number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); - var time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); - return createLocale(number, time); -} - -function defaultLocale(numberSpec, timeSpec) { - var args = arguments.length; - - if (args && args !== 2) { - error('defaultLocale expects either zero or two arguments.'); - } - - return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); -} - -function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); -} - -function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - var reader = formats(schema.type || 'json'); - if (!reader) error('Unknown data format type: ' + schema.type); - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - if (hasOwnProperty(data, 'columns')) delete data.columns; - return data; -} - -function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - - var locale = timeFormatDefaultLocale(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - var fields = data.columns || Object.keys(data[0]), - parsers, - datum, - field, - i, - j, - n, - m; - if (types === 'auto') types = inferTypes(data, fields); - fields = Object.keys(types); - parsers = fields.map(function (field) { - var type = types[field], - parts, - pattern; - - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - - pattern = parts[1]; - - if (pattern[0] === '\'' && pattern[pattern.length - 1] === '\'' || pattern[0] === '"' && pattern[pattern.length - 1] === '"') { - pattern = pattern.slice(1, -1); - } - - var _parse = parts[0] === 'utc' ? utcParser : timeParser; - - return _parse(pattern); - } - - if (!typeParsers[type]) { - throw Error('Illegal format pattern: ' + field + ':' + type); - } - - return typeParsers[type]; - }); - - for (i = 0, n = data.length, m = fields.length; i < n; ++i) { - datum = data[i]; - - for (j = 0; j < m; ++j) { - field = fields[j]; - datum[field] = parsers[j](datum[field]); - } - } -} - -var loader = loaderFactory(typeof fetch !== 'undefined' && fetch, // use built-in fetch API -null // no file system access -); -exports.loader = loader; - -function parse$1(data, format) { - var locale = this.locale(); - return read(data, format, locale.timeParse, locale.utcParse); -} -/** - * Ingests new data into the dataflow. First parses the data using the - * vega-loader read method, then pulses a changeset to the target operator. - * @param {Operator} target - The Operator to target with ingested data, - * typically a Collect transform instance. - * @param {*} data - The input data, prior to parsing. For JSON this may - * be a string or an object. For CSV, TSV, etc should be a string. - * @param {object} format - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @returns {Dataflow} - */ - - -function ingest$1(target, data, format) { - data = this.parse(data, format); - return this.pulse(target, this.changeset().insert(data)); -} -/** - * Request data from an external source, parse it, and return a Promise. - * @param {string} url - The URL from which to load the data. This string - * is passed to the vega-loader load method. - * @param {object} [format] - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @return {Promise} A Promise that resolves upon completion of the request. - * The resolved object contains the following properties: - * - data: an array of parsed data (or null upon error) - * - status: a code for success (0), load fail (-1), or parse fail (-2) - */ - - -function request(_x9, _x10) { - return _request.apply(this, arguments); -} - -function _request() { - _request = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(url, format) { - var df, status, data; - return regeneratorRuntime.wrap(function _callee8$(_context15) { - while (1) { - switch (_context15.prev = _context15.next) { - case 0: - df = this; - status = 0; - _context15.prev = 2; - _context15.next = 5; - return df.loader().load(url, { - context: 'dataflow', - response: responseType(format && format.type) - }); - - case 5: - data = _context15.sent; - - try { - data = df.parse(data, format); - } catch (err) { - status = -2; - df.warn('Data ingestion failed', url, err); - } - - _context15.next = 13; - break; - - case 9: - _context15.prev = 9; - _context15.t0 = _context15["catch"](2); - status = -1; - df.warn('Loading failed', url, _context15.t0); - - case 13: - return _context15.abrupt("return", { - data: data, - status: status - }); - - case 14: - case "end": - return _context15.stop(); - } - } - }, _callee8, this, [[2, 9]]); - })); - return _request.apply(this, arguments); -} - -function preload(_x11, _x12, _x13) { - return _preload.apply(this, arguments); -} - -function _preload() { - _preload = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(target, url, format) { - var df, pending, res; - return regeneratorRuntime.wrap(function _callee9$(_context16) { - while (1) { - switch (_context16.prev = _context16.next) { - case 0: - df = this, pending = df._pending || loadPending(df); - pending.requests += 1; - _context16.next = 4; - return df.request(url, format); - - case 4: - res = _context16.sent; - df.pulse(target, df.changeset().remove(truthy).insert(res.data || [])); - pending.done(); - return _context16.abrupt("return", res); - - case 8: - case "end": - return _context16.stop(); - } - } - }, _callee9, this); - })); - return _preload.apply(this, arguments); -} - -function loadPending(df) { - var pending = new Promise(function (a) { - accept = a; - }), - accept; - pending.requests = 0; - - pending.done = function () { - if (--pending.requests === 0) { - df._pending = null; - accept(df); - } - }; - - return df._pending = pending; -} - -var SKIP$1 = { - skip: true -}; -/** - * Perform operator updates in response to events. Applies an - * update function to compute a new operator value. If the update function - * returns a {@link ChangeSet}, the operator will be pulsed with those tuple - * changes. Otherwise, the operator value will be updated to the return value. - * @param {EventStream|Operator} source - The event source to react to. - * This argument can be either an EventStream or an Operator. - * @param {Operator|function(object):Operator} target - The operator to update. - * This argument can either be an Operator instance or (if the source - * argument is an EventStream), a function that accepts an event object as - * input and returns an Operator to target. - * @param {function(Parameters,Event): *} [update] - Optional update function - * to compute the new operator value, or a literal value to set. Update - * functions expect to receive a parameter object and event as arguments. - * This function can either return a new operator value or (if the source - * argument is an EventStream) a {@link ChangeSet} instance to pulse - * the target operator with tuple changes. - * @param {object} [params] - The update function parameters. - * @param {object} [options] - Additional options hash. If not overridden, - * updated operators will be skipped by default. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @return {Dataflow} - */ - -function on(source, target, update, params, options) { - var fn = source instanceof Operator ? onOperator : onStream; - fn(this, source, target, update, params, options); - return this; -} - -function onStream(df, stream, target, update, params, options) { - var opt = extend({}, options, SKIP$1), - func, - op; - if (!isFunction(target)) target = constant(target); - - if (update === undefined) { - func = function func(e) { - return df.touch(target(e)); - }; - } else if (isFunction(update)) { - op = new Operator(null, update, params, false); - - func = function func(e) { - op.evaluate(e); - var t = target(e), - v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else { - func = function func(e) { - return df.update(target(e), update, opt); - }; - } - - stream.apply(func); -} - -function onOperator(df, source, target, update, params, options) { - if (update === undefined) { - source.targets().add(target); - } else { - var opt = options || {}, - op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - - source.targets().add(op); // add dependency - - if (target) { - op.skip(true); // skip first invocation - - op.value = target.value; // initialize value - - op.targets().add(target); // chain dependencies - - df.connect(target, [op]); // rerank as needed, #1672 - } - } -} - -function updater(target, update) { - update = isFunction(update) ? update : constant(update); - return target ? function (_, pulse) { - var value = update(_, pulse); - - if (!target.skip()) { - target.skip(value !== this.value).value = value; - } - - return value; - } : update; -} -/** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ - - -function rank(op) { - op.rank = ++this._rank; -} -/** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ - - -function rerank(op) { - var queue = [op], - cur, - list, - i; - - while (queue.length) { - this.rank(cur = queue.pop()); - - if (list = cur._targets) { - for (i = list.length; --i >= 0;) { - queue.push(cur = list[i]); - if (cur === op) error('Cycle detected in dataflow graph.'); - } - } - } -} -/** - * Sentinel value indicating pulse propagation should stop. - */ - - -var StopPropagation = {}; // Pulse visit type flags - -var ADD = 1 << 0, - REM = 1 << 1, - MOD = 1 << 2, - ADD_REM = ADD | REM, - ADD_MOD = ADD | MOD, - ALL = ADD | REM | MOD, - REFLOW = 1 << 3, - SOURCE = 1 << 4, - NO_SOURCE = 1 << 5, - NO_FIELDS = 1 << 6; -/** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ - -function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; -} - -var prototype$3 = Pulse.prototype; -/** - * Sentinel value indicating pulse propagation should stop. - */ - -prototype$3.StopPropagation = StopPropagation; -/** - * Boolean flag indicating ADD (added) tuples. - */ - -prototype$3.ADD = ADD; -/** - * Boolean flag indicating REM (removed) tuples. - */ - -prototype$3.REM = REM; -/** - * Boolean flag indicating MOD (modified) tuples. - */ - -prototype$3.MOD = MOD; -/** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ - -prototype$3.ADD_REM = ADD_REM; -/** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ - -prototype$3.ADD_MOD = ADD_MOD; -/** - * Boolean flag indicating ADD, REM and MOD tuples. - */ - -prototype$3.ALL = ALL; -/** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ - -prototype$3.REFLOW = REFLOW; -/** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ - -prototype$3.SOURCE = SOURCE; -/** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ - -prototype$3.NO_SOURCE = NO_SOURCE; -/** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ - -prototype$3.NO_FIELDS = NO_FIELDS; -/** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ - -prototype$3.fork = function (flags) { - return new Pulse(this.dataflow).init(this, flags); -}; -/** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ - - -prototype$3.clone = function () { - var p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); -}; -/** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ - - -prototype$3.addAll = function () { - var p = this; - - if (!p.source || p.source.length === p.add.length) { - return p; - } else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - return p; - } -}; -/** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ - - -prototype$3.init = function (src, flags) { - var p = this; - p.stamp = src.stamp; - p.encode = src.encode; - - if (src.fields && !(flags & NO_FIELDS)) { - p.fields = src.fields; - } - - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - - return p; -}; -/** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ - - -prototype$3.runAfter = function (func) { - this.dataflow.runAfter(func); -}; -/** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ - - -prototype$3.changed = function (flags) { - var f = flags || ALL; - return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length; -}; -/** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ - - -prototype$3.reflow = function (fork) { - if (fork) return this.fork(ALL).reflow(); - var len = this.add.length, - src = this.source && this.source.length; - - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); - } - - return this; -}; -/** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ - - -prototype$3.clean = function (value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else { - return this.cleans; - } -}; -/** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ - - -prototype$3.modifies = function (_) { - var hash = this.fields || (this.fields = {}); - - if (isArray(_)) { - _.forEach(function (f) { - return hash[f] = true; - }); - } else { - hash[_] = true; - } - - return this; -}; -/** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ - - -prototype$3.modified = function (_, nomod) { - var fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : isArray(_) ? _.some(function (f) { - return fields[f]; - }) : fields[_]; -}; -/** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ - - -prototype$3.filter = function (flags, filter) { - var p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; -}; - -function addFilter(a, b) { - return a ? function (t, i) { - return a(t, i) && b(t, i); - } : b; -} -/** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ - - -prototype$3.materialize = function (flags) { - flags = flags || ALL; - var p = this; - - if (flags & ADD && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - - if (flags & REM && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - - if (flags & MOD && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - - if (flags & SOURCE && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - - return p; -}; - -function materialize(data, filter) { - var out = []; - visitArray(data, filter, function (_) { - return out.push(_); - }); - return out; -} - -function filter(pulse, flags) { - var map = {}; - pulse.visit(flags, function (t) { - map[tupleid(t)] = 1; - }); - return function (t) { - return map[tupleid(t)] ? null : t; - }; -} -/** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ - - -prototype$3.visit = function (flags, visitor) { - var p = this, - v = visitor, - src, - sum; - - if (flags & SOURCE) { - visitArray(p.source, p.srcF, v); - return p; - } - - if (flags & ADD) visitArray(p.add, p.addF, v); - if (flags & REM) visitArray(p.rem, p.remF, v); - if (flags & MOD) visitArray(p.mod, p.modF, v); - - if (flags & REFLOW && (src = p.source)) { - sum = p.add.length + p.mod.length; - if (sum === src.length) ;else if (sum) { - visitArray(src, filter(p, ADD_MOD), v); - } else { - // if no add/rem/mod tuples, visit source - visitArray(src, p.srcF, v); - } - } - - return p; -}; -/** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array} pulses - The sub-pulses for this multi-pulse. - */ - - -function MultiPulse(dataflow, stamp, pulses, encode) { - var p = this, - c = 0, - pulse, - hash, - i, - n, - f; - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - - for (i = 0, n = pulses.length; i < n; ++i) { - pulse = pulses[i]; - if (pulse.stamp !== stamp) continue; - - if (pulse.fields) { - hash = p.fields || (p.fields = {}); - - for (f in pulse.fields) { - hash[f] = 1; - } - } - - if (pulse.changed(p.ADD)) c |= p.ADD; - if (pulse.changed(p.REM)) c |= p.REM; - if (pulse.changed(p.MOD)) c |= p.MOD; - } - - this.changes = c; -} - -var prototype$4 = inherits(MultiPulse, Pulse); -/** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - */ - -prototype$4.fork = function (flags) { - var p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); - - if (flags !== undefined) { - if (flags & p.ADD) { - this.visit(p.ADD, function (t) { - return p.add.push(t); - }); - } - - if (flags & p.REM) { - this.visit(p.REM, function (t) { - return p.rem.push(t); - }); - } - - if (flags & p.MOD) { - this.visit(p.MOD, function (t) { - return p.mod.push(t); - }); - } - } - - return p; -}; - -prototype$4.changed = function (flags) { - return this.changes & flags; -}; - -prototype$4.modified = function (_) { - var p = this, - fields = p.fields; - return !(fields && p.changes & p.MOD) ? 0 : isArray(_) ? _.some(function (f) { - return fields[f]; - }) : fields[_]; -}; - -prototype$4.filter = function () { - error('MultiPulse does not support filtering.'); -}; - -prototype$4.materialize = function () { - error('MultiPulse does not support materialization.'); -}; - -prototype$4.visit = function (flags, visitor) { - var p = this, - pulses = p.pulses, - n = pulses.length, - i = 0; - - if (flags & p.SOURCE) { - for (; i < n; ++i) { - pulses[i].visit(flags, visitor); - } - } else { - for (; i < n; ++i) { - if (pulses[i].stamp === p.stamp) { - pulses[i].visit(flags, visitor); - } - } - } - - return p; -}; -/* eslint-disable require-atomic-updates */ - -/** - * Evaluates the dataflow and returns a Promise that resolves when pulse - * propagation completes. This method will increment the current timestamp - * and process all updated, pulsed and touched operators. When invoked for - * the first time, all registered operators will be processed. This method - * should not be invoked by third-party clients, use {@link runAsync} or - * {@link run} instead. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ - - -function evaluate(_x14, _x15, _x16) { - return _evaluate.apply(this, arguments); -} -/** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ - - -function _evaluate() { - _evaluate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(encode, prerun, postrun) { - var df, async, stamp, count, op, next, error, pr, i; - return regeneratorRuntime.wrap(function _callee10$(_context17) { - while (1) { - switch (_context17.prev = _context17.next) { - case 0: - df = this, async = []; // if the pulse value is set, this is a re-entrant call - - if (!df._pulse) { - _context17.next = 3; - break; - } - - return _context17.abrupt("return", reentrant(df)); - - case 3: - if (!df._pending) { - _context17.next = 6; - break; - } - - _context17.next = 6; - return df._pending; - - case 6: - if (!prerun) { - _context17.next = 9; - break; - } - - _context17.next = 9; - return asyncCallback(df, prerun); - - case 9: - if (df._touched.length) { - _context17.next = 12; - break; - } - - df.debug('Dataflow invoked, but nothing to do.'); - return _context17.abrupt("return", df); - - case 12: - // increment timestamp clock - stamp = ++df._clock; // set the current pulse - - df._pulse = new Pulse(df, stamp, encode); // initialize priority queue, reset touched operators - - df._touched.forEach(function (op) { - return df._enqueue(op, true); - }); - - df._touched = UniqueList(id); - count = 0; - _context17.prev = 17; - - case 18: - if (!(df._heap.size() > 0)) { - _context17.next = 35; - break; - } - - // dequeue operator with highest priority - op = df._heap.pop(); // re-queue if rank changed - - if (!(op.rank !== op.qrank)) { - _context17.next = 23; - break; - } - - df._enqueue(op, true); - - return _context17.abrupt("continue", 18); - - case 23: - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - - if (!next.then) { - _context17.next = 30; - break; - } - - _context17.next = 27; - return next; - - case 27: - next = _context17.sent; - _context17.next = 31; - break; - - case 30: - if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - - case 31: - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach(function (op) { - return df._enqueue(op); - }); - } // increment visit counter - - - ++count; - _context17.next = 18; - break; - - case 35: - _context17.next = 41; - break; - - case 37: - _context17.prev = 37; - _context17.t0 = _context17["catch"](17); - - df._heap.clear(); - - error = _context17.t0; - - case 41: - // reset pulse map - df._input = {}; - df._pulse = null; - df.debug("Pulse ".concat(stamp, ": ").concat(count, " operators")); - - if (error) { - df._postrun = []; - df.error(error); - } // invoke callbacks queued via runAfter - - - if (!df._postrun.length) { - _context17.next = 55; - break; - } - - pr = df._postrun.sort(function (a, b) { - return b.priority - a.priority; - }); - df._postrun = []; - i = 0; - - case 49: - if (!(i < pr.length)) { - _context17.next = 55; - break; - } - - _context17.next = 52; - return asyncCallback(df, pr[i].callback); - - case 52: - ++i; - _context17.next = 49; - break; - - case 55: - if (!postrun) { - _context17.next = 58; - break; - } - - _context17.next = 58; - return asyncCallback(df, postrun); - - case 58: - // handle non-blocking asynchronous callbacks - if (async.length) { - Promise.all(async).then(function (cb) { - return df.runAsync(null, function () { - cb.forEach(function (f) { - try { - f(df); - } catch (err) { - df.error(err); - } - }); - }); - }); - } - - return _context17.abrupt("return", df); - - case 60: - case "end": - return _context17.stop(); - } - } - }, _callee10, this, [[17, 37]]); - })); - return _evaluate.apply(this, arguments); -} - -function runAsync(_x17, _x18, _x19) { - return _runAsync.apply(this, arguments); -} -/** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ - - -function _runAsync() { - _runAsync = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(encode, prerun, postrun) { - var _this18 = this; - - var clear; - return regeneratorRuntime.wrap(function _callee11$(_context18) { - while (1) { - switch (_context18.prev = _context18.next) { - case 0: - if (!this._running) { - _context18.next = 5; - break; - } - - _context18.next = 3; - return this._running; - - case 3: - _context18.next = 0; - break; - - case 5: - // run dataflow, manage running promise - clear = function clear() { - return _this18._running = null; - }; - - (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear); - return _context18.abrupt("return", this._running); - - case 8: - case "end": - return _context18.stop(); - } - } - }, _callee11, this); - })); - return _runAsync.apply(this, arguments); -} - -function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this); -} -/** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ - - -function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) { - // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - } else { - // pulse propagation already complete, invoke immediately - try { - callback(this); - } catch (err) { - this.error(err); - } - } -} -/** - * Raise an error for re-entrant dataflow evaluation. - */ - - -function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; -} -/** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ - - -function enqueue(op, force) { - var q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - - if (q || force) { - op.qrank = op.rank; - - this._heap.push(op); - } -} -/** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ - - -function getPulse(op, encode) { - var s = op.source, - stamp = this._clock; - return s && isArray(s) ? new MultiPulse(this, stamp, s.map(function (_) { - return _.pulse; - }), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); -} - -function singlePulse(p, s) { - if (s && s.stamp === p.stamp) { - return s; - } - - p = p.fork(); - - if (s && s !== StopPropagation) { - p.source = s.source; - } - - return p; -} - -var NO_OPT = { - skip: false, - force: false -}; -/** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - -function touch(op, options) { - var opt = options || NO_OPT; - - if (this._pulse) { - // if in midst of propagation, add to priority queue - this._enqueue(op); - } else { - // otherwise, queue for next propagation - this._touched.add(op); - } - - if (opt.skip) op.skip(true); - return this; -} -/** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - - -function update(op, value, options) { - var opt = options || NO_OPT; - - if (op.set(value) || opt.force) { - this.touch(op, opt); - } - - return this; -} -/** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - - -function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - var p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), - t = op.pulse && op.pulse.source || []; - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - return this; -} - -function Heap(cmp) { - var nodes = []; - return { - clear: function clear() { - return nodes = []; - }, - size: function size() { - return nodes.length; - }, - peek: function peek() { - return nodes[0]; - }, - push: function push(x) { - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: function pop() { - var last = nodes.pop(), - item; - - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else { - item = last; - } - - return item; - } - }; -} - -function siftdown(array, start, idx, cmp) { - var item, parent, pidx; - item = array[idx]; - - while (idx > start) { - pidx = idx - 1 >> 1; - parent = array[pidx]; - - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - - break; - } - - return array[idx] = item; -} - -function siftup(array, idx, cmp) { - var start = idx, - end = array.length, - item = array[idx], - cidx = (idx << 1) + 1, - ridx; - - while (cidx < end) { - ridx = cidx + 1; - - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) { - cidx = ridx; - } - - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - - array[idx] = item; - return siftdown(array, start, idx, cmp); -} -/** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ - - -function Dataflow() { - this.logger(logger()); - this.logLevel(Error$1); - this._clock = 0; - this._rank = 0; - this._locale = defaultLocale(); - - try { - this._loader = loader(); - } catch (e) {// do nothing if loader module is unavailable - } - - this._touched = UniqueList(id); - this._input = {}; - this._pulse = null; - this._heap = Heap(function (a, b) { - return a.qrank - b.qrank; - }); - this._postrun = []; -} - -var prototype$5 = Dataflow.prototype; -/** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ - -prototype$5.stamp = function () { - return this._clock; -}; -/** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ - - -prototype$5.loader = function (_) { - if (arguments.length) { - this._loader = _; - return this; - } else { - return this._loader; - } -}; -/** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ - - -prototype$5.locale = function (_) { - if (arguments.length) { - this._locale = _; - return this; - } else { - return this._locale; - } -}; -/** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ - - -prototype$5.cleanThreshold = 1e4; // OPERATOR REGISTRATION - -prototype$5.add = add; -prototype$5.connect = connect; -prototype$5.rank = rank; -prototype$5.rerank = rerank; // OPERATOR UPDATES - -prototype$5.pulse = pulse; -prototype$5.touch = touch; -prototype$5.update = update; -prototype$5.changeset = changeset; // DATA LOADING - -prototype$5.ingest = ingest$1; -prototype$5.parse = parse$1; -prototype$5.preload = preload; -prototype$5.request = request; // EVENT HANDLING - -prototype$5.events = events; -prototype$5.on = on; // PULSE PROPAGATION - -prototype$5.evaluate = evaluate; -prototype$5.run = run; -prototype$5.runAsync = runAsync; -prototype$5.runAfter = runAfter; -prototype$5._enqueue = enqueue; -prototype$5._getPulse = getPulse; // LOGGING AND ERROR HANDLING - -function logMethod(method) { - return function () { - return this._log[method].apply(this, arguments); - }; -} -/** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ - - -prototype$5.logger = function (logger) { - if (arguments.length) { - this._log = logger; - return this; - } else { - return this._log; - } -}; -/** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ - - -prototype$5.error = logMethod('error'); -/** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ - -prototype$5.warn = logMethod('warn'); -/** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ - -prototype$5.info = logMethod('info'); -/** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ - -prototype$5.debug = logMethod('debug'); -/** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ - -prototype$5.logLevel = logMethod('level'); -/** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ - -function Transform(init, params) { - Operator.call(this, init, null, params); -} - -var prototype$6 = inherits(Transform, Operator); -/** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ - -prototype$6.run = function (pulse) { - var _this = this; - - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - var rv; - - if (this.skip()) { - this.skip(false); - } else { - rv = this.evaluate(pulse); - } - - rv = rv || pulse; - - if (rv.then) { - rv = rv.then(function (_) { - return _this.pulse = _; - }); - } else if (rv !== pulse.StopPropagation) { - this.pulse = rv; - } - - return rv; -}; -/** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ - - -prototype$6.evaluate = function (pulse) { - var params = this.marshall(pulse.stamp), - out = this.transform(params, pulse); - params.clear(); - return out; -}; -/** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ - - -prototype$6.transform = function () {}; - -var transforms = {}; -exports.transforms = transforms; - -function definition(type) { - var t = transform(type); - return t && t.Definition || null; -} - -function transform(type) { - type = type && type.toLowerCase(); - return hasOwnProperty(transforms, type) ? transforms[type] : null; -} - -function multikey(f) { - return function (x) { - var n = f.length, - i = 1, - k = String(f[0](x)); - - for (; i < n; ++i) { - k += '|' + f[i](x); - } - - return k; - }; -} - -function groupkey(fields) { - return !fields || !fields.length ? function () { - return ''; - } : fields.length === 1 ? fields[0] : multikey(fields); -} - -function measureName(op, field, as) { - return as || op + (!field ? '' : '_' + field); -} - -var noop = function noop() {}; - -var base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 -}; -var AggregateOps = { - values: { - init: function init(m) { - return m.cell.store = true; - }, - value: function value(m) { - return m.cell.data.values(); - }, - idx: -1 - }, - count: { - value: function value(m) { - return m.cell.num; - } - }, - __count__: { - value: function value(m) { - return m.missing + m.valid; - } - }, - missing: { - value: function value(m) { - return m.missing; - } - }, - valid: { - value: function value(m) { - return m.valid; - } - }, - sum: { - init: function init(m) { - return m.sum = 0; - }, - value: function value(m) { - return m.sum; - }, - add: function add(m, v) { - return m.sum += +v; - }, - rem: function rem(m, v) { - return m.sum -= v; - } - }, - product: { - init: function init(m) { - return m.product = 1; - }, - value: function value(m) { - return m.valid ? m.product : undefined; - }, - add: function add(m, v) { - return m.product *= v; - }, - rem: function rem(m, v) { - return m.product /= v; - } - }, - mean: { - init: function init(m) { - return m.mean = 0; - }, - value: function value(m) { - return m.valid ? m.mean : undefined; - }, - add: function add(m, v) { - return m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid; - }, - rem: function rem(m, v) { - return m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean; - } - }, - average: { - value: function value(m) { - return m.valid ? m.mean : undefined; - }, - req: ['mean'], - idx: 1 - }, - variance: { - init: function init(m) { - return m.dev = 0; - }, - value: function value(m) { - return m.valid > 1 ? m.dev / (m.valid - 1) : undefined; - }, - add: function add(m, v) { - return m.dev += m.mean_d * (v - m.mean); - }, - rem: function rem(m, v) { - return m.dev -= m.mean_d * (v - m.mean); - }, - req: ['mean'], - idx: 1 - }, - variancep: { - value: function value(m) { - return m.valid > 1 ? m.dev / m.valid : undefined; - }, - req: ['variance'], - idx: 2 - }, - stdev: { - value: function value(m) { - return m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined; - }, - req: ['variance'], - idx: 2 - }, - stdevp: { - value: function value(m) { - return m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined; - }, - req: ['variance'], - idx: 2 - }, - stderr: { - value: function value(m) { - return m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined; - }, - req: ['variance'], - idx: 2 - }, - distinct: { - value: function value(m) { - return m.cell.data.distinct(m.get); - }, - req: ['values'], - idx: 3 - }, - ci0: { - value: function value(m) { - return m.cell.data.ci0(m.get); - }, - req: ['values'], - idx: 3 - }, - ci1: { - value: function value(m) { - return m.cell.data.ci1(m.get); - }, - req: ['values'], - idx: 3 - }, - median: { - value: function value(m) { - return m.cell.data.q2(m.get); - }, - req: ['values'], - idx: 3 - }, - q1: { - value: function value(m) { - return m.cell.data.q1(m.get); - }, - req: ['values'], - idx: 3 - }, - q3: { - value: function value(m) { - return m.cell.data.q3(m.get); - }, - req: ['values'], - idx: 3 - }, - min: { - init: function init(m) { - return m.min = undefined; - }, - value: function value(m) { - return m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min; - }, - add: function add(m, v) { - if (v < m.min || m.min === undefined) m.min = v; - }, - rem: function rem(m, v) { - if (v <= m.min) m.min = NaN; - }, - req: ['values'], - idx: 4 - }, - max: { - init: function init(m) { - return m.max = undefined; - }, - value: function value(m) { - return m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max; - }, - add: function add(m, v) { - if (v > m.max || m.max === undefined) m.max = v; - }, - rem: function rem(m, v) { - if (v >= m.max) m.max = NaN; - }, - req: ['values'], - idx: 4 - }, - argmin: { - init: function init(m) { - return m.argmin = undefined; - }, - value: function value(m) { - return m.argmin || m.cell.data.argmin(m.get); - }, - add: function add(m, v, t) { - if (v < m.min) m.argmin = t; - }, - rem: function rem(m, v) { - if (v <= m.min) m.argmin = undefined; - }, - req: ['min', 'values'], - idx: 3 - }, - argmax: { - init: function init(m) { - return m.argmax = undefined; - }, - value: function value(m) { - return m.argmax || m.cell.data.argmax(m.get); - }, - add: function add(m, v, t) { - if (v > m.max) m.argmax = t; - }, - rem: function rem(m, v) { - if (v >= m.max) m.argmax = undefined; - }, - req: ['max', 'values'], - idx: 3 - } -}; -var ValidAggregateOps = Object.keys(AggregateOps); - -function measure(key, value) { - return function (out) { - return extend({ - name: key, - out: out || key - }, base_op, value); - }; -} - -ValidAggregateOps.forEach(function (key) { - AggregateOps[key] = measure(key, AggregateOps[key]); -}); - -function createMeasure(op, name) { - return AggregateOps[op](name); -} - -function compareIndex(a, b) { - return a.idx - b.idx; -} - -function resolve(agg) { - var map = {}; - agg.forEach(function (a) { - return map[a.name] = a; - }); - - var getreqs = function getreqs(a) { - if (!a.req) return; - a.req.forEach(function (key) { - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - - agg.forEach(getreqs); - return Object.values(map).sort(compareIndex); -} - -function init() { - var _this2 = this; - - this.valid = 0; - this.missing = 0; - - this._ops.forEach(function (op) { - return op.init(_this2); - }); -} - -function add$1(v, t) { - var _this3 = this; - - if (v == null || v === '') { - ++this.missing; - return; - } - - if (v !== v) return; - ++this.valid; - - this._ops.forEach(function (op) { - return op.add(_this3, v, t); - }); -} - -function rem(v, t) { - var _this4 = this; - - if (v == null || v === '') { - --this.missing; - return; - } - - if (v !== v) return; - --this.valid; - - this._ops.forEach(function (op) { - return op.rem(_this4, v, t); - }); -} - -function set(t) { - var _this5 = this; - - this._out.forEach(function (op) { - return t[op.out] = op.value(_this5); - }); - - return t; -} - -function compileMeasures(agg, field) { - var get = field || identity, - ops = resolve(agg), - out = agg.slice().sort(compareIndex); - - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - - ctr.prototype.init = init; - ctr.prototype.add = add$1; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map(function (op) { - return op.out; - }); - return ctr; -} - -function numbers$1(values, valueof) { - var _iterator13, _step13, _value14, _index7, _iterator14, _step14, _value15; - - return regeneratorRuntime.wrap(function numbers$1$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - if (!(valueof == null)) { - _context3.next = 21; - break; - } - - _iterator13 = _createForOfIteratorHelper(values); - _context3.prev = 2; - - _iterator13.s(); - - case 4: - if ((_step13 = _iterator13.n()).done) { - _context3.next = 11; - break; - } - - _value14 = _step13.value; - - if (!(_value14 != null && _value14 !== '' && (_value14 = +_value14) >= _value14)) { - _context3.next = 9; - break; - } - - _context3.next = 9; - return _value14; - - case 9: - _context3.next = 4; - break; - - case 11: - _context3.next = 16; - break; - - case 13: - _context3.prev = 13; - _context3.t0 = _context3["catch"](2); - - _iterator13.e(_context3.t0); - - case 16: - _context3.prev = 16; - - _iterator13.f(); - - return _context3.finish(16); - - case 19: - _context3.next = 41; - break; - - case 21: - _index7 = -1; - _iterator14 = _createForOfIteratorHelper(values); - _context3.prev = 23; - - _iterator14.s(); - - case 25: - if ((_step14 = _iterator14.n()).done) { - _context3.next = 33; - break; - } - - _value15 = _step14.value; - _value15 = valueof(_value15, ++_index7, values); - - if (!(_value15 != null && _value15 !== '' && (_value15 = +_value15) >= _value15)) { - _context3.next = 31; - break; - } - - _context3.next = 31; - return _value15; - - case 31: - _context3.next = 25; - break; - - case 33: - _context3.next = 38; - break; - - case 35: - _context3.prev = 35; - _context3.t1 = _context3["catch"](23); - - _iterator14.e(_context3.t1); - - case 38: - _context3.prev = 38; - - _iterator14.f(); - - return _context3.finish(38); - - case 41: - case "end": - return _context3.stop(); - } - } - }, _marked2, null, [[2, 13, 16, 19], [23, 35, 38, 41]]); -} - -function quantiles(array, p, f) { - var values = Float64Array.from(numbers$1(array, f)); // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - - values.sort(ascending); - return p.map(function (_) { - return quantileSorted(values, _); - }); -} - -function quartiles(array, f) { - return quantiles(array, [0.25, 0.50, 0.75], f); -} // Scott, D. W. (1992) Multivariate Density Estimation: -// Theory, Practice, and Visualization. Wiley. - - -function bandwidthNRD(array, f) { - var n = array.length, - v = deviation(array, f), - q = quartiles(array, f), - h = (q[2] - q[0]) / 1.34; - v = Math.min(v, h) || v || Math.abs(q[0]) || 1; - return 1.06 * v * Math.pow(n, -0.2); -} - -function bin(_) { - // determine range - var maxb = _.maxbins || 20, - base = _.base || 10, - logb = Math.log(base), - div = _.divide || [5, 2], - min = _.extent[0], - max = _.extent[1], - span = _.span || max - min || Math.abs(min) || 1, - step, - level, - minstep, - precision, - v, - i, - n, - eps; - - if (_.step) { - // if step size is explicitly given, use that - step = _.step; - } else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - - for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i) { - ; - } - - step = _.steps[Math.max(0, i - 1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level)); // increase step size if too many bins - - while (Math.ceil(span / step) > maxb) { - step *= base; - } // decrease step size if allowed - - - for (i = 0, n = div.length; i < n; ++i) { - v = step / div[i]; - if (v >= minstep && span / v <= maxb) step = v; - } - } // update precision, min and max - - - v = Math.log(step); - precision = v >= 0 ? 0 : ~~(-v / logb) + 1; - eps = Math.pow(base, -precision - 1); - - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; - } - - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; -} - -var _random = Math.random; -exports.random = _random; - -function setRandom(r) { - exports.random = _random = r; -} - -function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [undefined, undefined]; - var values = Float64Array.from(numbers$1(array, f)), - n = values.length, - m = samples, - a, - i, - j, - mu; - - for (j = 0, mu = Array(m); j < m; ++j) { - for (a = 0, i = 0; i < n; ++i) { - a += values[~~(_random() * n)]; - } - - mu[j] = a / n; - } - - mu.sort(ascending); - return [quantile(mu, alpha / 2), quantile(mu, 1 - alpha / 2)]; -} // Dot density binning for dot plot construction. -// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. -// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - - -function dotbin(array, step, smooth, f) { - f = f || function (_) { - return _; - }; - - var i = 0, - j = 1, - n = array.length, - v = new Float64Array(n), - a = f(array[0]), - b = a, - w = a + step, - x; - - for (; j < n; ++j) { - x = f(array[j]); - - if (x >= w) { - b = (a + b) / 2; - - for (; i < j; ++i) { - v[i] = b; - } - - w = x + step; - a = x; - } - - b = x; - } - - b = (a + b) / 2; - - for (; i < j; ++i) { - v[i] = b; - } - - return smooth ? smoothing(v, step + step / 4) : v; -} // perform smoothing to reduce variance -// swap points between "adjacent" stacks -// Wilkinson defines adjacent as within step/4 units - - -function smoothing(v, thresh) { - var n = v.length, - a = 0, - b = 1, - c, - d; // get left stack - - while (v[a] === v[b]) { - ++b; - } - - while (b < n) { - // get right stack - c = b + 1; - - while (v[b] === v[c]) { - ++c; - } // are stacks adjacent? - // if so, compare sizes and swap as needed - - - if (v[b] - v[b - 1] < thresh) { - d = b + (a + c - b - b >> 1); - - while (d < b) { - v[d++] = v[b]; - } - - while (d > b) { - v[d--] = v[a]; - } - } // update left stack indices - - - a = b; - b = c; - } - - return v; -} - -function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function () { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; -} - -function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - - var dist = {}, - a, - b, - d; - - dist.min = function (_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else { - return a; - } - }; - - dist.max = function (_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else { - return b; - } - }; - - dist.sample = function () { - return a + Math.floor(d * _random()); - }; - - dist.pdf = function (x) { - return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0; - }; - - dist.cdf = function (x) { - var v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }; - - dist.icdf = function (p) { - return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN; - }; - - return dist.min(min).max(max); -} - -var SQRT2PI = Math.sqrt(2 * Math.PI); -var SQRT2 = Math.SQRT2; -var nextSample = NaN; - -function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - var x = 0, - y = 0, - rds, - c; - - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = _random() * 2 - 1; - y = _random() * 2 - 1; - rds = x * x + y * y; - } while (rds === 0 || rds > 1); - - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - - x *= c; - nextSample = y * c; - } - - return mean + x * stdev; -} - -function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - var z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); -} // Approximation from West (2009) -// Better Approximations to Cumulative Normal Functions - - -function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - var cd, - z = (value - mean) / stdev, - Z = Math.abs(z); - - if (Z > 37) { - cd = 0; - } else { - var _sum, - _exp = Math.exp(-Z * Z / 2); - - if (Z < 7.07106781186547) { - _sum = 3.52624965998911e-02 * Z + 0.700383064443688; - _sum = _sum * Z + 6.37396220353165; - _sum = _sum * Z + 33.912866078383; - _sum = _sum * Z + 112.079291497871; - _sum = _sum * Z + 221.213596169931; - _sum = _sum * Z + 220.206867912376; - cd = _exp * _sum; - _sum = 8.83883476483184e-02 * Z + 1.75566716318264; - _sum = _sum * Z + 16.064177579207; - _sum = _sum * Z + 86.7807322029461; - _sum = _sum * Z + 296.564248779674; - _sum = _sum * Z + 637.333633378831; - _sum = _sum * Z + 793.826512519948; - _sum = _sum * Z + 440.413735824752; - cd = cd / _sum; - } else { - _sum = Z + 0.65; - _sum = Z + 4 / _sum; - _sum = Z + 3 / _sum; - _sum = Z + 2 / _sum; - _sum = Z + 1 / _sum; - cd = _exp / _sum / 2.506628274631; - } - } - - return z > 0 ? 1 - cd : cd; -} // Approximation of Probit function using inverse error function. - - -function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); -} // Approximate inverse error function. Implementation from "Approximating -// the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. -// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 - - -function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - var w = -Math.log((1 - x) * (1 + x)), - p; - - if (w < 6.25) { - w -= 3.125; - p = -3.6444120640178196996e-21; - p = -1.685059138182016589e-19 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -1.333171662854620906e-16 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -4.0545662729752068639e-14 + p * w; - p = -8.1519341976054721522e-14 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -1.2975133253453532498e-11 + p * w; - p = -5.4154120542946279317e-11 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -4.1126339803469836976e-09 + p * w; - p = -2.9070369957882005086e-08 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -1.3654692000834678645e-06 + p * w; - p = -1.3882523362786468719e-05 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.00074070253416626697512 + p * w; - p = -0.0060336708714301490533 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -2.7517406297064545428e-07 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -4.013867526981545969e-06 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -4.7318229009055733981e-05 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628474796 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047313 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.0037512085075692412107 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -2.7109920616438573243e-11; - p = -2.5556418169965252055e-10 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -3.7894654401267369937e-09 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -1.4960026627149240478e-08 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -6.7711997758452339498e-08 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -9.9298272942317002539e-07 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -1.9681778105531670567e-05 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477347 + p * w; - p = -0.00013871931833623122026 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else { - p = Infinity; - } - - return p * x; -} - -function randomNormal(mean, stdev) { - var mu, - sigma, - dist = { - mean: function mean(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function stdev(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: function sample() { - return sampleNormal(mu, sigma); - }, - pdf: function pdf(value) { - return densityNormal(value, mu, sigma); - }, - cdf: function cdf(value) { - return cumulativeNormal(value, mu, sigma); - }, - icdf: function icdf(p) { - return quantileNormal(p, mu, sigma); - } - }; - return dist.mean(mean).stdev(stdev); -} // TODO: support for additional kernels? - - -function randomKDE(support, bandwidth) { - var kernel = randomNormal(), - dist = {}, - n = 0; - - dist.data = function (_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else { - return support; - } - }; - - dist.bandwidth = function (_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = bandwidthNRD(support); - return dist; - }; - - dist.sample = function () { - return support[~~(_random() * n)] + bandwidth * kernel.sample(); - }; - - dist.pdf = function (x) { - for (var y = 0, i = 0; i < n; ++i) { - y += kernel.pdf((x - support[i]) / bandwidth); - } - - return y / bandwidth / n; - }; - - dist.cdf = function (x) { - for (var y = 0, i = 0; i < n; ++i) { - y += kernel.cdf((x - support[i]) / bandwidth); - } - - return y / n; - }; - - dist.icdf = function () { - throw Error('KDE icdf not supported.'); - }; - - return dist.data(support); -} - -function sampleLogNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - return Math.exp(mean + sampleNormal() * stdev); -} - -function densityLogNormal(value, mean, stdev) { - if (value <= 0) return 0; - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - var z = (Math.log(value) - mean) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value); -} - -function cumulativeLogNormal(value, mean, stdev) { - return cumulativeNormal(Math.log(value), mean, stdev); -} - -function quantileLogNormal(p, mean, stdev) { - return Math.exp(quantileNormal(p, mean, stdev)); -} - -function randomLogNormal(mean, stdev) { - var mu, - sigma, - dist = { - mean: function mean(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function stdev(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: function sample() { - return sampleLogNormal(mu, sigma); - }, - pdf: function pdf(value) { - return densityLogNormal(value, mu, sigma); - }, - cdf: function cdf(value) { - return cumulativeLogNormal(value, mu, sigma); - }, - icdf: function icdf(p) { - return quantileLogNormal(p, mu, sigma); - } - }; - return dist.mean(mean).stdev(stdev); -} - -function randomMixture(dists, weights) { - var dist = {}, - m = 0, - w; - - function normalize(x) { - var w = [], - sum = 0, - i; - - for (i = 0; i < m; ++i) { - sum += w[i] = x[i] == null ? 1 : +x[i]; - } - - for (i = 0; i < m; ++i) { - w[i] /= sum; - } - - return w; - } - - dist.weights = function (_) { - if (arguments.length) { - w = normalize(weights = _ || []); - return dist; - } - - return weights; - }; - - dist.distributions = function (_) { - if (arguments.length) { - if (_) { - m = _.length; - dists = _; - } else { - m = 0; - dists = []; - } - - return dist.weights(weights); - } - - return dists; - }; - - dist.sample = function () { - var r = _random(), - d = dists[m - 1], - v = w[0], - i = 0; // first select distribution - - - for (; i < m - 1; v += w[++i]) { - if (r < v) { - d = dists[i]; - break; - } - } // then sample from it - - - return d.sample(); - }; - - dist.pdf = function (x) { - for (var p = 0, i = 0; i < m; ++i) { - p += w[i] * dists[i].pdf(x); - } - - return p; - }; - - dist.cdf = function (x) { - for (var p = 0, i = 0; i < m; ++i) { - p += w[i] * dists[i].cdf(x); - } - - return p; - }; - - dist.icdf = function () { - throw Error('Mixture icdf not supported.'); - }; - - return dist.distributions(dists).weights(weights); -} - -function sampleUniform(min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return min + (max - min) * _random(); -} - -function densityUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return value >= min && value <= max ? 1 / (max - min) : 0; -} - -function cumulativeUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); -} - -function quantileUniform(p, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return p >= 0 && p <= 1 ? min + p * (max - min) : NaN; -} - -function randomUniform(min, max) { - var a, - b, - dist = { - min: function min(_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else { - return a; - } - }, - max: function max(_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else { - return b; - } - }, - sample: function sample() { - return sampleUniform(a, b); - }, - pdf: function pdf(value) { - return densityUniform(value, a, b); - }, - cdf: function cdf(value) { - return cumulativeUniform(value, a, b); - }, - icdf: function icdf(p) { - return quantileUniform(p, a, b); - } - }; - - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return dist.min(min).max(max); -} // Ordinary Least Squares - - -function ols(uX, uY, uXY, uX2) { - var delta = uX2 - uX * uX, - slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, - intercept = uY - slope * uX; - return [intercept, slope]; -} - -function points(data, x, y, sort) { - data = data.filter(function (d) { - var u = x(d), - v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - - if (sort) { - data.sort(function (a, b) { - return x(a) - x(b); - }); - } - - var n = data.length, - X = new Float64Array(n), - Y = new Float64Array(n); // extract values, calculate means - - var i = 0, - ux = 0, - uy = 0, - xv, - yv, - d; - - var _iterator15 = _createForOfIteratorHelper(data), - _step15; - - try { - for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) { - d = _step15.value; - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } // mean center the data - - } catch (err) { - _iterator15.e(err); - } finally { - _iterator15.f(); - } - - for (i = 0; i < n; ++i) { - X[i] -= ux; - Y[i] -= uy; - } - - return [X, Y, ux, uy]; -} - -function visitPoints(data, x, y, callback) { - var i = -1, - u, - v; - - var _iterator16 = _createForOfIteratorHelper(data), - _step16; - - try { - for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) { - var d = _step16.value; - u = x(d); - v = y(d); - - if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) { - callback(u, v, ++i); - } - } - } catch (err) { - _iterator16.e(err); - } finally { - _iterator16.f(); - } -} // Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - -function rSquared(data, x, y, uY, predict) { - var SSE = 0, - SST = 0; - visitPoints(data, x, y, function (dx, dy) { - var sse = dy - predict(dx), - sst = dy - uY; - SSE += sse * sse; - SST += sst * sst; - }); - return 1 - SSE / SST; -} // Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - -function regressionLinear(data, x, y) { - var X = 0, - Y = 0, - XY = 0, - X2 = 0, - n = 0; - visitPoints(data, x, y, function (dx, dy) { - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - var coef = ols(X, Y, XY, X2), - predict = function predict(x) { - return coef[0] + coef[1] * x; - }; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} // Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - -function regressionLog(data, x, y) { - var X = 0, - Y = 0, - XY = 0, - X2 = 0, - n = 0; - visitPoints(data, x, y, function (dx, dy) { - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - var coef = ols(X, Y, XY, X2), - predict = function predict(x) { - return coef[0] + coef[1] * Math.log(x); - }; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} - -function regressionExp(data, x, y) { - // eslint-disable-next-line no-unused-vars - var _points = points(data, x, y), - _points2 = _slicedToArray(_points, 4), - xv = _points2[0], - yv = _points2[1], - ux = _points2[2], - uy = _points2[3]; - - var YL = 0, - XY = 0, - XYL = 0, - X2Y = 0, - n = 0, - dx, - ly, - xy; - visitPoints(data, x, y, function (_, dy) { - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - - var _ols = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), - _ols2 = _slicedToArray(_ols, 2), - c0 = _ols2[0], - c1 = _ols2[1], - predict = function predict(x) { - return Math.exp(c0 + c1 * (x - ux)); - }; - - return { - coef: [Math.exp(c0 - c1 * ux), c1], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} // Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - -function regressionPow(data, x, y) { - var X = 0, - Y = 0, - XY = 0, - X2 = 0, - YS = 0, - n = 0; - visitPoints(data, x, y, function (dx, dy) { - var lx = Math.log(dx), - ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - - var coef = ols(X, Y, XY, X2), - predict = function predict(x) { - return coef[0] * Math.pow(x, coef[1]); - }; - - coef[0] = Math.exp(coef[0]); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; -} - -function regressionQuad(data, x, y) { - var _points3 = points(data, x, y), - _points4 = _slicedToArray(_points3, 4), - xv = _points4[0], - yv = _points4[1], - ux = _points4[2], - uy = _points4[3], - n = xv.length; - - var X2 = 0, - X3 = 0, - X4 = 0, - XY = 0, - X2Y = 0, - i, - dx, - dy, - x2; - - for (i = 0; i < n;) { - dx = xv[i]; - dy = yv[i++]; - x2 = dx * dx; - X2 += (x2 - X2) / i; - X3 += (x2 * dx - X3) / i; - X4 += (x2 * x2 - X4) / i; - XY += (dx * dy - XY) / i; - X2Y += (x2 * dy - X2Y) / i; - } - - var X2X2 = X4 - X2 * X2, - d = X2 * X2X2 - X3 * X3, - a = (X2Y * X2 - XY * X3) / d, - b = (XY * X2X2 - X2Y * X3) / d, - c = -a * X2, - predict = function predict(x) { - x = x - ux; - return a * x * x + b * x + c + uy; - }; // transform coefficients back from mean-centered space - - - return { - coef: [c - b * ux + a * ux * ux + uy, b - 2 * a * ux, a], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} // Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -// ... which was adapted from regression-js by Tom Alexander -// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 -// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE - - -function regressionPoly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 1) return regressionLinear(data, x, y); - if (order === 2) return regressionQuad(data, x, y); - - var _points5 = points(data, x, y), - _points6 = _slicedToArray(_points5, 4), - xv = _points6[0], - yv = _points6[1], - ux = _points6[2], - uy = _points6[3], - n = xv.length, - lhs = [], - rhs = [], - k = order + 1; - - var i, j, l, v, c; - - for (i = 0; i < k; ++i) { - for (l = 0, v = 0; l < n; ++l) { - v += Math.pow(xv[l], i) * yv[l]; - } - - lhs.push(v); - c = new Float64Array(k); - - for (j = 0; j < k; ++j) { - for (l = 0, v = 0; l < n; ++l) { - v += Math.pow(xv[l], i + j); - } - - c[j] = v; - } - - rhs.push(c); - } - - rhs.push(lhs); - - var coef = gaussianElimination(rhs), - predict = function predict(x) { - x -= ux; - var y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - - for (i = 3; i < k; ++i) { - y += coef[i] * Math.pow(x, i); - } - - return y; - }; - - return { - coef: uncenter(k, coef, -ux, uy), - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} - -function uncenter(k, a, x, y) { - var z = Array(k); - var i, j, v, c; // initialize to zero - - for (i = 0; i < k; ++i) { - z[i] = 0; - } // polynomial expansion - - - for (i = k - 1; i >= 0; --i) { - v = a[i]; - c = 1; - z[i] += v; - - for (j = 1; j <= i; ++j) { - c *= (i + 1 - j) / j; // binomial coefficent - - z[i - j] += v * Math.pow(x, j) * c; - } - } // bias term - - - z[0] += y; - return z; -} // Given an array for a two-dimensional matrix and the polynomial order, -// solve A * x = b using Gaussian elimination. - - -function gaussianElimination(matrix) { - var n = matrix.length - 1, - coef = []; - var i, j, k, r, t; - - for (i = 0; i < n; ++i) { - r = i; // max row - - for (j = i + 1; j < n; ++j) { - if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { - r = j; - } - } - - for (k = i; k < n + 1; ++k) { - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - - for (j = i + 1; j < n; ++j) { - for (k = n; k >= i; k--) { - matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; - } - } - } - - for (j = n - 1; j >= 0; --j) { - t = 0; - - for (k = j + 1; k < n; ++k) { - t += matrix[k][j] * coef[k]; - } - - coef[j] = (matrix[n][j] - t) / matrix[j][j]; - } - - return coef; -} - -var maxiters = 2, - epsilon = 1e-12; // Adapted from science.js by Jason Davies -// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js -// License: https://github.com/jasondavies/science.js/blob/master/LICENSE - -function regressionLoess(data, x, y, bandwidth) { - var _points7 = points(data, x, y, true), - _points8 = _slicedToArray(_points7, 4), - xv = _points8[0], - yv = _points8[1], - ux = _points8[2], - uy = _points8[3], - n = xv.length, - bw = Math.max(2, ~~(bandwidth * n)), - yhat = new Float64Array(n), - residuals = new Float64Array(n), - robustWeights = new Float64Array(n).fill(1); - - for (var iter = -1; ++iter <= maxiters;) { - var _interval = [0, bw - 1]; - - for (var i = 0; i < n; ++i) { - var dx = xv[i], - i0 = _interval[0], - i1 = _interval[1], - edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; - var W = 0, - _X = 0, - _Y = 0, - XY = 0, - X2 = 0, - denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - - for (var k = i0; k <= i1; ++k) { - var xk = xv[k], - yk = yv[k], - _w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], - xkw = xk * _w; - - W += _w; - _X += xkw; - _Y += yk * _w; - XY += yk * xkw; - X2 += xk * xkw; - } // linear regression fit - - - var _ols3 = ols(_X / W, _Y / W, XY / W, X2 / W), - _ols4 = _slicedToArray(_ols3, 2), - a = _ols4[0], - _b = _ols4[1]; - - yhat[i] = a + _b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - updateInterval(xv, i + 1, _interval); - } - - if (iter === maxiters) { - break; - } - - var medianResidual = median(residuals); - if (Math.abs(medianResidual) < epsilon) break; - - for (var _i2 = 0, arg, _w2; _i2 < n; ++_i2) { - arg = residuals[_i2] / (6 * medianResidual); // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - - robustWeights[_i2] = arg >= 1 ? epsilon : (_w2 = 1 - arg * arg) * _w2; - } - } - - return output(xv, yhat, ux, uy); -} // weighting kernel for local regression - - -function tricube(x) { - return (x = 1 - x * x * x) * x * x; -} // advance sliding window interval of nearest neighbors - - -function updateInterval(xv, i, interval) { - var val = xv[i], - left = interval[0], - right = interval[1] + 1; - if (right >= xv.length) return; // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - - while (i > left && xv[right] - val <= val - xv[left]) { - interval[0] = ++left; - interval[1] = right; - ++right; - } -} // generate smoothed output points -// average points with repeated x values - - -function output(xv, yhat, ux, uy) { - var n = xv.length, - out = []; - var i = 0, - cnt = 0, - prev = [], - v; - - for (; i < n; ++i) { - v = xv[i] + ux; - - if (prev[0] === v) { - // average output values via online update - prev[1] += (yhat[i] - prev[1]) / ++cnt; - } else { - // add new output point - cnt = 0; - prev[1] += uy; - prev = [v, yhat[i]]; - out.push(prev); - } - } - - prev[1] += uy; - return out; -} // subdivide up to accuracy of 0.1 degrees - - -var MIN_RADIANS = 0.1 * Math.PI / 180; // Adaptively sample an interpolated function over a domain extent - -function sampleCurve(f, extent, minSteps, maxSteps) { - minSteps = minSteps || 25; - maxSteps = Math.max(minSteps, maxSteps || 200); - - var point = function point(x) { - return [x, f(x)]; - }, - minX = extent[0], - maxX = extent[1], - span = maxX - minX, - stop = span / maxSteps, - prev = [point(minX)], - next = []; - - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for (var i = 1; i < maxSteps; ++i) { - prev.push(point(minX + i / minSteps * span)); - } - - prev.push(point(maxX)); - return prev; - } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - - for (var _i3 = minSteps; --_i3 > 0;) { - next.push(point(minX + _i3 / minSteps * span)); - } - } - - var p0 = prev[0], - p1 = next[next.length - 1]; - - while (p1) { - // midpoint for potential curve subdivision - var pm = point((p0[0] + p1[0]) / 2); - - if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) { - // maximum resolution has not yet been met, and - // subdivision midpoint sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - } else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - - p1 = next[next.length - 1]; - } - - return prev; -} - -function angleDelta(p, q, r) { - var a0 = Math.atan2(r[1] - p[1], r[0] - p[0]), - a1 = Math.atan2(q[1] - p[1], q[0] - p[0]); - return Math.abs(a0 - a1); -} - -function TupleStore(key) { - this._key = key ? field(key) : tupleid; - this.reset(); -} - -var prototype$7 = TupleStore.prototype; - -prototype$7.reset = function () { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; -}; - -prototype$7.add = function (v) { - this._add.push(v); -}; - -prototype$7.rem = function (v) { - this._rem.push(v); -}; - -prototype$7.values = function () { - this._get = null; - if (this._rem.length === 0) return this._add; - var a = this._add, - r = this._rem, - k = this._key, - n = a.length, - m = r.length, - x = Array(n - m), - map = {}, - i, - j, - v; // use unique key field to clear removed values - - for (i = 0; i < m; ++i) { - map[k(r[i])] = 1; - } - - for (i = 0, j = 0; i < n; ++i) { - if (map[k(v = a[i])]) { - map[k(v)] = 0; - } else { - x[j++] = v; - } - } - - this._rem = []; - return this._add = x; -}; // memoizing statistics methods - - -prototype$7.distinct = function (get) { - var v = this.values(), - n = v.length, - map = {}, - count = 0, - s; - - while (--n >= 0) { - s = get(v[n]) + ''; - - if (!hasOwnProperty(map, s)) { - map[s] = 1; - ++count; - } - } - - return count; -}; - -prototype$7.extent = function (get) { - if (this._get !== get || !this._ext) { - var v = this.values(), - i = extentIndex(v, get); - this._ext = [v[i[0]], v[i[1]]]; - this._get = get; - } - - return this._ext; -}; - -prototype$7.argmin = function (get) { - return this.extent(get)[0] || {}; -}; - -prototype$7.argmax = function (get) { - return this.extent(get)[1] || {}; -}; - -prototype$7.min = function (get) { - var m = this.extent(get)[0]; - return m != null ? get(m) : undefined; -}; - -prototype$7.max = function (get) { - var m = this.extent(get)[1]; - return m != null ? get(m) : undefined; -}; - -prototype$7.quartile = function (get) { - if (this._get !== get || !this._q) { - this._q = quartiles(this.values(), get); - this._get = get; - } - - return this._q; -}; - -prototype$7.q1 = function (get) { - return this.quartile(get)[0]; -}; - -prototype$7.q2 = function (get) { - return this.quartile(get)[1]; -}; - -prototype$7.q3 = function (get) { - return this.quartile(get)[2]; -}; - -prototype$7.ci = function (get) { - if (this._get !== get || !this._ci) { - this._ci = bootstrapCI(this.values(), 1000, 0.05, get); - this._get = get; - } - - return this._ci; -}; - -prototype$7.ci0 = function (get) { - return this.ci(get)[0]; -}; - -prototype$7.ci1 = function (get) { - return this.ci(get)[1]; -}; -/** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.fields] - An array of accessors to aggregate. - * @param {Array} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ - - -function Aggregate(params) { - Transform.call(this, null, params); - this._adds = []; // array of added output tuples - - this._mods = []; // array of modified output tuples - - this._alen = 0; // number of active added tuples - - this._mlen = 0; // number of active modified tuples - - this._drop = true; // should empty aggregation cells be removed - - this._cross = false; // produce full cross-product of group-by values - - this._dims = []; // group-by dimension accessors - - this._dnames = []; // group-by dimension names - - this._measures = []; // collection of aggregation monoids - - this._countOnly = false; // flag indicating only count aggregation - - this._counts = null; // collection of count fields - - this._prev = null; // previous aggregation cells - - this._inputs = null; // array of dependent input tuple field names - - this._outputs = null; // array of output tuple field names -} - -Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, { - 'name': 'drop', - 'type': 'boolean', - 'default': true - }, { - 'name': 'cross', - 'type': 'boolean', - 'default': false - }, { - 'name': 'key', - 'type': 'field' - }] -}; -var prototype$8 = inherits(Aggregate, Transform); - -prototype$8.transform = function (_, pulse) { - var _this6 = this; - - var aggr = this, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - mod = _.modified(); - - aggr.stamp = out.stamp; - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, function (t) { - return aggr.add(t); - }); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, function (t) { - return aggr.rem(t); - }); - pulse.visit(pulse.ADD, function (t) { - return aggr.add(t); - }); - } // Indicate output fields and return aggregate tuples. - - - out.modifies(aggr._outputs); // Should empty cells be dropped? - - aggr._drop = _.drop !== false; // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - - if (pulse.clean() && aggr._drop) { - out.clean(true).runAfter(function () { - return _this6.clean(); - }); - } - - return aggr.changes(out); -}; - -prototype$8.cross = function () { - var aggr = this, - curr = aggr.value, - dims = aggr._dnames, - vals = dims.map(function () { - return {}; - }), - n = dims.length; // collect all group-by domain values - - function collect(cells) { - var key, i, t, v; - - for (key in cells) { - t = cells[key].tuple; - - for (i = 0; i < n; ++i) { - vals[i][v = t[dims[i]]] = v; - } - } - } - - collect(aggr._prev); - collect(curr); // iterate over key cross-product, create cells as needed - - function generate(base, tuple, index) { - var name = dims[index], - v = vals[index++], - k, - key; - - for (k in v) { - tuple[name] = v[k]; - key = base ? base + '|' + k : k; - if (index < n) generate(key, tuple, index);else if (!curr[key]) aggr.cell(key, tuple); - } - } - - generate('', {}, 0); -}; - -prototype$8.init = function (_) { - // initialize input and output fields - var inputs = this._inputs = [], - outputs = this._outputs = [], - inputMap = {}; - - function inputVisit(get) { - var fields = array(accessorFields(get)), - i = 0, - n = fields.length, - f; - - for (; i < n; ++i) { - if (!inputMap[f = fields[i]]) { - inputMap[f] = 1; - inputs.push(f); - } - } - } // initialize group-by dimensions - - - this._dims = array(_.groupby); - this._dnames = this._dims.map(function (d) { - var dname = accessorName(d); - inputVisit(d); - outputs.push(dname); - return dname; - }); - this.cellkey = _.key ? _.key : groupkey(this._dims); // initialize aggregate measures - - this._countOnly = true; - this._counts = []; - this._measures = []; - var fields = _.fields || [null], - ops = _.ops || ['count'], - as = _.as || [], - n = fields.length, - map = {}, - field, - op, - m, - mname, - outname, - i; - - if (n !== ops.length) { - error('Unmatched number of fields and aggregate ops.'); - } - - for (i = 0; i < n; ++i) { - field = fields[i]; - op = ops[i]; - - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - - mname = accessorName(field); - outname = measureName(op, mname, as[i]); - outputs.push(outname); - - if (op === 'count') { - this._counts.push(outname); - - continue; - } - - m = map[mname]; - - if (!m) { - inputVisit(field); - m = map[mname] = []; - m.field = field; - - this._measures.push(m); - } - - if (op !== 'count') this._countOnly = false; - m.push(createMeasure(op, outname)); - } - - this._measures = this._measures.map(function (m) { - return compileMeasures(m, m.field); - }); - return {}; // aggregation cells (this.value) -}; // -- Cell Management ----- - - -prototype$8.cellkey = groupkey(); - -prototype$8.cell = function (key, t) { - var cell = this.value[key]; - - if (!cell) { - cell = this.value[key] = this.newcell(key, t); - this._adds[this._alen++] = cell; - } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._adds[this._alen++] = cell; - } else if (cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._mods[this._mlen++] = cell; - } - - return cell; -}; - -prototype$8.newcell = function (key, t) { - var cell = { - key: key, - num: 0, - agg: null, - tuple: this.newtuple(t, this._prev && this._prev[key]), - stamp: this.stamp, - store: false - }; - - if (!this._countOnly) { - var measures = this._measures, - n = measures.length, - i; - cell.agg = Array(n); - - for (i = 0; i < n; ++i) { - cell.agg[i] = new measures[i](cell); - } - } - - if (cell.store) { - cell.data = new TupleStore(); - } - - return cell; -}; - -prototype$8.newtuple = function (t, p) { - var names = this._dnames, - dims = this._dims, - x = {}, - i, - n; - - for (i = 0, n = dims.length; i < n; ++i) { - x[names[i]] = dims[i](t); - } - - return p ? replace(p.tuple, x) : ingest(x); -}; - -prototype$8.clean = function () { - var cells = this.value; - - for (var _key2 in cells) { - if (cells[_key2].num === 0) { - delete cells[_key2]; - } - } -}; // -- Process Tuples ----- - - -prototype$8.add = function (t) { - var key = this.cellkey(t), - cell = this.cell(key, t), - agg, - i, - n; - cell.num += 1; - if (this._countOnly) return; - if (cell.store) cell.data.add(t); - agg = cell.agg; - - for (i = 0, n = agg.length; i < n; ++i) { - agg[i].add(agg[i].get(t), t); - } -}; - -prototype$8.rem = function (t) { - var key = this.cellkey(t), - cell = this.cell(key, t), - agg, - i, - n; - cell.num -= 1; - if (this._countOnly) return; - if (cell.store) cell.data.rem(t); - agg = cell.agg; - - for (i = 0, n = agg.length; i < n; ++i) { - agg[i].rem(agg[i].get(t), t); - } -}; - -prototype$8.celltuple = function (cell) { - var tuple = cell.tuple, - counts = this._counts, - agg, - i, - n; // consolidate stored values - - if (cell.store) { - cell.data.values(); - } // update tuple properties - - - for (i = 0, n = counts.length; i < n; ++i) { - tuple[counts[i]] = cell.num; - } - - if (!this._countOnly) { - agg = cell.agg; - - for (i = 0, n = agg.length; i < n; ++i) { - agg[i].set(tuple); - } - } - - return tuple; -}; - -prototype$8.changes = function (out) { - var adds = this._adds, - mods = this._mods, - prev = this._prev, - drop = this._drop, - add = out.add, - rem = out.rem, - mod = out.mod, - cell, - key, - i, - n; - if (prev) for (key in prev) { - cell = prev[key]; - if (!drop || cell.num) rem.push(cell.tuple); - } - - for (i = 0, n = this._alen; i < n; ++i) { - add.push(this.celltuple(adds[i])); - adds[i] = null; // for garbage collection - } - - for (i = 0, n = this._mlen; i < n; ++i) { - cell = mods[i]; - (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell)); - mods[i] = null; // for garbage collection - } - - this._alen = this._mlen = 0; // reset list of active cells - - this._prev = null; - return out; -}; // epsilon bias to offset floating point error (#1737) - - -var EPSILON = 1e-14; -/** - * Generates a binning function for discretizing data. - * @constructor - * @param {object} params - The parameters for this operator. The - * provided values should be valid options for the {@link bin} function. - * @param {function(object): *} params.field - The data field to bin. - */ - -function Bin(params) { - Transform.call(this, null, params); -} - -Bin.Definition = { - 'type': 'Bin', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, { - 'name': 'anchor', - 'type': 'number' - }, { - 'name': 'maxbins', - 'type': 'number', - 'default': 20 - }, { - 'name': 'base', - 'type': 'number', - 'default': 10 - }, { - 'name': 'divide', - 'type': 'number', - 'array': true, - 'default': [5, 2] - }, { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, { - 'name': 'span', - 'type': 'number' - }, { - 'name': 'step', - 'type': 'number' - }, { - 'name': 'steps', - 'type': 'number', - 'array': true - }, { - 'name': 'minstep', - 'type': 'number', - 'default': 0 - }, { - 'name': 'nice', - 'type': 'boolean', - 'default': true - }, { - 'name': 'name', - 'type': 'string' - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['bin0', 'bin1'] - }] -}; -var prototype$9 = inherits(Bin, Transform); - -prototype$9.transform = function (_, pulse) { - var band = _.interval !== false, - bins = this._bins(_), - start = bins.start, - step = bins.step, - as = _.as || ['bin0', 'bin1'], - b0 = as[0], - b1 = as[1], - flag; - - if (_.modified()) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - } else { - flag = pulse.modified(accessorFields(_.field)) ? pulse.ADD_MOD : pulse.ADD; - } - - pulse.visit(flag, band ? function (t) { - var v = bins(t); // minimum bin value (inclusive) - - t[b0] = v; // maximum bin value (exclusive) - // use convoluted math for better floating point agreement - // see https://github.com/vega/vega/issues/830 - // infinite values propagate through this formula! #2227 - - t[b1] = v == null ? null : start + step * (1 + (v - start) / step); - } : function (t) { - t[b0] = bins(t); - }); - return pulse.modifies(band ? as : b0); -}; - -prototype$9._bins = function (_) { - if (this.value && !_.modified()) { - return this.value; - } - - var field = _.field, - bins = bin(_), - step = bins.step, - start = bins.start, - stop = start + Math.ceil((bins.stop - start) / step) * step, - a, - d; - - if ((a = _.anchor) != null) { - d = a - (start + step * Math.floor((a - start) / step)); - start += d; - stop += d; - } - - var f = function f(t) { - var v = toNumber(field(t)); - return v == null ? null : v < start ? -Infinity : v > stop ? +Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON + (v - start) / step)); - }; - - f.start = start; - f.stop = bins.stop; - f.step = step; - return this.value = accessor(f, accessorFields(field), _.name || 'bin_' + accessorName(field)); -}; - -function SortedList(idFunc, source, input) { - var $ = idFunc, - _data = source || [], - _add = input || [], - rem = {}, - cnt = 0; - - return { - add: function add(t) { - _add.push(t); - }, - remove: function remove(t) { - rem[$(t)] = ++cnt; - }, - size: function size() { - return _data.length; - }, - data: function data(compare, resort) { - if (cnt) { - _data = _data.filter(function (t) { - return !rem[$(t)]; - }); - rem = {}; - cnt = 0; - } - - if (resort && compare) { - _data.sort(compare); - } - - if (_add.length) { - _data = compare ? merge(compare, _data, _add.sort(compare)) : _data.concat(_add); - _add = []; - } - - return _data; - } - }; -} -/** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ - - -function Collect(params) { - Transform.call(this, [], params); -} - -Collect.Definition = { - 'type': 'Collect', - 'metadata': { - 'source': true - }, - 'params': [{ - 'name': 'sort', - 'type': 'compare' - }] -}; -var prototype$a = inherits(Collect, Transform); - -prototype$a.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), - sort = _.sort, - mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields)); - out.visit(out.REM, list.remove); - this.modified(mod); - this.value = out.source = list.data(stableCompare(sort), mod); // propagate tree root if defined - - if (pulse.source && pulse.source.root) { - this.value.root = pulse.source.root; - } - - return out; -}; -/** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The fields to compare. - * @param {Array} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ - - -function Compare(params) { - Operator.call(this, null, update$1, params); -} - -inherits(Compare, Operator); - -function update$1(_) { - return this.value && !_.modified() ? this.value : compare(_.fields, _.orders); -} -/** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ - - -function CountPattern(params) { - Transform.call(this, null, params); -} - -CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'case', - 'type': 'enum', - 'values': ['upper', 'lower', 'mixed'], - 'default': 'mixed' - }, { - 'name': 'pattern', - 'type': 'string', - 'default': '[\\w"]+' - }, { - 'name': 'stopwords', - 'type': 'string', - 'default': '' - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['text', 'count'] - }] -}; - -function tokenize(text, tcase, match) { - switch (tcase) { - case 'upper': - text = text.toUpperCase(); - break; - - case 'lower': - text = text.toLowerCase(); - break; - } - - return text.match(match); -} - -var prototype$b = inherits(CountPattern, Transform); - -prototype$b.transform = function (_, pulse) { - function process(update) { - return function (tuple) { - var tokens = tokenize(get(tuple), _.case, match) || [], - t; - - for (var i = 0, n = tokens.length; i < n; ++i) { - if (!stop.test(t = tokens[i])) update(t); - } - }; - } - - var init = this._parameterCheck(_, pulse), - counts = this._counts, - match = this._match, - stop = this._stop, - get = _.field, - as = _.as || ['text', 'count'], - add = process(function (t) { - counts[t] = 1 + (counts[t] || 0); - }), - rem = process(function (t) { - counts[t] -= 1; - }); - - if (init) { - pulse.visit(pulse.SOURCE, add); - } else { - pulse.visit(pulse.ADD, add); - pulse.visit(pulse.REM, rem); - } - - return this._finish(pulse, as); // generate output tuples -}; - -prototype$b._parameterCheck = function (_, pulse) { - var init = false; - - if (_.modified('stopwords') || !this._stop) { - this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i'); - init = true; - } - - if (_.modified('pattern') || !this._match) { - this._match = new RegExp(_.pattern || '[\\w\']+', 'g'); - init = true; - } - - if (_.modified('field') || pulse.modified(_.field.fields)) { - init = true; - } - - if (init) this._counts = {}; - return init; -}; - -prototype$b._finish = function (pulse, as) { - var counts = this._counts, - tuples = this._tuples || (this._tuples = {}), - text = as[0], - count = as[1], - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - w, - t, - c; - - for (w in counts) { - t = tuples[w]; - c = counts[w] || 0; - - if (!t && c) { - tuples[w] = t = ingest({}); - t[text] = w; - t[count] = c; - out.add.push(t); - } else if (c === 0) { - if (t) out.rem.push(t); - counts[w] = null; - tuples[w] = null; - } else if (t[count] !== c) { - t[count] = c; - out.mod.push(t); - } - } - - return out.modifies(as); -}; -/** - * Perform a cross-product of a tuple stream with itself. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object):boolean} [params.filter] - An optional filter - * function for selectively including tuples in the cross product. - * @param {Array} [params.as] - The names of the output fields. - */ - - -function Cross(params) { - Transform.call(this, null, params); -} - -Cross.Definition = { - 'type': 'Cross', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'filter', - 'type': 'expr' - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['a', 'b'] - }] -}; -var prototype$c = inherits(Cross, Transform); - -prototype$c.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - data = this.value, - as = _.as || ['a', 'b'], - a = as[0], - b = as[1], - reset = !data || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter'); - - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || truthy); - } else { - out.mod = data; - } - - out.source = this.value; - return out.modifies(as); -}; - -function cross(input, a, b, filter) { - var data = [], - t = {}, - n = input.length, - i = 0, - j, - left; - - for (; i < n; ++i) { - t[a] = left = input[i]; - - for (j = 0; j < n; ++j) { - t[b] = input[j]; - - if (filter(t)) { - data.push(ingest(t)); - t = {}; - t[a] = left; - } - } - } - - return data; -} - -var Distributions = { - kde: randomKDE, - mixture: randomMixture, - normal: randomNormal, - lognormal: randomLogNormal, - uniform: randomUniform -}; -var DISTRIBUTIONS = 'distributions', - FUNCTION = 'function', - FIELD = 'field'; -/** - * Parse a parameter object for a probability distribution. - * @param {object} def - The distribution parameter object. - * @param {function():Array} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ - -function parse$2(def, data) { - var func = def[FUNCTION]; - - if (!hasOwnProperty(Distributions, func)) { - error('Unknown distribution function: ' + func); - } - - var d = Distributions[func](); - - for (var name in def) { - // if data field, extract values - if (name === FIELD) { - d.data((def.from || data()).map(def[name])); - } // if distribution mixture, recurse to parse each definition - else if (name === DISTRIBUTIONS) { - d[name](def[name].map(function (_) { - return parse$2(_, data); - })); - } // otherwise, simply set the parameter - else if (_typeof(d[name]) === FUNCTION) { - d[name](def[name]); - } - } - - return d; -} -/** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - - -function Density(params) { - Transform.call(this, null, params); -} - -var distributions = [{ - 'key': { - 'function': 'normal' - }, - 'params': [{ - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - }] -}, { - 'key': { - 'function': 'lognormal' - }, - 'params': [{ - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - }] -}, { - 'key': { - 'function': 'uniform' - }, - 'params': [{ - 'name': 'min', - 'type': 'number', - 'default': 0 - }, { - 'name': 'max', - 'type': 'number', - 'default': 1 - }] -}, { - 'key': { - 'function': 'kde' - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'from', - 'type': 'data' - }, { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }] -}]; -var mixture = { - 'key': { - 'function': 'mixture' - }, - 'params': [{ - 'name': 'distributions', - 'type': 'param', - 'array': true, - 'params': distributions - }, { - 'name': 'weights', - 'type': 'number', - 'array': true - }] -}; -Density.Definition = { - 'type': 'Density', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'steps', - 'type': 'number' - }, { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, { - 'name': 'method', - 'type': 'string', - 'default': 'pdf', - 'values': ['pdf', 'cdf'] - }, { - 'name': 'distribution', - 'type': 'param', - 'params': distributions.concat(mixture) - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': ['value', 'density'] - }] -}; -var prototype$d = inherits(Density, Transform); - -prototype$d.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var dist = parse$2(_.distribution, source(pulse)), - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200, - method = _.method || 'pdf'; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - - if (!_.extent && !dist.data) { - error('Missing density extent parameter.'); - } - - method = dist[method]; - var as = _.as || ['value', 'density'], - domain = _.extent || extent(dist.data()), - values = sampleCurve(method, domain, minsteps, maxsteps).map(function (v) { - var tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return ingest(tuple); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; -}; - -function source(pulse) { - return function () { - return pulse.materialize(pulse.SOURCE).source; - }; -} // use either provided alias or accessor field name - - -function fieldNames(fields, as) { - if (!fields) return null; - return fields.map(function (f, i) { - return as[i] || accessorName(f); - }); -} - -function partition(data, groupby, field) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - t, - k, - g; // partition data points into groups - - - if (groupby == null) { - groups.push(data.map(field)); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - - g.push(field(t)); - } - } - - return groups; -} - -var Output = 'bin'; -/** - * Dot density binning for dot plot construction. - * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to bin. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ - -function DotBin(params) { - Transform.call(this, null, params); -} - -DotBin.Definition = { - 'type': 'DotBin', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'step', - 'type': 'number' - }, { - 'name': 'smooth', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'default': Output - }] -}; -var prototype$e = inherits(DotBin, Transform); - -prototype$e.transform = function (_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) { - return pulse; // early exit - } - - var source = pulse.materialize(pulse.SOURCE).source, - groups = partition(pulse.source, _.groupby, identity), - smooth = _.smooth || false, - field = _.field, - step = _.step || autostep(source, field), - sort = stableCompare(function (a, b) { - return field(a) - field(b); - }), - as = _.as || Output, - n = groups.length; // compute dotplot bins per group - - var min = Infinity, - max = -Infinity, - i = 0, - j; - - for (; i < n; ++i) { - var g = groups[i].sort(sort); - j = -1; - - var _iterator17 = _createForOfIteratorHelper(dotbin(g, step, smooth, field)), - _step17; - - try { - for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) { - var v = _step17.value; - if (v < min) min = v; - if (v > max) max = v; - g[++j][as] = v; - } - } catch (err) { - _iterator17.e(err); - } finally { - _iterator17.f(); - } - } - - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); -}; - -function autostep(data, field) { - return span(extent(data, field)) / 30; -} -/** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ - - -function Expression(params) { - Operator.call(this, null, update$2, params); - this.modified(true); -} - -inherits(Expression, Operator); - -function update$2(_) { - var expr = _.expr; - return this.value && !_.modified('expr') ? this.value : accessor(function (datum) { - return expr(datum, _); - }, accessorFields(expr), accessorName(expr)); -} -/** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ - - -function Extent(params) { - Transform.call(this, [undefined, undefined], params); -} - -Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }] -}; -var prototype$f = inherits(Extent, Transform); - -prototype$f.transform = function (_, pulse) { - var extent = this.value, - field = _.field, - min = extent[0], - max = extent[1], - mod; - mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field'); - - if (mod || min == null) { - min = +Infinity; - max = -Infinity; - } - - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, function (t) { - var v = toNumber(field(t)); - - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - - if (!Number.isFinite(min) || !Number.isFinite(max)) { - var name = accessorName(field); - if (name) name = " for field \"".concat(name, "\""); - pulse.dataflow.warn("Infinite extent".concat(name, ": [").concat(min, ", ").concat(max, "]")); - min = max = undefined; - } - - this.value = [min, max]; -}; -/** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ - - -function Subflow(pulse, parent) { - Operator.call(this, pulse); - this.parent = parent; - this.count = 0; -} - -var prototype$g = inherits(Subflow, Operator); -/** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ - -prototype$g.connect = function (target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return target.source = this; -}; -/** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ - - -prototype$g.add = function (t) { - this.count += 1; - this.value.add.push(t); -}; -/** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ - - -prototype$g.rem = function (t) { - this.count -= 1; - this.value.rem.push(t); -}; -/** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ - - -prototype$g.mod = function (t) { - this.value.mod.push(t); -}; -/** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ - - -prototype$g.init = function (pulse) { - this.value.init(pulse, pulse.NO_SOURCE); -}; -/** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ - - -prototype$g.evaluate = function () { - // assert: this.value.stamp === pulse.stamp - return this.value; -}; -/** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ - - -function Facet(params) { - Transform.call(this, {}, params); - this._keys = fastmap(); // cache previously calculated key values - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - - var a = this._targets = []; - a.active = 0; - - a.forEach = function (f) { - for (var i = 0, n = a.active; i < n; ++i) { - f(a[i], i, a); - } - }; -} - -var prototype$h = inherits(Facet, Transform); - -prototype$h.activate = function (flow) { - this._targets[this._targets.active++] = flow; -}; // parent argument provided by PreFacet subclass - - -prototype$h.subflow = function (key, flow, pulse, parent) { - var flows = this.value, - sf = hasOwnProperty(flows, key) && flows[key], - df, - p; - - if (!sf) { - p = parent || (p = this._group[key]) && p.tuple; - df = pulse.dataflow; - sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this); - df.add(sf).connect(flow(df, key, p)); - flows[key] = sf; - this.activate(sf); - } else if (sf.value.stamp < pulse.stamp) { - sf.init(pulse); - this.activate(sf); - } - - return sf; -}; - -prototype$h.clean = function () { - var flows = this.value; - - for (var _key3 in flows) { - if (flows[_key3].count === 0) { - var detach = flows[_key3].detachSubflow; - if (detach) detach(); - delete flows[_key3]; - } - } -}; - -prototype$h.initTargets = function () { - var a = this._targets, - n = a.length; - - for (var i = 0; i < n && a[i] != null; ++i) { - a[i] = null; // ensure old flows can be garbage collected - } - - a.active = 0; -}; - -prototype$h.transform = function (_, pulse) { - var _this7 = this; - - var df = pulse.dataflow, - key = _.key, - flow = _.subflow, - cache = this._keys, - rekey = _.modified('key'), - subflow = function subflow(key) { - return _this7.subflow(key, flow, pulse); - }; - - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t), - k = cache.get(id); - - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - pulse.visit(pulse.ADD, function (t) { - var k = key(t); - cache.set(tupleid(t), k); - subflow(k).add(t); - }); - - if (rekey || pulse.modified(key.fields)) { - pulse.visit(pulse.MOD, function (t) { - var id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - - if (k0 === k1) { - subflow(k1).mod(t); - } else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } else if (pulse.changed(pulse.MOD)) { - pulse.visit(pulse.MOD, function (t) { - subflow(cache.get(tupleid(t))).mod(t); - }); - } - - if (rekey) { - pulse.visit(pulse.REFLOW, function (t) { - var id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } - - if (pulse.clean()) { - df.runAfter(function () { - _this7.clean(); - - cache.clean(); - }); - } else if (cache.empty > df.cleanThreshold) { - df.runAfter(cache.clean); - } - - return pulse; -}; -/** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ - - -function Field(params) { - Operator.call(this, null, update$3, params); -} - -inherits(Field, Operator); - -function update$3(_) { - return this.value && !_.modified() ? this.value : isArray(_.name) ? array(_.name).map(function (f) { - return field(f); - }) : field(_.name, _.as); -} -/** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ - - -function Filter(params) { - Transform.call(this, fastmap(), params); -} - -Filter.Definition = { - 'type': 'Filter', - 'metadata': { - 'changes': true - }, - 'params': [{ - 'name': 'expr', - 'type': 'expr', - 'required': true - }] -}; -var prototype$i = inherits(Filter, Transform); - -prototype$i.transform = function (_, pulse) { - var df = pulse.dataflow, - cache = this.value, - // cache ids of filtered tuples - output = pulse.fork(), - add = output.add, - rem = output.rem, - mod = output.mod, - test = _.expr, - isMod = true; - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - if (!cache.has(id)) rem.push(t);else cache.delete(id); - }); - pulse.visit(pulse.ADD, function (t) { - if (test(t, _)) add.push(t);else cache.set(tupleid(t), 1); - }); - - function revisit(t) { - var id = tupleid(t), - b = test(t, _), - s = cache.get(id); - - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) { - mod.push(t); - } - } - - pulse.visit(pulse.MOD, revisit); - - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; -}; -/** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ - - -function Flatten(params) { - Transform.call(this, [], params); -} - -Flatten.Definition = { - 'type': 'Flatten', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'index', - 'type': 'string' - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }] -}; -var prototype$j = inherits(Flatten, Transform); - -prototype$j.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - as = fieldNames(fields, _.as || []), - index = _.index || null, - m = as.length; // remove any previous results - - out.rem = this.value; // generate flattened tuples - - pulse.visit(pulse.SOURCE, function (t) { - var arrays = fields.map(function (f) { - return f(t); - }), - maxlen = arrays.reduce(function (l, a) { - return Math.max(l, a.length); - }, 0), - i = 0, - j, - d, - v; - - for (; i < maxlen; ++i) { - d = derive(t); - - for (j = 0; j < m; ++j) { - d[as[j]] = (v = arrays[j][i]) == null ? null : v; - } - - if (index) { - d[index] = i; - } - - out.add.push(d); - } - }); - this.value = out.source = out.add; - if (index) out.modifies(index); - return out.modifies(as); -}; -/** - * Folds one more tuple fields into multiple tuples in which the field - * name and values are available under new 'key' and 'value' fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.fields - An array of field accessors - * for the tuple fields that should be folded. - * @param {Array} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ - - -function Fold(params) { - Transform.call(this, [], params); -} - -Fold.Definition = { - 'type': 'Fold', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['key', 'value'] - }] -}; -var prototype$k = inherits(Fold, Transform); - -prototype$k.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - fnames = fields.map(accessorName), - as = _.as || ['key', 'value'], - k = as[0], - v = as[1], - n = fields.length; - out.rem = this.value; - pulse.visit(pulse.SOURCE, function (t) { - for (var i = 0, d; i < n; ++i) { - d = derive(t); - d[k] = fnames[i]; - d[v] = fields[i](t); - out.add.push(d); - } - }); - this.value = out.source = out.add; - return out.modifies(as); -}; -/** - * Invokes a function for each data tuple and saves the results as a new field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The formula function to invoke for each tuple. - * @param {string} params.as - The field name under which to save the result. - * @param {boolean} [params.initonly=false] - If true, the formula is applied to - * added tuples only, and does not update in response to modifications. - */ - - -function Formula(params) { - Transform.call(this, null, params); -} - -Formula.Definition = { - 'type': 'Formula', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'expr', - 'type': 'expr', - 'required': true - }, { - 'name': 'as', - 'type': 'string', - 'required': true - }, { - 'name': 'initonly', - 'type': 'boolean' - }] -}; -var prototype$l = inherits(Formula, Transform); - -prototype$l.transform = function (_, pulse) { - var func = _.expr, - as = _.as, - mod = _.modified(), - flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD; - - if (mod) { - // parameters updated, need to reflow - pulse = pulse.materialize().reflow(true); - } - - if (!_.initonly) { - pulse.modifies(as); - } - - return pulse.visit(flag, function (t) { - return t[as] = func(t, _); - }); -}; -/** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ - - -function Generate(params) { - Transform.call(this, [], params); -} - -var prototype$m = inherits(Generate, Transform); - -prototype$m.transform = function (_, pulse) { - var data = this.value, - out = pulse.fork(pulse.ALL), - num = _.size - data.length, - gen = _.generator, - add, - rem, - t; - - if (num > 0) { - // need more tuples, generate and add - for (add = []; --num >= 0;) { - add.push(t = ingest(gen(_))); - data.push(t); - } - - out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem; - data = data.slice(-num); - } - - out.source = this.value = data; - return out; -}; - -var Methods = { - value: 'value', - median: median, - mean: mean, - min: min, - max: max -}; -var Empty = []; -/** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ - -function Impute(params) { - Transform.call(this, [], params); -} - -Impute.Definition = { - 'type': 'Impute', - 'metadata': { - 'changes': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'key', - 'type': 'field', - 'required': true - }, { - 'name': 'keyvals', - 'array': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'method', - 'type': 'enum', - 'default': 'value', - 'values': ['value', 'mean', 'median', 'max', 'min'] - }, { - 'name': 'value', - 'default': 0 - }] -}; -var prototype$n = inherits(Impute, Transform); - -function getValue(_) { - var m = _.method || Methods.value, - v; - - if (Methods[m] == null) { - error('Unrecognized imputation method: ' + m); - } else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return function () { - return v; - }; - } else { - return Methods[m]; - } -} - -function getField(_) { - var f = _.field; - return function (t) { - return t ? f(t) : NaN; - }; -} - -prototype$n.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - impute = getValue(_), - field = getField(_), - fName = accessorName(_.field), - kName = accessorName(_.key), - gNames = (_.groupby || []).map(accessorName), - groups = partition$1(pulse.source, _.groupby, _.key, _.keyvals), - curr = [], - prev = this.value, - m = groups.domain.length, - group, - value, - gVals, - kVal, - g, - i, - j, - l, - n, - t; - - for (g = 0, l = groups.length; g < l; ++g) { - group = groups[g]; - gVals = group.values; - value = NaN; // add tuples for missing values - - for (j = 0; j < m; ++j) { - if (group[j] != null) continue; - kVal = groups.domain[j]; - t = { - _impute: true - }; - - for (i = 0, n = gVals.length; i < n; ++i) { - t[gNames[i]] = gVals[i]; - } - - t[kName] = kVal; - t[fName] = Number.isNaN(value) ? value = impute(group, field) : value; - curr.push(ingest(t)); - } - } // update pulse with imputed tuples - - - if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); - if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); - this.value = curr; - return out; -}; - -function partition$1(data, groupby, key, keyvals) { - var get = function get(f) { - return f(t); - }, - groups = [], - domain = keyvals ? keyvals.slice() : [], - kMap = {}, - gMap = {}, - gVals, - gKey, - group, - i, - j, - k, - n, - t; - - domain.forEach(function (k, i) { - kMap[k] = i + 1; - }); - - for (i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = key(t); - j = kMap[k] || (kMap[k] = domain.push(k)); - gKey = (gVals = groupby ? groupby.map(get) : Empty) + ''; - - if (!(group = gMap[gKey])) { - group = gMap[gKey] = []; - groups.push(group); - group.values = gVals; - } - - group[j - 1] = t; - } - - groups.domain = domain; - return groups; -} -/** - * Extend input tuples with aggregate values. - * Calcuates aggregate values and joins them with the input stream. - * @constructor - */ - - -function JoinAggregate(params) { - Aggregate.call(this, params); -} - -JoinAggregate.Definition = { - 'type': 'JoinAggregate', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, { - 'name': 'key', - 'type': 'field' - }] -}; -var prototype$o = inherits(JoinAggregate, Aggregate); - -prototype$o.transform = function (_, pulse) { - var aggr = this, - mod = _.modified(), - cells; // process all input tuples to calculate aggregates - - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - cells = aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, function (t) { - aggr.add(t); - }); - } else { - cells = aggr.value = aggr.value || this.init(_); - pulse.visit(pulse.REM, function (t) { - aggr.rem(t); - }); - pulse.visit(pulse.ADD, function (t) { - aggr.add(t); - }); - } // update aggregation cells - - - aggr.changes(); // write aggregate values to input tuples - - pulse.visit(pulse.SOURCE, function (t) { - extend(t, cells[aggr.cellkey(t)].tuple); - }); - return pulse.reflow(mod).modifies(this._outputs); -}; - -prototype$o.changes = function () { - var adds = this._adds, - mods = this._mods, - i, - n; - - for (i = 0, n = this._alen; i < n; ++i) { - this.celltuple(adds[i]); - adds[i] = null; // for garbage collection - } - - for (i = 0, n = this._mlen; i < n; ++i) { - this.celltuple(mods[i]); - mods[i] = null; // for garbage collection - } - - this._alen = this._mlen = 0; // reset list of active cells -}; -/** - * Compute kernel density estimates (KDE) for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - - -function KDE(params) { - Transform.call(this, null, params); -} - -KDE.Definition = { - 'type': 'KDE', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'cumulative', - 'type': 'boolean', - 'default': false - }, { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }, { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'resolve', - 'type': 'enum', - 'values': ['shared', 'independent'], - 'default': 'independent' - }, { - 'name': 'steps', - 'type': 'number' - }, { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': ['value', 'density'] - }] -}; -var prototype$p = inherits(KDE, Transform); - -prototype$p.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var _source = pulse.materialize(pulse.SOURCE).source, - groups = partition(_source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - _bandwidth = _.bandwidth, - _method = _.cumulative ? 'cdf' : 'pdf', - as = _.as || ['value', 'density'], - _values = []; - - var _domain = _.extent, - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200; - - if (_method !== 'pdf' && _method !== 'cdf') { - error('Invalid density method: ' + _method); - } - - if (_.resolve === 'shared') { - if (!_domain) _domain = extent(_source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - - groups.forEach(function (g) { - var density = randomKDE(g, _bandwidth)[_method], - scale = _.counts ? g.length : 1, - local = _domain || extent(g); - - sampleCurve(density, local, minsteps, maxsteps).forEach(function (v) { - var t = {}; - - for (var i = 0; i < names.length; ++i) { - t[names[i]] = g.dims[i]; - } - - t[as[0]] = v[0]; - t[as[1]] = v[1] * scale; - - _values.push(ingest(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = _values; - } - - return out; -}; -/** - * Generates a key function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ - - -function Key(params) { - Operator.call(this, null, update$4, params); -} - -inherits(Key, Operator); - -function update$4(_) { - return this.value && !_.modified() ? this.value : key(_.fields, _.flat); -} -/** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ - - -function Load(params) { - Transform.call(this, [], params); - this._pending = null; -} - -var prototype$q = inherits(Load, Transform); - -prototype$q.transform = function (_, pulse) { - var _this8 = this; - - var df = pulse.dataflow; - - if (this._pending) { - // update state and return pulse - return output$1(this, pulse, this._pending); - } - - if (stop(_)) return pulse.StopPropagation; - - if (_.values) { - // parse and ingest values, return output pulse - return output$1(this, pulse, df.parse(_.values, _.format)); - } else if (_.async) { - // return promise for non-blocking async loading - var p = df.request(_.url, _.format).then(function (res) { - _this8._pending = array(res.data); - return function (df) { - return df.touch(_this8); - }; - }); - return { - async: p - }; - } else { - // return promise for synchronous loading - return df.request(_.url, _.format).then(function (res) { - return output$1(_this8, pulse, array(res.data)); - }); - } -}; - -function stop(_) { - return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format')); -} - -function output$1(op, pulse, data) { - data.forEach(ingest); - var out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; -} -/** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ - - -function Lookup(params) { - Transform.call(this, {}, params); -} - -Lookup.Definition = { - 'type': 'Lookup', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'index', - 'type': 'index', - 'params': [{ - 'name': 'from', - 'type': 'data', - 'required': true - }, { - 'name': 'key', - 'type': 'field', - 'required': true - }] - }, { - 'name': 'values', - 'type': 'field', - 'array': true - }, { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }, { - 'name': 'default', - 'default': null - }] -}; -var prototype$r = inherits(Lookup, Transform); - -prototype$r.transform = function (_, pulse) { - var out = pulse, - as = _.as, - keys = _.fields, - index = _.index, - values = _.values, - defaultValue = _.default == null ? null : _.default, - reset = _.modified(), - flag = reset ? pulse.SOURCE : pulse.ADD, - n = keys.length, - set, - m, - mods; - - if (values) { - m = values.length; - - if (n > 1 && !as) { - error('Multi-field lookup requires explicit "as" parameter.'); - } - - if (as && as.length !== n * m) { - error('The "as" parameter has too few output field names.'); - } - - as = as || values.map(accessorName); - - set = function set(t) { - for (var i = 0, k = 0, j, v; i < n; ++i) { - v = index.get(keys[i](t)); - if (v == null) for (j = 0; j < m; ++j, ++k) { - t[as[k]] = defaultValue; - } else for (j = 0; j < m; ++j, ++k) { - t[as[k]] = values[j](v); - } - } - }; - } else { - if (!as) { - error('Missing output field names.'); - } - - set = function set(t) { - for (var i = 0, v; i < n; ++i) { - v = index.get(keys[i](t)); - t[as[i]] = v == null ? defaultValue : v; - } - }; - } - - if (reset) { - out = pulse.reflow(true); - } else { - mods = keys.some(function (k) { - return pulse.modified(k.fields); - }); - flag |= mods ? pulse.MOD : 0; - } - - pulse.visit(flag, set); - return out.modifies(as); -}; -/** - * Computes global min/max extents over a collection of extents. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.extents - The input extents. - */ - - -function MultiExtent(params) { - Operator.call(this, null, update$5, params); -} - -inherits(MultiExtent, Operator); - -function update$5(_) { - if (this.value && !_.modified()) { - return this.value; - } - - var min = +Infinity, - max = -Infinity, - ext = _.extents, - i, - n, - e; - - for (i = 0, n = ext.length; i < n; ++i) { - e = ext[i]; - if (e[0] < min) min = e[0]; - if (e[1] > max) max = e[1]; - } - - return [min, max]; -} -/** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.values - The input value arrrays. - */ - - -function MultiValues(params) { - Operator.call(this, null, update$6, params); -} - -inherits(MultiValues, Operator); - -function update$6(_) { - return this.value && !_.modified() ? this.value : _.values.reduce(function (data, _) { - return data.concat(_); - }, []); -} -/** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - -function Params(params) { - Transform.call(this, null, params); -} - -inherits(Params, Transform); - -Params.prototype.transform = function (_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples -}; -/** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ - - -function Pivot(params) { - Aggregate.call(this, params); -} - -Pivot.Definition = { - 'type': 'Pivot', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'value', - 'type': 'field', - 'required': true - }, { - 'name': 'op', - 'type': 'enum', - 'values': ValidAggregateOps, - 'default': 'sum' - }, { - 'name': 'limit', - 'type': 'number', - 'default': 0 - }, { - 'name': 'key', - 'type': 'field' - }] -}; -var prototype$s = inherits(Pivot, Aggregate); -prototype$s._transform = prototype$s.transform; - -prototype$s.transform = function (_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); -}; // Shoehorn a pivot transform into an aggregate transform! -// First collect all unique pivot field values. -// Then generate aggregate fields for each output pivot field. - - -function aggregateParams(_, pulse) { - var key = _.field, - value = _.value, - op = (_.op === 'count' ? '__count__' : _.op) || 'sum', - fields = accessorFields(key).concat(accessorFields(value)), - keys = pivotKeys(key, _.limit || 0, pulse); // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - - if (pulse.changed()) _.set('__pivot__', null, null, true); - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(function () { - return op; - }), - fields: keys.map(function (k) { - return get(k, key, value, fields); - }), - as: keys.map(function (k) { - return k + ''; - }), - modified: _.modified.bind(_) - }; -} // Generate aggregate field accessor. -// Output NaN for non-existent values; aggregator will ignore! - - -function get(k, key, value, fields) { - return accessor(function (d) { - return key(d) === k ? value(d) : NaN; - }, fields, k + ''); -} // Collect (and optionally limit) all unique pivot values. - - -function pivotKeys(key, limit, pulse) { - var map = {}, - list = []; - pulse.visit(pulse.SOURCE, function (t) { - var k = key(t); - - if (!map[k]) { - map[k] = 1; - list.push(k); - } - }); // TODO? Move this comparator to vega-util? - - list.sort(function (u, v) { - return (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; - }); - return limit ? list.slice(0, limit) : list; -} -/** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array} params.field - The field - * accessor for an array of subflow tuple objects. - */ - - -function PreFacet(params) { - Facet.call(this, params); -} - -var prototype$t = inherits(PreFacet, Facet); - -prototype$t.transform = function (_, pulse) { - var _this9 = this; - - var flow = _.subflow, - field = _.field, - subflow = function subflow(t) { - return _this9.subflow(tupleid(t), flow, pulse, t); - }; - - if (_.modified('field') || field && pulse.modified(accessorFields(field))) { - error('PreFacet does not support field modification.'); - } - - this.initTargets(); // reset list of active subflows - - if (field) { - pulse.visit(pulse.MOD, function (t) { - var sf = subflow(t); - field(t).forEach(function (_) { - return sf.mod(_); - }); - }); - pulse.visit(pulse.ADD, function (t) { - var sf = subflow(t); - field(t).forEach(function (_) { - return sf.add(ingest(_)); - }); - }); - pulse.visit(pulse.REM, function (t) { - var sf = subflow(t); - field(t).forEach(function (_) { - return sf.rem(_); - }); - }); - } else { - pulse.visit(pulse.MOD, function (t) { - return subflow(t).mod(t); - }); - pulse.visit(pulse.ADD, function (t) { - return subflow(t).add(t); - }); - pulse.visit(pulse.REM, function (t) { - return subflow(t).rem(t); - }); - } - - if (pulse.clean()) { - pulse.runAfter(function () { - return _this9.clean(); - }); - } - - return pulse; -}; -/** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ - - -function Project(params) { - Transform.call(this, null, params); -} - -Project.Definition = { - 'type': 'Project', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }] -}; -var prototype$u = inherits(Project, Transform); - -prototype$u.transform = function (_, pulse) { - var fields = _.fields, - as = fieldNames(_.fields, _.as || []), - derive = fields ? function (s, t) { - return project(s, t, fields, as); - } : rederive, - out, - lut; - - if (this.value) { - lut = this.value; - } else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, function (t) { - var dt = derive(t, ingest({})); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, function (t) { - out.mod.push(derive(t, lut[tupleid(t)])); - }); - return out; -}; - -function project(s, t, fields, as) { - for (var i = 0, n = fields.length; i < n; ++i) { - t[as[i]] = fields[i](s); - } - - return t; -} -/** - * Proxy the value of another operator as a pure signal value. - * Ensures no tuples are propagated. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {*} params.value - The value to proxy, becomes the value of this operator. - */ - - -function Proxy(params) { - Transform.call(this, null, params); -} - -var prototype$v = inherits(Proxy, Transform); - -prototype$v.transform = function (_, pulse) { - this.value = _.value; - return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; -}; -/** - * Generates sample quantile values from an input data stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the data field - * over which to calculate quantile values. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {Array} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ - - -function Quantile(params) { - Transform.call(this, null, params); -} - -Quantile.Definition = { - 'type': 'Quantile', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'probs', - 'type': 'number', - 'array': true - }, { - 'name': 'step', - 'type': 'number', - 'default': 0.01 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': ['prob', 'value'] - }] -}; -var prototype$w = inherits(Quantile, Transform); -var EPSILON$1 = 1e-14; - -prototype$w.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - as = _.as || ['prob', 'value']; - - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - - var source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - values = [], - step = _.step || 0.01, - p = _.probs || sequence(step / 2, 1 - EPSILON$1, step), - n = p.length; - groups.forEach(function (g) { - var q = quantiles(g, p); - - for (var i = 0; i < n; ++i) { - var t = {}; - - for (var _i4 = 0; _i4 < names.length; ++_i4) { - t[names[_i4]] = g.dims[_i4]; - } - - t[as[0]] = p[i]; - t[as[1]] = q[i]; - values.push(ingest(t)); - } - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - return out; -}; -/** - * Relays a data stream between data processing pipelines. - * If the derive parameter is set, this transform will create derived - * copies of observed tuples. This provides derived data streams in which - * modifications to the tuples do not pollute an upstream data source. - * @param {object} params - The parameters for this operator. - * @param {number} [params.derive=false] - Boolean flag indicating if - * the transform should make derived copies of incoming tuples. - * @constructor - */ - - -function Relay(params) { - Transform.call(this, null, params); -} - -var prototype$x = inherits(Relay, Transform); - -prototype$x.transform = function (_, pulse) { - var out, lut; - - if (this.value) { - lut = this.value; - } else { - out = pulse = pulse.addAll(); - lut = this.value = {}; - } - - if (_.derive) { - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, function (t) { - var dt = derive(t); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, function (t) { - var dt = lut[tupleid(t)], - k; - - for (k in t) { - dt[k] = t[k]; // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - - out.modifies(k); - } - - out.mod.push(dt); - }); - } - - return out; -}; -/** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ - - -function Sample(params) { - Transform.call(this, [], params); - this.count = 0; -} - -Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'default': 1000 - }] -}; -var prototype$y = inherits(Sample, Transform); - -prototype$y.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - mod = _.modified('size'), - num = _.size, - res = this.value, - cnt = this.count, - cap = 0, - map = res.reduce(function (m, t) { - m[tupleid(t)] = 1; - return m; - }, {}); // sample reservoir update function - - - function update(t) { - var p, idx; - - if (res.length < num) { - res.push(t); - } else { - idx = ~~((cnt + 1) * _random()); - - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[tupleid(p)]) out.rem.push(p); // eviction - - res[idx] = t; - } - } - - ++cnt; - } - - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - - --cnt; - }); // filter removed tuples out of the sample reservoir - - res = res.filter(function (t) { - return map[tupleid(t)] !== -1; - }); - } - - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, function (t) { - // update, but skip previously sampled tuples - if (!map[tupleid(t)]) update(t); - }); - cap = -1; - } - - if (mod && res.length > num) { - for (var i = 0, n = res.length - num; i < n; ++i) { - map[tupleid(res[i])] = -1; - out.rem.push(res[i]); - } - - res = res.slice(n); - } - - if (pulse.mod.length) { - // propagate modified tuples in the sample reservoir - pulse.visit(pulse.MOD, function (t) { - if (map[tupleid(t)]) out.mod.push(t); - }); - } - - if (pulse.add.length) { - // update sample reservoir - pulse.visit(pulse.ADD, update); - } - - if (pulse.add.length || cap < 0) { - // output newly added tuples - out.add = res.filter(function (t) { - return !map[tupleid(t)]; - }); - } - - this.count = cnt; - this.value = out.source = res; - return out; -}; -/** - * Generates data tuples for a specified sequence range of numbers. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} params.start - The first number in the sequence. - * @param {number} params.stop - The last number (exclusive) in the sequence. - * @param {number} [params.step=1] - The step size between numbers in the sequence. - */ - - -function Sequence(params) { - Transform.call(this, null, params); -} - -Sequence.Definition = { - 'type': 'Sequence', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'start', - 'type': 'number', - 'required': true - }, { - 'name': 'stop', - 'type': 'number', - 'required': true - }, { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, { - 'name': 'as', - 'type': 'string', - 'default': 'data' - }] -}; -var prototype$z = inherits(Sequence, Transform); - -prototype$z.transform = function (_, pulse) { - if (this.value && !_.modified()) return; - var out = pulse.materialize().fork(pulse.MOD), - as = _.as || 'data'; - out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem; - this.value = sequence(_.start, _.stop, _.step || 1).map(function (v) { - var t = {}; - t[as] = v; - return ingest(t); - }); - out.add = pulse.add.concat(this.value); - return out; -}; -/** - * Propagates a new pulse without any tuples so long as the input - * pulse contains some added, removed or modified tuples. - * @param {object} params - The parameters for this operator. - * @constructor - */ - - -function Sieve(params) { - Transform.call(this, null, params); - this.modified(true); // always treat as modified -} - -var prototype$A = inherits(Sieve, Transform); - -prototype$A.transform = function (_, pulse) { - this.value = pulse.source; - return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; -}; -/** - * Discretize dates to specific time units. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The data field containing date/time values. - */ - - -function TimeUnit(params) { - Transform.call(this, null, params); -} - -var OUTPUT = ['unit0', 'unit1']; -TimeUnit.Definition = { - 'type': 'TimeUnit', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, { - 'name': 'units', - 'type': 'enum', - 'values': TIME_UNITS, - 'array': true - }, { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, { - 'name': 'maxbins', - 'type': 'number', - 'default': 40 - }, { - 'name': 'extent', - 'type': 'date', - 'array': true - }, { - 'name': 'timezone', - 'type': 'enum', - 'default': 'local', - 'values': ['local', 'utc'] - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': OUTPUT - }] -}; -var prototype$B = inherits(TimeUnit, Transform); - -prototype$B.transform = function (_, pulse) { - var field = _.field, - band = _.interval !== false, - utc = _.timezone === 'utc', - floor = this._floor(_, pulse), - offset = (utc ? utcInterval : timeInterval)(floor.unit).offset, - as = _.as || OUTPUT, - u0 = as[0], - u1 = as[1], - min = floor.start || Infinity, - max = floor.stop || -Infinity, - step = floor.step, - flag = pulse.ADD; - - if (_.modified() || pulse.modified(accessorFields(field))) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - min = Infinity; - max = -Infinity; - } - - pulse.visit(flag, function (t) { - var v = field(t), - a, - b; - - if (v == null) { - t[u0] = null; - if (band) t[u1] = null; - } else { - t[u0] = a = b = floor(v); - if (band) t[u1] = b = offset(a, step); - if (a < min) min = a; - if (b > max) max = b; - } - }); - floor.start = min; - floor.stop = max; - return pulse.modifies(band ? as : u0); -}; - -prototype$B._floor = function (_, pulse) { - var utc = _.timezone === 'utc'; // get parameters - - var _ref2 = _.units ? { - units: _.units, - step: _.step || 1 - } : timeBin({ - extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }), - units = _ref2.units, - step = _ref2.step; // check / standardize time units - - - units = timeUnits(units); - var prev = this.value || {}, - floor = (utc ? utcFloor : timeFloor)(units, step); - floor.unit = peek(units); - floor.units = units; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; -}; -/** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ - - -function TupleIndex(params) { - Transform.call(this, fastmap(), params); -} - -var prototype$C = inherits(TupleIndex, Transform); - -prototype$C.transform = function (_, pulse) { - var df = pulse.dataflow, - field = _.field, - index = this.value, - mod = true; - - function set(t) { - index.set(field(t), t); - } - - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, function (t) { - index.delete(field(t)); - }); - pulse.visit(pulse.ADD, set); - } else { - mod = false; - } - - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); -}; -/** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ - - -function Values(params) { - Transform.call(this, null, params); -} - -var prototype$D = inherits(Values, Transform); - -prototype$D.transform = function (_, pulse) { - var run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields); - - if (run) { - this.value = (_.sort ? pulse.source.slice().sort(stableCompare(_.sort)) : pulse.source).map(_.field); - } -}; - -function WindowOp(op, field, param, as) { - var fn = WindowOps[op](field, param); - return { - init: fn.init || zero, - update: function update(w, t) { - t[as] = fn.next(w); - } - }; -} - -var WindowOps = { - row_number: function row_number() { - return { - next: function next(w) { - return w.index + 1; - } - }; - }, - rank: function rank() { - var rank; - return { - init: function init() { - return rank = 1; - }, - next: function next(w) { - var i = w.index, - data = w.data; - return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank; - } - }; - }, - dense_rank: function dense_rank() { - var drank; - return { - init: function init() { - return drank = 1; - }, - next: function next(w) { - var i = w.index, - d = w.data; - return i && w.compare(d[i - 1], d[i]) ? ++drank : drank; - } - }; - }, - percent_rank: function percent_rank() { - var rank = WindowOps.rank(), - _next2 = rank.next; - return { - init: rank.init, - next: function next(w) { - return (_next2(w) - 1) / (w.data.length - 1); - } - }; - }, - cume_dist: function cume_dist() { - var cume; - return { - init: function init() { - return cume = 0; - }, - next: function next(w) { - var i = w.index, - d = w.data, - c = w.compare; - - if (cume < i) { - while (i + 1 < d.length && !c(d[i], d[i + 1])) { - ++i; - } - - cume = i; - } - - return (1 + cume) / d.length; - } - }; - }, - ntile: function ntile(field, num) { - num = +num; - if (!(num > 0)) error('ntile num must be greater than zero.'); - var cume = WindowOps.cume_dist(), - _next3 = cume.next; - return { - init: cume.init, - next: function next(w) { - return Math.ceil(num * _next3(w)); - } - }; - }, - lag: function lag(field, offset) { - offset = +offset || 1; - return { - next: function next(w) { - var i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function lead(field, offset) { - offset = +offset || 1; - return { - next: function next(w) { - var i = w.index + offset, - d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - first_value: function first_value(field) { - return { - next: function next(w) { - return field(w.data[w.i0]); - } - }; - }, - last_value: function last_value(field) { - return { - next: function next(w) { - return field(w.data[w.i1 - 1]); - } - }; - }, - nth_value: function nth_value(field, nth) { - nth = +nth; - if (!(nth > 0)) error('nth_value nth must be greater than zero.'); - return { - next: function next(w) { - var i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - prev_value: function prev_value(field) { - var prev; - return { - init: function init() { - return prev = null; - }, - next: function next(w) { - var v = field(w.data[w.index]); - return v != null ? prev = v : prev; - } - }; - }, - next_value: function next_value(field) { - var v, i; - return { - init: function init() { - return v = null, i = -1; - }, - next: function next(w) { - var d = w.data; - return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]); - } - }; - } -}; - -function find(field, data, index) { - for (var n = data.length; index < n; ++index) { - var v = field(data[index]); - if (v != null) return index; - } - - return -1; -} - -var ValidWindowOps = Object.keys(WindowOps); - -function WindowState(_) { - var self = this, - ops = array(_.ops), - fields = array(_.fields), - params = array(_.params), - as = array(_.as), - outputs = self.outputs = [], - windows = self.windows = [], - inputs = {}, - map = {}, - countOnly = true, - counts = [], - measures = []; - - function visitInputs(f) { - array(accessorFields(f)).forEach(function (_) { - return inputs[_] = 1; - }); - } - - visitInputs(_.sort); - ops.forEach(function (op, i) { - var field = fields[i], - mname = accessorName(field), - name = measureName(op, mname, as[i]); - visitInputs(field); - outputs.push(name); // Window operation - - if (hasOwnProperty(WindowOps, op)) { - windows.push(WindowOp(op, fields[i], params[i], name)); - } // Aggregate operation - else { - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - - if (op === 'count') { - counts.push(name); - return; - } - - countOnly = false; - var m = map[mname]; - - if (!m) { - m = map[mname] = []; - m.field = field; - measures.push(m); - } - - m.push(createMeasure(op, name)); - } - }); - - if (counts.length || measures.length) { - self.cell = cell(measures, counts, countOnly); - } - - self.inputs = Object.keys(inputs); -} - -var prototype$E = WindowState.prototype; - -prototype$E.init = function () { - this.windows.forEach(function (_) { - return _.init(); - }); - if (this.cell) this.cell.init(); -}; - -prototype$E.update = function (w, t) { - var self = this, - cell = self.cell, - wind = self.windows, - data = w.data, - m = wind && wind.length, - j; - - if (cell) { - for (j = w.p0; j < w.i0; ++j) { - cell.rem(data[j]); - } - - for (j = w.p1; j < w.i1; ++j) { - cell.add(data[j]); - } - - cell.set(t); - } - - for (j = 0; j < m; ++j) { - wind[j].update(w, t); - } -}; - -function cell(measures, counts, countOnly) { - measures = measures.map(function (m) { - return compileMeasures(m, m.field); - }); - var cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - - if (!countOnly) { - var n = measures.length, - a = cell.agg = Array(n), - i = 0; - - for (; i < n; ++i) { - a[i] = new measures[i](cell); - } - } - - if (cell.store) { - var store = cell.data = new TupleStore(); - } - - cell.add = function (t) { - cell.num += 1; - if (countOnly) return; - if (store) store.add(t); - - for (var _i5 = 0; _i5 < n; ++_i5) { - a[_i5].add(a[_i5].get(t), t); - } - }; - - cell.rem = function (t) { - cell.num -= 1; - if (countOnly) return; - if (store) store.rem(t); - - for (var _i6 = 0; _i6 < n; ++_i6) { - a[_i6].rem(a[_i6].get(t), t); - } - }; - - cell.set = function (t) { - var i, n; // consolidate stored values - - if (store) store.values(); // update tuple properties - - for (i = 0, n = counts.length; i < n; ++i) { - t[counts[i]] = cell.num; - } - - if (!countOnly) for (i = 0, n = a.length; i < n; ++i) { - a[i].set(t); - } - }; - - cell.init = function () { - cell.num = 0; - if (store) store.reset(); - - for (var _i7 = 0; _i7 < n; ++_i7) { - a[_i7].init(); - } - }; - - return cell; -} -/** - * Perform window calculations and write results to the input stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window. - * @param {Array} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array} params.ops - An array of strings indicating window operations to perform. - * @param {Array} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array} [params.as] - An array of output field names for window operations. - * @param {Array} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ - - -function Window(params) { - Transform.call(this, {}, params); - this._mlen = 0; - this._mods = []; -} - -Window.Definition = { - 'type': 'Window', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidWindowOps.concat(ValidAggregateOps) - }, { - 'name': 'params', - 'type': 'number', - 'null': true, - 'array': true - }, { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, { - 'name': 'frame', - 'type': 'number', - 'null': true, - 'array': true, - 'length': 2, - 'default': [null, 0] - }, { - 'name': 'ignorePeers', - 'type': 'boolean', - 'default': false - }] -}; -var prototype$F = inherits(Window, Transform); - -prototype$F.transform = function (_, pulse) { - var self = this, - state = self.state, - mod = _.modified(), - cmp = stableCompare(_.sort), - i, - n; - - this.stamp = pulse.stamp; // initialize window state - - if (!state || mod) { - state = self.state = new WindowState(_); - } // retrieve group for a tuple - - - var key = groupkey(_.groupby); - - function group(t) { - return self.group(key(t)); - } // partition input tuples - - - if (mod || pulse.modified(state.inputs)) { - self.value = {}; - pulse.visit(pulse.SOURCE, function (t) { - group(t).add(t); - }); - } else { - pulse.visit(pulse.REM, function (t) { - group(t).remove(t); - }); - pulse.visit(pulse.ADD, function (t) { - group(t).add(t); - }); - } // perform window calculations for each modified partition - - - for (i = 0, n = self._mlen; i < n; ++i) { - processPartition(self._mods[i], state, cmp, _); - } - - self._mlen = 0; - self._mods = []; // TODO don't reflow everything? - - return pulse.reflow(mod).modifies(state.outputs); -}; - -prototype$F.group = function (key) { - var self = this, - group = self.value[key]; - - if (!group) { - group = self.value[key] = SortedList(tupleid); - group.stamp = -1; - } - - if (group.stamp < self.stamp) { - group.stamp = self.stamp; - self._mods[self._mlen++] = group; - } - - return group; -}; - -function processPartition(list, state, cmp, _) { - var sort = _.sort, - range = sort && !_.ignorePeers, - frame = _.frame || [null, 0], - data = list.data(cmp), - // use cmp for stable sort - n = data.length, - i = 0, - b = range ? bisector(sort) : null, - w = { - i0: 0, - i1: 0, - p0: 0, - p1: 0, - index: 0, - data: data, - compare: sort || constant(-1) - }; - - for (state.init(); i < n; ++i) { - setWindow(w, frame, i, n); - if (range) adjustRange(w, b); - state.update(w, data[i]); - } -} - -function setWindow(w, f, i, n) { - w.p0 = w.i0; - w.p1 = w.i1; - w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); - w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); - w.index = i; -} // if frame type is 'range', adjust window for peer values - - -function adjustRange(w, bisect) { - var r0 = w.i0, - r1 = w.i1 - 1, - c = w.compare, - d = w.data, - n = d.length - 1; - if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]); -} - -var tx = /*#__PURE__*/Object.freeze({ - __proto__: null, - aggregate: Aggregate, - bin: Bin, - collect: Collect, - compare: Compare, - countpattern: CountPattern, - cross: Cross, - density: Density, - dotbin: DotBin, - expression: Expression, - extent: Extent, - facet: Facet, - field: Field, - filter: Filter, - flatten: Flatten, - fold: Fold, - formula: Formula, - generate: Generate, - impute: Impute, - joinaggregate: JoinAggregate, - kde: KDE, - key: Key, - load: Load, - lookup: Lookup, - multiextent: MultiExtent, - multivalues: MultiValues, - params: Params, - pivot: Pivot, - prefacet: PreFacet, - project: Project, - proxy: Proxy, - quantile: Quantile, - relay: Relay, - sample: Sample, - sequence: Sequence, - sieve: Sieve, - subflow: Subflow, - timeunit: TimeUnit, - tupleindex: TupleIndex, - values: Values, - window: Window -}); -var Top = 'top'; -var Left = 'left'; -var Right = 'right'; -var Bottom = 'bottom'; -var TopLeft = 'top-left'; -var TopRight = 'top-right'; -var BottomLeft = 'bottom-left'; -var BottomRight = 'bottom-right'; -var Start = 'start'; -var Middle = 'middle'; -var End = 'end'; -var X = 'x'; -var Y = 'y'; -var Group = 'group'; -var AxisRole = 'axis'; -var TitleRole = 'title'; -var FrameRole = 'frame'; -var ScopeRole = 'scope'; -var LegendRole = 'legend'; -var RowHeader = 'row-header'; -var RowFooter = 'row-footer'; -var RowTitle = 'row-title'; -var ColHeader = 'column-header'; -var ColFooter = 'column-footer'; -var ColTitle = 'column-title'; -var Padding = 'padding'; -var Symbols = 'symbol'; -var Fit = 'fit'; -var FitX = 'fit-x'; -var FitY = 'fit-y'; -var Pad = 'pad'; -var None$1 = 'none'; -var All = 'all'; -var Each = 'each'; -var Flush = 'flush'; -var Column = 'column'; -var Row = 'row'; -var gradient_id = 0; - -function resetSVGGradientId() { - gradient_id = 0; -} - -var patternPrefix = 'p_'; - -function isGradient(value) { - return value && value.gradient; -} - -function gradientRef(g, defs, base) { - var id = g.id, - type = g.gradient, - prefix = type === 'radial' ? patternPrefix : ''; // check id, assign default values as needed - - if (!id) { - id = g.id = 'gradient_' + gradient_id++; - - if (type === 'radial') { - g.x1 = get$1(g.x1, 0.5); - g.y1 = get$1(g.y1, 0.5); - g.r1 = get$1(g.r1, 0); - g.x2 = get$1(g.x2, 0.5); - g.y2 = get$1(g.y2, 0.5); - g.r2 = get$1(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get$1(g.x1, 0); - g.y1 = get$1(g.y1, 0); - g.x2 = get$1(g.x2, 1); - g.y2 = get$1(g.y2, 0); - } - } // register definition - - - defs[id] = g; // return url reference - - return 'url(' + (base || '') + '#' + prefix + id + ')'; -} - -function get$1(val, def) { - return val != null ? val : def; -} - -function Gradient(p0, p1) { - var stops = [], - gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function stop(offset, color) { - stops.push({ - offset: offset, - color: color - }); - return gradient; - } - }; -} - -var lookup = { - 'basis': { - curve: _d3Shape.curveBasis - }, - 'basis-closed': { - curve: _d3Shape.curveBasisClosed - }, - 'basis-open': { - curve: _d3Shape.curveBasisOpen - }, - 'bundle': { - curve: _d3Shape.curveBundle, - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: _d3Shape.curveCardinal, - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: _d3Shape.curveCardinalOpen, - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: _d3Shape.curveCardinalClosed, - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: _d3Shape.curveCatmullRom, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: _d3Shape.curveCatmullRomClosed, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: _d3Shape.curveCatmullRomOpen, - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: _d3Shape.curveLinear - }, - 'linear-closed': { - curve: _d3Shape.curveLinearClosed - }, - 'monotone': { - horizontal: _d3Shape.curveMonotoneY, - vertical: _d3Shape.curveMonotoneX - }, - 'natural': { - curve: _d3Shape.curveNatural - }, - 'step': { - curve: _d3Shape.curveStep - }, - 'step-after': { - curve: _d3Shape.curveStepAfter - }, - 'step-before': { - curve: _d3Shape.curveStepBefore - } -}; - -function curves(type, orientation, tension) { - var entry = hasOwnProperty(lookup, type) && lookup[type], - curve = null; - - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - - if (entry.tension && tension != null) { - curve = curve[entry.tension](tension); - } - } - - return curve; -} // Path parsing and rendering code adapted from fabric.js -- Thanks! - - -var cmdlen = { - m: 2, - l: 2, - h: 1, - v: 1, - c: 6, - s: 4, - q: 4, - t: 2, - a: 7 -}, - regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\d)([-+])/g, /\s|,|###/]; - -function pathParse(pathstr) { - var result = [], - path, - curr, - chunks, - parsed, - param, - cmd, - len, - i, - j, - n, - m; // First, break path into command sequence - - path = pathstr.slice().replace(regexp[0], '###$1').split(regexp[1]).slice(1); // Next, parse each command in turn - - for (i = 0, n = path.length; i < n; ++i) { - curr = path[i]; - chunks = curr.slice(1).trim().replace(regexp[2], '$1###$2').split(regexp[3]); - cmd = curr.charAt(0); - parsed = [cmd]; - - for (j = 0, m = chunks.length; j < m; ++j) { - if ((param = +chunks[j]) === param) { - // not NaN - parsed.push(param); - } - } - - len = cmdlen[cmd.toLowerCase()]; - - if (parsed.length - 1 > len) { - for (j = 1, m = parsed.length; j < m; j += len) { - result.push([cmd].concat(parsed.slice(j, j + len))); - } - } else { - result.push(parsed); - } - } - - return result; -} - -var DegToRad = Math.PI / 180; -var Epsilon = 1e-14; -var HalfPi = Math.PI / 2; -var Tau = Math.PI * 2; -var HalfSqrt3 = Math.sqrt(3) / 2; -var segmentCache = {}; -var bezierCache = {}; -var join = [].join; // Copied from Inkscape svgtopdf, thanks! - -function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) { - var key = join.call(arguments); - - if (segmentCache[key]) { - return segmentCache[key]; - } - - var th = rotateX * DegToRad; - var sin_th = Math.sin(th); - var cos_th = Math.cos(th); - rx = Math.abs(rx); - ry = Math.abs(ry); - var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5; - var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5; - var pl = px * px / (rx * rx) + py * py / (ry * ry); - - if (pl > 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - - var a00 = cos_th / rx; - var a01 = sin_th / rx; - var a10 = -sin_th / ry; - var a11 = cos_th / ry; - var x0 = a00 * ox + a01 * oy; - var y0 = a10 * ox + a11 * oy; - var x1 = a00 * x + a01 * y; - var y1 = a10 * x + a11 * y; - var d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - var sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - var sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - var xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); - var yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); - var th0 = Math.atan2(y0 - yc, x0 - xc); - var th1 = Math.atan2(y1 - yc, x1 - xc); - var th_arc = th1 - th0; - - if (th_arc < 0 && sweep === 1) { - th_arc += Tau; - } else if (th_arc > 0 && sweep === 0) { - th_arc -= Tau; - } - - var segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - var result = []; - - for (var i = 0; i < segs; ++i) { - var th2 = th0 + i * th_arc / segs; - var th3 = th0 + (i + 1) * th_arc / segs; - result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th]; - } - - return segmentCache[key] = result; -} - -function bezier(params) { - var key = join.call(params); - - if (bezierCache[key]) { - return bezierCache[key]; - } - - var cx = params[0], - cy = params[1], - th0 = params[2], - th1 = params[3], - rx = params[4], - ry = params[5], - sin_th = params[6], - cos_th = params[7]; - var a00 = cos_th * rx; - var a01 = -sin_th * ry; - var a10 = sin_th * rx; - var a11 = cos_th * ry; - var cos_th0 = Math.cos(th0); - var sin_th0 = Math.sin(th0); - var cos_th1 = Math.cos(th1); - var sin_th1 = Math.sin(th1); - var th_half = 0.5 * (th1 - th0); - var sin_th_h2 = Math.sin(th_half * 0.5); - var t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); - var x1 = cx + cos_th0 - t * sin_th0; - var y1 = cy + sin_th0 + t * cos_th0; - var x3 = cx + cos_th1; - var y3 = cy + sin_th1; - var x2 = x3 + t * sin_th1; - var y2 = y3 - t * cos_th1; - return bezierCache[key] = [a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3]; -} - -var temp = ['l', 0, 0, 0, 0, 0, 0, 0]; - -function scale(current, sX, sY) { - var c = temp[0] = current[0]; - - if (c === 'a' || c === 'A') { - temp[1] = sX * current[1]; - temp[2] = sY * current[2]; - temp[3] = current[3]; - temp[4] = current[4]; - temp[5] = current[5]; - temp[6] = sX * current[6]; - temp[7] = sY * current[7]; - } else if (c === 'h' || c === 'H') { - temp[1] = sX * current[1]; - } else if (c === 'v' || c === 'V') { - temp[1] = sY * current[1]; - } else { - for (var i = 1, n = current.length; i < n; ++i) { - temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; - } - } - - return temp; -} - -function pathRender(context, path, l, t, sX, sY) { - var current, - // current instruction - previous = null, - x = 0, - // current x - y = 0, - // current y - controlX = 0, - // current control point x - controlY = 0, - // current control point y - tempX, - tempY, - tempControlX, - tempControlY; - if (l == null) l = 0; - if (t == null) t = 0; - if (sX == null) sX = 1; - if (sY == null) sY = sX; - if (context.beginPath) context.beginPath(); - - for (var i = 0, len = path.length; i < len; ++i) { - current = path[i]; - - if (sX !== 1 || sY !== 1) { - current = scale(current, sX, sY); - } - - switch (current[0]) { - // first letter - case 'l': - // lineto, relative - x += current[1]; - y += current[2]; - context.lineTo(x + l, y + t); - break; - - case 'L': - // lineto, absolute - x = current[1]; - y = current[2]; - context.lineTo(x + l, y + t); - break; - - case 'h': - // horizontal lineto, relative - x += current[1]; - context.lineTo(x + l, y + t); - break; - - case 'H': - // horizontal lineto, absolute - x = current[1]; - context.lineTo(x + l, y + t); - break; - - case 'v': - // vertical lineto, relative - y += current[1]; - context.lineTo(x + l, y + t); - break; - - case 'V': - // verical lineto, absolute - y = current[1]; - context.lineTo(x + l, y + t); - break; - - case 'm': - // moveTo, relative - x += current[1]; - y += current[2]; - context.moveTo(x + l, y + t); - break; - - case 'M': - // moveTo, absolute - x = current[1]; - y = current[2]; - context.moveTo(x + l, y + t); - break; - - case 'c': - // bezierCurveTo, relative - tempX = x + current[5]; - tempY = y + current[6]; - controlX = x + current[3]; - controlY = y + current[4]; - context.bezierCurveTo(x + current[1] + l, // x1 - y + current[2] + t, // y1 - controlX + l, // x2 - controlY + t, // y2 - tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - - case 'C': - // bezierCurveTo, absolute - x = current[5]; - y = current[6]; - controlX = current[3]; - controlY = current[4]; - context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t); - break; - - case 's': - // shorthand cubic bezierCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; // calculate reflection of previous control points - - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t); // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - - controlX = x + current[1]; - controlY = y + current[2]; - x = tempX; - y = tempY; - break; - - case 'S': - // shorthand cubic bezierCurveTo, absolute - tempX = current[3]; - tempY = current[4]; // calculate reflection of previous control points - - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - - controlX = current[1]; - controlY = current[2]; - break; - - case 'q': - // quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - controlX = x + current[1]; - controlY = y + current[2]; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - - case 'Q': - // quadraticCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = current[1]; - controlY = current[2]; - break; - - case 't': - // shorthand quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[1]; - tempY = y + current[2]; - - if (previous[0].match(/[QqTt]/) === null) { - // If there is no previous command or if the previous command was not a Q, q, T or t, - // assume the control point is coincident with the current point - controlX = x; - controlY = y; - } else if (previous[0] === 't') { - // calculate reflection of previous control points for t - controlX = 2 * x - tempControlX; - controlY = 2 * y - tempControlY; - } else if (previous[0] === 'q') { - // calculate reflection of previous control points for q - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - } - - tempControlX = controlX; - tempControlY = controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = x + current[1]; - controlY = y + current[2]; - break; - - case 'T': - tempX = current[1]; - tempY = current[2]; // calculate reflection of previous control points - - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - - case 'a': - drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x + l, current[7] + y + t]); - x += current[6]; - y += current[7]; - break; - - case 'A': - drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]); - x = current[6]; - y = current[7]; - break; - - case 'z': - case 'Z': - context.closePath(); - break; - } - - previous = current; - } -} - -function drawArc(context, x, y, coords) { - var seg = segments(coords[5], // end x - coords[6], // end y - coords[0], // radius x - coords[1], // radius y - coords[3], // large flag - coords[4], // sweep flag - coords[2], // rotation - x, y); - - for (var i = 0; i < seg.length; ++i) { - var bez = bezier(seg[i]); - context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); - } -} - -var Tan30 = 0.5773502691896257; -var builtins = { - 'circle': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(r, 0); - context.arc(0, 0, r, 0, Tau); - } - }, - 'cross': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - s = r / 2.5; - context.moveTo(-r, -s); - context.lineTo(-r, s); - context.lineTo(-s, s); - context.lineTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, s); - context.lineTo(r, s); - context.lineTo(r, -s); - context.lineTo(s, -s); - context.lineTo(s, -r); - context.lineTo(-s, -r); - context.lineTo(-s, -s); - context.closePath(); - } - }, - 'diamond': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.closePath(); - } - }, - 'square': { - draw: function draw(context, size) { - var w = Math.sqrt(size), - x = -w / 2; - context.rect(x, x, w, w); - } - }, - 'arrow': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - s = r / 7, - t = r / 2.5, - v = r / 8; - context.moveTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, -v); - context.lineTo(t, -v); - context.lineTo(0, -r); - context.lineTo(-t, -v); - context.lineTo(-s, -v); - context.closePath(); - } - }, - 'wedge': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r, - o = h - r * Tan30, - b = r / 4; - context.moveTo(0, -h - o); - context.lineTo(-b, h - o); - context.lineTo(b, h - o); - context.closePath(); - } - }, - 'triangle': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r, - o = h - r * Tan30; - context.moveTo(0, -h - o); - context.lineTo(-r, h - o); - context.lineTo(r, h - o); - context.closePath(); - } - }, - 'triangle-up': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(0, -h); - context.lineTo(-r, h); - context.lineTo(r, h); - context.closePath(); - } - }, - 'triangle-down': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(0, h); - context.lineTo(-r, -h); - context.lineTo(r, -h); - context.closePath(); - } - }, - 'triangle-right': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(h, 0); - context.lineTo(-h, -r); - context.lineTo(-h, r); - context.closePath(); - } - }, - 'triangle-left': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(-h, 0); - context.lineTo(h, -r); - context.lineTo(h, r); - context.closePath(); - } - }, - 'stroke': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(r, 0); - } - } -}; - -function symbols(_) { - return hasOwnProperty(builtins, _) ? builtins[_] : customSymbol(_); -} - -var custom = {}; - -function customSymbol(path) { - if (!hasOwnProperty(custom, path)) { - var parsed = pathParse(path); - custom[path] = { - draw: function draw(context, size) { - pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2); - } - }; - } - - return custom[path]; -} // See http://spencermortensen.com/articles/bezier-circle/ - - -var C = 0.448084975506; // C = 1 - c - -function rectangleX(d) { - return d.x; -} - -function rectangleY(d) { - return d.y; -} - -function rectangleWidth(d) { - return d.width; -} - -function rectangleHeight(d) { - return d.height; -} - -function number$1(_) { - return typeof _ === 'function' ? _ : function () { - return +_; - }; -} - -function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); -} - -function vg_rect() { - var x = rectangleX, - y = rectangleY, - width = rectangleWidth, - height = rectangleHeight, - crTL = number$1(0), - crTR = crTL, - crBL = crTL, - crBR = crTL, - context = null; - - function rectangle(_, x0, y0) { - var buffer, - x1 = x0 != null ? x0 : +x.call(this, _), - y1 = y0 != null ? y0 : +y.call(this, _), - w = +width.call(this, _), - h = +height.call(this, _), - s = Math.min(w, h) / 2, - tl = clamp(+crTL.call(this, _), 0, s), - tr = clamp(+crTR.call(this, _), 0, s), - bl = clamp(+crBL.call(this, _), 0, s), - br = clamp(+crBR.call(this, _), 0, s); - if (!context) context = buffer = (0, _d3Path.path)(); - - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) { - context.rect(x1, y1, w, h); - } else { - var x2 = x1 + w, - y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - rectangle.x = function (_) { - if (arguments.length) { - x = number$1(_); - return rectangle; - } else { - return x; - } - }; - - rectangle.y = function (_) { - if (arguments.length) { - y = number$1(_); - return rectangle; - } else { - return y; - } - }; - - rectangle.width = function (_) { - if (arguments.length) { - width = number$1(_); - return rectangle; - } else { - return width; - } - }; - - rectangle.height = function (_) { - if (arguments.length) { - height = number$1(_); - return rectangle; - } else { - return height; - } - }; - - rectangle.cornerRadius = function (tl, tr, br, bl) { - if (arguments.length) { - crTL = number$1(tl); - crTR = tr != null ? number$1(tr) : crTL; - crBR = br != null ? number$1(br) : crTL; - crBL = bl != null ? number$1(bl) : crTR; - return rectangle; - } else { - return crTL; - } - }; - - rectangle.context = function (_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else { - return context; - } - }; - - return rectangle; -} - -function vg_trail() { - var x, - y, - size, - defined, - context = null, - ready, - x1, - y1, - r1; - - function point(x2, y2, w2) { - var r2 = w2 / 2; - - if (ready) { - var ux = y1 - y2, - uy = x2 - x1; - - if (ux || uy) { - // get normal vector - var ud = Math.sqrt(ux * ux + uy * uy), - rx = (ux /= ud) * r1, - ry = (uy /= ud) * r1, - t = Math.atan2(uy, ux); // draw segment - - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else { - context.arc(x2, y2, r2, 0, Tau); - } - - context.closePath(); - } else { - ready = 1; - } - - x1 = x2; - y1 = y2; - r1 = r2; - } - - function trail(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - if (context == null) context = buffer = (0, _d3Path.path)(); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - trail.x = function (_) { - if (arguments.length) { - x = _; - return trail; - } else { - return x; - } - }; - - trail.y = function (_) { - if (arguments.length) { - y = _; - return trail; - } else { - return y; - } - }; - - trail.size = function (_) { - if (arguments.length) { - size = _; - return trail; - } else { - return size; - } - }; - - trail.defined = function (_) { - if (arguments.length) { - defined = _; - return trail; - } else { - return defined; - } - }; - - trail.context = function (_) { - if (arguments.length) { - if (_ == null) { - context = null; - } else { - context = _; - } - - return trail; - } else { - return context; - } - }; - - return trail; -} - -function value(a, b) { - return a != null ? a : b; -} - -var x = function x(item) { - return item.x || 0; -}, - y = function y(item) { - return item.y || 0; -}, - w = function w(item) { - return item.width || 0; -}, - h = function h(item) { - return item.height || 0; -}, - xw = function xw(item) { - return (item.x || 0) + (item.width || 0); -}, - yh = function yh(item) { - return (item.y || 0) + (item.height || 0); -}, - sa = function sa(item) { - return item.startAngle || 0; -}, - ea = function ea(item) { - return item.endAngle || 0; -}, - pa = function pa(item) { - return item.padAngle || 0; -}, - ir = function ir(item) { - return item.innerRadius || 0; -}, - or = function or(item) { - return item.outerRadius || 0; -}, - cr = function cr(item) { - return item.cornerRadius || 0; -}, - tl = function tl(item) { - return value(item.cornerRadiusTopLeft, item.cornerRadius) || 0; -}, - tr = function tr(item) { - return value(item.cornerRadiusTopRight, item.cornerRadius) || 0; -}, - br = function br(item) { - return value(item.cornerRadiusBottomRight, item.cornerRadius) || 0; -}, - bl = function bl(item) { - return value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0; -}, - sz = function sz(item) { - return value(item.size, 64); -}, - ts = function ts(item) { - return item.size || 1; -}, - def = function def(item) { - return !(item.defined === false); -}, - type = function type(item) { - return symbols(item.shape || 'circle'); -}; - -var arcShape = (0, _d3Shape.arc)().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), - areavShape = (0, _d3Shape.area)().x(x).y1(y).y0(yh).defined(def), - areahShape = (0, _d3Shape.area)().y(y).x1(x).x0(xw).defined(def), - lineShape = (0, _d3Shape.line)().x(x).y(y).defined(def), - rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(tl, tr, br, bl), - symbolShape = (0, _d3Shape.symbol)().type(type).size(sz), - trailShape = vg_trail().x(x).y(y).defined(def).size(ts); - -function hasCornerRadius(item) { - return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; -} - -function arc(context, item) { - return arcShape.context(context)(item); -} - -function area(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items); -} - -function line(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items); -} - -function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); -} - -function shape(context, item) { - return (item.mark.shape || item.shape).context(context)(item); -} - -function symbol(context, item) { - return symbolShape.context(context)(item); -} - -function trail(context, items) { - return trailShape.context(context)(items); -} - -var clip_id = 1; - -function resetSVGClipId() { - clip_id = 1; -} - -function clip(renderer, item, size) { - var clip = item.clip, - defs = renderer._defs, - id = item.clip_id || (item.clip_id = 'clip' + clip_id++), - c = defs.clipping[id] || (defs.clipping[id] = { - id: id - }); - - if (isFunction(clip)) { - c.path = clip(null); - } else if (hasCornerRadius(size)) { - c.path = rectangle(null, size, 0, 0); - } else { - c.width = size.width || 0; - c.height = size.height || 0; - } - - return 'url(#' + id + ')'; -} - -function Bounds(b) { - this.clear(); - if (b) this.union(b); -} - -var prototype$G = Bounds.prototype; - -prototype$G.clone = function () { - return new Bounds(this); -}; - -prototype$G.clear = function () { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; -}; - -prototype$G.empty = function () { - return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; -}; - -prototype$G.equals = function (b) { - return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2; -}; - -prototype$G.set = function (x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; - } - - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; - } - - return this; -}; - -prototype$G.add = function (x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; -}; - -prototype$G.expand = function (d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; -}; - -prototype$G.round = function () { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; -}; - -prototype$G.scale = function (s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; -}; - -prototype$G.translate = function (dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; -}; - -prototype$G.rotate = function (angle, x, y) { - var p = this.rotatedPoints(angle, x, y); - return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); -}; - -prototype$G.rotatedPoints = function (angle, x, y) { - var x1 = this.x1, - y1 = this.y1, - x2 = this.x2, - y2 = this.y2, - cos = Math.cos(angle), - sin = Math.sin(angle), - cx = x - x * cos + y * sin, - cy = y - x * sin - y * cos; - return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy]; -}; - -prototype$G.union = function (b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; -}; - -prototype$G.intersect = function (b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; -}; - -prototype$G.encloses = function (b) { - return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2; -}; - -prototype$G.alignsWith = function (b) { - return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2); -}; - -prototype$G.intersects = function (b) { - return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2); -}; - -prototype$G.contains = function (x, y) { - return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2); -}; - -prototype$G.width = function () { - return this.x2 - this.x1; -}; - -prototype$G.height = function () { - return this.y2 - this.y1; -}; - -function Item(mark) { - this.mark = mark; - this.bounds = this.bounds || new Bounds(); -} - -function GroupItem(mark) { - Item.call(this, mark); - this.items = this.items || []; -} - -inherits(GroupItem, Item); - -function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - var c = document.createElement('canvas'); - - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } - } - - return null; -} - -function domImage() { - return typeof Image !== 'undefined' ? Image : null; -} - -function ResourceLoader(customLoader) { - this._pending = 0; - this._loader = customLoader || loader(); -} - -var prototype$H = ResourceLoader.prototype; - -prototype$H.pending = function () { - return this._pending; -}; - -function increment(loader) { - loader._pending += 1; -} - -function decrement(loader) { - loader._pending -= 1; -} - -prototype$H.sanitizeURL = function (uri) { - var loader = this; - increment(loader); - return loader._loader.sanitize(uri, { - context: 'href' - }).then(function (opt) { - decrement(loader); - return opt; - }).catch(function () { - decrement(loader); - return null; - }); -}; - -prototype$H.loadImage = function (uri) { - var loader = this, - Image = domImage(); - increment(loader); - return loader._loader.sanitize(uri, { - context: 'image' - }).then(function (opt) { - var url = opt.href; - if (!url || !Image) throw { - url: url - }; - var img = new Image(); // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - - var cors = hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; // attempt to load image resource - - img.onload = function () { - return decrement(loader); - }; - - img.onerror = function () { - return decrement(loader); - }; - - img.src = url; - return img; - }).catch(function (e) { - decrement(loader); - return { - complete: false, - width: 0, - height: 0, - src: e && e.url || '' - }; - }); -}; - -prototype$H.ready = function () { - var loader = this; - return new Promise(function (accept) { - function poll(value) { - if (!loader.pending()) accept(value);else setTimeout(function () { - poll(true); - }, 10); - } - - poll(false); - }); -}; - -function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - var sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - - return bounds; -} - -function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; -} - -var bounds, - lx, - ly, - circleThreshold = Tau - 1e-8; - -function context(_) { - bounds = _; - return context; -} - -function noop$1() {} - -function add$2(x, y) { - bounds.add(x, y); -} - -function addL(x, y) { - add$2(lx = x, ly = y); -} - -function addX(x) { - add$2(x, bounds.y1); -} - -function addY(y) { - add$2(bounds.x1, y); -} - -context.beginPath = noop$1; -context.closePath = noop$1; -context.moveTo = addL; -context.lineTo = addL; - -context.rect = function (x, y, w, h) { - add$2(x + w, y + h); - addL(x, y); -}; - -context.quadraticCurveTo = function (x1, y1, x2, y2) { - quadExtrema(lx, x1, x2, addX); - quadExtrema(ly, y1, y2, addY); - addL(x2, y2); -}; - -function quadExtrema(x0, x1, x2, cb) { - var t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); -} - -context.bezierCurveTo = function (x1, y1, x2, y2, x3, y3) { - cubicExtrema(lx, x1, x2, x3, addX); - cubicExtrema(ly, y1, y2, y3, addY); - addL(x3, y3); -}; - -function cubicExtrema(x0, x1, x2, x3, cb) { - var a = x3 - x0 + 3 * x1 - 3 * x2, - b = x0 + x2 - 2 * x1, - c = x0 - x1; - var t0 = 0, - t1 = 0, - r; // solve for parameter t - - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else { - // linear equation - t0 = 0.5 * c / b; - } // calculate position - - - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); -} - -function cubic(t, x0, x1, x2, x3) { - var s = 1 - t, - s2 = s * s, - t2 = t * t; - return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3; -} - -context.arc = function (cx, cy, r, sa, ea, ccw) { - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add$2(cx - r, cy - r); - add$2(cx + r, cy + r); - } else { - var _update = function _update(a) { - return add$2(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - }; - - var s, i; // sample end points - - _update(sa); - - _update(ea); // sample interior points aligned with 90 degrees - - - if (ea !== sa) { - sa = sa % Tau; - if (sa < 0) sa += Tau; - ea = ea % Tau; - if (ea < 0) ea += Tau; - - if (ea < sa) { - ccw = !ccw; // flip direction - - s = sa; - sa = ea; - ea = s; // swap end-points - } - - if (ccw) { - ea -= Tau; - s = sa - sa % HalfPi; - - for (i = 0; i < 4 && s > ea; ++i, s -= HalfPi) { - _update(s); - } - } else { - s = sa - sa % HalfPi + HalfPi; - - for (i = 0; i < 4 && s < ea; ++i, s = s + HalfPi) { - _update(s); - } - } - } - } -}; - -var context$1 = (context$1 = domCanvas(1, 1)) ? context$1.getContext('2d') : null; -var b = new Bounds(); - -function intersectPath(draw) { - return function (item, brush) { - // rely on (inaccurate) bounds intersection if no context - if (!context$1) return true; // add path to offscreen graphics context - - draw(context$1, item); // get bounds intersection region - - b.clear().union(item.bounds).intersect(brush).round(); - var x1 = b.x1, - y1 = b.y1, - x2 = b.x2, - y2 = b.y2; // iterate over intersection region - // perform fine grained inclusion test - - for (var _y = y1; _y <= y2; ++_y) { - for (var _x20 = x1; _x20 <= x2; ++_x20) { - if (context$1.isPointInPath(_x20, _y)) { - return true; - } - } - } // false if no hits in intersection region - - - return false; - }; -} - -function intersectPoint(item, box) { - return box.contains(item.x || 0, item.y || 0); -} - -function intersectRect(item, box) { - var x = item.x || 0, - y = item.y || 0, - w = item.width || 0, - h = item.height || 0; - return box.intersects(b.set(x, y, x + w, y + h)); -} - -function intersectRule(item, box) { - var x = item.x || 0, - y = item.y || 0, - x2 = item.x2 != null ? item.x2 : x, - y2 = item.y2 != null ? item.y2 : y; - return intersectBoxLine(box, x, y, x2, y2); -} - -function intersectBoxLine(box, x, y, u, v) { - var x1 = box.x1, - y1 = box.y1, - x2 = box.x2, - y2 = box.y2, - dx = u - x, - dy = v - y; - var t0 = 0, - t1 = 1, - p, - q, - r, - e; - - for (e = 0; e < 4; ++e) { - if (e === 0) { - p = -dx; - q = -(x1 - x); - } - - if (e === 1) { - p = dx; - q = x2 - x; - } - - if (e === 2) { - p = -dy; - q = -(y1 - y); - } - - if (e === 3) { - p = dy; - q = y2 - y; - } - - if (Math.abs(p) < 1e-10 && q < 0) return false; - r = q / p; - - if (p < 0) { - if (r > t1) return false;else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false;else if (r < t1) t1 = r; - } - } - - return true; -} - -function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; -} - -function value$1(value, dflt) { - return value == null ? dflt : value; -} - -function addStops(gradient, stops) { - var n = stops.length; - - for (var i = 0; i < n; ++i) { - gradient.addColorStop(stops[i].offset, stops[i].color); - } - - return gradient; -} - -function gradient(context, spec, bounds) { - var w = bounds.width(), - h = bounds.height(); - var gradient; - - if (spec.gradient === 'radial') { - gradient = context.createRadialGradient(bounds.x1 + value$1(spec.x1, 0.5) * w, bounds.y1 + value$1(spec.y1, 0.5) * h, Math.max(w, h) * value$1(spec.r1, 0), bounds.x1 + value$1(spec.x2, 0.5) * w, bounds.y1 + value$1(spec.y2, 0.5) * h, Math.max(w, h) * value$1(spec.r2, 0.5)); - } else { - // linear gradient - var x1 = value$1(spec.x1, 0), - y1 = value$1(spec.y1, 0), - x2 = value$1(spec.x2, 1), - y2 = value$1(spec.y2, 0); - - if (x1 === x2 || y1 === y2 || w === h) { - // axis aligned: use normal gradient - gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h); - } else { - // not axis aligned: render gradient into a pattern (#2365) - // this allows us to use normalized bounding box coordinates - var _image = domCanvas(Math.ceil(w), Math.ceil(h)), - ictx = _image.getContext('2d'); - - ictx.scale(w, h); - ictx.fillStyle = addStops(ictx.createLinearGradient(x1, y1, x2, y2), spec.stops); - ictx.fillRect(0, 0, w, h); - return context.createPattern(_image, 'no-repeat'); - } - } - - return addStops(gradient, spec.stops); -} - -function color(context, item, value) { - return isGradient(value) ? gradient(context, value, item.bounds) : value; -} - -function fill(context, item, opacity) { - opacity *= item.fillOpacity == null ? 1 : item.fillOpacity; - - if (opacity > 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else { - return false; - } -} - -var Empty$1 = []; - -function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - if (lw <= 0) return false; - opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity; - - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty$1); - context.lineDashOffset = item.strokeDashOffset || 0; - } - - return true; - } else { - return false; - } -} - -function compare$2(a, b) { - return a.zindex - b.zindex || a.index - b.index; -} - -function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - var items = scene.items, - output = [], - item, - i, - n; - - for (i = 0, n = items.length; i < n; ++i) { - item = items[i]; - item.index = i; - if (item.zindex) output.push(item); - } - - scene.zdirty = false; - return scene.zitems = output.sort(compare$2); -} - -function visit(scene, visitor) { - var items = scene.items, - i, - n; - if (!items || !items.length) return; - var zitems = zorder(scene); - - if (zitems && zitems.length) { - for (i = 0, n = items.length; i < n; ++i) { - if (!items[i].zindex) visitor(items[i]); - } - - items = zitems; - } - - for (i = 0, n = items.length; i < n; ++i) { - visitor(items[i]); - } -} - -function pickVisit(scene, visitor) { - var items = scene.items, - hit, - i; - if (!items || !items.length) return null; - var zitems = zorder(scene); - if (zitems && zitems.length) items = zitems; - - for (i = items.length; --i >= 0;) { - if (hit = visitor(items[i])) return hit; - } - - if (items === zitems) { - for (items = scene.items, i = items.length; --i >= 0;) { - if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; - } - } - } - - return null; -} - -function drawAll(path) { - return function (context, scene, bounds) { - visit(scene, function (item) { - if (!bounds || bounds.intersects(item.bounds)) { - drawPath(path, context, item, item); - } - }); - }; -} - -function drawOne(path) { - return function (context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) { - drawPath(path, context, scene.items[0], scene.items); - } - }; -} - -function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - if (path(context, items)) return; - blend(context, item); - - if (item.fill && fill(context, item, opacity)) { - context.fill(); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.stroke(); - } -} - -function pick(test) { - test = test || truthy; - return function (context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - return pickVisit(scene, function (item) { - var b = item.bounds; // first hit test against bounding box - - if (b && !b.contains(gx, gy) || !b) return; // if in bounding box, perform more careful test - - if (test(context, item, x, y, gx, gy)) return item; - }); - }; -} - -function hitPath(path, filled) { - return function (context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, - fill = filled == null ? item.fill : filled, - stroke = item.stroke && context.isPointInStroke, - lw, - lc; - - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - - return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y); - }; -} - -function pickPath(path) { - return pick(hitPath(path)); -} - -function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - -function rotate(a) { - return 'rotate(' + a + ')'; -} - -function scale$1(scaleX, scaleY) { - return 'scale(' + scaleX + ',' + scaleY + ')'; -} - -function translateItem(item) { - return translate(item.x || 0, item.y || 0); -} - -function transformItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale$1(item.scaleX || 1, item.scaleY || 1) : ''); -} - -function markItemPath(type, shape, isect) { - function attr(emit, item) { - emit('transform', transformItem(item)); - emit('d', shape(null, item)); - } - - function bound(bounds, item) { - var x = item.x || 0, - y = item.y || 0; - shape(context(bounds), item); - boundStroke(bounds, item).translate(x, y); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw(context, item) { - var x = item.x || 0, - y = item.y || 0, - a = item.angle || 0; - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); - } - - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; -} - -var arc$1 = markItemPath('arc', arc); - -function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], - z = a[0].orient === 'horizontal' ? 'y' : 'x', - i = a.length, - min = +Infinity, - hit, - d; - - while (--i >= 0) { - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - - if (d < min) { - min = d; - hit = a[i]; - } - } - - return hit; -} - -function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), - i = a.length, - dx, - dy, - dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - - return null; -} - -function pickTrail(a, p) { - var i = a.length, - dx, - dy, - dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx * dx) return a[i]; - } - - return null; -} - -function markMultiItemPath(type, shape, tip) { - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - - function bound(bounds, mark) { - var items = mark.items; - - if (items.length === 0) { - return bounds; - } else { - shape(context(bounds), items); - return boundStroke(bounds, items[0]); - } - } - - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - - var hit = hitPath(draw); - - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, - b = scene.bounds; - - if (!items || !items.length || b && !b.contains(gx, gy)) { - return null; - } - - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; - } - - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; -} - -var area$1 = markMultiItemPath('area', area, pickArea); - -function clip$1(context, scene) { - var clip = scene.clip; - context.save(); - - if (isFunction(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else { - clipGroup(context, scene.group); - } -} - -function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); -} - -function offset$1(item) { - var sw = value$1(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; -} - -function attr(emit, item) { - emit('transform', translateItem(item)); -} - -function emitRectangle(emit, item) { - var off = offset$1(item); - emit('d', rectangle(null, item, off, off)); -} - -function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); -} - -function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - - if (item.strokeForeground) { - emitRectangle(emit, item); - } else { - emit('d', ''); - } -} - -function content(emit, item, renderer) { - var url = item.clip ? clip(renderer, item, item) : null; - emit('clip-path', url); -} - -function bound(bounds, group) { - if (!group.clip && group.items) { - var items = group.items, - m = items.length; - - for (var j = 0; j < m; ++j) { - bounds.union(items[j].bounds); - } - } - - if ((group.clip || group.width || group.height) && !group.noBound) { - bounds.add(0, 0).add(group.width || 0, group.height || 0); - } - - boundStroke(bounds, group); - return bounds.translate(group.x || 0, group.y || 0); -} - -function rectanglePath(context, group, x, y) { - var off = offset$1(group); - context.beginPath(); - rectangle(context, group, (x || 0) + off, (y || 0) + off); -} - -var hitBackground = hitPath(rectanglePath); -var hitForeground = hitPath(rectanglePath, false); - -function draw(context, scene, bounds) { - var _this10 = this; - - visit(scene, function (group) { - var gx = group.x || 0, - gy = group.y || 0, - fore = group.strokeForeground, - opacity = group.opacity == null ? 1 : group.opacity; // draw group background - - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - - if (group.fill && fill(context, group, opacity)) { - context.fill(); - } - - if (group.stroke && !fore && stroke(context, group, opacity)) { - context.stroke(); - } - } // setup graphics context, set clip and bounds - - - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); // draw group contents - - visit(group, function (item) { - _this10.draw(context, item, bounds); - }); // restore graphics context - - if (bounds) bounds.translate(gx, gy); - context.restore(); // draw group foreground - - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - - if (stroke(context, group, opacity)) { - context.stroke(); - } - } - }); -} - -function pick$1(context, scene, x, y, gx, gy) { - var _this11 = this; - - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { - return null; - } - - var cx = x * context.pixelRatio, - cy = y * context.pixelRatio; - return pickVisit(scene, function (group) { - var hit, fore, ix, dx, dy, dw, dh, b, c; // first hit test bounding box - - b = group.bounds; - if (b && !b.contains(gx, gy)) return; // passed bounds check, test rectangular clip - - dx = group.x || 0; - dy = group.y || 0; - dw = dx + (group.width || 0); - dh = dy + (group.height || 0); - c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; // adjust coordinate system - - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; // test background for rounded corner clip - - if (c && hasCornerRadius(group) && !hitBackground(context, group, cx, cy)) { - context.restore(); - return null; - } - - fore = group.strokeForeground; - ix = scene.interactive !== false; // hit test against group foreground - - if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } // hit test against contained marks - - - hit = pickVisit(group, function (mark) { - return pickMark(mark, dx, dy) ? _this11.pick(mark, x, y, dx, dy) : null; - }); // hit test against group background - - if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) { - hit = group; - } // restore state and return - - - context.restore(); - return hit || null; - }); -} - -function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y); -} - -var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1, - isect: intersectRect, - content: content, - background: background, - foreground: foreground -}; -var metadata = { - 'version': '1.1', - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink' -}; - -function getImage(item, renderer) { - var image = item.image; - - if (!image || item.url && item.url !== image.url) { - image = { - complete: false, - width: 0, - height: 0 - }; - renderer.loadImage(item.url).then(function (image) { - item.image = image; - item.image.url = item.url; - }); - } - - return image; -} - -function imageWidth(item, image) { - return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width; -} - -function imageHeight(item, image) { - return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height; -} - -function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; -} - -function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; -} - -function attr$1(emit, item, renderer) { - var img = getImage(item, renderer), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); -} - -function bound$1(bounds, item) { - var img = item.image, - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h); - return bounds.set(x, y, x + w, y + h); -} - -function draw$1(context, scene, bounds) { - var _this12 = this; - - visit(scene, function (item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - var img = getImage(item, _this12), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - opacity, - ar0, - ar1, - t; - - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); -} - -var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick(), - isect: truthy, - // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset -}; -var line$1 = markMultiItemPath('line', line, pickLine); - -function attr$2(emit, item) { - var sx = item.scaleX || 1, - sy = item.scaleY || 1; - - if (sx !== 1 || sy !== 1) { - emit('vector-effect', 'non-scaling-stroke'); - } - - emit('transform', transformItem(item)); - emit('d', item.path); -} - -function path(context, item) { - var path = item.path; - if (path == null) return true; - var x = item.x || 0, - y = item.y || 0, - sx = item.scaleX || 1, - sy = item.scaleY || 1, - a = (item.angle || 0) * DegToRad, - cache = item.pathCache; - - if (!cache || cache.path !== path) { - (item.pathCache = cache = pathParse(path)).path = path; - } - - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else { - pathRender(context, cache, x, y, sx, sy); - } -} - -function bound$2(bounds, item) { - path(context(bounds), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, item.x || 0, item.y || 0); - } - - return bounds; -} - -var path$1 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(path), - pick: pickPath(path), - isect: intersectPath(path) -}; - -function attr$3(emit, item) { - emit('d', rectangle(null, item)); -} - -function bound$3(bounds, item) { - var x, y; - return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item); -} - -function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); -} - -var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect -}; - -function attr$4(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); -} - -function bound$4(bounds, item) { - var x1, y1; - return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item); -} - -function path$2(context, item, opacity) { - var x1, y1, x2, y2; - - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - - return false; -} - -function draw$3(context, scene, bounds) { - visit(scene, function (item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - var opacity = item.opacity == null ? 1 : item.opacity; - - if (opacity && path$2(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); -} - -function hit(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path$2(context, item, 1) && context.isPointInStroke(x, y); -} - -var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick(hit), - isect: intersectRule -}; -var shape$1 = markItemPath('shape', shape); -var symbol$1 = markItemPath('symbol', symbol, intersectPoint); // memoize text width measurement - -var widthCache = lruCache(); -var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas -}; -exports.textMetrics = textMetrics; -useCanvas(true); - -function useCanvas(use) { - textMetrics.width = use && context$1 ? measureWidth : estimateWidth; -} // make dumb, simple estimate if no canvas is available - - -function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); -} - -function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); -} // measure text width if canvas is available - - -function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item)); -} - -function _measureWidth(text, currentFont) { - var key = "(".concat(currentFont, ") ").concat(text); - var width = widthCache.get(key); - - if (width === undefined) { - context$1.font = currentFont; - width = context$1.measureText(text).width; - widthCache.set(key, width); - } - - return width; -} - -function fontSize(item) { - return item.fontSize != null ? +item.fontSize || 0 : 11; -} - -function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; -} - -function lineArray(_) { - return isArray(_) ? _.length > 1 ? _ : _[0] : _; -} - -function textLines(item) { - return lineArray(item.lineBreak && item.text && !isArray(item.text) ? item.text.split(item.lineBreak) : item.text); -} - -function multiLineOffset(item) { - var tl = textLines(item); - return (isArray(tl) ? tl.length - 1 : 0) * lineHeight(item); -} - -function textValue(item, line) { - var text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate$1(item, text) : text; -} - -function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - var currentFont = font(item); - return function (text) { - return _measureWidth(text, currentFont); - }; - } else { - // we are relying on estimates - var currentFontHeight = fontSize(item); - return function (text) { - return _estimateWidth(text, currentFontHeight); - }; - } -} - -function truncate$1(item, text) { - var limit = +item.limit, - width = widthGetter(item); - if (width(text) < limit) return text; - var ellipsis = item.ellipsis || "\u2026", - rtl = item.dir === 'rtl', - lo = 0, - hi = text.length, - mid; - limit -= width(ellipsis); - - if (rtl) { - while (lo < hi) { - mid = lo + hi >>> 1; - if (width(text.slice(mid)) > limit) lo = mid + 1;else hi = mid; - } - - return ellipsis + text.slice(lo); - } else { - while (lo < hi) { - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid;else hi = mid - 1; - } - - return text.slice(0, lo) + ellipsis; - } -} - -function fontFamily(item, quote) { - var font = item.font; - return (quote && font ? String(font).replace(/"/g, '\'') : font) || 'sans-serif'; -} - -function font(item, quote) { - return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote); -} - -function offset$2(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, - h = fontSize(item); - return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0); -} - -var textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' -}; -var tempBounds = new Bounds(); - -function anchorPoint(item) { - var x = item.x || 0, - y = item.y || 0, - r = item.radius || 0, - t; - - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; -} - -function attr$5(emit, item) { - var dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item), - p = anchorPoint(item), - x = p.x1, - y = p.y1, - a = item.angle || 0, - t; - emit('text-anchor', textAlign[item.align] || 'start'); - - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else { - t = translate(x + dx, y + dy); - } - - emit('transform', t); -} - -function bound$5(bounds, item, mode) { - var h = textMetrics.height(item), - a = item.align, - p = anchorPoint(item), - x = p.x1, - y = p.y1, - dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item) - Math.round(0.8 * h), - // use 4/5 offset - tl = textLines(item), - w; // get dimensions - - if (isArray(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce(function (w, t) { - return Math.max(w, textMetrics.width(item, t)); - }, 0); - } else { - // single-line text - w = textMetrics.width(item, tl); - } // horizontal alignment - - - if (a === 'center') { - dx -= w / 2; - } else if (a === 'right') { - dx -= w; - } - - bounds.set(dx += x, dy += y, dx + w, dy + h); - - if (item.angle && !mode) { - bounds.rotate(item.angle * DegToRad, x, y); - } else if (mode === 2) { - return bounds.rotatedPoints(item.angle * DegToRad, x, y); - } - - return bounds; -} - -function draw$4(context, scene, bounds) { - visit(scene, function (item) { - var opacity = item.opacity == null ? 1 : item.opacity, - p, - x, - y, - i, - lh, - tl, - str; - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; - context.font = font(item); - context.textAlign = item.align || 'left'; - p = anchorPoint(item); - x = p.x1, y = p.y1; - - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - - x += item.dx || 0; - y += (item.dy || 0) + offset$2(item); - tl = textLines(item); - blend(context, item); - - if (isArray(tl)) { - lh = lineHeight(item); - - for (i = 0; i < tl.length; ++i) { - str = textValue(item, tl[i]); - - if (item.fill && fill(context, item, opacity)) { - context.fillText(str, x, y); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.strokeText(str, x, y); - } - - y += lh; - } - } else { - str = textValue(item, tl); - - if (item.fill && fill(context, item, opacity)) { - context.fillText(str, x, y); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.strokeText(str, x, y); - } - } - - if (item.angle) context.restore(); - }); -} - -function hit$1(context, item, x, y, gx, gy) { - if (item.fontSize <= 0) return false; - if (!item.angle) return true; // bounds sufficient if no rotation - // project point into space of unrotated bounds - - var p = anchorPoint(item), - ax = p.x1, - ay = p.y1, - b = bound$5(tempBounds, item, 1), - a = -item.angle * DegToRad, - cos = Math.cos(a), - sin = Math.sin(a), - px = cos * gx - sin * gy + (ax - cos * ax + sin * ay), - py = sin * gx + cos * gy + (ay - sin * ax - cos * ay); - return b.contains(px, py); -} - -function intersectText(item, box) { - var p = bound$5(tempBounds, item, 2); - return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]); -} - -var text = { - type: 'text', - tag: 'text', - nested: false, - attr: attr$5, - bound: bound$5, - draw: draw$4, - pick: pick(hit$1), - isect: intersectText -}; -var trail$1 = markMultiItemPath('trail', trail, pickTrail); -var Marks = { - arc: arc$1, - area: area$1, - group: group, - image: image, - line: line$1, - path: path$1, - rect: rect, - rule: rule, - shape: shape$1, - symbol: symbol$1, - text: text, - trail: trail$1 -}; -exports.Marks = Marks; - -function boundItem(item, func, opt) { - var type = Marks[item.mark.marktype], - bound = func || type.bound; - if (type.nested) item = item.mark; - return bound(item.bounds || (item.bounds = new Bounds()), item, opt); -} - -var DUMMY = { - mark: null -}; - -function boundMark(mark, bounds, opt) { - var type = Marks[mark.marktype], - bound = type.bound, - items = mark.items, - hasItems = items && items.length, - i, - n, - item, - b; - - if (type.nested) { - if (hasItems) { - item = items[0]; - } else { - // no items, fake it - DUMMY.mark = mark; - item = DUMMY; - } - - b = boundItem(item, bound, opt); - bounds = bounds && bounds.union(b) || b; - return bounds; - } - - bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds(); - - if (hasItems) { - for (i = 0, n = items.length; i < n; ++i) { - bounds.union(boundItem(items[i], bound, opt)); - } - } - - return mark.bounds = bounds; -} - -var keys = ['marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', 'x', 'y', 'width', 'height', 'align', 'baseline', // layout -'fill', 'fillOpacity', 'opacity', 'blend', // fill -'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap', // stroke -'strokeDash', 'strokeDashOffset', // stroke dash -'strokeForeground', 'strokeOffset', // group -'startAngle', 'endAngle', 'innerRadius', 'outerRadius', // arc -'cornerRadius', 'padAngle', // arc, rect -'cornerRadiusTopLeft', 'cornerRadiusTopRight', // rect, group -'cornerRadiusBottomLeft', 'cornerRadiusBottomRight', 'interpolate', 'tension', 'orient', 'defined', // area, line -'url', 'aspect', 'smooth', // image -'path', 'scaleX', 'scaleY', // path -'x2', 'y2', // rule -'size', 'shape', // symbol -'text', 'angle', 'theta', 'radius', 'dir', 'dx', 'dy', // text -'ellipsis', 'limit', 'lineBreak', 'lineHeight', 'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant', // font -'description', 'aria', 'ariaRole', 'ariaRoleDescription' // aria -]; - -function sceneToJSON(scene, indent) { - return JSON.stringify(scene, keys, indent); -} - -function sceneFromJSON(json) { - var scene = typeof json === 'string' ? JSON.parse(json) : json; - return initialize(scene); -} - -function initialize(scene) { - var type = scene.marktype, - items = scene.items, - parent, - i, - n; - - if (items) { - for (i = 0, n = items.length; i < n; ++i) { - parent = type ? 'mark' : 'group'; - items[i][parent] = scene; - if (items[i].zindex) items[i][parent].zdirty = true; - if ('group' === (type || parent)) initialize(items[i]); - } - } - - if (type) boundMark(scene); - return scene; -} - -function Scenegraph(scene) { - if (arguments.length) { - this.root = sceneFromJSON(scene); - } else { - this.root = createMark({ - marktype: 'group', - name: 'root', - role: 'frame' - }); - this.root.items = [new GroupItem(this.root)]; - } -} - -var prototype$I = Scenegraph.prototype; - -prototype$I.toJSON = function (indent) { - return sceneToJSON(this.root, indent || 0); -}; - -prototype$I.mark = function (markdef, group, index) { - group = group || this.root.items[0]; - var mark = createMark(markdef, group); - group.items[index] = mark; - if (mark.zindex) mark.group.zdirty = true; - return mark; -}; - -function createMark(def, group) { - var mark = { - bounds: new Bounds(), - clip: !!def.clip, - group: group, - interactive: def.interactive === false ? false : true, - items: [], - marktype: def.marktype, - name: def.name || undefined, - role: def.role || undefined, - zindex: def.zindex || 0 - }; // add accessibility properties if defined - - if (def.aria != null) { - mark.aria = def.aria; - } - - if (def.description) { - mark.description = def.description; - } - - return mark; -} // create a new DOM element - - -function domCreate(doc, tag, ns) { - if (!doc && typeof document !== 'undefined' && document.createElement) { - doc = document; - } - - return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; -} // find first child element with matching tag - - -function domFind(el, tag) { - tag = tag.toLowerCase(); - var nodes = el.childNodes, - i = 0, - n = nodes.length; - - for (; i < n; ++i) { - if (nodes[i].tagName.toLowerCase() === tag) { - return nodes[i]; - } - } -} // retrieve child element at given index -// create & insert if doesn't exist or if tags do not match - - -function domChild(el, index, tag, ns) { - var a = el.childNodes[index], - b; - - if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) { - b = a || null; - a = domCreate(el.ownerDocument, tag, ns); - el.insertBefore(a, b); - } - - return a; -} // remove all child elements at or above the given index - - -function domClear(el, index) { - var nodes = el.childNodes, - curr = nodes.length; - - while (curr > index) { - el.removeChild(nodes[--curr]); - } - - return el; -} // generate css class name for mark - - -function cssClass(mark) { - return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : ''); -} - -function point(event, el) { - var rect = el.getBoundingClientRect(); - return [event.clientX - rect.left - (el.clientLeft || 0), event.clientY - rect.top - (el.clientTop || 0)]; -} - -function resolveItem(item, event, el, origin) { - var mark = item && item.mark, - mdef, - p; - - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - - while (item = item.mark.group) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - - item = mdef.tip(mark.items, p); - } - - return item; -} -/** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ - - -function Handler(customLoader, customTooltip) { - this._active = null; - this._handlers = {}; - this._loader = customLoader || loader(); - this._tooltip = customTooltip || defaultTooltip; -} // The default tooltip display handler. -// Sets the HTML title attribute on the visualization container. - - -function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); -} - -var prototype$J = Handler.prototype; -/** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ - -prototype$J.initialize = function (el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); -}; -/** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - - -prototype$J.element = function () { - return this._el; -}; -/** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - - -prototype$J.canvas = function () { - return this._el && this._el.firstChild; -}; -/** - * Get / set the origin coordinates of the visualization. - */ - - -prototype$J.origin = function (origin) { - if (arguments.length) { - this._origin = origin || [0, 0]; - return this; - } else { - return this._origin.slice(); - } -}; -/** - * Get / set the scenegraph root. - */ - - -prototype$J.scene = function (scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; -}; -/** - * Add an event handler. Subclasses should override this method. - */ - - -prototype$J.on = function () -/*type, handler*/ -{}; -/** - * Remove an event handler. Subclasses should override this method. - */ - - -prototype$J.off = function () -/*type, handler*/ -{}; -/** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ - - -prototype$J._handlerIndex = function (h, type, handler) { - for (var i = h ? h.length : 0; --i >= 0;) { - if (h[i].type === type && (!handler || h[i].handler === handler)) { - return i; - } - } - - return -1; -}; -/** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ - - -prototype$J.handlers = function (type) { - var h = this._handlers, - a = []; - - if (type) { - a.push.apply(a, h[this.eventName(type)]); - } else { - for (var k in h) { - a.push.apply(a, h[k]); - } - } - - return a; -}; -/** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ - - -prototype$J.eventName = function (name) { - var i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); -}; -/** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ - - -prototype$J.handleHref = function (event, item, href) { - this._loader.sanitize(href, { - context: 'href' - }).then(function (opt) { - var e = new MouseEvent(event.type, event), - a = domCreate(null, 'a'); - - for (var name in opt) { - a.setAttribute(name, opt[name]); - } - - a.dispatchEvent(e); - }).catch(function () { - /* do nothing */ - }); -}; -/** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ - - -prototype$J.handleTooltip = function (event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - - var _value16 = show && item && item.tooltip || null; - - this._tooltip.call(this._obj, this, event, item, _value16); - } -}; -/** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ - - -prototype$J.getItemBoundingClientRect = function (item) { - var el = this.canvas(); - if (!el) return; - var rect = el.getBoundingClientRect(), - origin = this._origin, - bounds = item.bounds, - width = bounds.width(), - height = bounds.height(); - var x = bounds.x1 + origin[0] + rect.left, - y = bounds.y1 + origin[1] + rect.top; // translate coordinate for each parent group - - while (item.mark && (item = item.mark.group)) { - x += item.x || 0; - y += item.y || 0; - } // return DOMRect-compatible bounding box - - - return { - x: x, - y: y, - width: width, - height: height, - left: x, - top: y, - right: x + width, - bottom: y + height - }; -}; -/** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ - - -function Renderer(loader) { - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); -} - -var prototype$K = Renderer.prototype; -/** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ - -prototype$K.initialize = function (el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); -}; -/** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - - -prototype$K.element = function () { - return this._el; -}; -/** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - - -prototype$K.canvas = function () { - return this._el && this._el.firstChild; -}; -/** - * Get / set the background color. - */ - - -prototype$K.background = function (bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; -}; -/** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ - - -prototype$K.resize = function (width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [0, 0]; - this._scale = scaleFactor || 1; - return this; -}; -/** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ - - -prototype$K.dirty = function () -/*item*/ -{}; -/** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Renderer} - This renderer instance. - */ - - -prototype$K.render = function (scene) { - var r = this; // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - - r._call = function () { - r._render(scene); - }; // invoke the renderer - - - r._call(); // clear the cached call for garbage collection - // async redraws will stash their own copy - - - r._call = null; - return r; -}; -/** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - */ - - -prototype$K._render = function () -/*scene*/ -{// subclasses to override -}; -/** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Promise} - A Promise that resolves when rendering is complete. - */ - - -prototype$K.renderAsync = function (scene) { - var r = this.render(scene); - return this._ready ? this._ready.then(function () { - return r; - }) : Promise.resolve(r); -}; -/** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ - - -prototype$K._load = function (method, uri) { - var r = this, - p = r._loader[method](uri); - - if (!r._ready) { - // re-render the scene when loading completes - var call = r._call; - r._ready = r._loader.ready().then(function (redraw) { - if (redraw) call(); - r._ready = null; - }); - } - - return p; -}; -/** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ - - -prototype$K.sanitizeURL = function (uri) { - return this._load('sanitizeURL', uri); -}; -/** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ - - -prototype$K.loadImage = function (uri) { - return this._load('loadImage', uri); -}; - -var KeyDownEvent = 'keydown'; -var KeyPressEvent = 'keypress'; -var KeyUpEvent = 'keyup'; -var DragEnterEvent = 'dragenter'; -var DragLeaveEvent = 'dragleave'; -var DragOverEvent = 'dragover'; -var MouseDownEvent = 'mousedown'; -var MouseUpEvent = 'mouseup'; -var MouseMoveEvent = 'mousemove'; -var MouseOutEvent = 'mouseout'; -var MouseOverEvent = 'mouseover'; -var ClickEvent = 'click'; -var DoubleClickEvent = 'dblclick'; -var WheelEvent = 'wheel'; -var MouseWheelEvent = 'mousewheel'; -var TouchStartEvent = 'touchstart'; -var TouchMoveEvent = 'touchmove'; -var TouchEndEvent = 'touchend'; -var Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent]; -var TooltipShowEvent = MouseMoveEvent; -var TooltipHideEvent = MouseOutEvent; -var HrefEvent = ClickEvent; - -function CanvasHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; -} - -var prototype$L = inherits(CanvasHandler, Handler); - -prototype$L.initialize = function (el, origin, obj) { - var _this13 = this; - - this._canvas = el && domFind(el, 'canvas'); // add minimal events required for proper state management - - [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent].forEach(function (type) { - return eventListenerCheck(_this13, type); - }); - return Handler.prototype.initialize.call(this, el, origin, obj); -}; - -var eventBundle = function eventBundle(type) { - return type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type]; -}; // lazily add listeners to the canvas as needed - - -function eventListenerCheck(handler, type) { - eventBundle(type).forEach(function (_) { - return addEventListener(handler, _); - }); -} - -function addEventListener(handler, type) { - var canvas = handler.canvas(); - - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] ? function (evt) { - return handler[type](evt); - } : function (evt) { - return handler.fire(type, evt); - }); - } -} // return the backing canvas instance - - -prototype$L.canvas = function () { - return this._canvas; -}; // retrieve the current canvas context - - -prototype$L.context = function () { - return this._canvas.getContext('2d'); -}; // supported events - - -prototype$L.events = Events; - -function move(moveEvent, overEvent, outEvent) { - return function (evt) { - var a = this._active, - p = this.pickEvent(evt); - - if (p === a) { - // active item and picked item are the same - this.fire(moveEvent, evt); // fire move - } else { - // active item and picked item are different - if (!a || !a.exit) { - // fire out for prior active item - // suppress if active item was removed from scene - this.fire(outEvent, evt); - } - - this._active = p; // set new active item - - this.fire(overEvent, evt); // fire over for new active item - - this.fire(moveEvent, evt); // fire move for new active item - } - }; -} - -function inactive(type) { - return function (evt) { - this.fire(type, evt); - this._active = null; - }; -} // to keep old versions of firefox happy - - -prototype$L.DOMMouseScroll = function (evt) { - this.fire(MouseWheelEvent, evt); -}; - -prototype$L.mousemove = move(MouseMoveEvent, MouseOverEvent, MouseOutEvent); -prototype$L.dragover = move(DragOverEvent, DragEnterEvent, DragLeaveEvent); -prototype$L.mouseout = inactive(MouseOutEvent); -prototype$L.dragleave = inactive(DragLeaveEvent); - -prototype$L.mousedown = function (evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); -}; - -prototype$L.click = function (evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } -}; - -prototype$L.touchstart = function (evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - - if (this._first) { - this._active = this._touch; - this._first = false; - } - - this.fire(TouchStartEvent, evt, true); -}; - -prototype$L.touchmove = function (evt) { - this.fire(TouchMoveEvent, evt, true); -}; - -prototype$L.touchend = function (evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; -}; // fire an event - - -prototype$L.fire = function (type, evt, touch) { - var a = touch ? this._touch : this._active, - h = this._handlers[type]; // set event type relative to scenegraph items - - evt.vegaType = type; // handle hyperlinks and tooltips first - - if (type === HrefEvent && a && a.href) { - this.handleHref(evt, a, a.href); - } else if (type === TooltipShowEvent || type === TooltipHideEvent) { - this.handleTooltip(evt, a, type !== TooltipHideEvent); - } // invoke all registered handlers - - - if (h) { - for (var i = 0, len = h.length; i < len; ++i) { - h[i].handler.call(this._obj, evt, a); - } - } -}; // add an event handler - - -prototype$L.on = function (type, handler) { - var name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - eventListenerCheck(this, type); - (h[name] || (h[name] = [])).push({ - type: type, - handler: handler - }); - } - - return this; -}; // remove an event handler - - -prototype$L.off = function (type, handler) { - var name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - h.splice(i, 1); - } - - return this; -}; - -prototype$L.pickEvent = function (evt) { - var p = point(evt, this._canvas), - o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); -}; // find the scenegraph item at the current mouse position -// x, y -- the absolute x, y mouse coordinates on the canvas element -// gx, gy -- the relative coordinates within the current group - - -prototype$L.pick = function (scene, x, y, gx, gy) { - var g = this.context(), - mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); -}; - -function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; -} - -var pixelRatio = devicePixelRatio(); - -function resize(canvas, width, height, origin, scaleFactor, opt) { - var inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null, - context = canvas.getContext('2d'), - ratio = inDOM ? pixelRatio : scaleFactor; - canvas.width = width * ratio; - canvas.height = height * ratio; - - for (var _key4 in opt) { - context[_key4] = opt[_key4]; - } - - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - } - - context.pixelRatio = ratio; - context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); - return canvas; -} - -function CanvasRenderer(loader) { - Renderer.call(this, loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); -} - -var prototype$M = inherits(CanvasRenderer, Renderer), - base = Renderer.prototype; - -prototype$M.initialize = function (el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - this._canvas = this._options.externalContext ? null : domCanvas(1, 1, this._options.type); // instantiate a small canvas - - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - - this._canvas.setAttribute('class', 'marks'); - } // this method will invoke resize to size the canvas appropriately - - - return base.initialize.call(this, el, width, height, origin, scaleFactor); -}; - -prototype$M.resize = function (width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - - if (this._canvas) { - // configure canvas size and transform - resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); - } else { - // external context needs to be scaled and positioned to origin - var ctx = this._options.externalContext; - if (!ctx) error('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - - this._redraw = true; - return this; -}; - -prototype$M.canvas = function () { - return this._canvas; -}; - -prototype$M.context = function () { - return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null); -}; - -prototype$M.dirty = function (item) { - var b = this._tempb.clear().union(item.bounds), - g = item.mark.group; - - while (g) { - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; - } - - this._dirty.union(b); -}; - -function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); // align to base pixel grid in case of non-integer scaling (#2425) - - if (g.pixelRatio % 1) { - b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - } // to avoid artifacts translate if origin has fractional pixels - - - b.translate(-(origin[0] % 1), -(origin[1] % 1)); // set clip path - - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - return b; -} - -var viewBounds = function viewBounds(origin, width, height) { - return new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]); -}; - -prototype$M._render = function (scene) { - var g = this.context(), - o = this._origin, - w = this._width, - h = this._height, - db = this._dirty, - vb = viewBounds(o, w, h); // setup - - g.save(); - var b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); - this.clear(-o[0], -o[1], w, h); // render - - this.draw(g, scene, b); // takedown - - g.restore(); - db.clear(); - return this; -}; - -prototype$M.draw = function (ctx, scene, bounds) { - var mark = Marks[scene.marktype]; - if (scene.clip) clip$1(ctx, scene); - mark.draw.call(this, ctx, scene, bounds); - if (scene.clip) ctx.restore(); -}; - -prototype$M.clear = function (x, y, w, h) { - var opt = this._options, - g = this.context(); - - if (opt.type !== 'pdf' && !opt.externalContext) { - // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - } - - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } -}; - -function SVGHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - var h = this; - h._hrefHandler = listener(h, function (evt, item) { - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, function (evt, item) { - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); - }); -} - -var prototype$N = inherits(SVGHandler, Handler); - -prototype$N.initialize = function (el, origin, obj) { - var svg = this._svg; - - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - - this._svg = svg = el && domFind(el, 'svg'); - - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - - return Handler.prototype.initialize.call(this, el, origin, obj); -}; - -prototype$N.canvas = function () { - return this._svg; -}; // wrap an event listener for the SVG DOM - - -var listener = function listener(context, handler) { - return function (evt) { - var item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; -}; // add an event handler - - -prototype$N.on = function (type, handler) { - var name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - var _x21 = { - type: type, - handler: handler, - listener: listener(this, handler) - }; - (h[name] || (h[name] = [])).push(_x21); - - if (this._svg) { - this._svg.addEventListener(name, _x21.listener); - } - } - - return this; -}; // remove an event handler - - -prototype$N.off = function (type, handler) { - var name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - if (this._svg) { - this._svg.removeEventListener(name, h[i].listener); - } - - h.splice(i, 1); - } - - return this; -}; - -function bandSpace(count, paddingInner, paddingOuter) { - var space = count - paddingInner + paddingOuter * 2; - return count ? space > 0 ? space : 1 : 0; -} - -var Identity = 'identity'; -var Linear = 'linear'; -var Log = 'log'; -var Pow = 'pow'; -var Sqrt = 'sqrt'; -var Symlog = 'symlog'; -var Time = 'time'; -var UTC = 'utc'; -var Sequential = 'sequential'; -var Diverging = 'diverging'; -var Quantile$1 = 'quantile'; -var Quantize = 'quantize'; -var Threshold = 'threshold'; -var Ordinal = 'ordinal'; -var Point = 'point'; -var Band = 'band'; -var BinOrdinal = 'bin-ordinal'; // categories - -var Continuous = 'continuous'; -var Discrete = 'discrete'; -var Discretizing = 'discretizing'; -var Interpolating = 'interpolating'; -var Temporal = 'temporal'; - -function invertRange(scale) { - return function (_) { - var lo = _[0], - hi = _[1], - t; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - return [scale.invert(lo), scale.invert(hi)]; - }; -} - -function invertRangeExtent(scale) { - return function (_) { - var range = scale.range(), - lo = _[0], - hi = _[1], - min = -1, - max, - t, - i, - n; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - for (i = 0, n = range.length; i < n; ++i) { - if (range[i] >= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - } - - if (min < 0) return undefined; - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - return [lo[0] === undefined ? lo[1] : lo[0], hi[1] === undefined ? hi[0] : hi[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: - { - if (typeof domain === "function") this.interpolator(domain);else this.range(domain); - break; - } - - default: - { - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator);else this.range(interpolator); - break; - } - } - - return this; -} - -var implicit = Symbol("implicit"); - -function ordinal() { - var index = new Map(), - domain = [], - range = [], - unknown = implicit; - - function scale(d) { - var key = d + "", - i = index.get(key); - - if (!i) { - if (unknown !== implicit) return unknown; - index.set(key, i = domain.push(d)); - } - - return range[(i - 1) % range.length]; - } - - scale.domain = function (_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new Map(); - - var _iterator18 = _createForOfIteratorHelper(_), - _step18; - - try { - for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) { - var _value17 = _step18.value; - - var _key5 = _value17 + ""; - - if (index.has(_key5)) continue; - index.set(_key5, domain.push(_value17)); - } - } catch (err) { - _iterator18.e(err); - } finally { - _iterator18.f(); - } - - return scale; - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function () { - return ordinal(domain, range).unknown(unknown); - }; - - initRange.apply(scale, arguments); - return scale; -} - -function constant$1(x) { - return function () { - return x; - }; -} - -function number$2(x) { - return +x; -} - -var unit = [0, 1]; - -function identity$1(x) { - return x; -} - -function normalize(a, b) { - return (b -= a = +a) ? function (x) { - return (x - a) / b; - } : constant$1(isNaN(b) ? NaN : 0.5); -} - -function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = 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 corresponding parameter t in [0,1]. -// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. - - -function bimap(domain, range, interpolate) { - var d0 = domain[0], - d1 = domain[1], - r0 = range[0], - r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function (x) { - return r0(d0(x)); - }; -} - -function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, - d = new Array(j), - r = new Array(j), - i = -1; // Reverse descending domains. - - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - - while (++i < j) { - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - - return function (x) { - var i = 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() { - var domain = unit, - range = unit, - interpolate = $$1.interpolate, - transform, - untransform, - unknown, - clamp = identity$1, - piecewise, - output, - input; - - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); - } - - scale.invert = function (y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), $$1.interpolateNumber)))(y))); - }; - - scale.domain = function (_) { - return arguments.length ? (domain = Array.from(_, number$2), rescale()) : domain.slice(); - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.rangeRound = function (_) { - return range = Array.from(_), interpolate = $$1.interpolateRound, rescale(); - }; - - scale.clamp = function (_) { - return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1; - }; - - scale.interpolate = function (_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function (t, u) { - transform = t, untransform = u; - return rescale(); - }; -} - -function continuous() { - return transformer()(identity$1, identity$1); -} - -function tickFormat(start, stop, count, specifier) { - var step = tickStep(start, stop, count), - precision; - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ",f" : specifier); - - switch (specifier.type) { - case "s": - { - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision; - return (0, _d3Format.formatPrefix)(specifier, value); - } - - case "": - case "e": - case "g": - case "p": - case "r": - { - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionRound)(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - } - - case "f": - case "%": - { - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - - return (0, _d3Format.format)(specifier); -} - -function linearish(scale) { - var domain = scale.domain; - - scale.ticks = function (count) { - var d = domain(); - return ticks(d[0], d[d.length - 1], count == null ? 10 : count); - }; - - scale.tickFormat = function (count, specifier) { - var d = domain(); - return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - - scale.nice = function (count) { - if (count == null) count = 10; - var d = domain(), - i0 = 0, - i1 = d.length - 1, - start = d[i0], - stop = d[i1], - step; - - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - - step = tickIncrement(start, stop, count); - - if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - step = tickIncrement(start, stop, count); - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - step = tickIncrement(start, stop, count); - } - - if (step > 0) { - d[i0] = Math.floor(start / step) * step; - d[i1] = Math.ceil(stop / step) * step; - domain(d); - } else if (step < 0) { - d[i0] = Math.ceil(start * step) / step; - d[i1] = Math.floor(stop * step) / step; - domain(d); - } - - return scale; - }; - - return scale; -} - -function linear() { - var scale = continuous(); - - scale.copy = function () { - return copy(scale, linear()); - }; - - initRange.apply(scale, arguments); - return linearish(scale); -} - -function identity$2(domain) { - var unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : x; - } - - scale.invert = scale; - - scale.domain = scale.range = function (_) { - return arguments.length ? (domain = Array.from(_, number$2), scale) : domain.slice(); - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function () { - return identity$2(domain).unknown(unknown); - }; - - domain = arguments.length ? Array.from(domain, number$2) : [0, 1]; - return linearish(scale); -} - -function nice(domain, interval) { - domain = domain.slice(); - var i0 = 0, - i1 = domain.length - 1, - x0 = domain[i0], - x1 = domain[i1], - t; - - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - - domain[i0] = interval.floor(x0); - domain[i1] = 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 === 10 ? pow10 : base === Math.E ? Math.exp : function (x) { - return Math.pow(base, x); - }; -} - -function logp(base) { - return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), function (x) { - return Math.log(x) / base; - }); -} - -function reflect(f) { - return function (x) { - return -f(-x); - }; -} - -function loggish(transform) { - var scale = transform(transformLog, transformExp), - domain = scale.domain, - base = 10, - logs, - pows; - - function rescale() { - logs = logp(base), pows = powp(base); - - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else { - transform(transformLog, transformExp); - } - - return scale; - } - - scale.base = function (_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - - scale.domain = function (_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.ticks = function (count) { - var d = domain(), - u = d[0], - v = d[d.length - 1], - r; - if (r = v < u) i = u, u = v, v = i; - var i = logs(u), - j = logs(v), - p, - k, - t, - n = count == null ? 10 : +count, - z = []; - - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for (; i <= j; ++i) { - for (k = 1, p = pows(i); k < base; ++k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } else for (; i <= j; ++i) { - for (k = base - 1, p = pows(i); k >= 1; --k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } - if (z.length * 2 < n) z = ticks(u, v, n); - } else { - z = ticks(i, j, Math.min(j - i, n)).map(pows); - } - - return r ? z.reverse() : z; - }; - - scale.tickFormat = function (count, specifier) { - if (specifier == null) specifier = base === 10 ? ".0e" : ","; - if (typeof specifier !== "function") specifier = (0, _d3Format.format)(specifier); - if (count === Infinity) return specifier; - if (count == null) count = 10; - var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - - return function (d) { - var i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; - }; - - scale.nice = function () { - return domain(nice(domain(), { - floor: function floor(x) { - return pows(Math.floor(logs(x))); - }, - ceil: function ceil(x) { - return pows(Math.ceil(logs(x))); - } - })); - }; - - return scale; -} - -function log$2() { - var scale = loggish(transformer()).domain([1, 10]); - - scale.copy = function () { - return copy(scale, log$2()).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 = 1, - scale = transform(transformSymlog(c), transformSymexp(c)); - - scale.constant = function (_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - - return linearish(scale); -} - -function symlog$1() { - var scale = symlogish(transformer()); - - scale.copy = function () { - return copy(scale, symlog$1()).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 = transform(identity$1, identity$1), - exponent = 1; - - function rescale() { - return exponent === 1 ? transform(identity$1, identity$1) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); - } - - scale.exponent = function (_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - - return linearish(scale); -} - -function pow$1() { - var scale = powish(transformer()); - - scale.copy = function () { - return copy(scale, pow$1()).exponent(scale.exponent()); - }; - - initRange.apply(scale, arguments); - return scale; -} - -function sqrt() { - return pow$1.apply(null, arguments).exponent(0.5); -} - -function quantile$1() { - var domain = [], - range = [], - thresholds = [], - unknown; - - function rescale() { - var i = 0, - n = Math.max(1, range.length); - thresholds = new Array(n - 1); - - while (++i < n) { - thresholds[i - 1] = quantile(domain, i / n); - } - - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : range[bisectRight(thresholds, x)]; - } - - scale.invertExtent = function (y) { - var i = 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 = function (_) { - if (!arguments.length) return domain.slice(); - domain = []; - - var _iterator19 = _createForOfIteratorHelper(_), - _step19; - - try { - for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) { - var d = _step19.value; - if (d != null && !isNaN(d = +d)) domain.push(d); - } - } catch (err) { - _iterator19.e(err); - } finally { - _iterator19.f(); - } - - domain.sort(ascending); - return rescale(); - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.quantiles = function () { - return thresholds.slice(); - }; - - scale.copy = function () { - return quantile$1().domain(domain).range(range).unknown(unknown); - }; - - return initRange.apply(scale, arguments); -} - -function quantize() { - var x0 = 0, - x1 = 1, - n = 1, - domain = [0.5], - range = [0, 1], - unknown; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - function rescale() { - var i = -1; - domain = new Array(n); - - while (++i < n) { - domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - } - - return scale; - } - - scale.domain = function (_) { - var _ref3, _ref4; - - return arguments.length ? ((_ref3 = _, _ref4 = _slicedToArray(_ref3, 2), x0 = _ref4[0], x1 = _ref4[1], _ref3), x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; - }; - - scale.range = function (_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - - scale.invertExtent = function (y) { - var i = range.indexOf(y); - return i < 0 ? [NaN, NaN] : i < 1 ? [x0, domain[0]] : i >= n ? [domain[n - 1], x1] : [domain[i - 1], domain[i]]; - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - - scale.thresholds = function () { - return domain.slice(); - }; - - scale.copy = function () { - return quantize().domain([x0, x1]).range(range).unknown(unknown); - }; - - return initRange.apply(linearish(scale), arguments); -} - -function threshold() { - var domain = [0.5], - range = [0, 1], - unknown, - n = 1; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - scale.domain = function (_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - - scale.invertExtent = function (y) { - var i = range.indexOf(y); - return [domain[i - 1], domain[i]]; - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function () { - return threshold().domain(domain).range(range).unknown(unknown); - }; - - return initRange.apply(scale, arguments); -} - -var durationSecond$1 = 1000, - durationMinute$1 = durationSecond$1 * 60, - durationHour$1 = durationMinute$1 * 60, - durationDay$1 = durationHour$1 * 24, - durationWeek$1 = durationDay$1 * 7, - durationMonth$1 = durationDay$1 * 30, - durationYear$1 = durationDay$1 * 365; - -function date(t) { - return new Date(t); -} - -function number$3(t) { - return t instanceof Date ? +t : +new Date(+t); -} - -function calendar(year, month, week, day, hour, minute, second, millisecond, format) { - var scale = continuous(), - invert = scale.invert, - domain = scale.domain; - var formatMillisecond = format(".%L"), - formatSecond = format(":%S"), - formatMinute = format("%I:%M"), - formatHour = format("%I %p"), - formatDay = format("%a %d"), - formatWeek = format("%b %d"), - formatMonth = format("%B"), - formatYear = format("%Y"); - var tickIntervals = [[second, 1, durationSecond$1], [second, 5, 5 * durationSecond$1], [second, 15, 15 * durationSecond$1], [second, 30, 30 * durationSecond$1], [minute, 1, durationMinute$1], [minute, 5, 5 * durationMinute$1], [minute, 15, 15 * durationMinute$1], [minute, 30, 30 * durationMinute$1], [hour, 1, durationHour$1], [hour, 3, 3 * durationHour$1], [hour, 6, 6 * durationHour$1], [hour, 12, 12 * durationHour$1], [day, 1, durationDay$1], [day, 2, 2 * durationDay$1], [week, 1, durationWeek$1], [month, 1, durationMonth$1], [month, 3, 3 * durationMonth$1], [year, 1, durationYear$1]]; - - function tickFormat(date) { - return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? week(date) < date ? formatDay : formatWeek : year(date) < date ? formatMonth : formatYear)(date); - } - - function tickInterval(interval, start, stop) { - if (interval == null) interval = 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 === "number") { - var target = Math.abs(stop - start) / interval, - i = bisector(function (i) { - return i[2]; - }).right(tickIntervals, target), - step; - - if (i === tickIntervals.length) { - step = tickStep(start / durationYear$1, stop / durationYear$1, interval); - interval = year; - } else if (i) { - i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - step = i[1]; - interval = i[0]; - } else { - step = Math.max(tickStep(start, stop, interval), 1); - interval = millisecond; - } - - return interval.every(step); - } - - return interval; - } - - scale.invert = function (y) { - return new Date(invert(y)); - }; - - scale.domain = function (_) { - return arguments.length ? domain(Array.from(_, number$3)) : domain().map(date); - }; - - scale.ticks = function (interval) { - var d = domain(), - t0 = d[0], - t1 = d[d.length - 1], - r = t1 < t0, - t; - if (r) t = t0, t0 = t1, t1 = t; - t = tickInterval(interval, t0, t1); - t = t ? t.range(t0, t1 + 1) : []; // inclusive stop - - return r ? t.reverse() : t; - }; - - scale.tickFormat = function (count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - - scale.nice = function (interval) { - var d = domain(); - return (interval = tickInterval(interval, d[0], d[d.length - 1])) ? domain(nice(d, interval)) : scale; - }; - - scale.copy = function () { - return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); - }; - - return scale; -} - -function time() { - return initRange.apply(calendar(_d3Time.timeYear, _d3Time.timeMonth, _d3Time.timeWeek, _d3Time.timeDay, _d3Time.timeHour, _d3Time.timeMinute, _d3Time.timeSecond, _d3Time.timeMillisecond, _d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); -} - -function utcTime() { - return initRange.apply(calendar(_d3Time.utcYear, _d3Time.utcMonth, _d3Time.utcWeek, _d3Time.utcDay, _d3Time.utcHour, _d3Time.utcMinute, _d3Time.utcSecond, _d3Time.utcMillisecond, _d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); -} - -function transformer$1() { - var x0 = 0, - x1 = 1, - t0, - t1, - k10, - transform, - interpolator = identity$1, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function (_) { - var _ref5, _ref6; - - return arguments.length ? ((_ref5 = _, _ref6 = _slicedToArray(_ref5, 2), x0 = _ref6[0], x1 = _ref6[1], _ref5), t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; - }; - - scale.clamp = function (_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function (_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function (_) { - var _ref7, _ref8; - - var r0, r1; - return arguments.length ? ((_ref7 = _, _ref8 = _slicedToArray(_ref7, 2), r0 = _ref8[0], r1 = _ref8[1], _ref7), interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; - }; - } - - scale.range = range($$1.interpolate); - scale.rangeRound = range($$1.interpolateRound); - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function (t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === 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 = linearish(transformer$1()(identity$1)); - - scale.copy = function () { - return copy$1(scale, sequential()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function sequentialLog() { - var scale = loggish(transformer$1()).domain([1, 10]); - - scale.copy = function () { - return copy$1(scale, sequentialLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function sequentialSymlog() { - var scale = symlogish(transformer$1()); - - scale.copy = function () { - return copy$1(scale, sequentialSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function sequentialPow() { - var scale = powish(transformer$1()); - - scale.copy = 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 transformer$2() { - var x0 = 0, - x1 = 0.5, - x2 = 1, - s = 1, - t0, - t1, - t2, - k10, - k21, - interpolator = identity$1, - transform, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function (_) { - var _ref9, _ref10; - - return arguments.length ? ((_ref9 = _, _ref10 = _slicedToArray(_ref9, 3), x0 = _ref10[0], x1 = _ref10[1], x2 = _ref10[2], _ref9), t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2]; - }; - - scale.clamp = function (_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function (_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function (_) { - var _ref11, _ref12; - - var r0, r1, r2; - return arguments.length ? ((_ref11 = _, _ref12 = _slicedToArray(_ref11, 3), r0 = _ref12[0], r1 = _ref12[1], r2 = _ref12[2], _ref11), interpolator = (0, $$1.piecewise)(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - - scale.range = range($$1.interpolate); - scale.rangeRound = range($$1.interpolateRound); - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function (t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; -} - -function diverging() { - var scale = linearish(transformer$2()(identity$1)); - - scale.copy = function () { - return copy$1(scale, diverging()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingLog() { - var scale = loggish(transformer$2()).domain([0.1, 1, 10]); - - scale.copy = function () { - return copy$1(scale, divergingLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingSymlog() { - var scale = symlogish(transformer$2()); - - scale.copy = function () { - return copy$1(scale, divergingSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingPow() { - var scale = powish(transformer$2()); - - scale.copy = 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 band() { - var scale = ordinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - range = [0, 1], - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = range[1] < range[0], - start = range[reverse - 0], - stop = range[1 - reverse], - space = bandSpace(n, paddingInner, paddingOuter); - step = (stop - start) / (space || 1); - - if (round) { - step = Math.floor(step); - } - - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - - var values = sequence(n).map(function (i) { - return start + step * i; - }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function (_) { - if (arguments.length) { - domain(_); - return rescale(); - } else { - return domain(); - } - }; - - scale.range = function (_) { - if (arguments.length) { - range = [+_[0], +_[1]]; - return rescale(); - } else { - return range.slice(); - } - }; - - scale.rangeRound = function (_) { - range = [+_[0], +_[1]]; - round = true; - return rescale(); - }; - - scale.bandwidth = function () { - return bandwidth; - }; - - scale.step = function () { - return step; - }; - - scale.round = function (_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else { - return round; - } - }; - - scale.padding = function (_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingInner = function (_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingOuter = function (_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingOuter; - } - }; - - scale.align = function (_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return align; - } - }; - - scale.invertRange = function (_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - var lo = +_[0], - hi = +_[1], - reverse = range[1] < range[0], - values = reverse ? ordinalRange().reverse() : ordinalRange(), - n = values.length - 1, - a, - b, - t; // bail if either range endpoint is invalid - - if (lo !== lo || hi !== hi) return; // order range inputs, bail if outside of scale range - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - if (hi < values[0] || lo > range[1 - reverse]) return; // binary search to index into scale range - - a = Math.max(0, bisectRight(values, lo) - 1); - b = lo === hi ? a : bisectRight(values, hi) - 1; // increment index a if lo is within padding gap - - if (lo - values[a] > bandwidth + 1e-10) ++a; - - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - - return a > b ? undefined : domain().slice(a, b + 1); - }; - - scale.invert = function (_) { - var value = scale.invertRange([_, _]); - return value ? value[0] : value; - }; - - scale.copy = function () { - return band().domain(domain()).range(range).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); - }; - - return rescale(); -} - -function pointish(scale) { - var copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - - scale.copy = function () { - return pointish(copy()); - }; - - return scale; -} - -function point$1() { - return pointish(band().paddingInner(1)); -} - -var map = Array.prototype.map; - -function numbers$2(_) { - return map.call(_, function (x) { - return +x; - }); -} - -var slice = Array.prototype.slice; - -function scaleBinOrdinal() { - var domain = [], - range = []; - - function scale(x) { - return x == null || x !== x ? undefined : range[(bisectRight(domain, x) - 1) % range.length]; - } - - scale.domain = function (_) { - if (arguments.length) { - domain = numbers$2(_); - return scale; - } else { - return domain.slice(); - } - }; - - scale.range = function (_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else { - return range.slice(); - } - }; - - scale.tickFormat = function (count, specifier) { - return tickFormat(domain[0], peek(domain), count == null ? 10 : count, specifier); - }; - - scale.copy = function () { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - - return scale; -} // scale registry - - -var scales = {}; -/** - * Augment scales with their type and needed inverse methods. - */ - -function create(type, constructor, metadata) { - var ctr = function scale() { - var s = constructor(); - - if (!s.invertRange) { - s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined; - } - - s.type = type; - return s; - }; - - ctr.metadata = toSet(array(metadata)); - return ctr; -} - -function scale$2(type, scale, metadata) { - if (arguments.length > 1) { - scales[type] = create(type, scale, metadata); - return this; - } else { - return isValidScaleType(type) ? scales[type] : undefined; - } -} // identity scale - - -scale$2(Identity, identity$2); // continuous scales - -scale$2(Linear, linear, Continuous); -scale$2(Log, log$2, [Continuous, Log]); -scale$2(Pow, pow$1, Continuous); -scale$2(Sqrt, sqrt, Continuous); -scale$2(Symlog, symlog$1, Continuous); -scale$2(Time, time, [Continuous, Temporal]); -scale$2(UTC, utcTime, [Continuous, Temporal]); // sequential scales - -scale$2(Sequential, sequential, [Continuous, Interpolating]); // backwards compat - -scale$2("".concat(Sequential, "-").concat(Linear), sequential, [Continuous, Interpolating]); -scale$2("".concat(Sequential, "-").concat(Log), sequentialLog, [Continuous, Interpolating, Log]); -scale$2("".concat(Sequential, "-").concat(Pow), sequentialPow, [Continuous, Interpolating]); -scale$2("".concat(Sequential, "-").concat(Sqrt), sequentialSqrt, [Continuous, Interpolating]); -scale$2("".concat(Sequential, "-").concat(Symlog), sequentialSymlog, [Continuous, Interpolating]); // diverging scales - -scale$2("".concat(Diverging, "-").concat(Linear), diverging, [Continuous, Interpolating]); -scale$2("".concat(Diverging, "-").concat(Log), divergingLog, [Continuous, Interpolating, Log]); -scale$2("".concat(Diverging, "-").concat(Pow), divergingPow, [Continuous, Interpolating]); -scale$2("".concat(Diverging, "-").concat(Sqrt), divergingSqrt, [Continuous, Interpolating]); -scale$2("".concat(Diverging, "-").concat(Symlog), divergingSymlog, [Continuous, Interpolating]); // discretizing scales - -scale$2(Quantile$1, quantile$1, [Discretizing, Quantile$1]); -scale$2(Quantize, quantize, Discretizing); -scale$2(Threshold, threshold, Discretizing); // discrete scales - -scale$2(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]); -scale$2(Ordinal, ordinal, Discrete); -scale$2(Band, band, Discrete); -scale$2(Point, point$1, Discrete); - -function isValidScaleType(type) { - return hasOwnProperty(scales, type); -} - -function hasType(key, type) { - var s = scales[key]; - return s && s.metadata[type]; -} - -function isContinuous(key) { - return hasType(key, Continuous); -} - -function isDiscrete(key) { - return hasType(key, Discrete); -} - -function isDiscretizing(key) { - return hasType(key, Discretizing); -} - -function isLogarithmic(key) { - return hasType(key, Log); -} - -function isTemporal(key) { - return hasType(key, Temporal); -} - -function isInterpolating(key) { - return hasType(key, Interpolating); -} - -function isQuantile(key) { - return hasType(key, Quantile$1); -} - -var scaleProps = ['clamp', 'base', 'constant', 'exponent']; - -function interpolateRange(interpolator, range) { - var start = range[0], - span = peek(range) - start; - return function (i) { - return interpolator(start + i * span); - }; -} - -function interpolateColors(colors, type, gamma) { - return (0, $$1.piecewise)(interpolate(type || 'rgb', gamma), colors); -} - -function quantizeInterpolator(interpolator, count) { - var samples = new Array(count), - n = count + 1; - - for (var i = 0; i < count;) { - samples[i] = interpolator(++i / n); - } - - return samples; -} - -function scaleFraction(scale, min, max) { - var delta = max - min, - i, - t, - s; - - if (!delta || !Number.isFinite(delta)) { - return constant(0.5); - } else { - i = (t = scale.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale$2(t)().domain([min, max]).range([0, 1]); - scaleProps.forEach(function (m) { - return scale[m] ? s[m](scale[m]()) : 0; - }); - return s; - } -} - -function interpolate(type, gamma) { - var interp = $$1[method(type)]; - return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp; -} - -function method(type) { - return 'interpolate' + type.toLowerCase().split('-').map(function (s) { - return s[0].toUpperCase() + s.slice(1); - }).join(''); -} - -var continuous$1 = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' -}; -var discrete = { - category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', - accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', - dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', - paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', - pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', - pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', - set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', - set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', - set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' -}; - -function colors(palette) { - var n = palette.length / 6 | 0, - c = new Array(n), - i = 0; - - while (i < n) { - c[i] = '#' + palette.slice(i * 6, ++i * 6); - } - - return c; -} - -function apply(_, f) { - for (var k in _) { - scheme(k, f(_[k])); - } -} - -var schemes = {}; -apply(discrete, colors); -apply(continuous$1, function (_) { - return interpolateColors(colors(_)); -}); - -function scheme(name, scheme) { - name = name && name.toLowerCase(); - - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else { - return schemes[name]; - } -} - -var SymbolLegend = 'symbol'; -var DiscreteLegend = 'discrete'; -var GradientLegend = 'gradient'; - -var defaultFormatter = function defaultFormatter(value) { - return isArray(value) ? value.map(function (v) { - return String(v); - }) : String(value); -}; - -var ascending$1 = function ascending$1(a, b) { - return a[1] - b[1]; -}; - -var descending = function descending(a, b) { - return b[1] - a[1]; -}; -/** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ - - -function tickCount(scale, count, minStep) { - var step; - - if (isNumber(count)) { - if (scale.bins) { - count = Math.max(count, scale.bins.length); - } - - if (minStep != null) { - count = Math.min(count, Math.floor(span(scale.domain()) / minStep || 1)); - } - } - - if (isObject(count)) { - step = count.step; - count = count.interval; - } - - if (isString(count)) { - count = scale.type === Time ? timeInterval(count) : scale.type == UTC ? utcInterval(count) : error('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - - return count; -} -/** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ - - -function validTicks(scale, ticks, count) { - var range = scale.range(), - lo = range[0], - hi = peek(range), - cmp = ascending$1; - - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - - lo = Math.floor(lo); - hi = Math.ceil(hi); // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - - ticks = ticks.map(function (v) { - return [v, scale(v)]; - }).filter(function (_) { - return lo <= _[1] && _[1] <= hi; - }).sort(cmp).map(function (_) { - return _[0]; - }); - - if (count > 0 && ticks.length > 1) { - var endpoints = [ticks[0], peek(ticks)]; - - while (ticks.length > count && ticks.length >= 3) { - ticks = ticks.filter(function (_, i) { - return !(i % 2); - }); - } - - if (ticks.length < 3) { - ticks = endpoints; - } - } - - return ticks; -} -/** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ - - -function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins) : scale.ticks ? scale.ticks(count) : scale.domain(); -} -/** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ - - -function tickFormat$1(locale, scale, count, specifier, formatType, noSkip) { - var type = scale.type; - var format = defaultFormatter; - - if (type === Time || formatType === Time) { - format = locale.timeFormat(specifier); - } else if (type === UTC || formatType === UTC) { - format = locale.utcFormat(specifier); - } else if (isLogarithmic(type)) { - var varfmt = locale.formatFloat(specifier); - - if (noSkip || scale.bins) { - format = varfmt; - } else { - var test = tickLog(scale, count, false); - - format = function format(_) { - return test(_) ? varfmt(_) : ''; - }; - } - } else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - var d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } else if (specifier) { - format = locale.format(specifier); - } - - return format; -} - -function tickLog(scale, count, values) { - var ticks = tickValues(scale, count), - base = scale.base(), - logb = Math.log(base), - k = Math.max(1, base * count / ticks.length); // apply d3-scale's log format filter criteria - - var test = function test(d) { - var i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - - return values ? ticks.filter(test) : test; -} - -var symbols$1 = (_symbols$ = {}, _defineProperty(_symbols$, Quantile$1, 'quantiles'), _defineProperty(_symbols$, Quantize, 'thresholds'), _defineProperty(_symbols$, Threshold, 'domain'), _symbols$); -var formats$1 = (_formats$ = {}, _defineProperty(_formats$, Quantile$1, 'quantiles'), _defineProperty(_formats$, Quantize, 'domain'), _formats$); - -function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols$1[scale.type] ? thresholdValues(scale[symbols$1[scale.type]]()) : tickValues(scale, count); -} - -function thresholdFormat(locale, scale, specifier) { - var _ = scale[formats$1[scale.type]](), - n = _.length, - d = n > 1 ? _[1] - _[0] : _[0], - i; - - for (i = 1; i < n; ++i) { - d = Math.min(d, _[i] - _[i - 1]); - } // tickCount = 3 ticks times 10 for increased resolution - - - return locale.formatSpan(0, d, 3 * 10, specifier); -} - -function thresholdValues(thresholds) { - var values = [-Infinity].concat(thresholds); - values.max = +Infinity; - return values; -} - -function binValues(bins) { - var values = bins.slice(0, -1); - values.max = peek(bins); - return values; -} - -function isDiscreteRange(scale) { - return symbols$1[scale.type] || scale.bins; -} - -function labelFormat(locale, scale, count, type, specifier, formatType, noSkip) { - var format = formats$1[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat$1(locale, scale, count, specifier, formatType, noSkip); - return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format); -} - -function formatRange(format) { - return function (value, index, array) { - var limit = get$2(array[index + 1], get$2(array.max, +Infinity)), - lo = formatValue(value, format), - hi = formatValue(limit, format); - return lo && hi ? lo + " \u2013 " + hi : hi ? '< ' + hi : "\u2265 " + lo; - }; -} - -function get$2(value, dflt) { - return value != null ? value : dflt; -} - -function formatDiscrete(format) { - return function (value, index) { - return index ? format(value) : null; - }; -} - -function formatPoint(format) { - return function (value) { - return format(value); - }; -} - -function formatValue(value, format) { - return Number.isFinite(value) ? format(value) : null; -} - -function labelFraction(scale) { - var domain = scale.domain(), - count = domain.length - 1, - lo = +domain[0], - hi = +peek(domain), - span = hi - lo; - - if (scale.type === Threshold) { - var adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - - return function (value) { - return (value - lo) / span; - }; -} - -function format$1(locale, scale, specifier, formatType) { - var type = formatType || scale.type; // replace abbreviated time specifiers to improve screen reader experience - - if (isString(specifier) && isTemporal(type)) { - specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - } - - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true); -} - -function domainCaption(locale, scale, opt) { - opt = opt || {}; - var max = Math.max(3, opt.maxlen || 7), - fmt = format$1(locale, scale, opt.format, opt.formatType); // if scale breaks domain into bins, describe boundaries - - if (isDiscretizing(scale.type)) { - var v = labelValues(scale).slice(1).map(fmt), - n = v.length; - return "".concat(n, " boundar").concat(n === 1 ? 'y' : 'ies', ": ").concat(v.join(', ')); - } // if scale domain is discrete, list values - else if (isDiscrete(scale.type)) { - var d = scale.domain(), - _n2 = d.length, - _v = _n2 > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', '); - - return "".concat(_n2, " value").concat(_n2 === 1 ? '' : 's', ": ").concat(_v); - } // if scale domain is continuous, describe value range - else { - var _d2 = scale.domain(); - - return "values from ".concat(fmt(_d2[0]), " to ").concat(fmt(peek(_d2))); - } -} - -var ARIA_HIDDEN = 'aria-hidden'; -var ARIA_LABEL = 'aria-label'; -var ARIA_ROLE = 'role'; -var ARIA_ROLEDESCRIPTION = 'aria-roledescription'; -var GRAPHICS_OBJECT = 'graphics-object'; -var GRAPHICS_SYMBOL = 'graphics-symbol'; - -var bundle = function bundle(role, roledesc, label) { - var _ref13; - - return _ref13 = {}, _defineProperty(_ref13, ARIA_ROLE, role), _defineProperty(_ref13, ARIA_ROLEDESCRIPTION, roledesc), _defineProperty(_ref13, ARIA_LABEL, label || undefined), _ref13; -}; // these roles are covered by related roles -// we can ignore them, no need to generate attributes - - -var AriaIgnore = toSet(['axis-domain', 'axis-grid', 'axis-label', 'axis-tick', 'axis-title', 'legend-band', 'legend-entry', 'legend-gradient', 'legend-label', 'legend-title', 'legend-symbol', 'title']); // aria attribute generators for guide roles - -var AriaGuides = { - 'axis': { - desc: 'axis', - caption: axisCaption - }, - 'legend': { - desc: 'legend', - caption: legendCaption - }, - 'title-text': { - desc: 'title', - caption: function caption(item) { - return "Title text '".concat(titleCaption(item), "'"); - } - }, - 'title-subtitle': { - desc: 'subtitle', - caption: function caption(item) { - return "Subtitle text '".concat(titleCaption(item), "'"); - } - } -}; // aria properties generated for mark item encoding channels - -var AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL -}; - -function ariaItemAttributes(emit, item) { - var hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - - if (hide || item.description == null) { - for (var prop in AriaEncode) { - emit(AriaEncode[prop], undefined); - } - } else { - var _type = item.mark.marktype; - emit(ARIA_LABEL, item.description); - emit(ARIA_ROLE, item.ariaRole || (_type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); - emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || "".concat(_type, " mark")); - } -} - -function ariaMarkAttributes(mark) { - return mark.aria === false ? _defineProperty({}, ARIA_HIDDEN, true) : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); -} - -function ariaMark(mark) { - var type = mark.marktype; - var recurse = type === 'group' || type === 'text' || mark.items.some(function (_) { - return _.description != null && _.aria !== false; - }); - return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, "".concat(type, " mark container"), mark.description); -} - -function ariaGuide(mark, opt) { - try { - var item = mark.items[0], - caption = opt.caption || function () { - return ''; - }; - - return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); - } catch (err) { - return null; - } -} - -function titleCaption(item) { - return array(item.text).join(' '); -} - -function axisCaption(item) { - var datum = item.datum, - orient = item.orient, - title = datum.title ? extractTitle(item) : null, - ctx = item.context, - scale = ctx.scales[datum.scale].value, - locale = ctx.dataflow.locale(), - type = scale.type, - xy = orient === 'left' || orient === 'right' ? 'Y' : 'X'; - return "".concat(xy, "-axis") + (title ? " titled '".concat(title, "'") : '') + " for a ".concat(isDiscrete(type) ? 'discrete' : type, " scale") + " with ".concat(domainCaption(locale, scale, item)); -} - -function legendCaption(item) { - var datum = item.datum, - title = datum.title ? extractTitle(item) : null, - type = "".concat(datum.type || '', " legend").trim(), - scales = datum.scales, - props = Object.keys(scales), - ctx = item.context, - scale = ctx.scales[scales[props[0]]].value, - locale = ctx.dataflow.locale(); - return capitalize(type) + (title ? " titled '".concat(title, "'") : '') + " for ".concat(channelCaption(props)) + " with ".concat(domainCaption(locale, scale, item)); -} - -function extractTitle(item) { - try { - return array(peek(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } -} - -function channelCaption(props) { - props = props.map(function (p) { - return p + (p === 'fill' || p === 'stroke' ? ' color' : ''); - }); - return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + peek(props); -} - -function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; -} - -var attrText = function attrText(val) { - return (val + '').replace(/&/g, '&').replace(/"/g, '"'); -}; -/** - * Generate string for an opening xml tag. - * @param tag the name of the xml tag - * @param attr hash of attribute name-value pairs to include - * @param raw additional raw string to include in tag markup - */ - - -function openTag(tag, attr, raw) { - var s = '<' + tag, - key, - val; - - if (attr) { - for (key in attr) { - val = attr[key]; - - if (val != null) { - s += ' ' + key + '="' + attrText(val) + '"'; - } - } - } - - if (raw) s += ' ' + raw; - return s + '>'; -} -/** - * Generate string for closing xml tag. - * @param tag the name of the xml tag - */ - - -function closeTag(tag) { - return ''; -} - -var styles = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity', - blend: 'mix-blend-mode' -}; // ensure miter limit default is consistent with canvas (#2498) - -var rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 -}; -var RootIndex = 0, - ns = metadata.xmlns; - -function SVGRenderer(loader) { - Renderer.call(this, loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; -} - -var prototype$O = inherits(SVGRenderer, Renderer); -var base$1 = Renderer.prototype; - -prototype$O.initialize = function (el, width, height, padding) { - // create the svg definitions cache - this._defs = { - gradient: {}, - clipping: {} - }; - - if (el) { - this._svg = domChild(el, 0, 'svg', ns); - - this._svg.setAttribute('class', 'marks'); - - domClear(el, 1); // set the svg root group - - this._root = domChild(this._svg, RootIndex, 'g', ns); - - for (var _attr in rootAttributes) { - this._root.setAttribute(_attr, rootAttributes[_attr]); - } // ensure no additional child elements - - - domClear(this._svg, RootIndex + 1); - } // set background color if defined - - - this.background(this._bgcolor); - return base$1.initialize.call(this, el, width, height, padding); -}; - -prototype$O.background = function (bgcolor) { - if (arguments.length && this._svg) { - this._svg.style.setProperty('background-color', bgcolor); - } - - return base$1.background.apply(this, arguments); -}; - -prototype$O.resize = function (width, height, origin, scaleFactor) { - base$1.resize.call(this, width, height, origin, scaleFactor); - - if (this._svg) { - this._svg.setAttribute('width', this._width * this._scale); - - this._svg.setAttribute('height', this._height * this._scale); - - this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height); - - this._root.setAttribute('transform', 'translate(' + this._origin + ')'); - } - - this._dirty = []; - return this; -}; - -prototype$O.canvas = function () { - return this._svg; -}; - -prototype$O.svg = function () { - if (!this._svg) return null; - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - - for (var key in metadata) { - attr[key] = metadata[key]; - } - - var bg = !this._bgcolor ? '' : openTag('rect', { - width: this._width, - height: this._height, - fill: this._bgcolor - }) + closeTag('rect'); - return openTag('svg', attr) + (this._defs.el ? this._defs.el.outerHTML : '') + bg + this._root.outerHTML + closeTag('svg'); -}; // -- Render entry point -- - - -prototype$O._render = function (scene) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._resetDefs(); - this.draw(this._root, scene); - domClear(this._root, 1); - } - - this.updateDefs(); - this._dirty = []; - ++this._dirtyID; - return this; -}; // -- Manage SVG definitions ('defs') block -- - - -prototype$O.updateDefs = function () { - var svg = this._svg, - defs = this._defs; - var el = defs.el, - index = 0; - - for (var _id in defs.gradient) { - if (!el) defs.el = el = domChild(svg, RootIndex, 'defs', ns); - index = updateGradient(el, defs.gradient[_id], index); - } - - for (var _id2 in defs.clipping) { - if (!el) defs.el = el = domChild(svg, RootIndex, 'defs', ns); - index = updateClipping(el, defs.clipping[_id2], index); - } // clean-up - - - if (el) { - index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index); - } -}; - -function updateGradient(el, grad, index) { - var i, n, stop; - - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - var pt = domChild(el, index++, 'pattern', ns); - pt.setAttribute('id', patternPrefix + grad.id); - pt.setAttribute('viewBox', '0,0,1,1'); - pt.setAttribute('width', '100%'); - pt.setAttribute('height', '100%'); - pt.setAttribute('preserveAspectRatio', 'xMidYMid slice'); - pt = domChild(pt, 0, 'rect', ns); - pt.setAttribute('width', '1'); - pt.setAttribute('height', '1'); - pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')'); - el = domChild(el, index++, 'radialGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('fx', grad.x1); - el.setAttribute('fy', grad.y1); - el.setAttribute('fr', grad.r1); - el.setAttribute('cx', grad.x2); - el.setAttribute('cy', grad.y2); - el.setAttribute('r', grad.r2); - } else { - el = domChild(el, index++, 'linearGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('x1', grad.x1); - el.setAttribute('x2', grad.x2); - el.setAttribute('y1', grad.y1); - el.setAttribute('y2', grad.y2); - } - - for (i = 0, n = grad.stops.length; i < n; ++i) { - stop = domChild(el, i, 'stop', ns); - stop.setAttribute('offset', grad.stops[i].offset); - stop.setAttribute('stop-color', grad.stops[i].color); - } - - domClear(el, i); - return index; -} - -function updateClipping(el, clip, index) { - var mask; - el = domChild(el, index, 'clipPath', ns); - el.setAttribute('id', clip.id); - - if (clip.path) { - mask = domChild(el, 0, 'path', ns); - mask.setAttribute('d', clip.path); - } else { - mask = domChild(el, 0, 'rect', ns); - mask.setAttribute('x', 0); - mask.setAttribute('y', 0); - mask.setAttribute('width', clip.width); - mask.setAttribute('height', clip.height); - } - - domClear(el, 1); - return index + 1; -} - -prototype$O._resetDefs = function () { - var def = this._defs; - def.gradient = {}; - def.clipping = {}; -}; // -- Manage rendering of items marked as dirty -- - - -prototype$O.dirty = function (item) { - if (item.dirty !== this._dirtyID) { - item.dirty = this._dirtyID; - - this._dirty.push(item); - } -}; - -prototype$O.isDirty = function (item) { - return this._dirtyAll || !item._svg || item.dirty === this._dirtyID; -}; - -prototype$O._dirtyCheck = function () { - this._dirtyAll = true; - var items = this._dirty; - if (!items.length || !this._dirtyID) return true; - var id = ++this._dirtyID, - item, - mark, - type, - mdef, - i, - n, - o; - - for (i = 0, n = items.length; i < n; ++i) { - item = items[i]; - mark = item.mark; - - if (mark.marktype !== type) { - // memoize mark instance lookup - type = mark.marktype; - mdef = Marks[type]; - } - - if (mark.zdirty && mark.dirty !== id) { - this._dirtyAll = false; - dirtyParents(item, id); - mark.items.forEach(function (i) { - i.dirty = id; - }); - } - - if (mark.zdirty) continue; // handle in standard drawing pass - - if (item.exit) { - // EXIT - if (mdef.nested && mark.items.length) { - // if nested mark with remaining points, update instead - o = mark.items[0]; - if (o._svg) this._update(mdef, o._svg, o); - } else if (item._svg) { - // otherwise remove from DOM - o = item._svg.parentNode; - if (o) o.removeChild(item._svg); - } - - item._svg = null; - continue; - } - - item = mdef.nested ? mark.items[0] : item; - if (item._update === id) continue; // already visited - - if (!item._svg || !item._svg.ownerSVGElement) { - // ENTER - this._dirtyAll = false; - dirtyParents(item, id); - } else { - // IN-PLACE UPDATE - this._update(mdef, item._svg, item); - } - - item._update = id; - } - - return !this._dirtyAll; -}; - -function dirtyParents(item, id) { - for (; item && item.dirty !== id; item = item.mark.group) { - item.dirty = id; - - if (item.mark && item.mark.dirty !== id) { - item.mark.dirty = id; - } else return; - } -} // -- Construct & maintain scenegraph to SVG mapping --- -// Draw a mark container. - - -prototype$O.draw = function (el, scene, prev) { - var _this14 = this; - - if (!this.isDirty(scene)) return scene._svg; - var svg = this._svg, - mdef = Marks[scene.marktype], - events = scene.interactive === false ? 'none' : null, - isGroup = mdef.tag === 'g', - sibling = null, - i = 0, - parent; - parent = bind(scene, el, prev, 'g', svg); - parent.setAttribute('class', cssClass(scene)); // apply aria attributes to parent container element - - var aria = ariaMarkAttributes(scene); - - for (var _key6 in aria) { - setAttribute(parent, _key6, aria[_key6]); - } - - if (!isGroup) { - setAttribute(parent, 'pointer-events', events); - } - - setAttribute(parent, 'clip-path', scene.clip ? clip(this, scene, scene.group) : null); - - var process = function process(item) { - var dirty = _this14.isDirty(item), - node = bind(item, parent, sibling, mdef.tag, svg); - - if (dirty) { - _this14._update(mdef, node, item); - - if (isGroup) recurse(_this14, node, item); - } - - sibling = node; - ++i; - }; - - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } - - domClear(parent, i); - return parent; -}; // Recursively process group contents. - - -function recurse(renderer, el, group) { - el = el.lastChild.previousSibling; - var prev, - idx = 0; - visit(group, function (item) { - prev = renderer.draw(el, item, prev); - ++idx; - }); // remove any extraneous DOM elements - - domClear(el, 1 + idx); -} // Bind a scenegraph item to an SVG DOM element. -// Create new SVG elements as needed. - - -function bind(item, el, sibling, tag, svg) { - var node = item._svg, - doc; // create a new dom node if needed - - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, ns); - item._svg = node; - - if (item.mark) { - node.__data__ = item; - node.__values__ = { - fill: 'default' - }; // if group, create background, content, and foreground elements - - if (tag === 'g') { - var bg = domCreate(doc, 'path', ns); - node.appendChild(bg); - bg.__data__ = item; - var cg = domCreate(doc, 'g', ns); - node.appendChild(cg); - cg.__data__ = item; - var fg = domCreate(doc, 'path', ns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = { - fill: 'default' - }; - } - } - } // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - - - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { - el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - } - - return node; -} - -function siblingCheck(node, sibling) { - return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same -} // -- Set attributes & styles on SVG elements --- - - -var element = null, - // temp var for current SVG element -values = null; // temp var for current values hash -// Extra configuration for certain mark types - -var mark_extras = { - group: function group(mdef, el, item) { - var fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - values = el.__values__; // use parent's values hash - - element = el.childNodes[1]; - mdef.content(emit, item, this); - var bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - var value = item.mark.interactive === false ? 'none' : null; - - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - - if (item.strokeForeground && item.stroke) { - var _fill = item.fill; - setAttribute(fg, 'display', null); // set style of background - - this.style(bg, item); - setAttribute(bg, 'stroke', null); // set style of foreground - - if (_fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (_fill) item.fill = _fill; // leave element null to prevent downstream styling - - element = null; - } else { - // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - } - }, - image: function image(mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else { - setStyle(el, 'image-rendering', null); - } - }, - text: function text(mdef, el, item) { - var tl = textLines(item), - key, - value, - doc, - lh; - - if (isArray(tl)) { - // multi-line text - value = tl.map(function (_) { - return textValue(item, _); - }); - key = value.join('\n'); // content cache key - - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach(function (t, i) { - var ts = domCreate(doc, 'tspan', ns); - ts.__data__ = item; // data binding - - ts.textContent = t; - - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } -}; - -function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) { - el.style.removeProperty(name); - } else { - el.style.setProperty(name, value + ''); - } - - values[name] = value; - } -} - -prototype$O._update = function (mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; // apply aria-specific properties - - ariaItemAttributes(emit, item); // apply svg attributes - - mdef.attr(emit, item, this); // some marks need special treatment - - var extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); // apply svg style attributes - // note: element may be modified by 'extra' method - - if (element) this.style(element, item); -}; - -function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; // use appropriate method given namespace (ns) - - if (ns) { - setAttributeNS(element, name, value, ns); - } else { - setAttribute(element, name, value); - } // note current value for future comparison - - - values[name] = value; -} - -function setAttribute(el, name, value) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttribute(name, value); - } else { - // else remove DOM attribute - el.removeAttribute(name); - } -} - -function setAttributeNS(el, name, value, ns) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - } else { - // else remove DOM attribute - el.removeAttributeNS(ns, name); - } -} - -prototype$O.style = function (el, o) { - if (o == null) return; - - for (var prop in styles) { - var _value18 = prop === 'font' ? fontFamily(o) : o[prop]; - - if (_value18 === values[prop]) continue; - var name = styles[prop]; - - if (_value18 == null) { - el.removeAttribute(name); - } else { - if (isGradient(_value18)) { - _value18 = gradientRef(_value18, this._defs.gradient, href()); - } - - el.setAttribute(name, _value18 + ''); - } - - values[prop] = _value18; - } -}; - -function href() { - var loc; - return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; -} - -function SVGStringRenderer(loader) { - Renderer.call(this, loader); - this._text = { - head: '', - bg: '', - root: '', - foot: '', - defs: '', - body: '' - }; - this._defs = { - gradient: {}, - clipping: {} - }; -} - -var prototype$P = inherits(SVGStringRenderer, Renderer); -var base$2 = Renderer.prototype; - -prototype$P.resize = function (width, height, origin, scaleFactor) { - base$2.resize.call(this, width, height, origin, scaleFactor); - var o = this._origin, - t = this._text; - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - - for (var key in metadata) { - attr[key] = metadata[key]; - } - - t.head = openTag('svg', attr); - var bg = this._bgcolor; - if (bg === 'transparent' || bg === 'none') bg = null; - - if (bg) { - t.bg = openTag('rect', { - width: this._width, - height: this._height, - fill: bg - }) + closeTag('rect'); - } else { - t.bg = ''; - } - - t.root = openTag('g', extend({}, rootAttributes, { - transform: 'translate(' + o + ')' - })); - t.foot = closeTag('g') + closeTag('svg'); - return this; -}; - -prototype$P.background = function () { - var rv = base$2.background.apply(this, arguments); - - if (arguments.length && this._text.head) { - this.resize(this._width, this._height, this._origin, this._scale); - } - - return rv; -}; - -prototype$P.svg = function () { - var t = this._text; - return t.head + t.defs + t.bg + t.root + t.body + t.foot; -}; - -prototype$P._render = function (scene) { - this._text.body = this.mark(scene); - this._text.defs = this.buildDefs(); - return this; -}; - -prototype$P.buildDefs = function () { - var defs = '', - tag; - - for (var _id3 in this._defs.gradient) { - var _def = this._defs.gradient[_id3], - stops = _def.stops; - - if (_def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - defs += openTag(tag = 'pattern', { - id: patternPrefix + _id3, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - defs += openTag('rect', { - width: '1', - height: '1', - fill: 'url(#' + _id3 + ')' - }) + closeTag('rect'); - defs += closeTag(tag); - defs += openTag(tag = 'radialGradient', { - id: _id3, - fx: _def.x1, - fy: _def.y1, - fr: _def.r1, - cx: _def.x2, - cy: _def.y2, - r: _def.r2 - }); - } else { - defs += openTag(tag = 'linearGradient', { - id: _id3, - x1: _def.x1, - x2: _def.x2, - y1: _def.y1, - y2: _def.y2 - }); - } - - for (var i = 0; i < stops.length; ++i) { - defs += openTag('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }) + closeTag('stop'); - } - - defs += closeTag(tag); - } - - for (var _id4 in this._defs.clipping) { - var _def2 = this._defs.clipping[_id4]; - defs += openTag('clipPath', { - id: _id4 - }); - - if (_def2.path) { - defs += openTag('path', { - d: _def2.path - }) + closeTag('path'); - } else { - defs += openTag('rect', { - x: 0, - y: 0, - width: _def2.width, - height: _def2.height - }) + closeTag('rect'); - } - - defs += closeTag('clipPath'); - } - - return defs ? openTag('defs') + defs + closeTag('defs') : ''; -}; - -prototype$P.attr = function (scene, item, attrs, tag) { - var _this15 = this; - - var object = {}, - emit = function emit(name, value, ns, prefixed) { - object[prefixed || name] = value; - }; // apply mark specific attributes - - - if (Array.isArray(attrs)) { - attrs.forEach(function (fn) { - return fn(emit, item, _this15); - }); - } else { - attrs(emit, item, this); - } // apply style attributes - - - if (tag) { - applyStyles(object, item, scene, tag, this._defs); - } - - return object; -}; - -prototype$P.href = function (item) { - var that = this, - href = item.href, - attr; - - if (href) { - if (attr = that._hrefs && that._hrefs[href]) { - return attr; - } else { - that.sanitizeURL(href).then(function (attr) { - // rewrite to use xlink namespace - // note that this will be deprecated in SVG 2.0 - attr['xlink:href'] = attr.href; - attr.href = null; - (that._hrefs || (that._hrefs = {}))[href] = attr; - }); - } - } - - return null; -}; - -prototype$P.mark = function (scene) { - var _this16 = this; - - var mdef = Marks[scene.marktype], - tag = mdef.tag, - attrList = [ariaItemAttributes, mdef.attr]; - var str = ''; // render opening group tag - - str += openTag('g', extend({ - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip(this, scene, scene.group) : null - }, ariaMarkAttributes(scene), { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - })); // render contained elements - - var process = function process(item) { - var href = _this16.href(item); - - if (href) str += openTag('a', href); - str += openTag(tag, _this16.attr(scene, item, attrList, tag !== 'g' ? tag : null)); - - if (tag === 'text') { - var _tl = textLines(item); - - if (isArray(_tl)) { - // multi-line text - var attrs = { - x: 0, - dy: lineHeight(item) - }; - - for (var i = 0; i < _tl.length; ++i) { - str += openTag('tspan', i ? attrs : null) + escape_text(textValue(item, _tl[i])) + closeTag('tspan'); - } - } else { - // single-line text - str += escape_text(textValue(item, _tl)); - } - } else if (tag === 'g') { - var fore = item.strokeForeground, - _fill2 = item.fill, - _stroke = item.stroke; - - if (fore && _stroke) { - item.stroke = null; - } - - str += openTag('path', _this16.attr(scene, item, mdef.background, 'bgrect')) + closeTag('path'); - str += openTag('g', _this16.attr(scene, item, mdef.content)) + _this16.markGroup(item) + closeTag('g'); - - if (fore && _stroke) { - if (_fill2) item.fill = null; - item.stroke = _stroke; - str += openTag('path', _this16.attr(scene, item, mdef.foreground, 'bgrect')) + closeTag('path'); - if (_fill2) item.fill = _fill2; - } else { - str += openTag('path', _this16.attr(scene, item, mdef.foreground, 'bgfore')) + closeTag('path'); - } - } - - str += closeTag(tag); - if (href) str += closeTag('a'); - }; - - if (mdef.nested) { - if (scene.items && scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } // render closing group tag - - - return str + closeTag('g'); -}; - -prototype$P.markGroup = function (scene) { - var _this17 = this; - - var str = ''; - visit(scene, function (item) { - str += _this17.mark(item); - }); - return str; -}; - -function applyStyles(s, item, scene, tag, defs) { - if (item == null) return s; - - if (tag === 'bgrect' && scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - if (tag === 'bgfore') { - if (scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - s.display = 'none'; - if (item.fill !== null) return s; - } - - if (tag === 'image' && item.smooth === false) { - s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;'; - } - - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - if (item.fontStyle) s['font-style'] = item.fontStyle; - if (item.fontVariant) s['font-variant'] = item.fontVariant; - if (item.fontWeight) s['font-weight'] = item.fontWeight; - } - - for (var prop in styles) { - var _value19 = item[prop]; - var name = styles[prop]; - if (_value19 === 'transparent' && (name === 'fill' || name === 'stroke')) ;else if (_value19 != null) { - if (isGradient(_value19)) { - _value19 = gradientRef(_value19, defs.gradient, ''); - } - - s[name] = _value19; - } - } - - return s; -} - -function escape_text(s) { - return s.replace(/&/g, '&').replace(//g, '>'); -} - -var Canvas = 'canvas'; -var PNG = 'png'; -var SVG = 'svg'; -var None$2 = 'none'; -var RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - None: None$2 -}; -exports.RenderType = RenderType; -var modules = {}; -modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler -}; -modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler -}; -modules[None$2] = {}; - -function renderModule(name, _) { - name = String(name || '').toLowerCase(); - - if (arguments.length > 1) { - modules[name] = _; - return this; - } else { - return modules[name]; - } -} - -function intersect(scene, bounds, filter) { - var hits = [], - // intersection results - box = new Bounds().union(bounds), - // defensive copy - type = scene.marktype; - return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : error('Intersect scene must be mark node or group item.'); -} - -function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - var items = mark.items, - _type2 = mark.marktype, - n = items.length; - var i = 0; - - if (_type2 === 'group') { - for (; i < n; ++i) { - intersectGroup(items[i], box, filter, hits); - } - } else { - for (var test = Marks[_type2].isect; i < n; ++i) { - var item = items[i]; - if (intersectItem(item, box, test)) hits.push(item); - } - } - } - - return hits; -} - -function visitMark(mark, box, filter) { - // process if bounds intersect and if - // (1) mark is a group mark (so we must recurse), or - // (2) mark is interactive and passes filter - return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark))); -} - -function intersectGroup(group, box, filter, hits) { - // test intersect against group - // skip groups by default unless filter says otherwise - if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) { - hits.push(group); - } // recursively test children marks - // translate box to group coordinate space - - - var marks = group.items, - n = marks && marks.length; - - if (n) { - var _x22 = group.x || 0, - _y2 = group.y || 0; - - box.translate(-_x22, -_y2); - - for (var i = 0; i < n; ++i) { - intersectMark(marks[i], box, filter, hits); - } - - box.translate(_x22, _y2); - } - - return hits; -} - -function intersectItem(item, box, test) { - // test bounds enclosure, bounds intersection, then detailed test - var bounds = item.bounds; - return box.encloses(bounds) || box.intersects(bounds) && test(item, box); -} - -var clipBounds = new Bounds(); - -function boundClip(mark) { - var clip = mark.clip; - - if (isFunction(clip)) { - clip(context(clipBounds.clear())); - } else if (clip) { - clipBounds.set(0, 0, mark.group.width, mark.group.height); - } else return; - - mark.bounds.intersect(clipBounds); -} - -var TOLERANCE = 1e-9; - -function sceneEqual(a, b, key) { - return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : isNumber(a) && isNumber(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !isObject(a) && !isObject(b) ? a == b : a == null || b == null ? false : objectEqual(a, b); -} - -function pathEqual(a, b) { - return sceneEqual(pathParse(a), pathParse(b)); -} - -function objectEqual(a, b) { - var ka = Object.keys(a), - kb = Object.keys(b), - key, - i; - if (ka.length !== kb.length) return false; - ka.sort(); - kb.sort(); - - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) return false; - } - - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; - } - - return _typeof(a) === _typeof(b); -} - -function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); -} -/** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ - - -function Bound(params) { - Transform.call(this, null, params); -} - -var prototype$Q = inherits(Bound, Transform); - -prototype$Q.transform = function (_, pulse) { - var view = pulse.dataflow, - mark = _.mark, - type = mark.marktype, - entry = Marks[type], - bound = entry.bound, - markBounds = mark.bounds, - rebound; - - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem$1(mark, bound); - mark.items.forEach(function (item) { - item.bounds.clear().union(markBounds); - }); - } else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, function (item) { - return view.dirty(item); - }); - markBounds.clear(); - mark.items.forEach(function (item) { - return markBounds.union(boundItem$1(item, bound)); - }); // force reflow for axes/legends/titles to propagate any layout changes - - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - pulse.visit(pulse.ADD, function (item) { - markBounds.union(boundItem$1(item, bound)); - }); - pulse.visit(pulse.MOD, function (item) { - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem$1(item, bound)); - }); - - if (rebound) { - markBounds.clear(); - mark.items.forEach(function (item) { - return markBounds.union(item.bounds); - }); - } - } // ensure mark bounds do not exceed any clipping region - - - boundClip(mark); - return pulse.modifies('bounds'); -}; - -function boundItem$1(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); -} - -var COUNTER_NAME = ':vega_identifier:'; -/** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ - -function Identifier(params) { - Transform.call(this, 0, params); -} - -Identifier.Definition = { - 'type': 'Identifier', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'as', - 'type': 'string', - 'required': true - }] -}; -var prototype$R = inherits(Identifier, Transform); - -prototype$R.transform = function (_, pulse) { - var counter = getCounter(pulse.dataflow), - id = counter.value, - as = _.as; - pulse.visit(pulse.ADD, function (t) { - if (!t[as]) t[as] = ++id; - }); - counter.set(this.value = id); - return pulse; -}; - -function getCounter(view) { - var counter = view._signals[COUNTER_NAME]; - - if (!counter) { - view._signals[COUNTER_NAME] = counter = view.add(0); - } - - return counter; -} -/** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ - - -function Mark(params) { - Transform.call(this, null, params); -} - -var prototype$S = inherits(Mark, Transform); - -prototype$S.transform = function (_, pulse) { - var mark = this.value; // acquire mark on first invocation, bind context and group - - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } // initialize entering items - - - var Init = mark.marktype === Group ? GroupItem : Item; - pulse.visit(pulse.ADD, function (item) { - return Init.call(item, mark); - }); // update clipping and/or interactive status - - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - - pulse.reflow(); - } // bind items array to scenegraph mark - - - mark.items = pulse.source; - return pulse; -}; - -function lookup$1(_) { - var g = _.groups, - p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; -} -/** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ - - -function Overlap(params) { - Transform.call(this, null, params); -} - -var prototype$T = inherits(Overlap, Transform); -var methods = { - parity: function parity(items) { - return items.filter(function (item, i) { - return i % 2 ? item.opacity = 0 : 1; - }); - }, - greedy: function greedy(items, sep) { - var a; - return items.filter(function (b, i) { - if (!i || !intersect$1(a.bounds, b.bounds, sep)) { - a = b; - return 1; - } else { - return b.opacity = 0; - } - }); - } -}; // compute bounding box intersection -// including padding pixels of separation - -function intersect$1(a, b, sep) { - return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2); -} - -function hasOverlap(items, pad) { - for (var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i) { - if (intersect$1(a, b = items[i].bounds, pad)) return true; - } -} - -function hasBounds(item) { - var b = item.bounds; - return b.width() > 1 && b.height() > 1; -} - -function boundTest(scale, orient, tolerance) { - var range = scale.range(), - b = new Bounds(); - - if (orient === Top || orient === Bottom) { - b.set(range[0], -Infinity, range[1], +Infinity); - } else { - b.set(-Infinity, range[0], +Infinity, range[1]); - } - - b.expand(tolerance || 1); - return function (item) { - return b.encloses(item.bounds); - }; -} // reset all items to be fully opaque - - -function reset(source) { - source.forEach(function (item) { - return item.opacity = 1; - }); - return source; -} // add all tuples to mod, fork pulse if parameters were modified -// fork prevents cross-stream tuple pollution (e.g., pulse from scale) - - -function reflow(pulse, _) { - return pulse.reflow(_.modified()).modifies('opacity'); -} - -prototype$T.transform = function (_, pulse) { - var reduce = methods[_.method] || methods.parity, - source = pulse.materialize(pulse.SOURCE).source, - sep = _.separation || 0, - items, - test, - bounds; - if (!source || !source.length) return; - - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - - return pulse; - } // skip labels with no content - - - source = source.filter(hasBounds); // early exit, nothing to do - - if (!source.length) return; - - if (_.sort) { - source = source.slice().sort(_.sort); - } - - items = reset(source); - pulse = reflow(pulse, _); - - if (items.length >= 3 && hasOverlap(items, sep)) { - do { - items = reduce(items, sep); - } while (items.length >= 3 && hasOverlap(items, sep)); - - if (items.length < 3 && !peek(source).opacity) { - if (items.length > 1) peek(items).opacity = 0; - peek(source).opacity = 1; - } - } - - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach(function (item) { - if (!test(item)) item.opacity = 0; - }); - } // re-calculate mark bounds - - - bounds = items[0].mark.bounds.clear(); - source.forEach(function (item) { - if (item.opacity) bounds.union(item.bounds); - }); - return pulse; -}; -/** - * Queue modified scenegraph items for rendering. - * @constructor - */ - - -function Render(params) { - Transform.call(this, null, params); -} - -var prototype$U = inherits(Render, Transform); - -prototype$U.transform = function (_, pulse) { - var view = pulse.dataflow; - pulse.visit(pulse.ALL, function (item) { - return view.dirty(item); - }); // set z-index dirty flag as needed - - if (pulse.fields && pulse.fields['zindex']) { - var item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } -}; - -var tempBounds$1 = new Bounds(); - -function set$1(item, property, value) { - return item[property] === value ? 0 : (item[property] = value, 1); -} - -function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; -} - -function axisIndices(datum) { - var index = +datum.grid; - return [datum.ticks ? index++ : -1, // ticks index - datum.labels ? index++ : -1, // labels index - index + +datum.domain // title index - ]; -} - -function axisLayout(view, axis, width, height) { - var item = axis.items[0], - datum = item.datum, - delta = item.translate != null ? item.translate : 0.5, - orient = item.orient, - indices = axisIndices(datum), - range = item.range, - offset = item.offset, - position = item.position, - minExtent = item.minExtent, - maxExtent = item.maxExtent, - title = datum.title && item.items[indices[2]].items[0], - titlePadding = item.titlePadding, - bounds = item.bounds, - dl = title && multiLineOffset(title), - x = 0, - y = 0, - i, - s; - tempBounds$1.clear().union(bounds); - bounds.clear(); - if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds); // position axis group and title - - switch (orient) { - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - - default: - x = item.x; - y = item.y; - } // update bounds - - - boundStroke(bounds.translate(x, y), item); - - if (set$1(item, 'x', x + delta) | set$1(item, 'y', y + delta)) { - item.bounds = tempBounds$1; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - - return item.mark.bounds.clear().union(bounds); -} - -function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - var b = title.bounds; - - if (title.auto) { - var v = sign * (offset + dl + pad); - var dx = 0, - dy = 0; - view.dirty(title); - isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - - bounds.union(b); -} // aggregation functions for grid margin determination - - -var min$1 = function min$1(a, b) { - return Math.floor(Math.min(a, b)); -}; - -var max$1 = function max$1(a, b) { - return Math.ceil(Math.max(a, b)); -}; - -function gridLayoutGroups(group) { - var _views$rowheaders, _views$rowfooters, _views$colheaders, _views$colfooters, _views$marks; - - var groups = group.items, - n = groups.length, - i = 0, - mark, - items; - var views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; // layout axes, gather legends, collect bounds - - for (; i < n; ++i) { - mark = groups[i]; - items = mark.items; - - if (mark.marktype === Group) { - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - break; - - case RowHeader: - (_views$rowheaders = views.rowheaders).push.apply(_views$rowheaders, _toConsumableArray(items)); - - break; - - case RowFooter: - (_views$rowfooters = views.rowfooters).push.apply(_views$rowfooters, _toConsumableArray(items)); - - break; - - case ColHeader: - (_views$colheaders = views.colheaders).push.apply(_views$colheaders, _toConsumableArray(items)); - - break; - - case ColFooter: - (_views$colfooters = views.colfooters).push.apply(_views$colfooters, _toConsumableArray(items)); - - break; - - case RowTitle: - views.rowtitle = items[0]; - break; - - case ColTitle: - views.coltitle = items[0]; - break; - - default: - (_views$marks = views.marks).push.apply(_views$marks, _toConsumableArray(items)); - - } - } - } - - return views; -} - -function bboxFlush(item) { - return new Bounds().set(0, 0, item.width || 0, item.height || 0); -} - -function bboxFull(item) { - var b = item.bounds.clone(); - return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0)); -} - -function get$3(opt, key, d) { - var v = isObject(opt) ? opt[key] : opt; - return v != null ? v : d !== undefined ? d : 0; -} - -function offsetValue(v) { - return v < 0 ? Math.ceil(-v) : 0; -} - -function gridLayout(view, groups, opt) { - var dirty = !opt.nodirty, - bbox = opt.bounds === Flush ? bboxFlush : bboxFull, - bounds = tempBounds$1.set(0, 0, 0, 0), - alignCol = get$3(opt.align, Column), - alignRow = get$3(opt.align, Row), - padCol = get$3(opt.padding, Column), - padRow = get$3(opt.padding, Row), - ncols = opt.columns || groups.length, - nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), - n = groups.length, - xOffset = Array(n), - xExtent = Array(ncols), - xMax = 0, - yOffset = Array(n), - yExtent = Array(nrows), - yMax = 0, - dx = Array(n), - dy = Array(n), - boxes = Array(n), - m, - i, - c, - r, - b, - g, - px, - py, - x, - y, - offset; - - for (i = 0; i < ncols; ++i) { - xExtent[i] = 0; - } - - for (i = 0; i < nrows; ++i) { - yExtent[i] = 0; - } // determine offsets for each group - - - for (i = 0; i < n; ++i) { - g = groups[i]; - b = boxes[i] = bbox(g); - g.x = g.x || 0; - dx[i] = 0; - g.y = g.y || 0; - dy[i] = 0; - c = i % ncols; - r = ~~(i / ncols); - xMax = Math.max(xMax, px = Math.ceil(b.x2)); - yMax = Math.max(yMax, py = Math.ceil(b.y2)); - xExtent[c] = Math.max(xExtent[c], px); - yExtent[r] = Math.max(yExtent[r], py); - xOffset[i] = padCol + offsetValue(b.x1); - yOffset[i] = padRow + offsetValue(b.y1); - if (dirty) view.dirty(groups[i]); - } // set initial alignment offsets - - - for (i = 0; i < n; ++i) { - if (i % ncols === 0) xOffset[i] = 0; - if (i < ncols) yOffset[i] = 0; - } // enforce column alignment constraints - - - if (alignCol === Each) { - for (c = 1; c < ncols; ++c) { - for (offset = 0, i = c; i < n; i += ncols) { - if (offset < xOffset[i]) offset = xOffset[i]; - } - - for (i = c; i < n; i += ncols) { - xOffset[i] = offset + xExtent[c - 1]; - } - } - } else if (alignCol === All) { - for (offset = 0, i = 0; i < n; ++i) { - if (i % ncols && offset < xOffset[i]) offset = xOffset[i]; - } - - for (i = 0; i < n; ++i) { - if (i % ncols) xOffset[i] = offset + xMax; - } - } else { - for (alignCol = false, c = 1; c < ncols; ++c) { - for (i = c; i < n; i += ncols) { - xOffset[i] += xExtent[c - 1]; - } - } - } // enforce row alignment constraints - - - if (alignRow === Each) { - for (r = 1; r < nrows; ++r) { - for (offset = 0, i = r * ncols, m = i + ncols; i < m; ++i) { - if (offset < yOffset[i]) offset = yOffset[i]; - } - - for (i = r * ncols; i < m; ++i) { - yOffset[i] = offset + yExtent[r - 1]; - } - } - } else if (alignRow === All) { - for (offset = 0, i = ncols; i < n; ++i) { - if (offset < yOffset[i]) offset = yOffset[i]; - } - - for (i = ncols; i < n; ++i) { - yOffset[i] = offset + yMax; - } - } else { - for (alignRow = false, r = 1; r < nrows; ++r) { - for (i = r * ncols, m = i + ncols; i < m; ++i) { - yOffset[i] += yExtent[r - 1]; - } - } - } // perform horizontal grid layout - - - for (x = 0, i = 0; i < n; ++i) { - x = xOffset[i] + (i % ncols ? x : 0); - dx[i] += x - groups[i].x; - } // perform vertical grid layout - - - for (c = 0; c < ncols; ++c) { - for (y = 0, i = c; i < n; i += ncols) { - y += yOffset[i]; - dy[i] += y - groups[i].y; - } - } // perform horizontal centering - - - if (alignCol && get$3(opt.center, Column) && nrows > 1) { - for (i = 0; i < n; ++i) { - b = alignCol === All ? xMax : xExtent[i % ncols]; - x = b - boxes[i].x2 - groups[i].x - dx[i]; - if (x > 0) dx[i] += x / 2; - } - } // perform vertical centering - - - if (alignRow && get$3(opt.center, Row) && ncols !== 1) { - for (i = 0; i < n; ++i) { - b = alignRow === All ? yMax : yExtent[~~(i / ncols)]; - y = b - boxes[i].y2 - groups[i].y - dy[i]; - if (y > 0) dy[i] += y / 2; - } - } // position grid relative to anchor - - - for (i = 0; i < n; ++i) { - bounds.union(boxes[i].translate(dx[i], dy[i])); - } - - x = get$3(opt.anchor, X); - y = get$3(opt.anchor, Y); - - switch (get$3(opt.anchor, Column)) { - case End: - x -= bounds.width(); - break; - - case Middle: - x -= bounds.width() / 2; - } - - switch (get$3(opt.anchor, Row)) { - case End: - y -= bounds.height(); - break; - - case Middle: - y -= bounds.height() / 2; - } - - x = Math.round(x); - y = Math.round(y); // update mark positions, bounds, dirty - - bounds.clear(); - - for (i = 0; i < n; ++i) { - groups[i].mark.bounds.clear(); - } - - for (i = 0; i < n; ++i) { - g = groups[i]; - g.x += dx[i] += x; - g.y += dy[i] += y; - bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); - if (dirty) view.dirty(g); - } - - return bounds; -} - -function trellisLayout(view, group, opt) { - var views = gridLayoutGroups(group), - groups = views.marks, - bbox = opt.bounds === Flush ? boundFlush : boundFull, - off = opt.offset, - ncols = opt.columns || groups.length, - nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), - cells = nrows * ncols, - x, - y, - x2, - y2, - anchor, - band, - offset; // -- initial grid layout - - var bounds = gridLayout(view, groups, opt); - if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid - // -- layout grid headers and footers -- - // perform row header layout - - if (views.rowheaders) { - band = get$3(opt.headerBand, Row, null); - x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get$3(off, 'rowHeader'), min$1, 0, bbox, 'x1', 0, ncols, 1, band); - } // perform column header layout - - - if (views.colheaders) { - band = get$3(opt.headerBand, Column, null); - y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get$3(off, 'columnHeader'), min$1, 1, bbox, 'y1', 0, 1, ncols, band); - } // perform row footer layout - - - if (views.rowfooters) { - band = get$3(opt.footerBand, Row, null); - x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get$3(off, 'rowFooter'), max$1, 0, bbox, 'x2', ncols - 1, ncols, 1, band); - } // perform column footer layout - - - if (views.colfooters) { - band = get$3(opt.footerBand, Column, null); - y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get$3(off, 'columnFooter'), max$1, 1, bbox, 'y2', cells - ncols, 1, ncols, band); - } // perform row title layout - - - if (views.rowtitle) { - anchor = get$3(opt.titleAnchor, Row); - offset = get$3(off, 'rowTitle'); - offset = anchor === End ? x2 + offset : x - offset; - band = get$3(opt.titleBand, Row, 0.5); - layoutTitle(view, views.rowtitle, offset, 0, bounds, band); - } // perform column title layout - - - if (views.coltitle) { - anchor = get$3(opt.titleAnchor, Column); - offset = get$3(off, 'columnTitle'); - offset = anchor === End ? y2 + offset : y - offset; - band = get$3(opt.titleBand, Column, 0.5); - layoutTitle(view, views.coltitle, offset, 1, bounds, band); - } -} - -function boundFlush(item, field) { - return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined; -} - -function boundFull(item, field) { - return item.bounds[field]; -} - -function layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) { - var n = groups.length, - init = 0, - edge = 0, - i, - j, - k, - m, - b, - h, - g, - x, - y; // if no groups, early exit and return 0 - - if (!n) return init; // compute margin - - for (i = start; i < n; i += stride) { - if (groups[i]) init = agg(init, bound(groups[i], bf)); - } // if no headers, return margin calculation - - - if (!headers.length) return init; // check if number of headers exceeds number of rows or columns - - if (headers.length > limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } // apply offset - - - init += offset; // clear mark bounds for all headers - - for (j = 0, m = headers.length; j < m; ++j) { - view.dirty(headers[j]); - headers[j].mark.bounds.clear(); - } // layout each header - - - for (i = start, j = 0, m = headers.length; j < m; ++j, i += stride) { - h = headers[j]; - b = h.mark.bounds; // search for nearest group to align to - // necessary if table has empty cells - - for (k = i; k >= 0 && (g = groups[k]) == null; k -= back) { - ; - } // assign coordinates and update bounds - - - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); // update current edge of layout bounds - - edge = agg(edge, b[bf]); - } - - return edge; -} - -function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); // compute title coordinates - - var x = offset, - y = offset; - isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height()); // assign coordinates and update bounds - - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; // queue title for redraw - - view.dirty(g); -} // utility for looking up legend layout configuration - - -function lookup$2(config, orient) { - var opt = config[orient] || {}; - return function (key, d) { - return opt[key] != null ? opt[key] : config[key] != null ? config[key] : d; - }; -} // if legends specify offset directly, use the maximum specified value - - -function offsets(legends, value) { - var max = -Infinity; - legends.forEach(function (item) { - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; -} - -function legendParams(g, orient, config, xb, yb, w, h) { - var _ = lookup$2(config, orient), - offset = offsets(g, _('offset', 0)), - anchor = _('anchor', Start), - mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - - var p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - - switch (orient) { - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, - column: End, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, - row: End, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - - case TopLeft: - p.anchor = { - x: offset, - y: offset - }; - break; - - case TopRight: - p.anchor = { - x: w - offset, - y: offset, - column: End - }; - break; - - case BottomLeft: - p.anchor = { - x: offset, - y: h - offset, - row: End - }; - break; - - case BottomRight: - p.anchor = { - x: w - offset, - y: h - offset, - column: End, - row: End - }; - break; - } - - return p; -} - -function legendLayout(view, legend) { - var item = legend.items[0], - datum = item.datum, - orient = item.orient, - bounds = item.bounds, - x = item.x, - y = item.y, - w, - h; // cache current bounds for later comparison - - item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone(); - bounds.clear(); // adjust legend to accommodate padding and title - - legendGroupLayout(view, item, item.items[0].items[0]); // aggregate bounds to determine size, and include origin - - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - - if (datum.type === Symbols) { - legendEntryLayout(item.items[0].items[0].items[0].items); - } - - if (orient !== None$1) { - item.x = x = 0; - item.y = y = 0; - } - - item.width = w; - item.height = h; - boundStroke(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - return item; -} - -function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach(function (_) { - return b.union(_.bounds); - }); // anchor to legend origin - - b.x1 = item.padding; - b.y1 = item.padding; - return b; -} - -function legendGroupLayout(view, item, entry) { - var pad = item.padding, - ex = pad - entry.x, - ey = pad - entry.y; - - if (!item.datum.title) { - if (ex || ey) translate$1(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], - anchor = title.anchor, - tpad = item.titlePadding || 0, - tx = pad - title.x, - ty = pad - title.y; - - switch (title.orient) { - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - - case Right: - case Bottom: - break; - - default: - ey += title.bounds.height() + tpad; - } - - if (ex || ey) translate$1(view, entry, ex, ey); - - switch (title.orient) { - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - - if (tx || ty) translate$1(view, title, tx, ty); // translate legend if title pushes into negative coordinates - - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate$1(view, entry, -tx, 0); - translate$1(view, title, -tx, 0); - } - } -} - -function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - var grad = item.datum.type !== 'symbol', - vgrad = title.datum.vgrad, - e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, - s = e.bounds[y ? 'y2' : 'x2'] - item.padding, - u = vgrad && lr ? s : 0, - v = vgrad && lr ? 0 : s, - o = y <= 0 ? 0 : multiLineOffset(title); - return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o)); -} - -function translate$1(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); -} - -function legendEntryLayout(entries) { - // get max widths for each column - var widths = entries.reduce(function (w, g) { - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); // set dimensions of legend entry groups - - entries.forEach(function (g) { - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); -} - -function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], - frame = group.frame, - orient = group.orient, - anchor = group.anchor, - offset = group.offset, - padding = group.padding, - title = group.items[0].items[0], - subtitle = group.items[1] && group.items[1].items[0], - end = orient === Left || orient === Right ? height : width, - start = 0, - x = 0, - y = 0, - sx = 0, - sy = 0, - pos; - - if (frame !== Group) { - orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2); - } else if (orient === Left) { - start = height, end = 0; - } - - pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2; - - if (subtitle && subtitle.text) { - // position subtitle - switch (orient) { - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - - case Left: - sx = title.bounds.width() + padding; - break; - - case Right: - sx = -title.bounds.width() - padding; - break; - } - - tempBounds$1.clear().union(subtitle.bounds); - tempBounds$1.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - - if (set$1(subtitle, 'x', sx) | set$1(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds$1); - subtitle.mark.bounds.clear().union(tempBounds$1); - view.dirty(subtitle); - } - - tempBounds$1.clear().union(subtitle.bounds); - } else { - tempBounds$1.clear(); - } - - tempBounds$1.union(title.bounds); // position title group - - switch (orient) { - case Top: - x = pos; - y = viewBounds.y1 - tempBounds$1.height() - offset; - break; - - case Left: - x = viewBounds.x1 - tempBounds$1.width() - offset; - y = pos; - break; - - case Right: - x = viewBounds.x2 + tempBounds$1.width() + offset; - y = pos; - break; - - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - - default: - x = group.x; - y = group.y; - } - - if (set$1(group, 'x', x) | set$1(group, 'y', y)) { - tempBounds$1.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds$1); - mark.bounds.clear().union(tempBounds$1); - view.dirty(group); - } - - return group.bounds; -} -/** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ - - -function ViewLayout(params) { - Transform.call(this, null, params); -} - -var prototype$V = inherits(ViewLayout, Transform); - -prototype$V.transform = function (_, pulse) { - var view = pulse.dataflow; - - _.mark.items.forEach(function (group) { - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; -}; - -function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; -} - -function layoutGroup(view, group, _) { - var items = group.items, - width = Math.max(0, group.width || 0), - height = Math.max(0, group.height || 0), - viewBounds = new Bounds().set(0, 0, width, height), - xBounds = viewBounds.clone(), - yBounds = viewBounds.clone(), - legends = [], - title, - mark, - orient, - b, - i, - n; // layout axes, gather legends, collect bounds - - for (i = 0, n = items.length; i < n; ++i) { - mark = items[i]; - - switch (mark.role) { - case AxisRole: - b = isYAxis(mark) ? xBounds : yBounds; - b.union(axisLayout(view, mark, width, height)); - break; - - case TitleRole: - title = mark; - break; - - case LegendRole: - legends.push(legendLayout(view, mark)); - break; - - case FrameRole: - case ScopeRole: - case RowHeader: - case RowFooter: - case RowTitle: - case ColHeader: - case ColFooter: - case ColTitle: - xBounds.union(mark.bounds); - yBounds.union(mark.bounds); - break; - - default: - viewBounds.union(mark.bounds); - } - } // layout legends, adjust viewBounds - - - if (legends.length) { - // group legends by orient - var l = {}; - legends.forEach(function (item) { - orient = item.orient || Right; - if (orient !== None$1) (l[orient] || (l[orient] = [])).push(item); - }); // perform grid layout for each orient group - - for (var _orient in l) { - var g = l[_orient]; - gridLayout(view, g, legendParams(g, _orient, _.legends, xBounds, yBounds, width, height)); - } // update view bounds - - - legends.forEach(function (item) { - var b = item.bounds; - - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - - item.bounds = b; - view.dirty(item); - } - - if (_.autosize && _.autosize.type === Fit) { - // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch (item.orient) { - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - } else { - viewBounds.union(b); - } - }); - } // combine bounding boxes - - - viewBounds.union(xBounds).union(yBounds); // layout title, adjust bounds - - if (title) { - viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - } // override aggregated view bounds if content is clipped - - - if (group.clip) { - viewBounds.set(0, 0, group.width || 0, group.height || 0); - } // perform size adjustment - - - viewSizeLayout(view, group, viewBounds, _); -} - -function viewSizeLayout(view, group, viewBounds, _) { - var auto = _.autosize || {}, - type = auto.type; - if (view._autosize < 1 || !type) return; - var viewWidth = view._width, - viewHeight = view._height, - width = Math.max(0, group.width || 0), - left = Math.max(0, Math.ceil(-viewBounds.x1)), - right = Math.max(0, Math.ceil(viewBounds.x2 - width)), - height = Math.max(0, group.height || 0), - top = Math.max(0, Math.ceil(-viewBounds.y1)), - bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - - if (auto.contains === Padding) { - var _padding = view.padding(); - - viewWidth -= _padding.left + _padding.right; - viewHeight -= _padding.top + _padding.bottom; - } - - if (type === None$1) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - - view._resizeView(viewWidth, viewHeight, width, height, [left, top], auto.resize); -} - -var vtx = /*#__PURE__*/Object.freeze({ - __proto__: null, - bound: Bound, - identifier: Identifier, - mark: Mark, - overlap: Overlap, - render: Render, - viewlayout: ViewLayout -}); -/** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - -function AxisTicks(params) { - Transform.call(this, null, params); -} - -var prototype$W = inherits(AxisTicks, Transform); - -prototype$W.transform = function (_, pulse) { - if (this.value && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - ticks = this.value, - scale = _.scale, - tally = _.count == null ? _.values ? _.values.length : 10 : _.count, - count = tickCount(scale, tally, _.minstep), - format = _.format || tickFormat$1(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), - values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count); - if (ticks) out.rem = ticks; - ticks = values.map(function (value, i) { - return ingest({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - }); - }); - - if (_.extra && ticks.length) { - // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push(ingest({ - index: -1, - extra: { - value: ticks[0].value - }, - label: '' - })); - } - - out.source = ticks; - out.add = ticks; - this.value = ticks; - return out; -}; -/** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ - - -function DataJoin(params) { - Transform.call(this, null, params); -} - -var prototype$X = inherits(DataJoin, Transform); - -function defaultItemCreate() { - return ingest({}); -} - -function newMap(key) { - var map = fastmap().test(function (t) { - return t.exit; - }); - - map.lookup = function (t) { - return map.get(key(t)); - }; - - return map; -} - -prototype$X.transform = function (_, pulse) { - var df = pulse.dataflow, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - item = _.item || defaultItemCreate, - key = _.key || tupleid, - map = this.value; // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - - if (isArray(out.encode)) { - out.encode = null; - } - - if (map && (_.modified('key') || pulse.modified(key))) { - error('DataJoin does not support modified key function or fields.'); - } - - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - - pulse.visit(pulse.ADD, function (t) { - var k = key(t); - var x = map.get(k); - - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else { - out.mod.push(x); - } - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - - x.datum = t; - x.exit = false; - }); - pulse.visit(pulse.MOD, function (t) { - var k = key(t), - x = map.get(k); - - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - pulse.visit(pulse.REM, function (t) { - var k = key(t), - x = map.get(k); - - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) { - df.runAfter(map.clean); - } - - return out; -}; -/** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ - - -function Encode(params) { - Transform.call(this, null, params); -} - -var prototype$Y = inherits(Encode, Transform); - -prototype$Y.transform = function (_, pulse) { - var out = pulse.fork(pulse.ADD_REM), - fmod = _.mod || false, - encoders = _.encoders, - encode = pulse.encode; // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - - if (isArray(encode)) { - if (out.changed() || encode.every(function (e) { - return encoders[e]; - })) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else { - return pulse.StopPropagation; - } - } // marshall encoder functions - - - var reenter = encode === 'enter', - update = encoders.update || falsy, - enter = encoders.enter || falsy, - exit = encoders.exit || falsy, - set = (encode && !reenter ? encoders[encode] : update) || falsy; - - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, function (t) { - enter(t, _); - update(t, _); - }); - out.modifies(enter.output); - out.modifies(update.output); - - if (set !== falsy && set !== update) { - pulse.visit(pulse.ADD, function (t) { - set(t, _); - }); - out.modifies(set.output); - } - } - - if (pulse.changed(pulse.REM) && exit !== falsy) { - pulse.visit(pulse.REM, function (t) { - exit(t, _); - }); - out.modifies(exit.output); - } - - if (reenter || set !== falsy) { - var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - - if (reenter) { - pulse.visit(flag, function (t) { - var mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else { - pulse.visit(flag, function (t) { - if (set(t, _) || fmod) out.mod.push(t); - }); - } - - if (out.mod.length) out.modifies(set.output); - } - - return out.changed() ? out : pulse.StopPropagation; -}; -/** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - - -function LegendEntries(params) { - Transform.call(this, [], params); -} - -var prototype$Z = inherits(LegendEntries, Transform); - -prototype$Z.transform = function (_, pulse) { - if (this.value != null && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - items = this.value, - type = _.type || SymbolLegend, - scale = _.scale, - limit = +_.limit, - count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep), - lskip = !!_.values || type === SymbolLegend, - format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), - values = _.values || labelValues(scale, count), - domain, - fraction, - size, - offset, - ellipsis; - if (items) out.rem = items; - - if (type === SymbolLegend) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else { - items = values; - } - - if (isFunction(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) { - items = items.slice(1); - } // compute size offset for legend entries - - - offset = items.reduce(function (max, value) { - return Math.max(max, size(value, _)); - }, 0); - } else { - size = constant(offset = size || 8); - } - - items = items.map(function (value, index) { - return ingest({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - }); - }); - - if (ellipsis) { - ellipsis = values[items.length]; - items.push(ingest({ - index: items.length, - label: "\u2026".concat(values.length - items.length, " entries"), - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } else if (type === GradientLegend) { - domain = scale.domain(), fraction = scaleFraction(scale, domain[0], peek(domain)); // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - - if (values.length < 3 && !_.values && domain[0] !== peek(domain)) { - values = [domain[0], peek(domain)]; - } - - items = values.map(function (value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - }); - }); - } else { - size = values.length - 1; - fraction = labelFraction(scale); - items = values.map(function (value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index + 1]) - }); - }); - } - - out.source = items; - out.add = items; - this.value = items; - return out; -}; - -var Paths = fastmap({ - 'line': line$2, - 'line-radial': lineR, - 'arc': arc$2, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR -}); - -function sourceX(t) { - return t.source.x; -} - -function sourceY(t) { - return t.source.y; -} - -function targetX(t) { - return t.target.x; -} - -function targetY(t) { - return t.target.y; -} -/** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - -function LinkPath(params) { - Transform.call(this, {}, params); -} - -LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'sourceX', - 'type': 'field', - 'default': 'source.x' - }, { - 'name': 'sourceY', - 'type': 'field', - 'default': 'source.y' - }, { - 'name': 'targetX', - 'type': 'field', - 'default': 'target.x' - }, { - 'name': 'targetY', - 'type': 'field', - 'default': 'target.y' - }, { - 'name': 'orient', - 'type': 'enum', - 'default': 'vertical', - 'values': ['horizontal', 'vertical', 'radial'] - }, { - 'name': 'shape', - 'type': 'enum', - 'default': 'line', - 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal'] - }, { - 'name': 'require', - 'type': 'signal' - }, { - 'name': 'as', - 'type': 'string', - 'default': 'path' - }] -}; -var prototype$_ = inherits(LinkPath, Transform); - -prototype$_.transform = function (_, pulse) { - var sx = _.sourceX || sourceX, - sy = _.sourceY || sourceY, - tx = _.targetX || targetX, - ty = _.targetY || targetY, - as = _.as || 'path', - orient = _.orient || 'vertical', - shape = _.shape || 'line', - path = Paths.get(shape + '-' + orient) || Paths.get(shape); - - if (!path) { - error('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : '')); - } - - pulse.visit(pulse.SOURCE, function (t) { - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - return pulse.reflow(_.modified()).modifies(as); -}; // -- Link Path Generation Methods ----- - - -function line$2(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + 'L' + tx + ',' + ty; -} - -function lineR(sa, sr, ta, tr) { - return line$2(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -} - -function arc$2(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - rr = Math.sqrt(dx * dx + dy * dy) / 2, - ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty; -} - -function arcR(sa, sr, ta, tr) { - return arc$2(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -} - -function curve(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - ix = 0.2 * (dx + dy), - iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty; -} - -function curveR(sa, sr, ta, tr) { - return curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -} - -function orthoX(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + 'V' + ty + 'H' + tx; -} - -function orthoY(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + 'H' + tx + 'V' + ty; -} - -function orthoR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts; -} - -function diagonalX(sx, sy, tx, ty) { - var m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty; -} - -function diagonalY(sx, sy, tx, ty) { - var m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty; -} - -function diagonalR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - mr = (sr + tr) / 2; - return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts; -} -/** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ - - -function Pie(params) { - Transform.call(this, null, params); -} - -Pie.Definition = { - 'type': 'Pie', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'startAngle', - 'type': 'number', - 'default': 0 - }, { - 'name': 'endAngle', - 'type': 'number', - 'default': 6.283185307179586 - }, { - 'name': 'sort', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['startAngle', 'endAngle'] - }] -}; -var prototype$$ = inherits(Pie, Transform); - -prototype$$.transform = function (_, pulse) { - var as = _.as || ['startAngle', 'endAngle'], - startAngle = as[0], - endAngle = as[1], - field = _.field || one, - start = _.startAngle || 0, - stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, - data = pulse.source, - values = data.map(field), - n = values.length, - a = start, - k = (stop - start) / sum(values), - index = sequence(n), - i, - t, - v; - - if (_.sort) { - index.sort(function (a, b) { - return values[a] - values[b]; - }); - } - - for (i = 0; i < n; ++i) { - v = values[index[i]]; - t = data[index[i]]; - t[startAngle] = a; - t[endAngle] = a += v * k; - } - - this.value = values; - return pulse.reflow(_.modified()).modifies(as); -}; - -var DEFAULT_COUNT = 5; - -function includeZero(scale) { - var type = scale.type; - return !scale.bins && (type === Linear || type === Pow || type === Sqrt); -} - -function includePad(type) { - return isContinuous(type) && type !== Sequential; -} - -var SKIP$2 = toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']); -/** - * Maintains a scale function mapping data values to visual channels. - * @constructor - * @param {object} params - The parameters for this operator. - */ - -function Scale(params) { - Transform.call(this, null, params); - this.modified(true); // always treat as modified -} - -var prototype$10 = inherits(Scale, Transform); - -prototype$10.transform = function (_, pulse) { - var df = pulse.dataflow, - scale = this.value, - key = scaleKey(_); - - if (!scale || key !== scale.type) { - this.value = scale = scale$2(key)(); - } - - for (key in _) { - if (!SKIP$2[key]) { - // padding is a scale property for band/point but not others - if (key === 'padding' && includePad(scale.type)) continue; // invoke scale property setter, raise warning if not found - - isFunction(scale[key]) ? scale[key](_[key]) : df.warn('Unsupported scale property: ' + key); - } - } - - configureRange(scale, _, configureBins(scale, _, configureDomain(scale, _, df))); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); -}; - -function scaleKey(_) { - var t = _.type, - d = '', - n; // backwards compatibility pre Vega 5. - - if (t === Sequential) return Sequential + '-' + Linear; - - if (isContinuousColor(_)) { - n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; - d = n === 2 ? Sequential + '-' : n === 3 ? Diverging + '-' : ''; - } - - return (d + t || Linear).toLowerCase(); -} - -function isContinuousColor(_) { - var t = _.type; - return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString)); -} - -function configureDomain(scale, _, df) { - // check raw domain, if provided use that and exit early - var raw = rawDomain(scale, _.domainRaw, df); - if (raw > -1) return raw; - var domain = _.domain, - type = scale.type, - zero = _.zero || _.zero === undefined && includeZero(scale), - n, - mid; - if (!domain) return 0; // adjust continuous domain for minimum pixel padding - - if (includePad(type) && _.padding && domain[0] !== peek(domain)) { - domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - } // adjust domain based on zero, min, max settings - - - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = (domain = domain.slice()).length - 1 || 1; - - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - - if (_.domainMid != null) { - mid = _.domainMid; - var i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } // set the scale domain - - - scale.domain(domainCheck(type, domain, df)); // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - - if (type === Ordinal) { - scale.unknown(_.domainImplicit ? implicit : undefined); - } // perform 'nice' adjustment as requested - - - if (_.nice && scale.nice) { - scale.nice(_.nice !== true && tickCount(scale, _.nice) || null); - } // return the cardinality of the domain - - - return domain.length; -} - -function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else { - return -1; - } -} - -function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs(peek(range) - range[0]), - frac = span / (span - 2 * pad), - d = type === Log ? zoomLog(domain, null, frac) : type === Sqrt ? zoomPow(domain, null, frac, 0.5) : type === Pow ? zoomPow(domain, null, frac, exponent || 1) : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) : zoomLinear(domain, null, frac); - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length - 1] = d[1]; - return domain; -} - -function domainCheck(type, domain, df) { - if (isLogarithmic(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce(function (s, v) { - return s + (v < 0 ? -1 : v > 0 ? 1 : 0); - }, 0)); - - if (s !== domain.length) { - df.warn('Log scale domain includes zero: ' + $(domain)); - } - } - - return domain; -} - -function configureBins(scale, _, count) { - var bins = _.bins; - - if (bins && !isArray(bins)) { - // generate bin boundary array - var _domain2 = scale.domain(), - lo = _domain2[0], - hi = peek(_domain2), - start = bins.start == null ? lo : bins.start, - _stop = bins.stop == null ? hi : bins.stop, - step = bins.step; - - if (!step) error('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (_stop > hi) _stop = step * Math.floor(hi / step); - bins = sequence(start, _stop + step / 2, step); - } - - if (bins) { - // assign bin boundaries to scale instance - scale.bins = bins; - } else if (scale.bins) { - // no current bins, remove bins if previously set - delete scale.bins; - } // special handling for bin-ordinal scales - - - if (scale.type === BinOrdinal) { - if (!bins) { - // the domain specifies the bins - scale.bins = scale.domain(); - } else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } // return domain cardinality - - - return count; -} - -function configureRange(scale, _, count) { - var type = scale.type, - round = _.round || false, - range = _.range; // if range step specified, calculate full range extent - - if (_.rangeStep != null) { - range = configureRangeStep(type, _, count); - } // else if a range scheme is defined, use that - else if (_.scheme) { - range = configureScheme(type, _, count); - - if (isFunction(range)) { - if (scale.interpolator) { - return scale.interpolator(range); - } else { - error("Scale type ".concat(type, " does not support interpolating color schemes.")); - } - } - } // given a range array for an interpolating scale, convert to interpolator - - - if (range && isInterpolating(type)) { - return scale.interpolator(interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma)); - } // configure rounding / interpolation - - - if (range && _.interpolate && scale.interpolate) { - scale.interpolate(interpolate(_.interpolate, _.interpolateGamma)); - } else if (isFunction(scale.round)) { - scale.round(round); - } else if (isFunction(scale.rangeRound)) { - scale.interpolate(round ? $$1.interpolateRound : $$1.interpolate); - } - - if (range) scale.range(flip(range, _.reverse)); -} - -function configureRangeStep(type, _, count) { - if (type !== Band && type !== Point) { - error('Only band and point scales support rangeStep.'); - } // calculate full range based on requested step size and padding - - - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, - inner = type === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; - return [0, _.rangeStep * bandSpace(count, inner, outer)]; -} - -function configureScheme(type, _, count) { - var extent = _.schemeExtent, - name, - scheme$1; - - if (isArray(_.scheme)) { - scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); - } else { - name = _.scheme.toLowerCase(); - scheme$1 = scheme(name); - if (!scheme$1) error("Unrecognized scheme name: ".concat(_.scheme)); - } // determine size for potential discrete range - - - count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === Quantile$1 || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate - - return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) : type === Ordinal ? scheme$1 : scheme$1.slice(0, count); -} - -function adjustScheme(scheme, extent, reverse) { - return isFunction(scheme) && (extent || reverse) ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) : scheme; -} - -function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; -} -/** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ - - -function SortItems(params) { - Transform.call(this, null, params); -} - -var prototype$11 = inherits(SortItems, Transform); - -prototype$11.transform = function (_, pulse) { - var mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum'); - if (mod) pulse.source.sort(stableCompare(_.sort)); - this.modified(mod); - return pulse; -}; - -var Zero = 'zero', - Center = 'center', - Normalize = 'normalize', - DefOutput = ['y0', 'y1']; -/** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ - -function Stack(params) { - Transform.call(this, null, params); -} - -Stack.Definition = { - 'type': 'Stack', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'offset', - 'type': 'enum', - 'default': Zero, - 'values': [Zero, Center, Normalize] - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': DefOutput - }] -}; -var prototype$12 = inherits(Stack, Transform); - -prototype$12.transform = function (_, pulse) { - var as = _.as || DefOutput, - y0 = as[0], - y1 = as[1], - sort = stableCompare(_.sort), - field = _.field || one, - stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, - groups, - i, - n, - max; // partition, sum, and sort the stack groups - - groups = partition$2(pulse.source, _.groupby, sort, field); // compute stack layouts per group - - for (i = 0, n = groups.length, max = groups.max; i < n; ++i) { - stack(groups[i], max, field, y0, y1); - } - - return pulse.reflow(_.modified()).modifies(as); -}; - -function stackCenter(group, max, field, y0, y1) { - var last = (max - group.sum) / 2, - m = group.length, - j = 0, - t; - - for (; j < m; ++j) { - t = group[j]; - t[y0] = last; - t[y1] = last += Math.abs(field(t)); - } -} - -function stackNormalize(group, max, field, y0, y1) { - var scale = 1 / group.sum, - last = 0, - m = group.length, - j = 0, - v = 0, - t; - - for (; j < m; ++j) { - t = group[j]; - t[y0] = last; - t[y1] = last = scale * (v += Math.abs(field(t))); - } -} - -function stackZero(group, max, field, y0, y1) { - var lastPos = 0, - lastNeg = 0, - m = group.length, - j = 0, - v, - t; - - for (; j < m; ++j) { - t = group[j]; - v = +field(t); - - if (v < 0) { - t[y0] = lastNeg; - t[y1] = lastNeg += v; - } else { - t[y0] = lastPos; - t[y1] = lastPos += v; - } - } -} - -function partition$2(data, groupby, sort, field) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - m, - t, - k, - g, - s, - max; // partition data points into stack groups - - - if (groupby == null) { - groups.push(data.slice()); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - groups.push(g); - } - - g.push(t); - } - } // compute sums of groups, sort groups as needed - - - for (k = 0, max = 0, m = groups.length; k < m; ++k) { - g = groups[k]; - - for (i = 0, s = 0, n = g.length; i < n; ++i) { - s += Math.abs(field(g[i])); - } - - g.sum = s; - if (s > max) max = s; - if (sort) g.sort(sort); - } - - groups.max = max; - return groups; -} - -var encode = /*#__PURE__*/Object.freeze({ - __proto__: null, - axisticks: AxisTicks, - datajoin: DataJoin, - encode: Encode, - legendentries: LegendEntries, - linkpath: LinkPath, - pie: Pie, - scale: Scale, - sortitems: SortItems, - stack: Stack -}); - -function noop$2() {} - -var cases = [[], [[[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]]], []]; // Implementation adapted from d3/d3-contour. Thanks! - -function contours() { - var dx = 1, - dy = 1, - smooth = smoothLinear; - - function contours(values, tz) { - 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.js - - - function contour(values, value) { - var polygons = [], - holes = []; - isorings(values, value, function (ring) { - smooth(ring, values, value); - if (area$2(ring) > 0) polygons.push([ring]);else holes.push(ring); - }); - holes.forEach(function (hole) { - for (var i = 0, n = polygons.length, polygon; i < n; ++i) { - if (contains((polygon = polygons[i])[0], hole) !== -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/stitch.js - - - function isorings(values, value, callback) { - var fragmentByStart = new Array(), - fragmentByEnd = new Array(), - x, - y, - t0, - t1, - t2, - t3; // Special case for the first row (y = -1, t2 = t3 = 0). - - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - - while (++x < dx - 1) { - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - - cases[t1 << 0].forEach(stitch); // General case for the intermediate rows. - - while (++y < dy - 1) { - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - - while (++x < dx - 1) { - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - - cases[t1 | t2 << 3].forEach(stitch); - } // Special case for the last row (y = dy - 1, t0 = t1 = 0). - - - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - - while (++x < dx - 1) { - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - - cases[t2 << 3].forEach(stitch); - - function stitch(line) { - var start = [line[0][0] + x, line[0][1] + y], - end = [line[1][0] + x, line[1][1] + y], - startIndex = index(start), - endIndex = index(end), - f, - g; - - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[f.start] = fragmentByEnd[g.end] = { - start: f.start, - end: g.end, - ring: f.ring.concat(g.ring) - }; - } - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[g.start] = fragmentByEnd[f.end] = { - start: g.start, - end: f.end, - ring: g.ring.concat(f.ring) - }; - } - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else { - fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { - 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 = point[0], - y = point[1], - xt = x | 0, - yt = y | 0, - v0, - v1 = values[yt * dx + xt]; - - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); - } - - contours.contour = contour; - - contours.size = function (_) { - if (!arguments.length) return [dx, dy]; - - var _0 = Math.floor(_[0]), - _1 = Math.floor(_[1]); - - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, contours; - }; - - contours.smooth = function (_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop$2, contours) : smooth === smoothLinear; - }; - - return contours; -} - -function area$2(ring) { - var i = 0, - n = ring.length, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - - while (++i < n) { - area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - } - - return area; -} - -function contains(ring, hole) { - var i = -1, - n = hole.length, - c; - - while (++i < n) { - if (c = ringContains(ring, hole[i])) return c; - } - - return 0; -} - -function ringContains(ring, point) { - var x = point[0], - y = point[1], - contains = -1; - - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], - xi = pi[0], - yi = pi[1], - pj = ring[j], - xj = pj[0], - yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains; - } - - return contains; -} - -function segmentContains(a, b, c) { - var i; - return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); -} - -function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); -} - -function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; -} - -function quantize$1(k, nice, zero) { - return function (values) { - var ex = extent(values), - start = zero ? Math.min(ex[0], 0) : ex[0], - stop = ex[1], - span = stop - start, - step = nice ? tickStep(start, stop, k) : span / (k + 1); - return sequence(step, stop, step); - }; -} -/** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ - - -function Isocontour(params) { - Transform.call(this, null, params); -} - -Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, { - 'name': 'levels', - 'type': 'number' - }, { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, { - 'name': 'resolve', - 'type': 'enum', - 'values': ['shared', 'independent'], - 'default': 'independent' - }, { - 'name': 'zero', - 'type': 'boolean', - 'default': true - }, { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }, { - 'name': 'scale', - 'type': 'number', - 'expr': true - }, { - 'name': 'translate', - 'type': 'number', - 'array': true, - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'default': 'contour' - }] -}; -var prototype$13 = inherits(Isocontour, Transform); - -prototype$13.transform = function (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - field = _.field || identity, - contour = contours().smooth(_.smooth !== false), - tz = _.thresholds || levels(source, field, _), - as = _.as === null ? null : _.as || 'contour', - values = []; - source.forEach(function (t) { - var grid = field(t); // generate contour paths in GeoJSON format - - var paths = contour.size([grid.width, grid.height])(grid.values, isArray(tz) ? tz : tz(grid.values)); // adjust contour path coordinates as needed - - transformPaths(paths, grid, t, _); // ingest; copy source data properties to output - - paths.forEach(function (p) { - values.push(rederive(t, ingest(as != null ? _defineProperty({}, as, p) : p))); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; -}; - -function levels(values, f, _) { - var q = quantize$1(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' ? q : q(values.map(function (t) { - return max(f(t).values); - })); -} - -function transformPaths(paths, grid, datum, _) { - var s = _.scale || grid.scale, - t = _.translate || grid.translate; - if (isFunction(s)) s = s(datum, _); - if (isFunction(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - var sx = (isNumber(s) ? s : s[0]) || 1, - sy = (isNumber(s) ? s : s[1]) || 1, - tx = t && t[0] || 0, - ty = t && t[1] || 0; - paths.forEach(transform$1(grid, sx, sy, tx, ty)); -} - -function transform$1(grid, sx, sy, tx, ty) { - var x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - flip = sx * sy < 0; - - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); - } - - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - - coordinates.forEach(transformPoint); - } - - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; - } - - return function (geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; - }; -} - -function radius(bw, data, f) { - var v = bw >= 0 ? bw : bandwidthNRD(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); -} - -function number$4(_) { - return isFunction(_) ? _ : constant(+_); -} // Implementation adapted from d3/d3-contour. Thanks! - - -function density2D() { - var x = function x(d) { - return d[0]; - }, - y = function y(d) { - return d[1]; - }, - weight = one, - bandwidth = [-1, -1], - dx = 960, - dy = 500, - k = 2; // log2(cellSize) - - - function density(data, counts) { - var rx = radius(bandwidth[0], data, x) >> k, - // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, - // blur y-radius - ox = rx ? rx + 2 : 0, - // x-offset padding for blur - oy = ry ? ry + 2 : 0, - // y-offset padding for blur - n = 2 * ox + (dx >> k), - // grid width - m = 2 * oy + (dy >> k), - // grid height - values0 = new Float32Array(n * m), - values1 = new Float32Array(n * m); - var values = values0; - data.forEach(function (d) { - var xi = ox + (+x(d) >> k), - yi = oy + (+y(d) >> k); - - if (xi >= 0 && xi < n && yi >= 0 && yi < m) { - values0[xi + yi * n] += +weight(d); - } - }); - - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } // scale density estimates - // density in points per square pixel or probability density - - - var s = counts ? Math.pow(2, -2 * k) : 1 / sum(values); - - for (var i = 0, _sz = n * m; i < _sz; ++i) { - values[i] *= s; - } - - return { - values: values, - scale: 1 << k, - width: n, - height: m, - x1: ox, - y1: oy, - x2: ox + (dx >> k), - y2: oy + (dy >> k) - }; - } - - density.x = function (_) { - return arguments.length ? (x = number$4(_), density) : x; - }; - - density.y = function (_) { - return arguments.length ? (y = number$4(_), density) : y; - }; - - density.weight = function (_) { - return arguments.length ? (weight = number$4(_), density) : weight; - }; - - density.size = function (_) { - if (!arguments.length) return [dx, dy]; - - var _0 = +_[0], - _1 = +_[1]; - - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, density; - }; - - density.cellSize = function (_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) error('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - - density.bandwidth = function (_) { - if (!arguments.length) return bandwidth; - _ = array(_); - if (_.length === 1) _ = [+_[0], +_[0]]; - if (_.length !== 2) error('invalid bandwidth'); - return bandwidth = _, density; - }; - - return density; -} - -function blurX(n, m, source, target, r) { - var w = (r << 1) + 1; - - for (var j = 0; j < m; ++j) { - for (var i = 0, sr = 0; i < n + r; ++i) { - if (i < n) { - sr += source[i + j * n]; - } - - if (i >= r) { - if (i >= w) { - sr -= source[i - w + j * n]; - } - - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } - } -} - -function blurY(n, m, source, target, r) { - var w = (r << 1) + 1; - - for (var i = 0; i < n; ++i) { - for (var j = 0, sr = 0; j < m + r; ++j) { - if (j < m) { - sr += source[i + j * n]; - } - - if (j >= r) { - if (j >= w) { - sr -= source[i + (j - w) * n]; - } - - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } - } -} -/** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ - - -function KDE2D(params) { - Transform.call(this, null, params); -} - -KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, { - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'weight', - 'type': 'field' - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'cellSize', - 'type': 'number' - }, { - 'name': 'bandwidth', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'default': 'grid' - }] -}; -var prototype$14 = inherits(KDE2D, Transform); -var PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth']; - -function params(obj, _) { - PARAMS.forEach(function (param) { - return _[param] != null ? obj[param](_[param]) : 0; - }); - return obj; -} - -prototype$14.transform = function (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - groups = partition$3(source, _.groupby), - names = (_.groupby || []).map(accessorName), - kde = params(density2D(), _), - as = _.as || 'grid', - values = []; - - function set(t, vals) { - for (var i = 0; i < names.length; ++i) { - t[names[i]] = vals[i]; - } - - return t; - } // generate density raster grids - - - values = groups.map(function (g) { - return ingest(set(_defineProperty({}, as, kde(g, _.counts)), g.dims)); - }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; -}; - -function partition$3(data, groupby) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - t, - k, - g; // partition data points into groups - - - if (groupby == null) { - groups.push(data); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - - g.push(t); - } - } - - return groups; -} -/** - * Generate contours based on kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ - - -function Contour(params) { - Transform.call(this, null, params); -} - -Contour.Definition = { - 'type': 'Contour', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, { - 'name': 'values', - 'type': 'number', - 'array': true - }, { - 'name': 'x', - 'type': 'field' - }, { - 'name': 'y', - 'type': 'field' - }, { - 'name': 'weight', - 'type': 'field' - }, { - 'name': 'cellSize', - 'type': 'number' - }, { - 'name': 'bandwidth', - 'type': 'number' - }, { - 'name': 'count', - 'type': 'number' - }, { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }] -}; -var prototype$15 = inherits(Contour, Transform); - -prototype$15.transform = function (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - contour = contours().smooth(_.smooth !== false), - values = _.values, - thresh = _.thresholds || quantize$1(_.count || 10, _.nice, !!values), - size = _.size, - grid, - post; - - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform$1(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [grid.width, grid.height]; - values = grid.values; - } - - thresh = isArray(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map(ingest); - return out; -}; - -var Feature = 'Feature'; -var FeatureCollection = 'FeatureCollection'; -var MultiPoint = 'MultiPoint'; -/** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ - -function GeoJSON(params) { - Transform.call(this, null, params); -} - -GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'length': 2 - }, { - 'name': 'geojson', - 'type': 'field' - }] -}; -var prototype$16 = inherits(GeoJSON, Transform); - -prototype$16.transform = function (_, pulse) { - var features = this._features, - points = this._points, - fields = _.fields, - lon = fields && fields[0], - lat = fields && fields[1], - geojson = _.geojson || !fields && identity, - flag = pulse.ADD, - mod; - mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified(accessorFields(geojson)) || lon && pulse.modified(accessorFields(lon)) || lat && pulse.modified(accessorFields(lat)); - - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = features = []; - this._points = points = []; - } - - if (geojson) { - pulse.visit(flag, function (t) { - features.push(geojson(t)); - }); - } - - if (lon && lat) { - pulse.visit(flag, function (t) { - var x = lon(t), - y = lat(t); - - if (x != null && y != null && (x = +x) === x && (y = +y) === y) { - points.push([x, y]); - } - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - - this.value = { - type: FeatureCollection, - features: features - }; -}; - -var abs = Math.abs; -var cos = Math.cos; -var sin = Math.sin; -var epsilon$1 = 1e-6; -var pi = Math.PI; -var halfPi = pi / 2; -var sqrt2 = sqrt$1(2); - -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} - -function sqrt$1(x) { - return x > 0 ? Math.sqrt(x) : 0; -} - -function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * sin(phi), - i = 30, - delta; - - do { - phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi)); - } while (abs(delta) > epsilon$1 && --i > 0); - - return phi / 2; -} - -function mollweideBromleyRaw(cx, cy, cp) { - function forward(lambda, phi) { - return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)]; - } - - forward.invert = function (x, y) { - return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)]; - }; - - return forward; -} - -var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); - -function geoMollweide() { - return (0, _d3Geo.geoProjection)(mollweideRaw).scale(169.529); -} - -var defaultPath = (0, _d3Geo.geoPath)(); -var projectionProperties = [// standard properties in d3-geo -'clipAngle', 'clipExtent', 'scale', 'translate', 'center', 'rotate', 'parallels', 'precision', 'reflectX', 'reflectY', // extended properties in d3-geo-projections -'coefficient', 'distance', 'fraction', 'lobes', 'parallel', 'radius', 'ratio', 'spacing', 'tilt']; -/** - * Augment projections with their type and a copy method. - */ - -function create$1(type, constructor) { - return function projection() { - var p = constructor(); - p.type = type; - p.path = (0, _d3Geo.geoPath)().projection(p); - - p.copy = p.copy || function () { - var c = projection(); - projectionProperties.forEach(function (prop) { - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - - return p; - }; -} - -function projection(type, proj) { - if (!type || typeof type !== 'string') { - throw new Error('Projection type must be a name string.'); - } - - type = type.toLowerCase(); - - if (arguments.length > 1) { - projections[type] = create$1(type, proj); - return this; - } else { - return projections[type] || null; - } -} - -function getProjectionPath(proj) { - return proj && proj.path || defaultPath; -} - -var projections = { - // base d3-geo projection types - albers: _d3Geo.geoAlbers, - albersusa: _d3Geo.geoAlbersUsa, - azimuthalequalarea: _d3Geo.geoAzimuthalEqualArea, - azimuthalequidistant: _d3Geo.geoAzimuthalEquidistant, - conicconformal: _d3Geo.geoConicConformal, - conicequalarea: _d3Geo.geoConicEqualArea, - conicequidistant: _d3Geo.geoConicEquidistant, - equalEarth: _d3Geo.geoEqualEarth, - equirectangular: _d3Geo.geoEquirectangular, - gnomonic: _d3Geo.geoGnomonic, - identity: _d3Geo.geoIdentity, - mercator: _d3Geo.geoMercator, - mollweide: geoMollweide, - naturalEarth1: _d3Geo.geoNaturalEarth1, - orthographic: _d3Geo.geoOrthographic, - stereographic: _d3Geo.geoStereographic, - transversemercator: _d3Geo.geoTransverseMercator -}; - -for (var key$1 in projections) { - projection(key$1, projections[key$1]); -} -/** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ - - -function GeoPath(params) { - Transform.call(this, null, params); -} - -GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'projection', - 'type': 'projection' - }, { - 'name': 'field', - 'type': 'field' - }, { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'default': 'path' - }] -}; -var prototype$17 = inherits(GeoPath, Transform); - -prototype$17.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - path = this.value, - field = _.field || identity, - as = _.as || 'path', - flag = out.SOURCE; - - function set(t) { - t[as] = path(field(t)); - } - - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = getProjectionPath(_.projection); - out.materialize().reflow(); - } else { - flag = field === identity || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD; - } - - var prev = initPath(path, _.pointRadius); - out.visit(flag, set); - path.pointRadius(prev); - return out.modifies(as); -}; - -function initPath(path, pointRadius) { - var prev = path.pointRadius(); - path.context(null); - - if (pointRadius != null) { - path.pointRadius(pointRadius); - } - - return prev; -} -/** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ - - -function GeoPoint(params) { - Transform.call(this, null, params); -} - -GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'projection', - 'type': 'projection', - 'required': true - }, { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['x', 'y'] - }] -}; -var prototype$18 = inherits(GeoPoint, Transform); - -prototype$18.transform = function (_, pulse) { - var proj = _.projection, - lon = _.fields[0], - lat = _.fields[1], - as = _.as || ['x', 'y'], - x = as[0], - y = as[1], - mod; - - function set(t) { - var xy = proj([lon(t), lat(t)]); - - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - - if (_.modified()) { - // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - } else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - - return pulse.modifies(as); -}; -/** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ - - -function GeoShape(params) { - Transform.call(this, null, params); -} - -GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': { - 'modifies': true, - 'nomod': true - }, - 'params': [{ - 'name': 'projection', - 'type': 'projection' - }, { - 'name': 'field', - 'type': 'field', - 'default': 'datum' - }, { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'default': 'shape' - }] -}; -var prototype$19 = inherits(GeoShape, Transform); - -prototype$19.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - shape = this.value, - as = _.as || 'shape', - flag = out.ADD; - - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator(getProjectionPath(_.projection), _.field || field('datum'), _.pointRadius); - out.materialize().reflow(); - flag = out.SOURCE; - } - - out.visit(flag, function (t) { - t[as] = shape; - }); - return out.modifies(as); -}; - -function shapeGenerator(path, field, pointRadius) { - var shape = pointRadius == null ? function (_) { - return path(field(_)); - } : function (_) { - var prev = path.pointRadius(), - value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - - shape.context = function (_) { - path.context(_); - return shape; - }; - - return shape; -} -/** - * GeoJSON feature generator for creating graticules. - * @constructor - */ - - -function Graticule(params) { - Transform.call(this, [], params); - this.generator = (0, _d3Geo.geoGraticule)(); -} - -Graticule.Definition = { - 'type': 'Graticule', - 'metadata': { - 'changes': true, - 'generates': true - }, - 'params': [{ - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'extentMajor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'extentMinor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'step', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'stepMajor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [90, 360] - }, { - 'name': 'stepMinor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [10, 10] - }, { - 'name': 'precision', - 'type': 'number', - 'default': 2.5 - }] -}; -var prototype$1a = inherits(Graticule, Transform); - -prototype$1a.transform = function (_, pulse) { - var src = this.value, - gen = this.generator, - t; - - if (!src.length || _.modified()) { - for (var prop in _) { - if (isFunction(gen[prop])) { - gen[prop](_[prop]); - } - } - } - - t = gen(); - - if (src.length) { - pulse.mod.push(replace(src[0], t)); - } else { - pulse.add.push(ingest(t)); - } - - src[0] = t; - return pulse; -}; -/** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ - - -function Heatmap(params) { - Transform.call(this, null, params); -} - -Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'color', - 'type': 'string', - 'expr': true - }, { - 'name': 'opacity', - 'type': 'number', - 'expr': true - }, { - 'name': 'resolve', - 'type': 'enum', - 'values': ['shared', 'independent'], - 'default': 'independent' - }, { - 'name': 'as', - 'type': 'string', - 'default': 'image' - }] -}; -var prototype$1b = inherits(Heatmap, Transform); - -prototype$1b.transform = function (_, pulse) { - if (!pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var source = pulse.materialize(pulse.SOURCE).source, - shared = _.resolve === 'shared', - field = _.field || identity, - opacity = opacity_(_.opacity, _), - color = color_(_.color, _), - as = _.as || 'image', - obj = { - $x: 0, - $y: 0, - $value: 0, - $max: shared ? max(source.map(function (t) { - return max(field(t).values); - })) : 0 - }; - source.forEach(function (t) { - var v = field(t); // build proxy data object - - var o = extend({}, t, obj); // set maximum value if not globally shared - - if (!shared) o.$max = max(v.values || []); // generate canvas image - // optimize color/opacity if not pixel-dependent - - t[as] = toCanvas(v, o, color.dep ? color : constant(color(o)), opacity.dep ? opacity : constant(opacity(o))); - }); - return pulse.reflow(true).modifies(as); -}; // get image color function - - -function color_(color, _) { - var f; - - if (isFunction(color)) { - f = function f(obj) { - return (0, _d3Color.rgb)(color(obj, _)); - }; - - f.dep = dependency(color); - } else { - // default to mid-grey - f = constant((0, _d3Color.rgb)(color || '#888')); - } - - return f; -} // get image opacity function - - -function opacity_(opacity, _) { - var f; - - if (isFunction(opacity)) { - f = function f(obj) { - return opacity(obj, _); - }; - - f.dep = dependency(opacity); - } else if (opacity) { - f = constant(opacity); - } else { - // default to [0, max] opacity gradient - f = function f(obj) { - return obj.$value / obj.$max || 0; - }; - - f.dep = true; - } - - return f; -} // check if function depends on individual pixel data - - -function dependency(f) { - if (!isFunction(f)) return false; - var set = toSet(accessorFields(f)); - return set.$x || set.$y || set.$value || set.$max; -} // render raster grid to canvas - - -function toCanvas(grid, obj, color, opacity) { - var n = grid.width, - m = grid.height, - x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - x2 = grid.x2 || n, - y2 = grid.y2 || m, - val = grid.values, - value = val ? function (i) { - return val[i]; - } : zero, - can = domCanvas(x2 - x1, y2 - y1), - ctx = can.getContext('2d'), - img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), - pix = img.data; - - for (var j = y1, k = 0; j < y2; ++j) { - obj.$y = j - y1; - - for (var i = x1, r = j * n; i < x2; ++i, k += 4) { - obj.$x = i - x1; - obj.$value = value(i + r); - var v = color(obj); - pix[k + 0] = v.r; - pix[k + 1] = v.g; - pix[k + 2] = v.b; - pix[k + 3] = ~~(255 * opacity(obj)); - } - } - - ctx.putImageData(img, 0, 0); - return can; -} -/** - * Maintains a cartographic projection. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - -function Projection(params) { - Transform.call(this, null, params); - this.modified(true); // always treat as modified -} - -var prototype$1c = inherits(Projection, Transform); - -prototype$1c.transform = function (_, pulse) { - var proj = this.value; - - if (!proj || _.modified('type')) { - this.value = proj = create$2(_.type); - projectionProperties.forEach(function (prop) { - if (_[prop] != null) set$2(proj, prop, _[prop]); - }); - } else { - projectionProperties.forEach(function (prop) { - if (_.modified(prop)) set$2(proj, prop, _[prop]); - }); - } - - if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); - if (_.fit) fit(proj, _); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); -}; - -function fit(proj, _) { - var data = collectGeoJSON(_.fit); - _.extent ? proj.fitExtent(_.extent, data) : _.size ? proj.fitSize(_.size, data) : 0; -} - -function create$2(type) { - var constructor = projection((type || 'mercator').toLowerCase()); - if (!constructor) error('Unrecognized projection type: ' + type); - return constructor(); -} - -function set$2(proj, key, value) { - if (isFunction(proj[key])) proj[key](value); -} - -function collectGeoJSON(data) { - data = array(data); - return data.length === 1 ? data[0] : { - type: FeatureCollection, - features: data.reduce(function (a, f) { - return a.concat(featurize(f)); - }, []) - }; -} - -function featurize(f) { - return f.type === FeatureCollection ? f.features : array(f).filter(function (d) { - return d != null; - }).map(function (d) { - return d.type === Feature ? d : { - type: Feature, - geometry: d - }; - }); -} - -var geo = /*#__PURE__*/Object.freeze({ - __proto__: null, - contour: Contour, - geojson: GeoJSON, - geopath: GeoPath, - geopoint: GeoPoint, - geoshape: GeoShape, - graticule: Graticule, - heatmap: Heatmap, - isocontour: Isocontour, - kde2d: KDE2D, - projection: Projection -}); -var ForceMap = { - center: _d3Force.forceCenter, - collide: _d3Force.forceCollide, - nbody: _d3Force.forceManyBody, - link: _d3Force.forceLink, - x: _d3Force.forceX, - y: _d3Force.forceY -}; -var Forces = 'forces', - ForceParams = ['alpha', 'alphaMin', 'alphaTarget', 'velocityDecay', 'forces'], - ForceConfig = ['static', 'iterations'], - ForceOutput = ['x', 'y', 'vx', 'vy']; -/** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.forces - The forces to apply. - */ - -function Force(params) { - Transform.call(this, null, params); -} - -Force.Definition = { - 'type': 'Force', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'static', - 'type': 'boolean', - 'default': false - }, { - 'name': 'restart', - 'type': 'boolean', - 'default': false - }, { - 'name': 'iterations', - 'type': 'number', - 'default': 300 - }, { - 'name': 'alpha', - 'type': 'number', - 'default': 1 - }, { - 'name': 'alphaMin', - 'type': 'number', - 'default': 0.001 - }, { - 'name': 'alphaTarget', - 'type': 'number', - 'default': 0 - }, { - 'name': 'velocityDecay', - 'type': 'number', - 'default': 0.4 - }, { - 'name': 'forces', - 'type': 'param', - 'array': true, - 'params': [{ - 'key': { - 'force': 'center' - }, - 'params': [{ - 'name': 'x', - 'type': 'number', - 'default': 0 - }, { - 'name': 'y', - 'type': 'number', - 'default': 0 - }] - }, { - 'key': { - 'force': 'collide' - }, - 'params': [{ - 'name': 'radius', - 'type': 'number', - 'expr': true - }, { - 'name': 'strength', - 'type': 'number', - 'default': 0.7 - }, { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'force': 'nbody' - }, - 'params': [{ - 'name': 'strength', - 'type': 'number', - 'default': -30 - }, { - 'name': 'theta', - 'type': 'number', - 'default': 0.9 - }, { - 'name': 'distanceMin', - 'type': 'number', - 'default': 1 - }, { - 'name': 'distanceMax', - 'type': 'number' - }] - }, { - 'key': { - 'force': 'link' - }, - 'params': [{ - 'name': 'links', - 'type': 'data' - }, { - 'name': 'id', - 'type': 'field' - }, { - 'name': 'distance', - 'type': 'number', - 'default': 30, - 'expr': true - }, { - 'name': 'strength', - 'type': 'number', - 'expr': true - }, { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'force': 'x' - }, - 'params': [{ - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, { - 'name': 'x', - 'type': 'field' - }] - }, { - 'key': { - 'force': 'y' - }, - 'params': [{ - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, { - 'name': 'y', - 'type': 'field' - }] - }] - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'modify': false, - 'default': ForceOutput - }] -}; -var prototype$1d = inherits(Force, Transform); - -prototype$1d.transform = function (_, pulse) { - var sim = this.value, - change = pulse.changed(pulse.ADD_REM), - params = _.modified(ForceParams), - iters = _.iterations || 300; // configure simulation - - - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - - pulse.modifies('index'); - } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - - if (params || pulse.changed(pulse.MOD)) { - setup(sim, _, 0, pulse); - } - } // run simulation - - - if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - - if (_.static) { - for (sim.stop(); --iters >= 0;) { - sim.tick(); - } - } else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } - } - - return this.finish(_, pulse); -}; - -prototype$1d.finish = function (_, pulse) { - var dataflow = pulse.dataflow; // inspect dependencies, touch link source data - - for (var args = this._argops, j = 0, m = args.length, arg; j < m; ++j) { - arg = args[j]; - - if (arg.name !== Forces || arg.op._argval.force !== 'link') { - continue; - } - - for (var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i) { - if (ops[i].name === 'links' && (op = ops[i].op.source)) { - dataflow.pulse(op, dataflow.changeset().reflow()); - break; - } - } - } // reflow all nodes - - - return pulse.reflow(_.modified()).modifies(ForceOutput); -}; - -function rerun(df, op) { - return function () { - df.touch(op).run(); - }; -} - -function simulation(nodes, _) { - var sim = (0, _d3Force.forceSimulation)(nodes), - stopped = false, - stop = sim.stop, - restart = sim.restart; - - sim.stopped = function () { - return stopped; - }; - - sim.restart = function () { - stopped = false; - return restart(); - }; - - sim.stop = function () { - stopped = true; - return stop(); - }; - - return setup(sim, _, true).on('end', function () { - stopped = true; - }); -} - -function setup(sim, _, init, pulse) { - var f = array(_.forces), - i, - n, - p, - name; - - for (i = 0, n = ForceParams.length; i < n; ++i) { - p = ForceParams[i]; - if (p !== Forces && _.modified(p)) sim[p](_[p]); - } - - for (i = 0, n = f.length; i < n; ++i) { - name = Forces + i; - p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null; - if (p) sim.force(name, p); - } - - for (n = sim.numForces || 0; i < n; ++i) { - sim.force(Forces + i, null); // remove - } - - sim.numForces = f.length; - return sim; -} - -function modified(f, pulse) { - var k, v; - - for (k in f) { - if (isFunction(v = f[k]) && pulse.modified(accessorFields(v))) return 1; - } - - return 0; -} - -function getForce(_) { - var f, p; - - if (!hasOwnProperty(ForceMap, _.force)) { - error('Unrecognized force: ' + _.force); - } - - f = ForceMap[_.force](); - - for (p in _) { - if (isFunction(f[p])) setForceParam(f[p], _[p], _); - } - - return f; -} - -function setForceParam(f, v, _) { - f(isFunction(v) ? function (d) { - return v(d, _); - } : v); -} - -var force = /*#__PURE__*/Object.freeze({ - __proto__: null, - force: Force -}); // Build lookup table mapping tuple keys to tree node instances - -function lookup$3(tree, key, filter) { - var map = {}; - tree.each(function (node) { - var t = node.data; - if (filter(t)) map[key(t)] = node; - }); - tree.lookup = map; - return tree; -} -/** - * Nest tuples into a tree structure, grouped by key values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ - - -function Nest(params) { - Transform.call(this, null, params); -} - -Nest.Definition = { - 'type': 'Nest', - 'metadata': { - 'treesource': true, - 'changes': true - }, - 'params': [{ - 'name': 'keys', - 'type': 'field', - 'array': true - }, { - 'name': 'generate', - 'type': 'boolean' - }] -}; -var prototype$1e = inherits(Nest, Transform); - -function children(n) { - return n.values; -} - -prototype$1e.transform = function (_, pulse) { - if (!pulse.source) { - error('Nest transform requires an upstream data source.'); - } - - var gen = _.generate, - mod = _.modified(), - out = pulse.clone(), - tree = this.value; - - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) { - tree.each(function (node) { - if (node.children && isTuple(node.data)) { - out.rem.push(node.data); - } - }); - } // generate new tree structure - - - this.value = tree = (0, _d3Hierarchy.hierarchy)({ - values: array(_.keys).reduce(function (n, k) { - n.key(k); - return n; - }, nest()).entries(out.source) - }, children); // collect nodes to add - - if (gen) { - tree.each(function (node) { - if (node.children) { - node = ingest(node.data); - out.add.push(node); - out.source.push(node); - } - }); - } // build lookup table - - - lookup$3(tree, tupleid, tupleid); - } - - out.source.root = tree; - return out; -}; - -function nest() { - var keys = [], - nest; - - function apply(array, depth) { - if (depth >= keys.length) { - return array; - } - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - value, - valuesByKey = {}, - values, - result = {}; - - while (++i < n) { - keyValue = key(value = array[i]) + ''; - - if (values = valuesByKey[keyValue]) { - values.push(value); - } else { - valuesByKey[keyValue] = [value]; - } - } - - for (keyValue in valuesByKey) { - result[keyValue] = apply(valuesByKey[keyValue], depth); - } - - return result; - } - - function _entries(map, depth) { - if (++depth > keys.length) return map; - var array = [], - k; - - for (k in map) { - array.push({ - key: k, - values: _entries(map[k], depth) - }); - } - - return array; - } - - return nest = { - entries: function entries(array) { - return _entries(apply(array, 0), 0); - }, - key: function key(d) { - keys.push(d); - return nest; - } - }; -} -/** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - -function HierarchyLayout(params) { - Transform.call(this, null, params); -} - -var prototype$1f = inherits(HierarchyLayout, Transform); - -prototype$1f.transform = function (_, pulse) { - if (!pulse.source || !pulse.source.root) { - error(this.constructor.name + ' transform requires a backing tree data source.'); - } - - var layout = this.layout(_.method), - fields = this.fields, - root = pulse.source.root, - as = _.as || fields; - if (_.field) root.sum(_.field);else root.count(); - if (_.sort) root.sort(stableCompare(_.sort, function (d) { - return d.data; - })); - setParams(layout, this.params, _); - - if (layout.separation) { - layout.separation(_.separation !== false ? defaultSeparation : one); - } - - try { - this.value = layout(root); - } catch (err) { - error(err); - } - - root.each(function (node) { - setFields(node, fields, as); - }); - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); -}; - -function setParams(layout, params, _) { - for (var p, i = 0, n = params.length; i < n; ++i) { - p = params[i]; - if (p in _) layout[p](_[p]); - } -} - -function setFields(node, fields, as) { - var t = node.data; - - for (var i = 0, n = fields.length - 1; i < n; ++i) { - t[as[i]] = node[fields[i]]; - } - - t[as[n]] = node.children ? node.children.length : 0; -} - -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} - -var Output$1 = ['x', 'y', 'r', 'depth', 'children']; -/** - * Packed circle tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ - -function Pack(params) { - HierarchyLayout.call(this, params); -} - -Pack.Definition = { - 'type': 'Pack', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, { - 'name': 'radius', - 'type': 'field', - 'default': null - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$1.length, - 'default': Output$1 - }] -}; -var prototype$1g = inherits(Pack, HierarchyLayout); -prototype$1g.layout = _d3Hierarchy.pack; -prototype$1g.params = ['radius', 'size', 'padding']; -prototype$1g.fields = Output$1; -var Output$2 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children']; -/** - * Partition tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ - -function Partition(params) { - HierarchyLayout.call(this, params); -} - -Partition.Definition = { - 'type': 'Partition', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$2.length, - 'default': Output$2 - }] -}; -var prototype$1h = inherits(Partition, HierarchyLayout); -prototype$1h.layout = _d3Hierarchy.partition; -prototype$1h.params = ['size', 'round', 'padding']; -prototype$1h.fields = Output$2; -/** - * Stratify a collection of tuples into a tree structure based on - * id and parent id fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.key - Unique key field for each tuple. - * @param {function(object): *} params.parentKey - Field with key for parent tuple. - */ - -function Stratify(params) { - Transform.call(this, null, params); -} - -Stratify.Definition = { - 'type': 'Stratify', - 'metadata': { - 'treesource': true - }, - 'params': [{ - 'name': 'key', - 'type': 'field', - 'required': true - }, { - 'name': 'parentKey', - 'type': 'field', - 'required': true - }] -}; -var prototype$1i = inherits(Stratify, Transform); - -prototype$1i.transform = function (_, pulse) { - if (!pulse.source) { - error('Stratify transform requires an upstream data source.'); - } - - var tree = this.value, - mod = _.modified(), - out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE), - run = !this.value || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields); // prevent upstream source pollution - - - out.source = out.source.slice(); - - if (run) { - if (out.source.length) { - tree = lookup$3((0, _d3Hierarchy.stratify)().id(_.key).parentId(_.parentKey)(out.source), _.key, truthy); - } else { - tree = lookup$3((0, _d3Hierarchy.stratify)()([{}]), _.key, _.key); - } - } - - out.source.root = this.value = tree; - return out; -}; - -var Layouts = { - tidy: _d3Hierarchy.tree, - cluster: _d3Hierarchy.cluster -}; -var Output$3 = ['x', 'y', 'depth', 'children']; -/** - * Tree layout. Depending on the method parameter, performs either - * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ - -function Tree(params) { - HierarchyLayout.call(this, params); -} - -Tree.Definition = { - 'type': 'Tree', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'method', - 'type': 'enum', - 'default': 'tidy', - 'values': ['tidy', 'cluster'] - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'nodeSize', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'separation', - 'type': 'boolean', - 'default': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$3.length, - 'default': Output$3 - }] -}; -var prototype$1j = inherits(Tree, HierarchyLayout); -/** - * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. - */ - -prototype$1j.layout = function (method) { - var m = method || 'tidy'; - if (hasOwnProperty(Layouts, m)) return Layouts[m]();else error('Unrecognized Tree layout method: ' + m); -}; - -prototype$1j.params = ['size', 'nodeSize']; -prototype$1j.fields = Output$3; -/** - * Generate tuples representing links between tree nodes. - * The resulting tuples will contain 'source' and 'target' fields, - * which point to parent and child node tuples, respectively. - * @constructor - * @param {object} params - The parameters for this operator. - */ - -function TreeLinks(params) { - Transform.call(this, [], params); -} - -TreeLinks.Definition = { - 'type': 'TreeLinks', - 'metadata': { - 'tree': true, - 'generates': true, - 'changes': true - }, - 'params': [] -}; -var prototype$1k = inherits(TreeLinks, Transform); - -prototype$1k.transform = function (_, pulse) { - var links = this.value, - tree = pulse.source && pulse.source.root, - out = pulse.fork(pulse.NO_SOURCE), - lut = {}; - if (!tree) error('TreeLinks transform requires a tree data source.'); - - if (pulse.changed(pulse.ADD_REM)) { - // remove previous links - out.rem = links; // build lookup table of valid tuples - - pulse.visit(pulse.SOURCE, function (t) { - lut[tupleid(t)] = 1; - }); // generate links for all edges incident on valid tuples - - tree.each(function (node) { - var t = node.data, - p = node.parent && node.parent.data; - - if (p && lut[tupleid(t)] && lut[tupleid(p)]) { - out.add.push(ingest({ - source: p, - target: t - })); - } - }); - this.value = out.add; - } else if (pulse.changed(pulse.MOD)) { - // build lookup table of modified tuples - pulse.visit(pulse.MOD, function (t) { - lut[tupleid(t)] = 1; - }); // gather links incident on modified tuples - - links.forEach(function (link) { - if (lut[tupleid(link.source)] || lut[tupleid(link.target)]) { - out.mod.push(link); - } - }); - } - - return out; -}; - -var Tiles = { - binary: _d3Hierarchy.treemapBinary, - dice: _d3Hierarchy.treemapDice, - slice: _d3Hierarchy.treemapSlice, - slicedice: _d3Hierarchy.treemapSliceDice, - squarify: _d3Hierarchy.treemapSquarify, - resquarify: _d3Hierarchy.treemapResquarify -}; -var Output$4 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children']; -/** - * Treemap layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ - -function Treemap(params) { - HierarchyLayout.call(this, params); -} - -Treemap.Definition = { - 'type': 'Treemap', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'method', - 'type': 'enum', - 'default': 'squarify', - 'values': ['squarify', 'resquarify', 'binary', 'dice', 'slice', 'slicedice'] - }, { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingInner', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingOuter', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingTop', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingRight', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingBottom', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingLeft', - 'type': 'number', - 'default': 0 - }, { - 'name': 'ratio', - 'type': 'number', - 'default': 1.618033988749895 - }, { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$4.length, - 'default': Output$4 - }] -}; -var prototype$1l = inherits(Treemap, HierarchyLayout); -/** - * Treemap layout generator. Adds 'method' and 'ratio' parameters - * to configure the underlying tile method. - */ - -prototype$1l.layout = function () { - var x = (0, _d3Hierarchy.treemap)(); - - x.ratio = function (_) { - var t = x.tile(); - if (t.ratio) x.tile(t.ratio(_)); - }; - - x.method = function (_) { - if (hasOwnProperty(Tiles, _)) x.tile(Tiles[_]);else error('Unrecognized Treemap layout method: ' + _); - }; - - return x; -}; - -prototype$1l.params = ['method', 'ratio', 'size', 'round', 'padding', 'paddingInner', 'paddingOuter', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft']; -prototype$1l.fields = Output$4; -var tree = /*#__PURE__*/Object.freeze({ - __proto__: null, - nest: Nest, - pack: Pack, - partition: Partition, - stratify: Stratify, - tree: Tree, - treelinks: TreeLinks, - treemap: Treemap -}); - -function partition$4(data, groupby) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - t, - k, - g; // partition data points into stack groups - - - if (groupby == null) { - groups.push(data); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - - g.push(t); - } - } - - return groups; -} -/** - * Compute locally-weighted regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ - - -function Loess(params) { - Transform.call(this, null, params); -} - -Loess.Definition = { - 'type': 'Loess', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0.3 - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }] -}; -var prototype$1m = inherits(Loess, Transform); - -prototype$1m.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var _source2 = pulse.materialize(pulse.SOURCE).source, - groups = partition$4(_source2, _.groupby), - names = (_.groupby || []).map(accessorName), - m = names.length, - as = _.as || [accessorName(_.x), accessorName(_.y)], - _values2 = []; - groups.forEach(function (g) { - regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(function (p) { - var t = {}; - - for (var i = 0; i < m; ++i) { - t[names[i]] = g.dims[i]; - } - - t[as[0]] = p[0]; - t[as[1]] = p[1]; - - _values2.push(ingest(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = _values2; - } - - return out; -}; - -var Methods$1 = { - linear: regressionLinear, - log: regressionLog, - exp: regressionExp, - pow: regressionPow, - quad: regressionQuad, - poly: regressionPoly -}; - -function degreesOfFreedom(method, order) { - return method === 'poly' ? order : method === 'quad' ? 2 : 1; -} -/** - * Compute regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {string} [params.method='linear'] - The regression method to apply. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ - - -function Regression(params) { - Transform.call(this, null, params); -} - -Regression.Definition = { - 'type': 'Regression', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'method', - 'type': 'string', - 'default': 'linear', - 'values': Object.keys(Methods$1) - }, { - 'name': 'order', - 'type': 'number', - 'default': 3 - }, { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'params', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }] -}; -var prototype$1n = inherits(Regression, Transform); - -prototype$1n.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var _source3 = pulse.materialize(pulse.SOURCE).source, - groups = partition$4(_source3, _.groupby), - names = (_.groupby || []).map(accessorName), - _method2 = _.method || 'linear', - order = _.order || 3, - dof = degreesOfFreedom(_method2, order), - as = _.as || [accessorName(_.x), accessorName(_.y)], - _fit = Methods$1[_method2], - _values3 = []; - - var _domain3 = _.extent; - - if (!hasOwnProperty(Methods$1, _method2)) { - error('Invalid regression method: ' + _method2); - } - - if (_domain3 != null) { - if (_method2 === 'log' && _domain3[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - _domain3 = null; - } - } - - groups.forEach(function (g) { - var n = g.length; - - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - - var model = _fit(g, _.x, _.y, order); - - if (_.params) { - // if parameter vectors requested return those - _values3.push(ingest({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - - return; - } - - var dom = _domain3 || extent(g, _.x), - add = function add(p) { - var t = {}; - - for (var i = 0; i < names.length; ++i) { - t[names[i]] = g.dims[i]; - } - - t[as[0]] = p[0]; - t[as[1]] = p[1]; - - _values3.push(ingest(t)); - }; - - if (_method2 === 'linear') { - // for linear regression we only need the end points - dom.forEach(function (x) { - return add([x, model.predict(x)]); - }); - } else { - // otherwise return trend line sample points - sampleCurve(model.predict, dom, 25, 200).forEach(add); - } - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = _values3; - } - - return out; -}; - -var reg = /*#__PURE__*/Object.freeze({ - __proto__: null, - loess: Loess, - regression: Regression -}); -var EPSILON$2 = Math.pow(2, -52); -var EDGE_STACK = new Uint32Array(512); - -var Delaunator = /*#__PURE__*/function () { - _createClass(Delaunator, null, [{ - key: "from", - value: function from(points) { - var getX = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetX; - var getY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultGetY; - var n = points.length; - var coords = new Float64Array(n * 2); - - for (var i = 0; i < n; i++) { - var p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - - return new Delaunator(coords); - } - }]); - - function Delaunator(coords) { - _classCallCheck(this, Delaunator); - - var n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - this.coords = coords; // arrays that will store the triangulation graph - - var maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); // temporary arrays for tracking the edges of the advancing convex hull - - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - - this._hullNext = new Uint32Array(n); // edge to next edge - - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - - this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash - // temporary arrays for sorting points - - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - this.update(); - } - - _createClass(Delaunator, [{ - key: "update", - value: function update() { - var coords = this.coords, - hullPrev = this._hullPrev, - hullNext = this._hullNext, - hullTri = this._hullTri, - hullHash = this._hullHash; - var n = coords.length >> 1; // populate an array of point indices; calculate input data bbox - - var minX = Infinity; - var minY = Infinity; - var maxX = -Infinity; - var maxY = -Infinity; - - for (var i = 0; i < n; i++) { - var _x23 = coords[2 * i]; - var _y3 = coords[2 * i + 1]; - if (_x23 < minX) minX = _x23; - if (_y3 < minY) minY = _y3; - if (_x23 > maxX) maxX = _x23; - if (_y3 > maxY) maxY = _y3; - this._ids[i] = i; - } - - var cx = (minX + maxX) / 2; - var cy = (minY + maxY) / 2; - var minDist = Infinity; - var i0, i1, i2; // pick a seed point close to the center - - for (var _i8 = 0; _i8 < n; _i8++) { - var d = dist(cx, cy, coords[2 * _i8], coords[2 * _i8 + 1]); - - if (d < minDist) { - i0 = _i8; - minDist = d; - } - } - - var i0x = coords[2 * i0]; - var i0y = coords[2 * i0 + 1]; - minDist = Infinity; // find the point closest to the seed - - for (var _i9 = 0; _i9 < n; _i9++) { - if (_i9 === i0) continue; - - var _d3 = dist(i0x, i0y, coords[2 * _i9], coords[2 * _i9 + 1]); - - if (_d3 < minDist && _d3 > 0) { - i1 = _i9; - minDist = _d3; - } - } - - var i1x = coords[2 * i1]; - var i1y = coords[2 * i1 + 1]; - var minRadius = Infinity; // find the third point which forms the smallest circumcircle with the first two - - for (var _i10 = 0; _i10 < n; _i10++) { - if (_i10 === i0 || _i10 === i1) continue; - var r = circumradius(i0x, i0y, i1x, i1y, coords[2 * _i10], coords[2 * _i10 + 1]); - - if (r < minRadius) { - i2 = _i10; - minRadius = r; - } - } - - var i2x = coords[2 * i2]; - var i2y = coords[2 * i2 + 1]; - - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for (var _i11 = 0; _i11 < n; _i11++) { - this._dists[_i11] = coords[2 * _i11] - coords[0] || coords[2 * _i11 + 1] - coords[1]; - } - - quicksort(this._ids, this._dists, 0, n - 1); - var hull = new Uint32Array(n); - var j = 0; - - for (var _i12 = 0, d0 = -Infinity; _i12 < n; _i12++) { - var _id5 = this._ids[_i12]; - - if (this._dists[_id5] > d0) { - hull[j++] = _id5; - d0 = this._dists[_id5]; - } - } - - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } // swap the order of the seed points for counter-clockwise orientation - - - if (orient(i0x, i0y, i1x, i1y, i2x, i2y)) { - var _i13 = i1; - var _x24 = i1x; - var _y4 = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = _i13; - i2x = _x24; - i2y = _y4; - } - - var center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - - for (var _i14 = 0; _i14 < n; _i14++) { - this._dists[_i14] = dist(coords[2 * _i14], coords[2 * _i14 + 1], center.x, center.y); - } // sort the points by distance from the seed triangle circumcenter - - - quicksort(this._ids, this._dists, 0, n - 1); // set up the seed triangle as the starting hull - - this._hullStart = i0; - var hullSize = 3; - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - this.trianglesLen = 0; - - this._addTriangle(i0, i1, i2, -1, -1, -1); - - for (var k = 0, xp, yp; k < this._ids.length; k++) { - var _i15 = this._ids[k]; - var _x25 = coords[2 * _i15]; - var _y5 = coords[2 * _i15 + 1]; // skip near-duplicate points - - if (k > 0 && Math.abs(_x25 - xp) <= EPSILON$2 && Math.abs(_y5 - yp) <= EPSILON$2) continue; - xp = _x25; - yp = _y5; // skip seed triangle points - - if (_i15 === i0 || _i15 === i1 || _i15 === i2) continue; // find a visible edge on the convex hull using edge hash - - var start = 0; - - for (var _j = 0, _key7 = this._hashKey(_x25, _y5); _j < this._hashSize; _j++) { - start = hullHash[(_key7 + _j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - - start = hullPrev[start]; - var e = start, - q = void 0; - - while (q = hullNext[e], !orient(_x25, _y5, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) { - e = q; - - if (e === start) { - e = -1; - break; - } - } - - if (e === -1) continue; // likely a near-duplicate point; skip it - // add the first triangle from the point - - var t = this._addTriangle(e, _i15, hullNext[e], -1, -1, hullTri[e]); // recursively flip triangles from the point until they satisfy the Delaunay condition - - - hullTri[_i15] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - - hullSize++; // walk forward through the hull, adding more triangles and flipping recursively - - var _n3 = hullNext[e]; - - while (q = hullNext[_n3], orient(_x25, _y5, coords[2 * _n3], coords[2 * _n3 + 1], coords[2 * q], coords[2 * q + 1])) { - t = this._addTriangle(_n3, _i15, q, hullTri[_i15], -1, hullTri[_n3]); - hullTri[_i15] = this._legalize(t + 2); - hullNext[_n3] = _n3; // mark as removed - - hullSize--; - _n3 = q; - } // walk backward from the other side, adding more triangles and flipping - - - if (e === start) { - while (q = hullPrev[e], orient(_x25, _y5, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) { - t = this._addTriangle(q, _i15, e, -1, hullTri[e], hullTri[q]); - - this._legalize(t + 2); - - hullTri[q] = t; - hullNext[e] = e; // mark as removed - - hullSize--; - e = q; - } - } // update the hull indices - - - this._hullStart = hullPrev[_i15] = e; - hullNext[e] = hullPrev[_n3] = _i15; - hullNext[_i15] = _n3; // save the two new edges in the hash table - - hullHash[this._hashKey(_x25, _y5)] = _i15; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - - this.hull = new Uint32Array(hullSize); - - for (var _i16 = 0, _e2 = this._hullStart; _i16 < hullSize; _i16++) { - this.hull[_i16] = _e2; - _e2 = hullNext[_e2]; - } // trim typed triangle mesh arrays - - - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - }, { - key: "_hashKey", - value: function _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - }, { - key: "_legalize", - value: function _legalize(a) { - var triangles = this._triangles, - halfedges = this._halfedges, - coords = this.coords; - var i = 0; - var ar = 0; // recursion eliminated with a fixed-size stack - - while (true) { - var _b2 = halfedges[a]; - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ - - var a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - - if (_b2 === -1) { - // convex hull edge - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - - var b0 = _b2 - _b2 % 3; - var al = a0 + (a + 1) % 3; - - var _bl = b0 + (_b2 + 2) % 3; - - var p0 = triangles[ar]; - var pr = triangles[a]; - var pl = triangles[al]; - var p1 = triangles[_bl]; - var illegal = inCircle(coords[2 * p0], coords[2 * p0 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1]); - - if (illegal) { - triangles[a] = p1; - triangles[_b2] = p0; - var hbl = halfedges[_bl]; // edge swapped on the other side of the hull (rare); fix the halfedge reference - - if (hbl === -1) { - var e = this._hullStart; - - do { - if (this._hullTri[e] === _bl) { - this._hullTri[e] = a; - break; - } - - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - - this._link(a, hbl); - - this._link(_b2, halfedges[ar]); - - this._link(ar, _bl); - - var _br = b0 + (_b2 + 1) % 3; // don't worry about hitting the cap: it can only happen on extremely degenerate input - - - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = _br; - } - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - - return ar; - } - }, { - key: "_link", - value: function _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } // add a new triangle given vertex indices and adjacent half-edge ids - - }, { - key: "_addTriangle", - value: function _addTriangle(i0, i1, i2, a, b, c) { - var t = this.trianglesLen; - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - - this._link(t, a); - - this._link(t + 1, b); - - this._link(t + 2, c); - - this.trianglesLen += 3; - return t; - } - }]); - - return Delaunator; -}(); // monotonically increases with real angle, but doesn't need expensive trigonometry - - -function pseudoAngle(dx, dy) { - var p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] -} - -function dist(ax, ay, bx, by) { - var dx = ax - bx; - var dy = ay - by; - return dx * dx + dy * dy; -} // return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check - - -function orientIfSure(px, py, rx, ry, qx, qy) { - var l = (ry - py) * (qx - px); - var r = (rx - px) * (qy - py); - return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0; -} // a more robust orientation test that's stable in a given triangle (to fix robustness issues) - - -function orient(rx, ry, qx, qy, px, py) { - var sign = orientIfSure(px, py, rx, ry, qx, qy) || orientIfSure(rx, ry, qx, qy, px, py) || orientIfSure(qx, qy, px, py, rx, ry); - return sign < 0; -} - -function inCircle(ax, ay, bx, by, cx, cy, px, py) { - var dx = ax - px; - var dy = ay - py; - var ex = bx - px; - var ey = by - py; - var fx = cx - px; - var fy = cy - py; - var ap = dx * dx + dy * dy; - var bp = ex * ex + ey * ey; - var cp = fx * fx + fy * fy; - return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; -} - -function circumradius(ax, ay, bx, by, cx, cy) { - var dx = bx - ax; - var dy = by - ay; - var ex = cx - ax; - var ey = cy - ay; - var bl = dx * dx + dy * dy; - var cl = ex * ex + ey * ey; - var d = 0.5 / (dx * ey - dy * ex); - var x = (ey * bl - dy * cl) * d; - var y = (dx * cl - ex * bl) * d; - return x * x + y * y; -} - -function circumcenter(ax, ay, bx, by, cx, cy) { - var dx = bx - ax; - var dy = by - ay; - var ex = cx - ax; - var ey = cy - ay; - var bl = dx * dx + dy * dy; - var cl = ex * ex + ey * ey; - var d = 0.5 / (dx * ey - dy * ex); - var x = ax + (ey * bl - dy * cl) * d; - var y = ay + (dx * cl - ex * bl) * d; - return { - x: x, - y: y - }; -} - -function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (var i = left + 1; i <= right; i++) { - var _temp = ids[i]; - var tempDist = dists[_temp]; - var j = i - 1; - - while (j >= left && dists[ids[j]] > tempDist) { - ids[j + 1] = ids[j--]; - } - - ids[j + 1] = _temp; - } - } else { - var _median = left + right >> 1; - - var _i17 = left + 1; - - var _j2 = right; - swap$1(ids, _median, _i17); - if (dists[ids[left]] > dists[ids[right]]) swap$1(ids, left, right); - if (dists[ids[_i17]] > dists[ids[right]]) swap$1(ids, _i17, right); - if (dists[ids[left]] > dists[ids[_i17]]) swap$1(ids, left, _i17); - var _temp2 = ids[_i17]; - var _tempDist = dists[_temp2]; - - while (true) { - do { - _i17++; - } while (dists[ids[_i17]] < _tempDist); - - do { - _j2--; - } while (dists[ids[_j2]] > _tempDist); - - if (_j2 < _i17) break; - swap$1(ids, _i17, _j2); - } - - ids[left + 1] = ids[_j2]; - ids[_j2] = _temp2; - - if (right - _i17 + 1 >= _j2 - left) { - quicksort(ids, dists, _i17, right); - quicksort(ids, dists, left, _j2 - 1); - } else { - quicksort(ids, dists, left, _j2 - 1); - quicksort(ids, dists, _i17, right); - } - } -} - -function swap$1(arr, i, j) { - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - -function defaultGetX(p) { - return p[0]; -} - -function defaultGetY(p) { - return p[1]; -} - -var epsilon$2 = 1e-6; - -var Path = /*#__PURE__*/function () { - function Path() { - _classCallCheck(this, Path); - - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - - this._ = ""; - } - - _createClass(Path, [{ - key: "moveTo", - value: function moveTo(x, y) { - this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y); - } - }, { - key: "closePath", - value: function closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - } - }, { - key: "lineTo", - value: function lineTo(x, y) { - this._ += "L".concat(this._x1 = +x, ",").concat(this._y1 = +y); - } - }, { - key: "arc", - value: function arc(x, y, r) { - x = +x, y = +y, r = +r; - var x0 = x + r; - var y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += "M".concat(x0, ",").concat(y0);else if (Math.abs(this._x1 - x0) > epsilon$2 || Math.abs(this._y1 - y0) > epsilon$2) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += "A".concat(r, ",").concat(r, ",0,1,1,").concat(x - r, ",").concat(y, "A").concat(r, ",").concat(r, ",0,1,1,").concat(this._x1 = x0, ",").concat(this._y1 = y0); - } - }, { - key: "rect", - value: function rect(x, y, w, h) { - this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y, "h").concat(+w, "v").concat(+h, "h").concat(-w, "Z"); - } - }, { - key: "value", - value: function value() { - return this._ || null; - } - }]); - - return Path; -}(); - -var Polygon = /*#__PURE__*/function () { - function Polygon() { - _classCallCheck(this, Polygon); - - this._ = []; - } - - _createClass(Polygon, [{ - key: "moveTo", - value: function moveTo(x, y) { - this._.push([x, y]); - } - }, { - key: "closePath", - value: function closePath() { - this._.push(this._[0].slice()); - } - }, { - key: "lineTo", - value: function lineTo(x, y) { - this._.push([x, y]); - } - }, { - key: "value", - value: function value() { - return this._.length ? this._ : null; - } - }]); - - return Polygon; -}(); - -var Voronoi = /*#__PURE__*/function () { - function Voronoi(delaunay) { - var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 960, 500], - _ref17 = _slicedToArray(_ref16, 4), - xmin = _ref17[0], - ymin = _ref17[1], - xmax = _ref17[2], - ymax = _ref17[3]; - - _classCallCheck(this, Voronoi); - - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - - this._init(); - } - - _createClass(Voronoi, [{ - key: "update", - value: function update() { - this.delaunay.update(); - - this._init(); - - return this; - } - }, { - key: "_init", - value: function _init() { - var _this$delaunay = this.delaunay, - points = _this$delaunay.points, - hull = _this$delaunay.hull, - triangles = _this$delaunay.triangles, - vectors = this.vectors; // Compute circumcenters. - - var circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - - for (var i = 0, j = 0, n = triangles.length, _x26, _y6; i < n; i += 3, j += 2) { - var t1 = triangles[i] * 2; - var t2 = triangles[i + 1] * 2; - var t3 = triangles[i + 2] * 2; - var _x27 = points[t1]; - var _y7 = points[t1 + 1]; - var x2 = points[t2]; - var y2 = points[t2 + 1]; - var x3 = points[t3]; - var y3 = points[t3 + 1]; - var dx = x2 - _x27; - var dy = y2 - _y7; - var ex = x3 - _x27; - var ey = y3 - _y7; - - var _bl2 = dx * dx + dy * dy; - - var cl = ex * ex + ey * ey; - var ab = (dx * ey - dy * ex) * 2; - - if (!ab) { - // degenerate case (collinear diagram) - _x26 = (_x27 + x3) / 2 - 1e8 * ey; - _y6 = (_y7 + y3) / 2 + 1e8 * ex; - } else if (Math.abs(ab) < 1e-8) { - // almost equal points (degenerate triangle) - _x26 = (_x27 + x3) / 2; - _y6 = (_y7 + y3) / 2; - } else { - var d = 1 / ab; - _x26 = _x27 + (ey * _bl2 - dy * cl) * d; - _y6 = _y7 + (dx * cl - ex * _bl2) * d; - } - - circumcenters[j] = _x26; - circumcenters[j + 1] = _y6; - } // Compute exterior cell rays. - - - var h = hull[hull.length - 1]; - var p0, - p1 = h * 4; - var x0, - x1 = points[2 * h]; - var y0, - y1 = points[2 * h + 1]; - vectors.fill(0); - - for (var _i18 = 0; _i18 < hull.length; ++_i18) { - h = hull[_i18]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - }, { - key: "render", - value: function render(context) { - var buffer = context == null ? context = new Path() : undefined; - var _this$delaunay2 = this.delaunay, - halfedges = _this$delaunay2.halfedges, - inedges = _this$delaunay2.inedges, - hull = _this$delaunay2.hull, - circumcenters = this.circumcenters, - vectors = this.vectors; - if (hull.length <= 1) return null; - - for (var i = 0, n = halfedges.length; i < n; ++i) { - var j = halfedges[i]; - if (j < i) continue; - var ti = Math.floor(i / 3) * 2; - var tj = Math.floor(j / 3) * 2; - var xi = circumcenters[ti]; - var yi = circumcenters[ti + 1]; - var xj = circumcenters[tj]; - var yj = circumcenters[tj + 1]; - - this._renderSegment(xi, yi, xj, yj, context); - } - - var h0, - h1 = hull[hull.length - 1]; - - for (var _i19 = 0; _i19 < hull.length; ++_i19) { - h0 = h1, h1 = hull[_i19]; - var t = Math.floor(inedges[h1] / 3) * 2; - var _x28 = circumcenters[t]; - var _y8 = circumcenters[t + 1]; - var v = h0 * 4; - - var p = this._project(_x28, _y8, vectors[v + 2], vectors[v + 3]); - - if (p) this._renderSegment(_x28, _y8, p[0], p[1], context); - } - - return buffer && buffer.value(); - } - }, { - key: "renderBounds", - value: function renderBounds(context) { - var buffer = context == null ? context = new Path() : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - }, { - key: "renderCell", - value: function renderCell(i, context) { - var buffer = context == null ? context = new Path() : undefined; - - var points = this._clip(i); - - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - var n = points.length; - - while (points[0] === points[n - 2] && points[1] === points[n - 1] && n > 1) { - n -= 2; - } - - for (var _i20 = 2; _i20 < n; _i20 += 2) { - if (points[_i20] !== points[_i20 - 2] || points[_i20 + 1] !== points[_i20 - 1]) context.lineTo(points[_i20], points[_i20 + 1]); - } - - context.closePath(); - return buffer && buffer.value(); - } - }, { - key: "cellPolygons", - value: /*#__PURE__*/regeneratorRuntime.mark(function cellPolygons() { - var points, i, n, _cell2; - - return regeneratorRuntime.wrap(function cellPolygons$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - points = this.delaunay.points; - i = 0, n = points.length / 2; - - case 2: - if (!(i < n)) { - _context4.next = 11; - break; - } - - _cell2 = this.cellPolygon(i); - - if (!_cell2) { - _context4.next = 8; - break; - } - - _cell2.index = i; - _context4.next = 8; - return _cell2; - - case 8: - ++i; - _context4.next = 2; - break; - - case 11: - case "end": - return _context4.stop(); - } - } - }, cellPolygons, this); - }) - }, { - key: "cellPolygon", - value: function cellPolygon(i) { - var polygon = new Polygon(); - this.renderCell(i, polygon); - return polygon.value(); - } - }, { - key: "_renderSegment", - value: function _renderSegment(x0, y0, x1, y1, context) { - var S; - - var c0 = this._regioncode(x0, y0); - - var c1 = this._regioncode(x1, y1); - - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } - } - }, { - key: "contains", - value: function contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; - } - }, { - key: "neighbors", - value: /*#__PURE__*/regeneratorRuntime.mark(function neighbors(i) { - var ci, _iterator20, _step20, j, cj, ai, li, aj, lj; - - return regeneratorRuntime.wrap(function neighbors$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - ci = this._clip(i); - - if (!ci) { - _context5.next = 33; - break; - } - - _iterator20 = _createForOfIteratorHelper(this.delaunay.neighbors(i)); - _context5.prev = 3; - - _iterator20.s(); - - case 5: - if ((_step20 = _iterator20.n()).done) { - _context5.next = 25; - break; - } - - j = _step20.value; - cj = this._clip(j); // find the common edge - - if (!cj) { - _context5.next = 23; - break; - } - - ai = 0, li = ci.length; - - case 10: - if (!(ai < li)) { - _context5.next = 23; - break; - } - - aj = 0, lj = cj.length; - - case 12: - if (!(aj < lj)) { - _context5.next = 20; - break; - } - - if (!(ci[ai] == cj[aj] && ci[ai + 1] == cj[aj + 1] && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj])) { - _context5.next = 17; - break; - } - - _context5.next = 16; - return j; - - case 16: - return _context5.abrupt("break", 23); - - case 17: - aj += 2; - _context5.next = 12; - break; - - case 20: - ai += 2; - _context5.next = 10; - break; - - case 23: - _context5.next = 5; - break; - - case 25: - _context5.next = 30; - break; - - case 27: - _context5.prev = 27; - _context5.t0 = _context5["catch"](3); - - _iterator20.e(_context5.t0); - - case 30: - _context5.prev = 30; - - _iterator20.f(); - - return _context5.finish(30); - - case 33: - case "end": - return _context5.stop(); - } - } - }, neighbors, this, [[3, 27, 30, 33]]); - }) - }, { - key: "_cell", - value: function _cell(i) { - var circumcenters = this.circumcenters, - _this$delaunay3 = this.delaunay, - inedges = _this$delaunay3.inedges, - halfedges = _this$delaunay3.halfedges, - triangles = _this$delaunay3.triangles; - var e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - - var points = []; - var e = e0; - - do { - var t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - - e = halfedges[e]; - } while (e !== e0 && e !== -1); - - return points; - } - }, { - key: "_clip", - value: function _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - - var points = this._cell(i); - - if (points === null) return null; - var V = this.vectors; - var v = i * 4; - return V[v] || V[v + 1] ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points); - } - }, { - key: "_clipFinite", - value: function _clipFinite(i, points) { - var n = points.length; - var P = null; - var x0, - y0, - x1 = points[n - 2], - y1 = points[n - 1]; - - var c0, - c1 = this._regioncode(x1, y1); - - var e0, e1; - - for (var j = 0; j < n; j += 2) { - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1);else P = [x1, y1]; - } else { - var S = void 0, - sx0 = void 0, - sy0 = void 0, - sx1 = void 0, - sy1 = void 0; - - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - var _S = S; - - var _S2 = _slicedToArray(_S, 4); - - sx0 = _S2[0]; - sy0 = _S2[1]; - sx1 = _S2[2]; - sy1 = _S2[3]; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - var _S3 = S; - - var _S4 = _slicedToArray(_S3, 4); - - sx1 = _S4[0]; - sy1 = _S4[1]; - sx0 = _S4[2]; - sy0 = _S4[3]; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0);else P = [sx0, sy0]; - } - - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1);else P = [sx1, sy1]; - } - } - - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - - return P; - } - }, { - key: "_clipSegment", - value: function _clipSegment(x0, y0, x1, y1, c0, c1) { - while (true) { - if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1]; - if (c0 & c1) return null; - - var _x29 = void 0, - _y9 = void 0, - c = c0 || c1; - - if (c & 8) _x29 = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), _y9 = this.ymax;else if (c & 4) _x29 = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), _y9 = this.ymin;else if (c & 2) _y9 = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), _x29 = this.xmax;else _y9 = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), _x29 = this.xmin; - if (c0) x0 = _x29, y0 = _y9, c0 = this._regioncode(x0, y0);else x1 = _x29, y1 = _y9, c1 = this._regioncode(x1, y1); - } - } - }, { - key: "_clipInfinite", - value: function _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - var P = Array.from(points), - p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - - if (P = this._clipFinite(i, P)) { - for (var j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; - } - - return P; - } - }, { - key: "_edge", - value: function _edge(i, e0, e1, P, j) { - while (e0 !== e1) { - var _x30 = void 0, - _y10 = void 0; - - switch (e0) { - case 5: - e0 = 4; - continue; - // top-left - - case 4: - e0 = 6, _x30 = this.xmax, _y10 = this.ymin; - break; - // top - - case 6: - e0 = 2; - continue; - // top-right - - case 2: - e0 = 10, _x30 = this.xmax, _y10 = this.ymax; - break; - // right - - case 10: - e0 = 8; - continue; - // bottom-right - - case 8: - e0 = 9, _x30 = this.xmin, _y10 = this.ymax; - break; - // bottom - - case 9: - e0 = 1; - continue; - // bottom-left - - case 1: - e0 = 5, _x30 = this.xmin, _y10 = this.ymin; - break; - // left - } - - if ((P[j] !== _x30 || P[j + 1] !== _y10) && this.contains(i, _x30, _y10)) { - P.splice(j, 0, _x30, _y10), j += 2; - } - } - - if (P.length > 4) { - for (var _i21 = 0; _i21 < P.length; _i21 += 2) { - var _j3 = (_i21 + 2) % P.length, - k = (_i21 + 4) % P.length; - - if (P[_i21] === P[_j3] && P[_j3] === P[k] || P[_i21 + 1] === P[_j3 + 1] && P[_j3 + 1] === P[k + 1]) P.splice(_j3, 2), _i21 -= 2; - } - } - - return j; - } - }, { - key: "_project", - value: function _project(x0, y0, vx, vy) { - var t = Infinity, - c, - x, - y; - - if (vy < 0) { - // top - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { - // bottom - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - - if (vx > 0) { - // right - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { - // left - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - - return [x, y]; - } - }, { - key: "_edgecode", - value: function _edgecode(x, y) { - return (x === this.xmin ? 1 : x === this.xmax ? 2 : 0) | (y === this.ymin ? 4 : y === this.ymax ? 8 : 0); - } - }, { - key: "_regioncode", - value: function _regioncode(x, y) { - return (x < this.xmin ? 1 : x > this.xmax ? 2 : 0) | (y < this.ymin ? 4 : y > this.ymax ? 8 : 0); - } - }]); - - return Voronoi; -}(); - -var tau = 2 * Math.PI, - pow$2 = Math.pow; - -function pointX(p) { - return p[0]; -} - -function pointY(p) { - return p[1]; -} // A triangulation is collinear if all its triangles have a non-null area - - -function collinear$1(d) { - var triangles = d.triangles, - coords = d.coords; - - for (var i = 0; i < triangles.length; i += 3) { - var a = 2 * triangles[i], - _b3 = 2 * triangles[i + 1], - c = 2 * triangles[i + 2], - _cross = (coords[c] - coords[a]) * (coords[_b3 + 1] - coords[a + 1]) - (coords[_b3] - coords[a]) * (coords[c + 1] - coords[a + 1]); - - if (_cross > 1e-10) return false; - } - - return true; -} - -function jitter(x, y, r) { - return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r]; -} - -var Delaunay = /*#__PURE__*/function () { - _createClass(Delaunay, null, [{ - key: "from", - value: function from(points) { - var fx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : pointX; - var fy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : pointY; - var that = arguments.length > 3 ? arguments[3] : undefined; - return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that))); - } - }]); - - function Delaunay(points) { - _classCallCheck(this, Delaunay); - - this._delaunator = new Delaunator(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - - this._init(); - } - - _createClass(Delaunay, [{ - key: "update", - value: function update() { - this._delaunator.update(); - - this._init(); - - return this; - } - }, { - key: "_init", - value: function _init() { - var d = this._delaunator, - points = this.points; // check for collinear - - if (d.hull && d.hull.length > 2 && collinear$1(d)) { - this.collinear = Int32Array.from({ - length: points.length / 2 - }, function (_, i) { - return i; - }).sort(function (i, j) { - return points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]; - }); // for exact neighbors - - var e = this.collinear[0], - f = this.collinear[this.collinear.length - 1], - _bounds = [points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1]], - r = 1e-8 * Math.hypot(_bounds[3] - _bounds[1], _bounds[2] - _bounds[0]); - - for (var i = 0, n = points.length / 2; i < n; ++i) { - var p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - - this._delaunator = new Delaunator(points); - } else { - delete this.collinear; - } - - var halfedges = this.halfedges = this._delaunator.halfedges; - var hull = this.hull = this._delaunator.hull; - var triangles = this.triangles = this._delaunator.triangles; - var inedges = this.inedges.fill(-1); - - var hullIndex = this._hullIndex.fill(-1); // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - - - for (var _e3 = 0, _n4 = halfedges.length; _e3 < _n4; ++_e3) { - var _p = triangles[_e3 % 3 === 2 ? _e3 - 2 : _e3 + 1]; - if (halfedges[_e3] === -1 || inedges[_p] === -1) inedges[_p] = _e3; - } - - for (var _i22 = 0, _n5 = hull.length; _i22 < _n5; ++_i22) { - hullIndex[hull[_i22]] = _i22; - } // degenerate case: 1 or 2 (distinct) points - - - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - inedges[hull[0]] = 1; - if (hull.length === 2) inedges[hull[1]] = 0; - } - } - }, { - key: "voronoi", - value: function voronoi(bounds) { - return new Voronoi(this, bounds); - } - }, { - key: "neighbors", - value: /*#__PURE__*/regeneratorRuntime.mark(function neighbors(i) { - var inedges, hull, _hullIndex, halfedges, triangles, collinear, l, e0, e, p0, p; - - return regeneratorRuntime.wrap(function neighbors$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - inedges = this.inedges, hull = this.hull, _hullIndex = this._hullIndex, halfedges = this.halfedges, triangles = this.triangles, collinear = this.collinear; // degenerate case with several collinear points - - if (!collinear) { - _context6.next = 10; - break; - } - - l = collinear.indexOf(i); - - if (!(l > 0)) { - _context6.next = 6; - break; - } - - _context6.next = 6; - return collinear[l - 1]; - - case 6: - if (!(l < collinear.length - 1)) { - _context6.next = 9; - break; - } - - _context6.next = 9; - return collinear[l + 1]; - - case 9: - return _context6.abrupt("return"); - - case 10: - e0 = inedges[i]; - - if (!(e0 === -1)) { - _context6.next = 13; - break; - } - - return _context6.abrupt("return"); - - case 13: - // coincident point - e = e0, p0 = -1; - - case 14: - _context6.next = 16; - return p0 = triangles[e]; - - case 16: - e = e % 3 === 2 ? e - 2 : e + 1; - - if (!(triangles[e] !== i)) { - _context6.next = 19; - break; - } - - return _context6.abrupt("return"); - - case 19: - // bad triangulation - e = halfedges[e]; - - if (!(e === -1)) { - _context6.next = 26; - break; - } - - p = hull[(_hullIndex[i] + 1) % hull.length]; - - if (!(p !== p0)) { - _context6.next = 25; - break; - } - - _context6.next = 25; - return p; - - case 25: - return _context6.abrupt("return"); - - case 26: - if (e !== e0) { - _context6.next = 14; - break; - } - - case 27: - case "end": - return _context6.stop(); - } - } - }, neighbors, this); - }) - }, { - key: "find", - value: function find(x, y) { - var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - var i0 = i; - var c; - - while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) { - i = c; - } - - return c; - } - }, { - key: "_step", - value: function _step(i, x, y) { - var inedges = this.inedges, - hull = this.hull, - _hullIndex = this._hullIndex, - halfedges = this.halfedges, - triangles = this.triangles, - points = this.points; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - var c = i; - var dc = pow$2(x - points[i * 2], 2) + pow$2(y - points[i * 2 + 1], 2); - var e0 = inedges[i]; - var e = e0; - - do { - var t = triangles[e]; - var dt = pow$2(x - points[t * 2], 2) + pow$2(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - - e = halfedges[e]; - - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - - if (e !== t) { - if (pow$2(x - points[e * 2], 2) + pow$2(y - points[e * 2 + 1], 2) < dc) return e; - } - - break; - } - } while (e !== e0); - - return c; - } - }, { - key: "render", - value: function render(context) { - var buffer = context == null ? context = new Path() : undefined; - var points = this.points, - halfedges = this.halfedges, - triangles = this.triangles; - - for (var i = 0, n = halfedges.length; i < n; ++i) { - var j = halfedges[i]; - if (j < i) continue; - var ti = triangles[i] * 2; - var tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - - this.renderHull(context); - return buffer && buffer.value(); - } - }, { - key: "renderPoints", - value: function renderPoints(context) { - var r = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; - var buffer = context == null ? context = new Path() : undefined; - var points = this.points; - - for (var i = 0, n = points.length; i < n; i += 2) { - var _x31 = points[i], - _y11 = points[i + 1]; - context.moveTo(_x31 + r, _y11); - context.arc(_x31, _y11, r, 0, tau); - } - - return buffer && buffer.value(); - } - }, { - key: "renderHull", - value: function renderHull(context) { - var buffer = context == null ? context = new Path() : undefined; - var hull = this.hull, - points = this.points; - var h = hull[0] * 2, - n = hull.length; - context.moveTo(points[h], points[h + 1]); - - for (var i = 1; i < n; ++i) { - var _h = 2 * hull[i]; - - context.lineTo(points[_h], points[_h + 1]); - } - - context.closePath(); - return buffer && buffer.value(); - } - }, { - key: "hullPolygon", - value: function hullPolygon() { - var polygon = new Polygon(); - this.renderHull(polygon); - return polygon.value(); - } - }, { - key: "renderTriangle", - value: function renderTriangle(i, context) { - var buffer = context == null ? context = new Path() : undefined; - var points = this.points, - triangles = this.triangles; - var t0 = triangles[i *= 3] * 2; - var t1 = triangles[i + 1] * 2; - var t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); - } - }, { - key: "trianglePolygons", - value: /*#__PURE__*/regeneratorRuntime.mark(function trianglePolygons() { - var triangles, i, n; - return regeneratorRuntime.wrap(function trianglePolygons$(_context7) { - while (1) { - switch (_context7.prev = _context7.next) { - case 0: - triangles = this.triangles; - i = 0, n = triangles.length / 3; - - case 2: - if (!(i < n)) { - _context7.next = 8; - break; - } - - _context7.next = 5; - return this.trianglePolygon(i); - - case 5: - ++i; - _context7.next = 2; - break; - - case 8: - case "end": - return _context7.stop(); - } - } - }, trianglePolygons, this); - }) - }, { - key: "trianglePolygon", - value: function trianglePolygon(i) { - var polygon = new Polygon(); - this.renderTriangle(i, polygon); - return polygon.value(); - } - }]); - - return Delaunay; -}(); - -function flatArray(points, fx, fy, that) { - var n = points.length; - var array = new Float64Array(n * 2); - - for (var i = 0; i < n; ++i) { - var p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - - return array; -} - -function flatIterable(points, fx, fy, that) { - var i, _iterator21, _step21, p; - - return regeneratorRuntime.wrap(function flatIterable$(_context8) { - while (1) { - switch (_context8.prev = _context8.next) { - case 0: - i = 0; - _iterator21 = _createForOfIteratorHelper(points); - _context8.prev = 2; - - _iterator21.s(); - - case 4: - if ((_step21 = _iterator21.n()).done) { - _context8.next = 13; - break; - } - - p = _step21.value; - _context8.next = 8; - return fx.call(that, p, i, points); - - case 8: - _context8.next = 10; - return fy.call(that, p, i, points); - - case 10: - ++i; - - case 11: - _context8.next = 4; - break; - - case 13: - _context8.next = 18; - break; - - case 15: - _context8.prev = 15; - _context8.t0 = _context8["catch"](2); - - _iterator21.e(_context8.t0); - - case 18: - _context8.prev = 18; - - _iterator21.f(); - - return _context8.finish(18); - - case 21: - case "end": - return _context8.stop(); - } - } - }, _marked3, null, [[2, 15, 18, 21]]); -} - -function Voronoi$1(params) { - Transform.call(this, null, params); -} - -Voronoi$1.Definition = { - 'type': 'Voronoi', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'default': [[-1e5, -1e5], [1e5, 1e5]], - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'as', - 'type': 'string', - 'default': 'path' - }] -}; -var prototype$1o = inherits(Voronoi$1, Transform); -var defaultExtent = [-1e5, -1e5, 1e5, 1e5]; - -prototype$1o.transform = function (_, pulse) { - var as = _.as || 'path', - data = pulse.source; // nothing to do if no data - - if (!data || !data.length) return pulse; // configure and construct voronoi diagram - - var s = _.size; - s = s ? [0, 0, s[0], s[1]] : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] : defaultExtent; - var voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s); // map polygons to paths - - for (var i = 0, n = data.length; i < n; ++i) { - var polygon = voronoi.cellPolygon(i); - data[i][as] = polygon ? toPathString(polygon) : null; - } - - return pulse.reflow(_.modified()).modifies(as); -}; // suppress duplicated end point vertices - - -function toPathString(p) { - var x = p[0][0], - y = p[0][1]; - var n = p.length - 1; - - for (; p[n][0] === x && p[n][1] === y; --n) { - ; - } - - return 'M' + p.slice(0, n + 1).join('L') + 'Z'; -} - -var voronoi = /*#__PURE__*/Object.freeze({ - __proto__: null, - voronoi: Voronoi$1 -}); -/* -Copyright (c) 2013, Jason Davies. -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 Jason Davies 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 JASON DAVIES 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. -*/ -// Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/ -// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf - -var cloudRadians = Math.PI / 180, - cw = 1 << 11 >> 5, - ch = 1 << 11; - -function cloud() { - var size = [256, 256], - text, - font, - fontSize, - fontStyle, - fontWeight, - rotate, - padding, - spiral = archimedeanSpiral, - words = [], - random = Math.random, - cloud = {}; - - cloud.layout = function () { - var contextAndRatio = getContext(domCanvas()), - board = zeroArray((size[0] >> 5) * size[1]), - bounds = null, - n = words.length, - i = -1, - tags = [], - data = words.map(function (d) { - return { - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - }; - }).sort(function (a, b) { - return b.size - a.size; - }); - - while (++i < n) { - var d = data[i]; - d.x = size[0] * (random() + .5) >> 1; - d.y = size[1] * (random() + .5) >> 1; - cloudSprite(contextAndRatio, d, data, i); - - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d);else bounds = [{ - x: d.x + d.x0, - y: d.y + d.y0 - }, { - x: d.x + d.x1, - y: d.y + d.y1 - }]; // Temporary hack - - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - - return tags; - }; - - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - return { - context: context, - ratio: ratio - }; - } - - function place(board, tag, bounds) { - var startX = tag.x, - startY = tag.y, - maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), - s = spiral(size), - dt = random() < .5 ? 1 : -1, - t = -dt, - dxdy, - dx, - dy; - - while (dxdy = s(t += dt)) { - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - tag.x = startX + dx; - tag.y = startY + dy; - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; // TODO only check for collisions within current bounds. - - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, - w = tag.width >> 5, - sw = size[0] >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - - for (var j = 0; j < h; j++) { - last = 0; - - for (var i = 0; i <= w; i++) { - board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - } - - x += sw; - } - - tag.sprite = null; - return true; - } - } - } - - return false; - } - - cloud.words = function (_) { - if (arguments.length) { - words = _; - return cloud; - } else { - return words; - } - }; - - cloud.size = function (_) { - if (arguments.length) { - size = [+_[0], +_[1]]; - return cloud; - } else { - return size; - } - }; - - cloud.font = function (_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else { - return font; - } - }; - - cloud.fontStyle = function (_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else { - return fontStyle; - } - }; - - cloud.fontWeight = function (_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else { - return fontWeight; - } - }; - - cloud.rotate = function (_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else { - return rotate; - } - }; - - cloud.text = function (_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else { - return text; - } - }; - - cloud.spiral = function (_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else { - return spiral; - } - }; - - cloud.fontSize = function (_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else { - return fontSize; - } - }; - - cloud.padding = function (_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else { - return padding; - } - }; - - cloud.random = function (_) { - if (arguments.length) { - random = _; - return cloud; - } else { - return random; - } - }; - - return cloud; -} // Fetches a monochrome sprite bitmap for the specified text. -// Load in batches for speed. - - -function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, - ratio = contextAndRatio.ratio; - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, - y = 0, - maxh = 0, - n = data.length, - w, - w32, - h, - i, - j; - --di; - - while (++di < n) { - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), - cr = Math.cos(d.rotate * cloudRadians), - wcr = w * cr, - wsr = w * sr, - hcr = h * cr, - hsr = h * sr; - w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else { - w = w + 0x1f >> 5 << 5; - } - - if (h > maxh) maxh = h; - - if (x + w >= cw << 5) { - x = 0; - y += maxh; - maxh = 0; - } - - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, - sprite = []; - - while (--di >= 0) { - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; // Zero the buffer - - for (i = 0; i < h * w32; i++) { - sprite[i] = 0; - } - - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, - seenRow = -1; - - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - var k = w32 * j + (i >> 5), - m = pixels[(y + j) * (cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0; - sprite[k] |= m; - seen |= m; - } - - if (seen) seenRow = j;else { - d.y0++; - h--; - j--; - y++; - } - } - - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); - } -} // Use mask-based collision detection. - - -function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, - w = tag.width >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - - for (var j = 0; j < h; j++) { - last = 0; - - for (var i = 0; i <= w; i++) { - if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true; - } - - x += sw; - } - - return false; -} - -function cloudBounds(bounds, d) { - var b0 = bounds[0], - b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; -} - -function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; -} - -function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function (t) { - return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)]; - }; -} - -function rectangularSpiral(size) { - var dy = 4, - dx = dy * size[0] / size[1], - x = 0, - y = 0; - return function (t) { - var sign = t < 0 ? -1 : 1; // See triangular numbers: T_n = n * (n + 1) / 2. - - switch (Math.sqrt(1 + 4 * sign * t) - sign & 3) { - case 0: - x += dx; - break; - - case 1: - y += dy; - break; - - case 2: - x -= dx; - break; - - default: - y -= dy; - break; - } - - return [x, y]; - }; -} // TODO reuse arrays? - - -function zeroArray(n) { - var a = [], - i = -1; - - while (++i < n) { - a[i] = 0; - } - - return a; -} - -function functor(d) { - return typeof d === 'function' ? d : function () { - return d; - }; -} - -var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral -}; -var Output$5 = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle']; -var Params$1 = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight']; - -function Wordcloud(params) { - Transform.call(this, cloud(), params); -} - -Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'font', - 'type': 'string', - 'expr': true, - 'default': 'sans-serif' - }, { - 'name': 'fontStyle', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, { - 'name': 'fontWeight', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, { - 'name': 'fontSize', - 'type': 'number', - 'expr': true, - 'default': 14 - }, { - 'name': 'fontSizeRange', - 'type': 'number', - 'array': 'nullable', - 'default': [10, 50] - }, { - 'name': 'rotate', - 'type': 'number', - 'expr': true, - 'default': 0 - }, { - 'name': 'text', - 'type': 'field' - }, { - 'name': 'spiral', - 'type': 'string', - 'values': ['archimedean', 'rectangular'] - }, { - 'name': 'padding', - 'type': 'number', - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 7, - 'default': Output$5 - }] -}; -var prototype$1p = inherits(Wordcloud, Transform); - -prototype$1p.transform = function (_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) { - error('Wordcloud size dimensions must be non-zero.'); - } - - function modp(param) { - var p = _[param]; - return isFunction(p) && pulse.modified(p.fields); - } - - var mod = _.modified(); - - if (!(mod || pulse.changed(pulse.ADD_REM) || Params$1.some(modp))) return; - var data = pulse.materialize(pulse.SOURCE).source, - layout = this.value, - as = _.as || Output$5, - fontSize = _.fontSize || 14, - range; - isFunction(fontSize) ? range = _.fontSizeRange : fontSize = constant(fontSize); // create font size scaling function as needed - - if (range) { - var fsize = fontSize, - sizeScale = scale$2('sqrt')().domain(extent(data, fsize)).range(range); - - fontSize = function fontSize(x) { - return sizeScale(fsize(x)); - }; - } - - data.forEach(function (t) { - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); // configure layout - - var words = layout.words(data).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random(_random).layout(); - var size = layout.size(), - dx = size[0] >> 1, - dy = size[1] >> 1, - i = 0, - n = words.length, - w, - t; - - for (; i < n; ++i) { - w = words[i]; - t = w.datum; - t[as[0]] = w.x + dx; - t[as[1]] = w.y + dy; - t[as[2]] = w.font; - t[as[3]] = w.size; - t[as[4]] = w.style; - t[as[5]] = w.weight; - t[as[6]] = w.rotate; - } - - return pulse.reflow(mod).modifies(as); -}; - -var wordcloud = /*#__PURE__*/Object.freeze({ - __proto__: null, - wordcloud: Wordcloud -}); - -function array8(n) { - return new Uint8Array(n); -} - -function array16(n) { - return new Uint16Array(n); -} - -function array32(n) { - return new Uint32Array(n); -} -/** - * Maintains CrossFilter state. - */ - - -function Bitmaps() { - var width = 8, - _data2 = [], - _seen = array32(0), - _curr = array$1(0, width), - _prev = array$1(0, width); - - return { - data: function data() { - return _data2; - }, - seen: function seen() { - return _seen = lengthen(_seen, _data2.length); - }, - add: function add(array) { - for (var i = 0, j = _data2.length, n = array.length, t; i < n; ++i) { - t = array[i]; - t._index = j++; - - _data2.push(t); - } - }, - remove: function remove(num, map) { - // map: index -> boolean (true => remove) - var n = _data2.length, - copy = Array(n - num), - reindex = _data2, - // reuse old data array for index map - t, - i, - j; // seek forward to first removal - - for (i = 0; !map[i] && i < n; ++i) { - copy[i] = _data2[i]; - reindex[i] = i; - } // condense arrays - - - for (j = i; i < n; ++i) { - t = _data2[i]; - - if (!map[i]) { - reindex[i] = j; - _curr[j] = _curr[i]; - _prev[j] = _prev[i]; - copy[j] = t; - t._index = j++; - } else { - reindex[i] = -1; - } - - _curr[i] = 0; // clear unused bits - } - - _data2 = copy; - return reindex; - }, - size: function size() { - return _data2.length; - }, - curr: function curr() { - return _curr; - }, - prev: function prev() { - return _prev; - }, - reset: function reset(k) { - _prev[k] = _curr[k]; - }, - all: function all() { - return width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff; - }, - set: function set(k, one) { - _curr[k] |= one; - }, - clear: function clear(k, one) { - _curr[k] &= ~one; - }, - resize: function resize(n, m) { - var k = _curr.length; - - if (n > k || m > width) { - width = Math.max(m, width); - _curr = array$1(n, width, _curr); - _prev = array$1(n, width); - } - } - }; -} - -function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; -} - -function array$1(n, m, array) { - var copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; -} - -function Dimension(index, i, query) { - var bit = 1 << i; - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - onAdd: function onAdd(added, curr) { - var dim = this, - range = dim.bisect(dim.range, added.value), - idx = added.index, - lo = range[0], - hi = range[1], - n1 = idx.length, - i; - - for (i = 0; i < lo; ++i) { - curr[idx[i]] |= bit; - } - - for (i = hi; i < n1; ++i) { - curr[idx[i]] |= bit; - } - - return dim; - } - }; -} -/** - * Maintains a list of values, sorted by key. - */ - - -function SortedIndex() { - var _index8 = array32(0), - value = [], - _size = 0; - - function insert(key, data, base) { - if (!data.length) return []; - var n0 = _size, - n1 = data.length, - addv = Array(n1), - addi = array32(n1), - oldv, - oldi, - i; - - for (i = 0; i < n1; ++i) { - addv[i] = key(data[i]); - addi[i] = i; - } - - addv = sort(addv, addi); - - if (n0) { - oldv = value; - oldi = _index8; - value = Array(n0 + n1); - _index8 = array32(n0 + n1); - merge$1(base, oldv, oldi, n0, addv, addi, n1, value, _index8); - } else { - if (base > 0) for (i = 0; i < n1; ++i) { - addi[i] += base; - } - value = addv; - _index8 = addi; - } - - _size = n0 + n1; - return { - index: addi, - value: addv - }; - } - - function remove(num, map) { - // map: index -> remove - var n = _size, - idx, - i, - j; // seek forward to first removal - - for (i = 0; !map[_index8[i]] && i < n; ++i) { - ; - } // condense index and value arrays - - - for (j = i; i < n; ++i) { - if (!map[idx = _index8[i]]) { - _index8[j] = idx; - value[j] = value[i]; - ++j; - } - } - - _size = n - num; - } - - function reindex(map) { - for (var i = 0, n = _size; i < n; ++i) { - _index8[i] = map[_index8[i]]; - } - } - - function bisect(range, array) { - var n; - - if (array) { - n = array.length; - } else { - array = value; - n = _size; - } - - return [bisectLeft(array, range[0], 0, n), bisectRight(array, range[1], 0, n)]; - } - - return { - insert: insert, - remove: remove, - bisect: bisect, - reindex: reindex, - index: function index() { - return _index8; - }, - size: function size() { - return _size; - } - }; -} - -function sort(values, index) { - values.sort.call(index, function (a, b) { - var x = values[a], - y = values[b]; - return x < y ? -1 : x > y ? 1 : 0; - }); - return permute(values, index); -} - -function merge$1(base, value0, index0, n0, value1, index1, n1, value, index) { - var i0 = 0, - i1 = 0, - i; - - for (i = 0; i0 < n0 && i1 < n1; ++i) { - if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - } - - for (; i0 < n0; ++i0, ++i) { - value[i] = value0[i0]; - index[i] = index0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } -} -/** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ - - -function CrossFilter(params) { - Transform.call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; -} - -CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'query', - 'type': 'array', - 'array': true, - 'required': true, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }] -}; -var prototype$1q = inherits(CrossFilter, Transform); - -prototype$1q.transform = function (_, pulse) { - if (!this._dims) { - return this.init(_, pulse); - } else { - var init = _.modified('fields') || _.fields.some(function (f) { - return pulse.modified(f.fields); - }); - - return init ? this.reinit(_, pulse) : this.eval(_, pulse); - } -}; - -prototype$1q.init = function (_, pulse) { - var fields = _.fields, - query = _.query, - indices = this._indices = {}, - dims = this._dims = [], - m = query.length, - i = 0, - key, - index; // instantiate indices and dimensions - - for (; i < m; ++i) { - key = fields[i].fname; - index = indices[key] || (indices[key] = SortedIndex()); - dims.push(Dimension(index, i, query[i])); - } - - return this.eval(_, pulse); -}; - -prototype$1q.reinit = function (_, pulse) { - var output = pulse.materialize().fork(), - fields = _.fields, - query = _.query, - indices = this._indices, - dims = this._dims, - bits = this.value, - curr = bits.curr(), - prev = bits.prev(), - all = bits.all(), - out = output.rem = output.add, - mod = output.mod, - m = query.length, - adds = {}, - add, - index, - key, - mods, - remMap, - modMap, - i, - n, - f; // set prev to current state - - prev.set(curr); // if pulse has remove tuples, process them first - - if (pulse.rem.length) { - remMap = this.remove(_, pulse, output); - } // if pulse has added tuples, add them to state - - - if (pulse.add.length) { - bits.add(pulse.add); - } // if pulse has modified tuples, create an index map - - - if (pulse.mod.length) { - modMap = {}; - - for (mods = pulse.mod, i = 0, n = mods.length; i < n; ++i) { - modMap[mods[i]._index] = 1; - } - } // re-initialize indices as needed, update curr bitmap - - - for (i = 0; i < m; ++i) { - f = fields[i]; - - if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) { - key = f.fname; - - if (!(add = adds[key])) { - indices[key] = index = SortedIndex(); - adds[key] = add = index.insert(f, pulse.source, 0); - } - - dims[i] = Dimension(index, i, query[i]).onAdd(add, curr); - } - } // visit each tuple - // if filter state changed, push index to add/rem - // else if in mod and passes a filter, push index to mod - - - for (i = 0, n = bits.data().length; i < n; ++i) { - if (remMap[i]) { - // skip if removed tuple - continue; - } else if (prev[i] !== curr[i]) { - // add if state changed - out.push(i); - } else if (modMap[i] && curr[i] !== all) { - // otherwise, pass mods through - mod.push(i); - } - } - - bits.mask = (1 << m) - 1; - return output; -}; - -prototype$1q.eval = function (_, pulse) { - var output = pulse.materialize().fork(), - m = this._dims.length, - mask = 0; - - if (pulse.rem.length) { - this.remove(_, pulse, output); - mask |= (1 << m) - 1; - } - - if (_.modified('query') && !_.modified('fields')) { - mask |= this.update(_, pulse, output); - } - - if (pulse.add.length) { - this.insert(_, pulse, output); - mask |= (1 << m) - 1; - } - - if (pulse.mod.length) { - this.modify(pulse, output); - mask |= (1 << m) - 1; - } - - this.value.mask = mask; - return output; -}; - -prototype$1q.insert = function (_, pulse, output) { - var tuples = pulse.add, - bits = this.value, - dims = this._dims, - indices = this._indices, - fields = _.fields, - adds = {}, - out = output.add, - k = bits.size(), - n = k + tuples.length, - m = dims.length, - j, - key, - add; // resize bitmaps and add tuples as needed - - bits.resize(n, m); - bits.add(tuples); - var curr = bits.curr(), - prev = bits.prev(), - all = bits.all(); // add to dimensional indices - - for (j = 0; j < m; ++j) { - key = fields[j].fname; - add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k)); - dims[j].onAdd(add, curr); - } // set previous filters, output if passes at least one filter - - - for (; k < n; ++k) { - prev[k] = all; - if (curr[k] !== all) out.push(k); - } -}; - -prototype$1q.modify = function (pulse, output) { - var out = output.mod, - bits = this.value, - curr = bits.curr(), - all = bits.all(), - tuples = pulse.mod, - i, - n, - k; - - for (i = 0, n = tuples.length; i < n; ++i) { - k = tuples[i]._index; - if (curr[k] !== all) out.push(k); - } -}; - -prototype$1q.remove = function (_, pulse, output) { - var indices = this._indices, - bits = this.value, - curr = bits.curr(), - prev = bits.prev(), - all = bits.all(), - map = {}, - out = output.rem, - tuples = pulse.rem, - i, - n, - k, - f; // process tuples, output if passes at least one filter - - for (i = 0, n = tuples.length; i < n; ++i) { - k = tuples[i]._index; - map[k] = 1; // build index map - - prev[k] = f = curr[k]; - curr[k] = all; - if (f !== all) out.push(k); - } // remove from dimensional indices - - - for (k in indices) { - indices[k].remove(n, map); - } - - this.reindex(pulse, n, map); - return map; -}; // reindex filters and indices after propagation completes - - -prototype$1q.reindex = function (pulse, num, map) { - var indices = this._indices, - bits = this.value; - pulse.runAfter(function () { - var indexMap = bits.remove(num, map); - - for (var key in indices) { - indices[key].reindex(indexMap); - } - }); -}; - -prototype$1q.update = function (_, pulse, output) { - var dims = this._dims, - query = _.query, - stamp = pulse.stamp, - m = dims.length, - mask = 0, - i, - q; // survey how many queries have changed - - output.filters = 0; - - for (q = 0; q < m; ++q) { - if (_.modified('query', q)) { - i = q; - ++mask; - } - } - - if (mask === 1) { - // only one query changed, use more efficient update - mask = dims[i].one; - this.incrementOne(dims[i], query[i], output.add, output.rem); - } else { - // multiple queries changed, perform full record keeping - for (q = 0, mask = 0; q < m; ++q) { - if (!_.modified('query', q)) continue; - mask |= dims[q].one; - this.incrementAll(dims[q], query[q], stamp, output.add); - output.rem = output.add; // duplicate add/rem for downstream resolve - } - } - - return mask; -}; - -prototype$1q.incrementAll = function (dim, query, stamp, out) { - var bits = this.value, - seen = bits.seen(), - curr = bits.curr(), - prev = bits.prev(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, - j, - k; // Fast incremental update based on previous lo index. - - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } // Fast incremental update based on previous hi index. - - - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } - - dim.range = query.slice(); -}; - -prototype$1q.incrementOne = function (dim, query, add, rem) { - var bits = this.value, - curr = bits.curr(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, - j, - k; // Fast incremental update based on previous lo index. - - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } // Fast incremental update based on previous hi index. - - - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - dim.range = query.slice(); -}; -/** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ - - -function ResolveFilter(params) { - Transform.call(this, null, params); -} - -ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [{ - 'name': 'ignore', - 'type': 'number', - 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' - }, { - 'name': 'filter', - 'type': 'object', - 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' - }] -}; -var prototype$1r = inherits(ResolveFilter, Transform); - -prototype$1r.transform = function (_, pulse) { - var ignore = ~(_.ignore || 0), - // bit mask where zeros -> dims to ignore - bitmap = _.filter, - mask = bitmap.mask; // exit early if no relevant filter changes - - if ((mask & ignore) === 0) return pulse.StopPropagation; - - var output = pulse.fork(pulse.ALL), - data = bitmap.data(), - curr = bitmap.curr(), - prev = bitmap.prev(), - pass = function pass(k) { - return !(curr[k] & ignore) ? data[k] : null; - }; // propagate all mod tuples that pass the filter - - - output.filter(output.MOD, pass); // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - - if (!(mask & mask - 1)) { - // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, function (k) { - return (curr[k] & ignore) === mask ? data[k] : null; - }); - } else { - // multiple filters changed - output.filter(output.ADD, function (k) { - var c = curr[k] & ignore, - f = !c && c ^ prev[k] & ignore; - return f ? data[k] : null; - }); - output.filter(output.REM, function (k) { - var c = curr[k] & ignore, - f = c && !(c ^ (c ^ prev[k] & ignore)); - return f ? data[k] : null; - }); - } // add filter to source data in case of reflow... - - - return output.filter(output.SOURCE, function (t) { - return pass(t._index); - }); -}; - -var xf = /*#__PURE__*/Object.freeze({ - __proto__: null, - crossfilter: CrossFilter, - resolvefilter: ResolveFilter -}); -var version = "5.13.0"; // initialize aria role and label attributes - -exports.version = version; - -function initializeAria(view) { - var el = view.container(); - - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } -} // update aria-label if we have a DOM container element - - -function ariaLabel(el, desc) { - if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc); -} - -function background$1(view) { - // respond to background signal - view.add(null, function (_) { - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { - bg: view._signals.background - }); -} - -var Default = 'default'; - -function cursor(view) { - // get cursor signal, add to dataflow if needed - var cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); // evaluate cursor on each mousemove event - - view.on(view.events('view', 'mousemove'), cursor, function (_, event) { - var value = cursor.value, - user = value ? isString(value) ? value : value.user : Default, - item = event.item && event.item.cursor || null; - return value && user === value.user && item == value.item ? value : { - user: user, - item: item - }; - }); // when cursor signal updates, set visible cursor - - view.add(null, function (_) { - var user = _.cursor, - item = this.value; - - if (!isString(user)) { - item = user.item; - user = user.user; - } - - setCursor(view, user && user !== Default ? user : item || user); - return item; - }, { - cursor: cursor - }); -} - -function setCursor(view, cursor) { - var el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container(); - - if (el) { - return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor; - } -} - -function dataref(view, name) { - var data = view._runtime.data; - - if (!hasOwnProperty(data, name)) { - error('Unrecognized data set: ' + name); - } - - return data[name]; -} - -function data(name, values) { - return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values)); -} - -function change(name, changes) { - if (!isChangeSet(changes)) { - error('Second argument to changes must be a changeset.'); - } - - var dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); -} - -function insert(name, _) { - return change.call(this, name, changeset().insert(_)); -} - -function remove(name, _) { - return change.call(this, name, changeset().remove(_)); -} - -function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); -} - -function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); -} - -function offset$3(view) { - var padding = view.padding(), - origin = view._origin; - return [padding.left + origin[0], padding.top + origin[1]]; -} - -function resizeRenderer(view) { - var origin = offset$3(view), - w = width(view), - h = height(view); - - view._renderer.background(view.background()); - - view._renderer.resize(w, h, origin); - - view._handler.origin(origin); - - view._resizeListeners.forEach(function (handler) { - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); -} -/** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ - - -function eventExtend(view, event, item) { - var r = view._renderer, - el = r && r.canvas(), - p, - e, - translate; - - if (el) { - translate = offset$3(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = point(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; -} - -function extension(view, item, point) { - var itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null; - - function group(name) { - var g = itemGroup, - i; - if (name) for (i = item; i; i = i.mark.group) { - if (i.mark.name === name) { - g = i; - break; - } - } - return g && g.mark && g.mark.interactive ? g : {}; - } - - function xy(item) { - if (!item) return point; - if (isString(item)) item = group(item); - var p = point.slice(); - - while (item) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - - return p; - } - - return { - view: constant(view), - item: constant(item || {}), - group: group, - xy: xy, - x: function x(item) { - return xy(item)[0]; - }, - y: function y(item) { - return xy(item)[1]; - } - }; -} - -var VIEW = 'view', - TIMER = 'timer', - WINDOW = 'window', - NO_TRAP = { - trap: false -}; -/** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ - -function initializeEventConfig(config) { - var events = extend({ - defaults: {} - }, config); - - var unpack = function unpack(obj, keys) { - keys.forEach(function (k) { - if (isArray(obj[k])) obj[k] = toSet(obj[k]); - }); - }; - - unpack(events.defaults, ['prevent', 'allow']); - unpack(events, ['view', 'window', 'selector']); - return events; -} - -function prevent(view, type) { - var def = view._eventConfig.defaults, - prevent = def.prevent, - allow = def.allow; - return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault(); -} - -function permit(view, key, type) { - var rule = view._eventConfig && view._eventConfig[key]; - - if (rule === false || isObject(rule) && !rule[type]) { - view.warn("Blocked ".concat(key, " ").concat(type, " event listener.")); - return false; - } - - return true; -} -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ - - -function events$1(source, type, filter) { - var view = this, - s = new EventStream(filter), - send = function send(e, item) { - view.runAsync(null, function () { - if (source === VIEW && prevent(view, type)) { - e.preventDefault(); - } - - s.receive(eventExtend(view, e, item)); - }); - }, - sources; - - if (source === TIMER) { - if (permit(view, 'timer', type)) { - view.timer(send, type); - } - } else if (source === VIEW) { - if (permit(view, 'view', type)) { - // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } - } else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') { - sources = [window]; - } - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) { - sources = document.querySelectorAll(source); - } - } - - if (!sources) { - view.warn('Can not resolve event source: ' + source); - } else { - for (var i = 0, n = sources.length; i < n; ++i) { - sources[i].addEventListener(type, send); - } - - view._eventListeners.push({ - type: type, - sources: sources, - handler: send - }); - } - } - - return s; -} - -function itemFilter(event) { - return event.item; -} - -function markTarget(event) { - // grab upstream collector feeding the mark operator - return event.item.mark.source; -} - -function invoke(name) { - return function (_, event) { - return event.vega.view().changeset().encode(event.item, name); - }; -} - -function hover(hoverSet, leaveSet) { - hoverSet = [hoverSet || 'hover']; - leaveSet = [leaveSet || 'update', hoverSet[0]]; // invoke hover set upon mouseover - - this.on(this.events('view', 'mouseover', itemFilter), markTarget, invoke(hoverSet)); // invoke leave set upon mouseout - - this.on(this.events('view', 'mouseout', itemFilter), markTarget, invoke(leaveSet)); - return this; -} -/** - * Finalize a View instance that is being removed. - * Cancel any running timers. - * Remove all external event listeners. - * Remove any currently displayed tooltip. - */ - - -function finalize() { - var tooltip = this._tooltip, - timers = this._timers, - listeners = this._eventListeners, - n, - m, - e; - n = timers.length; - - while (--n >= 0) { - timers[n].stop(); - } - - n = listeners.length; - - while (--n >= 0) { - e = listeners[n]; - m = e.sources.length; - - while (--m >= 0) { - e.sources[m].removeEventListener(e.type, e.handler); - } - } - - if (tooltip) { - tooltip.call(this, this._handler, null, null, null); - } - - return this; -} - -function element$1(tag, attr, text) { - var el = document.createElement(tag); - - for (var key in attr) { - el.setAttribute(key, attr[key]); - } - - if (text != null) el.textContent = text; - return el; -} - -var BindClass = 'vega-bind', - NameClass = 'vega-bind-name', - RadioClass = 'vega-bind-radio'; -/** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ - -function bind$1(view, el, binding) { - if (!el) return; - var param = binding.param; - var bind = binding.state; - - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: function update(value) { - if (value !== view.signal(param.signal)) { - view.runAsync(null, function () { - bind.source = true; - view.signal(param.signal, value); - }); - } - } - }; - - if (param.debounce) { - bind.update = debounce(param.debounce, bind.update); - } - } - - generate(bind, el, param, view.signal(param.signal)); - - if (!bind.active) { - view.on(view._signals[param.signal], null, function () { - bind.source ? bind.source = false : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - - return bind; -} -/** - * Generate an HTML input form element and bind it to a signal. - */ - - -function generate(bind, el, param, value) { - var div = element$1('div', { - 'class': BindClass - }); - var wrapper = param.input === 'radio' ? div : div.appendChild(element$1('label')); - wrapper.appendChild(element$1('span', { - 'class': NameClass - }, param.name || param.signal)); - el.appendChild(div); - var input = form; - - switch (param.input) { - case 'checkbox': - input = checkbox; - break; - - case 'select': - input = select; - break; - - case 'radio': - input = radio; - break; - - case 'range': - input = range; - break; - } - - input(bind, wrapper, param, value); -} -/** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ - - -function form(bind, el, param, value) { - var node = element$1('input'); - - for (var _key8 in param) { - if (_key8 !== 'signal' && _key8 !== 'element') { - node.setAttribute(_key8 === 'input' ? 'type' : _key8, param[_key8]); - } - } - - node.setAttribute('name', param.signal); - node.value = value; - el.appendChild(node); - node.addEventListener('input', function () { - return bind.update(node.value); - }); - bind.elements = [node]; - - bind.set = function (value) { - return node.value = value; - }; -} -/** - * Generates a checkbox input element. - */ - - -function checkbox(bind, el, param, value) { - var attr = { - type: 'checkbox', - name: param.signal - }; - if (value) attr.checked = true; - var node = element$1('input', attr); - el.appendChild(node); - node.addEventListener('change', function () { - return bind.update(node.checked); - }); - bind.elements = [node]; - - bind.set = function (value) { - return node.checked = !!value || null; - }; -} -/** - * Generates a selection list input element. - */ - - -function select(bind, el, param, value) { - var node = element$1('select', { - name: param.signal - }), - labels = param.labels || []; - param.options.forEach(function (option, i) { - var attr = { - value: option - }; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element$1('option', attr, (labels[i] || option) + '')); - }); - el.appendChild(node); - node.addEventListener('change', function () { - bind.update(param.options[node.selectedIndex]); - }); - bind.elements = [node]; - - bind.set = function (value) { - for (var i = 0, n = param.options.length; i < n; ++i) { - if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; - return; - } - } - }; -} -/** - * Generates a radio button group. - */ - - -function radio(bind, el, param, value) { - var group = element$1('span', { - 'class': RadioClass - }), - labels = param.labels || []; - el.appendChild(group); - bind.elements = param.options.map(function (option, i) { - var attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - var input = element$1('input', attr); - input.addEventListener('change', function () { - return bind.update(option); - }); - var label = element$1('label', {}, (labels[i] || option) + ''); - label.prepend(input); - group.appendChild(label); - return input; - }); - - bind.set = function (value) { - var nodes = bind.elements, - n = nodes.length; - - for (var i = 0; i < n; ++i) { - if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - } - }; -} -/** - * Generates a slider input element. - */ - - -function range(bind, el, param, value) { - value = value !== undefined ? value : (+param.max + +param.min) / 2; - var max = param.max != null ? param.max : Math.max(100, +value) || 100, - min = param.min || Math.min(0, max, +value) || 0, - step = param.step || tickStep(min, max, 100); - var node = element$1('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - var span = element$1('span', {}, +value); - el.appendChild(node); - el.appendChild(span); - - var update = function update() { - span.textContent = node.value; - bind.update(+node.value); - }; // subscribe to both input and change - - - node.addEventListener('input', update); - node.addEventListener('change', update); - bind.elements = [node]; - - bind.set = function (value) { - node.value = value; - span.textContent = value; - }; -} - -function valuesEqual(a, b) { - return a === b || a + '' === b + ''; -} - -function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r.initialize(el, width(view), height(view), offset$3(view), scaleFactor, opt).background(view.background()); -} - -function trap(view, fn) { - return !fn ? null : function () { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; -} - -function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - var handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset$3(view), view); // transfer event handlers - - if (prevHandler) { - prevHandler.handlers().forEach(function (h) { - handler.on(h.type, h.handler); - }); - } - - return handler; -} - -function initialize$1(el, elBind) { - var view = this, - type = view._renderType, - config = view._eventConfig.bind, - module = renderModule(type); // containing dom element - - el = view._el = el ? lookup$4(view, el) : null; // initialize aria attributes - - initializeAria(view); // select appropriate renderer & handler - - if (!module) view.error('Unrecognized renderer type: ' + type); - var Handler = module.handler || CanvasHandler, - Renderer = el ? module.renderer : module.headless; // initialize renderer and input handler - - view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; // initialize signal bindings - - if (el && config !== 'none') { - elBind = elBind ? view._elBind = lookup$4(view, elBind) : el.appendChild(element$1('form', { - 'class': 'vega-bindings' - })); - - view._bind.forEach(function (_) { - if (_.param.element && config !== 'container') { - _.element = lookup$4(view, _.param.element); - } - }); - - view._bind.forEach(function (_) { - bind$1(view, _.element || elBind, _); - }); - } - - return view; -} - -function lookup$4(view, el) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; - } - } - - if (el) { - try { - el.innerHTML = ''; - } catch (e) { - el = null; - view.error(e); - } - } - - return el; -} - -var number$5 = function number$5(_) { - return +_ || 0; -}; - -var paddingObject = function paddingObject(_) { - return { - top: _, - bottom: _, - left: _, - right: _ - }; -}; - -function padding(_) { - return isObject(_) ? { - top: number$5(_.top), - bottom: number$5(_.bottom), - left: number$5(_.left), - right: number$5(_.right) - } : paddingObject(number$5(_)); -} -/** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ - - -function renderHeadless(_x32, _x33, _x34, _x35) { - return _renderHeadless.apply(this, arguments); -} -/** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ - - -function _renderHeadless() { - _renderHeadless = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(view, type, scaleFactor, opt) { - var module, ctr; - return regeneratorRuntime.wrap(function _callee12$(_context19) { - while (1) { - switch (_context19.prev = _context19.next) { - case 0: - module = renderModule(type), ctr = module && module.headless; - if (!ctr) error('Unrecognized renderer type: ' + type); - _context19.next = 4; - return view.runAsync(); - - case 4: - return _context19.abrupt("return", initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root)); - - case 5: - case "end": - return _context19.stop(); - } - } - }, _callee12); - })); - return _renderHeadless.apply(this, arguments); -} - -function renderToImageURL(_x36, _x37) { - return _renderToImageURL.apply(this, arguments); -} - -function _renderToImageURL() { - _renderToImageURL = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(type, scaleFactor) { - var r; - return regeneratorRuntime.wrap(function _callee13$(_context20) { - while (1) { - switch (_context20.prev = _context20.next) { - case 0: - if (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG) { - error('Unrecognized image type: ' + type); - } - - _context20.next = 3; - return renderHeadless(this, type, scaleFactor); - - case 3: - r = _context20.sent; - return _context20.abrupt("return", type === RenderType.SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png')); - - case 5: - case "end": - return _context20.stop(); - } - } - }, _callee13, this); - })); - return _renderToImageURL.apply(this, arguments); -} - -function toBlobURL(data, mime) { - var blob = new Blob([data], { - type: mime - }); - return window.URL.createObjectURL(blob); -} -/** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ - - -function renderToCanvas(_x38, _x39) { - return _renderToCanvas.apply(this, arguments); -} -/** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ - - -function _renderToCanvas() { - _renderToCanvas = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(scaleFactor, opt) { - var r; - return regeneratorRuntime.wrap(function _callee14$(_context21) { - while (1) { - switch (_context21.prev = _context21.next) { - case 0: - _context21.next = 2; - return renderHeadless(this, RenderType.Canvas, scaleFactor, opt); - - case 2: - r = _context21.sent; - return _context21.abrupt("return", r.canvas()); - - case 4: - case "end": - return _context21.stop(); - } - } - }, _callee14, this); - })); - return _renderToCanvas.apply(this, arguments); -} - -function renderToSVG(_x40) { - return _renderToSVG.apply(this, arguments); -} - -function _renderToSVG() { - _renderToSVG = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(scaleFactor) { - var r; - return regeneratorRuntime.wrap(function _callee15$(_context22) { - while (1) { - switch (_context22.prev = _context22.next) { - case 0: - _context22.next = 2; - return renderHeadless(this, RenderType.SVG, scaleFactor); - - case 2: - r = _context22.sent; - return _context22.abrupt("return", r.svg()); - - case 4: - case "end": - return _context22.stop(); - } - } - }, _callee15, this); - })); - return _renderToSVG.apply(this, arguments); -} - -function data$1(name) { - var data = this.context.data[name]; - return data ? data.values.value : []; -} - -function indata(name, field, value) { - var index = this.context.data[name]['index:' + field], - entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; -} - -function setdata(name, tuples) { - var df = this.context.dataflow, - data = this.context.data[name], - input = data.input; - df.pulse(input, df.changeset().remove(truthy).insert(tuples)); - return 1; -} - -function encode$1(item, name, retval) { - if (item) { - var df = this.context.dataflow, - target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - - return retval !== undefined ? retval : item; -} - -var wrap = function wrap(method) { - return function (value, spec) { - var locale = this.context.dataflow.locale(); - return locale[method](spec)(value); - }; -}; - -var format$2 = wrap('format'); -var timeFormat = wrap('timeFormat'); -var utcFormat = wrap('utcFormat'); -var timeParse = wrap('timeParse'); -var utcParse = wrap('utcParse'); -var dateObj = new Date(2000, 0, 1); - -function time$1(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); - dateObj.setMonth(month); - dateObj.setDate(day); - return timeFormat.call(this, dateObj, specifier); -} - -function monthFormat(month) { - return time$1.call(this, month, 1, '%B'); -} - -function monthAbbrevFormat(month) { - return time$1.call(this, month, 1, '%b'); -} - -function dayFormat(day) { - return time$1.call(this, 0, 2 + day, '%A'); -} - -function dayAbbrevFormat(day) { - return time$1.call(this, 0, 2 + day, '%a'); -} - -var DataPrefix = ':'; -var IndexPrefix = '@'; -var ScalePrefix = '%'; -var SignalPrefix = '$'; -var RawCode = 'RawCode'; -var Literal = 'Literal'; -var Property = 'Property'; -var Identifier$1 = 'Identifier'; -var ArrayExpression = 'ArrayExpression'; -var BinaryExpression = 'BinaryExpression'; -var CallExpression = 'CallExpression'; -var ConditionalExpression = 'ConditionalExpression'; -var LogicalExpression = 'LogicalExpression'; -var MemberExpression = 'MemberExpression'; -var ObjectExpression = 'ObjectExpression'; -var UnaryExpression = 'UnaryExpression'; - -function ASTNode(type) { - this.type = type; -} - -ASTNode.prototype.visit = function (visitor) { - var node = this, - c, - i, - n; - if (visitor(node)) return 1; - - for (c = children$1(node), i = 0, n = c.length; i < n; ++i) { - if (c[i].visit(visitor)) return 1; - } -}; - -function children$1(node) { - switch (node.type) { - case ArrayExpression: - return node.elements; - - case BinaryExpression: - case LogicalExpression: - return [node.left, node.right]; - - case CallExpression: - var args = node.arguments.slice(); - args.unshift(node.callee); - return args; - - case ConditionalExpression: - return [node.test, node.consequent, node.alternate]; - - case MemberExpression: - return [node.object, node.property]; - - case ObjectExpression: - return node.properties; - - case Property: - return [node.key, node.value]; - - case UnaryExpression: - return [node.argument]; - - case Identifier$1: - case Literal: - case RawCode: - default: - return []; - } -} -/* - The following expression parser is based on Esprima (http://esprima.org/). - Original header comment and license for Esprima is included here: - - Copyright (C) 2013 Ariya Hidayat - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - - 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. - - 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 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. -*/ - - -var TokenName, source$1, index, length, lookahead; -var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; -TokenName = {}; -TokenName[TokenBooleanLiteral] = 'Boolean'; -TokenName[TokenEOF] = ''; -TokenName[TokenIdentifier] = 'Identifier'; -TokenName[TokenKeyword] = 'Keyword'; -TokenName[TokenNullLiteral] = 'Null'; -TokenName[TokenNumericLiteral] = 'Numeric'; -TokenName[TokenPunctuator] = 'Punctuator'; -TokenName[TokenStringLiteral] = 'String'; -TokenName[TokenRegularExpression] = 'RegularExpression'; -var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; // Error messages should be identical to V8. - -var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; -var ILLEGAL = 'ILLEGAL', - DISABLED = 'Disabled.'; // See also tools/generate-unicode-regex.py. - -var RegexNonAsciiIdentifierStart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\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\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), - // eslint-disable-next-line no-misleading-character-class -RegexNonAsciiIdentifierPart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E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\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"); // Ensure the condition is true, otherwise throw an error. -// This is only to have a better contract semantic, i.e. another safety net -// to catch a logic error. The condition shall be fulfilled in normal case. -// Do NOT use this to enforce a certain condition on any user input. - -function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } -} - -function isDecimalDigit(ch) { - return ch >= 0x30 && ch <= 0x39; // 0..9 -} - -function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; -} - -function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; -} // 7.2 White Space - - -function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0; -} // 7.3 Line Terminators - - -function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; -} // 7.6 Identifier Names and Identifiers - - -function isIdentifierStart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)); -} - -function isIdentifierPart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)); -} // 7.6.1.1 Keywords - - -var keywords = { - 'if': 1, - 'in': 1, - 'do': 1, - 'var': 1, - 'for': 1, - 'new': 1, - 'try': 1, - 'let': 1, - 'this': 1, - 'else': 1, - 'case': 1, - 'void': 1, - 'with': 1, - 'enum': 1, - 'while': 1, - 'break': 1, - 'catch': 1, - 'throw': 1, - 'const': 1, - 'yield': 1, - 'class': 1, - 'super': 1, - 'return': 1, - 'typeof': 1, - 'delete': 1, - 'switch': 1, - 'export': 1, - 'import': 1, - 'public': 1, - 'static': 1, - 'default': 1, - 'finally': 1, - 'extends': 1, - 'package': 1, - 'private': 1, - 'function': 1, - 'continue': 1, - 'debugger': 1, - 'interface': 1, - 'protected': 1, - 'instanceof': 1, - 'implements': 1 -}; - -function skipComment() { - var ch; - - while (index < length) { - ch = source$1.charCodeAt(index); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index; - } else { - break; - } - } -} - -function scanHexEscape(prefix) { - var i, - len, - ch, - code = 0; - len = prefix === 'u' ? 4 : 2; - - for (i = 0; i < len; ++i) { - if (index < length && isHexDigit(source$1[index])) { - ch = source$1[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - return String.fromCharCode(code); -} - -function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - ch = source$1[index]; - code = 0; // At least, one hex digit is required. - - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - while (index < length) { - ch = source$1[index++]; - - if (!isHexDigit(ch)) { - break; - } - - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } // UTF-16 Encoding - - - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - - cu1 = (code - 0x10000 >> 10) + 0xD800; - cu2 = (code - 0x10000 & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); -} - -function getEscapedIdentifier() { - var ch, id; - ch = source$1.charCodeAt(index++); - id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character. - - if (ch === 0x5C) { - if (source$1.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - ++index; - ch = scanHexEscape('u'); - - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - id = ch; - } - - while (index < length) { - ch = source$1.charCodeAt(index); - - if (!isIdentifierPart(ch)) { - break; - } - - ++index; - id += String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character. - - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - - if (source$1.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - ++index; - ch = scanHexEscape('u'); - - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - id += ch; - } - } - - return id; -} - -function getIdentifier() { - var start, ch; - start = index++; - - while (index < length) { - ch = source$1.charCodeAt(index); - - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); - } - - if (isIdentifierPart(ch)) { - ++index; - } else { - break; - } - } - - return source$1.slice(start, index); -} - -function scanIdentifier() { - var start, id, type; - start = index; // Backslash (U+005C) starts an escaped character. - - id = source$1.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { - // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index - }; -} // 7.7 Punctuators - - -function scanPunctuator() { - var start = index, - code = source$1.charCodeAt(index), - code2, - ch1 = source$1[index], - ch2, - ch3, - ch4; - - switch (code) { - // Check for most common single-character punctuators. - case 0x2E: // . dot - - case 0x28: // ( open bracket - - case 0x29: // ) close bracket - - case 0x3B: // ; semicolon - - case 0x2C: // , comma - - case 0x7B: // { open curly brace - - case 0x7D: // } close curly brace - - case 0x5B: // [ - - case 0x5D: // ] - - case 0x3A: // : - - case 0x3F: // ? - - case 0x7E: - // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - - default: - code2 = source$1.charCodeAt(index + 1); // '=' (U+003D) marks an assignment or comparison operator. - - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - - case 0x2D: // - - - case 0x2F: // / - - case 0x3C: // < - - case 0x3E: // > - - case 0x5E: // ^ - - case 0x7C: // | - - case 0x25: // % - - case 0x26: // & - - case 0x2A: - // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - - case 0x21: // ! - - case 0x3D: - // = - index += 2; // !== and === - - if (source$1.charCodeAt(index) === 0x3D) { - ++index; - } - - return { - type: TokenPunctuator, - value: source$1.slice(start, index), - start: start, - end: index - }; - } - } - - } // 4-character punctuator: >>>= - - - ch4 = source$1.substr(index, 4); - - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } // 3-character punctuators: === !== >>> <<= >>= - - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } // Other 2-character punctuators: ++ -- << >> && || - - - ch2 = ch3.substr(0, 2); - - if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } // 1-character punctuators: < > = ! + - * % & | ^ / - - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL); -} // 7.8.3 Numeric Literals - - -function scanHexLiteral(start) { - var number = ''; - - while (index < length) { - if (!isHexDigit(source$1[index])) { - break; - } - - number += source$1[index++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - if (isIdentifierStart(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index - }; -} - -function scanOctalLiteral(start) { - var number = '0' + source$1[index++]; - - while (index < length) { - if (!isOctalDigit(source$1[index])) { - break; - } - - number += source$1[index++]; - } - - if (isIdentifierStart(source$1.charCodeAt(index)) || isDecimalDigit(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; -} - -function scanNumericLiteral() { - var number, start, ch; - ch = source$1[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point'); - start = index; - number = ''; - - if (ch !== '.') { - number = source$1[index++]; - ch = source$1[index]; // Hex number starts with '0x'. - // Octal number starts with '0'. - - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } // decimal number starts with '0' such as '09' is illegal. - - - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - - ch = source$1[index]; - } - - if (ch === '.') { - number += source$1[index++]; - - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - - ch = source$1[index]; - } - - if (ch === 'e' || ch === 'E') { - number += source$1[index++]; - ch = source$1[index]; - - if (ch === '+' || ch === '-') { - number += source$1[index++]; - } - - if (isDecimalDigit(source$1.charCodeAt(index))) { - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - if (isIdentifierStart(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; -} // 7.8.4 String Literals - - -function scanStringLiteral() { - var str = '', - quote, - start, - ch, - code, - octal = false; - quote = source$1[index]; - assert(quote === '\'' || quote === '"', 'String literal must starts with a quote'); - start = index; - ++index; - - while (index < length) { - ch = source$1[index++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source$1[index++]; - - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source$1[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - - break; - - case 'n': - str += '\n'; - break; - - case 'r': - str += '\r'; - break; - - case 't': - str += '\t'; - break; - - case 'b': - str += '\b'; - break; - - case 'f': - str += '\f'; - break; - - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); // \0 is not octal escape sequence - - if (code !== 0) { - octal = true; - } - - if (index < length && isOctalDigit(source$1[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source$1[index++]); // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - - if ('0123'.indexOf(ch) >= 0 && index < length && isOctalDigit(source$1[index])) { - code = code * 8 + '01234567'.indexOf(source$1[index++]); - } - } - - str += String.fromCharCode(code); - } else { - str += ch; - } - - break; - } - } else { - if (ch === '\r' && source$1[index] === '\n') { - ++index; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index - }; -} - -function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - - throwError({}, MessageInvalidRegExp); - }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } // First, detect invalid regular expressions. - - - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - - - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } -} - -function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - ch = source$1[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source$1[index++]; - classMarker = false; - terminated = false; - - while (index < length) { - ch = source$1[index++]; - str += ch; - - if (ch === '\\') { - ch = source$1[index++]; // ECMA-262 7.8.5 - - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } // Exclude leading and trailing slash. - - - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; -} - -function scanRegExpFlags() { - var ch, str, flags; - str = ''; - flags = ''; - - while (index < length) { - ch = source$1[index]; - - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index; - - if (ch === '\\' && index < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; -} - -function scanRegExp() { - var start, body, flags, value; - lookahead = null; - skipComment(); - start = index; - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index - }; -} - -function isIdentifierName(token) { - return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; -} - -function advance() { - var ch; - skipComment(); - - if (index >= length) { - return { - type: TokenEOF, - start: index, - end: index - }; - } - - ch = source$1.charCodeAt(index); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } // Very common: ( and ) and ; - - - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } // String literal starts with single quote (U+0027) or double quote (U+0022). - - - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - - - if (ch === 0x2E) { - if (isDecimalDigit(source$1.charCodeAt(index + 1))) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); -} - -function lex() { - var token; - token = lookahead; - index = token.end; - lookahead = advance(); - index = token.end; - return token; -} - -function peek$1() { - var pos; - pos = index; - lookahead = advance(); - index = pos; -} - -function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; -} - -function finishBinaryExpression(operator, left, right) { - var node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; -} - -function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; -} - -function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; -} - -function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; -} - -function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source$1.slice(token.start, token.end); - - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - - node.regex = token.regex; - } - - return node; -} - -function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; -} - -function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; -} - -function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; -} - -function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; -} // Throw an exception - - -function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace(/%(\d)/g, function (whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - }); - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; -} // Throw an exception because of the token. - - -function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } // BooleanLiteral, NullLiteral, or Punctuator. - - - throwError(token, MessageUnexpectedToken, token.value); -} // Expect the next token to match the specified punctuator. -// If not, an exception will be thrown. - - -function expect(value) { - var token = lex(); - - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } -} // Return true if the next token matches the specified punctuator. - - -function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; -} // Return true if the next token matches the specified keyword - - -function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; -} // 11.1.4 Array Initialiser - - -function parseArrayInitialiser() { - var elements = []; - index = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - return finishArrayExpression(elements); -} // 11.1.5 Object Initialiser - - -function parseObjectPropertyKey() { - var token; - index = lookahead.start; - token = lex(); // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - - return finishLiteral(token); - } - - return finishIdentifier(token.value); -} - -function parseObjectProperty() { - var token, key, id, value; - index = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } -} - -function parseObjectInitialiser() { - var properties = [], - property, - name, - key, - map = {}, - toString = String; - index = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - return finishObjectExpression(properties); -} // 11.1.6 The Grouping Operator - - -function parseGroupExpression() { - var expr; - expect('('); - expr = parseExpression(); - expect(')'); - return expr; -} // 11.1 Primary Expressions - - -var legalKeywords = { - 'if': 1 -}; - -function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index = lookahead.start; - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = token.value === 'true'; - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek$1(); - } else { - throwUnexpected(lex()); - } - - return expr; -} // 11.2 Left-Hand-Side Expressions - - -function parseArguments() { - var args = []; - expect('('); - - if (!match(')')) { - while (index < length) { - args.push(parseConditionalExpression()); - - if (match(')')) { - break; - } - - expect(','); - } - } - - expect(')'); - return args; -} - -function parseNonComputedProperty() { - var token; - index = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); -} - -function parseNonComputedMember() { - expect('.'); - return parseNonComputedProperty(); -} - -function parseComputedMember() { - var expr; - expect('['); - expr = parseExpression(); - expect(']'); - return expr; -} - -function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; -} // 11.3 Postfix Expressions - - -function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if (match('++') || match('--')) { - throw new Error(DISABLED); - } - } - - return expr; -} // 11.4 Unary Operators - - -function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; -} - -function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - } - - return prec; -} // 11.5 Multiplicative Operators -// 11.6 Additive Operators -// 11.7 Bitwise Shift Operators -// 11.8 Relational Operators -// 11.9 Equality Operators -// 11.10 Binary Bitwise Operators -// 11.11 Binary Logical Operators - - -function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - marker = lookahead; - left = parseUnaryExpression(); - token = lookahead; - prec = binaryPrecedence(token); - - if (prec === 0) { - return left; - } - - token.prec = prec; - lex(); - markers = [marker, lookahead]; - right = parseUnaryExpression(); - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - // Reduce: make a binary expression from the three topmost entries. - while (stack.length > 2 && prec <= stack[stack.length - 2].prec) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } // Shift. - - - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } // Final reduce to clean-up the stack. - - - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; -} // 11.12 Conditional Operator - - -function parseConditionalExpression() { - var expr, consequent, alternate; - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; -} // 11.14 Comma Operator - - -function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; -} - -function parse$3(code) { - source$1 = code; - index = 0; - length = source$1.length; - lookahead = null; - peek$1(); - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - - return expr; -} - -var constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' -}; - -function functions(codegen) { - function fncall(name, args, cast, type) { - var obj = codegen(args[0]); - - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - - return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')'); - } - - function fn(name, cast, type) { - return function (args) { - return fncall(name, args, cast, type); - }; - } - - var DATE = 'new Date', - STRING = 'String', - REGEXP = 'RegExp'; - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - clamp: function clamp(args) { - if (args.length < 3) error('Missing arguments to clamp function.'); - if (args.length > 3) error('Too many arguments to clamp function.'); - var a = args.map(codegen); - return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))'; - }, - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - // sequence functions - length: fn('length', null, -1), - join: fn('join', null), - indexof: fn('indexOf', null), - lastindexof: fn('lastIndexOf', null), - slice: fn('slice', null), - reverse: function reverse(args) { - return '(' + codegen(args[0]) + ').slice().reverse()'; - }, - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - replace: fn('replace', STRING), - trim: fn('trim', STRING, 0), - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - // Control Flow functions - if: function _if(args) { - if (args.length < 3) error('Missing arguments to if function.'); - if (args.length > 3) error('Too many arguments to if function.'); - var a = args.map(codegen); - return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')'; - } - }; -} - -function stripQuotes(s) { - var n = s && s.length - 1; - return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s; -} - -function codegen(opt) { - opt = opt || {}; - var whitelist = opt.whitelist ? toSet(opt.whitelist) : {}, - blacklist = opt.blacklist ? toSet(opt.blacklist) : {}, - constants$1 = opt.constants || constants, - functions$1 = (opt.functions || functions)(visit), - globalvar = opt.globalvar, - fieldvar = opt.fieldvar, - globals = {}, - fields = {}, - memberDepth = 0; - var outputGlobal = isFunction(globalvar) ? globalvar : function (id) { - return globalvar + '["' + id + '"]'; - }; - - function visit(ast) { - if (isString(ast)) return ast; - var generator = Generators[ast.type]; - if (generator == null) error('Unsupported type: ' + ast.type); - return generator(ast); - } - - var Generators = { - Literal: function Literal(n) { - return n.raw; - }, - Identifier: function Identifier(n) { - var id = n.name; - - if (memberDepth > 0) { - return id; - } else if (hasOwnProperty(blacklist, id)) { - return error('Illegal identifier: ' + id); - } else if (hasOwnProperty(constants$1, id)) { - return constants$1[id]; - } else if (hasOwnProperty(whitelist, id)) { - return id; - } else { - globals[id] = 1; - return outputGlobal(id); - } - }, - MemberExpression: function MemberExpression(n) { - var d = !n.computed; - var o = visit(n.object); - if (d) memberDepth += 1; - var p = visit(n.property); - - if (o === fieldvar) { - // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - } - - if (d) memberDepth -= 1; - return o + (d ? '.' + p : '[' + p + ']'); - }, - CallExpression: function CallExpression(n) { - if (n.callee.type !== 'Identifier') { - error('Illegal callee type: ' + n.callee.type); - } - - var callee = n.callee.name; - var args = n.arguments; - var fn = hasOwnProperty(functions$1, callee) && functions$1[callee]; - if (!fn) error('Unrecognized function: ' + callee); - return isFunction(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')'; - }, - ArrayExpression: function ArrayExpression(n) { - return '[' + n.elements.map(visit).join(',') + ']'; - }, - BinaryExpression: function BinaryExpression(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - UnaryExpression: function UnaryExpression(n) { - return '(' + n.operator + visit(n.argument) + ')'; - }, - ConditionalExpression: function ConditionalExpression(n) { - return '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')'; - }, - LogicalExpression: function LogicalExpression(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - ObjectExpression: function ObjectExpression(n) { - return '{' + n.properties.map(visit).join(',') + '}'; - }, - Property: function Property(n) { - memberDepth += 1; - var k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - - function codegen(ast) { - var result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; - } - - codegen.functions = functions$1; - codegen.constants = constants$1; - return codegen; -} - -function dataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) { - error('First argument to data functions must be a string literal.'); - } - - var data = args[0].value, - dataName = DataPrefix + data; - - if (!hasOwnProperty(dataName, params)) { - try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) {// if data set does not exist, there's nothing to track - } - } -} - -function indataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to indata must be a string literal.'); - if (args[1].type !== Literal) error('Second argument to indata must be a string literal.'); - var data = args[0].value, - field = args[1].value, - indexName = IndexPrefix + field; - - if (!hasOwnProperty(indexName, params)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } -} - -function scaleVisitor(name, args, scope, params) { - if (args[0].type === Literal) { - // add scale dependency - addScaleDependency(scope, params, args[0].value); - } else { - // indirect scale lookup; add all scales as parameters - for (name in scope.scales) { - addScaleDependency(scope, params, name); - } - } -} - -function addScaleDependency(scope, params, name) { - var scaleName = ScalePrefix + name; - - if (!hasOwnProperty(params, scaleName)) { - try { - params[scaleName] = scope.scaleRef(name); - } catch (err) {// TODO: error handling? warning? - } - } -} - -function getScale(name, ctx) { - var s; - return isFunction(name) ? name : isString(name) ? (s = ctx.scales[name]) && s.value : undefined; -} - -function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = function (s) { - return s && s.bandwidth ? s.bandwidth() : 0; - }; // register AST visitors for internal scale functions - - - visitors._bandwidth = scaleVisitor; - visitors._range = scaleVisitor; - visitors._scale = scaleVisitor; // resolve scale reference directly to the signal hash argument - - var ref = function ref(arg) { - return '_[' + (arg.type === Literal ? $(ScalePrefix + arg.value) : $(ScalePrefix) + '+' + codegen(arg)) + ']'; - }; // define and return internal scale function code generators - // these internal functions are called by mark encoders - - - return { - _bandwidth: function _bandwidth(args) { - return "this.__bandwidth(".concat(ref(args[0]), ")"); - }, - _range: function _range(args) { - return "".concat(ref(args[0]), ".range()"); - }, - _scale: function _scale(args) { - return "".concat(ref(args[0]), "(").concat(codegen(args[1]), ")"); - } - }; -} - -function geoMethod(methodName, globalMethod) { - return function (projection, geojson, group) { - if (projection) { - // projection defined, use it - var p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else { - // projection undefined, use global method - return globalMethod(geojson); - } - }; -} - -var geoArea = geoMethod('area', _d3Geo.geoArea); -var geoBounds = geoMethod('bounds', _d3Geo.geoBounds); -var geoCentroid = geoMethod('centroid', _d3Geo.geoCentroid); - -function inScope(item) { - var group = this.context.group, - value = false; - if (group) while (item) { - if (item === group) { - value = true; - break; - } - - item = item.mark.group; - } - return value; -} - -function log$3(df, method, args) { - try { - df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args))); - } catch (err) { - df.warn(err); - } - - return args[args.length - 1]; -} - -function warn() { - return log$3(this.context.dataflow, 'warn', arguments); -} - -function info() { - return log$3(this.context.dataflow, 'info', arguments); -} - -function debug() { - return log$3(this.context.dataflow, 'debug', arguments); -} // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - - -function channel_luminance_value(channelValue) { - var val = channelValue / 255; - - if (val <= 0.03928) { - return val / 12.92; - } - - return Math.pow((val + 0.055) / 1.055, 2.4); -} - -function luminance(color) { - var c = (0, _d3Color.rgb)(color), - r = channel_luminance_value(c.r), - g = channel_luminance_value(c.g), - b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; -} // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef - - -function contrast(color1, color2) { - var lum1 = luminance(color1), - lum2 = luminance(color2), - lumL = Math.max(lum1, lum2), - lumD = Math.min(lum1, lum2); - return (lumL + 0.05) / (lumD + 0.05); -} - -function merge$2() { - var args = [].slice.call(arguments); - args.unshift({}); - return extend.apply(null, args); -} - -function equal(a, b) { - return a === b || a !== a && b !== b ? true : isArray(a) ? isArray(b) && a.length === b.length ? equalArray(a, b) : false : isObject(a) && isObject(b) ? equalObject(a, b) : false; -} - -function equalArray(a, b) { - for (var i = 0, n = a.length; i < n; ++i) { - if (!equal(a[i], b[i])) return false; - } - - return true; -} - -function equalObject(a, b) { - for (var _key9 in a) { - if (!equal(a[_key9], b[_key9])) return false; - } - - return true; -} - -function removePredicate(props) { - return function (_) { - return equalObject(props, _); - }; -} - -function modify(name, insert, remove, toggle, modify, values) { - var df = this.context.dataflow, - data = this.context.data[name], - input = data.input, - changes = data.changes, - stamp = df.stamp(), - predicate, - key; - - if (df._trigger === false || !(input.value.length || insert || toggle)) { - // nothing to do! - return 0; - } - - if (!changes || changes.stamp < stamp) { - data.changes = changes = df.changeset(); - changes.stamp = stamp; - df.runAfter(function () { - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - - if (remove) { - predicate = remove === true ? truthy : isArray(remove) || isTuple(remove) ? remove : removePredicate(remove); - changes.remove(predicate); - } - - if (insert) { - changes.insert(insert); - } - - if (toggle) { - predicate = removePredicate(toggle); - - if (input.value.some(predicate)) { - changes.remove(predicate); - } else { - changes.insert(toggle); - } - } - - if (modify) { - for (key in values) { - changes.modify(modify, key, values[key]); - } - } - - return 1; -} - -function pinchDistance(event) { - var t = event.touches, - dx = t[0].clientX - t[1].clientX, - dy = t[0].clientY - t[1].clientY; - return Math.sqrt(dx * dx + dy * dy); -} - -function pinchAngle(event) { - var t = event.touches; - return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); -} - -function bandspace(count, paddingInner, paddingOuter) { - return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0); -} - -function bandwidth(name, group) { - var s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; -} - -function copy$2(name, group) { - var s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; -} - -function domain(name, group) { - var s = getScale(name, (group || this).context); - return s ? s.domain() : []; -} - -function invert(name, range, group) { - var s = getScale(name, (group || this).context); - return !s ? undefined : isArray(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range); -} - -function range$1(name, group) { - var s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; -} - -function scale$3(name, value, group) { - var s = getScale(name, (group || this).context); - return s ? s(value) : undefined; -} - -function scaleGradient(scale, p0, p1, count, group) { - scale = getScale(scale, (group || this).context); - var gradient = Gradient(p0, p1); - var stops = scale.domain(), - min = stops[0], - max = peek(stops), - fraction = identity; - - if (!(max - min)) { - // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator ? scale$2('sequential')().interpolator(scale.interpolator()) : scale$2('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([min = 0, max = 1]); - } else { - fraction = scaleFraction(scale, min, max); - } - - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== peek(stops)) stops.push(max); - } - - stops.forEach(function (_) { - return gradient.stop(fraction(_), scale(_)); - }); - return gradient; -} - -function geoShape(projection, geojson, group) { - var p = getScale(projection, (group || this).context); - return function (context) { - return p ? p.path.context(context)(geojson) : ''; - }; -} - -function pathShape(path) { - var p = null; - return function (context) { - return context ? pathRender(context, p = p || pathParse(path)) : path; - }; -} - -var datum = function datum(d) { - return d.data; -}; - -function treeNodes(name, context) { - var tree = data$1.call(context, name); - return tree.root && tree.root.lookup || {}; -} - -function treePath(name, source, target) { - var nodes = treeNodes(name, this), - s = nodes[source], - t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; -} - -function treeAncestors(name, node) { - var n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; -} - -var _window = function _window() { - return typeof window !== 'undefined' && window || null; -}; - -function screen() { - var w = _window(); - - return w ? w.screen : {}; -} - -function windowSize() { - var w = _window(); - - return w ? [w.innerWidth, w.innerHeight] : [undefined, undefined]; -} - -function containerSize() { - var view = this.context.dataflow, - el = view.container && view.container(); - return el ? [el.clientWidth, el.clientHeight] : [undefined, undefined]; -} - -var Intersect = 'intersect'; -var Union = 'union'; -var VlMulti = 'vlMulti'; -var Or = 'or'; -var And = 'and'; -var TYPE_ENUM = 'E', - TYPE_RANGE_INC = 'R', - TYPE_RANGE_EXC = 'R-E', - TYPE_RANGE_LE = 'R-LE', - TYPE_RANGE_RE = 'R-RE', - UNIT_INDEX = 'index:unit'; // TODO: revisit date coercion? - -function testPoint(datum, entry) { - var fields = entry.fields, - values = entry.values, - n = fields.length, - i = 0, - dval, - f; - - for (; i < n; ++i) { - f = fields[i]; - f.getter = field.getter || field(f.field); - dval = f.getter(datum); - if (isDate(dval)) dval = toNumber(dval); - if (isDate(values[i])) values[i] = toNumber(values[i]); - if (isDate(values[i][0])) values[i] = values[i].map(toNumber); - - if (f.type === TYPE_ENUM) { - // Enumerated fields can either specify individual values (single/multi selections) - // or an array of values (interval selections). - if (isArray(values[i]) ? values[i].indexOf(dval) < 0 : dval !== values[i]) { - return false; - } - } else { - if (f.type === TYPE_RANGE_INC) { - if (!inrange(dval, values[i])) return false; - } else if (f.type === TYPE_RANGE_RE) { - // Discrete selection of bins test within the range [bin_start, bin_end). - if (!inrange(dval, values[i], true, false)) return false; - } else if (f.type === TYPE_RANGE_EXC) { - // 'R-E'/'R-LE' included for completeness. - if (!inrange(dval, values[i], false, false)) return false; - } else if (f.type === TYPE_RANGE_LE) { - if (!inrange(dval, values[i], false, true)) return false; - } - } - } - - return true; -} -/** - * Tests if a tuple is contained within an interactive selection. - * @param {string} name - The name of the data set representing the selection. - * Tuples in the dataset are of the form - * {unit: string, fields: array, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ - - -function selectionTest(name, datum, op) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, - intersect = op === Intersect, - n = entries.length, - i = 0, - entry, - miss, - count, - unit, - b; - - for (; i < n; ++i) { - entry = entries[i]; - - if (unitIdx && intersect) { - // multi selections union within the same unit and intersect across units. - miss = miss || {}; - count = miss[unit = entry.unit] || 0; // if we've already matched this unit, skip. - - if (count === -1) continue; - b = testPoint(datum, entry); - miss[unit] = b ? -1 : ++count; // if we match and there are no other units return true - // if we've missed against all tuples in this unit return false - - if (b && unitIdx.size === 1) return true; - if (!b && count === unitIdx.get(unit).count) return false; - } else { - b = testPoint(datum, entry); // if we find a miss and we do require intersection return false - // if we find a match and we don't require intersection return true - - if (intersect ^ b) return b; - } - } // if intersecting and we made it here, then we saw no misses - // if not intersecting, then we saw no matches - // if no active selections, return false - - - return n && intersect; -} -/** - * Resolves selection for use as a scale domain or reads via the API. - * @param {string} name - The name of the dataset representing the selection - * @param {string} [op='union'] - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @returns {object} An object of selected fields and values. - */ - - -function selectionResolve(name, op, isMulti) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - resolved = {}, - multiRes = {}, - types = {}, - entry, - fields, - values, - unit, - field, - res, - resUnit, - type, - union, - n = entries.length, - i = 0, - j, - m; // First union all entries within the same unit. - - for (; i < n; ++i) { - entry = entries[i]; - unit = entry.unit; - fields = entry.fields; - values = entry.values; - - for (j = 0, m = fields.length; j < m; ++j) { - field = fields[j]; - res = resolved[field.field] || (resolved[field.field] = {}); - resUnit = res[unit] || (res[unit] = []); - types[field.field] = type = field.type.charAt(0); - union = ops[type + '_union']; - res[unit] = union(resUnit, array(values[j])); - } // If the same multi-selection is repeated over views and projected over - // an encoding, it may operate over different fields making it especially - // tricky to reliably resolve it. At best, we can de-dupe identical entries - // but doing so may be more computationally expensive than it is worth. - // Instead, for now, we simply transform our store representation into - // a more human-friendly one. - - - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push(array(values).reduce(function (obj, curr, j) { - return obj[fields[j].field] = curr, obj; - }, {})); - } - } // Then resolve fields across units as per the op. - - - op = op || Union; - Object.keys(resolved).forEach(function (field) { - resolved[field] = Object.keys(resolved[field]).map(function (unit) { - return resolved[field][unit]; - }).reduce(function (acc, curr) { - return acc === undefined ? curr : ops[types[field] + '_' + op](acc, curr); - }); - }); - entries = Object.keys(multiRes); - - if (isMulti && entries.length) { - resolved[VlMulti] = op === Union ? _defineProperty({}, Or, entries.reduce(function (acc, k) { - return acc.push.apply(acc, multiRes[k]), acc; - }, [])) : _defineProperty({}, And, entries.map(function (k) { - return _defineProperty({}, Or, multiRes[k]); - })); - } - - return resolved; -} - -var ops = { - E_union: function E_union(base, value) { - if (!base.length) return value; - var i = 0, - n = value.length; - - for (; i < n; ++i) { - if (base.indexOf(value[i]) < 0) base.push(value[i]); - } - - return base; - }, - E_intersect: function E_intersect(base, value) { - return !base.length ? value : base.filter(function (v) { - return value.indexOf(v) >= 0; - }); - }, - R_union: function R_union(base, value) { - var lo = toNumber(value[0]), - hi = toNumber(value[1]); - - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; - }, - R_intersect: function R_intersect(base, value) { - var lo = toNumber(value[0]), - hi = toNumber(value[1]); - - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - - if (hi < base[0] || base[1] < lo) { - return []; - } else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - - return base; - } -}; -var DataPrefix$1 = ':', - IndexPrefix$1 = '@'; - -function selectionVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to selection functions must be a string literal.'); - var data = args[0].value, - op = args.length >= 2 && peek(args).value, - field = 'unit', - indexName = IndexPrefix$1 + field, - dataName = DataPrefix$1 + data; // eslint-disable-next-line no-prototype-builtins - - if (op === Intersect && !hasOwnProperty(params, indexName)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } // eslint-disable-next-line no-prototype-builtins - - - if (!hasOwnProperty(params, dataName)) { - params[dataName] = scope.getData(data).tuplesRef(); - } -} - -function intersect$2(b, opt, group) { - if (!b) return []; - - var _b4 = _slicedToArray(b, 2), - u = _b4[0], - v = _b4[1], - box = new Bounds().set(u[0], u[1], v[0], v[1]), - scene = group || this.context.dataflow.scenegraph().root; - - return intersect(scene, box, filter$1(opt)); -} - -function filter$1(opt) { - var p = null; - - if (opt) { - var types = array(opt.marktype), - names = array(opt.markname); - - p = function p(_) { - return (!types.length || types.some(function (t) { - return _.marktype === t; - })) && (!names.length || names.some(function (s) { - return _.name === s; - })); - }; - } - - return p; -} // Expression function context object - - -var functionContext = { - random: function random() { - return _random(); - }, - // override default - cumulativeNormal: cumulativeNormal, - cumulativeLogNormal: cumulativeLogNormal, - cumulativeUniform: cumulativeUniform, - densityNormal: densityNormal, - densityLogNormal: densityLogNormal, - densityUniform: densityUniform, - quantileNormal: quantileNormal, - quantileLogNormal: quantileLogNormal, - quantileUniform: quantileUniform, - sampleNormal: sampleNormal, - sampleLogNormal: sampleLogNormal, - sampleUniform: sampleUniform, - isArray: isArray, - isBoolean: isBoolean, - isDate: isDate, - isDefined: function isDefined(_) { - return _ !== undefined; - }, - isNumber: isNumber, - isObject: isObject, - isRegExp: isRegExp, - isString: isString, - isTuple: isTuple, - isValid: function isValid(_) { - return _ != null && _ === _; - }, - toBoolean: toBoolean, - toDate: toDate, - toNumber: toNumber, - toString: toString, - flush: flush, - lerp: lerp, - merge: merge$2, - pad: pad, - peek: peek, - span: span, - inrange: inrange, - truncate: truncate, - rgb: _d3Color.rgb, - lab: _d3Color.lab, - hcl: _d3Color.hcl, - hsl: _d3Color.hsl, - luminance: luminance, - contrast: contrast, - sequence: sequence, - format: format$2, - utcFormat: utcFormat, - utcParse: utcParse, - utcOffset: utcOffset, - utcSequence: utcSequence, - timeFormat: timeFormat, - timeParse: timeParse, - timeOffset: timeOffset, - timeSequence: timeSequence, - timeUnitSpecifier: timeUnitSpecifier, - monthFormat: monthFormat, - monthAbbrevFormat: monthAbbrevFormat, - dayFormat: dayFormat, - dayAbbrevFormat: dayAbbrevFormat, - quarter: quarter, - utcquarter: utcquarter, - week: week, - utcweek: utcweek, - dayofyear: dayofyear, - utcdayofyear: utcdayofyear, - warn: warn, - info: info, - debug: debug, - extent: extent, - inScope: inScope, - intersect: intersect$2, - clampRange: clampRange, - pinchDistance: pinchDistance, - pinchAngle: pinchAngle, - screen: screen, - containerSize: containerSize, - windowSize: windowSize, - bandspace: bandspace, - setdata: setdata, - pathShape: pathShape, - panLinear: panLinear, - panLog: panLog, - panPow: panPow, - panSymlog: panSymlog, - zoomLinear: zoomLinear, - zoomLog: zoomLog, - zoomPow: zoomPow, - zoomSymlog: zoomSymlog, - encode: encode$1, - modify: modify -}; -var eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'], - // event functions -eventPrefix = 'event.vega.', - // event function prefix -thisPrefix = 'this.', - // function context prefix -astVisitors = {}; // AST visitors for dependency analysis -// Build expression function registry - -function buildFunctions(codegen) { - var fn = functions(codegen); - eventFunctions.forEach(function (name) { - return fn[name] = eventPrefix + name; - }); - - for (var name in functionContext) { - fn[name] = thisPrefix + name; - } - - extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; -} // Register an expression function - - -function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) { - return functionContext[name]; - } // register with the functionContext - - - functionContext[name] = fn; // if there is an astVisitor register that, too - - if (visitor) astVisitors[name] = visitor; // if the code generator has already been initialized, - // we need to also register the function with it - - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; -} // register expression functions with ast visitors - - -expressionFunction('bandwidth', bandwidth, scaleVisitor); -expressionFunction('copy', copy$2, scaleVisitor); -expressionFunction('domain', domain, scaleVisitor); -expressionFunction('range', range$1, scaleVisitor); -expressionFunction('invert', invert, scaleVisitor); -expressionFunction('scale', scale$3, scaleVisitor); -expressionFunction('gradient', scaleGradient, scaleVisitor); -expressionFunction('geoArea', geoArea, scaleVisitor); -expressionFunction('geoBounds', geoBounds, scaleVisitor); -expressionFunction('geoCentroid', geoCentroid, scaleVisitor); -expressionFunction('geoShape', geoShape, scaleVisitor); -expressionFunction('indata', indata, indataVisitor); -expressionFunction('data', data$1, dataVisitor); -expressionFunction('treePath', treePath, dataVisitor); -expressionFunction('treeAncestors', treeAncestors, dataVisitor); // register Vega-Lite selection functions - -expressionFunction('vlSelectionTest', selectionTest, selectionVisitor); -expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor); // Export code generator and parameters - -var codegenParams = { - blacklist: ['_'], - whitelist: ['datum', 'event', 'item'], - fieldvar: 'datum', - globalvar: function globalvar(id) { - return '_[' + $(SignalPrefix + id) + ']'; - }, - functions: buildFunctions, - constants: constants, - visitors: astVisitors -}; -var codeGenerator = codegen(codegenParams); - -function parseExpression$1(expr, scope) { - var params = {}, - ast, - gen; // parse the expression to an abstract syntax tree (ast) - - try { - expr = isString(expr) ? expr : $(expr) + ''; - ast = parse$3(expr); - } catch (err) { - error('Expression parse error: ' + expr); - } // analyze ast function calls for dependencies - - - ast.visit(function (node) { - if (node.type !== CallExpression) return; - var name = node.callee.name, - visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); - }); // perform code generation - - gen = codeGenerator(ast); // collect signal dependencies - - gen.globals.forEach(function (name) { - var signalName = SignalPrefix + name; - - if (!hasOwnProperty(params, signalName) && scope.getSignal(name)) { - params[signalName] = scope.signalRef(name); - } - }); // return generated expression code and dependencies - - return { - $expr: extend({ - code: gen.code - }, scope.options.ast ? { - ast: ast - } : null), - $fields: gen.fields, - $params: params - }; -} -/** - * Parse a serialized dataflow specification. - */ - - -function parse$4(spec) { - var ctx = this, - operators = spec.operators || []; // parse background - - if (spec.background) { - ctx.background = spec.background; - } // parse event configuration - - - if (spec.eventConfig) { - ctx.eventConfig = spec.eventConfig; - } // parse locale configuration - - - if (spec.locale) { - ctx.locale = spec.locale; - } // parse operators - - - operators.forEach(function (entry) { - return ctx.parseOperator(entry); - }); // parse operator parameters - - operators.forEach(function (entry) { - return ctx.parseOperatorParameters(entry); - }); // parse streams - - (spec.streams || []).forEach(function (entry) { - return ctx.parseStream(entry); - }); // parse updates - - (spec.updates || []).forEach(function (entry) { - return ctx.parseUpdate(entry); - }); - return ctx.resolve(); -} - -var Skip = toSet(['rule']), - Swap = toSet(['group', 'image', 'rect']); - -function adjustSpatial(encode, marktype) { - var code = ''; - if (Skip[marktype]) return code; - - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) { - code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - } - - code += 'o.width=o.x2-o.x;'; - } else { - code += 'o.x=o.x2-(o.width||0);'; - } - } - - if (encode.xc) { - code += 'o.x=o.xc-(o.width||0)/2;'; - } - - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) { - code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - } - - code += 'o.height=o.y2-o.y;'; - } else { - code += 'o.y=o.y2-(o.height||0);'; - } - } - - if (encode.yc) { - code += 'o.y=o.yc-(o.height||0)/2;'; - } - - return code; -} - -function canonicalType(type) { - return (type + '').toLowerCase(); -} - -function isOperator(type) { - return canonicalType(type) === 'operator'; -} - -function isCollect(type) { - return canonicalType(type) === 'collect'; -} - -function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (code[code.length - 1] !== ';') { - code = 'return(' + code + ');'; - } - - var fn = Function.apply(null, args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; -} // generate code for comparing a single field - - -function _compare(u, v, lt, gt) { - return "((u = ".concat(u, ") < (v = ").concat(v, ") || u == null) && v != null ? ").concat(lt, "\n : (u > v || v == null) && u != null ? ").concat(gt, "\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(lt, "\n : v !== v && u === u ? ").concat(gt, " : "); -} - -var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ - operator: function operator(ctx, expr) { - return expression(ctx, ['_'], expr.code); - }, - - /** - * Parse an expression provided as an operator parameter value. - */ - parameter: function parameter(ctx, expr) { - return expression(ctx, ['datum', '_'], expr.code); - }, - - /** - * Parse an expression applied to an event stream. - */ - event: function event(ctx, expr) { - return expression(ctx, ['event'], expr.code); - }, - - /** - * Parse an expression used to handle an event-driven operator update. - */ - handler: function handler(ctx, expr) { - var code = "var datum=event.item&&event.item.datum;return ".concat(expr.code, ";"); - return expression(ctx, ['_', 'event'], code); - }, - - /** - * Parse an expression that performs visual encoding. - */ - encode: function encode(ctx, _encode) { - var marktype = _encode.marktype, - channels = _encode.channels; - var code = 'var o=item,datum=o.datum,m=0,$;'; - - for (var name in channels) { - var o = 'o[' + $(name) + ']'; - code += "$=".concat(channels[name].code, ";if(").concat(o, "!==$)").concat(o, "=$,m=1;"); - } - - code += adjustSpatial(channels, marktype); - code += 'return m;'; - return expression(ctx, ['item', '_'], code); - }, - - /** - * Optimized code generators for access and comparison. - */ - codegen: { - get: function get(path) { - var ref = "[".concat(path.map($).join(']['), "]"); - var get = Function('_', "return _".concat(ref, ";")); - get.path = ref; - return get; - }, - comparator: function comparator(fields, orders) { - var t; - - var map = function map(f, i) { - var o = orders[i]; - var u, v; - - if (f.path) { - u = "a".concat(f.path); - v = "b".concat(f.path); - } else { - (t = t || {})['f' + i] = f; - u = "this.f".concat(i, "(a)"); - v = "this.f".concat(i, "(b)"); - } - - return _compare(u, v, -o, o); - }; - - var fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } -}; -/** - * Parse a dataflow operator. - */ - -function parseOperator(spec) { - var ctx = this; - - if (isOperator(spec.type) || !spec.type) { - ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); - } else { - ctx.transform(spec, spec.type); - } -} -/** - * Parse and assign operator parameters. - */ - - -function parseOperatorParameters(spec) { - var ctx = this; - - if (spec.params) { - var op = ctx.get(spec.id); - if (!op) error('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); - } -} -/** - * Parse a set of operator parameters. - */ - - -function parseParameters(spec, params) { - params = params || {}; - var ctx = this; - - for (var _key10 in spec) { - var _value20 = spec[_key10]; - params[_key10] = isArray(_value20) ? _value20.map(function (v) { - return parseParameter(v, ctx, params); - }) : parseParameter(_value20, ctx, params); - } - - return params; -} -/** - * Parse a single parameter. - */ - - -function parseParameter(spec, ctx, params) { - if (!spec || !isObject(spec)) return spec; - - for (var i = 0, n = PARSERS.length, p; i < n; ++i) { - p = PARSERS[i]; - - if (hasOwnProperty(spec, p.key)) { - return p.parse(spec, ctx, params); - } - } - - return spec; -} -/** Reference parsers. */ - - -var PARSERS = [{ - key: '$ref', - parse: getOperator -}, { - key: '$key', - parse: getKey -}, { - key: '$expr', - parse: getExpression -}, { - key: '$field', - parse: getField$1 -}, { - key: '$encode', - parse: getEncode -}, { - key: '$compare', - parse: getCompare -}, { - key: '$context', - parse: getContext -}, { - key: '$subflow', - parse: getSubflow -}, { - key: '$tupleid', - parse: getTupleId -}]; -/** - * Resolve an operator reference. - */ - -function getOperator(_, ctx) { - return ctx.get(_.$ref) || error('Operator not defined: ' + _.$ref); -} -/** - * Resolve an expression reference. - */ - - -function getExpression(_, ctx, params) { - if (_.$params) { - // parse expression parameters - ctx.parseParameters(_.$params, params); - } - - var k = 'e:' + _.$expr.code + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields, _.$name)); -} -/** - * Resolve a key accessor reference. - */ - - -function getKey(_, ctx) { - var k = 'k:' + _.$key + '_' + !!_.$flat; - return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat, ctx.expr.codegen)); -} -/** - * Resolve a field accessor reference. - */ - - -function getField$1(_, ctx) { - if (!_.$field) return null; - var k = 'f:' + _.$field + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name, ctx.expr.codegen)); -} -/** - * Resolve a comparator function reference. - */ - - -function getCompare(_, ctx) { - // As of Vega 5.5.3, $tupleid sort is no longer used. - // Keep here for now for backwards compatibility. - var k = 'c:' + _.$compare + '_' + _.$order, - c = array(_.$compare).map(function (_) { - return _ && _.$tupleid ? tupleid : _; - }); - return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen)); -} -/** - * Resolve an encode operator reference. - */ - - -function getEncode(_, ctx) { - var spec = _.$encode, - encode = {}; - - for (var name in spec) { - var enc = spec[name]; - encode[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - - return encode; -} -/** - * Resolve a context reference. - */ - - -function getContext(_, ctx) { - return ctx; -} -/** - * Resolve a recursive subflow specification. - */ - - -function getSubflow(_, ctx) { - var spec = _.$subflow; - return function (dataflow, key, parent) { - var subctx = ctx.fork().parse(spec), - op = subctx.get(spec.operators[0].id), - p = subctx.signals.parent; - if (p) p.set(parent); - - op.detachSubflow = function () { - return ctx.detach(subctx); - }; - - return op; - }; -} -/** - * Resolve a tuple id reference. - */ - - -function getTupleId() { - return tupleid; -} -/** - * Parse an event stream specification. - */ - - -function parseStream(spec) { - var ctx = this, - filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, - stream = spec.stream != null ? ctx.get(spec.stream) : undefined, - args; - - if (spec.source) { - stream = ctx.events(spec.source, spec.type, filter); - } else if (spec.merge) { - args = spec.merge.map(function (_) { - return ctx.get(_); - }); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - - if (spec.between) { - args = spec.between.map(function (_) { - return ctx.get(_); - }); - stream = stream.between(args[0], args[1]); - } - - if (spec.filter) { - stream = stream.filter(filter); - } - - if (spec.throttle != null) { - stream = stream.throttle(+spec.throttle); - } - - if (spec.debounce != null) { - stream = stream.debounce(+spec.debounce); - } - - if (stream == null) { - error('Invalid stream definition: ' + JSON.stringify(spec)); - } - - if (spec.consume) stream.consume(true); - ctx.stream(spec, stream); -} -/** - * Parse an event-driven operator update. - */ - - -function parseUpdate(spec) { - var ctx = this, - srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid, - source = ctx.get(srcid), - target = null, - update = spec.update, - params = undefined; - if (!source) error('Source not defined: ' + spec.source); - target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); - - if (update && update.$expr) { - if (update.$params) { - params = ctx.parseParameters(update.$params); - } - - update = ctx.handlerExpression(update.$expr); - } - - ctx.update(spec, source, target, update, params); -} - -var SKIP$3 = { - skip: true -}; - -function getState(options) { - var ctx = this, - state = {}; - - if (options.signals) { - var signals = state.signals = {}; - Object.keys(ctx.signals).forEach(function (key) { - var op = ctx.signals[key]; - - if (options.signals(key, op)) { - signals[key] = op.value; - } - }); - } - - if (options.data) { - var data = state.data = {}; - Object.keys(ctx.data).forEach(function (key) { - var dataset = ctx.data[key]; - - if (options.data(key, dataset)) { - data[key] = dataset.input.value; - } - }); - } - - if (ctx.subcontext && options.recurse !== false) { - state.subcontext = ctx.subcontext.map(function (ctx) { - return ctx.getState(options); - }); - } - - return state; -} - -function setState(state) { - var ctx = this, - df = ctx.dataflow, - data = state.data, - signals = state.signals; - Object.keys(signals || {}).forEach(function (key) { - df.update(ctx.signals[key], signals[key], SKIP$3); - }); - Object.keys(data || {}).forEach(function (key) { - df.pulse(ctx.data[key].input, df.changeset().remove(truthy).insert(data[key])); - }); - (state.subcontext || []).forEach(function (substate, i) { - var subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); -} -/** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ - - -function context$2(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); -} - -function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } -} - -function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } -} - -Context.prototype = Subcontext.prototype = { - fork: function fork() { - var ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; - }, - detach: function detach(ctx) { - this.subcontext = this.subcontext.filter(function (c) { - return c !== ctx; - }); // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - - var keys = Object.keys(ctx.nodes); - - for (var _i23 = 0, _keys = keys; _i23 < _keys.length; _i23++) { - var _key11 = _keys[_i23]; - ctx.nodes[_key11]._targets = null; - } - - for (var _i24 = 0, _keys2 = keys; _i24 < _keys2.length; _i24++) { - var _key12 = _keys2[_i24]; - - ctx.nodes[_key12].detach(); - } - - ctx.nodes = null; - }, - get: function get(id) { - return this.nodes[id]; - }, - set: function set(id, node) { - return this.nodes[id] = node; - }, - add: function add(spec, op) { - var ctx = this, - df = ctx.dataflow, - data = spec.value; - ctx.set(spec.id, op); - - if (isCollect(spec.type) && data) { - if (data.$ingest) { - df.ingest(op, data.$ingest, data.$format); - } else if (data.$request) { - df.preload(op, data.$request, data.$format); - } else { - df.pulse(op, df.changeset().insert(data)); - } - } - - if (spec.root) { - ctx.root = op; - } - - if (spec.parent) { - var p = ctx.get(spec.parent.$ref); - - if (p) { - df.connect(p, [op]); - op.targets().add(p); - } else { - (ctx.unresolved = ctx.unresolved || []).push(function () { - p = ctx.get(spec.parent.$ref); - df.connect(p, [op]); - op.targets().add(p); - }); - } - } - - if (spec.signal) { - ctx.signals[spec.signal] = op; - } - - if (spec.scale) { - ctx.scales[spec.scale] = op; - } - - if (spec.data) { - var _loop = function _loop(name) { - var data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach(function (role) { - return data[role] = op; - }); - }; - - for (var name in spec.data) { - _loop(name); - } - } - }, - resolve: function resolve() { - (this.unresolved || []).forEach(function (fn) { - return fn(); - }); - delete this.unresolved; - return this; - }, - operator: function operator(spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); - }, - transform: function transform(spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); - }, - stream: function stream(spec, _stream) { - this.set(spec.id, _stream); - }, - update: function update(spec, stream, target, _update2, params) { - this.dataflow.on(stream, target, _update2, params, spec.options); - }, - // expression parsing - operatorExpression: function operatorExpression(expr) { - return this.expr.operator(this, expr); - }, - parameterExpression: function parameterExpression(expr) { - return this.expr.parameter(this, expr); - }, - eventExpression: function eventExpression(expr) { - return this.expr.event(this, expr); - }, - handlerExpression: function handlerExpression(expr) { - return this.expr.handler(this, expr); - }, - encodeExpression: function encodeExpression(encode) { - return this.expr.encode(this, encode); - }, - // parse methods - parse: parse$4, - parseOperator: parseOperator, - parseOperatorParameters: parseOperatorParameters, - parseParameters: parseParameters, - parseStream: parseStream, - parseUpdate: parseUpdate, - // state methods - getState: getState, - setState: setState -}; - -function runtime(view, spec, expr) { - return context$2(view, transforms, functionContext, expr).parse(spec); -} - -function scale$4(name) { - var scales = this._runtime.scales; - - if (!hasOwnProperty(scales, name)) { - error('Unrecognized scale or projection: ' + name); - } - - return scales[name].value; -} - -var Width = 'width', - Height = 'height', - Padding$1 = 'padding', - Skip$1 = { - skip: true -}; - -function viewWidth(view, width) { - var a = view.autosize(), - p = view.padding(); - return width - (a && a.contains === Padding$1 ? p.left + p.right : 0); -} - -function viewHeight(view, height) { - var a = view.autosize(), - p = view.padding(); - return height - (a && a.contains === Padding$1 ? p.top + p.bottom : 0); -} - -function initializeResize(view) { - var s = view._signals, - w = s[Width], - h = s[Height], - p = s[Padding$1]; - - function resetSize() { - view._autosize = view._resize = 1; - } // respond to width signal - - - view._resizeWidth = view.add(null, function (_) { - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, { - size: w - }); // respond to height signal - - view._resizeHeight = view.add(null, function (_) { - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, { - size: h - }); // respond to padding signal - - var resizePadding = view.add(null, resetSize, { - pad: p - }); // set rank to run immediately after source signal - - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; -} - -function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter(function (view) { - var rerun = 0; // reset autosize flag - - view._autosize = 0; // width value changed: update signal, skip resize op - - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip$1); // set width, skip update calc - - view._resizeWidth.skip(true); // skip width resize handler - - } // height value changed: update signal, skip resize op - - - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip$1); // set height, skip update calc - - view._resizeHeight.skip(true); // skip height resize handler - - } // view width changed: update view property, set resize flag - - - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } // view height changed: update view property, set resize flag - - - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } // origin changed: update view property, set resize flag - - - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } // run dataflow on width/height signal change - - - if (rerun) view.run('enter'); - if (auto) view.runAfter(function (v) { - return v.resize(); - }); - }, false, 1); -} -/** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ - - -function getState$1(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); -} - -function dataTest(name, data) { - return data.modified && isArray(data.input.value) && name.indexOf('_:vega:_'); -} - -function signalTest(name, op) { - return !(name === 'parent' || op instanceof transforms.proxy); -} -/** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ - - -function setState$1(state) { - this.runAsync(null, function (v) { - v._trigger = false; - - v._runtime.setState(state); - }, function (v) { - v._trigger = true; - }); - return this; -} - -function timer(callback, delay) { - function tick(elapsed) { - callback({ - timestamp: Date.now(), - elapsed: elapsed - }); - } - - this._timers.push((0, _d3Timer.interval)(tick, delay)); -} - -function defaultTooltip$1(handler, event, item, value) { - var el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); -} - -function formatTooltip(value) { - return value == null ? '' : isArray(value) ? formatArray(value) : isObject(value) && !isDate(value) ? formatObject(value) : value + ''; -} - -function formatObject(obj) { - return Object.keys(obj).map(function (key) { - var v = obj[key]; - return key + ': ' + (isArray(v) ? formatArray(v) : formatValue$1(v)); - }).join('\n'); -} - -function formatArray(value) { - return '[' + value.map(formatValue$1).join(', ') + ']'; -} - -function formatValue$1(value) { - return isArray(value) ? "[\u2026]" : isObject(value) && !isDate(value) ? "{\u2026}" : value; -} -/** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ - - -function View(spec, options) { - var view = this; - options = options || {}; - Dataflow.call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - - if (options.locale || spec.locale) { - var loc = extend({}, spec.locale, options.locale); - view.locale(locale(loc.number, loc.time)); - } - - view._el = null; - view._elBind = null; - view._renderType = options.renderer || RenderType.Canvas; - view._scenegraph = new Scenegraph(); - var root = view._scenegraph.root; // initialize renderer, handler and event management - - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip$1, view._redraw = true; - view._handler = new CanvasHandler().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; // initialize event configuration - - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); // initialize dataflow graph - - var ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map(function (_) { - return { - state: null, - param: extend({}, _) - }; - }); // initialize scenegraph - - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); // initialize view size - - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [0, 0]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); // initialize background color - - background$1(view); // initialize cursor - - cursor(view); // initialize view description - - view.description(spec.description); // initialize hover proessing, if requested - - if (options.hover) view.hover(); // initialize DOM container(s) and renderer - - if (options.container) view.initialize(options.container, options.bind); -} - -var prototype$1s = inherits(View, Dataflow); // -- DATAFLOW / RENDERING ---- - -prototype$1s.evaluate = /*#__PURE__*/function () { - var _ref21 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(encode, prerun, postrun) { - return regeneratorRuntime.wrap(function _callee2$(_context9) { - while (1) { - switch (_context9.prev = _context9.next) { - case 0: - _context9.next = 2; - return Dataflow.prototype.evaluate.call(this, encode, prerun); - - case 2: - if (!(this._redraw || this._resize)) { - _context9.next = 14; - break; - } - - _context9.prev = 3; - - if (!this._renderer) { - _context9.next = 8; - break; - } - - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - - _context9.next = 8; - return this._renderer.renderAsync(this._scenegraph.root); - - case 8: - this._redraw = false; - _context9.next = 14; - break; - - case 11: - _context9.prev = 11; - _context9.t0 = _context9["catch"](3); - this.error(_context9.t0); - - case 14: - // evaluate postrun - if (postrun) asyncCallback(this, postrun); - return _context9.abrupt("return", this); - - case 16: - case "end": - return _context9.stop(); - } - } - }, _callee2, this, [[3, 11]]); - })); - - return function (_x41, _x42, _x43) { - return _ref21.apply(this, arguments); - }; -}(); - -prototype$1s.dirty = function (item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); -}; // -- GET / SET ---- - - -prototype$1s.description = function (text) { - if (arguments.length) { - var desc = text != null ? text + '' : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - - return this._desc; -}; - -prototype$1s.container = function () { - return this._el; -}; - -prototype$1s.scenegraph = function () { - return this._scenegraph; -}; - -prototype$1s.origin = function () { - return this._origin.slice(); -}; - -function lookupSignal(view, name) { - return hasOwnProperty(view._signals, name) ? view._signals[name] : error('Unrecognized signal name: ' + $(name)); -} - -prototype$1s.signal = function (name, value, options) { - var op = lookupSignal(this, name); - return arguments.length === 1 ? op.value : this.update(op, value, options); -}; - -prototype$1s.width = function (_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); -}; - -prototype$1s.height = function (_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); -}; - -prototype$1s.padding = function (_) { - return arguments.length ? this.signal('padding', padding(_)) : padding(this.signal('padding')); -}; - -prototype$1s.autosize = function (_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); -}; - -prototype$1s.background = function (_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); -}; - -prototype$1s.renderer = function (type) { - if (!arguments.length) return this._renderType; - if (!renderModule(type)) error('Unrecognized renderer type: ' + type); - - if (type !== this._renderType) { - this._renderType = type; - - this._resetRenderer(); - } - - return this; -}; - -prototype$1s.tooltip = function (handler) { - if (!arguments.length) return this._tooltip; - - if (handler !== this._tooltip) { - this._tooltip = handler; - - this._resetRenderer(); - } - - return this; -}; - -prototype$1s.loader = function (loader) { - if (!arguments.length) return this._loader; - - if (loader !== this._loader) { - Dataflow.prototype.loader.call(this, loader); - - this._resetRenderer(); - } - - return this; -}; - -prototype$1s.resize = function () { - // set flag to perform autosize - this._autosize = 1; // touch autosize signal to ensure top-level ViewLayout runs - - return this.touch(lookupSignal(this, 'autosize')); -}; - -prototype$1s._resetRenderer = function () { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } -}; // -- SIZING ---- - - -prototype$1s._resizeView = resizeView; // -- EVENT HANDLING ---- - -prototype$1s.addEventListener = function (type, handler, options) { - var callback = handler; - - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - - this._handler.on(type, callback); - - return this; -}; - -prototype$1s.removeEventListener = function (type, handler) { - var handlers = this._handler.handlers(type), - i = handlers.length, - h, - t; // search registered handlers, remove if match found - - - while (--i >= 0) { - t = handlers[i].type; - h = handlers[i].handler; - - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - - break; - } - } - - return this; -}; - -prototype$1s.addResizeListener = function (handler) { - var l = this._resizeListeners; - - if (l.indexOf(handler) < 0) { - // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - } - - return this; -}; - -prototype$1s.removeResizeListener = function (handler) { - var l = this._resizeListeners, - i = l.indexOf(handler); - - if (i >= 0) { - l.splice(i, 1); - } - - return this; -}; - -function findOperatorHandler(op, handler) { - var h = (op._targets || []).filter(function (op) { - return op._update && op._update.handler === handler; - }); - return h.length ? h[0] : null; -} - -function addOperatorListener(view, name, op, handler) { - var h = findOperatorHandler(op, handler); - - if (!h) { - h = trap(view, function () { - return handler(name, op.value); - }); - h.handler = handler; - view.on(op, null, h); - } - - return view; -} - -function removeOperatorListener(view, op, handler) { - var h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; -} - -prototype$1s.addSignalListener = function (name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); -}; - -prototype$1s.removeSignalListener = function (name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); -}; - -prototype$1s.addDataListener = function (name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); -}; - -prototype$1s.removeDataListener = function (name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); -}; - -prototype$1s.globalCursor = function (_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - var prev = setCursor(this, null); // clear previous cursor - - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - - return this; - } else { - return this._globalCursor; - } -}; - -prototype$1s.preventDefault = function (_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else { - return this._preventDefault; - } -}; - -prototype$1s.timer = timer; -prototype$1s.events = events$1; -prototype$1s.finalize = finalize; -prototype$1s.hover = hover; // -- DATA ---- - -prototype$1s.data = data; -prototype$1s.change = change; -prototype$1s.insert = insert; -prototype$1s.remove = remove; // -- SCALES -- - -prototype$1s.scale = scale$4; // -- INITIALIZATION ---- - -prototype$1s.initialize = initialize$1; // -- HEADLESS RENDERING ---- - -prototype$1s.toImageURL = renderToImageURL; -prototype$1s.toCanvas = renderToCanvas; -prototype$1s.toSVG = renderToSVG; // -- SAVE / RESTORE STATE ---- - -prototype$1s.getState = getState$1; -prototype$1s.setState = setState$1; - -function parseAutosize(spec) { - return isObject(spec) ? spec : { - type: spec || 'pad' - }; -} - -var number$6 = function number$6(_) { - return +_ || 0; -}; - -var paddingObject$1 = function paddingObject$1(_) { - return { - top: _, - bottom: _, - left: _, - right: _ - }; -}; - -function parsePadding(spec) { - return !isObject(spec) ? paddingObject$1(number$6(spec)) : spec.signal ? spec : { - top: number$6(spec.top), - bottom: number$6(spec.bottom), - left: number$6(spec.left), - right: number$6(spec.right) - }; -} - -var encoder = function encoder(_) { - return isObject(_) && !isArray(_) ? extend({}, _) : { - value: _ - }; -}; - -function addEncode(object, name, value, set) { - if (value != null) { - // Always assign signal to update, even if the signal is from the enter block - if (isObject(value) && !isArray(value)) { - object.update[name] = value; - } else { - object[set || 'enter'][name] = { - value: value - }; - } - - return 1; - } else { - return 0; - } -} - -function addEncoders(object, enter, update) { - for (var name in enter) { - addEncode(object, name, enter[name]); - } - - for (var _name in update) { - addEncode(object, _name, update[_name], 'update'); - } -} - -function extendEncode(encode, extra, skip) { - for (var name in extra) { - if (skip && hasOwnProperty(skip, name)) continue; - encode[name] = extend(encode[name] || {}, extra[name]); - } - - return encode; -} - -function has(key, encode) { - return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]); -} - -var MarkRole = 'mark'; -var FrameRole$1 = 'frame'; -var ScopeRole$1 = 'scope'; -var AxisRole$1 = 'axis'; -var AxisDomainRole = 'axis-domain'; -var AxisGridRole = 'axis-grid'; -var AxisLabelRole = 'axis-label'; -var AxisTickRole = 'axis-tick'; -var AxisTitleRole = 'axis-title'; -var LegendRole$1 = 'legend'; -var LegendBandRole = 'legend-band'; -var LegendEntryRole = 'legend-entry'; -var LegendGradientRole = 'legend-gradient'; -var LegendLabelRole = 'legend-label'; -var LegendSymbolRole = 'legend-symbol'; -var LegendTitleRole = 'legend-title'; -var TitleRole$1 = 'title'; -var TitleTextRole = 'title-text'; -var TitleSubtitleRole = 'title-subtitle'; - -function applyDefaults(encode, type, role, style, config) { - var defaults = {}, - enter = {}; - var update, key, skip, props; // if text mark, apply global lineBreak settings (#2370) - - key = 'lineBreak'; - - if (type === 'text' && config[key] != null && !has(key, encode)) { - applyDefault(defaults, key, config[key]); - } // ignore legend and axis roles - - - if (role == 'legend' || String(role).startsWith('axis')) { - role = null; - } // resolve mark config - - - props = role === FrameRole$1 ? config.group : role === MarkRole ? extend({}, config.mark, config[type]) : null; - - for (key in props) { - // do not apply defaults if relevant fields are defined - skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode)); - if (!skip) applyDefault(defaults, key, props[key]); - } // resolve styles, apply with increasing precedence - - - array(style).forEach(function (name) { - var props = config.style && config.style[name]; - - for (var _key13 in props) { - if (!has(_key13, encode)) { - applyDefault(defaults, _key13, props[_key13]); - } - } - }); - encode = extend({}, encode); // defensive copy - - for (key in defaults) { - props = defaults[key]; - - if (props.signal) { - (update = update || {})[key] = props; - } else { - enter[key] = props; - } - } - - encode.enter = extend(enter, encode.enter); - if (update) encode.update = extend(update, encode.update); - return encode; -} - -function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal ? { - signal: value.signal - } : { - value: value - }; -} - -var scaleRef = function scaleRef(scale) { - return isString(scale) ? $(scale) : scale.signal ? "(".concat(scale.signal, ")") : field$1(scale); -}; - -function entry(enc) { - if (enc.gradient != null) { - return gradient$1(enc); - } - - var value = enc.signal ? "(".concat(enc.signal, ")") : enc.color ? color$1(enc.color) : enc.field != null ? field$1(enc.field) : enc.value !== undefined ? $(enc.value) : undefined; - - if (enc.scale != null) { - value = scale$5(enc, value); - } - - if (value === undefined) { - value = null; - } - - if (enc.exponent != null) { - value = "pow(".concat(value, ",").concat(property(enc.exponent), ")"); - } - - if (enc.mult != null) { - value += "*".concat(property(enc.mult)); - } - - if (enc.offset != null) { - value += "+".concat(property(enc.offset)); - } - - if (enc.round) { - value = "round(".concat(value, ")"); - } - - return value; -} - -var _color = function _color(type, x, y, z) { - return "(".concat(type, "(").concat([x, y, z].map(entry).join(','), ")+'')"); -}; - -function color$1(enc) { - return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null; -} - -function gradient$1(enc) { - // map undefined to null; expression lang does not allow undefined - var args = [enc.start, enc.stop, enc.count].map(function (_) { - return _ == null ? null : $(_); - }); // trim null inputs from the end - - while (args.length && peek(args) == null) { - args.pop(); - } - - args.unshift(scaleRef(enc.gradient)); - return "gradient(".concat(args.join(','), ")"); -} - -function property(property) { - return isObject(property) ? '(' + entry(property) + ')' : property; -} - -function field$1(ref) { - return resolveField(isObject(ref) ? ref : { - datum: ref - }); -} - -function resolveField(ref) { - var object, level, field; - - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - - while (level-- > 0) { - object += '.mark.group'; - } - - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else { - field = ref.group; - } - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else { - error('Invalid field reference: ' + $(ref)); - } - - if (!ref.signal) { - field = isString(field) ? splitAccessPath(field).map($).join('][') : resolveField(field); - } - - return object + '[' + field + ']'; -} - -function scale$5(enc, value) { - var scale = scaleRef(enc.scale); - - if (enc.range != null) { - // pull value from scale range - value = "lerp(_range(".concat(scale, "), ").concat(+enc.range, ")"); - } else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = "_scale(".concat(scale, ", ").concat(value, ")"); - - if (enc.band) { - value = (value ? value + '+' : '') + "_bandwidth(".concat(scale, ")") + (+enc.band === 1 ? '' : '*' + property(enc.band)); - - if (enc.extra) { - // include logic to handle extraneous elements - value = "(datum.extra ? _scale(".concat(scale, ", datum.extra.value) : ").concat(value, ")"); - } - } - - if (value == null) value = '0'; - } - - return value; -} - -function rule$1(enc) { - var code = ''; - enc.forEach(function (rule) { - var value = entry(rule); - code += rule.test ? "(".concat(rule.test, ")?").concat(value, ":") : value; - }); // if no else clause, terminate with null (#1366) - - if (peek(code) === ':') { - code += 'null'; - } - - return code; -} - -function parseEncode(encode, type, role, style, scope, params) { - var enc = {}; - params = params || {}; - params.encoders = { - $encode: enc - }; - encode = applyDefaults(encode, type, role, style, scope.config); - - for (var _key14 in encode) { - enc[_key14] = parseBlock(encode[_key14], type, params, scope); - } - - return params; -} - -function parseBlock(block, marktype, params, scope) { - var channels = {}, - fields = {}; - - for (var name in block) { - if (block[name] != null) { - // skip any null entries - channels[name] = parse$5(expr(block[name]), scope, params, fields); - } - } - - return { - $expr: { - marktype: marktype, - channels: channels - }, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; -} - -function expr(enc) { - return isArray(enc) ? rule$1(enc) : entry(enc); -} - -function parse$5(code, scope, params, fields) { - var expr = parseExpression$1(code, scope); - expr.$fields.forEach(function (name) { - return fields[name] = 1; - }); - extend(params, expr.$params); - return expr.$expr; -} - -var OUTER = 'outer', - OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind']; - -function outerError(prefix, name) { - error(prefix + ' for "outer" push: ' + $(name)); -} - -function parseSignal(signal, scope) { - var name = signal.name; - - if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); // signal push must not use properties reserved for standard definition - - OUTER_INVALID.forEach(function (prop) { - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); - } else { - // define a new signal in the current scope - var op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); - } -} - -function Entry(type, value, params, parent) { - this.id = -1; - this.type = type; - this.value = value; - this.params = params; - if (parent) this.parent = parent; -} - -function entry$1(type, value, params, parent) { - return new Entry(type, value, params, parent); -} - -function operator(value, params) { - return entry$1('operator', value, params); -} // ----- - - -function ref(op) { - var ref = { - $ref: op.id - }; // if operator not yet registered, cache ref to resolve later - - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; -} - -function fieldRef(field, name) { - return name ? { - $field: field, - $name: name - } : { - $field: field - }; -} - -var keyFieldRef = fieldRef('key'); - -function compareRef(fields, orders) { - return { - $compare: fields, - $order: orders - }; -} - -function keyRef(fields, flat) { - var ref = { - $key: fields - }; - if (flat) ref.$flat = true; - return ref; -} // ----- - - -var Ascending = 'ascending'; -var Descending = 'descending'; - -function sortKey(sort) { - return !isObject(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field); -} - -function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || ''); -} // ----- - - -var Scope = 'scope'; -var View$1 = 'view'; - -function isSignal(_) { - return _ && _.signal; -} - -function isExpr(_) { - return _ && _.expr; -} - -function hasSignal(_) { - if (isSignal(_)) return true; - if (isObject(_)) for (var key in _) { - if (hasSignal(_[key])) return true; - } - return false; -} - -function value$2(specValue, defaultValue) { - return specValue != null ? specValue : defaultValue; -} - -function deref(v) { - return v && v.signal || v; -} - -var Timer = 'timer'; - -function parseStream$1(stream, scope) { - var method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : error('Invalid stream specification: ' + $(stream)); - return method(stream, scope); -} - -function eventSource(source) { - return source === Scope ? View$1 : source || View$1; -} - -function mergeStream(stream, scope) { - var list = stream.merge.map(function (s) { - return parseStream$1(s, scope); - }), - entry = streamParameters({ - merge: list - }, stream, scope); - return scope.addStream(entry).id; -} - -function nestedStream(stream, scope) { - var id = parseStream$1(stream.stream, scope), - entry = streamParameters({ - stream: id - }, stream, scope); - return scope.addStream(entry).id; -} - -function eventStream(stream, scope) { - var id, entry; - - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = { - between: stream.between, - filter: stream.filter - }; - } else { - id = scope.event(eventSource(stream.source), stream.type); - } - - entry = streamParameters({ - stream: id - }, stream, scope); - return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id; -} - -function streamParameters(entry, stream, scope) { - var param = stream.between; - - if (param) { - if (param.length !== 2) { - error('Stream "between" parameter must have 2 entries: ' + $(stream)); - } - - entry.between = [parseStream$1(param[0], scope), parseStream$1(param[1], scope)]; - } - - param = stream.filter ? [].concat(stream.filter) : []; - - if (stream.marktype || stream.markname || stream.markrole) { - // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - } - - if (stream.source === Scope) { - // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - } - - if (param.length) { - entry.filter = parseExpression$1('(' + param.join(')&&(') + ')', scope).$expr; - } - - if ((param = stream.throttle) != null) { - entry.throttle = +param; - } - - if ((param = stream.debounce) != null) { - entry.debounce = +param; - } - - if (stream.consume) { - entry.consume = true; - } - - return entry; -} - -function filterMark(type, name, role) { - var item = 'event.item'; - return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); -} -/** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ - - -function selector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW$1; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); -} - -var VIEW$1 = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL$1 = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 -}; - -function isMarkType(type) { - return MARKS[type]; -} - -function find$1(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - - for (; i < n; ++i) { - c = s[i]; - if (!count && c === endChar) return i;else if (popChar && popChar.indexOf(c) >= 0) --count;else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - - return i; -} - -function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find$1(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - - return output; -} - -function parseSelector(s) { - return s[0] === '[' ? parseBetween(s) : parseStream$2(s); -} - -function parseBetween(s) { - var n = s.length, - i = 1, - b, - stream; - i = find$1(s, i, RBRACK, LBRACK, RBRACK); - - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector); - stream = parseSelector(s.slice(1).trim()); - - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; -} - -function parseStream$2(s) { - var stream = { - source: DEFAULT_SOURCE - }, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, - j, - filter; // extract throttle from end - - if (s[n - 1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i + 1, n - 1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - - i = 0; - } - - if (!n) throw s; // set name flag based on first char - - if (s[0] === NAME) markname = ++i; // extract first part of multi-part stream selector - - j = find$1(s, i, COLON); - - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } // extract remaining part of stream selector - - - i = find$1(s, i, LBRACK); - - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } // extract filters - - - while (i < n) { - i = find$1(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } // marshall event stream specification - - - if (!(n = source.length) || ILLEGAL$1.test(source[n - 1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - return stream; -} - -function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function (_) { - var x = +_; - if (x !== x) throw s; - return x; - }); -} // bypass expression parser for internal operator references - - -var OP_VALUE_EXPR = { - code: '_.$value', - ast: { - type: 'Identifier', - value: 'value' - } -}; - -function parseUpdate$1(spec, scope, target) { - var events = spec.events, - update = spec.update, - encode = spec.encode, - sources = [], - entry = { - target: target - }; - - if (!events) { - error('Signal update missing events specification.'); - } // interpret as an event selector string - - - if (isString(events)) { - events = selector(events, scope.isSubscope() ? Scope : View$1); - } // separate event streams from signal updates - - - events = array(events).filter(function (s) { - return s.signal || s.scale ? (sources.push(s), 0) : 1; - }); // merge internal operator listeners - - if (sources.length > 1) { - sources = [mergeSources(sources)]; - } // merge event streams, include as source - - - if (events.length) { - sources.push(events.length > 1 ? { - merge: events - } : events[0]); - } - - if (encode != null) { - if (update) error('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + $(encode) + ')'; - } // resolve update value - - - entry.update = isString(update) ? parseExpression$1(update, scope) : update.expr != null ? parseExpression$1(update.expr, scope) : update.value != null ? update.value : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: { - $value: scope.signalRef(update.signal) - } - } : error('Invalid signal update specification.'); - - if (spec.force) { - entry.options = { - force: true - }; - } - - sources.forEach(function (source) { - scope.addUpdate(extend(streamSource(source, scope), entry)); - }); -} - -function streamSource(stream, scope) { - return { - source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream$1(stream, scope) - }; -} - -function mergeSources(sources) { - return { - signal: '[' + sources.map(function (s) { - return s.scale ? 'scale("' + s.scale + '")' : s.signal; - }) + ']' - }; -} - -function parseSignalUpdates(signal, scope) { - var op = scope.getSignal(signal.name), - expr = signal.update; - - if (signal.init) { - if (expr) { - error('Signals can not include both init and update expressions.'); - } else { - expr = signal.init; - op.initonly = true; - } - } - - if (expr) { - expr = parseExpression$1(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - if (signal.on) { - signal.on.forEach(function (_) { - parseUpdate$1(_, scope, op.id); - }); - } -} - -var transform$2 = function transform$2(name) { - return function (params, value, parent) { - return entry$1(name, value, params || undefined, parent); - }; -}; - -var Aggregate$1 = transform$2('aggregate'); -var AxisTicks$1 = transform$2('axisticks'); -var Bound$1 = transform$2('bound'); -var Collect$1 = transform$2('collect'); -var Compare$1 = transform$2('compare'); -var DataJoin$1 = transform$2('datajoin'); -var Encode$1 = transform$2('encode'); -var Expression$1 = transform$2('expression'); -var Facet$1 = transform$2('facet'); -var Field$1 = transform$2('field'); -var Key$1 = transform$2('key'); -var LegendEntries$1 = transform$2('legendentries'); -var Load$1 = transform$2('load'); -var Mark$1 = transform$2('mark'); -var MultiExtent$1 = transform$2('multiextent'); -var MultiValues$1 = transform$2('multivalues'); -var Overlap$1 = transform$2('overlap'); -var Params$2 = transform$2('params'); -var PreFacet$1 = transform$2('prefacet'); -var Projection$1 = transform$2('projection'); -var Proxy$1 = transform$2('proxy'); -var Relay$1 = transform$2('relay'); -var Render$1 = transform$2('render'); -var Scale$1 = transform$2('scale'); -var Sieve$1 = transform$2('sieve'); -var SortItems$1 = transform$2('sortitems'); -var ViewLayout$1 = transform$2('viewlayout'); -var Values$1 = transform$2('values'); -var FIELD_REF_ID = 0; -var MULTIDOMAIN_SORT_OPS = { - min: 'min', - max: 'max', - count: 'sum' -}; - -function initScale(spec, scope) { - var type = spec.type || 'linear'; - - if (!isValidScaleType(type)) { - error('Unrecognized scale type: ' + $(type)); - } - - scope.addScale(spec.name, { - type: type, - domain: undefined - }); -} - -function parseScale(spec, scope) { - var params = scope.getScale(spec.name).params, - key; - params.domain = parseScaleDomain(spec.domain, spec, scope); - - if (spec.range != null) { - params.range = parseScaleRange(spec, scope, params); - } - - if (spec.interpolate != null) { - parseScaleInterpolate(spec.interpolate, params); - } - - if (spec.nice != null) { - params.nice = parseScaleNice(spec.nice); - } - - if (spec.bins != null) { - params.bins = parseScaleBins(spec.bins, scope); - } - - for (key in spec) { - if (hasOwnProperty(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } -} - -function parseLiteral(v, scope) { - return !isObject(v) ? v : v.signal ? scope.signalRef(v.signal) : error('Unsupported object: ' + $(v)); -} - -function parseArray(v, scope) { - return v.signal ? scope.signalRef(v.signal) : v.map(function (v) { - return parseLiteral(v, scope); - }); -} - -function dataLookupError(name) { - error('Can not find data set: ' + $(name)); -} // -- SCALE DOMAIN ---- - - -function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) { - error('No scale domain defined for domainMin/domainMax to override.'); - } - - return; // default domain - } - - return domain.signal ? scope.signalRef(domain.signal) : (isArray(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope); -} - -function explicitDomain(domain, spec, scope) { - return domain.map(function (v) { - return parseLiteral(v, scope); - }); -} - -function singularDomain(domain, spec, scope) { - var data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - return isDiscrete(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : isQuantile(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field); -} - -function multipleDomain(domain, spec, scope) { - var data = domain.data, - fields = domain.fields.reduce(function (dom, d) { - d = isString(d) ? { - data: data, - field: d - } : isArray(d) || d.signal ? fieldRef$1(d, scope) : d; - dom.push(d); - return dom; - }, []); - return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields); -} - -function fieldRef$1(data, scope) { - var name = '_:vega:_' + FIELD_REF_ID++, - coll = Collect$1({}); - - if (isArray(data)) { - coll.value = { - $ingest: data - }; - } else if (data.signal) { - var code = 'setdata(' + $(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - - scope.addDataPipeline(name, [coll, Sieve$1({})]); - return { - data: name, - field: 'data' - }; -} - -function ordinalMultipleDomain(domain, scope, fields) { - var sort = parseSort(domain.sort, true), - counts, - p, - a, - c, - v; // get value counts for each domain field - - counts = fields.map(function (f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); - }); // aggregate the results from each domain field - - p = { - groupby: keyFieldRef, - pulse: counts - }; - - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [MULTIDOMAIN_SORT_OPS[a]]; - p.fields = [scope.fieldRef(v)]; - p.as = [v]; - } - - a = scope.add(Aggregate$1(p)); // collect aggregate output - - c = scope.add(Collect$1({ - pulse: ref(a) - })); // extract values for combined domain - - v = scope.add(Values$1({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) - })); - return ref(v); -} - -function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if (isObject(sort)) sort.field = 'key';else sort = { - field: 'key' - }; - } else if (!sort.field && sort.op !== 'count') { - error('No field provided for sort aggregate op: ' + sort.op); - } else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) { - error('Multiple domain scales can not be sorted using ' + sort.op); - } - } - } - - return sort; -} - -function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - var values = fields.map(function (f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); - }); // combine value arrays - - return ref(scope.add(MultiValues$1({ - values: values - }))); -} - -function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - var extents = fields.map(function (f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); - }); // combine extents - - return ref(scope.add(MultiExtent$1({ - extents: extents - }))); -} // -- SCALE BINS ----- - - -function parseScaleBins(v, scope) { - return v.signal || isArray(v) ? parseArray(v, scope) : scope.objectProperty(v); -} // -- SCALE NICE ----- - - -function parseScaleNice(nice) { - return isObject(nice) ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } : parseLiteral(nice); -} // -- SCALE INTERPOLATION ----- - - -function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - - if (interpolate.gamma != null) { - params.interpolateGamma = parseLiteral(interpolate.gamma); - } -} // -- SCALE RANGE ----- - - -function parseScaleRange(spec, scope, params) { - var range = spec.range, - config = scope.config.range; - - if (range.signal) { - return scope.signalRef(range.signal); - } else if (isString(range)) { - if (config && hasOwnProperty(config, range)) { - spec = extend({}, spec, { - range: config[range] - }); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') { - range = [0, { - signal: 'width' - }]; - } else if (range === 'height') { - range = isDiscrete(spec.type) ? [0, { - signal: 'height' - }] : [{ - signal: 'height' - }, 0]; - } else { - error('Unrecognized scale range value: ' + $(range)); - } - } else if (range.scheme) { - params.scheme = isArray(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if (isDiscrete(spec.type) && !isArray(range)) { - return parseScaleDomain(range, spec, scope); - } else if (!isArray(range)) { - error('Unsupported range type: ' + $(range)); - } - - return range.map(function (v) { - return (isArray(v) ? parseArray : parseLiteral)(v, scope); - }); -} - -function parseProjection(proj, scope) { - var config = scope.config.projection || {}, - params = {}; - - for (var name in proj) { - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } // apply projection defaults from config - - - for (name in config) { - if (params[name] == null) { - params[name] = parseParameter$1(config[name], name, scope); - } - } - - scope.addProjection(proj.name, params); -} - -function parseParameter$1(_, name, scope) { - return isArray(_) ? _.map(function (_) { - return parseParameter$1(_, name, scope); - }) : !isObject(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : error('Unsupported parameter object: ' + $(_)); -} - -var Top$1 = 'top'; -var Left$1 = 'left'; -var Right$1 = 'right'; -var Bottom$1 = 'bottom'; -var Center$1 = 'center'; -var Vertical = 'vertical'; -var Start$1 = 'start'; -var Middle$1 = 'middle'; -var End$1 = 'end'; -var Index = 'index'; -var Label = 'label'; -var Offset = 'offset'; -var Perc = 'perc'; -var Perc2 = 'perc2'; -var Value = 'value'; -var GuideLabelStyle = 'guide-label'; -var GuideTitleStyle = 'guide-title'; -var GroupTitleStyle = 'group-title'; -var GroupSubtitleStyle = 'group-subtitle'; -var Symbols$1 = 'symbol'; -var Gradient$1 = 'gradient'; -var Discrete$1 = 'discrete'; -var Size = 'size'; -var Shape = 'shape'; -var Fill = 'fill'; -var Stroke = 'stroke'; -var StrokeWidth = 'strokeWidth'; -var StrokeDash = 'strokeDash'; -var Opacity = 'opacity'; // Encoding channels supported by legends -// In priority order of 'canonical' scale - -var LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity]; -var Skip$2 = { - name: 1, - style: 1, - interactive: 1 -}; -var zero$1 = { - value: 0 -}; -var one$1 = { - value: 1 -}; -var GroupMark = 'group'; -var RectMark = 'rect'; -var RuleMark = 'rule'; -var SymbolMark = 'symbol'; -var TextMark = 'text'; - -function guideGroup(mark) { - mark.type = GroupMark; - mark.interactive = mark.interactive || false; - return mark; -} - -function lookup$5(spec, config) { - var _ = function _(name, dflt) { - return value$2(spec[name], value$2(config[name], dflt)); - }; - - _.isVertical = function (s) { - return Vertical === value$2(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection)); - }; - - _.gradientLength = function () { - return value$2(spec.gradientLength, config.gradientLength || config.gradientWidth); - }; - - _.gradientThickness = function () { - return value$2(spec.gradientThickness, config.gradientThickness || config.gradientHeight); - }; - - _.entryColumns = function () { - return value$2(spec.columns, value$2(config.columns, +_.isVertical(true))); - }; - - return _; -} - -function getEncoding(name, encode) { - var v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]); - return v && v.signal ? v : v ? v.value : null; -} - -function getStyle(name, scope, style) { - var s = scope.config.style[style]; - return s && s[name]; -} - -function anchorExpr(s, e, m) { - return "item.anchor === '".concat(Start$1, "' ? ").concat(s, " : item.anchor === '").concat(End$1, "' ? ").concat(e, " : ").concat(m); -} - -var alignExpr = anchorExpr($(Left$1), $(Right$1), $(Center$1)); - -function tickBand(_) { - var v = _('tickBand'), - offset = _('tickOffset'), - band, - extra; - - if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); - } else if (v.signal) { - // if signal, augment code to interpret values - band = { - signal: "(".concat(v.signal, ") === 'extent' ? 1 : 0.5") - }; - extra = { - signal: "(".concat(v.signal, ") === 'extent'") - }; - - if (!isObject(offset)) { - offset = { - signal: "(".concat(v.signal, ") === 'extent' ? 0 : ").concat(offset) - }; - } - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; - } else { - band = 0.5; - extra = false; - } - - return { - extra: extra, - band: band, - offset: offset - }; -} - -function extendOffset(value, offset) { - return !offset ? value : !value ? offset : !isObject(value) ? { - value: value, - offset: offset - } : Object.assign({}, value, { - offset: extendOffset(value.offset, offset) - }); -} - -function guideMark(mark, extras) { - if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip$2); - } else { - mark.interactive = false; - } - - return mark; -} - -function legendGradient(spec, scale, config, userEncode) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, - enter, - start, - stop, - width, - height; - - if (vertical) { - start = [0, 1]; - stop = [0, 0]; - width = thickness; - height = length; - } else { - start = [0, 0]; - stop = [1, 0]; - width = length; - height = thickness; - } - - encode = { - enter: enter = { - opacity: zero$1, - x: zero$1, - y: zero$1, - width: encoder(width), - height: encoder(height) - }, - update: extend({}, enter, { - opacity: one$1, - fill: { - gradient: scale, - start: start, - stop: stop - } - }), - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { - // update - opacity: _('gradientOpacity') - }); - return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode: encode - }, userEncode); -} - -function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, - enter, - u, - v, - uu, - vv, - adjust = ''; - - vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); - enter = { - opacity: zero$1, - fill: { - scale: scale, - field: Value - } - }; - enter[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = zero$1; - enter[uu] = { - signal: adjust + 'datum.' + Perc2, - mult: length - }; - enter[vv] = encoder(thickness); - encode = { - enter: enter, - update: extend({}, enter, { - opacity: one$1 - }), - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { - // update - opacity: _('gradientOpacity') - }); - return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode: encode - }, userEncode); -} - -var alignExpr$1 = "datum.".concat(Perc, "<=0?\"").concat(Left$1, "\":datum.").concat(Perc, ">=1?\"").concat(Right$1, "\":\"").concat(Center$1, "\""), - baselineExpr = "datum.".concat(Perc, "<=0?\"").concat(Bottom$1, "\":datum.").concat(Perc, ">=1?\"").concat(Top$1, "\":\"").concat(Middle$1, "\""); - -function legendGradientLabels(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = encoder(_.gradientThickness()), - length = _.gradientLength(), - overlap = _('labelOverlap'), - encode, - enter, - update, - u, - v, - adjust = ''; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1, - text: { - field: Label - } - }, - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value$2(spec.labelLimit, config.gradientLabelLimit) - }); - - if (vertical) { - enter.align = { - value: 'left' - }; - enter.baseline = update.baseline = { - signal: baselineExpr - }; - u = 'y'; - v = 'x'; - adjust = '1-'; - } else { - enter.align = update.align = { - signal: alignExpr$1 - }; - enter.baseline = { - value: 'top' - }; - u = 'x'; - v = 'y'; - } - - enter[u] = update[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = update[v] = thickness; - thickness.offset = value$2(spec.labelOffset, config.gradientLabelOffset) || 0; - overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; // type, role, style, key, dataRef, encode, extras - - return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode: encode, - overlap: overlap - }, userEncode); -} // userEncode is top-level, includes entries, symbols, labels - - -function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - var _ = lookup$5(spec, config), - entries = userEncode.entries, - interactive = !!(entries && entries.interactive), - name = entries ? entries.name : undefined, - height = _('clipHeight'), - symbolOffset = _('symbolOffset'), - valueRef = { - data: 'value' - }, - encode = {}, - xSignal = "(".concat(columns, ") ? datum.").concat(Offset, " : datum.").concat(Size), - yEncode = height ? encoder(height) : { - field: Size - }, - index = "datum.".concat(Index), - ncols = "max(1, ".concat(columns, ")"), - enter, - update, - labelOffset, - symbols, - labels, - nrows, - sort; - - yEncode.mult = 0.5; // -- LEGEND SYMBOLS -- - - encode = { - enter: enter = { - opacity: zero$1, - x: { - signal: xSignal, - mult: 0.5, - offset: symbolOffset - }, - y: yEncode - }, - update: update = { - opacity: one$1, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$1 - } - }; - var baseFill = null, - baseStroke = null; - - if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') - }, { - // update - opacity: _('symbolOpacity') - }); - LegendScales.forEach(function (scale) { - if (spec[scale]) { - update[scale] = enter[scale] = { - scale: spec[scale], - field: Value - }; - } - }); - symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode: encode - }, userEncode.symbols); // -- LEGEND LABELS -- - - labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - encode = { - enter: enter = { - opacity: zero$1, - x: { - signal: xSignal, - offset: labelOffset - }, - y: yEncode - }, - update: update = { - opacity: one$1, - text: { - field: Label - }, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') - }); - labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode: encode - }, userEncode.labels); // -- LEGEND ENTRY GROUPS -- - - encode = { - enter: { - noBound: { - value: !height - }, - // ignore width/height in bounds calc - width: zero$1, - height: height ? encoder(height) : zero$1, - opacity: zero$1 - }, - exit: { - opacity: zero$1 - }, - update: update = { - opacity: one$1, - row: { - signal: null - }, - column: { - signal: null - } - } - }; // annotate and sort groups to ensure correct ordering - - if (_.isVertical(true)) { - nrows = "ceil(item.mark.items.length / ".concat(ncols, ")"); - update.row.signal = "".concat(index, "%").concat(nrows); - update.column.signal = "floor(".concat(index, " / ").concat(nrows, ")"); - sort = { - field: ['row', index] - }; - } else { - update.row.signal = "floor(".concat(index, " / ").concat(ncols, ")"); - update.column.signal = "".concat(index, " % ").concat(ncols); - sort = { - field: index - }; - } // handle zero column case (implies infinite columns) - - - update.column.signal = "(".concat(columns, ")?").concat(update.column.signal, ":").concat(index); // facet legend entries into sub-groups - - dataRef = { - facet: { - data: dataRef, - name: 'value', - groupby: Index - } - }; - return guideGroup({ - role: ScopeRole$1, - from: dataRef, - encode: extendEncode(encode, entries, Skip$2), - marks: [symbols, labels], - name: name, - interactive: interactive, - sort: sort - }); -} - -function legendSymbolLayout(spec, config) { - var _ = lookup$5(spec, config); // layout parameters for legend entries - - - return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } - }; -} // expression logic for align, anchor, angle, and baseline calculation - - -var isL = 'item.orient === "left"', - isR = 'item.orient === "right"', - isLR = "(".concat(isL, " || ").concat(isR, ")"), - isVG = "datum.vgrad && ".concat(isLR), - baseline = anchorExpr('"top"', '"bottom"', '"middle"'), - alignFlip = anchorExpr('"right"', '"left"', '"center"'), - exprAlign = "datum.vgrad && ".concat(isR, " ? (").concat(alignFlip, ") : (").concat(isLR, " && !(datum.vgrad && ").concat(isL, ")) ? \"left\" : ").concat(alignExpr), - exprAnchor = "item._anchor || (".concat(isLR, " ? \"middle\" : \"start\")"), - exprAngle = "".concat(isVG, " ? (").concat(isL, " ? -90 : 90) : 0"), - exprBaseline = "".concat(isLR, " ? (datum.vgrad ? (").concat(isR, " ? \"bottom\" : \"top\") : ").concat(baseline, ") : \"top\""); - -function legendTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - encode; - - encode = { - enter: { - opacity: zero$1 - }, - update: { - opacity: one$1, - x: { - field: { - group: 'padding' - } - }, - y: { - field: { - group: 'padding' - } - } - }, - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: { - signal: exprAnchor - }, - angle: { - signal: exprAngle - }, - align: { - signal: exprAlign - }, - baseline: { - signal: exprBaseline - }, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { - // require update - align: _('titleAlign'), - baseline: _('titleBaseline') - }); - return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode: encode - }, userEncode); -} - -function clip$2(clip, scope) { - var expr; - - if (isObject(clip)) { - if (clip.signal) { - expr = clip.signal; - } else if (clip.path) { - expr = 'pathShape(' + param(clip.path) + ')'; - } else if (clip.sphere) { - expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - } - - return expr ? scope.signalRef(expr) : !!clip; -} - -function param(value) { - return isObject(value) && value.signal ? value.signal : $(value); -} - -function getRole(spec) { - var role = spec.role || ''; - return !role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title') ? role : spec.type === GroupMark ? ScopeRole$1 : role || MarkRole; -} - -function definition$1(spec) { - return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; -} - -function interactive(spec, scope) { - return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true; -} -/** - * Parse a data transform specification. - */ - - -function parseTransform(spec, scope) { - var def = definition(spec.type); - if (!def) error('Unrecognized transform type: ' + $(spec.type)); - var t = entry$1(def.type.toLowerCase(), null, parseParameters$1(def, spec, scope)); - if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; - return t; -} -/** - * Parse all parameters of a data transform. - */ - - -function parseParameters$1(def, spec, scope) { - var params = {}, - pdef, - i, - n; - - for (i = 0, n = def.params.length; i < n; ++i) { - pdef = def.params[i]; - params[pdef.name] = parseParameter$2(pdef, spec, scope); - } - - return params; -} -/** - * Parse a data transform parameter. - */ - - -function parseParameter$2(def, spec, scope) { - var type = def.type, - value = spec[def.name]; - - if (type === 'index') { - return parseIndexParameter(def, spec, scope); - } else if (value === undefined) { - if (def.required) { - error('Missing required ' + $(spec.type) + ' parameter: ' + $(def.name)); - } - - return; - } else if (type === 'param') { - return parseSubParameters(def, spec, scope); - } else if (type === 'projection') { - return scope.projectionRef(spec[def.name]); - } - - return def.array && !isSignal(value) ? value.map(function (v) { - return parameterValue(def, v, scope); - }) : parameterValue(def, value, scope); -} -/** - * Parse a single parameter value. - */ - - -function parameterValue(def, value, scope) { - var type = def.type; - - if (isSignal(value)) { - return isExpr$1(type) ? error('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal); - } else { - var expr = def.expr || isField(type); - return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef(value.field, value.as) : isExpr$1(type) ? parseExpression$1(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef(value) : isCompare(type) ? scope.compareRef(value) : value; - } -} -/** - * Parse parameter for accessing an index of another data set. - */ - - -function parseIndexParameter(def, spec, scope) { - if (!isString(spec.from)) { - error('Lookup "from" parameter must be a string literal.'); - } - - return scope.getData(spec.from).lookupRef(scope, spec.key); -} -/** - * Parse a parameter that contains one or more sub-parameter objects. - */ - - -function parseSubParameters(def, spec, scope) { - var value = spec[def.name]; - - if (def.array) { - if (!isArray(value)) { - // signals not allowed! - error('Expected an array of sub-parameters. Instead: ' + $(value)); - } - - return value.map(function (v) { - return parseSubParameter(def, v, scope); - }); - } else { - return parseSubParameter(def, value, scope); - } -} -/** - * Parse a sub-parameter object. - */ - - -function parseSubParameter(def, value, scope) { - var params, pdef, k, i, n; // loop over defs to find matching key - - for (i = 0, n = def.params.length; i < n; ++i) { - pdef = def.params[i]; - - for (k in pdef.key) { - if (pdef.key[k] !== value[k]) { - pdef = null; - break; - } - } - - if (pdef) break; - } // raise error if matching key not found - - - if (!pdef) error('Unsupported parameter: ' + $(value)); // parse params, create Params transform, return ref - - params = extend(parseParameters$1(pdef, value, scope), pdef.key); - return ref(scope.add(Params$2(params))); -} // -- Utilities ----- - - -function outerExpr(_) { - return _ && _.expr; -} - -function outerField(_) { - return _ && _.field; -} - -function isData(_) { - return _ === 'data'; -} - -function isExpr$1(_) { - return _ === 'expr'; -} - -function isField(_) { - return _ === 'field'; -} - -function isCompare(_) { - return _ === 'compare'; -} - -function parseData(from, group, scope) { - var facet, key, op, dataRef, parent; // if no source data, generate singleton datum - - if (!from) { - dataRef = ref(scope.add(Collect$1(null, [{}]))); - } // if faceted, process facet specification - else if (facet = from.facet) { - if (!group) error('Only group marks can be faceted.'); // use pre-faceted source data, if available - - if (facet.field != null) { - dataRef = parent = getDataRef(facet, scope); - } else { - // generate facet aggregates if no direct data specification - if (!from.data) { - op = parseTransform(extend({ - type: 'aggregate', - groupby: array(facet.groupby) - }, facet.aggregate), scope); - op.params.key = scope.keyRef(facet.groupby); - op.params.pulse = getDataRef(facet, scope); - dataRef = parent = ref(scope.add(op)); - } else { - parent = ref(scope.getData(from.data).aggregate); - } - - key = scope.keyRef(facet.groupby, true); - } - } // if not yet defined, get source data reference - - - if (!dataRef) { - dataRef = getDataRef(from, scope); - } - - return { - key: key, - pulse: dataRef, - parent: parent - }; -} - -function getDataRef(from, scope) { - return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output); -} - -function DataScope(scope, input, output, values, aggr) { - this.scope = scope; // parent scope object - - this.input = input; // first operator in pipeline (tuple input) - - this.output = output; // last operator in pipeline (tuple output) - - this.values = values; // operator for accessing tuples (but not tuple flow) - // last aggregate in transform pipeline - - this.aggregate = aggr; // lookup table of field indices - - this.index = {}; -} - -DataScope.fromEntries = function (scope, entries) { - var n = entries.length, - i = 1, - input = entries[0], - values = entries[n - 1], - output = entries[n - 2], - aggr = null; - - if (input && input.type === 'load') { - input = entries[1]; - } // add operator entries to this scope, wire up pulse chain - - - scope.add(entries[0]); - - for (; i < n; ++i) { - entries[i].params.pulse = ref(entries[i - 1]); - scope.add(entries[i]); - if (entries[i].type === 'aggregate') aggr = entries[i]; - } - - return new DataScope(scope, input, output, values, aggr); -}; - -var prototype$1t = DataScope.prototype; - -prototype$1t.countsRef = function (scope, field, sort) { - var ds = this, - cache = ds.counts || (ds.counts = {}), - k = fieldKey(field), - v, - a, - p; - - if (k != null) { - scope = ds.scope; - v = cache[k]; - } - - if (!v) { - p = { - groupby: scope.fieldRef(field, 'key'), - pulse: ref(ds.output) - }; - if (sort && sort.field) addSortField(scope, p, sort); - a = scope.add(Aggregate$1(p)); - v = scope.add(Collect$1({ - pulse: ref(a) - })); - v = { - agg: a, - ref: ref(v) - }; - if (k != null) cache[k] = v; - } else if (sort && sort.field) { - addSortField(scope, v.agg.params, sort); - } - - return v.ref; -}; - -function fieldKey(field) { - return isString(field) ? field : null; -} - -function addSortField(scope, p, sort) { - var as = aggrField(sort.op, sort.field), - s; - - if (p.ops) { - for (var i = 0, n = p.as.length; i < n; ++i) { - if (p.as[i] === as) return; - } - } else { - p.ops = ['count']; - p.fields = [null]; - p.as = ['count']; - } - - if (sort.op) { - p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op); - p.fields.push(scope.fieldRef(sort.field)); - p.as.push(as); - } -} - -function cache(scope, ds, name, optype, field, counts, index) { - var cache = ds[name] || (ds[name] = {}), - sort = sortKey(counts), - k = fieldKey(field), - v, - op; - - if (k != null) { - scope = ds.scope; - k = k + (sort ? '|' + sort : ''); - v = cache[k]; - } - - if (!v) { - var params = counts ? { - field: keyFieldRef, - pulse: ds.countsRef(scope, field, counts) - } : { - field: scope.fieldRef(field), - pulse: ref(ds.output) - }; - if (sort) params.sort = scope.sortRef(counts); - op = scope.add(entry$1(optype, undefined, params)); - if (index) ds.index[field] = op; - v = ref(op); - if (k != null) cache[k] = v; - } - - return v; -} - -prototype$1t.tuplesRef = function () { - return ref(this.values); -}; - -prototype$1t.extentRef = function (scope, field) { - return cache(scope, this, 'extent', 'extent', field, false); -}; - -prototype$1t.domainRef = function (scope, field) { - return cache(scope, this, 'domain', 'values', field, false); -}; - -prototype$1t.valuesRef = function (scope, field, sort) { - return cache(scope, this, 'vals', 'values', field, sort || true); -}; - -prototype$1t.lookupRef = function (scope, field) { - return cache(scope, this, 'lookup', 'tupleindex', field, false); -}; - -prototype$1t.indataRef = function (scope, field) { - return cache(scope, this, 'indata', 'tupleindex', field, true, true); -}; - -function parseFacet(spec, scope, group) { - var facet = spec.from.facet, - name = facet.name, - data = getDataRef(facet, scope), - subscope, - source, - values, - op; - - if (!facet.name) { - error('Facet must have a name: ' + $(facet)); - } - - if (!facet.data) { - error('Facet must reference a data set: ' + $(facet)); - } - - if (facet.field) { - op = scope.add(PreFacet$1({ - field: scope.fieldRef(facet.field), - pulse: data - })); - } else if (facet.groupby) { - op = scope.add(Facet$1({ - key: scope.keyRef(facet.groupby), - group: ref(scope.proxy(group.parent)), - pulse: data - })); - } else { - error('Facet must specify groupby or field: ' + $(facet)); - } // initialize facet subscope - - - subscope = scope.fork(); - source = subscope.add(Collect$1()); - values = subscope.add(Sieve$1({ - pulse: ref(source) - })); - subscope.addData(name, new DataScope(subscope, source, source, values)); - subscope.addSignal('parent', null); // parse faceted subflow - - op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; -} - -function parseSubflow(spec, scope, input) { - var op = scope.add(PreFacet$1({ - pulse: input.pulse - })), - subscope = scope.fork(); - subscope.add(Sieve$1()); - subscope.addSignal('parent', null); // parse group mark subflow - - op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; -} - -function parseTrigger(spec, scope, name) { - var remove = spec.remove, - insert = spec.insert, - toggle = spec.toggle, - modify = spec.modify, - values = spec.values, - op = scope.add(operator()), - update, - expr; - update = 'if(' + spec.trigger + ',modify("' + name + '",' + [insert, remove, toggle, modify, values].map(function (_) { - return _ == null ? 'null' : _; - }).join(',') + '),0)'; - expr = parseExpression$1(update, scope); - op.update = expr.$expr; - op.params = expr.$params; -} - -function parseMark(spec, scope) { - var role = getRole(spec), - group = spec.type === GroupMark, - facet = spec.from && spec.from.facet, - layout = spec.layout || role === ScopeRole$1 || role === FrameRole$1, - nested = role === MarkRole || layout || facet, - overlap = spec.overlap, - ops, - op, - input, - store, - enc, - bound, - render, - sieve, - name, - joinRef, - markRef, - encodeRef, - layoutRef, - boundRef; // resolve input data - - input = parseData(spec.from, group, scope); // data join to map tuples to visual items - - op = scope.add(DataJoin$1({ - key: input.key || (spec.key ? fieldRef(spec.key) : undefined), - pulse: input.pulse, - clean: !group - })); - joinRef = ref(op); // collect visual items - - op = store = scope.add(Collect$1({ - pulse: joinRef - })); // connect visual items to scenegraph - - op = scope.add(Mark$1({ - markdef: definition$1(spec), - interactive: interactive(spec.interactive, scope), - clip: clip$2(spec.clip, scope), - context: { - $context: true - }, - groups: scope.lookup(), - parent: scope.signals.parent ? scope.signalRef('parent') : null, - index: scope.markpath(), - pulse: ref(op) - })); - markRef = ref(op); // add visual encoders - - op = enc = scope.add(Encode$1(parseEncode(spec.encode, spec.type, role, spec.style, scope, { - mod: false, - pulse: markRef - }))); // monitor parent marks to propagate changes - - op.params.parent = scope.encode(); // add post-encoding transforms, if defined - - if (spec.transform) { - spec.transform.forEach(function (_) { - var tx = parseTransform(_, scope), - md = tx.metadata; - - if (md.generates || md.changes) { - error('Mark transforms should not generate new data.'); - } - - if (!md.nomod) enc.params.mod = true; // update encode mod handling - - tx.params.pulse = ref(op); - scope.add(op = tx); - }); - } // if item sort specified, perform post-encoding - - - if (spec.sort) { - op = scope.add(SortItems$1({ - sort: scope.compareRef(spec.sort), - pulse: ref(op) - })); - } - - encodeRef = ref(op); // add view layout operator if needed - - if (facet || layout) { - layout = scope.add(ViewLayout$1({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - mark: markRef, - pulse: encodeRef - })); - layoutRef = ref(layout); - } // compute bounding boxes - - - bound = scope.add(Bound$1({ - mark: markRef, - pulse: layoutRef || encodeRef - })); - boundRef = ref(bound); // if group mark, recurse to parse nested content - - if (group) { - // juggle layout & bounds to ensure they run *after* any faceting transforms - if (nested) { - ops = scope.operators; - ops.pop(); - if (layout) ops.pop(); - } - - scope.pushState(encodeRef, layoutRef || boundRef, joinRef); - facet ? parseFacet(spec, scope, input) // explicit facet - : nested ? parseSubflow(spec, scope, input) // standard mark group - : scope.parse(spec); // guide group, we can avoid nested scopes - - scope.popState(); - - if (nested) { - if (layout) ops.push(layout); - ops.push(bound); - } - } // if requested, add overlap removal transform - - - if (overlap) { - boundRef = parseOverlap(overlap, boundRef, scope); - } // render / sieve items - - - render = scope.add(Render$1({ - pulse: boundRef - })); - sieve = scope.add(Sieve$1({ - pulse: ref(render) - }, undefined, scope.parent())); // if mark is named, make accessible as reactive geometry - // add trigger updates if defined - - if (spec.name != null) { - name = spec.name; - scope.addData(name, new DataScope(scope, store, render, sieve)); - if (spec.on) spec.on.forEach(function (on) { - if (on.insert || on.remove || on.toggle) { - error('Marks only support modify triggers.'); - } - - parseTrigger(on, scope, name); - }); - } -} - -function parseOverlap(overlap, source, scope) { - var method = overlap.method, - bound = overlap.bound, - sep = overlap.separation, - tol; - var params = { - separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, - method: isSignal(method) ? scope.signalRef(method.signal) : method, - pulse: source - }; - - if (overlap.order) { - params.sort = scope.compareRef({ - field: overlap.order - }); - } - - if (bound) { - tol = bound.tolerance; - params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; - params.boundScale = scope.scaleRef(bound.scale); - params.boundOrient = bound.orient; - } - - return ref(scope.add(Overlap$1(params))); -} - -function parseLegend(spec, scope) { - var config = scope.config.legend, - encode = spec.encode || {}, - legendEncode = encode.legend || {}, - name = legendEncode.name || undefined, - interactive = legendEncode.interactive, - style = legendEncode.style, - _ = lookup$5(spec, config), - scales = {}, - scale = 0, - entryEncode, - entryLayout, - params, - children, - type, - datum, - dataRef, - entryRef; // resolve scales and 'canonical' scale name - - - LegendScales.forEach(function (s) { - return spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0; - }); - if (!scale) error('Missing valid scale for legend.'); // resolve legend type (symbol, gradient, or discrete gradient) - - type = legendType(spec, scope.scaleType(scale)); // single-element data source for legend group - - datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - dataRef = ref(scope.add(Collect$1(null, [datum]))); // encoding properties for legend group - - legendEncode = extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip$2); // encoding properties for legend entry sub-group - - entryEncode = { - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - } - }; // data source for legend values - - entryRef = ref(scope.add(LegendEntries$1(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); // continuous gradient legend - - if (type === Gradient$1) { - children = [legendGradient(spec, scale, config, encode.gradient), legendGradientLabels(spec, config, encode.labels, entryRef)]; // adjust default tick count based on the gradient length - - params.count = params.count || scope.signalRef("max(2,2*floor((".concat(deref(_.gradientLength()), ")/100))")); - } // discrete gradient legend - else if (type === Discrete$1) { - children = [legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), legendGradientLabels(spec, config, encode.labels, entryRef)]; - } // symbol legend - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns))]; // pass symbol size information to legend entry generator - - params.size = sizeExpression(spec, scope, children[0].marks); - } // generate legend marks - - - children = [guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive: interactive - })]; // include legend title if defined - - if (datum.title) { - children.push(legendTitle(spec, config, encode.title, dataRef)); - } // parse legend specification - - - return parseMark(guideGroup({ - role: LegendRole$1, - from: dataRef, - encode: legendEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name: name, - interactive: interactive, - style: style - }), scope); -} - -function legendType(spec, scaleType) { - var type = spec.type || Symbols$1; - - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { - type = isContinuous(scaleType) ? Gradient$1 : isDiscretizing(scaleType) ? Discrete$1 : Symbols$1; - } - - return type !== Gradient$1 ? type : isDiscretizing(scaleType) ? Discrete$1 : Gradient$1; -} - -function scaleCount(spec) { - return LegendScales.reduce(function (count, type) { - return count + (spec[type] ? 1 : 0); - }, 0); -} - -function buildLegendEncode(_, spec, config) { - var encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - return encode; -} - -function sizeExpression(spec, scope, marks) { - var size = deref(getChannel('size', spec, marks)), - strokeWidth = deref(getChannel('strokeWidth', spec, marks)), - fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - return parseExpression$1("max(ceil(sqrt(".concat(size, ")+").concat(strokeWidth, "),").concat(fontSize, ")"), scope); -} - -function getChannel(name, spec, marks) { - return spec[name] ? "scale(\"".concat(spec[name], "\",datum)") : getEncoding(name, marks[0].encode); -} - -function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); -} - -var angleExpr = "item.orient===\"".concat(Left$1, "\"?-90:item.orient===\"").concat(Right$1, "\"?90:0"); - -function parseTitle(spec, scope) { - spec = isString(spec) ? { - text: spec - } : spec; - - var _ = lookup$5(spec, scope.config.title), - encode = spec.encode || {}, - userEncode = encode.group || {}, - name = userEncode.name || undefined, - interactive = userEncode.interactive, - style = userEncode.style, - children = [], - datum, - dataRef; // single-element data source for group title - - - datum = {}; - dataRef = ref(scope.add(Collect$1(null, [datum]))); // include title text - - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); // include subtitle text - - if (spec.subtitle) { - children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - } // parse title specification - - - return parseMark(guideGroup({ - role: TitleRole$1, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name: name, - interactive: interactive, - style: style - }), scope); -} // provide backwards-compatibility for title custom encode; -// the top-level encode block has been *deprecated*. - - -function titleEncode(spec) { - var encode = spec.encode; - return encode && encode.title || extend({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); -} - -function groupEncode(_, userEncode) { - var encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: { - signal: alignExpr - }, - angle: { - signal: angleExpr - }, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') - }); - return extendEncode(encode, userEncode, Skip$2); -} - -function buildTitle(spec, _, userEncode, dataRef) { - var zero = { - value: 0 - }, - text = spec.text, - encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') - }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode: encode - }, userEncode); -} - -function buildSubTitle(spec, _, userEncode, dataRef) { - var zero = { - value: 0 - }, - text = spec.subtitle, - encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') - }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode: encode - }, userEncode); -} - -function parseData$1(data, scope) { - var transforms = []; - - if (data.transform) { - data.transform.forEach(function (tx) { - transforms.push(parseTransform(tx, scope)); - }); - } - - if (data.on) { - data.on.forEach(function (on) { - parseTrigger(on, scope, data.name); - }); - } - - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); -} -/** - * Analyze a data pipeline, add needed operators. - */ - - -function analyze(data, scope, ops) { - var output = [], - source = null, - modify = false, - generate = false, - upstream, - i, - n, - t, - m; - - if (data.values) { - // hard-wired input data set - if (hasSignal(data.values) || hasSignal(data.format)) { - // if either values or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format - })); - } - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format - })); - } - } else if (data.source) { - // derives from one or more other data sets - source = upstream = array(data.source).map(function (d) { - return ref(scope.getData(d).output); - }); - output.push(null); // populate later - } // scan data transforms, add collectors as needed - - - for (i = 0, n = ops.length; i < n; ++i) { - t = ops[i]; - m = t.metadata; - - if (!source && !m.source) { - output.push(source = collect()); - } - - output.push(t); - if (m.generates) generate = true; - if (m.modifies && !generate) modify = true; - if (m.source) source = t;else if (m.changes) source = null; - } - - if (upstream) { - n = upstream.length - 1; - output[0] = Relay$1({ - derive: modify, - pulse: n ? upstream : upstream[0] - }); - - if (modify || n) { - // collect derived and multi-pulse tuples - output.splice(1, 0, collect()); - } - } - - if (!source) output.push(collect()); - output.push(Sieve$1({})); - return output; -} - -function collect(values) { - var s = Collect$1({}, values); - s.metadata = { - source: true - }; - return s; -} - -function load$1(scope, data) { - return Load$1({ - url: data.url ? scope.property(data.url) : undefined, - async: data.async ? scope.property(data.async) : undefined, - values: data.values ? scope.property(data.values) : undefined, - format: scope.objectProperty(data.format) - }); -} - -var isX = function isX(orient) { - return orient === Bottom$1 || orient === Top$1; -}; // get sign coefficient based on axis orient - - -var getSign = function getSign(orient, a, b) { - return isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left$1 || orient === Top$1 ? a : b; -}; // condition on axis x-direction - - -var ifX = function ifX(orient, a, b) { - return isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b; -}; // condition on axis y-direction - - -var ifY = function ifY(orient, a, b) { - return isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a; -}; - -var ifTop = function ifTop(orient, a, b) { - return isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top$1 ? { - value: a - } : { - value: b - }; -}; - -var ifRight = function ifRight(orient, a, b) { - return isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right$1 ? { - value: a - } : { - value: b - }; -}; - -var ifXEnc = function ifXEnc($orient, a, b) { - return ifEnc("".concat($orient, " === '").concat(Top$1, "' || ").concat($orient, " === '").concat(Bottom$1, "'"), a, b); -}; - -var ifYEnc = function ifYEnc($orient, a, b) { - return ifEnc("".concat($orient, " !== '").concat(Top$1, "' && ").concat($orient, " !== '").concat(Bottom$1, "'"), a, b); -}; - -var ifLeftTopExpr = function ifLeftTopExpr($orient, a, b) { - return ifExpr("".concat($orient, " === '").concat(Left$1, "' || ").concat($orient, " === '").concat(Top$1, "'"), a, b); -}; - -var ifTopExpr = function ifTopExpr($orient, a, b) { - return ifExpr("".concat($orient, " === '").concat(Top$1, "'"), a, b); -}; - -var ifRightExpr = function ifRightExpr($orient, a, b) { - return ifExpr("".concat($orient, " === '").concat(Right$1, "'"), a, b); -}; - -var ifEnc = function ifEnc(test, a, b) { - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? a.signal || $(a.value) : null; - b = b ? b.signal || $(b.value) : null; - return { - signal: "".concat(test, " ? (").concat(a, ") : (").concat(b, ")") - }; - } else { - // otherwise generate rule set - return [extend({ - test: test - }, a)].concat(b || []); - } -}; - -var isSimple = function isSimple(enc) { - return enc == null || Object.keys(enc).length === 1; -}; - -var ifExpr = function ifExpr(test, a, b) { - return { - signal: "".concat(test, " ? (").concat(toExpr(a), ") : (").concat(toExpr(b), ")") - }; -}; - -var ifOrient = function ifOrient($orient, t, b, l, r) { - return { - signal: (l != null ? "".concat($orient, " === '").concat(Left$1, "' ? (").concat(toExpr(l), ") : ") : '') + (b != null ? "".concat($orient, " === '").concat(Bottom$1, "' ? (").concat(toExpr(b), ") : ") : '') + (r != null ? "".concat($orient, " === '").concat(Right$1, "' ? (").concat(toExpr(r), ") : ") : '') + (t != null ? "".concat($orient, " === '").concat(Top$1, "' ? (").concat(toExpr(t), ") : ") : '') + '(null)' - }; -}; - -var toExpr = function toExpr(v) { - return isSignal(v) ? v.signal : v == null ? null : $(v); -}; - -var mult = function mult(sign, value) { - return value === 0 ? 0 : isSignal(sign) ? { - signal: "(".concat(sign.signal, ") * ").concat(value) - } : { - value: sign * value - }; -}; - -var patch = function patch(value, base) { - var s = value.signal; - return s && s.endsWith('(null)') ? { - signal: s.slice(0, -6) + base.signal - } : value; -}; - -function fallback(prop, config, axisConfig, style) { - var styleProp; - - if (config && hasOwnProperty(config, prop)) { - return config[prop]; - } else if (hasOwnProperty(axisConfig, prop)) { - return axisConfig[prop]; - } else if (prop.startsWith('title')) { - switch (prop) { - case 'titleColor': - styleProp = 'fill'; - break; - - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - - return style[GuideTitleStyle][styleProp]; - } else if (prop.startsWith('label')) { - switch (prop) { - case 'labelColor': - styleProp = 'fill'; - break; - - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - - return style[GuideLabelStyle][styleProp]; - } - - return null; -} - -function keys$1(objects) { - var map = {}; - - var _iterator22 = _createForOfIteratorHelper(objects), - _step22; - - try { - for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) { - var obj = _step22.value; - if (!obj) continue; - - for (var _key15 in obj) { - map[_key15] = 1; - } - } - } catch (err) { - _iterator22.e(err); - } finally { - _iterator22.f(); - } - - return Object.keys(map); -} - -function axisConfig(spec, scope) { - var config = scope.config, - style = config.style, - axis = config.axis, - band = scope.scaleType(spec.scale) === 'band' && config.axisBand, - orient = spec.orient, - xy, - or, - key; - - if (isSignal(orient)) { - var xyKeys = keys$1([config.axisX, config.axisY]), - orientKeys = keys$1([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]); - xy = {}; - - var _iterator23 = _createForOfIteratorHelper(xyKeys), - _step23; - - try { - for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) { - key = _step23.value; - xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style)); - } - } catch (err) { - _iterator23.e(err); - } finally { - _iterator23.f(); - } - - or = {}; - - var _iterator24 = _createForOfIteratorHelper(orientKeys), - _step24; - - try { - for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) { - key = _step24.value; - or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style)); - } - } catch (err) { - _iterator24.e(err); - } finally { - _iterator24.f(); - } - } else { - xy = orient === Top$1 || orient === Bottom$1 ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; - } - - var result = xy || or || band ? extend({}, axis, xy, or, band) : axis; - return result; -} - -function axisDomain(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - encode, - enter, - update; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1 - }, - exit: { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') - }); - var pos0 = position(spec, 0); - var pos1 = position(spec, 1); - enter.x = update.x = ifX(orient, pos0, zero$1); - enter.x2 = update.x2 = ifX(orient, pos1); - enter.y = update.y = ifY(orient, pos0, zero$1); - enter.y2 = update.y2 = ifY(orient, pos1); - return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode: encode - }, userEncode); -} - -function position(spec, pos) { - return { - scale: spec.scale, - range: pos - }; -} - -function axisGrid(spec, config, userEncode, dataRef, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - vscale = spec.gridScale, - sign = getSign(orient, 1, -1), - offset = offsetValue$1(spec.offset, sign), - encode, - enter, - exit, - update, - tickPos, - gridStart, - gridEnd, - sz; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1 - }, - exit: exit = { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') - }); - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - sz = ifX(orient, { - signal: 'height' - }, { - signal: 'width' - }); - gridStart = vscale ? { - scale: vscale, - range: 0, - mult: sign, - offset: offset - } : { - value: 0, - offset: offset - }; - gridEnd = vscale ? { - scale: vscale, - range: 1, - mult: sign, - offset: offset - } : extend(sz, { - mult: sign, - offset: offset - }); - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); - exit.x = ifX(orient, tickPos); - exit.y = ifY(orient, tickPos); - return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode: encode - }, userEncode); -} - -function offsetValue$1(offset, sign) { - if (sign === 1) ;else if (!isObject(offset)) { - offset = isSignal(sign) ? { - signal: "(".concat(sign.signal, ") * (").concat(offset || 0, ")") - } : sign * (offset || 0); - } else { - var _entry = offset = extend({}, offset); - - while (_entry.mult != null) { - if (!isObject(_entry.mult)) { - _entry.mult = isSignal(sign) // no offset if sign === 1 - ? { - signal: "(".concat(_entry.mult, ") * (").concat(sign.signal, ")") - } : _entry.mult * sign; - return offset; - } else { - _entry = _entry.mult = extend({}, _entry.mult); - } - } - - _entry.mult = sign; - } - return offset; -} - -function axisTicks(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, - enter, - exit, - update, - tickSize, - tickPos; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1 - }, - exit: exit = { - opacity: zero$1 - } - }; - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') - }); - tickSize = encoder(size); - tickSize.mult = sign; - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - update.y = enter.y = ifX(orient, zero$1, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); - exit.x = ifX(orient, tickPos); - update.x = enter.x = ifY(orient, zero$1, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); - exit.y = ifY(orient, tickPos); - return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode: encode - }, userEncode); -} - -function flushExpr(scale, threshold, a, b, c) { - return { - signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')' - }; -} - -function axisLabels(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - scale = spec.scale, - sign = getSign(orient, -1, 1), - flush = deref(_('labelFlush')), - flushOffset = deref(_('labelFlushOffset')), - flushOn = flush === 0 || !!flush, - labelAlign = _('labelAlign'), - labelBaseline = _('labelBaseline'), - encode, - enter, - update, - tickSize, - tickPos, - align, - baseline, - bound, - overlap, - offsetExpr; - - tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; - tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - align = ifX(orient, flushOn ? flushExpr(scale, flush, '"left"', '"right"', '"center"') : { - value: 'center' - }, ifRight(orient, 'left', 'right')); - baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : { - value: 'middle' - }); - offsetExpr = flushExpr(scale, flush, "-(".concat(flushOffset, ")"), flushOffset, 0); - flushOn = flushOn && flushOffset; - enter = { - opacity: zero$1, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - encode = { - enter: enter, - update: update = { - opacity: one$1, - text: { - field: Label - }, - x: enter.x, - y: enter.y, - align: align, - baseline: baseline - }, - exit: { - opacity: zero$1, - x: enter.x, - y: enter.y - } - }; - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') - }, { - align: labelAlign, - baseline: labelBaseline - }); - bound = _('labelBound'); - overlap = _('labelOverlap'); // if overlap method or bound defined, request label overlap removal - - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? { - scale: scale, - orient: orient, - tolerance: bound - } : null - } : undefined; - - if (update.align !== align) { - update.align = patch(update.align, align); - } - - if (update.baseline !== baseline) { - update.baseline = patch(update.baseline, baseline); - } - - return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode: encode, - overlap: overlap - }, userEncode); -} - -function axisTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, - enter, - update, - titlePos; - - encode = { - enter: enter = { - opacity: zero$1, - anchor: encoder(_('titleAnchor', null)), - align: { - signal: alignExpr - } - }, - update: update = extend({}, enter, { - opacity: one$1, - text: encoder(spec.title) - }), - exit: { - opacity: zero$1 - } - }; - titlePos = { - signal: "lerp(range(\"".concat(spec.scale, "\"), ").concat(anchorExpr(0, 1, 0.5), ")") - }; - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero$1, mult(sign, 90)); - enter.baseline = ifX(orient, ifTop(orient, Bottom$1, Top$1), { - value: Bottom$1 - }); - update.angle = enter.angle; - update.baseline = enter.baseline; - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { - // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); - return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode: encode - }, userEncode); -} - -function autoLayout(_, orient, encode, userEncode) { - var auto = function auto(value, dim) { - return value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false; - }; - - var autoY = auto(_('titleX'), 'x'), - autoX = auto(_('titleY'), 'y'); - encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); -} - -function parseAxis(spec, scope) { - var config = axisConfig(spec, scope), - encode = spec.encode || {}, - axisEncode = encode.axis || {}, - name = axisEncode.name || undefined, - interactive = axisEncode.interactive, - style = axisEncode.style, - _ = lookup$5(spec, config), - band = tickBand(_), - datum, - dataRef, - ticksRef, - size, - children; // single-element data source for axis group - - - datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - dataRef = ref(scope.add(Collect$1({}, [datum]))); // encoding properties for axis group item - - axisEncode = extendEncode(buildAxisEncode(_, spec), axisEncode, Skip$2); // data source for axis ticks - - ticksRef = ref(scope.add(AxisTicks$1({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); // generate axis marks - - children = []; // include axis gridlines if requested - - if (datum.grid) { - children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - } // include axis ticks if requested - - - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } // include axis labels if requested - - - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } // include axis domain path if requested - - - if (datum.domain) { - children.push(axisDomain(spec, config, encode.domain, dataRef)); - } // include axis title if defined - - - if (datum.title) { - children.push(axisTitle(spec, config, encode.title, dataRef)); - } // parse axis specification - - - return parseMark(guideGroup({ - role: AxisRole$1, - from: dataRef, - encode: axisEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name: name, - interactive: interactive, - style: style - }), scope); -} - -function buildAxisEncode(_, spec) { - var encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value$2(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: { - signal: "abs(span(range(\"".concat(spec.scale, "\")))") - }, - translate: _('translate'), - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - return encode; -} - -function parseScope(spec, scope, preprocessed) { - var signals = array(spec.signals), - scales = array(spec.scales); // parse signal definitions, if not already preprocessed - - if (!preprocessed) signals.forEach(function (_) { - return parseSignal(_, scope); - }); // parse cartographic projection definitions - - array(spec.projections).forEach(function (_) { - return parseProjection(_, scope); - }); // initialize scale references - - scales.forEach(function (_) { - return initScale(_, scope); - }); // parse data sources - - array(spec.data).forEach(function (_) { - return parseData$1(_, scope); - }); // parse scale definitions - - scales.forEach(function (_) { - return parseScale(_, scope); - }); // parse signal updates - - (preprocessed || signals).forEach(function (_) { - return parseSignalUpdates(_, scope); - }); // parse axis definitions - - array(spec.axes).forEach(function (_) { - return parseAxis(_, scope); - }); // parse mark definitions - - array(spec.marks).forEach(function (_) { - return parseMark(_, scope); - }); // parse legend definitions - - array(spec.legends).forEach(function (_) { - return parseLegend(_, scope); - }); // parse title, if defined - - if (spec.title) parseTitle(spec.title, scope); // parse collected lambda (anonymous) expressions - - scope.parseLambdas(); - return scope; -} - -var rootEncode = function rootEncode(spec) { - return extendEncode({ - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - }, - update: { - width: { - signal: 'width' - }, - height: { - signal: 'height' - } - } - }, spec); -}; - -function parseView(spec, scope) { - var config = scope.config; // add scenegraph root - - var root = ref(scope.root = scope.add(operator())); // parse top-level signal definitions - - var signals = collectSignals(spec, config); - signals.forEach(function (_) { - return parseSignal(_, scope); - }); // assign description, event, legend, and locale configuration - - scope.description = spec.description || config.description; - scope.eventConfig = config.events; - scope.legends = scope.objectProperty(config.legend && config.legend.layout); - scope.locale = config.locale; // store root group item - - var input = scope.add(Collect$1()); // encode root group item - - var encode = scope.add(Encode$1(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole$1, spec.style, scope, { - pulse: ref(input) - }))); // perform view layout - - var parent = scope.add(ViewLayout$1({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) - })); - scope.operators.pop(); // parse remainder of specification - - scope.pushState(ref(encode), ref(parent), null); - parseScope(spec, scope, signals); - scope.operators.push(parent); // bound / render / sieve root item - - var op = scope.add(Bound$1({ - mark: root, - pulse: ref(parent) - })); - op = scope.add(Render$1({ - pulse: ref(op) - })); - op = scope.add(Sieve$1({ - pulse: ref(op) - })); // track metadata for root item - - scope.addData('root', new DataScope(scope, input, input, op)); - return scope; -} - -function signalObject(name, value) { - return value && value.signal ? { - name: name, - update: value.signal - } : { - name: name, - value: value - }; -} -/** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ - - -function collectSignals(spec, config) { - var _ = function _(name) { - return value$2(spec[name], config[name]); - }, - signals = [signalObject('background', _('background')), signalObject('autosize', parseAutosize(_('autosize'))), signalObject('padding', parsePadding(_('padding'))), signalObject('width', _('width') || 0), signalObject('height', _('height') || 0)], - pre = signals.reduce(function (p, s) { - return p[s.name] = s, p; - }, {}), - map = {}; // add spec signal array - - - array(spec.signals).forEach(function (s) { - if (hasOwnProperty(pre, s.name)) { - // merge if built-in signal - s = extend(pre[s.name], s); - } else { - // otherwise add to signal list - signals.push(s); - } - - map[s.name] = s; - }); // add config signal array - - array(config.signals).forEach(function (s) { - if (!hasOwnProperty(map, s.name) && !hasOwnProperty(pre, s.name)) { - // add to signal list if not already defined - signals.push(s); - } - }); - return signals; -} - -function Scope$1(config, options) { - this.config = config || {}; - this.options = options || {}; - this.bindings = []; - this.field = {}; - this.signals = {}; - this.lambdas = {}; - this.scales = {}; - this.events = {}; - this.data = {}; - this.streams = []; - this.updates = []; - this.operators = []; - this.eventConfig = null; - this.locale = null; - this._id = 0; - this._subid = 0; - this._nextsub = [0]; - this._parent = []; - this._encode = []; - this._lookup = []; - this._markpath = []; -} - -function Subscope(scope) { - this.config = scope.config; - this.options = scope.options; - this.legends = scope.legends; - this.field = Object.create(scope.field); - this.signals = Object.create(scope.signals); - this.lambdas = Object.create(scope.lambdas); - this.scales = Object.create(scope.scales); - this.events = Object.create(scope.events); - this.data = Object.create(scope.data); - this.streams = []; - this.updates = []; - this.operators = []; - this._id = 0; - this._subid = ++scope._nextsub[0]; - this._nextsub = scope._nextsub; - this._parent = scope._parent.slice(); - this._encode = scope._encode.slice(); - this._lookup = scope._lookup.slice(); - this._markpath = scope._markpath; -} - -var prototype$1u = Scope$1.prototype = Subscope.prototype; // ---- - -prototype$1u.parse = function (spec) { - return parseScope(spec, this); -}; - -prototype$1u.fork = function () { - return new Subscope(this); -}; - -prototype$1u.isSubscope = function () { - return this._subid > 0; -}; - -prototype$1u.toRuntime = function () { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; -}; - -prototype$1u.id = function () { - return (this._subid ? this._subid + ':' : 0) + this._id++; -}; - -prototype$1u.add = function (op) { - this.operators.push(op); - op.id = this.id(); // if pre-registration references exist, resolve them now - - if (op.refs) { - op.refs.forEach(function (ref) { - ref.$ref = op.id; - }); - op.refs = null; - } - - return op; -}; - -prototype$1u.proxy = function (op) { - var vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy$1({ - value: vref - })); -}; - -prototype$1u.addStream = function (stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; -}; - -prototype$1u.addUpdate = function (update) { - this.updates.push(update); - return update; -}; // Apply metadata - - -prototype$1u.finish = function () { - var name, ds; // annotate root - - if (this.root) this.root.root = true; // annotate signals - - for (name in this.signals) { - this.signals[name].signal = name; - } // annotate scales - - - for (name in this.scales) { - this.scales[name].scale = name; - } // annotate data sets - - - function annotate(op, name, type) { - var data, list; - - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } - } - - for (name in this.data) { - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - - for (var field in ds.index) { - annotate(ds.index[field], name, 'index:' + field); - } - } - - return this; -}; // ---- - - -prototype$1u.pushState = function (encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve$1({ - pulse: encode - })))); - - this._parent.push(parent); - - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - - this._markpath.push(-1); -}; - -prototype$1u.popState = function () { - this._encode.pop(); - - this._parent.pop(); - - this._lookup.pop(); - - this._markpath.pop(); -}; - -prototype$1u.parent = function () { - return peek(this._parent); -}; - -prototype$1u.encode = function () { - return peek(this._encode); -}; - -prototype$1u.lookup = function () { - return peek(this._lookup); -}; - -prototype$1u.markpath = function () { - var p = this._markpath; - return ++p[p.length - 1]; -}; // ---- - - -prototype$1u.fieldRef = function (field, name) { - if (isString(field)) return fieldRef(field, name); - - if (!field.signal) { - error('Unsupported field reference: ' + $(field)); - } - - var s = field.signal, - f = this.field[s], - params; - - if (!f) { - params = { - name: this.signalRef(s) - }; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field$1(params))); - } - - return f; -}; - -prototype$1u.compareRef = function (cmp) { - function check(_) { - if (isSignal(_)) { - signal = true; - return scope.signalRef(_.signal); - } else if (isExpr(_)) { - signal = true; - return scope.exprRef(_.expr); - } else { - return _; - } - } - - var scope = this, - signal = false, - fields = array(cmp.field).map(check), - orders = array(cmp.order).map(check); - return signal ? ref(this.add(Compare$1({ - fields: fields, - orders: orders - }))) : compareRef(fields, orders); -}; - -prototype$1u.keyRef = function (fields, flat) { - function check(_) { - if (isSignal(_)) { - signal = true; - return ref(sig[_.signal]); - } else { - return _; - } - } - - var sig = this.signals, - signal = false; - fields = array(fields).map(check); - return signal ? ref(this.add(Key$1({ - fields: fields, - flat: flat - }))) : keyRef(fields, flat); -}; - -prototype$1u.sortRef = function (sort) { - if (!sort) return sort; // including id ensures stable sorting - - var a = aggrField(sort.op, sort.field), - o = sort.order || Ascending; - return o.signal ? ref(this.add(Compare$1({ - fields: a, - orders: this.signalRef(o.signal) - }))) : compareRef(a, o); -}; // ---- - - -prototype$1u.event = function (source, type) { - var key = source + ':' + type; - - if (!this.events[key]) { - var id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - - return this.events[key]; -}; // ---- - - -prototype$1u.hasOwnSignal = function (name) { - return hasOwnProperty(this.signals, name); -}; - -prototype$1u.addSignal = function (name, value) { - if (this.hasOwnSignal(name)) { - error('Duplicate signal name: ' + $(name)); - } - - var op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; -}; - -prototype$1u.getSignal = function (name) { - if (!this.signals[name]) { - error('Unrecognized signal name: ' + $(name)); - } - - return this.signals[name]; -}; - -prototype$1u.signalRef = function (s) { - if (this.signals[s]) { - return ref(this.signals[s]); - } else if (!hasOwnProperty(this.lambdas, s)) { - this.lambdas[s] = this.add(operator(null)); - } - - return ref(this.lambdas[s]); -}; - -prototype$1u.parseLambdas = function () { - var code = Object.keys(this.lambdas); - - for (var i = 0, n = code.length; i < n; ++i) { - var s = code[i], - e = parseExpression$1(s, this), - op = this.lambdas[s]; - op.params = e.$params; - op.update = e.$expr; - } -}; - -prototype$1u.property = function (spec) { - return spec && spec.signal ? this.signalRef(spec.signal) : spec; -}; - -prototype$1u.objectProperty = function (spec) { - return !spec || !isObject(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); -}; - -function propertyLambda(spec) { - return (isArray(spec) ? arrayLambda : objectLambda)(spec); -} - -function arrayLambda(array) { - var code = '[', - i = 0, - n = array.length, - value; - - for (; i < n; ++i) { - value = array[i]; - code += (i > 0 ? ',' : '') + (isObject(value) ? value.signal || propertyLambda(value) : $(value)); - } - - return code + ']'; -} - -function objectLambda(obj) { - var code = '{', - i = 0, - key, - value; - - for (key in obj) { - value = obj[key]; - code += (++i > 1 ? ',' : '') + $(key) + ':' + (isObject(value) ? value.signal || propertyLambda(value) : $(value)); - } - - return code + '}'; -} - -prototype$1u.exprRef = function (code, name) { - var params = { - expr: parseExpression$1(code, this) - }; - if (name) params.expr.$name = name; - return ref(this.add(Expression$1(params))); -}; - -prototype$1u.addBinding = function (name, bind) { - if (!this.bindings) { - error('Nested signals do not support binding: ' + $(name)); - } - - this.bindings.push(extend({ - signal: name - }, bind)); -}; // ---- - - -prototype$1u.addScaleProj = function (name, transform) { - if (hasOwnProperty(this.scales, name)) { - error('Duplicate scale or projection name: ' + $(name)); - } - - this.scales[name] = this.add(transform); -}; - -prototype$1u.addScale = function (name, params) { - this.addScaleProj(name, Scale$1(params)); -}; - -prototype$1u.addProjection = function (name, params) { - this.addScaleProj(name, Projection$1(params)); -}; - -prototype$1u.getScale = function (name) { - if (!this.scales[name]) { - error('Unrecognized scale name: ' + $(name)); - } - - return this.scales[name]; -}; - -prototype$1u.projectionRef = prototype$1u.scaleRef = function (name) { - return ref(this.getScale(name)); -}; - -prototype$1u.projectionType = prototype$1u.scaleType = function (name) { - return this.getScale(name).params.type; -}; // ---- - - -prototype$1u.addData = function (name, dataScope) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - - return this.data[name] = dataScope; -}; - -prototype$1u.getData = function (name) { - if (!this.data[name]) { - error('Undefined data set name: ' + $(name)); - } - - return this.data[name]; -}; - -prototype$1u.addDataPipeline = function (name, entries) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - - return this.addData(name, DataScope.fromEntries(this, entries)); -}; -/** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ - - -function defaults() { - var defaultFont = 'sans-serif', - defaultSymbolSize = 30, - defaultStrokeWidth = 2, - defaultColor = '#4c78a8', - black = '#000', - gray = '#888', - lightGray = '#ddd'; - return { - // default visualization description - description: 'Vega visualization', - // default padding around visualization - padding: 0, - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - // default view background color - // covers the entire view component - background: null, - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: { - allow: ['wheel'] - } - }, - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - } - }, - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 - }, - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 - }, - // correction for centering bias - axisBand: { - tickOffset: -0.5 - }, - // defaults for cartographic projection - projection: { - type: 'mercator' - }, - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { - direction: 'vertical' - }, - right: { - direction: 'vertical' - } - } - }, - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [1, 0] - }, - symbol: ['circle', 'square', 'triangle-up', 'cross', 'diamond', 'triangle-right', 'triangle-down', 'triangle-left'] - } - }; -} - -function parse$6(spec, config, options) { - if (!isObject(spec)) { - error('Input Vega specification must be an object.'); - } - - config = mergeConfig(defaults(), config, spec.config); - return parseView(spec, new Scope$1(config, options)).toRuntime(); -} // -- Transforms ----- - - -extend(transforms, tx, vtx, encode, geo, force, tree, reg, voronoi, wordcloud, xf); \ No newline at end of file diff --git a/node_modules/vega/build-es5/vega-node.js b/node_modules/vega/build-es5/vega-node.js deleted file mode 100644 index f792ed2..0000000 --- a/node_modules/vega/build-es5/vega-node.js +++ /dev/null @@ -1,276 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var vegaUtil = require('vega-util'); - -var vegaDataflow = require('vega-dataflow'); - -var tx = require('vega-transforms'); - -var vtx = require('vega-view-transforms'); - -var encode = require('vega-encode'); - -var geo = require('vega-geo'); - -var force = require('vega-force'); - -var tree = require('vega-hierarchy'); - -var reg = require('vega-regression'); - -var voronoi = require('vega-voronoi'); - -var wordcloud = require('vega-wordcloud'); - -var xf = require('vega-crossfilter'); - -var vegaStatistics = require('vega-statistics'); - -var vegaTime = require('vega-time'); - -var vegaLoader = require('vega-loader'); - -var vegaScenegraph = require('vega-scenegraph'); - -var vegaScale = require('vega-scale'); - -var vegaProjection = require('vega-projection'); - -var vegaView = require('vega-view'); - -var vegaFormat = require('vega-format'); - -var vegaFunctions = require('vega-functions'); - -var vegaParser = require('vega-parser'); - -var vegaRuntime = require('vega-runtime'); - -var version = "5.13.0"; // -- Transforms ----- - -vegaUtil.extend(vegaDataflow.transforms, tx, vtx, encode, geo, force, tree, reg, voronoi, wordcloud, xf); -Object.keys(vegaUtil).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function get() { - return vegaUtil[k]; - } - }); -}); -Object.keys(vegaStatistics).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function get() { - return vegaStatistics[k]; - } - }); -}); -Object.keys(vegaTime).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function get() { - return vegaTime[k]; - } - }); -}); -Object.keys(vegaLoader).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function get() { - return vegaLoader[k]; - } - }); -}); -Object.keys(vegaScenegraph).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function get() { - return vegaScenegraph[k]; - } - }); -}); -Object.defineProperty(exports, 'Dataflow', { - enumerable: true, - get: function get() { - return vegaDataflow.Dataflow; - } -}); -Object.defineProperty(exports, 'EventStream', { - enumerable: true, - get: function get() { - return vegaDataflow.EventStream; - } -}); -Object.defineProperty(exports, 'MultiPulse', { - enumerable: true, - get: function get() { - return vegaDataflow.MultiPulse; - } -}); -Object.defineProperty(exports, 'Operator', { - enumerable: true, - get: function get() { - return vegaDataflow.Operator; - } -}); -Object.defineProperty(exports, 'Parameters', { - enumerable: true, - get: function get() { - return vegaDataflow.Parameters; - } -}); -Object.defineProperty(exports, 'Pulse', { - enumerable: true, - get: function get() { - return vegaDataflow.Pulse; - } -}); -Object.defineProperty(exports, 'Transform', { - enumerable: true, - get: function get() { - return vegaDataflow.Transform; - } -}); -Object.defineProperty(exports, 'changeset', { - enumerable: true, - get: function get() { - return vegaDataflow.changeset; - } -}); -Object.defineProperty(exports, 'definition', { - enumerable: true, - get: function get() { - return vegaDataflow.definition; - } -}); -Object.defineProperty(exports, 'ingest', { - enumerable: true, - get: function get() { - return vegaDataflow.ingest; - } -}); -Object.defineProperty(exports, 'isTuple', { - enumerable: true, - get: function get() { - return vegaDataflow.isTuple; - } -}); -Object.defineProperty(exports, 'transform', { - enumerable: true, - get: function get() { - return vegaDataflow.transform; - } -}); -Object.defineProperty(exports, 'transforms', { - enumerable: true, - get: function get() { - return vegaDataflow.transforms; - } -}); -Object.defineProperty(exports, 'tupleid', { - enumerable: true, - get: function get() { - return vegaDataflow.tupleid; - } -}); -Object.defineProperty(exports, 'interpolate', { - enumerable: true, - get: function get() { - return vegaScale.interpolate; - } -}); -Object.defineProperty(exports, 'interpolateColors', { - enumerable: true, - get: function get() { - return vegaScale.interpolateColors; - } -}); -Object.defineProperty(exports, 'interpolateRange', { - enumerable: true, - get: function get() { - return vegaScale.interpolateRange; - } -}); -Object.defineProperty(exports, 'quantizeInterpolator', { - enumerable: true, - get: function get() { - return vegaScale.quantizeInterpolator; - } -}); -Object.defineProperty(exports, 'scale', { - enumerable: true, - get: function get() { - return vegaScale.scale; - } -}); -Object.defineProperty(exports, 'scheme', { - enumerable: true, - get: function get() { - return vegaScale.scheme; - } -}); -Object.defineProperty(exports, 'projection', { - enumerable: true, - get: function get() { - return vegaProjection.projection; - } -}); -Object.defineProperty(exports, 'View', { - enumerable: true, - get: function get() { - return vegaView.View; - } -}); -Object.defineProperty(exports, 'defaultLocale', { - enumerable: true, - get: function get() { - return vegaFormat.defaultLocale; - } -}); -Object.defineProperty(exports, 'formatLocale', { - enumerable: true, - get: function get() { - return vegaFormat.numberFormatDefaultLocale; - } -}); -Object.defineProperty(exports, 'locale', { - enumerable: true, - get: function get() { - return vegaFormat.locale; - } -}); -Object.defineProperty(exports, 'resetDefaultLocale', { - enumerable: true, - get: function get() { - return vegaFormat.resetDefaultLocale; - } -}); -Object.defineProperty(exports, 'timeFormatLocale', { - enumerable: true, - get: function get() { - return vegaFormat.timeFormatDefaultLocale; - } -}); -Object.defineProperty(exports, 'expressionFunction', { - enumerable: true, - get: function get() { - return vegaFunctions.expressionFunction; - } -}); -Object.defineProperty(exports, 'parse', { - enumerable: true, - get: function get() { - return vegaParser.parse; - } -}); -Object.defineProperty(exports, 'runtimeContext', { - enumerable: true, - get: function get() { - return vegaRuntime.context; - } -}); -exports.version = version; \ No newline at end of file diff --git a/node_modules/vega/build-es5/vega.js b/node_modules/vega/build-es5/vega.js deleted file mode 100644 index aecad95..0000000 --- a/node_modules/vega/build-es5/vega.js +++ /dev/null @@ -1,46909 +0,0 @@ -"use strict"; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e4) { throw _e4; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e5) { didErr = true; err = _e5; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -(function (global, factory) { - (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.vega = {})); -})(void 0, function (exports) { - 'use strict'; - - var _defaultSpecifiers, _localGet, _localInv, _utcGet, _utcInv, _timeIntervals, _utcIntervals, _symbols$, _formats$; - - var _marked = /*#__PURE__*/regeneratorRuntime.mark(numbers), - _marked2 = /*#__PURE__*/regeneratorRuntime.mark(numbers$1), - _marked3 = /*#__PURE__*/regeneratorRuntime.mark(flatIterable); - - function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; - } - - function accessorName(fn) { - return fn == null ? null : fn.fname; - } - - function accessorFields(fn) { - return fn == null ? null : fn.fields; - } - - function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); - } - - var get1 = function get1(field) { - return function (obj) { - return obj[field]; - }; - }; - - var getN = function getN(path) { - var len = path.length; - return function (obj) { - for (var i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - - return obj; - }; - }; - - function error(message) { - throw Error(message); - } - - function splitAccessPath(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, - j, - c; - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i = j = 0; j < n; ++j) { - c = p[j]; - - if (c === '\\') { - s += p.substring(i, j); - s += p.substring(++j, ++j); - i = j; - } else if (c === q) { - push(); - q = null; - b = -1; - } else if (q) { - continue; - } else if (i === b && c === '"') { - i = j + 1; - q = c; - } else if (i === b && c === "'") { - i = j + 1; - q = c; - } else if (c === '.' && !b) { - if (j > i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; - } - - function field(field, name, opt) { - var path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor((opt && opt.get || getter)(path), [field], name || field); - } - - var empty = []; - var id = field('id'); - var identity = accessor(function (_) { - return _; - }, empty, 'identity'); - var zero = accessor(function () { - return 0; - }, empty, 'zero'); - var one = accessor(function () { - return 1; - }, empty, 'one'); - var truthy = accessor(function () { - return true; - }, empty, 'true'); - var falsy = accessor(function () { - return false; - }, empty, 'false'); - - function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console - } - - var None = 0; - var Error$1 = 1; - var Warn = 2; - var Info = 3; - var Debug = 4; - - function logger(_, method) { - var _level = _ || None; - - return { - level: function level(_) { - if (arguments.length) { - _level = +_; - return this; - } else { - return _level; - } - }, - error: function error() { - if (_level >= Error$1) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function warn() { - if (_level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function info() { - if (_level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function debug() { - if (_level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; - } - - var isArray = Array.isArray; - - function isObject(_) { - return _ === Object(_); - } - - var isLegalKey = function isLegalKey(key) { - return key !== '__proto__'; - }; - - function mergeConfig() { - for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) { - configs[_key] = arguments[_key]; - } - - return configs.reduce(function (out, source) { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? { - layout: 1 - } : key === 'style' ? true : null; - writeConfig(out, key, source[key], r); - } - } - - return out; - }, {}); - } - - function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - var k, o; - - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : output[key] = {}; - - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } - } - - function mergeNamed(a, b) { - if (a == null) return b; - var map = {}, - out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; - } - - function peek(array) { - return array[array.length - 1]; - } - - function toNumber(_) { - return _ == null || _ === '' ? null : +_; - } - - function exp(sign) { - return function (x) { - return sign * Math.exp(x); - }; - } - - function log$1(sign) { - return function (x) { - return Math.log(sign * x); - }; - } - - function symlog(c) { - return function (x) { - return Math.sign(x) * Math.log1p(Math.abs(x / c)); - }; - } - - function symexp(c) { - return function (x) { - return Math.sign(x) * Math.expm1(Math.abs(x)) * c; - }; - } - - function pow(exponent) { - return function (x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; - } - - function pan(domain, delta, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - dd = (d1 - d0) * delta; - return [ground(d0 - dd), ground(d1 - dd)]; - } - - function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); - } - - function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log$1(sign), exp(sign)); - } - - function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1 / exponent)); - } - - function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); - } - - function zoom(domain, anchor, scale, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)]; - } - - function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); - } - - function zoomLog(domain, anchor, scale) { - var sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log$1(sign), exp(sign)); - } - - function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent)); - } - - function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); - } - - function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); - } - - function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); - } - - function array(_) { - return _ != null ? isArray(_) ? _ : [_] : []; - } - /** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ - - - function clampRange(range, min, max) { - var lo = range[0], - hi = range[1], - span; - - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - - span = hi - lo; - return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span]; - } - - function isFunction(_) { - return typeof _ === 'function'; - } - - var DESCENDING = 'descending'; - - function compare(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - var ord = [], - get = [], - fmap = {}, - gen = opt.comparator || comparator; - array(fields).forEach(function (f, i) { - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach(function (_) { - return fmap[_] = 1; - }); - }); - return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap)); - } - - var compare$1 = function compare$1(u, v) { - return (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; - }; - - var comparator = function comparator(fields, orders) { - return fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); - }; - - var compare1 = function compare1(field, order) { - return function (a, b) { - return compare$1(field(a), field(b)) * order; - }; - }; - - var compareN = function compareN(fields, orders, n) { - orders.push(0); // pad zero for convenient lookup - - return function (a, b) { - var f, - c = 0, - i = -1; - - while (c === 0 && ++i < n) { - f = fields[i]; - c = compare$1(f(a), f(b)); - } - - return c * orders[i]; - }; - }; - - function constant(_) { - return isFunction(_) ? _ : function () { - return _; - }; - } - - function debounce(delay, handler) { - var tid, evt; - - function callback() { - handler(evt); - tid = evt = null; - } - - return function (e) { - evt = e; - if (tid) clearTimeout(tid); - tid = setTimeout(callback, delay); - }; - } - - function extend(_) { - for (var x, k, i = 1, len = arguments.length; i < len; ++i) { - x = arguments[i]; - - for (k in x) { - _[k] = x[k]; - } - } - - return _; - } - /** - * Return an array with minimum and maximum values, in the - * form [min, max]. Ignores null, undefined, and NaN values. - */ - - - function extent(array, f) { - var i = 0, - n, - v, - min, - max; - - if (array && (n = array.length)) { - if (f == null) { - // find first valid value - for (v = array[i]; i < n && (v == null || v !== v); v = array[++i]) { - ; - } - - min = max = v; // visit all other values - - for (; i < n; ++i) { - v = array[i]; // skip null/undefined; NaN will fail all comparisons - - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } else { - // find first valid value - for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])) { - ; - } - - min = max = v; // visit all other values - - for (; i < n; ++i) { - v = f(array[i]); // skip null/undefined; NaN will fail all comparisons - - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } - } - - return [min, max]; - } - - function extentIndex(array, f) { - var i = -1, - n = array.length, - a, - b, - c, - u, - v; - - if (f == null) { - while (++i < n) { - b = array[i]; - - if (b != null && b >= b) { - a = c = b; - break; - } - } - - if (i === n) return [-1, -1]; - u = v = i; - - while (++i < n) { - b = array[i]; - - if (b != null) { - if (a > b) { - a = b; - u = i; - } - - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while (++i < n) { - b = f(array[i], i, array); - - if (b != null && b >= b) { - a = c = b; - break; - } - } - - if (i === n) return [-1, -1]; - u = v = i; - - while (++i < n) { - b = f(array[i], i, array); - - if (b != null) { - if (a > b) { - a = b; - u = i; - } - - if (c < b) { - c = b; - v = i; - } - } - } - } - - return [u, v]; - } - - var hop = Object.prototype.hasOwnProperty; - - function hasOwnProperty(object, property) { - return hop.call(object, property); - } - - var NULL = {}; - - function fastmap(input) { - var obj = {}, - map, - _test; - - function has(key) { - return hasOwnProperty(obj, key) && obj[key] !== NULL; - } - - map = { - size: 0, - empty: 0, - object: obj, - has: has, - get: function get(key) { - return has(key) ? obj[key] : undefined; - }, - set: function set(key, value) { - if (!has(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - - obj[key] = value; - return this; - }, - delete: function _delete(key) { - if (has(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - - return this; - }, - clear: function clear() { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test: function test(_) { - if (arguments.length) { - _test = _; - return map; - } else { - return _test; - } - }, - clean: function clean() { - var next = {}, - size = 0, - key, - value; - - for (key in obj) { - value = obj[key]; - - if (value !== NULL && (!_test || !_test(value))) { - next[key] = value; - ++size; - } - } - - map.size = size; - map.empty = 0; - map.object = obj = next; - } - }; - if (input) Object.keys(input).forEach(function (key) { - map.set(key, input[key]); - }); - return map; - } - - function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - var a = range[0], - b = peek(range), - t = +threshold, - l, - r; // swap endpoints if range is reversed - - if (b < a) { - l = a; - a = b; - b = l; - } // compare value to endpoints - - - l = Math.abs(value - a); - r = Math.abs(b - value); // adjust if value is within threshold distance of endpoint - - return l < r && l <= t ? left : r <= t ? right : center; - } - - function inherits(child, parent) { - var proto = child.prototype = Object.create(parent.prototype); - proto.constructor = child; - return proto; - } - /** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ - - - function inrange(value, range, left, right) { - var r0 = range[0], - r1 = range[range.length - 1], - t; - - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - - left = left === undefined || left; - right = right === undefined || right; - return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1); - } - - function isBoolean(_) { - return typeof _ === 'boolean'; - } - - function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; - } - - function isNumber(_) { - return typeof _ === 'number'; - } - - function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; - } - - function isString(_) { - return typeof _ === 'string'; - } - - function key(fields, flat, opt) { - if (fields) { - fields = flat ? array(fields).map(function (f) { - return f.replace(/\\(.)/g, '$1'); - }) : array(fields); - } - - var len = fields && fields.length, - gen = opt && opt.get || getter, - map = function map(f) { - return gen(flat ? [f] : splitAccessPath(f)); - }; - - var fn; - - if (!len) { - fn = function fn() { - return ''; - }; - } else if (len === 1) { - var _get = map(fields[0]); - - fn = function fn(_) { - return '' + _get(_); - }; - } else { - var _get2 = fields.map(map); - - fn = function fn(_) { - var s = '' + _get2[0](_), - i = 0; - - while (++i < len) { - s += '|' + _get2[i](_); - } - - return s; - }; - } - - return accessor(fn, fields, 'key'); - } - - function lerp(array, frac) { - var lo = array[0], - hi = peek(array), - f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); - } - - var DEFAULT_MAX_SIZE = 10000; // adapted from https://github.com/dominictarr/hashlru/ (MIT License) - - function lruCache(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - var curr, prev, size; - - var clear = function clear() { - curr = {}; - prev = {}; - size = 0; - }; - - var update = function update(key, value) { - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - - return curr[key] = value; - }; - - clear(); - return { - clear: clear, - has: function has(key) { - return hasOwnProperty(curr, key) || hasOwnProperty(prev, key); - }, - get: function get(key) { - return hasOwnProperty(curr, key) ? curr[key] : hasOwnProperty(prev, key) ? update(key, prev[key]) : undefined; - }, - set: function set(key, value) { - return hasOwnProperty(curr, key) ? curr[key] = value : update(key, value); - } - }; - } - - function merge(compare, array0, array1, output) { - var n0 = array0.length, - n1 = array1.length; - if (!n1) return array0; - if (!n0) return array1; - var merged = output || new array0.constructor(n0 + n1), - i0 = 0, - i1 = 0, - i = 0; - - for (; i0 < n0 && i1 < n1; ++i) { - merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; - } - - for (; i0 < n0; ++i0, ++i) { - merged[i] = array0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - merged[i] = array1[i1]; - } - - return merged; - } - - function repeat(str, reps) { - var s = ''; - - while (--reps >= 0) { - s += str; - } - - return s; - } - - function pad(str, length, padchar, align) { - var c = padchar || ' ', - s = str + '', - n = length - s.length; - return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n); - } - /** - * Return the numerical span of an array: the difference between - * the last and first values. - */ - - - function span(array) { - return array && peek(array) - array[0] || 0; - } - - function $(x) { - return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace("\u2028", "\\u2028").replace("\u2029", "\\u2029") : x; - } - - function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; - } - - function defaultParser(_) { - return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); - } - - function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); - } - - function toString(_) { - return _ == null || _ === '' ? null : _ + ''; - } - - function toSet(_) { - for (var s = {}, i = 0, n = _.length; i < n; ++i) { - s[_[i]] = true; - } - - return s; - } - - function truncate(str, length, align, ellipsis) { - var e = ellipsis != null ? ellipsis : "\u2026", - s = str + '', - n = s.length, - l = Math.max(0, length - e.length); - return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e; - } - - function visitArray(array, filter, visitor) { - if (array) { - if (filter) { - var i = 0, - n = array.length, - t; - - for (; i < n; ++i) { - if (t = filter(array[i])) visitor(t, i, array); - } - } else { - array.forEach(visitor); - } - } - } - - function UniqueList(idFunc) { - var $ = idFunc || identity, - list = [], - ids = {}; - - list.add = function (_) { - var id = $(_); - - if (!ids[id]) { - ids[id] = 1; - list.push(_); - } - - return list; - }; - - list.remove = function (_) { - var id = $(_), - idx; - - if (ids[id]) { - ids[id] = 0; - - if ((idx = list.indexOf(_)) >= 0) { - list.splice(idx, 1); - } - } - - return list; - }; - - return list; - } - /** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ - - - function asyncCallback(_x, _x2) { - return _asyncCallback.apply(this, arguments); - } - - function _asyncCallback() { - _asyncCallback = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(df, callback) { - return regeneratorRuntime.wrap(function _callee3$(_context10) { - while (1) { - switch (_context10.prev = _context10.next) { - case 0: - _context10.prev = 0; - _context10.next = 3; - return callback(df); - - case 3: - _context10.next = 8; - break; - - case 5: - _context10.prev = 5; - _context10.t0 = _context10["catch"](0); - df.error(_context10.t0); - - case 8: - case "end": - return _context10.stop(); - } - } - }, _callee3, null, [[0, 5]]); - })); - return _asyncCallback.apply(this, arguments); - } - - var TUPLE_ID_KEY = Symbol('vega_id'), - TUPLE_ID = 1; - /** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ - - function isTuple(t) { - return !!(t && tupleid(t)); - } - /** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ - - - function tupleid(t) { - return t[TUPLE_ID_KEY]; - } - /** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ - - - function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; - } - /** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ - - - function ingest(datum) { - var t = datum === Object(datum) ? datum : { - data: datum - }; - return tupleid(t) ? t : setid(t, TUPLE_ID++); - } - /** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ - - - function derive(t) { - return rederive(t, ingest({})); - } - /** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ - - - function rederive(t, d) { - for (var k in t) { - d[k] = t[k]; - } - - return d; - } - /** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ - - - function replace(t, d) { - return setid(d, tupleid(t)); - } - /** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ - - - function stableCompare(cmp, f) { - return !cmp ? null : f ? function (a, b) { - return cmp(a, b) || tupleid(f(a)) - tupleid(f(b)); - } : function (a, b) { - return cmp(a, b) || tupleid(a) - tupleid(b); - }; - } - - function isChangeSet(v) { - return v && v.constructor === changeset; - } - - function changeset() { - var add = [], - // insert tuples - rem = [], - // remove tuples - mod = [], - // modify tuples - remp = [], - // remove by predicate - modp = [], - // modify by predicate - _clean = null, - _reflow = false; - return { - constructor: changeset, - insert: function insert(t) { - var d = array(t), - i = 0, - n = d.length; - - for (; i < n; ++i) { - add.push(d[i]); - } - - return this; - }, - remove: function remove(t) { - var a = isFunction(t) ? remp : rem, - d = array(t), - i = 0, - n = d.length; - - for (; i < n; ++i) { - a.push(d[i]); - } - - return this; - }, - modify: function modify(t, field, value) { - var m = { - field: field, - value: constant(value) - }; - - if (isFunction(t)) { - m.filter = t; - modp.push(m); - } else { - m.tuple = t; - mod.push(m); - } - - return this; - }, - encode: function encode(t, set) { - if (isFunction(t)) modp.push({ - filter: t, - field: set - });else mod.push({ - tuple: t, - field: set - }); - return this; - }, - clean: function clean(value) { - _clean = value; - return this; - }, - reflow: function reflow() { - _reflow = true; - return this; - }, - pulse: function pulse(_pulse, tuples) { - var cur = {}, - out = {}, - i, - n, - m, - f, - t, - id; // build lookup table of current tuples - - for (i = 0, n = tuples.length; i < n; ++i) { - cur[tupleid(tuples[i])] = 1; - } // process individual tuples to remove - - - for (i = 0, n = rem.length; i < n; ++i) { - t = rem[i]; - cur[tupleid(t)] = -1; - } // process predicate-based removals - - - for (i = 0, n = remp.length; i < n; ++i) { - f = remp[i]; - tuples.forEach(function (t) { - if (f(t)) cur[tupleid(t)] = -1; - }); - } // process all add tuples - - - for (i = 0, n = add.length; i < n; ++i) { - t = add[i]; - id = tupleid(t); - - if (cur[id]) { - // tuple already resides in dataset - // if flagged for both add and remove, cancel - cur[id] = 1; - } else { - // tuple does not reside in dataset, add - _pulse.add.push(ingest(add[i])); - } - } // populate pulse rem list - - - for (i = 0, n = tuples.length; i < n; ++i) { - t = tuples[i]; - if (cur[tupleid(t)] < 0) _pulse.rem.push(t); - } // modify helper method - - - function modify(t, f, v) { - if (v) { - t[f] = v(t); - } else { - _pulse.encode = f; - } - - if (!_reflow) out[tupleid(t)] = t; - } // process individual tuples to modify - - - for (i = 0, n = mod.length; i < n; ++i) { - m = mod[i]; - t = m.tuple; - f = m.field; - id = cur[tupleid(t)]; - - if (id > 0) { - modify(t, f, m.value); - - _pulse.modifies(f); - } - } // process predicate-based modifications - - - for (i = 0, n = modp.length; i < n; ++i) { - m = modp[i]; - f = m.filter; - tuples.forEach(function (t) { - if (f(t) && cur[tupleid(t)] > 0) { - modify(t, m.field, m.value); - } - }); - - _pulse.modifies(m.field); - } // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - - - if (_reflow) { - _pulse.mod = rem.length || remp.length ? tuples.filter(function (t) { - return cur[tupleid(t)] > 0; - }) : tuples.slice(); - } else { - for (id in out) { - _pulse.mod.push(out[id]); - } - } // set pulse garbage collection request - - - if (_clean || _clean == null && (rem.length || remp.length)) { - _pulse.clean(true); - } - - return _pulse; - } - }; - } - - var CACHE = '_:mod:_'; - /** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ - - function Parameters() { - Object.defineProperty(this, CACHE, { - writable: true, - value: {} - }); - } - - var prototype = Parameters.prototype; - /** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ - - prototype.set = function (name, index, value, force) { - var o = this, - v = o[name], - mod = o[CACHE]; - - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = isArray(value) ? 1 + value.length : -1; - } - - return o; - }; - /** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ - - - prototype.modified = function (name, index) { - var mod = this[CACHE], - k; - - if (!arguments.length) { - for (k in mod) { - if (mod[k]) return true; - } - - return false; - } else if (isArray(name)) { - for (k = 0; k < name.length; ++k) { - if (mod[name[k]]) return true; - } - - return false; - } - - return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name]; - }; - /** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ - - - prototype.clear = function () { - this[CACHE] = {}; - return this; - }; - - var OP_ID = 0; - var PULSE = 'pulse'; - var NO_PARAMS = new Parameters(); // Boolean Flags - - var SKIP = 1, - MODIFIED = 2; - /** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ - - function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - - if (update) { - this._update = update; - } - - if (params) this.parameters(params, react); - } - - var prototype$1 = Operator.prototype; - /** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ - - prototype$1.targets = function () { - return this._targets || (this._targets = UniqueList(id)); - }; - /** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ - - - prototype$1.set = function (value) { - if (this.value !== value) { - this.value = value; - return 1; - } else { - return 0; - } - }; - - function flag(bit) { - return function (state) { - var f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? f | bit : f & ~bit; - return this; - }; - } - /** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ - - - prototype$1.skip = flag(SKIP); - /** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ - - prototype$1.modified = flag(MODIFIED); - /** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initiatal evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ - - prototype$1.parameters = function (params, react, initonly) { - react = react !== false; - var self = this, - argval = self._argval = self._argval || new Parameters(), - argops = self._argops = self._argops || [], - deps = [], - name, - value, - n, - i; - - function add(name, index, value) { - if (value instanceof Operator) { - if (value !== self) { - if (react) value.targets().add(self); - deps.push(value); - } - - argops.push({ - op: value, - name: name, - index: index - }); - } else { - argval.set(name, index, value); - } - } - - for (name in params) { - value = params[name]; - - if (name === PULSE) { - array(value).forEach(function (op) { - if (!(op instanceof Operator)) { - error('Pulse parameters must be operator instances.'); - } else if (op !== self) { - op.targets().add(self); - deps.push(op); - } - }); - self.source = value; - } else if (isArray(value)) { - argval.set(name, -1, Array(n = value.length)); - - for (i = 0; i < n; ++i) { - add(name, i, value[i]); - } - } else { - add(name, -1, value); - } - } - - this.marshall().clear(); // initialize values - - if (initonly) argops.initonly = true; - return deps; - }; - /** - * Internal method for marshalling parameter values. - * Visits each operator dependency to pull the latest value. - * @return {Parameters} A Parameters object to pass to the update function. - */ - - - prototype$1.marshall = function (stamp) { - var argval = this._argval || NO_PARAMS, - argops = this._argops, - item, - i, - n, - op, - mod; - - if (argops) { - for (i = 0, n = argops.length; i < n; ++i) { - item = argops[i]; - op = item.op; - mod = op.modified() && op.stamp === stamp; - argval.set(item.name, item.index, op.value, mod); - } - - if (argops.initonly) { - for (i = 0; i < n; ++i) { - item = argops[i]; - item.op.targets().remove(this); - } - - this._argops = null; - this._update = null; - } - } - - return argval; - }; - /** - * Detach this operator from the dataflow. - * Unregisters listeners on upstream dependencies. - */ - - - prototype$1.detach = function () { - var argops = this._argops, - i, - n, - item, - op; - - if (argops) { - for (i = 0, n = argops.length; i < n; ++i) { - item = argops[i]; - op = item.op; - - if (op._targets) { - op._targets.remove(this); - } - } - } - }; - /** - * Delegate method to perform operator processing. - * Subclasses can override this method to perform custom processing. - * By default, it marshalls parameters and calls the update function - * if that function is defined. If the update function does not - * change the operator value then StopPropagation is returned. - * If no update function is defined, this method does nothing. - * @param {Pulse} pulse - the current dataflow pulse. - * @return The output pulse or StopPropagation. A falsy return value - * (including undefined) will let the input pulse pass through. - */ - - - prototype$1.evaluate = function (pulse) { - var update = this._update; - - if (update) { - var params = this.marshall(pulse.stamp), - v = update.call(this, params, pulse); - params.clear(); - - if (v !== this.value) { - this.value = v; - } else if (!this.modified()) { - return pulse.StopPropagation; - } - } - }; - /** - * Run this operator for the current pulse. If this operator has already - * been run at (or after) the pulse timestamp, returns StopPropagation. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ - - - prototype$1.run = function (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - var rv; - - if (this.skip()) { - this.skip(false); - rv = 0; - } else { - rv = this.evaluate(pulse); - } - - return this.pulse = rv || pulse; - }; - /** - * Add an operator to the dataflow graph. This function accepts a - * variety of input argument types. The basic signature supports an - * initial value, update function and parameters. If the first parameter - * is an Operator instance, it will be added directly. If it is a - * constructor for an Operator subclass, a new instance will be instantiated. - * Otherwise, if the first parameter is a function instance, it will be used - * as the update function and a null initial value is assumed. - * @param {*} init - One of: the operator to add, the initial value of - * the operator, an operator class to instantiate, or an update function. - * @param {function} [update] - The operator update function. - * @param {object} [params] - The operator parameters. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @return {Operator} - The added operator. - */ - - - function add(init, update, params, react) { - var shift = 1, - op; - - if (init instanceof Operator) { - op = init; - } else if (init && init.prototype instanceof Operator) { - op = new init(); - } else if (isFunction(init)) { - op = new Operator(null, init); - } else { - shift = 0; - op = new Operator(init, update); - } - - this.rank(op); - - if (shift) { - react = params; - params = update; - } - - if (params) this.connect(op, op.parameters(params, react)); - this.touch(op); - return op; - } - /** - * Connect a target operator as a dependent of source operators. - * If necessary, this method will rerank the target operator and its - * dependents to ensure propagation proceeds in a topologically sorted order. - * @param {Operator} target - The target operator. - * @param {Array} - The source operators that should propagate - * to the target operator. - */ - - - function connect(target, sources) { - var targetRank = target.rank, - i, - n; - - for (i = 0, n = sources.length; i < n; ++i) { - if (targetRank < sources[i].rank) { - this.rerank(target); - return; - } - } - } - - var STREAM_ID = 0; - /** - * Models an event stream. - * @constructor - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @param {function(Object)} [receive] - Event callback function to invoke - * upon receipt of a new event. Use to override standard event processing. - */ - - function EventStream(filter, apply, receive) { - this.id = ++STREAM_ID; - this.value = null; - if (receive) this.receive = receive; - if (filter) this._filter = filter; - if (apply) this._apply = apply; - } - /** - * Creates a new event stream instance with the provided - * (optional) filter, apply and receive functions. - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @see EventStream - */ - - - function stream(filter, apply, receive) { - return new EventStream(filter, apply, receive); - } - - var prototype$2 = EventStream.prototype; - prototype$2._filter = truthy; - prototype$2._apply = identity; - - prototype$2.targets = function () { - return this._targets || (this._targets = UniqueList(id)); - }; - - prototype$2.consume = function (_) { - if (!arguments.length) return !!this._consume; - this._consume = !!_; - return this; - }; - - prototype$2.receive = function (evt) { - if (this._filter(evt)) { - var val = this.value = this._apply(evt), - trg = this._targets, - n = trg ? trg.length : 0, - i = 0; - - for (; i < n; ++i) { - trg[i].receive(val); - } - - if (this._consume) { - evt.preventDefault(); - evt.stopPropagation(); - } - } - }; - - prototype$2.filter = function (filter) { - var s = stream(filter); - this.targets().add(s); - return s; - }; - - prototype$2.apply = function (apply) { - var s = stream(null, apply); - this.targets().add(s); - return s; - }; - - prototype$2.merge = function () { - var s = stream(); - this.targets().add(s); - - for (var i = 0, n = arguments.length; i < n; ++i) { - arguments[i].targets().add(s); - } - - return s; - }; - - prototype$2.throttle = function (pause) { - var t = -1; - return this.filter(function () { - var now = Date.now(); - - if (now - t > pause) { - t = now; - return 1; - } else { - return 0; - } - }); - }; - - prototype$2.debounce = function (delay) { - var s = stream(); - this.targets().add(stream(null, null, debounce(delay, function (e) { - var df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }))); - return s; - }; - - prototype$2.between = function (a, b) { - var active = false; - a.targets().add(stream(null, null, function () { - active = true; - })); - b.targets().add(stream(null, null, function () { - active = false; - })); - return this.filter(function () { - return active; - }); - }; - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ - - - function events(source, type, filter, apply) { - var df = this, - s = stream(filter, apply), - send = function send(e) { - e.dataflow = df; - - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally { - df.run(); - } - }, - sources; - - if (typeof source === 'string' && typeof document !== 'undefined') { - sources = document.querySelectorAll(source); - } else { - sources = array(source); - } - - for (var i = 0, n = sources.length; i < n; ++i) { - sources[i].addEventListener(type, send); - } - - return s; - } // Matches absolute URLs with optional protocol - // https://... file://... //... - - - var protocol_re = /^([A-Za-z]+:)?\/\//; // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// - - var allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape - - var whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex - // Special treatment in node.js for the file: protocol - - var fileProtocol = 'file://'; - /** - * Factory for a loader constructor that provides methods for requesting - * files from either the network or disk, and for sanitizing request URIs. - * @param {function} fetch - The Fetch API for HTTP network requests. - * If null or undefined, HTTP loading will be disabled. - * @param {object} fs - The file system interface for file loading. - * If null or undefined, local file loading will be disabled. - * @return {function} A loader constructor with the following signature: - * param {object} [options] - Optional default loading options to use. - * return {object} - A new loader instance. - */ - - function loaderFactory(fetch, fs) { - return function (options) { - return { - options: options || {}, - sanitize: sanitize, - load: load, - fileAccess: !!fs, - file: fileLoader(fs), - http: httpLoader(fetch) - }; - }; - } - /** - * Load an external resource, typically either from the web or from the local - * filesystem. This function uses {@link sanitize} to first sanitize the uri, - * then calls either {@link http} (for web requests) or {@link file} (for - * filesystem loading). - * @param {string} uri - The resource indicator (e.g., URL or filename). - * @param {object} [options] - Optional loading options. These options will - * override any existing default options. - * @return {Promise} - A promise that resolves to the loaded content. - */ - - - function load(_x3, _x4) { - return _load.apply(this, arguments); - } - /** - * URI sanitizer function. - * @param {string} uri - The uri (url or filename) to sanity check. - * @param {object} options - An options hash. - * @return {Promise} - A promise that resolves to an object containing - * sanitized uri data, or rejects it the input uri is deemed invalid. - * The properties of the resolved object are assumed to be - * valid attributes for an HTML 'a' tag. The sanitized uri *must* be - * provided by the 'href' property of the returned object. - */ - - - function _load() { - _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(uri, options) { - var opt, url; - return regeneratorRuntime.wrap(function _callee4$(_context11) { - while (1) { - switch (_context11.prev = _context11.next) { - case 0: - _context11.next = 2; - return this.sanitize(uri, options); - - case 2: - opt = _context11.sent; - url = opt.href; - return _context11.abrupt("return", opt.localFile ? this.file(url) : this.http(url, options)); - - case 5: - case "end": - return _context11.stop(); - } - } - }, _callee4, this); - })); - return _load.apply(this, arguments); - } - - function sanitize(_x5, _x6) { - return _sanitize.apply(this, arguments); - } - /** - * File system loader factory. - * @param {object} fs - The file system interface. - * @return {function} - A file loader with the following signature: - * param {string} filename - The file system path to load. - * param {string} filename - The file system path to load. - * return {Promise} A promise that resolves to the file contents. - */ - - - function _sanitize() { - _sanitize = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(uri, options) { - var fileAccess, result, isFile, loadFile, base, isAllowed, hasProtocol; - return regeneratorRuntime.wrap(function _callee5$(_context12) { - while (1) { - switch (_context12.prev = _context12.next) { - case 0: - options = extend({}, this.options, options); - fileAccess = this.fileAccess, result = { - href: null - }; - isAllowed = allowed_re.test(uri.replace(whitespace_re, '')); - - if (uri == null || typeof uri !== 'string' || !isAllowed) { - error('Sanitize failure, invalid URI: ' + $(uri)); - } - - hasProtocol = protocol_re.test(uri); // if relative url (no protocol/host), prepend baseURL - - if ((base = options.baseURL) && !hasProtocol) { - // Ensure that there is a slash between the baseURL (e.g. hostname) and url - if (!uri.startsWith('/') && base[base.length - 1] !== '/') { - uri = '/' + uri; - } - - uri = base + uri; - } // should we load from file system? - - - loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess; - - if (isFile) { - // strip file protocol - uri = uri.slice(fileProtocol.length); - } else if (uri.startsWith('//')) { - if (options.defaultProtocol === 'file') { - // if is file, strip protocol and set loadFile flag - uri = uri.slice(2); - loadFile = true; - } else { - // if relative protocol (starts with '//'), prepend default protocol - uri = (options.defaultProtocol || 'http') + ':' + uri; - } - } // set non-enumerable mode flag to indicate local file load - - - Object.defineProperty(result, 'localFile', { - value: !!loadFile - }); // set uri - - result.href = uri; // set default result target, if specified - - if (options.target) { - result.target = options.target + ''; - } // set default result rel, if specified (#1542) - - - if (options.rel) { - result.rel = options.rel + ''; - } // provide control over cross-origin image handling (#2238) - // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image - - - if (options.context === 'image' && options.crossOrigin) { - result.crossOrigin = options.crossOrigin + ''; - } // return - - - return _context12.abrupt("return", result); - - case 14: - case "end": - return _context12.stop(); - } - } - }, _callee5, this); - })); - return _sanitize.apply(this, arguments); - } - - function fileLoader(fs) { - return fs ? function (filename) { - return new Promise(function (accept, reject) { - fs.readFile(filename, function (error, data) { - if (error) reject(error);else accept(data); - }); - }); - } : fileReject; - } - /** - * Default file system loader that simply rejects. - */ - - - function fileReject() { - return _fileReject.apply(this, arguments); - } - /** - * HTTP request handler factory. - * @param {function} fetch - The Fetch API method. - * @return {function} - An http loader with the following signature: - * param {string} url - The url to request. - * param {object} options - An options hash. - * return {Promise} - A promise that resolves to the file contents. - */ - - - function _fileReject() { - _fileReject = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { - return regeneratorRuntime.wrap(function _callee6$(_context13) { - while (1) { - switch (_context13.prev = _context13.next) { - case 0: - error('No file system access.'); - - case 1: - case "end": - return _context13.stop(); - } - } - }, _callee6); - })); - return _fileReject.apply(this, arguments); - } - - function httpLoader(fetch) { - return fetch ? /*#__PURE__*/function () { - var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, options) { - var opt, type, response; - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - opt = extend({}, this.options.http, options); - type = options && options.response; - _context.next = 4; - return fetch(url, opt); - - case 4: - response = _context.sent; - return _context.abrupt("return", !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text()); - - case 6: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - return function (_x7, _x8) { - return _ref.apply(this, arguments); - }; - }() : httpReject; - } - /** - * Default http request handler that simply rejects. - */ - - - function httpReject() { - return _httpReject.apply(this, arguments); - } - - function _httpReject() { - _httpReject = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { - return regeneratorRuntime.wrap(function _callee7$(_context14) { - while (1) { - switch (_context14.prev = _context14.next) { - case 0: - error('No HTTP fetch method available.'); - - case 1: - case "end": - return _context14.stop(); - } - } - }, _callee7); - })); - return _httpReject.apply(this, arguments); - } - - var typeParsers = { - boolean: toBoolean, - integer: toNumber, - number: toNumber, - date: toDate, - string: toString, - unknown: identity - }; - var typeTests = [isBoolean$1, isInteger, isNumber$1, isDate$1]; - var typeList = ['boolean', 'integer', 'number', 'date']; - - function inferType(values, field) { - if (!values || !values.length) return 'unknown'; - var n = values.length, - m = typeTests.length, - a = typeTests.map(function (_, i) { - return i + 1; - }); - - for (var i = 0, t = 0, j, _value; i < n; ++i) { - _value = field ? values[i][field] : values[i]; - - for (j = 0; j < m; ++j) { - if (a[j] && isValid(_value) && !typeTests[j](_value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - } - - return typeList[a.reduce(function (u, v) { - return u === 0 ? v : u; - }, 0) - 1]; - } - - function inferTypes(data, fields) { - return fields.reduce(function (types, field) { - types[field] = inferType(data, field); - return types; - }, {}); - } // -- Type Checks ---- - - - function isValid(_) { - return _ != null && _ === _; - } - - function isBoolean$1(_) { - return _ === 'true' || _ === 'false' || _ === true || _ === false; - } - - function isDate$1(_) { - return !Number.isNaN(Date.parse(_)); - } - - function isNumber$1(_) { - return !Number.isNaN(+_) && !(_ instanceof Date); - } - - function isInteger(_) { - return isNumber$1(_) && Number.isInteger(+_); - } - - var EOL = {}, - EOF = {}, - QUOTE = 34, - NEWLINE = 10, - RETURN = 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 = objectConverter(columns); - return function (row, i) { - return f(object(row), i, columns); - }; - } // Compute unique columns in order of discovery. - - - function inferColumns(rows) { - var columnSet = Object.create(null), - columns = []; - rows.forEach(function (row) { - for (var column in row) { - if (!(column in columnSet)) { - columns.push(columnSet[column] = column); - } - } - }); - return columns; - } - - function pad$1(value, width) { - var s = value + "", - length = s.length; - return length < width ? new Array(width - length + 1).join(0) + s : s; - } - - function formatYear(year) { - return year < 0 ? "-" + pad$1(-year, 6) : year > 9999 ? "+" + pad$1(year, 6) : pad$1(year, 4); - } - - function formatDate(date) { - var hours = date.getUTCHours(), - minutes = date.getUTCMinutes(), - seconds = date.getUTCSeconds(), - milliseconds = date.getUTCMilliseconds(); - return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear()) + "-" + pad$1(date.getUTCMonth() + 1, 2) + "-" + pad$1(date.getUTCDate(), 2) + (milliseconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "." + pad$1(milliseconds, 3) + "Z" : seconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "Z" : minutes || hours ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + "Z" : ""); - } - - function dsvFormat(delimiter) { - var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), - DELIMITER = delimiter.charCodeAt(0); - - function parse(text, f) { - var convert, - columns, - rows = parseRows(text, function (row, i) { - if (convert) return convert(row, i - 1); - columns = row, convert = f ? customConverter(row, f) : objectConverter(row); - }); - rows.columns = columns || []; - return rows; - } - - function parseRows(text, f) { - var rows = [], - // output rows - N = text.length, - I = 0, - // current character index - n = 0, - // current line number - t, - // current token - eof = N <= 0, - // current token followed by EOF? - eol = false; // current token followed by EOL? - // Strip the trailing newline. - - if (text.charCodeAt(N - 1) === NEWLINE) --N; - if (text.charCodeAt(N - 1) === RETURN) --N; - - function token() { - if (eof) return EOF; - if (eol) return eol = false, EOL; // Unescape quotes. - - var i, - j = I, - c; - - if (text.charCodeAt(j) === QUOTE) { - while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE) { - ; - } - - if ((i = I) >= N) eof = true;else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } - return text.slice(j + 1, i - 1).replace(/""/g, "\""); - } // Find next delimiter or newline. - - - while (I < N) { - if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } else if (c !== DELIMITER) continue; - return text.slice(j, i); - } // Return last token before EOF. - - - return eof = true, text.slice(j, N); - } - - while ((t = token()) !== EOF) { - var row = []; - - while (t !== EOL && t !== EOF) { - row.push(t), t = token(); - } - - if (f && (row = f(row, n++)) == 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 == null) columns = inferColumns(rows); - return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); - } - - function formatBody(rows, columns) { - if (columns == null) columns = 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 == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" : value; - } - - return { - parse: parse, - parseRows: parseRows, - format: format, - formatBody: formatBody, - formatRows: formatRows, - formatRow: formatRow, - formatValue: formatValue - }; - } - - function delimitedFormat(delimiter) { - var parse = function parse(data, format) { - var delim = { - delimiter: delimiter - }; - return dsv(data, format ? extend(format, delim) : delim); - }; - - parse.responseType = 'text'; - return parse; - } - - function dsv(data, format) { - if (format.header) { - data = format.header.map($).join(format.delimiter) + '\n' + data; - } - - return dsvFormat(format.delimiter).parse(data + ''); - } - - dsv.responseType = 'text'; - - function isBuffer(_) { - return typeof Buffer === 'function' && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; - } - - function json(data, format) { - var prop = format && format.property ? field(format.property) : identity; - return isObject(data) && !isBuffer(data) ? parseJSON(prop(data)) : prop(JSON.parse(data)); - } - - json.responseType = 'json'; - - function parseJSON(data, format) { - return format && format.copy ? JSON.parse(JSON.stringify(data)) : data; - } - - function identity$1(x) { - return x; - } - - function transform(transform) { - if (transform == null) return identity$1; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function (input, i) { - if (!i) x0 = y0 = 0; - var j = 2, - n = input.length, - output = new Array(n); - output[0] = (x0 += input[0]) * kx + dx; - output[1] = (y0 += input[1]) * ky + dy; - - while (j < n) { - output[j] = input[j], ++j; - } - - return output; - }; - } - - function reverse(array, n) { - var t, - j = array.length, - i = j - n; - - while (i < --j) { - t = array[i], array[i++] = array[j], array[j] = t; - } - } - - function feature(topology, o) { - if (typeof o === "string") o = topology.objects[o]; - return o.type === "GeometryCollection" ? { - type: "FeatureCollection", - features: o.geometries.map(function (o) { - return feature$1(topology, o); - }) - } : feature$1(topology, o); - } - - function feature$1(topology, o) { - var id = o.id, - bbox = o.bbox, - properties = o.properties == null ? {} : o.properties, - geometry = object(topology, o); - return id == null && bbox == null ? { - type: "Feature", - properties: properties, - geometry: geometry - } : bbox == null ? { - type: "Feature", - id: id, - properties: properties, - geometry: geometry - } : { - type: "Feature", - id: id, - bbox: bbox, - properties: properties, - geometry: geometry - }; - } - - function object(topology, o) { - var transformPoint = transform(topology.transform), - arcs = topology.arcs; - - function arc(i, points) { - if (points.length) points.pop(); - - for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) { - points.push(transformPoint(a[k], k)); - } - - if (i < 0) reverse(points, n); - } - - function point(p) { - return transformPoint(p); - } - - function line(arcs) { - var points = []; - - for (var i = 0, n = arcs.length; i < n; ++i) { - arc(arcs[i], points); - } - - if (points.length < 2) points.push(points[0]); // This should never happen per the specification. - - return points; - } - - function ring(arcs) { - var points = line(arcs); - - while (points.length < 4) { - points.push(points[0]); - } // This may happen if an arc has only two points. - - - return points; - } - - function polygon(arcs) { - return arcs.map(ring); - } - - function geometry(o) { - var type = o.type, - coordinates; - - switch (type) { - case "GeometryCollection": - return { - type: type, - geometries: o.geometries.map(geometry) - }; - - case "Point": - coordinates = point(o.coordinates); - break; - - case "MultiPoint": - coordinates = o.coordinates.map(point); - break; - - case "LineString": - coordinates = line(o.arcs); - break; - - case "MultiLineString": - coordinates = o.arcs.map(line); - break; - - case "Polygon": - coordinates = polygon(o.arcs); - break; - - case "MultiPolygon": - coordinates = o.arcs.map(polygon); - break; - - default: - return null; - } - - return { - type: type, - coordinates: coordinates - }; - } - - return geometry(o); - } - - function stitch(topology, arcs) { - var stitchedArcs = {}, - fragmentByStart = {}, - fragmentByEnd = {}, - fragments = [], - emptyIndex = -1; // Stitch empty arcs first, since they may be subsumed by other arcs. - - arcs.forEach(function (i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], - t; - - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) { - t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - } - }); - arcs.forEach(function (i) { - var e = ends(i), - start = e[0], - end = e[1], - f, - g; - - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else { - f = [i]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], - p0 = arc[0], - p1; - if (topology.transform) p1 = [0, 0], arc.forEach(function (dp) { - p1[0] += dp[0], p1[1] += dp[1]; - });else p1 = arc[arc.length - 1]; - return i < 0 ? [p1, p0] : [p0, p1]; - } - - function flush(fragmentByEnd, fragmentByStart) { - for (var k in fragmentByEnd) { - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function (i) { - stitchedArcs[i < 0 ? ~i : i] = 1; - }); - fragments.push(f); - } - } - - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function (i) { - if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); - }); - return fragments; - } - - function mesh(topology) { - return object(topology, meshArcs.apply(this, arguments)); - } - - function meshArcs(topology, object, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object, filter);else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) { - arcs[i] = i; - } - return { - type: "MultiLineString", - arcs: stitch(topology, arcs) - }; - } - - function extractArcs(topology, object, filter) { - var arcs = [], - geomsByArc = [], - geom; - - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({ - i: i, - g: geom - }); - } - - function extract1(arcs) { - arcs.forEach(extract0); - } - - function extract2(arcs) { - arcs.forEach(extract1); - } - - function extract3(arcs) { - arcs.forEach(extract2); - } - - function geometry(o) { - switch (geom = o, o.type) { - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - - case "LineString": - extract1(o.arcs); - break; - - case "MultiLineString": - case "Polygon": - extract2(o.arcs); - break; - - case "MultiPolygon": - extract3(o.arcs); - break; - } - } - - geometry(object); - geomsByArc.forEach(filter == null ? function (geoms) { - arcs.push(geoms[0].i); - } : function (geoms) { - if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); - }); - return arcs; - } - - var filters = { - interior: function interior(a, b) { - return a !== b; - }, - exterior: function exterior(a, b) { - return a === b; - } - }; - - function topojson(data, format) { - var method, object, property, filter; - data = json(data, format); - - if (format && format.feature) { - method = feature; - property = format.feature; - } else if (format && format.mesh) { - method = mesh; - property = format.mesh; - filter = filters[format.filter]; - } else { - error('Missing TopoJSON feature or mesh parameter.'); - } - - object = (object = data.objects[property]) ? method(data, object, filter) : error('Invalid TopoJSON object: ' + property); - return object && object.features || [object]; - } - - topojson.responseType = 'json'; - var format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson - }; - - function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else { - return hasOwnProperty(format, name) ? format[name] : null; - } - } - - function responseType(type) { - var f = formats(type); - return f && f.responseType || 'text'; - } - - function memoize(method) { - var cache = {}; - return function (spec) { - return cache[spec] || (cache[spec] = method(spec)); - }; - } - - function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; - } - - function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function left(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 right(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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; - } - }; - } - - function ascendingComparator(f) { - return function (d, x) { - return ascending(f(d), x); - }; - } - - var ascendingBisect = bisector(ascending); - var bisectRight = ascendingBisect.right; - var bisectLeft = ascendingBisect.left; - - function variance(values, valueof) { - var count = 0; - var delta; - var mean = 0; - var sum = 0; - - if (valueof === undefined) { - var _iterator = _createForOfIteratorHelper(values), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var _value2 = _step.value; - - if (_value2 != null && (_value2 = +_value2) >= _value2) { - delta = _value2 - mean; - mean += delta / ++count; - sum += delta * (_value2 - mean); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } else { - var _index = -1; - - var _iterator2 = _createForOfIteratorHelper(values), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var _value3 = _step2.value; - - if ((_value3 = valueof(_value3, ++_index, values)) != null && (_value3 = +_value3) >= _value3) { - delta = _value3 - mean; - mean += delta / ++count; - sum += delta * (_value3 - mean); - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - - if (count > 1) return sum / (count - 1); - } - - function deviation(values, valueof) { - var v = variance(values, valueof); - return v ? Math.sqrt(v) : v; - } - - function sequence(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; - } - - var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - - function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - - while (++i < n) { - ticks[i] = (start + i) * step; - } - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - - while (++i < n) { - ticks[i] = (start - i) / step; - } - } - - if (reverse) ticks.reverse(); - return ticks; - } - - function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); - } - - function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10;else if (error >= e5) step1 *= 5;else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; - } - - function max(values, valueof) { - var max; - - if (valueof === undefined) { - var _iterator3 = _createForOfIteratorHelper(values), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var _value4 = _step3.value; - - if (_value4 != null && (max < _value4 || max === undefined && _value4 >= _value4)) { - max = _value4; - } - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - } else { - var _index2 = -1; - - var _iterator4 = _createForOfIteratorHelper(values), - _step4; - - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { - var _value5 = _step4.value; - - if ((_value5 = valueof(_value5, ++_index2, values)) != null && (max < _value5 || max === undefined && _value5 >= _value5)) { - max = _value5; - } - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - } - - return max; - } - - function min(values, valueof) { - var min; - - if (valueof === undefined) { - var _iterator5 = _createForOfIteratorHelper(values), - _step5; - - try { - for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { - var _value6 = _step5.value; - - if (_value6 != null && (min > _value6 || min === undefined && _value6 >= _value6)) { - min = _value6; - } - } - } catch (err) { - _iterator5.e(err); - } finally { - _iterator5.f(); - } - } else { - var _index3 = -1; - - var _iterator6 = _createForOfIteratorHelper(values), - _step6; - - try { - for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { - var _value7 = _step6.value; - - if ((_value7 = valueof(_value7, ++_index3, values)) != null && (min > _value7 || min === undefined && _value7 >= _value7)) { - min = _value7; - } - } - } catch (err) { - _iterator6.e(err); - } finally { - _iterator6.f(); - } - } - - return min; - } // Based on https://github.com/mourner/quickselect - // ISC license, Copyright 2018 Vladimir Agafonkin. - - - function quickselect(array, k) { - var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : array.length - 1; - var compare = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ascending; - - while (right > left) { - if (right - left > 600) { - var n = right - left + 1; - var m = k - left + 1; - var z = Math.log(n); - var s = 0.5 * Math.exp(2 * z / 3); - var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - - var t = array[k]; - var i = left; - var j = right; - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - - while (i < j) { - swap(array, i, j), ++i, --j; - - while (compare(array[i], t) < 0) { - ++i; - } - - while (compare(array[j], t) > 0) { - --j; - } - } - - if (compare(array[left], t) === 0) swap(array, left, j);else ++j, swap(array, j, right); - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - - return array; - } - - function swap(array, i, j) { - var t = array[i]; - array[i] = array[j]; - array[j] = t; - } - - function number(x) { - return x === null ? NaN : +x; - } - - function numbers(values, valueof) { - var _iterator7, _step7, _value8, _index4, _iterator8, _step8, _value9; - - return regeneratorRuntime.wrap(function numbers$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (!(valueof === undefined)) { - _context2.next = 21; - break; - } - - _iterator7 = _createForOfIteratorHelper(values); - _context2.prev = 2; - - _iterator7.s(); - - case 4: - if ((_step7 = _iterator7.n()).done) { - _context2.next = 11; - break; - } - - _value8 = _step7.value; - - if (!(_value8 != null && (_value8 = +_value8) >= _value8)) { - _context2.next = 9; - break; - } - - _context2.next = 9; - return _value8; - - case 9: - _context2.next = 4; - break; - - case 11: - _context2.next = 16; - break; - - case 13: - _context2.prev = 13; - _context2.t0 = _context2["catch"](2); - - _iterator7.e(_context2.t0); - - case 16: - _context2.prev = 16; - - _iterator7.f(); - - return _context2.finish(16); - - case 19: - _context2.next = 40; - break; - - case 21: - _index4 = -1; - _iterator8 = _createForOfIteratorHelper(values); - _context2.prev = 23; - - _iterator8.s(); - - case 25: - if ((_step8 = _iterator8.n()).done) { - _context2.next = 32; - break; - } - - _value9 = _step8.value; - - if (!((_value9 = valueof(_value9, ++_index4, values)) != null && (_value9 = +_value9) >= _value9)) { - _context2.next = 30; - break; - } - - _context2.next = 30; - return _value9; - - case 30: - _context2.next = 25; - break; - - case 32: - _context2.next = 37; - break; - - case 34: - _context2.prev = 34; - _context2.t1 = _context2["catch"](23); - - _iterator8.e(_context2.t1); - - case 37: - _context2.prev = 37; - - _iterator8.f(); - - return _context2.finish(37); - - case 40: - case "end": - return _context2.stop(); - } - } - }, _marked, null, [[2, 13, 16, 19], [23, 34, 37, 40]]); - } - - function quantile(values, p, valueof) { - values = Float64Array.from(numbers(values, valueof)); - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return min(values); - if (p >= 1) return max(values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), - value1 = min(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); - } - - function quantileSorted(values, p) { - var valueof = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : number; - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); - } - - function mean(values, valueof) { - var count = 0; - var sum = 0; - - if (valueof === undefined) { - var _iterator9 = _createForOfIteratorHelper(values), - _step9; - - try { - for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { - var _value10 = _step9.value; - - if (_value10 != null && (_value10 = +_value10) >= _value10) { - ++count, sum += _value10; - } - } - } catch (err) { - _iterator9.e(err); - } finally { - _iterator9.f(); - } - } else { - var _index5 = -1; - - var _iterator10 = _createForOfIteratorHelper(values), - _step10; - - try { - for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { - var _value11 = _step10.value; - - if ((_value11 = valueof(_value11, ++_index5, values)) != null && (_value11 = +_value11) >= _value11) { - ++count, sum += _value11; - } - } - } catch (err) { - _iterator10.e(err); - } finally { - _iterator10.f(); - } - } - - if (count) return sum / count; - } - - function median(values, valueof) { - return quantile(values, 0.5, valueof); - } - - function permute(source, keys) { - return Array.from(keys, function (key) { - return source[key]; - }); - } - - function sum(values, valueof) { - var sum = 0; - - if (valueof === undefined) { - var _iterator11 = _createForOfIteratorHelper(values), - _step11; - - try { - for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { - var _value12 = _step11.value; - - if (_value12 = +_value12) { - sum += _value12; - } - } - } catch (err) { - _iterator11.e(err); - } finally { - _iterator11.f(); - } - } else { - var _index6 = -1; - - var _iterator12 = _createForOfIteratorHelper(values), - _step12; - - try { - for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) { - var _value13 = _step12.value; - - if (_value13 = +valueof(_value13, ++_index6, values)) { - sum += _value13; - } - } - } catch (err) { - _iterator12.e(err); - } finally { - _iterator12.f(); - } - } - - return sum; - } // 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 undefined. - // For example, formatDecimal(1.23) returns ["123", 0]. - - - function formatDecimal(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - - var i, - coefficient = 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) : coefficient, +x.slice(i + 1)]; - } - - function exponent(x) { - return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; - } - - function formatGroup(grouping, thousands) { - return function (value, width) { - var i = value.length, - t = [], - j = 0, - g = grouping[0], - length = 0; - - while (i > 0 && g > 0) { - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (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 = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; - - function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; - return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] - }); - } - - formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof - - function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; - this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; - this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; - this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; - } - - FormatSpecifier.prototype.toString = function () { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + 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 = s.length, i = 1, i0 = -1, i1; i < n; ++i) { - switch (s[i]) { - case ".": - i0 = i1 = i; - break; - - case "0": - if (i0 === 0) i0 = i; - i1 = i; - break; - - default: - if (!+s[i]) break out; - if (i0 > 0) i0 = 0; - break; - } - } - - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; - } - - var prefixExponent; - - function formatPrefixAuto(x, p) { - var d = formatDecimal(x, p); - if (!d) return x + ""; - var coefficient = d[0], - exponent = d[1], - i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, - n = coefficient.length; - return i === 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 = formatDecimal(x, p); - if (!d) return x + ""; - var coefficient = d[0], - exponent = 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 = { - "%": function _(x, p) { - return (x * 100).toFixed(p); - }, - "b": function b(x) { - return Math.round(x).toString(2); - }, - "c": function c(x) { - return x + ""; - }, - "d": function d(x) { - return Math.round(x).toString(10); - }, - "e": function e(x, p) { - return x.toExponential(p); - }, - "f": function f(x, p) { - return x.toFixed(p); - }, - "g": function g(x, p) { - return x.toPrecision(p); - }, - "o": function o(x) { - return Math.round(x).toString(8); - }, - "p": function p(x, _p) { - return formatRounded(x * 100, _p); - }, - "r": formatRounded, - "s": formatPrefixAuto, - "X": function X(x) { - return Math.round(x).toString(16).toUpperCase(); - }, - "x": function x(_x9) { - return Math.round(_x9).toString(16); - } - }; - - function identity$2(x) { - return x; - } - - var map = Array.prototype.map, - prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; - - function d3_formatLocale(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? identity$2 : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), - currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", - currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", - decimal = locale.decimal === undefined ? "." : locale.decimal + "", - numerals = locale.numerals === undefined ? identity$2 : formatNumerals(map.call(locale.numerals, String)), - percent = locale.percent === undefined ? "%" : locale.percent + "", - minus = locale.minus === undefined ? "-" : locale.minus + "", - nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - - function newFormat(specifier) { - specifier = formatSpecifier(specifier); - var fill = specifier.fill, - align = specifier.align, - sign = specifier.sign, - symbol = specifier.symbol, - zero = specifier.zero, - width = specifier.width, - comma = specifier.comma, - precision = specifier.precision, - trim = specifier.trim, - type = specifier.type; // The "n" type is an alias for ",g". - - if (type === "n") comma = true, type = "g"; // The "" type, and any invalid type, is an alias for ".12~g". - else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g"; // If zero fill is specified, padding goes after sign and before digits. - - if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", - suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - - var formatType = formatTypes[type], - maybeSuffix = /[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 = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - - function format(value) { - var valuePrefix = prefix, - valueSuffix = suffix, - i, - n, - c; - - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; // Determine the sign. -0 is not less than 0, but 1 / -0 is! - - var valueNegative = value < 0 || 1 / value < 0; // Perform the initial formatting. - - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); // Trim insignificant zeros. - - if (trim) value = formatTrim(value); // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; // Compute the prefix and suffix. - - valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - - if (maybeSuffix) { - i = -1, n = value.length; - - while (++i < n) { - if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - } // If the fill character is not "0", grouping is applied before padding. - - - if (comma && !zero) value = group(value, Infinity); // Compute the padding. - - var length = valuePrefix.length + value.length + valueSuffix.length, - padding = length < width ? new Array(width - length + 1).join(fill) : ""; // If the fill character is "0", grouping is applied after padding. - - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; // Reconstruct the final output based on the desired alignment. - - switch (align) { - case "<": - value = valuePrefix + value + valueSuffix + padding; - break; - - case "=": - value = valuePrefix + padding + value + valueSuffix; - break; - - case "^": - value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); - break; - - default: - value = padding + valuePrefix + value + valueSuffix; - break; - } - - return numerals(value); - } - - format.toString = function () { - return specifier + ""; - }; - - return format; - } - - function formatPrefix(specifier, value) { - var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), - e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, - k = Math.pow(10, -e), - prefix = prefixes[8 + e / 3]; - return function (value) { - return f(k * value) + prefix; - }; - } - - return { - format: newFormat, - formatPrefix: formatPrefix - }; - } - - var locale; - var format$1; - var formatPrefix; - defaultLocale({ - decimal: ".", - thousands: ",", - grouping: [3], - currency: ["$", ""], - minus: "-" - }); - - function defaultLocale(definition) { - locale = d3_formatLocale(definition); - format$1 = locale.format; - formatPrefix = locale.formatPrefix; - return locale; - } - - function precisionFixed(step) { - return Math.max(0, -exponent(Math.abs(step))); - } - - function precisionPrefix(step, value) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); - } - - function precisionRound(step, max) { - step = Math.abs(step), max = Math.abs(max) - step; - return Math.max(0, exponent(max) - exponent(step)) + 1; - } - - function trimZeroes(numberFormat, decimalChar) { - return function (x) { - var str = numberFormat(x), - dec = str.indexOf(decimalChar), - idx, - end; - if (dec < 0) return str; - idx = rightmostDigit(str, dec); - end = idx < str.length ? str.slice(idx) : ''; - - while (--idx > dec) { - if (str[idx] !== '0') { - ++idx; - break; - } - } - - return str.slice(0, idx) + end; - }; - } - - function rightmostDigit(str, dec) { - var i = str.lastIndexOf('e'), - c; - if (i > 0) return i; - - for (i = str.length; --i > dec;) { - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit - } - } - - function numberLocale(locale) { - var format = memoize(locale.format), - formatPrefix = locale.formatPrefix; - return { - format: format, - formatPrefix: formatPrefix, - formatFloat: function formatFloat(spec) { - var s = formatSpecifier(spec || ','); - - if (s.precision == null) { - s.precision = 12; - - switch (s.type) { - case '%': - s.precision -= 2; - break; - - case 'e': - s.precision -= 1; - break; - } - - return trimZeroes(format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else { - return format(s); - } - }, - formatSpan: function formatSpan(start, stop, count, specifier) { - specifier = formatSpecifier(specifier == null ? ',f' : specifier); - var step = tickStep(start, stop, count), - value = Math.max(Math.abs(start), Math.abs(stop)); - var precision; - - if (specifier.precision == null) { - switch (specifier.type) { - case 's': - { - if (!isNaN(precision = precisionPrefix(step, value))) { - specifier.precision = precision; - } - - return formatPrefix(specifier, value); - } - - case '': - case 'e': - case 'g': - case 'p': - case 'r': - { - if (!isNaN(precision = precisionRound(step, value))) { - specifier.precision = precision - (specifier.type === 'e'); - } - - break; - } - - case 'f': - case '%': - { - if (!isNaN(precision = precisionFixed(step))) { - specifier.precision = precision - (specifier.type === '%') * 2; - } - - break; - } - } - } - - return format(specifier); - } - }; - } - - var defaultNumberLocale; - resetNumberFormatDefaultLocale(); - - function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: format$1, - formatPrefix: formatPrefix - }); - } - - function numberFormatLocale(definition) { - return numberLocale(d3_formatLocale(definition)); - } - - function numberFormatDefaultLocale(definition) { - return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale; - } - - var YEAR = 'year'; - var QUARTER = 'quarter'; - var MONTH = 'month'; - var WEEK = 'week'; - var DATE = 'date'; - var DAY = 'day'; - var DAYOFYEAR = 'dayofyear'; - var HOURS = 'hours'; - var MINUTES = 'minutes'; - var SECONDS = 'seconds'; - var MILLISECONDS = 'milliseconds'; - var TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS]; - var UNITS = TIME_UNITS.reduce(function (o, u, i) { - return o[u] = 1 + i, o; - }, {}); - - function timeUnits(units) { - var u = array(units).slice(), - m = {}; // check validity - - if (!u.length) error('Missing time unit.'); - u.forEach(function (unit) { - if (hasOwnProperty(UNITS, unit)) { - m[unit] = 1; - } else { - error("Invalid time unit: ".concat(unit, ".")); - } - }); - var numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0); - - if (numTypes > 1) { - error("Incompatible time units: ".concat(units)); - } // ensure proper sort order - - - u.sort(function (a, b) { - return UNITS[a] - UNITS[b]; - }); - return u; - } - - var defaultSpecifiers = (_defaultSpecifiers = {}, _defineProperty(_defaultSpecifiers, YEAR, '%Y '), _defineProperty(_defaultSpecifiers, QUARTER, 'Q%q '), _defineProperty(_defaultSpecifiers, MONTH, '%b '), _defineProperty(_defaultSpecifiers, DATE, '%d '), _defineProperty(_defaultSpecifiers, WEEK, 'W%U '), _defineProperty(_defaultSpecifiers, DAY, '%a '), _defineProperty(_defaultSpecifiers, DAYOFYEAR, '%j '), _defineProperty(_defaultSpecifiers, HOURS, '%H:00'), _defineProperty(_defaultSpecifiers, MINUTES, '00:%M'), _defineProperty(_defaultSpecifiers, SECONDS, ':%S'), _defineProperty(_defaultSpecifiers, MILLISECONDS, '.%L'), _defineProperty(_defaultSpecifiers, "".concat(YEAR, "-").concat(MONTH), '%Y-%m '), _defineProperty(_defaultSpecifiers, "".concat(YEAR, "-").concat(MONTH, "-").concat(DATE), '%Y-%m-%d '), _defineProperty(_defaultSpecifiers, "".concat(HOURS, "-").concat(MINUTES), '%H:%M'), _defaultSpecifiers); - - function timeUnitSpecifier(units, specifiers) { - var s = extend({}, defaultSpecifiers, specifiers), - u = timeUnits(units), - n = u.length; - var fmt = '', - start = 0, - end, - key; - - for (start = 0; start < n;) { - for (end = u.length; end > start; --end) { - key = u.slice(start, end).join('-'); - - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - } - - return fmt.trim(); - } - - var t0 = new Date(), - t1 = new Date(); - - function newInterval(floori, offseti, count, field) { - function interval(date) { - return floori(date = arguments.length === 0 ? new Date() : new Date(+date)), date; - } - - interval.floor = function (date) { - return floori(date = new Date(+date)), date; - }; - - interval.ceil = function (date) { - return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; - }; - - interval.round = function (date) { - var d0 = interval(date), - d1 = interval.ceil(date); - return date - d0 < d1 - date ? d0 : d1; - }; - - interval.offset = function (date, step) { - return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; - }; - - interval.range = function (start, stop, step) { - var range = [], - previous; - start = interval.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date - - do { - range.push(previous = new Date(+start)), offseti(start, step), floori(start); - } while (previous < start && start < stop); - - return range; - }; - - interval.filter = function (test) { - return newInterval(function (date) { - if (date >= date) while (floori(date), !test(date)) { - date.setTime(date - 1); - } - }, function (date, step) { - if (date >= date) { - if (step < 0) while (++step <= 0) { - while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty - - } else while (--step >= 0) { - while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty - - } - } - }); - }; - - if (count) { - interval.count = function (start, end) { - t0.setTime(+start), t1.setTime(+end); - floori(t0), floori(t1); - return Math.floor(count(t0, t1)); - }; - - interval.every = function (step) { - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function (d) { - return field(d) % step === 0; - } : function (d) { - return interval.count(0, d) % step === 0; - }); - }; - } - - return interval; - } - - var millisecond = 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 = function (k) { - k = 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 durationSecond = 1e3; - var durationMinute = 6e4; - var durationHour = 36e5; - var durationDay = 864e5; - var durationWeek = 6048e5; - var second = 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 minute = newInterval(function (date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond); - }, function (date, step) { - date.setTime(+date + step * durationMinute); - }, function (start, end) { - return (end - start) / durationMinute; - }, function (date) { - return date.getMinutes(); - }); - var hour = newInterval(function (date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute); - }, function (date, step) { - date.setTime(+date + step * durationHour); - }, function (start, end) { - return (end - start) / durationHour; - }, function (date) { - return date.getHours(); - }); - var day = 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; - }); - - 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.getTimezoneOffset()) * durationMinute) / durationWeek; - }); - } - - var sunday = weekday(0); - var monday = weekday(1); - var tuesday = weekday(2); - var wednesday = weekday(3); - var thursday = weekday(4); - var friday = weekday(5); - var saturday = weekday(6); - var month = 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.getFullYear()) * 12; - }, function (date) { - return date.getMonth(); - }); - var year = 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 = function (k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function (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 utcMinute = 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 utcHour = 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 utcDay = 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; - }); - - 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 = utcWeekday(0); - var utcMonday = utcWeekday(1); - var utcTuesday = utcWeekday(2); - var utcWednesday = utcWeekday(3); - var utcThursday = utcWeekday(4); - var utcFriday = utcWeekday(5); - var utcSaturday = utcWeekday(6); - var utcMonth = 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 utcYear = 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 = function (k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function (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 t0$1 = new Date(); - - function localYear(y) { - t0$1.setFullYear(y); - t0$1.setMonth(0); - t0$1.setDate(1); - t0$1.setHours(0, 0, 0, 0); - return t0$1; - } - - function dayofyear(d) { - return localDayOfYear(new Date(d)); - } - - function week(d) { - return localWeekNum(new Date(d)); - } - - function localDayOfYear(d) { - return day.count(localYear(d.getFullYear()) - 1, d); - } - - function localWeekNum(d) { - return sunday.count(localYear(d.getFullYear()) - 1, d); - } - - function localFirst(y) { - return localYear(y).getDay(); - } - - function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - - return new Date(y, m, d, H, M, S, L); - } - - function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); - } - - function utcweek(d) { - return utcWeekNum(new Date(d)); - } - - function utcDayOfYear(d) { - var y = Date.UTC(d.getUTCFullYear(), 0, 1); - return utcDay.count(y - 1, d); - } - - function utcWeekNum(d) { - var y = Date.UTC(d.getUTCFullYear(), 0, 1); - return utcSunday.count(y - 1, d); - } - - function utcFirst(y) { - t0$1.setTime(Date.UTC(y, 0, 1)); - return t0$1.getUTCDay(); - } - - function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - - return new Date(Date.UTC(y, m, d, H, M, S, L)); - } - - function floor(units, step, get, inv, newDate) { - var s = step || 1, - b = peek(units), - _ = function _(unit, p, key) { - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - - var t = new Date(), - u = toSet(units), - y = u[YEAR] ? _(YEAR) : constant(2012), - m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : zero, - d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one, - H = u[HOURS] ? _(HOURS) : zero, - M = u[MINUTES] ? _(MINUTES) : zero, - S = u[SECONDS] ? _(SECONDS) : zero, - L = u[MILLISECONDS] ? _(MILLISECONDS) : zero; - return function (v) { - t.setTime(+v); - var year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; - } - - function getUnit(f, inv, step, phase) { - var u = step <= 1 ? f : phase ? function (d, y) { - return phase + step * Math.floor((f(d, y) - phase) / step); - } : function (d, y) { - return step * Math.floor(f(d, y) / step); - }; - return inv ? function (d, y) { - return inv(u(d, y), y); - } : u; - } // returns the day of the year based on week number, day of week, - // and the day of the week for the first day of the year - - - function weekday$1(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; - } // -- LOCAL TIME -- - - - var localGet = (_localGet = {}, _defineProperty(_localGet, YEAR, function (d) { - return d.getFullYear(); - }), _defineProperty(_localGet, QUARTER, function (d) { - return Math.floor(d.getMonth() / 3); - }), _defineProperty(_localGet, MONTH, function (d) { - return d.getMonth(); - }), _defineProperty(_localGet, DATE, function (d) { - return d.getDate(); - }), _defineProperty(_localGet, HOURS, function (d) { - return d.getHours(); - }), _defineProperty(_localGet, MINUTES, function (d) { - return d.getMinutes(); - }), _defineProperty(_localGet, SECONDS, function (d) { - return d.getSeconds(); - }), _defineProperty(_localGet, MILLISECONDS, function (d) { - return d.getMilliseconds(); - }), _defineProperty(_localGet, DAYOFYEAR, function (d) { - return localDayOfYear(d); - }), _defineProperty(_localGet, WEEK, function (d) { - return localWeekNum(d); - }), _defineProperty(_localGet, WEEK + DAY, function (d, y) { - return weekday$1(localWeekNum(d), d.getDay(), localFirst(y)); - }), _defineProperty(_localGet, DAY, function (d, y) { - return weekday$1(1, d.getDay(), localFirst(y)); - }), _localGet); - var localInv = (_localInv = {}, _defineProperty(_localInv, QUARTER, function (q) { - return 3 * q; - }), _defineProperty(_localInv, WEEK, function (w, y) { - return weekday$1(w, 0, localFirst(y)); - }), _localInv); - - function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); - } // -- UTC TIME -- - - - var utcGet = (_utcGet = {}, _defineProperty(_utcGet, YEAR, function (d) { - return d.getUTCFullYear(); - }), _defineProperty(_utcGet, QUARTER, function (d) { - return Math.floor(d.getUTCMonth() / 3); - }), _defineProperty(_utcGet, MONTH, function (d) { - return d.getUTCMonth(); - }), _defineProperty(_utcGet, DATE, function (d) { - return d.getUTCDate(); - }), _defineProperty(_utcGet, HOURS, function (d) { - return d.getUTCHours(); - }), _defineProperty(_utcGet, MINUTES, function (d) { - return d.getUTCMinutes(); - }), _defineProperty(_utcGet, SECONDS, function (d) { - return d.getUTCSeconds(); - }), _defineProperty(_utcGet, MILLISECONDS, function (d) { - return d.getUTCMilliseconds(); - }), _defineProperty(_utcGet, DAYOFYEAR, function (d) { - return utcDayOfYear(d); - }), _defineProperty(_utcGet, WEEK, function (d) { - return utcWeekNum(d); - }), _defineProperty(_utcGet, DAY, function (d, y) { - return weekday$1(1, d.getUTCDay(), utcFirst(y)); - }), _defineProperty(_utcGet, WEEK + DAY, function (d, y) { - return weekday$1(utcWeekNum(d), d.getUTCDay(), utcFirst(y)); - }), _utcGet); - var utcInv = (_utcInv = {}, _defineProperty(_utcInv, QUARTER, function (q) { - return 3 * q; - }), _defineProperty(_utcInv, WEEK, function (w, y) { - return weekday$1(w, 0, utcFirst(y)); - }), _utcInv); - - function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); - } - - var timeIntervals = (_timeIntervals = {}, _defineProperty(_timeIntervals, YEAR, year), _defineProperty(_timeIntervals, QUARTER, month.every(3)), _defineProperty(_timeIntervals, MONTH, month), _defineProperty(_timeIntervals, WEEK, sunday), _defineProperty(_timeIntervals, DATE, day), _defineProperty(_timeIntervals, DAY, day), _defineProperty(_timeIntervals, DAYOFYEAR, day), _defineProperty(_timeIntervals, HOURS, hour), _defineProperty(_timeIntervals, MINUTES, minute), _defineProperty(_timeIntervals, SECONDS, second), _defineProperty(_timeIntervals, MILLISECONDS, millisecond), _timeIntervals); - var utcIntervals = (_utcIntervals = {}, _defineProperty(_utcIntervals, YEAR, utcYear), _defineProperty(_utcIntervals, QUARTER, utcMonth.every(3)), _defineProperty(_utcIntervals, MONTH, utcMonth), _defineProperty(_utcIntervals, WEEK, utcSunday), _defineProperty(_utcIntervals, DATE, utcDay), _defineProperty(_utcIntervals, DAY, utcDay), _defineProperty(_utcIntervals, DAYOFYEAR, utcDay), _defineProperty(_utcIntervals, HOURS, utcHour), _defineProperty(_utcIntervals, MINUTES, utcMinute), _defineProperty(_utcIntervals, SECONDS, second), _defineProperty(_utcIntervals, MILLISECONDS, millisecond), _utcIntervals); - - function timeInterval(unit) { - return timeIntervals[unit]; - } - - function utcInterval(unit) { - return utcIntervals[unit]; - } - - function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; - } - - function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); - } - - function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); - } - - function sequence$1(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; - } - - function timeSequence(unit, start, stop, step) { - return sequence$1(timeInterval(unit), start, stop, step); - } - - function utcSequence(unit, start, stop, step) { - return sequence$1(utcInterval(unit), start, stop, step); - } - - var durationSecond$1 = 1000, - durationMinute$1 = durationSecond$1 * 60, - durationHour$1 = durationMinute$1 * 60, - durationDay$1 = durationHour$1 * 24, - durationWeek$1 = durationDay$1 * 7, - durationMonth = durationDay$1 * 30, - durationYear = durationDay$1 * 365; - var Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], - Seconds = Milli.slice(0, -1), - Minutes = Seconds.slice(0, -1), - Hours = Minutes.slice(0, -1), - Day = Hours.slice(0, -1), - Week = [YEAR, WEEK], - Month = [YEAR, MONTH], - Year = [YEAR]; - var intervals = [[Seconds, 1, durationSecond$1], [Seconds, 5, 5 * durationSecond$1], [Seconds, 15, 15 * durationSecond$1], [Seconds, 30, 30 * durationSecond$1], [Minutes, 1, durationMinute$1], [Minutes, 5, 5 * durationMinute$1], [Minutes, 15, 15 * durationMinute$1], [Minutes, 30, 30 * durationMinute$1], [Hours, 1, durationHour$1], [Hours, 3, 3 * durationHour$1], [Hours, 6, 6 * durationHour$1], [Hours, 12, 12 * durationHour$1], [Day, 1, durationDay$1], [Week, 1, durationWeek$1], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]]; - - function timeBin(opt) { - var ext = opt.extent, - max = opt.maxbins || 40, - target = Math.abs(span(ext)) / max; - var i = bisector(function (i) { - return i[2]; - }).right(intervals, target), - units, - step; - - if (i === intervals.length) { - units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max); - } else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max(tickStep(ext[0], ext[1], max), 1); - } - - return { - units: units, - step: step - }; - } - - function localDate$1(d) { - if (0 <= d.y && d.y < 100) { - var date = 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$1(d) { - if (0 <= d.y && d.y < 100) { - var date = 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 newDate(y, m, d) { - return { - y: y, - m: m, - d: d, - H: 0, - M: 0, - S: 0, - L: 0 - }; - } - - function formatLocale(locale) { - var locale_dateTime = locale.dateTime, - locale_date = locale.date, - locale_time = locale.time, - locale_periods = locale.periods, - locale_weekdays = locale.days, - locale_shortWeekdays = locale.shortDays, - locale_months = locale.months, - locale_shortMonths = locale.shortMonths; - var periodRe = formatRe(locale_periods), - periodLookup = formatLookup(locale_periods), - weekdayRe = formatRe(locale_weekdays), - weekdayLookup = formatLookup(locale_weekdays), - shortWeekdayRe = formatRe(locale_shortWeekdays), - shortWeekdayLookup = formatLookup(locale_shortWeekdays), - monthRe = formatRe(locale_months), - monthLookup = formatLookup(locale_months), - shortMonthRe = formatRe(locale_shortMonths), - shortMonthLookup = formatLookup(locale_shortMonths); - var formats = { - "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": formatQuarter, - "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 = { - "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": formatUTCQuarter, - "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 = { - "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": parseQuarter, - "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 = newFormat(locale_date, formats); - formats.X = newFormat(locale_time, formats); - formats.c = newFormat(locale_dateTime, formats); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - - function newFormat(specifier, formats) { - return function (date) { - var string = [], - i = -1, - j = 0, - n = specifier.length, - c, - pad, - format; - if (!(date instanceof Date)) date = new Date(+date); - - while (++i < n) { - if (specifier.charCodeAt(i) === 37) { - string.push(specifier.slice(j, i)); - if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);else pad = c === "e" ? " " : "0"; - if (format = formats[c]) c = format(date, pad); - string.push(c); - j = i + 1; - } - } - - string.push(specifier.slice(j, i)); - return string.join(""); - }; - } - - function newParse(specifier, Z) { - return function (string) { - var d = newDate(1900, undefined, 1), - i = parseSpecifier(d, specifier, string += "", 0), - week, - day$1; - if (i != string.length) return null; // If a UNIX timestamp is specified, return it. - - if ("Q" in d) return new Date(d.Q); - if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); // If this is utcParse, never use the local timezone. - - if (Z && !("Z" in d)) d.Z = 0; // The am-pm flag is 0 for AM, and 1 for PM. - - if ("p" in d) d.H = d.H % 12 + d.p * 12; // If the month was not specified, inherit from the quarter. - - if (d.m === undefined) d.m = "q" in d ? d.q : 0; // 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 = 1; - - if ("Z" in d) { - week = utcDate$1(newDate(d.y, 0, 1)), day$1 = week.getUTCDay(); - week = day$1 > 4 || day$1 === 0 ? utcMonday.ceil(week) : utcMonday(week); - week = utcDay.offset(week, (d.V - 1) * 7); - d.y = week.getUTCFullYear(); - d.m = week.getUTCMonth(); - d.d = week.getUTCDate() + (d.w + 6) % 7; - } else { - week = localDate$1(newDate(d.y, 0, 1)), day$1 = week.getDay(); - week = day$1 > 4 || day$1 === 0 ? monday.ceil(week) : monday(week); - week = day.offset(week, (d.V - 1) * 7); - d.y = week.getFullYear(); - d.m = week.getMonth(); - d.d = week.getDate() + (d.w + 6) % 7; - } - } else if ("W" in d || "U" in d) { - if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; - day$1 = "Z" in d ? utcDate$1(newDate(d.y, 0, 1)).getUTCDay() : localDate$1(newDate(d.y, 0, 1)).getDay(); - d.m = 0; - d.d = "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 += d.Z / 100 | 0; - d.M += d.Z % 100; - return utcDate$1(d); - } // Otherwise, all fields are in local time. - - - return localDate$1(d); - }; - } - - function parseSpecifier(d, specifier, string, j) { - var i = 0, - n = specifier.length, - m = string.length, - c, - parse; - - while (i < n) { - if (j >= m) return -1; - c = specifier.charCodeAt(i++); - - if (c === 37) { - c = specifier.charAt(i++); - parse = parses[c in pads ? specifier.charAt(i++) : c]; - if (!parse || (j = parse(d, string, j)) < 0) return -1; - } else if (c != string.charCodeAt(j++)) { - return -1; - } - } - - return j; - } - - function parsePeriod(d, string, i) { - var n = periodRe.exec(string.slice(i)); - return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseShortWeekday(d, string, i) { - var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseWeekday(d, string, i) { - var n = weekdayRe.exec(string.slice(i)); - return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseShortMonth(d, string, i) { - var n = shortMonthRe.exec(string.slice(i)); - return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseMonth(d, string, i) { - var n = monthRe.exec(string.slice(i)); - return n ? (d.m = 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() >= 12)]; - } - - function formatQuarter(d) { - return 1 + ~~(d.getMonth() / 3); - } - - 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() >= 12)]; - } - - function formatUTCQuarter(d) { - return 1 + ~~(d.getUTCMonth() / 3); - } - - return { - format: function format(specifier) { - var f = newFormat(specifier += "", formats); - - f.toString = function () { - return specifier; - }; - - return f; - }, - parse: function parse(specifier) { - var p = newParse(specifier += "", false); - - p.toString = function () { - return specifier; - }; - - return p; - }, - utcFormat: function utcFormat(specifier) { - var f = newFormat(specifier += "", utcFormats); - - f.toString = function () { - return specifier; - }; - - return f; - }, - utcParse: function utcParse(specifier) { - var p = newParse(specifier += "", true); - - p.toString = function () { - return specifier; - }; - - return p; - } - }; - } - - var pads = { - "-": "", - "_": " ", - "0": "0" - }, - numberRe = /^\s*\d+/, - // note: ignores next directive - percentRe = /^%/, - requoteRe = /[\\^$*+?|[\]().{}]/g; - - function pad$2(value, fill, width) { - var sign = value < 0 ? "-" : "", - string = (sign ? -value : value) + "", - length = 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 = {}, - i = -1, - n = names.length; - - while (++i < n) { - map[names[i].toLowerCase()] = i; - } - - return map; - } - - function parseWeekdayNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.w = +n[0], i + n[0].length) : -1; - } - - function parseWeekdayNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.u = +n[0], i + n[0].length) : -1; - } - - function parseWeekNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.U = +n[0], i + n[0].length) : -1; - } - - function parseWeekNumberISO(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.V = +n[0], i + n[0].length) : -1; - } - - function parseWeekNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.W = +n[0], i + n[0].length) : -1; - } - - function parseFullYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 4)); - return n ? (d.y = +n[0], i + n[0].length) : -1; - } - - function parseYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; - } - - function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); - return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; - } - - function parseQuarter(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; - } - - function parseMonthNumber(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.m = n[0] - 1, i + n[0].length) : -1; - } - - function parseDayOfMonth(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.d = +n[0], i + n[0].length) : -1; - } - - function parseDayOfYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; - } - - function parseHour24(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.H = +n[0], i + n[0].length) : -1; - } - - function parseMinutes(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.M = +n[0], i + n[0].length) : -1; - } - - function parseSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.S = +n[0], i + n[0].length) : -1; - } - - function parseMilliseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.L = +n[0], i + n[0].length) : -1; - } - - function parseMicroseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 6)); - return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; - } - - function parseLiteralPercent(d, string, i) { - var n = percentRe.exec(string.slice(i, i + 1)); - return n ? i + n[0].length : -1; - } - - function parseUnixTimestamp(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.Q = +n[0], i + n[0].length) : -1; - } - - function parseUnixTimestampSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.s = +n[0], i + n[0].length) : -1; - } - - function formatDayOfMonth(d, p) { - return pad$2(d.getDate(), p, 2); - } - - function formatHour24(d, p) { - return pad$2(d.getHours(), p, 2); - } - - function formatHour12(d, p) { - return pad$2(d.getHours() % 12 || 12, p, 2); - } - - function formatDayOfYear(d, p) { - return pad$2(1 + day.count(year(d), d), p, 3); - } - - function formatMilliseconds(d, p) { - return pad$2(d.getMilliseconds(), p, 3); - } - - function formatMicroseconds(d, p) { - return formatMilliseconds(d, p) + "000"; - } - - function formatMonthNumber(d, p) { - return pad$2(d.getMonth() + 1, p, 2); - } - - function formatMinutes(d, p) { - return pad$2(d.getMinutes(), p, 2); - } - - function formatSeconds(d, p) { - return pad$2(d.getSeconds(), p, 2); - } - - function formatWeekdayNumberMonday(d) { - var day = d.getDay(); - return day === 0 ? 7 : day; - } - - function formatWeekNumberSunday(d, p) { - return pad$2(sunday.count(year(d) - 1, d), p, 2); - } - - function formatWeekNumberISO(d, p) { - var day = d.getDay(); - d = day >= 4 || day === 0 ? thursday(d) : thursday.ceil(d); - return pad$2(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2); - } - - function formatWeekdayNumberSunday(d) { - return d.getDay(); - } - - function formatWeekNumberMonday(d, p) { - return pad$2(monday.count(year(d) - 1, d), p, 2); - } - - function formatYear$1(d, p) { - return pad$2(d.getFullYear() % 100, p, 2); - } - - function formatFullYear(d, p) { - return pad$2(d.getFullYear() % 10000, p, 4); - } - - function formatZone(d) { - var z = d.getTimezoneOffset(); - return (z > 0 ? "-" : (z *= -1, "+")) + pad$2(z / 60 | 0, "0", 2) + pad$2(z % 60, "0", 2); - } - - function formatUTCDayOfMonth(d, p) { - return pad$2(d.getUTCDate(), p, 2); - } - - function formatUTCHour24(d, p) { - return pad$2(d.getUTCHours(), p, 2); - } - - function formatUTCHour12(d, p) { - return pad$2(d.getUTCHours() % 12 || 12, p, 2); - } - - function formatUTCDayOfYear(d, p) { - return pad$2(1 + utcDay.count(utcYear(d), d), p, 3); - } - - function formatUTCMilliseconds(d, p) { - return pad$2(d.getUTCMilliseconds(), p, 3); - } - - function formatUTCMicroseconds(d, p) { - return formatUTCMilliseconds(d, p) + "000"; - } - - function formatUTCMonthNumber(d, p) { - return pad$2(d.getUTCMonth() + 1, p, 2); - } - - function formatUTCMinutes(d, p) { - return pad$2(d.getUTCMinutes(), p, 2); - } - - function formatUTCSeconds(d, p) { - return pad$2(d.getUTCSeconds(), p, 2); - } - - function formatUTCWeekdayNumberMonday(d) { - var dow = d.getUTCDay(); - return dow === 0 ? 7 : dow; - } - - function formatUTCWeekNumberSunday(d, p) { - return pad$2(utcSunday.count(utcYear(d) - 1, d), p, 2); - } - - function formatUTCWeekNumberISO(d, p) { - var day = d.getUTCDay(); - d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); - return pad$2(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); - } - - function formatUTCWeekdayNumberSunday(d) { - return d.getUTCDay(); - } - - function formatUTCWeekNumberMonday(d, p) { - return pad$2(utcMonday.count(utcYear(d) - 1, d), p, 2); - } - - function formatUTCYear(d, p) { - return pad$2(d.getUTCFullYear() % 100, p, 2); - } - - function formatUTCFullYear(d, p) { - return pad$2(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; - var timeFormat; - var timeParse; - var utcFormat; - var utcParse; - 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", "Sep", "Oct", "Nov", "Dec"] - }); - - function defaultLocale$1(definition) { - locale$1 = formatLocale(definition); - timeFormat = locale$1.format; - timeParse = locale$1.parse; - utcFormat = locale$1.utcFormat; - utcParse = locale$1.utcParse; - return locale$1; - } - - function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - - if (!isObject(spec)) { - error("Invalid time multi-format specifier: ".concat(spec)); - } - - var second = interval(SECONDS), - minute = interval(MINUTES), - hour = interval(HOURS), - day = interval(DATE), - week = interval(WEEK), - month = interval(MONTH), - quarter = interval(QUARTER), - year = interval(YEAR), - L = format(spec[MILLISECONDS] || '.%L'), - S = format(spec[SECONDS] || ':%S'), - M = format(spec[MINUTES] || '%I:%M'), - H = format(spec[HOURS] || '%I %p'), - d = format(spec[DATE] || spec[DAY] || '%a %d'), - w = format(spec[WEEK] || '%b %d'), - m = format(spec[MONTH] || '%B'), - q = format(spec[QUARTER] || '%B'), - y = format(spec[YEAR] || '%Y'); - return function (date) { - return (second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date); - }; - } - - function timeLocale(locale) { - var _timeFormat = memoize(locale.format), - _utcFormat = memoize(locale.utcFormat); - - return { - timeFormat: function timeFormat(spec) { - return isString(spec) ? _timeFormat(spec) : timeMultiFormat(_timeFormat, timeInterval, spec); - }, - utcFormat: function utcFormat(spec) { - return isString(spec) ? _utcFormat(spec) : timeMultiFormat(_utcFormat, utcInterval, spec); - }, - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; - } - - var defaultTimeLocale; - resetTimeFormatDefaultLocale(); - - function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: timeFormat, - parse: timeParse, - utcFormat: utcFormat, - utcParse: utcParse - }); - } - - function timeFormatLocale(definition) { - return timeLocale(formatLocale(definition)); - } - - function timeFormatDefaultLocale(definition) { - return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale; - } - - var createLocale = function createLocale(number, time) { - return extend({}, number, time); - }; - - function locale$2(numberSpec, timeSpec) { - var number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); - var time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); - return createLocale(number, time); - } - - function defaultLocale$2(numberSpec, timeSpec) { - var args = arguments.length; - - if (args && args !== 2) { - error('defaultLocale expects either zero or two arguments.'); - } - - return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); - } - - function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale$2(); - } - - function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - var reader = formats(schema.type || 'json'); - if (!reader) error('Unknown data format type: ' + schema.type); - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - if (hasOwnProperty(data, 'columns')) delete data.columns; - return data; - } - - function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - - var locale = timeFormatDefaultLocale(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - var fields = data.columns || Object.keys(data[0]), - parsers, - datum, - field, - i, - j, - n, - m; - if (types === 'auto') types = inferTypes(data, fields); - fields = Object.keys(types); - parsers = fields.map(function (field) { - var type = types[field], - parts, - pattern; - - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - - pattern = parts[1]; - - if (pattern[0] === '\'' && pattern[pattern.length - 1] === '\'' || pattern[0] === '"' && pattern[pattern.length - 1] === '"') { - pattern = pattern.slice(1, -1); - } - - var _parse = parts[0] === 'utc' ? utcParser : timeParser; - - return _parse(pattern); - } - - if (!typeParsers[type]) { - throw Error('Illegal format pattern: ' + field + ':' + type); - } - - return typeParsers[type]; - }); - - for (i = 0, n = data.length, m = fields.length; i < n; ++i) { - datum = data[i]; - - for (j = 0; j < m; ++j) { - field = fields[j]; - datum[field] = parsers[j](datum[field]); - } - } - } - - var loader = loaderFactory(typeof fetch !== 'undefined' && fetch, // use built-in fetch API - null // no file system access - ); - - function parse$1(data, format) { - var locale = this.locale(); - return read(data, format, locale.timeParse, locale.utcParse); - } - /** - * Ingests new data into the dataflow. First parses the data using the - * vega-loader read method, then pulses a changeset to the target operator. - * @param {Operator} target - The Operator to target with ingested data, - * typically a Collect transform instance. - * @param {*} data - The input data, prior to parsing. For JSON this may - * be a string or an object. For CSV, TSV, etc should be a string. - * @param {object} format - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @returns {Dataflow} - */ - - - function ingest$1(target, data, format) { - data = this.parse(data, format); - return this.pulse(target, this.changeset().insert(data)); - } - /** - * Request data from an external source, parse it, and return a Promise. - * @param {string} url - The URL from which to load the data. This string - * is passed to the vega-loader load method. - * @param {object} [format] - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @return {Promise} A Promise that resolves upon completion of the request. - * The resolved object contains the following properties: - * - data: an array of parsed data (or null upon error) - * - status: a code for success (0), load fail (-1), or parse fail (-2) - */ - - - function request(_x10, _x11) { - return _request.apply(this, arguments); - } - - function _request() { - _request = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(url, format) { - var df, status, data; - return regeneratorRuntime.wrap(function _callee8$(_context15) { - while (1) { - switch (_context15.prev = _context15.next) { - case 0: - df = this; - status = 0; - _context15.prev = 2; - _context15.next = 5; - return df.loader().load(url, { - context: 'dataflow', - response: responseType(format && format.type) - }); - - case 5: - data = _context15.sent; - - try { - data = df.parse(data, format); - } catch (err) { - status = -2; - df.warn('Data ingestion failed', url, err); - } - - _context15.next = 13; - break; - - case 9: - _context15.prev = 9; - _context15.t0 = _context15["catch"](2); - status = -1; - df.warn('Loading failed', url, _context15.t0); - - case 13: - return _context15.abrupt("return", { - data: data, - status: status - }); - - case 14: - case "end": - return _context15.stop(); - } - } - }, _callee8, this, [[2, 9]]); - })); - return _request.apply(this, arguments); - } - - function preload(_x12, _x13, _x14) { - return _preload.apply(this, arguments); - } - - function _preload() { - _preload = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(target, url, format) { - var df, pending, res; - return regeneratorRuntime.wrap(function _callee9$(_context16) { - while (1) { - switch (_context16.prev = _context16.next) { - case 0: - df = this, pending = df._pending || loadPending(df); - pending.requests += 1; - _context16.next = 4; - return df.request(url, format); - - case 4: - res = _context16.sent; - df.pulse(target, df.changeset().remove(truthy).insert(res.data || [])); - pending.done(); - return _context16.abrupt("return", res); - - case 8: - case "end": - return _context16.stop(); - } - } - }, _callee9, this); - })); - return _preload.apply(this, arguments); - } - - function loadPending(df) { - var pending = new Promise(function (a) { - accept = a; - }), - accept; - pending.requests = 0; - - pending.done = function () { - if (--pending.requests === 0) { - df._pending = null; - accept(df); - } - }; - - return df._pending = pending; - } - - var SKIP$1 = { - skip: true - }; - /** - * Perform operator updates in response to events. Applies an - * update function to compute a new operator value. If the update function - * returns a {@link ChangeSet}, the operator will be pulsed with those tuple - * changes. Otherwise, the operator value will be updated to the return value. - * @param {EventStream|Operator} source - The event source to react to. - * This argument can be either an EventStream or an Operator. - * @param {Operator|function(object):Operator} target - The operator to update. - * This argument can either be an Operator instance or (if the source - * argument is an EventStream), a function that accepts an event object as - * input and returns an Operator to target. - * @param {function(Parameters,Event): *} [update] - Optional update function - * to compute the new operator value, or a literal value to set. Update - * functions expect to receive a parameter object and event as arguments. - * This function can either return a new operator value or (if the source - * argument is an EventStream) a {@link ChangeSet} instance to pulse - * the target operator with tuple changes. - * @param {object} [params] - The update function parameters. - * @param {object} [options] - Additional options hash. If not overridden, - * updated operators will be skipped by default. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @return {Dataflow} - */ - - function on(source, target, update, params, options) { - var fn = source instanceof Operator ? onOperator : onStream; - fn(this, source, target, update, params, options); - return this; - } - - function onStream(df, stream, target, update, params, options) { - var opt = extend({}, options, SKIP$1), - func, - op; - if (!isFunction(target)) target = constant(target); - - if (update === undefined) { - func = function func(e) { - return df.touch(target(e)); - }; - } else if (isFunction(update)) { - op = new Operator(null, update, params, false); - - func = function func(e) { - op.evaluate(e); - var t = target(e), - v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else { - func = function func(e) { - return df.update(target(e), update, opt); - }; - } - - stream.apply(func); - } - - function onOperator(df, source, target, update, params, options) { - if (update === undefined) { - source.targets().add(target); - } else { - var opt = options || {}, - op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - - source.targets().add(op); // add dependency - - if (target) { - op.skip(true); // skip first invocation - - op.value = target.value; // initialize value - - op.targets().add(target); // chain dependencies - - df.connect(target, [op]); // rerank as needed, #1672 - } - } - } - - function updater(target, update) { - update = isFunction(update) ? update : constant(update); - return target ? function (_, pulse) { - var value = update(_, pulse); - - if (!target.skip()) { - target.skip(value !== this.value).value = value; - } - - return value; - } : update; - } - /** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ - - - function rank(op) { - op.rank = ++this._rank; - } - /** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ - - - function rerank(op) { - var queue = [op], - cur, - list, - i; - - while (queue.length) { - this.rank(cur = queue.pop()); - - if (list = cur._targets) { - for (i = list.length; --i >= 0;) { - queue.push(cur = list[i]); - if (cur === op) error('Cycle detected in dataflow graph.'); - } - } - } - } - /** - * Sentinel value indicating pulse propagation should stop. - */ - - - var StopPropagation = {}; // Pulse visit type flags - - var ADD = 1 << 0, - REM = 1 << 1, - MOD = 1 << 2, - ADD_REM = ADD | REM, - ADD_MOD = ADD | MOD, - ALL = ADD | REM | MOD, - REFLOW = 1 << 3, - SOURCE = 1 << 4, - NO_SOURCE = 1 << 5, - NO_FIELDS = 1 << 6; - /** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ - - function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; - } - - var prototype$3 = Pulse.prototype; - /** - * Sentinel value indicating pulse propagation should stop. - */ - - prototype$3.StopPropagation = StopPropagation; - /** - * Boolean flag indicating ADD (added) tuples. - */ - - prototype$3.ADD = ADD; - /** - * Boolean flag indicating REM (removed) tuples. - */ - - prototype$3.REM = REM; - /** - * Boolean flag indicating MOD (modified) tuples. - */ - - prototype$3.MOD = MOD; - /** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ - - prototype$3.ADD_REM = ADD_REM; - /** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ - - prototype$3.ADD_MOD = ADD_MOD; - /** - * Boolean flag indicating ADD, REM and MOD tuples. - */ - - prototype$3.ALL = ALL; - /** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ - - prototype$3.REFLOW = REFLOW; - /** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ - - prototype$3.SOURCE = SOURCE; - /** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ - - prototype$3.NO_SOURCE = NO_SOURCE; - /** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ - - prototype$3.NO_FIELDS = NO_FIELDS; - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ - - prototype$3.fork = function (flags) { - return new Pulse(this.dataflow).init(this, flags); - }; - /** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ - - - prototype$3.clone = function () { - var p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); - }; - /** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ - - - prototype$3.addAll = function () { - var p = this; - - if (!p.source || p.source.length === p.add.length) { - return p; - } else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - return p; - } - }; - /** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ - - - prototype$3.init = function (src, flags) { - var p = this; - p.stamp = src.stamp; - p.encode = src.encode; - - if (src.fields && !(flags & NO_FIELDS)) { - p.fields = src.fields; - } - - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - - return p; - }; - /** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ - - - prototype$3.runAfter = function (func) { - this.dataflow.runAfter(func); - }; - /** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ - - - prototype$3.changed = function (flags) { - var f = flags || ALL; - return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length; - }; - /** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ - - - prototype$3.reflow = function (fork) { - if (fork) return this.fork(ALL).reflow(); - var len = this.add.length, - src = this.source && this.source.length; - - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); - } - - return this; - }; - /** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ - - - prototype$3.clean = function (value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else { - return this.cleans; - } - }; - /** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ - - - prototype$3.modifies = function (_) { - var hash = this.fields || (this.fields = {}); - - if (isArray(_)) { - _.forEach(function (f) { - return hash[f] = true; - }); - } else { - hash[_] = true; - } - - return this; - }; - /** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ - - - prototype$3.modified = function (_, nomod) { - var fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : isArray(_) ? _.some(function (f) { - return fields[f]; - }) : fields[_]; - }; - /** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ - - - prototype$3.filter = function (flags, filter) { - var p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; - }; - - function addFilter(a, b) { - return a ? function (t, i) { - return a(t, i) && b(t, i); - } : b; - } - /** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ - - - prototype$3.materialize = function (flags) { - flags = flags || ALL; - var p = this; - - if (flags & ADD && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - - if (flags & REM && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - - if (flags & MOD && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - - if (flags & SOURCE && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - - return p; - }; - - function materialize(data, filter) { - var out = []; - visitArray(data, filter, function (_) { - return out.push(_); - }); - return out; - } - - function filter(pulse, flags) { - var map = {}; - pulse.visit(flags, function (t) { - map[tupleid(t)] = 1; - }); - return function (t) { - return map[tupleid(t)] ? null : t; - }; - } - /** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ - - - prototype$3.visit = function (flags, visitor) { - var p = this, - v = visitor, - src, - sum; - - if (flags & SOURCE) { - visitArray(p.source, p.srcF, v); - return p; - } - - if (flags & ADD) visitArray(p.add, p.addF, v); - if (flags & REM) visitArray(p.rem, p.remF, v); - if (flags & MOD) visitArray(p.mod, p.modF, v); - - if (flags & REFLOW && (src = p.source)) { - sum = p.add.length + p.mod.length; - if (sum === src.length) ;else if (sum) { - visitArray(src, filter(p, ADD_MOD), v); - } else { - // if no add/rem/mod tuples, visit source - visitArray(src, p.srcF, v); - } - } - - return p; - }; - /** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array} pulses - The sub-pulses for this multi-pulse. - */ - - - function MultiPulse(dataflow, stamp, pulses, encode) { - var p = this, - c = 0, - pulse, - hash, - i, - n, - f; - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - - for (i = 0, n = pulses.length; i < n; ++i) { - pulse = pulses[i]; - if (pulse.stamp !== stamp) continue; - - if (pulse.fields) { - hash = p.fields || (p.fields = {}); - - for (f in pulse.fields) { - hash[f] = 1; - } - } - - if (pulse.changed(p.ADD)) c |= p.ADD; - if (pulse.changed(p.REM)) c |= p.REM; - if (pulse.changed(p.MOD)) c |= p.MOD; - } - - this.changes = c; - } - - var prototype$4 = inherits(MultiPulse, Pulse); - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - */ - - prototype$4.fork = function (flags) { - var p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); - - if (flags !== undefined) { - if (flags & p.ADD) { - this.visit(p.ADD, function (t) { - return p.add.push(t); - }); - } - - if (flags & p.REM) { - this.visit(p.REM, function (t) { - return p.rem.push(t); - }); - } - - if (flags & p.MOD) { - this.visit(p.MOD, function (t) { - return p.mod.push(t); - }); - } - } - - return p; - }; - - prototype$4.changed = function (flags) { - return this.changes & flags; - }; - - prototype$4.modified = function (_) { - var p = this, - fields = p.fields; - return !(fields && p.changes & p.MOD) ? 0 : isArray(_) ? _.some(function (f) { - return fields[f]; - }) : fields[_]; - }; - - prototype$4.filter = function () { - error('MultiPulse does not support filtering.'); - }; - - prototype$4.materialize = function () { - error('MultiPulse does not support materialization.'); - }; - - prototype$4.visit = function (flags, visitor) { - var p = this, - pulses = p.pulses, - n = pulses.length, - i = 0; - - if (flags & p.SOURCE) { - for (; i < n; ++i) { - pulses[i].visit(flags, visitor); - } - } else { - for (; i < n; ++i) { - if (pulses[i].stamp === p.stamp) { - pulses[i].visit(flags, visitor); - } - } - } - - return p; - }; - /* eslint-disable require-atomic-updates */ - - /** - * Evaluates the dataflow and returns a Promise that resolves when pulse - * propagation completes. This method will increment the current timestamp - * and process all updated, pulsed and touched operators. When invoked for - * the first time, all registered operators will be processed. This method - * should not be invoked by third-party clients, use {@link runAsync} or - * {@link run} instead. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ - - - function evaluate(_x15, _x16, _x17) { - return _evaluate.apply(this, arguments); - } - /** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ - - - function _evaluate() { - _evaluate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(encode, prerun, postrun) { - var df, async, stamp, count, op, next, error, pr, i; - return regeneratorRuntime.wrap(function _callee10$(_context17) { - while (1) { - switch (_context17.prev = _context17.next) { - case 0: - df = this, async = []; // if the pulse value is set, this is a re-entrant call - - if (!df._pulse) { - _context17.next = 3; - break; - } - - return _context17.abrupt("return", reentrant(df)); - - case 3: - if (!df._pending) { - _context17.next = 6; - break; - } - - _context17.next = 6; - return df._pending; - - case 6: - if (!prerun) { - _context17.next = 9; - break; - } - - _context17.next = 9; - return asyncCallback(df, prerun); - - case 9: - if (df._touched.length) { - _context17.next = 12; - break; - } - - df.debug('Dataflow invoked, but nothing to do.'); - return _context17.abrupt("return", df); - - case 12: - // increment timestamp clock - stamp = ++df._clock; // set the current pulse - - df._pulse = new Pulse(df, stamp, encode); // initialize priority queue, reset touched operators - - df._touched.forEach(function (op) { - return df._enqueue(op, true); - }); - - df._touched = UniqueList(id); - count = 0; - _context17.prev = 17; - - case 18: - if (!(df._heap.size() > 0)) { - _context17.next = 35; - break; - } - - // dequeue operator with highest priority - op = df._heap.pop(); // re-queue if rank changed - - if (!(op.rank !== op.qrank)) { - _context17.next = 23; - break; - } - - df._enqueue(op, true); - - return _context17.abrupt("continue", 18); - - case 23: - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - - if (!next.then) { - _context17.next = 30; - break; - } - - _context17.next = 27; - return next; - - case 27: - next = _context17.sent; - _context17.next = 31; - break; - - case 30: - if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - - case 31: - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach(function (op) { - return df._enqueue(op); - }); - } // increment visit counter - - - ++count; - _context17.next = 18; - break; - - case 35: - _context17.next = 41; - break; - - case 37: - _context17.prev = 37; - _context17.t0 = _context17["catch"](17); - - df._heap.clear(); - - error = _context17.t0; - - case 41: - // reset pulse map - df._input = {}; - df._pulse = null; - df.debug("Pulse ".concat(stamp, ": ").concat(count, " operators")); - - if (error) { - df._postrun = []; - df.error(error); - } // invoke callbacks queued via runAfter - - - if (!df._postrun.length) { - _context17.next = 55; - break; - } - - pr = df._postrun.sort(function (a, b) { - return b.priority - a.priority; - }); - df._postrun = []; - i = 0; - - case 49: - if (!(i < pr.length)) { - _context17.next = 55; - break; - } - - _context17.next = 52; - return asyncCallback(df, pr[i].callback); - - case 52: - ++i; - _context17.next = 49; - break; - - case 55: - if (!postrun) { - _context17.next = 58; - break; - } - - _context17.next = 58; - return asyncCallback(df, postrun); - - case 58: - // handle non-blocking asynchronous callbacks - if (async.length) { - Promise.all(async).then(function (cb) { - return df.runAsync(null, function () { - cb.forEach(function (f) { - try { - f(df); - } catch (err) { - df.error(err); - } - }); - }); - }); - } - - return _context17.abrupt("return", df); - - case 60: - case "end": - return _context17.stop(); - } - } - }, _callee10, this, [[17, 37]]); - })); - return _evaluate.apply(this, arguments); - } - - function runAsync(_x18, _x19, _x20) { - return _runAsync.apply(this, arguments); - } - /** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ - - - function _runAsync() { - _runAsync = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(encode, prerun, postrun) { - var _this18 = this; - - var clear; - return regeneratorRuntime.wrap(function _callee11$(_context18) { - while (1) { - switch (_context18.prev = _context18.next) { - case 0: - if (!this._running) { - _context18.next = 5; - break; - } - - _context18.next = 3; - return this._running; - - case 3: - _context18.next = 0; - break; - - case 5: - // run dataflow, manage running promise - clear = function clear() { - return _this18._running = null; - }; - - (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear); - return _context18.abrupt("return", this._running); - - case 8: - case "end": - return _context18.stop(); - } - } - }, _callee11, this); - })); - return _runAsync.apply(this, arguments); - } - - function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this); - } - /** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ - - - function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) { - // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - } else { - // pulse propagation already complete, invoke immediately - try { - callback(this); - } catch (err) { - this.error(err); - } - } - } - /** - * Raise an error for re-entrant dataflow evaluation. - */ - - - function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; - } - /** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ - - - function enqueue(op, force) { - var q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - - if (q || force) { - op.qrank = op.rank; - - this._heap.push(op); - } - } - /** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ - - - function getPulse(op, encode) { - var s = op.source, - stamp = this._clock; - return s && isArray(s) ? new MultiPulse(this, stamp, s.map(function (_) { - return _.pulse; - }), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); - } - - function singlePulse(p, s) { - if (s && s.stamp === p.stamp) { - return s; - } - - p = p.fork(); - - if (s && s !== StopPropagation) { - p.source = s.source; - } - - return p; - } - - var NO_OPT = { - skip: false, - force: false - }; - /** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - - function touch(op, options) { - var opt = options || NO_OPT; - - if (this._pulse) { - // if in midst of propagation, add to priority queue - this._enqueue(op); - } else { - // otherwise, queue for next propagation - this._touched.add(op); - } - - if (opt.skip) op.skip(true); - return this; - } - /** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - - - function update(op, value, options) { - var opt = options || NO_OPT; - - if (op.set(value) || opt.force) { - this.touch(op, opt); - } - - return this; - } - /** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - - - function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - var p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), - t = op.pulse && op.pulse.source || []; - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - return this; - } - - function Heap(cmp) { - var nodes = []; - return { - clear: function clear() { - return nodes = []; - }, - size: function size() { - return nodes.length; - }, - peek: function peek() { - return nodes[0]; - }, - push: function push(x) { - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: function pop() { - var last = nodes.pop(), - item; - - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else { - item = last; - } - - return item; - } - }; - } - - function siftdown(array, start, idx, cmp) { - var item, parent, pidx; - item = array[idx]; - - while (idx > start) { - pidx = idx - 1 >> 1; - parent = array[pidx]; - - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - - break; - } - - return array[idx] = item; - } - - function siftup(array, idx, cmp) { - var start = idx, - end = array.length, - item = array[idx], - cidx = (idx << 1) + 1, - ridx; - - while (cidx < end) { - ridx = cidx + 1; - - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) { - cidx = ridx; - } - - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - - array[idx] = item; - return siftdown(array, start, idx, cmp); - } - /** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ - - - function Dataflow() { - this.logger(logger()); - this.logLevel(Error$1); - this._clock = 0; - this._rank = 0; - this._locale = defaultLocale$2(); - - try { - this._loader = loader(); - } catch (e) {// do nothing if loader module is unavailable - } - - this._touched = UniqueList(id); - this._input = {}; - this._pulse = null; - this._heap = Heap(function (a, b) { - return a.qrank - b.qrank; - }); - this._postrun = []; - } - - var prototype$5 = Dataflow.prototype; - /** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ - - prototype$5.stamp = function () { - return this._clock; - }; - /** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ - - - prototype$5.loader = function (_) { - if (arguments.length) { - this._loader = _; - return this; - } else { - return this._loader; - } - }; - /** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ - - - prototype$5.locale = function (_) { - if (arguments.length) { - this._locale = _; - return this; - } else { - return this._locale; - } - }; - /** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ - - - prototype$5.cleanThreshold = 1e4; // OPERATOR REGISTRATION - - prototype$5.add = add; - prototype$5.connect = connect; - prototype$5.rank = rank; - prototype$5.rerank = rerank; // OPERATOR UPDATES - - prototype$5.pulse = pulse; - prototype$5.touch = touch; - prototype$5.update = update; - prototype$5.changeset = changeset; // DATA LOADING - - prototype$5.ingest = ingest$1; - prototype$5.parse = parse$1; - prototype$5.preload = preload; - prototype$5.request = request; // EVENT HANDLING - - prototype$5.events = events; - prototype$5.on = on; // PULSE PROPAGATION - - prototype$5.evaluate = evaluate; - prototype$5.run = run; - prototype$5.runAsync = runAsync; - prototype$5.runAfter = runAfter; - prototype$5._enqueue = enqueue; - prototype$5._getPulse = getPulse; // LOGGING AND ERROR HANDLING - - function logMethod(method) { - return function () { - return this._log[method].apply(this, arguments); - }; - } - /** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ - - - prototype$5.logger = function (logger) { - if (arguments.length) { - this._log = logger; - return this; - } else { - return this._log; - } - }; - /** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ - - - prototype$5.error = logMethod('error'); - /** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ - - prototype$5.warn = logMethod('warn'); - /** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ - - prototype$5.info = logMethod('info'); - /** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ - - prototype$5.debug = logMethod('debug'); - /** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ - - prototype$5.logLevel = logMethod('level'); - /** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ - - function Transform(init, params) { - Operator.call(this, init, null, params); - } - - var prototype$6 = inherits(Transform, Operator); - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ - - prototype$6.run = function (pulse) { - var _this = this; - - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - var rv; - - if (this.skip()) { - this.skip(false); - } else { - rv = this.evaluate(pulse); - } - - rv = rv || pulse; - - if (rv.then) { - rv = rv.then(function (_) { - return _this.pulse = _; - }); - } else if (rv !== pulse.StopPropagation) { - this.pulse = rv; - } - - return rv; - }; - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ - - - prototype$6.evaluate = function (pulse) { - var params = this.marshall(pulse.stamp), - out = this.transform(params, pulse); - params.clear(); - return out; - }; - /** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ - - - prototype$6.transform = function () {}; - - var transforms = {}; - - function definition(type) { - var t = transform$1(type); - return t && t.Definition || null; - } - - function transform$1(type) { - type = type && type.toLowerCase(); - return hasOwnProperty(transforms, type) ? transforms[type] : null; - } - - function multikey(f) { - return function (x) { - var n = f.length, - i = 1, - k = String(f[0](x)); - - for (; i < n; ++i) { - k += '|' + f[i](x); - } - - return k; - }; - } - - function groupkey(fields) { - return !fields || !fields.length ? function () { - return ''; - } : fields.length === 1 ? fields[0] : multikey(fields); - } - - function measureName(op, field, as) { - return as || op + (!field ? '' : '_' + field); - } - - var noop = function noop() {}; - - var base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 - }; - var AggregateOps = { - values: { - init: function init(m) { - return m.cell.store = true; - }, - value: function value(m) { - return m.cell.data.values(); - }, - idx: -1 - }, - count: { - value: function value(m) { - return m.cell.num; - } - }, - __count__: { - value: function value(m) { - return m.missing + m.valid; - } - }, - missing: { - value: function value(m) { - return m.missing; - } - }, - valid: { - value: function value(m) { - return m.valid; - } - }, - sum: { - init: function init(m) { - return m.sum = 0; - }, - value: function value(m) { - return m.sum; - }, - add: function add(m, v) { - return m.sum += +v; - }, - rem: function rem(m, v) { - return m.sum -= v; - } - }, - product: { - init: function init(m) { - return m.product = 1; - }, - value: function value(m) { - return m.valid ? m.product : undefined; - }, - add: function add(m, v) { - return m.product *= v; - }, - rem: function rem(m, v) { - return m.product /= v; - } - }, - mean: { - init: function init(m) { - return m.mean = 0; - }, - value: function value(m) { - return m.valid ? m.mean : undefined; - }, - add: function add(m, v) { - return m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid; - }, - rem: function rem(m, v) { - return m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean; - } - }, - average: { - value: function value(m) { - return m.valid ? m.mean : undefined; - }, - req: ['mean'], - idx: 1 - }, - variance: { - init: function init(m) { - return m.dev = 0; - }, - value: function value(m) { - return m.valid > 1 ? m.dev / (m.valid - 1) : undefined; - }, - add: function add(m, v) { - return m.dev += m.mean_d * (v - m.mean); - }, - rem: function rem(m, v) { - return m.dev -= m.mean_d * (v - m.mean); - }, - req: ['mean'], - idx: 1 - }, - variancep: { - value: function value(m) { - return m.valid > 1 ? m.dev / m.valid : undefined; - }, - req: ['variance'], - idx: 2 - }, - stdev: { - value: function value(m) { - return m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined; - }, - req: ['variance'], - idx: 2 - }, - stdevp: { - value: function value(m) { - return m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined; - }, - req: ['variance'], - idx: 2 - }, - stderr: { - value: function value(m) { - return m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined; - }, - req: ['variance'], - idx: 2 - }, - distinct: { - value: function value(m) { - return m.cell.data.distinct(m.get); - }, - req: ['values'], - idx: 3 - }, - ci0: { - value: function value(m) { - return m.cell.data.ci0(m.get); - }, - req: ['values'], - idx: 3 - }, - ci1: { - value: function value(m) { - return m.cell.data.ci1(m.get); - }, - req: ['values'], - idx: 3 - }, - median: { - value: function value(m) { - return m.cell.data.q2(m.get); - }, - req: ['values'], - idx: 3 - }, - q1: { - value: function value(m) { - return m.cell.data.q1(m.get); - }, - req: ['values'], - idx: 3 - }, - q3: { - value: function value(m) { - return m.cell.data.q3(m.get); - }, - req: ['values'], - idx: 3 - }, - min: { - init: function init(m) { - return m.min = undefined; - }, - value: function value(m) { - return m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min; - }, - add: function add(m, v) { - if (v < m.min || m.min === undefined) m.min = v; - }, - rem: function rem(m, v) { - if (v <= m.min) m.min = NaN; - }, - req: ['values'], - idx: 4 - }, - max: { - init: function init(m) { - return m.max = undefined; - }, - value: function value(m) { - return m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max; - }, - add: function add(m, v) { - if (v > m.max || m.max === undefined) m.max = v; - }, - rem: function rem(m, v) { - if (v >= m.max) m.max = NaN; - }, - req: ['values'], - idx: 4 - }, - argmin: { - init: function init(m) { - return m.argmin = undefined; - }, - value: function value(m) { - return m.argmin || m.cell.data.argmin(m.get); - }, - add: function add(m, v, t) { - if (v < m.min) m.argmin = t; - }, - rem: function rem(m, v) { - if (v <= m.min) m.argmin = undefined; - }, - req: ['min', 'values'], - idx: 3 - }, - argmax: { - init: function init(m) { - return m.argmax = undefined; - }, - value: function value(m) { - return m.argmax || m.cell.data.argmax(m.get); - }, - add: function add(m, v, t) { - if (v > m.max) m.argmax = t; - }, - rem: function rem(m, v) { - if (v >= m.max) m.argmax = undefined; - }, - req: ['max', 'values'], - idx: 3 - } - }; - var ValidAggregateOps = Object.keys(AggregateOps); - - function measure(key, value) { - return function (out) { - return extend({ - name: key, - out: out || key - }, base_op, value); - }; - } - - ValidAggregateOps.forEach(function (key) { - AggregateOps[key] = measure(key, AggregateOps[key]); - }); - - function createMeasure(op, name) { - return AggregateOps[op](name); - } - - function compareIndex(a, b) { - return a.idx - b.idx; - } - - function resolve(agg) { - var map = {}; - agg.forEach(function (a) { - return map[a.name] = a; - }); - - var getreqs = function getreqs(a) { - if (!a.req) return; - a.req.forEach(function (key) { - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - - agg.forEach(getreqs); - return Object.values(map).sort(compareIndex); - } - - function init() { - var _this2 = this; - - this.valid = 0; - this.missing = 0; - - this._ops.forEach(function (op) { - return op.init(_this2); - }); - } - - function add$1(v, t) { - var _this3 = this; - - if (v == null || v === '') { - ++this.missing; - return; - } - - if (v !== v) return; - ++this.valid; - - this._ops.forEach(function (op) { - return op.add(_this3, v, t); - }); - } - - function rem(v, t) { - var _this4 = this; - - if (v == null || v === '') { - --this.missing; - return; - } - - if (v !== v) return; - --this.valid; - - this._ops.forEach(function (op) { - return op.rem(_this4, v, t); - }); - } - - function set(t) { - var _this5 = this; - - this._out.forEach(function (op) { - return t[op.out] = op.value(_this5); - }); - - return t; - } - - function compileMeasures(agg, field) { - var get = field || identity, - ops = resolve(agg), - out = agg.slice().sort(compareIndex); - - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - - ctr.prototype.init = init; - ctr.prototype.add = add$1; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map(function (op) { - return op.out; - }); - return ctr; - } - - function numbers$1(values, valueof) { - var _iterator13, _step13, _value14, _index7, _iterator14, _step14, _value15; - - return regeneratorRuntime.wrap(function numbers$1$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - if (!(valueof == null)) { - _context3.next = 21; - break; - } - - _iterator13 = _createForOfIteratorHelper(values); - _context3.prev = 2; - - _iterator13.s(); - - case 4: - if ((_step13 = _iterator13.n()).done) { - _context3.next = 11; - break; - } - - _value14 = _step13.value; - - if (!(_value14 != null && _value14 !== '' && (_value14 = +_value14) >= _value14)) { - _context3.next = 9; - break; - } - - _context3.next = 9; - return _value14; - - case 9: - _context3.next = 4; - break; - - case 11: - _context3.next = 16; - break; - - case 13: - _context3.prev = 13; - _context3.t0 = _context3["catch"](2); - - _iterator13.e(_context3.t0); - - case 16: - _context3.prev = 16; - - _iterator13.f(); - - return _context3.finish(16); - - case 19: - _context3.next = 41; - break; - - case 21: - _index7 = -1; - _iterator14 = _createForOfIteratorHelper(values); - _context3.prev = 23; - - _iterator14.s(); - - case 25: - if ((_step14 = _iterator14.n()).done) { - _context3.next = 33; - break; - } - - _value15 = _step14.value; - _value15 = valueof(_value15, ++_index7, values); - - if (!(_value15 != null && _value15 !== '' && (_value15 = +_value15) >= _value15)) { - _context3.next = 31; - break; - } - - _context3.next = 31; - return _value15; - - case 31: - _context3.next = 25; - break; - - case 33: - _context3.next = 38; - break; - - case 35: - _context3.prev = 35; - _context3.t1 = _context3["catch"](23); - - _iterator14.e(_context3.t1); - - case 38: - _context3.prev = 38; - - _iterator14.f(); - - return _context3.finish(38); - - case 41: - case "end": - return _context3.stop(); - } - } - }, _marked2, null, [[2, 13, 16, 19], [23, 35, 38, 41]]); - } - - function quantiles(array, p, f) { - var values = Float64Array.from(numbers$1(array, f)); // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - - values.sort(ascending); - return p.map(function (_) { - return quantileSorted(values, _); - }); - } - - function quartiles(array, f) { - return quantiles(array, [0.25, 0.50, 0.75], f); - } // Scott, D. W. (1992) Multivariate Density Estimation: - // Theory, Practice, and Visualization. Wiley. - - - function bandwidthNRD(array, f) { - var n = array.length, - v = deviation(array, f), - q = quartiles(array, f), - h = (q[2] - q[0]) / 1.34; - v = Math.min(v, h) || v || Math.abs(q[0]) || 1; - return 1.06 * v * Math.pow(n, -0.2); - } - - function bin(_) { - // determine range - var maxb = _.maxbins || 20, - base = _.base || 10, - logb = Math.log(base), - div = _.divide || [5, 2], - min = _.extent[0], - max = _.extent[1], - span = _.span || max - min || Math.abs(min) || 1, - step, - level, - minstep, - precision, - v, - i, - n, - eps; - - if (_.step) { - // if step size is explicitly given, use that - step = _.step; - } else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - - for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i) { - ; - } - - step = _.steps[Math.max(0, i - 1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level)); // increase step size if too many bins - - while (Math.ceil(span / step) > maxb) { - step *= base; - } // decrease step size if allowed - - - for (i = 0, n = div.length; i < n; ++i) { - v = step / div[i]; - if (v >= minstep && span / v <= maxb) step = v; - } - } // update precision, min and max - - - v = Math.log(step); - precision = v >= 0 ? 0 : ~~(-v / logb) + 1; - eps = Math.pow(base, -precision - 1); - - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; - } - - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; - } - - exports.random = Math.random; - - function setRandom(r) { - exports.random = r; - } - - function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [undefined, undefined]; - var values = Float64Array.from(numbers$1(array, f)), - n = values.length, - m = samples, - a, - i, - j, - mu; - - for (j = 0, mu = Array(m); j < m; ++j) { - for (a = 0, i = 0; i < n; ++i) { - a += values[~~(exports.random() * n)]; - } - - mu[j] = a / n; - } - - mu.sort(ascending); - return [quantile(mu, alpha / 2), quantile(mu, 1 - alpha / 2)]; - } // Dot density binning for dot plot construction. - // Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - // https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - - - function dotbin(array, step, smooth, f) { - f = f || function (_) { - return _; - }; - - var i = 0, - j = 1, - n = array.length, - v = new Float64Array(n), - a = f(array[0]), - b = a, - w = a + step, - x; - - for (; j < n; ++j) { - x = f(array[j]); - - if (x >= w) { - b = (a + b) / 2; - - for (; i < j; ++i) { - v[i] = b; - } - - w = x + step; - a = x; - } - - b = x; - } - - b = (a + b) / 2; - - for (; i < j; ++i) { - v[i] = b; - } - - return smooth ? smoothing(v, step + step / 4) : v; - } // perform smoothing to reduce variance - // swap points between "adjacent" stacks - // Wilkinson defines adjacent as within step/4 units - - - function smoothing(v, thresh) { - var n = v.length, - a = 0, - b = 1, - c, - d; // get left stack - - while (v[a] === v[b]) { - ++b; - } - - while (b < n) { - // get right stack - c = b + 1; - - while (v[b] === v[c]) { - ++c; - } // are stacks adjacent? - // if so, compare sizes and swap as needed - - - if (v[b] - v[b - 1] < thresh) { - d = b + (a + c - b - b >> 1); - - while (d < b) { - v[d++] = v[b]; - } - - while (d > b) { - v[d--] = v[a]; - } - } // update left stack indices - - - a = b; - b = c; - } - - return v; - } - - function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function () { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; - } - - function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - - var dist = {}, - a, - b, - d; - - dist.min = function (_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else { - return a; - } - }; - - dist.max = function (_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else { - return b; - } - }; - - dist.sample = function () { - return a + Math.floor(d * exports.random()); - }; - - dist.pdf = function (x) { - return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0; - }; - - dist.cdf = function (x) { - var v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }; - - dist.icdf = function (p) { - return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN; - }; - - return dist.min(min).max(max); - } - - var SQRT2PI = Math.sqrt(2 * Math.PI); - var SQRT2 = Math.SQRT2; - var nextSample = NaN; - - function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - var x = 0, - y = 0, - rds, - c; - - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = exports.random() * 2 - 1; - y = exports.random() * 2 - 1; - rds = x * x + y * y; - } while (rds === 0 || rds > 1); - - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - - x *= c; - nextSample = y * c; - } - - return mean + x * stdev; - } - - function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - var z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); - } // Approximation from West (2009) - // Better Approximations to Cumulative Normal Functions - - - function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - var cd, - z = (value - mean) / stdev, - Z = Math.abs(z); - - if (Z > 37) { - cd = 0; - } else { - var _sum, - _exp = Math.exp(-Z * Z / 2); - - if (Z < 7.07106781186547) { - _sum = 3.52624965998911e-02 * Z + 0.700383064443688; - _sum = _sum * Z + 6.37396220353165; - _sum = _sum * Z + 33.912866078383; - _sum = _sum * Z + 112.079291497871; - _sum = _sum * Z + 221.213596169931; - _sum = _sum * Z + 220.206867912376; - cd = _exp * _sum; - _sum = 8.83883476483184e-02 * Z + 1.75566716318264; - _sum = _sum * Z + 16.064177579207; - _sum = _sum * Z + 86.7807322029461; - _sum = _sum * Z + 296.564248779674; - _sum = _sum * Z + 637.333633378831; - _sum = _sum * Z + 793.826512519948; - _sum = _sum * Z + 440.413735824752; - cd = cd / _sum; - } else { - _sum = Z + 0.65; - _sum = Z + 4 / _sum; - _sum = Z + 3 / _sum; - _sum = Z + 2 / _sum; - _sum = Z + 1 / _sum; - cd = _exp / _sum / 2.506628274631; - } - } - - return z > 0 ? 1 - cd : cd; - } // Approximation of Probit function using inverse error function. - - - function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); - } // Approximate inverse error function. Implementation from "Approximating - // the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. - // Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 - - - function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - var w = -Math.log((1 - x) * (1 + x)), - p; - - if (w < 6.25) { - w -= 3.125; - p = -3.6444120640178196996e-21; - p = -1.685059138182016589e-19 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -1.333171662854620906e-16 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -4.0545662729752068639e-14 + p * w; - p = -8.1519341976054721522e-14 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -1.2975133253453532498e-11 + p * w; - p = -5.4154120542946279317e-11 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -4.1126339803469836976e-09 + p * w; - p = -2.9070369957882005086e-08 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -1.3654692000834678645e-06 + p * w; - p = -1.3882523362786468719e-05 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.00074070253416626697512 + p * w; - p = -0.0060336708714301490533 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -2.7517406297064545428e-07 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -4.013867526981545969e-06 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -4.7318229009055733981e-05 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628474796 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047313 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.0037512085075692412107 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -2.7109920616438573243e-11; - p = -2.5556418169965252055e-10 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -3.7894654401267369937e-09 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -1.4960026627149240478e-08 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -6.7711997758452339498e-08 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -9.9298272942317002539e-07 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -1.9681778105531670567e-05 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477347 + p * w; - p = -0.00013871931833623122026 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else { - p = Infinity; - } - - return p * x; - } - - function randomNormal(mean, stdev) { - var mu, - sigma, - dist = { - mean: function mean(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function stdev(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: function sample() { - return sampleNormal(mu, sigma); - }, - pdf: function pdf(value) { - return densityNormal(value, mu, sigma); - }, - cdf: function cdf(value) { - return cumulativeNormal(value, mu, sigma); - }, - icdf: function icdf(p) { - return quantileNormal(p, mu, sigma); - } - }; - return dist.mean(mean).stdev(stdev); - } // TODO: support for additional kernels? - - - function randomKDE(support, bandwidth) { - var kernel = randomNormal(), - dist = {}, - n = 0; - - dist.data = function (_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else { - return support; - } - }; - - dist.bandwidth = function (_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = bandwidthNRD(support); - return dist; - }; - - dist.sample = function () { - return support[~~(exports.random() * n)] + bandwidth * kernel.sample(); - }; - - dist.pdf = function (x) { - for (var y = 0, i = 0; i < n; ++i) { - y += kernel.pdf((x - support[i]) / bandwidth); - } - - return y / bandwidth / n; - }; - - dist.cdf = function (x) { - for (var y = 0, i = 0; i < n; ++i) { - y += kernel.cdf((x - support[i]) / bandwidth); - } - - return y / n; - }; - - dist.icdf = function () { - throw Error('KDE icdf not supported.'); - }; - - return dist.data(support); - } - - function sampleLogNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - return Math.exp(mean + sampleNormal() * stdev); - } - - function densityLogNormal(value, mean, stdev) { - if (value <= 0) return 0; - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - var z = (Math.log(value) - mean) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value); - } - - function cumulativeLogNormal(value, mean, stdev) { - return cumulativeNormal(Math.log(value), mean, stdev); - } - - function quantileLogNormal(p, mean, stdev) { - return Math.exp(quantileNormal(p, mean, stdev)); - } - - function randomLogNormal(mean, stdev) { - var mu, - sigma, - dist = { - mean: function mean(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function stdev(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: function sample() { - return sampleLogNormal(mu, sigma); - }, - pdf: function pdf(value) { - return densityLogNormal(value, mu, sigma); - }, - cdf: function cdf(value) { - return cumulativeLogNormal(value, mu, sigma); - }, - icdf: function icdf(p) { - return quantileLogNormal(p, mu, sigma); - } - }; - return dist.mean(mean).stdev(stdev); - } - - function randomMixture(dists, weights) { - var dist = {}, - m = 0, - w; - - function normalize(x) { - var w = [], - sum = 0, - i; - - for (i = 0; i < m; ++i) { - sum += w[i] = x[i] == null ? 1 : +x[i]; - } - - for (i = 0; i < m; ++i) { - w[i] /= sum; - } - - return w; - } - - dist.weights = function (_) { - if (arguments.length) { - w = normalize(weights = _ || []); - return dist; - } - - return weights; - }; - - dist.distributions = function (_) { - if (arguments.length) { - if (_) { - m = _.length; - dists = _; - } else { - m = 0; - dists = []; - } - - return dist.weights(weights); - } - - return dists; - }; - - dist.sample = function () { - var r = exports.random(), - d = dists[m - 1], - v = w[0], - i = 0; // first select distribution - - for (; i < m - 1; v += w[++i]) { - if (r < v) { - d = dists[i]; - break; - } - } // then sample from it - - - return d.sample(); - }; - - dist.pdf = function (x) { - for (var p = 0, i = 0; i < m; ++i) { - p += w[i] * dists[i].pdf(x); - } - - return p; - }; - - dist.cdf = function (x) { - for (var p = 0, i = 0; i < m; ++i) { - p += w[i] * dists[i].cdf(x); - } - - return p; - }; - - dist.icdf = function () { - throw Error('Mixture icdf not supported.'); - }; - - return dist.distributions(dists).weights(weights); - } - - function sampleUniform(min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return min + (max - min) * exports.random(); - } - - function densityUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return value >= min && value <= max ? 1 / (max - min) : 0; - } - - function cumulativeUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); - } - - function quantileUniform(p, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return p >= 0 && p <= 1 ? min + p * (max - min) : NaN; - } - - function randomUniform(min, max) { - var a, - b, - dist = { - min: function min(_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else { - return a; - } - }, - max: function max(_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else { - return b; - } - }, - sample: function sample() { - return sampleUniform(a, b); - }, - pdf: function pdf(value) { - return densityUniform(value, a, b); - }, - cdf: function cdf(value) { - return cumulativeUniform(value, a, b); - }, - icdf: function icdf(p) { - return quantileUniform(p, a, b); - } - }; - - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - - return dist.min(min).max(max); - } // Ordinary Least Squares - - - function ols(uX, uY, uXY, uX2) { - var delta = uX2 - uX * uX, - slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, - intercept = uY - slope * uX; - return [intercept, slope]; - } - - function points(data, x, y, sort) { - data = data.filter(function (d) { - var u = x(d), - v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - - if (sort) { - data.sort(function (a, b) { - return x(a) - x(b); - }); - } - - var n = data.length, - X = new Float64Array(n), - Y = new Float64Array(n); // extract values, calculate means - - var i = 0, - ux = 0, - uy = 0, - xv, - yv, - d; - - var _iterator15 = _createForOfIteratorHelper(data), - _step15; - - try { - for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) { - d = _step15.value; - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } // mean center the data - - } catch (err) { - _iterator15.e(err); - } finally { - _iterator15.f(); - } - - for (i = 0; i < n; ++i) { - X[i] -= ux; - Y[i] -= uy; - } - - return [X, Y, ux, uy]; - } - - function visitPoints(data, x, y, callback) { - var i = -1, - u, - v; - - var _iterator16 = _createForOfIteratorHelper(data), - _step16; - - try { - for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) { - var d = _step16.value; - u = x(d); - v = y(d); - - if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) { - callback(u, v, ++i); - } - } - } catch (err) { - _iterator16.e(err); - } finally { - _iterator16.f(); - } - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - - function rSquared(data, x, y, uY, predict) { - var SSE = 0, - SST = 0; - visitPoints(data, x, y, function (dx, dy) { - var sse = dy - predict(dx), - sst = dy - uY; - SSE += sse * sse; - SST += sst * sst; - }); - return 1 - SSE / SST; - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - - function regressionLinear(data, x, y) { - var X = 0, - Y = 0, - XY = 0, - X2 = 0, - n = 0; - visitPoints(data, x, y, function (dx, dy) { - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - var coef = ols(X, Y, XY, X2), - predict = function predict(x) { - return coef[0] + coef[1] * x; - }; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - - function regressionLog(data, x, y) { - var X = 0, - Y = 0, - XY = 0, - X2 = 0, - n = 0; - visitPoints(data, x, y, function (dx, dy) { - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - var coef = ols(X, Y, XY, X2), - predict = function predict(x) { - return coef[0] + coef[1] * Math.log(x); - }; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } - - function regressionExp(data, x, y) { - // eslint-disable-next-line no-unused-vars - var _points = points(data, x, y), - _points2 = _slicedToArray(_points, 4), - xv = _points2[0], - yv = _points2[1], - ux = _points2[2], - uy = _points2[3]; - - var YL = 0, - XY = 0, - XYL = 0, - X2Y = 0, - n = 0, - dx, - ly, - xy; - visitPoints(data, x, y, function (_, dy) { - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - - var _ols = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), - _ols2 = _slicedToArray(_ols, 2), - c0 = _ols2[0], - c1 = _ols2[1], - predict = function predict(x) { - return Math.exp(c0 + c1 * (x - ux)); - }; - - return { - coef: [Math.exp(c0 - c1 * ux), c1], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - - - function regressionPow(data, x, y) { - var X = 0, - Y = 0, - XY = 0, - X2 = 0, - YS = 0, - n = 0; - visitPoints(data, x, y, function (dx, dy) { - var lx = Math.log(dx), - ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - - var coef = ols(X, Y, XY, X2), - predict = function predict(x) { - return coef[0] * Math.pow(x, coef[1]); - }; - - coef[0] = Math.exp(coef[0]); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; - } - - function regressionQuad(data, x, y) { - var _points3 = points(data, x, y), - _points4 = _slicedToArray(_points3, 4), - xv = _points4[0], - yv = _points4[1], - ux = _points4[2], - uy = _points4[3], - n = xv.length; - - var X2 = 0, - X3 = 0, - X4 = 0, - XY = 0, - X2Y = 0, - i, - dx, - dy, - x2; - - for (i = 0; i < n;) { - dx = xv[i]; - dy = yv[i++]; - x2 = dx * dx; - X2 += (x2 - X2) / i; - X3 += (x2 * dx - X3) / i; - X4 += (x2 * x2 - X4) / i; - XY += (dx * dy - XY) / i; - X2Y += (x2 * dy - X2Y) / i; - } - - var X2X2 = X4 - X2 * X2, - d = X2 * X2X2 - X3 * X3, - a = (X2Y * X2 - XY * X3) / d, - b = (XY * X2X2 - X2Y * X3) / d, - c = -a * X2, - predict = function predict(x) { - x = x - ux; - return a * x * x + b * x + c + uy; - }; // transform coefficients back from mean-centered space - - - return { - coef: [c - b * ux + a * ux * ux + uy, b - 2 * a * ux, a], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - // ... which was adapted from regression-js by Tom Alexander - // Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 - // License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE - - - function regressionPoly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 1) return regressionLinear(data, x, y); - if (order === 2) return regressionQuad(data, x, y); - - var _points5 = points(data, x, y), - _points6 = _slicedToArray(_points5, 4), - xv = _points6[0], - yv = _points6[1], - ux = _points6[2], - uy = _points6[3], - n = xv.length, - lhs = [], - rhs = [], - k = order + 1; - - var i, j, l, v, c; - - for (i = 0; i < k; ++i) { - for (l = 0, v = 0; l < n; ++l) { - v += Math.pow(xv[l], i) * yv[l]; - } - - lhs.push(v); - c = new Float64Array(k); - - for (j = 0; j < k; ++j) { - for (l = 0, v = 0; l < n; ++l) { - v += Math.pow(xv[l], i + j); - } - - c[j] = v; - } - - rhs.push(c); - } - - rhs.push(lhs); - - var coef = gaussianElimination(rhs), - predict = function predict(x) { - x -= ux; - var y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - - for (i = 3; i < k; ++i) { - y += coef[i] * Math.pow(x, i); - } - - return y; - }; - - return { - coef: uncenter(k, coef, -ux, uy), - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } - - function uncenter(k, a, x, y) { - var z = Array(k); - var i, j, v, c; // initialize to zero - - for (i = 0; i < k; ++i) { - z[i] = 0; - } // polynomial expansion - - - for (i = k - 1; i >= 0; --i) { - v = a[i]; - c = 1; - z[i] += v; - - for (j = 1; j <= i; ++j) { - c *= (i + 1 - j) / j; // binomial coefficent - - z[i - j] += v * Math.pow(x, j) * c; - } - } // bias term - - - z[0] += y; - return z; - } // Given an array for a two-dimensional matrix and the polynomial order, - // solve A * x = b using Gaussian elimination. - - - function gaussianElimination(matrix) { - var n = matrix.length - 1, - coef = []; - var i, j, k, r, t; - - for (i = 0; i < n; ++i) { - r = i; // max row - - for (j = i + 1; j < n; ++j) { - if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { - r = j; - } - } - - for (k = i; k < n + 1; ++k) { - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - - for (j = i + 1; j < n; ++j) { - for (k = n; k >= i; k--) { - matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; - } - } - } - - for (j = n - 1; j >= 0; --j) { - t = 0; - - for (k = j + 1; k < n; ++k) { - t += matrix[k][j] * coef[k]; - } - - coef[j] = (matrix[n][j] - t) / matrix[j][j]; - } - - return coef; - } - - var maxiters = 2, - epsilon = 1e-12; // Adapted from science.js by Jason Davies - // Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js - // License: https://github.com/jasondavies/science.js/blob/master/LICENSE - - function regressionLoess(data, x, y, bandwidth) { - var _points7 = points(data, x, y, true), - _points8 = _slicedToArray(_points7, 4), - xv = _points8[0], - yv = _points8[1], - ux = _points8[2], - uy = _points8[3], - n = xv.length, - bw = Math.max(2, ~~(bandwidth * n)), - yhat = new Float64Array(n), - residuals = new Float64Array(n), - robustWeights = new Float64Array(n).fill(1); - - for (var iter = -1; ++iter <= maxiters;) { - var _interval = [0, bw - 1]; - - for (var i = 0; i < n; ++i) { - var dx = xv[i], - i0 = _interval[0], - i1 = _interval[1], - edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; - var W = 0, - _X = 0, - _Y = 0, - XY = 0, - _X2 = 0, - denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - - for (var k = i0; k <= i1; ++k) { - var xk = xv[k], - yk = yv[k], - _w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], - xkw = xk * _w; - - W += _w; - _X += xkw; - _Y += yk * _w; - XY += yk * xkw; - _X2 += xk * xkw; - } // linear regression fit - - - var _ols3 = ols(_X / W, _Y / W, XY / W, _X2 / W), - _ols4 = _slicedToArray(_ols3, 2), - a = _ols4[0], - _b = _ols4[1]; - - yhat[i] = a + _b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - updateInterval(xv, i + 1, _interval); - } - - if (iter === maxiters) { - break; - } - - var medianResidual = median(residuals); - if (Math.abs(medianResidual) < epsilon) break; - - for (var _i2 = 0, arg, _w2; _i2 < n; ++_i2) { - arg = residuals[_i2] / (6 * medianResidual); // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - - robustWeights[_i2] = arg >= 1 ? epsilon : (_w2 = 1 - arg * arg) * _w2; - } - } - - return output(xv, yhat, ux, uy); - } // weighting kernel for local regression - - - function tricube(x) { - return (x = 1 - x * x * x) * x * x; - } // advance sliding window interval of nearest neighbors - - - function updateInterval(xv, i, interval) { - var val = xv[i], - left = interval[0], - right = interval[1] + 1; - if (right >= xv.length) return; // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - - while (i > left && xv[right] - val <= val - xv[left]) { - interval[0] = ++left; - interval[1] = right; - ++right; - } - } // generate smoothed output points - // average points with repeated x values - - - function output(xv, yhat, ux, uy) { - var n = xv.length, - out = []; - var i = 0, - cnt = 0, - prev = [], - v; - - for (; i < n; ++i) { - v = xv[i] + ux; - - if (prev[0] === v) { - // average output values via online update - prev[1] += (yhat[i] - prev[1]) / ++cnt; - } else { - // add new output point - cnt = 0; - prev[1] += uy; - prev = [v, yhat[i]]; - out.push(prev); - } - } - - prev[1] += uy; - return out; - } // subdivide up to accuracy of 0.1 degrees - - - var MIN_RADIANS = 0.1 * Math.PI / 180; // Adaptively sample an interpolated function over a domain extent - - function sampleCurve(f, extent, minSteps, maxSteps) { - minSteps = minSteps || 25; - maxSteps = Math.max(minSteps, maxSteps || 200); - - var point = function point(x) { - return [x, f(x)]; - }, - minX = extent[0], - maxX = extent[1], - span = maxX - minX, - stop = span / maxSteps, - prev = [point(minX)], - next = []; - - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for (var i = 1; i < maxSteps; ++i) { - prev.push(point(minX + i / minSteps * span)); - } - - prev.push(point(maxX)); - return prev; - } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - - for (var _i3 = minSteps; --_i3 > 0;) { - next.push(point(minX + _i3 / minSteps * span)); - } - } - - var p0 = prev[0], - p1 = next[next.length - 1]; - - while (p1) { - // midpoint for potential curve subdivision - var pm = point((p0[0] + p1[0]) / 2); - - if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) { - // maximum resolution has not yet been met, and - // subdivision midpoint sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - } else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - - p1 = next[next.length - 1]; - } - - return prev; - } - - function angleDelta(p, q, r) { - var a0 = Math.atan2(r[1] - p[1], r[0] - p[0]), - a1 = Math.atan2(q[1] - p[1], q[0] - p[0]); - return Math.abs(a0 - a1); - } - - function TupleStore(key) { - this._key = key ? field(key) : tupleid; - this.reset(); - } - - var prototype$7 = TupleStore.prototype; - - prototype$7.reset = function () { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; - }; - - prototype$7.add = function (v) { - this._add.push(v); - }; - - prototype$7.rem = function (v) { - this._rem.push(v); - }; - - prototype$7.values = function () { - this._get = null; - if (this._rem.length === 0) return this._add; - var a = this._add, - r = this._rem, - k = this._key, - n = a.length, - m = r.length, - x = Array(n - m), - map = {}, - i, - j, - v; // use unique key field to clear removed values - - for (i = 0; i < m; ++i) { - map[k(r[i])] = 1; - } - - for (i = 0, j = 0; i < n; ++i) { - if (map[k(v = a[i])]) { - map[k(v)] = 0; - } else { - x[j++] = v; - } - } - - this._rem = []; - return this._add = x; - }; // memoizing statistics methods - - - prototype$7.distinct = function (get) { - var v = this.values(), - n = v.length, - map = {}, - count = 0, - s; - - while (--n >= 0) { - s = get(v[n]) + ''; - - if (!hasOwnProperty(map, s)) { - map[s] = 1; - ++count; - } - } - - return count; - }; - - prototype$7.extent = function (get) { - if (this._get !== get || !this._ext) { - var v = this.values(), - i = extentIndex(v, get); - this._ext = [v[i[0]], v[i[1]]]; - this._get = get; - } - - return this._ext; - }; - - prototype$7.argmin = function (get) { - return this.extent(get)[0] || {}; - }; - - prototype$7.argmax = function (get) { - return this.extent(get)[1] || {}; - }; - - prototype$7.min = function (get) { - var m = this.extent(get)[0]; - return m != null ? get(m) : undefined; - }; - - prototype$7.max = function (get) { - var m = this.extent(get)[1]; - return m != null ? get(m) : undefined; - }; - - prototype$7.quartile = function (get) { - if (this._get !== get || !this._q) { - this._q = quartiles(this.values(), get); - this._get = get; - } - - return this._q; - }; - - prototype$7.q1 = function (get) { - return this.quartile(get)[0]; - }; - - prototype$7.q2 = function (get) { - return this.quartile(get)[1]; - }; - - prototype$7.q3 = function (get) { - return this.quartile(get)[2]; - }; - - prototype$7.ci = function (get) { - if (this._get !== get || !this._ci) { - this._ci = bootstrapCI(this.values(), 1000, 0.05, get); - this._get = get; - } - - return this._ci; - }; - - prototype$7.ci0 = function (get) { - return this.ci(get)[0]; - }; - - prototype$7.ci1 = function (get) { - return this.ci(get)[1]; - }; - /** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.fields] - An array of accessors to aggregate. - * @param {Array} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ - - - function Aggregate(params) { - Transform.call(this, null, params); - this._adds = []; // array of added output tuples - - this._mods = []; // array of modified output tuples - - this._alen = 0; // number of active added tuples - - this._mlen = 0; // number of active modified tuples - - this._drop = true; // should empty aggregation cells be removed - - this._cross = false; // produce full cross-product of group-by values - - this._dims = []; // group-by dimension accessors - - this._dnames = []; // group-by dimension names - - this._measures = []; // collection of aggregation monoids - - this._countOnly = false; // flag indicating only count aggregation - - this._counts = null; // collection of count fields - - this._prev = null; // previous aggregation cells - - this._inputs = null; // array of dependent input tuple field names - - this._outputs = null; // array of output tuple field names - } - - Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, { - 'name': 'drop', - 'type': 'boolean', - 'default': true - }, { - 'name': 'cross', - 'type': 'boolean', - 'default': false - }, { - 'name': 'key', - 'type': 'field' - }] - }; - var prototype$8 = inherits(Aggregate, Transform); - - prototype$8.transform = function (_, pulse) { - var _this6 = this; - - var aggr = this, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - mod = _.modified(); - - aggr.stamp = out.stamp; - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, function (t) { - return aggr.add(t); - }); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, function (t) { - return aggr.rem(t); - }); - pulse.visit(pulse.ADD, function (t) { - return aggr.add(t); - }); - } // Indicate output fields and return aggregate tuples. - - - out.modifies(aggr._outputs); // Should empty cells be dropped? - - aggr._drop = _.drop !== false; // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - - if (pulse.clean() && aggr._drop) { - out.clean(true).runAfter(function () { - return _this6.clean(); - }); - } - - return aggr.changes(out); - }; - - prototype$8.cross = function () { - var aggr = this, - curr = aggr.value, - dims = aggr._dnames, - vals = dims.map(function () { - return {}; - }), - n = dims.length; // collect all group-by domain values - - function collect(cells) { - var key, i, t, v; - - for (key in cells) { - t = cells[key].tuple; - - for (i = 0; i < n; ++i) { - vals[i][v = t[dims[i]]] = v; - } - } - } - - collect(aggr._prev); - collect(curr); // iterate over key cross-product, create cells as needed - - function generate(base, tuple, index) { - var name = dims[index], - v = vals[index++], - k, - key; - - for (k in v) { - tuple[name] = v[k]; - key = base ? base + '|' + k : k; - if (index < n) generate(key, tuple, index);else if (!curr[key]) aggr.cell(key, tuple); - } - } - - generate('', {}, 0); - }; - - prototype$8.init = function (_) { - // initialize input and output fields - var inputs = this._inputs = [], - outputs = this._outputs = [], - inputMap = {}; - - function inputVisit(get) { - var fields = array(accessorFields(get)), - i = 0, - n = fields.length, - f; - - for (; i < n; ++i) { - if (!inputMap[f = fields[i]]) { - inputMap[f] = 1; - inputs.push(f); - } - } - } // initialize group-by dimensions - - - this._dims = array(_.groupby); - this._dnames = this._dims.map(function (d) { - var dname = accessorName(d); - inputVisit(d); - outputs.push(dname); - return dname; - }); - this.cellkey = _.key ? _.key : groupkey(this._dims); // initialize aggregate measures - - this._countOnly = true; - this._counts = []; - this._measures = []; - var fields = _.fields || [null], - ops = _.ops || ['count'], - as = _.as || [], - n = fields.length, - map = {}, - field, - op, - m, - mname, - outname, - i; - - if (n !== ops.length) { - error('Unmatched number of fields and aggregate ops.'); - } - - for (i = 0; i < n; ++i) { - field = fields[i]; - op = ops[i]; - - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - - mname = accessorName(field); - outname = measureName(op, mname, as[i]); - outputs.push(outname); - - if (op === 'count') { - this._counts.push(outname); - - continue; - } - - m = map[mname]; - - if (!m) { - inputVisit(field); - m = map[mname] = []; - m.field = field; - - this._measures.push(m); - } - - if (op !== 'count') this._countOnly = false; - m.push(createMeasure(op, outname)); - } - - this._measures = this._measures.map(function (m) { - return compileMeasures(m, m.field); - }); - return {}; // aggregation cells (this.value) - }; // -- Cell Management ----- - - - prototype$8.cellkey = groupkey(); - - prototype$8.cell = function (key, t) { - var cell = this.value[key]; - - if (!cell) { - cell = this.value[key] = this.newcell(key, t); - this._adds[this._alen++] = cell; - } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._adds[this._alen++] = cell; - } else if (cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._mods[this._mlen++] = cell; - } - - return cell; - }; - - prototype$8.newcell = function (key, t) { - var cell = { - key: key, - num: 0, - agg: null, - tuple: this.newtuple(t, this._prev && this._prev[key]), - stamp: this.stamp, - store: false - }; - - if (!this._countOnly) { - var measures = this._measures, - n = measures.length, - i; - cell.agg = Array(n); - - for (i = 0; i < n; ++i) { - cell.agg[i] = new measures[i](cell); - } - } - - if (cell.store) { - cell.data = new TupleStore(); - } - - return cell; - }; - - prototype$8.newtuple = function (t, p) { - var names = this._dnames, - dims = this._dims, - x = {}, - i, - n; - - for (i = 0, n = dims.length; i < n; ++i) { - x[names[i]] = dims[i](t); - } - - return p ? replace(p.tuple, x) : ingest(x); - }; - - prototype$8.clean = function () { - var cells = this.value; - - for (var _key2 in cells) { - if (cells[_key2].num === 0) { - delete cells[_key2]; - } - } - }; // -- Process Tuples ----- - - - prototype$8.add = function (t) { - var key = this.cellkey(t), - cell = this.cell(key, t), - agg, - i, - n; - cell.num += 1; - if (this._countOnly) return; - if (cell.store) cell.data.add(t); - agg = cell.agg; - - for (i = 0, n = agg.length; i < n; ++i) { - agg[i].add(agg[i].get(t), t); - } - }; - - prototype$8.rem = function (t) { - var key = this.cellkey(t), - cell = this.cell(key, t), - agg, - i, - n; - cell.num -= 1; - if (this._countOnly) return; - if (cell.store) cell.data.rem(t); - agg = cell.agg; - - for (i = 0, n = agg.length; i < n; ++i) { - agg[i].rem(agg[i].get(t), t); - } - }; - - prototype$8.celltuple = function (cell) { - var tuple = cell.tuple, - counts = this._counts, - agg, - i, - n; // consolidate stored values - - if (cell.store) { - cell.data.values(); - } // update tuple properties - - - for (i = 0, n = counts.length; i < n; ++i) { - tuple[counts[i]] = cell.num; - } - - if (!this._countOnly) { - agg = cell.agg; - - for (i = 0, n = agg.length; i < n; ++i) { - agg[i].set(tuple); - } - } - - return tuple; - }; - - prototype$8.changes = function (out) { - var adds = this._adds, - mods = this._mods, - prev = this._prev, - drop = this._drop, - add = out.add, - rem = out.rem, - mod = out.mod, - cell, - key, - i, - n; - if (prev) for (key in prev) { - cell = prev[key]; - if (!drop || cell.num) rem.push(cell.tuple); - } - - for (i = 0, n = this._alen; i < n; ++i) { - add.push(this.celltuple(adds[i])); - adds[i] = null; // for garbage collection - } - - for (i = 0, n = this._mlen; i < n; ++i) { - cell = mods[i]; - (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell)); - mods[i] = null; // for garbage collection - } - - this._alen = this._mlen = 0; // reset list of active cells - - this._prev = null; - return out; - }; // epsilon bias to offset floating point error (#1737) - - - var EPSILON = 1e-14; - /** - * Generates a binning function for discretizing data. - * @constructor - * @param {object} params - The parameters for this operator. The - * provided values should be valid options for the {@link bin} function. - * @param {function(object): *} params.field - The data field to bin. - */ - - function Bin(params) { - Transform.call(this, null, params); - } - - Bin.Definition = { - 'type': 'Bin', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, { - 'name': 'anchor', - 'type': 'number' - }, { - 'name': 'maxbins', - 'type': 'number', - 'default': 20 - }, { - 'name': 'base', - 'type': 'number', - 'default': 10 - }, { - 'name': 'divide', - 'type': 'number', - 'array': true, - 'default': [5, 2] - }, { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, { - 'name': 'span', - 'type': 'number' - }, { - 'name': 'step', - 'type': 'number' - }, { - 'name': 'steps', - 'type': 'number', - 'array': true - }, { - 'name': 'minstep', - 'type': 'number', - 'default': 0 - }, { - 'name': 'nice', - 'type': 'boolean', - 'default': true - }, { - 'name': 'name', - 'type': 'string' - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['bin0', 'bin1'] - }] - }; - var prototype$9 = inherits(Bin, Transform); - - prototype$9.transform = function (_, pulse) { - var band = _.interval !== false, - bins = this._bins(_), - start = bins.start, - step = bins.step, - as = _.as || ['bin0', 'bin1'], - b0 = as[0], - b1 = as[1], - flag; - - if (_.modified()) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - } else { - flag = pulse.modified(accessorFields(_.field)) ? pulse.ADD_MOD : pulse.ADD; - } - - pulse.visit(flag, band ? function (t) { - var v = bins(t); // minimum bin value (inclusive) - - t[b0] = v; // maximum bin value (exclusive) - // use convoluted math for better floating point agreement - // see https://github.com/vega/vega/issues/830 - // infinite values propagate through this formula! #2227 - - t[b1] = v == null ? null : start + step * (1 + (v - start) / step); - } : function (t) { - t[b0] = bins(t); - }); - return pulse.modifies(band ? as : b0); - }; - - prototype$9._bins = function (_) { - if (this.value && !_.modified()) { - return this.value; - } - - var field = _.field, - bins = bin(_), - step = bins.step, - start = bins.start, - stop = start + Math.ceil((bins.stop - start) / step) * step, - a, - d; - - if ((a = _.anchor) != null) { - d = a - (start + step * Math.floor((a - start) / step)); - start += d; - stop += d; - } - - var f = function f(t) { - var v = toNumber(field(t)); - return v == null ? null : v < start ? -Infinity : v > stop ? +Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON + (v - start) / step)); - }; - - f.start = start; - f.stop = bins.stop; - f.step = step; - return this.value = accessor(f, accessorFields(field), _.name || 'bin_' + accessorName(field)); - }; - - function SortedList(idFunc, source, input) { - var $ = idFunc, - _data = source || [], - _add = input || [], - rem = {}, - cnt = 0; - - return { - add: function add(t) { - _add.push(t); - }, - remove: function remove(t) { - rem[$(t)] = ++cnt; - }, - size: function size() { - return _data.length; - }, - data: function data(compare, resort) { - if (cnt) { - _data = _data.filter(function (t) { - return !rem[$(t)]; - }); - rem = {}; - cnt = 0; - } - - if (resort && compare) { - _data.sort(compare); - } - - if (_add.length) { - _data = compare ? merge(compare, _data, _add.sort(compare)) : _data.concat(_add); - _add = []; - } - - return _data; - } - }; - } - /** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ - - - function Collect(params) { - Transform.call(this, [], params); - } - - Collect.Definition = { - 'type': 'Collect', - 'metadata': { - 'source': true - }, - 'params': [{ - 'name': 'sort', - 'type': 'compare' - }] - }; - var prototype$a = inherits(Collect, Transform); - - prototype$a.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), - sort = _.sort, - mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields)); - out.visit(out.REM, list.remove); - this.modified(mod); - this.value = out.source = list.data(stableCompare(sort), mod); // propagate tree root if defined - - if (pulse.source && pulse.source.root) { - this.value.root = pulse.source.root; - } - - return out; - }; - /** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The fields to compare. - * @param {Array} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ - - - function Compare(params) { - Operator.call(this, null, update$1, params); - } - - inherits(Compare, Operator); - - function update$1(_) { - return this.value && !_.modified() ? this.value : compare(_.fields, _.orders); - } - /** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ - - - function CountPattern(params) { - Transform.call(this, null, params); - } - - CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'case', - 'type': 'enum', - 'values': ['upper', 'lower', 'mixed'], - 'default': 'mixed' - }, { - 'name': 'pattern', - 'type': 'string', - 'default': '[\\w"]+' - }, { - 'name': 'stopwords', - 'type': 'string', - 'default': '' - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['text', 'count'] - }] - }; - - function tokenize(text, tcase, match) { - switch (tcase) { - case 'upper': - text = text.toUpperCase(); - break; - - case 'lower': - text = text.toLowerCase(); - break; - } - - return text.match(match); - } - - var prototype$b = inherits(CountPattern, Transform); - - prototype$b.transform = function (_, pulse) { - function process(update) { - return function (tuple) { - var tokens = tokenize(get(tuple), _.case, match) || [], - t; - - for (var i = 0, n = tokens.length; i < n; ++i) { - if (!stop.test(t = tokens[i])) update(t); - } - }; - } - - var init = this._parameterCheck(_, pulse), - counts = this._counts, - match = this._match, - stop = this._stop, - get = _.field, - as = _.as || ['text', 'count'], - add = process(function (t) { - counts[t] = 1 + (counts[t] || 0); - }), - rem = process(function (t) { - counts[t] -= 1; - }); - - if (init) { - pulse.visit(pulse.SOURCE, add); - } else { - pulse.visit(pulse.ADD, add); - pulse.visit(pulse.REM, rem); - } - - return this._finish(pulse, as); // generate output tuples - }; - - prototype$b._parameterCheck = function (_, pulse) { - var init = false; - - if (_.modified('stopwords') || !this._stop) { - this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i'); - init = true; - } - - if (_.modified('pattern') || !this._match) { - this._match = new RegExp(_.pattern || '[\\w\']+', 'g'); - init = true; - } - - if (_.modified('field') || pulse.modified(_.field.fields)) { - init = true; - } - - if (init) this._counts = {}; - return init; - }; - - prototype$b._finish = function (pulse, as) { - var counts = this._counts, - tuples = this._tuples || (this._tuples = {}), - text = as[0], - count = as[1], - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - w, - t, - c; - - for (w in counts) { - t = tuples[w]; - c = counts[w] || 0; - - if (!t && c) { - tuples[w] = t = ingest({}); - t[text] = w; - t[count] = c; - out.add.push(t); - } else if (c === 0) { - if (t) out.rem.push(t); - counts[w] = null; - tuples[w] = null; - } else if (t[count] !== c) { - t[count] = c; - out.mod.push(t); - } - } - - return out.modifies(as); - }; - /** - * Perform a cross-product of a tuple stream with itself. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object):boolean} [params.filter] - An optional filter - * function for selectively including tuples in the cross product. - * @param {Array} [params.as] - The names of the output fields. - */ - - - function Cross(params) { - Transform.call(this, null, params); - } - - Cross.Definition = { - 'type': 'Cross', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'filter', - 'type': 'expr' - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['a', 'b'] - }] - }; - var prototype$c = inherits(Cross, Transform); - - prototype$c.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - data = this.value, - as = _.as || ['a', 'b'], - a = as[0], - b = as[1], - reset = !data || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter'); - - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || truthy); - } else { - out.mod = data; - } - - out.source = this.value; - return out.modifies(as); - }; - - function cross(input, a, b, filter) { - var data = [], - t = {}, - n = input.length, - i = 0, - j, - left; - - for (; i < n; ++i) { - t[a] = left = input[i]; - - for (j = 0; j < n; ++j) { - t[b] = input[j]; - - if (filter(t)) { - data.push(ingest(t)); - t = {}; - t[a] = left; - } - } - } - - return data; - } - - var Distributions = { - kde: randomKDE, - mixture: randomMixture, - normal: randomNormal, - lognormal: randomLogNormal, - uniform: randomUniform - }; - var DISTRIBUTIONS = 'distributions', - FUNCTION = 'function', - FIELD = 'field'; - /** - * Parse a parameter object for a probability distribution. - * @param {object} def - The distribution parameter object. - * @param {function():Array} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ - - function parse$2(def, data) { - var func = def[FUNCTION]; - - if (!hasOwnProperty(Distributions, func)) { - error('Unknown distribution function: ' + func); - } - - var d = Distributions[func](); - - for (var name in def) { - // if data field, extract values - if (name === FIELD) { - d.data((def.from || data()).map(def[name])); - } // if distribution mixture, recurse to parse each definition - else if (name === DISTRIBUTIONS) { - d[name](def[name].map(function (_) { - return parse$2(_, data); - })); - } // otherwise, simply set the parameter - else if (_typeof(d[name]) === FUNCTION) { - d[name](def[name]); - } - } - - return d; - } - /** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - - - function Density(params) { - Transform.call(this, null, params); - } - - var distributions = [{ - 'key': { - 'function': 'normal' - }, - 'params': [{ - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'function': 'lognormal' - }, - 'params': [{ - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'function': 'uniform' - }, - 'params': [{ - 'name': 'min', - 'type': 'number', - 'default': 0 - }, { - 'name': 'max', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'function': 'kde' - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'from', - 'type': 'data' - }, { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }] - }]; - var mixture = { - 'key': { - 'function': 'mixture' - }, - 'params': [{ - 'name': 'distributions', - 'type': 'param', - 'array': true, - 'params': distributions - }, { - 'name': 'weights', - 'type': 'number', - 'array': true - }] - }; - Density.Definition = { - 'type': 'Density', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'steps', - 'type': 'number' - }, { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, { - 'name': 'method', - 'type': 'string', - 'default': 'pdf', - 'values': ['pdf', 'cdf'] - }, { - 'name': 'distribution', - 'type': 'param', - 'params': distributions.concat(mixture) - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': ['value', 'density'] - }] - }; - var prototype$d = inherits(Density, Transform); - - prototype$d.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var dist = parse$2(_.distribution, source(pulse)), - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200, - method = _.method || 'pdf'; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - - if (!_.extent && !dist.data) { - error('Missing density extent parameter.'); - } - - method = dist[method]; - var as = _.as || ['value', 'density'], - domain = _.extent || extent(dist.data()), - values = sampleCurve(method, domain, minsteps, maxsteps).map(function (v) { - var tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return ingest(tuple); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; - }; - - function source(pulse) { - return function () { - return pulse.materialize(pulse.SOURCE).source; - }; - } // use either provided alias or accessor field name - - - function fieldNames(fields, as) { - if (!fields) return null; - return fields.map(function (f, i) { - return as[i] || accessorName(f); - }); - } - - function partition(data, groupby, field) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - t, - k, - g; // partition data points into groups - - - if (groupby == null) { - groups.push(data.map(field)); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - - g.push(field(t)); - } - } - - return groups; - } - - var Output = 'bin'; - /** - * Dot density binning for dot plot construction. - * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to bin. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ - - function DotBin(params) { - Transform.call(this, null, params); - } - - DotBin.Definition = { - 'type': 'DotBin', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'step', - 'type': 'number' - }, { - 'name': 'smooth', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'default': Output - }] - }; - var prototype$e = inherits(DotBin, Transform); - - prototype$e.transform = function (_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) { - return pulse; // early exit - } - - var source = pulse.materialize(pulse.SOURCE).source, - groups = partition(pulse.source, _.groupby, identity), - smooth = _.smooth || false, - field = _.field, - step = _.step || autostep(source, field), - sort = stableCompare(function (a, b) { - return field(a) - field(b); - }), - as = _.as || Output, - n = groups.length; // compute dotplot bins per group - - var min = Infinity, - max = -Infinity, - i = 0, - j; - - for (; i < n; ++i) { - var g = groups[i].sort(sort); - j = -1; - - var _iterator17 = _createForOfIteratorHelper(dotbin(g, step, smooth, field)), - _step17; - - try { - for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) { - var v = _step17.value; - if (v < min) min = v; - if (v > max) max = v; - g[++j][as] = v; - } - } catch (err) { - _iterator17.e(err); - } finally { - _iterator17.f(); - } - } - - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); - }; - - function autostep(data, field) { - return span(extent(data, field)) / 30; - } - /** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ - - - function Expression(params) { - Operator.call(this, null, update$2, params); - this.modified(true); - } - - inherits(Expression, Operator); - - function update$2(_) { - var expr = _.expr; - return this.value && !_.modified('expr') ? this.value : accessor(function (datum) { - return expr(datum, _); - }, accessorFields(expr), accessorName(expr)); - } - /** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ - - - function Extent(params) { - Transform.call(this, [undefined, undefined], params); - } - - Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }] - }; - var prototype$f = inherits(Extent, Transform); - - prototype$f.transform = function (_, pulse) { - var extent = this.value, - field = _.field, - min = extent[0], - max = extent[1], - mod; - mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field'); - - if (mod || min == null) { - min = +Infinity; - max = -Infinity; - } - - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, function (t) { - var v = toNumber(field(t)); - - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - - if (!Number.isFinite(min) || !Number.isFinite(max)) { - var name = accessorName(field); - if (name) name = " for field \"".concat(name, "\""); - pulse.dataflow.warn("Infinite extent".concat(name, ": [").concat(min, ", ").concat(max, "]")); - min = max = undefined; - } - - this.value = [min, max]; - }; - /** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ - - - function Subflow(pulse, parent) { - Operator.call(this, pulse); - this.parent = parent; - this.count = 0; - } - - var prototype$g = inherits(Subflow, Operator); - /** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ - - prototype$g.connect = function (target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return target.source = this; - }; - /** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ - - - prototype$g.add = function (t) { - this.count += 1; - this.value.add.push(t); - }; - /** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ - - - prototype$g.rem = function (t) { - this.count -= 1; - this.value.rem.push(t); - }; - /** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ - - - prototype$g.mod = function (t) { - this.value.mod.push(t); - }; - /** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ - - - prototype$g.init = function (pulse) { - this.value.init(pulse, pulse.NO_SOURCE); - }; - /** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ - - - prototype$g.evaluate = function () { - // assert: this.value.stamp === pulse.stamp - return this.value; - }; - /** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ - - - function Facet(params) { - Transform.call(this, {}, params); - this._keys = fastmap(); // cache previously calculated key values - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - - var a = this._targets = []; - a.active = 0; - - a.forEach = function (f) { - for (var i = 0, n = a.active; i < n; ++i) { - f(a[i], i, a); - } - }; - } - - var prototype$h = inherits(Facet, Transform); - - prototype$h.activate = function (flow) { - this._targets[this._targets.active++] = flow; - }; // parent argument provided by PreFacet subclass - - - prototype$h.subflow = function (key, flow, pulse, parent) { - var flows = this.value, - sf = hasOwnProperty(flows, key) && flows[key], - df, - p; - - if (!sf) { - p = parent || (p = this._group[key]) && p.tuple; - df = pulse.dataflow; - sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this); - df.add(sf).connect(flow(df, key, p)); - flows[key] = sf; - this.activate(sf); - } else if (sf.value.stamp < pulse.stamp) { - sf.init(pulse); - this.activate(sf); - } - - return sf; - }; - - prototype$h.clean = function () { - var flows = this.value; - - for (var _key3 in flows) { - if (flows[_key3].count === 0) { - var detach = flows[_key3].detachSubflow; - if (detach) detach(); - delete flows[_key3]; - } - } - }; - - prototype$h.initTargets = function () { - var a = this._targets, - n = a.length; - - for (var i = 0; i < n && a[i] != null; ++i) { - a[i] = null; // ensure old flows can be garbage collected - } - - a.active = 0; - }; - - prototype$h.transform = function (_, pulse) { - var _this7 = this; - - var df = pulse.dataflow, - key = _.key, - flow = _.subflow, - cache = this._keys, - rekey = _.modified('key'), - subflow = function subflow(key) { - return _this7.subflow(key, flow, pulse); - }; - - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t), - k = cache.get(id); - - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - pulse.visit(pulse.ADD, function (t) { - var k = key(t); - cache.set(tupleid(t), k); - subflow(k).add(t); - }); - - if (rekey || pulse.modified(key.fields)) { - pulse.visit(pulse.MOD, function (t) { - var id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - - if (k0 === k1) { - subflow(k1).mod(t); - } else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } else if (pulse.changed(pulse.MOD)) { - pulse.visit(pulse.MOD, function (t) { - subflow(cache.get(tupleid(t))).mod(t); - }); - } - - if (rekey) { - pulse.visit(pulse.REFLOW, function (t) { - var id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } - - if (pulse.clean()) { - df.runAfter(function () { - _this7.clean(); - - cache.clean(); - }); - } else if (cache.empty > df.cleanThreshold) { - df.runAfter(cache.clean); - } - - return pulse; - }; - /** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ - - - function Field(params) { - Operator.call(this, null, update$3, params); - } - - inherits(Field, Operator); - - function update$3(_) { - return this.value && !_.modified() ? this.value : isArray(_.name) ? array(_.name).map(function (f) { - return field(f); - }) : field(_.name, _.as); - } - /** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ - - - function Filter(params) { - Transform.call(this, fastmap(), params); - } - - Filter.Definition = { - 'type': 'Filter', - 'metadata': { - 'changes': true - }, - 'params': [{ - 'name': 'expr', - 'type': 'expr', - 'required': true - }] - }; - var prototype$i = inherits(Filter, Transform); - - prototype$i.transform = function (_, pulse) { - var df = pulse.dataflow, - cache = this.value, - // cache ids of filtered tuples - output = pulse.fork(), - add = output.add, - rem = output.rem, - mod = output.mod, - test = _.expr, - isMod = true; - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - if (!cache.has(id)) rem.push(t);else cache.delete(id); - }); - pulse.visit(pulse.ADD, function (t) { - if (test(t, _)) add.push(t);else cache.set(tupleid(t), 1); - }); - - function revisit(t) { - var id = tupleid(t), - b = test(t, _), - s = cache.get(id); - - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) { - mod.push(t); - } - } - - pulse.visit(pulse.MOD, revisit); - - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; - }; - /** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ - - - function Flatten(params) { - Transform.call(this, [], params); - } - - Flatten.Definition = { - 'type': 'Flatten', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'index', - 'type': 'string' - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }] - }; - var prototype$j = inherits(Flatten, Transform); - - prototype$j.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - as = fieldNames(fields, _.as || []), - index = _.index || null, - m = as.length; // remove any previous results - - out.rem = this.value; // generate flattened tuples - - pulse.visit(pulse.SOURCE, function (t) { - var arrays = fields.map(function (f) { - return f(t); - }), - maxlen = arrays.reduce(function (l, a) { - return Math.max(l, a.length); - }, 0), - i = 0, - j, - d, - v; - - for (; i < maxlen; ++i) { - d = derive(t); - - for (j = 0; j < m; ++j) { - d[as[j]] = (v = arrays[j][i]) == null ? null : v; - } - - if (index) { - d[index] = i; - } - - out.add.push(d); - } - }); - this.value = out.source = out.add; - if (index) out.modifies(index); - return out.modifies(as); - }; - /** - * Folds one more tuple fields into multiple tuples in which the field - * name and values are available under new 'key' and 'value' fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.fields - An array of field accessors - * for the tuple fields that should be folded. - * @param {Array} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ - - - function Fold(params) { - Transform.call(this, [], params); - } - - Fold.Definition = { - 'type': 'Fold', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['key', 'value'] - }] - }; - var prototype$k = inherits(Fold, Transform); - - prototype$k.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - fnames = fields.map(accessorName), - as = _.as || ['key', 'value'], - k = as[0], - v = as[1], - n = fields.length; - out.rem = this.value; - pulse.visit(pulse.SOURCE, function (t) { - for (var i = 0, d; i < n; ++i) { - d = derive(t); - d[k] = fnames[i]; - d[v] = fields[i](t); - out.add.push(d); - } - }); - this.value = out.source = out.add; - return out.modifies(as); - }; - /** - * Invokes a function for each data tuple and saves the results as a new field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The formula function to invoke for each tuple. - * @param {string} params.as - The field name under which to save the result. - * @param {boolean} [params.initonly=false] - If true, the formula is applied to - * added tuples only, and does not update in response to modifications. - */ - - - function Formula(params) { - Transform.call(this, null, params); - } - - Formula.Definition = { - 'type': 'Formula', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'expr', - 'type': 'expr', - 'required': true - }, { - 'name': 'as', - 'type': 'string', - 'required': true - }, { - 'name': 'initonly', - 'type': 'boolean' - }] - }; - var prototype$l = inherits(Formula, Transform); - - prototype$l.transform = function (_, pulse) { - var func = _.expr, - as = _.as, - mod = _.modified(), - flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD; - - if (mod) { - // parameters updated, need to reflow - pulse = pulse.materialize().reflow(true); - } - - if (!_.initonly) { - pulse.modifies(as); - } - - return pulse.visit(flag, function (t) { - return t[as] = func(t, _); - }); - }; - /** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ - - - function Generate(params) { - Transform.call(this, [], params); - } - - var prototype$m = inherits(Generate, Transform); - - prototype$m.transform = function (_, pulse) { - var data = this.value, - out = pulse.fork(pulse.ALL), - num = _.size - data.length, - gen = _.generator, - add, - rem, - t; - - if (num > 0) { - // need more tuples, generate and add - for (add = []; --num >= 0;) { - add.push(t = ingest(gen(_))); - data.push(t); - } - - out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem; - data = data.slice(-num); - } - - out.source = this.value = data; - return out; - }; - - var Methods = { - value: 'value', - median: median, - mean: mean, - min: min, - max: max - }; - var Empty = []; - /** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ - - function Impute(params) { - Transform.call(this, [], params); - } - - Impute.Definition = { - 'type': 'Impute', - 'metadata': { - 'changes': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'key', - 'type': 'field', - 'required': true - }, { - 'name': 'keyvals', - 'array': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'method', - 'type': 'enum', - 'default': 'value', - 'values': ['value', 'mean', 'median', 'max', 'min'] - }, { - 'name': 'value', - 'default': 0 - }] - }; - var prototype$n = inherits(Impute, Transform); - - function getValue(_) { - var m = _.method || Methods.value, - v; - - if (Methods[m] == null) { - error('Unrecognized imputation method: ' + m); - } else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return function () { - return v; - }; - } else { - return Methods[m]; - } - } - - function getField(_) { - var f = _.field; - return function (t) { - return t ? f(t) : NaN; - }; - } - - prototype$n.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - impute = getValue(_), - field = getField(_), - fName = accessorName(_.field), - kName = accessorName(_.key), - gNames = (_.groupby || []).map(accessorName), - groups = partition$1(pulse.source, _.groupby, _.key, _.keyvals), - curr = [], - prev = this.value, - m = groups.domain.length, - group, - value, - gVals, - kVal, - g, - i, - j, - l, - n, - t; - - for (g = 0, l = groups.length; g < l; ++g) { - group = groups[g]; - gVals = group.values; - value = NaN; // add tuples for missing values - - for (j = 0; j < m; ++j) { - if (group[j] != null) continue; - kVal = groups.domain[j]; - t = { - _impute: true - }; - - for (i = 0, n = gVals.length; i < n; ++i) { - t[gNames[i]] = gVals[i]; - } - - t[kName] = kVal; - t[fName] = Number.isNaN(value) ? value = impute(group, field) : value; - curr.push(ingest(t)); - } - } // update pulse with imputed tuples - - - if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); - if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); - this.value = curr; - return out; - }; - - function partition$1(data, groupby, key, keyvals) { - var get = function get(f) { - return f(t); - }, - groups = [], - domain = keyvals ? keyvals.slice() : [], - kMap = {}, - gMap = {}, - gVals, - gKey, - group, - i, - j, - k, - n, - t; - - domain.forEach(function (k, i) { - kMap[k] = i + 1; - }); - - for (i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = key(t); - j = kMap[k] || (kMap[k] = domain.push(k)); - gKey = (gVals = groupby ? groupby.map(get) : Empty) + ''; - - if (!(group = gMap[gKey])) { - group = gMap[gKey] = []; - groups.push(group); - group.values = gVals; - } - - group[j - 1] = t; - } - - groups.domain = domain; - return groups; - } - /** - * Extend input tuples with aggregate values. - * Calcuates aggregate values and joins them with the input stream. - * @constructor - */ - - - function JoinAggregate(params) { - Aggregate.call(this, params); - } - - JoinAggregate.Definition = { - 'type': 'JoinAggregate', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, { - 'name': 'key', - 'type': 'field' - }] - }; - var prototype$o = inherits(JoinAggregate, Aggregate); - - prototype$o.transform = function (_, pulse) { - var aggr = this, - mod = _.modified(), - cells; // process all input tuples to calculate aggregates - - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - cells = aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, function (t) { - aggr.add(t); - }); - } else { - cells = aggr.value = aggr.value || this.init(_); - pulse.visit(pulse.REM, function (t) { - aggr.rem(t); - }); - pulse.visit(pulse.ADD, function (t) { - aggr.add(t); - }); - } // update aggregation cells - - - aggr.changes(); // write aggregate values to input tuples - - pulse.visit(pulse.SOURCE, function (t) { - extend(t, cells[aggr.cellkey(t)].tuple); - }); - return pulse.reflow(mod).modifies(this._outputs); - }; - - prototype$o.changes = function () { - var adds = this._adds, - mods = this._mods, - i, - n; - - for (i = 0, n = this._alen; i < n; ++i) { - this.celltuple(adds[i]); - adds[i] = null; // for garbage collection - } - - for (i = 0, n = this._mlen; i < n; ++i) { - this.celltuple(mods[i]); - mods[i] = null; // for garbage collection - } - - this._alen = this._mlen = 0; // reset list of active cells - }; - /** - * Compute kernel density estimates (KDE) for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - - - function KDE(params) { - Transform.call(this, null, params); - } - - KDE.Definition = { - 'type': 'KDE', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'cumulative', - 'type': 'boolean', - 'default': false - }, { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }, { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'resolve', - 'type': 'enum', - 'values': ['shared', 'independent'], - 'default': 'independent' - }, { - 'name': 'steps', - 'type': 'number' - }, { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': ['value', 'density'] - }] - }; - var prototype$p = inherits(KDE, Transform); - - prototype$p.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var _source = pulse.materialize(pulse.SOURCE).source, - groups = partition(_source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - _bandwidth = _.bandwidth, - _method = _.cumulative ? 'cdf' : 'pdf', - as = _.as || ['value', 'density'], - _values = []; - - var _domain = _.extent, - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200; - - if (_method !== 'pdf' && _method !== 'cdf') { - error('Invalid density method: ' + _method); - } - - if (_.resolve === 'shared') { - if (!_domain) _domain = extent(_source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - - groups.forEach(function (g) { - var density = randomKDE(g, _bandwidth)[_method], - scale = _.counts ? g.length : 1, - local = _domain || extent(g); - - sampleCurve(density, local, minsteps, maxsteps).forEach(function (v) { - var t = {}; - - for (var i = 0; i < names.length; ++i) { - t[names[i]] = g.dims[i]; - } - - t[as[0]] = v[0]; - t[as[1]] = v[1] * scale; - - _values.push(ingest(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = _values; - } - - return out; - }; - /** - * Generates a key function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ - - - function Key(params) { - Operator.call(this, null, update$4, params); - } - - inherits(Key, Operator); - - function update$4(_) { - return this.value && !_.modified() ? this.value : key(_.fields, _.flat); - } - /** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ - - - function Load(params) { - Transform.call(this, [], params); - this._pending = null; - } - - var prototype$q = inherits(Load, Transform); - - prototype$q.transform = function (_, pulse) { - var _this8 = this; - - var df = pulse.dataflow; - - if (this._pending) { - // update state and return pulse - return output$1(this, pulse, this._pending); - } - - if (stop(_)) return pulse.StopPropagation; - - if (_.values) { - // parse and ingest values, return output pulse - return output$1(this, pulse, df.parse(_.values, _.format)); - } else if (_.async) { - // return promise for non-blocking async loading - var p = df.request(_.url, _.format).then(function (res) { - _this8._pending = array(res.data); - return function (df) { - return df.touch(_this8); - }; - }); - return { - async: p - }; - } else { - // return promise for synchronous loading - return df.request(_.url, _.format).then(function (res) { - return output$1(_this8, pulse, array(res.data)); - }); - } - }; - - function stop(_) { - return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format')); - } - - function output$1(op, pulse, data) { - data.forEach(ingest); - var out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; - } - /** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ - - - function Lookup(params) { - Transform.call(this, {}, params); - } - - Lookup.Definition = { - 'type': 'Lookup', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'index', - 'type': 'index', - 'params': [{ - 'name': 'from', - 'type': 'data', - 'required': true - }, { - 'name': 'key', - 'type': 'field', - 'required': true - }] - }, { - 'name': 'values', - 'type': 'field', - 'array': true - }, { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }, { - 'name': 'default', - 'default': null - }] - }; - var prototype$r = inherits(Lookup, Transform); - - prototype$r.transform = function (_, pulse) { - var out = pulse, - as = _.as, - keys = _.fields, - index = _.index, - values = _.values, - defaultValue = _.default == null ? null : _.default, - reset = _.modified(), - flag = reset ? pulse.SOURCE : pulse.ADD, - n = keys.length, - set, - m, - mods; - - if (values) { - m = values.length; - - if (n > 1 && !as) { - error('Multi-field lookup requires explicit "as" parameter.'); - } - - if (as && as.length !== n * m) { - error('The "as" parameter has too few output field names.'); - } - - as = as || values.map(accessorName); - - set = function set(t) { - for (var i = 0, k = 0, j, v; i < n; ++i) { - v = index.get(keys[i](t)); - if (v == null) for (j = 0; j < m; ++j, ++k) { - t[as[k]] = defaultValue; - } else for (j = 0; j < m; ++j, ++k) { - t[as[k]] = values[j](v); - } - } - }; - } else { - if (!as) { - error('Missing output field names.'); - } - - set = function set(t) { - for (var i = 0, v; i < n; ++i) { - v = index.get(keys[i](t)); - t[as[i]] = v == null ? defaultValue : v; - } - }; - } - - if (reset) { - out = pulse.reflow(true); - } else { - mods = keys.some(function (k) { - return pulse.modified(k.fields); - }); - flag |= mods ? pulse.MOD : 0; - } - - pulse.visit(flag, set); - return out.modifies(as); - }; - /** - * Computes global min/max extents over a collection of extents. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.extents - The input extents. - */ - - - function MultiExtent(params) { - Operator.call(this, null, update$5, params); - } - - inherits(MultiExtent, Operator); - - function update$5(_) { - if (this.value && !_.modified()) { - return this.value; - } - - var min = +Infinity, - max = -Infinity, - ext = _.extents, - i, - n, - e; - - for (i = 0, n = ext.length; i < n; ++i) { - e = ext[i]; - if (e[0] < min) min = e[0]; - if (e[1] > max) max = e[1]; - } - - return [min, max]; - } - /** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.values - The input value arrrays. - */ - - - function MultiValues(params) { - Operator.call(this, null, update$6, params); - } - - inherits(MultiValues, Operator); - - function update$6(_) { - return this.value && !_.modified() ? this.value : _.values.reduce(function (data, _) { - return data.concat(_); - }, []); - } - /** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - - function Params(params) { - Transform.call(this, null, params); - } - - inherits(Params, Transform); - - Params.prototype.transform = function (_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples - }; - /** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ - - - function Pivot(params) { - Aggregate.call(this, params); - } - - Pivot.Definition = { - 'type': 'Pivot', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'value', - 'type': 'field', - 'required': true - }, { - 'name': 'op', - 'type': 'enum', - 'values': ValidAggregateOps, - 'default': 'sum' - }, { - 'name': 'limit', - 'type': 'number', - 'default': 0 - }, { - 'name': 'key', - 'type': 'field' - }] - }; - var prototype$s = inherits(Pivot, Aggregate); - prototype$s._transform = prototype$s.transform; - - prototype$s.transform = function (_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); - }; // Shoehorn a pivot transform into an aggregate transform! - // First collect all unique pivot field values. - // Then generate aggregate fields for each output pivot field. - - - function aggregateParams(_, pulse) { - var key = _.field, - value = _.value, - op = (_.op === 'count' ? '__count__' : _.op) || 'sum', - fields = accessorFields(key).concat(accessorFields(value)), - keys = pivotKeys(key, _.limit || 0, pulse); // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - - if (pulse.changed()) _.set('__pivot__', null, null, true); - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(function () { - return op; - }), - fields: keys.map(function (k) { - return get(k, key, value, fields); - }), - as: keys.map(function (k) { - return k + ''; - }), - modified: _.modified.bind(_) - }; - } // Generate aggregate field accessor. - // Output NaN for non-existent values; aggregator will ignore! - - - function get(k, key, value, fields) { - return accessor(function (d) { - return key(d) === k ? value(d) : NaN; - }, fields, k + ''); - } // Collect (and optionally limit) all unique pivot values. - - - function pivotKeys(key, limit, pulse) { - var map = {}, - list = []; - pulse.visit(pulse.SOURCE, function (t) { - var k = key(t); - - if (!map[k]) { - map[k] = 1; - list.push(k); - } - }); // TODO? Move this comparator to vega-util? - - list.sort(function (u, v) { - return (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; - }); - return limit ? list.slice(0, limit) : list; - } - /** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array} params.field - The field - * accessor for an array of subflow tuple objects. - */ - - - function PreFacet(params) { - Facet.call(this, params); - } - - var prototype$t = inherits(PreFacet, Facet); - - prototype$t.transform = function (_, pulse) { - var _this9 = this; - - var flow = _.subflow, - field = _.field, - subflow = function subflow(t) { - return _this9.subflow(tupleid(t), flow, pulse, t); - }; - - if (_.modified('field') || field && pulse.modified(accessorFields(field))) { - error('PreFacet does not support field modification.'); - } - - this.initTargets(); // reset list of active subflows - - if (field) { - pulse.visit(pulse.MOD, function (t) { - var sf = subflow(t); - field(t).forEach(function (_) { - return sf.mod(_); - }); - }); - pulse.visit(pulse.ADD, function (t) { - var sf = subflow(t); - field(t).forEach(function (_) { - return sf.add(ingest(_)); - }); - }); - pulse.visit(pulse.REM, function (t) { - var sf = subflow(t); - field(t).forEach(function (_) { - return sf.rem(_); - }); - }); - } else { - pulse.visit(pulse.MOD, function (t) { - return subflow(t).mod(t); - }); - pulse.visit(pulse.ADD, function (t) { - return subflow(t).add(t); - }); - pulse.visit(pulse.REM, function (t) { - return subflow(t).rem(t); - }); - } - - if (pulse.clean()) { - pulse.runAfter(function () { - return _this9.clean(); - }); - } - - return pulse; - }; - /** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ - - - function Project(params) { - Transform.call(this, null, params); - } - - Project.Definition = { - 'type': 'Project', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }] - }; - var prototype$u = inherits(Project, Transform); - - prototype$u.transform = function (_, pulse) { - var fields = _.fields, - as = fieldNames(_.fields, _.as || []), - derive = fields ? function (s, t) { - return project(s, t, fields, as); - } : rederive, - out, - lut; - - if (this.value) { - lut = this.value; - } else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, function (t) { - var dt = derive(t, ingest({})); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, function (t) { - out.mod.push(derive(t, lut[tupleid(t)])); - }); - return out; - }; - - function project(s, t, fields, as) { - for (var i = 0, n = fields.length; i < n; ++i) { - t[as[i]] = fields[i](s); - } - - return t; - } - /** - * Proxy the value of another operator as a pure signal value. - * Ensures no tuples are propagated. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {*} params.value - The value to proxy, becomes the value of this operator. - */ - - - function Proxy(params) { - Transform.call(this, null, params); - } - - var prototype$v = inherits(Proxy, Transform); - - prototype$v.transform = function (_, pulse) { - this.value = _.value; - return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - }; - /** - * Generates sample quantile values from an input data stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the data field - * over which to calculate quantile values. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {Array} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ - - - function Quantile(params) { - Transform.call(this, null, params); - } - - Quantile.Definition = { - 'type': 'Quantile', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'probs', - 'type': 'number', - 'array': true - }, { - 'name': 'step', - 'type': 'number', - 'default': 0.01 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': ['prob', 'value'] - }] - }; - var prototype$w = inherits(Quantile, Transform); - var EPSILON$1 = 1e-14; - - prototype$w.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - as = _.as || ['prob', 'value']; - - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - - var source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - values = [], - step = _.step || 0.01, - p = _.probs || sequence(step / 2, 1 - EPSILON$1, step), - n = p.length; - groups.forEach(function (g) { - var q = quantiles(g, p); - - for (var i = 0; i < n; ++i) { - var t = {}; - - for (var _i4 = 0; _i4 < names.length; ++_i4) { - t[names[_i4]] = g.dims[_i4]; - } - - t[as[0]] = p[i]; - t[as[1]] = q[i]; - values.push(ingest(t)); - } - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - return out; - }; - /** - * Relays a data stream between data processing pipelines. - * If the derive parameter is set, this transform will create derived - * copies of observed tuples. This provides derived data streams in which - * modifications to the tuples do not pollute an upstream data source. - * @param {object} params - The parameters for this operator. - * @param {number} [params.derive=false] - Boolean flag indicating if - * the transform should make derived copies of incoming tuples. - * @constructor - */ - - - function Relay(params) { - Transform.call(this, null, params); - } - - var prototype$x = inherits(Relay, Transform); - - prototype$x.transform = function (_, pulse) { - var out, lut; - - if (this.value) { - lut = this.value; - } else { - out = pulse = pulse.addAll(); - lut = this.value = {}; - } - - if (_.derive) { - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, function (t) { - var dt = derive(t); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, function (t) { - var dt = lut[tupleid(t)], - k; - - for (k in t) { - dt[k] = t[k]; // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - - out.modifies(k); - } - - out.mod.push(dt); - }); - } - - return out; - }; - /** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ - - - function Sample(params) { - Transform.call(this, [], params); - this.count = 0; - } - - Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'default': 1000 - }] - }; - var prototype$y = inherits(Sample, Transform); - - prototype$y.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - mod = _.modified('size'), - num = _.size, - res = this.value, - cnt = this.count, - cap = 0, - map = res.reduce(function (m, t) { - m[tupleid(t)] = 1; - return m; - }, {}); // sample reservoir update function - - - function update(t) { - var p, idx; - - if (res.length < num) { - res.push(t); - } else { - idx = ~~((cnt + 1) * exports.random()); - - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[tupleid(p)]) out.rem.push(p); // eviction - - res[idx] = t; - } - } - - ++cnt; - } - - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, function (t) { - var id = tupleid(t); - - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - - --cnt; - }); // filter removed tuples out of the sample reservoir - - res = res.filter(function (t) { - return map[tupleid(t)] !== -1; - }); - } - - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, function (t) { - // update, but skip previously sampled tuples - if (!map[tupleid(t)]) update(t); - }); - cap = -1; - } - - if (mod && res.length > num) { - for (var i = 0, n = res.length - num; i < n; ++i) { - map[tupleid(res[i])] = -1; - out.rem.push(res[i]); - } - - res = res.slice(n); - } - - if (pulse.mod.length) { - // propagate modified tuples in the sample reservoir - pulse.visit(pulse.MOD, function (t) { - if (map[tupleid(t)]) out.mod.push(t); - }); - } - - if (pulse.add.length) { - // update sample reservoir - pulse.visit(pulse.ADD, update); - } - - if (pulse.add.length || cap < 0) { - // output newly added tuples - out.add = res.filter(function (t) { - return !map[tupleid(t)]; - }); - } - - this.count = cnt; - this.value = out.source = res; - return out; - }; - /** - * Generates data tuples for a specified sequence range of numbers. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} params.start - The first number in the sequence. - * @param {number} params.stop - The last number (exclusive) in the sequence. - * @param {number} [params.step=1] - The step size between numbers in the sequence. - */ - - - function Sequence(params) { - Transform.call(this, null, params); - } - - Sequence.Definition = { - 'type': 'Sequence', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [{ - 'name': 'start', - 'type': 'number', - 'required': true - }, { - 'name': 'stop', - 'type': 'number', - 'required': true - }, { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, { - 'name': 'as', - 'type': 'string', - 'default': 'data' - }] - }; - var prototype$z = inherits(Sequence, Transform); - - prototype$z.transform = function (_, pulse) { - if (this.value && !_.modified()) return; - var out = pulse.materialize().fork(pulse.MOD), - as = _.as || 'data'; - out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem; - this.value = sequence(_.start, _.stop, _.step || 1).map(function (v) { - var t = {}; - t[as] = v; - return ingest(t); - }); - out.add = pulse.add.concat(this.value); - return out; - }; - /** - * Propagates a new pulse without any tuples so long as the input - * pulse contains some added, removed or modified tuples. - * @param {object} params - The parameters for this operator. - * @constructor - */ - - - function Sieve(params) { - Transform.call(this, null, params); - this.modified(true); // always treat as modified - } - - var prototype$A = inherits(Sieve, Transform); - - prototype$A.transform = function (_, pulse) { - this.value = pulse.source; - return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - }; - /** - * Discretize dates to specific time units. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The data field containing date/time values. - */ - - - function TimeUnit(params) { - Transform.call(this, null, params); - } - - var OUTPUT = ['unit0', 'unit1']; - TimeUnit.Definition = { - 'type': 'TimeUnit', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field', - 'required': true - }, { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, { - 'name': 'units', - 'type': 'enum', - 'values': TIME_UNITS, - 'array': true - }, { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, { - 'name': 'maxbins', - 'type': 'number', - 'default': 40 - }, { - 'name': 'extent', - 'type': 'date', - 'array': true - }, { - 'name': 'timezone', - 'type': 'enum', - 'default': 'local', - 'values': ['local', 'utc'] - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': OUTPUT - }] - }; - var prototype$B = inherits(TimeUnit, Transform); - - prototype$B.transform = function (_, pulse) { - var field = _.field, - band = _.interval !== false, - utc = _.timezone === 'utc', - floor = this._floor(_, pulse), - offset = (utc ? utcInterval : timeInterval)(floor.unit).offset, - as = _.as || OUTPUT, - u0 = as[0], - u1 = as[1], - min = floor.start || Infinity, - max = floor.stop || -Infinity, - step = floor.step, - flag = pulse.ADD; - - if (_.modified() || pulse.modified(accessorFields(field))) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - min = Infinity; - max = -Infinity; - } - - pulse.visit(flag, function (t) { - var v = field(t), - a, - b; - - if (v == null) { - t[u0] = null; - if (band) t[u1] = null; - } else { - t[u0] = a = b = floor(v); - if (band) t[u1] = b = offset(a, step); - if (a < min) min = a; - if (b > max) max = b; - } - }); - floor.start = min; - floor.stop = max; - return pulse.modifies(band ? as : u0); - }; - - prototype$B._floor = function (_, pulse) { - var utc = _.timezone === 'utc'; // get parameters - - var _ref2 = _.units ? { - units: _.units, - step: _.step || 1 - } : timeBin({ - extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }), - units = _ref2.units, - step = _ref2.step; // check / standardize time units - - - units = timeUnits(units); - var prev = this.value || {}, - floor = (utc ? utcFloor : timeFloor)(units, step); - floor.unit = peek(units); - floor.units = units; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; - }; - /** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ - - - function TupleIndex(params) { - Transform.call(this, fastmap(), params); - } - - var prototype$C = inherits(TupleIndex, Transform); - - prototype$C.transform = function (_, pulse) { - var df = pulse.dataflow, - field = _.field, - index = this.value, - mod = true; - - function set(t) { - index.set(field(t), t); - } - - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, function (t) { - index.delete(field(t)); - }); - pulse.visit(pulse.ADD, set); - } else { - mod = false; - } - - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); - }; - /** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ - - - function Values(params) { - Transform.call(this, null, params); - } - - var prototype$D = inherits(Values, Transform); - - prototype$D.transform = function (_, pulse) { - var run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields); - - if (run) { - this.value = (_.sort ? pulse.source.slice().sort(stableCompare(_.sort)) : pulse.source).map(_.field); - } - }; - - function WindowOp(op, field, param, as) { - var fn = WindowOps[op](field, param); - return { - init: fn.init || zero, - update: function update(w, t) { - t[as] = fn.next(w); - } - }; - } - - var WindowOps = { - row_number: function row_number() { - return { - next: function next(w) { - return w.index + 1; - } - }; - }, - rank: function rank() { - var rank; - return { - init: function init() { - return rank = 1; - }, - next: function next(w) { - var i = w.index, - data = w.data; - return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank; - } - }; - }, - dense_rank: function dense_rank() { - var drank; - return { - init: function init() { - return drank = 1; - }, - next: function next(w) { - var i = w.index, - d = w.data; - return i && w.compare(d[i - 1], d[i]) ? ++drank : drank; - } - }; - }, - percent_rank: function percent_rank() { - var rank = WindowOps.rank(), - _next2 = rank.next; - return { - init: rank.init, - next: function next(w) { - return (_next2(w) - 1) / (w.data.length - 1); - } - }; - }, - cume_dist: function cume_dist() { - var cume; - return { - init: function init() { - return cume = 0; - }, - next: function next(w) { - var i = w.index, - d = w.data, - c = w.compare; - - if (cume < i) { - while (i + 1 < d.length && !c(d[i], d[i + 1])) { - ++i; - } - - cume = i; - } - - return (1 + cume) / d.length; - } - }; - }, - ntile: function ntile(field, num) { - num = +num; - if (!(num > 0)) error('ntile num must be greater than zero.'); - var cume = WindowOps.cume_dist(), - _next3 = cume.next; - return { - init: cume.init, - next: function next(w) { - return Math.ceil(num * _next3(w)); - } - }; - }, - lag: function lag(field, offset) { - offset = +offset || 1; - return { - next: function next(w) { - var i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function lead(field, offset) { - offset = +offset || 1; - return { - next: function next(w) { - var i = w.index + offset, - d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - first_value: function first_value(field) { - return { - next: function next(w) { - return field(w.data[w.i0]); - } - }; - }, - last_value: function last_value(field) { - return { - next: function next(w) { - return field(w.data[w.i1 - 1]); - } - }; - }, - nth_value: function nth_value(field, nth) { - nth = +nth; - if (!(nth > 0)) error('nth_value nth must be greater than zero.'); - return { - next: function next(w) { - var i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - prev_value: function prev_value(field) { - var prev; - return { - init: function init() { - return prev = null; - }, - next: function next(w) { - var v = field(w.data[w.index]); - return v != null ? prev = v : prev; - } - }; - }, - next_value: function next_value(field) { - var v, i; - return { - init: function init() { - return v = null, i = -1; - }, - next: function next(w) { - var d = w.data; - return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]); - } - }; - } - }; - - function find(field, data, index) { - for (var n = data.length; index < n; ++index) { - var v = field(data[index]); - if (v != null) return index; - } - - return -1; - } - - var ValidWindowOps = Object.keys(WindowOps); - - function WindowState(_) { - var self = this, - ops = array(_.ops), - fields = array(_.fields), - params = array(_.params), - as = array(_.as), - outputs = self.outputs = [], - windows = self.windows = [], - inputs = {}, - map = {}, - countOnly = true, - counts = [], - measures = []; - - function visitInputs(f) { - array(accessorFields(f)).forEach(function (_) { - return inputs[_] = 1; - }); - } - - visitInputs(_.sort); - ops.forEach(function (op, i) { - var field = fields[i], - mname = accessorName(field), - name = measureName(op, mname, as[i]); - visitInputs(field); - outputs.push(name); // Window operation - - if (hasOwnProperty(WindowOps, op)) { - windows.push(WindowOp(op, fields[i], params[i], name)); - } // Aggregate operation - else { - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - - if (op === 'count') { - counts.push(name); - return; - } - - countOnly = false; - var m = map[mname]; - - if (!m) { - m = map[mname] = []; - m.field = field; - measures.push(m); - } - - m.push(createMeasure(op, name)); - } - }); - - if (counts.length || measures.length) { - self.cell = cell(measures, counts, countOnly); - } - - self.inputs = Object.keys(inputs); - } - - var prototype$E = WindowState.prototype; - - prototype$E.init = function () { - this.windows.forEach(function (_) { - return _.init(); - }); - if (this.cell) this.cell.init(); - }; - - prototype$E.update = function (w, t) { - var self = this, - cell = self.cell, - wind = self.windows, - data = w.data, - m = wind && wind.length, - j; - - if (cell) { - for (j = w.p0; j < w.i0; ++j) { - cell.rem(data[j]); - } - - for (j = w.p1; j < w.i1; ++j) { - cell.add(data[j]); - } - - cell.set(t); - } - - for (j = 0; j < m; ++j) { - wind[j].update(w, t); - } - }; - - function cell(measures, counts, countOnly) { - measures = measures.map(function (m) { - return compileMeasures(m, m.field); - }); - var cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - - if (!countOnly) { - var n = measures.length, - a = cell.agg = Array(n), - i = 0; - - for (; i < n; ++i) { - a[i] = new measures[i](cell); - } - } - - if (cell.store) { - var store = cell.data = new TupleStore(); - } - - cell.add = function (t) { - cell.num += 1; - if (countOnly) return; - if (store) store.add(t); - - for (var _i5 = 0; _i5 < n; ++_i5) { - a[_i5].add(a[_i5].get(t), t); - } - }; - - cell.rem = function (t) { - cell.num -= 1; - if (countOnly) return; - if (store) store.rem(t); - - for (var _i6 = 0; _i6 < n; ++_i6) { - a[_i6].rem(a[_i6].get(t), t); - } - }; - - cell.set = function (t) { - var i, n; // consolidate stored values - - if (store) store.values(); // update tuple properties - - for (i = 0, n = counts.length; i < n; ++i) { - t[counts[i]] = cell.num; - } - - if (!countOnly) for (i = 0, n = a.length; i < n; ++i) { - a[i].set(t); - } - }; - - cell.init = function () { - cell.num = 0; - if (store) store.reset(); - - for (var _i7 = 0; _i7 < n; ++_i7) { - a[_i7].init(); - } - }; - - return cell; - } - /** - * Perform window calculations and write results to the input stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window. - * @param {Array} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array} params.ops - An array of strings indicating window operations to perform. - * @param {Array} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array} [params.as] - An array of output field names for window operations. - * @param {Array} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ - - - function Window(params) { - Transform.call(this, {}, params); - this._mlen = 0; - this._mods = []; - } - - Window.Definition = { - 'type': 'Window', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidWindowOps.concat(ValidAggregateOps) - }, { - 'name': 'params', - 'type': 'number', - 'null': true, - 'array': true - }, { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, { - 'name': 'frame', - 'type': 'number', - 'null': true, - 'array': true, - 'length': 2, - 'default': [null, 0] - }, { - 'name': 'ignorePeers', - 'type': 'boolean', - 'default': false - }] - }; - var prototype$F = inherits(Window, Transform); - - prototype$F.transform = function (_, pulse) { - var self = this, - state = self.state, - mod = _.modified(), - cmp = stableCompare(_.sort), - i, - n; - - this.stamp = pulse.stamp; // initialize window state - - if (!state || mod) { - state = self.state = new WindowState(_); - } // retrieve group for a tuple - - - var key = groupkey(_.groupby); - - function group(t) { - return self.group(key(t)); - } // partition input tuples - - - if (mod || pulse.modified(state.inputs)) { - self.value = {}; - pulse.visit(pulse.SOURCE, function (t) { - group(t).add(t); - }); - } else { - pulse.visit(pulse.REM, function (t) { - group(t).remove(t); - }); - pulse.visit(pulse.ADD, function (t) { - group(t).add(t); - }); - } // perform window calculations for each modified partition - - - for (i = 0, n = self._mlen; i < n; ++i) { - processPartition(self._mods[i], state, cmp, _); - } - - self._mlen = 0; - self._mods = []; // TODO don't reflow everything? - - return pulse.reflow(mod).modifies(state.outputs); - }; - - prototype$F.group = function (key) { - var self = this, - group = self.value[key]; - - if (!group) { - group = self.value[key] = SortedList(tupleid); - group.stamp = -1; - } - - if (group.stamp < self.stamp) { - group.stamp = self.stamp; - self._mods[self._mlen++] = group; - } - - return group; - }; - - function processPartition(list, state, cmp, _) { - var sort = _.sort, - range = sort && !_.ignorePeers, - frame = _.frame || [null, 0], - data = list.data(cmp), - // use cmp for stable sort - n = data.length, - i = 0, - b = range ? bisector(sort) : null, - w = { - i0: 0, - i1: 0, - p0: 0, - p1: 0, - index: 0, - data: data, - compare: sort || constant(-1) - }; - - for (state.init(); i < n; ++i) { - setWindow(w, frame, i, n); - if (range) adjustRange(w, b); - state.update(w, data[i]); - } - } - - function setWindow(w, f, i, n) { - w.p0 = w.i0; - w.p1 = w.i1; - w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); - w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); - w.index = i; - } // if frame type is 'range', adjust window for peer values - - - function adjustRange(w, bisect) { - var r0 = w.i0, - r1 = w.i1 - 1, - c = w.compare, - d = w.data, - n = d.length - 1; - if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]); - } - - var tx = /*#__PURE__*/Object.freeze({ - __proto__: null, - aggregate: Aggregate, - bin: Bin, - collect: Collect, - compare: Compare, - countpattern: CountPattern, - cross: Cross, - density: Density, - dotbin: DotBin, - expression: Expression, - extent: Extent, - facet: Facet, - field: Field, - filter: Filter, - flatten: Flatten, - fold: Fold, - formula: Formula, - generate: Generate, - impute: Impute, - joinaggregate: JoinAggregate, - kde: KDE, - key: Key, - load: Load, - lookup: Lookup, - multiextent: MultiExtent, - multivalues: MultiValues, - params: Params, - pivot: Pivot, - prefacet: PreFacet, - project: Project, - proxy: Proxy, - quantile: Quantile, - relay: Relay, - sample: Sample, - sequence: Sequence, - sieve: Sieve, - subflow: Subflow, - timeunit: TimeUnit, - tupleindex: TupleIndex, - values: Values, - window: Window - }); - var Top = 'top'; - var Left = 'left'; - var Right = 'right'; - var Bottom = 'bottom'; - var TopLeft = 'top-left'; - var TopRight = 'top-right'; - var BottomLeft = 'bottom-left'; - var BottomRight = 'bottom-right'; - var Start = 'start'; - var Middle = 'middle'; - var End = 'end'; - var X = 'x'; - var Y = 'y'; - var Group = 'group'; - var AxisRole = 'axis'; - var TitleRole = 'title'; - var FrameRole = 'frame'; - var ScopeRole = 'scope'; - var LegendRole = 'legend'; - var RowHeader = 'row-header'; - var RowFooter = 'row-footer'; - var RowTitle = 'row-title'; - var ColHeader = 'column-header'; - var ColFooter = 'column-footer'; - var ColTitle = 'column-title'; - var Padding = 'padding'; - var Symbols = 'symbol'; - var Fit = 'fit'; - var FitX = 'fit-x'; - var FitY = 'fit-y'; - var Pad = 'pad'; - var None$1 = 'none'; - var All = 'all'; - var Each = 'each'; - var Flush = 'flush'; - var Column = 'column'; - var Row = 'row'; - var gradient_id = 0; - - function resetSVGGradientId() { - gradient_id = 0; - } - - var patternPrefix = 'p_'; - - function isGradient(value) { - return value && value.gradient; - } - - function gradientRef(g, defs, base) { - var id = g.id, - type = g.gradient, - prefix = type === 'radial' ? patternPrefix : ''; // check id, assign default values as needed - - if (!id) { - id = g.id = 'gradient_' + gradient_id++; - - if (type === 'radial') { - g.x1 = get$1(g.x1, 0.5); - g.y1 = get$1(g.y1, 0.5); - g.r1 = get$1(g.r1, 0); - g.x2 = get$1(g.x2, 0.5); - g.y2 = get$1(g.y2, 0.5); - g.r2 = get$1(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get$1(g.x1, 0); - g.y1 = get$1(g.y1, 0); - g.x2 = get$1(g.x2, 1); - g.y2 = get$1(g.y2, 0); - } - } // register definition - - - defs[id] = g; // return url reference - - return 'url(' + (base || '') + '#' + prefix + id + ')'; - } - - function get$1(val, def) { - return val != null ? val : def; - } - - function Gradient(p0, p1) { - var stops = [], - gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function stop(offset, color) { - stops.push({ - offset: offset, - color: color - }); - return gradient; - } - }; - } - - var pi = Math.PI, - tau = 2 * pi, - epsilon$1 = 1e-6, - tauEpsilon = tau - epsilon$1; - - function Path() { - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - - this._ = ""; - } - - function path() { - return new Path(); - } - - Path.prototype = path.prototype = { - constructor: Path, - moveTo: function moveTo(x, y) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y); - }, - closePath: function closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - }, - lineTo: function lineTo(x, y) { - this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y); - }, - quadraticCurveTo: function quadraticCurveTo(x1, y1, x, y) { - this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - bezierCurveTo: function bezierCurveTo(x1, y1, x2, y2, x, y) { - this._ += "C" + +x1 + "," + +y1 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - arcTo: function arcTo(x1, y1, x2, y2, r) { - x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; - var x0 = this._x1, - y0 = this._y1, - x21 = x2 - x1, - y21 = y2 - y1, - x01 = x0 - x1, - y01 = y0 - y1, - l01_2 = 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 === null) { - this._ += "M" + (this._x1 = x1) + "," + (this._y1 = 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._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); - } // Otherwise, draw an arc! - else { - var x20 = x2 - x0, - y20 = y2 - y0, - l21_2 = x21 * x21 + y21 * y21, - l20_2 = x20 * x20 + y20 * y20, - l21 = Math.sqrt(l21_2), - l01 = Math.sqrt(l01_2), - l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), - t01 = l / l01, - t21 = l / l21; // If the start tangent is not coincident with (x0,y0), line to. - - if (Math.abs(t01 - 1) > epsilon$1) { - this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); - } - - this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21); - } - }, - arc: function arc(x, y, r, a0, a1, ccw) { - x = +x, y = +y, r = +r, ccw = !!ccw; - var dx = r * Math.cos(a0), - dy = r * Math.sin(a0), - x0 = x + dx, - y0 = y + dy, - cw = 1 ^ ccw, - da = 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 === null) { - this._ += "M" + x0 + "," + y0; - } // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0). - else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) { - this._ += "L" + x0 + "," + y0; - } // Is this arc empty? We’re done. - - - if (!r) return; // Does the angle go the wrong way? Flip the direction. - - if (da < 0) da = da % tau + tau; // Is this a complete circle? Draw two arcs to complete the circle. - - if (da > tauEpsilon) { - this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0); - } // Is this arc non-empty? Draw an arc! - else if (da > epsilon$1) { - this._ += "A" + r + "," + r + ",0," + +(da >= pi) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1)); - } - }, - rect: function rect(x, y, w, h) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z"; - }, - toString: function toString() { - return this._; - } - }; - - function constant$1(x) { - return function constant() { - return x; - }; - } - - var abs = Math.abs; - var atan2 = Math.atan2; - var cos = Math.cos; - var max$1 = Math.max; - var min$1 = Math.min; - var sin = Math.sin; - var sqrt = Math.sqrt; - var epsilon$2 = 1e-12; - var pi$1 = Math.PI; - var halfPi = pi$1 / 2; - var tau$1 = 2 * pi$1; - - function acos(x) { - return x > 1 ? 0 : x < -1 ? pi$1 : Math.acos(x); - } - - function asin(x) { - return x >= 1 ? halfPi : x <= -1 ? -halfPi : 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 = x1 - x0, - y10 = y1 - y0, - x32 = x3 - x2, - y32 = y3 - y2, - t = y32 * x10 - x32 * y10; - if (t * t < epsilon$2) return; - t = (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 = x0 - x1, - y01 = y0 - y1, - lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), - ox = lo * y01, - oy = -lo * x01, - x11 = x0 + ox, - y11 = y0 + oy, - x10 = x1 + ox, - y10 = y1 + oy, - x00 = (x11 + x10) / 2, - y00 = (y11 + y10) / 2, - dx = x10 - x11, - dy = y10 - y11, - d2 = dx * dx + dy * dy, - r = r1 - rc, - D = x11 * y10 - x10 * y11, - d = (dy < 0 ? -1 : 1) * sqrt(max$1(0, r * r * d2 - D * D)), - cx0 = (D * dy - dx * d) / d2, - cy0 = (-D * dx - dy * d) / d2, - cx1 = (D * dy + dx * d) / d2, - cy1 = (-D * dx + dy * d) / d2, - dx0 = cx0 - x00, - dy0 = cy0 - y00, - dx1 = cx1 - x00, - dy1 = 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 = cx1, cy0 = cy1; - return { - cx: cx0, - cy: cy0, - x01: -ox, - y01: -oy, - x11: cx0 * (r1 / r - 1), - y11: cy0 * (r1 / r - 1) - }; - } - - function d3_arc() { - var innerRadius = arcInnerRadius, - outerRadius = arcOuterRadius, - cornerRadius = constant$1(0), - padRadius = null, - startAngle = arcStartAngle, - endAngle = arcEndAngle, - padAngle = arcPadAngle, - context = null; - - function arc() { - var buffer, - r, - r0 = +innerRadius.apply(this, arguments), - r1 = +outerRadius.apply(this, arguments), - a0 = startAngle.apply(this, arguments) - halfPi, - a1 = endAngle.apply(this, arguments) - halfPi, - da = abs(a1 - a0), - cw = a1 > a0; - if (!context) context = buffer = path(); // Ensure that the outer radius is always larger than the inner radius. - - if (r1 < r0) r = r1, r1 = r0, r0 = r; // Is it a point? - - if (!(r1 > epsilon$2)) context.moveTo(0, 0); // Or is it a circle or annulus? - else if (da > tau$1 - epsilon$2) { - context.moveTo(r1 * cos(a0), r1 * sin(a0)); - context.arc(0, 0, r1, a0, a1, !cw); - - if (r0 > epsilon$2) { - context.moveTo(r0 * cos(a1), r0 * sin(a1)); - context.arc(0, 0, r0, a1, a0, cw); - } - } // Or is it a circular or annular sector? - else { - var a01 = a0, - a11 = a1, - a00 = a0, - a10 = a1, - da0 = da, - da1 = da, - ap = padAngle.apply(this, arguments) / 2, - rp = ap > epsilon$2 && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), - rc = min$1(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), - rc0 = rc, - rc1 = rc, - t0, - t1; // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. - - if (rp > epsilon$2) { - var p0 = asin(rp / r0 * sin(ap)), - p1 = asin(rp / r1 * sin(ap)); - if ((da0 -= p0 * 2) > epsilon$2) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;else da0 = 0, a00 = a10 = (a0 + a1) / 2; - if ((da1 -= p1 * 2) > epsilon$2) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;else da1 = 0, a01 = a11 = (a0 + a1) / 2; - } - - var x01 = r1 * cos(a01), - y01 = r1 * sin(a01), - x10 = r0 * cos(a10), - y10 = r0 * sin(a10); // Apply rounded corners? - - if (rc > epsilon$2) { - var x11 = r1 * cos(a11), - y11 = r1 * sin(a11), - x00 = r0 * cos(a00), - y00 = r0 * sin(a00), - oc; // Restrict the corner radius according to the sector angle. - - if (da < pi$1 && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) { - var ax = x01 - oc[0], - ay = y01 - oc[1], - bx = x11 - oc[0], - by = y11 - oc[1], - kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), - lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = min$1(rc, (r0 - lc) / (kc - 1)); - rc1 = min$1(rc, (r1 - lc) / (kc + 1)); - } - } // Is the sector collapsed to a line? - - - if (!(da1 > epsilon$2)) context.moveTo(x01, y01); // Does the sector’s outer ring have rounded corners? - else if (rc1 > epsilon$2) { - t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); - t1 = 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(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring. - else { - context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); - context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.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’s a circular sector? - // Or perhaps it’s an annular sector collapsed due to padding? - - if (!(r0 > epsilon$2) || !(da0 > epsilon$2)) context.lineTo(x10, y10); // Does the sector’s inner ring (or point) have rounded corners? - else if (rc0 > epsilon$2) { - t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); - t1 = 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(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring. - else { - context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); - context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.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 = null, buffer + "" || null; - } - - arc.centroid = function () { - var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, - a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$1 / 2; - return [cos(a) * r, sin(a) * r]; - }; - - arc.innerRadius = function (_) { - return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : innerRadius; - }; - - arc.outerRadius = function (_) { - return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : outerRadius; - }; - - arc.cornerRadius = function (_) { - return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : cornerRadius; - }; - - arc.padRadius = function (_) { - return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), arc) : padRadius; - }; - - arc.startAngle = function (_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : startAngle; - }; - - arc.endAngle = function (_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : endAngle; - }; - - arc.padAngle = function (_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : padAngle; - }; - - arc.context = function (_) { - return arguments.length ? (context = _ == null ? null : _, arc) : context; - }; - - return arc; - } - - function Linear(context) { - this._context = context; - } - - Linear.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._point = 0; - }, - lineEnd: function lineEnd() { - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function point(x, y) { - x = +x, y = +y; - - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - - case 1: - this._point = 2; - // proceed - - default: - this._context.lineTo(x, y); - - break; - } - } - }; - - function curveLinear(context) { - return new Linear(context); - } - - function x(p) { - return p[0]; - } - - function y(p) { - return p[1]; - } - - function d3_line() { - var x$1 = x, - y$1 = y, - defined = constant$1(true), - context = null, - curve = curveLinear, - output = null; - - function line(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - if (context == null) output = curve(buffer = path()); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) output.lineStart();else output.lineEnd(); - } - - if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data)); - } - - if (buffer) return output = null, buffer + "" || null; - } - - line.x = function (_) { - return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant$1(+_), line) : x$1; - }; - - line.y = function (_) { - return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant$1(+_), line) : y$1; - }; - - line.defined = function (_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant$1(!!_), line) : defined; - }; - - line.curve = function (_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; - }; - - line.context = function (_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; - }; - - return line; - } - - function d3_area() { - var x0 = x, - x1 = null, - y0 = constant$1(0), - y1 = y, - defined = constant$1(true), - context = null, - curve = curveLinear, - output = null; - - function area(data) { - var i, - j, - k, - n = data.length, - d, - defined0 = false, - buffer, - x0z = new Array(n), - y0z = new Array(n); - if (context == null) output = curve(buffer = path()); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) { - j = i; - output.areaStart(); - output.lineStart(); - } else { - output.lineEnd(); - output.lineStart(); - - for (k = i - 1; k >= j; --k) { - output.point(x0z[k], y0z[k]); - } - - output.lineEnd(); - output.areaEnd(); - } - } - - if (defined0) { - x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); - output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); - } - } - - if (buffer) return output = null, buffer + "" || null; - } - - function arealine() { - return d3_line().defined(defined).curve(curve).context(context); - } - - area.x = function (_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$1(+_), x1 = null, area) : x0; - }; - - area.x0 = function (_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$1(+_), area) : x0; - }; - - area.x1 = function (_) { - return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), area) : x1; - }; - - area.y = function (_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$1(+_), y1 = null, area) : y0; - }; - - area.y0 = function (_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$1(+_), area) : y0; - }; - - area.y1 = function (_) { - return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), area) : y1; - }; - - area.lineX0 = area.lineY0 = function () { - return arealine().x(x0).y(y0); - }; - - area.lineY1 = function () { - return arealine().x(x0).y(y1); - }; - - area.lineX1 = function () { - return arealine().x(x1).y(y0); - }; - - area.defined = function (_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant$1(!!_), area) : defined; - }; - - area.curve = function (_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; - }; - - area.context = function (_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; - }; - - return area; - } - - var circle = { - draw: function draw(context, size) { - var r = Math.sqrt(size / pi$1); - context.moveTo(r, 0); - context.arc(0, 0, r, 0, tau$1); - } - }; - - function d3_symbol() { - var type = constant$1(circle), - size = constant$1(64), - context = null; - - function symbol() { - var buffer; - if (!context) context = buffer = path(); - type.apply(this, arguments).draw(context, +size.apply(this, arguments)); - if (buffer) return context = null, buffer + "" || null; - } - - symbol.type = function (_) { - return arguments.length ? (type = typeof _ === "function" ? _ : constant$1(_), symbol) : type; - }; - - symbol.size = function (_) { - return arguments.length ? (size = typeof _ === "function" ? _ : constant$1(+_), symbol) : size; - }; - - symbol.context = function (_) { - return arguments.length ? (context = _ == null ? null : _, symbol) : context; - }; - - return symbol; - } - - function noop$1() {} - - function _point(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 = context; - } - - Basis.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function lineEnd() { - switch (this._point) { - case 3: - _point(this, this._x1, this._y1); - - // proceed - - case 2: - this._context.lineTo(this._x1, this._y1); - - break; - } - - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function point(x, y) { - x = +x, y = +y; - - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - - case 1: - this._point = 2; - break; - - case 2: - this._point = 3; - - this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); - - // proceed - - default: - _point(this, x, y); - - break; - } - - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } - }; - - function curveBasis(context) { - return new Basis(context); - } - - function BasisClosed(context) { - this._context = context; - } - - BasisClosed.prototype = { - areaStart: noop$1, - areaEnd: noop$1, - lineStart: function lineStart() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; - this._point = 0; - }, - lineEnd: function lineEnd() { - 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 point(x, y) { - x = +x, y = +y; - - switch (this._point) { - case 0: - this._point = 1; - this._x2 = x, this._y2 = y; - break; - - case 1: - this._point = 2; - this._x3 = x, this._y3 = y; - break; - - case 2: - this._point = 3; - this._x4 = x, this._y4 = y; - - this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); - - break; - - default: - _point(this, x, y); - - break; - } - - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } - }; - - function curveBasisClosed(context) { - return new BasisClosed(context); - } - - function BasisOpen(context) { - this._context = context; - } - - BasisOpen.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function lineEnd() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function point(x, y) { - x = +x, y = +y; - - switch (this._point) { - case 0: - this._point = 1; - break; - - case 1: - this._point = 2; - break; - - case 2: - this._point = 3; - var x0 = (this._x0 + 4 * this._x1 + x) / 6, - y0 = (this._y0 + 4 * this._y1 + y) / 6; - this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); - break; - - case 3: - this._point = 4; - // proceed - - default: - _point(this, x, y); - - break; - } - - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } - }; - - function curveBasisOpen(context) { - return new BasisOpen(context); - } - - function Bundle(context, beta) { - this._basis = new Basis(context); - this._beta = beta; - } - - Bundle.prototype = { - lineStart: function lineStart() { - this._x = []; - this._y = []; - - this._basis.lineStart(); - }, - lineEnd: function lineEnd() { - var x = this._x, - y = this._y, - j = x.length - 1; - - if (j > 0) { - var x0 = x[0], - y0 = y[0], - dx = x[j] - x0, - dy = y[j] - y0, - i = -1, - t; - - while (++i <= j) { - t = 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 = this._y = null; - - this._basis.lineEnd(); - }, - point: function point(x, y) { - this._x.push(+x); - - this._y.push(+y); - } - }; - - var curveBundle = function custom(beta) { - function bundle(context) { - return beta === 1 ? new Basis(context) : new Bundle(context, beta); - } - - bundle.beta = function (beta) { - return custom(+beta); - }; - - return bundle; - }(0.85); - - function point$1(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 = context; - this._k = (1 - tension) / 6; - } - - Cardinal.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function lineEnd() { - switch (this._point) { - case 2: - this._context.lineTo(this._x2, this._y2); - - break; - - case 3: - point$1(this, this._x1, this._y1); - break; - } - - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function point(x, y) { - x = +x, y = +y; - - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - - case 1: - this._point = 2; - this._x1 = x, this._y1 = y; - break; - - case 2: - this._point = 3; - // proceed - - default: - point$1(this, x, y); - break; - } - - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCardinal = function custom(tension) { - function cardinal(context) { - return new Cardinal(context, tension); - } - - cardinal.tension = function (tension) { - return custom(+tension); - }; - - return cardinal; - }(0); - - function CardinalClosed(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; - } - - CardinalClosed.prototype = { - areaStart: noop$1, - areaEnd: noop$1, - lineStart: function lineStart() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._point = 0; - }, - lineEnd: function lineEnd() { - 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 point(x, y) { - x = +x, y = +y; - - switch (this._point) { - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - - case 1: - this._point = 2; - - this._context.moveTo(this._x4 = x, this._y4 = y); - - break; - - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - - default: - point$1(this, x, y); - break; - } - - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCardinalClosed = function custom(tension) { - function cardinal(context) { - return new CardinalClosed(context, tension); - } - - cardinal.tension = function (tension) { - return custom(+tension); - }; - - return cardinal; - }(0); - - function CardinalOpen(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; - } - - CardinalOpen.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function lineEnd() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function point(x, y) { - x = +x, y = +y; - - switch (this._point) { - case 0: - this._point = 1; - break; - - case 1: - this._point = 2; - break; - - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - - case 3: - this._point = 4; - // proceed - - default: - point$1(this, x, y); - break; - } - - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCardinalOpen = function custom(tension) { - function cardinal(context) { - return new CardinalOpen(context, tension); - } - - cardinal.tension = function (tension) { - return custom(+tension); - }; - - return cardinal; - }(0); - - function point$2(that, x, y) { - var x1 = that._x1, - y1 = that._y1, - x2 = that._x2, - y2 = that._y2; - - if (that._l01_a > epsilon$2) { - var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, - n = 3 * that._l01_a * (that._l01_a + that._l12_a); - x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; - y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; - } - - if (that._l23_a > epsilon$2) { - var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, - m = 3 * that._l23_a * (that._l23_a + that._l12_a); - x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; - y2 = (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 = context; - this._alpha = alpha; - } - - CatmullRom.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function lineEnd() { - 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 !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function point(x, y) { - x = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - - case 1: - this._point = 2; - break; - - case 2: - this._point = 3; - // proceed - - default: - point$2(this, x, y); - break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCatmullRom = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); - } - - catmullRom.alpha = function (alpha) { - return custom(+alpha); - }; - - return catmullRom; - }(0.5); - - function CatmullRomClosed(context, alpha) { - this._context = context; - this._alpha = alpha; - } - - CatmullRomClosed.prototype = { - areaStart: noop$1, - areaEnd: noop$1, - lineStart: function lineStart() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function lineEnd() { - 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 point(x, y) { - x = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - - case 1: - this._point = 2; - - this._context.moveTo(this._x4 = x, this._y4 = y); - - break; - - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - - default: - point$2(this, x, y); - break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCatmullRomClosed = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); - } - - catmullRom.alpha = function (alpha) { - return custom(+alpha); - }; - - return catmullRom; - }(0.5); - - function CatmullRomOpen(context, alpha) { - this._context = context; - this._alpha = alpha; - } - - CatmullRomOpen.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function lineEnd() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function point(x, y) { - x = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: - this._point = 1; - break; - - case 1: - this._point = 2; - break; - - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - - case 3: - this._point = 4; - // proceed - - default: - point$2(this, x, y); - break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCatmullRomOpen = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); - } - - catmullRom.alpha = function (alpha) { - return custom(+alpha); - }; - - return catmullRom; - }(0.5); - - function LinearClosed(context) { - this._context = context; - } - - LinearClosed.prototype = { - areaStart: noop$1, - areaEnd: noop$1, - lineStart: function lineStart() { - this._point = 0; - }, - lineEnd: function lineEnd() { - if (this._point) this._context.closePath(); - }, - point: function point(x, y) { - x = +x, y = +y; - if (this._point) this._context.lineTo(x, y);else this._point = 1, this._context.moveTo(x, y); - } - }; - - function curveLinearClosed(context) { - return new LinearClosed(context); - } - - function sign(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 = that._x1 - that._x0, - h1 = x2 - that._x1, - s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), - s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), - p = (s0 * h1 + s1 * h0) / (h0 + h1); - return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; - } // Calculate a one-sided slope. - - - function slope2(that, t) { - var h = 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#Representations - // "you can express cubic Hermite interpolation in terms of cubic Bézier curves - // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". - - - function point$3(that, t0, t1) { - var x0 = that._x0, - y0 = that._y0, - x1 = that._x1, - y1 = that._y1, - dx = (x1 - x0) / 3; - - that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); - } - - function MonotoneX(context) { - this._context = context; - } - - MonotoneX.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; - this._point = 0; - }, - lineEnd: function lineEnd() { - switch (this._point) { - case 2: - this._context.lineTo(this._x1, this._y1); - - break; - - case 3: - point$3(this, this._t0, slope2(this, this._t0)); - break; - } - - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function point(x, y) { - var t1 = NaN; - x = +x, y = +y; - if (x === this._x1 && y === this._y1) return; // Ignore coincident points. - - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - - case 1: - this._point = 2; - break; - - case 2: - this._point = 3; - point$3(this, slope2(this, t1 = slope3(this, x, y)), t1); - break; - - default: - point$3(this, this._t0, t1 = slope3(this, x, y)); - break; - } - - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - this._t0 = t1; - } - }; - - function MonotoneY(context) { - this._context = new ReflectContext(context); - } - - (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function (x, y) { - MonotoneX.prototype.point.call(this, y, x); - }; - - function ReflectContext(context) { - this._context = context; - } - - ReflectContext.prototype = { - moveTo: function moveTo(x, y) { - this._context.moveTo(y, x); - }, - closePath: function closePath() { - this._context.closePath(); - }, - lineTo: function lineTo(x, y) { - this._context.lineTo(y, x); - }, - bezierCurveTo: function bezierCurveTo(x1, y1, x2, y2, x, y) { - this._context.bezierCurveTo(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 = context; - } - - Natural.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._x = []; - this._y = []; - }, - lineEnd: function lineEnd() { - var x = this._x, - y = this._y, - n = x.length; - - if (n) { - this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); - - if (n === 2) { - this._context.lineTo(x[1], y[1]); - } else { - var px = controlPoints(x), - py = controlPoints(y); - - for (var i0 = 0, i1 = 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 !== 0 && n === 1) this._context.closePath(); - this._line = 1 - this._line; - this._x = this._y = null; - }, - point: function point(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 = x.length - 1, - m, - a = new Array(n), - b = new Array(n), - r = new Array(n); - a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; - - for (i = 1; i < n - 1; ++i) { - a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; - } - - a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; - - for (i = 1; i < n; ++i) { - m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; - } - - a[n - 1] = r[n - 1] / b[n - 1]; - - for (i = n - 2; i >= 0; --i) { - a[i] = (r[i] - a[i + 1]) / b[i]; - } - - b[n - 1] = (x[n] + a[n - 1]) / 2; - - for (i = 0; i < n - 1; ++i) { - b[i] = 2 * x[i + 1] - a[i + 1]; - } - - return [a, b]; - } - - function curveNatural(context) { - return new Natural(context); - } - - function Step(context, t) { - this._context = context; - this._t = t; - } - - Step.prototype = { - areaStart: function areaStart() { - this._line = 0; - }, - areaEnd: function areaEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._x = this._y = NaN; - this._point = 0; - }, - lineEnd: function lineEnd() { - if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; - }, - point: function point(x, y) { - x = +x, y = +y; - - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - - case 1: - this._point = 2; - // proceed - - default: - { - if (this._t <= 0) { - this._context.lineTo(this._x, y); - - this._context.lineTo(x, y); - } else { - var x1 = this._x * (1 - this._t) + x * this._t; - - this._context.lineTo(x1, this._y); - - this._context.lineTo(x1, y); - } - - break; - } - } - - this._x = x, this._y = y; - } - }; - - function curveStep(context) { - return new Step(context, 0.5); - } - - function stepBefore(context) { - return new Step(context, 0); - } - - function stepAfter(context) { - return new Step(context, 1); - } - - var lookup = { - 'basis': { - curve: curveBasis - }, - 'basis-closed': { - curve: curveBasisClosed - }, - 'basis-open': { - curve: curveBasisOpen - }, - 'bundle': { - curve: curveBundle, - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: curveCardinal, - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: curveCardinalOpen, - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: curveCardinalClosed, - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: curveCatmullRom, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: curveCatmullRomClosed, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: curveCatmullRomOpen, - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: curveLinear - }, - 'linear-closed': { - curve: curveLinearClosed - }, - 'monotone': { - horizontal: monotoneY, - vertical: monotoneX - }, - 'natural': { - curve: curveNatural - }, - 'step': { - curve: curveStep - }, - 'step-after': { - curve: stepAfter - }, - 'step-before': { - curve: stepBefore - } - }; - - function curves(type, orientation, tension) { - var entry = hasOwnProperty(lookup, type) && lookup[type], - curve = null; - - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - - if (entry.tension && tension != null) { - curve = curve[entry.tension](tension); - } - } - - return curve; - } // Path parsing and rendering code adapted from fabric.js -- Thanks! - - - var cmdlen = { - m: 2, - l: 2, - h: 1, - v: 1, - c: 6, - s: 4, - q: 4, - t: 2, - a: 7 - }, - regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\d)([-+])/g, /\s|,|###/]; - - function pathParse(pathstr) { - var result = [], - path, - curr, - chunks, - parsed, - param, - cmd, - len, - i, - j, - n, - m; // First, break path into command sequence - - path = pathstr.slice().replace(regexp[0], '###$1').split(regexp[1]).slice(1); // Next, parse each command in turn - - for (i = 0, n = path.length; i < n; ++i) { - curr = path[i]; - chunks = curr.slice(1).trim().replace(regexp[2], '$1###$2').split(regexp[3]); - cmd = curr.charAt(0); - parsed = [cmd]; - - for (j = 0, m = chunks.length; j < m; ++j) { - if ((param = +chunks[j]) === param) { - // not NaN - parsed.push(param); - } - } - - len = cmdlen[cmd.toLowerCase()]; - - if (parsed.length - 1 > len) { - for (j = 1, m = parsed.length; j < m; j += len) { - result.push([cmd].concat(parsed.slice(j, j + len))); - } - } else { - result.push(parsed); - } - } - - return result; - } - - var DegToRad = Math.PI / 180; - var Epsilon = 1e-14; - var HalfPi = Math.PI / 2; - var Tau = Math.PI * 2; - var HalfSqrt3 = Math.sqrt(3) / 2; - var segmentCache = {}; - var bezierCache = {}; - var join = [].join; // Copied from Inkscape svgtopdf, thanks! - - function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) { - var key = join.call(arguments); - - if (segmentCache[key]) { - return segmentCache[key]; - } - - var th = rotateX * DegToRad; - var sin_th = Math.sin(th); - var cos_th = Math.cos(th); - rx = Math.abs(rx); - ry = Math.abs(ry); - var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5; - var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5; - var pl = px * px / (rx * rx) + py * py / (ry * ry); - - if (pl > 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - - var a00 = cos_th / rx; - var a01 = sin_th / rx; - var a10 = -sin_th / ry; - var a11 = cos_th / ry; - var x0 = a00 * ox + a01 * oy; - var y0 = a10 * ox + a11 * oy; - var x1 = a00 * x + a01 * y; - var y1 = a10 * x + a11 * y; - var d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - var sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - var sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - var xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); - var yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); - var th0 = Math.atan2(y0 - yc, x0 - xc); - var th1 = Math.atan2(y1 - yc, x1 - xc); - var th_arc = th1 - th0; - - if (th_arc < 0 && sweep === 1) { - th_arc += Tau; - } else if (th_arc > 0 && sweep === 0) { - th_arc -= Tau; - } - - var segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - var result = []; - - for (var i = 0; i < segs; ++i) { - var th2 = th0 + i * th_arc / segs; - var th3 = th0 + (i + 1) * th_arc / segs; - result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th]; - } - - return segmentCache[key] = result; - } - - function bezier(params) { - var key = join.call(params); - - if (bezierCache[key]) { - return bezierCache[key]; - } - - var cx = params[0], - cy = params[1], - th0 = params[2], - th1 = params[3], - rx = params[4], - ry = params[5], - sin_th = params[6], - cos_th = params[7]; - var a00 = cos_th * rx; - var a01 = -sin_th * ry; - var a10 = sin_th * rx; - var a11 = cos_th * ry; - var cos_th0 = Math.cos(th0); - var sin_th0 = Math.sin(th0); - var cos_th1 = Math.cos(th1); - var sin_th1 = Math.sin(th1); - var th_half = 0.5 * (th1 - th0); - var sin_th_h2 = Math.sin(th_half * 0.5); - var t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); - var x1 = cx + cos_th0 - t * sin_th0; - var y1 = cy + sin_th0 + t * cos_th0; - var x3 = cx + cos_th1; - var y3 = cy + sin_th1; - var x2 = x3 + t * sin_th1; - var y2 = y3 - t * cos_th1; - return bezierCache[key] = [a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3]; - } - - var temp = ['l', 0, 0, 0, 0, 0, 0, 0]; - - function scale(current, sX, sY) { - var c = temp[0] = current[0]; - - if (c === 'a' || c === 'A') { - temp[1] = sX * current[1]; - temp[2] = sY * current[2]; - temp[3] = current[3]; - temp[4] = current[4]; - temp[5] = current[5]; - temp[6] = sX * current[6]; - temp[7] = sY * current[7]; - } else if (c === 'h' || c === 'H') { - temp[1] = sX * current[1]; - } else if (c === 'v' || c === 'V') { - temp[1] = sY * current[1]; - } else { - for (var i = 1, n = current.length; i < n; ++i) { - temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; - } - } - - return temp; - } - - function pathRender(context, path, l, t, sX, sY) { - var current, - // current instruction - previous = null, - x = 0, - // current x - y = 0, - // current y - controlX = 0, - // current control point x - controlY = 0, - // current control point y - tempX, - tempY, - tempControlX, - tempControlY; - if (l == null) l = 0; - if (t == null) t = 0; - if (sX == null) sX = 1; - if (sY == null) sY = sX; - if (context.beginPath) context.beginPath(); - - for (var i = 0, len = path.length; i < len; ++i) { - current = path[i]; - - if (sX !== 1 || sY !== 1) { - current = scale(current, sX, sY); - } - - switch (current[0]) { - // first letter - case 'l': - // lineto, relative - x += current[1]; - y += current[2]; - context.lineTo(x + l, y + t); - break; - - case 'L': - // lineto, absolute - x = current[1]; - y = current[2]; - context.lineTo(x + l, y + t); - break; - - case 'h': - // horizontal lineto, relative - x += current[1]; - context.lineTo(x + l, y + t); - break; - - case 'H': - // horizontal lineto, absolute - x = current[1]; - context.lineTo(x + l, y + t); - break; - - case 'v': - // vertical lineto, relative - y += current[1]; - context.lineTo(x + l, y + t); - break; - - case 'V': - // verical lineto, absolute - y = current[1]; - context.lineTo(x + l, y + t); - break; - - case 'm': - // moveTo, relative - x += current[1]; - y += current[2]; - context.moveTo(x + l, y + t); - break; - - case 'M': - // moveTo, absolute - x = current[1]; - y = current[2]; - context.moveTo(x + l, y + t); - break; - - case 'c': - // bezierCurveTo, relative - tempX = x + current[5]; - tempY = y + current[6]; - controlX = x + current[3]; - controlY = y + current[4]; - context.bezierCurveTo(x + current[1] + l, // x1 - y + current[2] + t, // y1 - controlX + l, // x2 - controlY + t, // y2 - tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - - case 'C': - // bezierCurveTo, absolute - x = current[5]; - y = current[6]; - controlX = current[3]; - controlY = current[4]; - context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t); - break; - - case 's': - // shorthand cubic bezierCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; // calculate reflection of previous control points - - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t); // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - - controlX = x + current[1]; - controlY = y + current[2]; - x = tempX; - y = tempY; - break; - - case 'S': - // shorthand cubic bezierCurveTo, absolute - tempX = current[3]; - tempY = current[4]; // calculate reflection of previous control points - - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - - controlX = current[1]; - controlY = current[2]; - break; - - case 'q': - // quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - controlX = x + current[1]; - controlY = y + current[2]; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - - case 'Q': - // quadraticCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = current[1]; - controlY = current[2]; - break; - - case 't': - // shorthand quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[1]; - tempY = y + current[2]; - - if (previous[0].match(/[QqTt]/) === null) { - // If there is no previous command or if the previous command was not a Q, q, T or t, - // assume the control point is coincident with the current point - controlX = x; - controlY = y; - } else if (previous[0] === 't') { - // calculate reflection of previous control points for t - controlX = 2 * x - tempControlX; - controlY = 2 * y - tempControlY; - } else if (previous[0] === 'q') { - // calculate reflection of previous control points for q - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - } - - tempControlX = controlX; - tempControlY = controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = x + current[1]; - controlY = y + current[2]; - break; - - case 'T': - tempX = current[1]; - tempY = current[2]; // calculate reflection of previous control points - - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - - case 'a': - drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x + l, current[7] + y + t]); - x += current[6]; - y += current[7]; - break; - - case 'A': - drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]); - x = current[6]; - y = current[7]; - break; - - case 'z': - case 'Z': - context.closePath(); - break; - } - - previous = current; - } - } - - function drawArc(context, x, y, coords) { - var seg = segments(coords[5], // end x - coords[6], // end y - coords[0], // radius x - coords[1], // radius y - coords[3], // large flag - coords[4], // sweep flag - coords[2], // rotation - x, y); - - for (var i = 0; i < seg.length; ++i) { - var bez = bezier(seg[i]); - context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); - } - } - - var Tan30 = 0.5773502691896257; - var builtins = { - 'circle': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(r, 0); - context.arc(0, 0, r, 0, Tau); - } - }, - 'cross': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - s = r / 2.5; - context.moveTo(-r, -s); - context.lineTo(-r, s); - context.lineTo(-s, s); - context.lineTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, s); - context.lineTo(r, s); - context.lineTo(r, -s); - context.lineTo(s, -s); - context.lineTo(s, -r); - context.lineTo(-s, -r); - context.lineTo(-s, -s); - context.closePath(); - } - }, - 'diamond': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.closePath(); - } - }, - 'square': { - draw: function draw(context, size) { - var w = Math.sqrt(size), - x = -w / 2; - context.rect(x, x, w, w); - } - }, - 'arrow': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - s = r / 7, - t = r / 2.5, - v = r / 8; - context.moveTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, -v); - context.lineTo(t, -v); - context.lineTo(0, -r); - context.lineTo(-t, -v); - context.lineTo(-s, -v); - context.closePath(); - } - }, - 'wedge': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r, - o = h - r * Tan30, - b = r / 4; - context.moveTo(0, -h - o); - context.lineTo(-b, h - o); - context.lineTo(b, h - o); - context.closePath(); - } - }, - 'triangle': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r, - o = h - r * Tan30; - context.moveTo(0, -h - o); - context.lineTo(-r, h - o); - context.lineTo(r, h - o); - context.closePath(); - } - }, - 'triangle-up': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(0, -h); - context.lineTo(-r, h); - context.lineTo(r, h); - context.closePath(); - } - }, - 'triangle-down': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(0, h); - context.lineTo(-r, -h); - context.lineTo(r, -h); - context.closePath(); - } - }, - 'triangle-right': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(h, 0); - context.lineTo(-h, -r); - context.lineTo(-h, r); - context.closePath(); - } - }, - 'triangle-left': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2, - h = HalfSqrt3 * r; - context.moveTo(-h, 0); - context.lineTo(h, -r); - context.lineTo(h, r); - context.closePath(); - } - }, - 'stroke': { - draw: function draw(context, size) { - var r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(r, 0); - } - } - }; - - function symbols(_) { - return hasOwnProperty(builtins, _) ? builtins[_] : customSymbol(_); - } - - var custom = {}; - - function customSymbol(path) { - if (!hasOwnProperty(custom, path)) { - var parsed = pathParse(path); - custom[path] = { - draw: function draw(context, size) { - pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2); - } - }; - } - - return custom[path]; - } // See http://spencermortensen.com/articles/bezier-circle/ - - - var C = 0.448084975506; // C = 1 - c - - function rectangleX(d) { - return d.x; - } - - function rectangleY(d) { - return d.y; - } - - function rectangleWidth(d) { - return d.width; - } - - function rectangleHeight(d) { - return d.height; - } - - function number$1(_) { - return typeof _ === 'function' ? _ : function () { - return +_; - }; - } - - function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); - } - - function vg_rect() { - var x = rectangleX, - y = rectangleY, - width = rectangleWidth, - height = rectangleHeight, - crTL = number$1(0), - crTR = crTL, - crBL = crTL, - crBR = crTL, - context = null; - - function rectangle(_, x0, y0) { - var buffer, - x1 = x0 != null ? x0 : +x.call(this, _), - y1 = y0 != null ? y0 : +y.call(this, _), - w = +width.call(this, _), - h = +height.call(this, _), - s = Math.min(w, h) / 2, - tl = clamp(+crTL.call(this, _), 0, s), - tr = clamp(+crTR.call(this, _), 0, s), - bl = clamp(+crBL.call(this, _), 0, s), - br = clamp(+crBR.call(this, _), 0, s); - if (!context) context = buffer = path(); - - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) { - context.rect(x1, y1, w, h); - } else { - var x2 = x1 + w, - y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - rectangle.x = function (_) { - if (arguments.length) { - x = number$1(_); - return rectangle; - } else { - return x; - } - }; - - rectangle.y = function (_) { - if (arguments.length) { - y = number$1(_); - return rectangle; - } else { - return y; - } - }; - - rectangle.width = function (_) { - if (arguments.length) { - width = number$1(_); - return rectangle; - } else { - return width; - } - }; - - rectangle.height = function (_) { - if (arguments.length) { - height = number$1(_); - return rectangle; - } else { - return height; - } - }; - - rectangle.cornerRadius = function (tl, tr, br, bl) { - if (arguments.length) { - crTL = number$1(tl); - crTR = tr != null ? number$1(tr) : crTL; - crBR = br != null ? number$1(br) : crTL; - crBL = bl != null ? number$1(bl) : crTR; - return rectangle; - } else { - return crTL; - } - }; - - rectangle.context = function (_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else { - return context; - } - }; - - return rectangle; - } - - function vg_trail() { - var x, - y, - size, - defined, - context = null, - ready, - x1, - y1, - r1; - - function point(x2, y2, w2) { - var r2 = w2 / 2; - - if (ready) { - var ux = y1 - y2, - uy = x2 - x1; - - if (ux || uy) { - // get normal vector - var ud = Math.sqrt(ux * ux + uy * uy), - rx = (ux /= ud) * r1, - ry = (uy /= ud) * r1, - t = Math.atan2(uy, ux); // draw segment - - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else { - context.arc(x2, y2, r2, 0, Tau); - } - - context.closePath(); - } else { - ready = 1; - } - - x1 = x2; - y1 = y2; - r1 = r2; - } - - function trail(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - if (context == null) context = buffer = path(); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - trail.x = function (_) { - if (arguments.length) { - x = _; - return trail; - } else { - return x; - } - }; - - trail.y = function (_) { - if (arguments.length) { - y = _; - return trail; - } else { - return y; - } - }; - - trail.size = function (_) { - if (arguments.length) { - size = _; - return trail; - } else { - return size; - } - }; - - trail.defined = function (_) { - if (arguments.length) { - defined = _; - return trail; - } else { - return defined; - } - }; - - trail.context = function (_) { - if (arguments.length) { - if (_ == null) { - context = null; - } else { - context = _; - } - - return trail; - } else { - return context; - } - }; - - return trail; - } - - function value(a, b) { - return a != null ? a : b; - } - - var x$1 = function x$1(item) { - return item.x || 0; - }, - y$1 = function y$1(item) { - return item.y || 0; - }, - w = function w(item) { - return item.width || 0; - }, - h = function h(item) { - return item.height || 0; - }, - xw = function xw(item) { - return (item.x || 0) + (item.width || 0); - }, - yh = function yh(item) { - return (item.y || 0) + (item.height || 0); - }, - sa = function sa(item) { - return item.startAngle || 0; - }, - ea = function ea(item) { - return item.endAngle || 0; - }, - pa = function pa(item) { - return item.padAngle || 0; - }, - ir = function ir(item) { - return item.innerRadius || 0; - }, - or = function or(item) { - return item.outerRadius || 0; - }, - cr = function cr(item) { - return item.cornerRadius || 0; - }, - tl = function tl(item) { - return value(item.cornerRadiusTopLeft, item.cornerRadius) || 0; - }, - tr = function tr(item) { - return value(item.cornerRadiusTopRight, item.cornerRadius) || 0; - }, - br = function br(item) { - return value(item.cornerRadiusBottomRight, item.cornerRadius) || 0; - }, - bl = function bl(item) { - return value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0; - }, - sz = function sz(item) { - return value(item.size, 64); - }, - ts = function ts(item) { - return item.size || 1; - }, - def = function def(item) { - return !(item.defined === false); - }, - type = function type(item) { - return symbols(item.shape || 'circle'); - }; - - var arcShape = d3_arc().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), - areavShape = d3_area().x(x$1).y1(y$1).y0(yh).defined(def), - areahShape = d3_area().y(y$1).x1(x$1).x0(xw).defined(def), - lineShape = d3_line().x(x$1).y(y$1).defined(def), - rectShape = vg_rect().x(x$1).y(y$1).width(w).height(h).cornerRadius(tl, tr, br, bl), - symbolShape = d3_symbol().type(type).size(sz), - trailShape = vg_trail().x(x$1).y(y$1).defined(def).size(ts); - - function hasCornerRadius(item) { - return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; - } - - function arc(context, item) { - return arcShape.context(context)(item); - } - - function area(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items); - } - - function line(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items); - } - - function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); - } - - function shape(context, item) { - return (item.mark.shape || item.shape).context(context)(item); - } - - function symbol(context, item) { - return symbolShape.context(context)(item); - } - - function trail(context, items) { - return trailShape.context(context)(items); - } - - var clip_id = 1; - - function resetSVGClipId() { - clip_id = 1; - } - - function clip(renderer, item, size) { - var clip = item.clip, - defs = renderer._defs, - id = item.clip_id || (item.clip_id = 'clip' + clip_id++), - c = defs.clipping[id] || (defs.clipping[id] = { - id: id - }); - - if (isFunction(clip)) { - c.path = clip(null); - } else if (hasCornerRadius(size)) { - c.path = rectangle(null, size, 0, 0); - } else { - c.width = size.width || 0; - c.height = size.height || 0; - } - - return 'url(#' + id + ')'; - } - - function Bounds(b) { - this.clear(); - if (b) this.union(b); - } - - var prototype$G = Bounds.prototype; - - prototype$G.clone = function () { - return new Bounds(this); - }; - - prototype$G.clear = function () { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; - }; - - prototype$G.empty = function () { - return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; - }; - - prototype$G.equals = function (b) { - return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2; - }; - - prototype$G.set = function (x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; - } - - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; - } - - return this; - }; - - prototype$G.add = function (x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; - }; - - prototype$G.expand = function (d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; - }; - - prototype$G.round = function () { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; - }; - - prototype$G.scale = function (s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; - }; - - prototype$G.translate = function (dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; - }; - - prototype$G.rotate = function (angle, x, y) { - var p = this.rotatedPoints(angle, x, y); - return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); - }; - - prototype$G.rotatedPoints = function (angle, x, y) { - var x1 = this.x1, - y1 = this.y1, - x2 = this.x2, - y2 = this.y2, - cos = Math.cos(angle), - sin = Math.sin(angle), - cx = x - x * cos + y * sin, - cy = y - x * sin - y * cos; - return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy]; - }; - - prototype$G.union = function (b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; - }; - - prototype$G.intersect = function (b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; - }; - - prototype$G.encloses = function (b) { - return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2; - }; - - prototype$G.alignsWith = function (b) { - return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2); - }; - - prototype$G.intersects = function (b) { - return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2); - }; - - prototype$G.contains = function (x, y) { - return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2); - }; - - prototype$G.width = function () { - return this.x2 - this.x1; - }; - - prototype$G.height = function () { - return this.y2 - this.y1; - }; - - function Item(mark) { - this.mark = mark; - this.bounds = this.bounds || new Bounds(); - } - - function GroupItem(mark) { - Item.call(this, mark); - this.items = this.items || []; - } - - inherits(GroupItem, Item); - - function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - var c = document.createElement('canvas'); - - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } - } - - return null; - } - - function domImage() { - return typeof Image !== 'undefined' ? Image : null; - } - - function ResourceLoader(customLoader) { - this._pending = 0; - this._loader = customLoader || loader(); - } - - var prototype$H = ResourceLoader.prototype; - - prototype$H.pending = function () { - return this._pending; - }; - - function increment(loader) { - loader._pending += 1; - } - - function decrement(loader) { - loader._pending -= 1; - } - - prototype$H.sanitizeURL = function (uri) { - var loader = this; - increment(loader); - return loader._loader.sanitize(uri, { - context: 'href' - }).then(function (opt) { - decrement(loader); - return opt; - }).catch(function () { - decrement(loader); - return null; - }); - }; - - prototype$H.loadImage = function (uri) { - var loader = this, - Image = domImage(); - increment(loader); - return loader._loader.sanitize(uri, { - context: 'image' - }).then(function (opt) { - var url = opt.href; - if (!url || !Image) throw { - url: url - }; - var img = new Image(); // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - - var cors = hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; // attempt to load image resource - - img.onload = function () { - return decrement(loader); - }; - - img.onerror = function () { - return decrement(loader); - }; - - img.src = url; - return img; - }).catch(function (e) { - decrement(loader); - return { - complete: false, - width: 0, - height: 0, - src: e && e.url || '' - }; - }); - }; - - prototype$H.ready = function () { - var loader = this; - return new Promise(function (accept) { - function poll(value) { - if (!loader.pending()) accept(value);else setTimeout(function () { - poll(true); - }, 10); - } - - poll(false); - }); - }; - - function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - var sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - - return bounds; - } - - function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; - } - - var bounds, - lx, - ly, - circleThreshold = Tau - 1e-8; - - function context(_) { - bounds = _; - return context; - } - - function noop$2() {} - - function add$2(x, y) { - bounds.add(x, y); - } - - function addL(x, y) { - add$2(lx = x, ly = y); - } - - function addX(x) { - add$2(x, bounds.y1); - } - - function addY(y) { - add$2(bounds.x1, y); - } - - context.beginPath = noop$2; - context.closePath = noop$2; - context.moveTo = addL; - context.lineTo = addL; - - context.rect = function (x, y, w, h) { - add$2(x + w, y + h); - addL(x, y); - }; - - context.quadraticCurveTo = function (x1, y1, x2, y2) { - quadExtrema(lx, x1, x2, addX); - quadExtrema(ly, y1, y2, addY); - addL(x2, y2); - }; - - function quadExtrema(x0, x1, x2, cb) { - var t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); - } - - context.bezierCurveTo = function (x1, y1, x2, y2, x3, y3) { - cubicExtrema(lx, x1, x2, x3, addX); - cubicExtrema(ly, y1, y2, y3, addY); - addL(x3, y3); - }; - - function cubicExtrema(x0, x1, x2, x3, cb) { - var a = x3 - x0 + 3 * x1 - 3 * x2, - b = x0 + x2 - 2 * x1, - c = x0 - x1; - var t0 = 0, - t1 = 0, - r; // solve for parameter t - - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else { - // linear equation - t0 = 0.5 * c / b; - } // calculate position - - - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); - } - - function cubic(t, x0, x1, x2, x3) { - var s = 1 - t, - s2 = s * s, - t2 = t * t; - return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3; - } - - context.arc = function (cx, cy, r, sa, ea, ccw) { - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add$2(cx - r, cy - r); - add$2(cx + r, cy + r); - } else { - var _update = function _update(a) { - return add$2(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - }; - - var s, i; // sample end points - - _update(sa); - - _update(ea); // sample interior points aligned with 90 degrees - - - if (ea !== sa) { - sa = sa % Tau; - if (sa < 0) sa += Tau; - ea = ea % Tau; - if (ea < 0) ea += Tau; - - if (ea < sa) { - ccw = !ccw; // flip direction - - s = sa; - sa = ea; - ea = s; // swap end-points - } - - if (ccw) { - ea -= Tau; - s = sa - sa % HalfPi; - - for (i = 0; i < 4 && s > ea; ++i, s -= HalfPi) { - _update(s); - } - } else { - s = sa - sa % HalfPi + HalfPi; - - for (i = 0; i < 4 && s < ea; ++i, s = s + HalfPi) { - _update(s); - } - } - } - } - }; - - var context$1 = (context$1 = domCanvas(1, 1)) ? context$1.getContext('2d') : null; - var b = new Bounds(); - - function intersectPath(draw) { - return function (item, brush) { - // rely on (inaccurate) bounds intersection if no context - if (!context$1) return true; // add path to offscreen graphics context - - draw(context$1, item); // get bounds intersection region - - b.clear().union(item.bounds).intersect(brush).round(); - var x1 = b.x1, - y1 = b.y1, - x2 = b.x2, - y2 = b.y2; // iterate over intersection region - // perform fine grained inclusion test - - for (var _y = y1; _y <= y2; ++_y) { - for (var _x21 = x1; _x21 <= x2; ++_x21) { - if (context$1.isPointInPath(_x21, _y)) { - return true; - } - } - } // false if no hits in intersection region - - - return false; - }; - } - - function intersectPoint(item, box) { - return box.contains(item.x || 0, item.y || 0); - } - - function intersectRect(item, box) { - var x = item.x || 0, - y = item.y || 0, - w = item.width || 0, - h = item.height || 0; - return box.intersects(b.set(x, y, x + w, y + h)); - } - - function intersectRule(item, box) { - var x = item.x || 0, - y = item.y || 0, - x2 = item.x2 != null ? item.x2 : x, - y2 = item.y2 != null ? item.y2 : y; - return intersectBoxLine(box, x, y, x2, y2); - } - - function intersectBoxLine(box, x, y, u, v) { - var x1 = box.x1, - y1 = box.y1, - x2 = box.x2, - y2 = box.y2, - dx = u - x, - dy = v - y; - var t0 = 0, - t1 = 1, - p, - q, - r, - e; - - for (e = 0; e < 4; ++e) { - if (e === 0) { - p = -dx; - q = -(x1 - x); - } - - if (e === 1) { - p = dx; - q = x2 - x; - } - - if (e === 2) { - p = -dy; - q = -(y1 - y); - } - - if (e === 3) { - p = dy; - q = y2 - y; - } - - if (Math.abs(p) < 1e-10 && q < 0) return false; - r = q / p; - - if (p < 0) { - if (r > t1) return false;else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false;else if (r < t1) t1 = r; - } - } - - return true; - } - - function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; - } - - function value$1(value, dflt) { - return value == null ? dflt : value; - } - - function addStops(gradient, stops) { - var n = stops.length; - - for (var i = 0; i < n; ++i) { - gradient.addColorStop(stops[i].offset, stops[i].color); - } - - return gradient; - } - - function gradient(context, spec, bounds) { - var w = bounds.width(), - h = bounds.height(); - var gradient; - - if (spec.gradient === 'radial') { - gradient = context.createRadialGradient(bounds.x1 + value$1(spec.x1, 0.5) * w, bounds.y1 + value$1(spec.y1, 0.5) * h, Math.max(w, h) * value$1(spec.r1, 0), bounds.x1 + value$1(spec.x2, 0.5) * w, bounds.y1 + value$1(spec.y2, 0.5) * h, Math.max(w, h) * value$1(spec.r2, 0.5)); - } else { - // linear gradient - var _x22 = value$1(spec.x1, 0), - _y2 = value$1(spec.y1, 0), - x2 = value$1(spec.x2, 1), - y2 = value$1(spec.y2, 0); - - if (_x22 === x2 || _y2 === y2 || w === h) { - // axis aligned: use normal gradient - gradient = context.createLinearGradient(bounds.x1 + _x22 * w, bounds.y1 + _y2 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h); - } else { - // not axis aligned: render gradient into a pattern (#2365) - // this allows us to use normalized bounding box coordinates - var _image = domCanvas(Math.ceil(w), Math.ceil(h)), - ictx = _image.getContext('2d'); - - ictx.scale(w, h); - ictx.fillStyle = addStops(ictx.createLinearGradient(_x22, _y2, x2, y2), spec.stops); - ictx.fillRect(0, 0, w, h); - return context.createPattern(_image, 'no-repeat'); - } - } - - return addStops(gradient, spec.stops); - } - - function color(context, item, value) { - return isGradient(value) ? gradient(context, value, item.bounds) : value; - } - - function fill(context, item, opacity) { - opacity *= item.fillOpacity == null ? 1 : item.fillOpacity; - - if (opacity > 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else { - return false; - } - } - - var Empty$1 = []; - - function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - if (lw <= 0) return false; - opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity; - - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty$1); - context.lineDashOffset = item.strokeDashOffset || 0; - } - - return true; - } else { - return false; - } - } - - function compare$2(a, b) { - return a.zindex - b.zindex || a.index - b.index; - } - - function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - var items = scene.items, - output = [], - item, - i, - n; - - for (i = 0, n = items.length; i < n; ++i) { - item = items[i]; - item.index = i; - if (item.zindex) output.push(item); - } - - scene.zdirty = false; - return scene.zitems = output.sort(compare$2); - } - - function visit(scene, visitor) { - var items = scene.items, - i, - n; - if (!items || !items.length) return; - var zitems = zorder(scene); - - if (zitems && zitems.length) { - for (i = 0, n = items.length; i < n; ++i) { - if (!items[i].zindex) visitor(items[i]); - } - - items = zitems; - } - - for (i = 0, n = items.length; i < n; ++i) { - visitor(items[i]); - } - } - - function pickVisit(scene, visitor) { - var items = scene.items, - hit, - i; - if (!items || !items.length) return null; - var zitems = zorder(scene); - if (zitems && zitems.length) items = zitems; - - for (i = items.length; --i >= 0;) { - if (hit = visitor(items[i])) return hit; - } - - if (items === zitems) { - for (items = scene.items, i = items.length; --i >= 0;) { - if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; - } - } - } - - return null; - } - - function drawAll(path) { - return function (context, scene, bounds) { - visit(scene, function (item) { - if (!bounds || bounds.intersects(item.bounds)) { - drawPath(path, context, item, item); - } - }); - }; - } - - function drawOne(path) { - return function (context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) { - drawPath(path, context, scene.items[0], scene.items); - } - }; - } - - function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - if (path(context, items)) return; - blend(context, item); - - if (item.fill && fill(context, item, opacity)) { - context.fill(); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.stroke(); - } - } - - function pick(test) { - test = test || truthy; - return function (context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - return pickVisit(scene, function (item) { - var b = item.bounds; // first hit test against bounding box - - if (b && !b.contains(gx, gy) || !b) return; // if in bounding box, perform more careful test - - if (test(context, item, x, y, gx, gy)) return item; - }); - }; - } - - function hitPath(path, filled) { - return function (context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, - fill = filled == null ? item.fill : filled, - stroke = item.stroke && context.isPointInStroke, - lw, - lc; - - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - - return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y); - }; - } - - function pickPath(path) { - return pick(hitPath(path)); - } - - function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; - } - - function rotate(a) { - return 'rotate(' + a + ')'; - } - - function scale$1(scaleX, scaleY) { - return 'scale(' + scaleX + ',' + scaleY + ')'; - } - - function translateItem(item) { - return translate(item.x || 0, item.y || 0); - } - - function transformItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale$1(item.scaleX || 1, item.scaleY || 1) : ''); - } - - function markItemPath(type, shape, isect) { - function attr(emit, item) { - emit('transform', transformItem(item)); - emit('d', shape(null, item)); - } - - function bound(bounds, item) { - var x = item.x || 0, - y = item.y || 0; - shape(context(bounds), item); - boundStroke(bounds, item).translate(x, y); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw(context, item) { - var x = item.x || 0, - y = item.y || 0, - a = item.angle || 0; - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); - } - - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; - } - - var arc$1 = markItemPath('arc', arc); - - function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], - z = a[0].orient === 'horizontal' ? 'y' : 'x', - i = a.length, - min = +Infinity, - hit, - d; - - while (--i >= 0) { - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - - if (d < min) { - min = d; - hit = a[i]; - } - } - - return hit; - } - - function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), - i = a.length, - dx, - dy, - dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - - return null; - } - - function pickTrail(a, p) { - var i = a.length, - dx, - dy, - dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx * dx) return a[i]; - } - - return null; - } - - function markMultiItemPath(type, shape, tip) { - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - - function bound(bounds, mark) { - var items = mark.items; - - if (items.length === 0) { - return bounds; - } else { - shape(context(bounds), items); - return boundStroke(bounds, items[0]); - } - } - - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - - var hit = hitPath(draw); - - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, - b = scene.bounds; - - if (!items || !items.length || b && !b.contains(gx, gy)) { - return null; - } - - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; - } - - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; - } - - var area$1 = markMultiItemPath('area', area, pickArea); - - function clip$1(context, scene) { - var clip = scene.clip; - context.save(); - - if (isFunction(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else { - clipGroup(context, scene.group); - } - } - - function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); - } - - function offset$1(item) { - var sw = value$1(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; - } - - function attr(emit, item) { - emit('transform', translateItem(item)); - } - - function emitRectangle(emit, item) { - var off = offset$1(item); - emit('d', rectangle(null, item, off, off)); - } - - function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); - } - - function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - - if (item.strokeForeground) { - emitRectangle(emit, item); - } else { - emit('d', ''); - } - } - - function content(emit, item, renderer) { - var url = item.clip ? clip(renderer, item, item) : null; - emit('clip-path', url); - } - - function bound(bounds, group) { - if (!group.clip && group.items) { - var items = group.items, - m = items.length; - - for (var j = 0; j < m; ++j) { - bounds.union(items[j].bounds); - } - } - - if ((group.clip || group.width || group.height) && !group.noBound) { - bounds.add(0, 0).add(group.width || 0, group.height || 0); - } - - boundStroke(bounds, group); - return bounds.translate(group.x || 0, group.y || 0); - } - - function rectanglePath(context, group, x, y) { - var off = offset$1(group); - context.beginPath(); - rectangle(context, group, (x || 0) + off, (y || 0) + off); - } - - var hitBackground = hitPath(rectanglePath); - var hitForeground = hitPath(rectanglePath, false); - - function draw(context, scene, bounds) { - var _this10 = this; - - visit(scene, function (group) { - var gx = group.x || 0, - gy = group.y || 0, - fore = group.strokeForeground, - opacity = group.opacity == null ? 1 : group.opacity; // draw group background - - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - - if (group.fill && fill(context, group, opacity)) { - context.fill(); - } - - if (group.stroke && !fore && stroke(context, group, opacity)) { - context.stroke(); - } - } // setup graphics context, set clip and bounds - - - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); // draw group contents - - visit(group, function (item) { - _this10.draw(context, item, bounds); - }); // restore graphics context - - if (bounds) bounds.translate(gx, gy); - context.restore(); // draw group foreground - - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - - if (stroke(context, group, opacity)) { - context.stroke(); - } - } - }); - } - - function pick$1(context, scene, x, y, gx, gy) { - var _this11 = this; - - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { - return null; - } - - var cx = x * context.pixelRatio, - cy = y * context.pixelRatio; - return pickVisit(scene, function (group) { - var hit, fore, ix, dx, dy, dw, dh, b, c; // first hit test bounding box - - b = group.bounds; - if (b && !b.contains(gx, gy)) return; // passed bounds check, test rectangular clip - - dx = group.x || 0; - dy = group.y || 0; - dw = dx + (group.width || 0); - dh = dy + (group.height || 0); - c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; // adjust coordinate system - - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; // test background for rounded corner clip - - if (c && hasCornerRadius(group) && !hitBackground(context, group, cx, cy)) { - context.restore(); - return null; - } - - fore = group.strokeForeground; - ix = scene.interactive !== false; // hit test against group foreground - - if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } // hit test against contained marks - - - hit = pickVisit(group, function (mark) { - return pickMark(mark, dx, dy) ? _this11.pick(mark, x, y, dx, dy) : null; - }); // hit test against group background - - if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) { - hit = group; - } // restore state and return - - - context.restore(); - return hit || null; - }); - } - - function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y); - } - - var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1, - isect: intersectRect, - content: content, - background: background, - foreground: foreground - }; - var metadata = { - 'version': '1.1', - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink' - }; - - function getImage(item, renderer) { - var image = item.image; - - if (!image || item.url && item.url !== image.url) { - image = { - complete: false, - width: 0, - height: 0 - }; - renderer.loadImage(item.url).then(function (image) { - item.image = image; - item.image.url = item.url; - }); - } - - return image; - } - - function imageWidth(item, image) { - return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width; - } - - function imageHeight(item, image) { - return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height; - } - - function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; - } - - function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; - } - - function attr$1(emit, item, renderer) { - var img = getImage(item, renderer), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); - } - - function bound$1(bounds, item) { - var img = item.image, - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h); - return bounds.set(x, y, x + w, y + h); - } - - function draw$1(context, scene, bounds) { - var _this12 = this; - - visit(scene, function (item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - var img = getImage(item, _this12), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - opacity, - ar0, - ar1, - t; - - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); - } - - var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick(), - isect: truthy, - // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset - }; - var line$1 = markMultiItemPath('line', line, pickLine); - - function attr$2(emit, item) { - var sx = item.scaleX || 1, - sy = item.scaleY || 1; - - if (sx !== 1 || sy !== 1) { - emit('vector-effect', 'non-scaling-stroke'); - } - - emit('transform', transformItem(item)); - emit('d', item.path); - } - - function path$1(context, item) { - var path = item.path; - if (path == null) return true; - var x = item.x || 0, - y = item.y || 0, - sx = item.scaleX || 1, - sy = item.scaleY || 1, - a = (item.angle || 0) * DegToRad, - cache = item.pathCache; - - if (!cache || cache.path !== path) { - (item.pathCache = cache = pathParse(path)).path = path; - } - - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else { - pathRender(context, cache, x, y, sx, sy); - } - } - - function bound$2(bounds, item) { - path$1(context(bounds), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, item.x || 0, item.y || 0); - } - - return bounds; - } - - var path$2 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(path$1), - pick: pickPath(path$1), - isect: intersectPath(path$1) - }; - - function attr$3(emit, item) { - emit('d', rectangle(null, item)); - } - - function bound$3(bounds, item) { - var x, y; - return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item); - } - - function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); - } - - var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect - }; - - function attr$4(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); - } - - function bound$4(bounds, item) { - var x1, y1; - return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item); - } - - function path$3(context, item, opacity) { - var x1, y1, x2, y2; - - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - - return false; - } - - function draw$3(context, scene, bounds) { - visit(scene, function (item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - var opacity = item.opacity == null ? 1 : item.opacity; - - if (opacity && path$3(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); - } - - function hit(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path$3(context, item, 1) && context.isPointInStroke(x, y); - } - - var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick(hit), - isect: intersectRule - }; - var shape$1 = markItemPath('shape', shape); - var symbol$1 = markItemPath('symbol', symbol, intersectPoint); // memoize text width measurement - - var widthCache = lruCache(); - var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas - }; - useCanvas(true); - - function useCanvas(use) { - textMetrics.width = use && context$1 ? measureWidth : estimateWidth; - } // make dumb, simple estimate if no canvas is available - - - function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); - } - - function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); - } // measure text width if canvas is available - - - function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item)); - } - - function _measureWidth(text, currentFont) { - var key = "(".concat(currentFont, ") ").concat(text); - var width = widthCache.get(key); - - if (width === undefined) { - context$1.font = currentFont; - width = context$1.measureText(text).width; - widthCache.set(key, width); - } - - return width; - } - - function fontSize(item) { - return item.fontSize != null ? +item.fontSize || 0 : 11; - } - - function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; - } - - function lineArray(_) { - return isArray(_) ? _.length > 1 ? _ : _[0] : _; - } - - function textLines(item) { - return lineArray(item.lineBreak && item.text && !isArray(item.text) ? item.text.split(item.lineBreak) : item.text); - } - - function multiLineOffset(item) { - var tl = textLines(item); - return (isArray(tl) ? tl.length - 1 : 0) * lineHeight(item); - } - - function textValue(item, line) { - var text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate$1(item, text) : text; - } - - function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - var currentFont = font(item); - return function (text) { - return _measureWidth(text, currentFont); - }; - } else { - // we are relying on estimates - var currentFontHeight = fontSize(item); - return function (text) { - return _estimateWidth(text, currentFontHeight); - }; - } - } - - function truncate$1(item, text) { - var limit = +item.limit, - width = widthGetter(item); - if (width(text) < limit) return text; - var ellipsis = item.ellipsis || "\u2026", - rtl = item.dir === 'rtl', - lo = 0, - hi = text.length, - mid; - limit -= width(ellipsis); - - if (rtl) { - while (lo < hi) { - mid = lo + hi >>> 1; - if (width(text.slice(mid)) > limit) lo = mid + 1;else hi = mid; - } - - return ellipsis + text.slice(lo); - } else { - while (lo < hi) { - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid;else hi = mid - 1; - } - - return text.slice(0, lo) + ellipsis; - } - } - - function fontFamily(item, quote) { - var font = item.font; - return (quote && font ? String(font).replace(/"/g, '\'') : font) || 'sans-serif'; - } - - function font(item, quote) { - return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote); - } - - function offset$2(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, - h = fontSize(item); - return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0); - } - - var textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' - }; - var tempBounds = new Bounds(); - - function anchorPoint(item) { - var x = item.x || 0, - y = item.y || 0, - r = item.radius || 0, - t; - - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; - } - - function attr$5(emit, item) { - var dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item), - p = anchorPoint(item), - x = p.x1, - y = p.y1, - a = item.angle || 0, - t; - emit('text-anchor', textAlign[item.align] || 'start'); - - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else { - t = translate(x + dx, y + dy); - } - - emit('transform', t); - } - - function bound$5(bounds, item, mode) { - var h = textMetrics.height(item), - a = item.align, - p = anchorPoint(item), - x = p.x1, - y = p.y1, - dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item) - Math.round(0.8 * h), - // use 4/5 offset - tl = textLines(item), - w; // get dimensions - - if (isArray(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce(function (w, t) { - return Math.max(w, textMetrics.width(item, t)); - }, 0); - } else { - // single-line text - w = textMetrics.width(item, tl); - } // horizontal alignment - - - if (a === 'center') { - dx -= w / 2; - } else if (a === 'right') { - dx -= w; - } - - bounds.set(dx += x, dy += y, dx + w, dy + h); - - if (item.angle && !mode) { - bounds.rotate(item.angle * DegToRad, x, y); - } else if (mode === 2) { - return bounds.rotatedPoints(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw$4(context, scene, bounds) { - visit(scene, function (item) { - var opacity = item.opacity == null ? 1 : item.opacity, - p, - x, - y, - i, - lh, - tl, - str; - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; - context.font = font(item); - context.textAlign = item.align || 'left'; - p = anchorPoint(item); - x = p.x1, y = p.y1; - - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - - x += item.dx || 0; - y += (item.dy || 0) + offset$2(item); - tl = textLines(item); - blend(context, item); - - if (isArray(tl)) { - lh = lineHeight(item); - - for (i = 0; i < tl.length; ++i) { - str = textValue(item, tl[i]); - - if (item.fill && fill(context, item, opacity)) { - context.fillText(str, x, y); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.strokeText(str, x, y); - } - - y += lh; - } - } else { - str = textValue(item, tl); - - if (item.fill && fill(context, item, opacity)) { - context.fillText(str, x, y); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.strokeText(str, x, y); - } - } - - if (item.angle) context.restore(); - }); - } - - function hit$1(context, item, x, y, gx, gy) { - if (item.fontSize <= 0) return false; - if (!item.angle) return true; // bounds sufficient if no rotation - // project point into space of unrotated bounds - - var p = anchorPoint(item), - ax = p.x1, - ay = p.y1, - b = bound$5(tempBounds, item, 1), - a = -item.angle * DegToRad, - cos = Math.cos(a), - sin = Math.sin(a), - px = cos * gx - sin * gy + (ax - cos * ax + sin * ay), - py = sin * gx + cos * gy + (ay - sin * ax - cos * ay); - return b.contains(px, py); - } - - function intersectText(item, box) { - var p = bound$5(tempBounds, item, 2); - return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]); - } - - var text = { - type: 'text', - tag: 'text', - nested: false, - attr: attr$5, - bound: bound$5, - draw: draw$4, - pick: pick(hit$1), - isect: intersectText - }; - var trail$1 = markMultiItemPath('trail', trail, pickTrail); - var Marks = { - arc: arc$1, - area: area$1, - group: group, - image: image, - line: line$1, - path: path$2, - rect: rect, - rule: rule, - shape: shape$1, - symbol: symbol$1, - text: text, - trail: trail$1 - }; - - function boundItem(item, func, opt) { - var type = Marks[item.mark.marktype], - bound = func || type.bound; - if (type.nested) item = item.mark; - return bound(item.bounds || (item.bounds = new Bounds()), item, opt); - } - - var DUMMY = { - mark: null - }; - - function boundMark(mark, bounds, opt) { - var type = Marks[mark.marktype], - bound = type.bound, - items = mark.items, - hasItems = items && items.length, - i, - n, - item, - b; - - if (type.nested) { - if (hasItems) { - item = items[0]; - } else { - // no items, fake it - DUMMY.mark = mark; - item = DUMMY; - } - - b = boundItem(item, bound, opt); - bounds = bounds && bounds.union(b) || b; - return bounds; - } - - bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds(); - - if (hasItems) { - for (i = 0, n = items.length; i < n; ++i) { - bounds.union(boundItem(items[i], bound, opt)); - } - } - - return mark.bounds = bounds; - } - - var keys = ['marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', 'x', 'y', 'width', 'height', 'align', 'baseline', // layout - 'fill', 'fillOpacity', 'opacity', 'blend', // fill - 'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap', // stroke - 'strokeDash', 'strokeDashOffset', // stroke dash - 'strokeForeground', 'strokeOffset', // group - 'startAngle', 'endAngle', 'innerRadius', 'outerRadius', // arc - 'cornerRadius', 'padAngle', // arc, rect - 'cornerRadiusTopLeft', 'cornerRadiusTopRight', // rect, group - 'cornerRadiusBottomLeft', 'cornerRadiusBottomRight', 'interpolate', 'tension', 'orient', 'defined', // area, line - 'url', 'aspect', 'smooth', // image - 'path', 'scaleX', 'scaleY', // path - 'x2', 'y2', // rule - 'size', 'shape', // symbol - 'text', 'angle', 'theta', 'radius', 'dir', 'dx', 'dy', // text - 'ellipsis', 'limit', 'lineBreak', 'lineHeight', 'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant', // font - 'description', 'aria', 'ariaRole', 'ariaRoleDescription' // aria - ]; - - function sceneToJSON(scene, indent) { - return JSON.stringify(scene, keys, indent); - } - - function sceneFromJSON(json) { - var scene = typeof json === 'string' ? JSON.parse(json) : json; - return initialize(scene); - } - - function initialize(scene) { - var type = scene.marktype, - items = scene.items, - parent, - i, - n; - - if (items) { - for (i = 0, n = items.length; i < n; ++i) { - parent = type ? 'mark' : 'group'; - items[i][parent] = scene; - if (items[i].zindex) items[i][parent].zdirty = true; - if ('group' === (type || parent)) initialize(items[i]); - } - } - - if (type) boundMark(scene); - return scene; - } - - function Scenegraph(scene) { - if (arguments.length) { - this.root = sceneFromJSON(scene); - } else { - this.root = createMark({ - marktype: 'group', - name: 'root', - role: 'frame' - }); - this.root.items = [new GroupItem(this.root)]; - } - } - - var prototype$I = Scenegraph.prototype; - - prototype$I.toJSON = function (indent) { - return sceneToJSON(this.root, indent || 0); - }; - - prototype$I.mark = function (markdef, group, index) { - group = group || this.root.items[0]; - var mark = createMark(markdef, group); - group.items[index] = mark; - if (mark.zindex) mark.group.zdirty = true; - return mark; - }; - - function createMark(def, group) { - var mark = { - bounds: new Bounds(), - clip: !!def.clip, - group: group, - interactive: def.interactive === false ? false : true, - items: [], - marktype: def.marktype, - name: def.name || undefined, - role: def.role || undefined, - zindex: def.zindex || 0 - }; // add accessibility properties if defined - - if (def.aria != null) { - mark.aria = def.aria; - } - - if (def.description) { - mark.description = def.description; - } - - return mark; - } // create a new DOM element - - - function domCreate(doc, tag, ns) { - if (!doc && typeof document !== 'undefined' && document.createElement) { - doc = document; - } - - return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; - } // find first child element with matching tag - - - function domFind(el, tag) { - tag = tag.toLowerCase(); - var nodes = el.childNodes, - i = 0, - n = nodes.length; - - for (; i < n; ++i) { - if (nodes[i].tagName.toLowerCase() === tag) { - return nodes[i]; - } - } - } // retrieve child element at given index - // create & insert if doesn't exist or if tags do not match - - - function domChild(el, index, tag, ns) { - var a = el.childNodes[index], - b; - - if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) { - b = a || null; - a = domCreate(el.ownerDocument, tag, ns); - el.insertBefore(a, b); - } - - return a; - } // remove all child elements at or above the given index - - - function domClear(el, index) { - var nodes = el.childNodes, - curr = nodes.length; - - while (curr > index) { - el.removeChild(nodes[--curr]); - } - - return el; - } // generate css class name for mark - - - function cssClass(mark) { - return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : ''); - } - - function point$4(event, el) { - var rect = el.getBoundingClientRect(); - return [event.clientX - rect.left - (el.clientLeft || 0), event.clientY - rect.top - (el.clientTop || 0)]; - } - - function resolveItem(item, event, el, origin) { - var mark = item && item.mark, - mdef, - p; - - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point$4(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - - while (item = item.mark.group) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - - item = mdef.tip(mark.items, p); - } - - return item; - } - /** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ - - - function Handler(customLoader, customTooltip) { - this._active = null; - this._handlers = {}; - this._loader = customLoader || loader(); - this._tooltip = customTooltip || defaultTooltip; - } // The default tooltip display handler. - // Sets the HTML title attribute on the visualization container. - - - function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); - } - - var prototype$J = Handler.prototype; - /** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ - - prototype$J.initialize = function (el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); - }; - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - - - prototype$J.element = function () { - return this._el; - }; - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - - - prototype$J.canvas = function () { - return this._el && this._el.firstChild; - }; - /** - * Get / set the origin coordinates of the visualization. - */ - - - prototype$J.origin = function (origin) { - if (arguments.length) { - this._origin = origin || [0, 0]; - return this; - } else { - return this._origin.slice(); - } - }; - /** - * Get / set the scenegraph root. - */ - - - prototype$J.scene = function (scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; - }; - /** - * Add an event handler. Subclasses should override this method. - */ - - - prototype$J.on = function () - /*type, handler*/ - {}; - /** - * Remove an event handler. Subclasses should override this method. - */ - - - prototype$J.off = function () - /*type, handler*/ - {}; - /** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ - - - prototype$J._handlerIndex = function (h, type, handler) { - for (var i = h ? h.length : 0; --i >= 0;) { - if (h[i].type === type && (!handler || h[i].handler === handler)) { - return i; - } - } - - return -1; - }; - /** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ - - - prototype$J.handlers = function (type) { - var h = this._handlers, - a = []; - - if (type) { - a.push.apply(a, h[this.eventName(type)]); - } else { - for (var k in h) { - a.push.apply(a, h[k]); - } - } - - return a; - }; - /** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ - - - prototype$J.eventName = function (name) { - var i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); - }; - /** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ - - - prototype$J.handleHref = function (event, item, href) { - this._loader.sanitize(href, { - context: 'href' - }).then(function (opt) { - var e = new MouseEvent(event.type, event), - a = domCreate(null, 'a'); - - for (var name in opt) { - a.setAttribute(name, opt[name]); - } - - a.dispatchEvent(e); - }).catch(function () { - /* do nothing */ - }); - }; - /** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ - - - prototype$J.handleTooltip = function (event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - - var _value16 = show && item && item.tooltip || null; - - this._tooltip.call(this._obj, this, event, item, _value16); - } - }; - /** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ - - - prototype$J.getItemBoundingClientRect = function (item) { - var el = this.canvas(); - if (!el) return; - var rect = el.getBoundingClientRect(), - origin = this._origin, - bounds = item.bounds, - width = bounds.width(), - height = bounds.height(); - var x = bounds.x1 + origin[0] + rect.left, - y = bounds.y1 + origin[1] + rect.top; // translate coordinate for each parent group - - while (item.mark && (item = item.mark.group)) { - x += item.x || 0; - y += item.y || 0; - } // return DOMRect-compatible bounding box - - - return { - x: x, - y: y, - width: width, - height: height, - left: x, - top: y, - right: x + width, - bottom: y + height - }; - }; - /** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ - - - function Renderer(loader) { - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); - } - - var prototype$K = Renderer.prototype; - /** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ - - prototype$K.initialize = function (el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); - }; - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - - - prototype$K.element = function () { - return this._el; - }; - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - - - prototype$K.canvas = function () { - return this._el && this._el.firstChild; - }; - /** - * Get / set the background color. - */ - - - prototype$K.background = function (bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; - }; - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ - - - prototype$K.resize = function (width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [0, 0]; - this._scale = scaleFactor || 1; - return this; - }; - /** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ - - - prototype$K.dirty = function () - /*item*/ - {}; - /** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Renderer} - This renderer instance. - */ - - - prototype$K.render = function (scene) { - var r = this; // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - - r._call = function () { - r._render(scene); - }; // invoke the renderer - - - r._call(); // clear the cached call for garbage collection - // async redraws will stash their own copy - - - r._call = null; - return r; - }; - /** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - */ - - - prototype$K._render = function () - /*scene*/ - {// subclasses to override - }; - /** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Promise} - A Promise that resolves when rendering is complete. - */ - - - prototype$K.renderAsync = function (scene) { - var r = this.render(scene); - return this._ready ? this._ready.then(function () { - return r; - }) : Promise.resolve(r); - }; - /** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ - - - prototype$K._load = function (method, uri) { - var r = this, - p = r._loader[method](uri); - - if (!r._ready) { - // re-render the scene when loading completes - var call = r._call; - r._ready = r._loader.ready().then(function (redraw) { - if (redraw) call(); - r._ready = null; - }); - } - - return p; - }; - /** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ - - - prototype$K.sanitizeURL = function (uri) { - return this._load('sanitizeURL', uri); - }; - /** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ - - - prototype$K.loadImage = function (uri) { - return this._load('loadImage', uri); - }; - - var KeyDownEvent = 'keydown'; - var KeyPressEvent = 'keypress'; - var KeyUpEvent = 'keyup'; - var DragEnterEvent = 'dragenter'; - var DragLeaveEvent = 'dragleave'; - var DragOverEvent = 'dragover'; - var MouseDownEvent = 'mousedown'; - var MouseUpEvent = 'mouseup'; - var MouseMoveEvent = 'mousemove'; - var MouseOutEvent = 'mouseout'; - var MouseOverEvent = 'mouseover'; - var ClickEvent = 'click'; - var DoubleClickEvent = 'dblclick'; - var WheelEvent = 'wheel'; - var MouseWheelEvent = 'mousewheel'; - var TouchStartEvent = 'touchstart'; - var TouchMoveEvent = 'touchmove'; - var TouchEndEvent = 'touchend'; - var Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent]; - var TooltipShowEvent = MouseMoveEvent; - var TooltipHideEvent = MouseOutEvent; - var HrefEvent = ClickEvent; - - function CanvasHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; - } - - var prototype$L = inherits(CanvasHandler, Handler); - - prototype$L.initialize = function (el, origin, obj) { - var _this13 = this; - - this._canvas = el && domFind(el, 'canvas'); // add minimal events required for proper state management - - [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent].forEach(function (type) { - return eventListenerCheck(_this13, type); - }); - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - var eventBundle = function eventBundle(type) { - return type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type]; - }; // lazily add listeners to the canvas as needed - - - function eventListenerCheck(handler, type) { - eventBundle(type).forEach(function (_) { - return addEventListener(handler, _); - }); - } - - function addEventListener(handler, type) { - var canvas = handler.canvas(); - - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] ? function (evt) { - return handler[type](evt); - } : function (evt) { - return handler.fire(type, evt); - }); - } - } // return the backing canvas instance - - - prototype$L.canvas = function () { - return this._canvas; - }; // retrieve the current canvas context - - - prototype$L.context = function () { - return this._canvas.getContext('2d'); - }; // supported events - - - prototype$L.events = Events; - - function move(moveEvent, overEvent, outEvent) { - return function (evt) { - var a = this._active, - p = this.pickEvent(evt); - - if (p === a) { - // active item and picked item are the same - this.fire(moveEvent, evt); // fire move - } else { - // active item and picked item are different - if (!a || !a.exit) { - // fire out for prior active item - // suppress if active item was removed from scene - this.fire(outEvent, evt); - } - - this._active = p; // set new active item - - this.fire(overEvent, evt); // fire over for new active item - - this.fire(moveEvent, evt); // fire move for new active item - } - }; - } - - function inactive(type) { - return function (evt) { - this.fire(type, evt); - this._active = null; - }; - } // to keep old versions of firefox happy - - - prototype$L.DOMMouseScroll = function (evt) { - this.fire(MouseWheelEvent, evt); - }; - - prototype$L.mousemove = move(MouseMoveEvent, MouseOverEvent, MouseOutEvent); - prototype$L.dragover = move(DragOverEvent, DragEnterEvent, DragLeaveEvent); - prototype$L.mouseout = inactive(MouseOutEvent); - prototype$L.dragleave = inactive(DragLeaveEvent); - - prototype$L.mousedown = function (evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); - }; - - prototype$L.click = function (evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } - }; - - prototype$L.touchstart = function (evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - - if (this._first) { - this._active = this._touch; - this._first = false; - } - - this.fire(TouchStartEvent, evt, true); - }; - - prototype$L.touchmove = function (evt) { - this.fire(TouchMoveEvent, evt, true); - }; - - prototype$L.touchend = function (evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; - }; // fire an event - - - prototype$L.fire = function (type, evt, touch) { - var a = touch ? this._touch : this._active, - h = this._handlers[type]; // set event type relative to scenegraph items - - evt.vegaType = type; // handle hyperlinks and tooltips first - - if (type === HrefEvent && a && a.href) { - this.handleHref(evt, a, a.href); - } else if (type === TooltipShowEvent || type === TooltipHideEvent) { - this.handleTooltip(evt, a, type !== TooltipHideEvent); - } // invoke all registered handlers - - - if (h) { - for (var i = 0, len = h.length; i < len; ++i) { - h[i].handler.call(this._obj, evt, a); - } - } - }; // add an event handler - - - prototype$L.on = function (type, handler) { - var name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - eventListenerCheck(this, type); - (h[name] || (h[name] = [])).push({ - type: type, - handler: handler - }); - } - - return this; - }; // remove an event handler - - - prototype$L.off = function (type, handler) { - var name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - h.splice(i, 1); - } - - return this; - }; - - prototype$L.pickEvent = function (evt) { - var p = point$4(evt, this._canvas), - o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); - }; // find the scenegraph item at the current mouse position - // x, y -- the absolute x, y mouse coordinates on the canvas element - // gx, gy -- the relative coordinates within the current group - - - prototype$L.pick = function (scene, x, y, gx, gy) { - var g = this.context(), - mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); - }; - - function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; - } - - var pixelRatio = devicePixelRatio(); - - function resize(canvas, width, height, origin, scaleFactor, opt) { - var inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null, - context = canvas.getContext('2d'), - ratio = inDOM ? pixelRatio : scaleFactor; - canvas.width = width * ratio; - canvas.height = height * ratio; - - for (var _key4 in opt) { - context[_key4] = opt[_key4]; - } - - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - } - - context.pixelRatio = ratio; - context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); - return canvas; - } - - function CanvasRenderer(loader) { - Renderer.call(this, loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); - } - - var prototype$M = inherits(CanvasRenderer, Renderer), - base = Renderer.prototype; - - prototype$M.initialize = function (el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - this._canvas = this._options.externalContext ? null : domCanvas(1, 1, this._options.type); // instantiate a small canvas - - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - - this._canvas.setAttribute('class', 'marks'); - } // this method will invoke resize to size the canvas appropriately - - - return base.initialize.call(this, el, width, height, origin, scaleFactor); - }; - - prototype$M.resize = function (width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - - if (this._canvas) { - // configure canvas size and transform - resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); - } else { - // external context needs to be scaled and positioned to origin - var ctx = this._options.externalContext; - if (!ctx) error('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - - this._redraw = true; - return this; - }; - - prototype$M.canvas = function () { - return this._canvas; - }; - - prototype$M.context = function () { - return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null); - }; - - prototype$M.dirty = function (item) { - var b = this._tempb.clear().union(item.bounds), - g = item.mark.group; - - while (g) { - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; - } - - this._dirty.union(b); - }; - - function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); // align to base pixel grid in case of non-integer scaling (#2425) - - if (g.pixelRatio % 1) { - b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - } // to avoid artifacts translate if origin has fractional pixels - - - b.translate(-(origin[0] % 1), -(origin[1] % 1)); // set clip path - - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - return b; - } - - var viewBounds = function viewBounds(origin, width, height) { - return new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]); - }; - - prototype$M._render = function (scene) { - var g = this.context(), - o = this._origin, - w = this._width, - h = this._height, - db = this._dirty, - vb = viewBounds(o, w, h); // setup - - g.save(); - var b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); - this.clear(-o[0], -o[1], w, h); // render - - this.draw(g, scene, b); // takedown - - g.restore(); - db.clear(); - return this; - }; - - prototype$M.draw = function (ctx, scene, bounds) { - var mark = Marks[scene.marktype]; - if (scene.clip) clip$1(ctx, scene); - mark.draw.call(this, ctx, scene, bounds); - if (scene.clip) ctx.restore(); - }; - - prototype$M.clear = function (x, y, w, h) { - var opt = this._options, - g = this.context(); - - if (opt.type !== 'pdf' && !opt.externalContext) { - // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - } - - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } - }; - - function SVGHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - var h = this; - h._hrefHandler = listener(h, function (evt, item) { - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, function (evt, item) { - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); - }); - } - - var prototype$N = inherits(SVGHandler, Handler); - - prototype$N.initialize = function (el, origin, obj) { - var svg = this._svg; - - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - - this._svg = svg = el && domFind(el, 'svg'); - - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - prototype$N.canvas = function () { - return this._svg; - }; // wrap an event listener for the SVG DOM - - - var listener = function listener(context, handler) { - return function (evt) { - var item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; - }; // add an event handler - - - prototype$N.on = function (type, handler) { - var name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - var _x23 = { - type: type, - handler: handler, - listener: listener(this, handler) - }; - (h[name] || (h[name] = [])).push(_x23); - - if (this._svg) { - this._svg.addEventListener(name, _x23.listener); - } - } - - return this; - }; // remove an event handler - - - prototype$N.off = function (type, handler) { - var name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - if (this._svg) { - this._svg.removeEventListener(name, h[i].listener); - } - - h.splice(i, 1); - } - - return this; - }; - - function bandSpace(count, paddingInner, paddingOuter) { - var space = count - paddingInner + paddingOuter * 2; - return count ? space > 0 ? space : 1 : 0; - } - - var Identity = 'identity'; - var Linear$1 = 'linear'; - var Log = 'log'; - var Pow = 'pow'; - var Sqrt = 'sqrt'; - var Symlog = 'symlog'; - var Time = 'time'; - var UTC = 'utc'; - var Sequential = 'sequential'; - var Diverging = 'diverging'; - var Quantile$1 = 'quantile'; - var Quantize = 'quantize'; - var Threshold = 'threshold'; - var Ordinal = 'ordinal'; - var Point = 'point'; - var Band = 'band'; - var BinOrdinal = 'bin-ordinal'; // categories - - var Continuous = 'continuous'; - var Discrete = 'discrete'; - var Discretizing = 'discretizing'; - var Interpolating = 'interpolating'; - var Temporal = 'temporal'; - - function invertRange(scale) { - return function (_) { - var lo = _[0], - hi = _[1], - t; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - return [scale.invert(lo), scale.invert(hi)]; - }; - } - - function invertRangeExtent(scale) { - return function (_) { - var range = scale.range(), - lo = _[0], - hi = _[1], - min = -1, - max, - t, - i, - n; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - for (i = 0, n = range.length; i < n; ++i) { - if (range[i] >= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - } - - if (min < 0) return undefined; - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - return [lo[0] === undefined ? lo[1] : lo[0], hi[1] === undefined ? hi[0] : hi[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: - { - if (typeof domain === "function") this.interpolator(domain);else this.range(domain); - break; - } - - default: - { - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator);else this.range(interpolator); - break; - } - } - - return this; - } - - var implicit = Symbol("implicit"); - - function ordinal() { - var index = new Map(), - domain = [], - range = [], - unknown = implicit; - - function scale(d) { - var key = d + "", - i = index.get(key); - - if (!i) { - if (unknown !== implicit) return unknown; - index.set(key, i = domain.push(d)); - } - - return range[(i - 1) % range.length]; - } - - scale.domain = function (_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new Map(); - - var _iterator18 = _createForOfIteratorHelper(_), - _step18; - - try { - for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) { - var _value17 = _step18.value; - - var _key5 = _value17 + ""; - - if (index.has(_key5)) continue; - index.set(_key5, domain.push(_value17)); - } - } catch (err) { - _iterator18.e(err); - } finally { - _iterator18.f(); - } - - return scale; - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function () { - return ordinal(domain, range).unknown(unknown); - }; - - initRange.apply(scale, arguments); - return scale; - } - - function define(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; - } - - function extend$1(parent, definition) { - var prototype = Object.create(parent.prototype); - - for (var key in definition) { - prototype[key] = definition[key]; - } - - return prototype; - } - - function Color() {} - - var _darker = 0.7; - - var _brighter = 1 / _darker; - - var reI = "\\s*([+-]?\\d+)\\s*", - reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", - reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", - reHex = /^#([0-9a-f]{3,8})$/, - reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), - reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), - reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), - reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), - reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), - reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); - var named = { - 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$1, { - copy: function copy(channels) { - return Object.assign(new this.constructor(), this, channels); - }, - displayable: function displayable() { - return this.rgb().displayable(); - }, - hex: color_formatHex, - // Deprecated! Use color.formatHex. - formatHex: color_formatHex, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb - }); - - function color_formatHex() { - return this.rgb().formatHex(); - } - - function color_formatHsl() { - return hslConvert(this).formatHsl(); - } - - function color_formatRgb() { - return this.rgb().formatRgb(); - } - - function color$1(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb(m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba(m >> 12 & 0xf | m >> 8 & 0xf0, m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, ((m & 0xf) << 4 | m & 0xf) / 0xff) // #f000 - : null // invalid hex - ) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = 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]) // eslint-disable-line no-prototype-builtins - : format === "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 <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); - } - - function rgbConvert(o) { - if (!(o instanceof Color)) o = color$1(o); - if (!o) return new Rgb(); - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); - } - - function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); - } - - function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; - } - - define(Rgb, rgb, extend$1(Color, { - brighter: function brighter(k) { - k = k == null ? _brighter : Math.pow(_brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker: function darker(k) { - k = k == null ? _darker : Math.pow(_darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb: function rgb() { - return this; - }, - displayable: function displayable() { - return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; - }, - hex: rgb_formatHex, - // Deprecated! Use color.formatHex. - formatHex: rgb_formatHex, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb - })); - - function rgb_formatHex() { - return "#" + hex(this.r) + hex(this.g) + hex(this.b); - } - - function rgb_formatRgb() { - var a = this.opacity; - a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 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 === 1 ? ")" : ", " + a + ")"); - } - - function hex(value) { - value = 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 <= 0) h = s = l = NaN;else if (l <= 0 || l >= 1) h = s = NaN;else if (s <= 0) h = 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 = color$1(o); - if (!o) return new Hsl(); - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - h = NaN, - s = max - min, - l = (max + min) / 2; - - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6;else if (g === max) h = (b - r) / s + 2;else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else { - s = l > 0 && l < 1 ? 0 : h; - } - - return new Hsl(h, s, l, o.opacity); - } - - function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); - } - - function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; - } - - define(Hsl, hsl, extend$1(Color, { - brighter: function brighter(k) { - k = k == null ? _brighter : Math.pow(_brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker: function darker(k) { - k = k == null ? _darker : Math.pow(_darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function rgb() { - var h = this.h % 360 + (this.h < 0) * 360, - s = isNaN(h) || isNaN(this.s) ? 0 : this.s, - l = this.l, - m2 = l + (l < 0.5 ? l : 1 - l) * s, - m1 = 2 * l - m2; - return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity); - }, - displayable: function displayable() { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; - }, - formatHsl: function formatHsl() { - var a = this.opacity; - a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")"); - } - })); - /* 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 = Math.PI / 180; - var rad2deg = 180 / Math.PI; // https://observablehq.com/@mbostock/lab-and-rgb - - var K = 18, - Xn = 0.96422, - Yn = 1, - Zn = 0.82521, - t0$2 = 4 / 29, - t1$1 = 6 / 29, - t2 = 3 * t1$1 * t1$1, - t3 = t1$1 * t1$1 * t1$1; - - 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 = rgbConvert(o); - var r = rgb2lrgb(o.r), - g = rgb2lrgb(o.g), - b = rgb2lrgb(o.b), - y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), - x, - z; - if (r === g && g === b) x = z = y;else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = 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 lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); - } - - function Lab(l, a, b, opacity) { - this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; - } - - define(Lab, lab, extend$1(Color, { - brighter: function brighter(k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker: function darker(k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb: function rgb() { - var y = (this.l + 16) / 116, - x = isNaN(this.a) ? y : y + this.a / 500, - z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = 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$2; - } - - function lab2xyz(t) { - return t > t1$1 ? t * t * t : t2 * (t - t0$2); - } - - function lrgb2rgb(x) { - return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); - } - - function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 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 = labConvert(o); - if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h = 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 hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); - } - - function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; - this.l = +l; - this.opacity = +opacity; - } - - function hcl2lab(o) { - if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h = o.h * deg2rad; - return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); - } - - define(Hcl, hcl, extend$1(Color, { - brighter: function brighter(k) { - return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); - }, - darker: function darker(k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb: function rgb() { - return hcl2lab(this).rgb(); - } - })); - var A = -0.14861, - B = +1.78277, - C$1 = -0.29227, - D = -0.90649, - E = +1.97294, - ED = E * D, - EB = E * B, - BC_DA = B * C$1 - 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 = rgbConvert(o); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), - bl = b - l, - k = (E * (g - l) - C$1 * bl) / D, - s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), - // NaN if l=0 or l=1 - h = 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 === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); - } - - function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; - } - - define(Cubehelix, cubehelix, extend$1(Color, { - brighter: function brighter(k) { - k = k == null ? _brighter : Math.pow(_brighter, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker: function darker(k) { - k = k == null ? _darker : Math.pow(_darker, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function rgb() { - var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, - l = +this.l, - a = isNaN(this.s) ? 0 : this.s * l * (1 - l), - cosh = Math.cos(h), - sinh = Math.sin(h); - return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C$1 * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); - } - })); - - function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, - t3 = 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 = values.length - 1; - return function (t) { - var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), - v1 = values[i], - v2 = values[i + 1], - v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, - v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - } - - function basisClosed(values) { - var n = values.length; - return function (t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), - v0 = values[(i + n - 1) % n], - v1 = values[i % n], - v2 = values[(i + 1) % n], - v3 = values[(i + 2) % n]; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - } - - function constant$2(x) { - return function () { - return x; - }; - } - - function linear(a, d) { - return function (t) { - return a + t * d; - }; - } - - function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function (t) { - return Math.pow(a + t * b, y); - }; - } - - function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$2(isNaN(a) ? b : a); - } - - function gamma(y) { - return (y = +y) === 1 ? nogamma : function (a, b) { - return b - a ? exponential(a, b, y) : constant$2(isNaN(a) ? b : a); - }; - } - - function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : constant$2(isNaN(a) ? b : a); - } - - var rgb$1 = function rgbGamma(y) { - var color = gamma(y); - - function rgb$1(start, end) { - var r = color((start = rgb(start)).r, (end = rgb(end)).r), - g = color(start.g, end.g), - b = color(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function (t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - - rgb$1.gamma = rgbGamma; - return rgb$1; - }(1); - - function rgbSpline(spline) { - return function (colors) { - var n = colors.length, - r = new Array(n), - g = new Array(n), - b = new Array(n), - i, - color; - - for (i = 0; i < n; ++i) { - color = rgb(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function (t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; - }; - } - - var rgbBasis = rgbSpline(basis$1); - var rgbBasisClosed = rgbSpline(basisClosed); - - function numberArray(a, b) { - if (!b) b = []; - var n = a ? Math.min(b.length, a.length) : 0, - c = b.slice(), - i; - return function (t) { - for (i = 0; i < n; ++i) { - c[i] = a[i] * (1 - t) + b[i] * t; - } - - return c; - }; - } - - function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); - } - - function array$1(a, b) { - return (isNumberArray(b) ? numberArray : genericArray)(a, b); - } - - function genericArray(a, b) { - var nb = b ? b.length : 0, - na = a ? Math.min(nb, a.length) : 0, - x = new Array(na), - c = new Array(nb), - i; - - for (i = 0; i < na; ++i) { - x[i] = interpolate(a[i], b[i]); - } - - for (; i < nb; ++i) { - c[i] = b[i]; - } - - return function (t) { - for (i = 0; i < na; ++i) { - c[i] = x[i](t); - } - - return c; - }; - } - - function date(a, b) { - var d = new Date(); - return a = +a, b = +b, function (t) { - return d.setTime(a * (1 - t) + b * t), d; - }; - } - - function interpolateNumber(a, b) { - return a = +a, b = +b, function (t) { - return a * (1 - t) + b * t; - }; - } - - function object$1(a, b) { - var i = {}, - c = {}, - k; - if (a === null || _typeof(a) !== "object") a = {}; - if (b === null || _typeof(b) !== "object") b = {}; - - for (k in b) { - if (k in a) { - i[k] = interpolate(a[k], b[k]); - } else { - c[k] = b[k]; - } - } - - return function (t) { - for (k in i) { - c[k] = i[k](t); - } - - return c; - }; - } - - var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, - reB = new RegExp(reA.source, "g"); - - function zero$1(b) { - return function () { - return b; - }; - } - - function one$1(b) { - return function (t) { - return b(t) + ""; - }; - } - - function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 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 = -1, - // index in s - s = [], - // string constants and placeholders - q = []; // number interpolators - // Coerce inputs to strings. - - a = a + "", b = b + ""; // Interpolate pairs of numbers in a & b. - - while ((am = reA.exec(a)) && (bm = reB.exec(b))) { - if ((bs = bm.index) > bi) { - // a string precedes the next number in b - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - - if ((am = am[0]) === (bm = bm[0])) { - // numbers in a & b match - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; - } else { - // interpolate non-matching numbers - s[++i] = null; - q.push({ - i: i, - x: interpolateNumber(am, bm) - }); - } - - bi = reB.lastIndex; - } // Add remains of b. - - - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = 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$1(q[0].x) : zero$1(b) : (b = q.length, function (t) { - for (var i = 0, o; i < b; ++i) { - s[(o = q[i]).i] = o.x(t); - } - - return s.join(""); - }); - } - - function interpolate(a, b) { - var t = _typeof(b), - c; - - return b == null || t === "boolean" ? constant$2(b) : (t === "number" ? interpolateNumber : t === "string" ? (c = color$1(b)) ? (b = c, rgb$1) : string : b instanceof color$1 ? rgb$1 : b instanceof Date ? date : isNumberArray(b) ? numberArray : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object$1 : interpolateNumber)(a, b); - } - - function discrete(range) { - var n = 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 = hue(+a, +b); - return function (t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; - } - - function interpolateRound(a, b) { - return a = +a, b = +b, function (t) { - return Math.round(a * (1 - t) + b * t); - }; - } - - var degrees = 180 / Math.PI; - var identity$3 = { - 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 = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - 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 === "none") return identity$3; - if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; - cssNode.style.transform = value; - value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); - cssRoot.removeChild(cssNode); - value = value.slice(7, -1).split(","); - return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); - } - - function parseSvg(value) { - if (value == null) return identity$3; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return identity$3; - value = 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 !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({ - i: i - 4, - x: interpolateNumber(xa, xb) - }, { - i: i - 2, - x: interpolateNumber(ya, yb) - }); - } else if (xb || yb) { - s.push("translate(" + xb + pxComma + yb + pxParen); - } - } - - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) b += 360;else if (b - a > 180) a += 360; // shortest path - - q.push({ - i: s.push(pop(s) + "rotate(", null, degParen) - 2, - x: interpolateNumber(a, b) - }); - } else if (b) { - s.push(pop(s) + "rotate(" + b + degParen); - } - } - - function skewX(a, b, s, q) { - if (a !== b) { - q.push({ - i: s.push(pop(s) + "skewX(", null, degParen) - 2, - x: interpolateNumber(a, b) - }); - } else if (b) { - s.push(pop(s) + "skewX(" + b + degParen); - } - } - - function scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({ - i: i - 4, - x: interpolateNumber(xa, xb) - }, { - i: i - 2, - x: interpolateNumber(ya, yb) - }); - } else if (xb !== 1 || yb !== 1) { - s.push(pop(s) + "scale(" + xb + "," + yb + ")"); - } - } - - return function (a, b) { - var s = [], - // string constants and placeholders - q = []; // number interpolators - - a = parse(a), b = 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 = b = null; // gc - - return function (t) { - var i = -1, - n = q.length, - o; - - while (++i < n) { - s[(o = q[i]).i] = o.x(t); - } - - return s.join(""); - }; - }; - } - - var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); - var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); - var rho = Math.SQRT2, - rho2 = 2, - rho4 = 4, - epsilon2 = 1e-12; - - function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; - } - - function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; - } - - function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); - } // p0 = [ux0, uy0, w0] - // p1 = [ux1, uy1, w1] - - - function zoom$1(p0, p1) { - var ux0 = p0[0], - uy0 = p0[1], - w0 = p0[2], - ux1 = p1[0], - uy1 = p1[1], - w1 = p1[2], - dx = ux1 - ux0, - dy = uy1 - uy0, - d2 = dx * dx + dy * dy, - i, - S; // Special case for u0 ≅ u1. - - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - - i = function i(t) { - return [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S)]; - }; - } // General case. - else { - var d1 = Math.sqrt(d2), - b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), - b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), - r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), - r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - - i = function i(t) { - var s = t * S, - coshr0 = cosh(r0), - u = 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 = S * 1000; - return i; - } - - function hsl$1(hue) { - return function (start, end) { - var h = hue((start = hsl(start)).h, (end = hsl(end)).h), - s = nogamma(start.s, end.s), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function (t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - }; - } - - var hsl$2 = hsl$1(hue); - var hslLong = hsl$1(nogamma); - - function lab$1(start, end) { - var l = nogamma((start = lab(start)).l, (end = lab(end)).l), - a = nogamma(start.a, end.a), - b = nogamma(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function (t) { - start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - - function hcl$1(hue) { - return function (start, end) { - var h = hue((start = hcl(start)).h, (end = hcl(end)).h), - c = nogamma(start.c, end.c), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function (t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - }; - } - - var hcl$2 = hcl$1(hue); - var hclLong = hcl$1(nogamma); - - function cubehelix$1(hue) { - return function cubehelixGamma(y) { - y = +y; - - function cubehelix$1(start, end) { - var h = hue((start = cubehelix(start)).h, (end = cubehelix(end)).h), - s = nogamma(start.s, end.s), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function (t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - - cubehelix$1.gamma = cubehelixGamma; - return cubehelix$1; - }(1); - } - - var cubehelix$2 = cubehelix$1(hue); - var cubehelixLong = cubehelix$1(nogamma); - - function piecewise(interpolate, values) { - var i = 0, - n = values.length - 1, - v = values[0], - I = new Array(n < 0 ? 0 : n); - - while (i < n) { - I[i] = interpolate(v, v = values[++i]); - } - - return function (t) { - var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i](t - i); - }; - } - - function quantize(interpolator, n) { - var samples = new Array(n); - - for (var i = 0; i < n; ++i) { - samples[i] = interpolator(i / (n - 1)); - } - - return samples; - } - - var $$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - interpolate: interpolate, - interpolateArray: array$1, - interpolateBasis: basis$1, - interpolateBasisClosed: basisClosed, - interpolateDate: date, - interpolateDiscrete: discrete, - interpolateHue: hue$1, - interpolateNumber: interpolateNumber, - interpolateNumberArray: numberArray, - interpolateObject: object$1, - interpolateRound: interpolateRound, - interpolateString: string, - interpolateTransformCss: interpolateTransformCss, - interpolateTransformSvg: interpolateTransformSvg, - interpolateZoom: zoom$1, - interpolateRgb: rgb$1, - interpolateRgbBasis: rgbBasis, - interpolateRgbBasisClosed: rgbBasisClosed, - interpolateHsl: hsl$2, - interpolateHslLong: hslLong, - interpolateLab: lab$1, - interpolateHcl: hcl$2, - interpolateHclLong: hclLong, - interpolateCubehelix: cubehelix$2, - interpolateCubehelixLong: cubehelixLong, - piecewise: piecewise, - quantize: quantize - }); - - function constant$3(x) { - return function () { - return x; - }; - } - - function number$2(x) { - return +x; - } - - var unit = [0, 1]; - - function identity$4(x) { - return x; - } - - function normalize(a, b) { - return (b -= a = +a) ? function (x) { - return (x - a) / b; - } : constant$3(isNaN(b) ? NaN : 0.5); - } - - function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = 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 corresponding parameter t in [0,1]. - // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. - - - function bimap(domain, range, interpolate) { - var d0 = domain[0], - d1 = domain[1], - r0 = range[0], - r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function (x) { - return r0(d0(x)); - }; - } - - function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, - d = new Array(j), - r = new Array(j), - i = -1; // Reverse descending domains. - - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - - while (++i < j) { - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - - return function (x) { - var i = 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() { - var domain = unit, - range = unit, - interpolate$1 = interpolate, - transform, - untransform, - unknown, - clamp = identity$4, - piecewise, - output, - input; - - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity$4) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x))); - } - - scale.invert = function (y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y))); - }; - - scale.domain = function (_) { - return arguments.length ? (domain = Array.from(_, number$2), rescale()) : domain.slice(); - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.rangeRound = function (_) { - return range = Array.from(_), interpolate$1 = interpolateRound, rescale(); - }; - - scale.clamp = function (_) { - return arguments.length ? (clamp = _ ? true : identity$4, rescale()) : clamp !== identity$4; - }; - - scale.interpolate = function (_) { - return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1; - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function (t, u) { - transform = t, untransform = u; - return rescale(); - }; - } - - function continuous() { - return transformer()(identity$4, identity$4); - } - - function tickFormat(start, stop, count, specifier) { - var step = tickStep(start, stop, count), - precision; - specifier = formatSpecifier(specifier == null ? ",f" : specifier); - - switch (specifier.type) { - case "s": - { - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision; - return formatPrefix(specifier, value); - } - - case "": - case "e": - case "g": - case "p": - case "r": - { - if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - } - - case "f": - case "%": - { - if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - - return format$1(specifier); - } - - function linearish(scale) { - var domain = scale.domain; - - scale.ticks = function (count) { - var d = domain(); - return ticks(d[0], d[d.length - 1], count == null ? 10 : count); - }; - - scale.tickFormat = function (count, specifier) { - var d = domain(); - return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - - scale.nice = function (count) { - if (count == null) count = 10; - var d = domain(), - i0 = 0, - i1 = d.length - 1, - start = d[i0], - stop = d[i1], - step; - - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - - step = tickIncrement(start, stop, count); - - if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - step = tickIncrement(start, stop, count); - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - step = tickIncrement(start, stop, count); - } - - if (step > 0) { - d[i0] = Math.floor(start / step) * step; - d[i1] = Math.ceil(stop / step) * step; - domain(d); - } else if (step < 0) { - d[i0] = Math.ceil(start * step) / step; - d[i1] = Math.floor(stop * step) / step; - domain(d); - } - - return scale; - }; - - return scale; - } - - function linear$1() { - var scale = continuous(); - - scale.copy = function () { - return copy(scale, linear$1()); - }; - - initRange.apply(scale, arguments); - return linearish(scale); - } - - function identity$5(domain) { - var unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : x; - } - - scale.invert = scale; - - scale.domain = scale.range = function (_) { - return arguments.length ? (domain = Array.from(_, number$2), scale) : domain.slice(); - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function () { - return identity$5(domain).unknown(unknown); - }; - - domain = arguments.length ? Array.from(domain, number$2) : [0, 1]; - return linearish(scale); - } - - function nice(domain, interval) { - domain = domain.slice(); - var i0 = 0, - i1 = domain.length - 1, - x0 = domain[i0], - x1 = domain[i1], - t; - - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - - domain[i0] = interval.floor(x0); - domain[i1] = 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 === 10 ? pow10 : base === Math.E ? Math.exp : function (x) { - return Math.pow(base, x); - }; - } - - function logp(base) { - return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), function (x) { - return Math.log(x) / base; - }); - } - - function reflect(f) { - return function (x) { - return -f(-x); - }; - } - - function loggish(transform) { - var scale = transform(transformLog, transformExp), - domain = scale.domain, - base = 10, - logs, - pows; - - function rescale() { - logs = logp(base), pows = powp(base); - - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else { - transform(transformLog, transformExp); - } - - return scale; - } - - scale.base = function (_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - - scale.domain = function (_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.ticks = function (count) { - var d = domain(), - u = d[0], - v = d[d.length - 1], - r; - if (r = v < u) i = u, u = v, v = i; - var i = logs(u), - j = logs(v), - p, - k, - t, - n = count == null ? 10 : +count, - z = []; - - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for (; i <= j; ++i) { - for (k = 1, p = pows(i); k < base; ++k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } else for (; i <= j; ++i) { - for (k = base - 1, p = pows(i); k >= 1; --k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } - if (z.length * 2 < n) z = ticks(u, v, n); - } else { - z = ticks(i, j, Math.min(j - i, n)).map(pows); - } - - return r ? z.reverse() : z; - }; - - scale.tickFormat = function (count, specifier) { - if (specifier == null) specifier = base === 10 ? ".0e" : ","; - if (typeof specifier !== "function") specifier = format$1(specifier); - if (count === Infinity) return specifier; - if (count == null) count = 10; - var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - - return function (d) { - var i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; - }; - - scale.nice = function () { - return domain(nice(domain(), { - floor: function floor(x) { - return pows(Math.floor(logs(x))); - }, - ceil: function ceil(x) { - return pows(Math.ceil(logs(x))); - } - })); - }; - - return scale; - } - - function log$2() { - var scale = loggish(transformer()).domain([1, 10]); - - scale.copy = function () { - return copy(scale, log$2()).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 = 1, - scale = transform(transformSymlog(c), transformSymexp(c)); - - scale.constant = function (_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - - return linearish(scale); - } - - function symlog$1() { - var scale = symlogish(transformer()); - - scale.copy = function () { - return copy(scale, symlog$1()).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 = transform(identity$4, identity$4), - exponent = 1; - - function rescale() { - return exponent === 1 ? transform(identity$4, identity$4) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); - } - - scale.exponent = function (_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - - return linearish(scale); - } - - function pow$1() { - var scale = powish(transformer()); - - scale.copy = 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 = [], - range = [], - thresholds = [], - unknown; - - function rescale() { - var i = 0, - n = Math.max(1, range.length); - thresholds = new Array(n - 1); - - while (++i < n) { - thresholds[i - 1] = quantile(domain, i / n); - } - - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : range[bisectRight(thresholds, x)]; - } - - scale.invertExtent = function (y) { - var i = 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 = function (_) { - if (!arguments.length) return domain.slice(); - domain = []; - - var _iterator19 = _createForOfIteratorHelper(_), - _step19; - - try { - for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) { - var d = _step19.value; - if (d != null && !isNaN(d = +d)) domain.push(d); - } - } catch (err) { - _iterator19.e(err); - } finally { - _iterator19.f(); - } - - domain.sort(ascending); - return rescale(); - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.quantiles = function () { - return thresholds.slice(); - }; - - scale.copy = function () { - return quantile$1().domain(domain).range(range).unknown(unknown); - }; - - return initRange.apply(scale, arguments); - } - - function quantize$1() { - var x0 = 0, - x1 = 1, - n = 1, - domain = [0.5], - range = [0, 1], - unknown; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - function rescale() { - var i = -1; - domain = new Array(n); - - while (++i < n) { - domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - } - - return scale; - } - - scale.domain = function (_) { - var _ref3, _ref4; - - return arguments.length ? ((_ref3 = _, _ref4 = _slicedToArray(_ref3, 2), x0 = _ref4[0], x1 = _ref4[1], _ref3), x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; - }; - - scale.range = function (_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - - scale.invertExtent = function (y) { - var i = range.indexOf(y); - return i < 0 ? [NaN, NaN] : i < 1 ? [x0, domain[0]] : i >= n ? [domain[n - 1], x1] : [domain[i - 1], domain[i]]; - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - - scale.thresholds = function () { - return domain.slice(); - }; - - scale.copy = function () { - return quantize$1().domain([x0, x1]).range(range).unknown(unknown); - }; - - return initRange.apply(linearish(scale), arguments); - } - - function threshold() { - var domain = [0.5], - range = [0, 1], - unknown, - n = 1; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - scale.domain = function (_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - - scale.range = function (_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - - scale.invertExtent = function (y) { - var i = range.indexOf(y); - return [domain[i - 1], domain[i]]; - }; - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function () { - return threshold().domain(domain).range(range).unknown(unknown); - }; - - return initRange.apply(scale, arguments); - } - - var durationSecond$2 = 1000, - durationMinute$2 = durationSecond$2 * 60, - durationHour$2 = durationMinute$2 * 60, - durationDay$2 = durationHour$2 * 24, - durationWeek$2 = durationDay$2 * 7, - durationMonth$1 = durationDay$2 * 30, - durationYear$1 = durationDay$2 * 365; - - function date$1(t) { - return new Date(t); - } - - function number$3(t) { - return t instanceof Date ? +t : +new Date(+t); - } - - function calendar(year, month, week, day, hour, minute, second, millisecond, format) { - var scale = continuous(), - invert = scale.invert, - domain = scale.domain; - var formatMillisecond = format(".%L"), - formatSecond = format(":%S"), - formatMinute = format("%I:%M"), - formatHour = format("%I %p"), - formatDay = format("%a %d"), - formatWeek = format("%b %d"), - formatMonth = format("%B"), - formatYear = format("%Y"); - var tickIntervals = [[second, 1, durationSecond$2], [second, 5, 5 * durationSecond$2], [second, 15, 15 * durationSecond$2], [second, 30, 30 * durationSecond$2], [minute, 1, durationMinute$2], [minute, 5, 5 * durationMinute$2], [minute, 15, 15 * durationMinute$2], [minute, 30, 30 * durationMinute$2], [hour, 1, durationHour$2], [hour, 3, 3 * durationHour$2], [hour, 6, 6 * durationHour$2], [hour, 12, 12 * durationHour$2], [day, 1, durationDay$2], [day, 2, 2 * durationDay$2], [week, 1, durationWeek$2], [month, 1, durationMonth$1], [month, 3, 3 * durationMonth$1], [year, 1, durationYear$1]]; - - function tickFormat(date) { - return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? week(date) < date ? formatDay : formatWeek : year(date) < date ? formatMonth : formatYear)(date); - } - - function tickInterval(interval, start, stop) { - if (interval == null) interval = 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 === "number") { - var target = Math.abs(stop - start) / interval, - i = bisector(function (i) { - return i[2]; - }).right(tickIntervals, target), - step; - - if (i === tickIntervals.length) { - step = tickStep(start / durationYear$1, stop / durationYear$1, interval); - interval = year; - } else if (i) { - i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - step = i[1]; - interval = i[0]; - } else { - step = Math.max(tickStep(start, stop, interval), 1); - interval = millisecond; - } - - return interval.every(step); - } - - return interval; - } - - scale.invert = function (y) { - return new Date(invert(y)); - }; - - scale.domain = function (_) { - return arguments.length ? domain(Array.from(_, number$3)) : domain().map(date$1); - }; - - scale.ticks = function (interval) { - var d = domain(), - t0 = d[0], - t1 = d[d.length - 1], - r = t1 < t0, - t; - if (r) t = t0, t0 = t1, t1 = t; - t = tickInterval(interval, t0, t1); - t = t ? t.range(t0, t1 + 1) : []; // inclusive stop - - return r ? t.reverse() : t; - }; - - scale.tickFormat = function (count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - - scale.nice = function (interval) { - var d = domain(); - return (interval = tickInterval(interval, d[0], d[d.length - 1])) ? domain(nice(d, interval)) : scale; - }; - - scale.copy = function () { - return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); - }; - - return scale; - } - - function time() { - return initRange.apply(calendar(year, month, sunday, day, hour, minute, second, millisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); - } - - function utcTime() { - return initRange.apply(calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); - } - - function transformer$1() { - var x0 = 0, - x1 = 1, - t0, - t1, - k10, - transform, - interpolator = identity$4, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function (_) { - var _ref5, _ref6; - - return arguments.length ? ((_ref5 = _, _ref6 = _slicedToArray(_ref5, 2), x0 = _ref6[0], x1 = _ref6[1], _ref5), t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; - }; - - scale.clamp = function (_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function (_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function (_) { - var _ref7, _ref8; - - var r0, r1; - return arguments.length ? ((_ref7 = _, _ref8 = _slicedToArray(_ref7, 2), r0 = _ref8[0], r1 = _ref8[1], _ref7), interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; - }; - } - - scale.range = range(interpolate); - scale.rangeRound = range(interpolateRound); - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function (t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === 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 = linearish(transformer$1()(identity$4)); - - scale.copy = function () { - return copy$1(scale, sequential()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialLog() { - var scale = loggish(transformer$1()).domain([1, 10]); - - scale.copy = function () { - return copy$1(scale, sequentialLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialSymlog() { - var scale = symlogish(transformer$1()); - - scale.copy = function () { - return copy$1(scale, sequentialSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialPow() { - var scale = powish(transformer$1()); - - scale.copy = 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 transformer$2() { - var x0 = 0, - x1 = 0.5, - x2 = 1, - s = 1, - t0, - t1, - t2, - k10, - k21, - interpolator = identity$4, - transform, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function (_) { - var _ref9, _ref10; - - return arguments.length ? ((_ref9 = _, _ref10 = _slicedToArray(_ref9, 3), x0 = _ref10[0], x1 = _ref10[1], x2 = _ref10[2], _ref9), t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2]; - }; - - scale.clamp = function (_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function (_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function (_) { - var _ref11, _ref12; - - var r0, r1, r2; - return arguments.length ? ((_ref11 = _, _ref12 = _slicedToArray(_ref11, 3), r0 = _ref12[0], r1 = _ref12[1], r2 = _ref12[2], _ref11), interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - - scale.range = range(interpolate); - scale.rangeRound = range(interpolateRound); - - scale.unknown = function (_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function (t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; - } - - function diverging() { - var scale = linearish(transformer$2()(identity$4)); - - scale.copy = function () { - return copy$1(scale, diverging()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingLog() { - var scale = loggish(transformer$2()).domain([0.1, 1, 10]); - - scale.copy = function () { - return copy$1(scale, divergingLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingSymlog() { - var scale = symlogish(transformer$2()); - - scale.copy = function () { - return copy$1(scale, divergingSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingPow() { - var scale = powish(transformer$2()); - - scale.copy = 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 band() { - var scale = ordinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - range = [0, 1], - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = range[1] < range[0], - start = range[reverse - 0], - stop = range[1 - reverse], - space = bandSpace(n, paddingInner, paddingOuter); - step = (stop - start) / (space || 1); - - if (round) { - step = Math.floor(step); - } - - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - - var values = sequence(n).map(function (i) { - return start + step * i; - }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function (_) { - if (arguments.length) { - domain(_); - return rescale(); - } else { - return domain(); - } - }; - - scale.range = function (_) { - if (arguments.length) { - range = [+_[0], +_[1]]; - return rescale(); - } else { - return range.slice(); - } - }; - - scale.rangeRound = function (_) { - range = [+_[0], +_[1]]; - round = true; - return rescale(); - }; - - scale.bandwidth = function () { - return bandwidth; - }; - - scale.step = function () { - return step; - }; - - scale.round = function (_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else { - return round; - } - }; - - scale.padding = function (_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingInner = function (_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingOuter = function (_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingOuter; - } - }; - - scale.align = function (_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return align; - } - }; - - scale.invertRange = function (_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - var lo = +_[0], - hi = +_[1], - reverse = range[1] < range[0], - values = reverse ? ordinalRange().reverse() : ordinalRange(), - n = values.length - 1, - a, - b, - t; // bail if either range endpoint is invalid - - if (lo !== lo || hi !== hi) return; // order range inputs, bail if outside of scale range - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - if (hi < values[0] || lo > range[1 - reverse]) return; // binary search to index into scale range - - a = Math.max(0, bisectRight(values, lo) - 1); - b = lo === hi ? a : bisectRight(values, hi) - 1; // increment index a if lo is within padding gap - - if (lo - values[a] > bandwidth + 1e-10) ++a; - - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - - return a > b ? undefined : domain().slice(a, b + 1); - }; - - scale.invert = function (_) { - var value = scale.invertRange([_, _]); - return value ? value[0] : value; - }; - - scale.copy = function () { - return band().domain(domain()).range(range).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); - }; - - return rescale(); - } - - function pointish(scale) { - var copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - - scale.copy = function () { - return pointish(copy()); - }; - - return scale; - } - - function point$5() { - return pointish(band().paddingInner(1)); - } - - var map$1 = Array.prototype.map; - - function numbers$2(_) { - return map$1.call(_, function (x) { - return +x; - }); - } - - var slice = Array.prototype.slice; - - function scaleBinOrdinal() { - var domain = [], - range = []; - - function scale(x) { - return x == null || x !== x ? undefined : range[(bisectRight(domain, x) - 1) % range.length]; - } - - scale.domain = function (_) { - if (arguments.length) { - domain = numbers$2(_); - return scale; - } else { - return domain.slice(); - } - }; - - scale.range = function (_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else { - return range.slice(); - } - }; - - scale.tickFormat = function (count, specifier) { - return tickFormat(domain[0], peek(domain), count == null ? 10 : count, specifier); - }; - - scale.copy = function () { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - - return scale; - } // scale registry - - - var scales = {}; - /** - * Augment scales with their type and needed inverse methods. - */ - - function create(type, constructor, metadata) { - var ctr = function scale() { - var s = constructor(); - - if (!s.invertRange) { - s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined; - } - - s.type = type; - return s; - }; - - ctr.metadata = toSet(array(metadata)); - return ctr; - } - - function scale$2(type, scale, metadata) { - if (arguments.length > 1) { - scales[type] = create(type, scale, metadata); - return this; - } else { - return isValidScaleType(type) ? scales[type] : undefined; - } - } // identity scale - - - scale$2(Identity, identity$5); // continuous scales - - scale$2(Linear$1, linear$1, Continuous); - scale$2(Log, log$2, [Continuous, Log]); - scale$2(Pow, pow$1, Continuous); - scale$2(Sqrt, sqrt$1, Continuous); - scale$2(Symlog, symlog$1, Continuous); - scale$2(Time, time, [Continuous, Temporal]); - scale$2(UTC, utcTime, [Continuous, Temporal]); // sequential scales - - scale$2(Sequential, sequential, [Continuous, Interpolating]); // backwards compat - - scale$2("".concat(Sequential, "-").concat(Linear$1), sequential, [Continuous, Interpolating]); - scale$2("".concat(Sequential, "-").concat(Log), sequentialLog, [Continuous, Interpolating, Log]); - scale$2("".concat(Sequential, "-").concat(Pow), sequentialPow, [Continuous, Interpolating]); - scale$2("".concat(Sequential, "-").concat(Sqrt), sequentialSqrt, [Continuous, Interpolating]); - scale$2("".concat(Sequential, "-").concat(Symlog), sequentialSymlog, [Continuous, Interpolating]); // diverging scales - - scale$2("".concat(Diverging, "-").concat(Linear$1), diverging, [Continuous, Interpolating]); - scale$2("".concat(Diverging, "-").concat(Log), divergingLog, [Continuous, Interpolating, Log]); - scale$2("".concat(Diverging, "-").concat(Pow), divergingPow, [Continuous, Interpolating]); - scale$2("".concat(Diverging, "-").concat(Sqrt), divergingSqrt, [Continuous, Interpolating]); - scale$2("".concat(Diverging, "-").concat(Symlog), divergingSymlog, [Continuous, Interpolating]); // discretizing scales - - scale$2(Quantile$1, quantile$1, [Discretizing, Quantile$1]); - scale$2(Quantize, quantize$1, Discretizing); - scale$2(Threshold, threshold, Discretizing); // discrete scales - - scale$2(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]); - scale$2(Ordinal, ordinal, Discrete); - scale$2(Band, band, Discrete); - scale$2(Point, point$5, Discrete); - - function isValidScaleType(type) { - return hasOwnProperty(scales, type); - } - - function hasType(key, type) { - var s = scales[key]; - return s && s.metadata[type]; - } - - function isContinuous(key) { - return hasType(key, Continuous); - } - - function isDiscrete(key) { - return hasType(key, Discrete); - } - - function isDiscretizing(key) { - return hasType(key, Discretizing); - } - - function isLogarithmic(key) { - return hasType(key, Log); - } - - function isTemporal(key) { - return hasType(key, Temporal); - } - - function isInterpolating(key) { - return hasType(key, Interpolating); - } - - function isQuantile(key) { - return hasType(key, Quantile$1); - } - - var scaleProps = ['clamp', 'base', 'constant', 'exponent']; - - function interpolateRange(interpolator, range) { - var start = range[0], - span = peek(range) - start; - return function (i) { - return interpolator(start + i * span); - }; - } - - function interpolateColors(colors, type, gamma) { - return piecewise(interpolate$1(type || 'rgb', gamma), colors); - } - - function quantizeInterpolator(interpolator, count) { - var samples = new Array(count), - n = count + 1; - - for (var i = 0; i < count;) { - samples[i] = interpolator(++i / n); - } - - return samples; - } - - function scaleFraction(scale, min, max) { - var delta = max - min, - i, - t, - s; - - if (!delta || !Number.isFinite(delta)) { - return constant(0.5); - } else { - i = (t = scale.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale$2(t)().domain([min, max]).range([0, 1]); - scaleProps.forEach(function (m) { - return scale[m] ? s[m](scale[m]()) : 0; - }); - return s; - } - } - - function interpolate$1(type, gamma) { - var interp = $$1[method(type)]; - return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp; - } - - function method(type) { - return 'interpolate' + type.toLowerCase().split('-').map(function (s) { - return s[0].toUpperCase() + s.slice(1); - }).join(''); - } - - var continuous$1 = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' - }; - var discrete$1 = { - category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', - accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', - dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', - paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', - pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', - pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', - set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', - set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', - set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' - }; - - function colors(palette) { - var n = palette.length / 6 | 0, - c = new Array(n), - i = 0; - - while (i < n) { - c[i] = '#' + palette.slice(i * 6, ++i * 6); - } - - return c; - } - - function apply(_, f) { - for (var k in _) { - scheme(k, f(_[k])); - } - } - - var schemes = {}; - apply(discrete$1, colors); - apply(continuous$1, function (_) { - return interpolateColors(colors(_)); - }); - - function scheme(name, scheme) { - name = name && name.toLowerCase(); - - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else { - return schemes[name]; - } - } - - var SymbolLegend = 'symbol'; - var DiscreteLegend = 'discrete'; - var GradientLegend = 'gradient'; - - var defaultFormatter = function defaultFormatter(value) { - return isArray(value) ? value.map(function (v) { - return String(v); - }) : String(value); - }; - - var ascending$1 = function ascending$1(a, b) { - return a[1] - b[1]; - }; - - var descending = function descending(a, b) { - return b[1] - a[1]; - }; - /** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ - - - function tickCount(scale, count, minStep) { - var step; - - if (isNumber(count)) { - if (scale.bins) { - count = Math.max(count, scale.bins.length); - } - - if (minStep != null) { - count = Math.min(count, Math.floor(span(scale.domain()) / minStep || 1)); - } - } - - if (isObject(count)) { - step = count.step; - count = count.interval; - } - - if (isString(count)) { - count = scale.type === Time ? timeInterval(count) : scale.type == UTC ? utcInterval(count) : error('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - - return count; - } - /** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ - - - function validTicks(scale, ticks, count) { - var range = scale.range(), - lo = range[0], - hi = peek(range), - cmp = ascending$1; - - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - - lo = Math.floor(lo); - hi = Math.ceil(hi); // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - - ticks = ticks.map(function (v) { - return [v, scale(v)]; - }).filter(function (_) { - return lo <= _[1] && _[1] <= hi; - }).sort(cmp).map(function (_) { - return _[0]; - }); - - if (count > 0 && ticks.length > 1) { - var endpoints = [ticks[0], peek(ticks)]; - - while (ticks.length > count && ticks.length >= 3) { - ticks = ticks.filter(function (_, i) { - return !(i % 2); - }); - } - - if (ticks.length < 3) { - ticks = endpoints; - } - } - - return ticks; - } - /** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ - - - function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins) : scale.ticks ? scale.ticks(count) : scale.domain(); - } - /** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ - - - function tickFormat$1(locale, scale, count, specifier, formatType, noSkip) { - var type = scale.type; - var format = defaultFormatter; - - if (type === Time || formatType === Time) { - format = locale.timeFormat(specifier); - } else if (type === UTC || formatType === UTC) { - format = locale.utcFormat(specifier); - } else if (isLogarithmic(type)) { - var varfmt = locale.formatFloat(specifier); - - if (noSkip || scale.bins) { - format = varfmt; - } else { - var test = tickLog(scale, count, false); - - format = function format(_) { - return test(_) ? varfmt(_) : ''; - }; - } - } else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - var d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } else if (specifier) { - format = locale.format(specifier); - } - - return format; - } - - function tickLog(scale, count, values) { - var ticks = tickValues(scale, count), - base = scale.base(), - logb = Math.log(base), - k = Math.max(1, base * count / ticks.length); // apply d3-scale's log format filter criteria - - var test = function test(d) { - var i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - - return values ? ticks.filter(test) : test; - } - - var symbols$1 = (_symbols$ = {}, _defineProperty(_symbols$, Quantile$1, 'quantiles'), _defineProperty(_symbols$, Quantize, 'thresholds'), _defineProperty(_symbols$, Threshold, 'domain'), _symbols$); - var formats$1 = (_formats$ = {}, _defineProperty(_formats$, Quantile$1, 'quantiles'), _defineProperty(_formats$, Quantize, 'domain'), _formats$); - - function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols$1[scale.type] ? thresholdValues(scale[symbols$1[scale.type]]()) : tickValues(scale, count); - } - - function thresholdFormat(locale, scale, specifier) { - var _ = scale[formats$1[scale.type]](), - n = _.length, - d = n > 1 ? _[1] - _[0] : _[0], - i; - - for (i = 1; i < n; ++i) { - d = Math.min(d, _[i] - _[i - 1]); - } // tickCount = 3 ticks times 10 for increased resolution - - - return locale.formatSpan(0, d, 3 * 10, specifier); - } - - function thresholdValues(thresholds) { - var values = [-Infinity].concat(thresholds); - values.max = +Infinity; - return values; - } - - function binValues(bins) { - var values = bins.slice(0, -1); - values.max = peek(bins); - return values; - } - - function isDiscreteRange(scale) { - return symbols$1[scale.type] || scale.bins; - } - - function labelFormat(locale, scale, count, type, specifier, formatType, noSkip) { - var format = formats$1[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat$1(locale, scale, count, specifier, formatType, noSkip); - return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format); - } - - function formatRange(format) { - return function (value, index, array) { - var limit = get$2(array[index + 1], get$2(array.max, +Infinity)), - lo = formatValue(value, format), - hi = formatValue(limit, format); - return lo && hi ? lo + " \u2013 " + hi : hi ? '< ' + hi : "\u2265 " + lo; - }; - } - - function get$2(value, dflt) { - return value != null ? value : dflt; - } - - function formatDiscrete(format) { - return function (value, index) { - return index ? format(value) : null; - }; - } - - function formatPoint(format) { - return function (value) { - return format(value); - }; - } - - function formatValue(value, format) { - return Number.isFinite(value) ? format(value) : null; - } - - function labelFraction(scale) { - var domain = scale.domain(), - count = domain.length - 1, - lo = +domain[0], - hi = +peek(domain), - span = hi - lo; - - if (scale.type === Threshold) { - var adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - - return function (value) { - return (value - lo) / span; - }; - } - - function format$2(locale, scale, specifier, formatType) { - var type = formatType || scale.type; // replace abbreviated time specifiers to improve screen reader experience - - if (isString(specifier) && isTemporal(type)) { - specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - } - - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true); - } - - function domainCaption(locale, scale, opt) { - opt = opt || {}; - var max = Math.max(3, opt.maxlen || 7), - fmt = format$2(locale, scale, opt.format, opt.formatType); // if scale breaks domain into bins, describe boundaries - - if (isDiscretizing(scale.type)) { - var v = labelValues(scale).slice(1).map(fmt), - n = v.length; - return "".concat(n, " boundar").concat(n === 1 ? 'y' : 'ies', ": ").concat(v.join(', ')); - } // if scale domain is discrete, list values - else if (isDiscrete(scale.type)) { - var d = scale.domain(), - _n2 = d.length, - _v = _n2 > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', '); - - return "".concat(_n2, " value").concat(_n2 === 1 ? '' : 's', ": ").concat(_v); - } // if scale domain is continuous, describe value range - else { - var _d2 = scale.domain(); - - return "values from ".concat(fmt(_d2[0]), " to ").concat(fmt(peek(_d2))); - } - } - - var ARIA_HIDDEN = 'aria-hidden'; - var ARIA_LABEL = 'aria-label'; - var ARIA_ROLE = 'role'; - var ARIA_ROLEDESCRIPTION = 'aria-roledescription'; - var GRAPHICS_OBJECT = 'graphics-object'; - var GRAPHICS_SYMBOL = 'graphics-symbol'; - - var bundle = function bundle(role, roledesc, label) { - var _ref13; - - return _ref13 = {}, _defineProperty(_ref13, ARIA_ROLE, role), _defineProperty(_ref13, ARIA_ROLEDESCRIPTION, roledesc), _defineProperty(_ref13, ARIA_LABEL, label || undefined), _ref13; - }; // these roles are covered by related roles - // we can ignore them, no need to generate attributes - - - var AriaIgnore = toSet(['axis-domain', 'axis-grid', 'axis-label', 'axis-tick', 'axis-title', 'legend-band', 'legend-entry', 'legend-gradient', 'legend-label', 'legend-title', 'legend-symbol', 'title']); // aria attribute generators for guide roles - - var AriaGuides = { - 'axis': { - desc: 'axis', - caption: axisCaption - }, - 'legend': { - desc: 'legend', - caption: legendCaption - }, - 'title-text': { - desc: 'title', - caption: function caption(item) { - return "Title text '".concat(titleCaption(item), "'"); - } - }, - 'title-subtitle': { - desc: 'subtitle', - caption: function caption(item) { - return "Subtitle text '".concat(titleCaption(item), "'"); - } - } - }; // aria properties generated for mark item encoding channels - - var AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL - }; - - function ariaItemAttributes(emit, item) { - var hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - - if (hide || item.description == null) { - for (var prop in AriaEncode) { - emit(AriaEncode[prop], undefined); - } - } else { - var _type = item.mark.marktype; - emit(ARIA_LABEL, item.description); - emit(ARIA_ROLE, item.ariaRole || (_type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); - emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || "".concat(_type, " mark")); - } - } - - function ariaMarkAttributes(mark) { - return mark.aria === false ? _defineProperty({}, ARIA_HIDDEN, true) : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); - } - - function ariaMark(mark) { - var type = mark.marktype; - var recurse = type === 'group' || type === 'text' || mark.items.some(function (_) { - return _.description != null && _.aria !== false; - }); - return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, "".concat(type, " mark container"), mark.description); - } - - function ariaGuide(mark, opt) { - try { - var item = mark.items[0], - caption = opt.caption || function () { - return ''; - }; - - return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); - } catch (err) { - return null; - } - } - - function titleCaption(item) { - return array(item.text).join(' '); - } - - function axisCaption(item) { - var datum = item.datum, - orient = item.orient, - title = datum.title ? extractTitle(item) : null, - ctx = item.context, - scale = ctx.scales[datum.scale].value, - locale = ctx.dataflow.locale(), - type = scale.type, - xy = orient === 'left' || orient === 'right' ? 'Y' : 'X'; - return "".concat(xy, "-axis") + (title ? " titled '".concat(title, "'") : '') + " for a ".concat(isDiscrete(type) ? 'discrete' : type, " scale") + " with ".concat(domainCaption(locale, scale, item)); - } - - function legendCaption(item) { - var datum = item.datum, - title = datum.title ? extractTitle(item) : null, - type = "".concat(datum.type || '', " legend").trim(), - scales = datum.scales, - props = Object.keys(scales), - ctx = item.context, - scale = ctx.scales[scales[props[0]]].value, - locale = ctx.dataflow.locale(); - return capitalize(type) + (title ? " titled '".concat(title, "'") : '') + " for ".concat(channelCaption(props)) + " with ".concat(domainCaption(locale, scale, item)); - } - - function extractTitle(item) { - try { - return array(peek(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } - } - - function channelCaption(props) { - props = props.map(function (p) { - return p + (p === 'fill' || p === 'stroke' ? ' color' : ''); - }); - return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + peek(props); - } - - function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; - } - - var attrText = function attrText(val) { - return (val + '').replace(/&/g, '&').replace(/"/g, '"'); - }; - /** - * Generate string for an opening xml tag. - * @param tag the name of the xml tag - * @param attr hash of attribute name-value pairs to include - * @param raw additional raw string to include in tag markup - */ - - - function openTag(tag, attr, raw) { - var s = '<' + tag, - key, - val; - - if (attr) { - for (key in attr) { - val = attr[key]; - - if (val != null) { - s += ' ' + key + '="' + attrText(val) + '"'; - } - } - } - - if (raw) s += ' ' + raw; - return s + '>'; - } - /** - * Generate string for closing xml tag. - * @param tag the name of the xml tag - */ - - - function closeTag(tag) { - return ''; - } - - var styles = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity', - blend: 'mix-blend-mode' - }; // ensure miter limit default is consistent with canvas (#2498) - - var rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 - }; - var RootIndex = 0, - ns = metadata.xmlns; - - function SVGRenderer(loader) { - Renderer.call(this, loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; - } - - var prototype$O = inherits(SVGRenderer, Renderer); - var base$1 = Renderer.prototype; - - prototype$O.initialize = function (el, width, height, padding) { - // create the svg definitions cache - this._defs = { - gradient: {}, - clipping: {} - }; - - if (el) { - this._svg = domChild(el, 0, 'svg', ns); - - this._svg.setAttribute('class', 'marks'); - - domClear(el, 1); // set the svg root group - - this._root = domChild(this._svg, RootIndex, 'g', ns); - - for (var _attr in rootAttributes) { - this._root.setAttribute(_attr, rootAttributes[_attr]); - } // ensure no additional child elements - - - domClear(this._svg, RootIndex + 1); - } // set background color if defined - - - this.background(this._bgcolor); - return base$1.initialize.call(this, el, width, height, padding); - }; - - prototype$O.background = function (bgcolor) { - if (arguments.length && this._svg) { - this._svg.style.setProperty('background-color', bgcolor); - } - - return base$1.background.apply(this, arguments); - }; - - prototype$O.resize = function (width, height, origin, scaleFactor) { - base$1.resize.call(this, width, height, origin, scaleFactor); - - if (this._svg) { - this._svg.setAttribute('width', this._width * this._scale); - - this._svg.setAttribute('height', this._height * this._scale); - - this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height); - - this._root.setAttribute('transform', 'translate(' + this._origin + ')'); - } - - this._dirty = []; - return this; - }; - - prototype$O.canvas = function () { - return this._svg; - }; - - prototype$O.svg = function () { - if (!this._svg) return null; - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - - for (var key in metadata) { - attr[key] = metadata[key]; - } - - var bg = !this._bgcolor ? '' : openTag('rect', { - width: this._width, - height: this._height, - fill: this._bgcolor - }) + closeTag('rect'); - return openTag('svg', attr) + (this._defs.el ? this._defs.el.outerHTML : '') + bg + this._root.outerHTML + closeTag('svg'); - }; // -- Render entry point -- - - - prototype$O._render = function (scene) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._resetDefs(); - this.draw(this._root, scene); - domClear(this._root, 1); - } - - this.updateDefs(); - this._dirty = []; - ++this._dirtyID; - return this; - }; // -- Manage SVG definitions ('defs') block -- - - - prototype$O.updateDefs = function () { - var svg = this._svg, - defs = this._defs; - var el = defs.el, - index = 0; - - for (var _id in defs.gradient) { - if (!el) defs.el = el = domChild(svg, RootIndex, 'defs', ns); - index = updateGradient(el, defs.gradient[_id], index); - } - - for (var _id2 in defs.clipping) { - if (!el) defs.el = el = domChild(svg, RootIndex, 'defs', ns); - index = updateClipping(el, defs.clipping[_id2], index); - } // clean-up - - - if (el) { - index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index); - } - }; - - function updateGradient(el, grad, index) { - var i, n, stop; - - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - var pt = domChild(el, index++, 'pattern', ns); - pt.setAttribute('id', patternPrefix + grad.id); - pt.setAttribute('viewBox', '0,0,1,1'); - pt.setAttribute('width', '100%'); - pt.setAttribute('height', '100%'); - pt.setAttribute('preserveAspectRatio', 'xMidYMid slice'); - pt = domChild(pt, 0, 'rect', ns); - pt.setAttribute('width', '1'); - pt.setAttribute('height', '1'); - pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')'); - el = domChild(el, index++, 'radialGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('fx', grad.x1); - el.setAttribute('fy', grad.y1); - el.setAttribute('fr', grad.r1); - el.setAttribute('cx', grad.x2); - el.setAttribute('cy', grad.y2); - el.setAttribute('r', grad.r2); - } else { - el = domChild(el, index++, 'linearGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('x1', grad.x1); - el.setAttribute('x2', grad.x2); - el.setAttribute('y1', grad.y1); - el.setAttribute('y2', grad.y2); - } - - for (i = 0, n = grad.stops.length; i < n; ++i) { - stop = domChild(el, i, 'stop', ns); - stop.setAttribute('offset', grad.stops[i].offset); - stop.setAttribute('stop-color', grad.stops[i].color); - } - - domClear(el, i); - return index; - } - - function updateClipping(el, clip, index) { - var mask; - el = domChild(el, index, 'clipPath', ns); - el.setAttribute('id', clip.id); - - if (clip.path) { - mask = domChild(el, 0, 'path', ns); - mask.setAttribute('d', clip.path); - } else { - mask = domChild(el, 0, 'rect', ns); - mask.setAttribute('x', 0); - mask.setAttribute('y', 0); - mask.setAttribute('width', clip.width); - mask.setAttribute('height', clip.height); - } - - domClear(el, 1); - return index + 1; - } - - prototype$O._resetDefs = function () { - var def = this._defs; - def.gradient = {}; - def.clipping = {}; - }; // -- Manage rendering of items marked as dirty -- - - - prototype$O.dirty = function (item) { - if (item.dirty !== this._dirtyID) { - item.dirty = this._dirtyID; - - this._dirty.push(item); - } - }; - - prototype$O.isDirty = function (item) { - return this._dirtyAll || !item._svg || item.dirty === this._dirtyID; - }; - - prototype$O._dirtyCheck = function () { - this._dirtyAll = true; - var items = this._dirty; - if (!items.length || !this._dirtyID) return true; - var id = ++this._dirtyID, - item, - mark, - type, - mdef, - i, - n, - o; - - for (i = 0, n = items.length; i < n; ++i) { - item = items[i]; - mark = item.mark; - - if (mark.marktype !== type) { - // memoize mark instance lookup - type = mark.marktype; - mdef = Marks[type]; - } - - if (mark.zdirty && mark.dirty !== id) { - this._dirtyAll = false; - dirtyParents(item, id); - mark.items.forEach(function (i) { - i.dirty = id; - }); - } - - if (mark.zdirty) continue; // handle in standard drawing pass - - if (item.exit) { - // EXIT - if (mdef.nested && mark.items.length) { - // if nested mark with remaining points, update instead - o = mark.items[0]; - if (o._svg) this._update(mdef, o._svg, o); - } else if (item._svg) { - // otherwise remove from DOM - o = item._svg.parentNode; - if (o) o.removeChild(item._svg); - } - - item._svg = null; - continue; - } - - item = mdef.nested ? mark.items[0] : item; - if (item._update === id) continue; // already visited - - if (!item._svg || !item._svg.ownerSVGElement) { - // ENTER - this._dirtyAll = false; - dirtyParents(item, id); - } else { - // IN-PLACE UPDATE - this._update(mdef, item._svg, item); - } - - item._update = id; - } - - return !this._dirtyAll; - }; - - function dirtyParents(item, id) { - for (; item && item.dirty !== id; item = item.mark.group) { - item.dirty = id; - - if (item.mark && item.mark.dirty !== id) { - item.mark.dirty = id; - } else return; - } - } // -- Construct & maintain scenegraph to SVG mapping --- - // Draw a mark container. - - - prototype$O.draw = function (el, scene, prev) { - var _this14 = this; - - if (!this.isDirty(scene)) return scene._svg; - var svg = this._svg, - mdef = Marks[scene.marktype], - events = scene.interactive === false ? 'none' : null, - isGroup = mdef.tag === 'g', - sibling = null, - i = 0, - parent; - parent = bind(scene, el, prev, 'g', svg); - parent.setAttribute('class', cssClass(scene)); // apply aria attributes to parent container element - - var aria = ariaMarkAttributes(scene); - - for (var _key6 in aria) { - setAttribute(parent, _key6, aria[_key6]); - } - - if (!isGroup) { - setAttribute(parent, 'pointer-events', events); - } - - setAttribute(parent, 'clip-path', scene.clip ? clip(this, scene, scene.group) : null); - - var process = function process(item) { - var dirty = _this14.isDirty(item), - node = bind(item, parent, sibling, mdef.tag, svg); - - if (dirty) { - _this14._update(mdef, node, item); - - if (isGroup) recurse(_this14, node, item); - } - - sibling = node; - ++i; - }; - - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } - - domClear(parent, i); - return parent; - }; // Recursively process group contents. - - - function recurse(renderer, el, group) { - el = el.lastChild.previousSibling; - var prev, - idx = 0; - visit(group, function (item) { - prev = renderer.draw(el, item, prev); - ++idx; - }); // remove any extraneous DOM elements - - domClear(el, 1 + idx); - } // Bind a scenegraph item to an SVG DOM element. - // Create new SVG elements as needed. - - - function bind(item, el, sibling, tag, svg) { - var node = item._svg, - doc; // create a new dom node if needed - - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, ns); - item._svg = node; - - if (item.mark) { - node.__data__ = item; - node.__values__ = { - fill: 'default' - }; // if group, create background, content, and foreground elements - - if (tag === 'g') { - var bg = domCreate(doc, 'path', ns); - node.appendChild(bg); - bg.__data__ = item; - var cg = domCreate(doc, 'g', ns); - node.appendChild(cg); - cg.__data__ = item; - var fg = domCreate(doc, 'path', ns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = { - fill: 'default' - }; - } - } - } // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - - - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { - el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - } - - return node; - } - - function siblingCheck(node, sibling) { - return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same - } // -- Set attributes & styles on SVG elements --- - - - var element = null, - // temp var for current SVG element - values = null; // temp var for current values hash - // Extra configuration for certain mark types - - var mark_extras = { - group: function group(mdef, el, item) { - var fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - values = el.__values__; // use parent's values hash - - element = el.childNodes[1]; - mdef.content(emit, item, this); - var bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - var value = item.mark.interactive === false ? 'none' : null; - - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - - if (item.strokeForeground && item.stroke) { - var _fill = item.fill; - setAttribute(fg, 'display', null); // set style of background - - this.style(bg, item); - setAttribute(bg, 'stroke', null); // set style of foreground - - if (_fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (_fill) item.fill = _fill; // leave element null to prevent downstream styling - - element = null; - } else { - // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - } - }, - image: function image(mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else { - setStyle(el, 'image-rendering', null); - } - }, - text: function text(mdef, el, item) { - var tl = textLines(item), - key, - value, - doc, - lh; - - if (isArray(tl)) { - // multi-line text - value = tl.map(function (_) { - return textValue(item, _); - }); - key = value.join('\n'); // content cache key - - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach(function (t, i) { - var ts = domCreate(doc, 'tspan', ns); - ts.__data__ = item; // data binding - - ts.textContent = t; - - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } - }; - - function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) { - el.style.removeProperty(name); - } else { - el.style.setProperty(name, value + ''); - } - - values[name] = value; - } - } - - prototype$O._update = function (mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; // apply aria-specific properties - - ariaItemAttributes(emit, item); // apply svg attributes - - mdef.attr(emit, item, this); // some marks need special treatment - - var extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); // apply svg style attributes - // note: element may be modified by 'extra' method - - if (element) this.style(element, item); - }; - - function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; // use appropriate method given namespace (ns) - - if (ns) { - setAttributeNS(element, name, value, ns); - } else { - setAttribute(element, name, value); - } // note current value for future comparison - - - values[name] = value; - } - - function setAttribute(el, name, value) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttribute(name, value); - } else { - // else remove DOM attribute - el.removeAttribute(name); - } - } - - function setAttributeNS(el, name, value, ns) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - } else { - // else remove DOM attribute - el.removeAttributeNS(ns, name); - } - } - - prototype$O.style = function (el, o) { - if (o == null) return; - - for (var prop in styles) { - var _value18 = prop === 'font' ? fontFamily(o) : o[prop]; - - if (_value18 === values[prop]) continue; - var name = styles[prop]; - - if (_value18 == null) { - el.removeAttribute(name); - } else { - if (isGradient(_value18)) { - _value18 = gradientRef(_value18, this._defs.gradient, href()); - } - - el.setAttribute(name, _value18 + ''); - } - - values[prop] = _value18; - } - }; - - function href() { - var loc; - return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; - } - - function SVGStringRenderer(loader) { - Renderer.call(this, loader); - this._text = { - head: '', - bg: '', - root: '', - foot: '', - defs: '', - body: '' - }; - this._defs = { - gradient: {}, - clipping: {} - }; - } - - var prototype$P = inherits(SVGStringRenderer, Renderer); - var base$2 = Renderer.prototype; - - prototype$P.resize = function (width, height, origin, scaleFactor) { - base$2.resize.call(this, width, height, origin, scaleFactor); - var o = this._origin, - t = this._text; - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - - for (var key in metadata) { - attr[key] = metadata[key]; - } - - t.head = openTag('svg', attr); - var bg = this._bgcolor; - if (bg === 'transparent' || bg === 'none') bg = null; - - if (bg) { - t.bg = openTag('rect', { - width: this._width, - height: this._height, - fill: bg - }) + closeTag('rect'); - } else { - t.bg = ''; - } - - t.root = openTag('g', extend({}, rootAttributes, { - transform: 'translate(' + o + ')' - })); - t.foot = closeTag('g') + closeTag('svg'); - return this; - }; - - prototype$P.background = function () { - var rv = base$2.background.apply(this, arguments); - - if (arguments.length && this._text.head) { - this.resize(this._width, this._height, this._origin, this._scale); - } - - return rv; - }; - - prototype$P.svg = function () { - var t = this._text; - return t.head + t.defs + t.bg + t.root + t.body + t.foot; - }; - - prototype$P._render = function (scene) { - this._text.body = this.mark(scene); - this._text.defs = this.buildDefs(); - return this; - }; - - prototype$P.buildDefs = function () { - var defs = '', - tag; - - for (var _id3 in this._defs.gradient) { - var _def = this._defs.gradient[_id3], - stops = _def.stops; - - if (_def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - defs += openTag(tag = 'pattern', { - id: patternPrefix + _id3, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - defs += openTag('rect', { - width: '1', - height: '1', - fill: 'url(#' + _id3 + ')' - }) + closeTag('rect'); - defs += closeTag(tag); - defs += openTag(tag = 'radialGradient', { - id: _id3, - fx: _def.x1, - fy: _def.y1, - fr: _def.r1, - cx: _def.x2, - cy: _def.y2, - r: _def.r2 - }); - } else { - defs += openTag(tag = 'linearGradient', { - id: _id3, - x1: _def.x1, - x2: _def.x2, - y1: _def.y1, - y2: _def.y2 - }); - } - - for (var i = 0; i < stops.length; ++i) { - defs += openTag('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }) + closeTag('stop'); - } - - defs += closeTag(tag); - } - - for (var _id4 in this._defs.clipping) { - var _def2 = this._defs.clipping[_id4]; - defs += openTag('clipPath', { - id: _id4 - }); - - if (_def2.path) { - defs += openTag('path', { - d: _def2.path - }) + closeTag('path'); - } else { - defs += openTag('rect', { - x: 0, - y: 0, - width: _def2.width, - height: _def2.height - }) + closeTag('rect'); - } - - defs += closeTag('clipPath'); - } - - return defs ? openTag('defs') + defs + closeTag('defs') : ''; - }; - - prototype$P.attr = function (scene, item, attrs, tag) { - var _this15 = this; - - var object = {}, - emit = function emit(name, value, ns, prefixed) { - object[prefixed || name] = value; - }; // apply mark specific attributes - - - if (Array.isArray(attrs)) { - attrs.forEach(function (fn) { - return fn(emit, item, _this15); - }); - } else { - attrs(emit, item, this); - } // apply style attributes - - - if (tag) { - applyStyles(object, item, scene, tag, this._defs); - } - - return object; - }; - - prototype$P.href = function (item) { - var that = this, - href = item.href, - attr; - - if (href) { - if (attr = that._hrefs && that._hrefs[href]) { - return attr; - } else { - that.sanitizeURL(href).then(function (attr) { - // rewrite to use xlink namespace - // note that this will be deprecated in SVG 2.0 - attr['xlink:href'] = attr.href; - attr.href = null; - (that._hrefs || (that._hrefs = {}))[href] = attr; - }); - } - } - - return null; - }; - - prototype$P.mark = function (scene) { - var _this16 = this; - - var mdef = Marks[scene.marktype], - tag = mdef.tag, - attrList = [ariaItemAttributes, mdef.attr]; - var str = ''; // render opening group tag - - str += openTag('g', extend({ - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip(this, scene, scene.group) : null - }, ariaMarkAttributes(scene), { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - })); // render contained elements - - var process = function process(item) { - var href = _this16.href(item); - - if (href) str += openTag('a', href); - str += openTag(tag, _this16.attr(scene, item, attrList, tag !== 'g' ? tag : null)); - - if (tag === 'text') { - var _tl = textLines(item); - - if (isArray(_tl)) { - // multi-line text - var attrs = { - x: 0, - dy: lineHeight(item) - }; - - for (var i = 0; i < _tl.length; ++i) { - str += openTag('tspan', i ? attrs : null) + escape_text(textValue(item, _tl[i])) + closeTag('tspan'); - } - } else { - // single-line text - str += escape_text(textValue(item, _tl)); - } - } else if (tag === 'g') { - var fore = item.strokeForeground, - _fill2 = item.fill, - _stroke = item.stroke; - - if (fore && _stroke) { - item.stroke = null; - } - - str += openTag('path', _this16.attr(scene, item, mdef.background, 'bgrect')) + closeTag('path'); - str += openTag('g', _this16.attr(scene, item, mdef.content)) + _this16.markGroup(item) + closeTag('g'); - - if (fore && _stroke) { - if (_fill2) item.fill = null; - item.stroke = _stroke; - str += openTag('path', _this16.attr(scene, item, mdef.foreground, 'bgrect')) + closeTag('path'); - if (_fill2) item.fill = _fill2; - } else { - str += openTag('path', _this16.attr(scene, item, mdef.foreground, 'bgfore')) + closeTag('path'); - } - } - - str += closeTag(tag); - if (href) str += closeTag('a'); - }; - - if (mdef.nested) { - if (scene.items && scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } // render closing group tag - - - return str + closeTag('g'); - }; - - prototype$P.markGroup = function (scene) { - var _this17 = this; - - var str = ''; - visit(scene, function (item) { - str += _this17.mark(item); - }); - return str; - }; - - function applyStyles(s, item, scene, tag, defs) { - if (item == null) return s; - - if (tag === 'bgrect' && scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - if (tag === 'bgfore') { - if (scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - s.display = 'none'; - if (item.fill !== null) return s; - } - - if (tag === 'image' && item.smooth === false) { - s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;'; - } - - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - if (item.fontStyle) s['font-style'] = item.fontStyle; - if (item.fontVariant) s['font-variant'] = item.fontVariant; - if (item.fontWeight) s['font-weight'] = item.fontWeight; - } - - for (var prop in styles) { - var _value19 = item[prop]; - var name = styles[prop]; - if (_value19 === 'transparent' && (name === 'fill' || name === 'stroke')) ;else if (_value19 != null) { - if (isGradient(_value19)) { - _value19 = gradientRef(_value19, defs.gradient, ''); - } - - s[name] = _value19; - } - } - - return s; - } - - function escape_text(s) { - return s.replace(/&/g, '&').replace(//g, '>'); - } - - var Canvas = 'canvas'; - var PNG = 'png'; - var SVG = 'svg'; - var None$2 = 'none'; - var RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - None: None$2 - }; - var modules = {}; - modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler - }; - modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler - }; - modules[None$2] = {}; - - function renderModule(name, _) { - name = String(name || '').toLowerCase(); - - if (arguments.length > 1) { - modules[name] = _; - return this; - } else { - return modules[name]; - } - } - - function intersect$1(scene, bounds, filter) { - var hits = [], - // intersection results - box = new Bounds().union(bounds), - // defensive copy - type = scene.marktype; - return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : error('Intersect scene must be mark node or group item.'); - } - - function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - var items = mark.items, - _type2 = mark.marktype, - n = items.length; - var i = 0; - - if (_type2 === 'group') { - for (; i < n; ++i) { - intersectGroup(items[i], box, filter, hits); - } - } else { - for (var test = Marks[_type2].isect; i < n; ++i) { - var item = items[i]; - if (intersectItem(item, box, test)) hits.push(item); - } - } - } - - return hits; - } - - function visitMark(mark, box, filter) { - // process if bounds intersect and if - // (1) mark is a group mark (so we must recurse), or - // (2) mark is interactive and passes filter - return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark))); - } - - function intersectGroup(group, box, filter, hits) { - // test intersect against group - // skip groups by default unless filter says otherwise - if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) { - hits.push(group); - } // recursively test children marks - // translate box to group coordinate space - - - var marks = group.items, - n = marks && marks.length; - - if (n) { - var _x24 = group.x || 0, - _y3 = group.y || 0; - - box.translate(-_x24, -_y3); - - for (var i = 0; i < n; ++i) { - intersectMark(marks[i], box, filter, hits); - } - - box.translate(_x24, _y3); - } - - return hits; - } - - function intersectItem(item, box, test) { - // test bounds enclosure, bounds intersection, then detailed test - var bounds = item.bounds; - return box.encloses(bounds) || box.intersects(bounds) && test(item, box); - } - - var clipBounds = new Bounds(); - - function boundClip(mark) { - var clip = mark.clip; - - if (isFunction(clip)) { - clip(context(clipBounds.clear())); - } else if (clip) { - clipBounds.set(0, 0, mark.group.width, mark.group.height); - } else return; - - mark.bounds.intersect(clipBounds); - } - - var TOLERANCE = 1e-9; - - function sceneEqual(a, b, key) { - return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : isNumber(a) && isNumber(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !isObject(a) && !isObject(b) ? a == b : a == null || b == null ? false : objectEqual(a, b); - } - - function pathEqual(a, b) { - return sceneEqual(pathParse(a), pathParse(b)); - } - - function objectEqual(a, b) { - var ka = Object.keys(a), - kb = Object.keys(b), - key, - i; - if (ka.length !== kb.length) return false; - ka.sort(); - kb.sort(); - - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) return false; - } - - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; - } - - return _typeof(a) === _typeof(b); - } - - function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); - } - /** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ - - - function Bound(params) { - Transform.call(this, null, params); - } - - var prototype$Q = inherits(Bound, Transform); - - prototype$Q.transform = function (_, pulse) { - var view = pulse.dataflow, - mark = _.mark, - type = mark.marktype, - entry = Marks[type], - bound = entry.bound, - markBounds = mark.bounds, - rebound; - - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem$1(mark, bound); - mark.items.forEach(function (item) { - item.bounds.clear().union(markBounds); - }); - } else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, function (item) { - return view.dirty(item); - }); - markBounds.clear(); - mark.items.forEach(function (item) { - return markBounds.union(boundItem$1(item, bound)); - }); // force reflow for axes/legends/titles to propagate any layout changes - - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - pulse.visit(pulse.ADD, function (item) { - markBounds.union(boundItem$1(item, bound)); - }); - pulse.visit(pulse.MOD, function (item) { - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem$1(item, bound)); - }); - - if (rebound) { - markBounds.clear(); - mark.items.forEach(function (item) { - return markBounds.union(item.bounds); - }); - } - } // ensure mark bounds do not exceed any clipping region - - - boundClip(mark); - return pulse.modifies('bounds'); - }; - - function boundItem$1(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); - } - - var COUNTER_NAME = ':vega_identifier:'; - /** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ - - function Identifier(params) { - Transform.call(this, 0, params); - } - - Identifier.Definition = { - 'type': 'Identifier', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'as', - 'type': 'string', - 'required': true - }] - }; - var prototype$R = inherits(Identifier, Transform); - - prototype$R.transform = function (_, pulse) { - var counter = getCounter(pulse.dataflow), - id = counter.value, - as = _.as; - pulse.visit(pulse.ADD, function (t) { - if (!t[as]) t[as] = ++id; - }); - counter.set(this.value = id); - return pulse; - }; - - function getCounter(view) { - var counter = view._signals[COUNTER_NAME]; - - if (!counter) { - view._signals[COUNTER_NAME] = counter = view.add(0); - } - - return counter; - } - /** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ - - - function Mark(params) { - Transform.call(this, null, params); - } - - var prototype$S = inherits(Mark, Transform); - - prototype$S.transform = function (_, pulse) { - var mark = this.value; // acquire mark on first invocation, bind context and group - - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } // initialize entering items - - - var Init = mark.marktype === Group ? GroupItem : Item; - pulse.visit(pulse.ADD, function (item) { - return Init.call(item, mark); - }); // update clipping and/or interactive status - - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - - pulse.reflow(); - } // bind items array to scenegraph mark - - - mark.items = pulse.source; - return pulse; - }; - - function lookup$1(_) { - var g = _.groups, - p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; - } - /** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ - - - function Overlap(params) { - Transform.call(this, null, params); - } - - var prototype$T = inherits(Overlap, Transform); - var methods = { - parity: function parity(items) { - return items.filter(function (item, i) { - return i % 2 ? item.opacity = 0 : 1; - }); - }, - greedy: function greedy(items, sep) { - var a; - return items.filter(function (b, i) { - if (!i || !intersect$2(a.bounds, b.bounds, sep)) { - a = b; - return 1; - } else { - return b.opacity = 0; - } - }); - } - }; // compute bounding box intersection - // including padding pixels of separation - - function intersect$2(a, b, sep) { - return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2); - } - - function hasOverlap(items, pad) { - for (var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i) { - if (intersect$2(a, b = items[i].bounds, pad)) return true; - } - } - - function hasBounds(item) { - var b = item.bounds; - return b.width() > 1 && b.height() > 1; - } - - function boundTest(scale, orient, tolerance) { - var range = scale.range(), - b = new Bounds(); - - if (orient === Top || orient === Bottom) { - b.set(range[0], -Infinity, range[1], +Infinity); - } else { - b.set(-Infinity, range[0], +Infinity, range[1]); - } - - b.expand(tolerance || 1); - return function (item) { - return b.encloses(item.bounds); - }; - } // reset all items to be fully opaque - - - function reset(source) { - source.forEach(function (item) { - return item.opacity = 1; - }); - return source; - } // add all tuples to mod, fork pulse if parameters were modified - // fork prevents cross-stream tuple pollution (e.g., pulse from scale) - - - function reflow(pulse, _) { - return pulse.reflow(_.modified()).modifies('opacity'); - } - - prototype$T.transform = function (_, pulse) { - var reduce = methods[_.method] || methods.parity, - source = pulse.materialize(pulse.SOURCE).source, - sep = _.separation || 0, - items, - test, - bounds; - if (!source || !source.length) return; - - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - - return pulse; - } // skip labels with no content - - - source = source.filter(hasBounds); // early exit, nothing to do - - if (!source.length) return; - - if (_.sort) { - source = source.slice().sort(_.sort); - } - - items = reset(source); - pulse = reflow(pulse, _); - - if (items.length >= 3 && hasOverlap(items, sep)) { - do { - items = reduce(items, sep); - } while (items.length >= 3 && hasOverlap(items, sep)); - - if (items.length < 3 && !peek(source).opacity) { - if (items.length > 1) peek(items).opacity = 0; - peek(source).opacity = 1; - } - } - - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach(function (item) { - if (!test(item)) item.opacity = 0; - }); - } // re-calculate mark bounds - - - bounds = items[0].mark.bounds.clear(); - source.forEach(function (item) { - if (item.opacity) bounds.union(item.bounds); - }); - return pulse; - }; - /** - * Queue modified scenegraph items for rendering. - * @constructor - */ - - - function Render(params) { - Transform.call(this, null, params); - } - - var prototype$U = inherits(Render, Transform); - - prototype$U.transform = function (_, pulse) { - var view = pulse.dataflow; - pulse.visit(pulse.ALL, function (item) { - return view.dirty(item); - }); // set z-index dirty flag as needed - - if (pulse.fields && pulse.fields['zindex']) { - var item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } - }; - - var tempBounds$1 = new Bounds(); - - function set$1(item, property, value) { - return item[property] === value ? 0 : (item[property] = value, 1); - } - - function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; - } - - function axisIndices(datum) { - var index = +datum.grid; - return [datum.ticks ? index++ : -1, // ticks index - datum.labels ? index++ : -1, // labels index - index + +datum.domain // title index - ]; - } - - function axisLayout(view, axis, width, height) { - var item = axis.items[0], - datum = item.datum, - delta = item.translate != null ? item.translate : 0.5, - orient = item.orient, - indices = axisIndices(datum), - range = item.range, - offset = item.offset, - position = item.position, - minExtent = item.minExtent, - maxExtent = item.maxExtent, - title = datum.title && item.items[indices[2]].items[0], - titlePadding = item.titlePadding, - bounds = item.bounds, - dl = title && multiLineOffset(title), - x = 0, - y = 0, - i, - s; - tempBounds$1.clear().union(bounds); - bounds.clear(); - if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds); // position axis group and title - - switch (orient) { - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - - default: - x = item.x; - y = item.y; - } // update bounds - - - boundStroke(bounds.translate(x, y), item); - - if (set$1(item, 'x', x + delta) | set$1(item, 'y', y + delta)) { - item.bounds = tempBounds$1; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - - return item.mark.bounds.clear().union(bounds); - } - - function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - var b = title.bounds; - - if (title.auto) { - var v = sign * (offset + dl + pad); - var dx = 0, - dy = 0; - view.dirty(title); - isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - - bounds.union(b); - } // aggregation functions for grid margin determination - - - var min$2 = function min$2(a, b) { - return Math.floor(Math.min(a, b)); - }; - - var max$2 = function max$2(a, b) { - return Math.ceil(Math.max(a, b)); - }; - - function gridLayoutGroups(group) { - var _views$rowheaders, _views$rowfooters, _views$colheaders, _views$colfooters, _views$marks; - - var groups = group.items, - n = groups.length, - i = 0, - mark, - items; - var views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; // layout axes, gather legends, collect bounds - - for (; i < n; ++i) { - mark = groups[i]; - items = mark.items; - - if (mark.marktype === Group) { - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - break; - - case RowHeader: - (_views$rowheaders = views.rowheaders).push.apply(_views$rowheaders, _toConsumableArray(items)); - - break; - - case RowFooter: - (_views$rowfooters = views.rowfooters).push.apply(_views$rowfooters, _toConsumableArray(items)); - - break; - - case ColHeader: - (_views$colheaders = views.colheaders).push.apply(_views$colheaders, _toConsumableArray(items)); - - break; - - case ColFooter: - (_views$colfooters = views.colfooters).push.apply(_views$colfooters, _toConsumableArray(items)); - - break; - - case RowTitle: - views.rowtitle = items[0]; - break; - - case ColTitle: - views.coltitle = items[0]; - break; - - default: - (_views$marks = views.marks).push.apply(_views$marks, _toConsumableArray(items)); - - } - } - } - - return views; - } - - function bboxFlush(item) { - return new Bounds().set(0, 0, item.width || 0, item.height || 0); - } - - function bboxFull(item) { - var b = item.bounds.clone(); - return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0)); - } - - function get$3(opt, key, d) { - var v = isObject(opt) ? opt[key] : opt; - return v != null ? v : d !== undefined ? d : 0; - } - - function offsetValue(v) { - return v < 0 ? Math.ceil(-v) : 0; - } - - function gridLayout(view, groups, opt) { - var dirty = !opt.nodirty, - bbox = opt.bounds === Flush ? bboxFlush : bboxFull, - bounds = tempBounds$1.set(0, 0, 0, 0), - alignCol = get$3(opt.align, Column), - alignRow = get$3(opt.align, Row), - padCol = get$3(opt.padding, Column), - padRow = get$3(opt.padding, Row), - ncols = opt.columns || groups.length, - nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), - n = groups.length, - xOffset = Array(n), - xExtent = Array(ncols), - xMax = 0, - yOffset = Array(n), - yExtent = Array(nrows), - yMax = 0, - dx = Array(n), - dy = Array(n), - boxes = Array(n), - m, - i, - c, - r, - b, - g, - px, - py, - x, - y, - offset; - - for (i = 0; i < ncols; ++i) { - xExtent[i] = 0; - } - - for (i = 0; i < nrows; ++i) { - yExtent[i] = 0; - } // determine offsets for each group - - - for (i = 0; i < n; ++i) { - g = groups[i]; - b = boxes[i] = bbox(g); - g.x = g.x || 0; - dx[i] = 0; - g.y = g.y || 0; - dy[i] = 0; - c = i % ncols; - r = ~~(i / ncols); - xMax = Math.max(xMax, px = Math.ceil(b.x2)); - yMax = Math.max(yMax, py = Math.ceil(b.y2)); - xExtent[c] = Math.max(xExtent[c], px); - yExtent[r] = Math.max(yExtent[r], py); - xOffset[i] = padCol + offsetValue(b.x1); - yOffset[i] = padRow + offsetValue(b.y1); - if (dirty) view.dirty(groups[i]); - } // set initial alignment offsets - - - for (i = 0; i < n; ++i) { - if (i % ncols === 0) xOffset[i] = 0; - if (i < ncols) yOffset[i] = 0; - } // enforce column alignment constraints - - - if (alignCol === Each) { - for (c = 1; c < ncols; ++c) { - for (offset = 0, i = c; i < n; i += ncols) { - if (offset < xOffset[i]) offset = xOffset[i]; - } - - for (i = c; i < n; i += ncols) { - xOffset[i] = offset + xExtent[c - 1]; - } - } - } else if (alignCol === All) { - for (offset = 0, i = 0; i < n; ++i) { - if (i % ncols && offset < xOffset[i]) offset = xOffset[i]; - } - - for (i = 0; i < n; ++i) { - if (i % ncols) xOffset[i] = offset + xMax; - } - } else { - for (alignCol = false, c = 1; c < ncols; ++c) { - for (i = c; i < n; i += ncols) { - xOffset[i] += xExtent[c - 1]; - } - } - } // enforce row alignment constraints - - - if (alignRow === Each) { - for (r = 1; r < nrows; ++r) { - for (offset = 0, i = r * ncols, m = i + ncols; i < m; ++i) { - if (offset < yOffset[i]) offset = yOffset[i]; - } - - for (i = r * ncols; i < m; ++i) { - yOffset[i] = offset + yExtent[r - 1]; - } - } - } else if (alignRow === All) { - for (offset = 0, i = ncols; i < n; ++i) { - if (offset < yOffset[i]) offset = yOffset[i]; - } - - for (i = ncols; i < n; ++i) { - yOffset[i] = offset + yMax; - } - } else { - for (alignRow = false, r = 1; r < nrows; ++r) { - for (i = r * ncols, m = i + ncols; i < m; ++i) { - yOffset[i] += yExtent[r - 1]; - } - } - } // perform horizontal grid layout - - - for (x = 0, i = 0; i < n; ++i) { - x = xOffset[i] + (i % ncols ? x : 0); - dx[i] += x - groups[i].x; - } // perform vertical grid layout - - - for (c = 0; c < ncols; ++c) { - for (y = 0, i = c; i < n; i += ncols) { - y += yOffset[i]; - dy[i] += y - groups[i].y; - } - } // perform horizontal centering - - - if (alignCol && get$3(opt.center, Column) && nrows > 1) { - for (i = 0; i < n; ++i) { - b = alignCol === All ? xMax : xExtent[i % ncols]; - x = b - boxes[i].x2 - groups[i].x - dx[i]; - if (x > 0) dx[i] += x / 2; - } - } // perform vertical centering - - - if (alignRow && get$3(opt.center, Row) && ncols !== 1) { - for (i = 0; i < n; ++i) { - b = alignRow === All ? yMax : yExtent[~~(i / ncols)]; - y = b - boxes[i].y2 - groups[i].y - dy[i]; - if (y > 0) dy[i] += y / 2; - } - } // position grid relative to anchor - - - for (i = 0; i < n; ++i) { - bounds.union(boxes[i].translate(dx[i], dy[i])); - } - - x = get$3(opt.anchor, X); - y = get$3(opt.anchor, Y); - - switch (get$3(opt.anchor, Column)) { - case End: - x -= bounds.width(); - break; - - case Middle: - x -= bounds.width() / 2; - } - - switch (get$3(opt.anchor, Row)) { - case End: - y -= bounds.height(); - break; - - case Middle: - y -= bounds.height() / 2; - } - - x = Math.round(x); - y = Math.round(y); // update mark positions, bounds, dirty - - bounds.clear(); - - for (i = 0; i < n; ++i) { - groups[i].mark.bounds.clear(); - } - - for (i = 0; i < n; ++i) { - g = groups[i]; - g.x += dx[i] += x; - g.y += dy[i] += y; - bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); - if (dirty) view.dirty(g); - } - - return bounds; - } - - function trellisLayout(view, group, opt) { - var views = gridLayoutGroups(group), - groups = views.marks, - bbox = opt.bounds === Flush ? boundFlush : boundFull, - off = opt.offset, - ncols = opt.columns || groups.length, - nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), - cells = nrows * ncols, - x, - y, - x2, - y2, - anchor, - band, - offset; // -- initial grid layout - - var bounds = gridLayout(view, groups, opt); - if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid - // -- layout grid headers and footers -- - // perform row header layout - - if (views.rowheaders) { - band = get$3(opt.headerBand, Row, null); - x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get$3(off, 'rowHeader'), min$2, 0, bbox, 'x1', 0, ncols, 1, band); - } // perform column header layout - - - if (views.colheaders) { - band = get$3(opt.headerBand, Column, null); - y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get$3(off, 'columnHeader'), min$2, 1, bbox, 'y1', 0, 1, ncols, band); - } // perform row footer layout - - - if (views.rowfooters) { - band = get$3(opt.footerBand, Row, null); - x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get$3(off, 'rowFooter'), max$2, 0, bbox, 'x2', ncols - 1, ncols, 1, band); - } // perform column footer layout - - - if (views.colfooters) { - band = get$3(opt.footerBand, Column, null); - y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get$3(off, 'columnFooter'), max$2, 1, bbox, 'y2', cells - ncols, 1, ncols, band); - } // perform row title layout - - - if (views.rowtitle) { - anchor = get$3(opt.titleAnchor, Row); - offset = get$3(off, 'rowTitle'); - offset = anchor === End ? x2 + offset : x - offset; - band = get$3(opt.titleBand, Row, 0.5); - layoutTitle(view, views.rowtitle, offset, 0, bounds, band); - } // perform column title layout - - - if (views.coltitle) { - anchor = get$3(opt.titleAnchor, Column); - offset = get$3(off, 'columnTitle'); - offset = anchor === End ? y2 + offset : y - offset; - band = get$3(opt.titleBand, Column, 0.5); - layoutTitle(view, views.coltitle, offset, 1, bounds, band); - } - } - - function boundFlush(item, field) { - return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined; - } - - function boundFull(item, field) { - return item.bounds[field]; - } - - function layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) { - var n = groups.length, - init = 0, - edge = 0, - i, - j, - k, - m, - b, - h, - g, - x, - y; // if no groups, early exit and return 0 - - if (!n) return init; // compute margin - - for (i = start; i < n; i += stride) { - if (groups[i]) init = agg(init, bound(groups[i], bf)); - } // if no headers, return margin calculation - - - if (!headers.length) return init; // check if number of headers exceeds number of rows or columns - - if (headers.length > limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } // apply offset - - - init += offset; // clear mark bounds for all headers - - for (j = 0, m = headers.length; j < m; ++j) { - view.dirty(headers[j]); - headers[j].mark.bounds.clear(); - } // layout each header - - - for (i = start, j = 0, m = headers.length; j < m; ++j, i += stride) { - h = headers[j]; - b = h.mark.bounds; // search for nearest group to align to - // necessary if table has empty cells - - for (k = i; k >= 0 && (g = groups[k]) == null; k -= back) { - ; - } // assign coordinates and update bounds - - - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); // update current edge of layout bounds - - edge = agg(edge, b[bf]); - } - - return edge; - } - - function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); // compute title coordinates - - var x = offset, - y = offset; - isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height()); // assign coordinates and update bounds - - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; // queue title for redraw - - view.dirty(g); - } // utility for looking up legend layout configuration - - - function lookup$2(config, orient) { - var opt = config[orient] || {}; - return function (key, d) { - return opt[key] != null ? opt[key] : config[key] != null ? config[key] : d; - }; - } // if legends specify offset directly, use the maximum specified value - - - function offsets(legends, value) { - var max = -Infinity; - legends.forEach(function (item) { - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; - } - - function legendParams(g, orient, config, xb, yb, w, h) { - var _ = lookup$2(config, orient), - offset = offsets(g, _('offset', 0)), - anchor = _('anchor', Start), - mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - - var p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - - switch (orient) { - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, - column: End, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, - row: End, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - - case TopLeft: - p.anchor = { - x: offset, - y: offset - }; - break; - - case TopRight: - p.anchor = { - x: w - offset, - y: offset, - column: End - }; - break; - - case BottomLeft: - p.anchor = { - x: offset, - y: h - offset, - row: End - }; - break; - - case BottomRight: - p.anchor = { - x: w - offset, - y: h - offset, - column: End, - row: End - }; - break; - } - - return p; - } - - function legendLayout(view, legend) { - var item = legend.items[0], - datum = item.datum, - orient = item.orient, - bounds = item.bounds, - x = item.x, - y = item.y, - w, - h; // cache current bounds for later comparison - - item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone(); - bounds.clear(); // adjust legend to accommodate padding and title - - legendGroupLayout(view, item, item.items[0].items[0]); // aggregate bounds to determine size, and include origin - - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - - if (datum.type === Symbols) { - legendEntryLayout(item.items[0].items[0].items[0].items); - } - - if (orient !== None$1) { - item.x = x = 0; - item.y = y = 0; - } - - item.width = w; - item.height = h; - boundStroke(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - return item; - } - - function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach(function (_) { - return b.union(_.bounds); - }); // anchor to legend origin - - b.x1 = item.padding; - b.y1 = item.padding; - return b; - } - - function legendGroupLayout(view, item, entry) { - var pad = item.padding, - ex = pad - entry.x, - ey = pad - entry.y; - - if (!item.datum.title) { - if (ex || ey) translate$1(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], - anchor = title.anchor, - tpad = item.titlePadding || 0, - tx = pad - title.x, - ty = pad - title.y; - - switch (title.orient) { - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - - case Right: - case Bottom: - break; - - default: - ey += title.bounds.height() + tpad; - } - - if (ex || ey) translate$1(view, entry, ex, ey); - - switch (title.orient) { - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - - if (tx || ty) translate$1(view, title, tx, ty); // translate legend if title pushes into negative coordinates - - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate$1(view, entry, -tx, 0); - translate$1(view, title, -tx, 0); - } - } - } - - function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - var grad = item.datum.type !== 'symbol', - vgrad = title.datum.vgrad, - e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, - s = e.bounds[y ? 'y2' : 'x2'] - item.padding, - u = vgrad && lr ? s : 0, - v = vgrad && lr ? 0 : s, - o = y <= 0 ? 0 : multiLineOffset(title); - return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o)); - } - - function translate$1(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); - } - - function legendEntryLayout(entries) { - // get max widths for each column - var widths = entries.reduce(function (w, g) { - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); // set dimensions of legend entry groups - - entries.forEach(function (g) { - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); - } - - function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], - frame = group.frame, - orient = group.orient, - anchor = group.anchor, - offset = group.offset, - padding = group.padding, - title = group.items[0].items[0], - subtitle = group.items[1] && group.items[1].items[0], - end = orient === Left || orient === Right ? height : width, - start = 0, - x = 0, - y = 0, - sx = 0, - sy = 0, - pos; - - if (frame !== Group) { - orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2); - } else if (orient === Left) { - start = height, end = 0; - } - - pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2; - - if (subtitle && subtitle.text) { - // position subtitle - switch (orient) { - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - - case Left: - sx = title.bounds.width() + padding; - break; - - case Right: - sx = -title.bounds.width() - padding; - break; - } - - tempBounds$1.clear().union(subtitle.bounds); - tempBounds$1.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - - if (set$1(subtitle, 'x', sx) | set$1(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds$1); - subtitle.mark.bounds.clear().union(tempBounds$1); - view.dirty(subtitle); - } - - tempBounds$1.clear().union(subtitle.bounds); - } else { - tempBounds$1.clear(); - } - - tempBounds$1.union(title.bounds); // position title group - - switch (orient) { - case Top: - x = pos; - y = viewBounds.y1 - tempBounds$1.height() - offset; - break; - - case Left: - x = viewBounds.x1 - tempBounds$1.width() - offset; - y = pos; - break; - - case Right: - x = viewBounds.x2 + tempBounds$1.width() + offset; - y = pos; - break; - - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - - default: - x = group.x; - y = group.y; - } - - if (set$1(group, 'x', x) | set$1(group, 'y', y)) { - tempBounds$1.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds$1); - mark.bounds.clear().union(tempBounds$1); - view.dirty(group); - } - - return group.bounds; - } - /** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ - - - function ViewLayout(params) { - Transform.call(this, null, params); - } - - var prototype$V = inherits(ViewLayout, Transform); - - prototype$V.transform = function (_, pulse) { - var view = pulse.dataflow; - - _.mark.items.forEach(function (group) { - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; - }; - - function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; - } - - function layoutGroup(view, group, _) { - var items = group.items, - width = Math.max(0, group.width || 0), - height = Math.max(0, group.height || 0), - viewBounds = new Bounds().set(0, 0, width, height), - xBounds = viewBounds.clone(), - yBounds = viewBounds.clone(), - legends = [], - title, - mark, - orient, - b, - i, - n; // layout axes, gather legends, collect bounds - - for (i = 0, n = items.length; i < n; ++i) { - mark = items[i]; - - switch (mark.role) { - case AxisRole: - b = isYAxis(mark) ? xBounds : yBounds; - b.union(axisLayout(view, mark, width, height)); - break; - - case TitleRole: - title = mark; - break; - - case LegendRole: - legends.push(legendLayout(view, mark)); - break; - - case FrameRole: - case ScopeRole: - case RowHeader: - case RowFooter: - case RowTitle: - case ColHeader: - case ColFooter: - case ColTitle: - xBounds.union(mark.bounds); - yBounds.union(mark.bounds); - break; - - default: - viewBounds.union(mark.bounds); - } - } // layout legends, adjust viewBounds - - - if (legends.length) { - // group legends by orient - var l = {}; - legends.forEach(function (item) { - orient = item.orient || Right; - if (orient !== None$1) (l[orient] || (l[orient] = [])).push(item); - }); // perform grid layout for each orient group - - for (var _orient in l) { - var g = l[_orient]; - gridLayout(view, g, legendParams(g, _orient, _.legends, xBounds, yBounds, width, height)); - } // update view bounds - - - legends.forEach(function (item) { - var b = item.bounds; - - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - - item.bounds = b; - view.dirty(item); - } - - if (_.autosize && _.autosize.type === Fit) { - // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch (item.orient) { - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - } else { - viewBounds.union(b); - } - }); - } // combine bounding boxes - - - viewBounds.union(xBounds).union(yBounds); // layout title, adjust bounds - - if (title) { - viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - } // override aggregated view bounds if content is clipped - - - if (group.clip) { - viewBounds.set(0, 0, group.width || 0, group.height || 0); - } // perform size adjustment - - - viewSizeLayout(view, group, viewBounds, _); - } - - function viewSizeLayout(view, group, viewBounds, _) { - var auto = _.autosize || {}, - type = auto.type; - if (view._autosize < 1 || !type) return; - var viewWidth = view._width, - viewHeight = view._height, - width = Math.max(0, group.width || 0), - left = Math.max(0, Math.ceil(-viewBounds.x1)), - right = Math.max(0, Math.ceil(viewBounds.x2 - width)), - height = Math.max(0, group.height || 0), - top = Math.max(0, Math.ceil(-viewBounds.y1)), - bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - - if (auto.contains === Padding) { - var _padding = view.padding(); - - viewWidth -= _padding.left + _padding.right; - viewHeight -= _padding.top + _padding.bottom; - } - - if (type === None$1) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - - view._resizeView(viewWidth, viewHeight, width, height, [left, top], auto.resize); - } - - var vtx = /*#__PURE__*/Object.freeze({ - __proto__: null, - bound: Bound, - identifier: Identifier, - mark: Mark, - overlap: Overlap, - render: Render, - viewlayout: ViewLayout - }); - /** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - - function AxisTicks(params) { - Transform.call(this, null, params); - } - - var prototype$W = inherits(AxisTicks, Transform); - - prototype$W.transform = function (_, pulse) { - if (this.value && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - ticks = this.value, - scale = _.scale, - tally = _.count == null ? _.values ? _.values.length : 10 : _.count, - count = tickCount(scale, tally, _.minstep), - format = _.format || tickFormat$1(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), - values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count); - if (ticks) out.rem = ticks; - ticks = values.map(function (value, i) { - return ingest({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - }); - }); - - if (_.extra && ticks.length) { - // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push(ingest({ - index: -1, - extra: { - value: ticks[0].value - }, - label: '' - })); - } - - out.source = ticks; - out.add = ticks; - this.value = ticks; - return out; - }; - /** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ - - - function DataJoin(params) { - Transform.call(this, null, params); - } - - var prototype$X = inherits(DataJoin, Transform); - - function defaultItemCreate() { - return ingest({}); - } - - function newMap(key) { - var map = fastmap().test(function (t) { - return t.exit; - }); - - map.lookup = function (t) { - return map.get(key(t)); - }; - - return map; - } - - prototype$X.transform = function (_, pulse) { - var df = pulse.dataflow, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - item = _.item || defaultItemCreate, - key = _.key || tupleid, - map = this.value; // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - - if (isArray(out.encode)) { - out.encode = null; - } - - if (map && (_.modified('key') || pulse.modified(key))) { - error('DataJoin does not support modified key function or fields.'); - } - - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - - pulse.visit(pulse.ADD, function (t) { - var k = key(t); - var x = map.get(k); - - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else { - out.mod.push(x); - } - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - - x.datum = t; - x.exit = false; - }); - pulse.visit(pulse.MOD, function (t) { - var k = key(t), - x = map.get(k); - - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - pulse.visit(pulse.REM, function (t) { - var k = key(t), - x = map.get(k); - - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) { - df.runAfter(map.clean); - } - - return out; - }; - /** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ - - - function Encode(params) { - Transform.call(this, null, params); - } - - var prototype$Y = inherits(Encode, Transform); - - prototype$Y.transform = function (_, pulse) { - var out = pulse.fork(pulse.ADD_REM), - fmod = _.mod || false, - encoders = _.encoders, - encode = pulse.encode; // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - - if (isArray(encode)) { - if (out.changed() || encode.every(function (e) { - return encoders[e]; - })) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else { - return pulse.StopPropagation; - } - } // marshall encoder functions - - - var reenter = encode === 'enter', - update = encoders.update || falsy, - enter = encoders.enter || falsy, - exit = encoders.exit || falsy, - set = (encode && !reenter ? encoders[encode] : update) || falsy; - - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, function (t) { - enter(t, _); - update(t, _); - }); - out.modifies(enter.output); - out.modifies(update.output); - - if (set !== falsy && set !== update) { - pulse.visit(pulse.ADD, function (t) { - set(t, _); - }); - out.modifies(set.output); - } - } - - if (pulse.changed(pulse.REM) && exit !== falsy) { - pulse.visit(pulse.REM, function (t) { - exit(t, _); - }); - out.modifies(exit.output); - } - - if (reenter || set !== falsy) { - var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - - if (reenter) { - pulse.visit(flag, function (t) { - var mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else { - pulse.visit(flag, function (t) { - if (set(t, _) || fmod) out.mod.push(t); - }); - } - - if (out.mod.length) out.modifies(set.output); - } - - return out.changed() ? out : pulse.StopPropagation; - }; - /** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - - - function LegendEntries(params) { - Transform.call(this, [], params); - } - - var prototype$Z = inherits(LegendEntries, Transform); - - prototype$Z.transform = function (_, pulse) { - if (this.value != null && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - items = this.value, - type = _.type || SymbolLegend, - scale = _.scale, - limit = +_.limit, - count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep), - lskip = !!_.values || type === SymbolLegend, - format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), - values = _.values || labelValues(scale, count), - domain, - fraction, - size, - offset, - ellipsis; - if (items) out.rem = items; - - if (type === SymbolLegend) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else { - items = values; - } - - if (isFunction(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) { - items = items.slice(1); - } // compute size offset for legend entries - - - offset = items.reduce(function (max, value) { - return Math.max(max, size(value, _)); - }, 0); - } else { - size = constant(offset = size || 8); - } - - items = items.map(function (value, index) { - return ingest({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - }); - }); - - if (ellipsis) { - ellipsis = values[items.length]; - items.push(ingest({ - index: items.length, - label: "\u2026".concat(values.length - items.length, " entries"), - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } else if (type === GradientLegend) { - domain = scale.domain(), fraction = scaleFraction(scale, domain[0], peek(domain)); // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - - if (values.length < 3 && !_.values && domain[0] !== peek(domain)) { - values = [domain[0], peek(domain)]; - } - - items = values.map(function (value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - }); - }); - } else { - size = values.length - 1; - fraction = labelFraction(scale); - items = values.map(function (value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index + 1]) - }); - }); - } - - out.source = items; - out.add = items; - this.value = items; - return out; - }; - - var Paths = fastmap({ - 'line': line$2, - 'line-radial': lineR, - 'arc': arc$2, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR - }); - - function sourceX(t) { - return t.source.x; - } - - function sourceY(t) { - return t.source.y; - } - - function targetX(t) { - return t.target.x; - } - - function targetY(t) { - return t.target.y; - } - /** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - - function LinkPath(params) { - Transform.call(this, {}, params); - } - - LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'sourceX', - 'type': 'field', - 'default': 'source.x' - }, { - 'name': 'sourceY', - 'type': 'field', - 'default': 'source.y' - }, { - 'name': 'targetX', - 'type': 'field', - 'default': 'target.x' - }, { - 'name': 'targetY', - 'type': 'field', - 'default': 'target.y' - }, { - 'name': 'orient', - 'type': 'enum', - 'default': 'vertical', - 'values': ['horizontal', 'vertical', 'radial'] - }, { - 'name': 'shape', - 'type': 'enum', - 'default': 'line', - 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal'] - }, { - 'name': 'require', - 'type': 'signal' - }, { - 'name': 'as', - 'type': 'string', - 'default': 'path' - }] - }; - var prototype$_ = inherits(LinkPath, Transform); - - prototype$_.transform = function (_, pulse) { - var sx = _.sourceX || sourceX, - sy = _.sourceY || sourceY, - tx = _.targetX || targetX, - ty = _.targetY || targetY, - as = _.as || 'path', - orient = _.orient || 'vertical', - shape = _.shape || 'line', - path = Paths.get(shape + '-' + orient) || Paths.get(shape); - - if (!path) { - error('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : '')); - } - - pulse.visit(pulse.SOURCE, function (t) { - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - return pulse.reflow(_.modified()).modifies(as); - }; // -- Link Path Generation Methods ----- - - - function line$2(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + 'L' + tx + ',' + ty; - } - - function lineR(sa, sr, ta, tr) { - return line$2(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); - } - - function arc$2(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - rr = Math.sqrt(dx * dx + dy * dy) / 2, - ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty; - } - - function arcR(sa, sr, ta, tr) { - return arc$2(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); - } - - function curve(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - ix = 0.2 * (dx + dy), - iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty; - } - - function curveR(sa, sr, ta, tr) { - return curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); - } - - function orthoX(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + 'V' + ty + 'H' + tx; - } - - function orthoY(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + 'H' + tx + 'V' + ty; - } - - function orthoR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts; - } - - function diagonalX(sx, sy, tx, ty) { - var m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty; - } - - function diagonalY(sx, sy, tx, ty) { - var m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty; - } - - function diagonalR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - mr = (sr + tr) / 2; - return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts; - } - /** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ - - - function Pie(params) { - Transform.call(this, null, params); - } - - Pie.Definition = { - 'type': 'Pie', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'startAngle', - 'type': 'number', - 'default': 0 - }, { - 'name': 'endAngle', - 'type': 'number', - 'default': 6.283185307179586 - }, { - 'name': 'sort', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['startAngle', 'endAngle'] - }] - }; - var prototype$$ = inherits(Pie, Transform); - - prototype$$.transform = function (_, pulse) { - var as = _.as || ['startAngle', 'endAngle'], - startAngle = as[0], - endAngle = as[1], - field = _.field || one, - start = _.startAngle || 0, - stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, - data = pulse.source, - values = data.map(field), - n = values.length, - a = start, - k = (stop - start) / sum(values), - index = sequence(n), - i, - t, - v; - - if (_.sort) { - index.sort(function (a, b) { - return values[a] - values[b]; - }); - } - - for (i = 0; i < n; ++i) { - v = values[index[i]]; - t = data[index[i]]; - t[startAngle] = a; - t[endAngle] = a += v * k; - } - - this.value = values; - return pulse.reflow(_.modified()).modifies(as); - }; - - var DEFAULT_COUNT = 5; - - function includeZero(scale) { - var type = scale.type; - return !scale.bins && (type === Linear$1 || type === Pow || type === Sqrt); - } - - function includePad(type) { - return isContinuous(type) && type !== Sequential; - } - - var SKIP$2 = toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']); - /** - * Maintains a scale function mapping data values to visual channels. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - function Scale(params) { - Transform.call(this, null, params); - this.modified(true); // always treat as modified - } - - var prototype$10 = inherits(Scale, Transform); - - prototype$10.transform = function (_, pulse) { - var df = pulse.dataflow, - scale = this.value, - key = scaleKey(_); - - if (!scale || key !== scale.type) { - this.value = scale = scale$2(key)(); - } - - for (key in _) { - if (!SKIP$2[key]) { - // padding is a scale property for band/point but not others - if (key === 'padding' && includePad(scale.type)) continue; // invoke scale property setter, raise warning if not found - - isFunction(scale[key]) ? scale[key](_[key]) : df.warn('Unsupported scale property: ' + key); - } - } - - configureRange(scale, _, configureBins(scale, _, configureDomain(scale, _, df))); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - }; - - function scaleKey(_) { - var t = _.type, - d = '', - n; // backwards compatibility pre Vega 5. - - if (t === Sequential) return Sequential + '-' + Linear$1; - - if (isContinuousColor(_)) { - n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; - d = n === 2 ? Sequential + '-' : n === 3 ? Diverging + '-' : ''; - } - - return (d + t || Linear$1).toLowerCase(); - } - - function isContinuousColor(_) { - var t = _.type; - return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString)); - } - - function configureDomain(scale, _, df) { - // check raw domain, if provided use that and exit early - var raw = rawDomain(scale, _.domainRaw, df); - if (raw > -1) return raw; - var domain = _.domain, - type = scale.type, - zero = _.zero || _.zero === undefined && includeZero(scale), - n, - mid; - if (!domain) return 0; // adjust continuous domain for minimum pixel padding - - if (includePad(type) && _.padding && domain[0] !== peek(domain)) { - domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - } // adjust domain based on zero, min, max settings - - - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = (domain = domain.slice()).length - 1 || 1; - - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - - if (_.domainMid != null) { - mid = _.domainMid; - var i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } // set the scale domain - - - scale.domain(domainCheck(type, domain, df)); // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - - if (type === Ordinal) { - scale.unknown(_.domainImplicit ? implicit : undefined); - } // perform 'nice' adjustment as requested - - - if (_.nice && scale.nice) { - scale.nice(_.nice !== true && tickCount(scale, _.nice) || null); - } // return the cardinality of the domain - - - return domain.length; - } - - function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else { - return -1; - } - } - - function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs(peek(range) - range[0]), - frac = span / (span - 2 * pad), - d = type === Log ? zoomLog(domain, null, frac) : type === Sqrt ? zoomPow(domain, null, frac, 0.5) : type === Pow ? zoomPow(domain, null, frac, exponent || 1) : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) : zoomLinear(domain, null, frac); - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length - 1] = d[1]; - return domain; - } - - function domainCheck(type, domain, df) { - if (isLogarithmic(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce(function (s, v) { - return s + (v < 0 ? -1 : v > 0 ? 1 : 0); - }, 0)); - - if (s !== domain.length) { - df.warn('Log scale domain includes zero: ' + $(domain)); - } - } - - return domain; - } - - function configureBins(scale, _, count) { - var bins = _.bins; - - if (bins && !isArray(bins)) { - // generate bin boundary array - var _domain2 = scale.domain(), - lo = _domain2[0], - hi = peek(_domain2), - start = bins.start == null ? lo : bins.start, - _stop = bins.stop == null ? hi : bins.stop, - step = bins.step; - - if (!step) error('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (_stop > hi) _stop = step * Math.floor(hi / step); - bins = sequence(start, _stop + step / 2, step); - } - - if (bins) { - // assign bin boundaries to scale instance - scale.bins = bins; - } else if (scale.bins) { - // no current bins, remove bins if previously set - delete scale.bins; - } // special handling for bin-ordinal scales - - - if (scale.type === BinOrdinal) { - if (!bins) { - // the domain specifies the bins - scale.bins = scale.domain(); - } else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } // return domain cardinality - - - return count; - } - - function configureRange(scale, _, count) { - var type = scale.type, - round = _.round || false, - range = _.range; // if range step specified, calculate full range extent - - if (_.rangeStep != null) { - range = configureRangeStep(type, _, count); - } // else if a range scheme is defined, use that - else if (_.scheme) { - range = configureScheme(type, _, count); - - if (isFunction(range)) { - if (scale.interpolator) { - return scale.interpolator(range); - } else { - error("Scale type ".concat(type, " does not support interpolating color schemes.")); - } - } - } // given a range array for an interpolating scale, convert to interpolator - - - if (range && isInterpolating(type)) { - return scale.interpolator(interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma)); - } // configure rounding / interpolation - - - if (range && _.interpolate && scale.interpolate) { - scale.interpolate(interpolate$1(_.interpolate, _.interpolateGamma)); - } else if (isFunction(scale.round)) { - scale.round(round); - } else if (isFunction(scale.rangeRound)) { - scale.interpolate(round ? interpolateRound : interpolate); - } - - if (range) scale.range(flip(range, _.reverse)); - } - - function configureRangeStep(type, _, count) { - if (type !== Band && type !== Point) { - error('Only band and point scales support rangeStep.'); - } // calculate full range based on requested step size and padding - - - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, - inner = type === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; - return [0, _.rangeStep * bandSpace(count, inner, outer)]; - } - - function configureScheme(type, _, count) { - var extent = _.schemeExtent, - name, - scheme$1; - - if (isArray(_.scheme)) { - scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); - } else { - name = _.scheme.toLowerCase(); - scheme$1 = scheme(name); - if (!scheme$1) error("Unrecognized scheme name: ".concat(_.scheme)); - } // determine size for potential discrete range - - - count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === Quantile$1 || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate - - return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) : type === Ordinal ? scheme$1 : scheme$1.slice(0, count); - } - - function adjustScheme(scheme, extent, reverse) { - return isFunction(scheme) && (extent || reverse) ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) : scheme; - } - - function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; - } - /** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ - - - function SortItems(params) { - Transform.call(this, null, params); - } - - var prototype$11 = inherits(SortItems, Transform); - - prototype$11.transform = function (_, pulse) { - var mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum'); - if (mod) pulse.source.sort(stableCompare(_.sort)); - this.modified(mod); - return pulse; - }; - - var Zero = 'zero', - Center = 'center', - Normalize = 'normalize', - DefOutput = ['y0', 'y1']; - /** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ - - function Stack(params) { - Transform.call(this, null, params); - } - - Stack.Definition = { - 'type': 'Stack', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'offset', - 'type': 'enum', - 'default': Zero, - 'values': [Zero, Center, Normalize] - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': DefOutput - }] - }; - var prototype$12 = inherits(Stack, Transform); - - prototype$12.transform = function (_, pulse) { - var as = _.as || DefOutput, - y0 = as[0], - y1 = as[1], - sort = stableCompare(_.sort), - field = _.field || one, - stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, - groups, - i, - n, - max; // partition, sum, and sort the stack groups - - groups = partition$2(pulse.source, _.groupby, sort, field); // compute stack layouts per group - - for (i = 0, n = groups.length, max = groups.max; i < n; ++i) { - stack(groups[i], max, field, y0, y1); - } - - return pulse.reflow(_.modified()).modifies(as); - }; - - function stackCenter(group, max, field, y0, y1) { - var last = (max - group.sum) / 2, - m = group.length, - j = 0, - t; - - for (; j < m; ++j) { - t = group[j]; - t[y0] = last; - t[y1] = last += Math.abs(field(t)); - } - } - - function stackNormalize(group, max, field, y0, y1) { - var scale = 1 / group.sum, - last = 0, - m = group.length, - j = 0, - v = 0, - t; - - for (; j < m; ++j) { - t = group[j]; - t[y0] = last; - t[y1] = last = scale * (v += Math.abs(field(t))); - } - } - - function stackZero(group, max, field, y0, y1) { - var lastPos = 0, - lastNeg = 0, - m = group.length, - j = 0, - v, - t; - - for (; j < m; ++j) { - t = group[j]; - v = +field(t); - - if (v < 0) { - t[y0] = lastNeg; - t[y1] = lastNeg += v; - } else { - t[y0] = lastPos; - t[y1] = lastPos += v; - } - } - } - - function partition$2(data, groupby, sort, field) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - m, - t, - k, - g, - s, - max; // partition data points into stack groups - - - if (groupby == null) { - groups.push(data.slice()); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - groups.push(g); - } - - g.push(t); - } - } // compute sums of groups, sort groups as needed - - - for (k = 0, max = 0, m = groups.length; k < m; ++k) { - g = groups[k]; - - for (i = 0, s = 0, n = g.length; i < n; ++i) { - s += Math.abs(field(g[i])); - } - - g.sum = s; - if (s > max) max = s; - if (sort) g.sort(sort); - } - - groups.max = max; - return groups; - } - - var encode = /*#__PURE__*/Object.freeze({ - __proto__: null, - axisticks: AxisTicks, - datajoin: DataJoin, - encode: Encode, - legendentries: LegendEntries, - linkpath: LinkPath, - pie: Pie, - scale: Scale, - sortitems: SortItems, - stack: Stack - }); - - function noop$3() {} - - var cases = [[], [[[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]]], []]; // Implementation adapted from d3/d3-contour. Thanks! - - function contours() { - var dx = 1, - dy = 1, - smooth = smoothLinear; - - function contours(values, tz) { - 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.js - - - function contour(values, value) { - var polygons = [], - holes = []; - isorings(values, value, function (ring) { - smooth(ring, values, value); - if (area$2(ring) > 0) polygons.push([ring]);else holes.push(ring); - }); - holes.forEach(function (hole) { - for (var i = 0, n = polygons.length, polygon; i < n; ++i) { - if (contains((polygon = polygons[i])[0], hole) !== -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/stitch.js - - - function isorings(values, value, callback) { - var fragmentByStart = new Array(), - fragmentByEnd = new Array(), - x, - y, - t0, - t1, - t2, - t3; // Special case for the first row (y = -1, t2 = t3 = 0). - - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - - while (++x < dx - 1) { - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - - cases[t1 << 0].forEach(stitch); // General case for the intermediate rows. - - while (++y < dy - 1) { - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - - while (++x < dx - 1) { - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - - cases[t1 | t2 << 3].forEach(stitch); - } // Special case for the last row (y = dy - 1, t0 = t1 = 0). - - - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - - while (++x < dx - 1) { - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - - cases[t2 << 3].forEach(stitch); - - function stitch(line) { - var start = [line[0][0] + x, line[0][1] + y], - end = [line[1][0] + x, line[1][1] + y], - startIndex = index(start), - endIndex = index(end), - f, - g; - - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[f.start] = fragmentByEnd[g.end] = { - start: f.start, - end: g.end, - ring: f.ring.concat(g.ring) - }; - } - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[g.start] = fragmentByEnd[f.end] = { - start: g.start, - end: f.end, - ring: g.ring.concat(f.ring) - }; - } - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else { - fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { - 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 = point[0], - y = point[1], - xt = x | 0, - yt = y | 0, - v0, - v1 = values[yt * dx + xt]; - - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); - } - - contours.contour = contour; - - contours.size = function (_) { - if (!arguments.length) return [dx, dy]; - - var _0 = Math.floor(_[0]), - _1 = Math.floor(_[1]); - - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, contours; - }; - - contours.smooth = function (_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop$3, contours) : smooth === smoothLinear; - }; - - return contours; - } - - function area$2(ring) { - var i = 0, - n = ring.length, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - - while (++i < n) { - area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - } - - return area; - } - - function contains(ring, hole) { - var i = -1, - n = hole.length, - c; - - while (++i < n) { - if (c = ringContains(ring, hole[i])) return c; - } - - return 0; - } - - function ringContains(ring, point) { - var x = point[0], - y = point[1], - contains = -1; - - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], - xi = pi[0], - yi = pi[1], - pj = ring[j], - xj = pj[0], - yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains; - } - - return contains; - } - - function segmentContains(a, b, c) { - var i; - return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); - } - - function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); - } - - function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; - } - - function quantize$2(k, nice, zero) { - return function (values) { - var ex = extent(values), - start = zero ? Math.min(ex[0], 0) : ex[0], - stop = ex[1], - span = stop - start, - step = nice ? tickStep(start, stop, k) : span / (k + 1); - return sequence(step, stop, step); - }; - } - /** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ - - - function Isocontour(params) { - Transform.call(this, null, params); - } - - Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, { - 'name': 'levels', - 'type': 'number' - }, { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, { - 'name': 'resolve', - 'type': 'enum', - 'values': ['shared', 'independent'], - 'default': 'independent' - }, { - 'name': 'zero', - 'type': 'boolean', - 'default': true - }, { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }, { - 'name': 'scale', - 'type': 'number', - 'expr': true - }, { - 'name': 'translate', - 'type': 'number', - 'array': true, - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'null': true, - 'default': 'contour' - }] - }; - var prototype$13 = inherits(Isocontour, Transform); - - prototype$13.transform = function (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - field = _.field || identity, - contour = contours().smooth(_.smooth !== false), - tz = _.thresholds || levels(source, field, _), - as = _.as === null ? null : _.as || 'contour', - values = []; - source.forEach(function (t) { - var grid = field(t); // generate contour paths in GeoJSON format - - var paths = contour.size([grid.width, grid.height])(grid.values, isArray(tz) ? tz : tz(grid.values)); // adjust contour path coordinates as needed - - transformPaths(paths, grid, t, _); // ingest; copy source data properties to output - - paths.forEach(function (p) { - values.push(rederive(t, ingest(as != null ? _defineProperty({}, as, p) : p))); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; - }; - - function levels(values, f, _) { - var q = quantize$2(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' ? q : q(values.map(function (t) { - return max(f(t).values); - })); - } - - function transformPaths(paths, grid, datum, _) { - var s = _.scale || grid.scale, - t = _.translate || grid.translate; - if (isFunction(s)) s = s(datum, _); - if (isFunction(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - var sx = (isNumber(s) ? s : s[0]) || 1, - sy = (isNumber(s) ? s : s[1]) || 1, - tx = t && t[0] || 0, - ty = t && t[1] || 0; - paths.forEach(transform$2(grid, sx, sy, tx, ty)); - } - - function transform$2(grid, sx, sy, tx, ty) { - var x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - flip = sx * sy < 0; - - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); - } - - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - - coordinates.forEach(transformPoint); - } - - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; - } - - return function (geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; - }; - } - - function radius(bw, data, f) { - var v = bw >= 0 ? bw : bandwidthNRD(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); - } - - function number$4(_) { - return isFunction(_) ? _ : constant(+_); - } // Implementation adapted from d3/d3-contour. Thanks! - - - function density2D() { - var x = function x(d) { - return d[0]; - }, - y = function y(d) { - return d[1]; - }, - weight = one, - bandwidth = [-1, -1], - dx = 960, - dy = 500, - k = 2; // log2(cellSize) - - - function density(data, counts) { - var rx = radius(bandwidth[0], data, x) >> k, - // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, - // blur y-radius - ox = rx ? rx + 2 : 0, - // x-offset padding for blur - oy = ry ? ry + 2 : 0, - // y-offset padding for blur - n = 2 * ox + (dx >> k), - // grid width - m = 2 * oy + (dy >> k), - // grid height - values0 = new Float32Array(n * m), - values1 = new Float32Array(n * m); - var values = values0; - data.forEach(function (d) { - var xi = ox + (+x(d) >> k), - yi = oy + (+y(d) >> k); - - if (xi >= 0 && xi < n && yi >= 0 && yi < m) { - values0[xi + yi * n] += +weight(d); - } - }); - - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } // scale density estimates - // density in points per square pixel or probability density - - - var s = counts ? Math.pow(2, -2 * k) : 1 / sum(values); - - for (var i = 0, _sz = n * m; i < _sz; ++i) { - values[i] *= s; - } - - return { - values: values, - scale: 1 << k, - width: n, - height: m, - x1: ox, - y1: oy, - x2: ox + (dx >> k), - y2: oy + (dy >> k) - }; - } - - density.x = function (_) { - return arguments.length ? (x = number$4(_), density) : x; - }; - - density.y = function (_) { - return arguments.length ? (y = number$4(_), density) : y; - }; - - density.weight = function (_) { - return arguments.length ? (weight = number$4(_), density) : weight; - }; - - density.size = function (_) { - if (!arguments.length) return [dx, dy]; - - var _0 = +_[0], - _1 = +_[1]; - - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, density; - }; - - density.cellSize = function (_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) error('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - - density.bandwidth = function (_) { - if (!arguments.length) return bandwidth; - _ = array(_); - if (_.length === 1) _ = [+_[0], +_[0]]; - if (_.length !== 2) error('invalid bandwidth'); - return bandwidth = _, density; - }; - - return density; - } - - function blurX(n, m, source, target, r) { - var w = (r << 1) + 1; - - for (var j = 0; j < m; ++j) { - for (var i = 0, sr = 0; i < n + r; ++i) { - if (i < n) { - sr += source[i + j * n]; - } - - if (i >= r) { - if (i >= w) { - sr -= source[i - w + j * n]; - } - - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } - } - } - - function blurY(n, m, source, target, r) { - var w = (r << 1) + 1; - - for (var i = 0; i < n; ++i) { - for (var j = 0, sr = 0; j < m + r; ++j) { - if (j < m) { - sr += source[i + j * n]; - } - - if (j >= r) { - if (j >= w) { - sr -= source[i + (j - w) * n]; - } - - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } - } - } - /** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ - - - function KDE2D(params) { - Transform.call(this, null, params); - } - - KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, { - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'weight', - 'type': 'field' - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'cellSize', - 'type': 'number' - }, { - 'name': 'bandwidth', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'default': 'grid' - }] - }; - var prototype$14 = inherits(KDE2D, Transform); - var PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth']; - - function params(obj, _) { - PARAMS.forEach(function (param) { - return _[param] != null ? obj[param](_[param]) : 0; - }); - return obj; - } - - prototype$14.transform = function (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - groups = partition$3(source, _.groupby), - names = (_.groupby || []).map(accessorName), - kde = params(density2D(), _), - as = _.as || 'grid', - values = []; - - function set(t, vals) { - for (var i = 0; i < names.length; ++i) { - t[names[i]] = vals[i]; - } - - return t; - } // generate density raster grids - - - values = groups.map(function (g) { - return ingest(set(_defineProperty({}, as, kde(g, _.counts)), g.dims)); - }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; - }; - - function partition$3(data, groupby) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - t, - k, - g; // partition data points into groups - - - if (groupby == null) { - groups.push(data); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - - g.push(t); - } - } - - return groups; - } - /** - * Generate contours based on kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ - - - function Contour(params) { - Transform.call(this, null, params); - } - - Contour.Definition = { - 'type': 'Contour', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, { - 'name': 'values', - 'type': 'number', - 'array': true - }, { - 'name': 'x', - 'type': 'field' - }, { - 'name': 'y', - 'type': 'field' - }, { - 'name': 'weight', - 'type': 'field' - }, { - 'name': 'cellSize', - 'type': 'number' - }, { - 'name': 'bandwidth', - 'type': 'number' - }, { - 'name': 'count', - 'type': 'number' - }, { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }] - }; - var prototype$15 = inherits(Contour, Transform); - - prototype$15.transform = function (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - contour = contours().smooth(_.smooth !== false), - values = _.values, - thresh = _.thresholds || quantize$2(_.count || 10, _.nice, !!values), - size = _.size, - grid, - post; - - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform$2(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [grid.width, grid.height]; - values = grid.values; - } - - thresh = isArray(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map(ingest); - return out; - }; - - var Feature = 'Feature'; - var FeatureCollection = 'FeatureCollection'; - var MultiPoint = 'MultiPoint'; - /** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ - - function GeoJSON(params) { - Transform.call(this, null, params); - } - - GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'length': 2 - }, { - 'name': 'geojson', - 'type': 'field' - }] - }; - var prototype$16 = inherits(GeoJSON, Transform); - - prototype$16.transform = function (_, pulse) { - var features = this._features, - points = this._points, - fields = _.fields, - lon = fields && fields[0], - lat = fields && fields[1], - geojson = _.geojson || !fields && identity, - flag = pulse.ADD, - mod; - mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified(accessorFields(geojson)) || lon && pulse.modified(accessorFields(lon)) || lat && pulse.modified(accessorFields(lat)); - - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = features = []; - this._points = points = []; - } - - if (geojson) { - pulse.visit(flag, function (t) { - features.push(geojson(t)); - }); - } - - if (lon && lat) { - pulse.visit(flag, function (t) { - var x = lon(t), - y = lat(t); - - if (x != null && y != null && (x = +x) === x && (y = +y) === y) { - points.push([x, y]); - } - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - - this.value = { - type: FeatureCollection, - features: features - }; - }; // 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–363 (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 = { - constructor: Adder, - reset: function reset() { - this.s = // rounded value - this.t = 0; // exact error - }, - add: function add(y) { - add$3(temp$1, y, this.t); - add$3(this, temp$1.s, this.s); - if (this.s) this.t += temp$1.t;else this.s = temp$1.t; - }, - valueOf: function valueOf() { - return this.s; - } - }; - var temp$1 = new Adder(); - - function add$3(adder, a, b) { - var x = adder.s = a + b, - bv = x - a, - av = x - bv; - adder.t = a - av + (b - bv); - } - - var epsilon$3 = 1e-6; - var epsilon2$1 = 1e-12; - var pi$2 = Math.PI; - var halfPi$1 = pi$2 / 2; - var quarterPi = pi$2 / 4; - var tau$2 = pi$2 * 2; - var degrees$1 = 180 / pi$2; - var radians = pi$2 / 180; - var abs$1 = Math.abs; - var atan = Math.atan; - var atan2$1 = Math.atan2; - var cos$1 = Math.cos; - var ceil = Math.ceil; - var exp$1 = Math.exp; - var log$3 = Math.log; - var pow$2 = Math.pow; - var sin$1 = Math.sin; - - var sign$1 = Math.sign || function (x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; - }; - - var sqrt$2 = Math.sqrt; - var tan = Math.tan; - - function acos$1(x) { - return x > 1 ? 0 : x < -1 ? pi$2 : Math.acos(x); - } - - function asin$1(x) { - return x > 1 ? halfPi$1 : x < -1 ? -halfPi$1 : Math.asin(x); - } - - function noop$4() {} - - function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { - streamGeometryType[geometry.type](geometry, stream); - } - } - - var streamObjectType = { - Feature: function Feature(object, stream) { - streamGeometry(object.geometry, stream); - }, - FeatureCollection: function FeatureCollection(object, stream) { - var features = object.features, - i = -1, - n = features.length; - - while (++i < n) { - streamGeometry(features[i].geometry, stream); - } - } - }; - var streamGeometryType = { - Sphere: function Sphere(object, stream) { - stream.sphere(); - }, - Point: function Point(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); - }, - MultiPoint: function MultiPoint(object, stream) { - var coordinates = object.coordinates, - i = -1, - n = coordinates.length; - - while (++i < n) { - object = coordinates[i], stream.point(object[0], object[1], object[2]); - } - }, - LineString: function LineString(object, stream) { - streamLine(object.coordinates, stream, 0); - }, - MultiLineString: function MultiLineString(object, stream) { - var coordinates = object.coordinates, - i = -1, - n = coordinates.length; - - while (++i < n) { - streamLine(coordinates[i], stream, 0); - } - }, - Polygon: function Polygon(object, stream) { - streamPolygon(object.coordinates, stream); - }, - MultiPolygon: function MultiPolygon(object, stream) { - var coordinates = object.coordinates, - i = -1, - n = coordinates.length; - - while (++i < n) { - streamPolygon(coordinates[i], stream); - } - }, - GeometryCollection: function GeometryCollection(object, stream) { - var geometries = object.geometries, - i = -1, - n = geometries.length; - - while (++i < n) { - streamGeometry(geometries[i], stream); - } - } - }; - - function streamLine(coordinates, stream, closed) { - var i = -1, - n = coordinates.length - closed, - coordinate; - stream.lineStart(); - - while (++i < n) { - coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - } - - stream.lineEnd(); - } - - function streamPolygon(coordinates, stream) { - var i = -1, - n = 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 = adder(); - var areaSum = adder(), - lambda00, - phi00, - lambda0, - cosPhi0, - sinPhi0; - var areaStream = { - point: noop$4, - lineStart: noop$4, - lineEnd: noop$4, - polygonStart: function polygonStart() { - areaRingSum.reset(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function polygonEnd() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? tau$2 + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = noop$4; - }, - sphere: function sphere() { - areaSum.add(tau$2); - } - }; - - function areaRingStart() { - areaStream.point = areaPointFirst; - } - - function areaRingEnd() { - areaPoint(lambda00, phi00); - } - - function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= radians, phi *= radians; - lambda0 = lambda, cosPhi0 = cos$1(phi = phi / 2 + quarterPi), sinPhi0 = sin$1(phi); - } - - function areaPoint(lambda, phi) { - lambda *= radians, phi *= radians; - phi = 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’s - // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). - - var dLambda = lambda - lambda0, - sdLambda = dLambda >= 0 ? 1 : -1, - adLambda = sdLambda * dLambda, - cosPhi = cos$1(phi), - sinPhi = sin$1(phi), - k = sinPhi0 * sinPhi, - u = cosPhi0 * cosPhi + k * cos$1(adLambda), - v = k * sdLambda * sin$1(adLambda); - areaRingSum.add(atan2$1(v, u)); // Advance the previous points. - - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; - } - - function area$3(object) { - areaSum.reset(); - geoStream(object, areaStream); - return areaSum * 2; - } - - function spherical(cartesian) { - return [atan2$1(cartesian[1], cartesian[0]), asin$1(cartesian[2])]; - } - - function cartesian(spherical) { - var lambda = spherical[0], - phi = spherical[1], - cosPhi = 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] += b[0], a[1] += b[1], a[2] += b[2]; - } - - function cartesianScale(vector, k) { - return [vector[0] * k, vector[1] * k, vector[2] * k]; - } // TODO return d - - - function cartesianNormalizeInPlace(d) { - var l = sqrt$2(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; - } - - var lambda0$1, - phi0, - lambda1, - phi1, - // bounds - lambda2, - // previous lambda-coordinate - lambda00$1, - phi00$1, - // first point - p0, - // previous 3D point - deltaSum = adder(), - ranges, - range; - var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function polygonStart() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum.reset(); - areaStream.polygonStart(); - }, - polygonEnd: function polygonEnd() { - areaStream.polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);else if (deltaSum > epsilon$3) phi1 = 90;else if (deltaSum < -epsilon$3) phi0 = -90; - range[0] = lambda0$1, range[1] = lambda1; - }, - sphere: function sphere() { - lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); - } - }; - - function boundsPoint(lambda, phi) { - ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - - function linePoint(lambda, phi) { - var p = cartesian([lambda * radians, phi * radians]); - - if (p0) { - var normal = cartesianCross(p0, p), - equatorial = [normal[1], -normal[0], 0], - inflection = cartesianCross(equatorial, normal); - cartesianNormalizeInPlace(inflection); - inflection = spherical(inflection); - var delta = lambda - lambda2, - sign = delta > 0 ? 1 : -1, - lambdai = inflection[0] * degrees$1 * sign, - phii, - antimeridian = abs$1(delta) > 180; - - if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = inflection[1] * degrees$1; - if (phii > phi1) phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = -inflection[1] * degrees$1; - if (phii < phi0) phi0 = phii; - } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - - if (antimeridian) { - if (lambda < lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; - } - } else { - if (lambda1 >= lambda0$1) { - if (lambda < lambda0$1) lambda0$1 = lambda; - if (lambda > lambda1) lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; - } - } - } - } else { - ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); - } - - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - p0 = p, lambda2 = lambda; - } - - function boundsLineStart() { - boundsStream.point = linePoint; - } - - function boundsLineEnd() { - range[0] = lambda0$1, range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; - } - - function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add(abs$1(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else { - lambda00$1 = lambda, phi00$1 = phi; - } - - areaStream.point(lambda, phi); - linePoint(lambda, phi); - } - - function boundsRingStart() { - areaStream.lineStart(); - } - - function boundsRingEnd() { - boundsRingPoint(lambda00$1, phi00$1); - areaStream.lineEnd(); - if (abs$1(deltaSum) > epsilon$3) lambda0$1 = -(lambda1 = 180); - range[0] = lambda0$1, range[1] = lambda1; - p0 = null; - } // Finds the left-right distance between two longitudes. - // This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want - // the distance between ±180° to be 360°. - - - function angle(lambda0, lambda1) { - return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; - } - - function rangeCompare(a, b) { - return a[0] - b[0]; - } - - function rangeContains(range, x) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; - } - - function bounds$1(feature) { - var i, n, a, b, merged, deltaMax, delta; - phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity); - ranges = []; - geoStream(feature, boundsStream); // First, sort ranges by their minimum longitudes. - - if (n = ranges.length) { - ranges.sort(rangeCompare); // Then, merge any ranges that overlap. - - for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) { - b = ranges[i]; - - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - 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. - - - for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) { - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1]; - } - } - - ranges = range = null; - return lambda0$1 === Infinity || phi0 === 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 = { - sphere: noop$4, - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function polygonStart() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function polygonEnd() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } - }; // Arithmetic mean of Cartesian vectors. - - function centroidPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos$1(phi); - centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi)); - } - - function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; - } - - function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; - } - - function centroidLinePointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos$1(phi); - x0 = cosPhi * cos$1(lambda); - y0 = cosPhi * sin$1(lambda); - z0 = sin$1(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); - } - - function centroidLinePoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos$1(phi), - x = cosPhi * cos$1(lambda), - y = cosPhi * sin$1(lambda), - z = sin$1(phi), - w = atan2$1(sqrt$2((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); - } - - function centroidLineEnd() { - centroidStream.point = centroidPoint; - } // See J. E. Brock, The Inertia Tensor for a Spherical Triangle, - // J. Applied Mechanics 42, 239 (1975). - - - function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; - } - - function centroidRingEnd() { - centroidRingPoint(lambda00$2, phi00$2); - centroidStream.point = centroidPoint; - } - - function centroidRingPointFirst(lambda, phi) { - lambda00$2 = lambda, phi00$2 = phi; - lambda *= radians, phi *= radians; - centroidStream.point = centroidRingPoint; - var cosPhi = cos$1(phi); - x0 = cosPhi * cos$1(lambda); - y0 = cosPhi * sin$1(lambda); - z0 = sin$1(phi); - centroidPointCartesian(x0, y0, z0); - } - - function centroidRingPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos$1(phi), - x = cosPhi * cos$1(lambda), - y = cosPhi * sin$1(lambda), - z = sin$1(phi), - cx = y0 * z - z0 * y, - cy = z0 * x - x0 * z, - cz = x0 * y - y0 * x, - m = sqrt$2(cx * cx + cy * cy + cz * cz), - w = asin$1(m), - // line weight = angle - v = m && -w / m; // area weight multiplier - - X2 += v * cx; - Y2 += v * cy; - Z2 += v * cz; - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); - } - - function centroid(object) { - W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; - geoStream(object, centroidStream); - var x = X2, - y = Y2, - z = Z2, - m = x * x + y * y + z * z; // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. - - if (m < epsilon2$1) { - x = X1, y = Y1, z = Z1; // If the feature has zero length, fall back to arithmetic mean of point vectors. - - if (W1 < epsilon$3) x = X0, y = Y0, z = Z0; - m = 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$1(y, x) * degrees$1, asin$1(z / sqrt$2(m)) * degrees$1]; - } - - function compose(a, b) { - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - - if (a.invert && b.invert) compose.invert = function (x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - return compose; - } - - function rotationIdentity(lambda, phi) { - return [abs$1(lambda) > pi$2 ? lambda + Math.round(-lambda / tau$2) * tau$2 : lambda, phi]; - } - - rotationIdentity.invert = rotationIdentity; - - function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= tau$2) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; - } - - function forwardRotationLambda(deltaLambda) { - return function (lambda, phi) { - return lambda += deltaLambda, [lambda > pi$2 ? lambda - tau$2 : lambda < -pi$2 ? lambda + tau$2 : lambda, phi]; - }; - } - - function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; - } - - function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = cos$1(deltaPhi), - sinDeltaPhi = sin$1(deltaPhi), - cosDeltaGamma = cos$1(deltaGamma), - sinDeltaGamma = sin$1(deltaGamma); - - function rotation(lambda, phi) { - var cosPhi = cos$1(phi), - x = cos$1(lambda) * cosPhi, - y = sin$1(lambda) * cosPhi, - z = sin$1(phi), - k = z * cosDeltaPhi + x * sinDeltaPhi; - return [atan2$1(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), asin$1(k * cosDeltaGamma + y * sinDeltaGamma)]; - } - - rotation.invert = function (lambda, phi) { - var cosPhi = cos$1(phi), - x = cos$1(lambda) * cosPhi, - y = sin$1(lambda) * cosPhi, - z = sin$1(phi), - k = z * cosDeltaGamma - y * sinDeltaGamma; - return [atan2$1(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), asin$1(k * cosDeltaPhi - x * sinDeltaPhi)]; - }; - - return rotation; - } - - function rotation(rotate) { - rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0); - - function forward(coordinates) { - coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates; - } - - forward.invert = function (coordinates) { - coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates; - }; - - return forward; - } // Generates a circle centered at [0°, 0°], with a given radius and precision. - - - function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = cos$1(radius), - sinRadius = sin$1(radius), - step = direction * delta; - - if (t0 == null) { - t0 = radius + direction * tau$2; - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau$2; - } - - for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) { - point = 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 = cartesian(point), point[0] -= cosRadius; - cartesianNormalizeInPlace(point); - var radius = acos$1(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + tau$2 - epsilon$3) % tau$2; - } - - function clipBuffer() { - var lines = [], - line; - return { - point: function point(x, y, m) { - line.push([x, y, m]); - }, - lineStart: function lineStart() { - lines.push(line = []); - }, - lineEnd: noop$4, - rejoin: function rejoin() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function result() { - var result = lines; - lines = []; - line = null; - return result; - } - }; - } - - function pointEqual(a, b) { - return abs$1(a[0] - b[0]) < epsilon$3 && abs$1(a[1] - b[1]) < epsilon$3; - } - - function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - - this.e = entry; // is an entry? - - this.v = false; // visited - - this.n = this.p = 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 = [], - clip = [], - i, - n; - segments.forEach(function (segment) { - if ((n = segment.length - 1) <= 0) return; - var n, - p0 = segment[0], - p1 = segment[n], - x; - - if (pointEqual(p0, p1)) { - if (!p0[2] && !p1[2]) { - stream.lineStart(); - - for (i = 0; i < n; ++i) { - stream.point((p0 = segment[i])[0], p0[1]); - } - - stream.lineEnd(); - return; - } // handle degenerate cases by moving the point - - - p1[0] += 2 * epsilon$3; - } - - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - if (!subject.length) return; - clip.sort(compareIntersection); - link(subject); - link(clip); - - for (i = 0, n = clip.length; i < n; ++i) { - clip[i].e = startInside = !startInside; - } - - var start = subject[0], - points, - point; - - while (1) { - // Find first unvisited intersection. - var current = start, - isSubject = true; - - while (current.v) { - if ((current = current.n) === start) return; - } - - points = current.z; - stream.lineStart(); - - do { - current.v = current.o.v = true; - - if (current.e) { - if (isSubject) { - for (i = 0, n = points.length; i < n; ++i) { - stream.point((point = points[i])[0], point[1]); - } - } else { - interpolate(current.x, current.n.x, 1, stream); - } - - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - - for (i = points.length - 1; i >= 0; --i) { - stream.point((point = points[i])[0], point[1]); - } - } else { - interpolate(current.x, current.p.x, -1, stream); - } - - current = current.p; - } - - current = current.o; - points = current.z; - isSubject = !isSubject; - } while (!current.v); - - stream.lineEnd(); - } - } - - function link(array) { - if (!(n = array.length)) return; - var n, - i = 0, - a = array[0], - b; - - while (++i < n) { - a.n = b = array[i]; - b.p = a; - a = b; - } - - a.n = b = array[0]; - b.p = a; - } - - var sum$1 = adder(); - - function longitude(point) { - if (abs$1(point[0]) <= pi$2) return point[0];else return sign$1(point[0]) * ((abs$1(point[0]) + pi$2) % tau$2 - pi$2); - } - - function polygonContains(polygon, point) { - var lambda = longitude(point), - phi = point[1], - sinPhi = sin$1(phi), - normal = [sin$1(lambda), -cos$1(lambda), 0], - angle = 0, - winding = 0; - sum$1.reset(); - if (sinPhi === 1) phi = halfPi$1 + epsilon$3;else if (sinPhi === -1) phi = -halfPi$1 - epsilon$3; - - for (var i = 0, n = polygon.length; i < n; ++i) { - if (!(m = (ring = polygon[i]).length)) continue; - var ring, - m, - point0 = ring[m - 1], - lambda0 = longitude(point0), - phi0 = point0[1] / 2 + quarterPi, - sinPhi0 = sin$1(phi0), - cosPhi0 = cos$1(phi0); - - for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) { - var point1 = ring[j], - lambda1 = longitude(point1), - phi1 = point1[1] / 2 + quarterPi, - sinPhi1 = sin$1(phi1), - cosPhi1 = cos$1(phi1), - delta = lambda1 - lambda0, - sign = delta >= 0 ? 1 : -1, - absDelta = sign * delta, - antimeridian = absDelta > pi$2, - k = sinPhi0 * sinPhi1; - sum$1.add(atan2$1(k * sign * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta))); - angle += antimeridian ? delta + sign * tau$2 : delta; // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = cartesianCross(cartesian(point0), cartesian(point1)); - cartesianNormalizeInPlace(arc); - var intersection = cartesianCross(normal, arc); - cartesianNormalizeInPlace(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin$1(intersection[2]); - - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) { - winding += antimeridian ^ delta >= 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 negative - // (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$3 || angle < epsilon$3 && sum$1 < -epsilon$3) ^ winding & 1; - } - - function ascending$2(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; - } - - function bisector$1(compare) { - if (compare.length === 1) compare = ascendingComparator$1(compare); - return { - left: function left(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 right(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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; - } - }; - } - - function ascendingComparator$1(f) { - return function (d, x) { - return ascending$2(f(d), x); - }; - } - - var ascendingBisect$1 = bisector$1(ascending$2); - - function range$1(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; - } - - function merge$1(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; - } - - function clip$2(pointVisible, clipLine, interpolate, start) { - return function (sink) { - var line = clipLine(sink), - ringBuffer = clipBuffer(), - ringSink = clipLine(ringBuffer), - polygonStarted = false, - polygon, - segments, - ring; - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function polygonStart() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function polygonEnd() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = merge$1(segments); - var startInside = polygonContains(polygon, start); - - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - clipRejoin(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = null; - }, - sphere: function sphere() { - 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 = pointLine; - line.lineStart(); - } - - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - - function pointRing(lambda, phi) { - ring.push([lambda, phi]); - ringSink.point(lambda, phi); - } - - function ringStart() { - ringSink.lineStart(); - ring = []; - } - - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - var clean = ringSink.clean(), - ringSegments = ringBuffer.result(), - i, - n = ringSegments.length, - m, - segment, - point; - ring.pop(); - polygon.push(ring); - ring = null; - if (!n) return; // No intersections. - - if (clean & 1) { - segment = ringSegments[0]; - - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - - for (i = 0; i < m; ++i) { - sink.point((point = segment[i])[0], point[1]); - } - - sink.lineEnd(); - } - - return; - } // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - - - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.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 cutting - // and circle clipping, the same comparison is used. - - - function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - halfPi$1 - epsilon$3 : halfPi$1 - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi$1 - epsilon$3 : halfPi$1 - b[1]); - } - - var clipAntimeridian = clip$2(function () { - return true; - }, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi$2, -halfPi$1]); // Takes a line and cuts into visible segments. Return values: 0 - there were - // 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 = NaN, - phi0 = NaN, - sign0 = NaN, - _clean2; // no intersections - - - return { - lineStart: function lineStart() { - stream.lineStart(); - _clean2 = 1; - }, - point: function point(lambda1, phi1) { - var sign1 = lambda1 > 0 ? pi$2 : -pi$2, - delta = abs$1(lambda1 - lambda0); - - if (abs$1(delta - pi$2) < epsilon$3) { - // line crosses a pole - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$1 : -halfPi$1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - _clean2 = 0; - } else if (sign0 !== sign1 && delta >= pi$2) { - // line crosses antimeridian - if (abs$1(lambda0 - sign0) < epsilon$3) lambda0 -= sign0 * epsilon$3; // handle degeneracies - - if (abs$1(lambda1 - sign1) < epsilon$3) lambda1 -= sign1 * epsilon$3; - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - _clean2 = 0; - } - - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function lineEnd() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function clean() { - return 2 - _clean2; // if intersections, rejoin first and last segments - } - }; - } - - function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, - cosPhi1, - sinLambda0Lambda1 = sin$1(lambda0 - lambda1); - return abs$1(sinLambda0Lambda1) > epsilon$3 ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1) - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2; - } - - function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - - if (from == null) { - phi = direction * halfPi$1; - stream.point(-pi$2, phi); - stream.point(0, phi); - stream.point(pi$2, phi); - stream.point(pi$2, 0); - stream.point(pi$2, -phi); - stream.point(0, -phi); - stream.point(-pi$2, -phi); - stream.point(-pi$2, 0); - stream.point(-pi$2, phi); - } else if (abs$1(from[0] - to[0]) > epsilon$3) { - var lambda = from[0] < to[0] ? pi$2 : -pi$2; - phi = 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 = cos$1(radius), - delta = 6 * radians, - smallRadius = cr > 0, - notHemisphere = abs$1(cr) > epsilon$3; // TODO optimise for this common 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 polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // 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 - _clean3; // no intersections - - - return { - lineStart: function lineStart() { - v00 = v0 = false; - _clean3 = 1; - }, - point: function point(lambda, phi) { - var point1 = [lambda, phi], - point2, - v = visible(lambda, phi), - c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi$2 : -pi$2), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) point1[2] = 1; - } - - if (v !== v0) { - _clean3 = 0; - - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - - point0 = 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 = intersect(point1, point0, true))) { - _clean3 = 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], 3); - } - } - } - - if (v && (!point0 || !pointEqual(point0, point1))) { - stream.point(point1[0], point1[1]); - } - - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function lineEnd() { - if (v0) stream.lineEnd(); - point0 = null; - }, - // Rejoin first and last segments if there were intersections and the first - // and last points were visible. - clean: function clean() { - return _clean3 | (v00 && v0) << 1; - } - }; - } // Intersects the great circle between a and b with the clip circle. - - - function intersect(a, b, two) { - var pa = cartesian(a), - pb = cartesian(b); // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - - var n1 = [1, 0, 0], - // normal - n2 = cartesianCross(pa, pb), - n2n2 = cartesianDot(n2, n2), - n1n2 = n2[0], - // cartesianDot(n1, n2), - determinant = n2n2 - n1n2 * n1n2; // Two polar points. - - if (!determinant) return !two && a; - var c1 = cr * n2n2 / determinant, - c2 = -cr * n1n2 / determinant, - n1xn2 = cartesianCross(n1, n2), - A = cartesianScale(n1, c1), - B = cartesianScale(n2, c2); - cartesianAddInPlace(A, B); // Solve |p(t)|^2 = 1. - - var u = n1xn2, - w = cartesianDot(A, u), - uu = cartesianDot(u, u), - t2 = w * w - uu * (cartesianDot(A, A) - 1); - if (t2 < 0) return; - var t = sqrt$2(t2), - q = cartesianScale(u, (-w - t) / uu); - cartesianAddInPlace(q, A); - q = spherical(q); - if (!two) return q; // Two intersection points. - - var lambda0 = a[0], - lambda1 = b[0], - phi0 = a[1], - phi1 = b[1], - z; - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - var delta = lambda1 - lambda0, - polar = abs$1(delta - pi$2) < epsilon$3, - meridian = polar || delta < epsilon$3; - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; // Check that the first point is between a and b. - - if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs$1(q[0] - lambda0) < epsilon$3 ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > pi$2 ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = 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 = smallRadius ? radius : pi$2 - radius, - code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - - return code; - } - - return clip$2(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$2, radius - pi$2]); - } - - function clipLine(a, b, x0, y0, x1, y1) { - var ax = a[0], - ay = a[1], - bx = b[0], - by = b[1], - t0 = 0, - t1 = 1, - dx = bx - ax, - dy = by - ay, - r; - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; - } - - var clipMax = 1e9, - clipMin = -clipMax; // TODO Use d3-polygon’s 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 <= x && x <= x1 && y0 <= y && y <= y1; - } - - function interpolate(from, to, direction, stream) { - var a = 0, - a1 = 0; - - if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) { - do { - stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - } while ((a = (a + direction + 4) % 4) !== a1); - } else { - stream.point(to[0], to[1]); - } - } - - function corner(p, direction) { - return abs$1(p[0] - x0) < epsilon$3 ? direction > 0 ? 0 : 3 : abs$1(p[0] - x1) < epsilon$3 ? direction > 0 ? 2 : 1 : abs$1(p[1] - y0) < epsilon$3 ? 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 = corner(a, 1), - cb = corner(b, 1); - return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; - } - - return function (stream) { - var activeStream = stream, - bufferStream = clipBuffer(), - segments, - polygon, - ring, - x__, - y__, - v__, - // first point - x_, - y_, - v_, - // previous point - first, - clean; - var clipStream = { - 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 = 0; - - for (var i = 0, n = polygon.length; i < n; ++i) { - for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) { - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - - if (a1 <= y1) { - if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; - } else { - if (b1 <= 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 = bufferStream, segments = [], polygon = [], clean = true; - } - - function polygonEnd() { - var startInside = polygonInside(), - cleanInside = clean && startInside, - visible = (segments = merge$1(segments)).length; - - if (cleanInside || visible) { - stream.polygonStart(); - - if (cleanInside) { - stream.lineStart(); - interpolate(null, null, 1, stream); - stream.lineEnd(); - } - - if (visible) { - clipRejoin(segments, compareIntersection, startInside, interpolate, stream); - } - - stream.polygonEnd(); - } - - activeStream = stream, segments = polygon = ring = null; - } - - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } // TODO rather than special-case polygons, simply handle them separately. - // 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 = point; - if (v_) activeStream.lineEnd(); - } - - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([x, y]); - - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else { - if (v && v_) activeStream.point(x, y);else { - var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], - b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.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 = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - } - - x_ = x, y_ = y, v_ = v; - } - - return clipStream; - }; - } - - function graticuleX(y0, y1, dy) { - var y = range$1(y0, y1 - epsilon$3, dy).concat(y1); - return function (x) { - return y.map(function (y) { - return [x, y]; - }); - }; - } - - function graticuleY(x0, x1, dx) { - var x = range$1(x0, x1 - epsilon$3, 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 = 10, - dy = dx, - DX = 90, - DY = 360, - x, - y, - X, - Y, - precision = 2.5; - - function graticule() { - return { - type: "MultiLineString", - coordinates: lines() - }; - } - - function lines() { - return range$1(ceil(X0 / DX) * DX, X1, DX).map(X).concat(range$1(ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(range$1(ceil(x0 / dx) * dx, x1, dx).filter(function (x) { - return abs$1(x % DX) > epsilon$3; - }).map(x)).concat(range$1(ceil(y0 / dy) * dy, y1, dy).filter(function (y) { - return abs$1(y % DY) > epsilon$3; - }).map(y)); - } - - graticule.lines = function () { - return lines().map(function (coordinates) { - return { - type: "LineString", - coordinates: coordinates - }; - }); - }; - - graticule.outline = function () { - return { - type: "Polygon", - coordinates: [X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1))] - }; - }; - - graticule.extent = function (_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - - graticule.extentMajor = function (_) { - if (!arguments.length) return [[X0, Y0], [X1, Y1]]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - - graticule.extentMinor = function (_) { - if (!arguments.length) return [[x0, y0], [x1, y1]]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - - graticule.step = function (_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - - graticule.stepMajor = function (_) { - if (!arguments.length) return [DX, DY]; - DX = +_[0], DY = +_[1]; - return graticule; - }; - - graticule.stepMinor = function (_) { - if (!arguments.length) return [dx, dy]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - - graticule.precision = function (_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - - return graticule.extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]).extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]); - } - - function identity$6(x) { - return x; - } - - var areaSum$1 = adder(), - areaRingSum$1 = adder(), - x00, - y00, - x0$1, - y0$1; - var areaStream$1 = { - point: noop$4, - lineStart: noop$4, - lineEnd: noop$4, - polygonStart: function polygonStart() { - areaStream$1.lineStart = areaRingStart$1; - areaStream$1.lineEnd = areaRingEnd$1; - }, - polygonEnd: function polygonEnd() { - areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$4; - areaSum$1.add(abs$1(areaRingSum$1)); - areaRingSum$1.reset(); - }, - result: function result() { - var area = areaSum$1 / 2; - areaSum$1.reset(); - return area; - } - }; - - function areaRingStart$1() { - areaStream$1.point = areaPointFirst$1; - } - - function areaPointFirst$1(x, y) { - areaStream$1.point = areaPoint$1; - x00 = x0$1 = x, y00 = y0$1 = y; - } - - function areaPoint$1(x, y) { - areaRingSum$1.add(y0$1 * x - x0$1 * y); - x0$1 = x, y0$1 = y; - } - - function areaRingEnd$1() { - areaPoint$1(x00, y00); - } - - var x0$2 = Infinity, - y0$2 = x0$2, - x1 = -x0$2, - y1 = x1; - var boundsStream$1 = { - point: boundsPoint$1, - lineStart: noop$4, - lineEnd: noop$4, - polygonStart: noop$4, - polygonEnd: noop$4, - result: function result() { - var bounds = [[x0$2, y0$2], [x1, y1]]; - x1 = y1 = -(y0$2 = x0$2 = Infinity); - return bounds; - } - }; - - function boundsPoint$1(x, y) { - if (x < x0$2) x0$2 = x; - if (x > x1) x1 = x; - if (y < y0$2) y0$2 = y; - if (y > y1) y1 = y; - } // TODO Enforce positive area for exterior, negative area for interior? - - - var X0$1 = 0, - Y0$1 = 0, - Z0$1 = 0, - X1$1 = 0, - Y1$1 = 0, - Z1$1 = 0, - X2$1 = 0, - Y2$1 = 0, - Z2$1 = 0, - x00$1, - y00$1, - x0$3, - y0$3; - var centroidStream$1 = { - point: centroidPoint$1, - lineStart: centroidLineStart$1, - lineEnd: centroidLineEnd$1, - polygonStart: function polygonStart() { - centroidStream$1.lineStart = centroidRingStart$1; - centroidStream$1.lineEnd = centroidRingEnd$1; - }, - polygonEnd: function polygonEnd() { - centroidStream$1.point = centroidPoint$1; - centroidStream$1.lineStart = centroidLineStart$1; - centroidStream$1.lineEnd = centroidLineEnd$1; - }, - result: function result() { - var centroid = 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 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = X2$1 = Y2$1 = Z2$1 = 0; - return centroid; - } - }; - - function centroidPoint$1(x, y) { - X0$1 += x; - Y0$1 += y; - ++Z0$1; - } - - function centroidLineStart$1() { - centroidStream$1.point = centroidPointFirstLine; - } - - function centroidPointFirstLine(x, y) { - centroidStream$1.point = centroidPointLine; - centroidPoint$1(x0$3 = x, y0$3 = y); - } - - function centroidPointLine(x, y) { - var dx = x - x0$3, - dy = y - y0$3, - z = sqrt$2(dx * dx + dy * dy); - X1$1 += z * (x0$3 + x) / 2; - Y1$1 += z * (y0$3 + y) / 2; - Z1$1 += z; - centroidPoint$1(x0$3 = x, y0$3 = y); - } - - function centroidLineEnd$1() { - centroidStream$1.point = centroidPoint$1; - } - - function centroidRingStart$1() { - centroidStream$1.point = centroidPointFirstRing; - } - - function centroidRingEnd$1() { - centroidPointRing(x00$1, y00$1); - } - - function centroidPointFirstRing(x, y) { - centroidStream$1.point = centroidPointRing; - centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y); - } - - function centroidPointRing(x, y) { - var dx = x - x0$3, - dy = y - y0$3, - z = sqrt$2(dx * dx + dy * dy); - X1$1 += z * (x0$3 + x) / 2; - Y1$1 += z * (y0$3 + y) / 2; - Z1$1 += z; - z = y0$3 * x - x0$3 * y; - X2$1 += z * (x0$3 + x); - Y2$1 += z * (y0$3 + y); - Z2$1 += z * 3; - centroidPoint$1(x0$3 = x, y0$3 = y); - } - - function PathContext(context) { - this._context = context; - } - - PathContext.prototype = { - _radius: 4.5, - pointRadius: function pointRadius(_) { - return this._radius = _, this; - }, - polygonStart: function polygonStart() { - this._line = 0; - }, - polygonEnd: function polygonEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._point = 0; - }, - lineEnd: function lineEnd() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; - }, - point: function point(x, y) { - switch (this._point) { - case 0: - { - this._context.moveTo(x, y); - - this._point = 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$2); - - break; - } - } - }, - result: noop$4 - }; - var lengthSum = adder(), - lengthRing, - x00$2, - y00$2, - x0$4, - y0$4; - var lengthStream = { - point: noop$4, - lineStart: function lineStart() { - lengthStream.point = lengthPointFirst; - }, - lineEnd: function lineEnd() { - if (lengthRing) lengthPoint(x00$2, y00$2); - lengthStream.point = noop$4; - }, - polygonStart: function polygonStart() { - lengthRing = true; - }, - polygonEnd: function polygonEnd() { - lengthRing = null; - }, - result: function result() { - var length = +lengthSum; - lengthSum.reset(); - return length; - } - }; - - function lengthPointFirst(x, y) { - lengthStream.point = lengthPoint; - x00$2 = x0$4 = x, y00$2 = y0$4 = y; - } - - function lengthPoint(x, y) { - x0$4 -= x, y0$4 -= y; - lengthSum.add(sqrt$2(x0$4 * x0$4 + y0$4 * y0$4)); - x0$4 = x, y0$4 = y; - } - - function PathString() { - this._string = []; - } - - PathString.prototype = { - _radius: 4.5, - _circle: circle$1(4.5), - pointRadius: function pointRadius(_) { - if ((_ = +_) !== this._radius) this._radius = _, this._circle = null; - return this; - }, - polygonStart: function polygonStart() { - this._line = 0; - }, - polygonEnd: function polygonEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._point = 0; - }, - lineEnd: function lineEnd() { - if (this._line === 0) this._string.push("Z"); - this._point = NaN; - }, - point: function point(x, y) { - switch (this._point) { - case 0: - { - this._string.push("M", x, ",", y); - - this._point = 1; - break; - } - - case 1: - { - this._string.push("L", x, ",", y); - - break; - } - - default: - { - if (this._circle == null) this._circle = circle$1(this._radius); - - this._string.push("M", x, ",", y, this._circle); - - break; - } - } - }, - result: function result() { - if (this._string.length) { - var result = this._string.join(""); - - this._string = []; - 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 geoPath(projection, context) { - var pointRadius = 4.5, - projectionStream, - contextStream; - - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - geoStream(object, projectionStream(contextStream)); - } - - return contextStream.result(); - } - - path.area = function (object) { - geoStream(object, projectionStream(areaStream$1)); - return areaStream$1.result(); - }; - - path.measure = function (object) { - geoStream(object, projectionStream(lengthStream)); - return lengthStream.result(); - }; - - path.bounds = function (object) { - geoStream(object, projectionStream(boundsStream$1)); - return boundsStream$1.result(); - }; - - path.centroid = function (object) { - geoStream(object, projectionStream(centroidStream$1)); - return centroidStream$1.result(); - }; - - path.projection = function (_) { - return arguments.length ? (projectionStream = _ == null ? (projection = null, identity$6) : (projection = _).stream, path) : projection; - }; - - path.context = function (_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - - path.pointRadius = function (_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - - return path.projection(projection).context(context); - } - - function transformer$3(methods) { - return function (stream) { - var s = new TransformStream(); - - for (var key in methods) { - s[key] = methods[key]; - } - - s.stream = stream; - return s; - }; - } - - function TransformStream() {} - - TransformStream.prototype = { - constructor: TransformStream, - point: function point(x, y) { - this.stream.point(x, y); - }, - sphere: function sphere() { - this.stream.sphere(); - }, - lineStart: function lineStart() { - this.stream.lineStart(); - }, - lineEnd: function lineEnd() { - this.stream.lineEnd(); - }, - polygonStart: function polygonStart() { - this.stream.polygonStart(); - }, - polygonEnd: function polygonEnd() { - this.stream.polygonEnd(); - } - }; - - function fit(projection, fitBounds, object) { - var clip = projection.clipExtent && projection.clipExtent(); - projection.scale(150).translate([0, 0]); - if (clip != null) projection.clipExtent(null); - geoStream(object, projection.stream(boundsStream$1)); - fitBounds(boundsStream$1.result()); - if (clip != null) projection.clipExtent(clip); - return projection; - } - - function fitExtent(projection, extent, object) { - return fit(projection, function (b) { - var w = extent[1][0] - extent[0][0], - h = extent[1][1] - extent[0][1], - k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), - x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, - y = +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 = +width, - k = w / (b[1][0] - b[0][0]), - x = (w - k * (b[1][0] + b[0][0])) / 2, - y = -k * b[0][1]; - projection.scale(150 * k).translate([x, y]); - }, object); - } - - function fitHeight(projection, height, object) { - return fit(projection, function (b) { - var h = +height, - k = h / (b[1][1] - b[0][1]), - x = -k * b[0][0], - y = (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([x, y]); - }, object); - } - - var maxDepth = 16, - // maximum depth of subdivision - cosMinDistance = 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$3({ - point: function point(x, y) { - x = 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 = x1 - x0, - dy = y1 - y0, - d2 = dx * dx + dy * dy; - - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, - b = b0 + b1, - c = c0 + c1, - m = sqrt$2(a * a + b * b + c * c), - phi2 = asin$1(c /= m), - lambda2 = abs$1(abs$1(c) - 1) < epsilon$3 || abs$1(lambda0 - lambda1) < epsilon$3 ? (lambda0 + lambda1) / 2 : atan2$1(b, a), - p = project(lambda2, phi2), - x2 = p[0], - y2 = p[1], - dx2 = x2 - x0, - dy2 = y2 - y0, - dz = dy * dx2 - dx * dy2; - - if (dz * dz / d2 > delta2 // perpendicular projected distance - || abs$1((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end - || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { - // angular distance - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } - } - } - - return function (stream) { - var lambda00, x00, y00, a00, b00, c00, // first point - lambda0, x0, y0, a0, b0, c0; // previous point - - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function polygonStart() { - stream.polygonStart(); - resampleStream.lineStart = ringStart; - }, - polygonEnd: function polygonEnd() { - stream.polygonEnd(); - resampleStream.lineStart = lineStart; - } - }; - - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - - function linePoint(lambda, phi) { - var c = cartesian([lambda, phi]), - p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - - return resampleStream; - }; - } - - var transformRadians = transformer$3({ - point: function point(x, y) { - this.stream.point(x * radians, y * radians); - } - }); - - function transformRotate(rotate) { - return transformer$3({ - point: function point(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); - } - }); - } - - function scaleTranslate(k, dx, dy, sx, sy) { - function transform(x, y) { - x *= sx; - y *= sy; - return [dx + k * x, dy - k * y]; - } - - transform.invert = function (x, y) { - return [(x - dx) / k * sx, (dy - y) / k * sy]; - }; - - return transform; - } - - function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - var cosAlpha = cos$1(alpha), - sinAlpha = sin$1(alpha), - a = cosAlpha * k, - b = sinAlpha * k, - ai = cosAlpha / k, - bi = sinAlpha / k, - ci = (sinAlpha * dy - cosAlpha * dx) / k, - fi = (sinAlpha * dx + cosAlpha * dy) / k; - - function transform(x, y) { - x *= sx; - y *= sy; - return [a * x - b * y + dx, dy - b * x - a * y]; - } - - transform.invert = function (x, y) { - return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)]; - }; - - return transform; - } - - function projection(project) { - return projectionMutator(function () { - return project; - })(); - } - - function projectionMutator(projectAt) { - var project, - k = 150, - // scale - x = 480, - y = 250, - // translate - lambda = 0, - phi = 0, - // center - deltaLambda = 0, - deltaPhi = 0, - deltaGamma = 0, - rotate, - // pre-rotate - alpha = 0, - // post-rotate angle - sx = 1, - // reflectX - sy = 1, - // reflectX - theta = null, - preclip = clipAntimeridian, - // pre-clip angle - x0 = null, - y0, - x1, - y1, - postclip = identity$6, - // post-clip extent - delta2 = 0.5, - // precision - projectResample, - projectTransform, - projectRotateTransform, - cache, - cacheStream; - - function projection(point) { - return projectRotateTransform(point[0] * radians, point[1] * radians); - } - - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [point[0] * degrees$1, point[1] * degrees$1]; - } - - projection.stream = function (stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); - }; - - projection.preclip = function (_) { - return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; - }; - - projection.postclip = function (_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - - projection.clipAngle = function (_) { - return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees$1; - }; - - projection.clipExtent = function (_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$6) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - projection.scale = function (_) { - return arguments.length ? (k = +_, recenter()) : k; - }; - - projection.translate = function (_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y]; - }; - - projection.center = function (_) { - return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees$1, phi * degrees$1]; - }; - - projection.rotate = function (_) { - return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees$1, deltaPhi * degrees$1, deltaGamma * degrees$1]; - }; - - projection.angle = function (_) { - return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees$1; - }; - - projection.reflectX = function (_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; - }; - - projection.reflectY = function (_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; - }; - - projection.precision = function (_) { - return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt$2(delta2); - }; - - projection.fitExtent = function (extent, object) { - return fitExtent(projection, extent, object); - }; - - projection.fitSize = function (size, object) { - return fitSize(projection, size, object); - }; - - projection.fitWidth = function (width, object) { - return fitWidth(projection, width, object); - }; - - projection.fitHeight = function (height, object) { - return fitHeight(projection, height, object); - }; - - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), - transform = (alpha ? scaleTranslateRotate : scaleTranslate)(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma); - projectTransform = compose(project, transform); - projectRotateTransform = compose(rotate, projectTransform); - projectResample = resample(projectTransform, delta2); - return reset(); - } - - function reset() { - cache = cacheStream = null; - return projection; - } - - return function () { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; - } - - function conicProjection(projectAt) { - var phi0 = 0, - phi1 = pi$2 / 3, - m = projectionMutator(projectAt), - p = m(phi0, phi1); - - p.parallels = function (_) { - return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees$1, phi1 * degrees$1]; - }; - - return p; - } - - function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = cos$1(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, sin$1(phi) / cosPhi0]; - } - - forward.invert = function (x, y) { - return [x / cosPhi0, asin$1(y * cosPhi0)]; - }; - - return forward; - } - - function conicEqualAreaRaw(y0, y1) { - var sy0 = sin$1(y0), - n = (sy0 + sin$1(y1)) / 2; // Are the parallels symmetrical around the Equator? - - if (abs$1(n) < epsilon$3) return cylindricalEqualAreaRaw(y0); - var c = 1 + sy0 * (2 * n - sy0), - r0 = sqrt$2(c) / n; - - function project(x, y) { - var r = sqrt$2(c - 2 * n * sin$1(y)) / n; - return [r * sin$1(x *= n), r0 - r * cos$1(x)]; - } - - project.invert = function (x, y) { - var r0y = r0 - y, - l = atan2$1(x, abs$1(r0y)) * sign$1(r0y); - if (r0y * n < 0) l -= pi$2 * sign$1(x) * sign$1(r0y); - return [l / n, asin$1((c - (x * x + r0y * r0y) * n * n) / (2 * n))]; - }; - - return project; - } - - function geoConicEqualArea() { - return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]); - } - - function geoAlbers() { - return geoConicEqualArea().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 = streams.length; - return { - point: function point(x, y) { - var i = -1; - - while (++i < n) { - streams[i].point(x, y); - } - }, - sphere: function sphere() { - var i = -1; - - while (++i < n) { - streams[i].sphere(); - } - }, - lineStart: function lineStart() { - var i = -1; - - while (++i < n) { - streams[i].lineStart(); - } - }, - lineEnd: function lineEnd() { - var i = -1; - - while (++i < n) { - streams[i].lineEnd(); - } - }, - polygonStart: function polygonStart() { - var i = -1; - - while (++i < n) { - streams[i].polygonStart(); - } - }, - polygonEnd: function polygonEnd() { - var i = -1; - - while (++i < n) { - streams[i].polygonEnd(); - } - } - }; - } // A composite projection for the United States, configured by default for - // 960×500. The projection also works quite well at 960×600 if you 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 geoAlbersUsa() { - var cache, - cacheStream, - lower48 = geoAlbers(), - lower48Point, - alaska = geoConicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), - alaskaPoint, - // EPSG:3338 - hawaii = geoConicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), - hawaiiPoint, - // ESRI:102007 - _point2, - pointStream = { - point: function point(x, y) { - _point2 = [x, y]; - } - }; - - function albersUsa(coordinates) { - var x = coordinates[0], - y = coordinates[1]; - return _point2 = null, (lower48Point.point(x, y), _point2) || (alaskaPoint.point(x, y), _point2) || (hawaiiPoint.point(x, y), _point2); - } - - 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); - }; - - albersUsa.stream = function (stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]); - }; - - albersUsa.precision = function (_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - - 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); - alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon$3, y + 0.120 * k + epsilon$3], [x - 0.214 * k - epsilon$3, y + 0.234 * k - epsilon$3]]).stream(pointStream); - hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon$3, y + 0.166 * k + epsilon$3], [x - 0.115 * k - epsilon$3, y + 0.234 * k - epsilon$3]]).stream(pointStream); - return reset(); - }; - - albersUsa.fitExtent = function (extent, object) { - return fitExtent(albersUsa, extent, object); - }; - - albersUsa.fitSize = function (size, object) { - return fitSize(albersUsa, size, object); - }; - - albersUsa.fitWidth = function (width, object) { - return fitWidth(albersUsa, width, object); - }; - - albersUsa.fitHeight = function (height, object) { - return fitHeight(albersUsa, height, object); - }; - - function reset() { - cache = cacheStream = null; - return albersUsa; - } - - return albersUsa.scale(1070); - } - - function azimuthalRaw(scale) { - return function (x, y) { - var cx = cos$1(x), - cy = cos$1(y), - k = scale(cx * cy); - return [k * cy * sin$1(x), k * sin$1(y)]; - }; - } - - function azimuthalInvert(angle) { - return function (x, y) { - var z = sqrt$2(x * x + y * y), - c = angle(z), - sc = sin$1(c), - cc = cos$1(c); - return [atan2$1(x * sc, z * cc), asin$1(z && y * sc / z)]; - }; - } - - var azimuthalEqualAreaRaw = azimuthalRaw(function (cxcy) { - return sqrt$2(2 / (1 + cxcy)); - }); - azimuthalEqualAreaRaw.invert = azimuthalInvert(function (z) { - return 2 * asin$1(z / 2); - }); - - function geoAzimuthalEqualArea() { - return projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3); - } - - var azimuthalEquidistantRaw = azimuthalRaw(function (c) { - return (c = acos$1(c)) && c / sin$1(c); - }); - azimuthalEquidistantRaw.invert = azimuthalInvert(function (z) { - return z; - }); - - function geoAzimuthalEquidistant() { - return projection(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3); - } - - function mercatorRaw(lambda, phi) { - return [lambda, log$3(tan((halfPi$1 + phi) / 2))]; - } - - mercatorRaw.invert = function (x, y) { - return [x, 2 * atan(exp$1(y)) - halfPi$1]; - }; - - function geoMercator() { - return mercatorProjection(mercatorRaw).scale(961 / tau$2); - } - - function mercatorProjection(project) { - var m = projection(project), - center = m.center, - scale = m.scale, - translate = m.translate, - clipExtent = m.clipExtent, - x0 = null, - y0, - x1, - y1; // clip extent - - m.scale = function (_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - - m.translate = function (_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - - m.center = function (_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - - m.clipExtent = function (_) { - return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - function reclip() { - var k = pi$2 * scale(), - t = m(rotation(m.rotate()).invert([0, 0])); - return clipExtent(x0 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === 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$1 + y) / 2); - } - - function conicConformalRaw(y0, y1) { - var cy0 = cos$1(y0), - n = y0 === y1 ? sin$1(y0) : log$3(cy0 / cos$1(y1)) / log$3(tany(y1) / tany(y0)), - f = cy0 * pow$2(tany(y0), n) / n; - if (!n) return mercatorRaw; - - function project(x, y) { - if (f > 0) { - if (y < -halfPi$1 + epsilon$3) y = -halfPi$1 + epsilon$3; - } else { - if (y > halfPi$1 - epsilon$3) y = halfPi$1 - epsilon$3; - } - - var r = f / pow$2(tany(y), n); - return [r * sin$1(n * x), f - r * cos$1(n * x)]; - } - - project.invert = function (x, y) { - var fy = f - y, - r = sign$1(n) * sqrt$2(x * x + fy * fy), - l = atan2$1(x, abs$1(fy)) * sign$1(fy); - if (fy * n < 0) l -= pi$2 * sign$1(x) * sign$1(fy); - return [l / n, 2 * atan(pow$2(f / r, 1 / n)) - halfPi$1]; - }; - - return project; - } - - function geoConicConformal() { - return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]); - } - - function equirectangularRaw(lambda, phi) { - return [lambda, phi]; - } - - equirectangularRaw.invert = equirectangularRaw; - - function geoEquirectangular() { - return projection(equirectangularRaw).scale(152.63); - } - - function conicEquidistantRaw(y0, y1) { - var cy0 = cos$1(y0), - n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0), - g = cy0 / n + y0; - if (abs$1(n) < epsilon$3) return equirectangularRaw; - - function project(x, y) { - var gy = g - y, - nx = n * x; - return [gy * sin$1(nx), g - gy * cos$1(nx)]; - } - - project.invert = function (x, y) { - var gy = g - y, - l = atan2$1(x, abs$1(gy)) * sign$1(gy); - if (gy * n < 0) l -= pi$2 * sign$1(x) * sign$1(gy); - return [l / n, g - sign$1(n) * sqrt$2(x * x + gy * gy)]; - }; - - return project; - } - - function geoConicEquidistant() { - return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]); - } - - var A1 = 1.340264, - A2 = -0.081106, - A3 = 0.000893, - A4 = 0.003796, - M = sqrt$2(3) / 2, - iterations = 12; - - function equalEarthRaw(lambda, phi) { - var l = asin$1(M * sin$1(phi)), - l2 = l * l, - l6 = 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 = function (x, y) { - var l = y, - l2 = l * l, - l6 = l2 * l2 * l2; - - for (var i = 0, delta, fy, fpy; i < iterations; ++i) { - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if (abs$1(delta) < epsilon2$1) break; - } - - return [M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l), asin$1(sin$1(l) / M)]; - }; - - function geoEqualEarth() { - return projection(equalEarthRaw).scale(177.158); - } - - function gnomonicRaw(x, y) { - var cy = cos$1(y), - k = cos$1(x) * cy; - return [cy * sin$1(x) / k, sin$1(y) / k]; - } - - gnomonicRaw.invert = azimuthalInvert(atan); - - function geoGnomonic() { - return projection(gnomonicRaw).scale(144.049).clipAngle(60); - } - - function geoIdentity() { - var k = 1, - tx = 0, - ty = 0, - sx = 1, - sy = 1, - // scale, translate and reflect - alpha = 0, - ca, - sa, - // angle - x0 = null, - y0, - x1, - y1, - // clip extent - kx = 1, - ky = 1, - transform = transformer$3({ - point: function point(x, y) { - var p = projection([x, y]); - this.stream.point(p[0], p[1]); - } - }), - postclip = identity$6, - cache, - cacheStream; - - function reset() { - kx = k * sx; - ky = k * sy; - cache = cacheStream = null; - return projection; - } - - function projection(p) { - var x = p[0] * kx, - y = p[1] * ky; - - if (alpha) { - var t = y * ca - x * sa; - x = x * ca + y * sa; - y = t; - } - - return [x + tx, y + ty]; - } - - projection.invert = function (p) { - var x = p[0] - tx, - y = p[1] - ty; - - if (alpha) { - var t = y * ca + x * sa; - x = x * ca - y * sa; - y = t; - } - - return [x / kx, y / ky]; - }; - - projection.stream = function (stream) { - return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream)); - }; - - projection.postclip = function (_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - - projection.clipExtent = function (_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$6) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - projection.scale = function (_) { - return arguments.length ? (k = +_, reset()) : k; - }; - - projection.translate = function (_) { - return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty]; - }; - - projection.angle = function (_) { - return arguments.length ? (alpha = _ % 360 * radians, sa = sin$1(alpha), ca = cos$1(alpha), reset()) : alpha * degrees$1; - }; - - projection.reflectX = function (_) { - return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0; - }; - - projection.reflectY = function (_) { - return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0; - }; - - projection.fitExtent = function (extent, object) { - return fitExtent(projection, extent, object); - }; - - projection.fitSize = function (size, object) { - return fitSize(projection, size, object); - }; - - projection.fitWidth = function (width, object) { - return fitWidth(projection, width, object); - }; - - projection.fitHeight = function (height, object) { - return fitHeight(projection, height, object); - }; - - return projection; - } - - function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, - phi4 = phi2 * phi2; - return [lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4)))]; - } - - naturalEarth1Raw.invert = function (x, y) { - var phi = y, - i = 25, - delta; - - do { - var phi2 = phi * phi, - phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 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$1(delta) > epsilon$3 && --i > 0); - - return [x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), phi]; - }; - - function geoNaturalEarth1() { - return projection(naturalEarth1Raw).scale(175.295); - } - - function orthographicRaw(x, y) { - return [cos$1(y) * sin$1(x), sin$1(y)]; - } - - orthographicRaw.invert = azimuthalInvert(asin$1); - - function geoOrthographic() { - return projection(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$3); - } - - function stereographicRaw(x, y) { - var cy = cos$1(y), - k = 1 + cos$1(x) * cy; - return [cy * sin$1(x) / k, sin$1(y) / k]; - } - - stereographicRaw.invert = azimuthalInvert(function (z) { - return 2 * atan(z); - }); - - function geoStereographic() { - return projection(stereographicRaw).scale(250).clipAngle(142); - } - - function transverseMercatorRaw(lambda, phi) { - return [log$3(tan((halfPi$1 + phi) / 2)), -lambda]; - } - - transverseMercatorRaw.invert = function (x, y) { - return [-y, 2 * atan(exp$1(x)) - halfPi$1]; - }; - - function geoTransverseMercator() { - var m = mercatorProjection(transverseMercatorRaw), - center = m.center, - rotate = m.rotate; - - m.center = function (_) { - return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); - }; - - m.rotate = function (_) { - return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]); - }; - - return rotate([0, 0, 90]).scale(159.155); - } - - var abs$2 = Math.abs; - var cos$2 = Math.cos; - var sin$2 = Math.sin; - var epsilon$4 = 1e-6; - var pi$3 = Math.PI; - var halfPi$2 = pi$3 / 2; - var sqrt2 = sqrt$3(2); - - function asin$2(x) { - return x > 1 ? halfPi$2 : x < -1 ? -halfPi$2 : Math.asin(x); - } - - function sqrt$3(x) { - return x > 0 ? Math.sqrt(x) : 0; - } - - function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * sin$2(phi), - i = 30, - delta; - - do { - phi -= delta = (phi + sin$2(phi) - cpsinPhi) / (1 + cos$2(phi)); - } while (abs$2(delta) > epsilon$4 && --i > 0); - - return phi / 2; - } - - function mollweideBromleyRaw(cx, cy, cp) { - function forward(lambda, phi) { - return [cx * lambda * cos$2(phi = mollweideBromleyTheta(cp, phi)), cy * sin$2(phi)]; - } - - forward.invert = function (x, y) { - return y = asin$2(y / cy), [x / (cx * cos$2(y)), asin$2((2 * y + sin$2(2 * y)) / cp)]; - }; - - return forward; - } - - var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi$2, sqrt2, pi$3); - - function geoMollweide() { - return projection(mollweideRaw).scale(169.529); - } - - var defaultPath = geoPath(); - var projectionProperties = [// standard properties in d3-geo - 'clipAngle', 'clipExtent', 'scale', 'translate', 'center', 'rotate', 'parallels', 'precision', 'reflectX', 'reflectY', // extended properties in d3-geo-projections - 'coefficient', 'distance', 'fraction', 'lobes', 'parallel', 'radius', 'ratio', 'spacing', 'tilt']; - /** - * Augment projections with their type and a copy method. - */ - - function create$1(type, constructor) { - return function projection() { - var p = constructor(); - p.type = type; - p.path = geoPath().projection(p); - - p.copy = p.copy || function () { - var c = projection(); - projectionProperties.forEach(function (prop) { - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - - return p; - }; - } - - function projection$1(type, proj) { - if (!type || typeof type !== 'string') { - throw new Error('Projection type must be a name string.'); - } - - type = type.toLowerCase(); - - if (arguments.length > 1) { - projections[type] = create$1(type, proj); - return this; - } else { - return projections[type] || null; - } - } - - function getProjectionPath(proj) { - return proj && proj.path || defaultPath; - } - - var projections = { - // base d3-geo projection types - albers: geoAlbers, - albersusa: geoAlbersUsa, - azimuthalequalarea: geoAzimuthalEqualArea, - azimuthalequidistant: geoAzimuthalEquidistant, - conicconformal: geoConicConformal, - conicequalarea: geoConicEqualArea, - conicequidistant: geoConicEquidistant, - equalEarth: geoEqualEarth, - equirectangular: geoEquirectangular, - gnomonic: geoGnomonic, - identity: geoIdentity, - mercator: geoMercator, - mollweide: geoMollweide, - naturalEarth1: geoNaturalEarth1, - orthographic: geoOrthographic, - stereographic: geoStereographic, - transversemercator: geoTransverseMercator - }; - - for (var key$1 in projections) { - projection$1(key$1, projections[key$1]); - } - /** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ - - - function GeoPath(params) { - Transform.call(this, null, params); - } - - GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'projection', - 'type': 'projection' - }, { - 'name': 'field', - 'type': 'field' - }, { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'default': 'path' - }] - }; - var prototype$17 = inherits(GeoPath, Transform); - - prototype$17.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - path = this.value, - field = _.field || identity, - as = _.as || 'path', - flag = out.SOURCE; - - function set(t) { - t[as] = path(field(t)); - } - - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = getProjectionPath(_.projection); - out.materialize().reflow(); - } else { - flag = field === identity || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD; - } - - var prev = initPath(path, _.pointRadius); - out.visit(flag, set); - path.pointRadius(prev); - return out.modifies(as); - }; - - function initPath(path, pointRadius) { - var prev = path.pointRadius(); - path.context(null); - - if (pointRadius != null) { - path.pointRadius(pointRadius); - } - - return prev; - } - /** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ - - - function GeoPoint(params) { - Transform.call(this, null, params); - } - - GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'projection', - 'type': 'projection', - 'required': true - }, { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': ['x', 'y'] - }] - }; - var prototype$18 = inherits(GeoPoint, Transform); - - prototype$18.transform = function (_, pulse) { - var proj = _.projection, - lon = _.fields[0], - lat = _.fields[1], - as = _.as || ['x', 'y'], - x = as[0], - y = as[1], - mod; - - function set(t) { - var xy = proj([lon(t), lat(t)]); - - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - - if (_.modified()) { - // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - } else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - - return pulse.modifies(as); - }; - /** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ - - - function GeoShape(params) { - Transform.call(this, null, params); - } - - GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': { - 'modifies': true, - 'nomod': true - }, - 'params': [{ - 'name': 'projection', - 'type': 'projection' - }, { - 'name': 'field', - 'type': 'field', - 'default': 'datum' - }, { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'default': 'shape' - }] - }; - var prototype$19 = inherits(GeoShape, Transform); - - prototype$19.transform = function (_, pulse) { - var out = pulse.fork(pulse.ALL), - shape = this.value, - as = _.as || 'shape', - flag = out.ADD; - - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator(getProjectionPath(_.projection), _.field || field('datum'), _.pointRadius); - out.materialize().reflow(); - flag = out.SOURCE; - } - - out.visit(flag, function (t) { - t[as] = shape; - }); - return out.modifies(as); - }; - - function shapeGenerator(path, field, pointRadius) { - var shape = pointRadius == null ? function (_) { - return path(field(_)); - } : function (_) { - var prev = path.pointRadius(), - value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - - shape.context = function (_) { - path.context(_); - return shape; - }; - - return shape; - } - /** - * GeoJSON feature generator for creating graticules. - * @constructor - */ - - - function Graticule(params) { - Transform.call(this, [], params); - this.generator = graticule(); - } - - Graticule.Definition = { - 'type': 'Graticule', - 'metadata': { - 'changes': true, - 'generates': true - }, - 'params': [{ - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'extentMajor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'extentMinor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'step', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'stepMajor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [90, 360] - }, { - 'name': 'stepMinor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [10, 10] - }, { - 'name': 'precision', - 'type': 'number', - 'default': 2.5 - }] - }; - var prototype$1a = inherits(Graticule, Transform); - - prototype$1a.transform = function (_, pulse) { - var src = this.value, - gen = this.generator, - t; - - if (!src.length || _.modified()) { - for (var prop in _) { - if (isFunction(gen[prop])) { - gen[prop](_[prop]); - } - } - } - - t = gen(); - - if (src.length) { - pulse.mod.push(replace(src[0], t)); - } else { - pulse.add.push(ingest(t)); - } - - src[0] = t; - return pulse; - }; - /** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ - - - function Heatmap(params) { - Transform.call(this, null, params); - } - - Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'color', - 'type': 'string', - 'expr': true - }, { - 'name': 'opacity', - 'type': 'number', - 'expr': true - }, { - 'name': 'resolve', - 'type': 'enum', - 'values': ['shared', 'independent'], - 'default': 'independent' - }, { - 'name': 'as', - 'type': 'string', - 'default': 'image' - }] - }; - var prototype$1b = inherits(Heatmap, Transform); - - prototype$1b.transform = function (_, pulse) { - if (!pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var source = pulse.materialize(pulse.SOURCE).source, - shared = _.resolve === 'shared', - field = _.field || identity, - opacity = opacity_(_.opacity, _), - color = color_(_.color, _), - as = _.as || 'image', - obj = { - $x: 0, - $y: 0, - $value: 0, - $max: shared ? max(source.map(function (t) { - return max(field(t).values); - })) : 0 - }; - source.forEach(function (t) { - var v = field(t); // build proxy data object - - var o = extend({}, t, obj); // set maximum value if not globally shared - - if (!shared) o.$max = max(v.values || []); // generate canvas image - // optimize color/opacity if not pixel-dependent - - t[as] = toCanvas(v, o, color.dep ? color : constant(color(o)), opacity.dep ? opacity : constant(opacity(o))); - }); - return pulse.reflow(true).modifies(as); - }; // get image color function - - - function color_(color, _) { - var f; - - if (isFunction(color)) { - f = function f(obj) { - return rgb(color(obj, _)); - }; - - f.dep = dependency(color); - } else { - // default to mid-grey - f = constant(rgb(color || '#888')); - } - - return f; - } // get image opacity function - - - function opacity_(opacity, _) { - var f; - - if (isFunction(opacity)) { - f = function f(obj) { - return opacity(obj, _); - }; - - f.dep = dependency(opacity); - } else if (opacity) { - f = constant(opacity); - } else { - // default to [0, max] opacity gradient - f = function f(obj) { - return obj.$value / obj.$max || 0; - }; - - f.dep = true; - } - - return f; - } // check if function depends on individual pixel data - - - function dependency(f) { - if (!isFunction(f)) return false; - var set = toSet(accessorFields(f)); - return set.$x || set.$y || set.$value || set.$max; - } // render raster grid to canvas - - - function toCanvas(grid, obj, color, opacity) { - var n = grid.width, - m = grid.height, - x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - x2 = grid.x2 || n, - y2 = grid.y2 || m, - val = grid.values, - value = val ? function (i) { - return val[i]; - } : zero, - can = domCanvas(x2 - x1, y2 - y1), - ctx = can.getContext('2d'), - img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), - pix = img.data; - - for (var j = y1, k = 0; j < y2; ++j) { - obj.$y = j - y1; - - for (var i = x1, r = j * n; i < x2; ++i, k += 4) { - obj.$x = i - x1; - obj.$value = value(i + r); - var v = color(obj); - pix[k + 0] = v.r; - pix[k + 1] = v.g; - pix[k + 2] = v.b; - pix[k + 3] = ~~(255 * opacity(obj)); - } - } - - ctx.putImageData(img, 0, 0); - return can; - } - /** - * Maintains a cartographic projection. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - - function Projection(params) { - Transform.call(this, null, params); - this.modified(true); // always treat as modified - } - - var prototype$1c = inherits(Projection, Transform); - - prototype$1c.transform = function (_, pulse) { - var proj = this.value; - - if (!proj || _.modified('type')) { - this.value = proj = create$2(_.type); - projectionProperties.forEach(function (prop) { - if (_[prop] != null) set$2(proj, prop, _[prop]); - }); - } else { - projectionProperties.forEach(function (prop) { - if (_.modified(prop)) set$2(proj, prop, _[prop]); - }); - } - - if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); - if (_.fit) fit$1(proj, _); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - }; - - function fit$1(proj, _) { - var data = collectGeoJSON(_.fit); - _.extent ? proj.fitExtent(_.extent, data) : _.size ? proj.fitSize(_.size, data) : 0; - } - - function create$2(type) { - var constructor = projection$1((type || 'mercator').toLowerCase()); - if (!constructor) error('Unrecognized projection type: ' + type); - return constructor(); - } - - function set$2(proj, key, value) { - if (isFunction(proj[key])) proj[key](value); - } - - function collectGeoJSON(data) { - data = array(data); - return data.length === 1 ? data[0] : { - type: FeatureCollection, - features: data.reduce(function (a, f) { - return a.concat(featurize(f)); - }, []) - }; - } - - function featurize(f) { - return f.type === FeatureCollection ? f.features : array(f).filter(function (d) { - return d != null; - }).map(function (d) { - return d.type === Feature ? d : { - type: Feature, - geometry: d - }; - }); - } - - var geo = /*#__PURE__*/Object.freeze({ - __proto__: null, - contour: Contour, - geojson: GeoJSON, - geopath: GeoPath, - geopoint: GeoPoint, - geoshape: GeoShape, - graticule: Graticule, - heatmap: Heatmap, - isocontour: Isocontour, - kde2d: KDE2D, - projection: Projection - }); - - function forceCenter(x, y) { - var nodes; - if (x == null) x = 0; - if (y == null) y = 0; - - function force() { - var i, - n = nodes.length, - node, - sx = 0, - sy = 0; - - for (i = 0; i < n; ++i) { - node = nodes[i], sx += node.x, sy += node.y; - } - - for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) { - node = nodes[i], node.x -= sx, node.y -= sy; - } - } - - force.initialize = function (_) { - nodes = _; - }; - - force.x = function (_) { - return arguments.length ? (x = +_, force) : x; - }; - - force.y = function (_) { - return arguments.length ? (y = +_, force) : y; - }; - - return force; - } - - function tree_add(d) { - var x = +this._x.call(null, d), - y = +this._y.call(null, d); - return add$4(this.cover(x, y), x, y, d); - } - - function add$4(tree, x, y, d) { - if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points - - var parent, - node = tree._root, - leaf = { - data: d - }, - x0 = tree._x0, - y0 = tree._y0, - x1 = tree._x1, - y1 = 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 = leaf, tree; // Find the existing leaf for the new point, or add it. - - while (node.length) { - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;else y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; - } // Is the new point is exactly coincident with the existing point? - - - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; // Otherwise, split the leaf node until the old and new point are separated. - - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;else y1 = ym; - } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); - - return parent[j] = node, parent[i] = leaf, tree; - } - - function addAll(data) { - var d, - i, - n = data.length, - x, - y, - xz = new Array(n), - yz = new Array(n), - x0 = Infinity, - y0 = Infinity, - x1 = -Infinity, - y1 = -Infinity; // Compute the points and their extent. - - for (i = 0; i < n; ++i) { - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; - xz[i] = x; - yz[i] = y; - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = 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 = 0; i < n; ++i) { - add$4(this, xz[i], yz[i], data[i]); - } - - return this; - } - - function tree_cover(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points - - var x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = 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’t change due to floating point error! - - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; - } // Otherwise, double repeatedly to cover. - else { - var z = x1 - x0, - node = this._root, - parent, - i; - - while (x0 > x || x >= x1 || y0 > y || y >= y1) { - i = (y < y0) << 1 | x < x0; - parent = new Array(4), parent[i] = node, node = parent, z *= 2; - - switch (i) { - case 0: - x1 = x0 + z, y1 = y0 + z; - break; - - case 1: - x0 = x1 - z, y1 = y0 + z; - break; - - case 2: - x1 = x0 + z, y0 = y1 - z; - break; - - case 3: - x0 = x1 - z, y0 = y1 - z; - break; - } - } - - if (this._root && this._root.length) this._root = node; - } - - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; - } - - function tree_data() { - var data = []; - this.visit(function (node) { - if (!node.length) do { - data.push(node.data); - } while (node = 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, this._y1]]; - } - - function Quad(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - } - - function tree_find(x, y, radius) { - var data, - x0 = this._x0, - y0 = this._y0, - x1, - y1, - x2, - y2, - x3 = this._x1, - y3 = this._y1, - quads = [], - node = this._root, - q, - i; - if (node) quads.push(new Quad(node, x0, y0, x3, y3)); - if (radius == null) radius = Infinity;else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; - } - - while (q = quads.pop()) { - // Stop searching if this quadrant can’t contain a closer node. - if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) continue; // Bisect the current quadrant. - - if (node.length) { - var xm = (x1 + x2) / 2, - ym = (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 = (y >= ym) << 1 | x >= xm) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; - } - } // Visit this point. (Visiting coincident points isn’t necessary!) - else { - var dx = x - +this._x.call(null, node.data), - dy = y - +this._y.call(null, node.data), - d2 = dx * dx + dy * dy; - - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } - } - - return data; - } - - function tree_remove(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points - - var parent, - node = this._root, - retainer, - previous, - next, - x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = 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 sibling. - - if (node.length) while (true) { - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;else y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) return this; - if (!node.length) break; - if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; - } // Find the point to remove. - - while (node.data !== d) { - if (!(previous = node, node = node.next)) return this; - } - - if (next = node.next) delete node.next; // If there are multiple coincident points, remove just the point. - - if (previous) return next ? previous.next = next : delete previous.next, this; // If this is the root point, remove it. - - if (!parent) return this._root = next, this; // Remove this leaf. - - next ? parent[i] = next : delete parent[i]; // If the parent now contains exactly one leaf, collapse superfluous parents. - - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { - if (retainer) retainer[j] = node;else this._root = node; - } - - return this; - } - - function removeAll(data) { - for (var i = 0, n = data.length; i < n; ++i) { - this.remove(data[i]); - } - - return this; - } - - function tree_root() { - return this._root; - } - - function tree_size() { - var size = 0; - this.visit(function (node) { - if (!node.length) do { - ++size; - } while (node = node.next); - }); - return size; - } - - function tree_visit(callback) { - var quads = [], - q, - node = this._root, - child, - x0, - y0, - x1, - y1; - if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); - - while (q = quads.pop()) { - if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, - ym = (y0 + y1) / 2; - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); - } - } - - return this; - } - - function tree_visitAfter(callback) { - var quads = [], - next = [], - q; - if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); - - while (q = quads.pop()) { - var node = q.node; - - if (node.length) { - var child, - x0 = q.x0, - y0 = q.y0, - x1 = q.x1, - y1 = q.y1, - xm = (x0 + x1) / 2, - ym = (y0 + y1) / 2; - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); - } - - next.push(q); - } - - while (q = next.pop()) { - callback(q.node, q.x0, q.y0, q.x1, q.y1); - } - - return this; - } - - function defaultX(d) { - return d[0]; - } - - function tree_x(_) { - return arguments.length ? (this._x = _, this) : this._x; - } - - function defaultY(d) { - return d[1]; - } - - function tree_y(_) { - return arguments.length ? (this._y = _, this) : this._y; - } - - function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); - } - - function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = undefined; - } - - function leaf_copy(leaf) { - var copy = { - data: leaf.data - }, - next = copy; - - while (leaf = leaf.next) { - next = next.next = { - data: leaf.data - }; - } - - return copy; - } - - var treeProto = quadtree.prototype = Quadtree.prototype; - - treeProto.copy = function () { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), - node = this._root, - nodes, - child; - if (!node) return copy; - if (!node.length) return copy._root = leaf_copy(node), copy; - nodes = [{ - source: node, - target: copy._root = new Array(4) - }]; - - while (node = nodes.pop()) { - for (var i = 0; i < 4; ++i) { - if (child = node.source[i]) { - if (child.length) nodes.push({ - source: child, - target: node.target[i] = new Array(4) - });else node.target[i] = leaf_copy(child); - } - } - } - - return copy; - }; - - treeProto.add = tree_add; - treeProto.addAll = addAll; - treeProto.cover = tree_cover; - treeProto.data = tree_data; - treeProto.extent = tree_extent; - treeProto.find = tree_find; - treeProto.remove = tree_remove; - treeProto.removeAll = removeAll; - treeProto.root = tree_root; - treeProto.size = tree_size; - treeProto.visit = tree_visit; - treeProto.visitAfter = tree_visitAfter; - treeProto.x = tree_x; - treeProto.y = tree_y; - - function constant$4(x) { - return function () { - return x; - }; - } - - function jiggle() { - return (Math.random() - 0.5) * 1e-6; - } - - function x$2(d) { - return d.x + d.vx; - } - - function y$2(d) { - return d.y + d.vy; - } - - function forceCollide(radius) { - var nodes, - radii, - strength = 1, - iterations = 1; - if (typeof radius !== "function") radius = constant$4(radius == null ? 1 : +radius); - - function force() { - var i, - n = nodes.length, - tree, - node, - xi, - yi, - ri, - ri2; - - for (var k = 0; k < iterations; ++k) { - tree = quadtree(nodes, x$2, y$2).visitAfter(prepare); - - for (i = 0; i < n; ++i) { - node = nodes[i]; - ri = radii[node.index], ri2 = ri * ri; - xi = node.x + node.vx; - yi = node.y + node.vy; - tree.visit(apply); - } - } - - function apply(quad, x0, y0, x1, y1) { - var data = quad.data, - rj = quad.r, - r = ri + rj; - - if (data) { - if (data.index > node.index) { - var x = xi - data.x - data.vx, - y = yi - data.y - data.vy, - l = x * x + y * y; - - if (l < r * r) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y *= l) * r; - data.vx -= x * (r = 1 - r); - data.vy -= 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 = radii[quad.data.index]; - - for (var i = quad.r = 0; i < 4; ++i) { - if (quad[i] && quad[i].r > quad.r) { - quad.r = quad[i].r; - } - } - } - - function initialize() { - if (!nodes) return; - var i, - n = nodes.length, - node; - radii = new Array(n); - - for (i = 0; i < n; ++i) { - node = nodes[i], radii[node.index] = +radius(node, i, nodes); - } - } - - force.initialize = function (_) { - nodes = _; - initialize(); - }; - - force.iterations = function (_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - - force.strength = function (_) { - return arguments.length ? (strength = +_, force) : strength; - }; - - force.radius = function (_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : radius; - }; - - return force; - } - - function index(d) { - return d.index; - } - - function find$1(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) throw new Error("missing: " + nodeId); - return node; - } - - function forceLink(links) { - var id = index, - strength = defaultStrength, - strengths, - distance = constant$4(30), - distances, - nodes, - count, - bias, - iterations = 1; - if (links == null) links = []; - - function defaultStrength(link) { - return 1 / Math.min(count[link.source.index], count[link.target.index]); - } - - function force(alpha) { - for (var k = 0, n = links.length; k < iterations; ++k) { - for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) { - link = links[i], source = link.source, target = link.target; - x = target.x + target.vx - source.x - source.vx || jiggle(); - y = target.y + target.vy - source.y - source.vy || jiggle(); - l = Math.sqrt(x * x + y * y); - l = (l - distances[i]) / l * alpha * strengths[i]; - x *= l, y *= l; - target.vx -= x * (b = bias[i]); - target.vy -= y * b; - source.vx += x * (b = 1 - b); - source.vy += y * b; - } - } - } - - function initialize() { - if (!nodes) return; - var i, - n = nodes.length, - m = links.length, - nodeById = new Map(nodes.map(function (d, i) { - return [id(d, i, nodes), d]; - })), - link; - - for (i = 0, count = new Array(n); i < m; ++i) { - link = links[i], link.index = i; - if (_typeof(link.source) !== "object") link.source = find$1(nodeById, link.source); - if (_typeof(link.target) !== "object") link.target = find$1(nodeById, link.target); - count[link.source.index] = (count[link.source.index] || 0) + 1; - count[link.target.index] = (count[link.target.index] || 0) + 1; - } - - for (i = 0, bias = new Array(m); i < m; ++i) { - link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); - } - - strengths = new Array(m), initializeStrength(); - distances = new Array(m), initializeDistance(); - } - - function initializeStrength() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - strengths[i] = +strength(links[i], i, links); - } - } - - function initializeDistance() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - distances[i] = +distance(links[i], i, links); - } - } - - force.initialize = function (_) { - nodes = _; - initialize(); - }; - - force.links = function (_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - - force.id = function (_) { - return arguments.length ? (id = _, force) : id; - }; - - force.iterations = function (_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - - force.strength = function (_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant$4(+_), initializeStrength(), force) : strength; - }; - - force.distance = function (_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : constant$4(+_), initializeDistance(), force) : distance; - }; - - return force; - } - - var noop$5 = { - value: function value() {} - }; - - function dispatch() { - for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { - if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); - _[t] = []; - } - - return new Dispatch(_); - } - - function Dispatch(_) { - this._ = _; - } - - function parseTypenames(typenames, types) { - return typenames.trim().split(/^|\s+/).map(function (t) { - var name = "", - i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); - return { - type: t, - name: name - }; - }); - } - - Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function on(typename, callback) { - var _ = this._, - T = parseTypenames(typename + "", _), - t, - i = -1, - n = 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 = (typename = T[i]).type) && (t = get$4(_[t], typename.name))) return t; - } - - return; - } // If a type was specified, set the callback for the given type and name. - // Otherwise, if a null callback was specified, remove callbacks of the given name. - - - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); - - while (++i < n) { - if (t = (typename = T[i]).type) _[t] = set$3(_[t], typename.name, callback);else if (callback == null) for (t in _) { - _[t] = set$3(_[t], typename.name, null); - } - } - - return this; - }, - copy: function copy() { - var copy = {}, - _ = this._; - - for (var t in _) { - copy[t] = _[t].slice(); - } - - return new Dispatch(copy); - }, - call: function call(type, that) { - if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) { - args[i] = arguments[i + 2]; - } - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - - for (t = this._[type], i = 0, n = t.length; i < n; ++i) { - t[i].value.apply(that, args); - } - }, - apply: function apply(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - - for (var t = this._[type], i = 0, n = t.length; i < n; ++i) { - t[i].value.apply(that, args); - } - } - }; - - function get$4(type, name) { - for (var i = 0, n = type.length, c; i < n; ++i) { - if ((c = type[i]).name === name) { - return c.value; - } - } - } - - function set$3(type, name, callback) { - for (var i = 0, n = type.length; i < n; ++i) { - if (type[i].name === name) { - type[i] = noop$5, type = type.slice(0, i).concat(type.slice(i + 1)); - break; - } - } - - if (callback != null) type.push({ - name: name, - value: callback - }); - return type; - } - - var frame = 0, - // is an animation frame pending? - timeout = 0, - // is a timeout pending? - interval = 0, - // are any timers active? - pokeDelay = 1000, - // how frequently we check for clock skew - taskHead, - taskTail, - clockLast = 0, - clockNow = 0, - clockSkew = 0, - clock = (typeof performance === "undefined" ? "undefined" : _typeof(performance)) === "object" && performance.now ? performance : Date, - setFrame = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function (f) { - setTimeout(f, 17); - }; - - function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); - } - - function clearNow() { - clockNow = 0; - } - - function Timer() { - this._call = this._time = this._next = null; - } - - Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function restart(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - - if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this;else taskHead = this; - taskTail = this; - } - - this._call = callback; - this._time = time; - sleep(); - }, - stop: function stop() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); - } - } - }; - - function timer(callback, delay, time) { - var t = new Timer(); - t.restart(callback, delay, time); - return t; - } - - function timerFlush() { - now(); // Get the current time, if not already set. - - ++frame; // Pretend we’ve set an alarm, if we haven’t already. - - var t = taskHead, - e; - - while (t) { - if ((e = clockNow - t._time) >= 0) t._call.call(null, e); - t = t._next; - } - - --frame; - } - - function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - - try { - timerFlush(); - } finally { - frame = 0; - nap(); - clockNow = 0; - } - } - - function poke() { - var now = clock.now(), - delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; - } - - function nap() { - var t0, - t1 = taskHead, - t2, - time = Infinity; - - while (t1) { - if (t1._call) { - if (time > t1._time) time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } - } - - taskTail = t0; - sleep(time); - } - - function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - - if (timeout) timeout = clearTimeout(timeout); - var delay = time - clockNow; // Strictly less than if we recomputed clockNow. - - if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); - } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); - } - } - - function interval$1(callback, delay, time) { - var t = new Timer(), - total = delay; - if (delay == null) return t.restart(callback, delay, time), t; - delay = +delay, time = time == null ? now() : +time; - t.restart(function tick(elapsed) { - elapsed += total; - t.restart(tick, total += delay, time); - callback(elapsed); - }, delay, time); - return t; - } - - function x$3(d) { - return d.x; - } - - function y$3(d) { - return d.y; - } - - var initialRadius = 10, - initialAngle = Math.PI * (3 - Math.sqrt(5)); - - function forceSimulation(_nodes) { - var simulation, - _alpha = 1, - _alphaMin = 0.001, - _alphaDecay = 1 - Math.pow(_alphaMin, 1 / 300), - _alphaTarget = 0, - _velocityDecay = 0.6, - forces = new Map(), - stepper = timer(step), - event = dispatch("tick", "end"); - - if (_nodes == null) _nodes = []; - - function step() { - tick(); - event.call("tick", simulation); - - if (_alpha < _alphaMin) { - stepper.stop(); - event.call("end", simulation); - } - } - - function tick(iterations) { - var i, - n = _nodes.length, - node; - if (iterations === undefined) iterations = 1; - - for (var k = 0; k < iterations; ++k) { - _alpha += (_alphaTarget - _alpha) * _alphaDecay; - forces.forEach(function (force) { - force(_alpha); - }); - - for (i = 0; i < n; ++i) { - node = _nodes[i]; - if (node.fx == null) node.x += node.vx *= _velocityDecay;else node.x = node.fx, node.vx = 0; - if (node.fy == null) node.y += node.vy *= _velocityDecay;else node.y = node.fy, node.vy = 0; - } - } - - return simulation; - } - - function initializeNodes() { - for (var i = 0, n = _nodes.length, node; i < n; ++i) { - node = _nodes[i], node.index = i; - if (node.fx != null) node.x = node.fx; - if (node.fy != null) node.y = node.fy; - - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(i), - angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - - if (isNaN(node.vx) || isNaN(node.vy)) { - node.vx = node.vy = 0; - } - } - } - - function initializeForce(force) { - if (force.initialize) force.initialize(_nodes); - return force; - } - - initializeNodes(); - return simulation = { - tick: tick, - restart: function restart() { - return stepper.restart(step), simulation; - }, - stop: function stop() { - return stepper.stop(), simulation; - }, - nodes: function nodes(_) { - return arguments.length ? (_nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : _nodes; - }, - alpha: function alpha(_) { - return arguments.length ? (_alpha = +_, simulation) : _alpha; - }, - alphaMin: function alphaMin(_) { - return arguments.length ? (_alphaMin = +_, simulation) : _alphaMin; - }, - alphaDecay: function alphaDecay(_) { - return arguments.length ? (_alphaDecay = +_, simulation) : +_alphaDecay; - }, - alphaTarget: function alphaTarget(_) { - return arguments.length ? (_alphaTarget = +_, simulation) : _alphaTarget; - }, - velocityDecay: function velocityDecay(_) { - return arguments.length ? (_velocityDecay = 1 - _, simulation) : 1 - _velocityDecay; - }, - force: function force(name, _) { - return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name); - }, - find: function find(x, y, radius) { - var i = 0, - n = _nodes.length, - dx, - dy, - d2, - node, - closest; - if (radius == null) radius = Infinity;else radius *= radius; - - for (i = 0; i < n; ++i) { - node = _nodes[i]; - dx = x - node.x; - dy = y - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) closest = node, radius = d2; - } - - return closest; - }, - on: function on(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); - } - }; - } - - function forceManyBody() { - var nodes, - node, - alpha, - strength = constant$4(-30), - strengths, - distanceMin2 = 1, - distanceMax2 = Infinity, - theta2 = 0.81; - - function force(_) { - var i, - n = nodes.length, - tree = quadtree(nodes, x$3, y$3).visitAfter(accumulate); - - for (alpha = _, i = 0; i < n; ++i) { - node = nodes[i], tree.visit(apply); - } - } - - function initialize() { - if (!nodes) return; - var i, - n = nodes.length, - node; - strengths = new Array(n); - - for (i = 0; i < n; ++i) { - node = nodes[i], strengths[node.index] = +strength(node, i, nodes); - } - } - - function accumulate(quad) { - var strength = 0, - q, - c, - weight = 0, - x, - y, - i; // For internal nodes, accumulate forces from child quadrants. - - if (quad.length) { - for (x = y = i = 0; i < 4; ++i) { - if ((q = quad[i]) && (c = Math.abs(q.value))) { - strength += q.value, weight += c, x += c * q.x, y += c * q.y; - } - } - - quad.x = x / weight; - quad.y = y / weight; - } // For leaf nodes, accumulate forces from coincident quadrants. - else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - - do { - strength += strengths[q.data.index]; - } while (q = q.next); - } - - quad.value = strength; - } - - function apply(quad, x1, _, x2) { - if (!quad.value) return true; - var x = quad.x - node.x, - y = quad.y - node.y, - w = x2 - x1, - l = 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 === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - node.vx += x * quad.value * alpha / l; - node.vy += y * quad.value * alpha / l; - } - - return true; - } // Otherwise, process points directly. - else if (quad.length || l >= distanceMax2) return; // Limit forces for very close nodes; randomize direction if coincident. - - - if (quad.data !== node || quad.next) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - } - - do { - if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x * w; - node.vy += y * w; - } - } while (quad = quad.next); - } - - force.initialize = function (_) { - nodes = _; - initialize(); - }; - - force.strength = function (_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : strength; - }; - - force.distanceMin = function (_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - - force.distanceMax = function (_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - - force.theta = function (_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); - }; - - return force; - } - - function forceX(x) { - var strength = constant$4(0.1), - nodes, - strengths, - xz; - if (typeof x !== "function") x = constant$4(x == null ? 0 : +x); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; - } - } - - function initialize() { - if (!nodes) return; - var i, - n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function (_) { - nodes = _; - initialize(); - }; - - force.strength = function (_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : strength; - }; - - force.x = function (_) { - return arguments.length ? (x = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : x; - }; - - return force; - } - - function forceY(y) { - var strength = constant$4(0.1), - nodes, - strengths, - yz; - if (typeof y !== "function") y = constant$4(y == null ? 0 : +y); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; - } - } - - function initialize() { - if (!nodes) return; - var i, - n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function (_) { - nodes = _; - initialize(); - }; - - force.strength = function (_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : strength; - }; - - force.y = function (_) { - return arguments.length ? (y = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : y; - }; - - return force; - } - - var ForceMap = { - center: forceCenter, - collide: forceCollide, - nbody: forceManyBody, - link: forceLink, - x: forceX, - y: forceY - }; - var Forces = 'forces', - ForceParams = ['alpha', 'alphaMin', 'alphaTarget', 'velocityDecay', 'forces'], - ForceConfig = ['static', 'iterations'], - ForceOutput = ['x', 'y', 'vx', 'vy']; - /** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.forces - The forces to apply. - */ - - function Force(params) { - Transform.call(this, null, params); - } - - Force.Definition = { - 'type': 'Force', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'static', - 'type': 'boolean', - 'default': false - }, { - 'name': 'restart', - 'type': 'boolean', - 'default': false - }, { - 'name': 'iterations', - 'type': 'number', - 'default': 300 - }, { - 'name': 'alpha', - 'type': 'number', - 'default': 1 - }, { - 'name': 'alphaMin', - 'type': 'number', - 'default': 0.001 - }, { - 'name': 'alphaTarget', - 'type': 'number', - 'default': 0 - }, { - 'name': 'velocityDecay', - 'type': 'number', - 'default': 0.4 - }, { - 'name': 'forces', - 'type': 'param', - 'array': true, - 'params': [{ - 'key': { - 'force': 'center' - }, - 'params': [{ - 'name': 'x', - 'type': 'number', - 'default': 0 - }, { - 'name': 'y', - 'type': 'number', - 'default': 0 - }] - }, { - 'key': { - 'force': 'collide' - }, - 'params': [{ - 'name': 'radius', - 'type': 'number', - 'expr': true - }, { - 'name': 'strength', - 'type': 'number', - 'default': 0.7 - }, { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'force': 'nbody' - }, - 'params': [{ - 'name': 'strength', - 'type': 'number', - 'default': -30 - }, { - 'name': 'theta', - 'type': 'number', - 'default': 0.9 - }, { - 'name': 'distanceMin', - 'type': 'number', - 'default': 1 - }, { - 'name': 'distanceMax', - 'type': 'number' - }] - }, { - 'key': { - 'force': 'link' - }, - 'params': [{ - 'name': 'links', - 'type': 'data' - }, { - 'name': 'id', - 'type': 'field' - }, { - 'name': 'distance', - 'type': 'number', - 'default': 30, - 'expr': true - }, { - 'name': 'strength', - 'type': 'number', - 'expr': true - }, { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - }] - }, { - 'key': { - 'force': 'x' - }, - 'params': [{ - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, { - 'name': 'x', - 'type': 'field' - }] - }, { - 'key': { - 'force': 'y' - }, - 'params': [{ - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, { - 'name': 'y', - 'type': 'field' - }] - }] - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'modify': false, - 'default': ForceOutput - }] - }; - var prototype$1d = inherits(Force, Transform); - - prototype$1d.transform = function (_, pulse) { - var sim = this.value, - change = pulse.changed(pulse.ADD_REM), - params = _.modified(ForceParams), - iters = _.iterations || 300; // configure simulation - - - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - - pulse.modifies('index'); - } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - - if (params || pulse.changed(pulse.MOD)) { - setup(sim, _, 0, pulse); - } - } // run simulation - - - if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - - if (_.static) { - for (sim.stop(); --iters >= 0;) { - sim.tick(); - } - } else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } - } - - return this.finish(_, pulse); - }; - - prototype$1d.finish = function (_, pulse) { - var dataflow = pulse.dataflow; // inspect dependencies, touch link source data - - for (var args = this._argops, j = 0, m = args.length, arg; j < m; ++j) { - arg = args[j]; - - if (arg.name !== Forces || arg.op._argval.force !== 'link') { - continue; - } - - for (var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i) { - if (ops[i].name === 'links' && (op = ops[i].op.source)) { - dataflow.pulse(op, dataflow.changeset().reflow()); - break; - } - } - } // reflow all nodes - - - return pulse.reflow(_.modified()).modifies(ForceOutput); - }; - - function rerun(df, op) { - return function () { - df.touch(op).run(); - }; - } - - function simulation(nodes, _) { - var sim = forceSimulation(nodes), - stopped = false, - stop = sim.stop, - restart = sim.restart; - - sim.stopped = function () { - return stopped; - }; - - sim.restart = function () { - stopped = false; - return restart(); - }; - - sim.stop = function () { - stopped = true; - return stop(); - }; - - return setup(sim, _, true).on('end', function () { - stopped = true; - }); - } - - function setup(sim, _, init, pulse) { - var f = array(_.forces), - i, - n, - p, - name; - - for (i = 0, n = ForceParams.length; i < n; ++i) { - p = ForceParams[i]; - if (p !== Forces && _.modified(p)) sim[p](_[p]); - } - - for (i = 0, n = f.length; i < n; ++i) { - name = Forces + i; - p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null; - if (p) sim.force(name, p); - } - - for (n = sim.numForces || 0; i < n; ++i) { - sim.force(Forces + i, null); // remove - } - - sim.numForces = f.length; - return sim; - } - - function modified(f, pulse) { - var k, v; - - for (k in f) { - if (isFunction(v = f[k]) && pulse.modified(accessorFields(v))) return 1; - } - - return 0; - } - - function getForce(_) { - var f, p; - - if (!hasOwnProperty(ForceMap, _.force)) { - error('Unrecognized force: ' + _.force); - } - - f = ForceMap[_.force](); - - for (p in _) { - if (isFunction(f[p])) setForceParam(f[p], _[p], _); - } - - return f; - } - - function setForceParam(f, v, _) { - f(isFunction(v) ? function (d) { - return v(d, _); - } : v); - } - - var force = /*#__PURE__*/Object.freeze({ - __proto__: null, - force: Force - }); // Build lookup table mapping tuple keys to tree node instances - - function lookup$3(tree, key, filter) { - var map = {}; - tree.each(function (node) { - var t = node.data; - if (filter(t)) map[key(t)] = node; - }); - tree.lookup = map; - return tree; - } - - function defaultSeparation(a, b) { - return a.parent === 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 = node.children) { - node = children[0]; - } - - return node; - } - - function leafRight(node) { - var children; - - while (children = node.children) { - node = children[children.length - 1]; - } - - return node; - } - - function cluster() { - var separation = defaultSeparation, - dx = 1, - dy = 1, - nodeSize = false; - - function cluster(root) { - var previousNode, - x = 0; // First walk, computing the initial x & y values. - - root.eachAfter(function (node) { - var children = node.children; - - if (children) { - node.x = meanX(children); - node.y = maxY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - var left = leafLeft(root), - right = leafRight(root), - x0 = left.x - separation(left, right) / 2, - x1 = right.x + separation(right, left) / 2; // Second walk, normalizing x & y to the desired size. - - return root.eachAfter(nodeSize ? function (node) { - node.x = (node.x - root.x) * dx; - node.y = (root.y - node.y) * dy; - } : function (node) { - node.x = (node.x - x0) / (x1 - x0) * dx; - node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; - }); - } - - cluster.separation = function (x) { - return arguments.length ? (separation = x, cluster) : separation; - }; - - cluster.size = function (x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : nodeSize ? null : [dx, dy]; - }; - - cluster.nodeSize = function (x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : nodeSize ? [dx, dy] : null; - }; - - return cluster; - } - - function count(node) { - var sum = 0, - children = node.children, - i = children && children.length; - if (!i) sum = 1;else while (--i >= 0) { - sum += children[i].value; - } - node.value = sum; - } - - function node_count() { - return this.eachAfter(count); - } - - function node_each(callback) { - var node = this, - current, - next = [node], - children, - i, - n; - - do { - current = next.reverse(), next = []; - - while (node = current.pop()) { - callback(node), children = node.children; - if (children) for (i = 0, n = children.length; i < n; ++i) { - next.push(children[i]); - } - } - } while (next.length); - - return this; - } - - function node_eachBefore(callback) { - var node = this, - nodes = [node], - children, - i; - - while (node = nodes.pop()) { - callback(node), children = node.children; - if (children) for (i = children.length - 1; i >= 0; --i) { - nodes.push(children[i]); - } - } - - return this; - } - - function node_eachAfter(callback) { - var node = this, - nodes = [node], - next = [], - children, - i, - n; - - while (node = nodes.pop()) { - next.push(node), children = node.children; - if (children) for (i = 0, n = children.length; i < n; ++i) { - nodes.push(children[i]); - } - } - - while (node = next.pop()) { - callback(node); - } - - return this; - } - - function node_sum(value) { - return this.eachAfter(function (node) { - var sum = +value(node.data) || 0, - children = node.children, - i = children && children.length; - - while (--i >= 0) { - sum += children[i].value; - } - - node.value = sum; - }); - } - - function node_sort(compare) { - return this.eachBefore(function (node) { - if (node.children) { - node.children.sort(compare); - } - }); - } - - function node_path(end) { - var start = this, - ancestor = leastCommonAncestor(start, end), - nodes = [start]; - - while (start !== ancestor) { - start = start.parent; - nodes.push(start); - } - - var k = nodes.length; - - while (end !== ancestor) { - nodes.splice(k, 0, end); - end = end.parent; - } - - return nodes; - } - - function leastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = a.ancestors(), - bNodes = b.ancestors(), - c = null; - a = aNodes.pop(); - b = bNodes.pop(); - - while (a === b) { - c = a; - a = aNodes.pop(); - b = bNodes.pop(); - } - - return c; - } - - function node_ancestors() { - var node = this, - nodes = [node]; - - while (node = node.parent) { - nodes.push(node); - } - - return nodes; - } - - function node_descendants() { - var nodes = []; - this.each(function (node) { - nodes.push(node); - }); - return nodes; - } - - function node_leaves() { - var leaves = []; - this.eachBefore(function (node) { - if (!node.children) { - leaves.push(node); - } - }); - return leaves; - } - - function node_links() { - var root = this, - links = []; - root.each(function (node) { - if (node !== root) { - // Don’t include the root’s parent, if any. - links.push({ - source: node.parent, - target: node - }); - } - }); - return links; - } - - function hierarchy(data, children) { - var root = new Node(data), - valued = +data.value && (root.value = data.value), - node, - nodes = [root], - child, - childs, - i, - n; - if (children == null) children = defaultChildren; - - while (node = nodes.pop()) { - if (valued) node.value = +node.data.value; - - if ((childs = children(node.data)) && (n = childs.length)) { - node.children = new Array(n); - - for (i = n - 1; i >= 0; --i) { - nodes.push(child = node.children[i] = new Node(childs[i])); - child.parent = node; - child.depth = 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 = node.data.data; - } - - function computeHeight(node) { - var height = 0; - - do { - node.height = height; - } while ((node = node.parent) && node.height < ++height); - } - - function Node(data) { - this.data = data; - this.depth = this.height = 0; - this.parent = null; - } - - Node.prototype = hierarchy.prototype = { - 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$1 = Array.prototype.slice; - - function shuffle(array) { - var m = array.length, - t, - i; - - while (m) { - i = Math.random() * m-- | 0; - t = array[m]; - array[m] = array[i]; - array[i] = t; - } - - return array; - } - - function enclose(circles) { - var i = 0, - n = (circles = shuffle(slice$1.call(circles))).length, - B = [], - p, - e; - - while (i < n) { - p = circles[i]; - if (e && enclosesWeak(e, p)) ++i;else e = encloseBasis(B = extendBasis(B, p)), i = 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 = 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 = 0; i < B.length - 1; ++i) { - for (j = 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 = a.r - b.r, - dx = b.x - a.x, - dy = b.y - a.y; - return dr < 0 || dr * dr < dx * dx + dy * dy; - } - - function enclosesWeak(a, b) { - var dr = a.r - b.r + 1e-6, - dx = b.x - a.x, - dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; - } - - function enclosesWeakAll(a, B) { - for (var i = 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 = a.x, - y1 = a.y, - r1 = a.r, - x2 = b.x, - y2 = b.y, - r2 = b.r, - x21 = x2 - x1, - y21 = y2 - y1, - r21 = r2 - r1, - l = 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 = a.x, - y1 = a.y, - r1 = a.r, - x2 = b.x, - y2 = b.y, - r2 = b.r, - x3 = c.x, - y3 = c.y, - r3 = c.r, - a2 = x1 - x2, - a3 = x1 - x3, - b2 = y1 - y2, - b3 = y1 - y3, - c2 = r2 - r1, - c3 = r3 - r1, - d1 = x1 * x1 + y1 * y1 - r1 * r1, - d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, - d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, - ab = a3 * b2 - a2 * b3, - xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, - xb = (b3 * c2 - b2 * c3) / ab, - ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, - yb = (a2 * c3 - a3 * c2) / ab, - A = xb * xb + yb * yb - 1, - B = 2 * (r1 + xa * xb + ya * yb), - C = xa * xa + ya * ya - r1 * r1, - r = -(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 = b.x - a.x, - x, - a2, - dy = b.y - a.y, - y, - b2, - d2 = dx * dx + dy * dy; - - if (d2) { - a2 = a.r + c.r, a2 *= a2; - b2 = b.r + c.r, b2 *= b2; - - if (a2 > b2) { - x = (d2 + b2 - a2) / (2 * d2); - y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); - c.x = b.x - x * dx - y * dy; - c.y = b.y - x * dy + y * dx; - } else { - x = (d2 + a2 - b2) / (2 * d2); - y = Math.sqrt(Math.max(0, a2 / d2 - x * x)); - c.x = a.x + x * dx - y * dy; - c.y = a.y + x * dy + y * dx; - } - } else { - c.x = a.x + c.r; - c.y = a.y; - } - } - - function intersects(a, b) { - var dr = a.r + b.r - 1e-6, - dx = b.x - a.x, - dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; - } - - function score(node) { - var a = node._, - b = node.next._, - ab = a.r + b.r, - dx = (a.x * b.r + b.x * a.r) / ab, - dy = (a.y * b.r + b.y * a.r) / ab; - return dx * dx + dy * dy; - } - - function Node$1(circle) { - this._ = circle; - this.next = null; - this.previous = null; - } - - function packEnclose(circles) { - if (!(n = circles.length)) return 0; - var a, b, c, n, aa, ca, i, j, k, sj, sk; // Place the first circle. - - a = circles[0], a.x = 0, a.y = 0; - if (!(n > 1)) return a.r; // Place the second circle. - - b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; - if (!(n > 2)) return a.r + b.r; // Place the third circle. - - place(b, a, c = circles[2]); // Initialize the front-chain using the first three circles a, b and c. - - a = new Node$1(a), b = new Node$1(b), c = new Node$1(c); - a.next = c.previous = b; - b.next = a.previous = c; - c.next = b.previous = a; // Attempt to place each remaining circle… - - pack: for (i = 3; i < n; ++i) { - place(a._, b._, c = circles[i]), c = new Node$1(c); // Find the closest intersecting circle on the front-chain, if any. - // “Closeness” is determined by linear distance along the front-chain. - // “Ahead” or “behind” is likewise determined by linear distance. - - j = b.next, k = a.previous, sj = b._.r, sk = a._.r; - - do { - if (sj <= sk) { - if (intersects(j._, c._)) { - b = j, a.next = b, b.previous = a, --i; - continue pack; - } - - sj += j._.r, j = j.next; - } else { - if (intersects(k._, c._)) { - a = k, a.next = b, b.previous = a, --i; - continue pack; - } - - sk += k._.r, k = k.previous; - } - } while (j !== k.next); // Success! Insert the new circle c between a and b. - - - c.previous = a, c.next = b, a.next = b.previous = b = c; // Compute the new closest circle pair to the centroid. - - aa = score(a); - - while ((c = c.next) !== b) { - if ((ca = score(c)) < aa) { - a = c, aa = ca; - } - } - - b = a.next; - } // Compute the enclosing circle of the front chain. - - - a = [b._], c = b; - - while ((c = c.next) !== b) { - a.push(c._); - } - - c = enclose(a); // Translate the circles to put the enclosing circle around the origin. - - for (i = 0; i < n; ++i) { - a = circles[i], a.x -= c.x, a.y -= c.y; - } - - return c.r; - } - - function optional(f) { - return f == null ? null : required(f); - } - - function required(f) { - if (typeof f !== "function") throw new Error(); - return f; - } - - function constantZero() { - return 0; - } - - function constant$5(x) { - return function () { - return x; - }; - } - - function defaultRadius(d) { - return Math.sqrt(d.value); - } - - function pack() { - var radius = null, - dx = 1, - dy = 1, - padding = constantZero; - - function pack(root) { - root.x = dx / 2, root.y = dy / 2; - - if (radius) { - root.eachBefore(radiusLeaf(radius)).eachAfter(packChildren(padding, 0.5)).eachBefore(translateChild(1)); - } else { - root.eachBefore(radiusLeaf(defaultRadius)).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 = function (x) { - return arguments.length ? (radius = optional(x), pack) : radius; - }; - - pack.size = function (x) { - return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy]; - }; - - pack.padding = function (x) { - return arguments.length ? (padding = typeof x === "function" ? x : constant$5(+x), pack) : padding; - }; - - return pack; - } - - function radiusLeaf(radius) { - return function (node) { - if (!node.children) { - node.r = Math.max(0, +radius(node) || 0); - } - }; - } - - function packChildren(padding, k) { - return function (node) { - if (children = node.children) { - var children, - i, - n = children.length, - r = padding(node) * k || 0, - e; - if (r) for (i = 0; i < n; ++i) { - children[i].r += r; - } - e = packEnclose(children); - if (r) for (i = 0; i < n; ++i) { - children[i].r -= r; - } - node.r = e + r; - } - }; - } - - function translateChild(k) { - return function (node) { - var parent = node.parent; - node.r *= k; - - if (parent) { - node.x = parent.x + k * node.x; - node.y = parent.y + k * node.y; - } - }; - } - - function roundNode(node) { - node.x0 = Math.round(node.x0); - node.y0 = Math.round(node.y0); - node.x1 = Math.round(node.x1); - node.y1 = Math.round(node.y1); - } - - function treemapDice(parent, x0, y0, x1, y1) { - var nodes = parent.children, - node, - i = -1, - n = nodes.length, - k = parent.value && (x1 - x0) / parent.value; - - while (++i < n) { - node = nodes[i], node.y0 = y0, node.y1 = y1; - node.x0 = x0, node.x1 = x0 += node.value * k; - } - } - - function partition$4() { - var dx = 1, - dy = 1, - padding = 0, - round = false; - - function partition(root) { - var n = root.height + 1; - root.x0 = root.y0 = padding; - root.x1 = dx; - root.y1 = 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 = node.x0, - y0 = node.y0, - x1 = node.x1 - padding, - y1 = node.y1 - padding; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - }; - } - - partition.round = function (x) { - return arguments.length ? (round = !!x, partition) : round; - }; - - partition.size = function (x) { - return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy]; - }; - - partition.padding = function (x) { - return arguments.length ? (padding = +x, partition) : padding; - }; - - return partition; - } - - var keyPrefix = "$", - // Protect against keys like “__proto__”. - preroot = { - depth: -1 - }, - ambiguous = {}; - - function defaultId(d) { - return d.id; - } - - function defaultParentId(d) { - return d.parentId; - } - - function stratify() { - var id = defaultId, - parentId = defaultParentId; - - function stratify(data) { - var d, - i, - n = data.length, - root, - parent, - node, - nodes = new Array(n), - nodeId, - nodeKey, - nodeByKey = {}; - - for (i = 0; i < n; ++i) { - d = data[i], node = nodes[i] = new Node(d); - - if ((nodeId = id(d, i, data)) != null && (nodeId += "")) { - nodeKey = keyPrefix + (node.id = nodeId); - nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node; - } - } - - for (i = 0; i < n; ++i) { - node = nodes[i], nodeId = parentId(data[i], i, data); - - if (nodeId == null || !(nodeId += "")) { - if (root) throw new Error("multiple roots"); - root = node; - } else { - parent = nodeByKey[keyPrefix + nodeId]; - if (!parent) throw new Error("missing: " + nodeId); - if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); - if (parent.children) parent.children.push(node);else parent.children = [node]; - node.parent = parent; - } - } - - if (!root) throw new Error("no root"); - root.parent = preroot; - root.eachBefore(function (node) { - node.depth = node.parent.depth + 1; - --n; - }).eachBefore(computeHeight); - root.parent = null; - if (n > 0) throw new Error("cycle"); - return root; - } - - stratify.id = function (x) { - return arguments.length ? (id = required(x), stratify) : id; - }; - - stratify.parentId = function (x) { - return arguments.length ? (parentId = required(x), stratify) : parentId; - }; - - return stratify; - } - - function defaultSeparation$1(a, b) { - return a.parent === b.parent ? 1 : 2; - } // function radialSeparation(a, b) { - // return (a.parent === 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 successor is - // either given by the leftmost child of v or by the thread of v. The function - // returns null if and only if v is on the highest level of its subtree. - - - function nextLeft(v) { - var children = v.children; - return children ? children[0] : v.t; - } // This function works analogously to nextLeft. - - - function nextRight(v) { - var children = 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 = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.m += 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 = 0, - change = 0, - children = v.children, - i = children.length, - w; - - while (--i >= 0) { - w = children[i]; - w.z += shift; - w.m += shift; - shift += w.s + (change += w.c); - } - } // If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, - // returns the specified (default) ancestor. - - - function nextAncestor(vim, v, ancestor) { - return vim.a.parent === v.parent ? vim.a : ancestor; - } - - function TreeNode(node, i) { - this._ = node; - this.parent = null; - this.children = null; - this.A = null; // default ancestor - - this.a = this; // ancestor - - this.z = 0; // prelim - - this.m = 0; // mod - - this.c = 0; // change - - this.s = 0; // shift - - this.t = null; // thread - - this.i = i; // number - } - - TreeNode.prototype = Object.create(Node.prototype); - - function treeRoot(root) { - var tree = new TreeNode(root, 0), - node, - nodes = [tree], - child, - children, - i, - n; - - while (node = nodes.pop()) { - if (children = node._.children) { - node.children = new Array(n = children.length); - - for (i = n - 1; i >= 0; --i) { - nodes.push(child = node.children[i] = new TreeNode(children[i], i)); - child.parent = node; - } - } - } - - (tree.parent = new TreeNode(null, 0)).children = [tree]; - return tree; - } // Node-link tree diagram using the Reingold-Tilford "tidy" algorithm - - - function tree() { - var separation = defaultSeparation$1, - dx = 1, - dy = 1, - nodeSize = null; - - function tree(root) { - var t = treeRoot(root); // Compute the layout using Buchheim et al.’s algorithm. - - t.eachAfter(firstWalk), t.parent.m = -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 = root, - right = root, - bottom = root; - root.eachBefore(function (node) { - if (node.x < left.x) left = node; - if (node.x > right.x) right = node; - if (node.depth > bottom.depth) bottom = node; - }); - var s = left === right ? 1 : separation(left, right) / 2, - tx = s - left.x, - kx = dx / (right.x + s + tx), - ky = dy / (bottom.depth || 1); - root.eachBefore(function (node) { - node.x = (node.x + tx) * kx; - node.y = 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, the - // node v is placed to the midpoint of its outermost children. - - - function firstWalk(v) { - var children = v.children, - siblings = v.parent.children, - w = v.i ? siblings[v.i - 1] : null; - - if (children) { - executeShifts(v); - var midpoint = (children[0].z + children[children.length - 1].z) / 2; - - if (w) { - v.z = w.z + separation(v._, w._); - v.m = v.z - midpoint; - } else { - v.z = midpoint; - } - } else if (w) { - v.z = w.z + separation(v._, w._); - } - - v.parent.A = apportion(v, w, v.parent.A || siblings[0]); - } // Computes all real x-coordinates by summing up the modifiers recursively. - - - function secondWalk(v) { - v._.x = v.z + v.parent.m; - v.m += 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 subtrees. - // Finally, we add a new thread (if necessary). - - - function apportion(v, w, ancestor) { - if (w) { - var vip = v, - vop = v, - vim = w, - vom = vip.parent.children[0], - sip = vip.m, - sop = vop.m, - sim = vim.m, - som = vom.m, - shift; - - while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { - vom = nextLeft(vom); - vop = nextRight(vop); - vop.a = v; - shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); - - if (shift > 0) { - moveSubtree(nextAncestor(vim, v, ancestor), v, shift); - sip += shift; - sop += shift; - } - - sim += vim.m; - sip += vip.m; - som += vom.m; - sop += vop.m; - } - - if (vim && !nextRight(vop)) { - vop.t = vim; - vop.m += sim - sop; - } - - if (vip && !nextLeft(vom)) { - vom.t = vip; - vom.m += sip - som; - ancestor = v; - } - } - - return ancestor; - } - - function sizeNode(node) { - node.x *= dx; - node.y = node.depth * dy; - } - - tree.separation = function (x) { - return arguments.length ? (separation = x, tree) : separation; - }; - - tree.size = function (x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : nodeSize ? null : [dx, dy]; - }; - - tree.nodeSize = function (x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : nodeSize ? [dx, dy] : null; - }; - - return tree; - } - - function treemapSlice(parent, x0, y0, x1, y1) { - var nodes = parent.children, - node, - i = -1, - n = nodes.length, - k = parent.value && (y1 - y0) / parent.value; - - while (++i < n) { - node = nodes[i], node.x0 = x0, node.x1 = x1; - node.y0 = y0, node.y1 = y0 += node.value * k; - } - } - - var phi = (1 + Math.sqrt(5)) / 2; - - function squarifyRatio(ratio, parent, x0, y0, x1, y1) { - var rows = [], - nodes = parent.children, - row, - nodeValue, - i0 = 0, - i1 = 0, - n = nodes.length, - dx, - dy, - value = parent.value, - sumValue, - minValue, - maxValue, - newRatio, - minRatio, - alpha, - beta; - - while (i0 < n) { - dx = x1 - x0, dy = y1 - y0; // Find the next non-empty node. - - do { - sumValue = nodes[i1++].value; - } while (!sumValue && i1 < n); - - minValue = maxValue = sumValue; - alpha = Math.max(dy / dx, dx / dy) / (value * ratio); - beta = sumValue * sumValue * alpha; - minRatio = Math.max(maxValue / beta, beta / minValue); // Keep adding nodes while the aspect ratio maintains or improves. - - for (; i1 < n; ++i1) { - sumValue += nodeValue = nodes[i1].value; - if (nodeValue < minValue) minValue = nodeValue; - if (nodeValue > maxValue) maxValue = nodeValue; - beta = sumValue * sumValue * alpha; - newRatio = Math.max(maxValue / beta, beta / minValue); - - if (newRatio > minRatio) { - sumValue -= nodeValue; - break; - } - - minRatio = newRatio; - } // Position and record the row orientation. - - - rows.push(row = { - value: sumValue, - dice: dx < dy, - children: nodes.slice(i0, i1) - }); - if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); - value -= sumValue, i0 = i1; - } - - return rows; - } - - var treemapSquarify = function custom(ratio) { - function squarify(parent, x0, y0, x1, y1) { - squarifyRatio(ratio, parent, x0, y0, x1, y1); - } - - squarify.ratio = function (x) { - return custom((x = +x) > 1 ? x : 1); - }; - - return squarify; - }(phi); - - function treemap() { - var tile = treemapSquarify, - round = false, - dx = 1, - dy = 1, - paddingStack = [0], - paddingInner = constantZero, - paddingTop = constantZero, - paddingRight = constantZero, - paddingBottom = constantZero, - paddingLeft = constantZero; - - function treemap(root) { - root.x0 = root.y0 = 0; - root.x1 = dx; - root.y1 = dy; - root.eachBefore(positionNode); - paddingStack = [0]; - if (round) root.eachBefore(roundNode); - return root; - } - - function positionNode(node) { - var p = paddingStack[node.depth], - x0 = node.x0 + p, - y0 = node.y0 + p, - x1 = node.x1 - p, - y1 = node.y1 - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - - if (node.children) { - p = paddingStack[node.depth + 1] = paddingInner(node) / 2; - x0 += paddingLeft(node) - p; - y0 += paddingTop(node) - p; - x1 -= paddingRight(node) - p; - y1 -= paddingBottom(node) - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - tile(node, x0, y0, x1, y1); - } - } - - treemap.round = function (x) { - return arguments.length ? (round = !!x, treemap) : round; - }; - - treemap.size = function (x) { - return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy]; - }; - - treemap.tile = function (x) { - return arguments.length ? (tile = required(x), treemap) : tile; - }; - - treemap.padding = function (x) { - return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); - }; - - treemap.paddingInner = function (x) { - return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$5(+x), treemap) : paddingInner; - }; - - treemap.paddingOuter = function (x) { - return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); - }; - - treemap.paddingTop = function (x) { - return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$5(+x), treemap) : paddingTop; - }; - - treemap.paddingRight = function (x) { - return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$5(+x), treemap) : paddingRight; - }; - - treemap.paddingBottom = function (x) { - return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$5(+x), treemap) : paddingBottom; - }; - - treemap.paddingLeft = function (x) { - return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$5(+x), treemap) : paddingLeft; - }; - - return treemap; - } - - function treemapBinary(parent, x0, y0, x1, y1) { - var nodes = parent.children, - i, - n = nodes.length, - sum, - sums = new Array(n + 1); - - for (sums[0] = sum = i = 0; i < n; ++i) { - sums[i + 1] = sum += nodes[i].value; - } - - partition(0, n, parent.value, x0, y0, x1, y1); - - function partition(i, j, value, x0, y0, x1, y1) { - if (i >= j - 1) { - var node = nodes[i]; - node.x0 = x0, node.y0 = y0; - node.x1 = x1, node.y1 = y1; - return; - } - - var valueOffset = sums[i], - valueTarget = value / 2 + valueOffset, - k = i + 1, - hi = j - 1; - - while (k < hi) { - var mid = k + hi >>> 1; - if (sums[mid] < valueTarget) k = mid + 1;else hi = mid; - } - - if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i + 1 < k) --k; - var valueLeft = sums[k] - valueOffset, - valueRight = value - valueLeft; - - if (x1 - x0 > y1 - y0) { - var xk = (x0 * valueRight + x1 * valueLeft) / value; - partition(i, k, valueLeft, x0, y0, xk, y1); - partition(k, j, valueRight, xk, y0, x1, y1); - } else { - var yk = (y0 * valueRight + y1 * valueLeft) / value; - partition(i, k, valueLeft, x0, y0, x1, yk); - partition(k, j, valueRight, x0, yk, x1, y1); - } - } - } - - function treemapSliceDice(parent, x0, y0, x1, y1) { - (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1); - } - - var treemapResquarify = function custom(ratio) { - function resquarify(parent, x0, y0, x1, y1) { - if ((rows = parent._squarify) && rows.ratio === ratio) { - var rows, - row, - nodes, - i, - j = -1, - n, - m = rows.length, - value = parent.value; - - while (++j < m) { - row = rows[j], nodes = row.children; - - for (i = row.value = 0, n = nodes.length; i < n; ++i) { - row.value += nodes[i].value; - } - - if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value);else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1); - value -= row.value; - } - } else { - parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1); - rows.ratio = ratio; - } - } - - resquarify.ratio = function (x) { - return custom((x = +x) > 1 ? x : 1); - }; - - return resquarify; - }(phi); - /** - * Nest tuples into a tree structure, grouped by key values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ - - - function Nest(params) { - Transform.call(this, null, params); - } - - Nest.Definition = { - 'type': 'Nest', - 'metadata': { - 'treesource': true, - 'changes': true - }, - 'params': [{ - 'name': 'keys', - 'type': 'field', - 'array': true - }, { - 'name': 'generate', - 'type': 'boolean' - }] - }; - var prototype$1e = inherits(Nest, Transform); - - function children(n) { - return n.values; - } - - prototype$1e.transform = function (_, pulse) { - if (!pulse.source) { - error('Nest transform requires an upstream data source.'); - } - - var gen = _.generate, - mod = _.modified(), - out = pulse.clone(), - tree = this.value; - - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) { - tree.each(function (node) { - if (node.children && isTuple(node.data)) { - out.rem.push(node.data); - } - }); - } // generate new tree structure - - - this.value = tree = hierarchy({ - values: array(_.keys).reduce(function (n, k) { - n.key(k); - return n; - }, nest()).entries(out.source) - }, children); // collect nodes to add - - if (gen) { - tree.each(function (node) { - if (node.children) { - node = ingest(node.data); - out.add.push(node); - out.source.push(node); - } - }); - } // build lookup table - - - lookup$3(tree, tupleid, tupleid); - } - - out.source.root = tree; - return out; - }; - - function nest() { - var keys = [], - nest; - - function apply(array, depth) { - if (depth >= keys.length) { - return array; - } - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - value, - valuesByKey = {}, - values, - result = {}; - - while (++i < n) { - keyValue = key(value = array[i]) + ''; - - if (values = valuesByKey[keyValue]) { - values.push(value); - } else { - valuesByKey[keyValue] = [value]; - } - } - - for (keyValue in valuesByKey) { - result[keyValue] = apply(valuesByKey[keyValue], depth); - } - - return result; - } - - function _entries(map, depth) { - if (++depth > keys.length) return map; - var array = [], - k; - - for (k in map) { - array.push({ - key: k, - values: _entries(map[k], depth) - }); - } - - return array; - } - - return nest = { - entries: function entries(array) { - return _entries(apply(array, 0), 0); - }, - key: function key(d) { - keys.push(d); - return nest; - } - }; - } - /** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - - function HierarchyLayout(params) { - Transform.call(this, null, params); - } - - var prototype$1f = inherits(HierarchyLayout, Transform); - - prototype$1f.transform = function (_, pulse) { - if (!pulse.source || !pulse.source.root) { - error(this.constructor.name + ' transform requires a backing tree data source.'); - } - - var layout = this.layout(_.method), - fields = this.fields, - root = pulse.source.root, - as = _.as || fields; - if (_.field) root.sum(_.field);else root.count(); - if (_.sort) root.sort(stableCompare(_.sort, function (d) { - return d.data; - })); - setParams(layout, this.params, _); - - if (layout.separation) { - layout.separation(_.separation !== false ? defaultSeparation$2 : one); - } - - try { - this.value = layout(root); - } catch (err) { - error(err); - } - - root.each(function (node) { - setFields(node, fields, as); - }); - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); - }; - - function setParams(layout, params, _) { - for (var p, i = 0, n = params.length; i < n; ++i) { - p = params[i]; - if (p in _) layout[p](_[p]); - } - } - - function setFields(node, fields, as) { - var t = node.data; - - for (var i = 0, n = fields.length - 1; i < n; ++i) { - t[as[i]] = node[fields[i]]; - } - - t[as[n]] = node.children ? node.children.length : 0; - } - - function defaultSeparation$2(a, b) { - return a.parent === b.parent ? 1 : 2; - } - - var Output$1 = ['x', 'y', 'r', 'depth', 'children']; - /** - * Packed circle tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ - - function Pack(params) { - HierarchyLayout.call(this, params); - } - - Pack.Definition = { - 'type': 'Pack', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, { - 'name': 'radius', - 'type': 'field', - 'default': null - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$1.length, - 'default': Output$1 - }] - }; - var prototype$1g = inherits(Pack, HierarchyLayout); - prototype$1g.layout = pack; - prototype$1g.params = ['radius', 'size', 'padding']; - prototype$1g.fields = Output$1; - var Output$2 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children']; - /** - * Partition tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ - - function Partition(params) { - HierarchyLayout.call(this, params); - } - - Partition.Definition = { - 'type': 'Partition', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$2.length, - 'default': Output$2 - }] - }; - var prototype$1h = inherits(Partition, HierarchyLayout); - prototype$1h.layout = partition$4; - prototype$1h.params = ['size', 'round', 'padding']; - prototype$1h.fields = Output$2; - /** - * Stratify a collection of tuples into a tree structure based on - * id and parent id fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.key - Unique key field for each tuple. - * @param {function(object): *} params.parentKey - Field with key for parent tuple. - */ - - function Stratify(params) { - Transform.call(this, null, params); - } - - Stratify.Definition = { - 'type': 'Stratify', - 'metadata': { - 'treesource': true - }, - 'params': [{ - 'name': 'key', - 'type': 'field', - 'required': true - }, { - 'name': 'parentKey', - 'type': 'field', - 'required': true - }] - }; - var prototype$1i = inherits(Stratify, Transform); - - prototype$1i.transform = function (_, pulse) { - if (!pulse.source) { - error('Stratify transform requires an upstream data source.'); - } - - var tree = this.value, - mod = _.modified(), - out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE), - run = !this.value || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields); // prevent upstream source pollution - - - out.source = out.source.slice(); - - if (run) { - if (out.source.length) { - tree = lookup$3(stratify().id(_.key).parentId(_.parentKey)(out.source), _.key, truthy); - } else { - tree = lookup$3(stratify()([{}]), _.key, _.key); - } - } - - out.source.root = this.value = tree; - return out; - }; - - var Layouts = { - tidy: tree, - cluster: cluster - }; - var Output$3 = ['x', 'y', 'depth', 'children']; - /** - * Tree layout. Depending on the method parameter, performs either - * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - function Tree(params) { - HierarchyLayout.call(this, params); - } - - Tree.Definition = { - 'type': 'Tree', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'method', - 'type': 'enum', - 'default': 'tidy', - 'values': ['tidy', 'cluster'] - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'nodeSize', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'separation', - 'type': 'boolean', - 'default': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$3.length, - 'default': Output$3 - }] - }; - var prototype$1j = inherits(Tree, HierarchyLayout); - /** - * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. - */ - - prototype$1j.layout = function (method) { - var m = method || 'tidy'; - if (hasOwnProperty(Layouts, m)) return Layouts[m]();else error('Unrecognized Tree layout method: ' + m); - }; - - prototype$1j.params = ['size', 'nodeSize']; - prototype$1j.fields = Output$3; - /** - * Generate tuples representing links between tree nodes. - * The resulting tuples will contain 'source' and 'target' fields, - * which point to parent and child node tuples, respectively. - * @constructor - * @param {object} params - The parameters for this operator. - */ - - function TreeLinks(params) { - Transform.call(this, [], params); - } - - TreeLinks.Definition = { - 'type': 'TreeLinks', - 'metadata': { - 'tree': true, - 'generates': true, - 'changes': true - }, - 'params': [] - }; - var prototype$1k = inherits(TreeLinks, Transform); - - prototype$1k.transform = function (_, pulse) { - var links = this.value, - tree = pulse.source && pulse.source.root, - out = pulse.fork(pulse.NO_SOURCE), - lut = {}; - if (!tree) error('TreeLinks transform requires a tree data source.'); - - if (pulse.changed(pulse.ADD_REM)) { - // remove previous links - out.rem = links; // build lookup table of valid tuples - - pulse.visit(pulse.SOURCE, function (t) { - lut[tupleid(t)] = 1; - }); // generate links for all edges incident on valid tuples - - tree.each(function (node) { - var t = node.data, - p = node.parent && node.parent.data; - - if (p && lut[tupleid(t)] && lut[tupleid(p)]) { - out.add.push(ingest({ - source: p, - target: t - })); - } - }); - this.value = out.add; - } else if (pulse.changed(pulse.MOD)) { - // build lookup table of modified tuples - pulse.visit(pulse.MOD, function (t) { - lut[tupleid(t)] = 1; - }); // gather links incident on modified tuples - - links.forEach(function (link) { - if (lut[tupleid(link.source)] || lut[tupleid(link.target)]) { - out.mod.push(link); - } - }); - } - - return out; - }; - - var Tiles = { - binary: treemapBinary, - dice: treemapDice, - slice: treemapSlice, - slicedice: treemapSliceDice, - squarify: treemapSquarify, - resquarify: treemapResquarify - }; - var Output$4 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children']; - /** - * Treemap layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ - - function Treemap(params) { - HierarchyLayout.call(this, params); - } - - Treemap.Definition = { - 'type': 'Treemap', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [{ - 'name': 'field', - 'type': 'field' - }, { - 'name': 'sort', - 'type': 'compare' - }, { - 'name': 'method', - 'type': 'enum', - 'default': 'squarify', - 'values': ['squarify', 'resquarify', 'binary', 'dice', 'slice', 'slicedice'] - }, { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingInner', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingOuter', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingTop', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingRight', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingBottom', - 'type': 'number', - 'default': 0 - }, { - 'name': 'paddingLeft', - 'type': 'number', - 'default': 0 - }, { - 'name': 'ratio', - 'type': 'number', - 'default': 1.618033988749895 - }, { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$4.length, - 'default': Output$4 - }] - }; - var prototype$1l = inherits(Treemap, HierarchyLayout); - /** - * Treemap layout generator. Adds 'method' and 'ratio' parameters - * to configure the underlying tile method. - */ - - prototype$1l.layout = function () { - var x = treemap(); - - x.ratio = function (_) { - var t = x.tile(); - if (t.ratio) x.tile(t.ratio(_)); - }; - - x.method = function (_) { - if (hasOwnProperty(Tiles, _)) x.tile(Tiles[_]);else error('Unrecognized Treemap layout method: ' + _); - }; - - return x; - }; - - prototype$1l.params = ['method', 'ratio', 'size', 'round', 'padding', 'paddingInner', 'paddingOuter', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft']; - prototype$1l.fields = Output$4; - var tree$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - nest: Nest, - pack: Pack, - partition: Partition, - stratify: Stratify, - tree: Tree, - treelinks: TreeLinks, - treemap: Treemap - }); - - function partition$5(data, groupby) { - var groups = [], - get = function get(f) { - return f(t); - }, - map, - i, - n, - t, - k, - g; // partition data points into stack groups - - - if (groupby == null) { - groups.push(data); - } else { - for (map = {}, i = 0, n = data.length; i < n; ++i) { - t = data[i]; - k = groupby.map(get); - g = map[k]; - - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - - g.push(t); - } - } - - return groups; - } - /** - * Compute locally-weighted regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ - - - function Loess(params) { - Transform.call(this, null, params); - } - - Loess.Definition = { - 'type': 'Loess', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0.3 - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }] - }; - var prototype$1m = inherits(Loess, Transform); - - prototype$1m.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var _source2 = pulse.materialize(pulse.SOURCE).source, - groups = partition$5(_source2, _.groupby), - names = (_.groupby || []).map(accessorName), - m = names.length, - as = _.as || [accessorName(_.x), accessorName(_.y)], - _values2 = []; - groups.forEach(function (g) { - regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(function (p) { - var t = {}; - - for (var i = 0; i < m; ++i) { - t[names[i]] = g.dims[i]; - } - - t[as[0]] = p[0]; - t[as[1]] = p[1]; - - _values2.push(ingest(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = _values2; - } - - return out; - }; - - var Methods$1 = { - linear: regressionLinear, - log: regressionLog, - exp: regressionExp, - pow: regressionPow, - quad: regressionQuad, - poly: regressionPoly - }; - - function degreesOfFreedom(method, order) { - return method === 'poly' ? order : method === 'quad' ? 2 : 1; - } - /** - * Compute regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {string} [params.method='linear'] - The regression method to apply. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ - - - function Regression(params) { - Transform.call(this, null, params); - } - - Regression.Definition = { - 'type': 'Regression', - 'metadata': { - 'generates': true - }, - 'params': [{ - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, { - 'name': 'method', - 'type': 'string', - 'default': 'linear', - 'values': Object.keys(Methods$1) - }, { - 'name': 'order', - 'type': 'number', - 'default': 3 - }, { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'params', - 'type': 'boolean', - 'default': false - }, { - 'name': 'as', - 'type': 'string', - 'array': true - }] - }; - var prototype$1n = inherits(Regression, Transform); - - prototype$1n.transform = function (_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var _source3 = pulse.materialize(pulse.SOURCE).source, - groups = partition$5(_source3, _.groupby), - names = (_.groupby || []).map(accessorName), - _method2 = _.method || 'linear', - order = _.order || 3, - dof = degreesOfFreedom(_method2, order), - as = _.as || [accessorName(_.x), accessorName(_.y)], - _fit = Methods$1[_method2], - _values3 = []; - - var _domain3 = _.extent; - - if (!hasOwnProperty(Methods$1, _method2)) { - error('Invalid regression method: ' + _method2); - } - - if (_domain3 != null) { - if (_method2 === 'log' && _domain3[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - _domain3 = null; - } - } - - groups.forEach(function (g) { - var n = g.length; - - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - - var model = _fit(g, _.x, _.y, order); - - if (_.params) { - // if parameter vectors requested return those - _values3.push(ingest({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - - return; - } - - var dom = _domain3 || extent(g, _.x), - add = function add(p) { - var t = {}; - - for (var i = 0; i < names.length; ++i) { - t[names[i]] = g.dims[i]; - } - - t[as[0]] = p[0]; - t[as[1]] = p[1]; - - _values3.push(ingest(t)); - }; - - if (_method2 === 'linear') { - // for linear regression we only need the end points - dom.forEach(function (x) { - return add([x, model.predict(x)]); - }); - } else { - // otherwise return trend line sample points - sampleCurve(model.predict, dom, 25, 200).forEach(add); - } - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = _values3; - } - - return out; - }; - - var reg = /*#__PURE__*/Object.freeze({ - __proto__: null, - loess: Loess, - regression: Regression - }); - var EPSILON$2 = Math.pow(2, -52); - var EDGE_STACK = new Uint32Array(512); - - var Delaunator = /*#__PURE__*/function () { - _createClass(Delaunator, null, [{ - key: "from", - value: function from(points) { - var getX = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetX; - var getY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultGetY; - var n = points.length; - var coords = new Float64Array(n * 2); - - for (var i = 0; i < n; i++) { - var p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - - return new Delaunator(coords); - } - }]); - - function Delaunator(coords) { - _classCallCheck(this, Delaunator); - - var n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - this.coords = coords; // arrays that will store the triangulation graph - - var maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); // temporary arrays for tracking the edges of the advancing convex hull - - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - - this._hullNext = new Uint32Array(n); // edge to next edge - - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - - this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash - // temporary arrays for sorting points - - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - this.update(); - } - - _createClass(Delaunator, [{ - key: "update", - value: function update() { - var coords = this.coords, - hullPrev = this._hullPrev, - hullNext = this._hullNext, - hullTri = this._hullTri, - hullHash = this._hullHash; - var n = coords.length >> 1; // populate an array of point indices; calculate input data bbox - - var minX = Infinity; - var minY = Infinity; - var maxX = -Infinity; - var maxY = -Infinity; - - for (var i = 0; i < n; i++) { - var _x25 = coords[2 * i]; - var _y4 = coords[2 * i + 1]; - if (_x25 < minX) minX = _x25; - if (_y4 < minY) minY = _y4; - if (_x25 > maxX) maxX = _x25; - if (_y4 > maxY) maxY = _y4; - this._ids[i] = i; - } - - var cx = (minX + maxX) / 2; - var cy = (minY + maxY) / 2; - var minDist = Infinity; - var i0, i1, i2; // pick a seed point close to the center - - for (var _i8 = 0; _i8 < n; _i8++) { - var d = dist(cx, cy, coords[2 * _i8], coords[2 * _i8 + 1]); - - if (d < minDist) { - i0 = _i8; - minDist = d; - } - } - - var i0x = coords[2 * i0]; - var i0y = coords[2 * i0 + 1]; - minDist = Infinity; // find the point closest to the seed - - for (var _i9 = 0; _i9 < n; _i9++) { - if (_i9 === i0) continue; - - var _d3 = dist(i0x, i0y, coords[2 * _i9], coords[2 * _i9 + 1]); - - if (_d3 < minDist && _d3 > 0) { - i1 = _i9; - minDist = _d3; - } - } - - var i1x = coords[2 * i1]; - var i1y = coords[2 * i1 + 1]; - var minRadius = Infinity; // find the third point which forms the smallest circumcircle with the first two - - for (var _i10 = 0; _i10 < n; _i10++) { - if (_i10 === i0 || _i10 === i1) continue; - var r = circumradius(i0x, i0y, i1x, i1y, coords[2 * _i10], coords[2 * _i10 + 1]); - - if (r < minRadius) { - i2 = _i10; - minRadius = r; - } - } - - var i2x = coords[2 * i2]; - var i2y = coords[2 * i2 + 1]; - - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for (var _i11 = 0; _i11 < n; _i11++) { - this._dists[_i11] = coords[2 * _i11] - coords[0] || coords[2 * _i11 + 1] - coords[1]; - } - - quicksort(this._ids, this._dists, 0, n - 1); - var hull = new Uint32Array(n); - var j = 0; - - for (var _i12 = 0, d0 = -Infinity; _i12 < n; _i12++) { - var _id5 = this._ids[_i12]; - - if (this._dists[_id5] > d0) { - hull[j++] = _id5; - d0 = this._dists[_id5]; - } - } - - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } // swap the order of the seed points for counter-clockwise orientation - - - if (orient(i0x, i0y, i1x, i1y, i2x, i2y)) { - var _i13 = i1; - var _x26 = i1x; - var _y5 = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = _i13; - i2x = _x26; - i2y = _y5; - } - - var center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - - for (var _i14 = 0; _i14 < n; _i14++) { - this._dists[_i14] = dist(coords[2 * _i14], coords[2 * _i14 + 1], center.x, center.y); - } // sort the points by distance from the seed triangle circumcenter - - - quicksort(this._ids, this._dists, 0, n - 1); // set up the seed triangle as the starting hull - - this._hullStart = i0; - var hullSize = 3; - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - this.trianglesLen = 0; - - this._addTriangle(i0, i1, i2, -1, -1, -1); - - for (var k = 0, xp, yp; k < this._ids.length; k++) { - var _i15 = this._ids[k]; - var _x27 = coords[2 * _i15]; - var _y6 = coords[2 * _i15 + 1]; // skip near-duplicate points - - if (k > 0 && Math.abs(_x27 - xp) <= EPSILON$2 && Math.abs(_y6 - yp) <= EPSILON$2) continue; - xp = _x27; - yp = _y6; // skip seed triangle points - - if (_i15 === i0 || _i15 === i1 || _i15 === i2) continue; // find a visible edge on the convex hull using edge hash - - var start = 0; - - for (var _j = 0, _key7 = this._hashKey(_x27, _y6); _j < this._hashSize; _j++) { - start = hullHash[(_key7 + _j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - - start = hullPrev[start]; - var e = start, - q = void 0; - - while (q = hullNext[e], !orient(_x27, _y6, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) { - e = q; - - if (e === start) { - e = -1; - break; - } - } - - if (e === -1) continue; // likely a near-duplicate point; skip it - // add the first triangle from the point - - var t = this._addTriangle(e, _i15, hullNext[e], -1, -1, hullTri[e]); // recursively flip triangles from the point until they satisfy the Delaunay condition - - - hullTri[_i15] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - - hullSize++; // walk forward through the hull, adding more triangles and flipping recursively - - var _n3 = hullNext[e]; - - while (q = hullNext[_n3], orient(_x27, _y6, coords[2 * _n3], coords[2 * _n3 + 1], coords[2 * q], coords[2 * q + 1])) { - t = this._addTriangle(_n3, _i15, q, hullTri[_i15], -1, hullTri[_n3]); - hullTri[_i15] = this._legalize(t + 2); - hullNext[_n3] = _n3; // mark as removed - - hullSize--; - _n3 = q; - } // walk backward from the other side, adding more triangles and flipping - - - if (e === start) { - while (q = hullPrev[e], orient(_x27, _y6, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) { - t = this._addTriangle(q, _i15, e, -1, hullTri[e], hullTri[q]); - - this._legalize(t + 2); - - hullTri[q] = t; - hullNext[e] = e; // mark as removed - - hullSize--; - e = q; - } - } // update the hull indices - - - this._hullStart = hullPrev[_i15] = e; - hullNext[e] = hullPrev[_n3] = _i15; - hullNext[_i15] = _n3; // save the two new edges in the hash table - - hullHash[this._hashKey(_x27, _y6)] = _i15; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - - this.hull = new Uint32Array(hullSize); - - for (var _i16 = 0, _e2 = this._hullStart; _i16 < hullSize; _i16++) { - this.hull[_i16] = _e2; - _e2 = hullNext[_e2]; - } // trim typed triangle mesh arrays - - - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - }, { - key: "_hashKey", - value: function _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - }, { - key: "_legalize", - value: function _legalize(a) { - var triangles = this._triangles, - halfedges = this._halfedges, - coords = this.coords; - var i = 0; - var ar = 0; // recursion eliminated with a fixed-size stack - - while (true) { - var _b2 = halfedges[a]; - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ - - var a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - - if (_b2 === -1) { - // convex hull edge - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - - var b0 = _b2 - _b2 % 3; - var al = a0 + (a + 1) % 3; - - var _bl = b0 + (_b2 + 2) % 3; - - var _p2 = triangles[ar]; - var pr = triangles[a]; - var pl = triangles[al]; - var p1 = triangles[_bl]; - var illegal = inCircle(coords[2 * _p2], coords[2 * _p2 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1]); - - if (illegal) { - triangles[a] = p1; - triangles[_b2] = _p2; - var hbl = halfedges[_bl]; // edge swapped on the other side of the hull (rare); fix the halfedge reference - - if (hbl === -1) { - var e = this._hullStart; - - do { - if (this._hullTri[e] === _bl) { - this._hullTri[e] = a; - break; - } - - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - - this._link(a, hbl); - - this._link(_b2, halfedges[ar]); - - this._link(ar, _bl); - - var _br = b0 + (_b2 + 1) % 3; // don't worry about hitting the cap: it can only happen on extremely degenerate input - - - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = _br; - } - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - - return ar; - } - }, { - key: "_link", - value: function _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } // add a new triangle given vertex indices and adjacent half-edge ids - - }, { - key: "_addTriangle", - value: function _addTriangle(i0, i1, i2, a, b, c) { - var t = this.trianglesLen; - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - - this._link(t, a); - - this._link(t + 1, b); - - this._link(t + 2, c); - - this.trianglesLen += 3; - return t; - } - }]); - - return Delaunator; - }(); // monotonically increases with real angle, but doesn't need expensive trigonometry - - - function pseudoAngle(dx, dy) { - var p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] - } - - function dist(ax, ay, bx, by) { - var dx = ax - bx; - var dy = ay - by; - return dx * dx + dy * dy; - } // return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check - - - function orientIfSure(px, py, rx, ry, qx, qy) { - var l = (ry - py) * (qx - px); - var r = (rx - px) * (qy - py); - return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0; - } // a more robust orientation test that's stable in a given triangle (to fix robustness issues) - - - function orient(rx, ry, qx, qy, px, py) { - var sign = orientIfSure(px, py, rx, ry, qx, qy) || orientIfSure(rx, ry, qx, qy, px, py) || orientIfSure(qx, qy, px, py, rx, ry); - return sign < 0; - } - - function inCircle(ax, ay, bx, by, cx, cy, px, py) { - var dx = ax - px; - var dy = ay - py; - var ex = bx - px; - var ey = by - py; - var fx = cx - px; - var fy = cy - py; - var ap = dx * dx + dy * dy; - var bp = ex * ex + ey * ey; - var cp = fx * fx + fy * fy; - return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; - } - - function circumradius(ax, ay, bx, by, cx, cy) { - var dx = bx - ax; - var dy = by - ay; - var ex = cx - ax; - var ey = cy - ay; - var bl = dx * dx + dy * dy; - var cl = ex * ex + ey * ey; - var d = 0.5 / (dx * ey - dy * ex); - var x = (ey * bl - dy * cl) * d; - var y = (dx * cl - ex * bl) * d; - return x * x + y * y; - } - - function circumcenter(ax, ay, bx, by, cx, cy) { - var dx = bx - ax; - var dy = by - ay; - var ex = cx - ax; - var ey = cy - ay; - var bl = dx * dx + dy * dy; - var cl = ex * ex + ey * ey; - var d = 0.5 / (dx * ey - dy * ex); - var x = ax + (ey * bl - dy * cl) * d; - var y = ay + (dx * cl - ex * bl) * d; - return { - x: x, - y: y - }; - } - - function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (var i = left + 1; i <= right; i++) { - var _temp = ids[i]; - var tempDist = dists[_temp]; - var j = i - 1; - - while (j >= left && dists[ids[j]] > tempDist) { - ids[j + 1] = ids[j--]; - } - - ids[j + 1] = _temp; - } - } else { - var _median = left + right >> 1; - - var _i17 = left + 1; - - var _j2 = right; - swap$1(ids, _median, _i17); - if (dists[ids[left]] > dists[ids[right]]) swap$1(ids, left, right); - if (dists[ids[_i17]] > dists[ids[right]]) swap$1(ids, _i17, right); - if (dists[ids[left]] > dists[ids[_i17]]) swap$1(ids, left, _i17); - var _temp2 = ids[_i17]; - var _tempDist = dists[_temp2]; - - while (true) { - do { - _i17++; - } while (dists[ids[_i17]] < _tempDist); - - do { - _j2--; - } while (dists[ids[_j2]] > _tempDist); - - if (_j2 < _i17) break; - swap$1(ids, _i17, _j2); - } - - ids[left + 1] = ids[_j2]; - ids[_j2] = _temp2; - - if (right - _i17 + 1 >= _j2 - left) { - quicksort(ids, dists, _i17, right); - quicksort(ids, dists, left, _j2 - 1); - } else { - quicksort(ids, dists, left, _j2 - 1); - quicksort(ids, dists, _i17, right); - } - } - } - - function swap$1(arr, i, j) { - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; - } - - function defaultGetX(p) { - return p[0]; - } - - function defaultGetY(p) { - return p[1]; - } - - var epsilon$5 = 1e-6; - - var Path$1 = /*#__PURE__*/function () { - function Path$1() { - _classCallCheck(this, Path$1); - - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - - this._ = ""; - } - - _createClass(Path$1, [{ - key: "moveTo", - value: function moveTo(x, y) { - this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y); - } - }, { - key: "closePath", - value: function closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - } - }, { - key: "lineTo", - value: function lineTo(x, y) { - this._ += "L".concat(this._x1 = +x, ",").concat(this._y1 = +y); - } - }, { - key: "arc", - value: function arc(x, y, r) { - x = +x, y = +y, r = +r; - var x0 = x + r; - var y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += "M".concat(x0, ",").concat(y0);else if (Math.abs(this._x1 - x0) > epsilon$5 || Math.abs(this._y1 - y0) > epsilon$5) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += "A".concat(r, ",").concat(r, ",0,1,1,").concat(x - r, ",").concat(y, "A").concat(r, ",").concat(r, ",0,1,1,").concat(this._x1 = x0, ",").concat(this._y1 = y0); - } - }, { - key: "rect", - value: function rect(x, y, w, h) { - this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y, "h").concat(+w, "v").concat(+h, "h").concat(-w, "Z"); - } - }, { - key: "value", - value: function value() { - return this._ || null; - } - }]); - - return Path$1; - }(); - - var Polygon = /*#__PURE__*/function () { - function Polygon() { - _classCallCheck(this, Polygon); - - this._ = []; - } - - _createClass(Polygon, [{ - key: "moveTo", - value: function moveTo(x, y) { - this._.push([x, y]); - } - }, { - key: "closePath", - value: function closePath() { - this._.push(this._[0].slice()); - } - }, { - key: "lineTo", - value: function lineTo(x, y) { - this._.push([x, y]); - } - }, { - key: "value", - value: function value() { - return this._.length ? this._ : null; - } - }]); - - return Polygon; - }(); - - var Voronoi = /*#__PURE__*/function () { - function Voronoi(delaunay) { - var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 960, 500], - _ref17 = _slicedToArray(_ref16, 4), - xmin = _ref17[0], - ymin = _ref17[1], - xmax = _ref17[2], - ymax = _ref17[3]; - - _classCallCheck(this, Voronoi); - - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - - this._init(); - } - - _createClass(Voronoi, [{ - key: "update", - value: function update() { - this.delaunay.update(); - - this._init(); - - return this; - } - }, { - key: "_init", - value: function _init() { - var _this$delaunay = this.delaunay, - points = _this$delaunay.points, - hull = _this$delaunay.hull, - triangles = _this$delaunay.triangles, - vectors = this.vectors; // Compute circumcenters. - - var circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - - for (var i = 0, j = 0, n = triangles.length, _x28, _y7; i < n; i += 3, j += 2) { - var _t = triangles[i] * 2; - - var _t2 = triangles[i + 1] * 2; - - var _t3 = triangles[i + 2] * 2; - - var _x29 = points[_t]; - var _y8 = points[_t + 1]; - var x2 = points[_t2]; - var y2 = points[_t2 + 1]; - var x3 = points[_t3]; - var y3 = points[_t3 + 1]; - var dx = x2 - _x29; - var dy = y2 - _y8; - var ex = x3 - _x29; - var ey = y3 - _y8; - - var _bl2 = dx * dx + dy * dy; - - var cl = ex * ex + ey * ey; - var ab = (dx * ey - dy * ex) * 2; - - if (!ab) { - // degenerate case (collinear diagram) - _x28 = (_x29 + x3) / 2 - 1e8 * ey; - _y7 = (_y8 + y3) / 2 + 1e8 * ex; - } else if (Math.abs(ab) < 1e-8) { - // almost equal points (degenerate triangle) - _x28 = (_x29 + x3) / 2; - _y7 = (_y8 + y3) / 2; - } else { - var d = 1 / ab; - _x28 = _x29 + (ey * _bl2 - dy * cl) * d; - _y7 = _y8 + (dx * cl - ex * _bl2) * d; - } - - circumcenters[j] = _x28; - circumcenters[j + 1] = _y7; - } // Compute exterior cell rays. - - - var h = hull[hull.length - 1]; - var p0, - p1 = h * 4; - var x0, - x1 = points[2 * h]; - var y0, - y1 = points[2 * h + 1]; - vectors.fill(0); - - for (var _i18 = 0; _i18 < hull.length; ++_i18) { - h = hull[_i18]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - }, { - key: "render", - value: function render(context) { - var buffer = context == null ? context = new Path$1() : undefined; - var _this$delaunay2 = this.delaunay, - halfedges = _this$delaunay2.halfedges, - inedges = _this$delaunay2.inedges, - hull = _this$delaunay2.hull, - circumcenters = this.circumcenters, - vectors = this.vectors; - if (hull.length <= 1) return null; - - for (var i = 0, n = halfedges.length; i < n; ++i) { - var j = halfedges[i]; - if (j < i) continue; - var ti = Math.floor(i / 3) * 2; - var tj = Math.floor(j / 3) * 2; - var xi = circumcenters[ti]; - var yi = circumcenters[ti + 1]; - var xj = circumcenters[tj]; - var yj = circumcenters[tj + 1]; - - this._renderSegment(xi, yi, xj, yj, context); - } - - var h0, - h1 = hull[hull.length - 1]; - - for (var _i19 = 0; _i19 < hull.length; ++_i19) { - h0 = h1, h1 = hull[_i19]; - var t = Math.floor(inedges[h1] / 3) * 2; - var _x30 = circumcenters[t]; - var _y9 = circumcenters[t + 1]; - var v = h0 * 4; - - var p = this._project(_x30, _y9, vectors[v + 2], vectors[v + 3]); - - if (p) this._renderSegment(_x30, _y9, p[0], p[1], context); - } - - return buffer && buffer.value(); - } - }, { - key: "renderBounds", - value: function renderBounds(context) { - var buffer = context == null ? context = new Path$1() : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - }, { - key: "renderCell", - value: function renderCell(i, context) { - var buffer = context == null ? context = new Path$1() : undefined; - - var points = this._clip(i); - - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - var n = points.length; - - while (points[0] === points[n - 2] && points[1] === points[n - 1] && n > 1) { - n -= 2; - } - - for (var _i20 = 2; _i20 < n; _i20 += 2) { - if (points[_i20] !== points[_i20 - 2] || points[_i20 + 1] !== points[_i20 - 1]) context.lineTo(points[_i20], points[_i20 + 1]); - } - - context.closePath(); - return buffer && buffer.value(); - } - }, { - key: "cellPolygons", - value: /*#__PURE__*/regeneratorRuntime.mark(function cellPolygons() { - var points, i, n, _cell2; - - return regeneratorRuntime.wrap(function cellPolygons$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - points = this.delaunay.points; - i = 0, n = points.length / 2; - - case 2: - if (!(i < n)) { - _context4.next = 11; - break; - } - - _cell2 = this.cellPolygon(i); - - if (!_cell2) { - _context4.next = 8; - break; - } - - _cell2.index = i; - _context4.next = 8; - return _cell2; - - case 8: - ++i; - _context4.next = 2; - break; - - case 11: - case "end": - return _context4.stop(); - } - } - }, cellPolygons, this); - }) - }, { - key: "cellPolygon", - value: function cellPolygon(i) { - var polygon = new Polygon(); - this.renderCell(i, polygon); - return polygon.value(); - } - }, { - key: "_renderSegment", - value: function _renderSegment(x0, y0, x1, y1, context) { - var S; - - var c0 = this._regioncode(x0, y0); - - var c1 = this._regioncode(x1, y1); - - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } - } - }, { - key: "contains", - value: function contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; - } - }, { - key: "neighbors", - value: /*#__PURE__*/regeneratorRuntime.mark(function neighbors(i) { - var ci, _iterator20, _step20, j, cj, ai, li, aj, lj; - - return regeneratorRuntime.wrap(function neighbors$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - ci = this._clip(i); - - if (!ci) { - _context5.next = 33; - break; - } - - _iterator20 = _createForOfIteratorHelper(this.delaunay.neighbors(i)); - _context5.prev = 3; - - _iterator20.s(); - - case 5: - if ((_step20 = _iterator20.n()).done) { - _context5.next = 25; - break; - } - - j = _step20.value; - cj = this._clip(j); // find the common edge - - if (!cj) { - _context5.next = 23; - break; - } - - ai = 0, li = ci.length; - - case 10: - if (!(ai < li)) { - _context5.next = 23; - break; - } - - aj = 0, lj = cj.length; - - case 12: - if (!(aj < lj)) { - _context5.next = 20; - break; - } - - if (!(ci[ai] == cj[aj] && ci[ai + 1] == cj[aj + 1] && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj])) { - _context5.next = 17; - break; - } - - _context5.next = 16; - return j; - - case 16: - return _context5.abrupt("break", 23); - - case 17: - aj += 2; - _context5.next = 12; - break; - - case 20: - ai += 2; - _context5.next = 10; - break; - - case 23: - _context5.next = 5; - break; - - case 25: - _context5.next = 30; - break; - - case 27: - _context5.prev = 27; - _context5.t0 = _context5["catch"](3); - - _iterator20.e(_context5.t0); - - case 30: - _context5.prev = 30; - - _iterator20.f(); - - return _context5.finish(30); - - case 33: - case "end": - return _context5.stop(); - } - } - }, neighbors, this, [[3, 27, 30, 33]]); - }) - }, { - key: "_cell", - value: function _cell(i) { - var circumcenters = this.circumcenters, - _this$delaunay3 = this.delaunay, - inedges = _this$delaunay3.inedges, - halfedges = _this$delaunay3.halfedges, - triangles = _this$delaunay3.triangles; - var e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - - var points = []; - var e = e0; - - do { - var t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - - e = halfedges[e]; - } while (e !== e0 && e !== -1); - - return points; - } - }, { - key: "_clip", - value: function _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - - var points = this._cell(i); - - if (points === null) return null; - var V = this.vectors; - var v = i * 4; - return V[v] || V[v + 1] ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points); - } - }, { - key: "_clipFinite", - value: function _clipFinite(i, points) { - var n = points.length; - var P = null; - var x0, - y0, - x1 = points[n - 2], - y1 = points[n - 1]; - - var c0, - c1 = this._regioncode(x1, y1); - - var e0, e1; - - for (var j = 0; j < n; j += 2) { - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1);else P = [x1, y1]; - } else { - var S = void 0, - sx0 = void 0, - sy0 = void 0, - sx1 = void 0, - sy1 = void 0; - - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - var _S = S; - - var _S2 = _slicedToArray(_S, 4); - - sx0 = _S2[0]; - sy0 = _S2[1]; - sx1 = _S2[2]; - sy1 = _S2[3]; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - var _S3 = S; - - var _S4 = _slicedToArray(_S3, 4); - - sx1 = _S4[0]; - sy1 = _S4[1]; - sx0 = _S4[2]; - sy0 = _S4[3]; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0);else P = [sx0, sy0]; - } - - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1);else P = [sx1, sy1]; - } - } - - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - - return P; - } - }, { - key: "_clipSegment", - value: function _clipSegment(x0, y0, x1, y1, c0, c1) { - while (true) { - if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1]; - if (c0 & c1) return null; - - var _x31 = void 0, - _y10 = void 0, - c = c0 || c1; - - if (c & 8) _x31 = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), _y10 = this.ymax;else if (c & 4) _x31 = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), _y10 = this.ymin;else if (c & 2) _y10 = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), _x31 = this.xmax;else _y10 = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), _x31 = this.xmin; - if (c0) x0 = _x31, y0 = _y10, c0 = this._regioncode(x0, y0);else x1 = _x31, y1 = _y10, c1 = this._regioncode(x1, y1); - } - } - }, { - key: "_clipInfinite", - value: function _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - var P = Array.from(points), - p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - - if (P = this._clipFinite(i, P)) { - for (var j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; - } - - return P; - } - }, { - key: "_edge", - value: function _edge(i, e0, e1, P, j) { - while (e0 !== e1) { - var _x32 = void 0, - _y11 = void 0; - - switch (e0) { - case 5: - e0 = 4; - continue; - // top-left - - case 4: - e0 = 6, _x32 = this.xmax, _y11 = this.ymin; - break; - // top - - case 6: - e0 = 2; - continue; - // top-right - - case 2: - e0 = 10, _x32 = this.xmax, _y11 = this.ymax; - break; - // right - - case 10: - e0 = 8; - continue; - // bottom-right - - case 8: - e0 = 9, _x32 = this.xmin, _y11 = this.ymax; - break; - // bottom - - case 9: - e0 = 1; - continue; - // bottom-left - - case 1: - e0 = 5, _x32 = this.xmin, _y11 = this.ymin; - break; - // left - } - - if ((P[j] !== _x32 || P[j + 1] !== _y11) && this.contains(i, _x32, _y11)) { - P.splice(j, 0, _x32, _y11), j += 2; - } - } - - if (P.length > 4) { - for (var _i21 = 0; _i21 < P.length; _i21 += 2) { - var _j3 = (_i21 + 2) % P.length, - k = (_i21 + 4) % P.length; - - if (P[_i21] === P[_j3] && P[_j3] === P[k] || P[_i21 + 1] === P[_j3 + 1] && P[_j3 + 1] === P[k + 1]) P.splice(_j3, 2), _i21 -= 2; - } - } - - return j; - } - }, { - key: "_project", - value: function _project(x0, y0, vx, vy) { - var t = Infinity, - c, - x, - y; - - if (vy < 0) { - // top - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { - // bottom - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - - if (vx > 0) { - // right - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { - // left - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - - return [x, y]; - } - }, { - key: "_edgecode", - value: function _edgecode(x, y) { - return (x === this.xmin ? 1 : x === this.xmax ? 2 : 0) | (y === this.ymin ? 4 : y === this.ymax ? 8 : 0); - } - }, { - key: "_regioncode", - value: function _regioncode(x, y) { - return (x < this.xmin ? 1 : x > this.xmax ? 2 : 0) | (y < this.ymin ? 4 : y > this.ymax ? 8 : 0); - } - }]); - - return Voronoi; - }(); - - var tau$3 = 2 * Math.PI, - pow$3 = Math.pow; - - function pointX(p) { - return p[0]; - } - - function pointY(p) { - return p[1]; - } // A triangulation is collinear if all its triangles have a non-null area - - - function collinear$1(d) { - var triangles = d.triangles, - coords = d.coords; - - for (var i = 0; i < triangles.length; i += 3) { - var a = 2 * triangles[i], - _b3 = 2 * triangles[i + 1], - c = 2 * triangles[i + 2], - _cross = (coords[c] - coords[a]) * (coords[_b3 + 1] - coords[a + 1]) - (coords[_b3] - coords[a]) * (coords[c + 1] - coords[a + 1]); - - if (_cross > 1e-10) return false; - } - - return true; - } - - function jitter(x, y, r) { - return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r]; - } - - var Delaunay = /*#__PURE__*/function () { - _createClass(Delaunay, null, [{ - key: "from", - value: function from(points) { - var fx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : pointX; - var fy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : pointY; - var that = arguments.length > 3 ? arguments[3] : undefined; - return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that))); - } - }]); - - function Delaunay(points) { - _classCallCheck(this, Delaunay); - - this._delaunator = new Delaunator(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - - this._init(); - } - - _createClass(Delaunay, [{ - key: "update", - value: function update() { - this._delaunator.update(); - - this._init(); - - return this; - } - }, { - key: "_init", - value: function _init() { - var d = this._delaunator, - points = this.points; // check for collinear - - if (d.hull && d.hull.length > 2 && collinear$1(d)) { - this.collinear = Int32Array.from({ - length: points.length / 2 - }, function (_, i) { - return i; - }).sort(function (i, j) { - return points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]; - }); // for exact neighbors - - var e = this.collinear[0], - f = this.collinear[this.collinear.length - 1], - _bounds = [points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1]], - r = 1e-8 * Math.hypot(_bounds[3] - _bounds[1], _bounds[2] - _bounds[0]); - - for (var i = 0, n = points.length / 2; i < n; ++i) { - var p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - - this._delaunator = new Delaunator(points); - } else { - delete this.collinear; - } - - var halfedges = this.halfedges = this._delaunator.halfedges; - var hull = this.hull = this._delaunator.hull; - var triangles = this.triangles = this._delaunator.triangles; - var inedges = this.inedges.fill(-1); - - var hullIndex = this._hullIndex.fill(-1); // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - - - for (var _e3 = 0, _n4 = halfedges.length; _e3 < _n4; ++_e3) { - var _p3 = triangles[_e3 % 3 === 2 ? _e3 - 2 : _e3 + 1]; - if (halfedges[_e3] === -1 || inedges[_p3] === -1) inedges[_p3] = _e3; - } - - for (var _i22 = 0, _n5 = hull.length; _i22 < _n5; ++_i22) { - hullIndex[hull[_i22]] = _i22; - } // degenerate case: 1 or 2 (distinct) points - - - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - inedges[hull[0]] = 1; - if (hull.length === 2) inedges[hull[1]] = 0; - } - } - }, { - key: "voronoi", - value: function voronoi(bounds) { - return new Voronoi(this, bounds); - } - }, { - key: "neighbors", - value: /*#__PURE__*/regeneratorRuntime.mark(function neighbors(i) { - var inedges, hull, _hullIndex, halfedges, triangles, collinear, l, e0, e, p0, p; - - return regeneratorRuntime.wrap(function neighbors$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - inedges = this.inedges, hull = this.hull, _hullIndex = this._hullIndex, halfedges = this.halfedges, triangles = this.triangles, collinear = this.collinear; // degenerate case with several collinear points - - if (!collinear) { - _context6.next = 10; - break; - } - - l = collinear.indexOf(i); - - if (!(l > 0)) { - _context6.next = 6; - break; - } - - _context6.next = 6; - return collinear[l - 1]; - - case 6: - if (!(l < collinear.length - 1)) { - _context6.next = 9; - break; - } - - _context6.next = 9; - return collinear[l + 1]; - - case 9: - return _context6.abrupt("return"); - - case 10: - e0 = inedges[i]; - - if (!(e0 === -1)) { - _context6.next = 13; - break; - } - - return _context6.abrupt("return"); - - case 13: - // coincident point - e = e0, p0 = -1; - - case 14: - _context6.next = 16; - return p0 = triangles[e]; - - case 16: - e = e % 3 === 2 ? e - 2 : e + 1; - - if (!(triangles[e] !== i)) { - _context6.next = 19; - break; - } - - return _context6.abrupt("return"); - - case 19: - // bad triangulation - e = halfedges[e]; - - if (!(e === -1)) { - _context6.next = 26; - break; - } - - p = hull[(_hullIndex[i] + 1) % hull.length]; - - if (!(p !== p0)) { - _context6.next = 25; - break; - } - - _context6.next = 25; - return p; - - case 25: - return _context6.abrupt("return"); - - case 26: - if (e !== e0) { - _context6.next = 14; - break; - } - - case 27: - case "end": - return _context6.stop(); - } - } - }, neighbors, this); - }) - }, { - key: "find", - value: function find(x, y) { - var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - var i0 = i; - var c; - - while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) { - i = c; - } - - return c; - } - }, { - key: "_step", - value: function _step(i, x, y) { - var inedges = this.inedges, - hull = this.hull, - _hullIndex = this._hullIndex, - halfedges = this.halfedges, - triangles = this.triangles, - points = this.points; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - var c = i; - var dc = pow$3(x - points[i * 2], 2) + pow$3(y - points[i * 2 + 1], 2); - var e0 = inedges[i]; - var e = e0; - - do { - var t = triangles[e]; - var dt = pow$3(x - points[t * 2], 2) + pow$3(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - - e = halfedges[e]; - - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - - if (e !== t) { - if (pow$3(x - points[e * 2], 2) + pow$3(y - points[e * 2 + 1], 2) < dc) return e; - } - - break; - } - } while (e !== e0); - - return c; - } - }, { - key: "render", - value: function render(context) { - var buffer = context == null ? context = new Path$1() : undefined; - var points = this.points, - halfedges = this.halfedges, - triangles = this.triangles; - - for (var i = 0, n = halfedges.length; i < n; ++i) { - var j = halfedges[i]; - if (j < i) continue; - var ti = triangles[i] * 2; - var tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - - this.renderHull(context); - return buffer && buffer.value(); - } - }, { - key: "renderPoints", - value: function renderPoints(context) { - var r = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; - var buffer = context == null ? context = new Path$1() : undefined; - var points = this.points; - - for (var i = 0, n = points.length; i < n; i += 2) { - var _x33 = points[i], - _y12 = points[i + 1]; - context.moveTo(_x33 + r, _y12); - context.arc(_x33, _y12, r, 0, tau$3); - } - - return buffer && buffer.value(); - } - }, { - key: "renderHull", - value: function renderHull(context) { - var buffer = context == null ? context = new Path$1() : undefined; - var hull = this.hull, - points = this.points; - var h = hull[0] * 2, - n = hull.length; - context.moveTo(points[h], points[h + 1]); - - for (var i = 1; i < n; ++i) { - var _h = 2 * hull[i]; - - context.lineTo(points[_h], points[_h + 1]); - } - - context.closePath(); - return buffer && buffer.value(); - } - }, { - key: "hullPolygon", - value: function hullPolygon() { - var polygon = new Polygon(); - this.renderHull(polygon); - return polygon.value(); - } - }, { - key: "renderTriangle", - value: function renderTriangle(i, context) { - var buffer = context == null ? context = new Path$1() : undefined; - var points = this.points, - triangles = this.triangles; - var t0 = triangles[i *= 3] * 2; - var t1 = triangles[i + 1] * 2; - var t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); - } - }, { - key: "trianglePolygons", - value: /*#__PURE__*/regeneratorRuntime.mark(function trianglePolygons() { - var triangles, i, n; - return regeneratorRuntime.wrap(function trianglePolygons$(_context7) { - while (1) { - switch (_context7.prev = _context7.next) { - case 0: - triangles = this.triangles; - i = 0, n = triangles.length / 3; - - case 2: - if (!(i < n)) { - _context7.next = 8; - break; - } - - _context7.next = 5; - return this.trianglePolygon(i); - - case 5: - ++i; - _context7.next = 2; - break; - - case 8: - case "end": - return _context7.stop(); - } - } - }, trianglePolygons, this); - }) - }, { - key: "trianglePolygon", - value: function trianglePolygon(i) { - var polygon = new Polygon(); - this.renderTriangle(i, polygon); - return polygon.value(); - } - }]); - - return Delaunay; - }(); - - function flatArray(points, fx, fy, that) { - var n = points.length; - var array = new Float64Array(n * 2); - - for (var i = 0; i < n; ++i) { - var p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - - return array; - } - - function flatIterable(points, fx, fy, that) { - var i, _iterator21, _step21, p; - - return regeneratorRuntime.wrap(function flatIterable$(_context8) { - while (1) { - switch (_context8.prev = _context8.next) { - case 0: - i = 0; - _iterator21 = _createForOfIteratorHelper(points); - _context8.prev = 2; - - _iterator21.s(); - - case 4: - if ((_step21 = _iterator21.n()).done) { - _context8.next = 13; - break; - } - - p = _step21.value; - _context8.next = 8; - return fx.call(that, p, i, points); - - case 8: - _context8.next = 10; - return fy.call(that, p, i, points); - - case 10: - ++i; - - case 11: - _context8.next = 4; - break; - - case 13: - _context8.next = 18; - break; - - case 15: - _context8.prev = 15; - _context8.t0 = _context8["catch"](2); - - _iterator21.e(_context8.t0); - - case 18: - _context8.prev = 18; - - _iterator21.f(); - - return _context8.finish(18); - - case 21: - case "end": - return _context8.stop(); - } - } - }, _marked3, null, [[2, 15, 18, 21]]); - } - - function Voronoi$1(params) { - Transform.call(this, null, params); - } - - Voronoi$1.Definition = { - 'type': 'Voronoi', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'x', - 'type': 'field', - 'required': true - }, { - 'name': 'y', - 'type': 'field', - 'required': true - }, { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'default': [[-1e5, -1e5], [1e5, 1e5]], - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, { - 'name': 'as', - 'type': 'string', - 'default': 'path' - }] - }; - var prototype$1o = inherits(Voronoi$1, Transform); - var defaultExtent = [-1e5, -1e5, 1e5, 1e5]; - - prototype$1o.transform = function (_, pulse) { - var as = _.as || 'path', - data = pulse.source; // nothing to do if no data - - if (!data || !data.length) return pulse; // configure and construct voronoi diagram - - var s = _.size; - s = s ? [0, 0, s[0], s[1]] : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] : defaultExtent; - var voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s); // map polygons to paths - - for (var i = 0, n = data.length; i < n; ++i) { - var polygon = voronoi.cellPolygon(i); - data[i][as] = polygon ? toPathString(polygon) : null; - } - - return pulse.reflow(_.modified()).modifies(as); - }; // suppress duplicated end point vertices - - - function toPathString(p) { - var x = p[0][0], - y = p[0][1]; - var n = p.length - 1; - - for (; p[n][0] === x && p[n][1] === y; --n) { - ; - } - - return 'M' + p.slice(0, n + 1).join('L') + 'Z'; - } - - var voronoi = /*#__PURE__*/Object.freeze({ - __proto__: null, - voronoi: Voronoi$1 - }); - /* - Copyright (c) 2013, Jason Davies. - 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 Jason Davies 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 JASON DAVIES 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. - */ - // Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/ - // Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf - - var cloudRadians = Math.PI / 180, - cw = 1 << 11 >> 5, - ch = 1 << 11; - - function cloud() { - var size = [256, 256], - text, - font, - fontSize, - fontStyle, - fontWeight, - rotate, - padding, - spiral = archimedeanSpiral, - words = [], - random = Math.random, - cloud = {}; - - cloud.layout = function () { - var contextAndRatio = getContext(domCanvas()), - board = zeroArray((size[0] >> 5) * size[1]), - bounds = null, - n = words.length, - i = -1, - tags = [], - data = words.map(function (d) { - return { - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - }; - }).sort(function (a, b) { - return b.size - a.size; - }); - - while (++i < n) { - var d = data[i]; - d.x = size[0] * (random() + .5) >> 1; - d.y = size[1] * (random() + .5) >> 1; - cloudSprite(contextAndRatio, d, data, i); - - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d);else bounds = [{ - x: d.x + d.x0, - y: d.y + d.y0 - }, { - x: d.x + d.x1, - y: d.y + d.y1 - }]; // Temporary hack - - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - - return tags; - }; - - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - return { - context: context, - ratio: ratio - }; - } - - function place(board, tag, bounds) { - var startX = tag.x, - startY = tag.y, - maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), - s = spiral(size), - dt = random() < .5 ? 1 : -1, - t = -dt, - dxdy, - dx, - dy; - - while (dxdy = s(t += dt)) { - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - tag.x = startX + dx; - tag.y = startY + dy; - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; // TODO only check for collisions within current bounds. - - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, - w = tag.width >> 5, - sw = size[0] >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - - for (var j = 0; j < h; j++) { - last = 0; - - for (var i = 0; i <= w; i++) { - board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - } - - x += sw; - } - - tag.sprite = null; - return true; - } - } - } - - return false; - } - - cloud.words = function (_) { - if (arguments.length) { - words = _; - return cloud; - } else { - return words; - } - }; - - cloud.size = function (_) { - if (arguments.length) { - size = [+_[0], +_[1]]; - return cloud; - } else { - return size; - } - }; - - cloud.font = function (_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else { - return font; - } - }; - - cloud.fontStyle = function (_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else { - return fontStyle; - } - }; - - cloud.fontWeight = function (_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else { - return fontWeight; - } - }; - - cloud.rotate = function (_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else { - return rotate; - } - }; - - cloud.text = function (_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else { - return text; - } - }; - - cloud.spiral = function (_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else { - return spiral; - } - }; - - cloud.fontSize = function (_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else { - return fontSize; - } - }; - - cloud.padding = function (_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else { - return padding; - } - }; - - cloud.random = function (_) { - if (arguments.length) { - random = _; - return cloud; - } else { - return random; - } - }; - - return cloud; - } // Fetches a monochrome sprite bitmap for the specified text. - // Load in batches for speed. - - - function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, - ratio = contextAndRatio.ratio; - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, - y = 0, - maxh = 0, - n = data.length, - w, - w32, - h, - i, - j; - --di; - - while (++di < n) { - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), - cr = Math.cos(d.rotate * cloudRadians), - wcr = w * cr, - wsr = w * sr, - hcr = h * cr, - hsr = h * sr; - w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else { - w = w + 0x1f >> 5 << 5; - } - - if (h > maxh) maxh = h; - - if (x + w >= cw << 5) { - x = 0; - y += maxh; - maxh = 0; - } - - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, - sprite = []; - - while (--di >= 0) { - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; // Zero the buffer - - for (i = 0; i < h * w32; i++) { - sprite[i] = 0; - } - - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, - seenRow = -1; - - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - var k = w32 * j + (i >> 5), - m = pixels[(y + j) * (cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0; - sprite[k] |= m; - seen |= m; - } - - if (seen) seenRow = j;else { - d.y0++; - h--; - j--; - y++; - } - } - - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); - } - } // Use mask-based collision detection. - - - function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, - w = tag.width >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - - for (var j = 0; j < h; j++) { - last = 0; - - for (var i = 0; i <= w; i++) { - if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true; - } - - x += sw; - } - - return false; - } - - function cloudBounds(bounds, d) { - var b0 = bounds[0], - b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; - } - - function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; - } - - function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function (t) { - return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)]; - }; - } - - function rectangularSpiral(size) { - var dy = 4, - dx = dy * size[0] / size[1], - x = 0, - y = 0; - return function (t) { - var sign = t < 0 ? -1 : 1; // See triangular numbers: T_n = n * (n + 1) / 2. - - switch (Math.sqrt(1 + 4 * sign * t) - sign & 3) { - case 0: - x += dx; - break; - - case 1: - y += dy; - break; - - case 2: - x -= dx; - break; - - default: - y -= dy; - break; - } - - return [x, y]; - }; - } // TODO reuse arrays? - - - function zeroArray(n) { - var a = [], - i = -1; - - while (++i < n) { - a[i] = 0; - } - - return a; - } - - function functor(d) { - return typeof d === 'function' ? d : function () { - return d; - }; - } - - var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral - }; - var Output$5 = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle']; - var Params$1 = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight']; - - function Wordcloud(params) { - Transform.call(this, cloud(), params); - } - - Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': { - 'modifies': true - }, - 'params': [{ - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, { - 'name': 'font', - 'type': 'string', - 'expr': true, - 'default': 'sans-serif' - }, { - 'name': 'fontStyle', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, { - 'name': 'fontWeight', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, { - 'name': 'fontSize', - 'type': 'number', - 'expr': true, - 'default': 14 - }, { - 'name': 'fontSizeRange', - 'type': 'number', - 'array': 'nullable', - 'default': [10, 50] - }, { - 'name': 'rotate', - 'type': 'number', - 'expr': true, - 'default': 0 - }, { - 'name': 'text', - 'type': 'field' - }, { - 'name': 'spiral', - 'type': 'string', - 'values': ['archimedean', 'rectangular'] - }, { - 'name': 'padding', - 'type': 'number', - 'expr': true - }, { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 7, - 'default': Output$5 - }] - }; - var prototype$1p = inherits(Wordcloud, Transform); - - prototype$1p.transform = function (_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) { - error('Wordcloud size dimensions must be non-zero.'); - } - - function modp(param) { - var p = _[param]; - return isFunction(p) && pulse.modified(p.fields); - } - - var mod = _.modified(); - - if (!(mod || pulse.changed(pulse.ADD_REM) || Params$1.some(modp))) return; - var data = pulse.materialize(pulse.SOURCE).source, - layout = this.value, - as = _.as || Output$5, - fontSize = _.fontSize || 14, - range; - isFunction(fontSize) ? range = _.fontSizeRange : fontSize = constant(fontSize); // create font size scaling function as needed - - if (range) { - var fsize = fontSize, - sizeScale = scale$2('sqrt')().domain(extent(data, fsize)).range(range); - - fontSize = function fontSize(x) { - return sizeScale(fsize(x)); - }; - } - - data.forEach(function (t) { - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); // configure layout - - var words = layout.words(data).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random(exports.random).layout(); - var size = layout.size(), - dx = size[0] >> 1, - dy = size[1] >> 1, - i = 0, - n = words.length, - w, - t; - - for (; i < n; ++i) { - w = words[i]; - t = w.datum; - t[as[0]] = w.x + dx; - t[as[1]] = w.y + dy; - t[as[2]] = w.font; - t[as[3]] = w.size; - t[as[4]] = w.style; - t[as[5]] = w.weight; - t[as[6]] = w.rotate; - } - - return pulse.reflow(mod).modifies(as); - }; - - var wordcloud = /*#__PURE__*/Object.freeze({ - __proto__: null, - wordcloud: Wordcloud - }); - - function array8(n) { - return new Uint8Array(n); - } - - function array16(n) { - return new Uint16Array(n); - } - - function array32(n) { - return new Uint32Array(n); - } - /** - * Maintains CrossFilter state. - */ - - - function Bitmaps() { - var width = 8, - _data2 = [], - _seen = array32(0), - _curr = array$2(0, width), - _prev = array$2(0, width); - - return { - data: function data() { - return _data2; - }, - seen: function seen() { - return _seen = lengthen(_seen, _data2.length); - }, - add: function add(array) { - for (var i = 0, j = _data2.length, n = array.length, t; i < n; ++i) { - t = array[i]; - t._index = j++; - - _data2.push(t); - } - }, - remove: function remove(num, map) { - // map: index -> boolean (true => remove) - var n = _data2.length, - copy = Array(n - num), - reindex = _data2, - // reuse old data array for index map - t, - i, - j; // seek forward to first removal - - for (i = 0; !map[i] && i < n; ++i) { - copy[i] = _data2[i]; - reindex[i] = i; - } // condense arrays - - - for (j = i; i < n; ++i) { - t = _data2[i]; - - if (!map[i]) { - reindex[i] = j; - _curr[j] = _curr[i]; - _prev[j] = _prev[i]; - copy[j] = t; - t._index = j++; - } else { - reindex[i] = -1; - } - - _curr[i] = 0; // clear unused bits - } - - _data2 = copy; - return reindex; - }, - size: function size() { - return _data2.length; - }, - curr: function curr() { - return _curr; - }, - prev: function prev() { - return _prev; - }, - reset: function reset(k) { - _prev[k] = _curr[k]; - }, - all: function all() { - return width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff; - }, - set: function set(k, one) { - _curr[k] |= one; - }, - clear: function clear(k, one) { - _curr[k] &= ~one; - }, - resize: function resize(n, m) { - var k = _curr.length; - - if (n > k || m > width) { - width = Math.max(m, width); - _curr = array$2(n, width, _curr); - _prev = array$2(n, width); - } - } - }; - } - - function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; - } - - function array$2(n, m, array) { - var copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; - } - - function Dimension(index, i, query) { - var bit = 1 << i; - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - onAdd: function onAdd(added, curr) { - var dim = this, - range = dim.bisect(dim.range, added.value), - idx = added.index, - lo = range[0], - hi = range[1], - n1 = idx.length, - i; - - for (i = 0; i < lo; ++i) { - curr[idx[i]] |= bit; - } - - for (i = hi; i < n1; ++i) { - curr[idx[i]] |= bit; - } - - return dim; - } - }; - } - /** - * Maintains a list of values, sorted by key. - */ - - - function SortedIndex() { - var _index8 = array32(0), - value = [], - _size = 0; - - function insert(key, data, base) { - if (!data.length) return []; - var n0 = _size, - n1 = data.length, - addv = Array(n1), - addi = array32(n1), - oldv, - oldi, - i; - - for (i = 0; i < n1; ++i) { - addv[i] = key(data[i]); - addi[i] = i; - } - - addv = sort(addv, addi); - - if (n0) { - oldv = value; - oldi = _index8; - value = Array(n0 + n1); - _index8 = array32(n0 + n1); - merge$2(base, oldv, oldi, n0, addv, addi, n1, value, _index8); - } else { - if (base > 0) for (i = 0; i < n1; ++i) { - addi[i] += base; - } - value = addv; - _index8 = addi; - } - - _size = n0 + n1; - return { - index: addi, - value: addv - }; - } - - function remove(num, map) { - // map: index -> remove - var n = _size, - idx, - i, - j; // seek forward to first removal - - for (i = 0; !map[_index8[i]] && i < n; ++i) { - ; - } // condense index and value arrays - - - for (j = i; i < n; ++i) { - if (!map[idx = _index8[i]]) { - _index8[j] = idx; - value[j] = value[i]; - ++j; - } - } - - _size = n - num; - } - - function reindex(map) { - for (var i = 0, n = _size; i < n; ++i) { - _index8[i] = map[_index8[i]]; - } - } - - function bisect(range, array) { - var n; - - if (array) { - n = array.length; - } else { - array = value; - n = _size; - } - - return [bisectLeft(array, range[0], 0, n), bisectRight(array, range[1], 0, n)]; - } - - return { - insert: insert, - remove: remove, - bisect: bisect, - reindex: reindex, - index: function index() { - return _index8; - }, - size: function size() { - return _size; - } - }; - } - - function sort(values, index) { - values.sort.call(index, function (a, b) { - var x = values[a], - y = values[b]; - return x < y ? -1 : x > y ? 1 : 0; - }); - return permute(values, index); - } - - function merge$2(base, value0, index0, n0, value1, index1, n1, value, index) { - var i0 = 0, - i1 = 0, - i; - - for (i = 0; i0 < n0 && i1 < n1; ++i) { - if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - } - - for (; i0 < n0; ++i0, ++i) { - value[i] = value0[i0]; - index[i] = index0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } - } - /** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ - - - function CrossFilter(params) { - Transform.call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; - } - - CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [{ - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, { - 'name': 'query', - 'type': 'array', - 'array': true, - 'required': true, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }] - }; - var prototype$1q = inherits(CrossFilter, Transform); - - prototype$1q.transform = function (_, pulse) { - if (!this._dims) { - return this.init(_, pulse); - } else { - var init = _.modified('fields') || _.fields.some(function (f) { - return pulse.modified(f.fields); - }); - - return init ? this.reinit(_, pulse) : this.eval(_, pulse); - } - }; - - prototype$1q.init = function (_, pulse) { - var fields = _.fields, - query = _.query, - indices = this._indices = {}, - dims = this._dims = [], - m = query.length, - i = 0, - key, - index; // instantiate indices and dimensions - - for (; i < m; ++i) { - key = fields[i].fname; - index = indices[key] || (indices[key] = SortedIndex()); - dims.push(Dimension(index, i, query[i])); - } - - return this.eval(_, pulse); - }; - - prototype$1q.reinit = function (_, pulse) { - var output = pulse.materialize().fork(), - fields = _.fields, - query = _.query, - indices = this._indices, - dims = this._dims, - bits = this.value, - curr = bits.curr(), - prev = bits.prev(), - all = bits.all(), - out = output.rem = output.add, - mod = output.mod, - m = query.length, - adds = {}, - add, - index, - key, - mods, - remMap, - modMap, - i, - n, - f; // set prev to current state - - prev.set(curr); // if pulse has remove tuples, process them first - - if (pulse.rem.length) { - remMap = this.remove(_, pulse, output); - } // if pulse has added tuples, add them to state - - - if (pulse.add.length) { - bits.add(pulse.add); - } // if pulse has modified tuples, create an index map - - - if (pulse.mod.length) { - modMap = {}; - - for (mods = pulse.mod, i = 0, n = mods.length; i < n; ++i) { - modMap[mods[i]._index] = 1; - } - } // re-initialize indices as needed, update curr bitmap - - - for (i = 0; i < m; ++i) { - f = fields[i]; - - if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) { - key = f.fname; - - if (!(add = adds[key])) { - indices[key] = index = SortedIndex(); - adds[key] = add = index.insert(f, pulse.source, 0); - } - - dims[i] = Dimension(index, i, query[i]).onAdd(add, curr); - } - } // visit each tuple - // if filter state changed, push index to add/rem - // else if in mod and passes a filter, push index to mod - - - for (i = 0, n = bits.data().length; i < n; ++i) { - if (remMap[i]) { - // skip if removed tuple - continue; - } else if (prev[i] !== curr[i]) { - // add if state changed - out.push(i); - } else if (modMap[i] && curr[i] !== all) { - // otherwise, pass mods through - mod.push(i); - } - } - - bits.mask = (1 << m) - 1; - return output; - }; - - prototype$1q.eval = function (_, pulse) { - var output = pulse.materialize().fork(), - m = this._dims.length, - mask = 0; - - if (pulse.rem.length) { - this.remove(_, pulse, output); - mask |= (1 << m) - 1; - } - - if (_.modified('query') && !_.modified('fields')) { - mask |= this.update(_, pulse, output); - } - - if (pulse.add.length) { - this.insert(_, pulse, output); - mask |= (1 << m) - 1; - } - - if (pulse.mod.length) { - this.modify(pulse, output); - mask |= (1 << m) - 1; - } - - this.value.mask = mask; - return output; - }; - - prototype$1q.insert = function (_, pulse, output) { - var tuples = pulse.add, - bits = this.value, - dims = this._dims, - indices = this._indices, - fields = _.fields, - adds = {}, - out = output.add, - k = bits.size(), - n = k + tuples.length, - m = dims.length, - j, - key, - add; // resize bitmaps and add tuples as needed - - bits.resize(n, m); - bits.add(tuples); - var curr = bits.curr(), - prev = bits.prev(), - all = bits.all(); // add to dimensional indices - - for (j = 0; j < m; ++j) { - key = fields[j].fname; - add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k)); - dims[j].onAdd(add, curr); - } // set previous filters, output if passes at least one filter - - - for (; k < n; ++k) { - prev[k] = all; - if (curr[k] !== all) out.push(k); - } - }; - - prototype$1q.modify = function (pulse, output) { - var out = output.mod, - bits = this.value, - curr = bits.curr(), - all = bits.all(), - tuples = pulse.mod, - i, - n, - k; - - for (i = 0, n = tuples.length; i < n; ++i) { - k = tuples[i]._index; - if (curr[k] !== all) out.push(k); - } - }; - - prototype$1q.remove = function (_, pulse, output) { - var indices = this._indices, - bits = this.value, - curr = bits.curr(), - prev = bits.prev(), - all = bits.all(), - map = {}, - out = output.rem, - tuples = pulse.rem, - i, - n, - k, - f; // process tuples, output if passes at least one filter - - for (i = 0, n = tuples.length; i < n; ++i) { - k = tuples[i]._index; - map[k] = 1; // build index map - - prev[k] = f = curr[k]; - curr[k] = all; - if (f !== all) out.push(k); - } // remove from dimensional indices - - - for (k in indices) { - indices[k].remove(n, map); - } - - this.reindex(pulse, n, map); - return map; - }; // reindex filters and indices after propagation completes - - - prototype$1q.reindex = function (pulse, num, map) { - var indices = this._indices, - bits = this.value; - pulse.runAfter(function () { - var indexMap = bits.remove(num, map); - - for (var key in indices) { - indices[key].reindex(indexMap); - } - }); - }; - - prototype$1q.update = function (_, pulse, output) { - var dims = this._dims, - query = _.query, - stamp = pulse.stamp, - m = dims.length, - mask = 0, - i, - q; // survey how many queries have changed - - output.filters = 0; - - for (q = 0; q < m; ++q) { - if (_.modified('query', q)) { - i = q; - ++mask; - } - } - - if (mask === 1) { - // only one query changed, use more efficient update - mask = dims[i].one; - this.incrementOne(dims[i], query[i], output.add, output.rem); - } else { - // multiple queries changed, perform full record keeping - for (q = 0, mask = 0; q < m; ++q) { - if (!_.modified('query', q)) continue; - mask |= dims[q].one; - this.incrementAll(dims[q], query[q], stamp, output.add); - output.rem = output.add; // duplicate add/rem for downstream resolve - } - } - - return mask; - }; - - prototype$1q.incrementAll = function (dim, query, stamp, out) { - var bits = this.value, - seen = bits.seen(), - curr = bits.curr(), - prev = bits.prev(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, - j, - k; // Fast incremental update based on previous lo index. - - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } // Fast incremental update based on previous hi index. - - - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - - curr[k] ^= one; - } - } - - dim.range = query.slice(); - }; - - prototype$1q.incrementOne = function (dim, query, add, rem) { - var bits = this.value, - curr = bits.curr(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, - j, - k; // Fast incremental update based on previous lo index. - - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } // Fast incremental update based on previous hi index. - - - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - dim.range = query.slice(); - }; - /** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ - - - function ResolveFilter(params) { - Transform.call(this, null, params); - } - - ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [{ - 'name': 'ignore', - 'type': 'number', - 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' - }, { - 'name': 'filter', - 'type': 'object', - 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' - }] - }; - var prototype$1r = inherits(ResolveFilter, Transform); - - prototype$1r.transform = function (_, pulse) { - var ignore = ~(_.ignore || 0), - // bit mask where zeros -> dims to ignore - bitmap = _.filter, - mask = bitmap.mask; // exit early if no relevant filter changes - - if ((mask & ignore) === 0) return pulse.StopPropagation; - - var output = pulse.fork(pulse.ALL), - data = bitmap.data(), - curr = bitmap.curr(), - prev = bitmap.prev(), - pass = function pass(k) { - return !(curr[k] & ignore) ? data[k] : null; - }; // propagate all mod tuples that pass the filter - - - output.filter(output.MOD, pass); // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - - if (!(mask & mask - 1)) { - // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, function (k) { - return (curr[k] & ignore) === mask ? data[k] : null; - }); - } else { - // multiple filters changed - output.filter(output.ADD, function (k) { - var c = curr[k] & ignore, - f = !c && c ^ prev[k] & ignore; - return f ? data[k] : null; - }); - output.filter(output.REM, function (k) { - var c = curr[k] & ignore, - f = c && !(c ^ (c ^ prev[k] & ignore)); - return f ? data[k] : null; - }); - } // add filter to source data in case of reflow... - - - return output.filter(output.SOURCE, function (t) { - return pass(t._index); - }); - }; - - var xf = /*#__PURE__*/Object.freeze({ - __proto__: null, - crossfilter: CrossFilter, - resolvefilter: ResolveFilter - }); - var version = "5.13.0"; // initialize aria role and label attributes - - function initializeAria(view) { - var el = view.container(); - - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } - } // update aria-label if we have a DOM container element - - - function ariaLabel(el, desc) { - if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc); - } - - function background$1(view) { - // respond to background signal - view.add(null, function (_) { - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { - bg: view._signals.background - }); - } - - var Default = 'default'; - - function cursor(view) { - // get cursor signal, add to dataflow if needed - var cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); // evaluate cursor on each mousemove event - - view.on(view.events('view', 'mousemove'), cursor, function (_, event) { - var value = cursor.value, - user = value ? isString(value) ? value : value.user : Default, - item = event.item && event.item.cursor || null; - return value && user === value.user && item == value.item ? value : { - user: user, - item: item - }; - }); // when cursor signal updates, set visible cursor - - view.add(null, function (_) { - var user = _.cursor, - item = this.value; - - if (!isString(user)) { - item = user.item; - user = user.user; - } - - setCursor(view, user && user !== Default ? user : item || user); - return item; - }, { - cursor: cursor - }); - } - - function setCursor(view, cursor) { - var el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container(); - - if (el) { - return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor; - } - } - - function dataref(view, name) { - var data = view._runtime.data; - - if (!hasOwnProperty(data, name)) { - error('Unrecognized data set: ' + name); - } - - return data[name]; - } - - function data(name, values) { - return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values)); - } - - function change(name, changes) { - if (!isChangeSet(changes)) { - error('Second argument to changes must be a changeset.'); - } - - var dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); - } - - function insert(name, _) { - return change.call(this, name, changeset().insert(_)); - } - - function remove(name, _) { - return change.call(this, name, changeset().remove(_)); - } - - function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); - } - - function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); - } - - function offset$3(view) { - var padding = view.padding(), - origin = view._origin; - return [padding.left + origin[0], padding.top + origin[1]]; - } - - function resizeRenderer(view) { - var origin = offset$3(view), - w = width(view), - h = height(view); - - view._renderer.background(view.background()); - - view._renderer.resize(w, h, origin); - - view._handler.origin(origin); - - view._resizeListeners.forEach(function (handler) { - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); - } - /** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ - - - function eventExtend(view, event, item) { - var r = view._renderer, - el = r && r.canvas(), - p, - e, - translate; - - if (el) { - translate = offset$3(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = point$4(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; - } - - function extension(view, item, point) { - var itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null; - - function group(name) { - var g = itemGroup, - i; - if (name) for (i = item; i; i = i.mark.group) { - if (i.mark.name === name) { - g = i; - break; - } - } - return g && g.mark && g.mark.interactive ? g : {}; - } - - function xy(item) { - if (!item) return point; - if (isString(item)) item = group(item); - var p = point.slice(); - - while (item) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - - return p; - } - - return { - view: constant(view), - item: constant(item || {}), - group: group, - xy: xy, - x: function x(item) { - return xy(item)[0]; - }, - y: function y(item) { - return xy(item)[1]; - } - }; - } - - var VIEW = 'view', - TIMER = 'timer', - WINDOW = 'window', - NO_TRAP = { - trap: false - }; - /** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ - - function initializeEventConfig(config) { - var events = extend({ - defaults: {} - }, config); - - var unpack = function unpack(obj, keys) { - keys.forEach(function (k) { - if (isArray(obj[k])) obj[k] = toSet(obj[k]); - }); - }; - - unpack(events.defaults, ['prevent', 'allow']); - unpack(events, ['view', 'window', 'selector']); - return events; - } - - function prevent(view, type) { - var def = view._eventConfig.defaults, - prevent = def.prevent, - allow = def.allow; - return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault(); - } - - function permit(view, key, type) { - var rule = view._eventConfig && view._eventConfig[key]; - - if (rule === false || isObject(rule) && !rule[type]) { - view.warn("Blocked ".concat(key, " ").concat(type, " event listener.")); - return false; - } - - return true; - } - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ - - - function events$1(source, type, filter) { - var view = this, - s = new EventStream(filter), - send = function send(e, item) { - view.runAsync(null, function () { - if (source === VIEW && prevent(view, type)) { - e.preventDefault(); - } - - s.receive(eventExtend(view, e, item)); - }); - }, - sources; - - if (source === TIMER) { - if (permit(view, 'timer', type)) { - view.timer(send, type); - } - } else if (source === VIEW) { - if (permit(view, 'view', type)) { - // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } - } else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') { - sources = [window]; - } - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) { - sources = document.querySelectorAll(source); - } - } - - if (!sources) { - view.warn('Can not resolve event source: ' + source); - } else { - for (var i = 0, n = sources.length; i < n; ++i) { - sources[i].addEventListener(type, send); - } - - view._eventListeners.push({ - type: type, - sources: sources, - handler: send - }); - } - } - - return s; - } - - function itemFilter(event) { - return event.item; - } - - function markTarget(event) { - // grab upstream collector feeding the mark operator - return event.item.mark.source; - } - - function invoke(name) { - return function (_, event) { - return event.vega.view().changeset().encode(event.item, name); - }; - } - - function hover(hoverSet, leaveSet) { - hoverSet = [hoverSet || 'hover']; - leaveSet = [leaveSet || 'update', hoverSet[0]]; // invoke hover set upon mouseover - - this.on(this.events('view', 'mouseover', itemFilter), markTarget, invoke(hoverSet)); // invoke leave set upon mouseout - - this.on(this.events('view', 'mouseout', itemFilter), markTarget, invoke(leaveSet)); - return this; - } - /** - * Finalize a View instance that is being removed. - * Cancel any running timers. - * Remove all external event listeners. - * Remove any currently displayed tooltip. - */ - - - function finalize() { - var tooltip = this._tooltip, - timers = this._timers, - listeners = this._eventListeners, - n, - m, - e; - n = timers.length; - - while (--n >= 0) { - timers[n].stop(); - } - - n = listeners.length; - - while (--n >= 0) { - e = listeners[n]; - m = e.sources.length; - - while (--m >= 0) { - e.sources[m].removeEventListener(e.type, e.handler); - } - } - - if (tooltip) { - tooltip.call(this, this._handler, null, null, null); - } - - return this; - } - - function element$1(tag, attr, text) { - var el = document.createElement(tag); - - for (var key in attr) { - el.setAttribute(key, attr[key]); - } - - if (text != null) el.textContent = text; - return el; - } - - var BindClass = 'vega-bind', - NameClass = 'vega-bind-name', - RadioClass = 'vega-bind-radio'; - /** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ - - function bind$1(view, el, binding) { - if (!el) return; - var param = binding.param; - var bind = binding.state; - - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: function update(value) { - if (value !== view.signal(param.signal)) { - view.runAsync(null, function () { - bind.source = true; - view.signal(param.signal, value); - }); - } - } - }; - - if (param.debounce) { - bind.update = debounce(param.debounce, bind.update); - } - } - - generate(bind, el, param, view.signal(param.signal)); - - if (!bind.active) { - view.on(view._signals[param.signal], null, function () { - bind.source ? bind.source = false : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - - return bind; - } - /** - * Generate an HTML input form element and bind it to a signal. - */ - - - function generate(bind, el, param, value) { - var div = element$1('div', { - 'class': BindClass - }); - var wrapper = param.input === 'radio' ? div : div.appendChild(element$1('label')); - wrapper.appendChild(element$1('span', { - 'class': NameClass - }, param.name || param.signal)); - el.appendChild(div); - var input = form; - - switch (param.input) { - case 'checkbox': - input = checkbox; - break; - - case 'select': - input = select; - break; - - case 'radio': - input = radio; - break; - - case 'range': - input = range$2; - break; - } - - input(bind, wrapper, param, value); - } - /** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ - - - function form(bind, el, param, value) { - var node = element$1('input'); - - for (var _key8 in param) { - if (_key8 !== 'signal' && _key8 !== 'element') { - node.setAttribute(_key8 === 'input' ? 'type' : _key8, param[_key8]); - } - } - - node.setAttribute('name', param.signal); - node.value = value; - el.appendChild(node); - node.addEventListener('input', function () { - return bind.update(node.value); - }); - bind.elements = [node]; - - bind.set = function (value) { - return node.value = value; - }; - } - /** - * Generates a checkbox input element. - */ - - - function checkbox(bind, el, param, value) { - var attr = { - type: 'checkbox', - name: param.signal - }; - if (value) attr.checked = true; - var node = element$1('input', attr); - el.appendChild(node); - node.addEventListener('change', function () { - return bind.update(node.checked); - }); - bind.elements = [node]; - - bind.set = function (value) { - return node.checked = !!value || null; - }; - } - /** - * Generates a selection list input element. - */ - - - function select(bind, el, param, value) { - var node = element$1('select', { - name: param.signal - }), - labels = param.labels || []; - param.options.forEach(function (option, i) { - var attr = { - value: option - }; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element$1('option', attr, (labels[i] || option) + '')); - }); - el.appendChild(node); - node.addEventListener('change', function () { - bind.update(param.options[node.selectedIndex]); - }); - bind.elements = [node]; - - bind.set = function (value) { - for (var i = 0, n = param.options.length; i < n; ++i) { - if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; - return; - } - } - }; - } - /** - * Generates a radio button group. - */ - - - function radio(bind, el, param, value) { - var group = element$1('span', { - 'class': RadioClass - }), - labels = param.labels || []; - el.appendChild(group); - bind.elements = param.options.map(function (option, i) { - var attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - var input = element$1('input', attr); - input.addEventListener('change', function () { - return bind.update(option); - }); - var label = element$1('label', {}, (labels[i] || option) + ''); - label.prepend(input); - group.appendChild(label); - return input; - }); - - bind.set = function (value) { - var nodes = bind.elements, - n = nodes.length; - - for (var i = 0; i < n; ++i) { - if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - } - }; - } - /** - * Generates a slider input element. - */ - - - function range$2(bind, el, param, value) { - value = value !== undefined ? value : (+param.max + +param.min) / 2; - var max = param.max != null ? param.max : Math.max(100, +value) || 100, - min = param.min || Math.min(0, max, +value) || 0, - step = param.step || tickStep(min, max, 100); - var node = element$1('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - var span = element$1('span', {}, +value); - el.appendChild(node); - el.appendChild(span); - - var update = function update() { - span.textContent = node.value; - bind.update(+node.value); - }; // subscribe to both input and change - - - node.addEventListener('input', update); - node.addEventListener('change', update); - bind.elements = [node]; - - bind.set = function (value) { - node.value = value; - span.textContent = value; - }; - } - - function valuesEqual(a, b) { - return a === b || a + '' === b + ''; - } - - function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r.initialize(el, width(view), height(view), offset$3(view), scaleFactor, opt).background(view.background()); - } - - function trap(view, fn) { - return !fn ? null : function () { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; - } - - function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - var handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset$3(view), view); // transfer event handlers - - if (prevHandler) { - prevHandler.handlers().forEach(function (h) { - handler.on(h.type, h.handler); - }); - } - - return handler; - } - - function initialize$1(el, elBind) { - var view = this, - type = view._renderType, - config = view._eventConfig.bind, - module = renderModule(type); // containing dom element - - el = view._el = el ? lookup$4(view, el) : null; // initialize aria attributes - - initializeAria(view); // select appropriate renderer & handler - - if (!module) view.error('Unrecognized renderer type: ' + type); - var Handler = module.handler || CanvasHandler, - Renderer = el ? module.renderer : module.headless; // initialize renderer and input handler - - view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; // initialize signal bindings - - if (el && config !== 'none') { - elBind = elBind ? view._elBind = lookup$4(view, elBind) : el.appendChild(element$1('form', { - 'class': 'vega-bindings' - })); - - view._bind.forEach(function (_) { - if (_.param.element && config !== 'container') { - _.element = lookup$4(view, _.param.element); - } - }); - - view._bind.forEach(function (_) { - bind$1(view, _.element || elBind, _); - }); - } - - return view; - } - - function lookup$4(view, el) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; - } - } - - if (el) { - try { - el.innerHTML = ''; - } catch (e) { - el = null; - view.error(e); - } - } - - return el; - } - - var number$5 = function number$5(_) { - return +_ || 0; - }; - - var paddingObject = function paddingObject(_) { - return { - top: _, - bottom: _, - left: _, - right: _ - }; - }; - - function padding(_) { - return isObject(_) ? { - top: number$5(_.top), - bottom: number$5(_.bottom), - left: number$5(_.left), - right: number$5(_.right) - } : paddingObject(number$5(_)); - } - /** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ - - - function renderHeadless(_x34, _x35, _x36, _x37) { - return _renderHeadless.apply(this, arguments); - } - /** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ - - - function _renderHeadless() { - _renderHeadless = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(view, type, scaleFactor, opt) { - var module, ctr; - return regeneratorRuntime.wrap(function _callee12$(_context19) { - while (1) { - switch (_context19.prev = _context19.next) { - case 0: - module = renderModule(type), ctr = module && module.headless; - if (!ctr) error('Unrecognized renderer type: ' + type); - _context19.next = 4; - return view.runAsync(); - - case 4: - return _context19.abrupt("return", initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root)); - - case 5: - case "end": - return _context19.stop(); - } - } - }, _callee12); - })); - return _renderHeadless.apply(this, arguments); - } - - function renderToImageURL(_x38, _x39) { - return _renderToImageURL.apply(this, arguments); - } - - function _renderToImageURL() { - _renderToImageURL = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(type, scaleFactor) { - var r; - return regeneratorRuntime.wrap(function _callee13$(_context20) { - while (1) { - switch (_context20.prev = _context20.next) { - case 0: - if (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG) { - error('Unrecognized image type: ' + type); - } - - _context20.next = 3; - return renderHeadless(this, type, scaleFactor); - - case 3: - r = _context20.sent; - return _context20.abrupt("return", type === RenderType.SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png')); - - case 5: - case "end": - return _context20.stop(); - } - } - }, _callee13, this); - })); - return _renderToImageURL.apply(this, arguments); - } - - function toBlobURL(data, mime) { - var blob = new Blob([data], { - type: mime - }); - return window.URL.createObjectURL(blob); - } - /** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ - - - function renderToCanvas(_x40, _x41) { - return _renderToCanvas.apply(this, arguments); - } - /** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ - - - function _renderToCanvas() { - _renderToCanvas = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(scaleFactor, opt) { - var r; - return regeneratorRuntime.wrap(function _callee14$(_context21) { - while (1) { - switch (_context21.prev = _context21.next) { - case 0: - _context21.next = 2; - return renderHeadless(this, RenderType.Canvas, scaleFactor, opt); - - case 2: - r = _context21.sent; - return _context21.abrupt("return", r.canvas()); - - case 4: - case "end": - return _context21.stop(); - } - } - }, _callee14, this); - })); - return _renderToCanvas.apply(this, arguments); - } - - function renderToSVG(_x42) { - return _renderToSVG.apply(this, arguments); - } - - function _renderToSVG() { - _renderToSVG = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(scaleFactor) { - var r; - return regeneratorRuntime.wrap(function _callee15$(_context22) { - while (1) { - switch (_context22.prev = _context22.next) { - case 0: - _context22.next = 2; - return renderHeadless(this, RenderType.SVG, scaleFactor); - - case 2: - r = _context22.sent; - return _context22.abrupt("return", r.svg()); - - case 4: - case "end": - return _context22.stop(); - } - } - }, _callee15, this); - })); - return _renderToSVG.apply(this, arguments); - } - - function data$1(name) { - var data = this.context.data[name]; - return data ? data.values.value : []; - } - - function indata(name, field, value) { - var index = this.context.data[name]['index:' + field], - entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; - } - - function setdata(name, tuples) { - var df = this.context.dataflow, - data = this.context.data[name], - input = data.input; - df.pulse(input, df.changeset().remove(truthy).insert(tuples)); - return 1; - } - - function encode$1(item, name, retval) { - if (item) { - var df = this.context.dataflow, - target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - - return retval !== undefined ? retval : item; - } - - var wrap = function wrap(method) { - return function (value, spec) { - var locale = this.context.dataflow.locale(); - return locale[method](spec)(value); - }; - }; - - var format$3 = wrap('format'); - var timeFormat$1 = wrap('timeFormat'); - var utcFormat$1 = wrap('utcFormat'); - var timeParse$1 = wrap('timeParse'); - var utcParse$1 = wrap('utcParse'); - var dateObj = new Date(2000, 0, 1); - - function time$1(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); - dateObj.setMonth(month); - dateObj.setDate(day); - return timeFormat$1.call(this, dateObj, specifier); - } - - function monthFormat(month) { - return time$1.call(this, month, 1, '%B'); - } - - function monthAbbrevFormat(month) { - return time$1.call(this, month, 1, '%b'); - } - - function dayFormat(day) { - return time$1.call(this, 0, 2 + day, '%A'); - } - - function dayAbbrevFormat(day) { - return time$1.call(this, 0, 2 + day, '%a'); - } - - var DataPrefix = ':'; - var IndexPrefix = '@'; - var ScalePrefix = '%'; - var SignalPrefix = '$'; - var RawCode = 'RawCode'; - var Literal = 'Literal'; - var Property = 'Property'; - var Identifier$1 = 'Identifier'; - var ArrayExpression = 'ArrayExpression'; - var BinaryExpression = 'BinaryExpression'; - var CallExpression = 'CallExpression'; - var ConditionalExpression = 'ConditionalExpression'; - var LogicalExpression = 'LogicalExpression'; - var MemberExpression = 'MemberExpression'; - var ObjectExpression = 'ObjectExpression'; - var UnaryExpression = 'UnaryExpression'; - - function ASTNode(type) { - this.type = type; - } - - ASTNode.prototype.visit = function (visitor) { - var node = this, - c, - i, - n; - if (visitor(node)) return 1; - - for (c = children$1(node), i = 0, n = c.length; i < n; ++i) { - if (c[i].visit(visitor)) return 1; - } - }; - - function children$1(node) { - switch (node.type) { - case ArrayExpression: - return node.elements; - - case BinaryExpression: - case LogicalExpression: - return [node.left, node.right]; - - case CallExpression: - var args = node.arguments.slice(); - args.unshift(node.callee); - return args; - - case ConditionalExpression: - return [node.test, node.consequent, node.alternate]; - - case MemberExpression: - return [node.object, node.property]; - - case ObjectExpression: - return node.properties; - - case Property: - return [node.key, node.value]; - - case UnaryExpression: - return [node.argument]; - - case Identifier$1: - case Literal: - case RawCode: - default: - return []; - } - } - /* - The following expression parser is based on Esprima (http://esprima.org/). - Original header comment and license for Esprima is included here: - Copyright (C) 2013 Ariya Hidayat - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - 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. - 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 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. - */ - - - var TokenName, source$1, index$1, length, lookahead; - var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; - TokenName = {}; - TokenName[TokenBooleanLiteral] = 'Boolean'; - TokenName[TokenEOF] = ''; - TokenName[TokenIdentifier] = 'Identifier'; - TokenName[TokenKeyword] = 'Keyword'; - TokenName[TokenNullLiteral] = 'Null'; - TokenName[TokenNumericLiteral] = 'Numeric'; - TokenName[TokenPunctuator] = 'Punctuator'; - TokenName[TokenStringLiteral] = 'String'; - TokenName[TokenRegularExpression] = 'RegularExpression'; - var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; // Error messages should be identical to V8. - - var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; - var ILLEGAL = 'ILLEGAL', - DISABLED = 'Disabled.'; // See also tools/generate-unicode-regex.py. - - var RegexNonAsciiIdentifierStart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\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u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), - // eslint-disable-next-line no-misleading-character-class - RegexNonAsciiIdentifierPart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\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\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"); // Ensure the condition is true, otherwise throw an error. - // This is only to have a better contract semantic, i.e. another safety net - // to catch a logic error. The condition shall be fulfilled in normal case. - // Do NOT use this to enforce a certain condition on any user input. - - function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - - function isDecimalDigit(ch) { - return ch >= 0x30 && ch <= 0x39; // 0..9 - } - - function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; - } - - function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; - } // 7.2 White Space - - - function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0; - } // 7.3 Line Terminators - - - function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; - } // 7.6 Identifier Names and Identifiers - - - function isIdentifierStart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)); - } - - function isIdentifierPart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)); - } // 7.6.1.1 Keywords - - - var keywords = { - 'if': 1, - 'in': 1, - 'do': 1, - 'var': 1, - 'for': 1, - 'new': 1, - 'try': 1, - 'let': 1, - 'this': 1, - 'else': 1, - 'case': 1, - 'void': 1, - 'with': 1, - 'enum': 1, - 'while': 1, - 'break': 1, - 'catch': 1, - 'throw': 1, - 'const': 1, - 'yield': 1, - 'class': 1, - 'super': 1, - 'return': 1, - 'typeof': 1, - 'delete': 1, - 'switch': 1, - 'export': 1, - 'import': 1, - 'public': 1, - 'static': 1, - 'default': 1, - 'finally': 1, - 'extends': 1, - 'package': 1, - 'private': 1, - 'function': 1, - 'continue': 1, - 'debugger': 1, - 'interface': 1, - 'protected': 1, - 'instanceof': 1, - 'implements': 1 - }; - - function skipComment() { - var ch; - - while (index$1 < length) { - ch = source$1.charCodeAt(index$1); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index$1; - } else { - break; - } - } - } - - function scanHexEscape(prefix) { - var i, - len, - ch, - code = 0; - len = prefix === 'u' ? 4 : 2; - - for (i = 0; i < len; ++i) { - if (index$1 < length && isHexDigit(source$1[index$1])) { - ch = source$1[index$1++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - return String.fromCharCode(code); - } - - function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - ch = source$1[index$1]; - code = 0; // At least, one hex digit is required. - - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - while (index$1 < length) { - ch = source$1[index$1++]; - - if (!isHexDigit(ch)) { - break; - } - - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } // UTF-16 Encoding - - - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - - cu1 = (code - 0x10000 >> 10) + 0xD800; - cu2 = (code - 0x10000 & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); - } - - function getEscapedIdentifier() { - var ch, id; - ch = source$1.charCodeAt(index$1++); - id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character. - - if (ch === 0x5C) { - if (source$1.charCodeAt(index$1) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - ++index$1; - ch = scanHexEscape('u'); - - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - id = ch; - } - - while (index$1 < length) { - ch = source$1.charCodeAt(index$1); - - if (!isIdentifierPart(ch)) { - break; - } - - ++index$1; - id += String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character. - - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - - if (source$1.charCodeAt(index$1) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - ++index$1; - ch = scanHexEscape('u'); - - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - id += ch; - } - } - - return id; - } - - function getIdentifier() { - var start, ch; - start = index$1++; - - while (index$1 < length) { - ch = source$1.charCodeAt(index$1); - - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index$1 = start; - return getEscapedIdentifier(); - } - - if (isIdentifierPart(ch)) { - ++index$1; - } else { - break; - } - } - - return source$1.slice(start, index$1); - } - - function scanIdentifier() { - var start, id, type; - start = index$1; // Backslash (U+005C) starts an escaped character. - - id = source$1.charCodeAt(index$1) === 0x5C ? getEscapedIdentifier() : getIdentifier(); // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { - // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index$1 - }; - } // 7.7 Punctuators - - - function scanPunctuator() { - var start = index$1, - code = source$1.charCodeAt(index$1), - code2, - ch1 = source$1[index$1], - ch2, - ch3, - ch4; - - switch (code) { - // Check for most common single-character punctuators. - case 0x2E: // . dot - - case 0x28: // ( open bracket - - case 0x29: // ) close bracket - - case 0x3B: // ; semicolon - - case 0x2C: // , comma - - case 0x7B: // { open curly brace - - case 0x7D: // } close curly brace - - case 0x5B: // [ - - case 0x5D: // ] - - case 0x3A: // : - - case 0x3F: // ? - - case 0x7E: - // ~ - ++index$1; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index$1 - }; - - default: - code2 = source$1.charCodeAt(index$1 + 1); // '=' (U+003D) marks an assignment or comparison operator. - - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - - case 0x2D: // - - - case 0x2F: // / - - case 0x3C: // < - - case 0x3E: // > - - case 0x5E: // ^ - - case 0x7C: // | - - case 0x25: // % - - case 0x26: // & - - case 0x2A: - // * - index$1 += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index$1 - }; - - case 0x21: // ! - - case 0x3D: - // = - index$1 += 2; // !== and === - - if (source$1.charCodeAt(index$1) === 0x3D) { - ++index$1; - } - - return { - type: TokenPunctuator, - value: source$1.slice(start, index$1), - start: start, - end: index$1 - }; - } - } - - } // 4-character punctuator: >>>= - - - ch4 = source$1.substr(index$1, 4); - - if (ch4 === '>>>=') { - index$1 += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index$1 - }; - } // 3-character punctuators: === !== >>> <<= >>= - - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index$1 += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index$1 - }; - } // Other 2-character punctuators: ++ -- << >> && || - - - ch2 = ch3.substr(0, 2); - - if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') { - index$1 += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index$1 - }; - } // 1-character punctuators: < > = ! + - * % & | ^ / - - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index$1; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index$1 - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL); - } // 7.8.3 Numeric Literals - - - function scanHexLiteral(start) { - var number = ''; - - while (index$1 < length) { - if (!isHexDigit(source$1[index$1])) { - break; - } - - number += source$1[index$1++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - if (isIdentifierStart(source$1.charCodeAt(index$1))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index$1 - }; - } - - function scanOctalLiteral(start) { - var number = '0' + source$1[index$1++]; - - while (index$1 < length) { - if (!isOctalDigit(source$1[index$1])) { - break; - } - - number += source$1[index$1++]; - } - - if (isIdentifierStart(source$1.charCodeAt(index$1)) || isDecimalDigit(source$1.charCodeAt(index$1))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index$1 - }; - } - - function scanNumericLiteral() { - var number, start, ch; - ch = source$1[index$1]; - assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point'); - start = index$1; - number = ''; - - if (ch !== '.') { - number = source$1[index$1++]; - ch = source$1[index$1]; // Hex number starts with '0x'. - // Octal number starts with '0'. - - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index$1; - return scanHexLiteral(start); - } - - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } // decimal number starts with '0' such as '09' is illegal. - - - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - while (isDecimalDigit(source$1.charCodeAt(index$1))) { - number += source$1[index$1++]; - } - - ch = source$1[index$1]; - } - - if (ch === '.') { - number += source$1[index$1++]; - - while (isDecimalDigit(source$1.charCodeAt(index$1))) { - number += source$1[index$1++]; - } - - ch = source$1[index$1]; - } - - if (ch === 'e' || ch === 'E') { - number += source$1[index$1++]; - ch = source$1[index$1]; - - if (ch === '+' || ch === '-') { - number += source$1[index$1++]; - } - - if (isDecimalDigit(source$1.charCodeAt(index$1))) { - while (isDecimalDigit(source$1.charCodeAt(index$1))) { - number += source$1[index$1++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - if (isIdentifierStart(source$1.charCodeAt(index$1))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index$1 - }; - } // 7.8.4 String Literals - - - function scanStringLiteral() { - var str = '', - quote, - start, - ch, - code, - octal = false; - quote = source$1[index$1]; - assert(quote === '\'' || quote === '"', 'String literal must starts with a quote'); - start = index$1; - ++index$1; - - while (index$1 < length) { - ch = source$1[index$1++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source$1[index$1++]; - - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source$1[index$1] === '{') { - ++index$1; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - - break; - - case 'n': - str += '\n'; - break; - - case 'r': - str += '\r'; - break; - - case 't': - str += '\t'; - break; - - case 'b': - str += '\b'; - break; - - case 'f': - str += '\f'; - break; - - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); // \0 is not octal escape sequence - - if (code !== 0) { - octal = true; - } - - if (index$1 < length && isOctalDigit(source$1[index$1])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source$1[index$1++]); // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - - if ('0123'.indexOf(ch) >= 0 && index$1 < length && isOctalDigit(source$1[index$1])) { - code = code * 8 + '01234567'.indexOf(source$1[index$1++]); - } - } - - str += String.fromCharCode(code); - } else { - str += ch; - } - - break; - } - } else { - if (ch === '\r' && source$1[index$1] === '\n') { - ++index$1; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index$1 - }; - } - - function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - - throwError({}, MessageInvalidRegExp); - }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } // First, detect invalid regular expressions. - - - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - - - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } - } - - function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - ch = source$1[index$1]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source$1[index$1++]; - classMarker = false; - terminated = false; - - while (index$1 < length) { - ch = source$1[index$1++]; - str += ch; - - if (ch === '\\') { - ch = source$1[index$1++]; // ECMA-262 7.8.5 - - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } // Exclude leading and trailing slash. - - - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; - } - - function scanRegExpFlags() { - var ch, str, flags; - str = ''; - flags = ''; - - while (index$1 < length) { - ch = source$1[index$1]; - - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index$1; - - if (ch === '\\' && index$1 < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; - } - - function scanRegExp() { - var start, body, flags, value; - lookahead = null; - skipComment(); - start = index$1; - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index$1 - }; - } - - function isIdentifierName(token) { - return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; - } - - function advance() { - var ch; - skipComment(); - - if (index$1 >= length) { - return { - type: TokenEOF, - start: index$1, - end: index$1 - }; - } - - ch = source$1.charCodeAt(index$1); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } // Very common: ( and ) and ; - - - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } // String literal starts with single quote (U+0027) or double quote (U+0022). - - - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - - - if (ch === 0x2E) { - if (isDecimalDigit(source$1.charCodeAt(index$1 + 1))) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - function lex() { - var token; - token = lookahead; - index$1 = token.end; - lookahead = advance(); - index$1 = token.end; - return token; - } - - function peek$1() { - var pos; - pos = index$1; - lookahead = advance(); - index$1 = pos; - } - - function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; - } - - function finishBinaryExpression(operator, left, right) { - var node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; - } - - function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; - } - - function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; - } - - function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; - } - - function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source$1.slice(token.start, token.end); - - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - - node.regex = token.regex; - } - - return node; - } - - function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; - } - - function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; - } - - function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; - } - - function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; - } // Throw an exception - - - function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace(/%(\d)/g, function (whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - }); - error = new Error(msg); - error.index = index$1; - error.description = msg; - throw error; - } // Throw an exception because of the token. - - - function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } // BooleanLiteral, NullLiteral, or Punctuator. - - - throwError(token, MessageUnexpectedToken, token.value); - } // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - - - function expect(value) { - var token = lex(); - - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } - } // Return true if the next token matches the specified punctuator. - - - function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; - } // Return true if the next token matches the specified keyword - - - function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; - } // 11.1.4 Array Initialiser - - - function parseArrayInitialiser() { - var elements = []; - index$1 = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - return finishArrayExpression(elements); - } // 11.1.5 Object Initialiser - - - function parseObjectPropertyKey() { - var token; - index$1 = lookahead.start; - token = lex(); // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - - return finishLiteral(token); - } - - return finishIdentifier(token.value); - } - - function parseObjectProperty() { - var token, key, id, value; - index$1 = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } - } - - function parseObjectInitialiser() { - var properties = [], - property, - name, - key, - map = {}, - toString = String; - index$1 = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - return finishObjectExpression(properties); - } // 11.1.6 The Grouping Operator - - - function parseGroupExpression() { - var expr; - expect('('); - expr = parseExpression(); - expect(')'); - return expr; - } // 11.1 Primary Expressions - - - var legalKeywords = { - 'if': 1 - }; - - function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index$1 = lookahead.start; - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = token.value === 'true'; - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek$1(); - } else { - throwUnexpected(lex()); - } - - return expr; - } // 11.2 Left-Hand-Side Expressions - - - function parseArguments() { - var args = []; - expect('('); - - if (!match(')')) { - while (index$1 < length) { - args.push(parseConditionalExpression()); - - if (match(')')) { - break; - } - - expect(','); - } - } - - expect(')'); - return args; - } - - function parseNonComputedProperty() { - var token; - index$1 = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); - } - - function parseNonComputedMember() { - expect('.'); - return parseNonComputedProperty(); - } - - function parseComputedMember() { - var expr; - expect('['); - expr = parseExpression(); - expect(']'); - return expr; - } - - function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; - } // 11.3 Postfix Expressions - - - function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if (match('++') || match('--')) { - throw new Error(DISABLED); - } - } - - return expr; - } // 11.4 Unary Operators - - - function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; - } - - function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - } - - return prec; - } // 11.5 Multiplicative Operators - // 11.6 Additive Operators - // 11.7 Bitwise Shift Operators - // 11.8 Relational Operators - // 11.9 Equality Operators - // 11.10 Binary Bitwise Operators - // 11.11 Binary Logical Operators - - - function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - marker = lookahead; - left = parseUnaryExpression(); - token = lookahead; - prec = binaryPrecedence(token); - - if (prec === 0) { - return left; - } - - token.prec = prec; - lex(); - markers = [marker, lookahead]; - right = parseUnaryExpression(); - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - // Reduce: make a binary expression from the three topmost entries. - while (stack.length > 2 && prec <= stack[stack.length - 2].prec) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } // Shift. - - - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } // Final reduce to clean-up the stack. - - - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; - } // 11.12 Conditional Operator - - - function parseConditionalExpression() { - var expr, consequent, alternate; - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; - } // 11.14 Comma Operator - - - function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; - } - - function parse$3(code) { - source$1 = code; - index$1 = 0; - length = source$1.length; - lookahead = null; - peek$1(); - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - - return expr; - } - - var constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' - }; - - function functions(codegen) { - function fncall(name, args, cast, type) { - var obj = codegen(args[0]); - - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - - return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')'); - } - - function fn(name, cast, type) { - return function (args) { - return fncall(name, args, cast, type); - }; - } - - var DATE = 'new Date', - STRING = 'String', - REGEXP = 'RegExp'; - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - clamp: function clamp(args) { - if (args.length < 3) error('Missing arguments to clamp function.'); - if (args.length > 3) error('Too many arguments to clamp function.'); - var a = args.map(codegen); - return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))'; - }, - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - // sequence functions - length: fn('length', null, -1), - join: fn('join', null), - indexof: fn('indexOf', null), - lastindexof: fn('lastIndexOf', null), - slice: fn('slice', null), - reverse: function reverse(args) { - return '(' + codegen(args[0]) + ').slice().reverse()'; - }, - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - replace: fn('replace', STRING), - trim: fn('trim', STRING, 0), - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - // Control Flow functions - if: function _if(args) { - if (args.length < 3) error('Missing arguments to if function.'); - if (args.length > 3) error('Too many arguments to if function.'); - var a = args.map(codegen); - return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')'; - } - }; - } - - function stripQuotes(s) { - var n = s && s.length - 1; - return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s; - } - - function codegen(opt) { - opt = opt || {}; - var whitelist = opt.whitelist ? toSet(opt.whitelist) : {}, - blacklist = opt.blacklist ? toSet(opt.blacklist) : {}, - constants$1 = opt.constants || constants, - functions$1 = (opt.functions || functions)(visit), - globalvar = opt.globalvar, - fieldvar = opt.fieldvar, - globals = {}, - fields = {}, - memberDepth = 0; - var outputGlobal = isFunction(globalvar) ? globalvar : function (id) { - return globalvar + '["' + id + '"]'; - }; - - function visit(ast) { - if (isString(ast)) return ast; - var generator = Generators[ast.type]; - if (generator == null) error('Unsupported type: ' + ast.type); - return generator(ast); - } - - var Generators = { - Literal: function Literal(n) { - return n.raw; - }, - Identifier: function Identifier(n) { - var id = n.name; - - if (memberDepth > 0) { - return id; - } else if (hasOwnProperty(blacklist, id)) { - return error('Illegal identifier: ' + id); - } else if (hasOwnProperty(constants$1, id)) { - return constants$1[id]; - } else if (hasOwnProperty(whitelist, id)) { - return id; - } else { - globals[id] = 1; - return outputGlobal(id); - } - }, - MemberExpression: function MemberExpression(n) { - var d = !n.computed; - var o = visit(n.object); - if (d) memberDepth += 1; - var p = visit(n.property); - - if (o === fieldvar) { - // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - } - - if (d) memberDepth -= 1; - return o + (d ? '.' + p : '[' + p + ']'); - }, - CallExpression: function CallExpression(n) { - if (n.callee.type !== 'Identifier') { - error('Illegal callee type: ' + n.callee.type); - } - - var callee = n.callee.name; - var args = n.arguments; - var fn = hasOwnProperty(functions$1, callee) && functions$1[callee]; - if (!fn) error('Unrecognized function: ' + callee); - return isFunction(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')'; - }, - ArrayExpression: function ArrayExpression(n) { - return '[' + n.elements.map(visit).join(',') + ']'; - }, - BinaryExpression: function BinaryExpression(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - UnaryExpression: function UnaryExpression(n) { - return '(' + n.operator + visit(n.argument) + ')'; - }, - ConditionalExpression: function ConditionalExpression(n) { - return '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')'; - }, - LogicalExpression: function LogicalExpression(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - ObjectExpression: function ObjectExpression(n) { - return '{' + n.properties.map(visit).join(',') + '}'; - }, - Property: function Property(n) { - memberDepth += 1; - var k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - - function codegen(ast) { - var result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; - } - - codegen.functions = functions$1; - codegen.constants = constants$1; - return codegen; - } - - function dataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) { - error('First argument to data functions must be a string literal.'); - } - - var data = args[0].value, - dataName = DataPrefix + data; - - if (!hasOwnProperty(dataName, params)) { - try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) {// if data set does not exist, there's nothing to track - } - } - } - - function indataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to indata must be a string literal.'); - if (args[1].type !== Literal) error('Second argument to indata must be a string literal.'); - var data = args[0].value, - field = args[1].value, - indexName = IndexPrefix + field; - - if (!hasOwnProperty(indexName, params)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - } - - function scaleVisitor(name, args, scope, params) { - if (args[0].type === Literal) { - // add scale dependency - addScaleDependency(scope, params, args[0].value); - } else { - // indirect scale lookup; add all scales as parameters - for (name in scope.scales) { - addScaleDependency(scope, params, name); - } - } - } - - function addScaleDependency(scope, params, name) { - var scaleName = ScalePrefix + name; - - if (!hasOwnProperty(params, scaleName)) { - try { - params[scaleName] = scope.scaleRef(name); - } catch (err) {// TODO: error handling? warning? - } - } - } - - function getScale(name, ctx) { - var s; - return isFunction(name) ? name : isString(name) ? (s = ctx.scales[name]) && s.value : undefined; - } - - function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = function (s) { - return s && s.bandwidth ? s.bandwidth() : 0; - }; // register AST visitors for internal scale functions - - - visitors._bandwidth = scaleVisitor; - visitors._range = scaleVisitor; - visitors._scale = scaleVisitor; // resolve scale reference directly to the signal hash argument - - var ref = function ref(arg) { - return '_[' + (arg.type === Literal ? $(ScalePrefix + arg.value) : $(ScalePrefix) + '+' + codegen(arg)) + ']'; - }; // define and return internal scale function code generators - // these internal functions are called by mark encoders - - - return { - _bandwidth: function _bandwidth(args) { - return "this.__bandwidth(".concat(ref(args[0]), ")"); - }, - _range: function _range(args) { - return "".concat(ref(args[0]), ".range()"); - }, - _scale: function _scale(args) { - return "".concat(ref(args[0]), "(").concat(codegen(args[1]), ")"); - } - }; - } - - function geoMethod(methodName, globalMethod) { - return function (projection, geojson, group) { - if (projection) { - // projection defined, use it - var p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else { - // projection undefined, use global method - return globalMethod(geojson); - } - }; - } - - var geoArea = geoMethod('area', area$3); - var geoBounds = geoMethod('bounds', bounds$1); - var geoCentroid = geoMethod('centroid', centroid); - - function inScope(item) { - var group = this.context.group, - value = false; - if (group) while (item) { - if (item === group) { - value = true; - break; - } - - item = item.mark.group; - } - return value; - } - - function log$4(df, method, args) { - try { - df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args))); - } catch (err) { - df.warn(err); - } - - return args[args.length - 1]; - } - - function warn() { - return log$4(this.context.dataflow, 'warn', arguments); - } - - function info() { - return log$4(this.context.dataflow, 'info', arguments); - } - - function debug() { - return log$4(this.context.dataflow, 'debug', arguments); - } // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - - - function channel_luminance_value(channelValue) { - var val = channelValue / 255; - - if (val <= 0.03928) { - return val / 12.92; - } - - return Math.pow((val + 0.055) / 1.055, 2.4); - } - - function luminance(color) { - var c = rgb(color), - r = channel_luminance_value(c.r), - g = channel_luminance_value(c.g), - b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; - } // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef - - - function contrast(color1, color2) { - var lum1 = luminance(color1), - lum2 = luminance(color2), - lumL = Math.max(lum1, lum2), - lumD = Math.min(lum1, lum2); - return (lumL + 0.05) / (lumD + 0.05); - } - - function merge$3() { - var args = [].slice.call(arguments); - args.unshift({}); - return extend.apply(null, args); - } - - function equal(a, b) { - return a === b || a !== a && b !== b ? true : isArray(a) ? isArray(b) && a.length === b.length ? equalArray(a, b) : false : isObject(a) && isObject(b) ? equalObject(a, b) : false; - } - - function equalArray(a, b) { - for (var i = 0, n = a.length; i < n; ++i) { - if (!equal(a[i], b[i])) return false; - } - - return true; - } - - function equalObject(a, b) { - for (var _key9 in a) { - if (!equal(a[_key9], b[_key9])) return false; - } - - return true; - } - - function removePredicate(props) { - return function (_) { - return equalObject(props, _); - }; - } - - function modify(name, insert, remove, toggle, modify, values) { - var df = this.context.dataflow, - data = this.context.data[name], - input = data.input, - changes = data.changes, - stamp = df.stamp(), - predicate, - key; - - if (df._trigger === false || !(input.value.length || insert || toggle)) { - // nothing to do! - return 0; - } - - if (!changes || changes.stamp < stamp) { - data.changes = changes = df.changeset(); - changes.stamp = stamp; - df.runAfter(function () { - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - - if (remove) { - predicate = remove === true ? truthy : isArray(remove) || isTuple(remove) ? remove : removePredicate(remove); - changes.remove(predicate); - } - - if (insert) { - changes.insert(insert); - } - - if (toggle) { - predicate = removePredicate(toggle); - - if (input.value.some(predicate)) { - changes.remove(predicate); - } else { - changes.insert(toggle); - } - } - - if (modify) { - for (key in values) { - changes.modify(modify, key, values[key]); - } - } - - return 1; - } - - function pinchDistance(event) { - var t = event.touches, - dx = t[0].clientX - t[1].clientX, - dy = t[0].clientY - t[1].clientY; - return Math.sqrt(dx * dx + dy * dy); - } - - function pinchAngle(event) { - var t = event.touches; - return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); - } - - function bandspace(count, paddingInner, paddingOuter) { - return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0); - } - - function bandwidth(name, group) { - var s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; - } - - function copy$2(name, group) { - var s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; - } - - function domain(name, group) { - var s = getScale(name, (group || this).context); - return s ? s.domain() : []; - } - - function invert(name, range, group) { - var s = getScale(name, (group || this).context); - return !s ? undefined : isArray(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range); - } - - function range$3(name, group) { - var s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; - } - - function scale$3(name, value, group) { - var s = getScale(name, (group || this).context); - return s ? s(value) : undefined; - } - - function scaleGradient(scale, p0, p1, count, group) { - scale = getScale(scale, (group || this).context); - var gradient = Gradient(p0, p1); - var stops = scale.domain(), - min = stops[0], - max = peek(stops), - fraction = identity; - - if (!(max - min)) { - // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator ? scale$2('sequential')().interpolator(scale.interpolator()) : scale$2('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([min = 0, max = 1]); - } else { - fraction = scaleFraction(scale, min, max); - } - - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== peek(stops)) stops.push(max); - } - - stops.forEach(function (_) { - return gradient.stop(fraction(_), scale(_)); - }); - return gradient; - } - - function geoShape(projection, geojson, group) { - var p = getScale(projection, (group || this).context); - return function (context) { - return p ? p.path.context(context)(geojson) : ''; - }; - } - - function pathShape(path) { - var p = null; - return function (context) { - return context ? pathRender(context, p = p || pathParse(path)) : path; - }; - } - - var datum = function datum(d) { - return d.data; - }; - - function treeNodes(name, context) { - var tree = data$1.call(context, name); - return tree.root && tree.root.lookup || {}; - } - - function treePath(name, source, target) { - var nodes = treeNodes(name, this), - s = nodes[source], - t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; - } - - function treeAncestors(name, node) { - var n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; - } - - var _window = function _window() { - return typeof window !== 'undefined' && window || null; - }; - - function screen() { - var w = _window(); - - return w ? w.screen : {}; - } - - function windowSize() { - var w = _window(); - - return w ? [w.innerWidth, w.innerHeight] : [undefined, undefined]; - } - - function containerSize() { - var view = this.context.dataflow, - el = view.container && view.container(); - return el ? [el.clientWidth, el.clientHeight] : [undefined, undefined]; - } - - var Intersect = 'intersect'; - var Union = 'union'; - var VlMulti = 'vlMulti'; - var Or = 'or'; - var And = 'and'; - var TYPE_ENUM = 'E', - TYPE_RANGE_INC = 'R', - TYPE_RANGE_EXC = 'R-E', - TYPE_RANGE_LE = 'R-LE', - TYPE_RANGE_RE = 'R-RE', - UNIT_INDEX = 'index:unit'; // TODO: revisit date coercion? - - function testPoint(datum, entry) { - var fields = entry.fields, - values = entry.values, - n = fields.length, - i = 0, - dval, - f; - - for (; i < n; ++i) { - f = fields[i]; - f.getter = field.getter || field(f.field); - dval = f.getter(datum); - if (isDate(dval)) dval = toNumber(dval); - if (isDate(values[i])) values[i] = toNumber(values[i]); - if (isDate(values[i][0])) values[i] = values[i].map(toNumber); - - if (f.type === TYPE_ENUM) { - // Enumerated fields can either specify individual values (single/multi selections) - // or an array of values (interval selections). - if (isArray(values[i]) ? values[i].indexOf(dval) < 0 : dval !== values[i]) { - return false; - } - } else { - if (f.type === TYPE_RANGE_INC) { - if (!inrange(dval, values[i])) return false; - } else if (f.type === TYPE_RANGE_RE) { - // Discrete selection of bins test within the range [bin_start, bin_end). - if (!inrange(dval, values[i], true, false)) return false; - } else if (f.type === TYPE_RANGE_EXC) { - // 'R-E'/'R-LE' included for completeness. - if (!inrange(dval, values[i], false, false)) return false; - } else if (f.type === TYPE_RANGE_LE) { - if (!inrange(dval, values[i], false, true)) return false; - } - } - } - - return true; - } - /** - * Tests if a tuple is contained within an interactive selection. - * @param {string} name - The name of the data set representing the selection. - * Tuples in the dataset are of the form - * {unit: string, fields: array, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ - - - function selectionTest(name, datum, op) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, - intersect = op === Intersect, - n = entries.length, - i = 0, - entry, - miss, - count, - unit, - b; - - for (; i < n; ++i) { - entry = entries[i]; - - if (unitIdx && intersect) { - // multi selections union within the same unit and intersect across units. - miss = miss || {}; - count = miss[unit = entry.unit] || 0; // if we've already matched this unit, skip. - - if (count === -1) continue; - b = testPoint(datum, entry); - miss[unit] = b ? -1 : ++count; // if we match and there are no other units return true - // if we've missed against all tuples in this unit return false - - if (b && unitIdx.size === 1) return true; - if (!b && count === unitIdx.get(unit).count) return false; - } else { - b = testPoint(datum, entry); // if we find a miss and we do require intersection return false - // if we find a match and we don't require intersection return true - - if (intersect ^ b) return b; - } - } // if intersecting and we made it here, then we saw no misses - // if not intersecting, then we saw no matches - // if no active selections, return false - - - return n && intersect; - } - /** - * Resolves selection for use as a scale domain or reads via the API. - * @param {string} name - The name of the dataset representing the selection - * @param {string} [op='union'] - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @returns {object} An object of selected fields and values. - */ - - - function selectionResolve(name, op, isMulti) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - resolved = {}, - multiRes = {}, - types = {}, - entry, - fields, - values, - unit, - field, - res, - resUnit, - type, - union, - n = entries.length, - i = 0, - j, - m; // First union all entries within the same unit. - - for (; i < n; ++i) { - entry = entries[i]; - unit = entry.unit; - fields = entry.fields; - values = entry.values; - - for (j = 0, m = fields.length; j < m; ++j) { - field = fields[j]; - res = resolved[field.field] || (resolved[field.field] = {}); - resUnit = res[unit] || (res[unit] = []); - types[field.field] = type = field.type.charAt(0); - union = ops[type + '_union']; - res[unit] = union(resUnit, array(values[j])); - } // If the same multi-selection is repeated over views and projected over - // an encoding, it may operate over different fields making it especially - // tricky to reliably resolve it. At best, we can de-dupe identical entries - // but doing so may be more computationally expensive than it is worth. - // Instead, for now, we simply transform our store representation into - // a more human-friendly one. - - - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push(array(values).reduce(function (obj, curr, j) { - return obj[fields[j].field] = curr, obj; - }, {})); - } - } // Then resolve fields across units as per the op. - - - op = op || Union; - Object.keys(resolved).forEach(function (field) { - resolved[field] = Object.keys(resolved[field]).map(function (unit) { - return resolved[field][unit]; - }).reduce(function (acc, curr) { - return acc === undefined ? curr : ops[types[field] + '_' + op](acc, curr); - }); - }); - entries = Object.keys(multiRes); - - if (isMulti && entries.length) { - resolved[VlMulti] = op === Union ? _defineProperty({}, Or, entries.reduce(function (acc, k) { - return acc.push.apply(acc, multiRes[k]), acc; - }, [])) : _defineProperty({}, And, entries.map(function (k) { - return _defineProperty({}, Or, multiRes[k]); - })); - } - - return resolved; - } - - var ops = { - E_union: function E_union(base, value) { - if (!base.length) return value; - var i = 0, - n = value.length; - - for (; i < n; ++i) { - if (base.indexOf(value[i]) < 0) base.push(value[i]); - } - - return base; - }, - E_intersect: function E_intersect(base, value) { - return !base.length ? value : base.filter(function (v) { - return value.indexOf(v) >= 0; - }); - }, - R_union: function R_union(base, value) { - var lo = toNumber(value[0]), - hi = toNumber(value[1]); - - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; - }, - R_intersect: function R_intersect(base, value) { - var lo = toNumber(value[0]), - hi = toNumber(value[1]); - - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - - if (hi < base[0] || base[1] < lo) { - return []; - } else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - - return base; - } - }; - var DataPrefix$1 = ':', - IndexPrefix$1 = '@'; - - function selectionVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to selection functions must be a string literal.'); - var data = args[0].value, - op = args.length >= 2 && peek(args).value, - field = 'unit', - indexName = IndexPrefix$1 + field, - dataName = DataPrefix$1 + data; // eslint-disable-next-line no-prototype-builtins - - if (op === Intersect && !hasOwnProperty(params, indexName)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } // eslint-disable-next-line no-prototype-builtins - - - if (!hasOwnProperty(params, dataName)) { - params[dataName] = scope.getData(data).tuplesRef(); - } - } - - function intersect$3(b, opt, group) { - if (!b) return []; - - var _b4 = _slicedToArray(b, 2), - u = _b4[0], - v = _b4[1], - box = new Bounds().set(u[0], u[1], v[0], v[1]), - scene = group || this.context.dataflow.scenegraph().root; - - return intersect$1(scene, box, filter$1(opt)); - } - - function filter$1(opt) { - var p = null; - - if (opt) { - var types = array(opt.marktype), - names = array(opt.markname); - - p = function p(_) { - return (!types.length || types.some(function (t) { - return _.marktype === t; - })) && (!names.length || names.some(function (s) { - return _.name === s; - })); - }; - } - - return p; - } // Expression function context object - - - var functionContext = { - random: function random() { - return exports.random(); - }, - // override default - cumulativeNormal: cumulativeNormal, - cumulativeLogNormal: cumulativeLogNormal, - cumulativeUniform: cumulativeUniform, - densityNormal: densityNormal, - densityLogNormal: densityLogNormal, - densityUniform: densityUniform, - quantileNormal: quantileNormal, - quantileLogNormal: quantileLogNormal, - quantileUniform: quantileUniform, - sampleNormal: sampleNormal, - sampleLogNormal: sampleLogNormal, - sampleUniform: sampleUniform, - isArray: isArray, - isBoolean: isBoolean, - isDate: isDate, - isDefined: function isDefined(_) { - return _ !== undefined; - }, - isNumber: isNumber, - isObject: isObject, - isRegExp: isRegExp, - isString: isString, - isTuple: isTuple, - isValid: function isValid(_) { - return _ != null && _ === _; - }, - toBoolean: toBoolean, - toDate: toDate, - toNumber: toNumber, - toString: toString, - flush: flush, - lerp: lerp, - merge: merge$3, - pad: pad, - peek: peek, - span: span, - inrange: inrange, - truncate: truncate, - rgb: rgb, - lab: lab, - hcl: hcl, - hsl: hsl, - luminance: luminance, - contrast: contrast, - sequence: sequence, - format: format$3, - utcFormat: utcFormat$1, - utcParse: utcParse$1, - utcOffset: utcOffset, - utcSequence: utcSequence, - timeFormat: timeFormat$1, - timeParse: timeParse$1, - timeOffset: timeOffset, - timeSequence: timeSequence, - timeUnitSpecifier: timeUnitSpecifier, - monthFormat: monthFormat, - monthAbbrevFormat: monthAbbrevFormat, - dayFormat: dayFormat, - dayAbbrevFormat: dayAbbrevFormat, - quarter: quarter, - utcquarter: utcquarter, - week: week, - utcweek: utcweek, - dayofyear: dayofyear, - utcdayofyear: utcdayofyear, - warn: warn, - info: info, - debug: debug, - extent: extent, - inScope: inScope, - intersect: intersect$3, - clampRange: clampRange, - pinchDistance: pinchDistance, - pinchAngle: pinchAngle, - screen: screen, - containerSize: containerSize, - windowSize: windowSize, - bandspace: bandspace, - setdata: setdata, - pathShape: pathShape, - panLinear: panLinear, - panLog: panLog, - panPow: panPow, - panSymlog: panSymlog, - zoomLinear: zoomLinear, - zoomLog: zoomLog, - zoomPow: zoomPow, - zoomSymlog: zoomSymlog, - encode: encode$1, - modify: modify - }; - var eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'], - // event functions - eventPrefix = 'event.vega.', - // event function prefix - thisPrefix = 'this.', - // function context prefix - astVisitors = {}; // AST visitors for dependency analysis - // Build expression function registry - - function buildFunctions(codegen) { - var fn = functions(codegen); - eventFunctions.forEach(function (name) { - return fn[name] = eventPrefix + name; - }); - - for (var name in functionContext) { - fn[name] = thisPrefix + name; - } - - extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; - } // Register an expression function - - - function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) { - return functionContext[name]; - } // register with the functionContext - - - functionContext[name] = fn; // if there is an astVisitor register that, too - - if (visitor) astVisitors[name] = visitor; // if the code generator has already been initialized, - // we need to also register the function with it - - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; - } // register expression functions with ast visitors - - - expressionFunction('bandwidth', bandwidth, scaleVisitor); - expressionFunction('copy', copy$2, scaleVisitor); - expressionFunction('domain', domain, scaleVisitor); - expressionFunction('range', range$3, scaleVisitor); - expressionFunction('invert', invert, scaleVisitor); - expressionFunction('scale', scale$3, scaleVisitor); - expressionFunction('gradient', scaleGradient, scaleVisitor); - expressionFunction('geoArea', geoArea, scaleVisitor); - expressionFunction('geoBounds', geoBounds, scaleVisitor); - expressionFunction('geoCentroid', geoCentroid, scaleVisitor); - expressionFunction('geoShape', geoShape, scaleVisitor); - expressionFunction('indata', indata, indataVisitor); - expressionFunction('data', data$1, dataVisitor); - expressionFunction('treePath', treePath, dataVisitor); - expressionFunction('treeAncestors', treeAncestors, dataVisitor); // register Vega-Lite selection functions - - expressionFunction('vlSelectionTest', selectionTest, selectionVisitor); - expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor); // Export code generator and parameters - - var codegenParams = { - blacklist: ['_'], - whitelist: ['datum', 'event', 'item'], - fieldvar: 'datum', - globalvar: function globalvar(id) { - return '_[' + $(SignalPrefix + id) + ']'; - }, - functions: buildFunctions, - constants: constants, - visitors: astVisitors - }; - var codeGenerator = codegen(codegenParams); - - function parseExpression$1(expr, scope) { - var params = {}, - ast, - gen; // parse the expression to an abstract syntax tree (ast) - - try { - expr = isString(expr) ? expr : $(expr) + ''; - ast = parse$3(expr); - } catch (err) { - error('Expression parse error: ' + expr); - } // analyze ast function calls for dependencies - - - ast.visit(function (node) { - if (node.type !== CallExpression) return; - var name = node.callee.name, - visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); - }); // perform code generation - - gen = codeGenerator(ast); // collect signal dependencies - - gen.globals.forEach(function (name) { - var signalName = SignalPrefix + name; - - if (!hasOwnProperty(params, signalName) && scope.getSignal(name)) { - params[signalName] = scope.signalRef(name); - } - }); // return generated expression code and dependencies - - return { - $expr: extend({ - code: gen.code - }, scope.options.ast ? { - ast: ast - } : null), - $fields: gen.fields, - $params: params - }; - } - /** - * Parse a serialized dataflow specification. - */ - - - function parse$4(spec) { - var ctx = this, - operators = spec.operators || []; // parse background - - if (spec.background) { - ctx.background = spec.background; - } // parse event configuration - - - if (spec.eventConfig) { - ctx.eventConfig = spec.eventConfig; - } // parse locale configuration - - - if (spec.locale) { - ctx.locale = spec.locale; - } // parse operators - - - operators.forEach(function (entry) { - return ctx.parseOperator(entry); - }); // parse operator parameters - - operators.forEach(function (entry) { - return ctx.parseOperatorParameters(entry); - }); // parse streams - - (spec.streams || []).forEach(function (entry) { - return ctx.parseStream(entry); - }); // parse updates - - (spec.updates || []).forEach(function (entry) { - return ctx.parseUpdate(entry); - }); - return ctx.resolve(); - } - - var Skip = toSet(['rule']), - Swap = toSet(['group', 'image', 'rect']); - - function adjustSpatial(encode, marktype) { - var code = ''; - if (Skip[marktype]) return code; - - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) { - code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - } - - code += 'o.width=o.x2-o.x;'; - } else { - code += 'o.x=o.x2-(o.width||0);'; - } - } - - if (encode.xc) { - code += 'o.x=o.xc-(o.width||0)/2;'; - } - - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) { - code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - } - - code += 'o.height=o.y2-o.y;'; - } else { - code += 'o.y=o.y2-(o.height||0);'; - } - } - - if (encode.yc) { - code += 'o.y=o.yc-(o.height||0)/2;'; - } - - return code; - } - - function canonicalType(type) { - return (type + '').toLowerCase(); - } - - function isOperator(type) { - return canonicalType(type) === 'operator'; - } - - function isCollect(type) { - return canonicalType(type) === 'collect'; - } - - function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (code[code.length - 1] !== ';') { - code = 'return(' + code + ');'; - } - - var fn = Function.apply(null, args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; - } // generate code for comparing a single field - - - function _compare(u, v, lt, gt) { - return "((u = ".concat(u, ") < (v = ").concat(v, ") || u == null) && v != null ? ").concat(lt, "\n : (u > v || v == null) && u != null ? ").concat(gt, "\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(lt, "\n : v !== v && u === u ? ").concat(gt, " : "); - } - - var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ - operator: function operator(ctx, expr) { - return expression(ctx, ['_'], expr.code); - }, - - /** - * Parse an expression provided as an operator parameter value. - */ - parameter: function parameter(ctx, expr) { - return expression(ctx, ['datum', '_'], expr.code); - }, - - /** - * Parse an expression applied to an event stream. - */ - event: function event(ctx, expr) { - return expression(ctx, ['event'], expr.code); - }, - - /** - * Parse an expression used to handle an event-driven operator update. - */ - handler: function handler(ctx, expr) { - var code = "var datum=event.item&&event.item.datum;return ".concat(expr.code, ";"); - return expression(ctx, ['_', 'event'], code); - }, - - /** - * Parse an expression that performs visual encoding. - */ - encode: function encode(ctx, _encode) { - var marktype = _encode.marktype, - channels = _encode.channels; - var code = 'var o=item,datum=o.datum,m=0,$;'; - - for (var name in channels) { - var o = 'o[' + $(name) + ']'; - code += "$=".concat(channels[name].code, ";if(").concat(o, "!==$)").concat(o, "=$,m=1;"); - } - - code += adjustSpatial(channels, marktype); - code += 'return m;'; - return expression(ctx, ['item', '_'], code); - }, - - /** - * Optimized code generators for access and comparison. - */ - codegen: { - get: function get(path) { - var ref = "[".concat(path.map($).join(']['), "]"); - var get = Function('_', "return _".concat(ref, ";")); - get.path = ref; - return get; - }, - comparator: function comparator(fields, orders) { - var t; - - var map = function map(f, i) { - var o = orders[i]; - var u, v; - - if (f.path) { - u = "a".concat(f.path); - v = "b".concat(f.path); - } else { - (t = t || {})['f' + i] = f; - u = "this.f".concat(i, "(a)"); - v = "this.f".concat(i, "(b)"); - } - - return _compare(u, v, -o, o); - }; - - var fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } - }; - /** - * Parse a dataflow operator. - */ - - function parseOperator(spec) { - var ctx = this; - - if (isOperator(spec.type) || !spec.type) { - ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); - } else { - ctx.transform(spec, spec.type); - } - } - /** - * Parse and assign operator parameters. - */ - - - function parseOperatorParameters(spec) { - var ctx = this; - - if (spec.params) { - var op = ctx.get(spec.id); - if (!op) error('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); - } - } - /** - * Parse a set of operator parameters. - */ - - - function parseParameters(spec, params) { - params = params || {}; - var ctx = this; - - for (var _key10 in spec) { - var _value20 = spec[_key10]; - params[_key10] = isArray(_value20) ? _value20.map(function (v) { - return parseParameter(v, ctx, params); - }) : parseParameter(_value20, ctx, params); - } - - return params; - } - /** - * Parse a single parameter. - */ - - - function parseParameter(spec, ctx, params) { - if (!spec || !isObject(spec)) return spec; - - for (var i = 0, n = PARSERS.length, p; i < n; ++i) { - p = PARSERS[i]; - - if (hasOwnProperty(spec, p.key)) { - return p.parse(spec, ctx, params); - } - } - - return spec; - } - /** Reference parsers. */ - - - var PARSERS = [{ - key: '$ref', - parse: getOperator - }, { - key: '$key', - parse: getKey - }, { - key: '$expr', - parse: getExpression - }, { - key: '$field', - parse: getField$1 - }, { - key: '$encode', - parse: getEncode - }, { - key: '$compare', - parse: getCompare - }, { - key: '$context', - parse: getContext - }, { - key: '$subflow', - parse: getSubflow - }, { - key: '$tupleid', - parse: getTupleId - }]; - /** - * Resolve an operator reference. - */ - - function getOperator(_, ctx) { - return ctx.get(_.$ref) || error('Operator not defined: ' + _.$ref); - } - /** - * Resolve an expression reference. - */ - - - function getExpression(_, ctx, params) { - if (_.$params) { - // parse expression parameters - ctx.parseParameters(_.$params, params); - } - - var k = 'e:' + _.$expr.code + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields, _.$name)); - } - /** - * Resolve a key accessor reference. - */ - - - function getKey(_, ctx) { - var k = 'k:' + _.$key + '_' + !!_.$flat; - return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat, ctx.expr.codegen)); - } - /** - * Resolve a field accessor reference. - */ - - - function getField$1(_, ctx) { - if (!_.$field) return null; - var k = 'f:' + _.$field + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name, ctx.expr.codegen)); - } - /** - * Resolve a comparator function reference. - */ - - - function getCompare(_, ctx) { - // As of Vega 5.5.3, $tupleid sort is no longer used. - // Keep here for now for backwards compatibility. - var k = 'c:' + _.$compare + '_' + _.$order, - c = array(_.$compare).map(function (_) { - return _ && _.$tupleid ? tupleid : _; - }); - return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen)); - } - /** - * Resolve an encode operator reference. - */ - - - function getEncode(_, ctx) { - var spec = _.$encode, - encode = {}; - - for (var name in spec) { - var enc = spec[name]; - encode[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - - return encode; - } - /** - * Resolve a context reference. - */ - - - function getContext(_, ctx) { - return ctx; - } - /** - * Resolve a recursive subflow specification. - */ - - - function getSubflow(_, ctx) { - var spec = _.$subflow; - return function (dataflow, key, parent) { - var subctx = ctx.fork().parse(spec), - op = subctx.get(spec.operators[0].id), - p = subctx.signals.parent; - if (p) p.set(parent); - - op.detachSubflow = function () { - return ctx.detach(subctx); - }; - - return op; - }; - } - /** - * Resolve a tuple id reference. - */ - - - function getTupleId() { - return tupleid; - } - /** - * Parse an event stream specification. - */ - - - function parseStream(spec) { - var ctx = this, - filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, - stream = spec.stream != null ? ctx.get(spec.stream) : undefined, - args; - - if (spec.source) { - stream = ctx.events(spec.source, spec.type, filter); - } else if (spec.merge) { - args = spec.merge.map(function (_) { - return ctx.get(_); - }); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - - if (spec.between) { - args = spec.between.map(function (_) { - return ctx.get(_); - }); - stream = stream.between(args[0], args[1]); - } - - if (spec.filter) { - stream = stream.filter(filter); - } - - if (spec.throttle != null) { - stream = stream.throttle(+spec.throttle); - } - - if (spec.debounce != null) { - stream = stream.debounce(+spec.debounce); - } - - if (stream == null) { - error('Invalid stream definition: ' + JSON.stringify(spec)); - } - - if (spec.consume) stream.consume(true); - ctx.stream(spec, stream); - } - /** - * Parse an event-driven operator update. - */ - - - function parseUpdate(spec) { - var ctx = this, - srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid, - source = ctx.get(srcid), - target = null, - update = spec.update, - params = undefined; - if (!source) error('Source not defined: ' + spec.source); - target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); - - if (update && update.$expr) { - if (update.$params) { - params = ctx.parseParameters(update.$params); - } - - update = ctx.handlerExpression(update.$expr); - } - - ctx.update(spec, source, target, update, params); - } - - var SKIP$3 = { - skip: true - }; - - function getState(options) { - var ctx = this, - state = {}; - - if (options.signals) { - var signals = state.signals = {}; - Object.keys(ctx.signals).forEach(function (key) { - var op = ctx.signals[key]; - - if (options.signals(key, op)) { - signals[key] = op.value; - } - }); - } - - if (options.data) { - var data = state.data = {}; - Object.keys(ctx.data).forEach(function (key) { - var dataset = ctx.data[key]; - - if (options.data(key, dataset)) { - data[key] = dataset.input.value; - } - }); - } - - if (ctx.subcontext && options.recurse !== false) { - state.subcontext = ctx.subcontext.map(function (ctx) { - return ctx.getState(options); - }); - } - - return state; - } - - function setState(state) { - var ctx = this, - df = ctx.dataflow, - data = state.data, - signals = state.signals; - Object.keys(signals || {}).forEach(function (key) { - df.update(ctx.signals[key], signals[key], SKIP$3); - }); - Object.keys(data || {}).forEach(function (key) { - df.pulse(ctx.data[key].input, df.changeset().remove(truthy).insert(data[key])); - }); - (state.subcontext || []).forEach(function (substate, i) { - var subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); - } - /** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ - - - function context$2(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); - } - - function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } - } - - function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } - } - - Context.prototype = Subcontext.prototype = { - fork: function fork() { - var ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; - }, - detach: function detach(ctx) { - this.subcontext = this.subcontext.filter(function (c) { - return c !== ctx; - }); // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - - var keys = Object.keys(ctx.nodes); - - for (var _i23 = 0, _keys = keys; _i23 < _keys.length; _i23++) { - var _key11 = _keys[_i23]; - ctx.nodes[_key11]._targets = null; - } - - for (var _i24 = 0, _keys2 = keys; _i24 < _keys2.length; _i24++) { - var _key12 = _keys2[_i24]; - - ctx.nodes[_key12].detach(); - } - - ctx.nodes = null; - }, - get: function get(id) { - return this.nodes[id]; - }, - set: function set(id, node) { - return this.nodes[id] = node; - }, - add: function add(spec, op) { - var ctx = this, - df = ctx.dataflow, - data = spec.value; - ctx.set(spec.id, op); - - if (isCollect(spec.type) && data) { - if (data.$ingest) { - df.ingest(op, data.$ingest, data.$format); - } else if (data.$request) { - df.preload(op, data.$request, data.$format); - } else { - df.pulse(op, df.changeset().insert(data)); - } - } - - if (spec.root) { - ctx.root = op; - } - - if (spec.parent) { - var p = ctx.get(spec.parent.$ref); - - if (p) { - df.connect(p, [op]); - op.targets().add(p); - } else { - (ctx.unresolved = ctx.unresolved || []).push(function () { - p = ctx.get(spec.parent.$ref); - df.connect(p, [op]); - op.targets().add(p); - }); - } - } - - if (spec.signal) { - ctx.signals[spec.signal] = op; - } - - if (spec.scale) { - ctx.scales[spec.scale] = op; - } - - if (spec.data) { - var _loop = function _loop(name) { - var data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach(function (role) { - return data[role] = op; - }); - }; - - for (var name in spec.data) { - _loop(name); - } - } - }, - resolve: function resolve() { - (this.unresolved || []).forEach(function (fn) { - return fn(); - }); - delete this.unresolved; - return this; - }, - operator: function operator(spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); - }, - transform: function transform(spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); - }, - stream: function stream(spec, _stream) { - this.set(spec.id, _stream); - }, - update: function update(spec, stream, target, _update2, params) { - this.dataflow.on(stream, target, _update2, params, spec.options); - }, - // expression parsing - operatorExpression: function operatorExpression(expr) { - return this.expr.operator(this, expr); - }, - parameterExpression: function parameterExpression(expr) { - return this.expr.parameter(this, expr); - }, - eventExpression: function eventExpression(expr) { - return this.expr.event(this, expr); - }, - handlerExpression: function handlerExpression(expr) { - return this.expr.handler(this, expr); - }, - encodeExpression: function encodeExpression(encode) { - return this.expr.encode(this, encode); - }, - // parse methods - parse: parse$4, - parseOperator: parseOperator, - parseOperatorParameters: parseOperatorParameters, - parseParameters: parseParameters, - parseStream: parseStream, - parseUpdate: parseUpdate, - // state methods - getState: getState, - setState: setState - }; - - function runtime(view, spec, expr) { - return context$2(view, transforms, functionContext, expr).parse(spec); - } - - function scale$4(name) { - var scales = this._runtime.scales; - - if (!hasOwnProperty(scales, name)) { - error('Unrecognized scale or projection: ' + name); - } - - return scales[name].value; - } - - var Width = 'width', - Height = 'height', - Padding$1 = 'padding', - Skip$1 = { - skip: true - }; - - function viewWidth(view, width) { - var a = view.autosize(), - p = view.padding(); - return width - (a && a.contains === Padding$1 ? p.left + p.right : 0); - } - - function viewHeight(view, height) { - var a = view.autosize(), - p = view.padding(); - return height - (a && a.contains === Padding$1 ? p.top + p.bottom : 0); - } - - function initializeResize(view) { - var s = view._signals, - w = s[Width], - h = s[Height], - p = s[Padding$1]; - - function resetSize() { - view._autosize = view._resize = 1; - } // respond to width signal - - - view._resizeWidth = view.add(null, function (_) { - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, { - size: w - }); // respond to height signal - - view._resizeHeight = view.add(null, function (_) { - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, { - size: h - }); // respond to padding signal - - var resizePadding = view.add(null, resetSize, { - pad: p - }); // set rank to run immediately after source signal - - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; - } - - function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter(function (view) { - var rerun = 0; // reset autosize flag - - view._autosize = 0; // width value changed: update signal, skip resize op - - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip$1); // set width, skip update calc - - view._resizeWidth.skip(true); // skip width resize handler - - } // height value changed: update signal, skip resize op - - - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip$1); // set height, skip update calc - - view._resizeHeight.skip(true); // skip height resize handler - - } // view width changed: update view property, set resize flag - - - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } // view height changed: update view property, set resize flag - - - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } // origin changed: update view property, set resize flag - - - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } // run dataflow on width/height signal change - - - if (rerun) view.run('enter'); - if (auto) view.runAfter(function (v) { - return v.resize(); - }); - }, false, 1); - } - /** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ - - - function getState$1(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); - } - - function dataTest(name, data) { - return data.modified && isArray(data.input.value) && name.indexOf('_:vega:_'); - } - - function signalTest(name, op) { - return !(name === 'parent' || op instanceof transforms.proxy); - } - /** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ - - - function setState$1(state) { - this.runAsync(null, function (v) { - v._trigger = false; - - v._runtime.setState(state); - }, function (v) { - v._trigger = true; - }); - return this; - } - - function timer$1(callback, delay) { - function tick(elapsed) { - callback({ - timestamp: Date.now(), - elapsed: elapsed - }); - } - - this._timers.push(interval$1(tick, delay)); - } - - function defaultTooltip$1(handler, event, item, value) { - var el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); - } - - function formatTooltip(value) { - return value == null ? '' : isArray(value) ? formatArray(value) : isObject(value) && !isDate(value) ? formatObject(value) : value + ''; - } - - function formatObject(obj) { - return Object.keys(obj).map(function (key) { - var v = obj[key]; - return key + ': ' + (isArray(v) ? formatArray(v) : formatValue$1(v)); - }).join('\n'); - } - - function formatArray(value) { - return '[' + value.map(formatValue$1).join(', ') + ']'; - } - - function formatValue$1(value) { - return isArray(value) ? "[\u2026]" : isObject(value) && !isDate(value) ? "{\u2026}" : value; - } - /** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ - - - function View(spec, options) { - var view = this; - options = options || {}; - Dataflow.call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - - if (options.locale || spec.locale) { - var loc = extend({}, spec.locale, options.locale); - view.locale(locale$2(loc.number, loc.time)); - } - - view._el = null; - view._elBind = null; - view._renderType = options.renderer || RenderType.Canvas; - view._scenegraph = new Scenegraph(); - var root = view._scenegraph.root; // initialize renderer, handler and event management - - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip$1, view._redraw = true; - view._handler = new CanvasHandler().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; // initialize event configuration - - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); // initialize dataflow graph - - var ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map(function (_) { - return { - state: null, - param: extend({}, _) - }; - }); // initialize scenegraph - - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); // initialize view size - - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [0, 0]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); // initialize background color - - background$1(view); // initialize cursor - - cursor(view); // initialize view description - - view.description(spec.description); // initialize hover proessing, if requested - - if (options.hover) view.hover(); // initialize DOM container(s) and renderer - - if (options.container) view.initialize(options.container, options.bind); - } - - var prototype$1s = inherits(View, Dataflow); // -- DATAFLOW / RENDERING ---- - - prototype$1s.evaluate = /*#__PURE__*/function () { - var _ref21 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(encode, prerun, postrun) { - return regeneratorRuntime.wrap(function _callee2$(_context9) { - while (1) { - switch (_context9.prev = _context9.next) { - case 0: - _context9.next = 2; - return Dataflow.prototype.evaluate.call(this, encode, prerun); - - case 2: - if (!(this._redraw || this._resize)) { - _context9.next = 14; - break; - } - - _context9.prev = 3; - - if (!this._renderer) { - _context9.next = 8; - break; - } - - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - - _context9.next = 8; - return this._renderer.renderAsync(this._scenegraph.root); - - case 8: - this._redraw = false; - _context9.next = 14; - break; - - case 11: - _context9.prev = 11; - _context9.t0 = _context9["catch"](3); - this.error(_context9.t0); - - case 14: - // evaluate postrun - if (postrun) asyncCallback(this, postrun); - return _context9.abrupt("return", this); - - case 16: - case "end": - return _context9.stop(); - } - } - }, _callee2, this, [[3, 11]]); - })); - - return function (_x43, _x44, _x45) { - return _ref21.apply(this, arguments); - }; - }(); - - prototype$1s.dirty = function (item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); - }; // -- GET / SET ---- - - - prototype$1s.description = function (text) { - if (arguments.length) { - var desc = text != null ? text + '' : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - - return this._desc; - }; - - prototype$1s.container = function () { - return this._el; - }; - - prototype$1s.scenegraph = function () { - return this._scenegraph; - }; - - prototype$1s.origin = function () { - return this._origin.slice(); - }; - - function lookupSignal(view, name) { - return hasOwnProperty(view._signals, name) ? view._signals[name] : error('Unrecognized signal name: ' + $(name)); - } - - prototype$1s.signal = function (name, value, options) { - var op = lookupSignal(this, name); - return arguments.length === 1 ? op.value : this.update(op, value, options); - }; - - prototype$1s.width = function (_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); - }; - - prototype$1s.height = function (_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); - }; - - prototype$1s.padding = function (_) { - return arguments.length ? this.signal('padding', padding(_)) : padding(this.signal('padding')); - }; - - prototype$1s.autosize = function (_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); - }; - - prototype$1s.background = function (_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); - }; - - prototype$1s.renderer = function (type) { - if (!arguments.length) return this._renderType; - if (!renderModule(type)) error('Unrecognized renderer type: ' + type); - - if (type !== this._renderType) { - this._renderType = type; - - this._resetRenderer(); - } - - return this; - }; - - prototype$1s.tooltip = function (handler) { - if (!arguments.length) return this._tooltip; - - if (handler !== this._tooltip) { - this._tooltip = handler; - - this._resetRenderer(); - } - - return this; - }; - - prototype$1s.loader = function (loader) { - if (!arguments.length) return this._loader; - - if (loader !== this._loader) { - Dataflow.prototype.loader.call(this, loader); - - this._resetRenderer(); - } - - return this; - }; - - prototype$1s.resize = function () { - // set flag to perform autosize - this._autosize = 1; // touch autosize signal to ensure top-level ViewLayout runs - - return this.touch(lookupSignal(this, 'autosize')); - }; - - prototype$1s._resetRenderer = function () { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } - }; // -- SIZING ---- - - - prototype$1s._resizeView = resizeView; // -- EVENT HANDLING ---- - - prototype$1s.addEventListener = function (type, handler, options) { - var callback = handler; - - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - - this._handler.on(type, callback); - - return this; - }; - - prototype$1s.removeEventListener = function (type, handler) { - var handlers = this._handler.handlers(type), - i = handlers.length, - h, - t; // search registered handlers, remove if match found - - - while (--i >= 0) { - t = handlers[i].type; - h = handlers[i].handler; - - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - - break; - } - } - - return this; - }; - - prototype$1s.addResizeListener = function (handler) { - var l = this._resizeListeners; - - if (l.indexOf(handler) < 0) { - // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - } - - return this; - }; - - prototype$1s.removeResizeListener = function (handler) { - var l = this._resizeListeners, - i = l.indexOf(handler); - - if (i >= 0) { - l.splice(i, 1); - } - - return this; - }; - - function findOperatorHandler(op, handler) { - var h = (op._targets || []).filter(function (op) { - return op._update && op._update.handler === handler; - }); - return h.length ? h[0] : null; - } - - function addOperatorListener(view, name, op, handler) { - var h = findOperatorHandler(op, handler); - - if (!h) { - h = trap(view, function () { - return handler(name, op.value); - }); - h.handler = handler; - view.on(op, null, h); - } - - return view; - } - - function removeOperatorListener(view, op, handler) { - var h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; - } - - prototype$1s.addSignalListener = function (name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); - }; - - prototype$1s.removeSignalListener = function (name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); - }; - - prototype$1s.addDataListener = function (name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); - }; - - prototype$1s.removeDataListener = function (name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); - }; - - prototype$1s.globalCursor = function (_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - var prev = setCursor(this, null); // clear previous cursor - - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - - return this; - } else { - return this._globalCursor; - } - }; - - prototype$1s.preventDefault = function (_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else { - return this._preventDefault; - } - }; - - prototype$1s.timer = timer$1; - prototype$1s.events = events$1; - prototype$1s.finalize = finalize; - prototype$1s.hover = hover; // -- DATA ---- - - prototype$1s.data = data; - prototype$1s.change = change; - prototype$1s.insert = insert; - prototype$1s.remove = remove; // -- SCALES -- - - prototype$1s.scale = scale$4; // -- INITIALIZATION ---- - - prototype$1s.initialize = initialize$1; // -- HEADLESS RENDERING ---- - - prototype$1s.toImageURL = renderToImageURL; - prototype$1s.toCanvas = renderToCanvas; - prototype$1s.toSVG = renderToSVG; // -- SAVE / RESTORE STATE ---- - - prototype$1s.getState = getState$1; - prototype$1s.setState = setState$1; - - function parseAutosize(spec) { - return isObject(spec) ? spec : { - type: spec || 'pad' - }; - } - - var number$6 = function number$6(_) { - return +_ || 0; - }; - - var paddingObject$1 = function paddingObject$1(_) { - return { - top: _, - bottom: _, - left: _, - right: _ - }; - }; - - function parsePadding(spec) { - return !isObject(spec) ? paddingObject$1(number$6(spec)) : spec.signal ? spec : { - top: number$6(spec.top), - bottom: number$6(spec.bottom), - left: number$6(spec.left), - right: number$6(spec.right) - }; - } - - var encoder = function encoder(_) { - return isObject(_) && !isArray(_) ? extend({}, _) : { - value: _ - }; - }; - - function addEncode(object, name, value, set) { - if (value != null) { - // Always assign signal to update, even if the signal is from the enter block - if (isObject(value) && !isArray(value)) { - object.update[name] = value; - } else { - object[set || 'enter'][name] = { - value: value - }; - } - - return 1; - } else { - return 0; - } - } - - function addEncoders(object, enter, update) { - for (var name in enter) { - addEncode(object, name, enter[name]); - } - - for (var _name in update) { - addEncode(object, _name, update[_name], 'update'); - } - } - - function extendEncode(encode, extra, skip) { - for (var name in extra) { - if (skip && hasOwnProperty(skip, name)) continue; - encode[name] = extend(encode[name] || {}, extra[name]); - } - - return encode; - } - - function has(key, encode) { - return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]); - } - - var MarkRole = 'mark'; - var FrameRole$1 = 'frame'; - var ScopeRole$1 = 'scope'; - var AxisRole$1 = 'axis'; - var AxisDomainRole = 'axis-domain'; - var AxisGridRole = 'axis-grid'; - var AxisLabelRole = 'axis-label'; - var AxisTickRole = 'axis-tick'; - var AxisTitleRole = 'axis-title'; - var LegendRole$1 = 'legend'; - var LegendBandRole = 'legend-band'; - var LegendEntryRole = 'legend-entry'; - var LegendGradientRole = 'legend-gradient'; - var LegendLabelRole = 'legend-label'; - var LegendSymbolRole = 'legend-symbol'; - var LegendTitleRole = 'legend-title'; - var TitleRole$1 = 'title'; - var TitleTextRole = 'title-text'; - var TitleSubtitleRole = 'title-subtitle'; - - function applyDefaults(encode, type, role, style, config) { - var defaults = {}, - enter = {}; - var update, key, skip, props; // if text mark, apply global lineBreak settings (#2370) - - key = 'lineBreak'; - - if (type === 'text' && config[key] != null && !has(key, encode)) { - applyDefault(defaults, key, config[key]); - } // ignore legend and axis roles - - - if (role == 'legend' || String(role).startsWith('axis')) { - role = null; - } // resolve mark config - - - props = role === FrameRole$1 ? config.group : role === MarkRole ? extend({}, config.mark, config[type]) : null; - - for (key in props) { - // do not apply defaults if relevant fields are defined - skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode)); - if (!skip) applyDefault(defaults, key, props[key]); - } // resolve styles, apply with increasing precedence - - - array(style).forEach(function (name) { - var props = config.style && config.style[name]; - - for (var _key13 in props) { - if (!has(_key13, encode)) { - applyDefault(defaults, _key13, props[_key13]); - } - } - }); - encode = extend({}, encode); // defensive copy - - for (key in defaults) { - props = defaults[key]; - - if (props.signal) { - (update = update || {})[key] = props; - } else { - enter[key] = props; - } - } - - encode.enter = extend(enter, encode.enter); - if (update) encode.update = extend(update, encode.update); - return encode; - } - - function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal ? { - signal: value.signal - } : { - value: value - }; - } - - var scaleRef = function scaleRef(scale) { - return isString(scale) ? $(scale) : scale.signal ? "(".concat(scale.signal, ")") : field$1(scale); - }; - - function entry(enc) { - if (enc.gradient != null) { - return gradient$1(enc); - } - - var value = enc.signal ? "(".concat(enc.signal, ")") : enc.color ? color$2(enc.color) : enc.field != null ? field$1(enc.field) : enc.value !== undefined ? $(enc.value) : undefined; - - if (enc.scale != null) { - value = scale$5(enc, value); - } - - if (value === undefined) { - value = null; - } - - if (enc.exponent != null) { - value = "pow(".concat(value, ",").concat(property(enc.exponent), ")"); - } - - if (enc.mult != null) { - value += "*".concat(property(enc.mult)); - } - - if (enc.offset != null) { - value += "+".concat(property(enc.offset)); - } - - if (enc.round) { - value = "round(".concat(value, ")"); - } - - return value; - } - - var _color = function _color(type, x, y, z) { - return "(".concat(type, "(").concat([x, y, z].map(entry).join(','), ")+'')"); - }; - - function color$2(enc) { - return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null; - } - - function gradient$1(enc) { - // map undefined to null; expression lang does not allow undefined - var args = [enc.start, enc.stop, enc.count].map(function (_) { - return _ == null ? null : $(_); - }); // trim null inputs from the end - - while (args.length && peek(args) == null) { - args.pop(); - } - - args.unshift(scaleRef(enc.gradient)); - return "gradient(".concat(args.join(','), ")"); - } - - function property(property) { - return isObject(property) ? '(' + entry(property) + ')' : property; - } - - function field$1(ref) { - return resolveField(isObject(ref) ? ref : { - datum: ref - }); - } - - function resolveField(ref) { - var object, level, field; - - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - - while (level-- > 0) { - object += '.mark.group'; - } - - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else { - field = ref.group; - } - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else { - error('Invalid field reference: ' + $(ref)); - } - - if (!ref.signal) { - field = isString(field) ? splitAccessPath(field).map($).join('][') : resolveField(field); - } - - return object + '[' + field + ']'; - } - - function scale$5(enc, value) { - var scale = scaleRef(enc.scale); - - if (enc.range != null) { - // pull value from scale range - value = "lerp(_range(".concat(scale, "), ").concat(+enc.range, ")"); - } else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = "_scale(".concat(scale, ", ").concat(value, ")"); - - if (enc.band) { - value = (value ? value + '+' : '') + "_bandwidth(".concat(scale, ")") + (+enc.band === 1 ? '' : '*' + property(enc.band)); - - if (enc.extra) { - // include logic to handle extraneous elements - value = "(datum.extra ? _scale(".concat(scale, ", datum.extra.value) : ").concat(value, ")"); - } - } - - if (value == null) value = '0'; - } - - return value; - } - - function rule$1(enc) { - var code = ''; - enc.forEach(function (rule) { - var value = entry(rule); - code += rule.test ? "(".concat(rule.test, ")?").concat(value, ":") : value; - }); // if no else clause, terminate with null (#1366) - - if (peek(code) === ':') { - code += 'null'; - } - - return code; - } - - function parseEncode(encode, type, role, style, scope, params) { - var enc = {}; - params = params || {}; - params.encoders = { - $encode: enc - }; - encode = applyDefaults(encode, type, role, style, scope.config); - - for (var _key14 in encode) { - enc[_key14] = parseBlock(encode[_key14], type, params, scope); - } - - return params; - } - - function parseBlock(block, marktype, params, scope) { - var channels = {}, - fields = {}; - - for (var name in block) { - if (block[name] != null) { - // skip any null entries - channels[name] = parse$5(expr(block[name]), scope, params, fields); - } - } - - return { - $expr: { - marktype: marktype, - channels: channels - }, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; - } - - function expr(enc) { - return isArray(enc) ? rule$1(enc) : entry(enc); - } - - function parse$5(code, scope, params, fields) { - var expr = parseExpression$1(code, scope); - expr.$fields.forEach(function (name) { - return fields[name] = 1; - }); - extend(params, expr.$params); - return expr.$expr; - } - - var OUTER = 'outer', - OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind']; - - function outerError(prefix, name) { - error(prefix + ' for "outer" push: ' + $(name)); - } - - function parseSignal(signal, scope) { - var name = signal.name; - - if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); // signal push must not use properties reserved for standard definition - - OUTER_INVALID.forEach(function (prop) { - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); - } else { - // define a new signal in the current scope - var op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); - } - } - - function Entry(type, value, params, parent) { - this.id = -1; - this.type = type; - this.value = value; - this.params = params; - if (parent) this.parent = parent; - } - - function entry$1(type, value, params, parent) { - return new Entry(type, value, params, parent); - } - - function operator(value, params) { - return entry$1('operator', value, params); - } // ----- - - - function ref(op) { - var ref = { - $ref: op.id - }; // if operator not yet registered, cache ref to resolve later - - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; - } - - function fieldRef(field, name) { - return name ? { - $field: field, - $name: name - } : { - $field: field - }; - } - - var keyFieldRef = fieldRef('key'); - - function compareRef(fields, orders) { - return { - $compare: fields, - $order: orders - }; - } - - function keyRef(fields, flat) { - var ref = { - $key: fields - }; - if (flat) ref.$flat = true; - return ref; - } // ----- - - - var Ascending = 'ascending'; - var Descending = 'descending'; - - function sortKey(sort) { - return !isObject(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field); - } - - function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || ''); - } // ----- - - - var Scope = 'scope'; - var View$1 = 'view'; - - function isSignal(_) { - return _ && _.signal; - } - - function isExpr(_) { - return _ && _.expr; - } - - function hasSignal(_) { - if (isSignal(_)) return true; - if (isObject(_)) for (var key in _) { - if (hasSignal(_[key])) return true; - } - return false; - } - - function value$2(specValue, defaultValue) { - return specValue != null ? specValue : defaultValue; - } - - function deref(v) { - return v && v.signal || v; - } - - var Timer$1 = 'timer'; - - function parseStream$1(stream, scope) { - var method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : error('Invalid stream specification: ' + $(stream)); - return method(stream, scope); - } - - function eventSource(source) { - return source === Scope ? View$1 : source || View$1; - } - - function mergeStream(stream, scope) { - var list = stream.merge.map(function (s) { - return parseStream$1(s, scope); - }), - entry = streamParameters({ - merge: list - }, stream, scope); - return scope.addStream(entry).id; - } - - function nestedStream(stream, scope) { - var id = parseStream$1(stream.stream, scope), - entry = streamParameters({ - stream: id - }, stream, scope); - return scope.addStream(entry).id; - } - - function eventStream(stream, scope) { - var id, entry; - - if (stream.type === Timer$1) { - id = scope.event(Timer$1, stream.throttle); - stream = { - between: stream.between, - filter: stream.filter - }; - } else { - id = scope.event(eventSource(stream.source), stream.type); - } - - entry = streamParameters({ - stream: id - }, stream, scope); - return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id; - } - - function streamParameters(entry, stream, scope) { - var param = stream.between; - - if (param) { - if (param.length !== 2) { - error('Stream "between" parameter must have 2 entries: ' + $(stream)); - } - - entry.between = [parseStream$1(param[0], scope), parseStream$1(param[1], scope)]; - } - - param = stream.filter ? [].concat(stream.filter) : []; - - if (stream.marktype || stream.markname || stream.markrole) { - // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - } - - if (stream.source === Scope) { - // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - } - - if (param.length) { - entry.filter = parseExpression$1('(' + param.join(')&&(') + ')', scope).$expr; - } - - if ((param = stream.throttle) != null) { - entry.throttle = +param; - } - - if ((param = stream.debounce) != null) { - entry.debounce = +param; - } - - if (stream.consume) { - entry.consume = true; - } - - return entry; - } - - function filterMark(type, name, role) { - var item = 'event.item'; - return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); - } - /** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ - - - function selector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW$1; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); - } - - var VIEW$1 = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL$1 = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - - function isMarkType(type) { - return MARKS[type]; - } - - function find$2(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - - for (; i < n; ++i) { - c = s[i]; - if (!count && c === endChar) return i;else if (popChar && popChar.indexOf(c) >= 0) --count;else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - - return i; - } - - function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find$2(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - - return output; - } - - function parseSelector(s) { - return s[0] === '[' ? parseBetween(s) : parseStream$2(s); - } - - function parseBetween(s) { - var n = s.length, - i = 1, - b, - stream; - i = find$2(s, i, RBRACK, LBRACK, RBRACK); - - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector); - stream = parseSelector(s.slice(1).trim()); - - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; - } - - function parseStream$2(s) { - var stream = { - source: DEFAULT_SOURCE - }, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, - j, - filter; // extract throttle from end - - if (s[n - 1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i + 1, n - 1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - - i = 0; - } - - if (!n) throw s; // set name flag based on first char - - if (s[0] === NAME) markname = ++i; // extract first part of multi-part stream selector - - j = find$2(s, i, COLON); - - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } // extract remaining part of stream selector - - - i = find$2(s, i, LBRACK); - - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } // extract filters - - - while (i < n) { - i = find$2(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } // marshall event stream specification - - - if (!(n = source.length) || ILLEGAL$1.test(source[n - 1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - return stream; - } - - function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function (_) { - var x = +_; - if (x !== x) throw s; - return x; - }); - } // bypass expression parser for internal operator references - - - var OP_VALUE_EXPR = { - code: '_.$value', - ast: { - type: 'Identifier', - value: 'value' - } - }; - - function parseUpdate$1(spec, scope, target) { - var events = spec.events, - update = spec.update, - encode = spec.encode, - sources = [], - entry = { - target: target - }; - - if (!events) { - error('Signal update missing events specification.'); - } // interpret as an event selector string - - - if (isString(events)) { - events = selector(events, scope.isSubscope() ? Scope : View$1); - } // separate event streams from signal updates - - - events = array(events).filter(function (s) { - return s.signal || s.scale ? (sources.push(s), 0) : 1; - }); // merge internal operator listeners - - if (sources.length > 1) { - sources = [mergeSources(sources)]; - } // merge event streams, include as source - - - if (events.length) { - sources.push(events.length > 1 ? { - merge: events - } : events[0]); - } - - if (encode != null) { - if (update) error('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + $(encode) + ')'; - } // resolve update value - - - entry.update = isString(update) ? parseExpression$1(update, scope) : update.expr != null ? parseExpression$1(update.expr, scope) : update.value != null ? update.value : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: { - $value: scope.signalRef(update.signal) - } - } : error('Invalid signal update specification.'); - - if (spec.force) { - entry.options = { - force: true - }; - } - - sources.forEach(function (source) { - scope.addUpdate(extend(streamSource(source, scope), entry)); - }); - } - - function streamSource(stream, scope) { - return { - source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream$1(stream, scope) - }; - } - - function mergeSources(sources) { - return { - signal: '[' + sources.map(function (s) { - return s.scale ? 'scale("' + s.scale + '")' : s.signal; - }) + ']' - }; - } - - function parseSignalUpdates(signal, scope) { - var op = scope.getSignal(signal.name), - expr = signal.update; - - if (signal.init) { - if (expr) { - error('Signals can not include both init and update expressions.'); - } else { - expr = signal.init; - op.initonly = true; - } - } - - if (expr) { - expr = parseExpression$1(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - if (signal.on) { - signal.on.forEach(function (_) { - parseUpdate$1(_, scope, op.id); - }); - } - } - - var transform$3 = function transform$3(name) { - return function (params, value, parent) { - return entry$1(name, value, params || undefined, parent); - }; - }; - - var Aggregate$1 = transform$3('aggregate'); - var AxisTicks$1 = transform$3('axisticks'); - var Bound$1 = transform$3('bound'); - var Collect$1 = transform$3('collect'); - var Compare$1 = transform$3('compare'); - var DataJoin$1 = transform$3('datajoin'); - var Encode$1 = transform$3('encode'); - var Expression$1 = transform$3('expression'); - var Facet$1 = transform$3('facet'); - var Field$1 = transform$3('field'); - var Key$1 = transform$3('key'); - var LegendEntries$1 = transform$3('legendentries'); - var Load$1 = transform$3('load'); - var Mark$1 = transform$3('mark'); - var MultiExtent$1 = transform$3('multiextent'); - var MultiValues$1 = transform$3('multivalues'); - var Overlap$1 = transform$3('overlap'); - var Params$2 = transform$3('params'); - var PreFacet$1 = transform$3('prefacet'); - var Projection$1 = transform$3('projection'); - var Proxy$1 = transform$3('proxy'); - var Relay$1 = transform$3('relay'); - var Render$1 = transform$3('render'); - var Scale$1 = transform$3('scale'); - var Sieve$1 = transform$3('sieve'); - var SortItems$1 = transform$3('sortitems'); - var ViewLayout$1 = transform$3('viewlayout'); - var Values$1 = transform$3('values'); - var FIELD_REF_ID = 0; - var MULTIDOMAIN_SORT_OPS = { - min: 'min', - max: 'max', - count: 'sum' - }; - - function initScale(spec, scope) { - var type = spec.type || 'linear'; - - if (!isValidScaleType(type)) { - error('Unrecognized scale type: ' + $(type)); - } - - scope.addScale(spec.name, { - type: type, - domain: undefined - }); - } - - function parseScale(spec, scope) { - var params = scope.getScale(spec.name).params, - key; - params.domain = parseScaleDomain(spec.domain, spec, scope); - - if (spec.range != null) { - params.range = parseScaleRange(spec, scope, params); - } - - if (spec.interpolate != null) { - parseScaleInterpolate(spec.interpolate, params); - } - - if (spec.nice != null) { - params.nice = parseScaleNice(spec.nice); - } - - if (spec.bins != null) { - params.bins = parseScaleBins(spec.bins, scope); - } - - for (key in spec) { - if (hasOwnProperty(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } - } - - function parseLiteral(v, scope) { - return !isObject(v) ? v : v.signal ? scope.signalRef(v.signal) : error('Unsupported object: ' + $(v)); - } - - function parseArray(v, scope) { - return v.signal ? scope.signalRef(v.signal) : v.map(function (v) { - return parseLiteral(v, scope); - }); - } - - function dataLookupError(name) { - error('Can not find data set: ' + $(name)); - } // -- SCALE DOMAIN ---- - - - function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) { - error('No scale domain defined for domainMin/domainMax to override.'); - } - - return; // default domain - } - - return domain.signal ? scope.signalRef(domain.signal) : (isArray(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope); - } - - function explicitDomain(domain, spec, scope) { - return domain.map(function (v) { - return parseLiteral(v, scope); - }); - } - - function singularDomain(domain, spec, scope) { - var data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - return isDiscrete(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : isQuantile(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field); - } - - function multipleDomain(domain, spec, scope) { - var data = domain.data, - fields = domain.fields.reduce(function (dom, d) { - d = isString(d) ? { - data: data, - field: d - } : isArray(d) || d.signal ? fieldRef$1(d, scope) : d; - dom.push(d); - return dom; - }, []); - return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields); - } - - function fieldRef$1(data, scope) { - var name = '_:vega:_' + FIELD_REF_ID++, - coll = Collect$1({}); - - if (isArray(data)) { - coll.value = { - $ingest: data - }; - } else if (data.signal) { - var code = 'setdata(' + $(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - - scope.addDataPipeline(name, [coll, Sieve$1({})]); - return { - data: name, - field: 'data' - }; - } - - function ordinalMultipleDomain(domain, scope, fields) { - var sort = parseSort(domain.sort, true), - counts, - p, - a, - c, - v; // get value counts for each domain field - - counts = fields.map(function (f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); - }); // aggregate the results from each domain field - - p = { - groupby: keyFieldRef, - pulse: counts - }; - - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [MULTIDOMAIN_SORT_OPS[a]]; - p.fields = [scope.fieldRef(v)]; - p.as = [v]; - } - - a = scope.add(Aggregate$1(p)); // collect aggregate output - - c = scope.add(Collect$1({ - pulse: ref(a) - })); // extract values for combined domain - - v = scope.add(Values$1({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) - })); - return ref(v); - } - - function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if (isObject(sort)) sort.field = 'key';else sort = { - field: 'key' - }; - } else if (!sort.field && sort.op !== 'count') { - error('No field provided for sort aggregate op: ' + sort.op); - } else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) { - error('Multiple domain scales can not be sorted using ' + sort.op); - } - } - } - - return sort; - } - - function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - var values = fields.map(function (f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); - }); // combine value arrays - - return ref(scope.add(MultiValues$1({ - values: values - }))); - } - - function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - var extents = fields.map(function (f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); - }); // combine extents - - return ref(scope.add(MultiExtent$1({ - extents: extents - }))); - } // -- SCALE BINS ----- - - - function parseScaleBins(v, scope) { - return v.signal || isArray(v) ? parseArray(v, scope) : scope.objectProperty(v); - } // -- SCALE NICE ----- - - - function parseScaleNice(nice) { - return isObject(nice) ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } : parseLiteral(nice); - } // -- SCALE INTERPOLATION ----- - - - function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - - if (interpolate.gamma != null) { - params.interpolateGamma = parseLiteral(interpolate.gamma); - } - } // -- SCALE RANGE ----- - - - function parseScaleRange(spec, scope, params) { - var range = spec.range, - config = scope.config.range; - - if (range.signal) { - return scope.signalRef(range.signal); - } else if (isString(range)) { - if (config && hasOwnProperty(config, range)) { - spec = extend({}, spec, { - range: config[range] - }); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') { - range = [0, { - signal: 'width' - }]; - } else if (range === 'height') { - range = isDiscrete(spec.type) ? [0, { - signal: 'height' - }] : [{ - signal: 'height' - }, 0]; - } else { - error('Unrecognized scale range value: ' + $(range)); - } - } else if (range.scheme) { - params.scheme = isArray(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if (isDiscrete(spec.type) && !isArray(range)) { - return parseScaleDomain(range, spec, scope); - } else if (!isArray(range)) { - error('Unsupported range type: ' + $(range)); - } - - return range.map(function (v) { - return (isArray(v) ? parseArray : parseLiteral)(v, scope); - }); - } - - function parseProjection(proj, scope) { - var config = scope.config.projection || {}, - params = {}; - - for (var name in proj) { - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } // apply projection defaults from config - - - for (name in config) { - if (params[name] == null) { - params[name] = parseParameter$1(config[name], name, scope); - } - } - - scope.addProjection(proj.name, params); - } - - function parseParameter$1(_, name, scope) { - return isArray(_) ? _.map(function (_) { - return parseParameter$1(_, name, scope); - }) : !isObject(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : error('Unsupported parameter object: ' + $(_)); - } - - var Top$1 = 'top'; - var Left$1 = 'left'; - var Right$1 = 'right'; - var Bottom$1 = 'bottom'; - var Center$1 = 'center'; - var Vertical = 'vertical'; - var Start$1 = 'start'; - var Middle$1 = 'middle'; - var End$1 = 'end'; - var Index = 'index'; - var Label = 'label'; - var Offset = 'offset'; - var Perc = 'perc'; - var Perc2 = 'perc2'; - var Value = 'value'; - var GuideLabelStyle = 'guide-label'; - var GuideTitleStyle = 'guide-title'; - var GroupTitleStyle = 'group-title'; - var GroupSubtitleStyle = 'group-subtitle'; - var Symbols$1 = 'symbol'; - var Gradient$1 = 'gradient'; - var Discrete$1 = 'discrete'; - var Size = 'size'; - var Shape = 'shape'; - var Fill = 'fill'; - var Stroke = 'stroke'; - var StrokeWidth = 'strokeWidth'; - var StrokeDash = 'strokeDash'; - var Opacity = 'opacity'; // Encoding channels supported by legends - // In priority order of 'canonical' scale - - var LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity]; - var Skip$2 = { - name: 1, - style: 1, - interactive: 1 - }; - var zero$2 = { - value: 0 - }; - var one$2 = { - value: 1 - }; - var GroupMark = 'group'; - var RectMark = 'rect'; - var RuleMark = 'rule'; - var SymbolMark = 'symbol'; - var TextMark = 'text'; - - function guideGroup(mark) { - mark.type = GroupMark; - mark.interactive = mark.interactive || false; - return mark; - } - - function lookup$5(spec, config) { - var _ = function _(name, dflt) { - return value$2(spec[name], value$2(config[name], dflt)); - }; - - _.isVertical = function (s) { - return Vertical === value$2(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection)); - }; - - _.gradientLength = function () { - return value$2(spec.gradientLength, config.gradientLength || config.gradientWidth); - }; - - _.gradientThickness = function () { - return value$2(spec.gradientThickness, config.gradientThickness || config.gradientHeight); - }; - - _.entryColumns = function () { - return value$2(spec.columns, value$2(config.columns, +_.isVertical(true))); - }; - - return _; - } - - function getEncoding(name, encode) { - var v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]); - return v && v.signal ? v : v ? v.value : null; - } - - function getStyle(name, scope, style) { - var s = scope.config.style[style]; - return s && s[name]; - } - - function anchorExpr(s, e, m) { - return "item.anchor === '".concat(Start$1, "' ? ").concat(s, " : item.anchor === '").concat(End$1, "' ? ").concat(e, " : ").concat(m); - } - - var alignExpr = anchorExpr($(Left$1), $(Right$1), $(Center$1)); - - function tickBand(_) { - var v = _('tickBand'), - offset = _('tickOffset'), - band, - extra; - - if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); - } else if (v.signal) { - // if signal, augment code to interpret values - band = { - signal: "(".concat(v.signal, ") === 'extent' ? 1 : 0.5") - }; - extra = { - signal: "(".concat(v.signal, ") === 'extent'") - }; - - if (!isObject(offset)) { - offset = { - signal: "(".concat(v.signal, ") === 'extent' ? 0 : ").concat(offset) - }; - } - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; - } else { - band = 0.5; - extra = false; - } - - return { - extra: extra, - band: band, - offset: offset - }; - } - - function extendOffset(value, offset) { - return !offset ? value : !value ? offset : !isObject(value) ? { - value: value, - offset: offset - } : Object.assign({}, value, { - offset: extendOffset(value.offset, offset) - }); - } - - function guideMark(mark, extras) { - if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip$2); - } else { - mark.interactive = false; - } - - return mark; - } - - function legendGradient(spec, scale, config, userEncode) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, - enter, - start, - stop, - width, - height; - - if (vertical) { - start = [0, 1]; - stop = [0, 0]; - width = thickness; - height = length; - } else { - start = [0, 0]; - stop = [1, 0]; - width = length; - height = thickness; - } - - encode = { - enter: enter = { - opacity: zero$2, - x: zero$2, - y: zero$2, - width: encoder(width), - height: encoder(height) - }, - update: extend({}, enter, { - opacity: one$2, - fill: { - gradient: scale, - start: start, - stop: stop - } - }), - exit: { - opacity: zero$2 - } - }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { - // update - opacity: _('gradientOpacity') - }); - return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode: encode - }, userEncode); - } - - function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, - enter, - u, - v, - uu, - vv, - adjust = ''; - - vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); - enter = { - opacity: zero$2, - fill: { - scale: scale, - field: Value - } - }; - enter[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = zero$2; - enter[uu] = { - signal: adjust + 'datum.' + Perc2, - mult: length - }; - enter[vv] = encoder(thickness); - encode = { - enter: enter, - update: extend({}, enter, { - opacity: one$2 - }), - exit: { - opacity: zero$2 - } - }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { - // update - opacity: _('gradientOpacity') - }); - return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode: encode - }, userEncode); - } - - var alignExpr$1 = "datum.".concat(Perc, "<=0?\"").concat(Left$1, "\":datum.").concat(Perc, ">=1?\"").concat(Right$1, "\":\"").concat(Center$1, "\""), - baselineExpr = "datum.".concat(Perc, "<=0?\"").concat(Bottom$1, "\":datum.").concat(Perc, ">=1?\"").concat(Top$1, "\":\"").concat(Middle$1, "\""); - - function legendGradientLabels(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = encoder(_.gradientThickness()), - length = _.gradientLength(), - overlap = _('labelOverlap'), - encode, - enter, - update, - u, - v, - adjust = ''; - - encode = { - enter: enter = { - opacity: zero$2 - }, - update: update = { - opacity: one$2, - text: { - field: Label - } - }, - exit: { - opacity: zero$2 - } - }; - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value$2(spec.labelLimit, config.gradientLabelLimit) - }); - - if (vertical) { - enter.align = { - value: 'left' - }; - enter.baseline = update.baseline = { - signal: baselineExpr - }; - u = 'y'; - v = 'x'; - adjust = '1-'; - } else { - enter.align = update.align = { - signal: alignExpr$1 - }; - enter.baseline = { - value: 'top' - }; - u = 'x'; - v = 'y'; - } - - enter[u] = update[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = update[v] = thickness; - thickness.offset = value$2(spec.labelOffset, config.gradientLabelOffset) || 0; - overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; // type, role, style, key, dataRef, encode, extras - - return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode: encode, - overlap: overlap - }, userEncode); - } // userEncode is top-level, includes entries, symbols, labels - - - function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - var _ = lookup$5(spec, config), - entries = userEncode.entries, - interactive = !!(entries && entries.interactive), - name = entries ? entries.name : undefined, - height = _('clipHeight'), - symbolOffset = _('symbolOffset'), - valueRef = { - data: 'value' - }, - encode = {}, - xSignal = "(".concat(columns, ") ? datum.").concat(Offset, " : datum.").concat(Size), - yEncode = height ? encoder(height) : { - field: Size - }, - index = "datum.".concat(Index), - ncols = "max(1, ".concat(columns, ")"), - enter, - update, - labelOffset, - symbols, - labels, - nrows, - sort; - - yEncode.mult = 0.5; // -- LEGEND SYMBOLS -- - - encode = { - enter: enter = { - opacity: zero$2, - x: { - signal: xSignal, - mult: 0.5, - offset: symbolOffset - }, - y: yEncode - }, - update: update = { - opacity: one$2, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$2 - } - }; - var baseFill = null, - baseStroke = null; - - if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') - }, { - // update - opacity: _('symbolOpacity') - }); - LegendScales.forEach(function (scale) { - if (spec[scale]) { - update[scale] = enter[scale] = { - scale: spec[scale], - field: Value - }; - } - }); - symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode: encode - }, userEncode.symbols); // -- LEGEND LABELS -- - - labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - encode = { - enter: enter = { - opacity: zero$2, - x: { - signal: xSignal, - offset: labelOffset - }, - y: yEncode - }, - update: update = { - opacity: one$2, - text: { - field: Label - }, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$2 - } - }; - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') - }); - labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode: encode - }, userEncode.labels); // -- LEGEND ENTRY GROUPS -- - - encode = { - enter: { - noBound: { - value: !height - }, - // ignore width/height in bounds calc - width: zero$2, - height: height ? encoder(height) : zero$2, - opacity: zero$2 - }, - exit: { - opacity: zero$2 - }, - update: update = { - opacity: one$2, - row: { - signal: null - }, - column: { - signal: null - } - } - }; // annotate and sort groups to ensure correct ordering - - if (_.isVertical(true)) { - nrows = "ceil(item.mark.items.length / ".concat(ncols, ")"); - update.row.signal = "".concat(index, "%").concat(nrows); - update.column.signal = "floor(".concat(index, " / ").concat(nrows, ")"); - sort = { - field: ['row', index] - }; - } else { - update.row.signal = "floor(".concat(index, " / ").concat(ncols, ")"); - update.column.signal = "".concat(index, " % ").concat(ncols); - sort = { - field: index - }; - } // handle zero column case (implies infinite columns) - - - update.column.signal = "(".concat(columns, ")?").concat(update.column.signal, ":").concat(index); // facet legend entries into sub-groups - - dataRef = { - facet: { - data: dataRef, - name: 'value', - groupby: Index - } - }; - return guideGroup({ - role: ScopeRole$1, - from: dataRef, - encode: extendEncode(encode, entries, Skip$2), - marks: [symbols, labels], - name: name, - interactive: interactive, - sort: sort - }); - } - - function legendSymbolLayout(spec, config) { - var _ = lookup$5(spec, config); // layout parameters for legend entries - - - return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } - }; - } // expression logic for align, anchor, angle, and baseline calculation - - - var isL = 'item.orient === "left"', - isR = 'item.orient === "right"', - isLR = "(".concat(isL, " || ").concat(isR, ")"), - isVG = "datum.vgrad && ".concat(isLR), - baseline = anchorExpr('"top"', '"bottom"', '"middle"'), - alignFlip = anchorExpr('"right"', '"left"', '"center"'), - exprAlign = "datum.vgrad && ".concat(isR, " ? (").concat(alignFlip, ") : (").concat(isLR, " && !(datum.vgrad && ").concat(isL, ")) ? \"left\" : ").concat(alignExpr), - exprAnchor = "item._anchor || (".concat(isLR, " ? \"middle\" : \"start\")"), - exprAngle = "".concat(isVG, " ? (").concat(isL, " ? -90 : 90) : 0"), - exprBaseline = "".concat(isLR, " ? (datum.vgrad ? (").concat(isR, " ? \"bottom\" : \"top\") : ").concat(baseline, ") : \"top\""); - - function legendTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - encode; - - encode = { - enter: { - opacity: zero$2 - }, - update: { - opacity: one$2, - x: { - field: { - group: 'padding' - } - }, - y: { - field: { - group: 'padding' - } - } - }, - exit: { - opacity: zero$2 - } - }; - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: { - signal: exprAnchor - }, - angle: { - signal: exprAngle - }, - align: { - signal: exprAlign - }, - baseline: { - signal: exprBaseline - }, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { - // require update - align: _('titleAlign'), - baseline: _('titleBaseline') - }); - return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode: encode - }, userEncode); - } - - function clip$3(clip, scope) { - var expr; - - if (isObject(clip)) { - if (clip.signal) { - expr = clip.signal; - } else if (clip.path) { - expr = 'pathShape(' + param(clip.path) + ')'; - } else if (clip.sphere) { - expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - } - - return expr ? scope.signalRef(expr) : !!clip; - } - - function param(value) { - return isObject(value) && value.signal ? value.signal : $(value); - } - - function getRole(spec) { - var role = spec.role || ''; - return !role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title') ? role : spec.type === GroupMark ? ScopeRole$1 : role || MarkRole; - } - - function definition$1(spec) { - return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; - } - - function interactive(spec, scope) { - return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true; - } - /** - * Parse a data transform specification. - */ - - - function parseTransform(spec, scope) { - var def = definition(spec.type); - if (!def) error('Unrecognized transform type: ' + $(spec.type)); - var t = entry$1(def.type.toLowerCase(), null, parseParameters$1(def, spec, scope)); - if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; - return t; - } - /** - * Parse all parameters of a data transform. - */ - - - function parseParameters$1(def, spec, scope) { - var params = {}, - pdef, - i, - n; - - for (i = 0, n = def.params.length; i < n; ++i) { - pdef = def.params[i]; - params[pdef.name] = parseParameter$2(pdef, spec, scope); - } - - return params; - } - /** - * Parse a data transform parameter. - */ - - - function parseParameter$2(def, spec, scope) { - var type = def.type, - value = spec[def.name]; - - if (type === 'index') { - return parseIndexParameter(def, spec, scope); - } else if (value === undefined) { - if (def.required) { - error('Missing required ' + $(spec.type) + ' parameter: ' + $(def.name)); - } - - return; - } else if (type === 'param') { - return parseSubParameters(def, spec, scope); - } else if (type === 'projection') { - return scope.projectionRef(spec[def.name]); - } - - return def.array && !isSignal(value) ? value.map(function (v) { - return parameterValue(def, v, scope); - }) : parameterValue(def, value, scope); - } - /** - * Parse a single parameter value. - */ - - - function parameterValue(def, value, scope) { - var type = def.type; - - if (isSignal(value)) { - return isExpr$1(type) ? error('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal); - } else { - var expr = def.expr || isField(type); - return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef(value.field, value.as) : isExpr$1(type) ? parseExpression$1(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef(value) : isCompare(type) ? scope.compareRef(value) : value; - } - } - /** - * Parse parameter for accessing an index of another data set. - */ - - - function parseIndexParameter(def, spec, scope) { - if (!isString(spec.from)) { - error('Lookup "from" parameter must be a string literal.'); - } - - return scope.getData(spec.from).lookupRef(scope, spec.key); - } - /** - * Parse a parameter that contains one or more sub-parameter objects. - */ - - - function parseSubParameters(def, spec, scope) { - var value = spec[def.name]; - - if (def.array) { - if (!isArray(value)) { - // signals not allowed! - error('Expected an array of sub-parameters. Instead: ' + $(value)); - } - - return value.map(function (v) { - return parseSubParameter(def, v, scope); - }); - } else { - return parseSubParameter(def, value, scope); - } - } - /** - * Parse a sub-parameter object. - */ - - - function parseSubParameter(def, value, scope) { - var params, pdef, k, i, n; // loop over defs to find matching key - - for (i = 0, n = def.params.length; i < n; ++i) { - pdef = def.params[i]; - - for (k in pdef.key) { - if (pdef.key[k] !== value[k]) { - pdef = null; - break; - } - } - - if (pdef) break; - } // raise error if matching key not found - - - if (!pdef) error('Unsupported parameter: ' + $(value)); // parse params, create Params transform, return ref - - params = extend(parseParameters$1(pdef, value, scope), pdef.key); - return ref(scope.add(Params$2(params))); - } // -- Utilities ----- - - - function outerExpr(_) { - return _ && _.expr; - } - - function outerField(_) { - return _ && _.field; - } - - function isData(_) { - return _ === 'data'; - } - - function isExpr$1(_) { - return _ === 'expr'; - } - - function isField(_) { - return _ === 'field'; - } - - function isCompare(_) { - return _ === 'compare'; - } - - function parseData(from, group, scope) { - var facet, key, op, dataRef, parent; // if no source data, generate singleton datum - - if (!from) { - dataRef = ref(scope.add(Collect$1(null, [{}]))); - } // if faceted, process facet specification - else if (facet = from.facet) { - if (!group) error('Only group marks can be faceted.'); // use pre-faceted source data, if available - - if (facet.field != null) { - dataRef = parent = getDataRef(facet, scope); - } else { - // generate facet aggregates if no direct data specification - if (!from.data) { - op = parseTransform(extend({ - type: 'aggregate', - groupby: array(facet.groupby) - }, facet.aggregate), scope); - op.params.key = scope.keyRef(facet.groupby); - op.params.pulse = getDataRef(facet, scope); - dataRef = parent = ref(scope.add(op)); - } else { - parent = ref(scope.getData(from.data).aggregate); - } - - key = scope.keyRef(facet.groupby, true); - } - } // if not yet defined, get source data reference - - - if (!dataRef) { - dataRef = getDataRef(from, scope); - } - - return { - key: key, - pulse: dataRef, - parent: parent - }; - } - - function getDataRef(from, scope) { - return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output); - } - - function DataScope(scope, input, output, values, aggr) { - this.scope = scope; // parent scope object - - this.input = input; // first operator in pipeline (tuple input) - - this.output = output; // last operator in pipeline (tuple output) - - this.values = values; // operator for accessing tuples (but not tuple flow) - // last aggregate in transform pipeline - - this.aggregate = aggr; // lookup table of field indices - - this.index = {}; - } - - DataScope.fromEntries = function (scope, entries) { - var n = entries.length, - i = 1, - input = entries[0], - values = entries[n - 1], - output = entries[n - 2], - aggr = null; - - if (input && input.type === 'load') { - input = entries[1]; - } // add operator entries to this scope, wire up pulse chain - - - scope.add(entries[0]); - - for (; i < n; ++i) { - entries[i].params.pulse = ref(entries[i - 1]); - scope.add(entries[i]); - if (entries[i].type === 'aggregate') aggr = entries[i]; - } - - return new DataScope(scope, input, output, values, aggr); - }; - - var prototype$1t = DataScope.prototype; - - prototype$1t.countsRef = function (scope, field, sort) { - var ds = this, - cache = ds.counts || (ds.counts = {}), - k = fieldKey(field), - v, - a, - p; - - if (k != null) { - scope = ds.scope; - v = cache[k]; - } - - if (!v) { - p = { - groupby: scope.fieldRef(field, 'key'), - pulse: ref(ds.output) - }; - if (sort && sort.field) addSortField(scope, p, sort); - a = scope.add(Aggregate$1(p)); - v = scope.add(Collect$1({ - pulse: ref(a) - })); - v = { - agg: a, - ref: ref(v) - }; - if (k != null) cache[k] = v; - } else if (sort && sort.field) { - addSortField(scope, v.agg.params, sort); - } - - return v.ref; - }; - - function fieldKey(field) { - return isString(field) ? field : null; - } - - function addSortField(scope, p, sort) { - var as = aggrField(sort.op, sort.field), - s; - - if (p.ops) { - for (var i = 0, n = p.as.length; i < n; ++i) { - if (p.as[i] === as) return; - } - } else { - p.ops = ['count']; - p.fields = [null]; - p.as = ['count']; - } - - if (sort.op) { - p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op); - p.fields.push(scope.fieldRef(sort.field)); - p.as.push(as); - } - } - - function cache(scope, ds, name, optype, field, counts, index) { - var cache = ds[name] || (ds[name] = {}), - sort = sortKey(counts), - k = fieldKey(field), - v, - op; - - if (k != null) { - scope = ds.scope; - k = k + (sort ? '|' + sort : ''); - v = cache[k]; - } - - if (!v) { - var params = counts ? { - field: keyFieldRef, - pulse: ds.countsRef(scope, field, counts) - } : { - field: scope.fieldRef(field), - pulse: ref(ds.output) - }; - if (sort) params.sort = scope.sortRef(counts); - op = scope.add(entry$1(optype, undefined, params)); - if (index) ds.index[field] = op; - v = ref(op); - if (k != null) cache[k] = v; - } - - return v; - } - - prototype$1t.tuplesRef = function () { - return ref(this.values); - }; - - prototype$1t.extentRef = function (scope, field) { - return cache(scope, this, 'extent', 'extent', field, false); - }; - - prototype$1t.domainRef = function (scope, field) { - return cache(scope, this, 'domain', 'values', field, false); - }; - - prototype$1t.valuesRef = function (scope, field, sort) { - return cache(scope, this, 'vals', 'values', field, sort || true); - }; - - prototype$1t.lookupRef = function (scope, field) { - return cache(scope, this, 'lookup', 'tupleindex', field, false); - }; - - prototype$1t.indataRef = function (scope, field) { - return cache(scope, this, 'indata', 'tupleindex', field, true, true); - }; - - function parseFacet(spec, scope, group) { - var facet = spec.from.facet, - name = facet.name, - data = getDataRef(facet, scope), - subscope, - source, - values, - op; - - if (!facet.name) { - error('Facet must have a name: ' + $(facet)); - } - - if (!facet.data) { - error('Facet must reference a data set: ' + $(facet)); - } - - if (facet.field) { - op = scope.add(PreFacet$1({ - field: scope.fieldRef(facet.field), - pulse: data - })); - } else if (facet.groupby) { - op = scope.add(Facet$1({ - key: scope.keyRef(facet.groupby), - group: ref(scope.proxy(group.parent)), - pulse: data - })); - } else { - error('Facet must specify groupby or field: ' + $(facet)); - } // initialize facet subscope - - - subscope = scope.fork(); - source = subscope.add(Collect$1()); - values = subscope.add(Sieve$1({ - pulse: ref(source) - })); - subscope.addData(name, new DataScope(subscope, source, source, values)); - subscope.addSignal('parent', null); // parse faceted subflow - - op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; - } - - function parseSubflow(spec, scope, input) { - var op = scope.add(PreFacet$1({ - pulse: input.pulse - })), - subscope = scope.fork(); - subscope.add(Sieve$1()); - subscope.addSignal('parent', null); // parse group mark subflow - - op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; - } - - function parseTrigger(spec, scope, name) { - var remove = spec.remove, - insert = spec.insert, - toggle = spec.toggle, - modify = spec.modify, - values = spec.values, - op = scope.add(operator()), - update, - expr; - update = 'if(' + spec.trigger + ',modify("' + name + '",' + [insert, remove, toggle, modify, values].map(function (_) { - return _ == null ? 'null' : _; - }).join(',') + '),0)'; - expr = parseExpression$1(update, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - function parseMark(spec, scope) { - var role = getRole(spec), - group = spec.type === GroupMark, - facet = spec.from && spec.from.facet, - layout = spec.layout || role === ScopeRole$1 || role === FrameRole$1, - nested = role === MarkRole || layout || facet, - overlap = spec.overlap, - ops, - op, - input, - store, - enc, - bound, - render, - sieve, - name, - joinRef, - markRef, - encodeRef, - layoutRef, - boundRef; // resolve input data - - input = parseData(spec.from, group, scope); // data join to map tuples to visual items - - op = scope.add(DataJoin$1({ - key: input.key || (spec.key ? fieldRef(spec.key) : undefined), - pulse: input.pulse, - clean: !group - })); - joinRef = ref(op); // collect visual items - - op = store = scope.add(Collect$1({ - pulse: joinRef - })); // connect visual items to scenegraph - - op = scope.add(Mark$1({ - markdef: definition$1(spec), - interactive: interactive(spec.interactive, scope), - clip: clip$3(spec.clip, scope), - context: { - $context: true - }, - groups: scope.lookup(), - parent: scope.signals.parent ? scope.signalRef('parent') : null, - index: scope.markpath(), - pulse: ref(op) - })); - markRef = ref(op); // add visual encoders - - op = enc = scope.add(Encode$1(parseEncode(spec.encode, spec.type, role, spec.style, scope, { - mod: false, - pulse: markRef - }))); // monitor parent marks to propagate changes - - op.params.parent = scope.encode(); // add post-encoding transforms, if defined - - if (spec.transform) { - spec.transform.forEach(function (_) { - var tx = parseTransform(_, scope), - md = tx.metadata; - - if (md.generates || md.changes) { - error('Mark transforms should not generate new data.'); - } - - if (!md.nomod) enc.params.mod = true; // update encode mod handling - - tx.params.pulse = ref(op); - scope.add(op = tx); - }); - } // if item sort specified, perform post-encoding - - - if (spec.sort) { - op = scope.add(SortItems$1({ - sort: scope.compareRef(spec.sort), - pulse: ref(op) - })); - } - - encodeRef = ref(op); // add view layout operator if needed - - if (facet || layout) { - layout = scope.add(ViewLayout$1({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - mark: markRef, - pulse: encodeRef - })); - layoutRef = ref(layout); - } // compute bounding boxes - - - bound = scope.add(Bound$1({ - mark: markRef, - pulse: layoutRef || encodeRef - })); - boundRef = ref(bound); // if group mark, recurse to parse nested content - - if (group) { - // juggle layout & bounds to ensure they run *after* any faceting transforms - if (nested) { - ops = scope.operators; - ops.pop(); - if (layout) ops.pop(); - } - - scope.pushState(encodeRef, layoutRef || boundRef, joinRef); - facet ? parseFacet(spec, scope, input) // explicit facet - : nested ? parseSubflow(spec, scope, input) // standard mark group - : scope.parse(spec); // guide group, we can avoid nested scopes - - scope.popState(); - - if (nested) { - if (layout) ops.push(layout); - ops.push(bound); - } - } // if requested, add overlap removal transform - - - if (overlap) { - boundRef = parseOverlap(overlap, boundRef, scope); - } // render / sieve items - - - render = scope.add(Render$1({ - pulse: boundRef - })); - sieve = scope.add(Sieve$1({ - pulse: ref(render) - }, undefined, scope.parent())); // if mark is named, make accessible as reactive geometry - // add trigger updates if defined - - if (spec.name != null) { - name = spec.name; - scope.addData(name, new DataScope(scope, store, render, sieve)); - if (spec.on) spec.on.forEach(function (on) { - if (on.insert || on.remove || on.toggle) { - error('Marks only support modify triggers.'); - } - - parseTrigger(on, scope, name); - }); - } - } - - function parseOverlap(overlap, source, scope) { - var method = overlap.method, - bound = overlap.bound, - sep = overlap.separation, - tol; - var params = { - separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, - method: isSignal(method) ? scope.signalRef(method.signal) : method, - pulse: source - }; - - if (overlap.order) { - params.sort = scope.compareRef({ - field: overlap.order - }); - } - - if (bound) { - tol = bound.tolerance; - params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; - params.boundScale = scope.scaleRef(bound.scale); - params.boundOrient = bound.orient; - } - - return ref(scope.add(Overlap$1(params))); - } - - function parseLegend(spec, scope) { - var config = scope.config.legend, - encode = spec.encode || {}, - legendEncode = encode.legend || {}, - name = legendEncode.name || undefined, - interactive = legendEncode.interactive, - style = legendEncode.style, - _ = lookup$5(spec, config), - scales = {}, - scale = 0, - entryEncode, - entryLayout, - params, - children, - type, - datum, - dataRef, - entryRef; // resolve scales and 'canonical' scale name - - - LegendScales.forEach(function (s) { - return spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0; - }); - if (!scale) error('Missing valid scale for legend.'); // resolve legend type (symbol, gradient, or discrete gradient) - - type = legendType(spec, scope.scaleType(scale)); // single-element data source for legend group - - datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - dataRef = ref(scope.add(Collect$1(null, [datum]))); // encoding properties for legend group - - legendEncode = extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip$2); // encoding properties for legend entry sub-group - - entryEncode = { - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - } - }; // data source for legend values - - entryRef = ref(scope.add(LegendEntries$1(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); // continuous gradient legend - - if (type === Gradient$1) { - children = [legendGradient(spec, scale, config, encode.gradient), legendGradientLabels(spec, config, encode.labels, entryRef)]; // adjust default tick count based on the gradient length - - params.count = params.count || scope.signalRef("max(2,2*floor((".concat(deref(_.gradientLength()), ")/100))")); - } // discrete gradient legend - else if (type === Discrete$1) { - children = [legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), legendGradientLabels(spec, config, encode.labels, entryRef)]; - } // symbol legend - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns))]; // pass symbol size information to legend entry generator - - params.size = sizeExpression(spec, scope, children[0].marks); - } // generate legend marks - - - children = [guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive: interactive - })]; // include legend title if defined - - if (datum.title) { - children.push(legendTitle(spec, config, encode.title, dataRef)); - } // parse legend specification - - - return parseMark(guideGroup({ - role: LegendRole$1, - from: dataRef, - encode: legendEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name: name, - interactive: interactive, - style: style - }), scope); - } - - function legendType(spec, scaleType) { - var type = spec.type || Symbols$1; - - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { - type = isContinuous(scaleType) ? Gradient$1 : isDiscretizing(scaleType) ? Discrete$1 : Symbols$1; - } - - return type !== Gradient$1 ? type : isDiscretizing(scaleType) ? Discrete$1 : Gradient$1; - } - - function scaleCount(spec) { - return LegendScales.reduce(function (count, type) { - return count + (spec[type] ? 1 : 0); - }, 0); - } - - function buildLegendEncode(_, spec, config) { - var encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - return encode; - } - - function sizeExpression(spec, scope, marks) { - var size = deref(getChannel('size', spec, marks)), - strokeWidth = deref(getChannel('strokeWidth', spec, marks)), - fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - return parseExpression$1("max(ceil(sqrt(".concat(size, ")+").concat(strokeWidth, "),").concat(fontSize, ")"), scope); - } - - function getChannel(name, spec, marks) { - return spec[name] ? "scale(\"".concat(spec[name], "\",datum)") : getEncoding(name, marks[0].encode); - } - - function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); - } - - var angleExpr = "item.orient===\"".concat(Left$1, "\"?-90:item.orient===\"").concat(Right$1, "\"?90:0"); - - function parseTitle(spec, scope) { - spec = isString(spec) ? { - text: spec - } : spec; - - var _ = lookup$5(spec, scope.config.title), - encode = spec.encode || {}, - userEncode = encode.group || {}, - name = userEncode.name || undefined, - interactive = userEncode.interactive, - style = userEncode.style, - children = [], - datum, - dataRef; // single-element data source for group title - - - datum = {}; - dataRef = ref(scope.add(Collect$1(null, [datum]))); // include title text - - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); // include subtitle text - - if (spec.subtitle) { - children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - } // parse title specification - - - return parseMark(guideGroup({ - role: TitleRole$1, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name: name, - interactive: interactive, - style: style - }), scope); - } // provide backwards-compatibility for title custom encode; - // the top-level encode block has been *deprecated*. - - - function titleEncode(spec) { - var encode = spec.encode; - return encode && encode.title || extend({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); - } - - function groupEncode(_, userEncode) { - var encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: { - signal: alignExpr - }, - angle: { - signal: angleExpr - }, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') - }); - return extendEncode(encode, userEncode, Skip$2); - } - - function buildTitle(spec, _, userEncode, dataRef) { - var zero = { - value: 0 - }, - text = spec.text, - encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') - }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode: encode - }, userEncode); - } - - function buildSubTitle(spec, _, userEncode, dataRef) { - var zero = { - value: 0 - }, - text = spec.subtitle, - encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') - }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode: encode - }, userEncode); - } - - function parseData$1(data, scope) { - var transforms = []; - - if (data.transform) { - data.transform.forEach(function (tx) { - transforms.push(parseTransform(tx, scope)); - }); - } - - if (data.on) { - data.on.forEach(function (on) { - parseTrigger(on, scope, data.name); - }); - } - - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); - } - /** - * Analyze a data pipeline, add needed operators. - */ - - - function analyze(data, scope, ops) { - var output = [], - source = null, - modify = false, - generate = false, - upstream, - i, - n, - t, - m; - - if (data.values) { - // hard-wired input data set - if (hasSignal(data.values) || hasSignal(data.format)) { - // if either values or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format - })); - } - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format - })); - } - } else if (data.source) { - // derives from one or more other data sets - source = upstream = array(data.source).map(function (d) { - return ref(scope.getData(d).output); - }); - output.push(null); // populate later - } // scan data transforms, add collectors as needed - - - for (i = 0, n = ops.length; i < n; ++i) { - t = ops[i]; - m = t.metadata; - - if (!source && !m.source) { - output.push(source = collect()); - } - - output.push(t); - if (m.generates) generate = true; - if (m.modifies && !generate) modify = true; - if (m.source) source = t;else if (m.changes) source = null; - } - - if (upstream) { - n = upstream.length - 1; - output[0] = Relay$1({ - derive: modify, - pulse: n ? upstream : upstream[0] - }); - - if (modify || n) { - // collect derived and multi-pulse tuples - output.splice(1, 0, collect()); - } - } - - if (!source) output.push(collect()); - output.push(Sieve$1({})); - return output; - } - - function collect(values) { - var s = Collect$1({}, values); - s.metadata = { - source: true - }; - return s; - } - - function load$1(scope, data) { - return Load$1({ - url: data.url ? scope.property(data.url) : undefined, - async: data.async ? scope.property(data.async) : undefined, - values: data.values ? scope.property(data.values) : undefined, - format: scope.objectProperty(data.format) - }); - } - - var isX = function isX(orient) { - return orient === Bottom$1 || orient === Top$1; - }; // get sign coefficient based on axis orient - - - var getSign = function getSign(orient, a, b) { - return isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left$1 || orient === Top$1 ? a : b; - }; // condition on axis x-direction - - - var ifX = function ifX(orient, a, b) { - return isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b; - }; // condition on axis y-direction - - - var ifY = function ifY(orient, a, b) { - return isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a; - }; - - var ifTop = function ifTop(orient, a, b) { - return isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top$1 ? { - value: a - } : { - value: b - }; - }; - - var ifRight = function ifRight(orient, a, b) { - return isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right$1 ? { - value: a - } : { - value: b - }; - }; - - var ifXEnc = function ifXEnc($orient, a, b) { - return ifEnc("".concat($orient, " === '").concat(Top$1, "' || ").concat($orient, " === '").concat(Bottom$1, "'"), a, b); - }; - - var ifYEnc = function ifYEnc($orient, a, b) { - return ifEnc("".concat($orient, " !== '").concat(Top$1, "' && ").concat($orient, " !== '").concat(Bottom$1, "'"), a, b); - }; - - var ifLeftTopExpr = function ifLeftTopExpr($orient, a, b) { - return ifExpr("".concat($orient, " === '").concat(Left$1, "' || ").concat($orient, " === '").concat(Top$1, "'"), a, b); - }; - - var ifTopExpr = function ifTopExpr($orient, a, b) { - return ifExpr("".concat($orient, " === '").concat(Top$1, "'"), a, b); - }; - - var ifRightExpr = function ifRightExpr($orient, a, b) { - return ifExpr("".concat($orient, " === '").concat(Right$1, "'"), a, b); - }; - - var ifEnc = function ifEnc(test, a, b) { - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? a.signal || $(a.value) : null; - b = b ? b.signal || $(b.value) : null; - return { - signal: "".concat(test, " ? (").concat(a, ") : (").concat(b, ")") - }; - } else { - // otherwise generate rule set - return [extend({ - test: test - }, a)].concat(b || []); - } - }; - - var isSimple = function isSimple(enc) { - return enc == null || Object.keys(enc).length === 1; - }; - - var ifExpr = function ifExpr(test, a, b) { - return { - signal: "".concat(test, " ? (").concat(toExpr(a), ") : (").concat(toExpr(b), ")") - }; - }; - - var ifOrient = function ifOrient($orient, t, b, l, r) { - return { - signal: (l != null ? "".concat($orient, " === '").concat(Left$1, "' ? (").concat(toExpr(l), ") : ") : '') + (b != null ? "".concat($orient, " === '").concat(Bottom$1, "' ? (").concat(toExpr(b), ") : ") : '') + (r != null ? "".concat($orient, " === '").concat(Right$1, "' ? (").concat(toExpr(r), ") : ") : '') + (t != null ? "".concat($orient, " === '").concat(Top$1, "' ? (").concat(toExpr(t), ") : ") : '') + '(null)' - }; - }; - - var toExpr = function toExpr(v) { - return isSignal(v) ? v.signal : v == null ? null : $(v); - }; - - var mult = function mult(sign, value) { - return value === 0 ? 0 : isSignal(sign) ? { - signal: "(".concat(sign.signal, ") * ").concat(value) - } : { - value: sign * value - }; - }; - - var patch = function patch(value, base) { - var s = value.signal; - return s && s.endsWith('(null)') ? { - signal: s.slice(0, -6) + base.signal - } : value; - }; - - function fallback(prop, config, axisConfig, style) { - var styleProp; - - if (config && hasOwnProperty(config, prop)) { - return config[prop]; - } else if (hasOwnProperty(axisConfig, prop)) { - return axisConfig[prop]; - } else if (prop.startsWith('title')) { - switch (prop) { - case 'titleColor': - styleProp = 'fill'; - break; - - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - - return style[GuideTitleStyle][styleProp]; - } else if (prop.startsWith('label')) { - switch (prop) { - case 'labelColor': - styleProp = 'fill'; - break; - - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - - return style[GuideLabelStyle][styleProp]; - } - - return null; - } - - function keys$1(objects) { - var map = {}; - - var _iterator22 = _createForOfIteratorHelper(objects), - _step22; - - try { - for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) { - var obj = _step22.value; - if (!obj) continue; - - for (var _key15 in obj) { - map[_key15] = 1; - } - } - } catch (err) { - _iterator22.e(err); - } finally { - _iterator22.f(); - } - - return Object.keys(map); - } - - function axisConfig(spec, scope) { - var config = scope.config, - style = config.style, - axis = config.axis, - band = scope.scaleType(spec.scale) === 'band' && config.axisBand, - orient = spec.orient, - xy, - or, - key; - - if (isSignal(orient)) { - var xyKeys = keys$1([config.axisX, config.axisY]), - orientKeys = keys$1([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]); - xy = {}; - - var _iterator23 = _createForOfIteratorHelper(xyKeys), - _step23; - - try { - for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) { - key = _step23.value; - xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style)); - } - } catch (err) { - _iterator23.e(err); - } finally { - _iterator23.f(); - } - - or = {}; - - var _iterator24 = _createForOfIteratorHelper(orientKeys), - _step24; - - try { - for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) { - key = _step24.value; - or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style)); - } - } catch (err) { - _iterator24.e(err); - } finally { - _iterator24.f(); - } - } else { - xy = orient === Top$1 || orient === Bottom$1 ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; - } - - var result = xy || or || band ? extend({}, axis, xy, or, band) : axis; - return result; - } - - function axisDomain(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - encode, - enter, - update; - - encode = { - enter: enter = { - opacity: zero$2 - }, - update: update = { - opacity: one$2 - }, - exit: { - opacity: zero$2 - } - }; - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') - }); - var pos0 = position(spec, 0); - var pos1 = position(spec, 1); - enter.x = update.x = ifX(orient, pos0, zero$2); - enter.x2 = update.x2 = ifX(orient, pos1); - enter.y = update.y = ifY(orient, pos0, zero$2); - enter.y2 = update.y2 = ifY(orient, pos1); - return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode: encode - }, userEncode); - } - - function position(spec, pos) { - return { - scale: spec.scale, - range: pos - }; - } - - function axisGrid(spec, config, userEncode, dataRef, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - vscale = spec.gridScale, - sign = getSign(orient, 1, -1), - offset = offsetValue$1(spec.offset, sign), - encode, - enter, - exit, - update, - tickPos, - gridStart, - gridEnd, - sz; - - encode = { - enter: enter = { - opacity: zero$2 - }, - update: update = { - opacity: one$2 - }, - exit: exit = { - opacity: zero$2 - } - }; - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') - }); - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - sz = ifX(orient, { - signal: 'height' - }, { - signal: 'width' - }); - gridStart = vscale ? { - scale: vscale, - range: 0, - mult: sign, - offset: offset - } : { - value: 0, - offset: offset - }; - gridEnd = vscale ? { - scale: vscale, - range: 1, - mult: sign, - offset: offset - } : extend(sz, { - mult: sign, - offset: offset - }); - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); - exit.x = ifX(orient, tickPos); - exit.y = ifY(orient, tickPos); - return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode: encode - }, userEncode); - } - - function offsetValue$1(offset, sign) { - if (sign === 1) ;else if (!isObject(offset)) { - offset = isSignal(sign) ? { - signal: "(".concat(sign.signal, ") * (").concat(offset || 0, ")") - } : sign * (offset || 0); - } else { - var _entry = offset = extend({}, offset); - - while (_entry.mult != null) { - if (!isObject(_entry.mult)) { - _entry.mult = isSignal(sign) // no offset if sign === 1 - ? { - signal: "(".concat(_entry.mult, ") * (").concat(sign.signal, ")") - } : _entry.mult * sign; - return offset; - } else { - _entry = _entry.mult = extend({}, _entry.mult); - } - } - - _entry.mult = sign; - } - return offset; - } - - function axisTicks(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, - enter, - exit, - update, - tickSize, - tickPos; - - encode = { - enter: enter = { - opacity: zero$2 - }, - update: update = { - opacity: one$2 - }, - exit: exit = { - opacity: zero$2 - } - }; - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') - }); - tickSize = encoder(size); - tickSize.mult = sign; - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - update.y = enter.y = ifX(orient, zero$2, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); - exit.x = ifX(orient, tickPos); - update.x = enter.x = ifY(orient, zero$2, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); - exit.y = ifY(orient, tickPos); - return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode: encode - }, userEncode); - } - - function flushExpr(scale, threshold, a, b, c) { - return { - signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')' - }; - } - - function axisLabels(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - scale = spec.scale, - sign = getSign(orient, -1, 1), - flush = deref(_('labelFlush')), - flushOffset = deref(_('labelFlushOffset')), - flushOn = flush === 0 || !!flush, - labelAlign = _('labelAlign'), - labelBaseline = _('labelBaseline'), - encode, - enter, - update, - tickSize, - tickPos, - align, - baseline, - bound, - overlap, - offsetExpr; - - tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; - tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - align = ifX(orient, flushOn ? flushExpr(scale, flush, '"left"', '"right"', '"center"') : { - value: 'center' - }, ifRight(orient, 'left', 'right')); - baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : { - value: 'middle' - }); - offsetExpr = flushExpr(scale, flush, "-(".concat(flushOffset, ")"), flushOffset, 0); - flushOn = flushOn && flushOffset; - enter = { - opacity: zero$2, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - encode = { - enter: enter, - update: update = { - opacity: one$2, - text: { - field: Label - }, - x: enter.x, - y: enter.y, - align: align, - baseline: baseline - }, - exit: { - opacity: zero$2, - x: enter.x, - y: enter.y - } - }; - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') - }, { - align: labelAlign, - baseline: labelBaseline - }); - bound = _('labelBound'); - overlap = _('labelOverlap'); // if overlap method or bound defined, request label overlap removal - - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? { - scale: scale, - orient: orient, - tolerance: bound - } : null - } : undefined; - - if (update.align !== align) { - update.align = patch(update.align, align); - } - - if (update.baseline !== baseline) { - update.baseline = patch(update.baseline, baseline); - } - - return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode: encode, - overlap: overlap - }, userEncode); - } - - function axisTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, - enter, - update, - titlePos; - - encode = { - enter: enter = { - opacity: zero$2, - anchor: encoder(_('titleAnchor', null)), - align: { - signal: alignExpr - } - }, - update: update = extend({}, enter, { - opacity: one$2, - text: encoder(spec.title) - }), - exit: { - opacity: zero$2 - } - }; - titlePos = { - signal: "lerp(range(\"".concat(spec.scale, "\"), ").concat(anchorExpr(0, 1, 0.5), ")") - }; - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero$2, mult(sign, 90)); - enter.baseline = ifX(orient, ifTop(orient, Bottom$1, Top$1), { - value: Bottom$1 - }); - update.angle = enter.angle; - update.baseline = enter.baseline; - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { - // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); - return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode: encode - }, userEncode); - } - - function autoLayout(_, orient, encode, userEncode) { - var auto = function auto(value, dim) { - return value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false; - }; - - var autoY = auto(_('titleX'), 'x'), - autoX = auto(_('titleY'), 'y'); - encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); - } - - function parseAxis(spec, scope) { - var config = axisConfig(spec, scope), - encode = spec.encode || {}, - axisEncode = encode.axis || {}, - name = axisEncode.name || undefined, - interactive = axisEncode.interactive, - style = axisEncode.style, - _ = lookup$5(spec, config), - band = tickBand(_), - datum, - dataRef, - ticksRef, - size, - children; // single-element data source for axis group - - - datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - dataRef = ref(scope.add(Collect$1({}, [datum]))); // encoding properties for axis group item - - axisEncode = extendEncode(buildAxisEncode(_, spec), axisEncode, Skip$2); // data source for axis ticks - - ticksRef = ref(scope.add(AxisTicks$1({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); // generate axis marks - - children = []; // include axis gridlines if requested - - if (datum.grid) { - children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - } // include axis ticks if requested - - - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } // include axis labels if requested - - - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } // include axis domain path if requested - - - if (datum.domain) { - children.push(axisDomain(spec, config, encode.domain, dataRef)); - } // include axis title if defined - - - if (datum.title) { - children.push(axisTitle(spec, config, encode.title, dataRef)); - } // parse axis specification - - - return parseMark(guideGroup({ - role: AxisRole$1, - from: dataRef, - encode: axisEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name: name, - interactive: interactive, - style: style - }), scope); - } - - function buildAxisEncode(_, spec) { - var encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value$2(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: { - signal: "abs(span(range(\"".concat(spec.scale, "\")))") - }, - translate: _('translate'), - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - return encode; - } - - function parseScope(spec, scope, preprocessed) { - var signals = array(spec.signals), - scales = array(spec.scales); // parse signal definitions, if not already preprocessed - - if (!preprocessed) signals.forEach(function (_) { - return parseSignal(_, scope); - }); // parse cartographic projection definitions - - array(spec.projections).forEach(function (_) { - return parseProjection(_, scope); - }); // initialize scale references - - scales.forEach(function (_) { - return initScale(_, scope); - }); // parse data sources - - array(spec.data).forEach(function (_) { - return parseData$1(_, scope); - }); // parse scale definitions - - scales.forEach(function (_) { - return parseScale(_, scope); - }); // parse signal updates - - (preprocessed || signals).forEach(function (_) { - return parseSignalUpdates(_, scope); - }); // parse axis definitions - - array(spec.axes).forEach(function (_) { - return parseAxis(_, scope); - }); // parse mark definitions - - array(spec.marks).forEach(function (_) { - return parseMark(_, scope); - }); // parse legend definitions - - array(spec.legends).forEach(function (_) { - return parseLegend(_, scope); - }); // parse title, if defined - - if (spec.title) parseTitle(spec.title, scope); // parse collected lambda (anonymous) expressions - - scope.parseLambdas(); - return scope; - } - - var rootEncode = function rootEncode(spec) { - return extendEncode({ - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - }, - update: { - width: { - signal: 'width' - }, - height: { - signal: 'height' - } - } - }, spec); - }; - - function parseView(spec, scope) { - var config = scope.config; // add scenegraph root - - var root = ref(scope.root = scope.add(operator())); // parse top-level signal definitions - - var signals = collectSignals(spec, config); - signals.forEach(function (_) { - return parseSignal(_, scope); - }); // assign description, event, legend, and locale configuration - - scope.description = spec.description || config.description; - scope.eventConfig = config.events; - scope.legends = scope.objectProperty(config.legend && config.legend.layout); - scope.locale = config.locale; // store root group item - - var input = scope.add(Collect$1()); // encode root group item - - var encode = scope.add(Encode$1(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole$1, spec.style, scope, { - pulse: ref(input) - }))); // perform view layout - - var parent = scope.add(ViewLayout$1({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) - })); - scope.operators.pop(); // parse remainder of specification - - scope.pushState(ref(encode), ref(parent), null); - parseScope(spec, scope, signals); - scope.operators.push(parent); // bound / render / sieve root item - - var op = scope.add(Bound$1({ - mark: root, - pulse: ref(parent) - })); - op = scope.add(Render$1({ - pulse: ref(op) - })); - op = scope.add(Sieve$1({ - pulse: ref(op) - })); // track metadata for root item - - scope.addData('root', new DataScope(scope, input, input, op)); - return scope; - } - - function signalObject(name, value) { - return value && value.signal ? { - name: name, - update: value.signal - } : { - name: name, - value: value - }; - } - /** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ - - - function collectSignals(spec, config) { - var _ = function _(name) { - return value$2(spec[name], config[name]); - }, - signals = [signalObject('background', _('background')), signalObject('autosize', parseAutosize(_('autosize'))), signalObject('padding', parsePadding(_('padding'))), signalObject('width', _('width') || 0), signalObject('height', _('height') || 0)], - pre = signals.reduce(function (p, s) { - return p[s.name] = s, p; - }, {}), - map = {}; // add spec signal array - - - array(spec.signals).forEach(function (s) { - if (hasOwnProperty(pre, s.name)) { - // merge if built-in signal - s = extend(pre[s.name], s); - } else { - // otherwise add to signal list - signals.push(s); - } - - map[s.name] = s; - }); // add config signal array - - array(config.signals).forEach(function (s) { - if (!hasOwnProperty(map, s.name) && !hasOwnProperty(pre, s.name)) { - // add to signal list if not already defined - signals.push(s); - } - }); - return signals; - } - - function Scope$1(config, options) { - this.config = config || {}; - this.options = options || {}; - this.bindings = []; - this.field = {}; - this.signals = {}; - this.lambdas = {}; - this.scales = {}; - this.events = {}; - this.data = {}; - this.streams = []; - this.updates = []; - this.operators = []; - this.eventConfig = null; - this.locale = null; - this._id = 0; - this._subid = 0; - this._nextsub = [0]; - this._parent = []; - this._encode = []; - this._lookup = []; - this._markpath = []; - } - - function Subscope(scope) { - this.config = scope.config; - this.options = scope.options; - this.legends = scope.legends; - this.field = Object.create(scope.field); - this.signals = Object.create(scope.signals); - this.lambdas = Object.create(scope.lambdas); - this.scales = Object.create(scope.scales); - this.events = Object.create(scope.events); - this.data = Object.create(scope.data); - this.streams = []; - this.updates = []; - this.operators = []; - this._id = 0; - this._subid = ++scope._nextsub[0]; - this._nextsub = scope._nextsub; - this._parent = scope._parent.slice(); - this._encode = scope._encode.slice(); - this._lookup = scope._lookup.slice(); - this._markpath = scope._markpath; - } - - var prototype$1u = Scope$1.prototype = Subscope.prototype; // ---- - - prototype$1u.parse = function (spec) { - return parseScope(spec, this); - }; - - prototype$1u.fork = function () { - return new Subscope(this); - }; - - prototype$1u.isSubscope = function () { - return this._subid > 0; - }; - - prototype$1u.toRuntime = function () { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; - }; - - prototype$1u.id = function () { - return (this._subid ? this._subid + ':' : 0) + this._id++; - }; - - prototype$1u.add = function (op) { - this.operators.push(op); - op.id = this.id(); // if pre-registration references exist, resolve them now - - if (op.refs) { - op.refs.forEach(function (ref) { - ref.$ref = op.id; - }); - op.refs = null; - } - - return op; - }; - - prototype$1u.proxy = function (op) { - var vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy$1({ - value: vref - })); - }; - - prototype$1u.addStream = function (stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; - }; - - prototype$1u.addUpdate = function (update) { - this.updates.push(update); - return update; - }; // Apply metadata - - - prototype$1u.finish = function () { - var name, ds; // annotate root - - if (this.root) this.root.root = true; // annotate signals - - for (name in this.signals) { - this.signals[name].signal = name; - } // annotate scales - - - for (name in this.scales) { - this.scales[name].scale = name; - } // annotate data sets - - - function annotate(op, name, type) { - var data, list; - - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } - } - - for (name in this.data) { - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - - for (var field in ds.index) { - annotate(ds.index[field], name, 'index:' + field); - } - } - - return this; - }; // ---- - - - prototype$1u.pushState = function (encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve$1({ - pulse: encode - })))); - - this._parent.push(parent); - - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - - this._markpath.push(-1); - }; - - prototype$1u.popState = function () { - this._encode.pop(); - - this._parent.pop(); - - this._lookup.pop(); - - this._markpath.pop(); - }; - - prototype$1u.parent = function () { - return peek(this._parent); - }; - - prototype$1u.encode = function () { - return peek(this._encode); - }; - - prototype$1u.lookup = function () { - return peek(this._lookup); - }; - - prototype$1u.markpath = function () { - var p = this._markpath; - return ++p[p.length - 1]; - }; // ---- - - - prototype$1u.fieldRef = function (field, name) { - if (isString(field)) return fieldRef(field, name); - - if (!field.signal) { - error('Unsupported field reference: ' + $(field)); - } - - var s = field.signal, - f = this.field[s], - params; - - if (!f) { - params = { - name: this.signalRef(s) - }; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field$1(params))); - } - - return f; - }; - - prototype$1u.compareRef = function (cmp) { - function check(_) { - if (isSignal(_)) { - signal = true; - return scope.signalRef(_.signal); - } else if (isExpr(_)) { - signal = true; - return scope.exprRef(_.expr); - } else { - return _; - } - } - - var scope = this, - signal = false, - fields = array(cmp.field).map(check), - orders = array(cmp.order).map(check); - return signal ? ref(this.add(Compare$1({ - fields: fields, - orders: orders - }))) : compareRef(fields, orders); - }; - - prototype$1u.keyRef = function (fields, flat) { - function check(_) { - if (isSignal(_)) { - signal = true; - return ref(sig[_.signal]); - } else { - return _; - } - } - - var sig = this.signals, - signal = false; - fields = array(fields).map(check); - return signal ? ref(this.add(Key$1({ - fields: fields, - flat: flat - }))) : keyRef(fields, flat); - }; - - prototype$1u.sortRef = function (sort) { - if (!sort) return sort; // including id ensures stable sorting - - var a = aggrField(sort.op, sort.field), - o = sort.order || Ascending; - return o.signal ? ref(this.add(Compare$1({ - fields: a, - orders: this.signalRef(o.signal) - }))) : compareRef(a, o); - }; // ---- - - - prototype$1u.event = function (source, type) { - var key = source + ':' + type; - - if (!this.events[key]) { - var id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - - return this.events[key]; - }; // ---- - - - prototype$1u.hasOwnSignal = function (name) { - return hasOwnProperty(this.signals, name); - }; - - prototype$1u.addSignal = function (name, value) { - if (this.hasOwnSignal(name)) { - error('Duplicate signal name: ' + $(name)); - } - - var op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; - }; - - prototype$1u.getSignal = function (name) { - if (!this.signals[name]) { - error('Unrecognized signal name: ' + $(name)); - } - - return this.signals[name]; - }; - - prototype$1u.signalRef = function (s) { - if (this.signals[s]) { - return ref(this.signals[s]); - } else if (!hasOwnProperty(this.lambdas, s)) { - this.lambdas[s] = this.add(operator(null)); - } - - return ref(this.lambdas[s]); - }; - - prototype$1u.parseLambdas = function () { - var code = Object.keys(this.lambdas); - - for (var i = 0, n = code.length; i < n; ++i) { - var s = code[i], - e = parseExpression$1(s, this), - op = this.lambdas[s]; - op.params = e.$params; - op.update = e.$expr; - } - }; - - prototype$1u.property = function (spec) { - return spec && spec.signal ? this.signalRef(spec.signal) : spec; - }; - - prototype$1u.objectProperty = function (spec) { - return !spec || !isObject(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); - }; - - function propertyLambda(spec) { - return (isArray(spec) ? arrayLambda : objectLambda)(spec); - } - - function arrayLambda(array) { - var code = '[', - i = 0, - n = array.length, - value; - - for (; i < n; ++i) { - value = array[i]; - code += (i > 0 ? ',' : '') + (isObject(value) ? value.signal || propertyLambda(value) : $(value)); - } - - return code + ']'; - } - - function objectLambda(obj) { - var code = '{', - i = 0, - key, - value; - - for (key in obj) { - value = obj[key]; - code += (++i > 1 ? ',' : '') + $(key) + ':' + (isObject(value) ? value.signal || propertyLambda(value) : $(value)); - } - - return code + '}'; - } - - prototype$1u.exprRef = function (code, name) { - var params = { - expr: parseExpression$1(code, this) - }; - if (name) params.expr.$name = name; - return ref(this.add(Expression$1(params))); - }; - - prototype$1u.addBinding = function (name, bind) { - if (!this.bindings) { - error('Nested signals do not support binding: ' + $(name)); - } - - this.bindings.push(extend({ - signal: name - }, bind)); - }; // ---- - - - prototype$1u.addScaleProj = function (name, transform) { - if (hasOwnProperty(this.scales, name)) { - error('Duplicate scale or projection name: ' + $(name)); - } - - this.scales[name] = this.add(transform); - }; - - prototype$1u.addScale = function (name, params) { - this.addScaleProj(name, Scale$1(params)); - }; - - prototype$1u.addProjection = function (name, params) { - this.addScaleProj(name, Projection$1(params)); - }; - - prototype$1u.getScale = function (name) { - if (!this.scales[name]) { - error('Unrecognized scale name: ' + $(name)); - } - - return this.scales[name]; - }; - - prototype$1u.projectionRef = prototype$1u.scaleRef = function (name) { - return ref(this.getScale(name)); - }; - - prototype$1u.projectionType = prototype$1u.scaleType = function (name) { - return this.getScale(name).params.type; - }; // ---- - - - prototype$1u.addData = function (name, dataScope) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - - return this.data[name] = dataScope; - }; - - prototype$1u.getData = function (name) { - if (!this.data[name]) { - error('Undefined data set name: ' + $(name)); - } - - return this.data[name]; - }; - - prototype$1u.addDataPipeline = function (name, entries) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - - return this.addData(name, DataScope.fromEntries(this, entries)); - }; - /** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ - - - function defaults() { - var defaultFont = 'sans-serif', - defaultSymbolSize = 30, - defaultStrokeWidth = 2, - defaultColor = '#4c78a8', - black = '#000', - gray = '#888', - lightGray = '#ddd'; - return { - // default visualization description - description: 'Vega visualization', - // default padding around visualization - padding: 0, - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - // default view background color - // covers the entire view component - background: null, - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: { - allow: ['wheel'] - } - }, - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - } - }, - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 - }, - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 - }, - // correction for centering bias - axisBand: { - tickOffset: -0.5 - }, - // defaults for cartographic projection - projection: { - type: 'mercator' - }, - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { - direction: 'vertical' - }, - right: { - direction: 'vertical' - } - } - }, - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [1, 0] - }, - symbol: ['circle', 'square', 'triangle-up', 'cross', 'diamond', 'triangle-right', 'triangle-down', 'triangle-left'] - } - }; - } - - function parse$6(spec, config, options) { - if (!isObject(spec)) { - error('Input Vega specification must be an object.'); - } - - config = mergeConfig(defaults(), config, spec.config); - return parseView(spec, new Scope$1(config, options)).toRuntime(); - } // -- Transforms ----- - - - extend(transforms, tx, vtx, encode, geo, force, tree$1, reg, voronoi, wordcloud, xf); - exports.Bounds = Bounds; - exports.CanvasHandler = CanvasHandler; - exports.CanvasRenderer = CanvasRenderer; - exports.DATE = DATE; - exports.DAY = DAY; - exports.DAYOFYEAR = DAYOFYEAR; - exports.Dataflow = Dataflow; - exports.Debug = Debug; - exports.Error = Error$1; - exports.EventStream = EventStream; - exports.Gradient = Gradient; - exports.GroupItem = GroupItem; - exports.HOURS = HOURS; - exports.Handler = Handler; - exports.Info = Info; - exports.Item = Item; - exports.MILLISECONDS = MILLISECONDS; - exports.MINUTES = MINUTES; - exports.MONTH = MONTH; - exports.Marks = Marks; - exports.MultiPulse = MultiPulse; - exports.None = None; - exports.Operator = Operator; - exports.Parameters = Parameters; - exports.Pulse = Pulse; - exports.QUARTER = QUARTER; - exports.RenderType = RenderType; - exports.Renderer = Renderer; - exports.ResourceLoader = ResourceLoader; - exports.SECONDS = SECONDS; - exports.SVGHandler = SVGHandler; - exports.SVGRenderer = SVGRenderer; - exports.SVGStringRenderer = SVGStringRenderer; - exports.Scenegraph = Scenegraph; - exports.TIME_UNITS = TIME_UNITS; - exports.Transform = Transform; - exports.View = View; - exports.WEEK = WEEK; - exports.Warn = Warn; - exports.YEAR = YEAR; - exports.accessor = accessor; - exports.accessorFields = accessorFields; - exports.accessorName = accessorName; - exports.array = array; - exports.bandwidthNRD = bandwidthNRD; - exports.bin = bin; - exports.bootstrapCI = bootstrapCI; - exports.boundClip = boundClip; - exports.boundContext = context; - exports.boundItem = boundItem; - exports.boundMark = boundMark; - exports.boundStroke = boundStroke; - exports.changeset = changeset; - exports.clampRange = clampRange; - exports.closeTag = closeTag; - exports.compare = compare; - exports.constant = constant; - exports.cumulativeLogNormal = cumulativeLogNormal; - exports.cumulativeNormal = cumulativeNormal; - exports.cumulativeUniform = cumulativeUniform; - exports.dayofyear = dayofyear; - exports.debounce = debounce; - exports.defaultLocale = defaultLocale$2; - exports.definition = definition; - exports.densityLogNormal = densityLogNormal; - exports.densityNormal = densityNormal; - exports.densityUniform = densityUniform; - exports.domChild = domChild; - exports.domClear = domClear; - exports.domCreate = domCreate; - exports.domFind = domFind; - exports.dotbin = dotbin; - exports.error = error; - exports.expressionFunction = expressionFunction; - exports.extend = extend; - exports.extent = extent; - exports.extentIndex = extentIndex; - exports.falsy = falsy; - exports.fastmap = fastmap; - exports.field = field; - exports.flush = flush; - exports.font = font; - exports.fontFamily = fontFamily; - exports.fontSize = fontSize; - exports.format = format; - exports.formatLocale = numberFormatDefaultLocale; - exports.formats = formats; - exports.hasOwnProperty = hasOwnProperty; - exports.id = id; - exports.identity = identity; - exports.inferType = inferType; - exports.inferTypes = inferTypes; - exports.ingest = ingest; - exports.inherits = inherits; - exports.inrange = inrange; - exports.interpolate = interpolate$1; - exports.interpolateColors = interpolateColors; - exports.interpolateRange = interpolateRange; - exports.intersect = intersect$1; - exports.intersectBoxLine = intersectBoxLine; - exports.intersectPath = intersectPath; - exports.intersectPoint = intersectPoint; - exports.intersectRule = intersectRule; - exports.isArray = isArray; - exports.isBoolean = isBoolean; - exports.isDate = isDate; - exports.isFunction = isFunction; - exports.isNumber = isNumber; - exports.isObject = isObject; - exports.isRegExp = isRegExp; - exports.isString = isString; - exports.isTuple = isTuple; - exports.key = key; - exports.lerp = lerp; - exports.lineHeight = lineHeight; - exports.loader = loader; - exports.locale = locale$2; - exports.logger = logger; - exports.lruCache = lruCache; - exports.merge = merge; - exports.mergeConfig = mergeConfig; - exports.multiLineOffset = multiLineOffset; - exports.one = one; - exports.openTag = openTag; - exports.pad = pad; - exports.panLinear = panLinear; - exports.panLog = panLog; - exports.panPow = panPow; - exports.panSymlog = panSymlog; - exports.parse = parse$6; - exports.pathCurves = curves; - exports.pathEqual = pathEqual; - exports.pathParse = pathParse; - exports.pathRectangle = vg_rect; - exports.pathRender = pathRender; - exports.pathSymbols = symbols; - exports.pathTrail = vg_trail; - exports.peek = peek; - exports.point = point$4; - exports.projection = projection$1; - exports.quantileLogNormal = quantileLogNormal; - exports.quantileNormal = quantileNormal; - exports.quantileUniform = quantileUniform; - exports.quantiles = quantiles; - exports.quantizeInterpolator = quantizeInterpolator; - exports.quarter = quarter; - exports.quartiles = quartiles; - exports.randomInteger = integer; - exports.randomKDE = randomKDE; - exports.randomLCG = lcg; - exports.randomLogNormal = randomLogNormal; - exports.randomMixture = randomMixture; - exports.randomNormal = randomNormal; - exports.randomUniform = randomUniform; - exports.read = read; - exports.regressionExp = regressionExp; - exports.regressionLinear = regressionLinear; - exports.regressionLoess = regressionLoess; - exports.regressionLog = regressionLog; - exports.regressionPoly = regressionPoly; - exports.regressionPow = regressionPow; - exports.regressionQuad = regressionQuad; - exports.renderModule = renderModule; - exports.repeat = repeat; - exports.resetDefaultLocale = resetDefaultLocale; - exports.resetSVGClipId = resetSVGClipId; - exports.resetSVGDefIds = resetSVGDefIds; - exports.responseType = responseType; - exports.runtimeContext = context$2; - exports.sampleCurve = sampleCurve; - exports.sampleLogNormal = sampleLogNormal; - exports.sampleNormal = sampleNormal; - exports.sampleUniform = sampleUniform; - exports.scale = scale$2; - exports.sceneEqual = sceneEqual; - exports.sceneFromJSON = sceneFromJSON; - exports.scenePickVisit = pickVisit; - exports.sceneToJSON = sceneToJSON; - exports.sceneVisit = visit; - exports.sceneZOrder = zorder; - exports.scheme = scheme; - exports.setRandom = setRandom; - exports.span = span; - exports.splitAccessPath = splitAccessPath; - exports.stringValue = $; - exports.textMetrics = textMetrics; - exports.timeBin = timeBin; - exports.timeFloor = timeFloor; - exports.timeFormatLocale = timeFormatDefaultLocale; - exports.timeInterval = timeInterval; - exports.timeOffset = timeOffset; - exports.timeSequence = timeSequence; - exports.timeUnitSpecifier = timeUnitSpecifier; - exports.timeUnits = timeUnits; - exports.toBoolean = toBoolean; - exports.toDate = toDate; - exports.toNumber = toNumber; - exports.toSet = toSet; - exports.toString = toString; - exports.transform = transform$1; - exports.transforms = transforms; - exports.truncate = truncate; - exports.truthy = truthy; - exports.tupleid = tupleid; - exports.typeParsers = typeParsers; - exports.utcFloor = utcFloor; - exports.utcInterval = utcInterval; - exports.utcOffset = utcOffset; - exports.utcSequence = utcSequence; - exports.utcdayofyear = utcdayofyear; - exports.utcquarter = utcquarter; - exports.utcweek = utcweek; - exports.version = version; - exports.visitArray = visitArray; - exports.week = week; - exports.writeConfig = writeConfig; - exports.zero = zero; - exports.zoomLinear = zoomLinear; - exports.zoomLog = zoomLog; - exports.zoomPow = zoomPow; - exports.zoomSymlog = zoomSymlog; - Object.defineProperty(exports, '__esModule', { - value: true - }); -}); \ No newline at end of file diff --git a/node_modules/vega/build-es5/vega.min.js b/node_modules/vega/build-es5/vega.min.js deleted file mode 100644 index e91098a..0000000 --- a/node_modules/vega/build-es5/vega.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";function _classCallCheck(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,n){for(var e=0;e=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,o=!1;return{s:function(){e=t[Symbol.iterator]()},n:function(){var t=e.next();return u=t.done,t},e:function(t){o=!0,a=t},f:function(){try{u||null==e.return||e.return()}finally{if(o)throw a}}}}function _unsupportedIterableToArray(t,n){if(t){if("string"==typeof t)return _arrayLikeToArray(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,n):void 0}}function _arrayLikeToArray(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);en&&l(),u=n=e+1):"]"===r&&(u||_("Access path missing open bracket: "+t),u>0&&l(),u=0,n=e+1):e>n?l():n=e+1}return u&&_("Access path missing closing bracket: "+t),a&&_("Access path missing closing quote: "+t),e>n&&(e++,l()),i}function b(t,n,e){var r=x(t);return t=1===r.length?r[0]:t,d((e&&e.get||g)(r),[t],n||t)}var w=[],k=b("id"),A=d((function(t){return t}),w,"identity"),M=d((function(){return 0}),w,"zero"),E=d((function(){return 1}),w,"one"),C=d((function(){return!0}),w,"true"),D=d((function(){return!1}),w,"false");function F(t,n,e){var r=[n].concat([].slice.call(e));console[t].apply(console,r)}function S(t,n){var e=t||0;return{level:function(t){return arguments.length?(e=+t,this):e},error:function(){return e>=1&&F(n||"error","ERROR",arguments),this},warn:function(){return e>=2&&F(n||"warn","WARN",arguments),this},info:function(){return e>=3&&F(n||"log","INFO",arguments),this},debug:function(){return e>=4&&F(n||"log","DEBUG",arguments),this}}}var T=Array.isArray;function B(t){return t===Object(t)}var O=function(t){return"__proto__"!==t};function z(){for(var t=arguments.length,n=new Array(t),e=0;e=e-n?[n,e]:[i=Math.min(Math.max(i,n),e-r),i+r]}function it(t){return"function"==typeof t}function at(t,n,e){e=e||{},n=et(n)||[];var r=[],i=[],a={},u=e.comparator||ot;return et(t).forEach((function(t,u){null!=t&&(r.push("descending"===n[u]?-1:1),i.push(t=it(t)?t:b(t,null,e)),(v(t)||[]).forEach((function(t){return a[t]=1})))})),0===i.length?null:d(u(i,r),Object.keys(a))}var ut=function(t,n){return(tn||null==n)&&null!=t?1:(n=n instanceof Date?+n:n,(t=t instanceof Date?+t:t)!==t&&n==n?-1:n!=n&&t==t?1:0)},ot=function(t,n){return 1===t.length?st(t[0],n[0]):lt(t,n,t.length)},st=function(t,n){return function(e,r){return ut(t(e),t(r))*n}},lt=function(t,n,e){return n.push(0),function(r,i){for(var a,u=0,o=-1;0===u&&++oa&&(a=r))}else{for(r=n(t[u]);ua&&(a=r))}return[i,a]}function pt(t,n){var e,r,i,a,u,o=-1,s=t.length;if(null==n){for(;++o=r){e=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++or&&(e=r,a=o),i=r){e=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++or&&(e=r,a=o),iu&&(i=a,a=u,u=i),r=void 0===r||r,((e=void 0===e||e)?a<=t:at&&(e=n,n={},r=1),n[i]=a};return i(),{clear:i,has:function(t){return gt(n,t)||gt(e,t)},get:function(t){return gt(n,t)?n[t]:gt(e,t)?a(t,e[t]):void 0},set:function(t,e){return gt(n,t)?n[t]=e:a(t,e)}}}function St(t,n,e,r){var i=n.length,a=e.length;if(!a)return n;if(!i)return e;for(var u=r||new n.constructor(i+a),o=0,s=0,l=0;o0?e[s++]:n[o++];for(;o=0;)e+=t;return e}function Bt(t,n,e,r){var i=e||" ",a=t+"",u=n-a.length;return u<=0?a:"left"===r?Tt(i,u)+a:"center"===r?Tt(i,~~(u/2))+a+Tt(i,Math.ceil(u/2)):a+Tt(i,u)}function Ot(t){return t&&P(t)-t[0]||0}function zt(t){return T(t)?"["+t.map(zt)+"]":B(t)||Et(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function Rt(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}function Nt(t){return At(t)||kt(t)?t:Date.parse(t)}function Pt(t,n){return n=n||Nt,null==t||""===t?null:n(t)}function qt(t){return null==t||""===t?null:t+""}function Lt(t){for(var n={},e=0,r=t.length;e=0&&e.splice(i,1)),e},e}function $t(t,n){return Ht.apply(this,arguments)}function Ht(){return(Ht=_asyncToGenerator(regeneratorRuntime.mark((function t(n,e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e(n);case 3:t.next=8;break;case 5:t.prev=5,t.t0=t.catch(0),n.error(t.t0);case 8:case"end":return t.stop()}}),t,null,[[0,5]])})))).apply(this,arguments)}var Wt=Symbol("vega_id"),Yt=1;function Gt(t){return!(!t||!Vt(t))}function Vt(t){return t[Wt]}function Xt(t,n){return t[Wt]=n,t}function Jt(t){var n=t===Object(t)?t:{data:t};return Vt(n)?n:Xt(n,Yt++)}function Zt(t){return Qt(t,Jt({}))}function Qt(t,n){for(var e in t)n[e]=t[e];return n}function Kt(t,n){return Xt(n,Vt(t))}function tn(t,n){return t?n?function(e,r){return t(e,r)||Vt(n(e))-Vt(n(r))}:function(n,e){return t(n,e)||Vt(n)-Vt(e)}:null}function nn(t){return t&&t.constructor===en}function en(){var t=[],n=[],e=[],r=[],i=[],a=null,u=!1;return{constructor:en,insert:function(n){for(var e=et(n),r=0,i=e.length;r0&&(m(d,h,f.value),o.modifies(h));for(l=0,c=i.length;l0&&m(t,f.field,f.value)})),o.modifies(f.field);if(u)o.mod=n.length||r.length?s.filter((function(t){return v[Vt(t)]>0})):s.slice();else for(p in g)o.mod.push(g[p]);return(a||null==a&&(n.length||r.length))&&o.clean(!0),o}}}var rn="_:mod:_";function an(){Object.defineProperty(this,rn,{writable:!0,value:{}})}var un=an.prototype;un.set=function(t,n,e,r){var i=this,a=i[t],u=i[rn];return null!=n&&n>=0?(a[n]!==e||r)&&(a[n]=e,u[n+":"+t]=-1,u[t]=-1):(a!==e||r)&&(i[t]=e,u[t]=T(e)?1+e.length:-1),i},un.modified=function(t,n){var e,r=this[rn];if(!arguments.length){for(e in r)if(r[e])return!0;return!1}if(T(t)){for(e=0;e=0?n+1t?(n=e,1):0}))},vn.debounce=function(t){var n=pn();return this.targets().add(pn(null,null,ft(t,(function(t){var e=t.dataflow;n.receive(t),e&&e.run&&e.run()})))),n},vn.between=function(t,n){var e=!1;return t.targets().add(pn(null,null,(function(){e=!0}))),n.targets().add(pn(null,null,(function(){e=!1}))),this.filter((function(){return e}))};var gn=/^([A-Za-z]+:)?\/\//,mn=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,yn=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;function _n(t,n){return xn.apply(this,arguments)}function xn(){return(xn=_asyncToGenerator(regeneratorRuntime.mark((function t(n,e){var r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sanitize(n,e);case 2:return r=t.sent,i=r.href,t.abrupt("return",r.localFile?this.file(i):this.http(i,e));case 5:case"end":return t.stop()}}),t,this)})))).apply(this,arguments)}function bn(t,n){return wn.apply(this,arguments)}function wn(){return(wn=_asyncToGenerator(regeneratorRuntime.mark((function t(n,e){var r,i,a,u,o,s,l;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=ht({},this.options,e),r=this.fileAccess,i={href:null},s=mn.test(n.replace(yn,"")),null!=n&&"string"==typeof n&&s||_("Sanitize failure, invalid URI: "+zt(n)),l=gn.test(n),(o=e.baseURL)&&!l&&(n.startsWith("/")||"/"===o[o.length-1]||(n="/"+n),n=o+n),u=(a=n.startsWith("file://"))||"file"===e.mode||"http"!==e.mode&&!l&&r,a?n=n.slice("file://".length):n.startsWith("//")&&("file"===e.defaultProtocol?(n=n.slice(2),u=!0):n=(e.defaultProtocol||"http")+":"+n),Object.defineProperty(i,"localFile",{value:!!u}),i.href=n,e.target&&(i.target=e.target+""),e.rel&&(i.rel=e.rel+""),"image"===e.context&&e.crossOrigin&&(i.crossOrigin=e.crossOrigin+""),t.abrupt("return",i);case 14:case"end":return t.stop()}}),t,this)})))).apply(this,arguments)}function kn(t){return t?function(n){return new Promise((function(e,r){t.readFile(n,(function(t,n){t?r(t):e(n)}))}))}:An}function An(){return Mn.apply(this,arguments)}function Mn(){return(Mn=_asyncToGenerator(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:_("No file system access.");case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function En(t){return t?function(){var n=_asyncToGenerator(regeneratorRuntime.mark((function n(e,r){var i,a,u;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=ht({},this.options.http,r),a=r&&r.response,n.next=4,t(e,i);case 4:return u=n.sent,n.abrupt("return",u.ok?it(u[a])?u[a]():u.text():_(u.status+""+u.statusText));case 6:case"end":return n.stop()}}),n,this)})));return function(t,e){return n.apply(this,arguments)}}():Cn}function Cn(){return Dn.apply(this,arguments)}function Dn(){return(Dn=_asyncToGenerator(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:_("No HTTP fetch method available.");case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Fn={boolean:Rt,integer:q,number:q,date:Pt,string:qt,unknown:A},Sn=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return zn(t)&&Number.isInteger(+t)},zn,function(t){return!Number.isNaN(Date.parse(t))}],Tn=["boolean","integer","number","date"];function Bn(t,n){if(!t||!t.length)return"unknown";for(var e,r,i,a=t.length,u=Sn.length,o=Sn.map((function(t,n){return n+1})),s=0,l=0;s9999?"+"+Ln(t,6):Ln(t,4)}(t.getUTCFullYear())+"-"+Ln(t.getUTCMonth()+1,2)+"-"+Ln(t.getUTCDate(),2)+(i?"T"+Ln(n,2)+":"+Ln(e,2)+":"+Ln(r,2)+"."+Ln(i,3)+"Z":r?"T"+Ln(n,2)+":"+Ln(e,2)+":"+Ln(r,2)+"Z":e||n?"T"+Ln(n,2)+":"+Ln(e,2)+"Z":"")}function jn(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],a=t.length,u=0,o=0,s=a<=0,l=!1;function c(){if(s)return Nn;if(l)return l=!1,Rn;var n,r,i=u;if(34===t.charCodeAt(i)){for(;u++=a?s=!0:10===(r=t.charCodeAt(u++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(u)&&++u),t.slice(i+1,n-1).replace(/""/g,'"')}for(;u1)r=Qn(t,n,e);else for(i=0,r=new Array(a=t.arcs.length);i1?(ne[t]=n,this):gt(ne,t)?ne[t]:null}function re(t){var n=ee(t);return n&&n.responseType||"text"}function ie(t){var n={};return function(e){return n[e]||(n[e]=t(e))}}function ae(t,n){return tn?1:t>=n?0:NaN}function ue(t){var n;return 1===t.length&&(n=t,t=function(t,e){return ae(n(t),e)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r>>1;t(n[a],e)<0?r=a+1:i=a}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r>>1;t(n[a],e)>0?i=a:r=a+1}return r}}}var oe=ue(ae),se=oe.right,le=oe.left;function ce(t,n){var e=function(t,n){var e,r=0,i=0,a=0;if(void 0===n){var u,o=_createForOfIteratorHelper(t);try{for(o.s();!(u=o.n()).done;){var s=u.value;null!=s&&(s=+s)>=s&&(a+=(e=s-i)*(s-(i+=e/++r)))}}catch(t){o.e(t)}finally{o.f()}}else{var l,c=-1,f=_createForOfIteratorHelper(t);try{for(f.s();!(l=f.n()).done;){var h=l.value;null!=(h=n(h,++c,t))&&(h=+h)>=h&&(a+=(e=h-i)*(h-(i+=e/++r)))}}catch(t){f.e(t)}finally{f.f()}}if(r>1)return a/(r-1)}(t,n);return e?Math.sqrt(e):e}function fe(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),a=new Array(i);++r0)return[t];if((r=n0)for(t=Math.ceil(t/u),n=Math.floor(n/u),a=new Array(i=Math.ceil(n-t+1));++o=0?(a>=he?10:a>=de?5:a>=pe?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=he?10:a>=de?5:a>=pe?2:1)}function me(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=he?i*=10:a>=de?i*=5:a>=pe&&(i*=2),n=a)&&(e=a)}}catch(t){i.e(t)}finally{i.f()}}else{var u,o=-1,s=_createForOfIteratorHelper(t);try{for(s.s();!(u=s.n()).done;){var l=u.value;null!=(l=n(l,++o,t))&&(e=l)&&(e=l)}}catch(t){s.e(t)}finally{s.f()}}return e}function _e(t,n){var e;if(void 0===n){var r,i=_createForOfIteratorHelper(t);try{for(i.s();!(r=i.n()).done;){var a=r.value;null!=a&&(e>a||void 0===e&&a>=a)&&(e=a)}}catch(t){i.e(t)}finally{i.f()}}else{var u,o=-1,s=_createForOfIteratorHelper(t);try{for(s.s();!(u=s.n()).done;){var l=u.value;null!=(l=n(l,++o,t))&&(e>l||void 0===e&&l>=l)&&(e=l)}}catch(t){s.e(t)}finally{s.f()}}return e}function xe(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function be(t){return null===t?NaN:+t}function we(t,n){var e,r,i,a,u,o,s;return regeneratorRuntime.wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(void 0!==n){l.next=21;break}e=_createForOfIteratorHelper(t),l.prev=2,e.s();case 4:if((r=e.n()).done){l.next=11;break}if(!(null!=(i=r.value)&&(i=+i)>=i)){l.next=9;break}return l.next=9,i;case 9:l.next=4;break;case 11:l.next=16;break;case 13:l.prev=13,l.t0=l.catch(2),e.e(l.t0);case 16:return l.prev=16,e.f(),l.finish(16);case 19:l.next=40;break;case 21:a=-1,u=_createForOfIteratorHelper(t),l.prev=23,u.s();case 25:if((o=u.n()).done){l.next=32;break}if(s=o.value,!(null!=(s=n(s,++a,t))&&(s=+s)>=s)){l.next=30;break}return l.next=30,s;case 30:l.next=25;break;case 32:l.next=37;break;case 34:l.prev=34,l.t1=l.catch(23),u.e(l.t1);case 37:return l.prev=37,u.f(),l.finish(37);case 40:case"end":return l.stop()}}),c,null,[[2,13,16,19],[23,34,37,40]])}function ke(t,n,e){if(r=(t=Float64Array.from(we(t,e))).length){if((n=+n)<=0||r<2)return _e(t);if(n>=1)return ye(t);var r,i=(r-1)*n,a=Math.floor(i),u=ye(function t(n,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.length-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:ae;i>r;){if(i-r>600){var u=i-r+1,o=e-r+1,s=Math.log(u),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(u-l)/u)*(o-u/2<0?-1:1),f=Math.max(r,Math.floor(e-o*l/u+c)),h=Math.min(i,Math.floor(e+(u-o)*l/u+c));t(n,e,f,h,a)}var d=n[e],p=r,v=i;for(xe(n,r,e),a(n[i],d)>0&&xe(n,r,i);p0;)--v}0===a(n[r],d)?xe(n,r,v):xe(n,++v,i),v<=e&&(r=v+1),e<=v&&(i=v-1)}return n}(t,a).subarray(0,a+1));return u+(_e(t.subarray(a+1))-u)*(i-a)}}function Ae(t,n){return ke(t,.5,n)}function Me(t,n){var e=0;if(void 0===n){var r,i=_createForOfIteratorHelper(t);try{for(i.s();!(r=i.n()).done;){var a=r.value;(a=+a)&&(e+=a)}}catch(t){i.e(t)}finally{i.f()}}else{var u,o=-1,s=_createForOfIteratorHelper(t);try{for(s.s();!(u=s.n()).done;){var l=u.value;(l=+n(l,++o,t))&&(e+=l)}}catch(t){s.e(t)}finally{s.f()}}return e}function Ee(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Ce(t){return(t=Ee(Math.abs(t)))?t[1]:NaN}var De,Fe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Se(t){if(!(n=Fe.exec(t)))throw new Error("invalid format: "+t);var n;return new Te({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Te(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Be(t,n){var e=Ee(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Se.prototype=Te.prototype,Te.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Oe={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return Be(100*t,n)},r:Be,s:function(t,n){var e=Ee(t,n);if(!e)return t+"";var r=e[0],i=e[1],a=i-(De=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return a===u?r:a>u?r+new Array(a-u+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Ee(t,Math.max(0,n+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function ze(t){return t}var Re,Ne,Pe,qe,Le=Array.prototype.map,Ue=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function je(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?ze:(n=Le.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,a=[],u=0,o=n[0],s=0;i>0&&o>0&&(s+o+1>r&&(o=Math.max(1,r-s)),a.push(t.substring(i-=o,i+o)),!((s+=o+1)>r));)o=n[u=(u+1)%n.length];return a.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",u=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?ze:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Le.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var n=(t=Se(t)).fill,e=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,v=t.comma,g=t.precision,m=t.trim,y=t.type;"n"===y?(v=!0,y="g"):Oe[y]||(void 0===g&&(g=12),m=!0,y="g"),(d||"0"===n&&"="===e)&&(d=!0,n="0",e="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===h?a:/[%p]/.test(y)?s:"",b=Oe[y],w=/[defgprs%]/.test(y);function k(t){var i,a,s,h=_,k=x;if("c"===y)k=b(t)+k,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),g),m&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),A&&0==+t&&"+"!==f&&(A=!1),h=(A?"("===f?f:l:"-"===f||"("===f?"":f)+h,k=("s"===y?Ue[8+De/3]:"")+k+(A&&"("===f?")":""),w)for(i=-1,a=t.length;++i(s=t.charCodeAt(i))||s>57){k=(46===s?u+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}v&&!d&&(t=r(t,1/0));var M=h.length+t.length+k.length,E=M>1)+h+t+k+E.slice(M);break;default:t=E+h+t+k}return o(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,n){var e=f(((t=Se(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Ce(n)/3))),i=Math.pow(10,-r),a=Ue[8+r/3];return function(t){return e(i*t)+a}}}}function Ie(t){return Math.max(0,-Ce(Math.abs(t)))}function $e(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Ce(n)/3)))-Ce(Math.abs(t)))}function He(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Ce(n)-Ce(t))+1}function We(t){var n=ie(t.format),e=t.formatPrefix;return{format:n,formatPrefix:e,formatFloat:function(t){var e,r,i=Se(t||",");if(null==i.precision){switch(i.precision=12,i.type){case"%":i.precision-=2;break;case"e":i.precision-=1}return e=n(i),r=n(".1f")(1)[1],function(t){var n,i,a=e(t),u=a.indexOf(r);if(u<0)return a;for(i=(n=function(t,n){var e,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>n;)if((e=t.charCodeAt(r))>=48&&e<=57)return r+1}(a,u))u;)if("0"!==a[n]){++n;break}return a.slice(0,n)+i}}return n(i)},formatSpan:function(t,r,i,a){a=Se(null==a?",f":a);var u,o=me(t,r,i),s=Math.max(Math.abs(t),Math.abs(r));if(null==a.precision)switch(a.type){case"s":return isNaN(u=$e(o,s))||(a.precision=u),e(a,s);case"":case"e":case"g":case"p":case"r":isNaN(u=He(o,s))||(a.precision=u-("e"===a.type));break;case"f":case"%":isNaN(u=Ie(o))||(a.precision=u-2*("%"===a.type))}return n(a)}}}function Ye(){return qe=We({format:Ne,formatPrefix:Pe})}function Ge(t){return We(je(t))}function Ve(t){return arguments.length?qe=Ge(t):qe}!function(t){Re=je(t),Ne=Re.format,Pe=Re.formatPrefix}({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),Ye();var Xe="year",Je="quarter",Ze="month",Qe="week",Ke="date",tr="day",nr="hours",er="minutes",rr="seconds",ir=[Xe,Je,Ze,Qe,Ke,tr,"dayofyear",nr,er,rr,"milliseconds"],ar=ir.reduce((function(t,n,e){return t[n]=1+e,t}),{});function ur(t){var n=et(t).slice(),e={};return n.length||_("Missing time unit."),n.forEach((function(t){gt(ar,t)?e[t]=1:_("Invalid time unit: ".concat(t,"."))})),(e[Qe]||e.day?1:0)+(e[Je]||e[Ze]||e[Ke]?1:0)+(e.dayofyear?1:0)>1&&_("Incompatible time units: ".concat(t)),n.sort((function(t,n){return ar[t]-ar[n]})),n}var or=(_defineProperty(n={},Xe,"%Y "),_defineProperty(n,Je,"Q%q "),_defineProperty(n,Ze,"%b "),_defineProperty(n,Ke,"%d "),_defineProperty(n,Qe,"W%U "),_defineProperty(n,tr,"%a "),_defineProperty(n,"dayofyear","%j "),_defineProperty(n,nr,"%H:00"),_defineProperty(n,er,"00:%M"),_defineProperty(n,rr,":%S"),_defineProperty(n,"milliseconds",".%L"),_defineProperty(n,"".concat(Xe,"-").concat(Ze),"%Y-%m "),_defineProperty(n,"".concat(Xe,"-").concat(Ze,"-").concat(Ke),"%Y-%m-%d "),_defineProperty(n,"".concat(nr,"-").concat(er),"%H:%M"),n);function sr(t,n){var e,r,i=ht({},or,n),a=ur(t),u=a.length,o="",s=0;for(s=0;ss;--e)if(null!=i[r=a.slice(s,e).join("-")]){o+=i[r],s=e;break}return o.trim()}var lr=new Date,cr=new Date;function fr(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=function(n){return t(n=new Date(+n)),n},i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n0))return o;do{o.push(u=new Date(+e)),n(e,a),t(e)}while(u=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););}))},e&&(i.count=function(n,r){return lr.setTime(+n),cr.setTime(+r),t(lr),t(cr),Math.floor(e(lr,cr))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var hr=fr((function(){}),(function(t,n){t.setTime(+t+n)}),(function(t,n){return n-t}));hr.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?fr((function(n){n.setTime(Math.floor(n/t)*t)}),(function(n,e){n.setTime(+n+e*t)}),(function(n,e){return(e-n)/t})):hr:null};var dr=fr((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,n){t.setTime(+t+1e3*n)}),(function(t,n){return(n-t)/1e3}),(function(t){return t.getUTCSeconds()})),pr=fr((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,n){t.setTime(+t+6e4*n)}),(function(t,n){return(n-t)/6e4}),(function(t){return t.getMinutes()})),vr=fr((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getHours()})),gr=fr((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}));function mr(t){return fr((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var yr=mr(0),_r=mr(1),xr=(mr(2),mr(3),mr(4)),br=(mr(5),mr(6),fr((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))),wr=fr((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));wr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?fr((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var kr=fr((function(t){t.setUTCSeconds(0,0)}),(function(t,n){t.setTime(+t+6e4*n)}),(function(t,n){return(n-t)/6e4}),(function(t){return t.getUTCMinutes()})),Ar=fr((function(t){t.setUTCMinutes(0,0,0)}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getUTCHours()})),Mr=fr((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/864e5}),(function(t){return t.getUTCDate()-1}));function Er(t){return fr((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/6048e5}))}var Cr=Er(0),Dr=Er(1),Fr=(Er(2),Er(3),Er(4)),Sr=(Er(5),Er(6),fr((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCMonth(t.getUTCMonth()+n)}),(function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))),Tr=fr((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Tr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?fr((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var Br=new Date;function Or(t){return Br.setFullYear(t),Br.setMonth(0),Br.setDate(1),Br.setHours(0,0,0,0),Br}function zr(t){return Nr(new Date(t))}function Rr(t){return Pr(new Date(t))}function Nr(t){return gr.count(Or(t.getFullYear())-1,t)}function Pr(t){return yr.count(Or(t.getFullYear())-1,t)}function qr(t){return Or(t).getDay()}function Lr(t,n,e,r,i,a,u){if(0<=t&&t<100){var o=new Date(-1,n,e,r,i,a,u);return o.setFullYear(t),o}return new Date(t,n,e,r,i,a,u)}function Ur(t){return Ir(new Date(t))}function jr(t){return $r(new Date(t))}function Ir(t){var n=Date.UTC(t.getUTCFullYear(),0,1);return Mr.count(n-1,t)}function $r(t){var n=Date.UTC(t.getUTCFullYear(),0,1);return Cr.count(n-1,t)}function Hr(t){return Br.setTime(Date.UTC(t,0,1)),Br.getUTCDay()}function Wr(t,n,e,r,i,a,u){if(0<=t&&t<100){var o=new Date(Date.UTC(-1,n,e,r,i,a,u));return o.setUTCFullYear(e.y),o}return new Date(Date.UTC(t,n,e,r,i,a,u))}function Yr(t,n,e,r,i){var a=n||1,u=P(t),o=function(t,n,i){return function(t,n,e,r){var i=e<=1?t:r?function(n,i){return r+e*Math.floor((t(n,i)-r)/e)}:function(n,r){return e*Math.floor(t(n,r)/e)};return n?function(t,e){return n(i(t,e),e)}:i}(e[i=i||t],r[i],t===u&&a,n)},s=new Date,l=Lt(t),c=l[Xe]?o(Xe):ct(2012),f=l[Ze]?o(Ze):l[Je]?o(Je):M,h=l[Qe]&&l.day?o(tr,1,Qe+tr):l[Qe]?o(Qe,1):l.day?o(tr,1):l[Ke]?o(Ke,1):l.dayofyear?o("dayofyear",1):E,d=l[nr]?o(nr):M,p=l[er]?o(er):M,v=l[rr]?o(rr):M,g=l.milliseconds?o("milliseconds"):M;return function(t){s.setTime(+t);var n=c(s);return i(n,f(s),h(s,n),d(s),p(s),v(s),g(s))}}function Gr(t,n,e){return n+7*t-(e+6)%7}var Vr=(_defineProperty(e={},Xe,(function(t){return t.getFullYear()})),_defineProperty(e,Je,(function(t){return Math.floor(t.getMonth()/3)})),_defineProperty(e,Ze,(function(t){return t.getMonth()})),_defineProperty(e,Ke,(function(t){return t.getDate()})),_defineProperty(e,nr,(function(t){return t.getHours()})),_defineProperty(e,er,(function(t){return t.getMinutes()})),_defineProperty(e,rr,(function(t){return t.getSeconds()})),_defineProperty(e,"milliseconds",(function(t){return t.getMilliseconds()})),_defineProperty(e,"dayofyear",(function(t){return Nr(t)})),_defineProperty(e,Qe,(function(t){return Pr(t)})),_defineProperty(e,Qe+tr,(function(t,n){return Gr(Pr(t),t.getDay(),qr(n))})),_defineProperty(e,tr,(function(t,n){return Gr(1,t.getDay(),qr(n))})),e),Xr=(_defineProperty(r={},Je,(function(t){return 3*t})),_defineProperty(r,Qe,(function(t,n){return Gr(t,0,qr(n))})),r);function Jr(t,n){return Yr(t,n||1,Vr,Xr,Lr)}var Zr=(_defineProperty(i={},Xe,(function(t){return t.getUTCFullYear()})),_defineProperty(i,Je,(function(t){return Math.floor(t.getUTCMonth()/3)})),_defineProperty(i,Ze,(function(t){return t.getUTCMonth()})),_defineProperty(i,Ke,(function(t){return t.getUTCDate()})),_defineProperty(i,nr,(function(t){return t.getUTCHours()})),_defineProperty(i,er,(function(t){return t.getUTCMinutes()})),_defineProperty(i,rr,(function(t){return t.getUTCSeconds()})),_defineProperty(i,"milliseconds",(function(t){return t.getUTCMilliseconds()})),_defineProperty(i,"dayofyear",(function(t){return Ir(t)})),_defineProperty(i,Qe,(function(t){return $r(t)})),_defineProperty(i,tr,(function(t,n){return Gr(1,t.getUTCDay(),Hr(n))})),_defineProperty(i,Qe+tr,(function(t,n){return Gr($r(t),t.getUTCDay(),Hr(n))})),i),Qr=(_defineProperty(a={},Je,(function(t){return 3*t})),_defineProperty(a,Qe,(function(t,n){return Gr(t,0,Hr(n))})),a);function Kr(t,n){return Yr(t,n||1,Zr,Qr,Wr)}var ti=(_defineProperty(u={},Xe,wr),_defineProperty(u,Je,br.every(3)),_defineProperty(u,Ze,br),_defineProperty(u,Qe,yr),_defineProperty(u,Ke,gr),_defineProperty(u,tr,gr),_defineProperty(u,"dayofyear",gr),_defineProperty(u,nr,vr),_defineProperty(u,er,pr),_defineProperty(u,rr,dr),_defineProperty(u,"milliseconds",hr),u),ni=(_defineProperty(o={},Xe,Tr),_defineProperty(o,Je,Sr.every(3)),_defineProperty(o,Ze,Sr),_defineProperty(o,Qe,Cr),_defineProperty(o,Ke,Mr),_defineProperty(o,tr,Mr),_defineProperty(o,"dayofyear",Mr),_defineProperty(o,nr,Ar),_defineProperty(o,er,kr),_defineProperty(o,rr,dr),_defineProperty(o,"milliseconds",hr),o);function ei(t){return ti[t]}function ri(t){return ni[t]}function ii(t,n,e){return t?t.offset(n,e):void 0}function ai(t,n,e){return ii(ei(t),n,e)}function ui(t,n,e){return ii(ri(t),n,e)}function oi(t,n,e,r){return t?t.range(n,e,r):void 0}function si(t,n,e,r){return oi(ei(t),n,e,r)}function li(t,n,e,r){return oi(ri(t),n,e,r)}var ci=[Xe,Ze,Ke,nr,er,rr,"milliseconds"],fi=ci.slice(0,-1),hi=fi.slice(0,-1),di=hi.slice(0,-1),pi=di.slice(0,-1),vi=[Xe,Ze],gi=[Xe],mi=[[fi,1,1e3],[fi,5,5e3],[fi,15,15e3],[fi,30,3e4],[hi,1,6e4],[hi,5,3e5],[hi,15,9e5],[hi,30,18e5],[di,1,36e5],[di,3,108e5],[di,6,216e5],[di,12,432e5],[pi,1,864e5],[[Xe,Qe],1,6048e5],[vi,1,2592e6],[vi,3,7776e6],[gi,1,31536e6]];function yi(t){var n,e,r=t.extent,i=t.maxbins||40,a=Math.abs(Ot(r))/i,u=ue((function(t){return t[2]})).right(mi,a);return u===mi.length?(n=gi,e=me(r[0]/31536e6,r[1]/31536e6,i)):u?(n=(u=mi[a/mi[u-1][2]=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:qa,s:La,S:fa,u:ha,U:da,V:pa,w:va,W:ga,x:null,X:null,y:ma,Y:ya,Z:_a,"%":Pa},x={a:function(t){return u[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:xa,e:xa,f:Ma,H:ba,I:wa,j:ka,L:Aa,m:Ea,M:Ca,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:qa,s:La,S:Da,u:Fa,U:Sa,V:Ta,w:Ba,W:Oa,x:null,X:null,y:za,Y:Ra,Z:Na,"%":Pa},b={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=p[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=m.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return A(t,n,e,r)},d:Gi,e:Gi,f:Ki,H:Xi,I:Xi,j:Vi,L:Qi,m:Yi,M:Ji,p:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.p=c[r[0].toLowerCase()],e+r[0].length):-1},q:Wi,Q:na,s:ea,S:Zi,u:qi,U:Li,V:Ui,w:Pi,W:ji,x:function(t,n,r){return A(t,e,n,r)},X:function(t,n,e){return A(t,r,n,e)},y:$i,Y:Ii,Z:Hi,"%":ta};function w(t,n){return function(e){var r,i,a,u=[],o=-1,s=0,l=t.length;for(e instanceof Date||(e=new Date(+e));++o53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=xi(bi(a.y,0,1))).getUTCDay(),r=i>4||0===i?Dr.ceil(r):Dr(r),r=Mr.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=_i(bi(a.y,0,1))).getDay(),r=i>4||0===i?_r.ceil(r):_r(r),r=gr.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?xi(bi(a.y,0,1)).getUTCDay():_i(bi(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,xi(a)):_i(a)}}function A(t,n,e,r){for(var i,a,u=0,o=n.length,s=e.length;u=s)return-1;if(37===(i=n.charCodeAt(u++))){if(i=n.charAt(u++),!(a=b[i in Fi?n.charAt(u++):i])||(r=a(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return _.x=w(e,_),_.X=w(r,_),_.c=w(n,_),x.x=w(e,x),x.X=w(r,x),x.c=w(n,x),{format:function(t){var n=w(t+="",_);return n.toString=function(){return t},n},parse:function(t){var n=k(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",x);return n.toString=function(){return t},n},utcParse:function(t){var n=k(t+="",!0);return n.toString=function(){return t},n}}}var ki,Ai,Mi,Ei,Ci,Di,Fi={"-":"",_:" ",0:"0"},Si=/^\s*\d+/,Ti=/^%/,Bi=/[\\^$*+?|[\]().{}]/g;function Oi(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a68?1900:2e3),e+r[0].length):-1}function Hi(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Wi(t,n,e){var r=Si.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function Yi(t,n,e){var r=Si.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function Gi(t,n,e){var r=Si.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Vi(t,n,e){var r=Si.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Xi(t,n,e){var r=Si.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Ji(t,n,e){var r=Si.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Zi(t,n,e){var r=Si.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Qi(t,n,e){var r=Si.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function Ki(t,n,e){var r=Si.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function ta(t,n,e){var r=Ti.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function na(t,n,e){var r=Si.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function ea(t,n,e){var r=Si.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function ra(t,n){return Oi(t.getDate(),n,2)}function ia(t,n){return Oi(t.getHours(),n,2)}function aa(t,n){return Oi(t.getHours()%12||12,n,2)}function ua(t,n){return Oi(1+gr.count(wr(t),t),n,3)}function oa(t,n){return Oi(t.getMilliseconds(),n,3)}function sa(t,n){return oa(t,n)+"000"}function la(t,n){return Oi(t.getMonth()+1,n,2)}function ca(t,n){return Oi(t.getMinutes(),n,2)}function fa(t,n){return Oi(t.getSeconds(),n,2)}function ha(t){var n=t.getDay();return 0===n?7:n}function da(t,n){return Oi(yr.count(wr(t)-1,t),n,2)}function pa(t,n){var e=t.getDay();return t=e>=4||0===e?xr(t):xr.ceil(t),Oi(xr.count(wr(t),t)+(4===wr(t).getDay()),n,2)}function va(t){return t.getDay()}function ga(t,n){return Oi(_r.count(wr(t)-1,t),n,2)}function ma(t,n){return Oi(t.getFullYear()%100,n,2)}function ya(t,n){return Oi(t.getFullYear()%1e4,n,4)}function _a(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Oi(n/60|0,"0",2)+Oi(n%60,"0",2)}function xa(t,n){return Oi(t.getUTCDate(),n,2)}function ba(t,n){return Oi(t.getUTCHours(),n,2)}function wa(t,n){return Oi(t.getUTCHours()%12||12,n,2)}function ka(t,n){return Oi(1+Mr.count(Tr(t),t),n,3)}function Aa(t,n){return Oi(t.getUTCMilliseconds(),n,3)}function Ma(t,n){return Aa(t,n)+"000"}function Ea(t,n){return Oi(t.getUTCMonth()+1,n,2)}function Ca(t,n){return Oi(t.getUTCMinutes(),n,2)}function Da(t,n){return Oi(t.getUTCSeconds(),n,2)}function Fa(t){var n=t.getUTCDay();return 0===n?7:n}function Sa(t,n){return Oi(Cr.count(Tr(t)-1,t),n,2)}function Ta(t,n){var e=t.getUTCDay();return t=e>=4||0===e?Fr(t):Fr.ceil(t),Oi(Fr.count(Tr(t),t)+(4===Tr(t).getUTCDay()),n,2)}function Ba(t){return t.getUTCDay()}function Oa(t,n){return Oi(Dr.count(Tr(t)-1,t),n,2)}function za(t,n){return Oi(t.getUTCFullYear()%100,n,2)}function Ra(t,n){return Oi(t.getUTCFullYear()%1e4,n,4)}function Na(){return"+0000"}function Pa(){return"%"}function qa(t){return+t}function La(t){return Math.floor(+t/1e3)}function Ua(t,n,e){B(e=e||{})||_("Invalid time multi-format specifier: ".concat(e));var r=n(rr),i=n(er),a=n(nr),u=n(Ke),o=n(Qe),s=n(Ze),l=n(Je),c=n(Xe),f=t(e.milliseconds||".%L"),h=t(e[rr]||":%S"),d=t(e[er]||"%I:%M"),p=t(e[nr]||"%I %p"),v=t(e[Ke]||e.day||"%a %d"),g=t(e[Qe]||"%b %d"),m=t(e[Ze]||"%B"),y=t(e[Je]||"%B"),x=t(e[Xe]||"%Y");return function(t){return(r(t)0)){t.next=35;break}if((s=i._heap.pop()).rank===s.qrank){t.next=23;break}return i._enqueue(s,!0),t.abrupt("continue",18);case 23:if(!(l=s.run(i._getPulse(s,n))).then){t.next=30;break}return t.next=27,l;case 27:l=t.sent,t.next=31;break;case 30:l.async&&(a.push(l.async),l=eu);case 31:l!==eu&&s._targets&&s._targets.forEach((function(t){return i._enqueue(t)})),++o,t.next=18;break;case 35:t.next=41;break;case 37:t.prev=37,t.t0=t.catch(17),i._heap.clear(),c=t.t0;case 41:if(i._input={},i._pulse=null,i.debug("Pulse ".concat(u,": ").concat(o," operators")),c&&(i._postrun=[],i.error(c)),!i._postrun.length){t.next=55;break}f=i._postrun.sort((function(t,n){return n.priority-t.priority})),i._postrun=[],h=0;case 49:if(!(h=0&&(o=r),t[n]=t[o],o=1+((n=o)<<1);t[n]=u,vu(t,i,n,e)}(n,0,t)):e=r,e}}}function vu(t,n,e,r){var i,a,u;for(i=t[e];e>n&&r(i,a=t[u=e-1>>1])<0;)t[e]=a,e=u;return t[e]=i}function gu(){this.logger(S()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Ga();try{this._loader=Xa()}catch(t){}this._touched=It(k),this._input={},this._pulse=null,this._heap=pu((function(t,n){return t.qrank-n.qrank})),this._postrun=[]}var mu=gu.prototype;function yu(t){return function(){return this._log[t].apply(this,arguments)}}function _u(t,n){ln.call(this,t,null,n)}mu.stamp=function(){return this._clock},mu.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},mu.locale=function(t){return arguments.length?(this._locale=t,this):this._locale},mu.cleanThreshold=1e4,mu.add=function(t,n,e,r){var i,a=1;return t instanceof ln?i=t:t&&t.prototype instanceof ln?i=new t:it(t)?i=new ln(null,t):(a=0,i=new ln(t,n)),this.rank(i),a&&(r=e,e=n),e&&this.connect(i,i.parameters(e,r)),this.touch(i),i},mu.connect=function(t,n){var e,r,i=t.rank;for(e=0,r=n.length;e=0;)i.push(n=e[r]),n===t&&_("Cycle detected in dataflow graph.")},mu.pulse=function(t,n,e){this.touch(t,e||du);var r=new ru(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=n.pulse(r,i),this},mu.touch=function(t,n){var e=n||du;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},mu.update=function(t,n,e){var r=e||du;return(t.set(n)||r.force)&&this.touch(t,r),this},mu.changeset=en,mu.ingest=function(t,n,e){return n=this.parse(n,e),this.pulse(t,this.changeset().insert(n))},mu.parse=function(t,n){var e=this.locale();return Va(t,n,e.timeParse,e.utcParse)},mu.preload=function(t,n,e){return Za.apply(this,arguments)},mu.request=function(t,n){return Ja.apply(this,arguments)},mu.events=function(t,n,e,r){for(var i,a=this,u=pn(e,r),o=function(t){t.dataflow=a;try{u.receive(t)}catch(t){a.error(t)}finally{a.run()}},s=0,l=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):et(t)).length;s1?t.dev/(t.valid-1):void 0},add:function(t,n){return t.dev+=t.mean_d*(n-t.mean)},rem:function(t,n){return t.dev-=t.mean_d*(n-t.mean)},req:["mean"],idx:1},variancep:{value:function(t){return t.valid>1?t.dev/t.valid:void 0},req:["variance"],idx:2},stdev:{value:function(t){return t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0},req:["variance"],idx:2},stdevp:{value:function(t){return t.valid>1?Math.sqrt(t.dev/t.valid):void 0},req:["variance"],idx:2},stderr:{value:function(t){return t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0},req:["variance"],idx:2},distinct:{value:function(t){return t.cell.data.distinct(t.get)},req:["values"],idx:3},ci0:{value:function(t){return t.cell.data.ci0(t.get)},req:["values"],idx:3},ci1:{value:function(t){return t.cell.data.ci1(t.get)},req:["values"],idx:3},median:{value:function(t){return t.cell.data.q2(t.get)},req:["values"],idx:3},q1:{value:function(t){return t.cell.data.q1(t.get)},req:["values"],idx:3},q3:{value:function(t){return t.cell.data.q3(t.get)},req:["values"],idx:3},min:{init:function(t){return t.min=void 0},value:function(t){return t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min},add:function(t,n){(nt.max||void 0===t.max)&&(t.max=n)},rem:function(t,n){n>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:function(t){return t.argmin=void 0},value:function(t){return t.argmin||t.cell.data.argmin(t.get)},add:function(t,n,e){nt.max&&(t.argmax=e)},rem:function(t,n){n>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3}},Fu=Object.keys(Du);function Su(t,n){return Du[t](n)}function Tu(t,n){return t.idx-n.idx}function Bu(){var t=this;this.valid=0,this.missing=0,this._ops.forEach((function(n){return n.init(t)}))}function Ou(t,n){var e=this;null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((function(r){return r.add(e,t,n)}))):++this.missing}function zu(t,n){var e=this;null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((function(r){return r.rem(e,t,n)}))):--this.missing}function Ru(t){var n=this;return this._out.forEach((function(e){return t[e.out]=e.value(n)})),t}function Nu(t,n){var e=n||A,r=function(t){var n={};return t.forEach((function(t){return n[t.name]=t})),t.forEach((function t(e){e.req&&e.req.forEach((function(e){n[e]||t(n[e]=Du[e]())}))})),Object.values(n).sort(Tu)}(t),i=t.slice().sort(Tu);function a(t){this._ops=r,this._out=i,this.cell=t,this.init()}return a.prototype.init=Bu,a.prototype.add=Ou,a.prototype.rem=zu,a.prototype.set=Ru,a.prototype.get=e,a.fields=t.map((function(t){return t.out})),a}function Pu(t,n){var e,r,i,a,u,o,s;return regeneratorRuntime.wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(null!=n){l.next=21;break}e=_createForOfIteratorHelper(t),l.prev=2,e.s();case 4:if((r=e.n()).done){l.next=11;break}if(!(null!=(i=r.value)&&""!==i&&(i=+i)>=i)){l.next=9;break}return l.next=9,i;case 9:l.next=4;break;case 11:l.next=16;break;case 13:l.prev=13,l.t0=l.catch(2),e.e(l.t0);case 16:return l.prev=16,e.f(),l.finish(16);case 19:l.next=41;break;case 21:a=-1,u=_createForOfIteratorHelper(t),l.prev=23,u.s();case 25:if((o=u.n()).done){l.next=33;break}if(s=o.value,!(null!=(s=n(s,++a,t))&&""!==s&&(s=+s)>=s)){l.next=31;break}return l.next=31,s;case 31:l.next=25;break;case 33:l.next=38;break;case 35:l.prev=35,l.t1=l.catch(23),u.e(l.t1);case 38:return l.prev=38,u.f(),l.finish(38);case 41:case"end":return l.stop()}}),f,null,[[2,13,16,19],[23,35,38,41]])}function qu(t,n,e){var r=Float64Array.from(Pu(t,e));return r.sort(ae),n.map((function(t){return function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:be;if(r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),u=+e(t[a],a,t),o=+e(t[a+1],a+1,t);return u+(o-u)*(i-a)}}(r,t)}))}function Lu(t,n){return qu(t,[.25,.5,.75],n)}function Uu(t,n){var e=t.length,r=ce(t,n),i=Lu(t,n),a=(i[2]-i[0])/1.34;return 1.06*(r=Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(e,-.2)}function ju(t){var n,e,r,i,a,u,o,s,l=t.maxbins||20,c=t.base||10,f=Math.log(c),h=t.divide||[5,2],d=t.extent[0],p=t.extent[1],v=t.span||p-d||Math.abs(d)||1;if(t.step)n=t.step;else if(t.steps){for(a=v/l,u=0,o=t.steps.length;ul;)n*=c;for(u=0,o=h.length;u=r&&v/a<=l&&(n=a)}return i=(a=Math.log(n))>=0?0:1+~~(-a/f),s=Math.pow(c,-i-1),(t.nice||void 0===t.nice)&&(d=d<(a=Math.floor(d/n+s)*n)?a-n:a,p=Math.ceil(p/n)*n),{start:d,stop:p===d?d+n:p,step:n}}function Iu(n,e,r,i){if(!n.length)return[void 0,void 0];var a,u,o,s,l=Float64Array.from(Pu(n,i)),c=l.length,f=e;for(o=0,s=Array(f);o=f){for(c=(l+c)/2;a>1);ru;)t[r--]=t[a]}a=u,u=e}return t}(s,n+n/4):s}Fu.forEach((function(t){Du[t]=function(t,n){return function(e){return ht({name:t,out:e||t},Cu,n)}}(t,Du[t])})),t.random=Math.random;var Hu=Math.sqrt(2*Math.PI),Wu=Math.SQRT2,Yu=NaN;function Gu(n,e){n=n||0,e=null==e?1:e;var r,i,a=0,u=0;if(Yu==Yu)a=Yu,Yu=NaN;else{do{r=(a=2*t.random()-1)*a+(u=2*t.random()-1)*u}while(0===r||r>1);a*=i=Math.sqrt(-2*Math.log(r)/r),Yu=u*i}return n+a*e}function Vu(t,n,e){var r=(t-(n||0))/(e=null==e?1:e);return Math.exp(-.5*r*r)/(e*Hu)}function Xu(t,n,e){var r,i=(t-(n=n||0))/(e=null==e?1:e),a=Math.abs(i);if(a>37)r=0;else{var u=Math.exp(-a*a/2);a<7.07106781186547?(r=u*((((((.0352624965998911*a+.700383064443688)*a+6.37396220353165)*a+33.912866078383)*a+112.079291497871)*a+221.213596169931)*a+220.206867912376),r/=((((((.0883883476483184*a+1.75566716318264)*a+16.064177579207)*a+86.7807322029461)*a+296.564248779674)*a+637.333633378831)*a+793.826512519948)*a+440.413735824752):r=u/(a+1/(a+2/(a+3/(a+4/(a+.65)))))/2.506628274631}return i>0?1-r:r}function Ju(t,n,e){return t<0||t>1?NaN:(n||0)+(null==e?1:e)*Wu*function(t){var n,e=-Math.log((1-t)*(1+t));e<6.25?n=1.6536545626831027+(n=.24015818242558962+(n=(n=(n=.00018673420803405714+(n=(n=(n=4.2347877827932404e-7+(n=(n=(n=1.0512122733215323e-9+(n=(n=(n=26335093153082323e-28+(n=(n=(n=6637638134358324e-30+(n=20972767875968562e-33+(n=(n=11157877678025181e-33+(n=128584807152564e-32+(n=(n=-364441206401782e-35)*(e-=3.125)-16850591381820166e-35)*e)*e)*e-1333171662854621e-31)*e)*e)*e-4054566272975207e-29)*e-8151934197605472e-29)*e)*e-12975133253453532e-27)*e-5415412054294628e-26)*e)*e-4.112633980346984e-9)*e-2.9070369957882005e-8)*e)*e-13654692000834679e-22)*e-13882523362786469e-21)*e)*e-.000740702534166267)*e-.006033670871430149)*e)*e:e<16?(e=Math.sqrt(e)-3.25,n=3.0838856104922208+(n=1.0052589676941592+(n=.005370914553590064+(n=(n=.002491442096107851+(n=(n=.0009532893797373805+(n=(n=24031110387097894e-21+(n=6828485145957318e-20+(n=(n=12475304481671779e-21+(n=29234449089955446e-22+(n=(n=15027403968909828e-22+(n=1.8239629214389228e-8+(n=(n=9.075656193888539e-8+(n=2.2137376921775787e-9)*e)*e-2.7517406297064545e-7)*e)*e)*e-4013867526981546e-21)*e)*e)*e-47318229009055734e-21)*e)*e)*e-.0003550375203628475)*e)*e-.0016882755560235047)*e)*e-.003751208507569241)*e)*e)*e):Number.isFinite(e)?(e=Math.sqrt(e)-5,n=4.849906401408584+(n=1.0103004648645344+(n=(n=(n=7599527703001776e-20+(n=(n=4526062597223154e-21+(n=(n=2.2900482228026655e-7+(n=(n=2.914795345090108e-8+(n=(n=7.61570120807834e-9+(n=(n=1.5076572693500548e-9+(n=(n=-27109920616438573e-27)*e-2.555641816996525e-10)*e)*e-3.789465440126737e-9)*e)*e-1.496002662714924e-8)*e)*e-6.771199775845234e-8)*e)*e-9.9298272942317e-7)*e)*e-1968177810553167e-20)*e)*e-.00021503011930044477)*e-.00013871931833623122)*e)*e):n=1/0;return n*t}(2*t-1)}function Zu(t,n){var e,r,i={mean:function(t){return arguments.length?(e=t||0,i):e},stdev:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:function(){return Gu(e,r)},pdf:function(t){return Vu(t,e,r)},cdf:function(t){return Xu(t,e,r)},icdf:function(t){return Ju(t,e,r)}};return i.mean(t).stdev(n)}function Qu(n,e){var r=Zu(),i={},a=0;return i.data=function(t){return arguments.length?(n=t,a=t?t.length:0,i.bandwidth(e)):n},i.bandwidth=function(t){return arguments.length?(!(e=t)&&n&&(e=Uu(n)),i):e},i.sample=function(){return n[~~(t.random()*a)]+e*r.sample()},i.pdf=function(t){for(var i=0,u=0;u=n&&t<=e?1/(e-n):0}function oo(t,n,e){return null==e&&(e=null==n?1:n,n=0),te?1:(t-n)/(e-n)}function so(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=0&&t<=1?n+t*(e-n):NaN}function lo(t,n){var e,r,i={min:function(t){return arguments.length?(e=t||0,i):e},max:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:function(){return ao(e,r)},pdf:function(t){return uo(t,e,r)},cdf:function(t){return oo(t,e,r)},icdf:function(t){return so(t,e,r)}};return null==n&&(n=null==t?1:t,t=0),i.min(t).max(n)}function co(t,n,e,r){var i=r-t*t,a=Math.abs(i)<1e-24?0:(e-t*n)/i;return[n-a*t,a]}function fo(t,n,e,r){t=t.filter((function(t){var r=n(t),i=e(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&t.sort((function(t,e){return n(t)-n(e)}));var i,a,u,o,s=t.length,l=new Float64Array(s),c=new Float64Array(s),f=0,h=0,d=0,p=_createForOfIteratorHelper(t);try{for(p.s();!(o=p.n()).done;)u=o.value,l[f]=i=+n(u),c[f]=a=+e(u),h+=(i-h)/++f,d+=(a-d)/f}catch(t){p.e(t)}finally{p.f()}for(f=0;f=i&&null!=a&&(a=+a)>=a&&r(i,a,++o)}}catch(t){s.e(t)}finally{s.f()}}function po(t,n,e,r,i){var a=0,u=0;return ho(t,n,e,(function(t,n){var e=n-i(t),o=n-r;a+=e*e,u+=o*o})),1-a/u}function vo(t,n,e){var r=0,i=0,a=0,u=0,o=0;ho(t,n,e,(function(t,n){++o,r+=(t-r)/o,i+=(n-i)/o,a+=(t*n-a)/o,u+=(t*t-u)/o}));var s=co(r,i,a,u),l=function(t){return s[0]+s[1]*t};return{coef:s,predict:l,rSquared:po(t,n,e,i,l)}}function go(t,n,e){var r=0,i=0,a=0,u=0,o=0;ho(t,n,e,(function(t,n){++o,t=Math.log(t),r+=(t-r)/o,i+=(n-i)/o,a+=(t*n-a)/o,u+=(t*t-u)/o}));var s=co(r,i,a,u),l=function(t){return s[0]+s[1]*Math.log(t)};return{coef:s,predict:l,rSquared:po(t,n,e,i,l)}}function mo(t,n,e){var r,i,a,u=_slicedToArray(fo(t,n,e),4),o=u[0],s=(u[1],u[2]),l=u[3],c=0,f=0,h=0,d=0,p=0;ho(t,n,e,(function(t,n){r=o[p++],i=Math.log(n),c+=(n*i-c)/p,f+=((a=r*n)-f)/p,h+=(a*i-h)/p,d+=(r*a-d)/p}));var v=_slicedToArray(co(f/l,c/l,h/l,d/l),2),g=v[0],m=v[1],y=function(t){return Math.exp(g+m*(t-s))};return{coef:[Math.exp(g-m*s),m],predict:y,rSquared:po(t,n,e,l,y)}}function yo(t,n,e){var r=0,i=0,a=0,u=0,o=0,s=0;ho(t,n,e,(function(t,n){var e=Math.log(t),l=Math.log(n);++s,r+=(e-r)/s,i+=(l-i)/s,a+=(e*l-a)/s,u+=(e*e-u)/s,o+=(n-o)/s}));var l=co(r,i,a,u),c=function(t){return l[0]*Math.pow(t,l[1])};return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:po(t,n,e,o,c)}}function _o(t,n,e){var r,i,a,u,o=_slicedToArray(fo(t,n,e),4),s=o[0],l=o[1],c=o[2],f=o[3],h=s.length,d=0,p=0,v=0,g=0,m=0;for(r=0;rMath.abs(t[n][i])&&(i=e);for(r=n;r=n;r--)t[r][e]-=t[r][n]*t[n][e]/t[n][n]}for(e=u-1;e>=0;--e){for(a=0,r=e+1;r=0;--i)for(u=n[i],o=1,s[i]+=u,a=1;a<=i;++a)o*=(i+1-a)/a,s[i-a]+=u*Math.pow(e,a)*o;return s[0]+=r,s}function wo(t,n,e,r){for(var i=_slicedToArray(fo(t,n,e,!0),4),a=i[0],u=i[1],o=i[2],s=i[3],l=a.length,c=Math.max(2,~~(r*l)),f=new Float64Array(l),h=new Float64Array(l),d=new Float64Array(l).fill(1),p=-1;++p<=2;){for(var v=[0,c-1],g=0;ga[_]-m?y:_,b=0,w=0,k=0,A=0,M=0,E=1/Math.abs(a[x]-m||1),C=y;C<=_;++C){var D=a[C],F=u[C],S=ko(Math.abs(m-D)*E)*d[C],T=D*S;b+=S,w+=T,k+=F*S,A+=F*T,M+=D*T}var B=_slicedToArray(co(w/b,k/b,A/b,M/b),2),O=B[0],z=B[1];f[g]=O+z*m,h[g]=Math.abs(u[g]-f[g]),Ao(a,g+1,v)}if(2===p)break;var R=Ae(h);if(Math.abs(R)<1e-12)break;for(var N,P,q=0;q=1?1e-12:(P=1-N*N)*P}return function(t,n,e,r){for(var i,a=t.length,u=[],o=0,s=0,l=[];o=t.length))for(;n>i&&t[a]-r<=r-t[i];)e[0]=++i,e[1]=a,++a}var Mo=.1*Math.PI/180;function Eo(t,n,e,r){e=e||25,r=Math.max(e,r||200);var i=function(n){return[n,t(n)]},a=n[0],u=n[1],o=u-a,s=o/r,l=[i(a)],c=[];if(e===r){for(var f=1;f0;)c.push(i(a+h/e*o));for(var d,p,v,g,m,y=l[0],_=c[c.length-1];_;){var x=i((y[0]+_[0])/2);x[0]-y[0]>=s&&(d=y,p=x,v=_,g=void 0,m=void 0,g=Math.atan2(v[1]-d[1],v[0]-d[0]),m=Math.atan2(p[1]-d[1],p[0]-d[0]),Math.abs(g-m)>Mo)?c.push(x):(y=_,l.push(_),c.pop()),_=c[c.length-1]}return l}function Co(t){this._key=t?b(t):Vt,this.reset()}var Do=Co.prototype;function Fo(t){_u.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}Do.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Do.add=function(t){this._add.push(t)},Do.rem=function(t){this._rem.push(t)},Do.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,n,e,r=this._add,i=this._rem,a=this._key,u=r.length,o=i.length,s=Array(u-o),l={};for(t=0;t=0;)gt(i,n=t(e[r])+"")||(i[n]=1,++a);return a},Do.extent=function(t){if(this._get!==t||!this._ext){var n=this.values(),e=pt(n,t);this._ext=[n[e[0]],n[e[1]]],this._get=t}return this._ext},Do.argmin=function(t){return this.extent(t)[0]||{}},Do.argmax=function(t){return this.extent(t)[1]||{}},Do.min=function(t){var n=this.extent(t)[0];return null!=n?t(n):void 0},Do.max=function(t){var n=this.extent(t)[1];return null!=n?t(n):void 0},Do.quartile=function(t){return this._get===t&&this._q||(this._q=Lu(this.values(),t),this._get=t),this._q},Do.q1=function(t){return this.quartile(t)[0]},Do.q2=function(t){return this.quartile(t)[1]},Do.q3=function(t){return this.quartile(t)[2]},Do.ci=function(t){return this._get===t&&this._ci||(this._ci=Iu(this.values(),1e3,.05,t),this._get=t),this._ci},Do.ci0=function(t){return this.ci(t)[0]},Do.ci1=function(t){return this.ci(t)[1]},Fo.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Fu},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};var So=xt(Fo,_u);So.transform=function(t,n){var e=this,r=this,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),a=t.modified();return r.stamp=i.stamp,r.value&&(a||n.modified(r._inputs,!0))?(r._prev=r.value,r.value=a?r.init(t):{},n.visit(n.SOURCE,(function(t){return r.add(t)}))):(r.value=r.value||r.init(t),n.visit(n.REM,(function(t){return r.rem(t)})),n.visit(n.ADD,(function(t){return r.add(t)}))),i.modifies(r._outputs),r._drop=!1!==t.drop,t.cross&&r._dims.length>1&&(r._drop=!1,r.cross()),n.clean()&&r._drop&&i.clean(!0).runAfter((function(){return e.clean()})),r.changes(i)},So.cross=function(){var t=this,n=t.value,e=t._dnames,r=e.map((function(){return{}})),i=e.length;function a(t){var n,a,u,o;for(n in t)for(u=t[n].tuple,a=0;ao?1/0:(n=Math.max(u,Math.min(n,o-a)),u+a*Math.floor(1e-14+(n-u)/a))};return s.start=u,s.stop=i.stop,s.step=a,this.value=d(s,v(r),t.name||"bin_"+p(r))},zo.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},xt(zo,_u).transform=function(t,n){var e=n.fork(n.ALL),r=Oo(Vt,this.value,e.materialize(e.ADD).add),i=t.sort,a=n.changed()||i&&(t.modified("sort")||n.modified(i.fields));return e.visit(e.REM,r.remove),this.modified(a),this.value=e.source=r.data(tn(i),a),n.source&&n.source.root&&(this.value.root=n.source.root),e},xt(Ro,ln),Po.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};var qo=xt(Po,_u);function Lo(t){_u.call(this,null,t)}qo.transform=function(t,n){function e(n){return function(e){for(var r,i=function(t,n,e){switch(n){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(e)}(o(e),t.case,a)||[],s=0,l=i.length;sh&&(h=m),p[++e][l]=m}}catch(t){g.e(t)}finally{g.f()}}return this.value={start:f,stop:h,step:o},n.reflow(!0).modifies(l)},xt(Go,ln),Xo.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},xt(Xo,_u).transform=function(t,n){var e,r=this.value,i=t.field,a=r[0],u=r[1];if(((e=n.changed()||n.modified(i.fields)||t.modified("field"))||null==a)&&(a=1/0,u=-1/0),n.visit(e?n.SOURCE:n.ADD,(function(t){var n=q(i(t));null!=n&&(nu&&(u=n))})),!Number.isFinite(a)||!Number.isFinite(u)){var o=p(i);o&&(o=' for field "'.concat(o,'"')),n.dataflow.warn("Infinite extent".concat(o,": [").concat(a,", ").concat(u,"]")),a=u=void 0}this.value=[a,u]};var Zo=xt(Jo,ln);function Qo(t){_u.call(this,{},t),this._keys=yt();var n=this._targets=[];n.active=0,n.forEach=function(t){for(var e=0,r=n.active;er.cleanThreshold&&r.runAfter(u.clean),n},xt(ts,ln),es.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},xt(es,_u).transform=function(t,n){var e=n.dataflow,r=this.value,i=n.fork(),a=i.add,u=i.rem,o=i.mod,s=t.expr,l=!0;function c(n){var e=Vt(n),i=s(n,t),c=r.get(e);i&&c?(r.delete(e),a.push(n)):i||c?l&&i&&!c&&o.push(n):(r.set(e,1),u.push(n))}return n.visit(n.REM,(function(t){var n=Vt(t);r.has(n)?r.delete(n):u.push(t)})),n.visit(n.ADD,(function(n){s(n,t)?a.push(n):r.set(Vt(n),1)})),n.visit(n.MOD,c),t.modified()&&(l=!1,n.visit(n.REFLOW,c)),r.empty>e.cleanThreshold&&e.runAfter(r.clean),i},rs.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},xt(rs,_u).transform=function(t,n){var e=n.fork(n.NO_SOURCE),r=t.fields,i=Ho(r,t.as||[]),a=t.index||null,u=i.length;return e.rem=this.value,n.visit(n.SOURCE,(function(t){for(var n,o,s,l=r.map((function(n){return n(t)})),c=l.reduce((function(t,n){return Math.max(t,n.length)}),0),f=0;f0){for(e=[];--o>=0;)e.push(i=Jt(s(t))),a.push(i);u.add=u.add.length?u.materialize(u.ADD).add.concat(e):e}else r=a.slice(0,-o),u.rem=u.rem.length?u.materialize(u.REM).rem.concat(r):r,a=a.slice(-o);return u.source=this.value=a,u};var os={value:"value",median:Ae,mean:function(t,n){var e=0,r=0;if(void 0===n){var i,a=_createForOfIteratorHelper(t);try{for(a.s();!(i=a.n()).done;){var u=i.value;null!=u&&(u=+u)>=u&&(++e,r+=u)}}catch(t){a.e(t)}finally{a.f()}}else{var o,s=-1,l=_createForOfIteratorHelper(t);try{for(l.s();!(o=l.n()).done;){var c=o.value;null!=(c=n(c,++s,t))&&(c=+c)>=c&&(++e,r+=c)}}catch(t){l.e(t)}finally{l.f()}}if(e)return r/e},min:_e,max:ye},ss=[];function ls(t){_u.call(this,[],t)}function cs(t){Fo.call(this,t)}ls.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},xt(ls,_u).transform=function(t,n){var e,r,i,a,u,o,s,l,c,f,h=n.fork(n.ALL),d=function(t){var n,e=t.method||os.value;if(null!=os[e])return e===os.value?(n=void 0!==t.value?t.value:0,function(){return n}):os[e];_("Unrecognized imputation method: "+e)}(t),v=function(t){var n=t.field;return function(t){return t?n(t):NaN}}(t),g=p(t.field),m=p(t.key),y=(t.groupby||[]).map(p),x=function(t,n,e,r){var i,a,u,o,s,l,c,f,h=function(t){return t(f)},d=[],p=r?r.slice():[],v={},g={};for(p.forEach((function(t,n){v[t]=n+1})),o=0,c=t.length;oa&&(a=r[1]);return[i,a]}function xs(t){ln.call(this,null,bs,t)}function bs(t){return this.value&&!t.modified()?this.value:t.values.reduce((function(t,n){return t.concat(n)}),[])}function ws(t){_u.call(this,null,t)}function ks(t){Fo.call(this,t)}fs.transform=function(t,n){var e,r=this,i=t.modified();return r.value&&(i||n.modified(r._inputs,!0))?(e=r.value=i?r.init(t):{},n.visit(n.SOURCE,(function(t){r.add(t)}))):(e=r.value=r.value||this.init(t),n.visit(n.REM,(function(t){r.rem(t)})),n.visit(n.ADD,(function(t){r.add(t)}))),r.changes(),n.visit(n.SOURCE,(function(t){ht(t,e[r.cellkey(t)].tuple)})),n.reflow(i).modifies(this._outputs)},fs.changes=function(){var t,n,e=this._adds,r=this._mods;for(t=0,n=this._alen;t1&&!a&&_('Multi-field lookup requires explicit "as" parameter.'),a&&a.length!==h*r&&_('The "as" parameter has too few output field names.'),a=a||s.map(p),e=function(t){for(var n,e,i=0,c=0;in||null==n)&&null!=t?1:(n=n instanceof Date?+n:n,(t=t instanceof Date?+t:t)!==t&&n==n?-1:n!=n&&t==t?1:0)})),n?i.slice(0,n):i}(e,t.limit||0,n);n.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:u.map((function(){return i})),fields:u.map((function(t){return function(t,n,e,r){return d((function(r){return n(r)===t?e(r):NaN}),r,t+"")}(t,e,r,a)})),as:u.map((function(t){return t+""})),modified:t.modified.bind(t)}}(t,n),n)},xt(Ms,Qo).transform=function(t,n){var e=this,r=t.subflow,i=t.field,a=function(t){return e.subflow(Vt(t),r,n,t)};return(t.modified("field")||i&&n.modified(v(i)))&&_("PreFacet does not support field modification."),this.initTargets(),i?(n.visit(n.MOD,(function(t){var n=a(t);i(t).forEach((function(t){return n.mod(t)}))})),n.visit(n.ADD,(function(t){var n=a(t);i(t).forEach((function(t){return n.add(Jt(t))}))})),n.visit(n.REM,(function(t){var n=a(t);i(t).forEach((function(t){return n.rem(t)}))}))):(n.visit(n.MOD,(function(t){return a(t).mod(t)})),n.visit(n.ADD,(function(t){return a(t).add(t)})),n.visit(n.REM,(function(t){return a(t).rem(t)}))),n.clean()&&n.runAfter((function(){return e.clean()})),n},Es.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},xt(Es,_u).transform=function(t,n){var e,r,i=t.fields,a=Ho(t.fields,t.as||[]),u=i?function(t,n){return function(t,n,e,r){for(var i=0,a=e.length;i=s&&(e=u[i],l[Vt(e)]&&r.rem.push(e),u[i]=n),++o}if(e.rem.length&&(e.visit(e.REM,(function(t){var n=Vt(t);l[n]&&(l[n]=-1,r.rem.push(t)),--o})),u=u.filter((function(t){return-1!==l[Vt(t)]}))),(e.rem.length||i)&&u.lengtha){for(var f=0,h=u.length-a;ff&&(f=i))})),a.start=c,a.stop=f,n.modifies(r?o:s)},Ns._floor=function(t,n){var e="utc"===t.timezone,r=t.units?{units:t.units,step:t.step||1}:yi({extent:t.extent||dt(n.materialize(n.SOURCE).source,t.field),maxbins:t.maxbins}),i=r.units,a=r.step;i=ur(i);var u=this.value||{},o=(e?Kr:Jr)(i,a);return o.unit=P(i),o.units=i,o.step=a,o.start=u.start,o.stop=u.stop,this.value=o},xt(Ps,_u).transform=function(t,n){var e=n.dataflow,r=t.field,i=this.value,a=!0;function u(t){i.set(r(t),t)}return t.modified("field")||n.modified(r.fields)?(i.clear(),n.visit(n.SOURCE,u)):n.changed()?(n.visit(n.REM,(function(t){i.delete(r(t))})),n.visit(n.ADD,u)):a=!1,this.modified(a),i.empty>e.cleanThreshold&&e.runAfter(i.clean),n.fork()},xt(qs,_u).transform=function(t,n){(!this.value||t.modified("field")||t.modified("sort")||n.changed()||t.sort&&n.modified(t.sort.fields))&&(this.value=(t.sort?n.source.slice().sort(tn(t.sort)):n.source).map(t.field))};var Ls={row_number:function(){return{next:function(t){return t.index+1}}},rank:function(){var t;return{init:function(){return t=1},next:function(n){var e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?t=e+1:t}}},dense_rank:function(){var t;return{init:function(){return t=1},next:function(n){var e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?++t:t}}},percent_rank:function(){var t=Ls.rank(),n=t.next;return{init:t.init,next:function(t){return(n(t)-1)/(t.data.length-1)}}},cume_dist:function(){var t;return{init:function(){return t=0},next:function(n){var e=n.index,r=n.data,i=n.compare;if(t0||_("ntile num must be greater than zero.");var e=Ls.cume_dist(),r=e.next;return{init:e.init,next:function(t){return Math.ceil(n*r(t))}}},lag:function(t,n){return n=+n||1,{next:function(e){var r=e.index-n;return r>=0?t(e.data[r]):null}}},lead:function(t,n){return n=+n||1,{next:function(e){var r=e.index+n,i=e.data;return r0||_("nth_value nth must be greater than zero."),{next:function(e){var r=e.i0+(n-1);return r0&&!i(a[e],a[e-1])&&(t.i0=n.left(a,a[e])),r1e-6)if(Math.abs(c*o-s*l)>1e-6&&i){var h=e-a,d=r-u,p=o*o+s*s,v=h*h+d*d,g=Math.sqrt(p),m=Math.sqrt(f),y=i*Math.tan((al-Math.acos((p+f-v)/(2*g*m)))/2),_=y/m,x=y/g;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*l)+","+(n+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*h>l*d)+","+(this._x1=t+x*o)+","+(this._y1=n+x*s)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,a){t=+t,n=+n,a=!!a;var u=(e=+e)*Math.cos(r),o=e*Math.sin(r),s=t+u,l=n+o,c=1^a,f=a?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+s+","+l),e&&(f<0&&(f=f%ul+ul),f>ol?this._+="A"+e+","+e+",0,1,"+c+","+(t-u)+","+(n-o)+"A"+e+","+e+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>1e-6&&(this._+="A"+e+","+e+",0,"+ +(f>=al)+","+c+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var fl=Math.abs,hl=Math.atan2,dl=Math.cos,pl=Math.max,vl=Math.min,gl=Math.sin,ml=Math.sqrt,yl=Math.PI,_l=yl/2,xl=2*yl;function bl(t){return t>1?0:t<-1?yl:Math.acos(t)}function wl(t){return t>=1?_l:t<=-1?-_l:Math.asin(t)}function kl(t){return t.innerRadius}function Al(t){return t.outerRadius}function Ml(t){return t.startAngle}function El(t){return t.endAngle}function Cl(t){return t&&t.padAngle}function Dl(t,n,e,r,i,a,u,o){var s=e-t,l=r-n,c=u-i,f=o-a,h=f*s-c*l;if(!(h*h<1e-12))return[t+(h=(c*(n-a)-f*(t-i))/h)*s,n+h*l]}function Fl(t,n,e,r,i,a,u){var o=t-e,s=n-r,l=(u?a:-a)/ml(o*o+s*s),c=l*s,f=-l*o,h=t+c,d=n+f,p=e+c,v=r+f,g=(h+p)/2,m=(d+v)/2,y=p-h,_=v-d,x=y*y+_*_,b=i-a,w=h*v-p*d,k=(_<0?-1:1)*ml(pl(0,b*b*x-w*w)),A=(w*_-y*k)/x,M=(-w*y-_*k)/x,E=(w*_+y*k)/x,C=(-w*y+_*k)/x,D=A-g,F=M-m,S=E-g,T=C-m;return D*D+F*F>S*S+T*T&&(A=E,M=C),{cx:A,cy:M,x01:-c,y01:-f,x11:A*(i/b-1),y11:M*(i/b-1)}}function Sl(t){this._context=t}function Tl(t){return new Sl(t)}function Bl(t){return t[0]}function Ol(t){return t[1]}function zl(){var t=Bl,n=Ol,e=cl(!0),r=null,i=Tl,a=null;function u(u){var o,s,l,c=u.length,f=!1;for(null==r&&(a=i(l=ll())),o=0;o<=c;++o)!(o=c;--f)o.point(g[f],m[f]);o.lineEnd(),o.areaEnd()}v&&(g[l]=+t(h,l,s),m[l]=+e(h,l,s),o.point(n?+n(h,l,s):g[l],r?+r(h,l,s):m[l]))}if(d)return o=null,d+""||null}function l(){return zl().defined(i).curve(u).context(a)}return s.x=function(e){return arguments.length?(t="function"==typeof e?e:cl(+e),n=null,s):t},s.x0=function(n){return arguments.length?(t="function"==typeof n?n:cl(+n),s):t},s.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:cl(+t),s):n},s.y=function(t){return arguments.length?(e="function"==typeof t?t:cl(+t),r=null,s):e},s.y0=function(t){return arguments.length?(e="function"==typeof t?t:cl(+t),s):e},s.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:cl(+t),s):r},s.lineX0=s.lineY0=function(){return l().x(t).y(e)},s.lineY1=function(){return l().x(t).y(r)},s.lineX1=function(){return l().x(n).y(e)},s.defined=function(t){return arguments.length?(i="function"==typeof t?t:cl(!!t),s):i},s.curve=function(t){return arguments.length?(u=t,null!=a&&(o=u(a)),s):u},s.context=function(t){return arguments.length?(null==t?a=o=null:o=u(a=t),s):a},s}Sl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var Nl={draw:function(t,n){var e=Math.sqrt(n/yl);t.moveTo(e,0),t.arc(0,0,e,0,xl)}};function Pl(){}function ql(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Ll(t){this._context=t}function Ul(t){this._context=t}function jl(t){this._context=t}function Il(t,n){this._basis=new Ll(t),this._beta=n}Ll.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ql(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ql(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Ul.prototype={areaStart:Pl,areaEnd:Pl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=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)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:ql(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},jl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:ql(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Il.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],a=n[0],u=t[e]-i,o=n[e]-a,s=-1;++s<=e;)r=s/e,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*u),this._beta*n[s]+(1-this._beta)*(a+r*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var $l=function t(n){function e(t){return 1===n?new Ll(t):new Il(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function Hl(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Wl(t,n){this._context=t,this._k=(1-n)/6}Wl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Hl(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Hl(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Yl=function t(n){function e(t){return new Wl(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Gl(t,n){this._context=t,this._k=(1-n)/6}Gl.prototype={areaStart:Pl,areaEnd:Pl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=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)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Hl(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Vl=function t(n){function e(t){return new Gl(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Xl(t,n){this._context=t,this._k=(1-n)/6}Xl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Hl(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Jl=function t(n){function e(t){return new Xl(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Zl(t,n,e){var r=t._x1,i=t._y1,a=t._x2,u=t._y2;if(t._l01_a>1e-12){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>1e-12){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*l+t._x1*t._l23_2a-n*t._l12_2a)/c,u=(u*l+t._y1*t._l23_2a-e*t._l12_2a)/c}t._context.bezierCurveTo(r,i,a,u,t._x2,t._y2)}function Ql(t,n){this._context=t,this._alpha=n}Ql.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Zl(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Kl=function t(n){function e(t){return n?new Ql(t,n):new Wl(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function tc(t,n){this._context=t,this._alpha=n}tc.prototype={areaStart:Pl,areaEnd:Pl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=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)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Zl(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var nc=function t(n){function e(t){return n?new tc(t,n):new Gl(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function ec(t,n){this._context=t,this._alpha=n}ec.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Zl(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var rc=function t(n){function e(t){return n?new ec(t,n):new Xl(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function ic(t){this._context=t}function ac(t){return t<0?-1:1}function uc(t,n,e){var r=t._x1-t._x0,i=n-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),u=(e-t._y1)/(i||r<0&&-0),o=(a*i+u*r)/(r+i);return(ac(a)+ac(u))*Math.min(Math.abs(a),Math.abs(u),.5*Math.abs(o))||0}function oc(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function sc(t,n,e){var r=t._x0,i=t._y0,a=t._x1,u=t._y1,o=(a-r)/3;t._context.bezierCurveTo(r+o,i+o*n,a-o,u-o*e,a,u)}function lc(t){this._context=t}function cc(t){this._context=new fc(t)}function fc(t){this._context=t}function hc(t){this._context=t}function dc(t){var n,e,r=t.length-1,i=new Array(r),a=new Array(r),u=new Array(r);for(i[0]=0,a[0]=2,u[0]=t[0]+2*t[1],n=1;n=0;--n)i[n]=(u[n]-i[n+1])/a[n];for(a[r-1]=(t[r]+i[r-1])/2,n=0;n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};var vc={basis:{curve:function(t){return new Ll(t)}},"basis-closed":{curve:function(t){return new Ul(t)}},"basis-open":{curve:function(t){return new jl(t)}},bundle:{curve:$l,tension:"beta",value:.85},cardinal:{curve:Yl,tension:"tension",value:0},"cardinal-open":{curve:Jl,tension:"tension",value:0},"cardinal-closed":{curve:Vl,tension:"tension",value:0},"catmull-rom":{curve:Kl,tension:"alpha",value:.5},"catmull-rom-closed":{curve:nc,tension:"alpha",value:.5},"catmull-rom-open":{curve:rc,tension:"alpha",value:.5},linear:{curve:Tl},"linear-closed":{curve:function(t){return new ic(t)}},monotone:{horizontal:function(t){return new cc(t)},vertical:function(t){return new lc(t)}},natural:{curve:function(t){return new hc(t)}},step:{curve:function(t){return new pc(t,.5)}},"step-after":{curve:function(t){return new pc(t,1)}},"step-before":{curve:function(t){return new pc(t,0)}}};function gc(t,n,e){var r=gt(vc,t)&&vc[t],i=null;return r&&(i=r.curve||r[n||"vertical"],r.tension&&null!=e&&(i=i[r.tension](e))),i}var mc={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},yc=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function _c(t){var n,e,r,i,a,u,o,s,l,c,f,h=[];for(s=0,c=(n=t.slice().replace(yc[0],"###$1").split(yc[1]).slice(1)).length;so)for(l=1,f=i.length;l1&&(e*=v=Math.sqrt(v),r*=v);var g=h/e,m=f/e,y=-f/r,_=h/r,x=g*o+m*s,b=y*o+_*s,w=g*t+m*n,k=y*t+_*n,A=(w-x)*(w-x)+(k-b)*(k-b),M=1/A-.25;M<0&&(M=0);var E=Math.sqrt(M);a==i&&(E=-E);var C=.5*(x+w)-E*(k-b),D=.5*(b+k)+E*(w-x),F=Math.atan2(b-D,x-C),S=Math.atan2(k-D,w-C),T=S-F;T<0&&1===a?T+=wc:T>0&&0===a&&(T-=wc);for(var B=Math.ceil(Math.abs(T/(bc+.001))),O=[],z=0;zh;if(o||(o=s=ll()),f1e-12)if(p>xl-1e-12)o.moveTo(f*dl(h),f*gl(h)),o.arc(0,0,f,h,d,!v),c>1e-12&&(o.moveTo(c*dl(d),c*gl(d)),o.arc(0,0,c,d,h,v));else{var g,m,y=h,_=d,x=h,b=d,w=p,k=p,A=u.apply(this,arguments)/2,M=A>1e-12&&(r?+r.apply(this,arguments):ml(c*c+f*f)),E=vl(fl(f-c)/2,+e.apply(this,arguments)),C=E,D=E;if(M>1e-12){var F=wl(M/c*gl(A)),S=wl(M/f*gl(A));(w-=2*F)>1e-12?(x+=F*=v?1:-1,b-=F):(w=0,x=b=(h+d)/2),(k-=2*S)>1e-12?(y+=S*=v?1:-1,_-=S):(k=0,y=_=(h+d)/2)}var T=f*dl(y),B=f*gl(y),O=c*dl(b),z=c*gl(b);if(E>1e-12){var R,N=f*dl(_),P=f*gl(_),q=c*dl(x),L=c*gl(x);if(p1e-12?D>1e-12?(g=Fl(q,L,T,B,f,D,v),m=Fl(N,P,O,z,f,D,v),o.moveTo(g.cx+g.x01,g.cy+g.y01),D1e-12&&w>1e-12?C>1e-12?(g=Fl(O,z,N,P,c,-C,v),m=Fl(T,B,q,L,c,-C,v),o.lineTo(g.cx+g.x01,g.cy+g.y01),Cthis.x2&&(this.x2=t),n>this.y2&&(this.y2=n),this},lf.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},lf.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},lf.scale=function(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},lf.translate=function(t,n){return this.x1+=t,this.x2+=t,this.y1+=n,this.y2+=n,this},lf.rotate=function(t,n,e){var r=this.rotatedPoints(t,n,e);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},lf.rotatedPoints=function(t,n,e){var r=this.x1,i=this.y1,a=this.x2,u=this.y2,o=Math.cos(t),s=Math.sin(t),l=n-n*o+e*s,c=e-n*s-e*o;return[o*r-s*i+l,s*r+o*i+c,o*r-s*u+l,s*r+o*u+c,o*a-s*i+l,s*a+o*i+c,o*a-s*u+l,s*a+o*u+c]},lf.union=function(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},lf.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},lf.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},lf.intersects=function(t){return t&&!(this.x2t.x2||this.y2t.y2)},lf.contains=function(t,n){return!(tthis.x2||nthis.y2)},lf.width=function(){return this.x2-this.x1},lf.height=function(){return this.y2-this.y1},xt(ff,cf);var vf=pf.prototype;function gf(t){t._pending+=1}function mf(t){t._pending-=1}function yf(t,n,e){if(n.stroke&&0!==n.opacity&&0!==n.strokeOpacity){var r=null!=n.strokeWidth?+n.strokeWidth:1;t.expand(r+(e?function(t,n){return t.strokeJoin&&"miter"!==t.strokeJoin?0:n}(n,r):0))}return t}vf.pending=function(){return this._pending},vf.sanitizeURL=function(t){var n=this;return gf(n),n._loader.sanitize(t,{context:"href"}).then((function(t){return mf(n),t})).catch((function(){return mf(n),null}))},vf.loadImage=function(t){var n=this,e=df();return gf(n),n._loader.sanitize(t,{context:"image"}).then((function(t){var r=t.href;if(!r||!e)throw{url:r};var i=new e,a=gt(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=a&&(i.crossOrigin=a),i.onload=function(){return mf(n)},i.onerror=function(){return mf(n)},i.src=r,i})).catch((function(t){return mf(n),{complete:!1,width:0,height:0,src:t&&t.url||""}}))},vf.ready=function(){var t=this;return new Promise((function(n){!function e(r){t.pending()?setTimeout((function(){e(!0)}),10):n(r)}(!1)}))};var _f,xf,bf,wf=wc-1e-8;function kf(t){return _f=t,kf}function Af(){}function Mf(t,n){_f.add(t,n)}function Ef(t,n){Mf(xf=t,bf=n)}function Cf(t){Mf(t,_f.y1)}function Df(t){Mf(_f.x1,t)}function Ff(t,n,e,r){var i=(t-n)/(t+e-2*n);01e-14?(a=o*o+s*u)>=0&&(l=(-o+(a=Math.sqrt(a)))/u,c=(-o-a)/u):l=.5*s/o,0wf)Mf(t-e,n-e),Mf(t+e,n+e);else{var u,o,s=function(r){return Mf(e*Math.cos(r)+t,e*Math.sin(r)+n)};if(s(r),s(i),i!==r)if((r%=wc)<0&&(r+=wc),(i%=wc)<0&&(i+=wc),ii;++o,u-=bc)s(u);else for(u=r-r%bc+bc,o=0;o<4&&ug)return!1;o>v&&(v=o)}else if(a>0){if(o0&&(t.globalAlpha=e,t.fillStyle=If(t,n,n.fill),!0)}var Hf=[];function Wf(t,n,e){var r=null!=(r=n.strokeWidth)?r:1;return!(r<=0)&&((e*=null==n.strokeOpacity?1:n.strokeOpacity)>0&&(t.globalAlpha=e,t.strokeStyle=If(t,n,n.stroke),t.lineWidth=r,t.lineCap=n.strokeCap||"butt",t.lineJoin=n.strokeJoin||"miter",t.miterLimit=n.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(n.strokeDash||Hf),t.lineDashOffset=n.strokeDashOffset||0),!0))}function Yf(t,n){return t.zindex-n.zindex||t.index-n.index}function Gf(t){if(!t.zdirty)return t.zitems;var n,e,r,i=t.items,a=[];for(e=0,r=i.length;e=0;)if(e=n(i[r]))return e;if(i===a)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(e=n(i[r])))return e;return null}function Jf(t){return function(n,e,r){Vf(e,(function(e){r&&!r.intersects(e.bounds)||Qf(t,n,e,e)}))}}function Zf(t){return function(n,e,r){!e.items.length||r&&!r.intersects(e.bounds)||Qf(t,n,e.items[0],e.items)}}function Qf(t,n,e,r){var i=null==e.opacity?1:e.opacity;0!==i&&(t(n,r)||(Lf(n,e),e.fill&&$f(n,e,i)&&n.fill(),e.stroke&&Wf(n,e,i)&&n.stroke()))}function Kf(t){return t=t||C,function(n,e,r,i,a,u){return r*=n.pixelRatio,i*=n.pixelRatio,Xf(e,(function(e){var o=e.bounds;if((!o||o.contains(a,u))&&o)return t(n,e,r,i,a,u)?e:void 0}))}}function th(t,n){return function(e,r,i,a){var u,o,s=Array.isArray(r)?r[0]:r,l=null==n?s.fill:n,c=s.stroke&&e.isPointInStroke;return c&&(u=s.strokeWidth,o=s.strokeCap,e.lineWidth=null!=u?u:1,e.lineCap=null!=o?o:"butt"),!t(e,r)&&(l&&e.isPointInPath(i,a)||c&&e.isPointInStroke(i,a))}}function nh(t){return Kf(th(t))}function eh(t,n){return"translate("+t+","+n+")"}function rh(t){return"rotate("+t+")"}function ih(t){return eh(t.x||0,t.y||0)}function ah(t){return eh(t.x||0,t.y||0)+(t.angle?" "+rh(t.angle):"")+(t.scaleX||t.scaleY?" "+(n=t.scaleX||1,e=t.scaleY||1,"scale("+n+","+e+")"):"");var n,e}function uh(t,n,e){function r(t,e){var r=e.x||0,i=e.y||0,a=e.angle||0;t.translate(r,i),a&&t.rotate(a*=xc),t.beginPath(),n(t,e),a&&t.rotate(-a),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,e){t("transform",ah(e)),t("d",n(null,e))},bound:function(t,e){var r=e.x||0,i=e.y||0;return n(kf(t),e),yf(t,e).translate(r,i),e.angle&&t.rotate(e.angle*xc,r,i),t},draw:Jf(r),pick:nh(r),isect:e||zf(r)}}var oh=uh("arc",(function(t,n){return Xc.context(t)(n)}));function sh(t,n,e){function r(t,e){t.beginPath(),n(t,e)}var i=th(r);return{type:t,tag:"path",nested:!0,attr:function(t,e){var r=e.mark.items;r.length&&t("d",n(null,r))},bound:function(t,e){var r=e.items;return 0===r.length?t:(n(kf(t),r),yf(t,r[0]))},draw:Zf(r),pick:function(t,n,e,r,a,u){var o=n.items,s=n.bounds;return!o||!o.length||s&&!s.contains(a,u)?null:(e*=t.pixelRatio,r*=t.pixelRatio,i(t,o,e,r)?o[0]:null)},isect:Rf,tip:e}}var lh=sh("area",(function(t,n){var e=n[0],r=e.interpolate||"linear";return("horizontal"===e.orient?Zc:Jc).curve(gc(r,e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i="horizontal"===t[0].orient?n[1]:n[0],a="horizontal"===t[0].orient?"y":"x",u=t.length,o=1/0;--u>=0;)!1!==t[u].defined&&(r=Math.abs(t[u][a]-i)).5&&n<1.5?.5-Math.abs(n-1):0}function hh(t,n){var e=fh(n);t("d",rf(null,n,e,e))}function dh(t,n,e,r){var i=fh(n);t.beginPath(),rf(t,n,(e||0)+i,(r||0)+i)}var ph=th(dh),vh=th(dh,!1);var gh={type:"group",tag:"g",nested:!1,attr:function(t,n){t("transform",ih(n))},bound:function(t,n){if(!n.clip&&n.items)for(var e=n.items,r=e.length,i=0;iv||ag)))return t.save(),t.translate(d,p),d=i-d,p=a-p,y&&ef(l)&&!ph(t,l,o,s)?(t.restore(),null):(f=l.strokeForeground,(h=!1!==n.interactive)&&f&&l.stroke&&vh(t,l,o,s)?(t.restore(),l):(!(c=Xf(l,(function(t){return function(t,n,e){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(n,e)}(t,d,p)?u.pick(t,e,r,d,p):null})))&&h&&(l.fill||!f&&l.stroke)&&ph(t,l,o,s)&&(c=l),t.restore(),c||null))}))},isect:Nf,content:function(t,n,e){t("clip-path",n.clip?of(e,n,n):null)},background:function(t,n){t("class","background"),t("aria-hidden",!0),hh(t,n)},foreground:function(t,n){t("class","foreground"),t("aria-hidden",!0),n.strokeForeground?hh(t,n):t("d","")}},mh={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function yh(t,n){var e=t.image;return(!e||t.url&&t.url!==e.url)&&(e={complete:!1,width:0,height:0},n.loadImage(t.url).then((function(n){t.image=n,t.image.url=t.url}))),e}function _h(t,n){return null!=t.width?t.width:n&&n.width?!1!==t.aspect&&t.height?t.height*n.width/n.height:n.width:0}function xh(t,n){return null!=t.height?t.height:n&&n.height?!1!==t.aspect&&t.width?t.width*n.height/n.width:n.height:0}function bh(t,n){return"center"===t?n/2:"right"===t?n:0}function wh(t,n){return"middle"===t?n/2:"bottom"===t?n:0}var kh={type:"image",tag:"image",nested:!1,attr:function(t,n,e){var r=yh(n,e),i=_h(n,r),a=xh(n,r),u=(n.x||0)-bh(n.align,i),o=(n.y||0)-wh(n.baseline,a);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",mh["xmlns:xlink"],"xlink:href"),t("transform",eh(u,o)),t("width",i),t("height",a),t("preserveAspectRatio",!1===n.aspect?"none":"xMidYMid")},bound:function(t,n){var e=n.image,r=_h(n,e),i=xh(n,e),a=(n.x||0)-bh(n.align,r),u=(n.y||0)-wh(n.baseline,i);return t.set(a,u,a+r,u+i)},draw:function(t,n,e){var r=this;Vf(n,(function(n){if(!e||e.intersects(n.bounds)){var i,a,u,o,s=yh(n,r),l=_h(n,s),c=xh(n,s),f=(n.x||0)-bh(n.align,l),h=(n.y||0)-wh(n.baseline,c);!1!==n.aspect&&(a=s.width/s.height,u=n.width/n.height,a==a&&u==u&&a!==u&&(u=0;)if(!1!==t[a].defined&&(e=t[a].x-n[0])*e+(r=t[a].y-n[1])*r1?n:n[0]:n;var n}function $h(t){var n=Ih(t);return(T(n)?n.length-1:0)*jh(t)}function Hh(t,n){var e=null==n?"":(n+"").trim();return t.limit>0&&e.length?function(t,n){var e=+t.limit,r=function(t){if(zh.width===qh){var n=Yh(t);return function(t){return Lh(t,n)}}var e=Uh(t);return function(t){return Ph(t,e)}}(t);if(r(n)>>1,r(n.slice(i))>e?o=i+1:s=i;return a+n.slice(o)}for(;o>>1),r(n.slice(0,i))=0;)if(!1!==t[i].defined&&(e=t[i].x-n[0])*e+(r=t[i].y-n[1])*r<(e=t[i].size||1)*e)return t[i];return null}))};function Kh(t,n,e){var r=Qh[t.mark.marktype],i=n||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new sf),t,e)}var td={mark:null};function nd(t,n,e){var r,i,a,u,o=Qh[t.marktype],s=o.bound,l=t.items,c=l&&l.length;if(o.nested)return c?a=l[0]:(td.mark=t,a=td),u=Kh(a,s,e),n=n&&n.union(u)||u;if(n=n||t.bounds&&t.bounds.clear()||new sf,c)for(r=0,i=l.length;rn;)t.removeChild(e[--r]);return t}function hd(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function dd(t,n){var e=n.getBoundingClientRect();return[t.clientX-e.left-(n.clientLeft||0),t.clientY-e.top-(n.clientTop||0)]}function pd(t,n){this._active=null,this._handlers={},this._loader=t||Xa(),this._tooltip=n||vd}function vd(t,n,e,r){t.element().setAttribute("title",r||"")}ud.toJSON=function(t){return rd(this.root,t||0)},ud.mark=function(t,n,e){var r=od(t,n=n||this.root.items[0]);return n.items[e]=r,r.zindex&&(r.group.zdirty=!0),r};var gd=pd.prototype;function md(t){this._el=null,this._bgcolor=null,this._loader=new pf(t)}gd.initialize=function(t,n,e){return this._el=t,this._obj=e||null,this.origin(n)},gd.element=function(){return this._el},gd.canvas=function(){return this._el&&this._el.firstChild},gd.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},gd.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},gd.on=function(){},gd.off=function(){},gd._handlerIndex=function(t,n,e){for(var r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!e||t[r].handler===e))return r;return-1},gd.handlers=function(t){var n=this._handlers,e=[];if(t)e.push.apply(e,n[this.eventName(t)]);else for(var r in n)e.push.apply(e,n[r]);return e},gd.eventName=function(t){var n=t.indexOf(".");return n<0?t:t.slice(0,n)},gd.handleHref=function(t,n,e){this._loader.sanitize(e,{context:"href"}).then((function(n){var e=new MouseEvent(t.type,t),r=sd(null,"a");for(var i in n)r.setAttribute(i,n[i]);r.dispatchEvent(e)})).catch((function(){}))},gd.handleTooltip=function(t,n,e){if(n&&null!=n.tooltip){n=function(t,n,e,r){var i,a,u=t&&t.mark;if(u&&(i=Qh[u.marktype]).tip){for((a=dd(n,e))[0]-=r[0],a[1]-=r[1];t=t.mark.group;)a[0]-=t.x||0,a[1]-=t.y||0;t=i.tip(u.items,a)}return t}(n,t,this.canvas(),this._origin);var r=e&&n&&n.tooltip||null;this._tooltip.call(this._obj,this,t,n,r)}},gd.getItemBoundingClientRect=function(t){var n=this.canvas();if(n){for(var e=n.getBoundingClientRect(),r=this._origin,i=t.bounds,a=i.width(),u=i.height(),o=i.x1+r[0]+e.left,s=i.y1+r[1]+e.top;t.mark&&(t=t.mark.group);)o+=t.x||0,s+=t.y||0;return{x:o,y:s,width:a,height:u,left:o,top:s,right:o+a,bottom:s+u}}};var yd=md.prototype;yd.initialize=function(t,n,e,r,i){return this._el=t,this.resize(n,e,r,i)},yd.element=function(){return this._el},yd.canvas=function(){return this._el&&this._el.firstChild},yd.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},yd.resize=function(t,n,e,r){return this._width=t,this._height=n,this._origin=e||[0,0],this._scale=r||1,this},yd.dirty=function(){},yd.render=function(t){var n=this;return n._call=function(){n._render(t)},n._call(),n._call=null,n},yd._render=function(){},yd.renderAsync=function(t){var n=this.render(t);return this._ready?this._ready.then((function(){return n})):Promise.resolve(n)},yd._load=function(t,n){var e=this,r=e._loader[t](n);if(!e._ready){var i=e._call;e._ready=e._loader.ready().then((function(t){t&&i(),e._ready=null}))}return r},yd.sanitizeURL=function(t){return this._load("sanitizeURL",t)},yd.loadImage=function(t){return this._load("loadImage",t)};var _d="dragleave",xd="mousedown",bd="mousemove",wd="mouseout",kd="click",Ad=["keydown","keypress","keyup","dragenter",_d,"dragover",xd,"mouseup",bd,wd,"mouseover",kd,"dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],Md=bd,Ed=wd,Cd=kd;function Dd(t,n){pd.call(this,t,n),this._down=null,this._touch=null,this._first=!0,this._events={}}var Fd=xt(Dd,pd);Fd.initialize=function(t,n,e){var r=this;return this._canvas=t&&ld(t,"canvas"),[kd,xd,bd,wd,_d].forEach((function(t){return Sd(r,t)})),pd.prototype.initialize.call(this,t,n,e)};function Sd(t,n){(function(t){return"touchstart"===t||"touchmove"===t||"touchend"===t?["touchstart","touchmove","touchend"]:[t]})(n).forEach((function(n){return function(t,n){var e=t.canvas();e&&!t._events[n]&&(t._events[n]=1,e.addEventListener(n,t[n]?function(e){return t[n](e)}:function(e){return t.fire(n,e)}))}(t,n)}))}function Td(t,n,e){return function(r){var i=this._active,a=this.pickEvent(r);a===i||(i&&i.exit||this.fire(e,r),this._active=a,this.fire(n,r)),this.fire(t,r)}}function Bd(t){return function(n){this.fire(t,n),this._active=null}}Fd.canvas=function(){return this._canvas},Fd.context=function(){return this._canvas.getContext("2d")},Fd.events=Ad,Fd.DOMMouseScroll=function(t){this.fire("mousewheel",t)},Fd.mousemove=Td(bd,"mouseover",wd),Fd.dragover=Td("dragover","dragenter",_d),Fd.mouseout=Bd(wd),Fd.dragleave=Bd(_d),Fd.mousedown=function(t){this._down=this._active,this.fire(xd,t)},Fd.click=function(t){this._down===this._active&&(this.fire(kd,t),this._down=null)},Fd.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},Fd.touchmove=function(t){this.fire("touchmove",t,!0)},Fd.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},Fd.fire=function(t,n,e){var r=e?this._touch:this._active,i=this._handlers[t];if(n.vegaType=t,t===Cd&&r&&r.href?this.handleHref(n,r,r.href):t!==Md&&t!==Ed||this.handleTooltip(n,r,t!==Ed),i)for(var a=0,u=i.length;a=0&&r.splice(i,1),this},Fd.pickEvent=function(t){var n=dd(t,this._canvas),e=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-e[0],n[1]-e[1])},Fd.pick=function(t,n,e,r,i){var a=this.context();return Qh[t.marktype].pick.call(this,a,t,n,e,r,i)};var Od="undefined"!=typeof window&&window.devicePixelRatio||1;function zd(t){md.call(this,t),this._options={},this._redraw=!1,this._dirty=new sf,this._tempb=new sf}var Rd=xt(zd,md),Nd=md.prototype;Rd.initialize=function(t,n,e,r,i,a){return this._options=a||{},this._canvas=this._options.externalContext?null:hf(1,1,this._options.type),t&&this._canvas&&(fd(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Nd.initialize.call(this,t,n,e,r,i)},Rd.resize=function(t,n,e,r){if(Nd.resize.call(this,t,n,e,r),this._canvas)!function(t,n,e,r,i,a){var u="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,o=t.getContext("2d"),s=u?Od:i;for(var l in t.width=n*s,t.height=e*s,a)o[l]=a[l];u&&1!==s&&(t.style.width=n+"px",t.style.height=e+"px"),o.pixelRatio=s,o.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{var i=this._options.externalContext;i||_("CanvasRenderer is missing a valid canvas or context"),i.scale(this._scale,this._scale),i.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},Rd.canvas=function(){return this._canvas},Rd.context=function(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},Rd.dirty=function(t){for(var n=this._tempb.clear().union(t.bounds),e=t.mark.group;e;)n.translate(e.x||0,e.y||0),e=e.mark.group;this._dirty.union(n)};function Pd(t,n){pd.call(this,t,n);var e=this;e._hrefHandler=Ld(e,(function(t,n){n&&n.href&&e.handleHref(t,n,n.href)})),e._tooltipHandler=Ld(e,(function(t,n){e.handleTooltip(t,n,t.type!==Ed)}))}Rd._render=function(t){var n=this.context(),e=this._origin,r=this._width,i=this._height,a=this._dirty,u=function(t,n,e){return(new sf).set(0,0,n,e).translate(-t[0],-t[1])}(e,r,i);n.save();var o=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):function(t,n,e){return n.expand(1).round(),t.pixelRatio%1&&n.scale(t.pixelRatio).round().scale(1/t.pixelRatio),n.translate(-e[0]%1,-e[1]%1),t.beginPath(),t.rect(n.x1,n.y1,n.width(),n.height()),t.clip(),n}(n,u.intersect(a),e);return this.clear(-e[0],-e[1],r,i),this.draw(n,t,o),n.restore(),a.clear(),this},Rd.draw=function(t,n,e){var r=Qh[n.marktype];n.clip&&function(t,n){var e=n.clip;t.save(),it(e)?(t.beginPath(),e(t),t.clip()):ch(t,n.group)}(t,n),r.draw.call(this,t,n,e),n.clip&&t.restore()},Rd.clear=function(t,n,e,r){var i=this._options,a=this.context();"pdf"===i.type||i.externalContext||a.clearRect(t,n,e,r),null!=this._bgcolor&&(a.fillStyle=this._bgcolor,a.fillRect(t,n,e,r))};var qd=xt(Pd,pd);qd.initialize=function(t,n,e){var r=this._svg;return r&&(r.removeEventListener(Cd,this._hrefHandler),r.removeEventListener(Md,this._tooltipHandler),r.removeEventListener(Ed,this._tooltipHandler)),this._svg=r=t&&ld(t,"svg"),r&&(r.addEventListener(Cd,this._hrefHandler),r.addEventListener(Md,this._tooltipHandler),r.addEventListener(Ed,this._tooltipHandler)),pd.prototype.initialize.call(this,t,n,e)},qd.canvas=function(){return this._svg};var Ld=function(t,n){return function(e){var r=e.target.__data__;r=Array.isArray(r)?r[0]:r,e.vegaType=e.type,n.call(t._obj,e,r)}};function Ud(t,n,e){var r=t-n+2*e;return t?r>0?r:1:0}qd.on=function(t,n){var e=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[e],t,n)<0){var i={type:t,handler:n,listener:Ld(this,n)};(r[e]||(r[e]=[])).push(i),this._svg&&this._svg.addEventListener(e,i.listener)}return this},qd.off=function(t,n){var e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&(this._svg&&this._svg.removeEventListener(e,r[i].listener),r.splice(i,1)),this};var jd="log",Id="time",$d="utc",Hd="continuous";function Wd(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function Yd(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}var Gd=Symbol("implicit");function Vd(){var t=new Map,n=[],e=[],r=Gd;function i(i){var a=i+"",u=t.get(a);if(!u){if(r!==Gd)return r;t.set(a,u=n.push(i))}return e[(u-1)%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new Map;var r,a=_createForOfIteratorHelper(e);try{for(a.s();!(r=a.n()).done;){var u=r.value,o=u+"";t.has(o)||t.set(o,n.push(u))}}catch(t){a.e(t)}finally{a.f()}return i},i.range=function(t){return arguments.length?(e=Array.from(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Vd(n,e).unknown(r)},Wd.apply(i,arguments),i}function Xd(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Jd(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function Zd(){}var Qd="\\s*([+-]?\\d+)\\s*",Kd="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",tp="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",np=/^#([0-9a-f]{3,8})$/,ep=new RegExp("^rgb\\("+[Qd,Qd,Qd]+"\\)$"),rp=new RegExp("^rgb\\("+[tp,tp,tp]+"\\)$"),ip=new RegExp("^rgba\\("+[Qd,Qd,Qd,Kd]+"\\)$"),ap=new RegExp("^rgba\\("+[tp,tp,tp,Kd]+"\\)$"),up=new RegExp("^hsl\\("+[Kd,tp,tp]+"\\)$"),op=new RegExp("^hsla\\("+[Kd,tp,tp,Kd]+"\\)$"),sp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function lp(){return this.rgb().formatHex()}function cp(){return this.rgb().formatRgb()}function fp(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=np.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?hp(n):3===e?new gp(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?dp(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?dp(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=ep.exec(t))?new gp(n[1],n[2],n[3],1):(n=rp.exec(t))?new gp(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=ip.exec(t))?dp(n[1],n[2],n[3],n[4]):(n=ap.exec(t))?dp(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=up.exec(t))?xp(n[1],n[2]/100,n[3]/100,1):(n=op.exec(t))?xp(n[1],n[2]/100,n[3]/100,n[4]):sp.hasOwnProperty(t)?hp(sp[t]):"transparent"===t?new gp(NaN,NaN,NaN,0):null}function hp(t){return new gp(t>>16&255,t>>8&255,255&t,1)}function dp(t,n,e,r){return r<=0&&(t=n=e=NaN),new gp(t,n,e,r)}function pp(t){return t instanceof Zd||(t=fp(t)),t?new gp((t=t.rgb()).r,t.g,t.b,t.opacity):new gp}function vp(t,n,e,r){return 1===arguments.length?pp(t):new gp(t,n,e,null==r?1:r)}function gp(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function mp(){return"#"+_p(this.r)+_p(this.g)+_p(this.b)}function yp(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"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))+(1===t?")":", "+t+")")}function _p(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function xp(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new kp(t,n,e,r)}function bp(t){if(t instanceof kp)return new kp(t.h,t.s,t.l,t.opacity);if(t instanceof Zd||(t=fp(t)),!t)return new kp;if(t instanceof kp)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),a=Math.max(n,e,r),u=NaN,o=a-i,s=(a+i)/2;return o?(u=n===a?(e-r)/o+6*(e0&&s<1?0:u,new kp(u,o,s,t.opacity)}function wp(t,n,e,r){return 1===arguments.length?bp(t):new kp(t,n,e,null==r?1:r)}function kp(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ap(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Xd(Zd,fp,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:lp,formatHex:lp,formatHsl:function(){return bp(this).formatHsl()},formatRgb:cp,toString:cp}),Xd(gp,vp,Jd(Zd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new gp(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new gp(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mp,formatHex:mp,formatRgb:yp,toString:yp})),Xd(kp,wp,Jd(Zd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new kp(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new kp(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new gp(Ap(t>=240?t-240:t+120,i,r),Ap(t,i,r),Ap(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Mp=Math.PI/180,Ep=180/Math.PI,Cp=6/29*3*(6/29);function Dp(t){if(t instanceof Sp)return new Sp(t.l,t.a,t.b,t.opacity);if(t instanceof Pp)return qp(t);t instanceof gp||(t=pp(t));var n,e,r=zp(t.r),i=zp(t.g),a=zp(t.b),u=Tp((.2225045*r+.7168786*i+.0606169*a)/1);return r===i&&i===a?n=e=u:(n=Tp((.4360747*r+.3850649*i+.1430804*a)/.96422),e=Tp((.0139322*r+.0971045*i+.7141733*a)/.82521)),new Sp(116*u-16,500*(n-u),200*(u-e),t.opacity)}function Fp(t,n,e,r){return 1===arguments.length?Dp(t):new Sp(t,n,e,null==r?1:r)}function Sp(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function Tp(t){return t>6/29*(6/29)*(6/29)?Math.pow(t,1/3):t/Cp+4/29}function Bp(t){return t>6/29?t*t*t:Cp*(t-4/29)}function Op(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function zp(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Rp(t){if(t instanceof Pp)return new Pp(t.h,t.c,t.l,t.opacity);if(t instanceof Sp||(t=Dp(t)),0===t.a&&0===t.b)return new Pp(NaN,0=1?(e=1,n-1):Math.floor(e*n),i=t[r],a=t[r+1],u=r>0?t[r-1]:2*i-a,o=r180||e<-180?e-360*Math.round(e/360):e):Kp(isNaN(t)?n:t)}function ev(t){return 1==(t=+t)?rv:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Kp(isNaN(n)?e:n)}}function rv(t,n){var e=n-t;return e?tv(t,e):Kp(isNaN(t)?n:t)}Xd(Xp,Vp,Jd(Zd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Xp(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Xp(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Mp,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new gp(255*(n+e*(Lp*r+Up*i)),255*(n+e*(jp*r+Ip*i)),255*(n+e*($p*r)),this.opacity)}}));var iv=function t(n){var e=ev(n);function r(t,n){var r=e((t=vp(t)).r,(n=vp(n)).r),i=e(t.g,n.g),a=e(t.b,n.b),u=rv(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=a(n),t.opacity=u(n),t+""}}return r.gamma=t,r}(1);function av(t){return function(n){var e,r,i=n.length,a=new Array(i),u=new Array(i),o=new Array(i);for(e=0;ea&&(i=n.slice(a,i),o[u]?o[u]+=i:o[++u]=i),(e=e[0])===(r=r[0])?o[u]?o[u]+=r:o[++u]=r:(o[++u]=null,s.push({i:u,x:hv(e,r)})),a=vv.lastIndex;return a180?n+=360:n-t>180&&(t+=360),a.push({i:e.push(i(e)+"rotate(",null,r)-2,x:hv(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(a.rotate,u.rotate,o,s),function(t,n,e,a){t!==n?a.push({i:e.push(i(e)+"skewX(",null,r)-2,x:hv(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(a.skewX,u.skewX,o,s),function(t,n,e,r,a,u){if(t!==e||n!==r){var o=a.push(i(a)+"scale(",null,",",null,")");u.push({i:o-4,x:hv(t,e)},{i:o-2,x:hv(n,r)})}else 1===e&&1===r||a.push(i(a)+"scale("+e+","+r+")")}(a.scaleX,a.scaleY,u.scaleX,u.scaleY,o,s),a=u=null,function(t){for(var n,e=-1,r=s.length;++en&&(e=t,t=n,n=e),function(e){return Math.max(t,Math.min(n,e))}}(u[0],u[t-1])),r=t>2?Gv:Yv,i=a=null,f}function f(n){return isNaN(n=+n)?e:(i||(i=r(u.map(t),o,s)))(t(l(n)))}return f.invert=function(e){return l(n((a||(a=r(o,u.map(t),hv)))(e)))},f.domain=function(t){return arguments.length?(u=Array.from(t,Iv),c()):u.slice()},f.range=function(t){return arguments.length?(o=Array.from(t),c()):o.slice()},f.rangeRound=function(t){return o=Array.from(t),s=yv,c()},f.clamp=function(t){return arguments.length?(l=!!t||Hv,c()):l!==Hv},f.interpolate=function(t){return arguments.length?(s=t,c()):s},f.unknown=function(t){return arguments.length?(e=t,f):e},function(e,r){return t=e,n=r,c()}}function Jv(){return Xv()(Hv,Hv)}function Zv(t,n,e,r){var i,a=me(t,n,e);switch((r=Se(null==r?",f":r)).type){case"s":var u=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=$e(a,u))||(r.precision=i),Pe(r,u);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=He(a,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Ie(a))||(r.precision=i-2*("%"===r.type))}return Ne(r)}function Qv(t){var n=t.domain;return t.ticks=function(t){var e=n();return ve(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return Zv(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i=n(),a=0,u=i.length-1,o=i[a],s=i[u];return s0?r=ge(o=Math.floor(o/r)*r,s=Math.ceil(s/r)*r,e):r<0&&(r=ge(o=Math.ceil(o*r)/r,s=Math.floor(s*r)/r,e)),r>0?(i[a]=Math.floor(o/r)*r,i[u]=Math.ceil(s/r)*r,n(i)):r<0&&(i[a]=Math.ceil(o*r)/r,i[u]=Math.floor(s*r)/r,n(i)),t},t}function Kv(t,n){var e,r=0,i=(t=t.slice()).length-1,a=t[r],u=t[i];return u0){for(;h<=d;++h)for(c=1,l=e(h);cs)break;v.push(f)}}else for(;h<=d;++h)for(c=a-1,l=e(h);c>=1;--c)if(!((f=l*c)s)break;v.push(f)}2*v.lengtha[1-c])))return e=Math.max(0,se(f,s)-1),u=s===l?e:se(f,l)-1,s-f[e]>n+1e-10&&++e,c&&(o=e,e=h-u,u=h-o),e>u?void 0:r().slice(e,u+1)}},e.invert=function(t){var n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Ag().domain(r()).range(a).round(u).paddingInner(o).paddingOuter(s).align(l)},c()}var Mg=Array.prototype.map;function Eg(t){return Mg.call(t,(function(t){return+t}))}var Cg=Array.prototype.slice;var Dg={};function Fg(t,n,e){var r=function(){var e=n();return e.invertRange||(e.invertRange=e.invert?function(t){return function(n){var e,r=n[0],i=n[1];return i=o&&u[i]<=s&&(l<0&&(l=i),e=i);if(!(l<0))return o=t.invertExtent(u[l]),s=t.invertExtent(u[e]),[void 0===o[0]?o[1]:o[0],void 0===s[1]?s[0]:s[1]]}}(e):void 0),e.type=t,e};return r.metadata=Lt(et(e)),r}function Sg(t,n,e){return arguments.length>1?(Dg[t]=Fg(t,n,e),this):Tg(t)?Dg[t]:void 0}function Tg(t){return gt(Dg,t)}function Bg(t,n){var e=Dg[t];return e&&e.metadata[n]}function Og(t){return Bg(t,Hd)}function zg(t){return Bg(t,"discrete")}function Rg(t){return Bg(t,"discretizing")}function Ng(t){return Bg(t,jd)}function Pg(t){return Bg(t,"interpolating")}function qg(t){return Bg(t,"quantile")}Sg("identity",(function t(n){var e;function r(t){return isNaN(t=+t)?e:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(n=Array.from(t,Iv),r):n.slice()},r.unknown=function(t){return arguments.length?(e=t,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,Iv):[0,1],Qv(r)})),Sg("linear",(function t(){var n=Jv();return n.copy=function(){return Vv(n,t())},Wd.apply(n,arguments),Qv(n)}),Hd),Sg(jd,(function t(){var n=ug(Xv()).domain([1,10]);return n.copy=function(){return Vv(n,t()).base(n.base())},Wd.apply(n,arguments),n}),[Hd,jd]),Sg("pow",pg,Hd),Sg("sqrt",(function(){return pg.apply(null,arguments).exponent(.5)}),Hd),Sg("symlog",(function t(){var n=lg(Xv());return n.copy=function(){return Vv(n,t()).constant(n.constant())},Wd.apply(n,arguments)}),Hd),Sg(Id,(function(){return Wd.apply(mg(wr,br,yr,gr,vr,pr,dr,hr,Ai).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Hd,"temporal"]),Sg($d,(function(){return Wd.apply(mg(Tr,Sr,Cr,Mr,Ar,kr,dr,hr,Ei).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Hd,"temporal"]),Sg("sequential",xg,[Hd,"interpolating"]),Sg("".concat("sequential","-").concat("linear"),xg,[Hd,"interpolating"]),Sg("".concat("sequential","-").concat(jd),(function t(){var n=ug(yg()).domain([1,10]);return n.copy=function(){return _g(n,t()).base(n.base())},Yd.apply(n,arguments)}),[Hd,"interpolating",jd]),Sg("".concat("sequential","-").concat("pow"),bg,[Hd,"interpolating"]),Sg("".concat("sequential","-").concat("sqrt"),(function(){return bg.apply(null,arguments).exponent(.5)}),[Hd,"interpolating"]),Sg("".concat("sequential","-").concat("symlog"),(function t(){var n=lg(yg());return n.copy=function(){return _g(n,t()).constant(n.constant())},Yd.apply(n,arguments)}),[Hd,"interpolating"]),Sg("".concat("diverging","-").concat("linear"),(function t(){var n=Qv(wg()(Hv));return n.copy=function(){return _g(n,t())},Yd.apply(n,arguments)}),[Hd,"interpolating"]),Sg("".concat("diverging","-").concat(jd),(function t(){var n=ug(wg()).domain([.1,1,10]);return n.copy=function(){return _g(n,t()).base(n.base())},Yd.apply(n,arguments)}),[Hd,"interpolating",jd]),Sg("".concat("diverging","-").concat("pow"),kg,[Hd,"interpolating"]),Sg("".concat("diverging","-").concat("sqrt"),(function(){return kg.apply(null,arguments).exponent(.5)}),[Hd,"interpolating"]),Sg("".concat("diverging","-").concat("symlog"),(function t(){var n=lg(wg());return n.copy=function(){return _g(n,t()).constant(n.constant())},Yd.apply(n,arguments)}),[Hd,"interpolating"]),Sg("quantile",(function t(){var n,e=[],r=[],i=[];function a(){var t=0,n=Math.max(1,r.length);for(i=new Array(n-1);++t0?i[n-1]:e[0],n=i?[a[i-1],r]:[a[n-1],a[n]]},o.unknown=function(t){return arguments.length?(n=t,o):o},o.thresholds=function(){return a.slice()},o.copy=function(){return t().domain([e,r]).range(u).unknown(n)},Wd.apply(Qv(o),arguments)}),"discretizing"),Sg("threshold",(function t(){var n,e=[.5],r=[0,1],i=1;function a(t){return t<=t?r[se(e,t,0,i)]:n}return a.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,r.length-1),a):e.slice()},a.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(e.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},a.unknown=function(t){return arguments.length?(n=t,a):n},a.copy=function(){return t().domain(e).range(r).unknown(n)},Wd.apply(a,arguments)}),"discretizing"),Sg("bin-ordinal",(function t(){var n=[],e=[];function r(t){return null==t||t!=t?void 0:e[(se(n,t)-1)%e.length]}return r.domain=function(t){return arguments.length?(n=Eg(t),r):n.slice()},r.range=function(t){return arguments.length?(e=Cg.call(t),r):e.slice()},r.tickFormat=function(t,e){return Zv(n[0],P(n),null==t?10:t,e)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),["discrete","discretizing"]),Sg("ordinal",Vd,"discrete"),Sg("band",Ag,"discrete"),Sg("point",(function(){return function t(n){var e=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,n.copy=function(){return t(e())},n}(Ag().paddingInner(1))}),"discrete");var Lg=["clamp","base","constant","exponent"];function Ug(t,n){var e=n[0],r=P(n)-e;return function(n){return t(e+n*r)}}function jg(t,n,e){return Uv(Hg(n||"rgb",e),t)}function Ig(t,n){for(var e=new Array(n),r=n+1,i=0;i1?(Gg[t]=n,this):Gg[t]}Yg({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},Wg),Yg({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(function(t){return jg(Wg(t))}));var Xg=function(t){return T(t)?t.map((function(t){return String(t)})):String(t)},Jg=function(t,n){return t[1]-n[1]},Zg=function(t,n){return n[1]-t[1]};function Qg(t,n,e){var r;return At(n)&&(t.bins&&(n=Math.max(n,t.bins.length)),null!=e&&(n=Math.min(n,Math.floor(Ot(t.domain())/e||1)))),B(n)&&(r=n.step,n=n.interval),Et(n)&&(n=t.type===Id?ei(n):t.type==$d?ri(n):_("Only time and utc scales accept interval strings."),r&&(n=n.every(r))),n}function Kg(t,n,e){var r=t.range(),i=r[0],a=P(r),u=Jg;if(i>a&&(r=a,a=i,i=r,u=Zg),i=Math.floor(i),a=Math.ceil(a),n=n.map((function(n){return[n,t(n)]})).filter((function(t){return i<=t[1]&&t[1]<=a})).sort(u).map((function(t){return t[0]})),e>0&&n.length>1){for(var o=[n[0],P(n)];n.length>e&&n.length>=3;)n=n.filter((function(t,n){return!(n%2)}));n.length<3&&(n=o)}return n}function tm(t,n){return t.bins?Kg(t,t.bins):t.ticks?t.ticks(n):t.domain()}function nm(t,n,e,r,i,a){var u=n.type,o=Xg;if(u===Id||i===Id)o=t.timeFormat(r);else if(u===$d||i===$d)o=t.utcFormat(r);else if(Ng(u)){var s=t.formatFloat(r);if(a||n.bins)o=s;else{var l=em(n,e,!1);o=function(t){return l(t)?s(t):""}}}else if(n.tickFormat){var c=n.domain();o=t.formatSpan(c[0],c[c.length-1],e,r)}else r&&(o=t.format(r));return o}function em(t,n,e){var r=tm(t,n),i=t.base(),a=Math.log(i),u=Math.max(1,i*n/r.length),o=function(t){var n=t/Math.pow(i,Math.round(Math.log(t)/a));return n*i1?i[1]-i[0]:i[0];for(r=1;rr?o.slice(0,r-2).map(i).join(", ")+", ending with "+o.slice(-1).map(i):o.map(i).join(", ");return"".concat(s," value").concat(1===s?"":"s",": ").concat(l)}var c=n.domain();return"values from ".concat(i(c[0])," to ").concat(i(P(c)))}var fm=function(t,n,e){var r;return _defineProperty(r={},"role",t),_defineProperty(r,"aria-roledescription",n),_defineProperty(r,"aria-label",e||void 0),r},hm=Lt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),dm={axis:{desc:"axis",caption:function(t){var n=t.datum,e=t.orient,r=n.title?ym(t):null,i=t.context,a=i.scales[n.scale].value,u=i.dataflow.locale(),o=a.type;return"".concat("left"===e||"right"===e?"Y":"X","-axis")+(r?" titled '".concat(r,"'"):"")+" for a ".concat(zg(o)?"discrete":o," scale")+" with ".concat(cm(u,a,t))}},legend:{desc:"legend",caption:function(t){var n=t.datum,e=n.title?ym(t):null,r="".concat(n.type||""," legend").trim(),i=n.scales,a=Object.keys(i),u=t.context,o=u.scales[i[a[0]]].value,s=u.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(e?" titled '".concat(e,"'"):"")+" for ".concat(function(t){return(t=t.map((function(t){return t+("fill"===t||"stroke"===t?" color":"")}))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+P(t)}(a))+" with ".concat(cm(s,o,t));var l}},"title-text":{desc:"title",caption:function(t){return"Title text '".concat(mm(t),"'")}},"title-subtitle":{desc:"subtitle",caption:function(t){return"Subtitle text '".concat(mm(t),"'")}}},pm={ariaRole:"role",ariaRoleDescription:"aria-roledescription",description:"aria-label"};function vm(t,n){var e=!1===n.aria;if(t("aria-hidden",e||void 0),e||null==n.description)for(var r in pm)t(pm[r],void 0);else{var i=n.mark.marktype;t("aria-label",n.description),t("role",n.ariaRole||("group"===i?"graphics-object":"graphics-symbol")),t("aria-roledescription",n.ariaRoleDescription||"".concat(i," mark"))}}function gm(t){return!1===t.aria?_defineProperty({},"aria-hidden",!0):hm[t.role]?null:dm[t.role]?function(t,n){try{var e=t.items[0],r=n.caption||function(){return""};return fm(n.role||"graphics-symbol",n.desc,e.description||r(e))}catch(t){return null}}(t,dm[t.role]):function(t){var n=t.marktype,e="group"===n||"text"===n||t.items.some((function(t){return null!=t.description&&!1!==t.aria}));return fm(e?"graphics-object":"graphics-symbol","".concat(n," mark container"),t.description)}(t)}function mm(t){return et(t.text).join(" ")}function ym(t){try{return et(P(t.items).items[0].text).join(" ")}catch(t){return null}}var _m=function(t){return(t+"").replace(/&/g,"&").replace(/"/g,""")};function xm(t,n,e){var r,i,a="<"+t;if(n)for(r in n)null!=(i=n[r])&&(a+=" "+r+'="'+_m(i)+'"');return e&&(a+=" "+e),a+">"}function bm(t){return""}var wm={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity",blend:"mix-blend-mode"},km={fill:"none","stroke-miterlimit":10},Am=mh.xmlns;function Mm(t){md.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var Em=xt(Mm,md),Cm=md.prototype;function Dm(t,n,e){var r,i,a;if("radial"===n.gradient){var u=cd(t,e++,"pattern",Am);u.setAttribute("id","p_"+n.id),u.setAttribute("viewBox","0,0,1,1"),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("preserveAspectRatio","xMidYMid slice"),(u=cd(u,0,"rect",Am)).setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","url("+qm()+"#"+n.id+")"),(t=cd(t,e++,"radialGradient",Am)).setAttribute("id",n.id),t.setAttribute("fx",n.x1),t.setAttribute("fy",n.y1),t.setAttribute("fr",n.r1),t.setAttribute("cx",n.x2),t.setAttribute("cy",n.y2),t.setAttribute("r",n.r2)}else(t=cd(t,e++,"linearGradient",Am)).setAttribute("id",n.id),t.setAttribute("x1",n.x1),t.setAttribute("x2",n.x2),t.setAttribute("y1",n.y1),t.setAttribute("y2",n.y2);for(r=0,i=n.stops.length;r1&&t.previousSibling!=n}(u,e))&&n.insertBefore(u,e?e.nextSibling:n.firstChild),u}Em.initialize=function(t,n,e,r){if(this._defs={gradient:{},clipping:{}},t){for(var i in this._svg=cd(t,0,"svg",Am),this._svg.setAttribute("class","marks"),fd(t,1),this._root=cd(this._svg,0,"g",Am),km)this._root.setAttribute(i,km[i]);fd(this._svg,1)}return this.background(this._bgcolor),Cm.initialize.call(this,t,n,e,r)},Em.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),Cm.background.apply(this,arguments)},Em.resize=function(t,n,e,r){return Cm.resize.call(this,t,n,e,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},Em.canvas=function(){return this._svg},Em.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var n in mh)t[n]=mh[n];var e=this._bgcolor?xm("rect",{width:this._width,height:this._height,fill:this._bgcolor})+bm("rect"):"";return xm("svg",t)+(this._defs.el?this._defs.el.outerHTML:"")+e+this._root.outerHTML+bm("svg")},Em._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),fd(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},Em.updateDefs=function(){var t=this._svg,n=this._defs,e=n.el,r=0;for(var i in n.gradient)e||(n.el=e=cd(t,0,"defs",Am)),r=Dm(e,n.gradient[i],r);for(var a in n.clipping)e||(n.el=e=cd(t,0,"defs",Am)),r=Fm(e,n.clipping[a],r);e&&(0===r?(t.removeChild(e),n.el=null):fd(e,r))},Em._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},Em.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},Em.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},Em._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length||!this._dirtyID)return!0;var n,e,r,i,a,u,o,s=++this._dirtyID;for(a=0,u=t.length;a/g,">")}Um.resize=function(t,n,e,r){jm.resize.call(this,t,n,e,r);var i=this._origin,a=this._text,u={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var o in mh)u[o]=mh[o];a.head=xm("svg",u);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),a.bg=s?xm("rect",{width:this._width,height:this._height,fill:s})+bm("rect"):"",a.root=xm("g",ht({},km,{transform:"translate("+i+")"})),a.foot=bm("g")+bm("svg"),this},Um.background=function(){var t=jm.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},Um.svg=function(){var t=this._text;return t.head+t.defs+t.bg+t.root+t.body+t.foot},Um._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},Um.buildDefs=function(){var t,n="";for(var e in this._defs.gradient){var r=this._defs.gradient[e],i=r.stops;"radial"===r.gradient?(n+=xm(t="pattern",{id:"p_"+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),n+=xm("rect",{width:"1",height:"1",fill:"url(#"+e+")"})+bm("rect"),n+=bm(t),n+=xm(t="radialGradient",{id:e,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):n+=xm(t="linearGradient",{id:e,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(var a=0;a1?(Hm[t]=n,this):Hm[t]}function Ym(t,n,e){var r=[],i=(new sf).union(n),a=t.marktype;return a?Gm(t,i,e,r):"group"===a?Vm(t,i,e,r):_("Intersect scene must be mark node or group item.")}function Gm(t,n,e,r){if(function(t,n,e){return t.bounds&&n.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!e||e(t)))}(t,n,e)){var i=t.items,a=t.marktype,u=i.length,o=0;if("group"===a)for(;o=0;r--)if(i[r]!=a[r])return!1;for(r=i.length-1;r>=0;r--)if(e=i[r],!Qm(t[e],n[e],e))return!1;return _typeof(t)===_typeof(n)}(t,n):t==n)}function Km(t,n){return Qm(_c(t),_c(n))}function ty(t){_u.call(this,null,t)}function ny(t,n,e){return n(t.bounds.clear(),t,e)}xt(ty,_u).transform=function(t,n){var e,r=n.dataflow,i=t.mark,a=i.marktype,u=Qh[a],o=u.bound,s=i.bounds;if(u.nested)i.items.length&&r.dirty(i.items[0]),s=ny(i,o),i.items.forEach((function(t){t.bounds.clear().union(s)}));else if("group"===a||t.modified())switch(n.visit(n.MOD,(function(t){return r.dirty(t)})),s.clear(),i.items.forEach((function(t){return s.union(ny(t,o))})),i.role){case"axis":case"legend":case"title":n.reflow()}else e=n.changed(n.REM),n.visit(n.ADD,(function(t){s.union(ny(t,o))})),n.visit(n.MOD,(function(t){e=e||s.alignsWith(t.bounds),r.dirty(t),s.union(ny(t,o))})),e&&(s.clear(),i.items.forEach((function(t){return s.union(t.bounds)})));return Zm(i),n.modifies("bounds")};function ey(t){_u.call(this,0,t)}function ry(t){_u.call(this,null,t)}function iy(t){_u.call(this,null,t)}ey.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},xt(ey,_u).transform=function(t,n){var e=function(t){var n=t._signals[":vega_identifier:"];n||(t._signals[":vega_identifier:"]=n=t.add(0));return n}(n.dataflow),r=e.value,i=t.as;return n.visit(n.ADD,(function(t){t[i]||(t[i]=++r)})),e.set(this.value=r),n},xt(ry,_u).transform=function(t,n){var e=this.value;e||((e=n.dataflow.scenegraph().mark(t.markdef,function(t){var n=t.groups,e=t.parent;return n&&1===n.size?n.get(Object.keys(n.object)[0]):n&&e?n.lookup(e):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=e.group),e.source=this.source,e.clip=t.clip,e.interactive=t.interactive,this.value=e);var r="group"===e.marktype?ff:cf;return n.visit(n.ADD,(function(t){return r.call(t,e)})),(t.modified("clip")||t.modified("interactive"))&&(e.clip=t.clip,e.interactive=!!t.interactive,e.zdirty=!0,n.reflow()),e.items=n.source,n};var ay=xt(iy,_u),uy={parity:function(t){return t.filter((function(t,n){return n%2?t.opacity=0:1}))},greedy:function(t,n){var e;return t.filter((function(t,r){return r&&oy(e.bounds,t.bounds,n)?t.opacity=0:(e=t,1)}))}};function oy(t,n,e){return e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2)}function sy(t,n){for(var e,r=1,i=t.length,a=t[0].bounds;r1&&n.height()>1}function cy(t){return t.forEach((function(t){return t.opacity=1})),t}function fy(t,n){return t.reflow(n.modified()).modifies("opacity")}function hy(t){_u.call(this,null,t)}ay.transform=function(t,n){var e,r,i,a=uy[t.method]||uy.parity,u=n.materialize(n.SOURCE).source,o=t.separation||0;if(u&&u.length){if(!t.method)return t.modified("method")&&(cy(u),n=fy(n,t)),n;if((u=u.filter(ly)).length){if(t.sort&&(u=u.slice().sort(t.sort)),e=cy(u),n=fy(n,t),e.length>=3&&sy(e,o)){do{e=a(e,o)}while(e.length>=3&&sy(e,o));e.length<3&&!P(u).opacity&&(e.length>1&&(P(e).opacity=0),P(u).opacity=1)}return t.boundScale&&t.boundTolerance>=0&&(r=function(t,n,e){var r=t.range(),i=new sf;return n===Xs||"bottom"===n?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(e||1),function(t){return i.encloses(t.bounds)}}(t.boundScale,t.boundOrient,+t.boundTolerance),u.forEach((function(t){r(t)||(t.opacity=0)}))),i=e[0].mark.bounds.clear(),u.forEach((function(t){t.opacity&&i.union(t.bounds)})),n}}},xt(hy,_u).transform=function(t,n){var e=n.dataflow;if(n.visit(n.ALL,(function(t){return e.dirty(t)})),n.fields&&n.fields.zindex){var r=n.source&&n.source[0];r&&(r.mark.zdirty=!0)}};var dy=new sf;function py(t,n,e){return t[n]===e?0:(t[n]=e,1)}function vy(t){var n=t.items[0].orient;return n===Js||n===Zs}function gy(t,n,e,r){var i,a,u=n.items[0],o=u.datum,s=null!=u.translate?u.translate:.5,l=u.orient,c=function(t){var n=+t.grid;return[t.ticks?n++:-1,t.labels?n++:-1,n+ +t.domain]}(o),f=u.range,h=u.offset,d=u.position,p=u.minExtent,v=u.maxExtent,g=o.title&&u.items[c[2]].items[0],m=u.titlePadding,y=u.bounds,_=g&&$h(g),x=0,b=0;switch(dy.clear().union(y),y.clear(),(i=c[0])>-1&&y.union(u.items[i].bounds),(i=c[1])>-1&&y.union(u.items[i].bounds),l){case Xs:x=d||0,b=-h,a=Math.max(p,Math.min(v,-y.y1)),y.add(0,-a).add(f,0),g&&my(t,g,a,m,_,0,-1,y);break;case Js:x=-h,b=d||0,a=Math.max(p,Math.min(v,-y.x1)),y.add(-a,0).add(0,f),g&&my(t,g,a,m,_,1,-1,y);break;case Zs:x=e+h,b=d||0,a=Math.max(p,Math.min(v,y.x2)),y.add(0,0).add(a,f),g&&my(t,g,a,m,_,1,1,y);break;case"bottom":x=d||0,b=r+h,a=Math.max(p,Math.min(v,y.y2)),y.add(0,0).add(f,a),g&&my(t,g,a,m,0,0,1,y);break;default:x=u.x,b=u.y}return yf(y.translate(x,b),u),py(u,"x",x+s)|py(u,"y",b+s)&&(u.bounds=dy,t.dirty(u),u.bounds=y,t.dirty(u)),u.mark.bounds.clear().union(y)}function my(t,n,e,r,i,a,u,o){var s=n.bounds;if(n.auto){var l=u*(e+i+r),c=0,f=0;t.dirty(n),a?c=(n.x||0)-(n.x=l):f=(n.y||0)-(n.y=l),n.mark.bounds.clear().union(s.translate(-c,-f)),t.dirty(n)}o.union(s)}var yy=function(t,n){return Math.floor(Math.min(t,n))},_y=function(t,n){return Math.ceil(Math.max(t,n))};function xy(t){return(new sf).set(0,0,t.width||0,t.height||0)}function by(t){var n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function wy(t,n,e){var r=B(t)?t[n]:t;return null!=r?r:void 0!==e?e:0}function ky(t){return t<0?Math.ceil(-t):0}function Ay(t,n,e){var r,i,a,u,o,s,l,c,f,h,d,p=!e.nodirty,v="flush"===e.bounds?xy:by,g=dy.set(0,0,0,0),m=wy(e.align,"column"),y=wy(e.align,Ks),_=wy(e.padding,"column"),x=wy(e.padding,Ks),b=e.columns||n.length,w=b<=0?1:Math.ceil(n.length/b),k=n.length,A=Array(k),M=Array(b),E=0,C=Array(k),D=Array(w),F=0,S=Array(k),T=Array(k),B=Array(k);for(i=0;i1)for(i=0;i0&&(S[i]+=f/2);if(y&&wy(e.center,Ks)&&1!==b)for(i=0;i0&&(T[i]+=h/2);for(i=0;ii&&(t.warn("Grid headers exceed limit: "+i),n=n.slice(0,i)),A+=a,v=0,m=n.length;v=0&&null==(x=e[g]);g-=h);o?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=A):(b=A,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),y.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),M=u(M,y[l])}return M}function Fy(t,n,e,r,i,a){if(n){t.dirty(n);var u=e,o=e;r?u=Math.round(i.x1+a*i.width()):o=Math.round(i.y1+a*i.height()),n.bounds.translate(u-(n.x||0),o-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=u,n.y=o,t.dirty(n)}}function Sy(t,n,e,r,i,a,u){var o=function(t,n){var e=t[n]||{};return function(n,r){return null!=e[n]?e[n]:null!=t[n]?t[n]:r}}(e,n),s=function(t,n){var e=-1/0;return t.forEach((function(t){null!=t.offset&&(e=Math.max(e,t.offset))})),e>-1/0?e:n}(t,o("offset",0)),l=o("anchor","start"),c=l===Qs?1:"middle"===l?.5:0,f={align:"each",bounds:o("bounds","flush"),columns:"vertical"===o("direction")?1:t.length,padding:o("margin",8),center:o("center"),nodirty:!0};switch(n){case Js:f.anchor={x:Math.floor(r.x1)-s,column:Qs,y:c*(u||r.height()+2*r.y1),row:l};break;case Zs:f.anchor={x:Math.ceil(r.x2)+s,y:c*(u||r.height()+2*r.y1),row:l};break;case Xs:f.anchor={y:Math.floor(i.y1)-s,row:Qs,x:c*(a||i.width()+2*i.x1),column:l};break;case"bottom":f.anchor={y:Math.ceil(i.y2)+s,x:c*(a||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:a-s,y:s,column:Qs};break;case"bottom-left":f.anchor={x:s,y:u-s,row:Qs};break;case"bottom-right":f.anchor={x:a-s,y:u-s,column:Qs,row:Qs}}return f}function Ty(t,n){var e,r,i,a,u=n.items[0],o=u.datum,s=u.orient,l=u.bounds,c=u.x,f=u.y;return u._bounds?u._bounds.clear().union(l):u._bounds=l.clone(),l.clear(),function(t,n,e){var r=n.padding,i=r-e.x,a=r-e.y;if(n.datum.title){var u=n.items[1].items[0],o=u.anchor,s=n.titlePadding||0,l=r-u.x,c=r-u.y;switch(u.orient){case Js:i+=Math.ceil(u.bounds.width())+s;break;case Zs:case"bottom":break;default:a+=u.bounds.height()+s}switch((i||a)&&Oy(t,e,i,a),u.orient){case Js:c+=By(n,e,u,o,1,1);break;case Zs:l+=By(n,e,u,Qs,0,0)+s,c+=By(n,e,u,o,1,1);break;case"bottom":l+=By(n,e,u,o,0,0),c+=By(n,e,u,Qs,-1,0,1)+s;break;default:l+=By(n,e,u,o,0,0)}(l||c)&&Oy(t,u,l,c),(l=Math.round(u.bounds.x1-r))<0&&(Oy(t,e,-l,0),Oy(t,u,-l,0))}else(i||a)&&Oy(t,e,i,a)}(t,u,u.items[0].items[0]),l=function(t,n){return t.items.forEach((function(t){return n.union(t.bounds)})),n.x1=t.padding,n.y1=t.padding,n}(u,l),e=2*u.padding,r=2*u.padding,l.empty()||(e=Math.ceil(l.width()+e),r=Math.ceil(l.height()+r)),"symbol"===o.type&&(i=u.items[0].items[0].items[0].items,a=i.reduce((function(t,n){return t[n.column]=Math.max(n.bounds.x2-n.x,t[n.column]||0),t}),{}),i.forEach((function(t){t.width=a[t.column],t.height=t.bounds.y2-t.y}))),"none"!==s&&(u.x=c=0,u.y=f=0),u.width=e,u.height=r,yf(l.set(c,f,c+e,f+r),u),u.mark.bounds.clear().union(l),u}function By(t,n,e,r,i,a,u){var o="symbol"!==t.datum.type,s=e.datum.vgrad,l=(!o||!a&&s||u?n:n.items[0]).bounds[i?"y2":"x2"]-t.padding,c=s&&a?l:0,f=s&&a?0:l,h=i<=0?0:$h(e);return Math.round("start"===r?c:r===Qs?f-h:.5*(l-h))}function Oy(t,n,e,r){n.x+=e,n.y+=r,n.bounds.translate(e,r),n.mark.bounds.translate(e,r),t.dirty(n)}function zy(t){_u.call(this,null,t)}xt(zy,_u).transform=function(t,n){var e=n.dataflow;return t.mark.items.forEach((function(n){t.layout&&My(e,n,t.layout),function(t,n,e){var r,i,a,u,o,s=n.items,l=Math.max(0,n.width||0),c=Math.max(0,n.height||0),f=(new sf).set(0,0,l,c),h=f.clone(),d=f.clone(),p=[];for(u=0,o=s.length;ue.cleanThreshold)&&e.runAfter(u.clean),r},xt(Ly,_u).transform=function(t,n){var e=n.fork(n.ADD_REM),r=t.mod||!1,i=t.encoders,a=n.encode;if(T(a)){if(!e.changed()&&!a.every((function(t){return i[t]})))return n.StopPropagation;a=a[0],e.encode=null}var u="enter"===a,o=i.update||D,s=i.enter||D,l=i.exit||D,c=(a&&!u?i[a]:o)||D;if(n.changed(n.ADD)&&(n.visit(n.ADD,(function(n){s(n,t),o(n,t)})),e.modifies(s.output),e.modifies(o.output),c!==D&&c!==o&&(n.visit(n.ADD,(function(n){c(n,t)})),e.modifies(c.output))),n.changed(n.REM)&&l!==D&&(n.visit(n.REM,(function(n){l(n,t)})),e.modifies(l.output)),u||c!==D){var f=n.MOD|(t.modified()?n.REFLOW:0);u?(n.visit(f,(function(n){var i=s(n,t)||r;(c(n,t)||i)&&e.mod.push(n)})),e.mod.length&&e.modifies(s.output)):n.visit(f,(function(n){(c(n,t)||r)&&e.mod.push(n)})),e.mod.length&&e.modifies(c.output)}return e.changed()?e:n.StopPropagation},xt(Uy,_u).transform=function(t,n){if(null!=this.value&&!t.modified())return n.StopPropagation;var e,r,i,a,u,o=n.dataflow.locale(),s=n.fork(n.NO_SOURCE|n.NO_FIELDS),l=this.value,c=t.type||"symbol",f=t.scale,h=+t.limit,d=Qg(f,null==t.count?5:t.count,t.minstep),p=!!t.values||"symbol"===c,v=t.format||um(o,f,d,c,t.formatSpecifier,t.formatType,p),g=t.values||am(f,d);return l&&(s.rem=l),"symbol"===c?(h&&g.length>h?(n.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=g.slice(0,h-1),u=!0):l=g,it(i=t.size)?(t.values||0!==f(l[0])||(l=l.slice(1)),a=l.reduce((function(n,e){return Math.max(n,i(e,t))}),0)):i=ct(a=i||8),l=l.map((function(n,e){return Jt({index:e,label:v(n,e,l),value:n,offset:a,size:i(n,t)})})),u&&(u=g[l.length],l.push(Jt({index:l.length,label:"…".concat(g.length-l.length," entries"),value:u,offset:a,size:i(u,t)})))):"gradient"===c?(e=f.domain(),r=$g(f,e[0],P(e)),g.length<3&&!t.values&&e[0]!==P(e)&&(g=[e[0],P(e)]),l=g.map((function(t,n){return Jt({index:n,label:v(t,n,g),value:t,perc:r(t)})}))):(i=g.length-1,r=function(t){var n=t.domain(),e=n.length-1,r=+n[0],i=+P(n),a=i-r;if("threshold"===t.type){var u=e?a/e:.1;a=(i+=u)-(r-=u)}return function(t){return(t-r)/a}}(f),l=g.map((function(t,n){return Jt({index:n,label:v(t,n,g),value:t,perc:n?r(t):0,perc2:n===i?1:r(g[n+1])})}))),s.source=l,s.add=l,this.value=l,s};var jy=yt({line:Gy,"line-radial":function(t,n,e,r){return Gy(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e))},arc:Vy,"arc-radial":function(t,n,e,r){return Vy(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e))},curve:Xy,"curve-radial":function(t,n,e,r){return Xy(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e))},"orthogonal-horizontal":function(t,n,e,r){return"M"+t+","+n+"V"+r+"H"+e},"orthogonal-vertical":function(t,n,e,r){return"M"+t+","+n+"H"+e+"V"+r},"orthogonal-radial":function(t,n,e,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(e),o=Math.sin(e),s=Math.abs(e-t)>Math.PI?e<=t:e>t;return"M"+n*i+","+n*a+"A"+n+","+n+" 0 0,"+(s?1:0)+" "+n*u+","+n*o+"L"+r*u+","+r*o},"diagonal-horizontal":function(t,n,e,r){var i=(t+e)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+e+","+r},"diagonal-vertical":function(t,n,e,r){var i=(n+r)/2;return"M"+t+","+n+"C"+t+","+i+" "+e+","+i+" "+e+","+r},"diagonal-radial":function(t,n,e,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(e),o=Math.sin(e),s=(n+r)/2;return"M"+n*i+","+n*a+"C"+s*i+","+s*a+" "+s*u+","+s*o+" "+r*u+","+r*o}});function Iy(t){return t.source.x}function $y(t){return t.source.y}function Hy(t){return t.target.x}function Wy(t){return t.target.y}function Yy(t){_u.call(this,{},t)}function Gy(t,n,e,r){return"M"+t+","+n+"L"+e+","+r}function Vy(t,n,e,r){var i=e-t,a=r-n,u=Math.sqrt(i*i+a*a)/2;return"M"+t+","+n+"A"+u+","+u+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+e+","+r}function Xy(t,n,e,r){var i=e-t,a=r-n,u=.2*(i+a),o=.2*(a-i);return"M"+t+","+n+"C"+(t+u)+","+(n+o)+" "+(e+o)+","+(r-u)+" "+e+","+r}function Jy(t){_u.call(this,null,t)}Yy.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},xt(Yy,_u).transform=function(t,n){var e=t.sourceX||Iy,r=t.sourceY||$y,i=t.targetX||Hy,a=t.targetY||Wy,u=t.as||"path",o=t.orient||"vertical",s=t.shape||"line",l=jy.get(s+"-"+o)||jy.get(s);return l||_("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),n.visit(n.SOURCE,(function(t){t[u]=l(e(t),r(t),i(t),a(t))})),n.reflow(t.modified()).modifies(u)},Jy.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},xt(Jy,_u).transform=function(t,n){var e,r,i,a=t.as||["startAngle","endAngle"],u=a[0],o=a[1],s=t.field||E,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=n.source,h=f.map(s),d=h.length,p=l,v=(c-l)/Me(h),g=fe(d);for(t.sort&&g.sort((function(t,n){return h[t]-h[n]})),e=0;e0?1:0)}),0))!==n.length&&e.warn("Log scale domain includes zero: "+zt(n)));return n}function n_(t,n,e){return it(t)&&(n||e)?Ug(t,e_(n||[0,1],e)):t}function e_(t,n){return n?t.slice().reverse():t}function r_(t){_u.call(this,null,t)}xt(Ky,_u).transform=function(t,n){var e=n.dataflow,r=this.value,i=function(t){var n,e=t.type,r="";if("sequential"===e)return"sequential-linear";(function(t){var n=t.type;return Og(n)&&n!==Id&&n!==$d&&(t.scheme||t.range&&t.range.length&&t.range.every(Et))})(t)&&(n=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0,r=2===n?"sequential-":3===n?"diverging-":"");return(r+e||"linear").toLowerCase()}(t);for(i in r&&i===r.type||(this.value=r=Sg(i)()),t)if(!Qy[i]){if("padding"===i&&Zy(r.type))continue;it(r[i])?r[i](t[i]):e.warn("Unsupported scale property: "+i)}return function(t,n,e){var r=t.type,i=n.round||!1,a=n.range;if(null!=n.rangeStep)a=function(t,n,e){"band"!==t&&"point"!==t&&_("Only band and point scales support rangeStep.");var r=(null!=n.paddingOuter?n.paddingOuter:n.padding)||0,i="point"===t?1:(null!=n.paddingInner?n.paddingInner:n.padding)||0;return[0,n.rangeStep*Ud(e,i,r)]}(r,n,e);else if(n.scheme&&(a=function(t,n,e){var r,i,a=n.schemeExtent;T(n.scheme)?i=jg(n.scheme,n.interpolate,n.interpolateGamma):(r=n.scheme.toLowerCase(),(i=Vg(r))||_("Unrecognized scheme name: ".concat(n.scheme)));return e="threshold"===t?e+1:"bin-ordinal"===t?e-1:"quantile"===t||"quantize"===t?+n.schemeCount||5:e,Pg(t)?n_(i,a,n.reverse):it(i)?Ig(n_(i,a),e):"ordinal"===t?i:i.slice(0,e)}(r,n,e),it(a))){if(t.interpolator)return t.interpolator(a);_("Scale type ".concat(r," does not support interpolating color schemes."))}if(a&&Pg(r))return t.interpolator(jg(e_(a,n.reverse),n.interpolate,n.interpolateGamma));a&&n.interpolate&&t.interpolate?t.interpolate(Hg(n.interpolate,n.interpolateGamma)):it(t.round)?t.round(i):it(t.rangeRound)&&t.interpolate(i?yv:mv);a&&t.range(e_(a,n.reverse))}(r,t,function(t,n,e){var r=n.bins;if(r&&!T(r)){var i=t.domain(),a=i[0],u=P(i),o=null==r.start?a:r.start,s=null==r.stop?u:r.stop,l=r.step;l||_("Scale bins parameter missing step property."),ou&&(s=l*Math.floor(u/l)),r=fe(o,s+l/2,l)}r?t.bins=r:t.bins&&delete t.bins;"bin-ordinal"===t.type&&(r?n.domain||n.domainRaw||(t.domain(r),e=r.length):t.bins=t.domain());return e}(r,t,function(t,n,e){var r=function(t,n,e){return n?(t.domain(t_(t.type,n,e)),n.length):-1}(t,n.domainRaw,e);if(r>-1)return r;var i,a,u=n.domain,o=t.type,s=n.zero||void 0===n.zero&&function(t){var n=t.type;return!t.bins&&("linear"===n||"pow"===n||"sqrt"===n)}(t);if(!u)return 0;Zy(o)&&n.padding&&u[0]!==P(u)&&(u=function(t,n,e,r,i,a){var u=Math.abs(P(e)-e[0]),o=u/(u-2*r),s=t===jd?Z(n,null,o):"sqrt"===t?Q(n,null,o,.5):"pow"===t?Q(n,null,o,i||1):"symlog"===t?K(n,null,o,a||1):J(n,null,o);return(n=n.slice())[0]=s[0],n[n.length-1]=s[1],n}(o,u,n.range,n.padding,n.exponent,n.constant));if((s||null!=n.domainMin||null!=n.domainMax||null!=n.domainMid)&&(i=(u=u.slice()).length-1||1,s&&(u[0]>0&&(u[0]=0),u[i]<0&&(u[i]=0)),null!=n.domainMin&&(u[0]=n.domainMin),null!=n.domainMax&&(u[i]=n.domainMax),null!=n.domainMid)){var l=(a=n.domainMid)>u[i]?i+1:ah&&(h=f),e&&c.sort(e)}return d.max=h,d}(n.source,t.groupby,l,c),r=0,i=e.length,a=e.max;r=r,f_[l<<1].forEach(p);for(;++u=r,f_[s|l<<1].forEach(p);f_[l<<0].forEach(p);for(;++o=r,c=e[o*t]>=r,f_[l<<1|c<<2].forEach(p);++u=r,f=c,c=e[o*t+u+1]>=r,f_[s|l<<1|c<<2|f<<3].forEach(p);f_[l|c<<3].forEach(p)}u=-1,c=e[o*t]>=r,f_[c<<2].forEach(p);for(;++u=r,f_[c<<2|f<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+u,t[0][1]+o],s=[t[1][0]+u,t[1][1]+o],l=a(r),c=a(s);(n=d[l])?(e=h[c])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(s),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(s),d[n.end=c]=n):(n=h[c])?(e=d[l])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(s),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=l]=n):h[l]=d[c]={start:l,end:c,ring:[r,s]}}f_[c<<3].forEach(p)}(r,i,(function(t){e(t,r,i),function(t){var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];for(;++n0?u.push([t]):o.push(t)})),o.forEach((function(t){for(var n,e=0,r=u.length;e0&&u0&&o=0&&a>=0||_("invalid size"),t=i,n=a,r},r.smooth=function(t){return arguments.length?(e=t?u:c_,r):e===u},r}function d_(t,n){for(var e,r=-1,i=n.length;++rr!=d>r&&e<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function v_(t,n,e){var r,i,a,u;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],a=e[r],u=n[r],i<=a&&a<=u||u<=a&&a<=i)}function g_(t,n,e){return function(r){var i=dt(r),a=e?Math.min(i[0],0):i[0],u=i[1],o=u-a,s=n?me(a,u,t):o/(t+1);return fe(s,u,s)}}function m_(t){_u.call(this,null,t)}function y_(t,n,e,r,i){var a=t.x1||0,u=t.y1||0,o=n*e<0;function s(t){t.forEach(l)}function l(t){o&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-a)*n+r,t[1]=(t[1]-u)*e+i}return function(t){return t.coordinates.forEach(s),t}}function __(t,n,e){var r=t>=0?t:Uu(n,e);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function x_(t){return it(t)?t:ct(+t)}function b_(){var t=function(t){return t[0]},n=function(t){return t[1]},e=E,r=[-1,-1],i=960,a=500,u=2;function o(o,s){var l=__(r[0],o,t)>>u,c=__(r[1],o,n)>>u,f=l?l+2:0,h=c?c+2:0,d=2*f+(i>>u),p=2*h+(a>>u),v=new Float32Array(d*p),g=new Float32Array(d*p),m=v;o.forEach((function(r){var i=f+(+t(r)>>u),a=h+(+n(r)>>u);i>=0&&i=0&&a0&&c>0?(w_(d,p,v,g,l),k_(d,p,g,v,c),w_(d,p,v,g,l),k_(d,p,g,v,c),w_(d,p,v,g,l),k_(d,p,g,v,c)):l>0?(w_(d,p,v,g,l),w_(d,p,g,v,l),w_(d,p,v,g,l),m=g):c>0&&(k_(d,p,v,g,c),k_(d,p,g,v,c),k_(d,p,v,g,c),m=g);for(var y=s?Math.pow(2,-2*u):1/Me(m),_=0,x=d*p;_>u),y2:h+(a>>u)}}return o.x=function(n){return arguments.length?(t=x_(n),o):t},o.y=function(t){return arguments.length?(n=x_(t),o):n},o.weight=function(t){return arguments.length?(e=x_(t),o):e},o.size=function(t){if(!arguments.length)return[i,a];var n=+t[0],e=+t[1];return n>=0&&e>=0||_("invalid size"),i=n,a=e,o},o.cellSize=function(t){return arguments.length?((t=+t)>=1||_("invalid cell size"),u=Math.floor(Math.log(t)/Math.LN2),o):1<=i&&(o>=a&&(s-=e[o-a+u*t]),r[o-i+u*t]=s/Math.min(o+1,t-1+a-o,a))}function k_(t,n,e,r,i){for(var a=1+(i<<1),u=0;u=i&&(o>=a&&(s-=e[u+(o-a)*t]),r[u+(o-i)*t]=s/Math.min(o+1,n-1+a-o,a))}function A_(t){_u.call(this,null,t)}m_.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},xt(m_,_u).transform=function(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=n.materialize(n.SOURCE).source,i=t.field||A,a=h_().smooth(!1!==t.smooth),u=t.thresholds||function(t,n,e){var r=g_(e.levels||10,e.nice,!1!==e.zero);return"shared"!==e.resolve?r:r(t.map((function(t){return ye(n(t).values)})))}(r,i,t),o=null===t.as?null:t.as||"contour",s=[];return r.forEach((function(n){var e=i(n),r=a.size([e.width,e.height])(e.values,T(u)?u:u(e.values));!function(t,n,e,r){var i=r.scale||n.scale,a=r.translate||n.translate;it(i)&&(i=i(e,r));it(a)&&(a=a(e,r));if((1===i||null==i)&&!a)return;var u=(At(i)?i:i[0])||1,o=(At(i)?i:i[1])||1,s=a&&a[0]||0,l=a&&a[1]||0;t.forEach(y_(n,u,o,s,l))}(r,e,n,t),r.forEach((function(t){s.push(Qt(n,Jt(null!=o?_defineProperty({},o,t):t)))}))})),this.value&&(e.rem=this.value),this.value=e.source=e.add=s,e},A_.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};var M_=xt(A_,_u),E_=["x","y","weight","size","cellSize","bandwidth"];function C_(t,n){return E_.forEach((function(e){return null!=n[e]?t[e](n[e]):0})),t}function D_(t){_u.call(this,null,t)}M_.transform=function(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=function(t,n){var e,r,i,a,u,o,s=[],l=function(t){return t(a)};if(null==n)s.push(t);else for(e={},r=0,i=t.length;r0?1:t<0?-1:0},J_=Math.sqrt,Z_=Math.tan;function Q_(t){return t>1?0:t<-1?z_:Math.acos(t)}function K_(t){return t>1?R_:t<-1?-R_:Math.asin(t)}function tx(){}function nx(t,n){t&&rx.hasOwnProperty(t.type)&&rx[t.type](t,n)}var ex={Feature:function(t,n){nx(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r=0?1:-1,i=r*e,a=$_(n=(n*=L_)/2+N_),u=V_(n),o=fx*u,s=cx*a+o*$_(i),l=o*r*V_(i);hx.add(I_(l,s)),lx=t,cx=a,fx=u}function _x(t){return[I_(t[1],t[0]),K_(t[2])]}function xx(t){var n=t[0],e=t[1],r=$_(e);return[r*$_(n),r*V_(n),V_(e)]}function bx(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function wx(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function kx(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Ax(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Mx(t){var n=J_(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Ex,Cx,Dx,Fx,Sx,Tx,Bx,Ox,zx,Rx,Nx,Px,qx,Lx,Ux,jx,Ix,$x,Hx,Wx,Yx,Gx,Vx,Xx,Jx,Zx,Qx=S_(),Kx={point:tb,lineStart:eb,lineEnd:rb,polygonStart:function(){Kx.point=ib,Kx.lineStart=ab,Kx.lineEnd=ub,Qx.reset(),px.polygonStart()},polygonEnd:function(){px.polygonEnd(),Kx.point=tb,Kx.lineStart=eb,Kx.lineEnd=rb,hx<0?(Ex=-(Dx=180),Cx=-(Fx=90)):Qx>1e-6?Fx=90:Qx<-1e-6&&(Cx=-90),Rx[0]=Ex,Rx[1]=Dx},sphere:function(){Ex=-(Dx=180),Cx=-(Fx=90)}};function tb(t,n){zx.push(Rx=[Ex=t,Dx=t]),nFx&&(Fx=n)}function nb(t,n){var e=xx([t*L_,n*L_]);if(Ox){var r=wx(Ox,e),i=wx([r[1],-r[0],0],r);Mx(i),i=_x(i);var a,u=t-Sx,o=u>0?1:-1,s=i[0]*q_*o,l=U_(u)>180;l^(o*SxFx&&(Fx=a):l^(o*Sx<(s=(s+360)%360-180)&&sFx&&(Fx=n)),l?tob(Ex,Dx)&&(Dx=t):ob(t,Dx)>ob(Ex,Dx)&&(Ex=t):Dx>=Ex?(tDx&&(Dx=t)):t>Sx?ob(Ex,t)>ob(Ex,Dx)&&(Dx=t):ob(t,Dx)>ob(Ex,Dx)&&(Ex=t)}else zx.push(Rx=[Ex=t,Dx=t]);nFx&&(Fx=n),Ox=e,Sx=t}function eb(){Kx.point=nb}function rb(){Rx[0]=Ex,Rx[1]=Dx,Kx.point=tb,Ox=null}function ib(t,n){if(Ox){var e=t-Sx;Qx.add(U_(e)>180?e+(e>0?360:-360):e)}else Tx=t,Bx=n;px.point(t,n),nb(t,n)}function ab(){px.lineStart()}function ub(){ib(Tx,Bx),px.lineEnd(),U_(Qx)>1e-6&&(Ex=-(Dx=180)),Rx[0]=Ex,Rx[1]=Dx,Ox=null}function ob(t,n){return(n-=t)<0?n+360:n}function sb(t,n){return t[0]-n[0]}function lb(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nz_?t+Math.round(-t/P_)*P_:t,n]}function kb(t,n,e){return(t%=P_)?n||e?bb(Mb(t),Eb(n,e)):Mb(t):n||e?Eb(n,e):wb}function Ab(t){return function(n,e){return[(n+=t)>z_?n-P_:n<-z_?n+P_:n,e]}}function Mb(t){var n=Ab(t);return n.invert=Ab(-t),n}function Eb(t,n){var e=$_(t),r=V_(t),i=$_(n),a=V_(n);function u(t,n){var u=$_(n),o=$_(t)*u,s=V_(t)*u,l=V_(n),c=l*e+o*r;return[I_(s*i-c*a,o*e-l*r),K_(c*i+s*a)]}return u.invert=function(t,n){var u=$_(n),o=$_(t)*u,s=V_(t)*u,l=V_(n),c=l*i-s*a;return[I_(s*i+l*a,o*e+c*r),K_(c*e-o*r)]},u}function Cb(t,n){(n=xx(n))[0]-=t,Mx(n);var e=Q_(-n[1]);return((-n[2]<0?-e:e)+P_-1e-6)%P_}function Db(){var t,n=[];return{point:function(n,e,r){t.push([n,e,r])},lineStart:function(){n.push(t=[])},lineEnd:tx,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Fb(t,n){return U_(t[0]-n[0])<1e-6&&U_(t[1]-n[1])<1e-6}function Sb(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Tb(t,n,e,r,i){var a,u,o=[],s=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],u=t[n];if(Fb(r,u)){if(!r[2]&&!u[2]){for(i.lineStart(),a=0;a=0;--a)i.point((c=l[a])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function Bb(t){if(n=t.length){for(var n,e,r=0,i=t[0];++rn?1:t>=n?0:NaN}!function(t){var n;1===t.length&&(n=t,t=function(t,e){return Rb(n(t),e)})}(Rb);function Nb(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),a=new Array(i);++r=0;)for(n=(r=t[i]).length;--n>=0;)e[--u]=r[n];return e}function qb(t,n,e,r){return function(i){var a,u,o,s=n(i),l=Db(),c=n(l),f=!1,h={point:d,lineStart:v,lineEnd:g,polygonStart:function(){h.point=m,h.lineStart=y,h.lineEnd=_,u=[],a=[]},polygonEnd:function(){h.point=d,h.lineStart=v,h.lineEnd=g,u=Pb(u);var t=function(t,n){var e=zb(n),r=n[1],i=V_(r),a=[V_(e),-$_(e),0],u=0,o=0;Ob.reset(),1===i?r=R_+1e-6:-1===i&&(r=-R_-1e-6);for(var s=0,l=t.length;s=0?1:-1,M=A*k,E=M>z_,C=v*b;if(Ob.add(I_(C*A*V_(M),g*w+C*$_(M))),u+=E?k+A*P_:k,E^d>=e^_>=e){var D=wx(xx(h),xx(y));Mx(D);var F=wx(a,D);Mx(F);var S=(E^k>=0?-1:1)*K_(F[2]);(r>S||r===S&&(D[0]||D[1]))&&(o+=E^k>=0?1:-1)}}return(u<-1e-6||u<1e-6&&Ob<-1e-6)^1&o}(a,r);u.length?(f||(i.polygonStart(),f=!0),Tb(u,Ub,t,e,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),u=a=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(n,e){t(n,e)&&i.point(n,e)}function p(t,n){s.point(t,n)}function v(){h.point=p,s.lineStart()}function g(){h.point=d,s.lineEnd()}function m(t,n){o.push([t,n]),c.point(t,n)}function y(){c.lineStart(),o=[]}function _(){m(o[0][0],o[0][1]),c.lineEnd();var t,n,e,r,s=c.clean(),h=l.result(),d=h.length;if(o.pop(),a.push(o),o=null,d)if(1&s){if((n=(e=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t1&&2&s&&h.push(h.pop().concat(h.shift())),u.push(h.filter(Lb))}return h}}function Lb(t){return t.length>1}function Ub(t,n){return((t=t.x)[0]<0?t[1]-R_-1e-6:R_-t[1])-((n=n.x)[0]<0?n[1]-R_-1e-6:R_-n[1])}var jb=qb((function(){return!0}),(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(a,u){var o=a>0?z_:-z_,s=U_(a-e);U_(s-z_)<1e-6?(t.point(e,r=(r+u)/2>0?R_:-R_),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),t.point(a,r),n=0):i!==o&&s>=z_&&(U_(e-i)<1e-6&&(e-=1e-6*i),U_(a-o)<1e-6&&(a-=1e-6*o),r=function(t,n,e,r){var i,a,u=V_(t-e);return U_(u)>1e-6?j_((V_(n)*(a=$_(r))*V_(e)-V_(r)*(i=$_(n))*V_(t))/(i*a*u)):(n+r)/2}(e,r,a,u),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),n=0),t.point(e=a,r=u),i=o},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)i=e*R_,r.point(-z_,i),r.point(0,i),r.point(z_,i),r.point(z_,0),r.point(z_,-i),r.point(0,-i),r.point(-z_,-i),r.point(-z_,0),r.point(-z_,i);else if(U_(t[0]-n[0])>1e-6){var a=t[0]0,i=U_(n)>1e-6;function a(t,e){return $_(t)*$_(e)>n}function u(t,e,r){var i=[1,0,0],a=wx(xx(t),xx(e)),u=bx(a,a),o=a[0],s=u-o*o;if(!s)return!r&&t;var l=n*u/s,c=-n*o/s,f=wx(i,a),h=Ax(i,l);kx(h,Ax(a,c));var d=f,p=bx(h,d),v=bx(d,d),g=p*p-v*(bx(h,h)-1);if(!(g<0)){var m=J_(g),y=Ax(d,(-p-m)/v);if(kx(y,h),y=_x(y),!r)return y;var _,x=t[0],b=e[0],w=t[1],k=e[1];b0^y[1]<(U_(y[0]-x)<1e-6?w:k):w<=y[1]&&y[1]<=k:A>z_^(x<=y[0]&&y[0]<=b)){var E=Ax(d,(-p+m)/v);return kx(E,h),[y,_x(E)]}}}function o(n,e){var i=r?t:z_-t,a=0;return n<-i?a|=1:n>i&&(a|=2),e<-i?a|=4:e>i&&(a|=8),a}return qb(a,(function(t){var n,e,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var d,p=[f,h],v=a(f,h),g=r?v?0:o(f,h):v?o(f+(f<0?z_:-z_),h):0;if(!n&&(l=s=v)&&t.lineStart(),v!==s&&(!(d=u(n,p))||Fb(n,d)||Fb(p,d))&&(p[2]=1),v!==s)c=0,v?(t.lineStart(),d=u(p,n),t.point(d[0],d[1])):(d=u(n,p),t.point(d[0],d[1],2),t.lineEnd()),n=d;else if(i&&n&&r^v){var m;g&e||!(m=u(p,n,!0))||(c=0,r?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1],3)))}!v||n&&Fb(n,p)||t.point(p[0],p[1]),n=p,s=v,e=g},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return c|(l&&s)<<1}}}),(function(n,r,i,a){!function(t,n,e,r,i,a){if(e){var u=$_(n),o=V_(n),s=r*e;null==i?(i=n+r*P_,a=n-s/2):(i=Cb(u,i),a=Cb(u,a),(r>0?ia)&&(i+=r*P_));for(var l,c=i;r>0?c>a:c0)do{l.point(0===c||3===c?t:e,c>1?r:n)}while((c=(c+o+4)%4)!==f);else l.point(a[0],a[1])}function u(r,i){return U_(r[0]-t)<1e-6?i>0?0:3:U_(r[0]-e)<1e-6?i>0?2:1:U_(r[1]-n)<1e-6?i>0?1:0:i>0?3:2}function o(t,n){return s(t.x,n.x)}function s(t,n){var e=u(t,1),r=u(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(u){var s,l,c,f,h,d,p,v,g,m,y,_=u,x=Db(),b={point:w,lineStart:function(){b.point=k,l&&l.push(c=[]);m=!0,g=!1,p=v=NaN},lineEnd:function(){s&&(k(f,h),d&&g&&x.rejoin(),s.push(x.result()));b.point=w,g&&_.lineEnd()},polygonStart:function(){_=x,s=[],l=[],y=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=l.length;er&&(h-a)*(r-u)>(d-u)*(t-a)&&++n:d<=r&&(h-a)*(r-u)<(d-u)*(t-a)&&--n;return n}(),e=y&&n,i=(s=Pb(s)).length;(e||i)&&(u.polygonStart(),e&&(u.lineStart(),a(null,null,1,u),u.lineEnd()),i&&Tb(s,o,n,a,u),u.polygonEnd());_=u,s=l=c=null}};function w(t,n){i(t,n)&&_.point(t,n)}function k(a,u){var o=i(a,u);if(l&&c.push([a,u]),m)f=a,h=u,d=o,m=!1,o&&(_.lineStart(),_.point(a,u));else if(o&&g)_.point(a,u);else{var s=[p=Math.max(-1e9,Math.min(1e9,p)),v=Math.max(-1e9,Math.min(1e9,v))],x=[a=Math.max(-1e9,Math.min(1e9,a)),u=Math.max(-1e9,Math.min(1e9,u))];!function(t,n,e,r,i,a){var u,o=t[0],s=t[1],l=0,c=1,f=n[0]-o,h=n[1]-s;if(u=e-o,f||!(u>0)){if(u/=f,f<0){if(u0){if(u>c)return;u>l&&(l=u)}if(u=i-o,f||!(u<0)){if(u/=f,f<0){if(u>c)return;u>l&&(l=u)}else if(f>0){if(u0)){if(u/=h,h<0){if(u0){if(u>c)return;u>l&&(l=u)}if(u=a-s,h||!(u<0)){if(u/=h,h<0){if(u>c)return;u>l&&(l=u)}else if(h>0){if(u0&&(t[0]=o+l*f,t[1]=s+l*h),c<1&&(n[0]=o+c*f,n[1]=s+c*h),!0}}}}}(s,x,t,n,e,r)?o&&(_.lineStart(),_.point(a,u),y=!1):(g||(_.lineStart(),_.point(s[0],s[1])),_.point(x[0],x[1]),o||_.lineEnd(),y=!1)}p=a,v=u,g=o}return b}}function Hb(t,n,e){var r=Nb(t,n-1e-6,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function Wb(t,n,e){var r=Nb(t,n-1e-6,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}function Yb(t){return t}var Gb,Vb,Xb,Jb,Zb=S_(),Qb=S_(),Kb={point:tx,lineStart:tx,lineEnd:tx,polygonStart:function(){Kb.lineStart=tw,Kb.lineEnd=rw},polygonEnd:function(){Kb.lineStart=Kb.lineEnd=Kb.point=tx,Zb.add(U_(Qb)),Qb.reset()},result:function(){var t=Zb/2;return Zb.reset(),t}};function tw(){Kb.point=nw}function nw(t,n){Kb.point=ew,Gb=Xb=t,Vb=Jb=n}function ew(t,n){Qb.add(Jb*t-Xb*n),Xb=t,Jb=n}function rw(){ew(Gb,Vb)}var iw=1/0,aw=iw,uw=-iw,ow=uw,sw={point:function(t,n){tuw&&(uw=t);now&&(ow=n)},lineStart:tx,lineEnd:tx,polygonStart:tx,polygonEnd:tx,result:function(){var t=[[iw,aw],[uw,ow]];return uw=ow=-(aw=iw=1/0),t}};var lw,cw,fw,hw,dw=0,pw=0,vw=0,gw=0,mw=0,yw=0,_w=0,xw=0,bw=0,ww={point:kw,lineStart:Aw,lineEnd:Cw,polygonStart:function(){ww.lineStart=Dw,ww.lineEnd=Fw},polygonEnd:function(){ww.point=kw,ww.lineStart=Aw,ww.lineEnd=Cw},result:function(){var t=bw?[_w/bw,xw/bw]:yw?[gw/yw,mw/yw]:vw?[dw/vw,pw/vw]:[NaN,NaN];return dw=pw=vw=gw=mw=yw=_w=xw=bw=0,t}};function kw(t,n){dw+=t,pw+=n,++vw}function Aw(){ww.point=Mw}function Mw(t,n){ww.point=Ew,kw(fw=t,hw=n)}function Ew(t,n){var e=t-fw,r=n-hw,i=J_(e*e+r*r);gw+=i*(fw+t)/2,mw+=i*(hw+n)/2,yw+=i,kw(fw=t,hw=n)}function Cw(){ww.point=kw}function Dw(){ww.point=Sw}function Fw(){Tw(lw,cw)}function Sw(t,n){ww.point=Tw,kw(lw=fw=t,cw=hw=n)}function Tw(t,n){var e=t-fw,r=n-hw,i=J_(e*e+r*r);gw+=i*(fw+t)/2,mw+=i*(hw+n)/2,yw+=i,_w+=(i=hw*t-fw*n)*(fw+t),xw+=i*(hw+n),bw+=3*i,kw(fw=t,hw=n)}function Bw(t){this._context=t}Bw.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,P_)}},result:tx};var Ow,zw,Rw,Nw,Pw,qw=S_(),Lw={point:tx,lineStart:function(){Lw.point=Uw},lineEnd:function(){Ow&&jw(zw,Rw),Lw.point=tx},polygonStart:function(){Ow=!0},polygonEnd:function(){Ow=null},result:function(){var t=+qw;return qw.reset(),t}};function Uw(t,n){Lw.point=jw,zw=Nw=t,Rw=Pw=n}function jw(t,n){Nw-=t,Pw-=n,qw.add(J_(Nw*Nw+Pw*Pw)),Nw=t,Pw=n}function Iw(){this._string=[]}function $w(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Hw(t,n){var e,r,i=4.5;function a(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),ux(t,e(r))),r.result()}return a.area=function(t){return ux(t,e(Kb)),Kb.result()},a.measure=function(t){return ux(t,e(Lw)),Lw.result()},a.bounds=function(t){return ux(t,e(sw)),sw.result()},a.centroid=function(t){return ux(t,e(ww)),ww.result()},a.projection=function(n){return arguments.length?(e=null==n?(t=null,Yb):(t=n).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(n=null,new Iw):new Bw(n=t),"function"!=typeof i&&r.pointRadius(i),a):n},a.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),a):i},a.projection(t).context(n)}function Ww(t){return function(n){var e=new Yw;for(var r in t)e[r]=t[r];return e.stream=n,e}}function Yw(){}function Gw(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),ux(e,t.stream(sw)),n(sw.result()),null!=r&&t.clipExtent(r),t}function Vw(t,n,e){return Gw(t,(function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],a=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),u=+n[0][0]+(r-a*(e[1][0]+e[0][0]))/2,o=+n[0][1]+(i-a*(e[1][1]+e[0][1]))/2;t.scale(150*a).translate([u,o])}),e)}function Xw(t,n,e){return Vw(t,[[0,0],n],e)}function Jw(t,n,e){return Gw(t,(function(e){var r=+n,i=r/(e[1][0]-e[0][0]),a=(r-i*(e[1][0]+e[0][0]))/2,u=-i*e[0][1];t.scale(150*i).translate([a,u])}),e)}function Zw(t,n,e){return Gw(t,(function(e){var r=+n,i=r/(e[1][1]-e[0][1]),a=-i*e[0][0],u=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([a,u])}),e)}Iw.prototype={_radius:4.5,_circle:$w(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=$w(this._radius)),this._string.push("M",t,",",n,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Yw.prototype={constructor:Yw,point:function(t,n){this.stream.point(t,n)},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()}};var Qw=$_(30*L_);function Kw(t,n){return+n?function(t,n){function e(r,i,a,u,o,s,l,c,f,h,d,p,v,g){var m=l-r,y=c-i,_=m*m+y*y;if(_>4*n&&v--){var x=u+h,b=o+d,w=s+p,k=J_(x*x+b*b+w*w),A=K_(w/=k),M=U_(U_(w)-1)<1e-6||U_(a-f)<1e-6?(a+f)/2:I_(b,x),E=t(M,A),C=E[0],D=E[1],F=C-r,S=D-i,T=y*F-m*S;(T*T/_>n||U_((m*F+y*S)/_-.5)>.3||u*h+o*d+s*p2?t[2]%360*L_:0,F()):[g*q_,m*q_,y*q_]},C.angle=function(t){return arguments.length?(_=t%360*L_,F()):_*q_},C.reflectX=function(t){return arguments.length?(x=t?-1:1,F()):x<0},C.reflectY=function(t){return arguments.length?(b=t?-1:1,F()):b<0},C.precision=function(t){return arguments.length?(u=Kw(o,E=t*t),S()):J_(E)},C.fitExtent=function(t,n){return Vw(C,t,n)},C.fitSize=function(t,n){return Xw(C,t,n)},C.fitWidth=function(t,n){return Jw(C,t,n)},C.fitHeight=function(t,n){return Zw(C,t,n)},function(){return n=t.apply(this,arguments),C.invert=n.invert&&D,F()}}function ak(t){var n=0,e=z_/3,r=ik(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*L_,e=t[1]*L_):[n*q_,e*q_]},i}function uk(t,n){var e=V_(t),r=(e+V_(n))/2;if(U_(r)<1e-6)return function(t){var n=$_(t);function e(t,e){return[t*n,V_(e)/n]}return e.invert=function(t,e){return[t/n,K_(e*n)]},e}(t);var i=1+e*(2*r-e),a=J_(i)/r;function u(t,n){var e=J_(i-2*r*V_(n))/r;return[e*V_(t*=r),a-e*$_(t)]}return u.invert=function(t,n){var e=a-n,u=I_(t,U_(e))*X_(e);return e*r<0&&(u-=z_*X_(t)*X_(e)),[u/r,K_((i-(t*t+e*e)*r*r)/(2*r))]},u}function ok(){return ak(uk).scale(155.424).center([0,33.6442])}function sk(){return ok().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function lk(t){return function(n,e){var r=$_(n),i=$_(e),a=t(r*i);return[a*i*V_(n),a*V_(e)]}}function ck(t){return function(n,e){var r=J_(n*n+e*e),i=t(r),a=V_(i),u=$_(i);return[I_(n*a,r*u),K_(r&&e*a/r)]}}var fk=lk((function(t){return J_(2/(1+t))}));fk.invert=ck((function(t){return 2*K_(t/2)}));var hk=lk((function(t){return(t=Q_(t))&&t/V_(t)}));function dk(t,n){return[t,Y_(Z_((R_+n)/2))]}function pk(t){var n,e,r,i=rk(t),a=i.center,u=i.scale,o=i.translate,s=i.clipExtent,l=null;function c(){var a=z_*u(),o=i(function(t){function n(n){return(n=t(n[0]*L_,n[1]*L_))[0]*=q_,n[1]*=q_,n}return t=kb(t[0]*L_,t[1]*L_,t.length>2?t[2]*L_:0),n.invert=function(n){return(n=t.invert(n[0]*L_,n[1]*L_))[0]*=q_,n[1]*=q_,n},n}(i.rotate()).invert([0,0]));return s(null==l?[[o[0]-a,o[1]-a],[o[0]+a,o[1]+a]]:t===dk?[[Math.max(o[0]-a,l),n],[Math.min(o[0]+a,e),r]]:[[l,Math.max(o[1]-a,n)],[e,Math.min(o[1]+a,r)]])}return i.scale=function(t){return arguments.length?(u(t),c()):u()},i.translate=function(t){return arguments.length?(o(t),c()):o()},i.center=function(t){return arguments.length?(a(t),c()):a()},i.clipExtent=function(t){return arguments.length?(null==t?l=n=e=r=null:(l=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,n],[e,r]]},c()}function vk(t){return Z_((R_+t)/2)}function gk(t,n){var e=$_(t),r=t===n?V_(t):Y_(e/$_(n))/Y_(vk(n)/vk(t)),i=e*G_(vk(t),r)/r;if(!r)return dk;function a(t,n){i>0?n<1e-6-R_&&(n=1e-6-R_):n>R_-1e-6&&(n=R_-1e-6);var e=i/G_(vk(n),r);return[e*V_(r*t),i-e*$_(r*t)]}return a.invert=function(t,n){var e=i-n,a=X_(r)*J_(t*t+e*e),u=I_(t,U_(e))*X_(e);return e*r<0&&(u-=z_*X_(t)*X_(e)),[u/r,2*j_(G_(i/a,1/r))-R_]},a}function mk(t,n){return[t,n]}function yk(t,n){var e=$_(t),r=t===n?V_(t):(e-$_(n))/(n-t),i=e/r+t;if(U_(r)<1e-6)return mk;function a(t,n){var e=i-n,a=r*t;return[e*V_(a),i-e*$_(a)]}return a.invert=function(t,n){var e=i-n,a=I_(t,U_(e))*X_(e);return e*r<0&&(a-=z_*X_(t)*X_(e)),[a/r,i-X_(r)*J_(t*t+e*e)]},a}hk.invert=ck((function(t){return t})),dk.invert=function(t,n){return[t,2*j_(W_(n))-R_]},mk.invert=mk;var _k=1.340264,xk=-.081106,bk=893e-6,wk=.003796,kk=J_(3)/2;function Ak(t,n){var e=K_(kk*V_(n)),r=e*e,i=r*r*r;return[t*$_(e)/(kk*(_k+3*xk*r+i*(7*bk+9*wk*r))),e*(_k+xk*r+i*(bk+wk*r))]}function Mk(t,n){var e=$_(n),r=$_(t)*e;return[e*V_(t)/r,V_(n)/r]}function Ek(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function Ck(t,n){return[$_(n)*V_(t),V_(n)]}function Dk(t,n){var e=$_(n),r=1+$_(t)*e;return[e*V_(t)/r,V_(n)/r]}function Fk(t,n){return[Y_(Z_((R_+n)/2)),-t]}Ak.invert=function(t,n){for(var e,r=n,i=r*r,a=i*i*i,u=0;u<12&&(a=(i=(r-=e=(r*(_k+xk*i+a*(bk+wk*i))-n)/(_k+3*xk*i+a*(7*bk+9*wk*i)))*r)*i*i,!(U_(e)<1e-12));++u);return[kk*t*(_k+3*xk*i+a*(7*bk+9*wk*i))/$_(r),K_(V_(r)/kk)]},Mk.invert=ck(j_),Ek.invert=function(t,n){var e,r=n,i=25;do{var a=r*r,u=a*a;r-=e=(r*(1.007226+a*(.015085+u*(.028874*a-.044475-.005916*u)))-n)/(1.007226+a*(.045255+u*(.259866*a-.311325-.005916*11*u)))}while(U_(e)>1e-6&&--i>0);return[t/(.8707+(a=r*r)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),r]},Ck.invert=ck(K_),Dk.invert=ck((function(t){return 2*j_(t)})),Fk.invert=function(t,n){return[-n,2*j_(W_(t))-R_]};var Sk=Math.abs,Tk=Math.cos,Bk=Math.sin,Ok=Math.PI,zk=Ok/2,Rk=function(t){return t>0?Math.sqrt(t):0}(2);function Nk(t){return t>1?zk:t<-1?-zk:Math.asin(t)}function Pk(t,n){var e,r=t*Bk(n),i=30;do{n-=e=(n+Bk(n)-r)/(1+Tk(n))}while(Sk(e)>1e-6&&--i>0);return n/2}var qk=function(t,n,e){function r(r,i){return[t*r*Tk(i=Pk(e,i)),n*Bk(i)]}return r.invert=function(r,i){return i=Nk(i/n),[r/(t*Tk(i)),Nk((2*i+Bk(2*i))/e)]},r}(Rk/zk,Rk,Ok);var Lk=Hw(),Uk=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function jk(t,n){return function e(){var r=n();return r.type=t,r.path=Hw().projection(r),r.copy=r.copy||function(){var t=e();return Uk.forEach((function(n){r[n]&&t[n](r[n]())})),t.path.pointRadius(r.path.pointRadius()),t},r}}function Ik(t,n){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(Hk[t]=jk(t,n),this):Hk[t]||null}function $k(t){return t&&t.path||Lk}var Hk={albers:sk,albersusa:function(){var t,n,e,r,i,a,u=sk(),o=ok().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=ok().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){a=[t,n]}};function c(t){var n=t[0],u=t[1];return a=null,e.point(n,u),a||(r.point(n,u),a)||(i.point(n,u),a)}function f(){return t=n=null,c}return c.invert=function(t){var n=u.scale(),e=u.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?o:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:u).invert(t)},c.stream=function(e){return t&&n===e?t:(r=[u.stream(n=e),o.stream(e),s.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)}};for(var Wk in Hk)Ik(Wk,Hk[Wk]);function Yk(t){_u.call(this,null,t)}function Gk(t){_u.call(this,null,t)}function Vk(t){_u.call(this,null,t)}function Xk(t){_u.call(this,[],t),this.generator=function(){var t,n,e,r,i,a,u,o,s,l,c,f,h=10,d=h,p=90,v=360,g=2.5;function m(){return{type:"MultiLineString",coordinates:y()}}function y(){return Nb(H_(r/p)*p,e,p).map(c).concat(Nb(H_(o/v)*v,u,v).map(f)).concat(Nb(H_(n/h)*h,t,h).filter((function(t){return U_(t%p)>1e-6})).map(s)).concat(Nb(H_(a/d)*d,i,d).filter((function(t){return U_(t%v)>1e-6})).map(l))}return m.lines=function(){return y().map((function(t){return{type:"LineString",coordinates:t}}))},m.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(u).slice(1),c(e).reverse().slice(1),f(o).reverse().slice(1))]}},m.extent=function(t){return arguments.length?m.extentMajor(t).extentMinor(t):m.extentMinor()},m.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),o>u&&(t=o,o=u,u=t),m.precision(g)):[[r,o],[e,u]]},m.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],a=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),a>i&&(e=a,a=i,i=e),m.precision(g)):[[n,a],[t,i]]},m.step=function(t){return arguments.length?m.stepMajor(t).stepMinor(t):m.stepMinor()},m.stepMajor=function(t){return arguments.length?(p=+t[0],v=+t[1],m):[p,v]},m.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],m):[h,d]},m.precision=function(h){return arguments.length?(g=+h,s=Hb(a,i,90),l=Wb(n,t,g),c=Hb(o,u,90),f=Wb(r,e,g),m):g},m.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function Jk(t){_u.call(this,null,t)}function Zk(t){if(!it(t))return!1;var n=Lt(v(t));return n.$x||n.$y||n.$value||n.$max}function Qk(t){_u.call(this,null,t),this.modified(!0)}function Kk(t,n,e){it(t[n])&&t[n](e)}Yk.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},xt(Yk,_u).transform=function(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||A,a=t.as||"path",u=e.SOURCE;!r||t.modified()?(this.value=r=$k(t.projection),e.materialize().reflow()):u=i===A||n.modified(i.fields)?e.ADD_MOD:e.ADD;var o=function(t,n){var e=t.pointRadius();t.context(null),null!=n&&t.pointRadius(n);return e}(r,t.pointRadius);return e.visit(u,(function(t){t[a]=r(i(t))})),r.pointRadius(o),e.modifies(a)},Gk.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},xt(Gk,_u).transform=function(t,n){var e,r=t.projection,i=t.fields[0],a=t.fields[1],u=t.as||["x","y"],o=u[0],s=u[1];function l(t){var n=r([i(t),a(t)]);n?(t[o]=n[0],t[s]=n[1]):(t[o]=void 0,t[s]=void 0)}return t.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,l):(e=n.modified(i.fields)||n.modified(a.fields),n.visit(e?n.ADD_MOD:n.ADD,l)),n.modifies(u)},Vk.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},xt(Vk,_u).transform=function(t,n){var e=n.fork(n.ALL),r=this.value,i=t.as||"shape",a=e.ADD;return r&&!t.modified()||(this.value=r=function(t,n,e){var r=null==e?function(e){return t(n(e))}:function(r){var i=t.pointRadius(),a=t.pointRadius(e)(n(r));return t.pointRadius(i),a};return r.context=function(n){return t.context(n),r},r}($k(t.projection),t.field||b("datum"),t.pointRadius),e.materialize().reflow(),a=e.SOURCE),e.visit(a,(function(t){t[i]=r})),e.modifies(i)},Xk.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},xt(Xk,_u).transform=function(t,n){var e,r=this.value,i=this.generator;if(!r.length||t.modified())for(var a in t)it(i[a])&&i[a](t[a]);return e=i(),r.length?n.mod.push(Kt(r[0],e)):n.add.push(Jt(e)),r[0]=e,n},Jk.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},xt(Jk,_u).transform=function(t,n){if(!n.changed()&&!t.modified())return n.StopPropagation;var e=n.materialize(n.SOURCE).source,r="shared"===t.resolve,i=t.field||A,a=function(t,n){var e;it(t)?(e=function(e){return t(e,n)}).dep=Zk(t):t?e=ct(t):(e=function(t){return t.$value/t.$max||0}).dep=!0;return e}(t.opacity,t),u=function(t,n){var e;it(t)?(e=function(e){return vp(t(e,n))}).dep=Zk(t):e=ct(vp(t||"#888"));return e}(t.color,t),o=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?ye(e.map((function(t){return ye(i(t).values)}))):0};return e.forEach((function(t){var n=i(t),e=ht({},t,s);r||(e.$max=ye(n.values||[])),t[o]=function(t,n,e,r){for(var i=t.width,a=t.height,u=t.x1||0,o=t.y1||0,s=t.x2||i,l=t.y2||a,c=t.values,f=c?function(t){return c[t]}:M,h=hf(s-u,l-o),d=h.getContext("2d"),p=d.getImageData(0,0,s-u,l-o),v=p.data,g=o,m=0;g=(a=(v+m)/2))?v=a:m=a,(c=e>=(u=(g+y)/2))?g=u:y=u,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(o=+t._x.call(null,d.data),s=+t._y.call(null,d.data),n===o&&e===s)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=n>=(a=(v+m)/2))?v=a:m=a,(c=e>=(u=(g+y)/2))?g=u:y=u}while((f=c<<1|l)==(h=(s>=u)<<1|o>=a));return i[h]=d,i[f]=p,t}function eA(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function rA(t){return t[0]}function iA(t){return t[1]}function aA(t,n,e){var r=new uA(null==n?rA:n,null==e?iA:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function uA(t,n,e,r,i,a){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function oA(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var sA=aA.prototype=uA.prototype;function lA(t){return function(){return t}}function cA(){return 1e-6*(Math.random()-.5)}function fA(t){return t.x+t.vx}function hA(t){return t.y+t.vy}function dA(t){return t.index}function pA(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}sA.copy=function(){var t,n,e=new uA(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=oA(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=oA(n));return e},sA.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return nA(this.cover(n,e),n,e,t)},sA.addAll=function(t){var n,e,r,i,a=t.length,u=new Array(a),o=new Array(a),s=1/0,l=1/0,c=-1/0,f=-1/0;for(e=0;ec&&(c=r),if&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),e=0;et||t>=i||r>n||n>=a;)switch(o=(nh||(a=s.y0)>d||(u=s.x1)=m)<<1|t>=g)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var y=t-+this._x.call(null,v.data),_=n-+this._y.call(null,v.data),x=y*y+_*_;if(x=(o=(p+g)/2))?p=o:g=o,(c=u>=(s=(v+m)/2))?v=s:m=s,n=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[f]=i:delete n[f],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},sA.removeAll=function(t){for(var n=0,e=t.length;n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function _A(t,n){for(var e,r=0,i=t.length;r0)for(var e,r,i=new Array(e),a=0;a=0&&n._call.call(null,t),n=n._next;--kA}()}finally{kA=0,function(){var t,n,e=bA,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:bA=n);wA=t,PA(r)}(),CA=0}}function NA(){var t=FA.now(),n=t-EA;n>1e3&&(DA-=n,EA=t)}function PA(t){kA||(AA&&(AA=clearTimeout(AA)),t-CA>24?(t<1/0&&(AA=setTimeout(RA,t-FA.now()-DA)),MA&&(MA=clearInterval(MA))):(MA||(EA=FA.now(),MA=setInterval(NA,1e3)),kA=1,SA(RA)))}function qA(t){return t.x}function LA(t){return t.y}OA.prototype=zA.prototype={constructor:OA,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?TA():+e)+(null==n?0:+n),this._next||wA===this||(wA?wA._next=this:bA=this,wA=this),this._call=t,this._time=e,PA()},stop:function(){this._call&&(this._call=null,this._time=1/0,PA())}};var UA=Math.PI*(3-Math.sqrt(5));var jA={center:function(t,n){var e;function r(){var r,i,a=e.length,u=0,o=0;for(r=0;rs+d||il+d||ao.index){var p=s-u.x-u.vx,v=l-u.y-u.vy,g=p*p+v*v;gt.r&&(t.r=t[n].r)}function o(){if(n){var r,i,a=n.length;for(e=new Array(a),r=0;r=u)){(t.data!==n||t.next)&&(0===c&&(d+=(c=cA())*c),0===f&&(d+=(f=cA())*f),d1?(null==e?o.delete(t):o.set(t,d(e)),n):o.get(t)},find:function(n,e,r){var i,a,u,o,s,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l1?(l.on(t,e),n):l.on(t)}}}(t),r=!1,i=e.stop,a=e.restart;return e.stopped=function(){return r},e.restart=function(){return r=!1,a()},e.stop=function(){return r=!0,i()},GA(e,n,!0).on("end",(function(){r=!0}))}(n.source,t),i.on("tick",(e=n.dataflow,r=this,function(){e.touch(r).run()})),t.static||(a=!0,i.tick()),n.modifies("index")),u||a||t.modified($A)||n.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/o)),t.static)for(i.stop();--o>=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return n.StopPropagation;return this.finish(t,n)},YA.finish=function(t,n){for(var e,r=n.dataflow,i=this._argops,a=0,u=i.length;a=0;)n+=e[r].value;else n=1;t.value=n}function rM(t,n){var e,r,i,a,u,o=new oM(t),s=+t.value&&(o.value=t.value),l=[o];for(null==n&&(n=iM);e=l.pop();)if(s&&(e.value=+e.data.value),(i=n(e.data))&&(u=i.length))for(e.children=new Array(u),a=u-1;a>=0;--a)l.push(r=e.children[a]=new oM(i[a])),r.parent=e,r.depth=e.depth+1;return o.eachBefore(uM)}function iM(t){return t.children}function aM(t){t.data=t.data.data}function uM(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function oM(t){this.data=t,this.depth=this.height=0,this.parent=null}oM.prototype=rM.prototype={constructor:oM,count:function(){return this.eachAfter(eM)},each:function(t){var n,e,r,i,a=this,u=[a];do{for(n=u.reverse(),u=[];a=n.pop();)if(t(a),e=a.children)for(r=0,i=e.length;r=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;t=e.pop(),n=r.pop();for(;t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each((function(n){t.push(n)})),t},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return rM(this).eachBefore(aM)}};var sM=Array.prototype.slice;function lM(t){for(var n,e,r=0,i=(t=function(t){for(var n,e,r=t.length;r;)e=Math.random()*r--|0,n=t[r],t[r]=t[e],t[e]=n;return t}(sM.call(t))).length,a=[];r0&&e*e>r*r+i*i}function dM(t,n){for(var e=0;e(u*=u)?(r=(l+u-i)/(2*l),a=Math.sqrt(Math.max(0,u/l-r*r)),e.x=t.x-r*o-a*s,e.y=t.y-r*s+a*o):(r=(l+i-u)/(2*l),a=Math.sqrt(Math.max(0,i/l-r*r)),e.x=n.x+r*o-a*s,e.y=n.y+r*s+a*o)):(e.x=n.x+e.r,e.y=n.y)}function yM(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function _M(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,a=(n.y*e.r+e.y*n.r)/r;return i*i+a*a}function xM(t){this._=t,this.next=null,this.previous=null}function bM(t){return null==t?null:wM(t)}function wM(t){if("function"!=typeof t)throw new Error;return t}function kM(){return 0}function AM(t){return function(){return t}}function MM(t){return Math.sqrt(t.value)}function EM(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function CM(t,n){return function(e){if(r=e.children){var r,i,a,u=r.length,o=t(e)*n||0;if(o)for(i=0;i1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;mM(e,n,r=t[2]),n=new xM(n),e=new xM(e),r=new xM(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(o=3;o0)throw new Error("cycle");return a}return e.id=function(n){return arguments.length?(t=wM(n),e):t},e.parentId=function(t){return arguments.length?(n=wM(t),e):n},e}function NM(t,n){return t.parent===n.parent?1:2}function PM(t){var n=t.children;return n?n[0]:t.t}function qM(t){var n=t.children;return n?n[n.length-1]:t.t}function LM(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function UM(t,n,e){return t.a.parent===n.parent?t.a:e}function jM(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function IM(t,n,e,r,i){for(var a,u=t.children,o=-1,s=u.length,l=t.value&&(i-e)/t.value;++oh&&(h=o),g=c*c*v,(d=Math.max(h/g,g/f))>p){c-=o;break}p=d}m.push(u={value:c,dice:s1?n:1)},e}($M);var YM=function t(n){function e(t,e,r,i,a){if((u=t._squarify)&&u.ratio===n)for(var u,o,s,l,c,f=-1,h=u.length,d=t.value;++f1?n:1)},e}($M);function GM(t){_u.call(this,null,t)}function VM(t){return t.values}function XM(){var t,n=[];return t={entries:function(t){return function t(e,r){if(++r>n.length)return e;var i,a=[];for(i in e)a.push({key:i,values:t(e[i],r)});return a}(function t(e,r){if(r>=n.length)return e;for(var i,a,u,o=-1,s=e.length,l=n[r++],c={},f={};++o=0;--i)o.push(e=n.children[i]=new jM(r[i],i)),e.parent=n;return(u.parent=new jM(null,0)).children=[u],u}(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(u),r)i.eachBefore(o);else{var l=i,c=i,f=i;i.eachBefore((function(t){t.xc.x&&(c=t),t.depth>f.depth&&(f=t)}));var h=l===c?1:t(l,c)/2,d=h-l.x,p=n/(c.x+h+d),v=e/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*v}))}return i}function a(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,a=i.length;--a>=0;)(n=i[a]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var a=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-a):n.z=a}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,a=n,u=n,o=e,s=a.parent.children[0],l=a.m,c=u.m,f=o.m,h=s.m;o=qM(o),a=PM(a),o&&a;)s=PM(s),(u=qM(u)).a=n,(i=o.z+f-a.z-l+t(o._,a._))>0&&(LM(UM(o,n,r),n,i),l+=i,c+=i),f+=o.m,l+=a.m,h+=s.m,c+=u.m;o&&!qM(u)&&(u.t=o,u.m+=f-c),a&&!PM(s)&&(s.t=a,s.m+=l-h,r=n)}return r}(n,i,n.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function o(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},cluster:function(){var t=KA,n=1,e=1,r=!1;function i(i){var a,u=0;i.eachAfter((function(n){var e=n.children;e?(n.x=function(t){return t.reduce(tM,0)/t.length}(e),n.y=function(t){return 1+t.reduce(nM,0)}(e)):(n.x=a?u+=t(n,a):0,n.y=0,a=n)}));var o=function(t){for(var n;n=t.children;)t=n[0];return t}(i),s=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),l=o.x-t(o,s)/2,c=s.x+t(s,o)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-l)/(c-l)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i}},uE=["x","y","depth","children"];function oE(t){JM.call(this,t)}oE.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:uE.length,default:uE}]};var sE=xt(oE,JM);function lE(t){_u.call(this,[],t)}sE.layout=function(t){var n=t||"tidy";if(gt(aE,n))return aE[n]();_("Unrecognized Tree layout method: "+n)},sE.params=["size","nodeSize"],sE.fields=uE,lE.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},xt(lE,_u).transform=function(t,n){var e=this.value,r=n.source&&n.source.root,i=n.fork(n.NO_SOURCE),a={};return r||_("TreeLinks transform requires a tree data source."),n.changed(n.ADD_REM)?(i.rem=e,n.visit(n.SOURCE,(function(t){a[Vt(t)]=1})),r.each((function(t){var n=t.data,e=t.parent&&t.parent.data;e&&a[Vt(n)]&&a[Vt(e)]&&i.add.push(Jt({source:e,target:n}))})),this.value=i.add):n.changed(n.MOD)&&(n.visit(n.MOD,(function(t){a[Vt(t)]=1})),e.forEach((function(t){(a[Vt(t.source)]||a[Vt(t.target)])&&i.mod.push(t)}))),i};var cE={binary:function(t,n,e,r,i){var a,u,o=t.children,s=o.length,l=new Array(s+1);for(l[0]=u=a=0;a=e-1){var c=o[n];return c.x0=i,c.y0=a,c.x1=u,void(c.y1=s)}var f=l[n],h=r/2+f,d=n+1,p=e-1;for(;d>>1;l[v]s-a){var y=(i*m+u*g)/r;t(n,d,g,i,a,y,s),t(d,e,m,y,a,u,s)}else{var _=(a*m+s*g)/r;t(n,d,g,i,a,u,_),t(d,e,m,i,_,u,s)}}(0,s,t.value,n,e,r,i)},dice:SM,slice:IM,slicedice:function(t,n,e,r,i){(1&t.depth?IM:SM)(t,n,e,r,i)},squarify:WM,resquarify:YM},fE=["x0","y0","x1","y1","depth","children"];function hE(t){JM.call(this,t)}hE.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:fE.length,default:fE}]};var dE=xt(hE,JM);dE.layout=function(){var t=function(){var t=WM,n=!1,e=1,r=1,i=[0],a=kM,u=kM,o=kM,s=kM,l=kM;function c(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(f),i=[0],n&&t.eachBefore(FM),t}function f(n){var e=i[n.depth],r=n.x0+e,c=n.y0+e,f=n.x1-e,h=n.y1-e;f>1;if(e>0&&"number"!=typeof n[0])throw new Error("Expected coords to contain numbers.");this.coords=n;var r=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}return _createClass(t,null,[{key:"from",value:function(n){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:FE,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:SE,i=n.length,a=new Float64Array(2*i),u=0;u>1,u=1/0,o=1/0,s=-1/0,l=-1/0,c=0;cs&&(s=f),h>l&&(l=h),this._ids[c]=c}for(var d,p,v,g=(u+s)/2,m=(o+l)/2,y=1/0,_=0;_0&&(p=k,y=A)}for(var M=t[2*p],E=t[2*p+1],C=1/0,D=0;DN&&(O[z++]=P,N=this._dists[P])}return this.hull=O.subarray(0,z),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(ME(b,w,M,E,S,T)){var q=p,L=M,U=E;p=v,M=S,E=T,v=q,S=L,T=U}var j=function(t,n,e,r,i,a){var u=e-t,o=r-n,s=i-t,l=a-n,c=u*u+o*o,f=s*s+l*l,h=.5/(u*l-o*s);return{x:t+(l*c-o*f)*h,y:n+(u*f-s*c)*h}}(b,w,M,E,S,T);this._cx=j.x,this._cy=j.y;for(var I=0;I0&&Math.abs(V-H)<=xE&&Math.abs(X-W)<=xE)&&(H=V,W=X,G!==d&&G!==p&&G!==v)){for(var J=0,Z=0,Q=this._hashKey(V,X);Z0?3-i:1+i)/4*this._hashSize))%this._hashSize;var e,r,i}},{key:"_legalize",value:function(t){for(var n,e,r,i,a,u,o,s,l,c,f,h,d,p,v,g,m=this._triangles,y=this._halfedges,_=this.coords,x=0,b=0;;){var w=y[t],k=t-t%3;if(b=k+(t+2)%3,-1!==w){var A=w-w%3,M=k+(t+1)%3,E=A+(w+2)%3,C=m[b],D=m[t],F=m[M],S=m[E];if(n=_[2*C],e=_[2*C+1],r=_[2*D],i=_[2*D+1],a=_[2*F],u=_[2*F+1],o=_[2*S],s=_[2*S+1],l=void 0,c=void 0,f=void 0,h=void 0,d=void 0,p=void 0,void 0,v=void 0,g=void 0,(l=n-o)*((h=i-s)*(g=(d=a-o)*d+(p=u-s)*p)-(v=(f=r-o)*f+h*h)*p)-(c=e-s)*(f*g-v*d)+(l*l+c*c)*(f*p-h*d)<0){m[t]=S,m[w]=C;var T=y[E];if(-1===T){var B=this._hullStart;do{if(this._hullTri[B]===E){this._hullTri[B]=t;break}B=this._hullPrev[B]}while(B!==this._hullStart)}this._link(t,T),this._link(w,y[b]),this._link(b,E);var O=A+(w+1)%3;x=33306690738754716e-32*Math.abs(u+o)?u-o:0}function ME(t,n,e,r,i,a){return(AE(i,a,t,n,e,r)||AE(t,n,e,r,i,a)||AE(e,r,i,a,t,n))<0}function EE(t,n,e,r,i,a){var u=e-t,o=r-n,s=i-t,l=a-n,c=u*u+o*o,f=s*s+l*l,h=.5/(u*l-o*s),d=(l*c-o*f)*h,p=(u*f-s*c)*h;return d*d+p*p}function CE(t,n,e,r){if(r-e<=20)for(var i=e+1;i<=r;i++){for(var a=t[i],u=n[a],o=i-1;o>=e&&n[t[o]]>u;)t[o+1]=t[o--];t[o+1]=a}else{var s=e+1,l=r;DE(t,e+r>>1,s),n[t[e]]>n[t[r]]&&DE(t,e,r),n[t[s]]>n[t[r]]&&DE(t,s,r),n[t[e]]>n[t[s]]&&DE(t,e,s);for(var c=t[s],f=n[c];;){do{s++}while(n[t[s]]f);if(l=l-e?(CE(t,n,s,r),CE(t,n,e,l-1)):(CE(t,n,e,l-1),CE(t,n,s,r))}}function DE(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function FE(t){return t[0]}function SE(t){return t[1]}var TE=function(){function t(){_classCallCheck(this,t),this._x0=this._y0=this._x1=this._y1=null,this._=""}return _createClass(t,[{key:"moveTo",value:function(t,n){this._+="M".concat(this._x0=this._x1=+t,",").concat(this._y0=this._y1=+n)}},{key:"closePath",value:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}},{key:"lineTo",value:function(t,n){this._+="L".concat(this._x1=+t,",").concat(this._y1=+n)}},{key:"arc",value:function(t,n,e){var r=(t=+t)+(e=+e),i=n=+n;if(e<0)throw new Error("negative radius");null===this._x1?this._+="M".concat(r,",").concat(i):(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+r+","+i),e&&(this._+="A".concat(e,",").concat(e,",0,1,1,").concat(t-e,",").concat(n,"A").concat(e,",").concat(e,",0,1,1,").concat(this._x1=r,",").concat(this._y1=i))}},{key:"rect",value:function(t,n,e,r){this._+="M".concat(this._x0=this._x1=+t,",").concat(this._y0=this._y1=+n,"h").concat(+e,"v").concat(+r,"h").concat(-e,"Z")}},{key:"value",value:function(){return this._||null}}]),t}(),BE=function(){function t(){_classCallCheck(this,t),this._=[]}return _createClass(t,[{key:"moveTo",value:function(t,n){this._.push([t,n])}},{key:"closePath",value:function(){this._.push(this._[0].slice())}},{key:"lineTo",value:function(t,n){this._.push([t,n])}},{key:"value",value:function(){return this._.length?this._:null}}]),t}(),OE=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,960,500],r=_slicedToArray(e,4),i=r[0],a=r[1],u=r[2],o=r[3];if(_classCallCheck(this,t),!((u=+u)>=(i=+i)&&(o=+o)>=(a=+a)))throw new Error("invalid bounds");this.delaunay=n,this._circumcenters=new Float64Array(2*n.points.length),this.vectors=new Float64Array(2*n.points.length),this.xmax=u,this.xmin=i,this.ymax=o,this.ymin=a,this._init()}return _createClass(t,[{key:"update",value:function(){return this.delaunay.update(),this._init(),this}},{key:"_init",value:function(){for(var t,n,e=this.delaunay,r=e.points,i=e.hull,a=e.triangles,u=this.vectors,o=this.circumcenters=this._circumcenters.subarray(0,a.length/3*2),s=0,l=0,c=a.length;s1;)i-=2;for(var a=2;a4)for(var o=0;o0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)this.xmax?2:0)|(nthis.ymax?8:0)}}]),t}(),zE=2*Math.PI,RE=Math.pow;function NE(t){return t[0]}function PE(t){return t[1]}function qE(t,n,e){return[t+Math.sin(t+n)*e,n+Math.cos(t-n)*e]}var LE=function(){function t(n){_classCallCheck(this,t),this._delaunator=new wE(n),this.inedges=new Int32Array(n.length/2),this._hullIndex=new Int32Array(n.length/2),this.points=this._delaunator.coords,this._init()}return _createClass(t,null,[{key:"from",value:function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NE,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:PE,i=arguments.length>3?arguments[3]:void 0;return new t("length"in n?UE(n,e,r,i):Float64Array.from(jE(n,e,r,i)))}}]),_createClass(t,[{key:"update",value:function(){return this._delaunator.update(),this._init(),this}},{key:"_init",value:function(){var t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&function(t){for(var n=t.triangles,e=t.coords,r=0;r1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:n.length/2},(function(t,n){return n})).sort((function(t,e){return n[2*t]-n[2*e]||n[2*t+1]-n[2*e+1]}));for(var e=this.collinear[0],r=this.collinear[this.collinear.length-1],i=[n[2*e],n[2*e+1],n[2*r],n[2*r+1]],a=1e-8*Math.hypot(i[3]-i[1],i[2]-i[0]),u=0,o=n.length/2;u0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=c[0],this.triangles[1]=c[1],this.triangles[2]=c[1],h[c[0]]=1,2===c.length&&(h[c[1]]=0))}},{key:"voronoi",value:function(t){return new OE(this,t)}},{key:"neighbors",value:regeneratorRuntime.mark((function t(n){var e,r,i,a,u,o,s,l,c,f,h;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.inedges,r=this.hull,i=this._hullIndex,a=this.halfedges,u=this.triangles,!(o=this.collinear)){t.next=10;break}if(!((s=o.indexOf(n))>0)){t.next=6;break}return t.next=6,o[s-1];case 6:if(!(s2&&void 0!==arguments[2]?arguments[2]:0;if((t=+t)!=t||(n=+n)!=n)return-1;for(var r,i=e;(r=this._step(e,t,n))>=0&&r!==e&&r!==i;)e=r;return r}},{key:"_step",value:function(t,n,e){var r=this.inedges,i=this.hull,a=this._hullIndex,u=this.halfedges,o=this.triangles,s=this.points;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);var l=t,c=RE(n-s[2*t],2)+RE(e-s[2*t+1],2),f=r[t],h=f;do{var d=o[h],p=RE(n-s[2*d],2)+RE(e-s[2*d+1],2);if(p1&&void 0!==arguments[1]?arguments[1]:2,e=null==t?t=new TE:void 0,r=this.points,i=0,a=r.length;i=f));)if(n.x=u+i,n.y=l+a,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>o[0]||n.y+n.y1>o[1])&&(!e||!JE(n,t,o[0]))&&(!e||QE(n,e))){for(var v,g=n.sprite,m=n.width>>5,y=o[0]>>5,_=n.x-(m<<4),x=127&_,b=32-x,w=n.y1-n.y0,k=(n.y+n.y0)*y+(_>>5),A=0;A>>x:0);k+=y}return n.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var n=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/n,t.height=2048/n;var e=t.getContext("2d");return e.fillStyle=e.strokeStyle="red",e.textAlign="center",{context:e,ratio:n}}(hf()),f=function(t){var n=[],e=-1;for(;++e>5)*o[1]),d=null,p=l.length,v=-1,g=[],m=l.map((function(o){return{text:t(o),font:n(o),style:r(o),weight:i(o),rotate:a(o),size:~~(e(o)+1e-14),padding:u(o),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:o}})).sort((function(t,n){return n.size-t.size}));++v>1,y.y=o[1]*(c()+.5)>>1,XE(s,y,m,v),y.hasText&&h(f,y,d)&&(g.push(y),d?ZE(d,y):d=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=o[0]>>1,y.y-=o[1]>>1)}return g},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(o=[+t[0],+t[1]],f):o},f.font=function(t){return arguments.length?(n=tC(t),f):n},f.fontStyle=function(t){return arguments.length?(r=tC(t),f):r},f.fontWeight=function(t){return arguments.length?(i=tC(t),f):i},f.rotate=function(t){return arguments.length?(a=tC(t),f):a},f.text=function(n){return arguments.length?(t=tC(n),f):t},f.spiral=function(t){return arguments.length?(s=nC[t]||t,f):s},f.fontSize=function(t){return arguments.length?(e=tC(t),f):e},f.padding=function(t){return arguments.length?(u=tC(t),f):u},f.random=function(t){return arguments.length?(c=t,f):c},f}function XE(t,n,e,r){if(!n.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,2048/a,2048/a);var u,o,s,l,c,f=0,h=0,d=0,p=e.length;for(--r;++r>5<<5,s=~~Math.max(Math.abs(y+_),Math.abs(y-_))}else u=u+31>>5<<5;if(s>d&&(d=s),f+u>=2048&&(f=0,h+=d,d=0),h+s>=2048)break;i.translate((f+(u>>1))/a,(h+(s>>1))/a),n.rotate&&i.rotate(n.rotate*GE),i.fillText(n.text,0,0),n.padding&&(i.lineWidth=2*n.padding,i.strokeText(n.text,0,0)),i.restore(),n.width=u,n.height=s,n.xoff=f,n.yoff=h,n.x1=u>>1,n.y1=s>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,f+=u}for(var b=i.getImageData(0,0,2048/a,2048/a).data,w=[];--r>=0;)if((n=e[r]).hasText){for(o=(u=n.width)>>5,s=n.y1-n.y0,l=0;l>5),E=b[2048*(h+c)+(f+l)<<2]?1<<31-l%32:0;w[M]|=E,k|=E}k?A=c:(n.y0++,s--,c--,h++)}n.y1=n.y0+A,n.sprite=w.slice(0,(n.y1-n.y0)*o)}}}function JE(t,n,e){e>>=5;for(var r,i=t.sprite,a=t.width>>5,u=t.x-(a<<4),o=127&u,s=32-o,l=t.y1-t.y0,c=(t.y+t.y0)*e+(u>>5),f=0;f>>o:0))&n[c+h])return!0;c+=e}return!1}function ZE(t,n){var e=t[0],r=t[1];n.x+n.x0r.x&&(r.x=n.x+n.x1),n.y+n.y1>r.y&&(r.y=n.y+n.y1)}function QE(t,n){return t.x+t.x1>n[0].x&&t.x+t.x0n[0].y&&t.y+t.y0>1,g=p[1]>>1,m=0,y=d.length;mi?1:0})),function(t,n){return Array.from(n,(function(n){return t[n]}))}(t,n)}(f,h),l)u=n,o=t,n=Array(l+c),t=sC(l+c),function(t,n,e,r,i,a,u,o,s){var l,c=0,f=0;for(l=0;c0)for(s=0;s=n?t:((e=e||new t.constructor(n)).set(t),e)}(e,n.length)},add:function(t){for(var e,r=0,i=n.length,a=t.length;rr.length||e>t)&&(t=Math.max(e,t),r=lC(n,t,r),i=lC(n,t))}}}(),t),this._indices=null,this._dims=null}hC.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]};var dC=xt(hC,_u);function pC(t){_u.call(this,null,t)}dC.transform=function(t,n){return this._dims?t.modified("fields")||t.fields.some((function(t){return n.modified(t.fields)}))?this.reinit(t,n):this.eval(t,n):this.init(t,n)},dC.init=function(t,n){for(var e,r,i=t.fields,a=t.query,u=this._indices={},o=this._dims=[],s=a.length,l=0;lg)for(i=g,a=Math.min(p,m);im)for(i=Math.max(p,m),a=v;id)for(i=d,a=Math.min(f,p);ip)for(i=Math.max(f,p),a=h;i",iD[3]="Identifier",iD[4]="Keyword",iD[5]="Null",iD[6]="Numeric",iD[7]="Punctuator",iD[8]="String",iD[9]="RegularExpression";var cD="ILLEGAL",fD=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\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u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),hD=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BE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0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function dD(t,n){if(!t)throw new Error("ASSERT: "+n)}function pD(t){return t>=48&&t<=57}function vD(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function gD(t){return"01234567".indexOf(t)>=0}function mD(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function yD(t){return 10===t||13===t||8232===t||8233===t}function _D(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&fD.test(String.fromCharCode(t))}function xD(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&hD.test(String.fromCharCode(t))}var bD={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function wD(){for(var t;uD1114111||"}"!==t)&&LD({},"Unexpected token %0",cD),n<=65535?String.fromCharCode(n):(e=55296+(n-65536>>10),r=56320+(n-65536&1023),String.fromCharCode(e,r))}function MD(){var t,n;for(t=aD.charCodeAt(uD++),n=String.fromCharCode(t),92===t&&(117!==aD.charCodeAt(uD)&&LD({},"Unexpected token %0",cD),++uD,(t=kD("u"))&&"\\"!==t&&_D(t.charCodeAt(0))||LD({},"Unexpected token %0",cD),n=t);uD>>="===(r=aD.substr(uD,4))?{type:7,value:r,start:i,end:uD+=4}:">>>"===(e=r.substr(0,3))||"<<="===e||">>="===e?{type:7,value:e,start:i,end:uD+=3}:u===(n=e.substr(0,2))[1]&&"+-<>&|".indexOf(u)>=0||"=>"===n?{type:7,value:n,start:i,end:uD+=2}:"<>=!+-*%&|^/".indexOf(u)>=0?{type:7,value:u,start:i,end:++uD}:void LD({},"Unexpected token %0",cD)}function DD(){var t,n,e;if(dD(pD((e=aD[uD]).charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point"),n=uD,t="","."!==e){if(t=aD[uD++],e=aD[uD],"0"===t){if("x"===e||"X"===e)return++uD,function(t){for(var n="";uD=0&&LD({},"Invalid regular expression",e),{value:e,literal:n}}(),r=function(t,n){var e=t;n.indexOf("u")>=0&&(e=e.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(t,n){if(parseInt(n,16)<=1114111)return"x";LD({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(e)}catch(t){LD({},"Invalid regular expression")}try{return new RegExp(t,n)}catch(t){return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:uD}}function SD(){var t;return wD(),uD>=oD?{type:2,start:uD,end:uD}:_D(t=aD.charCodeAt(uD))?ED():40===t||41===t||59===t?CD():39===t||34===t?function(){var t,n,e,r,i="",a=!1;for(dD("'"===(t=aD[uD])||'"'===t,"String literal must starts with a quote"),n=uD,++uD;uD=0&&uD":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function eF(){var t,n;return t=function(){var t,n,e,r,i,a,u,o,s,l;if(t=sD,s=tF(),0===(i=nF(r=sD)))return s;for(r.prec=i,TD(),n=[t,sD],a=[s,r,u=tF()];(i=nF(sD))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)u=a.pop(),o=a.pop().value,s=a.pop(),n.pop(),e=OD(o,s,u),a.push(e);(r=TD()).prec=i,a.push(r),n.push(sD),e=tF(),a.push(e)}for(e=a[l=a.length-1],n.pop();l>1;)n.pop(),e=OD(a[l-1].value,a[l-2],e),l-=2;return e}(),ID("?")&&(TD(),n=eF(),jD(":"),t=function(t,n,e){var r=new lD("ConditionalExpression");return r.test=t,r.consequent=n,r.alternate=e,r}(t,n,eF())),t}function rF(){var t=eF();if(ID(","))throw new Error("Disabled.");return t}var iF={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function aF(t){function n(n,e,r){return function(i){return function(n,e,r,i){var a=t(e[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+n+(i<0?"":0===i?"()":"("+e.slice(1).map(t).join(",")+")")}(n,i,e,r)}}var e="new Date";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(n){n.length<3&&_("Missing arguments to clamp function."),n.length>3&&_("Too many arguments to clamp function.");var e=n.map(t);return"Math.max("+e[1]+", Math.min("+e[2]+","+e[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:n("getDate",e,0),day:n("getDay",e,0),year:n("getFullYear",e,0),month:n("getMonth",e,0),hours:n("getHours",e,0),minutes:n("getMinutes",e,0),seconds:n("getSeconds",e,0),milliseconds:n("getMilliseconds",e,0),time:n("getTime",e,0),timezoneoffset:n("getTimezoneOffset",e,0),utcdate:n("getUTCDate",e,0),utcday:n("getUTCDay",e,0),utcyear:n("getUTCFullYear",e,0),utcmonth:n("getUTCMonth",e,0),utchours:n("getUTCHours",e,0),utcminutes:n("getUTCMinutes",e,0),utcseconds:n("getUTCSeconds",e,0),utcmilliseconds:n("getUTCMilliseconds",e,0),length:n("length",null,-1),join:n("join",null),indexof:n("indexOf",null),lastindexof:n("lastIndexOf",null),slice:n("slice",null),reverse:function(n){return"("+t(n[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase","String",0),lower:n("toLowerCase","String",0),substring:n("substring","String"),split:n("split","String"),replace:n("replace","String"),trim:n("trim","String",0),regexp:"RegExp",test:n("test","RegExp"),if:function(n){n.length<3&&_("Missing arguments to if function."),n.length>3&&_("Too many arguments to if function.");var e=n.map(t);return"("+e[0]+"?"+e[1]+":"+e[2]+")"}}}function uF(t,n,e,r){"Literal"!==n[0].type&&_("First argument to data functions must be a string literal.");var i=n[0].value,a=":"+i;if(!gt(a,r))try{r[a]=e.getData(i).tuplesRef()}catch(t){}}function oF(t,n,e,r){if("Literal"===n[0].type)sF(e,r,n[0].value);else for(t in e.scales)sF(e,r,t)}function sF(t,n,e){var r="%"+e;if(!gt(n,r))try{n[r]=t.scaleRef(e)}catch(t){}}function lF(t,n){var e;return it(t)?t:Et(t)?(e=n.scales[t])&&e.value:void 0}function cF(t,n){return function(e,r,i){if(e){var a=lF(e,(i||this).context);return a&&a.path[t](r)}return n(r)}}var fF=cF("area",(function(t){return dx.reset(),ux(t,px),2*dx})),hF=cF("bounds",(function(t){var n,e,r,i,a,u,o;if(Fx=Dx=-(Ex=Cx=1/0),zx=[],ux(t,Kx),e=zx.length){for(zx.sort(sb),n=1,a=[r=zx[0]];nob(r[0],r[1])&&(r[1]=i[1]),ob(i[0],r[1])>ob(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(u=-1/0,n=0,r=a[e=a.length-1];n<=e;r=i,++n)i=a[n],(o=ob(r[1],i[0]))>u&&(u=o,Ex=i[0],Dx=r[1])}return zx=Rx=null,Ex===1/0||Cx===1/0?[[NaN,NaN],[NaN,NaN]]:[[Ex,Cx],[Dx,Fx]]})),dF=cF("centroid",(function(t){Nx=Px=qx=Lx=Ux=jx=Ix=$x=Hx=Wx=Yx=0,ux(t,cb);var n=Hx,e=Wx,r=Yx,i=n*n+e*e+r*r;return i<1e-12&&(n=jx,e=Ix,r=$x,Px<1e-6&&(n=qx,e=Lx,r=Ux),(i=n*n+e*e+r*r)<1e-12)?[NaN,NaN]:[I_(e,n)*q_,K_(r/J_(i))*q_]}));function pF(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function vF(t){var n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function gF(t){var n=vp(t);return.2126*vF(n.r)+.7152*vF(n.g)+.0722*vF(n.b)}function mF(t,n){return t===n||t!=t&&n!=n||(T(t)?!(!T(n)||t.length!==n.length)&&function(t,n){for(var e=0,r=t.length;e=0})):n},R_union:function(t,n){var e=q(n[0]),r=q(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?(t[0]>e&&(t[0]=e),t[1]r&&(e=n[1],r=n[0]),t.length?rr&&(t[1]=r),t):[e,r]}};function MF(t,n,e,r){"Literal"!==n[0].type&&_("First argument to selection functions must be a string literal.");var i=n[0].value,a=":"+i;"intersect"!==(n.length>=2&&P(n).value)||gt(r,"@unit")||(r["@unit"]=e.getData(i).indataRef(e,"unit")),gt(r,a)||(r[a]=e.getData(i).tuplesRef())}var EF={random:function(){return t.random()},cumulativeNormal:Xu,cumulativeLogNormal:no,cumulativeUniform:oo,densityNormal:Vu,densityLogNormal:to,densityUniform:uo,quantileNormal:Ju,quantileLogNormal:eo,quantileUniform:so,sampleNormal:Gu,sampleLogNormal:Ku,sampleUniform:ao,isArray:T,isBoolean:wt,isDate:kt,isDefined:function(t){return void 0!==t},isNumber:At,isObject:B,isRegExp:Mt,isString:Et,isTuple:Gt,isValid:function(t){return null!=t&&t==t},toBoolean:Rt,toDate:Pt,toNumber:q,toString:qt,flush:_t,lerp:Dt,merge:function(){var t=[].slice.call(arguments);return t.unshift({}),ht.apply(null,t)},pad:Bt,peek:P,span:Ot,inrange:bt,truncate:Ut,rgb:vp,lab:Fp,hcl:Np,hsl:wp,luminance:gF,contrast:function(t,n){var e=gF(t),r=gF(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)},sequence:fe,format:ZC,utcFormat:KC,utcParse:nD,utcOffset:ui,utcSequence:li,timeFormat:QC,timeParse:tD,timeOffset:ai,timeSequence:si,timeUnitSpecifier:sr,monthFormat:function(t){return rD.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return rD.call(this,t,1,"%b")},dayFormat:function(t){return rD.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return rD.call(this,0,2+t,"%a")},quarter:tt,utcquarter:nt,week:Rr,utcweek:jr,dayofyear:zr,utcdayofyear:Ur,warn:function(){return pF(this.context.dataflow,"warn",arguments)},info:function(){return pF(this.context.dataflow,"info",arguments)},debug:function(){return pF(this.context.dataflow,"debug",arguments)},extent:dt,inScope:function(t){var n=this.context.group,e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e},intersect:function(t,n,e){if(!t)return[];var r=_slicedToArray(t,2),i=r[0],a=r[1],u=(new sf).set(i[0],i[1],a[0],a[1]);return Ym(e||this.context.dataflow.scenegraph().root,u,function(t){var n=null;if(t){var e=et(t.marktype),r=et(t.markname);n=function(t){return(!e.length||e.some((function(n){return t.marktype===n})))&&(!r.length||r.some((function(n){return t.name===n})))}}return n}(n))},clampRange:rt,pinchDistance:function(t){var n=t.touches,e=n[0].clientX-n[1].clientX,r=n[0].clientY-n[1].clientY;return Math.sqrt(e*e+r*r)},pinchAngle:function(t){var n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)},screen:function(){var t=wF();return t?t.screen:{}},containerSize:function(){var t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]},windowSize:function(){var t=wF();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,n,e){return Ud(t||0,n||0,e||0)},setdata:function(t,n){var e=this.context.dataflow,r=this.context.data[t].input;return e.pulse(r,e.changeset().remove(C).insert(n)),1},pathShape:function(t){var n=null;return function(e){return e?Sc(e,n=n||_c(t)):t}},panLinear:W,panLog:Y,panPow:G,panSymlog:V,zoomLinear:J,zoomLog:Z,zoomPow:Q,zoomSymlog:K,encode:function(t,n,e){if(t){var r=this.context.dataflow,i=t.mark.source;r.pulse(i,r.changeset().encode(t,n))}return void 0!==e?e:t},modify:function(t,n,e,r,i,a){var u,o,s=this.context.dataflow,l=this.context.data[t],c=l.input,f=l.changes,h=s.stamp();if(!1===s._trigger||!(c.value.length||n||r))return 0;if((!f||f.stamp0?i:gt(e,i)?_("Illegal identifier: "+i):gt(r,i)?r[i]:gt(n,i)?i:(o[i]=1,c(i))},MemberExpression:function(t){var n=!t.computed,e=f(t.object);n&&(l+=1);var r=f(t.property);return e===u&&(s[function(t){var n=t&&t.length-1;return n&&('"'===t[0]&&'"'===t[n]||"'"===t[0]&&"'"===t[n])?t.slice(1,-1):t}(r)]=1),n&&(l-=1),e+(n?"."+r:"["+r+"]")},CallExpression:function(t){"Identifier"!==t.callee.type&&_("Illegal callee type: "+t.callee.type);var n=t.callee.name,e=t.arguments,r=gt(i,n)&&i[n];return r||_("Unrecognized function: "+n),it(r)?r(e):r+"("+e.map(f).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(f).join(",")+"]"},BinaryExpression:function(t){return"("+f(t.left)+t.operator+f(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+f(t.argument)+")"},ConditionalExpression:function(t){return"("+f(t.test)+"?"+f(t.consequent)+":"+f(t.alternate)+")"},LogicalExpression:function(t){return"("+f(t.left)+t.operator+f(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(f).join(",")+"}"},Property:function(t){l+=1;var n=f(t.key);return l-=1,n+":"+f(t.value)}};function d(t){var n={code:f(t),globals:Object.keys(o),fields:Object.keys(s)};return o={},s={},n}return d.functions=i,d.constants=r,d}(SF);function BF(t,n){var e,r,i={};try{e=function(t){uD=0,oD=(aD=t).length,sD=null,BD();var n=rF();if(2!==sD.type)throw new Error("Unexpect token after expression.");return n}(t=Et(t)?t:zt(t)+"")}catch(n){_("Expression parse error: "+t)}return e.visit((function(t){if("CallExpression"===t.type){var e=t.callee.name,r=SF.visitors[e];r&&r(e,t.arguments,n,i)}})),(r=TF(e)).globals.forEach((function(t){var e="$"+t;!gt(i,e)&&n.getSignal(t)&&(i[e]=n.signalRef(t))})),{$expr:ht({code:r.code},n.options.ast?{ast:e}:null),$fields:r.fields,$params:i}}var OF=Lt(["rule"]),zF=Lt(["group","image","rect"]);function RF(t){return(t+"").toLowerCase()}function NF(t,n,e){";"!==e[e.length-1]&&(e="return("+e+");");var r=Function.apply(null,n.concat(e));return t&&t.functions?r.bind(t.functions):r}var PF={operator:function(t,n){return NF(t,["_"],n.code)},parameter:function(t,n){return NF(t,["datum","_"],n.code)},event:function(t,n){return NF(t,["event"],n.code)},handler:function(t,n){return NF(t,["_","event"],"var datum=event.item&&event.item.datum;return ".concat(n.code,";"))},encode:function(t,n){var e=n.marktype,r=n.channels,i="var o=item,datum=o.datum,m=0,$;";for(var a in r){var u="o["+zt(a)+"]";i+="$=".concat(r[a].code,";if(").concat(u,"!==$)").concat(u,"=$,m=1;")}return i+=function(t,n){var e="";return OF[n]||(t.x2&&(t.x?(zF[n]&&(e+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),e+="o.width=o.x2-o.x;"):e+="o.x=o.x2-(o.width||0);"),t.xc&&(e+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(zF[n]&&(e+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),e+="o.height=o.y2-o.y;"):e+="o.y=o.y2-(o.height||0);"),t.yc&&(e+="o.y=o.yc-(o.height||0)/2;")),e}(r,e),NF(t,["item","_"],i+="return m;")},codegen:{get:function(t){var n="[".concat(t.map(zt).join("]["),"]"),e=Function("_","return _".concat(n,";"));return e.path=n,e},comparator:function(t,n){var e,r=Function("a","b","var u, v; return "+t.map((function(t,r){var i,a,u=n[r];return t.path?(i="a".concat(t.path),a="b".concat(t.path)):((e=e||{})["f"+r]=t,i="this.f".concat(r,"(a)"),a="this.f".concat(r,"(b)")),function(t,n,e,r){return"((u = ".concat(t,") < (v = ").concat(n,") || u == null) && v != null ? ").concat(e,"\n : (u > v || v == null) && u != null ? ").concat(r,"\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(e,"\n : v !== v && u === u ? ").concat(r," : ")}(i,a,-u,u)})).join("")+"0;");return e?r.bind(e):r}}};function qF(t,n,e){if(!t||!B(t))return t;for(var r,i=0,a=LF.length;i=0;)if(r=i[a].type,e=i[a].handler,t===r&&(n===e||n===e.raw)){this._handler.off(r,e);break}return this},KF.addResizeListener=function(t){var n=this._resizeListeners;return n.indexOf(t)<0&&n.push(t),this},KF.removeResizeListener=function(t){var n=this._resizeListeners,e=n.indexOf(t);return e>=0&&n.splice(e,1),this},KF.addSignalListener=function(t,n){return eS(this,t,tS(this,t),n)},KF.removeSignalListener=function(t,n){return rS(this,tS(this,t),n)},KF.addDataListener=function(t,n){return eS(this,t,yC(this,t).values,n)},KF.removeDataListener=function(t,n){return rS(this,yC(this,t).values,n)},KF.globalCursor=function(t){if(arguments.length){if(this._globalCursor!==!!t){var n=mC(this,null);this._globalCursor=!!t,n&&mC(this,n)}return this}return this._globalCursor},KF.preventDefault=function(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},KF.timer=function(t,n){this._timers.push(function(t,n,e){var r=new OA,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?TA():+e,r.restart((function a(u){u+=i,r.restart(a,i+=n,e),t(u)}),n,e),r)}((function(n){t({timestamp:Date.now(),elapsed:n})}),n))},KF.events=function(t,n,e){var r,i=this,a=new dn(e),u=function(e,r){i.runAsync(null,(function(){"view"===t&&function(t,n){var e=t._eventConfig.defaults,r=e.prevent,i=e.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[n]:i?!i[n]:t.preventDefault()))}(i,n)&&e.preventDefault(),a.receive(AC(i,e,r))}))};if("timer"===t)EC(i,"timer",n)&&i.timer(u,n);else if("view"===t)EC(i,"view",n)&&i.addEventListener(n,u,MC);else if("window"===t?EC(i,"window",n)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&EC(i,"selector",n)&&(r=document.querySelectorAll(t)),r){for(var o=0,s=r.length;o=0;)i[t].stop();for(t=a.length;--t>=0;)for(n=(e=a[t]).sources.length;--n>=0;)e.sources[n].removeEventListener(e.type,e.handler);return r&&r.call(this,this._handler,null,null,null),this},KF.hover=function(t,n){return n=[n||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",CC),DC,FC(t)),this.on(this.events("view","mouseout",CC),DC,FC(n)),this},KF.data=function(t,n){return arguments.length<2?yC(this,t).values.value:_C.call(this,t,en().remove(C).insert(n))},KF.change=_C,KF.insert=function(t,n){return _C.call(this,t,en().insert(n))},KF.remove=function(t,n){return _C.call(this,t,en().remove(n))},KF.scale=function(t){var n=this._runtime.scales;return gt(n,t)||_("Unrecognized scale or projection: "+t),n[t].value},KF.initialize=function(t,n){var e=this,r=e._renderType,i=e._eventConfig.bind,a=Wm(r);t=e._el=t?UC(e,t):null,function(t){var n=t.container();n&&(n.setAttribute("role","graphics-document"),n.setAttribute("aria-roleDescription","visualization"),gC(n,t.description()))}(e),a||e.error("Unrecognized renderer type: "+r);var u=a.handler||Dd,o=t?a.renderer:a.headless;return e._renderer=o?qC(e,e._renderer,t,o):null,e._handler=function(t,n,e,r){var i=new r(t.loader(),LC(t,t.tooltip())).scene(t.scenegraph().root).initialize(e,wC(t),t);return n&&n.handlers().forEach((function(t){i.on(t.type,t.handler)})),i}(e,e._handler,t,u),e._redraw=!0,t&&"none"!==i&&(n=n?e._elBind=UC(e,n):t.appendChild(SC("form",{class:"vega-bindings"})),e._bind.forEach((function(t){t.param.element&&"container"!==i&&(t.element=UC(e,t.param.element))})),e._bind.forEach((function(t){TC(e,t.element||n,t)}))),e},KF.toImageURL=function(t,n){return WC.apply(this,arguments)},KF.toCanvas=function(t,n){return GC.apply(this,arguments)},KF.toSVG=function(t){return VC.apply(this,arguments)},KF.getState=function(t){return this._runtime.getState(t||{data:GF,signals:VF,recurse:!0})},KF.setState=function(t){return this.runAsync(null,(function(n){n._trigger=!1,n._runtime.setState(t)}),(function(t){t._trigger=!0})),this};var aS=function(t){return+t||0};function uS(t){return B(t)?t.signal?t:{top:aS(t.top),bottom:aS(t.bottom),left:aS(t.left),right:aS(t.right)}:{top:n=aS(t),bottom:n,left:n,right:n};var n}var oS=function(t){return B(t)&&!T(t)?ht({},t):{value:t}};function sS(t,n,e,r){return null!=e?(B(e)&&!T(e)?t.update[n]=e:t[r||"enter"][n]={value:e},1):0}function lS(t,n,e){for(var r in n)sS(t,r,n[r]);for(var i in e)sS(t,i,e[i],"update")}function cS(t,n,e){for(var r in n)e&>(e,r)||(t[r]=ht(t[r]||{},n[r]));return t}function fS(t,n){return n&&(n.enter&&n.enter[t]||n.update&&n.update[t])}function hS(t,n,e){t[n]=e&&e.signal?{signal:e.signal}:{value:e}}var dS=function(t){return Et(t)?zt(t):t.signal?"(".concat(t.signal,")"):mS(t)};function pS(t){if(null!=t.gradient)return function(t){var n=[t.start,t.stop,t.count].map((function(t){return null==t?null:zt(t)}));for(;n.length&&null==P(n);)n.pop();return n.unshift(dS(t.gradient)),"gradient(".concat(n.join(","),")")}(t);var n=t.signal?"(".concat(t.signal,")"):t.color?function(t){return t.c?vS("hcl",t.h,t.c,t.l):t.h||t.s?vS("hsl",t.h,t.s,t.l):t.l||t.a?vS("lab",t.l,t.a,t.b):t.r||t.g||t.b?vS("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?mS(t.field):void 0!==t.value?zt(t.value):void 0;return null!=t.scale&&(n=function(t,n){var e=dS(t.scale);null!=t.range?n="lerp(_range(".concat(e,"), ").concat(+t.range,")"):(void 0!==n&&(n="_scale(".concat(e,", ").concat(n,")")),t.band&&(n=(n?n+"+":"")+"_bandwidth(".concat(e,")")+(1==+t.band?"":"*"+gS(t.band)),t.extra&&(n="(datum.extra ? _scale(".concat(e,", datum.extra.value) : ").concat(n,")"))),null==n&&(n="0"));return n}(t,n)),void 0===n&&(n=null),null!=t.exponent&&(n="pow(".concat(n,",").concat(gS(t.exponent),")")),null!=t.mult&&(n+="*".concat(gS(t.mult))),null!=t.offset&&(n+="+".concat(gS(t.offset))),t.round&&(n="round(".concat(n,")")),n}var vS=function(t,n,e,r){return"(".concat(t,"(").concat([n,e,r].map(pS).join(","),")+'')")};function gS(t){return B(t)?"("+pS(t)+")":t}function mS(t){return function t(n){var e,r,i;if(n.signal)e="datum",i=n.signal;else if(n.group||n.parent){for(r=Math.max(1,n.level||1),e="item";r-- >0;)e+=".mark.group";n.parent?(i=n.parent,e+=".datum"):i=n.group}else n.datum?(e="datum",i=n.datum):_("Invalid field reference: "+zt(n));n.signal||(i=Et(i)?x(i).map(zt).join("]["):t(i));return e+"["+i+"]"}(B(t)?t:{datum:t})}function yS(t,n,e,r,i,a){var u={};for(var o in(a=a||{}).encoders={$encode:u},t=function(t,n,e,r,i){var a,u,o,s={},l={};for(u in u="lineBreak","text"!==n||null==i[u]||fS(u,t)||hS(s,u,i[u]),("legend"==e||String(e).startsWith("axis"))&&(e=null),o="frame"===e?i.group:"mark"===e?ht({},i.mark,i[n]):null)fS(u,t)||("fill"===u||"stroke"===u)&&(fS("fill",t)||fS("stroke",t))||hS(s,u,o[u]);for(u in et(r).forEach((function(n){var e=i.style&&i.style[n];for(var r in e)fS(r,t)||hS(s,r,e[r])})),t=ht({},t),s)(o=s[u]).signal?(a=a||{})[u]=o:l[u]=o;return t.enter=ht(l,t.enter),a&&(t.update=ht(a,t.update)),t}(t,n,e,r,i.config))u[o]=_S(t[o],n,a,i);return a}function _S(t,n,e,r){var i,a={},u={};for(var o in t)null!=t[o]&&(a[o]=xS((i=t[o],T(i)?function(t){var n="";return t.forEach((function(t){var e=pS(t);n+=t.test?"(".concat(t.test,")?").concat(e,":"):e})),":"===P(n)&&(n+="null"),n}(i):pS(i)),r,e,u));return{$expr:{marktype:n,channels:a},$fields:Object.keys(u),$output:Object.keys(t)}}function xS(t,n,e,r){var i=BF(t,n);return i.$fields.forEach((function(t){return r[t]=1})),ht(e,i.$params),i.$expr}var bS=["value","update","init","react","bind"];function wS(t,n){_(t+' for "outer" push: '+zt(n))}function kS(t,n){var e=t.name;if("outer"===t.push)n.signals[e]||wS("No prior signal definition",e),bS.forEach((function(n){void 0!==t[n]&&wS("Invalid property ",n)}));else{var r=n.addSignal(e,t.value);!1===t.react&&(r.react=!1),t.bind&&n.addBinding(e,t.bind)}}function AS(t,n,e,r){this.id=-1,this.type=t,this.value=n,this.params=e,r&&(this.parent=r)}function MS(t,n,e,r){return new AS(t,n,e,r)}function ES(t,n){return MS("operator",t,n)}function CS(t){var n={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(n),n}function DS(t,n){return n?{$field:t,$name:n}:{$field:t}}var FS=DS("key");function SS(t,n){return{$compare:t,$order:n}}function TS(t,n){return(t&&t.signal?"$"+t.signal:t||"")+(t&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}function BS(t){return t&&t.signal}function OS(t){if(BS(t))return!0;if(B(t))for(var n in t)if(OS(t[n]))return!0;return!1}function zS(t,n){return null!=t?t:n}function RS(t){return t&&t.signal||t}function NS(t,n){return(t.merge?PS:t.stream?qS:t.type?LS:_("Invalid stream specification: "+zt(t)))(t,n)}function PS(t,n){var e=US({merge:t.merge.map((function(t){return NS(t,n)}))},t,n);return n.addStream(e).id}function qS(t,n){var e=US({stream:NS(t.stream,n)},t,n);return n.addStream(e).id}function LS(t,n){var e,r;return"timer"===t.type?(e=n.event("timer",t.throttle),t={between:t.between,filter:t.filter}):e=n.event(function(t){return"scope"===t?"view":t||"view"}(t.source),t.type),r=US({stream:e},t,n),1===Object.keys(r).length?e:n.addStream(r).id}function US(t,n,e){var r=n.between;return r&&(2!==r.length&&_('Stream "between" parameter must have 2 entries: '+zt(n)),t.between=[NS(r[0],e),NS(r[1],e)]),r=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(function(t,n,e){var r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(e?"&&"+r+".mark.role==='"+e+"'":"")+(n?"&&"+r+".mark.name==='"+n+"'":"")}(n.marktype,n.markname,n.markrole)),"scope"===n.source&&r.push("inScope(event.item)"),r.length&&(t.filter=BF("("+r.join(")&&(")+")",e).$expr),null!=(r=n.throttle)&&(t.throttle=+r),null!=(r=n.debounce)&&(t.debounce=+r),n.consume&&(t.consume=!0),t}var jS,IS,$S="view",HS=/[[\]{}]/,WS={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function YS(t,n,e,r,i){for(var a,u=0,o=t.length;n=0?--u:r&&r.indexOf(a)>=0&&++u}return n}function GS(t){for(var n=[],e=0,r=t.length,i=0;i"!==(t=t.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+t;if(n=n.map(VS),(e=VS(t.slice(1).trim())).between)return{between:n,stream:e};e.between=n;return e}(t):function(t){var n,e,r={source:jS},i=[],a=[0,0],u=0,o=0,s=t.length,l=0;if("}"===t[s-1]){if(!((l=t.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+t;try{a=function(t){var n=t.split(",");if(!t.length||n.length>2)throw t;return n.map((function(n){var e=+n;if(e!=e)throw t;return e}))}(t.substring(l+1,s-1))}catch(n){throw"Invalid throttle specification: "+t}t=t.slice(0,l).trim(),s=t.length,l=0}if(!s)throw t;"@"===t[0]&&(u=++l);(n=YS(t,l,":"))1?(r.type=i[1],u?r.markname=i[0].slice(1):!function(t){return IS[t]}(i[0])?r.source=i[0]:r.marktype=i[0]):r.type=i[0];"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=e&&(r.filter=e);a[0]&&(r.throttle=a[0]);a[1]&&(r.debounce=a[1]);return r}(t)}var XS={code:"_.$value",ast:{type:"Identifier",value:"value"}};function JS(t,n,e){var r=t.events,i=t.update,a=t.encode,u=[],o={target:e};r||_("Signal update missing events specification."),Et(r)&&(r=function(t,n,e){return jS=n||$S,IS=e||WS,GS(t.trim()).map(VS)}(r,n.isSubscope()?"scope":"view")),r=et(r).filter((function(t){return t.signal||t.scale?(u.push(t),0):1})),u.length>1&&(u=[ZS(u)]),r.length&&u.push(r.length>1?{merge:r}:r[0]),null!=a&&(i&&_("Signal encode and update are mutually exclusive."),i="encode(item(),"+zt(a)+")"),o.update=Et(i)?BF(i,n):null!=i.expr?BF(i.expr,n):null!=i.value?i.value:null!=i.signal?{$expr:XS,$params:{$value:n.signalRef(i.signal)}}:_("Invalid signal update specification."),t.force&&(o.options={force:!0}),u.forEach((function(t){n.addUpdate(ht(function(t,n){return{source:t.signal?n.signalRef(t.signal):t.scale?n.scaleRef(t.scale):NS(t,n)}}(t,n),o))}))}function ZS(t){return{signal:"["+t.map((function(t){return t.scale?'scale("'+t.scale+'")':t.signal}))+"]"}}var QS=function(t){return function(n,e,r){return MS(t,e,n||void 0,r)}},KS=QS("aggregate"),tT=QS("axisticks"),nT=QS("bound"),eT=QS("collect"),rT=QS("compare"),iT=QS("datajoin"),aT=QS("encode"),uT=QS("expression"),oT=QS("facet"),sT=QS("field"),lT=QS("key"),cT=QS("legendentries"),fT=QS("load"),hT=QS("mark"),dT=QS("multiextent"),pT=QS("multivalues"),vT=QS("overlap"),gT=QS("params"),mT=QS("prefacet"),yT=QS("projection"),_T=QS("proxy"),xT=QS("relay"),bT=QS("render"),wT=QS("scale"),kT=QS("sieve"),AT=QS("sortitems"),MT=QS("viewlayout"),ET=QS("values"),CT=0,DT={min:"min",max:"max",count:"sum"};function FT(t,n){var e,r=n.getScale(t.name).params;for(e in r.domain=OT(t.domain,t,n),null!=t.range&&(r.range=function t(n,e,r){var i=n.range,a=e.config.range;if(i.signal)return e.signalRef(i.signal);if(Et(i)){if(a&>(a,i))return n=ht({},n,{range:a[i]}),t(n,e,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=zg(n.type)?[0,{signal:"height"}]:[{signal:"height"},0]:_("Unrecognized scale range value: "+zt(i))}else{if(i.scheme)return r.scheme=T(i.scheme)?TT(i.scheme,e):ST(i.scheme,e),i.extent&&(r.schemeExtent=TT(i.extent,e)),void(i.count&&(r.schemeCount=ST(i.count,e)));if(i.step)return void(r.rangeStep=ST(i.step,e));if(zg(n.type)&&!T(i))return OT(i,n,e);T(i)||_("Unsupported range type: "+zt(i))}return i.map((function(t){return(T(t)?TT:ST)(t,e)}))}(t,n,r)),null!=t.interpolate&&function(t,n){n.interpolate=ST(t.type||t),null!=t.gamma&&(n.interpolateGamma=ST(t.gamma))}(t.interpolate,r),null!=t.nice&&(r.nice=function(t){return B(t)?{interval:ST(t.interval),step:ST(t.step)}:ST(t)}(t.nice)),null!=t.bins&&(r.bins=function(t,n){return t.signal||T(t)?TT(t,n):n.objectProperty(t)}(t.bins,n)),t)gt(r,e)||"name"===e||(r[e]=ST(t[e],n))}function ST(t,n){return B(t)?t.signal?n.signalRef(t.signal):_("Unsupported object: "+zt(t)):t}function TT(t,n){return t.signal?n.signalRef(t.signal):t.map((function(t){return ST(t,n)}))}function BT(t){_("Can not find data set: "+zt(t))}function OT(t,n,e){if(t)return t.signal?e.signalRef(t.signal):(T(t)?zT:t.fields?NT:RT)(t,n,e);null==n.domainMin&&null==n.domainMax||_("No scale domain defined for domainMin/domainMax to override.")}function zT(t,n,e){return t.map((function(t){return ST(t,e)}))}function RT(t,n,e){var r=e.getData(t.data);return r||BT(t.data),zg(n.type)?r.valuesRef(e,t.field,qT(t.sort,!1)):qg(n.type)?r.domainRef(e,t.field):r.extentRef(e,t.field)}function NT(t,n,e){var r=t.data,i=t.fields.reduce((function(t,n){return n=Et(n)?{data:r,field:n}:T(n)||n.signal?function(t,n){var e="_:vega:_"+CT++,r=eT({});if(T(t))r.value={$ingest:t};else if(t.signal){var i="setdata("+zt(e)+","+t.signal+")";r.params.input=n.signalRef(i)}return n.addDataPipeline(e,[r,kT({})]),{data:e,field:"data"}}(n,e):n,t.push(n),t}),[]);return(zg(n.type)?PT:qg(n.type)?LT:UT)(t,e,i)}function PT(t,n,e){var r,i,a,u,o,s=qT(t.sort,!0);return r=e.map((function(t){var e=n.getData(t.data);return e||BT(t.data),e.countsRef(n,t.field,s)})),i={groupby:FS,pulse:r},s&&(a=s.op||"count",o=s.field?TS(a,s.field):"count",i.ops=[DT[a]],i.fields=[n.fieldRef(o)],i.as=[o]),a=n.add(KS(i)),u=n.add(eT({pulse:CS(a)})),o=n.add(ET({field:FS,sort:n.sortRef(s),pulse:CS(u)})),CS(o)}function qT(t,n){return t&&(t.field||t.op?t.field||"count"===t.op?n&&t.field&&t.op&&!DT[t.op]&&_("Multiple domain scales can not be sorted using "+t.op):_("No field provided for sort aggregate op: "+t.op):B(t)?t.field="key":t={field:"key"}),t}function LT(t,n,e){var r=e.map((function(t){var e=n.getData(t.data);return e||BT(t.data),e.domainRef(n,t.field)}));return CS(n.add(pT({values:r})))}function UT(t,n,e){var r=e.map((function(t){var e=n.getData(t.data);return e||BT(t.data),e.extentRef(n,t.field)}));return CS(n.add(dT({extents:r})))}function jT(t,n,e){return T(t)?t.map((function(t){return jT(t,n,e)})):B(t)?t.signal?e.signalRef(t.signal):"fit"===n?t:_("Unsupported parameter object: "+zt(t)):t}var IT="value",$T=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],HT={name:1,style:1,interactive:1},WT={value:0},YT={value:1};function GT(t){return t.type="group",t.interactive=t.interactive||!1,t}function VT(t,n){var e=function(e,r){return zS(t[e],zS(n[e],r))};return e.isVertical=function(e){return"vertical"===zS(t.direction,n.direction||(e?n.symbolDirection:n.gradientDirection))},e.gradientLength=function(){return zS(t.gradientLength,n.gradientLength||n.gradientWidth)},e.gradientThickness=function(){return zS(t.gradientThickness,n.gradientThickness||n.gradientHeight)},e.entryColumns=function(){return zS(t.columns,zS(n.columns,+e.isVertical(!0)))},e}function XT(t,n){var e=n&&(n.update&&n.update[t]||n.enter&&n.enter[t]);return e&&e.signal?e:e?e.value:null}function JT(t,n,e){return"item.anchor === '".concat("start","' ? ").concat(t," : item.anchor === '").concat("end","' ? ").concat(n," : ").concat(e)}var ZT=JT(zt("left"),zt("right"),zt("center"));function QT(t,n){return n?t?B(t)?Object.assign({},t,{offset:QT(t.offset,n)}):{value:t,offset:n}:n:t}function KT(t,n){return n?(t.name=n.name,t.style=n.style||t.style,t.interactive=!!n.interactive,t.encode=cS(t.encode,n,HT)):t.interactive=!1,t}function tB(t,n,e,r){var i,a,u,o,s,l,c=VT(t,e),f=c.isVertical(),h=c.gradientThickness(),d=c.gradientLength();return f?(u=[0,1],o=[0,0],s=h,l=d):(u=[0,0],o=[1,0],s=d,l=h),lS(i={enter:a={opacity:WT,x:WT,y:WT,width:oS(s),height:oS(l)},update:ht({},a,{opacity:YT,fill:{gradient:n,start:u,stop:o}}),exit:{opacity:WT}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),KT({type:"rect",role:"legend-gradient",encode:i},r)}function nB(t,n,e,r,i){var a,u,o,s,l,c,f=VT(t,e),h=f.isVertical(),d=f.gradientThickness(),p=f.gradientLength(),v="";return h?(o="y",l="y2",s="x",c="width",v="1-"):(o="x",l="x2",s="y",c="height"),(u={opacity:WT,fill:{scale:n,field:IT}})[o]={signal:v+"datum.perc",mult:p},u[s]=WT,u[l]={signal:v+"datum.perc2",mult:p},u[c]=oS(d),lS(a={enter:u,update:ht({},u,{opacity:YT}),exit:{opacity:WT}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),KT({type:"rect",role:"legend-band",key:IT,from:i,encode:a},r)}var eB="datum.".concat("perc",'<=0?"').concat("left",'":datum.').concat("perc",'>=1?"').concat("right",'":"').concat("center",'"'),rB="datum.".concat("perc",'<=0?"').concat("bottom",'":datum.').concat("perc",'>=1?"').concat("top",'":"').concat("middle",'"');function iB(t,n,e,r){var i,a,u,o,s,l=VT(t,n),c=l.isVertical(),f=oS(l.gradientThickness()),h=l.gradientLength(),d=l("labelOverlap"),p="";return lS(i={enter:a={opacity:WT},update:u={opacity:YT,text:{field:"label"}},exit:{opacity:WT}},{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:zS(t.labelLimit,n.gradientLabelLimit)}),c?(a.align={value:"left"},a.baseline=u.baseline={signal:rB},o="y",s="x",p="1-"):(a.align=u.align={signal:eB},a.baseline={value:"top"},o="x",s="y"),a[o]=u[o]={signal:p+"datum.perc",mult:h},a[s]=u[s]=f,f.offset=zS(t.labelOffset,n.gradientLabelOffset)||0,d=d?{separation:l("labelSeparation"),method:d,order:"datum.index"}:void 0,KT({type:"text",role:"legend-label",style:"guide-label",key:IT,from:r,encode:i,overlap:d},e)}function aB(t,n,e,r,i){var a,u,o,s,l,c,f,h=VT(t,n),d=e.entries,p=!(!d||!d.interactive),v=d?d.name:void 0,g=h("clipHeight"),m=h("symbolOffset"),y={data:"value"},_={},x="(".concat(i,") ? datum.").concat("offset"," : datum.").concat("size"),b=g?oS(g):{field:"size"},w="datum.".concat("index"),k="max(1, ".concat(i,")");b.mult=.5,_={enter:a={opacity:WT,x:{signal:x,mult:.5,offset:m},y:b},update:u={opacity:YT,x:a.x,y:a.y},exit:{opacity:WT}};var A=null,M=null;return t.fill||(A=n.symbolBaseFillColor,M=n.symbolBaseStrokeColor),lS(_,{fill:h("symbolFillColor",A),shape:h("symbolType"),size:h("symbolSize"),stroke:h("symbolStrokeColor",M),strokeDash:h("symbolDash"),strokeDashOffset:h("symbolDashOffset"),strokeWidth:h("symbolStrokeWidth")},{opacity:h("symbolOpacity")}),$T.forEach((function(n){t[n]&&(u[n]=a[n]={scale:t[n],field:IT})})),s=KT({type:"symbol",role:"legend-symbol",key:IT,from:y,clip:!!g||void 0,encode:_},e.symbols),(o=oS(m)).offset=h("labelOffset"),lS(_={enter:a={opacity:WT,x:{signal:x,offset:o},y:b},update:u={opacity:YT,text:{field:"label"},x:a.x,y:a.y},exit:{opacity:WT}},{align:h("labelAlign"),baseline:h("labelBaseline"),fill:h("labelColor"),fillOpacity:h("labelOpacity"),font:h("labelFont"),fontSize:h("labelFontSize"),fontStyle:h("labelFontStyle"),fontWeight:h("labelFontWeight"),limit:h("labelLimit")}),l=KT({type:"text",role:"legend-label",style:"guide-label",key:IT,from:y,encode:_},e.labels),_={enter:{noBound:{value:!g},width:WT,height:g?oS(g):WT,opacity:WT},exit:{opacity:WT},update:u={opacity:YT,row:{signal:null},column:{signal:null}}},h.isVertical(!0)?(c="ceil(item.mark.items.length / ".concat(k,")"),u.row.signal="".concat(w,"%").concat(c),u.column.signal="floor(".concat(w," / ").concat(c,")"),f={field:["row",w]}):(u.row.signal="floor(".concat(w," / ").concat(k,")"),u.column.signal="".concat(w," % ").concat(k),f={field:w}),u.column.signal="(".concat(i,")?").concat(u.column.signal,":").concat(w),GT({role:"scope",from:r={facet:{data:r,name:"value",groupby:"index"}},encode:cS(_,d,HT),marks:[s,l],name:v,interactive:p,sort:f})}var uB='item.orient === "left"',oB='item.orient === "right"',sB="(".concat(uB," || ").concat(oB,")"),lB="datum.vgrad && ".concat(sB),cB=JT('"top"','"bottom"','"middle"'),fB=JT('"right"','"left"','"center"'),hB="datum.vgrad && ".concat(oB," ? (").concat(fB,") : (").concat(sB," && !(datum.vgrad && ").concat(uB,')) ? "left" : ').concat(ZT),dB="item._anchor || (".concat(sB,' ? "middle" : "start")'),pB="".concat(lB," ? (").concat(uB," ? -90 : 90) : 0"),vB="".concat(sB," ? (datum.vgrad ? (").concat(oB,' ? "bottom" : "top") : ').concat(cB,') : "top"');function gB(t,n){var e;return B(t)&&(t.signal?e=t.signal:t.path?e="pathShape("+mB(t.path)+")":t.sphere&&(e="geoShape("+mB(t.sphere)+', {type: "Sphere"})')),e?n.signalRef(e):!!t}function mB(t){return B(t)&&t.signal?t.signal:zt(t)}function yB(t){var n=t.role||"";return n.indexOf("axis")&&n.indexOf("legend")&&n.indexOf("title")?"group"===t.type?"scope":n||"mark":n}function _B(t){return{marktype:t.type,name:t.name||void 0,role:t.role||yB(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function xB(t,n){return t&&t.signal?n.signalRef(t.signal):!1!==t}function bB(t,n){var e=wu(t.type);e||_("Unrecognized transform type: "+zt(t.type));var r=MS(e.type.toLowerCase(),null,wB(e,t,n));return t.signal&&n.addSignal(t.signal,n.proxy(r)),r.metadata=e.metadata||{},r}function wB(t,n,e){var r,i,a,u={};for(i=0,a=t.params.length;i0?",":"")+(B(n=t[r])?n.signal||bO(n):zt(n));return e+"]"}function kO(t){var n,e,r="{",i=0;for(n in t)e=t[n],r+=(++i>1?",":"")+zt(n)+":"+(B(e)?e.signal||bO(e):zt(e));return r+"}"}xO.parse=function(t){return vO(t,this)},xO.fork=function(){return new _O(this)},xO.isSubscope=function(){return this._subid>0},xO.toRuntime=function(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},xO.id=function(){return(this._subid?this._subid+":":0)+this._id++},xO.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((function(n){n.$ref=t.id})),t.refs=null),t},xO.proxy=function(t){var n=t instanceof AS?CS(t):t;return this.add(_T({value:n}))},xO.addStream=function(t){return this.streams.push(t),t.id=this.id(),t},xO.addUpdate=function(t){return this.updates.push(t),t},xO.finish=function(){var t,n;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function e(t,n,e){var r;t&&((r=t.data||(t.data={}))[n]||(r[n]=[])).push(e)}for(t in this.data)for(var r in e((n=this.data[t]).input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values"),n.index)e(n.index[r],t,"index:"+r);return this},xO.pushState=function(t,n,e){this._encode.push(CS(this.add(kT({pulse:t})))),this._parent.push(n),this._lookup.push(e?CS(this.proxy(e)):null),this._markpath.push(-1)},xO.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},xO.parent=function(){return P(this._parent)},xO.encode=function(){return P(this._encode)},xO.lookup=function(){return P(this._lookup)},xO.markpath=function(){var t=this._markpath;return++t[t.length-1]},xO.fieldRef=function(t,n){if(Et(t))return DS(t,n);t.signal||_("Unsupported field reference: "+zt(t));var e,r=t.signal,i=this.field[r];return i||(e={name:this.signalRef(r)},n&&(e.as=n),this.field[r]=i=CS(this.add(sT(e)))),i},xO.compareRef=function(t){function n(t){return BS(t)?(r=!0,e.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(r=!0,e.exprRef(t.expr)):t}var e=this,r=!1,i=et(t.field).map(n),a=et(t.order).map(n);return r?CS(this.add(rT({fields:i,orders:a}))):SS(i,a)},xO.keyRef=function(t,n){var e=this.signals,r=!1;return t=et(t).map((function(t){return BS(t)?(r=!0,CS(e[t.signal])):t})),r?CS(this.add(lT({fields:t,flat:n}))):function(t,n){var e={$key:t};return n&&(e.$flat=!0),e}(t,n)},xO.sortRef=function(t){if(!t)return t;var n=TS(t.op,t.field),e=t.order||"ascending";return e.signal?CS(this.add(rT({fields:n,orders:this.signalRef(e.signal)}))):SS(n,e)},xO.event=function(t,n){var e=t+":"+n;if(!this.events[e]){var r=this.id();this.streams.push({id:r,source:t,type:n}),this.events[e]=r}return this.events[e]},xO.hasOwnSignal=function(t){return gt(this.signals,t)},xO.addSignal=function(t,n){this.hasOwnSignal(t)&&_("Duplicate signal name: "+zt(t));var e=n instanceof AS?n:this.add(ES(n));return this.signals[t]=e},xO.getSignal=function(t){return this.signals[t]||_("Unrecognized signal name: "+zt(t)),this.signals[t]},xO.signalRef=function(t){return this.signals[t]?CS(this.signals[t]):(gt(this.lambdas,t)||(this.lambdas[t]=this.add(ES(null))),CS(this.lambdas[t]))},xO.parseLambdas=function(){for(var t=Object.keys(this.lambdas),n=0,e=t.length;n=r&&t=i?1:(n-r+1)/a},u.icdf=function(t){return t>=0&&t<=1?r-1+Math.floor(t*a):NaN},u.min(n).max(e)},t.randomKDE=Qu,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=ro,t.randomMixture=io,t.randomNormal=Zu,t.randomUniform=lo,t.read=Va,t.regressionExp=mo,t.regressionLinear=vo,t.regressionLoess=wo,t.regressionLog=go,t.regressionPoly=xo,t.regressionPow=yo,t.regressionQuad=_o,t.renderModule=Wm,t.repeat=Tt,t.resetDefaultLocale=function(){return Ye(),Ia(),Ga()},t.resetSVGClipId=uf,t.resetSVGDefIds=function(){uf(),tl=0},t.responseType=re,t.runtimeContext=jF,t.sampleCurve=Eo,t.sampleLogNormal=Ku,t.sampleNormal=Gu,t.sampleUniform=ao,t.scale=Sg,t.sceneEqual=Qm,t.sceneFromJSON=id,t.scenePickVisit=Xf,t.sceneToJSON=rd,t.sceneVisit=Vf,t.sceneZOrder=Gf,t.scheme=Vg,t.setRandom=function(n){t.random=n},t.span=Ot,t.splitAccessPath=x,t.stringValue=zt,t.textMetrics=zh,t.timeBin=yi,t.timeFloor=Jr,t.timeFormatLocale=Ha,t.timeInterval=ei,t.timeOffset=ai,t.timeSequence=si,t.timeUnitSpecifier=sr,t.timeUnits=ur,t.toBoolean=Rt,t.toDate=Pt,t.toNumber=q,t.toSet=Lt,t.toString=qt,t.transform=ku,t.transforms=bu,t.truncate=Ut,t.truthy=C,t.tupleid=Vt,t.typeParsers=Fn,t.utcFloor=Kr,t.utcInterval=ri,t.utcOffset=ui,t.utcSequence=li,t.utcdayofyear=Ur,t.utcquarter=nt,t.utcweek=jr,t.version="5.13.0",t.visitArray=jt,t.week=Rr,t.writeConfig=R,t.zero=M,t.zoomLinear=J,t.zoomLog=Z,t.zoomPow=Q,t.zoomSymlog=K,Object.defineProperty(t,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega/build/vega-core.js b/node_modules/vega/build/vega-core.js deleted file mode 100644 index e7cc954..0000000 --- a/node_modules/vega/build/vega-core.js +++ /dev/null @@ -1,32906 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dsv'), require('topojson-client'), require('d3-format'), require('d3-time'), require('d3-time-format'), require('d3-shape'), require('d3-path'), require('d3-interpolate'), require('d3-geo'), require('d3-color'), require('d3-force'), require('d3-hierarchy'), require('d3-timer')) : - typeof define === 'function' && define.amd ? define(['exports', 'd3-dsv', 'topojson-client', 'd3-format', 'd3-time', 'd3-time-format', 'd3-shape', 'd3-path', 'd3-interpolate', 'd3-geo', 'd3-color', 'd3-force', 'd3-hierarchy', 'd3-timer'], factory) : - (global = global || self, factory(global.vega = {}, global.d3, global.topojson, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3, global.d3)); -}(this, (function (exports, d3Dsv, topojsonClient, d3Format, d3Time, d3TimeFormat, d3Shape, d3Path, $$1, d3Geo, d3Color, d3Force, d3Hierarchy, d3Timer) { 'use strict'; - - function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; - } - - function accessorName(fn) { - return fn == null ? null : fn.fname; - } - - function accessorFields(fn) { - return fn == null ? null : fn.fields; - } - - function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); - } - - const get1 = field => function(obj) { - return obj[field]; - }; - - const getN = path => { - const len = path.length; - return function(obj) { - for (let i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - return obj; - }; - }; - - function error(message) { - throw Error(message); - } - - function splitAccessPath(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, j, c; - - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i=j=0; j i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; - } - - function field(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor( - (opt && opt.get || getter)(path), - [field], - name || field - ); - } - - var empty = []; - - var id = field('id'); - - var identity = accessor(function(_) { return _; }, empty, 'identity'); - - var zero = accessor(function() { return 0; }, empty, 'zero'); - - var one = accessor(function() { return 1; }, empty, 'one'); - - var truthy = accessor(function() { return true; }, empty, 'true'); - - var falsy = accessor(function() { return false; }, empty, 'false'); - - function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console - } - - var None = 0; - var Error$1 = 1; - var Warn = 2; - var Info = 3; - var Debug = 4; - - function logger(_, method) { - var level = _ || None; - return { - level: function(_) { - if (arguments.length) { - level = +_; - return this; - } else { - return level; - } - }, - error: function() { - if (level >= Error$1) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function() { - if (level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function() { - if (level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function() { - if (level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; - } - - var isArray = Array.isArray; - - function isObject(_) { - return _ === Object(_); - } - - const isLegalKey = key => key !== '__proto__'; - - function mergeConfig(...configs) { - return configs.reduce((out, source) => { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? {layout: 1} - : key === 'style' ? true - : null; - writeConfig(out, key, source[key], r); - } - } - return out; - }, {}); - } - - function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - - var k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : (output[key] = {}); - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } - } - - function mergeNamed(a, b) { - if (a == null) return b; - - const map = {}, out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; - } - - function peek(array) { - return array[array.length - 1]; - } - - function toNumber(_) { - return _ == null || _ === '' ? null : +_; - } - - function exp(sign) { - return function(x) { return sign * Math.exp(x); }; - } - - function log$1(sign) { - return function(x) { return Math.log(sign * x); }; - } - - function symlog(c) { - return function(x) { return Math.sign(x) * Math.log1p(Math.abs(x / c)); }; - } - - function symexp(c) { - return function(x) { return Math.sign(x) * Math.expm1(Math.abs(x)) * c; }; - } - - function pow(exponent) { - return function(x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; - } - - function pan(domain, delta, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - dd = (d1 - d0) * delta; - - return [ - ground(d0 - dd), - ground(d1 - dd) - ]; - } - - function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); - } - - function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log$1(sign), exp(sign)); - } - - function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1/exponent)); - } - - function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); - } - - function zoom(domain, anchor, scale, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - - return [ - ground(da + (d0 - da) * scale), - ground(da + (d1 - da) * scale) - ]; - } - - function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); - } - - function zoomLog(domain, anchor, scale) { - var sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log$1(sign), exp(sign)); - } - - function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1/exponent)); - } - - function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); - } - - function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); - } - - function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); - } - - function array(_) { - return _ != null ? (isArray(_) ? _ : [_]) : []; - } - - /** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ - function clampRange(range, min, max) { - var lo = range[0], - hi = range[1], - span; - - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - span = hi - lo; - - return span >= (max - min) - ? [min, max] - : [ - (lo = Math.min(Math.max(lo, min), max - span)), - lo + span - ]; - } - - function isFunction(_) { - return typeof _ === 'function'; - } - - const DESCENDING = 'descending'; - - function compare(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - - const ord = [], get = [], fmap = {}, - gen = opt.comparator || comparator; - - array(fields).forEach((f, i) => { - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach(_ => fmap[_] = 1); - }); - - return get.length === 0 - ? null - : accessor(gen(get, ord), Object.keys(fmap)); - } - - const compare$1 = (u, v) => (u < v || u == null) && v != null ? -1 - : (u > v || v == null) && u != null ? 1 - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? -1 - : v !== v && u === u ? 1 - : 0; - - const comparator = (fields, orders) => fields.length === 1 - ? compare1(fields[0], orders[0]) - : compareN(fields, orders, fields.length); - - const compare1 = (field, order) => function(a, b) { - return compare$1(field(a), field(b)) * order; - }; - - const compareN = (fields, orders, n) => { - orders.push(0); // pad zero for convenient lookup - return function(a, b) { - let f, c = 0, i = -1; - while (c === 0 && ++i < n) { - f = fields[i]; - c = compare$1(f(a), f(b)); - } - return c * orders[i]; - }; - }; - - function constant(_) { - return isFunction(_) ? _ : function() { return _; }; - } - - function debounce(delay, handler) { - var tid, evt; - - function callback() { - handler(evt); - tid = evt = null; - } - - return function(e) { - evt = e; - if (tid) clearTimeout(tid); - tid = setTimeout(callback, delay); - }; - } - - function extend(_) { - for (var x, k, i=1, len=arguments.length; i max) max = v; - } - } - } else { - // find first valid value - for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])); - min = max = v; - - // visit all other values - for (; i max) max = v; - } - } - } - } - - return [min, max]; - } - - function extentIndex(array, f) { - var i = -1, - n = array.length, - a, b, c, u, v; - - if (f == null) { - while (++i < n) { - b = array[i]; - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = array[i]; - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while (++i < n) { - b = f(array[i], i, array); - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = f(array[i], i, array); - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } - - return [u, v]; - } - - const hop = Object.prototype.hasOwnProperty; - - function hasOwnProperty(object, property) { - return hop.call(object, property); - } - - var NULL = {}; - - function fastmap(input) { - var obj = {}, - map, - test; - - function has(key) { - return hasOwnProperty(obj, key) && obj[key] !== NULL; - } - - map = { - size: 0, - empty: 0, - object: obj, - has: has, - get(key) { - return has(key) ? obj[key] : undefined; - }, - set(key, value) { - if (!has(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - obj[key] = value; - return this; - }, - delete(key) { - if (has(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - return this; - }, - clear() { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test(_) { - if (arguments.length) { - test = _; - return map; - } else { - return test; - } - }, - clean() { - var next = {}, - size = 0, - key, value; - for (key in obj) { - value = obj[key]; - if (value !== NULL && (!test || !test(value))) { - next[key] = value; - ++size; - } - } - map.size = size; - map.empty = 0; - map.object = (obj = next); - } - }; - - if (input) Object.keys(input).forEach(function(key) { - map.set(key, input[key]); - }); - - return map; - } - - function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - - var a = range[0], - b = peek(range), - t = +threshold, - l, r; - - // swap endpoints if range is reversed - if (b < a) { - l = a; a = b; b = l; - } - - // compare value to endpoints - l = Math.abs(value - a); - r = Math.abs(b - value); - - // adjust if value is within threshold distance of endpoint - return l < r && l <= t ? left : r <= t ? right : center; - } - - function inherits(child, parent) { - var proto = (child.prototype = Object.create(parent.prototype)); - proto.constructor = child; - return proto; - } - - /** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ - function inrange(value, range, left, right) { - var r0 = range[0], r1 = range[range.length-1], t; - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - left = left === undefined || left; - right = right === undefined || right; - - return (left ? r0 <= value : r0 < value) && - (right ? value <= r1 : value < r1); - } - - function isBoolean(_) { - return typeof _ === 'boolean'; - } - - function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; - } - - function isNumber(_) { - return typeof _ === 'number'; - } - - function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; - } - - function isString(_) { - return typeof _ === 'string'; - } - - function key(fields, flat, opt) { - if (fields) { - fields = flat - ? array(fields).map(f => f.replace(/\\(.)/g, '$1')) - : array(fields); - } - - const len = fields && fields.length, - gen = opt && opt.get || getter, - map = f => gen(flat ? [f] : splitAccessPath(f)); - let fn; - - if (!len) { - fn = function() { return ''; }; - } else if (len === 1) { - const get = map(fields[0]); - fn = function(_) { return '' + get(_); }; - } else { - const get = fields.map(map); - fn = function(_) { - let s = '' + get[0](_), i = 0; - while (++i < len) s += '|' + get[i](_); - return s; - }; - } - - return accessor(fn, fields, 'key'); - } - - function lerp(array, frac) { - const lo = array[0], - hi = peek(array), - f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); - } - - const DEFAULT_MAX_SIZE = 10000; - - // adapted from https://github.com/dominictarr/hashlru/ (MIT License) - function lruCache(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - - let curr, prev, size; - - const clear = () => { - curr = {}; - prev = {}; - size = 0; - }; - - const update = (key, value) => { - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - return (curr[key] = value); - }; - - clear(); - - return { - clear, - has: key => hasOwnProperty(curr, key) || hasOwnProperty(prev, key), - get: key => hasOwnProperty(curr, key) ? curr[key] - : hasOwnProperty(prev, key) ? update(key, prev[key]) - : undefined, - set: (key, value) => hasOwnProperty(curr, key) - ? (curr[key] = value) - : update(key, value) - }; - } - - function merge(compare, array0, array1, output) { - var n0 = array0.length, - n1 = array1.length; - - if (!n1) return array0; - if (!n0) return array1; - - var merged = output || new array0.constructor(n0 + n1), - i0 = 0, i1 = 0, i = 0; - - for (; i0 0 - ? array1[i1++] - : array0[i0++]; - } - - for (; i0= 0) s += str; - return s; - } - - function pad(str, length, padchar, align) { - var c = padchar || ' ', - s = str + '', - n = length - s.length; - - return n <= 0 ? s - : align === 'left' ? repeat(c, n) + s - : align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2)) - : s + repeat(c, n); - } - - /** - * Return the numerical span of an array: the difference between - * the last and first values. - */ - function span(array) { - return array && (peek(array) - array[0]) || 0; - } - - function $(x) { - return isArray(x) ? '[' + x.map($) + ']' - : isObject(x) || isString(x) ? - // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029') - : x; - } - - function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; - } - - function defaultParser(_) { - return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); - } - - function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); - } - - function toString(_) { - return _ == null || _ === '' ? null : _ + ''; - } - - function toSet(_) { - for (var s={}, i=0, n=_.length; i= 0) { - list.splice(idx, 1); - } - } - return list; - }; - - return list; - } - - /** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ - async function asyncCallback(df, callback) { - try { await callback(df); } catch (err) { df.error(err); } - } - - var TUPLE_ID_KEY = Symbol('vega_id'), - TUPLE_ID = 1; - - /** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ - function isTuple(t) { - return !!(t && tupleid(t)); - } - - /** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ - function tupleid(t) { - return t[TUPLE_ID_KEY]; - } - - /** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ - function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; - } - - /** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ - function ingest(datum) { - var t = (datum === Object(datum)) ? datum : {data: datum}; - return tupleid(t) ? t : setid(t, TUPLE_ID++); - } - - /** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ - function derive(t) { - return rederive(t, ingest({})); - } - - /** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ - function rederive(t, d) { - for (var k in t) d[k] = t[k]; - return d; - } - - /** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ - function replace(t, d) { - return setid(d, tupleid(t)); - } - - /** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ - function stableCompare(cmp, f) { - return !cmp ? null - : f ? (a, b) => cmp(a, b) || (tupleid(f(a)) - tupleid(f(b))) - : (a, b) => cmp(a, b) || (tupleid(a) - tupleid(b)); - } - - function isChangeSet(v) { - return v && v.constructor === changeset; - } - - function changeset() { - var add = [], // insert tuples - rem = [], // remove tuples - mod = [], // modify tuples - remp = [], // remove by predicate - modp = [], // modify by predicate - clean = null, - reflow = false; - - return { - constructor: changeset, - insert: function(t) { - var d = array(t), i = 0, n = d.length; - for (; i 0) { - modify(t, f, m.value); - pulse.modifies(f); - } - } - - // process predicate-based modifications - for (i=0, n=modp.length; i 0) { - modify(t, m.field, m.value); - } - }); - pulse.modifies(m.field); - } - - // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - if (reflow) { - pulse.mod = rem.length || remp.length - ? tuples.filter(function(t) { return cur[tupleid(t)] > 0; }) - : tuples.slice(); - } else { - for (id in out) pulse.mod.push(out[id]); - } - - // set pulse garbage collection request - if (clean || clean == null && (rem.length || remp.length)) { - pulse.clean(true); - } - - return pulse; - } - }; - } - - var CACHE = '_:mod:_'; - - /** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ - function Parameters() { - Object.defineProperty(this, CACHE, {writable: true, value: {}}); - } - - var prototype = Parameters.prototype; - - /** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ - prototype.set = function(name, index, value, force) { - var o = this, - v = o[name], - mod = o[CACHE]; - - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = isArray(value) ? 1 + value.length : -1; - } - - return o; - }; - - /** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ - prototype.modified = function(name, index) { - var mod = this[CACHE], k; - if (!arguments.length) { - for (k in mod) { if (mod[k]) return true; } - return false; - } else if (isArray(name)) { - for (k=0; k= 0) - ? (index + 1 < mod[name] || !!mod[index + ':' + name]) - : !!mod[name]; - }; - - /** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ - prototype.clear = function() { - this[CACHE] = {}; - return this; - }; - - var OP_ID = 0; - var PULSE = 'pulse'; - var NO_PARAMS = new Parameters(); - - // Boolean Flags - var SKIP = 1, - MODIFIED = 2; - - /** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ - function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - - if (update) { - this._update = update; - } - if (params) this.parameters(params, react); - } - - var prototype$1 = Operator.prototype; - - /** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ - prototype$1.targets = function() { - return this._targets || (this._targets = UniqueList(id)); - }; - - /** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ - prototype$1.set = function(value) { - if (this.value !== value) { - this.value = value; - return 1; - } else { - return 0; - } - }; - - function flag(bit) { - return function(state) { - var f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? (f | bit) : (f & ~bit); - return this; - }; - } - - /** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ - prototype$1.skip = flag(SKIP); - - /** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ - prototype$1.modified = flag(MODIFIED); - - /** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initiatal evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ - prototype$1.parameters = function(params, react, initonly) { - react = react !== false; - var self = this, - argval = (self._argval = self._argval || new Parameters()), - argops = (self._argops = self._argops || []), - deps = [], - name, value, n, i; - - function add(name, index, value) { - if (value instanceof Operator) { - if (value !== self) { - if (react) value.targets().add(self); - deps.push(value); - } - argops.push({op:value, name:name, index:index}); - } else { - argval.set(name, index, value); - } - } - - for (name in params) { - value = params[name]; - - if (name === PULSE) { - array(value).forEach(function(op) { - if (!(op instanceof Operator)) { - error('Pulse parameters must be operator instances.'); - } else if (op !== self) { - op.targets().add(self); - deps.push(op); - } - }); - self.source = value; - } else if (isArray(value)) { - argval.set(name, -1, Array(n = value.length)); - for (i=0; i} - The source operators that should propagate - * to the target operator. - */ - function connect(target, sources) { - var targetRank = target.rank, i, n; - - for (i=0, n=sources.length; i pause) { - t = now; - return 1; - } else { - return 0; - } - }); - }; - - prototype$2.debounce = function(delay) { - var s = stream(); - - this.targets().add(stream(null, null, - debounce(delay, function(e) { - var df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }) - )); - - return s; - }; - - prototype$2.between = function(a, b) { - var active = false; - a.targets().add(stream(null, null, function() { active = true; })); - b.targets().add(stream(null, null, function() { active = false; })); - return this.filter(function() { return active; }); - }; - - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ - function events(source, type, filter, apply) { - var df = this, - s = stream(filter, apply), - send = function(e) { - e.dataflow = df; - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally { - df.run(); - } - }, - sources; - - if (typeof source === 'string' && typeof document !== 'undefined') { - sources = document.querySelectorAll(source); - } else { - sources = array(source); - } - - for (var i=0, n=sources.length; i i + 1); - - for (let i = 0, t = 0, j, value; i < n; ++i) { - value = field ? values[i][field] : values[i]; - for (j = 0; j < m; ++j) { - if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - } - - return typeList[ - a.reduce((u, v) => u === 0 ? v : u, 0) - 1 - ]; - } - - function inferTypes(data, fields) { - return fields.reduce(function(types, field) { - types[field] = inferType(data, field); - return types; - }, {}); - } - - // -- Type Checks ---- - - function isValid(_) { - return _ != null && _ === _; - } - - function isBoolean$1(_) { - return _ === 'true' || _ === 'false' || _ === true || _ === false; - } - - function isDate$1(_) { - return !Number.isNaN(Date.parse(_)); - } - - function isNumber$1(_) { - return !Number.isNaN(+_) && !(_ instanceof Date); - } - - function isInteger(_) { - return isNumber$1(_) && Number.isInteger(+_); - } - - function delimitedFormat(delimiter) { - const parse = function(data, format) { - const delim = {delimiter: delimiter}; - return dsv(data, format ? extend(format, delim) : delim); - }; - - parse.responseType = 'text'; - - return parse; - } - - function dsv(data, format) { - if (format.header) { - data = format.header - .map($) - .join(format.delimiter) + '\n' + data; - } - return d3Dsv.dsvFormat(format.delimiter).parse(data + ''); - } - - dsv.responseType = 'text'; - - function isBuffer(_) { - return (typeof Buffer === 'function' && isFunction(Buffer.isBuffer)) - ? Buffer.isBuffer(_) : false; - } - - function json(data, format) { - const prop = (format && format.property) ? field(format.property) : identity; - return isObject(data) && !isBuffer(data) - ? parseJSON(prop(data)) - : prop(JSON.parse(data)); - } - - json.responseType = 'json'; - - function parseJSON(data, format) { - return (format && format.copy) - ? JSON.parse(JSON.stringify(data)) - : data; - } - - const filters = { - interior: (a, b) => a !== b, - exterior: (a, b) => a === b - }; - - function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - - if (format && format.feature) { - method = topojsonClient.feature; - property = format.feature; - } else if (format && format.mesh) { - method = topojsonClient.mesh; - property = format.mesh; - filter = filters[format.filter]; - } else { - error('Missing TopoJSON feature or mesh parameter.'); - } - - object = (object = data.objects[property]) - ? method(data, object, filter) - : error('Invalid TopoJSON object: ' + property); - - return object && object.features || [object]; - } - - topojson.responseType = 'json'; - - const format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson - }; - - function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else { - return hasOwnProperty(format, name) ? format[name] : null; - } - } - - function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; - } - - function memoize(method) { - const cache = {}; - return spec => cache[spec] || (cache[spec] = method(spec)); - } - - function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; - } - - function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; - } - - function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; - } - - var ascendingBisect = bisector(ascending); - var bisectRight = ascendingBisect.right; - var bisectLeft = ascendingBisect.left; - - function variance(values, valueof) { - let count = 0; - let delta; - let mean = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } - if (count > 1) return sum / (count - 1); - } - - function deviation(values, valueof) { - const v = variance(values, valueof); - return v ? Math.sqrt(v) : v; - } - - function sequence(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; - } - - var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - - function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; - } - - function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); - } - - function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; - } - - function max(values, valueof) { - let max; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } - return max; - } - - function min(values, valueof) { - let min; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } - return min; - } - - // Based on https://github.com/mourner/quickselect - // ISC license, Copyright 2018 Vladimir Agafonkin. - function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending) { - while (right > left) { - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - - const t = array[k]; - let i = left; - let j = right; - - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - - while (i < j) { - swap(array, i, j), ++i, --j; - while (compare(array[i], t) < 0) ++i; - while (compare(array[j], t) > 0) --j; - } - - if (compare(array[left], t) === 0) swap(array, left, j); - else ++j, swap(array, j, right); - - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array; - } - - function swap(array, i, j) { - const t = array[i]; - array[i] = array[j]; - array[j] = t; - } - - function number(x) { - return x === null ? NaN : +x; - } - - function* numbers(values, valueof) { - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - yield value; - } - } - } - } - - function quantile(values, p, valueof) { - values = Float64Array.from(numbers(values, valueof)); - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return min(values); - if (p >= 1) return max(values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), - value1 = min(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); - } - - function quantileSorted(values, p, valueof = number) { - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); - } - - function mean(values, valueof) { - let count = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } - if (count) return sum / count; - } - - function median(values, valueof) { - return quantile(values, 0.5, valueof); - } - - function permute(source, keys) { - return Array.from(keys, key => source[key]); - } - - function sum(values, valueof) { - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value = +value) { - sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if (value = +valueof(value, ++index, values)) { - sum += value; - } - } - } - return sum; - } - - function trimZeroes(numberFormat, decimalChar) { - return x => { - var str = numberFormat(x), - dec = str.indexOf(decimalChar), - idx, end; - - if (dec < 0) return str; - - idx = rightmostDigit(str, dec); - end = idx < str.length ? str.slice(idx) : ''; - while (--idx > dec) if (str[idx] !== '0') { ++idx; break; } - - return str.slice(0, idx) + end; - }; - } - - function rightmostDigit(str, dec) { - var i = str.lastIndexOf('e'), c; - if (i > 0) return i; - for (i=str.length; --i > dec;) { - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit - } - } - - function numberLocale(locale) { - const format = memoize(locale.format), - formatPrefix = locale.formatPrefix; - - return { - format, - formatPrefix, - formatFloat(spec) { - var s = d3Format.formatSpecifier(spec || ','); - if (s.precision == null) { - s.precision = 12; - switch (s.type) { - case '%': s.precision -= 2; break; - case 'e': s.precision -= 1; break; - } - return trimZeroes( - format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else { - return format(s); - } - }, - formatSpan(start, stop, count, specifier) { - specifier = d3Format.formatSpecifier(specifier == null ? ',f' : specifier); - const step = tickStep(start, stop, count), - value = Math.max(Math.abs(start), Math.abs(stop)); - let precision; - - if (specifier.precision == null) { - switch (specifier.type) { - case 's': { - if (!isNaN(precision = d3Format.precisionPrefix(step, value))) { - specifier.precision = precision; - } - return formatPrefix(specifier, value); - } - case '': - case 'e': - case 'g': - case 'p': - case 'r': { - if (!isNaN(precision = d3Format.precisionRound(step, value))) { - specifier.precision = precision - (specifier.type === 'e'); - } - break; - } - case 'f': - case '%': { - if (!isNaN(precision = d3Format.precisionFixed(step))) { - specifier.precision = precision - (specifier.type === '%') * 2; - } - break; - } - } - } - return format(specifier); - } - }; - } - - let defaultNumberLocale; - resetNumberFormatDefaultLocale(); - - function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: d3Format.format, - formatPrefix: d3Format.formatPrefix - }); - } - - function numberFormatLocale(definition) { - return numberLocale(d3Format.formatLocale(definition)); - } - - function numberFormatDefaultLocale(definition) { - return arguments.length - ? (defaultNumberLocale = numberFormatLocale(definition)) - : defaultNumberLocale; - } - - const YEAR = 'year'; - const QUARTER = 'quarter'; - const MONTH = 'month'; - const WEEK = 'week'; - const DATE = 'date'; - const DAY = 'day'; - const DAYOFYEAR = 'dayofyear'; - const HOURS = 'hours'; - const MINUTES = 'minutes'; - const SECONDS = 'seconds'; - const MILLISECONDS = 'milliseconds'; - - const TIME_UNITS = [ - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS - ]; - - const UNITS = TIME_UNITS.reduce((o, u, i) => (o[u] = 1 + i, o), {}); - - function timeUnits(units) { - const u = array(units).slice(), - m = {}; - - // check validity - if (!u.length) error('Missing time unit.'); - - u.forEach(unit => { - if (hasOwnProperty(UNITS, unit)) { - m[unit] = 1; - } else { - error(`Invalid time unit: ${unit}.`); - } - }); - - const numTypes = ( - (m[WEEK] || m[DAY] ? 1 : 0) + - (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + - (m[DAYOFYEAR] ? 1 : 0) - ); - - if (numTypes > 1) { - error(`Incompatible time units: ${units}`); - } - - // ensure proper sort order - u.sort((a, b) => UNITS[a] - UNITS[b]); - - return u; - } - - const defaultSpecifiers = { - [YEAR]: '%Y ', - [QUARTER]: 'Q%q ', - [MONTH]: '%b ', - [DATE]: '%d ', - [WEEK]: 'W%U ', - [DAY]: '%a ', - [DAYOFYEAR]: '%j ', - [HOURS]: '%H:00', - [MINUTES]: '00:%M', - [SECONDS]: ':%S', - [MILLISECONDS]: '.%L', - [`${YEAR}-${MONTH}`]: '%Y-%m ', - [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ', - [`${HOURS}-${MINUTES}`]: '%H:%M' - }; - - function timeUnitSpecifier(units, specifiers) { - const s = extend({}, defaultSpecifiers, specifiers), - u = timeUnits(units), - n = u.length; - - let fmt = '', start = 0, end, key; - - for (start=0; start start; --end) { - key = u.slice(start, end).join('-'); - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - } - - return fmt.trim(); - } - - const t0 = new Date; - - function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; - } - - function dayofyear(d) { - return localDayOfYear(new Date(d)); - } - - function week(d) { - return localWeekNum(new Date(d)); - } - - function localDayOfYear(d) { - return d3Time.timeDay.count(localYear(d.getFullYear()) - 1, d); - } - - function localWeekNum(d) { - return d3Time.timeWeek.count(localYear(d.getFullYear()) - 1, d); - } - - function localFirst(y) { - return localYear(y).getDay(); - } - - function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - return new Date(y, m, d, H, M, S, L); - } - - function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); - } - - function utcweek(d) { - return utcWeekNum(new Date(d)); - } - - function utcDayOfYear(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return d3Time.utcDay.count(y - 1, d); - } - - function utcWeekNum(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return d3Time.utcWeek.count(y - 1, d); - } - - function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); - } - - function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(y, m, d, H, M, S, L)); - } - - function floor(units, step, get, inv, newDate) { - const s = step || 1, - b = peek(units), - _ = (unit, p, key) => { - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - - const t = new Date, - u = toSet(units), - y = u[YEAR] ? _(YEAR) : constant(2012), - m = u[MONTH] ? _(MONTH) - : u[QUARTER] ? _(QUARTER) - : zero, - d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) - : u[WEEK] ? _(WEEK, 1) - : u[DAY] ? _(DAY, 1) - : u[DATE] ? _(DATE, 1) - : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) - : one, - H = u[HOURS] ? _(HOURS) : zero, - M = u[MINUTES] ? _(MINUTES) : zero, - S = u[SECONDS] ? _(SECONDS) : zero, - L = u[MILLISECONDS] ? _(MILLISECONDS) : zero; - - return function(v) { - t.setTime(+v); - const year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; - } - - function getUnit(f, inv, step, phase) { - const u = step <= 1 ? f - : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) - : (d, y) => step * Math.floor(f(d, y) / step); - return inv ? (d, y) => inv(u(d, y), y) : u; - } - - // returns the day of the year based on week number, day of week, - // and the day of the week for the first day of the year - function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; - } - - // -- LOCAL TIME -- - - const localGet = { - [YEAR]: d => d.getFullYear(), - [QUARTER]: d => Math.floor(d.getMonth() / 3), - [MONTH]: d => d.getMonth(), - [DATE]: d => d.getDate(), - [HOURS]: d => d.getHours(), - [MINUTES]: d => d.getMinutes(), - [SECONDS]: d => d.getSeconds(), - [MILLISECONDS]: d => d.getMilliseconds(), - [DAYOFYEAR]: d => localDayOfYear(d), - [WEEK]: d => localWeekNum(d), - [WEEK + DAY]: (d, y) => weekday(localWeekNum(d), d.getDay(), localFirst(y)), - [DAY]: (d, y) => weekday(1, d.getDay(), localFirst(y)) - }; - - const localInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday(w, 0, localFirst(y)) - }; - - function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); - } - - // -- UTC TIME -- - - const utcGet = { - [YEAR]: d => d.getUTCFullYear(), - [QUARTER]: d => Math.floor(d.getUTCMonth() / 3), - [MONTH]: d => d.getUTCMonth(), - [DATE]: d => d.getUTCDate(), - [HOURS]: d => d.getUTCHours(), - [MINUTES]: d => d.getUTCMinutes(), - [SECONDS]: d => d.getUTCSeconds(), - [MILLISECONDS]: d => d.getUTCMilliseconds(), - [DAYOFYEAR]: d => utcDayOfYear(d), - [WEEK]: d => utcWeekNum(d), - [DAY]: (d, y) => weekday(1, d.getUTCDay(), utcFirst(y)), - [WEEK + DAY]: (d, y) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)) - }; - - const utcInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday(w, 0, utcFirst(y)) - }; - - function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); - } - - const timeIntervals = { - [YEAR]: d3Time.timeYear, - [QUARTER]: d3Time.timeMonth.every(3), - [MONTH]: d3Time.timeMonth, - [WEEK]: d3Time.timeWeek, - [DATE]: d3Time.timeDay, - [DAY]: d3Time.timeDay, - [DAYOFYEAR]: d3Time.timeDay, - [HOURS]: d3Time.timeHour, - [MINUTES]: d3Time.timeMinute, - [SECONDS]: d3Time.timeSecond, - [MILLISECONDS]: d3Time.timeMillisecond - }; - - const utcIntervals = { - [YEAR]: d3Time.utcYear, - [QUARTER]: d3Time.utcMonth.every(3), - [MONTH]: d3Time.utcMonth, - [WEEK]: d3Time.utcWeek, - [DATE]: d3Time.utcDay, - [DAY]: d3Time.utcDay, - [DAYOFYEAR]: d3Time.utcDay, - [HOURS]: d3Time.utcHour, - [MINUTES]: d3Time.utcMinute, - [SECONDS]: d3Time.utcSecond, - [MILLISECONDS]: d3Time.utcMillisecond - }; - - function timeInterval(unit) { - return timeIntervals[unit]; - } - - function utcInterval(unit) { - return utcIntervals[unit]; - } - - function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; - } - - function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); - } - - function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); - } - - function sequence$1(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; - } - - function timeSequence(unit, start, stop, step) { - return sequence$1(timeInterval(unit), start, stop, step); - } - - function utcSequence(unit, start, stop, step) { - return sequence$1(utcInterval(unit), start, stop, step); - } - - const durationSecond = 1000, - durationMinute = durationSecond * 60, - durationHour = durationMinute * 60, - durationDay = durationHour * 24, - durationWeek = durationDay * 7, - durationMonth = durationDay * 30, - durationYear = durationDay * 365; - - const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], - Seconds = Milli.slice(0, -1), - Minutes = Seconds.slice(0, -1), - Hours = Minutes.slice(0, -1), - Day = Hours.slice(0, -1), - Week = [YEAR, WEEK], - Month = [YEAR, MONTH], - Year = [YEAR]; - - const intervals = [ - [Seconds, 1, durationSecond], - [Seconds, 5, 5 * durationSecond], - [Seconds, 15, 15 * durationSecond], - [Seconds, 30, 30 * durationSecond], - [Minutes, 1, durationMinute], - [Minutes, 5, 5 * durationMinute], - [Minutes, 15, 15 * durationMinute], - [Minutes, 30, 30 * durationMinute], - [ Hours, 1, durationHour ], - [ Hours, 3, 3 * durationHour ], - [ Hours, 6, 6 * durationHour ], - [ Hours, 12, 12 * durationHour ], - [ Day, 1, durationDay ], - [ Week, 1, durationWeek ], - [ Month, 1, durationMonth ], - [ Month, 3, 3 * durationMonth ], - [ Year, 1, durationYear ] - ]; - - function timeBin(opt) { - const ext = opt.extent, - max = opt.maxbins || 40, - target = Math.abs(span(ext)) / max; - - let i = bisector(i => i[2]).right(intervals, target), - units, step; - - if (i === intervals.length) { - units = Year, - step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max); - } else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max(tickStep(ext[0], ext[1], max), 1); - } - - return {units, step}; - } - - function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - if (!isObject(spec)) { - error(`Invalid time multi-format specifier: ${spec}`); - } - - const second = interval(SECONDS), - minute = interval(MINUTES), - hour = interval(HOURS), - day = interval(DATE), - week = interval(WEEK), - month = interval(MONTH), - quarter = interval(QUARTER), - year = interval(YEAR), - L = format(spec[MILLISECONDS] || '.%L'), - S = format(spec[SECONDS] || ':%S'), - M = format(spec[MINUTES] || '%I:%M'), - H = format(spec[HOURS] || '%I %p'), - d = format(spec[DATE] || spec[DAY] || '%a %d'), - w = format(spec[WEEK] || '%b %d'), - m = format(spec[MONTH] || '%B'), - q = format(spec[QUARTER] || '%B'), - y = format(spec[YEAR] || '%Y'); - - return date => ( - second(date) < date ? L : - minute(date) < date ? S : - hour(date) < date ? M : - day(date) < date ? H : - month(date) < date ? (week(date) < date ? d : w) : - year(date) < date ? (quarter(date) < date ? m : q) : - y)(date); - } - - function timeLocale(locale) { - const timeFormat = memoize(locale.format), - utcFormat = memoize(locale.utcFormat); - - return { - timeFormat: spec => isString(spec) - ? timeFormat(spec) - : timeMultiFormat(timeFormat, timeInterval, spec), - utcFormat: spec => isString(spec) - ? utcFormat(spec) - : timeMultiFormat(utcFormat, utcInterval, spec), - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; - } - - let defaultTimeLocale; - resetTimeFormatDefaultLocale(); - - function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: d3TimeFormat.timeFormat, - parse: d3TimeFormat.timeParse, - utcFormat: d3TimeFormat.utcFormat, - utcParse: d3TimeFormat.utcParse - }); - } - - function timeFormatLocale(definition) { - return timeLocale(d3TimeFormat.timeFormatLocale(definition)); - } - - function timeFormatDefaultLocale(definition) { - return arguments.length - ? (defaultTimeLocale = timeFormatLocale(definition)) - : defaultTimeLocale; - } - - const createLocale = (number, time) => extend({}, number, time); - - function locale(numberSpec, timeSpec) { - const number = numberSpec - ? numberFormatLocale(numberSpec) - : numberFormatDefaultLocale(); - - const time = timeSpec - ? timeFormatLocale(timeSpec) - : timeFormatDefaultLocale(); - - return createLocale(number, time); - } - - function defaultLocale(numberSpec, timeSpec) { - const args = arguments.length; - if (args && args !== 2) { - error('defaultLocale expects either zero or two arguments.'); - } - - return args - ? createLocale( - numberFormatDefaultLocale(numberSpec), - timeFormatDefaultLocale(timeSpec) - ) - : createLocale( - numberFormatDefaultLocale(), - timeFormatDefaultLocale() - ); - } - - function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); - } - - function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - - const reader = formats(schema.type || 'json'); - if (!reader) error('Unknown data format type: ' + schema.type); - - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - - if (hasOwnProperty(data, 'columns')) delete data.columns; - return data; - } - - function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - - const locale = timeFormatDefaultLocale(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - - var fields = data.columns || Object.keys(data[0]), - parsers, datum, field, i, j, n, m; - - if (types === 'auto') types = inferTypes(data, fields); - - fields = Object.keys(types); - parsers = fields.map(function(field) { - var type = types[field], - parts, pattern; - - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - - if ((pattern[0] === '\'' && pattern[pattern.length-1] === '\'') || - (pattern[0] === '"' && pattern[pattern.length-1] === '"')) { - pattern = pattern.slice(1, -1); - } - - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - - if (!typeParsers[type]) { - throw Error('Illegal format pattern: ' + field + ':' + type); - } - - return typeParsers[type]; - }); - - for (i=0, n=data.length, m=fields.length; i df.touch(target(e)); - } else if (isFunction(update)) { - op = new Operator(null, update, params, false); - func = e => { - op.evaluate(e); - const t = target(e), v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else { - func = e => df.update(target(e), update, opt); - } - - stream.apply(func); - } - - function onOperator(df, source, target, update, params, options) { - if (update === undefined) { - source.targets().add(target); - } else { - const opt = options || {}, - op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - source.targets().add(op); // add dependency - - if (target) { - op.skip(true); // skip first invocation - op.value = target.value; // initialize value - op.targets().add(target); // chain dependencies - df.connect(target, [op]); // rerank as needed, #1672 - } - } - } - - function updater(target, update) { - update = isFunction(update) ? update : constant(update); - return target - ? function(_, pulse) { - const value = update(_, pulse); - if (!target.skip()) { - target.skip(value !== this.value).value = value; - } - return value; - } - : update; - } - - /** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ - function rank(op) { - op.rank = ++this._rank; - } - - /** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ - function rerank(op) { - var queue = [op], - cur, list, i; - - while (queue.length) { - this.rank(cur = queue.pop()); - if (list = cur._targets) { - for (i=list.length; --i >= 0;) { - queue.push(cur = list[i]); - if (cur === op) error('Cycle detected in dataflow graph.'); - } - } - } - } - - /** - * Sentinel value indicating pulse propagation should stop. - */ - const StopPropagation = {}; - - // Pulse visit type flags - const ADD = (1 << 0), - REM = (1 << 1), - MOD = (1 << 2), - ADD_REM = ADD | REM, - ADD_MOD = ADD | MOD, - ALL = ADD | REM | MOD, - REFLOW = (1 << 3), - SOURCE = (1 << 4), - NO_SOURCE = (1 << 5), - NO_FIELDS = (1 << 6); - - /** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ - function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; - } - - const prototype$3 = Pulse.prototype; - - /** - * Sentinel value indicating pulse propagation should stop. - */ - prototype$3.StopPropagation = StopPropagation; - - /** - * Boolean flag indicating ADD (added) tuples. - */ - prototype$3.ADD = ADD; - - /** - * Boolean flag indicating REM (removed) tuples. - */ - prototype$3.REM = REM; - - /** - * Boolean flag indicating MOD (modified) tuples. - */ - prototype$3.MOD = MOD; - - /** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ - prototype$3.ADD_REM = ADD_REM; - - /** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ - prototype$3.ADD_MOD = ADD_MOD; - - /** - * Boolean flag indicating ADD, REM and MOD tuples. - */ - prototype$3.ALL = ALL; - - /** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ - prototype$3.REFLOW = REFLOW; - - /** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ - prototype$3.SOURCE = SOURCE; - - /** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ - prototype$3.NO_SOURCE = NO_SOURCE; - - /** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ - prototype$3.NO_FIELDS = NO_FIELDS; - - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ - prototype$3.fork = function(flags) { - return new Pulse(this.dataflow).init(this, flags); - }; - - /** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ - prototype$3.clone = function() { - const p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); - }; - - /** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ - prototype$3.addAll = function() { - let p = this; - if (!p.source || p.source.length === p.add.length) { - return p; - } else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - return p; - } - }; - - /** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ - prototype$3.init = function(src, flags) { - const p = this; - p.stamp = src.stamp; - p.encode = src.encode; - - if (src.fields && !(flags & NO_FIELDS)) { - p.fields = src.fields; - } - - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - - return p; - }; - - /** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ - prototype$3.runAfter = function(func) { - this.dataflow.runAfter(func); - }; - - /** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ - prototype$3.changed = function(flags) { - var f = flags || ALL; - return ((f & ADD) && this.add.length) - || ((f & REM) && this.rem.length) - || ((f & MOD) && this.mod.length); - }; - - /** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ - prototype$3.reflow = function(fork) { - if (fork) return this.fork(ALL).reflow(); - - var len = this.add.length, - src = this.source && this.source.length; - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); - } - return this; - }; - - /** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ - prototype$3.clean = function(value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else { - return this.cleans; - } - }; - - /** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ - prototype$3.modifies = function(_) { - var hash = this.fields || (this.fields = {}); - if (isArray(_)) { - _.forEach(f => hash[f] = true); - } else { - hash[_] = true; - } - return this; - }; - - /** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ - prototype$3.modified = function(_, nomod) { - var fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false - : !arguments.length ? !!fields - : isArray(_) ? _.some(f => fields[f]) - : fields[_]; - }; - - /** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ - prototype$3.filter = function(flags, filter) { - var p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; - }; - - function addFilter(a, b) { - return a - ? (t, i) => a(t, i) && b(t, i) - : b; - } - - /** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ - prototype$3.materialize = function(flags) { - flags = flags || ALL; - var p = this; - if ((flags & ADD) && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - if ((flags & REM) && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - if ((flags & MOD) && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - if ((flags & SOURCE) && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - return p; - }; - - function materialize(data, filter) { - var out = []; - visitArray(data, filter, _ => out.push(_)); - return out; - } - - function filter(pulse, flags) { - var map = {}; - pulse.visit(flags, function(t) { map[tupleid(t)] = 1; }); - return t => map[tupleid(t)] ? null : t; - } - - /** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ - prototype$3.visit = function(flags, visitor) { - var p = this, v = visitor, src, sum; - - if (flags & SOURCE) { - visitArray(p.source, p.srcF, v); - return p; - } - - if (flags & ADD) visitArray(p.add, p.addF, v); - if (flags & REM) visitArray(p.rem, p.remF, v); - if (flags & MOD) visitArray(p.mod, p.modF, v); - - if ((flags & REFLOW) && (src = p.source)) { - sum = p.add.length + p.mod.length; - if (sum === src.length) ; else if (sum) { - visitArray(src, filter(p, ADD_MOD), v); - } else { - // if no add/rem/mod tuples, visit source - visitArray(src, p.srcF, v); - } - } - - return p; - }; - - /** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array} pulses - The sub-pulses for this multi-pulse. - */ - function MultiPulse(dataflow, stamp, pulses, encode) { - var p = this, - c = 0, - pulse, hash, i, n, f; - - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - - for (i=0, n=pulses.length; i df._enqueue(op, true)); - df._touched = UniqueList(id); - - let count = 0, op, next, error; - - try { - while (df._heap.size() > 0) { - // dequeue operator with highest priority - op = df._heap.pop(); - - // re-queue if rank changed - if (op.rank !== op.qrank) { - df._enqueue(op, true); - continue; - } - - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - - if (next.then) { - // await if operator returns a promise directly - next = await next; - } else if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach(op => df._enqueue(op)); - } - - // increment visit counter - ++count; - } - } catch (err) { - df._heap.clear(); - error = err; - } - - // reset pulse map - df._input = {}; - df._pulse = null; - - df.debug(`Pulse ${stamp}: ${count} operators`); - - if (error) { - df._postrun = []; - df.error(error); - } - - // invoke callbacks queued via runAfter - if (df._postrun.length) { - const pr = df._postrun.sort((a, b) => b.priority - a.priority); - df._postrun = []; - for (let i=0; i df.runAsync(null, () => { - cb.forEach(f => { try { f(df); } catch (err) { df.error(err); } }); - })); - } - - return df; - } - - /** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ - async function runAsync(encode, prerun, postrun) { - // await previously queued functions - while (this._running) await this._running; - - // run dataflow, manage running promise - const clear = () => this._running = null; - (this._running = this.evaluate(encode, prerun, postrun)) - .then(clear, clear); - - return this._running; - } - - /** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ - function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) - : (this.evaluate(encode, prerun, postrun), this); - } - - /** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ - function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) { - // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - } else { - // pulse propagation already complete, invoke immediately - try { callback(this); } catch (err) { this.error(err); } - } - } - - /** - * Raise an error for re-entrant dataflow evaluation. - */ - function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; - } - - /** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ - function enqueue(op, force) { - var q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - if (q || force) { - op.qrank = op.rank; - this._heap.push(op); - } - } - - /** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ - function getPulse(op, encode) { - var s = op.source, - stamp = this._clock; - - return s && isArray(s) - ? new MultiPulse(this, stamp, s.map(_ => _.pulse), encode) - : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); - } - - function singlePulse(p, s) { - if (s && s.stamp === p.stamp) { - return s; - } - - p = p.fork(); - if (s && s !== StopPropagation) { - p.source = s.source; - } - return p; - } - - var NO_OPT = {skip: false, force: false}; - - /** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - function touch(op, options) { - var opt = options || NO_OPT; - if (this._pulse) { - // if in midst of propagation, add to priority queue - this._enqueue(op); - } else { - // otherwise, queue for next propagation - this._touched.add(op); - } - if (opt.skip) op.skip(true); - return this; - } - - /** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - function update(op, value, options) { - var opt = options || NO_OPT; - if (op.set(value) || opt.force) { - this.touch(op, opt); - } - return this; - } - - /** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - - var p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), - t = op.pulse && op.pulse.source || []; - - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - - return this; - } - - function Heap(cmp) { - var nodes = []; - return { - clear: () => nodes = [], - size: () => nodes.length, - peek: () => nodes[0], - push: x => { - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: () => { - var last = nodes.pop(), item; - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else { - item = last; - } - return item; - } - }; - } - - function siftdown(array, start, idx, cmp) { - var item, parent, pidx; - - item = array[idx]; - while (idx > start) { - pidx = (idx - 1) >> 1; - parent = array[pidx]; - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - break; - } - return (array[idx] = item); - } - - function siftup(array, idx, cmp) { - var start = idx, - end = array.length, - item = array[idx], - cidx = (idx << 1) + 1, ridx; - - while (cidx < end) { - ridx = cidx + 1; - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) { - cidx = ridx; - } - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - array[idx] = item; - return siftdown(array, start, idx, cmp); - } - - /** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ - function Dataflow() { - this.logger(logger()); - this.logLevel(Error$1); - - this._clock = 0; - this._rank = 0; - this._locale = defaultLocale(); - try { - this._loader = loader(); - } catch (e) { - // do nothing if loader module is unavailable - } - - this._touched = UniqueList(id); - this._input = {}; - this._pulse = null; - - this._heap = Heap((a, b) => a.qrank - b.qrank); - this._postrun = []; - } - - var prototype$5 = Dataflow.prototype; - - /** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ - prototype$5.stamp = function() { - return this._clock; - }; - - /** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ - prototype$5.loader = function(_) { - if (arguments.length) { - this._loader = _; - return this; - } else { - return this._loader; - } - }; - - /** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ - prototype$5.locale = function(_) { - if (arguments.length) { - this._locale = _; - return this; - } else { - return this._locale; - } - }; - - /** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ - prototype$5.cleanThreshold = 1e4; - - // OPERATOR REGISTRATION - prototype$5.add = add; - prototype$5.connect = connect; - prototype$5.rank = rank; - prototype$5.rerank = rerank; - - // OPERATOR UPDATES - prototype$5.pulse = pulse; - prototype$5.touch = touch; - prototype$5.update = update; - prototype$5.changeset = changeset; - - // DATA LOADING - prototype$5.ingest = ingest$1; - prototype$5.parse = parse$1; - prototype$5.preload = preload; - prototype$5.request = request; - - // EVENT HANDLING - prototype$5.events = events; - prototype$5.on = on; - - // PULSE PROPAGATION - prototype$5.evaluate = evaluate; - prototype$5.run = run; - prototype$5.runAsync = runAsync; - prototype$5.runAfter = runAfter; - prototype$5._enqueue = enqueue; - prototype$5._getPulse = getPulse; - - // LOGGING AND ERROR HANDLING - - function logMethod(method) { - return function() { - return this._log[method].apply(this, arguments); - }; - } - - /** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ - prototype$5.logger = function(logger) { - if (arguments.length) { - this._log = logger; - return this; - } else { - return this._log; - } - }; - - /** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ - prototype$5.error = logMethod('error'); - - /** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ - prototype$5.warn = logMethod('warn'); - - /** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ - prototype$5.info = logMethod('info'); - - /** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ - prototype$5.debug = logMethod('debug'); - - /** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ - prototype$5.logLevel = logMethod('level'); - - /** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ - function Transform(init, params) { - Operator.call(this, init, null, params); - } - - var prototype$6 = inherits(Transform, Operator); - - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ - prototype$6.run = function(pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - - var rv; - if (this.skip()) { - this.skip(false); - } else { - rv = this.evaluate(pulse); - } - rv = rv || pulse; - - if (rv.then) { - rv = rv.then(_ => this.pulse =_); - } else if (rv !== pulse.StopPropagation) { - this.pulse = rv; - } - - return rv; - }; - - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ - prototype$6.evaluate = function(pulse) { - var params = this.marshall(pulse.stamp), - out = this.transform(params, pulse); - params.clear(); - return out; - }; - - /** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ - prototype$6.transform = function() {}; - - var transforms = {}; - - function definition(type) { - var t = transform(type); - return t && t.Definition || null; - } - - function transform(type) { - type = type && type.toLowerCase(); - return hasOwnProperty(transforms, type) ? transforms[type] : null; - } - - function multikey(f) { - return function(x) { - var n = f.length, - i = 1, - k = String(f[0](x)); - - for (; i {}; - - const base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 - }; - - const AggregateOps = { - values: { - init: m => m.cell.store = true, - value: m => m.cell.data.values(), - idx: -1 - }, - count: { - value: m => m.cell.num - }, - __count__: { - value: m => m.missing + m.valid - }, - missing: { - value: m => m.missing - }, - valid: { - value: m => m.valid - }, - sum: { - init: m => m.sum = 0, - value: m => m.sum, - add: (m, v) => m.sum += +v, - rem: (m, v) => m.sum -= v - }, - product: { - init: m => m.product = 1, - value: m => m.valid ? m.product : undefined, - add: (m, v) => m.product *= v, - rem: (m, v) => m.product /= v - }, - mean: { - init: m => m.mean = 0, - value: m => m.valid ? m.mean : undefined, - add: (m, v) => (m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid), - rem: (m, v) => (m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean) - }, - average: { - value: m => m.valid ? m.mean : undefined, - req: ['mean'], idx: 1 - }, - variance: { - init: m => m.dev = 0, - value: m => m.valid > 1 ? m.dev / (m.valid - 1) : undefined, - add: (m, v) => m.dev += m.mean_d * (v - m.mean), - rem: (m, v) => m.dev -= m.mean_d * (v - m.mean), - req: ['mean'], idx: 1 - }, - variancep: { - value: m => m.valid > 1 ? m.dev / m.valid : undefined, - req: ['variance'], idx: 2 - }, - stdev: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined, - req: ['variance'], idx: 2 - }, - stdevp: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined, - req: ['variance'], idx: 2 - }, - stderr: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined, - req: ['variance'], idx: 2 - }, - distinct: { - value: m => m.cell.data.distinct(m.get), - req: ['values'], idx: 3 - }, - ci0: { - value: m => m.cell.data.ci0(m.get), - req: ['values'], idx: 3 - }, - ci1: { - value: m => m.cell.data.ci1(m.get), - req: ['values'], idx: 3 - }, - median: { - value: m => m.cell.data.q2(m.get), - req: ['values'], idx: 3 - }, - q1: { - value: m => m.cell.data.q1(m.get), - req: ['values'], idx: 3 - }, - q3: { - value: m => m.cell.data.q3(m.get), - req: ['values'], idx: 3 - }, - min: { - init: m => m.min = undefined, - value: m => m.min = (Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min), - add: (m, v) => { if (v < m.min || m.min === undefined) m.min = v; }, - rem: (m, v) => { if (v <= m.min) m.min = NaN; }, - req: ['values'], idx: 4 - }, - max: { - init: m => m.max = undefined, - value: m => m.max = (Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max), - add: (m, v) => { if (v > m.max || m.max === undefined) m.max = v; }, - rem: (m, v) => { if (v >= m.max) m.max = NaN; }, - req: ['values'], idx: 4 - }, - argmin: { - init: m => m.argmin = undefined, - value: m => m.argmin || m.cell.data.argmin(m.get), - add: (m, v, t) => { if (v < m.min) m.argmin = t; }, - rem: (m, v) => { if (v <= m.min) m.argmin = undefined; }, - req: ['min', 'values'], idx: 3 - }, - argmax: { - init: m => m.argmax = undefined, - value: m => m.argmax || m.cell.data.argmax(m.get), - add: (m, v, t) => { if (v > m.max) m.argmax = t; }, - rem: (m, v) => { if (v >= m.max) m.argmax = undefined; }, - req: ['max', 'values'], idx: 3 - } - }; - - const ValidAggregateOps = Object.keys(AggregateOps); - - function measure(key, value) { - return out => extend({ - name: key, - out: out || key - }, base_op, value); - } - - ValidAggregateOps.forEach(key => { - AggregateOps[key] = measure(key, AggregateOps[key]); - }); - - function createMeasure(op, name) { - return AggregateOps[op](name); - } - - function compareIndex(a, b) { - return a.idx - b.idx; - } - - function resolve(agg) { - const map = {}; - agg.forEach(a => map[a.name] = a); - - const getreqs = a => { - if (!a.req) return; - a.req.forEach(key => { - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - agg.forEach(getreqs); - - return Object.values(map).sort(compareIndex); - } - - function init() { - this.valid = 0; - this.missing = 0; - this._ops.forEach(op => op.init(this)); - } - - function add$1(v, t) { - if (v == null || v === '') { ++this.missing; return; } - if (v !== v) return; - ++this.valid; - this._ops.forEach(op => op.add(this, v, t)); - } - - function rem(v, t) { - if (v == null || v === '') { --this.missing; return; } - if (v !== v) return; - --this.valid; - this._ops.forEach(op => op.rem(this, v, t)); - } - - function set(t) { - this._out.forEach(op => t[op.out] = op.value(this)); - return t; - } - - function compileMeasures(agg, field) { - var get = field || identity, - ops = resolve(agg), - out = agg.slice().sort(compareIndex); - - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - - ctr.prototype.init = init; - ctr.prototype.add = add$1; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map(op => op.out); - - return ctr; - } - - function* numbers$1(values, valueof) { - if (valueof == null) { - for (let value of values) { - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - value = valueof(value, ++index, values); - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } - } - - function quantiles(array, p, f) { - var values = Float64Array.from(numbers$1(array, f)); - - // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - values.sort(ascending); - - return p.map(_ => quantileSorted(values, _)); - } - - function quartiles(array, f) { - return quantiles(array, [0.25, 0.50, 0.75], f); - } - - // Scott, D. W. (1992) Multivariate Density Estimation: - // Theory, Practice, and Visualization. Wiley. - function bandwidthNRD(array, f) { - var n = array.length, - v = deviation(array, f), - q = quartiles(array, f), - h = (q[2] - q[0]) / 1.34; - - v = Math.min(v, h) || v || Math.abs(q[0]) || 1; - - return 1.06 * v * Math.pow(n, -0.2); - } - - function bin(_) { - // determine range - var maxb = _.maxbins || 20, - base = _.base || 10, - logb = Math.log(base), - div = _.divide || [5, 2], - min = _.extent[0], - max = _.extent[1], - span = _.span || (max - min) || Math.abs(min) || 1, - step, level, minstep, precision, v, i, n, eps; - - if (_.step) { - // if step size is explicitly given, use that - step = _.step; - } else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - for (i=0, n=_.steps.length; i < n && _.steps[i] < v; ++i); - step = _.steps[Math.max(0, i-1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max( - minstep, - Math.pow(base, Math.round(Math.log(span) / logb) - level) - ); - - // increase step size if too many bins - while (Math.ceil(span/step) > maxb) { step *= base; } - - // decrease step size if allowed - for (i=0, n=div.length; i= minstep && span / v <= maxb) step = v; - } - } - - // update precision, min and max - v = Math.log(step); - precision = v >= 0 ? 0 : ~~(-v / logb) + 1; - eps = Math.pow(base, -precision - 1); - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; - } - - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; - } - - exports.random = Math.random; - - function setRandom(r) { - exports.random = r; - } - - function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [undefined, undefined]; - - var values = Float64Array.from(numbers$1(array, f)), - n = values.length, - m = samples, - a, i, j, mu; - - for (j=0, mu=Array(m); j _); - - let i = 0, j = 1, - n = array.length, - v = new Float64Array(n), - a = f(array[0]), - b = a, - w = a + step, - x; - - for (; j= w) { - b = (a + b) / 2; - for (; i> 1); - while (d < b) v[d++] = v[b]; - while (d > b) v[d--] = v[a]; - } - - // update left stack indices - a = b; - b = c; - } - - return v; - } - - function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function() { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; - } - - function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - - var dist = {}, - a, b, d; - - dist.min = function(_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else { - return a; - } - }; - - dist.max = function(_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else { - return b; - } - }; - - dist.sample = function() { - return a + Math.floor(d * exports.random()); - }; - - dist.pdf = function(x) { - return (x === Math.floor(x) && x >= a && x < b) ? 1 / d : 0; - }; - - dist.cdf = function(x) { - var v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }; - - dist.icdf = function(p) { - return (p >= 0 && p <= 1) ? a - 1 + Math.floor(p * d) : NaN; - }; - - return dist.min(min).max(max); - } - - const SQRT2PI = Math.sqrt(2 * Math.PI); - const SQRT2 = Math.SQRT2; - - let nextSample = NaN; - - function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - - let x = 0, y = 0, rds, c; - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = exports.random() * 2 - 1; - y = exports.random() * 2 - 1; - rds = x * x + y * y; - } while (rds === 0 || rds > 1); - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - x *= c; - nextSample = y * c; - } - return mean + x * stdev; - } - - function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - const z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); - } - - // Approximation from West (2009) - // Better Approximations to Cumulative Normal Functions - function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - - let cd, - z = (value - mean) / stdev, - Z = Math.abs(z); - - if (Z > 37) { - cd = 0; - } else { - let sum, exp = Math.exp(-Z * Z / 2); - if (Z < 7.07106781186547) { - sum = 3.52624965998911e-02 * Z + 0.700383064443688; - sum = sum * Z + 6.37396220353165; - sum = sum * Z + 33.912866078383; - sum = sum * Z + 112.079291497871; - sum = sum * Z + 221.213596169931; - sum = sum * Z + 220.206867912376; - cd = exp * sum; - sum = 8.83883476483184e-02 * Z + 1.75566716318264; - sum = sum * Z + 16.064177579207; - sum = sum * Z + 86.7807322029461; - sum = sum * Z + 296.564248779674; - sum = sum * Z + 637.333633378831; - sum = sum * Z + 793.826512519948; - sum = sum * Z + 440.413735824752; - cd = cd / sum; - } else { - sum = Z + 0.65; - sum = Z + 4 / sum; - sum = Z + 3 / sum; - sum = Z + 2 / sum; - sum = Z + 1 / sum; - cd = exp / sum / 2.506628274631; - } - } - return z > 0 ? 1 - cd : cd; - } - - // Approximation of Probit function using inverse error function. - function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); - } - - // Approximate inverse error function. Implementation from "Approximating - // the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. - // Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 - function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - let w = - Math.log((1 - x) * (1 + x)), p; - - if (w < 6.25) { - w -= 3.125; - p = -3.6444120640178196996e-21; - p = -1.685059138182016589e-19 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -1.333171662854620906e-16 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -4.0545662729752068639e-14 + p * w; - p = -8.1519341976054721522e-14 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -1.2975133253453532498e-11 + p * w; - p = -5.4154120542946279317e-11 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -4.1126339803469836976e-09 + p * w; - p = -2.9070369957882005086e-08 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -1.3654692000834678645e-06 + p * w; - p = -1.3882523362786468719e-05 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.00074070253416626697512 + p * w; - p = -0.0060336708714301490533 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -2.7517406297064545428e-07 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -4.013867526981545969e-06 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -4.7318229009055733981e-05 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628474796 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047313 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.0037512085075692412107 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -2.7109920616438573243e-11; - p = -2.5556418169965252055e-10 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -3.7894654401267369937e-09 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -1.4960026627149240478e-08 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -6.7711997758452339498e-08 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -9.9298272942317002539e-07 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -1.9681778105531670567e-05 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477347 + p * w; - p = -0.00013871931833623122026 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else { - p = Infinity; - } - - return p * x; - } - - function randomNormal(mean, stdev) { - var mu, - sigma, - dist = { - mean: function(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: () => sampleNormal(mu, sigma), - pdf: value => densityNormal(value, mu, sigma), - cdf: value => cumulativeNormal(value, mu, sigma), - icdf: p => quantileNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); - } - - // TODO: support for additional kernels? - function randomKDE(support, bandwidth) { - var kernel = randomNormal(), - dist = {}, - n = 0; - - dist.data = function(_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else { - return support; - } - }; - - dist.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = bandwidthNRD(support); - return dist; - }; - - dist.sample = function() { - return support[~~(exports.random() * n)] + bandwidth * kernel.sample(); - }; - - dist.pdf = function(x) { - for (var y=0, i=0; i sampleLogNormal(mu, sigma), - pdf: value => densityLogNormal(value, mu, sigma), - cdf: value => cumulativeLogNormal(value, mu, sigma), - icdf: p => quantileLogNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); - } - - function randomMixture(dists, weights) { - var dist = {}, m = 0, w; - - function normalize(x) { - var w = [], sum = 0, i; - for (i=0; i= min && value <= max) ? 1 / (max - min) : 0; - } - - function cumulativeUniform(value, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); - } - - function quantileUniform(p, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return (p >= 0 && p <= 1) ? min + p * (max - min) : NaN; - } - - function randomUniform(min, max) { - var a, b, - dist = { - min: function(_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else { - return a; - } - }, - max: function(_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else { - return b; - } - }, - sample: () => sampleUniform(a, b), - pdf: value => densityUniform(value, a, b), - cdf: value => cumulativeUniform(value, a, b), - icdf: p => quantileUniform(p, a, b) - }; - - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return dist.min(min).max(max); - } - - // Ordinary Least Squares - function ols(uX, uY, uXY, uX2) { - const delta = uX2 - uX * uX, - slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, - intercept = uY - slope * uX; - - return [intercept, slope]; - } - - function points(data, x, y, sort) { - data = data.filter(d => { - let u = x(d), v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - - if (sort) { - data.sort((a, b) => x(a) - x(b)); - } - - const n = data.length, - X = new Float64Array(n), - Y = new Float64Array(n); - - // extract values, calculate means - let i = 0, ux = 0, uy = 0, xv, yv, d; - for (d of data) { - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } - - // mean center the data - for (i=0; i= u && v != null && (v = +v) >= v) { - callback(u, v, ++i); - } - } - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function rSquared(data, x, y, uY, predict) { - let SSE = 0, SST = 0; - - visitPoints(data, x, y, (dx, dy) => { - const sse = dy - predict(dx), - sst = dy - uY; - - SSE += sse * sse; - SST += sst * sst; - }); - - return 1 - SSE / SST; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function regressionLinear(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * x; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function regressionLog(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * Math.log(x); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } - - function regressionExp(data, x, y) { - // eslint-disable-next-line no-unused-vars - const [xv, yv, ux, uy] = points(data, x, y); - let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly, xy; - - visitPoints(data, x, y, (_, dy) => { - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - - const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), - predict = x => Math.exp(c0 + c1 * (x - ux)); - - return { - coef: [Math.exp(c0 - c1 * ux), c1], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function regressionPow(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, YS = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - const lx = Math.log(dx), - ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] * Math.pow(x, coef[1]); - - coef[0] = Math.exp(coef[0]); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; - } - - function regressionQuad(data, x, y) { - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length; - - let X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, - i, dx, dy, x2; - - for (i=0; i { - x = x - ux; - return a * x * x + b * x + c + uy; - }; - - // transform coefficients back from mean-centered space - return { - coef: [ - c - b * ux + a * ux * ux + uy, - b - 2 * a * ux, - a - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - // ... which was adapted from regression-js by Tom Alexander - // Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 - // License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE - function regressionPoly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 1) return regressionLinear(data, x, y); - if (order === 2) return regressionQuad(data, x, y); - - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length, - lhs = [], - rhs = [], - k = order + 1; - - let i, j, l, v, c; - - for (i=0; i { - x -= ux; - let y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - for (i=3; i=0; --i) { - v = a[i]; - c = 1; - z[i] += v; - for (j=1; j<=i; ++j) { - c *= (i + 1 - j) / j; // binomial coefficent - z[i-j] += v * Math.pow(x, j) * c; - } - } - - // bias term - z[0] += y; - - return z; - } - - // Given an array for a two-dimensional matrix and the polynomial order, - // solve A * x = b using Gaussian elimination. - function gaussianElimination(matrix) { - const n = matrix.length - 1, - coef = []; - - let i, j, k, r, t; - - for (i = 0; i < n; ++i) { - r = i; // max row - for (j = i + 1; j < n; ++j) { - if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { - r = j; - } - } - - for (k = i; k < n + 1; ++k) { - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - - for (j = i + 1; j < n; ++j) { - for (k = n; k >= i; k--) { - matrix[k][j] -= (matrix[k][i] * matrix[i][j]) / matrix[i][i]; - } - } - } - - for (j = n - 1; j >= 0; --j) { - t = 0; - for (k = j + 1; k < n; ++k) { - t += matrix[k][j] * coef[k]; - } - coef[j] = (matrix[n][j] - t) / matrix[j][j]; - } - - return coef; - } - - const maxiters = 2, - epsilon = 1e-12; - - // Adapted from science.js by Jason Davies - // Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js - // License: https://github.com/jasondavies/science.js/blob/master/LICENSE - function regressionLoess(data, x, y, bandwidth) { - const [xv, yv, ux, uy] = points(data, x, y, true), - n = xv.length, - bw = Math.max(2, ~~(bandwidth * n)), // # nearest neighbors - yhat = new Float64Array(n), - residuals = new Float64Array(n), - robustWeights = new Float64Array(n).fill(1); - - for (let iter = -1; ++iter <= maxiters; ) { - const interval = [0, bw - 1]; - - for (let i = 0; i < n; ++i) { - const dx = xv[i], - i0 = interval[0], - i1 = interval[1], - edge = (dx - xv[i0]) > (xv[i1] - dx) ? i0 : i1; - - let W = 0, X = 0, Y = 0, XY = 0, X2 = 0, - denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - - for (let k = i0; k <= i1; ++k) { - const xk = xv[k], - yk = yv[k], - w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], - xkw = xk * w; - - W += w; - X += xkw; - Y += yk * w; - XY += yk * xkw; - X2 += xk * xkw; - } - - // linear regression fit - const [a, b] = ols(X / W, Y / W, XY / W, X2 / W); - yhat[i] = a + b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - - updateInterval(xv, i + 1, interval); - } - - if (iter === maxiters) { - break; - } - - const medianResidual = median(residuals); - if (Math.abs(medianResidual) < epsilon) break; - - for (let i = 0, arg, w; i < n; ++i){ - arg = residuals[i] / (6 * medianResidual); - // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - robustWeights[i] = (arg >= 1) ? epsilon : ((w = 1 - arg * arg) * w); - } - } - - return output(xv, yhat, ux, uy); - } - - // weighting kernel for local regression - function tricube(x) { - return (x = 1 - x * x * x) * x * x; - } - - // advance sliding window interval of nearest neighbors - function updateInterval(xv, i, interval) { - let val = xv[i], - left = interval[0], - right = interval[1] + 1; - - if (right >= xv.length) return; - - // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - while (i > left && (xv[right] - val) <= (val - xv[left])) { - interval[0] = ++left; - interval[1] = right; - ++right; - } - } - - // generate smoothed output points - // average points with repeated x values - function output(xv, yhat, ux, uy) { - const n = xv.length, out = []; - let i = 0, cnt = 0, prev = [], v; - - for (; i [x, f(x)], - minX = extent[0], - maxX = extent[1], - span = maxX - minX, - stop = span / maxSteps, - prev = [point(minX)], - next = []; - - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for (let i = 1; i < maxSteps; ++i) { - prev.push(point(minX + (i / minSteps) * span)); - } - prev.push(point(maxX)); - return prev; - } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - for (let i = minSteps; --i > 0;) { - next.push(point(minX + (i / minSteps) * span)); - } - } - - let p0 = prev[0], - p1 = next[next.length - 1]; - - while (p1) { - // midpoint for potential curve subdivision - const pm = point((p0[0] + p1[0]) / 2); - - if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) { - // maximum resolution has not yet been met, and - // subdivision midpoint sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - } else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - p1 = next[next.length - 1]; - } - - return prev; - } - - function angleDelta(p, q, r) { - const a0 = Math.atan2(r[1] - p[1], r[0] - p[0]), - a1 = Math.atan2(q[1] - p[1], q[0] - p[0]); - return Math.abs(a0 - a1); - } - - function TupleStore(key) { - this._key = key ? field(key) : tupleid; - this.reset(); - } - - var prototype$7 = TupleStore.prototype; - - prototype$7.reset = function() { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; - }; - - prototype$7.add = function(v) { - this._add.push(v); - }; - - prototype$7.rem = function(v) { - this._rem.push(v); - }; - - prototype$7.values = function() { - this._get = null; - if (this._rem.length === 0) return this._add; - - var a = this._add, - r = this._rem, - k = this._key, - n = a.length, - m = r.length, - x = Array(n - m), - map = {}, i, j, v; - - // use unique key field to clear removed values - for (i=0; i= 0) { - s = get(v[n]) + ''; - if (!hasOwnProperty(map, s)) { - map[s] = 1; - ++count; - } - } - - return count; - }; - - prototype$7.extent = function(get) { - if (this._get !== get || !this._ext) { - var v = this.values(), - i = extentIndex(v, get); - this._ext = [v[i[0]], v[i[1]]]; - this._get = get; - } - return this._ext; - }; - - prototype$7.argmin = function(get) { - return this.extent(get)[0] || {}; - }; - - prototype$7.argmax = function(get) { - return this.extent(get)[1] || {}; - }; - - prototype$7.min = function(get) { - var m = this.extent(get)[0]; - return m != null ? get(m) : undefined; - }; - - prototype$7.max = function(get) { - var m = this.extent(get)[1]; - return m != null ? get(m) : undefined; - }; - - prototype$7.quartile = function(get) { - if (this._get !== get || !this._q) { - this._q = quartiles(this.values(), get); - this._get = get; - } - return this._q; - }; - - prototype$7.q1 = function(get) { - return this.quartile(get)[0]; - }; - - prototype$7.q2 = function(get) { - return this.quartile(get)[1]; - }; - - prototype$7.q3 = function(get) { - return this.quartile(get)[2]; - }; - - prototype$7.ci = function(get) { - if (this._get !== get || !this._ci) { - this._ci = bootstrapCI(this.values(), 1000, 0.05, get); - this._get = get; - } - return this._ci; - }; - - prototype$7.ci0 = function(get) { - return this.ci(get)[0]; - }; - - prototype$7.ci1 = function(get) { - return this.ci(get)[1]; - }; - - /** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.fields] - An array of accessors to aggregate. - * @param {Array} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ - function Aggregate(params) { - Transform.call(this, null, params); - - this._adds = []; // array of added output tuples - this._mods = []; // array of modified output tuples - this._alen = 0; // number of active added tuples - this._mlen = 0; // number of active modified tuples - this._drop = true; // should empty aggregation cells be removed - this._cross = false; // produce full cross-product of group-by values - - this._dims = []; // group-by dimension accessors - this._dnames = []; // group-by dimension names - - this._measures = []; // collection of aggregation monoids - this._countOnly = false; // flag indicating only count aggregation - this._counts = null; // collection of count fields - this._prev = null; // previous aggregation cells - - this._inputs = null; // array of dependent input tuple field names - this._outputs = null; // array of output tuple field names - } - - Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidAggregateOps }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'drop', 'type': 'boolean', 'default': true }, - { 'name': 'cross', 'type': 'boolean', 'default': false }, - { 'name': 'key', 'type': 'field' } - ] - }; - - var prototype$8 = inherits(Aggregate, Transform); - - prototype$8.transform = function(_, pulse) { - var aggr = this, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - mod = _.modified(); - - aggr.stamp = out.stamp; - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, t => aggr.add(t)); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, t => aggr.rem(t)); - pulse.visit(pulse.ADD, t => aggr.add(t)); - } - - // Indicate output fields and return aggregate tuples. - out.modifies(aggr._outputs); - - // Should empty cells be dropped? - aggr._drop = _.drop !== false; - - // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - - if (pulse.clean() && aggr._drop) { - out.clean(true).runAfter(() => this.clean()); - } - - return aggr.changes(out); - }; - - prototype$8.cross = function() { - var aggr = this, - curr = aggr.value, - dims = aggr._dnames, - vals = dims.map(function() { return {}; }), - n = dims.length; - - // collect all group-by domain values - function collect(cells) { - var key, i, t, v; - for (key in cells) { - t = cells[key].tuple; - for (i=0; i stop ? +Infinity - : ( - v = Math.max(start, Math.min(v, stop - step)), - start + step * Math.floor(EPSILON + (v - start) / step) - ); - }; - - f.start = start; - f.stop = bins.stop; - f.step = step; - - return this.value = accessor( - f, - accessorFields(field), - _.name || 'bin_' + accessorName(field) - ); - }; - - function SortedList(idFunc, source, input) { - var $ = idFunc, - data = source || [], - add = input || [], - rem = {}, - cnt = 0; - - return { - add: function(t) { add.push(t); }, - remove: function(t) { rem[$(t)] = ++cnt; }, - size: function() { return data.length; }, - data: function(compare, resort) { - if (cnt) { - data = data.filter(function(t) { return !rem[$(t)]; }); - rem = {}; - cnt = 0; - } - if (resort && compare) { - data.sort(compare); - } - if (add.length) { - data = compare - ? merge(compare, data, add.sort(compare)) - : data.concat(add); - add = []; - } - return data; - } - }; - } - - /** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ - function Collect(params) { - Transform.call(this, [], params); - } - - Collect.Definition = { - 'type': 'Collect', - 'metadata': {'source': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' } - ] - }; - - var prototype$a = inherits(Collect, Transform); - - prototype$a.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), - sort = _.sort, - mod = pulse.changed() || (sort && - (_.modified('sort') || pulse.modified(sort.fields))); - - out.visit(out.REM, list.remove); - - this.modified(mod); - this.value = out.source = list.data(stableCompare(sort), mod); - - // propagate tree root if defined - if (pulse.source && pulse.source.root) { - this.value.root = pulse.source.root; - } - - return out; - }; - - /** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The fields to compare. - * @param {Array} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ - function Compare(params) { - Operator.call(this, null, update$1, params); - } - - inherits(Compare, Operator); - - function update$1(_) { - return (this.value && !_.modified()) - ? this.value - : compare(_.fields, _.orders); - } - - /** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ - function CountPattern(params) { - Transform.call(this, null, params); - } - - CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'case', 'type': 'enum', 'values': ['upper', 'lower', 'mixed'], 'default': 'mixed' }, - { 'name': 'pattern', 'type': 'string', 'default': '[\\w"]+' }, - { 'name': 'stopwords', 'type': 'string', 'default': '' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['text', 'count'] } - ] - }; - - function tokenize(text, tcase, match) { - switch (tcase) { - case 'upper': text = text.toUpperCase(); break; - case 'lower': text = text.toLowerCase(); break; - } - return text.match(match); - } - - var prototype$b = inherits(CountPattern, Transform); - - prototype$b.transform = function(_, pulse) { - function process(update) { - return function(tuple) { - var tokens = tokenize(get(tuple), _.case, match) || [], t; - for (var i=0, n=tokens.length; i} [params.as] - The names of the output fields. - */ - function Cross(params) { - Transform.call(this, null, params); - } - - Cross.Definition = { - 'type': 'Cross', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'filter', 'type': 'expr' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['a', 'b'] } - ] - }; - - var prototype$c = inherits(Cross, Transform); - - prototype$c.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - data = this.value, - as = _.as || ['a', 'b'], - a = as[0], b = as[1], - reset = !data - || pulse.changed(pulse.ADD_REM) - || _.modified('as') - || _.modified('filter'); - - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || truthy); - } else { - out.mod = data; - } - - out.source = this.value; - return out.modifies(as); - }; - - function cross(input, a, b, filter) { - var data = [], - t = {}, - n = input.length, - i = 0, - j, left; - - for (; i} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ - function parse$2(def, data) { - var func = def[FUNCTION]; - if (!hasOwnProperty(Distributions, func)) { - error('Unknown distribution function: ' + func); - } - - var d = Distributions[func](); - - for (var name in def) { - // if data field, extract values - if (name === FIELD) { - d.data((def.from || data()).map(def[name])); - } - - // if distribution mixture, recurse to parse each definition - else if (name === DISTRIBUTIONS) { - d[name](def[name].map(function(_) { return parse$2(_, data); })); - } - - // otherwise, simply set the parameter - else if (typeof d[name] === FUNCTION) { - d[name](def[name]); - } - } - - return d; - } - - /** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - function Density(params) { - Transform.call(this, null, params); - } - - var distributions = [ - { - 'key': {'function': 'normal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'lognormal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'uniform'}, - 'params': [ - { 'name': 'min', 'type': 'number', 'default': 0 }, - { 'name': 'max', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'kde'}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'from', 'type': 'data' }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 } - ] - } - ]; - - var mixture = { - 'key': {'function': 'mixture'}, - 'params': [ - { 'name': 'distributions', 'type': 'param', 'array': true, - 'params': distributions }, - { 'name': 'weights', 'type': 'number', 'array': true } - ] - }; - - Density.Definition = { - 'type': 'Density', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'method', 'type': 'string', 'default': 'pdf', - 'values': ['pdf', 'cdf'] }, - { 'name': 'distribution', 'type': 'param', - 'params': distributions.concat(mixture) }, - { 'name': 'as', 'type': 'string', 'array': true, - 'default': ['value', 'density'] } - ] - }; - - var prototype$d = inherits(Density, Transform); - - prototype$d.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var dist = parse$2(_.distribution, source(pulse)), - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200, - method = _.method || 'pdf'; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - if (!_.extent && !dist.data) { - error('Missing density extent parameter.'); - } - method = dist[method]; - - var as = _.as || ['value', 'density'], - domain = _.extent || extent(dist.data()), - values = sampleCurve(method, domain, minsteps, maxsteps).map(v => { - var tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return ingest(tuple); - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; - }; - - function source(pulse) { - return function() { return pulse.materialize(pulse.SOURCE).source; }; - } - - // use either provided alias or accessor field name - function fieldNames(fields, as) { - if (!fields) return null; - return fields.map(function(f, i) { - return as[i] || accessorName(f); - }); - } - - function partition(data, groupby, field) { - var groups = [], - get = function(f) { return f(t); }, - map, i, n, t, k, g; - - // partition data points into groups - if (groupby == null) { - groups.push(data.map(field)); - } else { - for (map={}, i=0, n=data.length; i} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ - function DotBin(params) { - Transform.call(this, null, params); - } - - DotBin.Definition = { - 'type': 'DotBin', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'step', 'type': 'number' }, - { 'name': 'smooth', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': Output } - ] - }; - - const prototype$e = inherits(DotBin, Transform); - - prototype$e.transform = function(_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) { - return pulse; // early exit - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(pulse.source, _.groupby, identity), - smooth = _.smooth || false, - field = _.field, - step = _.step || autostep(source, field), - sort = stableCompare((a, b) => field(a) - field(b)), - as = _.as || Output, - n = groups.length; - - // compute dotplot bins per group - let min = Infinity, max = -Infinity, i = 0, j; - for (; i max) max = v; - g[++j][as] = v; - } - } - - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); - }; - - function autostep(data, field) { - return span(extent(data, field)) / 30; - } - - /** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ - function Expression(params) { - Operator.call(this, null, update$2, params); - this.modified(true); - } - - inherits(Expression, Operator); - - function update$2(_) { - var expr = _.expr; - return this.value && !_.modified('expr') - ? this.value - : accessor( - datum => expr(datum, _), - accessorFields(expr), - accessorName(expr) - ); - } - - /** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ - function Extent(params) { - Transform.call(this, [undefined, undefined], params); - } - - Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true } - ] - }; - - var prototype$f = inherits(Extent, Transform); - - prototype$f.transform = function(_, pulse) { - var extent = this.value, - field = _.field, - min = extent[0], - max = extent[1], - mod; - - mod = pulse.changed() - || pulse.modified(field.fields) - || _.modified('field'); - - if (mod || min == null) { - min = +Infinity; - max = -Infinity; - } - - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, function(t) { - var v = toNumber(field(t)); - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - - if (!Number.isFinite(min) || !Number.isFinite(max)) { - let name = accessorName(field); - if (name) name = ` for field "${name}"`; - pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`); - min = max = undefined; - } - this.value = [min, max]; - }; - - /** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ - function Subflow(pulse, parent) { - Operator.call(this, pulse); - this.parent = parent; - this.count = 0; - } - - var prototype$g = inherits(Subflow, Operator); - - /** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ - prototype$g.connect = function(target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return (target.source = this); - }; - - /** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ - prototype$g.add = function(t) { - this.count += 1; - this.value.add.push(t); - }; - - /** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ - prototype$g.rem = function(t) { - this.count -= 1; - this.value.rem.push(t); - }; - - /** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ - prototype$g.mod = function(t) { - this.value.mod.push(t); - }; - - /** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ - prototype$g.init = function(pulse) { - this.value.init(pulse, pulse.NO_SOURCE); - }; - - /** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ - prototype$g.evaluate = function() { - // assert: this.value.stamp === pulse.stamp - return this.value; - }; - - /** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ - function Facet(params) { - Transform.call(this, {}, params); - this._keys = fastmap(); // cache previously calculated key values - - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - const a = this._targets = []; - a.active = 0; - a.forEach = f => { - for (let i=0, n=a.active; i this.subflow(key, flow, pulse); - - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - - pulse.visit(pulse.REM, t => { - const id = tupleid(t), - k = cache.get(id); - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - - pulse.visit(pulse.ADD, t => { - const k = key(t); - cache.set(tupleid(t), k); - subflow(k).add(t); - }); - - if (rekey || pulse.modified(key.fields)) { - pulse.visit(pulse.MOD, t => { - const id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 === k1) { - subflow(k1).mod(t); - } else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } else if (pulse.changed(pulse.MOD)) { - pulse.visit(pulse.MOD, t => { - subflow(cache.get(tupleid(t))).mod(t); - }); - } - - if (rekey) { - pulse.visit(pulse.REFLOW, t => { - const id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } - - if (pulse.clean()) { - df.runAfter(() => { this.clean(); cache.clean(); }); - } else if (cache.empty > df.cleanThreshold) { - df.runAfter(cache.clean); - } - - return pulse; - }; - - /** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ - function Field(params) { - Operator.call(this, null, update$3, params); - } - - inherits(Field, Operator); - - function update$3(_) { - return (this.value && !_.modified()) ? this.value - : isArray(_.name) ? array(_.name).map(function(f) { return field(f); }) - : field(_.name, _.as); - } - - /** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ - function Filter(params) { - Transform.call(this, fastmap(), params); - } - - Filter.Definition = { - 'type': 'Filter', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'expr', 'type': 'expr', 'required': true } - ] - }; - - var prototype$i = inherits(Filter, Transform); - - prototype$i.transform = function(_, pulse) { - var df = pulse.dataflow, - cache = this.value, // cache ids of filtered tuples - output = pulse.fork(), - add = output.add, - rem = output.rem, - mod = output.mod, - test = _.expr, - isMod = true; - - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - if (!cache.has(id)) rem.push(t); - else cache.delete(id); - }); - - pulse.visit(pulse.ADD, function(t) { - if (test(t, _)) add.push(t); - else cache.set(tupleid(t), 1); - }); - - function revisit(t) { - var id = tupleid(t), - b = test(t, _), - s = cache.get(id); - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) { - mod.push(t); - } - } - - pulse.visit(pulse.MOD, revisit); - - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; - }; - - /** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ - function Flatten(params) { - Transform.call(this, [], params); - } - - Flatten.Definition = { - 'type': 'Flatten', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'index', 'type': 'string' }, - { 'name': 'as', 'type': 'string', 'array': true } - ] - }; - - var prototype$j = inherits(Flatten, Transform); - - prototype$j.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - as = fieldNames(fields, _.as || []), - index = _.index || null, - m = as.length; - - // remove any previous results - out.rem = this.value; - - // generate flattened tuples - pulse.visit(pulse.SOURCE, function(t) { - var arrays = fields.map(f => f(t)), - maxlen = arrays.reduce((l, a) => Math.max(l, a.length), 0), - i = 0, j, d, v; - - for (; i} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ - function Fold(params) { - Transform.call(this, [], params); - } - - Fold.Definition = { - 'type': 'Fold', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['key', 'value'] } - ] - }; - - var prototype$k = inherits(Fold, Transform); - - prototype$k.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - fnames = fields.map(accessorName), - as = _.as || ['key', 'value'], - k = as[0], - v = as[1], - n = fields.length; - - out.rem = this.value; - - pulse.visit(pulse.SOURCE, function(t) { - for (var i=0, d; i t[as] = func(t, _)); - }; - - /** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ - function Generate(params) { - Transform.call(this, [], params); - } - - var prototype$m = inherits(Generate, Transform); - - prototype$m.transform = function(_, pulse) { - var data = this.value, - out = pulse.fork(pulse.ALL), - num = _.size - data.length, - gen = _.generator, - add, rem, t; - - if (num > 0) { - // need more tuples, generate and add - for (add=[]; --num >= 0;) { - add.push(t = ingest(gen(_))); - data.push(t); - } - out.add = out.add.length - ? out.materialize(out.ADD).add.concat(add) - : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length - ? out.materialize(out.REM).rem.concat(rem) - : rem; - data = data.slice(-num); - } - - out.source = this.value = data; - return out; - }; - - var Methods = { - value: 'value', - median: median, - mean: mean, - min: min, - max: max - }; - - var Empty = []; - - /** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ - function Impute(params) { - Transform.call(this, [], params); - } - - Impute.Definition = { - 'type': 'Impute', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'key', 'type': 'field', 'required': true }, - { 'name': 'keyvals', 'array': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'enum', 'default': 'value', - 'values': ['value', 'mean', 'median', 'max', 'min'] }, - { 'name': 'value', 'default': 0 } - ] - }; - - var prototype$n = inherits(Impute, Transform); - - function getValue(_) { - var m = _.method || Methods.value, v; - - if (Methods[m] == null) { - error('Unrecognized imputation method: ' + m); - } else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return function() { return v; }; - } else { - return Methods[m]; - } - } - - function getField(_) { - var f = _.field; - return function(t) { return t ? f(t) : NaN; }; - } - - prototype$n.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - impute = getValue(_), - field = getField(_), - fName = accessorName(_.field), - kName = accessorName(_.key), - gNames = (_.groupby || []).map(accessorName), - groups = partition$1(pulse.source, _.groupby, _.key, _.keyvals), - curr = [], - prev = this.value, - m = groups.domain.length, - group, value, gVals, kVal, g, i, j, l, n, t; - - for (g=0, l=groups.length; g} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - function KDE(params) { - Transform.call(this, null, params); - } - - KDE.Definition = { - 'type': 'KDE', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'cumulative', 'type': 'boolean', 'default': false }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['value', 'density'] } - ] - }; - - var prototype$p = inherits(KDE, Transform); - - prototype$p.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - bandwidth = _.bandwidth, - method = _.cumulative ? 'cdf' : 'pdf', - as = _.as || ['value', 'density'], - values = []; - - let domain = _.extent, - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - - if (_.resolve === 'shared') { - if (!domain) domain = extent(source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - - groups.forEach(g => { - const density = randomKDE(g, bandwidth)[method], - scale = _.counts ? g.length : 1, - local = domain || extent(g); - - sampleCurve(density, local, minsteps, maxsteps).forEach(v => { - const t = {}; - for (let i=0; i} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ - function Key(params) { - Operator.call(this, null, update$4, params); - } - - inherits(Key, Operator); - - function update$4(_) { - return (this.value && !_.modified()) ? this.value : key(_.fields, _.flat); - } - - /** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ - function Load(params) { - Transform.call(this, [], params); - this._pending = null; - } - - var prototype$q = inherits(Load, Transform); - - prototype$q.transform = function(_, pulse) { - const df = pulse.dataflow; - - if (this._pending) { - // update state and return pulse - return output$1(this, pulse, this._pending); - } - - if (stop(_)) return pulse.StopPropagation; - - if (_.values) { - // parse and ingest values, return output pulse - return output$1(this, pulse, df.parse(_.values, _.format)); - } else if (_.async) { - // return promise for non-blocking async loading - const p = df.request(_.url, _.format).then(res => { - this._pending = array(res.data); - return df => df.touch(this); - }); - return {async: p}; - } else { - // return promise for synchronous loading - return df.request(_.url, _.format) - .then(res => output$1(this, pulse, array(res.data))); - } - }; - - function stop(_) { - return _.modified('async') && !( - _.modified('values') || _.modified('url') || _.modified('format') - ); - } - - function output$1(op, pulse, data) { - data.forEach(ingest); - const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; - } - - /** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ - function Lookup(params) { - Transform.call(this, {}, params); - } - - Lookup.Definition = { - 'type': 'Lookup', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'index', 'type': 'index', 'params': [ - {'name': 'from', 'type': 'data', 'required': true }, - {'name': 'key', 'type': 'field', 'required': true } - ] }, - { 'name': 'values', 'type': 'field', 'array': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true }, - { 'name': 'default', 'default': null } - ] - }; - - var prototype$r = inherits(Lookup, Transform); - - prototype$r.transform = function(_, pulse) { - var out = pulse, - as = _.as, - keys = _.fields, - index = _.index, - values = _.values, - defaultValue = _.default==null ? null : _.default, - reset = _.modified(), - flag = reset ? pulse.SOURCE : pulse.ADD, - n = keys.length, - set, m, mods; - - if (values) { - m = values.length; - - if (n > 1 && !as) { - error('Multi-field lookup requires explicit "as" parameter.'); - } - if (as && as.length !== n * m) { - error('The "as" parameter has too few output field names.'); - } - as = as || values.map(accessorName); - - set = function(t) { - for (var i=0, k=0, j, v; i>} params.extents - The input extents. - */ - function MultiExtent(params) { - Operator.call(this, null, update$5, params); - } - - inherits(MultiExtent, Operator); - - function update$5(_) { - if (this.value && !_.modified()) { - return this.value; - } - - var min = +Infinity, - max = -Infinity, - ext = _.extents, - i, n, e; - - for (i=0, n=ext.length; i max) max = e[1]; - } - return [min, max]; - } - - /** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.values - The input value arrrays. - */ - function MultiValues(params) { - Operator.call(this, null, update$6, params); - } - - inherits(MultiValues, Operator); - - function update$6(_) { - return (this.value && !_.modified()) - ? this.value - : _.values.reduce(function(data, _) { return data.concat(_); }, []); - } - - /** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ - function Params(params) { - Transform.call(this, null, params); - } - - inherits(Params, Transform); - - Params.prototype.transform = function(_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples - }; - - /** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ - function Pivot(params) { - Aggregate.call(this, params); - } - - Pivot.Definition = { - 'type': 'Pivot', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'value', 'type': 'field', 'required': true }, - { 'name': 'op', 'type': 'enum', 'values': ValidAggregateOps, 'default': 'sum' }, - { 'name': 'limit', 'type': 'number', 'default': 0 }, - { 'name': 'key', 'type': 'field' } - ] - }; - - var prototype$s = inherits(Pivot, Aggregate); - - prototype$s._transform = prototype$s.transform; - - prototype$s.transform = function(_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); - }; - - // Shoehorn a pivot transform into an aggregate transform! - // First collect all unique pivot field values. - // Then generate aggregate fields for each output pivot field. - function aggregateParams(_, pulse) { - var key = _.field, - value = _.value, - op = (_.op === 'count' ? '__count__' : _.op) || 'sum', - fields = accessorFields(key).concat(accessorFields(value)), - keys = pivotKeys(key, _.limit || 0, pulse); - - // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - if (pulse.changed()) _.set('__pivot__', null, null, true); - - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(function() { return op; }), - fields: keys.map(function(k) { return get(k, key, value, fields); }), - as: keys.map(function(k) { return k + ''; }), - modified: _.modified.bind(_) - }; - } - - // Generate aggregate field accessor. - // Output NaN for non-existent values; aggregator will ignore! - function get(k, key, value, fields) { - return accessor( - function(d) { return key(d) === k ? value(d) : NaN; }, - fields, - k + '' - ); - } - - // Collect (and optionally limit) all unique pivot values. - function pivotKeys(key, limit, pulse) { - var map = {}, - list = []; - - pulse.visit(pulse.SOURCE, function(t) { - var k = key(t); - if (!map[k]) { - map[k] = 1; - list.push(k); - } - }); - - // TODO? Move this comparator to vega-util? - list.sort(function(u, v) { - return (uv||v==null) && u!=null ? 1 - : ((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))!==u && v===v ? -1 - : v!==v && u===u ? 1 : 0; - }); - - return limit ? list.slice(0, limit) : list; - } - - /** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array} params.field - The field - * accessor for an array of subflow tuple objects. - */ - function PreFacet(params) { - Facet.call(this, params); - } - - const prototype$t = inherits(PreFacet, Facet); - - prototype$t.transform = function(_, pulse) { - const flow = _.subflow, - field = _.field, - subflow = t => this.subflow(tupleid(t), flow, pulse, t); - - if (_.modified('field') || field && pulse.modified(accessorFields(field))) { - error('PreFacet does not support field modification.'); - } - - this.initTargets(); // reset list of active subflows - - if (field) { - pulse.visit(pulse.MOD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.mod(_)); - }); - - pulse.visit(pulse.ADD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.add(ingest(_))); - }); - - pulse.visit(pulse.REM, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.rem(_)); - }); - } else { - pulse.visit(pulse.MOD, t => subflow(t).mod(t)); - pulse.visit(pulse.ADD, t => subflow(t).add(t)); - pulse.visit(pulse.REM, t => subflow(t).rem(t)); - } - - if (pulse.clean()) { - pulse.runAfter(() => this.clean()); - } - - return pulse; - }; - - /** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ - function Project(params) { - Transform.call(this, null, params); - } - - Project.Definition = { - 'type': 'Project', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true } - ] - }; - - var prototype$u = inherits(Project, Transform); - - prototype$u.transform = function(_, pulse) { - var fields = _.fields, - as = fieldNames(_.fields, _.as || []), - derive = fields - ? function(s, t) { return project(s, t, fields, as); } - : rederive, - out, lut; - - if (this.value) { - lut = this.value; - } else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - - out = pulse.fork(pulse.NO_SOURCE); - - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, function(t) { - var dt = derive(t, ingest({})); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, function(t) { - out.mod.push(derive(t, lut[tupleid(t)])); - }); - - return out; - }; - - function project(s, t, fields, as) { - for (var i=0, n=fields.length; i} [params.groupby] - An array of accessors - * to groupby. - * @param {Array} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ - function Quantile(params) { - Transform.call(this, null, params); - } - - Quantile.Definition = { - 'type': 'Quantile', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'probs', 'type': 'number', 'array': true }, - { 'name': 'step', 'type': 'number', 'default': 0.01 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['prob', 'value'] } - ] - }; - - var prototype$w = inherits(Quantile, Transform); - - var EPSILON$1 = 1e-14; - - prototype$w.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - as = _.as || ['prob', 'value']; - - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - values = [], - step = _.step || 0.01, - p = _.probs || sequence(step/2, 1 - EPSILON$1, step), - n = p.length; - - groups.forEach(g => { - const q = quantiles(g, p); - - for (let i=0; i { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, t => { - var dt = derive(t); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, t => { - var dt = lut[tupleid(t)], k; - for (k in t) { - dt[k] = t[k]; - // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - out.modifies(k); - } - out.mod.push(dt); - }); - } - - return out; - }; - - /** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ - function Sample(params) { - Transform.call(this, [], params); - this.count = 0; - } - - Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [ - { 'name': 'size', 'type': 'number', 'default': 1000 } - ] - }; - - var prototype$y = inherits(Sample, Transform); - - prototype$y.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - mod = _.modified('size'), - num = _.size, - res = this.value, - cnt = this.count, - cap = 0, - map = res.reduce(function(m, t) { - m[tupleid(t)] = 1; - return m; - }, {}); - - // sample reservoir update function - function update(t) { - var p, idx; - - if (res.length < num) { - res.push(t); - } else { - idx = ~~((cnt + 1) * exports.random()); - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[tupleid(p)]) out.rem.push(p); // eviction - res[idx] = t; - } - } - ++cnt; - } - - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - --cnt; - }); - - // filter removed tuples out of the sample reservoir - res = res.filter(function(t) { return map[tupleid(t)] !== -1; }); - } - - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, function(t) { - // update, but skip previously sampled tuples - if (!map[tupleid(t)]) update(t); - }); - cap = -1; - } - - if (mod && res.length > num) { - for (var i=0, n=res.length-num; i max) max = b; - } - }); - - floor.start = min; - floor.stop = max; - - return pulse.modifies(band ? as : u0); - }; - - prototype$B._floor = function(_, pulse) { - const utc = _.timezone === 'utc'; - - // get parameters - let {units, step} = _.units - ? {units: _.units, step: _.step || 1} - : timeBin({ - extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }); - - // check / standardize time units - units = timeUnits(units); - - const prev = this.value || {}, - floor = (utc ? utcFloor : timeFloor)(units, step); - - floor.unit = peek(units); - floor.units = units; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; - }; - - /** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ - function TupleIndex(params) { - Transform.call(this, fastmap(), params); - } - - var prototype$C = inherits(TupleIndex, Transform); - - prototype$C.transform = function(_, pulse) { - var df = pulse.dataflow, - field = _.field, - index = this.value, - mod = true; - - function set(t) { index.set(field(t), t); } - - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, function(t) { index.delete(field(t)); }); - pulse.visit(pulse.ADD, set); - } else { - mod = false; - } - - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); - }; - - /** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ - function Values(params) { - Transform.call(this, null, params); - } - - var prototype$D = inherits(Values, Transform); - - prototype$D.transform = function(_, pulse) { - var run = !this.value - || _.modified('field') - || _.modified('sort') - || pulse.changed() - || (_.sort && pulse.modified(_.sort.fields)); - - if (run) { - this.value = (_.sort - ? pulse.source.slice().sort(stableCompare(_.sort)) - : pulse.source).map(_.field); - } - }; - - function WindowOp(op, field, param, as) { - let fn = WindowOps[op](field, param); - return { - init: fn.init || zero, - update: function(w, t) { t[as] = fn.next(w); } - }; - } - - const WindowOps = { - row_number: function() { - return { - next: w => w.index + 1 - }; - }, - rank: function() { - let rank; - return { - init: () => rank = 1, - next: w => { - let i = w.index, - data = w.data; - return (i && w.compare(data[i - 1], data[i])) ? (rank = i + 1) : rank; - } - }; - }, - dense_rank: function() { - let drank; - return { - init: () => drank = 1, - next: w => { - let i = w.index, - d = w.data; - return (i && w.compare(d[i - 1], d[i])) ? ++drank : drank; - } - }; - }, - percent_rank: function() { - let rank = WindowOps.rank(), - next = rank.next; - return { - init: rank.init, - next: w => (next(w) - 1) / (w.data.length - 1) - }; - }, - cume_dist: function() { - let cume; - return { - init: () => cume = 0, - next: w => { - let i = w.index, - d = w.data, - c = w.compare; - if (cume < i) { - while (i + 1 < d.length && !c(d[i], d[i + 1])) ++i; - cume = i; - } - return (1 + cume) / d.length; - } - }; - }, - ntile: function(field, num) { - num = +num; - if (!(num > 0)) error('ntile num must be greater than zero.'); - let cume = WindowOps.cume_dist(), - next = cume.next; - return { - init: cume.init, - next: w => Math.ceil(num * next(w)) - }; - }, - - lag: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index + offset, - d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - - first_value: function(field) { - return { - next: w => field(w.data[w.i0]) - }; - }, - last_value: function(field) { - return { - next: w => field(w.data[w.i1 - 1]) - }; - }, - nth_value: function(field, nth) { - nth = +nth; - if (!(nth > 0)) error('nth_value nth must be greater than zero.'); - return { - next: w => { - let i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - - prev_value: function(field) { - let prev; - return { - init: () => prev = null, - next: w => { - let v = field(w.data[w.index]); - return v != null ? (prev = v) : prev; - } - }; - }, - next_value: function(field) { - let v, i; - return { - init: () => (v = null, i = -1), - next: w => { - let d = w.data; - return w.index <= i ? v - : (i = find(field, d, w.index)) < 0 - ? (i = d.length, v = null) - : (v = field(d[i])); - } - }; - } - }; - - function find(field, data, index) { - for (let n = data.length; index < n; ++index) { - let v = field(data[index]); - if (v != null) return index; - } - return -1; - } - - var ValidWindowOps = Object.keys(WindowOps); - - function WindowState(_) { - let self = this, - ops = array(_.ops), - fields = array(_.fields), - params = array(_.params), - as = array(_.as), - outputs = self.outputs = [], - windows = self.windows = [], - inputs = {}, - map = {}, - countOnly = true, - counts = [], - measures = []; - - function visitInputs(f) { - array(accessorFields(f)).forEach(_ => inputs[_] = 1); - } - visitInputs(_.sort); - - ops.forEach(function(op, i) { - let field = fields[i], - mname = accessorName(field), - name = measureName(op, mname, as[i]); - - visitInputs(field); - outputs.push(name); - - // Window operation - if (hasOwnProperty(WindowOps, op)) { - windows.push(WindowOp(op, fields[i], params[i], name)); - } - - // Aggregate operation - else { - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - if (op === 'count') { - counts.push(name); - return; - } - - countOnly = false; - let m = map[mname]; - if (!m) { - m = (map[mname] = []); - m.field = field; - measures.push(m); - } - m.push(createMeasure(op, name)); - } - }); - - if (counts.length || measures.length) { - self.cell = cell(measures, counts, countOnly); - } - - self.inputs = Object.keys(inputs); - } - - const prototype$E = WindowState.prototype; - - prototype$E.init = function() { - this.windows.forEach(_ => _.init()); - if (this.cell) this.cell.init(); - }; - - prototype$E.update = function(w, t) { - let self = this, - cell = self.cell, - wind = self.windows, - data = w.data, - m = wind && wind.length, - j; - - if (cell) { - for (j=w.p0; j compileMeasures(m, m.field)); - - let cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - - if (!countOnly) { - var n = measures.length, - a = cell.agg = Array(n), - i = 0; - for (; i} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array} params.ops - An array of strings indicating window operations to perform. - * @param {Array} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array} [params.as] - An array of output field names for window operations. - * @param {Array} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ - function Window(params) { - Transform.call(this, {}, params); - this._mlen = 0; - this._mods = []; - } - - Window.Definition = { - 'type': 'Window', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidWindowOps.concat(ValidAggregateOps) }, - { 'name': 'params', 'type': 'number', 'null': true, 'array': true }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'frame', 'type': 'number', 'null': true, 'array': true, 'length': 2, 'default': [null, 0] }, - { 'name': 'ignorePeers', 'type': 'boolean', 'default': false } - ] - }; - - var prototype$F = inherits(Window, Transform); - - prototype$F.transform = function(_, pulse) { - var self = this, - state = self.state, - mod = _.modified(), - cmp = stableCompare(_.sort), - i, n; - - this.stamp = pulse.stamp; - - // initialize window state - if (!state || mod) { - state = self.state = new WindowState(_); - } - - // retrieve group for a tuple - var key = groupkey(_.groupby); - function group(t) { return self.group(key(t)); } - - // partition input tuples - if (mod || pulse.modified(state.inputs)) { - self.value = {}; - pulse.visit(pulse.SOURCE, function(t) { group(t).add(t); }); - } else { - pulse.visit(pulse.REM, function(t) { group(t).remove(t); }); - pulse.visit(pulse.ADD, function(t) { group(t).add(t); }); - } - - // perform window calculations for each modified partition - for (i=0, n=self._mlen; i 0 && !c(d[r0], d[r0-1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1+1])) w.i1 = bisect.right(d, d[r1]); - } - - var tx = /*#__PURE__*/Object.freeze({ - __proto__: null, - aggregate: Aggregate, - bin: Bin, - collect: Collect, - compare: Compare, - countpattern: CountPattern, - cross: Cross, - density: Density, - dotbin: DotBin, - expression: Expression, - extent: Extent, - facet: Facet, - field: Field, - filter: Filter, - flatten: Flatten, - fold: Fold, - formula: Formula, - generate: Generate, - impute: Impute, - joinaggregate: JoinAggregate, - kde: KDE, - key: Key, - load: Load, - lookup: Lookup, - multiextent: MultiExtent, - multivalues: MultiValues, - params: Params, - pivot: Pivot, - prefacet: PreFacet, - project: Project, - proxy: Proxy, - quantile: Quantile, - relay: Relay, - sample: Sample, - sequence: Sequence, - sieve: Sieve, - subflow: Subflow, - timeunit: TimeUnit, - tupleindex: TupleIndex, - values: Values, - window: Window - }); - - const Top = 'top'; - const Left = 'left'; - const Right = 'right'; - const Bottom = 'bottom'; - - const TopLeft = 'top-left'; - const TopRight = 'top-right'; - const BottomLeft = 'bottom-left'; - const BottomRight = 'bottom-right'; - - const Start = 'start'; - const Middle = 'middle'; - const End = 'end'; - - const X = 'x'; - const Y = 'y'; - - const Group = 'group'; - - const AxisRole = 'axis'; - const TitleRole = 'title'; - const FrameRole = 'frame'; - const ScopeRole = 'scope'; - const LegendRole = 'legend'; - - const RowHeader = 'row-header'; - const RowFooter = 'row-footer'; - const RowTitle = 'row-title'; - const ColHeader = 'column-header'; - const ColFooter = 'column-footer'; - const ColTitle = 'column-title'; - - const Padding = 'padding'; - - const Symbols = 'symbol'; - - const Fit = 'fit'; - const FitX = 'fit-x'; - const FitY = 'fit-y'; - const Pad = 'pad'; - const None$1 = 'none'; - - const All = 'all'; - const Each = 'each'; - const Flush = 'flush'; - - const Column = 'column'; - const Row = 'row'; - - var gradient_id = 0; - - function resetSVGGradientId() { - gradient_id = 0; - } - - const patternPrefix = 'p_'; - - function isGradient(value) { - return value && value.gradient; - } - - function gradientRef(g, defs, base) { - let id = g.id, - type = g.gradient, - prefix = type === 'radial' ? patternPrefix : ''; - - // check id, assign default values as needed - if (!id) { - id = g.id = 'gradient_' + (gradient_id++); - if (type === 'radial') { - g.x1 = get$1(g.x1, 0.5); - g.y1 = get$1(g.y1, 0.5); - g.r1 = get$1(g.r1, 0); - g.x2 = get$1(g.x2, 0.5); - g.y2 = get$1(g.y2, 0.5); - g.r2 = get$1(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get$1(g.x1, 0); - g.y1 = get$1(g.y1, 0); - g.x2 = get$1(g.x2, 1); - g.y2 = get$1(g.y2, 0); - } - } - - // register definition - defs[id] = g; - - // return url reference - return 'url(' + (base || '') + '#' + prefix + id + ')'; - } - - function get$1(val, def) { - return val != null ? val : def; - } - - function Gradient(p0, p1) { - var stops = [], gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function(offset, color) { - stops.push({offset: offset, color: color}); - return gradient; - } - }; - } - - var lookup = { - 'basis': { - curve: d3Shape.curveBasis - }, - 'basis-closed': { - curve: d3Shape.curveBasisClosed - }, - 'basis-open': { - curve: d3Shape.curveBasisOpen - }, - 'bundle': { - curve: d3Shape.curveBundle, - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: d3Shape.curveCardinal, - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: d3Shape.curveCardinalOpen, - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: d3Shape.curveCardinalClosed, - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: d3Shape.curveCatmullRom, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: d3Shape.curveCatmullRomClosed, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: d3Shape.curveCatmullRomOpen, - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: d3Shape.curveLinear - }, - 'linear-closed': { - curve: d3Shape.curveLinearClosed - }, - 'monotone': { - horizontal: d3Shape.curveMonotoneY, - vertical: d3Shape.curveMonotoneX - }, - 'natural': { - curve: d3Shape.curveNatural - }, - 'step': { - curve: d3Shape.curveStep - }, - 'step-after': { - curve: d3Shape.curveStepAfter - }, - 'step-before': { - curve: d3Shape.curveStepBefore - } - }; - - function curves(type, orientation, tension) { - var entry = hasOwnProperty(lookup, type) && lookup[type], - curve = null; - - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - if (entry.tension && tension != null) { - curve = curve[entry.tension](tension); - } - } - - return curve; - } - - // Path parsing and rendering code adapted from fabric.js -- Thanks! - var cmdlen = { m:2, l:2, h:1, v:1, c:6, s:4, q:4, t:2, a:7 }, - regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\d)([-+])/g, /\s|,|###/]; - - function pathParse(pathstr) { - var result = [], - path, - curr, - chunks, - parsed, param, - cmd, len, i, j, n, m; - - // First, break path into command sequence - path = pathstr - .slice() - .replace(regexp[0], '###$1') - .split(regexp[1]) - .slice(1); - - // Next, parse each command in turn - for (i=0, n=path.length; i len) { - for (j=1, m=parsed.length; j 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - - var a00 = cos_th / rx; - var a01 = sin_th / rx; - var a10 = (-sin_th) / ry; - var a11 = (cos_th) / ry; - var x0 = a00 * ox + a01 * oy; - var y0 = a10 * ox + a11 * oy; - var x1 = a00 * x + a01 * y; - var y1 = a10 * x + a11 * y; - - var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0); - var sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - var sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0); - var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0); - - var th0 = Math.atan2(y0-yc, x0-xc); - var th1 = Math.atan2(y1-yc, x1-xc); - - var th_arc = th1-th0; - if (th_arc < 0 && sweep === 1) { - th_arc += Tau; - } else if (th_arc > 0 && sweep === 0) { - th_arc -= Tau; - } - - var segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - var result = []; - for (var i=0; i +_; - } - - function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); - } - - function vg_rect() { - var x = rectangleX, - y = rectangleY, - width = rectangleWidth, - height = rectangleHeight, - crTL = number$1(0), - crTR = crTL, - crBL = crTL, - crBR = crTL, - context = null; - - function rectangle(_, x0, y0) { - var buffer, - x1 = x0 != null ? x0 : +x.call(this, _), - y1 = y0 != null ? y0 : +y.call(this, _), - w = +width.call(this, _), - h = +height.call(this, _), - s = Math.min(w, h) / 2, - tl = clamp(+crTL.call(this, _), 0, s), - tr = clamp(+crTR.call(this, _), 0, s), - bl = clamp(+crBL.call(this, _), 0, s), - br = clamp(+crBR.call(this, _), 0, s); - - if (!context) context = buffer = d3Path.path(); - - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) { - context.rect(x1, y1, w, h); - } else { - var x2 = x1 + w, - y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - rectangle.x = function(_) { - if (arguments.length) { - x = number$1(_); - return rectangle; - } else { - return x; - } - }; - - rectangle.y = function(_) { - if (arguments.length) { - y = number$1(_); - return rectangle; - } else { - return y; - } - }; - - rectangle.width = function(_) { - if (arguments.length) { - width = number$1(_); - return rectangle; - } else { - return width; - } - }; - - rectangle.height = function(_) { - if (arguments.length) { - height = number$1(_); - return rectangle; - } else { - return height; - } - }; - - rectangle.cornerRadius = function(tl, tr, br, bl) { - if (arguments.length) { - crTL = number$1(tl); - crTR = tr != null ? number$1(tr) : crTL; - crBR = br != null ? number$1(br) : crTL; - crBL = bl != null ? number$1(bl) : crTR; - return rectangle; - } else { - return crTL; - } - }; - - rectangle.context = function(_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else { - return context; - } - }; - - return rectangle; - } - - function vg_trail() { - var x, - y, - size, - defined, - context = null, - ready, x1, y1, r1; - - function point(x2, y2, w2) { - var r2 = w2 / 2; - - if (ready) { - var ux = y1 - y2, - uy = x2 - x1; - - if (ux || uy) { - // get normal vector - var ud = Math.sqrt(ux * ux + uy * uy), - rx = (ux /= ud) * r1, - ry = (uy /= ud) * r1, - t = Math.atan2(uy, ux); - - // draw segment - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else { - context.arc(x2, y2, r2, 0, Tau); - } - context.closePath(); - } else { - ready = 1; - } - x1 = x2; - y1 = y2; - r1 = r2; - } - - function trail(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - - if (context == null) context = buffer = d3Path.path(); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - trail.x = function(_) { - if (arguments.length) { - x = _; - return trail; - } else { - return x; - } - }; - - trail.y = function(_) { - if (arguments.length) { - y = _; - return trail; - } else { - return y; - } - }; - - trail.size = function(_) { - if (arguments.length) { - size = _; - return trail; - } else { - return size; - } - }; - - trail.defined = function(_) { - if (arguments.length) { - defined = _; - return trail; - } else { - return defined; - } - }; - - trail.context = function(_) { - if (arguments.length) { - if (_ == null) { - context = null; - } else { - context = _; - } - return trail; - } else { - return context; - } - }; - - return trail; - } - - function value(a, b) { - return a != null ? a : b; - } - - const x = item => item.x || 0, - y = item => item.y || 0, - w = item => item.width || 0, - h = item => item.height || 0, - xw = item => (item.x || 0) + (item.width || 0), - yh = item => (item.y || 0) + (item.height || 0), - sa = item => item.startAngle || 0, - ea = item => item.endAngle || 0, - pa = item => item.padAngle || 0, - ir = item => item.innerRadius || 0, - or = item => item.outerRadius || 0, - cr = item => item.cornerRadius || 0, - tl = item => value(item.cornerRadiusTopLeft, item.cornerRadius) || 0, - tr = item => value(item.cornerRadiusTopRight, item.cornerRadius) || 0, - br = item => value(item.cornerRadiusBottomRight, item.cornerRadius) || 0, - bl = item => value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, - sz = item => value(item.size, 64), - ts = item => item.size || 1, - def = item => !(item.defined === false), - type = item => symbols(item.shape || 'circle'); - - const arcShape = d3Shape.arc().startAngle(sa).endAngle(ea).padAngle(pa) - .innerRadius(ir).outerRadius(or).cornerRadius(cr), - areavShape = d3Shape.area().x(x).y1(y).y0(yh).defined(def), - areahShape = d3Shape.area().y(y).x1(x).x0(xw).defined(def), - lineShape = d3Shape.line().x(x).y(y).defined(def), - rectShape = vg_rect().x(x).y(y).width(w).height(h) - .cornerRadius(tl, tr, br, bl), - symbolShape = d3Shape.symbol().type(type).size(sz), - trailShape = vg_trail().x(x).y(y).defined(def).size(ts); - - function hasCornerRadius(item) { - return item.cornerRadius - || item.cornerRadiusTopLeft - || item.cornerRadiusTopRight - || item.cornerRadiusBottomRight - || item.cornerRadiusBottomLeft; - } - - function arc(context, item) { - return arcShape.context(context)(item); - } - - function area(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape) - .curve(curves(interp, item.orient, item.tension)) - .context(context)(items); - } - - function line(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)) - .context(context)(items); - } - - function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); - } - - function shape(context, item) { - return (item.mark.shape || item.shape) - .context(context)(item); - } - - function symbol(context, item) { - return symbolShape.context(context)(item); - } - - function trail(context, items) { - return trailShape.context(context)(items); - } - - var clip_id = 1; - - function resetSVGClipId() { - clip_id = 1; - } - - function clip(renderer, item, size) { - var clip = item.clip, - defs = renderer._defs, - id = item.clip_id || (item.clip_id = 'clip' + clip_id++), - c = defs.clipping[id] || (defs.clipping[id] = {id: id}); - - if (isFunction(clip)) { - c.path = clip(null); - } else if (hasCornerRadius(size)) { - c.path = rectangle(null, size, 0, 0); - } else { - c.width = size.width || 0; - c.height = size.height || 0; - } - - return 'url(#' + id + ')'; - } - - function Bounds(b) { - this.clear(); - if (b) this.union(b); - } - - var prototype$G = Bounds.prototype; - - prototype$G.clone = function() { - return new Bounds(this); - }; - - prototype$G.clear = function() { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; - }; - - prototype$G.empty = function() { - return ( - this.x1 === +Number.MAX_VALUE && - this.y1 === +Number.MAX_VALUE && - this.x2 === -Number.MAX_VALUE && - this.y2 === -Number.MAX_VALUE - ); - }; - - prototype$G.equals = function(b) { - return ( - this.x1 === b.x1 && - this.y1 === b.y1 && - this.x2 === b.x2 && - this.y2 === b.y2 - ); - }; - - prototype$G.set = function(x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; - } - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; - } - return this; - }; - - prototype$G.add = function(x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; - }; - - prototype$G.expand = function(d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; - }; - - prototype$G.round = function() { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; - }; - - prototype$G.scale = function(s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; - }; - - prototype$G.translate = function(dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; - }; - - prototype$G.rotate = function(angle, x, y) { - const p = this.rotatedPoints(angle, x, y); - return this.clear() - .add(p[0], p[1]) - .add(p[2], p[3]) - .add(p[4], p[5]) - .add(p[6], p[7]); - }; - - prototype$G.rotatedPoints = function(angle, x, y) { - var {x1, y1, x2, y2} = this, - cos = Math.cos(angle), - sin = Math.sin(angle), - cx = x - x*cos + y*sin, - cy = y - x*sin - y*cos; - - return [ - cos*x1 - sin*y1 + cx, sin*x1 + cos*y1 + cy, - cos*x1 - sin*y2 + cx, sin*x1 + cos*y2 + cy, - cos*x2 - sin*y1 + cx, sin*x2 + cos*y1 + cy, - cos*x2 - sin*y2 + cx, sin*x2 + cos*y2 + cy - ]; - }; - - prototype$G.union = function(b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; - }; - - prototype$G.intersect = function(b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; - }; - - prototype$G.encloses = function(b) { - return b && ( - this.x1 <= b.x1 && - this.x2 >= b.x2 && - this.y1 <= b.y1 && - this.y2 >= b.y2 - ); - }; - - prototype$G.alignsWith = function(b) { - return b && ( - this.x1 == b.x1 || - this.x2 == b.x2 || - this.y1 == b.y1 || - this.y2 == b.y2 - ); - }; - - prototype$G.intersects = function(b) { - return b && !( - this.x2 < b.x1 || - this.x1 > b.x2 || - this.y2 < b.y1 || - this.y1 > b.y2 - ); - }; - - prototype$G.contains = function(x, y) { - return !( - x < this.x1 || - x > this.x2 || - y < this.y1 || - y > this.y2 - ); - }; - - prototype$G.width = function() { - return this.x2 - this.x1; - }; - - prototype$G.height = function() { - return this.y2 - this.y1; - }; - - function Item(mark) { - this.mark = mark; - this.bounds = (this.bounds || new Bounds()); - } - - function GroupItem(mark) { - Item.call(this, mark); - this.items = (this.items || []); - } - - inherits(GroupItem, Item); - - function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - var c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } - } - return null; - } - - function domImage() { - return typeof Image !== 'undefined' ? Image : null; - } - - function ResourceLoader(customLoader) { - this._pending = 0; - this._loader = customLoader || loader(); - } - - var prototype$H = ResourceLoader.prototype; - - prototype$H.pending = function() { - return this._pending; - }; - - function increment(loader) { - loader._pending += 1; - } - - function decrement(loader) { - loader._pending -= 1; - } - - prototype$H.sanitizeURL = function(uri) { - var loader = this; - increment(loader); - - return loader._loader.sanitize(uri, {context:'href'}) - .then(function(opt) { - decrement(loader); - return opt; - }) - .catch(function() { - decrement(loader); - return null; - }); - }; - - prototype$H.loadImage = function(uri) { - const loader = this, - Image = domImage(); - increment(loader); - - return loader._loader - .sanitize(uri, {context: 'image'}) - .then(function(opt) { - const url = opt.href; - if (!url || !Image) throw {url: url}; - - const img = new Image(); - - // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - const cors = hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; - - // attempt to load image resource - img.onload = () => decrement(loader); - img.onerror = () => decrement(loader); - img.src = url; - - return img; - }) - .catch(function(e) { - decrement(loader); - return {complete: false, width: 0, height: 0, src: e && e.url || ''}; - }); - }; - - prototype$H.ready = function() { - var loader = this; - return new Promise(function(accept) { - function poll(value) { - if (!loader.pending()) accept(value); - else setTimeout(function() { poll(true); }, 10); - } - poll(false); - }); - }; - - function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - const sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - return bounds; - } - - function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; - } - - var bounds, lx, ly, - circleThreshold = Tau - 1e-8; - - function context(_) { - bounds = _; - return context; - } - - function noop$1() {} - - function add$2(x, y) { bounds.add(x, y); } - - function addL(x, y) { add$2(lx = x, ly = y); } - - function addX(x) { add$2(x, bounds.y1); } - - function addY(y) { add$2(bounds.x1, y); } - - context.beginPath = noop$1; - - context.closePath = noop$1; - - context.moveTo = addL; - - context.lineTo = addL; - - context.rect = function(x, y, w, h) { - add$2(x + w, y + h); - addL(x, y); - }; - - context.quadraticCurveTo = function(x1, y1, x2, y2) { - quadExtrema(lx, x1, x2, addX); - quadExtrema(ly, y1, y2, addY); - addL(x2, y2); - }; - - function quadExtrema(x0, x1, x2, cb) { - const t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); - } - - context.bezierCurveTo = function(x1, y1, x2, y2, x3, y3) { - cubicExtrema(lx, x1, x2, x3, addX); - cubicExtrema(ly, y1, y2, y3, addY); - addL(x3, y3); - }; - - function cubicExtrema(x0, x1, x2, x3, cb) { - const a = x3 - x0 + 3 * x1 - 3 * x2, - b = x0 + x2 - 2 * x1, - c = x0 - x1; - - let t0 = 0, t1 = 0, r; - - // solve for parameter t - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else { - // linear equation - t0 = 0.5 * c / b; - } - - // calculate position - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); - } - - function cubic(t, x0, x1, x2, x3) { - const s = 1 - t, s2 = s * s, t2 = t * t; - return (s2 * s * x0) + (3 * s2 * t * x1) + (3 * s * t2 * x2) + (t2 * t * x3); - } - - context.arc = function(cx, cy, r, sa, ea, ccw) { - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add$2(cx - r, cy - r); - add$2(cx + r, cy + r); - } else { - const update = a => add$2(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - let s, i; - - // sample end points - update(sa); - update(ea); - - // sample interior points aligned with 90 degrees - if (ea !== sa) { - sa = sa % Tau; if (sa < 0) sa += Tau; - ea = ea % Tau; if (ea < 0) ea += Tau; - - if (ea < sa) { - ccw = !ccw; // flip direction - s = sa; sa = ea; ea = s; // swap end-points - } - - if (ccw) { - ea -= Tau; - s = sa - (sa % HalfPi); - for (i=0; i<4 && s>ea; ++i, s-=HalfPi) update(s); - } else { - s = sa - (sa % HalfPi) + HalfPi; - for (i=0; i<4 && s t1) return false; - else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false; - else if (r < t1) t1 = r; - } - } - - return true; - } - - function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; - } - - function value$1(value, dflt) { - return value == null ? dflt : value; - } - - function addStops(gradient, stops) { - const n = stops.length; - for (let i=0; i 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else { - return false; - } - } - - var Empty$1 = []; - - function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - - if (lw <= 0) return false; - - opacity *= (item.strokeOpacity==null ? 1 : item.strokeOpacity); - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty$1); - context.lineDashOffset = item.strokeDashOffset || 0; - } - return true; - } else { - return false; - } - } - - function compare$2(a, b) { - return a.zindex - b.zindex || a.index - b.index; - } - - function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - - var items = scene.items, - output = [], item, i, n; - - for (i=0, n=items.length; i= 0;) { - if (hit = visitor(items[i])) return hit; - } - - if (items === zitems) { - for (items=scene.items, i=items.length; --i >= 0;) { - if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; - } - } - } - - return null; - } - - function drawAll(path) { - return function(context, scene, bounds) { - visit(scene, function(item) { - if (!bounds || bounds.intersects(item.bounds)) { - drawPath(path, context, item, item); - } - }); - }; - } - - function drawOne(path) { - return function(context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) { - drawPath(path, context, scene.items[0], scene.items); - } - }; - } - - function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - - if (path(context, items)) return; - - blend(context, item); - - if (item.fill && fill(context, item, opacity)) { - context.fill(); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.stroke(); - } - } - - function pick(test) { - test = test || truthy; - - return function(context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - - return pickVisit(scene, function(item) { - var b = item.bounds; - // first hit test against bounding box - if ((b && !b.contains(gx, gy)) || !b) return; - // if in bounding box, perform more careful test - if (test(context, item, x, y, gx, gy)) return item; - }); - }; - } - - function hitPath(path, filled) { - return function(context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, - fill = (filled == null) ? item.fill : filled, - stroke = item.stroke && context.isPointInStroke, lw, lc; - - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - - return path(context, o) ? false : - (fill && context.isPointInPath(x, y)) || - (stroke && context.isPointInStroke(x, y)); - }; - } - - function pickPath(path) { - return pick(hitPath(path)); - } - - function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; - } - - function rotate(a) { - return 'rotate(' + a + ')'; - } - - function scale$1(scaleX, scaleY){ - return 'scale('+ scaleX + ',' + scaleY+')'; - } - - function translateItem(item) { - return translate(item.x || 0, item.y || 0); - } - - function transformItem(item) { - return translate(item.x || 0, item.y || 0) - + (item.angle ? ' ' + rotate(item.angle) : '') - + (item.scaleX || item.scaleY ? ' ' + scale$1(item.scaleX || 1, item.scaleY || 1) : ''); - } - - function markItemPath(type, shape, isect) { - - function attr(emit, item) { - emit('transform', transformItem(item)); - emit('d', shape(null, item)); - } - - function bound(bounds, item) { - var x = item.x || 0, - y = item.y || 0; - - shape(context(bounds), item); - boundStroke(bounds, item).translate(x, y); - if (item.angle) { - bounds.rotate(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw(context, item) { - var x = item.x || 0, - y = item.y || 0, - a = item.angle || 0; - - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); - } - - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; - - } - - var arc$1 = markItemPath('arc', arc); - - function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], - z = a[0].orient === 'horizontal' ? 'y' : 'x', - i = a.length, - min = +Infinity, hit, d; - - while (--i >= 0) { - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - if (d < min) { - min = d; - hit = a[i]; - } - } - - return hit; - } - - function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), - i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - - return null; - } - - function pickTrail(a, p) { - var i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx*dx) return a[i]; - } - - return null; - } - - function markMultiItemPath(type, shape, tip) { - - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - - function bound(bounds, mark) { - var items = mark.items; - if (items.length === 0) { - return bounds; - } else { - shape(context(bounds), items); - return boundStroke(bounds, items[0]); - } - } - - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - - var hit = hitPath(draw); - - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, - b = scene.bounds; - - if (!items || !items.length || b && !b.contains(gx, gy)) { - return null; - } - - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; - } - - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; - - } - - var area$1 = markMultiItemPath('area', area, pickArea); - - function clip$1(context, scene) { - var clip = scene.clip; - - context.save(); - - if (isFunction(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else { - clipGroup(context, scene.group); - } - } - - function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) - ? rectangle(context, group, 0, 0) - : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); - } - - function offset$1(item) { - const sw = value$1(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset - : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) - : 0; - } - - function attr(emit, item) { - emit('transform', translateItem(item)); - } - - function emitRectangle(emit, item) { - const off = offset$1(item); - emit('d', rectangle(null, item, off, off)); - } - - function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); - } - - function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - if (item.strokeForeground) { - emitRectangle(emit, item); - } else { - emit('d', ''); - } - } - - function content(emit, item, renderer) { - const url = item.clip ? clip(renderer, item, item) : null; - emit('clip-path', url); - } - - function bound(bounds, group) { - if (!group.clip && group.items) { - const items = group.items, m = items.length; - for (let j=0; j { - const gx = group.x || 0, - gy = group.y || 0, - fore = group.strokeForeground, - opacity = group.opacity == null ? 1 : group.opacity; - - // draw group background - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (group.fill && fill(context, group, opacity)) { - context.fill(); - } - if (group.stroke && !fore && stroke(context, group, opacity)) { - context.stroke(); - } - } - - // setup graphics context, set clip and bounds - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); - - // draw group contents - visit(group, item => { - this.draw(context, item, bounds); - }); - - // restore graphics context - if (bounds) bounds.translate(gx, gy); - context.restore(); - - // draw group foreground - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (stroke(context, group, opacity)) { - context.stroke(); - } - } - }); - } - - function pick$1(context, scene, x, y, gx, gy) { - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { - return null; - } - - const cx = x * context.pixelRatio, - cy = y * context.pixelRatio; - - return pickVisit(scene, group => { - let hit, fore, ix, dx, dy, dw, dh, b, c; - - // first hit test bounding box - b = group.bounds; - if (b && !b.contains(gx, gy)) return; - - // passed bounds check, test rectangular clip - dx = group.x || 0; - dy = group.y || 0; - dw = dx + (group.width || 0); - dh = dy + (group.height || 0); - c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; - - // adjust coordinate system - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; - - // test background for rounded corner clip - if (c && hasCornerRadius(group) && !hitBackground(context, group, cx, cy)) { - context.restore(); - return null; - } - - fore = group.strokeForeground; - ix = scene.interactive !== false; - - // hit test against group foreground - if (ix && fore && group.stroke - && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } - - // hit test against contained marks - hit = pickVisit(group, mark => pickMark(mark, dx, dy) - ? this.pick(mark, x, y, dx, dy) - : null - ); - - // hit test against group background - if (!hit && ix && (group.fill || (!fore && group.stroke)) - && hitBackground(context, group, cx, cy)) { - hit = group; - } - - // restore state and return - context.restore(); - return hit || null; - }); - } - - function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') - && mark.bounds && mark.bounds.contains(x, y); - } - - var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1, - isect: intersectRect, - content: content, - background: background, - foreground: foreground - }; - - var metadata = { - 'version': '1.1', - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink' - }; - - function getImage(item, renderer) { - var image = item.image; - if (!image || item.url && item.url !== image.url) { - image = {complete: false, width: 0, height: 0}; - renderer.loadImage(item.url).then(image => { - item.image = image; - item.image.url = item.url; - }); - } - return image; - } - - function imageWidth(item, image) { - return item.width != null ? item.width - : !image || !image.width ? 0 - : item.aspect !== false && item.height ? item.height * image.width / image.height - : image.width; - } - - function imageHeight(item, image) { - return item.height != null ? item.height - : !image || !image.height ? 0 - : item.aspect !== false && item.width ? item.width * image.height / image.width - : image.height; - } - - function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; - } - - function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; - } - - function attr$1(emit, item, renderer) { - const img = getImage(item, renderer), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); - } - - function bound$1(bounds, item) { - const img = item.image, - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h); - - return bounds.set(x, y, x + w, y + h); - } - - function draw$1(context, scene, bounds) { - visit(scene, item => { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - let img = getImage(item, this), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - opacity, ar0, ar1, t; - - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); - } - - var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick(), - isect: truthy, // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset - }; - - var line$1 = markMultiItemPath('line', line, pickLine); - - function attr$2(emit, item) { - var sx = item.scaleX || 1, - sy = item.scaleY || 1; - if (sx !== 1 || sy !== 1) { - emit('vector-effect', 'non-scaling-stroke'); - } - emit('transform', transformItem(item)); - emit('d', item.path); - } - - function path(context, item) { - var path = item.path; - if (path == null) return true; - - var x = item.x || 0, - y = item.y || 0, - sx = item.scaleX || 1, - sy = item.scaleY || 1, - a = (item.angle || 0) * DegToRad, - cache = item.pathCache; - - if (!cache || cache.path !== path) { - (item.pathCache = cache = pathParse(path)).path = path; - } - - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else { - pathRender(context, cache, x, y, sx, sy); - } - } - - function bound$2(bounds, item) { - path(context(bounds), item) - ? bounds.set(0, 0, 0, 0) - : boundStroke(bounds, item, true); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, item.x || 0, item.y || 0); - } - - return bounds; - } - - var path$1 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(path), - pick: pickPath(path), - isect: intersectPath(path) - }; - - function attr$3(emit, item) { - emit('d', rectangle(null, item)); - } - - function bound$3(bounds, item) { - var x, y; - return boundStroke(bounds.set( - x = item.x || 0, - y = item.y || 0, - (x + item.width) || 0, - (y + item.height) || 0 - ), item); - } - - function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); - } - - var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect - }; - - function attr$4(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); - } - - function bound$4(bounds, item) { - var x1, y1; - return boundStroke(bounds.set( - x1 = item.x || 0, - y1 = item.y || 0, - item.x2 != null ? item.x2 : x1, - item.y2 != null ? item.y2 : y1 - ), item); - } - - function path$2(context, item, opacity) { - var x1, y1, x2, y2; - - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - return false; - } - - function draw$3(context, scene, bounds) { - visit(scene, function(item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity && path$2(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); - } - - function hit(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path$2(context, item, 1) && context.isPointInStroke(x, y); - } - - var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick(hit), - isect: intersectRule - }; - - var shape$1 = markItemPath('shape', shape); - - var symbol$1 = markItemPath('symbol', symbol, intersectPoint); - - // memoize text width measurement - const widthCache = lruCache(); - - var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas - }; - - useCanvas(true); - - function useCanvas(use) { - textMetrics.width = (use && context$1) ? measureWidth : estimateWidth; - } - - // make dumb, simple estimate if no canvas is available - function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); - } - - function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); - } - - // measure text width if canvas is available - function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 - : _measureWidth(text, font(item)); - } - - function _measureWidth(text, currentFont) { - const key = `(${currentFont}) ${text}`; - let width = widthCache.get(key); - if (width === undefined) { - context$1.font = currentFont; - width = context$1.measureText(text).width; - widthCache.set(key, width); - } - return width; - } - - function fontSize(item) { - return item.fontSize != null ? (+item.fontSize || 0) : 11; - } - - function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : (fontSize(item) + 2); - } - - function lineArray(_) { - return isArray(_) ? _.length > 1 ? _ : _[0] : _; - } - - function textLines(item) { - return lineArray( - item.lineBreak && item.text && !isArray(item.text) - ? item.text.split(item.lineBreak) - : item.text - ); - } - - function multiLineOffset(item) { - const tl = textLines(item); - return (isArray(tl) ? (tl.length - 1) : 0) * lineHeight(item); - } - - function textValue(item, line) { - const text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate$1(item, text) : text; - } - - function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - const currentFont = font(item); - return text => _measureWidth(text, currentFont); - } else { - // we are relying on estimates - const currentFontHeight = fontSize(item); - return text => _estimateWidth(text, currentFontHeight); - } - } - - function truncate$1(item, text) { - var limit = +item.limit, - width = widthGetter(item); - - if (width(text) < limit) return text; - - var ellipsis = item.ellipsis || '\u2026', - rtl = item.dir === 'rtl', - lo = 0, - hi = text.length, mid; - - limit -= width(ellipsis); - - if (rtl) { - while (lo < hi) { - mid = (lo + hi >>> 1); - if (width(text.slice(mid)) > limit) lo = mid + 1; - else hi = mid; - } - return ellipsis + text.slice(lo); - } else { - while (lo < hi) { - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid; - else hi = mid - 1; - } - return text.slice(0, lo) + ellipsis; - } - } - - function fontFamily(item, quote) { - var font = item.font; - return (quote && font - ? String(font).replace(/"/g, '\'') - : font) || 'sans-serif'; - } - - function font(item, quote) { - return '' + - (item.fontStyle ? item.fontStyle + ' ' : '') + - (item.fontVariant ? item.fontVariant + ' ' : '') + - (item.fontWeight ? item.fontWeight + ' ' : '') + - fontSize(item) + 'px ' + - fontFamily(item, quote); - } - - function offset$2(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, - h = fontSize(item); - - return Math.round( - baseline === 'top' ? 0.79 * h : - baseline === 'middle' ? 0.30 * h : - baseline === 'bottom' ? -0.21 * h : - baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : - baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0 - ); - } - - var textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' - }; - - var tempBounds = new Bounds(); - - function anchorPoint(item) { - var x = item.x || 0, - y = item.y || 0, - r = item.radius || 0, t; - - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; - } - - function attr$5(emit, item) { - var dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item), - p = anchorPoint(item), - x = p.x1, - y = p.y1, - a = item.angle || 0, t; - - emit('text-anchor', textAlign[item.align] || 'start'); - - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else { - t = translate(x + dx, y + dy); - } - emit('transform', t); - } - - function bound$5(bounds, item, mode) { - var h = textMetrics.height(item), - a = item.align, - p = anchorPoint(item), - x = p.x1, - y = p.y1, - dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item) - Math.round(0.8*h), // use 4/5 offset - tl = textLines(item), - w; - - // get dimensions - if (isArray(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce((w, t) => Math.max(w, textMetrics.width(item, t)), 0); - } else { - // single-line text - w = textMetrics.width(item, tl); - } - - // horizontal alignment - if (a === 'center') { - dx -= (w / 2); - } else if (a === 'right') { - dx -= w; - } - - bounds.set(dx+=x, dy+=y, dx+w, dy+h); - - if (item.angle && !mode) { - bounds.rotate(item.angle * DegToRad, x, y); - } else if (mode === 2) { - return bounds.rotatedPoints(item.angle * DegToRad, x, y); - } - return bounds; - } - - function draw$4(context, scene, bounds) { - visit(scene, function(item) { - var opacity = item.opacity == null ? 1 : item.opacity, - p, x, y, i, lh, tl, str; - - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || - item.text == null || item.text.length === 0) return; - - context.font = font(item); - context.textAlign = item.align || 'left'; - - p = anchorPoint(item); - x = p.x1, - y = p.y1; - - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - x += (item.dx || 0); - y += (item.dy || 0) + offset$2(item); - - tl = textLines(item); - blend(context, item); - if (isArray(tl)) { - lh = lineHeight(item); - for (i=0; i index) el.removeChild(nodes[--curr]); - return el; - } - - // generate css class name for mark - function cssClass(mark) { - return 'mark-' + mark.marktype - + (mark.role ? ' role-' + mark.role : '') - + (mark.name ? ' ' + mark.name : ''); - } - - function point(event, el) { - var rect = el.getBoundingClientRect(); - return [ - event.clientX - rect.left - (el.clientLeft || 0), - event.clientY - rect.top - (el.clientTop || 0) - ]; - } - - function resolveItem(item, event, el, origin) { - var mark = item && item.mark, - mdef, p; - - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - while (item = item.mark.group) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - item = mdef.tip(mark.items, p); - } - - return item; - } - - /** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ - function Handler(customLoader, customTooltip) { - this._active = null; - this._handlers = {}; - this._loader = customLoader || loader(); - this._tooltip = customTooltip || defaultTooltip; - } - - // The default tooltip display handler. - // Sets the HTML title attribute on the visualization container. - function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); - } - - const prototype$J = Handler.prototype; - - /** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ - prototype$J.initialize = function(el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); - }; - - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - prototype$J.element = function() { - return this._el; - }; - - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - prototype$J.canvas = function() { - return this._el && this._el.firstChild; - }; - - /** - * Get / set the origin coordinates of the visualization. - */ - prototype$J.origin = function(origin) { - if (arguments.length) { - this._origin = origin || [0, 0]; - return this; - } else { - return this._origin.slice(); - } - }; - - /** - * Get / set the scenegraph root. - */ - prototype$J.scene = function(scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; - }; - - /** - * Add an event handler. Subclasses should override this method. - */ - prototype$J.on = function(/*type, handler*/) {}; - - /** - * Remove an event handler. Subclasses should override this method. - */ - prototype$J.off = function(/*type, handler*/) {}; - - /** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ - prototype$J._handlerIndex = function(h, type, handler) { - for (let i = h ? h.length : 0; --i>=0;) { - if (h[i].type === type && (!handler || h[i].handler === handler)) { - return i; - } - } - return -1; - }; - - /** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ - prototype$J.handlers = function(type) { - const h = this._handlers, a = []; - if (type) { - a.push.apply(a, h[this.eventName(type)]); - } else { - for (const k in h) { a.push.apply(a, h[k]); } - } - return a; - }; - - /** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ - prototype$J.eventName = function(name) { - const i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); - }; - - /** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ - prototype$J.handleHref = function(event, item, href) { - this._loader - .sanitize(href, {context:'href'}) - .then(opt => { - const e = new MouseEvent(event.type, event), - a = domCreate(null, 'a'); - for (const name in opt) a.setAttribute(name, opt[name]); - a.dispatchEvent(e); - }) - .catch(function() { /* do nothing */ }); - }; - - /** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ - prototype$J.handleTooltip = function(event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - const value = (show && item && item.tooltip) || null; - this._tooltip.call(this._obj, this, event, item, value); - } - }; - - /** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ - prototype$J.getItemBoundingClientRect = function(item) { - const el = this.canvas(); - if (!el) return; - - const rect = el.getBoundingClientRect(), - origin = this._origin, - bounds = item.bounds, - width = bounds.width(), - height = bounds.height(); - - let x = bounds.x1 + origin[0] + rect.left, - y = bounds.y1 + origin[1] + rect.top; - - // translate coordinate for each parent group - while (item.mark && (item = item.mark.group)) { - x += item.x || 0; - y += item.y || 0; - } - - // return DOMRect-compatible bounding box - return { - x, y, width, height, - left: x, top: y, right: x + width, bottom: y + height - }; - }; - - /** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ - function Renderer(loader) { - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); - } - - var prototype$K = Renderer.prototype; - - /** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ - prototype$K.initialize = function(el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); - }; - - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - prototype$K.element = function() { - return this._el; - }; - - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - prototype$K.canvas = function() { - return this._el && this._el.firstChild; - }; - - /** - * Get / set the background color. - */ - prototype$K.background = function(bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; - }; - - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ - prototype$K.resize = function(width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [0, 0]; - this._scale = scaleFactor || 1; - return this; - }; - - /** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ - prototype$K.dirty = function(/*item*/) { - }; - - /** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Renderer} - This renderer instance. - */ - prototype$K.render = function(scene) { - var r = this; - - // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - r._call = function() { r._render(scene); }; - - // invoke the renderer - r._call(); - - // clear the cached call for garbage collection - // async redraws will stash their own copy - r._call = null; - - return r; - }; - - /** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - */ - prototype$K._render = function(/*scene*/) { - // subclasses to override - }; - - /** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Promise} - A Promise that resolves when rendering is complete. - */ - prototype$K.renderAsync = function(scene) { - var r = this.render(scene); - return this._ready - ? this._ready.then(function() { return r; }) - : Promise.resolve(r); - }; - - /** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ - prototype$K._load = function(method, uri) { - var r = this, - p = r._loader[method](uri); - - if (!r._ready) { - // re-render the scene when loading completes - var call = r._call; - r._ready = r._loader.ready() - .then(function(redraw) { - if (redraw) call(); - r._ready = null; - }); - } - - return p; - }; - - /** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ - prototype$K.sanitizeURL = function(uri) { - return this._load('sanitizeURL', uri); - }; - - /** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ - prototype$K.loadImage = function(uri) { - return this._load('loadImage', uri); - }; - - const KeyDownEvent = 'keydown'; - const KeyPressEvent = 'keypress'; - const KeyUpEvent = 'keyup'; - const DragEnterEvent = 'dragenter'; - const DragLeaveEvent = 'dragleave'; - const DragOverEvent = 'dragover'; - const MouseDownEvent = 'mousedown'; - const MouseUpEvent = 'mouseup'; - const MouseMoveEvent = 'mousemove'; - const MouseOutEvent = 'mouseout'; - const MouseOverEvent = 'mouseover'; - const ClickEvent = 'click'; - const DoubleClickEvent = 'dblclick'; - const WheelEvent = 'wheel'; - const MouseWheelEvent = 'mousewheel'; - const TouchStartEvent = 'touchstart'; - const TouchMoveEvent = 'touchmove'; - const TouchEndEvent = 'touchend'; - - const Events = [ - KeyDownEvent, - KeyPressEvent, - KeyUpEvent, - DragEnterEvent, - DragLeaveEvent, - DragOverEvent, - MouseDownEvent, - MouseUpEvent, - MouseMoveEvent, - MouseOutEvent, - MouseOverEvent, - ClickEvent, - DoubleClickEvent, - WheelEvent, - MouseWheelEvent, - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent - ]; - - const TooltipShowEvent = MouseMoveEvent; - - const TooltipHideEvent = MouseOutEvent; - - const HrefEvent = ClickEvent; - - function CanvasHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; - } - - const prototype$L = inherits(CanvasHandler, Handler); - - prototype$L.initialize = function(el, origin, obj) { - this._canvas = el && domFind(el, 'canvas'); - - // add minimal events required for proper state management - [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent] - .forEach(type => eventListenerCheck(this, type)); - - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - const eventBundle = type => ( - type === TouchStartEvent || - type === TouchMoveEvent || - type === TouchEndEvent - ) - ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] - : [type]; - - // lazily add listeners to the canvas as needed - function eventListenerCheck(handler, type) { - eventBundle(type).forEach(_ => addEventListener(handler, _)); - } - - function addEventListener(handler, type) { - const canvas = handler.canvas(); - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] - ? evt => handler[type](evt) - : evt => handler.fire(type, evt) - ); - } - } - - // return the backing canvas instance - prototype$L.canvas = function() { - return this._canvas; - }; - - // retrieve the current canvas context - prototype$L.context = function() { - return this._canvas.getContext('2d'); - }; - - // supported events - prototype$L.events = Events; - - function move(moveEvent, overEvent, outEvent) { - return function(evt) { - const a = this._active, - p = this.pickEvent(evt); - - if (p === a) { - // active item and picked item are the same - this.fire(moveEvent, evt); // fire move - } else { - // active item and picked item are different - if (!a || !a.exit) { - // fire out for prior active item - // suppress if active item was removed from scene - this.fire(outEvent, evt); - } - this._active = p; // set new active item - this.fire(overEvent, evt); // fire over for new active item - this.fire(moveEvent, evt); // fire move for new active item - } - }; - } - - function inactive(type) { - return function(evt) { - this.fire(type, evt); - this._active = null; - }; - } - - // to keep old versions of firefox happy - prototype$L.DOMMouseScroll = function(evt) { - this.fire(MouseWheelEvent, evt); - }; - - prototype$L.mousemove = move(MouseMoveEvent, MouseOverEvent, MouseOutEvent); - prototype$L.dragover = move(DragOverEvent, DragEnterEvent, DragLeaveEvent); - - prototype$L.mouseout = inactive(MouseOutEvent); - prototype$L.dragleave = inactive(DragLeaveEvent); - - prototype$L.mousedown = function(evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); - }; - - prototype$L.click = function(evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } - }; - - prototype$L.touchstart = function(evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - - if (this._first) { - this._active = this._touch; - this._first = false; - } - - this.fire(TouchStartEvent, evt, true); - }; - - prototype$L.touchmove = function(evt) { - this.fire(TouchMoveEvent, evt, true); - }; - - prototype$L.touchend = function(evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; - }; - - // fire an event - prototype$L.fire = function(type, evt, touch) { - const a = touch ? this._touch : this._active, - h = this._handlers[type]; - - // set event type relative to scenegraph items - evt.vegaType = type; - - // handle hyperlinks and tooltips first - if (type === HrefEvent && a && a.href) { - this.handleHref(evt, a, a.href); - } else if (type === TooltipShowEvent || type === TooltipHideEvent) { - this.handleTooltip(evt, a, type !== TooltipHideEvent); - } - - // invoke all registered handlers - if (h) { - for (let i=0, len=h.length; i= 0) { - h.splice(i, 1); - } - - return this; - }; - - prototype$L.pickEvent = function(evt) { - const p = point(evt, this._canvas), - o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); - }; - - // find the scenegraph item at the current mouse position - // x, y -- the absolute x, y mouse coordinates on the canvas element - // gx, gy -- the relative coordinates within the current group - prototype$L.pick = function(scene, x, y, gx, gy) { - const g = this.context(), - mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); - }; - - function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; - } - - var pixelRatio = devicePixelRatio(); - - function resize(canvas, width, height, origin, scaleFactor, opt) { - const inDOM = typeof HTMLElement !== 'undefined' - && canvas instanceof HTMLElement - && canvas.parentNode != null, - context = canvas.getContext('2d'), - ratio = inDOM ? pixelRatio : scaleFactor; - - canvas.width = width * ratio; - canvas.height = height * ratio; - - for (const key in opt) { - context[key] = opt[key]; - } - - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - } - - context.pixelRatio = ratio; - context.setTransform( - ratio, 0, 0, ratio, - ratio * origin[0], - ratio * origin[1] - ); - - return canvas; - } - - function CanvasRenderer(loader) { - Renderer.call(this, loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); - } - - const prototype$M = inherits(CanvasRenderer, Renderer), - base = Renderer.prototype; - - prototype$M.initialize = function(el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - - this._canvas = this._options.externalContext - ? null - : domCanvas(1, 1, this._options.type); // instantiate a small canvas - - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - this._canvas.setAttribute('class', 'marks'); - } - - // this method will invoke resize to size the canvas appropriately - return base.initialize.call(this, el, width, height, origin, scaleFactor); - }; - - prototype$M.resize = function(width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - - if (this._canvas) { - // configure canvas size and transform - resize(this._canvas, this._width, this._height, - this._origin, this._scale, this._options.context); - } else { - // external context needs to be scaled and positioned to origin - const ctx = this._options.externalContext; - if (!ctx) error('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - - this._redraw = true; - return this; - }; - - prototype$M.canvas = function() { - return this._canvas; - }; - - prototype$M.context = function() { - return this._options.externalContext - || (this._canvas ? this._canvas.getContext('2d') : null); - }; - - prototype$M.dirty = function(item) { - let b = this._tempb.clear().union(item.bounds), - g = item.mark.group; - - while (g) { - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; - } - - this._dirty.union(b); - }; - - function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); - - // align to base pixel grid in case of non-integer scaling (#2425) - if (g.pixelRatio % 1) { - b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - } - - // to avoid artifacts translate if origin has fractional pixels - b.translate(-(origin[0] % 1), -(origin[1] % 1)); - - // set clip path - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - - return b; - } - - const viewBounds = (origin, width, height) => new Bounds() - .set(0, 0, width, height) - .translate(-origin[0], -origin[1]); - - prototype$M._render = function(scene) { - const g = this.context(), - o = this._origin, - w = this._width, - h = this._height, - db = this._dirty, - vb = viewBounds(o, w, h); - - // setup - g.save(); - const b = this._redraw || db.empty() - ? (this._redraw = false, vb.expand(1)) - : clipToBounds(g, vb.intersect(db), o); - - this.clear(-o[0], -o[1], w, h); - - // render - this.draw(g, scene, b); - - // takedown - g.restore(); - db.clear(); - - return this; - }; - - prototype$M.draw = function(ctx, scene, bounds) { - const mark = Marks[scene.marktype]; - if (scene.clip) clip$1(ctx, scene); - mark.draw.call(this, ctx, scene, bounds); - if (scene.clip) ctx.restore(); - }; - - prototype$M.clear = function(x, y, w, h) { - const opt = this._options, - g = this.context(); - - if (opt.type !== 'pdf' && !opt.externalContext) { - // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - } - - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } - }; - - function SVGHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - const h = this; - h._hrefHandler = listener(h, (evt, item) => { - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, (evt, item) => { - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); - }); - } - - const prototype$N = inherits(SVGHandler, Handler); - - prototype$N.initialize = function(el, origin, obj) { - let svg = this._svg; - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - this._svg = svg = el && domFind(el, 'svg'); - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - prototype$N.canvas = function() { - return this._svg; - }; - - // wrap an event listener for the SVG DOM - const listener = (context, handler) => evt => { - let item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; - - // add an event handler - prototype$N.on = function(type, handler) { - const name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - const x = { - type, - handler, - listener: listener(this, handler) - }; - - (h[name] || (h[name] = [])).push(x); - if (this._svg) { - this._svg.addEventListener(name, x.listener); - } - } - - return this; - }; - - // remove an event handler - prototype$N.off = function(type, handler) { - const name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - if (this._svg) { - this._svg.removeEventListener(name, h[i].listener); - } - h.splice(i, 1); - } - - return this; - }; - - function bandSpace(count, paddingInner, paddingOuter) { - var space = count - paddingInner + paddingOuter * 2; - return count ? (space > 0 ? space : 1) : 0; - } - - const Identity = 'identity'; - - const Linear = 'linear'; - const Log = 'log'; - const Pow = 'pow'; - const Sqrt = 'sqrt'; - const Symlog = 'symlog'; - - const Time = 'time'; - const UTC = 'utc'; - - const Sequential = 'sequential'; - const Diverging = 'diverging'; - - const Quantile$1 = 'quantile'; - const Quantize = 'quantize'; - const Threshold = 'threshold'; - - const Ordinal = 'ordinal'; - const Point = 'point'; - const Band = 'band'; - const BinOrdinal = 'bin-ordinal'; - - // categories - const Continuous = 'continuous'; - const Discrete = 'discrete'; - const Discretizing = 'discretizing'; - const Interpolating = 'interpolating'; - const Temporal = 'temporal'; - - function invertRange(scale) { - return function(_) { - var lo = _[0], - hi = _[1], - t; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - return [ - scale.invert(lo), - scale.invert(hi) - ]; - }; - } - - function invertRangeExtent(scale) { - return function(_) { - var range = scale.range(), - lo = _[0], - hi = _[1], - min = -1, max, t, i, n; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - for (i=0, n=range.length; i= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - } - - if (min < 0) return undefined; - - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - - return [ - lo[0] === undefined ? lo[1] : lo[0], - hi[1] === undefined ? hi[0] : hi[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: { - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); - break; - } - default: { - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; - } - } - return this; - } - - const implicit = Symbol("implicit"); - - function ordinal() { - var index = new Map(), - domain = [], - range = [], - unknown = implicit; - - function scale(d) { - var key = d + "", i = index.get(key); - if (!i) { - if (unknown !== implicit) return unknown; - index.set(key, i = domain.push(d)); - } - return range[(i - 1) % range.length]; - } - - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new Map(); - for (const value of _) { - const key = value + ""; - if (index.has(key)) continue; - index.set(key, domain.push(value)); - } - return scale; - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return ordinal(domain, range).unknown(unknown); - }; - - initRange.apply(scale, arguments); - - return scale; - } - - function constant$1(x) { - return function() { - return x; - }; - } - - function number$2(x) { - return +x; - } - - var unit = [0, 1]; - - function identity$1(x) { - return x; - } - - function normalize(a, b) { - return (b -= (a = +a)) - ? function(x) { return (x - a) / b; } - : constant$1(isNaN(b) ? NaN : 0.5); - } - - function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = 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 corresponding parameter t in [0,1]. - // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. - function bimap(domain, range, interpolate) { - var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function(x) { return r0(d0(x)); }; - } - - function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, - d = new Array(j), - r = new Array(j), - i = -1; - - // Reverse descending domains. - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - - while (++i < j) { - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - - return function(x) { - var i = 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() { - var domain = unit, - range = unit, - interpolate = $$1.interpolate, - transform, - untransform, - unknown, - clamp = identity$1, - piecewise, - output, - input; - - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); - } - - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), $$1.interpolateNumber)))(y))); - }; - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, number$2), rescale()) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.rangeRound = function(_) { - return range = Array.from(_), interpolate = $$1.interpolateRound, rescale(); - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1; - }; - - scale.interpolate = function(_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t, u) { - transform = t, untransform = u; - return rescale(); - }; - } - - function continuous() { - return transformer()(identity$1, identity$1); - } - - function tickFormat(start, stop, count, specifier) { - var step = tickStep(start, stop, count), - precision; - specifier = d3Format.formatSpecifier(specifier == null ? ",f" : specifier); - switch (specifier.type) { - case "s": { - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = d3Format.precisionPrefix(step, value))) specifier.precision = precision; - return d3Format.formatPrefix(specifier, value); - } - case "": - case "e": - case "g": - case "p": - case "r": { - if (specifier.precision == null && !isNaN(precision = d3Format.precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - } - case "f": - case "%": { - if (specifier.precision == null && !isNaN(precision = d3Format.precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - return d3Format.format(specifier); - } - - function linearish(scale) { - var domain = scale.domain; - - scale.ticks = function(count) { - var d = domain(); - return ticks(d[0], d[d.length - 1], count == null ? 10 : count); - }; - - scale.tickFormat = function(count, specifier) { - var d = domain(); - return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - - scale.nice = function(count) { - if (count == null) count = 10; - - var d = domain(), - i0 = 0, - i1 = d.length - 1, - start = d[i0], - stop = d[i1], - step; - - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - - step = tickIncrement(start, stop, count); - - if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - step = tickIncrement(start, stop, count); - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - step = tickIncrement(start, stop, count); - } - - if (step > 0) { - d[i0] = Math.floor(start / step) * step; - d[i1] = Math.ceil(stop / step) * step; - domain(d); - } else if (step < 0) { - d[i0] = Math.ceil(start * step) / step; - d[i1] = Math.floor(stop * step) / step; - domain(d); - } - - return scale; - }; - - return scale; - } - - function linear() { - var scale = continuous(); - - scale.copy = function() { - return copy(scale, linear()); - }; - - initRange.apply(scale, arguments); - - return linearish(scale); - } - - function identity$2(domain) { - var unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : x; - } - - scale.invert = scale; - - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, number$2), scale) : domain.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return identity$2(domain).unknown(unknown); - }; - - domain = arguments.length ? Array.from(domain, number$2) : [0, 1]; - - return linearish(scale); - } - - function nice(domain, interval) { - domain = domain.slice(); - - var i0 = 0, - i1 = domain.length - 1, - x0 = domain[i0], - x1 = domain[i1], - t; - - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - - domain[i0] = interval.floor(x0); - domain[i1] = 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 === 10 ? pow10 - : base === Math.E ? Math.exp - : function(x) { return Math.pow(base, x); }; - } - - function logp(base) { - return base === Math.E ? Math.log - : base === 10 && Math.log10 - || base === 2 && Math.log2 - || (base = Math.log(base), function(x) { return Math.log(x) / base; }); - } - - function reflect(f) { - return function(x) { - return -f(-x); - }; - } - - function loggish(transform) { - var scale = transform(transformLog, transformExp), - domain = scale.domain, - base = 10, - logs, - pows; - - function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else { - transform(transformLog, transformExp); - } - return scale; - } - - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.ticks = function(count) { - var d = domain(), - u = d[0], - v = d[d.length - 1], - r; - - if (r = v < u) i = u, u = v, v = i; - - var i = logs(u), - j = logs(v), - p, - k, - t, - n = count == null ? 10 : +count, - z = []; - - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for (; i <= j; ++i) { - for (k = 1, p = pows(i); k < base; ++k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } else for (; i <= j; ++i) { - for (k = base - 1, p = pows(i); k >= 1; --k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } - if (z.length * 2 < n) z = ticks(u, v, n); - } else { - z = ticks(i, j, Math.min(j - i, n)).map(pows); - } - - return r ? z.reverse() : z; - }; - - scale.tickFormat = function(count, specifier) { - if (specifier == null) specifier = base === 10 ? ".0e" : ","; - if (typeof specifier !== "function") specifier = d3Format.format(specifier); - if (count === Infinity) return specifier; - if (count == null) count = 10; - var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - return function(d) { - var i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; - }; - - scale.nice = 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$2() { - var scale = loggish(transformer()).domain([1, 10]); - - scale.copy = function() { - return copy(scale, log$2()).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 = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - - return linearish(scale); - } - - function symlog$1() { - var scale = symlogish(transformer()); - - scale.copy = function() { - return copy(scale, symlog$1()).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 = transform(identity$1, identity$1), - exponent = 1; - - function rescale() { - return exponent === 1 ? transform(identity$1, identity$1) - : exponent === 0.5 ? transform(transformSqrt, transformSquare) - : transform(transformPow(exponent), transformPow(1 / exponent)); - } - - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - - return linearish(scale); - } - - function pow$1() { - var scale = powish(transformer()); - - scale.copy = function() { - return copy(scale, pow$1()).exponent(scale.exponent()); - }; - - initRange.apply(scale, arguments); - - return scale; - } - - function sqrt() { - return pow$1.apply(null, arguments).exponent(0.5); - } - - function quantile$1() { - var domain = [], - range = [], - thresholds = [], - unknown; - - function rescale() { - var i = 0, n = Math.max(1, range.length); - thresholds = new Array(n - 1); - while (++i < n) thresholds[i - 1] = quantile(domain, i / n); - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : range[bisectRight(thresholds, x)]; - } - - scale.invertExtent = function(y) { - var i = 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 = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort(ascending); - return rescale(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.quantiles = function() { - return thresholds.slice(); - }; - - scale.copy = function() { - return quantile$1() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); - } - - function quantize() { - var x0 = 0, - x1 = 1, - n = 1, - domain = [0.5], - range = [0, 1], - unknown; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - function rescale() { - var i = -1; - domain = new Array(n); - while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; - }; - - scale.range = function(_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [NaN, NaN] - : i < 1 ? [x0, domain[0]] - : i >= n ? [domain[n - 1], x1] - : [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - - scale.thresholds = function() { - return domain.slice(); - }; - - scale.copy = function() { - return quantize() - .domain([x0, x1]) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(linearish(scale), arguments); - } - - function threshold() { - var domain = [0.5], - range = [0, 1], - unknown, - n = 1; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return threshold() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); - } - - var durationSecond$1 = 1000, - durationMinute$1 = durationSecond$1 * 60, - durationHour$1 = durationMinute$1 * 60, - durationDay$1 = durationHour$1 * 24, - durationWeek$1 = durationDay$1 * 7, - durationMonth$1 = durationDay$1 * 30, - durationYear$1 = durationDay$1 * 365; - - function date(t) { - return new Date(t); - } - - function number$3(t) { - return t instanceof Date ? +t : +new Date(+t); - } - - function calendar(year, month, week, day, hour, minute, second, millisecond, format) { - var scale = continuous(), - invert = scale.invert, - domain = scale.domain; - - var formatMillisecond = format(".%L"), - formatSecond = format(":%S"), - formatMinute = format("%I:%M"), - formatHour = format("%I %p"), - formatDay = format("%a %d"), - formatWeek = format("%b %d"), - formatMonth = format("%B"), - formatYear = format("%Y"); - - var tickIntervals = [ - [second, 1, durationSecond$1], - [second, 5, 5 * durationSecond$1], - [second, 15, 15 * durationSecond$1], - [second, 30, 30 * durationSecond$1], - [minute, 1, durationMinute$1], - [minute, 5, 5 * durationMinute$1], - [minute, 15, 15 * durationMinute$1], - [minute, 30, 30 * durationMinute$1], - [ hour, 1, durationHour$1 ], - [ hour, 3, 3 * durationHour$1 ], - [ hour, 6, 6 * durationHour$1 ], - [ hour, 12, 12 * durationHour$1 ], - [ day, 1, durationDay$1 ], - [ day, 2, 2 * durationDay$1 ], - [ week, 1, durationWeek$1 ], - [ month, 1, durationMonth$1 ], - [ month, 3, 3 * durationMonth$1 ], - [ year, 1, durationYear$1 ] - ]; - - function tickFormat(date) { - return (second(date) < date ? formatMillisecond - : minute(date) < date ? formatSecond - : hour(date) < date ? formatMinute - : day(date) < date ? formatHour - : month(date) < date ? (week(date) < date ? formatDay : formatWeek) - : year(date) < date ? formatMonth - : formatYear)(date); - } - - function tickInterval(interval, start, stop) { - if (interval == null) interval = 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 === "number") { - var target = Math.abs(stop - start) / interval, - i = bisector(function(i) { return i[2]; }).right(tickIntervals, target), - step; - if (i === tickIntervals.length) { - step = tickStep(start / durationYear$1, stop / durationYear$1, interval); - interval = year; - } else if (i) { - i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - step = i[1]; - interval = i[0]; - } else { - step = Math.max(tickStep(start, stop, interval), 1); - interval = millisecond; - } - return interval.every(step); - } - - return interval; - } - - scale.invert = function(y) { - return new Date(invert(y)); - }; - - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number$3)) : domain().map(date); - }; - - scale.ticks = function(interval) { - var d = domain(), - t0 = d[0], - t1 = d[d.length - 1], - r = t1 < t0, - t; - if (r) t = t0, t0 = t1, t1 = t; - t = tickInterval(interval, t0, t1); - t = t ? t.range(t0, t1 + 1) : []; // inclusive stop - return r ? t.reverse() : t; - }; - - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - - scale.nice = function(interval) { - var d = domain(); - return (interval = tickInterval(interval, d[0], d[d.length - 1])) - ? domain(nice(d, interval)) - : scale; - }; - - scale.copy = function() { - return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); - }; - - return scale; - } - - function time() { - return initRange.apply(calendar(d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3Time.timeMillisecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); - } - - function utcTime() { - return initRange.apply(calendar(d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3Time.utcMillisecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); - } - - function transformer$1() { - var x0 = 0, - x1 = 1, - t0, - t1, - k10, - transform, - interpolator = identity$1, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; - }; - } - - scale.range = range($$1.interpolate); - - scale.rangeRound = range($$1.interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === 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 = linearish(transformer$1()(identity$1)); - - scale.copy = function() { - return copy$1(scale, sequential()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialLog() { - var scale = loggish(transformer$1()).domain([1, 10]); - - scale.copy = function() { - return copy$1(scale, sequentialLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialSymlog() { - var scale = symlogish(transformer$1()); - - scale.copy = function() { - return copy$1(scale, sequentialSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialPow() { - var scale = powish(transformer$1()); - - scale.copy = 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 transformer$2() { - var x0 = 0, - x1 = 0.5, - x2 = 1, - s = 1, - t0, - t1, - t2, - k10, - k21, - interpolator = identity$1, - transform, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = $$1.piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - - scale.range = range($$1.interpolate); - - scale.rangeRound = range($$1.interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; - } - - function diverging() { - var scale = linearish(transformer$2()(identity$1)); - - scale.copy = function() { - return copy$1(scale, diverging()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingLog() { - var scale = loggish(transformer$2()).domain([0.1, 1, 10]); - - scale.copy = function() { - return copy$1(scale, divergingLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingSymlog() { - var scale = symlogish(transformer$2()); - - scale.copy = function() { - return copy$1(scale, divergingSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingPow() { - var scale = powish(transformer$2()); - - scale.copy = 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 band() { - var scale = ordinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - range = [0, 1], - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = range[1] < range[0], - start = range[reverse - 0], - stop = range[1 - reverse], - space = bandSpace(n, paddingInner, paddingOuter); - - step = (stop - start) / (space || 1); - if (round) { - step = Math.floor(step); - } - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - var values = sequence(n).map(function(i) { return start + step * i; }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function(_) { - if (arguments.length) { - domain(_); - return rescale(); - } else { - return domain(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = [+_[0], +_[1]]; - return rescale(); - } else { - return range.slice(); - } - }; - - scale.rangeRound = function(_) { - range = [+_[0], +_[1]]; - round = true; - return rescale(); - }; - - scale.bandwidth = function() { - return bandwidth; - }; - - scale.step = function() { - return step; - }; - - scale.round = function(_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else { - return round; - } - }; - - scale.padding = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingInner = function(_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingOuter = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingOuter; - } - }; - - scale.align = function(_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return align; - } - }; - - scale.invertRange = function(_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - - var lo = +_[0], - hi = +_[1], - reverse = range[1] < range[0], - values = reverse ? ordinalRange().reverse() : ordinalRange(), - n = values.length - 1, a, b, t; - - // bail if either range endpoint is invalid - if (lo !== lo || hi !== hi) return; - - // order range inputs, bail if outside of scale range - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - if (hi < values[0] || lo > range[1-reverse]) return; - - // binary search to index into scale range - a = Math.max(0, bisectRight(values, lo) - 1); - b = lo===hi ? a : bisectRight(values, hi) - 1; - - // increment index a if lo is within padding gap - if (lo - values[a] > bandwidth + 1e-10) ++a; - - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - return (a > b) ? undefined : domain().slice(a, b+1); - }; - - scale.invert = function(_) { - var value = scale.invertRange([_, _]); - return value ? value[0] : value; - }; - - scale.copy = function() { - return band() - .domain(domain()) - .range(range) - .round(round) - .paddingInner(paddingInner) - .paddingOuter(paddingOuter) - .align(align); - }; - - return rescale(); - } - - function pointish(scale) { - var copy = scale.copy; - - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - - scale.copy = function() { - return pointish(copy()); - }; - - return scale; - } - - function point$1() { - return pointish(band().paddingInner(1)); - } - - var map = Array.prototype.map; - - function numbers$2(_) { - return map.call(_, function(x) { return +x; }); - } - - var slice = Array.prototype.slice; - - function scaleBinOrdinal() { - var domain = [], - range = []; - - function scale(x) { - return x == null || x !== x - ? undefined - : range[(bisectRight(domain, x) - 1) % range.length]; - } - - scale.domain = function(_) { - if (arguments.length) { - domain = numbers$2(_); - return scale; - } else { - return domain.slice(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else { - return range.slice(); - } - }; - - scale.tickFormat = function(count, specifier) { - return tickFormat(domain[0], peek(domain), count == null ? 10 : count, specifier); - }; - - scale.copy = function() { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - - return scale; - } - - // scale registry - const scales = {}; - - /** - * Augment scales with their type and needed inverse methods. - */ - function create(type, constructor, metadata) { - const ctr = function scale() { - var s = constructor(); - - if (!s.invertRange) { - s.invertRange = s.invert ? invertRange(s) - : s.invertExtent ? invertRangeExtent(s) - : undefined; - } - - s.type = type; - return s; - }; - - ctr.metadata = toSet(array(metadata)); - - return ctr; - } - - function scale$2(type, scale, metadata) { - if (arguments.length > 1) { - scales[type] = create(type, scale, metadata); - return this; - } else { - return isValidScaleType(type) ? scales[type] : undefined; - } - } - - // identity scale - scale$2(Identity, identity$2); - - // continuous scales - scale$2(Linear, linear, Continuous); - scale$2(Log, log$2, [Continuous, Log]); - scale$2(Pow, pow$1, Continuous); - scale$2(Sqrt, sqrt, Continuous); - scale$2(Symlog, symlog$1, Continuous); - scale$2(Time, time, [Continuous, Temporal]); - scale$2(UTC, utcTime, [Continuous, Temporal]); - - // sequential scales - scale$2(Sequential, sequential, [Continuous, Interpolating]); // backwards compat - scale$2(`${Sequential}-${Linear}`, sequential, [Continuous, Interpolating]); - scale$2(`${Sequential}-${Log}`, sequentialLog, [Continuous, Interpolating, Log]); - scale$2(`${Sequential}-${Pow}`, sequentialPow, [Continuous, Interpolating]); - scale$2(`${Sequential}-${Sqrt}`, sequentialSqrt, [Continuous, Interpolating]); - scale$2(`${Sequential}-${Symlog}`, sequentialSymlog, [Continuous, Interpolating]); - - // diverging scales - scale$2(`${Diverging}-${Linear}`, diverging, [Continuous, Interpolating]); - scale$2(`${Diverging}-${Log}`, divergingLog, [Continuous, Interpolating, Log]); - scale$2(`${Diverging}-${Pow}`, divergingPow, [Continuous, Interpolating]); - scale$2(`${Diverging}-${Sqrt}`, divergingSqrt, [Continuous, Interpolating]); - scale$2(`${Diverging}-${Symlog}`, divergingSymlog, [Continuous, Interpolating]); - - // discretizing scales - scale$2(Quantile$1, quantile$1, [Discretizing, Quantile$1]); - scale$2(Quantize, quantize, Discretizing); - scale$2(Threshold, threshold, Discretizing); - - // discrete scales - scale$2(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]); - scale$2(Ordinal, ordinal, Discrete); - scale$2(Band, band, Discrete); - scale$2(Point, point$1, Discrete); - - function isValidScaleType(type) { - return hasOwnProperty(scales, type); - } - - function hasType(key, type) { - const s = scales[key]; - return s && s.metadata[type]; - } - - function isContinuous(key) { - return hasType(key, Continuous); - } - - function isDiscrete(key) { - return hasType(key, Discrete); - } - - function isDiscretizing(key) { - return hasType(key, Discretizing); - } - - function isLogarithmic(key) { - return hasType(key, Log); - } - - function isTemporal(key) { - return hasType(key, Temporal); - } - - function isInterpolating(key) { - return hasType(key, Interpolating); - } - - function isQuantile(key) { - return hasType(key, Quantile$1); - } - - const scaleProps = ['clamp', 'base', 'constant', 'exponent']; - - function interpolateRange(interpolator, range) { - var start = range[0], - span = peek(range) - start; - return function(i) { return interpolator(start + i * span); }; - } - - function interpolateColors(colors, type, gamma) { - return $$1.piecewise(interpolate(type || 'rgb', gamma), colors); - } - - function quantizeInterpolator(interpolator, count) { - var samples = new Array(count), - n = count + 1; - for (var i = 0; i < count;) samples[i] = interpolator(++i / n); - return samples; - } - - function scaleFraction(scale, min, max) { - var delta = max - min, i, t, s; - - if (!delta || !Number.isFinite(delta)) { - return constant(0.5); - } else { - i = (t = scale.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale$2(t)().domain([min, max]).range([0, 1]); - scaleProps.forEach(m => scale[m] ? s[m](scale[m]()) : 0); - return s; - } - } - - function interpolate(type, gamma) { - var interp = $$1[method(type)]; - return (gamma != null && interp && interp.gamma) - ? interp.gamma(gamma) - : interp; - } - - function method(type) { - return 'interpolate' + type.toLowerCase() - .split('-') - .map(function(s) { return s[0].toUpperCase() + s.slice(1); }) - .join(''); - } - - const continuous$1 = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' - }; - - const discrete = { - category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', - accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', - dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', - paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', - pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', - pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', - set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', - set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', - set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' - }; - - function colors(palette) { - var n = palette.length / 6 | 0, c = new Array(n), i = 0; - while (i < n) c[i] = '#' + palette.slice(i * 6, ++i * 6); - return c; - } - - function apply(_, f) { - for (let k in _) scheme(k, f(_[k])); - } - - const schemes = {}; - apply(discrete, colors); - apply(continuous$1, _ => interpolateColors(colors(_))); - - function scheme(name, scheme) { - name = name && name.toLowerCase(); - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else { - return schemes[name]; - } - } - - var SymbolLegend = 'symbol'; - var DiscreteLegend = 'discrete'; - var GradientLegend = 'gradient'; - - const defaultFormatter = value => isArray(value) - ? value.map(v => String(v)) - : String(value); - - const ascending$1 = (a, b) => a[1] - b[1]; - const descending = (a, b) => b[1] - a[1]; - - /** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ - function tickCount(scale, count, minStep) { - var step; - - if (isNumber(count)) { - if (scale.bins) { - count = Math.max(count, scale.bins.length); - } - if (minStep != null) { - count = Math.min( - count, - Math.floor((span(scale.domain()) / minStep) || 1) - ); - } - } - - if (isObject(count)) { - step = count.step; - count = count.interval; - } - - if (isString(count)) { - count = scale.type === Time ? timeInterval(count) - : scale.type == UTC ? utcInterval(count) - : error('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - - return count; - } - - /** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ - function validTicks(scale, ticks, count) { - let range = scale.range(), - lo = range[0], - hi = peek(range), - cmp = ascending$1; - - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - - lo = Math.floor(lo); - hi = Math.ceil(hi); - - // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - ticks = ticks.map(v => [v, scale(v)]) - .filter(_ => lo <= _[1] && _[1] <= hi) - .sort(cmp) - .map(_ => _[0]); - - if (count > 0 && ticks.length > 1) { - const endpoints = [ticks[0], peek(ticks)]; - while (ticks.length > count && ticks.length >= 3) { - ticks = ticks.filter((_, i) => !(i % 2)); - } - if (ticks.length < 3) { - ticks = endpoints; - } - } - - return ticks; - } - - /** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ - function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins) - : scale.ticks ? scale.ticks(count) - : scale.domain(); - } - - /** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ - function tickFormat$1(locale, scale, count, specifier, formatType, noSkip) { - var type = scale.type; - let format = defaultFormatter; - - if (type === Time || formatType === Time) { - format = locale.timeFormat(specifier); - } - else if (type === UTC || formatType === UTC) { - format = locale.utcFormat(specifier); - } - else if (isLogarithmic(type)) { - const varfmt = locale.formatFloat(specifier); - if (noSkip || scale.bins) { - format = varfmt; - } else { - const test = tickLog(scale, count, false); - format = _ => test(_) ? varfmt(_) : ''; - } - } - else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - const d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } - else if (specifier) { - format = locale.format(specifier); - } - - return format; - } - - function tickLog(scale, count, values) { - const ticks = tickValues(scale, count), - base = scale.base(), - logb = Math.log(base), - k = Math.max(1, base * count / ticks.length); - - // apply d3-scale's log format filter criteria - const test = d => { - let i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - - return values ? ticks.filter(test) : test; - } - - const symbols$1 = { - [Quantile$1]: 'quantiles', - [Quantize]: 'thresholds', - [Threshold]: 'domain' - }; - - const formats$1 = { - [Quantile$1]: 'quantiles', - [Quantize]: 'domain' - }; - - function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) - : scale.type === Log ? tickLog(scale, count, true) - : symbols$1[scale.type] ? thresholdValues(scale[symbols$1[scale.type]]()) - : tickValues(scale, count); - } - - function thresholdFormat(locale, scale, specifier) { - var _ = scale[formats$1[scale.type]](), - n = _.length, - d = n > 1 ? _[1] - _[0] : _[0], i; - - for (i=1; i { - var limit = get$2(array[index + 1], get$2(array.max, +Infinity)), - lo = formatValue(value, format), - hi = formatValue(limit, format); - return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo; - }; - } - - function get$2(value, dflt) { - return value != null ? value : dflt; - } - - function formatDiscrete(format) { - return (value, index) => index ? format(value) : null; - } - - function formatPoint(format) { - return value => format(value); - } - - function formatValue(value, format) { - return Number.isFinite(value) ? format(value) : null; - } - - function labelFraction(scale) { - var domain = scale.domain(), - count = domain.length - 1, - lo = +domain[0], - hi = +peek(domain), - span = hi - lo; - - if (scale.type === Threshold) { - const adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - - return value => (value - lo) / span; - } - - function format$1(locale, scale, specifier, formatType) { - const type = formatType || scale.type; - - // replace abbreviated time specifiers to improve screen reader experience - if (isString(specifier) && isTemporal(type)) { - specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - } - - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') - : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') - : labelFormat(locale, scale, 5, null, specifier, formatType, true); - } - - function domainCaption(locale, scale, opt) { - opt = opt || {}; - const max = Math.max(3, opt.maxlen || 7), - fmt = format$1(locale, scale, opt.format, opt.formatType); - - // if scale breaks domain into bins, describe boundaries - if (isDiscretizing(scale.type)) { - const v = labelValues(scale).slice(1).map(fmt), - n = v.length; - return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`; - } - - // if scale domain is discrete, list values - else if (isDiscrete(scale.type)) { - const d = scale.domain(), - n = d.length, - v = n > max - ? d.slice(0, max - 2).map(fmt).join(', ') - + ', ending with ' + d.slice(-1).map(fmt) - : d.map(fmt).join(', '); - return `${n} value${n === 1 ? '' : 's'}: ${v}`; - } - - // if scale domain is continuous, describe value range - else { - const d = scale.domain(); - return `values from ${fmt(d[0])} to ${fmt(peek(d))}`; - } - } - - const ARIA_HIDDEN = 'aria-hidden'; - const ARIA_LABEL = 'aria-label'; - const ARIA_ROLE = 'role'; - const ARIA_ROLEDESCRIPTION = 'aria-roledescription'; - const GRAPHICS_OBJECT = 'graphics-object'; - const GRAPHICS_SYMBOL = 'graphics-symbol'; - - const bundle = (role, roledesc, label) => ({ - [ARIA_ROLE]: role, - [ARIA_ROLEDESCRIPTION]: roledesc, - [ARIA_LABEL]: label || undefined - }); - - // these roles are covered by related roles - // we can ignore them, no need to generate attributes - const AriaIgnore = toSet([ - 'axis-domain', - 'axis-grid', - 'axis-label', - 'axis-tick', - 'axis-title', - 'legend-band', - 'legend-entry', - 'legend-gradient', - 'legend-label', - 'legend-title', - 'legend-symbol', - 'title' - ]); - - // aria attribute generators for guide roles - const AriaGuides = { - 'axis': {desc: 'axis', caption: axisCaption}, - 'legend': {desc: 'legend', caption: legendCaption}, - 'title-text': { - desc: 'title', - caption: item => `Title text '${titleCaption(item)}'` - }, - 'title-subtitle': { - desc: 'subtitle', - caption: item => `Subtitle text '${titleCaption(item)}'` - } - }; - - // aria properties generated for mark item encoding channels - const AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL - }; - - function ariaItemAttributes(emit, item) { - const hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - - if (hide || item.description == null) { - for (const prop in AriaEncode) { - emit(AriaEncode[prop], undefined); - } - } else { - const type = item.mark.marktype; - emit( - ARIA_LABEL, - item.description - ); - emit( - ARIA_ROLE, - item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL) - ); - emit( - ARIA_ROLEDESCRIPTION, - item.ariaRoleDescription || `${type} mark` - ); - } - } - - function ariaMarkAttributes(mark) { - return mark.aria === false ? { [ARIA_HIDDEN]: true } - : AriaIgnore[mark.role] ? null - : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) - : ariaMark(mark); - } - - function ariaMark(mark) { - const type = mark.marktype; - const recurse = ( - type === 'group' || - type === 'text' || - mark.items.some(_ => _.description != null && _.aria !== false) - ); - return bundle( - recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, - `${type} mark container`, - mark.description - ); - } - - function ariaGuide(mark, opt) { - try { - const item = mark.items[0], - caption = opt.caption || (() => ''); - return bundle( - opt.role || GRAPHICS_SYMBOL, - opt.desc, - item.description || caption(item) - ); - } catch (err) { - return null; - } - } - - function titleCaption(item) { - return array(item.text).join(' '); - } - - function axisCaption(item) { - const datum = item.datum, - orient = item.orient, - title = datum.title ? extractTitle(item) : null, - ctx = item.context, - scale = ctx.scales[datum.scale].value, - locale = ctx.dataflow.locale(), - type = scale.type, - xy = (orient === 'left' || orient === 'right') ? 'Y' : 'X'; - - return `${xy}-axis` - + (title ? ` titled '${title}'` : '') - + ` for a ${isDiscrete(type) ? 'discrete' : type} scale` - + ` with ${domainCaption(locale, scale, item)}`; - } - - function legendCaption(item) { - const datum = item.datum, - title = datum.title ? extractTitle(item) : null, - type = `${datum.type || ''} legend`.trim(), - scales = datum.scales, - props = Object.keys(scales), - ctx = item.context, - scale = ctx.scales[scales[props[0]]].value, - locale = ctx.dataflow.locale(); - - return capitalize(type) - + (title ? ` titled '${title}'` : '') - + ` for ${channelCaption(props)}` - + ` with ${domainCaption(locale, scale, item)}`; - } - - function extractTitle(item) { - try { - return array(peek(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } - } - - function channelCaption(props) { - props = props.map(p => p + (p === 'fill' || p === 'stroke' ? ' color' : '')); - return props.length < 2 ? props[0] - : props.slice(0, -1).join(', ') + ' and ' + peek(props); - } - - function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; - } - - const attrText = val => (val + '') - .replace(/&/g, '&') - .replace(/"/g, '"'); - - /** - * Generate string for an opening xml tag. - * @param tag the name of the xml tag - * @param attr hash of attribute name-value pairs to include - * @param raw additional raw string to include in tag markup - */ - function openTag(tag, attr, raw) { - var s = '<' + tag, key, val; - if (attr) { - for (key in attr) { - val = attr[key]; - if (val != null) { - s += ' ' + key + '="' + attrText(val) + '"'; - } - } - } - if (raw) s += ' ' + raw; - return s + '>'; - } - - /** - * Generate string for closing xml tag. - * @param tag the name of the xml tag - */ - function closeTag(tag) { - return ''; - } - - const styles = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity', - blend: 'mix-blend-mode' - }; - - // ensure miter limit default is consistent with canvas (#2498) - const rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 - }; - - const RootIndex = 0, - ns = metadata.xmlns; - - function SVGRenderer(loader) { - Renderer.call(this, loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; - } - - var prototype$O = inherits(SVGRenderer, Renderer); - var base$1 = Renderer.prototype; - - prototype$O.initialize = function(el, width, height, padding) { - // create the svg definitions cache - this._defs = { - gradient: {}, - clipping: {} - }; - - if (el) { - this._svg = domChild(el, 0, 'svg', ns); - this._svg.setAttribute('class', 'marks'); - domClear(el, 1); - - // set the svg root group - this._root = domChild(this._svg, RootIndex, 'g', ns); - for (const attr in rootAttributes) { - this._root.setAttribute(attr, rootAttributes[attr]); - } - - // ensure no additional child elements - domClear(this._svg, RootIndex + 1); - } - - // set background color if defined - this.background(this._bgcolor); - - return base$1.initialize.call(this, el, width, height, padding); - }; - - prototype$O.background = function(bgcolor) { - if (arguments.length && this._svg) { - this._svg.style.setProperty('background-color', bgcolor); - } - return base$1.background.apply(this, arguments); - }; - - prototype$O.resize = function(width, height, origin, scaleFactor) { - base$1.resize.call(this, width, height, origin, scaleFactor); - - if (this._svg) { - this._svg.setAttribute('width', this._width * this._scale); - this._svg.setAttribute('height', this._height * this._scale); - this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height); - this._root.setAttribute('transform', 'translate(' + this._origin + ')'); - } - - this._dirty = []; - - return this; - }; - - prototype$O.canvas = function() { - return this._svg; - }; - - prototype$O.svg = function() { - if (!this._svg) return null; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - var bg = !this._bgcolor ? '' - : (openTag('rect', { - width: this._width, - height: this._height, - fill: this._bgcolor - }) + closeTag('rect')); - - return openTag('svg', attr) - + (this._defs.el ? this._defs.el.outerHTML : '') - + bg - + this._root.outerHTML - + closeTag('svg'); - }; - - - // -- Render entry point -- - - prototype$O._render = function(scene) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._resetDefs(); - this.draw(this._root, scene); - domClear(this._root, 1); - } - - this.updateDefs(); - - this._dirty = []; - ++this._dirtyID; - - return this; - }; - - // -- Manage SVG definitions ('defs') block -- - - prototype$O.updateDefs = function() { - const svg = this._svg, - defs = this._defs; - - let el = defs.el, - index = 0; - - for (const id in defs.gradient) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateGradient(el, defs.gradient[id], index); - } - - for (const id in defs.clipping) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateClipping(el, defs.clipping[id], index); - } - - // clean-up - if (el) { - index === 0 - ? (svg.removeChild(el), defs.el = null) - : domClear(el, index); - } - }; - - function updateGradient(el, grad, index) { - var i, n, stop; - - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - var pt = domChild(el, index++, 'pattern', ns); - pt.setAttribute('id', patternPrefix + grad.id); - pt.setAttribute('viewBox', '0,0,1,1'); - pt.setAttribute('width', '100%'); - pt.setAttribute('height', '100%'); - pt.setAttribute('preserveAspectRatio', 'xMidYMid slice'); - - pt = domChild(pt, 0, 'rect', ns); - pt.setAttribute('width', '1'); - pt.setAttribute('height', '1'); - pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')'); - - el = domChild(el, index++, 'radialGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('fx', grad.x1); - el.setAttribute('fy', grad.y1); - el.setAttribute('fr', grad.r1); - el.setAttribute('cx', grad.x2); - el.setAttribute('cy', grad.y2); - el.setAttribute( 'r', grad.r2); - } else { - el = domChild(el, index++, 'linearGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('x1', grad.x1); - el.setAttribute('x2', grad.x2); - el.setAttribute('y1', grad.y1); - el.setAttribute('y2', grad.y2); - } - - for (i=0, n=grad.stops.length; i { - const dirty = this.isDirty(item), - node = bind(item, parent, sibling, mdef.tag, svg); - - if (dirty) { - this._update(mdef, node, item); - if (isGroup) recurse(this, node, item); - } - - sibling = node; - ++i; - }; - - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } - - domClear(parent, i); - return parent; - }; - - // Recursively process group contents. - function recurse(renderer, el, group) { - el = el.lastChild.previousSibling; - let prev, idx = 0; - - visit(group, item => { - prev = renderer.draw(el, item, prev); - ++idx; - }); - - // remove any extraneous DOM elements - domClear(el, 1 + idx); - } - - // Bind a scenegraph item to an SVG DOM element. - // Create new SVG elements as needed. - function bind(item, el, sibling, tag, svg) { - let node = item._svg, doc; - - // create a new dom node if needed - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, ns); - item._svg = node; - - if (item.mark) { - node.__data__ = item; - node.__values__ = {fill: 'default'}; - - // if group, create background, content, and foreground elements - if (tag === 'g') { - const bg = domCreate(doc, 'path', ns); - node.appendChild(bg); - bg.__data__ = item; - - const cg = domCreate(doc, 'g', ns); - node.appendChild(cg); - cg.__data__ = item; - - const fg = domCreate(doc, 'path', ns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = {fill: 'default'}; - } - } - } - - // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { - el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - } - - return node; - } - - function siblingCheck(node, sibling) { - return node.parentNode - && node.parentNode.childNodes.length > 1 - && node.previousSibling != sibling; // treat null/undefined the same - } - - - // -- Set attributes & styles on SVG elements --- - - var element = null, // temp var for current SVG element - values = null; // temp var for current values hash - - // Extra configuration for certain mark types - var mark_extras = { - group: function(mdef, el, item) { - const fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - - values = el.__values__; // use parent's values hash - element = el.childNodes[1]; - mdef.content(emit, item, this); - - const bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - - const value = item.mark.interactive === false ? 'none' : null; - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - - if (item.strokeForeground && item.stroke) { - const fill = item.fill; - setAttribute(fg, 'display', null); - - // set style of background - this.style(bg, item); - setAttribute(bg, 'stroke', null); - - // set style of foreground - if (fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (fill) item.fill = fill; - - // leave element null to prevent downstream styling - element = null; - } else { - // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - } - }, - image: function(mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else { - setStyle(el, 'image-rendering', null); - } - }, - text: function(mdef, el, item) { - let tl = textLines(item), - key, value, doc, lh; - - if (isArray(tl)) { - // multi-line text - value = tl.map(_ => textValue(item, _)); - key = value.join('\n'); // content cache key - - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach((t, i) => { - const ts = domCreate(doc, 'tspan', ns); - ts.__data__ = item; // data binding - ts.textContent = t; - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } - }; - - function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) { - el.style.removeProperty(name); - } else { - el.style.setProperty(name, value + ''); - } - values[name] = value; - } - } - - prototype$O._update = function(mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; - - // apply aria-specific properties - ariaItemAttributes(emit, item); - - // apply svg attributes - mdef.attr(emit, item, this); - - // some marks need special treatment - const extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); - - // apply svg style attributes - // note: element may be modified by 'extra' method - if (element) this.style(element, item); - }; - - function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; - - // use appropriate method given namespace (ns) - if (ns) { - setAttributeNS(element, name, value, ns); - } else { - setAttribute(element, name, value); - } - - // note current value for future comparison - values[name] = value; - } - - function setAttribute(el, name, value) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttribute(name, value); - } else { - // else remove DOM attribute - el.removeAttribute(name); - } - } - - function setAttributeNS(el, name, value, ns) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - } else { - // else remove DOM attribute - el.removeAttributeNS(ns, name); - } - } - - prototype$O.style = function(el, o) { - if (o == null) return; - - for (const prop in styles) { - let value = prop === 'font' ? fontFamily(o) : o[prop]; - if (value === values[prop]) continue; - - const name = styles[prop]; - if (value == null) { - el.removeAttribute(name); - } else { - if (isGradient(value)) { - value = gradientRef(value, this._defs.gradient, href()); - } - el.setAttribute(name, value + ''); - } - - values[prop] = value; - } - }; - - function href() { - let loc; - return typeof window === 'undefined' ? '' - : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) - : loc.href; - } - - function SVGStringRenderer(loader) { - Renderer.call(this, loader); - - this._text = { - head: '', - bg: '', - root: '', - foot: '', - defs: '', - body: '' - }; - - this._defs = { - gradient: {}, - clipping: {} - }; - } - - var prototype$P = inherits(SVGStringRenderer, Renderer); - var base$2 = Renderer.prototype; - - prototype$P.resize = function(width, height, origin, scaleFactor) { - base$2.resize.call(this, width, height, origin, scaleFactor); - var o = this._origin, - t = this._text; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - t.head = openTag('svg', attr); - - var bg = this._bgcolor; - if (bg === 'transparent' || bg === 'none') bg = null; - - if (bg) { - t.bg = openTag('rect', { - width: this._width, - height: this._height, - fill: bg - }) + closeTag('rect'); - } else { - t.bg = ''; - } - - t.root = openTag('g', extend( - {}, rootAttributes, {transform: 'translate(' + o + ')'} - )); - - t.foot = closeTag('g') + closeTag('svg'); - - return this; - }; - - prototype$P.background = function() { - var rv = base$2.background.apply(this, arguments); - if (arguments.length && this._text.head) { - this.resize(this._width, this._height, this._origin, this._scale); - } - return rv; - }; - - prototype$P.svg = function() { - var t = this._text; - return t.head + t.defs + t.bg + t.root + t.body + t.foot; - }; - - prototype$P._render = function(scene) { - this._text.body = this.mark(scene); - this._text.defs = this.buildDefs(); - return this; - }; - - prototype$P.buildDefs = function() { - let defs = '', tag; - - for (const id in this._defs.gradient) { - const def = this._defs.gradient[id], - stops = def.stops; - - if (def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - - defs += openTag(tag = 'pattern', { - id: patternPrefix + id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - - defs += openTag('rect', { - width: '1', - height: '1', - fill: 'url(#' + id + ')' - }) + closeTag('rect'); - - defs += closeTag(tag); - - defs += openTag(tag = 'radialGradient', { - id: id, - fx: def.x1, - fy: def.y1, - fr: def.r1, - cx: def.x2, - cy: def.y2, - r: def.r2 - }); - } else { - defs += openTag(tag = 'linearGradient', { - id: id, - x1: def.x1, - x2: def.x2, - y1: def.y1, - y2: def.y2 - }); - } - - for (let i = 0; i < stops.length; ++i) { - defs += openTag('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }) + closeTag('stop'); - } - - defs += closeTag(tag); - } - - for (const id in this._defs.clipping) { - const def = this._defs.clipping[id]; - - defs += openTag('clipPath', {id: id}); - - if (def.path) { - defs += openTag('path', { - d: def.path - }) + closeTag('path'); - } else { - defs += openTag('rect', { - x: 0, - y: 0, - width: def.width, - height: def.height - }) + closeTag('rect'); - } - - defs += closeTag('clipPath'); - } - - return defs ? (openTag('defs') + defs + closeTag('defs')) : ''; - }; - - prototype$P.attr = function(scene, item, attrs, tag) { - const object = {}, - emit = (name, value, ns, prefixed) => { - object[prefixed || name] = value; - }; - - // apply mark specific attributes - if (Array.isArray(attrs)) { - attrs.forEach(fn => fn(emit, item, this)); - } else { - attrs(emit, item, this); - } - - // apply style attributes - if (tag) { - applyStyles(object, item, scene, tag, this._defs); - } - - return object; - }; - - prototype$P.href = function(item) { - var that = this, - href = item.href, - attr; - - if (href) { - if (attr = that._hrefs && that._hrefs[href]) { - return attr; - } else { - that.sanitizeURL(href).then(attr => { - // rewrite to use xlink namespace - // note that this will be deprecated in SVG 2.0 - attr['xlink:href'] = attr.href; - attr.href = null; - (that._hrefs || (that._hrefs = {}))[href] = attr; - }); - } - } - return null; - }; - - prototype$P.mark = function(scene) { - const mdef = Marks[scene.marktype], - tag = mdef.tag, - attrList = [ariaItemAttributes, mdef.attr]; - - let str = ''; - - // render opening group tag - str += openTag('g', extend( - { - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip(this, scene, scene.group) : null - }, - ariaMarkAttributes(scene), - { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - } - )); - - // render contained elements - const process = item => { - const href = this.href(item); - if (href) str += openTag('a', href); - - str += openTag( - tag, - this.attr(scene, item, attrList, tag !== 'g' ? tag : null) - ); - - if (tag === 'text') { - const tl = textLines(item); - if (isArray(tl)) { - // multi-line text - const attrs = {x: 0, dy: lineHeight(item)}; - for (let i=0; i { str += this.mark(item); }); - return str; - }; - - function applyStyles(s, item, scene, tag, defs) { - if (item == null) return s; - - if (tag === 'bgrect' && scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - if (tag === 'bgfore') { - if (scene.interactive === false) { - s['pointer-events'] = 'none'; - } - s.display = 'none'; - if (item.fill !== null) return s; - } - - if (tag === 'image' && item.smooth === false) { - s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;'; - } - - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - if (item.fontStyle) s['font-style'] = item.fontStyle; - if (item.fontVariant) s['font-variant'] = item.fontVariant; - if (item.fontWeight) s['font-weight'] = item.fontWeight; - } - - for (const prop in styles) { - let value = item[prop]; - const name = styles[prop]; - - if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; else if (value != null) { - if (isGradient(value)) { - value = gradientRef(value, defs.gradient, ''); - } - s[name] = value; - } - } - - return s; - } - - function escape_text(s) { - return s.replace(/&/g, '&') - .replace(//g, '>'); - } - - var Canvas = 'canvas'; - var PNG = 'png'; - var SVG = 'svg'; - var None$2 = 'none'; - - var RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - None: None$2 - }; - - var modules = {}; - - modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler - }; - - modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler - }; - - modules[None$2] = {}; - - function renderModule(name, _) { - name = String(name || '').toLowerCase(); - if (arguments.length > 1) { - modules[name] = _; - return this; - } else { - return modules[name]; - } - } - - function intersect(scene, bounds, filter) { - const hits = [], // intersection results - box = new Bounds().union(bounds), // defensive copy - type = scene.marktype; - - return type ? intersectMark(scene, box, filter, hits) - : type === 'group' ? intersectGroup(scene, box, filter, hits) - : error('Intersect scene must be mark node or group item.'); - } - - function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - const items = mark.items, - type = mark.marktype, - n = items.length; - - let i = 0; - - if (type === 'group') { - for (; i= 0; i--) { - if (ka[i] != kb[i]) return false; - } - - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; - } - - return typeof a === typeof b; - } - - function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); - } - - /** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ - function Bound(params) { - Transform.call(this, null, params); - } - - var prototype$Q = inherits(Bound, Transform); - - prototype$Q.transform = function(_, pulse) { - var view = pulse.dataflow, - mark = _.mark, - type = mark.marktype, - entry = Marks[type], - bound = entry.bound, - markBounds = mark.bounds, rebound; - - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem$1(mark, bound); - mark.items.forEach(function(item) { - item.bounds.clear().union(markBounds); - }); - } - - else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, item => view.dirty(item)); - markBounds.clear(); - mark.items.forEach(item => markBounds.union(boundItem$1(item, bound))); - - // force reflow for axes/legends/titles to propagate any layout changes - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } - - else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - - pulse.visit(pulse.ADD, item => { - markBounds.union(boundItem$1(item, bound)); - }); - - pulse.visit(pulse.MOD, item => { - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem$1(item, bound)); - }); - - if (rebound) { - markBounds.clear(); - mark.items.forEach(item => markBounds.union(item.bounds)); - } - } - - // ensure mark bounds do not exceed any clipping region - boundClip(mark); - - return pulse.modifies('bounds'); - }; - - function boundItem$1(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); - } - - var COUNTER_NAME = ':vega_identifier:'; - - /** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ - function Identifier(params) { - Transform.call(this, 0, params); - } - - Identifier.Definition = { - 'type': 'Identifier', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'as', 'type': 'string', 'required': true } - ] - }; - - var prototype$R = inherits(Identifier, Transform); - - prototype$R.transform = function(_, pulse) { - var counter = getCounter(pulse.dataflow), - id = counter.value, - as = _.as; - - pulse.visit(pulse.ADD, t => { - if (!t[as]) t[as] = ++id; - }); - - counter.set(this.value = id); - return pulse; - }; - - function getCounter(view) { - var counter = view._signals[COUNTER_NAME]; - if (!counter) { - view._signals[COUNTER_NAME] = (counter = view.add(0)); - } - return counter; - } - - /** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ - function Mark(params) { - Transform.call(this, null, params); - } - - var prototype$S = inherits(Mark, Transform); - - prototype$S.transform = function(_, pulse) { - var mark = this.value; - - // acquire mark on first invocation, bind context and group - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } - - // initialize entering items - var Init = mark.marktype === Group ? GroupItem : Item; - pulse.visit(pulse.ADD, item => Init.call(item, mark)); - - // update clipping and/or interactive status - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - pulse.reflow(); - } - - // bind items array to scenegraph mark - mark.items = pulse.source; - return pulse; - }; - - function lookup$1(_) { - var g = _.groups, p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) - : g && p ? g.lookup(p) - : null; - } - - /** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ - function Overlap(params) { - Transform.call(this, null, params); - } - - var prototype$T = inherits(Overlap, Transform); - - var methods = { - parity: items => { - return items.filter((item, i) => i % 2 ? (item.opacity = 0) : 1); - }, - greedy: (items, sep) => { - var a; - return items.filter((b, i) => { - if (!i || !intersect$1(a.bounds, b.bounds, sep)) { - a = b; - return 1; - } else { - return b.opacity = 0; - } - }); - } - }; - - // compute bounding box intersection - // including padding pixels of separation - function intersect$1(a, b, sep) { - return sep > Math.max( - b.x1 - a.x2, - a.x1 - b.x2, - b.y1 - a.y2, - a.y1 - b.y2 - ); - } - - function hasOverlap(items, pad) { - for (var i=1, n=items.length, a=items[0].bounds, b; i 1 && b.height() > 1; - } - - function boundTest(scale, orient, tolerance) { - var range = scale.range(), - b = new Bounds(); - - if (orient === Top || orient === Bottom) { - b.set(range[0], -Infinity, range[1], +Infinity); - } else { - b.set(-Infinity, range[0], +Infinity, range[1]); - } - b.expand(tolerance || 1); - - return item => b.encloses(item.bounds); - } - - // reset all items to be fully opaque - function reset(source) { - source.forEach(item => item.opacity = 1); - return source; - } - - // add all tuples to mod, fork pulse if parameters were modified - // fork prevents cross-stream tuple pollution (e.g., pulse from scale) - function reflow(pulse, _) { - return pulse.reflow(_.modified()).modifies('opacity'); - } - - prototype$T.transform = function(_, pulse) { - var reduce = methods[_.method] || methods.parity, - source = pulse.materialize(pulse.SOURCE).source, - sep = _.separation || 0, - items, test, bounds; - - if (!source || !source.length) return; - - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - return pulse; - } - - // skip labels with no content - source = source.filter(hasBounds); - - // early exit, nothing to do - if (!source.length) return; - - if (_.sort) { - source = source.slice().sort(_.sort); - } - - items = reset(source); - pulse = reflow(pulse, _); - - if (items.length >= 3 && hasOverlap(items, sep)) { - do { - items = reduce(items, sep); - } while (items.length >= 3 && hasOverlap(items, sep)); - - if (items.length < 3 && !peek(source).opacity) { - if (items.length > 1) peek(items).opacity = 0; - peek(source).opacity = 1; - } - } - - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach(item => { - if (!test(item)) item.opacity = 0; - }); - } - - // re-calculate mark bounds - bounds = items[0].mark.bounds.clear(); - source.forEach(item => { - if (item.opacity) bounds.union(item.bounds); - }); - - return pulse; - }; - - /** - * Queue modified scenegraph items for rendering. - * @constructor - */ - function Render(params) { - Transform.call(this, null, params); - } - - var prototype$U = inherits(Render, Transform); - - prototype$U.transform = function(_, pulse) { - var view = pulse.dataflow; - - pulse.visit(pulse.ALL, item => view.dirty(item)); - - // set z-index dirty flag as needed - if (pulse.fields && pulse.fields['zindex']) { - var item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } - }; - - const tempBounds$1 = new Bounds(); - - function set$1(item, property, value) { - return item[property] === value ? 0 - : (item[property] = value, 1); - } - - function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; - } - - function axisIndices(datum) { - var index = +datum.grid; - return [ - datum.ticks ? index++ : -1, // ticks index - datum.labels ? index++ : -1, // labels index - index + (+datum.domain) // title index - ]; - } - - function axisLayout(view, axis, width, height) { - var item = axis.items[0], - datum = item.datum, - delta = item.translate != null ? item.translate : 0.5, - orient = item.orient, - indices = axisIndices(datum), - range = item.range, - offset = item.offset, - position = item.position, - minExtent = item.minExtent, - maxExtent = item.maxExtent, - title = datum.title && item.items[indices[2]].items[0], - titlePadding = item.titlePadding, - bounds = item.bounds, - dl = title && multiLineOffset(title), - x = 0, y = 0, i, s; - - tempBounds$1.clear().union(bounds); - bounds.clear(); - if ((i=indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i=indices[1]) > -1) bounds.union(item.items[i].bounds); - - // position axis group and title - switch (orient) { - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - default: - x = item.x; - y = item.y; - } - - // update bounds - boundStroke(bounds.translate(x, y), item); - - if (set$1(item, 'x', x + delta) | set$1(item, 'y', y + delta)) { - item.bounds = tempBounds$1; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - - return item.mark.bounds.clear().union(bounds); - } - - function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - const b = title.bounds; - - if (title.auto) { - const v = sign * (offset + dl + pad); - let dx = 0, dy = 0; - - view.dirty(title); - isYAxis - ? dx = (title.x || 0) - (title.x = v) - : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - - bounds.union(b); - } - - // aggregation functions for grid margin determination - const min$1 = (a, b) => Math.floor(Math.min(a, b)); - const max$1 = (a, b) => Math.ceil(Math.max(a, b)); - - function gridLayoutGroups(group) { - var groups = group.items, - n = groups.length, - i = 0, mark, items; - - var views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; - - // layout axes, gather legends, collect bounds - for (; i 1) { - for (i=0; i 0) dx[i] += x / 2; - } - } - - // perform vertical centering - if (alignRow && get$3(opt.center, Row) && ncols !== 1) { - for (i=0; i 0) dy[i] += y / 2; - } - } - - // position grid relative to anchor - for (i=0; i limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } - - // apply offset - init += offset; - - // clear mark bounds for all headers - for (j=0, m=headers.length; j= 0 && (g = groups[k]) == null; k-=back); - - // assign coordinates and update bounds - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); - - // update current edge of layout bounds - edge = agg(edge, b[bf]); - } - - return edge; - } - - function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); - - // compute title coordinates - var x = offset, y = offset; - isX - ? (x = Math.round(bounds.x1 + band * bounds.width())) - : (y = Math.round(bounds.y1 + band * bounds.height())); - - // assign coordinates and update bounds - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; - - // queue title for redraw - view.dirty(g); - } - - // utility for looking up legend layout configuration - function lookup$2(config, orient) { - const opt = config[orient] || {}; - return (key, d) => opt[key] != null ? opt[key] - : config[key] != null ? config[key] - : d; - } - - // if legends specify offset directly, use the maximum specified value - function offsets(legends, value) { - var max = -Infinity; - legends.forEach(item => { - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; - } - - function legendParams(g, orient, config, xb, yb, w, h) { - const _ = lookup$2(config, orient), - offset = offsets(g, _('offset', 0)), - anchor = _('anchor', Start), - mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - - const p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - - switch (orient) { - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, column: End, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, row: End, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case TopLeft: - p.anchor = {x: offset, y: offset}; - break; - case TopRight: - p.anchor = {x: w - offset, y: offset, column: End}; - break; - case BottomLeft: - p.anchor = {x: offset, y: h - offset, row: End}; - break; - case BottomRight: - p.anchor = {x: w - offset, y: h - offset, column: End, row: End}; - break; - } - - return p; - } - - function legendLayout(view, legend) { - var item = legend.items[0], - datum = item.datum, - orient = item.orient, - bounds = item.bounds, - x = item.x, y = item.y, w, h; - - // cache current bounds for later comparison - item._bounds - ? item._bounds.clear().union(bounds) - : item._bounds = bounds.clone(); - bounds.clear(); - - // adjust legend to accommodate padding and title - legendGroupLayout(view, item, item.items[0].items[0]); - - // aggregate bounds to determine size, and include origin - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - - if (datum.type === Symbols) { - legendEntryLayout(item.items[0].items[0].items[0].items); - } - - if (orient !== None$1) { - item.x = x = 0; - item.y = y = 0; - } - item.width = w; - item.height = h; - boundStroke(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - - return item; - } - - function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach(_ => b.union(_.bounds)); - - // anchor to legend origin - b.x1 = item.padding; - b.y1 = item.padding; - - return b; - } - - function legendGroupLayout(view, item, entry) { - var pad = item.padding, - ex = pad - entry.x, - ey = pad - entry.y; - - if (!item.datum.title) { - if (ex || ey) translate$1(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], - anchor = title.anchor, - tpad = item.titlePadding || 0, - tx = pad - title.x, - ty = pad - title.y; - - switch (title.orient) { - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - case Right: - case Bottom: - break; - default: - ey += title.bounds.height() + tpad; - } - if (ex || ey) translate$1(view, entry, ex, ey); - - switch (title.orient) { - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - if (tx || ty) translate$1(view, title, tx, ty); - - // translate legend if title pushes into negative coordinates - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate$1(view, entry, -tx, 0); - translate$1(view, title, -tx, 0); - } - } - } - - function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - const grad = item.datum.type !== 'symbol', - vgrad = title.datum.vgrad, - e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, - s = e.bounds[y ? 'y2' : 'x2'] - item.padding, - u = vgrad && lr ? s : 0, - v = vgrad && lr ? 0 : s, - o = y <= 0 ? 0 : multiLineOffset(title); - - return Math.round(anchor === Start ? u - : anchor === End ? (v - o) - : 0.5 * (s - o)); - } - - function translate$1(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); - } - - function legendEntryLayout(entries) { - // get max widths for each column - var widths = entries.reduce((w, g) => { - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); - - // set dimensions of legend entry groups - entries.forEach(g => { - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); - } - - function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], - frame = group.frame, - orient = group.orient, - anchor = group.anchor, - offset = group.offset, - padding = group.padding, - title = group.items[0].items[0], - subtitle = group.items[1] && group.items[1].items[0], - end = (orient === Left || orient === Right) ? height : width, - start = 0, x = 0, y = 0, sx = 0, sy = 0, pos; - - if (frame !== Group) { - orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) - : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) - : (start = viewBounds.x1, end = viewBounds.x2); - } else if (orient === Left) { - start = height, end = 0; - } - - pos = (anchor === Start) ? start - : (anchor === End) ? end - : (start + end) / 2; - - if (subtitle && subtitle.text) { - // position subtitle - switch (orient) { - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - case Left: - sx = title.bounds.width() + padding; - break; - case Right: - sx = -title.bounds.width() - padding; - break; - } - - tempBounds$1.clear().union(subtitle.bounds); - tempBounds$1.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - if (set$1(subtitle, 'x', sx) | set$1(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds$1); - subtitle.mark.bounds.clear().union(tempBounds$1); - view.dirty(subtitle); - } - - tempBounds$1.clear().union(subtitle.bounds); - } else { - tempBounds$1.clear(); - } - tempBounds$1.union(title.bounds); - - // position title group - switch (orient) { - case Top: - x = pos; - y = viewBounds.y1 - tempBounds$1.height() - offset; - break; - case Left: - x = viewBounds.x1 - tempBounds$1.width() - offset; - y = pos; - break; - case Right: - x = viewBounds.x2 + tempBounds$1.width() + offset; - y = pos; - break; - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - default: - x = group.x; - y = group.y; - } - - if (set$1(group, 'x', x) | set$1(group, 'y', y)) { - tempBounds$1.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds$1); - mark.bounds.clear().union(tempBounds$1); - view.dirty(group); - } - return group.bounds; - } - - /** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ - function ViewLayout(params) { - Transform.call(this, null, params); - } - - var prototype$V = inherits(ViewLayout, Transform); - - prototype$V.transform = function(_, pulse) { - var view = pulse.dataflow; - _.mark.items.forEach(group => { - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; - }; - - function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; - } - - function layoutGroup(view, group, _) { - var items = group.items, - width = Math.max(0, group.width || 0), - height = Math.max(0, group.height || 0), - viewBounds = new Bounds().set(0, 0, width, height), - xBounds = viewBounds.clone(), - yBounds = viewBounds.clone(), - legends = [], title, - mark, orient, b, i, n; - - // layout axes, gather legends, collect bounds - for (i=0, n=items.length; i { - orient = item.orient || Right; - if (orient !== None$1) (l[orient] || (l[orient] = [])).push(item); - }); - - // perform grid layout for each orient group - for (let orient in l) { - const g = l[orient]; - gridLayout(view, g, legendParams( - g, orient, _.legends, xBounds, yBounds, width, height - )); - } - - // update view bounds - legends.forEach(item => { - const b = item.bounds; - - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - item.bounds = b; - view.dirty(item); - } - - if (_.autosize && _.autosize.type === Fit) { - // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch(item.orient) { - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - } else { - viewBounds.union(b); - } - }); - } - - // combine bounding boxes - viewBounds.union(xBounds).union(yBounds); - - // layout title, adjust bounds - if (title) { - viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - } - - // override aggregated view bounds if content is clipped - if (group.clip) { - viewBounds.set(0, 0, group.width || 0, group.height || 0); - } - - // perform size adjustment - viewSizeLayout(view, group, viewBounds, _); - } - - function viewSizeLayout(view, group, viewBounds, _) { - const auto = _.autosize || {}, - type = auto.type; - - if (view._autosize < 1 || !type) return; - - let viewWidth = view._width, - viewHeight = view._height, - width = Math.max(0, group.width || 0), - left = Math.max(0, Math.ceil(-viewBounds.x1)), - right = Math.max(0, Math.ceil(viewBounds.x2 - width)), - height = Math.max(0, group.height || 0), - top = Math.max(0, Math.ceil(-viewBounds.y1)), - bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - - if (auto.contains === Padding) { - const padding = view.padding(); - viewWidth -= padding.left + padding.right; - viewHeight -= padding.top + padding.bottom; - } - - if (type === None$1) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } - - else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } - - else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - - view._resizeView( - viewWidth, viewHeight, - width, height, - [left, top], - auto.resize - ); - } - - var vtx = /*#__PURE__*/Object.freeze({ - __proto__: null, - bound: Bound, - identifier: Identifier, - mark: Mark, - overlap: Overlap, - render: Render, - viewlayout: ViewLayout - }); - - /** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - function AxisTicks(params) { - Transform.call(this, null, params); - } - - var prototype$W = inherits(AxisTicks, Transform); - - prototype$W.transform = function(_, pulse) { - if (this.value && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - ticks = this.value, - scale = _.scale, - tally = _.count == null ? (_.values ? _.values.length : 10) : _.count, - count = tickCount(scale, tally, _.minstep), - format = _.format || tickFormat$1(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), - values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count); - - if (ticks) out.rem = ticks; - - ticks = values.map(function(value, i) { - return ingest({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - }); - }); - - if (_.extra && ticks.length) { - // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push(ingest({ - index: -1, - extra: {value: ticks[0].value}, - label: '' - })); - } - - out.source = ticks; - out.add = ticks; - this.value = ticks; - - return out; - }; - - /** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ - function DataJoin(params) { - Transform.call(this, null, params); - } - - var prototype$X = inherits(DataJoin, Transform); - - function defaultItemCreate() { - return ingest({}); - } - - function newMap(key) { - const map = fastmap().test(t => t.exit); - map.lookup = t => map.get(key(t)); - return map; - } - - prototype$X.transform = function(_, pulse) { - var df = pulse.dataflow, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - item = _.item || defaultItemCreate, - key = _.key || tupleid, - map = this.value; - - // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - if (isArray(out.encode)) { - out.encode = null; - } - - if (map && (_.modified('key') || pulse.modified(key))) { - error('DataJoin does not support modified key function or fields.'); - } - - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - - pulse.visit(pulse.ADD, t => { - const k = key(t); - let x = map.get(k); - - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else { - out.mod.push(x); - } - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - - x.datum = t; - x.exit = false; - }); - - pulse.visit(pulse.MOD, t => { - const k = key(t), - x = map.get(k); - - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - - pulse.visit(pulse.REM, t => { - const k = key(t), - x = map.get(k); - - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) { - df.runAfter(map.clean); - } - - return out; - }; - - /** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ - function Encode(params) { - Transform.call(this, null, params); - } - - var prototype$Y = inherits(Encode, Transform); - - prototype$Y.transform = function(_, pulse) { - var out = pulse.fork(pulse.ADD_REM), - fmod = _.mod || false, - encoders = _.encoders, - encode = pulse.encode; - - // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - if (isArray(encode)) { - if (out.changed() || encode.every(function(e) { return encoders[e]; })) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else { - return pulse.StopPropagation; - } - } - - // marshall encoder functions - var reenter = encode === 'enter', - update = encoders.update || falsy, - enter = encoders.enter || falsy, - exit = encoders.exit || falsy, - set = (encode && !reenter ? encoders[encode] : update) || falsy; - - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, function(t) { enter(t, _); update(t, _); }); - out.modifies(enter.output); - out.modifies(update.output); - if (set !== falsy && set !== update) { - pulse.visit(pulse.ADD, function(t) { set(t, _); }); - out.modifies(set.output); - } - } - - if (pulse.changed(pulse.REM) && exit !== falsy) { - pulse.visit(pulse.REM, function(t) { exit(t, _); }); - out.modifies(exit.output); - } - - if (reenter || set !== falsy) { - var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - if (reenter) { - pulse.visit(flag, function(t) { - var mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else { - pulse.visit(flag, function(t) { - if (set(t, _) || fmod) out.mod.push(t); - }); - } - if (out.mod.length) out.modifies(set.output); - } - - return out.changed() ? out : pulse.StopPropagation; - }; - - /** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - function LegendEntries(params) { - Transform.call(this, [], params); - } - - var prototype$Z = inherits(LegendEntries, Transform); - - prototype$Z.transform = function(_, pulse) { - if (this.value != null && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - items = this.value, - type = _.type || SymbolLegend, - scale = _.scale, - limit = +_.limit, - count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep), - lskip = !!_.values || type === SymbolLegend, - format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), - values = _.values || labelValues(scale, count), - domain, fraction, size, offset, ellipsis; - - if (items) out.rem = items; - - if (type === SymbolLegend) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else { - items = values; - } - - if (isFunction(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) { - items = items.slice(1); - } - // compute size offset for legend entries - offset = items.reduce(function(max, value) { - return Math.max(max, size(value, _)); - }, 0); - } else { - size = constant(offset = size || 8); - } - - items = items.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - }); - }); - - if (ellipsis) { - ellipsis = values[items.length]; - items.push(ingest({ - index: items.length, - label: `\u2026${values.length-items.length} entries`, - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } - - else if (type === GradientLegend) { - domain = scale.domain(), - fraction = scaleFraction(scale, domain[0], peek(domain)); - - // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - if (values.length < 3 && !_.values && domain[0] !== peek(domain)) { - values = [domain[0], peek(domain)]; - } - - items = values.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - }); - }); - } - - else { - size = values.length - 1; - fraction = labelFraction(scale); - - items = values.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index+1]) - }); - }); - } - - out.source = items; - out.add = items; - this.value = items; - - return out; - }; - - var Paths = fastmap({ - 'line': line$2, - 'line-radial': lineR, - 'arc': arc$2, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR - }); - - function sourceX(t) { return t.source.x; } - function sourceY(t) { return t.source.y; } - function targetX(t) { return t.target.x; } - function targetY(t) { return t.target.y; } - - /** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ - function LinkPath(params) { - Transform.call(this, {}, params); - } - - LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sourceX', 'type': 'field', 'default': 'source.x' }, - { 'name': 'sourceY', 'type': 'field', 'default': 'source.y' }, - { 'name': 'targetX', 'type': 'field', 'default': 'target.x' }, - { 'name': 'targetY', 'type': 'field', 'default': 'target.y' }, - { 'name': 'orient', 'type': 'enum', 'default': 'vertical', - 'values': ['horizontal', 'vertical', 'radial'] }, - { 'name': 'shape', 'type': 'enum', 'default': 'line', - 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal'] }, - { 'name': 'require', 'type': 'signal' }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] - }; - - var prototype$_ = inherits(LinkPath, Transform); - - prototype$_.transform = function(_, pulse) { - var sx = _.sourceX || sourceX, - sy = _.sourceY || sourceY, - tx = _.targetX || targetX, - ty = _.targetY || targetY, - as = _.as || 'path', - orient = _.orient || 'vertical', - shape = _.shape || 'line', - path = Paths.get(shape + '-' + orient) || Paths.get(shape); - - if (!path) { - error('LinkPath unsupported type: ' + _.shape - + (_.orient ? '-' + _.orient : '')); - } - - pulse.visit(pulse.SOURCE, function(t) { - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - - return pulse.reflow(_.modified()).modifies(as); - }; - - // -- Link Path Generation Methods ----- - - function line$2(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'L' + tx + ',' + ty; - } - - function lineR(sa, sr, ta, tr) { - return line$2( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); - } - - function arc$2(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - rr = Math.sqrt(dx * dx + dy * dy) / 2, - ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + - 'A' + rr + ',' + rr + - ' ' + ra + ' 0 1' + - ' ' + tx + ',' + ty; - } - - function arcR(sa, sr, ta, tr) { - return arc$2( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); - } - - function curve(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - ix = 0.2 * (dx + dy), - iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + - 'C' + (sx+ix) + ',' + (sy+iy) + - ' ' + (tx+iy) + ',' + (ty-ix) + - ' ' + tx + ',' + ty; - } - - function curveR(sa, sr, ta, tr) { - return curve( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); - } - - function orthoX(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'V' + ty + 'H' + tx; - } - - function orthoY(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'H' + tx + 'V' + ty; - } - - function orthoR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'A' + sr + ',' + sr + ' 0 0,' + (sf?1:0) + - ' ' + (sr*tc) + ',' + (sr*ts) + - 'L' + (tr*tc) + ',' + (tr*ts); - } - - function diagonalX(sx, sy, tx, ty) { - var m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + - 'C' + m + ',' + sy + - ' ' + m + ',' + ty + - ' ' + tx + ',' + ty; - } - - function diagonalY(sx, sy, tx, ty) { - var m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + - 'C' + sx + ',' + m + - ' ' + tx + ',' + m + - ' ' + tx + ',' + ty; - } - - function diagonalR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - mr = (sr + tr) / 2; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'C' + (mr*sc) + ',' + (mr*ss) + - ' ' + (mr*tc) + ',' + (mr*ts) + - ' ' + (tr*tc) + ',' + (tr*ts); - } - - /** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ - function Pie(params) { - Transform.call(this, null, params); - } - - Pie.Definition = { - 'type': 'Pie', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'startAngle', 'type': 'number', 'default': 0 }, - { 'name': 'endAngle', 'type': 'number', 'default': 6.283185307179586 }, - { 'name': 'sort', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['startAngle', 'endAngle'] } - ] - }; - - var prototype$$ = inherits(Pie, Transform); - - prototype$$.transform = function(_, pulse) { - var as = _.as || ['startAngle', 'endAngle'], - startAngle = as[0], - endAngle = as[1], - field = _.field || one, - start = _.startAngle || 0, - stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, - data = pulse.source, - values = data.map(field), - n = values.length, - a = start, - k = (stop - start) / sum(values), - index = sequence(n), - i, t, v; - - if (_.sort) { - index.sort(function(a, b) { - return values[a] - values[b]; - }); - } - - for (i=0; i -1) return raw; - - var domain = _.domain, - type = scale.type, - zero = _.zero || (_.zero === undefined && includeZero(scale)), - n, mid; - - if (!domain) return 0; - - // adjust continuous domain for minimum pixel padding - if (includePad(type) && _.padding && domain[0] !== peek(domain)) { - domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - } - - // adjust domain based on zero, min, max settings - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = ((domain = domain.slice()).length - 1) || 1; - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - - if (_.domainMid != null) { - mid = _.domainMid; - const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } - - // set the scale domain - scale.domain(domainCheck(type, domain, df)); - - // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - if (type === Ordinal) { - scale.unknown(_.domainImplicit ? implicit : undefined); - } - - // perform 'nice' adjustment as requested - if (_.nice && scale.nice) { - scale.nice((_.nice !== true && tickCount(scale, _.nice)) || null); - } - - // return the cardinality of the domain - return domain.length; - } - - function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else { - return -1; - } - } - - function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs(peek(range) - range[0]), - frac = span / (span - 2 * pad), - d = type === Log ? zoomLog(domain, null, frac) - : type === Sqrt ? zoomPow(domain, null, frac, 0.5) - : type === Pow ? zoomPow(domain, null, frac, exponent || 1) - : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) - : zoomLinear(domain, null, frac); - - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length-1] = d[1]; - return domain; - } - - function domainCheck(type, domain, df) { - if (isLogarithmic(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce(function(s, v) { - return s + (v < 0 ? -1 : v > 0 ? 1 : 0); - }, 0)); - - if (s !== domain.length) { - df.warn('Log scale domain includes zero: ' + $(domain)); - } - } - return domain; - } - - function configureBins(scale, _, count) { - let bins = _.bins; - - if (bins && !isArray(bins)) { - // generate bin boundary array - let domain = scale.domain(), - lo = domain[0], - hi = peek(domain), - start = bins.start == null ? lo : bins.start, - stop = bins.stop == null ? hi : bins.stop, - step = bins.step; - - if (!step) error('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (stop > hi) stop = step * Math.floor(hi / step); - bins = sequence(start, stop + step / 2, step); - } - - if (bins) { - // assign bin boundaries to scale instance - scale.bins = bins; - } else if (scale.bins) { - // no current bins, remove bins if previously set - delete scale.bins; - } - - // special handling for bin-ordinal scales - if (scale.type === BinOrdinal) { - if (!bins) { - // the domain specifies the bins - scale.bins = scale.domain(); - } else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } - - // return domain cardinality - return count; - } - - function configureRange(scale, _, count) { - var type = scale.type, - round = _.round || false, - range = _.range; - - // if range step specified, calculate full range extent - if (_.rangeStep != null) { - range = configureRangeStep(type, _, count); - } - - // else if a range scheme is defined, use that - else if (_.scheme) { - range = configureScheme(type, _, count); - if (isFunction(range)) { - if (scale.interpolator) { - return scale.interpolator(range); - } else { - error(`Scale type ${type} does not support interpolating color schemes.`); - } - } - } - - // given a range array for an interpolating scale, convert to interpolator - if (range && isInterpolating(type)) { - return scale.interpolator( - interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma) - ); - } - - // configure rounding / interpolation - if (range && _.interpolate && scale.interpolate) { - scale.interpolate(interpolate(_.interpolate, _.interpolateGamma)); - } else if (isFunction(scale.round)) { - scale.round(round); - } else if (isFunction(scale.rangeRound)) { - scale.interpolate(round ? $$1.interpolateRound : $$1.interpolate); - } - - if (range) scale.range(flip(range, _.reverse)); - } - - function configureRangeStep(type, _, count) { - if (type !== Band && type !== Point) { - error('Only band and point scales support rangeStep.'); - } - - // calculate full range based on requested step size and padding - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, - inner = type === Point ? 1 - : ((_.paddingInner != null ? _.paddingInner : _.padding) || 0); - return [0, _.rangeStep * bandSpace(count, inner, outer)]; - } - - function configureScheme(type, _, count) { - var extent = _.schemeExtent, - name, scheme$1; - - if (isArray(_.scheme)) { - scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); - } else { - name = _.scheme.toLowerCase(); - scheme$1 = scheme(name); - if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`); - } - - // determine size for potential discrete range - count = (type === Threshold) ? count + 1 - : (type === BinOrdinal) ? count - 1 - : (type === Quantile$1 || type === Quantize) ? (+_.schemeCount || DEFAULT_COUNT) - : count; - - // adjust and/or quantize scheme as appropriate - return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) - : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) - : type === Ordinal ? scheme$1 : scheme$1.slice(0, count); - } - - function adjustScheme(scheme, extent, reverse) { - return (isFunction(scheme) && (extent || reverse)) - ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) - : scheme; - } - - function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; - } - - /** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ - function SortItems(params) { - Transform.call(this, null, params); - } - - var prototype$11 = inherits(SortItems, Transform); - - prototype$11.transform = function(_, pulse) { - var mod = _.modified('sort') - || pulse.changed(pulse.ADD) - || pulse.modified(_.sort.fields) - || pulse.modified('datum'); - - if (mod) pulse.source.sort(stableCompare(_.sort)); - - this.modified(mod); - return pulse; - }; - - var Zero = 'zero', - Center = 'center', - Normalize = 'normalize', - DefOutput = ['y0', 'y1']; - - /** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ - function Stack(params) { - Transform.call(this, null, params); - } - - Stack.Definition = { - 'type': 'Stack', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'offset', 'type': 'enum', 'default': Zero, 'values': [Zero, Center, Normalize] }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': DefOutput } - ] - }; - - var prototype$12 = inherits(Stack, Transform); - - prototype$12.transform = function(_, pulse) { - var as = _.as || DefOutput, - y0 = as[0], - y1 = as[1], - sort = stableCompare(_.sort), - field = _.field || one, - stack = _.offset === Center ? stackCenter - : _.offset === Normalize ? stackNormalize - : stackZero, - groups, i, n, max; - - // partition, sum, and sort the stack groups - groups = partition$2(pulse.source, _.groupby, sort, field); - - // compute stack layouts per group - for (i=0, n=groups.length, max=groups.max; i max) max = s; - if (sort) g.sort(sort); - } - groups.max = max; - - return groups; - } - - var encode = /*#__PURE__*/Object.freeze({ - __proto__: null, - axisticks: AxisTicks, - datajoin: DataJoin, - encode: Encode, - legendentries: LegendEntries, - linkpath: LinkPath, - pie: Pie, - scale: Scale, - sortitems: SortItems, - stack: Stack - }); - - function noop$2() {} - - const cases = [ - [], - [[[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]]], - [] - ]; - - // Implementation adapted from d3/d3-contour. Thanks! - function contours() { - var dx = 1, - dy = 1, - smooth = smoothLinear; - - function contours(values, tz) { - return tz.map(value => 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.js - function contour(values, value) { - var polygons = [], - holes = []; - - isorings(values, value, function(ring) { - smooth(ring, values, value); - if (area$2(ring) > 0) polygons.push([ring]); - else holes.push(ring); - }); - - holes.forEach(function(hole) { - for (var i = 0, n = polygons.length, polygon; i < n; ++i) { - if (contains((polygon = polygons[i])[0], hole) !== -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/stitch.js - function isorings(values, value, callback) { - var fragmentByStart = new Array, - fragmentByEnd = new Array, - x, y, t0, t1, t2, t3; - - // Special case for the first row (y = -1, t2 = t3 = 0). - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - - // General case for the intermediate rows. - while (++y < dy - 1) { - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - - // Special case for the last row (y = dy - 1, t0 = t1 = 0). - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - - function stitch(line) { - var start = [line[0][0] + x, line[0][1] + y], - end = [line[1][0] + x, line[1][1] + y], - startIndex = index(start), - endIndex = index(end), - f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[f.start] = fragmentByEnd[g.end] = {start: f.start, end: g.end, ring: f.ring.concat(g.ring)}; - } - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[g.start] = fragmentByEnd[f.end] = {start: g.start, end: f.end, ring: g.ring.concat(f.ring)}; - } - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else { - fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {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 = point[0], - y = point[1], - xt = x | 0, - yt = y | 0, - v0, - v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); - } - - contours.contour = contour; - - contours.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, contours; - }; - - contours.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop$2, contours) : smooth === smoothLinear; - }; - - return contours; - } - - function area$2(ring) { - var i = 0, - n = ring.length, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area; - } - - function contains(ring, hole) { - var i = -1, n = hole.length, c; - while (++i < n) if (c = ringContains(ring, hole[i])) return c; - return 0; - } - - function ringContains(ring, point) { - var x = point[0], y = point[1], contains = -1; - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) contains = -contains; - } - return contains; - } - - function segmentContains(a, b, c) { - var i; return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); - } - - function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); - } - - function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; - } - - function quantize$1(k, nice, zero) { - return function(values) { - var ex = extent(values), - start = zero ? Math.min(ex[0], 0) : ex[0], - stop = ex[1], - span = stop - start, - step = nice ? tickStep(start, stop, k) : (span / (k + 1)); - return sequence(step, stop, step); - }; - } - - /** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ - function Isocontour(params) { - Transform.call(this, null, params); - } - - Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'levels', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'zero', 'type': 'boolean', 'default': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true }, - { 'name': 'scale', 'type': 'number', 'expr': true }, - { 'name': 'translate', 'type': 'number', 'array': true, 'expr': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'default': 'contour' } - ] - }; - - var prototype$13 = inherits(Isocontour, Transform); - - prototype$13.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - field = _.field || identity, - contour = contours().smooth(_.smooth !== false), - tz = _.thresholds || levels(source, field, _), - as = _.as === null ? null : _.as || 'contour', - values = []; - - source.forEach(t => { - const grid = field(t); - - // generate contour paths in GeoJSON format - const paths = contour.size([grid.width, grid.height])( - grid.values, isArray(tz) ? tz : tz(grid.values) - ); - - // adjust contour path coordinates as needed - transformPaths(paths, grid, t, _); - - // ingest; copy source data properties to output - paths.forEach(p => { - values.push(rederive(t, ingest(as != null ? {[as]: p} : p))); - }); - }); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; - }; - - function levels(values, f, _) { - const q = quantize$1(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' - ? q - : q(values.map(t => max(f(t).values))); - } - - function transformPaths(paths, grid, datum, _) { - let s = _.scale || grid.scale, - t = _.translate || grid.translate; - if (isFunction(s)) s = s(datum, _); - if (isFunction(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - - const sx = (isNumber(s) ? s : s[0]) || 1, - sy = (isNumber(s) ? s : s[1]) || 1, - tx = t && t[0] || 0, - ty = t && t[1] || 0; - - paths.forEach(transform$1(grid, sx, sy, tx, ty)); - } - - function transform$1(grid, sx, sy, tx, ty) { - const x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - flip = sx * sy < 0; - - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); - } - - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - coordinates.forEach(transformPoint); - } - - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; - } - - return function(geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; - }; - } - - function radius(bw, data, f) { - const v = bw >= 0 ? bw : bandwidthNRD(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); - } - - function number$4(_) { - return isFunction(_) ? _ : constant(+_); - } - - // Implementation adapted from d3/d3-contour. Thanks! - function density2D() { - var x = d => d[0], - y = d => d[1], - weight = one, - bandwidth = [-1, -1], - dx = 960, - dy = 500, - k = 2; // log2(cellSize) - - function density(data, counts) { - const rx = radius(bandwidth[0], data, x) >> k, // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, // blur y-radius - ox = rx ? rx + 2 : 0, // x-offset padding for blur - oy = ry ? ry + 2 : 0, // y-offset padding for blur - n = 2 * ox + (dx >> k), // grid width - m = 2 * oy + (dy >> k), // grid height - values0 = new Float32Array(n * m), - values1 = new Float32Array(n * m); - - let values = values0; - - data.forEach(d => { - const xi = ox + (+x(d) >> k), - yi = oy + (+y(d) >> k); - - if (xi >= 0 && xi < n && yi >= 0 && yi < m) { - values0[xi + yi * n] += +weight(d); - } - }); - - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } - - // scale density estimates - // density in points per square pixel or probability density - let s = counts ? Math.pow(2, -2 * k) : 1 / sum(values); - for (let i=0, sz=n*m; i> k), - y2: oy + (dy >> k) - }; - } - - density.x = function(_) { - return arguments.length ? (x = number$4(_), density) : x; - }; - - density.y = function(_) { - return arguments.length ? (y = number$4(_), density) : y; - }; - - density.weight = function(_) { - return arguments.length ? (weight = number$4(_), density) : weight; - }; - - density.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, density; - }; - - density.cellSize = function(_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) error('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - - density.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - _ = array(_); - if (_.length === 1) _ = [+_[0], +_[0]]; - if (_.length !== 2) error('invalid bandwidth'); - return bandwidth = _, density; - }; - - return density; - } - - function blurX(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let j = 0; j < m; ++j) { - for (let i = 0, sr = 0; i < n + r; ++i) { - if (i < n) { - sr += source[i + j * n]; - } - if (i >= r) { - if (i >= w) { - sr -= source[i - w + j * n]; - } - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } - } - } - - function blurY(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let i = 0; i < n; ++i) { - for (let j = 0, sr = 0; j < m + r; ++j) { - if (j < m) { - sr += source[i + j * n]; - } - if (j >= r) { - if (j >= w) { - sr -= source[i + (j - w) * n]; - } - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } - } - } - - /** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ - function KDE2D(params) { - Transform.call(this, null, params); - } - - KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': 'grid'} - ] - }; - - var prototype$14 = inherits(KDE2D, Transform); - - const PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth']; - - function params(obj, _) { - PARAMS.forEach(param => _[param] != null ? obj[param](_[param]) : 0); - return obj; - } - - prototype$14.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) - return pulse.StopPropagation; - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - groups = partition$3(source, _.groupby), - names = (_.groupby || []).map(accessorName), - kde = params(density2D(), _), - as = _.as || 'grid', - values = []; - - function set(t, vals) { - for (let i=0; i ingest( - set({[as]: kde(g, _.counts)}, g.dims) - )); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; - }; - - function partition$3(data, groupby) { - var groups = [], - get = f => f(t), - map, i, n, t, k, g; - - // partition data points into groups - if (groupby == null) { - groups.push(data); - } else { - for (map={}, i=0, n=data.length; i} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ - function Contour(params) { - Transform.call(this, null, params); - } - - Contour.Definition = { - 'type': 'Contour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'values', 'type': 'number', 'array': true }, - { 'name': 'x', 'type': 'field' }, - { 'name': 'y', 'type': 'field' }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number' }, - { 'name': 'count', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true } - ] - }; - - var prototype$15 = inherits(Contour, Transform); - - prototype$15.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - contour = contours().smooth(_.smooth !== false), - values = _.values, - thresh = _.thresholds || quantize$1(_.count || 10, _.nice, !!values), - size = _.size, grid, post; - - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform$1(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [grid.width, grid.height]; - values = grid.values; - } - - thresh = isArray(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map(ingest); - - return out; - }; - - var Feature = 'Feature'; - var FeatureCollection = 'FeatureCollection'; - var MultiPoint = 'MultiPoint'; - - /** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ - function GeoJSON(params) { - Transform.call(this, null, params); - } - - GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'length': 2 }, - { 'name': 'geojson', 'type': 'field' } - ] - }; - - var prototype$16 = inherits(GeoJSON, Transform); - - prototype$16.transform = function(_, pulse) { - var features = this._features, - points = this._points, - fields = _.fields, - lon = fields && fields[0], - lat = fields && fields[1], - geojson = _.geojson || (!fields && identity), - flag = pulse.ADD, - mod; - - mod = _.modified() - || pulse.changed(pulse.REM) - || pulse.modified(accessorFields(geojson)) - || (lon && (pulse.modified(accessorFields(lon)))) - || (lat && (pulse.modified(accessorFields(lat)))); - - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = (features = []); - this._points = (points = []); - } - - if (geojson) { - pulse.visit(flag, function(t) { - features.push(geojson(t)); - }); - } - - if (lon && lat) { - pulse.visit(flag, function(t) { - var x = lon(t), - y = lat(t); - if (x != null && y != null && (x = +x) === x && (y = +y) === y) { - points.push([x, y]); - } - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - - this.value = { - type: FeatureCollection, - features: features - }; - }; - - var abs = Math.abs; - var cos = Math.cos; - var sin = Math.sin; - - var epsilon$1 = 1e-6; - var pi = Math.PI; - var halfPi = pi / 2; - var sqrt2 = sqrt$1(2); - - function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); - } - - function sqrt$1(x) { - return x > 0 ? Math.sqrt(x) : 0; - } - - function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * sin(phi), i = 30, delta; - do phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi)); - while (abs(delta) > epsilon$1 && --i > 0); - return phi / 2; - } - - function mollweideBromleyRaw(cx, cy, cp) { - - function forward(lambda, phi) { - return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)]; - } - - forward.invert = function(x, y) { - return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)]; - }; - - return forward; - } - - var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); - - function geoMollweide() { - return d3Geo.geoProjection(mollweideRaw) - .scale(169.529); - } - - var defaultPath = d3Geo.geoPath(); - - var projectionProperties = [ - // standard properties in d3-geo - 'clipAngle', - 'clipExtent', - 'scale', - 'translate', - 'center', - 'rotate', - 'parallels', - 'precision', - 'reflectX', - 'reflectY', - - // extended properties in d3-geo-projections - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' - ]; - - /** - * Augment projections with their type and a copy method. - */ - function create$1(type, constructor) { - return function projection() { - var p = constructor(); - - p.type = type; - - p.path = d3Geo.geoPath().projection(p); - - p.copy = p.copy || function() { - var c = projection(); - projectionProperties.forEach(function(prop) { - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - - return p; - }; - } - - function projection(type, proj) { - if (!type || typeof type !== 'string') { - throw new Error('Projection type must be a name string.'); - } - type = type.toLowerCase(); - if (arguments.length > 1) { - projections[type] = create$1(type, proj); - return this; - } else { - return projections[type] || null; - } - } - - function getProjectionPath(proj) { - return (proj && proj.path) || defaultPath; - } - - var projections = { - // base d3-geo projection types - albers: d3Geo.geoAlbers, - albersusa: d3Geo.geoAlbersUsa, - azimuthalequalarea: d3Geo.geoAzimuthalEqualArea, - azimuthalequidistant: d3Geo.geoAzimuthalEquidistant, - conicconformal: d3Geo.geoConicConformal, - conicequalarea: d3Geo.geoConicEqualArea, - conicequidistant: d3Geo.geoConicEquidistant, - equalEarth: d3Geo.geoEqualEarth, - equirectangular: d3Geo.geoEquirectangular, - gnomonic: d3Geo.geoGnomonic, - identity: d3Geo.geoIdentity, - mercator: d3Geo.geoMercator, - mollweide: geoMollweide, - naturalEarth1: d3Geo.geoNaturalEarth1, - orthographic: d3Geo.geoOrthographic, - stereographic: d3Geo.geoStereographic, - transversemercator: d3Geo.geoTransverseMercator - }; - - for (var key$1 in projections) { - projection(key$1, projections[key$1]); - } - - /** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ - function GeoPath(params) { - Transform.call(this, null, params); - } - - GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] - }; - - var prototype$17 = inherits(GeoPath, Transform); - - prototype$17.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - path = this.value, - field = _.field || identity, - as = _.as || 'path', - flag = out.SOURCE; - - function set(t) { t[as] = path(field(t)); } - - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = getProjectionPath(_.projection); - out.materialize().reflow(); - } else { - flag = field === identity || pulse.modified(field.fields) - ? out.ADD_MOD - : out.ADD; - } - - var prev = initPath(path, _.pointRadius); - out.visit(flag, set); - path.pointRadius(prev); - - return out.modifies(as); - }; - - function initPath(path, pointRadius) { - var prev = path.pointRadius(); - path.context(null); - if (pointRadius != null) { - path.pointRadius(pointRadius); - } - return prev; - } - - /** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ - function GeoPoint(params) { - Transform.call(this, null, params); - } - - GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection', 'required': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true, 'length': 2 }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['x', 'y'] } - ] - }; - - var prototype$18 = inherits(GeoPoint, Transform); - - prototype$18.transform = function(_, pulse) { - var proj = _.projection, - lon = _.fields[0], - lat = _.fields[1], - as = _.as || ['x', 'y'], - x = as[0], - y = as[1], - mod; - - function set(t) { - var xy = proj([lon(t), lat(t)]); - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - - if (_.modified()) { - // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - } else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - - return pulse.modifies(as); - }; - - /** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ - function GeoShape(params) { - Transform.call(this, null, params); - } - - GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': {'modifies': true, 'nomod': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field', 'default': 'datum' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'shape' } - ] - }; - - var prototype$19 = inherits(GeoShape, Transform); - - prototype$19.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - shape = this.value, - as = _.as || 'shape', - flag = out.ADD; - - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator( - getProjectionPath(_.projection), - _.field || field('datum'), - _.pointRadius - ); - out.materialize().reflow(); - flag = out.SOURCE; - } - - out.visit(flag, function(t) { t[as] = shape; }); - - return out.modifies(as); - }; - - function shapeGenerator(path, field, pointRadius) { - var shape = pointRadius == null - ? function(_) { return path(field(_)); } - : function(_) { - var prev = path.pointRadius(), - value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - shape.context = function(_) { - path.context(_); - return shape; - }; - - return shape; - } - - /** - * GeoJSON feature generator for creating graticules. - * @constructor - */ - function Graticule(params) { - Transform.call(this, [], params); - this.generator = d3Geo.geoGraticule(); - } - - Graticule.Definition = { - 'type': 'Graticule', - 'metadata': {'changes': true, 'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMajor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMinor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'step', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'stepMajor', 'type': 'number', 'array': true, 'length': 2, 'default': [90, 360] }, - { 'name': 'stepMinor', 'type': 'number', 'array': true, 'length': 2, 'default': [10, 10] }, - { 'name': 'precision', 'type': 'number', 'default': 2.5 } - ] - }; - - var prototype$1a = inherits(Graticule, Transform); - - prototype$1a.transform = function(_, pulse) { - var src = this.value, - gen = this.generator, t; - - if (!src.length || _.modified()) { - for (var prop in _) { - if (isFunction(gen[prop])) { - gen[prop](_[prop]); - } - } - } - - t = gen(); - if (src.length) { - pulse.mod.push(replace(src[0], t)); - } else { - pulse.add.push(ingest(t)); - } - src[0] = t; - - return pulse; - }; - - /** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ - function Heatmap(params) { - Transform.call(this, null, params); - } - - Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'color', 'type': 'string', 'expr': true}, - { 'name': 'opacity', 'type': 'number', 'expr': true}, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'as', 'type': 'string', 'default': 'image' } - ] - }; - - var prototype$1b = inherits(Heatmap, Transform); - - prototype$1b.transform = function(_, pulse) { - if (!pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var source = pulse.materialize(pulse.SOURCE).source, - shared = _.resolve === 'shared', - field = _.field || identity, - opacity = opacity_(_.opacity, _), - color = color_(_.color, _), - as = _.as || 'image', - obj = { - $x: 0, $y: 0, $value: 0, - $max: shared ? max(source.map(t => max(field(t).values))) : 0 - }; - - source.forEach(t => { - const v = field(t); - - // build proxy data object - const o = extend({}, t, obj); - // set maximum value if not globally shared - if (!shared) o.$max = max(v.values || []); - - // generate canvas image - // optimize color/opacity if not pixel-dependent - t[as] = toCanvas(v, o, - color.dep ? color : constant(color(o)), - opacity.dep ? opacity : constant(opacity(o)) - ); - }); - - return pulse.reflow(true).modifies(as); - }; - - // get image color function - function color_(color, _) { - let f; - if (isFunction(color)) { - f = obj => d3Color.rgb(color(obj, _)); - f.dep = dependency(color); - } else { - // default to mid-grey - f = constant(d3Color.rgb(color || '#888')); - } - return f; - } - - // get image opacity function - function opacity_(opacity, _) { - let f; - if (isFunction(opacity)) { - f = obj => opacity(obj, _); - f.dep = dependency(opacity); - } else if (opacity) { - f = constant(opacity); - } else { - // default to [0, max] opacity gradient - f = obj => (obj.$value / obj.$max) || 0; - f.dep = true; - } - return f; - } - - // check if function depends on individual pixel data - function dependency(f) { - if (!isFunction(f)) return false; - const set = toSet(accessorFields(f)); - return set.$x || set.$y || set.$value || set.$max; - } - - // render raster grid to canvas - function toCanvas(grid, obj, color, opacity) { - const n = grid.width, - m = grid.height, - x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - x2 = grid.x2 || n, - y2 = grid.y2 || m, - val = grid.values, - value = val ? i => val[i] : zero, - can = domCanvas(x2 - x1, y2 - y1), - ctx = can.getContext('2d'), - img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), - pix = img.data; - - for (let j=y1, k=0; j a.concat(featurize(f)), []) - }; - } - - function featurize(f) { - return f.type === FeatureCollection - ? f.features - : array(f).filter(d => d != null).map( - d => d.type === Feature ? d : {type: Feature, geometry: d} - ); - } - - var geo = /*#__PURE__*/Object.freeze({ - __proto__: null, - contour: Contour, - geojson: GeoJSON, - geopath: GeoPath, - geopoint: GeoPoint, - geoshape: GeoShape, - graticule: Graticule, - heatmap: Heatmap, - isocontour: Isocontour, - kde2d: KDE2D, - projection: Projection - }); - - var ForceMap = { - center: d3Force.forceCenter, - collide: d3Force.forceCollide, - nbody: d3Force.forceManyBody, - link: d3Force.forceLink, - x: d3Force.forceX, - y: d3Force.forceY - }; - - var Forces = 'forces', - ForceParams = [ - 'alpha', 'alphaMin', 'alphaTarget', - 'velocityDecay', 'forces' - ], - ForceConfig = ['static', 'iterations'], - ForceOutput = ['x', 'y', 'vx', 'vy']; - - /** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.forces - The forces to apply. - */ - function Force(params) { - Transform.call(this, null, params); - } - - Force.Definition = { - 'type': 'Force', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'static', 'type': 'boolean', 'default': false }, - { 'name': 'restart', 'type': 'boolean', 'default': false }, - { 'name': 'iterations', 'type': 'number', 'default': 300 }, - { 'name': 'alpha', 'type': 'number', 'default': 1 }, - { 'name': 'alphaMin', 'type': 'number', 'default': 0.001 }, - { 'name': 'alphaTarget', 'type': 'number', 'default': 0 }, - { 'name': 'velocityDecay', 'type': 'number', 'default': 0.4 }, - { 'name': 'forces', 'type': 'param', 'array': true, - 'params': [ - { - 'key': {'force': 'center'}, - 'params': [ - { 'name': 'x', 'type': 'number', 'default': 0 }, - { 'name': 'y', 'type': 'number', 'default': 0 } - ] - }, - { - 'key': {'force': 'collide'}, - 'params': [ - { 'name': 'radius', 'type': 'number', 'expr': true }, - { 'name': 'strength', 'type': 'number', 'default': 0.7 }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'nbody'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': -30 }, - { 'name': 'theta', 'type': 'number', 'default': 0.9 }, - { 'name': 'distanceMin', 'type': 'number', 'default': 1 }, - { 'name': 'distanceMax', 'type': 'number' } - ] - }, - { - 'key': {'force': 'link'}, - 'params': [ - { 'name': 'links', 'type': 'data' }, - { 'name': 'id', 'type': 'field' }, - { 'name': 'distance', 'type': 'number', 'default': 30, 'expr': true }, - { 'name': 'strength', 'type': 'number', 'expr': true }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'x'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'x', 'type': 'field' } - ] - }, - { - 'key': {'force': 'y'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'y', 'type': 'field' } - ] - } - ] }, - { - 'name': 'as', 'type': 'string', 'array': true, 'modify': false, - 'default': ForceOutput - } - ] - }; - - var prototype$1d = inherits(Force, Transform); - - prototype$1d.transform = function(_, pulse) { - var sim = this.value, - change = pulse.changed(pulse.ADD_REM), - params = _.modified(ForceParams), - iters = _.iterations || 300; - - // configure simulation - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - pulse.modifies('index'); - } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - if (params || pulse.changed(pulse.MOD)) { - setup(sim, _, 0, pulse); - } - } - - // run simulation - if (params || change || _.modified(ForceConfig) - || (pulse.changed() && _.restart)) - { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)) - .alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - - if (_.static) { - for (sim.stop(); --iters >= 0;) sim.tick(); - } else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } - } - - return this.finish(_, pulse); - }; - - prototype$1d.finish = function(_, pulse) { - var dataflow = pulse.dataflow; - - // inspect dependencies, touch link source data - for (var args=this._argops, j=0, m=args.length, arg; j} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ - function Nest(params) { - Transform.call(this, null, params); - } - - Nest.Definition = { - 'type': 'Nest', - 'metadata': {'treesource': true, 'changes': true}, - 'params': [ - { 'name': 'keys', 'type': 'field', 'array': true }, - { 'name': 'generate', 'type': 'boolean' } - ] - }; - - var prototype$1e = inherits(Nest, Transform); - - function children(n) { - return n.values; - } - - prototype$1e.transform = function(_, pulse) { - if (!pulse.source) { - error('Nest transform requires an upstream data source.'); - } - - var gen = _.generate, - mod = _.modified(), - out = pulse.clone(), - tree = this.value; - - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) { - tree.each(node => { - if (node.children && isTuple(node.data)) { - out.rem.push(node.data); - } - }); - } - - // generate new tree structure - this.value = tree = d3Hierarchy.hierarchy({ - values: array(_.keys) - .reduce((n, k) => { n.key(k); return n; }, nest()) - .entries(out.source) - }, children); - - // collect nodes to add - if (gen) { - tree.each(node => { - if (node.children) { - node = ingest(node.data); - out.add.push(node); - out.source.push(node); - } - }); - } - - // build lookup table - lookup$3(tree, tupleid, tupleid); - } - - out.source.root = tree; - return out; - }; - - function nest() { - var keys = [], - nest; - - function apply(array, depth) { - if (depth >= keys.length) { - return array; - } - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - value, - valuesByKey = {}, - values, - result = {}; - - while (++i < n) { - keyValue = key(value = array[i]) + ''; - if (values = valuesByKey[keyValue]) { - values.push(value); - } else { - valuesByKey[keyValue] = [value]; - } - } - - for (keyValue in valuesByKey) { - result[keyValue] = apply(valuesByKey[keyValue], depth); - } - - return result; - } - - function entries(map, depth) { - if (++depth > keys.length) return map; - var array = [], k; - for (k in map) { - array.push({key: k, values: entries(map[k], depth)}); - } - return array; - } - - return nest = { - entries: array => entries(apply(array, 0), 0), - key: d => { keys.push(d); return nest; } - }; - } - - /** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ - function HierarchyLayout(params) { - Transform.call(this, null, params); - } - - var prototype$1f = inherits(HierarchyLayout, Transform); - - prototype$1f.transform = function(_, pulse) { - if (!pulse.source || !pulse.source.root) { - error(this.constructor.name - + ' transform requires a backing tree data source.'); - } - - var layout = this.layout(_.method), - fields = this.fields, - root = pulse.source.root, - as = _.as || fields; - - if (_.field) root.sum(_.field); else root.count(); - if (_.sort) root.sort(stableCompare(_.sort, d => d.data)); - - setParams(layout, this.params, _); - if (layout.separation) { - layout.separation(_.separation !== false ? defaultSeparation : one); - } - - try { - this.value = layout(root); - } catch (err) { - error(err); - } - root.each(function(node) { setFields(node, fields, as); }); - - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); - }; - - function setParams(layout, params, _) { - for (var p, i=0, n=params.length; i} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ - function Loess(params) { - Transform.call(this, null, params); - } - - Loess.Definition = { - 'type': 'Loess', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0.3 }, - { 'name': 'as', 'type': 'string', 'array': true } - ] - }; - - var prototype$1m = inherits(Loess, Transform); - - prototype$1m.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition$4(source, _.groupby), - names = (_.groupby || []).map(accessorName), - m = names.length, - as = _.as || [accessorName(_.x), accessorName(_.y)], - values = []; - - groups.forEach(g => { - regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(p => { - const t = {}; - for (let i=0; i} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ - function Regression(params) { - Transform.call(this, null, params); - } - - Regression.Definition = { - 'type': 'Regression', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'string', 'default': 'linear', 'values': Object.keys(Methods$1) }, - { 'name': 'order', 'type': 'number', 'default': 3 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'params', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true } - ] - }; - - var prototype$1n = inherits(Regression, Transform); - - prototype$1n.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition$4(source, _.groupby), - names = (_.groupby || []).map(accessorName), - method = _.method || 'linear', - order = _.order || 3, - dof = degreesOfFreedom(method, order), - as = _.as || [accessorName(_.x), accessorName(_.y)], - fit = Methods$1[method], - values = []; - - let domain = _.extent; - - if (!hasOwnProperty(Methods$1, method)) { - error('Invalid regression method: ' + method); - } - - if (domain != null) { - if (method === 'log' && domain[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - domain = null; - } - } - - groups.forEach(g => { - const n = g.length; - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - - const model = fit(g, _.x, _.y, order); - - if (_.params) { - // if parameter vectors requested return those - values.push(ingest({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - return; - } - - const dom = domain || extent(g, _.x), - add = p => { - const t = {}; - for (let i=0; i add([x, model.predict(x)])); - } else { - // otherwise return trend line sample points - sampleCurve(model.predict, dom, 25, 200).forEach(add); - } - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; - }; - - var reg = /*#__PURE__*/Object.freeze({ - __proto__: null, - loess: Loess, - regression: Regression - }); - - const EPSILON$2 = Math.pow(2, -52); - const EDGE_STACK = new Uint32Array(512); - - class Delaunator { - - static from(points, getX = defaultGetX, getY = defaultGetY) { - const n = points.length; - const coords = new Float64Array(n * 2); - - for (let i = 0; i < n; i++) { - const p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - - return new Delaunator(coords); - } - - constructor(coords) { - const n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - - this.coords = coords; - - // arrays that will store the triangulation graph - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash - - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - - this.update(); - } - - update() { - const {coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash} = this; - const n = coords.length >> 1; - - // populate an array of point indices; calculate input data bbox - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - - for (let i = 0; i < n; i++) { - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - - let minDist = Infinity; - let i0, i1, i2; - - // pick a seed point close to the center - for (let i = 0; i < n; i++) { - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } - } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - - minDist = Infinity; - - // find the point closest to the seed - for (let i = 0; i < n; i++) { - if (i === i0) continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } - } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - - let minRadius = Infinity; - - // find the third point which forms the smallest circumcircle with the first two - for (let i = 0; i < n; i++) { - if (i === i0 || i === i1) continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } - } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for (let i = 0; i < n; i++) { - this._dists[i] = (coords[2 * i] - coords[0]) || (coords[2 * i + 1] - coords[1]); - } - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for (let i = 0, d0 = -Infinity; i < n; i++) { - const id = this._ids[i]; - if (this._dists[id] > d0) { - hull[j++] = id; - d0 = this._dists[id]; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } - - // swap the order of the seed points for counter-clockwise orientation - if (orient(i0x, i0y, i1x, i1y, i2x, i2y)) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - - for (let i = 0; i < n; i++) { - this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - } - - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - - // set up the seed triangle as the starting hull - this._hullStart = i0; - let hullSize = 3; - - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - - for (let k = 0, xp, yp; k < this._ids.length; k++) { - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - - // skip near-duplicate points - if (k > 0 && Math.abs(x - xp) <= EPSILON$2 && Math.abs(y - yp) <= EPSILON$2) continue; - xp = x; - yp = y; - - // skip seed triangle points - if (i === i0 || i === i1 || i === i2) continue; - - // find a visible edge on the convex hull using edge hash - let start = 0; - for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) { - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - - start = hullPrev[start]; - let e = start, q; - while (q = hullNext[e], !orient(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) { - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) continue; // likely a near-duplicate point; skip it - - // add the first triangle from the point - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - - // walk forward through the hull, adding more triangles and flipping recursively - let n = hullNext[e]; - while (q = hullNext[n], orient(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1])) { - t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]); - hullTri[i] = this._legalize(t + 2); - hullNext[n] = n; // mark as removed - hullSize--; - n = q; - } - - // walk backward from the other side, adding more triangles and flipping - if (e === start) { - while (q = hullPrev[e], orient(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) { - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - } - - // update the hull indices - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n] = i; - hullNext[i] = n; - - // save the two new edges in the hash table - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - - this.hull = new Uint32Array(hullSize); - for (let i = 0, e = this._hullStart; i < hullSize; i++) { - this.hull[i] = e; - e = hullNext[e]; - } - - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - - _legalize(a) { - const {_triangles: triangles, _halfedges: halfedges, coords} = this; - - let i = 0; - let ar = 0; - - // recursion eliminated with a fixed-size stack - while (true) { - const b = halfedges[a]; - - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ - const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - - if (b === -1) { // convex hull edge - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - - const illegal = inCircle( - coords[2 * p0], coords[2 * p0 + 1], - coords[2 * pr], coords[2 * pr + 1], - coords[2 * pl], coords[2 * pl + 1], - coords[2 * p1], coords[2 * p1 + 1]); - - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - - const hbl = halfedges[bl]; - - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - - const br = b0 + (b + 1) % 3; - - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = br; - } - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - - return ar; - } - - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } - - // add a new triangle given vertex indices and adjacent half-edge ids - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - - this.trianglesLen += 3; - - return t; - } - } - - // monotonically increases with real angle, but doesn't need expensive trigonometry - function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] - } - - function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; - } - - // return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check - function orientIfSure(px, py, rx, ry, qx, qy) { - const l = (ry - py) * (qx - px); - const r = (rx - px) * (qy - py); - return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0; - } - - // a more robust orientation test that's stable in a given triangle (to fix robustness issues) - function orient(rx, ry, qx, qy, px, py) { - const sign = orientIfSure(px, py, rx, ry, qx, qy) || - orientIfSure(rx, ry, qx, qy, px, py) || - orientIfSure(qx, qy, px, py, rx, ry); - return sign < 0; - } - - function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - - return dx * (ey * cp - bp * fy) - - dy * (ex * cp - bp * fx) + - ap * (ex * fy - ey * fx) < 0; - } - - function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - - return x * x + y * y; - } - - function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - - return {x, y}; - } - - function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (let i = left + 1; i <= right; i++) { - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; - ids[j + 1] = temp; - } - } else { - const median = (left + right) >> 1; - let i = left + 1; - let j = right; - swap$1(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) swap$1(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) swap$1(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) swap$1(ids, left, i); - - const temp = ids[i]; - const tempDist = dists[temp]; - while (true) { - do i++; while (dists[ids[i]] < tempDist); - do j--; while (dists[ids[j]] > tempDist); - if (j < i) break; - swap$1(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); - } - } - } - - function swap$1(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; - } - - function defaultGetX(p) { - return p[0]; - } - function defaultGetY(p) { - return p[1]; - } - - const epsilon$2 = 1e-6; - - class Path { - constructor() { - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; - } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; - } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon$2 || Math.abs(this._y1 - y0) > epsilon$2) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; - } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; - } - value() { - return this._ || null; - } - } - - class Polygon { - constructor() { - this._ = []; - } - moveTo(x, y) { - this._.push([x, y]); - } - closePath() { - this._.push(this._[0].slice()); - } - lineTo(x, y) { - this._.push([x, y]); - } - value() { - return this._.length ? this._ : null; - } - } - - class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); - } - update() { - this.delaunay.update(); - this._init(); - return this; - } - _init() { - const {delaunay: {points, hull, triangles}, vectors} = this; - - // Compute circumcenters. - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for (let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2) { - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x1 = points[t1]; - const y1 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - - const dx = x2 - x1; - const dy = y2 - y1; - const ex = x3 - x1; - const ey = y3 - y1; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const ab = (dx * ey - dy * ex) * 2; - - if (!ab) { - // degenerate case (collinear diagram) - x = (x1 + x3) / 2 - 1e8 * ey; - y = (y1 + y3) / 2 + 1e8 * ex; - } - else if (Math.abs(ab) < 1e-8) { - // almost equal points (degenerate triangle) - x = (x1 + x3) / 2; - y = (y1 + y3) / 2; - } else { - const d = 1 / ab; - x = x1 + (ey * bl - dy * cl) * d; - y = y1 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - - // Compute exterior cell rays. - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for (let i = 0; i < hull.length; ++i) { - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new Path : undefined; - const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this; - if (hull.length <= 1) return null; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for (let i = 0; i < hull.length; ++i) { - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new Path : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new Path : undefined; - const points = this._clip(i); - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - let n = points.length; - while (points[0] === points[n-2] && points[1] === points[n-1] && n > 1) n -= 2; - for (let i = 2; i < n; i += 2) { - if (points[i] !== points[i-2] || points[i+1] !== points[i-1]) - context.lineTo(points[i], points[i + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - *cellPolygons() { - const {delaunay: {points}} = this; - for (let i = 0, n = points.length / 2; i < n; ++i) { - const cell = this.cellPolygon(i); - if (cell) cell.index = i, yield cell; - } - } - cellPolygon(i) { - const polygon = new Polygon; - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } - } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; - } - *neighbors(i) { - const ci = this._clip(i); - if (ci) for (const j of this.delaunay.neighbors(i)) { - const cj = this._clip(j); - // find the common edge - if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { - for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { - if (ci[ai] == cj[aj] - && ci[ai + 1] == cj[aj + 1] - && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] - && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj] - ) { - yield j; - break loop; - } - } - } - } - } - _cell(i) { - const {circumcenters, delaunay: {inedges, halfedges, triangles}} = this; - const e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - } while (e !== e0 && e !== -1); - return points; - } - _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - const points = this._cell(i); - if (points === null) return null; - const {vectors: V} = this; - const v = i * 4; - return V[v] || V[v + 1] - ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) - : this._clipFinite(i, points); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1; - for (let j = 0; j < n; j += 2) { - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1); - else P = [x1, y1]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0); - else P = [sx0, sy0]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1); - else P = [sx1, sy1]; - } - } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - while (true) { - if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1]; - if (c0 & c1) return null; - let x, y, c = c0 || c1; - if (c & 0b1000) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 0b0100) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 0b0010) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) { - for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; - } - return P; - } - _edge(i, e0, e1, P, j) { - while (e0 !== e1) { - let x, y; - switch (e0) { - case 0b0101: e0 = 0b0100; continue; // top-left - case 0b0100: e0 = 0b0110, x = this.xmax, y = this.ymin; break; // top - case 0b0110: e0 = 0b0010; continue; // top-right - case 0b0010: e0 = 0b1010, x = this.xmax, y = this.ymax; break; // right - case 0b1010: e0 = 0b1000; continue; // bottom-right - case 0b1000: e0 = 0b1001, x = this.xmin, y = this.ymax; break; // bottom - case 0b1001: e0 = 0b0001; continue; // bottom-left - case 0b0001: e0 = 0b0101, x = this.xmin, y = this.ymin; break; // left - } - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) { - P.splice(j, 0, x, y), j += 2; - } - } - if (P.length > 4) { - for (let i = 0; i < P.length; i+= 2) { - const j = (i + 2) % P.length, k = (i + 4) % P.length; - if (P[i] === P[j] && P[j] === P[k] - || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) - P.splice(j, 2), i -= 2; - } - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { // top - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { // bottom - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { // right - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { // left - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - return [x, y]; - } - _edgecode(x, y) { - return (x === this.xmin ? 0b0001 - : x === this.xmax ? 0b0010 : 0b0000) - | (y === this.ymin ? 0b0100 - : y === this.ymax ? 0b1000 : 0b0000); - } - _regioncode(x, y) { - return (x < this.xmin ? 0b0001 - : x > this.xmax ? 0b0010 : 0b0000) - | (y < this.ymin ? 0b0100 - : y > this.ymax ? 0b1000 : 0b0000); - } - } - - const tau = 2 * Math.PI, pow$2 = Math.pow; - - function pointX(p) { - return p[0]; - } - - function pointY(p) { - return p[1]; - } - - // A triangulation is collinear if all its triangles have a non-null area - function collinear$1(d) { - const {triangles, coords} = d; - for (let i = 0; i < triangles.length; i += 3) { - const a = 2 * triangles[i], - b = 2 * triangles[i + 1], - c = 2 * triangles[i + 2], - cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1]) - - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]); - if (cross > 1e-10) return false; - } - return true; - } - - function jitter(x, y, r) { - return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r]; - } - - class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points - ? flatArray(points, fx, fy, that) - : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points) { - this._delaunator = new Delaunator(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); - } - update() { - this._delaunator.update(); - this._init(); - return this; - } - _init() { - const d = this._delaunator, points = this.points; - - // check for collinear - if (d.hull && d.hull.length > 2 && collinear$1(d)) { - this.collinear = Int32Array.from({length: points.length/2}, (_,i) => i) - .sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], - bounds = [ points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1] ], - r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for (let i = 0, n = points.length / 2; i < n; ++i) { - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new Delaunator(points); - } else { - delete this.collinear; - } - - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - - // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - for (let e = 0, n = halfedges.length; e < n; ++e) { - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; - } - for (let i = 0, n = hull.length; i < n; ++i) { - hullIndex[hull[i]] = i; - } - - // degenerate case: 1 or 2 (distinct) points - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - inedges[hull[0]] = 1; - if (hull.length === 2) inedges[hull[1]] = 0; - } - } - voronoi(bounds) { - return new Voronoi(this, bounds); - } - *neighbors(i) { - const {inedges, hull, _hullIndex, halfedges, triangles, collinear} = this; - - // degenerate case with several collinear points - if (collinear) { - const l = collinear.indexOf(i); - if (l > 0) yield collinear[l - 1]; - if (l < collinear.length - 1) yield collinear[l + 1]; - return; - } - - const e0 = inedges[i]; - if (e0 === -1) return; // coincident point - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) return; // bad triangulation - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) yield p; - return; - } - } while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - const i0 = i; - let c; - while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) i = c; - return c; - } - _step(i, x, y) { - const {inedges, hull, _hullIndex, halfedges, triangles, points} = this; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow$2(x - points[i * 2], 2) + pow$2(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow$2(x - points[t * 2], 2) + pow$2(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow$2(x - points[e * 2], 2) + pow$2(y - points[e * 2 + 1], 2) < dc) return e; - } - break; - } - } while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new Path : undefined; - const {points, halfedges, triangles} = this; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r = 2) { - const buffer = context == null ? context = new Path : undefined; - const {points} = this; - for (let i = 0, n = points.length; i < n; i += 2) { - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new Path : undefined; - const {hull, points} = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for (let i = 1; i < n; ++i) { - const h = 2 * hull[i]; - context.lineTo(points[h], points[h + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - hullPolygon() { - const polygon = new Polygon; - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new Path : undefined; - const {points, triangles} = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); - } - *trianglePolygons() { - const {triangles} = this; - for (let i = 0, n = triangles.length / 3; i < n; ++i) { - yield this.trianglePolygon(i); - } - } - trianglePolygon(i) { - const polygon = new Polygon; - this.renderTriangle(i, polygon); - return polygon.value(); - } - } - - function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for (let i = 0; i < n; ++i) { - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; - } - - function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points) { - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; - } - } - - function Voronoi$1(params) { - Transform.call(this, null, params); - } - - Voronoi$1.Definition = { - 'type': 'Voronoi', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'extent', 'type': 'array', 'array': true, 'length': 2, - 'default': [[-1e5, -1e5], [1e5, 1e5]], - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] - }; - - const prototype$1o = inherits(Voronoi$1, Transform); - - const defaultExtent = [-1e5, -1e5, 1e5, 1e5]; - - prototype$1o.transform = function(_, pulse) { - const as = _.as || 'path', - data = pulse.source; - - // nothing to do if no data - if (!data || !data.length) return pulse; - - // configure and construct voronoi diagram - let s = _.size; - s = s ? [0, 0, s[0], s[1]] - : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] - : defaultExtent; - - const voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s); - - // map polygons to paths - for (let i=0, n=data.length; i> 5, - ch = 1 << 11; - - function cloud() { - var size = [256, 256], - text, - font, - fontSize, - fontStyle, - fontWeight, - rotate, - padding, - spiral = archimedeanSpiral, - words = [], - random = Math.random, - cloud = {}; - - cloud.layout = function() { - var contextAndRatio = getContext(domCanvas()), - board = zeroArray((size[0] >> 5) * size[1]), - bounds = null, - n = words.length, - i = -1, - tags = [], - data = words.map(function(d) { - return { - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - }; - }).sort(function(a, b) { return b.size - a.size; }); - - while (++i < n) { - var d = data[i]; - d.x = (size[0] * (random() + .5)) >> 1; - d.y = (size[1] * (random() + .5)) >> 1; - cloudSprite(contextAndRatio, d, data, i); - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d); - else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}]; - // Temporary hack - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - - return tags; - }; - - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - - return {context: context, ratio: ratio}; - } - - function place(board, tag, bounds) { - var startX = tag.x, - startY = tag.y, - maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), - s = spiral(size), - dt = random() < .5 ? 1 : -1, - t = -dt, - dxdy, - dx, - dy; - - while (dxdy = s(t += dt)) { - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - - tag.x = startX + dx; - tag.y = startY + dy; - - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || - tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; - // TODO only check for collisions within current bounds. - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, - w = tag.width >> 5, - sw = size[0] >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - } - x += sw; - } - tag.sprite = null; - return true; - } - } - } - return false; - } - - cloud.words = function(_) { - if (arguments.length) { - words = _; - return cloud; - } else { - return words; - } - }; - - cloud.size = function(_) { - if (arguments.length) { - size = [+_[0], +_[1]]; - return cloud; - } else { - return size; - } - }; - - cloud.font = function(_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else { - return font; - } - }; - - cloud.fontStyle = function(_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else { - return fontStyle; - } - }; - - cloud.fontWeight = function(_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else { - return fontWeight; - } - }; - - cloud.rotate = function(_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else { - return rotate; - } - }; - - cloud.text = function(_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else { - return text; - } - }; - - cloud.spiral = function(_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else { - return spiral; - } - }; - - cloud.fontSize = function(_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else { - return fontSize; - } - }; - - cloud.padding = function(_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else { - return padding; - } - }; - - cloud.random = function(_) { - if (arguments.length) { - random = _; - return cloud; - } else { - return random; - } - }; - - return cloud; - } - - // Fetches a monochrome sprite bitmap for the specified text. - // Load in batches for speed. - function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, - ratio = contextAndRatio.ratio; - - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, - y = 0, - maxh = 0, - n = data.length, - w, w32, h, i, j; - --di; - while (++di < n) { - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), - cr = Math.cos(d.rotate * cloudRadians), - wcr = w * cr, - wsr = w * sr, - hcr = h * cr, - hsr = h * sr; - w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else { - w = (w + 0x1f) >> 5 << 5; - } - if (h > maxh) maxh = h; - if (x + w >= (cw << 5)) { - x = 0; - y += maxh; - maxh = 0; - } - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, - sprite = []; - while (--di >= 0) { - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; - // Zero the buffer - for (i = 0; i < h * w32; i++) sprite[i] = 0; - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, - seenRow = -1; - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - var k = w32 * j + (i >> 5), - m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0; - sprite[k] |= m; - seen |= m; - } - if (seen) seenRow = j; - else { - d.y0++; - h--; - j--; - y++; - } - } - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); - } - } - - // Use mask-based collision detection. - function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, - w = tag.width >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) - & board[x + i]) return true; - } - x += sw; - } - return false; - } - - function cloudBounds(bounds, d) { - var b0 = bounds[0], - b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; - } - - function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; - } - - function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function(t) { - return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)]; - }; - } - - function rectangularSpiral(size) { - var dy = 4, - dx = dy * size[0] / size[1], - x = 0, - y = 0; - return function(t) { - var sign = t < 0 ? -1 : 1; - // See triangular numbers: T_n = n * (n + 1) / 2. - switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) { - case 0: x += dx; break; - case 1: y += dy; break; - case 2: x -= dx; break; - default: y -= dy; break; - } - return [x, y]; - }; - } - - // TODO reuse arrays? - function zeroArray(n) { - var a = [], - i = -1; - while (++i < n) a[i] = 0; - return a; - } - - function functor(d) { - return typeof d === 'function' ? d : function() { return d; }; - } - - var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral - }; - - var Output$5 = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle']; - - var Params$1 = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight']; - - function Wordcloud(params) { - Transform.call(this, cloud(), params); - } - - Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'font', 'type': 'string', 'expr': true, 'default': 'sans-serif' }, - { 'name': 'fontStyle', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontWeight', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontSize', 'type': 'number', 'expr': true, 'default': 14 }, - { 'name': 'fontSizeRange', 'type': 'number', 'array': 'nullable', 'default': [10, 50] }, - { 'name': 'rotate', 'type': 'number', 'expr': true, 'default': 0 }, - { 'name': 'text', 'type': 'field' }, - { 'name': 'spiral', 'type': 'string', 'values': ['archimedean', 'rectangular'] }, - { 'name': 'padding', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 7, 'default': Output$5 } - ] - }; - - var prototype$1p = inherits(Wordcloud, Transform); - - prototype$1p.transform = function(_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) { - error('Wordcloud size dimensions must be non-zero.'); - } - - function modp(param) { - var p = _[param]; - return isFunction(p) && pulse.modified(p.fields); - } - - var mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || Params$1.some(modp))) return; - - var data = pulse.materialize(pulse.SOURCE).source, - layout = this.value, - as = _.as || Output$5, - fontSize = _.fontSize || 14, - range; - - isFunction(fontSize) - ? (range = _.fontSizeRange) - : (fontSize = constant(fontSize)); - - // create font size scaling function as needed - if (range) { - var fsize = fontSize, - sizeScale = scale$2('sqrt')() - .domain(extent(data, fsize)) - .range(range); - fontSize = function(x) { return sizeScale(fsize(x)); }; - } - - data.forEach(function(t) { - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); - - // configure layout - var words = layout - .words(data) - .text(_.text) - .size(_.size || [500, 500]) - .padding(_.padding || 1) - .spiral(_.spiral || 'archimedean') - .rotate(_.rotate || 0) - .font(_.font || 'sans-serif') - .fontStyle(_.fontStyle || 'normal') - .fontWeight(_.fontWeight || 'normal') - .fontSize(fontSize) - .random(exports.random) - .layout(); - - var size = layout.size(), - dx = size[0] >> 1, - dy = size[1] >> 1, - i = 0, - n = words.length, - w, t; - - for (; i boolean (true => remove) - var n = data.length, - copy = Array(n - num), - reindex = data, // reuse old data array for index map - t, i, j; - - // seek forward to first removal - for (i=0; !map[i] && i k || m > width) { - width = Math.max(m, width); - curr = array$1(n, width, curr); - prev = array$1(n, width); - } - } - }; - } - - function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; - } - - function array$1(n, m, array) { - var copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; - } - - function Dimension(index, i, query) { - var bit = (1 << i); - - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - - onAdd: function(added, curr) { - var dim = this, - range = dim.bisect(dim.range, added.value), - idx = added.index, - lo = range[0], - hi = range[1], - n1 = idx.length, i; - - for (i=0; i 0) for (i=0; i remove - var n = size, - idx, i, j; - - // seek forward to first removal - for (i=0; !map[index[i]] && i y ? 1 : 0; - }); - return permute(values, index); - } - - function merge$1(base, value0, index0, n0, value1, index1, n1, value, index) { - var i0 = 0, i1 = 0, i; - - for (i=0; i0 < n0 && i1 < n1; ++i) { - if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - } - - for (; i0 < n0; ++i0, ++i) { - value[i] = value0[i0]; - index[i] = index0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } - } - - /** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ - function CrossFilter(params) { - Transform.call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; - } - - CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'query', 'type': 'array', 'array': true, 'required': true, - 'content': {'type': 'number', 'array': true, 'length': 2} } - ] - }; - - var prototype$1q = inherits(CrossFilter, Transform); - - prototype$1q.transform = function(_, pulse) { - if (!this._dims) { - return this.init(_, pulse); - } else { - var init = _.modified('fields') - || _.fields.some(function(f) { return pulse.modified(f.fields); }); - - return init - ? this.reinit(_, pulse) - : this.eval(_, pulse); - } - }; - - prototype$1q.init = function(_, pulse) { - var fields = _.fields, - query = _.query, - indices = this._indices = {}, - dims = this._dims = [], - m = query.length, - i = 0, key, index; - - // instantiate indices and dimensions - for (; i lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - dim.range = query.slice(); - }; - - prototype$1q.incrementOne = function(dim, query, add, rem) { - var bits = this.value, - curr = bits.curr(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, j, k; - - // Fast incremental update based on previous lo index. - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - dim.range = query.slice(); - }; - - /** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ - function ResolveFilter(params) { - Transform.call(this, null, params); - } - - ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [ - { 'name': 'ignore', 'type': 'number', 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' }, - { 'name': 'filter', 'type': 'object', 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' } - ] - }; - - var prototype$1r = inherits(ResolveFilter, Transform); - - prototype$1r.transform = function(_, pulse) { - var ignore = ~(_.ignore || 0), // bit mask where zeros -> dims to ignore - bitmap = _.filter, - mask = bitmap.mask; - - // exit early if no relevant filter changes - if ((mask & ignore) === 0) return pulse.StopPropagation; - - var output = pulse.fork(pulse.ALL), - data = bitmap.data(), - curr = bitmap.curr(), - prev = bitmap.prev(), - pass = function(k) { - return !(curr[k] & ignore) ? data[k] : null; - }; - - // propagate all mod tuples that pass the filter - output.filter(output.MOD, pass); - - // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - - if (!(mask & (mask-1))) { // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, function(k) { - return (curr[k] & ignore) === mask ? data[k] : null; - }); - - } else { // multiple filters changed - output.filter(output.ADD, function(k) { - var c = curr[k] & ignore, - f = !c && (c ^ (prev[k] & ignore)); - return f ? data[k] : null; - }); - output.filter(output.REM, function(k) { - var c = curr[k] & ignore, - f = c && !(c ^ (c ^ (prev[k] & ignore))); - return f ? data[k] : null; - }); - } - - // add filter to source data in case of reflow... - return output.filter(output.SOURCE, function(t) { return pass(t._index); }); - }; - - var xf = /*#__PURE__*/Object.freeze({ - __proto__: null, - crossfilter: CrossFilter, - resolvefilter: ResolveFilter - }); - - var version = "5.13.0"; - - // initialize aria role and label attributes - function initializeAria(view) { - const el = view.container(); - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } - } - - // update aria-label if we have a DOM container element - function ariaLabel(el, desc) { - if (el) desc == null - ? el.removeAttribute('aria-label') - : el.setAttribute('aria-label', desc); - } - - function background$1(view) { - // respond to background signal - view.add(null, _ => { - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { bg: view._signals.background }); - } - - const Default = 'default'; - - function cursor(view) { - // get cursor signal, add to dataflow if needed - const cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); - - // evaluate cursor on each mousemove event - view.on(view.events('view', 'mousemove'), cursor, - function(_, event) { - const value = cursor.value, - user = value ? (isString(value) ? value : value.user) : Default, - item = event.item && event.item.cursor || null; - - return (value && user === value.user && item == value.item) - ? value - : {user: user, item: item}; - } - ); - - // when cursor signal updates, set visible cursor - view.add(null, function(_) { - let user = _.cursor, - item = this.value; - - if (!isString(user)) { - item = user.item; - user = user.user; - } - - setCursor(view, user && user !== Default ? user : (item || user)); - - return item; - }, {cursor: cursor}); - } - - function setCursor(view, cursor) { - const el = view.globalCursor() - ? (typeof document !== 'undefined' && document.body) - : view.container(); - - if (el) { - return cursor == null - ? el.style.removeProperty('cursor') - : (el.style.cursor = cursor); - } - } - - function dataref(view, name) { - var data = view._runtime.data; - if (!hasOwnProperty(data, name)) { - error('Unrecognized data set: ' + name); - } - return data[name]; - } - - function data(name, values) { - return arguments.length < 2 - ? dataref(this, name).values.value - : change.call(this, name, changeset().remove(truthy).insert(values)); - } - - function change(name, changes) { - if (!isChangeSet(changes)) { - error('Second argument to changes must be a changeset.'); - } - var dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); - } - - function insert(name, _) { - return change.call(this, name, changeset().insert(_)); - } - - function remove(name, _) { - return change.call(this, name, changeset().remove(_)); - } - - function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); - } - - function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); - } - - function offset$3(view) { - var padding = view.padding(), - origin = view._origin; - return [ - padding.left + origin[0], - padding.top + origin[1] - ]; - } - - function resizeRenderer(view) { - var origin = offset$3(view), - w = width(view), - h = height(view); - - view._renderer.background(view.background()); - view._renderer.resize(w, h, origin); - view._handler.origin(origin); - - view._resizeListeners.forEach(function(handler) { - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); - } - - /** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ - function eventExtend(view, event, item) { - var r = view._renderer, - el = r && r.canvas(), - p, e, translate; - - if (el) { - translate = offset$3(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = point(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; - } - - function extension(view, item, point) { - var itemGroup = item - ? item.mark.marktype === 'group' ? item : item.mark.group - : null; - - function group(name) { - var g = itemGroup, i; - if (name) for (i = item; i; i = i.mark.group) { - if (i.mark.name === name) { g = i; break; } - } - return g && g.mark && g.mark.interactive ? g : {}; - } - - function xy(item) { - if (!item) return point; - if (isString(item)) item = group(item); - - var p = point.slice(); - while (item) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - return p; - } - - return { - view: constant(view), - item: constant(item || {}), - group: group, - xy: xy, - x: function(item) { return xy(item)[0]; }, - y: function(item) { return xy(item)[1]; } - }; - } - - const VIEW = 'view', - TIMER = 'timer', - WINDOW = 'window', - NO_TRAP = {trap: false}; - - /** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ - function initializeEventConfig(config) { - const events = extend({defaults: {}}, config); - - const unpack = (obj, keys) => { - keys.forEach(k => { - if (isArray(obj[k])) obj[k] = toSet(obj[k]); - }); - }; - - unpack(events.defaults, ['prevent', 'allow']); - unpack(events, ['view', 'window', 'selector']); - - return events; - } - - function prevent(view, type) { - var def = view._eventConfig.defaults, - prevent = def.prevent, - allow = def.allow; - - return prevent === false || allow === true ? false - : prevent === true || allow === false ? true - : prevent ? prevent[type] - : allow ? !allow[type] - : view.preventDefault(); - } - - function permit(view, key, type) { - const rule = view._eventConfig && view._eventConfig[key]; - - if (rule === false || (isObject(rule) && !rule[type])) { - view.warn(`Blocked ${key} ${type} event listener.`); - return false; - } - - return true; - } - - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ - function events$1(source, type, filter) { - var view = this, - s = new EventStream(filter), - send = function(e, item) { - view.runAsync(null, () => { - if (source === VIEW && prevent(view, type)) { - e.preventDefault(); - } - s.receive(eventExtend(view, e, item)); - }); - }, - sources; - - if (source === TIMER) { - if (permit(view, 'timer', type)) { - view.timer(send, type); - } - } - - else if (source === VIEW) { - if (permit(view, 'view', type)) { - // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } - } - - else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') { - sources = [window]; - } - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) { - sources = document.querySelectorAll(source); - } - } - - if (!sources) { - view.warn('Can not resolve event source: ' + source); - } else { - for (var i=0, n=sources.length; i= 0) { - timers[n].stop(); - } - - n = listeners.length; - while (--n >= 0) { - e = listeners[n]; - m = e.sources.length; - while (--m >= 0) { - e.sources[m].removeEventListener(e.type, e.handler); - } - } - - if (tooltip) { - tooltip.call(this, this._handler, null, null, null); - } - - return this; - } - - function element$1(tag, attr, text) { - var el = document.createElement(tag); - for (var key in attr) el.setAttribute(key, attr[key]); - if (text != null) el.textContent = text; - return el; - } - - const BindClass = 'vega-bind', - NameClass = 'vega-bind-name', - RadioClass = 'vega-bind-radio'; - - /** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ - function bind$1(view, el, binding) { - if (!el) return; - - const param = binding.param; - let bind = binding.state; - - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: value => { - if (value !== view.signal(param.signal)) { - view.runAsync(null, function() { - bind.source = true; - view.signal(param.signal, value); - }); - } - } - }; - if (param.debounce) { - bind.update = debounce(param.debounce, bind.update); - } - } - - generate(bind, el, param, view.signal(param.signal)); - - if (!bind.active) { - view.on(view._signals[param.signal], null, () => { - bind.source - ? (bind.source = false) - : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - - return bind; - } - - /** - * Generate an HTML input form element and bind it to a signal. - */ - function generate(bind, el, param, value) { - const div = element$1('div', {'class': BindClass}); - - const wrapper = param.input === 'radio' - ? div - : div.appendChild(element$1('label')); - - wrapper.appendChild(element$1('span', - {'class': NameClass}, - (param.name || param.signal) - )); - - el.appendChild(div); - - let input = form; - switch (param.input) { - case 'checkbox': input = checkbox; break; - case 'select': input = select; break; - case 'radio': input = radio; break; - case 'range': input = range; break; - } - - input(bind, wrapper, param, value); - } - - /** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ - function form(bind, el, param, value) { - const node = element$1('input'); - - for (const key in param) { - if (key !== 'signal' && key !== 'element') { - node.setAttribute(key === 'input' ? 'type' : key, param[key]); - } - } - node.setAttribute('name', param.signal); - node.value = value; - - el.appendChild(node); - node.addEventListener('input', () => bind.update(node.value)); - - bind.elements = [node]; - bind.set = value => node.value = value; - } - - /** - * Generates a checkbox input element. - */ - function checkbox(bind, el, param, value) { - const attr = {type: 'checkbox', name: param.signal}; - if (value) attr.checked = true; - const node = element$1('input', attr); - - el.appendChild(node); - node.addEventListener('change', () => bind.update(node.checked)); - - bind.elements = [node]; - bind.set = value => node.checked = !!value || null; - } - - /** - * Generates a selection list input element. - */ - function select(bind, el, param, value) { - const node = element$1('select', {name: param.signal}), - labels = param.labels || []; - - param.options.forEach((option, i) => { - const attr = {value: option}; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element$1('option', attr, (labels[i] || option)+'')); - }); - - el.appendChild(node); - - node.addEventListener('change', () => { - bind.update(param.options[node.selectedIndex]); - }); - - bind.elements = [node]; - bind.set = value => { - for (let i = 0, n = param.options.length; i < n; ++i) { - if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; return; - } - } - }; - } - - /** - * Generates a radio button group. - */ - function radio(bind, el, param, value) { - const group = element$1('span', {'class': RadioClass}), - labels = param.labels || []; - - el.appendChild(group); - - bind.elements = param.options.map((option, i) => { - const attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - - const input = element$1('input', attr); - input.addEventListener('change', () => bind.update(option)); - - const label = element$1('label', {}, (labels[i] || option)+''); - label.prepend(input); - group.appendChild(label); - - return input; - }); - - bind.set = value => { - const nodes = bind.elements, - n = nodes.length; - for (let i = 0; i < n; ++i) { - if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - } - }; - } - - /** - * Generates a slider input element. - */ - function range(bind, el, param, value) { - value = value !== undefined ? value : ((+param.max) + (+param.min)) / 2; - - const max = param.max != null ? param.max : Math.max(100, +value) || 100, - min = param.min || Math.min(0, max, +value) || 0, - step = param.step || tickStep(min, max, 100); - - const node = element$1('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - - const span = element$1('span', {}, +value); - - el.appendChild(node); - el.appendChild(span); - - const update = () => { - span.textContent = node.value; - bind.update(+node.value); - }; - - // subscribe to both input and change - node.addEventListener('input', update); - node.addEventListener('change', update); - - bind.elements = [node]; - bind.set = value => { - node.value = value; - span.textContent = value; - }; - } - - function valuesEqual(a, b) { - return a === b || (a+'' === b+''); - } - - function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r - .initialize(el, width(view), height(view), offset$3(view), scaleFactor, opt) - .background(view.background()); - } - - function trap(view, fn) { - return !fn ? null : function() { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; - } - - function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - var handler = new constructor(view.loader(), trap(view, view.tooltip())) - .scene(view.scenegraph().root) - .initialize(el, offset$3(view), view); - - // transfer event handlers - if (prevHandler) { - prevHandler.handlers().forEach(function(h) { - handler.on(h.type, h.handler); - }); - } - - return handler; - } - - function initialize$1(el, elBind) { - const view = this, - type = view._renderType, - config = view._eventConfig.bind, - module = renderModule(type); - - // containing dom element - el = view._el = el ? lookup$4(view, el) : null; - - // initialize aria attributes - initializeAria(view); - - // select appropriate renderer & handler - if (!module) view.error('Unrecognized renderer type: ' + type); - const Handler = module.handler || CanvasHandler, - Renderer = (el ? module.renderer : module.headless); - - // initialize renderer and input handler - view._renderer = !Renderer ? null - : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; - - // initialize signal bindings - if (el && config !== 'none') { - elBind = elBind ? (view._elBind = lookup$4(view, elBind)) - : el.appendChild(element$1('form', {'class': 'vega-bindings'})); - - view._bind.forEach(function(_) { - if (_.param.element && config !== 'container') { - _.element = lookup$4(view, _.param.element); - } - }); - - view._bind.forEach(function(_) { - bind$1(view, _.element || elBind, _); - }); - } - - return view; - } - - function lookup$4(view, el) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; - } - } - if (el) { - try { - el.innerHTML = ''; - } catch (e) { - el = null; - view.error(e); - } - } - return el; - } - - const number$5 = _ => +_ || 0; - - const paddingObject = _ => ({top: _, bottom: _, left: _, right: _}); - - function padding(_) { - return isObject(_) - ? { - top: number$5(_.top), - bottom: number$5(_.bottom), - left: number$5(_.left), - right: number$5(_.right) - } - : paddingObject(number$5(_)); - } - - /** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ - async function renderHeadless(view, type, scaleFactor, opt) { - const module = renderModule(type), - ctr = module && module.headless; - - if (!ctr) error('Unrecognized renderer type: ' + type); - - await view.runAsync(); - return initializeRenderer(view, null, null, ctr, scaleFactor, opt) - .renderAsync(view._scenegraph.root); - } - - /** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ - async function renderToImageURL(type, scaleFactor) { - if (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG) { - error('Unrecognized image type: ' + type); - } - - const r = await renderHeadless(this, type, scaleFactor); - return type === RenderType.SVG - ? toBlobURL(r.svg(), 'image/svg+xml') - : r.canvas().toDataURL('image/png'); - } - - function toBlobURL(data, mime) { - var blob = new Blob([data], {type: mime}); - return window.URL.createObjectURL(blob); - } - - /** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ - async function renderToCanvas(scaleFactor, opt) { - const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt); - return r.canvas(); - } - - /** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ - async function renderToSVG(scaleFactor) { - const r = await renderHeadless(this, RenderType.SVG, scaleFactor); - return r.svg(); - } - - function data$1(name) { - const data = this.context.data[name]; - return data ? data.values.value : []; - } - - function indata(name, field, value) { - const index = this.context.data[name]['index:' + field], - entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; - } - - function setdata(name, tuples) { - const df = this.context.dataflow, - data = this.context.data[name], - input = data.input; - - df.pulse(input, df.changeset().remove(truthy).insert(tuples)); - return 1; - } - - function encode$1(item, name, retval) { - if (item) { - const df = this.context.dataflow, - target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - return retval !== undefined ? retval : item; - } - - const wrap = method => function(value, spec) { - const locale = this.context.dataflow.locale(); - return locale[method](spec)(value); - }; - - const format$2 = wrap('format'); - const timeFormat = wrap('timeFormat'); - const utcFormat = wrap('utcFormat'); - const timeParse = wrap('timeParse'); - const utcParse = wrap('utcParse'); - - var dateObj = new Date(2000, 0, 1); - - function time$1(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); - dateObj.setMonth(month); - dateObj.setDate(day); - return timeFormat.call(this, dateObj, specifier); - } - - function monthFormat(month) { - return time$1.call(this, month, 1, '%B'); - } - - function monthAbbrevFormat(month) { - return time$1.call(this, month, 1, '%b'); - } - - function dayFormat(day) { - return time$1.call(this, 0, 2 + day, '%A'); - } - - function dayAbbrevFormat(day) { - return time$1.call(this, 0, 2 + day, '%a'); - } - - const DataPrefix = ':'; - const IndexPrefix = '@'; - const ScalePrefix = '%'; - const SignalPrefix = '$'; - - var RawCode = 'RawCode'; - var Literal = 'Literal'; - var Property = 'Property'; - var Identifier$1 = 'Identifier'; - - var ArrayExpression = 'ArrayExpression'; - var BinaryExpression = 'BinaryExpression'; - var CallExpression = 'CallExpression'; - var ConditionalExpression = 'ConditionalExpression'; - var LogicalExpression = 'LogicalExpression'; - var MemberExpression = 'MemberExpression'; - var ObjectExpression = 'ObjectExpression'; - var UnaryExpression = 'UnaryExpression'; - - function ASTNode(type) { - this.type = type; - } - - ASTNode.prototype.visit = function(visitor) { - var node = this, c, i, n; - - if (visitor(node)) return 1; - - for (c=children$1(node), i=0, n=c.length; i - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - - 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. - - 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 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. - */ - - var TokenName, - source$1, - index, - length, - lookahead; - - var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; - - TokenName = {}; - TokenName[TokenBooleanLiteral] = 'Boolean'; - TokenName[TokenEOF] = ''; - TokenName[TokenIdentifier] = 'Identifier'; - TokenName[TokenKeyword] = 'Keyword'; - TokenName[TokenNullLiteral] = 'Null'; - TokenName[TokenNumericLiteral] = 'Numeric'; - TokenName[TokenPunctuator] = 'Punctuator'; - TokenName[TokenStringLiteral] = 'String'; - TokenName[TokenRegularExpression] = 'RegularExpression'; - - var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; - - // Error messages should be identical to V8. - var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; - - var ILLEGAL = 'ILLEGAL', - DISABLED = 'Disabled.'; - - // See also tools/generate-unicode-regex.py. - var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), - // eslint-disable-next-line no-misleading-character-class - RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-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-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); - - // Ensure the condition is true, otherwise throw an error. - // This is only to have a better contract semantic, i.e. another safety net - // to catch a logic error. The condition shall be fulfilled in normal case. - // Do NOT use this to enforce a certain condition on any user input. - - function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - - function isDecimalDigit(ch) { - return (ch >= 0x30 && ch <= 0x39); // 0..9 - } - - function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; - } - - function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; - } - - // 7.2 White Space - - function isWhiteSpace(ch) { - return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || - (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); - } - - // 7.3 Line Terminators - - function isLineTerminator(ch) { - return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); - } - - // 7.6 Identifier Names and Identifiers - - function isIdentifierStart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch))); - } - - function isIdentifierPart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch >= 0x30 && ch <= 0x39) || // 0..9 - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch))); - } - - // 7.6.1.1 Keywords - - var keywords = { - 'if':1, 'in':1, 'do':1, - 'var':1, 'for':1, 'new':1, 'try':1, 'let':1, - 'this':1, 'else':1, 'case':1, 'void':1, 'with':1, 'enum':1, - 'while':1, 'break':1, 'catch':1, 'throw':1, 'const':1, 'yield':1, 'class':1, 'super':1, - 'return':1, 'typeof':1, 'delete':1, 'switch':1, 'export':1, 'import':1, 'public':1, 'static':1, - 'default':1, 'finally':1, 'extends':1, 'package':1, 'private':1, - 'function':1, 'continue':1, 'debugger':1, - 'interface':1, 'protected':1, - 'instanceof':1, 'implements':1 - }; - - function skipComment() { - var ch; - - while (index < length) { - ch = source$1.charCodeAt(index); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index; - } else { - break; - } - } - } - - function scanHexEscape(prefix) { - var i, len, ch, code = 0; - - len = (prefix === 'u') ? 4 : 2; - for (i = 0; i < len; ++i) { - if (index < length && isHexDigit(source$1[index])) { - ch = source$1[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - return String.fromCharCode(code); - } - - function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - - ch = source$1[index]; - code = 0; - - // At least, one hex digit is required. - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - while (index < length) { - ch = source$1[index++]; - if (!isHexDigit(ch)) { - break; - } - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - // UTF-16 Encoding - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - cu1 = ((code - 0x10000) >> 10) + 0xD800; - cu2 = ((code - 0x10000) & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); - } - - function getEscapedIdentifier() { - var ch, id; - - ch = source$1.charCodeAt(index++); - id = String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source$1.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id = ch; - } - - while (index < length) { - ch = source$1.charCodeAt(index); - if (!isIdentifierPart(ch)) { - break; - } - ++index; - id += String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source$1.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id += ch; - } - } - - return id; - } - - function getIdentifier() { - var start, ch; - - start = index++; - while (index < length) { - ch = source$1.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); - } - if (isIdentifierPart(ch)) { - ++index; - } else { - break; - } - } - - return source$1.slice(start, index); - } - - function scanIdentifier() { - var start, id, type; - - start = index; - - // Backslash (U+005C) starts an escaped character. - id = (source$1.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); - - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index - }; - } - - // 7.7 Punctuators - - function scanPunctuator() { - var start = index, - code = source$1.charCodeAt(index), - code2, - ch1 = source$1[index], - ch2, - ch3, - ch4; - - switch (code) { - - // Check for most common single-character punctuators. - case 0x2E: // . dot - case 0x28: // ( open bracket - case 0x29: // ) close bracket - case 0x3B: // ; semicolon - case 0x2C: // , comma - case 0x7B: // { open curly brace - case 0x7D: // } close curly brace - case 0x5B: // [ - case 0x5D: // ] - case 0x3A: // : - case 0x3F: // ? - case 0x7E: // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - - default: - code2 = source$1.charCodeAt(index + 1); - - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - case 0x2D: // - - case 0x2F: // / - case 0x3C: // < - case 0x3E: // > - case 0x5E: // ^ - case 0x7C: // | - case 0x25: // % - case 0x26: // & - case 0x2A: // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - - case 0x21: // ! - case 0x3D: // = - index += 2; - - // !== and === - if (source$1.charCodeAt(index) === 0x3D) { - ++index; - } - return { - type: TokenPunctuator, - value: source$1.slice(start, index), - start: start, - end: index - }; - } - } - } - - // 4-character punctuator: >>>= - - ch4 = source$1.substr(index, 4); - - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } - - // 3-character punctuators: === !== >>> <<= >>= - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } - - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - - if ((ch1 === ch2[1] && ('+-<>&|'.indexOf(ch1) >= 0)) || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } - - // 1-character punctuators: < > = ! + - * % & | ^ / - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - // 7.8.3 Numeric Literals - - function scanHexLiteral(start) { - var number = ''; - - while (index < length) { - if (!isHexDigit(source$1[index])) { - break; - } - number += source$1[index++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - if (isIdentifierStart(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index - }; - } - - function scanOctalLiteral(start) { - var number = '0' + source$1[index++]; - while (index < length) { - if (!isOctalDigit(source$1[index])) { - break; - } - number += source$1[index++]; - } - - if (isIdentifierStart(source$1.charCodeAt(index)) || isDecimalDigit(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; - } - - function scanNumericLiteral() { - var number, start, ch; - - ch = source$1[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), - 'Numeric literal must start with a decimal digit or a decimal point'); - - start = index; - number = ''; - if (ch !== '.') { - number = source$1[index++]; - ch = source$1[index]; - - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } - - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - ch = source$1[index]; - } - - if (ch === '.') { - number += source$1[index++]; - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - ch = source$1[index]; - } - - if (ch === 'e' || ch === 'E') { - number += source$1[index++]; - - ch = source$1[index]; - if (ch === '+' || ch === '-') { - number += source$1[index++]; - } - if (isDecimalDigit(source$1.charCodeAt(index))) { - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - if (isIdentifierStart(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; - } - - // 7.8.4 String Literals - - function scanStringLiteral() { - var str = '', - quote, start, ch, code, octal = false; - - quote = source$1[index]; - assert((quote === '\'' || quote === '"'), - 'String literal must starts with a quote'); - - start = index; - ++index; - - while (index < length) { - ch = source$1[index++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source$1[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source$1[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - - // \0 is not octal escape sequence - if (code !== 0) { - octal = true; - } - - if (index < length && isOctalDigit(source$1[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source$1[index++]); - - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.indexOf(ch) >= 0 && - index < length && - isOctalDigit(source$1[index])) { - code = code * 8 + '01234567'.indexOf(source$1[index++]); - } - } - str += String.fromCharCode(code); - } else { - str += ch; - } - break; - } - } else { - if (ch === '\r' && source$1[index] === '\n') { - ++index; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index - }; - } - - function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp - .replace(/\\u\{([0-9a-fA-F]+)\}/g, function($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - throwError({}, MessageInvalidRegExp); - }) - .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } - - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } - - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } - } - - function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - - ch = source$1[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source$1[index++]; - - classMarker = false; - terminated = false; - while (index < length) { - ch = source$1[index++]; - str += ch; - if (ch === '\\') { - ch = source$1[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } - - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; - } - - function scanRegExpFlags() { - var ch, str, flags; - - str = ''; - flags = ''; - while (index < length) { - ch = source$1[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index; - if (ch === '\\' && index < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; - } - - function scanRegExp() { - var start, body, flags, value; - - lookahead = null; - skipComment(); - start = index; - - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index - }; - } - - function isIdentifierName(token) { - return token.type === TokenIdentifier || - token.type === TokenKeyword || - token.type === TokenBooleanLiteral || - token.type === TokenNullLiteral; - } - - function advance() { - var ch; - - skipComment(); - - if (index >= length) { - return { - type: TokenEOF, - start: index, - end: index - }; - } - - ch = source$1.charCodeAt(index); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } - - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } - - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } - - - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source$1.charCodeAt(index + 1))) { - return scanNumericLiteral(); - } - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - function lex() { - var token; - - token = lookahead; - index = token.end; - - lookahead = advance(); - - index = token.end; - - return token; - } - - function peek$1() { - var pos; - - pos = index; - - lookahead = advance(); - index = pos; - } - - function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; - } - - function finishBinaryExpression(operator, left, right) { - var node = new ASTNode((operator === '||' || operator === '&&') ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; - } - - function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; - } - - function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; - } - - function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; - } - - function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source$1.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - node.regex = token.regex; - } - return node; - } - - function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; - } - - function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; - } - - function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; - } - - function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; - } - - // Throw an exception - - function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace( - /%(\d)/g, - function(whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - } - ); - - - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; - } - - // Throw an exception because of the token. - - function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } - - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); - } - - // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - - function expect(value) { - var token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } - } - - // Return true if the next token matches the specified punctuator. - - function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; - } - - // Return true if the next token matches the specified keyword - - function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; - } - - // 11.1.4 Array Initialiser - - function parseArrayInitialiser() { - var elements = []; - - index = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - - return finishArrayExpression(elements); - } - - // 11.1.5 Object Initialiser - - function parseObjectPropertyKey() { - var token; - - index = lookahead.start; - token = lex(); - - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - return finishLiteral(token); - } - - return finishIdentifier(token.value); - } - - function parseObjectProperty() { - var token, key, id, value; - - index = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } - } - - function parseObjectInitialiser() { - var properties = [], - property, name, key, map = {}, - toString = String; - - index = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - - return finishObjectExpression(properties); - } - - // 11.1.6 The Grouping Operator - - function parseGroupExpression() { - var expr; - - expect('('); - - expr = parseExpression(); - - expect(')'); - - return expr; - } - - - // 11.1 Primary Expressions - - var legalKeywords = { - 'if': 1 - }; - - function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index = lookahead.start; - - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = (token.value === 'true'); - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek$1(); - } else { - throwUnexpected(lex()); - } - - return expr; - } - - // 11.2 Left-Hand-Side Expressions - - function parseArguments() { - var args = []; - - expect('('); - - if (!match(')')) { - while (index < length) { - args.push(parseConditionalExpression()); - if (match(')')) { - break; - } - expect(','); - } - } - - expect(')'); - - return args; - } - - function parseNonComputedProperty() { - var token; - index = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); - } - - function parseNonComputedMember() { - expect('.'); - - return parseNonComputedProperty(); - } - - function parseComputedMember() { - var expr; - - expect('['); - - expr = parseExpression(); - - expect(']'); - - return expr; - } - - function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; - } - - // 11.3 Postfix Expressions - - function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if ((match('++') || match('--'))) { - throw new Error(DISABLED); - } - } - - return expr; - } - - // 11.4 Unary Operators - - function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; - } - - function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - } - - return prec; - } - - // 11.5 Multiplicative Operators - // 11.6 Additive Operators - // 11.7 Bitwise Shift Operators - // 11.8 Relational Operators - // 11.9 Equality Operators - // 11.10 Binary Bitwise Operators - // 11.11 Binary Logical Operators - - function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - - marker = lookahead; - left = parseUnaryExpression(); - - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) { - return left; - } - token.prec = prec; - lex(); - - markers = [marker, lookahead]; - right = parseUnaryExpression(); - - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - - // Reduce: make a binary expression from the three topmost entries. - while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; - } - - // 11.12 Conditional Operator - - function parseConditionalExpression() { - var expr, consequent, alternate; - - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; - } - - // 11.14 Comma Operator - - function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; - } - - function parse$3(code) { - source$1 = code; - index = 0; - length = source$1.length; - lookahead = null; - - peek$1(); - - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - return expr; - } - - var constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' - }; - - function functions(codegen) { - - function fncall(name, args, cast, type) { - var obj = codegen(args[0]); - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - return obj + '.' + name + (type < 0 ? '' : type === 0 ? - '()' : - '(' + args.slice(1).map(codegen).join(',') + ')'); - } - - function fn(name, cast, type) { - return function(args) { - return fncall(name, args, cast, type); - }; - } - - var DATE = 'new Date', - STRING = 'String', - REGEXP = 'RegExp'; - - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - - clamp: function(args) { - if (args.length < 3) error('Missing arguments to clamp function.'); - if (args.length > 3) error('Too many arguments to clamp function.'); - var a = args.map(codegen); - return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))'; - }, - - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - - // sequence functions - length: fn('length', null, -1), - join: fn('join', null), - indexof: fn('indexOf', null), - lastindexof: fn('lastIndexOf', null), - slice: fn('slice', null), - - reverse: function(args) { - return '('+codegen(args[0])+').slice().reverse()'; - }, - - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - replace: fn('replace', STRING), - trim: fn('trim', STRING, 0), - - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - - // Control Flow functions - if: function(args) { - if (args.length < 3) error('Missing arguments to if function.'); - if (args.length > 3) error('Too many arguments to if function.'); - var a = args.map(codegen); - return '('+a[0]+'?'+a[1]+':'+a[2]+')'; - } - }; - } - - function stripQuotes(s) { - var n = s && s.length - 1; - return n && ( - (s[0]==='"' && s[n]==='"') || - (s[0]==='\'' && s[n]==='\'') - ) ? s.slice(1, -1) : s; - } - - function codegen(opt) { - opt = opt || {}; - - var whitelist = opt.whitelist ? toSet(opt.whitelist) : {}, - blacklist = opt.blacklist ? toSet(opt.blacklist) : {}, - constants$1 = opt.constants || constants, - functions$1 = (opt.functions || functions)(visit), - globalvar = opt.globalvar, - fieldvar = opt.fieldvar, - globals = {}, - fields = {}, - memberDepth = 0; - - var outputGlobal = isFunction(globalvar) - ? globalvar - : function (id) { return globalvar + '["' + id + '"]'; }; - - function visit(ast) { - if (isString(ast)) return ast; - var generator = Generators[ast.type]; - if (generator == null) error('Unsupported type: ' + ast.type); - return generator(ast); - } - - var Generators = { - Literal: function(n) { - return n.raw; - }, - - Identifier: function(n) { - var id = n.name; - if (memberDepth > 0) { - return id; - } else if (hasOwnProperty(blacklist, id)) { - return error('Illegal identifier: ' + id); - } else if (hasOwnProperty(constants$1, id)) { - return constants$1[id]; - } else if (hasOwnProperty(whitelist, id)) { - return id; - } else { - globals[id] = 1; - return outputGlobal(id); - } - }, - - MemberExpression: function(n) { - var d = !n.computed; - var o = visit(n.object); - if (d) memberDepth += 1; - var p = visit(n.property); - if (o === fieldvar) { - // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - } - if (d) memberDepth -= 1; - return o + (d ? '.'+p : '['+p+']'); - }, - - CallExpression: function(n) { - if (n.callee.type !== 'Identifier') { - error('Illegal callee type: ' + n.callee.type); - } - var callee = n.callee.name; - var args = n.arguments; - var fn = hasOwnProperty(functions$1, callee) && functions$1[callee]; - if (!fn) error('Unrecognized function: ' + callee); - return isFunction(fn) - ? fn(args) - : fn + '(' + args.map(visit).join(',') + ')'; - }, - - ArrayExpression: function(n) { - return '[' + n.elements.map(visit).join(',') + ']'; - }, - - BinaryExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - UnaryExpression: function(n) { - return '(' + n.operator + visit(n.argument) + ')'; - }, - - ConditionalExpression: function(n) { - return '(' + visit(n.test) + - '?' + visit(n.consequent) + - ':' + visit(n.alternate) + - ')'; - }, - - LogicalExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - ObjectExpression: function(n) { - return '{' + n.properties.map(visit).join(',') + '}'; - }, - - Property: function(n) { - memberDepth += 1; - var k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - - function codegen(ast) { - var result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; - } - - codegen.functions = functions$1; - codegen.constants = constants$1; - - return codegen; - } - - function dataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) { - error('First argument to data functions must be a string literal.'); - } - - const data = args[0].value, - dataName = DataPrefix + data; - - if (!hasOwnProperty(dataName, params)) { - try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) { - // if data set does not exist, there's nothing to track - } - } - } - - function indataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to indata must be a string literal.'); - if (args[1].type !== Literal) error('Second argument to indata must be a string literal.'); - - const data = args[0].value, - field = args[1].value, - indexName = IndexPrefix + field; - - if (!hasOwnProperty(indexName, params)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - } - - function scaleVisitor(name, args, scope, params) { - if (args[0].type === Literal) { - // add scale dependency - addScaleDependency(scope, params, args[0].value); - } else { - // indirect scale lookup; add all scales as parameters - for (name in scope.scales) { - addScaleDependency(scope, params, name); - } - } - } - - function addScaleDependency(scope, params, name) { - const scaleName = ScalePrefix + name; - if (!hasOwnProperty(params, scaleName)) { - try { - params[scaleName] = scope.scaleRef(name); - } catch (err) { - // TODO: error handling? warning? - } - } - } - - function getScale(name, ctx) { - let s; - return isFunction(name) ? name - : isString(name) ? (s = ctx.scales[name]) && s.value - : undefined; - } - - function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = s => s && s.bandwidth ? s.bandwidth() : 0; - - // register AST visitors for internal scale functions - visitors._bandwidth = scaleVisitor; - visitors._range = scaleVisitor; - visitors._scale = scaleVisitor; - - // resolve scale reference directly to the signal hash argument - const ref = arg => '_[' + ( - arg.type === Literal - ? $(ScalePrefix + arg.value) - : $(ScalePrefix) + '+' + codegen(arg) - ) + ']'; - - // define and return internal scale function code generators - // these internal functions are called by mark encoders - return { - _bandwidth: args => `this.__bandwidth(${ref(args[0])})`, - _range: args => `${ref(args[0])}.range()`, - _scale: args => `${ref(args[0])}(${codegen(args[1])})` - }; - } - - function geoMethod(methodName, globalMethod) { - return function(projection, geojson, group) { - if (projection) { - // projection defined, use it - const p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else { - // projection undefined, use global method - return globalMethod(geojson); - } - }; - } - - const geoArea = geoMethod('area', d3Geo.geoArea); - const geoBounds = geoMethod('bounds', d3Geo.geoBounds); - const geoCentroid = geoMethod('centroid', d3Geo.geoCentroid); - - function inScope(item) { - let group = this.context.group, - value = false; - - if (group) while (item) { - if (item === group) { value = true; break; } - item = item.mark.group; - } - return value; - } - - function log$3(df, method, args) { - try { - df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args))); - } catch (err) { - df.warn(err); - } - return args[args.length-1]; - } - - function warn() { - return log$3(this.context.dataflow, 'warn', arguments); - } - - function info() { - return log$3(this.context.dataflow, 'info', arguments); - } - - function debug() { - return log$3(this.context.dataflow, 'debug', arguments); - } - - // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - function channel_luminance_value(channelValue) { - const val = channelValue / 255; - if (val <= 0.03928) { - return val / 12.92; - } - return Math.pow((val + 0.055) / 1.055, 2.4); - } - - function luminance(color) { - const c = d3Color.rgb(color), - r = channel_luminance_value(c.r), - g = channel_luminance_value(c.g), - b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; - } - - // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef - function contrast(color1, color2) { - const lum1 = luminance(color1), - lum2 = luminance(color2), - lumL = Math.max(lum1, lum2), - lumD = Math.min(lum1, lum2); - return (lumL + 0.05) / (lumD + 0.05); - } - - function merge$2() { - var args = [].slice.call(arguments); - args.unshift({}); - return extend.apply(null, args); - } - - function equal(a, b) { - return a === b || a !== a && b !== b ? true - : isArray(a) ? ( - isArray(b) && a.length === b.length ? equalArray(a, b) : false - ) - : isObject(a) && isObject(b) ? equalObject(a, b) - : false; - } - - function equalArray(a, b) { - for (let i=0, n=a.length; i equalObject(props, _); - } - - function modify(name, insert, remove, toggle, modify, values) { - let df = this.context.dataflow, - data = this.context.data[name], - input = data.input, - changes = data.changes, - stamp = df.stamp(), - predicate, key; - - if (df._trigger === false || !(input.value.length || insert || toggle)) { - // nothing to do! - return 0; - } - - if (!changes || changes.stamp < stamp) { - data.changes = (changes = df.changeset()); - changes.stamp = stamp; - df.runAfter(function() { - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - - if (remove) { - predicate = remove === true ? truthy - : (isArray(remove) || isTuple(remove)) ? remove - : removePredicate(remove); - changes.remove(predicate); - } - - if (insert) { - changes.insert(insert); - } - - if (toggle) { - predicate = removePredicate(toggle); - if (input.value.some(predicate)) { - changes.remove(predicate); - } else { - changes.insert(toggle); - } - } - - if (modify) { - for (key in values) { - changes.modify(modify, key, values[key]); - } - } - - return 1; - } - - function pinchDistance(event) { - const t = event.touches, - dx = t[0].clientX - t[1].clientX, - dy = t[0].clientY - t[1].clientY; - return Math.sqrt(dx * dx + dy * dy); - } - - function pinchAngle(event) { - const t = event.touches; - return Math.atan2( - t[0].clientY - t[1].clientY, - t[0].clientX - t[1].clientX - ); - } - - function bandspace(count, paddingInner, paddingOuter) { - return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0); - } - - function bandwidth(name, group) { - const s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; - } - - function copy$2(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; - } - - function domain(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.domain() : []; - } - - function invert(name, range, group) { - const s = getScale(name, (group || this).context); - return !s ? undefined - : isArray(range) ? (s.invertRange || s.invert)(range) - : (s.invert || s.invertExtent)(range); - } - - function range$1(name, group) { - const s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; - } - - function scale$3(name, value, group) { - const s = getScale(name, (group || this).context); - return s ? s(value) : undefined; - } - - function scaleGradient(scale, p0, p1, count, group) { - scale = getScale(scale, (group || this).context); - - const gradient = Gradient(p0, p1); - - let stops = scale.domain(), - min = stops[0], - max = peek(stops), - fraction = identity; - - if (!(max - min)) { - // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator - ? scale$2('sequential')().interpolator(scale.interpolator()) - : scale$2('linear')().interpolate(scale.interpolate()).range(scale.range()) - ).domain([min=0, max=1]); - } else { - fraction = scaleFraction(scale, min, max); - } - - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== peek(stops)) stops.push(max); - } - - stops.forEach(_ => gradient.stop(fraction(_), scale(_))); - - return gradient; - } - - function geoShape(projection, geojson, group) { - const p = getScale(projection, (group || this).context); - return function(context) { - return p ? p.path.context(context)(geojson) : ''; - }; - } - - function pathShape(path) { - let p = null; - return function(context) { - return context - ? pathRender(context, (p = p || pathParse(path))) - : path; - }; - } - - const datum = d => d.data; - - function treeNodes(name, context) { - const tree = data$1.call(context, name); - return tree.root && tree.root.lookup || {}; - } - - function treePath(name, source, target) { - const nodes = treeNodes(name, this), - s = nodes[source], - t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; - } - - function treeAncestors(name, node) { - const n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; - } - - const _window = () => (typeof window !== 'undefined' && window) || null; - - function screen() { - const w = _window(); - return w ? w.screen : {}; - } - - function windowSize() { - const w = _window(); - return w - ? [w.innerWidth, w.innerHeight] - : [undefined, undefined]; - } - - function containerSize() { - const view = this.context.dataflow, - el = view.container && view.container(); - return el - ? [el.clientWidth, el.clientHeight] - : [undefined, undefined]; - } - - const Intersect = 'intersect'; - const Union = 'union'; - const VlMulti = 'vlMulti'; - const Or = 'or'; - const And = 'and'; - - var TYPE_ENUM = 'E', - TYPE_RANGE_INC = 'R', - TYPE_RANGE_EXC = 'R-E', - TYPE_RANGE_LE = 'R-LE', - TYPE_RANGE_RE = 'R-RE', - UNIT_INDEX = 'index:unit'; - - // TODO: revisit date coercion? - function testPoint(datum, entry) { - var fields = entry.fields, - values = entry.values, - n = fields.length, - i = 0, dval, f; - - for (; i, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ - function selectionTest(name, datum, op) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, - intersect = op === Intersect, - n = entries.length, - i = 0, - entry, miss, count, unit, b; - - for (; i (obj[fields[j].field] = curr, obj), {})); - } - } - - // Then resolve fields across units as per the op. - op = op || Union; - Object.keys(resolved).forEach(function (field) { - resolved[field] = Object.keys(resolved[field]) - .map(unit => resolved[field][unit]) - .reduce((acc, curr) => acc === undefined ? curr : ops[types[field] + '_' + op](acc, curr)); - }); - - entries = Object.keys(multiRes); - if (isMulti && entries.length) { - resolved[VlMulti] = op === Union - ? {[Or]: entries.reduce((acc, k) => (acc.push.apply(acc, multiRes[k]), acc), [])} - : {[And]: entries.map(k => ({[Or]: multiRes[k]}))}; - } - - return resolved; - } - - var ops = { - E_union: function(base, value) { - if (!base.length) return value; - - var i = 0, n = value.length; - for (; i= 0; }); - }, - - R_union: function(base, value) { - var lo = toNumber(value[0]), hi = toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; - }, - - R_intersect: function(base, value) { - var lo = toNumber(value[0]), hi = toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (hi < base[0] || base[1] < lo) { - return []; - } else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - return base; - } - }; - - const DataPrefix$1 = ':', - IndexPrefix$1 = '@'; - - function selectionVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to selection functions must be a string literal.'); - - const data = args[0].value, - op = args.length >= 2 && peek(args).value, - field = 'unit', - indexName = IndexPrefix$1 + field, - dataName = DataPrefix$1 + data; - - // eslint-disable-next-line no-prototype-builtins - if (op === Intersect && !hasOwnProperty(params, indexName)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - - // eslint-disable-next-line no-prototype-builtins - if (!hasOwnProperty(params, dataName)) { - params[dataName] = scope.getData(data).tuplesRef(); - } - } - - function intersect$2(b, opt, group) { - if (!b) return []; - - const [u, v] = b, - box = new Bounds().set(u[0], u[1], v[0], v[1]), - scene = group || this.context.dataflow.scenegraph().root; - - return intersect(scene, box, filter$1(opt)); - } - - function filter$1(opt) { - let p = null; - - if (opt) { - const types = array(opt.marktype), - names = array(opt.markname); - p = _ => (!types.length || types.some(t => _.marktype === t)) - && (!names.length || names.some(s => _.name === s)); - } - - return p; - } - - // Expression function context object - const functionContext = { - random: function() { return exports.random(); }, // override default - cumulativeNormal, - cumulativeLogNormal, - cumulativeUniform, - densityNormal, - densityLogNormal, - densityUniform, - quantileNormal, - quantileLogNormal, - quantileUniform, - sampleNormal, - sampleLogNormal, - sampleUniform, - isArray, - isBoolean, - isDate, - isDefined: function(_) { return _ !== undefined; }, - isNumber, - isObject, - isRegExp, - isString, - isTuple, - isValid: function(_) { return _ != null && _ === _; }, - toBoolean, - toDate, - toNumber, - toString, - flush, - lerp, - merge: merge$2, - pad, - peek, - span, - inrange, - truncate, - rgb: d3Color.rgb, - lab: d3Color.lab, - hcl: d3Color.hcl, - hsl: d3Color.hsl, - luminance, - contrast, - sequence, - format: format$2, - utcFormat, - utcParse, - utcOffset, - utcSequence, - timeFormat, - timeParse, - timeOffset, - timeSequence, - timeUnitSpecifier, - monthFormat, - monthAbbrevFormat, - dayFormat, - dayAbbrevFormat, - quarter, - utcquarter, - week, - utcweek, - dayofyear, - utcdayofyear, - warn, - info, - debug, - extent, - inScope, - intersect: intersect$2, - clampRange, - pinchDistance, - pinchAngle, - screen, - containerSize, - windowSize, - bandspace, - setdata, - pathShape, - panLinear, - panLog, - panPow, - panSymlog, - zoomLinear, - zoomLog, - zoomPow, - zoomSymlog, - encode: encode$1, - modify - }; - - const eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'], // event functions - eventPrefix = 'event.vega.', // event function prefix - thisPrefix = 'this.', // function context prefix - astVisitors = {}; // AST visitors for dependency analysis - - // Build expression function registry - function buildFunctions(codegen) { - const fn = functions(codegen); - eventFunctions.forEach(name => fn[name] = eventPrefix + name); - for (let name in functionContext) { fn[name] = thisPrefix + name; } - extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; - } - - // Register an expression function - function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) { - return functionContext[name]; - } - - // register with the functionContext - functionContext[name] = fn; - - // if there is an astVisitor register that, too - if (visitor) astVisitors[name] = visitor; - - // if the code generator has already been initialized, - // we need to also register the function with it - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; - } - - // register expression functions with ast visitors - expressionFunction('bandwidth', bandwidth, scaleVisitor); - expressionFunction('copy', copy$2, scaleVisitor); - expressionFunction('domain', domain, scaleVisitor); - expressionFunction('range', range$1, scaleVisitor); - expressionFunction('invert', invert, scaleVisitor); - expressionFunction('scale', scale$3, scaleVisitor); - expressionFunction('gradient', scaleGradient, scaleVisitor); - expressionFunction('geoArea', geoArea, scaleVisitor); - expressionFunction('geoBounds', geoBounds, scaleVisitor); - expressionFunction('geoCentroid', geoCentroid, scaleVisitor); - expressionFunction('geoShape', geoShape, scaleVisitor); - expressionFunction('indata', indata, indataVisitor); - expressionFunction('data', data$1, dataVisitor); - expressionFunction('treePath', treePath, dataVisitor); - expressionFunction('treeAncestors', treeAncestors, dataVisitor); - - // register Vega-Lite selection functions - expressionFunction('vlSelectionTest', selectionTest, selectionVisitor); - expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor); - - // Export code generator and parameters - const codegenParams = { - blacklist: ['_'], - whitelist: ['datum', 'event', 'item'], - fieldvar: 'datum', - globalvar: id => '_[' + $(SignalPrefix + id) + ']', - functions: buildFunctions, - constants: constants, - visitors: astVisitors - }; - - var codeGenerator = codegen(codegenParams); - - function parseExpression$1(expr, scope) { - var params = {}, ast, gen; - - // parse the expression to an abstract syntax tree (ast) - try { - expr = isString(expr) ? expr : ($(expr) + ''); - ast = parse$3(expr); - } catch (err) { - error('Expression parse error: ' + expr); - } - - // analyze ast function calls for dependencies - ast.visit(node => { - if (node.type !== CallExpression) return; - var name = node.callee.name, - visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); - }); - - // perform code generation - gen = codeGenerator(ast); - - // collect signal dependencies - gen.globals.forEach(name => { - var signalName = SignalPrefix + name; - if (!hasOwnProperty(params, signalName) && scope.getSignal(name)) { - params[signalName] = scope.signalRef(name); - } - }); - - // return generated expression code and dependencies - return { - $expr: extend({code: gen.code}, scope.options.ast ? {ast} : null), - $fields: gen.fields, - $params: params - }; - } - - /** - * Parse a serialized dataflow specification. - */ - function parse$4(spec) { - const ctx = this, - operators = spec.operators || []; - - // parse background - if (spec.background) { - ctx.background = spec.background; - } - - // parse event configuration - if (spec.eventConfig) { - ctx.eventConfig = spec.eventConfig; - } - - // parse locale configuration - if (spec.locale) { - ctx.locale = spec.locale; - } - - // parse operators - operators.forEach(entry => ctx.parseOperator(entry)); - - // parse operator parameters - operators.forEach(entry => ctx.parseOperatorParameters(entry)); - - // parse streams - (spec.streams || []).forEach(entry => ctx.parseStream(entry)); - - // parse updates - (spec.updates || []).forEach(entry => ctx.parseUpdate(entry)); - - return ctx.resolve(); - } - - const Skip = toSet(['rule']), - Swap = toSet(['group', 'image', 'rect']); - - function adjustSpatial(encode, marktype) { - let code = ''; - - if (Skip[marktype]) return code; - - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) { - code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - } - code += 'o.width=o.x2-o.x;'; - } else { - code += 'o.x=o.x2-(o.width||0);'; - } - } - - if (encode.xc) { - code += 'o.x=o.xc-(o.width||0)/2;'; - } - - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) { - code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - } - code += 'o.height=o.y2-o.y;'; - } else { - code += 'o.y=o.y2-(o.height||0);'; - } - } - - if (encode.yc) { - code += 'o.y=o.yc-(o.height||0)/2;'; - } - - return code; - } - - function canonicalType(type) { - return (type + '').toLowerCase(); - } - - function isOperator(type) { - return canonicalType(type) === 'operator'; - } - - function isCollect(type) { - return canonicalType(type) === 'collect'; - } - - function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (code[code.length-1] !== ';') { - code = 'return(' + code + ');'; - } - var fn = Function.apply(null, args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; - } - - // generate code for comparing a single field - function _compare(u, v, lt, gt) { - return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt} - : (u > v || v == null) && u != null ? ${gt} - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} - : v !== v && u === u ? ${gt} : `; - } - - var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ - operator: (ctx, expr) => expression(ctx, ['_'], expr.code), - - /** - * Parse an expression provided as an operator parameter value. - */ - parameter: (ctx, expr) => expression(ctx, ['datum', '_'], expr.code), - - /** - * Parse an expression applied to an event stream. - */ - event: (ctx, expr) => expression(ctx, ['event'], expr.code), - - /** - * Parse an expression used to handle an event-driven operator update. - */ - handler: (ctx, expr) => { - const code = `var datum=event.item&&event.item.datum;return ${expr.code};`; - return expression(ctx, ['_', 'event'], code); - }, - - /** - * Parse an expression that performs visual encoding. - */ - encode: (ctx, encode) => { - const {marktype, channels} = encode; - - let code = 'var o=item,datum=o.datum,m=0,$;'; - for (const name in channels) { - const o ='o[' + $(name) + ']'; - code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; - } - code += adjustSpatial(channels, marktype); - code += 'return m;'; - - return expression(ctx, ['item', '_'], code); - }, - - /** - * Optimized code generators for access and comparison. - */ - codegen: { - get(path) { - const ref = `[${path.map($).join('][')}]`; - const get = Function('_', `return _${ref};`); - get.path = ref; - return get; - }, - comparator(fields, orders) { - let t; - const map = (f, i) => { - const o = orders[i]; - let u, v; - if (f.path) { - u = `a${f.path}`; - v = `b${f.path}`; - } else { - (t = t || {})['f'+i] = f; - u = `this.f${i}(a)`; - v = `this.f${i}(b)`; - } - return _compare(u, v, -o, o); - }; - - const fn = Function('a', 'b', 'var u, v; return ' - + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } - }; - - /** - * Parse a dataflow operator. - */ - function parseOperator(spec) { - const ctx = this; - if (isOperator(spec.type) || !spec.type) { - ctx.operator( - spec, - spec.update ? ctx.operatorExpression(spec.update) : null - ); - } else { - ctx.transform(spec, spec.type); - } - } - - /** - * Parse and assign operator parameters. - */ - function parseOperatorParameters(spec) { - const ctx = this; - if (spec.params) { - const op = ctx.get(spec.id); - if (!op) error('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters( - ctx.parseParameters(spec.params), - spec.react, - spec.initonly - )); - } - } - - /** - * Parse a set of operator parameters. - */ - function parseParameters(spec, params) { - params = params || {}; - const ctx = this; - - for (const key in spec) { - const value = spec[key]; - params[key] = isArray(value) - ? value.map(v => parseParameter(v, ctx, params)) - : parseParameter(value, ctx, params); - } - - return params; - } - - /** - * Parse a single parameter. - */ - function parseParameter(spec, ctx, params) { - if (!spec || !isObject(spec)) return spec; - - for (let i=0, n=PARSERS.length, p; i (_ && _.$tupleid) ? tupleid : _); - return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen)); - } - - /** - * Resolve an encode operator reference. - */ - function getEncode(_, ctx) { - const spec = _.$encode, - encode = {}; - - for (const name in spec) { - const enc = spec[name]; - encode[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - return encode; - } - - /** - * Resolve a context reference. - */ - function getContext(_, ctx) { - return ctx; - } - - /** - * Resolve a recursive subflow specification. - */ - function getSubflow(_, ctx) { - const spec = _.$subflow; - return function(dataflow, key, parent) { - const subctx = ctx.fork().parse(spec), - op = subctx.get(spec.operators[0].id), - p = subctx.signals.parent; - if (p) p.set(parent); - op.detachSubflow = () => ctx.detach(subctx); - return op; - }; - } - - /** - * Resolve a tuple id reference. - */ - function getTupleId() { - return tupleid; - } - - /** - * Parse an event stream specification. - */ - function parseStream(spec) { - var ctx = this, - filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, - stream = spec.stream != null ? ctx.get(spec.stream) : undefined, - args; - - if (spec.source) { - stream = ctx.events(spec.source, spec.type, filter); - } - else if (spec.merge) { - args = spec.merge.map(_ => ctx.get(_)); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - - if (spec.between) { - args = spec.between.map(_ => ctx.get(_)); - stream = stream.between(args[0], args[1]); - } - - if (spec.filter) { - stream = stream.filter(filter); - } - - if (spec.throttle != null) { - stream = stream.throttle(+spec.throttle); - } - - if (spec.debounce != null) { - stream = stream.debounce(+spec.debounce); - } - - if (stream == null) { - error('Invalid stream definition: ' + JSON.stringify(spec)); - } - - if (spec.consume) stream.consume(true); - - ctx.stream(spec, stream); - } - - /** - * Parse an event-driven operator update. - */ - function parseUpdate(spec) { - var ctx = this, - srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid, - source = ctx.get(srcid), - target = null, - update = spec.update, - params = undefined; - - if (!source) error('Source not defined: ' + spec.source); - - target = spec.target && spec.target.$expr - ? ctx.eventExpression(spec.target.$expr) - : ctx.get(spec.target); - - if (update && update.$expr) { - if (update.$params) { - params = ctx.parseParameters(update.$params); - } - update = ctx.handlerExpression(update.$expr); - } - - ctx.update(spec, source, target, update, params); - } - - var SKIP$3 = {skip: true}; - - function getState(options) { - var ctx = this, - state = {}; - - if (options.signals) { - var signals = (state.signals = {}); - Object.keys(ctx.signals).forEach(key => { - var op = ctx.signals[key]; - if (options.signals(key, op)) { - signals[key] = op.value; - } - }); - } - - if (options.data) { - var data = (state.data = {}); - Object.keys(ctx.data).forEach(key => { - var dataset = ctx.data[key]; - if (options.data(key, dataset)) { - data[key] = dataset.input.value; - } - }); - } - - if (ctx.subcontext && options.recurse !== false) { - state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options)); - } - - return state; - } - - function setState(state) { - var ctx = this, - df = ctx.dataflow, - data = state.data, - signals = state.signals; - - Object.keys(signals || {}).forEach(key => { - df.update(ctx.signals[key], signals[key], SKIP$3); - }); - - Object.keys(data || {}).forEach(key => { - df.pulse( - ctx.data[key].input, - df.changeset().remove(truthy).insert(data[key]) - ); - }); - - (state.subcontext || []).forEach((substate, i) => { - var subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); - } - - /** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ - function context$2(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); - } - - function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, - this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } - } - - function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } - } - - Context.prototype = Subcontext.prototype = { - fork() { - const ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; - }, - detach(ctx) { - this.subcontext = this.subcontext.filter(c => c !== ctx); - - // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - const keys = Object.keys(ctx.nodes); - for (const key of keys) ctx.nodes[key]._targets = null; - for (const key of keys) ctx.nodes[key].detach(); - ctx.nodes = null; - }, - get(id) { - return this.nodes[id]; - }, - set(id, node) { - return this.nodes[id] = node; - }, - add(spec, op) { - const ctx = this, - df = ctx.dataflow, - data = spec.value; - - ctx.set(spec.id, op); - - if (isCollect(spec.type) && data) { - if (data.$ingest) { - df.ingest(op, data.$ingest, data.$format); - } else if (data.$request) { - df.preload(op, data.$request, data.$format); - } else { - df.pulse(op, df.changeset().insert(data)); - } - } - - if (spec.root) { - ctx.root = op; - } - - if (spec.parent) { - var p = ctx.get(spec.parent.$ref); - if (p) { - df.connect(p, [op]); - op.targets().add(p); - } else { - (ctx.unresolved = ctx.unresolved || []).push(() => { - p = ctx.get(spec.parent.$ref); - df.connect(p, [op]); - op.targets().add(p); - }); - } - } - - if (spec.signal) { - ctx.signals[spec.signal] = op; - } - - if (spec.scale) { - ctx.scales[spec.scale] = op; - } - - if (spec.data) { - for (const name in spec.data) { - const data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach(role => data[role] = op); - } - } - }, - resolve() { - (this.unresolved || []).forEach(fn => fn()); - delete this.unresolved; - return this; - }, - operator(spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); - }, - transform(spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); - }, - stream(spec, stream) { - this.set(spec.id, stream); - }, - update(spec, stream, target, update, params) { - this.dataflow.on(stream, target, update, params, spec.options); - }, - - // expression parsing - operatorExpression(expr) { - return this.expr.operator(this, expr); - }, - parameterExpression(expr) { - return this.expr.parameter(this, expr); - }, - eventExpression(expr) { - return this.expr.event(this, expr); - }, - handlerExpression(expr) { - return this.expr.handler(this, expr); - }, - encodeExpression(encode) { - return this.expr.encode(this, encode); - }, - - // parse methods - parse: parse$4, - parseOperator, - parseOperatorParameters, - parseParameters, - parseStream, - parseUpdate, - - // state methods - getState, - setState - }; - - function runtime(view, spec, expr) { - return context$2(view, transforms, functionContext, expr).parse(spec); - } - - function scale$4(name) { - var scales = this._runtime.scales; - if (!hasOwnProperty(scales, name)) { - error('Unrecognized scale or projection: ' + name); - } - return scales[name].value; - } - - var Width = 'width', - Height = 'height', - Padding$1 = 'padding', - Skip$1 = {skip: true}; - - function viewWidth(view, width) { - var a = view.autosize(), - p = view.padding(); - return width - (a && a.contains === Padding$1 ? p.left + p.right : 0); - } - - function viewHeight(view, height) { - var a = view.autosize(), - p = view.padding(); - return height - (a && a.contains === Padding$1 ? p.top + p.bottom : 0); - } - - function initializeResize(view) { - var s = view._signals, - w = s[Width], - h = s[Height], - p = s[Padding$1]; - - function resetSize() { - view._autosize = view._resize = 1; - } - - // respond to width signal - view._resizeWidth = view.add(null, - function(_) { - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, - {size: w} - ); - - // respond to height signal - view._resizeHeight = view.add(null, - function(_) { - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, - {size: h} - ); - - // respond to padding signal - var resizePadding = view.add(null, resetSize, {pad: p}); - - // set rank to run immediately after source signal - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; - } - - function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter(function(view) { - var rerun = 0; - - // reset autosize flag - view._autosize = 0; - - // width value changed: update signal, skip resize op - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip$1); // set width, skip update calc - view._resizeWidth.skip(true); // skip width resize handler - } - - // height value changed: update signal, skip resize op - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip$1); // set height, skip update calc - view._resizeHeight.skip(true); // skip height resize handler - } - - // view width changed: update view property, set resize flag - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } - - // view height changed: update view property, set resize flag - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } - - // origin changed: update view property, set resize flag - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } - - // run dataflow on width/height signal change - if (rerun) view.run('enter'); - if (auto) view.runAfter(v => v.resize()); - }, false, 1); - } - - /** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ - function getState$1(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); - } - - function dataTest(name, data) { - return data.modified - && isArray(data.input.value) - && name.indexOf('_:vega:_'); - } - - function signalTest(name, op) { - return !(name === 'parent' || op instanceof transforms.proxy); - } - - /** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ - function setState$1(state) { - this.runAsync(null, - v => { v._trigger = false; v._runtime.setState(state); }, - v => { v._trigger = true; } - ); - return this; - } - - function timer(callback, delay) { - function tick(elapsed) { - callback({timestamp: Date.now(), elapsed: elapsed}); - } - this._timers.push(d3Timer.interval(tick, delay)); - } - - function defaultTooltip$1(handler, event, item, value) { - var el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); - } - - function formatTooltip(value) { - return value == null ? '' - : isArray(value) ? formatArray(value) - : isObject(value) && !isDate(value) ? formatObject(value) - : value + ''; - } - - function formatObject(obj) { - return Object.keys(obj).map(function(key) { - var v = obj[key]; - return key + ': ' + (isArray(v) ? formatArray(v) : formatValue$1(v)); - }).join('\n'); - } - - function formatArray(value) { - return '[' + value.map(formatValue$1).join(', ') + ']'; - } - - function formatValue$1(value) { - return isArray(value) ? '[\u2026]' - : isObject(value) && !isDate(value) ? '{\u2026}' - : value; - } - - /** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ - function View(spec, options) { - const view = this; - options = options || {}; - - Dataflow.call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - if (options.locale || spec.locale) { - const loc = extend({}, spec.locale, options.locale); - view.locale(locale(loc.number, loc.time)); - } - - view._el = null; - view._elBind = null; - view._renderType = options.renderer || RenderType.Canvas; - view._scenegraph = new Scenegraph(); - const root = view._scenegraph.root; - - // initialize renderer, handler and event management - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip$1, - view._redraw = true; - view._handler = new CanvasHandler().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; - - // initialize event configuration - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); - - // initialize dataflow graph - const ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map(_ => ({ - state: null, - param: extend({}, _) - })); - - // initialize scenegraph - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse( - ctx.data.root.input, - view.changeset().insert(root.items) - ); - - // initialize view size - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [0, 0]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); - - // initialize background color - background$1(view); - - // initialize cursor - cursor(view); - - // initialize view description - view.description(spec.description); - - // initialize hover proessing, if requested - if (options.hover) view.hover(); - - // initialize DOM container(s) and renderer - if (options.container) view.initialize(options.container, options.bind); - } - - var prototype$1s = inherits(View, Dataflow); - - // -- DATAFLOW / RENDERING ---- - - prototype$1s.evaluate = async function(encode, prerun, postrun) { - // evaluate dataflow and prerun - await Dataflow.prototype.evaluate.call(this, encode, prerun); - - // render as needed - if (this._redraw || this._resize) { - try { - if (this._renderer) { - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - await this._renderer.renderAsync(this._scenegraph.root); - } - this._redraw = false; - } catch (e) { - this.error(e); - } - } - - // evaluate postrun - if (postrun) asyncCallback(this, postrun); - - return this; - }; - - prototype$1s.dirty = function(item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); - }; - - // -- GET / SET ---- - - prototype$1s.description = function(text) { - if (arguments.length) { - const desc = text != null ? (text + '') : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - return this._desc; - }; - - prototype$1s.container = function() { - return this._el; - }; - - prototype$1s.scenegraph = function() { - return this._scenegraph; - }; - - prototype$1s.origin = function() { - return this._origin.slice(); - }; - - function lookupSignal(view, name) { - return hasOwnProperty(view._signals, name) - ? view._signals[name] - : error('Unrecognized signal name: ' + $(name)); - } - - prototype$1s.signal = function(name, value, options) { - var op = lookupSignal(this, name); - return arguments.length === 1 - ? op.value - : this.update(op, value, options); - }; - - prototype$1s.width = function(_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); - }; - - prototype$1s.height = function(_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); - }; - - prototype$1s.padding = function(_) { - return arguments.length - ? this.signal('padding', padding(_)) - : padding(this.signal('padding')); - }; - - prototype$1s.autosize = function(_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); - }; - - prototype$1s.background = function(_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); - }; - - prototype$1s.renderer = function(type) { - if (!arguments.length) return this._renderType; - if (!renderModule(type)) error('Unrecognized renderer type: ' + type); - if (type !== this._renderType) { - this._renderType = type; - this._resetRenderer(); - } - return this; - }; - - prototype$1s.tooltip = function(handler) { - if (!arguments.length) return this._tooltip; - if (handler !== this._tooltip) { - this._tooltip = handler; - this._resetRenderer(); - } - return this; - }; - - prototype$1s.loader = function(loader) { - if (!arguments.length) return this._loader; - if (loader !== this._loader) { - Dataflow.prototype.loader.call(this, loader); - this._resetRenderer(); - } - return this; - }; - - prototype$1s.resize = function() { - // set flag to perform autosize - this._autosize = 1; - // touch autosize signal to ensure top-level ViewLayout runs - return this.touch(lookupSignal(this, 'autosize')); - }; - - prototype$1s._resetRenderer = function() { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } - }; - - // -- SIZING ---- - prototype$1s._resizeView = resizeView; - - // -- EVENT HANDLING ---- - - prototype$1s.addEventListener = function(type, handler, options) { - var callback = handler; - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - this._handler.on(type, callback); - return this; - }; - - prototype$1s.removeEventListener = function(type, handler) { - var handlers = this._handler.handlers(type), - i = handlers.length, h, t; - - // search registered handlers, remove if match found - while (--i >= 0) { - t = handlers[i].type; - h = handlers[i].handler; - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - break; - } - } - return this; - }; - - prototype$1s.addResizeListener = function(handler) { - var l = this._resizeListeners; - if (l.indexOf(handler) < 0) { - // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - } - return this; - }; - - prototype$1s.removeResizeListener = function(handler) { - var l = this._resizeListeners, - i = l.indexOf(handler); - if (i >= 0) { - l.splice(i, 1); - } - return this; - }; - - function findOperatorHandler(op, handler) { - const h = (op._targets || []) - .filter(op => op._update && op._update.handler === handler); - return h.length ? h[0] : null; - } - - function addOperatorListener(view, name, op, handler) { - var h = findOperatorHandler(op, handler); - if (!h) { - h = trap(view, () => handler(name, op.value)); - h.handler = handler; - view.on(op, null, h); - } - return view; - } - - function removeOperatorListener(view, op, handler) { - var h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; - } - - prototype$1s.addSignalListener = function(name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); - }; - - prototype$1s.removeSignalListener = function(name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); - }; - - prototype$1s.addDataListener = function(name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); - }; - - prototype$1s.removeDataListener = function(name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); - }; - - prototype$1s.globalCursor = function(_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - const prev = setCursor(this, null); // clear previous cursor - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - return this; - } else { - return this._globalCursor; - } - }; - - prototype$1s.preventDefault = function(_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else { - return this._preventDefault; - } - }; - - prototype$1s.timer = timer; - prototype$1s.events = events$1; - prototype$1s.finalize = finalize; - prototype$1s.hover = hover; - - // -- DATA ---- - prototype$1s.data = data; - prototype$1s.change = change; - prototype$1s.insert = insert; - prototype$1s.remove = remove; - - // -- SCALES -- - prototype$1s.scale = scale$4; - - // -- INITIALIZATION ---- - prototype$1s.initialize = initialize$1; - - // -- HEADLESS RENDERING ---- - prototype$1s.toImageURL = renderToImageURL; - prototype$1s.toCanvas = renderToCanvas; - prototype$1s.toSVG = renderToSVG; - - // -- SAVE / RESTORE STATE ---- - prototype$1s.getState = getState$1; - prototype$1s.setState = setState$1; - - function parseAutosize(spec) { - return isObject(spec) ? spec : {type: spec || 'pad'}; - } - - const number$6 = _ => +_ || 0; - - const paddingObject$1 = _ => ({top: _, bottom: _, left: _, right: _}); - - function parsePadding(spec) { - return !isObject(spec) ? paddingObject$1(number$6(spec)) - : spec.signal ? spec - : { - top: number$6(spec.top), - bottom: number$6(spec.bottom), - left: number$6(spec.left), - right: number$6(spec.right) - }; - } - - const encoder = _ => isObject(_) && !isArray(_) - ? extend({}, _) - : {value: _}; - - function addEncode(object, name, value, set) { - if (value != null) { - // Always assign signal to update, even if the signal is from the enter block - if (isObject(value) && !isArray(value)) { - object.update[name] = value; - } else { - object[set || 'enter'][name] = {value: value}; - } - return 1; - } else { - return 0; - } - } - - function addEncoders(object, enter, update) { - for (const name in enter) { - addEncode(object, name, enter[name]); - } - for (const name in update) { - addEncode(object, name, update[name], 'update'); - } - } - - function extendEncode(encode, extra, skip) { - for (const name in extra) { - if (skip && hasOwnProperty(skip, name)) continue; - encode[name] = extend(encode[name] || {}, extra[name]); - } - return encode; - } - - function has(key, encode) { - return encode && ( - (encode.enter && encode.enter[key]) || - (encode.update && encode.update[key]) - ); - } - - var MarkRole = 'mark'; - var FrameRole$1 = 'frame'; - var ScopeRole$1 = 'scope'; - - var AxisRole$1 = 'axis'; - var AxisDomainRole = 'axis-domain'; - var AxisGridRole = 'axis-grid'; - var AxisLabelRole = 'axis-label'; - var AxisTickRole = 'axis-tick'; - var AxisTitleRole = 'axis-title'; - - var LegendRole$1 = 'legend'; - var LegendBandRole = 'legend-band'; - var LegendEntryRole = 'legend-entry'; - var LegendGradientRole = 'legend-gradient'; - var LegendLabelRole = 'legend-label'; - var LegendSymbolRole = 'legend-symbol'; - var LegendTitleRole = 'legend-title'; - - var TitleRole$1 = 'title'; - var TitleTextRole = 'title-text'; - var TitleSubtitleRole = 'title-subtitle'; - - function applyDefaults(encode, type, role, style, config) { - const defaults = {}, enter = {}; - let update, key, skip, props; - - // if text mark, apply global lineBreak settings (#2370) - key = 'lineBreak'; - if (type === 'text' && config[key] != null && !has(key, encode)) { - applyDefault(defaults, key, config[key]); - } - - // ignore legend and axis roles - if (role == 'legend' || String(role).startsWith('axis')) { - role = null; - } - - // resolve mark config - props = role === FrameRole$1 ? config.group - : (role === MarkRole) ? extend({}, config.mark, config[type]) - : null; - - for (key in props) { - // do not apply defaults if relevant fields are defined - skip = has(key, encode) - || (key === 'fill' || key === 'stroke') - && (has('fill', encode) || has('stroke', encode)); - - if (!skip) applyDefault(defaults, key, props[key]); - } - - // resolve styles, apply with increasing precedence - array(style).forEach(name => { - const props = config.style && config.style[name]; - for (const key in props) { - if (!has(key, encode)) { - applyDefault(defaults, key, props[key]); - } - } - }); - - encode = extend({}, encode); // defensive copy - for (key in defaults) { - props = defaults[key]; - if (props.signal) { - (update = update || {})[key] = props; - } else { - enter[key] = props; - } - } - - encode.enter = extend(enter, encode.enter); - if (update) encode.update = extend(update, encode.update); - - return encode; - } - - function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal - ? {signal: value.signal} - : {value: value}; - } - - const scaleRef = scale => isString(scale) ? $(scale) - : scale.signal ? `(${scale.signal})` - : field$1(scale); - - function entry(enc) { - if (enc.gradient != null) { - return gradient$1(enc); - } - - let value = enc.signal ? `(${enc.signal})` - : enc.color ? color$1(enc.color) - : enc.field != null ? field$1(enc.field) - : enc.value !== undefined ? $(enc.value) - : undefined; - - if (enc.scale != null) { - value = scale$5(enc, value); - } - - if (value === undefined) { - value = null; - } - - if (enc.exponent != null) { - value = `pow(${value},${property(enc.exponent)})`; - } - - if (enc.mult != null) { - value += `*${property(enc.mult)}`; - } - - if (enc.offset != null) { - value += `+${property(enc.offset)}`; - } - - if (enc.round) { - value = `round(${value})`; - } - - return value; - } - - const _color = (type, x, y, z) => - `(${type}(${[x, y, z].map(entry).join(',')})+'')`; - - function color$1(enc) { - return (enc.c) ? _color('hcl', enc.h, enc.c, enc.l) - : (enc.h || enc.s) ? _color('hsl', enc.h, enc.s, enc.l) - : (enc.l || enc.a) ? _color('lab', enc.l, enc.a, enc.b) - : (enc.r || enc.g || enc.b) ? _color('rgb', enc.r, enc.g, enc.b) - : null; - } - - function gradient$1(enc) { - // map undefined to null; expression lang does not allow undefined - const args = [enc.start, enc.stop, enc.count] - .map(_ => _ == null ? null : $(_)); - - // trim null inputs from the end - while (args.length && peek(args) == null) args.pop(); - - args.unshift(scaleRef(enc.gradient)); - return `gradient(${args.join(',')})`; - } - - function property(property) { - return isObject(property) ? '(' + entry(property) + ')' : property; - } - - function field$1(ref) { - return resolveField(isObject(ref) ? ref : {datum: ref}); - } - - function resolveField(ref) { - let object, level, field; - - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - - while (level-- > 0) { - object += '.mark.group'; - } - - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else { - field = ref.group; - } - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else { - error('Invalid field reference: ' + $(ref)); - } - - if (!ref.signal) { - field = isString(field) - ? splitAccessPath(field).map($).join('][') - : resolveField(field); - } - - return object + '[' + field + ']'; - } - - function scale$5(enc, value) { - const scale = scaleRef(enc.scale); - - if (enc.range != null) { - // pull value from scale range - value = `lerp(_range(${scale}), ${+enc.range})`; - } else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = `_scale(${scale}, ${value})`; - - if (enc.band) { - value = (value ? value + '+' : '') - + `_bandwidth(${scale})` - + (+enc.band === 1 ? '' : '*' + property(enc.band)); - - if (enc.extra) { - // include logic to handle extraneous elements - value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`; - } - } - - if (value == null) value = '0'; - } - - return value; - } - - function rule$1(enc) { - let code = ''; - - enc.forEach(rule => { - const value = entry(rule); - code += rule.test ? `(${rule.test})?${value}:` : value; - }); - - // if no else clause, terminate with null (#1366) - if (peek(code) === ':') { - code += 'null'; - } - - return code; - } - - function parseEncode(encode, type, role, style, scope, params) { - const enc = {}; - params = params || {}; - params.encoders = {$encode: enc}; - - encode = applyDefaults(encode, type, role, style, scope.config); - for (const key in encode) { - enc[key] = parseBlock(encode[key], type, params, scope); - } - - return params; - } - - function parseBlock(block, marktype, params, scope) { - const channels = {}, - fields = {}; - - for (const name in block) { - if (block[name] != null) { // skip any null entries - channels[name] = parse$5(expr(block[name]), scope, params, fields); - } - } - - return { - $expr: {marktype, channels}, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; - } - - function expr(enc) { - return isArray(enc) ? rule$1(enc) : entry(enc); - } - - function parse$5(code, scope, params, fields) { - const expr = parseExpression$1(code, scope); - expr.$fields.forEach(name => fields[name] = 1); - extend(params, expr.$params); - return expr.$expr; - } - - var OUTER = 'outer', - OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind']; - - function outerError(prefix, name) { - error(prefix + ' for "outer" push: ' + $(name)); - } - - function parseSignal(signal, scope) { - var name = signal.name; - - if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); - // signal push must not use properties reserved for standard definition - OUTER_INVALID.forEach(function(prop) { - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); - } else { - // define a new signal in the current scope - var op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); - } - } - - function Entry(type, value, params, parent) { - this.id = -1; - this.type = type; - this.value = value; - this.params = params; - if (parent) this.parent = parent; - } - - function entry$1(type, value, params, parent) { - return new Entry(type, value, params, parent); - } - - function operator(value, params) { - return entry$1('operator', value, params); - } - - // ----- - - function ref(op) { - var ref = {$ref: op.id}; - // if operator not yet registered, cache ref to resolve later - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; - } - - function fieldRef(field, name) { - return name ? {$field: field, $name: name} : {$field: field}; - } - - var keyFieldRef = fieldRef('key'); - - function compareRef(fields, orders) { - return {$compare: fields, $order: orders}; - } - - function keyRef(fields, flat) { - var ref = {$key: fields}; - if (flat) ref.$flat = true; - return ref; - } - - // ----- - - var Ascending = 'ascending'; - - var Descending = 'descending'; - - function sortKey(sort) { - return !isObject(sort) ? '' - : (sort.order === Descending ? '-' : '+') - + aggrField(sort.op, sort.field); - } - - function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') - + (op && field ? '_' : '') - + (field && field.signal ? '$' + field.signal : field || ''); - } - - // ----- - - var Scope = 'scope'; - - var View$1 = 'view'; - - function isSignal(_) { - return _ && _.signal; - } - - function isExpr(_) { - return _ && _.expr; - } - - function hasSignal(_) { - if (isSignal(_)) return true; - if (isObject(_)) for (var key in _) { - if (hasSignal(_[key])) return true; - } - return false; - } - - function value$2(specValue, defaultValue) { - return specValue != null ? specValue : defaultValue; - } - - function deref(v) { - return v && v.signal || v; - } - - var Timer = 'timer'; - - function parseStream$1(stream, scope) { - var method = stream.merge ? mergeStream - : stream.stream ? nestedStream - : stream.type ? eventStream - : error('Invalid stream specification: ' + $(stream)); - - return method(stream, scope); - } - - function eventSource(source) { - return source === Scope ? View$1 : (source || View$1); - } - - function mergeStream(stream, scope) { - var list = stream.merge.map(s => parseStream$1(s, scope)), - entry = streamParameters({merge: list}, stream, scope); - return scope.addStream(entry).id; - } - - function nestedStream(stream, scope) { - var id = parseStream$1(stream.stream, scope), - entry = streamParameters({stream: id}, stream, scope); - return scope.addStream(entry).id; - } - - function eventStream(stream, scope) { - var id, entry; - - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = {between: stream.between, filter: stream.filter}; - } else { - id = scope.event(eventSource(stream.source), stream.type); - } - - entry = streamParameters({stream: id}, stream, scope); - return Object.keys(entry).length === 1 - ? id - : scope.addStream(entry).id; - } - - function streamParameters(entry, stream, scope) { - var param = stream.between; - - if (param) { - if (param.length !== 2) { - error('Stream "between" parameter must have 2 entries: ' + $(stream)); - } - entry.between = [ - parseStream$1(param[0], scope), - parseStream$1(param[1], scope) - ]; - } - - param = stream.filter ? [].concat(stream.filter) : []; - if (stream.marktype || stream.markname || stream.markrole) { - // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - } - if (stream.source === Scope) { - // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - } - if (param.length) { - entry.filter = parseExpression$1('(' + param.join(')&&(') + ')', scope).$expr; - } - - if ((param = stream.throttle) != null) { - entry.throttle = +param; - } - - if ((param = stream.debounce) != null) { - entry.debounce = +param; - } - - if (stream.consume) { - entry.consume = true; - } - - return entry; - } - - function filterMark(type, name, role) { - var item = 'event.item'; - return item - + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') - + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') - + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); - } - - /** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ - function selector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW$1; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); - } - - var VIEW$1 = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL$1 = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - - function isMarkType(type) { - return MARKS[type]; - } - - function find$1(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - for (; i= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - return i; - } - - function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find$1(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - return output; - } - - function parseSelector(s) { - return s[0] === '[' - ? parseBetween(s) - : parseStream$2(s); - } - - function parseBetween(s) { - var n = s.length, - i = 1, - b, stream; - - i = find$1(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector); - - stream = parseSelector(s.slice(1).trim()); - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; - } - - function parseStream$2(s) { - var stream = {source: DEFAULT_SOURCE}, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, j, - filter; - - // extract throttle from end - if (s[n-1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i+1, n-1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - - if (!n) throw s; - - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - - // extract first part of multi-part stream selector - j = find$1(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } - - // extract remaining part of stream selector - i = find$1(s, i, LBRACK); - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - - // extract filters - while (i < n) { - i = find$1(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n-1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - - // marshall event stream specification - if (!(n = source.length) || ILLEGAL$1.test(source[n-1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - - return stream; - } - - function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function(_) { - var x = +_; - if (x !== x) throw s; - return x; - }); - } - - // bypass expression parser for internal operator references - const OP_VALUE_EXPR = { - code: '_.$value', - ast: {type: 'Identifier', value: 'value'} - }; - - function parseUpdate$1(spec, scope, target) { - var events = spec.events, - update = spec.update, - encode = spec.encode, - sources = [], - entry = {target: target}; - - if (!events) { - error('Signal update missing events specification.'); - } - - // interpret as an event selector string - if (isString(events)) { - events = selector(events, scope.isSubscope() ? Scope : View$1); - } - - // separate event streams from signal updates - events = array(events) - .filter(s => s.signal || s.scale ? (sources.push(s), 0) : 1); - - // merge internal operator listeners - if (sources.length > 1) { - sources = [mergeSources(sources)]; - } - - // merge event streams, include as source - if (events.length) { - sources.push(events.length > 1 ? {merge: events} : events[0]); - } - - if (encode != null) { - if (update) error('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + $(encode) + ')'; - } - - // resolve update value - entry.update = isString(update) ? parseExpression$1(update, scope) - : update.expr != null ? parseExpression$1(update.expr, scope) - : update.value != null ? update.value - : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: {$value: scope.signalRef(update.signal)} - } - : error('Invalid signal update specification.'); - - if (spec.force) { - entry.options = {force: true}; - } - - sources.forEach(function(source) { - scope.addUpdate(extend(streamSource(source, scope), entry)); - }); - } - - function streamSource(stream, scope) { - return { - source: stream.signal ? scope.signalRef(stream.signal) - : stream.scale ? scope.scaleRef(stream.scale) - : parseStream$1(stream, scope) - }; - } - - function mergeSources(sources) { - return { - signal: '[' - + sources.map(s => s.scale ? 'scale("' + s.scale + '")' : s.signal) - + ']' - }; - } - - function parseSignalUpdates(signal, scope) { - var op = scope.getSignal(signal.name), - expr = signal.update; - - if (signal.init) { - if (expr) { - error('Signals can not include both init and update expressions.'); - } else { - expr = signal.init; - op.initonly = true; - } - } - - if (expr) { - expr = parseExpression$1(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - if (signal.on) { - signal.on.forEach(function(_) { - parseUpdate$1(_, scope, op.id); - }); - } - } - - const transform$2 = name => (params, value, parent) => - entry$1(name, value, params || undefined, parent); - - var Aggregate$1 = transform$2('aggregate'); - var AxisTicks$1 = transform$2('axisticks'); - var Bound$1 = transform$2('bound'); - var Collect$1 = transform$2('collect'); - var Compare$1 = transform$2('compare'); - var DataJoin$1 = transform$2('datajoin'); - var Encode$1 = transform$2('encode'); - var Expression$1 = transform$2('expression'); - var Facet$1 = transform$2('facet'); - var Field$1 = transform$2('field'); - var Key$1 = transform$2('key'); - var LegendEntries$1 = transform$2('legendentries'); - var Load$1 = transform$2('load'); - var Mark$1 = transform$2('mark'); - var MultiExtent$1 = transform$2('multiextent'); - var MultiValues$1 = transform$2('multivalues'); - var Overlap$1 = transform$2('overlap'); - var Params$2 = transform$2('params'); - var PreFacet$1 = transform$2('prefacet'); - var Projection$1 = transform$2('projection'); - var Proxy$1 = transform$2('proxy'); - var Relay$1 = transform$2('relay'); - var Render$1 = transform$2('render'); - var Scale$1 = transform$2('scale'); - var Sieve$1 = transform$2('sieve'); - var SortItems$1 = transform$2('sortitems'); - var ViewLayout$1 = transform$2('viewlayout'); - var Values$1 = transform$2('values'); - - var FIELD_REF_ID = 0; - - var MULTIDOMAIN_SORT_OPS = {min: 'min', max: 'max', count: 'sum'}; - - function initScale(spec, scope) { - var type = spec.type || 'linear'; - - if (!isValidScaleType(type)) { - error('Unrecognized scale type: ' + $(type)); - } - - scope.addScale(spec.name, { - type: type, - domain: undefined - }); - } - - function parseScale(spec, scope) { - var params = scope.getScale(spec.name).params, - key; - - params.domain = parseScaleDomain(spec.domain, spec, scope); - - if (spec.range != null) { - params.range = parseScaleRange(spec, scope, params); - } - - if (spec.interpolate != null) { - parseScaleInterpolate(spec.interpolate, params); - } - - if (spec.nice != null) { - params.nice = parseScaleNice(spec.nice); - } - - if (spec.bins != null) { - params.bins = parseScaleBins(spec.bins, scope); - } - - for (key in spec) { - if (hasOwnProperty(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } - } - - function parseLiteral(v, scope) { - return !isObject(v) ? v - : v.signal ? scope.signalRef(v.signal) - : error('Unsupported object: ' + $(v)); - } - - function parseArray(v, scope) { - return v.signal - ? scope.signalRef(v.signal) - : v.map(v => parseLiteral(v, scope)); - } - - function dataLookupError(name) { - error('Can not find data set: ' + $(name)); - } - - // -- SCALE DOMAIN ---- - - function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) { - error('No scale domain defined for domainMin/domainMax to override.'); - } - return; // default domain - } - - return domain.signal ? scope.signalRef(domain.signal) - : (isArray(domain) ? explicitDomain - : domain.fields ? multipleDomain - : singularDomain)(domain, spec, scope); - } - - function explicitDomain(domain, spec, scope) { - return domain.map(function(v) { - return parseLiteral(v, scope); - }); - } - - function singularDomain(domain, spec, scope) { - var data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - - return isDiscrete(spec.type) - ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) - : isQuantile(spec.type) ? data.domainRef(scope, domain.field) - : data.extentRef(scope, domain.field); - } - - function multipleDomain(domain, spec, scope) { - var data = domain.data, - fields = domain.fields.reduce(function(dom, d) { - d = isString(d) ? {data: data, field: d} - : (isArray(d) || d.signal) ? fieldRef$1(d, scope) - : d; - dom.push(d); - return dom; - }, []); - - return (isDiscrete(spec.type) ? ordinalMultipleDomain - : isQuantile(spec.type) ? quantileMultipleDomain - : numericMultipleDomain)(domain, scope, fields); - } - - function fieldRef$1(data, scope) { - var name = '_:vega:_' + (FIELD_REF_ID++), - coll = Collect$1({}); - - if (isArray(data)) { - coll.value = {$ingest: data}; - } else if (data.signal) { - var code = 'setdata(' + $(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - scope.addDataPipeline(name, [coll, Sieve$1({})]); - return {data: name, field: 'data'}; - } - - function ordinalMultipleDomain(domain, scope, fields) { - var sort = parseSort(domain.sort, true), - counts, p, a, c, v; - - // get value counts for each domain field - counts = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); - }); - - // aggregate the results from each domain field - p = {groupby: keyFieldRef, pulse: counts}; - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [MULTIDOMAIN_SORT_OPS[a]]; - p.fields = [scope.fieldRef(v)]; - p.as = [v]; - } - a = scope.add(Aggregate$1(p)); - - // collect aggregate output - c = scope.add(Collect$1({pulse: ref(a)})); - - // extract values for combined domain - v = scope.add(Values$1({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) - })); - - return ref(v); - } - - function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if (isObject(sort)) sort.field = 'key'; - else sort = {field: 'key'}; - } else if (!sort.field && sort.op !== 'count') { - error('No field provided for sort aggregate op: ' + sort.op); - } else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) { - error('Multiple domain scales can not be sorted using ' + sort.op); - } - } - } - return sort; - } - - function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - var values = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); - }); - - // combine value arrays - return ref(scope.add(MultiValues$1({values: values}))); - } - - function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - var extents = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); - }); - - // combine extents - return ref(scope.add(MultiExtent$1({extents: extents}))); - } - - // -- SCALE BINS ----- - - function parseScaleBins(v, scope) { - return v.signal || isArray(v) - ? parseArray(v, scope) - : scope.objectProperty(v); - } - - // -- SCALE NICE ----- - - function parseScaleNice(nice) { - return isObject(nice) - ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } - : parseLiteral(nice); - } - - // -- SCALE INTERPOLATION ----- - - function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - if (interpolate.gamma != null) { - params.interpolateGamma = parseLiteral(interpolate.gamma); - } - } - - // -- SCALE RANGE ----- - - function parseScaleRange(spec, scope, params) { - var range = spec.range, - config = scope.config.range; - - if (range.signal) { - return scope.signalRef(range.signal); - } else if (isString(range)) { - if (config && hasOwnProperty(config, range)) { - spec = extend({}, spec, {range: config[range]}); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') { - range = [0, {signal: 'width'}]; - } else if (range === 'height') { - range = isDiscrete(spec.type) - ? [0, {signal: 'height'}] - : [{signal: 'height'}, 0]; - } else { - error('Unrecognized scale range value: ' + $(range)); - } - } else if (range.scheme) { - params.scheme = isArray(range.scheme) - ? parseArray(range.scheme, scope) - : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if (isDiscrete(spec.type) && !isArray(range)) { - return parseScaleDomain(range, spec, scope); - } else if (!isArray(range)) { - error('Unsupported range type: ' + $(range)); - } - - return range.map(v => (isArray(v) ? parseArray : parseLiteral)(v, scope)); - } - - function parseProjection(proj, scope) { - var config = scope.config.projection || {}, - params = {}; - - for (var name in proj) { - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } - - // apply projection defaults from config - for (name in config) { - if (params[name] == null) { - params[name] = parseParameter$1(config[name], name, scope); - } - } - - scope.addProjection(proj.name, params); - } - - function parseParameter$1(_, name, scope) { - return isArray(_) ? _.map(function(_) { return parseParameter$1(_, name, scope); }) - : !isObject(_) ? _ - : _.signal ? scope.signalRef(_.signal) - : name === 'fit' ? _ - : error('Unsupported parameter object: ' + $(_)); - } - - const Top$1 = 'top'; - const Left$1 = 'left'; - const Right$1 = 'right'; - const Bottom$1 = 'bottom'; - const Center$1 = 'center'; - - const Vertical = 'vertical'; - - const Start$1 = 'start'; - const Middle$1 = 'middle'; - const End$1 = 'end'; - - const Index = 'index'; - const Label = 'label'; - const Offset = 'offset'; - const Perc = 'perc'; - const Perc2 = 'perc2'; - const Value = 'value'; - - const GuideLabelStyle = 'guide-label'; - const GuideTitleStyle = 'guide-title'; - const GroupTitleStyle = 'group-title'; - const GroupSubtitleStyle = 'group-subtitle'; - - const Symbols$1 = 'symbol'; - const Gradient$1 = 'gradient'; - const Discrete$1 = 'discrete'; - - const Size = 'size'; - const Shape = 'shape'; - const Fill = 'fill'; - const Stroke = 'stroke'; - const StrokeWidth = 'strokeWidth'; - const StrokeDash = 'strokeDash'; - const Opacity = 'opacity'; - - // Encoding channels supported by legends - // In priority order of 'canonical' scale - const LegendScales = [ - Size, - Shape, - Fill, - Stroke, - StrokeWidth, - StrokeDash, - Opacity - ]; - - const Skip$2 = { - name: 1, - style: 1, - interactive: 1 - }; - - const zero$1 = {value: 0}; - const one$1 = {value: 1}; - - var GroupMark = 'group'; - var RectMark = 'rect'; - var RuleMark = 'rule'; - var SymbolMark = 'symbol'; - var TextMark = 'text'; - - function guideGroup(mark) { - mark.type = GroupMark; - mark.interactive = mark.interactive || false; - return mark; - } - - function lookup$5(spec, config) { - const _ = (name, dflt) => value$2(spec[name], value$2(config[name], dflt)); - - _.isVertical = s => Vertical === value$2( - spec.direction, - config.direction || (s ? config.symbolDirection : config.gradientDirection) - ); - - _.gradientLength = () => value$2( - spec.gradientLength, - config.gradientLength || config.gradientWidth - ); - - _.gradientThickness = () => value$2( - spec.gradientThickness, - config.gradientThickness || config.gradientHeight - ); - - _.entryColumns = () => value$2( - spec.columns, - value$2(config.columns, +_.isVertical(true)) - ); - - return _; - } - - function getEncoding(name, encode) { - var v = encode && ( - (encode.update && encode.update[name]) || - (encode.enter && encode.enter[name]) - ); - return v && v.signal ? v : v ? v.value : null; - } - - function getStyle(name, scope, style) { - var s = scope.config.style[style]; - return s && s[name]; - } - - function anchorExpr(s, e, m) { - return `item.anchor === '${Start$1}' ? ${s} : item.anchor === '${End$1}' ? ${e} : ${m}`; - } - - const alignExpr = anchorExpr( - $(Left$1), - $(Right$1), - $(Center$1) - ); - - function tickBand(_) { - let v = _('tickBand'), - offset = _('tickOffset'), - band, extra; - - if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); - } else if (v.signal) { - // if signal, augment code to interpret values - band = {signal: `(${v.signal}) === 'extent' ? 1 : 0.5`}; - extra = {signal: `(${v.signal}) === 'extent'`}; - if (!isObject(offset)) { - offset = {signal: `(${v.signal}) === 'extent' ? 0 : ${offset}`}; - } - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; - } else { - band = 0.5; - extra = false; - } - - return {extra, band, offset}; - } - - function extendOffset(value, offset) { - return !offset ? value - : !value ? offset - : !isObject(value) ? { value, offset } - : Object.assign({}, value, { offset: extendOffset(value.offset, offset) }); - } - - function guideMark(mark, extras) { - if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip$2); - } else { - mark.interactive = false; - } - return mark; - } - - function legendGradient(spec, scale, config, userEncode) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, start, stop, width, height; - - if (vertical) { - start = [0, 1]; - stop = [0, 0]; - width = thickness; - height = length; - } else { - start = [0, 0]; - stop = [1, 0]; - width = length; - height = thickness; - } - - encode = { - enter: enter = { - opacity: zero$1, - x: zero$1, - y: zero$1, - width: encoder(width), - height: encoder(height) - }, - update: extend({}, enter, { - opacity: one$1, - fill: {gradient: scale, start: start, stop: stop} - }), - exit: { - opacity: zero$1 - } - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode - }, userEncode); - } - - function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, u, v, uu, vv, adjust = ''; - - vertical - ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') - : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); - - enter = { - opacity: zero$1, - fill: {scale: scale, field: Value} - }; - enter[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - enter[v] = zero$1; - enter[uu] = {signal: adjust + 'datum.' + Perc2, mult: length}; - enter[vv] = encoder(thickness); - - encode = { - enter: enter, - update: extend({}, enter, {opacity: one$1}), - exit: {opacity: zero$1} - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode - }, userEncode); - } - - const alignExpr$1 = `datum.${Perc}<=0?"${Left$1}":datum.${Perc}>=1?"${Right$1}":"${Center$1}"`, - baselineExpr = `datum.${Perc}<=0?"${Bottom$1}":datum.${Perc}>=1?"${Top$1}":"${Middle$1}"`; - - function legendGradientLabels(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = encoder(_.gradientThickness()), - length = _.gradientLength(), - overlap = _('labelOverlap'), - encode, enter, update, u, v, adjust = ''; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1, - text: {field: Label} - }, - exit: { - opacity: zero$1 - } - }; - - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value$2(spec.labelLimit, config.gradientLabelLimit) - }); - - if (vertical) { - enter.align = {value: 'left'}; - enter.baseline = update.baseline = {signal: baselineExpr}; - u = 'y'; v = 'x'; adjust = '1-'; - } else { - enter.align = update.align = {signal: alignExpr$1}; - enter.baseline = {value: 'top'}; - u = 'x'; v = 'y'; - } - - enter[u] = update[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - - enter[v] = update[v] = thickness; - thickness.offset = value$2(spec.labelOffset, config.gradientLabelOffset) || 0; - - overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; - - // type, role, style, key, dataRef, encode, extras - return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); - } - - // userEncode is top-level, includes entries, symbols, labels - function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - var _ = lookup$5(spec, config), - entries = userEncode.entries, - interactive = !!(entries && entries.interactive), - name = entries ? entries.name : undefined, - height = _('clipHeight'), - symbolOffset = _('symbolOffset'), - valueRef = {data: 'value'}, - encode = {}, - xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, - yEncode = height ? encoder(height) : {field: Size}, - index = `datum.${Index}`, - ncols = `max(1, ${columns})`, - enter, update, labelOffset, symbols, labels, nrows, sort; - - yEncode.mult = 0.5; - - // -- LEGEND SYMBOLS -- - encode = { - enter: enter = { - opacity: zero$1, - x: {signal: xSignal, mult: 0.5, offset: symbolOffset}, - y: yEncode - }, - update: update = { - opacity: one$1, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$1 - } - }; - - var baseFill = null, - baseStroke = null; - if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') - }, { // update - opacity: _('symbolOpacity') - }); - - LegendScales.forEach(function(scale) { - if (spec[scale]) { - update[scale] = enter[scale] = {scale: spec[scale], field: Value}; - } - }); - - symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode - }, userEncode.symbols); - - // -- LEGEND LABELS -- - labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - - encode = { - enter: enter = { - opacity: zero$1, - x: {signal: xSignal, offset: labelOffset}, - y: yEncode - }, - update: update = { - opacity: one$1, - text: {field: Label}, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$1 - } - }; - - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') - }); - - labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode - }, userEncode.labels); - - // -- LEGEND ENTRY GROUPS -- - encode = { - enter: { - noBound: {value: !height}, // ignore width/height in bounds calc - width: zero$1, - height: height ? encoder(height) : zero$1, - opacity: zero$1 - }, - exit: {opacity: zero$1}, - update: update = { - opacity: one$1, - row: {signal: null}, - column: {signal: null} - } - }; - - // annotate and sort groups to ensure correct ordering - if (_.isVertical(true)) { - nrows = `ceil(item.mark.items.length / ${ncols})`; - update.row.signal = `${index}%${nrows}`; - update.column.signal = `floor(${index} / ${nrows})`; - sort = {field: ['row', index]}; - } else { - update.row.signal = `floor(${index} / ${ncols})`; - update.column.signal = `${index} % ${ncols}`; - sort = {field: index}; - } - // handle zero column case (implies infinite columns) - update.column.signal = `(${columns})?${update.column.signal}:${index}`; - - // facet legend entries into sub-groups - dataRef = {facet: {data: dataRef, name: 'value', groupby: Index}}; - - return guideGroup({ - role: ScopeRole$1, - from: dataRef, - encode: extendEncode(encode, entries, Skip$2), - marks: [symbols, labels], - name, - interactive, - sort - }); - } - - function legendSymbolLayout(spec, config) { - const _ = lookup$5(spec, config); - - // layout parameters for legend entries - return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } - }; - } - - // expression logic for align, anchor, angle, and baseline calculation - const isL = 'item.orient === "left"', - isR = 'item.orient === "right"', - isLR = `(${isL} || ${isR})`, - isVG = `datum.vgrad && ${isLR}`, - baseline = anchorExpr('"top"', '"bottom"', '"middle"'), - alignFlip = anchorExpr('"right"', '"left"', '"center"'), - exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr}`, - exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, - exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, - exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; - - function legendTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), encode; - - encode = { - enter: {opacity: zero$1}, - update: { - opacity: one$1, - x: {field: {group: 'padding'}}, - y: {field: {group: 'padding'}} - }, - exit: {opacity: zero$1} - }; - - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: {signal: exprAnchor}, - angle: {signal: exprAngle}, - align: {signal: exprAlign}, - baseline: {signal: exprBaseline}, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - baseline: _('titleBaseline') - }); - - return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function clip$2(clip, scope) { - var expr; - - if (isObject(clip)) { - if (clip.signal) { - expr = clip.signal; - } else if (clip.path) { - expr = 'pathShape(' + param(clip.path) + ')'; - } else if (clip.sphere) { - expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - } - - return expr - ? scope.signalRef(expr) - : !!clip; - } - - function param(value) { - return isObject(value) && value.signal - ? value.signal - : $(value); - } - - function getRole(spec) { - var role = spec.role || ''; - return (!role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title')) - ? role - : spec.type === GroupMark ? ScopeRole$1 : (role || MarkRole); - } - - function definition$1(spec) { - return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; - } - - function interactive(spec, scope) { - return spec && spec.signal ? scope.signalRef(spec.signal) - : spec === false ? false - : true; - } - - /** - * Parse a data transform specification. - */ - function parseTransform(spec, scope) { - var def = definition(spec.type); - if (!def) error('Unrecognized transform type: ' + $(spec.type)); - - var t = entry$1(def.type.toLowerCase(), null, parseParameters$1(def, spec, scope)); - if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; - - return t; - } - - /** - * Parse all parameters of a data transform. - */ - function parseParameters$1(def, spec, scope) { - var params = {}, pdef, i, n; - for (i=0, n=def.params.length; i spec[s] - ? (scales[s] = spec[s], scale = scale || spec[s]) : 0 - ); - if (!scale) error('Missing valid scale for legend.'); - - // resolve legend type (symbol, gradient, or discrete gradient) - type = legendType(spec, scope.scaleType(scale)); - - // single-element data source for legend group - datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - dataRef = ref(scope.add(Collect$1(null, [datum]))); - - // encoding properties for legend group - legendEncode = extendEncode( - buildLegendEncode(_, spec, config), legendEncode, Skip$2 - ); - - // encoding properties for legend entry sub-group - entryEncode = {enter: {x: {value: 0}, y: {value: 0}}}; - - // data source for legend values - entryRef = ref(scope.add(LegendEntries$1(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // continuous gradient legend - if (type === Gradient$1) { - children = [ - legendGradient(spec, scale, config, encode.gradient), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - // adjust default tick count based on the gradient length - params.count = params.count || scope.signalRef( - `max(2,2*floor((${deref(_.gradientLength())})/100))` - ); - } - - // discrete gradient legend - else if (type === Discrete$1) { - children = [ - legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - } - - // symbol legend - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [ - legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns)) - ]; - // pass symbol size information to legend entry generator - params.size = sizeExpression(spec, scope, children[0].marks); - } - - // generate legend marks - children = [ - guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive - }) - ]; - - // include legend title if defined - if (datum.title) { - children.push(legendTitle(spec, config, encode.title, dataRef)); - } - - // parse legend specification - return parseMark( - guideGroup({ - role: LegendRole$1, - from: dataRef, - encode: legendEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); - } - - function legendType(spec, scaleType) { - var type = spec.type || Symbols$1; - - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { - type = isContinuous(scaleType) ? Gradient$1 - : isDiscretizing(scaleType) ? Discrete$1 - : Symbols$1; - } - - return type !== Gradient$1 ? type - : isDiscretizing(scaleType) ? Discrete$1 - : Gradient$1; - } - - function scaleCount(spec) { - return LegendScales.reduce(function(count, type) { - return count + (spec[type] ? 1 : 0); - }, 0); - } - - function buildLegendEncode(_, spec, config) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; - } - - function sizeExpression(spec, scope, marks) { - var size = deref(getChannel('size', spec, marks)), - strokeWidth = deref(getChannel('strokeWidth', spec, marks)), - fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - - return parseExpression$1( - `max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, - scope - ); - } - - function getChannel(name, spec, marks) { - return spec[name] - ? `scale("${spec[name]}",datum)` - : getEncoding(name, marks[0].encode); - } - - function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); - } - - const angleExpr = `item.orient==="${Left$1}"?-90:item.orient==="${Right$1}"?90:0`; - - function parseTitle(spec, scope) { - spec = isString(spec) ? {text: spec} : spec; - - var _ = lookup$5(spec, scope.config.title), - encode = spec.encode || {}, - userEncode = encode.group || {}, - name = userEncode.name || undefined, - interactive = userEncode.interactive, - style = userEncode.style, - children = [], - datum, dataRef; - - // single-element data source for group title - datum = {}; - dataRef = ref(scope.add(Collect$1(null, [datum]))); - - // include title text - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); - - // include subtitle text - if (spec.subtitle) { - children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - } - - // parse title specification - return parseMark( - guideGroup({ - role: TitleRole$1, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); - } - - // provide backwards-compatibility for title custom encode; - // the top-level encode block has been *deprecated*. - function titleEncode(spec) { - const encode = spec.encode; - return (encode && encode.title) || extend({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); - } - - function groupEncode(_, userEncode) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: {signal: alignExpr}, - angle: {signal: angleExpr}, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') - }); - - return extendEncode(encode, userEncode, Skip$2); - } - - function buildTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.text, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function buildSubTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.subtitle, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function parseData$1(data, scope) { - var transforms = []; - - if (data.transform) { - data.transform.forEach(function(tx) { - transforms.push(parseTransform(tx, scope)); - }); - } - - if (data.on) { - data.on.forEach(function(on) { - parseTrigger(on, scope, data.name); - }); - } - - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); - } - - /** - * Analyze a data pipeline, add needed operators. - */ - function analyze(data, scope, ops) { - var output = [], - source = null, - modify = false, - generate = false, - upstream, i, n, t, m; - - if (data.values) { - // hard-wired input data set - if (hasSignal(data.values) || hasSignal(data.format)) { - // if either values or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format - })); - } - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format - })); - } - } else if (data.source) { - // derives from one or more other data sets - source = upstream = array(data.source).map(function(d) { - return ref(scope.getData(d).output); - }); - output.push(null); // populate later - } - - // scan data transforms, add collectors as needed - for (i=0, n=ops.length; i orient === Bottom$1 || orient === Top$1; - - // get sign coefficient based on axis orient - const getSign = (orient, a, b) => isSignal(orient) - ? ifLeftTopExpr(orient.signal, a, b) - : orient === Left$1 || orient === Top$1 ? a : b; - - // condition on axis x-direction - const ifX = (orient, a, b) => isSignal(orient) - ? ifXEnc(orient.signal, a, b) - : isX(orient) ? a : b; - - // condition on axis y-direction - const ifY = (orient, a, b) => isSignal(orient) - ? ifYEnc(orient.signal, a, b) - : isX(orient) ? b : a; - - const ifTop = (orient, a, b) => isSignal(orient) - ? ifTopExpr(orient.signal, a, b) - : orient === Top$1 ? {value: a} : {value: b}; - - const ifRight = (orient, a, b) => isSignal(orient) - ? ifRightExpr(orient.signal, a, b) - : orient === Right$1 ? {value: a} : {value: b}; - - const ifXEnc = ($orient, a, b) => ifEnc( - `${$orient} === '${Top$1}' || ${$orient} === '${Bottom$1}'`, a, b - ); - - const ifYEnc = ($orient, a, b) => ifEnc( - `${$orient} !== '${Top$1}' && ${$orient} !== '${Bottom$1}'`, a, b - ); - - const ifLeftTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Left$1}' || ${$orient} === '${Top$1}'`, a, b - ); - - const ifTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Top$1}'`, a, b - ); - - const ifRightExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Right$1}'`, a, b - ); - - const ifEnc = (test, a, b) => { - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? (a.signal || $(a.value)) : null; - b = b ? (b.signal || $(b.value)) : null; - return {signal: `${test} ? (${a}) : (${b})`}; - } else { - // otherwise generate rule set - return [extend({test}, a)].concat(b || []); - } - }; - - const isSimple = enc => ( - enc == null || Object.keys(enc).length === 1 - ); - - const ifExpr = (test, a, b) => ({ - signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})` - }); - - const ifOrient = ($orient, t, b, l, r) => ({ - signal: (l != null ? `${$orient} === '${Left$1}' ? (${toExpr(l)}) : ` : '') - + (b != null ? `${$orient} === '${Bottom$1}' ? (${toExpr(b)}) : ` : '') - + (r != null ? `${$orient} === '${Right$1}' ? (${toExpr(r)}) : ` : '') - + (t != null ? `${$orient} === '${Top$1}' ? (${toExpr(t)}) : ` : '') - + '(null)' - }); - - const toExpr = v => isSignal(v) - ? v.signal - : v == null ? null : $(v); - - const mult = (sign, value) => value === 0 ? 0 : isSignal(sign) - ? {signal: `(${sign.signal}) * ${value}`} - : {value: sign * value}; - - const patch = (value, base) => { - const s = value.signal; - return s && s.endsWith('(null)') - ? {signal: s.slice(0, -6) + base.signal} - : value; - }; - - function fallback(prop, config, axisConfig, style) { - let styleProp; - - if (config && hasOwnProperty(config, prop)) { - return config[prop]; - } - else if (hasOwnProperty(axisConfig, prop)) { - return axisConfig[prop]; - } - else if (prop.startsWith('title')) { - switch (prop) { - case 'titleColor': - styleProp = 'fill'; - break; - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideTitleStyle][styleProp]; - } - else if (prop.startsWith('label')) { - switch (prop) { - case 'labelColor': - styleProp = 'fill'; - break; - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideLabelStyle][styleProp]; - } - - return null; - } - - function keys$1(objects) { - const map = {}; - for (const obj of objects) { - if (!obj) continue; - for (const key in obj) map[key] = 1; - } - return Object.keys(map); - } - - function axisConfig(spec, scope) { - var config = scope.config, - style = config.style, - axis = config.axis, - band = scope.scaleType(spec.scale) === 'band' && config.axisBand, - orient = spec.orient, - xy, or, key; - - if (isSignal(orient)) { - const xyKeys = keys$1([ - config.axisX, config.axisY - ]), - orientKeys = keys$1([ - config.axisTop, config.axisBottom, - config.axisLeft, config.axisRight - ]); - - xy = {}; - for (key of xyKeys) { - xy[key] = ifX( - orient, - fallback(key, config.axisX, axis, style), - fallback(key, config.axisY, axis, style) - ); - } - - or = {}; - for (key of orientKeys) { - or[key] = ifOrient( - orient.signal, - fallback(key, config.axisTop, axis, style), - fallback(key, config.axisBottom, axis, style), - fallback(key, config.axisLeft, axis, style), - fallback(key, config.axisRight, axis, style) - ); - } - } else { - xy = (orient === Top$1 || orient === Bottom$1) ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; - } - - var result = (xy || or || band) - ? extend({}, axis, xy, or, band) - : axis; - - return result; - } - - function axisDomain(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - encode, enter, update; - - encode = { - enter: enter = {opacity: zero$1}, - update: update = {opacity: one$1}, - exit: {opacity: zero$1} - }; - - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') - }); - - const pos0 = position(spec, 0); - const pos1 = position(spec, 1); - - enter.x = update.x = ifX(orient, pos0, zero$1); - enter.x2 = update.x2 = ifX(orient, pos1); - - enter.y = update.y = ifY(orient, pos0, zero$1); - enter.y2 = update.y2 = ifY(orient, pos1); - - return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode - }, userEncode); - } - - function position(spec, pos) { - return {scale: spec.scale, range: pos}; - } - - function axisGrid(spec, config, userEncode, dataRef, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - vscale = spec.gridScale, - sign = getSign(orient, 1, -1), - offset = offsetValue$1(spec.offset, sign), - encode, enter, exit, update, - tickPos, gridStart, gridEnd, sz; - - encode = { - enter: enter = {opacity: zero$1}, - update: update = {opacity: one$1}, - exit: exit = {opacity: zero$1} - }; - - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') - }); - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - sz = ifX(orient, {signal: 'height'}, {signal: 'width'}); - - gridStart = vscale - ? {scale: vscale, range: 0, mult: sign, offset: offset} - : {value: 0, offset: offset}; - - gridEnd = vscale - ? {scale: vscale, range: 1, mult: sign, offset: offset} - : extend(sz, {mult: sign, offset: offset}); - - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); - exit.x = ifX(orient, tickPos); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode - }, userEncode); - } - - function offsetValue$1(offset, sign) { - if (sign === 1) ; else if (!isObject(offset)) { - offset = isSignal(sign) - ? {signal: `(${sign.signal}) * (${offset || 0})`} - : sign * (offset || 0); - } else { - let entry = offset = extend({}, offset); - while (entry.mult != null) { - if (!isObject(entry.mult)) { - entry.mult = isSignal(sign) // no offset if sign === 1 - ? {signal: `(${entry.mult}) * (${sign.signal})`} - : entry.mult * sign; - return offset; - } else { - entry = entry.mult = extend({}, entry.mult); - } - } - entry.mult = sign; - } - - return offset; - } - - function axisTicks(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, exit, update, tickSize, tickPos; - - encode = { - enter: enter = {opacity: zero$1}, - update: update = {opacity: one$1}, - exit: exit = {opacity: zero$1} - }; - - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') - }); - - tickSize = encoder(size); - tickSize.mult = sign; - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - update.y = enter.y = ifX(orient, zero$1, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); - exit.x = ifX(orient, tickPos); - - update.x = enter.x = ifY(orient, zero$1, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode - }, userEncode); - } - - function flushExpr(scale, threshold, a, b, c) { - return { - signal: 'flush(range("' + scale + '"), ' - + 'scale("' + scale + '", datum.value), ' - + threshold + ',' + a + ',' + b + ',' + c + ')' - }; - } - - function axisLabels(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - scale = spec.scale, - sign = getSign(orient, -1, 1), - flush = deref(_('labelFlush')), - flushOffset = deref(_('labelFlushOffset')), - flushOn = flush === 0 || !!flush, - labelAlign = _('labelAlign'), - labelBaseline = _('labelBaseline'), - encode, enter, update, tickSize, tickPos, - align, baseline, bound, overlap, offsetExpr; - - tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; - - tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - - align = ifX(orient, - flushOn - ? flushExpr(scale, flush, '"left"', '"right"', '"center"') - : {value: 'center'}, - ifRight(orient, 'left', 'right') - ); - - baseline = ifX(orient, - ifTop(orient, 'bottom', 'top'), - flushOn - ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') - : {value: 'middle'} - ); - - offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0); - flushOn = flushOn && flushOffset; - - enter = { - opacity: zero$1, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - - encode = { - enter: enter, - update: update = { - opacity: one$1, - text: {field: Label}, - x: enter.x, - y: enter.y, - align, - baseline - }, - exit: { - opacity: zero$1, - x: enter.x, - y: enter.y - } - }; - - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') - }, { - align: labelAlign, - baseline: labelBaseline - }); - - bound = _('labelBound'); - overlap = _('labelOverlap'); - - // if overlap method or bound defined, request label overlap removal - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? {scale, orient, tolerance: bound} : null - } : undefined; - - if (update.align !== align) { - update.align = patch(update.align, align); - } - if (update.baseline !== baseline) { - update.baseline = patch(update.baseline, baseline); - } - - return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); - } - - function axisTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, update, titlePos; - - encode = { - enter: enter = { - opacity: zero$1, - anchor: encoder(_('titleAnchor', null)), - align: {signal: alignExpr} - }, - update: update = extend({}, enter, { - opacity: one$1, - text: encoder(spec.title) - }), - exit: { - opacity: zero$1 - } - }; - - titlePos = { - signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` - }; - - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero$1, mult(sign, 90)); - enter.baseline = ifX(orient, ifTop(orient, Bottom$1, Top$1), {value: Bottom$1}); - update.angle = enter.angle; - update.baseline = enter.baseline; - - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); - - return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function autoLayout(_, orient, encode, userEncode) { - const auto = (value, dim) => value != null - ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) - : !has(dim, userEncode) ? true : false; - - const autoY = auto(_('titleX'), 'x'), - autoX = auto(_('titleY'), 'y'); - - encode.enter.auto = autoX === autoY - ? encoder(autoX) - : ifX(orient, encoder(autoX), encoder(autoY)); - } - - function parseAxis(spec, scope) { - var config = axisConfig(spec, scope), - encode = spec.encode || {}, - axisEncode = encode.axis || {}, - name = axisEncode.name || undefined, - interactive = axisEncode.interactive, - style = axisEncode.style, - _ = lookup$5(spec, config), - band = tickBand(_), - datum, dataRef, ticksRef, size, children; - - // single-element data source for axis group - datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - dataRef = ref(scope.add(Collect$1({}, [datum]))); - - // encoding properties for axis group item - axisEncode = extendEncode( - buildAxisEncode(_, spec), axisEncode, Skip$2 - ); - - // data source for axis ticks - ticksRef = ref(scope.add(AxisTicks$1({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // generate axis marks - children = []; - - // include axis gridlines if requested - if (datum.grid) { - children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - } - - // include axis ticks if requested - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } - - // include axis labels if requested - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } - - // include axis domain path if requested - if (datum.domain) { - children.push(axisDomain(spec, config, encode.domain, dataRef)); - } - - // include axis title if defined - if (datum.title) { - children.push(axisTitle(spec, config, encode.title, dataRef)); - } - - // parse axis specification - return parseMark( - guideGroup({ - role: AxisRole$1, - from: dataRef, - encode: axisEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); - } - - function buildAxisEncode(_, spec) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value$2(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: {signal: `abs(span(range("${spec.scale}")))`}, - translate: _('translate'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; - } - - function parseScope(spec, scope, preprocessed) { - var signals = array(spec.signals), - scales = array(spec.scales); - - // parse signal definitions, if not already preprocessed - if (!preprocessed) signals.forEach(_ => parseSignal(_, scope)); - - // parse cartographic projection definitions - array(spec.projections).forEach(_ => parseProjection(_, scope)); - - // initialize scale references - scales.forEach(_ => initScale(_, scope)); - - // parse data sources - array(spec.data).forEach(_ => parseData$1(_, scope)); - - // parse scale definitions - scales.forEach(_ => parseScale(_, scope)); - - // parse signal updates - (preprocessed || signals).forEach(_ => parseSignalUpdates(_, scope)); - - // parse axis definitions - array(spec.axes).forEach(_ => parseAxis(_, scope)); - - // parse mark definitions - array(spec.marks).forEach(_ => parseMark(_, scope)); - - // parse legend definitions - array(spec.legends).forEach(_ => parseLegend(_, scope)); - - // parse title, if defined - if (spec.title) parseTitle(spec.title, scope); - - // parse collected lambda (anonymous) expressions - scope.parseLambdas(); - - return scope; - } - - const rootEncode = spec => extendEncode( - { - enter: { - x: {value: 0}, - y: {value: 0} - }, - update: { - width: {signal: 'width'}, - height: {signal: 'height'} - } - }, - spec - ); - - function parseView(spec, scope) { - const config = scope.config; - - // add scenegraph root - const root = ref(scope.root = scope.add(operator())); - - // parse top-level signal definitions - const signals = collectSignals(spec, config); - signals.forEach(_ => parseSignal(_, scope)); - - // assign description, event, legend, and locale configuration - scope.description = spec.description || config.description; - scope.eventConfig = config.events; - scope.legends = scope.objectProperty(config.legend && config.legend.layout); - scope.locale = config.locale; - - // store root group item - const input = scope.add(Collect$1()); - - // encode root group item - const encode = scope.add(Encode$1(parseEncode( - rootEncode(spec.encode), GroupMark, FrameRole$1, - spec.style, scope, {pulse: ref(input)} - ))); - - // perform view layout - const parent = scope.add(ViewLayout$1({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) - })); - scope.operators.pop(); - - // parse remainder of specification - scope.pushState(ref(encode), ref(parent), null); - parseScope(spec, scope, signals); - scope.operators.push(parent); - - // bound / render / sieve root item - let op = scope.add(Bound$1({mark: root, pulse: ref(parent)})); - op = scope.add(Render$1({pulse: ref(op)})); - op = scope.add(Sieve$1({pulse: ref(op)})); - - // track metadata for root item - scope.addData('root', new DataScope(scope, input, input, op)); - - return scope; - } - - function signalObject(name, value) { - return value && value.signal - ? { name, update: value.signal } - : { name, value }; - } - - /** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ - function collectSignals(spec, config) { - const _ = name => value$2(spec[name], config[name]), - signals = [ - signalObject('background', _('background')), - signalObject('autosize', parseAutosize(_('autosize'))), - signalObject('padding', parsePadding(_('padding'))), - signalObject('width', _('width') || 0), - signalObject('height', _('height') || 0) - ], - pre = signals.reduce((p, s) => (p[s.name] = s, p), {}), - map = {}; - - // add spec signal array - array(spec.signals).forEach(s => { - if (hasOwnProperty(pre, s.name)) { - // merge if built-in signal - s = extend(pre[s.name], s); - } else { - // otherwise add to signal list - signals.push(s); - } - map[s.name] = s; - }); - - // add config signal array - array(config.signals).forEach(s => { - if (!hasOwnProperty(map, s.name) && !hasOwnProperty(pre, s.name)) { - // add to signal list if not already defined - signals.push(s); - } - }); - - return signals; - } - - function Scope$1(config, options) { - this.config = config || {}; - this.options = options || {}; - - this.bindings = []; - this.field = {}; - this.signals = {}; - this.lambdas = {}; - this.scales = {}; - this.events = {}; - this.data = {}; - - this.streams = []; - this.updates = []; - this.operators = []; - this.eventConfig = null; - this.locale = null; - - this._id = 0; - this._subid = 0; - this._nextsub = [0]; - - this._parent = []; - this._encode = []; - this._lookup = []; - this._markpath = []; - } - - function Subscope(scope) { - this.config = scope.config; - this.options = scope.options; - this.legends = scope.legends; - - this.field = Object.create(scope.field); - this.signals = Object.create(scope.signals); - this.lambdas = Object.create(scope.lambdas); - this.scales = Object.create(scope.scales); - this.events = Object.create(scope.events); - this.data = Object.create(scope.data); - - this.streams = []; - this.updates = []; - this.operators = []; - - this._id = 0; - this._subid = ++scope._nextsub[0]; - this._nextsub = scope._nextsub; - - this._parent = scope._parent.slice(); - this._encode = scope._encode.slice(); - this._lookup = scope._lookup.slice(); - this._markpath = scope._markpath; - } - - var prototype$1u = Scope$1.prototype = Subscope.prototype; - - // ---- - - prototype$1u.parse = function(spec) { - return parseScope(spec, this); - }; - - prototype$1u.fork = function() { - return new Subscope(this); - }; - - prototype$1u.isSubscope = function() { - return this._subid > 0; - }; - - prototype$1u.toRuntime = function() { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; - }; - - prototype$1u.id = function() { - return (this._subid ? this._subid + ':' : 0) + this._id++; - }; - - prototype$1u.add = function(op) { - this.operators.push(op); - op.id = this.id(); - // if pre-registration references exist, resolve them now - if (op.refs) { - op.refs.forEach(function(ref) { ref.$ref = op.id; }); - op.refs = null; - } - return op; - }; - - prototype$1u.proxy = function(op) { - var vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy$1({value: vref})); - }; - - prototype$1u.addStream = function(stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; - }; - - prototype$1u.addUpdate = function(update) { - this.updates.push(update); - return update; - }; - - // Apply metadata - prototype$1u.finish = function() { - var name, ds; - - // annotate root - if (this.root) this.root.root = true; - - // annotate signals - for (name in this.signals) { - this.signals[name].signal = name; - } - - // annotate scales - for (name in this.scales) { - this.scales[name].scale = name; - } - - // annotate data sets - function annotate(op, name, type) { - var data, list; - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } - } - for (name in this.data) { - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - for (var field in ds.index) { - annotate(ds.index[field], name, 'index:' + field); - } - } - - return this; - }; - - // ---- - - prototype$1u.pushState = function(encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve$1({pulse: encode})))); - this._parent.push(parent); - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - this._markpath.push(-1); - }; - - prototype$1u.popState = function() { - this._encode.pop(); - this._parent.pop(); - this._lookup.pop(); - this._markpath.pop(); - }; - - prototype$1u.parent = function() { - return peek(this._parent); - }; - - prototype$1u.encode = function() { - return peek(this._encode); - }; - - prototype$1u.lookup = function() { - return peek(this._lookup); - }; - - prototype$1u.markpath = function() { - var p = this._markpath; - return ++p[p.length-1]; - }; - - // ---- - - prototype$1u.fieldRef = function(field, name) { - if (isString(field)) return fieldRef(field, name); - if (!field.signal) { - error('Unsupported field reference: ' + $(field)); - } - - var s = field.signal, - f = this.field[s], - params; - - if (!f) { - params = {name: this.signalRef(s)}; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field$1(params))); - } - return f; - }; - - prototype$1u.compareRef = function(cmp) { - function check(_) { - if (isSignal(_)) { - signal = true; - return scope.signalRef(_.signal); - } else if (isExpr(_)) { - signal = true; - return scope.exprRef(_.expr); - } else { - return _; - } - } - - var scope = this, - signal = false, - fields = array(cmp.field).map(check), - orders = array(cmp.order).map(check); - - return signal - ? ref(this.add(Compare$1({fields: fields, orders: orders}))) - : compareRef(fields, orders); - }; - - prototype$1u.keyRef = function(fields, flat) { - function check(_) { - if (isSignal(_)) { - signal = true; - return ref(sig[_.signal]); - } else { - return _; - } - } - - var sig = this.signals, - signal = false; - fields = array(fields).map(check); - - return signal - ? ref(this.add(Key$1({fields: fields, flat: flat}))) - : keyRef(fields, flat); - }; - - prototype$1u.sortRef = function(sort) { - if (!sort) return sort; - - // including id ensures stable sorting - var a = aggrField(sort.op, sort.field), - o = sort.order || Ascending; - - return o.signal - ? ref(this.add(Compare$1({ - fields: a, - orders: this.signalRef(o.signal) - }))) - : compareRef(a, o); - }; - - // ---- - - prototype$1u.event = function(source, type) { - var key = source + ':' + type; - if (!this.events[key]) { - var id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - return this.events[key]; - }; - - // ---- - - prototype$1u.hasOwnSignal = function(name) { - return hasOwnProperty(this.signals, name); - }; - - prototype$1u.addSignal = function(name, value) { - if (this.hasOwnSignal(name)) { - error('Duplicate signal name: ' + $(name)); - } - var op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; - }; - - prototype$1u.getSignal = function(name) { - if (!this.signals[name]) { - error('Unrecognized signal name: ' + $(name)); - } - return this.signals[name]; - }; - - prototype$1u.signalRef = function(s) { - if (this.signals[s]) { - return ref(this.signals[s]); - } else if (!hasOwnProperty(this.lambdas, s)) { - this.lambdas[s] = this.add(operator(null)); - } - return ref(this.lambdas[s]); - }; - - prototype$1u.parseLambdas = function() { - var code = Object.keys(this.lambdas); - for (var i=0, n=code.length; i 0 ? ',' : '') - + (isObject(value) - ? (value.signal || propertyLambda(value)) - : $(value)); - } - return code + ']'; - } - - function objectLambda(obj) { - var code = '{', - i = 0, - key, value; - - for (key in obj) { - value = obj[key]; - code += (++i > 1 ? ',' : '') - + $(key) + ':' - + (isObject(value) - ? (value.signal || propertyLambda(value)) - : $(value)); - } - return code + '}'; - } - - prototype$1u.exprRef = function(code, name) { - var params = {expr: parseExpression$1(code, this)}; - if (name) params.expr.$name = name; - return ref(this.add(Expression$1(params))); - }; - - prototype$1u.addBinding = function(name, bind) { - if (!this.bindings) { - error('Nested signals do not support binding: ' + $(name)); - } - this.bindings.push(extend({signal: name}, bind)); - }; - - // ---- - - prototype$1u.addScaleProj = function(name, transform) { - if (hasOwnProperty(this.scales, name)) { - error('Duplicate scale or projection name: ' + $(name)); - } - this.scales[name] = this.add(transform); - }; - - prototype$1u.addScale = function(name, params) { - this.addScaleProj(name, Scale$1(params)); - }; - - prototype$1u.addProjection = function(name, params) { - this.addScaleProj(name, Projection$1(params)); - }; - - prototype$1u.getScale = function(name) { - if (!this.scales[name]) { - error('Unrecognized scale name: ' + $(name)); - } - return this.scales[name]; - }; - - prototype$1u.projectionRef = - prototype$1u.scaleRef = function(name) { - return ref(this.getScale(name)); - }; - - prototype$1u.projectionType = - prototype$1u.scaleType = function(name) { - return this.getScale(name).params.type; - }; - - // ---- - - prototype$1u.addData = function(name, dataScope) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - return (this.data[name] = dataScope); - }; - - prototype$1u.getData = function(name) { - if (!this.data[name]) { - error('Undefined data set name: ' + $(name)); - } - return this.data[name]; - }; - - prototype$1u.addDataPipeline = function(name, entries) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - return this.addData(name, DataScope.fromEntries(this, entries)); - }; - - /** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ - function defaults() { - const defaultFont = 'sans-serif', - defaultSymbolSize = 30, - defaultStrokeWidth = 2, - defaultColor = '#4c78a8', - black = '#000', - gray = '#888', - lightGray = '#ddd'; - - return { - // default visualization description - description: 'Vega visualization', - - // default padding around visualization - padding: 0, - - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - - // default view background color - // covers the entire view component - background: null, - - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: {allow: ['wheel']} - }, - - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - } - }, - - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 - }, - - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 - }, - - // correction for centering bias - axisBand: { - tickOffset: -0.5 - }, - - // defaults for cartographic projection - projection: { - type: 'mercator' - }, - - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { direction: 'vertical' }, - right: { direction: 'vertical' } - } - }, - - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [1, 0] - }, - symbol: [ - 'circle', - 'square', - 'triangle-up', - 'cross', - 'diamond', - 'triangle-right', - 'triangle-down', - 'triangle-left' - ] - } - }; - } - - function parse$6(spec, config, options) { - if (!isObject(spec)) { - error('Input Vega specification must be an object.'); - } - - config = mergeConfig(defaults(), config, spec.config); - return parseView(spec, new Scope$1(config, options)).toRuntime(); - } - - // -- Transforms ----- - extend(transforms, tx, vtx, encode, geo, force, tree, reg, voronoi, wordcloud, xf); - - exports.Bounds = Bounds; - exports.CanvasHandler = CanvasHandler; - exports.CanvasRenderer = CanvasRenderer; - exports.DATE = DATE; - exports.DAY = DAY; - exports.DAYOFYEAR = DAYOFYEAR; - exports.Dataflow = Dataflow; - exports.Debug = Debug; - exports.Error = Error$1; - exports.EventStream = EventStream; - exports.Gradient = Gradient; - exports.GroupItem = GroupItem; - exports.HOURS = HOURS; - exports.Handler = Handler; - exports.Info = Info; - exports.Item = Item; - exports.MILLISECONDS = MILLISECONDS; - exports.MINUTES = MINUTES; - exports.MONTH = MONTH; - exports.Marks = Marks; - exports.MultiPulse = MultiPulse; - exports.None = None; - exports.Operator = Operator; - exports.Parameters = Parameters; - exports.Pulse = Pulse; - exports.QUARTER = QUARTER; - exports.RenderType = RenderType; - exports.Renderer = Renderer; - exports.ResourceLoader = ResourceLoader; - exports.SECONDS = SECONDS; - exports.SVGHandler = SVGHandler; - exports.SVGRenderer = SVGRenderer; - exports.SVGStringRenderer = SVGStringRenderer; - exports.Scenegraph = Scenegraph; - exports.TIME_UNITS = TIME_UNITS; - exports.Transform = Transform; - exports.View = View; - exports.WEEK = WEEK; - exports.Warn = Warn; - exports.YEAR = YEAR; - exports.accessor = accessor; - exports.accessorFields = accessorFields; - exports.accessorName = accessorName; - exports.array = array; - exports.bandwidthNRD = bandwidthNRD; - exports.bin = bin; - exports.bootstrapCI = bootstrapCI; - exports.boundClip = boundClip; - exports.boundContext = context; - exports.boundItem = boundItem; - exports.boundMark = boundMark; - exports.boundStroke = boundStroke; - exports.changeset = changeset; - exports.clampRange = clampRange; - exports.closeTag = closeTag; - exports.compare = compare; - exports.constant = constant; - exports.cumulativeLogNormal = cumulativeLogNormal; - exports.cumulativeNormal = cumulativeNormal; - exports.cumulativeUniform = cumulativeUniform; - exports.dayofyear = dayofyear; - exports.debounce = debounce; - exports.defaultLocale = defaultLocale; - exports.definition = definition; - exports.densityLogNormal = densityLogNormal; - exports.densityNormal = densityNormal; - exports.densityUniform = densityUniform; - exports.domChild = domChild; - exports.domClear = domClear; - exports.domCreate = domCreate; - exports.domFind = domFind; - exports.dotbin = dotbin; - exports.error = error; - exports.expressionFunction = expressionFunction; - exports.extend = extend; - exports.extent = extent; - exports.extentIndex = extentIndex; - exports.falsy = falsy; - exports.fastmap = fastmap; - exports.field = field; - exports.flush = flush; - exports.font = font; - exports.fontFamily = fontFamily; - exports.fontSize = fontSize; - exports.format = format; - exports.formatLocale = numberFormatDefaultLocale; - exports.formats = formats; - exports.hasOwnProperty = hasOwnProperty; - exports.id = id; - exports.identity = identity; - exports.inferType = inferType; - exports.inferTypes = inferTypes; - exports.ingest = ingest; - exports.inherits = inherits; - exports.inrange = inrange; - exports.interpolate = interpolate; - exports.interpolateColors = interpolateColors; - exports.interpolateRange = interpolateRange; - exports.intersect = intersect; - exports.intersectBoxLine = intersectBoxLine; - exports.intersectPath = intersectPath; - exports.intersectPoint = intersectPoint; - exports.intersectRule = intersectRule; - exports.isArray = isArray; - exports.isBoolean = isBoolean; - exports.isDate = isDate; - exports.isFunction = isFunction; - exports.isNumber = isNumber; - exports.isObject = isObject; - exports.isRegExp = isRegExp; - exports.isString = isString; - exports.isTuple = isTuple; - exports.key = key; - exports.lerp = lerp; - exports.lineHeight = lineHeight; - exports.loader = loader; - exports.locale = locale; - exports.logger = logger; - exports.lruCache = lruCache; - exports.merge = merge; - exports.mergeConfig = mergeConfig; - exports.multiLineOffset = multiLineOffset; - exports.one = one; - exports.openTag = openTag; - exports.pad = pad; - exports.panLinear = panLinear; - exports.panLog = panLog; - exports.panPow = panPow; - exports.panSymlog = panSymlog; - exports.parse = parse$6; - exports.pathCurves = curves; - exports.pathEqual = pathEqual; - exports.pathParse = pathParse; - exports.pathRectangle = vg_rect; - exports.pathRender = pathRender; - exports.pathSymbols = symbols; - exports.pathTrail = vg_trail; - exports.peek = peek; - exports.point = point; - exports.projection = projection; - exports.quantileLogNormal = quantileLogNormal; - exports.quantileNormal = quantileNormal; - exports.quantileUniform = quantileUniform; - exports.quantiles = quantiles; - exports.quantizeInterpolator = quantizeInterpolator; - exports.quarter = quarter; - exports.quartiles = quartiles; - exports.randomInteger = integer; - exports.randomKDE = randomKDE; - exports.randomLCG = lcg; - exports.randomLogNormal = randomLogNormal; - exports.randomMixture = randomMixture; - exports.randomNormal = randomNormal; - exports.randomUniform = randomUniform; - exports.read = read; - exports.regressionExp = regressionExp; - exports.regressionLinear = regressionLinear; - exports.regressionLoess = regressionLoess; - exports.regressionLog = regressionLog; - exports.regressionPoly = regressionPoly; - exports.regressionPow = regressionPow; - exports.regressionQuad = regressionQuad; - exports.renderModule = renderModule; - exports.repeat = repeat; - exports.resetDefaultLocale = resetDefaultLocale; - exports.resetSVGClipId = resetSVGClipId; - exports.resetSVGDefIds = resetSVGDefIds; - exports.responseType = responseType; - exports.runtimeContext = context$2; - exports.sampleCurve = sampleCurve; - exports.sampleLogNormal = sampleLogNormal; - exports.sampleNormal = sampleNormal; - exports.sampleUniform = sampleUniform; - exports.scale = scale$2; - exports.sceneEqual = sceneEqual; - exports.sceneFromJSON = sceneFromJSON; - exports.scenePickVisit = pickVisit; - exports.sceneToJSON = sceneToJSON; - exports.sceneVisit = visit; - exports.sceneZOrder = zorder; - exports.scheme = scheme; - exports.setRandom = setRandom; - exports.span = span; - exports.splitAccessPath = splitAccessPath; - exports.stringValue = $; - exports.textMetrics = textMetrics; - exports.timeBin = timeBin; - exports.timeFloor = timeFloor; - exports.timeFormatLocale = timeFormatDefaultLocale; - exports.timeInterval = timeInterval; - exports.timeOffset = timeOffset; - exports.timeSequence = timeSequence; - exports.timeUnitSpecifier = timeUnitSpecifier; - exports.timeUnits = timeUnits; - exports.toBoolean = toBoolean; - exports.toDate = toDate; - exports.toNumber = toNumber; - exports.toSet = toSet; - exports.toString = toString; - exports.transform = transform; - exports.transforms = transforms; - exports.truncate = truncate; - exports.truthy = truthy; - exports.tupleid = tupleid; - exports.typeParsers = typeParsers; - exports.utcFloor = utcFloor; - exports.utcInterval = utcInterval; - exports.utcOffset = utcOffset; - exports.utcSequence = utcSequence; - exports.utcdayofyear = utcdayofyear; - exports.utcquarter = utcquarter; - exports.utcweek = utcweek; - exports.version = version; - exports.visitArray = visitArray; - exports.week = week; - exports.writeConfig = writeConfig; - exports.zero = zero; - exports.zoomLinear = zoomLinear; - exports.zoomLog = zoomLog; - exports.zoomPow = zoomPow; - exports.zoomSymlog = zoomSymlog; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega/build/vega-core.min.js b/node_modules/vega/build/vega-core.min.js deleted file mode 100644 index 453c7f6..0000000 --- a/node_modules/vega/build/vega-core.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-dsv"),require("topojson-client"),require("d3-format"),require("d3-time"),require("d3-time-format"),require("d3-shape"),require("d3-path"),require("d3-interpolate"),require("d3-geo"),require("d3-color"),require("d3-force"),require("d3-hierarchy"),require("d3-timer")):"function"==typeof define&&define.amd?define(["exports","d3-dsv","topojson-client","d3-format","d3-time","d3-time-format","d3-shape","d3-path","d3-interpolate","d3-geo","d3-color","d3-force","d3-hierarchy","d3-timer"],e):e((t=t||self).vega={},t.d3,t.topojson,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(this,(function(t,e,n,r,i,a,o,u,s,l,c,f,d,h){"use strict";function p(t,e,n){return t.fields=e||[],t.fname=n,t}function m(t){return null==t?null:t.fname}function g(t){return null==t?null:t.fields}function v(t){return 1===t.length?y(t[0]):b(t)}const y=t=>function(e){return e[t]},b=t=>{const e=t.length;return function(n){for(let r=0;re&&l(),o=e=n+1):"]"===r&&(o||x("Access path missing open bracket: "+t),o>0&&l(),o=0,e=n+1):n>e?l():e=n+1}return o&&x("Access path missing closing bracket: "+t),a&&x("Access path missing closing quote: "+t),n>e&&(n++,l()),i}function A(t,e,n){const r=_(t);return t=1===r.length?r[0]:t,p((n&&n.get||v)(r),[t],e||t)}var k=[],w=A("id"),D=p((function(t){return t}),k,"identity"),M=p((function(){return 0}),k,"zero"),C=p((function(){return 1}),k,"one"),E=p((function(){return!0}),k,"true"),F=p((function(){return!1}),k,"false");function S(t,e,n){var r=[e].concat([].slice.call(n));console[t].apply(console,r)}function B(t,e){var n=t||0;return{level:function(t){return arguments.length?(n=+t,this):n},error:function(){return n>=1&&S(e||"error","ERROR",arguments),this},warn:function(){return n>=2&&S(e||"warn","WARN",arguments),this},info:function(){return n>=3&&S(e||"log","INFO",arguments),this},debug:function(){return n>=4&&S(e||"log","DEBUG",arguments),this}}}var O=Array.isArray;function z(t){return t===Object(t)}const R=t=>"__proto__"!==t;function T(...t){return t.reduce((t,e)=>{for(var n in e)if("signals"===n)t.signals=$(t.signals,e.signals);else{var r="legend"===n?{layout:1}:"style"===n||null;q(t,n,e[n],r)}return t},{})}function q(t,e,n,r){var i,a;if(R(e))if(z(n)&&!O(n))for(i in a=z(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?q(a,i,n[i]):R(i)&&(a[i]=n[i]);else t[e]=n}function $(t,e){if(null==t)return e;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}function L(t){return t[t.length-1]}function N(t){return null==t||""===t?null:+t}function U(t){return function(e){return t*Math.exp(e)}}function P(t){return function(e){return Math.log(t*e)}}function j(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function I(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function W(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function H(t,e,n,r){var i=n(t[0]),a=n(L(t)),o=(a-i)*e;return[r(i-o),r(a-o)]}function G(t,e){return H(t,e,N,D)}function Y(t,e){var n=Math.sign(t[0]);return H(t,e,P(n),U(n))}function V(t,e,n){return H(t,e,W(n),W(1/n))}function X(t,e,n){return H(t,e,j(n),I(n))}function J(t,e,n,r,i){var a=r(t[0]),o=r(L(t)),u=null!=e?r(e):(a+o)/2;return[i(u+(a-u)*n),i(u+(o-u)*n)]}function K(t,e,n){return J(t,e,n,N,D)}function Q(t,e,n){var r=Math.sign(t[0]);return J(t,e,n,P(r),U(r))}function Z(t,e,n,r){return J(t,e,n,W(r),W(1/r))}function tt(t,e,n,r){return J(t,e,n,j(r),I(r))}function et(t){return 1+~~(new Date(t).getMonth()/3)}function nt(t){return 1+~~(new Date(t).getUTCMonth()/3)}function rt(t){return null!=t?O(t)?t:[t]:[]}function it(t,e,n){var r,i=t[0],a=t[1];return a=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]}function at(t){return"function"==typeof t}function ot(t,e,n){n=n||{},e=rt(e)||[];const r=[],i=[],a={},o=n.comparator||st;return rt(t).forEach((t,o)=>{null!=t&&(r.push("descending"===e[o]?-1:1),i.push(t=at(t)?t:A(t,null,n)),(g(t)||[]).forEach(t=>a[t]=1))}),0===i.length?null:p(o(i,r),Object.keys(a))}const ut=(t,e)=>(te||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0),st=(t,e)=>1===t.length?lt(t[0],e[0]):ct(t,e,t.length),lt=(t,e)=>function(n,r){return ut(t(n),t(r))*e},ct=(t,e,n)=>(e.push(0),function(r,i){let a,o=0,u=-1;for(;0===o&&++ua&&(a=r))}else{for(r=e(t[o]);oa&&(a=r))}return[i,a]}function mt(t,e){var n,r,i,a,o,u=-1,s=t.length;if(null==e){for(;++u=r){n=i=r;break}if(u===s)return[-1,-1];for(a=o=u;++ur&&(n=r,a=u),i=r){n=i=r;break}if(u===s)return[-1,-1];for(a=o=u;++ur&&(n=r,a=u),ii(t)?r[t]:void 0,set(t,n){return i(t)||(++e.size,r[t]===yt&&--e.empty),r[t]=n,this},delete(t){return i(t)&&(--e.size,++e.empty,r[t]=yt),this},clear(){e.size=e.empty=0,e.object=r={}},test(t){return arguments.length?(n=t,e):n},clean(){var t,i,a={},o=0;for(t in r)(i=r[t])===yt||n&&n(i)||(a[t]=i,++o);e.size=o,e.empty=0,e.object=r=a}},t&&Object.keys(t).forEach((function(n){e.set(n,t[n])})),e}function xt(t,e,n,r,i,a){if(!n&&0!==n)return a;var o,u,s=t[0],l=L(t),c=+n;return lo&&(i=a,a=o,o=i),r=void 0===r||r,((n=void 0===n||n)?a<=t:at.replace(/\\(.)/g,"$1")):rt(t));const r=t&&t.length,i=n&&n.get||v,a=t=>i(e?[t]:_(t));let o;if(r)if(1===r){const e=a(t[0]);o=function(t){return""+e(t)}}else{const e=t.map(a);o=function(t){let n=""+e[0](t),i=0;for(;++i{e={},n={},r=0},a=(i,a)=>(++r>t&&(n=e,e={},r=1),e[i]=a);return i(),{clear:i,has:t=>vt(e,t)||vt(n,t),get:t=>vt(e,t)?e[t]:vt(n,t)?a(t,n[t]):void 0,set:(t,n)=>vt(e,t)?e[t]=n:a(t,n)}}function Bt(t,e,n,r){var i=e.length,a=n.length;if(!a)return e;if(!i)return n;for(var o=r||new e.constructor(i+a),u=0,s=0,l=0;u0?n[s++]:e[u++];for(;u=0;)n+=t;return n}function zt(t,e,n,r){var i=n||" ",a=t+"",o=e-a.length;return o<=0?a:"left"===r?Ot(i,o)+a:"center"===r?Ot(i,~~(o/2))+a+Ot(i,Math.ceil(o/2)):a+Ot(i,o)}function Rt(t){return t&&L(t)-t[0]||0}function Tt(t){return O(t)?"["+t.map(Tt)+"]":z(t)||Ct(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function qt(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}function $t(t){return Dt(t)||wt(t)?t:Date.parse(t)}function Lt(t,e){return e=e||$t,null==t||""===t?null:e(t)}function Nt(t){return null==t||""===t?null:t+""}function Ut(t){for(var e={},n=0,r=t.length;n=0&&n.splice(i,1)),n},n}async function Wt(t,e){try{await e(t)}catch(e){t.error(e)}}var Ht=Symbol("vega_id"),Gt=1;function Yt(t){return!(!t||!Vt(t))}function Vt(t){return t[Ht]}function Xt(t,e){return t[Ht]=e,t}function Jt(t){var e=t===Object(t)?t:{data:t};return Vt(e)?e:Xt(e,Gt++)}function Kt(t){return Qt(t,Jt({}))}function Qt(t,e){for(var n in t)e[n]=t[n];return e}function Zt(t,e){return Xt(e,Vt(t))}function te(t,e){return t?e?(n,r)=>t(n,r)||Vt(e(n))-Vt(e(r)):(e,n)=>t(e,n)||Vt(e)-Vt(n):null}function ee(t){return t&&t.constructor===ne}function ne(){var t=[],e=[],n=[],r=[],i=[],a=null,o=!1;return{constructor:ne,insert:function(e){for(var n=rt(e),r=0,i=n.length;r0&&(v(h,d,f.value),u.modifies(d));for(l=0,c=i.length;l0&&v(t,f.field,f.value)})),u.modifies(f.field);if(o)u.mod=e.length||r.length?s.filter((function(t){return m[Vt(t)]>0})):s.slice();else for(p in g)u.mod.push(g[p]);return(a||null==a&&(e.length||r.length))&&u.clean(!0),u}}}var re="_:mod:_";function ie(){Object.defineProperty(this,re,{writable:!0,value:{}})}var ae=ie.prototype;ae.set=function(t,e,n,r){var i=this,a=i[t],o=i[re];return null!=e&&e>=0?(a[e]!==n||r)&&(a[e]=n,o[e+":"+t]=-1,o[t]=-1):(a!==n||r)&&(i[t]=n,o[t]=O(n)?1+n.length:-1),i},ae.modified=function(t,e){var n,r=this[re];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(O(t)){for(n=0;n=0?e+1t?(e=n,1):0}))},pe.debounce=function(t){var e=he();return this.targets().add(he(null,null,dt(t,(function(t){var n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},pe.between=function(t,e){var n=!1;return t.targets().add(he(null,null,(function(){n=!0}))),e.targets().add(he(null,null,(function(){n=!1}))),this.filter((function(){return n}))};const me=/^([A-Za-z]+:)?\/\//,ge=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,ve=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function ye(t,e){const n=await this.sanitize(t,e),r=n.href;return n.localFile?this.file(r):this.http(r,e)}async function be(t,e){e=ht({},this.options,e);const n=this.fileAccess,r={href:null};let i,a,o;const u=ge.test(t.replace(ve,""));null!=t&&"string"==typeof t&&u||x("Sanitize failure, invalid URI: "+Tt(t));const s=me.test(t);return(o=e.baseURL)&&!s&&(t.startsWith("/")||"/"===o[o.length-1]||(t="/"+t),t=o+t),a=(i=t.startsWith("file://"))||"file"===e.mode||"http"!==e.mode&&!s&&n,i?t=t.slice("file://".length):t.startsWith("//")&&("file"===e.defaultProtocol?(t=t.slice(2),a=!0):t=(e.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!a}),r.href=t,e.target&&(r.target=e.target+""),e.rel&&(r.rel=e.rel+""),"image"===e.context&&e.crossOrigin&&(r.crossOrigin=e.crossOrigin+""),r}function xe(t){return t?function(e){return new Promise((function(n,r){t.readFile(e,(function(t,e){t?r(t):n(e)}))}))}:_e}async function _e(){x("No file system access.")}function Ae(t){return t?async function(e,n){const r=ht({},this.options.http,n),i=n&&n.response,a=await t(e,r);return a.ok?at(a[i])?a[i]():a.text():x(a.status+""+a.statusText)}:ke}async function ke(){x("No HTTP fetch method available.")}var we={boolean:qt,integer:N,number:N,date:Lt,string:Nt,unknown:D},De=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return Fe(t)&&Number.isInteger(+t)},Fe,function(t){return!Number.isNaN(Date.parse(t))}],Me=["boolean","integer","number","date"];function Ce(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=De.length,i=De.map((t,e)=>e+1);for(let o,u,s=0,l=0;s0===t?e:t,0)-1]}function Ee(t,e){return e.reduce((function(e,n){return e[n]=Ce(t,n),e}),{})}function Fe(t){return!(Number.isNaN(+t)||t instanceof Date)}function Se(t){const e=function(e,n){const r={delimiter:t};return Be(e,n?ht(n,r):r)};return e.responseType="text",e}function Be(t,n){return n.header&&(t=n.header.map(Tt).join(n.delimiter)+"\n"+t),e.dsvFormat(n.delimiter).parse(t+"")}function Oe(t,e){const n=e&&e.property?A(e.property):D;return!z(t)||(r=t,"function"==typeof Buffer&&at(Buffer.isBuffer)&&Buffer.isBuffer(r))?n(JSON.parse(t)):function(t,e){return e&&e.copy?JSON.parse(JSON.stringify(t)):t}(n(t));var r}Be.responseType="text",Oe.responseType="json";const ze={interior:(t,e)=>t!==e,exterior:(t,e)=>t===e};function Re(t,e){let r,i,a,o;return t=Oe(t,e),e&&e.feature?(r=n.feature,a=e.feature):e&&e.mesh?(r=n.mesh,a=e.mesh,o=ze[e.filter]):x("Missing TopoJSON feature or mesh parameter."),i=(i=t.objects[a])?r(t,i,o):x("Invalid TopoJSON object: "+a),i&&i.features||[i]}Re.responseType="json";const Te={dsv:Be,csv:Se(","),tsv:Se("\t"),json:Oe,topojson:Re};function qe(t,e){return arguments.length>1?(Te[t]=e,this):vt(Te,t)?Te[t]:null}function $e(t){const e=qe(t);return e&&e.responseType||"text"}function Le(t){const e={};return n=>e[n]||(e[n]=t(n))}function Ne(t,e){return te?1:t>=e?0:NaN}function Ue(t){var e;return 1===t.length&&(e=t,t=function(t,n){return Ne(e(t),n)}),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}var Pe=Ue(Ne),je=Pe.right,Ie=Pe.left;function We(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r0)return[t];if((r=e0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++u=0?(a>=He?10:a>=Ge?5:a>=Ye?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=He?10:a>=Ge?5:a>=Ye?2:1)}function Je(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=He?i*=10:a>=Ge?i*=5:a>=Ye&&(i*=2),e=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function Qe(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function Ze(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function tn(t){return null===t?NaN:+t}function en(t,e,n){if(r=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n))).length){if((e=+e)<=0||r<2)return Qe(t);if(e>=1)return Ke(t);var r,i=(r-1)*e,a=Math.floor(i),o=Ke(function t(e,n,r=0,i=e.length-1,a=Ne){for(;i>r;){if(i-r>600){const o=i-r+1,u=n-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(u-o/2<0?-1:1);t(e,n,Math.max(r,Math.floor(n-u*l/o+c)),Math.min(i,Math.floor(n+(o-u)*l/o+c)),a)}const o=e[n];let u=r,s=i;for(Ze(e,r,n),a(e[i],o)>0&&Ze(e,r,i);u0;)--s}0===a(e[r],o)?Ze(e,r,s):(++s,Ze(e,s,i)),s<=n&&(r=s+1),n<=s&&(i=s-1)}return e}(t,a).subarray(0,a+1));return o+(Qe(t.subarray(a+1))-o)*(i-a)}}function nn(t,e){return en(t,.5,e)}function rn(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n}function an(t){const e=Le(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){var n,i,a=r.formatSpecifier(t||",");if(null==a.precision){switch(a.precision=12,a.type){case"%":a.precision-=2;break;case"e":a.precision-=1}return n=e(a),i=e(".1f")(1)[1],t=>{var e,r,a=n(t),o=a.indexOf(i);if(o<0)return a;for(r=(e=function(t,e){var n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if((n=t.charCodeAt(r))>=48&&n<=57)return r+1}(a,o))o;)if("0"!==a[e]){++e;break}return a.slice(0,e)+r}}return e(a)},formatSpan(t,i,a,o){o=r.formatSpecifier(null==o?",f":o);const u=Je(t,i,a),s=Math.max(Math.abs(t),Math.abs(i));let l;if(null==o.precision)switch(o.type){case"s":return isNaN(l=r.precisionPrefix(u,s))||(o.precision=l),n(o,s);case"":case"e":case"g":case"p":case"r":isNaN(l=r.precisionRound(u,s))||(o.precision=l-("e"===o.type));break;case"f":case"%":isNaN(l=r.precisionFixed(u))||(o.precision=l-2*("%"===o.type))}return e(o)}}}let on;function un(){return on=an({format:r.format,formatPrefix:r.formatPrefix})}function sn(t){return an(r.formatLocale(t))}function ln(t){return arguments.length?on=sn(t):on}un();const cn="year",fn="quarter",dn="month",hn="week",pn="date",mn="day",gn="hours",vn="minutes",yn="seconds",bn=[cn,fn,dn,hn,pn,mn,"dayofyear",gn,vn,yn,"milliseconds"],xn=bn.reduce((t,e,n)=>(t[e]=1+n,t),{});function _n(t){const e=rt(t).slice(),n={};e.length||x("Missing time unit."),e.forEach(t=>{vt(xn,t)?n[t]=1:x(`Invalid time unit: ${t}.`)});return(n[hn]||n.day?1:0)+(n[fn]||n[dn]||n[pn]?1:0)+(n.dayofyear?1:0)>1&&x("Incompatible time units: "+t),e.sort((t,e)=>xn[t]-xn[e]),e}const An={[cn]:"%Y ",[fn]:"Q%q ",[dn]:"%b ",[pn]:"%d ",[hn]:"W%U ",[mn]:"%a ",dayofyear:"%j ",[gn]:"%H:00",[vn]:"00:%M",[yn]:":%S",milliseconds:".%L","year-month":"%Y-%m ","year-month-date":"%Y-%m-%d ",["hours-"+vn]:"%H:%M"};function kn(t,e){const n=ht({},An,e),r=_n(t),i=r.length;let a,o,u="",s=0;for(s=0;ss;--a)if(o=r.slice(s,a).join("-"),null!=n[o]){u+=n[o],s=a;break}return u.trim()}const wn=new Date;function Dn(t){return wn.setFullYear(t),wn.setMonth(0),wn.setDate(1),wn.setHours(0,0,0,0),wn}function Mn(t){return En(new Date(t))}function Cn(t){return Fn(new Date(t))}function En(t){return i.timeDay.count(Dn(t.getFullYear())-1,t)}function Fn(t){return i.timeWeek.count(Dn(t.getFullYear())-1,t)}function Sn(t){return Dn(t).getDay()}function Bn(t,e,n,r,i,a,o){if(0<=t&&t<100){var u=new Date(-1,e,n,r,i,a,o);return u.setFullYear(t),u}return new Date(t,e,n,r,i,a,o)}function On(t){return Rn(new Date(t))}function zn(t){return Tn(new Date(t))}function Rn(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return i.utcDay.count(e-1,t)}function Tn(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return i.utcWeek.count(e-1,t)}function qn(t){return wn.setTime(Date.UTC(t,0,1)),wn.getUTCDay()}function $n(t,e,n,r,i,a,o){if(0<=t&&t<100){var u=new Date(Date.UTC(-1,e,n,r,i,a,o));return u.setUTCFullYear(n.y),u}return new Date(Date.UTC(t,e,n,r,i,a,o))}function Ln(t,e,n,r,i){const a=e||1,o=L(t),u=(t,e,i)=>function(t,e,n,r){const i=n<=1?t:r?(e,i)=>r+n*Math.floor((t(e,i)-r)/n):(e,r)=>n*Math.floor(t(e,r)/n);return e?(t,n)=>e(i(t,n),n):i}(n[i=i||t],r[i],t===o&&a,e),s=new Date,l=Ut(t),c=l[cn]?u(cn):ft(2012),f=l[dn]?u(dn):l[fn]?u(fn):M,d=l[hn]&&l.day?u(mn,1,hn+mn):l[hn]?u(hn,1):l.day?u(mn,1):l[pn]?u(pn,1):l.dayofyear?u("dayofyear",1):C,h=l[gn]?u(gn):M,p=l[vn]?u(vn):M,m=l[yn]?u(yn):M,g=l.milliseconds?u("milliseconds"):M;return function(t){s.setTime(+t);const e=c(s);return i(e,f(s),d(s,e),h(s),p(s),m(s),g(s))}}function Nn(t,e,n){return e+7*t-(n+6)%7}const Un={[cn]:t=>t.getFullYear(),[fn]:t=>Math.floor(t.getMonth()/3),[dn]:t=>t.getMonth(),[pn]:t=>t.getDate(),[gn]:t=>t.getHours(),[vn]:t=>t.getMinutes(),[yn]:t=>t.getSeconds(),milliseconds:t=>t.getMilliseconds(),dayofyear:t=>En(t),[hn]:t=>Fn(t),[hn+mn]:(t,e)=>Nn(Fn(t),t.getDay(),Sn(e)),[mn]:(t,e)=>Nn(1,t.getDay(),Sn(e))},Pn={[fn]:t=>3*t,[hn]:(t,e)=>Nn(t,0,Sn(e))};function jn(t,e){return Ln(t,e||1,Un,Pn,Bn)}const In={[cn]:t=>t.getUTCFullYear(),[fn]:t=>Math.floor(t.getUTCMonth()/3),[dn]:t=>t.getUTCMonth(),[pn]:t=>t.getUTCDate(),[gn]:t=>t.getUTCHours(),[vn]:t=>t.getUTCMinutes(),[yn]:t=>t.getUTCSeconds(),milliseconds:t=>t.getUTCMilliseconds(),dayofyear:t=>Rn(t),[hn]:t=>Tn(t),[mn]:(t,e)=>Nn(1,t.getUTCDay(),qn(e)),[hn+mn]:(t,e)=>Nn(Tn(t),t.getUTCDay(),qn(e))},Wn={[fn]:t=>3*t,[hn]:(t,e)=>Nn(t,0,qn(e))};function Hn(t,e){return Ln(t,e||1,In,Wn,$n)}const Gn={[cn]:i.timeYear,[fn]:i.timeMonth.every(3),[dn]:i.timeMonth,[hn]:i.timeWeek,[pn]:i.timeDay,[mn]:i.timeDay,dayofyear:i.timeDay,[gn]:i.timeHour,[vn]:i.timeMinute,[yn]:i.timeSecond,milliseconds:i.timeMillisecond},Yn={[cn]:i.utcYear,[fn]:i.utcMonth.every(3),[dn]:i.utcMonth,[hn]:i.utcWeek,[pn]:i.utcDay,[mn]:i.utcDay,dayofyear:i.utcDay,[gn]:i.utcHour,[vn]:i.utcMinute,[yn]:i.utcSecond,milliseconds:i.utcMillisecond};function Vn(t){return Gn[t]}function Xn(t){return Yn[t]}function Jn(t,e,n){return t?t.offset(e,n):void 0}function Kn(t,e,n){return Jn(Vn(t),e,n)}function Qn(t,e,n){return Jn(Xn(t),e,n)}function Zn(t,e,n,r){return t?t.range(e,n,r):void 0}function tr(t,e,n,r){return Zn(Vn(t),e,n,r)}function er(t,e,n,r){return Zn(Xn(t),e,n,r)}const nr=[cn,dn,pn,gn,vn,yn,"milliseconds"],rr=nr.slice(0,-1),ir=rr.slice(0,-1),ar=ir.slice(0,-1),or=ar.slice(0,-1),ur=[cn,dn],sr=[cn],lr=[[rr,1,1e3],[rr,5,5e3],[rr,15,15e3],[rr,30,3e4],[ir,1,6e4],[ir,5,3e5],[ir,15,9e5],[ir,30,18e5],[ar,1,36e5],[ar,3,108e5],[ar,6,216e5],[ar,12,432e5],[or,1,864e5],[[cn,hn],1,6048e5],[ur,1,2592e6],[ur,3,7776e6],[sr,1,31536e6]];function cr(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(Rt(e))/n;let i,a,o=Ue(t=>t[2]).right(lr,r);return o===lr.length?(i=sr,a=Je(e[0]/31536e6,e[1]/31536e6,n)):o?(o=lr[r/lr[o-1][2](r(t)Ct(t)?e(t):fr(e,Vn,t),utcFormat:t=>Ct(t)?n(t):fr(n,Xn,t),timeParse:Le(t.parse),utcParse:Le(t.utcParse)}}let hr;function pr(){return hr=dr({format:a.timeFormat,parse:a.timeParse,utcFormat:a.utcFormat,utcParse:a.utcParse})}function mr(t){return dr(a.timeFormatLocale(t))}function gr(t){return arguments.length?hr=mr(t):hr}pr();const vr=(t,e)=>ht({},t,e);function yr(t,e){const n=t?sn(t):ln(),r=e?mr(e):gr();return vr(n,r)}function br(t,e){const n=arguments.length;return n&&2!==n&&x("defaultLocale expects either zero or two arguments."),n?vr(ln(t),gr(e)):vr(ln(),gr())}function xr(t,e,n,r){const i=qe((e=e||{}).type||"json");return i||x("Unknown data format type: "+e.type),t=i(t,e),e.parse&&function(t,e,n,r){if(!t.length)return;const i=gr();n=n||i.timeParse,r=r||i.utcParse;var a,o,u,s,l,c,f,d=t.columns||Object.keys(t[0]);"auto"===e&&(e=Ee(t,d));for(d=Object.keys(e),a=d.map((function(t){var i,a,o=e[t];if(o&&(o.startsWith("date:")||o.startsWith("utc:"))){("'"===(a=(i=o.split(/:(.+)?/,2))[1])[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1));return("utc"===i[0]?r:n)(a)}if(!we[o])throw Error("Illegal format pattern: "+t+":"+o);return we[o]})),s=0,c=t.length,f=d.length;st.touch(n(e)):at(r)?(u=new se(null,r,i,!1),o=e=>{u.evaluate(e);const r=n(e),i=u.value;ee(i)?t.pulse(r,i,a):t.update(r,i,s)}):o=e=>t.update(n(e),r,s),e.apply(o)}function wr(t,e,n,r,i,a){if(void 0===r)e.targets().add(n);else{const o=a||{},u=new se(null,function(t,e){return e=at(e)?e:ft(e),t?function(n,r){const i=e(n,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:e}(n,r),i,!1);u.modified(o.force),u.rank=e.rank,e.targets().add(u),n&&(u.skip(!0),u.value=n.value,u.targets().add(n),t.connect(n,[u]))}}const Dr={};function Mr(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}const Cr=Mr.prototype;function Er(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function Fr(t,e){var n=[];return jt(t,e,t=>n.push(t)),n}function Sr(t,e){var n={};return t.visit(e,(function(t){n[Vt(t)]=1})),t=>n[Vt(t)]?null:t}function Br(t,e,n,r){var i,a,o,u,s,l=this,c=0;for(this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n,o=0,u=n.length;oe[t]=!0):e[t]=!0,this},Cr.modified=function(t,e){var n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?O(t)?t.some(t=>n[t]):n[t]:!!n)},Cr.filter=function(t,e){var n=this;return 1&t&&(n.addF=Er(n.addF,e)),2&t&&(n.remF=Er(n.remF,e)),4&t&&(n.modF=Er(n.modF,e)),16&t&&(n.srcF=Er(n.srcF,e)),n},Cr.materialize=function(t){var e=this;return 1&(t=t||7)&&e.addF&&(e.add=Fr(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=Fr(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=Fr(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},Cr.visit=function(t,e){var n,r,i=this,a=e;return 16&t?(jt(i.source,i.srcF,a),i):(1&t&&jt(i.add,i.addF,a),2&t&&jt(i.rem,i.remF,a),4&t&&jt(i.mod,i.modF,a),8&t&&(n=i.source)&&((r=i.add.length+i.mod.length)===n.length||jt(n,r?Sr(i,5):i.srcF,a)),i)};var Or=_t(Br,Mr);function zr(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}Or.fork=function(t){var e=new Mr(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(function(t){return e.add.push(t)})),t&e.REM&&this.visit(e.REM,(function(t){return e.rem.push(t)})),t&e.MOD&&this.visit(e.MOD,(function(t){return e.mod.push(t)}))),e},Or.changed=function(t){return this.changes&t},Or.modified=function(t){var e=this,n=e.fields;return n&&e.changes&e.MOD?O(t)?t.some((function(t){return n[t]})):n[t]:0},Or.filter=function(){x("MultiPulse does not support filtering.")},Or.materialize=function(){x("MultiPulse does not support materialization.")},Or.visit=function(t,e){var n=this,r=n.pulses,i=r.length,a=0;if(t&n.SOURCE)for(;ae=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),qr(e,0,e.length-1,t)),pop:()=>{var n,r=e.pop();return e.length?(n=e[0],e[0]=r,function(t,e,n){var r,i=e,a=t.length,o=t[e],u=1+(e<<1);for(;u=0&&(u=r),t[e]=t[u],u=1+((e=u)<<1);t[e]=o,qr(t,i,e,n)}(e,0,t)):n=r,n}}}function qr(t,e,n,r){var i,a,o;for(i=t[n];n>e&&r(i,a=t[o=n-1>>1])<0;)t[n]=a,n=o;return t[n]=i}function $r(){this.logger(B()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=br();try{this._loader=_r()}catch(t){}this._touched=It(w),this._input={},this._pulse=null,this._heap=Tr((t,e)=>t.qrank-e.qrank),this._postrun=[]}var Lr=$r.prototype;function Nr(t){return function(){return this._log[t].apply(this,arguments)}}function Ur(t,e){se.call(this,t,null,e)}Lr.stamp=function(){return this._clock},Lr.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},Lr.locale=function(t){return arguments.length?(this._locale=t,this):this._locale},Lr.cleanThreshold=1e4,Lr.add=function(t,e,n,r){var i,a=1;return t instanceof se?i=t:t&&t.prototype instanceof se?i=new t:at(t)?i=new se(null,t):(a=0,i=new se(t,e)),this.rank(i),a&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},Lr.connect=function(t,e){var n,r,i=t.rank;for(n=0,r=e.length;n=0;)i.push(e=n[r]),e===t&&x("Cycle detected in dataflow graph.")},Lr.pulse=function(t,e,n){this.touch(t,n||Rr);var r=new Mr(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,i),this},Lr.touch=function(t,e){var n=e||Rr;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},Lr.update=function(t,e,n){var r=n||Rr;return(t.set(e)||r.force)&&this.touch(t,r),this},Lr.changeset=ne,Lr.ingest=function(t,e,n){return e=this.parse(e,n),this.pulse(t,this.changeset().insert(e))},Lr.parse=function(t,e){const n=this.locale();return xr(t,e,n.timeParse,n.utcParse)},Lr.preload=async function(t,e,n){const r=this,i=r._pending||function(t){var e,n=new Promise((function(t){e=t}));return n.requests=0,n.done=function(){0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(r);i.requests+=1;const a=await r.request(e,n);return r.pulse(t,r.changeset().remove(E).insert(a.data||[])),i.done(),a},Lr.request=async function(t,e){const n=this;let r,i=0;try{r=await n.loader().load(t,{context:"dataflow",response:$e(e&&e.type)});try{r=n.parse(r,e)}catch(e){i=-2,n.warn("Data ingestion failed",t,e)}}catch(e){i=-1,n.warn("Loading failed",t,e)}return{data:r,status:i}},Lr.events=function(t,e,n,r){for(var i,a=this,o=he(n,r),u=function(t){t.dataflow=a;try{o.receive(t)}catch(t){a.error(t)}finally{a.run()}},s=0,l=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):rt(t)).length;sr._enqueue(t,!0)),r._touched=It(w);let o,u,s,l=0;try{for(;r._heap.size()>0;)o=r._heap.pop(),o.rank===o.qrank?(u=o.run(r._getPulse(o,t)),u.then?u=await u:u.async&&(i.push(u.async),u=Dr),u!==Dr&&o._targets&&o._targets.forEach(t=>r._enqueue(t)),++l):r._enqueue(o,!0)}catch(t){r._heap.clear(),s=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${a}: ${l} operators`),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun.sort((t,e)=>e.priority-t.priority);r._postrun=[];for(let e=0;er.runAsync(null,()=>{t.forEach(t=>{try{t(r)}catch(t){r.error(t)}})})),r},Lr.run=function(t,e,n){return this._pulse?zr(this):(this.evaluate(t,e,n),this)},Lr.runAsync=async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},Lr.runAfter=function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},Lr._enqueue=function(t,e){var n=t.stampt.pulse),e):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==Dr&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)},Lr.logger=function(t){return arguments.length?(this._log=t,this):this._log},Lr.error=Nr("error"),Lr.warn=Nr("warn"),Lr.info=Nr("info"),Lr.debug=Nr("debug"),Lr.logLevel=Nr("level");var Pr=_t(Ur,se);Pr.run=function(t){return t.stampthis.pulse=t):e!==t.StopPropagation&&(this.pulse=e),e);var e},Pr.evaluate=function(t){var e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},Pr.transform=function(){};var jr={};function Ir(t){var e=Wr(t);return e&&e.Definition||null}function Wr(t){return t=t&&t.toLowerCase(),vt(jr,t)?jr[t]:null}function Hr(t){return t&&t.length?1===t.length?t[0]:(e=t,function(t){for(var n=e.length,r=1,i=String(e[0](t));r{},Vr={init:Yr,add:Yr,rem:Yr,idx:0},Xr={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.sum,add:(t,e)=>t.sum+=+e,rem:(t,e)=>t.sum-=e},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,e)=>t.product*=e,rem:(t,e)=>t.product/=e},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,e)=>(t.mean_d=e-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,e)=>(t.mean_d=e-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,e)=>t.dev+=t.mean_d*(e-t.mean),rem:(t,e)=>t.dev-=t.mean_d*(e-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,e)=>{(e{e<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,e)=>{(e>t.max||void 0===t.max)&&(t.max=e)},rem:(t,e)=>{e>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,e,n)=>{e{e<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,e,n)=>{e>t.max&&(t.argmax=n)},rem:(t,e)=>{e>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3}},Jr=Object.keys(Xr);function Kr(t,e){return Xr[t](e)}function Qr(t,e){return t.idx-e.idx}function Zr(){this.valid=0,this.missing=0,this._ops.forEach(t=>t.init(this))}function ti(t,e){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach(n=>n.add(this,t,e))):++this.missing}function ei(t,e){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach(n=>n.rem(this,t,e))):--this.missing}function ni(t){return this._out.forEach(e=>t[e.out]=e.value(this)),t}function ri(t,e){var n=e||D,r=function(t){const e={};t.forEach(t=>e[t.name]=t);const n=t=>{t.req&&t.req.forEach(t=>{e[t]||n(e[t]=Xr[t]())})};return t.forEach(n),Object.values(e).sort(Qr)}(t),i=t.slice().sort(Qr);function a(t){this._ops=r,this._out=i,this.cell=t,this.init()}return a.prototype.init=Zr,a.prototype.add=ti,a.prototype.rem=ei,a.prototype.set=ni,a.prototype.get=n,a.fields=t.map(t=>t.out),a}function*ii(t,e){if(null==e)for(let e of t)null!=e&&""!==e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)r=e(r,++n,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function ai(t,e,n){var r=Float64Array.from(ii(t,n));return r.sort(Ne),e.map(t=>function(t,e,n=tn){if(r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,a=Math.floor(i),o=+n(t[a],a,t);return o+(+n(t[a+1],a+1,t)-o)*(i-a)}}(r,t))}function oi(t,e){return ai(t,[.25,.5,.75],e)}function ui(t,e){var n=t.length,r=function(t,e){const n=function(t,e){let n,r=0,i=0,a=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,a+=n*(e-i));else{let o=-1;for(let u of t)null!=(u=e(u,++o,t))&&(u=+u)>=u&&(n=u-i,i+=n/++r,a+=n*(u-i))}if(r>1)return a/(r-1)}(t,e);return n?Math.sqrt(n):n}(t,e),i=oi(t,e),a=(i[2]-i[0])/1.34;return 1.06*(r=Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function si(t){var e,n,r,i,a,o,u,s,l=t.maxbins||20,c=t.base||10,f=Math.log(c),d=t.divide||[5,2],h=t.extent[0],p=t.extent[1],m=t.span||p-h||Math.abs(h)||1;if(t.step)e=t.step;else if(t.steps){for(a=m/l,o=0,u=t.steps.length;ol;)e*=c;for(o=0,u=d.length;o=r&&m/a<=l&&(e=a)}return i=(a=Math.log(e))>=0?0:1+~~(-a/f),s=Math.pow(c,-i-1),(t.nice||void 0===t.nice)&&(h=h<(a=Math.floor(h/e+s)*e)?a-e:a,p=Math.ceil(p/e)*e),{start:h,stop:p===h?h+e:p,step:e}}function li(e,n,r,i){if(!e.length)return[void 0,void 0];var a,o,u,s,l=Float64Array.from(ii(e,i)),c=l.length,f=n;for(u=0,s=Array(f);ut);let i,a=0,o=1,u=t.length,s=new Float64Array(u),l=r(t[0]),c=l,f=l+e;for(;o=f){for(c=(l+c)/2;a>1);ro;)t[r--]=t[a]}a=o,o=n}return t}(s,e+e/4):s}Jr.forEach(t=>{Xr[t]=function(t,e){return n=>ht({name:t,out:n||t},Vr,e)}(t,Xr[t])}),t.random=Math.random;const fi=Math.sqrt(2*Math.PI),di=Math.SQRT2;let hi=NaN;function pi(e,n){e=e||0,n=null==n?1:n;let r,i,a=0,o=0;if(hi==hi)a=hi,hi=NaN;else{do{a=2*t.random()-1,o=2*t.random()-1,r=a*a+o*o}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),a*=i,hi=o*i}return e+a*n}function mi(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*fi)}function gi(t,e,n){let r,i=(t-(e=e||0))/(n=null==n?1:n),a=Math.abs(i);if(a>37)r=0;else{let t,e=Math.exp(-a*a/2);a<7.07106781186547?(t=.0352624965998911*a+.700383064443688,t=t*a+6.37396220353165,t=t*a+33.912866078383,t=t*a+112.079291497871,t=t*a+221.213596169931,t=t*a+220.206867912376,r=e*t,t=.0883883476483184*a+1.75566716318264,t=t*a+16.064177579207,t=t*a+86.7807322029461,t=t*a+296.564248779674,t=t*a+637.333633378831,t=t*a+793.826512519948,t=t*a+440.413735824752,r/=t):(t=a+.65,t=a+4/t,t=a+3/t,t=a+2/t,t=a+1/t,r=e/t/2.506628274631)}return i>0?1-r:r}function vi(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*di*function(t){let e,n=-Math.log((1-t)*(1+t));n<6.25?(n-=3.125,e=-364441206401782e-35,e=e*n-16850591381820166e-35,e=128584807152564e-32+e*n,e=11157877678025181e-33+e*n,e=e*n-1333171662854621e-31,e=20972767875968562e-33+e*n,e=6637638134358324e-30+e*n,e=e*n-4054566272975207e-29,e=e*n-8151934197605472e-29,e=26335093153082323e-28+e*n,e=e*n-12975133253453532e-27,e=e*n-5415412054294628e-26,e=1.0512122733215323e-9+e*n,e=e*n-4.112633980346984e-9,e=e*n-2.9070369957882005e-8,e=4.2347877827932404e-7+e*n,e=e*n-13654692000834679e-22,e=e*n-13882523362786469e-21,e=.00018673420803405714+e*n,e=e*n-.000740702534166267,e=e*n-.006033670871430149,e=.24015818242558962+e*n,e=1.6536545626831027+e*n):n<16?(n=Math.sqrt(n)-3.25,e=2.2137376921775787e-9,e=9.075656193888539e-8+e*n,e=e*n-2.7517406297064545e-7,e=1.8239629214389228e-8+e*n,e=15027403968909828e-22+e*n,e=e*n-4013867526981546e-21,e=29234449089955446e-22+e*n,e=12475304481671779e-21+e*n,e=e*n-47318229009055734e-21,e=6828485145957318e-20+e*n,e=24031110387097894e-21+e*n,e=e*n-.0003550375203628475,e=.0009532893797373805+e*n,e=e*n-.0016882755560235047,e=.002491442096107851+e*n,e=e*n-.003751208507569241,e=.005370914553590064+e*n,e=1.0052589676941592+e*n,e=3.0838856104922208+e*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,e=-27109920616438573e-27,e=e*n-2.555641816996525e-10,e=1.5076572693500548e-9+e*n,e=e*n-3.789465440126737e-9,e=7.61570120807834e-9+e*n,e=e*n-1.496002662714924e-8,e=2.914795345090108e-8+e*n,e=e*n-6.771199775845234e-8,e=2.2900482228026655e-7+e*n,e=e*n-9.9298272942317e-7,e=4526062597223154e-21+e*n,e=e*n-1968177810553167e-20,e=7599527703001776e-20+e*n,e=e*n-.00021503011930044477,e=e*n-.00013871931833623122,e=1.0103004648645344+e*n,e=4.849906401408584+e*n):e=1/0;return e*t}(2*t-1)}function yi(t,e){var n,r,i={mean:function(t){return arguments.length?(n=t||0,i):n},stdev:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>pi(n,r),pdf:t=>mi(t,n,r),cdf:t=>gi(t,n,r),icdf:t=>vi(t,n,r)};return i.mean(t).stdev(e)}function bi(e,n){var r=yi(),i={},a=0;return i.data=function(t){return arguments.length?(e=t,a=t?t.length:0,i.bandwidth(n)):e},i.bandwidth=function(t){return arguments.length?(!(n=t)&&e&&(n=ui(e)),i):n},i.sample=function(){return e[~~(t.random()*a)]+n*r.sample()},i.pdf=function(t){for(var i=0,o=0;oxi(n,r),pdf:t=>_i(t,n,r),cdf:t=>Ai(t,n,r),icdf:t=>ki(t,n,r)};return i.mean(t).stdev(e)}function Di(e,n){var r,i={},a=0;function o(t){var e,n=[],r=0;for(e=0;e=e&&t<=n?1/(n-e):0}function Ei(t,e,n){return null==n&&(n=null==e?1:e,e=0),tn?1:(t-e)/(n-e)}function Fi(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function Si(t,e){var n,r,i={min:function(t){return arguments.length?(n=t||0,i):n},max:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Mi(n,r),pdf:t=>Ci(t,n,r),cdf:t=>Ei(t,n,r),icdf:t=>Fi(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function Bi(t,e,n,r){const i=r-t*t,a=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-a*t,a]}function Oi(t,e,n,r){t=t.filter(t=>{let r=e(t),i=n(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i}),r&&t.sort((t,n)=>e(t)-e(n));const i=t.length,a=new Float64Array(i),o=new Float64Array(i);let u,s,l,c=0,f=0,d=0;for(l of t)a[c]=u=+e(l),o[c]=s=+n(l),++c,f+=(u-f)/c,d+=(s-d)/c;for(c=0;c=i&&null!=a&&(a=+a)>=a&&r(i,a,++o)}function Ri(t,e,n,r,i){let a=0,o=0;return zi(t,e,n,(t,e)=>{const n=e-i(t),u=e-r;a+=n*n,o+=u*u}),1-a/o}function Ti(t,e,n){let r=0,i=0,a=0,o=0,u=0;zi(t,e,n,(t,e)=>{++u,r+=(t-r)/u,i+=(e-i)/u,a+=(t*e-a)/u,o+=(t*t-o)/u});const s=Bi(r,i,a,o),l=t=>s[0]+s[1]*t;return{coef:s,predict:l,rSquared:Ri(t,e,n,i,l)}}function qi(t,e,n){let r=0,i=0,a=0,o=0,u=0;zi(t,e,n,(t,e)=>{++u,t=Math.log(t),r+=(t-r)/u,i+=(e-i)/u,a+=(t*e-a)/u,o+=(t*t-o)/u});const s=Bi(r,i,a,o),l=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:l,rSquared:Ri(t,e,n,i,l)}}function $i(t,e,n){const[r,i,a,o]=Oi(t,e,n);let u,s,l,c=0,f=0,d=0,h=0,p=0;zi(t,e,n,(t,e)=>{u=r[p++],s=Math.log(e),l=u*e,c+=(e*s-c)/p,f+=(l-f)/p,d+=(l*s-d)/p,h+=(u*l-h)/p});const[m,g]=Bi(f/o,c/o,d/o,h/o),v=t=>Math.exp(m+g*(t-a));return{coef:[Math.exp(m-g*a),g],predict:v,rSquared:Ri(t,e,n,o,v)}}function Li(t,e,n){let r=0,i=0,a=0,o=0,u=0,s=0;zi(t,e,n,(t,e)=>{const n=Math.log(t),l=Math.log(e);++s,r+=(n-r)/s,i+=(l-i)/s,a+=(n*l-a)/s,o+=(n*n-o)/s,u+=(e-u)/s});const l=Bi(r,i,a,o),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Ri(t,e,n,u,c)}}function Ni(t,e,n){const[r,i,a,o]=Oi(t,e,n),u=r.length;let s,l,c,f,d=0,h=0,p=0,m=0,g=0;for(s=0;sb*(t-=a)*t+x*t+_+o;return{coef:[_-x*a+b*a*a+o,x-2*b*a,b],predict:A,rSquared:Ri(t,e,n,o,A)}}function Ui(t,e,n,r){if(1===r)return Ti(t,e,n);if(2===r)return Ni(t,e,n);const[i,a,o,u]=Oi(t,e,n),s=i.length,l=[],c=[],f=r+1;let d,h,p,m,g;for(d=0;dMath.abs(t[r][o])&&(o=i);for(a=r;a=r;a--)t[a][i]-=t[a][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(u=0,a=i+1;a{t-=o;let e=u+v[0]+v[1]*t+v[2]*t*t;for(d=3;d=0;--a)for(u=e[a],s=1,i[a]+=u,o=1;o<=a;++o)s*=(a+1-o)/o,i[a-o]+=u*Math.pow(n,o)*s;return i[0]+=r,i}function ji(t,e,n,r){const[i,a,o,u]=Oi(t,e,n,!0),s=i.length,l=Math.max(2,~~(r*s)),c=new Float64Array(s),f=new Float64Array(s),d=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const e=[0,l-1];for(let t=0;ti[o]-n?r:o;let s=0,l=0,h=0,p=0,m=0,g=1/Math.abs(i[u]-n||1);for(let t=r;t<=o;++t){const e=i[t],r=a[t],o=Ii(Math.abs(n-e)*g)*d[t],u=e*o;s+=o,l+=u,h+=r*o,p+=r*u,m+=e*u}const[v,y]=Bi(l/s,h/s,p/s,m/s);c[t]=v+y*n,f[t]=Math.abs(a[t]-c[t]),Wi(i,t+1,e)}if(2===t)break;const n=nn(f);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r=1?1e-12:(e=1-t*t)*e}return function(t,e,n,r){const i=t.length,a=[];let o,u=0,s=0,l=[];for(;u=t.length))for(;e>i&&t[a]-r<=r-t[i];)n[0]=++i,n[1]=a,++a}const Hi=.1*Math.PI/180;function Gi(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],a=e[0],o=e[1],u=o-a,s=u/r,l=[i(a)],c=[];if(n===r){for(let t=1;t0;)c.push(i(a+t/n*u));let f=l[0],d=c[c.length-1];for(;d;){const t=i((f[0]+d[0])/2);t[0]-f[0]>=s&&Yi(f,t,d)>Hi?c.push(t):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function Yi(t,e,n){const r=Math.atan2(n[1]-t[1],n[0]-t[0]),i=Math.atan2(e[1]-t[1],e[0]-t[0]);return Math.abs(r-i)}function Vi(t){this._key=t?A(t):Vt,this.reset()}var Xi=Vi.prototype;function Ji(t){Ur.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}Xi.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Xi.add=function(t){this._add.push(t)},Xi.rem=function(t){this._rem.push(t)},Xi.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,e,n,r=this._add,i=this._rem,a=this._key,o=r.length,u=i.length,s=Array(o-u),l={};for(t=0;t=0;)vt(i,e=t(n[r])+"")||(i[e]=1,++a);return a},Xi.extent=function(t){if(this._get!==t||!this._ext){var e=this.values(),n=mt(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},Xi.argmin=function(t){return this.extent(t)[0]||{}},Xi.argmax=function(t){return this.extent(t)[1]||{}},Xi.min=function(t){var e=this.extent(t)[0];return null!=e?t(e):void 0},Xi.max=function(t){var e=this.extent(t)[1];return null!=e?t(e):void 0},Xi.quartile=function(t){return this._get===t&&this._q||(this._q=oi(this.values(),t),this._get=t),this._q},Xi.q1=function(t){return this.quartile(t)[0]},Xi.q2=function(t){return this.quartile(t)[1]},Xi.q3=function(t){return this.quartile(t)[2]},Xi.ci=function(t){return this._get===t&&this._ci||(this._ci=li(this.values(),1e3,.05,t),this._get=t),this._ci},Xi.ci0=function(t){return this.ci(t)[0]},Xi.ci1=function(t){return this.ci(t)[1]},Ji.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Jr},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};var Ki=_t(Ji,Ur);Ki.transform=function(t,e){var n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.modified();return n.stamp=r.stamp,n.value&&(i||e.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(t):{},e.visit(e.SOURCE,t=>n.add(t))):(n.value=n.value||n.init(t),e.visit(e.REM,t=>n.rem(t)),e.visit(e.ADD,t=>n.add(t))),r.modifies(n._outputs),n._drop=!1!==t.drop,t.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),e.clean()&&n._drop&&r.clean(!0).runAfter(()=>this.clean()),n.changes(r)},Ki.cross=function(){var t=this,e=t.value,n=t._dnames,r=n.map((function(){return{}})),i=n.length;function a(t){var e,a,o,u;for(e in t)for(o=t[e].tuple,a=0;au?1/0:(e=Math.max(o,Math.min(e,u-a)),o+a*Math.floor(1e-14+(e-o)/a))};return s.start=o,s.stop=i.stop,s.step=a,this.value=p(s,g(r),t.name||"bin_"+m(r))},ea.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},_t(ea,Ur).transform=function(t,e){var n=e.fork(e.ALL),r=ta(Vt,this.value,n.materialize(n.ADD).add),i=t.sort,a=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(te(i),a),e.source&&e.source.root&&(this.value.root=e.source.root),n},_t(na,se),ia.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};var aa=_t(ia,Ur);function oa(t){Ur.call(this,null,t)}aa.transform=function(t,e){function n(e){return function(n){for(var r,i=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(u(n),t.case,a)||[],s=0,l=i.length;s{var e={};return e[u[0]]=t[0],e[u[1]]=t[1],Jt(e)});this.value&&(n.rem=this.value),this.value=n.add=n.source=s}return n};function ha(t){Ur.call(this,null,t)}ha.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function pa(t){se.call(this,null,ma,t),this.modified(!0)}function ma(t){var e=t.expr;return this.value&&!t.modified("expr")?this.value:p(n=>e(n,t),g(e),m(e))}function ga(t){Ur.call(this,[void 0,void 0],t)}function va(t,e){se.call(this,t),this.parent=e,this.count=0}_t(ha,Ur).transform=function(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=da(e.source,t.groupby,D),i=t.smooth||!1,a=t.field,o=t.step||function(t,e){return Rt(pt(t,e))/30}(n,a),u=te((t,e)=>a(t)-a(e)),s=t.as||"bin",l=r.length;let c,f=1/0,d=-1/0,h=0;for(;hd&&(d=e),t[++c][s]=e}return this.value={start:f,stop:d,step:o},e.reflow(!0).modifies(s)},_t(pa,se),ga.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},_t(ga,Ur).transform=function(t,e){var n,r=this.value,i=t.field,a=r[0],o=r[1];if(((n=e.changed()||e.modified(i.fields)||t.modified("field"))||null==a)&&(a=1/0,o=-1/0),e.visit(n?e.SOURCE:e.ADD,(function(t){var e=N(i(t));null!=e&&(eo&&(o=e))})),!Number.isFinite(a)||!Number.isFinite(o)){let t=m(i);t&&(t=` for field "${t}"`),e.dataflow.warn(`Infinite extent${t}: [${a}, ${o}]`),a=o=void 0}this.value=[a,o]};var ya=_t(va,se);function ba(t){Ur.call(this,{},t),this._keys=bt();const e=this._targets=[];e.active=0,e.forEach=t=>{for(let n=0,r=e.active;nthis.subflow(t,i,e);return this._group=t.group||{},this.initTargets(),e.visit(e.REM,t=>{const e=Vt(t),n=a.get(e);void 0!==n&&(a.delete(e),u(n).rem(t))}),e.visit(e.ADD,t=>{const e=r(t);a.set(Vt(t),e),u(e).add(t)}),o||e.modified(r.fields)?e.visit(e.MOD,t=>{const e=Vt(t),n=a.get(e),i=r(t);n===i?u(i).mod(t):(a.set(e,i),u(n).rem(t),u(i).add(t))}):e.changed(e.MOD)&&e.visit(e.MOD,t=>{u(a.get(Vt(t))).mod(t)}),o&&e.visit(e.REFLOW,t=>{const e=Vt(t),n=a.get(e),i=r(t);n!==i&&(a.set(e,i),u(n).rem(t),u(i).add(t))}),e.clean()?n.runAfter(()=>{this.clean(),a.clean()}):a.empty>n.cleanThreshold&&n.runAfter(a.clean),e},_t(_a,se),ka.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},_t(ka,Ur).transform=function(t,e){var n=e.dataflow,r=this.value,i=e.fork(),a=i.add,o=i.rem,u=i.mod,s=t.expr,l=!0;function c(e){var n=Vt(e),i=s(e,t),c=r.get(n);i&&c?(r.delete(n),a.push(e)):i||c?l&&i&&!c&&u.push(e):(r.set(n,1),o.push(e))}return e.visit(e.REM,(function(t){var e=Vt(t);r.has(e)?r.delete(e):o.push(t)})),e.visit(e.ADD,(function(e){s(e,t)?a.push(e):r.set(Vt(e),1)})),e.visit(e.MOD,c),t.modified()&&(l=!1,e.visit(e.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i},wa.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},_t(wa,Ur).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=t.fields,i=fa(r,t.as||[]),a=t.index||null,o=i.length;return n.rem=this.value,e.visit(e.SOURCE,(function(t){for(var e,u,s,l=r.map(e=>e(t)),c=l.reduce((t,e)=>Math.max(t,e.length),0),f=0;fe[r]=n(e,t))},_t(Ca,Ur).transform=function(t,e){var n,r,i,a=this.value,o=e.fork(e.ALL),u=t.size-a.length,s=t.generator;if(u>0){for(n=[];--u>=0;)n.push(i=Jt(s(t))),a.push(i);o.add=o.add.length?o.materialize(o.ADD).add.concat(n):n}else r=a.slice(0,-u),o.rem=o.rem.length?o.materialize(o.REM).rem.concat(r):r,a=a.slice(-u);return o.source=this.value=a,o};var Ea={value:"value",median:nn,mean:function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n},min:Qe,max:Ke},Fa=[];function Sa(t){Ur.call(this,[],t)}function Ba(t){Ji.call(this,t)}Sa.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},_t(Sa,Ur).transform=function(t,e){var n,r,i,a,o,u,s,l,c,f,d=e.fork(e.ALL),h=function(t){var e,n=t.method||Ea.value;if(null!=Ea[n])return n===Ea.value?(e=void 0!==t.value?t.value:0,function(){return e}):Ea[n];x("Unrecognized imputation method: "+n)}(t),p=function(t){var e=t.field;return function(t){return t?e(t):NaN}}(t),g=m(t.field),v=m(t.key),y=(t.groupby||[]).map(m),b=function(t,e,n,r){var i,a,o,u,s,l,c,f,d=function(t){return t(f)},h=[],p=r?r.slice():[],m={},g={};for(p.forEach((function(t,e){m[t]=e+1})),u=0,c=t.length;ua&&(a=r[1]);return[i,a]}function Pa(t){se.call(this,null,ja,t)}function ja(t){return this.value&&!t.modified()?this.value:t.values.reduce((function(t,e){return t.concat(e)}),[])}function Ia(t){Ur.call(this,null,t)}function Wa(t){Ji.call(this,t)}Oa.transform=function(t,e){var n,r=this,i=t.modified();return r.value&&(i||e.modified(r._inputs,!0))?(n=r.value=i?r.init(t):{},e.visit(e.SOURCE,(function(t){r.add(t)}))):(n=r.value=r.value||this.init(t),e.visit(e.REM,(function(t){r.rem(t)})),e.visit(e.ADD,(function(t){r.add(t)}))),r.changes(),e.visit(e.SOURCE,(function(t){ht(t,n[r.cellkey(t)].tuple)})),e.reflow(i).modifies(this._outputs)},Oa.changes=function(){var t,e,n=this._adds,r=this._mods;for(t=0,e=this._alen;t{const n=bi(e,o)[u],r=t.counts?e.length:1;Gi(n,c||pt(e),f,d).forEach(t=>{const n={};for(let t=0;t(this._pending=rt(t.data),t=>t.touch(this)))}}return n.request(t.url,t.format).then(t=>$a(this,e,rt(t.data)))},La.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},_t(La,Ur).transform=function(t,e){var n,r,i=e,a=t.as,o=t.fields,u=t.index,s=t.values,l=null==t.default?null:t.default,c=t.modified(),f=c?e.SOURCE:e.ADD,d=o.length;return s?(r=s.length,d>1&&!a&&x('Multi-field lookup requires explicit "as" parameter.'),a&&a.length!==d*r&&x('The "as" parameter has too few output field names.'),a=a||s.map(m),n=function(t){for(var e,n,i=0,c=0;ie||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0)})),e?i.slice(0,e):i}(n,t.limit||0,e);e.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:o.map((function(){return i})),fields:o.map((function(t){return function(t,e,n,r){return p((function(r){return e(r)===t?n(r):NaN}),r,t+"")}(t,n,r,a)})),as:o.map((function(t){return t+""})),modified:t.modified.bind(t)}}(t,e),e)};function Ya(t){Ur.call(this,null,t)}function Va(t){Ur.call(this,null,t)}function Xa(t){Ur.call(this,null,t)}_t(Ga,ba).transform=function(t,e){const n=t.subflow,r=t.field,i=t=>this.subflow(Vt(t),n,e,t);return(t.modified("field")||r&&e.modified(g(r)))&&x("PreFacet does not support field modification."),this.initTargets(),r?(e.visit(e.MOD,t=>{const e=i(t);r(t).forEach(t=>e.mod(t))}),e.visit(e.ADD,t=>{const e=i(t);r(t).forEach(t=>e.add(Jt(t)))}),e.visit(e.REM,t=>{const e=i(t);r(t).forEach(t=>e.rem(t))})):(e.visit(e.MOD,t=>i(t).mod(t)),e.visit(e.ADD,t=>i(t).add(t)),e.visit(e.REM,t=>i(t).rem(t))),e.clean()&&e.runAfter(()=>this.clean()),e},Ya.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},_t(Ya,Ur).transform=function(t,e){var n,r,i=t.fields,a=fa(t.fields,t.as||[]),o=i?function(t,e){return function(t,e,n,r){for(var i=0,a=n.length;i{const e=ai(t,s);for(let n=0;n{var e=Vt(t);n.rem.push(r[e]),r[e]=null}),e.visit(e.ADD,t=>{var e=Kt(t);r[Vt(t)]=e,n.add.push(e)}),e.visit(e.MOD,t=>{var e,i=r[Vt(t)];for(e in t)i[e]=t[e],n.modifies(e);n.mod.push(i)})),n},Qa.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},_t(Qa,Ur).transform=function(e,n){var r=n.fork(n.NO_SOURCE),i=e.modified("size"),a=e.size,o=this.value,u=this.count,s=0,l=o.reduce((function(t,e){return t[Vt(e)]=1,t}),{});function c(e){var n,i;o.length=s&&(n=o[i],l[Vt(n)]&&r.rem.push(n),o[i]=e),++u}if(n.rem.length&&(n.visit(n.REM,(function(t){var e=Vt(t);l[e]&&(l[e]=-1,r.rem.push(t)),--u})),o=o.filter((function(t){return-1!==l[Vt(t)]}))),(n.rem.length||i)&&o.lengtha){for(var f=0,d=o.length-a;ff&&(f=i))})),a.start=c,a.stop=f,e.modifies(r?u:s)},ro._floor=function(t,e){const n="utc"===t.timezone;let{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:cr({extent:t.extent||pt(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins});r=_n(r);const a=this.value||{},o=(n?Hn:jn)(r,i);return o.unit=L(r),o.units=r,o.step=i,o.start=a.start,o.stop=a.stop,this.value=o},_t(io,Ur).transform=function(t,e){var n=e.dataflow,r=t.field,i=this.value,a=!0;function o(t){i.set(r(t),t)}return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,o)):e.changed()?(e.visit(e.REM,(function(t){i.delete(r(t))})),e.visit(e.ADD,o)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()},_t(ao,Ur).transform=function(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(te(t.sort)):e.source).map(t.field))};const oo={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:e=>{let n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?t=n+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:e=>{let n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){let t=oo.rank(),e=t.next;return{init:t.init,next:t=>(e(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:e=>{let n=e.index,r=e.data,i=e.compare;if(t0||x("ntile num must be greater than zero.");let n=oo.cume_dist(),r=n.next;return{init:n.init,next:t=>Math.ceil(e*r(t))}},lag:function(t,e){return e=+e||1,{next:n=>{let r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:n=>{let r=n.index+e,i=n.data;return rt(e.data[e.i0])}},last_value:function(t){return{next:e=>t(e.data[e.i1-1])}},nth_value:function(t,e){return(e=+e)>0||x("nth_value nth must be greater than zero."),{next:n=>{let r=n.i0+(e-1);return re=null,next:n=>{let r=t(n.data[n.index]);return null!=r?e=r:e}}},next_value:function(t){let e,n;return{init:()=>(e=null,n=-1),next:r=>{let i=r.data;return r.index<=n?e:(n=function(t,e,n){for(let r=e.length;ns[t]=1)}h(t.sort),n.forEach((function(t,e){let n=r[e],s=m(n),p=Gr(t,s,a[e]);if(h(n),o.push(p),vt(oo,t))u.push(function(t,e,n,r){let i=oo[t](e,n);return{init:i.init||M,update:function(t,e){e[r]=i.next(t)}}}(t,r[e],i[e],p));else{if(null==n&&"count"!==t&&x("Null aggregate field specified."),"count"===t)return void f.push(p);c=!1;let e=l[s];e||(e=l[s]=[],e.field=n,d.push(e)),e.push(Kr(t,p))}})),(f.length||d.length)&&(e.cell=function(t,e,n){t=t.map(t=>ri(t,t.field));let r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,a=r.agg=Array(i),o=0;ot.init()),this.cell&&this.cell.init()},lo.update=function(t,e){let n,r=this.cell,i=this.windows,a=t.data,o=i&&i.length;if(r){for(n=t.p0;n0&&!i(a[n],a[n-1])&&(t.i0=e.left(a,a[n])),ru)for(l=1,f=i.length;l1&&(n*=m=Math.sqrt(m),r*=m);var g=d/n,v=f/n,y=-f/r,b=d/r,x=g*u+v*s,_=y*u+b*s,A=g*t+v*e,k=y*t+b*e,w=(A-x)*(A-x)+(k-_)*(k-_),D=1/w-.25;D<0&&(D=0);var M=Math.sqrt(D);a==i&&(M=-M);var C=.5*(x+A)-M*(k-_),E=.5*(_+k)+M*(A-x),F=Math.atan2(_-E,x-C),S=Math.atan2(k-E,A-C),B=S-F;B<0&&1===a?B+=Ro:B>0&&0===a&&(B-=Ro);for(var O=Math.ceil(Math.abs(B/(zo+.001))),z=[],R=0;R+t}function tu(t,e,n){return Math.max(e,Math.min(t,n))}function eu(){var t=Xo,e=Jo,n=Ko,r=Qo,i=Zo(0),a=i,o=i,s=i,l=null;function c(c,f,d){var h,p=null!=f?f:+t.call(this,c),m=null!=d?d:+e.call(this,c),g=+n.call(this,c),v=+r.call(this,c),y=Math.min(g,v)/2,b=tu(+i.call(this,c),0,y),x=tu(+a.call(this,c),0,y),_=tu(+o.call(this,c),0,y),A=tu(+s.call(this,c),0,y);if(l||(l=h=u.path()),b<=0&&x<=0&&_<=0&&A<=0)l.rect(p,m,g,v);else{var k=p+g,w=m+v;l.moveTo(p+b,m),l.lineTo(k-x,m),l.bezierCurveTo(k-Vo*x,m,k,m+Vo*x,k,m+x),l.lineTo(k,w-A),l.bezierCurveTo(k,w-Vo*A,k-Vo*A,w,k-A,w),l.lineTo(p+_,w),l.bezierCurveTo(p+Vo*_,w,p,w-Vo*_,p,w-_),l.lineTo(p,m+b),l.bezierCurveTo(p,m+Vo*b,p+Vo*b,m,p+b,m),l.closePath()}if(h)return l=null,h+""||null}return c.x=function(e){return arguments.length?(t=Zo(e),c):t},c.y=function(t){return arguments.length?(e=Zo(t),c):e},c.width=function(t){return arguments.length?(n=Zo(t),c):n},c.height=function(t){return arguments.length?(r=Zo(t),c):r},c.cornerRadius=function(t,e,n,r){return arguments.length?(i=Zo(t),a=null!=e?Zo(e):i,s=null!=n?Zo(n):i,o=null!=r?Zo(r):a,c):i},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}function nu(){var t,e,n,r,i,a,o,s,l=null;function c(t,e,n){var r=n/2;if(i){var u=o-e,c=t-a;if(u||c){var f=Math.sqrt(u*u+c*c),d=(u/=f)*s,h=(c/=f)*s,p=Math.atan2(c,u);l.moveTo(a-d,o-h),l.lineTo(t-u*r,e-c*r),l.arc(t,e,r,p-Math.PI,p),l.lineTo(a+d,o+h),l.arc(a,o,s,p,p+Math.PI)}else l.arc(t,e,r,0,Ro);l.closePath()}else i=1;a=t,o=e,s=r}function f(a){var o,s,f,d=a.length,h=!1;for(null==l&&(l=f=u.path()),o=0;o<=d;++o)!(ot.x||0,au=t=>t.y||0,ou=t=>!(!1===t.defined),uu=o.arc().startAngle(t=>t.startAngle||0).endAngle(t=>t.endAngle||0).padAngle(t=>t.padAngle||0).innerRadius(t=>t.innerRadius||0).outerRadius(t=>t.outerRadius||0).cornerRadius(t=>t.cornerRadius||0),su=o.area().x(iu).y1(au).y0(t=>(t.y||0)+(t.height||0)).defined(ou),lu=o.area().y(au).x1(iu).x0(t=>(t.x||0)+(t.width||0)).defined(ou),cu=o.line().x(iu).y(au).defined(ou),fu=eu().x(iu).y(au).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>ru(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>ru(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>ru(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>ru(t.cornerRadiusBottomLeft,t.cornerRadius)||0),du=o.symbol().type(t=>Go(t.shape||"circle")).size(t=>ru(t.size,64)),hu=nu().x(iu).y(au).defined(ou).size(t=>t.size||1);function pu(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function mu(t,e,n,r){return fu.context(t)(e,n,r)}var gu=1;function vu(){gu=1}function yu(t,e,n){var r=e.clip,i=t._defs,a=e.clip_id||(e.clip_id="clip"+gu++),o=i.clipping[a]||(i.clipping[a]={id:a});return at(r)?o.path=r(null):pu(n)?o.path=mu(null,n,0,0):(o.width=n.width||0,o.height=n.height||0),"url(#"+a+")"}function bu(t){this.clear(),t&&this.union(t)}var xu=bu.prototype;function _u(t){this.mark=t,this.bounds=this.bounds||new bu}function Au(t){_u.call(this,t),this.items=this.items||[]}function ku(t,e){if("undefined"!=typeof document&&document.createElement){var n=document.createElement("canvas");if(n&&n.getContext)return n.width=t,n.height=e,n}return null}function wu(){return"undefined"!=typeof Image?Image:null}function Du(t){this._pending=0,this._loader=t||_r()}xu.clone=function(){return new bu(this)},xu.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},xu.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},xu.equals=function(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},xu.set=function(t,e,n,r){return nthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},xu.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},xu.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},xu.scale=function(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},xu.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},xu.rotate=function(t,e,n){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},xu.rotatedPoints=function(t,e,n){var{x1:r,y1:i,x2:a,y2:o}=this,u=Math.cos(t),s=Math.sin(t),l=e-e*u+n*s,c=n-e*s-n*u;return[u*r-s*i+l,s*r+u*i+c,u*r-s*o+l,s*r+u*o+c,u*a-s*i+l,s*a+u*i+c,u*a-s*o+l,s*a+u*o+c]},xu.union=function(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},xu.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},xu.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},xu.intersects=function(t){return t&&!(this.x2t.x2||this.y2t.y2)},xu.contains=function(t,e){return!(tthis.x2||ethis.y2)},xu.width=function(){return this.x2-this.x1},xu.height=function(){return this.y2-this.y1},_t(Au,_u);var Mu=Du.prototype;function Cu(t){t._pending+=1}function Eu(t){t._pending-=1}function Fu(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const r=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(r+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,r):0))}return t}Mu.pending=function(){return this._pending},Mu.sanitizeURL=function(t){var e=this;return Cu(e),e._loader.sanitize(t,{context:"href"}).then((function(t){return Eu(e),t})).catch((function(){return Eu(e),null}))},Mu.loadImage=function(t){const e=this,n=wu();return Cu(e),e._loader.sanitize(t,{context:"image"}).then((function(t){const r=t.href;if(!r||!n)throw{url:r};const i=new n,a=vt(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=a&&(i.crossOrigin=a),i.onload=()=>Eu(e),i.onerror=()=>Eu(e),i.src=r,i})).catch((function(t){return Eu(e),{complete:!1,width:0,height:0,src:t&&t.url||""}}))},Mu.ready=function(){var t=this;return new Promise((function(e){!function n(r){t.pending()?setTimeout((function(){n(!0)}),10):e(r)}(!1)}))};var Su,Bu,Ou,zu=Ro-1e-8;function Ru(t){return Su=t,Ru}function Tu(){}function qu(t,e){Su.add(t,e)}function $u(t,e){qu(Bu=t,Ou=e)}function Lu(t){qu(t,Su.y1)}function Nu(t){qu(Su.x1,t)}function Uu(t,e,n,r){const i=(t-e)/(t+n-2*e);01e-14?(s=o*o+u*a,s>=0&&(s=Math.sqrt(s),l=(-o+s)/a,c=(-o-s)/a)):l=.5*u/o,0zu)qu(t-n,e-n),qu(t+n,e+n);else{const o=r=>qu(n*Math.cos(r)+t,n*Math.sin(r)+e);let u,s;if(o(r),o(i),i!==r)if((r%=Ro)<0&&(r+=Ro),(i%=Ro)<0&&(i+=Ro),ii;++s,u-=zo)o(u);else for(u=r-r%zo+zo,s=0;s<4&&ug)return!1;h>m&&(m=h)}else if(f>0){if(h0&&(t.globalAlpha=n,t.fillStyle=Zu(t,e,e.fill),!0)}var es=[];function ns(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=Zu(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||es),t.lineDashOffset=e.strokeDashOffset||0),!0))}function rs(t,e){return t.zindex-e.zindex||t.index-e.index}function is(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,a=[];for(n=0,r=i.length;n=0;)if(n=e(i[r]))return n;if(i===a)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function us(t){return function(e,n,r){as(n,(function(n){r&&!r.intersects(n.bounds)||ls(t,e,n,n)}))}}function ss(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||ls(t,e,n.items[0],n.items)}}function ls(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(Ju(e,n),n.fill&&ts(e,n,i)&&e.fill(),n.stroke&&ns(e,n,i)&&e.stroke()))}function cs(t){return t=t||E,function(e,n,r,i,a,o){return r*=e.pixelRatio,i*=e.pixelRatio,os(n,(function(n){var u=n.bounds;if((!u||u.contains(a,o))&&u)return t(e,n,r,i,a,o)?n:void 0}))}}function fs(t,e){return function(n,r,i,a){var o,u,s=Array.isArray(r)?r[0]:r,l=null==e?s.fill:e,c=s.stroke&&n.isPointInStroke;return c&&(o=s.strokeWidth,u=s.strokeCap,n.lineWidth=null!=o?o:1,n.lineCap=null!=u?u:"butt"),!t(n,r)&&(l&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a))}}function ds(t){return cs(fs(t))}function hs(t,e){return"translate("+t+","+e+")"}function ps(t){return"rotate("+t+")"}function ms(t){return hs(t.x||0,t.y||0)}function gs(t){return hs(t.x||0,t.y||0)+(t.angle?" "+ps(t.angle):"")+(t.scaleX||t.scaleY?" "+(e=t.scaleX||1,n=t.scaleY||1,"scale("+e+","+n+")"):"");var e,n}function vs(t,e,n){function r(t,n){var r=n.x||0,i=n.y||0,a=n.angle||0;t.translate(r,i),a&&t.rotate(a*=Oo),t.beginPath(),e(t,n),a&&t.rotate(-a),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",gs(n)),t("d",e(null,n))},bound:function(t,n){var r=n.x||0,i=n.y||0;return e(Ru(t),n),Fu(t,n).translate(r,i),n.angle&&t.rotate(n.angle*Oo,r,i),t},draw:us(r),pick:ds(r),isect:n||Hu(r)}}var ys=vs("arc",(function(t,e){return uu.context(t)(e)}));function bs(t,e,n){function r(t,n){t.beginPath(),e(t,n)}var i=fs(r);return{type:t,tag:"path",nested:!0,attr:function(t,n){var r=n.mark.items;r.length&&t("d",e(null,r))},bound:function(t,n){var r=n.items;return 0===r.length?t:(e(Ru(t),r),Fu(t,r[0]))},draw:ss(r),pick:function(t,e,n,r,a,o){var u=e.items,s=e.bounds;return!u||!u.length||s&&!s.contains(a,o)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,u,n,r)?u[0]:null)},isect:Gu,tip:n}}var xs=bs("area",(function(t,e){var n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?lu:su).curve(Eo(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],a="horizontal"===t[0].orient?"y":"x",o=t.length,u=1/0;--o>=0;)!1!==t[o].defined&&(r=Math.abs(t[o][a]-i)).5&&e<1.5?.5-Math.abs(e-1):0}function ks(t,e){const n=As(e);t("d",mu(null,e,n,n))}function ws(t,e,n,r){const i=As(e);t.beginPath(),mu(t,e,(n||0)+i,(r||0)+i)}const Ds=fs(ws),Ms=fs(ws,!1);var Cs={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",ms(e))},bound:function(t,e){if(!e.clip&&e.items){const n=e.items,r=n.length;for(let e=0;e{const r=e.x||0,i=e.y||0,a=e.strokeForeground,o=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&o&&(ws(t,e,r,i),Ju(t,e),e.fill&&ts(t,e,o)&&t.fill(),e.stroke&&!a&&ns(t,e,o)&&t.stroke()),t.save(),t.translate(r,i),e.clip&&_s(t,e),n&&n.translate(-r,-i),as(e,e=>{this.draw(t,e,n)}),n&&n.translate(r,i),t.restore(),a&&e.stroke&&o&&(ws(t,e,r,i),Ju(t,e),ns(t,e,o)&&t.stroke())})},pick:function(t,e,n,r,i,a){if(e.bounds&&!e.bounds.contains(i,a)||!e.items)return null;const o=n*t.pixelRatio,u=r*t.pixelRatio;return os(e,s=>{let l,c,f,d,h,p,m,g,v;if(g=s.bounds,(!g||g.contains(i,a))&&(d=s.x||0,h=s.y||0,p=d+(s.width||0),m=h+(s.height||0),v=s.clip,!v||!(ip||am)))return t.save(),t.translate(d,h),d=i-d,h=a-h,v&&pu(s)&&!Ds(t,s,o,u)?(t.restore(),null):(c=s.strokeForeground,f=!1!==e.interactive,f&&c&&s.stroke&&Ms(t,s,o,u)?(t.restore(),s):(l=os(s,t=>function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,d,h)?this.pick(t,n,r,d,h):null),!l&&f&&(s.fill||!c&&s.stroke)&&Ds(t,s,o,u)&&(l=s),t.restore(),l||null))})},isect:Yu,content:function(t,e,n){t("clip-path",e.clip?yu(n,e,e):null)},background:function(t,e){t("class","background"),t("aria-hidden",!0),ks(t,e)},foreground:function(t,e){t("class","foreground"),t("aria-hidden",!0),e.strokeForeground?ks(t,e):t("d","")}},Es={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function Fs(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then(e=>{t.image=e,t.image.url=t.url})),n}function Ss(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function Bs(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function Os(t,e){return"center"===t?e/2:"right"===t?e:0}function zs(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var Rs={type:"image",tag:"image",nested:!1,attr:function(t,e,n){const r=Fs(e,n),i=Ss(e,r),a=Bs(e,r),o=(e.x||0)-Os(e.align,i),u=(e.y||0)-zs(e.baseline,a);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",Es["xmlns:xlink"],"xlink:href"),t("transform",hs(o,u)),t("width",i),t("height",a),t("preserveAspectRatio",!1===e.aspect?"none":"xMidYMid")},bound:function(t,e){const n=e.image,r=Ss(e,n),i=Bs(e,n),a=(e.x||0)-Os(e.align,r),o=(e.y||0)-zs(e.baseline,i);return t.set(a,o,a+r,o+i)},draw:function(t,e,n){as(e,e=>{if(n&&!n.intersects(e.bounds))return;let r,i,a,o,u=Fs(e,this),s=Ss(e,u),l=Bs(e,u),c=(e.x||0)-Os(e.align,s),f=(e.y||0)-zs(e.baseline,l);!1!==e.aspect&&(i=u.width/u.height,a=e.width/e.height,i==i&&a==a&&i!==a&&(a=0;)if(!1!==t[a].defined&&(n=t[a].x-e[0])*n+(r=t[a].y-e[1])*r1?e:e[0]:e;var e}function tl(t){const e=Zs(t);return(O(e)?e.length-1:0)*Qs(t)}function el(t,e){const n=null==e?"":(e+"").trim();return t.limit>0&&n.length?function(t,e){var n=+t.limit,r=function(t){if(Hs.width===Xs){const e=rl(t);return t=>Js(t,e)}{const e=Ks(t);return t=>Vs(t,e)}}(t);if(r(e)>>1,r(e.slice(i))>n?u=i+1:s=i;return a+e.slice(u)}for(;u>>1),r(e.slice(0,i))Math.max(t,Hs.width(e,n)),0)):r=Hs.width(e,f),"center"===a?l-=r/2:"right"===a&&(l-=r),t.set(l+=u,c+=s,l+r,c+i),e.angle&&!n)t.rotate(e.angle*Oo,u,s);else if(2===n)return t.rotatedPoints(e.angle*Oo,u,s);return t}var ll={arc:ys,area:xs,group:Cs,image:Rs,line:Ts,path:$s,rect:Ns,rule:Ps,shape:js,symbol:Is,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+il(e),a=ul(e),o=a.x1,u=a.y1,s=e.angle||0;t("text-anchor",al[e.align]||"start"),s?(n=hs(o,u)+" "+ps(s),(r||i)&&(n+=" "+hs(r,i))):n=hs(o+r,u+i),t("transform",n)},bound:sl,draw:function(t,e,n){as(e,(function(e){var r,i,a,o,u,s,l,c=null==e.opacity?1:e.opacity;if(!(n&&!n.intersects(e.bounds)||0===c||e.fontSize<=0||null==e.text||0===e.text.length)){if(t.font=rl(e),t.textAlign=e.align||"left",i=(r=ul(e)).x1,a=r.y1,e.angle&&(t.save(),t.translate(i,a),t.rotate(e.angle*Oo),i=a=0),i+=e.dx||0,a+=(e.dy||0)+il(e),s=Zs(e),Ju(t,e),O(s))for(u=Qs(e),o=0;o=0;)if(!1!==t[i].defined&&(n=t[i].x-e[0])*n+(r=t[i].y-e[1])*r<(n=t[i].size||1)*n)return t[i];return null}))};function cl(t,e,n){var r=ll[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new bu),t,n)}var fl={mark:null};function dl(t,e,n){var r,i,a,o,u=ll[t.marktype],s=u.bound,l=t.items,c=l&&l.length;if(u.nested)return c?a=l[0]:(fl.mark=t,a=fl),o=cl(a,s,n),e=e&&e.union(o)||o;if(e=e||t.bounds&&t.bounds.clear()||new bu,c)for(r=0,i=l.length;re;)t.removeChild(n[--r]);return t}function kl(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function wl(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Dl(t,e){this._active=null,this._handlers={},this._loader=t||_r(),this._tooltip=e||Ml}function Ml(t,e,n,r){t.element().setAttribute("title",r||"")}vl.toJSON=function(t){return pl(this.root,t||0)},vl.mark=function(t,e,n){var r=yl(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r};const Cl=Dl.prototype;function El(t){this._el=null,this._bgcolor=null,this._loader=new Du(t)}Cl.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Cl.element=function(){return this._el},Cl.canvas=function(){return this._el&&this._el.firstChild},Cl.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Cl.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Cl.on=function(){},Cl.off=function(){},Cl._handlerIndex=function(t,e,n){for(let r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1},Cl.handlers=function(t){const e=this._handlers,n=[];if(t)n.push.apply(n,e[this.eventName(t)]);else for(const t in e)n.push.apply(n,e[t]);return n},Cl.eventName=function(t){const e=t.indexOf(".");return e<0?t:t.slice(0,e)},Cl.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then(e=>{const n=new MouseEvent(t.type,t),r=bl(null,"a");for(const t in e)r.setAttribute(t,e[t]);r.dispatchEvent(n)}).catch((function(){}))},Cl.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,a,o=t&&t.mark;if(o&&(i=ll[o.marktype]).tip){for((a=wl(e,n))[0]-=r[0],a[1]-=r[1];t=t.mark.group;)a[0]-=t.x||0,a[1]-=t.y||0;t=i.tip(o.items,a)}return t}(e,t,this.canvas(),this._origin);const r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}},Cl.getItemBoundingClientRect=function(t){const e=this.canvas();if(!e)return;const n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,a=i.width(),o=i.height();let u=i.x1+r[0]+n.left,s=i.y1+r[1]+n.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,s+=t.y||0;return{x:u,y:s,width:a,height:o,left:u,top:s,right:u+a,bottom:s+o}};var Fl=El.prototype;Fl.initialize=function(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)},Fl.element=function(){return this._el},Fl.canvas=function(){return this._el&&this._el.firstChild},Fl.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},Fl.resize=function(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this},Fl.dirty=function(){},Fl.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},Fl._render=function(){},Fl.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then((function(){return e})):Promise.resolve(e)},Fl._load=function(t,e){var n=this,r=n._loader[t](e);if(!n._ready){var i=n._call;n._ready=n._loader.ready().then((function(t){t&&i(),n._ready=null}))}return r},Fl.sanitizeURL=function(t){return this._load("sanitizeURL",t)},Fl.loadImage=function(t){return this._load("loadImage",t)};const Sl="dragleave",Bl="mousedown",Ol="mousemove",zl="mouseout",Rl="click",Tl=["keydown","keypress","keyup","dragenter",Sl,"dragover",Bl,"mouseup",Ol,zl,"mouseover",Rl,"dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],ql=Ol,$l=zl,Ll=Rl;function Nl(t,e){Dl.call(this,t,e),this._down=null,this._touch=null,this._first=!0,this._events={}}const Ul=_t(Nl,Dl);Ul.initialize=function(t,e,n){return this._canvas=t&&xl(t,"canvas"),[Rl,Bl,Ol,zl,Sl].forEach(t=>Pl(this,t)),Dl.prototype.initialize.call(this,t,e,n)};function Pl(t,e){(t=>"touchstart"===t||"touchmove"===t||"touchend"===t?["touchstart","touchmove","touchend"]:[t])(e).forEach(e=>function(t,e){const n=t.canvas();n&&!t._events[e]&&(t._events[e]=1,n.addEventListener(e,t[e]?n=>t[e](n):n=>t.fire(e,n)))}(t,e))}function jl(t,e,n){return function(r){const i=this._active,a=this.pickEvent(r);a===i||(i&&i.exit||this.fire(n,r),this._active=a,this.fire(e,r)),this.fire(t,r)}}function Il(t){return function(e){this.fire(t,e),this._active=null}}Ul.canvas=function(){return this._canvas},Ul.context=function(){return this._canvas.getContext("2d")},Ul.events=Tl,Ul.DOMMouseScroll=function(t){this.fire("mousewheel",t)},Ul.mousemove=jl(Ol,"mouseover",zl),Ul.dragover=jl("dragover","dragenter",Sl),Ul.mouseout=Il(zl),Ul.dragleave=Il(Sl),Ul.mousedown=function(t){this._down=this._active,this.fire(Bl,t)},Ul.click=function(t){this._down===this._active&&(this.fire(Rl,t),this._down=null)},Ul.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},Ul.touchmove=function(t){this.fire("touchmove",t,!0)},Ul.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},Ul.fire=function(t,e,n){const r=n?this._touch:this._active,i=this._handlers[t];if(e.vegaType=t,t===Ll&&r&&r.href?this.handleHref(e,r,r.href):t!==ql&&t!==$l||this.handleTooltip(e,r,t!==$l),i)for(let t=0,n=i.length;t=0&&r.splice(i,1),this},Ul.pickEvent=function(t){const e=wl(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},Ul.pick=function(t,e,n,r,i){const a=this.context();return ll[t.marktype].pick.call(this,a,t,e,n,r,i)};var Wl="undefined"!=typeof window&&window.devicePixelRatio||1;function Hl(t){El.call(this,t),this._options={},this._redraw=!1,this._dirty=new bu,this._tempb=new bu}const Gl=_t(Hl,El),Yl=El.prototype;Gl.initialize=function(t,e,n,r,i,a){return this._options=a||{},this._canvas=this._options.externalContext?null:ku(1,1,this._options.type),t&&this._canvas&&(Al(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Yl.initialize.call(this,t,e,n,r,i)},Gl.resize=function(t,e,n,r){if(Yl.resize.call(this,t,e,n,r),this._canvas)!function(t,e,n,r,i,a){const o="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),s=o?Wl:i;t.width=e*s,t.height=n*s;for(const t in a)u[t]=a[t];o&&1!==s&&(t.style.width=e+"px",t.style.height=n+"px"),u.pixelRatio=s,u.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||x("CanvasRenderer is missing a valid canvas or context"),t.scale(this._scale,this._scale),t.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},Gl.canvas=function(){return this._canvas},Gl.context=function(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},Gl.dirty=function(t){let e=this._tempb.clear().union(t.bounds),n=t.mark.group;for(;n;)e.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(e)};function Vl(t,e){Dl.call(this,t,e);const n=this;n._hrefHandler=Jl(n,(t,e)=>{e&&e.href&&n.handleHref(t,e,e.href)}),n._tooltipHandler=Jl(n,(t,e)=>{n.handleTooltip(t,e,t.type!==$l)})}Gl._render=function(t){const e=this.context(),n=this._origin,r=this._width,i=this._height,a=this._dirty,o=((t,e,n)=>(new bu).set(0,0,e,n).translate(-t[0],-t[1]))(n,r,i);e.save();const u=this._redraw||a.empty()?(this._redraw=!1,o.expand(1)):function(t,e,n){return e.expand(1).round(),t.pixelRatio%1&&e.scale(t.pixelRatio).round().scale(1/t.pixelRatio),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,o.intersect(a),n);return this.clear(-n[0],-n[1],r,i),this.draw(e,t,u),e.restore(),a.clear(),this},Gl.draw=function(t,e,n){const r=ll[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),at(n)?(t.beginPath(),n(t),t.clip()):_s(t,e.group)}(t,e),r.draw.call(this,t,e,n),e.clip&&t.restore()},Gl.clear=function(t,e,n,r){const i=this._options,a=this.context();"pdf"===i.type||i.externalContext||a.clearRect(t,e,n,r),null!=this._bgcolor&&(a.fillStyle=this._bgcolor,a.fillRect(t,e,n,r))};const Xl=_t(Vl,Dl);Xl.initialize=function(t,e,n){let r=this._svg;return r&&(r.removeEventListener(Ll,this._hrefHandler),r.removeEventListener(ql,this._tooltipHandler),r.removeEventListener($l,this._tooltipHandler)),this._svg=r=t&&xl(t,"svg"),r&&(r.addEventListener(Ll,this._hrefHandler),r.addEventListener(ql,this._tooltipHandler),r.addEventListener($l,this._tooltipHandler)),Dl.prototype.initialize.call(this,t,e,n)},Xl.canvas=function(){return this._svg};const Jl=(t,e)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,e.call(t._obj,n,r)};function Kl(t,e,n){var r=t-e+2*n;return t?r>0?r:1:0}Xl.on=function(t,e){const n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){const i={type:t,handler:e,listener:Jl(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},Xl.off=function(t,e){const n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this};const Ql="log",Zl="time",tc="utc",ec="continuous";function nc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function rc(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const ic=Symbol("implicit");function ac(){var t=new Map,e=[],n=[],r=ic;function i(i){var a=i+"",o=t.get(a);if(!o){if(r!==ic)return r;t.set(a,o=e.push(i))}return n[(o-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Map;for(const r of n){const n=r+"";t.has(n)||t.set(n,e.push(r))}return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return ac(e,n).unknown(r)},nc.apply(i,arguments),i}function oc(t){return+t}var uc=[0,1];function sc(t){return t}function lc(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function cc(t,e,n){var r=t[0],i=t[1],a=e[0],o=e[1];return ie&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(o[0],o[t-1])),r=t>2?fc:cc,i=a=null,d}function d(e){return isNaN(e=+e)?n:(i||(i=r(o.map(t),u,l)))(t(c(e)))}return d.invert=function(n){return c(e((a||(a=r(u,o.map(t),s.interpolateNumber)))(n)))},d.domain=function(t){return arguments.length?(o=Array.from(t,oc),f()):o.slice()},d.range=function(t){return arguments.length?(u=Array.from(t),f()):u.slice()},d.rangeRound=function(t){return u=Array.from(t),l=s.interpolateRound,f()},d.clamp=function(t){return arguments.length?(c=!!t||sc,f()):c!==sc},d.interpolate=function(t){return arguments.length?(l=t,f()):l},d.unknown=function(t){return arguments.length?(n=t,d):n},function(n,r){return t=n,e=r,f()}}function pc(){return hc()(sc,sc)}function mc(t,e,n,i){var a,o=Je(t,e,n);switch((i=r.formatSpecifier(null==i?",f":i)).type){case"s":var u=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN(a=r.precisionPrefix(o,u))||(i.precision=a),r.formatPrefix(i,u);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(a=r.precisionRound(o,Math.max(Math.abs(t),Math.abs(e))))||(i.precision=a-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(a=r.precisionFixed(o))||(i.precision=a-2*("%"===i.type))}return r.format(i)}function gc(t){var e=t.domain;return t.ticks=function(t){var n=e();return Ve(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return mc(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i=e(),a=0,o=i.length-1,u=i[a],s=i[o];return s0?r=Xe(u=Math.floor(u/r)*r,s=Math.ceil(s/r)*r,n):r<0&&(r=Xe(u=Math.ceil(u*r)/r,s=Math.floor(s*r)/r,n)),r>0?(i[a]=Math.floor(u/r)*r,i[o]=Math.ceil(s/r)*r,e(i)):r<0&&(i[a]=Math.ceil(u*r)/r,i[o]=Math.floor(s*r)/r,e(i)),t},t}function vc(t,e){var n,r=0,i=(t=t.slice()).length-1,a=t[r],o=t[i];return o0){for(;d<=h;++d)for(c=1,l=n(d);cs)break;m.push(f)}}else for(;d<=h;++d)for(c=o-1,l=n(d);c>=1;--c)if(!((f=l*c)s)break;m.push(f)}2*m.lengtha[1-c])))return n=Math.max(0,je(f,s)-1),o=s===l?n:je(f,l)-1,s-f[n]>e+1e-10&&++n,c&&(u=n,n=d-o,o=d-u),n>o?void 0:r().slice(n,o+1)}},n.invert=function(t){var e=n.invertRange([t,t]);return e?e[0]:e},n.copy=function(){return jc().domain(r()).range(a).round(o).paddingInner(u).paddingOuter(s).align(l)},c()}var Ic=Array.prototype.map;function Wc(t){return Ic.call(t,(function(t){return+t}))}var Hc=Array.prototype.slice;const Gc={};function Yc(t,e,n){const r=function(){var n=e();return n.invertRange||(n.invertRange=n.invert?function(t){return function(e){var n,r=e[0],i=e[1];return i=u&&o[i]<=s&&(l<0&&(l=i),n=i);if(!(l<0))return u=t.invertExtent(o[l]),s=t.invertExtent(o[n]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=t,n};return r.metadata=Ut(rt(n)),r}function Vc(t,e,n){return arguments.length>1?(Gc[t]=Yc(t,e,n),this):Xc(t)?Gc[t]:void 0}function Xc(t){return vt(Gc,t)}function Jc(t,e){const n=Gc[t];return n&&n.metadata[e]}function Kc(t){return Jc(t,ec)}function Qc(t){return Jc(t,"discrete")}function Zc(t){return Jc(t,"discretizing")}function tf(t){return Jc(t,Ql)}function ef(t){return Jc(t,"interpolating")}function nf(t){return Jc(t,"quantile")}Vc("identity",(function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,oc),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,oc):[0,1],gc(r)})),Vc("linear",(function t(){var e=pc();return e.copy=function(){return dc(e,t())},nc.apply(e,arguments),gc(e)}),ec),Vc(Ql,(function t(){var e=wc(hc()).domain([1,10]);return e.copy=function(){return dc(e,t()).base(e.base())},nc.apply(e,arguments),e}),[ec,Ql]),Vc("pow",Oc,ec),Vc("sqrt",(function(){return Oc.apply(null,arguments).exponent(.5)}),ec),Vc("symlog",(function t(){var e=Cc(hc());return e.copy=function(){return dc(e,t()).constant(e.constant())},nc.apply(e,arguments)}),ec),Vc(Zl,(function(){return nc.apply(Tc(i.timeYear,i.timeMonth,i.timeWeek,i.timeDay,i.timeHour,i.timeMinute,i.timeSecond,i.timeMillisecond,a.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[ec,"temporal"]),Vc(tc,(function(){return nc.apply(Tc(i.utcYear,i.utcMonth,i.utcWeek,i.utcDay,i.utcHour,i.utcMinute,i.utcSecond,i.utcMillisecond,a.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[ec,"temporal"]),Vc("sequential",Lc,[ec,"interpolating"]),Vc("sequential-linear",Lc,[ec,"interpolating"]),Vc("sequential-log",(function t(){var e=wc(qc()).domain([1,10]);return e.copy=function(){return $c(e,t()).base(e.base())},rc.apply(e,arguments)}),[ec,"interpolating",Ql]),Vc("sequential-pow",Nc,[ec,"interpolating"]),Vc("sequential-sqrt",(function(){return Nc.apply(null,arguments).exponent(.5)}),[ec,"interpolating"]),Vc("sequential-symlog",(function t(){var e=Cc(qc());return e.copy=function(){return $c(e,t()).constant(e.constant())},rc.apply(e,arguments)}),[ec,"interpolating"]),Vc("diverging-linear",(function t(){var e=gc(Uc()(sc));return e.copy=function(){return $c(e,t())},rc.apply(e,arguments)}),[ec,"interpolating"]),Vc("diverging-log",(function t(){var e=wc(Uc()).domain([.1,1,10]);return e.copy=function(){return $c(e,t()).base(e.base())},rc.apply(e,arguments)}),[ec,"interpolating",Ql]),Vc("diverging-pow",Pc,[ec,"interpolating"]),Vc("diverging-sqrt",(function(){return Pc.apply(null,arguments).exponent(.5)}),[ec,"interpolating"]),Vc("diverging-symlog",(function t(){var e=Cc(Uc());return e.copy=function(){return $c(e,t()).constant(e.constant())},rc.apply(e,arguments)}),[ec,"interpolating"]),Vc("quantile",(function t(){var e,n=[],r=[],i=[];function a(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t0?i[e-1]:n[0],e=i?[a[i-1],r]:[a[e-1],a[e]]},u.unknown=function(t){return arguments.length?(e=t,u):u},u.thresholds=function(){return a.slice()},u.copy=function(){return t().domain([n,r]).range(o).unknown(e)},nc.apply(gc(u),arguments)}),"discretizing"),Vc("threshold",(function t(){var e,n=[.5],r=[0,1],i=1;function a(t){return t<=t?r[je(n,t,0,i)]:e}return a.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),a):n.slice()},a.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},a.unknown=function(t){return arguments.length?(e=t,a):e},a.copy=function(){return t().domain(n).range(r).unknown(e)},nc.apply(a,arguments)}),"discretizing"),Vc("bin-ordinal",(function t(){var e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(je(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=Wc(t),r):e.slice()},r.range=function(t){return arguments.length?(n=Hc.call(t),r):n.slice()},r.tickFormat=function(t,n){return mc(e[0],L(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),["discrete","discretizing"]),Vc("ordinal",ac,"discrete"),Vc("band",jc,"discrete"),Vc("point",(function(){return function t(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return t(n())},e}(jc().paddingInner(1))}),"discrete");const rf=["clamp","base","constant","exponent"];function af(t,e){var n=e[0],r=L(e)-n;return function(e){return t(n+e*r)}}function of(t,e,n){return s.piecewise(lf(e||"rgb",n),t)}function uf(t,e){for(var n=new Array(e),r=e+1,i=0;it[e]?a[e](t[e]()):0),a):ft(.5)}function lf(t,e){var n=s[function(t){return"interpolate"+t.toLowerCase().split("-").map((function(t){return t[0].toUpperCase()+t.slice(1)})).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function cf(t){for(var e=t.length/6|0,n=new Array(e),r=0;r1?(df[t]=e,this):df[t]}ff({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},cf),ff({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},t=>of(cf(t)));const pf=t=>O(t)?t.map(t=>String(t)):String(t),mf=(t,e)=>t[1]-e[1],gf=(t,e)=>e[1]-t[1];function vf(t,e,n){var r;return Dt(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n&&(e=Math.min(e,Math.floor(Rt(t.domain())/n||1)))),z(e)&&(r=e.step,e=e.interval),Ct(e)&&(e=t.type===Zl?Vn(e):t.type==tc?Xn(e):x("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function yf(t,e,n){let r=t.range(),i=r[0],a=L(r),o=mf;if(i>a&&(r=a,a=i,i=r,o=gf),i=Math.floor(i),a=Math.ceil(a),e=e.map(e=>[e,t(e)]).filter(t=>i<=t[1]&&t[1]<=a).sort(o).map(t=>t[0]),n>0&&e.length>1){const t=[e[0],L(e)];for(;e.length>n&&e.length>=3;)e=e.filter((t,e)=>!(e%2));e.length<3&&(e=t)}return e}function bf(t,e){return t.bins?yf(t,t.bins):t.ticks?t.ticks(e):t.domain()}function xf(t,e,n,r,i,a){var o=e.type;let u=pf;if(o===Zl||i===Zl)u=t.timeFormat(r);else if(o===tc||i===tc)u=t.utcFormat(r);else if(tf(o)){const i=t.formatFloat(r);if(a||e.bins)u=i;else{const t=_f(e,n,!1);u=e=>t(e)?i(e):""}}else if(e.tickFormat){const i=e.domain();u=t.formatSpan(i[0],i[i.length-1],n,r)}else r&&(u=t.format(r));return u}function _f(t,e,n){const r=bf(t,e),i=t.base(),a=Math.log(i),o=Math.max(1,i*e/r.length),u=t=>{let e=t/Math.pow(i,Math.round(Math.log(t)/a));return e*i1?i[1]-i[0]:i[0];for(r=1;r{var i=Mf(r[n+1],Mf(r.max,1/0)),a=Cf(e,t),o=Cf(i,t);return a&&o?a+" – "+o:o?"< "+o:"≥ "+a}}(u):"discrete"===r?function(t){return(e,n)=>n?t(e):null}(u):function(t){return e=>t(e)}(u)}function Mf(t,e){return null!=t?t:e}function Cf(t,e){return Number.isFinite(t)?e(t):null}function Ef(t,e,n,r){const i=r||e.type;return Ct(n)&&function(t){return Jc(t,"temporal")}(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||i!==Zl?n||i!==tc?Df(t,e,5,null,n,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}function Ff(t,e,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=Ef(t,e,n.format,n.formatType);if(Zc(e.type)){const t=wf(e).slice(1).map(i),n=t.length;return`${n} boundar${1===n?"y":"ies"}: ${t.join(", ")}`}if(Qc(e.type)){const t=e.domain(),n=t.length;return`${n} value${1===n?"":"s"}: ${n>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=e.domain();return`values from ${i(t[0])} to ${i(L(t))}`}}const Sf=(t,e,n)=>({role:t,"aria-roledescription":e,"aria-label":n||void 0}),Bf=Ut(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Of={axis:{desc:"axis",caption:function(t){const e=t.datum,n=t.orient,r=e.title?$f(t):null,i=t.context,a=i.scales[e.scale].value,o=i.dataflow.locale(),u=a.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(r?` titled '${r}'`:"")+` for a ${Qc(u)?"discrete":u} scale with `+Ff(o,a,t)}},legend:{desc:"legend",caption:function(t){const e=t.datum,n=e.title?$f(t):null,r=((e.type||"")+" legend").trim(),i=e.scales,a=Object.keys(i),o=t.context,u=o.scales[i[a[0]]].value,s=o.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?` titled '${n}'`:"")+" for "+function(t){return(t=t.map(t=>t+("fill"===t||"stroke"===t?" color":""))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+L(t)}(a)+" with "+Ff(s,u,t);var l}},"title-text":{desc:"title",caption:t=>`Title text '${qf(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${qf(t)}'`}},zf={ariaRole:"role",ariaRoleDescription:"aria-roledescription",description:"aria-label"};function Rf(t,e){const n=!1===e.aria;if(t("aria-hidden",n||void 0),n||null==e.description)for(const e in zf)t(zf[e],void 0);else{const n=e.mark.marktype;t("aria-label",e.description),t("role",e.ariaRole||("group"===n?"graphics-object":"graphics-symbol")),t("aria-roledescription",e.ariaRoleDescription||n+" mark")}}function Tf(t){return!1===t.aria?{"aria-hidden":!0}:Bf[t.role]?null:Of[t.role]?function(t,e){try{const n=t.items[0],r=e.caption||(()=>"");return Sf(e.role||"graphics-symbol",e.desc,n.description||r(n))}catch(t){return null}}(t,Of[t.role]):function(t){const e=t.marktype,n="group"===e||"text"===e||t.items.some(t=>null!=t.description&&!1!==t.aria);return Sf(n?"graphics-object":"graphics-symbol",e+" mark container",t.description)}(t)}function qf(t){return rt(t.text).join(" ")}function $f(t){try{return rt(L(t.items).items[0].text).join(" ")}catch(t){return null}}const Lf=t=>(t+"").replace(/&/g,"&").replace(/"/g,""");function Nf(t,e,n){var r,i,a="<"+t;if(e)for(r in e)null!=(i=e[r])&&(a+=" "+r+'="'+Lf(i)+'"');return n&&(a+=" "+n),a+">"}function Uf(t){return""}const Pf={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity",blend:"mix-blend-mode"},jf={fill:"none","stroke-miterlimit":10},If=Es.xmlns;function Wf(t){El.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var Hf=_t(Wf,El),Gf=El.prototype;function Yf(t,e,n){var r,i,a;if("radial"===e.gradient){var o=_l(t,n++,"pattern",If);o.setAttribute("id","p_"+e.id),o.setAttribute("viewBox","0,0,1,1"),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("preserveAspectRatio","xMidYMid slice"),(o=_l(o,0,"rect",If)).setAttribute("width","1"),o.setAttribute("height","1"),o.setAttribute("fill","url("+rd()+"#"+e.id+")"),(t=_l(t,n++,"radialGradient",If)).setAttribute("id",e.id),t.setAttribute("fx",e.x1),t.setAttribute("fy",e.y1),t.setAttribute("fr",e.r1),t.setAttribute("cx",e.x2),t.setAttribute("cy",e.y2),t.setAttribute("r",e.r2)}else(t=_l(t,n++,"linearGradient",If)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2);for(r=0,i=e.stops.length;r1&&t.previousSibling!=e}(o,n))&&e.insertBefore(o,n?n.nextSibling:e.firstChild),o}Hf.initialize=function(t,e,n,r){if(this._defs={gradient:{},clipping:{}},t){this._svg=_l(t,0,"svg",If),this._svg.setAttribute("class","marks"),Al(t,1),this._root=_l(this._svg,0,"g",If);for(const t in jf)this._root.setAttribute(t,jf[t]);Al(this._svg,1)}return this.background(this._bgcolor),Gf.initialize.call(this,t,e,n,r)},Hf.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),Gf.background.apply(this,arguments)},Hf.resize=function(t,e,n,r){return Gf.resize.call(this,t,e,n,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},Hf.canvas=function(){return this._svg},Hf.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in Es)t[e]=Es[e];var n=this._bgcolor?Nf("rect",{width:this._width,height:this._height,fill:this._bgcolor})+Uf("rect"):"";return Nf("svg",t)+(this._defs.el?this._defs.el.outerHTML:"")+n+this._root.outerHTML+Uf("svg")},Hf._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),Al(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},Hf.updateDefs=function(){const t=this._svg,e=this._defs;let n=e.el,r=0;for(const i in e.gradient)n||(e.el=n=_l(t,0,"defs",If)),r=Yf(n,e.gradient[i],r);for(const i in e.clipping)n||(e.el=n=_l(t,0,"defs",If)),r=Vf(n,e.clipping[i],r);n&&(0===r?(t.removeChild(n),e.el=null):Al(n,r))},Hf._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},Hf.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},Hf.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},Hf._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length||!this._dirtyID)return!0;var e,n,r,i,a,o,u,s=++this._dirtyID;for(a=0,o=t.length;a{const e=this.isDirty(t),n=Jf(t,r,s,a.tag,i);e&&(this._update(a,n,t),u&&function(t,e,n){e=e.lastChild.previousSibling;let r,i=0;as(n,n=>{r=t.draw(e,n,r),++i}),Al(e,1+i)}(this,n,t)),s=n,++l};return a.nested?e.items.length&&f(e.items[0]):as(e,f),Al(r,l),r};var Kf=null,Qf=null,Zf={group:function(t,e,n){const r=Kf=e.childNodes[2];Qf=r.__values__,t.foreground(ed,n,this),Qf=e.__values__,Kf=e.childNodes[1],t.content(ed,n,this);const i=Kf=e.childNodes[0];t.background(ed,n,this);const a=!1===n.mark.interactive?"none":null;if(a!==Qf.events&&(nd(r,"pointer-events",a),nd(i,"pointer-events",a),Qf.events=a),n.strokeForeground&&n.stroke){const t=n.fill;nd(r,"display",null),this.style(i,n),nd(i,"stroke",null),t&&(n.fill=null),Qf=r.__values__,this.style(r,n),t&&(n.fill=t),Kf=null}else nd(r,"display","none")},image:function(t,e,n){!1===n.smooth?(td(e,"image-rendering","optimizeSpeed"),td(e,"image-rendering","pixelated")):td(e,"image-rendering",null)},text:function(t,e,n){let r,i,a,o,u=Zs(n);O(u)?(i=u.map(t=>el(n,t)),r=i.join("\n"),r!==Qf.text&&(Al(e,0),a=e.ownerDocument,o=Qs(n),i.forEach((t,r)=>{const i=bl(a,"tspan",If);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",o)),e.appendChild(i)}),Qf.text=r)):(i=el(n,u),i!==Qf.text&&(e.textContent=i,Qf.text=i)),nd(e,"font-family",nl(n)),nd(e,"font-size",Ks(n)+"px"),nd(e,"font-style",n.fontStyle),nd(e,"font-variant",n.fontVariant),nd(e,"font-weight",n.fontWeight)}};function td(t,e,n){n!==Qf[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),Qf[e]=n)}function ed(t,e,n){e!==Qf[t]&&(n?function(t,e,n,r){null!=n?t.setAttributeNS(r,e,n):t.removeAttributeNS(r,e)}(Kf,t,e,n):nd(Kf,t,e),Qf[t]=e)}function nd(t,e,n){null!=n?t.setAttribute(e,n):t.removeAttribute(e)}function rd(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function id(t){El.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}Hf._update=function(t,e,n){Kf=e,Qf=e.__values__,Rf(ed,n),t.attr(ed,n,this);const r=Zf[t.type];r&&r.call(this,t,e,n),Kf&&this.style(Kf,n)},Hf.style=function(t,e){if(null!=e)for(const n in Pf){let r="font"===n?nl(e):e[n];if(r===Qf[n])continue;const i=Pf[n];null==r?t.removeAttribute(i):(ko(r)&&(r=wo(r,this._defs.gradient,rd())),t.setAttribute(i,r+"")),Qf[n]=r}};var ad=_t(id,El),od=El.prototype;function ud(t){return t.replace(/&/g,"&").replace(//g,">")}ad.resize=function(t,e,n,r){od.resize.call(this,t,e,n,r);var i=this._origin,a=this._text,o={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var u in Es)o[u]=Es[u];a.head=Nf("svg",o);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),a.bg=s?Nf("rect",{width:this._width,height:this._height,fill:s})+Uf("rect"):"",a.root=Nf("g",ht({},jf,{transform:"translate("+i+")"})),a.foot=Uf("g")+Uf("svg"),this},ad.background=function(){var t=od.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},ad.svg=function(){var t=this._text;return t.head+t.defs+t.bg+t.root+t.body+t.foot},ad._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},ad.buildDefs=function(){let t,e="";for(const n in this._defs.gradient){const r=this._defs.gradient[n],i=r.stops;"radial"===r.gradient?(e+=Nf(t="pattern",{id:"p_"+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e+=Nf("rect",{width:"1",height:"1",fill:"url(#"+n+")"})+Uf("rect"),e+=Uf(t),e+=Nf(t="radialGradient",{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):e+=Nf(t="linearGradient",{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let t=0;t{i[r||t]=e};return Array.isArray(n)?n.forEach(t=>t(a,e,this)):n(a,e,this),r&&function(t,e,n,r,i){if(null==e)return t;"bgrect"===r&&!1===n.interactive&&(t["pointer-events"]="none");if("bgfore"===r&&(!1===n.interactive&&(t["pointer-events"]="none"),t.display="none",null!==e.fill))return t;"image"===r&&!1===e.smooth&&(t.style="image-rendering: optimizeSpeed; image-rendering: pixelated;");"text"===r&&(t["font-family"]=nl(e),t["font-size"]=Ks(e)+"px",e.fontStyle&&(t["font-style"]=e.fontStyle),e.fontVariant&&(t["font-variant"]=e.fontVariant),e.fontWeight&&(t["font-weight"]=e.fontWeight));for(const n in Pf){let r=e[n];const a=Pf[n];("transparent"!==r||"fill"!==a&&"stroke"!==a)&&null!=r&&(ko(r)&&(r=wo(r,i.gradient,"")),t[a]=r)}}(i,e,t,r,this._defs),i},ad.href=function(t){var e,n=this,r=t.href;if(r){if(e=n._hrefs&&n._hrefs[r])return e;n.sanitizeURL(r).then(t=>{t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[r]=t})}return null},ad.mark=function(t){const e=ll[t.marktype],n=e.tag,r=[Rf,e.attr];let i="";i+=Nf("g",ht({class:kl(t),"clip-path":t.clip?yu(this,t,t.group):null},Tf(t),{"pointer-events":"g"!==n&&!1===t.interactive?"none":null}));const a=a=>{const o=this.href(a);if(o&&(i+=Nf("a",o)),i+=Nf(n,this.attr(t,a,r,"g"!==n?n:null)),"text"===n){const t=Zs(a);if(O(t)){const e={x:0,dy:Qs(a)};for(let n=0;n{e+=this.mark(t)}),e};var sd={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},ld={};function cd(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(ld[t]=e,this):ld[t]}function fd(t,e,n){const r=[],i=(new bu).union(e),a=t.marktype;return a?dd(t,i,n,r):"group"===a?hd(t,i,n,r):x("Intersect scene must be mark node or group item.")}function dd(t,e,n,r){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const i=t.items,a=t.marktype,o=i.length;let u=0;if("group"===a)for(;u=0;r--)if(i[r]!=a[r])return!1;for(r=i.length-1;r>=0;r--)if(n=i[r],!vd(t[n],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function yd(t,e){return vd(Bo(t),Bo(e))}function bd(t){Ur.call(this,null,t)}function xd(t,e,n){return e(t.bounds.clear(),t,n)}_t(bd,Ur).transform=function(t,e){var n,r=e.dataflow,i=t.mark,a=i.marktype,o=ll[a],u=o.bound,s=i.bounds;if(o.nested)i.items.length&&r.dirty(i.items[0]),s=xd(i,u),i.items.forEach((function(t){t.bounds.clear().union(s)}));else if("group"===a||t.modified())switch(e.visit(e.MOD,t=>r.dirty(t)),s.clear(),i.items.forEach(t=>s.union(xd(t,u))),i.role){case"axis":case"legend":case"title":e.reflow()}else n=e.changed(e.REM),e.visit(e.ADD,t=>{s.union(xd(t,u))}),e.visit(e.MOD,t=>{n=n||s.alignsWith(t.bounds),r.dirty(t),s.union(xd(t,u))}),n&&(s.clear(),i.items.forEach(t=>s.union(t.bounds)));return gd(i),e.modifies("bounds")};function _d(t){Ur.call(this,0,t)}function Ad(t){Ur.call(this,null,t)}function kd(t){Ur.call(this,null,t)}_d.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},_t(_d,Ur).transform=function(t,e){var n=function(t){var e=t._signals[":vega_identifier:"];e||(t._signals[":vega_identifier:"]=e=t.add(0));return e}(e.dataflow),r=n.value,i=t.as;return e.visit(e.ADD,t=>{t[i]||(t[i]=++r)}),n.set(this.value=r),e},_t(Ad,Ur).transform=function(t,e){var n=this.value;n||((n=e.dataflow.scenegraph().mark(t.markdef,function(t){var e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=n.group),n.source=this.source,n.clip=t.clip,n.interactive=t.interactive,this.value=n);var r="group"===n.marktype?Au:_u;return e.visit(e.ADD,t=>r.call(t,n)),(t.modified("clip")||t.modified("interactive"))&&(n.clip=t.clip,n.interactive=!!t.interactive,n.zdirty=!0,e.reflow()),n.items=e.source,e};var wd=_t(kd,Ur),Dd={parity:t=>t.filter((t,e)=>e%2?t.opacity=0:1),greedy:(t,e)=>{var n;return t.filter((t,r)=>r&&Md(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1))}};function Md(t,e,n){return n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function Cd(t,e){for(var n,r=1,i=t.length,a=t[0].bounds;r1&&e.height()>1}function Fd(t){return t.forEach(t=>t.opacity=1),t}function Sd(t,e){return t.reflow(e.modified()).modifies("opacity")}function Bd(t){Ur.call(this,null,t)}wd.transform=function(t,e){var n,r,i,a=Dd[t.method]||Dd.parity,o=e.materialize(e.SOURCE).source,u=t.separation||0;if(o&&o.length){if(!t.method)return t.modified("method")&&(Fd(o),e=Sd(e,t)),e;if((o=o.filter(Ed)).length){if(t.sort&&(o=o.slice().sort(t.sort)),n=Fd(o),e=Sd(e,t),n.length>=3&&Cd(n,u)){do{n=a(n,u)}while(n.length>=3&&Cd(n,u));n.length<3&&!L(o).opacity&&(n.length>1&&(L(n).opacity=0),L(o).opacity=1)}return t.boundScale&&t.boundTolerance>=0&&(r=function(t,e,n){var r=t.range(),i=new bu;return e===vo||"bottom"===e?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),t=>i.encloses(t.bounds)}(t.boundScale,t.boundOrient,+t.boundTolerance),o.forEach(t=>{r(t)||(t.opacity=0)})),i=n[0].mark.bounds.clear(),o.forEach(t=>{t.opacity&&i.union(t.bounds)}),e}}},_t(Bd,Ur).transform=function(t,e){var n=e.dataflow;if(e.visit(e.ALL,t=>n.dirty(t)),e.fields&&e.fields.zindex){var r=e.source&&e.source[0];r&&(r.mark.zdirty=!0)}};const Od=new bu;function zd(t,e,n){return t[e]===n?0:(t[e]=n,1)}function Rd(t){var e=t.items[0].orient;return e===yo||e===bo}function Td(t,e,n,r){var i,a,o=e.items[0],u=o.datum,s=null!=o.translate?o.translate:.5,l=o.orient,c=function(t){var e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(u),f=o.range,d=o.offset,h=o.position,p=o.minExtent,m=o.maxExtent,g=u.title&&o.items[c[2]].items[0],v=o.titlePadding,y=o.bounds,b=g&&tl(g),x=0,_=0;switch(Od.clear().union(y),y.clear(),(i=c[0])>-1&&y.union(o.items[i].bounds),(i=c[1])>-1&&y.union(o.items[i].bounds),l){case vo:x=h||0,_=-d,a=Math.max(p,Math.min(m,-y.y1)),y.add(0,-a).add(f,0),g&&qd(t,g,a,v,b,0,-1,y);break;case yo:x=-d,_=h||0,a=Math.max(p,Math.min(m,-y.x1)),y.add(-a,0).add(0,f),g&&qd(t,g,a,v,b,1,-1,y);break;case bo:x=n+d,_=h||0,a=Math.max(p,Math.min(m,y.x2)),y.add(0,0).add(a,f),g&&qd(t,g,a,v,b,1,1,y);break;case"bottom":x=h||0,_=r+d,a=Math.max(p,Math.min(m,y.y2)),y.add(0,0).add(f,a),g&&qd(t,g,a,v,0,0,1,y);break;default:x=o.x,_=o.y}return Fu(y.translate(x,_),o),zd(o,"x",x+s)|zd(o,"y",_+s)&&(o.bounds=Od,t.dirty(o),o.bounds=y,t.dirty(o)),o.mark.bounds.clear().union(y)}function qd(t,e,n,r,i,a,o,u){const s=e.bounds;if(e.auto){const u=o*(n+i+r);let l=0,c=0;t.dirty(e),a?l=(e.x||0)-(e.x=u):c=(e.y||0)-(e.y=u),e.mark.bounds.clear().union(s.translate(-l,-c)),t.dirty(e)}u.union(s)}const $d=(t,e)=>Math.floor(Math.min(t,e)),Ld=(t,e)=>Math.ceil(Math.max(t,e));function Nd(t){return(new bu).set(0,0,t.width||0,t.height||0)}function Ud(t){var e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function Pd(t,e,n){var r=z(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function jd(t){return t<0?Math.ceil(-t):0}function Id(t,e,n){var r,i,a,o,u,s,l,c,f,d,h,p=!n.nodirty,m="flush"===n.bounds?Nd:Ud,g=Od.set(0,0,0,0),v=Pd(n.align,"column"),y=Pd(n.align,_o),b=Pd(n.padding,"column"),x=Pd(n.padding,_o),_=n.columns||e.length,A=_<=0?1:Math.ceil(e.length/_),k=e.length,w=Array(k),D=Array(_),M=0,C=Array(k),E=Array(A),F=0,S=Array(k),B=Array(k),O=Array(k);for(i=0;i<_;++i)D[i]=0;for(i=0;i1)for(i=0;i0&&(S[i]+=f/2);if(y&&Pd(n.center,_o)&&1!==_)for(i=0;i0&&(B[i]+=d/2);for(i=0;ii&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),w+=a,m=0,v=e.length;m=0&&null==(x=n[g]);g-=d);u?(_=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),A=w):(_=w,A=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),y.union(b.bounds.translate(_-(b.x||0),A-(b.y||0))),b.x=_,b.y=A,t.dirty(b),D=o(D,y[l])}return D}function Yd(t,e,n,r,i,a){if(e){t.dirty(e);var o=n,u=n;r?o=Math.round(i.x1+a*i.width()):u=Math.round(i.y1+a*i.height()),e.bounds.translate(o-(e.x||0),u-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=o,e.y=u,t.dirty(e)}}function Vd(t,e,n,r,i,a,o){const u=function(t,e){const n=t[e]||{};return(e,r)=>null!=n[e]?n[e]:null!=t[e]?t[e]:r}(n,e),s=function(t,e){var n=-1/0;return t.forEach(t=>{null!=t.offset&&(n=Math.max(n,t.offset))}),n>-1/0?n:e}(t,u("offset",0)),l=u("anchor","start"),c=l===xo?1:"middle"===l?.5:0,f={align:"each",bounds:u("bounds","flush"),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(e){case yo:f.anchor={x:Math.floor(r.x1)-s,column:xo,y:c*(o||r.height()+2*r.y1),row:l};break;case bo:f.anchor={x:Math.ceil(r.x2)+s,y:c*(o||r.height()+2*r.y1),row:l};break;case vo:f.anchor={y:Math.floor(i.y1)-s,row:xo,x:c*(a||i.width()+2*i.x1),column:l};break;case"bottom":f.anchor={y:Math.ceil(i.y2)+s,x:c*(a||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:a-s,y:s,column:xo};break;case"bottom-left":f.anchor={x:s,y:o-s,row:xo};break;case"bottom-right":f.anchor={x:a-s,y:o-s,column:xo,row:xo}}return f}function Xd(t,e){var n,r,i,a,o=e.items[0],u=o.datum,s=o.orient,l=o.bounds,c=o.x,f=o.y;return o._bounds?o._bounds.clear().union(l):o._bounds=l.clone(),l.clear(),function(t,e,n){var r=e.padding,i=r-n.x,a=r-n.y;if(e.datum.title){var o=e.items[1].items[0],u=o.anchor,s=e.titlePadding||0,l=r-o.x,c=r-o.y;switch(o.orient){case yo:i+=Math.ceil(o.bounds.width())+s;break;case bo:case"bottom":break;default:a+=o.bounds.height()+s}switch((i||a)&&Kd(t,n,i,a),o.orient){case yo:c+=Jd(e,n,o,u,1,1);break;case bo:l+=Jd(e,n,o,xo,0,0)+s,c+=Jd(e,n,o,u,1,1);break;case"bottom":l+=Jd(e,n,o,u,0,0),c+=Jd(e,n,o,xo,-1,0,1)+s;break;default:l+=Jd(e,n,o,u,0,0)}(l||c)&&Kd(t,o,l,c),(l=Math.round(o.bounds.x1-r))<0&&(Kd(t,n,-l,0),Kd(t,o,-l,0))}else(i||a)&&Kd(t,n,i,a)}(t,o,o.items[0].items[0]),l=function(t,e){return t.items.forEach(t=>e.union(t.bounds)),e.x1=t.padding,e.y1=t.padding,e}(o,l),n=2*o.padding,r=2*o.padding,l.empty()||(n=Math.ceil(l.width()+n),r=Math.ceil(l.height()+r)),"symbol"===u.type&&(i=o.items[0].items[0].items[0].items,a=i.reduce((t,e)=>(t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t),{}),i.forEach(t=>{t.width=a[t.column],t.height=t.bounds.y2-t.y})),"none"!==s&&(o.x=c=0,o.y=f=0),o.width=n,o.height=r,Fu(l.set(c,f,c+n,f+r),o),o.mark.bounds.clear().union(l),o}function Jd(t,e,n,r,i,a,o){const u="symbol"!==t.datum.type,s=n.datum.vgrad,l=(!u||!a&&s||o?e:e.items[0]).bounds[i?"y2":"x2"]-t.padding,c=s&&a?l:0,f=s&&a?0:l,d=i<=0?0:tl(n);return Math.round("start"===r?c:r===xo?f-d:.5*(l-d))}function Kd(t,e,n,r){e.x+=n,e.y+=r,e.bounds.translate(n,r),e.mark.bounds.translate(n,r),t.dirty(e)}function Qd(t){Ur.call(this,null,t)}_t(Qd,Ur).transform=function(t,e){var n=e.dataflow;return t.mark.items.forEach(e=>{t.layout&&function(t,e,n){var r,i,a,o,u,s,l,c=function(t){for(var e,n,r=t.items,i=r.length,a=0,o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a{"none"!==(a=t.orient||bo)&&(e[a]||(e[a]=[])).push(t)});for(let r in e){const i=e[r];Id(t,i,Vd(i,r,n.legends,d,h,l,c))}p.forEach(e=>{const r=e.bounds;if(r.equals(e._bounds)||(e.bounds=e._bounds,t.dirty(e),e.bounds=r,t.dirty(e)),n.autosize&&"fit"===n.autosize.type)switch(e.orient){case yo:case bo:f.add(r.x1,0).add(r.x2,0);break;case vo:case"bottom":f.add(0,r.y1).add(0,r.y2)}else f.union(r)})}f.union(d).union(h),r&&f.union(function(t,e,n,r,i){var a,o=e.items[0],u=o.frame,s=o.orient,l=o.anchor,c=o.offset,f=o.padding,d=o.items[0].items[0],h=o.items[1]&&o.items[1].items[0],p=s===yo||s===bo?r:n,m=0,g=0,v=0,y=0,b=0;if("group"!==u?s===yo?(m=i.y2,p=i.y1):s===bo?(m=i.y1,p=i.y2):(m=i.x1,p=i.x2):s===yo&&(m=r,p=0),a="start"===l?m:l===xo?p:(m+p)/2,h&&h.text){switch(s){case vo:case"bottom":b=d.bounds.height()+f;break;case yo:y=d.bounds.width()+f;break;case bo:y=-d.bounds.width()-f}Od.clear().union(h.bounds),Od.translate(y-(h.x||0),b-(h.y||0)),zd(h,"x",y)|zd(h,"y",b)&&(t.dirty(h),h.bounds.clear().union(Od),h.mark.bounds.clear().union(Od),t.dirty(h)),Od.clear().union(h.bounds)}else Od.clear();switch(Od.union(d.bounds),s){case vo:g=a,v=i.y1-Od.height()-c;break;case yo:g=i.x1-Od.width()-c,v=a;break;case bo:g=i.x2+Od.width()+c,v=a;break;case"bottom":g=a,v=i.y2+c;break;default:g=o.x,v=o.y}return zd(o,"x",g)|zd(o,"y",v)&&(Od.translate(g,v),t.dirty(o),o.bounds.clear().union(Od),e.bounds.clear().union(Od),t.dirty(o)),o.bounds}(t,r,l,c,f));e.clip&&f.set(0,0,e.width||0,e.height||0);!function(t,e,n,r){const i=r.autosize||{},a=i.type;if(t._autosize<1||!a)return;let o=t._width,u=t._height,s=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,Math.ceil(n.x2-s)),f=Math.max(0,e.height||0),d=Math.max(0,Math.ceil(-n.y1)),h=Math.max(0,Math.ceil(n.y2-f));if("padding"===i.contains){const e=t.padding();o-=e.left+e.right,u-=e.top+e.bottom}"none"===a?(l=0,d=0,s=o,f=u):"fit"===a?(s=Math.max(0,o-l-c),f=Math.max(0,u-d-h)):"fit-x"===a?(s=Math.max(0,o-l-c),u=f+d+h):"fit-y"===a?(o=s+l+c,f=Math.max(0,u-d-h)):"pad"===a&&(o=s+l+c,u=f+d+h);t._resizeView(o,u,s,f,[l,d],i.resize)}(t,e,f,n)}(n,e,t)}),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?e.reflow():e};var Zd=Object.freeze({__proto__:null,bound:bd,identifier:_d,mark:Ad,overlap:kd,render:Bd,viewlayout:Qd});function th(t){Ur.call(this,null,t)}function eh(t){Ur.call(this,null,t)}function nh(){return Jt({})}function rh(t){Ur.call(this,null,t)}function ih(t){Ur.call(this,[],t)}_t(th,Ur).transform=function(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.dataflow.locale(),r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=this.value,a=t.scale,o=vf(a,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||xf(n,a,o,t.formatSpecifier,t.formatType,!!t.values),s=t.values?yf(a,t.values,o):bf(a,o);return i&&(r.rem=i),i=s.map((function(t,e){return Jt({index:e/(s.length-1||1),value:t,label:u(t)})})),t.extra&&i.length&&i.push(Jt({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r},_t(eh,Ur).transform=function(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||nh,a=t.key||Vt,o=this.value;return O(r.encode)&&(r.encode=null),o&&(t.modified("key")||e.modified(a))&&x("DataJoin does not support modified key function or fields."),o||(e=e.addAll(),this.value=o=function(t){const e=bt().test(t=>t.exit);return e.lookup=n=>e.get(t(n)),e}(a)),e.visit(e.ADD,t=>{const e=a(t);let n=o.get(e);n?n.exit?(o.empty--,r.add.push(n)):r.mod.push(n):(n=i(t),o.set(e,n),r.add.push(n)),n.datum=t,n.exit=!1}),e.visit(e.MOD,t=>{const e=a(t),n=o.get(e);n&&(n.datum=t,r.mod.push(n))}),e.visit(e.REM,t=>{const e=a(t),n=o.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++o.empty)}),e.changed(e.ADD_MOD)&&r.modifies("datum"),(e.clean()||t.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),r},_t(rh,Ur).transform=function(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,a=e.encode;if(O(a)){if(!n.changed()&&!a.every((function(t){return i[t]})))return e.StopPropagation;a=a[0],n.encode=null}var o="enter"===a,u=i.update||F,s=i.enter||F,l=i.exit||F,c=(a&&!o?i[a]:u)||F;if(e.changed(e.ADD)&&(e.visit(e.ADD,(function(e){s(e,t),u(e,t)})),n.modifies(s.output),n.modifies(u.output),c!==F&&c!==u&&(e.visit(e.ADD,(function(e){c(e,t)})),n.modifies(c.output))),e.changed(e.REM)&&l!==F&&(e.visit(e.REM,(function(e){l(e,t)})),n.modifies(l.output)),o||c!==F){var f=e.MOD|(t.modified()?e.REFLOW:0);o?(e.visit(f,(function(e){var i=s(e,t)||r;(c(e,t)||i)&&n.mod.push(e)})),n.mod.length&&n.modifies(s.output)):e.visit(f,(function(e){(c(e,t)||r)&&n.mod.push(e)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:e.StopPropagation},_t(ih,Ur).transform=function(t,e){if(null!=this.value&&!t.modified())return e.StopPropagation;var n,r,i,a,o,u=e.dataflow.locale(),s=e.fork(e.NO_SOURCE|e.NO_FIELDS),l=this.value,c=t.type||"symbol",f=t.scale,d=+t.limit,h=vf(f,null==t.count?5:t.count,t.minstep),p=!!t.values||"symbol"===c,m=t.format||Df(u,f,h,c,t.formatSpecifier,t.formatType,p),g=t.values||wf(f,h);return l&&(s.rem=l),"symbol"===c?(d&&g.length>d?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=g.slice(0,d-1),o=!0):l=g,at(i=t.size)?(t.values||0!==f(l[0])||(l=l.slice(1)),a=l.reduce((function(e,n){return Math.max(e,i(n,t))}),0)):i=ft(a=i||8),l=l.map((function(e,n){return Jt({index:n,label:m(e,n,l),value:e,offset:a,size:i(e,t)})})),o&&(o=g[l.length],l.push(Jt({index:l.length,label:`…${g.length-l.length} entries`,value:o,offset:a,size:i(o,t)})))):"gradient"===c?(n=f.domain(),r=sf(f,n[0],L(n)),g.length<3&&!t.values&&n[0]!==L(n)&&(g=[n[0],L(n)]),l=g.map((function(t,e){return Jt({index:e,label:m(t,e,g),value:t,perc:r(t)})}))):(i=g.length-1,r=function(t){var e=t.domain(),n=e.length-1,r=+e[0],i=+L(e),a=i-r;if("threshold"===t.type){const t=n?a/n:.1;a=(i+=t)-(r-=t)}return t=>(t-r)/a}(f),l=g.map((function(t,e){return Jt({index:e,label:m(t,e,g),value:t,perc:e?r(t):0,perc2:e===i?1:r(g[e+1])})}))),s.source=l,s.add=l,this.value=l,s};var ah=bt({line:fh,"line-radial":function(t,e,n,r){return fh(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},arc:dh,"arc-radial":function(t,e,n,r){return dh(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},curve:hh,"curve-radial":function(t,e,n,r){return hh(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},"orthogonal-horizontal":function(t,e,n,r){return"M"+t+","+e+"V"+r+"H"+n},"orthogonal-vertical":function(t,e,n,r){return"M"+t+","+e+"H"+n+"V"+r},"orthogonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),o=Math.cos(n),u=Math.sin(n),s=Math.abs(n-t)>Math.PI?n<=t:n>t;return"M"+e*i+","+e*a+"A"+e+","+e+" 0 0,"+(s?1:0)+" "+e*o+","+e*u+"L"+r*o+","+r*u},"diagonal-horizontal":function(t,e,n,r){var i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":function(t,e,n,r){var i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),o=Math.cos(n),u=Math.sin(n),s=(e+r)/2;return"M"+e*i+","+e*a+"C"+s*i+","+s*a+" "+s*o+","+s*u+" "+r*o+","+r*u}});function oh(t){return t.source.x}function uh(t){return t.source.y}function sh(t){return t.target.x}function lh(t){return t.target.y}function ch(t){Ur.call(this,{},t)}function fh(t,e,n,r){return"M"+t+","+e+"L"+n+","+r}function dh(t,e,n,r){var i=n-t,a=r-e,o=Math.sqrt(i*i+a*a)/2;return"M"+t+","+e+"A"+o+","+o+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+n+","+r}function hh(t,e,n,r){var i=n-t,a=r-e,o=.2*(i+a),u=.2*(a-i);return"M"+t+","+e+"C"+(t+o)+","+(e+u)+" "+(n+u)+","+(r-o)+" "+n+","+r}function ph(t){Ur.call(this,null,t)}ch.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},_t(ch,Ur).transform=function(t,e){var n=t.sourceX||oh,r=t.sourceY||uh,i=t.targetX||sh,a=t.targetY||lh,o=t.as||"path",u=t.orient||"vertical",s=t.shape||"line",l=ah.get(s+"-"+u)||ah.get(s);return l||x("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,(function(t){t[o]=l(n(t),r(t),i(t),a(t))})),e.reflow(t.modified()).modifies(o)},ph.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},_t(ph,Ur).transform=function(t,e){var n,r,i,a=t.as||["startAngle","endAngle"],o=a[0],u=a[1],s=t.field||C,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,d=f.map(s),h=d.length,p=l,m=(c-l)/rn(d),g=We(h);for(t.sort&&g.sort((function(t,e){return d[t]-d[e]})),n=0;n0?1:0)}),0))!==e.length&&n.warn("Log scale domain includes zero: "+Tt(e)));return e}function bh(t,e,n){return at(t)&&(e||n)?af(t,xh(e||[0,1],n)):t}function xh(t,e){return e?t.slice().reverse():t}function _h(t){Ur.call(this,null,t)}_t(vh,Ur).transform=function(t,e){var n=e.dataflow,r=this.value,i=function(t){var e,n=t.type,r="";if("sequential"===n)return"sequential-linear";(function(t){const e=t.type;return Kc(e)&&e!==Zl&&e!==tc&&(t.scheme||t.range&&t.range.length&&t.range.every(Ct))})(t)&&(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0,r=2===e?"sequential-":3===e?"diverging-":"");return(r+n||"linear").toLowerCase()}(t);for(i in r&&i===r.type||(this.value=r=Vc(i)()),t)if(!gh[i]){if("padding"===i&&mh(r.type))continue;at(r[i])?r[i](t[i]):n.warn("Unsupported scale property: "+i)}return function(t,e,n){var r=t.type,i=e.round||!1,a=e.range;if(null!=e.rangeStep)a=function(t,e,n){"band"!==t&&"point"!==t&&x("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i="point"===t?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*Kl(n,i,r)]}(r,e,n);else if(e.scheme&&(a=function(t,e,n){var r,i,a=e.schemeExtent;O(e.scheme)?i=of(e.scheme,e.interpolate,e.interpolateGamma):(r=e.scheme.toLowerCase(),(i=hf(r))||x("Unrecognized scheme name: "+e.scheme));return n="threshold"===t?n+1:"bin-ordinal"===t?n-1:"quantile"===t||"quantize"===t?+e.schemeCount||5:n,ef(t)?bh(i,a,e.reverse):at(i)?uf(bh(i,a),n):"ordinal"===t?i:i.slice(0,n)}(r,e,n),at(a))){if(t.interpolator)return t.interpolator(a);x(`Scale type ${r} does not support interpolating color schemes.`)}if(a&&ef(r))return t.interpolator(of(xh(a,e.reverse),e.interpolate,e.interpolateGamma));a&&e.interpolate&&t.interpolate?t.interpolate(lf(e.interpolate,e.interpolateGamma)):at(t.round)?t.round(i):at(t.rangeRound)&&t.interpolate(i?s.interpolateRound:s.interpolate);a&&t.range(xh(a,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!O(r)){let e=t.domain(),n=e[0],i=L(e),a=null==r.start?n:r.start,o=null==r.stop?i:r.stop,u=r.step;u||x("Scale bins parameter missing step property."),ai&&(o=u*Math.floor(i/u)),r=We(a,o+u/2,u)}r?t.bins=r:t.bins&&delete t.bins;"bin-ordinal"===t.type&&(r?e.domain||e.domainRaw||(t.domain(r),n=r.length):t.bins=t.domain());return n}(r,t,function(t,e,n){var r=function(t,e,n){return e?(t.domain(yh(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,a,o=e.domain,u=t.type,s=e.zero||void 0===e.zero&&function(t){const e=t.type;return!t.bins&&("linear"===e||"pow"===e||"sqrt"===e)}(t);if(!o)return 0;mh(u)&&e.padding&&o[0]!==L(o)&&(o=function(t,e,n,r,i,a){var o=Math.abs(L(n)-n[0]),u=o/(o-2*r),s=t===Ql?Q(e,null,u):"sqrt"===t?Z(e,null,u,.5):"pow"===t?Z(e,null,u,i||1):"symlog"===t?tt(e,null,u,a||1):K(e,null,u);return(e=e.slice())[0]=s[0],e[e.length-1]=s[1],e}(u,o,e.range,e.padding,e.exponent,e.constant));if((s||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(o=o.slice()).length-1||1,s&&(o[0]>0&&(o[0]=0),o[i]<0&&(o[i]=0)),null!=e.domainMin&&(o[0]=e.domainMin),null!=e.domainMax&&(o[i]=e.domainMax),null!=e.domainMid)){const t=(a=e.domainMid)>o[i]?i+1:ad&&(d=f),n&&c.sort(n)}return h.max=d,h}(e.source,t.groupby,l,c),r=0,i=n.length,a=n.max;ri(t,e))}function i(r,i){var o=[],u=[];return function(n,r,i){var o,u,s,l,c,f,d=new Array,h=new Array;o=u=-1,l=n[0]>=r,Fh[l<<1].forEach(p);for(;++o=r,Fh[s|l<<1].forEach(p);Fh[l<<0].forEach(p);for(;++u=r,c=n[u*t]>=r,Fh[l<<1|c<<2].forEach(p);++o=r,f=c,c=n[u*t+o+1]>=r,Fh[s|l<<1|c<<2|f<<3].forEach(p);Fh[l|c<<3].forEach(p)}o=-1,c=n[u*t]>=r,Fh[c<<2].forEach(p);for(;++o=r,Fh[c<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+o,t[0][1]+u],s=[t[1][0]+o,t[1][1]+u],l=a(r),c=a(s);(e=h[l])?(n=d[c])?(delete h[e.end],delete d[n.start],e===n?(e.ring.push(s),i(e.ring)):d[e.start]=h[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[e.end],e.ring.push(s),h[e.end=c]=e):(e=d[c])?(n=h[l])?(delete d[e.start],delete h[n.end],e===n?(e.ring.push(s),i(e.ring)):d[n.start]=h[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(r),d[e.start=l]=e):d[l]=h[c]={start:l,end:c,ring:[r,s]}}Fh[c<<3].forEach(p)}(r,i,(function(t){n(t,r,i),function(t){var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];for(;++e0?o.push([t]):u.push(t)})),u.forEach((function(t){for(var e,n=0,r=o.length;n0&&o0&&u=0&&a>=0||x("invalid size"),t=i,e=a,r},r.smooth=function(t){return arguments.length?(n=t?o:Eh,r):n===o},r}function Bh(t,e){for(var n,r=-1,i=e.length;++rr!=h>r&&n<(d-l)*(r-c)/(h-c)+l&&(i=-i)}return i}function zh(t,e,n){var r,i,a,o;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],a=n[r],o=e[r],i<=a&&a<=o||o<=a&&a<=i)}function Rh(t,e,n){return function(r){var i=pt(r),a=n?Math.min(i[0],0):i[0],o=i[1],u=o-a,s=e?Je(a,o,t):u/(t+1);return We(s,o,s)}}function Th(t){Ur.call(this,null,t)}function qh(t,e,n,r,i){const a=t.x1||0,o=t.y1||0,u=e*n<0;function s(t){t.forEach(l)}function l(t){u&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-a)*e+r,t[1]=(t[1]-o)*n+i}return function(t){return t.coordinates.forEach(s),t}}function $h(t,e,n){const r=t>=0?t:ui(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function Lh(t){return at(t)?t:ft(+t)}function Nh(){var t=t=>t[0],e=t=>t[1],n=C,r=[-1,-1],i=960,a=500,o=2;function u(u,s){const l=$h(r[0],u,t)>>o,c=$h(r[1],u,e)>>o,f=l?l+2:0,d=c?c+2:0,h=2*f+(i>>o),p=2*d+(a>>o),m=new Float32Array(h*p),g=new Float32Array(h*p);let v=m;u.forEach(r=>{const i=f+(+t(r)>>o),a=d+(+e(r)>>o);i>=0&&i=0&&a0&&c>0?(Uh(h,p,m,g,l),Ph(h,p,g,m,c),Uh(h,p,m,g,l),Ph(h,p,g,m,c),Uh(h,p,m,g,l),Ph(h,p,g,m,c)):l>0?(Uh(h,p,m,g,l),Uh(h,p,g,m,l),Uh(h,p,m,g,l),v=g):c>0&&(Ph(h,p,m,g,c),Ph(h,p,g,m,c),Ph(h,p,m,g,c),v=g);let y=s?Math.pow(2,-2*o):1/rn(v);for(let t=0,e=h*p;t>o),y2:d+(a>>o)}}return u.x=function(e){return arguments.length?(t=Lh(e),u):t},u.y=function(t){return arguments.length?(e=Lh(t),u):e},u.weight=function(t){return arguments.length?(n=Lh(t),u):n},u.size=function(t){if(!arguments.length)return[i,a];var e=+t[0],n=+t[1];return e>=0&&n>=0||x("invalid size"),i=e,a=n,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||x("invalid cell size"),o=Math.floor(Math.log(t)/Math.LN2),u):1<=i&&(e>=a&&(u-=n[e-a+o*t]),r[e-i+o*t]=u/Math.min(e+1,t-1+a-e,a))}function Ph(t,e,n,r,i){const a=1+(i<<1);for(let o=0;o=i&&(u>=a&&(s-=n[o+(u-a)*t]),r[o+(u-i)*t]=s/Math.min(u+1,e-1+a-u,a))}function jh(t){Ur.call(this,null,t)}Th.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},_t(Th,Ur).transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=e.materialize(e.SOURCE).source,i=t.field||D,a=Sh().smooth(!1!==t.smooth),o=t.thresholds||function(t,e,n){const r=Rh(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map(t=>Ke(e(t).values)))}(r,i,t),u=null===t.as?null:t.as||"contour",s=[];return r.forEach(e=>{const n=i(e),r=a.size([n.width,n.height])(n.values,O(o)?o:o(n.values));!function(t,e,n,r){let i=r.scale||e.scale,a=r.translate||e.translate;at(i)&&(i=i(n,r));at(a)&&(a=a(n,r));if((1===i||null==i)&&!a)return;const o=(Dt(i)?i:i[0])||1,u=(Dt(i)?i:i[1])||1,s=a&&a[0]||0,l=a&&a[1]||0;t.forEach(qh(e,o,u,s,l))}(r,n,e,t),r.forEach(t=>{s.push(Qt(e,Jt(null!=u?{[u]:t}:t)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=s,n},jh.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};var Ih=_t(jh,Ur);const Wh=["x","y","weight","size","cellSize","bandwidth"];function Hh(t,e){return Wh.forEach(n=>null!=e[n]?t[n](e[n]):0),t}function Gh(t){Ur.call(this,null,t)}Ih.transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=function(t,e){var n,r,i,a,o,u,s=[],l=t=>t(a);if(null==e)s.push(t);else for(n={},r=0,i=t.length;rJt(function(t,e){for(let n=0;n0?Math.sqrt(t):0}(2);function tp(t){return t>1?Qh:t<-1?-Qh:Math.asin(t)}function ep(t,e){var n,r=t*Jh(e),i=30;do{e-=n=(e+Jh(e)-r)/(1+Xh(e))}while(Vh(n)>1e-6&&--i>0);return e/2}var np=function(t,e,n){function r(r,i){return[t*r*Xh(i=ep(n,i)),e*Jh(i)]}return r.invert=function(r,i){return i=tp(i/e),[r/(t*Xh(i)),tp((2*i+Jh(2*i))/n)]},r}(Zh/Qh,Zh,Kh);var rp=l.geoPath(),ip=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function ap(t,e){return function n(){var r=e();return r.type=t,r.path=l.geoPath().projection(r),r.copy=r.copy||function(){var t=n();return ip.forEach((function(e){r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},r}}function op(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(sp[t]=ap(t,e),this):sp[t]||null}function up(t){return t&&t.path||rp}var sp={albers:l.geoAlbers,albersusa:l.geoAlbersUsa,azimuthalequalarea:l.geoAzimuthalEqualArea,azimuthalequidistant:l.geoAzimuthalEquidistant,conicconformal:l.geoConicConformal,conicequalarea:l.geoConicEqualArea,conicequidistant:l.geoConicEquidistant,equalEarth:l.geoEqualEarth,equirectangular:l.geoEquirectangular,gnomonic:l.geoGnomonic,identity:l.geoIdentity,mercator:l.geoMercator,mollweide:function(){return l.geoProjection(np).scale(169.529)},naturalEarth1:l.geoNaturalEarth1,orthographic:l.geoOrthographic,stereographic:l.geoStereographic,transversemercator:l.geoTransverseMercator};for(var lp in sp)op(lp,sp[lp]);function cp(t){Ur.call(this,null,t)}function fp(t){Ur.call(this,null,t)}function dp(t){Ur.call(this,null,t)}function hp(t){Ur.call(this,[],t),this.generator=l.geoGraticule()}function pp(t){Ur.call(this,null,t)}function mp(t){if(!at(t))return!1;const e=Ut(g(t));return e.$x||e.$y||e.$value||e.$max}function gp(t){Ur.call(this,null,t),this.modified(!0)}function vp(t,e,n){at(t[e])&&t[e](n)}cp.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},_t(cp,Ur).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||D,a=t.as||"path",o=n.SOURCE;!r||t.modified()?(this.value=r=up(t.projection),n.materialize().reflow()):o=i===D||e.modified(i.fields)?n.ADD_MOD:n.ADD;var u=function(t,e){var n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(o,(function(t){t[a]=r(i(t))})),r.pointRadius(u),n.modifies(a)},fp.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},_t(fp,Ur).transform=function(t,e){var n,r=t.projection,i=t.fields[0],a=t.fields[1],o=t.as||["x","y"],u=o[0],s=o[1];function l(t){var e=r([i(t),a(t)]);e?(t[u]=e[0],t[s]=e[1]):(t[u]=void 0,t[s]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,l):(n=e.modified(i.fields)||e.modified(a.fields),e.visit(n?e.ADD_MOD:e.ADD,l)),e.modifies(o)},dp.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},_t(dp,Ur).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.as||"shape",a=n.ADD;return r&&!t.modified()||(this.value=r=function(t,e,n){var r=null==n?function(n){return t(e(n))}:function(r){var i=t.pointRadius(),a=t.pointRadius(n)(e(r));return t.pointRadius(i),a};return r.context=function(e){return t.context(e),r},r}(up(t.projection),t.field||A("datum"),t.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,(function(t){t[i]=r})),n.modifies(i)},hp.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},_t(hp,Ur).transform=function(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(var a in t)at(i[a])&&i[a](t[a]);return n=i(),r.length?e.mod.push(Zt(r[0],n)):e.add.push(Jt(n)),r[0]=n,e},pp.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},_t(pp,Ur).transform=function(t,e){if(!e.changed()&&!t.modified())return e.StopPropagation;var n=e.materialize(e.SOURCE).source,r="shared"===t.resolve,i=t.field||D,a=function(t,e){let n;at(t)?(n=n=>t(n,e),n.dep=mp(t)):t?n=ft(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),o=function(t,e){let n;at(t)?(n=n=>c.rgb(t(n,e)),n.dep=mp(t)):n=ft(c.rgb(t||"#888"));return n}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?Ke(n.map(t=>Ke(i(t).values))):0};return n.forEach(t=>{const e=i(t),n=ht({},t,s);r||(n.$max=Ke(e.values||[])),t[u]=function(t,e,n,r){const i=t.width,a=t.height,o=t.x1||0,u=t.y1||0,s=t.x2||i,l=t.y2||a,c=t.values,f=c?t=>c[t]:M,d=ku(s-o,l-u),h=d.getContext("2d"),p=h.getImageData(0,0,s-o,l-u),m=p.data;for(let t=u,a=0;tt.concat(function(t){return"FeatureCollection"===t.type?t.features:rt(t).filter(t=>null!=t).map(t=>"Feature"===t.type?t:{type:"Feature",geometry:t})}(e)),[])}}(e.fit);e.extent?t.fitExtent(e.extent,n):e.size&&t.fitSize(e.size,n)}(n,t),e.fork(e.NO_SOURCE|e.NO_FIELDS)};var yp=Object.freeze({__proto__:null,contour:Gh,geojson:Yh,geopath:cp,geopoint:fp,geoshape:dp,graticule:hp,heatmap:pp,isocontour:Th,kde2d:jh,projection:gp}),bp={center:f.forceCenter,collide:f.forceCollide,nbody:f.forceManyBody,link:f.forceLink,x:f.forceX,y:f.forceY},xp=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],_p=["static","iterations"],Ap=["x","y","vx","vy"];function kp(t){Ur.call(this,null,t)}kp.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:Ap}]};var wp=_t(kp,Ur);function Dp(t,e,n,r){var i,a,o,u,s=rt(e.forces);for(i=0,a=xp.length;i=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return e.StopPropagation;return this.finish(t,e)},wp.finish=function(t,e){for(var n,r=e.dataflow,i=this._argops,a=0,o=i.length;afunction t(n,r){if(++r>e.length)return n;var i,a=[];for(i in n)a.push({key:i,values:t(n[i],r)});return a}(function t(n,r){if(r>=e.length)return n;for(var i,a,o,u=-1,s=n.length,l=e[r++],c={},f={};++u(e.push(n),t)}}function Rp(t){Ur.call(this,null,t)}function Tp(t,e){return t.parent===e.parent?1:2}Bp.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},_t(Bp,Ur).transform=function(t,e){e.source||x("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),i=e.clone(),a=this.value;return(!a||r||e.changed())&&(a&&a.each(t=>{t.children&&Yt(t.data)&&i.rem.push(t.data)}),this.value=a=d.hierarchy({values:rt(t.keys).reduce((t,e)=>(t.key(e),t),zp()).entries(i.source)},Op),n&&a.each(t=>{t.children&&(t=Jt(t.data),i.add.push(t),i.source.push(t))}),Sp(a,Vt,Vt)),i.source.root=a,i},_t(Rp,Ur).transform=function(t,e){e.source&&e.source.root||x(this.constructor.name+" transform requires a backing tree data source.");var n=this.layout(t.method),r=this.fields,i=e.source.root,a=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(te(t.sort,t=>t.data)),function(t,e,n){for(var r,i=0,a=e.length;i{ji(e,t.x,t.y,t.bandwidth||.3).forEach(t=>{const n={};for(let t=0;t{if(n.length<=u)return void e.dataflow.warn("Skipping regression with more parameters than data points.");const r=l(n,t.x,t.y,o);if(t.params)return void c.push(Jt({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const d=f||pt(n,t.x),h=t=>{const e={};for(let t=0;th([t,r.predict(t)])):Gi(r.predict,d,25,200).forEach(h)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n};var rm=Object.freeze({__proto__:null,loess:tm,regression:nm});const im=Math.pow(2,-52),am=new Uint32Array(512);class om{static from(t,e=pm,n=mm){const r=t.length,i=new Float64Array(2*r);for(let a=0;a>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=t.length>>1;let o=1/0,u=1/0,s=-1/0,l=-1/0;for(let e=0;es&&(s=n),r>l&&(l=r),this._ids[e]=e}const c=(o+s)/2,f=(u+l)/2;let d,h,p,m=1/0;for(let e=0;e0&&(h=e,m=n)}let y=t[2*h],b=t[2*h+1],x=1/0;for(let e=0;er&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(lm(g,v,y,b,_,A)){const t=h,e=y,n=b;h=p,y=_,b=A,p=t,_=e,A=n}const k=function(t,e,n,r,i,a){const o=n-t,u=r-e,s=i-t,l=a-e,c=o*o+u*u,f=s*s+l*l,d=.5/(o*l-u*s);return{x:t+(l*c-u*f)*d,y:e+(o*f-s*c)*d}}(g,v,y,b,_,A);this._cx=k.x,this._cy=k.y;for(let e=0;e0&&Math.abs(l-a)<=im&&Math.abs(c-o)<=im)continue;if(a=l,o=c,s===d||s===h||s===p)continue;let f=0;for(let t=0,e=this._hashKey(l,c);t0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,a=0;for(;;){const o=n[t],u=t-t%3;if(a=u+(t+2)%3,-1===o){if(0===i)break;t=am[--i];continue}const s=o-o%3,l=u+(t+1)%3,c=s+(o+2)%3,f=e[a],d=e[t],h=e[l],p=e[c];if(cm(r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*h],r[2*h+1],r[2*p],r[2*p+1])){e[t]=p,e[o]=f;const r=n[c];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(o,n[a]),this._link(a,c);const u=s+(o+1)%3;i=33306690738754716e-32*Math.abs(o+u)?o-u:0}function lm(t,e,n,r,i,a){return(sm(i,a,t,e,n,r)||sm(t,e,n,r,i,a)||sm(n,r,i,a,t,e))<0}function cm(t,e,n,r,i,a,o,u){const s=t-o,l=e-u,c=n-o,f=r-u,d=i-o,h=a-u,p=c*c+f*f,m=d*d+h*h;return s*(f*m-p*h)-l*(c*m-p*d)+(s*s+l*l)*(c*h-f*d)<0}function fm(t,e,n,r,i,a){const o=n-t,u=r-e,s=i-t,l=a-e,c=o*o+u*u,f=s*s+l*l,d=.5/(o*l-u*s),h=(l*c-u*f)*d,p=(o*f-s*c)*d;return h*h+p*p}function dm(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],a=e[r];let o=i-1;for(;o>=n&&e[t[o]]>a;)t[o+1]=t[o--];t[o+1]=r}else{let i=n+1,a=r;hm(t,n+r>>1,i),e[t[n]]>e[t[r]]&&hm(t,n,r),e[t[i]]>e[t[r]]&&hm(t,i,r),e[t[n]]>e[t[i]]&&hm(t,n,i);const o=t[i],u=e[o];for(;;){do{i++}while(e[t[i]]u);if(a=a-n?(dm(t,e,i,r),dm(t,e,n,a-1)):(dm(t,e,n,a-1),dm(t,e,i,r))}}function hm(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function pm(t){return t[0]}function mm(t){return t[1]}class gm{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class vm{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class ym{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,a=0,o=0,u=n.length;a1;)i-=2;for(let t=2;t4)for(let t=0;t0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)this.xmax?2:0)|(ethis.ymax?8:0)}}const bm=2*Math.PI,xm=Math.pow;function _m(t){return t[0]}function Am(t){return t[1]}function km(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class wm{static from(t,e=_m,n=Am,r){return new wm("length"in t?function(t,e,n,r){const i=t.length,a=new Float64Array(2*i);for(let o=0;o2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},(t,e)=>e).sort((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]);const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],a[r[0]]=1,2===r.length&&(a[r[1]]=0))}voronoi(t){return new ym(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:o}=this;if(o){const e=o.indexOf(t);return e>0&&(yield o[e-1]),void(e=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:a,halfedges:o,triangles:u,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let l=t,c=xm(e-s[2*t],2)+xm(n-s[2*t+1],2);const f=r[t];let d=f;do{let r=u[d];const f=xm(e-s[2*r],2)+xm(n-s[2*r+1],2);if(f=f));)if(e.x=o+i,e.y=l+a,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>u[0]||e.y+e.y1>u[1])&&(!n||!zm(e,t,u[0]))&&(!n||Tm(e,n))){for(var m,g=e.sprite,v=e.width>>5,y=u[0]>>5,b=e.x-(v<<4),x=127&b,_=32-x,A=e.y1-e.y0,k=(e.y+e.y0)*y+(b>>5),w=0;w>>x:0);k+=y}return e.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=2048/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(ku()),f=function(t){var e=[],n=-1;for(;++n>5)*u[1]),h=null,p=l.length,m=-1,g=[],v=l.map((function(u){return{text:t(u),font:e(u),style:r(u),weight:i(u),rotate:a(u),size:~~(n(u)+1e-14),padding:o(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}})).sort((function(t,e){return e.size-t.size}));++m>1,y.y=u[1]*(c()+.5)>>1,Om(s,y,v,m),y.hasText&&d(f,y,h)&&(g.push(y),h?Rm(h,y):h=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=u[0]>>1,y.y-=u[1]>>1)}return g},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(u=[+t[0],+t[1]],f):u},f.font=function(t){return arguments.length?(e=$m(t),f):e},f.fontStyle=function(t){return arguments.length?(r=$m(t),f):r},f.fontWeight=function(t){return arguments.length?(i=$m(t),f):i},f.rotate=function(t){return arguments.length?(a=$m(t),f):a},f.text=function(e){return arguments.length?(t=$m(e),f):t},f.spiral=function(t){return arguments.length?(s=Lm[t]||t,f):s},f.fontSize=function(t){return arguments.length?(n=$m(t),f):n},f.padding=function(t){return arguments.length?(o=$m(t),f):o},f.random=function(t){return arguments.length?(c=t,f):c},f}function Om(t,e,n,r){if(!e.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,2048/a,2048/a);var o,u,s,l,c,f=0,d=0,h=0,p=n.length;for(--r;++r>5<<5,s=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else o=o+31>>5<<5;if(s>h&&(h=s),f+o>=2048&&(f=0,d+=h,h=0),d+s>=2048)break;i.translate((f+(o>>1))/a,(d+(s>>1))/a),e.rotate&&i.rotate(e.rotate*Sm),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=o,e.height=s,e.xoff=f,e.yoff=d,e.x1=o>>1,e.y1=s>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=o}for(var _=i.getImageData(0,0,2048/a,2048/a).data,A=[];--r>=0;)if((e=n[r]).hasText){for(u=(o=e.width)>>5,s=e.y1-e.y0,l=0;l>5),M=_[2048*(d+c)+(f+l)<<2]?1<<31-l%32:0;A[D]|=M,k|=M}k?w=c:(e.y0++,s--,c--,d++)}e.y1=e.y0+w,e.sprite=A.slice(0,(e.y1-e.y0)*u)}}}function zm(t,e,n){n>>=5;for(var r,i=t.sprite,a=t.width>>5,o=t.x-(a<<4),u=127&o,s=32-u,l=t.y1-t.y0,c=(t.y+t.y0)*n+(o>>5),f=0;f>>u:0))&e[c+d])return!0;c+=n}return!1}function Rm(t,e){var n=t[0],r=t[1];e.x+e.x0r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function Tm(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0>1,g=p[1]>>1,v=0,y=h.length;vi?1:0})),function(t,e){return Array.from(e,e=>t[e])}(t,e)}(f,d),l)o=e,u=t,e=Array(l+c),t=Hm(l+c),function(t,e,n,r,i,a,o,u,s){var l,c=0,f=0;for(l=0;c0)for(s=0;s=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length)},add:function(t){for(var n,r=0,i=e.length,a=t.length;rr.length||n>t)&&(t=Math.max(n,t),r=Gm(e,t,r),i=Gm(e,t))}}}(),t),this._indices=null,this._dims=null}Xm.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]};var Jm=_t(Xm,Ur);function Km(t){Ur.call(this,null,t)}Jm.transform=function(t,e){return this._dims?t.modified("fields")||t.fields.some((function(t){return e.modified(t.fields)}))?this.reinit(t,e):this.eval(t,e):this.init(t,e)},Jm.init=function(t,e){for(var n,r,i=t.fields,a=t.query,o=this._indices={},u=this._dims=[],s=a.length,l=0;lg)for(i=g,a=Math.min(p,v);iv)for(i=Math.max(p,v),a=m;ih)for(i=h,a=Math.min(f,p);ip)for(i=Math.max(f,p),a=d;i{e!==t.signal(r.signal)&&t.runAsync(null,(function(){i.source=!0,t.signal(r.signal,e)}))}},r.debounce&&(i.update=dt(r.debounce,i.update))),function(t,e,n,r){const i=dg("div",{class:"vega-bind"}),a="radio"===n.input?i:i.appendChild(dg("label"));a.appendChild(dg("span",{class:"vega-bind-name"},n.name||n.signal)),e.appendChild(i);let o=pg;switch(n.input){case"checkbox":o=mg;break;case"select":o=gg;break;case"radio":o=vg;break;case"range":o=yg}o(t,a,n,r)}(i,e,r,t.signal(r.signal)),i.active||(t.on(t._signals[r.signal],null,()=>{i.source?i.source=!1:i.set(t.signal(r.signal))}),i.active=!0),i}function pg(t,e,n,r){const i=dg("input");for(const t in n)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,n[t]);i.setAttribute("name",n.signal),i.value=r,e.appendChild(i),i.addEventListener("input",()=>t.update(i.value)),t.elements=[i],t.set=t=>i.value=t}function mg(t,e,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const a=dg("input",i);e.appendChild(a),a.addEventListener("change",()=>t.update(a.checked)),t.elements=[a],t.set=t=>a.checked=!!t||null}function gg(t,e,n,r){const i=dg("select",{name:n.signal}),a=n.labels||[];n.options.forEach((t,e)=>{const n={value:t};bg(t,r)&&(n.selected=!0),i.appendChild(dg("option",n,(a[e]||t)+""))}),e.appendChild(i),i.addEventListener("change",()=>{t.update(n.options[i.selectedIndex])}),t.elements=[i],t.set=t=>{for(let e=0,r=n.options.length;e{const u={type:"radio",name:n.signal,value:e};bg(e,r)&&(u.checked=!0);const s=dg("input",u);s.addEventListener("change",()=>t.update(e));const l=dg("label",{},(a[o]||e)+"");return l.prepend(s),i.appendChild(l),s}),t.set=e=>{const n=t.elements,r=n.length;for(let t=0;t{s.textContent=u.value,t.update(+u.value)};u.addEventListener("input",l),u.addEventListener("change",l),t.elements=[u],t.set=t=>{u.value=t,s.textContent=t}}function bg(t,e){return t===e||t+""==e+""}function xg(t,e,n,r,i,a){return(e=e||new r(t.loader())).initialize(n,rg(t),ig(t),ag(t),i,a).background(t.background())}function _g(t,e){return e?function(){try{e.apply(this,arguments)}catch(e){t.error(e)}}:null}function Ag(t,e){if("string"==typeof e){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(e=document.querySelector(e)))return t.error("Signal bind element not found: "+e),null}if(e)try{e.innerHTML=""}catch(n){e=null,t.error(n)}return e}const kg=t=>+t||0;function wg(t){return z(t)?{top:kg(t.top),bottom:kg(t.bottom),left:kg(t.left),right:kg(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(kg(t))}async function Dg(t,e,n,r){const i=cd(e),a=i&&i.headless;return a||x("Unrecognized renderer type: "+e),await t.runAsync(),xg(t,null,null,a,n,r).renderAsync(t._scenegraph.root)}function Mg(t){const e=this.context.data[t];return e?e.values.value:[]}const Cg=t=>function(e,n){return this.context.dataflow.locale()[t](n)(e)},Eg=Cg("format"),Fg=Cg("timeFormat"),Sg=Cg("utcFormat"),Bg=Cg("timeParse"),Og=Cg("utcParse");var zg=new Date(2e3,0,1);function Rg(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(zg.setYear(2e3),zg.setMonth(t),zg.setDate(e),Fg.call(this,zg,n)):""}var Tg,qg,$g,Lg,Ng;function Ug(t){this.type=t}Ug.prototype.visit=function(t){var e,n,r;if(t(this))return 1;for(n=0,r=(e=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case"CallExpression":var e=t.arguments.slice();return e.unshift(t.callee),e;case"ConditionalExpression":return[t.test,t.consequent,t.alternate];case"MemberExpression":return[t.object,t.property];case"ObjectExpression":return t.properties;case"Property":return[t.key,t.value];case"UnaryExpression":return[t.argument];case"Identifier":case"Literal":case"RawCode":default:return[]}}(this)).length;n",Tg[3]="Identifier",Tg[4]="Keyword",Tg[5]="Null",Tg[6]="Numeric",Tg[7]="Punctuator",Tg[8]="String",Tg[9]="RegularExpression";var Pg="ILLEGAL",jg=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\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D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u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E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function Wg(t,e){if(!t)throw new Error("ASSERT: "+e)}function Hg(t){return t>=48&&t<=57}function Gg(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function Yg(t){return"01234567".indexOf(t)>=0}function Vg(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function Xg(t){return 10===t||13===t||8232===t||8233===t}function Jg(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&jg.test(String.fromCharCode(t))}function Kg(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&Ig.test(String.fromCharCode(t))}var Qg={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function Zg(){for(var t;$g1114111||"}"!==t)&&gv({},"Unexpected token %0",Pg),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function nv(){var t,e;for(t=qg.charCodeAt($g++),e=String.fromCharCode(t),92===t&&(117!==qg.charCodeAt($g)&&gv({},"Unexpected token %0",Pg),++$g,(t=tv("u"))&&"\\"!==t&&Jg(t.charCodeAt(0))||gv({},"Unexpected token %0",Pg),e=t);$g>>="===(r=qg.substr($g,4))?{type:7,value:r,start:i,end:$g+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:$g+=3}:o===(e=n.substr(0,2))[1]&&"+-<>&|".indexOf(o)>=0||"=>"===e?{type:7,value:e,start:i,end:$g+=2}:"<>=!+-*%&|^/".indexOf(o)>=0?{type:7,value:o,start:i,end:++$g}:void gv({},"Unexpected token %0",Pg)}function av(){var t,e,n;if(Wg(Hg((n=qg[$g]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=$g,t="","."!==n){if(t=qg[$g++],n=qg[$g],"0"===t){if("x"===n||"X"===n)return++$g,function(t){for(var e="";$g=0&&gv({},"Invalid regular expression",n),{value:n,literal:e}}(),r=function(t,e){var n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(t,e){if(parseInt(e,16)<=1114111)return"x";gv({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){gv({},"Invalid regular expression")}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:$g}}function uv(){var t;return Zg(),$g>=Lg?{type:2,start:$g,end:$g}:Jg(t=qg.charCodeAt($g))?rv():40===t||41===t||59===t?iv():39===t||34===t?function(){var t,e,n,r,i="",a=!1;for(Wg("'"===(t=qg[$g])||'"'===t,"String literal must starts with a quote"),e=$g,++$g;$g=0&&$g":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function zv(){var t,e;return t=function(){var t,e,n,r,i,a,o,u,s,l;if(t=Ng,s=Bv(),0===(i=Ov(r=Ng)))return s;for(r.prec=i,sv(),e=[t,Ng],a=[s,r,o=Bv()];(i=Ov(Ng))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),u=a.pop().value,s=a.pop(),e.pop(),n=cv(u,s,o),a.push(n);(r=sv()).prec=i,a.push(r),e.push(Ng),n=Bv(),a.push(n)}for(n=a[l=a.length-1],e.pop();l>1;)e.pop(),n=cv(a[l-1].value,a[l-2],n),l-=2;return n}(),bv("?")&&(sv(),e=zv(),yv(":"),t=function(t,e,n){var r=new Ug("ConditionalExpression");return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,zv())),t}function Rv(){var t=zv();if(bv(","))throw new Error("Disabled.");return t}var Tv={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function qv(t){function e(e,n,r){return function(i){return function(e,n,r,i){var a=t(n[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}}var n="new Date";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(e){e.length<3&&x("Missing arguments to clamp function."),e.length>3&&x("Too many arguments to clamp function.");var n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),join:e("join",null),indexof:e("indexOf",null),lastindexof:e("lastIndexOf",null),slice:e("slice",null),reverse:function(e){return"("+t(e[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase","String",0),lower:e("toLowerCase","String",0),substring:e("substring","String"),split:e("split","String"),replace:e("replace","String"),trim:e("trim","String",0),regexp:"RegExp",test:e("test","RegExp"),if:function(e){e.length<3&&x("Missing arguments to if function."),e.length>3&&x("Too many arguments to if function.");var n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function $v(t,e,n,r){"Literal"!==e[0].type&&x("First argument to data functions must be a string literal.");const i=e[0].value,a=":"+i;if(!vt(a,r))try{r[a]=n.getData(i).tuplesRef()}catch(t){}}function Lv(t,e,n,r){if("Literal"===e[0].type)Nv(n,r,e[0].value);else for(t in n.scales)Nv(n,r,t)}function Nv(t,e,n){const r="%"+n;if(!vt(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}function Uv(t,e){let n;return at(t)?t:Ct(t)?(n=e.scales[t])&&n.value:void 0}function Pv(t,e){return function(n,r,i){if(n){const e=Uv(n,(i||this).context);return e&&e.path[t](r)}return e(r)}}const jv=Pv("area",l.geoArea),Iv=Pv("bounds",l.geoBounds),Wv=Pv("centroid",l.geoCentroid);function Hv(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}function Gv(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Yv(t){const e=c.rgb(t);return.2126*Gv(e.r)+.7152*Gv(e.g)+.0722*Gv(e.b)}function Vv(t,e){return t===e||t!=t&&e!=e||(O(t)?!(!O(e)||t.length!==e.length)&&function(t,e){for(let n=0,r=t.length;nXv(t,e)}const Kv=t=>t.data;function Qv(t,e){const n=Mg.call(e,t);return n.root&&n.root.lookup||{}}const Zv=()=>"undefined"!=typeof window&&window||null;function ty(t,e){for(var n,r,i=e.fields,a=e.values,o=i.length,u=0;u=0})):e},R_union:function(t,e){var n=N(e[0]),r=N(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]r&&(n=e[1],r=e[0]),t.length?rr&&(t[1]=r),t):[n,r]}};function ny(t,e,n,r){"Literal"!==e[0].type&&x("First argument to selection functions must be a string literal.");const i=e[0].value,a=":"+i;"intersect"!==(e.length>=2&&L(e).value)||vt(r,"@unit")||(r["@unit"]=n.getData(i).indataRef(n,"unit")),vt(r,a)||(r[a]=n.getData(i).tuplesRef())}const ry={random:function(){return t.random()},cumulativeNormal:gi,cumulativeLogNormal:Ai,cumulativeUniform:Ei,densityNormal:mi,densityLogNormal:_i,densityUniform:Ci,quantileNormal:vi,quantileLogNormal:ki,quantileUniform:Fi,sampleNormal:pi,sampleLogNormal:xi,sampleUniform:Mi,isArray:O,isBoolean:kt,isDate:wt,isDefined:function(t){return void 0!==t},isNumber:Dt,isObject:z,isRegExp:Mt,isString:Ct,isTuple:Yt,isValid:function(t){return null!=t&&t==t},toBoolean:qt,toDate:Lt,toNumber:N,toString:Nt,flush:xt,lerp:Ft,merge:function(){var t=[].slice.call(arguments);return t.unshift({}),ht.apply(null,t)},pad:zt,peek:L,span:Rt,inrange:At,truncate:Pt,rgb:c.rgb,lab:c.lab,hcl:c.hcl,hsl:c.hsl,luminance:Yv,contrast:function(t,e){const n=Yv(t),r=Yv(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:We,format:Eg,utcFormat:Sg,utcParse:Og,utcOffset:Qn,utcSequence:er,timeFormat:Fg,timeParse:Bg,timeOffset:Kn,timeSequence:tr,timeUnitSpecifier:kn,monthFormat:function(t){return Rg.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return Rg.call(this,t,1,"%b")},dayFormat:function(t){return Rg.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return Rg.call(this,0,2+t,"%a")},quarter:et,utcquarter:nt,week:Cn,utcweek:zn,dayofyear:Mn,utcdayofyear:On,warn:function(){return Hv(this.context.dataflow,"warn",arguments)},info:function(){return Hv(this.context.dataflow,"info",arguments)},debug:function(){return Hv(this.context.dataflow,"debug",arguments)},extent:pt,inScope:function(t){let e=this.context.group,n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},intersect:function(t,e,n){if(!t)return[];const[r,i]=t,a=(new bu).set(r[0],r[1],i[0],i[1]);return fd(n||this.context.dataflow.scenegraph().root,a,function(t){let e=null;if(t){const n=rt(t.marktype),r=rt(t.markname);e=t=>(!n.length||n.some(e=>t.marktype===e))&&(!r.length||r.some(e=>t.name===e))}return e}(e))},clampRange:it,pinchDistance:function(t){const e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(t){const e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){const t=Zv();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){const t=Zv();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,e,n){return Kl(t||0,e||0,n||0)},setdata:function(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(E).insert(e)),1},pathShape:function(t){let e=null;return function(n){return n?jo(n,e=e||Bo(t)):t}},panLinear:G,panLog:Y,panPow:V,panSymlog:X,zoomLinear:K,zoomLog:Q,zoomPow:Z,zoomSymlog:tt,encode:function(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,a){let o,u,s=this.context.dataflow,l=this.context.data[t],c=l.input,f=l.changes,d=s.stamp();if(!1===s._trigger||!(c.value.length||e||r))return 0;if((!f||f.stampa.stop(l(e),t(e))),a}),Lv),oy("geoArea",jv,Lv),oy("geoBounds",Iv,Lv),oy("geoCentroid",Wv,Lv),oy("geoShape",(function(t,e,n){const r=Uv(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}),Lv),oy("indata",(function(t,e,n){const r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(t,e,n,r){"Literal"!==e[0].type&&x("First argument to indata must be a string literal."),"Literal"!==e[1].type&&x("Second argument to indata must be a string literal.");const i=e[0].value,a=e[1].value,o="@"+a;vt(o,r)||(r[o]=n.getData(i).indataRef(n,a))})),oy("data",Mg,$v),oy("treePath",(function(t,e,n){const r=Qv(t,this),i=r[e],a=r[n];return i&&a?i.path(a).map(Kv):void 0}),$v),oy("treeAncestors",(function(t,e){const n=Qv(t,this)[e];return n?n.ancestors().map(Kv):void 0}),$v),oy("vlSelectionTest",(function(t,e,n){for(var r,i,a,o,u,s=this.context.data[t],l=s?s.values.value:[],c=s?s["index:unit"]&&s["index:unit"].value:void 0,f="intersect"===n,d=l.length,h=0;h(t[i[n].field]=e,t),{}))}return e=e||"union",Object.keys(g).forEach((function(t){g[t]=Object.keys(g[t]).map(e=>g[t][e]).reduce((n,r)=>void 0===n?r:ey[y[t]+"_"+e](n,r))})),m=Object.keys(v),n&&m.length&&(g.vlMulti="union"===e?{or:m.reduce((t,e)=>(t.push.apply(t,v[e]),t),[])}:{and:m.map(t=>({or:v[t]}))}),g}),ny);const uy={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:t=>"_["+Tt("$"+t)+"]",functions:function(t){const e=qv(t);iy.forEach(t=>e[t]="event.vega."+t);for(let t in ry)e[t]="this."+t;return ht(e,function(t,e,n){e.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,n._bandwidth=Lv,n._range=Lv,n._scale=Lv;const r=e=>"_["+("Literal"===e.type?Tt("%"+e.value):Tt("%")+"+"+t(e))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>r(t[0])+".range()",_scale:e=>`${r(e[0])}(${t(e[1])})`}}(t,ry,ay)),e},constants:Tv,visitors:ay};var sy=function(t){var e=(t=t||{}).whitelist?Ut(t.whitelist):{},n=t.blacklist?Ut(t.blacklist):{},r=t.constants||Tv,i=(t.functions||qv)(f),a=t.globalvar,o=t.fieldvar,u={},s={},l=0,c=at(a)?a:function(t){return a+'["'+t+'"]'};function f(t){if(Ct(t))return t;var e=d[t.type];return null==e&&x("Unsupported type: "+t.type),e(t)}var d={Literal:function(t){return t.raw},Identifier:function(t){var i=t.name;return l>0?i:vt(n,i)?x("Illegal identifier: "+i):vt(r,i)?r[i]:vt(e,i)?i:(u[i]=1,c(i))},MemberExpression:function(t){var e=!t.computed,n=f(t.object);e&&(l+=1);var r=f(t.property);return n===o&&(s[function(t){var e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(l-=1),n+(e?"."+r:"["+r+"]")},CallExpression:function(t){"Identifier"!==t.callee.type&&x("Illegal callee type: "+t.callee.type);var e=t.callee.name,n=t.arguments,r=vt(i,e)&&i[e];return r||x("Unrecognized function: "+e),at(r)?r(n):r+"("+n.map(f).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(f).join(",")+"]"},BinaryExpression:function(t){return"("+f(t.left)+t.operator+f(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+f(t.argument)+")"},ConditionalExpression:function(t){return"("+f(t.test)+"?"+f(t.consequent)+":"+f(t.alternate)+")"},LogicalExpression:function(t){return"("+f(t.left)+t.operator+f(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(f).join(",")+"}"},Property:function(t){l+=1;var e=f(t.key);return l-=1,e+":"+f(t.value)}};function h(t){var e={code:f(t),globals:Object.keys(u),fields:Object.keys(s)};return u={},s={},e}return h.functions=i,h.constants=r,h}(uy);function ly(t,e){var n,r,i={};try{n=function(t){$g=0,Lg=(qg=t).length,Ng=null,lv();var e=Rv();if(2!==Ng.type)throw new Error("Unexpect token after expression.");return e}(t=Ct(t)?t:Tt(t)+"")}catch(e){x("Expression parse error: "+t)}return n.visit(t=>{if("CallExpression"===t.type){var n=t.callee.name,r=uy.visitors[n];r&&r(n,t.arguments,e,i)}}),(r=sy(n)).globals.forEach(t=>{var n="$"+t;!vt(i,n)&&e.getSignal(t)&&(i[n]=e.signalRef(t))}),{$expr:ht({code:r.code},e.options.ast?{ast:n}:null),$fields:r.fields,$params:i}}const cy=Ut(["rule"]),fy=Ut(["group","image","rect"]);function dy(t){return(t+"").toLowerCase()}function hy(t,e,n){";"!==n[n.length-1]&&(n="return("+n+");");var r=Function.apply(null,e.concat(n));return t&&t.functions?r.bind(t.functions):r}var py={operator:(t,e)=>hy(t,["_"],e.code),parameter:(t,e)=>hy(t,["datum","_"],e.code),event:(t,e)=>hy(t,["event"],e.code),handler:(t,e)=>hy(t,["_","event"],`var datum=event.item&&event.item.datum;return ${e.code};`),encode:(t,e)=>{const{marktype:n,channels:r}=e;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const e="o["+Tt(t)+"]";i+=`$=${r[t].code};if(${e}!==$)${e}=$,m=1;`}return i+=function(t,e){let n="";return cy[e]||(t.x2&&(t.x?(fy[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(fy[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(r,n),i+="return m;",hy(t,["item","_"],i)},codegen:{get(t){const e=`[${t.map(Tt).join("][")}]`,n=Function("_",`return _${e};`);return n.path=e,n},comparator(t,e){let n;const r=Function("a","b","var u, v; return "+t.map((t,r)=>{const i=e[r];let a,o;return t.path?(a="a"+t.path,o="b"+t.path):((n=n||{})["f"+r]=t,a=`this.f${r}(a)`,o=`this.f${r}(b)`),function(t,e,n,r){return`((u = ${t}) < (v = ${e}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${r}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${r} : `}(a,o,-i,i)}).join("")+"0;");return n?r.bind(n):r}}};function my(t,e,n){if(!t||!z(t))return t;for(let r,i=0,a=gy.length;it&&t.$tupleid?Vt:t);return e.fn[n]||(e.fn[n]=ot(r,t.$order,e.expr.codegen))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,e){const n=t.$subflow;return function(t,r,i){const a=e.fork().parse(n),o=a.get(n.operators[0].id),u=a.signals.parent;return u&&u.set(i),o.detachSubflow=()=>e.detach(a),o}}},{key:"$tupleid",parse:function(){return Vt}}];var vy={skip:!0};function yy(t,e,n,r){return new by(t,e,n,r)}function by(t,e,n,r){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.expr=r||py,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function xy(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}by.prototype=xy.prototype={fork(){const t=new xy(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter(e=>e!==t);const e=Object.keys(t.nodes);for(const n of e)t.nodes[n]._targets=null;for(const n of e)t.nodes[n].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,e){return this.nodes[t]=e},add(t,e){const n=this,r=n.dataflow,i=t.value;if(n.set(t.id,e),function(t){return"collect"===dy(t)}(t.type)&&i&&(i.$ingest?r.ingest(e,i.$ingest,i.$format):i.$request?r.preload(e,i.$request,i.$format):r.pulse(e,r.changeset().insert(i))),t.root&&(n.root=e),t.parent){var a=n.get(t.parent.$ref);a?(r.connect(a,[e]),e.targets().add(a)):(n.unresolved=n.unresolved||[]).push(()=>{a=n.get(t.parent.$ref),r.connect(a,[e]),e.targets().add(a)})}if(t.signal&&(n.signals[t.signal]=e),t.scale&&(n.scales[t.scale]=e),t.data)for(const r in t.data){const i=n.data[r]||(n.data[r]={});t.data[r].forEach(t=>i[t]=e)}},resolve(){return(this.unresolved||[]).forEach(t=>t()),delete this.unresolved,this},operator(t,e){this.add(t,this.dataflow.add(t.value,e))},transform(t,e){this.add(t,this.dataflow.add(this.transforms[dy(e)]))},stream(t,e){this.set(t.id,e)},update(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const e=this,n=t.operators||[];return t.background&&(e.background=t.background),t.eventConfig&&(e.eventConfig=t.eventConfig),t.locale&&(e.locale=t.locale),n.forEach(t=>e.parseOperator(t)),n.forEach(t=>e.parseOperatorParameters(t)),(t.streams||[]).forEach(t=>e.parseStream(t)),(t.updates||[]).forEach(t=>e.parseUpdate(t)),e.resolve()},parseOperator:function(t){const e=this;!function(t){return"operator"===dy(t)}(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?e.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const e=this;if(t.params){const n=e.get(t.id);n||x("Invalid operator id: "+t.id),e.dataflow.connect(n,n.parameters(e.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,e){e=e||{};const n=this;for(const r in t){const i=t[r];e[r]=O(i)?i.map(t=>my(t,n,e)):my(i,n,e)}return e},parseStream:function(t){var e,n=this,r=null!=t.filter?n.eventExpression(t.filter):void 0,i=null!=t.stream?n.get(t.stream):void 0;t.source?i=n.events(t.source,t.type,r):t.merge&&(i=(e=t.merge.map(t=>n.get(t)))[0].merge.apply(e[0],e.slice(1))),t.between&&(e=t.between.map(t=>n.get(t)),i=i.between(e[0],e[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&x("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),n.stream(t,i)},parseUpdate:function(t){var e,n=z(n=t.source)?n.$ref:n,r=this.get(n),i=t.update,a=void 0;r||x("Source not defined: "+t.source),e=t.target&&t.target.$expr?this.eventExpression(t.target.$expr):this.get(t.target),i&&i.$expr&&(i.$params&&(a=this.parseParameters(i.$params)),i=this.handlerExpression(i.$expr)),this.update(t,r,e,i,a)},getState:function(t){var e=this,n={};if(t.signals){var r=n.signals={};Object.keys(e.signals).forEach(n=>{var i=e.signals[n];t.signals(n,i)&&(r[n]=i.value)})}if(t.data){var i=n.data={};Object.keys(e.data).forEach(n=>{var r=e.data[n];t.data(n,r)&&(i[n]=r.input.value)})}return e.subcontext&&!1!==t.recurse&&(n.subcontext=e.subcontext.map(e=>e.getState(t))),n},setState:function(t){var e=this,n=e.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach(t=>{n.update(e.signals[t],i[t],vy)}),Object.keys(r||{}).forEach(t=>{n.pulse(e.data[t].input,n.changeset().remove(E).insert(r[t]))}),(t.subcontext||[]).forEach((t,n)=>{var r=e.subcontext[n];r&&r.setState(t)})}};var _y={skip:!0};function Ay(t,e){var n=t.autosize(),r=t.padding();return e-(n&&"padding"===n.contains?r.left+r.right:0)}function ky(t,e){var n=t.autosize(),r=t.padding();return e-(n&&"padding"===n.contains?r.top+r.bottom:0)}function wy(t,e){return e.modified&&O(e.input.value)&&t.indexOf("_:vega:_")}function Dy(t,e){return!("parent"===t||e instanceof jr.proxy)}function My(t,e,n,r){var i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":O(t)?Cy(t):z(t)&&!wt(t)?(e=t,Object.keys(e).map((function(t){var n=e[t];return t+": "+(O(n)?Cy(n):Ey(n))})).join("\n")):t+"";var e}(r))}function Cy(t){return"["+t.map(Ey).join(", ")+"]"}function Ey(t){return O(t)?"[…]":z(t)&&!wt(t)?"{…}":t}function Fy(t,e){const n=this;if(e=e||{},$r.call(n),e.loader&&n.loader(e.loader),e.logger&&n.logger(e.logger),null!=e.logLevel&&n.logLevel(e.logLevel),e.locale||t.locale){const r=ht({},t.locale,e.locale);n.locale(yr(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=e.renderer||sd.Canvas,n._scenegraph=new gl;const r=n._scenegraph.root;n._renderer=null,n._tooltip=e.tooltip||My,n._redraw=!0,n._handler=(new Nl).scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(t){const e=ht({defaults:{}},t),n=(t,e)=>{e.forEach(e=>{O(t[e])&&(t[e]=Ut(t[e]))})};return n(e.defaults,["prevent","allow"]),n(e,["view","window","selector"]),e}(t.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=function(t,e,n){return yy(t,jr,ry,n).parse(e)}(n,t,e.expr);n._runtime=i,n._signals=i.signals,n._bind=(t.bindings||[]).map(t=>({state:null,param:ht({},t)})),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=Ay(n,n._width),n._viewHeight=ky(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(t){var e=t._signals,n=e.width,r=e.height,i=e.padding;function a(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(function(e){t._width=e.size,t._viewWidth=Ay(t,e.size),a()}),{size:n}),t._resizeHeight=t.add(null,(function(e){t._height=e.size,t._viewHeight=ky(t,e.size),a()}),{size:r});var o=t.add(null,a,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,o.rank=i.rank+1}(n),function(t){t.add(null,e=>(t._background=e.bg,t._resize=1,e.bg),{bg:t._signals.background})}(n),function(t){const e=t._signals.cursor||(t._signals.cursor=t.add({user:"default",item:null}));t.on(t.events("view","mousemove"),e,(function(t,n){const r=e.value,i=r?Ct(r)?r:r.user:"default",a=n.item&&n.item.cursor||null;return r&&i===r.user&&a==r.item?r:{user:i,item:a}})),t.add(null,(function(e){let n=e.cursor,r=this.value;return Ct(n)||(r=n.item,n=n.user),tg(t,n&&"default"!==n?n:r||n),r}),{cursor:e})}(n),n.description(t.description),e.hover&&n.hover(),e.container&&n.initialize(e.container,e.bind)}var Sy=_t(Fy,$r);function By(t,e){return vt(t._signals,e)?t._signals[e]:x("Unrecognized signal name: "+Tt(e))}function Oy(t,e){const n=(t._targets||[]).filter(t=>t._update&&t._update.handler===e);return n.length?n[0]:null}function zy(t,e,n,r){var i=Oy(n,r);return i||((i=_g(t,()=>r(e,n.value))).handler=r,t.on(n,null,i)),t}function Ry(t,e,n){var r=Oy(e,n);return r&&e._targets.remove(r),t}function Ty(t){return z(t)?t:{type:t||"pad"}}Sy.evaluate=async function(t,e,n){if(await $r.prototype.evaluate.call(this,t,e),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var e=ag(t),n=rg(t),r=ig(t);t._renderer.background(t.background()),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach((function(e){try{e(n,r)}catch(e){t.error(e)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return n&&Wt(this,n),this},Sy.dirty=function(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},Sy.description=function(t){if(arguments.length){const e=null!=t?t+"":null;return e!==this._desc&&Zm(this._el,this._desc=e),this}return this._desc},Sy.container=function(){return this._el},Sy.scenegraph=function(){return this._scenegraph},Sy.origin=function(){return this._origin.slice()},Sy.signal=function(t,e,n){var r=By(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},Sy.width=function(t){return arguments.length?this.signal("width",t):this.signal("width")},Sy.height=function(t){return arguments.length?this.signal("height",t):this.signal("height")},Sy.padding=function(t){return arguments.length?this.signal("padding",wg(t)):wg(this.signal("padding"))},Sy.autosize=function(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},Sy.background=function(t){return arguments.length?this.signal("background",t):this.signal("background")},Sy.renderer=function(t){return arguments.length?(cd(t)||x("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},Sy.tooltip=function(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},Sy.loader=function(t){return arguments.length?(t!==this._loader&&($r.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},Sy.resize=function(){return this._autosize=1,this.touch(By(this,"autosize"))},Sy._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},Sy._resizeView=function(t,e,n,r,i,a){this.runAfter((function(o){var u=0;o._autosize=0,o.width()!==n&&(u=1,o.signal("width",n,_y),o._resizeWidth.skip(!0)),o.height()!==r&&(u=1,o.signal("height",r,_y),o._resizeHeight.skip(!0)),o._viewWidth!==t&&(o._resize=1,o._viewWidth=t),o._viewHeight!==e&&(o._resize=1,o._viewHeight=e),o._origin[0]===i[0]&&o._origin[1]===i[1]||(o._resize=1,o._origin=i),u&&o.run("enter"),a&&o.runAfter(t=>t.resize())}),!1,1)},Sy.addEventListener=function(t,e,n){var r=e;return n&&!1===n.trap||((r=_g(this,e)).raw=e),this._handler.on(t,r),this},Sy.removeEventListener=function(t,e){for(var n,r,i=this._handler.handlers(t),a=i.length;--a>=0;)if(r=i[a].type,n=i[a].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},Sy.addResizeListener=function(t){var e=this._resizeListeners;return e.indexOf(t)<0&&e.push(t),this},Sy.removeResizeListener=function(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},Sy.addSignalListener=function(t,e){return zy(this,t,By(this,t),e)},Sy.removeSignalListener=function(t,e){return Ry(this,By(this,t),e)},Sy.addDataListener=function(t,e){return zy(this,t,eg(this,t).values,e)},Sy.removeDataListener=function(t,e){return Ry(this,eg(this,t).values,e)},Sy.globalCursor=function(t){if(arguments.length){if(this._globalCursor!==!!t){const e=tg(this,null);this._globalCursor=!!t,e&&tg(this,e)}return this}return this._globalCursor},Sy.preventDefault=function(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},Sy.timer=function(t,e){this._timers.push(h.interval((function(e){t({timestamp:Date.now(),elapsed:e})}),e))},Sy.events=function(t,e,n){var r,i=this,a=new de(n),o=function(n,r){i.runAsync(null,()=>{"view"===t&&function(t,e){var n=t._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault(),a.receive(og(i,n,r))})};if("timer"===t)sg(i,"timer",e)&&i.timer(o,e);else if("view"===t)sg(i,"view",e)&&i.addEventListener(e,o,ug);else if("window"===t?sg(i,"window",e)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&sg(i,"selector",e)&&(r=document.querySelectorAll(t)),r){for(var u=0,s=r.length;u=0;)i[t].stop();for(t=a.length;--t>=0;)for(e=(n=a[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);return r&&r.call(this,this._handler,null,null,null),this},Sy.hover=function(t,e){return e=[e||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",lg),cg,fg(t)),this.on(this.events("view","mouseout",lg),cg,fg(e)),this},Sy.data=function(t,e){return arguments.length<2?eg(this,t).values.value:ng.call(this,t,ne().remove(E).insert(e))},Sy.change=ng,Sy.insert=function(t,e){return ng.call(this,t,ne().insert(e))},Sy.remove=function(t,e){return ng.call(this,t,ne().remove(e))},Sy.scale=function(t){var e=this._runtime.scales;return vt(e,t)||x("Unrecognized scale or projection: "+t),e[t].value},Sy.initialize=function(t,e){const n=this,r=n._renderType,i=n._eventConfig.bind,a=cd(r);t=n._el=t?Ag(n,t):null,function(t){const e=t.container();e&&(e.setAttribute("role","graphics-document"),e.setAttribute("aria-roleDescription","visualization"),Zm(e,t.description()))}(n),a||n.error("Unrecognized renderer type: "+r);const o=a.handler||Nl,u=t?a.renderer:a.headless;return n._renderer=u?xg(n,n._renderer,t,u):null,n._handler=function(t,e,n,r){var i=new r(t.loader(),_g(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,ag(t),t);return e&&e.handlers().forEach((function(t){i.on(t.type,t.handler)})),i}(n,n._handler,t,o),n._redraw=!0,t&&"none"!==i&&(e=e?n._elBind=Ag(n,e):t.appendChild(dg("form",{class:"vega-bindings"})),n._bind.forEach((function(t){t.param.element&&"container"!==i&&(t.element=Ag(n,t.param.element))})),n._bind.forEach((function(t){hg(n,t.element||e,t)}))),n},Sy.toImageURL=async function(t,e){t!==sd.Canvas&&t!==sd.SVG&&t!==sd.PNG&&x("Unrecognized image type: "+t);const n=await Dg(this,t,e);return t===sd.SVG?function(t,e){var n=new Blob([t],{type:e});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},Sy.toCanvas=async function(t,e){return(await Dg(this,sd.Canvas,t,e)).canvas()},Sy.toSVG=async function(t){return(await Dg(this,sd.SVG,t)).svg()},Sy.getState=function(t){return this._runtime.getState(t||{data:wy,signals:Dy,recurse:!0})},Sy.setState=function(t){return this.runAsync(null,e=>{e._trigger=!1,e._runtime.setState(t)},t=>{t._trigger=!0}),this};const qy=t=>+t||0;function $y(t){return z(t)?t.signal?t:{top:qy(t.top),bottom:qy(t.bottom),left:qy(t.left),right:qy(t.right)}:{top:e=qy(t),bottom:e,left:e,right:e};var e}const Ly=t=>z(t)&&!O(t)?ht({},t):{value:t};function Ny(t,e,n,r){return null!=n?(z(n)&&!O(n)?t.update[e]=n:t[r||"enter"][e]={value:n},1):0}function Uy(t,e,n){for(const n in e)Ny(t,n,e[n]);for(const e in n)Ny(t,e,n[e],"update")}function Py(t,e,n){for(const r in e)n&&vt(n,r)||(t[r]=ht(t[r]||{},e[r]));return t}function jy(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}function Iy(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}const Wy=t=>Ct(t)?Tt(t):t.signal?`(${t.signal})`:Vy(t);function Hy(t){if(null!=t.gradient)return function(t){const e=[t.start,t.stop,t.count].map(t=>null==t?null:Tt(t));for(;e.length&&null==L(e);)e.pop();return e.unshift(Wy(t.gradient)),`gradient(${e.join(",")})`}(t);let e=t.signal?`(${t.signal})`:t.color?function(t){return t.c?Gy("hcl",t.h,t.c,t.l):t.h||t.s?Gy("hsl",t.h,t.s,t.l):t.l||t.a?Gy("lab",t.l,t.a,t.b):t.r||t.g||t.b?Gy("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?Vy(t.field):void 0!==t.value?Tt(t.value):void 0;return null!=t.scale&&(e=function(t,e){const n=Wy(t.scale);null!=t.range?e=`lerp(_range(${n}), ${+t.range})`:(void 0!==e&&(e=`_scale(${n}, ${e})`),t.band&&(e=(e?e+"+":"")+`_bandwidth(${n})`+(1==+t.band?"":"*"+Yy(t.band)),t.extra&&(e=`(datum.extra ? _scale(${n}, datum.extra.value) : ${e})`)),null==e&&(e="0"));return e}(t,e)),void 0===e&&(e=null),null!=t.exponent&&(e=`pow(${e},${Yy(t.exponent)})`),null!=t.mult&&(e+="*"+Yy(t.mult)),null!=t.offset&&(e+="+"+Yy(t.offset)),t.round&&(e=`round(${e})`),e}const Gy=(t,e,n,r)=>`(${t}(${[e,n,r].map(Hy).join(",")})+'')`;function Yy(t){return z(t)?"("+Hy(t)+")":t}function Vy(t){return function t(e){let n,r,i;if(e.signal)n="datum",i=e.signal;else if(e.group||e.parent){for(r=Math.max(1,e.level||1),n="item";r-- >0;)n+=".mark.group";e.parent?(i=e.parent,n+=".datum"):i=e.group}else e.datum?(n="datum",i=e.datum):x("Invalid field reference: "+Tt(e));e.signal||(i=Ct(i)?_(i).map(Tt).join("]["):t(i));return n+"["+i+"]"}(z(t)?t:{datum:t})}function Xy(t,e,n,r,i,a){const o={};(a=a||{}).encoders={$encode:o},t=function(t,e,n,r,i){const a={},o={};let u,s,l,c;for(s in s="lineBreak","text"!==e||null==i[s]||jy(s,t)||Iy(a,s,i[s]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c="frame"===n?i.group:"mark"===n?ht({},i.mark,i[e]):null,c)l=jy(s,t)||("fill"===s||"stroke"===s)&&(jy("fill",t)||jy("stroke",t)),l||Iy(a,s,c[s]);for(s in rt(r).forEach(e=>{const n=i.style&&i.style[e];for(const e in n)jy(e,t)||Iy(a,e,n[e])}),t=ht({},t),a)c=a[s],c.signal?(u=u||{})[s]=c:o[s]=c;return t.enter=ht(o,t.enter),u&&(t.update=ht(u,t.update)),t}(t,e,n,r,i.config);for(const n in t)o[n]=Jy(t[n],e,a,i);return a}function Jy(t,e,n,r){const i={},a={};for(const e in t)null!=t[e]&&(i[e]=Ky((o=t[e],O(o)?function(t){let e="";return t.forEach(t=>{const n=Hy(t);e+=t.test?`(${t.test})?${n}:`:n}),":"===L(e)&&(e+="null"),e}(o):Hy(o)),r,n,a));var o;return{$expr:{marktype:e,channels:i},$fields:Object.keys(a),$output:Object.keys(t)}}function Ky(t,e,n,r){const i=ly(t,e);return i.$fields.forEach(t=>r[t]=1),ht(n,i.$params),i.$expr}var Qy=["value","update","init","react","bind"];function Zy(t,e){x(t+' for "outer" push: '+Tt(e))}function tb(t,e){var n=t.name;if("outer"===t.push)e.signals[n]||Zy("No prior signal definition",n),Qy.forEach((function(e){void 0!==t[e]&&Zy("Invalid property ",e)}));else{var r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}function eb(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function nb(t,e,n,r){return new eb(t,e,n,r)}function rb(t,e){return nb("operator",t,e)}function ib(t){var e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function ab(t,e){return e?{$field:t,$name:e}:{$field:t}}var ob=ab("key");function ub(t,e){return{$compare:t,$order:e}}function sb(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}function lb(t){return t&&t.signal}function cb(t){if(lb(t))return!0;if(z(t))for(var e in t)if(cb(t[e]))return!0;return!1}function fb(t,e){return null!=t?t:e}function db(t){return t&&t.signal||t}function hb(t,e){return(t.merge?pb:t.stream?mb:t.type?gb:x("Invalid stream specification: "+Tt(t)))(t,e)}function pb(t,e){var n=vb({merge:t.merge.map(t=>hb(t,e))},t,e);return e.addStream(n).id}function mb(t,e){var n=vb({stream:hb(t.stream,e)},t,e);return e.addStream(n).id}function gb(t,e){var n,r;return"timer"===t.type?(n=e.event("timer",t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return"scope"===t?"view":t||"view"}(t.source),t.type),r=vb({stream:n},t,e),1===Object.keys(r).length?n:e.addStream(r).id}function vb(t,e,n){var r=e.between;return r&&(2!==r.length&&x('Stream "between" parameter must have 2 entries: '+Tt(e)),t.between=[hb(r[0],n),hb(r[1],n)]),r=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){var r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),"scope"===e.source&&r.push("inScope(event.item)"),r.length&&(t.filter=ly("("+r.join(")&&(")+")",n).$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}var yb,bb,xb="view",_b=/[[\]{}]/,Ab={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function kb(t,e,n,r,i){for(var a,o=0,u=t.length;e=0?--o:r&&r.indexOf(a)>=0&&++o}return e}function wb(t){for(var e=[],n=0,r=t.length,i=0;i"!==(t=t.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+t;if(e=e.map(Db),(n=Db(t.slice(1).trim())).between)return{between:e,stream:n};n.between=e;return n}(t):function(t){var e,n,r={source:yb},i=[],a=[0,0],o=0,u=0,s=t.length,l=0;if("}"===t[s-1]){if(!((l=t.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+t;try{a=function(t){var e=t.split(",");if(!t.length||e.length>2)throw t;return e.map((function(e){var n=+e;if(n!=n)throw t;return n}))}(t.substring(l+1,s-1))}catch(e){throw"Invalid throttle specification: "+t}t=t.slice(0,l).trim(),s=t.length,l=0}if(!s)throw t;"@"===t[0]&&(o=++l);(e=kb(t,l,":"))1?(r.type=i[1],o?r.markname=i[0].slice(1):!function(t){return bb[t]}(i[0])?r.source=i[0]:r.marktype=i[0]):r.type=i[0];"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=n&&(r.filter=n);a[0]&&(r.throttle=a[0]);a[1]&&(r.debounce=a[1]);return r}(t)}const Mb={code:"_.$value",ast:{type:"Identifier",value:"value"}};function Cb(t,e,n){var r=t.events,i=t.update,a=t.encode,o=[],u={target:n};r||x("Signal update missing events specification."),Ct(r)&&(r=function(t,e,n){return yb=e||xb,bb=n||Ab,wb(t.trim()).map(Db)}(r,e.isSubscope()?"scope":"view")),r=rt(r).filter(t=>t.signal||t.scale?(o.push(t),0):1),o.length>1&&(o=[Eb(o)]),r.length&&o.push(r.length>1?{merge:r}:r[0]),null!=a&&(i&&x("Signal encode and update are mutually exclusive."),i="encode(item(),"+Tt(a)+")"),u.update=Ct(i)?ly(i,e):null!=i.expr?ly(i.expr,e):null!=i.value?i.value:null!=i.signal?{$expr:Mb,$params:{$value:e.signalRef(i.signal)}}:x("Invalid signal update specification."),t.force&&(u.options={force:!0}),o.forEach((function(t){e.addUpdate(ht(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):hb(t,e)}}(t,e),u))}))}function Eb(t){return{signal:"["+t.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}const Fb=t=>(e,n,r)=>nb(t,n,e||void 0,r);var Sb=Fb("aggregate"),Bb=Fb("axisticks"),Ob=Fb("bound"),zb=Fb("collect"),Rb=Fb("compare"),Tb=Fb("datajoin"),qb=Fb("encode"),$b=Fb("expression"),Lb=Fb("facet"),Nb=Fb("field"),Ub=Fb("key"),Pb=Fb("legendentries"),jb=Fb("load"),Ib=Fb("mark"),Wb=Fb("multiextent"),Hb=Fb("multivalues"),Gb=Fb("overlap"),Yb=Fb("params"),Vb=Fb("prefacet"),Xb=Fb("projection"),Jb=Fb("proxy"),Kb=Fb("relay"),Qb=Fb("render"),Zb=Fb("scale"),tx=Fb("sieve"),ex=Fb("sortitems"),nx=Fb("viewlayout"),rx=Fb("values"),ix=0,ax={min:"min",max:"max",count:"sum"};function ox(t,e){var n,r=e.getScale(t.name).params;for(n in r.domain=cx(t.domain,t,e),null!=t.range&&(r.range=function t(e,n,r){var i=e.range,a=n.config.range;if(i.signal)return n.signalRef(i.signal);if(Ct(i)){if(a&&vt(a,i))return e=ht({},e,{range:a[i]}),t(e,n,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=Qc(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:x("Unrecognized scale range value: "+Tt(i))}else{if(i.scheme)return r.scheme=O(i.scheme)?sx(i.scheme,n):ux(i.scheme,n),i.extent&&(r.schemeExtent=sx(i.extent,n)),void(i.count&&(r.schemeCount=ux(i.count,n)));if(i.step)return void(r.rangeStep=ux(i.step,n));if(Qc(e.type)&&!O(i))return cx(i,e,n);O(i)||x("Unsupported range type: "+Tt(i))}return i.map(t=>(O(t)?sx:ux)(t,n))}(t,e,r)),null!=t.interpolate&&function(t,e){e.interpolate=ux(t.type||t),null!=t.gamma&&(e.interpolateGamma=ux(t.gamma))}(t.interpolate,r),null!=t.nice&&(r.nice=function(t){return z(t)?{interval:ux(t.interval),step:ux(t.step)}:ux(t)}(t.nice)),null!=t.bins&&(r.bins=function(t,e){return t.signal||O(t)?sx(t,e):e.objectProperty(t)}(t.bins,e)),t)vt(r,n)||"name"===n||(r[n]=ux(t[n],e))}function ux(t,e){return z(t)?t.signal?e.signalRef(t.signal):x("Unsupported object: "+Tt(t)):t}function sx(t,e){return t.signal?e.signalRef(t.signal):t.map(t=>ux(t,e))}function lx(t){x("Can not find data set: "+Tt(t))}function cx(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(O(t)?fx:t.fields?hx:dx)(t,e,n);null==e.domainMin&&null==e.domainMax||x("No scale domain defined for domainMin/domainMax to override.")}function fx(t,e,n){return t.map((function(t){return ux(t,n)}))}function dx(t,e,n){var r=n.getData(t.data);return r||lx(t.data),Qc(e.type)?r.valuesRef(n,t.field,mx(t.sort,!1)):nf(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)}function hx(t,e,n){var r=t.data,i=t.fields.reduce((function(t,e){return e=Ct(e)?{data:r,field:e}:O(e)||e.signal?function(t,e){var n="_:vega:_"+ix++,r=zb({});if(O(t))r.value={$ingest:t};else if(t.signal){var i="setdata("+Tt(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,tx({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t}),[]);return(Qc(e.type)?px:nf(e.type)?gx:vx)(t,n,i)}function px(t,e,n){var r,i,a,o,u,s=mx(t.sort,!0);return r=n.map((function(t){var n=e.getData(t.data);return n||lx(t.data),n.countsRef(e,t.field,s)})),i={groupby:ob,pulse:r},s&&(a=s.op||"count",u=s.field?sb(a,s.field):"count",i.ops=[ax[a]],i.fields=[e.fieldRef(u)],i.as=[u]),a=e.add(Sb(i)),o=e.add(zb({pulse:ib(a)})),u=e.add(rx({field:ob,sort:e.sortRef(s),pulse:ib(o)})),ib(u)}function mx(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field&&t.op&&!ax[t.op]&&x("Multiple domain scales can not be sorted using "+t.op):x("No field provided for sort aggregate op: "+t.op):z(t)?t.field="key":t={field:"key"}),t}function gx(t,e,n){var r=n.map((function(t){var n=e.getData(t.data);return n||lx(t.data),n.domainRef(e,t.field)}));return ib(e.add(Hb({values:r})))}function vx(t,e,n){var r=n.map((function(t){var n=e.getData(t.data);return n||lx(t.data),n.extentRef(e,t.field)}));return ib(e.add(Wb({extents:r})))}function yx(t,e,n){return O(t)?t.map((function(t){return yx(t,e,n)})):z(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:x("Unsupported parameter object: "+Tt(t)):t}const bx="value",xx=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],_x={name:1,style:1,interactive:1},Ax={value:0},kx={value:1};function wx(t){return t.type="group",t.interactive=t.interactive||!1,t}function Dx(t,e){const n=(n,r)=>fb(t[n],fb(e[n],r));return n.isVertical=n=>"vertical"===fb(t.direction,e.direction||(n?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>fb(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>fb(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>fb(t.columns,fb(e.columns,+n.isVertical(!0))),n}function Mx(t,e){var n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function Cx(t,e,n){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${e} : ${n}`}const Ex=Cx(Tt("left"),Tt("right"),Tt("center"));function Fx(t,e){return e?t?z(t)?Object.assign({},t,{offset:Fx(t.offset,e)}):{value:t,offset:e}:e:t}function Sx(t,e){return e?(t.name=e.name,t.style=e.style||t.style,t.interactive=!!e.interactive,t.encode=Py(t.encode,e,_x)):t.interactive=!1,t}function Bx(t,e,n,r){var i,a,o,u,s,l,c=Dx(t,n),f=c.isVertical(),d=c.gradientThickness(),h=c.gradientLength();return f?(o=[0,1],u=[0,0],s=d,l=h):(o=[0,0],u=[1,0],s=h,l=d),Uy(i={enter:a={opacity:Ax,x:Ax,y:Ax,width:Ly(s),height:Ly(l)},update:ht({},a,{opacity:kx,fill:{gradient:e,start:o,stop:u}}),exit:{opacity:Ax}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),Sx({type:"rect",role:"legend-gradient",encode:i},r)}function Ox(t,e,n,r,i){var a,o,u,s,l,c,f=Dx(t,n),d=f.isVertical(),h=f.gradientThickness(),p=f.gradientLength(),m="";return d?(u="y",l="y2",s="x",c="width",m="1-"):(u="x",l="x2",s="y",c="height"),(o={opacity:Ax,fill:{scale:e,field:bx}})[u]={signal:m+"datum.perc",mult:p},o[s]=Ax,o[l]={signal:m+"datum.perc2",mult:p},o[c]=Ly(h),Uy(a={enter:o,update:ht({},o,{opacity:kx}),exit:{opacity:Ax}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),Sx({type:"rect",role:"legend-band",key:bx,from:i,encode:a},r)}function zx(t,e,n,r){var i,a,o,u,s,l=Dx(t,e),c=l.isVertical(),f=Ly(l.gradientThickness()),d=l.gradientLength(),h=l("labelOverlap"),p="";return Uy(i={enter:a={opacity:Ax},update:o={opacity:kx,text:{field:"label"}},exit:{opacity:Ax}},{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:fb(t.labelLimit,e.gradientLabelLimit)}),c?(a.align={value:"left"},a.baseline=o.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},u="y",s="x",p="1-"):(a.align=o.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},a.baseline={value:"top"},u="x",s="y"),a[u]=o[u]={signal:p+"datum.perc",mult:d},a[s]=o[s]=f,f.offset=fb(t.labelOffset,e.gradientLabelOffset)||0,h=h?{separation:l("labelSeparation"),method:h,order:"datum.index"}:void 0,Sx({type:"text",role:"legend-label",style:"guide-label",key:bx,from:r,encode:i,overlap:h},n)}function Rx(t,e,n,r,i){var a,o,u,s,l,c,f,d=Dx(t,e),h=n.entries,p=!(!h||!h.interactive),m=h?h.name:void 0,g=d("clipHeight"),v=d("symbolOffset"),y={data:"value"},b={},x=`(${i}) ? datum.offset : datum.size`,_=g?Ly(g):{field:"size"},A="datum.index",k=`max(1, ${i})`;_.mult=.5,b={enter:a={opacity:Ax,x:{signal:x,mult:.5,offset:v},y:_},update:o={opacity:kx,x:a.x,y:a.y},exit:{opacity:Ax}};var w=null,D=null;return t.fill||(w=e.symbolBaseFillColor,D=e.symbolBaseStrokeColor),Uy(b,{fill:d("symbolFillColor",w),shape:d("symbolType"),size:d("symbolSize"),stroke:d("symbolStrokeColor",D),strokeDash:d("symbolDash"),strokeDashOffset:d("symbolDashOffset"),strokeWidth:d("symbolStrokeWidth")},{opacity:d("symbolOpacity")}),xx.forEach((function(e){t[e]&&(o[e]=a[e]={scale:t[e],field:bx})})),s=Sx({type:"symbol",role:"legend-symbol",key:bx,from:y,clip:!!g||void 0,encode:b},n.symbols),(u=Ly(v)).offset=d("labelOffset"),Uy(b={enter:a={opacity:Ax,x:{signal:x,offset:u},y:_},update:o={opacity:kx,text:{field:"label"},x:a.x,y:a.y},exit:{opacity:Ax}},{align:d("labelAlign"),baseline:d("labelBaseline"),fill:d("labelColor"),fillOpacity:d("labelOpacity"),font:d("labelFont"),fontSize:d("labelFontSize"),fontStyle:d("labelFontStyle"),fontWeight:d("labelFontWeight"),limit:d("labelLimit")}),l=Sx({type:"text",role:"legend-label",style:"guide-label",key:bx,from:y,encode:b},n.labels),b={enter:{noBound:{value:!g},width:Ax,height:g?Ly(g):Ax,opacity:Ax},exit:{opacity:Ax},update:o={opacity:kx,row:{signal:null},column:{signal:null}}},d.isVertical(!0)?(c=`ceil(item.mark.items.length / ${k})`,o.row.signal=`${A}%${c}`,o.column.signal=`floor(${A} / ${c})`,f={field:["row",A]}):(o.row.signal=`floor(${A} / ${k})`,o.column.signal=`${A} % ${k}`,f={field:A}),o.column.signal=`(${i})?${o.column.signal}:${A}`,wx({role:"scope",from:r={facet:{data:r,name:"value",groupby:"index"}},encode:Py(b,h,_x),marks:[s,l],name:m,interactive:p,sort:f})}const Tx='item.orient === "left"',qx='item.orient === "right"',$x=`(${Tx} || ${qx})`,Lx="datum.vgrad && "+$x,Nx=Cx('"top"','"bottom"','"middle"'),Ux=`datum.vgrad && ${qx} ? (${Cx('"right"','"left"','"center"')}) : (${$x} && !(datum.vgrad && ${Tx})) ? "left" : ${Ex}`,Px=`item._anchor || (${$x} ? "middle" : "start")`,jx=`${Lx} ? (${Tx} ? -90 : 90) : 0`,Ix=`${$x} ? (datum.vgrad ? (${qx} ? "bottom" : "top") : ${Nx}) : "top"`;function Wx(t,e){var n;return z(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+Hx(t.path)+")":t.sphere&&(n="geoShape("+Hx(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function Hx(t){return z(t)&&t.signal?t.signal:Tt(t)}function Gx(t){var e=t.role||"";return e.indexOf("axis")&&e.indexOf("legend")&&e.indexOf("title")?"group"===t.type?"scope":e||"mark":e}function Yx(t){return{marktype:t.type,name:t.name||void 0,role:t.role||Gx(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function Vx(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}function Xx(t,e){var n=Ir(t.type);n||x("Unrecognized transform type: "+Tt(t.type));var r=nb(n.type.toLowerCase(),null,Jx(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r}function Jx(t,e,n){var r,i,a,o={};for(i=0,a=t.params.length;it[e]?(v[e]=t[e],y=y||t[e]):0),y||x("Missing valid scale for legend."),o=function(t,e){var n=t.type||"symbol";t.type||1!==function(t){return xx.reduce((function(e,n){return e+(t[n]?1:0)}),0)}(t)||!t.fill&&!t.stroke||(n=Kc(e)?"gradient":Zc(e)?"discrete":"symbol");return"gradient"!==n?n:Zc(e)?"discrete":"gradient"}(t,e.scaleType(y)),u={title:null!=t.title,scales:v,type:o,vgrad:"symbol"!==o&&g.isVertical()},s=ib(e.add(zb(null,[u]))),d=Py(function(t,e,n){var r={enter:{},update:{}};return Uy(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:t("legendX"),y:t("legendY"),format:e.format,formatType:e.formatType}),r}(g,t,c),d,_x),n={enter:{x:{value:0},y:{value:0}}},l=ib(e.add(Pb(i={type:o,scale:e.scaleRef(y),count:e.objectProperty(g("tickCount")),limit:e.property(g("symbolLimit")),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),"gradient"===o?(a=[Bx(t,y,c,f.gradient),zx(t,c,f.labels,l)],i.count=i.count||e.signalRef(`max(2,2*floor((${db(g.gradientLength())})/100))`)):"discrete"===o?a=[Ox(t,y,c,f.gradient,l),zx(t,c,f.labels,l)]:(r=function(t,e){const n=Dx(t,e);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(t,c),a=[Rx(t,c,f,l,db(r.columns))],i.size=function(t,e,n){var r=db(d_("size",t,n)),i=db(d_("strokeWidth",t,n)),a=db(function(t,e,n){return Mx("fontSize",t)||function(t,e,n){var r=e.config.style[n];return r&&r[t]}("fontSize",e,n)}(n[1].encode,e,"guide-label"));return ly(`max(ceil(sqrt(${r})+${i}),${a})`,e)}(t,e,a[0].marks)),a=[wx({role:"legend-entry",from:s,encode:n,marks:a,layout:r,interactive:p})],u.title&&a.push(function(t,e,n,r){var i,a=Dx(t,e);return Uy(i={enter:{opacity:Ax},update:{opacity:kx,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:Ax}},{orient:a("titleOrient"),_anchor:a("titleAnchor"),anchor:{signal:Px},angle:{signal:jx},align:{signal:Ux},baseline:{signal:Ix},text:t.title,fill:a("titleColor"),fillOpacity:a("titleOpacity"),font:a("titleFont"),fontSize:a("titleFontSize"),fontStyle:a("titleFontStyle"),fontWeight:a("titleFontWeight"),limit:a("titleLimit"),lineHeight:a("titleLineHeight")},{align:a("titleAlign"),baseline:a("titleBaseline")}),Sx({type:"text",role:"legend-title",style:"guide-title",from:r,encode:i},n)}(t,c,f.title,s)),c_(wx({role:"legend",from:s,encode:d,marks:a,aria:g("aria"),description:g("description"),zindex:g("zindex"),name:h,interactive:p,style:m}),e)}function d_(t,e,n){return e[t]?`scale("${e[t]}",datum)`:Mx(t,n[0].encode)}a_.countsRef=function(t,e,n){var r,i,a,o=this.counts||(this.counts={}),u=o_(e);return null!=u&&(t=this.scope,r=o[u]),r?n&&n.field&&u_(t,r.agg.params,n):(a={groupby:t.fieldRef(e,"key"),pulse:ib(this.output)},n&&n.field&&u_(t,a,n),i=t.add(Sb(a)),r=t.add(zb({pulse:ib(i)})),r={agg:i,ref:ib(r)},null!=u&&(o[u]=r)),r.ref},a_.tuplesRef=function(){return ib(this.values)},a_.extentRef=function(t,e){return s_(t,this,"extent","extent",e,!1)},a_.domainRef=function(t,e){return s_(t,this,"domain","values",e,!1)},a_.valuesRef=function(t,e,n){return s_(t,this,"vals","values",e,n||!0)},a_.lookupRef=function(t,e){return s_(t,this,"lookup","tupleindex",e,!1)},a_.indataRef=function(t,e){return s_(t,this,"indata","tupleindex",e,!0,!0)};function h_(t,e){var n,r,i=Dx(t=Ct(t)?{text:t}:t,e.config.title),a=t.encode||{},o=a.group||{},u=o.name||void 0,s=o.interactive,l=o.style,c=[];return n={},r=ib(e.add(zb(null,[n]))),c.push(function(t,e,n,r){var i={value:0},a=t.text,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return Uy(o,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("color"),font:e("font"),fontSize:e("fontSize"),fontStyle:e("fontStyle"),fontWeight:e("fontWeight"),lineHeight:e("lineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),Sx({type:"text",role:"title-text",style:"group-title",from:r,encode:o},n)}(t,i,function(t){const e=t.encode;return e&&e.title||ht({name:t.name,interactive:t.interactive,style:t.style},e)}(t),r)),t.subtitle&&c.push(function(t,e,n,r){var i={value:0},a=t.subtitle,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return Uy(o,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("subtitleColor"),font:e("subtitleFont"),fontSize:e("subtitleFontSize"),fontStyle:e("subtitleFontStyle"),fontWeight:e("subtitleFontWeight"),lineHeight:e("subtitleLineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),Sx({type:"text",role:"title-subtitle",style:"group-subtitle",from:r,encode:o},n)}(t,i,a.subtitle,r)),c_(wx({role:"title",from:r,encode:p_(i,o),marks:c,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:u,interactive:s,style:l}),e)}function p_(t,e){var n={enter:{},update:{}};return Uy(n,{orient:t("orient"),anchor:t("anchor"),align:{signal:Ex},angle:{signal:'item.orient==="left"?-90:item.orient==="right"?90:0'},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),Py(n,e,_x)}function m_(t,e){var n=[];t.transform&&t.transform.forEach((function(t){n.push(Xx(t,e))})),t.on&&t.on.forEach((function(n){l_(n,e,t.name)})),e.addDataPipeline(t.name,function(t,e,n){var r,i,a,o,u,s=[],l=null,c=!1,f=!1;t.values?cb(t.values)||cb(t.format)?(s.push(v_(e,t)),s.push(l=g_())):s.push(l=g_({$ingest:t.values,$format:t.format})):t.url?cb(t.url)||cb(t.format)?(s.push(v_(e,t)),s.push(l=g_())):s.push(l=g_({$request:t.url,$format:t.format})):t.source&&(l=r=rt(t.source).map((function(t){return ib(e.getData(t).output)})),s.push(null));for(i=0,a=n.length;i"bottom"===t||"top"===t,b_=(t,e,n)=>lb(t)?D_(t.signal,e,n):"left"===t||"top"===t?e:n,x_=(t,e,n)=>lb(t)?k_(t.signal,e,n):y_(t)?e:n,__=(t,e,n)=>lb(t)?w_(t.signal,e,n):y_(t)?n:e,A_=(t,e,n)=>lb(t)?M_(t.signal,e,n):"top"===t?{value:e}:{value:n},k_=(t,e,n)=>E_(`${t} === 'top' || ${t} === 'bottom'`,e,n),w_=(t,e,n)=>E_(`${t} !== 'top' && ${t} !== 'bottom'`,e,n),D_=(t,e,n)=>S_(`${t} === 'left' || ${t} === 'top'`,e,n),M_=(t,e,n)=>S_(t+" === 'top'",e,n),C_=(t,e,n)=>S_(t+" === 'right'",e,n),E_=(t,e,n)=>(e=null!=e?Ly(e):e,n=null!=n?Ly(n):n,F_(e)&&F_(n)?{signal:`${t} ? (${e=e?e.signal||Tt(e.value):null}) : (${n=n?n.signal||Tt(n.value):null})`}:[ht({test:t},e)].concat(n||[])),F_=t=>null==t||1===Object.keys(t).length,S_=(t,e,n)=>({signal:`${t} ? (${O_(e)}) : (${O_(n)})`}),B_=(t,e,n,r,i)=>({signal:(null!=r?`${t} === 'left' ? (${O_(r)}) : `:"")+(null!=n?`${t} === 'bottom' ? (${O_(n)}) : `:"")+(null!=i?`${t} === 'right' ? (${O_(i)}) : `:"")+(null!=e?`${t} === 'top' ? (${O_(e)}) : `:"")+"(null)"}),O_=t=>lb(t)?t.signal:null==t?null:Tt(t),z_=(t,e)=>{const n=t.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+e.signal}:t};function R_(t,e,n,r){let i;if(e&&vt(e,t))return e[t];if(vt(n,t))return n[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r["guide-title"][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r["guide-label"][i]}return null}function T_(t){const e={};for(const n of t)if(n)for(const t in n)e[t]=1;return Object.keys(e)}function q_(t,e){return{scale:t.scale,range:e}}function $_(t,e,n,r,i){var a,o,u,s,l,c,f,d,h=Dx(t,e),p=t.orient,m=t.gridScale,g=b_(p,1,-1),v=function(t,e){if(1===e);else if(z(t)){let n=t=ht({},t);for(;null!=n.mult;){if(!z(n.mult))return n.mult=lb(e)?{signal:`(${n.mult}) * (${e.signal})`}:n.mult*e,t;n=n.mult=ht({},n.mult)}n.mult=e}else t=lb(e)?{signal:`(${e.signal}) * (${t||0})`}:e*(t||0);return t}(t.offset,g);return Uy(a={enter:o={opacity:Ax},update:s={opacity:kx},exit:u={opacity:Ax}},{stroke:h("gridColor"),strokeCap:h("gridCap"),strokeDash:h("gridDash"),strokeDashOffset:h("gridDashOffset"),strokeOpacity:h("gridOpacity"),strokeWidth:h("gridWidth")}),l={scale:t.scale,field:bx,band:i.band,extra:i.extra,offset:i.offset,round:h("tickRound")},d=x_(p,{signal:"height"},{signal:"width"}),c=m?{scale:m,range:0,mult:g,offset:v}:{value:0,offset:v},f=m?{scale:m,range:1,mult:g,offset:v}:ht(d,{mult:g,offset:v}),o.x=s.x=x_(p,l,c),o.y=s.y=__(p,l,c),o.x2=s.x2=__(p,f),o.y2=s.y2=x_(p,f),u.x=x_(p,l),u.y=__(p,l),Sx({type:"rule",role:"axis-grid",key:bx,from:r,encode:a},n)}function L_(t,e,n,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+r+","+i+")"}}function N_(t,e,n,r,i,a){var o,u,s,l,c,f,d,h,p,m,g=Dx(t,e),v=t.orient,y=t.scale,b=b_(v,-1,1),x=db(g("labelFlush")),_=db(g("labelFlushOffset")),A=0===x||!!x,k=g("labelAlign"),w=g("labelBaseline");return(l=Ly(i)).mult=b,l.offset=Ly(g("labelPadding")||0),l.offset.mult=b,c={scale:y,field:bx,band:.5,offset:Fx(a.offset,g("labelOffset"))},f=x_(v,A?L_(y,x,'"left"','"right"','"center"'):{value:"center"},((t,e,n)=>lb(t)?C_(t.signal,e,n):"right"===t?{value:e}:{value:n})(v,"left","right")),d=x_(v,A_(v,"bottom","top"),A?L_(y,x,'"top"','"bottom"','"middle"'):{value:"middle"}),m=L_(y,x,`-(${_})`,_,0),A=A&&_,Uy(o={enter:u={opacity:Ax,x:x_(v,c,l),y:__(v,c,l)},update:s={opacity:kx,text:{field:"label"},x:u.x,y:u.y,align:f,baseline:d},exit:{opacity:Ax,x:u.x,y:u.y}},{dx:!k&&A?x_(v,m):null,dy:!w&&A?__(v,m):null}),Uy(o,{angle:g("labelAngle"),fill:g("labelColor"),fillOpacity:g("labelOpacity"),font:g("labelFont"),fontSize:g("labelFontSize"),fontWeight:g("labelFontWeight"),fontStyle:g("labelFontStyle"),limit:g("labelLimit"),lineHeight:g("labelLineHeight")},{align:k,baseline:w}),h=g("labelBound"),p=(p=g("labelOverlap"))||h?{separation:g("labelSeparation"),method:p,order:"datum.index",bound:h?{scale:y,orient:v,tolerance:h}:null}:void 0,s.align!==f&&(s.align=z_(s.align,f)),s.baseline!==d&&(s.baseline=z_(s.baseline,d)),Sx({type:"text",role:"axis-label",style:"guide-label",key:bx,from:r,encode:o,overlap:p},n)}function U_(t,e,n,r){var i,a,o,u,s=Dx(t,e),l=t.orient,c=b_(l,-1,1);return i={enter:a={opacity:Ax,anchor:Ly(s("titleAnchor",null)),align:{signal:Ex}},update:o=ht({},a,{opacity:kx,text:Ly(t.title)}),exit:{opacity:Ax}},u={signal:`lerp(range("${t.scale}"), ${Cx(0,1,.5)})`},o.x=x_(l,u),o.y=__(l,u),a.angle=x_(l,Ax,((t,e)=>0===e?0:lb(t)?{signal:`(${t.signal}) * ${e}`}:{value:t*e})(c,90)),a.baseline=x_(l,A_(l,"bottom","top"),{value:"bottom"}),o.angle=a.angle,o.baseline=a.baseline,Uy(i,{fill:s("titleColor"),fillOpacity:s("titleOpacity"),font:s("titleFont"),fontSize:s("titleFontSize"),fontStyle:s("titleFontStyle"),fontWeight:s("titleFontWeight"),limit:s("titleLimit"),lineHeight:s("titleLineHeight")},{align:s("titleAlign"),angle:s("titleAngle"),baseline:s("titleBaseline")}),function(t,e,n,r){const i=(t,e)=>null!=t?(n.update[e]=z_(Ly(t),n.update[e]),!1):!jy(e,r),a=i(t("titleX"),"x"),o=i(t("titleY"),"y");n.enter.auto=o===a?Ly(o):x_(e,Ly(o),Ly(a))}(s,l,i,n),i.update.align=z_(i.update.align,a.align),i.update.angle=z_(i.update.angle,a.angle),i.update.baseline=z_(i.update.baseline,a.baseline),Sx({type:"text",role:"axis-title",style:"guide-title",from:r,encode:i},n)}function P_(t,e){var n,r,i,a,o,u=function(t,e){var n,r,i,a=e.config,o=a.style,u=a.axis,s="band"===e.scaleType(t.scale)&&a.axisBand,l=t.orient;if(lb(l)){const t=T_([a.axisX,a.axisY]),e=T_([a.axisTop,a.axisBottom,a.axisLeft,a.axisRight]);for(i of(n={},t))n[i]=x_(l,R_(i,a.axisX,u,o),R_(i,a.axisY,u,o));for(i of(r={},e))r[i]=B_(l.signal,R_(i,a.axisTop,u,o),R_(i,a.axisBottom,u,o),R_(i,a.axisLeft,u,o),R_(i,a.axisRight,u,o))}else n="top"===l||"bottom"===l?a.axisX:a.axisY,r=a["axis"+l[0].toUpperCase()+l.slice(1)];return n||r||s?ht({},u,n,r,s):u}(t,e),s=t.encode||{},l=s.axis||{},c=l.name||void 0,f=l.interactive,d=l.style,h=Dx(t,u),p=function(t){let e,n,r=t("tickBand"),i=t("tickOffset");return r?r.signal?(e={signal:`(${r.signal}) === 'extent' ? 1 : 0.5`},n={signal:`(${r.signal}) === 'extent'`},z(i)||(i={signal:`(${r.signal}) === 'extent' ? 0 : ${i}`})):"extent"===r?(e=1,n=!0,i=0):(e=.5,n=!1):(e=t("bandPosition"),n=t("tickExtra")),{extra:n,band:e,offset:i}}(h);return n={scale:t.scale,ticks:!!h("ticks"),labels:!!h("labels"),grid:!!h("grid"),domain:!!h("domain"),title:null!=t.title},r=ib(e.add(zb({},[n]))),l=Py(function(t,e){var n={enter:{},update:{}};return Uy(n,{orient:t("orient"),offset:t("offset")||0,position:fb(e.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${e.scale}")))`},translate:t("translate"),format:e.format,formatType:e.formatType}),n}(h,t),l,_x),i=ib(e.add(Bb({scale:e.scaleRef(t.scale),extra:e.property(p.extra),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),o=[],n.grid&&o.push($_(t,u,s.grid,i,p)),n.ticks&&(a=h("tickSize"),o.push(function(t,e,n,r,i,a){var o,u,s,l,c,f,d=Dx(t,e),h=t.orient,p=b_(h,-1,1);return Uy(o={enter:u={opacity:Ax},update:l={opacity:kx},exit:s={opacity:Ax}},{stroke:d("tickColor"),strokeCap:d("tickCap"),strokeDash:d("tickDash"),strokeDashOffset:d("tickDashOffset"),strokeOpacity:d("tickOpacity"),strokeWidth:d("tickWidth")}),(c=Ly(i)).mult=p,f={scale:t.scale,field:bx,band:a.band,extra:a.extra,offset:a.offset,round:d("tickRound")},l.y=u.y=x_(h,Ax,f),l.y2=u.y2=x_(h,c),s.x=x_(h,f),l.x=u.x=__(h,Ax,f),l.x2=u.x2=__(h,c),s.y=__(h,f),Sx({type:"rule",role:"axis-tick",key:bx,from:r,encode:o},n)}(t,u,s.ticks,i,a,p))),n.labels&&(a=n.ticks?a:0,o.push(N_(t,u,s.labels,i,a,p))),n.domain&&o.push(function(t,e,n,r){var i,a,o,u=Dx(t,e),s=t.orient;Uy(i={enter:a={opacity:Ax},update:o={opacity:kx},exit:{opacity:Ax}},{stroke:u("domainColor"),strokeCap:u("domainCap"),strokeDash:u("domainDash"),strokeDashOffset:u("domainDashOffset"),strokeWidth:u("domainWidth"),strokeOpacity:u("domainOpacity")});const l=q_(t,0),c=q_(t,1);return a.x=o.x=x_(s,l,Ax),a.x2=o.x2=x_(s,c),a.y=o.y=__(s,l,Ax),a.y2=o.y2=__(s,c),Sx({type:"rule",role:"axis-domain",from:r,encode:i},n)}(t,u,s.domain,r)),n.title&&o.push(U_(t,u,s.title,r)),c_(wx({role:"axis",from:r,encode:l,marks:o,aria:h("aria"),description:h("description"),zindex:h("zindex"),name:c,interactive:f,style:d}),e)}function j_(t,e,n){var r=rt(t.signals),i=rt(t.scales);return n||r.forEach(t=>tb(t,e)),rt(t.projections).forEach(t=>function(t,e){var n=e.config.projection||{},r={};for(var i in t)"name"!==i&&(r[i]=yx(t[i],i,e));for(i in n)null==r[i]&&(r[i]=yx(n[i],i,e));e.addProjection(t.name,r)}(t,e)),i.forEach(t=>function(t,e){var n=t.type||"linear";Xc(n)||x("Unrecognized scale type: "+Tt(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e)),rt(t.data).forEach(t=>m_(t,e)),i.forEach(t=>ox(t,e)),(n||r).forEach(t=>function(t,e){var n=e.getSignal(t.name),r=t.update;t.init&&(r?x("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=ly(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach((function(t){Cb(t,e,n.id)}))}(t,e)),rt(t.axes).forEach(t=>P_(t,e)),rt(t.marks).forEach(t=>c_(t,e)),rt(t.legends).forEach(t=>f_(t,e)),t.title&&h_(t.title,e),e.parseLambdas(),e}function I_(t,e){const n=e.config,r=ib(e.root=e.add(rb())),i=function(t,e){const n=n=>fb(t[n],e[n]),r=[W_("background",n("background")),W_("autosize",Ty(n("autosize"))),W_("padding",$y(n("padding"))),W_("width",n("width")||0),W_("height",n("height")||0)],i=r.reduce((t,e)=>(t[e.name]=e,t),{}),a={};return rt(t.signals).forEach(t=>{vt(i,t.name)?t=ht(i[t.name],t):r.push(t),a[t.name]=t}),rt(e.signals).forEach(t=>{vt(a,t.name)||vt(i,t.name)||r.push(t)}),r}(t,n);i.forEach(t=>tb(t,e)),e.description=t.description||n.description,e.eventConfig=n.events,e.legends=e.objectProperty(n.legend&&n.legend.layout),e.locale=n.locale;const a=e.add(zb()),o=e.add(qb(Xy((t=>Py({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t))(t.encode),"group","frame",t.style,e,{pulse:ib(a)}))),u=e.add(nx({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:r,pulse:ib(o)}));e.operators.pop(),e.pushState(ib(o),ib(u),null),j_(t,e,i),e.operators.push(u);let s=e.add(Ob({mark:r,pulse:ib(u)}));return s=e.add(Qb({pulse:ib(s)})),s=e.add(tx({pulse:ib(s)})),e.addData("root",new i_(e,a,a,s)),e}function W_(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function H_(t,e){this.config=t||{},this.options=e||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function G_(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}var Y_=H_.prototype=G_.prototype;function V_(t){return(O(t)?X_:J_)(t)}function X_(t){for(var e,n="[",r=0,i=t.length;r0?",":"")+(z(e=t[r])?e.signal||V_(e):Tt(e));return n+"]"}function J_(t){var e,n,r="{",i=0;for(e in t)n=t[e],r+=(++i>1?",":"")+Tt(e)+":"+(z(n)?n.signal||V_(n):Tt(n));return r+"}"}Y_.parse=function(t){return j_(t,this)},Y_.fork=function(){return new G_(this)},Y_.isSubscope=function(){return this._subid>0},Y_.toRuntime=function(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},Y_.id=function(){return(this._subid?this._subid+":":0)+this._id++},Y_.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((function(e){e.$ref=t.id})),t.refs=null),t},Y_.proxy=function(t){var e=t instanceof eb?ib(t):t;return this.add(Jb({value:e}))},Y_.addStream=function(t){return this.streams.push(t),t.id=this.id(),t},Y_.addUpdate=function(t){return this.updates.push(t),t},Y_.finish=function(){var t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){var r;t&&((r=t.data||(t.data={}))[e]||(r[e]=[])).push(n)}for(t in this.data)for(var r in n((e=this.data[t]).input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values"),e.index)n(e.index[r],t,"index:"+r);return this},Y_.pushState=function(t,e,n){this._encode.push(ib(this.add(tx({pulse:t})))),this._parent.push(e),this._lookup.push(n?ib(this.proxy(n)):null),this._markpath.push(-1)},Y_.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},Y_.parent=function(){return L(this._parent)},Y_.encode=function(){return L(this._encode)},Y_.lookup=function(){return L(this._lookup)},Y_.markpath=function(){var t=this._markpath;return++t[t.length-1]},Y_.fieldRef=function(t,e){if(Ct(t))return ab(t,e);t.signal||x("Unsupported field reference: "+Tt(t));var n,r=t.signal,i=this.field[r];return i||(n={name:this.signalRef(r)},e&&(n.as=e),this.field[r]=i=ib(this.add(Nb(n)))),i},Y_.compareRef=function(t){function e(t){return lb(t)?(r=!0,n.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(r=!0,n.exprRef(t.expr)):t}var n=this,r=!1,i=rt(t.field).map(e),a=rt(t.order).map(e);return r?ib(this.add(Rb({fields:i,orders:a}))):ub(i,a)},Y_.keyRef=function(t,e){var n=this.signals,r=!1;return t=rt(t).map((function(t){return lb(t)?(r=!0,ib(n[t.signal])):t})),r?ib(this.add(Ub({fields:t,flat:e}))):function(t,e){var n={$key:t};return e&&(n.$flat=!0),n}(t,e)},Y_.sortRef=function(t){if(!t)return t;var e=sb(t.op,t.field),n=t.order||"ascending";return n.signal?ib(this.add(Rb({fields:e,orders:this.signalRef(n.signal)}))):ub(e,n)},Y_.event=function(t,e){var n=t+":"+e;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},Y_.hasOwnSignal=function(t){return vt(this.signals,t)},Y_.addSignal=function(t,e){this.hasOwnSignal(t)&&x("Duplicate signal name: "+Tt(t));var n=e instanceof eb?e:this.add(rb(e));return this.signals[t]=n},Y_.getSignal=function(t){return this.signals[t]||x("Unrecognized signal name: "+Tt(t)),this.signals[t]},Y_.signalRef=function(t){return this.signals[t]?ib(this.signals[t]):(vt(this.lambdas,t)||(this.lambdas[t]=this.add(rb(null))),ib(this.lambdas[t]))},Y_.parseLambdas=function(){for(var t=Object.keys(this.lambdas),e=0,n=t.length;e=r&&t=i?1:(e-r+1)/a},o.icdf=function(t){return t>=0&&t<=1?r-1+Math.floor(t*a):NaN},o.min(e).max(n)},t.randomKDE=bi,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=wi,t.randomMixture=Di,t.randomNormal=yi,t.randomUniform=Si,t.read=xr,t.regressionExp=$i,t.regressionLinear=Ti,t.regressionLoess=ji,t.regressionLog=qi,t.regressionPoly=Ui,t.regressionPow=Li,t.regressionQuad=Ni,t.renderModule=cd,t.repeat=Ot,t.resetDefaultLocale=function(){return un(),pr(),br()},t.resetSVGClipId=vu,t.resetSVGDefIds=function(){vu(),Ao=0},t.responseType=$e,t.runtimeContext=yy,t.sampleCurve=Gi,t.sampleLogNormal=xi,t.sampleNormal=pi,t.sampleUniform=Mi,t.scale=Vc,t.sceneEqual=vd,t.sceneFromJSON=ml,t.scenePickVisit=os,t.sceneToJSON=pl,t.sceneVisit=as,t.sceneZOrder=is,t.scheme=hf,t.setRandom=function(e){t.random=e},t.span=Rt,t.splitAccessPath=_,t.stringValue=Tt,t.textMetrics=Hs,t.timeBin=cr,t.timeFloor=jn,t.timeFormatLocale=gr,t.timeInterval=Vn,t.timeOffset=Kn,t.timeSequence=tr,t.timeUnitSpecifier=kn,t.timeUnits=_n,t.toBoolean=qt,t.toDate=Lt,t.toNumber=N,t.toSet=Ut,t.toString=Nt,t.transform=Wr,t.transforms=jr,t.truncate=Pt,t.truthy=E,t.tupleid=Vt,t.typeParsers=we,t.utcFloor=Hn,t.utcInterval=Xn,t.utcOffset=Qn,t.utcSequence=er,t.utcdayofyear=On,t.utcquarter=nt,t.utcweek=zn,t.version="5.13.0",t.visitArray=jt,t.week=Cn,t.writeConfig=q,t.zero=M,t.zoomLinear=K,t.zoomLog=Q,t.zoomPow=Z,t.zoomSymlog=tt,Object.defineProperty(t,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega/build/vega-module.js b/node_modules/vega/build/vega-module.js deleted file mode 100644 index 35a5b79..0000000 --- a/node_modules/vega/build/vega-module.js +++ /dev/null @@ -1,32691 +0,0 @@ -import { dsvFormat } from 'd3-dsv'; -import { feature, mesh } from 'topojson-client'; -import { formatLocale, formatSpecifier, precisionFixed, precisionRound, precisionPrefix, format as format$3, formatPrefix } from 'd3-format'; -import { timeDay, timeWeek, utcDay, utcWeek, timeYear, timeMonth, timeHour, timeMinute, timeSecond, timeMillisecond, utcYear, utcMonth, utcHour, utcMinute, utcSecond, utcMillisecond } from 'd3-time'; -import { timeFormatLocale as timeFormatLocale$1, timeFormat as timeFormat$1, timeParse as timeParse$1, utcFormat as utcFormat$1, utcParse as utcParse$1 } from 'd3-time-format'; -import { curveBasis, curveBasisClosed, curveBasisOpen, curveBundle, curveCardinal, curveCardinalOpen, curveCardinalClosed, curveCatmullRom, curveCatmullRomClosed, curveCatmullRomOpen, curveLinear, curveLinearClosed, curveMonotoneY, curveMonotoneX, curveNatural, curveStep, curveStepAfter, curveStepBefore, arc as arc$3, area as area$3, line as line$3, symbol as symbol$2 } from 'd3-shape'; -import { path as path$3 } from 'd3-path'; -import * as $$1 from 'd3-interpolate'; -import { interpolateNumber, interpolateRound, interpolate as interpolate$1, piecewise } from 'd3-interpolate'; -import { geoProjection, geoPath, geoAlbers, geoAlbersUsa, geoAzimuthalEqualArea, geoAzimuthalEquidistant, geoConicConformal, geoConicEqualArea, geoConicEquidistant, geoEqualEarth, geoEquirectangular, geoGnomonic, geoIdentity, geoMercator, geoNaturalEarth1, geoOrthographic, geoStereographic, geoTransverseMercator, geoGraticule, geoBounds as geoBounds$1, geoCentroid as geoCentroid$1, geoArea as geoArea$1 } from 'd3-geo'; -import { rgb, lab, hcl, hsl } from 'd3-color'; -import { forceSimulation, forceCenter, forceCollide, forceManyBody, forceLink, forceX, forceY } from 'd3-force'; -import { hierarchy, pack, partition as partition$5, stratify, tree as tree$1, cluster, treemap, treemapBinary, treemapDice, treemapSlice, treemapSliceDice, treemapSquarify, treemapResquarify } from 'd3-hierarchy'; -import { interval } from 'd3-timer'; - -function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; -} - -function accessorName(fn) { - return fn == null ? null : fn.fname; -} - -function accessorFields(fn) { - return fn == null ? null : fn.fields; -} - -function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); -} - -const get1 = field => function(obj) { - return obj[field]; -}; - -const getN = path => { - const len = path.length; - return function(obj) { - for (let i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - return obj; - }; -}; - -function error(message) { - throw Error(message); -} - -function splitAccessPath(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, j, c; - - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i=j=0; j i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; -} - -function field(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor( - (opt && opt.get || getter)(path), - [field], - name || field - ); -} - -var empty = []; - -var id = field('id'); - -var identity = accessor(function(_) { return _; }, empty, 'identity'); - -var zero = accessor(function() { return 0; }, empty, 'zero'); - -var one = accessor(function() { return 1; }, empty, 'one'); - -var truthy = accessor(function() { return true; }, empty, 'true'); - -var falsy = accessor(function() { return false; }, empty, 'false'); - -function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console -} - -var None = 0; -var Error$1 = 1; -var Warn = 2; -var Info = 3; -var Debug = 4; - -function logger(_, method) { - var level = _ || None; - return { - level: function(_) { - if (arguments.length) { - level = +_; - return this; - } else { - return level; - } - }, - error: function() { - if (level >= Error$1) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function() { - if (level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function() { - if (level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function() { - if (level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; -} - -var isArray = Array.isArray; - -function isObject(_) { - return _ === Object(_); -} - -const isLegalKey = key => key !== '__proto__'; - -function mergeConfig(...configs) { - return configs.reduce((out, source) => { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? {layout: 1} - : key === 'style' ? true - : null; - writeConfig(out, key, source[key], r); - } - } - return out; - }, {}); -} - -function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - - var k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : (output[key] = {}); - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } -} - -function mergeNamed(a, b) { - if (a == null) return b; - - const map = {}, out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; -} - -function peek(array) { - return array[array.length - 1]; -} - -function toNumber(_) { - return _ == null || _ === '' ? null : +_; -} - -function exp(sign) { - return function(x) { return sign * Math.exp(x); }; -} - -function log$1(sign) { - return function(x) { return Math.log(sign * x); }; -} - -function symlog(c) { - return function(x) { return Math.sign(x) * Math.log1p(Math.abs(x / c)); }; -} - -function symexp(c) { - return function(x) { return Math.sign(x) * Math.expm1(Math.abs(x)) * c; }; -} - -function pow(exponent) { - return function(x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; -} - -function pan(domain, delta, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - dd = (d1 - d0) * delta; - - return [ - ground(d0 - dd), - ground(d1 - dd) - ]; -} - -function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); -} - -function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log$1(sign), exp(sign)); -} - -function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1/exponent)); -} - -function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); -} - -function zoom(domain, anchor, scale, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - - return [ - ground(da + (d0 - da) * scale), - ground(da + (d1 - da) * scale) - ]; -} - -function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); -} - -function zoomLog(domain, anchor, scale) { - var sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log$1(sign), exp(sign)); -} - -function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1/exponent)); -} - -function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); -} - -function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); -} - -function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); -} - -function array(_) { - return _ != null ? (isArray(_) ? _ : [_]) : []; -} - -/** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ -function clampRange(range, min, max) { - var lo = range[0], - hi = range[1], - span; - - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - span = hi - lo; - - return span >= (max - min) - ? [min, max] - : [ - (lo = Math.min(Math.max(lo, min), max - span)), - lo + span - ]; -} - -function isFunction(_) { - return typeof _ === 'function'; -} - -const DESCENDING = 'descending'; - -function compare(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - - const ord = [], get = [], fmap = {}, - gen = opt.comparator || comparator; - - array(fields).forEach((f, i) => { - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach(_ => fmap[_] = 1); - }); - - return get.length === 0 - ? null - : accessor(gen(get, ord), Object.keys(fmap)); -} - -const compare$1 = (u, v) => (u < v || u == null) && v != null ? -1 - : (u > v || v == null) && u != null ? 1 - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? -1 - : v !== v && u === u ? 1 - : 0; - -const comparator = (fields, orders) => fields.length === 1 - ? compare1(fields[0], orders[0]) - : compareN(fields, orders, fields.length); - -const compare1 = (field, order) => function(a, b) { - return compare$1(field(a), field(b)) * order; -}; - -const compareN = (fields, orders, n) => { - orders.push(0); // pad zero for convenient lookup - return function(a, b) { - let f, c = 0, i = -1; - while (c === 0 && ++i < n) { - f = fields[i]; - c = compare$1(f(a), f(b)); - } - return c * orders[i]; - }; -}; - -function constant(_) { - return isFunction(_) ? _ : function() { return _; }; -} - -function debounce(delay, handler) { - var tid, evt; - - function callback() { - handler(evt); - tid = evt = null; - } - - return function(e) { - evt = e; - if (tid) clearTimeout(tid); - tid = setTimeout(callback, delay); - }; -} - -function extend(_) { - for (var x, k, i=1, len=arguments.length; i max) max = v; - } - } - } else { - // find first valid value - for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])); - min = max = v; - - // visit all other values - for (; i max) max = v; - } - } - } - } - - return [min, max]; -} - -function extentIndex(array, f) { - var i = -1, - n = array.length, - a, b, c, u, v; - - if (f == null) { - while (++i < n) { - b = array[i]; - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = array[i]; - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while (++i < n) { - b = f(array[i], i, array); - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = f(array[i], i, array); - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } - - return [u, v]; -} - -const hop = Object.prototype.hasOwnProperty; - -function hasOwnProperty(object, property) { - return hop.call(object, property); -} - -var NULL = {}; - -function fastmap(input) { - var obj = {}, - map, - test; - - function has(key) { - return hasOwnProperty(obj, key) && obj[key] !== NULL; - } - - map = { - size: 0, - empty: 0, - object: obj, - has: has, - get(key) { - return has(key) ? obj[key] : undefined; - }, - set(key, value) { - if (!has(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - obj[key] = value; - return this; - }, - delete(key) { - if (has(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - return this; - }, - clear() { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test(_) { - if (arguments.length) { - test = _; - return map; - } else { - return test; - } - }, - clean() { - var next = {}, - size = 0, - key, value; - for (key in obj) { - value = obj[key]; - if (value !== NULL && (!test || !test(value))) { - next[key] = value; - ++size; - } - } - map.size = size; - map.empty = 0; - map.object = (obj = next); - } - }; - - if (input) Object.keys(input).forEach(function(key) { - map.set(key, input[key]); - }); - - return map; -} - -function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - - var a = range[0], - b = peek(range), - t = +threshold, - l, r; - - // swap endpoints if range is reversed - if (b < a) { - l = a; a = b; b = l; - } - - // compare value to endpoints - l = Math.abs(value - a); - r = Math.abs(b - value); - - // adjust if value is within threshold distance of endpoint - return l < r && l <= t ? left : r <= t ? right : center; -} - -function inherits(child, parent) { - var proto = (child.prototype = Object.create(parent.prototype)); - proto.constructor = child; - return proto; -} - -/** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ -function inrange(value, range, left, right) { - var r0 = range[0], r1 = range[range.length-1], t; - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - left = left === undefined || left; - right = right === undefined || right; - - return (left ? r0 <= value : r0 < value) && - (right ? value <= r1 : value < r1); -} - -function isBoolean(_) { - return typeof _ === 'boolean'; -} - -function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; -} - -function isNumber(_) { - return typeof _ === 'number'; -} - -function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; -} - -function isString(_) { - return typeof _ === 'string'; -} - -function key(fields, flat, opt) { - if (fields) { - fields = flat - ? array(fields).map(f => f.replace(/\\(.)/g, '$1')) - : array(fields); - } - - const len = fields && fields.length, - gen = opt && opt.get || getter, - map = f => gen(flat ? [f] : splitAccessPath(f)); - let fn; - - if (!len) { - fn = function() { return ''; }; - } else if (len === 1) { - const get = map(fields[0]); - fn = function(_) { return '' + get(_); }; - } else { - const get = fields.map(map); - fn = function(_) { - let s = '' + get[0](_), i = 0; - while (++i < len) s += '|' + get[i](_); - return s; - }; - } - - return accessor(fn, fields, 'key'); -} - -function lerp(array, frac) { - const lo = array[0], - hi = peek(array), - f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); -} - -const DEFAULT_MAX_SIZE = 10000; - -// adapted from https://github.com/dominictarr/hashlru/ (MIT License) -function lruCache(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - - let curr, prev, size; - - const clear = () => { - curr = {}; - prev = {}; - size = 0; - }; - - const update = (key, value) => { - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - return (curr[key] = value); - }; - - clear(); - - return { - clear, - has: key => hasOwnProperty(curr, key) || hasOwnProperty(prev, key), - get: key => hasOwnProperty(curr, key) ? curr[key] - : hasOwnProperty(prev, key) ? update(key, prev[key]) - : undefined, - set: (key, value) => hasOwnProperty(curr, key) - ? (curr[key] = value) - : update(key, value) - }; -} - -function merge(compare, array0, array1, output) { - var n0 = array0.length, - n1 = array1.length; - - if (!n1) return array0; - if (!n0) return array1; - - var merged = output || new array0.constructor(n0 + n1), - i0 = 0, i1 = 0, i = 0; - - for (; i0 0 - ? array1[i1++] - : array0[i0++]; - } - - for (; i0= 0) s += str; - return s; -} - -function pad(str, length, padchar, align) { - var c = padchar || ' ', - s = str + '', - n = length - s.length; - - return n <= 0 ? s - : align === 'left' ? repeat(c, n) + s - : align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2)) - : s + repeat(c, n); -} - -/** - * Return the numerical span of an array: the difference between - * the last and first values. - */ -function span(array) { - return array && (peek(array) - array[0]) || 0; -} - -function $(x) { - return isArray(x) ? '[' + x.map($) + ']' - : isObject(x) || isString(x) ? - // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029') - : x; -} - -function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; -} - -function defaultParser(_) { - return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); -} - -function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); -} - -function toString(_) { - return _ == null || _ === '' ? null : _ + ''; -} - -function toSet(_) { - for (var s={}, i=0, n=_.length; i= 0) { - list.splice(idx, 1); - } - } - return list; - }; - - return list; -} - -/** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ -async function asyncCallback(df, callback) { - try { await callback(df); } catch (err) { df.error(err); } -} - -var TUPLE_ID_KEY = Symbol('vega_id'), - TUPLE_ID = 1; - -/** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ -function isTuple(t) { - return !!(t && tupleid(t)); -} - -/** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ -function tupleid(t) { - return t[TUPLE_ID_KEY]; -} - -/** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ -function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; -} - -/** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ -function ingest(datum) { - var t = (datum === Object(datum)) ? datum : {data: datum}; - return tupleid(t) ? t : setid(t, TUPLE_ID++); -} - -/** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ -function derive(t) { - return rederive(t, ingest({})); -} - -/** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ -function rederive(t, d) { - for (var k in t) d[k] = t[k]; - return d; -} - -/** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ -function replace(t, d) { - return setid(d, tupleid(t)); -} - -/** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ -function stableCompare(cmp, f) { - return !cmp ? null - : f ? (a, b) => cmp(a, b) || (tupleid(f(a)) - tupleid(f(b))) - : (a, b) => cmp(a, b) || (tupleid(a) - tupleid(b)); -} - -function isChangeSet(v) { - return v && v.constructor === changeset; -} - -function changeset() { - var add = [], // insert tuples - rem = [], // remove tuples - mod = [], // modify tuples - remp = [], // remove by predicate - modp = [], // modify by predicate - clean = null, - reflow = false; - - return { - constructor: changeset, - insert: function(t) { - var d = array(t), i = 0, n = d.length; - for (; i 0) { - modify(t, f, m.value); - pulse.modifies(f); - } - } - - // process predicate-based modifications - for (i=0, n=modp.length; i 0) { - modify(t, m.field, m.value); - } - }); - pulse.modifies(m.field); - } - - // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - if (reflow) { - pulse.mod = rem.length || remp.length - ? tuples.filter(function(t) { return cur[tupleid(t)] > 0; }) - : tuples.slice(); - } else { - for (id in out) pulse.mod.push(out[id]); - } - - // set pulse garbage collection request - if (clean || clean == null && (rem.length || remp.length)) { - pulse.clean(true); - } - - return pulse; - } - }; -} - -var CACHE = '_:mod:_'; - -/** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ -function Parameters() { - Object.defineProperty(this, CACHE, {writable: true, value: {}}); -} - -var prototype = Parameters.prototype; - -/** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ -prototype.set = function(name, index, value, force) { - var o = this, - v = o[name], - mod = o[CACHE]; - - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = isArray(value) ? 1 + value.length : -1; - } - - return o; -}; - -/** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ -prototype.modified = function(name, index) { - var mod = this[CACHE], k; - if (!arguments.length) { - for (k in mod) { if (mod[k]) return true; } - return false; - } else if (isArray(name)) { - for (k=0; k= 0) - ? (index + 1 < mod[name] || !!mod[index + ':' + name]) - : !!mod[name]; -}; - -/** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ -prototype.clear = function() { - this[CACHE] = {}; - return this; -}; - -var OP_ID = 0; -var PULSE = 'pulse'; -var NO_PARAMS = new Parameters(); - -// Boolean Flags -var SKIP = 1, - MODIFIED = 2; - -/** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ -function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - - if (update) { - this._update = update; - } - if (params) this.parameters(params, react); -} - -var prototype$1 = Operator.prototype; - -/** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ -prototype$1.targets = function() { - return this._targets || (this._targets = UniqueList(id)); -}; - -/** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ -prototype$1.set = function(value) { - if (this.value !== value) { - this.value = value; - return 1; - } else { - return 0; - } -}; - -function flag(bit) { - return function(state) { - var f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? (f | bit) : (f & ~bit); - return this; - }; -} - -/** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ -prototype$1.skip = flag(SKIP); - -/** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ -prototype$1.modified = flag(MODIFIED); - -/** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initiatal evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ -prototype$1.parameters = function(params, react, initonly) { - react = react !== false; - var self = this, - argval = (self._argval = self._argval || new Parameters()), - argops = (self._argops = self._argops || []), - deps = [], - name, value, n, i; - - function add(name, index, value) { - if (value instanceof Operator) { - if (value !== self) { - if (react) value.targets().add(self); - deps.push(value); - } - argops.push({op:value, name:name, index:index}); - } else { - argval.set(name, index, value); - } - } - - for (name in params) { - value = params[name]; - - if (name === PULSE) { - array(value).forEach(function(op) { - if (!(op instanceof Operator)) { - error('Pulse parameters must be operator instances.'); - } else if (op !== self) { - op.targets().add(self); - deps.push(op); - } - }); - self.source = value; - } else if (isArray(value)) { - argval.set(name, -1, Array(n = value.length)); - for (i=0; i} - The source operators that should propagate - * to the target operator. - */ -function connect(target, sources) { - var targetRank = target.rank, i, n; - - for (i=0, n=sources.length; i pause) { - t = now; - return 1; - } else { - return 0; - } - }); -}; - -prototype$2.debounce = function(delay) { - var s = stream(); - - this.targets().add(stream(null, null, - debounce(delay, function(e) { - var df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }) - )); - - return s; -}; - -prototype$2.between = function(a, b) { - var active = false; - a.targets().add(stream(null, null, function() { active = true; })); - b.targets().add(stream(null, null, function() { active = false; })); - return this.filter(function() { return active; }); -}; - -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ -function events(source, type, filter, apply) { - var df = this, - s = stream(filter, apply), - send = function(e) { - e.dataflow = df; - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally { - df.run(); - } - }, - sources; - - if (typeof source === 'string' && typeof document !== 'undefined') { - sources = document.querySelectorAll(source); - } else { - sources = array(source); - } - - for (var i=0, n=sources.length; i i + 1); - - for (let i = 0, t = 0, j, value; i < n; ++i) { - value = field ? values[i][field] : values[i]; - for (j = 0; j < m; ++j) { - if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - } - - return typeList[ - a.reduce((u, v) => u === 0 ? v : u, 0) - 1 - ]; -} - -function inferTypes(data, fields) { - return fields.reduce(function(types, field) { - types[field] = inferType(data, field); - return types; - }, {}); -} - -// -- Type Checks ---- - -function isValid(_) { - return _ != null && _ === _; -} - -function isBoolean$1(_) { - return _ === 'true' || _ === 'false' || _ === true || _ === false; -} - -function isDate$1(_) { - return !Number.isNaN(Date.parse(_)); -} - -function isNumber$1(_) { - return !Number.isNaN(+_) && !(_ instanceof Date); -} - -function isInteger(_) { - return isNumber$1(_) && Number.isInteger(+_); -} - -function delimitedFormat(delimiter) { - const parse = function(data, format) { - const delim = {delimiter: delimiter}; - return dsv(data, format ? extend(format, delim) : delim); - }; - - parse.responseType = 'text'; - - return parse; -} - -function dsv(data, format) { - if (format.header) { - data = format.header - .map($) - .join(format.delimiter) + '\n' + data; - } - return dsvFormat(format.delimiter).parse(data + ''); -} - -dsv.responseType = 'text'; - -function isBuffer(_) { - return (typeof Buffer === 'function' && isFunction(Buffer.isBuffer)) - ? Buffer.isBuffer(_) : false; -} - -function json(data, format) { - const prop = (format && format.property) ? field(format.property) : identity; - return isObject(data) && !isBuffer(data) - ? parseJSON(prop(data)) - : prop(JSON.parse(data)); -} - -json.responseType = 'json'; - -function parseJSON(data, format) { - return (format && format.copy) - ? JSON.parse(JSON.stringify(data)) - : data; -} - -const filters = { - interior: (a, b) => a !== b, - exterior: (a, b) => a === b -}; - -function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - - if (format && format.feature) { - method = feature; - property = format.feature; - } else if (format && format.mesh) { - method = mesh; - property = format.mesh; - filter = filters[format.filter]; - } else { - error('Missing TopoJSON feature or mesh parameter.'); - } - - object = (object = data.objects[property]) - ? method(data, object, filter) - : error('Invalid TopoJSON object: ' + property); - - return object && object.features || [object]; -} - -topojson.responseType = 'json'; - -const format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson -}; - -function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else { - return hasOwnProperty(format, name) ? format[name] : null; - } -} - -function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; -} - -function memoize(method) { - const cache = {}; - return spec => cache[spec] || (cache[spec] = method(spec)); -} - -function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; -} - -function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; -} - -var ascendingBisect = bisector(ascending); -var bisectRight = ascendingBisect.right; -var bisectLeft = ascendingBisect.left; - -function variance(values, valueof) { - let count = 0; - let delta; - let mean = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } - if (count > 1) return sum / (count - 1); -} - -function deviation(values, valueof) { - const v = variance(values, valueof); - return v ? Math.sqrt(v) : v; -} - -function sequence(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} - -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; -} - -function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} - -function max(values, valueof) { - let max; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } - return max; -} - -function min(values, valueof) { - let min; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } - return min; -} - -// Based on https://github.com/mourner/quickselect -// ISC license, Copyright 2018 Vladimir Agafonkin. -function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending) { - while (right > left) { - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - - const t = array[k]; - let i = left; - let j = right; - - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - - while (i < j) { - swap(array, i, j), ++i, --j; - while (compare(array[i], t) < 0) ++i; - while (compare(array[j], t) > 0) --j; - } - - if (compare(array[left], t) === 0) swap(array, left, j); - else ++j, swap(array, j, right); - - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array; -} - -function swap(array, i, j) { - const t = array[i]; - array[i] = array[j]; - array[j] = t; -} - -function number(x) { - return x === null ? NaN : +x; -} - -function* numbers(values, valueof) { - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - yield value; - } - } - } -} - -function quantile(values, p, valueof) { - values = Float64Array.from(numbers(values, valueof)); - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return min(values); - if (p >= 1) return max(values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), - value1 = min(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); -} - -function quantileSorted(values, p, valueof = number) { - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} - -function mean(values, valueof) { - let count = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } - if (count) return sum / count; -} - -function median(values, valueof) { - return quantile(values, 0.5, valueof); -} - -function permute(source, keys) { - return Array.from(keys, key => source[key]); -} - -function sum(values, valueof) { - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value = +value) { - sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if (value = +valueof(value, ++index, values)) { - sum += value; - } - } - } - return sum; -} - -function trimZeroes(numberFormat, decimalChar) { - return x => { - var str = numberFormat(x), - dec = str.indexOf(decimalChar), - idx, end; - - if (dec < 0) return str; - - idx = rightmostDigit(str, dec); - end = idx < str.length ? str.slice(idx) : ''; - while (--idx > dec) if (str[idx] !== '0') { ++idx; break; } - - return str.slice(0, idx) + end; - }; -} - -function rightmostDigit(str, dec) { - var i = str.lastIndexOf('e'), c; - if (i > 0) return i; - for (i=str.length; --i > dec;) { - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit - } -} - -function numberLocale(locale) { - const format = memoize(locale.format), - formatPrefix = locale.formatPrefix; - - return { - format, - formatPrefix, - formatFloat(spec) { - var s = formatSpecifier(spec || ','); - if (s.precision == null) { - s.precision = 12; - switch (s.type) { - case '%': s.precision -= 2; break; - case 'e': s.precision -= 1; break; - } - return trimZeroes( - format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else { - return format(s); - } - }, - formatSpan(start, stop, count, specifier) { - specifier = formatSpecifier(specifier == null ? ',f' : specifier); - const step = tickStep(start, stop, count), - value = Math.max(Math.abs(start), Math.abs(stop)); - let precision; - - if (specifier.precision == null) { - switch (specifier.type) { - case 's': { - if (!isNaN(precision = precisionPrefix(step, value))) { - specifier.precision = precision; - } - return formatPrefix(specifier, value); - } - case '': - case 'e': - case 'g': - case 'p': - case 'r': { - if (!isNaN(precision = precisionRound(step, value))) { - specifier.precision = precision - (specifier.type === 'e'); - } - break; - } - case 'f': - case '%': { - if (!isNaN(precision = precisionFixed(step))) { - specifier.precision = precision - (specifier.type === '%') * 2; - } - break; - } - } - } - return format(specifier); - } - }; -} - -let defaultNumberLocale; -resetNumberFormatDefaultLocale(); - -function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: format$3, - formatPrefix: formatPrefix - }); -} - -function numberFormatLocale(definition) { - return numberLocale(formatLocale(definition)); -} - -function numberFormatDefaultLocale(definition) { - return arguments.length - ? (defaultNumberLocale = numberFormatLocale(definition)) - : defaultNumberLocale; -} - -const YEAR = 'year'; -const QUARTER = 'quarter'; -const MONTH = 'month'; -const WEEK = 'week'; -const DATE = 'date'; -const DAY = 'day'; -const DAYOFYEAR = 'dayofyear'; -const HOURS = 'hours'; -const MINUTES = 'minutes'; -const SECONDS = 'seconds'; -const MILLISECONDS = 'milliseconds'; - -const TIME_UNITS = [ - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -]; - -const UNITS = TIME_UNITS.reduce((o, u, i) => (o[u] = 1 + i, o), {}); - -function timeUnits(units) { - const u = array(units).slice(), - m = {}; - - // check validity - if (!u.length) error('Missing time unit.'); - - u.forEach(unit => { - if (hasOwnProperty(UNITS, unit)) { - m[unit] = 1; - } else { - error(`Invalid time unit: ${unit}.`); - } - }); - - const numTypes = ( - (m[WEEK] || m[DAY] ? 1 : 0) + - (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + - (m[DAYOFYEAR] ? 1 : 0) - ); - - if (numTypes > 1) { - error(`Incompatible time units: ${units}`); - } - - // ensure proper sort order - u.sort((a, b) => UNITS[a] - UNITS[b]); - - return u; -} - -const defaultSpecifiers = { - [YEAR]: '%Y ', - [QUARTER]: 'Q%q ', - [MONTH]: '%b ', - [DATE]: '%d ', - [WEEK]: 'W%U ', - [DAY]: '%a ', - [DAYOFYEAR]: '%j ', - [HOURS]: '%H:00', - [MINUTES]: '00:%M', - [SECONDS]: ':%S', - [MILLISECONDS]: '.%L', - [`${YEAR}-${MONTH}`]: '%Y-%m ', - [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ', - [`${HOURS}-${MINUTES}`]: '%H:%M' -}; - -function timeUnitSpecifier(units, specifiers) { - const s = extend({}, defaultSpecifiers, specifiers), - u = timeUnits(units), - n = u.length; - - let fmt = '', start = 0, end, key; - - for (start=0; start start; --end) { - key = u.slice(start, end).join('-'); - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - } - - return fmt.trim(); -} - -const t0 = new Date; - -function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; -} - -function dayofyear(d) { - return localDayOfYear(new Date(d)); -} - -function week(d) { - return localWeekNum(new Date(d)); -} - -function localDayOfYear(d) { - return timeDay.count(localYear(d.getFullYear()) - 1, d); -} - -function localWeekNum(d) { - return timeWeek.count(localYear(d.getFullYear()) - 1, d); -} - -function localFirst(y) { - return localYear(y).getDay(); -} - -function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - return new Date(y, m, d, H, M, S, L); -} - -function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); -} - -function utcweek(d) { - return utcWeekNum(new Date(d)); -} - -function utcDayOfYear(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return utcDay.count(y - 1, d); -} - -function utcWeekNum(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return utcWeek.count(y - 1, d); -} - -function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); -} - -function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(y, m, d, H, M, S, L)); -} - -function floor(units, step, get, inv, newDate) { - const s = step || 1, - b = peek(units), - _ = (unit, p, key) => { - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - - const t = new Date, - u = toSet(units), - y = u[YEAR] ? _(YEAR) : constant(2012), - m = u[MONTH] ? _(MONTH) - : u[QUARTER] ? _(QUARTER) - : zero, - d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) - : u[WEEK] ? _(WEEK, 1) - : u[DAY] ? _(DAY, 1) - : u[DATE] ? _(DATE, 1) - : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) - : one, - H = u[HOURS] ? _(HOURS) : zero, - M = u[MINUTES] ? _(MINUTES) : zero, - S = u[SECONDS] ? _(SECONDS) : zero, - L = u[MILLISECONDS] ? _(MILLISECONDS) : zero; - - return function(v) { - t.setTime(+v); - const year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; -} - -function getUnit(f, inv, step, phase) { - const u = step <= 1 ? f - : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) - : (d, y) => step * Math.floor(f(d, y) / step); - return inv ? (d, y) => inv(u(d, y), y) : u; -} - -// returns the day of the year based on week number, day of week, -// and the day of the week for the first day of the year -function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; -} - -// -- LOCAL TIME -- - -const localGet = { - [YEAR]: d => d.getFullYear(), - [QUARTER]: d => Math.floor(d.getMonth() / 3), - [MONTH]: d => d.getMonth(), - [DATE]: d => d.getDate(), - [HOURS]: d => d.getHours(), - [MINUTES]: d => d.getMinutes(), - [SECONDS]: d => d.getSeconds(), - [MILLISECONDS]: d => d.getMilliseconds(), - [DAYOFYEAR]: d => localDayOfYear(d), - [WEEK]: d => localWeekNum(d), - [WEEK + DAY]: (d, y) => weekday(localWeekNum(d), d.getDay(), localFirst(y)), - [DAY]: (d, y) => weekday(1, d.getDay(), localFirst(y)) -}; - -const localInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday(w, 0, localFirst(y)) -}; - -function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); -} - -// -- UTC TIME -- - -const utcGet = { - [YEAR]: d => d.getUTCFullYear(), - [QUARTER]: d => Math.floor(d.getUTCMonth() / 3), - [MONTH]: d => d.getUTCMonth(), - [DATE]: d => d.getUTCDate(), - [HOURS]: d => d.getUTCHours(), - [MINUTES]: d => d.getUTCMinutes(), - [SECONDS]: d => d.getUTCSeconds(), - [MILLISECONDS]: d => d.getUTCMilliseconds(), - [DAYOFYEAR]: d => utcDayOfYear(d), - [WEEK]: d => utcWeekNum(d), - [DAY]: (d, y) => weekday(1, d.getUTCDay(), utcFirst(y)), - [WEEK + DAY]: (d, y) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)) -}; - -const utcInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday(w, 0, utcFirst(y)) -}; - -function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); -} - -const timeIntervals = { - [YEAR]: timeYear, - [QUARTER]: timeMonth.every(3), - [MONTH]: timeMonth, - [WEEK]: timeWeek, - [DATE]: timeDay, - [DAY]: timeDay, - [DAYOFYEAR]: timeDay, - [HOURS]: timeHour, - [MINUTES]: timeMinute, - [SECONDS]: timeSecond, - [MILLISECONDS]: timeMillisecond -}; - -const utcIntervals = { - [YEAR]: utcYear, - [QUARTER]: utcMonth.every(3), - [MONTH]: utcMonth, - [WEEK]: utcWeek, - [DATE]: utcDay, - [DAY]: utcDay, - [DAYOFYEAR]: utcDay, - [HOURS]: utcHour, - [MINUTES]: utcMinute, - [SECONDS]: utcSecond, - [MILLISECONDS]: utcMillisecond -}; - -function timeInterval(unit) { - return timeIntervals[unit]; -} - -function utcInterval(unit) { - return utcIntervals[unit]; -} - -function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; -} - -function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); -} - -function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); -} - -function sequence$1(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; -} - -function timeSequence(unit, start, stop, step) { - return sequence$1(timeInterval(unit), start, stop, step); -} - -function utcSequence(unit, start, stop, step) { - return sequence$1(utcInterval(unit), start, stop, step); -} - -const durationSecond = 1000, - durationMinute = durationSecond * 60, - durationHour = durationMinute * 60, - durationDay = durationHour * 24, - durationWeek = durationDay * 7, - durationMonth = durationDay * 30, - durationYear = durationDay * 365; - -const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], - Seconds = Milli.slice(0, -1), - Minutes = Seconds.slice(0, -1), - Hours = Minutes.slice(0, -1), - Day = Hours.slice(0, -1), - Week = [YEAR, WEEK], - Month = [YEAR, MONTH], - Year = [YEAR]; - -const intervals = [ - [Seconds, 1, durationSecond], - [Seconds, 5, 5 * durationSecond], - [Seconds, 15, 15 * durationSecond], - [Seconds, 30, 30 * durationSecond], - [Minutes, 1, durationMinute], - [Minutes, 5, 5 * durationMinute], - [Minutes, 15, 15 * durationMinute], - [Minutes, 30, 30 * durationMinute], - [ Hours, 1, durationHour ], - [ Hours, 3, 3 * durationHour ], - [ Hours, 6, 6 * durationHour ], - [ Hours, 12, 12 * durationHour ], - [ Day, 1, durationDay ], - [ Week, 1, durationWeek ], - [ Month, 1, durationMonth ], - [ Month, 3, 3 * durationMonth ], - [ Year, 1, durationYear ] -]; - -function timeBin(opt) { - const ext = opt.extent, - max = opt.maxbins || 40, - target = Math.abs(span(ext)) / max; - - let i = bisector(i => i[2]).right(intervals, target), - units, step; - - if (i === intervals.length) { - units = Year, - step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max); - } else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max(tickStep(ext[0], ext[1], max), 1); - } - - return {units, step}; -} - -function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - if (!isObject(spec)) { - error(`Invalid time multi-format specifier: ${spec}`); - } - - const second = interval(SECONDS), - minute = interval(MINUTES), - hour = interval(HOURS), - day = interval(DATE), - week = interval(WEEK), - month = interval(MONTH), - quarter = interval(QUARTER), - year = interval(YEAR), - L = format(spec[MILLISECONDS] || '.%L'), - S = format(spec[SECONDS] || ':%S'), - M = format(spec[MINUTES] || '%I:%M'), - H = format(spec[HOURS] || '%I %p'), - d = format(spec[DATE] || spec[DAY] || '%a %d'), - w = format(spec[WEEK] || '%b %d'), - m = format(spec[MONTH] || '%B'), - q = format(spec[QUARTER] || '%B'), - y = format(spec[YEAR] || '%Y'); - - return date => ( - second(date) < date ? L : - minute(date) < date ? S : - hour(date) < date ? M : - day(date) < date ? H : - month(date) < date ? (week(date) < date ? d : w) : - year(date) < date ? (quarter(date) < date ? m : q) : - y)(date); -} - -function timeLocale(locale) { - const timeFormat = memoize(locale.format), - utcFormat = memoize(locale.utcFormat); - - return { - timeFormat: spec => isString(spec) - ? timeFormat(spec) - : timeMultiFormat(timeFormat, timeInterval, spec), - utcFormat: spec => isString(spec) - ? utcFormat(spec) - : timeMultiFormat(utcFormat, utcInterval, spec), - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; -} - -let defaultTimeLocale; -resetTimeFormatDefaultLocale(); - -function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: timeFormat$1, - parse: timeParse$1, - utcFormat: utcFormat$1, - utcParse: utcParse$1 - }); -} - -function timeFormatLocale(definition) { - return timeLocale(timeFormatLocale$1(definition)); -} - -function timeFormatDefaultLocale(definition) { - return arguments.length - ? (defaultTimeLocale = timeFormatLocale(definition)) - : defaultTimeLocale; -} - -const createLocale = (number, time) => extend({}, number, time); - -function locale(numberSpec, timeSpec) { - const number = numberSpec - ? numberFormatLocale(numberSpec) - : numberFormatDefaultLocale(); - - const time = timeSpec - ? timeFormatLocale(timeSpec) - : timeFormatDefaultLocale(); - - return createLocale(number, time); -} - -function defaultLocale(numberSpec, timeSpec) { - const args = arguments.length; - if (args && args !== 2) { - error('defaultLocale expects either zero or two arguments.'); - } - - return args - ? createLocale( - numberFormatDefaultLocale(numberSpec), - timeFormatDefaultLocale(timeSpec) - ) - : createLocale( - numberFormatDefaultLocale(), - timeFormatDefaultLocale() - ); -} - -function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); -} - -function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - - const reader = formats(schema.type || 'json'); - if (!reader) error('Unknown data format type: ' + schema.type); - - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - - if (hasOwnProperty(data, 'columns')) delete data.columns; - return data; -} - -function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - - const locale = timeFormatDefaultLocale(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - - var fields = data.columns || Object.keys(data[0]), - parsers, datum, field, i, j, n, m; - - if (types === 'auto') types = inferTypes(data, fields); - - fields = Object.keys(types); - parsers = fields.map(function(field) { - var type = types[field], - parts, pattern; - - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - - if ((pattern[0] === '\'' && pattern[pattern.length-1] === '\'') || - (pattern[0] === '"' && pattern[pattern.length-1] === '"')) { - pattern = pattern.slice(1, -1); - } - - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - - if (!typeParsers[type]) { - throw Error('Illegal format pattern: ' + field + ':' + type); - } - - return typeParsers[type]; - }); - - for (i=0, n=data.length, m=fields.length; i df.touch(target(e)); - } else if (isFunction(update)) { - op = new Operator(null, update, params, false); - func = e => { - op.evaluate(e); - const t = target(e), v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else { - func = e => df.update(target(e), update, opt); - } - - stream.apply(func); -} - -function onOperator(df, source, target, update, params, options) { - if (update === undefined) { - source.targets().add(target); - } else { - const opt = options || {}, - op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - source.targets().add(op); // add dependency - - if (target) { - op.skip(true); // skip first invocation - op.value = target.value; // initialize value - op.targets().add(target); // chain dependencies - df.connect(target, [op]); // rerank as needed, #1672 - } - } -} - -function updater(target, update) { - update = isFunction(update) ? update : constant(update); - return target - ? function(_, pulse) { - const value = update(_, pulse); - if (!target.skip()) { - target.skip(value !== this.value).value = value; - } - return value; - } - : update; -} - -/** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ -function rank(op) { - op.rank = ++this._rank; -} - -/** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ -function rerank(op) { - var queue = [op], - cur, list, i; - - while (queue.length) { - this.rank(cur = queue.pop()); - if (list = cur._targets) { - for (i=list.length; --i >= 0;) { - queue.push(cur = list[i]); - if (cur === op) error('Cycle detected in dataflow graph.'); - } - } - } -} - -/** - * Sentinel value indicating pulse propagation should stop. - */ -const StopPropagation = {}; - -// Pulse visit type flags -const ADD = (1 << 0), - REM = (1 << 1), - MOD = (1 << 2), - ADD_REM = ADD | REM, - ADD_MOD = ADD | MOD, - ALL = ADD | REM | MOD, - REFLOW = (1 << 3), - SOURCE = (1 << 4), - NO_SOURCE = (1 << 5), - NO_FIELDS = (1 << 6); - -/** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ -function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; -} - -const prototype$3 = Pulse.prototype; - -/** - * Sentinel value indicating pulse propagation should stop. - */ -prototype$3.StopPropagation = StopPropagation; - -/** - * Boolean flag indicating ADD (added) tuples. - */ -prototype$3.ADD = ADD; - -/** - * Boolean flag indicating REM (removed) tuples. - */ -prototype$3.REM = REM; - -/** - * Boolean flag indicating MOD (modified) tuples. - */ -prototype$3.MOD = MOD; - -/** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ -prototype$3.ADD_REM = ADD_REM; - -/** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ -prototype$3.ADD_MOD = ADD_MOD; - -/** - * Boolean flag indicating ADD, REM and MOD tuples. - */ -prototype$3.ALL = ALL; - -/** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ -prototype$3.REFLOW = REFLOW; - -/** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ -prototype$3.SOURCE = SOURCE; - -/** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ -prototype$3.NO_SOURCE = NO_SOURCE; - -/** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ -prototype$3.NO_FIELDS = NO_FIELDS; - -/** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ -prototype$3.fork = function(flags) { - return new Pulse(this.dataflow).init(this, flags); -}; - -/** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ -prototype$3.clone = function() { - const p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); -}; - -/** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ -prototype$3.addAll = function() { - let p = this; - if (!p.source || p.source.length === p.add.length) { - return p; - } else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - return p; - } -}; - -/** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ -prototype$3.init = function(src, flags) { - const p = this; - p.stamp = src.stamp; - p.encode = src.encode; - - if (src.fields && !(flags & NO_FIELDS)) { - p.fields = src.fields; - } - - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - - return p; -}; - -/** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ -prototype$3.runAfter = function(func) { - this.dataflow.runAfter(func); -}; - -/** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ -prototype$3.changed = function(flags) { - var f = flags || ALL; - return ((f & ADD) && this.add.length) - || ((f & REM) && this.rem.length) - || ((f & MOD) && this.mod.length); -}; - -/** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ -prototype$3.reflow = function(fork) { - if (fork) return this.fork(ALL).reflow(); - - var len = this.add.length, - src = this.source && this.source.length; - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); - } - return this; -}; - -/** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ -prototype$3.clean = function(value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else { - return this.cleans; - } -}; - -/** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ -prototype$3.modifies = function(_) { - var hash = this.fields || (this.fields = {}); - if (isArray(_)) { - _.forEach(f => hash[f] = true); - } else { - hash[_] = true; - } - return this; -}; - -/** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ -prototype$3.modified = function(_, nomod) { - var fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false - : !arguments.length ? !!fields - : isArray(_) ? _.some(f => fields[f]) - : fields[_]; -}; - -/** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ -prototype$3.filter = function(flags, filter) { - var p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; -}; - -function addFilter(a, b) { - return a - ? (t, i) => a(t, i) && b(t, i) - : b; -} - -/** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ -prototype$3.materialize = function(flags) { - flags = flags || ALL; - var p = this; - if ((flags & ADD) && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - if ((flags & REM) && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - if ((flags & MOD) && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - if ((flags & SOURCE) && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - return p; -}; - -function materialize(data, filter) { - var out = []; - visitArray(data, filter, _ => out.push(_)); - return out; -} - -function filter(pulse, flags) { - var map = {}; - pulse.visit(flags, function(t) { map[tupleid(t)] = 1; }); - return t => map[tupleid(t)] ? null : t; -} - -/** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ -prototype$3.visit = function(flags, visitor) { - var p = this, v = visitor, src, sum; - - if (flags & SOURCE) { - visitArray(p.source, p.srcF, v); - return p; - } - - if (flags & ADD) visitArray(p.add, p.addF, v); - if (flags & REM) visitArray(p.rem, p.remF, v); - if (flags & MOD) visitArray(p.mod, p.modF, v); - - if ((flags & REFLOW) && (src = p.source)) { - sum = p.add.length + p.mod.length; - if (sum === src.length) ; else if (sum) { - visitArray(src, filter(p, ADD_MOD), v); - } else { - // if no add/rem/mod tuples, visit source - visitArray(src, p.srcF, v); - } - } - - return p; -}; - -/** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array} pulses - The sub-pulses for this multi-pulse. - */ -function MultiPulse(dataflow, stamp, pulses, encode) { - var p = this, - c = 0, - pulse, hash, i, n, f; - - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - - for (i=0, n=pulses.length; i df._enqueue(op, true)); - df._touched = UniqueList(id); - - let count = 0, op, next, error; - - try { - while (df._heap.size() > 0) { - // dequeue operator with highest priority - op = df._heap.pop(); - - // re-queue if rank changed - if (op.rank !== op.qrank) { - df._enqueue(op, true); - continue; - } - - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - - if (next.then) { - // await if operator returns a promise directly - next = await next; - } else if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach(op => df._enqueue(op)); - } - - // increment visit counter - ++count; - } - } catch (err) { - df._heap.clear(); - error = err; - } - - // reset pulse map - df._input = {}; - df._pulse = null; - - df.debug(`Pulse ${stamp}: ${count} operators`); - - if (error) { - df._postrun = []; - df.error(error); - } - - // invoke callbacks queued via runAfter - if (df._postrun.length) { - const pr = df._postrun.sort((a, b) => b.priority - a.priority); - df._postrun = []; - for (let i=0; i df.runAsync(null, () => { - cb.forEach(f => { try { f(df); } catch (err) { df.error(err); } }); - })); - } - - return df; -} - -/** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ -async function runAsync(encode, prerun, postrun) { - // await previously queued functions - while (this._running) await this._running; - - // run dataflow, manage running promise - const clear = () => this._running = null; - (this._running = this.evaluate(encode, prerun, postrun)) - .then(clear, clear); - - return this._running; -} - -/** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ -function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) - : (this.evaluate(encode, prerun, postrun), this); -} - -/** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ -function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) { - // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - } else { - // pulse propagation already complete, invoke immediately - try { callback(this); } catch (err) { this.error(err); } - } -} - -/** - * Raise an error for re-entrant dataflow evaluation. - */ -function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; -} - -/** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ -function enqueue(op, force) { - var q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - if (q || force) { - op.qrank = op.rank; - this._heap.push(op); - } -} - -/** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ -function getPulse(op, encode) { - var s = op.source, - stamp = this._clock; - - return s && isArray(s) - ? new MultiPulse(this, stamp, s.map(_ => _.pulse), encode) - : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); -} - -function singlePulse(p, s) { - if (s && s.stamp === p.stamp) { - return s; - } - - p = p.fork(); - if (s && s !== StopPropagation) { - p.source = s.source; - } - return p; -} - -var NO_OPT = {skip: false, force: false}; - -/** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ -function touch(op, options) { - var opt = options || NO_OPT; - if (this._pulse) { - // if in midst of propagation, add to priority queue - this._enqueue(op); - } else { - // otherwise, queue for next propagation - this._touched.add(op); - } - if (opt.skip) op.skip(true); - return this; -} - -/** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ -function update(op, value, options) { - var opt = options || NO_OPT; - if (op.set(value) || opt.force) { - this.touch(op, opt); - } - return this; -} - -/** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ -function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - - var p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), - t = op.pulse && op.pulse.source || []; - - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - - return this; -} - -function Heap(cmp) { - var nodes = []; - return { - clear: () => nodes = [], - size: () => nodes.length, - peek: () => nodes[0], - push: x => { - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: () => { - var last = nodes.pop(), item; - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else { - item = last; - } - return item; - } - }; -} - -function siftdown(array, start, idx, cmp) { - var item, parent, pidx; - - item = array[idx]; - while (idx > start) { - pidx = (idx - 1) >> 1; - parent = array[pidx]; - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - break; - } - return (array[idx] = item); -} - -function siftup(array, idx, cmp) { - var start = idx, - end = array.length, - item = array[idx], - cidx = (idx << 1) + 1, ridx; - - while (cidx < end) { - ridx = cidx + 1; - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) { - cidx = ridx; - } - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - array[idx] = item; - return siftdown(array, start, idx, cmp); -} - -/** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ -function Dataflow() { - this.logger(logger()); - this.logLevel(Error$1); - - this._clock = 0; - this._rank = 0; - this._locale = defaultLocale(); - try { - this._loader = loader(); - } catch (e) { - // do nothing if loader module is unavailable - } - - this._touched = UniqueList(id); - this._input = {}; - this._pulse = null; - - this._heap = Heap((a, b) => a.qrank - b.qrank); - this._postrun = []; -} - -var prototype$5 = Dataflow.prototype; - -/** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ -prototype$5.stamp = function() { - return this._clock; -}; - -/** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ -prototype$5.loader = function(_) { - if (arguments.length) { - this._loader = _; - return this; - } else { - return this._loader; - } -}; - -/** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ -prototype$5.locale = function(_) { - if (arguments.length) { - this._locale = _; - return this; - } else { - return this._locale; - } -}; - -/** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ -prototype$5.cleanThreshold = 1e4; - -// OPERATOR REGISTRATION -prototype$5.add = add; -prototype$5.connect = connect; -prototype$5.rank = rank; -prototype$5.rerank = rerank; - -// OPERATOR UPDATES -prototype$5.pulse = pulse; -prototype$5.touch = touch; -prototype$5.update = update; -prototype$5.changeset = changeset; - -// DATA LOADING -prototype$5.ingest = ingest$1; -prototype$5.parse = parse$1; -prototype$5.preload = preload; -prototype$5.request = request; - -// EVENT HANDLING -prototype$5.events = events; -prototype$5.on = on; - -// PULSE PROPAGATION -prototype$5.evaluate = evaluate; -prototype$5.run = run; -prototype$5.runAsync = runAsync; -prototype$5.runAfter = runAfter; -prototype$5._enqueue = enqueue; -prototype$5._getPulse = getPulse; - -// LOGGING AND ERROR HANDLING - -function logMethod(method) { - return function() { - return this._log[method].apply(this, arguments); - }; -} - -/** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ -prototype$5.logger = function(logger) { - if (arguments.length) { - this._log = logger; - return this; - } else { - return this._log; - } -}; - -/** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ -prototype$5.error = logMethod('error'); - -/** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ -prototype$5.warn = logMethod('warn'); - -/** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ -prototype$5.info = logMethod('info'); - -/** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ -prototype$5.debug = logMethod('debug'); - -/** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ -prototype$5.logLevel = logMethod('level'); - -/** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ -function Transform(init, params) { - Operator.call(this, init, null, params); -} - -var prototype$6 = inherits(Transform, Operator); - -/** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ -prototype$6.run = function(pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - - var rv; - if (this.skip()) { - this.skip(false); - } else { - rv = this.evaluate(pulse); - } - rv = rv || pulse; - - if (rv.then) { - rv = rv.then(_ => this.pulse =_); - } else if (rv !== pulse.StopPropagation) { - this.pulse = rv; - } - - return rv; -}; - -/** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ -prototype$6.evaluate = function(pulse) { - var params = this.marshall(pulse.stamp), - out = this.transform(params, pulse); - params.clear(); - return out; -}; - -/** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ -prototype$6.transform = function() {}; - -var transforms = {}; - -function definition(type) { - var t = transform(type); - return t && t.Definition || null; -} - -function transform(type) { - type = type && type.toLowerCase(); - return hasOwnProperty(transforms, type) ? transforms[type] : null; -} - -function multikey(f) { - return function(x) { - var n = f.length, - i = 1, - k = String(f[0](x)); - - for (; i {}; - -const base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 -}; - -const AggregateOps = { - values: { - init: m => m.cell.store = true, - value: m => m.cell.data.values(), - idx: -1 - }, - count: { - value: m => m.cell.num - }, - __count__: { - value: m => m.missing + m.valid - }, - missing: { - value: m => m.missing - }, - valid: { - value: m => m.valid - }, - sum: { - init: m => m.sum = 0, - value: m => m.sum, - add: (m, v) => m.sum += +v, - rem: (m, v) => m.sum -= v - }, - product: { - init: m => m.product = 1, - value: m => m.valid ? m.product : undefined, - add: (m, v) => m.product *= v, - rem: (m, v) => m.product /= v - }, - mean: { - init: m => m.mean = 0, - value: m => m.valid ? m.mean : undefined, - add: (m, v) => (m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid), - rem: (m, v) => (m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean) - }, - average: { - value: m => m.valid ? m.mean : undefined, - req: ['mean'], idx: 1 - }, - variance: { - init: m => m.dev = 0, - value: m => m.valid > 1 ? m.dev / (m.valid - 1) : undefined, - add: (m, v) => m.dev += m.mean_d * (v - m.mean), - rem: (m, v) => m.dev -= m.mean_d * (v - m.mean), - req: ['mean'], idx: 1 - }, - variancep: { - value: m => m.valid > 1 ? m.dev / m.valid : undefined, - req: ['variance'], idx: 2 - }, - stdev: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined, - req: ['variance'], idx: 2 - }, - stdevp: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined, - req: ['variance'], idx: 2 - }, - stderr: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined, - req: ['variance'], idx: 2 - }, - distinct: { - value: m => m.cell.data.distinct(m.get), - req: ['values'], idx: 3 - }, - ci0: { - value: m => m.cell.data.ci0(m.get), - req: ['values'], idx: 3 - }, - ci1: { - value: m => m.cell.data.ci1(m.get), - req: ['values'], idx: 3 - }, - median: { - value: m => m.cell.data.q2(m.get), - req: ['values'], idx: 3 - }, - q1: { - value: m => m.cell.data.q1(m.get), - req: ['values'], idx: 3 - }, - q3: { - value: m => m.cell.data.q3(m.get), - req: ['values'], idx: 3 - }, - min: { - init: m => m.min = undefined, - value: m => m.min = (Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min), - add: (m, v) => { if (v < m.min || m.min === undefined) m.min = v; }, - rem: (m, v) => { if (v <= m.min) m.min = NaN; }, - req: ['values'], idx: 4 - }, - max: { - init: m => m.max = undefined, - value: m => m.max = (Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max), - add: (m, v) => { if (v > m.max || m.max === undefined) m.max = v; }, - rem: (m, v) => { if (v >= m.max) m.max = NaN; }, - req: ['values'], idx: 4 - }, - argmin: { - init: m => m.argmin = undefined, - value: m => m.argmin || m.cell.data.argmin(m.get), - add: (m, v, t) => { if (v < m.min) m.argmin = t; }, - rem: (m, v) => { if (v <= m.min) m.argmin = undefined; }, - req: ['min', 'values'], idx: 3 - }, - argmax: { - init: m => m.argmax = undefined, - value: m => m.argmax || m.cell.data.argmax(m.get), - add: (m, v, t) => { if (v > m.max) m.argmax = t; }, - rem: (m, v) => { if (v >= m.max) m.argmax = undefined; }, - req: ['max', 'values'], idx: 3 - } -}; - -const ValidAggregateOps = Object.keys(AggregateOps); - -function measure(key, value) { - return out => extend({ - name: key, - out: out || key - }, base_op, value); -} - -ValidAggregateOps.forEach(key => { - AggregateOps[key] = measure(key, AggregateOps[key]); -}); - -function createMeasure(op, name) { - return AggregateOps[op](name); -} - -function compareIndex(a, b) { - return a.idx - b.idx; -} - -function resolve(agg) { - const map = {}; - agg.forEach(a => map[a.name] = a); - - const getreqs = a => { - if (!a.req) return; - a.req.forEach(key => { - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - agg.forEach(getreqs); - - return Object.values(map).sort(compareIndex); -} - -function init() { - this.valid = 0; - this.missing = 0; - this._ops.forEach(op => op.init(this)); -} - -function add$1(v, t) { - if (v == null || v === '') { ++this.missing; return; } - if (v !== v) return; - ++this.valid; - this._ops.forEach(op => op.add(this, v, t)); -} - -function rem(v, t) { - if (v == null || v === '') { --this.missing; return; } - if (v !== v) return; - --this.valid; - this._ops.forEach(op => op.rem(this, v, t)); -} - -function set(t) { - this._out.forEach(op => t[op.out] = op.value(this)); - return t; -} - -function compileMeasures(agg, field) { - var get = field || identity, - ops = resolve(agg), - out = agg.slice().sort(compareIndex); - - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - - ctr.prototype.init = init; - ctr.prototype.add = add$1; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map(op => op.out); - - return ctr; -} - -function* numbers$1(values, valueof) { - if (valueof == null) { - for (let value of values) { - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - value = valueof(value, ++index, values); - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } -} - -function quantiles(array, p, f) { - var values = Float64Array.from(numbers$1(array, f)); - - // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - values.sort(ascending); - - return p.map(_ => quantileSorted(values, _)); -} - -function quartiles(array, f) { - return quantiles(array, [0.25, 0.50, 0.75], f); -} - -// Scott, D. W. (1992) Multivariate Density Estimation: -// Theory, Practice, and Visualization. Wiley. -function bandwidthNRD(array, f) { - var n = array.length, - v = deviation(array, f), - q = quartiles(array, f), - h = (q[2] - q[0]) / 1.34; - - v = Math.min(v, h) || v || Math.abs(q[0]) || 1; - - return 1.06 * v * Math.pow(n, -0.2); -} - -function bin(_) { - // determine range - var maxb = _.maxbins || 20, - base = _.base || 10, - logb = Math.log(base), - div = _.divide || [5, 2], - min = _.extent[0], - max = _.extent[1], - span = _.span || (max - min) || Math.abs(min) || 1, - step, level, minstep, precision, v, i, n, eps; - - if (_.step) { - // if step size is explicitly given, use that - step = _.step; - } else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - for (i=0, n=_.steps.length; i < n && _.steps[i] < v; ++i); - step = _.steps[Math.max(0, i-1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max( - minstep, - Math.pow(base, Math.round(Math.log(span) / logb) - level) - ); - - // increase step size if too many bins - while (Math.ceil(span/step) > maxb) { step *= base; } - - // decrease step size if allowed - for (i=0, n=div.length; i= minstep && span / v <= maxb) step = v; - } - } - - // update precision, min and max - v = Math.log(step); - precision = v >= 0 ? 0 : ~~(-v / logb) + 1; - eps = Math.pow(base, -precision - 1); - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; - } - - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; -} - -var random = Math.random; - -function setRandom(r) { - random = r; -} - -function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [undefined, undefined]; - - var values = Float64Array.from(numbers$1(array, f)), - n = values.length, - m = samples, - a, i, j, mu; - - for (j=0, mu=Array(m); j _); - - let i = 0, j = 1, - n = array.length, - v = new Float64Array(n), - a = f(array[0]), - b = a, - w = a + step, - x; - - for (; j= w) { - b = (a + b) / 2; - for (; i> 1); - while (d < b) v[d++] = v[b]; - while (d > b) v[d--] = v[a]; - } - - // update left stack indices - a = b; - b = c; - } - - return v; -} - -function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function() { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; -} - -function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - - var dist = {}, - a, b, d; - - dist.min = function(_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else { - return a; - } - }; - - dist.max = function(_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else { - return b; - } - }; - - dist.sample = function() { - return a + Math.floor(d * random()); - }; - - dist.pdf = function(x) { - return (x === Math.floor(x) && x >= a && x < b) ? 1 / d : 0; - }; - - dist.cdf = function(x) { - var v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }; - - dist.icdf = function(p) { - return (p >= 0 && p <= 1) ? a - 1 + Math.floor(p * d) : NaN; - }; - - return dist.min(min).max(max); -} - -const SQRT2PI = Math.sqrt(2 * Math.PI); -const SQRT2 = Math.SQRT2; - -let nextSample = NaN; - -function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - - let x = 0, y = 0, rds, c; - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = random() * 2 - 1; - y = random() * 2 - 1; - rds = x * x + y * y; - } while (rds === 0 || rds > 1); - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - x *= c; - nextSample = y * c; - } - return mean + x * stdev; -} - -function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - const z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); -} - -// Approximation from West (2009) -// Better Approximations to Cumulative Normal Functions -function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - - let cd, - z = (value - mean) / stdev, - Z = Math.abs(z); - - if (Z > 37) { - cd = 0; - } else { - let sum, exp = Math.exp(-Z * Z / 2); - if (Z < 7.07106781186547) { - sum = 3.52624965998911e-02 * Z + 0.700383064443688; - sum = sum * Z + 6.37396220353165; - sum = sum * Z + 33.912866078383; - sum = sum * Z + 112.079291497871; - sum = sum * Z + 221.213596169931; - sum = sum * Z + 220.206867912376; - cd = exp * sum; - sum = 8.83883476483184e-02 * Z + 1.75566716318264; - sum = sum * Z + 16.064177579207; - sum = sum * Z + 86.7807322029461; - sum = sum * Z + 296.564248779674; - sum = sum * Z + 637.333633378831; - sum = sum * Z + 793.826512519948; - sum = sum * Z + 440.413735824752; - cd = cd / sum; - } else { - sum = Z + 0.65; - sum = Z + 4 / sum; - sum = Z + 3 / sum; - sum = Z + 2 / sum; - sum = Z + 1 / sum; - cd = exp / sum / 2.506628274631; - } - } - return z > 0 ? 1 - cd : cd; -} - -// Approximation of Probit function using inverse error function. -function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); -} - -// Approximate inverse error function. Implementation from "Approximating -// the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. -// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 -function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - let w = - Math.log((1 - x) * (1 + x)), p; - - if (w < 6.25) { - w -= 3.125; - p = -3.6444120640178196996e-21; - p = -1.685059138182016589e-19 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -1.333171662854620906e-16 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -4.0545662729752068639e-14 + p * w; - p = -8.1519341976054721522e-14 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -1.2975133253453532498e-11 + p * w; - p = -5.4154120542946279317e-11 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -4.1126339803469836976e-09 + p * w; - p = -2.9070369957882005086e-08 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -1.3654692000834678645e-06 + p * w; - p = -1.3882523362786468719e-05 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.00074070253416626697512 + p * w; - p = -0.0060336708714301490533 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -2.7517406297064545428e-07 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -4.013867526981545969e-06 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -4.7318229009055733981e-05 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628474796 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047313 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.0037512085075692412107 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -2.7109920616438573243e-11; - p = -2.5556418169965252055e-10 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -3.7894654401267369937e-09 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -1.4960026627149240478e-08 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -6.7711997758452339498e-08 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -9.9298272942317002539e-07 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -1.9681778105531670567e-05 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477347 + p * w; - p = -0.00013871931833623122026 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else { - p = Infinity; - } - - return p * x; -} - -function randomNormal(mean, stdev) { - var mu, - sigma, - dist = { - mean: function(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: () => sampleNormal(mu, sigma), - pdf: value => densityNormal(value, mu, sigma), - cdf: value => cumulativeNormal(value, mu, sigma), - icdf: p => quantileNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); -} - -// TODO: support for additional kernels? -function randomKDE(support, bandwidth) { - var kernel = randomNormal(), - dist = {}, - n = 0; - - dist.data = function(_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else { - return support; - } - }; - - dist.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = bandwidthNRD(support); - return dist; - }; - - dist.sample = function() { - return support[~~(random() * n)] + bandwidth * kernel.sample(); - }; - - dist.pdf = function(x) { - for (var y=0, i=0; i sampleLogNormal(mu, sigma), - pdf: value => densityLogNormal(value, mu, sigma), - cdf: value => cumulativeLogNormal(value, mu, sigma), - icdf: p => quantileLogNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); -} - -function randomMixture(dists, weights) { - var dist = {}, m = 0, w; - - function normalize(x) { - var w = [], sum = 0, i; - for (i=0; i= min && value <= max) ? 1 / (max - min) : 0; -} - -function cumulativeUniform(value, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); -} - -function quantileUniform(p, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return (p >= 0 && p <= 1) ? min + p * (max - min) : NaN; -} - -function randomUniform(min, max) { - var a, b, - dist = { - min: function(_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else { - return a; - } - }, - max: function(_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else { - return b; - } - }, - sample: () => sampleUniform(a, b), - pdf: value => densityUniform(value, a, b), - cdf: value => cumulativeUniform(value, a, b), - icdf: p => quantileUniform(p, a, b) - }; - - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return dist.min(min).max(max); -} - -// Ordinary Least Squares -function ols(uX, uY, uXY, uX2) { - const delta = uX2 - uX * uX, - slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, - intercept = uY - slope * uX; - - return [intercept, slope]; -} - -function points(data, x, y, sort) { - data = data.filter(d => { - let u = x(d), v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - - if (sort) { - data.sort((a, b) => x(a) - x(b)); - } - - const n = data.length, - X = new Float64Array(n), - Y = new Float64Array(n); - - // extract values, calculate means - let i = 0, ux = 0, uy = 0, xv, yv, d; - for (d of data) { - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } - - // mean center the data - for (i=0; i= u && v != null && (v = +v) >= v) { - callback(u, v, ++i); - } - } -} - -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function rSquared(data, x, y, uY, predict) { - let SSE = 0, SST = 0; - - visitPoints(data, x, y, (dx, dy) => { - const sse = dy - predict(dx), - sst = dy - uY; - - SSE += sse * sse; - SST += sst * sst; - }); - - return 1 - SSE / SST; -} - -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function regressionLinear(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * x; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} - -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function regressionLog(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * Math.log(x); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} - -function regressionExp(data, x, y) { - // eslint-disable-next-line no-unused-vars - const [xv, yv, ux, uy] = points(data, x, y); - let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly, xy; - - visitPoints(data, x, y, (_, dy) => { - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - - const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), - predict = x => Math.exp(c0 + c1 * (x - ux)); - - return { - coef: [Math.exp(c0 - c1 * ux), c1], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} - -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function regressionPow(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, YS = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - const lx = Math.log(dx), - ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] * Math.pow(x, coef[1]); - - coef[0] = Math.exp(coef[0]); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; -} - -function regressionQuad(data, x, y) { - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length; - - let X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, - i, dx, dy, x2; - - for (i=0; i { - x = x - ux; - return a * x * x + b * x + c + uy; - }; - - // transform coefficients back from mean-centered space - return { - coef: [ - c - b * ux + a * ux * ux + uy, - b - 2 * a * ux, - a - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} - -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -// ... which was adapted from regression-js by Tom Alexander -// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 -// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE -function regressionPoly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 1) return regressionLinear(data, x, y); - if (order === 2) return regressionQuad(data, x, y); - - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length, - lhs = [], - rhs = [], - k = order + 1; - - let i, j, l, v, c; - - for (i=0; i { - x -= ux; - let y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - for (i=3; i=0; --i) { - v = a[i]; - c = 1; - z[i] += v; - for (j=1; j<=i; ++j) { - c *= (i + 1 - j) / j; // binomial coefficent - z[i-j] += v * Math.pow(x, j) * c; - } - } - - // bias term - z[0] += y; - - return z; -} - -// Given an array for a two-dimensional matrix and the polynomial order, -// solve A * x = b using Gaussian elimination. -function gaussianElimination(matrix) { - const n = matrix.length - 1, - coef = []; - - let i, j, k, r, t; - - for (i = 0; i < n; ++i) { - r = i; // max row - for (j = i + 1; j < n; ++j) { - if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { - r = j; - } - } - - for (k = i; k < n + 1; ++k) { - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - - for (j = i + 1; j < n; ++j) { - for (k = n; k >= i; k--) { - matrix[k][j] -= (matrix[k][i] * matrix[i][j]) / matrix[i][i]; - } - } - } - - for (j = n - 1; j >= 0; --j) { - t = 0; - for (k = j + 1; k < n; ++k) { - t += matrix[k][j] * coef[k]; - } - coef[j] = (matrix[n][j] - t) / matrix[j][j]; - } - - return coef; -} - -const maxiters = 2, - epsilon = 1e-12; - -// Adapted from science.js by Jason Davies -// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js -// License: https://github.com/jasondavies/science.js/blob/master/LICENSE -function regressionLoess(data, x, y, bandwidth) { - const [xv, yv, ux, uy] = points(data, x, y, true), - n = xv.length, - bw = Math.max(2, ~~(bandwidth * n)), // # nearest neighbors - yhat = new Float64Array(n), - residuals = new Float64Array(n), - robustWeights = new Float64Array(n).fill(1); - - for (let iter = -1; ++iter <= maxiters; ) { - const interval = [0, bw - 1]; - - for (let i = 0; i < n; ++i) { - const dx = xv[i], - i0 = interval[0], - i1 = interval[1], - edge = (dx - xv[i0]) > (xv[i1] - dx) ? i0 : i1; - - let W = 0, X = 0, Y = 0, XY = 0, X2 = 0, - denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - - for (let k = i0; k <= i1; ++k) { - const xk = xv[k], - yk = yv[k], - w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], - xkw = xk * w; - - W += w; - X += xkw; - Y += yk * w; - XY += yk * xkw; - X2 += xk * xkw; - } - - // linear regression fit - const [a, b] = ols(X / W, Y / W, XY / W, X2 / W); - yhat[i] = a + b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - - updateInterval(xv, i + 1, interval); - } - - if (iter === maxiters) { - break; - } - - const medianResidual = median(residuals); - if (Math.abs(medianResidual) < epsilon) break; - - for (let i = 0, arg, w; i < n; ++i){ - arg = residuals[i] / (6 * medianResidual); - // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - robustWeights[i] = (arg >= 1) ? epsilon : ((w = 1 - arg * arg) * w); - } - } - - return output(xv, yhat, ux, uy); -} - -// weighting kernel for local regression -function tricube(x) { - return (x = 1 - x * x * x) * x * x; -} - -// advance sliding window interval of nearest neighbors -function updateInterval(xv, i, interval) { - let val = xv[i], - left = interval[0], - right = interval[1] + 1; - - if (right >= xv.length) return; - - // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - while (i > left && (xv[right] - val) <= (val - xv[left])) { - interval[0] = ++left; - interval[1] = right; - ++right; - } -} - -// generate smoothed output points -// average points with repeated x values -function output(xv, yhat, ux, uy) { - const n = xv.length, out = []; - let i = 0, cnt = 0, prev = [], v; - - for (; i [x, f(x)], - minX = extent[0], - maxX = extent[1], - span = maxX - minX, - stop = span / maxSteps, - prev = [point(minX)], - next = []; - - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for (let i = 1; i < maxSteps; ++i) { - prev.push(point(minX + (i / minSteps) * span)); - } - prev.push(point(maxX)); - return prev; - } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - for (let i = minSteps; --i > 0;) { - next.push(point(minX + (i / minSteps) * span)); - } - } - - let p0 = prev[0], - p1 = next[next.length - 1]; - - while (p1) { - // midpoint for potential curve subdivision - const pm = point((p0[0] + p1[0]) / 2); - - if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) { - // maximum resolution has not yet been met, and - // subdivision midpoint sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - } else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - p1 = next[next.length - 1]; - } - - return prev; -} - -function angleDelta(p, q, r) { - const a0 = Math.atan2(r[1] - p[1], r[0] - p[0]), - a1 = Math.atan2(q[1] - p[1], q[0] - p[0]); - return Math.abs(a0 - a1); -} - -function TupleStore(key) { - this._key = key ? field(key) : tupleid; - this.reset(); -} - -var prototype$7 = TupleStore.prototype; - -prototype$7.reset = function() { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; -}; - -prototype$7.add = function(v) { - this._add.push(v); -}; - -prototype$7.rem = function(v) { - this._rem.push(v); -}; - -prototype$7.values = function() { - this._get = null; - if (this._rem.length === 0) return this._add; - - var a = this._add, - r = this._rem, - k = this._key, - n = a.length, - m = r.length, - x = Array(n - m), - map = {}, i, j, v; - - // use unique key field to clear removed values - for (i=0; i= 0) { - s = get(v[n]) + ''; - if (!hasOwnProperty(map, s)) { - map[s] = 1; - ++count; - } - } - - return count; -}; - -prototype$7.extent = function(get) { - if (this._get !== get || !this._ext) { - var v = this.values(), - i = extentIndex(v, get); - this._ext = [v[i[0]], v[i[1]]]; - this._get = get; - } - return this._ext; -}; - -prototype$7.argmin = function(get) { - return this.extent(get)[0] || {}; -}; - -prototype$7.argmax = function(get) { - return this.extent(get)[1] || {}; -}; - -prototype$7.min = function(get) { - var m = this.extent(get)[0]; - return m != null ? get(m) : undefined; -}; - -prototype$7.max = function(get) { - var m = this.extent(get)[1]; - return m != null ? get(m) : undefined; -}; - -prototype$7.quartile = function(get) { - if (this._get !== get || !this._q) { - this._q = quartiles(this.values(), get); - this._get = get; - } - return this._q; -}; - -prototype$7.q1 = function(get) { - return this.quartile(get)[0]; -}; - -prototype$7.q2 = function(get) { - return this.quartile(get)[1]; -}; - -prototype$7.q3 = function(get) { - return this.quartile(get)[2]; -}; - -prototype$7.ci = function(get) { - if (this._get !== get || !this._ci) { - this._ci = bootstrapCI(this.values(), 1000, 0.05, get); - this._get = get; - } - return this._ci; -}; - -prototype$7.ci0 = function(get) { - return this.ci(get)[0]; -}; - -prototype$7.ci1 = function(get) { - return this.ci(get)[1]; -}; - -/** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.fields] - An array of accessors to aggregate. - * @param {Array} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ -function Aggregate(params) { - Transform.call(this, null, params); - - this._adds = []; // array of added output tuples - this._mods = []; // array of modified output tuples - this._alen = 0; // number of active added tuples - this._mlen = 0; // number of active modified tuples - this._drop = true; // should empty aggregation cells be removed - this._cross = false; // produce full cross-product of group-by values - - this._dims = []; // group-by dimension accessors - this._dnames = []; // group-by dimension names - - this._measures = []; // collection of aggregation monoids - this._countOnly = false; // flag indicating only count aggregation - this._counts = null; // collection of count fields - this._prev = null; // previous aggregation cells - - this._inputs = null; // array of dependent input tuple field names - this._outputs = null; // array of output tuple field names -} - -Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidAggregateOps }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'drop', 'type': 'boolean', 'default': true }, - { 'name': 'cross', 'type': 'boolean', 'default': false }, - { 'name': 'key', 'type': 'field' } - ] -}; - -var prototype$8 = inherits(Aggregate, Transform); - -prototype$8.transform = function(_, pulse) { - var aggr = this, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - mod = _.modified(); - - aggr.stamp = out.stamp; - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, t => aggr.add(t)); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, t => aggr.rem(t)); - pulse.visit(pulse.ADD, t => aggr.add(t)); - } - - // Indicate output fields and return aggregate tuples. - out.modifies(aggr._outputs); - - // Should empty cells be dropped? - aggr._drop = _.drop !== false; - - // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - - if (pulse.clean() && aggr._drop) { - out.clean(true).runAfter(() => this.clean()); - } - - return aggr.changes(out); -}; - -prototype$8.cross = function() { - var aggr = this, - curr = aggr.value, - dims = aggr._dnames, - vals = dims.map(function() { return {}; }), - n = dims.length; - - // collect all group-by domain values - function collect(cells) { - var key, i, t, v; - for (key in cells) { - t = cells[key].tuple; - for (i=0; i stop ? +Infinity - : ( - v = Math.max(start, Math.min(v, stop - step)), - start + step * Math.floor(EPSILON + (v - start) / step) - ); - }; - - f.start = start; - f.stop = bins.stop; - f.step = step; - - return this.value = accessor( - f, - accessorFields(field), - _.name || 'bin_' + accessorName(field) - ); -}; - -function SortedList(idFunc, source, input) { - var $ = idFunc, - data = source || [], - add = input || [], - rem = {}, - cnt = 0; - - return { - add: function(t) { add.push(t); }, - remove: function(t) { rem[$(t)] = ++cnt; }, - size: function() { return data.length; }, - data: function(compare, resort) { - if (cnt) { - data = data.filter(function(t) { return !rem[$(t)]; }); - rem = {}; - cnt = 0; - } - if (resort && compare) { - data.sort(compare); - } - if (add.length) { - data = compare - ? merge(compare, data, add.sort(compare)) - : data.concat(add); - add = []; - } - return data; - } - }; -} - -/** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ -function Collect(params) { - Transform.call(this, [], params); -} - -Collect.Definition = { - 'type': 'Collect', - 'metadata': {'source': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' } - ] -}; - -var prototype$a = inherits(Collect, Transform); - -prototype$a.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), - sort = _.sort, - mod = pulse.changed() || (sort && - (_.modified('sort') || pulse.modified(sort.fields))); - - out.visit(out.REM, list.remove); - - this.modified(mod); - this.value = out.source = list.data(stableCompare(sort), mod); - - // propagate tree root if defined - if (pulse.source && pulse.source.root) { - this.value.root = pulse.source.root; - } - - return out; -}; - -/** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The fields to compare. - * @param {Array} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ -function Compare(params) { - Operator.call(this, null, update$1, params); -} - -inherits(Compare, Operator); - -function update$1(_) { - return (this.value && !_.modified()) - ? this.value - : compare(_.fields, _.orders); -} - -/** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ -function CountPattern(params) { - Transform.call(this, null, params); -} - -CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'case', 'type': 'enum', 'values': ['upper', 'lower', 'mixed'], 'default': 'mixed' }, - { 'name': 'pattern', 'type': 'string', 'default': '[\\w"]+' }, - { 'name': 'stopwords', 'type': 'string', 'default': '' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['text', 'count'] } - ] -}; - -function tokenize(text, tcase, match) { - switch (tcase) { - case 'upper': text = text.toUpperCase(); break; - case 'lower': text = text.toLowerCase(); break; - } - return text.match(match); -} - -var prototype$b = inherits(CountPattern, Transform); - -prototype$b.transform = function(_, pulse) { - function process(update) { - return function(tuple) { - var tokens = tokenize(get(tuple), _.case, match) || [], t; - for (var i=0, n=tokens.length; i} [params.as] - The names of the output fields. - */ -function Cross(params) { - Transform.call(this, null, params); -} - -Cross.Definition = { - 'type': 'Cross', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'filter', 'type': 'expr' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['a', 'b'] } - ] -}; - -var prototype$c = inherits(Cross, Transform); - -prototype$c.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - data = this.value, - as = _.as || ['a', 'b'], - a = as[0], b = as[1], - reset = !data - || pulse.changed(pulse.ADD_REM) - || _.modified('as') - || _.modified('filter'); - - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || truthy); - } else { - out.mod = data; - } - - out.source = this.value; - return out.modifies(as); -}; - -function cross(input, a, b, filter) { - var data = [], - t = {}, - n = input.length, - i = 0, - j, left; - - for (; i} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ -function parse$2(def, data) { - var func = def[FUNCTION]; - if (!hasOwnProperty(Distributions, func)) { - error('Unknown distribution function: ' + func); - } - - var d = Distributions[func](); - - for (var name in def) { - // if data field, extract values - if (name === FIELD) { - d.data((def.from || data()).map(def[name])); - } - - // if distribution mixture, recurse to parse each definition - else if (name === DISTRIBUTIONS) { - d[name](def[name].map(function(_) { return parse$2(_, data); })); - } - - // otherwise, simply set the parameter - else if (typeof d[name] === FUNCTION) { - d[name](def[name]); - } - } - - return d; -} - -/** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ -function Density(params) { - Transform.call(this, null, params); -} - -var distributions = [ - { - 'key': {'function': 'normal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'lognormal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'uniform'}, - 'params': [ - { 'name': 'min', 'type': 'number', 'default': 0 }, - { 'name': 'max', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'kde'}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'from', 'type': 'data' }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 } - ] - } -]; - -var mixture = { - 'key': {'function': 'mixture'}, - 'params': [ - { 'name': 'distributions', 'type': 'param', 'array': true, - 'params': distributions }, - { 'name': 'weights', 'type': 'number', 'array': true } - ] -}; - -Density.Definition = { - 'type': 'Density', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'method', 'type': 'string', 'default': 'pdf', - 'values': ['pdf', 'cdf'] }, - { 'name': 'distribution', 'type': 'param', - 'params': distributions.concat(mixture) }, - { 'name': 'as', 'type': 'string', 'array': true, - 'default': ['value', 'density'] } - ] -}; - -var prototype$d = inherits(Density, Transform); - -prototype$d.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var dist = parse$2(_.distribution, source(pulse)), - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200, - method = _.method || 'pdf'; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - if (!_.extent && !dist.data) { - error('Missing density extent parameter.'); - } - method = dist[method]; - - var as = _.as || ['value', 'density'], - domain = _.extent || extent(dist.data()), - values = sampleCurve(method, domain, minsteps, maxsteps).map(v => { - var tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return ingest(tuple); - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; -}; - -function source(pulse) { - return function() { return pulse.materialize(pulse.SOURCE).source; }; -} - -// use either provided alias or accessor field name -function fieldNames(fields, as) { - if (!fields) return null; - return fields.map(function(f, i) { - return as[i] || accessorName(f); - }); -} - -function partition(data, groupby, field) { - var groups = [], - get = function(f) { return f(t); }, - map, i, n, t, k, g; - - // partition data points into groups - if (groupby == null) { - groups.push(data.map(field)); - } else { - for (map={}, i=0, n=data.length; i} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ -function DotBin(params) { - Transform.call(this, null, params); -} - -DotBin.Definition = { - 'type': 'DotBin', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'step', 'type': 'number' }, - { 'name': 'smooth', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': Output } - ] -}; - -const prototype$e = inherits(DotBin, Transform); - -prototype$e.transform = function(_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) { - return pulse; // early exit - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(pulse.source, _.groupby, identity), - smooth = _.smooth || false, - field = _.field, - step = _.step || autostep(source, field), - sort = stableCompare((a, b) => field(a) - field(b)), - as = _.as || Output, - n = groups.length; - - // compute dotplot bins per group - let min = Infinity, max = -Infinity, i = 0, j; - for (; i max) max = v; - g[++j][as] = v; - } - } - - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); -}; - -function autostep(data, field) { - return span(extent(data, field)) / 30; -} - -/** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ -function Expression(params) { - Operator.call(this, null, update$2, params); - this.modified(true); -} - -inherits(Expression, Operator); - -function update$2(_) { - var expr = _.expr; - return this.value && !_.modified('expr') - ? this.value - : accessor( - datum => expr(datum, _), - accessorFields(expr), - accessorName(expr) - ); -} - -/** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ -function Extent(params) { - Transform.call(this, [undefined, undefined], params); -} - -Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true } - ] -}; - -var prototype$f = inherits(Extent, Transform); - -prototype$f.transform = function(_, pulse) { - var extent = this.value, - field = _.field, - min = extent[0], - max = extent[1], - mod; - - mod = pulse.changed() - || pulse.modified(field.fields) - || _.modified('field'); - - if (mod || min == null) { - min = +Infinity; - max = -Infinity; - } - - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, function(t) { - var v = toNumber(field(t)); - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - - if (!Number.isFinite(min) || !Number.isFinite(max)) { - let name = accessorName(field); - if (name) name = ` for field "${name}"`; - pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`); - min = max = undefined; - } - this.value = [min, max]; -}; - -/** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ -function Subflow(pulse, parent) { - Operator.call(this, pulse); - this.parent = parent; - this.count = 0; -} - -var prototype$g = inherits(Subflow, Operator); - -/** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ -prototype$g.connect = function(target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return (target.source = this); -}; - -/** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ -prototype$g.add = function(t) { - this.count += 1; - this.value.add.push(t); -}; - -/** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ -prototype$g.rem = function(t) { - this.count -= 1; - this.value.rem.push(t); -}; - -/** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ -prototype$g.mod = function(t) { - this.value.mod.push(t); -}; - -/** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ -prototype$g.init = function(pulse) { - this.value.init(pulse, pulse.NO_SOURCE); -}; - -/** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ -prototype$g.evaluate = function() { - // assert: this.value.stamp === pulse.stamp - return this.value; -}; - -/** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ -function Facet(params) { - Transform.call(this, {}, params); - this._keys = fastmap(); // cache previously calculated key values - - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - const a = this._targets = []; - a.active = 0; - a.forEach = f => { - for (let i=0, n=a.active; i this.subflow(key, flow, pulse); - - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - - pulse.visit(pulse.REM, t => { - const id = tupleid(t), - k = cache.get(id); - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - - pulse.visit(pulse.ADD, t => { - const k = key(t); - cache.set(tupleid(t), k); - subflow(k).add(t); - }); - - if (rekey || pulse.modified(key.fields)) { - pulse.visit(pulse.MOD, t => { - const id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 === k1) { - subflow(k1).mod(t); - } else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } else if (pulse.changed(pulse.MOD)) { - pulse.visit(pulse.MOD, t => { - subflow(cache.get(tupleid(t))).mod(t); - }); - } - - if (rekey) { - pulse.visit(pulse.REFLOW, t => { - const id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } - - if (pulse.clean()) { - df.runAfter(() => { this.clean(); cache.clean(); }); - } else if (cache.empty > df.cleanThreshold) { - df.runAfter(cache.clean); - } - - return pulse; -}; - -/** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ -function Field(params) { - Operator.call(this, null, update$3, params); -} - -inherits(Field, Operator); - -function update$3(_) { - return (this.value && !_.modified()) ? this.value - : isArray(_.name) ? array(_.name).map(function(f) { return field(f); }) - : field(_.name, _.as); -} - -/** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ -function Filter(params) { - Transform.call(this, fastmap(), params); -} - -Filter.Definition = { - 'type': 'Filter', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'expr', 'type': 'expr', 'required': true } - ] -}; - -var prototype$i = inherits(Filter, Transform); - -prototype$i.transform = function(_, pulse) { - var df = pulse.dataflow, - cache = this.value, // cache ids of filtered tuples - output = pulse.fork(), - add = output.add, - rem = output.rem, - mod = output.mod, - test = _.expr, - isMod = true; - - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - if (!cache.has(id)) rem.push(t); - else cache.delete(id); - }); - - pulse.visit(pulse.ADD, function(t) { - if (test(t, _)) add.push(t); - else cache.set(tupleid(t), 1); - }); - - function revisit(t) { - var id = tupleid(t), - b = test(t, _), - s = cache.get(id); - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) { - mod.push(t); - } - } - - pulse.visit(pulse.MOD, revisit); - - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; -}; - -/** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ -function Flatten(params) { - Transform.call(this, [], params); -} - -Flatten.Definition = { - 'type': 'Flatten', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'index', 'type': 'string' }, - { 'name': 'as', 'type': 'string', 'array': true } - ] -}; - -var prototype$j = inherits(Flatten, Transform); - -prototype$j.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - as = fieldNames(fields, _.as || []), - index = _.index || null, - m = as.length; - - // remove any previous results - out.rem = this.value; - - // generate flattened tuples - pulse.visit(pulse.SOURCE, function(t) { - var arrays = fields.map(f => f(t)), - maxlen = arrays.reduce((l, a) => Math.max(l, a.length), 0), - i = 0, j, d, v; - - for (; i} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ -function Fold(params) { - Transform.call(this, [], params); -} - -Fold.Definition = { - 'type': 'Fold', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['key', 'value'] } - ] -}; - -var prototype$k = inherits(Fold, Transform); - -prototype$k.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - fnames = fields.map(accessorName), - as = _.as || ['key', 'value'], - k = as[0], - v = as[1], - n = fields.length; - - out.rem = this.value; - - pulse.visit(pulse.SOURCE, function(t) { - for (var i=0, d; i t[as] = func(t, _)); -}; - -/** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ -function Generate(params) { - Transform.call(this, [], params); -} - -var prototype$m = inherits(Generate, Transform); - -prototype$m.transform = function(_, pulse) { - var data = this.value, - out = pulse.fork(pulse.ALL), - num = _.size - data.length, - gen = _.generator, - add, rem, t; - - if (num > 0) { - // need more tuples, generate and add - for (add=[]; --num >= 0;) { - add.push(t = ingest(gen(_))); - data.push(t); - } - out.add = out.add.length - ? out.materialize(out.ADD).add.concat(add) - : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length - ? out.materialize(out.REM).rem.concat(rem) - : rem; - data = data.slice(-num); - } - - out.source = this.value = data; - return out; -}; - -var Methods = { - value: 'value', - median: median, - mean: mean, - min: min, - max: max -}; - -var Empty = []; - -/** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ -function Impute(params) { - Transform.call(this, [], params); -} - -Impute.Definition = { - 'type': 'Impute', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'key', 'type': 'field', 'required': true }, - { 'name': 'keyvals', 'array': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'enum', 'default': 'value', - 'values': ['value', 'mean', 'median', 'max', 'min'] }, - { 'name': 'value', 'default': 0 } - ] -}; - -var prototype$n = inherits(Impute, Transform); - -function getValue(_) { - var m = _.method || Methods.value, v; - - if (Methods[m] == null) { - error('Unrecognized imputation method: ' + m); - } else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return function() { return v; }; - } else { - return Methods[m]; - } -} - -function getField(_) { - var f = _.field; - return function(t) { return t ? f(t) : NaN; }; -} - -prototype$n.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - impute = getValue(_), - field = getField(_), - fName = accessorName(_.field), - kName = accessorName(_.key), - gNames = (_.groupby || []).map(accessorName), - groups = partition$1(pulse.source, _.groupby, _.key, _.keyvals), - curr = [], - prev = this.value, - m = groups.domain.length, - group, value, gVals, kVal, g, i, j, l, n, t; - - for (g=0, l=groups.length; g} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ -function KDE(params) { - Transform.call(this, null, params); -} - -KDE.Definition = { - 'type': 'KDE', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'cumulative', 'type': 'boolean', 'default': false }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['value', 'density'] } - ] -}; - -var prototype$p = inherits(KDE, Transform); - -prototype$p.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - bandwidth = _.bandwidth, - method = _.cumulative ? 'cdf' : 'pdf', - as = _.as || ['value', 'density'], - values = []; - - let domain = _.extent, - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - - if (_.resolve === 'shared') { - if (!domain) domain = extent(source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - - groups.forEach(g => { - const density = randomKDE(g, bandwidth)[method], - scale = _.counts ? g.length : 1, - local = domain || extent(g); - - sampleCurve(density, local, minsteps, maxsteps).forEach(v => { - const t = {}; - for (let i=0; i} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ -function Key(params) { - Operator.call(this, null, update$4, params); -} - -inherits(Key, Operator); - -function update$4(_) { - return (this.value && !_.modified()) ? this.value : key(_.fields, _.flat); -} - -/** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ -function Load(params) { - Transform.call(this, [], params); - this._pending = null; -} - -var prototype$q = inherits(Load, Transform); - -prototype$q.transform = function(_, pulse) { - const df = pulse.dataflow; - - if (this._pending) { - // update state and return pulse - return output$1(this, pulse, this._pending); - } - - if (stop(_)) return pulse.StopPropagation; - - if (_.values) { - // parse and ingest values, return output pulse - return output$1(this, pulse, df.parse(_.values, _.format)); - } else if (_.async) { - // return promise for non-blocking async loading - const p = df.request(_.url, _.format).then(res => { - this._pending = array(res.data); - return df => df.touch(this); - }); - return {async: p}; - } else { - // return promise for synchronous loading - return df.request(_.url, _.format) - .then(res => output$1(this, pulse, array(res.data))); - } -}; - -function stop(_) { - return _.modified('async') && !( - _.modified('values') || _.modified('url') || _.modified('format') - ); -} - -function output$1(op, pulse, data) { - data.forEach(ingest); - const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; -} - -/** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ -function Lookup(params) { - Transform.call(this, {}, params); -} - -Lookup.Definition = { - 'type': 'Lookup', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'index', 'type': 'index', 'params': [ - {'name': 'from', 'type': 'data', 'required': true }, - {'name': 'key', 'type': 'field', 'required': true } - ] }, - { 'name': 'values', 'type': 'field', 'array': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true }, - { 'name': 'default', 'default': null } - ] -}; - -var prototype$r = inherits(Lookup, Transform); - -prototype$r.transform = function(_, pulse) { - var out = pulse, - as = _.as, - keys = _.fields, - index = _.index, - values = _.values, - defaultValue = _.default==null ? null : _.default, - reset = _.modified(), - flag = reset ? pulse.SOURCE : pulse.ADD, - n = keys.length, - set, m, mods; - - if (values) { - m = values.length; - - if (n > 1 && !as) { - error('Multi-field lookup requires explicit "as" parameter.'); - } - if (as && as.length !== n * m) { - error('The "as" parameter has too few output field names.'); - } - as = as || values.map(accessorName); - - set = function(t) { - for (var i=0, k=0, j, v; i>} params.extents - The input extents. - */ -function MultiExtent(params) { - Operator.call(this, null, update$5, params); -} - -inherits(MultiExtent, Operator); - -function update$5(_) { - if (this.value && !_.modified()) { - return this.value; - } - - var min = +Infinity, - max = -Infinity, - ext = _.extents, - i, n, e; - - for (i=0, n=ext.length; i max) max = e[1]; - } - return [min, max]; -} - -/** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.values - The input value arrrays. - */ -function MultiValues(params) { - Operator.call(this, null, update$6, params); -} - -inherits(MultiValues, Operator); - -function update$6(_) { - return (this.value && !_.modified()) - ? this.value - : _.values.reduce(function(data, _) { return data.concat(_); }, []); -} - -/** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ -function Params(params) { - Transform.call(this, null, params); -} - -inherits(Params, Transform); - -Params.prototype.transform = function(_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples -}; - -/** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ -function Pivot(params) { - Aggregate.call(this, params); -} - -Pivot.Definition = { - 'type': 'Pivot', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'value', 'type': 'field', 'required': true }, - { 'name': 'op', 'type': 'enum', 'values': ValidAggregateOps, 'default': 'sum' }, - { 'name': 'limit', 'type': 'number', 'default': 0 }, - { 'name': 'key', 'type': 'field' } - ] -}; - -var prototype$s = inherits(Pivot, Aggregate); - -prototype$s._transform = prototype$s.transform; - -prototype$s.transform = function(_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); -}; - -// Shoehorn a pivot transform into an aggregate transform! -// First collect all unique pivot field values. -// Then generate aggregate fields for each output pivot field. -function aggregateParams(_, pulse) { - var key = _.field, - value = _.value, - op = (_.op === 'count' ? '__count__' : _.op) || 'sum', - fields = accessorFields(key).concat(accessorFields(value)), - keys = pivotKeys(key, _.limit || 0, pulse); - - // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - if (pulse.changed()) _.set('__pivot__', null, null, true); - - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(function() { return op; }), - fields: keys.map(function(k) { return get(k, key, value, fields); }), - as: keys.map(function(k) { return k + ''; }), - modified: _.modified.bind(_) - }; -} - -// Generate aggregate field accessor. -// Output NaN for non-existent values; aggregator will ignore! -function get(k, key, value, fields) { - return accessor( - function(d) { return key(d) === k ? value(d) : NaN; }, - fields, - k + '' - ); -} - -// Collect (and optionally limit) all unique pivot values. -function pivotKeys(key, limit, pulse) { - var map = {}, - list = []; - - pulse.visit(pulse.SOURCE, function(t) { - var k = key(t); - if (!map[k]) { - map[k] = 1; - list.push(k); - } - }); - - // TODO? Move this comparator to vega-util? - list.sort(function(u, v) { - return (uv||v==null) && u!=null ? 1 - : ((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))!==u && v===v ? -1 - : v!==v && u===u ? 1 : 0; - }); - - return limit ? list.slice(0, limit) : list; -} - -/** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array} params.field - The field - * accessor for an array of subflow tuple objects. - */ -function PreFacet(params) { - Facet.call(this, params); -} - -const prototype$t = inherits(PreFacet, Facet); - -prototype$t.transform = function(_, pulse) { - const flow = _.subflow, - field = _.field, - subflow = t => this.subflow(tupleid(t), flow, pulse, t); - - if (_.modified('field') || field && pulse.modified(accessorFields(field))) { - error('PreFacet does not support field modification.'); - } - - this.initTargets(); // reset list of active subflows - - if (field) { - pulse.visit(pulse.MOD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.mod(_)); - }); - - pulse.visit(pulse.ADD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.add(ingest(_))); - }); - - pulse.visit(pulse.REM, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.rem(_)); - }); - } else { - pulse.visit(pulse.MOD, t => subflow(t).mod(t)); - pulse.visit(pulse.ADD, t => subflow(t).add(t)); - pulse.visit(pulse.REM, t => subflow(t).rem(t)); - } - - if (pulse.clean()) { - pulse.runAfter(() => this.clean()); - } - - return pulse; -}; - -/** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ -function Project(params) { - Transform.call(this, null, params); -} - -Project.Definition = { - 'type': 'Project', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true } - ] -}; - -var prototype$u = inherits(Project, Transform); - -prototype$u.transform = function(_, pulse) { - var fields = _.fields, - as = fieldNames(_.fields, _.as || []), - derive = fields - ? function(s, t) { return project(s, t, fields, as); } - : rederive, - out, lut; - - if (this.value) { - lut = this.value; - } else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - - out = pulse.fork(pulse.NO_SOURCE); - - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, function(t) { - var dt = derive(t, ingest({})); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, function(t) { - out.mod.push(derive(t, lut[tupleid(t)])); - }); - - return out; -}; - -function project(s, t, fields, as) { - for (var i=0, n=fields.length; i} [params.groupby] - An array of accessors - * to groupby. - * @param {Array} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ -function Quantile(params) { - Transform.call(this, null, params); -} - -Quantile.Definition = { - 'type': 'Quantile', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'probs', 'type': 'number', 'array': true }, - { 'name': 'step', 'type': 'number', 'default': 0.01 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['prob', 'value'] } - ] -}; - -var prototype$w = inherits(Quantile, Transform); - -var EPSILON$1 = 1e-14; - -prototype$w.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - as = _.as || ['prob', 'value']; - - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - values = [], - step = _.step || 0.01, - p = _.probs || sequence(step/2, 1 - EPSILON$1, step), - n = p.length; - - groups.forEach(g => { - const q = quantiles(g, p); - - for (let i=0; i { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, t => { - var dt = derive(t); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, t => { - var dt = lut[tupleid(t)], k; - for (k in t) { - dt[k] = t[k]; - // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - out.modifies(k); - } - out.mod.push(dt); - }); - } - - return out; -}; - -/** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ -function Sample(params) { - Transform.call(this, [], params); - this.count = 0; -} - -Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [ - { 'name': 'size', 'type': 'number', 'default': 1000 } - ] -}; - -var prototype$y = inherits(Sample, Transform); - -prototype$y.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - mod = _.modified('size'), - num = _.size, - res = this.value, - cnt = this.count, - cap = 0, - map = res.reduce(function(m, t) { - m[tupleid(t)] = 1; - return m; - }, {}); - - // sample reservoir update function - function update(t) { - var p, idx; - - if (res.length < num) { - res.push(t); - } else { - idx = ~~((cnt + 1) * random()); - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[tupleid(p)]) out.rem.push(p); // eviction - res[idx] = t; - } - } - ++cnt; - } - - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - --cnt; - }); - - // filter removed tuples out of the sample reservoir - res = res.filter(function(t) { return map[tupleid(t)] !== -1; }); - } - - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, function(t) { - // update, but skip previously sampled tuples - if (!map[tupleid(t)]) update(t); - }); - cap = -1; - } - - if (mod && res.length > num) { - for (var i=0, n=res.length-num; i max) max = b; - } - }); - - floor.start = min; - floor.stop = max; - - return pulse.modifies(band ? as : u0); -}; - -prototype$B._floor = function(_, pulse) { - const utc = _.timezone === 'utc'; - - // get parameters - let {units, step} = _.units - ? {units: _.units, step: _.step || 1} - : timeBin({ - extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }); - - // check / standardize time units - units = timeUnits(units); - - const prev = this.value || {}, - floor = (utc ? utcFloor : timeFloor)(units, step); - - floor.unit = peek(units); - floor.units = units; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; -}; - -/** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ -function TupleIndex(params) { - Transform.call(this, fastmap(), params); -} - -var prototype$C = inherits(TupleIndex, Transform); - -prototype$C.transform = function(_, pulse) { - var df = pulse.dataflow, - field = _.field, - index = this.value, - mod = true; - - function set(t) { index.set(field(t), t); } - - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, function(t) { index.delete(field(t)); }); - pulse.visit(pulse.ADD, set); - } else { - mod = false; - } - - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); -}; - -/** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ -function Values(params) { - Transform.call(this, null, params); -} - -var prototype$D = inherits(Values, Transform); - -prototype$D.transform = function(_, pulse) { - var run = !this.value - || _.modified('field') - || _.modified('sort') - || pulse.changed() - || (_.sort && pulse.modified(_.sort.fields)); - - if (run) { - this.value = (_.sort - ? pulse.source.slice().sort(stableCompare(_.sort)) - : pulse.source).map(_.field); - } -}; - -function WindowOp(op, field, param, as) { - let fn = WindowOps[op](field, param); - return { - init: fn.init || zero, - update: function(w, t) { t[as] = fn.next(w); } - }; -} - -const WindowOps = { - row_number: function() { - return { - next: w => w.index + 1 - }; - }, - rank: function() { - let rank; - return { - init: () => rank = 1, - next: w => { - let i = w.index, - data = w.data; - return (i && w.compare(data[i - 1], data[i])) ? (rank = i + 1) : rank; - } - }; - }, - dense_rank: function() { - let drank; - return { - init: () => drank = 1, - next: w => { - let i = w.index, - d = w.data; - return (i && w.compare(d[i - 1], d[i])) ? ++drank : drank; - } - }; - }, - percent_rank: function() { - let rank = WindowOps.rank(), - next = rank.next; - return { - init: rank.init, - next: w => (next(w) - 1) / (w.data.length - 1) - }; - }, - cume_dist: function() { - let cume; - return { - init: () => cume = 0, - next: w => { - let i = w.index, - d = w.data, - c = w.compare; - if (cume < i) { - while (i + 1 < d.length && !c(d[i], d[i + 1])) ++i; - cume = i; - } - return (1 + cume) / d.length; - } - }; - }, - ntile: function(field, num) { - num = +num; - if (!(num > 0)) error('ntile num must be greater than zero.'); - let cume = WindowOps.cume_dist(), - next = cume.next; - return { - init: cume.init, - next: w => Math.ceil(num * next(w)) - }; - }, - - lag: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index + offset, - d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - - first_value: function(field) { - return { - next: w => field(w.data[w.i0]) - }; - }, - last_value: function(field) { - return { - next: w => field(w.data[w.i1 - 1]) - }; - }, - nth_value: function(field, nth) { - nth = +nth; - if (!(nth > 0)) error('nth_value nth must be greater than zero.'); - return { - next: w => { - let i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - - prev_value: function(field) { - let prev; - return { - init: () => prev = null, - next: w => { - let v = field(w.data[w.index]); - return v != null ? (prev = v) : prev; - } - }; - }, - next_value: function(field) { - let v, i; - return { - init: () => (v = null, i = -1), - next: w => { - let d = w.data; - return w.index <= i ? v - : (i = find(field, d, w.index)) < 0 - ? (i = d.length, v = null) - : (v = field(d[i])); - } - }; - } -}; - -function find(field, data, index) { - for (let n = data.length; index < n; ++index) { - let v = field(data[index]); - if (v != null) return index; - } - return -1; -} - -var ValidWindowOps = Object.keys(WindowOps); - -function WindowState(_) { - let self = this, - ops = array(_.ops), - fields = array(_.fields), - params = array(_.params), - as = array(_.as), - outputs = self.outputs = [], - windows = self.windows = [], - inputs = {}, - map = {}, - countOnly = true, - counts = [], - measures = []; - - function visitInputs(f) { - array(accessorFields(f)).forEach(_ => inputs[_] = 1); - } - visitInputs(_.sort); - - ops.forEach(function(op, i) { - let field = fields[i], - mname = accessorName(field), - name = measureName(op, mname, as[i]); - - visitInputs(field); - outputs.push(name); - - // Window operation - if (hasOwnProperty(WindowOps, op)) { - windows.push(WindowOp(op, fields[i], params[i], name)); - } - - // Aggregate operation - else { - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - if (op === 'count') { - counts.push(name); - return; - } - - countOnly = false; - let m = map[mname]; - if (!m) { - m = (map[mname] = []); - m.field = field; - measures.push(m); - } - m.push(createMeasure(op, name)); - } - }); - - if (counts.length || measures.length) { - self.cell = cell(measures, counts, countOnly); - } - - self.inputs = Object.keys(inputs); -} - -const prototype$E = WindowState.prototype; - -prototype$E.init = function() { - this.windows.forEach(_ => _.init()); - if (this.cell) this.cell.init(); -}; - -prototype$E.update = function(w, t) { - let self = this, - cell = self.cell, - wind = self.windows, - data = w.data, - m = wind && wind.length, - j; - - if (cell) { - for (j=w.p0; j compileMeasures(m, m.field)); - - let cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - - if (!countOnly) { - var n = measures.length, - a = cell.agg = Array(n), - i = 0; - for (; i} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array} params.ops - An array of strings indicating window operations to perform. - * @param {Array} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array} [params.as] - An array of output field names for window operations. - * @param {Array} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ -function Window(params) { - Transform.call(this, {}, params); - this._mlen = 0; - this._mods = []; -} - -Window.Definition = { - 'type': 'Window', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidWindowOps.concat(ValidAggregateOps) }, - { 'name': 'params', 'type': 'number', 'null': true, 'array': true }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'frame', 'type': 'number', 'null': true, 'array': true, 'length': 2, 'default': [null, 0] }, - { 'name': 'ignorePeers', 'type': 'boolean', 'default': false } - ] -}; - -var prototype$F = inherits(Window, Transform); - -prototype$F.transform = function(_, pulse) { - var self = this, - state = self.state, - mod = _.modified(), - cmp = stableCompare(_.sort), - i, n; - - this.stamp = pulse.stamp; - - // initialize window state - if (!state || mod) { - state = self.state = new WindowState(_); - } - - // retrieve group for a tuple - var key = groupkey(_.groupby); - function group(t) { return self.group(key(t)); } - - // partition input tuples - if (mod || pulse.modified(state.inputs)) { - self.value = {}; - pulse.visit(pulse.SOURCE, function(t) { group(t).add(t); }); - } else { - pulse.visit(pulse.REM, function(t) { group(t).remove(t); }); - pulse.visit(pulse.ADD, function(t) { group(t).add(t); }); - } - - // perform window calculations for each modified partition - for (i=0, n=self._mlen; i 0 && !c(d[r0], d[r0-1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1+1])) w.i1 = bisect.right(d, d[r1]); -} - -var tx = /*#__PURE__*/Object.freeze({ - __proto__: null, - aggregate: Aggregate, - bin: Bin, - collect: Collect, - compare: Compare, - countpattern: CountPattern, - cross: Cross, - density: Density, - dotbin: DotBin, - expression: Expression, - extent: Extent, - facet: Facet, - field: Field, - filter: Filter, - flatten: Flatten, - fold: Fold, - formula: Formula, - generate: Generate, - impute: Impute, - joinaggregate: JoinAggregate, - kde: KDE, - key: Key, - load: Load, - lookup: Lookup, - multiextent: MultiExtent, - multivalues: MultiValues, - params: Params, - pivot: Pivot, - prefacet: PreFacet, - project: Project, - proxy: Proxy, - quantile: Quantile, - relay: Relay, - sample: Sample, - sequence: Sequence, - sieve: Sieve, - subflow: Subflow, - timeunit: TimeUnit, - tupleindex: TupleIndex, - values: Values, - window: Window -}); - -const Top = 'top'; -const Left = 'left'; -const Right = 'right'; -const Bottom = 'bottom'; - -const TopLeft = 'top-left'; -const TopRight = 'top-right'; -const BottomLeft = 'bottom-left'; -const BottomRight = 'bottom-right'; - -const Start = 'start'; -const Middle = 'middle'; -const End = 'end'; - -const X = 'x'; -const Y = 'y'; - -const Group = 'group'; - -const AxisRole = 'axis'; -const TitleRole = 'title'; -const FrameRole = 'frame'; -const ScopeRole = 'scope'; -const LegendRole = 'legend'; - -const RowHeader = 'row-header'; -const RowFooter = 'row-footer'; -const RowTitle = 'row-title'; -const ColHeader = 'column-header'; -const ColFooter = 'column-footer'; -const ColTitle = 'column-title'; - -const Padding = 'padding'; - -const Symbols = 'symbol'; - -const Fit = 'fit'; -const FitX = 'fit-x'; -const FitY = 'fit-y'; -const Pad = 'pad'; -const None$1 = 'none'; - -const All = 'all'; -const Each = 'each'; -const Flush = 'flush'; - -const Column = 'column'; -const Row = 'row'; - -var gradient_id = 0; - -function resetSVGGradientId() { - gradient_id = 0; -} - -const patternPrefix = 'p_'; - -function isGradient(value) { - return value && value.gradient; -} - -function gradientRef(g, defs, base) { - let id = g.id, - type = g.gradient, - prefix = type === 'radial' ? patternPrefix : ''; - - // check id, assign default values as needed - if (!id) { - id = g.id = 'gradient_' + (gradient_id++); - if (type === 'radial') { - g.x1 = get$1(g.x1, 0.5); - g.y1 = get$1(g.y1, 0.5); - g.r1 = get$1(g.r1, 0); - g.x2 = get$1(g.x2, 0.5); - g.y2 = get$1(g.y2, 0.5); - g.r2 = get$1(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get$1(g.x1, 0); - g.y1 = get$1(g.y1, 0); - g.x2 = get$1(g.x2, 1); - g.y2 = get$1(g.y2, 0); - } - } - - // register definition - defs[id] = g; - - // return url reference - return 'url(' + (base || '') + '#' + prefix + id + ')'; -} - -function get$1(val, def) { - return val != null ? val : def; -} - -function Gradient(p0, p1) { - var stops = [], gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function(offset, color) { - stops.push({offset: offset, color: color}); - return gradient; - } - }; -} - -var lookup = { - 'basis': { - curve: curveBasis - }, - 'basis-closed': { - curve: curveBasisClosed - }, - 'basis-open': { - curve: curveBasisOpen - }, - 'bundle': { - curve: curveBundle, - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: curveCardinal, - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: curveCardinalOpen, - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: curveCardinalClosed, - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: curveCatmullRom, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: curveCatmullRomClosed, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: curveCatmullRomOpen, - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: curveLinear - }, - 'linear-closed': { - curve: curveLinearClosed - }, - 'monotone': { - horizontal: curveMonotoneY, - vertical: curveMonotoneX - }, - 'natural': { - curve: curveNatural - }, - 'step': { - curve: curveStep - }, - 'step-after': { - curve: curveStepAfter - }, - 'step-before': { - curve: curveStepBefore - } -}; - -function curves(type, orientation, tension) { - var entry = hasOwnProperty(lookup, type) && lookup[type], - curve = null; - - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - if (entry.tension && tension != null) { - curve = curve[entry.tension](tension); - } - } - - return curve; -} - -// Path parsing and rendering code adapted from fabric.js -- Thanks! -var cmdlen = { m:2, l:2, h:1, v:1, c:6, s:4, q:4, t:2, a:7 }, - regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\d)([-+])/g, /\s|,|###/]; - -function pathParse(pathstr) { - var result = [], - path, - curr, - chunks, - parsed, param, - cmd, len, i, j, n, m; - - // First, break path into command sequence - path = pathstr - .slice() - .replace(regexp[0], '###$1') - .split(regexp[1]) - .slice(1); - - // Next, parse each command in turn - for (i=0, n=path.length; i len) { - for (j=1, m=parsed.length; j 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - - var a00 = cos_th / rx; - var a01 = sin_th / rx; - var a10 = (-sin_th) / ry; - var a11 = (cos_th) / ry; - var x0 = a00 * ox + a01 * oy; - var y0 = a10 * ox + a11 * oy; - var x1 = a00 * x + a01 * y; - var y1 = a10 * x + a11 * y; - - var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0); - var sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - var sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0); - var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0); - - var th0 = Math.atan2(y0-yc, x0-xc); - var th1 = Math.atan2(y1-yc, x1-xc); - - var th_arc = th1-th0; - if (th_arc < 0 && sweep === 1) { - th_arc += Tau; - } else if (th_arc > 0 && sweep === 0) { - th_arc -= Tau; - } - - var segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - var result = []; - for (var i=0; i +_; -} - -function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); -} - -function vg_rect() { - var x = rectangleX, - y = rectangleY, - width = rectangleWidth, - height = rectangleHeight, - crTL = number$1(0), - crTR = crTL, - crBL = crTL, - crBR = crTL, - context = null; - - function rectangle(_, x0, y0) { - var buffer, - x1 = x0 != null ? x0 : +x.call(this, _), - y1 = y0 != null ? y0 : +y.call(this, _), - w = +width.call(this, _), - h = +height.call(this, _), - s = Math.min(w, h) / 2, - tl = clamp(+crTL.call(this, _), 0, s), - tr = clamp(+crTR.call(this, _), 0, s), - bl = clamp(+crBL.call(this, _), 0, s), - br = clamp(+crBR.call(this, _), 0, s); - - if (!context) context = buffer = path$3(); - - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) { - context.rect(x1, y1, w, h); - } else { - var x2 = x1 + w, - y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - rectangle.x = function(_) { - if (arguments.length) { - x = number$1(_); - return rectangle; - } else { - return x; - } - }; - - rectangle.y = function(_) { - if (arguments.length) { - y = number$1(_); - return rectangle; - } else { - return y; - } - }; - - rectangle.width = function(_) { - if (arguments.length) { - width = number$1(_); - return rectangle; - } else { - return width; - } - }; - - rectangle.height = function(_) { - if (arguments.length) { - height = number$1(_); - return rectangle; - } else { - return height; - } - }; - - rectangle.cornerRadius = function(tl, tr, br, bl) { - if (arguments.length) { - crTL = number$1(tl); - crTR = tr != null ? number$1(tr) : crTL; - crBR = br != null ? number$1(br) : crTL; - crBL = bl != null ? number$1(bl) : crTR; - return rectangle; - } else { - return crTL; - } - }; - - rectangle.context = function(_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else { - return context; - } - }; - - return rectangle; -} - -function vg_trail() { - var x, - y, - size, - defined, - context = null, - ready, x1, y1, r1; - - function point(x2, y2, w2) { - var r2 = w2 / 2; - - if (ready) { - var ux = y1 - y2, - uy = x2 - x1; - - if (ux || uy) { - // get normal vector - var ud = Math.sqrt(ux * ux + uy * uy), - rx = (ux /= ud) * r1, - ry = (uy /= ud) * r1, - t = Math.atan2(uy, ux); - - // draw segment - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else { - context.arc(x2, y2, r2, 0, Tau); - } - context.closePath(); - } else { - ready = 1; - } - x1 = x2; - y1 = y2; - r1 = r2; - } - - function trail(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - - if (context == null) context = buffer = path$3(); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - trail.x = function(_) { - if (arguments.length) { - x = _; - return trail; - } else { - return x; - } - }; - - trail.y = function(_) { - if (arguments.length) { - y = _; - return trail; - } else { - return y; - } - }; - - trail.size = function(_) { - if (arguments.length) { - size = _; - return trail; - } else { - return size; - } - }; - - trail.defined = function(_) { - if (arguments.length) { - defined = _; - return trail; - } else { - return defined; - } - }; - - trail.context = function(_) { - if (arguments.length) { - if (_ == null) { - context = null; - } else { - context = _; - } - return trail; - } else { - return context; - } - }; - - return trail; -} - -function value(a, b) { - return a != null ? a : b; -} - -const x = item => item.x || 0, - y = item => item.y || 0, - w = item => item.width || 0, - h = item => item.height || 0, - xw = item => (item.x || 0) + (item.width || 0), - yh = item => (item.y || 0) + (item.height || 0), - sa = item => item.startAngle || 0, - ea = item => item.endAngle || 0, - pa = item => item.padAngle || 0, - ir = item => item.innerRadius || 0, - or = item => item.outerRadius || 0, - cr = item => item.cornerRadius || 0, - tl = item => value(item.cornerRadiusTopLeft, item.cornerRadius) || 0, - tr = item => value(item.cornerRadiusTopRight, item.cornerRadius) || 0, - br = item => value(item.cornerRadiusBottomRight, item.cornerRadius) || 0, - bl = item => value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, - sz = item => value(item.size, 64), - ts = item => item.size || 1, - def = item => !(item.defined === false), - type = item => symbols(item.shape || 'circle'); - -const arcShape = arc$3().startAngle(sa).endAngle(ea).padAngle(pa) - .innerRadius(ir).outerRadius(or).cornerRadius(cr), - areavShape = area$3().x(x).y1(y).y0(yh).defined(def), - areahShape = area$3().y(y).x1(x).x0(xw).defined(def), - lineShape = line$3().x(x).y(y).defined(def), - rectShape = vg_rect().x(x).y(y).width(w).height(h) - .cornerRadius(tl, tr, br, bl), - symbolShape = symbol$2().type(type).size(sz), - trailShape = vg_trail().x(x).y(y).defined(def).size(ts); - -function hasCornerRadius(item) { - return item.cornerRadius - || item.cornerRadiusTopLeft - || item.cornerRadiusTopRight - || item.cornerRadiusBottomRight - || item.cornerRadiusBottomLeft; -} - -function arc(context, item) { - return arcShape.context(context)(item); -} - -function area(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape) - .curve(curves(interp, item.orient, item.tension)) - .context(context)(items); -} - -function line(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)) - .context(context)(items); -} - -function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); -} - -function shape(context, item) { - return (item.mark.shape || item.shape) - .context(context)(item); -} - -function symbol(context, item) { - return symbolShape.context(context)(item); -} - -function trail(context, items) { - return trailShape.context(context)(items); -} - -var clip_id = 1; - -function resetSVGClipId() { - clip_id = 1; -} - -function clip(renderer, item, size) { - var clip = item.clip, - defs = renderer._defs, - id = item.clip_id || (item.clip_id = 'clip' + clip_id++), - c = defs.clipping[id] || (defs.clipping[id] = {id: id}); - - if (isFunction(clip)) { - c.path = clip(null); - } else if (hasCornerRadius(size)) { - c.path = rectangle(null, size, 0, 0); - } else { - c.width = size.width || 0; - c.height = size.height || 0; - } - - return 'url(#' + id + ')'; -} - -function Bounds(b) { - this.clear(); - if (b) this.union(b); -} - -var prototype$G = Bounds.prototype; - -prototype$G.clone = function() { - return new Bounds(this); -}; - -prototype$G.clear = function() { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; -}; - -prototype$G.empty = function() { - return ( - this.x1 === +Number.MAX_VALUE && - this.y1 === +Number.MAX_VALUE && - this.x2 === -Number.MAX_VALUE && - this.y2 === -Number.MAX_VALUE - ); -}; - -prototype$G.equals = function(b) { - return ( - this.x1 === b.x1 && - this.y1 === b.y1 && - this.x2 === b.x2 && - this.y2 === b.y2 - ); -}; - -prototype$G.set = function(x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; - } - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; - } - return this; -}; - -prototype$G.add = function(x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; -}; - -prototype$G.expand = function(d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; -}; - -prototype$G.round = function() { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; -}; - -prototype$G.scale = function(s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; -}; - -prototype$G.translate = function(dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; -}; - -prototype$G.rotate = function(angle, x, y) { - const p = this.rotatedPoints(angle, x, y); - return this.clear() - .add(p[0], p[1]) - .add(p[2], p[3]) - .add(p[4], p[5]) - .add(p[6], p[7]); -}; - -prototype$G.rotatedPoints = function(angle, x, y) { - var {x1, y1, x2, y2} = this, - cos = Math.cos(angle), - sin = Math.sin(angle), - cx = x - x*cos + y*sin, - cy = y - x*sin - y*cos; - - return [ - cos*x1 - sin*y1 + cx, sin*x1 + cos*y1 + cy, - cos*x1 - sin*y2 + cx, sin*x1 + cos*y2 + cy, - cos*x2 - sin*y1 + cx, sin*x2 + cos*y1 + cy, - cos*x2 - sin*y2 + cx, sin*x2 + cos*y2 + cy - ]; -}; - -prototype$G.union = function(b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; -}; - -prototype$G.intersect = function(b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; -}; - -prototype$G.encloses = function(b) { - return b && ( - this.x1 <= b.x1 && - this.x2 >= b.x2 && - this.y1 <= b.y1 && - this.y2 >= b.y2 - ); -}; - -prototype$G.alignsWith = function(b) { - return b && ( - this.x1 == b.x1 || - this.x2 == b.x2 || - this.y1 == b.y1 || - this.y2 == b.y2 - ); -}; - -prototype$G.intersects = function(b) { - return b && !( - this.x2 < b.x1 || - this.x1 > b.x2 || - this.y2 < b.y1 || - this.y1 > b.y2 - ); -}; - -prototype$G.contains = function(x, y) { - return !( - x < this.x1 || - x > this.x2 || - y < this.y1 || - y > this.y2 - ); -}; - -prototype$G.width = function() { - return this.x2 - this.x1; -}; - -prototype$G.height = function() { - return this.y2 - this.y1; -}; - -function Item(mark) { - this.mark = mark; - this.bounds = (this.bounds || new Bounds()); -} - -function GroupItem(mark) { - Item.call(this, mark); - this.items = (this.items || []); -} - -inherits(GroupItem, Item); - -function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - var c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } - } - return null; -} - -function domImage() { - return typeof Image !== 'undefined' ? Image : null; -} - -function ResourceLoader(customLoader) { - this._pending = 0; - this._loader = customLoader || loader(); -} - -var prototype$H = ResourceLoader.prototype; - -prototype$H.pending = function() { - return this._pending; -}; - -function increment(loader) { - loader._pending += 1; -} - -function decrement(loader) { - loader._pending -= 1; -} - -prototype$H.sanitizeURL = function(uri) { - var loader = this; - increment(loader); - - return loader._loader.sanitize(uri, {context:'href'}) - .then(function(opt) { - decrement(loader); - return opt; - }) - .catch(function() { - decrement(loader); - return null; - }); -}; - -prototype$H.loadImage = function(uri) { - const loader = this, - Image = domImage(); - increment(loader); - - return loader._loader - .sanitize(uri, {context: 'image'}) - .then(function(opt) { - const url = opt.href; - if (!url || !Image) throw {url: url}; - - const img = new Image(); - - // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - const cors = hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; - - // attempt to load image resource - img.onload = () => decrement(loader); - img.onerror = () => decrement(loader); - img.src = url; - - return img; - }) - .catch(function(e) { - decrement(loader); - return {complete: false, width: 0, height: 0, src: e && e.url || ''}; - }); -}; - -prototype$H.ready = function() { - var loader = this; - return new Promise(function(accept) { - function poll(value) { - if (!loader.pending()) accept(value); - else setTimeout(function() { poll(true); }, 10); - } - poll(false); - }); -}; - -function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - const sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - return bounds; -} - -function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; -} - -var bounds, lx, ly, - circleThreshold = Tau - 1e-8; - -function context(_) { - bounds = _; - return context; -} - -function noop$1() {} - -function add$2(x, y) { bounds.add(x, y); } - -function addL(x, y) { add$2(lx = x, ly = y); } - -function addX(x) { add$2(x, bounds.y1); } - -function addY(y) { add$2(bounds.x1, y); } - -context.beginPath = noop$1; - -context.closePath = noop$1; - -context.moveTo = addL; - -context.lineTo = addL; - -context.rect = function(x, y, w, h) { - add$2(x + w, y + h); - addL(x, y); -}; - -context.quadraticCurveTo = function(x1, y1, x2, y2) { - quadExtrema(lx, x1, x2, addX); - quadExtrema(ly, y1, y2, addY); - addL(x2, y2); -}; - -function quadExtrema(x0, x1, x2, cb) { - const t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); -} - -context.bezierCurveTo = function(x1, y1, x2, y2, x3, y3) { - cubicExtrema(lx, x1, x2, x3, addX); - cubicExtrema(ly, y1, y2, y3, addY); - addL(x3, y3); -}; - -function cubicExtrema(x0, x1, x2, x3, cb) { - const a = x3 - x0 + 3 * x1 - 3 * x2, - b = x0 + x2 - 2 * x1, - c = x0 - x1; - - let t0 = 0, t1 = 0, r; - - // solve for parameter t - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else { - // linear equation - t0 = 0.5 * c / b; - } - - // calculate position - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); -} - -function cubic(t, x0, x1, x2, x3) { - const s = 1 - t, s2 = s * s, t2 = t * t; - return (s2 * s * x0) + (3 * s2 * t * x1) + (3 * s * t2 * x2) + (t2 * t * x3); -} - -context.arc = function(cx, cy, r, sa, ea, ccw) { - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add$2(cx - r, cy - r); - add$2(cx + r, cy + r); - } else { - const update = a => add$2(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - let s, i; - - // sample end points - update(sa); - update(ea); - - // sample interior points aligned with 90 degrees - if (ea !== sa) { - sa = sa % Tau; if (sa < 0) sa += Tau; - ea = ea % Tau; if (ea < 0) ea += Tau; - - if (ea < sa) { - ccw = !ccw; // flip direction - s = sa; sa = ea; ea = s; // swap end-points - } - - if (ccw) { - ea -= Tau; - s = sa - (sa % HalfPi); - for (i=0; i<4 && s>ea; ++i, s-=HalfPi) update(s); - } else { - s = sa - (sa % HalfPi) + HalfPi; - for (i=0; i<4 && s t1) return false; - else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false; - else if (r < t1) t1 = r; - } - } - - return true; -} - -function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; -} - -function value$1(value, dflt) { - return value == null ? dflt : value; -} - -function addStops(gradient, stops) { - const n = stops.length; - for (let i=0; i 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else { - return false; - } -} - -var Empty$1 = []; - -function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - - if (lw <= 0) return false; - - opacity *= (item.strokeOpacity==null ? 1 : item.strokeOpacity); - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty$1); - context.lineDashOffset = item.strokeDashOffset || 0; - } - return true; - } else { - return false; - } -} - -function compare$2(a, b) { - return a.zindex - b.zindex || a.index - b.index; -} - -function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - - var items = scene.items, - output = [], item, i, n; - - for (i=0, n=items.length; i= 0;) { - if (hit = visitor(items[i])) return hit; - } - - if (items === zitems) { - for (items=scene.items, i=items.length; --i >= 0;) { - if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; - } - } - } - - return null; -} - -function drawAll(path) { - return function(context, scene, bounds) { - visit(scene, function(item) { - if (!bounds || bounds.intersects(item.bounds)) { - drawPath(path, context, item, item); - } - }); - }; -} - -function drawOne(path) { - return function(context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) { - drawPath(path, context, scene.items[0], scene.items); - } - }; -} - -function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - - if (path(context, items)) return; - - blend(context, item); - - if (item.fill && fill(context, item, opacity)) { - context.fill(); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.stroke(); - } -} - -function pick(test) { - test = test || truthy; - - return function(context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - - return pickVisit(scene, function(item) { - var b = item.bounds; - // first hit test against bounding box - if ((b && !b.contains(gx, gy)) || !b) return; - // if in bounding box, perform more careful test - if (test(context, item, x, y, gx, gy)) return item; - }); - }; -} - -function hitPath(path, filled) { - return function(context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, - fill = (filled == null) ? item.fill : filled, - stroke = item.stroke && context.isPointInStroke, lw, lc; - - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - - return path(context, o) ? false : - (fill && context.isPointInPath(x, y)) || - (stroke && context.isPointInStroke(x, y)); - }; -} - -function pickPath(path) { - return pick(hitPath(path)); -} - -function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - -function rotate(a) { - return 'rotate(' + a + ')'; -} - -function scale$1(scaleX, scaleY){ - return 'scale('+ scaleX + ',' + scaleY+')'; -} - -function translateItem(item) { - return translate(item.x || 0, item.y || 0); -} - -function transformItem(item) { - return translate(item.x || 0, item.y || 0) - + (item.angle ? ' ' + rotate(item.angle) : '') - + (item.scaleX || item.scaleY ? ' ' + scale$1(item.scaleX || 1, item.scaleY || 1) : ''); -} - -function markItemPath(type, shape, isect) { - - function attr(emit, item) { - emit('transform', transformItem(item)); - emit('d', shape(null, item)); - } - - function bound(bounds, item) { - var x = item.x || 0, - y = item.y || 0; - - shape(context(bounds), item); - boundStroke(bounds, item).translate(x, y); - if (item.angle) { - bounds.rotate(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw(context, item) { - var x = item.x || 0, - y = item.y || 0, - a = item.angle || 0; - - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); - } - - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; - -} - -var arc$1 = markItemPath('arc', arc); - -function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], - z = a[0].orient === 'horizontal' ? 'y' : 'x', - i = a.length, - min = +Infinity, hit, d; - - while (--i >= 0) { - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - if (d < min) { - min = d; - hit = a[i]; - } - } - - return hit; -} - -function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), - i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - - return null; -} - -function pickTrail(a, p) { - var i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx*dx) return a[i]; - } - - return null; -} - -function markMultiItemPath(type, shape, tip) { - - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - - function bound(bounds, mark) { - var items = mark.items; - if (items.length === 0) { - return bounds; - } else { - shape(context(bounds), items); - return boundStroke(bounds, items[0]); - } - } - - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - - var hit = hitPath(draw); - - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, - b = scene.bounds; - - if (!items || !items.length || b && !b.contains(gx, gy)) { - return null; - } - - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; - } - - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; - -} - -var area$1 = markMultiItemPath('area', area, pickArea); - -function clip$1(context, scene) { - var clip = scene.clip; - - context.save(); - - if (isFunction(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else { - clipGroup(context, scene.group); - } -} - -function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) - ? rectangle(context, group, 0, 0) - : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); -} - -function offset$1(item) { - const sw = value$1(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset - : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) - : 0; -} - -function attr(emit, item) { - emit('transform', translateItem(item)); -} - -function emitRectangle(emit, item) { - const off = offset$1(item); - emit('d', rectangle(null, item, off, off)); -} - -function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); -} - -function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - if (item.strokeForeground) { - emitRectangle(emit, item); - } else { - emit('d', ''); - } -} - -function content(emit, item, renderer) { - const url = item.clip ? clip(renderer, item, item) : null; - emit('clip-path', url); -} - -function bound(bounds, group) { - if (!group.clip && group.items) { - const items = group.items, m = items.length; - for (let j=0; j { - const gx = group.x || 0, - gy = group.y || 0, - fore = group.strokeForeground, - opacity = group.opacity == null ? 1 : group.opacity; - - // draw group background - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (group.fill && fill(context, group, opacity)) { - context.fill(); - } - if (group.stroke && !fore && stroke(context, group, opacity)) { - context.stroke(); - } - } - - // setup graphics context, set clip and bounds - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); - - // draw group contents - visit(group, item => { - this.draw(context, item, bounds); - }); - - // restore graphics context - if (bounds) bounds.translate(gx, gy); - context.restore(); - - // draw group foreground - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (stroke(context, group, opacity)) { - context.stroke(); - } - } - }); -} - -function pick$1(context, scene, x, y, gx, gy) { - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { - return null; - } - - const cx = x * context.pixelRatio, - cy = y * context.pixelRatio; - - return pickVisit(scene, group => { - let hit, fore, ix, dx, dy, dw, dh, b, c; - - // first hit test bounding box - b = group.bounds; - if (b && !b.contains(gx, gy)) return; - - // passed bounds check, test rectangular clip - dx = group.x || 0; - dy = group.y || 0; - dw = dx + (group.width || 0); - dh = dy + (group.height || 0); - c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; - - // adjust coordinate system - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; - - // test background for rounded corner clip - if (c && hasCornerRadius(group) && !hitBackground(context, group, cx, cy)) { - context.restore(); - return null; - } - - fore = group.strokeForeground; - ix = scene.interactive !== false; - - // hit test against group foreground - if (ix && fore && group.stroke - && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } - - // hit test against contained marks - hit = pickVisit(group, mark => pickMark(mark, dx, dy) - ? this.pick(mark, x, y, dx, dy) - : null - ); - - // hit test against group background - if (!hit && ix && (group.fill || (!fore && group.stroke)) - && hitBackground(context, group, cx, cy)) { - hit = group; - } - - // restore state and return - context.restore(); - return hit || null; - }); -} - -function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') - && mark.bounds && mark.bounds.contains(x, y); -} - -var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1, - isect: intersectRect, - content: content, - background: background, - foreground: foreground -}; - -var metadata = { - 'version': '1.1', - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink' -}; - -function getImage(item, renderer) { - var image = item.image; - if (!image || item.url && item.url !== image.url) { - image = {complete: false, width: 0, height: 0}; - renderer.loadImage(item.url).then(image => { - item.image = image; - item.image.url = item.url; - }); - } - return image; -} - -function imageWidth(item, image) { - return item.width != null ? item.width - : !image || !image.width ? 0 - : item.aspect !== false && item.height ? item.height * image.width / image.height - : image.width; -} - -function imageHeight(item, image) { - return item.height != null ? item.height - : !image || !image.height ? 0 - : item.aspect !== false && item.width ? item.width * image.height / image.width - : image.height; -} - -function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; -} - -function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; -} - -function attr$1(emit, item, renderer) { - const img = getImage(item, renderer), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); -} - -function bound$1(bounds, item) { - const img = item.image, - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h); - - return bounds.set(x, y, x + w, y + h); -} - -function draw$1(context, scene, bounds) { - visit(scene, item => { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - let img = getImage(item, this), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - opacity, ar0, ar1, t; - - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); -} - -var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick(), - isect: truthy, // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset -}; - -var line$1 = markMultiItemPath('line', line, pickLine); - -function attr$2(emit, item) { - var sx = item.scaleX || 1, - sy = item.scaleY || 1; - if (sx !== 1 || sy !== 1) { - emit('vector-effect', 'non-scaling-stroke'); - } - emit('transform', transformItem(item)); - emit('d', item.path); -} - -function path(context, item) { - var path = item.path; - if (path == null) return true; - - var x = item.x || 0, - y = item.y || 0, - sx = item.scaleX || 1, - sy = item.scaleY || 1, - a = (item.angle || 0) * DegToRad, - cache = item.pathCache; - - if (!cache || cache.path !== path) { - (item.pathCache = cache = pathParse(path)).path = path; - } - - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else { - pathRender(context, cache, x, y, sx, sy); - } -} - -function bound$2(bounds, item) { - path(context(bounds), item) - ? bounds.set(0, 0, 0, 0) - : boundStroke(bounds, item, true); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, item.x || 0, item.y || 0); - } - - return bounds; -} - -var path$1 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(path), - pick: pickPath(path), - isect: intersectPath(path) -}; - -function attr$3(emit, item) { - emit('d', rectangle(null, item)); -} - -function bound$3(bounds, item) { - var x, y; - return boundStroke(bounds.set( - x = item.x || 0, - y = item.y || 0, - (x + item.width) || 0, - (y + item.height) || 0 - ), item); -} - -function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); -} - -var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect -}; - -function attr$4(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); -} - -function bound$4(bounds, item) { - var x1, y1; - return boundStroke(bounds.set( - x1 = item.x || 0, - y1 = item.y || 0, - item.x2 != null ? item.x2 : x1, - item.y2 != null ? item.y2 : y1 - ), item); -} - -function path$2(context, item, opacity) { - var x1, y1, x2, y2; - - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - return false; -} - -function draw$3(context, scene, bounds) { - visit(scene, function(item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity && path$2(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); -} - -function hit(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path$2(context, item, 1) && context.isPointInStroke(x, y); -} - -var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick(hit), - isect: intersectRule -}; - -var shape$1 = markItemPath('shape', shape); - -var symbol$1 = markItemPath('symbol', symbol, intersectPoint); - -// memoize text width measurement -const widthCache = lruCache(); - -var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas -}; - -useCanvas(true); - -function useCanvas(use) { - textMetrics.width = (use && context$1) ? measureWidth : estimateWidth; -} - -// make dumb, simple estimate if no canvas is available -function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); -} - -function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); -} - -// measure text width if canvas is available -function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 - : _measureWidth(text, font(item)); -} - -function _measureWidth(text, currentFont) { - const key = `(${currentFont}) ${text}`; - let width = widthCache.get(key); - if (width === undefined) { - context$1.font = currentFont; - width = context$1.measureText(text).width; - widthCache.set(key, width); - } - return width; -} - -function fontSize(item) { - return item.fontSize != null ? (+item.fontSize || 0) : 11; -} - -function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : (fontSize(item) + 2); -} - -function lineArray(_) { - return isArray(_) ? _.length > 1 ? _ : _[0] : _; -} - -function textLines(item) { - return lineArray( - item.lineBreak && item.text && !isArray(item.text) - ? item.text.split(item.lineBreak) - : item.text - ); -} - -function multiLineOffset(item) { - const tl = textLines(item); - return (isArray(tl) ? (tl.length - 1) : 0) * lineHeight(item); -} - -function textValue(item, line) { - const text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate$1(item, text) : text; -} - -function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - const currentFont = font(item); - return text => _measureWidth(text, currentFont); - } else { - // we are relying on estimates - const currentFontHeight = fontSize(item); - return text => _estimateWidth(text, currentFontHeight); - } -} - -function truncate$1(item, text) { - var limit = +item.limit, - width = widthGetter(item); - - if (width(text) < limit) return text; - - var ellipsis = item.ellipsis || '\u2026', - rtl = item.dir === 'rtl', - lo = 0, - hi = text.length, mid; - - limit -= width(ellipsis); - - if (rtl) { - while (lo < hi) { - mid = (lo + hi >>> 1); - if (width(text.slice(mid)) > limit) lo = mid + 1; - else hi = mid; - } - return ellipsis + text.slice(lo); - } else { - while (lo < hi) { - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid; - else hi = mid - 1; - } - return text.slice(0, lo) + ellipsis; - } -} - -function fontFamily(item, quote) { - var font = item.font; - return (quote && font - ? String(font).replace(/"/g, '\'') - : font) || 'sans-serif'; -} - -function font(item, quote) { - return '' + - (item.fontStyle ? item.fontStyle + ' ' : '') + - (item.fontVariant ? item.fontVariant + ' ' : '') + - (item.fontWeight ? item.fontWeight + ' ' : '') + - fontSize(item) + 'px ' + - fontFamily(item, quote); -} - -function offset$2(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, - h = fontSize(item); - - return Math.round( - baseline === 'top' ? 0.79 * h : - baseline === 'middle' ? 0.30 * h : - baseline === 'bottom' ? -0.21 * h : - baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : - baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0 - ); -} - -var textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' -}; - -var tempBounds = new Bounds(); - -function anchorPoint(item) { - var x = item.x || 0, - y = item.y || 0, - r = item.radius || 0, t; - - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; -} - -function attr$5(emit, item) { - var dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item), - p = anchorPoint(item), - x = p.x1, - y = p.y1, - a = item.angle || 0, t; - - emit('text-anchor', textAlign[item.align] || 'start'); - - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else { - t = translate(x + dx, y + dy); - } - emit('transform', t); -} - -function bound$5(bounds, item, mode) { - var h = textMetrics.height(item), - a = item.align, - p = anchorPoint(item), - x = p.x1, - y = p.y1, - dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item) - Math.round(0.8*h), // use 4/5 offset - tl = textLines(item), - w; - - // get dimensions - if (isArray(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce((w, t) => Math.max(w, textMetrics.width(item, t)), 0); - } else { - // single-line text - w = textMetrics.width(item, tl); - } - - // horizontal alignment - if (a === 'center') { - dx -= (w / 2); - } else if (a === 'right') { - dx -= w; - } - - bounds.set(dx+=x, dy+=y, dx+w, dy+h); - - if (item.angle && !mode) { - bounds.rotate(item.angle * DegToRad, x, y); - } else if (mode === 2) { - return bounds.rotatedPoints(item.angle * DegToRad, x, y); - } - return bounds; -} - -function draw$4(context, scene, bounds) { - visit(scene, function(item) { - var opacity = item.opacity == null ? 1 : item.opacity, - p, x, y, i, lh, tl, str; - - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || - item.text == null || item.text.length === 0) return; - - context.font = font(item); - context.textAlign = item.align || 'left'; - - p = anchorPoint(item); - x = p.x1, - y = p.y1; - - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - x += (item.dx || 0); - y += (item.dy || 0) + offset$2(item); - - tl = textLines(item); - blend(context, item); - if (isArray(tl)) { - lh = lineHeight(item); - for (i=0; i index) el.removeChild(nodes[--curr]); - return el; -} - -// generate css class name for mark -function cssClass(mark) { - return 'mark-' + mark.marktype - + (mark.role ? ' role-' + mark.role : '') - + (mark.name ? ' ' + mark.name : ''); -} - -function point(event, el) { - var rect = el.getBoundingClientRect(); - return [ - event.clientX - rect.left - (el.clientLeft || 0), - event.clientY - rect.top - (el.clientTop || 0) - ]; -} - -function resolveItem(item, event, el, origin) { - var mark = item && item.mark, - mdef, p; - - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - while (item = item.mark.group) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - item = mdef.tip(mark.items, p); - } - - return item; -} - -/** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ -function Handler(customLoader, customTooltip) { - this._active = null; - this._handlers = {}; - this._loader = customLoader || loader(); - this._tooltip = customTooltip || defaultTooltip; -} - -// The default tooltip display handler. -// Sets the HTML title attribute on the visualization container. -function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); -} - -const prototype$J = Handler.prototype; - -/** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ -prototype$J.initialize = function(el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); -}; - -/** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ -prototype$J.element = function() { - return this._el; -}; - -/** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ -prototype$J.canvas = function() { - return this._el && this._el.firstChild; -}; - -/** - * Get / set the origin coordinates of the visualization. - */ -prototype$J.origin = function(origin) { - if (arguments.length) { - this._origin = origin || [0, 0]; - return this; - } else { - return this._origin.slice(); - } -}; - -/** - * Get / set the scenegraph root. - */ -prototype$J.scene = function(scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; -}; - -/** - * Add an event handler. Subclasses should override this method. - */ -prototype$J.on = function(/*type, handler*/) {}; - -/** - * Remove an event handler. Subclasses should override this method. - */ -prototype$J.off = function(/*type, handler*/) {}; - -/** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ -prototype$J._handlerIndex = function(h, type, handler) { - for (let i = h ? h.length : 0; --i>=0;) { - if (h[i].type === type && (!handler || h[i].handler === handler)) { - return i; - } - } - return -1; -}; - -/** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ -prototype$J.handlers = function(type) { - const h = this._handlers, a = []; - if (type) { - a.push.apply(a, h[this.eventName(type)]); - } else { - for (const k in h) { a.push.apply(a, h[k]); } - } - return a; -}; - -/** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ -prototype$J.eventName = function(name) { - const i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); -}; - -/** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ -prototype$J.handleHref = function(event, item, href) { - this._loader - .sanitize(href, {context:'href'}) - .then(opt => { - const e = new MouseEvent(event.type, event), - a = domCreate(null, 'a'); - for (const name in opt) a.setAttribute(name, opt[name]); - a.dispatchEvent(e); - }) - .catch(function() { /* do nothing */ }); -}; - -/** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ -prototype$J.handleTooltip = function(event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - const value = (show && item && item.tooltip) || null; - this._tooltip.call(this._obj, this, event, item, value); - } -}; - -/** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ -prototype$J.getItemBoundingClientRect = function(item) { - const el = this.canvas(); - if (!el) return; - - const rect = el.getBoundingClientRect(), - origin = this._origin, - bounds = item.bounds, - width = bounds.width(), - height = bounds.height(); - - let x = bounds.x1 + origin[0] + rect.left, - y = bounds.y1 + origin[1] + rect.top; - - // translate coordinate for each parent group - while (item.mark && (item = item.mark.group)) { - x += item.x || 0; - y += item.y || 0; - } - - // return DOMRect-compatible bounding box - return { - x, y, width, height, - left: x, top: y, right: x + width, bottom: y + height - }; -}; - -/** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ -function Renderer(loader) { - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); -} - -var prototype$K = Renderer.prototype; - -/** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ -prototype$K.initialize = function(el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); -}; - -/** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ -prototype$K.element = function() { - return this._el; -}; - -/** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ -prototype$K.canvas = function() { - return this._el && this._el.firstChild; -}; - -/** - * Get / set the background color. - */ -prototype$K.background = function(bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; -}; - -/** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ -prototype$K.resize = function(width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [0, 0]; - this._scale = scaleFactor || 1; - return this; -}; - -/** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ -prototype$K.dirty = function(/*item*/) { -}; - -/** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Renderer} - This renderer instance. - */ -prototype$K.render = function(scene) { - var r = this; - - // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - r._call = function() { r._render(scene); }; - - // invoke the renderer - r._call(); - - // clear the cached call for garbage collection - // async redraws will stash their own copy - r._call = null; - - return r; -}; - -/** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - */ -prototype$K._render = function(/*scene*/) { - // subclasses to override -}; - -/** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Promise} - A Promise that resolves when rendering is complete. - */ -prototype$K.renderAsync = function(scene) { - var r = this.render(scene); - return this._ready - ? this._ready.then(function() { return r; }) - : Promise.resolve(r); -}; - -/** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ -prototype$K._load = function(method, uri) { - var r = this, - p = r._loader[method](uri); - - if (!r._ready) { - // re-render the scene when loading completes - var call = r._call; - r._ready = r._loader.ready() - .then(function(redraw) { - if (redraw) call(); - r._ready = null; - }); - } - - return p; -}; - -/** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ -prototype$K.sanitizeURL = function(uri) { - return this._load('sanitizeURL', uri); -}; - -/** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ -prototype$K.loadImage = function(uri) { - return this._load('loadImage', uri); -}; - -const KeyDownEvent = 'keydown'; -const KeyPressEvent = 'keypress'; -const KeyUpEvent = 'keyup'; -const DragEnterEvent = 'dragenter'; -const DragLeaveEvent = 'dragleave'; -const DragOverEvent = 'dragover'; -const MouseDownEvent = 'mousedown'; -const MouseUpEvent = 'mouseup'; -const MouseMoveEvent = 'mousemove'; -const MouseOutEvent = 'mouseout'; -const MouseOverEvent = 'mouseover'; -const ClickEvent = 'click'; -const DoubleClickEvent = 'dblclick'; -const WheelEvent = 'wheel'; -const MouseWheelEvent = 'mousewheel'; -const TouchStartEvent = 'touchstart'; -const TouchMoveEvent = 'touchmove'; -const TouchEndEvent = 'touchend'; - -const Events = [ - KeyDownEvent, - KeyPressEvent, - KeyUpEvent, - DragEnterEvent, - DragLeaveEvent, - DragOverEvent, - MouseDownEvent, - MouseUpEvent, - MouseMoveEvent, - MouseOutEvent, - MouseOverEvent, - ClickEvent, - DoubleClickEvent, - WheelEvent, - MouseWheelEvent, - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent -]; - -const TooltipShowEvent = MouseMoveEvent; - -const TooltipHideEvent = MouseOutEvent; - -const HrefEvent = ClickEvent; - -function CanvasHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; -} - -const prototype$L = inherits(CanvasHandler, Handler); - -prototype$L.initialize = function(el, origin, obj) { - this._canvas = el && domFind(el, 'canvas'); - - // add minimal events required for proper state management - [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent] - .forEach(type => eventListenerCheck(this, type)); - - return Handler.prototype.initialize.call(this, el, origin, obj); -}; - -const eventBundle = type => ( - type === TouchStartEvent || - type === TouchMoveEvent || - type === TouchEndEvent -) -? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] -: [type]; - -// lazily add listeners to the canvas as needed -function eventListenerCheck(handler, type) { - eventBundle(type).forEach(_ => addEventListener(handler, _)); -} - -function addEventListener(handler, type) { - const canvas = handler.canvas(); - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] - ? evt => handler[type](evt) - : evt => handler.fire(type, evt) - ); - } -} - -// return the backing canvas instance -prototype$L.canvas = function() { - return this._canvas; -}; - -// retrieve the current canvas context -prototype$L.context = function() { - return this._canvas.getContext('2d'); -}; - -// supported events -prototype$L.events = Events; - -function move(moveEvent, overEvent, outEvent) { - return function(evt) { - const a = this._active, - p = this.pickEvent(evt); - - if (p === a) { - // active item and picked item are the same - this.fire(moveEvent, evt); // fire move - } else { - // active item and picked item are different - if (!a || !a.exit) { - // fire out for prior active item - // suppress if active item was removed from scene - this.fire(outEvent, evt); - } - this._active = p; // set new active item - this.fire(overEvent, evt); // fire over for new active item - this.fire(moveEvent, evt); // fire move for new active item - } - }; -} - -function inactive(type) { - return function(evt) { - this.fire(type, evt); - this._active = null; - }; -} - -// to keep old versions of firefox happy -prototype$L.DOMMouseScroll = function(evt) { - this.fire(MouseWheelEvent, evt); -}; - -prototype$L.mousemove = move(MouseMoveEvent, MouseOverEvent, MouseOutEvent); -prototype$L.dragover = move(DragOverEvent, DragEnterEvent, DragLeaveEvent); - -prototype$L.mouseout = inactive(MouseOutEvent); -prototype$L.dragleave = inactive(DragLeaveEvent); - -prototype$L.mousedown = function(evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); -}; - -prototype$L.click = function(evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } -}; - -prototype$L.touchstart = function(evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - - if (this._first) { - this._active = this._touch; - this._first = false; - } - - this.fire(TouchStartEvent, evt, true); -}; - -prototype$L.touchmove = function(evt) { - this.fire(TouchMoveEvent, evt, true); -}; - -prototype$L.touchend = function(evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; -}; - -// fire an event -prototype$L.fire = function(type, evt, touch) { - const a = touch ? this._touch : this._active, - h = this._handlers[type]; - - // set event type relative to scenegraph items - evt.vegaType = type; - - // handle hyperlinks and tooltips first - if (type === HrefEvent && a && a.href) { - this.handleHref(evt, a, a.href); - } else if (type === TooltipShowEvent || type === TooltipHideEvent) { - this.handleTooltip(evt, a, type !== TooltipHideEvent); - } - - // invoke all registered handlers - if (h) { - for (let i=0, len=h.length; i= 0) { - h.splice(i, 1); - } - - return this; -}; - -prototype$L.pickEvent = function(evt) { - const p = point(evt, this._canvas), - o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); -}; - -// find the scenegraph item at the current mouse position -// x, y -- the absolute x, y mouse coordinates on the canvas element -// gx, gy -- the relative coordinates within the current group -prototype$L.pick = function(scene, x, y, gx, gy) { - const g = this.context(), - mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); -}; - -function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; -} - -var pixelRatio = devicePixelRatio(); - -function resize(canvas, width, height, origin, scaleFactor, opt) { - const inDOM = typeof HTMLElement !== 'undefined' - && canvas instanceof HTMLElement - && canvas.parentNode != null, - context = canvas.getContext('2d'), - ratio = inDOM ? pixelRatio : scaleFactor; - - canvas.width = width * ratio; - canvas.height = height * ratio; - - for (const key in opt) { - context[key] = opt[key]; - } - - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - } - - context.pixelRatio = ratio; - context.setTransform( - ratio, 0, 0, ratio, - ratio * origin[0], - ratio * origin[1] - ); - - return canvas; -} - -function CanvasRenderer(loader) { - Renderer.call(this, loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); -} - -const prototype$M = inherits(CanvasRenderer, Renderer), - base = Renderer.prototype; - -prototype$M.initialize = function(el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - - this._canvas = this._options.externalContext - ? null - : domCanvas(1, 1, this._options.type); // instantiate a small canvas - - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - this._canvas.setAttribute('class', 'marks'); - } - - // this method will invoke resize to size the canvas appropriately - return base.initialize.call(this, el, width, height, origin, scaleFactor); -}; - -prototype$M.resize = function(width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - - if (this._canvas) { - // configure canvas size and transform - resize(this._canvas, this._width, this._height, - this._origin, this._scale, this._options.context); - } else { - // external context needs to be scaled and positioned to origin - const ctx = this._options.externalContext; - if (!ctx) error('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - - this._redraw = true; - return this; -}; - -prototype$M.canvas = function() { - return this._canvas; -}; - -prototype$M.context = function() { - return this._options.externalContext - || (this._canvas ? this._canvas.getContext('2d') : null); -}; - -prototype$M.dirty = function(item) { - let b = this._tempb.clear().union(item.bounds), - g = item.mark.group; - - while (g) { - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; - } - - this._dirty.union(b); -}; - -function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); - - // align to base pixel grid in case of non-integer scaling (#2425) - if (g.pixelRatio % 1) { - b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - } - - // to avoid artifacts translate if origin has fractional pixels - b.translate(-(origin[0] % 1), -(origin[1] % 1)); - - // set clip path - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - - return b; -} - -const viewBounds = (origin, width, height) => new Bounds() - .set(0, 0, width, height) - .translate(-origin[0], -origin[1]); - -prototype$M._render = function(scene) { - const g = this.context(), - o = this._origin, - w = this._width, - h = this._height, - db = this._dirty, - vb = viewBounds(o, w, h); - - // setup - g.save(); - const b = this._redraw || db.empty() - ? (this._redraw = false, vb.expand(1)) - : clipToBounds(g, vb.intersect(db), o); - - this.clear(-o[0], -o[1], w, h); - - // render - this.draw(g, scene, b); - - // takedown - g.restore(); - db.clear(); - - return this; -}; - -prototype$M.draw = function(ctx, scene, bounds) { - const mark = Marks[scene.marktype]; - if (scene.clip) clip$1(ctx, scene); - mark.draw.call(this, ctx, scene, bounds); - if (scene.clip) ctx.restore(); -}; - -prototype$M.clear = function(x, y, w, h) { - const opt = this._options, - g = this.context(); - - if (opt.type !== 'pdf' && !opt.externalContext) { - // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - } - - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } -}; - -function SVGHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - const h = this; - h._hrefHandler = listener(h, (evt, item) => { - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, (evt, item) => { - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); - }); -} - -const prototype$N = inherits(SVGHandler, Handler); - -prototype$N.initialize = function(el, origin, obj) { - let svg = this._svg; - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - this._svg = svg = el && domFind(el, 'svg'); - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - return Handler.prototype.initialize.call(this, el, origin, obj); -}; - -prototype$N.canvas = function() { - return this._svg; -}; - -// wrap an event listener for the SVG DOM -const listener = (context, handler) => evt => { - let item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); -}; - -// add an event handler -prototype$N.on = function(type, handler) { - const name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - const x = { - type, - handler, - listener: listener(this, handler) - }; - - (h[name] || (h[name] = [])).push(x); - if (this._svg) { - this._svg.addEventListener(name, x.listener); - } - } - - return this; -}; - -// remove an event handler -prototype$N.off = function(type, handler) { - const name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - if (this._svg) { - this._svg.removeEventListener(name, h[i].listener); - } - h.splice(i, 1); - } - - return this; -}; - -function bandSpace(count, paddingInner, paddingOuter) { - var space = count - paddingInner + paddingOuter * 2; - return count ? (space > 0 ? space : 1) : 0; -} - -const Identity = 'identity'; - -const Linear = 'linear'; -const Log = 'log'; -const Pow = 'pow'; -const Sqrt = 'sqrt'; -const Symlog = 'symlog'; - -const Time = 'time'; -const UTC = 'utc'; - -const Sequential = 'sequential'; -const Diverging = 'diverging'; - -const Quantile$1 = 'quantile'; -const Quantize = 'quantize'; -const Threshold = 'threshold'; - -const Ordinal = 'ordinal'; -const Point = 'point'; -const Band = 'band'; -const BinOrdinal = 'bin-ordinal'; - -// categories -const Continuous = 'continuous'; -const Discrete = 'discrete'; -const Discretizing = 'discretizing'; -const Interpolating = 'interpolating'; -const Temporal = 'temporal'; - -function invertRange(scale) { - return function(_) { - var lo = _[0], - hi = _[1], - t; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - return [ - scale.invert(lo), - scale.invert(hi) - ]; - }; -} - -function invertRangeExtent(scale) { - return function(_) { - var range = scale.range(), - lo = _[0], - hi = _[1], - min = -1, max, t, i, n; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - for (i=0, n=range.length; i= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - } - - if (min < 0) return undefined; - - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - - return [ - lo[0] === undefined ? lo[1] : lo[0], - hi[1] === undefined ? hi[0] : hi[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: { - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); - break; - } - default: { - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; - } - } - return this; -} - -const implicit = Symbol("implicit"); - -function ordinal() { - var index = new Map(), - domain = [], - range = [], - unknown = implicit; - - function scale(d) { - var key = d + "", i = index.get(key); - if (!i) { - if (unknown !== implicit) return unknown; - index.set(key, i = domain.push(d)); - } - return range[(i - 1) % range.length]; - } - - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new Map(); - for (const value of _) { - const key = value + ""; - if (index.has(key)) continue; - index.set(key, domain.push(value)); - } - return scale; - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return ordinal(domain, range).unknown(unknown); - }; - - initRange.apply(scale, arguments); - - return scale; -} - -function constant$1(x) { - return function() { - return x; - }; -} - -function number$2(x) { - return +x; -} - -var unit = [0, 1]; - -function identity$1(x) { - return x; -} - -function normalize(a, b) { - return (b -= (a = +a)) - ? function(x) { return (x - a) / b; } - : constant$1(isNaN(b) ? NaN : 0.5); -} - -function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = 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 corresponding parameter t in [0,1]. -// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. -function bimap(domain, range, interpolate) { - var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function(x) { return r0(d0(x)); }; -} - -function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, - d = new Array(j), - r = new Array(j), - i = -1; - - // Reverse descending domains. - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - - while (++i < j) { - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - - return function(x) { - var i = 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() { - var domain = unit, - range = unit, - interpolate = interpolate$1, - transform, - untransform, - unknown, - clamp = identity$1, - piecewise, - output, - input; - - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); - } - - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y))); - }; - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, number$2), rescale()) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.rangeRound = function(_) { - return range = Array.from(_), interpolate = interpolateRound, rescale(); - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1; - }; - - scale.interpolate = function(_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t, u) { - transform = t, untransform = u; - return rescale(); - }; -} - -function continuous() { - return transformer()(identity$1, identity$1); -} - -function tickFormat(start, stop, count, specifier) { - var step = tickStep(start, stop, count), - precision; - specifier = formatSpecifier(specifier == null ? ",f" : specifier); - switch (specifier.type) { - case "s": { - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision; - return formatPrefix(specifier, value); - } - case "": - case "e": - case "g": - case "p": - case "r": { - if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - } - case "f": - case "%": { - if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - return format$3(specifier); -} - -function linearish(scale) { - var domain = scale.domain; - - scale.ticks = function(count) { - var d = domain(); - return ticks(d[0], d[d.length - 1], count == null ? 10 : count); - }; - - scale.tickFormat = function(count, specifier) { - var d = domain(); - return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - - scale.nice = function(count) { - if (count == null) count = 10; - - var d = domain(), - i0 = 0, - i1 = d.length - 1, - start = d[i0], - stop = d[i1], - step; - - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - - step = tickIncrement(start, stop, count); - - if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - step = tickIncrement(start, stop, count); - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - step = tickIncrement(start, stop, count); - } - - if (step > 0) { - d[i0] = Math.floor(start / step) * step; - d[i1] = Math.ceil(stop / step) * step; - domain(d); - } else if (step < 0) { - d[i0] = Math.ceil(start * step) / step; - d[i1] = Math.floor(stop * step) / step; - domain(d); - } - - return scale; - }; - - return scale; -} - -function linear() { - var scale = continuous(); - - scale.copy = function() { - return copy(scale, linear()); - }; - - initRange.apply(scale, arguments); - - return linearish(scale); -} - -function identity$2(domain) { - var unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : x; - } - - scale.invert = scale; - - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, number$2), scale) : domain.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return identity$2(domain).unknown(unknown); - }; - - domain = arguments.length ? Array.from(domain, number$2) : [0, 1]; - - return linearish(scale); -} - -function nice(domain, interval) { - domain = domain.slice(); - - var i0 = 0, - i1 = domain.length - 1, - x0 = domain[i0], - x1 = domain[i1], - t; - - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - - domain[i0] = interval.floor(x0); - domain[i1] = 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 === 10 ? pow10 - : base === Math.E ? Math.exp - : function(x) { return Math.pow(base, x); }; -} - -function logp(base) { - return base === Math.E ? Math.log - : base === 10 && Math.log10 - || base === 2 && Math.log2 - || (base = Math.log(base), function(x) { return Math.log(x) / base; }); -} - -function reflect(f) { - return function(x) { - return -f(-x); - }; -} - -function loggish(transform) { - var scale = transform(transformLog, transformExp), - domain = scale.domain, - base = 10, - logs, - pows; - - function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else { - transform(transformLog, transformExp); - } - return scale; - } - - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.ticks = function(count) { - var d = domain(), - u = d[0], - v = d[d.length - 1], - r; - - if (r = v < u) i = u, u = v, v = i; - - var i = logs(u), - j = logs(v), - p, - k, - t, - n = count == null ? 10 : +count, - z = []; - - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for (; i <= j; ++i) { - for (k = 1, p = pows(i); k < base; ++k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } else for (; i <= j; ++i) { - for (k = base - 1, p = pows(i); k >= 1; --k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } - if (z.length * 2 < n) z = ticks(u, v, n); - } else { - z = ticks(i, j, Math.min(j - i, n)).map(pows); - } - - return r ? z.reverse() : z; - }; - - scale.tickFormat = function(count, specifier) { - if (specifier == null) specifier = base === 10 ? ".0e" : ","; - if (typeof specifier !== "function") specifier = format$3(specifier); - if (count === Infinity) return specifier; - if (count == null) count = 10; - var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - return function(d) { - var i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; - }; - - scale.nice = 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$2() { - var scale = loggish(transformer()).domain([1, 10]); - - scale.copy = function() { - return copy(scale, log$2()).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 = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - - return linearish(scale); -} - -function symlog$1() { - var scale = symlogish(transformer()); - - scale.copy = function() { - return copy(scale, symlog$1()).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 = transform(identity$1, identity$1), - exponent = 1; - - function rescale() { - return exponent === 1 ? transform(identity$1, identity$1) - : exponent === 0.5 ? transform(transformSqrt, transformSquare) - : transform(transformPow(exponent), transformPow(1 / exponent)); - } - - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - - return linearish(scale); -} - -function pow$1() { - var scale = powish(transformer()); - - scale.copy = function() { - return copy(scale, pow$1()).exponent(scale.exponent()); - }; - - initRange.apply(scale, arguments); - - return scale; -} - -function sqrt() { - return pow$1.apply(null, arguments).exponent(0.5); -} - -function quantile$1() { - var domain = [], - range = [], - thresholds = [], - unknown; - - function rescale() { - var i = 0, n = Math.max(1, range.length); - thresholds = new Array(n - 1); - while (++i < n) thresholds[i - 1] = quantile(domain, i / n); - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : range[bisectRight(thresholds, x)]; - } - - scale.invertExtent = function(y) { - var i = 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 = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort(ascending); - return rescale(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.quantiles = function() { - return thresholds.slice(); - }; - - scale.copy = function() { - return quantile$1() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); -} - -function quantize() { - var x0 = 0, - x1 = 1, - n = 1, - domain = [0.5], - range = [0, 1], - unknown; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - function rescale() { - var i = -1; - domain = new Array(n); - while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; - }; - - scale.range = function(_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [NaN, NaN] - : i < 1 ? [x0, domain[0]] - : i >= n ? [domain[n - 1], x1] - : [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - - scale.thresholds = function() { - return domain.slice(); - }; - - scale.copy = function() { - return quantize() - .domain([x0, x1]) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(linearish(scale), arguments); -} - -function threshold() { - var domain = [0.5], - range = [0, 1], - unknown, - n = 1; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return threshold() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); -} - -var durationSecond$1 = 1000, - durationMinute$1 = durationSecond$1 * 60, - durationHour$1 = durationMinute$1 * 60, - durationDay$1 = durationHour$1 * 24, - durationWeek$1 = durationDay$1 * 7, - durationMonth$1 = durationDay$1 * 30, - durationYear$1 = durationDay$1 * 365; - -function date(t) { - return new Date(t); -} - -function number$3(t) { - return t instanceof Date ? +t : +new Date(+t); -} - -function calendar(year, month, week, day, hour, minute, second, millisecond, format) { - var scale = continuous(), - invert = scale.invert, - domain = scale.domain; - - var formatMillisecond = format(".%L"), - formatSecond = format(":%S"), - formatMinute = format("%I:%M"), - formatHour = format("%I %p"), - formatDay = format("%a %d"), - formatWeek = format("%b %d"), - formatMonth = format("%B"), - formatYear = format("%Y"); - - var tickIntervals = [ - [second, 1, durationSecond$1], - [second, 5, 5 * durationSecond$1], - [second, 15, 15 * durationSecond$1], - [second, 30, 30 * durationSecond$1], - [minute, 1, durationMinute$1], - [minute, 5, 5 * durationMinute$1], - [minute, 15, 15 * durationMinute$1], - [minute, 30, 30 * durationMinute$1], - [ hour, 1, durationHour$1 ], - [ hour, 3, 3 * durationHour$1 ], - [ hour, 6, 6 * durationHour$1 ], - [ hour, 12, 12 * durationHour$1 ], - [ day, 1, durationDay$1 ], - [ day, 2, 2 * durationDay$1 ], - [ week, 1, durationWeek$1 ], - [ month, 1, durationMonth$1 ], - [ month, 3, 3 * durationMonth$1 ], - [ year, 1, durationYear$1 ] - ]; - - function tickFormat(date) { - return (second(date) < date ? formatMillisecond - : minute(date) < date ? formatSecond - : hour(date) < date ? formatMinute - : day(date) < date ? formatHour - : month(date) < date ? (week(date) < date ? formatDay : formatWeek) - : year(date) < date ? formatMonth - : formatYear)(date); - } - - function tickInterval(interval, start, stop) { - if (interval == null) interval = 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 === "number") { - var target = Math.abs(stop - start) / interval, - i = bisector(function(i) { return i[2]; }).right(tickIntervals, target), - step; - if (i === tickIntervals.length) { - step = tickStep(start / durationYear$1, stop / durationYear$1, interval); - interval = year; - } else if (i) { - i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - step = i[1]; - interval = i[0]; - } else { - step = Math.max(tickStep(start, stop, interval), 1); - interval = millisecond; - } - return interval.every(step); - } - - return interval; - } - - scale.invert = function(y) { - return new Date(invert(y)); - }; - - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number$3)) : domain().map(date); - }; - - scale.ticks = function(interval) { - var d = domain(), - t0 = d[0], - t1 = d[d.length - 1], - r = t1 < t0, - t; - if (r) t = t0, t0 = t1, t1 = t; - t = tickInterval(interval, t0, t1); - t = t ? t.range(t0, t1 + 1) : []; // inclusive stop - return r ? t.reverse() : t; - }; - - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - - scale.nice = function(interval) { - var d = domain(); - return (interval = tickInterval(interval, d[0], d[d.length - 1])) - ? domain(nice(d, interval)) - : scale; - }; - - scale.copy = function() { - return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); - }; - - return scale; -} - -function time() { - return initRange.apply(calendar(timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond, timeFormat$1).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); -} - -function utcTime() { - return initRange.apply(calendar(utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcMillisecond, utcFormat$1).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); -} - -function transformer$1() { - var x0 = 0, - x1 = 1, - t0, - t1, - k10, - transform, - interpolator = identity$1, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; - }; - } - - scale.range = range(interpolate$1); - - scale.rangeRound = range(interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === 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 = linearish(transformer$1()(identity$1)); - - scale.copy = function() { - return copy$1(scale, sequential()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function sequentialLog() { - var scale = loggish(transformer$1()).domain([1, 10]); - - scale.copy = function() { - return copy$1(scale, sequentialLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function sequentialSymlog() { - var scale = symlogish(transformer$1()); - - scale.copy = function() { - return copy$1(scale, sequentialSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function sequentialPow() { - var scale = powish(transformer$1()); - - scale.copy = 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 transformer$2() { - var x0 = 0, - x1 = 0.5, - x2 = 1, - s = 1, - t0, - t1, - t2, - k10, - k21, - interpolator = identity$1, - transform, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - - scale.range = range(interpolate$1); - - scale.rangeRound = range(interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; -} - -function diverging() { - var scale = linearish(transformer$2()(identity$1)); - - scale.copy = function() { - return copy$1(scale, diverging()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingLog() { - var scale = loggish(transformer$2()).domain([0.1, 1, 10]); - - scale.copy = function() { - return copy$1(scale, divergingLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingSymlog() { - var scale = symlogish(transformer$2()); - - scale.copy = function() { - return copy$1(scale, divergingSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); -} - -function divergingPow() { - var scale = powish(transformer$2()); - - scale.copy = 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 band() { - var scale = ordinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - range = [0, 1], - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = range[1] < range[0], - start = range[reverse - 0], - stop = range[1 - reverse], - space = bandSpace(n, paddingInner, paddingOuter); - - step = (stop - start) / (space || 1); - if (round) { - step = Math.floor(step); - } - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - var values = sequence(n).map(function(i) { return start + step * i; }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function(_) { - if (arguments.length) { - domain(_); - return rescale(); - } else { - return domain(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = [+_[0], +_[1]]; - return rescale(); - } else { - return range.slice(); - } - }; - - scale.rangeRound = function(_) { - range = [+_[0], +_[1]]; - round = true; - return rescale(); - }; - - scale.bandwidth = function() { - return bandwidth; - }; - - scale.step = function() { - return step; - }; - - scale.round = function(_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else { - return round; - } - }; - - scale.padding = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingInner = function(_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingOuter = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingOuter; - } - }; - - scale.align = function(_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return align; - } - }; - - scale.invertRange = function(_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - - var lo = +_[0], - hi = +_[1], - reverse = range[1] < range[0], - values = reverse ? ordinalRange().reverse() : ordinalRange(), - n = values.length - 1, a, b, t; - - // bail if either range endpoint is invalid - if (lo !== lo || hi !== hi) return; - - // order range inputs, bail if outside of scale range - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - if (hi < values[0] || lo > range[1-reverse]) return; - - // binary search to index into scale range - a = Math.max(0, bisectRight(values, lo) - 1); - b = lo===hi ? a : bisectRight(values, hi) - 1; - - // increment index a if lo is within padding gap - if (lo - values[a] > bandwidth + 1e-10) ++a; - - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - return (a > b) ? undefined : domain().slice(a, b+1); - }; - - scale.invert = function(_) { - var value = scale.invertRange([_, _]); - return value ? value[0] : value; - }; - - scale.copy = function() { - return band() - .domain(domain()) - .range(range) - .round(round) - .paddingInner(paddingInner) - .paddingOuter(paddingOuter) - .align(align); - }; - - return rescale(); -} - -function pointish(scale) { - var copy = scale.copy; - - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - - scale.copy = function() { - return pointish(copy()); - }; - - return scale; -} - -function point$1() { - return pointish(band().paddingInner(1)); -} - -var map = Array.prototype.map; - -function numbers$2(_) { - return map.call(_, function(x) { return +x; }); -} - -var slice = Array.prototype.slice; - -function scaleBinOrdinal() { - var domain = [], - range = []; - - function scale(x) { - return x == null || x !== x - ? undefined - : range[(bisectRight(domain, x) - 1) % range.length]; - } - - scale.domain = function(_) { - if (arguments.length) { - domain = numbers$2(_); - return scale; - } else { - return domain.slice(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else { - return range.slice(); - } - }; - - scale.tickFormat = function(count, specifier) { - return tickFormat(domain[0], peek(domain), count == null ? 10 : count, specifier); - }; - - scale.copy = function() { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - - return scale; -} - -// scale registry -const scales = {}; - -/** - * Augment scales with their type and needed inverse methods. - */ -function create(type, constructor, metadata) { - const ctr = function scale() { - var s = constructor(); - - if (!s.invertRange) { - s.invertRange = s.invert ? invertRange(s) - : s.invertExtent ? invertRangeExtent(s) - : undefined; - } - - s.type = type; - return s; - }; - - ctr.metadata = toSet(array(metadata)); - - return ctr; -} - -function scale$2(type, scale, metadata) { - if (arguments.length > 1) { - scales[type] = create(type, scale, metadata); - return this; - } else { - return isValidScaleType(type) ? scales[type] : undefined; - } -} - -// identity scale -scale$2(Identity, identity$2); - -// continuous scales -scale$2(Linear, linear, Continuous); -scale$2(Log, log$2, [Continuous, Log]); -scale$2(Pow, pow$1, Continuous); -scale$2(Sqrt, sqrt, Continuous); -scale$2(Symlog, symlog$1, Continuous); -scale$2(Time, time, [Continuous, Temporal]); -scale$2(UTC, utcTime, [Continuous, Temporal]); - -// sequential scales -scale$2(Sequential, sequential, [Continuous, Interpolating]); // backwards compat -scale$2(`${Sequential}-${Linear}`, sequential, [Continuous, Interpolating]); -scale$2(`${Sequential}-${Log}`, sequentialLog, [Continuous, Interpolating, Log]); -scale$2(`${Sequential}-${Pow}`, sequentialPow, [Continuous, Interpolating]); -scale$2(`${Sequential}-${Sqrt}`, sequentialSqrt, [Continuous, Interpolating]); -scale$2(`${Sequential}-${Symlog}`, sequentialSymlog, [Continuous, Interpolating]); - -// diverging scales -scale$2(`${Diverging}-${Linear}`, diverging, [Continuous, Interpolating]); -scale$2(`${Diverging}-${Log}`, divergingLog, [Continuous, Interpolating, Log]); -scale$2(`${Diverging}-${Pow}`, divergingPow, [Continuous, Interpolating]); -scale$2(`${Diverging}-${Sqrt}`, divergingSqrt, [Continuous, Interpolating]); -scale$2(`${Diverging}-${Symlog}`, divergingSymlog, [Continuous, Interpolating]); - -// discretizing scales -scale$2(Quantile$1, quantile$1, [Discretizing, Quantile$1]); -scale$2(Quantize, quantize, Discretizing); -scale$2(Threshold, threshold, Discretizing); - -// discrete scales -scale$2(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]); -scale$2(Ordinal, ordinal, Discrete); -scale$2(Band, band, Discrete); -scale$2(Point, point$1, Discrete); - -function isValidScaleType(type) { - return hasOwnProperty(scales, type); -} - -function hasType(key, type) { - const s = scales[key]; - return s && s.metadata[type]; -} - -function isContinuous(key) { - return hasType(key, Continuous); -} - -function isDiscrete(key) { - return hasType(key, Discrete); -} - -function isDiscretizing(key) { - return hasType(key, Discretizing); -} - -function isLogarithmic(key) { - return hasType(key, Log); -} - -function isTemporal(key) { - return hasType(key, Temporal); -} - -function isInterpolating(key) { - return hasType(key, Interpolating); -} - -function isQuantile(key) { - return hasType(key, Quantile$1); -} - -const scaleProps = ['clamp', 'base', 'constant', 'exponent']; - -function interpolateRange(interpolator, range) { - var start = range[0], - span = peek(range) - start; - return function(i) { return interpolator(start + i * span); }; -} - -function interpolateColors(colors, type, gamma) { - return piecewise(interpolate(type || 'rgb', gamma), colors); -} - -function quantizeInterpolator(interpolator, count) { - var samples = new Array(count), - n = count + 1; - for (var i = 0; i < count;) samples[i] = interpolator(++i / n); - return samples; -} - -function scaleFraction(scale, min, max) { - var delta = max - min, i, t, s; - - if (!delta || !Number.isFinite(delta)) { - return constant(0.5); - } else { - i = (t = scale.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale$2(t)().domain([min, max]).range([0, 1]); - scaleProps.forEach(m => scale[m] ? s[m](scale[m]()) : 0); - return s; - } -} - -function interpolate(type, gamma) { - var interp = $$1[method(type)]; - return (gamma != null && interp && interp.gamma) - ? interp.gamma(gamma) - : interp; -} - -function method(type) { - return 'interpolate' + type.toLowerCase() - .split('-') - .map(function(s) { return s[0].toUpperCase() + s.slice(1); }) - .join(''); -} - -const continuous$1 = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' -}; - -const discrete = { - category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', - accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', - dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', - paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', - pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', - pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', - set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', - set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', - set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' -}; - -function colors(palette) { - var n = palette.length / 6 | 0, c = new Array(n), i = 0; - while (i < n) c[i] = '#' + palette.slice(i * 6, ++i * 6); - return c; -} - -function apply(_, f) { - for (let k in _) scheme(k, f(_[k])); -} - -const schemes = {}; -apply(discrete, colors); -apply(continuous$1, _ => interpolateColors(colors(_))); - -function scheme(name, scheme) { - name = name && name.toLowerCase(); - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else { - return schemes[name]; - } -} - -var SymbolLegend = 'symbol'; -var DiscreteLegend = 'discrete'; -var GradientLegend = 'gradient'; - -const defaultFormatter = value => isArray(value) - ? value.map(v => String(v)) - : String(value); - -const ascending$1 = (a, b) => a[1] - b[1]; -const descending = (a, b) => b[1] - a[1]; - -/** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ -function tickCount(scale, count, minStep) { - var step; - - if (isNumber(count)) { - if (scale.bins) { - count = Math.max(count, scale.bins.length); - } - if (minStep != null) { - count = Math.min( - count, - Math.floor((span(scale.domain()) / minStep) || 1) - ); - } - } - - if (isObject(count)) { - step = count.step; - count = count.interval; - } - - if (isString(count)) { - count = scale.type === Time ? timeInterval(count) - : scale.type == UTC ? utcInterval(count) - : error('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - - return count; -} - -/** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ -function validTicks(scale, ticks, count) { - let range = scale.range(), - lo = range[0], - hi = peek(range), - cmp = ascending$1; - - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - - lo = Math.floor(lo); - hi = Math.ceil(hi); - - // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - ticks = ticks.map(v => [v, scale(v)]) - .filter(_ => lo <= _[1] && _[1] <= hi) - .sort(cmp) - .map(_ => _[0]); - - if (count > 0 && ticks.length > 1) { - const endpoints = [ticks[0], peek(ticks)]; - while (ticks.length > count && ticks.length >= 3) { - ticks = ticks.filter((_, i) => !(i % 2)); - } - if (ticks.length < 3) { - ticks = endpoints; - } - } - - return ticks; -} - -/** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ -function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins) - : scale.ticks ? scale.ticks(count) - : scale.domain(); -} - -/** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ -function tickFormat$1(locale, scale, count, specifier, formatType, noSkip) { - var type = scale.type; - let format = defaultFormatter; - - if (type === Time || formatType === Time) { - format = locale.timeFormat(specifier); - } - else if (type === UTC || formatType === UTC) { - format = locale.utcFormat(specifier); - } - else if (isLogarithmic(type)) { - const varfmt = locale.formatFloat(specifier); - if (noSkip || scale.bins) { - format = varfmt; - } else { - const test = tickLog(scale, count, false); - format = _ => test(_) ? varfmt(_) : ''; - } - } - else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - const d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } - else if (specifier) { - format = locale.format(specifier); - } - - return format; -} - -function tickLog(scale, count, values) { - const ticks = tickValues(scale, count), - base = scale.base(), - logb = Math.log(base), - k = Math.max(1, base * count / ticks.length); - - // apply d3-scale's log format filter criteria - const test = d => { - let i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - - return values ? ticks.filter(test) : test; -} - -const symbols$1 = { - [Quantile$1]: 'quantiles', - [Quantize]: 'thresholds', - [Threshold]: 'domain' -}; - -const formats$1 = { - [Quantile$1]: 'quantiles', - [Quantize]: 'domain' -}; - -function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) - : scale.type === Log ? tickLog(scale, count, true) - : symbols$1[scale.type] ? thresholdValues(scale[symbols$1[scale.type]]()) - : tickValues(scale, count); -} - -function thresholdFormat(locale, scale, specifier) { - var _ = scale[formats$1[scale.type]](), - n = _.length, - d = n > 1 ? _[1] - _[0] : _[0], i; - - for (i=1; i { - var limit = get$2(array[index + 1], get$2(array.max, +Infinity)), - lo = formatValue(value, format), - hi = formatValue(limit, format); - return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo; - }; -} - -function get$2(value, dflt) { - return value != null ? value : dflt; -} - -function formatDiscrete(format) { - return (value, index) => index ? format(value) : null; -} - -function formatPoint(format) { - return value => format(value); -} - -function formatValue(value, format) { - return Number.isFinite(value) ? format(value) : null; -} - -function labelFraction(scale) { - var domain = scale.domain(), - count = domain.length - 1, - lo = +domain[0], - hi = +peek(domain), - span = hi - lo; - - if (scale.type === Threshold) { - const adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - - return value => (value - lo) / span; -} - -function format$1(locale, scale, specifier, formatType) { - const type = formatType || scale.type; - - // replace abbreviated time specifiers to improve screen reader experience - if (isString(specifier) && isTemporal(type)) { - specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - } - - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') - : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') - : labelFormat(locale, scale, 5, null, specifier, formatType, true); -} - -function domainCaption(locale, scale, opt) { - opt = opt || {}; - const max = Math.max(3, opt.maxlen || 7), - fmt = format$1(locale, scale, opt.format, opt.formatType); - - // if scale breaks domain into bins, describe boundaries - if (isDiscretizing(scale.type)) { - const v = labelValues(scale).slice(1).map(fmt), - n = v.length; - return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`; - } - - // if scale domain is discrete, list values - else if (isDiscrete(scale.type)) { - const d = scale.domain(), - n = d.length, - v = n > max - ? d.slice(0, max - 2).map(fmt).join(', ') - + ', ending with ' + d.slice(-1).map(fmt) - : d.map(fmt).join(', '); - return `${n} value${n === 1 ? '' : 's'}: ${v}`; - } - - // if scale domain is continuous, describe value range - else { - const d = scale.domain(); - return `values from ${fmt(d[0])} to ${fmt(peek(d))}`; - } -} - -const ARIA_HIDDEN = 'aria-hidden'; -const ARIA_LABEL = 'aria-label'; -const ARIA_ROLE = 'role'; -const ARIA_ROLEDESCRIPTION = 'aria-roledescription'; -const GRAPHICS_OBJECT = 'graphics-object'; -const GRAPHICS_SYMBOL = 'graphics-symbol'; - -const bundle = (role, roledesc, label) => ({ - [ARIA_ROLE]: role, - [ARIA_ROLEDESCRIPTION]: roledesc, - [ARIA_LABEL]: label || undefined -}); - -// these roles are covered by related roles -// we can ignore them, no need to generate attributes -const AriaIgnore = toSet([ - 'axis-domain', - 'axis-grid', - 'axis-label', - 'axis-tick', - 'axis-title', - 'legend-band', - 'legend-entry', - 'legend-gradient', - 'legend-label', - 'legend-title', - 'legend-symbol', - 'title' -]); - -// aria attribute generators for guide roles -const AriaGuides = { - 'axis': {desc: 'axis', caption: axisCaption}, - 'legend': {desc: 'legend', caption: legendCaption}, - 'title-text': { - desc: 'title', - caption: item => `Title text '${titleCaption(item)}'` - }, - 'title-subtitle': { - desc: 'subtitle', - caption: item => `Subtitle text '${titleCaption(item)}'` - } -}; - -// aria properties generated for mark item encoding channels -const AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL -}; - -function ariaItemAttributes(emit, item) { - const hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - - if (hide || item.description == null) { - for (const prop in AriaEncode) { - emit(AriaEncode[prop], undefined); - } - } else { - const type = item.mark.marktype; - emit( - ARIA_LABEL, - item.description - ); - emit( - ARIA_ROLE, - item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL) - ); - emit( - ARIA_ROLEDESCRIPTION, - item.ariaRoleDescription || `${type} mark` - ); - } -} - -function ariaMarkAttributes(mark) { - return mark.aria === false ? { [ARIA_HIDDEN]: true } - : AriaIgnore[mark.role] ? null - : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) - : ariaMark(mark); -} - -function ariaMark(mark) { - const type = mark.marktype; - const recurse = ( - type === 'group' || - type === 'text' || - mark.items.some(_ => _.description != null && _.aria !== false) - ); - return bundle( - recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, - `${type} mark container`, - mark.description - ); -} - -function ariaGuide(mark, opt) { - try { - const item = mark.items[0], - caption = opt.caption || (() => ''); - return bundle( - opt.role || GRAPHICS_SYMBOL, - opt.desc, - item.description || caption(item) - ); - } catch (err) { - return null; - } -} - -function titleCaption(item) { - return array(item.text).join(' '); -} - -function axisCaption(item) { - const datum = item.datum, - orient = item.orient, - title = datum.title ? extractTitle(item) : null, - ctx = item.context, - scale = ctx.scales[datum.scale].value, - locale = ctx.dataflow.locale(), - type = scale.type, - xy = (orient === 'left' || orient === 'right') ? 'Y' : 'X'; - - return `${xy}-axis` - + (title ? ` titled '${title}'` : '') - + ` for a ${isDiscrete(type) ? 'discrete' : type} scale` - + ` with ${domainCaption(locale, scale, item)}`; -} - -function legendCaption(item) { - const datum = item.datum, - title = datum.title ? extractTitle(item) : null, - type = `${datum.type || ''} legend`.trim(), - scales = datum.scales, - props = Object.keys(scales), - ctx = item.context, - scale = ctx.scales[scales[props[0]]].value, - locale = ctx.dataflow.locale(); - - return capitalize(type) - + (title ? ` titled '${title}'` : '') - + ` for ${channelCaption(props)}` - + ` with ${domainCaption(locale, scale, item)}`; -} - -function extractTitle(item) { - try { - return array(peek(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } -} - -function channelCaption(props) { - props = props.map(p => p + (p === 'fill' || p === 'stroke' ? ' color' : '')); - return props.length < 2 ? props[0] - : props.slice(0, -1).join(', ') + ' and ' + peek(props); -} - -function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; -} - -const attrText = val => (val + '') - .replace(/&/g, '&') - .replace(/"/g, '"'); - -/** - * Generate string for an opening xml tag. - * @param tag the name of the xml tag - * @param attr hash of attribute name-value pairs to include - * @param raw additional raw string to include in tag markup - */ -function openTag(tag, attr, raw) { - var s = '<' + tag, key, val; - if (attr) { - for (key in attr) { - val = attr[key]; - if (val != null) { - s += ' ' + key + '="' + attrText(val) + '"'; - } - } - } - if (raw) s += ' ' + raw; - return s + '>'; -} - -/** - * Generate string for closing xml tag. - * @param tag the name of the xml tag - */ -function closeTag(tag) { - return ''; -} - -const styles = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity', - blend: 'mix-blend-mode' -}; - -// ensure miter limit default is consistent with canvas (#2498) -const rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 -}; - -const RootIndex = 0, - ns = metadata.xmlns; - -function SVGRenderer(loader) { - Renderer.call(this, loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; -} - -var prototype$O = inherits(SVGRenderer, Renderer); -var base$1 = Renderer.prototype; - -prototype$O.initialize = function(el, width, height, padding) { - // create the svg definitions cache - this._defs = { - gradient: {}, - clipping: {} - }; - - if (el) { - this._svg = domChild(el, 0, 'svg', ns); - this._svg.setAttribute('class', 'marks'); - domClear(el, 1); - - // set the svg root group - this._root = domChild(this._svg, RootIndex, 'g', ns); - for (const attr in rootAttributes) { - this._root.setAttribute(attr, rootAttributes[attr]); - } - - // ensure no additional child elements - domClear(this._svg, RootIndex + 1); - } - - // set background color if defined - this.background(this._bgcolor); - - return base$1.initialize.call(this, el, width, height, padding); -}; - -prototype$O.background = function(bgcolor) { - if (arguments.length && this._svg) { - this._svg.style.setProperty('background-color', bgcolor); - } - return base$1.background.apply(this, arguments); -}; - -prototype$O.resize = function(width, height, origin, scaleFactor) { - base$1.resize.call(this, width, height, origin, scaleFactor); - - if (this._svg) { - this._svg.setAttribute('width', this._width * this._scale); - this._svg.setAttribute('height', this._height * this._scale); - this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height); - this._root.setAttribute('transform', 'translate(' + this._origin + ')'); - } - - this._dirty = []; - - return this; -}; - -prototype$O.canvas = function() { - return this._svg; -}; - -prototype$O.svg = function() { - if (!this._svg) return null; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - var bg = !this._bgcolor ? '' - : (openTag('rect', { - width: this._width, - height: this._height, - fill: this._bgcolor - }) + closeTag('rect')); - - return openTag('svg', attr) - + (this._defs.el ? this._defs.el.outerHTML : '') - + bg - + this._root.outerHTML - + closeTag('svg'); -}; - - -// -- Render entry point -- - -prototype$O._render = function(scene) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._resetDefs(); - this.draw(this._root, scene); - domClear(this._root, 1); - } - - this.updateDefs(); - - this._dirty = []; - ++this._dirtyID; - - return this; -}; - -// -- Manage SVG definitions ('defs') block -- - -prototype$O.updateDefs = function() { - const svg = this._svg, - defs = this._defs; - - let el = defs.el, - index = 0; - - for (const id in defs.gradient) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateGradient(el, defs.gradient[id], index); - } - - for (const id in defs.clipping) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateClipping(el, defs.clipping[id], index); - } - - // clean-up - if (el) { - index === 0 - ? (svg.removeChild(el), defs.el = null) - : domClear(el, index); - } -}; - -function updateGradient(el, grad, index) { - var i, n, stop; - - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - var pt = domChild(el, index++, 'pattern', ns); - pt.setAttribute('id', patternPrefix + grad.id); - pt.setAttribute('viewBox', '0,0,1,1'); - pt.setAttribute('width', '100%'); - pt.setAttribute('height', '100%'); - pt.setAttribute('preserveAspectRatio', 'xMidYMid slice'); - - pt = domChild(pt, 0, 'rect', ns); - pt.setAttribute('width', '1'); - pt.setAttribute('height', '1'); - pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')'); - - el = domChild(el, index++, 'radialGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('fx', grad.x1); - el.setAttribute('fy', grad.y1); - el.setAttribute('fr', grad.r1); - el.setAttribute('cx', grad.x2); - el.setAttribute('cy', grad.y2); - el.setAttribute( 'r', grad.r2); - } else { - el = domChild(el, index++, 'linearGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('x1', grad.x1); - el.setAttribute('x2', grad.x2); - el.setAttribute('y1', grad.y1); - el.setAttribute('y2', grad.y2); - } - - for (i=0, n=grad.stops.length; i { - const dirty = this.isDirty(item), - node = bind(item, parent, sibling, mdef.tag, svg); - - if (dirty) { - this._update(mdef, node, item); - if (isGroup) recurse(this, node, item); - } - - sibling = node; - ++i; - }; - - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } - - domClear(parent, i); - return parent; -}; - -// Recursively process group contents. -function recurse(renderer, el, group) { - el = el.lastChild.previousSibling; - let prev, idx = 0; - - visit(group, item => { - prev = renderer.draw(el, item, prev); - ++idx; - }); - - // remove any extraneous DOM elements - domClear(el, 1 + idx); -} - -// Bind a scenegraph item to an SVG DOM element. -// Create new SVG elements as needed. -function bind(item, el, sibling, tag, svg) { - let node = item._svg, doc; - - // create a new dom node if needed - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, ns); - item._svg = node; - - if (item.mark) { - node.__data__ = item; - node.__values__ = {fill: 'default'}; - - // if group, create background, content, and foreground elements - if (tag === 'g') { - const bg = domCreate(doc, 'path', ns); - node.appendChild(bg); - bg.__data__ = item; - - const cg = domCreate(doc, 'g', ns); - node.appendChild(cg); - cg.__data__ = item; - - const fg = domCreate(doc, 'path', ns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = {fill: 'default'}; - } - } - } - - // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { - el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - } - - return node; -} - -function siblingCheck(node, sibling) { - return node.parentNode - && node.parentNode.childNodes.length > 1 - && node.previousSibling != sibling; // treat null/undefined the same -} - - -// -- Set attributes & styles on SVG elements --- - -var element = null, // temp var for current SVG element - values = null; // temp var for current values hash - -// Extra configuration for certain mark types -var mark_extras = { - group: function(mdef, el, item) { - const fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - - values = el.__values__; // use parent's values hash - element = el.childNodes[1]; - mdef.content(emit, item, this); - - const bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - - const value = item.mark.interactive === false ? 'none' : null; - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - - if (item.strokeForeground && item.stroke) { - const fill = item.fill; - setAttribute(fg, 'display', null); - - // set style of background - this.style(bg, item); - setAttribute(bg, 'stroke', null); - - // set style of foreground - if (fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (fill) item.fill = fill; - - // leave element null to prevent downstream styling - element = null; - } else { - // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - } - }, - image: function(mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else { - setStyle(el, 'image-rendering', null); - } - }, - text: function(mdef, el, item) { - let tl = textLines(item), - key, value, doc, lh; - - if (isArray(tl)) { - // multi-line text - value = tl.map(_ => textValue(item, _)); - key = value.join('\n'); // content cache key - - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach((t, i) => { - const ts = domCreate(doc, 'tspan', ns); - ts.__data__ = item; // data binding - ts.textContent = t; - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } -}; - -function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) { - el.style.removeProperty(name); - } else { - el.style.setProperty(name, value + ''); - } - values[name] = value; - } -} - -prototype$O._update = function(mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; - - // apply aria-specific properties - ariaItemAttributes(emit, item); - - // apply svg attributes - mdef.attr(emit, item, this); - - // some marks need special treatment - const extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); - - // apply svg style attributes - // note: element may be modified by 'extra' method - if (element) this.style(element, item); -}; - -function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; - - // use appropriate method given namespace (ns) - if (ns) { - setAttributeNS(element, name, value, ns); - } else { - setAttribute(element, name, value); - } - - // note current value for future comparison - values[name] = value; -} - -function setAttribute(el, name, value) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttribute(name, value); - } else { - // else remove DOM attribute - el.removeAttribute(name); - } -} - -function setAttributeNS(el, name, value, ns) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - } else { - // else remove DOM attribute - el.removeAttributeNS(ns, name); - } -} - -prototype$O.style = function(el, o) { - if (o == null) return; - - for (const prop in styles) { - let value = prop === 'font' ? fontFamily(o) : o[prop]; - if (value === values[prop]) continue; - - const name = styles[prop]; - if (value == null) { - el.removeAttribute(name); - } else { - if (isGradient(value)) { - value = gradientRef(value, this._defs.gradient, href()); - } - el.setAttribute(name, value + ''); - } - - values[prop] = value; - } -}; - -function href() { - let loc; - return typeof window === 'undefined' ? '' - : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) - : loc.href; -} - -function SVGStringRenderer(loader) { - Renderer.call(this, loader); - - this._text = { - head: '', - bg: '', - root: '', - foot: '', - defs: '', - body: '' - }; - - this._defs = { - gradient: {}, - clipping: {} - }; -} - -var prototype$P = inherits(SVGStringRenderer, Renderer); -var base$2 = Renderer.prototype; - -prototype$P.resize = function(width, height, origin, scaleFactor) { - base$2.resize.call(this, width, height, origin, scaleFactor); - var o = this._origin, - t = this._text; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - t.head = openTag('svg', attr); - - var bg = this._bgcolor; - if (bg === 'transparent' || bg === 'none') bg = null; - - if (bg) { - t.bg = openTag('rect', { - width: this._width, - height: this._height, - fill: bg - }) + closeTag('rect'); - } else { - t.bg = ''; - } - - t.root = openTag('g', extend( - {}, rootAttributes, {transform: 'translate(' + o + ')'} - )); - - t.foot = closeTag('g') + closeTag('svg'); - - return this; -}; - -prototype$P.background = function() { - var rv = base$2.background.apply(this, arguments); - if (arguments.length && this._text.head) { - this.resize(this._width, this._height, this._origin, this._scale); - } - return rv; -}; - -prototype$P.svg = function() { - var t = this._text; - return t.head + t.defs + t.bg + t.root + t.body + t.foot; -}; - -prototype$P._render = function(scene) { - this._text.body = this.mark(scene); - this._text.defs = this.buildDefs(); - return this; -}; - -prototype$P.buildDefs = function() { - let defs = '', tag; - - for (const id in this._defs.gradient) { - const def = this._defs.gradient[id], - stops = def.stops; - - if (def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - - defs += openTag(tag = 'pattern', { - id: patternPrefix + id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - - defs += openTag('rect', { - width: '1', - height: '1', - fill: 'url(#' + id + ')' - }) + closeTag('rect'); - - defs += closeTag(tag); - - defs += openTag(tag = 'radialGradient', { - id: id, - fx: def.x1, - fy: def.y1, - fr: def.r1, - cx: def.x2, - cy: def.y2, - r: def.r2 - }); - } else { - defs += openTag(tag = 'linearGradient', { - id: id, - x1: def.x1, - x2: def.x2, - y1: def.y1, - y2: def.y2 - }); - } - - for (let i = 0; i < stops.length; ++i) { - defs += openTag('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }) + closeTag('stop'); - } - - defs += closeTag(tag); - } - - for (const id in this._defs.clipping) { - const def = this._defs.clipping[id]; - - defs += openTag('clipPath', {id: id}); - - if (def.path) { - defs += openTag('path', { - d: def.path - }) + closeTag('path'); - } else { - defs += openTag('rect', { - x: 0, - y: 0, - width: def.width, - height: def.height - }) + closeTag('rect'); - } - - defs += closeTag('clipPath'); - } - - return defs ? (openTag('defs') + defs + closeTag('defs')) : ''; -}; - -prototype$P.attr = function(scene, item, attrs, tag) { - const object = {}, - emit = (name, value, ns, prefixed) => { - object[prefixed || name] = value; - }; - - // apply mark specific attributes - if (Array.isArray(attrs)) { - attrs.forEach(fn => fn(emit, item, this)); - } else { - attrs(emit, item, this); - } - - // apply style attributes - if (tag) { - applyStyles(object, item, scene, tag, this._defs); - } - - return object; -}; - -prototype$P.href = function(item) { - var that = this, - href = item.href, - attr; - - if (href) { - if (attr = that._hrefs && that._hrefs[href]) { - return attr; - } else { - that.sanitizeURL(href).then(attr => { - // rewrite to use xlink namespace - // note that this will be deprecated in SVG 2.0 - attr['xlink:href'] = attr.href; - attr.href = null; - (that._hrefs || (that._hrefs = {}))[href] = attr; - }); - } - } - return null; -}; - -prototype$P.mark = function(scene) { - const mdef = Marks[scene.marktype], - tag = mdef.tag, - attrList = [ariaItemAttributes, mdef.attr]; - - let str = ''; - - // render opening group tag - str += openTag('g', extend( - { - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip(this, scene, scene.group) : null - }, - ariaMarkAttributes(scene), - { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - } - )); - - // render contained elements - const process = item => { - const href = this.href(item); - if (href) str += openTag('a', href); - - str += openTag( - tag, - this.attr(scene, item, attrList, tag !== 'g' ? tag : null) - ); - - if (tag === 'text') { - const tl = textLines(item); - if (isArray(tl)) { - // multi-line text - const attrs = {x: 0, dy: lineHeight(item)}; - for (let i=0; i { str += this.mark(item); }); - return str; -}; - -function applyStyles(s, item, scene, tag, defs) { - if (item == null) return s; - - if (tag === 'bgrect' && scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - if (tag === 'bgfore') { - if (scene.interactive === false) { - s['pointer-events'] = 'none'; - } - s.display = 'none'; - if (item.fill !== null) return s; - } - - if (tag === 'image' && item.smooth === false) { - s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;'; - } - - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - if (item.fontStyle) s['font-style'] = item.fontStyle; - if (item.fontVariant) s['font-variant'] = item.fontVariant; - if (item.fontWeight) s['font-weight'] = item.fontWeight; - } - - for (const prop in styles) { - let value = item[prop]; - const name = styles[prop]; - - if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; else if (value != null) { - if (isGradient(value)) { - value = gradientRef(value, defs.gradient, ''); - } - s[name] = value; - } - } - - return s; -} - -function escape_text(s) { - return s.replace(/&/g, '&') - .replace(//g, '>'); -} - -var Canvas = 'canvas'; -var PNG = 'png'; -var SVG = 'svg'; -var None$2 = 'none'; - -var RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - None: None$2 -}; - -var modules = {}; - -modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler -}; - -modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler -}; - -modules[None$2] = {}; - -function renderModule(name, _) { - name = String(name || '').toLowerCase(); - if (arguments.length > 1) { - modules[name] = _; - return this; - } else { - return modules[name]; - } -} - -function intersect(scene, bounds, filter) { - const hits = [], // intersection results - box = new Bounds().union(bounds), // defensive copy - type = scene.marktype; - - return type ? intersectMark(scene, box, filter, hits) - : type === 'group' ? intersectGroup(scene, box, filter, hits) - : error('Intersect scene must be mark node or group item.'); -} - -function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - const items = mark.items, - type = mark.marktype, - n = items.length; - - let i = 0; - - if (type === 'group') { - for (; i= 0; i--) { - if (ka[i] != kb[i]) return false; - } - - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; - } - - return typeof a === typeof b; -} - -function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); -} - -/** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ -function Bound(params) { - Transform.call(this, null, params); -} - -var prototype$Q = inherits(Bound, Transform); - -prototype$Q.transform = function(_, pulse) { - var view = pulse.dataflow, - mark = _.mark, - type = mark.marktype, - entry = Marks[type], - bound = entry.bound, - markBounds = mark.bounds, rebound; - - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem$1(mark, bound); - mark.items.forEach(function(item) { - item.bounds.clear().union(markBounds); - }); - } - - else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, item => view.dirty(item)); - markBounds.clear(); - mark.items.forEach(item => markBounds.union(boundItem$1(item, bound))); - - // force reflow for axes/legends/titles to propagate any layout changes - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } - - else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - - pulse.visit(pulse.ADD, item => { - markBounds.union(boundItem$1(item, bound)); - }); - - pulse.visit(pulse.MOD, item => { - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem$1(item, bound)); - }); - - if (rebound) { - markBounds.clear(); - mark.items.forEach(item => markBounds.union(item.bounds)); - } - } - - // ensure mark bounds do not exceed any clipping region - boundClip(mark); - - return pulse.modifies('bounds'); -}; - -function boundItem$1(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); -} - -var COUNTER_NAME = ':vega_identifier:'; - -/** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ -function Identifier(params) { - Transform.call(this, 0, params); -} - -Identifier.Definition = { - 'type': 'Identifier', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'as', 'type': 'string', 'required': true } - ] -}; - -var prototype$R = inherits(Identifier, Transform); - -prototype$R.transform = function(_, pulse) { - var counter = getCounter(pulse.dataflow), - id = counter.value, - as = _.as; - - pulse.visit(pulse.ADD, t => { - if (!t[as]) t[as] = ++id; - }); - - counter.set(this.value = id); - return pulse; -}; - -function getCounter(view) { - var counter = view._signals[COUNTER_NAME]; - if (!counter) { - view._signals[COUNTER_NAME] = (counter = view.add(0)); - } - return counter; -} - -/** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ -function Mark(params) { - Transform.call(this, null, params); -} - -var prototype$S = inherits(Mark, Transform); - -prototype$S.transform = function(_, pulse) { - var mark = this.value; - - // acquire mark on first invocation, bind context and group - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } - - // initialize entering items - var Init = mark.marktype === Group ? GroupItem : Item; - pulse.visit(pulse.ADD, item => Init.call(item, mark)); - - // update clipping and/or interactive status - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - pulse.reflow(); - } - - // bind items array to scenegraph mark - mark.items = pulse.source; - return pulse; -}; - -function lookup$1(_) { - var g = _.groups, p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) - : g && p ? g.lookup(p) - : null; -} - -/** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ -function Overlap(params) { - Transform.call(this, null, params); -} - -var prototype$T = inherits(Overlap, Transform); - -var methods = { - parity: items => { - return items.filter((item, i) => i % 2 ? (item.opacity = 0) : 1); - }, - greedy: (items, sep) => { - var a; - return items.filter((b, i) => { - if (!i || !intersect$1(a.bounds, b.bounds, sep)) { - a = b; - return 1; - } else { - return b.opacity = 0; - } - }); - } -}; - -// compute bounding box intersection -// including padding pixels of separation -function intersect$1(a, b, sep) { - return sep > Math.max( - b.x1 - a.x2, - a.x1 - b.x2, - b.y1 - a.y2, - a.y1 - b.y2 - ); -} - -function hasOverlap(items, pad) { - for (var i=1, n=items.length, a=items[0].bounds, b; i 1 && b.height() > 1; -} - -function boundTest(scale, orient, tolerance) { - var range = scale.range(), - b = new Bounds(); - - if (orient === Top || orient === Bottom) { - b.set(range[0], -Infinity, range[1], +Infinity); - } else { - b.set(-Infinity, range[0], +Infinity, range[1]); - } - b.expand(tolerance || 1); - - return item => b.encloses(item.bounds); -} - -// reset all items to be fully opaque -function reset(source) { - source.forEach(item => item.opacity = 1); - return source; -} - -// add all tuples to mod, fork pulse if parameters were modified -// fork prevents cross-stream tuple pollution (e.g., pulse from scale) -function reflow(pulse, _) { - return pulse.reflow(_.modified()).modifies('opacity'); -} - -prototype$T.transform = function(_, pulse) { - var reduce = methods[_.method] || methods.parity, - source = pulse.materialize(pulse.SOURCE).source, - sep = _.separation || 0, - items, test, bounds; - - if (!source || !source.length) return; - - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - return pulse; - } - - // skip labels with no content - source = source.filter(hasBounds); - - // early exit, nothing to do - if (!source.length) return; - - if (_.sort) { - source = source.slice().sort(_.sort); - } - - items = reset(source); - pulse = reflow(pulse, _); - - if (items.length >= 3 && hasOverlap(items, sep)) { - do { - items = reduce(items, sep); - } while (items.length >= 3 && hasOverlap(items, sep)); - - if (items.length < 3 && !peek(source).opacity) { - if (items.length > 1) peek(items).opacity = 0; - peek(source).opacity = 1; - } - } - - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach(item => { - if (!test(item)) item.opacity = 0; - }); - } - - // re-calculate mark bounds - bounds = items[0].mark.bounds.clear(); - source.forEach(item => { - if (item.opacity) bounds.union(item.bounds); - }); - - return pulse; -}; - -/** - * Queue modified scenegraph items for rendering. - * @constructor - */ -function Render(params) { - Transform.call(this, null, params); -} - -var prototype$U = inherits(Render, Transform); - -prototype$U.transform = function(_, pulse) { - var view = pulse.dataflow; - - pulse.visit(pulse.ALL, item => view.dirty(item)); - - // set z-index dirty flag as needed - if (pulse.fields && pulse.fields['zindex']) { - var item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } -}; - -const tempBounds$1 = new Bounds(); - -function set$1(item, property, value) { - return item[property] === value ? 0 - : (item[property] = value, 1); -} - -function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; -} - -function axisIndices(datum) { - var index = +datum.grid; - return [ - datum.ticks ? index++ : -1, // ticks index - datum.labels ? index++ : -1, // labels index - index + (+datum.domain) // title index - ]; -} - -function axisLayout(view, axis, width, height) { - var item = axis.items[0], - datum = item.datum, - delta = item.translate != null ? item.translate : 0.5, - orient = item.orient, - indices = axisIndices(datum), - range = item.range, - offset = item.offset, - position = item.position, - minExtent = item.minExtent, - maxExtent = item.maxExtent, - title = datum.title && item.items[indices[2]].items[0], - titlePadding = item.titlePadding, - bounds = item.bounds, - dl = title && multiLineOffset(title), - x = 0, y = 0, i, s; - - tempBounds$1.clear().union(bounds); - bounds.clear(); - if ((i=indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i=indices[1]) > -1) bounds.union(item.items[i].bounds); - - // position axis group and title - switch (orient) { - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - default: - x = item.x; - y = item.y; - } - - // update bounds - boundStroke(bounds.translate(x, y), item); - - if (set$1(item, 'x', x + delta) | set$1(item, 'y', y + delta)) { - item.bounds = tempBounds$1; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - - return item.mark.bounds.clear().union(bounds); -} - -function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - const b = title.bounds; - - if (title.auto) { - const v = sign * (offset + dl + pad); - let dx = 0, dy = 0; - - view.dirty(title); - isYAxis - ? dx = (title.x || 0) - (title.x = v) - : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - - bounds.union(b); -} - -// aggregation functions for grid margin determination -const min$1 = (a, b) => Math.floor(Math.min(a, b)); -const max$1 = (a, b) => Math.ceil(Math.max(a, b)); - -function gridLayoutGroups(group) { - var groups = group.items, - n = groups.length, - i = 0, mark, items; - - var views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; - - // layout axes, gather legends, collect bounds - for (; i 1) { - for (i=0; i 0) dx[i] += x / 2; - } - } - - // perform vertical centering - if (alignRow && get$3(opt.center, Row) && ncols !== 1) { - for (i=0; i 0) dy[i] += y / 2; - } - } - - // position grid relative to anchor - for (i=0; i limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } - - // apply offset - init += offset; - - // clear mark bounds for all headers - for (j=0, m=headers.length; j= 0 && (g = groups[k]) == null; k-=back); - - // assign coordinates and update bounds - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); - - // update current edge of layout bounds - edge = agg(edge, b[bf]); - } - - return edge; -} - -function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); - - // compute title coordinates - var x = offset, y = offset; - isX - ? (x = Math.round(bounds.x1 + band * bounds.width())) - : (y = Math.round(bounds.y1 + band * bounds.height())); - - // assign coordinates and update bounds - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; - - // queue title for redraw - view.dirty(g); -} - -// utility for looking up legend layout configuration -function lookup$2(config, orient) { - const opt = config[orient] || {}; - return (key, d) => opt[key] != null ? opt[key] - : config[key] != null ? config[key] - : d; -} - -// if legends specify offset directly, use the maximum specified value -function offsets(legends, value) { - var max = -Infinity; - legends.forEach(item => { - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; -} - -function legendParams(g, orient, config, xb, yb, w, h) { - const _ = lookup$2(config, orient), - offset = offsets(g, _('offset', 0)), - anchor = _('anchor', Start), - mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - - const p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - - switch (orient) { - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, column: End, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, row: End, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case TopLeft: - p.anchor = {x: offset, y: offset}; - break; - case TopRight: - p.anchor = {x: w - offset, y: offset, column: End}; - break; - case BottomLeft: - p.anchor = {x: offset, y: h - offset, row: End}; - break; - case BottomRight: - p.anchor = {x: w - offset, y: h - offset, column: End, row: End}; - break; - } - - return p; -} - -function legendLayout(view, legend) { - var item = legend.items[0], - datum = item.datum, - orient = item.orient, - bounds = item.bounds, - x = item.x, y = item.y, w, h; - - // cache current bounds for later comparison - item._bounds - ? item._bounds.clear().union(bounds) - : item._bounds = bounds.clone(); - bounds.clear(); - - // adjust legend to accommodate padding and title - legendGroupLayout(view, item, item.items[0].items[0]); - - // aggregate bounds to determine size, and include origin - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - - if (datum.type === Symbols) { - legendEntryLayout(item.items[0].items[0].items[0].items); - } - - if (orient !== None$1) { - item.x = x = 0; - item.y = y = 0; - } - item.width = w; - item.height = h; - boundStroke(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - - return item; -} - -function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach(_ => b.union(_.bounds)); - - // anchor to legend origin - b.x1 = item.padding; - b.y1 = item.padding; - - return b; -} - -function legendGroupLayout(view, item, entry) { - var pad = item.padding, - ex = pad - entry.x, - ey = pad - entry.y; - - if (!item.datum.title) { - if (ex || ey) translate$1(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], - anchor = title.anchor, - tpad = item.titlePadding || 0, - tx = pad - title.x, - ty = pad - title.y; - - switch (title.orient) { - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - case Right: - case Bottom: - break; - default: - ey += title.bounds.height() + tpad; - } - if (ex || ey) translate$1(view, entry, ex, ey); - - switch (title.orient) { - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - if (tx || ty) translate$1(view, title, tx, ty); - - // translate legend if title pushes into negative coordinates - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate$1(view, entry, -tx, 0); - translate$1(view, title, -tx, 0); - } - } -} - -function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - const grad = item.datum.type !== 'symbol', - vgrad = title.datum.vgrad, - e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, - s = e.bounds[y ? 'y2' : 'x2'] - item.padding, - u = vgrad && lr ? s : 0, - v = vgrad && lr ? 0 : s, - o = y <= 0 ? 0 : multiLineOffset(title); - - return Math.round(anchor === Start ? u - : anchor === End ? (v - o) - : 0.5 * (s - o)); -} - -function translate$1(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); -} - -function legendEntryLayout(entries) { - // get max widths for each column - var widths = entries.reduce((w, g) => { - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); - - // set dimensions of legend entry groups - entries.forEach(g => { - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); -} - -function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], - frame = group.frame, - orient = group.orient, - anchor = group.anchor, - offset = group.offset, - padding = group.padding, - title = group.items[0].items[0], - subtitle = group.items[1] && group.items[1].items[0], - end = (orient === Left || orient === Right) ? height : width, - start = 0, x = 0, y = 0, sx = 0, sy = 0, pos; - - if (frame !== Group) { - orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) - : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) - : (start = viewBounds.x1, end = viewBounds.x2); - } else if (orient === Left) { - start = height, end = 0; - } - - pos = (anchor === Start) ? start - : (anchor === End) ? end - : (start + end) / 2; - - if (subtitle && subtitle.text) { - // position subtitle - switch (orient) { - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - case Left: - sx = title.bounds.width() + padding; - break; - case Right: - sx = -title.bounds.width() - padding; - break; - } - - tempBounds$1.clear().union(subtitle.bounds); - tempBounds$1.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - if (set$1(subtitle, 'x', sx) | set$1(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds$1); - subtitle.mark.bounds.clear().union(tempBounds$1); - view.dirty(subtitle); - } - - tempBounds$1.clear().union(subtitle.bounds); - } else { - tempBounds$1.clear(); - } - tempBounds$1.union(title.bounds); - - // position title group - switch (orient) { - case Top: - x = pos; - y = viewBounds.y1 - tempBounds$1.height() - offset; - break; - case Left: - x = viewBounds.x1 - tempBounds$1.width() - offset; - y = pos; - break; - case Right: - x = viewBounds.x2 + tempBounds$1.width() + offset; - y = pos; - break; - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - default: - x = group.x; - y = group.y; - } - - if (set$1(group, 'x', x) | set$1(group, 'y', y)) { - tempBounds$1.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds$1); - mark.bounds.clear().union(tempBounds$1); - view.dirty(group); - } - return group.bounds; -} - -/** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ -function ViewLayout(params) { - Transform.call(this, null, params); -} - -var prototype$V = inherits(ViewLayout, Transform); - -prototype$V.transform = function(_, pulse) { - var view = pulse.dataflow; - _.mark.items.forEach(group => { - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; -}; - -function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; -} - -function layoutGroup(view, group, _) { - var items = group.items, - width = Math.max(0, group.width || 0), - height = Math.max(0, group.height || 0), - viewBounds = new Bounds().set(0, 0, width, height), - xBounds = viewBounds.clone(), - yBounds = viewBounds.clone(), - legends = [], title, - mark, orient, b, i, n; - - // layout axes, gather legends, collect bounds - for (i=0, n=items.length; i { - orient = item.orient || Right; - if (orient !== None$1) (l[orient] || (l[orient] = [])).push(item); - }); - - // perform grid layout for each orient group - for (let orient in l) { - const g = l[orient]; - gridLayout(view, g, legendParams( - g, orient, _.legends, xBounds, yBounds, width, height - )); - } - - // update view bounds - legends.forEach(item => { - const b = item.bounds; - - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - item.bounds = b; - view.dirty(item); - } - - if (_.autosize && _.autosize.type === Fit) { - // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch(item.orient) { - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - } else { - viewBounds.union(b); - } - }); - } - - // combine bounding boxes - viewBounds.union(xBounds).union(yBounds); - - // layout title, adjust bounds - if (title) { - viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - } - - // override aggregated view bounds if content is clipped - if (group.clip) { - viewBounds.set(0, 0, group.width || 0, group.height || 0); - } - - // perform size adjustment - viewSizeLayout(view, group, viewBounds, _); -} - -function viewSizeLayout(view, group, viewBounds, _) { - const auto = _.autosize || {}, - type = auto.type; - - if (view._autosize < 1 || !type) return; - - let viewWidth = view._width, - viewHeight = view._height, - width = Math.max(0, group.width || 0), - left = Math.max(0, Math.ceil(-viewBounds.x1)), - right = Math.max(0, Math.ceil(viewBounds.x2 - width)), - height = Math.max(0, group.height || 0), - top = Math.max(0, Math.ceil(-viewBounds.y1)), - bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - - if (auto.contains === Padding) { - const padding = view.padding(); - viewWidth -= padding.left + padding.right; - viewHeight -= padding.top + padding.bottom; - } - - if (type === None$1) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } - - else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } - - else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - - view._resizeView( - viewWidth, viewHeight, - width, height, - [left, top], - auto.resize - ); -} - -var vtx = /*#__PURE__*/Object.freeze({ - __proto__: null, - bound: Bound, - identifier: Identifier, - mark: Mark, - overlap: Overlap, - render: Render, - viewlayout: ViewLayout -}); - -/** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ -function AxisTicks(params) { - Transform.call(this, null, params); -} - -var prototype$W = inherits(AxisTicks, Transform); - -prototype$W.transform = function(_, pulse) { - if (this.value && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - ticks = this.value, - scale = _.scale, - tally = _.count == null ? (_.values ? _.values.length : 10) : _.count, - count = tickCount(scale, tally, _.minstep), - format = _.format || tickFormat$1(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), - values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count); - - if (ticks) out.rem = ticks; - - ticks = values.map(function(value, i) { - return ingest({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - }); - }); - - if (_.extra && ticks.length) { - // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push(ingest({ - index: -1, - extra: {value: ticks[0].value}, - label: '' - })); - } - - out.source = ticks; - out.add = ticks; - this.value = ticks; - - return out; -}; - -/** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ -function DataJoin(params) { - Transform.call(this, null, params); -} - -var prototype$X = inherits(DataJoin, Transform); - -function defaultItemCreate() { - return ingest({}); -} - -function newMap(key) { - const map = fastmap().test(t => t.exit); - map.lookup = t => map.get(key(t)); - return map; -} - -prototype$X.transform = function(_, pulse) { - var df = pulse.dataflow, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - item = _.item || defaultItemCreate, - key = _.key || tupleid, - map = this.value; - - // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - if (isArray(out.encode)) { - out.encode = null; - } - - if (map && (_.modified('key') || pulse.modified(key))) { - error('DataJoin does not support modified key function or fields.'); - } - - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - - pulse.visit(pulse.ADD, t => { - const k = key(t); - let x = map.get(k); - - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else { - out.mod.push(x); - } - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - - x.datum = t; - x.exit = false; - }); - - pulse.visit(pulse.MOD, t => { - const k = key(t), - x = map.get(k); - - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - - pulse.visit(pulse.REM, t => { - const k = key(t), - x = map.get(k); - - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) { - df.runAfter(map.clean); - } - - return out; -}; - -/** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ -function Encode(params) { - Transform.call(this, null, params); -} - -var prototype$Y = inherits(Encode, Transform); - -prototype$Y.transform = function(_, pulse) { - var out = pulse.fork(pulse.ADD_REM), - fmod = _.mod || false, - encoders = _.encoders, - encode = pulse.encode; - - // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - if (isArray(encode)) { - if (out.changed() || encode.every(function(e) { return encoders[e]; })) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else { - return pulse.StopPropagation; - } - } - - // marshall encoder functions - var reenter = encode === 'enter', - update = encoders.update || falsy, - enter = encoders.enter || falsy, - exit = encoders.exit || falsy, - set = (encode && !reenter ? encoders[encode] : update) || falsy; - - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, function(t) { enter(t, _); update(t, _); }); - out.modifies(enter.output); - out.modifies(update.output); - if (set !== falsy && set !== update) { - pulse.visit(pulse.ADD, function(t) { set(t, _); }); - out.modifies(set.output); - } - } - - if (pulse.changed(pulse.REM) && exit !== falsy) { - pulse.visit(pulse.REM, function(t) { exit(t, _); }); - out.modifies(exit.output); - } - - if (reenter || set !== falsy) { - var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - if (reenter) { - pulse.visit(flag, function(t) { - var mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else { - pulse.visit(flag, function(t) { - if (set(t, _) || fmod) out.mod.push(t); - }); - } - if (out.mod.length) out.modifies(set.output); - } - - return out.changed() ? out : pulse.StopPropagation; -}; - -/** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ -function LegendEntries(params) { - Transform.call(this, [], params); -} - -var prototype$Z = inherits(LegendEntries, Transform); - -prototype$Z.transform = function(_, pulse) { - if (this.value != null && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - items = this.value, - type = _.type || SymbolLegend, - scale = _.scale, - limit = +_.limit, - count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep), - lskip = !!_.values || type === SymbolLegend, - format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), - values = _.values || labelValues(scale, count), - domain, fraction, size, offset, ellipsis; - - if (items) out.rem = items; - - if (type === SymbolLegend) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else { - items = values; - } - - if (isFunction(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) { - items = items.slice(1); - } - // compute size offset for legend entries - offset = items.reduce(function(max, value) { - return Math.max(max, size(value, _)); - }, 0); - } else { - size = constant(offset = size || 8); - } - - items = items.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - }); - }); - - if (ellipsis) { - ellipsis = values[items.length]; - items.push(ingest({ - index: items.length, - label: `\u2026${values.length-items.length} entries`, - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } - - else if (type === GradientLegend) { - domain = scale.domain(), - fraction = scaleFraction(scale, domain[0], peek(domain)); - - // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - if (values.length < 3 && !_.values && domain[0] !== peek(domain)) { - values = [domain[0], peek(domain)]; - } - - items = values.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - }); - }); - } - - else { - size = values.length - 1; - fraction = labelFraction(scale); - - items = values.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index+1]) - }); - }); - } - - out.source = items; - out.add = items; - this.value = items; - - return out; -}; - -var Paths = fastmap({ - 'line': line$2, - 'line-radial': lineR, - 'arc': arc$2, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR -}); - -function sourceX(t) { return t.source.x; } -function sourceY(t) { return t.source.y; } -function targetX(t) { return t.target.x; } -function targetY(t) { return t.target.y; } - - /** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ -function LinkPath(params) { - Transform.call(this, {}, params); -} - -LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sourceX', 'type': 'field', 'default': 'source.x' }, - { 'name': 'sourceY', 'type': 'field', 'default': 'source.y' }, - { 'name': 'targetX', 'type': 'field', 'default': 'target.x' }, - { 'name': 'targetY', 'type': 'field', 'default': 'target.y' }, - { 'name': 'orient', 'type': 'enum', 'default': 'vertical', - 'values': ['horizontal', 'vertical', 'radial'] }, - { 'name': 'shape', 'type': 'enum', 'default': 'line', - 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal'] }, - { 'name': 'require', 'type': 'signal' }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] -}; - -var prototype$_ = inherits(LinkPath, Transform); - -prototype$_.transform = function(_, pulse) { - var sx = _.sourceX || sourceX, - sy = _.sourceY || sourceY, - tx = _.targetX || targetX, - ty = _.targetY || targetY, - as = _.as || 'path', - orient = _.orient || 'vertical', - shape = _.shape || 'line', - path = Paths.get(shape + '-' + orient) || Paths.get(shape); - - if (!path) { - error('LinkPath unsupported type: ' + _.shape - + (_.orient ? '-' + _.orient : '')); - } - - pulse.visit(pulse.SOURCE, function(t) { - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - - return pulse.reflow(_.modified()).modifies(as); -}; - -// -- Link Path Generation Methods ----- - -function line$2(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'L' + tx + ',' + ty; -} - -function lineR(sa, sr, ta, tr) { - return line$2( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); -} - -function arc$2(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - rr = Math.sqrt(dx * dx + dy * dy) / 2, - ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + - 'A' + rr + ',' + rr + - ' ' + ra + ' 0 1' + - ' ' + tx + ',' + ty; -} - -function arcR(sa, sr, ta, tr) { - return arc$2( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); -} - -function curve(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - ix = 0.2 * (dx + dy), - iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + - 'C' + (sx+ix) + ',' + (sy+iy) + - ' ' + (tx+iy) + ',' + (ty-ix) + - ' ' + tx + ',' + ty; -} - -function curveR(sa, sr, ta, tr) { - return curve( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); -} - -function orthoX(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'V' + ty + 'H' + tx; -} - -function orthoY(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'H' + tx + 'V' + ty; -} - -function orthoR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'A' + sr + ',' + sr + ' 0 0,' + (sf?1:0) + - ' ' + (sr*tc) + ',' + (sr*ts) + - 'L' + (tr*tc) + ',' + (tr*ts); -} - -function diagonalX(sx, sy, tx, ty) { - var m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + - 'C' + m + ',' + sy + - ' ' + m + ',' + ty + - ' ' + tx + ',' + ty; -} - -function diagonalY(sx, sy, tx, ty) { - var m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + - 'C' + sx + ',' + m + - ' ' + tx + ',' + m + - ' ' + tx + ',' + ty; -} - -function diagonalR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - mr = (sr + tr) / 2; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'C' + (mr*sc) + ',' + (mr*ss) + - ' ' + (mr*tc) + ',' + (mr*ts) + - ' ' + (tr*tc) + ',' + (tr*ts); -} - -/** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ -function Pie(params) { - Transform.call(this, null, params); -} - -Pie.Definition = { - 'type': 'Pie', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'startAngle', 'type': 'number', 'default': 0 }, - { 'name': 'endAngle', 'type': 'number', 'default': 6.283185307179586 }, - { 'name': 'sort', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['startAngle', 'endAngle'] } - ] -}; - -var prototype$$ = inherits(Pie, Transform); - -prototype$$.transform = function(_, pulse) { - var as = _.as || ['startAngle', 'endAngle'], - startAngle = as[0], - endAngle = as[1], - field = _.field || one, - start = _.startAngle || 0, - stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, - data = pulse.source, - values = data.map(field), - n = values.length, - a = start, - k = (stop - start) / sum(values), - index = sequence(n), - i, t, v; - - if (_.sort) { - index.sort(function(a, b) { - return values[a] - values[b]; - }); - } - - for (i=0; i -1) return raw; - - var domain = _.domain, - type = scale.type, - zero = _.zero || (_.zero === undefined && includeZero(scale)), - n, mid; - - if (!domain) return 0; - - // adjust continuous domain for minimum pixel padding - if (includePad(type) && _.padding && domain[0] !== peek(domain)) { - domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - } - - // adjust domain based on zero, min, max settings - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = ((domain = domain.slice()).length - 1) || 1; - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - - if (_.domainMid != null) { - mid = _.domainMid; - const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } - - // set the scale domain - scale.domain(domainCheck(type, domain, df)); - - // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - if (type === Ordinal) { - scale.unknown(_.domainImplicit ? implicit : undefined); - } - - // perform 'nice' adjustment as requested - if (_.nice && scale.nice) { - scale.nice((_.nice !== true && tickCount(scale, _.nice)) || null); - } - - // return the cardinality of the domain - return domain.length; -} - -function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else { - return -1; - } -} - -function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs(peek(range) - range[0]), - frac = span / (span - 2 * pad), - d = type === Log ? zoomLog(domain, null, frac) - : type === Sqrt ? zoomPow(domain, null, frac, 0.5) - : type === Pow ? zoomPow(domain, null, frac, exponent || 1) - : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) - : zoomLinear(domain, null, frac); - - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length-1] = d[1]; - return domain; -} - -function domainCheck(type, domain, df) { - if (isLogarithmic(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce(function(s, v) { - return s + (v < 0 ? -1 : v > 0 ? 1 : 0); - }, 0)); - - if (s !== domain.length) { - df.warn('Log scale domain includes zero: ' + $(domain)); - } - } - return domain; -} - -function configureBins(scale, _, count) { - let bins = _.bins; - - if (bins && !isArray(bins)) { - // generate bin boundary array - let domain = scale.domain(), - lo = domain[0], - hi = peek(domain), - start = bins.start == null ? lo : bins.start, - stop = bins.stop == null ? hi : bins.stop, - step = bins.step; - - if (!step) error('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (stop > hi) stop = step * Math.floor(hi / step); - bins = sequence(start, stop + step / 2, step); - } - - if (bins) { - // assign bin boundaries to scale instance - scale.bins = bins; - } else if (scale.bins) { - // no current bins, remove bins if previously set - delete scale.bins; - } - - // special handling for bin-ordinal scales - if (scale.type === BinOrdinal) { - if (!bins) { - // the domain specifies the bins - scale.bins = scale.domain(); - } else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } - - // return domain cardinality - return count; -} - -function configureRange(scale, _, count) { - var type = scale.type, - round = _.round || false, - range = _.range; - - // if range step specified, calculate full range extent - if (_.rangeStep != null) { - range = configureRangeStep(type, _, count); - } - - // else if a range scheme is defined, use that - else if (_.scheme) { - range = configureScheme(type, _, count); - if (isFunction(range)) { - if (scale.interpolator) { - return scale.interpolator(range); - } else { - error(`Scale type ${type} does not support interpolating color schemes.`); - } - } - } - - // given a range array for an interpolating scale, convert to interpolator - if (range && isInterpolating(type)) { - return scale.interpolator( - interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma) - ); - } - - // configure rounding / interpolation - if (range && _.interpolate && scale.interpolate) { - scale.interpolate(interpolate(_.interpolate, _.interpolateGamma)); - } else if (isFunction(scale.round)) { - scale.round(round); - } else if (isFunction(scale.rangeRound)) { - scale.interpolate(round ? interpolateRound : interpolate$1); - } - - if (range) scale.range(flip(range, _.reverse)); -} - -function configureRangeStep(type, _, count) { - if (type !== Band && type !== Point) { - error('Only band and point scales support rangeStep.'); - } - - // calculate full range based on requested step size and padding - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, - inner = type === Point ? 1 - : ((_.paddingInner != null ? _.paddingInner : _.padding) || 0); - return [0, _.rangeStep * bandSpace(count, inner, outer)]; -} - -function configureScheme(type, _, count) { - var extent = _.schemeExtent, - name, scheme$1; - - if (isArray(_.scheme)) { - scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); - } else { - name = _.scheme.toLowerCase(); - scheme$1 = scheme(name); - if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`); - } - - // determine size for potential discrete range - count = (type === Threshold) ? count + 1 - : (type === BinOrdinal) ? count - 1 - : (type === Quantile$1 || type === Quantize) ? (+_.schemeCount || DEFAULT_COUNT) - : count; - - // adjust and/or quantize scheme as appropriate - return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) - : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) - : type === Ordinal ? scheme$1 : scheme$1.slice(0, count); -} - -function adjustScheme(scheme, extent, reverse) { - return (isFunction(scheme) && (extent || reverse)) - ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) - : scheme; -} - -function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; -} - -/** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ -function SortItems(params) { - Transform.call(this, null, params); -} - -var prototype$11 = inherits(SortItems, Transform); - -prototype$11.transform = function(_, pulse) { - var mod = _.modified('sort') - || pulse.changed(pulse.ADD) - || pulse.modified(_.sort.fields) - || pulse.modified('datum'); - - if (mod) pulse.source.sort(stableCompare(_.sort)); - - this.modified(mod); - return pulse; -}; - -var Zero = 'zero', - Center = 'center', - Normalize = 'normalize', - DefOutput = ['y0', 'y1']; - -/** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ -function Stack(params) { - Transform.call(this, null, params); -} - -Stack.Definition = { - 'type': 'Stack', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'offset', 'type': 'enum', 'default': Zero, 'values': [Zero, Center, Normalize] }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': DefOutput } - ] -}; - -var prototype$12 = inherits(Stack, Transform); - -prototype$12.transform = function(_, pulse) { - var as = _.as || DefOutput, - y0 = as[0], - y1 = as[1], - sort = stableCompare(_.sort), - field = _.field || one, - stack = _.offset === Center ? stackCenter - : _.offset === Normalize ? stackNormalize - : stackZero, - groups, i, n, max; - - // partition, sum, and sort the stack groups - groups = partition$2(pulse.source, _.groupby, sort, field); - - // compute stack layouts per group - for (i=0, n=groups.length, max=groups.max; i max) max = s; - if (sort) g.sort(sort); - } - groups.max = max; - - return groups; -} - -var encode = /*#__PURE__*/Object.freeze({ - __proto__: null, - axisticks: AxisTicks, - datajoin: DataJoin, - encode: Encode, - legendentries: LegendEntries, - linkpath: LinkPath, - pie: Pie, - scale: Scale, - sortitems: SortItems, - stack: Stack -}); - -function noop$2() {} - -const cases = [ - [], - [[[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]]], - [] -]; - -// Implementation adapted from d3/d3-contour. Thanks! -function contours() { - var dx = 1, - dy = 1, - smooth = smoothLinear; - - function contours(values, tz) { - return tz.map(value => 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.js - function contour(values, value) { - var polygons = [], - holes = []; - - isorings(values, value, function(ring) { - smooth(ring, values, value); - if (area$2(ring) > 0) polygons.push([ring]); - else holes.push(ring); - }); - - holes.forEach(function(hole) { - for (var i = 0, n = polygons.length, polygon; i < n; ++i) { - if (contains((polygon = polygons[i])[0], hole) !== -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/stitch.js - function isorings(values, value, callback) { - var fragmentByStart = new Array, - fragmentByEnd = new Array, - x, y, t0, t1, t2, t3; - - // Special case for the first row (y = -1, t2 = t3 = 0). - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - - // General case for the intermediate rows. - while (++y < dy - 1) { - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - - // Special case for the last row (y = dy - 1, t0 = t1 = 0). - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - - function stitch(line) { - var start = [line[0][0] + x, line[0][1] + y], - end = [line[1][0] + x, line[1][1] + y], - startIndex = index(start), - endIndex = index(end), - f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[f.start] = fragmentByEnd[g.end] = {start: f.start, end: g.end, ring: f.ring.concat(g.ring)}; - } - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[g.start] = fragmentByEnd[f.end] = {start: g.start, end: f.end, ring: g.ring.concat(f.ring)}; - } - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else { - fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {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 = point[0], - y = point[1], - xt = x | 0, - yt = y | 0, - v0, - v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); - } - - contours.contour = contour; - - contours.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, contours; - }; - - contours.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop$2, contours) : smooth === smoothLinear; - }; - - return contours; -} - -function area$2(ring) { - var i = 0, - n = ring.length, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area; -} - -function contains(ring, hole) { - var i = -1, n = hole.length, c; - while (++i < n) if (c = ringContains(ring, hole[i])) return c; - return 0; -} - -function ringContains(ring, point) { - var x = point[0], y = point[1], contains = -1; - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) contains = -contains; - } - return contains; -} - -function segmentContains(a, b, c) { - var i; return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); -} - -function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); -} - -function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; -} - -function quantize$1(k, nice, zero) { - return function(values) { - var ex = extent(values), - start = zero ? Math.min(ex[0], 0) : ex[0], - stop = ex[1], - span = stop - start, - step = nice ? tickStep(start, stop, k) : (span / (k + 1)); - return sequence(step, stop, step); - }; -} - -/** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ -function Isocontour(params) { - Transform.call(this, null, params); -} - -Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'levels', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'zero', 'type': 'boolean', 'default': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true }, - { 'name': 'scale', 'type': 'number', 'expr': true }, - { 'name': 'translate', 'type': 'number', 'array': true, 'expr': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'default': 'contour' } - ] -}; - -var prototype$13 = inherits(Isocontour, Transform); - -prototype$13.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - field = _.field || identity, - contour = contours().smooth(_.smooth !== false), - tz = _.thresholds || levels(source, field, _), - as = _.as === null ? null : _.as || 'contour', - values = []; - - source.forEach(t => { - const grid = field(t); - - // generate contour paths in GeoJSON format - const paths = contour.size([grid.width, grid.height])( - grid.values, isArray(tz) ? tz : tz(grid.values) - ); - - // adjust contour path coordinates as needed - transformPaths(paths, grid, t, _); - - // ingest; copy source data properties to output - paths.forEach(p => { - values.push(rederive(t, ingest(as != null ? {[as]: p} : p))); - }); - }); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; -}; - -function levels(values, f, _) { - const q = quantize$1(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' - ? q - : q(values.map(t => max(f(t).values))); -} - -function transformPaths(paths, grid, datum, _) { - let s = _.scale || grid.scale, - t = _.translate || grid.translate; - if (isFunction(s)) s = s(datum, _); - if (isFunction(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - - const sx = (isNumber(s) ? s : s[0]) || 1, - sy = (isNumber(s) ? s : s[1]) || 1, - tx = t && t[0] || 0, - ty = t && t[1] || 0; - - paths.forEach(transform$1(grid, sx, sy, tx, ty)); -} - -function transform$1(grid, sx, sy, tx, ty) { - const x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - flip = sx * sy < 0; - - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); - } - - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - coordinates.forEach(transformPoint); - } - - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; - } - - return function(geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; - }; -} - -function radius(bw, data, f) { - const v = bw >= 0 ? bw : bandwidthNRD(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); -} - -function number$4(_) { - return isFunction(_) ? _ : constant(+_); -} - -// Implementation adapted from d3/d3-contour. Thanks! -function density2D() { - var x = d => d[0], - y = d => d[1], - weight = one, - bandwidth = [-1, -1], - dx = 960, - dy = 500, - k = 2; // log2(cellSize) - - function density(data, counts) { - const rx = radius(bandwidth[0], data, x) >> k, // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, // blur y-radius - ox = rx ? rx + 2 : 0, // x-offset padding for blur - oy = ry ? ry + 2 : 0, // y-offset padding for blur - n = 2 * ox + (dx >> k), // grid width - m = 2 * oy + (dy >> k), // grid height - values0 = new Float32Array(n * m), - values1 = new Float32Array(n * m); - - let values = values0; - - data.forEach(d => { - const xi = ox + (+x(d) >> k), - yi = oy + (+y(d) >> k); - - if (xi >= 0 && xi < n && yi >= 0 && yi < m) { - values0[xi + yi * n] += +weight(d); - } - }); - - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } - - // scale density estimates - // density in points per square pixel or probability density - let s = counts ? Math.pow(2, -2 * k) : 1 / sum(values); - for (let i=0, sz=n*m; i> k), - y2: oy + (dy >> k) - }; - } - - density.x = function(_) { - return arguments.length ? (x = number$4(_), density) : x; - }; - - density.y = function(_) { - return arguments.length ? (y = number$4(_), density) : y; - }; - - density.weight = function(_) { - return arguments.length ? (weight = number$4(_), density) : weight; - }; - - density.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, density; - }; - - density.cellSize = function(_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) error('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - - density.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - _ = array(_); - if (_.length === 1) _ = [+_[0], +_[0]]; - if (_.length !== 2) error('invalid bandwidth'); - return bandwidth = _, density; - }; - - return density; -} - -function blurX(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let j = 0; j < m; ++j) { - for (let i = 0, sr = 0; i < n + r; ++i) { - if (i < n) { - sr += source[i + j * n]; - } - if (i >= r) { - if (i >= w) { - sr -= source[i - w + j * n]; - } - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } - } -} - -function blurY(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let i = 0; i < n; ++i) { - for (let j = 0, sr = 0; j < m + r; ++j) { - if (j < m) { - sr += source[i + j * n]; - } - if (j >= r) { - if (j >= w) { - sr -= source[i + (j - w) * n]; - } - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } - } -} - -/** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ -function KDE2D(params) { - Transform.call(this, null, params); -} - -KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': 'grid'} - ] -}; - -var prototype$14 = inherits(KDE2D, Transform); - -const PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth']; - -function params(obj, _) { - PARAMS.forEach(param => _[param] != null ? obj[param](_[param]) : 0); - return obj; -} - -prototype$14.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) - return pulse.StopPropagation; - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - groups = partition$3(source, _.groupby), - names = (_.groupby || []).map(accessorName), - kde = params(density2D(), _), - as = _.as || 'grid', - values = []; - - function set(t, vals) { - for (let i=0; i ingest( - set({[as]: kde(g, _.counts)}, g.dims) - )); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; -}; - -function partition$3(data, groupby) { - var groups = [], - get = f => f(t), - map, i, n, t, k, g; - - // partition data points into groups - if (groupby == null) { - groups.push(data); - } else { - for (map={}, i=0, n=data.length; i} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ -function Contour(params) { - Transform.call(this, null, params); -} - -Contour.Definition = { - 'type': 'Contour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'values', 'type': 'number', 'array': true }, - { 'name': 'x', 'type': 'field' }, - { 'name': 'y', 'type': 'field' }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number' }, - { 'name': 'count', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true } - ] -}; - -var prototype$15 = inherits(Contour, Transform); - -prototype$15.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - contour = contours().smooth(_.smooth !== false), - values = _.values, - thresh = _.thresholds || quantize$1(_.count || 10, _.nice, !!values), - size = _.size, grid, post; - - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform$1(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [grid.width, grid.height]; - values = grid.values; - } - - thresh = isArray(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map(ingest); - - return out; -}; - -var Feature = 'Feature'; -var FeatureCollection = 'FeatureCollection'; -var MultiPoint = 'MultiPoint'; - -/** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ -function GeoJSON(params) { - Transform.call(this, null, params); -} - -GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'length': 2 }, - { 'name': 'geojson', 'type': 'field' } - ] -}; - -var prototype$16 = inherits(GeoJSON, Transform); - -prototype$16.transform = function(_, pulse) { - var features = this._features, - points = this._points, - fields = _.fields, - lon = fields && fields[0], - lat = fields && fields[1], - geojson = _.geojson || (!fields && identity), - flag = pulse.ADD, - mod; - - mod = _.modified() - || pulse.changed(pulse.REM) - || pulse.modified(accessorFields(geojson)) - || (lon && (pulse.modified(accessorFields(lon)))) - || (lat && (pulse.modified(accessorFields(lat)))); - - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = (features = []); - this._points = (points = []); - } - - if (geojson) { - pulse.visit(flag, function(t) { - features.push(geojson(t)); - }); - } - - if (lon && lat) { - pulse.visit(flag, function(t) { - var x = lon(t), - y = lat(t); - if (x != null && y != null && (x = +x) === x && (y = +y) === y) { - points.push([x, y]); - } - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - - this.value = { - type: FeatureCollection, - features: features - }; -}; - -var abs = Math.abs; -var cos = Math.cos; -var sin = Math.sin; - -var epsilon$1 = 1e-6; -var pi = Math.PI; -var halfPi = pi / 2; -var sqrt2 = sqrt$1(2); - -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} - -function sqrt$1(x) { - return x > 0 ? Math.sqrt(x) : 0; -} - -function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * sin(phi), i = 30, delta; - do phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi)); - while (abs(delta) > epsilon$1 && --i > 0); - return phi / 2; -} - -function mollweideBromleyRaw(cx, cy, cp) { - - function forward(lambda, phi) { - return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)]; - } - - forward.invert = function(x, y) { - return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)]; - }; - - return forward; -} - -var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); - -function geoMollweide() { - return geoProjection(mollweideRaw) - .scale(169.529); -} - -var defaultPath = geoPath(); - -var projectionProperties = [ - // standard properties in d3-geo - 'clipAngle', - 'clipExtent', - 'scale', - 'translate', - 'center', - 'rotate', - 'parallels', - 'precision', - 'reflectX', - 'reflectY', - - // extended properties in d3-geo-projections - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' -]; - -/** - * Augment projections with their type and a copy method. - */ -function create$1(type, constructor) { - return function projection() { - var p = constructor(); - - p.type = type; - - p.path = geoPath().projection(p); - - p.copy = p.copy || function() { - var c = projection(); - projectionProperties.forEach(function(prop) { - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - - return p; - }; -} - -function projection(type, proj) { - if (!type || typeof type !== 'string') { - throw new Error('Projection type must be a name string.'); - } - type = type.toLowerCase(); - if (arguments.length > 1) { - projections[type] = create$1(type, proj); - return this; - } else { - return projections[type] || null; - } -} - -function getProjectionPath(proj) { - return (proj && proj.path) || defaultPath; -} - -var projections = { - // base d3-geo projection types - albers: geoAlbers, - albersusa: geoAlbersUsa, - azimuthalequalarea: geoAzimuthalEqualArea, - azimuthalequidistant: geoAzimuthalEquidistant, - conicconformal: geoConicConformal, - conicequalarea: geoConicEqualArea, - conicequidistant: geoConicEquidistant, - equalEarth: geoEqualEarth, - equirectangular: geoEquirectangular, - gnomonic: geoGnomonic, - identity: geoIdentity, - mercator: geoMercator, - mollweide: geoMollweide, - naturalEarth1: geoNaturalEarth1, - orthographic: geoOrthographic, - stereographic: geoStereographic, - transversemercator: geoTransverseMercator -}; - -for (var key$1 in projections) { - projection(key$1, projections[key$1]); -} - -/** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ -function GeoPath(params) { - Transform.call(this, null, params); -} - -GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] -}; - -var prototype$17 = inherits(GeoPath, Transform); - -prototype$17.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - path = this.value, - field = _.field || identity, - as = _.as || 'path', - flag = out.SOURCE; - - function set(t) { t[as] = path(field(t)); } - - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = getProjectionPath(_.projection); - out.materialize().reflow(); - } else { - flag = field === identity || pulse.modified(field.fields) - ? out.ADD_MOD - : out.ADD; - } - - var prev = initPath(path, _.pointRadius); - out.visit(flag, set); - path.pointRadius(prev); - - return out.modifies(as); -}; - -function initPath(path, pointRadius) { - var prev = path.pointRadius(); - path.context(null); - if (pointRadius != null) { - path.pointRadius(pointRadius); - } - return prev; -} - -/** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ -function GeoPoint(params) { - Transform.call(this, null, params); -} - -GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection', 'required': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true, 'length': 2 }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['x', 'y'] } - ] -}; - -var prototype$18 = inherits(GeoPoint, Transform); - -prototype$18.transform = function(_, pulse) { - var proj = _.projection, - lon = _.fields[0], - lat = _.fields[1], - as = _.as || ['x', 'y'], - x = as[0], - y = as[1], - mod; - - function set(t) { - var xy = proj([lon(t), lat(t)]); - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - - if (_.modified()) { - // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - } else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - - return pulse.modifies(as); -}; - -/** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ -function GeoShape(params) { - Transform.call(this, null, params); -} - -GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': {'modifies': true, 'nomod': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field', 'default': 'datum' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'shape' } - ] -}; - -var prototype$19 = inherits(GeoShape, Transform); - -prototype$19.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - shape = this.value, - as = _.as || 'shape', - flag = out.ADD; - - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator( - getProjectionPath(_.projection), - _.field || field('datum'), - _.pointRadius - ); - out.materialize().reflow(); - flag = out.SOURCE; - } - - out.visit(flag, function(t) { t[as] = shape; }); - - return out.modifies(as); -}; - -function shapeGenerator(path, field, pointRadius) { - var shape = pointRadius == null - ? function(_) { return path(field(_)); } - : function(_) { - var prev = path.pointRadius(), - value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - shape.context = function(_) { - path.context(_); - return shape; - }; - - return shape; -} - -/** - * GeoJSON feature generator for creating graticules. - * @constructor - */ -function Graticule(params) { - Transform.call(this, [], params); - this.generator = geoGraticule(); -} - -Graticule.Definition = { - 'type': 'Graticule', - 'metadata': {'changes': true, 'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMajor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMinor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'step', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'stepMajor', 'type': 'number', 'array': true, 'length': 2, 'default': [90, 360] }, - { 'name': 'stepMinor', 'type': 'number', 'array': true, 'length': 2, 'default': [10, 10] }, - { 'name': 'precision', 'type': 'number', 'default': 2.5 } - ] -}; - -var prototype$1a = inherits(Graticule, Transform); - -prototype$1a.transform = function(_, pulse) { - var src = this.value, - gen = this.generator, t; - - if (!src.length || _.modified()) { - for (var prop in _) { - if (isFunction(gen[prop])) { - gen[prop](_[prop]); - } - } - } - - t = gen(); - if (src.length) { - pulse.mod.push(replace(src[0], t)); - } else { - pulse.add.push(ingest(t)); - } - src[0] = t; - - return pulse; -}; - -/** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ -function Heatmap(params) { - Transform.call(this, null, params); -} - -Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'color', 'type': 'string', 'expr': true}, - { 'name': 'opacity', 'type': 'number', 'expr': true}, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'as', 'type': 'string', 'default': 'image' } - ] -}; - -var prototype$1b = inherits(Heatmap, Transform); - -prototype$1b.transform = function(_, pulse) { - if (!pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var source = pulse.materialize(pulse.SOURCE).source, - shared = _.resolve === 'shared', - field = _.field || identity, - opacity = opacity_(_.opacity, _), - color = color_(_.color, _), - as = _.as || 'image', - obj = { - $x: 0, $y: 0, $value: 0, - $max: shared ? max(source.map(t => max(field(t).values))) : 0 - }; - - source.forEach(t => { - const v = field(t); - - // build proxy data object - const o = extend({}, t, obj); - // set maximum value if not globally shared - if (!shared) o.$max = max(v.values || []); - - // generate canvas image - // optimize color/opacity if not pixel-dependent - t[as] = toCanvas(v, o, - color.dep ? color : constant(color(o)), - opacity.dep ? opacity : constant(opacity(o)) - ); - }); - - return pulse.reflow(true).modifies(as); -}; - -// get image color function -function color_(color, _) { - let f; - if (isFunction(color)) { - f = obj => rgb(color(obj, _)); - f.dep = dependency(color); - } else { - // default to mid-grey - f = constant(rgb(color || '#888')); - } - return f; -} - -// get image opacity function -function opacity_(opacity, _) { - let f; - if (isFunction(opacity)) { - f = obj => opacity(obj, _); - f.dep = dependency(opacity); - } else if (opacity) { - f = constant(opacity); - } else { - // default to [0, max] opacity gradient - f = obj => (obj.$value / obj.$max) || 0; - f.dep = true; - } - return f; -} - -// check if function depends on individual pixel data -function dependency(f) { - if (!isFunction(f)) return false; - const set = toSet(accessorFields(f)); - return set.$x || set.$y || set.$value || set.$max; -} - -// render raster grid to canvas -function toCanvas(grid, obj, color, opacity) { - const n = grid.width, - m = grid.height, - x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - x2 = grid.x2 || n, - y2 = grid.y2 || m, - val = grid.values, - value = val ? i => val[i] : zero, - can = domCanvas(x2 - x1, y2 - y1), - ctx = can.getContext('2d'), - img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), - pix = img.data; - - for (let j=y1, k=0; j a.concat(featurize(f)), []) - }; -} - -function featurize(f) { - return f.type === FeatureCollection - ? f.features - : array(f).filter(d => d != null).map( - d => d.type === Feature ? d : {type: Feature, geometry: d} - ); -} - -var geo = /*#__PURE__*/Object.freeze({ - __proto__: null, - contour: Contour, - geojson: GeoJSON, - geopath: GeoPath, - geopoint: GeoPoint, - geoshape: GeoShape, - graticule: Graticule, - heatmap: Heatmap, - isocontour: Isocontour, - kde2d: KDE2D, - projection: Projection -}); - -var ForceMap = { - center: forceCenter, - collide: forceCollide, - nbody: forceManyBody, - link: forceLink, - x: forceX, - y: forceY -}; - -var Forces = 'forces', - ForceParams = [ - 'alpha', 'alphaMin', 'alphaTarget', - 'velocityDecay', 'forces' - ], - ForceConfig = ['static', 'iterations'], - ForceOutput = ['x', 'y', 'vx', 'vy']; - -/** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.forces - The forces to apply. - */ -function Force(params) { - Transform.call(this, null, params); -} - -Force.Definition = { - 'type': 'Force', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'static', 'type': 'boolean', 'default': false }, - { 'name': 'restart', 'type': 'boolean', 'default': false }, - { 'name': 'iterations', 'type': 'number', 'default': 300 }, - { 'name': 'alpha', 'type': 'number', 'default': 1 }, - { 'name': 'alphaMin', 'type': 'number', 'default': 0.001 }, - { 'name': 'alphaTarget', 'type': 'number', 'default': 0 }, - { 'name': 'velocityDecay', 'type': 'number', 'default': 0.4 }, - { 'name': 'forces', 'type': 'param', 'array': true, - 'params': [ - { - 'key': {'force': 'center'}, - 'params': [ - { 'name': 'x', 'type': 'number', 'default': 0 }, - { 'name': 'y', 'type': 'number', 'default': 0 } - ] - }, - { - 'key': {'force': 'collide'}, - 'params': [ - { 'name': 'radius', 'type': 'number', 'expr': true }, - { 'name': 'strength', 'type': 'number', 'default': 0.7 }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'nbody'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': -30 }, - { 'name': 'theta', 'type': 'number', 'default': 0.9 }, - { 'name': 'distanceMin', 'type': 'number', 'default': 1 }, - { 'name': 'distanceMax', 'type': 'number' } - ] - }, - { - 'key': {'force': 'link'}, - 'params': [ - { 'name': 'links', 'type': 'data' }, - { 'name': 'id', 'type': 'field' }, - { 'name': 'distance', 'type': 'number', 'default': 30, 'expr': true }, - { 'name': 'strength', 'type': 'number', 'expr': true }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'x'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'x', 'type': 'field' } - ] - }, - { - 'key': {'force': 'y'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'y', 'type': 'field' } - ] - } - ] }, - { - 'name': 'as', 'type': 'string', 'array': true, 'modify': false, - 'default': ForceOutput - } - ] -}; - -var prototype$1d = inherits(Force, Transform); - -prototype$1d.transform = function(_, pulse) { - var sim = this.value, - change = pulse.changed(pulse.ADD_REM), - params = _.modified(ForceParams), - iters = _.iterations || 300; - - // configure simulation - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - pulse.modifies('index'); - } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - if (params || pulse.changed(pulse.MOD)) { - setup(sim, _, 0, pulse); - } - } - - // run simulation - if (params || change || _.modified(ForceConfig) - || (pulse.changed() && _.restart)) - { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)) - .alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - - if (_.static) { - for (sim.stop(); --iters >= 0;) sim.tick(); - } else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } - } - - return this.finish(_, pulse); -}; - -prototype$1d.finish = function(_, pulse) { - var dataflow = pulse.dataflow; - - // inspect dependencies, touch link source data - for (var args=this._argops, j=0, m=args.length, arg; j} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ -function Nest(params) { - Transform.call(this, null, params); -} - -Nest.Definition = { - 'type': 'Nest', - 'metadata': {'treesource': true, 'changes': true}, - 'params': [ - { 'name': 'keys', 'type': 'field', 'array': true }, - { 'name': 'generate', 'type': 'boolean' } - ] -}; - -var prototype$1e = inherits(Nest, Transform); - -function children(n) { - return n.values; -} - -prototype$1e.transform = function(_, pulse) { - if (!pulse.source) { - error('Nest transform requires an upstream data source.'); - } - - var gen = _.generate, - mod = _.modified(), - out = pulse.clone(), - tree = this.value; - - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) { - tree.each(node => { - if (node.children && isTuple(node.data)) { - out.rem.push(node.data); - } - }); - } - - // generate new tree structure - this.value = tree = hierarchy({ - values: array(_.keys) - .reduce((n, k) => { n.key(k); return n; }, nest()) - .entries(out.source) - }, children); - - // collect nodes to add - if (gen) { - tree.each(node => { - if (node.children) { - node = ingest(node.data); - out.add.push(node); - out.source.push(node); - } - }); - } - - // build lookup table - lookup$3(tree, tupleid, tupleid); - } - - out.source.root = tree; - return out; -}; - -function nest() { - var keys = [], - nest; - - function apply(array, depth) { - if (depth >= keys.length) { - return array; - } - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - value, - valuesByKey = {}, - values, - result = {}; - - while (++i < n) { - keyValue = key(value = array[i]) + ''; - if (values = valuesByKey[keyValue]) { - values.push(value); - } else { - valuesByKey[keyValue] = [value]; - } - } - - for (keyValue in valuesByKey) { - result[keyValue] = apply(valuesByKey[keyValue], depth); - } - - return result; - } - - function entries(map, depth) { - if (++depth > keys.length) return map; - var array = [], k; - for (k in map) { - array.push({key: k, values: entries(map[k], depth)}); - } - return array; - } - - return nest = { - entries: array => entries(apply(array, 0), 0), - key: d => { keys.push(d); return nest; } - }; -} - -/** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ -function HierarchyLayout(params) { - Transform.call(this, null, params); -} - -var prototype$1f = inherits(HierarchyLayout, Transform); - -prototype$1f.transform = function(_, pulse) { - if (!pulse.source || !pulse.source.root) { - error(this.constructor.name - + ' transform requires a backing tree data source.'); - } - - var layout = this.layout(_.method), - fields = this.fields, - root = pulse.source.root, - as = _.as || fields; - - if (_.field) root.sum(_.field); else root.count(); - if (_.sort) root.sort(stableCompare(_.sort, d => d.data)); - - setParams(layout, this.params, _); - if (layout.separation) { - layout.separation(_.separation !== false ? defaultSeparation : one); - } - - try { - this.value = layout(root); - } catch (err) { - error(err); - } - root.each(function(node) { setFields(node, fields, as); }); - - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); -}; - -function setParams(layout, params, _) { - for (var p, i=0, n=params.length; i} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ -function Loess(params) { - Transform.call(this, null, params); -} - -Loess.Definition = { - 'type': 'Loess', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0.3 }, - { 'name': 'as', 'type': 'string', 'array': true } - ] -}; - -var prototype$1m = inherits(Loess, Transform); - -prototype$1m.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition$4(source, _.groupby), - names = (_.groupby || []).map(accessorName), - m = names.length, - as = _.as || [accessorName(_.x), accessorName(_.y)], - values = []; - - groups.forEach(g => { - regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(p => { - const t = {}; - for (let i=0; i} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ -function Regression(params) { - Transform.call(this, null, params); -} - -Regression.Definition = { - 'type': 'Regression', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'string', 'default': 'linear', 'values': Object.keys(Methods$1) }, - { 'name': 'order', 'type': 'number', 'default': 3 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'params', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true } - ] -}; - -var prototype$1n = inherits(Regression, Transform); - -prototype$1n.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition$4(source, _.groupby), - names = (_.groupby || []).map(accessorName), - method = _.method || 'linear', - order = _.order || 3, - dof = degreesOfFreedom(method, order), - as = _.as || [accessorName(_.x), accessorName(_.y)], - fit = Methods$1[method], - values = []; - - let domain = _.extent; - - if (!hasOwnProperty(Methods$1, method)) { - error('Invalid regression method: ' + method); - } - - if (domain != null) { - if (method === 'log' && domain[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - domain = null; - } - } - - groups.forEach(g => { - const n = g.length; - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - - const model = fit(g, _.x, _.y, order); - - if (_.params) { - // if parameter vectors requested return those - values.push(ingest({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - return; - } - - const dom = domain || extent(g, _.x), - add = p => { - const t = {}; - for (let i=0; i add([x, model.predict(x)])); - } else { - // otherwise return trend line sample points - sampleCurve(model.predict, dom, 25, 200).forEach(add); - } - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; -}; - -var reg = /*#__PURE__*/Object.freeze({ - __proto__: null, - loess: Loess, - regression: Regression -}); - -const EPSILON$2 = Math.pow(2, -52); -const EDGE_STACK = new Uint32Array(512); - -class Delaunator { - - static from(points, getX = defaultGetX, getY = defaultGetY) { - const n = points.length; - const coords = new Float64Array(n * 2); - - for (let i = 0; i < n; i++) { - const p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - - return new Delaunator(coords); - } - - constructor(coords) { - const n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - - this.coords = coords; - - // arrays that will store the triangulation graph - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash - - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - - this.update(); - } - - update() { - const {coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash} = this; - const n = coords.length >> 1; - - // populate an array of point indices; calculate input data bbox - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - - for (let i = 0; i < n; i++) { - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - - let minDist = Infinity; - let i0, i1, i2; - - // pick a seed point close to the center - for (let i = 0; i < n; i++) { - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } - } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - - minDist = Infinity; - - // find the point closest to the seed - for (let i = 0; i < n; i++) { - if (i === i0) continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } - } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - - let minRadius = Infinity; - - // find the third point which forms the smallest circumcircle with the first two - for (let i = 0; i < n; i++) { - if (i === i0 || i === i1) continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } - } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for (let i = 0; i < n; i++) { - this._dists[i] = (coords[2 * i] - coords[0]) || (coords[2 * i + 1] - coords[1]); - } - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for (let i = 0, d0 = -Infinity; i < n; i++) { - const id = this._ids[i]; - if (this._dists[id] > d0) { - hull[j++] = id; - d0 = this._dists[id]; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } - - // swap the order of the seed points for counter-clockwise orientation - if (orient(i0x, i0y, i1x, i1y, i2x, i2y)) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - - for (let i = 0; i < n; i++) { - this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - } - - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - - // set up the seed triangle as the starting hull - this._hullStart = i0; - let hullSize = 3; - - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - - for (let k = 0, xp, yp; k < this._ids.length; k++) { - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - - // skip near-duplicate points - if (k > 0 && Math.abs(x - xp) <= EPSILON$2 && Math.abs(y - yp) <= EPSILON$2) continue; - xp = x; - yp = y; - - // skip seed triangle points - if (i === i0 || i === i1 || i === i2) continue; - - // find a visible edge on the convex hull using edge hash - let start = 0; - for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) { - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - - start = hullPrev[start]; - let e = start, q; - while (q = hullNext[e], !orient(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) { - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) continue; // likely a near-duplicate point; skip it - - // add the first triangle from the point - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - - // walk forward through the hull, adding more triangles and flipping recursively - let n = hullNext[e]; - while (q = hullNext[n], orient(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1])) { - t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]); - hullTri[i] = this._legalize(t + 2); - hullNext[n] = n; // mark as removed - hullSize--; - n = q; - } - - // walk backward from the other side, adding more triangles and flipping - if (e === start) { - while (q = hullPrev[e], orient(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) { - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - } - - // update the hull indices - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n] = i; - hullNext[i] = n; - - // save the two new edges in the hash table - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - - this.hull = new Uint32Array(hullSize); - for (let i = 0, e = this._hullStart; i < hullSize; i++) { - this.hull[i] = e; - e = hullNext[e]; - } - - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - - _legalize(a) { - const {_triangles: triangles, _halfedges: halfedges, coords} = this; - - let i = 0; - let ar = 0; - - // recursion eliminated with a fixed-size stack - while (true) { - const b = halfedges[a]; - - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ - const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - - if (b === -1) { // convex hull edge - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - - const illegal = inCircle( - coords[2 * p0], coords[2 * p0 + 1], - coords[2 * pr], coords[2 * pr + 1], - coords[2 * pl], coords[2 * pl + 1], - coords[2 * p1], coords[2 * p1 + 1]); - - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - - const hbl = halfedges[bl]; - - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - - const br = b0 + (b + 1) % 3; - - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = br; - } - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - - return ar; - } - - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } - - // add a new triangle given vertex indices and adjacent half-edge ids - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - - this.trianglesLen += 3; - - return t; - } -} - -// monotonically increases with real angle, but doesn't need expensive trigonometry -function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] -} - -function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; -} - -// return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check -function orientIfSure(px, py, rx, ry, qx, qy) { - const l = (ry - py) * (qx - px); - const r = (rx - px) * (qy - py); - return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0; -} - -// a more robust orientation test that's stable in a given triangle (to fix robustness issues) -function orient(rx, ry, qx, qy, px, py) { - const sign = orientIfSure(px, py, rx, ry, qx, qy) || - orientIfSure(rx, ry, qx, qy, px, py) || - orientIfSure(qx, qy, px, py, rx, ry); - return sign < 0; -} - -function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - - return dx * (ey * cp - bp * fy) - - dy * (ex * cp - bp * fx) + - ap * (ex * fy - ey * fx) < 0; -} - -function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - - return x * x + y * y; -} - -function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - - return {x, y}; -} - -function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (let i = left + 1; i <= right; i++) { - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; - ids[j + 1] = temp; - } - } else { - const median = (left + right) >> 1; - let i = left + 1; - let j = right; - swap$1(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) swap$1(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) swap$1(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) swap$1(ids, left, i); - - const temp = ids[i]; - const tempDist = dists[temp]; - while (true) { - do i++; while (dists[ids[i]] < tempDist); - do j--; while (dists[ids[j]] > tempDist); - if (j < i) break; - swap$1(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); - } - } -} - -function swap$1(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - -function defaultGetX(p) { - return p[0]; -} -function defaultGetY(p) { - return p[1]; -} - -const epsilon$2 = 1e-6; - -class Path { - constructor() { - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; - } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; - } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon$2 || Math.abs(this._y1 - y0) > epsilon$2) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; - } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; - } - value() { - return this._ || null; - } -} - -class Polygon { - constructor() { - this._ = []; - } - moveTo(x, y) { - this._.push([x, y]); - } - closePath() { - this._.push(this._[0].slice()); - } - lineTo(x, y) { - this._.push([x, y]); - } - value() { - return this._.length ? this._ : null; - } -} - -class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); - } - update() { - this.delaunay.update(); - this._init(); - return this; - } - _init() { - const {delaunay: {points, hull, triangles}, vectors} = this; - - // Compute circumcenters. - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for (let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2) { - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x1 = points[t1]; - const y1 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - - const dx = x2 - x1; - const dy = y2 - y1; - const ex = x3 - x1; - const ey = y3 - y1; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const ab = (dx * ey - dy * ex) * 2; - - if (!ab) { - // degenerate case (collinear diagram) - x = (x1 + x3) / 2 - 1e8 * ey; - y = (y1 + y3) / 2 + 1e8 * ex; - } - else if (Math.abs(ab) < 1e-8) { - // almost equal points (degenerate triangle) - x = (x1 + x3) / 2; - y = (y1 + y3) / 2; - } else { - const d = 1 / ab; - x = x1 + (ey * bl - dy * cl) * d; - y = y1 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - - // Compute exterior cell rays. - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for (let i = 0; i < hull.length; ++i) { - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new Path : undefined; - const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this; - if (hull.length <= 1) return null; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for (let i = 0; i < hull.length; ++i) { - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new Path : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new Path : undefined; - const points = this._clip(i); - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - let n = points.length; - while (points[0] === points[n-2] && points[1] === points[n-1] && n > 1) n -= 2; - for (let i = 2; i < n; i += 2) { - if (points[i] !== points[i-2] || points[i+1] !== points[i-1]) - context.lineTo(points[i], points[i + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - *cellPolygons() { - const {delaunay: {points}} = this; - for (let i = 0, n = points.length / 2; i < n; ++i) { - const cell = this.cellPolygon(i); - if (cell) cell.index = i, yield cell; - } - } - cellPolygon(i) { - const polygon = new Polygon; - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } - } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; - } - *neighbors(i) { - const ci = this._clip(i); - if (ci) for (const j of this.delaunay.neighbors(i)) { - const cj = this._clip(j); - // find the common edge - if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { - for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { - if (ci[ai] == cj[aj] - && ci[ai + 1] == cj[aj + 1] - && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] - && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj] - ) { - yield j; - break loop; - } - } - } - } - } - _cell(i) { - const {circumcenters, delaunay: {inedges, halfedges, triangles}} = this; - const e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - } while (e !== e0 && e !== -1); - return points; - } - _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - const points = this._cell(i); - if (points === null) return null; - const {vectors: V} = this; - const v = i * 4; - return V[v] || V[v + 1] - ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) - : this._clipFinite(i, points); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1; - for (let j = 0; j < n; j += 2) { - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1); - else P = [x1, y1]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0); - else P = [sx0, sy0]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1); - else P = [sx1, sy1]; - } - } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - while (true) { - if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1]; - if (c0 & c1) return null; - let x, y, c = c0 || c1; - if (c & 0b1000) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 0b0100) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 0b0010) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) { - for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; - } - return P; - } - _edge(i, e0, e1, P, j) { - while (e0 !== e1) { - let x, y; - switch (e0) { - case 0b0101: e0 = 0b0100; continue; // top-left - case 0b0100: e0 = 0b0110, x = this.xmax, y = this.ymin; break; // top - case 0b0110: e0 = 0b0010; continue; // top-right - case 0b0010: e0 = 0b1010, x = this.xmax, y = this.ymax; break; // right - case 0b1010: e0 = 0b1000; continue; // bottom-right - case 0b1000: e0 = 0b1001, x = this.xmin, y = this.ymax; break; // bottom - case 0b1001: e0 = 0b0001; continue; // bottom-left - case 0b0001: e0 = 0b0101, x = this.xmin, y = this.ymin; break; // left - } - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) { - P.splice(j, 0, x, y), j += 2; - } - } - if (P.length > 4) { - for (let i = 0; i < P.length; i+= 2) { - const j = (i + 2) % P.length, k = (i + 4) % P.length; - if (P[i] === P[j] && P[j] === P[k] - || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) - P.splice(j, 2), i -= 2; - } - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { // top - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { // bottom - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { // right - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { // left - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - return [x, y]; - } - _edgecode(x, y) { - return (x === this.xmin ? 0b0001 - : x === this.xmax ? 0b0010 : 0b0000) - | (y === this.ymin ? 0b0100 - : y === this.ymax ? 0b1000 : 0b0000); - } - _regioncode(x, y) { - return (x < this.xmin ? 0b0001 - : x > this.xmax ? 0b0010 : 0b0000) - | (y < this.ymin ? 0b0100 - : y > this.ymax ? 0b1000 : 0b0000); - } -} - -const tau = 2 * Math.PI, pow$2 = Math.pow; - -function pointX(p) { - return p[0]; -} - -function pointY(p) { - return p[1]; -} - -// A triangulation is collinear if all its triangles have a non-null area -function collinear$1(d) { - const {triangles, coords} = d; - for (let i = 0; i < triangles.length; i += 3) { - const a = 2 * triangles[i], - b = 2 * triangles[i + 1], - c = 2 * triangles[i + 2], - cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1]) - - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]); - if (cross > 1e-10) return false; - } - return true; -} - -function jitter(x, y, r) { - return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r]; -} - -class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points - ? flatArray(points, fx, fy, that) - : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points) { - this._delaunator = new Delaunator(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); - } - update() { - this._delaunator.update(); - this._init(); - return this; - } - _init() { - const d = this._delaunator, points = this.points; - - // check for collinear - if (d.hull && d.hull.length > 2 && collinear$1(d)) { - this.collinear = Int32Array.from({length: points.length/2}, (_,i) => i) - .sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], - bounds = [ points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1] ], - r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for (let i = 0, n = points.length / 2; i < n; ++i) { - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new Delaunator(points); - } else { - delete this.collinear; - } - - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - - // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - for (let e = 0, n = halfedges.length; e < n; ++e) { - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; - } - for (let i = 0, n = hull.length; i < n; ++i) { - hullIndex[hull[i]] = i; - } - - // degenerate case: 1 or 2 (distinct) points - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - inedges[hull[0]] = 1; - if (hull.length === 2) inedges[hull[1]] = 0; - } - } - voronoi(bounds) { - return new Voronoi(this, bounds); - } - *neighbors(i) { - const {inedges, hull, _hullIndex, halfedges, triangles, collinear} = this; - - // degenerate case with several collinear points - if (collinear) { - const l = collinear.indexOf(i); - if (l > 0) yield collinear[l - 1]; - if (l < collinear.length - 1) yield collinear[l + 1]; - return; - } - - const e0 = inedges[i]; - if (e0 === -1) return; // coincident point - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) return; // bad triangulation - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) yield p; - return; - } - } while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - const i0 = i; - let c; - while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) i = c; - return c; - } - _step(i, x, y) { - const {inedges, hull, _hullIndex, halfedges, triangles, points} = this; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow$2(x - points[i * 2], 2) + pow$2(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow$2(x - points[t * 2], 2) + pow$2(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow$2(x - points[e * 2], 2) + pow$2(y - points[e * 2 + 1], 2) < dc) return e; - } - break; - } - } while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new Path : undefined; - const {points, halfedges, triangles} = this; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r = 2) { - const buffer = context == null ? context = new Path : undefined; - const {points} = this; - for (let i = 0, n = points.length; i < n; i += 2) { - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new Path : undefined; - const {hull, points} = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for (let i = 1; i < n; ++i) { - const h = 2 * hull[i]; - context.lineTo(points[h], points[h + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - hullPolygon() { - const polygon = new Polygon; - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new Path : undefined; - const {points, triangles} = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); - } - *trianglePolygons() { - const {triangles} = this; - for (let i = 0, n = triangles.length / 3; i < n; ++i) { - yield this.trianglePolygon(i); - } - } - trianglePolygon(i) { - const polygon = new Polygon; - this.renderTriangle(i, polygon); - return polygon.value(); - } -} - -function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for (let i = 0; i < n; ++i) { - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; -} - -function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points) { - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; - } -} - -function Voronoi$1(params) { - Transform.call(this, null, params); -} - -Voronoi$1.Definition = { - 'type': 'Voronoi', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'extent', 'type': 'array', 'array': true, 'length': 2, - 'default': [[-1e5, -1e5], [1e5, 1e5]], - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] -}; - -const prototype$1o = inherits(Voronoi$1, Transform); - -const defaultExtent = [-1e5, -1e5, 1e5, 1e5]; - -prototype$1o.transform = function(_, pulse) { - const as = _.as || 'path', - data = pulse.source; - - // nothing to do if no data - if (!data || !data.length) return pulse; - - // configure and construct voronoi diagram - let s = _.size; - s = s ? [0, 0, s[0], s[1]] - : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] - : defaultExtent; - - const voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s); - - // map polygons to paths - for (let i=0, n=data.length; i> 5, - ch = 1 << 11; - -function cloud() { - var size = [256, 256], - text, - font, - fontSize, - fontStyle, - fontWeight, - rotate, - padding, - spiral = archimedeanSpiral, - words = [], - random = Math.random, - cloud = {}; - - cloud.layout = function() { - var contextAndRatio = getContext(domCanvas()), - board = zeroArray((size[0] >> 5) * size[1]), - bounds = null, - n = words.length, - i = -1, - tags = [], - data = words.map(function(d) { - return { - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - }; - }).sort(function(a, b) { return b.size - a.size; }); - - while (++i < n) { - var d = data[i]; - d.x = (size[0] * (random() + .5)) >> 1; - d.y = (size[1] * (random() + .5)) >> 1; - cloudSprite(contextAndRatio, d, data, i); - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d); - else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}]; - // Temporary hack - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - - return tags; - }; - - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - - return {context: context, ratio: ratio}; - } - - function place(board, tag, bounds) { - var startX = tag.x, - startY = tag.y, - maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), - s = spiral(size), - dt = random() < .5 ? 1 : -1, - t = -dt, - dxdy, - dx, - dy; - - while (dxdy = s(t += dt)) { - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - - tag.x = startX + dx; - tag.y = startY + dy; - - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || - tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; - // TODO only check for collisions within current bounds. - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, - w = tag.width >> 5, - sw = size[0] >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - } - x += sw; - } - tag.sprite = null; - return true; - } - } - } - return false; - } - - cloud.words = function(_) { - if (arguments.length) { - words = _; - return cloud; - } else { - return words; - } - }; - - cloud.size = function(_) { - if (arguments.length) { - size = [+_[0], +_[1]]; - return cloud; - } else { - return size; - } - }; - - cloud.font = function(_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else { - return font; - } - }; - - cloud.fontStyle = function(_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else { - return fontStyle; - } - }; - - cloud.fontWeight = function(_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else { - return fontWeight; - } - }; - - cloud.rotate = function(_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else { - return rotate; - } - }; - - cloud.text = function(_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else { - return text; - } - }; - - cloud.spiral = function(_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else { - return spiral; - } - }; - - cloud.fontSize = function(_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else { - return fontSize; - } - }; - - cloud.padding = function(_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else { - return padding; - } - }; - - cloud.random = function(_) { - if (arguments.length) { - random = _; - return cloud; - } else { - return random; - } - }; - - return cloud; -} - -// Fetches a monochrome sprite bitmap for the specified text. -// Load in batches for speed. -function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, - ratio = contextAndRatio.ratio; - - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, - y = 0, - maxh = 0, - n = data.length, - w, w32, h, i, j; - --di; - while (++di < n) { - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), - cr = Math.cos(d.rotate * cloudRadians), - wcr = w * cr, - wsr = w * sr, - hcr = h * cr, - hsr = h * sr; - w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else { - w = (w + 0x1f) >> 5 << 5; - } - if (h > maxh) maxh = h; - if (x + w >= (cw << 5)) { - x = 0; - y += maxh; - maxh = 0; - } - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, - sprite = []; - while (--di >= 0) { - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; - // Zero the buffer - for (i = 0; i < h * w32; i++) sprite[i] = 0; - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, - seenRow = -1; - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - var k = w32 * j + (i >> 5), - m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0; - sprite[k] |= m; - seen |= m; - } - if (seen) seenRow = j; - else { - d.y0++; - h--; - j--; - y++; - } - } - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); - } -} - -// Use mask-based collision detection. -function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, - w = tag.width >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) - & board[x + i]) return true; - } - x += sw; - } - return false; -} - -function cloudBounds(bounds, d) { - var b0 = bounds[0], - b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; -} - -function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; -} - -function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function(t) { - return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)]; - }; -} - -function rectangularSpiral(size) { - var dy = 4, - dx = dy * size[0] / size[1], - x = 0, - y = 0; - return function(t) { - var sign = t < 0 ? -1 : 1; - // See triangular numbers: T_n = n * (n + 1) / 2. - switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) { - case 0: x += dx; break; - case 1: y += dy; break; - case 2: x -= dx; break; - default: y -= dy; break; - } - return [x, y]; - }; -} - -// TODO reuse arrays? -function zeroArray(n) { - var a = [], - i = -1; - while (++i < n) a[i] = 0; - return a; -} - -function functor(d) { - return typeof d === 'function' ? d : function() { return d; }; -} - -var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral -}; - -var Output$5 = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle']; - -var Params$1 = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight']; - -function Wordcloud(params) { - Transform.call(this, cloud(), params); -} - -Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'font', 'type': 'string', 'expr': true, 'default': 'sans-serif' }, - { 'name': 'fontStyle', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontWeight', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontSize', 'type': 'number', 'expr': true, 'default': 14 }, - { 'name': 'fontSizeRange', 'type': 'number', 'array': 'nullable', 'default': [10, 50] }, - { 'name': 'rotate', 'type': 'number', 'expr': true, 'default': 0 }, - { 'name': 'text', 'type': 'field' }, - { 'name': 'spiral', 'type': 'string', 'values': ['archimedean', 'rectangular'] }, - { 'name': 'padding', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 7, 'default': Output$5 } - ] -}; - -var prototype$1p = inherits(Wordcloud, Transform); - -prototype$1p.transform = function(_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) { - error('Wordcloud size dimensions must be non-zero.'); - } - - function modp(param) { - var p = _[param]; - return isFunction(p) && pulse.modified(p.fields); - } - - var mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || Params$1.some(modp))) return; - - var data = pulse.materialize(pulse.SOURCE).source, - layout = this.value, - as = _.as || Output$5, - fontSize = _.fontSize || 14, - range; - - isFunction(fontSize) - ? (range = _.fontSizeRange) - : (fontSize = constant(fontSize)); - - // create font size scaling function as needed - if (range) { - var fsize = fontSize, - sizeScale = scale$2('sqrt')() - .domain(extent(data, fsize)) - .range(range); - fontSize = function(x) { return sizeScale(fsize(x)); }; - } - - data.forEach(function(t) { - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); - - // configure layout - var words = layout - .words(data) - .text(_.text) - .size(_.size || [500, 500]) - .padding(_.padding || 1) - .spiral(_.spiral || 'archimedean') - .rotate(_.rotate || 0) - .font(_.font || 'sans-serif') - .fontStyle(_.fontStyle || 'normal') - .fontWeight(_.fontWeight || 'normal') - .fontSize(fontSize) - .random(random) - .layout(); - - var size = layout.size(), - dx = size[0] >> 1, - dy = size[1] >> 1, - i = 0, - n = words.length, - w, t; - - for (; i boolean (true => remove) - var n = data.length, - copy = Array(n - num), - reindex = data, // reuse old data array for index map - t, i, j; - - // seek forward to first removal - for (i=0; !map[i] && i k || m > width) { - width = Math.max(m, width); - curr = array$1(n, width, curr); - prev = array$1(n, width); - } - } - }; -} - -function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; -} - -function array$1(n, m, array) { - var copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; -} - -function Dimension(index, i, query) { - var bit = (1 << i); - - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - - onAdd: function(added, curr) { - var dim = this, - range = dim.bisect(dim.range, added.value), - idx = added.index, - lo = range[0], - hi = range[1], - n1 = idx.length, i; - - for (i=0; i 0) for (i=0; i remove - var n = size, - idx, i, j; - - // seek forward to first removal - for (i=0; !map[index[i]] && i y ? 1 : 0; - }); - return permute(values, index); -} - -function merge$1(base, value0, index0, n0, value1, index1, n1, value, index) { - var i0 = 0, i1 = 0, i; - - for (i=0; i0 < n0 && i1 < n1; ++i) { - if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - } - - for (; i0 < n0; ++i0, ++i) { - value[i] = value0[i0]; - index[i] = index0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } -} - -/** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ -function CrossFilter(params) { - Transform.call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; -} - -CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'query', 'type': 'array', 'array': true, 'required': true, - 'content': {'type': 'number', 'array': true, 'length': 2} } - ] -}; - -var prototype$1q = inherits(CrossFilter, Transform); - -prototype$1q.transform = function(_, pulse) { - if (!this._dims) { - return this.init(_, pulse); - } else { - var init = _.modified('fields') - || _.fields.some(function(f) { return pulse.modified(f.fields); }); - - return init - ? this.reinit(_, pulse) - : this.eval(_, pulse); - } -}; - -prototype$1q.init = function(_, pulse) { - var fields = _.fields, - query = _.query, - indices = this._indices = {}, - dims = this._dims = [], - m = query.length, - i = 0, key, index; - - // instantiate indices and dimensions - for (; i lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - dim.range = query.slice(); -}; - -prototype$1q.incrementOne = function(dim, query, add, rem) { - var bits = this.value, - curr = bits.curr(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, j, k; - - // Fast incremental update based on previous lo index. - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - dim.range = query.slice(); -}; - -/** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ -function ResolveFilter(params) { - Transform.call(this, null, params); -} - -ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [ - { 'name': 'ignore', 'type': 'number', 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' }, - { 'name': 'filter', 'type': 'object', 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' } - ] -}; - -var prototype$1r = inherits(ResolveFilter, Transform); - -prototype$1r.transform = function(_, pulse) { - var ignore = ~(_.ignore || 0), // bit mask where zeros -> dims to ignore - bitmap = _.filter, - mask = bitmap.mask; - - // exit early if no relevant filter changes - if ((mask & ignore) === 0) return pulse.StopPropagation; - - var output = pulse.fork(pulse.ALL), - data = bitmap.data(), - curr = bitmap.curr(), - prev = bitmap.prev(), - pass = function(k) { - return !(curr[k] & ignore) ? data[k] : null; - }; - - // propagate all mod tuples that pass the filter - output.filter(output.MOD, pass); - - // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - - if (!(mask & (mask-1))) { // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, function(k) { - return (curr[k] & ignore) === mask ? data[k] : null; - }); - - } else { // multiple filters changed - output.filter(output.ADD, function(k) { - var c = curr[k] & ignore, - f = !c && (c ^ (prev[k] & ignore)); - return f ? data[k] : null; - }); - output.filter(output.REM, function(k) { - var c = curr[k] & ignore, - f = c && !(c ^ (c ^ (prev[k] & ignore))); - return f ? data[k] : null; - }); - } - - // add filter to source data in case of reflow... - return output.filter(output.SOURCE, function(t) { return pass(t._index); }); -}; - -var xf = /*#__PURE__*/Object.freeze({ - __proto__: null, - crossfilter: CrossFilter, - resolvefilter: ResolveFilter -}); - -var version = "5.13.0"; - -// initialize aria role and label attributes -function initializeAria(view) { - const el = view.container(); - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } -} - -// update aria-label if we have a DOM container element -function ariaLabel(el, desc) { - if (el) desc == null - ? el.removeAttribute('aria-label') - : el.setAttribute('aria-label', desc); -} - -function background$1(view) { - // respond to background signal - view.add(null, _ => { - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { bg: view._signals.background }); -} - -const Default = 'default'; - -function cursor(view) { - // get cursor signal, add to dataflow if needed - const cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); - - // evaluate cursor on each mousemove event - view.on(view.events('view', 'mousemove'), cursor, - function(_, event) { - const value = cursor.value, - user = value ? (isString(value) ? value : value.user) : Default, - item = event.item && event.item.cursor || null; - - return (value && user === value.user && item == value.item) - ? value - : {user: user, item: item}; - } - ); - - // when cursor signal updates, set visible cursor - view.add(null, function(_) { - let user = _.cursor, - item = this.value; - - if (!isString(user)) { - item = user.item; - user = user.user; - } - - setCursor(view, user && user !== Default ? user : (item || user)); - - return item; - }, {cursor: cursor}); -} - -function setCursor(view, cursor) { - const el = view.globalCursor() - ? (typeof document !== 'undefined' && document.body) - : view.container(); - - if (el) { - return cursor == null - ? el.style.removeProperty('cursor') - : (el.style.cursor = cursor); - } -} - -function dataref(view, name) { - var data = view._runtime.data; - if (!hasOwnProperty(data, name)) { - error('Unrecognized data set: ' + name); - } - return data[name]; -} - -function data(name, values) { - return arguments.length < 2 - ? dataref(this, name).values.value - : change.call(this, name, changeset().remove(truthy).insert(values)); -} - -function change(name, changes) { - if (!isChangeSet(changes)) { - error('Second argument to changes must be a changeset.'); - } - var dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); -} - -function insert(name, _) { - return change.call(this, name, changeset().insert(_)); -} - -function remove(name, _) { - return change.call(this, name, changeset().remove(_)); -} - -function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); -} - -function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); -} - -function offset$3(view) { - var padding = view.padding(), - origin = view._origin; - return [ - padding.left + origin[0], - padding.top + origin[1] - ]; -} - -function resizeRenderer(view) { - var origin = offset$3(view), - w = width(view), - h = height(view); - - view._renderer.background(view.background()); - view._renderer.resize(w, h, origin); - view._handler.origin(origin); - - view._resizeListeners.forEach(function(handler) { - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); -} - -/** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ -function eventExtend(view, event, item) { - var r = view._renderer, - el = r && r.canvas(), - p, e, translate; - - if (el) { - translate = offset$3(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = point(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; -} - -function extension(view, item, point) { - var itemGroup = item - ? item.mark.marktype === 'group' ? item : item.mark.group - : null; - - function group(name) { - var g = itemGroup, i; - if (name) for (i = item; i; i = i.mark.group) { - if (i.mark.name === name) { g = i; break; } - } - return g && g.mark && g.mark.interactive ? g : {}; - } - - function xy(item) { - if (!item) return point; - if (isString(item)) item = group(item); - - var p = point.slice(); - while (item) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - return p; - } - - return { - view: constant(view), - item: constant(item || {}), - group: group, - xy: xy, - x: function(item) { return xy(item)[0]; }, - y: function(item) { return xy(item)[1]; } - }; -} - -const VIEW = 'view', - TIMER = 'timer', - WINDOW = 'window', - NO_TRAP = {trap: false}; - -/** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ -function initializeEventConfig(config) { - const events = extend({defaults: {}}, config); - - const unpack = (obj, keys) => { - keys.forEach(k => { - if (isArray(obj[k])) obj[k] = toSet(obj[k]); - }); - }; - - unpack(events.defaults, ['prevent', 'allow']); - unpack(events, ['view', 'window', 'selector']); - - return events; -} - -function prevent(view, type) { - var def = view._eventConfig.defaults, - prevent = def.prevent, - allow = def.allow; - - return prevent === false || allow === true ? false - : prevent === true || allow === false ? true - : prevent ? prevent[type] - : allow ? !allow[type] - : view.preventDefault(); -} - -function permit(view, key, type) { - const rule = view._eventConfig && view._eventConfig[key]; - - if (rule === false || (isObject(rule) && !rule[type])) { - view.warn(`Blocked ${key} ${type} event listener.`); - return false; - } - - return true; -} - -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ -function events$1(source, type, filter) { - var view = this, - s = new EventStream(filter), - send = function(e, item) { - view.runAsync(null, () => { - if (source === VIEW && prevent(view, type)) { - e.preventDefault(); - } - s.receive(eventExtend(view, e, item)); - }); - }, - sources; - - if (source === TIMER) { - if (permit(view, 'timer', type)) { - view.timer(send, type); - } - } - - else if (source === VIEW) { - if (permit(view, 'view', type)) { - // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } - } - - else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') { - sources = [window]; - } - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) { - sources = document.querySelectorAll(source); - } - } - - if (!sources) { - view.warn('Can not resolve event source: ' + source); - } else { - for (var i=0, n=sources.length; i= 0) { - timers[n].stop(); - } - - n = listeners.length; - while (--n >= 0) { - e = listeners[n]; - m = e.sources.length; - while (--m >= 0) { - e.sources[m].removeEventListener(e.type, e.handler); - } - } - - if (tooltip) { - tooltip.call(this, this._handler, null, null, null); - } - - return this; -} - -function element$1(tag, attr, text) { - var el = document.createElement(tag); - for (var key in attr) el.setAttribute(key, attr[key]); - if (text != null) el.textContent = text; - return el; -} - -const BindClass = 'vega-bind', - NameClass = 'vega-bind-name', - RadioClass = 'vega-bind-radio'; - -/** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ -function bind$1(view, el, binding) { - if (!el) return; - - const param = binding.param; - let bind = binding.state; - - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: value => { - if (value !== view.signal(param.signal)) { - view.runAsync(null, function() { - bind.source = true; - view.signal(param.signal, value); - }); - } - } - }; - if (param.debounce) { - bind.update = debounce(param.debounce, bind.update); - } - } - - generate(bind, el, param, view.signal(param.signal)); - - if (!bind.active) { - view.on(view._signals[param.signal], null, () => { - bind.source - ? (bind.source = false) - : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - - return bind; -} - -/** - * Generate an HTML input form element and bind it to a signal. - */ -function generate(bind, el, param, value) { - const div = element$1('div', {'class': BindClass}); - - const wrapper = param.input === 'radio' - ? div - : div.appendChild(element$1('label')); - - wrapper.appendChild(element$1('span', - {'class': NameClass}, - (param.name || param.signal) - )); - - el.appendChild(div); - - let input = form; - switch (param.input) { - case 'checkbox': input = checkbox; break; - case 'select': input = select; break; - case 'radio': input = radio; break; - case 'range': input = range; break; - } - - input(bind, wrapper, param, value); -} - -/** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ -function form(bind, el, param, value) { - const node = element$1('input'); - - for (const key in param) { - if (key !== 'signal' && key !== 'element') { - node.setAttribute(key === 'input' ? 'type' : key, param[key]); - } - } - node.setAttribute('name', param.signal); - node.value = value; - - el.appendChild(node); - node.addEventListener('input', () => bind.update(node.value)); - - bind.elements = [node]; - bind.set = value => node.value = value; -} - -/** - * Generates a checkbox input element. - */ -function checkbox(bind, el, param, value) { - const attr = {type: 'checkbox', name: param.signal}; - if (value) attr.checked = true; - const node = element$1('input', attr); - - el.appendChild(node); - node.addEventListener('change', () => bind.update(node.checked)); - - bind.elements = [node]; - bind.set = value => node.checked = !!value || null; -} - -/** - * Generates a selection list input element. - */ -function select(bind, el, param, value) { - const node = element$1('select', {name: param.signal}), - labels = param.labels || []; - - param.options.forEach((option, i) => { - const attr = {value: option}; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element$1('option', attr, (labels[i] || option)+'')); - }); - - el.appendChild(node); - - node.addEventListener('change', () => { - bind.update(param.options[node.selectedIndex]); - }); - - bind.elements = [node]; - bind.set = value => { - for (let i = 0, n = param.options.length; i < n; ++i) { - if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; return; - } - } - }; -} - -/** - * Generates a radio button group. - */ -function radio(bind, el, param, value) { - const group = element$1('span', {'class': RadioClass}), - labels = param.labels || []; - - el.appendChild(group); - - bind.elements = param.options.map((option, i) => { - const attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - - const input = element$1('input', attr); - input.addEventListener('change', () => bind.update(option)); - - const label = element$1('label', {}, (labels[i] || option)+''); - label.prepend(input); - group.appendChild(label); - - return input; - }); - - bind.set = value => { - const nodes = bind.elements, - n = nodes.length; - for (let i = 0; i < n; ++i) { - if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - } - }; -} - -/** - * Generates a slider input element. - */ -function range(bind, el, param, value) { - value = value !== undefined ? value : ((+param.max) + (+param.min)) / 2; - - const max = param.max != null ? param.max : Math.max(100, +value) || 100, - min = param.min || Math.min(0, max, +value) || 0, - step = param.step || tickStep(min, max, 100); - - const node = element$1('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - - const span = element$1('span', {}, +value); - - el.appendChild(node); - el.appendChild(span); - - const update = () => { - span.textContent = node.value; - bind.update(+node.value); - }; - - // subscribe to both input and change - node.addEventListener('input', update); - node.addEventListener('change', update); - - bind.elements = [node]; - bind.set = value => { - node.value = value; - span.textContent = value; - }; -} - -function valuesEqual(a, b) { - return a === b || (a+'' === b+''); -} - -function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r - .initialize(el, width(view), height(view), offset$3(view), scaleFactor, opt) - .background(view.background()); -} - -function trap(view, fn) { - return !fn ? null : function() { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; -} - -function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - var handler = new constructor(view.loader(), trap(view, view.tooltip())) - .scene(view.scenegraph().root) - .initialize(el, offset$3(view), view); - - // transfer event handlers - if (prevHandler) { - prevHandler.handlers().forEach(function(h) { - handler.on(h.type, h.handler); - }); - } - - return handler; -} - -function initialize$1(el, elBind) { - const view = this, - type = view._renderType, - config = view._eventConfig.bind, - module = renderModule(type); - - // containing dom element - el = view._el = el ? lookup$4(view, el) : null; - - // initialize aria attributes - initializeAria(view); - - // select appropriate renderer & handler - if (!module) view.error('Unrecognized renderer type: ' + type); - const Handler = module.handler || CanvasHandler, - Renderer = (el ? module.renderer : module.headless); - - // initialize renderer and input handler - view._renderer = !Renderer ? null - : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; - - // initialize signal bindings - if (el && config !== 'none') { - elBind = elBind ? (view._elBind = lookup$4(view, elBind)) - : el.appendChild(element$1('form', {'class': 'vega-bindings'})); - - view._bind.forEach(function(_) { - if (_.param.element && config !== 'container') { - _.element = lookup$4(view, _.param.element); - } - }); - - view._bind.forEach(function(_) { - bind$1(view, _.element || elBind, _); - }); - } - - return view; -} - -function lookup$4(view, el) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; - } - } - if (el) { - try { - el.innerHTML = ''; - } catch (e) { - el = null; - view.error(e); - } - } - return el; -} - -const number$5 = _ => +_ || 0; - -const paddingObject = _ => ({top: _, bottom: _, left: _, right: _}); - -function padding(_) { - return isObject(_) - ? { - top: number$5(_.top), - bottom: number$5(_.bottom), - left: number$5(_.left), - right: number$5(_.right) - } - : paddingObject(number$5(_)); -} - -/** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ -async function renderHeadless(view, type, scaleFactor, opt) { - const module = renderModule(type), - ctr = module && module.headless; - - if (!ctr) error('Unrecognized renderer type: ' + type); - - await view.runAsync(); - return initializeRenderer(view, null, null, ctr, scaleFactor, opt) - .renderAsync(view._scenegraph.root); -} - -/** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ -async function renderToImageURL(type, scaleFactor) { - if (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG) { - error('Unrecognized image type: ' + type); - } - - const r = await renderHeadless(this, type, scaleFactor); - return type === RenderType.SVG - ? toBlobURL(r.svg(), 'image/svg+xml') - : r.canvas().toDataURL('image/png'); -} - -function toBlobURL(data, mime) { - var blob = new Blob([data], {type: mime}); - return window.URL.createObjectURL(blob); -} - -/** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ -async function renderToCanvas(scaleFactor, opt) { - const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt); - return r.canvas(); -} - -/** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ -async function renderToSVG(scaleFactor) { - const r = await renderHeadless(this, RenderType.SVG, scaleFactor); - return r.svg(); -} - -function data$1(name) { - const data = this.context.data[name]; - return data ? data.values.value : []; -} - -function indata(name, field, value) { - const index = this.context.data[name]['index:' + field], - entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; -} - -function setdata(name, tuples) { - const df = this.context.dataflow, - data = this.context.data[name], - input = data.input; - - df.pulse(input, df.changeset().remove(truthy).insert(tuples)); - return 1; -} - -function encode$1(item, name, retval) { - if (item) { - const df = this.context.dataflow, - target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - return retval !== undefined ? retval : item; -} - -const wrap = method => function(value, spec) { - const locale = this.context.dataflow.locale(); - return locale[method](spec)(value); -}; - -const format$2 = wrap('format'); -const timeFormat = wrap('timeFormat'); -const utcFormat = wrap('utcFormat'); -const timeParse = wrap('timeParse'); -const utcParse = wrap('utcParse'); - -var dateObj = new Date(2000, 0, 1); - -function time$1(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); - dateObj.setMonth(month); - dateObj.setDate(day); - return timeFormat.call(this, dateObj, specifier); -} - -function monthFormat(month) { - return time$1.call(this, month, 1, '%B'); -} - -function monthAbbrevFormat(month) { - return time$1.call(this, month, 1, '%b'); -} - -function dayFormat(day) { - return time$1.call(this, 0, 2 + day, '%A'); -} - -function dayAbbrevFormat(day) { - return time$1.call(this, 0, 2 + day, '%a'); -} - -const DataPrefix = ':'; -const IndexPrefix = '@'; -const ScalePrefix = '%'; -const SignalPrefix = '$'; - -var RawCode = 'RawCode'; -var Literal = 'Literal'; -var Property = 'Property'; -var Identifier$1 = 'Identifier'; - -var ArrayExpression = 'ArrayExpression'; -var BinaryExpression = 'BinaryExpression'; -var CallExpression = 'CallExpression'; -var ConditionalExpression = 'ConditionalExpression'; -var LogicalExpression = 'LogicalExpression'; -var MemberExpression = 'MemberExpression'; -var ObjectExpression = 'ObjectExpression'; -var UnaryExpression = 'UnaryExpression'; - -function ASTNode(type) { - this.type = type; -} - -ASTNode.prototype.visit = function(visitor) { - var node = this, c, i, n; - - if (visitor(node)) return 1; - - for (c=children$1(node), i=0, n=c.length; i - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - - 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. - - 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 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. -*/ - -var TokenName, - source$1, - index, - length, - lookahead; - -var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; - -TokenName = {}; -TokenName[TokenBooleanLiteral] = 'Boolean'; -TokenName[TokenEOF] = ''; -TokenName[TokenIdentifier] = 'Identifier'; -TokenName[TokenKeyword] = 'Keyword'; -TokenName[TokenNullLiteral] = 'Null'; -TokenName[TokenNumericLiteral] = 'Numeric'; -TokenName[TokenPunctuator] = 'Punctuator'; -TokenName[TokenStringLiteral] = 'String'; -TokenName[TokenRegularExpression] = 'RegularExpression'; - -var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; - -// Error messages should be identical to V8. -var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; - -var ILLEGAL = 'ILLEGAL', - DISABLED = 'Disabled.'; - -// See also tools/generate-unicode-regex.py. -var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), - // eslint-disable-next-line no-misleading-character-class - RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C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0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); - -// Ensure the condition is true, otherwise throw an error. -// This is only to have a better contract semantic, i.e. another safety net -// to catch a logic error. The condition shall be fulfilled in normal case. -// Do NOT use this to enforce a certain condition on any user input. - -function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } -} - -function isDecimalDigit(ch) { - return (ch >= 0x30 && ch <= 0x39); // 0..9 -} - -function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; -} - -function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; -} - -// 7.2 White Space - -function isWhiteSpace(ch) { - return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || - (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); -} - -// 7.3 Line Terminators - -function isLineTerminator(ch) { - return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); -} - -// 7.6 Identifier Names and Identifiers - -function isIdentifierStart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch))); -} - -function isIdentifierPart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch >= 0x30 && ch <= 0x39) || // 0..9 - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch))); -} - -// 7.6.1.1 Keywords - -var keywords = { - 'if':1, 'in':1, 'do':1, - 'var':1, 'for':1, 'new':1, 'try':1, 'let':1, - 'this':1, 'else':1, 'case':1, 'void':1, 'with':1, 'enum':1, - 'while':1, 'break':1, 'catch':1, 'throw':1, 'const':1, 'yield':1, 'class':1, 'super':1, - 'return':1, 'typeof':1, 'delete':1, 'switch':1, 'export':1, 'import':1, 'public':1, 'static':1, - 'default':1, 'finally':1, 'extends':1, 'package':1, 'private':1, - 'function':1, 'continue':1, 'debugger':1, - 'interface':1, 'protected':1, - 'instanceof':1, 'implements':1 -}; - -function skipComment() { - var ch; - - while (index < length) { - ch = source$1.charCodeAt(index); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index; - } else { - break; - } - } -} - -function scanHexEscape(prefix) { - var i, len, ch, code = 0; - - len = (prefix === 'u') ? 4 : 2; - for (i = 0; i < len; ++i) { - if (index < length && isHexDigit(source$1[index])) { - ch = source$1[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - return String.fromCharCode(code); -} - -function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - - ch = source$1[index]; - code = 0; - - // At least, one hex digit is required. - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - while (index < length) { - ch = source$1[index++]; - if (!isHexDigit(ch)) { - break; - } - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - // UTF-16 Encoding - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - cu1 = ((code - 0x10000) >> 10) + 0xD800; - cu2 = ((code - 0x10000) & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); -} - -function getEscapedIdentifier() { - var ch, id; - - ch = source$1.charCodeAt(index++); - id = String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source$1.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id = ch; - } - - while (index < length) { - ch = source$1.charCodeAt(index); - if (!isIdentifierPart(ch)) { - break; - } - ++index; - id += String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source$1.charCodeAt(index) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id += ch; - } - } - - return id; -} - -function getIdentifier() { - var start, ch; - - start = index++; - while (index < length) { - ch = source$1.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); - } - if (isIdentifierPart(ch)) { - ++index; - } else { - break; - } - } - - return source$1.slice(start, index); -} - -function scanIdentifier() { - var start, id, type; - - start = index; - - // Backslash (U+005C) starts an escaped character. - id = (source$1.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); - - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index - }; -} - -// 7.7 Punctuators - -function scanPunctuator() { - var start = index, - code = source$1.charCodeAt(index), - code2, - ch1 = source$1[index], - ch2, - ch3, - ch4; - - switch (code) { - - // Check for most common single-character punctuators. - case 0x2E: // . dot - case 0x28: // ( open bracket - case 0x29: // ) close bracket - case 0x3B: // ; semicolon - case 0x2C: // , comma - case 0x7B: // { open curly brace - case 0x7D: // } close curly brace - case 0x5B: // [ - case 0x5D: // ] - case 0x3A: // : - case 0x3F: // ? - case 0x7E: // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - - default: - code2 = source$1.charCodeAt(index + 1); - - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - case 0x2D: // - - case 0x2F: // / - case 0x3C: // < - case 0x3E: // > - case 0x5E: // ^ - case 0x7C: // | - case 0x25: // % - case 0x26: // & - case 0x2A: // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - - case 0x21: // ! - case 0x3D: // = - index += 2; - - // !== and === - if (source$1.charCodeAt(index) === 0x3D) { - ++index; - } - return { - type: TokenPunctuator, - value: source$1.slice(start, index), - start: start, - end: index - }; - } - } - } - - // 4-character punctuator: >>>= - - ch4 = source$1.substr(index, 4); - - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } - - // 3-character punctuators: === !== >>> <<= >>= - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } - - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - - if ((ch1 === ch2[1] && ('+-<>&|'.indexOf(ch1) >= 0)) || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } - - // 1-character punctuators: < > = ! + - * % & | ^ / - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL); -} - -// 7.8.3 Numeric Literals - -function scanHexLiteral(start) { - var number = ''; - - while (index < length) { - if (!isHexDigit(source$1[index])) { - break; - } - number += source$1[index++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - if (isIdentifierStart(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index - }; -} - -function scanOctalLiteral(start) { - var number = '0' + source$1[index++]; - while (index < length) { - if (!isOctalDigit(source$1[index])) { - break; - } - number += source$1[index++]; - } - - if (isIdentifierStart(source$1.charCodeAt(index)) || isDecimalDigit(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; -} - -function scanNumericLiteral() { - var number, start, ch; - - ch = source$1[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), - 'Numeric literal must start with a decimal digit or a decimal point'); - - start = index; - number = ''; - if (ch !== '.') { - number = source$1[index++]; - ch = source$1[index]; - - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } - - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - ch = source$1[index]; - } - - if (ch === '.') { - number += source$1[index++]; - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - ch = source$1[index]; - } - - if (ch === 'e' || ch === 'E') { - number += source$1[index++]; - - ch = source$1[index]; - if (ch === '+' || ch === '-') { - number += source$1[index++]; - } - if (isDecimalDigit(source$1.charCodeAt(index))) { - while (isDecimalDigit(source$1.charCodeAt(index))) { - number += source$1[index++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - if (isIdentifierStart(source$1.charCodeAt(index))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; -} - -// 7.8.4 String Literals - -function scanStringLiteral() { - var str = '', - quote, start, ch, code, octal = false; - - quote = source$1[index]; - assert((quote === '\'' || quote === '"'), - 'String literal must starts with a quote'); - - start = index; - ++index; - - while (index < length) { - ch = source$1[index++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source$1[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source$1[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - - // \0 is not octal escape sequence - if (code !== 0) { - octal = true; - } - - if (index < length && isOctalDigit(source$1[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source$1[index++]); - - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.indexOf(ch) >= 0 && - index < length && - isOctalDigit(source$1[index])) { - code = code * 8 + '01234567'.indexOf(source$1[index++]); - } - } - str += String.fromCharCode(code); - } else { - str += ch; - } - break; - } - } else { - if (ch === '\r' && source$1[index] === '\n') { - ++index; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index - }; -} - -function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp - .replace(/\\u\{([0-9a-fA-F]+)\}/g, function($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - throwError({}, MessageInvalidRegExp); - }) - .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } - - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } - - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } -} - -function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - - ch = source$1[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source$1[index++]; - - classMarker = false; - terminated = false; - while (index < length) { - ch = source$1[index++]; - str += ch; - if (ch === '\\') { - ch = source$1[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } - - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; -} - -function scanRegExpFlags() { - var ch, str, flags; - - str = ''; - flags = ''; - while (index < length) { - ch = source$1[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index; - if (ch === '\\' && index < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; -} - -function scanRegExp() { - var start, body, flags, value; - - lookahead = null; - skipComment(); - start = index; - - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index - }; -} - -function isIdentifierName(token) { - return token.type === TokenIdentifier || - token.type === TokenKeyword || - token.type === TokenBooleanLiteral || - token.type === TokenNullLiteral; -} - -function advance() { - var ch; - - skipComment(); - - if (index >= length) { - return { - type: TokenEOF, - start: index, - end: index - }; - } - - ch = source$1.charCodeAt(index); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } - - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } - - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } - - - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source$1.charCodeAt(index + 1))) { - return scanNumericLiteral(); - } - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); -} - -function lex() { - var token; - - token = lookahead; - index = token.end; - - lookahead = advance(); - - index = token.end; - - return token; -} - -function peek$1() { - var pos; - - pos = index; - - lookahead = advance(); - index = pos; -} - -function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; -} - -function finishBinaryExpression(operator, left, right) { - var node = new ASTNode((operator === '||' || operator === '&&') ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; -} - -function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; -} - -function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; -} - -function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; -} - -function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source$1.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - node.regex = token.regex; - } - return node; -} - -function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; -} - -function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; -} - -function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; -} - -function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; -} - -// Throw an exception - -function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace( - /%(\d)/g, - function(whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - } - ); - - - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; -} - -// Throw an exception because of the token. - -function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } - - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); -} - -// Expect the next token to match the specified punctuator. -// If not, an exception will be thrown. - -function expect(value) { - var token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } -} - -// Return true if the next token matches the specified punctuator. - -function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; -} - -// Return true if the next token matches the specified keyword - -function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; -} - -// 11.1.4 Array Initialiser - -function parseArrayInitialiser() { - var elements = []; - - index = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - - return finishArrayExpression(elements); -} - -// 11.1.5 Object Initialiser - -function parseObjectPropertyKey() { - var token; - - index = lookahead.start; - token = lex(); - - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - return finishLiteral(token); - } - - return finishIdentifier(token.value); -} - -function parseObjectProperty() { - var token, key, id, value; - - index = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } -} - -function parseObjectInitialiser() { - var properties = [], - property, name, key, map = {}, - toString = String; - - index = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - - return finishObjectExpression(properties); -} - -// 11.1.6 The Grouping Operator - -function parseGroupExpression() { - var expr; - - expect('('); - - expr = parseExpression(); - - expect(')'); - - return expr; -} - - -// 11.1 Primary Expressions - -var legalKeywords = { - 'if': 1 -}; - -function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index = lookahead.start; - - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = (token.value === 'true'); - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek$1(); - } else { - throwUnexpected(lex()); - } - - return expr; -} - -// 11.2 Left-Hand-Side Expressions - -function parseArguments() { - var args = []; - - expect('('); - - if (!match(')')) { - while (index < length) { - args.push(parseConditionalExpression()); - if (match(')')) { - break; - } - expect(','); - } - } - - expect(')'); - - return args; -} - -function parseNonComputedProperty() { - var token; - index = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); -} - -function parseNonComputedMember() { - expect('.'); - - return parseNonComputedProperty(); -} - -function parseComputedMember() { - var expr; - - expect('['); - - expr = parseExpression(); - - expect(']'); - - return expr; -} - -function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; -} - -// 11.3 Postfix Expressions - -function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if ((match('++') || match('--'))) { - throw new Error(DISABLED); - } - } - - return expr; -} - -// 11.4 Unary Operators - -function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; -} - -function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - } - - return prec; -} - -// 11.5 Multiplicative Operators -// 11.6 Additive Operators -// 11.7 Bitwise Shift Operators -// 11.8 Relational Operators -// 11.9 Equality Operators -// 11.10 Binary Bitwise Operators -// 11.11 Binary Logical Operators - -function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - - marker = lookahead; - left = parseUnaryExpression(); - - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) { - return left; - } - token.prec = prec; - lex(); - - markers = [marker, lookahead]; - right = parseUnaryExpression(); - - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - - // Reduce: make a binary expression from the three topmost entries. - while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; -} - -// 11.12 Conditional Operator - -function parseConditionalExpression() { - var expr, consequent, alternate; - - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; -} - -// 11.14 Comma Operator - -function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; -} - -function parse$3(code) { - source$1 = code; - index = 0; - length = source$1.length; - lookahead = null; - - peek$1(); - - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - return expr; -} - -var constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' -}; - -function functions(codegen) { - - function fncall(name, args, cast, type) { - var obj = codegen(args[0]); - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - return obj + '.' + name + (type < 0 ? '' : type === 0 ? - '()' : - '(' + args.slice(1).map(codegen).join(',') + ')'); - } - - function fn(name, cast, type) { - return function(args) { - return fncall(name, args, cast, type); - }; - } - - var DATE = 'new Date', - STRING = 'String', - REGEXP = 'RegExp'; - - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - - clamp: function(args) { - if (args.length < 3) error('Missing arguments to clamp function.'); - if (args.length > 3) error('Too many arguments to clamp function.'); - var a = args.map(codegen); - return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))'; - }, - - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - - // sequence functions - length: fn('length', null, -1), - join: fn('join', null), - indexof: fn('indexOf', null), - lastindexof: fn('lastIndexOf', null), - slice: fn('slice', null), - - reverse: function(args) { - return '('+codegen(args[0])+').slice().reverse()'; - }, - - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - replace: fn('replace', STRING), - trim: fn('trim', STRING, 0), - - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - - // Control Flow functions - if: function(args) { - if (args.length < 3) error('Missing arguments to if function.'); - if (args.length > 3) error('Too many arguments to if function.'); - var a = args.map(codegen); - return '('+a[0]+'?'+a[1]+':'+a[2]+')'; - } - }; -} - -function stripQuotes(s) { - var n = s && s.length - 1; - return n && ( - (s[0]==='"' && s[n]==='"') || - (s[0]==='\'' && s[n]==='\'') - ) ? s.slice(1, -1) : s; -} - -function codegen(opt) { - opt = opt || {}; - - var whitelist = opt.whitelist ? toSet(opt.whitelist) : {}, - blacklist = opt.blacklist ? toSet(opt.blacklist) : {}, - constants$1 = opt.constants || constants, - functions$1 = (opt.functions || functions)(visit), - globalvar = opt.globalvar, - fieldvar = opt.fieldvar, - globals = {}, - fields = {}, - memberDepth = 0; - - var outputGlobal = isFunction(globalvar) - ? globalvar - : function (id) { return globalvar + '["' + id + '"]'; }; - - function visit(ast) { - if (isString(ast)) return ast; - var generator = Generators[ast.type]; - if (generator == null) error('Unsupported type: ' + ast.type); - return generator(ast); - } - - var Generators = { - Literal: function(n) { - return n.raw; - }, - - Identifier: function(n) { - var id = n.name; - if (memberDepth > 0) { - return id; - } else if (hasOwnProperty(blacklist, id)) { - return error('Illegal identifier: ' + id); - } else if (hasOwnProperty(constants$1, id)) { - return constants$1[id]; - } else if (hasOwnProperty(whitelist, id)) { - return id; - } else { - globals[id] = 1; - return outputGlobal(id); - } - }, - - MemberExpression: function(n) { - var d = !n.computed; - var o = visit(n.object); - if (d) memberDepth += 1; - var p = visit(n.property); - if (o === fieldvar) { - // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - } - if (d) memberDepth -= 1; - return o + (d ? '.'+p : '['+p+']'); - }, - - CallExpression: function(n) { - if (n.callee.type !== 'Identifier') { - error('Illegal callee type: ' + n.callee.type); - } - var callee = n.callee.name; - var args = n.arguments; - var fn = hasOwnProperty(functions$1, callee) && functions$1[callee]; - if (!fn) error('Unrecognized function: ' + callee); - return isFunction(fn) - ? fn(args) - : fn + '(' + args.map(visit).join(',') + ')'; - }, - - ArrayExpression: function(n) { - return '[' + n.elements.map(visit).join(',') + ']'; - }, - - BinaryExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - UnaryExpression: function(n) { - return '(' + n.operator + visit(n.argument) + ')'; - }, - - ConditionalExpression: function(n) { - return '(' + visit(n.test) + - '?' + visit(n.consequent) + - ':' + visit(n.alternate) + - ')'; - }, - - LogicalExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - ObjectExpression: function(n) { - return '{' + n.properties.map(visit).join(',') + '}'; - }, - - Property: function(n) { - memberDepth += 1; - var k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - - function codegen(ast) { - var result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; - } - - codegen.functions = functions$1; - codegen.constants = constants$1; - - return codegen; -} - -function dataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) { - error('First argument to data functions must be a string literal.'); - } - - const data = args[0].value, - dataName = DataPrefix + data; - - if (!hasOwnProperty(dataName, params)) { - try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) { - // if data set does not exist, there's nothing to track - } - } -} - -function indataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to indata must be a string literal.'); - if (args[1].type !== Literal) error('Second argument to indata must be a string literal.'); - - const data = args[0].value, - field = args[1].value, - indexName = IndexPrefix + field; - - if (!hasOwnProperty(indexName, params)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } -} - -function scaleVisitor(name, args, scope, params) { - if (args[0].type === Literal) { - // add scale dependency - addScaleDependency(scope, params, args[0].value); - } else { - // indirect scale lookup; add all scales as parameters - for (name in scope.scales) { - addScaleDependency(scope, params, name); - } - } -} - -function addScaleDependency(scope, params, name) { - const scaleName = ScalePrefix + name; - if (!hasOwnProperty(params, scaleName)) { - try { - params[scaleName] = scope.scaleRef(name); - } catch (err) { - // TODO: error handling? warning? - } - } -} - -function getScale(name, ctx) { - let s; - return isFunction(name) ? name - : isString(name) ? (s = ctx.scales[name]) && s.value - : undefined; -} - -function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = s => s && s.bandwidth ? s.bandwidth() : 0; - - // register AST visitors for internal scale functions - visitors._bandwidth = scaleVisitor; - visitors._range = scaleVisitor; - visitors._scale = scaleVisitor; - - // resolve scale reference directly to the signal hash argument - const ref = arg => '_[' + ( - arg.type === Literal - ? $(ScalePrefix + arg.value) - : $(ScalePrefix) + '+' + codegen(arg) - ) + ']'; - - // define and return internal scale function code generators - // these internal functions are called by mark encoders - return { - _bandwidth: args => `this.__bandwidth(${ref(args[0])})`, - _range: args => `${ref(args[0])}.range()`, - _scale: args => `${ref(args[0])}(${codegen(args[1])})` - }; -} - -function geoMethod(methodName, globalMethod) { - return function(projection, geojson, group) { - if (projection) { - // projection defined, use it - const p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else { - // projection undefined, use global method - return globalMethod(geojson); - } - }; -} - -const geoArea = geoMethod('area', geoArea$1); -const geoBounds = geoMethod('bounds', geoBounds$1); -const geoCentroid = geoMethod('centroid', geoCentroid$1); - -function inScope(item) { - let group = this.context.group, - value = false; - - if (group) while (item) { - if (item === group) { value = true; break; } - item = item.mark.group; - } - return value; -} - -function log$3(df, method, args) { - try { - df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args))); - } catch (err) { - df.warn(err); - } - return args[args.length-1]; -} - -function warn() { - return log$3(this.context.dataflow, 'warn', arguments); -} - -function info() { - return log$3(this.context.dataflow, 'info', arguments); -} - -function debug() { - return log$3(this.context.dataflow, 'debug', arguments); -} - -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef -function channel_luminance_value(channelValue) { - const val = channelValue / 255; - if (val <= 0.03928) { - return val / 12.92; - } - return Math.pow((val + 0.055) / 1.055, 2.4); -} - -function luminance(color) { - const c = rgb(color), - r = channel_luminance_value(c.r), - g = channel_luminance_value(c.g), - b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; -} - -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef -function contrast(color1, color2) { - const lum1 = luminance(color1), - lum2 = luminance(color2), - lumL = Math.max(lum1, lum2), - lumD = Math.min(lum1, lum2); - return (lumL + 0.05) / (lumD + 0.05); -} - -function merge$2() { - var args = [].slice.call(arguments); - args.unshift({}); - return extend.apply(null, args); -} - -function equal(a, b) { - return a === b || a !== a && b !== b ? true - : isArray(a) ? ( - isArray(b) && a.length === b.length ? equalArray(a, b) : false - ) - : isObject(a) && isObject(b) ? equalObject(a, b) - : false; -} - -function equalArray(a, b) { - for (let i=0, n=a.length; i equalObject(props, _); -} - -function modify(name, insert, remove, toggle, modify, values) { - let df = this.context.dataflow, - data = this.context.data[name], - input = data.input, - changes = data.changes, - stamp = df.stamp(), - predicate, key; - - if (df._trigger === false || !(input.value.length || insert || toggle)) { - // nothing to do! - return 0; - } - - if (!changes || changes.stamp < stamp) { - data.changes = (changes = df.changeset()); - changes.stamp = stamp; - df.runAfter(function() { - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - - if (remove) { - predicate = remove === true ? truthy - : (isArray(remove) || isTuple(remove)) ? remove - : removePredicate(remove); - changes.remove(predicate); - } - - if (insert) { - changes.insert(insert); - } - - if (toggle) { - predicate = removePredicate(toggle); - if (input.value.some(predicate)) { - changes.remove(predicate); - } else { - changes.insert(toggle); - } - } - - if (modify) { - for (key in values) { - changes.modify(modify, key, values[key]); - } - } - - return 1; -} - -function pinchDistance(event) { - const t = event.touches, - dx = t[0].clientX - t[1].clientX, - dy = t[0].clientY - t[1].clientY; - return Math.sqrt(dx * dx + dy * dy); -} - -function pinchAngle(event) { - const t = event.touches; - return Math.atan2( - t[0].clientY - t[1].clientY, - t[0].clientX - t[1].clientX - ); -} - -function bandspace(count, paddingInner, paddingOuter) { - return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0); -} - -function bandwidth(name, group) { - const s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; -} - -function copy$2(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; -} - -function domain(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.domain() : []; -} - -function invert(name, range, group) { - const s = getScale(name, (group || this).context); - return !s ? undefined - : isArray(range) ? (s.invertRange || s.invert)(range) - : (s.invert || s.invertExtent)(range); -} - -function range$1(name, group) { - const s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; -} - -function scale$3(name, value, group) { - const s = getScale(name, (group || this).context); - return s ? s(value) : undefined; -} - -function scaleGradient(scale, p0, p1, count, group) { - scale = getScale(scale, (group || this).context); - - const gradient = Gradient(p0, p1); - - let stops = scale.domain(), - min = stops[0], - max = peek(stops), - fraction = identity; - - if (!(max - min)) { - // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator - ? scale$2('sequential')().interpolator(scale.interpolator()) - : scale$2('linear')().interpolate(scale.interpolate()).range(scale.range()) - ).domain([min=0, max=1]); - } else { - fraction = scaleFraction(scale, min, max); - } - - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== peek(stops)) stops.push(max); - } - - stops.forEach(_ => gradient.stop(fraction(_), scale(_))); - - return gradient; -} - -function geoShape(projection, geojson, group) { - const p = getScale(projection, (group || this).context); - return function(context) { - return p ? p.path.context(context)(geojson) : ''; - }; -} - -function pathShape(path) { - let p = null; - return function(context) { - return context - ? pathRender(context, (p = p || pathParse(path))) - : path; - }; -} - -const datum = d => d.data; - -function treeNodes(name, context) { - const tree = data$1.call(context, name); - return tree.root && tree.root.lookup || {}; -} - -function treePath(name, source, target) { - const nodes = treeNodes(name, this), - s = nodes[source], - t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; -} - -function treeAncestors(name, node) { - const n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; -} - -const _window = () => (typeof window !== 'undefined' && window) || null; - -function screen() { - const w = _window(); - return w ? w.screen : {}; -} - -function windowSize() { - const w = _window(); - return w - ? [w.innerWidth, w.innerHeight] - : [undefined, undefined]; -} - -function containerSize() { - const view = this.context.dataflow, - el = view.container && view.container(); - return el - ? [el.clientWidth, el.clientHeight] - : [undefined, undefined]; -} - -const Intersect = 'intersect'; -const Union = 'union'; -const VlMulti = 'vlMulti'; -const Or = 'or'; -const And = 'and'; - -var TYPE_ENUM = 'E', - TYPE_RANGE_INC = 'R', - TYPE_RANGE_EXC = 'R-E', - TYPE_RANGE_LE = 'R-LE', - TYPE_RANGE_RE = 'R-RE', - UNIT_INDEX = 'index:unit'; - -// TODO: revisit date coercion? -function testPoint(datum, entry) { - var fields = entry.fields, - values = entry.values, - n = fields.length, - i = 0, dval, f; - - for (; i, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ -function selectionTest(name, datum, op) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, - intersect = op === Intersect, - n = entries.length, - i = 0, - entry, miss, count, unit, b; - - for (; i (obj[fields[j].field] = curr, obj), {})); - } - } - - // Then resolve fields across units as per the op. - op = op || Union; - Object.keys(resolved).forEach(function (field) { - resolved[field] = Object.keys(resolved[field]) - .map(unit => resolved[field][unit]) - .reduce((acc, curr) => acc === undefined ? curr : ops[types[field] + '_' + op](acc, curr)); - }); - - entries = Object.keys(multiRes); - if (isMulti && entries.length) { - resolved[VlMulti] = op === Union - ? {[Or]: entries.reduce((acc, k) => (acc.push.apply(acc, multiRes[k]), acc), [])} - : {[And]: entries.map(k => ({[Or]: multiRes[k]}))}; - } - - return resolved; -} - -var ops = { - E_union: function(base, value) { - if (!base.length) return value; - - var i = 0, n = value.length; - for (; i= 0; }); - }, - - R_union: function(base, value) { - var lo = toNumber(value[0]), hi = toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; - }, - - R_intersect: function(base, value) { - var lo = toNumber(value[0]), hi = toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (hi < base[0] || base[1] < lo) { - return []; - } else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - return base; - } -}; - -const DataPrefix$1 = ':', - IndexPrefix$1 = '@'; - -function selectionVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to selection functions must be a string literal.'); - - const data = args[0].value, - op = args.length >= 2 && peek(args).value, - field = 'unit', - indexName = IndexPrefix$1 + field, - dataName = DataPrefix$1 + data; - - // eslint-disable-next-line no-prototype-builtins - if (op === Intersect && !hasOwnProperty(params, indexName)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - - // eslint-disable-next-line no-prototype-builtins - if (!hasOwnProperty(params, dataName)) { - params[dataName] = scope.getData(data).tuplesRef(); - } -} - -function intersect$2(b, opt, group) { - if (!b) return []; - - const [u, v] = b, - box = new Bounds().set(u[0], u[1], v[0], v[1]), - scene = group || this.context.dataflow.scenegraph().root; - - return intersect(scene, box, filter$1(opt)); -} - -function filter$1(opt) { - let p = null; - - if (opt) { - const types = array(opt.marktype), - names = array(opt.markname); - p = _ => (!types.length || types.some(t => _.marktype === t)) - && (!names.length || names.some(s => _.name === s)); - } - - return p; -} - -// Expression function context object -const functionContext = { - random: function() { return random(); }, // override default - cumulativeNormal, - cumulativeLogNormal, - cumulativeUniform, - densityNormal, - densityLogNormal, - densityUniform, - quantileNormal, - quantileLogNormal, - quantileUniform, - sampleNormal, - sampleLogNormal, - sampleUniform, - isArray, - isBoolean, - isDate, - isDefined: function(_) { return _ !== undefined; }, - isNumber, - isObject, - isRegExp, - isString, - isTuple, - isValid: function(_) { return _ != null && _ === _; }, - toBoolean, - toDate, - toNumber, - toString, - flush, - lerp, - merge: merge$2, - pad, - peek, - span, - inrange, - truncate, - rgb, - lab, - hcl, - hsl, - luminance, - contrast, - sequence, - format: format$2, - utcFormat, - utcParse, - utcOffset, - utcSequence, - timeFormat, - timeParse, - timeOffset, - timeSequence, - timeUnitSpecifier, - monthFormat, - monthAbbrevFormat, - dayFormat, - dayAbbrevFormat, - quarter, - utcquarter, - week, - utcweek, - dayofyear, - utcdayofyear, - warn, - info, - debug, - extent, - inScope, - intersect: intersect$2, - clampRange, - pinchDistance, - pinchAngle, - screen, - containerSize, - windowSize, - bandspace, - setdata, - pathShape, - panLinear, - panLog, - panPow, - panSymlog, - zoomLinear, - zoomLog, - zoomPow, - zoomSymlog, - encode: encode$1, - modify -}; - -const eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'], // event functions - eventPrefix = 'event.vega.', // event function prefix - thisPrefix = 'this.', // function context prefix - astVisitors = {}; // AST visitors for dependency analysis - -// Build expression function registry -function buildFunctions(codegen) { - const fn = functions(codegen); - eventFunctions.forEach(name => fn[name] = eventPrefix + name); - for (let name in functionContext) { fn[name] = thisPrefix + name; } - extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; -} - -// Register an expression function -function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) { - return functionContext[name]; - } - - // register with the functionContext - functionContext[name] = fn; - - // if there is an astVisitor register that, too - if (visitor) astVisitors[name] = visitor; - - // if the code generator has already been initialized, - // we need to also register the function with it - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; -} - -// register expression functions with ast visitors -expressionFunction('bandwidth', bandwidth, scaleVisitor); -expressionFunction('copy', copy$2, scaleVisitor); -expressionFunction('domain', domain, scaleVisitor); -expressionFunction('range', range$1, scaleVisitor); -expressionFunction('invert', invert, scaleVisitor); -expressionFunction('scale', scale$3, scaleVisitor); -expressionFunction('gradient', scaleGradient, scaleVisitor); -expressionFunction('geoArea', geoArea, scaleVisitor); -expressionFunction('geoBounds', geoBounds, scaleVisitor); -expressionFunction('geoCentroid', geoCentroid, scaleVisitor); -expressionFunction('geoShape', geoShape, scaleVisitor); -expressionFunction('indata', indata, indataVisitor); -expressionFunction('data', data$1, dataVisitor); -expressionFunction('treePath', treePath, dataVisitor); -expressionFunction('treeAncestors', treeAncestors, dataVisitor); - -// register Vega-Lite selection functions -expressionFunction('vlSelectionTest', selectionTest, selectionVisitor); -expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor); - -// Export code generator and parameters -const codegenParams = { - blacklist: ['_'], - whitelist: ['datum', 'event', 'item'], - fieldvar: 'datum', - globalvar: id => '_[' + $(SignalPrefix + id) + ']', - functions: buildFunctions, - constants: constants, - visitors: astVisitors -}; - -var codeGenerator = codegen(codegenParams); - -function parseExpression$1(expr, scope) { - var params = {}, ast, gen; - - // parse the expression to an abstract syntax tree (ast) - try { - expr = isString(expr) ? expr : ($(expr) + ''); - ast = parse$3(expr); - } catch (err) { - error('Expression parse error: ' + expr); - } - - // analyze ast function calls for dependencies - ast.visit(node => { - if (node.type !== CallExpression) return; - var name = node.callee.name, - visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); - }); - - // perform code generation - gen = codeGenerator(ast); - - // collect signal dependencies - gen.globals.forEach(name => { - var signalName = SignalPrefix + name; - if (!hasOwnProperty(params, signalName) && scope.getSignal(name)) { - params[signalName] = scope.signalRef(name); - } - }); - - // return generated expression code and dependencies - return { - $expr: extend({code: gen.code}, scope.options.ast ? {ast} : null), - $fields: gen.fields, - $params: params - }; -} - -/** - * Parse a serialized dataflow specification. - */ -function parse$4(spec) { - const ctx = this, - operators = spec.operators || []; - - // parse background - if (spec.background) { - ctx.background = spec.background; - } - - // parse event configuration - if (spec.eventConfig) { - ctx.eventConfig = spec.eventConfig; - } - - // parse locale configuration - if (spec.locale) { - ctx.locale = spec.locale; - } - - // parse operators - operators.forEach(entry => ctx.parseOperator(entry)); - - // parse operator parameters - operators.forEach(entry => ctx.parseOperatorParameters(entry)); - - // parse streams - (spec.streams || []).forEach(entry => ctx.parseStream(entry)); - - // parse updates - (spec.updates || []).forEach(entry => ctx.parseUpdate(entry)); - - return ctx.resolve(); -} - -const Skip = toSet(['rule']), - Swap = toSet(['group', 'image', 'rect']); - -function adjustSpatial(encode, marktype) { - let code = ''; - - if (Skip[marktype]) return code; - - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) { - code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - } - code += 'o.width=o.x2-o.x;'; - } else { - code += 'o.x=o.x2-(o.width||0);'; - } - } - - if (encode.xc) { - code += 'o.x=o.xc-(o.width||0)/2;'; - } - - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) { - code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - } - code += 'o.height=o.y2-o.y;'; - } else { - code += 'o.y=o.y2-(o.height||0);'; - } - } - - if (encode.yc) { - code += 'o.y=o.yc-(o.height||0)/2;'; - } - - return code; -} - -function canonicalType(type) { - return (type + '').toLowerCase(); -} - -function isOperator(type) { - return canonicalType(type) === 'operator'; -} - -function isCollect(type) { - return canonicalType(type) === 'collect'; -} - -function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (code[code.length-1] !== ';') { - code = 'return(' + code + ');'; - } - var fn = Function.apply(null, args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; -} - -// generate code for comparing a single field -function _compare(u, v, lt, gt) { - return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt} - : (u > v || v == null) && u != null ? ${gt} - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} - : v !== v && u === u ? ${gt} : `; -} - -var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ - operator: (ctx, expr) => expression(ctx, ['_'], expr.code), - - /** - * Parse an expression provided as an operator parameter value. - */ - parameter: (ctx, expr) => expression(ctx, ['datum', '_'], expr.code), - - /** - * Parse an expression applied to an event stream. - */ - event: (ctx, expr) => expression(ctx, ['event'], expr.code), - - /** - * Parse an expression used to handle an event-driven operator update. - */ - handler: (ctx, expr) => { - const code = `var datum=event.item&&event.item.datum;return ${expr.code};`; - return expression(ctx, ['_', 'event'], code); - }, - - /** - * Parse an expression that performs visual encoding. - */ - encode: (ctx, encode) => { - const {marktype, channels} = encode; - - let code = 'var o=item,datum=o.datum,m=0,$;'; - for (const name in channels) { - const o ='o[' + $(name) + ']'; - code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; - } - code += adjustSpatial(channels, marktype); - code += 'return m;'; - - return expression(ctx, ['item', '_'], code); - }, - - /** - * Optimized code generators for access and comparison. - */ - codegen: { - get(path) { - const ref = `[${path.map($).join('][')}]`; - const get = Function('_', `return _${ref};`); - get.path = ref; - return get; - }, - comparator(fields, orders) { - let t; - const map = (f, i) => { - const o = orders[i]; - let u, v; - if (f.path) { - u = `a${f.path}`; - v = `b${f.path}`; - } else { - (t = t || {})['f'+i] = f; - u = `this.f${i}(a)`; - v = `this.f${i}(b)`; - } - return _compare(u, v, -o, o); - }; - - const fn = Function('a', 'b', 'var u, v; return ' - + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } -}; - -/** - * Parse a dataflow operator. - */ -function parseOperator(spec) { - const ctx = this; - if (isOperator(spec.type) || !spec.type) { - ctx.operator( - spec, - spec.update ? ctx.operatorExpression(spec.update) : null - ); - } else { - ctx.transform(spec, spec.type); - } -} - -/** - * Parse and assign operator parameters. - */ -function parseOperatorParameters(spec) { - const ctx = this; - if (spec.params) { - const op = ctx.get(spec.id); - if (!op) error('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters( - ctx.parseParameters(spec.params), - spec.react, - spec.initonly - )); - } -} - -/** - * Parse a set of operator parameters. - */ -function parseParameters(spec, params) { - params = params || {}; - const ctx = this; - - for (const key in spec) { - const value = spec[key]; - params[key] = isArray(value) - ? value.map(v => parseParameter(v, ctx, params)) - : parseParameter(value, ctx, params); - } - - return params; -} - -/** - * Parse a single parameter. - */ -function parseParameter(spec, ctx, params) { - if (!spec || !isObject(spec)) return spec; - - for (let i=0, n=PARSERS.length, p; i (_ && _.$tupleid) ? tupleid : _); - return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen)); -} - -/** - * Resolve an encode operator reference. - */ -function getEncode(_, ctx) { - const spec = _.$encode, - encode = {}; - - for (const name in spec) { - const enc = spec[name]; - encode[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - return encode; -} - -/** - * Resolve a context reference. - */ -function getContext(_, ctx) { - return ctx; -} - -/** - * Resolve a recursive subflow specification. - */ -function getSubflow(_, ctx) { - const spec = _.$subflow; - return function(dataflow, key, parent) { - const subctx = ctx.fork().parse(spec), - op = subctx.get(spec.operators[0].id), - p = subctx.signals.parent; - if (p) p.set(parent); - op.detachSubflow = () => ctx.detach(subctx); - return op; - }; -} - -/** - * Resolve a tuple id reference. - */ -function getTupleId() { - return tupleid; -} - -/** - * Parse an event stream specification. - */ -function parseStream(spec) { - var ctx = this, - filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, - stream = spec.stream != null ? ctx.get(spec.stream) : undefined, - args; - - if (spec.source) { - stream = ctx.events(spec.source, spec.type, filter); - } - else if (spec.merge) { - args = spec.merge.map(_ => ctx.get(_)); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - - if (spec.between) { - args = spec.between.map(_ => ctx.get(_)); - stream = stream.between(args[0], args[1]); - } - - if (spec.filter) { - stream = stream.filter(filter); - } - - if (spec.throttle != null) { - stream = stream.throttle(+spec.throttle); - } - - if (spec.debounce != null) { - stream = stream.debounce(+spec.debounce); - } - - if (stream == null) { - error('Invalid stream definition: ' + JSON.stringify(spec)); - } - - if (spec.consume) stream.consume(true); - - ctx.stream(spec, stream); -} - -/** - * Parse an event-driven operator update. - */ -function parseUpdate(spec) { - var ctx = this, - srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid, - source = ctx.get(srcid), - target = null, - update = spec.update, - params = undefined; - - if (!source) error('Source not defined: ' + spec.source); - - target = spec.target && spec.target.$expr - ? ctx.eventExpression(spec.target.$expr) - : ctx.get(spec.target); - - if (update && update.$expr) { - if (update.$params) { - params = ctx.parseParameters(update.$params); - } - update = ctx.handlerExpression(update.$expr); - } - - ctx.update(spec, source, target, update, params); -} - -var SKIP$3 = {skip: true}; - -function getState(options) { - var ctx = this, - state = {}; - - if (options.signals) { - var signals = (state.signals = {}); - Object.keys(ctx.signals).forEach(key => { - var op = ctx.signals[key]; - if (options.signals(key, op)) { - signals[key] = op.value; - } - }); - } - - if (options.data) { - var data = (state.data = {}); - Object.keys(ctx.data).forEach(key => { - var dataset = ctx.data[key]; - if (options.data(key, dataset)) { - data[key] = dataset.input.value; - } - }); - } - - if (ctx.subcontext && options.recurse !== false) { - state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options)); - } - - return state; -} - -function setState(state) { - var ctx = this, - df = ctx.dataflow, - data = state.data, - signals = state.signals; - - Object.keys(signals || {}).forEach(key => { - df.update(ctx.signals[key], signals[key], SKIP$3); - }); - - Object.keys(data || {}).forEach(key => { - df.pulse( - ctx.data[key].input, - df.changeset().remove(truthy).insert(data[key]) - ); - }); - - (state.subcontext || []).forEach((substate, i) => { - var subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); -} - -/** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ -function context$2(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); -} - -function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, - this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } -} - -function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } -} - -Context.prototype = Subcontext.prototype = { - fork() { - const ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; - }, - detach(ctx) { - this.subcontext = this.subcontext.filter(c => c !== ctx); - - // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - const keys = Object.keys(ctx.nodes); - for (const key of keys) ctx.nodes[key]._targets = null; - for (const key of keys) ctx.nodes[key].detach(); - ctx.nodes = null; - }, - get(id) { - return this.nodes[id]; - }, - set(id, node) { - return this.nodes[id] = node; - }, - add(spec, op) { - const ctx = this, - df = ctx.dataflow, - data = spec.value; - - ctx.set(spec.id, op); - - if (isCollect(spec.type) && data) { - if (data.$ingest) { - df.ingest(op, data.$ingest, data.$format); - } else if (data.$request) { - df.preload(op, data.$request, data.$format); - } else { - df.pulse(op, df.changeset().insert(data)); - } - } - - if (spec.root) { - ctx.root = op; - } - - if (spec.parent) { - var p = ctx.get(spec.parent.$ref); - if (p) { - df.connect(p, [op]); - op.targets().add(p); - } else { - (ctx.unresolved = ctx.unresolved || []).push(() => { - p = ctx.get(spec.parent.$ref); - df.connect(p, [op]); - op.targets().add(p); - }); - } - } - - if (spec.signal) { - ctx.signals[spec.signal] = op; - } - - if (spec.scale) { - ctx.scales[spec.scale] = op; - } - - if (spec.data) { - for (const name in spec.data) { - const data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach(role => data[role] = op); - } - } - }, - resolve() { - (this.unresolved || []).forEach(fn => fn()); - delete this.unresolved; - return this; - }, - operator(spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); - }, - transform(spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); - }, - stream(spec, stream) { - this.set(spec.id, stream); - }, - update(spec, stream, target, update, params) { - this.dataflow.on(stream, target, update, params, spec.options); - }, - - // expression parsing - operatorExpression(expr) { - return this.expr.operator(this, expr); - }, - parameterExpression(expr) { - return this.expr.parameter(this, expr); - }, - eventExpression(expr) { - return this.expr.event(this, expr); - }, - handlerExpression(expr) { - return this.expr.handler(this, expr); - }, - encodeExpression(encode) { - return this.expr.encode(this, encode); - }, - - // parse methods - parse: parse$4, - parseOperator, - parseOperatorParameters, - parseParameters, - parseStream, - parseUpdate, - - // state methods - getState, - setState -}; - -function runtime(view, spec, expr) { - return context$2(view, transforms, functionContext, expr).parse(spec); -} - -function scale$4(name) { - var scales = this._runtime.scales; - if (!hasOwnProperty(scales, name)) { - error('Unrecognized scale or projection: ' + name); - } - return scales[name].value; -} - -var Width = 'width', - Height = 'height', - Padding$1 = 'padding', - Skip$1 = {skip: true}; - -function viewWidth(view, width) { - var a = view.autosize(), - p = view.padding(); - return width - (a && a.contains === Padding$1 ? p.left + p.right : 0); -} - -function viewHeight(view, height) { - var a = view.autosize(), - p = view.padding(); - return height - (a && a.contains === Padding$1 ? p.top + p.bottom : 0); -} - -function initializeResize(view) { - var s = view._signals, - w = s[Width], - h = s[Height], - p = s[Padding$1]; - - function resetSize() { - view._autosize = view._resize = 1; - } - - // respond to width signal - view._resizeWidth = view.add(null, - function(_) { - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, - {size: w} - ); - - // respond to height signal - view._resizeHeight = view.add(null, - function(_) { - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, - {size: h} - ); - - // respond to padding signal - var resizePadding = view.add(null, resetSize, {pad: p}); - - // set rank to run immediately after source signal - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; -} - -function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter(function(view) { - var rerun = 0; - - // reset autosize flag - view._autosize = 0; - - // width value changed: update signal, skip resize op - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip$1); // set width, skip update calc - view._resizeWidth.skip(true); // skip width resize handler - } - - // height value changed: update signal, skip resize op - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip$1); // set height, skip update calc - view._resizeHeight.skip(true); // skip height resize handler - } - - // view width changed: update view property, set resize flag - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } - - // view height changed: update view property, set resize flag - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } - - // origin changed: update view property, set resize flag - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } - - // run dataflow on width/height signal change - if (rerun) view.run('enter'); - if (auto) view.runAfter(v => v.resize()); - }, false, 1); -} - -/** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ -function getState$1(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); -} - -function dataTest(name, data) { - return data.modified - && isArray(data.input.value) - && name.indexOf('_:vega:_'); -} - -function signalTest(name, op) { - return !(name === 'parent' || op instanceof transforms.proxy); -} - -/** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ -function setState$1(state) { - this.runAsync(null, - v => { v._trigger = false; v._runtime.setState(state); }, - v => { v._trigger = true; } - ); - return this; -} - -function timer(callback, delay) { - function tick(elapsed) { - callback({timestamp: Date.now(), elapsed: elapsed}); - } - this._timers.push(interval(tick, delay)); -} - -function defaultTooltip$1(handler, event, item, value) { - var el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); -} - -function formatTooltip(value) { - return value == null ? '' - : isArray(value) ? formatArray(value) - : isObject(value) && !isDate(value) ? formatObject(value) - : value + ''; -} - -function formatObject(obj) { - return Object.keys(obj).map(function(key) { - var v = obj[key]; - return key + ': ' + (isArray(v) ? formatArray(v) : formatValue$1(v)); - }).join('\n'); -} - -function formatArray(value) { - return '[' + value.map(formatValue$1).join(', ') + ']'; -} - -function formatValue$1(value) { - return isArray(value) ? '[\u2026]' - : isObject(value) && !isDate(value) ? '{\u2026}' - : value; -} - -/** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ -function View(spec, options) { - const view = this; - options = options || {}; - - Dataflow.call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - if (options.locale || spec.locale) { - const loc = extend({}, spec.locale, options.locale); - view.locale(locale(loc.number, loc.time)); - } - - view._el = null; - view._elBind = null; - view._renderType = options.renderer || RenderType.Canvas; - view._scenegraph = new Scenegraph(); - const root = view._scenegraph.root; - - // initialize renderer, handler and event management - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip$1, - view._redraw = true; - view._handler = new CanvasHandler().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; - - // initialize event configuration - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); - - // initialize dataflow graph - const ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map(_ => ({ - state: null, - param: extend({}, _) - })); - - // initialize scenegraph - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse( - ctx.data.root.input, - view.changeset().insert(root.items) - ); - - // initialize view size - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [0, 0]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); - - // initialize background color - background$1(view); - - // initialize cursor - cursor(view); - - // initialize view description - view.description(spec.description); - - // initialize hover proessing, if requested - if (options.hover) view.hover(); - - // initialize DOM container(s) and renderer - if (options.container) view.initialize(options.container, options.bind); -} - -var prototype$1s = inherits(View, Dataflow); - -// -- DATAFLOW / RENDERING ---- - -prototype$1s.evaluate = async function(encode, prerun, postrun) { - // evaluate dataflow and prerun - await Dataflow.prototype.evaluate.call(this, encode, prerun); - - // render as needed - if (this._redraw || this._resize) { - try { - if (this._renderer) { - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - await this._renderer.renderAsync(this._scenegraph.root); - } - this._redraw = false; - } catch (e) { - this.error(e); - } - } - - // evaluate postrun - if (postrun) asyncCallback(this, postrun); - - return this; -}; - -prototype$1s.dirty = function(item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); -}; - -// -- GET / SET ---- - -prototype$1s.description = function(text) { - if (arguments.length) { - const desc = text != null ? (text + '') : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - return this._desc; -}; - -prototype$1s.container = function() { - return this._el; -}; - -prototype$1s.scenegraph = function() { - return this._scenegraph; -}; - -prototype$1s.origin = function() { - return this._origin.slice(); -}; - -function lookupSignal(view, name) { - return hasOwnProperty(view._signals, name) - ? view._signals[name] - : error('Unrecognized signal name: ' + $(name)); -} - -prototype$1s.signal = function(name, value, options) { - var op = lookupSignal(this, name); - return arguments.length === 1 - ? op.value - : this.update(op, value, options); -}; - -prototype$1s.width = function(_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); -}; - -prototype$1s.height = function(_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); -}; - -prototype$1s.padding = function(_) { - return arguments.length - ? this.signal('padding', padding(_)) - : padding(this.signal('padding')); -}; - -prototype$1s.autosize = function(_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); -}; - -prototype$1s.background = function(_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); -}; - -prototype$1s.renderer = function(type) { - if (!arguments.length) return this._renderType; - if (!renderModule(type)) error('Unrecognized renderer type: ' + type); - if (type !== this._renderType) { - this._renderType = type; - this._resetRenderer(); - } - return this; -}; - -prototype$1s.tooltip = function(handler) { - if (!arguments.length) return this._tooltip; - if (handler !== this._tooltip) { - this._tooltip = handler; - this._resetRenderer(); - } - return this; -}; - -prototype$1s.loader = function(loader) { - if (!arguments.length) return this._loader; - if (loader !== this._loader) { - Dataflow.prototype.loader.call(this, loader); - this._resetRenderer(); - } - return this; -}; - -prototype$1s.resize = function() { - // set flag to perform autosize - this._autosize = 1; - // touch autosize signal to ensure top-level ViewLayout runs - return this.touch(lookupSignal(this, 'autosize')); -}; - -prototype$1s._resetRenderer = function() { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } -}; - -// -- SIZING ---- -prototype$1s._resizeView = resizeView; - -// -- EVENT HANDLING ---- - -prototype$1s.addEventListener = function(type, handler, options) { - var callback = handler; - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - this._handler.on(type, callback); - return this; -}; - -prototype$1s.removeEventListener = function(type, handler) { - var handlers = this._handler.handlers(type), - i = handlers.length, h, t; - - // search registered handlers, remove if match found - while (--i >= 0) { - t = handlers[i].type; - h = handlers[i].handler; - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - break; - } - } - return this; -}; - -prototype$1s.addResizeListener = function(handler) { - var l = this._resizeListeners; - if (l.indexOf(handler) < 0) { - // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - } - return this; -}; - -prototype$1s.removeResizeListener = function(handler) { - var l = this._resizeListeners, - i = l.indexOf(handler); - if (i >= 0) { - l.splice(i, 1); - } - return this; -}; - -function findOperatorHandler(op, handler) { - const h = (op._targets || []) - .filter(op => op._update && op._update.handler === handler); - return h.length ? h[0] : null; -} - -function addOperatorListener(view, name, op, handler) { - var h = findOperatorHandler(op, handler); - if (!h) { - h = trap(view, () => handler(name, op.value)); - h.handler = handler; - view.on(op, null, h); - } - return view; -} - -function removeOperatorListener(view, op, handler) { - var h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; -} - -prototype$1s.addSignalListener = function(name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); -}; - -prototype$1s.removeSignalListener = function(name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); -}; - -prototype$1s.addDataListener = function(name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); -}; - -prototype$1s.removeDataListener = function(name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); -}; - -prototype$1s.globalCursor = function(_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - const prev = setCursor(this, null); // clear previous cursor - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - return this; - } else { - return this._globalCursor; - } -}; - -prototype$1s.preventDefault = function(_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else { - return this._preventDefault; - } -}; - -prototype$1s.timer = timer; -prototype$1s.events = events$1; -prototype$1s.finalize = finalize; -prototype$1s.hover = hover; - -// -- DATA ---- -prototype$1s.data = data; -prototype$1s.change = change; -prototype$1s.insert = insert; -prototype$1s.remove = remove; - -// -- SCALES -- -prototype$1s.scale = scale$4; - -// -- INITIALIZATION ---- -prototype$1s.initialize = initialize$1; - -// -- HEADLESS RENDERING ---- -prototype$1s.toImageURL = renderToImageURL; -prototype$1s.toCanvas = renderToCanvas; -prototype$1s.toSVG = renderToSVG; - -// -- SAVE / RESTORE STATE ---- -prototype$1s.getState = getState$1; -prototype$1s.setState = setState$1; - -function parseAutosize(spec) { - return isObject(spec) ? spec : {type: spec || 'pad'}; -} - -const number$6 = _ => +_ || 0; - -const paddingObject$1 = _ => ({top: _, bottom: _, left: _, right: _}); - -function parsePadding(spec) { - return !isObject(spec) ? paddingObject$1(number$6(spec)) - : spec.signal ? spec - : { - top: number$6(spec.top), - bottom: number$6(spec.bottom), - left: number$6(spec.left), - right: number$6(spec.right) - }; -} - -const encoder = _ => isObject(_) && !isArray(_) - ? extend({}, _) - : {value: _}; - -function addEncode(object, name, value, set) { - if (value != null) { - // Always assign signal to update, even if the signal is from the enter block - if (isObject(value) && !isArray(value)) { - object.update[name] = value; - } else { - object[set || 'enter'][name] = {value: value}; - } - return 1; - } else { - return 0; - } -} - -function addEncoders(object, enter, update) { - for (const name in enter) { - addEncode(object, name, enter[name]); - } - for (const name in update) { - addEncode(object, name, update[name], 'update'); - } -} - -function extendEncode(encode, extra, skip) { - for (const name in extra) { - if (skip && hasOwnProperty(skip, name)) continue; - encode[name] = extend(encode[name] || {}, extra[name]); - } - return encode; -} - -function has(key, encode) { - return encode && ( - (encode.enter && encode.enter[key]) || - (encode.update && encode.update[key]) - ); -} - -var MarkRole = 'mark'; -var FrameRole$1 = 'frame'; -var ScopeRole$1 = 'scope'; - -var AxisRole$1 = 'axis'; -var AxisDomainRole = 'axis-domain'; -var AxisGridRole = 'axis-grid'; -var AxisLabelRole = 'axis-label'; -var AxisTickRole = 'axis-tick'; -var AxisTitleRole = 'axis-title'; - -var LegendRole$1 = 'legend'; -var LegendBandRole = 'legend-band'; -var LegendEntryRole = 'legend-entry'; -var LegendGradientRole = 'legend-gradient'; -var LegendLabelRole = 'legend-label'; -var LegendSymbolRole = 'legend-symbol'; -var LegendTitleRole = 'legend-title'; - -var TitleRole$1 = 'title'; -var TitleTextRole = 'title-text'; -var TitleSubtitleRole = 'title-subtitle'; - -function applyDefaults(encode, type, role, style, config) { - const defaults = {}, enter = {}; - let update, key, skip, props; - - // if text mark, apply global lineBreak settings (#2370) - key = 'lineBreak'; - if (type === 'text' && config[key] != null && !has(key, encode)) { - applyDefault(defaults, key, config[key]); - } - - // ignore legend and axis roles - if (role == 'legend' || String(role).startsWith('axis')) { - role = null; - } - - // resolve mark config - props = role === FrameRole$1 ? config.group - : (role === MarkRole) ? extend({}, config.mark, config[type]) - : null; - - for (key in props) { - // do not apply defaults if relevant fields are defined - skip = has(key, encode) - || (key === 'fill' || key === 'stroke') - && (has('fill', encode) || has('stroke', encode)); - - if (!skip) applyDefault(defaults, key, props[key]); - } - - // resolve styles, apply with increasing precedence - array(style).forEach(name => { - const props = config.style && config.style[name]; - for (const key in props) { - if (!has(key, encode)) { - applyDefault(defaults, key, props[key]); - } - } - }); - - encode = extend({}, encode); // defensive copy - for (key in defaults) { - props = defaults[key]; - if (props.signal) { - (update = update || {})[key] = props; - } else { - enter[key] = props; - } - } - - encode.enter = extend(enter, encode.enter); - if (update) encode.update = extend(update, encode.update); - - return encode; -} - -function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal - ? {signal: value.signal} - : {value: value}; -} - -const scaleRef = scale => isString(scale) ? $(scale) - : scale.signal ? `(${scale.signal})` - : field$1(scale); - -function entry(enc) { - if (enc.gradient != null) { - return gradient$1(enc); - } - - let value = enc.signal ? `(${enc.signal})` - : enc.color ? color$1(enc.color) - : enc.field != null ? field$1(enc.field) - : enc.value !== undefined ? $(enc.value) - : undefined; - - if (enc.scale != null) { - value = scale$5(enc, value); - } - - if (value === undefined) { - value = null; - } - - if (enc.exponent != null) { - value = `pow(${value},${property(enc.exponent)})`; - } - - if (enc.mult != null) { - value += `*${property(enc.mult)}`; - } - - if (enc.offset != null) { - value += `+${property(enc.offset)}`; - } - - if (enc.round) { - value = `round(${value})`; - } - - return value; -} - -const _color = (type, x, y, z) => - `(${type}(${[x, y, z].map(entry).join(',')})+'')`; - -function color$1(enc) { - return (enc.c) ? _color('hcl', enc.h, enc.c, enc.l) - : (enc.h || enc.s) ? _color('hsl', enc.h, enc.s, enc.l) - : (enc.l || enc.a) ? _color('lab', enc.l, enc.a, enc.b) - : (enc.r || enc.g || enc.b) ? _color('rgb', enc.r, enc.g, enc.b) - : null; -} - -function gradient$1(enc) { - // map undefined to null; expression lang does not allow undefined - const args = [enc.start, enc.stop, enc.count] - .map(_ => _ == null ? null : $(_)); - - // trim null inputs from the end - while (args.length && peek(args) == null) args.pop(); - - args.unshift(scaleRef(enc.gradient)); - return `gradient(${args.join(',')})`; -} - -function property(property) { - return isObject(property) ? '(' + entry(property) + ')' : property; -} - -function field$1(ref) { - return resolveField(isObject(ref) ? ref : {datum: ref}); -} - -function resolveField(ref) { - let object, level, field; - - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - - while (level-- > 0) { - object += '.mark.group'; - } - - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else { - field = ref.group; - } - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else { - error('Invalid field reference: ' + $(ref)); - } - - if (!ref.signal) { - field = isString(field) - ? splitAccessPath(field).map($).join('][') - : resolveField(field); - } - - return object + '[' + field + ']'; -} - -function scale$5(enc, value) { - const scale = scaleRef(enc.scale); - - if (enc.range != null) { - // pull value from scale range - value = `lerp(_range(${scale}), ${+enc.range})`; - } else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = `_scale(${scale}, ${value})`; - - if (enc.band) { - value = (value ? value + '+' : '') - + `_bandwidth(${scale})` - + (+enc.band === 1 ? '' : '*' + property(enc.band)); - - if (enc.extra) { - // include logic to handle extraneous elements - value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`; - } - } - - if (value == null) value = '0'; - } - - return value; -} - -function rule$1(enc) { - let code = ''; - - enc.forEach(rule => { - const value = entry(rule); - code += rule.test ? `(${rule.test})?${value}:` : value; - }); - - // if no else clause, terminate with null (#1366) - if (peek(code) === ':') { - code += 'null'; - } - - return code; -} - -function parseEncode(encode, type, role, style, scope, params) { - const enc = {}; - params = params || {}; - params.encoders = {$encode: enc}; - - encode = applyDefaults(encode, type, role, style, scope.config); - for (const key in encode) { - enc[key] = parseBlock(encode[key], type, params, scope); - } - - return params; -} - -function parseBlock(block, marktype, params, scope) { - const channels = {}, - fields = {}; - - for (const name in block) { - if (block[name] != null) { // skip any null entries - channels[name] = parse$5(expr(block[name]), scope, params, fields); - } - } - - return { - $expr: {marktype, channels}, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; -} - -function expr(enc) { - return isArray(enc) ? rule$1(enc) : entry(enc); -} - -function parse$5(code, scope, params, fields) { - const expr = parseExpression$1(code, scope); - expr.$fields.forEach(name => fields[name] = 1); - extend(params, expr.$params); - return expr.$expr; -} - -var OUTER = 'outer', - OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind']; - -function outerError(prefix, name) { - error(prefix + ' for "outer" push: ' + $(name)); -} - -function parseSignal(signal, scope) { - var name = signal.name; - - if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); - // signal push must not use properties reserved for standard definition - OUTER_INVALID.forEach(function(prop) { - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); - } else { - // define a new signal in the current scope - var op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); - } -} - -function Entry(type, value, params, parent) { - this.id = -1; - this.type = type; - this.value = value; - this.params = params; - if (parent) this.parent = parent; -} - -function entry$1(type, value, params, parent) { - return new Entry(type, value, params, parent); -} - -function operator(value, params) { - return entry$1('operator', value, params); -} - -// ----- - -function ref(op) { - var ref = {$ref: op.id}; - // if operator not yet registered, cache ref to resolve later - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; -} - -function fieldRef(field, name) { - return name ? {$field: field, $name: name} : {$field: field}; -} - -var keyFieldRef = fieldRef('key'); - -function compareRef(fields, orders) { - return {$compare: fields, $order: orders}; -} - -function keyRef(fields, flat) { - var ref = {$key: fields}; - if (flat) ref.$flat = true; - return ref; -} - -// ----- - -var Ascending = 'ascending'; - -var Descending = 'descending'; - -function sortKey(sort) { - return !isObject(sort) ? '' - : (sort.order === Descending ? '-' : '+') - + aggrField(sort.op, sort.field); -} - -function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') - + (op && field ? '_' : '') - + (field && field.signal ? '$' + field.signal : field || ''); -} - -// ----- - -var Scope = 'scope'; - -var View$1 = 'view'; - -function isSignal(_) { - return _ && _.signal; -} - -function isExpr(_) { - return _ && _.expr; -} - -function hasSignal(_) { - if (isSignal(_)) return true; - if (isObject(_)) for (var key in _) { - if (hasSignal(_[key])) return true; - } - return false; -} - -function value$2(specValue, defaultValue) { - return specValue != null ? specValue : defaultValue; -} - -function deref(v) { - return v && v.signal || v; -} - -var Timer = 'timer'; - -function parseStream$1(stream, scope) { - var method = stream.merge ? mergeStream - : stream.stream ? nestedStream - : stream.type ? eventStream - : error('Invalid stream specification: ' + $(stream)); - - return method(stream, scope); -} - -function eventSource(source) { - return source === Scope ? View$1 : (source || View$1); -} - -function mergeStream(stream, scope) { - var list = stream.merge.map(s => parseStream$1(s, scope)), - entry = streamParameters({merge: list}, stream, scope); - return scope.addStream(entry).id; -} - -function nestedStream(stream, scope) { - var id = parseStream$1(stream.stream, scope), - entry = streamParameters({stream: id}, stream, scope); - return scope.addStream(entry).id; -} - -function eventStream(stream, scope) { - var id, entry; - - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = {between: stream.between, filter: stream.filter}; - } else { - id = scope.event(eventSource(stream.source), stream.type); - } - - entry = streamParameters({stream: id}, stream, scope); - return Object.keys(entry).length === 1 - ? id - : scope.addStream(entry).id; -} - -function streamParameters(entry, stream, scope) { - var param = stream.between; - - if (param) { - if (param.length !== 2) { - error('Stream "between" parameter must have 2 entries: ' + $(stream)); - } - entry.between = [ - parseStream$1(param[0], scope), - parseStream$1(param[1], scope) - ]; - } - - param = stream.filter ? [].concat(stream.filter) : []; - if (stream.marktype || stream.markname || stream.markrole) { - // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - } - if (stream.source === Scope) { - // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - } - if (param.length) { - entry.filter = parseExpression$1('(' + param.join(')&&(') + ')', scope).$expr; - } - - if ((param = stream.throttle) != null) { - entry.throttle = +param; - } - - if ((param = stream.debounce) != null) { - entry.debounce = +param; - } - - if (stream.consume) { - entry.consume = true; - } - - return entry; -} - -function filterMark(type, name, role) { - var item = 'event.item'; - return item - + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') - + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') - + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); -} - -/** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ -function selector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW$1; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); -} - -var VIEW$1 = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL$1 = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - -function isMarkType(type) { - return MARKS[type]; -} - -function find$1(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - for (; i= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - return i; -} - -function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find$1(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - return output; -} - -function parseSelector(s) { - return s[0] === '[' - ? parseBetween(s) - : parseStream$2(s); -} - -function parseBetween(s) { - var n = s.length, - i = 1, - b, stream; - - i = find$1(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector); - - stream = parseSelector(s.slice(1).trim()); - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; -} - -function parseStream$2(s) { - var stream = {source: DEFAULT_SOURCE}, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, j, - filter; - - // extract throttle from end - if (s[n-1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i+1, n-1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - - if (!n) throw s; - - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - - // extract first part of multi-part stream selector - j = find$1(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } - - // extract remaining part of stream selector - i = find$1(s, i, LBRACK); - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - - // extract filters - while (i < n) { - i = find$1(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n-1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - - // marshall event stream specification - if (!(n = source.length) || ILLEGAL$1.test(source[n-1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - - return stream; -} - -function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function(_) { - var x = +_; - if (x !== x) throw s; - return x; - }); -} - -// bypass expression parser for internal operator references -const OP_VALUE_EXPR = { - code: '_.$value', - ast: {type: 'Identifier', value: 'value'} -}; - -function parseUpdate$1(spec, scope, target) { - var events = spec.events, - update = spec.update, - encode = spec.encode, - sources = [], - entry = {target: target}; - - if (!events) { - error('Signal update missing events specification.'); - } - - // interpret as an event selector string - if (isString(events)) { - events = selector(events, scope.isSubscope() ? Scope : View$1); - } - - // separate event streams from signal updates - events = array(events) - .filter(s => s.signal || s.scale ? (sources.push(s), 0) : 1); - - // merge internal operator listeners - if (sources.length > 1) { - sources = [mergeSources(sources)]; - } - - // merge event streams, include as source - if (events.length) { - sources.push(events.length > 1 ? {merge: events} : events[0]); - } - - if (encode != null) { - if (update) error('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + $(encode) + ')'; - } - - // resolve update value - entry.update = isString(update) ? parseExpression$1(update, scope) - : update.expr != null ? parseExpression$1(update.expr, scope) - : update.value != null ? update.value - : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: {$value: scope.signalRef(update.signal)} - } - : error('Invalid signal update specification.'); - - if (spec.force) { - entry.options = {force: true}; - } - - sources.forEach(function(source) { - scope.addUpdate(extend(streamSource(source, scope), entry)); - }); -} - -function streamSource(stream, scope) { - return { - source: stream.signal ? scope.signalRef(stream.signal) - : stream.scale ? scope.scaleRef(stream.scale) - : parseStream$1(stream, scope) - }; -} - -function mergeSources(sources) { - return { - signal: '[' - + sources.map(s => s.scale ? 'scale("' + s.scale + '")' : s.signal) - + ']' - }; -} - -function parseSignalUpdates(signal, scope) { - var op = scope.getSignal(signal.name), - expr = signal.update; - - if (signal.init) { - if (expr) { - error('Signals can not include both init and update expressions.'); - } else { - expr = signal.init; - op.initonly = true; - } - } - - if (expr) { - expr = parseExpression$1(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - if (signal.on) { - signal.on.forEach(function(_) { - parseUpdate$1(_, scope, op.id); - }); - } -} - -const transform$2 = name => (params, value, parent) => - entry$1(name, value, params || undefined, parent); - -var Aggregate$1 = transform$2('aggregate'); -var AxisTicks$1 = transform$2('axisticks'); -var Bound$1 = transform$2('bound'); -var Collect$1 = transform$2('collect'); -var Compare$1 = transform$2('compare'); -var DataJoin$1 = transform$2('datajoin'); -var Encode$1 = transform$2('encode'); -var Expression$1 = transform$2('expression'); -var Facet$1 = transform$2('facet'); -var Field$1 = transform$2('field'); -var Key$1 = transform$2('key'); -var LegendEntries$1 = transform$2('legendentries'); -var Load$1 = transform$2('load'); -var Mark$1 = transform$2('mark'); -var MultiExtent$1 = transform$2('multiextent'); -var MultiValues$1 = transform$2('multivalues'); -var Overlap$1 = transform$2('overlap'); -var Params$2 = transform$2('params'); -var PreFacet$1 = transform$2('prefacet'); -var Projection$1 = transform$2('projection'); -var Proxy$1 = transform$2('proxy'); -var Relay$1 = transform$2('relay'); -var Render$1 = transform$2('render'); -var Scale$1 = transform$2('scale'); -var Sieve$1 = transform$2('sieve'); -var SortItems$1 = transform$2('sortitems'); -var ViewLayout$1 = transform$2('viewlayout'); -var Values$1 = transform$2('values'); - -var FIELD_REF_ID = 0; - -var MULTIDOMAIN_SORT_OPS = {min: 'min', max: 'max', count: 'sum'}; - -function initScale(spec, scope) { - var type = spec.type || 'linear'; - - if (!isValidScaleType(type)) { - error('Unrecognized scale type: ' + $(type)); - } - - scope.addScale(spec.name, { - type: type, - domain: undefined - }); -} - -function parseScale(spec, scope) { - var params = scope.getScale(spec.name).params, - key; - - params.domain = parseScaleDomain(spec.domain, spec, scope); - - if (spec.range != null) { - params.range = parseScaleRange(spec, scope, params); - } - - if (spec.interpolate != null) { - parseScaleInterpolate(spec.interpolate, params); - } - - if (spec.nice != null) { - params.nice = parseScaleNice(spec.nice); - } - - if (spec.bins != null) { - params.bins = parseScaleBins(spec.bins, scope); - } - - for (key in spec) { - if (hasOwnProperty(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } -} - -function parseLiteral(v, scope) { - return !isObject(v) ? v - : v.signal ? scope.signalRef(v.signal) - : error('Unsupported object: ' + $(v)); -} - -function parseArray(v, scope) { - return v.signal - ? scope.signalRef(v.signal) - : v.map(v => parseLiteral(v, scope)); -} - -function dataLookupError(name) { - error('Can not find data set: ' + $(name)); -} - -// -- SCALE DOMAIN ---- - -function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) { - error('No scale domain defined for domainMin/domainMax to override.'); - } - return; // default domain - } - - return domain.signal ? scope.signalRef(domain.signal) - : (isArray(domain) ? explicitDomain - : domain.fields ? multipleDomain - : singularDomain)(domain, spec, scope); -} - -function explicitDomain(domain, spec, scope) { - return domain.map(function(v) { - return parseLiteral(v, scope); - }); -} - -function singularDomain(domain, spec, scope) { - var data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - - return isDiscrete(spec.type) - ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) - : isQuantile(spec.type) ? data.domainRef(scope, domain.field) - : data.extentRef(scope, domain.field); -} - -function multipleDomain(domain, spec, scope) { - var data = domain.data, - fields = domain.fields.reduce(function(dom, d) { - d = isString(d) ? {data: data, field: d} - : (isArray(d) || d.signal) ? fieldRef$1(d, scope) - : d; - dom.push(d); - return dom; - }, []); - - return (isDiscrete(spec.type) ? ordinalMultipleDomain - : isQuantile(spec.type) ? quantileMultipleDomain - : numericMultipleDomain)(domain, scope, fields); -} - -function fieldRef$1(data, scope) { - var name = '_:vega:_' + (FIELD_REF_ID++), - coll = Collect$1({}); - - if (isArray(data)) { - coll.value = {$ingest: data}; - } else if (data.signal) { - var code = 'setdata(' + $(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - scope.addDataPipeline(name, [coll, Sieve$1({})]); - return {data: name, field: 'data'}; -} - -function ordinalMultipleDomain(domain, scope, fields) { - var sort = parseSort(domain.sort, true), - counts, p, a, c, v; - - // get value counts for each domain field - counts = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); - }); - - // aggregate the results from each domain field - p = {groupby: keyFieldRef, pulse: counts}; - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [MULTIDOMAIN_SORT_OPS[a]]; - p.fields = [scope.fieldRef(v)]; - p.as = [v]; - } - a = scope.add(Aggregate$1(p)); - - // collect aggregate output - c = scope.add(Collect$1({pulse: ref(a)})); - - // extract values for combined domain - v = scope.add(Values$1({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) - })); - - return ref(v); -} - -function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if (isObject(sort)) sort.field = 'key'; - else sort = {field: 'key'}; - } else if (!sort.field && sort.op !== 'count') { - error('No field provided for sort aggregate op: ' + sort.op); - } else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) { - error('Multiple domain scales can not be sorted using ' + sort.op); - } - } - } - return sort; -} - -function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - var values = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); - }); - - // combine value arrays - return ref(scope.add(MultiValues$1({values: values}))); -} - -function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - var extents = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); - }); - - // combine extents - return ref(scope.add(MultiExtent$1({extents: extents}))); -} - -// -- SCALE BINS ----- - -function parseScaleBins(v, scope) { - return v.signal || isArray(v) - ? parseArray(v, scope) - : scope.objectProperty(v); -} - -// -- SCALE NICE ----- - -function parseScaleNice(nice) { - return isObject(nice) - ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } - : parseLiteral(nice); -} - -// -- SCALE INTERPOLATION ----- - -function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - if (interpolate.gamma != null) { - params.interpolateGamma = parseLiteral(interpolate.gamma); - } -} - -// -- SCALE RANGE ----- - -function parseScaleRange(spec, scope, params) { - var range = spec.range, - config = scope.config.range; - - if (range.signal) { - return scope.signalRef(range.signal); - } else if (isString(range)) { - if (config && hasOwnProperty(config, range)) { - spec = extend({}, spec, {range: config[range]}); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') { - range = [0, {signal: 'width'}]; - } else if (range === 'height') { - range = isDiscrete(spec.type) - ? [0, {signal: 'height'}] - : [{signal: 'height'}, 0]; - } else { - error('Unrecognized scale range value: ' + $(range)); - } - } else if (range.scheme) { - params.scheme = isArray(range.scheme) - ? parseArray(range.scheme, scope) - : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if (isDiscrete(spec.type) && !isArray(range)) { - return parseScaleDomain(range, spec, scope); - } else if (!isArray(range)) { - error('Unsupported range type: ' + $(range)); - } - - return range.map(v => (isArray(v) ? parseArray : parseLiteral)(v, scope)); -} - -function parseProjection(proj, scope) { - var config = scope.config.projection || {}, - params = {}; - - for (var name in proj) { - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } - - // apply projection defaults from config - for (name in config) { - if (params[name] == null) { - params[name] = parseParameter$1(config[name], name, scope); - } - } - - scope.addProjection(proj.name, params); -} - -function parseParameter$1(_, name, scope) { - return isArray(_) ? _.map(function(_) { return parseParameter$1(_, name, scope); }) - : !isObject(_) ? _ - : _.signal ? scope.signalRef(_.signal) - : name === 'fit' ? _ - : error('Unsupported parameter object: ' + $(_)); -} - -const Top$1 = 'top'; -const Left$1 = 'left'; -const Right$1 = 'right'; -const Bottom$1 = 'bottom'; -const Center$1 = 'center'; - -const Vertical = 'vertical'; - -const Start$1 = 'start'; -const Middle$1 = 'middle'; -const End$1 = 'end'; - -const Index = 'index'; -const Label = 'label'; -const Offset = 'offset'; -const Perc = 'perc'; -const Perc2 = 'perc2'; -const Value = 'value'; - -const GuideLabelStyle = 'guide-label'; -const GuideTitleStyle = 'guide-title'; -const GroupTitleStyle = 'group-title'; -const GroupSubtitleStyle = 'group-subtitle'; - -const Symbols$1 = 'symbol'; -const Gradient$1 = 'gradient'; -const Discrete$1 = 'discrete'; - -const Size = 'size'; -const Shape = 'shape'; -const Fill = 'fill'; -const Stroke = 'stroke'; -const StrokeWidth = 'strokeWidth'; -const StrokeDash = 'strokeDash'; -const Opacity = 'opacity'; - -// Encoding channels supported by legends -// In priority order of 'canonical' scale -const LegendScales = [ - Size, - Shape, - Fill, - Stroke, - StrokeWidth, - StrokeDash, - Opacity -]; - -const Skip$2 = { - name: 1, - style: 1, - interactive: 1 -}; - -const zero$1 = {value: 0}; -const one$1 = {value: 1}; - -var GroupMark = 'group'; -var RectMark = 'rect'; -var RuleMark = 'rule'; -var SymbolMark = 'symbol'; -var TextMark = 'text'; - -function guideGroup(mark) { - mark.type = GroupMark; - mark.interactive = mark.interactive || false; - return mark; -} - -function lookup$5(spec, config) { - const _ = (name, dflt) => value$2(spec[name], value$2(config[name], dflt)); - - _.isVertical = s => Vertical === value$2( - spec.direction, - config.direction || (s ? config.symbolDirection : config.gradientDirection) - ); - - _.gradientLength = () => value$2( - spec.gradientLength, - config.gradientLength || config.gradientWidth - ); - - _.gradientThickness = () => value$2( - spec.gradientThickness, - config.gradientThickness || config.gradientHeight - ); - - _.entryColumns = () => value$2( - spec.columns, - value$2(config.columns, +_.isVertical(true)) - ); - - return _; -} - -function getEncoding(name, encode) { - var v = encode && ( - (encode.update && encode.update[name]) || - (encode.enter && encode.enter[name]) - ); - return v && v.signal ? v : v ? v.value : null; -} - -function getStyle(name, scope, style) { - var s = scope.config.style[style]; - return s && s[name]; -} - -function anchorExpr(s, e, m) { - return `item.anchor === '${Start$1}' ? ${s} : item.anchor === '${End$1}' ? ${e} : ${m}`; -} - -const alignExpr = anchorExpr( - $(Left$1), - $(Right$1), - $(Center$1) -); - -function tickBand(_) { - let v = _('tickBand'), - offset = _('tickOffset'), - band, extra; - - if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); - } else if (v.signal) { - // if signal, augment code to interpret values - band = {signal: `(${v.signal}) === 'extent' ? 1 : 0.5`}; - extra = {signal: `(${v.signal}) === 'extent'`}; - if (!isObject(offset)) { - offset = {signal: `(${v.signal}) === 'extent' ? 0 : ${offset}`}; - } - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; - } else { - band = 0.5; - extra = false; - } - - return {extra, band, offset}; -} - -function extendOffset(value, offset) { - return !offset ? value - : !value ? offset - : !isObject(value) ? { value, offset } - : Object.assign({}, value, { offset: extendOffset(value.offset, offset) }); -} - -function guideMark(mark, extras) { - if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip$2); - } else { - mark.interactive = false; - } - return mark; -} - -function legendGradient(spec, scale, config, userEncode) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, start, stop, width, height; - - if (vertical) { - start = [0, 1]; - stop = [0, 0]; - width = thickness; - height = length; - } else { - start = [0, 0]; - stop = [1, 0]; - width = length; - height = thickness; - } - - encode = { - enter: enter = { - opacity: zero$1, - x: zero$1, - y: zero$1, - width: encoder(width), - height: encoder(height) - }, - update: extend({}, enter, { - opacity: one$1, - fill: {gradient: scale, start: start, stop: stop} - }), - exit: { - opacity: zero$1 - } - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode - }, userEncode); -} - -function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, u, v, uu, vv, adjust = ''; - - vertical - ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') - : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); - - enter = { - opacity: zero$1, - fill: {scale: scale, field: Value} - }; - enter[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - enter[v] = zero$1; - enter[uu] = {signal: adjust + 'datum.' + Perc2, mult: length}; - enter[vv] = encoder(thickness); - - encode = { - enter: enter, - update: extend({}, enter, {opacity: one$1}), - exit: {opacity: zero$1} - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode - }, userEncode); -} - -const alignExpr$1 = `datum.${Perc}<=0?"${Left$1}":datum.${Perc}>=1?"${Right$1}":"${Center$1}"`, - baselineExpr = `datum.${Perc}<=0?"${Bottom$1}":datum.${Perc}>=1?"${Top$1}":"${Middle$1}"`; - -function legendGradientLabels(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = encoder(_.gradientThickness()), - length = _.gradientLength(), - overlap = _('labelOverlap'), - encode, enter, update, u, v, adjust = ''; - - encode = { - enter: enter = { - opacity: zero$1 - }, - update: update = { - opacity: one$1, - text: {field: Label} - }, - exit: { - opacity: zero$1 - } - }; - - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value$2(spec.labelLimit, config.gradientLabelLimit) - }); - - if (vertical) { - enter.align = {value: 'left'}; - enter.baseline = update.baseline = {signal: baselineExpr}; - u = 'y'; v = 'x'; adjust = '1-'; - } else { - enter.align = update.align = {signal: alignExpr$1}; - enter.baseline = {value: 'top'}; - u = 'x'; v = 'y'; - } - - enter[u] = update[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - - enter[v] = update[v] = thickness; - thickness.offset = value$2(spec.labelOffset, config.gradientLabelOffset) || 0; - - overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; - - // type, role, style, key, dataRef, encode, extras - return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); -} - -// userEncode is top-level, includes entries, symbols, labels -function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - var _ = lookup$5(spec, config), - entries = userEncode.entries, - interactive = !!(entries && entries.interactive), - name = entries ? entries.name : undefined, - height = _('clipHeight'), - symbolOffset = _('symbolOffset'), - valueRef = {data: 'value'}, - encode = {}, - xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, - yEncode = height ? encoder(height) : {field: Size}, - index = `datum.${Index}`, - ncols = `max(1, ${columns})`, - enter, update, labelOffset, symbols, labels, nrows, sort; - - yEncode.mult = 0.5; - - // -- LEGEND SYMBOLS -- - encode = { - enter: enter = { - opacity: zero$1, - x: {signal: xSignal, mult: 0.5, offset: symbolOffset}, - y: yEncode - }, - update: update = { - opacity: one$1, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$1 - } - }; - - var baseFill = null, - baseStroke = null; - if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') - }, { // update - opacity: _('symbolOpacity') - }); - - LegendScales.forEach(function(scale) { - if (spec[scale]) { - update[scale] = enter[scale] = {scale: spec[scale], field: Value}; - } - }); - - symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode - }, userEncode.symbols); - - // -- LEGEND LABELS -- - labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - - encode = { - enter: enter = { - opacity: zero$1, - x: {signal: xSignal, offset: labelOffset}, - y: yEncode - }, - update: update = { - opacity: one$1, - text: {field: Label}, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$1 - } - }; - - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') - }); - - labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode - }, userEncode.labels); - - // -- LEGEND ENTRY GROUPS -- - encode = { - enter: { - noBound: {value: !height}, // ignore width/height in bounds calc - width: zero$1, - height: height ? encoder(height) : zero$1, - opacity: zero$1 - }, - exit: {opacity: zero$1}, - update: update = { - opacity: one$1, - row: {signal: null}, - column: {signal: null} - } - }; - - // annotate and sort groups to ensure correct ordering - if (_.isVertical(true)) { - nrows = `ceil(item.mark.items.length / ${ncols})`; - update.row.signal = `${index}%${nrows}`; - update.column.signal = `floor(${index} / ${nrows})`; - sort = {field: ['row', index]}; - } else { - update.row.signal = `floor(${index} / ${ncols})`; - update.column.signal = `${index} % ${ncols}`; - sort = {field: index}; - } - // handle zero column case (implies infinite columns) - update.column.signal = `(${columns})?${update.column.signal}:${index}`; - - // facet legend entries into sub-groups - dataRef = {facet: {data: dataRef, name: 'value', groupby: Index}}; - - return guideGroup({ - role: ScopeRole$1, - from: dataRef, - encode: extendEncode(encode, entries, Skip$2), - marks: [symbols, labels], - name, - interactive, - sort - }); -} - -function legendSymbolLayout(spec, config) { - const _ = lookup$5(spec, config); - - // layout parameters for legend entries - return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } - }; -} - -// expression logic for align, anchor, angle, and baseline calculation -const isL = 'item.orient === "left"', - isR = 'item.orient === "right"', - isLR = `(${isL} || ${isR})`, - isVG = `datum.vgrad && ${isLR}`, - baseline = anchorExpr('"top"', '"bottom"', '"middle"'), - alignFlip = anchorExpr('"right"', '"left"', '"center"'), - exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr}`, - exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, - exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, - exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; - -function legendTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), encode; - - encode = { - enter: {opacity: zero$1}, - update: { - opacity: one$1, - x: {field: {group: 'padding'}}, - y: {field: {group: 'padding'}} - }, - exit: {opacity: zero$1} - }; - - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: {signal: exprAnchor}, - angle: {signal: exprAngle}, - align: {signal: exprAlign}, - baseline: {signal: exprBaseline}, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - baseline: _('titleBaseline') - }); - - return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); -} - -function clip$2(clip, scope) { - var expr; - - if (isObject(clip)) { - if (clip.signal) { - expr = clip.signal; - } else if (clip.path) { - expr = 'pathShape(' + param(clip.path) + ')'; - } else if (clip.sphere) { - expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - } - - return expr - ? scope.signalRef(expr) - : !!clip; -} - -function param(value) { - return isObject(value) && value.signal - ? value.signal - : $(value); -} - -function getRole(spec) { - var role = spec.role || ''; - return (!role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title')) - ? role - : spec.type === GroupMark ? ScopeRole$1 : (role || MarkRole); -} - -function definition$1(spec) { - return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; -} - -function interactive(spec, scope) { - return spec && spec.signal ? scope.signalRef(spec.signal) - : spec === false ? false - : true; -} - -/** - * Parse a data transform specification. - */ -function parseTransform(spec, scope) { - var def = definition(spec.type); - if (!def) error('Unrecognized transform type: ' + $(spec.type)); - - var t = entry$1(def.type.toLowerCase(), null, parseParameters$1(def, spec, scope)); - if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; - - return t; -} - -/** - * Parse all parameters of a data transform. - */ -function parseParameters$1(def, spec, scope) { - var params = {}, pdef, i, n; - for (i=0, n=def.params.length; i spec[s] - ? (scales[s] = spec[s], scale = scale || spec[s]) : 0 - ); - if (!scale) error('Missing valid scale for legend.'); - - // resolve legend type (symbol, gradient, or discrete gradient) - type = legendType(spec, scope.scaleType(scale)); - - // single-element data source for legend group - datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - dataRef = ref(scope.add(Collect$1(null, [datum]))); - - // encoding properties for legend group - legendEncode = extendEncode( - buildLegendEncode(_, spec, config), legendEncode, Skip$2 - ); - - // encoding properties for legend entry sub-group - entryEncode = {enter: {x: {value: 0}, y: {value: 0}}}; - - // data source for legend values - entryRef = ref(scope.add(LegendEntries$1(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // continuous gradient legend - if (type === Gradient$1) { - children = [ - legendGradient(spec, scale, config, encode.gradient), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - // adjust default tick count based on the gradient length - params.count = params.count || scope.signalRef( - `max(2,2*floor((${deref(_.gradientLength())})/100))` - ); - } - - // discrete gradient legend - else if (type === Discrete$1) { - children = [ - legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - } - - // symbol legend - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [ - legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns)) - ]; - // pass symbol size information to legend entry generator - params.size = sizeExpression(spec, scope, children[0].marks); - } - - // generate legend marks - children = [ - guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive - }) - ]; - - // include legend title if defined - if (datum.title) { - children.push(legendTitle(spec, config, encode.title, dataRef)); - } - - // parse legend specification - return parseMark( - guideGroup({ - role: LegendRole$1, - from: dataRef, - encode: legendEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); -} - -function legendType(spec, scaleType) { - var type = spec.type || Symbols$1; - - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { - type = isContinuous(scaleType) ? Gradient$1 - : isDiscretizing(scaleType) ? Discrete$1 - : Symbols$1; - } - - return type !== Gradient$1 ? type - : isDiscretizing(scaleType) ? Discrete$1 - : Gradient$1; -} - -function scaleCount(spec) { - return LegendScales.reduce(function(count, type) { - return count + (spec[type] ? 1 : 0); - }, 0); -} - -function buildLegendEncode(_, spec, config) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; -} - -function sizeExpression(spec, scope, marks) { - var size = deref(getChannel('size', spec, marks)), - strokeWidth = deref(getChannel('strokeWidth', spec, marks)), - fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - - return parseExpression$1( - `max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, - scope - ); -} - -function getChannel(name, spec, marks) { - return spec[name] - ? `scale("${spec[name]}",datum)` - : getEncoding(name, marks[0].encode); -} - -function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); -} - -const angleExpr = `item.orient==="${Left$1}"?-90:item.orient==="${Right$1}"?90:0`; - -function parseTitle(spec, scope) { - spec = isString(spec) ? {text: spec} : spec; - - var _ = lookup$5(spec, scope.config.title), - encode = spec.encode || {}, - userEncode = encode.group || {}, - name = userEncode.name || undefined, - interactive = userEncode.interactive, - style = userEncode.style, - children = [], - datum, dataRef; - - // single-element data source for group title - datum = {}; - dataRef = ref(scope.add(Collect$1(null, [datum]))); - - // include title text - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); - - // include subtitle text - if (spec.subtitle) { - children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - } - - // parse title specification - return parseMark( - guideGroup({ - role: TitleRole$1, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); -} - -// provide backwards-compatibility for title custom encode; -// the top-level encode block has been *deprecated*. -function titleEncode(spec) { - const encode = spec.encode; - return (encode && encode.title) || extend({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); -} - -function groupEncode(_, userEncode) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: {signal: alignExpr}, - angle: {signal: angleExpr}, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') - }); - - return extendEncode(encode, userEncode, Skip$2); -} - -function buildTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.text, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode - }, userEncode); -} - -function buildSubTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.subtitle, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode - }, userEncode); -} - -function parseData$1(data, scope) { - var transforms = []; - - if (data.transform) { - data.transform.forEach(function(tx) { - transforms.push(parseTransform(tx, scope)); - }); - } - - if (data.on) { - data.on.forEach(function(on) { - parseTrigger(on, scope, data.name); - }); - } - - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); -} - -/** - * Analyze a data pipeline, add needed operators. - */ -function analyze(data, scope, ops) { - var output = [], - source = null, - modify = false, - generate = false, - upstream, i, n, t, m; - - if (data.values) { - // hard-wired input data set - if (hasSignal(data.values) || hasSignal(data.format)) { - // if either values or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format - })); - } - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format - })); - } - } else if (data.source) { - // derives from one or more other data sets - source = upstream = array(data.source).map(function(d) { - return ref(scope.getData(d).output); - }); - output.push(null); // populate later - } - - // scan data transforms, add collectors as needed - for (i=0, n=ops.length; i orient === Bottom$1 || orient === Top$1; - -// get sign coefficient based on axis orient -const getSign = (orient, a, b) => isSignal(orient) - ? ifLeftTopExpr(orient.signal, a, b) - : orient === Left$1 || orient === Top$1 ? a : b; - -// condition on axis x-direction -const ifX = (orient, a, b) => isSignal(orient) - ? ifXEnc(orient.signal, a, b) - : isX(orient) ? a : b; - -// condition on axis y-direction -const ifY = (orient, a, b) => isSignal(orient) - ? ifYEnc(orient.signal, a, b) - : isX(orient) ? b : a; - -const ifTop = (orient, a, b) => isSignal(orient) - ? ifTopExpr(orient.signal, a, b) - : orient === Top$1 ? {value: a} : {value: b}; - -const ifRight = (orient, a, b) => isSignal(orient) - ? ifRightExpr(orient.signal, a, b) - : orient === Right$1 ? {value: a} : {value: b}; - -const ifXEnc = ($orient, a, b) => ifEnc( - `${$orient} === '${Top$1}' || ${$orient} === '${Bottom$1}'`, a, b -); - -const ifYEnc = ($orient, a, b) => ifEnc( - `${$orient} !== '${Top$1}' && ${$orient} !== '${Bottom$1}'`, a, b -); - -const ifLeftTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Left$1}' || ${$orient} === '${Top$1}'`, a, b -); - -const ifTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Top$1}'`, a, b -); - -const ifRightExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Right$1}'`, a, b -); - -const ifEnc = (test, a, b) => { - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? (a.signal || $(a.value)) : null; - b = b ? (b.signal || $(b.value)) : null; - return {signal: `${test} ? (${a}) : (${b})`}; - } else { - // otherwise generate rule set - return [extend({test}, a)].concat(b || []); - } -}; - -const isSimple = enc => ( - enc == null || Object.keys(enc).length === 1 -); - -const ifExpr = (test, a, b) => ({ - signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})` -}); - -const ifOrient = ($orient, t, b, l, r) => ({ - signal: (l != null ? `${$orient} === '${Left$1}' ? (${toExpr(l)}) : ` : '') - + (b != null ? `${$orient} === '${Bottom$1}' ? (${toExpr(b)}) : ` : '') - + (r != null ? `${$orient} === '${Right$1}' ? (${toExpr(r)}) : ` : '') - + (t != null ? `${$orient} === '${Top$1}' ? (${toExpr(t)}) : ` : '') - + '(null)' -}); - -const toExpr = v => isSignal(v) - ? v.signal - : v == null ? null : $(v); - -const mult = (sign, value) => value === 0 ? 0 : isSignal(sign) - ? {signal: `(${sign.signal}) * ${value}`} - : {value: sign * value}; - -const patch = (value, base) => { - const s = value.signal; - return s && s.endsWith('(null)') - ? {signal: s.slice(0, -6) + base.signal} - : value; -}; - -function fallback(prop, config, axisConfig, style) { - let styleProp; - - if (config && hasOwnProperty(config, prop)) { - return config[prop]; - } - else if (hasOwnProperty(axisConfig, prop)) { - return axisConfig[prop]; - } - else if (prop.startsWith('title')) { - switch (prop) { - case 'titleColor': - styleProp = 'fill'; - break; - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideTitleStyle][styleProp]; - } - else if (prop.startsWith('label')) { - switch (prop) { - case 'labelColor': - styleProp = 'fill'; - break; - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideLabelStyle][styleProp]; - } - - return null; -} - -function keys$1(objects) { - const map = {}; - for (const obj of objects) { - if (!obj) continue; - for (const key in obj) map[key] = 1; - } - return Object.keys(map); -} - -function axisConfig(spec, scope) { - var config = scope.config, - style = config.style, - axis = config.axis, - band = scope.scaleType(spec.scale) === 'band' && config.axisBand, - orient = spec.orient, - xy, or, key; - - if (isSignal(orient)) { - const xyKeys = keys$1([ - config.axisX, config.axisY - ]), - orientKeys = keys$1([ - config.axisTop, config.axisBottom, - config.axisLeft, config.axisRight - ]); - - xy = {}; - for (key of xyKeys) { - xy[key] = ifX( - orient, - fallback(key, config.axisX, axis, style), - fallback(key, config.axisY, axis, style) - ); - } - - or = {}; - for (key of orientKeys) { - or[key] = ifOrient( - orient.signal, - fallback(key, config.axisTop, axis, style), - fallback(key, config.axisBottom, axis, style), - fallback(key, config.axisLeft, axis, style), - fallback(key, config.axisRight, axis, style) - ); - } - } else { - xy = (orient === Top$1 || orient === Bottom$1) ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; - } - - var result = (xy || or || band) - ? extend({}, axis, xy, or, band) - : axis; - - return result; -} - -function axisDomain(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - encode, enter, update; - - encode = { - enter: enter = {opacity: zero$1}, - update: update = {opacity: one$1}, - exit: {opacity: zero$1} - }; - - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') - }); - - const pos0 = position(spec, 0); - const pos1 = position(spec, 1); - - enter.x = update.x = ifX(orient, pos0, zero$1); - enter.x2 = update.x2 = ifX(orient, pos1); - - enter.y = update.y = ifY(orient, pos0, zero$1); - enter.y2 = update.y2 = ifY(orient, pos1); - - return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode - }, userEncode); -} - -function position(spec, pos) { - return {scale: spec.scale, range: pos}; -} - -function axisGrid(spec, config, userEncode, dataRef, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - vscale = spec.gridScale, - sign = getSign(orient, 1, -1), - offset = offsetValue$1(spec.offset, sign), - encode, enter, exit, update, - tickPos, gridStart, gridEnd, sz; - - encode = { - enter: enter = {opacity: zero$1}, - update: update = {opacity: one$1}, - exit: exit = {opacity: zero$1} - }; - - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') - }); - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - sz = ifX(orient, {signal: 'height'}, {signal: 'width'}); - - gridStart = vscale - ? {scale: vscale, range: 0, mult: sign, offset: offset} - : {value: 0, offset: offset}; - - gridEnd = vscale - ? {scale: vscale, range: 1, mult: sign, offset: offset} - : extend(sz, {mult: sign, offset: offset}); - - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); - exit.x = ifX(orient, tickPos); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode - }, userEncode); -} - -function offsetValue$1(offset, sign) { - if (sign === 1) ; else if (!isObject(offset)) { - offset = isSignal(sign) - ? {signal: `(${sign.signal}) * (${offset || 0})`} - : sign * (offset || 0); - } else { - let entry = offset = extend({}, offset); - while (entry.mult != null) { - if (!isObject(entry.mult)) { - entry.mult = isSignal(sign) // no offset if sign === 1 - ? {signal: `(${entry.mult}) * (${sign.signal})`} - : entry.mult * sign; - return offset; - } else { - entry = entry.mult = extend({}, entry.mult); - } - } - entry.mult = sign; - } - - return offset; -} - -function axisTicks(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, exit, update, tickSize, tickPos; - - encode = { - enter: enter = {opacity: zero$1}, - update: update = {opacity: one$1}, - exit: exit = {opacity: zero$1} - }; - - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') - }); - - tickSize = encoder(size); - tickSize.mult = sign; - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - update.y = enter.y = ifX(orient, zero$1, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); - exit.x = ifX(orient, tickPos); - - update.x = enter.x = ifY(orient, zero$1, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode - }, userEncode); -} - -function flushExpr(scale, threshold, a, b, c) { - return { - signal: 'flush(range("' + scale + '"), ' - + 'scale("' + scale + '", datum.value), ' - + threshold + ',' + a + ',' + b + ',' + c + ')' - }; -} - -function axisLabels(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - scale = spec.scale, - sign = getSign(orient, -1, 1), - flush = deref(_('labelFlush')), - flushOffset = deref(_('labelFlushOffset')), - flushOn = flush === 0 || !!flush, - labelAlign = _('labelAlign'), - labelBaseline = _('labelBaseline'), - encode, enter, update, tickSize, tickPos, - align, baseline, bound, overlap, offsetExpr; - - tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; - - tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - - align = ifX(orient, - flushOn - ? flushExpr(scale, flush, '"left"', '"right"', '"center"') - : {value: 'center'}, - ifRight(orient, 'left', 'right') - ); - - baseline = ifX(orient, - ifTop(orient, 'bottom', 'top'), - flushOn - ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') - : {value: 'middle'} - ); - - offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0); - flushOn = flushOn && flushOffset; - - enter = { - opacity: zero$1, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - - encode = { - enter: enter, - update: update = { - opacity: one$1, - text: {field: Label}, - x: enter.x, - y: enter.y, - align, - baseline - }, - exit: { - opacity: zero$1, - x: enter.x, - y: enter.y - } - }; - - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') - }, { - align: labelAlign, - baseline: labelBaseline - }); - - bound = _('labelBound'); - overlap = _('labelOverlap'); - - // if overlap method or bound defined, request label overlap removal - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? {scale, orient, tolerance: bound} : null - } : undefined; - - if (update.align !== align) { - update.align = patch(update.align, align); - } - if (update.baseline !== baseline) { - update.baseline = patch(update.baseline, baseline); - } - - return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); -} - -function axisTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, update, titlePos; - - encode = { - enter: enter = { - opacity: zero$1, - anchor: encoder(_('titleAnchor', null)), - align: {signal: alignExpr} - }, - update: update = extend({}, enter, { - opacity: one$1, - text: encoder(spec.title) - }), - exit: { - opacity: zero$1 - } - }; - - titlePos = { - signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` - }; - - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero$1, mult(sign, 90)); - enter.baseline = ifX(orient, ifTop(orient, Bottom$1, Top$1), {value: Bottom$1}); - update.angle = enter.angle; - update.baseline = enter.baseline; - - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); - - return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); -} - -function autoLayout(_, orient, encode, userEncode) { - const auto = (value, dim) => value != null - ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) - : !has(dim, userEncode) ? true : false; - - const autoY = auto(_('titleX'), 'x'), - autoX = auto(_('titleY'), 'y'); - - encode.enter.auto = autoX === autoY - ? encoder(autoX) - : ifX(orient, encoder(autoX), encoder(autoY)); -} - -function parseAxis(spec, scope) { - var config = axisConfig(spec, scope), - encode = spec.encode || {}, - axisEncode = encode.axis || {}, - name = axisEncode.name || undefined, - interactive = axisEncode.interactive, - style = axisEncode.style, - _ = lookup$5(spec, config), - band = tickBand(_), - datum, dataRef, ticksRef, size, children; - - // single-element data source for axis group - datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - dataRef = ref(scope.add(Collect$1({}, [datum]))); - - // encoding properties for axis group item - axisEncode = extendEncode( - buildAxisEncode(_, spec), axisEncode, Skip$2 - ); - - // data source for axis ticks - ticksRef = ref(scope.add(AxisTicks$1({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // generate axis marks - children = []; - - // include axis gridlines if requested - if (datum.grid) { - children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - } - - // include axis ticks if requested - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } - - // include axis labels if requested - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } - - // include axis domain path if requested - if (datum.domain) { - children.push(axisDomain(spec, config, encode.domain, dataRef)); - } - - // include axis title if defined - if (datum.title) { - children.push(axisTitle(spec, config, encode.title, dataRef)); - } - - // parse axis specification - return parseMark( - guideGroup({ - role: AxisRole$1, - from: dataRef, - encode: axisEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); -} - -function buildAxisEncode(_, spec) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value$2(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: {signal: `abs(span(range("${spec.scale}")))`}, - translate: _('translate'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; -} - -function parseScope(spec, scope, preprocessed) { - var signals = array(spec.signals), - scales = array(spec.scales); - - // parse signal definitions, if not already preprocessed - if (!preprocessed) signals.forEach(_ => parseSignal(_, scope)); - - // parse cartographic projection definitions - array(spec.projections).forEach(_ => parseProjection(_, scope)); - - // initialize scale references - scales.forEach(_ => initScale(_, scope)); - - // parse data sources - array(spec.data).forEach(_ => parseData$1(_, scope)); - - // parse scale definitions - scales.forEach(_ => parseScale(_, scope)); - - // parse signal updates - (preprocessed || signals).forEach(_ => parseSignalUpdates(_, scope)); - - // parse axis definitions - array(spec.axes).forEach(_ => parseAxis(_, scope)); - - // parse mark definitions - array(spec.marks).forEach(_ => parseMark(_, scope)); - - // parse legend definitions - array(spec.legends).forEach(_ => parseLegend(_, scope)); - - // parse title, if defined - if (spec.title) parseTitle(spec.title, scope); - - // parse collected lambda (anonymous) expressions - scope.parseLambdas(); - - return scope; -} - -const rootEncode = spec => extendEncode( - { - enter: { - x: {value: 0}, - y: {value: 0} - }, - update: { - width: {signal: 'width'}, - height: {signal: 'height'} - } - }, - spec -); - -function parseView(spec, scope) { - const config = scope.config; - - // add scenegraph root - const root = ref(scope.root = scope.add(operator())); - - // parse top-level signal definitions - const signals = collectSignals(spec, config); - signals.forEach(_ => parseSignal(_, scope)); - - // assign description, event, legend, and locale configuration - scope.description = spec.description || config.description; - scope.eventConfig = config.events; - scope.legends = scope.objectProperty(config.legend && config.legend.layout); - scope.locale = config.locale; - - // store root group item - const input = scope.add(Collect$1()); - - // encode root group item - const encode = scope.add(Encode$1(parseEncode( - rootEncode(spec.encode), GroupMark, FrameRole$1, - spec.style, scope, {pulse: ref(input)} - ))); - - // perform view layout - const parent = scope.add(ViewLayout$1({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) - })); - scope.operators.pop(); - - // parse remainder of specification - scope.pushState(ref(encode), ref(parent), null); - parseScope(spec, scope, signals); - scope.operators.push(parent); - - // bound / render / sieve root item - let op = scope.add(Bound$1({mark: root, pulse: ref(parent)})); - op = scope.add(Render$1({pulse: ref(op)})); - op = scope.add(Sieve$1({pulse: ref(op)})); - - // track metadata for root item - scope.addData('root', new DataScope(scope, input, input, op)); - - return scope; -} - -function signalObject(name, value) { - return value && value.signal - ? { name, update: value.signal } - : { name, value }; -} - -/** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ -function collectSignals(spec, config) { - const _ = name => value$2(spec[name], config[name]), - signals = [ - signalObject('background', _('background')), - signalObject('autosize', parseAutosize(_('autosize'))), - signalObject('padding', parsePadding(_('padding'))), - signalObject('width', _('width') || 0), - signalObject('height', _('height') || 0) - ], - pre = signals.reduce((p, s) => (p[s.name] = s, p), {}), - map = {}; - - // add spec signal array - array(spec.signals).forEach(s => { - if (hasOwnProperty(pre, s.name)) { - // merge if built-in signal - s = extend(pre[s.name], s); - } else { - // otherwise add to signal list - signals.push(s); - } - map[s.name] = s; - }); - - // add config signal array - array(config.signals).forEach(s => { - if (!hasOwnProperty(map, s.name) && !hasOwnProperty(pre, s.name)) { - // add to signal list if not already defined - signals.push(s); - } - }); - - return signals; -} - -function Scope$1(config, options) { - this.config = config || {}; - this.options = options || {}; - - this.bindings = []; - this.field = {}; - this.signals = {}; - this.lambdas = {}; - this.scales = {}; - this.events = {}; - this.data = {}; - - this.streams = []; - this.updates = []; - this.operators = []; - this.eventConfig = null; - this.locale = null; - - this._id = 0; - this._subid = 0; - this._nextsub = [0]; - - this._parent = []; - this._encode = []; - this._lookup = []; - this._markpath = []; -} - -function Subscope(scope) { - this.config = scope.config; - this.options = scope.options; - this.legends = scope.legends; - - this.field = Object.create(scope.field); - this.signals = Object.create(scope.signals); - this.lambdas = Object.create(scope.lambdas); - this.scales = Object.create(scope.scales); - this.events = Object.create(scope.events); - this.data = Object.create(scope.data); - - this.streams = []; - this.updates = []; - this.operators = []; - - this._id = 0; - this._subid = ++scope._nextsub[0]; - this._nextsub = scope._nextsub; - - this._parent = scope._parent.slice(); - this._encode = scope._encode.slice(); - this._lookup = scope._lookup.slice(); - this._markpath = scope._markpath; -} - -var prototype$1u = Scope$1.prototype = Subscope.prototype; - -// ---- - -prototype$1u.parse = function(spec) { - return parseScope(spec, this); -}; - -prototype$1u.fork = function() { - return new Subscope(this); -}; - -prototype$1u.isSubscope = function() { - return this._subid > 0; -}; - -prototype$1u.toRuntime = function() { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; -}; - -prototype$1u.id = function() { - return (this._subid ? this._subid + ':' : 0) + this._id++; -}; - -prototype$1u.add = function(op) { - this.operators.push(op); - op.id = this.id(); - // if pre-registration references exist, resolve them now - if (op.refs) { - op.refs.forEach(function(ref) { ref.$ref = op.id; }); - op.refs = null; - } - return op; -}; - -prototype$1u.proxy = function(op) { - var vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy$1({value: vref})); -}; - -prototype$1u.addStream = function(stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; -}; - -prototype$1u.addUpdate = function(update) { - this.updates.push(update); - return update; -}; - -// Apply metadata -prototype$1u.finish = function() { - var name, ds; - - // annotate root - if (this.root) this.root.root = true; - - // annotate signals - for (name in this.signals) { - this.signals[name].signal = name; - } - - // annotate scales - for (name in this.scales) { - this.scales[name].scale = name; - } - - // annotate data sets - function annotate(op, name, type) { - var data, list; - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } - } - for (name in this.data) { - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - for (var field in ds.index) { - annotate(ds.index[field], name, 'index:' + field); - } - } - - return this; -}; - -// ---- - -prototype$1u.pushState = function(encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve$1({pulse: encode})))); - this._parent.push(parent); - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - this._markpath.push(-1); -}; - -prototype$1u.popState = function() { - this._encode.pop(); - this._parent.pop(); - this._lookup.pop(); - this._markpath.pop(); -}; - -prototype$1u.parent = function() { - return peek(this._parent); -}; - -prototype$1u.encode = function() { - return peek(this._encode); -}; - -prototype$1u.lookup = function() { - return peek(this._lookup); -}; - -prototype$1u.markpath = function() { - var p = this._markpath; - return ++p[p.length-1]; -}; - -// ---- - -prototype$1u.fieldRef = function(field, name) { - if (isString(field)) return fieldRef(field, name); - if (!field.signal) { - error('Unsupported field reference: ' + $(field)); - } - - var s = field.signal, - f = this.field[s], - params; - - if (!f) { - params = {name: this.signalRef(s)}; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field$1(params))); - } - return f; -}; - -prototype$1u.compareRef = function(cmp) { - function check(_) { - if (isSignal(_)) { - signal = true; - return scope.signalRef(_.signal); - } else if (isExpr(_)) { - signal = true; - return scope.exprRef(_.expr); - } else { - return _; - } - } - - var scope = this, - signal = false, - fields = array(cmp.field).map(check), - orders = array(cmp.order).map(check); - - return signal - ? ref(this.add(Compare$1({fields: fields, orders: orders}))) - : compareRef(fields, orders); -}; - -prototype$1u.keyRef = function(fields, flat) { - function check(_) { - if (isSignal(_)) { - signal = true; - return ref(sig[_.signal]); - } else { - return _; - } - } - - var sig = this.signals, - signal = false; - fields = array(fields).map(check); - - return signal - ? ref(this.add(Key$1({fields: fields, flat: flat}))) - : keyRef(fields, flat); -}; - -prototype$1u.sortRef = function(sort) { - if (!sort) return sort; - - // including id ensures stable sorting - var a = aggrField(sort.op, sort.field), - o = sort.order || Ascending; - - return o.signal - ? ref(this.add(Compare$1({ - fields: a, - orders: this.signalRef(o.signal) - }))) - : compareRef(a, o); -}; - -// ---- - -prototype$1u.event = function(source, type) { - var key = source + ':' + type; - if (!this.events[key]) { - var id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - return this.events[key]; -}; - -// ---- - -prototype$1u.hasOwnSignal = function(name) { - return hasOwnProperty(this.signals, name); -}; - -prototype$1u.addSignal = function(name, value) { - if (this.hasOwnSignal(name)) { - error('Duplicate signal name: ' + $(name)); - } - var op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; -}; - -prototype$1u.getSignal = function(name) { - if (!this.signals[name]) { - error('Unrecognized signal name: ' + $(name)); - } - return this.signals[name]; -}; - -prototype$1u.signalRef = function(s) { - if (this.signals[s]) { - return ref(this.signals[s]); - } else if (!hasOwnProperty(this.lambdas, s)) { - this.lambdas[s] = this.add(operator(null)); - } - return ref(this.lambdas[s]); -}; - -prototype$1u.parseLambdas = function() { - var code = Object.keys(this.lambdas); - for (var i=0, n=code.length; i 0 ? ',' : '') - + (isObject(value) - ? (value.signal || propertyLambda(value)) - : $(value)); - } - return code + ']'; -} - -function objectLambda(obj) { - var code = '{', - i = 0, - key, value; - - for (key in obj) { - value = obj[key]; - code += (++i > 1 ? ',' : '') - + $(key) + ':' - + (isObject(value) - ? (value.signal || propertyLambda(value)) - : $(value)); - } - return code + '}'; -} - -prototype$1u.exprRef = function(code, name) { - var params = {expr: parseExpression$1(code, this)}; - if (name) params.expr.$name = name; - return ref(this.add(Expression$1(params))); -}; - -prototype$1u.addBinding = function(name, bind) { - if (!this.bindings) { - error('Nested signals do not support binding: ' + $(name)); - } - this.bindings.push(extend({signal: name}, bind)); -}; - -// ---- - -prototype$1u.addScaleProj = function(name, transform) { - if (hasOwnProperty(this.scales, name)) { - error('Duplicate scale or projection name: ' + $(name)); - } - this.scales[name] = this.add(transform); -}; - -prototype$1u.addScale = function(name, params) { - this.addScaleProj(name, Scale$1(params)); -}; - -prototype$1u.addProjection = function(name, params) { - this.addScaleProj(name, Projection$1(params)); -}; - -prototype$1u.getScale = function(name) { - if (!this.scales[name]) { - error('Unrecognized scale name: ' + $(name)); - } - return this.scales[name]; -}; - -prototype$1u.projectionRef = -prototype$1u.scaleRef = function(name) { - return ref(this.getScale(name)); -}; - -prototype$1u.projectionType = -prototype$1u.scaleType = function(name) { - return this.getScale(name).params.type; -}; - -// ---- - -prototype$1u.addData = function(name, dataScope) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - return (this.data[name] = dataScope); -}; - -prototype$1u.getData = function(name) { - if (!this.data[name]) { - error('Undefined data set name: ' + $(name)); - } - return this.data[name]; -}; - -prototype$1u.addDataPipeline = function(name, entries) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - return this.addData(name, DataScope.fromEntries(this, entries)); -}; - -/** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ -function defaults() { - const defaultFont = 'sans-serif', - defaultSymbolSize = 30, - defaultStrokeWidth = 2, - defaultColor = '#4c78a8', - black = '#000', - gray = '#888', - lightGray = '#ddd'; - - return { - // default visualization description - description: 'Vega visualization', - - // default padding around visualization - padding: 0, - - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - - // default view background color - // covers the entire view component - background: null, - - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: {allow: ['wheel']} - }, - - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - } - }, - - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 - }, - - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 - }, - - // correction for centering bias - axisBand: { - tickOffset: -0.5 - }, - - // defaults for cartographic projection - projection: { - type: 'mercator' - }, - - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { direction: 'vertical' }, - right: { direction: 'vertical' } - } - }, - - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [1, 0] - }, - symbol: [ - 'circle', - 'square', - 'triangle-up', - 'cross', - 'diamond', - 'triangle-right', - 'triangle-down', - 'triangle-left' - ] - } - }; -} - -function parse$6(spec, config, options) { - if (!isObject(spec)) { - error('Input Vega specification must be an object.'); - } - - config = mergeConfig(defaults(), config, spec.config); - return parseView(spec, new Scope$1(config, options)).toRuntime(); -} - -// -- Transforms ----- -extend(transforms, tx, vtx, encode, geo, force, tree, reg, voronoi, wordcloud, xf); - -export { Bounds, CanvasHandler, CanvasRenderer, DATE, DAY, DAYOFYEAR, Dataflow, Debug, Error$1 as Error, EventStream, Gradient, GroupItem, HOURS, Handler, Info, Item, MILLISECONDS, MINUTES, MONTH, Marks, MultiPulse, None, Operator, Parameters, Pulse, QUARTER, RenderType, Renderer, ResourceLoader, SECONDS, SVGHandler, SVGRenderer, SVGStringRenderer, Scenegraph, TIME_UNITS, Transform, View, WEEK, Warn, YEAR, accessor, accessorFields, accessorName, array, bandwidthNRD, bin, bootstrapCI, boundClip, context as boundContext, boundItem, boundMark, boundStroke, changeset, clampRange, closeTag, compare, constant, cumulativeLogNormal, cumulativeNormal, cumulativeUniform, dayofyear, debounce, defaultLocale, definition, densityLogNormal, densityNormal, densityUniform, domChild, domClear, domCreate, domFind, dotbin, error, expressionFunction, extend, extent, extentIndex, falsy, fastmap, field, flush, font, fontFamily, fontSize, format, numberFormatDefaultLocale as formatLocale, formats, hasOwnProperty, id, identity, inferType, inferTypes, ingest, inherits, inrange, interpolate, interpolateColors, interpolateRange, intersect, intersectBoxLine, intersectPath, intersectPoint, intersectRule, isArray, isBoolean, isDate, isFunction, isNumber, isObject, isRegExp, isString, isTuple, key, lerp, lineHeight, loader, locale, logger, lruCache, merge, mergeConfig, multiLineOffset, one, openTag, pad, panLinear, panLog, panPow, panSymlog, parse$6 as parse, curves as pathCurves, pathEqual, pathParse, vg_rect as pathRectangle, pathRender, symbols as pathSymbols, vg_trail as pathTrail, peek, point, projection, quantileLogNormal, quantileNormal, quantileUniform, quantiles, quantizeInterpolator, quarter, quartiles, random, integer as randomInteger, randomKDE, lcg as randomLCG, randomLogNormal, randomMixture, randomNormal, randomUniform, read, regressionExp, regressionLinear, regressionLoess, regressionLog, regressionPoly, regressionPow, regressionQuad, renderModule, repeat, resetDefaultLocale, resetSVGClipId, resetSVGDefIds, responseType, context$2 as runtimeContext, sampleCurve, sampleLogNormal, sampleNormal, sampleUniform, scale$2 as scale, sceneEqual, sceneFromJSON, pickVisit as scenePickVisit, sceneToJSON, visit as sceneVisit, zorder as sceneZOrder, scheme, setRandom, span, splitAccessPath, $ as stringValue, textMetrics, timeBin, timeFloor, timeFormatDefaultLocale as timeFormatLocale, timeInterval, timeOffset, timeSequence, timeUnitSpecifier, timeUnits, toBoolean, toDate, toNumber, toSet, toString, transform, transforms, truncate, truthy, tupleid, typeParsers, utcFloor, utcInterval, utcOffset, utcSequence, utcdayofyear, utcquarter, utcweek, version, visitArray, week, writeConfig, zero, zoomLinear, zoomLog, zoomPow, zoomSymlog }; diff --git a/node_modules/vega/build/vega-node.js b/node_modules/vega/build/vega-node.js deleted file mode 100644 index a92ea3a..0000000 --- a/node_modules/vega/build/vega-node.js +++ /dev/null @@ -1,254 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var vegaUtil = require('vega-util'); -var vegaDataflow = require('vega-dataflow'); -var tx = require('vega-transforms'); -var vtx = require('vega-view-transforms'); -var encode = require('vega-encode'); -var geo = require('vega-geo'); -var force = require('vega-force'); -var tree = require('vega-hierarchy'); -var reg = require('vega-regression'); -var voronoi = require('vega-voronoi'); -var wordcloud = require('vega-wordcloud'); -var xf = require('vega-crossfilter'); -var vegaStatistics = require('vega-statistics'); -var vegaTime = require('vega-time'); -var vegaLoader = require('vega-loader'); -var vegaScenegraph = require('vega-scenegraph'); -var vegaScale = require('vega-scale'); -var vegaProjection = require('vega-projection'); -var vegaView = require('vega-view'); -var vegaFormat = require('vega-format'); -var vegaFunctions = require('vega-functions'); -var vegaParser = require('vega-parser'); -var vegaRuntime = require('vega-runtime'); - -var version = "5.13.0"; - -// -- Transforms ----- -vegaUtil.extend(vegaDataflow.transforms, tx, vtx, encode, geo, force, tree, reg, voronoi, wordcloud, xf); - -Object.keys(vegaUtil).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return vegaUtil[k]; - } - }); -}); -Object.keys(vegaStatistics).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return vegaStatistics[k]; - } - }); -}); -Object.keys(vegaTime).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return vegaTime[k]; - } - }); -}); -Object.keys(vegaLoader).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return vegaLoader[k]; - } - }); -}); -Object.keys(vegaScenegraph).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return vegaScenegraph[k]; - } - }); -}); -Object.defineProperty(exports, 'Dataflow', { - enumerable: true, - get: function () { - return vegaDataflow.Dataflow; - } -}); -Object.defineProperty(exports, 'EventStream', { - enumerable: true, - get: function () { - return vegaDataflow.EventStream; - } -}); -Object.defineProperty(exports, 'MultiPulse', { - enumerable: true, - get: function () { - return vegaDataflow.MultiPulse; - } -}); -Object.defineProperty(exports, 'Operator', { - enumerable: true, - get: function () { - return vegaDataflow.Operator; - } -}); -Object.defineProperty(exports, 'Parameters', { - enumerable: true, - get: function () { - return vegaDataflow.Parameters; - } -}); -Object.defineProperty(exports, 'Pulse', { - enumerable: true, - get: function () { - return vegaDataflow.Pulse; - } -}); -Object.defineProperty(exports, 'Transform', { - enumerable: true, - get: function () { - return vegaDataflow.Transform; - } -}); -Object.defineProperty(exports, 'changeset', { - enumerable: true, - get: function () { - return vegaDataflow.changeset; - } -}); -Object.defineProperty(exports, 'definition', { - enumerable: true, - get: function () { - return vegaDataflow.definition; - } -}); -Object.defineProperty(exports, 'ingest', { - enumerable: true, - get: function () { - return vegaDataflow.ingest; - } -}); -Object.defineProperty(exports, 'isTuple', { - enumerable: true, - get: function () { - return vegaDataflow.isTuple; - } -}); -Object.defineProperty(exports, 'transform', { - enumerable: true, - get: function () { - return vegaDataflow.transform; - } -}); -Object.defineProperty(exports, 'transforms', { - enumerable: true, - get: function () { - return vegaDataflow.transforms; - } -}); -Object.defineProperty(exports, 'tupleid', { - enumerable: true, - get: function () { - return vegaDataflow.tupleid; - } -}); -Object.defineProperty(exports, 'interpolate', { - enumerable: true, - get: function () { - return vegaScale.interpolate; - } -}); -Object.defineProperty(exports, 'interpolateColors', { - enumerable: true, - get: function () { - return vegaScale.interpolateColors; - } -}); -Object.defineProperty(exports, 'interpolateRange', { - enumerable: true, - get: function () { - return vegaScale.interpolateRange; - } -}); -Object.defineProperty(exports, 'quantizeInterpolator', { - enumerable: true, - get: function () { - return vegaScale.quantizeInterpolator; - } -}); -Object.defineProperty(exports, 'scale', { - enumerable: true, - get: function () { - return vegaScale.scale; - } -}); -Object.defineProperty(exports, 'scheme', { - enumerable: true, - get: function () { - return vegaScale.scheme; - } -}); -Object.defineProperty(exports, 'projection', { - enumerable: true, - get: function () { - return vegaProjection.projection; - } -}); -Object.defineProperty(exports, 'View', { - enumerable: true, - get: function () { - return vegaView.View; - } -}); -Object.defineProperty(exports, 'defaultLocale', { - enumerable: true, - get: function () { - return vegaFormat.defaultLocale; - } -}); -Object.defineProperty(exports, 'formatLocale', { - enumerable: true, - get: function () { - return vegaFormat.numberFormatDefaultLocale; - } -}); -Object.defineProperty(exports, 'locale', { - enumerable: true, - get: function () { - return vegaFormat.locale; - } -}); -Object.defineProperty(exports, 'resetDefaultLocale', { - enumerable: true, - get: function () { - return vegaFormat.resetDefaultLocale; - } -}); -Object.defineProperty(exports, 'timeFormatLocale', { - enumerable: true, - get: function () { - return vegaFormat.timeFormatDefaultLocale; - } -}); -Object.defineProperty(exports, 'expressionFunction', { - enumerable: true, - get: function () { - return vegaFunctions.expressionFunction; - } -}); -Object.defineProperty(exports, 'parse', { - enumerable: true, - get: function () { - return vegaParser.parse; - } -}); -Object.defineProperty(exports, 'runtimeContext', { - enumerable: true, - get: function () { - return vegaRuntime.context; - } -}); -exports.version = version; diff --git a/node_modules/vega/build/vega-schema.json b/node_modules/vega/build/vega-schema.json deleted file mode 100644 index 75c0993..0000000 --- a/node_modules/vega/build/vega-schema.json +++ /dev/null @@ -1,16250 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-06/schema#", - "title": "Vega Visualization Specification Language", - "defs": { - "autosize": { - "oneOf": [ - { - "enum": [ - "pad", - "fit", - "fit-x", - "fit-y", - "none" - ], - "default": "pad" - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "pad", - "fit", - "fit-x", - "fit-y", - "none" - ], - "default": "pad" - }, - "resize": { - "type": "boolean" - }, - "contains": { - "enum": [ - "content", - "padding" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "axis": { - "type": "object", - "properties": { - "orient": { - "oneOf": [ - { - "enum": [ - "top", - "bottom", - "left", - "right" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "scale": { - "type": "string" - }, - "format": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "year": { - "type": "string" - }, - "quarter": { - "type": "string" - }, - "month": { - "type": "string" - }, - "date": { - "type": "string" - }, - "week": { - "type": "string" - }, - "day": { - "type": "string" - }, - "hours": { - "type": "string" - }, - "minutes": { - "type": "string" - }, - "seconds": { - "type": "string" - }, - "milliseconds": { - "type": "string" - } - }, - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "formatType": { - "oneOf": [ - { - "enum": [ - "number", - "time", - "utc" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minExtent": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "maxExtent": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "offset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "position": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "bandPosition": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "translate": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "values": { - "$ref": "#/refs/arrayOrSignal" - }, - "zindex": { - "type": "number" - }, - "aria": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "title": { - "$ref": "#/refs/textOrSignal" - }, - "titlePadding": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleAlign": { - "oneOf": [ - { - "enum": [ - "left", - "right", - "center" - ] - }, - { - "$ref": "#/refs/alignValue" - } - ] - }, - "titleAnchor": { - "oneOf": [ - { - "enum": [ - null, - "start", - "middle", - "end" - ] - }, - { - "$ref": "#/refs/anchorValue" - } - ] - }, - "titleAngle": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleX": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleY": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleBaseline": { - "oneOf": [ - { - "enum": [ - "top", - "middle", - "bottom", - "alphabetic", - "line-top", - "line-bottom" - ] - }, - { - "$ref": "#/refs/baselineValue" - } - ] - }, - "titleColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "titleFont": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "titleFontSize": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleFontStyle": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "titleFontWeight": { - "oneOf": [ - { - "enum": [ - null, - "normal", - "bold", - "lighter", - "bolder", - "100", - "200", - "300", - "400", - "500", - "600", - "700", - "800", - "900", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ] - }, - { - "$ref": "#/refs/fontWeightValue" - } - ] - }, - "titleLimit": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleLineHeight": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleOpacity": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "domain": { - "type": "boolean" - }, - "domainCap": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "domainColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "domainDash": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "number" - } - }, - { - "$ref": "#/refs/arrayValue" - } - ] - }, - "domainDashOffset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "domainOpacity": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "domainWidth": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "ticks": { - "type": "boolean" - }, - "tickBand": { - "$ref": "#/refs/tickBand" - }, - "tickCap": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "tickColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "tickDash": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "number" - } - }, - { - "$ref": "#/refs/arrayValue" - } - ] - }, - "tickDashOffset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "tickOffset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "tickOpacity": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "tickRound": { - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/booleanValue" - } - ] - }, - "tickSize": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "tickWidth": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "tickCount": { - "$ref": "#/refs/tickCount" - }, - "tickExtra": { - "$ref": "#/refs/booleanOrSignal" - }, - "tickMinStep": { - "$ref": "#/refs/numberOrSignal" - }, - "grid": { - "type": "boolean" - }, - "gridScale": { - "type": "string" - }, - "gridCap": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "gridColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "gridDash": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "number" - } - }, - { - "$ref": "#/refs/arrayValue" - } - ] - }, - "gridDashOffset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "gridOpacity": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "gridWidth": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labels": { - "type": "boolean" - }, - "labelAlign": { - "oneOf": [ - { - "enum": [ - "left", - "right", - "center" - ] - }, - { - "$ref": "#/refs/alignValue" - } - ] - }, - "labelBaseline": { - "oneOf": [ - { - "enum": [ - "top", - "middle", - "bottom", - "alphabetic", - "line-top", - "line-bottom" - ] - }, - { - "$ref": "#/refs/baselineValue" - } - ] - }, - "labelBound": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "labelFlush": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "labelFlushOffset": { - "$ref": "#/refs/numberOrSignal" - }, - "labelOverlap": { - "$ref": "#/refs/labelOverlap" - }, - "labelAngle": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "labelFont": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "labelFontSize": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelFontWeight": { - "oneOf": [ - { - "enum": [ - null, - "normal", - "bold", - "lighter", - "bolder", - "100", - "200", - "300", - "400", - "500", - "600", - "700", - "800", - "900", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ] - }, - { - "$ref": "#/refs/fontWeightValue" - } - ] - }, - "labelFontStyle": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "labelLimit": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelLineHeight": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelOpacity": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelOffset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelPadding": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelSeparation": { - "$ref": "#/refs/numberOrSignal" - }, - "encode": { - "type": "object", - "properties": { - "axis": { - "$ref": "#/defs/guideEncode" - }, - "ticks": { - "$ref": "#/defs/guideEncode" - }, - "labels": { - "$ref": "#/defs/guideEncode" - }, - "title": { - "$ref": "#/defs/guideEncode" - }, - "grid": { - "$ref": "#/defs/guideEncode" - }, - "domain": { - "$ref": "#/defs/guideEncode" - } - }, - "additionalProperties": false - } - }, - "required": [ - "orient", - "scale" - ], - "additionalProperties": false - }, - "background": { - "$ref": "#/refs/stringOrSignal" - }, - "bind": { - "oneOf": [ - { - "type": "object", - "properties": { - "input": { - "enum": [ - "checkbox" - ] - }, - "element": { - "$ref": "#/refs/element" - }, - "debounce": { - "type": "number" - }, - "name": { - "type": "string" - } - }, - "required": [ - "input" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "input": { - "enum": [ - "radio", - "select" - ] - }, - "element": { - "$ref": "#/refs/element" - }, - "options": { - "type": "array" - }, - "labels": { - "type": "array", - "items": { - "type": "string" - } - }, - "debounce": { - "type": "number" - }, - "name": { - "type": "string" - } - }, - "required": [ - "input", - "options" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "input": { - "enum": [ - "range" - ] - }, - "element": { - "$ref": "#/refs/element" - }, - "min": { - "type": "number" - }, - "max": { - "type": "number" - }, - "step": { - "type": "number" - }, - "debounce": { - "type": "number" - }, - "name": { - "type": "string" - } - }, - "required": [ - "input" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "input": { - "not": { - "enum": [ - "checkbox", - "radio", - "range", - "select" - ] - } - }, - "element": { - "$ref": "#/refs/element" - }, - "debounce": { - "type": "number" - }, - "name": { - "type": "string" - } - }, - "required": [ - "input" - ], - "additionalProperties": true - } - ] - }, - "data": { - "oneOf": [ - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "transform": { - "type": "array", - "items": { - "$ref": "#/defs/transform" - } - }, - "on": { - "$ref": "#/defs/onTrigger" - } - }, - "required": [ - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "source": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1 - } - ] - }, - "name": { - "type": "string" - }, - "transform": { - "type": "array", - "items": { - "$ref": "#/defs/transform" - } - }, - "on": { - "$ref": "#/defs/onTrigger" - } - }, - "required": [ - "source", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "url": { - "$ref": "#/refs/stringOrSignal" - }, - "format": { - "oneOf": [ - { - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "$ref": "#/refs/stringOrSignal" - }, - "parse": { - "oneOf": [ - { - "enum": [ - "auto" - ] - }, - { - "type": "object", - "properties": {}, - "additionalProperties": { - "oneOf": [ - { - "enum": [ - "boolean", - "number", - "date", - "string" - ] - }, - { - "type": "string", - "pattern": "^(date|utc):.*$" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - } - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "json" - ] - }, - "parse": { - "oneOf": [ - { - "enum": [ - "auto" - ] - }, - { - "type": "object", - "properties": {}, - "additionalProperties": { - "oneOf": [ - { - "enum": [ - "boolean", - "number", - "date", - "string" - ] - }, - { - "type": "string", - "pattern": "^(date|utc):.*$" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "property": { - "$ref": "#/refs/stringOrSignal" - }, - "copy": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "csv", - "tsv" - ] - }, - "header": { - "type": "array", - "items": { - "type": "string" - } - }, - "parse": { - "oneOf": [ - { - "enum": [ - "auto" - ] - }, - { - "type": "object", - "properties": {}, - "additionalProperties": { - "oneOf": [ - { - "enum": [ - "boolean", - "number", - "date", - "string" - ] - }, - { - "type": "string", - "pattern": "^(date|utc):.*$" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "dsv" - ] - }, - "delimiter": { - "type": "string" - }, - "header": { - "type": "array", - "items": { - "type": "string" - } - }, - "parse": { - "oneOf": [ - { - "enum": [ - "auto" - ] - }, - { - "type": "object", - "properties": {}, - "additionalProperties": { - "oneOf": [ - { - "enum": [ - "boolean", - "number", - "date", - "string" - ] - }, - { - "type": "string", - "pattern": "^(date|utc):.*$" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type", - "delimiter" - ], - "additionalProperties": false - }, - { - "oneOf": [ - { - "type": "object", - "properties": { - "type": { - "enum": [ - "topojson" - ] - }, - "feature": { - "$ref": "#/refs/stringOrSignal" - }, - "property": { - "$ref": "#/refs/stringOrSignal" - } - }, - "required": [ - "type", - "feature" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "topojson" - ] - }, - "mesh": { - "$ref": "#/refs/stringOrSignal" - }, - "property": { - "$ref": "#/refs/stringOrSignal" - }, - "filter": { - "enum": [ - "interior", - "exterior", - null - ] - } - }, - "required": [ - "type", - "mesh" - ], - "additionalProperties": false - } - ] - } - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "async": { - "$ref": "#/refs/booleanOrSignal" - }, - "name": { - "type": "string" - }, - "transform": { - "type": "array", - "items": { - "$ref": "#/defs/transform" - } - }, - "on": { - "$ref": "#/defs/onTrigger" - } - }, - "required": [ - "url", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "values": { - "oneOf": [ - {}, - { - "$ref": "#/refs/signal" - } - ] - }, - "format": { - "oneOf": [ - { - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "$ref": "#/refs/stringOrSignal" - }, - "parse": { - "oneOf": [ - { - "enum": [ - "auto" - ] - }, - { - "type": "object", - "properties": {}, - "additionalProperties": { - "oneOf": [ - { - "enum": [ - "boolean", - "number", - "date", - "string" - ] - }, - { - "type": "string", - "pattern": "^(date|utc):.*$" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - } - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "json" - ] - }, - "parse": { - "oneOf": [ - { - "enum": [ - "auto" - ] - }, - { - "type": "object", - "properties": {}, - "additionalProperties": { - "oneOf": [ - { - "enum": [ - "boolean", - "number", - "date", - "string" - ] - }, - { - "type": "string", - "pattern": "^(date|utc):.*$" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "property": { - "$ref": "#/refs/stringOrSignal" - }, - "copy": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "csv", - "tsv" - ] - }, - "header": { - "type": "array", - "items": { - "type": "string" - } - }, - "parse": { - "oneOf": [ - { - "enum": [ - "auto" - ] - }, - { - "type": "object", - "properties": {}, - "additionalProperties": { - "oneOf": [ - { - "enum": [ - "boolean", - "number", - "date", - "string" - ] - }, - { - "type": "string", - "pattern": "^(date|utc):.*$" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "dsv" - ] - }, - "delimiter": { - "type": "string" - }, - "header": { - "type": "array", - "items": { - "type": "string" - } - }, - "parse": { - "oneOf": [ - { - "enum": [ - "auto" - ] - }, - { - "type": "object", - "properties": {}, - "additionalProperties": { - "oneOf": [ - { - "enum": [ - "boolean", - "number", - "date", - "string" - ] - }, - { - "type": "string", - "pattern": "^(date|utc):.*$" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type", - "delimiter" - ], - "additionalProperties": false - }, - { - "oneOf": [ - { - "type": "object", - "properties": { - "type": { - "enum": [ - "topojson" - ] - }, - "feature": { - "$ref": "#/refs/stringOrSignal" - }, - "property": { - "$ref": "#/refs/stringOrSignal" - } - }, - "required": [ - "type", - "feature" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "topojson" - ] - }, - "mesh": { - "$ref": "#/refs/stringOrSignal" - }, - "property": { - "$ref": "#/refs/stringOrSignal" - }, - "filter": { - "enum": [ - "interior", - "exterior", - null - ] - } - }, - "required": [ - "type", - "mesh" - ], - "additionalProperties": false - } - ] - } - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "async": { - "$ref": "#/refs/booleanOrSignal" - }, - "name": { - "type": "string" - }, - "transform": { - "type": "array", - "items": { - "$ref": "#/defs/transform" - } - }, - "on": { - "$ref": "#/defs/onTrigger" - } - }, - "required": [ - "values", - "name" - ], - "additionalProperties": false - } - ] - }, - "rule": { - "type": "object", - "properties": { - "test": { - "type": "string" - } - } - }, - "encodeEntry": { - "type": "object", - "properties": { - "x": { - "$ref": "#/refs/numberValue" - }, - "x2": { - "$ref": "#/refs/numberValue" - }, - "xc": { - "$ref": "#/refs/numberValue" - }, - "width": { - "$ref": "#/refs/numberValue" - }, - "y": { - "$ref": "#/refs/numberValue" - }, - "y2": { - "$ref": "#/refs/numberValue" - }, - "yc": { - "$ref": "#/refs/numberValue" - }, - "height": { - "$ref": "#/refs/numberValue" - }, - "opacity": { - "$ref": "#/refs/numberValue" - }, - "fill": { - "$ref": "#/refs/colorValue" - }, - "fillOpacity": { - "$ref": "#/refs/numberValue" - }, - "stroke": { - "$ref": "#/refs/colorValue" - }, - "strokeOpacity": { - "$ref": "#/refs/numberValue" - }, - "strokeWidth": { - "$ref": "#/refs/numberValue" - }, - "strokeCap": { - "$ref": "#/refs/strokeCapValue" - }, - "strokeDash": { - "$ref": "#/refs/arrayValue" - }, - "strokeDashOffset": { - "$ref": "#/refs/numberValue" - }, - "strokeJoin": { - "$ref": "#/refs/strokeJoinValue" - }, - "strokeMiterLimit": { - "$ref": "#/refs/numberValue" - }, - "blend": { - "$ref": "#/refs/blendValue" - }, - "cursor": { - "$ref": "#/refs/stringValue" - }, - "tooltip": { - "$ref": "#/refs/anyValue" - }, - "zindex": { - "$ref": "#/refs/numberValue" - }, - "description": { - "$ref": "#/refs/stringValue" - }, - "aria": { - "$ref": "#/refs/booleanValue" - }, - "ariaRole": { - "$ref": "#/refs/stringValue" - }, - "ariaRoleDescription": { - "$ref": "#/refs/stringValue" - }, - "clip": { - "$ref": "#/refs/booleanValue" - }, - "strokeForeground": { - "$ref": "#/refs/booleanValue" - }, - "strokeOffset": { - "$ref": "#/refs/numberValue" - }, - "cornerRadius": { - "$ref": "#/refs/numberValue" - }, - "cornerRadiusTopLeft": { - "$ref": "#/refs/numberValue" - }, - "cornerRadiusTopRight": { - "$ref": "#/refs/numberValue" - }, - "cornerRadiusBottomRight": { - "$ref": "#/refs/numberValue" - }, - "cornerRadiusBottomLeft": { - "$ref": "#/refs/numberValue" - }, - "angle": { - "$ref": "#/refs/numberValue" - }, - "size": { - "$ref": "#/refs/numberValue" - }, - "shape": { - "$ref": "#/refs/stringValue" - }, - "path": { - "$ref": "#/refs/stringValue" - }, - "scaleX": { - "$ref": "#/refs/numberValue" - }, - "scaleY": { - "$ref": "#/refs/numberValue" - }, - "innerRadius": { - "$ref": "#/refs/numberValue" - }, - "outerRadius": { - "$ref": "#/refs/numberValue" - }, - "startAngle": { - "$ref": "#/refs/numberValue" - }, - "endAngle": { - "$ref": "#/refs/numberValue" - }, - "padAngle": { - "$ref": "#/refs/numberValue" - }, - "interpolate": { - "$ref": "#/refs/stringValue" - }, - "tension": { - "$ref": "#/refs/numberValue" - }, - "orient": { - "$ref": "#/refs/directionValue" - }, - "defined": { - "$ref": "#/refs/booleanValue" - }, - "url": { - "$ref": "#/refs/stringValue" - }, - "align": { - "$ref": "#/refs/alignValue" - }, - "baseline": { - "$ref": "#/refs/baselineValue" - }, - "aspect": { - "$ref": "#/refs/booleanValue" - }, - "smooth": { - "$ref": "#/refs/booleanValue" - }, - "text": { - "$ref": "#/refs/textValue" - }, - "dir": { - "$ref": "#/refs/stringValue" - }, - "ellipsis": { - "$ref": "#/refs/stringValue" - }, - "limit": { - "$ref": "#/refs/numberValue" - }, - "lineBreak": { - "$ref": "#/refs/stringValue" - }, - "lineHeight": { - "$ref": "#/refs/numberValue" - }, - "dx": { - "$ref": "#/refs/numberValue" - }, - "dy": { - "$ref": "#/refs/numberValue" - }, - "radius": { - "$ref": "#/refs/numberValue" - }, - "theta": { - "$ref": "#/refs/numberValue" - }, - "font": { - "$ref": "#/refs/stringValue" - }, - "fontSize": { - "$ref": "#/refs/numberValue" - }, - "fontWeight": { - "$ref": "#/refs/fontWeightValue" - }, - "fontStyle": { - "$ref": "#/refs/stringValue" - } - }, - "additionalProperties": true - }, - "encode": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^.+$": { - "$ref": "#/defs/encodeEntry" - } - } - }, - "layout": { - "oneOf": [ - { - "type": "object", - "properties": { - "align": { - "oneOf": [ - { - "oneOf": [ - { - "enum": [ - "all", - "each", - "none" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - { - "type": "object", - "properties": { - "row": { - "oneOf": [ - { - "enum": [ - "all", - "each", - "none" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "column": { - "oneOf": [ - { - "enum": [ - "all", - "each", - "none" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "additionalProperties": false - } - ] - }, - "bounds": { - "oneOf": [ - { - "enum": [ - "full", - "flush" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "center": { - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "row": { - "$ref": "#/refs/booleanOrSignal" - }, - "column": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "additionalProperties": false - } - ] - }, - "columns": { - "$ref": "#/refs/numberOrSignal" - }, - "padding": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "row": { - "$ref": "#/refs/numberOrSignal" - }, - "column": { - "$ref": "#/refs/numberOrSignal" - } - }, - "additionalProperties": false - } - ] - }, - "offset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "rowHeader": { - "$ref": "#/refs/numberOrSignal" - }, - "rowFooter": { - "$ref": "#/refs/numberOrSignal" - }, - "rowTitle": { - "$ref": "#/refs/numberOrSignal" - }, - "columnHeader": { - "$ref": "#/refs/numberOrSignal" - }, - "columnFooter": { - "$ref": "#/refs/numberOrSignal" - }, - "columnTitle": { - "$ref": "#/refs/numberOrSignal" - } - }, - "additionalProperties": false - } - ] - }, - "headerBand": { - "oneOf": [ - { - "$ref": "#/refs/numberOrSignal" - }, - { - "type": "null" - }, - { - "type": "object", - "properties": { - "row": { - "$ref": "#/refs/numberOrSignal" - }, - "column": { - "$ref": "#/refs/numberOrSignal" - } - }, - "additionalProperties": false - } - ] - }, - "footerBand": { - "oneOf": [ - { - "$ref": "#/refs/numberOrSignal" - }, - { - "type": "null" - }, - { - "type": "object", - "properties": { - "row": { - "$ref": "#/refs/numberOrSignal" - }, - "column": { - "$ref": "#/refs/numberOrSignal" - } - }, - "additionalProperties": false - } - ] - }, - "titleBand": { - "oneOf": [ - { - "$ref": "#/refs/numberOrSignal" - }, - { - "type": "null" - }, - { - "type": "object", - "properties": { - "row": { - "$ref": "#/refs/numberOrSignal" - }, - "column": { - "$ref": "#/refs/numberOrSignal" - } - }, - "additionalProperties": false - } - ] - }, - "titleAnchor": { - "oneOf": [ - { - "oneOf": [ - { - "enum": [ - "start", - "end" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - { - "type": "object", - "properties": { - "row": { - "oneOf": [ - { - "enum": [ - "start", - "end" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "column": { - "oneOf": [ - { - "enum": [ - "start", - "end" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "additionalProperties": false - } - ] - } - }, - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "guideEncode": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "interactive": { - "type": "boolean", - "default": false - }, - "style": { - "$ref": "#/refs/style" - } - }, - "additionalProperties": false, - "patternProperties": { - "^(?!interactive|name|style).+$": { - "$ref": "#/defs/encodeEntry" - } - } - }, - "legend": { - "allOf": [ - { - "type": "object", - "properties": { - "size": { - "type": "string" - }, - "shape": { - "type": "string" - }, - "fill": { - "type": "string" - }, - "stroke": { - "type": "string" - }, - "opacity": { - "type": "string" - }, - "strokeDash": { - "type": "string" - }, - "strokeWidth": { - "type": "string" - }, - "type": { - "enum": [ - "gradient", - "symbol" - ] - }, - "direction": { - "enum": [ - "vertical", - "horizontal" - ] - }, - "orient": { - "oneOf": [ - { - "enum": [ - "none", - "left", - "right", - "top", - "bottom", - "top-left", - "top-right", - "bottom-left", - "bottom-right" - ], - "default": "right" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "tickCount": { - "$ref": "#/refs/tickCount" - }, - "tickMinStep": { - "$ref": "#/refs/numberOrSignal" - }, - "symbolLimit": { - "$ref": "#/refs/numberOrSignal" - }, - "values": { - "$ref": "#/refs/arrayOrSignal" - }, - "zindex": { - "type": "number" - }, - "aria": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "cornerRadius": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "fillColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "offset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "padding": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "strokeColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "legendX": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "legendY": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "title": { - "$ref": "#/refs/textOrSignal" - }, - "titleAlign": { - "oneOf": [ - { - "enum": [ - "left", - "right", - "center" - ] - }, - { - "$ref": "#/refs/alignValue" - } - ] - }, - "titleAnchor": { - "oneOf": [ - { - "enum": [ - null, - "start", - "middle", - "end" - ] - }, - { - "$ref": "#/refs/anchorValue" - } - ] - }, - "titleBaseline": { - "oneOf": [ - { - "enum": [ - "top", - "middle", - "bottom", - "alphabetic", - "line-top", - "line-bottom" - ] - }, - { - "$ref": "#/refs/baselineValue" - } - ] - }, - "titleColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "titleFont": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "titleFontSize": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleFontStyle": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "titleFontWeight": { - "oneOf": [ - { - "enum": [ - null, - "normal", - "bold", - "lighter", - "bolder", - "100", - "200", - "300", - "400", - "500", - "600", - "700", - "800", - "900", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ] - }, - { - "$ref": "#/refs/fontWeightValue" - } - ] - }, - "titleLimit": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleLineHeight": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleOpacity": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "titleOrient": { - "oneOf": [ - { - "enum": [ - "left", - "right", - "top", - "bottom" - ] - }, - { - "$ref": "#/refs/orientValue" - } - ] - }, - "titlePadding": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "gradientLength": { - "$ref": "#/refs/numberOrSignal" - }, - "gradientOpacity": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "gradientStrokeColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "gradientStrokeWidth": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "gradientThickness": { - "$ref": "#/refs/numberOrSignal" - }, - "clipHeight": { - "$ref": "#/refs/numberOrSignal" - }, - "columns": { - "$ref": "#/refs/numberOrSignal" - }, - "columnPadding": { - "$ref": "#/refs/numberOrSignal" - }, - "rowPadding": { - "$ref": "#/refs/numberOrSignal" - }, - "gridAlign": { - "oneOf": [ - { - "enum": [ - "all", - "each", - "none" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "symbolDash": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "number" - } - }, - { - "$ref": "#/refs/arrayValue" - } - ] - }, - "symbolDashOffset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "symbolFillColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "symbolOffset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "symbolOpacity": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "symbolSize": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "symbolStrokeColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "symbolStrokeWidth": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "symbolType": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "format": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "year": { - "type": "string" - }, - "quarter": { - "type": "string" - }, - "month": { - "type": "string" - }, - "date": { - "type": "string" - }, - "week": { - "type": "string" - }, - "day": { - "type": "string" - }, - "hours": { - "type": "string" - }, - "minutes": { - "type": "string" - }, - "seconds": { - "type": "string" - }, - "milliseconds": { - "type": "string" - } - }, - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "formatType": { - "oneOf": [ - { - "enum": [ - "number", - "time", - "utc" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "labelAlign": { - "oneOf": [ - { - "enum": [ - "left", - "right", - "center" - ] - }, - { - "$ref": "#/refs/alignValue" - } - ] - }, - "labelBaseline": { - "oneOf": [ - { - "enum": [ - "top", - "middle", - "bottom", - "alphabetic", - "line-top", - "line-bottom" - ] - }, - { - "$ref": "#/refs/baselineValue" - } - ] - }, - "labelColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "labelFont": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "labelFontSize": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelFontStyle": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "labelFontWeight": { - "oneOf": [ - { - "enum": [ - null, - "normal", - "bold", - "lighter", - "bolder", - "100", - "200", - "300", - "400", - "500", - "600", - "700", - "800", - "900", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ] - }, - { - "$ref": "#/refs/fontWeightValue" - } - ] - }, - "labelLimit": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelOffset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelOpacity": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "labelOverlap": { - "$ref": "#/refs/labelOverlap" - }, - "labelSeparation": { - "$ref": "#/refs/numberOrSignal" - }, - "encode": { - "type": "object", - "properties": { - "title": { - "$ref": "#/defs/guideEncode" - }, - "labels": { - "$ref": "#/defs/guideEncode" - }, - "legend": { - "$ref": "#/defs/guideEncode" - }, - "entries": { - "$ref": "#/defs/guideEncode" - }, - "symbols": { - "$ref": "#/defs/guideEncode" - }, - "gradient": { - "$ref": "#/defs/guideEncode" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "anyOf": [ - { - "type": "object", - "required": [ - "size" - ] - }, - { - "type": "object", - "required": [ - "shape" - ] - }, - { - "type": "object", - "required": [ - "fill" - ] - }, - { - "type": "object", - "required": [ - "stroke" - ] - }, - { - "type": "object", - "required": [ - "opacity" - ] - }, - { - "type": "object", - "required": [ - "strokeDash" - ] - }, - { - "type": "object", - "required": [ - "strokeWidth" - ] - } - ] - } - ] - }, - "mark": { - "type": "object", - "properties": { - "type": { - "$ref": "#/refs/marktype" - }, - "role": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "aria": { - "type": "boolean" - }, - "style": { - "$ref": "#/refs/style" - }, - "key": { - "type": "string" - }, - "clip": { - "$ref": "#/refs/markclip" - }, - "sort": { - "$ref": "#/refs/compare" - }, - "interactive": { - "$ref": "#/refs/booleanOrSignal" - }, - "encode": { - "$ref": "#/defs/encode" - }, - "transform": { - "type": "array", - "items": { - "$ref": "#/defs/transformMark" - } - }, - "on": { - "$ref": "#/defs/onMarkTrigger" - } - }, - "required": [ - "type" - ] - }, - "markGroup": { - "allOf": [ - { - "type": "object", - "properties": { - "type": { - "enum": [ - "group" - ] - }, - "from": { - "oneOf": [ - { - "$ref": "#/refs/from" - }, - { - "$ref": "#/refs/facet" - } - ] - } - }, - "required": [ - "type" - ] - }, - { - "$ref": "#/defs/mark" - }, - { - "$ref": "#/defs/scope" - } - ] - }, - "markVisual": { - "allOf": [ - { - "type": "object", - "properties": { - "type": { - "not": { - "enum": [ - "group" - ] - } - }, - "from": { - "$ref": "#/refs/from" - } - } - }, - { - "$ref": "#/defs/mark" - } - ] - }, - "listener": { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "scale": { - "type": "string" - } - }, - "required": [ - "scale" - ] - }, - { - "$ref": "#/defs/stream" - } - ] - }, - "onEvents": { - "type": "array", - "items": { - "allOf": [ - { - "type": "object", - "properties": { - "events": { - "oneOf": [ - { - "$ref": "#/refs/selector" - }, - { - "$ref": "#/defs/listener" - }, - { - "type": "array", - "items": { - "$ref": "#/defs/listener" - }, - "minItems": 1 - } - ] - }, - "force": { - "type": "boolean" - } - }, - "required": [ - "events" - ] - }, - { - "oneOf": [ - { - "type": "object", - "properties": { - "encode": { - "type": "string" - } - }, - "required": [ - "encode" - ] - }, - { - "type": "object", - "properties": { - "update": { - "oneOf": [ - { - "$ref": "#/refs/exprString" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": {} - }, - "required": [ - "value" - ] - } - ] - } - }, - "required": [ - "update" - ] - } - ] - } - ] - } - }, - "onTrigger": { - "type": "array", - "items": { - "type": "object", - "properties": { - "trigger": { - "$ref": "#/refs/exprString" - }, - "insert": { - "$ref": "#/refs/exprString" - }, - "remove": { - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/exprString" - } - ] - }, - "toggle": { - "$ref": "#/refs/exprString" - }, - "modify": { - "$ref": "#/refs/exprString" - }, - "values": { - "$ref": "#/refs/exprString" - } - }, - "required": [ - "trigger" - ], - "additionalProperties": false - } - }, - "onMarkTrigger": { - "type": "array", - "items": { - "type": "object", - "properties": { - "trigger": { - "$ref": "#/refs/exprString" - }, - "modify": { - "$ref": "#/refs/exprString" - }, - "values": { - "$ref": "#/refs/exprString" - } - }, - "required": [ - "trigger" - ], - "additionalProperties": false - } - }, - "padding": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "object", - "properties": { - "top": { - "type": "number" - }, - "bottom": { - "type": "number" - }, - "left": { - "type": "number" - }, - "right": { - "type": "number" - } - }, - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "projection": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "$ref": "#/refs/stringOrSignal" - }, - "clipAngle": { - "$ref": "#/refs/numberOrSignal" - }, - "clipExtent": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "scale": { - "$ref": "#/refs/numberOrSignal" - }, - "translate": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "center": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "rotate": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "minItems": 2, - "maxItems": 3 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "parallels": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "precision": { - "$ref": "#/refs/numberOrSignal" - }, - "pointRadius": { - "$ref": "#/refs/numberOrSignal" - }, - "fit": { - "oneOf": [ - { - "type": "object" - }, - { - "type": "array" - } - ] - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "name" - ], - "additionalProperties": true - }, - "scale": { - "oneOf": [ - { - "type": "object", - "properties": { - "type": { - "enum": [ - "identity" - ] - }, - "nice": { - "$ref": "#/refs/booleanOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "ordinal" - ] - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "scheme": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "$ref": "#/refs/numberOrSignal" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "numItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "scheme" - ], - "additionalProperties": false - }, - { - "oneOf": [ - { - "type": "object", - "properties": { - "data": { - "type": "string" - }, - "field": { - "$ref": "#/refs/stringOrSignal" - }, - "sort": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/stringOrSignal" - }, - "op": { - "$ref": "#/refs/stringOrSignal" - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "additionalProperties": false - } - ] - } - }, - "required": [ - "data", - "field" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "data": { - "type": "string" - }, - "fields": { - "type": "array", - "items": { - "$ref": "#/refs/stringOrSignal" - }, - "minItems": 1 - }, - "sort": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "properties": { - "op": { - "enum": [ - "count" - ] - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/stringOrSignal" - }, - "op": { - "enum": [ - "count", - "min", - "max" - ] - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "required": [ - "field", - "op" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "data", - "fields" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "fields": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "data": { - "type": "string" - }, - "field": { - "$ref": "#/refs/stringOrSignal" - } - }, - "required": [ - "data", - "field" - ], - "additionalProperties": false - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 1 - }, - "sort": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "properties": { - "op": { - "enum": [ - "count" - ] - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/stringOrSignal" - }, - "op": { - "enum": [ - "count", - "min", - "max" - ] - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "required": [ - "field", - "op" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "fields" - ], - "additionalProperties": false - } - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "interpolate": { - "$ref": "#/refs/scaleInterpolate" - }, - "domainImplicit": { - "$ref": "#/refs/booleanOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "band" - ] - }, - "paddingInner": { - "$ref": "#/refs/numberOrSignal" - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "step": { - "$ref": "#/refs/numberOrSignal" - } - }, - "required": [ - "step" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "padding": { - "$ref": "#/refs/numberOrSignal" - }, - "paddingOuter": { - "$ref": "#/refs/numberOrSignal" - }, - "align": { - "$ref": "#/refs/numberOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "point" - ] - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "step": { - "$ref": "#/refs/numberOrSignal" - } - }, - "required": [ - "step" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "padding": { - "$ref": "#/refs/numberOrSignal" - }, - "paddingOuter": { - "$ref": "#/refs/numberOrSignal" - }, - "align": { - "$ref": "#/refs/numberOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "quantize", - "threshold" - ] - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "scheme": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "$ref": "#/refs/numberOrSignal" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "numItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "scheme" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "interpolate": { - "$ref": "#/refs/scaleInterpolate" - }, - "nice": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "zero": { - "$ref": "#/refs/booleanOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "quantile" - ] - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "scheme": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "$ref": "#/refs/numberOrSignal" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "numItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "scheme" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "interpolate": { - "$ref": "#/refs/scaleInterpolate" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "bin-ordinal" - ] - }, - "bins": { - "$ref": "#/refs/scaleBins" - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "scheme": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "$ref": "#/refs/numberOrSignal" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "numItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "scheme" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "interpolate": { - "$ref": "#/refs/scaleInterpolate" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "time", - "utc" - ] - }, - "nice": { - "oneOf": [ - { - "type": "boolean" - }, - { - "enum": [ - "millisecond", - "second", - "minute", - "hour", - "day", - "week", - "month", - "year" - ] - }, - { - "type": "object", - "properties": { - "interval": { - "oneOf": [ - { - "enum": [ - "millisecond", - "second", - "minute", - "hour", - "day", - "week", - "month", - "year" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "step": { - "$ref": "#/refs/numberOrSignal" - } - }, - "required": [ - "interval" - ], - "additionalProperties": false - } - ] - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "scheme": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "$ref": "#/refs/numberOrSignal" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "numItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "scheme" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "bins": { - "$ref": "#/refs/scaleBins" - }, - "interpolate": { - "$ref": "#/refs/scaleInterpolate" - }, - "clamp": { - "$ref": "#/refs/booleanOrSignal" - }, - "padding": { - "$ref": "#/refs/numberOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "linear", - "sqrt", - "sequential" - ] - }, - "nice": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "zero": { - "$ref": "#/refs/booleanOrSignal" - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "scheme": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "$ref": "#/refs/numberOrSignal" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "numItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "scheme" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "bins": { - "$ref": "#/refs/scaleBins" - }, - "interpolate": { - "$ref": "#/refs/scaleInterpolate" - }, - "clamp": { - "$ref": "#/refs/booleanOrSignal" - }, - "padding": { - "$ref": "#/refs/numberOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "log" - ] - }, - "base": { - "$ref": "#/refs/numberOrSignal" - }, - "nice": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "zero": { - "$ref": "#/refs/booleanOrSignal" - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "scheme": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "$ref": "#/refs/numberOrSignal" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "numItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "scheme" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "bins": { - "$ref": "#/refs/scaleBins" - }, - "interpolate": { - "$ref": "#/refs/scaleInterpolate" - }, - "clamp": { - "$ref": "#/refs/booleanOrSignal" - }, - "padding": { - "$ref": "#/refs/numberOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "pow" - ] - }, - "exponent": { - "$ref": "#/refs/numberOrSignal" - }, - "nice": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "zero": { - "$ref": "#/refs/booleanOrSignal" - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "scheme": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "$ref": "#/refs/numberOrSignal" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "numItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "scheme" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "bins": { - "$ref": "#/refs/scaleBins" - }, - "interpolate": { - "$ref": "#/refs/scaleInterpolate" - }, - "clamp": { - "$ref": "#/refs/booleanOrSignal" - }, - "padding": { - "$ref": "#/refs/numberOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { - "enum": [ - "symlog" - ] - }, - "constant": { - "$ref": "#/refs/numberOrSignal" - }, - "nice": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "zero": { - "$ref": "#/refs/booleanOrSignal" - }, - "range": { - "oneOf": [ - { - "enum": [ - "width", - "height", - "symbol", - "category", - "ordinal", - "ramp", - "diverging", - "heatmap" - ] - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "type": "object", - "properties": { - "scheme": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "$ref": "#/refs/numberOrSignal" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - }, - "numItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "scheme" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "bins": { - "$ref": "#/refs/scaleBins" - }, - "interpolate": { - "$ref": "#/refs/scaleInterpolate" - }, - "clamp": { - "$ref": "#/refs/booleanOrSignal" - }, - "padding": { - "$ref": "#/refs/numberOrSignal" - }, - "name": { - "type": "string" - }, - "domain": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - } - ] - } - }, - { - "$ref": "#/refs/scaleData" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "domainMin": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMax": { - "$ref": "#/refs/numberOrSignal" - }, - "domainMid": { - "$ref": "#/refs/numberOrSignal" - }, - "domainRaw": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "reverse": { - "$ref": "#/refs/booleanOrSignal" - }, - "round": { - "$ref": "#/refs/booleanOrSignal" - } - }, - "required": [ - "type", - "name" - ], - "additionalProperties": false - } - ] - }, - "scope": { - "type": "object", - "properties": { - "encode": { - "$ref": "#/defs/encode" - }, - "layout": { - "$ref": "#/defs/layout" - }, - "signals": { - "type": "array", - "items": { - "$ref": "#/defs/signal" - } - }, - "data": { - "type": "array", - "items": { - "$ref": "#/defs/data" - } - }, - "scales": { - "type": "array", - "items": { - "$ref": "#/defs/scale" - } - }, - "projections": { - "type": "array", - "items": { - "$ref": "#/defs/projection" - } - }, - "axes": { - "type": "array", - "items": { - "$ref": "#/defs/axis" - } - }, - "legends": { - "type": "array", - "items": { - "$ref": "#/defs/legend" - } - }, - "title": { - "$ref": "#/defs/title" - }, - "marks": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/defs/markGroup" - }, - { - "$ref": "#/defs/markVisual" - } - ] - } - }, - "usermeta": { - "type": "object" - } - } - }, - "signalName": { - "type": "string", - "not": { - "enum": [ - "parent", - "datum", - "event", - "item" - ] - } - }, - "signal": { - "oneOf": [ - { - "type": "object", - "properties": { - "name": { - "$ref": "#/defs/signalName" - }, - "description": { - "type": "string" - }, - "push": { - "enum": [ - "outer" - ] - }, - "on": { - "$ref": "#/defs/onEvents" - } - }, - "required": [ - "name", - "push" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "name": { - "$ref": "#/defs/signalName" - }, - "description": { - "type": "string" - }, - "value": {}, - "react": { - "type": "boolean", - "default": true - }, - "update": { - "$ref": "#/refs/exprString" - }, - "on": { - "$ref": "#/defs/onEvents" - }, - "bind": { - "$ref": "#/defs/bind" - } - }, - "required": [ - "name" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "name": { - "$ref": "#/defs/signalName" - }, - "description": { - "type": "string" - }, - "value": {}, - "init": { - "$ref": "#/refs/exprString" - }, - "on": { - "$ref": "#/defs/onEvents" - }, - "bind": { - "$ref": "#/defs/bind" - } - }, - "required": [ - "name", - "init" - ], - "additionalProperties": false - } - ] - }, - "stream": { - "allOf": [ - { - "type": "object", - "properties": { - "between": { - "type": "array", - "items": { - "$ref": "#/defs/stream" - }, - "minItems": 2, - "maxItems": 2 - }, - "marktype": { - "type": "string" - }, - "markname": { - "type": "string" - }, - "filter": { - "oneOf": [ - { - "$ref": "#/refs/exprString" - }, - { - "type": "array", - "items": { - "$ref": "#/refs/exprString" - }, - "minItems": 1 - } - ] - }, - "throttle": { - "type": "number" - }, - "debounce": { - "type": "number" - }, - "consume": { - "type": "boolean" - } - } - }, - { - "oneOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "source": { - "type": "string" - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "stream": { - "$ref": "#/defs/stream" - } - }, - "required": [ - "stream" - ] - }, - { - "type": "object", - "properties": { - "merge": { - "type": "array", - "items": { - "$ref": "#/defs/stream" - }, - "minItems": 1 - } - }, - "required": [ - "merge" - ] - } - ] - } - ] - }, - "title": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "orient": { - "oneOf": [ - { - "enum": [ - "none", - "left", - "right", - "top", - "bottom" - ], - "default": "top" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "anchor": { - "oneOf": [ - { - "enum": [ - null, - "start", - "middle", - "end" - ] - }, - { - "$ref": "#/refs/anchorValue" - } - ] - }, - "frame": { - "oneOf": [ - { - "enum": [ - "group", - "bounds" - ] - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "offset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "aria": { - "type": "boolean" - }, - "limit": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "zindex": { - "type": "number" - }, - "align": { - "oneOf": [ - { - "enum": [ - "left", - "right", - "center" - ] - }, - { - "$ref": "#/refs/alignValue" - } - ] - }, - "angle": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "baseline": { - "oneOf": [ - { - "enum": [ - "top", - "middle", - "bottom", - "alphabetic", - "line-top", - "line-bottom" - ] - }, - { - "$ref": "#/refs/baselineValue" - } - ] - }, - "dx": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "dy": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "text": { - "$ref": "#/refs/textOrSignal" - }, - "color": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "font": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "fontSize": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "fontStyle": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "fontWeight": { - "oneOf": [ - { - "enum": [ - null, - "normal", - "bold", - "lighter", - "bolder", - "100", - "200", - "300", - "400", - "500", - "600", - "700", - "800", - "900", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ] - }, - { - "$ref": "#/refs/fontWeightValue" - } - ] - }, - "lineHeight": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "subtitle": { - "$ref": "#/refs/textOrSignal" - }, - "subtitleColor": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/colorValue" - } - ] - }, - "subtitleFont": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "subtitleFontSize": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "subtitleFontStyle": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/stringValue" - } - ] - }, - "subtitleFontWeight": { - "oneOf": [ - { - "enum": [ - null, - "normal", - "bold", - "lighter", - "bolder", - "100", - "200", - "300", - "400", - "500", - "600", - "700", - "800", - "900", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ] - }, - { - "$ref": "#/refs/fontWeightValue" - } - ] - }, - "subtitleLineHeight": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "subtitlePadding": { - "$ref": "#/refs/numberOrSignal" - }, - "encode": { - "anyOf": [ - { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^(?!interactive|name|style).+$": { - "$ref": "#/defs/encodeEntry" - } - } - }, - { - "type": "object", - "properties": { - "group": { - "$ref": "#/defs/guideEncode" - }, - "title": { - "$ref": "#/defs/guideEncode" - }, - "subtitle": { - "$ref": "#/defs/guideEncode" - } - }, - "additionalProperties": false - } - ] - }, - "name": { - "type": "string" - }, - "interactive": { - "type": "boolean" - }, - "style": { - "$ref": "#/refs/style" - } - }, - "additionalProperties": false - } - ] - }, - "transform": { - "oneOf": [ - { - "$ref": "#/defs/crossfilterTransform" - }, - { - "$ref": "#/defs/resolvefilterTransform" - }, - { - "$ref": "#/defs/linkpathTransform" - }, - { - "$ref": "#/defs/pieTransform" - }, - { - "$ref": "#/defs/stackTransform" - }, - { - "$ref": "#/defs/forceTransform" - }, - { - "$ref": "#/defs/contourTransform" - }, - { - "$ref": "#/defs/geojsonTransform" - }, - { - "$ref": "#/defs/geopathTransform" - }, - { - "$ref": "#/defs/geopointTransform" - }, - { - "$ref": "#/defs/geoshapeTransform" - }, - { - "$ref": "#/defs/graticuleTransform" - }, - { - "$ref": "#/defs/heatmapTransform" - }, - { - "$ref": "#/defs/isocontourTransform" - }, - { - "$ref": "#/defs/kde2dTransform" - }, - { - "$ref": "#/defs/nestTransform" - }, - { - "$ref": "#/defs/packTransform" - }, - { - "$ref": "#/defs/partitionTransform" - }, - { - "$ref": "#/defs/stratifyTransform" - }, - { - "$ref": "#/defs/treeTransform" - }, - { - "$ref": "#/defs/treelinksTransform" - }, - { - "$ref": "#/defs/treemapTransform" - }, - { - "$ref": "#/defs/labelTransform" - }, - { - "$ref": "#/defs/loessTransform" - }, - { - "$ref": "#/defs/regressionTransform" - }, - { - "$ref": "#/defs/aggregateTransform" - }, - { - "$ref": "#/defs/binTransform" - }, - { - "$ref": "#/defs/collectTransform" - }, - { - "$ref": "#/defs/countpatternTransform" - }, - { - "$ref": "#/defs/crossTransform" - }, - { - "$ref": "#/defs/densityTransform" - }, - { - "$ref": "#/defs/dotbinTransform" - }, - { - "$ref": "#/defs/extentTransform" - }, - { - "$ref": "#/defs/filterTransform" - }, - { - "$ref": "#/defs/flattenTransform" - }, - { - "$ref": "#/defs/foldTransform" - }, - { - "$ref": "#/defs/formulaTransform" - }, - { - "$ref": "#/defs/imputeTransform" - }, - { - "$ref": "#/defs/joinaggregateTransform" - }, - { - "$ref": "#/defs/kdeTransform" - }, - { - "$ref": "#/defs/lookupTransform" - }, - { - "$ref": "#/defs/pivotTransform" - }, - { - "$ref": "#/defs/projectTransform" - }, - { - "$ref": "#/defs/quantileTransform" - }, - { - "$ref": "#/defs/sampleTransform" - }, - { - "$ref": "#/defs/sequenceTransform" - }, - { - "$ref": "#/defs/timeunitTransform" - }, - { - "$ref": "#/defs/windowTransform" - }, - { - "$ref": "#/defs/identifierTransform" - }, - { - "$ref": "#/defs/voronoiTransform" - }, - { - "$ref": "#/defs/wordcloudTransform" - } - ] - }, - "transformMark": { - "oneOf": [ - { - "$ref": "#/defs/crossfilterTransform" - }, - { - "$ref": "#/defs/resolvefilterTransform" - }, - { - "$ref": "#/defs/linkpathTransform" - }, - { - "$ref": "#/defs/pieTransform" - }, - { - "$ref": "#/defs/stackTransform" - }, - { - "$ref": "#/defs/forceTransform" - }, - { - "$ref": "#/defs/geojsonTransform" - }, - { - "$ref": "#/defs/geopathTransform" - }, - { - "$ref": "#/defs/geopointTransform" - }, - { - "$ref": "#/defs/geoshapeTransform" - }, - { - "$ref": "#/defs/heatmapTransform" - }, - { - "$ref": "#/defs/packTransform" - }, - { - "$ref": "#/defs/partitionTransform" - }, - { - "$ref": "#/defs/stratifyTransform" - }, - { - "$ref": "#/defs/treeTransform" - }, - { - "$ref": "#/defs/treemapTransform" - }, - { - "$ref": "#/defs/labelTransform" - }, - { - "$ref": "#/defs/binTransform" - }, - { - "$ref": "#/defs/collectTransform" - }, - { - "$ref": "#/defs/dotbinTransform" - }, - { - "$ref": "#/defs/extentTransform" - }, - { - "$ref": "#/defs/formulaTransform" - }, - { - "$ref": "#/defs/joinaggregateTransform" - }, - { - "$ref": "#/defs/lookupTransform" - }, - { - "$ref": "#/defs/sampleTransform" - }, - { - "$ref": "#/defs/timeunitTransform" - }, - { - "$ref": "#/defs/windowTransform" - }, - { - "$ref": "#/defs/identifierTransform" - }, - { - "$ref": "#/defs/voronoiTransform" - }, - { - "$ref": "#/defs/wordcloudTransform" - } - ] - }, - "crossfilterTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "crossfilter" - ] - }, - "signal": { - "type": "string" - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "query": { - "oneOf": [ - { - "type": "array", - "items": {} - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type", - "fields", - "query" - ], - "additionalProperties": false - }, - "resolvefilterTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "resolvefilter" - ] - }, - "signal": { - "type": "string" - }, - "ignore": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "filter": {} - }, - "required": [ - "type", - "ignore", - "filter" - ], - "additionalProperties": false - }, - "linkpathTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "linkpath" - ] - }, - "signal": { - "type": "string" - }, - "sourceX": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ], - "default": "source.x" - }, - "sourceY": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ], - "default": "source.y" - }, - "targetX": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ], - "default": "target.x" - }, - "targetY": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ], - "default": "target.y" - }, - "orient": { - "anyOf": [ - { - "enum": [ - "horizontal", - "vertical", - "radial" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "vertical" - }, - "shape": { - "anyOf": [ - { - "enum": [ - "line", - "arc", - "curve", - "diagonal", - "orthogonal" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "line" - }, - "require": { - "$ref": "#/refs/signal" - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "path" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "pieTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "pie" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "startAngle": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "endAngle": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 6.283185307179586 - }, - "sort": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - "startAngle", - "endAngle" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "stackTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "stack" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "sort": { - "$ref": "#/refs/compare" - }, - "offset": { - "anyOf": [ - { - "enum": [ - "zero", - "center", - "normalize" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "zero" - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - "y0", - "y1" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "forceTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "force" - ] - }, - "signal": { - "type": "string" - }, - "static": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "restart": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "iterations": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 300 - }, - "alpha": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1 - }, - "alphaMin": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.001 - }, - "alphaTarget": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "velocityDecay": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.4 - }, - "forces": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "force": { - "enum": [ - "center" - ] - }, - "x": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "y": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "force" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "force": { - "enum": [ - "collide" - ] - }, - "radius": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - }, - "strength": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.7 - }, - "iterations": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1 - } - }, - "required": [ - "force" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "force": { - "enum": [ - "nbody" - ] - }, - "strength": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": -30 - }, - "theta": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.9 - }, - "distanceMin": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1 - }, - "distanceMax": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "force" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "force": { - "enum": [ - "link" - ] - }, - "links": { - "type": "string" - }, - "id": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "distance": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ], - "default": 30 - }, - "strength": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - }, - "iterations": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1 - } - }, - "required": [ - "force" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "force": { - "enum": [ - "x" - ] - }, - "strength": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.1 - }, - "x": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - "required": [ - "force" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "force": { - "enum": [ - "y" - ] - }, - "strength": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.1 - }, - "y": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - "required": [ - "force" - ], - "additionalProperties": false - } - ] - } - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "default": [ - "x", - "y", - "vx", - "vy" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "contourTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "contour" - ] - }, - "signal": { - "type": "string" - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "values": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "x": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "y": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "weight": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "cellSize": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "bandwidth": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "count": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "nice": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "thresholds": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "smooth": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - } - }, - "required": [ - "type", - "size" - ], - "additionalProperties": false - }, - "geojsonTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "geojson" - ] - }, - "signal": { - "type": "string" - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "geojson": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "geopathTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "geopath" - ] - }, - "signal": { - "type": "string" - }, - "projection": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "pointRadius": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "path" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "geopointTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "geopoint" - ] - }, - "signal": { - "type": "string" - }, - "projection": { - "type": "string" - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - "x", - "y" - ] - } - }, - "required": [ - "type", - "projection", - "fields" - ], - "additionalProperties": false - }, - "geoshapeTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "geoshape" - ] - }, - "signal": { - "type": "string" - }, - "projection": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ], - "default": "datum" - }, - "pointRadius": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "shape" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "graticuleTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "graticule" - ] - }, - "signal": { - "type": "string" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": {} - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "extentMajor": { - "oneOf": [ - { - "type": "array", - "items": {} - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "extentMinor": { - "oneOf": [ - { - "type": "array", - "items": {} - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "step": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "stepMajor": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - 90, - 360 - ] - }, - "stepMinor": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - 10, - 10 - ] - }, - "precision": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 2.5 - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "heatmapTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "heatmap" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "color": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - }, - "opacity": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - }, - "resolve": { - "anyOf": [ - { - "enum": [ - "shared", - "independent" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "independent" - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "image" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "isocontourTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "isocontour" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "thresholds": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "levels": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "nice": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "resolve": { - "anyOf": [ - { - "enum": [ - "shared", - "independent" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "independent" - }, - "zero": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - }, - "smooth": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - }, - "scale": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - }, - "translate": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "null" - } - ], - "default": "contour" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "kde2dTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "kde2d" - ] - }, - "signal": { - "type": "string" - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "x": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "y": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "weight": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "cellSize": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "bandwidth": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "counts": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "grid" - } - }, - "required": [ - "type", - "size", - "x", - "y" - ], - "additionalProperties": false - }, - "nestTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "nest" - ] - }, - "signal": { - "type": "string" - }, - "keys": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "generate": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "packTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "pack" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "sort": { - "$ref": "#/refs/compare" - }, - "padding": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "radius": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 5, - "minItems": 5, - "default": [ - "x", - "y", - "r", - "depth", - "children" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "partitionTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "partition" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "sort": { - "$ref": "#/refs/compare" - }, - "padding": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "round": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 6, - "minItems": 6, - "default": [ - "x0", - "y0", - "x1", - "y1", - "depth", - "children" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "stratifyTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "stratify" - ] - }, - "signal": { - "type": "string" - }, - "key": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "parentKey": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - "required": [ - "type", - "key", - "parentKey" - ], - "additionalProperties": false - }, - "treeTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "tree" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "sort": { - "$ref": "#/refs/compare" - }, - "method": { - "anyOf": [ - { - "enum": [ - "tidy", - "cluster" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "tidy" - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "nodeSize": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "separation": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 4, - "minItems": 4, - "default": [ - "x", - "y", - "depth", - "children" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "treelinksTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "treelinks" - ] - }, - "signal": { - "type": "string" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "treemapTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "treemap" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "sort": { - "$ref": "#/refs/compare" - }, - "method": { - "anyOf": [ - { - "enum": [ - "squarify", - "resquarify", - "binary", - "dice", - "slice", - "slicedice" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "squarify" - }, - "padding": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "paddingInner": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "paddingOuter": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "paddingTop": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "paddingRight": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "paddingBottom": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "paddingLeft": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "ratio": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1.618033988749895 - }, - "round": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 6, - "minItems": 6, - "default": [ - "x0", - "y0", - "x1", - "y1", - "depth", - "children" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "labelTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "label" - ] - }, - "signal": { - "type": "string" - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "sort": { - "$ref": "#/refs/compare" - }, - "anchor": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "default": [ - "top-left", - "left", - "bottom-left", - "top", - "bottom", - "top-right", - "right", - "bottom-right" - ] - }, - "offset": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "default": [ - 1 - ] - }, - "padding": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "lineAnchor": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "end" - }, - "markIndex": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "avoidBaseMark": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - }, - "avoidMarks": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "method": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "naive" - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 5, - "minItems": 5, - "default": [ - "x", - "y", - "opacity", - "align", - "baseline" - ] - } - }, - "required": [ - "type", - "size" - ], - "additionalProperties": false - }, - "loessTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "loess" - ] - }, - "signal": { - "type": "string" - }, - "x": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "y": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "bandwidth": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.3 - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type", - "x", - "y" - ], - "additionalProperties": false - }, - "regressionTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "regression" - ] - }, - "signal": { - "type": "string" - }, - "x": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "y": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "method": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "linear" - }, - "order": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 3 - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "params": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type", - "x", - "y" - ], - "additionalProperties": false - }, - "aggregateTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "aggregate" - ] - }, - "signal": { - "type": "string" - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "ops": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "enum": [ - "values", - "count", - "__count__", - "missing", - "valid", - "sum", - "product", - "mean", - "average", - "variance", - "variancep", - "stdev", - "stdevp", - "stderr", - "distinct", - "ci0", - "ci1", - "median", - "q1", - "q3", - "min", - "max", - "argmin", - "argmax" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - }, - { - "type": "null" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "null" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "drop": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - }, - "cross": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "key": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "binTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "bin" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "interval": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - }, - "anchor": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "maxbins": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 20 - }, - "base": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 10 - }, - "divide": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "default": [ - 5, - 2 - ] - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "span": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "step": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "steps": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minstep": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "nice": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - "bin0", - "bin1" - ] - } - }, - "required": [ - "type", - "field", - "extent" - ], - "additionalProperties": false - }, - "collectTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "collect" - ] - }, - "signal": { - "type": "string" - }, - "sort": { - "$ref": "#/refs/compare" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "countpatternTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "countpattern" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "case": { - "anyOf": [ - { - "enum": [ - "upper", - "lower", - "mixed" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "mixed" - }, - "pattern": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "[\\w\"]+" - }, - "stopwords": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - "text", - "count" - ] - } - }, - "required": [ - "type", - "field" - ], - "additionalProperties": false - }, - "crossTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "cross" - ] - }, - "signal": { - "type": "string" - }, - "filter": { - "$ref": "#/refs/exprString" - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - "a", - "b" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "densityTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "density" - ] - }, - "signal": { - "type": "string" - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "steps": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minsteps": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 25 - }, - "maxsteps": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 200 - }, - "method": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "pdf" - }, - "distribution": { - "oneOf": [ - { - "type": "object", - "properties": { - "function": { - "enum": [ - "normal" - ] - }, - "mean": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "stdev": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1 - } - }, - "required": [ - "function" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "function": { - "enum": [ - "lognormal" - ] - }, - "mean": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "stdev": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1 - } - }, - "required": [ - "function" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "function": { - "enum": [ - "uniform" - ] - }, - "min": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "max": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1 - } - }, - "required": [ - "function" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "function": { - "enum": [ - "kde" - ] - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "from": { - "type": "string" - }, - "bandwidth": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "function", - "field" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "function": { - "enum": [ - "mixture" - ] - }, - "distributions": { - "oneOf": [ - { - "type": "array", - "items": {} - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "weights": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "function" - ], - "additionalProperties": false - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "default": [ - "value", - "density" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "dotbinTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "dotbin" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "step": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "smooth": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "bin" - } - }, - "required": [ - "type", - "field" - ], - "additionalProperties": false - }, - "extentTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "extent" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - "required": [ - "type", - "field" - ], - "additionalProperties": false - }, - "filterTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "filter" - ] - }, - "signal": { - "type": "string" - }, - "expr": { - "$ref": "#/refs/exprString" - } - }, - "required": [ - "type", - "expr" - ], - "additionalProperties": false - }, - "flattenTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "flatten" - ] - }, - "signal": { - "type": "string" - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "index": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type", - "fields" - ], - "additionalProperties": false - }, - "foldTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "fold" - ] - }, - "signal": { - "type": "string" - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - "key", - "value" - ] - } - }, - "required": [ - "type", - "fields" - ], - "additionalProperties": false - }, - "formulaTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "formula" - ] - }, - "signal": { - "type": "string" - }, - "expr": { - "$ref": "#/refs/exprString" - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "initonly": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type", - "expr", - "as" - ], - "additionalProperties": false - }, - "imputeTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "impute" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "key": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "keyvals": { - "oneOf": [ - { - "type": "array", - "items": {} - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "method": { - "anyOf": [ - { - "enum": [ - "value", - "mean", - "median", - "max", - "min" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "value" - }, - "value": {} - }, - "required": [ - "type", - "field", - "key" - ], - "additionalProperties": false - }, - "joinaggregateTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "joinaggregate" - ] - }, - "signal": { - "type": "string" - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - }, - { - "type": "null" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "ops": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "enum": [ - "values", - "count", - "__count__", - "missing", - "valid", - "sum", - "product", - "mean", - "average", - "variance", - "variancep", - "stdev", - "stdevp", - "stderr", - "distinct", - "ci0", - "ci1", - "median", - "q1", - "q3", - "min", - "max", - "argmin", - "argmax" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "null" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "key": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "kdeTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "kde" - ] - }, - "signal": { - "type": "string" - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "cumulative": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "counts": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "bandwidth": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "resolve": { - "anyOf": [ - { - "enum": [ - "shared", - "independent" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "independent" - }, - "steps": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minsteps": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 25 - }, - "maxsteps": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 200 - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "default": [ - "value", - "density" - ] - } - }, - "required": [ - "type", - "field" - ], - "additionalProperties": false - }, - "lookupTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "lookup" - ] - }, - "signal": { - "type": "string" - }, - "from": { - "type": "string" - }, - "key": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "values": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "default": {} - }, - "required": [ - "type", - "from", - "key", - "fields" - ], - "additionalProperties": false - }, - "pivotTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "pivot" - ] - }, - "signal": { - "type": "string" - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "value": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "op": { - "anyOf": [ - { - "enum": [ - "values", - "count", - "__count__", - "missing", - "valid", - "sum", - "product", - "mean", - "average", - "variance", - "variancep", - "stdev", - "stdevp", - "stderr", - "distinct", - "ci0", - "ci1", - "median", - "q1", - "q3", - "min", - "max", - "argmin", - "argmax" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "sum" - }, - "limit": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "key": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - "required": [ - "type", - "field", - "value" - ], - "additionalProperties": false - }, - "projectTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "project" - ] - }, - "signal": { - "type": "string" - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "null" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "quantileTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "quantile" - ] - }, - "signal": { - "type": "string" - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "probs": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "step": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.01 - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "default": [ - "prob", - "value" - ] - } - }, - "required": [ - "type", - "field" - ], - "additionalProperties": false - }, - "sampleTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "sample" - ] - }, - "signal": { - "type": "string" - }, - "size": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1000 - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "sequenceTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "sequence" - ] - }, - "signal": { - "type": "string" - }, - "start": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "stop": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "step": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1 - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "data" - } - }, - "required": [ - "type", - "start", - "stop" - ], - "additionalProperties": false - }, - "timeunitTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "timeunit" - ] - }, - "signal": { - "type": "string" - }, - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "interval": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - }, - "units": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "enum": [ - "year", - "quarter", - "month", - "week", - "date", - "day", - "dayofyear", - "hours", - "minutes", - "seconds", - "milliseconds" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "step": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 1 - }, - "maxbins": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 40 - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "timezone": { - "anyOf": [ - { - "enum": [ - "local", - "utc" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "local" - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - "unit0", - "unit1" - ] - } - }, - "required": [ - "type", - "field" - ], - "additionalProperties": false - }, - "windowTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "window" - ] - }, - "signal": { - "type": "string" - }, - "sort": { - "$ref": "#/refs/compare" - }, - "groupby": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "ops": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "enum": [ - "row_number", - "rank", - "dense_rank", - "percent_rank", - "cume_dist", - "ntile", - "lag", - "lead", - "first_value", - "last_value", - "nth_value", - "prev_value", - "next_value", - "values", - "count", - "__count__", - "missing", - "valid", - "sum", - "product", - "mean", - "average", - "variance", - "variancep", - "stdev", - "stdevp", - "stderr", - "distinct", - "ci0", - "ci1", - "median", - "q1", - "q3", - "min", - "max", - "argmin", - "argmax" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "params": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "null" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "fields": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - }, - { - "type": "null" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "null" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "frame": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "null" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - null, - 0 - ] - }, - "ignorePeers": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "identifierTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "identifier" - ] - }, - "signal": { - "type": "string" - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type", - "as" - ], - "additionalProperties": false - }, - "voronoiTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "voronoi" - ] - }, - "signal": { - "type": "string" - }, - "x": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "y": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "extent": { - "oneOf": [ - { - "type": "array", - "items": {} - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2, - "default": [ - [ - -100000, - -100000 - ], - [ - 100000, - 100000 - ] - ] - }, - "as": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "path" - } - }, - "required": [ - "type", - "x", - "y" - ], - "additionalProperties": false - }, - "wordcloudTransform": { - "type": "object", - "properties": { - "type": { - "enum": [ - "wordcloud" - ] - }, - "signal": { - "type": "string" - }, - "size": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 2, - "minItems": 2 - }, - "font": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ], - "default": "sans-serif" - }, - "fontStyle": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ], - "default": "normal" - }, - "fontWeight": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ], - "default": "normal" - }, - "fontSize": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ], - "default": 14 - }, - "fontSizeRange": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "null" - } - ], - "default": [ - 10, - 50 - ] - }, - "rotate": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - }, - "text": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/paramField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "spiral": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "padding": { - "anyOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - }, - { - "$ref": "#/refs/expr" - }, - { - "$ref": "#/refs/paramField" - } - ] - }, - "as": { - "oneOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "maxItems": 7, - "minItems": 7, - "default": [ - "x", - "y", - "font", - "fontSize", - "fontStyle", - "fontWeight", - "angle" - ] - } - }, - "required": [ - "type" - ], - "additionalProperties": false - } - }, - "refs": { - "labelOverlap": { - "oneOf": [ - { - "type": "boolean" - }, - { - "enum": [ - "parity", - "greedy" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "tickBand": { - "oneOf": [ - { - "enum": [ - "center", - "extent" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "tickCount": { - "oneOf": [ - { - "type": "number" - }, - { - "enum": [ - "millisecond", - "second", - "minute", - "hour", - "day", - "week", - "month", - "year" - ] - }, - { - "type": "object", - "properties": { - "interval": { - "oneOf": [ - { - "enum": [ - "millisecond", - "second", - "minute", - "hour", - "day", - "week", - "month", - "year" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "step": { - "$ref": "#/refs/numberOrSignal" - } - }, - "required": [ - "interval" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "element": { - "type": "string" - }, - "paramField": { - "type": "object", - "properties": { - "field": { - "type": "string" - }, - "as": { - "type": "string" - } - }, - "required": [ - "field" - ], - "additionalProperties": false - }, - "field": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "datum": { - "$ref": "#/refs/field" - } - }, - "required": [ - "datum" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "group": { - "$ref": "#/refs/field" - }, - "level": { - "type": "number" - } - }, - "required": [ - "group" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "parent": { - "$ref": "#/refs/field" - }, - "level": { - "type": "number" - } - }, - "required": [ - "parent" - ], - "additionalProperties": false - } - ] - }, - "scale": { - "$ref": "#/refs/field" - }, - "stringModifiers": { - "type": "object", - "properties": { - "scale": { - "$ref": "#/refs/scale" - } - } - }, - "numberModifiers": { - "type": "object", - "properties": { - "exponent": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "mult": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "offset": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/numberValue" - } - ] - }, - "round": { - "type": "boolean", - "default": false - }, - "scale": { - "$ref": "#/refs/scale" - }, - "band": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - }, - "extra": { - "type": "boolean" - } - } - }, - "anyValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": {} - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": {} - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "blendValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - null, - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "hue", - "saturation", - "color", - "luminosity" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "numberValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/numberModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "type": "number" - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/numberModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "type": "number" - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "stringValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "textValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "booleanValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "type": "boolean" - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "type": "boolean" - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "arrayValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "type": "array" - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "type": "array" - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "fontWeightValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - null, - "normal", - "bold", - "lighter", - "bolder", - "100", - "200", - "300", - "400", - "500", - "600", - "700", - "800", - "900", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - null, - "normal", - "bold", - "lighter", - "bolder", - "100", - "200", - "300", - "400", - "500", - "600", - "700", - "800", - "900", - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "anchorValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "start", - "middle", - "end" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "start", - "middle", - "end" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "alignValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "left", - "right", - "center" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "left", - "right", - "center" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "baselineValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "top", - "middle", - "bottom", - "alphabetic" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "top", - "middle", - "bottom", - "alphabetic" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "directionValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "horizontal", - "vertical" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "horizontal", - "vertical" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "orientValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "left", - "right", - "top", - "bottom" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "left", - "right", - "top", - "bottom" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "strokeCapValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "butt", - "round", - "square" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "butt", - "round", - "square" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "strokeJoinValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "miter", - "round", - "bevel" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - } - }, - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "enum": [ - "miter", - "round", - "bevel" - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - } - ] - }, - "baseColorValue": { - "oneOf": [ - { - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "value": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "value" - ] - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/field" - } - }, - "required": [ - "field" - ] - }, - { - "type": "object", - "properties": { - "range": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - "required": [ - "range" - ] - } - ] - }, - { - "type": "object", - "required": [ - "scale", - "value" - ] - }, - { - "type": "object", - "required": [ - "scale", - "band" - ] - }, - { - "type": "object", - "required": [ - "offset" - ] - } - ] - } - ] - }, - { - "type": "object", - "properties": { - "value": { - "$ref": "#/refs/linearGradient" - } - }, - "required": [ - "value" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "value": { - "$ref": "#/refs/radialGradient" - } - }, - "required": [ - "value" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "gradient": { - "$ref": "#/refs/scale" - }, - "start": { - "type": "array", - "items": { - "type": "number" - }, - "minItems": 2, - "maxItems": 2 - }, - "stop": { - "type": "array", - "items": { - "type": "number" - }, - "minItems": 2, - "maxItems": 2 - }, - "count": { - "type": "number" - } - }, - "required": [ - "gradient" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "color": { - "oneOf": [ - { - "$ref": "#/refs/colorRGB" - }, - { - "$ref": "#/refs/colorHSL" - }, - { - "$ref": "#/refs/colorLAB" - }, - { - "$ref": "#/refs/colorHCL" - } - ] - } - }, - "required": [ - "color" - ], - "additionalProperties": false - } - ] - }, - "colorRGB": { - "type": "object", - "properties": { - "r": { - "$ref": "#/refs/numberValue" - }, - "g": { - "$ref": "#/refs/numberValue" - }, - "b": { - "$ref": "#/refs/numberValue" - } - }, - "required": [ - "r", - "g", - "b" - ] - }, - "colorHSL": { - "type": "object", - "properties": { - "h": { - "$ref": "#/refs/numberValue" - }, - "s": { - "$ref": "#/refs/numberValue" - }, - "l": { - "$ref": "#/refs/numberValue" - } - }, - "required": [ - "h", - "s", - "l" - ] - }, - "colorLAB": { - "type": "object", - "properties": { - "l": { - "$ref": "#/refs/numberValue" - }, - "a": { - "$ref": "#/refs/numberValue" - }, - "b": { - "$ref": "#/refs/numberValue" - } - }, - "required": [ - "l", - "a", - "b" - ] - }, - "colorHCL": { - "type": "object", - "properties": { - "h": { - "$ref": "#/refs/numberValue" - }, - "c": { - "$ref": "#/refs/numberValue" - }, - "l": { - "$ref": "#/refs/numberValue" - } - }, - "required": [ - "h", - "c", - "l" - ] - }, - "colorValue": { - "oneOf": [ - { - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/defs/rule" - }, - { - "$ref": "#/refs/baseColorValue" - } - ] - } - }, - { - "$ref": "#/refs/baseColorValue" - } - ] - }, - "gradientStops": { - "type": "array", - "items": { - "type": "object", - "properties": { - "offset": { - "type": "number" - }, - "color": { - "type": "string" - } - }, - "required": [ - "offset", - "color" - ], - "additionalProperties": false - } - }, - "linearGradient": { - "type": "object", - "properties": { - "gradient": { - "enum": [ - "linear" - ] - }, - "id": { - "type": "string" - }, - "x1": { - "type": "number" - }, - "y1": { - "type": "number" - }, - "x2": { - "type": "number" - }, - "y2": { - "type": "number" - }, - "stops": { - "$ref": "#/refs/gradientStops" - } - }, - "required": [ - "gradient", - "stops" - ], - "additionalProperties": false - }, - "radialGradient": { - "type": "object", - "properties": { - "gradient": { - "enum": [ - "radial" - ] - }, - "id": { - "type": "string" - }, - "x1": { - "type": "number" - }, - "y1": { - "type": "number" - }, - "r1": { - "type": "number" - }, - "x2": { - "type": "number" - }, - "y2": { - "type": "number" - }, - "r2": { - "type": "number" - }, - "stops": { - "$ref": "#/refs/gradientStops" - } - }, - "required": [ - "gradient", - "stops" - ], - "additionalProperties": false - }, - "expr": { - "type": "object", - "properties": { - "expr": { - "type": "string" - }, - "as": { - "type": "string" - } - }, - "required": [ - "expr" - ] - }, - "exprString": { - "type": "string" - }, - "compare": { - "oneOf": [ - { - "type": "object", - "properties": { - "field": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/expr" - } - ] - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "field": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/refs/scaleField" - }, - { - "$ref": "#/refs/expr" - } - ] - } - }, - "order": { - "type": "array", - "items": { - "$ref": "#/refs/sortOrder" - } - } - }, - "additionalProperties": false - } - ] - }, - "from": { - "type": "object", - "properties": { - "data": { - "type": "string" - } - }, - "additionalProperties": false - }, - "facet": { - "type": "object", - "properties": { - "data": { - "type": "string" - }, - "facet": { - "oneOf": [ - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "data": { - "type": "string" - }, - "field": { - "type": "string" - } - }, - "required": [ - "name", - "data", - "field" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "data": { - "type": "string" - }, - "groupby": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "aggregate": { - "type": "object", - "properties": { - "cross": { - "type": "boolean" - }, - "fields": { - "type": "array", - "items": { - "type": "string" - } - }, - "ops": { - "type": "array", - "items": { - "type": "string" - } - }, - "as": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - } - }, - "required": [ - "name", - "data", - "groupby" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "facet" - ], - "additionalProperties": false - }, - "markclip": { - "oneOf": [ - { - "$ref": "#/refs/booleanOrSignal" - }, - { - "type": "object", - "properties": { - "path": { - "$ref": "#/refs/stringOrSignal" - } - }, - "required": [ - "path" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "sphere": { - "$ref": "#/refs/stringOrSignal" - } - }, - "required": [ - "sphere" - ], - "additionalProperties": false - } - ] - }, - "style": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "marktype": { - "type": "string" - }, - "scaleField": { - "$ref": "#/refs/stringOrSignal" - }, - "sortOrder": { - "oneOf": [ - { - "enum": [ - "ascending", - "descending" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "scaleBins": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/refs/numberOrSignal" - } - }, - { - "type": "object", - "properties": { - "step": { - "$ref": "#/refs/numberOrSignal" - }, - "start": { - "$ref": "#/refs/numberOrSignal" - }, - "stop": { - "$ref": "#/refs/numberOrSignal" - } - }, - "required": [ - "step" - ], - "additionalProperties": false - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "scaleInterpolate": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - }, - { - "type": "object", - "properties": { - "type": { - "$ref": "#/refs/stringOrSignal" - }, - "gamma": { - "$ref": "#/refs/numberOrSignal" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - } - ] - }, - "scaleData": { - "oneOf": [ - { - "type": "object", - "properties": { - "data": { - "type": "string" - }, - "field": { - "$ref": "#/refs/stringOrSignal" - }, - "sort": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/stringOrSignal" - }, - "op": { - "$ref": "#/refs/stringOrSignal" - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "additionalProperties": false - } - ] - } - }, - "required": [ - "data", - "field" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "data": { - "type": "string" - }, - "fields": { - "type": "array", - "items": { - "$ref": "#/refs/stringOrSignal" - }, - "minItems": 1 - }, - "sort": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "properties": { - "op": { - "enum": [ - "count" - ] - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/stringOrSignal" - }, - "op": { - "enum": [ - "count", - "min", - "max" - ] - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "required": [ - "field", - "op" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "data", - "fields" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "fields": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "data": { - "type": "string" - }, - "field": { - "$ref": "#/refs/stringOrSignal" - } - }, - "required": [ - "data", - "field" - ], - "additionalProperties": false - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 1 - }, - "sort": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "properties": { - "op": { - "enum": [ - "count" - ] - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "field": { - "$ref": "#/refs/stringOrSignal" - }, - "op": { - "enum": [ - "count", - "min", - "max" - ] - }, - "order": { - "$ref": "#/refs/sortOrder" - } - }, - "required": [ - "field", - "op" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "fields" - ], - "additionalProperties": false - } - ] - }, - "selector": { - "type": "string" - }, - "signal": { - "type": "object", - "properties": { - "signal": { - "type": "string" - } - }, - "required": [ - "signal" - ] - }, - "arrayOrSignal": { - "oneOf": [ - { - "type": "array" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "booleanOrSignal": { - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "numberOrSignal": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "stringOrSignal": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "textOrSignal": { - "oneOf": [ - { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "type": "object", - "allOf": [ - { - "$ref": "#/defs/scope" - }, - { - "properties": { - "$schema": { - "type": "string", - "format": "uri" - }, - "config": { - "type": "object" - }, - "description": { - "type": "string" - }, - "width": { - "$ref": "#/refs/numberOrSignal" - }, - "height": { - "$ref": "#/refs/numberOrSignal" - }, - "padding": { - "$ref": "#/defs/padding" - }, - "autosize": { - "$ref": "#/defs/autosize" - }, - "background": { - "$ref": "#/defs/background" - }, - "style": { - "$ref": "#/refs/style" - } - } - } - ] -} \ No newline at end of file diff --git a/node_modules/vega/build/vega.js b/node_modules/vega/build/vega.js deleted file mode 100644 index 2e2c7c0..0000000 --- a/node_modules/vega/build/vega.js +++ /dev/null @@ -1,42558 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.vega = {})); -}(this, (function (exports) { 'use strict'; - - function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; - } - - function accessorName(fn) { - return fn == null ? null : fn.fname; - } - - function accessorFields(fn) { - return fn == null ? null : fn.fields; - } - - function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); - } - - const get1 = field => function(obj) { - return obj[field]; - }; - - const getN = path => { - const len = path.length; - return function(obj) { - for (let i = 0; i < len; ++i) { - obj = obj[path[i]]; - } - return obj; - }; - }; - - function error(message) { - throw Error(message); - } - - function splitAccessPath(p) { - var path = [], - q = null, - b = 0, - n = p.length, - s = '', - i, j, c; - - p = p + ''; - - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; - } - - for (i=j=0; j i) { - push(); - } else { - i = j + 1; - } - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - - if (j > i) { - j++; - push(); - } - - return path; - } - - function field(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor( - (opt && opt.get || getter)(path), - [field], - name || field - ); - } - - var empty = []; - - var id = field('id'); - - var identity = accessor(function(_) { return _; }, empty, 'identity'); - - var zero = accessor(function() { return 0; }, empty, 'zero'); - - var one = accessor(function() { return 1; }, empty, 'one'); - - var truthy = accessor(function() { return true; }, empty, 'true'); - - var falsy = accessor(function() { return false; }, empty, 'false'); - - function log(method, level, input) { - var args = [level].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console - } - - var None = 0; - var Error$1 = 1; - var Warn = 2; - var Info = 3; - var Debug = 4; - - function logger(_, method) { - var level = _ || None; - return { - level: function(_) { - if (arguments.length) { - level = +_; - return this; - } else { - return level; - } - }, - error: function() { - if (level >= Error$1) log(method || 'error', 'ERROR', arguments); - return this; - }, - warn: function() { - if (level >= Warn) log(method || 'warn', 'WARN', arguments); - return this; - }, - info: function() { - if (level >= Info) log(method || 'log', 'INFO', arguments); - return this; - }, - debug: function() { - if (level >= Debug) log(method || 'log', 'DEBUG', arguments); - return this; - } - }; - } - - var isArray = Array.isArray; - - function isObject(_) { - return _ === Object(_); - } - - const isLegalKey = key => key !== '__proto__'; - - function mergeConfig(...configs) { - return configs.reduce((out, source) => { - for (var key in source) { - if (key === 'signals') { - // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - } else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - var r = key === 'legend' ? {layout: 1} - : key === 'style' ? true - : null; - writeConfig(out, key, source[key], r); - } - } - return out; - }, {}); - } - - function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - - var k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : (output[key] = {}); - for (k in value) { - if (recurse && (recurse === true || recurse[k])) { - writeConfig(o, k, value[k]); - } else if (isLegalKey(k)) { - o[k] = value[k]; - } - } - } else { - output[key] = value; - } - } - - function mergeNamed(a, b) { - if (a == null) return b; - - const map = {}, out = []; - - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - - b.forEach(add); - a.forEach(add); - return out; - } - - function peek(array) { - return array[array.length - 1]; - } - - function toNumber(_) { - return _ == null || _ === '' ? null : +_; - } - - function exp(sign) { - return function(x) { return sign * Math.exp(x); }; - } - - function log$1(sign) { - return function(x) { return Math.log(sign * x); }; - } - - function symlog(c) { - return function(x) { return Math.sign(x) * Math.log1p(Math.abs(x / c)); }; - } - - function symexp(c) { - return function(x) { return Math.sign(x) * Math.expm1(Math.abs(x)) * c; }; - } - - function pow(exponent) { - return function(x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; - } - - function pan(domain, delta, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - dd = (d1 - d0) * delta; - - return [ - ground(d0 - dd), - ground(d1 - dd) - ]; - } - - function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); - } - - function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log$1(sign), exp(sign)); - } - - function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1/exponent)); - } - - function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); - } - - function zoom(domain, anchor, scale, lift, ground) { - var d0 = lift(domain[0]), - d1 = lift(peek(domain)), - da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - - return [ - ground(da + (d0 - da) * scale), - ground(da + (d1 - da) * scale) - ]; - } - - function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); - } - - function zoomLog(domain, anchor, scale) { - var sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log$1(sign), exp(sign)); - } - - function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1/exponent)); - } - - function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); - } - - function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); - } - - function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); - } - - function array(_) { - return _ != null ? (isArray(_) ? _ : [_]) : []; - } - - /** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ - function clampRange(range, min, max) { - var lo = range[0], - hi = range[1], - span; - - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - span = hi - lo; - - return span >= (max - min) - ? [min, max] - : [ - (lo = Math.min(Math.max(lo, min), max - span)), - lo + span - ]; - } - - function isFunction(_) { - return typeof _ === 'function'; - } - - const DESCENDING = 'descending'; - - function compare(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - - const ord = [], get = [], fmap = {}, - gen = opt.comparator || comparator; - - array(fields).forEach((f, i) => { - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach(_ => fmap[_] = 1); - }); - - return get.length === 0 - ? null - : accessor(gen(get, ord), Object.keys(fmap)); - } - - const compare$1 = (u, v) => (u < v || u == null) && v != null ? -1 - : (u > v || v == null) && u != null ? 1 - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? -1 - : v !== v && u === u ? 1 - : 0; - - const comparator = (fields, orders) => fields.length === 1 - ? compare1(fields[0], orders[0]) - : compareN(fields, orders, fields.length); - - const compare1 = (field, order) => function(a, b) { - return compare$1(field(a), field(b)) * order; - }; - - const compareN = (fields, orders, n) => { - orders.push(0); // pad zero for convenient lookup - return function(a, b) { - let f, c = 0, i = -1; - while (c === 0 && ++i < n) { - f = fields[i]; - c = compare$1(f(a), f(b)); - } - return c * orders[i]; - }; - }; - - function constant(_) { - return isFunction(_) ? _ : function() { return _; }; - } - - function debounce(delay, handler) { - var tid, evt; - - function callback() { - handler(evt); - tid = evt = null; - } - - return function(e) { - evt = e; - if (tid) clearTimeout(tid); - tid = setTimeout(callback, delay); - }; - } - - function extend(_) { - for (var x, k, i=1, len=arguments.length; i max) max = v; - } - } - } else { - // find first valid value - for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])); - min = max = v; - - // visit all other values - for (; i max) max = v; - } - } - } - } - - return [min, max]; - } - - function extentIndex(array, f) { - var i = -1, - n = array.length, - a, b, c, u, v; - - if (f == null) { - while (++i < n) { - b = array[i]; - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = array[i]; - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while (++i < n) { - b = f(array[i], i, array); - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [-1, -1]; - u = v = i; - while (++i < n) { - b = f(array[i], i, array); - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } - - return [u, v]; - } - - const hop = Object.prototype.hasOwnProperty; - - function hasOwnProperty(object, property) { - return hop.call(object, property); - } - - var NULL = {}; - - function fastmap(input) { - var obj = {}, - map, - test; - - function has(key) { - return hasOwnProperty(obj, key) && obj[key] !== NULL; - } - - map = { - size: 0, - empty: 0, - object: obj, - has: has, - get(key) { - return has(key) ? obj[key] : undefined; - }, - set(key, value) { - if (!has(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - obj[key] = value; - return this; - }, - delete(key) { - if (has(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - return this; - }, - clear() { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test(_) { - if (arguments.length) { - test = _; - return map; - } else { - return test; - } - }, - clean() { - var next = {}, - size = 0, - key, value; - for (key in obj) { - value = obj[key]; - if (value !== NULL && (!test || !test(value))) { - next[key] = value; - ++size; - } - } - map.size = size; - map.empty = 0; - map.object = (obj = next); - } - }; - - if (input) Object.keys(input).forEach(function(key) { - map.set(key, input[key]); - }); - - return map; - } - - function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - - var a = range[0], - b = peek(range), - t = +threshold, - l, r; - - // swap endpoints if range is reversed - if (b < a) { - l = a; a = b; b = l; - } - - // compare value to endpoints - l = Math.abs(value - a); - r = Math.abs(b - value); - - // adjust if value is within threshold distance of endpoint - return l < r && l <= t ? left : r <= t ? right : center; - } - - function inherits(child, parent) { - var proto = (child.prototype = Object.create(parent.prototype)); - proto.constructor = child; - return proto; - } - - /** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ - function inrange(value, range, left, right) { - var r0 = range[0], r1 = range[range.length-1], t; - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - left = left === undefined || left; - right = right === undefined || right; - - return (left ? r0 <= value : r0 < value) && - (right ? value <= r1 : value < r1); - } - - function isBoolean(_) { - return typeof _ === 'boolean'; - } - - function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; - } - - function isNumber(_) { - return typeof _ === 'number'; - } - - function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; - } - - function isString(_) { - return typeof _ === 'string'; - } - - function key(fields, flat, opt) { - if (fields) { - fields = flat - ? array(fields).map(f => f.replace(/\\(.)/g, '$1')) - : array(fields); - } - - const len = fields && fields.length, - gen = opt && opt.get || getter, - map = f => gen(flat ? [f] : splitAccessPath(f)); - let fn; - - if (!len) { - fn = function() { return ''; }; - } else if (len === 1) { - const get = map(fields[0]); - fn = function(_) { return '' + get(_); }; - } else { - const get = fields.map(map); - fn = function(_) { - let s = '' + get[0](_), i = 0; - while (++i < len) s += '|' + get[i](_); - return s; - }; - } - - return accessor(fn, fields, 'key'); - } - - function lerp(array, frac) { - const lo = array[0], - hi = peek(array), - f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); - } - - const DEFAULT_MAX_SIZE = 10000; - - // adapted from https://github.com/dominictarr/hashlru/ (MIT License) - function lruCache(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - - let curr, prev, size; - - const clear = () => { - curr = {}; - prev = {}; - size = 0; - }; - - const update = (key, value) => { - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - return (curr[key] = value); - }; - - clear(); - - return { - clear, - has: key => hasOwnProperty(curr, key) || hasOwnProperty(prev, key), - get: key => hasOwnProperty(curr, key) ? curr[key] - : hasOwnProperty(prev, key) ? update(key, prev[key]) - : undefined, - set: (key, value) => hasOwnProperty(curr, key) - ? (curr[key] = value) - : update(key, value) - }; - } - - function merge(compare, array0, array1, output) { - var n0 = array0.length, - n1 = array1.length; - - if (!n1) return array0; - if (!n0) return array1; - - var merged = output || new array0.constructor(n0 + n1), - i0 = 0, i1 = 0, i = 0; - - for (; i0 0 - ? array1[i1++] - : array0[i0++]; - } - - for (; i0= 0) s += str; - return s; - } - - function pad(str, length, padchar, align) { - var c = padchar || ' ', - s = str + '', - n = length - s.length; - - return n <= 0 ? s - : align === 'left' ? repeat(c, n) + s - : align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2)) - : s + repeat(c, n); - } - - /** - * Return the numerical span of an array: the difference between - * the last and first values. - */ - function span(array) { - return array && (peek(array) - array[0]) || 0; - } - - function $(x) { - return isArray(x) ? '[' + x.map($) + ']' - : isObject(x) || isString(x) ? - // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029') - : x; - } - - function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; - } - - function defaultParser(_) { - return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); - } - - function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); - } - - function toString(_) { - return _ == null || _ === '' ? null : _ + ''; - } - - function toSet(_) { - for (var s={}, i=0, n=_.length; i= 0) { - list.splice(idx, 1); - } - } - return list; - }; - - return list; - } - - /** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ - async function asyncCallback(df, callback) { - try { await callback(df); } catch (err) { df.error(err); } - } - - var TUPLE_ID_KEY = Symbol('vega_id'), - TUPLE_ID = 1; - - /** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ - function isTuple(t) { - return !!(t && tupleid(t)); - } - - /** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ - function tupleid(t) { - return t[TUPLE_ID_KEY]; - } - - /** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ - function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; - } - - /** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ - function ingest(datum) { - var t = (datum === Object(datum)) ? datum : {data: datum}; - return tupleid(t) ? t : setid(t, TUPLE_ID++); - } - - /** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ - function derive(t) { - return rederive(t, ingest({})); - } - - /** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ - function rederive(t, d) { - for (var k in t) d[k] = t[k]; - return d; - } - - /** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ - function replace(t, d) { - return setid(d, tupleid(t)); - } - - /** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ - function stableCompare(cmp, f) { - return !cmp ? null - : f ? (a, b) => cmp(a, b) || (tupleid(f(a)) - tupleid(f(b))) - : (a, b) => cmp(a, b) || (tupleid(a) - tupleid(b)); - } - - function isChangeSet(v) { - return v && v.constructor === changeset; - } - - function changeset() { - var add = [], // insert tuples - rem = [], // remove tuples - mod = [], // modify tuples - remp = [], // remove by predicate - modp = [], // modify by predicate - clean = null, - reflow = false; - - return { - constructor: changeset, - insert: function(t) { - var d = array(t), i = 0, n = d.length; - for (; i 0) { - modify(t, f, m.value); - pulse.modifies(f); - } - } - - // process predicate-based modifications - for (i=0, n=modp.length; i 0) { - modify(t, m.field, m.value); - } - }); - pulse.modifies(m.field); - } - - // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - if (reflow) { - pulse.mod = rem.length || remp.length - ? tuples.filter(function(t) { return cur[tupleid(t)] > 0; }) - : tuples.slice(); - } else { - for (id in out) pulse.mod.push(out[id]); - } - - // set pulse garbage collection request - if (clean || clean == null && (rem.length || remp.length)) { - pulse.clean(true); - } - - return pulse; - } - }; - } - - var CACHE = '_:mod:_'; - - /** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ - function Parameters() { - Object.defineProperty(this, CACHE, {writable: true, value: {}}); - } - - var prototype = Parameters.prototype; - - /** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ - prototype.set = function(name, index, value, force) { - var o = this, - v = o[name], - mod = o[CACHE]; - - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = isArray(value) ? 1 + value.length : -1; - } - - return o; - }; - - /** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ - prototype.modified = function(name, index) { - var mod = this[CACHE], k; - if (!arguments.length) { - for (k in mod) { if (mod[k]) return true; } - return false; - } else if (isArray(name)) { - for (k=0; k= 0) - ? (index + 1 < mod[name] || !!mod[index + ':' + name]) - : !!mod[name]; - }; - - /** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ - prototype.clear = function() { - this[CACHE] = {}; - return this; - }; - - var OP_ID = 0; - var PULSE = 'pulse'; - var NO_PARAMS = new Parameters(); - - // Boolean Flags - var SKIP = 1, - MODIFIED = 2; - - /** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ - function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - - if (update) { - this._update = update; - } - if (params) this.parameters(params, react); - } - - var prototype$1 = Operator.prototype; - - /** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ - prototype$1.targets = function() { - return this._targets || (this._targets = UniqueList(id)); - }; - - /** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ - prototype$1.set = function(value) { - if (this.value !== value) { - this.value = value; - return 1; - } else { - return 0; - } - }; - - function flag(bit) { - return function(state) { - var f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? (f | bit) : (f & ~bit); - return this; - }; - } - - /** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ - prototype$1.skip = flag(SKIP); - - /** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ - prototype$1.modified = flag(MODIFIED); - - /** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initiatal evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ - prototype$1.parameters = function(params, react, initonly) { - react = react !== false; - var self = this, - argval = (self._argval = self._argval || new Parameters()), - argops = (self._argops = self._argops || []), - deps = [], - name, value, n, i; - - function add(name, index, value) { - if (value instanceof Operator) { - if (value !== self) { - if (react) value.targets().add(self); - deps.push(value); - } - argops.push({op:value, name:name, index:index}); - } else { - argval.set(name, index, value); - } - } - - for (name in params) { - value = params[name]; - - if (name === PULSE) { - array(value).forEach(function(op) { - if (!(op instanceof Operator)) { - error('Pulse parameters must be operator instances.'); - } else if (op !== self) { - op.targets().add(self); - deps.push(op); - } - }); - self.source = value; - } else if (isArray(value)) { - argval.set(name, -1, Array(n = value.length)); - for (i=0; i} - The source operators that should propagate - * to the target operator. - */ - function connect(target, sources) { - var targetRank = target.rank, i, n; - - for (i=0, n=sources.length; i pause) { - t = now; - return 1; - } else { - return 0; - } - }); - }; - - prototype$2.debounce = function(delay) { - var s = stream(); - - this.targets().add(stream(null, null, - debounce(delay, function(e) { - var df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }) - )); - - return s; - }; - - prototype$2.between = function(a, b) { - var active = false; - a.targets().add(stream(null, null, function() { active = true; })); - b.targets().add(stream(null, null, function() { active = false; })); - return this.filter(function() { return active; }); - }; - - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ - function events(source, type, filter, apply) { - var df = this, - s = stream(filter, apply), - send = function(e) { - e.dataflow = df; - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally { - df.run(); - } - }, - sources; - - if (typeof source === 'string' && typeof document !== 'undefined') { - sources = document.querySelectorAll(source); - } else { - sources = array(source); - } - - for (var i=0, n=sources.length; i i + 1); - - for (let i = 0, t = 0, j, value; i < n; ++i) { - value = field ? values[i][field] : values[i]; - for (j = 0; j < m; ++j) { - if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - } - - return typeList[ - a.reduce((u, v) => u === 0 ? v : u, 0) - 1 - ]; - } - - function inferTypes(data, fields) { - return fields.reduce(function(types, field) { - types[field] = inferType(data, field); - return types; - }, {}); - } - - // -- Type Checks ---- - - function isValid(_) { - return _ != null && _ === _; - } - - function isBoolean$1(_) { - return _ === 'true' || _ === 'false' || _ === true || _ === false; - } - - function isDate$1(_) { - return !Number.isNaN(Date.parse(_)); - } - - function isNumber$1(_) { - return !Number.isNaN(+_) && !(_ instanceof Date); - } - - function isInteger(_) { - return isNumber$1(_) && Number.isInteger(+_); - } - - var EOL = {}, - EOF = {}, - QUOTE = 34, - NEWLINE = 10, - RETURN = 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 = objectConverter(columns); - return function(row, i) { - return f(object(row), i, columns); - }; - } - - // Compute unique columns in order of discovery. - function inferColumns(rows) { - var columnSet = Object.create(null), - columns = []; - - rows.forEach(function(row) { - for (var column in row) { - if (!(column in columnSet)) { - columns.push(columnSet[column] = column); - } - } - }); - - return columns; - } - - function pad$1(value, width) { - var s = value + "", length = s.length; - return length < width ? new Array(width - length + 1).join(0) + s : s; - } - - function formatYear(year) { - return year < 0 ? "-" + pad$1(-year, 6) - : year > 9999 ? "+" + pad$1(year, 6) - : pad$1(year, 4); - } - - function formatDate(date) { - var hours = date.getUTCHours(), - minutes = date.getUTCMinutes(), - seconds = date.getUTCSeconds(), - milliseconds = date.getUTCMilliseconds(); - return isNaN(date) ? "Invalid Date" - : formatYear(date.getUTCFullYear()) + "-" + pad$1(date.getUTCMonth() + 1, 2) + "-" + pad$1(date.getUTCDate(), 2) - + (milliseconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "." + pad$1(milliseconds, 3) + "Z" - : seconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "Z" - : minutes || hours ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + "Z" - : ""); - } - - function dsvFormat(delimiter) { - var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), - DELIMITER = delimiter.charCodeAt(0); - - function parse(text, f) { - var convert, columns, rows = parseRows(text, function(row, i) { - if (convert) return convert(row, i - 1); - columns = row, convert = f ? customConverter(row, f) : objectConverter(row); - }); - rows.columns = columns || []; - return rows; - } - - function parseRows(text, f) { - var rows = [], // output rows - N = text.length, - I = 0, // current character index - n = 0, // current line number - t, // current token - eof = N <= 0, // current token followed by EOF? - eol = false; // current token followed by EOL? - - // Strip the trailing newline. - if (text.charCodeAt(N - 1) === NEWLINE) --N; - if (text.charCodeAt(N - 1) === RETURN) --N; - - function token() { - if (eof) return EOF; - if (eol) return eol = false, EOL; - - // Unescape quotes. - var i, j = I, c; - if (text.charCodeAt(j) === QUOTE) { - while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE); - if ((i = I) >= N) eof = true; - else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true; - else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; } - return text.slice(j + 1, i - 1).replace(/""/g, "\""); - } - - // Find next delimiter or newline. - while (I < N) { - if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true; - else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; } - else if (c !== DELIMITER) continue; - return text.slice(j, i); - } - - // Return last token before EOF. - return eof = true, text.slice(j, N); - } - - while ((t = token()) !== EOF) { - var row = []; - while (t !== EOL && t !== EOF) row.push(t), t = token(); - if (f && (row = f(row, n++)) == 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 == null) columns = inferColumns(rows); - return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); - } - - function formatBody(rows, columns) { - if (columns == null) columns = 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 == null ? "" - : value instanceof Date ? formatDate(value) - : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" - : value; - } - - return { - parse: parse, - parseRows: parseRows, - format: format, - formatBody: formatBody, - formatRows: formatRows, - formatRow: formatRow, - formatValue: formatValue - }; - } - - function delimitedFormat(delimiter) { - const parse = function(data, format) { - const delim = {delimiter: delimiter}; - return dsv(data, format ? extend(format, delim) : delim); - }; - - parse.responseType = 'text'; - - return parse; - } - - function dsv(data, format) { - if (format.header) { - data = format.header - .map($) - .join(format.delimiter) + '\n' + data; - } - return dsvFormat(format.delimiter).parse(data + ''); - } - - dsv.responseType = 'text'; - - function isBuffer(_) { - return (typeof Buffer === 'function' && isFunction(Buffer.isBuffer)) - ? Buffer.isBuffer(_) : false; - } - - function json(data, format) { - const prop = (format && format.property) ? field(format.property) : identity; - return isObject(data) && !isBuffer(data) - ? parseJSON(prop(data)) - : prop(JSON.parse(data)); - } - - json.responseType = 'json'; - - function parseJSON(data, format) { - return (format && format.copy) - ? JSON.parse(JSON.stringify(data)) - : data; - } - - function identity$1(x) { - return x; - } - - function transform(transform) { - if (transform == null) return identity$1; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n); - output[0] = (x0 += input[0]) * kx + dx; - output[1] = (y0 += input[1]) * ky + dy; - while (j < n) output[j] = input[j], ++j; - return output; - }; - } - - function reverse(array, n) { - var t, j = array.length, i = j - n; - while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; - } - - function feature(topology, o) { - if (typeof o === "string") o = topology.objects[o]; - return o.type === "GeometryCollection" - ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature$1(topology, o); })} - : feature$1(topology, o); - } - - function feature$1(topology, o) { - var id = o.id, - bbox = o.bbox, - properties = o.properties == null ? {} : o.properties, - geometry = object(topology, o); - return id == null && bbox == null ? {type: "Feature", properties: properties, geometry: geometry} - : bbox == null ? {type: "Feature", id: id, properties: properties, geometry: geometry} - : {type: "Feature", id: id, bbox: bbox, properties: properties, geometry: geometry}; - } - - function object(topology, o) { - var transformPoint = transform(topology.transform), - arcs = topology.arcs; - - function arc(i, points) { - if (points.length) points.pop(); - for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) { - points.push(transformPoint(a[k], k)); - } - if (i < 0) reverse(points, n); - } - - function point(p) { - return transformPoint(p); - } - - function line(arcs) { - var points = []; - for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points); - if (points.length < 2) points.push(points[0]); // This should never happen per the specification. - return points; - } - - function ring(arcs) { - var points = line(arcs); - while (points.length < 4) points.push(points[0]); // This may happen if an arc has only two points. - return points; - } - - function polygon(arcs) { - return arcs.map(ring); - } - - function geometry(o) { - var type = o.type, coordinates; - switch (type) { - case "GeometryCollection": return {type: type, geometries: o.geometries.map(geometry)}; - case "Point": coordinates = point(o.coordinates); break; - case "MultiPoint": coordinates = o.coordinates.map(point); break; - case "LineString": coordinates = line(o.arcs); break; - case "MultiLineString": coordinates = o.arcs.map(line); break; - case "Polygon": coordinates = polygon(o.arcs); break; - case "MultiPolygon": coordinates = o.arcs.map(polygon); break; - default: return null; - } - return {type: type, coordinates: coordinates}; - } - - return geometry(o); - } - - function stitch(topology, arcs) { - var stitchedArcs = {}, - fragmentByStart = {}, - fragmentByEnd = {}, - fragments = [], - emptyIndex = -1; - - // Stitch empty arcs first, since they may be subsumed by other arcs. - arcs.forEach(function(i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], t; - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) { - t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - } - }); - - arcs.forEach(function(i) { - var e = ends(i), - start = e[0], - end = e[1], - f, g; - - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else { - f = [i]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1; - if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; }); - else p1 = arc[arc.length - 1]; - return i < 0 ? [p1, p0] : [p0, p1]; - } - - function flush(fragmentByEnd, fragmentByStart) { - for (var k in fragmentByEnd) { - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; }); - fragments.push(f); - } - } - - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); }); - - return fragments; - } - - function mesh(topology) { - return object(topology, meshArcs.apply(this, arguments)); - } - - function meshArcs(topology, object, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object, filter); - else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; - return {type: "MultiLineString", arcs: stitch(topology, arcs)}; - } - - function extractArcs(topology, object, filter) { - var arcs = [], - geomsByArc = [], - geom; - - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom}); - } - - function extract1(arcs) { - arcs.forEach(extract0); - } - - function extract2(arcs) { - arcs.forEach(extract1); - } - - function extract3(arcs) { - arcs.forEach(extract2); - } - - function geometry(o) { - switch (geom = o, o.type) { - case "GeometryCollection": o.geometries.forEach(geometry); break; - case "LineString": extract1(o.arcs); break; - case "MultiLineString": case "Polygon": extract2(o.arcs); break; - case "MultiPolygon": extract3(o.arcs); break; - } - } - - geometry(object); - - geomsByArc.forEach(filter == null - ? function(geoms) { arcs.push(geoms[0].i); } - : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - - return arcs; - } - - const filters = { - interior: (a, b) => a !== b, - exterior: (a, b) => a === b - }; - - function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - - if (format && format.feature) { - method = feature; - property = format.feature; - } else if (format && format.mesh) { - method = mesh; - property = format.mesh; - filter = filters[format.filter]; - } else { - error('Missing TopoJSON feature or mesh parameter.'); - } - - object = (object = data.objects[property]) - ? method(data, object, filter) - : error('Invalid TopoJSON object: ' + property); - - return object && object.features || [object]; - } - - topojson.responseType = 'json'; - - const format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson - }; - - function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else { - return hasOwnProperty(format, name) ? format[name] : null; - } - } - - function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; - } - - function memoize(method) { - const cache = {}; - return spec => cache[spec] || (cache[spec] = method(spec)); - } - - function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; - } - - function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; - } - - function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; - } - - var ascendingBisect = bisector(ascending); - var bisectRight = ascendingBisect.right; - var bisectLeft = ascendingBisect.left; - - function variance(values, valueof) { - let count = 0; - let delta; - let mean = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - } - if (count > 1) return sum / (count - 1); - } - - function deviation(values, valueof) { - const v = variance(values, valueof); - return v ? Math.sqrt(v) : v; - } - - function sequence(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; - } - - var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - - function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; - } - - function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); - } - - function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; - } - - function max(values, valueof) { - let max; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (max < value || (max === undefined && value >= value))) { - max = value; - } - } - } - return max; - } - - function min(values, valueof) { - let min; - if (valueof === undefined) { - for (const value of values) { - if (value != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null - && (min > value || (min === undefined && value >= value))) { - min = value; - } - } - } - return min; - } - - // Based on https://github.com/mourner/quickselect - // ISC license, Copyright 2018 Vladimir Agafonkin. - function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending) { - while (right > left) { - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - - const t = array[k]; - let i = left; - let j = right; - - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - - while (i < j) { - swap(array, i, j), ++i, --j; - while (compare(array[i], t) < 0) ++i; - while (compare(array[j], t) > 0) --j; - } - - if (compare(array[left], t) === 0) swap(array, left, j); - else ++j, swap(array, j, right); - - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array; - } - - function swap(array, i, j) { - const t = array[i]; - array[i] = array[j]; - array[j] = t; - } - - function number(x) { - return x === null ? NaN : +x; - } - - function* numbers(values, valueof) { - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - yield value; - } - } - } - } - - function quantile(values, p, valueof) { - values = Float64Array.from(numbers(values, valueof)); - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return min(values); - if (p >= 1) return max(values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), - value1 = min(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); - } - - function quantileSorted(values, p, valueof = number) { - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); - } - - function mean(values, valueof) { - let count = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - ++count, sum += value; - } - } - } - if (count) return sum / count; - } - - function median(values, valueof) { - return quantile(values, 0.5, valueof); - } - - function permute(source, keys) { - return Array.from(keys, key => source[key]); - } - - function sum(values, valueof) { - let sum = 0; - if (valueof === undefined) { - for (let value of values) { - if (value = +value) { - sum += value; - } - } - } else { - let index = -1; - for (let value of values) { - if (value = +valueof(value, ++index, values)) { - sum += value; - } - } - } - return sum; - } - - // 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 undefined. - // For example, formatDecimal(1.23) returns ["123", 0]. - function formatDecimal(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = 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) : coefficient, - +x.slice(i + 1) - ]; - } - - function exponent(x) { - return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; - } - - function formatGroup(grouping, thousands) { - return function(value, width) { - var i = value.length, - t = [], - j = 0, - g = grouping[0], - length = 0; - - while (i > 0 && g > 0) { - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (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 = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; - - function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; - return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] - }); - } - - formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof - - function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; - this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; - this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; - this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; - } - - FormatSpecifier.prototype.toString = function() { - return this.fill - + this.align - + this.sign - + this.symbol - + (this.zero ? "0" : "") - + (this.width === undefined ? "" : Math.max(1, this.width | 0)) - + (this.comma ? "," : "") - + (this.precision === undefined ? "" : "." + 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 = s.length, i = 1, i0 = -1, i1; i < n; ++i) { - switch (s[i]) { - case ".": i0 = i1 = i; break; - case "0": if (i0 === 0) i0 = i; i1 = i; break; - default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break; - } - } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; - } - - var prefixExponent; - - function formatPrefixAuto(x, p) { - var d = formatDecimal(x, p); - if (!d) return x + ""; - var coefficient = d[0], - exponent = d[1], - i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, - n = coefficient.length; - return i === 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 = formatDecimal(x, p); - if (!d) return x + ""; - var coefficient = d[0], - exponent = 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 = { - "%": 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$2(x) { - return x; - } - - var map = Array.prototype.map, - prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"]; - - function d3_formatLocale(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? identity$2 : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), - currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", - currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", - decimal = locale.decimal === undefined ? "." : locale.decimal + "", - numerals = locale.numerals === undefined ? identity$2 : formatNumerals(map.call(locale.numerals, String)), - percent = locale.percent === undefined ? "%" : locale.percent + "", - minus = locale.minus === undefined ? "-" : locale.minus + "", - nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - - function newFormat(specifier) { - specifier = formatSpecifier(specifier); - - var fill = specifier.fill, - align = specifier.align, - sign = specifier.sign, - symbol = specifier.symbol, - zero = specifier.zero, - width = specifier.width, - comma = specifier.comma, - precision = specifier.precision, - trim = specifier.trim, - type = specifier.type; - - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - - // The "" type, and any invalid type, is an alias for ".12~g". - else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - - // If zero fill is specified, padding goes after sign and before digits. - if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; - - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", - suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = formatTypes[type], - maybeSuffix = /[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 = precision === undefined ? 6 - : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) - : Math.max(0, Math.min(20, precision)); - - function format(value) { - var valuePrefix = prefix, - valueSuffix = suffix, - i, n, c; - - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - - // Trim insignificant zeros. - if (trim) value = formatTrim(value); - - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while (++i < n) { - if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - } - - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, - padding = length < width ? new Array(width - length + 1).join(fill) : ""; - - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - - // Reconstruct the final output based on the desired alignment. - switch (align) { - case "<": value = valuePrefix + value + valueSuffix + padding; break; - case "=": value = valuePrefix + padding + value + valueSuffix; break; - case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; - default: value = padding + valuePrefix + value + valueSuffix; break; - } - - return numerals(value); - } - - format.toString = function() { - return specifier + ""; - }; - - return format; - } - - function formatPrefix(specifier, value) { - var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), - e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, - k = Math.pow(10, -e), - prefix = prefixes[8 + e / 3]; - return function(value) { - return f(k * value) + prefix; - }; - } - - return { - format: newFormat, - formatPrefix: formatPrefix - }; - } - - var locale; - var format$1; - var formatPrefix; - - defaultLocale({ - decimal: ".", - thousands: ",", - grouping: [3], - currency: ["$", ""], - minus: "-" - }); - - function defaultLocale(definition) { - locale = d3_formatLocale(definition); - format$1 = locale.format; - formatPrefix = locale.formatPrefix; - return locale; - } - - function precisionFixed(step) { - return Math.max(0, -exponent(Math.abs(step))); - } - - function precisionPrefix(step, value) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); - } - - function precisionRound(step, max) { - step = Math.abs(step), max = Math.abs(max) - step; - return Math.max(0, exponent(max) - exponent(step)) + 1; - } - - function trimZeroes(numberFormat, decimalChar) { - return x => { - var str = numberFormat(x), - dec = str.indexOf(decimalChar), - idx, end; - - if (dec < 0) return str; - - idx = rightmostDigit(str, dec); - end = idx < str.length ? str.slice(idx) : ''; - while (--idx > dec) if (str[idx] !== '0') { ++idx; break; } - - return str.slice(0, idx) + end; - }; - } - - function rightmostDigit(str, dec) { - var i = str.lastIndexOf('e'), c; - if (i > 0) return i; - for (i=str.length; --i > dec;) { - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit - } - } - - function numberLocale(locale) { - const format = memoize(locale.format), - formatPrefix = locale.formatPrefix; - - return { - format, - formatPrefix, - formatFloat(spec) { - var s = formatSpecifier(spec || ','); - if (s.precision == null) { - s.precision = 12; - switch (s.type) { - case '%': s.precision -= 2; break; - case 'e': s.precision -= 1; break; - } - return trimZeroes( - format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else { - return format(s); - } - }, - formatSpan(start, stop, count, specifier) { - specifier = formatSpecifier(specifier == null ? ',f' : specifier); - const step = tickStep(start, stop, count), - value = Math.max(Math.abs(start), Math.abs(stop)); - let precision; - - if (specifier.precision == null) { - switch (specifier.type) { - case 's': { - if (!isNaN(precision = precisionPrefix(step, value))) { - specifier.precision = precision; - } - return formatPrefix(specifier, value); - } - case '': - case 'e': - case 'g': - case 'p': - case 'r': { - if (!isNaN(precision = precisionRound(step, value))) { - specifier.precision = precision - (specifier.type === 'e'); - } - break; - } - case 'f': - case '%': { - if (!isNaN(precision = precisionFixed(step))) { - specifier.precision = precision - (specifier.type === '%') * 2; - } - break; - } - } - } - return format(specifier); - } - }; - } - - let defaultNumberLocale; - resetNumberFormatDefaultLocale(); - - function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: format$1, - formatPrefix: formatPrefix - }); - } - - function numberFormatLocale(definition) { - return numberLocale(d3_formatLocale(definition)); - } - - function numberFormatDefaultLocale(definition) { - return arguments.length - ? (defaultNumberLocale = numberFormatLocale(definition)) - : defaultNumberLocale; - } - - const YEAR = 'year'; - const QUARTER = 'quarter'; - const MONTH = 'month'; - const WEEK = 'week'; - const DATE = 'date'; - const DAY = 'day'; - const DAYOFYEAR = 'dayofyear'; - const HOURS = 'hours'; - const MINUTES = 'minutes'; - const SECONDS = 'seconds'; - const MILLISECONDS = 'milliseconds'; - - const TIME_UNITS = [ - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS - ]; - - const UNITS = TIME_UNITS.reduce((o, u, i) => (o[u] = 1 + i, o), {}); - - function timeUnits(units) { - const u = array(units).slice(), - m = {}; - - // check validity - if (!u.length) error('Missing time unit.'); - - u.forEach(unit => { - if (hasOwnProperty(UNITS, unit)) { - m[unit] = 1; - } else { - error(`Invalid time unit: ${unit}.`); - } - }); - - const numTypes = ( - (m[WEEK] || m[DAY] ? 1 : 0) + - (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + - (m[DAYOFYEAR] ? 1 : 0) - ); - - if (numTypes > 1) { - error(`Incompatible time units: ${units}`); - } - - // ensure proper sort order - u.sort((a, b) => UNITS[a] - UNITS[b]); - - return u; - } - - const defaultSpecifiers = { - [YEAR]: '%Y ', - [QUARTER]: 'Q%q ', - [MONTH]: '%b ', - [DATE]: '%d ', - [WEEK]: 'W%U ', - [DAY]: '%a ', - [DAYOFYEAR]: '%j ', - [HOURS]: '%H:00', - [MINUTES]: '00:%M', - [SECONDS]: ':%S', - [MILLISECONDS]: '.%L', - [`${YEAR}-${MONTH}`]: '%Y-%m ', - [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ', - [`${HOURS}-${MINUTES}`]: '%H:%M' - }; - - function timeUnitSpecifier(units, specifiers) { - const s = extend({}, defaultSpecifiers, specifiers), - u = timeUnits(units), - n = u.length; - - let fmt = '', start = 0, end, key; - - for (start=0; start start; --end) { - key = u.slice(start, end).join('-'); - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - } - - return fmt.trim(); - } - - var t0 = new Date, - t1 = new Date; - - function newInterval(floori, offseti, count, field) { - - function interval(date) { - return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date; - } - - interval.floor = function(date) { - return floori(date = new Date(+date)), date; - }; - - interval.ceil = function(date) { - return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; - }; - - interval.round = function(date) { - var d0 = interval(date), - d1 = interval.ceil(date); - return date - d0 < d1 - date ? d0 : d1; - }; - - interval.offset = function(date, step) { - return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; - }; - - interval.range = function(start, stop, step) { - var range = [], previous; - start = interval.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date - do range.push(previous = new Date(+start)), offseti(start, step), floori(start); - while (previous < start && start < stop); - return range; - }; - - interval.filter = function(test) { - return newInterval(function(date) { - if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); - }, function(date, step) { - if (date >= date) { - if (step < 0) while (++step <= 0) { - while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty - } else while (--step >= 0) { - while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty - } - } - }); - }; - - if (count) { - interval.count = function(start, end) { - t0.setTime(+start), t1.setTime(+end); - floori(t0), floori(t1); - return Math.floor(count(t0, t1)); - }; - - interval.every = function(step) { - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null - : !(step > 1) ? interval - : interval.filter(field - ? function(d) { return field(d) % step === 0; } - : function(d) { return interval.count(0, d) % step === 0; }); - }; - } - - return interval; - } - - var millisecond = 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 = function(k) { - k = 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 durationSecond = 1e3; - var durationMinute = 6e4; - var durationHour = 36e5; - var durationDay = 864e5; - var durationWeek = 6048e5; - - var second = 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 minute = newInterval(function(date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond); - }, function(date, step) { - date.setTime(+date + step * durationMinute); - }, function(start, end) { - return (end - start) / durationMinute; - }, function(date) { - return date.getMinutes(); - }); - - var hour = newInterval(function(date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute); - }, function(date, step) { - date.setTime(+date + step * durationHour); - }, function(start, end) { - return (end - start) / durationHour; - }, function(date) { - return date.getHours(); - }); - - var day = 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; - }); - - 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.getTimezoneOffset()) * durationMinute) / durationWeek; - }); - } - - var sunday = weekday(0); - var monday = weekday(1); - var tuesday = weekday(2); - var wednesday = weekday(3); - var thursday = weekday(4); - var friday = weekday(5); - var saturday = weekday(6); - - var month = 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.getFullYear()) * 12; - }, function(date) { - return date.getMonth(); - }); - - var year = 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 = function(k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(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 utcMinute = 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 utcHour = 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 utcDay = 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; - }); - - 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 = utcWeekday(0); - var utcMonday = utcWeekday(1); - var utcTuesday = utcWeekday(2); - var utcWednesday = utcWeekday(3); - var utcThursday = utcWeekday(4); - var utcFriday = utcWeekday(5); - var utcSaturday = utcWeekday(6); - - var utcMonth = 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 utcYear = 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 = function(k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(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); - }); - }; - - const t0$1 = new Date; - - function localYear(y) { - t0$1.setFullYear(y); - t0$1.setMonth(0); - t0$1.setDate(1); - t0$1.setHours(0, 0, 0, 0); - return t0$1; - } - - function dayofyear(d) { - return localDayOfYear(new Date(d)); - } - - function week(d) { - return localWeekNum(new Date(d)); - } - - function localDayOfYear(d) { - return day.count(localYear(d.getFullYear()) - 1, d); - } - - function localWeekNum(d) { - return sunday.count(localYear(d.getFullYear()) - 1, d); - } - - function localFirst(y) { - return localYear(y).getDay(); - } - - function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - return new Date(y, m, d, H, M, S, L); - } - - function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); - } - - function utcweek(d) { - return utcWeekNum(new Date(d)); - } - - function utcDayOfYear(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return utcDay.count(y - 1, d); - } - - function utcWeekNum(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return utcSunday.count(y - 1, d); - } - - function utcFirst(y) { - t0$1.setTime(Date.UTC(y, 0, 1)); - return t0$1.getUTCDay(); - } - - function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - var date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(y, m, d, H, M, S, L)); - } - - function floor(units, step, get, inv, newDate) { - const s = step || 1, - b = peek(units), - _ = (unit, p, key) => { - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - - const t = new Date, - u = toSet(units), - y = u[YEAR] ? _(YEAR) : constant(2012), - m = u[MONTH] ? _(MONTH) - : u[QUARTER] ? _(QUARTER) - : zero, - d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) - : u[WEEK] ? _(WEEK, 1) - : u[DAY] ? _(DAY, 1) - : u[DATE] ? _(DATE, 1) - : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) - : one, - H = u[HOURS] ? _(HOURS) : zero, - M = u[MINUTES] ? _(MINUTES) : zero, - S = u[SECONDS] ? _(SECONDS) : zero, - L = u[MILLISECONDS] ? _(MILLISECONDS) : zero; - - return function(v) { - t.setTime(+v); - const year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; - } - - function getUnit(f, inv, step, phase) { - const u = step <= 1 ? f - : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) - : (d, y) => step * Math.floor(f(d, y) / step); - return inv ? (d, y) => inv(u(d, y), y) : u; - } - - // returns the day of the year based on week number, day of week, - // and the day of the week for the first day of the year - function weekday$1(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; - } - - // -- LOCAL TIME -- - - const localGet = { - [YEAR]: d => d.getFullYear(), - [QUARTER]: d => Math.floor(d.getMonth() / 3), - [MONTH]: d => d.getMonth(), - [DATE]: d => d.getDate(), - [HOURS]: d => d.getHours(), - [MINUTES]: d => d.getMinutes(), - [SECONDS]: d => d.getSeconds(), - [MILLISECONDS]: d => d.getMilliseconds(), - [DAYOFYEAR]: d => localDayOfYear(d), - [WEEK]: d => localWeekNum(d), - [WEEK + DAY]: (d, y) => weekday$1(localWeekNum(d), d.getDay(), localFirst(y)), - [DAY]: (d, y) => weekday$1(1, d.getDay(), localFirst(y)) - }; - - const localInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday$1(w, 0, localFirst(y)) - }; - - function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); - } - - // -- UTC TIME -- - - const utcGet = { - [YEAR]: d => d.getUTCFullYear(), - [QUARTER]: d => Math.floor(d.getUTCMonth() / 3), - [MONTH]: d => d.getUTCMonth(), - [DATE]: d => d.getUTCDate(), - [HOURS]: d => d.getUTCHours(), - [MINUTES]: d => d.getUTCMinutes(), - [SECONDS]: d => d.getUTCSeconds(), - [MILLISECONDS]: d => d.getUTCMilliseconds(), - [DAYOFYEAR]: d => utcDayOfYear(d), - [WEEK]: d => utcWeekNum(d), - [DAY]: (d, y) => weekday$1(1, d.getUTCDay(), utcFirst(y)), - [WEEK + DAY]: (d, y) => weekday$1(utcWeekNum(d), d.getUTCDay(), utcFirst(y)) - }; - - const utcInv = { - [QUARTER]: q => 3 * q, - [WEEK]: (w, y) => weekday$1(w, 0, utcFirst(y)) - }; - - function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); - } - - const timeIntervals = { - [YEAR]: year, - [QUARTER]: month.every(3), - [MONTH]: month, - [WEEK]: sunday, - [DATE]: day, - [DAY]: day, - [DAYOFYEAR]: day, - [HOURS]: hour, - [MINUTES]: minute, - [SECONDS]: second, - [MILLISECONDS]: millisecond - }; - - const utcIntervals = { - [YEAR]: utcYear, - [QUARTER]: utcMonth.every(3), - [MONTH]: utcMonth, - [WEEK]: utcSunday, - [DATE]: utcDay, - [DAY]: utcDay, - [DAYOFYEAR]: utcDay, - [HOURS]: utcHour, - [MINUTES]: utcMinute, - [SECONDS]: second, - [MILLISECONDS]: millisecond - }; - - function timeInterval(unit) { - return timeIntervals[unit]; - } - - function utcInterval(unit) { - return utcIntervals[unit]; - } - - function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; - } - - function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); - } - - function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); - } - - function sequence$1(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; - } - - function timeSequence(unit, start, stop, step) { - return sequence$1(timeInterval(unit), start, stop, step); - } - - function utcSequence(unit, start, stop, step) { - return sequence$1(utcInterval(unit), start, stop, step); - } - - const durationSecond$1 = 1000, - durationMinute$1 = durationSecond$1 * 60, - durationHour$1 = durationMinute$1 * 60, - durationDay$1 = durationHour$1 * 24, - durationWeek$1 = durationDay$1 * 7, - durationMonth = durationDay$1 * 30, - durationYear = durationDay$1 * 365; - - const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], - Seconds = Milli.slice(0, -1), - Minutes = Seconds.slice(0, -1), - Hours = Minutes.slice(0, -1), - Day = Hours.slice(0, -1), - Week = [YEAR, WEEK], - Month = [YEAR, MONTH], - Year = [YEAR]; - - const intervals = [ - [Seconds, 1, durationSecond$1], - [Seconds, 5, 5 * durationSecond$1], - [Seconds, 15, 15 * durationSecond$1], - [Seconds, 30, 30 * durationSecond$1], - [Minutes, 1, durationMinute$1], - [Minutes, 5, 5 * durationMinute$1], - [Minutes, 15, 15 * durationMinute$1], - [Minutes, 30, 30 * durationMinute$1], - [ Hours, 1, durationHour$1 ], - [ Hours, 3, 3 * durationHour$1 ], - [ Hours, 6, 6 * durationHour$1 ], - [ Hours, 12, 12 * durationHour$1 ], - [ Day, 1, durationDay$1 ], - [ Week, 1, durationWeek$1 ], - [ Month, 1, durationMonth ], - [ Month, 3, 3 * durationMonth ], - [ Year, 1, durationYear ] - ]; - - function timeBin(opt) { - const ext = opt.extent, - max = opt.maxbins || 40, - target = Math.abs(span(ext)) / max; - - let i = bisector(i => i[2]).right(intervals, target), - units, step; - - if (i === intervals.length) { - units = Year, - step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max); - } else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max(tickStep(ext[0], ext[1], max), 1); - } - - return {units, step}; - } - - function localDate$1(d) { - if (0 <= d.y && d.y < 100) { - var date = 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$1(d) { - if (0 <= d.y && d.y < 100) { - var date = 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 newDate(y, m, d) { - return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0}; - } - - function formatLocale(locale) { - var locale_dateTime = locale.dateTime, - locale_date = locale.date, - locale_time = locale.time, - locale_periods = locale.periods, - locale_weekdays = locale.days, - locale_shortWeekdays = locale.shortDays, - locale_months = locale.months, - locale_shortMonths = locale.shortMonths; - - var periodRe = formatRe(locale_periods), - periodLookup = formatLookup(locale_periods), - weekdayRe = formatRe(locale_weekdays), - weekdayLookup = formatLookup(locale_weekdays), - shortWeekdayRe = formatRe(locale_shortWeekdays), - shortWeekdayLookup = formatLookup(locale_shortWeekdays), - monthRe = formatRe(locale_months), - monthLookup = formatLookup(locale_months), - shortMonthRe = formatRe(locale_shortMonths), - shortMonthLookup = formatLookup(locale_shortMonths); - - var formats = { - "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": formatQuarter, - "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 = { - "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": formatUTCQuarter, - "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 = { - "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": parseQuarter, - "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 = newFormat(locale_date, formats); - formats.X = newFormat(locale_time, formats); - formats.c = newFormat(locale_dateTime, formats); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - - function newFormat(specifier, formats) { - return function(date) { - var string = [], - i = -1, - j = 0, - n = specifier.length, - c, - pad, - format; - - if (!(date instanceof Date)) date = new Date(+date); - - while (++i < n) { - if (specifier.charCodeAt(i) === 37) { - string.push(specifier.slice(j, i)); - if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); - else pad = c === "e" ? " " : "0"; - if (format = formats[c]) c = format(date, pad); - string.push(c); - j = i + 1; - } - } - - string.push(specifier.slice(j, i)); - return string.join(""); - }; - } - - function newParse(specifier, Z) { - return function(string) { - var d = newDate(1900, undefined, 1), - i = parseSpecifier(d, specifier, string += "", 0), - week, day$1; - if (i != string.length) return null; - - // If a UNIX timestamp is specified, return it. - if ("Q" in d) return new Date(d.Q); - if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); - - // If this is utcParse, never use the local timezone. - if (Z && !("Z" in d)) d.Z = 0; - - // The am-pm flag is 0 for AM, and 1 for PM. - if ("p" in d) d.H = d.H % 12 + d.p * 12; - - // If the month was not specified, inherit from the quarter. - if (d.m === undefined) d.m = "q" in d ? d.q : 0; - - // 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 = 1; - if ("Z" in d) { - week = utcDate$1(newDate(d.y, 0, 1)), day$1 = week.getUTCDay(); - week = day$1 > 4 || day$1 === 0 ? utcMonday.ceil(week) : utcMonday(week); - week = utcDay.offset(week, (d.V - 1) * 7); - d.y = week.getUTCFullYear(); - d.m = week.getUTCMonth(); - d.d = week.getUTCDate() + (d.w + 6) % 7; - } else { - week = localDate$1(newDate(d.y, 0, 1)), day$1 = week.getDay(); - week = day$1 > 4 || day$1 === 0 ? monday.ceil(week) : monday(week); - week = day.offset(week, (d.V - 1) * 7); - d.y = week.getFullYear(); - d.m = week.getMonth(); - d.d = week.getDate() + (d.w + 6) % 7; - } - } else if ("W" in d || "U" in d) { - if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; - day$1 = "Z" in d ? utcDate$1(newDate(d.y, 0, 1)).getUTCDay() : localDate$1(newDate(d.y, 0, 1)).getDay(); - d.m = 0; - d.d = "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 += d.Z / 100 | 0; - d.M += d.Z % 100; - return utcDate$1(d); - } - - // Otherwise, all fields are in local time. - return localDate$1(d); - }; - } - - function parseSpecifier(d, specifier, string, j) { - var i = 0, - n = specifier.length, - m = string.length, - c, - parse; - - while (i < n) { - if (j >= m) return -1; - c = specifier.charCodeAt(i++); - if (c === 37) { - c = specifier.charAt(i++); - parse = parses[c in pads ? specifier.charAt(i++) : c]; - if (!parse || ((j = parse(d, string, j)) < 0)) return -1; - } else if (c != string.charCodeAt(j++)) { - return -1; - } - } - - return j; - } - - function parsePeriod(d, string, i) { - var n = periodRe.exec(string.slice(i)); - return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseShortWeekday(d, string, i) { - var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseWeekday(d, string, i) { - var n = weekdayRe.exec(string.slice(i)); - return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseShortMonth(d, string, i) { - var n = shortMonthRe.exec(string.slice(i)); - return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; - } - - function parseMonth(d, string, i) { - var n = monthRe.exec(string.slice(i)); - return n ? (d.m = 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() >= 12)]; - } - - function formatQuarter(d) { - return 1 + ~~(d.getMonth() / 3); - } - - 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() >= 12)]; - } - - function formatUTCQuarter(d) { - return 1 + ~~(d.getUTCMonth() / 3); - } - - return { - format: function(specifier) { - var f = newFormat(specifier += "", formats); - f.toString = function() { return specifier; }; - return f; - }, - parse: function(specifier) { - var p = newParse(specifier += "", false); - p.toString = function() { return specifier; }; - return p; - }, - utcFormat: function(specifier) { - var f = newFormat(specifier += "", utcFormats); - f.toString = function() { return specifier; }; - return f; - }, - utcParse: function(specifier) { - var p = newParse(specifier += "", true); - p.toString = function() { return specifier; }; - return p; - } - }; - } - - var pads = {"-": "", "_": " ", "0": "0"}, - numberRe = /^\s*\d+/, // note: ignores next directive - percentRe = /^%/, - requoteRe = /[\\^$*+?|[\]().{}]/g; - - function pad$2(value, fill, width) { - var sign = value < 0 ? "-" : "", - string = (sign ? -value : value) + "", - length = 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 = {}, i = -1, n = names.length; - while (++i < n) map[names[i].toLowerCase()] = i; - return map; - } - - function parseWeekdayNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.w = +n[0], i + n[0].length) : -1; - } - - function parseWeekdayNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.u = +n[0], i + n[0].length) : -1; - } - - function parseWeekNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.U = +n[0], i + n[0].length) : -1; - } - - function parseWeekNumberISO(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.V = +n[0], i + n[0].length) : -1; - } - - function parseWeekNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.W = +n[0], i + n[0].length) : -1; - } - - function parseFullYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 4)); - return n ? (d.y = +n[0], i + n[0].length) : -1; - } - - function parseYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; - } - - function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); - return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; - } - - function parseQuarter(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; - } - - function parseMonthNumber(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.m = n[0] - 1, i + n[0].length) : -1; - } - - function parseDayOfMonth(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.d = +n[0], i + n[0].length) : -1; - } - - function parseDayOfYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; - } - - function parseHour24(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.H = +n[0], i + n[0].length) : -1; - } - - function parseMinutes(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.M = +n[0], i + n[0].length) : -1; - } - - function parseSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.S = +n[0], i + n[0].length) : -1; - } - - function parseMilliseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.L = +n[0], i + n[0].length) : -1; - } - - function parseMicroseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 6)); - return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; - } - - function parseLiteralPercent(d, string, i) { - var n = percentRe.exec(string.slice(i, i + 1)); - return n ? i + n[0].length : -1; - } - - function parseUnixTimestamp(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.Q = +n[0], i + n[0].length) : -1; - } - - function parseUnixTimestampSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.s = +n[0], i + n[0].length) : -1; - } - - function formatDayOfMonth(d, p) { - return pad$2(d.getDate(), p, 2); - } - - function formatHour24(d, p) { - return pad$2(d.getHours(), p, 2); - } - - function formatHour12(d, p) { - return pad$2(d.getHours() % 12 || 12, p, 2); - } - - function formatDayOfYear(d, p) { - return pad$2(1 + day.count(year(d), d), p, 3); - } - - function formatMilliseconds(d, p) { - return pad$2(d.getMilliseconds(), p, 3); - } - - function formatMicroseconds(d, p) { - return formatMilliseconds(d, p) + "000"; - } - - function formatMonthNumber(d, p) { - return pad$2(d.getMonth() + 1, p, 2); - } - - function formatMinutes(d, p) { - return pad$2(d.getMinutes(), p, 2); - } - - function formatSeconds(d, p) { - return pad$2(d.getSeconds(), p, 2); - } - - function formatWeekdayNumberMonday(d) { - var day = d.getDay(); - return day === 0 ? 7 : day; - } - - function formatWeekNumberSunday(d, p) { - return pad$2(sunday.count(year(d) - 1, d), p, 2); - } - - function formatWeekNumberISO(d, p) { - var day = d.getDay(); - d = (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d); - return pad$2(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2); - } - - function formatWeekdayNumberSunday(d) { - return d.getDay(); - } - - function formatWeekNumberMonday(d, p) { - return pad$2(monday.count(year(d) - 1, d), p, 2); - } - - function formatYear$1(d, p) { - return pad$2(d.getFullYear() % 100, p, 2); - } - - function formatFullYear(d, p) { - return pad$2(d.getFullYear() % 10000, p, 4); - } - - function formatZone(d) { - var z = d.getTimezoneOffset(); - return (z > 0 ? "-" : (z *= -1, "+")) - + pad$2(z / 60 | 0, "0", 2) - + pad$2(z % 60, "0", 2); - } - - function formatUTCDayOfMonth(d, p) { - return pad$2(d.getUTCDate(), p, 2); - } - - function formatUTCHour24(d, p) { - return pad$2(d.getUTCHours(), p, 2); - } - - function formatUTCHour12(d, p) { - return pad$2(d.getUTCHours() % 12 || 12, p, 2); - } - - function formatUTCDayOfYear(d, p) { - return pad$2(1 + utcDay.count(utcYear(d), d), p, 3); - } - - function formatUTCMilliseconds(d, p) { - return pad$2(d.getUTCMilliseconds(), p, 3); - } - - function formatUTCMicroseconds(d, p) { - return formatUTCMilliseconds(d, p) + "000"; - } - - function formatUTCMonthNumber(d, p) { - return pad$2(d.getUTCMonth() + 1, p, 2); - } - - function formatUTCMinutes(d, p) { - return pad$2(d.getUTCMinutes(), p, 2); - } - - function formatUTCSeconds(d, p) { - return pad$2(d.getUTCSeconds(), p, 2); - } - - function formatUTCWeekdayNumberMonday(d) { - var dow = d.getUTCDay(); - return dow === 0 ? 7 : dow; - } - - function formatUTCWeekNumberSunday(d, p) { - return pad$2(utcSunday.count(utcYear(d) - 1, d), p, 2); - } - - function formatUTCWeekNumberISO(d, p) { - var day = d.getUTCDay(); - d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d); - return pad$2(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); - } - - function formatUTCWeekdayNumberSunday(d) { - return d.getUTCDay(); - } - - function formatUTCWeekNumberMonday(d, p) { - return pad$2(utcMonday.count(utcYear(d) - 1, d), p, 2); - } - - function formatUTCYear(d, p) { - return pad$2(d.getUTCFullYear() % 100, p, 2); - } - - function formatUTCFullYear(d, p) { - return pad$2(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; - var timeFormat; - var timeParse; - var utcFormat; - var utcParse; - - 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", "Sep", "Oct", "Nov", "Dec"] - }); - - function defaultLocale$1(definition) { - locale$1 = formatLocale(definition); - timeFormat = locale$1.format; - timeParse = locale$1.parse; - utcFormat = locale$1.utcFormat; - utcParse = locale$1.utcParse; - return locale$1; - } - - function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - if (!isObject(spec)) { - error(`Invalid time multi-format specifier: ${spec}`); - } - - const second = interval(SECONDS), - minute = interval(MINUTES), - hour = interval(HOURS), - day = interval(DATE), - week = interval(WEEK), - month = interval(MONTH), - quarter = interval(QUARTER), - year = interval(YEAR), - L = format(spec[MILLISECONDS] || '.%L'), - S = format(spec[SECONDS] || ':%S'), - M = format(spec[MINUTES] || '%I:%M'), - H = format(spec[HOURS] || '%I %p'), - d = format(spec[DATE] || spec[DAY] || '%a %d'), - w = format(spec[WEEK] || '%b %d'), - m = format(spec[MONTH] || '%B'), - q = format(spec[QUARTER] || '%B'), - y = format(spec[YEAR] || '%Y'); - - return date => ( - second(date) < date ? L : - minute(date) < date ? S : - hour(date) < date ? M : - day(date) < date ? H : - month(date) < date ? (week(date) < date ? d : w) : - year(date) < date ? (quarter(date) < date ? m : q) : - y)(date); - } - - function timeLocale(locale) { - const timeFormat = memoize(locale.format), - utcFormat = memoize(locale.utcFormat); - - return { - timeFormat: spec => isString(spec) - ? timeFormat(spec) - : timeMultiFormat(timeFormat, timeInterval, spec), - utcFormat: spec => isString(spec) - ? utcFormat(spec) - : timeMultiFormat(utcFormat, utcInterval, spec), - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; - } - - let defaultTimeLocale; - resetTimeFormatDefaultLocale(); - - function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: timeFormat, - parse: timeParse, - utcFormat: utcFormat, - utcParse: utcParse - }); - } - - function timeFormatLocale(definition) { - return timeLocale(formatLocale(definition)); - } - - function timeFormatDefaultLocale(definition) { - return arguments.length - ? (defaultTimeLocale = timeFormatLocale(definition)) - : defaultTimeLocale; - } - - const createLocale = (number, time) => extend({}, number, time); - - function locale$2(numberSpec, timeSpec) { - const number = numberSpec - ? numberFormatLocale(numberSpec) - : numberFormatDefaultLocale(); - - const time = timeSpec - ? timeFormatLocale(timeSpec) - : timeFormatDefaultLocale(); - - return createLocale(number, time); - } - - function defaultLocale$2(numberSpec, timeSpec) { - const args = arguments.length; - if (args && args !== 2) { - error('defaultLocale expects either zero or two arguments.'); - } - - return args - ? createLocale( - numberFormatDefaultLocale(numberSpec), - timeFormatDefaultLocale(timeSpec) - ) - : createLocale( - numberFormatDefaultLocale(), - timeFormatDefaultLocale() - ); - } - - function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale$2(); - } - - function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - - const reader = formats(schema.type || 'json'); - if (!reader) error('Unknown data format type: ' + schema.type); - - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - - if (hasOwnProperty(data, 'columns')) delete data.columns; - return data; - } - - function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - - const locale = timeFormatDefaultLocale(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - - var fields = data.columns || Object.keys(data[0]), - parsers, datum, field, i, j, n, m; - - if (types === 'auto') types = inferTypes(data, fields); - - fields = Object.keys(types); - parsers = fields.map(function(field) { - var type = types[field], - parts, pattern; - - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - - if ((pattern[0] === '\'' && pattern[pattern.length-1] === '\'') || - (pattern[0] === '"' && pattern[pattern.length-1] === '"')) { - pattern = pattern.slice(1, -1); - } - - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - - if (!typeParsers[type]) { - throw Error('Illegal format pattern: ' + field + ':' + type); - } - - return typeParsers[type]; - }); - - for (i=0, n=data.length, m=fields.length; i df.touch(target(e)); - } else if (isFunction(update)) { - op = new Operator(null, update, params, false); - func = e => { - op.evaluate(e); - const t = target(e), v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else { - func = e => df.update(target(e), update, opt); - } - - stream.apply(func); - } - - function onOperator(df, source, target, update, params, options) { - if (update === undefined) { - source.targets().add(target); - } else { - const opt = options || {}, - op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - source.targets().add(op); // add dependency - - if (target) { - op.skip(true); // skip first invocation - op.value = target.value; // initialize value - op.targets().add(target); // chain dependencies - df.connect(target, [op]); // rerank as needed, #1672 - } - } - } - - function updater(target, update) { - update = isFunction(update) ? update : constant(update); - return target - ? function(_, pulse) { - const value = update(_, pulse); - if (!target.skip()) { - target.skip(value !== this.value).value = value; - } - return value; - } - : update; - } - - /** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ - function rank(op) { - op.rank = ++this._rank; - } - - /** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ - function rerank(op) { - var queue = [op], - cur, list, i; - - while (queue.length) { - this.rank(cur = queue.pop()); - if (list = cur._targets) { - for (i=list.length; --i >= 0;) { - queue.push(cur = list[i]); - if (cur === op) error('Cycle detected in dataflow graph.'); - } - } - } - } - - /** - * Sentinel value indicating pulse propagation should stop. - */ - const StopPropagation = {}; - - // Pulse visit type flags - const ADD = (1 << 0), - REM = (1 << 1), - MOD = (1 << 2), - ADD_REM = ADD | REM, - ADD_MOD = ADD | MOD, - ALL = ADD | REM | MOD, - REFLOW = (1 << 3), - SOURCE = (1 << 4), - NO_SOURCE = (1 << 5), - NO_FIELDS = (1 << 6); - - /** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ - function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; - } - - const prototype$3 = Pulse.prototype; - - /** - * Sentinel value indicating pulse propagation should stop. - */ - prototype$3.StopPropagation = StopPropagation; - - /** - * Boolean flag indicating ADD (added) tuples. - */ - prototype$3.ADD = ADD; - - /** - * Boolean flag indicating REM (removed) tuples. - */ - prototype$3.REM = REM; - - /** - * Boolean flag indicating MOD (modified) tuples. - */ - prototype$3.MOD = MOD; - - /** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ - prototype$3.ADD_REM = ADD_REM; - - /** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ - prototype$3.ADD_MOD = ADD_MOD; - - /** - * Boolean flag indicating ADD, REM and MOD tuples. - */ - prototype$3.ALL = ALL; - - /** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ - prototype$3.REFLOW = REFLOW; - - /** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ - prototype$3.SOURCE = SOURCE; - - /** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ - prototype$3.NO_SOURCE = NO_SOURCE; - - /** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ - prototype$3.NO_FIELDS = NO_FIELDS; - - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ - prototype$3.fork = function(flags) { - return new Pulse(this.dataflow).init(this, flags); - }; - - /** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ - prototype$3.clone = function() { - const p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); - }; - - /** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ - prototype$3.addAll = function() { - let p = this; - if (!p.source || p.source.length === p.add.length) { - return p; - } else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - return p; - } - }; - - /** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ - prototype$3.init = function(src, flags) { - const p = this; - p.stamp = src.stamp; - p.encode = src.encode; - - if (src.fields && !(flags & NO_FIELDS)) { - p.fields = src.fields; - } - - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - - return p; - }; - - /** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ - prototype$3.runAfter = function(func) { - this.dataflow.runAfter(func); - }; - - /** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ - prototype$3.changed = function(flags) { - var f = flags || ALL; - return ((f & ADD) && this.add.length) - || ((f & REM) && this.rem.length) - || ((f & MOD) && this.mod.length); - }; - - /** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ - prototype$3.reflow = function(fork) { - if (fork) return this.fork(ALL).reflow(); - - var len = this.add.length, - src = this.source && this.source.length; - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); - } - return this; - }; - - /** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ - prototype$3.clean = function(value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else { - return this.cleans; - } - }; - - /** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ - prototype$3.modifies = function(_) { - var hash = this.fields || (this.fields = {}); - if (isArray(_)) { - _.forEach(f => hash[f] = true); - } else { - hash[_] = true; - } - return this; - }; - - /** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ - prototype$3.modified = function(_, nomod) { - var fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false - : !arguments.length ? !!fields - : isArray(_) ? _.some(f => fields[f]) - : fields[_]; - }; - - /** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ - prototype$3.filter = function(flags, filter) { - var p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; - }; - - function addFilter(a, b) { - return a - ? (t, i) => a(t, i) && b(t, i) - : b; - } - - /** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ - prototype$3.materialize = function(flags) { - flags = flags || ALL; - var p = this; - if ((flags & ADD) && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - if ((flags & REM) && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - if ((flags & MOD) && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - if ((flags & SOURCE) && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - return p; - }; - - function materialize(data, filter) { - var out = []; - visitArray(data, filter, _ => out.push(_)); - return out; - } - - function filter(pulse, flags) { - var map = {}; - pulse.visit(flags, function(t) { map[tupleid(t)] = 1; }); - return t => map[tupleid(t)] ? null : t; - } - - /** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ - prototype$3.visit = function(flags, visitor) { - var p = this, v = visitor, src, sum; - - if (flags & SOURCE) { - visitArray(p.source, p.srcF, v); - return p; - } - - if (flags & ADD) visitArray(p.add, p.addF, v); - if (flags & REM) visitArray(p.rem, p.remF, v); - if (flags & MOD) visitArray(p.mod, p.modF, v); - - if ((flags & REFLOW) && (src = p.source)) { - sum = p.add.length + p.mod.length; - if (sum === src.length) ; else if (sum) { - visitArray(src, filter(p, ADD_MOD), v); - } else { - // if no add/rem/mod tuples, visit source - visitArray(src, p.srcF, v); - } - } - - return p; - }; - - /** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array} pulses - The sub-pulses for this multi-pulse. - */ - function MultiPulse(dataflow, stamp, pulses, encode) { - var p = this, - c = 0, - pulse, hash, i, n, f; - - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - - for (i=0, n=pulses.length; i df._enqueue(op, true)); - df._touched = UniqueList(id); - - let count = 0, op, next, error; - - try { - while (df._heap.size() > 0) { - // dequeue operator with highest priority - op = df._heap.pop(); - - // re-queue if rank changed - if (op.rank !== op.qrank) { - df._enqueue(op, true); - continue; - } - - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - - if (next.then) { - // await if operator returns a promise directly - next = await next; - } else if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach(op => df._enqueue(op)); - } - - // increment visit counter - ++count; - } - } catch (err) { - df._heap.clear(); - error = err; - } - - // reset pulse map - df._input = {}; - df._pulse = null; - - df.debug(`Pulse ${stamp}: ${count} operators`); - - if (error) { - df._postrun = []; - df.error(error); - } - - // invoke callbacks queued via runAfter - if (df._postrun.length) { - const pr = df._postrun.sort((a, b) => b.priority - a.priority); - df._postrun = []; - for (let i=0; i df.runAsync(null, () => { - cb.forEach(f => { try { f(df); } catch (err) { df.error(err); } }); - })); - } - - return df; - } - - /** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ - async function runAsync(encode, prerun, postrun) { - // await previously queued functions - while (this._running) await this._running; - - // run dataflow, manage running promise - const clear = () => this._running = null; - (this._running = this.evaluate(encode, prerun, postrun)) - .then(clear, clear); - - return this._running; - } - - /** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ - function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) - : (this.evaluate(encode, prerun, postrun), this); - } - - /** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ - function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) { - // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - } else { - // pulse propagation already complete, invoke immediately - try { callback(this); } catch (err) { this.error(err); } - } - } - - /** - * Raise an error for re-entrant dataflow evaluation. - */ - function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; - } - - /** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ - function enqueue(op, force) { - var q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - if (q || force) { - op.qrank = op.rank; - this._heap.push(op); - } - } - - /** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ - function getPulse(op, encode) { - var s = op.source, - stamp = this._clock; - - return s && isArray(s) - ? new MultiPulse(this, stamp, s.map(_ => _.pulse), encode) - : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); - } - - function singlePulse(p, s) { - if (s && s.stamp === p.stamp) { - return s; - } - - p = p.fork(); - if (s && s !== StopPropagation) { - p.source = s.source; - } - return p; - } - - var NO_OPT = {skip: false, force: false}; - - /** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - function touch(op, options) { - var opt = options || NO_OPT; - if (this._pulse) { - // if in midst of propagation, add to priority queue - this._enqueue(op); - } else { - // otherwise, queue for next propagation - this._touched.add(op); - } - if (opt.skip) op.skip(true); - return this; - } - - /** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - function update(op, value, options) { - var opt = options || NO_OPT; - if (op.set(value) || opt.force) { - this.touch(op, opt); - } - return this; - } - - /** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ - function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - - var p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), - t = op.pulse && op.pulse.source || []; - - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - - return this; - } - - function Heap(cmp) { - var nodes = []; - return { - clear: () => nodes = [], - size: () => nodes.length, - peek: () => nodes[0], - push: x => { - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: () => { - var last = nodes.pop(), item; - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else { - item = last; - } - return item; - } - }; - } - - function siftdown(array, start, idx, cmp) { - var item, parent, pidx; - - item = array[idx]; - while (idx > start) { - pidx = (idx - 1) >> 1; - parent = array[pidx]; - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - break; - } - return (array[idx] = item); - } - - function siftup(array, idx, cmp) { - var start = idx, - end = array.length, - item = array[idx], - cidx = (idx << 1) + 1, ridx; - - while (cidx < end) { - ridx = cidx + 1; - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) { - cidx = ridx; - } - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - array[idx] = item; - return siftdown(array, start, idx, cmp); - } - - /** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ - function Dataflow() { - this.logger(logger()); - this.logLevel(Error$1); - - this._clock = 0; - this._rank = 0; - this._locale = defaultLocale$2(); - try { - this._loader = loader(); - } catch (e) { - // do nothing if loader module is unavailable - } - - this._touched = UniqueList(id); - this._input = {}; - this._pulse = null; - - this._heap = Heap((a, b) => a.qrank - b.qrank); - this._postrun = []; - } - - var prototype$5 = Dataflow.prototype; - - /** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ - prototype$5.stamp = function() { - return this._clock; - }; - - /** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ - prototype$5.loader = function(_) { - if (arguments.length) { - this._loader = _; - return this; - } else { - return this._loader; - } - }; - - /** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ - prototype$5.locale = function(_) { - if (arguments.length) { - this._locale = _; - return this; - } else { - return this._locale; - } - }; - - /** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ - prototype$5.cleanThreshold = 1e4; - - // OPERATOR REGISTRATION - prototype$5.add = add; - prototype$5.connect = connect; - prototype$5.rank = rank; - prototype$5.rerank = rerank; - - // OPERATOR UPDATES - prototype$5.pulse = pulse; - prototype$5.touch = touch; - prototype$5.update = update; - prototype$5.changeset = changeset; - - // DATA LOADING - prototype$5.ingest = ingest$1; - prototype$5.parse = parse$1; - prototype$5.preload = preload; - prototype$5.request = request; - - // EVENT HANDLING - prototype$5.events = events; - prototype$5.on = on; - - // PULSE PROPAGATION - prototype$5.evaluate = evaluate; - prototype$5.run = run; - prototype$5.runAsync = runAsync; - prototype$5.runAfter = runAfter; - prototype$5._enqueue = enqueue; - prototype$5._getPulse = getPulse; - - // LOGGING AND ERROR HANDLING - - function logMethod(method) { - return function() { - return this._log[method].apply(this, arguments); - }; - } - - /** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ - prototype$5.logger = function(logger) { - if (arguments.length) { - this._log = logger; - return this; - } else { - return this._log; - } - }; - - /** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ - prototype$5.error = logMethod('error'); - - /** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ - prototype$5.warn = logMethod('warn'); - - /** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ - prototype$5.info = logMethod('info'); - - /** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ - prototype$5.debug = logMethod('debug'); - - /** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ - prototype$5.logLevel = logMethod('level'); - - /** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ - function Transform(init, params) { - Operator.call(this, init, null, params); - } - - var prototype$6 = inherits(Transform, Operator); - - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ - prototype$6.run = function(pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - - var rv; - if (this.skip()) { - this.skip(false); - } else { - rv = this.evaluate(pulse); - } - rv = rv || pulse; - - if (rv.then) { - rv = rv.then(_ => this.pulse =_); - } else if (rv !== pulse.StopPropagation) { - this.pulse = rv; - } - - return rv; - }; - - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ - prototype$6.evaluate = function(pulse) { - var params = this.marshall(pulse.stamp), - out = this.transform(params, pulse); - params.clear(); - return out; - }; - - /** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ - prototype$6.transform = function() {}; - - var transforms = {}; - - function definition(type) { - var t = transform$1(type); - return t && t.Definition || null; - } - - function transform$1(type) { - type = type && type.toLowerCase(); - return hasOwnProperty(transforms, type) ? transforms[type] : null; - } - - function multikey(f) { - return function(x) { - var n = f.length, - i = 1, - k = String(f[0](x)); - - for (; i {}; - - const base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 - }; - - const AggregateOps = { - values: { - init: m => m.cell.store = true, - value: m => m.cell.data.values(), - idx: -1 - }, - count: { - value: m => m.cell.num - }, - __count__: { - value: m => m.missing + m.valid - }, - missing: { - value: m => m.missing - }, - valid: { - value: m => m.valid - }, - sum: { - init: m => m.sum = 0, - value: m => m.sum, - add: (m, v) => m.sum += +v, - rem: (m, v) => m.sum -= v - }, - product: { - init: m => m.product = 1, - value: m => m.valid ? m.product : undefined, - add: (m, v) => m.product *= v, - rem: (m, v) => m.product /= v - }, - mean: { - init: m => m.mean = 0, - value: m => m.valid ? m.mean : undefined, - add: (m, v) => (m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid), - rem: (m, v) => (m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean) - }, - average: { - value: m => m.valid ? m.mean : undefined, - req: ['mean'], idx: 1 - }, - variance: { - init: m => m.dev = 0, - value: m => m.valid > 1 ? m.dev / (m.valid - 1) : undefined, - add: (m, v) => m.dev += m.mean_d * (v - m.mean), - rem: (m, v) => m.dev -= m.mean_d * (v - m.mean), - req: ['mean'], idx: 1 - }, - variancep: { - value: m => m.valid > 1 ? m.dev / m.valid : undefined, - req: ['variance'], idx: 2 - }, - stdev: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined, - req: ['variance'], idx: 2 - }, - stdevp: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined, - req: ['variance'], idx: 2 - }, - stderr: { - value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined, - req: ['variance'], idx: 2 - }, - distinct: { - value: m => m.cell.data.distinct(m.get), - req: ['values'], idx: 3 - }, - ci0: { - value: m => m.cell.data.ci0(m.get), - req: ['values'], idx: 3 - }, - ci1: { - value: m => m.cell.data.ci1(m.get), - req: ['values'], idx: 3 - }, - median: { - value: m => m.cell.data.q2(m.get), - req: ['values'], idx: 3 - }, - q1: { - value: m => m.cell.data.q1(m.get), - req: ['values'], idx: 3 - }, - q3: { - value: m => m.cell.data.q3(m.get), - req: ['values'], idx: 3 - }, - min: { - init: m => m.min = undefined, - value: m => m.min = (Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min), - add: (m, v) => { if (v < m.min || m.min === undefined) m.min = v; }, - rem: (m, v) => { if (v <= m.min) m.min = NaN; }, - req: ['values'], idx: 4 - }, - max: { - init: m => m.max = undefined, - value: m => m.max = (Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max), - add: (m, v) => { if (v > m.max || m.max === undefined) m.max = v; }, - rem: (m, v) => { if (v >= m.max) m.max = NaN; }, - req: ['values'], idx: 4 - }, - argmin: { - init: m => m.argmin = undefined, - value: m => m.argmin || m.cell.data.argmin(m.get), - add: (m, v, t) => { if (v < m.min) m.argmin = t; }, - rem: (m, v) => { if (v <= m.min) m.argmin = undefined; }, - req: ['min', 'values'], idx: 3 - }, - argmax: { - init: m => m.argmax = undefined, - value: m => m.argmax || m.cell.data.argmax(m.get), - add: (m, v, t) => { if (v > m.max) m.argmax = t; }, - rem: (m, v) => { if (v >= m.max) m.argmax = undefined; }, - req: ['max', 'values'], idx: 3 - } - }; - - const ValidAggregateOps = Object.keys(AggregateOps); - - function measure(key, value) { - return out => extend({ - name: key, - out: out || key - }, base_op, value); - } - - ValidAggregateOps.forEach(key => { - AggregateOps[key] = measure(key, AggregateOps[key]); - }); - - function createMeasure(op, name) { - return AggregateOps[op](name); - } - - function compareIndex(a, b) { - return a.idx - b.idx; - } - - function resolve(agg) { - const map = {}; - agg.forEach(a => map[a.name] = a); - - const getreqs = a => { - if (!a.req) return; - a.req.forEach(key => { - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - agg.forEach(getreqs); - - return Object.values(map).sort(compareIndex); - } - - function init() { - this.valid = 0; - this.missing = 0; - this._ops.forEach(op => op.init(this)); - } - - function add$1(v, t) { - if (v == null || v === '') { ++this.missing; return; } - if (v !== v) return; - ++this.valid; - this._ops.forEach(op => op.add(this, v, t)); - } - - function rem(v, t) { - if (v == null || v === '') { --this.missing; return; } - if (v !== v) return; - --this.valid; - this._ops.forEach(op => op.rem(this, v, t)); - } - - function set(t) { - this._out.forEach(op => t[op.out] = op.value(this)); - return t; - } - - function compileMeasures(agg, field) { - var get = field || identity, - ops = resolve(agg), - out = agg.slice().sort(compareIndex); - - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - - ctr.prototype.init = init; - ctr.prototype.add = add$1; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map(op => op.out); - - return ctr; - } - - function* numbers$1(values, valueof) { - if (valueof == null) { - for (let value of values) { - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } else { - let index = -1; - for (let value of values) { - value = valueof(value, ++index, values); - if (value != null && value !== '' && (value = +value) >= value) { - yield value; - } - } - } - } - - function quantiles(array, p, f) { - var values = Float64Array.from(numbers$1(array, f)); - - // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - values.sort(ascending); - - return p.map(_ => quantileSorted(values, _)); - } - - function quartiles(array, f) { - return quantiles(array, [0.25, 0.50, 0.75], f); - } - - // Scott, D. W. (1992) Multivariate Density Estimation: - // Theory, Practice, and Visualization. Wiley. - function bandwidthNRD(array, f) { - var n = array.length, - v = deviation(array, f), - q = quartiles(array, f), - h = (q[2] - q[0]) / 1.34; - - v = Math.min(v, h) || v || Math.abs(q[0]) || 1; - - return 1.06 * v * Math.pow(n, -0.2); - } - - function bin(_) { - // determine range - var maxb = _.maxbins || 20, - base = _.base || 10, - logb = Math.log(base), - div = _.divide || [5, 2], - min = _.extent[0], - max = _.extent[1], - span = _.span || (max - min) || Math.abs(min) || 1, - step, level, minstep, precision, v, i, n, eps; - - if (_.step) { - // if step size is explicitly given, use that - step = _.step; - } else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - for (i=0, n=_.steps.length; i < n && _.steps[i] < v; ++i); - step = _.steps[Math.max(0, i-1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max( - minstep, - Math.pow(base, Math.round(Math.log(span) / logb) - level) - ); - - // increase step size if too many bins - while (Math.ceil(span/step) > maxb) { step *= base; } - - // decrease step size if allowed - for (i=0, n=div.length; i= minstep && span / v <= maxb) step = v; - } - } - - // update precision, min and max - v = Math.log(step); - precision = v >= 0 ? 0 : ~~(-v / logb) + 1; - eps = Math.pow(base, -precision - 1); - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; - } - - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; - } - - exports.random = Math.random; - - function setRandom(r) { - exports.random = r; - } - - function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [undefined, undefined]; - - var values = Float64Array.from(numbers$1(array, f)), - n = values.length, - m = samples, - a, i, j, mu; - - for (j=0, mu=Array(m); j _); - - let i = 0, j = 1, - n = array.length, - v = new Float64Array(n), - a = f(array[0]), - b = a, - w = a + step, - x; - - for (; j= w) { - b = (a + b) / 2; - for (; i> 1); - while (d < b) v[d++] = v[b]; - while (d > b) v[d--] = v[a]; - } - - // update left stack indices - a = b; - b = c; - } - - return v; - } - - function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function() { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; - } - - function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - - var dist = {}, - a, b, d; - - dist.min = function(_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else { - return a; - } - }; - - dist.max = function(_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else { - return b; - } - }; - - dist.sample = function() { - return a + Math.floor(d * exports.random()); - }; - - dist.pdf = function(x) { - return (x === Math.floor(x) && x >= a && x < b) ? 1 / d : 0; - }; - - dist.cdf = function(x) { - var v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }; - - dist.icdf = function(p) { - return (p >= 0 && p <= 1) ? a - 1 + Math.floor(p * d) : NaN; - }; - - return dist.min(min).max(max); - } - - const SQRT2PI = Math.sqrt(2 * Math.PI); - const SQRT2 = Math.SQRT2; - - let nextSample = NaN; - - function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - - let x = 0, y = 0, rds, c; - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = exports.random() * 2 - 1; - y = exports.random() * 2 - 1; - rds = x * x + y * y; - } while (rds === 0 || rds > 1); - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - x *= c; - nextSample = y * c; - } - return mean + x * stdev; - } - - function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - const z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); - } - - // Approximation from West (2009) - // Better Approximations to Cumulative Normal Functions - function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - - let cd, - z = (value - mean) / stdev, - Z = Math.abs(z); - - if (Z > 37) { - cd = 0; - } else { - let sum, exp = Math.exp(-Z * Z / 2); - if (Z < 7.07106781186547) { - sum = 3.52624965998911e-02 * Z + 0.700383064443688; - sum = sum * Z + 6.37396220353165; - sum = sum * Z + 33.912866078383; - sum = sum * Z + 112.079291497871; - sum = sum * Z + 221.213596169931; - sum = sum * Z + 220.206867912376; - cd = exp * sum; - sum = 8.83883476483184e-02 * Z + 1.75566716318264; - sum = sum * Z + 16.064177579207; - sum = sum * Z + 86.7807322029461; - sum = sum * Z + 296.564248779674; - sum = sum * Z + 637.333633378831; - sum = sum * Z + 793.826512519948; - sum = sum * Z + 440.413735824752; - cd = cd / sum; - } else { - sum = Z + 0.65; - sum = Z + 4 / sum; - sum = Z + 3 / sum; - sum = Z + 2 / sum; - sum = Z + 1 / sum; - cd = exp / sum / 2.506628274631; - } - } - return z > 0 ? 1 - cd : cd; - } - - // Approximation of Probit function using inverse error function. - function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); - } - - // Approximate inverse error function. Implementation from "Approximating - // the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. - // Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 - function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - let w = - Math.log((1 - x) * (1 + x)), p; - - if (w < 6.25) { - w -= 3.125; - p = -3.6444120640178196996e-21; - p = -1.685059138182016589e-19 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -1.333171662854620906e-16 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -4.0545662729752068639e-14 + p * w; - p = -8.1519341976054721522e-14 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -1.2975133253453532498e-11 + p * w; - p = -5.4154120542946279317e-11 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -4.1126339803469836976e-09 + p * w; - p = -2.9070369957882005086e-08 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -1.3654692000834678645e-06 + p * w; - p = -1.3882523362786468719e-05 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.00074070253416626697512 + p * w; - p = -0.0060336708714301490533 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -2.7517406297064545428e-07 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -4.013867526981545969e-06 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -4.7318229009055733981e-05 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628474796 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047313 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.0037512085075692412107 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -2.7109920616438573243e-11; - p = -2.5556418169965252055e-10 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -3.7894654401267369937e-09 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -1.4960026627149240478e-08 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -6.7711997758452339498e-08 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -9.9298272942317002539e-07 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -1.9681778105531670567e-05 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477347 + p * w; - p = -0.00013871931833623122026 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else { - p = Infinity; - } - - return p * x; - } - - function randomNormal(mean, stdev) { - var mu, - sigma, - dist = { - mean: function(_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else { - return mu; - } - }, - stdev: function(_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else { - return sigma; - } - }, - sample: () => sampleNormal(mu, sigma), - pdf: value => densityNormal(value, mu, sigma), - cdf: value => cumulativeNormal(value, mu, sigma), - icdf: p => quantileNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); - } - - // TODO: support for additional kernels? - function randomKDE(support, bandwidth) { - var kernel = randomNormal(), - dist = {}, - n = 0; - - dist.data = function(_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else { - return support; - } - }; - - dist.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = bandwidthNRD(support); - return dist; - }; - - dist.sample = function() { - return support[~~(exports.random() * n)] + bandwidth * kernel.sample(); - }; - - dist.pdf = function(x) { - for (var y=0, i=0; i sampleLogNormal(mu, sigma), - pdf: value => densityLogNormal(value, mu, sigma), - cdf: value => cumulativeLogNormal(value, mu, sigma), - icdf: p => quantileLogNormal(p, mu, sigma) - }; - - return dist.mean(mean).stdev(stdev); - } - - function randomMixture(dists, weights) { - var dist = {}, m = 0, w; - - function normalize(x) { - var w = [], sum = 0, i; - for (i=0; i= min && value <= max) ? 1 / (max - min) : 0; - } - - function cumulativeUniform(value, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); - } - - function quantileUniform(p, min, max) { - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return (p >= 0 && p <= 1) ? min + p * (max - min) : NaN; - } - - function randomUniform(min, max) { - var a, b, - dist = { - min: function(_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else { - return a; - } - }, - max: function(_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else { - return b; - } - }, - sample: () => sampleUniform(a, b), - pdf: value => densityUniform(value, a, b), - cdf: value => cumulativeUniform(value, a, b), - icdf: p => quantileUniform(p, a, b) - }; - - if (max == null) { - max = (min == null ? 1 : min); - min = 0; - } - return dist.min(min).max(max); - } - - // Ordinary Least Squares - function ols(uX, uY, uXY, uX2) { - const delta = uX2 - uX * uX, - slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, - intercept = uY - slope * uX; - - return [intercept, slope]; - } - - function points(data, x, y, sort) { - data = data.filter(d => { - let u = x(d), v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - - if (sort) { - data.sort((a, b) => x(a) - x(b)); - } - - const n = data.length, - X = new Float64Array(n), - Y = new Float64Array(n); - - // extract values, calculate means - let i = 0, ux = 0, uy = 0, xv, yv, d; - for (d of data) { - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } - - // mean center the data - for (i=0; i= u && v != null && (v = +v) >= v) { - callback(u, v, ++i); - } - } - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function rSquared(data, x, y, uY, predict) { - let SSE = 0, SST = 0; - - visitPoints(data, x, y, (dx, dy) => { - const sse = dy - predict(dx), - sst = dy - uY; - - SSE += sse * sse; - SST += sst * sst; - }); - - return 1 - SSE / SST; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function regressionLinear(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * x; - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function regressionLog(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] + coef[1] * Math.log(x); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; - } - - function regressionExp(data, x, y) { - // eslint-disable-next-line no-unused-vars - const [xv, yv, ux, uy] = points(data, x, y); - let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly, xy; - - visitPoints(data, x, y, (_, dy) => { - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - - const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), - predict = x => Math.exp(c0 + c1 * (x - ux)); - - return { - coef: [Math.exp(c0 - c1 * ux), c1], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - function regressionPow(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, YS = 0, n = 0; - - visitPoints(data, x, y, (dx, dy) => { - const lx = Math.log(dx), - ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - - const coef = ols(X, Y, XY, X2), - predict = x => coef[0] * Math.pow(x, coef[1]); - - coef[0] = Math.exp(coef[0]); - - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; - } - - function regressionQuad(data, x, y) { - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length; - - let X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, - i, dx, dy, x2; - - for (i=0; i { - x = x - ux; - return a * x * x + b * x + c + uy; - }; - - // transform coefficients back from mean-centered space - return { - coef: [ - c - b * ux + a * ux * ux + uy, - b - 2 * a * ux, - a - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; - } - - // Adapted from d3-regression by Harry Stevens - // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE - // ... which was adapted from regression-js by Tom Alexander - // Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 - // License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE - function regressionPoly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 1) return regressionLinear(data, x, y); - if (order === 2) return regressionQuad(data, x, y); - - const [xv, yv, ux, uy] = points(data, x, y), - n = xv.length, - lhs = [], - rhs = [], - k = order + 1; - - let i, j, l, v, c; - - for (i=0; i { - x -= ux; - let y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - for (i=3; i=0; --i) { - v = a[i]; - c = 1; - z[i] += v; - for (j=1; j<=i; ++j) { - c *= (i + 1 - j) / j; // binomial coefficent - z[i-j] += v * Math.pow(x, j) * c; - } - } - - // bias term - z[0] += y; - - return z; - } - - // Given an array for a two-dimensional matrix and the polynomial order, - // solve A * x = b using Gaussian elimination. - function gaussianElimination(matrix) { - const n = matrix.length - 1, - coef = []; - - let i, j, k, r, t; - - for (i = 0; i < n; ++i) { - r = i; // max row - for (j = i + 1; j < n; ++j) { - if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { - r = j; - } - } - - for (k = i; k < n + 1; ++k) { - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - - for (j = i + 1; j < n; ++j) { - for (k = n; k >= i; k--) { - matrix[k][j] -= (matrix[k][i] * matrix[i][j]) / matrix[i][i]; - } - } - } - - for (j = n - 1; j >= 0; --j) { - t = 0; - for (k = j + 1; k < n; ++k) { - t += matrix[k][j] * coef[k]; - } - coef[j] = (matrix[n][j] - t) / matrix[j][j]; - } - - return coef; - } - - const maxiters = 2, - epsilon = 1e-12; - - // Adapted from science.js by Jason Davies - // Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js - // License: https://github.com/jasondavies/science.js/blob/master/LICENSE - function regressionLoess(data, x, y, bandwidth) { - const [xv, yv, ux, uy] = points(data, x, y, true), - n = xv.length, - bw = Math.max(2, ~~(bandwidth * n)), // # nearest neighbors - yhat = new Float64Array(n), - residuals = new Float64Array(n), - robustWeights = new Float64Array(n).fill(1); - - for (let iter = -1; ++iter <= maxiters; ) { - const interval = [0, bw - 1]; - - for (let i = 0; i < n; ++i) { - const dx = xv[i], - i0 = interval[0], - i1 = interval[1], - edge = (dx - xv[i0]) > (xv[i1] - dx) ? i0 : i1; - - let W = 0, X = 0, Y = 0, XY = 0, X2 = 0, - denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - - for (let k = i0; k <= i1; ++k) { - const xk = xv[k], - yk = yv[k], - w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], - xkw = xk * w; - - W += w; - X += xkw; - Y += yk * w; - XY += yk * xkw; - X2 += xk * xkw; - } - - // linear regression fit - const [a, b] = ols(X / W, Y / W, XY / W, X2 / W); - yhat[i] = a + b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - - updateInterval(xv, i + 1, interval); - } - - if (iter === maxiters) { - break; - } - - const medianResidual = median(residuals); - if (Math.abs(medianResidual) < epsilon) break; - - for (let i = 0, arg, w; i < n; ++i){ - arg = residuals[i] / (6 * medianResidual); - // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - robustWeights[i] = (arg >= 1) ? epsilon : ((w = 1 - arg * arg) * w); - } - } - - return output(xv, yhat, ux, uy); - } - - // weighting kernel for local regression - function tricube(x) { - return (x = 1 - x * x * x) * x * x; - } - - // advance sliding window interval of nearest neighbors - function updateInterval(xv, i, interval) { - let val = xv[i], - left = interval[0], - right = interval[1] + 1; - - if (right >= xv.length) return; - - // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - while (i > left && (xv[right] - val) <= (val - xv[left])) { - interval[0] = ++left; - interval[1] = right; - ++right; - } - } - - // generate smoothed output points - // average points with repeated x values - function output(xv, yhat, ux, uy) { - const n = xv.length, out = []; - let i = 0, cnt = 0, prev = [], v; - - for (; i [x, f(x)], - minX = extent[0], - maxX = extent[1], - span = maxX - minX, - stop = span / maxSteps, - prev = [point(minX)], - next = []; - - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for (let i = 1; i < maxSteps; ++i) { - prev.push(point(minX + (i / minSteps) * span)); - } - prev.push(point(maxX)); - return prev; - } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - for (let i = minSteps; --i > 0;) { - next.push(point(minX + (i / minSteps) * span)); - } - } - - let p0 = prev[0], - p1 = next[next.length - 1]; - - while (p1) { - // midpoint for potential curve subdivision - const pm = point((p0[0] + p1[0]) / 2); - - if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) { - // maximum resolution has not yet been met, and - // subdivision midpoint sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - } else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - p1 = next[next.length - 1]; - } - - return prev; - } - - function angleDelta(p, q, r) { - const a0 = Math.atan2(r[1] - p[1], r[0] - p[0]), - a1 = Math.atan2(q[1] - p[1], q[0] - p[0]); - return Math.abs(a0 - a1); - } - - function TupleStore(key) { - this._key = key ? field(key) : tupleid; - this.reset(); - } - - var prototype$7 = TupleStore.prototype; - - prototype$7.reset = function() { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; - }; - - prototype$7.add = function(v) { - this._add.push(v); - }; - - prototype$7.rem = function(v) { - this._rem.push(v); - }; - - prototype$7.values = function() { - this._get = null; - if (this._rem.length === 0) return this._add; - - var a = this._add, - r = this._rem, - k = this._key, - n = a.length, - m = r.length, - x = Array(n - m), - map = {}, i, j, v; - - // use unique key field to clear removed values - for (i=0; i= 0) { - s = get(v[n]) + ''; - if (!hasOwnProperty(map, s)) { - map[s] = 1; - ++count; - } - } - - return count; - }; - - prototype$7.extent = function(get) { - if (this._get !== get || !this._ext) { - var v = this.values(), - i = extentIndex(v, get); - this._ext = [v[i[0]], v[i[1]]]; - this._get = get; - } - return this._ext; - }; - - prototype$7.argmin = function(get) { - return this.extent(get)[0] || {}; - }; - - prototype$7.argmax = function(get) { - return this.extent(get)[1] || {}; - }; - - prototype$7.min = function(get) { - var m = this.extent(get)[0]; - return m != null ? get(m) : undefined; - }; - - prototype$7.max = function(get) { - var m = this.extent(get)[1]; - return m != null ? get(m) : undefined; - }; - - prototype$7.quartile = function(get) { - if (this._get !== get || !this._q) { - this._q = quartiles(this.values(), get); - this._get = get; - } - return this._q; - }; - - prototype$7.q1 = function(get) { - return this.quartile(get)[0]; - }; - - prototype$7.q2 = function(get) { - return this.quartile(get)[1]; - }; - - prototype$7.q3 = function(get) { - return this.quartile(get)[2]; - }; - - prototype$7.ci = function(get) { - if (this._get !== get || !this._ci) { - this._ci = bootstrapCI(this.values(), 1000, 0.05, get); - this._get = get; - } - return this._ci; - }; - - prototype$7.ci0 = function(get) { - return this.ci(get)[0]; - }; - - prototype$7.ci1 = function(get) { - return this.ci(get)[1]; - }; - - /** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.fields] - An array of accessors to aggregate. - * @param {Array} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ - function Aggregate(params) { - Transform.call(this, null, params); - - this._adds = []; // array of added output tuples - this._mods = []; // array of modified output tuples - this._alen = 0; // number of active added tuples - this._mlen = 0; // number of active modified tuples - this._drop = true; // should empty aggregation cells be removed - this._cross = false; // produce full cross-product of group-by values - - this._dims = []; // group-by dimension accessors - this._dnames = []; // group-by dimension names - - this._measures = []; // collection of aggregation monoids - this._countOnly = false; // flag indicating only count aggregation - this._counts = null; // collection of count fields - this._prev = null; // previous aggregation cells - - this._inputs = null; // array of dependent input tuple field names - this._outputs = null; // array of output tuple field names - } - - Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidAggregateOps }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'drop', 'type': 'boolean', 'default': true }, - { 'name': 'cross', 'type': 'boolean', 'default': false }, - { 'name': 'key', 'type': 'field' } - ] - }; - - var prototype$8 = inherits(Aggregate, Transform); - - prototype$8.transform = function(_, pulse) { - var aggr = this, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - mod = _.modified(); - - aggr.stamp = out.stamp; - - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, t => aggr.add(t)); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, t => aggr.rem(t)); - pulse.visit(pulse.ADD, t => aggr.add(t)); - } - - // Indicate output fields and return aggregate tuples. - out.modifies(aggr._outputs); - - // Should empty cells be dropped? - aggr._drop = _.drop !== false; - - // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - - if (pulse.clean() && aggr._drop) { - out.clean(true).runAfter(() => this.clean()); - } - - return aggr.changes(out); - }; - - prototype$8.cross = function() { - var aggr = this, - curr = aggr.value, - dims = aggr._dnames, - vals = dims.map(function() { return {}; }), - n = dims.length; - - // collect all group-by domain values - function collect(cells) { - var key, i, t, v; - for (key in cells) { - t = cells[key].tuple; - for (i=0; i stop ? +Infinity - : ( - v = Math.max(start, Math.min(v, stop - step)), - start + step * Math.floor(EPSILON + (v - start) / step) - ); - }; - - f.start = start; - f.stop = bins.stop; - f.step = step; - - return this.value = accessor( - f, - accessorFields(field), - _.name || 'bin_' + accessorName(field) - ); - }; - - function SortedList(idFunc, source, input) { - var $ = idFunc, - data = source || [], - add = input || [], - rem = {}, - cnt = 0; - - return { - add: function(t) { add.push(t); }, - remove: function(t) { rem[$(t)] = ++cnt; }, - size: function() { return data.length; }, - data: function(compare, resort) { - if (cnt) { - data = data.filter(function(t) { return !rem[$(t)]; }); - rem = {}; - cnt = 0; - } - if (resort && compare) { - data.sort(compare); - } - if (add.length) { - data = compare - ? merge(compare, data, add.sort(compare)) - : data.concat(add); - add = []; - } - return data; - } - }; - } - - /** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ - function Collect(params) { - Transform.call(this, [], params); - } - - Collect.Definition = { - 'type': 'Collect', - 'metadata': {'source': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' } - ] - }; - - var prototype$a = inherits(Collect, Transform); - - prototype$a.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), - sort = _.sort, - mod = pulse.changed() || (sort && - (_.modified('sort') || pulse.modified(sort.fields))); - - out.visit(out.REM, list.remove); - - this.modified(mod); - this.value = out.source = list.data(stableCompare(sort), mod); - - // propagate tree root if defined - if (pulse.source && pulse.source.root) { - this.value.root = pulse.source.root; - } - - return out; - }; - - /** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - The fields to compare. - * @param {Array} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ - function Compare(params) { - Operator.call(this, null, update$1, params); - } - - inherits(Compare, Operator); - - function update$1(_) { - return (this.value && !_.modified()) - ? this.value - : compare(_.fields, _.orders); - } - - /** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ - function CountPattern(params) { - Transform.call(this, null, params); - } - - CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'case', 'type': 'enum', 'values': ['upper', 'lower', 'mixed'], 'default': 'mixed' }, - { 'name': 'pattern', 'type': 'string', 'default': '[\\w"]+' }, - { 'name': 'stopwords', 'type': 'string', 'default': '' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['text', 'count'] } - ] - }; - - function tokenize(text, tcase, match) { - switch (tcase) { - case 'upper': text = text.toUpperCase(); break; - case 'lower': text = text.toLowerCase(); break; - } - return text.match(match); - } - - var prototype$b = inherits(CountPattern, Transform); - - prototype$b.transform = function(_, pulse) { - function process(update) { - return function(tuple) { - var tokens = tokenize(get(tuple), _.case, match) || [], t; - for (var i=0, n=tokens.length; i} [params.as] - The names of the output fields. - */ - function Cross(params) { - Transform.call(this, null, params); - } - - Cross.Definition = { - 'type': 'Cross', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'filter', 'type': 'expr' }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['a', 'b'] } - ] - }; - - var prototype$c = inherits(Cross, Transform); - - prototype$c.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - data = this.value, - as = _.as || ['a', 'b'], - a = as[0], b = as[1], - reset = !data - || pulse.changed(pulse.ADD_REM) - || _.modified('as') - || _.modified('filter'); - - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || truthy); - } else { - out.mod = data; - } - - out.source = this.value; - return out.modifies(as); - }; - - function cross(input, a, b, filter) { - var data = [], - t = {}, - n = input.length, - i = 0, - j, left; - - for (; i} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ - function parse$2(def, data) { - var func = def[FUNCTION]; - if (!hasOwnProperty(Distributions, func)) { - error('Unknown distribution function: ' + func); - } - - var d = Distributions[func](); - - for (var name in def) { - // if data field, extract values - if (name === FIELD) { - d.data((def.from || data()).map(def[name])); - } - - // if distribution mixture, recurse to parse each definition - else if (name === DISTRIBUTIONS) { - d[name](def[name].map(function(_) { return parse$2(_, data); })); - } - - // otherwise, simply set the parameter - else if (typeof d[name] === FUNCTION) { - d[name](def[name]); - } - } - - return d; - } - - /** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - function Density(params) { - Transform.call(this, null, params); - } - - var distributions = [ - { - 'key': {'function': 'normal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'lognormal'}, - 'params': [ - { 'name': 'mean', 'type': 'number', 'default': 0 }, - { 'name': 'stdev', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'uniform'}, - 'params': [ - { 'name': 'min', 'type': 'number', 'default': 0 }, - { 'name': 'max', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'function': 'kde'}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'from', 'type': 'data' }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 } - ] - } - ]; - - var mixture = { - 'key': {'function': 'mixture'}, - 'params': [ - { 'name': 'distributions', 'type': 'param', 'array': true, - 'params': distributions }, - { 'name': 'weights', 'type': 'number', 'array': true } - ] - }; - - Density.Definition = { - 'type': 'Density', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'method', 'type': 'string', 'default': 'pdf', - 'values': ['pdf', 'cdf'] }, - { 'name': 'distribution', 'type': 'param', - 'params': distributions.concat(mixture) }, - { 'name': 'as', 'type': 'string', 'array': true, - 'default': ['value', 'density'] } - ] - }; - - var prototype$d = inherits(Density, Transform); - - prototype$d.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - var dist = parse$2(_.distribution, source(pulse)), - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200, - method = _.method || 'pdf'; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - if (!_.extent && !dist.data) { - error('Missing density extent parameter.'); - } - method = dist[method]; - - var as = _.as || ['value', 'density'], - domain = _.extent || extent(dist.data()), - values = sampleCurve(method, domain, minsteps, maxsteps).map(v => { - var tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return ingest(tuple); - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; - }; - - function source(pulse) { - return function() { return pulse.materialize(pulse.SOURCE).source; }; - } - - // use either provided alias or accessor field name - function fieldNames(fields, as) { - if (!fields) return null; - return fields.map(function(f, i) { - return as[i] || accessorName(f); - }); - } - - function partition(data, groupby, field) { - var groups = [], - get = function(f) { return f(t); }, - map, i, n, t, k, g; - - // partition data points into groups - if (groupby == null) { - groups.push(data.map(field)); - } else { - for (map={}, i=0, n=data.length; i} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ - function DotBin(params) { - Transform.call(this, null, params); - } - - DotBin.Definition = { - 'type': 'DotBin', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'step', 'type': 'number' }, - { 'name': 'smooth', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': Output } - ] - }; - - const prototype$e = inherits(DotBin, Transform); - - prototype$e.transform = function(_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) { - return pulse; // early exit - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(pulse.source, _.groupby, identity), - smooth = _.smooth || false, - field = _.field, - step = _.step || autostep(source, field), - sort = stableCompare((a, b) => field(a) - field(b)), - as = _.as || Output, - n = groups.length; - - // compute dotplot bins per group - let min = Infinity, max = -Infinity, i = 0, j; - for (; i max) max = v; - g[++j][as] = v; - } - } - - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); - }; - - function autostep(data, field) { - return span(extent(data, field)) / 30; - } - - /** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ - function Expression(params) { - Operator.call(this, null, update$2, params); - this.modified(true); - } - - inherits(Expression, Operator); - - function update$2(_) { - var expr = _.expr; - return this.value && !_.modified('expr') - ? this.value - : accessor( - datum => expr(datum, _), - accessorFields(expr), - accessorName(expr) - ); - } - - /** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ - function Extent(params) { - Transform.call(this, [undefined, undefined], params); - } - - Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true } - ] - }; - - var prototype$f = inherits(Extent, Transform); - - prototype$f.transform = function(_, pulse) { - var extent = this.value, - field = _.field, - min = extent[0], - max = extent[1], - mod; - - mod = pulse.changed() - || pulse.modified(field.fields) - || _.modified('field'); - - if (mod || min == null) { - min = +Infinity; - max = -Infinity; - } - - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, function(t) { - var v = toNumber(field(t)); - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - - if (!Number.isFinite(min) || !Number.isFinite(max)) { - let name = accessorName(field); - if (name) name = ` for field "${name}"`; - pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`); - min = max = undefined; - } - this.value = [min, max]; - }; - - /** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ - function Subflow(pulse, parent) { - Operator.call(this, pulse); - this.parent = parent; - this.count = 0; - } - - var prototype$g = inherits(Subflow, Operator); - - /** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ - prototype$g.connect = function(target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return (target.source = this); - }; - - /** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ - prototype$g.add = function(t) { - this.count += 1; - this.value.add.push(t); - }; - - /** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ - prototype$g.rem = function(t) { - this.count -= 1; - this.value.rem.push(t); - }; - - /** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ - prototype$g.mod = function(t) { - this.value.mod.push(t); - }; - - /** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ - prototype$g.init = function(pulse) { - this.value.init(pulse, pulse.NO_SOURCE); - }; - - /** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ - prototype$g.evaluate = function() { - // assert: this.value.stamp === pulse.stamp - return this.value; - }; - - /** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ - function Facet(params) { - Transform.call(this, {}, params); - this._keys = fastmap(); // cache previously calculated key values - - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - const a = this._targets = []; - a.active = 0; - a.forEach = f => { - for (let i=0, n=a.active; i this.subflow(key, flow, pulse); - - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - - pulse.visit(pulse.REM, t => { - const id = tupleid(t), - k = cache.get(id); - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - - pulse.visit(pulse.ADD, t => { - const k = key(t); - cache.set(tupleid(t), k); - subflow(k).add(t); - }); - - if (rekey || pulse.modified(key.fields)) { - pulse.visit(pulse.MOD, t => { - const id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 === k1) { - subflow(k1).mod(t); - } else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } else if (pulse.changed(pulse.MOD)) { - pulse.visit(pulse.MOD, t => { - subflow(cache.get(tupleid(t))).mod(t); - }); - } - - if (rekey) { - pulse.visit(pulse.REFLOW, t => { - const id = tupleid(t), - k0 = cache.get(id), - k1 = key(t); - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - } - - if (pulse.clean()) { - df.runAfter(() => { this.clean(); cache.clean(); }); - } else if (cache.empty > df.cleanThreshold) { - df.runAfter(cache.clean); - } - - return pulse; - }; - - /** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ - function Field(params) { - Operator.call(this, null, update$3, params); - } - - inherits(Field, Operator); - - function update$3(_) { - return (this.value && !_.modified()) ? this.value - : isArray(_.name) ? array(_.name).map(function(f) { return field(f); }) - : field(_.name, _.as); - } - - /** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ - function Filter(params) { - Transform.call(this, fastmap(), params); - } - - Filter.Definition = { - 'type': 'Filter', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'expr', 'type': 'expr', 'required': true } - ] - }; - - var prototype$i = inherits(Filter, Transform); - - prototype$i.transform = function(_, pulse) { - var df = pulse.dataflow, - cache = this.value, // cache ids of filtered tuples - output = pulse.fork(), - add = output.add, - rem = output.rem, - mod = output.mod, - test = _.expr, - isMod = true; - - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - if (!cache.has(id)) rem.push(t); - else cache.delete(id); - }); - - pulse.visit(pulse.ADD, function(t) { - if (test(t, _)) add.push(t); - else cache.set(tupleid(t), 1); - }); - - function revisit(t) { - var id = tupleid(t), - b = test(t, _), - s = cache.get(id); - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) { - mod.push(t); - } - } - - pulse.visit(pulse.MOD, revisit); - - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; - }; - - /** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ - function Flatten(params) { - Transform.call(this, [], params); - } - - Flatten.Definition = { - 'type': 'Flatten', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'index', 'type': 'string' }, - { 'name': 'as', 'type': 'string', 'array': true } - ] - }; - - var prototype$j = inherits(Flatten, Transform); - - prototype$j.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - as = fieldNames(fields, _.as || []), - index = _.index || null, - m = as.length; - - // remove any previous results - out.rem = this.value; - - // generate flattened tuples - pulse.visit(pulse.SOURCE, function(t) { - var arrays = fields.map(f => f(t)), - maxlen = arrays.reduce((l, a) => Math.max(l, a.length), 0), - i = 0, j, d, v; - - for (; i} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ - function Fold(params) { - Transform.call(this, [], params); - } - - Fold.Definition = { - 'type': 'Fold', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['key', 'value'] } - ] - }; - - var prototype$k = inherits(Fold, Transform); - - prototype$k.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - fields = _.fields, - fnames = fields.map(accessorName), - as = _.as || ['key', 'value'], - k = as[0], - v = as[1], - n = fields.length; - - out.rem = this.value; - - pulse.visit(pulse.SOURCE, function(t) { - for (var i=0, d; i t[as] = func(t, _)); - }; - - /** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ - function Generate(params) { - Transform.call(this, [], params); - } - - var prototype$m = inherits(Generate, Transform); - - prototype$m.transform = function(_, pulse) { - var data = this.value, - out = pulse.fork(pulse.ALL), - num = _.size - data.length, - gen = _.generator, - add, rem, t; - - if (num > 0) { - // need more tuples, generate and add - for (add=[]; --num >= 0;) { - add.push(t = ingest(gen(_))); - data.push(t); - } - out.add = out.add.length - ? out.materialize(out.ADD).add.concat(add) - : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length - ? out.materialize(out.REM).rem.concat(rem) - : rem; - data = data.slice(-num); - } - - out.source = this.value = data; - return out; - }; - - var Methods = { - value: 'value', - median: median, - mean: mean, - min: min, - max: max - }; - - var Empty = []; - - /** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ - function Impute(params) { - Transform.call(this, [], params); - } - - Impute.Definition = { - 'type': 'Impute', - 'metadata': {'changes': true}, - 'params': [ - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'key', 'type': 'field', 'required': true }, - { 'name': 'keyvals', 'array': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'enum', 'default': 'value', - 'values': ['value', 'mean', 'median', 'max', 'min'] }, - { 'name': 'value', 'default': 0 } - ] - }; - - var prototype$n = inherits(Impute, Transform); - - function getValue(_) { - var m = _.method || Methods.value, v; - - if (Methods[m] == null) { - error('Unrecognized imputation method: ' + m); - } else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return function() { return v; }; - } else { - return Methods[m]; - } - } - - function getField(_) { - var f = _.field; - return function(t) { return t ? f(t) : NaN; }; - } - - prototype$n.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - impute = getValue(_), - field = getField(_), - fName = accessorName(_.field), - kName = accessorName(_.key), - gNames = (_.groupby || []).map(accessorName), - groups = partition$1(pulse.source, _.groupby, _.key, _.keyvals), - curr = [], - prev = this.value, - m = groups.domain.length, - group, value, gVals, kVal, g, i, j, l, n, t; - - for (g=0, l=groups.length; g} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ - function KDE(params) { - Transform.call(this, null, params); - } - - KDE.Definition = { - 'type': 'KDE', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'cumulative', 'type': 'boolean', 'default': false }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'steps', 'type': 'number' }, - { 'name': 'minsteps', 'type': 'number', 'default': 25 }, - { 'name': 'maxsteps', 'type': 'number', 'default': 200 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['value', 'density'] } - ] - }; - - var prototype$p = inherits(KDE, Transform); - - prototype$p.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - bandwidth = _.bandwidth, - method = _.cumulative ? 'cdf' : 'pdf', - as = _.as || ['value', 'density'], - values = []; - - let domain = _.extent, - minsteps = _.steps || _.minsteps || 25, - maxsteps = _.steps || _.maxsteps || 200; - - if (method !== 'pdf' && method !== 'cdf') { - error('Invalid density method: ' + method); - } - - if (_.resolve === 'shared') { - if (!domain) domain = extent(source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - - groups.forEach(g => { - const density = randomKDE(g, bandwidth)[method], - scale = _.counts ? g.length : 1, - local = domain || extent(g); - - sampleCurve(density, local, minsteps, maxsteps).forEach(v => { - const t = {}; - for (let i=0; i} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ - function Key(params) { - Operator.call(this, null, update$4, params); - } - - inherits(Key, Operator); - - function update$4(_) { - return (this.value && !_.modified()) ? this.value : key(_.fields, _.flat); - } - - /** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ - function Load(params) { - Transform.call(this, [], params); - this._pending = null; - } - - var prototype$q = inherits(Load, Transform); - - prototype$q.transform = function(_, pulse) { - const df = pulse.dataflow; - - if (this._pending) { - // update state and return pulse - return output$1(this, pulse, this._pending); - } - - if (stop(_)) return pulse.StopPropagation; - - if (_.values) { - // parse and ingest values, return output pulse - return output$1(this, pulse, df.parse(_.values, _.format)); - } else if (_.async) { - // return promise for non-blocking async loading - const p = df.request(_.url, _.format).then(res => { - this._pending = array(res.data); - return df => df.touch(this); - }); - return {async: p}; - } else { - // return promise for synchronous loading - return df.request(_.url, _.format) - .then(res => output$1(this, pulse, array(res.data))); - } - }; - - function stop(_) { - return _.modified('async') && !( - _.modified('values') || _.modified('url') || _.modified('format') - ); - } - - function output$1(op, pulse, data) { - data.forEach(ingest); - const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; - } - - /** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ - function Lookup(params) { - Transform.call(this, {}, params); - } - - Lookup.Definition = { - 'type': 'Lookup', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'index', 'type': 'index', 'params': [ - {'name': 'from', 'type': 'data', 'required': true }, - {'name': 'key', 'type': 'field', 'required': true } - ] }, - { 'name': 'values', 'type': 'field', 'array': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'as', 'type': 'string', 'array': true }, - { 'name': 'default', 'default': null } - ] - }; - - var prototype$r = inherits(Lookup, Transform); - - prototype$r.transform = function(_, pulse) { - var out = pulse, - as = _.as, - keys = _.fields, - index = _.index, - values = _.values, - defaultValue = _.default==null ? null : _.default, - reset = _.modified(), - flag = reset ? pulse.SOURCE : pulse.ADD, - n = keys.length, - set, m, mods; - - if (values) { - m = values.length; - - if (n > 1 && !as) { - error('Multi-field lookup requires explicit "as" parameter.'); - } - if (as && as.length !== n * m) { - error('The "as" parameter has too few output field names.'); - } - as = as || values.map(accessorName); - - set = function(t) { - for (var i=0, k=0, j, v; i>} params.extents - The input extents. - */ - function MultiExtent(params) { - Operator.call(this, null, update$5, params); - } - - inherits(MultiExtent, Operator); - - function update$5(_) { - if (this.value && !_.modified()) { - return this.value; - } - - var min = +Infinity, - max = -Infinity, - ext = _.extents, - i, n, e; - - for (i=0, n=ext.length; i max) max = e[1]; - } - return [min, max]; - } - - /** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array>} params.values - The input value arrrays. - */ - function MultiValues(params) { - Operator.call(this, null, update$6, params); - } - - inherits(MultiValues, Operator); - - function update$6(_) { - return (this.value && !_.modified()) - ? this.value - : _.values.reduce(function(data, _) { return data.concat(_); }, []); - } - - /** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ - function Params(params) { - Transform.call(this, null, params); - } - - inherits(Params, Transform); - - Params.prototype.transform = function(_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples - }; - - /** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ - function Pivot(params) { - Aggregate.call(this, params); - } - - Pivot.Definition = { - 'type': 'Pivot', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'value', 'type': 'field', 'required': true }, - { 'name': 'op', 'type': 'enum', 'values': ValidAggregateOps, 'default': 'sum' }, - { 'name': 'limit', 'type': 'number', 'default': 0 }, - { 'name': 'key', 'type': 'field' } - ] - }; - - var prototype$s = inherits(Pivot, Aggregate); - - prototype$s._transform = prototype$s.transform; - - prototype$s.transform = function(_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); - }; - - // Shoehorn a pivot transform into an aggregate transform! - // First collect all unique pivot field values. - // Then generate aggregate fields for each output pivot field. - function aggregateParams(_, pulse) { - var key = _.field, - value = _.value, - op = (_.op === 'count' ? '__count__' : _.op) || 'sum', - fields = accessorFields(key).concat(accessorFields(value)), - keys = pivotKeys(key, _.limit || 0, pulse); - - // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - if (pulse.changed()) _.set('__pivot__', null, null, true); - - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(function() { return op; }), - fields: keys.map(function(k) { return get(k, key, value, fields); }), - as: keys.map(function(k) { return k + ''; }), - modified: _.modified.bind(_) - }; - } - - // Generate aggregate field accessor. - // Output NaN for non-existent values; aggregator will ignore! - function get(k, key, value, fields) { - return accessor( - function(d) { return key(d) === k ? value(d) : NaN; }, - fields, - k + '' - ); - } - - // Collect (and optionally limit) all unique pivot values. - function pivotKeys(key, limit, pulse) { - var map = {}, - list = []; - - pulse.visit(pulse.SOURCE, function(t) { - var k = key(t); - if (!map[k]) { - map[k] = 1; - list.push(k); - } - }); - - // TODO? Move this comparator to vega-util? - list.sort(function(u, v) { - return (uv||v==null) && u!=null ? 1 - : ((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))!==u && v===v ? -1 - : v!==v && u===u ? 1 : 0; - }); - - return limit ? list.slice(0, limit) : list; - } - - /** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array} params.field - The field - * accessor for an array of subflow tuple objects. - */ - function PreFacet(params) { - Facet.call(this, params); - } - - const prototype$t = inherits(PreFacet, Facet); - - prototype$t.transform = function(_, pulse) { - const flow = _.subflow, - field = _.field, - subflow = t => this.subflow(tupleid(t), flow, pulse, t); - - if (_.modified('field') || field && pulse.modified(accessorFields(field))) { - error('PreFacet does not support field modification.'); - } - - this.initTargets(); // reset list of active subflows - - if (field) { - pulse.visit(pulse.MOD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.mod(_)); - }); - - pulse.visit(pulse.ADD, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.add(ingest(_))); - }); - - pulse.visit(pulse.REM, t => { - const sf = subflow(t); - field(t).forEach(_ => sf.rem(_)); - }); - } else { - pulse.visit(pulse.MOD, t => subflow(t).mod(t)); - pulse.visit(pulse.ADD, t => subflow(t).add(t)); - pulse.visit(pulse.REM, t => subflow(t).rem(t)); - } - - if (pulse.clean()) { - pulse.runAfter(() => this.clean()); - } - - return pulse; - }; - - /** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ - function Project(params) { - Transform.call(this, null, params); - } - - Project.Definition = { - 'type': 'Project', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true } - ] - }; - - var prototype$u = inherits(Project, Transform); - - prototype$u.transform = function(_, pulse) { - var fields = _.fields, - as = fieldNames(_.fields, _.as || []), - derive = fields - ? function(s, t) { return project(s, t, fields, as); } - : rederive, - out, lut; - - if (this.value) { - lut = this.value; - } else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - - out = pulse.fork(pulse.NO_SOURCE); - - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, function(t) { - var dt = derive(t, ingest({})); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, function(t) { - out.mod.push(derive(t, lut[tupleid(t)])); - }); - - return out; - }; - - function project(s, t, fields, as) { - for (var i=0, n=fields.length; i} [params.groupby] - An array of accessors - * to groupby. - * @param {Array} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ - function Quantile(params) { - Transform.call(this, null, params); - } - - Quantile.Definition = { - 'type': 'Quantile', - 'metadata': {'generates': true, 'changes': true}, - 'params': [ - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'field', 'type': 'field', 'required': true }, - { 'name': 'probs', 'type': 'number', 'array': true }, - { 'name': 'step', 'type': 'number', 'default': 0.01 }, - { 'name': 'as', 'type': 'string', 'array': true, 'default': ['prob', 'value'] } - ] - }; - - var prototype$w = inherits(Quantile, Transform); - - var EPSILON$1 = 1e-14; - - prototype$w.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - as = _.as || ['prob', 'value']; - - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition(source, _.groupby, _.field), - names = (_.groupby || []).map(accessorName), - values = [], - step = _.step || 0.01, - p = _.probs || sequence(step/2, 1 - EPSILON$1, step), - n = p.length; - - groups.forEach(g => { - const q = quantiles(g, p); - - for (let i=0; i { - var id = tupleid(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - - pulse.visit(pulse.ADD, t => { - var dt = derive(t); - lut[tupleid(t)] = dt; - out.add.push(dt); - }); - - pulse.visit(pulse.MOD, t => { - var dt = lut[tupleid(t)], k; - for (k in t) { - dt[k] = t[k]; - // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - out.modifies(k); - } - out.mod.push(dt); - }); - } - - return out; - }; - - /** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ - function Sample(params) { - Transform.call(this, [], params); - this.count = 0; - } - - Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [ - { 'name': 'size', 'type': 'number', 'default': 1000 } - ] - }; - - var prototype$y = inherits(Sample, Transform); - - prototype$y.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE), - mod = _.modified('size'), - num = _.size, - res = this.value, - cnt = this.count, - cap = 0, - map = res.reduce(function(m, t) { - m[tupleid(t)] = 1; - return m; - }, {}); - - // sample reservoir update function - function update(t) { - var p, idx; - - if (res.length < num) { - res.push(t); - } else { - idx = ~~((cnt + 1) * exports.random()); - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[tupleid(p)]) out.rem.push(p); // eviction - res[idx] = t; - } - } - ++cnt; - } - - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, function(t) { - var id = tupleid(t); - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - --cnt; - }); - - // filter removed tuples out of the sample reservoir - res = res.filter(function(t) { return map[tupleid(t)] !== -1; }); - } - - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, function(t) { - // update, but skip previously sampled tuples - if (!map[tupleid(t)]) update(t); - }); - cap = -1; - } - - if (mod && res.length > num) { - for (var i=0, n=res.length-num; i max) max = b; - } - }); - - floor.start = min; - floor.stop = max; - - return pulse.modifies(band ? as : u0); - }; - - prototype$B._floor = function(_, pulse) { - const utc = _.timezone === 'utc'; - - // get parameters - let {units, step} = _.units - ? {units: _.units, step: _.step || 1} - : timeBin({ - extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }); - - // check / standardize time units - units = timeUnits(units); - - const prev = this.value || {}, - floor = (utc ? utcFloor : timeFloor)(units, step); - - floor.unit = peek(units); - floor.units = units; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; - }; - - /** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ - function TupleIndex(params) { - Transform.call(this, fastmap(), params); - } - - var prototype$C = inherits(TupleIndex, Transform); - - prototype$C.transform = function(_, pulse) { - var df = pulse.dataflow, - field = _.field, - index = this.value, - mod = true; - - function set(t) { index.set(field(t), t); } - - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, function(t) { index.delete(field(t)); }); - pulse.visit(pulse.ADD, set); - } else { - mod = false; - } - - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); - }; - - /** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ - function Values(params) { - Transform.call(this, null, params); - } - - var prototype$D = inherits(Values, Transform); - - prototype$D.transform = function(_, pulse) { - var run = !this.value - || _.modified('field') - || _.modified('sort') - || pulse.changed() - || (_.sort && pulse.modified(_.sort.fields)); - - if (run) { - this.value = (_.sort - ? pulse.source.slice().sort(stableCompare(_.sort)) - : pulse.source).map(_.field); - } - }; - - function WindowOp(op, field, param, as) { - let fn = WindowOps[op](field, param); - return { - init: fn.init || zero, - update: function(w, t) { t[as] = fn.next(w); } - }; - } - - const WindowOps = { - row_number: function() { - return { - next: w => w.index + 1 - }; - }, - rank: function() { - let rank; - return { - init: () => rank = 1, - next: w => { - let i = w.index, - data = w.data; - return (i && w.compare(data[i - 1], data[i])) ? (rank = i + 1) : rank; - } - }; - }, - dense_rank: function() { - let drank; - return { - init: () => drank = 1, - next: w => { - let i = w.index, - d = w.data; - return (i && w.compare(d[i - 1], d[i])) ? ++drank : drank; - } - }; - }, - percent_rank: function() { - let rank = WindowOps.rank(), - next = rank.next; - return { - init: rank.init, - next: w => (next(w) - 1) / (w.data.length - 1) - }; - }, - cume_dist: function() { - let cume; - return { - init: () => cume = 0, - next: w => { - let i = w.index, - d = w.data, - c = w.compare; - if (cume < i) { - while (i + 1 < d.length && !c(d[i], d[i + 1])) ++i; - cume = i; - } - return (1 + cume) / d.length; - } - }; - }, - ntile: function(field, num) { - num = +num; - if (!(num > 0)) error('ntile num must be greater than zero.'); - let cume = WindowOps.cume_dist(), - next = cume.next; - return { - init: cume.init, - next: w => Math.ceil(num * next(w)) - }; - }, - - lag: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function(field, offset) { - offset = +offset || 1; - return { - next: w => { - let i = w.index + offset, - d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - - first_value: function(field) { - return { - next: w => field(w.data[w.i0]) - }; - }, - last_value: function(field) { - return { - next: w => field(w.data[w.i1 - 1]) - }; - }, - nth_value: function(field, nth) { - nth = +nth; - if (!(nth > 0)) error('nth_value nth must be greater than zero.'); - return { - next: w => { - let i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - - prev_value: function(field) { - let prev; - return { - init: () => prev = null, - next: w => { - let v = field(w.data[w.index]); - return v != null ? (prev = v) : prev; - } - }; - }, - next_value: function(field) { - let v, i; - return { - init: () => (v = null, i = -1), - next: w => { - let d = w.data; - return w.index <= i ? v - : (i = find(field, d, w.index)) < 0 - ? (i = d.length, v = null) - : (v = field(d[i])); - } - }; - } - }; - - function find(field, data, index) { - for (let n = data.length; index < n; ++index) { - let v = field(data[index]); - if (v != null) return index; - } - return -1; - } - - var ValidWindowOps = Object.keys(WindowOps); - - function WindowState(_) { - let self = this, - ops = array(_.ops), - fields = array(_.fields), - params = array(_.params), - as = array(_.as), - outputs = self.outputs = [], - windows = self.windows = [], - inputs = {}, - map = {}, - countOnly = true, - counts = [], - measures = []; - - function visitInputs(f) { - array(accessorFields(f)).forEach(_ => inputs[_] = 1); - } - visitInputs(_.sort); - - ops.forEach(function(op, i) { - let field = fields[i], - mname = accessorName(field), - name = measureName(op, mname, as[i]); - - visitInputs(field); - outputs.push(name); - - // Window operation - if (hasOwnProperty(WindowOps, op)) { - windows.push(WindowOp(op, fields[i], params[i], name)); - } - - // Aggregate operation - else { - if (field == null && op !== 'count') { - error('Null aggregate field specified.'); - } - if (op === 'count') { - counts.push(name); - return; - } - - countOnly = false; - let m = map[mname]; - if (!m) { - m = (map[mname] = []); - m.field = field; - measures.push(m); - } - m.push(createMeasure(op, name)); - } - }); - - if (counts.length || measures.length) { - self.cell = cell(measures, counts, countOnly); - } - - self.inputs = Object.keys(inputs); - } - - const prototype$E = WindowState.prototype; - - prototype$E.init = function() { - this.windows.forEach(_ => _.init()); - if (this.cell) this.cell.init(); - }; - - prototype$E.update = function(w, t) { - let self = this, - cell = self.cell, - wind = self.windows, - data = w.data, - m = wind && wind.length, - j; - - if (cell) { - for (j=w.p0; j compileMeasures(m, m.field)); - - let cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - - if (!countOnly) { - var n = measures.length, - a = cell.agg = Array(n), - i = 0; - for (; i} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array} params.ops - An array of strings indicating window operations to perform. - * @param {Array} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array} [params.as] - An array of output field names for window operations. - * @param {Array} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ - function Window(params) { - Transform.call(this, {}, params); - this._mlen = 0; - this._mods = []; - } - - Window.Definition = { - 'type': 'Window', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'ops', 'type': 'enum', 'array': true, 'values': ValidWindowOps.concat(ValidAggregateOps) }, - { 'name': 'params', 'type': 'number', 'null': true, 'array': true }, - { 'name': 'fields', 'type': 'field', 'null': true, 'array': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'array': true }, - { 'name': 'frame', 'type': 'number', 'null': true, 'array': true, 'length': 2, 'default': [null, 0] }, - { 'name': 'ignorePeers', 'type': 'boolean', 'default': false } - ] - }; - - var prototype$F = inherits(Window, Transform); - - prototype$F.transform = function(_, pulse) { - var self = this, - state = self.state, - mod = _.modified(), - cmp = stableCompare(_.sort), - i, n; - - this.stamp = pulse.stamp; - - // initialize window state - if (!state || mod) { - state = self.state = new WindowState(_); - } - - // retrieve group for a tuple - var key = groupkey(_.groupby); - function group(t) { return self.group(key(t)); } - - // partition input tuples - if (mod || pulse.modified(state.inputs)) { - self.value = {}; - pulse.visit(pulse.SOURCE, function(t) { group(t).add(t); }); - } else { - pulse.visit(pulse.REM, function(t) { group(t).remove(t); }); - pulse.visit(pulse.ADD, function(t) { group(t).add(t); }); - } - - // perform window calculations for each modified partition - for (i=0, n=self._mlen; i 0 && !c(d[r0], d[r0-1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1+1])) w.i1 = bisect.right(d, d[r1]); - } - - var tx = /*#__PURE__*/Object.freeze({ - __proto__: null, - aggregate: Aggregate, - bin: Bin, - collect: Collect, - compare: Compare, - countpattern: CountPattern, - cross: Cross, - density: Density, - dotbin: DotBin, - expression: Expression, - extent: Extent, - facet: Facet, - field: Field, - filter: Filter, - flatten: Flatten, - fold: Fold, - formula: Formula, - generate: Generate, - impute: Impute, - joinaggregate: JoinAggregate, - kde: KDE, - key: Key, - load: Load, - lookup: Lookup, - multiextent: MultiExtent, - multivalues: MultiValues, - params: Params, - pivot: Pivot, - prefacet: PreFacet, - project: Project, - proxy: Proxy, - quantile: Quantile, - relay: Relay, - sample: Sample, - sequence: Sequence, - sieve: Sieve, - subflow: Subflow, - timeunit: TimeUnit, - tupleindex: TupleIndex, - values: Values, - window: Window - }); - - const Top = 'top'; - const Left = 'left'; - const Right = 'right'; - const Bottom = 'bottom'; - - const TopLeft = 'top-left'; - const TopRight = 'top-right'; - const BottomLeft = 'bottom-left'; - const BottomRight = 'bottom-right'; - - const Start = 'start'; - const Middle = 'middle'; - const End = 'end'; - - const X = 'x'; - const Y = 'y'; - - const Group = 'group'; - - const AxisRole = 'axis'; - const TitleRole = 'title'; - const FrameRole = 'frame'; - const ScopeRole = 'scope'; - const LegendRole = 'legend'; - - const RowHeader = 'row-header'; - const RowFooter = 'row-footer'; - const RowTitle = 'row-title'; - const ColHeader = 'column-header'; - const ColFooter = 'column-footer'; - const ColTitle = 'column-title'; - - const Padding = 'padding'; - - const Symbols = 'symbol'; - - const Fit = 'fit'; - const FitX = 'fit-x'; - const FitY = 'fit-y'; - const Pad = 'pad'; - const None$1 = 'none'; - - const All = 'all'; - const Each = 'each'; - const Flush = 'flush'; - - const Column = 'column'; - const Row = 'row'; - - var gradient_id = 0; - - function resetSVGGradientId() { - gradient_id = 0; - } - - const patternPrefix = 'p_'; - - function isGradient(value) { - return value && value.gradient; - } - - function gradientRef(g, defs, base) { - let id = g.id, - type = g.gradient, - prefix = type === 'radial' ? patternPrefix : ''; - - // check id, assign default values as needed - if (!id) { - id = g.id = 'gradient_' + (gradient_id++); - if (type === 'radial') { - g.x1 = get$1(g.x1, 0.5); - g.y1 = get$1(g.y1, 0.5); - g.r1 = get$1(g.r1, 0); - g.x2 = get$1(g.x2, 0.5); - g.y2 = get$1(g.y2, 0.5); - g.r2 = get$1(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get$1(g.x1, 0); - g.y1 = get$1(g.y1, 0); - g.x2 = get$1(g.x2, 1); - g.y2 = get$1(g.y2, 0); - } - } - - // register definition - defs[id] = g; - - // return url reference - return 'url(' + (base || '') + '#' + prefix + id + ')'; - } - - function get$1(val, def) { - return val != null ? val : def; - } - - function Gradient(p0, p1) { - var stops = [], gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function(offset, color) { - stops.push({offset: offset, color: color}); - return gradient; - } - }; - } - - var pi = Math.PI, - tau = 2 * pi, - epsilon$1 = 1e-6, - tauEpsilon = tau - epsilon$1; - - function Path() { - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - - function path() { - return new Path; - } - - Path.prototype = path.prototype = { - constructor: Path, - moveTo: function(x, y) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y); - }, - closePath: function() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - }, - lineTo: function(x, y) { - this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y); - }, - quadraticCurveTo: function(x1, y1, x, y) { - this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - bezierCurveTo: function(x1, y1, x2, y2, x, y) { - this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - arcTo: function(x1, y1, x2, y2, r) { - x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; - var x0 = this._x1, - y0 = this._y1, - x21 = x2 - x1, - y21 = y2 - y1, - x01 = x0 - x1, - y01 = y0 - y1, - l01_2 = 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 === null) { - this._ += "M" + (this._x1 = x1) + "," + (this._y1 = 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._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); - } - - // Otherwise, draw an arc! - else { - var x20 = x2 - x0, - y20 = y2 - y0, - l21_2 = x21 * x21 + y21 * y21, - l20_2 = x20 * x20 + y20 * y20, - l21 = Math.sqrt(l21_2), - l01 = Math.sqrt(l01_2), - l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), - t01 = l / l01, - t21 = l / l21; - - // If the start tangent is not coincident with (x0,y0), line to. - if (Math.abs(t01 - 1) > epsilon$1) { - this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); - } - - this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21); - } - }, - arc: function(x, y, r, a0, a1, ccw) { - x = +x, y = +y, r = +r, ccw = !!ccw; - var dx = r * Math.cos(a0), - dy = r * Math.sin(a0), - x0 = x + dx, - y0 = y + dy, - cw = 1 ^ ccw, - da = 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 === null) { - this._ += "M" + x0 + "," + y0; - } - - // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0). - else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) { - this._ += "L" + x0 + "," + y0; - } - - // Is this arc empty? We’re done. - if (!r) return; - - // Does the angle go the wrong way? Flip the direction. - if (da < 0) da = da % tau + tau; - - // Is this a complete circle? Draw two arcs to complete the circle. - if (da > tauEpsilon) { - this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0); - } - - // Is this arc non-empty? Draw an arc! - else if (da > epsilon$1) { - this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1)); - } - }, - rect: function(x, y, w, h) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z"; - }, - toString: function() { - return this._; - } - }; - - function constant$1(x) { - return function constant() { - return x; - }; - } - - var abs = Math.abs; - var atan2 = Math.atan2; - var cos = Math.cos; - var max$1 = Math.max; - var min$1 = Math.min; - var sin = Math.sin; - var sqrt = Math.sqrt; - - var epsilon$2 = 1e-12; - var pi$1 = Math.PI; - var halfPi = pi$1 / 2; - var tau$1 = 2 * pi$1; - - function acos(x) { - return x > 1 ? 0 : x < -1 ? pi$1 : Math.acos(x); - } - - function asin(x) { - return x >= 1 ? halfPi : x <= -1 ? -halfPi : 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 = x1 - x0, y10 = y1 - y0, - x32 = x3 - x2, y32 = y3 - y2, - t = y32 * x10 - x32 * y10; - if (t * t < epsilon$2) return; - t = (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 = x0 - x1, - y01 = y0 - y1, - lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), - ox = lo * y01, - oy = -lo * x01, - x11 = x0 + ox, - y11 = y0 + oy, - x10 = x1 + ox, - y10 = y1 + oy, - x00 = (x11 + x10) / 2, - y00 = (y11 + y10) / 2, - dx = x10 - x11, - dy = y10 - y11, - d2 = dx * dx + dy * dy, - r = r1 - rc, - D = x11 * y10 - x10 * y11, - d = (dy < 0 ? -1 : 1) * sqrt(max$1(0, r * r * d2 - D * D)), - cx0 = (D * dy - dx * d) / d2, - cy0 = (-D * dx - dy * d) / d2, - cx1 = (D * dy + dx * d) / d2, - cy1 = (-D * dx + dy * d) / d2, - dx0 = cx0 - x00, - dy0 = cy0 - y00, - dx1 = cx1 - x00, - dy1 = 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 = cx1, cy0 = cy1; - - return { - cx: cx0, - cy: cy0, - x01: -ox, - y01: -oy, - x11: cx0 * (r1 / r - 1), - y11: cy0 * (r1 / r - 1) - }; - } - - function d3_arc() { - var innerRadius = arcInnerRadius, - outerRadius = arcOuterRadius, - cornerRadius = constant$1(0), - padRadius = null, - startAngle = arcStartAngle, - endAngle = arcEndAngle, - padAngle = arcPadAngle, - context = null; - - function arc() { - var buffer, - r, - r0 = +innerRadius.apply(this, arguments), - r1 = +outerRadius.apply(this, arguments), - a0 = startAngle.apply(this, arguments) - halfPi, - a1 = endAngle.apply(this, arguments) - halfPi, - da = abs(a1 - a0), - cw = a1 > a0; - - if (!context) context = buffer = path(); - - // Ensure that the outer radius is always larger than the inner radius. - if (r1 < r0) r = r1, r1 = r0, r0 = r; - - // Is it a point? - if (!(r1 > epsilon$2)) context.moveTo(0, 0); - - // Or is it a circle or annulus? - else if (da > tau$1 - epsilon$2) { - context.moveTo(r1 * cos(a0), r1 * sin(a0)); - context.arc(0, 0, r1, a0, a1, !cw); - if (r0 > epsilon$2) { - context.moveTo(r0 * cos(a1), r0 * sin(a1)); - context.arc(0, 0, r0, a1, a0, cw); - } - } - - // Or is it a circular or annular sector? - else { - var a01 = a0, - a11 = a1, - a00 = a0, - a10 = a1, - da0 = da, - da1 = da, - ap = padAngle.apply(this, arguments) / 2, - rp = (ap > epsilon$2) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), - rc = min$1(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), - rc0 = rc, - rc1 = rc, - t0, - t1; - - // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. - if (rp > epsilon$2) { - var p0 = asin(rp / r0 * sin(ap)), - p1 = asin(rp / r1 * sin(ap)); - if ((da0 -= p0 * 2) > epsilon$2) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0; - else da0 = 0, a00 = a10 = (a0 + a1) / 2; - if ((da1 -= p1 * 2) > epsilon$2) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1; - else da1 = 0, a01 = a11 = (a0 + a1) / 2; - } - - var x01 = r1 * cos(a01), - y01 = r1 * sin(a01), - x10 = r0 * cos(a10), - y10 = r0 * sin(a10); - - // Apply rounded corners? - if (rc > epsilon$2) { - var x11 = r1 * cos(a11), - y11 = r1 * sin(a11), - x00 = r0 * cos(a00), - y00 = r0 * sin(a00), - oc; - - // Restrict the corner radius according to the sector angle. - if (da < pi$1 && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) { - var ax = x01 - oc[0], - ay = y01 - oc[1], - bx = x11 - oc[0], - by = y11 - oc[1], - kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), - lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = min$1(rc, (r0 - lc) / (kc - 1)); - rc1 = min$1(rc, (r1 - lc) / (kc + 1)); - } - } - - // Is the sector collapsed to a line? - if (!(da1 > epsilon$2)) context.moveTo(x01, y01); - - // Does the sector’s outer ring have rounded corners? - else if (rc1 > epsilon$2) { - t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); - t1 = 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(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); - - // Otherwise, draw the two corners and the ring. - else { - context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); - context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.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’s a circular sector? - // Or perhaps it’s an annular sector collapsed due to padding? - if (!(r0 > epsilon$2) || !(da0 > epsilon$2)) context.lineTo(x10, y10); - - // Does the sector’s inner ring (or point) have rounded corners? - else if (rc0 > epsilon$2) { - t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); - t1 = 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(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); - - // Otherwise, draw the two corners and the ring. - else { - context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); - context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.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 = null, buffer + "" || null; - } - - arc.centroid = function() { - var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, - a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$1 / 2; - return [cos(a) * r, sin(a) * r]; - }; - - arc.innerRadius = function(_) { - return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : innerRadius; - }; - - arc.outerRadius = function(_) { - return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : outerRadius; - }; - - arc.cornerRadius = function(_) { - return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : cornerRadius; - }; - - arc.padRadius = function(_) { - return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), arc) : padRadius; - }; - - arc.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : startAngle; - }; - - arc.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : endAngle; - }; - - arc.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : padAngle; - }; - - arc.context = function(_) { - return arguments.length ? ((context = _ == null ? null : _), arc) : context; - }; - - return arc; - } - - function Linear(context) { - this._context = context; - } - - Linear.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; // proceed - default: this._context.lineTo(x, y); break; - } - } - }; - - function curveLinear(context) { - return new Linear(context); - } - - function x(p) { - return p[0]; - } - - function y(p) { - return p[1]; - } - - function d3_line() { - var x$1 = x, - y$1 = y, - defined = constant$1(true), - context = null, - curve = curveLinear, - output = null; - - function line(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - - if (context == null) output = curve(buffer = path()); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) output.lineStart(); - else output.lineEnd(); - } - if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data)); - } - - if (buffer) return output = null, buffer + "" || null; - } - - line.x = function(_) { - return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant$1(+_), line) : x$1; - }; - - line.y = function(_) { - return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant$1(+_), line) : y$1; - }; - - line.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant$1(!!_), line) : defined; - }; - - line.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; - }; - - line.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; - }; - - return line; - } - - function d3_area() { - var x0 = x, - x1 = null, - y0 = constant$1(0), - y1 = y, - defined = constant$1(true), - context = null, - curve = curveLinear, - output = null; - - function area(data) { - var i, - j, - k, - n = data.length, - d, - defined0 = false, - buffer, - x0z = new Array(n), - y0z = new Array(n); - - if (context == null) output = curve(buffer = path()); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) { - j = i; - output.areaStart(); - output.lineStart(); - } else { - output.lineEnd(); - output.lineStart(); - for (k = i - 1; k >= j; --k) { - output.point(x0z[k], y0z[k]); - } - output.lineEnd(); - output.areaEnd(); - } - } - if (defined0) { - x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); - output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); - } - } - - if (buffer) return output = null, buffer + "" || null; - } - - function arealine() { - return d3_line().defined(defined).curve(curve).context(context); - } - - area.x = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$1(+_), x1 = null, area) : x0; - }; - - area.x0 = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$1(+_), area) : x0; - }; - - area.x1 = function(_) { - return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), area) : x1; - }; - - area.y = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$1(+_), y1 = null, area) : y0; - }; - - area.y0 = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$1(+_), area) : y0; - }; - - area.y1 = function(_) { - return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), area) : y1; - }; - - area.lineX0 = - area.lineY0 = function() { - return arealine().x(x0).y(y0); - }; - - area.lineY1 = function() { - return arealine().x(x0).y(y1); - }; - - area.lineX1 = function() { - return arealine().x(x1).y(y0); - }; - - area.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant$1(!!_), area) : defined; - }; - - area.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; - }; - - area.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; - }; - - return area; - } - - var circle = { - draw: function(context, size) { - var r = Math.sqrt(size / pi$1); - context.moveTo(r, 0); - context.arc(0, 0, r, 0, tau$1); - } - }; - - function d3_symbol() { - var type = constant$1(circle), - size = constant$1(64), - context = null; - - function symbol() { - var buffer; - if (!context) context = buffer = path(); - type.apply(this, arguments).draw(context, +size.apply(this, arguments)); - if (buffer) return context = null, buffer + "" || null; - } - - symbol.type = function(_) { - return arguments.length ? (type = typeof _ === "function" ? _ : constant$1(_), symbol) : type; - }; - - symbol.size = function(_) { - return arguments.length ? (size = typeof _ === "function" ? _ : constant$1(+_), symbol) : size; - }; - - symbol.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, symbol) : context; - }; - - return symbol; - } - - function noop$1() {} - - function point(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 = context; - } - - Basis.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = - this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 3: point(this, this._x1, this._y1); // proceed - case 2: this._context.lineTo(this._x1, this._y1); break; - } - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; break; - case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } - }; - - function curveBasis(context) { - return new Basis(context); - } - - function BasisClosed(context) { - this._context = context; - } - - BasisClosed.prototype = { - areaStart: noop$1, - areaEnd: noop$1, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = - this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; - this._point = 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 = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._x2 = x, this._y2 = y; break; - case 1: this._point = 2; this._x3 = x, this._y3 = y; break; - case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break; - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } - }; - - function curveBasisClosed(context) { - return new BasisClosed(context); - } - - function BasisOpen(context) { - this._context = context; - } - - BasisOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = - this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; break; - case 1: this._point = 2; break; - case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break; - case 3: this._point = 4; // proceed - default: point(this, x, y); break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } - }; - - function curveBasisOpen(context) { - return new BasisOpen(context); - } - - function Bundle(context, beta) { - this._basis = new Basis(context); - this._beta = beta; - } - - Bundle.prototype = { - lineStart: function() { - this._x = []; - this._y = []; - this._basis.lineStart(); - }, - lineEnd: function() { - var x = this._x, - y = this._y, - j = x.length - 1; - - if (j > 0) { - var x0 = x[0], - y0 = y[0], - dx = x[j] - x0, - dy = y[j] - y0, - i = -1, - t; - - while (++i <= j) { - t = 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 = this._y = null; - this._basis.lineEnd(); - }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } - }; - - var curveBundle = (function custom(beta) { - - function bundle(context) { - return beta === 1 ? new Basis(context) : new Bundle(context, beta); - } - - bundle.beta = function(beta) { - return custom(+beta); - }; - - return bundle; - })(0.85); - - function point$1(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 = context; - this._k = (1 - tension) / 6; - } - - Cardinal.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 2: this._context.lineTo(this._x2, this._y2); break; - case 3: point$1(this, this._x1, this._y1); break; - } - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; this._x1 = x, this._y1 = y; break; - case 2: this._point = 3; // proceed - default: point$1(this, x, y); break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCardinal = (function custom(tension) { - - function cardinal(context) { - return new Cardinal(context, tension); - } - - cardinal.tension = function(tension) { - return custom(+tension); - }; - - return cardinal; - })(0); - - function CardinalClosed(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; - } - - CardinalClosed.prototype = { - areaStart: noop$1, - areaEnd: noop$1, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = - this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._point = 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 = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._x3 = x, this._y3 = y; break; - case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; - case 2: this._point = 3; this._x5 = x, this._y5 = y; break; - default: point$1(this, x, y); break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCardinalClosed = (function custom(tension) { - - function cardinal(context) { - return new CardinalClosed(context, tension); - } - - cardinal.tension = function(tension) { - return custom(+tension); - }; - - return cardinal; - })(0); - - function CardinalOpen(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; - } - - CardinalOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; break; - case 1: this._point = 2; break; - case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; - case 3: this._point = 4; // proceed - default: point$1(this, x, y); break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCardinalOpen = (function custom(tension) { - - function cardinal(context) { - return new CardinalOpen(context, tension); - } - - cardinal.tension = function(tension) { - return custom(+tension); - }; - - return cardinal; - })(0); - - function point$2(that, x, y) { - var x1 = that._x1, - y1 = that._y1, - x2 = that._x2, - y2 = that._y2; - - if (that._l01_a > epsilon$2) { - var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, - n = 3 * that._l01_a * (that._l01_a + that._l12_a); - x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; - y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; - } - - if (that._l23_a > epsilon$2) { - var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, - m = 3 * that._l23_a * (that._l23_a + that._l12_a); - x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; - y2 = (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 = context; - this._alpha = alpha; - } - - CatmullRom.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = - this._l01_2a = this._l12_2a = this._l23_2a = - this._point = 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 !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; break; - case 2: this._point = 3; // proceed - default: point$2(this, x, y); break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCatmullRom = (function custom(alpha) { - - function catmullRom(context) { - return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); - } - - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - - return catmullRom; - })(0.5); - - function CatmullRomClosed(context, alpha) { - this._context = context; - this._alpha = alpha; - } - - CatmullRomClosed.prototype = { - areaStart: noop$1, - areaEnd: noop$1, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = - this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._l01_a = this._l12_a = this._l23_a = - this._l01_2a = this._l12_2a = this._l23_2a = - this._point = 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 = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: this._point = 1; this._x3 = x, this._y3 = y; break; - case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; - case 2: this._point = 3; this._x5 = x, this._y5 = y; break; - default: point$2(this, x, y); break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCatmullRomClosed = (function custom(alpha) { - - function catmullRom(context) { - return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); - } - - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - - return catmullRom; - })(0.5); - - function CatmullRomOpen(context, alpha) { - this._context = context; - this._alpha = alpha; - } - - CatmullRomOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = - this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = - this._l01_2a = this._l12_2a = this._l23_2a = - this._point = 0; - }, - lineEnd: function() { - if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - - if (this._point) { - var x23 = this._x2 - x, - y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - - switch (this._point) { - case 0: this._point = 1; break; - case 1: this._point = 2; break; - case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; - case 3: this._point = 4; // proceed - default: point$2(this, x, y); break; - } - - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } - }; - - var curveCatmullRomOpen = (function custom(alpha) { - - function catmullRom(context) { - return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); - } - - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - - return catmullRom; - })(0.5); - - function LinearClosed(context) { - this._context = context; - } - - LinearClosed.prototype = { - areaStart: noop$1, - areaEnd: noop$1, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._point) this._context.closePath(); - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) this._context.lineTo(x, y); - else this._point = 1, this._context.moveTo(x, y); - } - }; - - function curveLinearClosed(context) { - return new LinearClosed(context); - } - - function sign(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 = that._x1 - that._x0, - h1 = x2 - that._x1, - s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), - s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), - p = (s0 * h1 + s1 * h0) / (h0 + h1); - return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; - } - - // Calculate a one-sided slope. - function slope2(that, t) { - var h = 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#Representations - // "you can express cubic Hermite interpolation in terms of cubic Bézier curves - // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". - function point$3(that, t0, t1) { - var x0 = that._x0, - y0 = that._y0, - x1 = that._x1, - y1 = that._y1, - dx = (x1 - x0) / 3; - that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); - } - - function MonotoneX(context) { - this._context = context; - } - - MonotoneX.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = - this._y0 = this._y1 = - this._t0 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 2: this._context.lineTo(this._x1, this._y1); break; - case 3: point$3(this, this._t0, slope2(this, this._t0)); break; - } - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - var t1 = NaN; - - x = +x, y = +y; - if (x === this._x1 && y === this._y1) return; // Ignore coincident points. - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; break; - case 2: this._point = 3; point$3(this, slope2(this, t1 = slope3(this, x, y)), t1); break; - default: point$3(this, this._t0, t1 = slope3(this, x, y)); break; - } - - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - this._t0 = t1; - } - }; - - function MonotoneY(context) { - this._context = new ReflectContext(context); - } - - (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { - MonotoneX.prototype.point.call(this, y, x); - }; - - function ReflectContext(context) { - this._context = context; - } - - ReflectContext.prototype = { - 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.bezierCurveTo(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 = context; - } - - Natural.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = []; - this._y = []; - }, - lineEnd: function() { - var x = this._x, - y = this._y, - n = x.length; - - if (n) { - this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); - if (n === 2) { - this._context.lineTo(x[1], y[1]); - } else { - var px = controlPoints(x), - py = controlPoints(y); - for (var i0 = 0, i1 = 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 !== 0 && n === 1)) this._context.closePath(); - this._line = 1 - this._line; - this._x = this._y = 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 = x.length - 1, - m, - a = new Array(n), - b = new Array(n), - r = new Array(n); - a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; - for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; - a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; - for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; - a[n - 1] = r[n - 1] / b[n - 1]; - for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i]; - b[n - 1] = (x[n] + a[n - 1]) / 2; - for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1]; - return [a, b]; - } - - function curveNatural(context) { - return new Natural(context); - } - - function Step(context, t) { - this._context = context; - this._t = t; - } - - Step.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = this._y = NaN; - this._point = 0; - }, - lineEnd: function() { - if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); - if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); - if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch (this._point) { - case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; - case 1: this._point = 2; // proceed - default: { - if (this._t <= 0) { - this._context.lineTo(this._x, y); - this._context.lineTo(x, y); - } else { - var x1 = this._x * (1 - this._t) + x * this._t; - this._context.lineTo(x1, this._y); - this._context.lineTo(x1, y); - } - break; - } - } - this._x = x, this._y = y; - } - }; - - function curveStep(context) { - return new Step(context, 0.5); - } - - function stepBefore(context) { - return new Step(context, 0); - } - - function stepAfter(context) { - return new Step(context, 1); - } - - var lookup = { - 'basis': { - curve: curveBasis - }, - 'basis-closed': { - curve: curveBasisClosed - }, - 'basis-open': { - curve: curveBasisOpen - }, - 'bundle': { - curve: curveBundle, - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: curveCardinal, - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: curveCardinalOpen, - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: curveCardinalClosed, - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: curveCatmullRom, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: curveCatmullRomClosed, - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: curveCatmullRomOpen, - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: curveLinear - }, - 'linear-closed': { - curve: curveLinearClosed - }, - 'monotone': { - horizontal: monotoneY, - vertical: monotoneX - }, - 'natural': { - curve: curveNatural - }, - 'step': { - curve: curveStep - }, - 'step-after': { - curve: stepAfter - }, - 'step-before': { - curve: stepBefore - } - }; - - function curves(type, orientation, tension) { - var entry = hasOwnProperty(lookup, type) && lookup[type], - curve = null; - - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - if (entry.tension && tension != null) { - curve = curve[entry.tension](tension); - } - } - - return curve; - } - - // Path parsing and rendering code adapted from fabric.js -- Thanks! - var cmdlen = { m:2, l:2, h:1, v:1, c:6, s:4, q:4, t:2, a:7 }, - regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\d)([-+])/g, /\s|,|###/]; - - function pathParse(pathstr) { - var result = [], - path, - curr, - chunks, - parsed, param, - cmd, len, i, j, n, m; - - // First, break path into command sequence - path = pathstr - .slice() - .replace(regexp[0], '###$1') - .split(regexp[1]) - .slice(1); - - // Next, parse each command in turn - for (i=0, n=path.length; i len) { - for (j=1, m=parsed.length; j 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - - var a00 = cos_th / rx; - var a01 = sin_th / rx; - var a10 = (-sin_th) / ry; - var a11 = (cos_th) / ry; - var x0 = a00 * ox + a01 * oy; - var y0 = a10 * ox + a11 * oy; - var x1 = a00 * x + a01 * y; - var y1 = a10 * x + a11 * y; - - var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0); - var sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - var sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0); - var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0); - - var th0 = Math.atan2(y0-yc, x0-xc); - var th1 = Math.atan2(y1-yc, x1-xc); - - var th_arc = th1-th0; - if (th_arc < 0 && sweep === 1) { - th_arc += Tau; - } else if (th_arc > 0 && sweep === 0) { - th_arc -= Tau; - } - - var segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - var result = []; - for (var i=0; i +_; - } - - function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); - } - - function vg_rect() { - var x = rectangleX, - y = rectangleY, - width = rectangleWidth, - height = rectangleHeight, - crTL = number$1(0), - crTR = crTL, - crBL = crTL, - crBR = crTL, - context = null; - - function rectangle(_, x0, y0) { - var buffer, - x1 = x0 != null ? x0 : +x.call(this, _), - y1 = y0 != null ? y0 : +y.call(this, _), - w = +width.call(this, _), - h = +height.call(this, _), - s = Math.min(w, h) / 2, - tl = clamp(+crTL.call(this, _), 0, s), - tr = clamp(+crTR.call(this, _), 0, s), - bl = clamp(+crBL.call(this, _), 0, s), - br = clamp(+crBR.call(this, _), 0, s); - - if (!context) context = buffer = path(); - - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) { - context.rect(x1, y1, w, h); - } else { - var x2 = x1 + w, - y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - rectangle.x = function(_) { - if (arguments.length) { - x = number$1(_); - return rectangle; - } else { - return x; - } - }; - - rectangle.y = function(_) { - if (arguments.length) { - y = number$1(_); - return rectangle; - } else { - return y; - } - }; - - rectangle.width = function(_) { - if (arguments.length) { - width = number$1(_); - return rectangle; - } else { - return width; - } - }; - - rectangle.height = function(_) { - if (arguments.length) { - height = number$1(_); - return rectangle; - } else { - return height; - } - }; - - rectangle.cornerRadius = function(tl, tr, br, bl) { - if (arguments.length) { - crTL = number$1(tl); - crTR = tr != null ? number$1(tr) : crTL; - crBR = br != null ? number$1(br) : crTL; - crBL = bl != null ? number$1(bl) : crTR; - return rectangle; - } else { - return crTL; - } - }; - - rectangle.context = function(_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else { - return context; - } - }; - - return rectangle; - } - - function vg_trail() { - var x, - y, - size, - defined, - context = null, - ready, x1, y1, r1; - - function point(x2, y2, w2) { - var r2 = w2 / 2; - - if (ready) { - var ux = y1 - y2, - uy = x2 - x1; - - if (ux || uy) { - // get normal vector - var ud = Math.sqrt(ux * ux + uy * uy), - rx = (ux /= ud) * r1, - ry = (uy /= ud) * r1, - t = Math.atan2(uy, ux); - - // draw segment - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else { - context.arc(x2, y2, r2, 0, Tau); - } - context.closePath(); - } else { - ready = 1; - } - x1 = x2; - y1 = y2; - r1 = r2; - } - - function trail(data) { - var i, - n = data.length, - d, - defined0 = false, - buffer; - - if (context == null) context = buffer = path(); - - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - - if (buffer) { - context = null; - return buffer + '' || null; - } - } - - trail.x = function(_) { - if (arguments.length) { - x = _; - return trail; - } else { - return x; - } - }; - - trail.y = function(_) { - if (arguments.length) { - y = _; - return trail; - } else { - return y; - } - }; - - trail.size = function(_) { - if (arguments.length) { - size = _; - return trail; - } else { - return size; - } - }; - - trail.defined = function(_) { - if (arguments.length) { - defined = _; - return trail; - } else { - return defined; - } - }; - - trail.context = function(_) { - if (arguments.length) { - if (_ == null) { - context = null; - } else { - context = _; - } - return trail; - } else { - return context; - } - }; - - return trail; - } - - function value(a, b) { - return a != null ? a : b; - } - - const x$1 = item => item.x || 0, - y$1 = item => item.y || 0, - w = item => item.width || 0, - h = item => item.height || 0, - xw = item => (item.x || 0) + (item.width || 0), - yh = item => (item.y || 0) + (item.height || 0), - sa = item => item.startAngle || 0, - ea = item => item.endAngle || 0, - pa = item => item.padAngle || 0, - ir = item => item.innerRadius || 0, - or = item => item.outerRadius || 0, - cr = item => item.cornerRadius || 0, - tl = item => value(item.cornerRadiusTopLeft, item.cornerRadius) || 0, - tr = item => value(item.cornerRadiusTopRight, item.cornerRadius) || 0, - br = item => value(item.cornerRadiusBottomRight, item.cornerRadius) || 0, - bl = item => value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, - sz = item => value(item.size, 64), - ts = item => item.size || 1, - def = item => !(item.defined === false), - type = item => symbols(item.shape || 'circle'); - - const arcShape = d3_arc().startAngle(sa).endAngle(ea).padAngle(pa) - .innerRadius(ir).outerRadius(or).cornerRadius(cr), - areavShape = d3_area().x(x$1).y1(y$1).y0(yh).defined(def), - areahShape = d3_area().y(y$1).x1(x$1).x0(xw).defined(def), - lineShape = d3_line().x(x$1).y(y$1).defined(def), - rectShape = vg_rect().x(x$1).y(y$1).width(w).height(h) - .cornerRadius(tl, tr, br, bl), - symbolShape = d3_symbol().type(type).size(sz), - trailShape = vg_trail().x(x$1).y(y$1).defined(def).size(ts); - - function hasCornerRadius(item) { - return item.cornerRadius - || item.cornerRadiusTopLeft - || item.cornerRadiusTopRight - || item.cornerRadiusBottomRight - || item.cornerRadiusBottomLeft; - } - - function arc(context, item) { - return arcShape.context(context)(item); - } - - function area(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape) - .curve(curves(interp, item.orient, item.tension)) - .context(context)(items); - } - - function line(context, items) { - var item = items[0], - interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)) - .context(context)(items); - } - - function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); - } - - function shape(context, item) { - return (item.mark.shape || item.shape) - .context(context)(item); - } - - function symbol(context, item) { - return symbolShape.context(context)(item); - } - - function trail(context, items) { - return trailShape.context(context)(items); - } - - var clip_id = 1; - - function resetSVGClipId() { - clip_id = 1; - } - - function clip(renderer, item, size) { - var clip = item.clip, - defs = renderer._defs, - id = item.clip_id || (item.clip_id = 'clip' + clip_id++), - c = defs.clipping[id] || (defs.clipping[id] = {id: id}); - - if (isFunction(clip)) { - c.path = clip(null); - } else if (hasCornerRadius(size)) { - c.path = rectangle(null, size, 0, 0); - } else { - c.width = size.width || 0; - c.height = size.height || 0; - } - - return 'url(#' + id + ')'; - } - - function Bounds(b) { - this.clear(); - if (b) this.union(b); - } - - var prototype$G = Bounds.prototype; - - prototype$G.clone = function() { - return new Bounds(this); - }; - - prototype$G.clear = function() { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; - }; - - prototype$G.empty = function() { - return ( - this.x1 === +Number.MAX_VALUE && - this.y1 === +Number.MAX_VALUE && - this.x2 === -Number.MAX_VALUE && - this.y2 === -Number.MAX_VALUE - ); - }; - - prototype$G.equals = function(b) { - return ( - this.x1 === b.x1 && - this.y1 === b.y1 && - this.x2 === b.x2 && - this.y2 === b.y2 - ); - }; - - prototype$G.set = function(x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; - } - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; - } - return this; - }; - - prototype$G.add = function(x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; - }; - - prototype$G.expand = function(d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; - }; - - prototype$G.round = function() { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; - }; - - prototype$G.scale = function(s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; - }; - - prototype$G.translate = function(dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; - }; - - prototype$G.rotate = function(angle, x, y) { - const p = this.rotatedPoints(angle, x, y); - return this.clear() - .add(p[0], p[1]) - .add(p[2], p[3]) - .add(p[4], p[5]) - .add(p[6], p[7]); - }; - - prototype$G.rotatedPoints = function(angle, x, y) { - var {x1, y1, x2, y2} = this, - cos = Math.cos(angle), - sin = Math.sin(angle), - cx = x - x*cos + y*sin, - cy = y - x*sin - y*cos; - - return [ - cos*x1 - sin*y1 + cx, sin*x1 + cos*y1 + cy, - cos*x1 - sin*y2 + cx, sin*x1 + cos*y2 + cy, - cos*x2 - sin*y1 + cx, sin*x2 + cos*y1 + cy, - cos*x2 - sin*y2 + cx, sin*x2 + cos*y2 + cy - ]; - }; - - prototype$G.union = function(b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; - }; - - prototype$G.intersect = function(b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; - }; - - prototype$G.encloses = function(b) { - return b && ( - this.x1 <= b.x1 && - this.x2 >= b.x2 && - this.y1 <= b.y1 && - this.y2 >= b.y2 - ); - }; - - prototype$G.alignsWith = function(b) { - return b && ( - this.x1 == b.x1 || - this.x2 == b.x2 || - this.y1 == b.y1 || - this.y2 == b.y2 - ); - }; - - prototype$G.intersects = function(b) { - return b && !( - this.x2 < b.x1 || - this.x1 > b.x2 || - this.y2 < b.y1 || - this.y1 > b.y2 - ); - }; - - prototype$G.contains = function(x, y) { - return !( - x < this.x1 || - x > this.x2 || - y < this.y1 || - y > this.y2 - ); - }; - - prototype$G.width = function() { - return this.x2 - this.x1; - }; - - prototype$G.height = function() { - return this.y2 - this.y1; - }; - - function Item(mark) { - this.mark = mark; - this.bounds = (this.bounds || new Bounds()); - } - - function GroupItem(mark) { - Item.call(this, mark); - this.items = (this.items || []); - } - - inherits(GroupItem, Item); - - function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - var c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } - } - return null; - } - - function domImage() { - return typeof Image !== 'undefined' ? Image : null; - } - - function ResourceLoader(customLoader) { - this._pending = 0; - this._loader = customLoader || loader(); - } - - var prototype$H = ResourceLoader.prototype; - - prototype$H.pending = function() { - return this._pending; - }; - - function increment(loader) { - loader._pending += 1; - } - - function decrement(loader) { - loader._pending -= 1; - } - - prototype$H.sanitizeURL = function(uri) { - var loader = this; - increment(loader); - - return loader._loader.sanitize(uri, {context:'href'}) - .then(function(opt) { - decrement(loader); - return opt; - }) - .catch(function() { - decrement(loader); - return null; - }); - }; - - prototype$H.loadImage = function(uri) { - const loader = this, - Image = domImage(); - increment(loader); - - return loader._loader - .sanitize(uri, {context: 'image'}) - .then(function(opt) { - const url = opt.href; - if (!url || !Image) throw {url: url}; - - const img = new Image(); - - // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - const cors = hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; - - // attempt to load image resource - img.onload = () => decrement(loader); - img.onerror = () => decrement(loader); - img.src = url; - - return img; - }) - .catch(function(e) { - decrement(loader); - return {complete: false, width: 0, height: 0, src: e && e.url || ''}; - }); - }; - - prototype$H.ready = function() { - var loader = this; - return new Promise(function(accept) { - function poll(value) { - if (!loader.pending()) accept(value); - else setTimeout(function() { poll(true); }, 10); - } - poll(false); - }); - }; - - function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - const sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - return bounds; - } - - function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; - } - - var bounds, lx, ly, - circleThreshold = Tau - 1e-8; - - function context(_) { - bounds = _; - return context; - } - - function noop$2() {} - - function add$2(x, y) { bounds.add(x, y); } - - function addL(x, y) { add$2(lx = x, ly = y); } - - function addX(x) { add$2(x, bounds.y1); } - - function addY(y) { add$2(bounds.x1, y); } - - context.beginPath = noop$2; - - context.closePath = noop$2; - - context.moveTo = addL; - - context.lineTo = addL; - - context.rect = function(x, y, w, h) { - add$2(x + w, y + h); - addL(x, y); - }; - - context.quadraticCurveTo = function(x1, y1, x2, y2) { - quadExtrema(lx, x1, x2, addX); - quadExtrema(ly, y1, y2, addY); - addL(x2, y2); - }; - - function quadExtrema(x0, x1, x2, cb) { - const t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); - } - - context.bezierCurveTo = function(x1, y1, x2, y2, x3, y3) { - cubicExtrema(lx, x1, x2, x3, addX); - cubicExtrema(ly, y1, y2, y3, addY); - addL(x3, y3); - }; - - function cubicExtrema(x0, x1, x2, x3, cb) { - const a = x3 - x0 + 3 * x1 - 3 * x2, - b = x0 + x2 - 2 * x1, - c = x0 - x1; - - let t0 = 0, t1 = 0, r; - - // solve for parameter t - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else { - // linear equation - t0 = 0.5 * c / b; - } - - // calculate position - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); - } - - function cubic(t, x0, x1, x2, x3) { - const s = 1 - t, s2 = s * s, t2 = t * t; - return (s2 * s * x0) + (3 * s2 * t * x1) + (3 * s * t2 * x2) + (t2 * t * x3); - } - - context.arc = function(cx, cy, r, sa, ea, ccw) { - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add$2(cx - r, cy - r); - add$2(cx + r, cy + r); - } else { - const update = a => add$2(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - let s, i; - - // sample end points - update(sa); - update(ea); - - // sample interior points aligned with 90 degrees - if (ea !== sa) { - sa = sa % Tau; if (sa < 0) sa += Tau; - ea = ea % Tau; if (ea < 0) ea += Tau; - - if (ea < sa) { - ccw = !ccw; // flip direction - s = sa; sa = ea; ea = s; // swap end-points - } - - if (ccw) { - ea -= Tau; - s = sa - (sa % HalfPi); - for (i=0; i<4 && s>ea; ++i, s-=HalfPi) update(s); - } else { - s = sa - (sa % HalfPi) + HalfPi; - for (i=0; i<4 && s t1) return false; - else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false; - else if (r < t1) t1 = r; - } - } - - return true; - } - - function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; - } - - function value$1(value, dflt) { - return value == null ? dflt : value; - } - - function addStops(gradient, stops) { - const n = stops.length; - for (let i=0; i 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else { - return false; - } - } - - var Empty$1 = []; - - function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - - if (lw <= 0) return false; - - opacity *= (item.strokeOpacity==null ? 1 : item.strokeOpacity); - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty$1); - context.lineDashOffset = item.strokeDashOffset || 0; - } - return true; - } else { - return false; - } - } - - function compare$2(a, b) { - return a.zindex - b.zindex || a.index - b.index; - } - - function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - - var items = scene.items, - output = [], item, i, n; - - for (i=0, n=items.length; i= 0;) { - if (hit = visitor(items[i])) return hit; - } - - if (items === zitems) { - for (items=scene.items, i=items.length; --i >= 0;) { - if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; - } - } - } - - return null; - } - - function drawAll(path) { - return function(context, scene, bounds) { - visit(scene, function(item) { - if (!bounds || bounds.intersects(item.bounds)) { - drawPath(path, context, item, item); - } - }); - }; - } - - function drawOne(path) { - return function(context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) { - drawPath(path, context, scene.items[0], scene.items); - } - }; - } - - function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - - if (path(context, items)) return; - - blend(context, item); - - if (item.fill && fill(context, item, opacity)) { - context.fill(); - } - - if (item.stroke && stroke(context, item, opacity)) { - context.stroke(); - } - } - - function pick(test) { - test = test || truthy; - - return function(context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - - return pickVisit(scene, function(item) { - var b = item.bounds; - // first hit test against bounding box - if ((b && !b.contains(gx, gy)) || !b) return; - // if in bounding box, perform more careful test - if (test(context, item, x, y, gx, gy)) return item; - }); - }; - } - - function hitPath(path, filled) { - return function(context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, - fill = (filled == null) ? item.fill : filled, - stroke = item.stroke && context.isPointInStroke, lw, lc; - - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - - return path(context, o) ? false : - (fill && context.isPointInPath(x, y)) || - (stroke && context.isPointInStroke(x, y)); - }; - } - - function pickPath(path) { - return pick(hitPath(path)); - } - - function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; - } - - function rotate(a) { - return 'rotate(' + a + ')'; - } - - function scale$1(scaleX, scaleY){ - return 'scale('+ scaleX + ',' + scaleY+')'; - } - - function translateItem(item) { - return translate(item.x || 0, item.y || 0); - } - - function transformItem(item) { - return translate(item.x || 0, item.y || 0) - + (item.angle ? ' ' + rotate(item.angle) : '') - + (item.scaleX || item.scaleY ? ' ' + scale$1(item.scaleX || 1, item.scaleY || 1) : ''); - } - - function markItemPath(type, shape, isect) { - - function attr(emit, item) { - emit('transform', transformItem(item)); - emit('d', shape(null, item)); - } - - function bound(bounds, item) { - var x = item.x || 0, - y = item.y || 0; - - shape(context(bounds), item); - boundStroke(bounds, item).translate(x, y); - if (item.angle) { - bounds.rotate(item.angle * DegToRad, x, y); - } - - return bounds; - } - - function draw(context, item) { - var x = item.x || 0, - y = item.y || 0, - a = item.angle || 0; - - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); - } - - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; - - } - - var arc$1 = markItemPath('arc', arc); - - function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], - z = a[0].orient === 'horizontal' ? 'y' : 'x', - i = a.length, - min = +Infinity, hit, d; - - while (--i >= 0) { - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - if (d < min) { - min = d; - hit = a[i]; - } - } - - return hit; - } - - function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), - i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - - return null; - } - - function pickTrail(a, p) { - var i = a.length, dx, dy, dd; - - while (--i >= 0) { - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx*dx) return a[i]; - } - - return null; - } - - function markMultiItemPath(type, shape, tip) { - - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - - function bound(bounds, mark) { - var items = mark.items; - if (items.length === 0) { - return bounds; - } else { - shape(context(bounds), items); - return boundStroke(bounds, items[0]); - } - } - - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - - var hit = hitPath(draw); - - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, - b = scene.bounds; - - if (!items || !items.length || b && !b.contains(gx, gy)) { - return null; - } - - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; - } - - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; - - } - - var area$1 = markMultiItemPath('area', area, pickArea); - - function clip$1(context, scene) { - var clip = scene.clip; - - context.save(); - - if (isFunction(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else { - clipGroup(context, scene.group); - } - } - - function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) - ? rectangle(context, group, 0, 0) - : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); - } - - function offset$1(item) { - const sw = value$1(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset - : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) - : 0; - } - - function attr(emit, item) { - emit('transform', translateItem(item)); - } - - function emitRectangle(emit, item) { - const off = offset$1(item); - emit('d', rectangle(null, item, off, off)); - } - - function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); - } - - function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - if (item.strokeForeground) { - emitRectangle(emit, item); - } else { - emit('d', ''); - } - } - - function content(emit, item, renderer) { - const url = item.clip ? clip(renderer, item, item) : null; - emit('clip-path', url); - } - - function bound(bounds, group) { - if (!group.clip && group.items) { - const items = group.items, m = items.length; - for (let j=0; j { - const gx = group.x || 0, - gy = group.y || 0, - fore = group.strokeForeground, - opacity = group.opacity == null ? 1 : group.opacity; - - // draw group background - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (group.fill && fill(context, group, opacity)) { - context.fill(); - } - if (group.stroke && !fore && stroke(context, group, opacity)) { - context.stroke(); - } - } - - // setup graphics context, set clip and bounds - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); - - // draw group contents - visit(group, item => { - this.draw(context, item, bounds); - }); - - // restore graphics context - if (bounds) bounds.translate(gx, gy); - context.restore(); - - // draw group foreground - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (stroke(context, group, opacity)) { - context.stroke(); - } - } - }); - } - - function pick$1(context, scene, x, y, gx, gy) { - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { - return null; - } - - const cx = x * context.pixelRatio, - cy = y * context.pixelRatio; - - return pickVisit(scene, group => { - let hit, fore, ix, dx, dy, dw, dh, b, c; - - // first hit test bounding box - b = group.bounds; - if (b && !b.contains(gx, gy)) return; - - // passed bounds check, test rectangular clip - dx = group.x || 0; - dy = group.y || 0; - dw = dx + (group.width || 0); - dh = dy + (group.height || 0); - c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; - - // adjust coordinate system - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; - - // test background for rounded corner clip - if (c && hasCornerRadius(group) && !hitBackground(context, group, cx, cy)) { - context.restore(); - return null; - } - - fore = group.strokeForeground; - ix = scene.interactive !== false; - - // hit test against group foreground - if (ix && fore && group.stroke - && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } - - // hit test against contained marks - hit = pickVisit(group, mark => pickMark(mark, dx, dy) - ? this.pick(mark, x, y, dx, dy) - : null - ); - - // hit test against group background - if (!hit && ix && (group.fill || (!fore && group.stroke)) - && hitBackground(context, group, cx, cy)) { - hit = group; - } - - // restore state and return - context.restore(); - return hit || null; - }); - } - - function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') - && mark.bounds && mark.bounds.contains(x, y); - } - - var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1, - isect: intersectRect, - content: content, - background: background, - foreground: foreground - }; - - var metadata = { - 'version': '1.1', - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink' - }; - - function getImage(item, renderer) { - var image = item.image; - if (!image || item.url && item.url !== image.url) { - image = {complete: false, width: 0, height: 0}; - renderer.loadImage(item.url).then(image => { - item.image = image; - item.image.url = item.url; - }); - } - return image; - } - - function imageWidth(item, image) { - return item.width != null ? item.width - : !image || !image.width ? 0 - : item.aspect !== false && item.height ? item.height * image.width / image.height - : image.width; - } - - function imageHeight(item, image) { - return item.height != null ? item.height - : !image || !image.height ? 0 - : item.aspect !== false && item.width ? item.width * image.height / image.width - : image.height; - } - - function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; - } - - function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; - } - - function attr$1(emit, item, renderer) { - const img = getImage(item, renderer), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); - } - - function bound$1(bounds, item) { - const img = item.image, - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h); - - return bounds.set(x, y, x + w, y + h); - } - - function draw$1(context, scene, bounds) { - visit(scene, item => { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - - let img = getImage(item, this), - w = imageWidth(item, img), - h = imageHeight(item, img), - x = (item.x || 0) - imageXOffset(item.align, w), - y = (item.y || 0) - imageYOffset(item.baseline, h), - opacity, ar0, ar1, t; - - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); - } - - var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick(), - isect: truthy, // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset - }; - - var line$1 = markMultiItemPath('line', line, pickLine); - - function attr$2(emit, item) { - var sx = item.scaleX || 1, - sy = item.scaleY || 1; - if (sx !== 1 || sy !== 1) { - emit('vector-effect', 'non-scaling-stroke'); - } - emit('transform', transformItem(item)); - emit('d', item.path); - } - - function path$1(context, item) { - var path = item.path; - if (path == null) return true; - - var x = item.x || 0, - y = item.y || 0, - sx = item.scaleX || 1, - sy = item.scaleY || 1, - a = (item.angle || 0) * DegToRad, - cache = item.pathCache; - - if (!cache || cache.path !== path) { - (item.pathCache = cache = pathParse(path)).path = path; - } - - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else { - pathRender(context, cache, x, y, sx, sy); - } - } - - function bound$2(bounds, item) { - path$1(context(bounds), item) - ? bounds.set(0, 0, 0, 0) - : boundStroke(bounds, item, true); - - if (item.angle) { - bounds.rotate(item.angle * DegToRad, item.x || 0, item.y || 0); - } - - return bounds; - } - - var path$2 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(path$1), - pick: pickPath(path$1), - isect: intersectPath(path$1) - }; - - function attr$3(emit, item) { - emit('d', rectangle(null, item)); - } - - function bound$3(bounds, item) { - var x, y; - return boundStroke(bounds.set( - x = item.x || 0, - y = item.y || 0, - (x + item.width) || 0, - (y + item.height) || 0 - ), item); - } - - function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); - } - - var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect - }; - - function attr$4(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); - } - - function bound$4(bounds, item) { - var x1, y1; - return boundStroke(bounds.set( - x1 = item.x || 0, - y1 = item.y || 0, - item.x2 != null ? item.x2 : x1, - item.y2 != null ? item.y2 : y1 - ), item); - } - - function path$3(context, item, opacity) { - var x1, y1, x2, y2; - - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - return false; - } - - function draw$3(context, scene, bounds) { - visit(scene, function(item) { - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity && path$3(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); - } - - function hit(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path$3(context, item, 1) && context.isPointInStroke(x, y); - } - - var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick(hit), - isect: intersectRule - }; - - var shape$1 = markItemPath('shape', shape); - - var symbol$1 = markItemPath('symbol', symbol, intersectPoint); - - // memoize text width measurement - const widthCache = lruCache(); - - var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas - }; - - useCanvas(true); - - function useCanvas(use) { - textMetrics.width = (use && context$1) ? measureWidth : estimateWidth; - } - - // make dumb, simple estimate if no canvas is available - function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); - } - - function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); - } - - // measure text width if canvas is available - function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 - : _measureWidth(text, font(item)); - } - - function _measureWidth(text, currentFont) { - const key = `(${currentFont}) ${text}`; - let width = widthCache.get(key); - if (width === undefined) { - context$1.font = currentFont; - width = context$1.measureText(text).width; - widthCache.set(key, width); - } - return width; - } - - function fontSize(item) { - return item.fontSize != null ? (+item.fontSize || 0) : 11; - } - - function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : (fontSize(item) + 2); - } - - function lineArray(_) { - return isArray(_) ? _.length > 1 ? _ : _[0] : _; - } - - function textLines(item) { - return lineArray( - item.lineBreak && item.text && !isArray(item.text) - ? item.text.split(item.lineBreak) - : item.text - ); - } - - function multiLineOffset(item) { - const tl = textLines(item); - return (isArray(tl) ? (tl.length - 1) : 0) * lineHeight(item); - } - - function textValue(item, line) { - const text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate$1(item, text) : text; - } - - function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - const currentFont = font(item); - return text => _measureWidth(text, currentFont); - } else { - // we are relying on estimates - const currentFontHeight = fontSize(item); - return text => _estimateWidth(text, currentFontHeight); - } - } - - function truncate$1(item, text) { - var limit = +item.limit, - width = widthGetter(item); - - if (width(text) < limit) return text; - - var ellipsis = item.ellipsis || '\u2026', - rtl = item.dir === 'rtl', - lo = 0, - hi = text.length, mid; - - limit -= width(ellipsis); - - if (rtl) { - while (lo < hi) { - mid = (lo + hi >>> 1); - if (width(text.slice(mid)) > limit) lo = mid + 1; - else hi = mid; - } - return ellipsis + text.slice(lo); - } else { - while (lo < hi) { - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid; - else hi = mid - 1; - } - return text.slice(0, lo) + ellipsis; - } - } - - function fontFamily(item, quote) { - var font = item.font; - return (quote && font - ? String(font).replace(/"/g, '\'') - : font) || 'sans-serif'; - } - - function font(item, quote) { - return '' + - (item.fontStyle ? item.fontStyle + ' ' : '') + - (item.fontVariant ? item.fontVariant + ' ' : '') + - (item.fontWeight ? item.fontWeight + ' ' : '') + - fontSize(item) + 'px ' + - fontFamily(item, quote); - } - - function offset$2(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, - h = fontSize(item); - - return Math.round( - baseline === 'top' ? 0.79 * h : - baseline === 'middle' ? 0.30 * h : - baseline === 'bottom' ? -0.21 * h : - baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : - baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0 - ); - } - - var textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' - }; - - var tempBounds = new Bounds(); - - function anchorPoint(item) { - var x = item.x || 0, - y = item.y || 0, - r = item.radius || 0, t; - - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; - } - - function attr$5(emit, item) { - var dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item), - p = anchorPoint(item), - x = p.x1, - y = p.y1, - a = item.angle || 0, t; - - emit('text-anchor', textAlign[item.align] || 'start'); - - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else { - t = translate(x + dx, y + dy); - } - emit('transform', t); - } - - function bound$5(bounds, item, mode) { - var h = textMetrics.height(item), - a = item.align, - p = anchorPoint(item), - x = p.x1, - y = p.y1, - dx = item.dx || 0, - dy = (item.dy || 0) + offset$2(item) - Math.round(0.8*h), // use 4/5 offset - tl = textLines(item), - w; - - // get dimensions - if (isArray(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce((w, t) => Math.max(w, textMetrics.width(item, t)), 0); - } else { - // single-line text - w = textMetrics.width(item, tl); - } - - // horizontal alignment - if (a === 'center') { - dx -= (w / 2); - } else if (a === 'right') { - dx -= w; - } - - bounds.set(dx+=x, dy+=y, dx+w, dy+h); - - if (item.angle && !mode) { - bounds.rotate(item.angle * DegToRad, x, y); - } else if (mode === 2) { - return bounds.rotatedPoints(item.angle * DegToRad, x, y); - } - return bounds; - } - - function draw$4(context, scene, bounds) { - visit(scene, function(item) { - var opacity = item.opacity == null ? 1 : item.opacity, - p, x, y, i, lh, tl, str; - - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || - item.text == null || item.text.length === 0) return; - - context.font = font(item); - context.textAlign = item.align || 'left'; - - p = anchorPoint(item); - x = p.x1, - y = p.y1; - - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - x += (item.dx || 0); - y += (item.dy || 0) + offset$2(item); - - tl = textLines(item); - blend(context, item); - if (isArray(tl)) { - lh = lineHeight(item); - for (i=0; i index) el.removeChild(nodes[--curr]); - return el; - } - - // generate css class name for mark - function cssClass(mark) { - return 'mark-' + mark.marktype - + (mark.role ? ' role-' + mark.role : '') - + (mark.name ? ' ' + mark.name : ''); - } - - function point$4(event, el) { - var rect = el.getBoundingClientRect(); - return [ - event.clientX - rect.left - (el.clientLeft || 0), - event.clientY - rect.top - (el.clientTop || 0) - ]; - } - - function resolveItem(item, event, el, origin) { - var mark = item && item.mark, - mdef, p; - - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point$4(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - while (item = item.mark.group) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - item = mdef.tip(mark.items, p); - } - - return item; - } - - /** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ - function Handler(customLoader, customTooltip) { - this._active = null; - this._handlers = {}; - this._loader = customLoader || loader(); - this._tooltip = customTooltip || defaultTooltip; - } - - // The default tooltip display handler. - // Sets the HTML title attribute on the visualization container. - function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); - } - - const prototype$J = Handler.prototype; - - /** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ - prototype$J.initialize = function(el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); - }; - - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - prototype$J.element = function() { - return this._el; - }; - - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - prototype$J.canvas = function() { - return this._el && this._el.firstChild; - }; - - /** - * Get / set the origin coordinates of the visualization. - */ - prototype$J.origin = function(origin) { - if (arguments.length) { - this._origin = origin || [0, 0]; - return this; - } else { - return this._origin.slice(); - } - }; - - /** - * Get / set the scenegraph root. - */ - prototype$J.scene = function(scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; - }; - - /** - * Add an event handler. Subclasses should override this method. - */ - prototype$J.on = function(/*type, handler*/) {}; - - /** - * Remove an event handler. Subclasses should override this method. - */ - prototype$J.off = function(/*type, handler*/) {}; - - /** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ - prototype$J._handlerIndex = function(h, type, handler) { - for (let i = h ? h.length : 0; --i>=0;) { - if (h[i].type === type && (!handler || h[i].handler === handler)) { - return i; - } - } - return -1; - }; - - /** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ - prototype$J.handlers = function(type) { - const h = this._handlers, a = []; - if (type) { - a.push.apply(a, h[this.eventName(type)]); - } else { - for (const k in h) { a.push.apply(a, h[k]); } - } - return a; - }; - - /** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ - prototype$J.eventName = function(name) { - const i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); - }; - - /** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ - prototype$J.handleHref = function(event, item, href) { - this._loader - .sanitize(href, {context:'href'}) - .then(opt => { - const e = new MouseEvent(event.type, event), - a = domCreate(null, 'a'); - for (const name in opt) a.setAttribute(name, opt[name]); - a.dispatchEvent(e); - }) - .catch(function() { /* do nothing */ }); - }; - - /** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ - prototype$J.handleTooltip = function(event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - const value = (show && item && item.tooltip) || null; - this._tooltip.call(this._obj, this, event, item, value); - } - }; - - /** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ - prototype$J.getItemBoundingClientRect = function(item) { - const el = this.canvas(); - if (!el) return; - - const rect = el.getBoundingClientRect(), - origin = this._origin, - bounds = item.bounds, - width = bounds.width(), - height = bounds.height(); - - let x = bounds.x1 + origin[0] + rect.left, - y = bounds.y1 + origin[1] + rect.top; - - // translate coordinate for each parent group - while (item.mark && (item = item.mark.group)) { - x += item.x || 0; - y += item.y || 0; - } - - // return DOMRect-compatible bounding box - return { - x, y, width, height, - left: x, top: y, right: x + width, bottom: y + height - }; - }; - - /** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ - function Renderer(loader) { - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); - } - - var prototype$K = Renderer.prototype; - - /** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ - prototype$K.initialize = function(el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); - }; - - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ - prototype$K.element = function() { - return this._el; - }; - - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ - prototype$K.canvas = function() { - return this._el && this._el.firstChild; - }; - - /** - * Get / set the background color. - */ - prototype$K.background = function(bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; - }; - - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ - prototype$K.resize = function(width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [0, 0]; - this._scale = scaleFactor || 1; - return this; - }; - - /** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ - prototype$K.dirty = function(/*item*/) { - }; - - /** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Renderer} - This renderer instance. - */ - prototype$K.render = function(scene) { - var r = this; - - // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - r._call = function() { r._render(scene); }; - - // invoke the renderer - r._call(); - - // clear the cached call for garbage collection - // async redraws will stash their own copy - r._call = null; - - return r; - }; - - /** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - */ - prototype$K._render = function(/*scene*/) { - // subclasses to override - }; - - /** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @return {Promise} - A Promise that resolves when rendering is complete. - */ - prototype$K.renderAsync = function(scene) { - var r = this.render(scene); - return this._ready - ? this._ready.then(function() { return r; }) - : Promise.resolve(r); - }; - - /** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ - prototype$K._load = function(method, uri) { - var r = this, - p = r._loader[method](uri); - - if (!r._ready) { - // re-render the scene when loading completes - var call = r._call; - r._ready = r._loader.ready() - .then(function(redraw) { - if (redraw) call(); - r._ready = null; - }); - } - - return p; - }; - - /** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ - prototype$K.sanitizeURL = function(uri) { - return this._load('sanitizeURL', uri); - }; - - /** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ - prototype$K.loadImage = function(uri) { - return this._load('loadImage', uri); - }; - - const KeyDownEvent = 'keydown'; - const KeyPressEvent = 'keypress'; - const KeyUpEvent = 'keyup'; - const DragEnterEvent = 'dragenter'; - const DragLeaveEvent = 'dragleave'; - const DragOverEvent = 'dragover'; - const MouseDownEvent = 'mousedown'; - const MouseUpEvent = 'mouseup'; - const MouseMoveEvent = 'mousemove'; - const MouseOutEvent = 'mouseout'; - const MouseOverEvent = 'mouseover'; - const ClickEvent = 'click'; - const DoubleClickEvent = 'dblclick'; - const WheelEvent = 'wheel'; - const MouseWheelEvent = 'mousewheel'; - const TouchStartEvent = 'touchstart'; - const TouchMoveEvent = 'touchmove'; - const TouchEndEvent = 'touchend'; - - const Events = [ - KeyDownEvent, - KeyPressEvent, - KeyUpEvent, - DragEnterEvent, - DragLeaveEvent, - DragOverEvent, - MouseDownEvent, - MouseUpEvent, - MouseMoveEvent, - MouseOutEvent, - MouseOverEvent, - ClickEvent, - DoubleClickEvent, - WheelEvent, - MouseWheelEvent, - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent - ]; - - const TooltipShowEvent = MouseMoveEvent; - - const TooltipHideEvent = MouseOutEvent; - - const HrefEvent = ClickEvent; - - function CanvasHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; - } - - const prototype$L = inherits(CanvasHandler, Handler); - - prototype$L.initialize = function(el, origin, obj) { - this._canvas = el && domFind(el, 'canvas'); - - // add minimal events required for proper state management - [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent] - .forEach(type => eventListenerCheck(this, type)); - - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - const eventBundle = type => ( - type === TouchStartEvent || - type === TouchMoveEvent || - type === TouchEndEvent - ) - ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] - : [type]; - - // lazily add listeners to the canvas as needed - function eventListenerCheck(handler, type) { - eventBundle(type).forEach(_ => addEventListener(handler, _)); - } - - function addEventListener(handler, type) { - const canvas = handler.canvas(); - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] - ? evt => handler[type](evt) - : evt => handler.fire(type, evt) - ); - } - } - - // return the backing canvas instance - prototype$L.canvas = function() { - return this._canvas; - }; - - // retrieve the current canvas context - prototype$L.context = function() { - return this._canvas.getContext('2d'); - }; - - // supported events - prototype$L.events = Events; - - function move(moveEvent, overEvent, outEvent) { - return function(evt) { - const a = this._active, - p = this.pickEvent(evt); - - if (p === a) { - // active item and picked item are the same - this.fire(moveEvent, evt); // fire move - } else { - // active item and picked item are different - if (!a || !a.exit) { - // fire out for prior active item - // suppress if active item was removed from scene - this.fire(outEvent, evt); - } - this._active = p; // set new active item - this.fire(overEvent, evt); // fire over for new active item - this.fire(moveEvent, evt); // fire move for new active item - } - }; - } - - function inactive(type) { - return function(evt) { - this.fire(type, evt); - this._active = null; - }; - } - - // to keep old versions of firefox happy - prototype$L.DOMMouseScroll = function(evt) { - this.fire(MouseWheelEvent, evt); - }; - - prototype$L.mousemove = move(MouseMoveEvent, MouseOverEvent, MouseOutEvent); - prototype$L.dragover = move(DragOverEvent, DragEnterEvent, DragLeaveEvent); - - prototype$L.mouseout = inactive(MouseOutEvent); - prototype$L.dragleave = inactive(DragLeaveEvent); - - prototype$L.mousedown = function(evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); - }; - - prototype$L.click = function(evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } - }; - - prototype$L.touchstart = function(evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - - if (this._first) { - this._active = this._touch; - this._first = false; - } - - this.fire(TouchStartEvent, evt, true); - }; - - prototype$L.touchmove = function(evt) { - this.fire(TouchMoveEvent, evt, true); - }; - - prototype$L.touchend = function(evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; - }; - - // fire an event - prototype$L.fire = function(type, evt, touch) { - const a = touch ? this._touch : this._active, - h = this._handlers[type]; - - // set event type relative to scenegraph items - evt.vegaType = type; - - // handle hyperlinks and tooltips first - if (type === HrefEvent && a && a.href) { - this.handleHref(evt, a, a.href); - } else if (type === TooltipShowEvent || type === TooltipHideEvent) { - this.handleTooltip(evt, a, type !== TooltipHideEvent); - } - - // invoke all registered handlers - if (h) { - for (let i=0, len=h.length; i= 0) { - h.splice(i, 1); - } - - return this; - }; - - prototype$L.pickEvent = function(evt) { - const p = point$4(evt, this._canvas), - o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); - }; - - // find the scenegraph item at the current mouse position - // x, y -- the absolute x, y mouse coordinates on the canvas element - // gx, gy -- the relative coordinates within the current group - prototype$L.pick = function(scene, x, y, gx, gy) { - const g = this.context(), - mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); - }; - - function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; - } - - var pixelRatio = devicePixelRatio(); - - function resize(canvas, width, height, origin, scaleFactor, opt) { - const inDOM = typeof HTMLElement !== 'undefined' - && canvas instanceof HTMLElement - && canvas.parentNode != null, - context = canvas.getContext('2d'), - ratio = inDOM ? pixelRatio : scaleFactor; - - canvas.width = width * ratio; - canvas.height = height * ratio; - - for (const key in opt) { - context[key] = opt[key]; - } - - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - } - - context.pixelRatio = ratio; - context.setTransform( - ratio, 0, 0, ratio, - ratio * origin[0], - ratio * origin[1] - ); - - return canvas; - } - - function CanvasRenderer(loader) { - Renderer.call(this, loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); - } - - const prototype$M = inherits(CanvasRenderer, Renderer), - base = Renderer.prototype; - - prototype$M.initialize = function(el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - - this._canvas = this._options.externalContext - ? null - : domCanvas(1, 1, this._options.type); // instantiate a small canvas - - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - this._canvas.setAttribute('class', 'marks'); - } - - // this method will invoke resize to size the canvas appropriately - return base.initialize.call(this, el, width, height, origin, scaleFactor); - }; - - prototype$M.resize = function(width, height, origin, scaleFactor) { - base.resize.call(this, width, height, origin, scaleFactor); - - if (this._canvas) { - // configure canvas size and transform - resize(this._canvas, this._width, this._height, - this._origin, this._scale, this._options.context); - } else { - // external context needs to be scaled and positioned to origin - const ctx = this._options.externalContext; - if (!ctx) error('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - - this._redraw = true; - return this; - }; - - prototype$M.canvas = function() { - return this._canvas; - }; - - prototype$M.context = function() { - return this._options.externalContext - || (this._canvas ? this._canvas.getContext('2d') : null); - }; - - prototype$M.dirty = function(item) { - let b = this._tempb.clear().union(item.bounds), - g = item.mark.group; - - while (g) { - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; - } - - this._dirty.union(b); - }; - - function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); - - // align to base pixel grid in case of non-integer scaling (#2425) - if (g.pixelRatio % 1) { - b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - } - - // to avoid artifacts translate if origin has fractional pixels - b.translate(-(origin[0] % 1), -(origin[1] % 1)); - - // set clip path - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - - return b; - } - - const viewBounds = (origin, width, height) => new Bounds() - .set(0, 0, width, height) - .translate(-origin[0], -origin[1]); - - prototype$M._render = function(scene) { - const g = this.context(), - o = this._origin, - w = this._width, - h = this._height, - db = this._dirty, - vb = viewBounds(o, w, h); - - // setup - g.save(); - const b = this._redraw || db.empty() - ? (this._redraw = false, vb.expand(1)) - : clipToBounds(g, vb.intersect(db), o); - - this.clear(-o[0], -o[1], w, h); - - // render - this.draw(g, scene, b); - - // takedown - g.restore(); - db.clear(); - - return this; - }; - - prototype$M.draw = function(ctx, scene, bounds) { - const mark = Marks[scene.marktype]; - if (scene.clip) clip$1(ctx, scene); - mark.draw.call(this, ctx, scene, bounds); - if (scene.clip) ctx.restore(); - }; - - prototype$M.clear = function(x, y, w, h) { - const opt = this._options, - g = this.context(); - - if (opt.type !== 'pdf' && !opt.externalContext) { - // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - } - - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } - }; - - function SVGHandler(loader, tooltip) { - Handler.call(this, loader, tooltip); - const h = this; - h._hrefHandler = listener(h, (evt, item) => { - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, (evt, item) => { - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); - }); - } - - const prototype$N = inherits(SVGHandler, Handler); - - prototype$N.initialize = function(el, origin, obj) { - let svg = this._svg; - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - this._svg = svg = el && domFind(el, 'svg'); - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - return Handler.prototype.initialize.call(this, el, origin, obj); - }; - - prototype$N.canvas = function() { - return this._svg; - }; - - // wrap an event listener for the SVG DOM - const listener = (context, handler) => evt => { - let item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; - - // add an event handler - prototype$N.on = function(type, handler) { - const name = this.eventName(type), - h = this._handlers, - i = this._handlerIndex(h[name], type, handler); - - if (i < 0) { - const x = { - type, - handler, - listener: listener(this, handler) - }; - - (h[name] || (h[name] = [])).push(x); - if (this._svg) { - this._svg.addEventListener(name, x.listener); - } - } - - return this; - }; - - // remove an event handler - prototype$N.off = function(type, handler) { - const name = this.eventName(type), - h = this._handlers[name], - i = this._handlerIndex(h, type, handler); - - if (i >= 0) { - if (this._svg) { - this._svg.removeEventListener(name, h[i].listener); - } - h.splice(i, 1); - } - - return this; - }; - - function bandSpace(count, paddingInner, paddingOuter) { - var space = count - paddingInner + paddingOuter * 2; - return count ? (space > 0 ? space : 1) : 0; - } - - const Identity = 'identity'; - - const Linear$1 = 'linear'; - const Log = 'log'; - const Pow = 'pow'; - const Sqrt = 'sqrt'; - const Symlog = 'symlog'; - - const Time = 'time'; - const UTC = 'utc'; - - const Sequential = 'sequential'; - const Diverging = 'diverging'; - - const Quantile$1 = 'quantile'; - const Quantize = 'quantize'; - const Threshold = 'threshold'; - - const Ordinal = 'ordinal'; - const Point = 'point'; - const Band = 'band'; - const BinOrdinal = 'bin-ordinal'; - - // categories - const Continuous = 'continuous'; - const Discrete = 'discrete'; - const Discretizing = 'discretizing'; - const Interpolating = 'interpolating'; - const Temporal = 'temporal'; - - function invertRange(scale) { - return function(_) { - var lo = _[0], - hi = _[1], - t; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - return [ - scale.invert(lo), - scale.invert(hi) - ]; - }; - } - - function invertRangeExtent(scale) { - return function(_) { - var range = scale.range(), - lo = _[0], - hi = _[1], - min = -1, max, t, i, n; - - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - - for (i=0, n=range.length; i= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - } - - if (min < 0) return undefined; - - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - - return [ - lo[0] === undefined ? lo[1] : lo[0], - hi[1] === undefined ? hi[0] : hi[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: { - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); - break; - } - default: { - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; - } - } - return this; - } - - const implicit = Symbol("implicit"); - - function ordinal() { - var index = new Map(), - domain = [], - range = [], - unknown = implicit; - - function scale(d) { - var key = d + "", i = index.get(key); - if (!i) { - if (unknown !== implicit) return unknown; - index.set(key, i = domain.push(d)); - } - return range[(i - 1) % range.length]; - } - - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new Map(); - for (const value of _) { - const key = value + ""; - if (index.has(key)) continue; - index.set(key, domain.push(value)); - } - return scale; - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return ordinal(domain, range).unknown(unknown); - }; - - initRange.apply(scale, arguments); - - return scale; - } - - function define(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; - } - - function extend$1(parent, definition) { - var prototype = Object.create(parent.prototype); - for (var key in definition) prototype[key] = definition[key]; - return prototype; - } - - function Color() {} - - var darker = 0.7; - var brighter = 1 / darker; - - var reI = "\\s*([+-]?\\d+)\\s*", - reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", - reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", - reHex = /^#([0-9a-f]{3,8})$/, - reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), - reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), - reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), - reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), - reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), - reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); - - var named = { - 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$1, { - copy: function(channels) { - return Object.assign(new this.constructor, this, channels); - }, - displayable: function() { - return this.rgb().displayable(); - }, - hex: color_formatHex, // Deprecated! Use color.formatHex. - formatHex: color_formatHex, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb - }); - - function color_formatHex() { - return this.rgb().formatHex(); - } - - function color_formatHsl() { - return hslConvert(this).formatHsl(); - } - - function color_formatRgb() { - return this.rgb().formatRgb(); - } - - function color$1(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 - : null) // invalid hex - : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = 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]) // eslint-disable-line no-prototype-builtins - : format === "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 <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); - } - - function rgbConvert(o) { - if (!(o instanceof Color)) o = color$1(o); - if (!o) return new Rgb; - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); - } - - function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); - } - - function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; - } - - define(Rgb, rgb, extend$1(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker: function(k) { - k = k == 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 <= this.r && this.r < 255.5) - && (-0.5 <= this.g && this.g < 255.5) - && (-0.5 <= this.b && this.b < 255.5) - && (0 <= this.opacity && this.opacity <= 1); - }, - hex: rgb_formatHex, // Deprecated! Use color.formatHex. - formatHex: rgb_formatHex, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb - })); - - function rgb_formatHex() { - return "#" + hex(this.r) + hex(this.g) + hex(this.b); - } - - function rgb_formatRgb() { - var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 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 === 1 ? ")" : ", " + a + ")"); - } - - function hex(value) { - value = 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 <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = 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 = color$1(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - h = NaN, - s = max - min, - l = (max + min) / 2; - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else { - s = l > 0 && l < 1 ? 0 : h; - } - return new Hsl(h, s, l, o.opacity); - } - - function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); - } - - function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; - } - - define(Hsl, hsl, extend$1(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = this.h % 360 + (this.h < 0) * 360, - s = isNaN(h) || isNaN(this.s) ? 0 : this.s, - l = this.l, - m2 = l + (l < 0.5 ? l : 1 - l) * s, - m1 = 2 * l - m2; - return new Rgb( - hsl2rgb(h >= 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 <= this.s && this.s <= 1 || isNaN(this.s)) - && (0 <= this.l && this.l <= 1) - && (0 <= this.opacity && this.opacity <= 1); - }, - formatHsl: function() { - var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 1 ? "hsl(" : "hsla(") - + (this.h || 0) + ", " - + (this.s || 0) * 100 + "%, " - + (this.l || 0) * 100 + "%" - + (a === 1 ? ")" : ", " + a + ")"); - } - })); - - /* 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 = Math.PI / 180; - var rad2deg = 180 / Math.PI; - - // https://observablehq.com/@mbostock/lab-and-rgb - var K = 18, - Xn = 0.96422, - Yn = 1, - Zn = 0.82521, - t0$2 = 4 / 29, - t1$1 = 6 / 29, - t2 = 3 * t1$1 * t1$1, - t3 = t1$1 * t1$1 * t1$1; - - 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 = rgbConvert(o); - var r = rgb2lrgb(o.r), - g = rgb2lrgb(o.g), - b = rgb2lrgb(o.b), - y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; - if (r === g && g === b) x = z = y; else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = 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 lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); - } - - function Lab(l, a, b, opacity) { - this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; - } - - define(Lab, lab, extend$1(Color, { - brighter: function(k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker: function(k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb: function() { - var y = (this.l + 16) / 116, - x = isNaN(this.a) ? y : y + this.a / 500, - z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = 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$2; - } - - function lab2xyz(t) { - return t > t1$1 ? t * t * t : t2 * (t - t0$2); - } - - function lrgb2rgb(x) { - return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); - } - - function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 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 = labConvert(o); - if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h = 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 hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); - } - - function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; - this.l = +l; - this.opacity = +opacity; - } - - function hcl2lab(o) { - if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h = o.h * deg2rad; - return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); - } - - define(Hcl, hcl, extend$1(Color, { - brighter: function(k) { - return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); - }, - darker: function(k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb: function() { - return hcl2lab(this).rgb(); - } - })); - - var A = -0.14861, - B = +1.78277, - C$1 = -0.29227, - D = -0.90649, - E = +1.97294, - ED = E * D, - EB = E * B, - BC_DA = B * C$1 - 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 = rgbConvert(o); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), - bl = b - l, - k = (E * (g - l) - C$1 * bl) / D, - s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 - h = 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 === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); - } - - function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; - } - - define(Cubehelix, cubehelix, extend$1(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, - l = +this.l, - a = isNaN(this.s) ? 0 : this.s * l * (1 - l), - cosh = Math.cos(h), - sinh = Math.sin(h); - return new Rgb( - 255 * (l + a * (A * cosh + B * sinh)), - 255 * (l + a * (C$1 * cosh + D * sinh)), - 255 * (l + a * (E * cosh)), - this.opacity - ); - } - })); - - function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, t3 = 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 = values.length - 1; - return function(t) { - var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), - v1 = values[i], - v2 = values[i + 1], - v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, - v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - } - - function basisClosed(values) { - var n = values.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), - v0 = values[(i + n - 1) % n], - v1 = values[i % n], - v2 = values[(i + 1) % n], - v3 = values[(i + 2) % n]; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - } - - function constant$2(x) { - return function() { - return x; - }; - } - - function linear(a, d) { - return function(t) { - return a + t * d; - }; - } - - function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; - } - - function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$2(isNaN(a) ? b : a); - } - - function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : constant$2(isNaN(a) ? b : a); - }; - } - - function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : constant$2(isNaN(a) ? b : a); - } - - var rgb$1 = (function rgbGamma(y) { - var color = gamma(y); - - function rgb$1(start, end) { - var r = color((start = rgb(start)).r, (end = rgb(end)).r), - g = color(start.g, end.g), - b = color(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - - rgb$1.gamma = rgbGamma; - - return rgb$1; - })(1); - - function rgbSpline(spline) { - return function(colors) { - var n = colors.length, - r = new Array(n), - g = new Array(n), - b = new Array(n), - i, color; - for (i = 0; i < n; ++i) { - color = rgb(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function(t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; - }; - } - - var rgbBasis = rgbSpline(basis$1); - var rgbBasisClosed = rgbSpline(basisClosed); - - function numberArray(a, b) { - if (!b) b = []; - var n = a ? Math.min(b.length, a.length) : 0, - c = b.slice(), - i; - return function(t) { - for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; - return c; - }; - } - - function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); - } - - function array$1(a, b) { - return (isNumberArray(b) ? numberArray : genericArray)(a, b); - } - - function genericArray(a, b) { - var nb = b ? b.length : 0, - na = a ? Math.min(nb, a.length) : 0, - x = new Array(na), - c = new Array(nb), - i; - - for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]); - for (; i < nb; ++i) c[i] = b[i]; - - return function(t) { - for (i = 0; i < na; ++i) c[i] = x[i](t); - return c; - }; - } - - function date(a, b) { - var d = new Date; - return a = +a, b = +b, function(t) { - return d.setTime(a * (1 - t) + b * t), d; - }; - } - - function interpolateNumber(a, b) { - return a = +a, b = +b, function(t) { - return a * (1 - t) + b * t; - }; - } - - function object$1(a, b) { - var i = {}, - c = {}, - k; - - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; - - for (k in b) { - if (k in a) { - i[k] = interpolate(a[k], b[k]); - } else { - c[k] = b[k]; - } - } - - return function(t) { - for (k in i) c[k] = i[k](t); - return c; - }; - } - - var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, - reB = new RegExp(reA.source, "g"); - - function zero$1(b) { - return function() { - return b; - }; - } - - function one$1(b) { - return function(t) { - return b(t) + ""; - }; - } - - function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 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 = -1, // index in s - s = [], // string constants and placeholders - q = []; // number interpolators - - // Coerce inputs to strings. - a = a + "", b = b + ""; - - // Interpolate pairs of numbers in a & b. - while ((am = reA.exec(a)) - && (bm = reB.exec(b))) { - if ((bs = bm.index) > bi) { // a string precedes the next number in b - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; - } else { // interpolate non-matching numbers - s[++i] = null; - q.push({i: i, x: interpolateNumber(am, bm)}); - } - bi = reB.lastIndex; - } - - // Add remains of b. - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = 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$1(q[0].x) - : zero$1(b)) - : (b = q.length, function(t) { - for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }); - } - - function interpolate(a, b) { - var t = typeof b, c; - return b == null || t === "boolean" ? constant$2(b) - : (t === "number" ? interpolateNumber - : t === "string" ? ((c = color$1(b)) ? (b = c, rgb$1) : string) - : b instanceof color$1 ? rgb$1 - : b instanceof Date ? date - : isNumberArray(b) ? numberArray - : Array.isArray(b) ? genericArray - : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object$1 - : interpolateNumber)(a, b); - } - - function discrete(range) { - var n = 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 = hue(+a, +b); - return function(t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; - } - - function interpolateRound(a, b) { - return a = +a, b = +b, function(t) { - return Math.round(a * (1 - t) + b * t); - }; - } - - var degrees = 180 / Math.PI; - - var identity$3 = { - 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 = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - 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 === "none") return identity$3; - if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; - cssNode.style.transform = value; - value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); - cssRoot.removeChild(cssNode); - value = value.slice(7, -1).split(","); - return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); - } - - function parseSvg(value) { - if (value == null) return identity$3; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return identity$3; - value = 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 !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)}); - } else if (xb || yb) { - s.push("translate(" + xb + pxComma + yb + pxParen); - } - } - - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path - q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpolateNumber(a, b)}); - } else if (b) { - s.push(pop(s) + "rotate(" + b + degParen); - } - } - - function skewX(a, b, s, q) { - if (a !== b) { - q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpolateNumber(a, b)}); - } else if (b) { - s.push(pop(s) + "skewX(" + b + degParen); - } - } - - function scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)}); - } else if (xb !== 1 || yb !== 1) { - s.push(pop(s) + "scale(" + xb + "," + yb + ")"); - } - } - - return function(a, b) { - var s = [], // string constants and placeholders - q = []; // number interpolators - a = parse(a), b = 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 = b = null; // gc - return function(t) { - var i = -1, n = q.length, o; - while (++i < n) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; - }; - } - - var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); - var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); - - var rho = Math.SQRT2, - rho2 = 2, - rho4 = 4, - epsilon2 = 1e-12; - - function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; - } - - function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; - } - - function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); - } - - // p0 = [ux0, uy0, w0] - // p1 = [ux1, uy1, w1] - function zoom$1(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], - ux1 = p1[0], uy1 = p1[1], w1 = p1[2], - dx = ux1 - ux0, - dy = uy1 - uy0, - d2 = dx * dx + dy * dy, - i, - S; - - // Special case for u0 ≅ u1. - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; - }; - } - - // General case. - else { - var d1 = Math.sqrt(d2), - b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), - b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), - r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), - r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s = t * S, - coshr0 = cosh(r0), - u = 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 = S * 1000; - - return i; - } - - function hsl$1(hue) { - return function(start, end) { - var h = hue((start = hsl(start)).h, (end = hsl(end)).h), - s = nogamma(start.s, end.s), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - } - } - - var hsl$2 = hsl$1(hue); - var hslLong = hsl$1(nogamma); - - function lab$1(start, end) { - var l = nogamma((start = lab(start)).l, (end = lab(end)).l), - a = nogamma(start.a, end.a), - b = nogamma(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - - function hcl$1(hue) { - return function(start, end) { - var h = hue((start = hcl(start)).h, (end = hcl(end)).h), - c = nogamma(start.c, end.c), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - } - } - - var hcl$2 = hcl$1(hue); - var hclLong = hcl$1(nogamma); - - function cubehelix$1(hue) { - return (function cubehelixGamma(y) { - y = +y; - - function cubehelix$1(start, end) { - var h = hue((start = cubehelix(start)).h, (end = cubehelix(end)).h), - s = nogamma(start.s, end.s), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - - cubehelix$1.gamma = cubehelixGamma; - - return cubehelix$1; - })(1); - } - - var cubehelix$2 = cubehelix$1(hue); - var cubehelixLong = cubehelix$1(nogamma); - - function piecewise(interpolate, values) { - var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); - while (i < n) I[i] = interpolate(v, v = values[++i]); - return function(t) { - var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i](t - i); - }; - } - - function quantize(interpolator, n) { - var samples = new Array(n); - for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); - return samples; - } - - var $$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - interpolate: interpolate, - interpolateArray: array$1, - interpolateBasis: basis$1, - interpolateBasisClosed: basisClosed, - interpolateDate: date, - interpolateDiscrete: discrete, - interpolateHue: hue$1, - interpolateNumber: interpolateNumber, - interpolateNumberArray: numberArray, - interpolateObject: object$1, - interpolateRound: interpolateRound, - interpolateString: string, - interpolateTransformCss: interpolateTransformCss, - interpolateTransformSvg: interpolateTransformSvg, - interpolateZoom: zoom$1, - interpolateRgb: rgb$1, - interpolateRgbBasis: rgbBasis, - interpolateRgbBasisClosed: rgbBasisClosed, - interpolateHsl: hsl$2, - interpolateHslLong: hslLong, - interpolateLab: lab$1, - interpolateHcl: hcl$2, - interpolateHclLong: hclLong, - interpolateCubehelix: cubehelix$2, - interpolateCubehelixLong: cubehelixLong, - piecewise: piecewise, - quantize: quantize - }); - - function constant$3(x) { - return function() { - return x; - }; - } - - function number$2(x) { - return +x; - } - - var unit = [0, 1]; - - function identity$4(x) { - return x; - } - - function normalize(a, b) { - return (b -= (a = +a)) - ? function(x) { return (x - a) / b; } - : constant$3(isNaN(b) ? NaN : 0.5); - } - - function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = 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 corresponding parameter t in [0,1]. - // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. - function bimap(domain, range, interpolate) { - var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function(x) { return r0(d0(x)); }; - } - - function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, - d = new Array(j), - r = new Array(j), - i = -1; - - // Reverse descending domains. - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - - while (++i < j) { - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - - return function(x) { - var i = 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() { - var domain = unit, - range = unit, - interpolate$1 = interpolate, - transform, - untransform, - unknown, - clamp = identity$4, - piecewise, - output, - input; - - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity$4) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x))); - } - - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y))); - }; - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, number$2), rescale()) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.rangeRound = function(_) { - return range = Array.from(_), interpolate$1 = interpolateRound, rescale(); - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity$4, rescale()) : clamp !== identity$4; - }; - - scale.interpolate = function(_) { - return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t, u) { - transform = t, untransform = u; - return rescale(); - }; - } - - function continuous() { - return transformer()(identity$4, identity$4); - } - - function tickFormat(start, stop, count, specifier) { - var step = tickStep(start, stop, count), - precision; - specifier = formatSpecifier(specifier == null ? ",f" : specifier); - switch (specifier.type) { - case "s": { - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision; - return formatPrefix(specifier, value); - } - case "": - case "e": - case "g": - case "p": - case "r": { - if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - } - case "f": - case "%": { - if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - return format$1(specifier); - } - - function linearish(scale) { - var domain = scale.domain; - - scale.ticks = function(count) { - var d = domain(); - return ticks(d[0], d[d.length - 1], count == null ? 10 : count); - }; - - scale.tickFormat = function(count, specifier) { - var d = domain(); - return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - - scale.nice = function(count) { - if (count == null) count = 10; - - var d = domain(), - i0 = 0, - i1 = d.length - 1, - start = d[i0], - stop = d[i1], - step; - - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - - step = tickIncrement(start, stop, count); - - if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - step = tickIncrement(start, stop, count); - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - step = tickIncrement(start, stop, count); - } - - if (step > 0) { - d[i0] = Math.floor(start / step) * step; - d[i1] = Math.ceil(stop / step) * step; - domain(d); - } else if (step < 0) { - d[i0] = Math.ceil(start * step) / step; - d[i1] = Math.floor(stop * step) / step; - domain(d); - } - - return scale; - }; - - return scale; - } - - function linear$1() { - var scale = continuous(); - - scale.copy = function() { - return copy(scale, linear$1()); - }; - - initRange.apply(scale, arguments); - - return linearish(scale); - } - - function identity$5(domain) { - var unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : x; - } - - scale.invert = scale; - - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, number$2), scale) : domain.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return identity$5(domain).unknown(unknown); - }; - - domain = arguments.length ? Array.from(domain, number$2) : [0, 1]; - - return linearish(scale); - } - - function nice(domain, interval) { - domain = domain.slice(); - - var i0 = 0, - i1 = domain.length - 1, - x0 = domain[i0], - x1 = domain[i1], - t; - - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - - domain[i0] = interval.floor(x0); - domain[i1] = 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 === 10 ? pow10 - : base === Math.E ? Math.exp - : function(x) { return Math.pow(base, x); }; - } - - function logp(base) { - return base === Math.E ? Math.log - : base === 10 && Math.log10 - || base === 2 && Math.log2 - || (base = Math.log(base), function(x) { return Math.log(x) / base; }); - } - - function reflect(f) { - return function(x) { - return -f(-x); - }; - } - - function loggish(transform) { - var scale = transform(transformLog, transformExp), - domain = scale.domain, - base = 10, - logs, - pows; - - function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else { - transform(transformLog, transformExp); - } - return scale; - } - - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - - scale.ticks = function(count) { - var d = domain(), - u = d[0], - v = d[d.length - 1], - r; - - if (r = v < u) i = u, u = v, v = i; - - var i = logs(u), - j = logs(v), - p, - k, - t, - n = count == null ? 10 : +count, - z = []; - - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for (; i <= j; ++i) { - for (k = 1, p = pows(i); k < base; ++k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } else for (; i <= j; ++i) { - for (k = base - 1, p = pows(i); k >= 1; --k) { - t = p * k; - if (t < u) continue; - if (t > v) break; - z.push(t); - } - } - if (z.length * 2 < n) z = ticks(u, v, n); - } else { - z = ticks(i, j, Math.min(j - i, n)).map(pows); - } - - return r ? z.reverse() : z; - }; - - scale.tickFormat = function(count, specifier) { - if (specifier == null) specifier = base === 10 ? ".0e" : ","; - if (typeof specifier !== "function") specifier = format$1(specifier); - if (count === Infinity) return specifier; - if (count == null) count = 10; - var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - return function(d) { - var i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; - }; - - scale.nice = 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$2() { - var scale = loggish(transformer()).domain([1, 10]); - - scale.copy = function() { - return copy(scale, log$2()).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 = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - - return linearish(scale); - } - - function symlog$1() { - var scale = symlogish(transformer()); - - scale.copy = function() { - return copy(scale, symlog$1()).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 = transform(identity$4, identity$4), - exponent = 1; - - function rescale() { - return exponent === 1 ? transform(identity$4, identity$4) - : exponent === 0.5 ? transform(transformSqrt, transformSquare) - : transform(transformPow(exponent), transformPow(1 / exponent)); - } - - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - - return linearish(scale); - } - - function pow$1() { - var scale = powish(transformer()); - - scale.copy = 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 = [], - range = [], - thresholds = [], - unknown; - - function rescale() { - var i = 0, n = Math.max(1, range.length); - thresholds = new Array(n - 1); - while (++i < n) thresholds[i - 1] = quantile(domain, i / n); - return scale; - } - - function scale(x) { - return isNaN(x = +x) ? unknown : range[bisectRight(thresholds, x)]; - } - - scale.invertExtent = function(y) { - var i = 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 = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort(ascending); - return rescale(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.quantiles = function() { - return thresholds.slice(); - }; - - scale.copy = function() { - return quantile$1() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); - } - - function quantize$1() { - var x0 = 0, - x1 = 1, - n = 1, - domain = [0.5], - range = [0, 1], - unknown; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - function rescale() { - var i = -1; - domain = new Array(n); - while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; - }; - - scale.range = function(_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [NaN, NaN] - : i < 1 ? [x0, domain[0]] - : i >= n ? [domain[n - 1], x1] - : [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - - scale.thresholds = function() { - return domain.slice(); - }; - - scale.copy = function() { - return quantize$1() - .domain([x0, x1]) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(linearish(scale), arguments); - } - - function threshold() { - var domain = [0.5], - range = [0, 1], - unknown, - n = 1; - - function scale(x) { - return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown; - } - - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return [domain[i - 1], domain[i]]; - }; - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - scale.copy = function() { - return threshold() - .domain(domain) - .range(range) - .unknown(unknown); - }; - - return initRange.apply(scale, arguments); - } - - var durationSecond$2 = 1000, - durationMinute$2 = durationSecond$2 * 60, - durationHour$2 = durationMinute$2 * 60, - durationDay$2 = durationHour$2 * 24, - durationWeek$2 = durationDay$2 * 7, - durationMonth$1 = durationDay$2 * 30, - durationYear$1 = durationDay$2 * 365; - - function date$1(t) { - return new Date(t); - } - - function number$3(t) { - return t instanceof Date ? +t : +new Date(+t); - } - - function calendar(year, month, week, day, hour, minute, second, millisecond, format) { - var scale = continuous(), - invert = scale.invert, - domain = scale.domain; - - var formatMillisecond = format(".%L"), - formatSecond = format(":%S"), - formatMinute = format("%I:%M"), - formatHour = format("%I %p"), - formatDay = format("%a %d"), - formatWeek = format("%b %d"), - formatMonth = format("%B"), - formatYear = format("%Y"); - - var tickIntervals = [ - [second, 1, durationSecond$2], - [second, 5, 5 * durationSecond$2], - [second, 15, 15 * durationSecond$2], - [second, 30, 30 * durationSecond$2], - [minute, 1, durationMinute$2], - [minute, 5, 5 * durationMinute$2], - [minute, 15, 15 * durationMinute$2], - [minute, 30, 30 * durationMinute$2], - [ hour, 1, durationHour$2 ], - [ hour, 3, 3 * durationHour$2 ], - [ hour, 6, 6 * durationHour$2 ], - [ hour, 12, 12 * durationHour$2 ], - [ day, 1, durationDay$2 ], - [ day, 2, 2 * durationDay$2 ], - [ week, 1, durationWeek$2 ], - [ month, 1, durationMonth$1 ], - [ month, 3, 3 * durationMonth$1 ], - [ year, 1, durationYear$1 ] - ]; - - function tickFormat(date) { - return (second(date) < date ? formatMillisecond - : minute(date) < date ? formatSecond - : hour(date) < date ? formatMinute - : day(date) < date ? formatHour - : month(date) < date ? (week(date) < date ? formatDay : formatWeek) - : year(date) < date ? formatMonth - : formatYear)(date); - } - - function tickInterval(interval, start, stop) { - if (interval == null) interval = 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 === "number") { - var target = Math.abs(stop - start) / interval, - i = bisector(function(i) { return i[2]; }).right(tickIntervals, target), - step; - if (i === tickIntervals.length) { - step = tickStep(start / durationYear$1, stop / durationYear$1, interval); - interval = year; - } else if (i) { - i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - step = i[1]; - interval = i[0]; - } else { - step = Math.max(tickStep(start, stop, interval), 1); - interval = millisecond; - } - return interval.every(step); - } - - return interval; - } - - scale.invert = function(y) { - return new Date(invert(y)); - }; - - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number$3)) : domain().map(date$1); - }; - - scale.ticks = function(interval) { - var d = domain(), - t0 = d[0], - t1 = d[d.length - 1], - r = t1 < t0, - t; - if (r) t = t0, t0 = t1, t1 = t; - t = tickInterval(interval, t0, t1); - t = t ? t.range(t0, t1 + 1) : []; // inclusive stop - return r ? t.reverse() : t; - }; - - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - - scale.nice = function(interval) { - var d = domain(); - return (interval = tickInterval(interval, d[0], d[d.length - 1])) - ? domain(nice(d, interval)) - : scale; - }; - - scale.copy = function() { - return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); - }; - - return scale; - } - - function time() { - return initRange.apply(calendar(year, month, sunday, day, hour, minute, second, millisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); - } - - function utcTime() { - return initRange.apply(calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); - } - - function transformer$1() { - var x0 = 0, - x1 = 1, - t0, - t1, - k10, - transform, - interpolator = identity$4, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; - }; - } - - scale.range = range(interpolate); - - scale.rangeRound = range(interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === 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 = linearish(transformer$1()(identity$4)); - - scale.copy = function() { - return copy$1(scale, sequential()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialLog() { - var scale = loggish(transformer$1()).domain([1, 10]); - - scale.copy = function() { - return copy$1(scale, sequentialLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialSymlog() { - var scale = symlogish(transformer$1()); - - scale.copy = function() { - return copy$1(scale, sequentialSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function sequentialPow() { - var scale = powish(transformer$1()); - - scale.copy = 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 transformer$2() { - var x0 = 0, - x1 = 0.5, - x2 = 1, - s = 1, - t0, - t1, - t2, - k10, - k21, - interpolator = identity$4, - transform, - clamp = false, - unknown; - - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2]; - }; - - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - - function range(interpolate) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - - scale.range = range(interpolate); - - scale.rangeRound = range(interpolateRound); - - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; - } - - function diverging() { - var scale = linearish(transformer$2()(identity$4)); - - scale.copy = function() { - return copy$1(scale, diverging()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingLog() { - var scale = loggish(transformer$2()).domain([0.1, 1, 10]); - - scale.copy = function() { - return copy$1(scale, divergingLog()).base(scale.base()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingSymlog() { - var scale = symlogish(transformer$2()); - - scale.copy = function() { - return copy$1(scale, divergingSymlog()).constant(scale.constant()); - }; - - return initInterpolator.apply(scale, arguments); - } - - function divergingPow() { - var scale = powish(transformer$2()); - - scale.copy = 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 band() { - var scale = ordinal().unknown(undefined), - domain = scale.domain, - ordinalRange = scale.range, - range = [0, 1], - step, - bandwidth, - round = false, - paddingInner = 0, - paddingOuter = 0, - align = 0.5; - - delete scale.unknown; - - function rescale() { - var n = domain().length, - reverse = range[1] < range[0], - start = range[reverse - 0], - stop = range[1 - reverse], - space = bandSpace(n, paddingInner, paddingOuter); - - step = (stop - start) / (space || 1); - if (round) { - step = Math.floor(step); - } - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - var values = sequence(n).map(function(i) { return start + step * i; }); - return ordinalRange(reverse ? values.reverse() : values); - } - - scale.domain = function(_) { - if (arguments.length) { - domain(_); - return rescale(); - } else { - return domain(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = [+_[0], +_[1]]; - return rescale(); - } else { - return range.slice(); - } - }; - - scale.rangeRound = function(_) { - range = [+_[0], +_[1]]; - round = true; - return rescale(); - }; - - scale.bandwidth = function() { - return bandwidth; - }; - - scale.step = function() { - return step; - }; - - scale.round = function(_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else { - return round; - } - }; - - scale.padding = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingInner = function(_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingInner; - } - }; - - scale.paddingOuter = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return paddingOuter; - } - }; - - scale.align = function(_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else { - return align; - } - }; - - scale.invertRange = function(_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - - var lo = +_[0], - hi = +_[1], - reverse = range[1] < range[0], - values = reverse ? ordinalRange().reverse() : ordinalRange(), - n = values.length - 1, a, b, t; - - // bail if either range endpoint is invalid - if (lo !== lo || hi !== hi) return; - - // order range inputs, bail if outside of scale range - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - if (hi < values[0] || lo > range[1-reverse]) return; - - // binary search to index into scale range - a = Math.max(0, bisectRight(values, lo) - 1); - b = lo===hi ? a : bisectRight(values, hi) - 1; - - // increment index a if lo is within padding gap - if (lo - values[a] > bandwidth + 1e-10) ++a; - - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - return (a > b) ? undefined : domain().slice(a, b+1); - }; - - scale.invert = function(_) { - var value = scale.invertRange([_, _]); - return value ? value[0] : value; - }; - - scale.copy = function() { - return band() - .domain(domain()) - .range(range) - .round(round) - .paddingInner(paddingInner) - .paddingOuter(paddingOuter) - .align(align); - }; - - return rescale(); - } - - function pointish(scale) { - var copy = scale.copy; - - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - - scale.copy = function() { - return pointish(copy()); - }; - - return scale; - } - - function point$5() { - return pointish(band().paddingInner(1)); - } - - var map$1 = Array.prototype.map; - - function numbers$2(_) { - return map$1.call(_, function(x) { return +x; }); - } - - var slice = Array.prototype.slice; - - function scaleBinOrdinal() { - var domain = [], - range = []; - - function scale(x) { - return x == null || x !== x - ? undefined - : range[(bisectRight(domain, x) - 1) % range.length]; - } - - scale.domain = function(_) { - if (arguments.length) { - domain = numbers$2(_); - return scale; - } else { - return domain.slice(); - } - }; - - scale.range = function(_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else { - return range.slice(); - } - }; - - scale.tickFormat = function(count, specifier) { - return tickFormat(domain[0], peek(domain), count == null ? 10 : count, specifier); - }; - - scale.copy = function() { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - - return scale; - } - - // scale registry - const scales = {}; - - /** - * Augment scales with their type and needed inverse methods. - */ - function create(type, constructor, metadata) { - const ctr = function scale() { - var s = constructor(); - - if (!s.invertRange) { - s.invertRange = s.invert ? invertRange(s) - : s.invertExtent ? invertRangeExtent(s) - : undefined; - } - - s.type = type; - return s; - }; - - ctr.metadata = toSet(array(metadata)); - - return ctr; - } - - function scale$2(type, scale, metadata) { - if (arguments.length > 1) { - scales[type] = create(type, scale, metadata); - return this; - } else { - return isValidScaleType(type) ? scales[type] : undefined; - } - } - - // identity scale - scale$2(Identity, identity$5); - - // continuous scales - scale$2(Linear$1, linear$1, Continuous); - scale$2(Log, log$2, [Continuous, Log]); - scale$2(Pow, pow$1, Continuous); - scale$2(Sqrt, sqrt$1, Continuous); - scale$2(Symlog, symlog$1, Continuous); - scale$2(Time, time, [Continuous, Temporal]); - scale$2(UTC, utcTime, [Continuous, Temporal]); - - // sequential scales - scale$2(Sequential, sequential, [Continuous, Interpolating]); // backwards compat - scale$2(`${Sequential}-${Linear$1}`, sequential, [Continuous, Interpolating]); - scale$2(`${Sequential}-${Log}`, sequentialLog, [Continuous, Interpolating, Log]); - scale$2(`${Sequential}-${Pow}`, sequentialPow, [Continuous, Interpolating]); - scale$2(`${Sequential}-${Sqrt}`, sequentialSqrt, [Continuous, Interpolating]); - scale$2(`${Sequential}-${Symlog}`, sequentialSymlog, [Continuous, Interpolating]); - - // diverging scales - scale$2(`${Diverging}-${Linear$1}`, diverging, [Continuous, Interpolating]); - scale$2(`${Diverging}-${Log}`, divergingLog, [Continuous, Interpolating, Log]); - scale$2(`${Diverging}-${Pow}`, divergingPow, [Continuous, Interpolating]); - scale$2(`${Diverging}-${Sqrt}`, divergingSqrt, [Continuous, Interpolating]); - scale$2(`${Diverging}-${Symlog}`, divergingSymlog, [Continuous, Interpolating]); - - // discretizing scales - scale$2(Quantile$1, quantile$1, [Discretizing, Quantile$1]); - scale$2(Quantize, quantize$1, Discretizing); - scale$2(Threshold, threshold, Discretizing); - - // discrete scales - scale$2(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]); - scale$2(Ordinal, ordinal, Discrete); - scale$2(Band, band, Discrete); - scale$2(Point, point$5, Discrete); - - function isValidScaleType(type) { - return hasOwnProperty(scales, type); - } - - function hasType(key, type) { - const s = scales[key]; - return s && s.metadata[type]; - } - - function isContinuous(key) { - return hasType(key, Continuous); - } - - function isDiscrete(key) { - return hasType(key, Discrete); - } - - function isDiscretizing(key) { - return hasType(key, Discretizing); - } - - function isLogarithmic(key) { - return hasType(key, Log); - } - - function isTemporal(key) { - return hasType(key, Temporal); - } - - function isInterpolating(key) { - return hasType(key, Interpolating); - } - - function isQuantile(key) { - return hasType(key, Quantile$1); - } - - const scaleProps = ['clamp', 'base', 'constant', 'exponent']; - - function interpolateRange(interpolator, range) { - var start = range[0], - span = peek(range) - start; - return function(i) { return interpolator(start + i * span); }; - } - - function interpolateColors(colors, type, gamma) { - return piecewise(interpolate$1(type || 'rgb', gamma), colors); - } - - function quantizeInterpolator(interpolator, count) { - var samples = new Array(count), - n = count + 1; - for (var i = 0; i < count;) samples[i] = interpolator(++i / n); - return samples; - } - - function scaleFraction(scale, min, max) { - var delta = max - min, i, t, s; - - if (!delta || !Number.isFinite(delta)) { - return constant(0.5); - } else { - i = (t = scale.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale$2(t)().domain([min, max]).range([0, 1]); - scaleProps.forEach(m => scale[m] ? s[m](scale[m]()) : 0); - return s; - } - } - - function interpolate$1(type, gamma) { - var interp = $$1[method(type)]; - return (gamma != null && interp && interp.gamma) - ? interp.gamma(gamma) - : interp; - } - - function method(type) { - return 'interpolate' + type.toLowerCase() - .split('-') - .map(function(s) { return s[0].toUpperCase() + s.slice(1); }) - .join(''); - } - - const continuous$1 = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' - }; - - const discrete$1 = { - category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', - accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', - dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', - paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', - pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', - pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', - set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', - set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', - set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' - }; - - function colors(palette) { - var n = palette.length / 6 | 0, c = new Array(n), i = 0; - while (i < n) c[i] = '#' + palette.slice(i * 6, ++i * 6); - return c; - } - - function apply(_, f) { - for (let k in _) scheme(k, f(_[k])); - } - - const schemes = {}; - apply(discrete$1, colors); - apply(continuous$1, _ => interpolateColors(colors(_))); - - function scheme(name, scheme) { - name = name && name.toLowerCase(); - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else { - return schemes[name]; - } - } - - var SymbolLegend = 'symbol'; - var DiscreteLegend = 'discrete'; - var GradientLegend = 'gradient'; - - const defaultFormatter = value => isArray(value) - ? value.map(v => String(v)) - : String(value); - - const ascending$1 = (a, b) => a[1] - b[1]; - const descending = (a, b) => b[1] - a[1]; - - /** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ - function tickCount(scale, count, minStep) { - var step; - - if (isNumber(count)) { - if (scale.bins) { - count = Math.max(count, scale.bins.length); - } - if (minStep != null) { - count = Math.min( - count, - Math.floor((span(scale.domain()) / minStep) || 1) - ); - } - } - - if (isObject(count)) { - step = count.step; - count = count.interval; - } - - if (isString(count)) { - count = scale.type === Time ? timeInterval(count) - : scale.type == UTC ? utcInterval(count) - : error('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - - return count; - } - - /** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ - function validTicks(scale, ticks, count) { - let range = scale.range(), - lo = range[0], - hi = peek(range), - cmp = ascending$1; - - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - - lo = Math.floor(lo); - hi = Math.ceil(hi); - - // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - ticks = ticks.map(v => [v, scale(v)]) - .filter(_ => lo <= _[1] && _[1] <= hi) - .sort(cmp) - .map(_ => _[0]); - - if (count > 0 && ticks.length > 1) { - const endpoints = [ticks[0], peek(ticks)]; - while (ticks.length > count && ticks.length >= 3) { - ticks = ticks.filter((_, i) => !(i % 2)); - } - if (ticks.length < 3) { - ticks = endpoints; - } - } - - return ticks; - } - - /** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ - function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins) - : scale.ticks ? scale.ticks(count) - : scale.domain(); - } - - /** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ - function tickFormat$1(locale, scale, count, specifier, formatType, noSkip) { - var type = scale.type; - let format = defaultFormatter; - - if (type === Time || formatType === Time) { - format = locale.timeFormat(specifier); - } - else if (type === UTC || formatType === UTC) { - format = locale.utcFormat(specifier); - } - else if (isLogarithmic(type)) { - const varfmt = locale.formatFloat(specifier); - if (noSkip || scale.bins) { - format = varfmt; - } else { - const test = tickLog(scale, count, false); - format = _ => test(_) ? varfmt(_) : ''; - } - } - else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - const d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } - else if (specifier) { - format = locale.format(specifier); - } - - return format; - } - - function tickLog(scale, count, values) { - const ticks = tickValues(scale, count), - base = scale.base(), - logb = Math.log(base), - k = Math.max(1, base * count / ticks.length); - - // apply d3-scale's log format filter criteria - const test = d => { - let i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - - return values ? ticks.filter(test) : test; - } - - const symbols$1 = { - [Quantile$1]: 'quantiles', - [Quantize]: 'thresholds', - [Threshold]: 'domain' - }; - - const formats$1 = { - [Quantile$1]: 'quantiles', - [Quantize]: 'domain' - }; - - function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) - : scale.type === Log ? tickLog(scale, count, true) - : symbols$1[scale.type] ? thresholdValues(scale[symbols$1[scale.type]]()) - : tickValues(scale, count); - } - - function thresholdFormat(locale, scale, specifier) { - var _ = scale[formats$1[scale.type]](), - n = _.length, - d = n > 1 ? _[1] - _[0] : _[0], i; - - for (i=1; i { - var limit = get$2(array[index + 1], get$2(array.max, +Infinity)), - lo = formatValue(value, format), - hi = formatValue(limit, format); - return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo; - }; - } - - function get$2(value, dflt) { - return value != null ? value : dflt; - } - - function formatDiscrete(format) { - return (value, index) => index ? format(value) : null; - } - - function formatPoint(format) { - return value => format(value); - } - - function formatValue(value, format) { - return Number.isFinite(value) ? format(value) : null; - } - - function labelFraction(scale) { - var domain = scale.domain(), - count = domain.length - 1, - lo = +domain[0], - hi = +peek(domain), - span = hi - lo; - - if (scale.type === Threshold) { - const adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - - return value => (value - lo) / span; - } - - function format$2(locale, scale, specifier, formatType) { - const type = formatType || scale.type; - - // replace abbreviated time specifiers to improve screen reader experience - if (isString(specifier) && isTemporal(type)) { - specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - } - - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') - : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') - : labelFormat(locale, scale, 5, null, specifier, formatType, true); - } - - function domainCaption(locale, scale, opt) { - opt = opt || {}; - const max = Math.max(3, opt.maxlen || 7), - fmt = format$2(locale, scale, opt.format, opt.formatType); - - // if scale breaks domain into bins, describe boundaries - if (isDiscretizing(scale.type)) { - const v = labelValues(scale).slice(1).map(fmt), - n = v.length; - return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`; - } - - // if scale domain is discrete, list values - else if (isDiscrete(scale.type)) { - const d = scale.domain(), - n = d.length, - v = n > max - ? d.slice(0, max - 2).map(fmt).join(', ') - + ', ending with ' + d.slice(-1).map(fmt) - : d.map(fmt).join(', '); - return `${n} value${n === 1 ? '' : 's'}: ${v}`; - } - - // if scale domain is continuous, describe value range - else { - const d = scale.domain(); - return `values from ${fmt(d[0])} to ${fmt(peek(d))}`; - } - } - - const ARIA_HIDDEN = 'aria-hidden'; - const ARIA_LABEL = 'aria-label'; - const ARIA_ROLE = 'role'; - const ARIA_ROLEDESCRIPTION = 'aria-roledescription'; - const GRAPHICS_OBJECT = 'graphics-object'; - const GRAPHICS_SYMBOL = 'graphics-symbol'; - - const bundle = (role, roledesc, label) => ({ - [ARIA_ROLE]: role, - [ARIA_ROLEDESCRIPTION]: roledesc, - [ARIA_LABEL]: label || undefined - }); - - // these roles are covered by related roles - // we can ignore them, no need to generate attributes - const AriaIgnore = toSet([ - 'axis-domain', - 'axis-grid', - 'axis-label', - 'axis-tick', - 'axis-title', - 'legend-band', - 'legend-entry', - 'legend-gradient', - 'legend-label', - 'legend-title', - 'legend-symbol', - 'title' - ]); - - // aria attribute generators for guide roles - const AriaGuides = { - 'axis': {desc: 'axis', caption: axisCaption}, - 'legend': {desc: 'legend', caption: legendCaption}, - 'title-text': { - desc: 'title', - caption: item => `Title text '${titleCaption(item)}'` - }, - 'title-subtitle': { - desc: 'subtitle', - caption: item => `Subtitle text '${titleCaption(item)}'` - } - }; - - // aria properties generated for mark item encoding channels - const AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL - }; - - function ariaItemAttributes(emit, item) { - const hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - - if (hide || item.description == null) { - for (const prop in AriaEncode) { - emit(AriaEncode[prop], undefined); - } - } else { - const type = item.mark.marktype; - emit( - ARIA_LABEL, - item.description - ); - emit( - ARIA_ROLE, - item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL) - ); - emit( - ARIA_ROLEDESCRIPTION, - item.ariaRoleDescription || `${type} mark` - ); - } - } - - function ariaMarkAttributes(mark) { - return mark.aria === false ? { [ARIA_HIDDEN]: true } - : AriaIgnore[mark.role] ? null - : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) - : ariaMark(mark); - } - - function ariaMark(mark) { - const type = mark.marktype; - const recurse = ( - type === 'group' || - type === 'text' || - mark.items.some(_ => _.description != null && _.aria !== false) - ); - return bundle( - recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, - `${type} mark container`, - mark.description - ); - } - - function ariaGuide(mark, opt) { - try { - const item = mark.items[0], - caption = opt.caption || (() => ''); - return bundle( - opt.role || GRAPHICS_SYMBOL, - opt.desc, - item.description || caption(item) - ); - } catch (err) { - return null; - } - } - - function titleCaption(item) { - return array(item.text).join(' '); - } - - function axisCaption(item) { - const datum = item.datum, - orient = item.orient, - title = datum.title ? extractTitle(item) : null, - ctx = item.context, - scale = ctx.scales[datum.scale].value, - locale = ctx.dataflow.locale(), - type = scale.type, - xy = (orient === 'left' || orient === 'right') ? 'Y' : 'X'; - - return `${xy}-axis` - + (title ? ` titled '${title}'` : '') - + ` for a ${isDiscrete(type) ? 'discrete' : type} scale` - + ` with ${domainCaption(locale, scale, item)}`; - } - - function legendCaption(item) { - const datum = item.datum, - title = datum.title ? extractTitle(item) : null, - type = `${datum.type || ''} legend`.trim(), - scales = datum.scales, - props = Object.keys(scales), - ctx = item.context, - scale = ctx.scales[scales[props[0]]].value, - locale = ctx.dataflow.locale(); - - return capitalize(type) - + (title ? ` titled '${title}'` : '') - + ` for ${channelCaption(props)}` - + ` with ${domainCaption(locale, scale, item)}`; - } - - function extractTitle(item) { - try { - return array(peek(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } - } - - function channelCaption(props) { - props = props.map(p => p + (p === 'fill' || p === 'stroke' ? ' color' : '')); - return props.length < 2 ? props[0] - : props.slice(0, -1).join(', ') + ' and ' + peek(props); - } - - function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; - } - - const attrText = val => (val + '') - .replace(/&/g, '&') - .replace(/"/g, '"'); - - /** - * Generate string for an opening xml tag. - * @param tag the name of the xml tag - * @param attr hash of attribute name-value pairs to include - * @param raw additional raw string to include in tag markup - */ - function openTag(tag, attr, raw) { - var s = '<' + tag, key, val; - if (attr) { - for (key in attr) { - val = attr[key]; - if (val != null) { - s += ' ' + key + '="' + attrText(val) + '"'; - } - } - } - if (raw) s += ' ' + raw; - return s + '>'; - } - - /** - * Generate string for closing xml tag. - * @param tag the name of the xml tag - */ - function closeTag(tag) { - return ''; - } - - const styles = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity', - blend: 'mix-blend-mode' - }; - - // ensure miter limit default is consistent with canvas (#2498) - const rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 - }; - - const RootIndex = 0, - ns = metadata.xmlns; - - function SVGRenderer(loader) { - Renderer.call(this, loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; - } - - var prototype$O = inherits(SVGRenderer, Renderer); - var base$1 = Renderer.prototype; - - prototype$O.initialize = function(el, width, height, padding) { - // create the svg definitions cache - this._defs = { - gradient: {}, - clipping: {} - }; - - if (el) { - this._svg = domChild(el, 0, 'svg', ns); - this._svg.setAttribute('class', 'marks'); - domClear(el, 1); - - // set the svg root group - this._root = domChild(this._svg, RootIndex, 'g', ns); - for (const attr in rootAttributes) { - this._root.setAttribute(attr, rootAttributes[attr]); - } - - // ensure no additional child elements - domClear(this._svg, RootIndex + 1); - } - - // set background color if defined - this.background(this._bgcolor); - - return base$1.initialize.call(this, el, width, height, padding); - }; - - prototype$O.background = function(bgcolor) { - if (arguments.length && this._svg) { - this._svg.style.setProperty('background-color', bgcolor); - } - return base$1.background.apply(this, arguments); - }; - - prototype$O.resize = function(width, height, origin, scaleFactor) { - base$1.resize.call(this, width, height, origin, scaleFactor); - - if (this._svg) { - this._svg.setAttribute('width', this._width * this._scale); - this._svg.setAttribute('height', this._height * this._scale); - this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height); - this._root.setAttribute('transform', 'translate(' + this._origin + ')'); - } - - this._dirty = []; - - return this; - }; - - prototype$O.canvas = function() { - return this._svg; - }; - - prototype$O.svg = function() { - if (!this._svg) return null; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - var bg = !this._bgcolor ? '' - : (openTag('rect', { - width: this._width, - height: this._height, - fill: this._bgcolor - }) + closeTag('rect')); - - return openTag('svg', attr) - + (this._defs.el ? this._defs.el.outerHTML : '') - + bg - + this._root.outerHTML - + closeTag('svg'); - }; - - - // -- Render entry point -- - - prototype$O._render = function(scene) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._resetDefs(); - this.draw(this._root, scene); - domClear(this._root, 1); - } - - this.updateDefs(); - - this._dirty = []; - ++this._dirtyID; - - return this; - }; - - // -- Manage SVG definitions ('defs') block -- - - prototype$O.updateDefs = function() { - const svg = this._svg, - defs = this._defs; - - let el = defs.el, - index = 0; - - for (const id in defs.gradient) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateGradient(el, defs.gradient[id], index); - } - - for (const id in defs.clipping) { - if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns)); - index = updateClipping(el, defs.clipping[id], index); - } - - // clean-up - if (el) { - index === 0 - ? (svg.removeChild(el), defs.el = null) - : domClear(el, index); - } - }; - - function updateGradient(el, grad, index) { - var i, n, stop; - - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - var pt = domChild(el, index++, 'pattern', ns); - pt.setAttribute('id', patternPrefix + grad.id); - pt.setAttribute('viewBox', '0,0,1,1'); - pt.setAttribute('width', '100%'); - pt.setAttribute('height', '100%'); - pt.setAttribute('preserveAspectRatio', 'xMidYMid slice'); - - pt = domChild(pt, 0, 'rect', ns); - pt.setAttribute('width', '1'); - pt.setAttribute('height', '1'); - pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')'); - - el = domChild(el, index++, 'radialGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('fx', grad.x1); - el.setAttribute('fy', grad.y1); - el.setAttribute('fr', grad.r1); - el.setAttribute('cx', grad.x2); - el.setAttribute('cy', grad.y2); - el.setAttribute( 'r', grad.r2); - } else { - el = domChild(el, index++, 'linearGradient', ns); - el.setAttribute('id', grad.id); - el.setAttribute('x1', grad.x1); - el.setAttribute('x2', grad.x2); - el.setAttribute('y1', grad.y1); - el.setAttribute('y2', grad.y2); - } - - for (i=0, n=grad.stops.length; i { - const dirty = this.isDirty(item), - node = bind(item, parent, sibling, mdef.tag, svg); - - if (dirty) { - this._update(mdef, node, item); - if (isGroup) recurse(this, node, item); - } - - sibling = node; - ++i; - }; - - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else { - visit(scene, process); - } - - domClear(parent, i); - return parent; - }; - - // Recursively process group contents. - function recurse(renderer, el, group) { - el = el.lastChild.previousSibling; - let prev, idx = 0; - - visit(group, item => { - prev = renderer.draw(el, item, prev); - ++idx; - }); - - // remove any extraneous DOM elements - domClear(el, 1 + idx); - } - - // Bind a scenegraph item to an SVG DOM element. - // Create new SVG elements as needed. - function bind(item, el, sibling, tag, svg) { - let node = item._svg, doc; - - // create a new dom node if needed - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, ns); - item._svg = node; - - if (item.mark) { - node.__data__ = item; - node.__values__ = {fill: 'default'}; - - // if group, create background, content, and foreground elements - if (tag === 'g') { - const bg = domCreate(doc, 'path', ns); - node.appendChild(bg); - bg.__data__ = item; - - const cg = domCreate(doc, 'g', ns); - node.appendChild(cg); - cg.__data__ = item; - - const fg = domCreate(doc, 'path', ns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = {fill: 'default'}; - } - } - } - - // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { - el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - } - - return node; - } - - function siblingCheck(node, sibling) { - return node.parentNode - && node.parentNode.childNodes.length > 1 - && node.previousSibling != sibling; // treat null/undefined the same - } - - - // -- Set attributes & styles on SVG elements --- - - var element = null, // temp var for current SVG element - values = null; // temp var for current values hash - - // Extra configuration for certain mark types - var mark_extras = { - group: function(mdef, el, item) { - const fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - - values = el.__values__; // use parent's values hash - element = el.childNodes[1]; - mdef.content(emit, item, this); - - const bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - - const value = item.mark.interactive === false ? 'none' : null; - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - - if (item.strokeForeground && item.stroke) { - const fill = item.fill; - setAttribute(fg, 'display', null); - - // set style of background - this.style(bg, item); - setAttribute(bg, 'stroke', null); - - // set style of foreground - if (fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (fill) item.fill = fill; - - // leave element null to prevent downstream styling - element = null; - } else { - // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - } - }, - image: function(mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else { - setStyle(el, 'image-rendering', null); - } - }, - text: function(mdef, el, item) { - let tl = textLines(item), - key, value, doc, lh; - - if (isArray(tl)) { - // multi-line text - value = tl.map(_ => textValue(item, _)); - key = value.join('\n'); // content cache key - - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach((t, i) => { - const ts = domCreate(doc, 'tspan', ns); - ts.__data__ = item; // data binding - ts.textContent = t; - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } - }; - - function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) { - el.style.removeProperty(name); - } else { - el.style.setProperty(name, value + ''); - } - values[name] = value; - } - } - - prototype$O._update = function(mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; - - // apply aria-specific properties - ariaItemAttributes(emit, item); - - // apply svg attributes - mdef.attr(emit, item, this); - - // some marks need special treatment - const extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); - - // apply svg style attributes - // note: element may be modified by 'extra' method - if (element) this.style(element, item); - }; - - function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; - - // use appropriate method given namespace (ns) - if (ns) { - setAttributeNS(element, name, value, ns); - } else { - setAttribute(element, name, value); - } - - // note current value for future comparison - values[name] = value; - } - - function setAttribute(el, name, value) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttribute(name, value); - } else { - // else remove DOM attribute - el.removeAttribute(name); - } - } - - function setAttributeNS(el, name, value, ns) { - if (value != null) { - // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - } else { - // else remove DOM attribute - el.removeAttributeNS(ns, name); - } - } - - prototype$O.style = function(el, o) { - if (o == null) return; - - for (const prop in styles) { - let value = prop === 'font' ? fontFamily(o) : o[prop]; - if (value === values[prop]) continue; - - const name = styles[prop]; - if (value == null) { - el.removeAttribute(name); - } else { - if (isGradient(value)) { - value = gradientRef(value, this._defs.gradient, href()); - } - el.setAttribute(name, value + ''); - } - - values[prop] = value; - } - }; - - function href() { - let loc; - return typeof window === 'undefined' ? '' - : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) - : loc.href; - } - - function SVGStringRenderer(loader) { - Renderer.call(this, loader); - - this._text = { - head: '', - bg: '', - root: '', - foot: '', - defs: '', - body: '' - }; - - this._defs = { - gradient: {}, - clipping: {} - }; - } - - var prototype$P = inherits(SVGStringRenderer, Renderer); - var base$2 = Renderer.prototype; - - prototype$P.resize = function(width, height, origin, scaleFactor) { - base$2.resize.call(this, width, height, origin, scaleFactor); - var o = this._origin, - t = this._text; - - var attr = { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: '0 0 ' + this._width + ' ' + this._height - }; - for (var key in metadata) { - attr[key] = metadata[key]; - } - - t.head = openTag('svg', attr); - - var bg = this._bgcolor; - if (bg === 'transparent' || bg === 'none') bg = null; - - if (bg) { - t.bg = openTag('rect', { - width: this._width, - height: this._height, - fill: bg - }) + closeTag('rect'); - } else { - t.bg = ''; - } - - t.root = openTag('g', extend( - {}, rootAttributes, {transform: 'translate(' + o + ')'} - )); - - t.foot = closeTag('g') + closeTag('svg'); - - return this; - }; - - prototype$P.background = function() { - var rv = base$2.background.apply(this, arguments); - if (arguments.length && this._text.head) { - this.resize(this._width, this._height, this._origin, this._scale); - } - return rv; - }; - - prototype$P.svg = function() { - var t = this._text; - return t.head + t.defs + t.bg + t.root + t.body + t.foot; - }; - - prototype$P._render = function(scene) { - this._text.body = this.mark(scene); - this._text.defs = this.buildDefs(); - return this; - }; - - prototype$P.buildDefs = function() { - let defs = '', tag; - - for (const id in this._defs.gradient) { - const def = this._defs.gradient[id], - stops = def.stops; - - if (def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - - defs += openTag(tag = 'pattern', { - id: patternPrefix + id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - - defs += openTag('rect', { - width: '1', - height: '1', - fill: 'url(#' + id + ')' - }) + closeTag('rect'); - - defs += closeTag(tag); - - defs += openTag(tag = 'radialGradient', { - id: id, - fx: def.x1, - fy: def.y1, - fr: def.r1, - cx: def.x2, - cy: def.y2, - r: def.r2 - }); - } else { - defs += openTag(tag = 'linearGradient', { - id: id, - x1: def.x1, - x2: def.x2, - y1: def.y1, - y2: def.y2 - }); - } - - for (let i = 0; i < stops.length; ++i) { - defs += openTag('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }) + closeTag('stop'); - } - - defs += closeTag(tag); - } - - for (const id in this._defs.clipping) { - const def = this._defs.clipping[id]; - - defs += openTag('clipPath', {id: id}); - - if (def.path) { - defs += openTag('path', { - d: def.path - }) + closeTag('path'); - } else { - defs += openTag('rect', { - x: 0, - y: 0, - width: def.width, - height: def.height - }) + closeTag('rect'); - } - - defs += closeTag('clipPath'); - } - - return defs ? (openTag('defs') + defs + closeTag('defs')) : ''; - }; - - prototype$P.attr = function(scene, item, attrs, tag) { - const object = {}, - emit = (name, value, ns, prefixed) => { - object[prefixed || name] = value; - }; - - // apply mark specific attributes - if (Array.isArray(attrs)) { - attrs.forEach(fn => fn(emit, item, this)); - } else { - attrs(emit, item, this); - } - - // apply style attributes - if (tag) { - applyStyles(object, item, scene, tag, this._defs); - } - - return object; - }; - - prototype$P.href = function(item) { - var that = this, - href = item.href, - attr; - - if (href) { - if (attr = that._hrefs && that._hrefs[href]) { - return attr; - } else { - that.sanitizeURL(href).then(attr => { - // rewrite to use xlink namespace - // note that this will be deprecated in SVG 2.0 - attr['xlink:href'] = attr.href; - attr.href = null; - (that._hrefs || (that._hrefs = {}))[href] = attr; - }); - } - } - return null; - }; - - prototype$P.mark = function(scene) { - const mdef = Marks[scene.marktype], - tag = mdef.tag, - attrList = [ariaItemAttributes, mdef.attr]; - - let str = ''; - - // render opening group tag - str += openTag('g', extend( - { - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip(this, scene, scene.group) : null - }, - ariaMarkAttributes(scene), - { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - } - )); - - // render contained elements - const process = item => { - const href = this.href(item); - if (href) str += openTag('a', href); - - str += openTag( - tag, - this.attr(scene, item, attrList, tag !== 'g' ? tag : null) - ); - - if (tag === 'text') { - const tl = textLines(item); - if (isArray(tl)) { - // multi-line text - const attrs = {x: 0, dy: lineHeight(item)}; - for (let i=0; i { str += this.mark(item); }); - return str; - }; - - function applyStyles(s, item, scene, tag, defs) { - if (item == null) return s; - - if (tag === 'bgrect' && scene.interactive === false) { - s['pointer-events'] = 'none'; - } - - if (tag === 'bgfore') { - if (scene.interactive === false) { - s['pointer-events'] = 'none'; - } - s.display = 'none'; - if (item.fill !== null) return s; - } - - if (tag === 'image' && item.smooth === false) { - s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;'; - } - - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - if (item.fontStyle) s['font-style'] = item.fontStyle; - if (item.fontVariant) s['font-variant'] = item.fontVariant; - if (item.fontWeight) s['font-weight'] = item.fontWeight; - } - - for (const prop in styles) { - let value = item[prop]; - const name = styles[prop]; - - if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; else if (value != null) { - if (isGradient(value)) { - value = gradientRef(value, defs.gradient, ''); - } - s[name] = value; - } - } - - return s; - } - - function escape_text(s) { - return s.replace(/&/g, '&') - .replace(//g, '>'); - } - - var Canvas = 'canvas'; - var PNG = 'png'; - var SVG = 'svg'; - var None$2 = 'none'; - - var RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - None: None$2 - }; - - var modules = {}; - - modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler - }; - - modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler - }; - - modules[None$2] = {}; - - function renderModule(name, _) { - name = String(name || '').toLowerCase(); - if (arguments.length > 1) { - modules[name] = _; - return this; - } else { - return modules[name]; - } - } - - function intersect$1(scene, bounds, filter) { - const hits = [], // intersection results - box = new Bounds().union(bounds), // defensive copy - type = scene.marktype; - - return type ? intersectMark(scene, box, filter, hits) - : type === 'group' ? intersectGroup(scene, box, filter, hits) - : error('Intersect scene must be mark node or group item.'); - } - - function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - const items = mark.items, - type = mark.marktype, - n = items.length; - - let i = 0; - - if (type === 'group') { - for (; i= 0; i--) { - if (ka[i] != kb[i]) return false; - } - - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; - } - - return typeof a === typeof b; - } - - function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); - } - - /** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ - function Bound(params) { - Transform.call(this, null, params); - } - - var prototype$Q = inherits(Bound, Transform); - - prototype$Q.transform = function(_, pulse) { - var view = pulse.dataflow, - mark = _.mark, - type = mark.marktype, - entry = Marks[type], - bound = entry.bound, - markBounds = mark.bounds, rebound; - - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem$1(mark, bound); - mark.items.forEach(function(item) { - item.bounds.clear().union(markBounds); - }); - } - - else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, item => view.dirty(item)); - markBounds.clear(); - mark.items.forEach(item => markBounds.union(boundItem$1(item, bound))); - - // force reflow for axes/legends/titles to propagate any layout changes - switch (mark.role) { - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } - - else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - - pulse.visit(pulse.ADD, item => { - markBounds.union(boundItem$1(item, bound)); - }); - - pulse.visit(pulse.MOD, item => { - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem$1(item, bound)); - }); - - if (rebound) { - markBounds.clear(); - mark.items.forEach(item => markBounds.union(item.bounds)); - } - } - - // ensure mark bounds do not exceed any clipping region - boundClip(mark); - - return pulse.modifies('bounds'); - }; - - function boundItem$1(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); - } - - var COUNTER_NAME = ':vega_identifier:'; - - /** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ - function Identifier(params) { - Transform.call(this, 0, params); - } - - Identifier.Definition = { - 'type': 'Identifier', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'as', 'type': 'string', 'required': true } - ] - }; - - var prototype$R = inherits(Identifier, Transform); - - prototype$R.transform = function(_, pulse) { - var counter = getCounter(pulse.dataflow), - id = counter.value, - as = _.as; - - pulse.visit(pulse.ADD, t => { - if (!t[as]) t[as] = ++id; - }); - - counter.set(this.value = id); - return pulse; - }; - - function getCounter(view) { - var counter = view._signals[COUNTER_NAME]; - if (!counter) { - view._signals[COUNTER_NAME] = (counter = view.add(0)); - } - return counter; - } - - /** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ - function Mark(params) { - Transform.call(this, null, params); - } - - var prototype$S = inherits(Mark, Transform); - - prototype$S.transform = function(_, pulse) { - var mark = this.value; - - // acquire mark on first invocation, bind context and group - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } - - // initialize entering items - var Init = mark.marktype === Group ? GroupItem : Item; - pulse.visit(pulse.ADD, item => Init.call(item, mark)); - - // update clipping and/or interactive status - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - pulse.reflow(); - } - - // bind items array to scenegraph mark - mark.items = pulse.source; - return pulse; - }; - - function lookup$1(_) { - var g = _.groups, p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) - : g && p ? g.lookup(p) - : null; - } - - /** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ - function Overlap(params) { - Transform.call(this, null, params); - } - - var prototype$T = inherits(Overlap, Transform); - - var methods = { - parity: items => { - return items.filter((item, i) => i % 2 ? (item.opacity = 0) : 1); - }, - greedy: (items, sep) => { - var a; - return items.filter((b, i) => { - if (!i || !intersect$2(a.bounds, b.bounds, sep)) { - a = b; - return 1; - } else { - return b.opacity = 0; - } - }); - } - }; - - // compute bounding box intersection - // including padding pixels of separation - function intersect$2(a, b, sep) { - return sep > Math.max( - b.x1 - a.x2, - a.x1 - b.x2, - b.y1 - a.y2, - a.y1 - b.y2 - ); - } - - function hasOverlap(items, pad) { - for (var i=1, n=items.length, a=items[0].bounds, b; i 1 && b.height() > 1; - } - - function boundTest(scale, orient, tolerance) { - var range = scale.range(), - b = new Bounds(); - - if (orient === Top || orient === Bottom) { - b.set(range[0], -Infinity, range[1], +Infinity); - } else { - b.set(-Infinity, range[0], +Infinity, range[1]); - } - b.expand(tolerance || 1); - - return item => b.encloses(item.bounds); - } - - // reset all items to be fully opaque - function reset(source) { - source.forEach(item => item.opacity = 1); - return source; - } - - // add all tuples to mod, fork pulse if parameters were modified - // fork prevents cross-stream tuple pollution (e.g., pulse from scale) - function reflow(pulse, _) { - return pulse.reflow(_.modified()).modifies('opacity'); - } - - prototype$T.transform = function(_, pulse) { - var reduce = methods[_.method] || methods.parity, - source = pulse.materialize(pulse.SOURCE).source, - sep = _.separation || 0, - items, test, bounds; - - if (!source || !source.length) return; - - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - return pulse; - } - - // skip labels with no content - source = source.filter(hasBounds); - - // early exit, nothing to do - if (!source.length) return; - - if (_.sort) { - source = source.slice().sort(_.sort); - } - - items = reset(source); - pulse = reflow(pulse, _); - - if (items.length >= 3 && hasOverlap(items, sep)) { - do { - items = reduce(items, sep); - } while (items.length >= 3 && hasOverlap(items, sep)); - - if (items.length < 3 && !peek(source).opacity) { - if (items.length > 1) peek(items).opacity = 0; - peek(source).opacity = 1; - } - } - - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach(item => { - if (!test(item)) item.opacity = 0; - }); - } - - // re-calculate mark bounds - bounds = items[0].mark.bounds.clear(); - source.forEach(item => { - if (item.opacity) bounds.union(item.bounds); - }); - - return pulse; - }; - - /** - * Queue modified scenegraph items for rendering. - * @constructor - */ - function Render(params) { - Transform.call(this, null, params); - } - - var prototype$U = inherits(Render, Transform); - - prototype$U.transform = function(_, pulse) { - var view = pulse.dataflow; - - pulse.visit(pulse.ALL, item => view.dirty(item)); - - // set z-index dirty flag as needed - if (pulse.fields && pulse.fields['zindex']) { - var item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } - }; - - const tempBounds$1 = new Bounds(); - - function set$1(item, property, value) { - return item[property] === value ? 0 - : (item[property] = value, 1); - } - - function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; - } - - function axisIndices(datum) { - var index = +datum.grid; - return [ - datum.ticks ? index++ : -1, // ticks index - datum.labels ? index++ : -1, // labels index - index + (+datum.domain) // title index - ]; - } - - function axisLayout(view, axis, width, height) { - var item = axis.items[0], - datum = item.datum, - delta = item.translate != null ? item.translate : 0.5, - orient = item.orient, - indices = axisIndices(datum), - range = item.range, - offset = item.offset, - position = item.position, - minExtent = item.minExtent, - maxExtent = item.maxExtent, - title = datum.title && item.items[indices[2]].items[0], - titlePadding = item.titlePadding, - bounds = item.bounds, - dl = title && multiLineOffset(title), - x = 0, y = 0, i, s; - - tempBounds$1.clear().union(bounds); - bounds.clear(); - if ((i=indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i=indices[1]) > -1) bounds.union(item.items[i].bounds); - - // position axis group and title - switch (orient) { - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - default: - x = item.x; - y = item.y; - } - - // update bounds - boundStroke(bounds.translate(x, y), item); - - if (set$1(item, 'x', x + delta) | set$1(item, 'y', y + delta)) { - item.bounds = tempBounds$1; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - - return item.mark.bounds.clear().union(bounds); - } - - function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - const b = title.bounds; - - if (title.auto) { - const v = sign * (offset + dl + pad); - let dx = 0, dy = 0; - - view.dirty(title); - isYAxis - ? dx = (title.x || 0) - (title.x = v) - : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - - bounds.union(b); - } - - // aggregation functions for grid margin determination - const min$2 = (a, b) => Math.floor(Math.min(a, b)); - const max$2 = (a, b) => Math.ceil(Math.max(a, b)); - - function gridLayoutGroups(group) { - var groups = group.items, - n = groups.length, - i = 0, mark, items; - - var views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; - - // layout axes, gather legends, collect bounds - for (; i 1) { - for (i=0; i 0) dx[i] += x / 2; - } - } - - // perform vertical centering - if (alignRow && get$3(opt.center, Row) && ncols !== 1) { - for (i=0; i 0) dy[i] += y / 2; - } - } - - // position grid relative to anchor - for (i=0; i limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } - - // apply offset - init += offset; - - // clear mark bounds for all headers - for (j=0, m=headers.length; j= 0 && (g = groups[k]) == null; k-=back); - - // assign coordinates and update bounds - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); - - // update current edge of layout bounds - edge = agg(edge, b[bf]); - } - - return edge; - } - - function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); - - // compute title coordinates - var x = offset, y = offset; - isX - ? (x = Math.round(bounds.x1 + band * bounds.width())) - : (y = Math.round(bounds.y1 + band * bounds.height())); - - // assign coordinates and update bounds - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; - - // queue title for redraw - view.dirty(g); - } - - // utility for looking up legend layout configuration - function lookup$2(config, orient) { - const opt = config[orient] || {}; - return (key, d) => opt[key] != null ? opt[key] - : config[key] != null ? config[key] - : d; - } - - // if legends specify offset directly, use the maximum specified value - function offsets(legends, value) { - var max = -Infinity; - legends.forEach(item => { - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; - } - - function legendParams(g, orient, config, xb, yb, w, h) { - const _ = lookup$2(config, orient), - offset = offsets(g, _('offset', 0)), - anchor = _('anchor', Start), - mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - - const p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - - switch (orient) { - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, column: End, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), row: anchor - }; - break; - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, row: End, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), column: anchor - }; - break; - case TopLeft: - p.anchor = {x: offset, y: offset}; - break; - case TopRight: - p.anchor = {x: w - offset, y: offset, column: End}; - break; - case BottomLeft: - p.anchor = {x: offset, y: h - offset, row: End}; - break; - case BottomRight: - p.anchor = {x: w - offset, y: h - offset, column: End, row: End}; - break; - } - - return p; - } - - function legendLayout(view, legend) { - var item = legend.items[0], - datum = item.datum, - orient = item.orient, - bounds = item.bounds, - x = item.x, y = item.y, w, h; - - // cache current bounds for later comparison - item._bounds - ? item._bounds.clear().union(bounds) - : item._bounds = bounds.clone(); - bounds.clear(); - - // adjust legend to accommodate padding and title - legendGroupLayout(view, item, item.items[0].items[0]); - - // aggregate bounds to determine size, and include origin - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - - if (datum.type === Symbols) { - legendEntryLayout(item.items[0].items[0].items[0].items); - } - - if (orient !== None$1) { - item.x = x = 0; - item.y = y = 0; - } - item.width = w; - item.height = h; - boundStroke(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - - return item; - } - - function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach(_ => b.union(_.bounds)); - - // anchor to legend origin - b.x1 = item.padding; - b.y1 = item.padding; - - return b; - } - - function legendGroupLayout(view, item, entry) { - var pad = item.padding, - ex = pad - entry.x, - ey = pad - entry.y; - - if (!item.datum.title) { - if (ex || ey) translate$1(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], - anchor = title.anchor, - tpad = item.titlePadding || 0, - tx = pad - title.x, - ty = pad - title.y; - - switch (title.orient) { - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - case Right: - case Bottom: - break; - default: - ey += title.bounds.height() + tpad; - } - if (ex || ey) translate$1(view, entry, ex, ey); - - switch (title.orient) { - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - if (tx || ty) translate$1(view, title, tx, ty); - - // translate legend if title pushes into negative coordinates - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate$1(view, entry, -tx, 0); - translate$1(view, title, -tx, 0); - } - } - } - - function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - const grad = item.datum.type !== 'symbol', - vgrad = title.datum.vgrad, - e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, - s = e.bounds[y ? 'y2' : 'x2'] - item.padding, - u = vgrad && lr ? s : 0, - v = vgrad && lr ? 0 : s, - o = y <= 0 ? 0 : multiLineOffset(title); - - return Math.round(anchor === Start ? u - : anchor === End ? (v - o) - : 0.5 * (s - o)); - } - - function translate$1(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); - } - - function legendEntryLayout(entries) { - // get max widths for each column - var widths = entries.reduce((w, g) => { - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); - - // set dimensions of legend entry groups - entries.forEach(g => { - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); - } - - function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], - frame = group.frame, - orient = group.orient, - anchor = group.anchor, - offset = group.offset, - padding = group.padding, - title = group.items[0].items[0], - subtitle = group.items[1] && group.items[1].items[0], - end = (orient === Left || orient === Right) ? height : width, - start = 0, x = 0, y = 0, sx = 0, sy = 0, pos; - - if (frame !== Group) { - orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) - : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) - : (start = viewBounds.x1, end = viewBounds.x2); - } else if (orient === Left) { - start = height, end = 0; - } - - pos = (anchor === Start) ? start - : (anchor === End) ? end - : (start + end) / 2; - - if (subtitle && subtitle.text) { - // position subtitle - switch (orient) { - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - case Left: - sx = title.bounds.width() + padding; - break; - case Right: - sx = -title.bounds.width() - padding; - break; - } - - tempBounds$1.clear().union(subtitle.bounds); - tempBounds$1.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - if (set$1(subtitle, 'x', sx) | set$1(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds$1); - subtitle.mark.bounds.clear().union(tempBounds$1); - view.dirty(subtitle); - } - - tempBounds$1.clear().union(subtitle.bounds); - } else { - tempBounds$1.clear(); - } - tempBounds$1.union(title.bounds); - - // position title group - switch (orient) { - case Top: - x = pos; - y = viewBounds.y1 - tempBounds$1.height() - offset; - break; - case Left: - x = viewBounds.x1 - tempBounds$1.width() - offset; - y = pos; - break; - case Right: - x = viewBounds.x2 + tempBounds$1.width() + offset; - y = pos; - break; - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - default: - x = group.x; - y = group.y; - } - - if (set$1(group, 'x', x) | set$1(group, 'y', y)) { - tempBounds$1.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds$1); - mark.bounds.clear().union(tempBounds$1); - view.dirty(group); - } - return group.bounds; - } - - /** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ - function ViewLayout(params) { - Transform.call(this, null, params); - } - - var prototype$V = inherits(ViewLayout, Transform); - - prototype$V.transform = function(_, pulse) { - var view = pulse.dataflow; - _.mark.items.forEach(group => { - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; - }; - - function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; - } - - function layoutGroup(view, group, _) { - var items = group.items, - width = Math.max(0, group.width || 0), - height = Math.max(0, group.height || 0), - viewBounds = new Bounds().set(0, 0, width, height), - xBounds = viewBounds.clone(), - yBounds = viewBounds.clone(), - legends = [], title, - mark, orient, b, i, n; - - // layout axes, gather legends, collect bounds - for (i=0, n=items.length; i { - orient = item.orient || Right; - if (orient !== None$1) (l[orient] || (l[orient] = [])).push(item); - }); - - // perform grid layout for each orient group - for (let orient in l) { - const g = l[orient]; - gridLayout(view, g, legendParams( - g, orient, _.legends, xBounds, yBounds, width, height - )); - } - - // update view bounds - legends.forEach(item => { - const b = item.bounds; - - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - item.bounds = b; - view.dirty(item); - } - - if (_.autosize && _.autosize.type === Fit) { - // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch(item.orient) { - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - } else { - viewBounds.union(b); - } - }); - } - - // combine bounding boxes - viewBounds.union(xBounds).union(yBounds); - - // layout title, adjust bounds - if (title) { - viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - } - - // override aggregated view bounds if content is clipped - if (group.clip) { - viewBounds.set(0, 0, group.width || 0, group.height || 0); - } - - // perform size adjustment - viewSizeLayout(view, group, viewBounds, _); - } - - function viewSizeLayout(view, group, viewBounds, _) { - const auto = _.autosize || {}, - type = auto.type; - - if (view._autosize < 1 || !type) return; - - let viewWidth = view._width, - viewHeight = view._height, - width = Math.max(0, group.width || 0), - left = Math.max(0, Math.ceil(-viewBounds.x1)), - right = Math.max(0, Math.ceil(viewBounds.x2 - width)), - height = Math.max(0, group.height || 0), - top = Math.max(0, Math.ceil(-viewBounds.y1)), - bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - - if (auto.contains === Padding) { - const padding = view.padding(); - viewWidth -= padding.left + padding.right; - viewHeight -= padding.top + padding.bottom; - } - - if (type === None$1) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } - - else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } - - else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } - - else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - - view._resizeView( - viewWidth, viewHeight, - width, height, - [left, top], - auto.resize - ); - } - - var vtx = /*#__PURE__*/Object.freeze({ - __proto__: null, - bound: Bound, - identifier: Identifier, - mark: Mark, - overlap: Overlap, - render: Render, - viewlayout: ViewLayout - }); - - /** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - function AxisTicks(params) { - Transform.call(this, null, params); - } - - var prototype$W = inherits(AxisTicks, Transform); - - prototype$W.transform = function(_, pulse) { - if (this.value && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - ticks = this.value, - scale = _.scale, - tally = _.count == null ? (_.values ? _.values.length : 10) : _.count, - count = tickCount(scale, tally, _.minstep), - format = _.format || tickFormat$1(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), - values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count); - - if (ticks) out.rem = ticks; - - ticks = values.map(function(value, i) { - return ingest({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - }); - }); - - if (_.extra && ticks.length) { - // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push(ingest({ - index: -1, - extra: {value: ticks[0].value}, - label: '' - })); - } - - out.source = ticks; - out.add = ticks; - this.value = ticks; - - return out; - }; - - /** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ - function DataJoin(params) { - Transform.call(this, null, params); - } - - var prototype$X = inherits(DataJoin, Transform); - - function defaultItemCreate() { - return ingest({}); - } - - function newMap(key) { - const map = fastmap().test(t => t.exit); - map.lookup = t => map.get(key(t)); - return map; - } - - prototype$X.transform = function(_, pulse) { - var df = pulse.dataflow, - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - item = _.item || defaultItemCreate, - key = _.key || tupleid, - map = this.value; - - // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - if (isArray(out.encode)) { - out.encode = null; - } - - if (map && (_.modified('key') || pulse.modified(key))) { - error('DataJoin does not support modified key function or fields.'); - } - - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - - pulse.visit(pulse.ADD, t => { - const k = key(t); - let x = map.get(k); - - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else { - out.mod.push(x); - } - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - - x.datum = t; - x.exit = false; - }); - - pulse.visit(pulse.MOD, t => { - const k = key(t), - x = map.get(k); - - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - - pulse.visit(pulse.REM, t => { - const k = key(t), - x = map.get(k); - - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) { - df.runAfter(map.clean); - } - - return out; - }; - - /** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ - function Encode(params) { - Transform.call(this, null, params); - } - - var prototype$Y = inherits(Encode, Transform); - - prototype$Y.transform = function(_, pulse) { - var out = pulse.fork(pulse.ADD_REM), - fmod = _.mod || false, - encoders = _.encoders, - encode = pulse.encode; - - // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - if (isArray(encode)) { - if (out.changed() || encode.every(function(e) { return encoders[e]; })) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else { - return pulse.StopPropagation; - } - } - - // marshall encoder functions - var reenter = encode === 'enter', - update = encoders.update || falsy, - enter = encoders.enter || falsy, - exit = encoders.exit || falsy, - set = (encode && !reenter ? encoders[encode] : update) || falsy; - - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, function(t) { enter(t, _); update(t, _); }); - out.modifies(enter.output); - out.modifies(update.output); - if (set !== falsy && set !== update) { - pulse.visit(pulse.ADD, function(t) { set(t, _); }); - out.modifies(set.output); - } - } - - if (pulse.changed(pulse.REM) && exit !== falsy) { - pulse.visit(pulse.REM, function(t) { exit(t, _); }); - out.modifies(exit.output); - } - - if (reenter || set !== falsy) { - var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - if (reenter) { - pulse.visit(flag, function(t) { - var mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else { - pulse.visit(flag, function(t) { - if (set(t, _) || fmod) out.mod.push(t); - }); - } - if (out.mod.length) out.modifies(set.output); - } - - return out.changed() ? out : pulse.StopPropagation; - }; - - /** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ - function LegendEntries(params) { - Transform.call(this, [], params); - } - - var prototype$Z = inherits(LegendEntries, Transform); - - prototype$Z.transform = function(_, pulse) { - if (this.value != null && !_.modified()) { - return pulse.StopPropagation; - } - - var locale = pulse.dataflow.locale(), - out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - items = this.value, - type = _.type || SymbolLegend, - scale = _.scale, - limit = +_.limit, - count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep), - lskip = !!_.values || type === SymbolLegend, - format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), - values = _.values || labelValues(scale, count), - domain, fraction, size, offset, ellipsis; - - if (items) out.rem = items; - - if (type === SymbolLegend) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else { - items = values; - } - - if (isFunction(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) { - items = items.slice(1); - } - // compute size offset for legend entries - offset = items.reduce(function(max, value) { - return Math.max(max, size(value, _)); - }, 0); - } else { - size = constant(offset = size || 8); - } - - items = items.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - }); - }); - - if (ellipsis) { - ellipsis = values[items.length]; - items.push(ingest({ - index: items.length, - label: `\u2026${values.length-items.length} entries`, - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } - - else if (type === GradientLegend) { - domain = scale.domain(), - fraction = scaleFraction(scale, domain[0], peek(domain)); - - // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - if (values.length < 3 && !_.values && domain[0] !== peek(domain)) { - values = [domain[0], peek(domain)]; - } - - items = values.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - }); - }); - } - - else { - size = values.length - 1; - fraction = labelFraction(scale); - - items = values.map(function(value, index) { - return ingest({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index+1]) - }); - }); - } - - out.source = items; - out.add = items; - this.value = items; - - return out; - }; - - var Paths = fastmap({ - 'line': line$2, - 'line-radial': lineR, - 'arc': arc$2, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR - }); - - function sourceX(t) { return t.source.x; } - function sourceY(t) { return t.source.y; } - function targetX(t) { return t.target.x; } - function targetY(t) { return t.target.y; } - - /** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ - function LinkPath(params) { - Transform.call(this, {}, params); - } - - LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'sourceX', 'type': 'field', 'default': 'source.x' }, - { 'name': 'sourceY', 'type': 'field', 'default': 'source.y' }, - { 'name': 'targetX', 'type': 'field', 'default': 'target.x' }, - { 'name': 'targetY', 'type': 'field', 'default': 'target.y' }, - { 'name': 'orient', 'type': 'enum', 'default': 'vertical', - 'values': ['horizontal', 'vertical', 'radial'] }, - { 'name': 'shape', 'type': 'enum', 'default': 'line', - 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal'] }, - { 'name': 'require', 'type': 'signal' }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] - }; - - var prototype$_ = inherits(LinkPath, Transform); - - prototype$_.transform = function(_, pulse) { - var sx = _.sourceX || sourceX, - sy = _.sourceY || sourceY, - tx = _.targetX || targetX, - ty = _.targetY || targetY, - as = _.as || 'path', - orient = _.orient || 'vertical', - shape = _.shape || 'line', - path = Paths.get(shape + '-' + orient) || Paths.get(shape); - - if (!path) { - error('LinkPath unsupported type: ' + _.shape - + (_.orient ? '-' + _.orient : '')); - } - - pulse.visit(pulse.SOURCE, function(t) { - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - - return pulse.reflow(_.modified()).modifies(as); - }; - - // -- Link Path Generation Methods ----- - - function line$2(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'L' + tx + ',' + ty; - } - - function lineR(sa, sr, ta, tr) { - return line$2( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); - } - - function arc$2(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - rr = Math.sqrt(dx * dx + dy * dy) / 2, - ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + - 'A' + rr + ',' + rr + - ' ' + ra + ' 0 1' + - ' ' + tx + ',' + ty; - } - - function arcR(sa, sr, ta, tr) { - return arc$2( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); - } - - function curve(sx, sy, tx, ty) { - var dx = tx - sx, - dy = ty - sy, - ix = 0.2 * (dx + dy), - iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + - 'C' + (sx+ix) + ',' + (sy+iy) + - ' ' + (tx+iy) + ',' + (ty-ix) + - ' ' + tx + ',' + ty; - } - - function curveR(sa, sr, ta, tr) { - return curve( - sr * Math.cos(sa), sr * Math.sin(sa), - tr * Math.cos(ta), tr * Math.sin(ta) - ); - } - - function orthoX(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'V' + ty + 'H' + tx; - } - - function orthoY(sx, sy, tx, ty) { - return 'M' + sx + ',' + sy + - 'H' + tx + 'V' + ty; - } - - function orthoR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'A' + sr + ',' + sr + ' 0 0,' + (sf?1:0) + - ' ' + (sr*tc) + ',' + (sr*ts) + - 'L' + (tr*tc) + ',' + (tr*ts); - } - - function diagonalX(sx, sy, tx, ty) { - var m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + - 'C' + m + ',' + sy + - ' ' + m + ',' + ty + - ' ' + tx + ',' + ty; - } - - function diagonalY(sx, sy, tx, ty) { - var m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + - 'C' + sx + ',' + m + - ' ' + tx + ',' + m + - ' ' + tx + ',' + ty; - } - - function diagonalR(sa, sr, ta, tr) { - var sc = Math.cos(sa), - ss = Math.sin(sa), - tc = Math.cos(ta), - ts = Math.sin(ta), - mr = (sr + tr) / 2; - return 'M' + (sr*sc) + ',' + (sr*ss) + - 'C' + (mr*sc) + ',' + (mr*ss) + - ' ' + (mr*tc) + ',' + (mr*ts) + - ' ' + (tr*tc) + ',' + (tr*ts); - } - - /** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ - function Pie(params) { - Transform.call(this, null, params); - } - - Pie.Definition = { - 'type': 'Pie', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'startAngle', 'type': 'number', 'default': 0 }, - { 'name': 'endAngle', 'type': 'number', 'default': 6.283185307179586 }, - { 'name': 'sort', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['startAngle', 'endAngle'] } - ] - }; - - var prototype$$ = inherits(Pie, Transform); - - prototype$$.transform = function(_, pulse) { - var as = _.as || ['startAngle', 'endAngle'], - startAngle = as[0], - endAngle = as[1], - field = _.field || one, - start = _.startAngle || 0, - stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, - data = pulse.source, - values = data.map(field), - n = values.length, - a = start, - k = (stop - start) / sum(values), - index = sequence(n), - i, t, v; - - if (_.sort) { - index.sort(function(a, b) { - return values[a] - values[b]; - }); - } - - for (i=0; i -1) return raw; - - var domain = _.domain, - type = scale.type, - zero = _.zero || (_.zero === undefined && includeZero(scale)), - n, mid; - - if (!domain) return 0; - - // adjust continuous domain for minimum pixel padding - if (includePad(type) && _.padding && domain[0] !== peek(domain)) { - domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - } - - // adjust domain based on zero, min, max settings - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = ((domain = domain.slice()).length - 1) || 1; - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - - if (_.domainMid != null) { - mid = _.domainMid; - const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } - - // set the scale domain - scale.domain(domainCheck(type, domain, df)); - - // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - if (type === Ordinal) { - scale.unknown(_.domainImplicit ? implicit : undefined); - } - - // perform 'nice' adjustment as requested - if (_.nice && scale.nice) { - scale.nice((_.nice !== true && tickCount(scale, _.nice)) || null); - } - - // return the cardinality of the domain - return domain.length; - } - - function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else { - return -1; - } - } - - function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs(peek(range) - range[0]), - frac = span / (span - 2 * pad), - d = type === Log ? zoomLog(domain, null, frac) - : type === Sqrt ? zoomPow(domain, null, frac, 0.5) - : type === Pow ? zoomPow(domain, null, frac, exponent || 1) - : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) - : zoomLinear(domain, null, frac); - - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length-1] = d[1]; - return domain; - } - - function domainCheck(type, domain, df) { - if (isLogarithmic(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce(function(s, v) { - return s + (v < 0 ? -1 : v > 0 ? 1 : 0); - }, 0)); - - if (s !== domain.length) { - df.warn('Log scale domain includes zero: ' + $(domain)); - } - } - return domain; - } - - function configureBins(scale, _, count) { - let bins = _.bins; - - if (bins && !isArray(bins)) { - // generate bin boundary array - let domain = scale.domain(), - lo = domain[0], - hi = peek(domain), - start = bins.start == null ? lo : bins.start, - stop = bins.stop == null ? hi : bins.stop, - step = bins.step; - - if (!step) error('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (stop > hi) stop = step * Math.floor(hi / step); - bins = sequence(start, stop + step / 2, step); - } - - if (bins) { - // assign bin boundaries to scale instance - scale.bins = bins; - } else if (scale.bins) { - // no current bins, remove bins if previously set - delete scale.bins; - } - - // special handling for bin-ordinal scales - if (scale.type === BinOrdinal) { - if (!bins) { - // the domain specifies the bins - scale.bins = scale.domain(); - } else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } - - // return domain cardinality - return count; - } - - function configureRange(scale, _, count) { - var type = scale.type, - round = _.round || false, - range = _.range; - - // if range step specified, calculate full range extent - if (_.rangeStep != null) { - range = configureRangeStep(type, _, count); - } - - // else if a range scheme is defined, use that - else if (_.scheme) { - range = configureScheme(type, _, count); - if (isFunction(range)) { - if (scale.interpolator) { - return scale.interpolator(range); - } else { - error(`Scale type ${type} does not support interpolating color schemes.`); - } - } - } - - // given a range array for an interpolating scale, convert to interpolator - if (range && isInterpolating(type)) { - return scale.interpolator( - interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma) - ); - } - - // configure rounding / interpolation - if (range && _.interpolate && scale.interpolate) { - scale.interpolate(interpolate$1(_.interpolate, _.interpolateGamma)); - } else if (isFunction(scale.round)) { - scale.round(round); - } else if (isFunction(scale.rangeRound)) { - scale.interpolate(round ? interpolateRound : interpolate); - } - - if (range) scale.range(flip(range, _.reverse)); - } - - function configureRangeStep(type, _, count) { - if (type !== Band && type !== Point) { - error('Only band and point scales support rangeStep.'); - } - - // calculate full range based on requested step size and padding - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, - inner = type === Point ? 1 - : ((_.paddingInner != null ? _.paddingInner : _.padding) || 0); - return [0, _.rangeStep * bandSpace(count, inner, outer)]; - } - - function configureScheme(type, _, count) { - var extent = _.schemeExtent, - name, scheme$1; - - if (isArray(_.scheme)) { - scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); - } else { - name = _.scheme.toLowerCase(); - scheme$1 = scheme(name); - if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`); - } - - // determine size for potential discrete range - count = (type === Threshold) ? count + 1 - : (type === BinOrdinal) ? count - 1 - : (type === Quantile$1 || type === Quantize) ? (+_.schemeCount || DEFAULT_COUNT) - : count; - - // adjust and/or quantize scheme as appropriate - return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) - : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) - : type === Ordinal ? scheme$1 : scheme$1.slice(0, count); - } - - function adjustScheme(scheme, extent, reverse) { - return (isFunction(scheme) && (extent || reverse)) - ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) - : scheme; - } - - function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; - } - - /** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ - function SortItems(params) { - Transform.call(this, null, params); - } - - var prototype$11 = inherits(SortItems, Transform); - - prototype$11.transform = function(_, pulse) { - var mod = _.modified('sort') - || pulse.changed(pulse.ADD) - || pulse.modified(_.sort.fields) - || pulse.modified('datum'); - - if (mod) pulse.source.sort(stableCompare(_.sort)); - - this.modified(mod); - return pulse; - }; - - var Zero = 'zero', - Center = 'center', - Normalize = 'normalize', - DefOutput = ['y0', 'y1']; - - /** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ - function Stack(params) { - Transform.call(this, null, params); - } - - Stack.Definition = { - 'type': 'Stack', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'sort', 'type': 'compare' }, - { 'name': 'offset', 'type': 'enum', 'default': Zero, 'values': [Zero, Center, Normalize] }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': DefOutput } - ] - }; - - var prototype$12 = inherits(Stack, Transform); - - prototype$12.transform = function(_, pulse) { - var as = _.as || DefOutput, - y0 = as[0], - y1 = as[1], - sort = stableCompare(_.sort), - field = _.field || one, - stack = _.offset === Center ? stackCenter - : _.offset === Normalize ? stackNormalize - : stackZero, - groups, i, n, max; - - // partition, sum, and sort the stack groups - groups = partition$2(pulse.source, _.groupby, sort, field); - - // compute stack layouts per group - for (i=0, n=groups.length, max=groups.max; i max) max = s; - if (sort) g.sort(sort); - } - groups.max = max; - - return groups; - } - - var encode = /*#__PURE__*/Object.freeze({ - __proto__: null, - axisticks: AxisTicks, - datajoin: DataJoin, - encode: Encode, - legendentries: LegendEntries, - linkpath: LinkPath, - pie: Pie, - scale: Scale, - sortitems: SortItems, - stack: Stack - }); - - function noop$3() {} - - const cases = [ - [], - [[[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]]], - [] - ]; - - // Implementation adapted from d3/d3-contour. Thanks! - function contours() { - var dx = 1, - dy = 1, - smooth = smoothLinear; - - function contours(values, tz) { - return tz.map(value => 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.js - function contour(values, value) { - var polygons = [], - holes = []; - - isorings(values, value, function(ring) { - smooth(ring, values, value); - if (area$2(ring) > 0) polygons.push([ring]); - else holes.push(ring); - }); - - holes.forEach(function(hole) { - for (var i = 0, n = polygons.length, polygon; i < n; ++i) { - if (contains((polygon = polygons[i])[0], hole) !== -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/stitch.js - function isorings(values, value, callback) { - var fragmentByStart = new Array, - fragmentByEnd = new Array, - x, y, t0, t1, t2, t3; - - // Special case for the first row (y = -1, t2 = t3 = 0). - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - - // General case for the intermediate rows. - while (++y < dy - 1) { - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - - // Special case for the last row (y = dy - 1, t0 = t1 = 0). - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - - function stitch(line) { - var start = [line[0][0] + x, line[0][1] + y], - end = [line[1][0] + x, line[1][1] + y], - startIndex = index(start), - endIndex = index(end), - f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[f.start] = fragmentByEnd[g.end] = {start: f.start, end: g.end, ring: f.ring.concat(g.ring)}; - } - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[g.start] = fragmentByEnd[f.end] = {start: g.start, end: f.end, ring: g.ring.concat(f.ring)}; - } - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else { - fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {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 = point[0], - y = point[1], - xt = x | 0, - yt = y | 0, - v0, - v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); - } - - contours.contour = contour; - - contours.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, contours; - }; - - contours.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop$3, contours) : smooth === smoothLinear; - }; - - return contours; - } - - function area$2(ring) { - var i = 0, - n = ring.length, - area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area; - } - - function contains(ring, hole) { - var i = -1, n = hole.length, c; - while (++i < n) if (c = ringContains(ring, hole[i])) return c; - return 0; - } - - function ringContains(ring, point) { - var x = point[0], y = point[1], contains = -1; - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) contains = -contains; - } - return contains; - } - - function segmentContains(a, b, c) { - var i; return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); - } - - function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); - } - - function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; - } - - function quantize$2(k, nice, zero) { - return function(values) { - var ex = extent(values), - start = zero ? Math.min(ex[0], 0) : ex[0], - stop = ex[1], - span = stop - start, - step = nice ? tickStep(start, stop, k) : (span / (k + 1)); - return sequence(step, stop, step); - }; - } - - /** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ - function Isocontour(params) { - Transform.call(this, null, params); - } - - Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'levels', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'zero', 'type': 'boolean', 'default': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true }, - { 'name': 'scale', 'type': 'number', 'expr': true }, - { 'name': 'translate', 'type': 'number', 'array': true, 'expr': true }, - { 'name': 'as', 'type': 'string', 'null': true, 'default': 'contour' } - ] - }; - - var prototype$13 = inherits(Isocontour, Transform); - - prototype$13.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - field = _.field || identity, - contour = contours().smooth(_.smooth !== false), - tz = _.thresholds || levels(source, field, _), - as = _.as === null ? null : _.as || 'contour', - values = []; - - source.forEach(t => { - const grid = field(t); - - // generate contour paths in GeoJSON format - const paths = contour.size([grid.width, grid.height])( - grid.values, isArray(tz) ? tz : tz(grid.values) - ); - - // adjust contour path coordinates as needed - transformPaths(paths, grid, t, _); - - // ingest; copy source data properties to output - paths.forEach(p => { - values.push(rederive(t, ingest(as != null ? {[as]: p} : p))); - }); - }); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; - }; - - function levels(values, f, _) { - const q = quantize$2(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' - ? q - : q(values.map(t => max(f(t).values))); - } - - function transformPaths(paths, grid, datum, _) { - let s = _.scale || grid.scale, - t = _.translate || grid.translate; - if (isFunction(s)) s = s(datum, _); - if (isFunction(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - - const sx = (isNumber(s) ? s : s[0]) || 1, - sy = (isNumber(s) ? s : s[1]) || 1, - tx = t && t[0] || 0, - ty = t && t[1] || 0; - - paths.forEach(transform$2(grid, sx, sy, tx, ty)); - } - - function transform$2(grid, sx, sy, tx, ty) { - const x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - flip = sx * sy < 0; - - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); - } - - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - coordinates.forEach(transformPoint); - } - - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; - } - - return function(geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; - }; - } - - function radius(bw, data, f) { - const v = bw >= 0 ? bw : bandwidthNRD(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); - } - - function number$4(_) { - return isFunction(_) ? _ : constant(+_); - } - - // Implementation adapted from d3/d3-contour. Thanks! - function density2D() { - var x = d => d[0], - y = d => d[1], - weight = one, - bandwidth = [-1, -1], - dx = 960, - dy = 500, - k = 2; // log2(cellSize) - - function density(data, counts) { - const rx = radius(bandwidth[0], data, x) >> k, // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, // blur y-radius - ox = rx ? rx + 2 : 0, // x-offset padding for blur - oy = ry ? ry + 2 : 0, // y-offset padding for blur - n = 2 * ox + (dx >> k), // grid width - m = 2 * oy + (dy >> k), // grid height - values0 = new Float32Array(n * m), - values1 = new Float32Array(n * m); - - let values = values0; - - data.forEach(d => { - const xi = ox + (+x(d) >> k), - yi = oy + (+y(d) >> k); - - if (xi >= 0 && xi < n && yi >= 0 && yi < m) { - values0[xi + yi * n] += +weight(d); - } - }); - - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } - - // scale density estimates - // density in points per square pixel or probability density - let s = counts ? Math.pow(2, -2 * k) : 1 / sum(values); - for (let i=0, sz=n*m; i> k), - y2: oy + (dy >> k) - }; - } - - density.x = function(_) { - return arguments.length ? (x = number$4(_), density) : x; - }; - - density.y = function(_) { - return arguments.length ? (y = number$4(_), density) : y; - }; - - density.weight = function(_) { - return arguments.length ? (weight = number$4(_), density) : weight; - }; - - density.size = function(_) { - if (!arguments.length) return [dx, dy]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) error('invalid size'); - return dx = _0, dy = _1, density; - }; - - density.cellSize = function(_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) error('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - - density.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - _ = array(_); - if (_.length === 1) _ = [+_[0], +_[0]]; - if (_.length !== 2) error('invalid bandwidth'); - return bandwidth = _, density; - }; - - return density; - } - - function blurX(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let j = 0; j < m; ++j) { - for (let i = 0, sr = 0; i < n + r; ++i) { - if (i < n) { - sr += source[i + j * n]; - } - if (i >= r) { - if (i >= w) { - sr -= source[i - w + j * n]; - } - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } - } - } - - function blurY(n, m, source, target, r) { - const w = (r << 1) + 1; - for (let i = 0; i < n; ++i) { - for (let j = 0, sr = 0; j < m + r; ++j) { - if (j < m) { - sr += source[i + j * n]; - } - if (j >= r) { - if (j >= w) { - sr -= source[i + (j - w) * n]; - } - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } - } - } - - /** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ - function KDE2D(params) { - Transform.call(this, null, params); - } - - KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'counts', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'default': 'grid'} - ] - }; - - var prototype$14 = inherits(KDE2D, Transform); - - const PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth']; - - function params(obj, _) { - PARAMS.forEach(param => _[param] != null ? obj[param](_[param]) : 0); - return obj; - } - - prototype$14.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) - return pulse.StopPropagation; - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - source = pulse.materialize(pulse.SOURCE).source, - groups = partition$3(source, _.groupby), - names = (_.groupby || []).map(accessorName), - kde = params(density2D(), _), - as = _.as || 'grid', - values = []; - - function set(t, vals) { - for (let i=0; i ingest( - set({[as]: kde(g, _.counts)}, g.dims) - )); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - - return out; - }; - - function partition$3(data, groupby) { - var groups = [], - get = f => f(t), - map, i, n, t, k, g; - - // partition data points into groups - if (groupby == null) { - groups.push(data); - } else { - for (map={}, i=0, n=data.length; i} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ - function Contour(params) { - Transform.call(this, null, params); - } - - Contour.Definition = { - 'type': 'Contour', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2, 'required': true }, - { 'name': 'values', 'type': 'number', 'array': true }, - { 'name': 'x', 'type': 'field' }, - { 'name': 'y', 'type': 'field' }, - { 'name': 'weight', 'type': 'field' }, - { 'name': 'cellSize', 'type': 'number' }, - { 'name': 'bandwidth', 'type': 'number' }, - { 'name': 'count', 'type': 'number' }, - { 'name': 'nice', 'type': 'boolean', 'default': false }, - { 'name': 'thresholds', 'type': 'number', 'array': true }, - { 'name': 'smooth', 'type': 'boolean', 'default': true } - ] - }; - - var prototype$15 = inherits(Contour, Transform); - - prototype$15.transform = function(_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), - contour = contours().smooth(_.smooth !== false), - values = _.values, - thresh = _.thresholds || quantize$2(_.count || 10, _.nice, !!values), - size = _.size, grid, post; - - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform$2(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [grid.width, grid.height]; - values = grid.values; - } - - thresh = isArray(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map(ingest); - - return out; - }; - - var Feature = 'Feature'; - var FeatureCollection = 'FeatureCollection'; - var MultiPoint = 'MultiPoint'; - - /** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ - function GeoJSON(params) { - Transform.call(this, null, params); - } - - GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'length': 2 }, - { 'name': 'geojson', 'type': 'field' } - ] - }; - - var prototype$16 = inherits(GeoJSON, Transform); - - prototype$16.transform = function(_, pulse) { - var features = this._features, - points = this._points, - fields = _.fields, - lon = fields && fields[0], - lat = fields && fields[1], - geojson = _.geojson || (!fields && identity), - flag = pulse.ADD, - mod; - - mod = _.modified() - || pulse.changed(pulse.REM) - || pulse.modified(accessorFields(geojson)) - || (lon && (pulse.modified(accessorFields(lon)))) - || (lat && (pulse.modified(accessorFields(lat)))); - - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = (features = []); - this._points = (points = []); - } - - if (geojson) { - pulse.visit(flag, function(t) { - features.push(geojson(t)); - }); - } - - if (lon && lat) { - pulse.visit(flag, function(t) { - var x = lon(t), - y = lat(t); - if (x != null && y != null && (x = +x) === x && (y = +y) === y) { - points.push([x, y]); - } - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - - this.value = { - type: FeatureCollection, - features: features - }; - }; - - // 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–363 (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 = { - constructor: Adder, - reset: function() { - this.s = // rounded value - this.t = 0; // exact error - }, - add: function(y) { - add$3(temp$1, y, this.t); - add$3(this, temp$1.s, this.s); - if (this.s) this.t += temp$1.t; - else this.s = temp$1.t; - }, - valueOf: function() { - return this.s; - } - }; - - var temp$1 = new Adder; - - function add$3(adder, a, b) { - var x = adder.s = a + b, - bv = x - a, - av = x - bv; - adder.t = (a - av) + (b - bv); - } - - var epsilon$3 = 1e-6; - var epsilon2$1 = 1e-12; - var pi$2 = Math.PI; - var halfPi$1 = pi$2 / 2; - var quarterPi = pi$2 / 4; - var tau$2 = pi$2 * 2; - - var degrees$1 = 180 / pi$2; - var radians = pi$2 / 180; - - var abs$1 = Math.abs; - var atan = Math.atan; - var atan2$1 = Math.atan2; - var cos$1 = Math.cos; - var ceil = Math.ceil; - var exp$1 = Math.exp; - var log$3 = Math.log; - var pow$2 = Math.pow; - var sin$1 = Math.sin; - var sign$1 = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; - var sqrt$2 = Math.sqrt; - var tan = Math.tan; - - function acos$1(x) { - return x > 1 ? 0 : x < -1 ? pi$2 : Math.acos(x); - } - - function asin$1(x) { - return x > 1 ? halfPi$1 : x < -1 ? -halfPi$1 : Math.asin(x); - } - - function noop$4() {} - - function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { - streamGeometryType[geometry.type](geometry, stream); - } - } - - var streamObjectType = { - Feature: function(object, stream) { - streamGeometry(object.geometry, stream); - }, - FeatureCollection: function(object, stream) { - var features = object.features, i = -1, n = features.length; - while (++i < n) streamGeometry(features[i].geometry, stream); - } - }; - - var streamGeometryType = { - Sphere: function(object, stream) { - stream.sphere(); - }, - Point: function(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); - }, - MultiPoint: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]); - }, - LineString: function(object, stream) { - streamLine(object.coordinates, stream, 0); - }, - MultiLineString: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamLine(coordinates[i], stream, 0); - }, - Polygon: function(object, stream) { - streamPolygon(object.coordinates, stream); - }, - MultiPolygon: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamPolygon(coordinates[i], stream); - }, - GeometryCollection: function(object, stream) { - var geometries = object.geometries, i = -1, n = geometries.length; - while (++i < n) streamGeometry(geometries[i], stream); - } - }; - - function streamLine(coordinates, stream, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - stream.lineStart(); - while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - stream.lineEnd(); - } - - function streamPolygon(coordinates, stream) { - var i = -1, n = 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 = adder(); - - var areaSum = adder(), - lambda00, - phi00, - lambda0, - cosPhi0, - sinPhi0; - - var areaStream = { - point: noop$4, - lineStart: noop$4, - lineEnd: noop$4, - polygonStart: function() { - areaRingSum.reset(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? tau$2 + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = noop$4; - }, - sphere: function() { - areaSum.add(tau$2); - } - }; - - function areaRingStart() { - areaStream.point = areaPointFirst; - } - - function areaRingEnd() { - areaPoint(lambda00, phi00); - } - - function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= radians, phi *= radians; - lambda0 = lambda, cosPhi0 = cos$1(phi = phi / 2 + quarterPi), sinPhi0 = sin$1(phi); - } - - function areaPoint(lambda, phi) { - lambda *= radians, phi *= radians; - phi = 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’s - // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). - var dLambda = lambda - lambda0, - sdLambda = dLambda >= 0 ? 1 : -1, - adLambda = sdLambda * dLambda, - cosPhi = cos$1(phi), - sinPhi = sin$1(phi), - k = sinPhi0 * sinPhi, - u = cosPhi0 * cosPhi + k * cos$1(adLambda), - v = k * sdLambda * sin$1(adLambda); - areaRingSum.add(atan2$1(v, u)); - - // Advance the previous points. - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; - } - - function area$3(object) { - areaSum.reset(); - geoStream(object, areaStream); - return areaSum * 2; - } - - function spherical(cartesian) { - return [atan2$1(cartesian[1], cartesian[0]), asin$1(cartesian[2])]; - } - - function cartesian(spherical) { - var lambda = spherical[0], phi = spherical[1], cosPhi = 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] += b[0], a[1] += b[1], a[2] += b[2]; - } - - function cartesianScale(vector, k) { - return [vector[0] * k, vector[1] * k, vector[2] * k]; - } - - // TODO return d - function cartesianNormalizeInPlace(d) { - var l = sqrt$2(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; - } - - var lambda0$1, phi0, lambda1, phi1, // bounds - lambda2, // previous lambda-coordinate - lambda00$1, phi00$1, // first point - p0, // previous 3D point - deltaSum = adder(), - ranges, - range; - - var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum.reset(); - areaStream.polygonStart(); - }, - polygonEnd: function() { - areaStream.polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > epsilon$3) phi1 = 90; - else if (deltaSum < -epsilon$3) phi0 = -90; - range[0] = lambda0$1, range[1] = lambda1; - }, - sphere: function() { - lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); - } - }; - - function boundsPoint(lambda, phi) { - ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - - function linePoint(lambda, phi) { - var p = cartesian([lambda * radians, phi * radians]); - if (p0) { - var normal = cartesianCross(p0, p), - equatorial = [normal[1], -normal[0], 0], - inflection = cartesianCross(equatorial, normal); - cartesianNormalizeInPlace(inflection); - inflection = spherical(inflection); - var delta = lambda - lambda2, - sign = delta > 0 ? 1 : -1, - lambdai = inflection[0] * degrees$1 * sign, - phii, - antimeridian = abs$1(delta) > 180; - if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = inflection[1] * degrees$1; - if (phii > phi1) phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = -inflection[1] * degrees$1; - if (phii < phi0) phi0 = phii; - } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - if (antimeridian) { - if (lambda < lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; - } - } else { - if (lambda1 >= lambda0$1) { - if (lambda < lambda0$1) lambda0$1 = lambda; - if (lambda > lambda1) lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; - } - } - } - } else { - ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); - } - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - p0 = p, lambda2 = lambda; - } - - function boundsLineStart() { - boundsStream.point = linePoint; - } - - function boundsLineEnd() { - range[0] = lambda0$1, range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; - } - - function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add(abs$1(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else { - lambda00$1 = lambda, phi00$1 = phi; - } - areaStream.point(lambda, phi); - linePoint(lambda, phi); - } - - function boundsRingStart() { - areaStream.lineStart(); - } - - function boundsRingEnd() { - boundsRingPoint(lambda00$1, phi00$1); - areaStream.lineEnd(); - if (abs$1(deltaSum) > epsilon$3) lambda0$1 = -(lambda1 = 180); - range[0] = lambda0$1, range[1] = lambda1; - p0 = null; - } - - // Finds the left-right distance between two longitudes. - // This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want - // the distance between ±180° to be 360°. - function angle(lambda0, lambda1) { - return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; - } - - function rangeCompare(a, b) { - return a[0] - b[0]; - } - - function rangeContains(range, x) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; - } - - function bounds$1(feature) { - var i, n, a, b, merged, deltaMax, delta; - - phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity); - ranges = []; - geoStream(feature, boundsStream); - - // First, sort ranges by their minimum longitudes. - if (n = ranges.length) { - ranges.sort(rangeCompare); - - // Then, merge any ranges that overlap. - for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) { - b = ranges[i]; - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - 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. - for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) { - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1]; - } - } - - ranges = range = null; - - return lambda0$1 === Infinity || phi0 === 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 = { - sphere: noop$4, - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } - }; - - // Arithmetic mean of Cartesian vectors. - function centroidPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos$1(phi); - centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi)); - } - - function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; - } - - function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; - } - - function centroidLinePointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos$1(phi); - x0 = cosPhi * cos$1(lambda); - y0 = cosPhi * sin$1(lambda); - z0 = sin$1(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); - } - - function centroidLinePoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos$1(phi), - x = cosPhi * cos$1(lambda), - y = cosPhi * sin$1(lambda), - z = sin$1(phi), - w = atan2$1(sqrt$2((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); - } - - function centroidLineEnd() { - centroidStream.point = centroidPoint; - } - - // See J. E. Brock, The Inertia Tensor for a Spherical Triangle, - // J. Applied Mechanics 42, 239 (1975). - function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; - } - - function centroidRingEnd() { - centroidRingPoint(lambda00$2, phi00$2); - centroidStream.point = centroidPoint; - } - - function centroidRingPointFirst(lambda, phi) { - lambda00$2 = lambda, phi00$2 = phi; - lambda *= radians, phi *= radians; - centroidStream.point = centroidRingPoint; - var cosPhi = cos$1(phi); - x0 = cosPhi * cos$1(lambda); - y0 = cosPhi * sin$1(lambda); - z0 = sin$1(phi); - centroidPointCartesian(x0, y0, z0); - } - - function centroidRingPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos$1(phi), - x = cosPhi * cos$1(lambda), - y = cosPhi * sin$1(lambda), - z = sin$1(phi), - cx = y0 * z - z0 * y, - cy = z0 * x - x0 * z, - cz = x0 * y - y0 * x, - m = sqrt$2(cx * cx + cy * cy + cz * cz), - w = asin$1(m), // line weight = angle - v = m && -w / m; // area weight multiplier - X2 += v * cx; - Y2 += v * cy; - Z2 += v * cz; - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); - } - - function centroid(object) { - W0 = W1 = - X0 = Y0 = Z0 = - X1 = Y1 = Z1 = - X2 = Y2 = Z2 = 0; - geoStream(object, centroidStream); - - var x = X2, - y = Y2, - z = Z2, - m = x * x + y * y + z * z; - - // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. - if (m < epsilon2$1) { - x = X1, y = Y1, z = Z1; - // If the feature has zero length, fall back to arithmetic mean of point vectors. - if (W1 < epsilon$3) x = X0, y = Y0, z = Z0; - m = 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$1(y, x) * degrees$1, asin$1(z / sqrt$2(m)) * degrees$1]; - } - - function compose(a, b) { - - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - - return compose; - } - - function rotationIdentity(lambda, phi) { - return [abs$1(lambda) > pi$2 ? lambda + Math.round(-lambda / tau$2) * tau$2 : lambda, phi]; - } - - rotationIdentity.invert = rotationIdentity; - - function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= tau$2) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) - : rotationLambda(deltaLambda)) - : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) - : rotationIdentity); - } - - function forwardRotationLambda(deltaLambda) { - return function(lambda, phi) { - return lambda += deltaLambda, [lambda > pi$2 ? lambda - tau$2 : lambda < -pi$2 ? lambda + tau$2 : lambda, phi]; - }; - } - - function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; - } - - function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = cos$1(deltaPhi), - sinDeltaPhi = sin$1(deltaPhi), - cosDeltaGamma = cos$1(deltaGamma), - sinDeltaGamma = sin$1(deltaGamma); - - function rotation(lambda, phi) { - var cosPhi = cos$1(phi), - x = cos$1(lambda) * cosPhi, - y = sin$1(lambda) * cosPhi, - z = sin$1(phi), - k = z * cosDeltaPhi + x * sinDeltaPhi; - return [ - atan2$1(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), - asin$1(k * cosDeltaGamma + y * sinDeltaGamma) - ]; - } - - rotation.invert = function(lambda, phi) { - var cosPhi = cos$1(phi), - x = cos$1(lambda) * cosPhi, - y = sin$1(lambda) * cosPhi, - z = sin$1(phi), - k = z * cosDeltaGamma - y * sinDeltaGamma; - return [ - atan2$1(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), - asin$1(k * cosDeltaPhi - x * sinDeltaPhi) - ]; - }; - - return rotation; - } - - function rotation(rotate) { - rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0); - - function forward(coordinates) { - coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates; - } - - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates; - }; - - return forward; - } - - // Generates a circle centered at [0°, 0°], with a given radius and precision. - function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = cos$1(radius), - sinRadius = sin$1(radius), - step = direction * delta; - if (t0 == null) { - t0 = radius + direction * tau$2; - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau$2; - } - for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) { - point = 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 = cartesian(point), point[0] -= cosRadius; - cartesianNormalizeInPlace(point); - var radius = acos$1(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + tau$2 - epsilon$3) % tau$2; - } - - function clipBuffer() { - var lines = [], - line; - return { - point: function(x, y, m) { - line.push([x, y, m]); - }, - lineStart: function() { - lines.push(line = []); - }, - lineEnd: noop$4, - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function() { - var result = lines; - lines = []; - line = null; - return result; - } - }; - } - - function pointEqual(a, b) { - return abs$1(a[0] - b[0]) < epsilon$3 && abs$1(a[1] - b[1]) < epsilon$3; - } - - function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - this.e = entry; // is an entry? - this.v = false; // visited - this.n = this.p = 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 = [], - clip = [], - i, - n; - - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n], x; - - if (pointEqual(p0, p1)) { - if (!p0[2] && !p1[2]) { - stream.lineStart(); - for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]); - stream.lineEnd(); - return; - } - // handle degenerate cases by moving the point - p1[0] += 2 * epsilon$3; - } - - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - - if (!subject.length) return; - - clip.sort(compareIntersection); - link(subject); - link(clip); - - for (i = 0, n = clip.length; i < n; ++i) { - clip[i].e = startInside = !startInside; - } - - var start = subject[0], - points, - point; - - while (1) { - // Find first unvisited intersection. - var current = start, - isSubject = true; - while (current.v) if ((current = current.n) === start) return; - points = current.z; - stream.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) { - for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.n.x, 1, stream); - } - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.p.x, -1, stream); - } - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - } while (!current.v); - stream.lineEnd(); - } - } - - function link(array) { - if (!(n = array.length)) return; - var n, - i = 0, - a = array[0], - b; - while (++i < n) { - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; - } - - var sum$1 = adder(); - - function longitude(point) { - if (abs$1(point[0]) <= pi$2) - return point[0]; - else - return sign$1(point[0]) * ((abs$1(point[0]) + pi$2) % tau$2 - pi$2); - } - - function polygonContains(polygon, point) { - var lambda = longitude(point), - phi = point[1], - sinPhi = sin$1(phi), - normal = [sin$1(lambda), -cos$1(lambda), 0], - angle = 0, - winding = 0; - - sum$1.reset(); - - if (sinPhi === 1) phi = halfPi$1 + epsilon$3; - else if (sinPhi === -1) phi = -halfPi$1 - epsilon$3; - - for (var i = 0, n = polygon.length; i < n; ++i) { - if (!(m = (ring = polygon[i]).length)) continue; - var ring, - m, - point0 = ring[m - 1], - lambda0 = longitude(point0), - phi0 = point0[1] / 2 + quarterPi, - sinPhi0 = sin$1(phi0), - cosPhi0 = cos$1(phi0); - - for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) { - var point1 = ring[j], - lambda1 = longitude(point1), - phi1 = point1[1] / 2 + quarterPi, - sinPhi1 = sin$1(phi1), - cosPhi1 = cos$1(phi1), - delta = lambda1 - lambda0, - sign = delta >= 0 ? 1 : -1, - absDelta = sign * delta, - antimeridian = absDelta > pi$2, - k = sinPhi0 * sinPhi1; - - sum$1.add(atan2$1(k * sign * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta))); - angle += antimeridian ? delta + sign * tau$2 : delta; - - // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = cartesianCross(cartesian(point0), cartesian(point1)); - cartesianNormalizeInPlace(arc); - var intersection = cartesianCross(normal, arc); - cartesianNormalizeInPlace(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin$1(intersection[2]); - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) { - winding += antimeridian ^ delta >= 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 negative - // (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$3 || angle < epsilon$3 && sum$1 < -epsilon$3) ^ (winding & 1); - } - - function ascending$2(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; - } - - function bisector$1(compare) { - if (compare.length === 1) compare = ascendingComparator$1(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) 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 (lo == null) lo = 0; - if (hi == null) 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; - } - }; - } - - function ascendingComparator$1(f) { - return function(d, x) { - return ascending$2(f(d), x); - }; - } - - var ascendingBisect$1 = bisector$1(ascending$2); - - function range$1(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; - } - - function merge$1(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; - } - - function clip$2(pointVisible, clipLine, interpolate, start) { - return function(sink) { - var line = clipLine(sink), - ringBuffer = clipBuffer(), - ringSink = clipLine(ringBuffer), - polygonStarted = false, - polygon, - segments, - ring; - - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = merge$1(segments); - var startInside = polygonContains(polygon, start); - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - clipRejoin(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = 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 = pointLine; - line.lineStart(); - } - - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - - function pointRing(lambda, phi) { - ring.push([lambda, phi]); - ringSink.point(lambda, phi); - } - - function ringStart() { - ringSink.lineStart(); - ring = []; - } - - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - - var clean = ringSink.clean(), - ringSegments = ringBuffer.result(), - i, n = ringSegments.length, m, - segment, - point; - - ring.pop(); - polygon.push(ring); - ring = null; - - if (!n) return; - - // No intersections. - if (clean & 1) { - segment = ringSegments[0]; - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]); - sink.lineEnd(); - } - return; - } - - // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.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 cutting - // and circle clipping, the same comparison is used. - function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - halfPi$1 - epsilon$3 : halfPi$1 - a[1]) - - ((b = b.x)[0] < 0 ? b[1] - halfPi$1 - epsilon$3 : halfPi$1 - b[1]); - } - - var clipAntimeridian = clip$2( - function() { return true; }, - clipAntimeridianLine, - clipAntimeridianInterpolate, - [-pi$2, -halfPi$1] - ); - - // Takes a line and cuts into visible segments. Return values: 0 - there were - // 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 = NaN, - phi0 = NaN, - sign0 = NaN, - clean; // no intersections - - return { - lineStart: function() { - stream.lineStart(); - clean = 1; - }, - point: function(lambda1, phi1) { - var sign1 = lambda1 > 0 ? pi$2 : -pi$2, - delta = abs$1(lambda1 - lambda0); - if (abs$1(delta - pi$2) < epsilon$3) { // line crosses a pole - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$1 : -halfPi$1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - clean = 0; - } else if (sign0 !== sign1 && delta >= pi$2) { // line crosses antimeridian - if (abs$1(lambda0 - sign0) < epsilon$3) lambda0 -= sign0 * epsilon$3; // handle degeneracies - if (abs$1(lambda1 - sign1) < epsilon$3) lambda1 -= sign1 * epsilon$3; - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - clean = 0; - } - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function() { - return 2 - clean; // if intersections, rejoin first and last segments - } - }; - } - - function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, - cosPhi1, - sinLambda0Lambda1 = sin$1(lambda0 - lambda1); - return abs$1(sinLambda0Lambda1) > epsilon$3 - ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1) - - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0)) - / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) - : (phi0 + phi1) / 2; - } - - function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - if (from == null) { - phi = direction * halfPi$1; - stream.point(-pi$2, phi); - stream.point(0, phi); - stream.point(pi$2, phi); - stream.point(pi$2, 0); - stream.point(pi$2, -phi); - stream.point(0, -phi); - stream.point(-pi$2, -phi); - stream.point(-pi$2, 0); - stream.point(-pi$2, phi); - } else if (abs$1(from[0] - to[0]) > epsilon$3) { - var lambda = from[0] < to[0] ? pi$2 : -pi$2; - phi = 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 = cos$1(radius), - delta = 6 * radians, - smallRadius = cr > 0, - notHemisphere = abs$1(cr) > epsilon$3; // TODO optimise for this common 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 polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // 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 = v0 = false; - clean = 1; - }, - point: function(lambda, phi) { - var point1 = [lambda, phi], - point2, - v = visible(lambda, phi), - c = smallRadius - ? v ? 0 : code(lambda, phi) - : v ? code(lambda + (lambda < 0 ? pi$2 : -pi$2), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) - point1[2] = 1; - } - if (v !== v0) { - clean = 0; - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - point0 = 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 = intersect(point1, point0, true))) { - clean = 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], 3); - } - } - } - if (v && (!point0 || !pointEqual(point0, point1))) { - stream.point(point1[0], point1[1]); - } - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) stream.lineEnd(); - point0 = 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 = cartesian(a), - pb = cartesian(b); - - // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - var n1 = [1, 0, 0], // normal - n2 = cartesianCross(pa, pb), - n2n2 = cartesianDot(n2, n2), - n1n2 = n2[0], // cartesianDot(n1, n2), - determinant = n2n2 - n1n2 * n1n2; - - // Two polar points. - if (!determinant) return !two && a; - - var c1 = cr * n2n2 / determinant, - c2 = -cr * n1n2 / determinant, - n1xn2 = cartesianCross(n1, n2), - A = cartesianScale(n1, c1), - B = cartesianScale(n2, c2); - cartesianAddInPlace(A, B); - - // Solve |p(t)|^2 = 1. - var u = n1xn2, - w = cartesianDot(A, u), - uu = cartesianDot(u, u), - t2 = w * w - uu * (cartesianDot(A, A) - 1); - - if (t2 < 0) return; - - var t = sqrt$2(t2), - q = cartesianScale(u, (-w - t) / uu); - cartesianAddInPlace(q, A); - q = spherical(q); - - if (!two) return q; - - // Two intersection points. - var lambda0 = a[0], - lambda1 = b[0], - phi0 = a[1], - phi1 = b[1], - z; - - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - - var delta = lambda1 - lambda0, - polar = abs$1(delta - pi$2) < epsilon$3, - meridian = polar || delta < epsilon$3; - - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; - - // Check that the first point is between a and b. - if (meridian - ? polar - ? phi0 + phi1 > 0 ^ q[1] < (abs$1(q[0] - lambda0) < epsilon$3 ? phi0 : phi1) - : phi0 <= q[1] && q[1] <= phi1 - : delta > pi$2 ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = 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 = smallRadius ? radius : pi$2 - radius, - code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - return code; - } - - return clip$2(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$2, radius - pi$2]); - } - - function clipLine(a, b, x0, y0, x1, y1) { - var ax = a[0], - ay = a[1], - bx = b[0], - by = b[1], - t0 = 0, - t1 = 1, - dx = bx - ax, - dy = by - ay, - r; - - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; - } - - var clipMax = 1e9, clipMin = -clipMax; - - // TODO Use d3-polygon’s 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 <= x && x <= x1 && y0 <= y && y <= y1; - } - - function interpolate(from, to, direction, stream) { - var a = 0, a1 = 0; - if (from == null - || (a = corner(from, direction)) !== (a1 = corner(to, direction)) - || comparePoint(from, to) < 0 ^ direction > 0) { - do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - while ((a = (a + direction + 4) % 4) !== a1); - } else { - stream.point(to[0], to[1]); - } - } - - function corner(p, direction) { - return abs$1(p[0] - x0) < epsilon$3 ? direction > 0 ? 0 : 3 - : abs$1(p[0] - x1) < epsilon$3 ? direction > 0 ? 2 : 1 - : abs$1(p[1] - y0) < epsilon$3 ? 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 = corner(a, 1), - cb = corner(b, 1); - return ca !== cb ? ca - cb - : ca === 0 ? b[1] - a[1] - : ca === 1 ? a[0] - b[0] - : ca === 2 ? a[1] - b[1] - : b[0] - a[0]; - } - - return function(stream) { - var activeStream = stream, - bufferStream = clipBuffer(), - segments, - polygon, - ring, - x__, y__, v__, // first point - x_, y_, v_, // previous point - first, - clean; - - var clipStream = { - 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 = 0; - - for (var i = 0, n = polygon.length; i < n; ++i) { - for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) { - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; } - else { if (b1 <= 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 = bufferStream, segments = [], polygon = [], clean = true; - } - - function polygonEnd() { - var startInside = polygonInside(), - cleanInside = clean && startInside, - visible = (segments = merge$1(segments)).length; - if (cleanInside || visible) { - stream.polygonStart(); - if (cleanInside) { - stream.lineStart(); - interpolate(null, null, 1, stream); - stream.lineEnd(); - } - if (visible) { - clipRejoin(segments, compareIntersection, startInside, interpolate, stream); - } - stream.polygonEnd(); - } - activeStream = stream, segments = polygon = ring = null; - } - - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - - // TODO rather than special-case polygons, simply handle them separately. - // 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 = point; - if (v_) activeStream.lineEnd(); - } - - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([x, y]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else { - if (v && v_) activeStream.point(x, y); - else { - var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], - b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.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 = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - } - x_ = x, y_ = y, v_ = v; - } - - return clipStream; - }; - } - - function graticuleX(y0, y1, dy) { - var y = range$1(y0, y1 - epsilon$3, dy).concat(y1); - return function(x) { return y.map(function(y) { return [x, y]; }); }; - } - - function graticuleY(x0, x1, dx) { - var x = range$1(x0, x1 - epsilon$3, 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 = 10, dy = dx, DX = 90, DY = 360, - x, y, X, Y, - precision = 2.5; - - function graticule() { - return {type: "MultiLineString", coordinates: lines()}; - } - - function lines() { - return range$1(ceil(X0 / DX) * DX, X1, DX).map(X) - .concat(range$1(ceil(Y0 / DY) * DY, Y1, DY).map(Y)) - .concat(range$1(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs$1(x % DX) > epsilon$3; }).map(x)) - .concat(range$1(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs$1(y % DY) > epsilon$3; }).map(y)); - } - - graticule.lines = function() { - return lines().map(function(coordinates) { return {type: "LineString", coordinates: coordinates}; }); - }; - - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ - X(X0).concat( - Y(Y1).slice(1), - X(X1).reverse().slice(1), - Y(Y0).reverse().slice(1)) - ] - }; - }; - - graticule.extent = function(_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - - graticule.extentMajor = function(_) { - if (!arguments.length) return [[X0, Y0], [X1, Y1]]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - - graticule.extentMinor = function(_) { - if (!arguments.length) return [[x0, y0], [x1, y1]]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - - graticule.step = function(_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - - graticule.stepMajor = function(_) { - if (!arguments.length) return [DX, DY]; - DX = +_[0], DY = +_[1]; - return graticule; - }; - - graticule.stepMinor = function(_) { - if (!arguments.length) return [dx, dy]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - - return graticule - .extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]) - .extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]); - } - - function identity$6(x) { - return x; - } - - var areaSum$1 = adder(), - areaRingSum$1 = adder(), - x00, - y00, - x0$1, - y0$1; - - var areaStream$1 = { - point: noop$4, - lineStart: noop$4, - lineEnd: noop$4, - polygonStart: function() { - areaStream$1.lineStart = areaRingStart$1; - areaStream$1.lineEnd = areaRingEnd$1; - }, - polygonEnd: function() { - areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$4; - areaSum$1.add(abs$1(areaRingSum$1)); - areaRingSum$1.reset(); - }, - result: function() { - var area = areaSum$1 / 2; - areaSum$1.reset(); - return area; - } - }; - - function areaRingStart$1() { - areaStream$1.point = areaPointFirst$1; - } - - function areaPointFirst$1(x, y) { - areaStream$1.point = areaPoint$1; - x00 = x0$1 = x, y00 = y0$1 = y; - } - - function areaPoint$1(x, y) { - areaRingSum$1.add(y0$1 * x - x0$1 * y); - x0$1 = x, y0$1 = y; - } - - function areaRingEnd$1() { - areaPoint$1(x00, y00); - } - - var x0$2 = Infinity, - y0$2 = x0$2, - x1 = -x0$2, - y1 = x1; - - var boundsStream$1 = { - point: boundsPoint$1, - lineStart: noop$4, - lineEnd: noop$4, - polygonStart: noop$4, - polygonEnd: noop$4, - result: function() { - var bounds = [[x0$2, y0$2], [x1, y1]]; - x1 = y1 = -(y0$2 = x0$2 = Infinity); - return bounds; - } - }; - - function boundsPoint$1(x, y) { - if (x < x0$2) x0$2 = x; - if (x > x1) x1 = x; - if (y < y0$2) y0$2 = y; - if (y > y1) y1 = y; - } - - // TODO Enforce positive area for exterior, negative area for interior? - - var X0$1 = 0, - Y0$1 = 0, - Z0$1 = 0, - X1$1 = 0, - Y1$1 = 0, - Z1$1 = 0, - X2$1 = 0, - Y2$1 = 0, - Z2$1 = 0, - x00$1, - y00$1, - x0$3, - y0$3; - - var centroidStream$1 = { - point: centroidPoint$1, - lineStart: centroidLineStart$1, - lineEnd: centroidLineEnd$1, - polygonStart: function() { - centroidStream$1.lineStart = centroidRingStart$1; - centroidStream$1.lineEnd = centroidRingEnd$1; - }, - polygonEnd: function() { - centroidStream$1.point = centroidPoint$1; - centroidStream$1.lineStart = centroidLineStart$1; - centroidStream$1.lineEnd = centroidLineEnd$1; - }, - result: function() { - var centroid = 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 = Y0$1 = Z0$1 = - X1$1 = Y1$1 = Z1$1 = - X2$1 = Y2$1 = Z2$1 = 0; - return centroid; - } - }; - - function centroidPoint$1(x, y) { - X0$1 += x; - Y0$1 += y; - ++Z0$1; - } - - function centroidLineStart$1() { - centroidStream$1.point = centroidPointFirstLine; - } - - function centroidPointFirstLine(x, y) { - centroidStream$1.point = centroidPointLine; - centroidPoint$1(x0$3 = x, y0$3 = y); - } - - function centroidPointLine(x, y) { - var dx = x - x0$3, dy = y - y0$3, z = sqrt$2(dx * dx + dy * dy); - X1$1 += z * (x0$3 + x) / 2; - Y1$1 += z * (y0$3 + y) / 2; - Z1$1 += z; - centroidPoint$1(x0$3 = x, y0$3 = y); - } - - function centroidLineEnd$1() { - centroidStream$1.point = centroidPoint$1; - } - - function centroidRingStart$1() { - centroidStream$1.point = centroidPointFirstRing; - } - - function centroidRingEnd$1() { - centroidPointRing(x00$1, y00$1); - } - - function centroidPointFirstRing(x, y) { - centroidStream$1.point = centroidPointRing; - centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y); - } - - function centroidPointRing(x, y) { - var dx = x - x0$3, - dy = y - y0$3, - z = sqrt$2(dx * dx + dy * dy); - - X1$1 += z * (x0$3 + x) / 2; - Y1$1 += z * (y0$3 + y) / 2; - Z1$1 += z; - - z = y0$3 * x - x0$3 * y; - X2$1 += z * (x0$3 + x); - Y2$1 += z * (y0$3 + y); - Z2$1 += z * 3; - centroidPoint$1(x0$3 = x, y0$3 = y); - } - - function PathContext(context) { - this._context = context; - } - - PathContext.prototype = { - _radius: 4.5, - pointRadius: function(_) { - return this._radius = _, this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._context.moveTo(x, y); - this._point = 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$2); - break; - } - } - }, - result: noop$4 - }; - - var lengthSum = adder(), - lengthRing, - x00$2, - y00$2, - x0$4, - y0$4; - - var lengthStream = { - point: noop$4, - lineStart: function() { - lengthStream.point = lengthPointFirst; - }, - lineEnd: function() { - if (lengthRing) lengthPoint(x00$2, y00$2); - lengthStream.point = noop$4; - }, - polygonStart: function() { - lengthRing = true; - }, - polygonEnd: function() { - lengthRing = null; - }, - result: function() { - var length = +lengthSum; - lengthSum.reset(); - return length; - } - }; - - function lengthPointFirst(x, y) { - lengthStream.point = lengthPoint; - x00$2 = x0$4 = x, y00$2 = y0$4 = y; - } - - function lengthPoint(x, y) { - x0$4 -= x, y0$4 -= y; - lengthSum.add(sqrt$2(x0$4 * x0$4 + y0$4 * y0$4)); - x0$4 = x, y0$4 = y; - } - - function PathString() { - this._string = []; - } - - PathString.prototype = { - _radius: 4.5, - _circle: circle$1(4.5), - pointRadius: function(_) { - if ((_ = +_) !== this._radius) this._radius = _, this._circle = null; - return this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._string.push("Z"); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._string.push("M", x, ",", y); - this._point = 1; - break; - } - case 1: { - this._string.push("L", x, ",", y); - break; - } - default: { - if (this._circle == null) this._circle = circle$1(this._radius); - this._string.push("M", x, ",", y, this._circle); - break; - } - } - }, - result: function() { - if (this._string.length) { - var result = this._string.join(""); - this._string = []; - 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 geoPath(projection, context) { - var pointRadius = 4.5, - projectionStream, - contextStream; - - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - geoStream(object, projectionStream(contextStream)); - } - return contextStream.result(); - } - - path.area = function(object) { - geoStream(object, projectionStream(areaStream$1)); - return areaStream$1.result(); - }; - - path.measure = function(object) { - geoStream(object, projectionStream(lengthStream)); - return lengthStream.result(); - }; - - path.bounds = function(object) { - geoStream(object, projectionStream(boundsStream$1)); - return boundsStream$1.result(); - }; - - path.centroid = function(object) { - geoStream(object, projectionStream(centroidStream$1)); - return centroidStream$1.result(); - }; - - path.projection = function(_) { - return arguments.length ? (projectionStream = _ == null ? (projection = null, identity$6) : (projection = _).stream, path) : projection; - }; - - path.context = function(_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - - return path.projection(projection).context(context); - } - - function transformer$3(methods) { - return function(stream) { - var s = new TransformStream; - for (var key in methods) s[key] = methods[key]; - s.stream = stream; - return s; - }; - } - - function TransformStream() {} - - TransformStream.prototype = { - 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 = projection.clipExtent && projection.clipExtent(); - projection.scale(150).translate([0, 0]); - if (clip != null) projection.clipExtent(null); - geoStream(object, projection.stream(boundsStream$1)); - fitBounds(boundsStream$1.result()); - if (clip != null) projection.clipExtent(clip); - return projection; - } - - function fitExtent(projection, extent, object) { - return fit(projection, function(b) { - var w = extent[1][0] - extent[0][0], - h = extent[1][1] - extent[0][1], - k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), - x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, - y = +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 = +width, - k = w / (b[1][0] - b[0][0]), - x = (w - k * (b[1][0] + b[0][0])) / 2, - y = -k * b[0][1]; - projection.scale(150 * k).translate([x, y]); - }, object); - } - - function fitHeight(projection, height, object) { - return fit(projection, function(b) { - var h = +height, - k = h / (b[1][1] - b[0][1]), - x = -k * b[0][0], - y = (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([x, y]); - }, object); - } - - var maxDepth = 16, // maximum depth of subdivision - cosMinDistance = 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$3({ - point: function(x, y) { - x = 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 = x1 - x0, - dy = y1 - y0, - d2 = dx * dx + dy * dy; - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, - b = b0 + b1, - c = c0 + c1, - m = sqrt$2(a * a + b * b + c * c), - phi2 = asin$1(c /= m), - lambda2 = abs$1(abs$1(c) - 1) < epsilon$3 || abs$1(lambda0 - lambda1) < epsilon$3 ? (lambda0 + lambda1) / 2 : atan2$1(b, a), - p = project(lambda2, phi2), - x2 = p[0], - y2 = p[1], - dx2 = x2 - x0, - dy2 = y2 - y0, - dz = dy * dx2 - dx * dy2; - if (dz * dz / d2 > delta2 // perpendicular projected distance - || abs$1((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end - || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } - } - } - return function(stream) { - var lambda00, x00, y00, a00, b00, c00, // first point - lambda0, x0, y0, a0, b0, c0; // previous point - - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; }, - polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; } - }; - - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - - function linePoint(lambda, phi) { - var c = cartesian([lambda, phi]), p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - - return resampleStream; - }; - } - - var transformRadians = transformer$3({ - point: function(x, y) { - this.stream.point(x * radians, y * radians); - } - }); - - function transformRotate(rotate) { - return transformer$3({ - point: function(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); - } - }); - } - - function scaleTranslate(k, dx, dy, sx, sy) { - function transform(x, y) { - x *= sx; y *= sy; - return [dx + k * x, dy - k * y]; - } - transform.invert = function(x, y) { - return [(x - dx) / k * sx, (dy - y) / k * sy]; - }; - return transform; - } - - function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - var cosAlpha = cos$1(alpha), - sinAlpha = sin$1(alpha), - a = cosAlpha * k, - b = sinAlpha * k, - ai = cosAlpha / k, - bi = sinAlpha / k, - ci = (sinAlpha * dy - cosAlpha * dx) / k, - fi = (sinAlpha * dx + cosAlpha * dy) / k; - function transform(x, y) { - x *= sx; y *= sy; - return [a * x - b * y + dx, dy - b * x - a * y]; - } - transform.invert = function(x, y) { - return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)]; - }; - return transform; - } - - function projection(project) { - return projectionMutator(function() { return project; })(); - } - - function projectionMutator(projectAt) { - var project, - k = 150, // scale - x = 480, y = 250, // translate - lambda = 0, phi = 0, // center - deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate - alpha = 0, // post-rotate angle - sx = 1, // reflectX - sy = 1, // reflectX - theta = null, preclip = clipAntimeridian, // pre-clip angle - x0 = null, y0, x1, y1, postclip = identity$6, // post-clip extent - delta2 = 0.5, // precision - projectResample, - projectTransform, - projectRotateTransform, - cache, - cacheStream; - - function projection(point) { - return projectRotateTransform(point[0] * radians, point[1] * radians); - } - - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [point[0] * degrees$1, point[1] * degrees$1]; - } - - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); - }; - - projection.preclip = function(_) { - return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; - }; - - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - - projection.clipAngle = function(_) { - return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees$1; - }; - - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$6) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - projection.scale = function(_) { - return arguments.length ? (k = +_, recenter()) : k; - }; - - projection.translate = function(_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y]; - }; - - projection.center = function(_) { - return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees$1, phi * degrees$1]; - }; - - projection.rotate = function(_) { - return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees$1, deltaPhi * degrees$1, deltaGamma * degrees$1]; - }; - - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees$1; - }; - - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; - }; - - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; - }; - - projection.precision = function(_) { - return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt$2(delta2); - }; - - projection.fitExtent = function(extent, object) { - return fitExtent(projection, extent, object); - }; - - projection.fitSize = function(size, object) { - return fitSize(projection, size, object); - }; - - projection.fitWidth = function(width, object) { - return fitWidth(projection, width, object); - }; - - projection.fitHeight = function(height, object) { - return fitHeight(projection, height, object); - }; - - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), - transform = (alpha ? scaleTranslateRotate : scaleTranslate)(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma); - projectTransform = compose(project, transform); - projectRotateTransform = compose(rotate, projectTransform); - projectResample = resample(projectTransform, delta2); - return reset(); - } - - function reset() { - cache = cacheStream = null; - return projection; - } - - return function() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; - } - - function conicProjection(projectAt) { - var phi0 = 0, - phi1 = pi$2 / 3, - m = projectionMutator(projectAt), - p = m(phi0, phi1); - - p.parallels = function(_) { - return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees$1, phi1 * degrees$1]; - }; - - return p; - } - - function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = cos$1(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, sin$1(phi) / cosPhi0]; - } - - forward.invert = function(x, y) { - return [x / cosPhi0, asin$1(y * cosPhi0)]; - }; - - return forward; - } - - function conicEqualAreaRaw(y0, y1) { - var sy0 = sin$1(y0), n = (sy0 + sin$1(y1)) / 2; - - // Are the parallels symmetrical around the Equator? - if (abs$1(n) < epsilon$3) return cylindricalEqualAreaRaw(y0); - - var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt$2(c) / n; - - function project(x, y) { - var r = sqrt$2(c - 2 * n * sin$1(y)) / n; - return [r * sin$1(x *= n), r0 - r * cos$1(x)]; - } - - project.invert = function(x, y) { - var r0y = r0 - y, - l = atan2$1(x, abs$1(r0y)) * sign$1(r0y); - if (r0y * n < 0) - l -= pi$2 * sign$1(x) * sign$1(r0y); - return [l / n, asin$1((c - (x * x + r0y * r0y) * n * n) / (2 * n))]; - }; - - return project; - } - - function geoConicEqualArea() { - return conicProjection(conicEqualAreaRaw) - .scale(155.424) - .center([0, 33.6442]); - } - - function geoAlbers() { - return geoConicEqualArea() - .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 = streams.length; - return { - point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); }, - sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); }, - lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); }, - lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); }, - polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); }, - polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); } - }; - } - - // A composite projection for the United States, configured by default for - // 960×500. The projection also works quite well at 960×600 if you 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 geoAlbersUsa() { - var cache, - cacheStream, - lower48 = geoAlbers(), lower48Point, - alaska = geoConicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338 - hawaii = geoConicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007 - point, pointStream = {point: function(x, y) { point = [x, y]; }}; - - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - return point = null, - (lower48Point.point(x, y), point) - || (alaskaPoint.point(x, y), point) - || (hawaiiPoint.point(x, y), 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); - }; - - albersUsa.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]); - }; - - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - - 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); - - alaskaPoint = alaska - .translate([x - 0.307 * k, y + 0.201 * k]) - .clipExtent([[x - 0.425 * k + epsilon$3, y + 0.120 * k + epsilon$3], [x - 0.214 * k - epsilon$3, y + 0.234 * k - epsilon$3]]) - .stream(pointStream); - - hawaiiPoint = hawaii - .translate([x - 0.205 * k, y + 0.212 * k]) - .clipExtent([[x - 0.214 * k + epsilon$3, y + 0.166 * k + epsilon$3], [x - 0.115 * k - epsilon$3, y + 0.234 * k - epsilon$3]]) - .stream(pointStream); - - return reset(); - }; - - albersUsa.fitExtent = function(extent, object) { - return fitExtent(albersUsa, extent, object); - }; - - albersUsa.fitSize = function(size, object) { - return fitSize(albersUsa, size, object); - }; - - albersUsa.fitWidth = function(width, object) { - return fitWidth(albersUsa, width, object); - }; - - albersUsa.fitHeight = function(height, object) { - return fitHeight(albersUsa, height, object); - }; - - function reset() { - cache = cacheStream = null; - return albersUsa; - } - - return albersUsa.scale(1070); - } - - function azimuthalRaw(scale) { - return function(x, y) { - var cx = cos$1(x), - cy = cos$1(y), - k = scale(cx * cy); - return [ - k * cy * sin$1(x), - k * sin$1(y) - ]; - } - } - - function azimuthalInvert(angle) { - return function(x, y) { - var z = sqrt$2(x * x + y * y), - c = angle(z), - sc = sin$1(c), - cc = cos$1(c); - return [ - atan2$1(x * sc, z * cc), - asin$1(z && y * sc / z) - ]; - } - } - - var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { - return sqrt$2(2 / (1 + cxcy)); - }); - - azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) { - return 2 * asin$1(z / 2); - }); - - function geoAzimuthalEqualArea() { - return projection(azimuthalEqualAreaRaw) - .scale(124.75) - .clipAngle(180 - 1e-3); - } - - var azimuthalEquidistantRaw = azimuthalRaw(function(c) { - return (c = acos$1(c)) && c / sin$1(c); - }); - - azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) { - return z; - }); - - function geoAzimuthalEquidistant() { - return projection(azimuthalEquidistantRaw) - .scale(79.4188) - .clipAngle(180 - 1e-3); - } - - function mercatorRaw(lambda, phi) { - return [lambda, log$3(tan((halfPi$1 + phi) / 2))]; - } - - mercatorRaw.invert = function(x, y) { - return [x, 2 * atan(exp$1(y)) - halfPi$1]; - }; - - function geoMercator() { - return mercatorProjection(mercatorRaw) - .scale(961 / tau$2); - } - - function mercatorProjection(project) { - var m = projection(project), - center = m.center, - scale = m.scale, - translate = m.translate, - clipExtent = m.clipExtent, - x0 = null, y0, x1, y1; // clip extent - - m.scale = function(_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - - m.translate = function(_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - - m.center = function(_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - - m.clipExtent = function(_) { - return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - function reclip() { - var k = pi$2 * scale(), - t = m(rotation(m.rotate()).invert([0, 0])); - return clipExtent(x0 == null - ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === 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$1 + y) / 2); - } - - function conicConformalRaw(y0, y1) { - var cy0 = cos$1(y0), - n = y0 === y1 ? sin$1(y0) : log$3(cy0 / cos$1(y1)) / log$3(tany(y1) / tany(y0)), - f = cy0 * pow$2(tany(y0), n) / n; - - if (!n) return mercatorRaw; - - function project(x, y) { - if (f > 0) { if (y < -halfPi$1 + epsilon$3) y = -halfPi$1 + epsilon$3; } - else { if (y > halfPi$1 - epsilon$3) y = halfPi$1 - epsilon$3; } - var r = f / pow$2(tany(y), n); - return [r * sin$1(n * x), f - r * cos$1(n * x)]; - } - - project.invert = function(x, y) { - var fy = f - y, r = sign$1(n) * sqrt$2(x * x + fy * fy), - l = atan2$1(x, abs$1(fy)) * sign$1(fy); - if (fy * n < 0) - l -= pi$2 * sign$1(x) * sign$1(fy); - return [l / n, 2 * atan(pow$2(f / r, 1 / n)) - halfPi$1]; - }; - - return project; - } - - function geoConicConformal() { - return conicProjection(conicConformalRaw) - .scale(109.5) - .parallels([30, 30]); - } - - function equirectangularRaw(lambda, phi) { - return [lambda, phi]; - } - - equirectangularRaw.invert = equirectangularRaw; - - function geoEquirectangular() { - return projection(equirectangularRaw) - .scale(152.63); - } - - function conicEquidistantRaw(y0, y1) { - var cy0 = cos$1(y0), - n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0), - g = cy0 / n + y0; - - if (abs$1(n) < epsilon$3) return equirectangularRaw; - - function project(x, y) { - var gy = g - y, nx = n * x; - return [gy * sin$1(nx), g - gy * cos$1(nx)]; - } - - project.invert = function(x, y) { - var gy = g - y, - l = atan2$1(x, abs$1(gy)) * sign$1(gy); - if (gy * n < 0) - l -= pi$2 * sign$1(x) * sign$1(gy); - return [l / n, g - sign$1(n) * sqrt$2(x * x + gy * gy)]; - }; - - return project; - } - - function geoConicEquidistant() { - return conicProjection(conicEquidistantRaw) - .scale(131.154) - .center([0, 13.9389]); - } - - var A1 = 1.340264, - A2 = -0.081106, - A3 = 0.000893, - A4 = 0.003796, - M = sqrt$2(3) / 2, - iterations = 12; - - function equalEarthRaw(lambda, phi) { - var l = asin$1(M * sin$1(phi)), l2 = l * l, l6 = 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 = function(x, y) { - var l = y, l2 = l * l, l6 = l2 * l2 * l2; - for (var i = 0, delta, fy, fpy; i < iterations; ++i) { - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if (abs$1(delta) < epsilon2$1) break; - } - return [ - M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l), - asin$1(sin$1(l) / M) - ]; - }; - - function geoEqualEarth() { - return projection(equalEarthRaw) - .scale(177.158); - } - - function gnomonicRaw(x, y) { - var cy = cos$1(y), k = cos$1(x) * cy; - return [cy * sin$1(x) / k, sin$1(y) / k]; - } - - gnomonicRaw.invert = azimuthalInvert(atan); - - function geoGnomonic() { - return projection(gnomonicRaw) - .scale(144.049) - .clipAngle(60); - } - - function geoIdentity() { - var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, // scale, translate and reflect - alpha = 0, ca, sa, // angle - x0 = null, y0, x1, y1, // clip extent - kx = 1, ky = 1, - transform = transformer$3({ - point: function(x, y) { - var p = projection([x, y]); - this.stream.point(p[0], p[1]); - } - }), - postclip = identity$6, - cache, - cacheStream; - - function reset() { - kx = k * sx; - ky = k * sy; - cache = cacheStream = null; - return projection; - } - - function projection (p) { - var x = p[0] * kx, y = p[1] * ky; - if (alpha) { - var t = y * ca - x * sa; - x = x * ca + y * sa; - y = t; - } - return [x + tx, y + ty]; - } - projection.invert = function(p) { - var x = p[0] - tx, y = p[1] - ty; - if (alpha) { - var t = y * ca + x * sa; - x = x * ca - y * sa; - y = t; - } - return [x / kx, y / ky]; - }; - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream)); - }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$6) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - projection.scale = function(_) { - return arguments.length ? (k = +_, reset()) : k; - }; - projection.translate = function(_) { - return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty]; - }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * radians, sa = sin$1(alpha), ca = cos$1(alpha), reset()) : alpha * degrees$1; - }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0; - }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0; - }; - projection.fitExtent = function(extent, object) { - return fitExtent(projection, extent, object); - }; - projection.fitSize = function(size, object) { - return fitSize(projection, size, object); - }; - projection.fitWidth = function(width, object) { - return fitWidth(projection, width, object); - }; - projection.fitHeight = function(height, object) { - return fitHeight(projection, height, object); - }; - - return projection; - } - - function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2; - return [ - lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), - phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - ]; - } - - naturalEarth1Raw.invert = function(x, y) { - var phi = y, i = 25, delta; - do { - var phi2 = phi * phi, phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 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$1(delta) > epsilon$3 && --i > 0); - return [ - x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), - phi - ]; - }; - - function geoNaturalEarth1() { - return projection(naturalEarth1Raw) - .scale(175.295); - } - - function orthographicRaw(x, y) { - return [cos$1(y) * sin$1(x), sin$1(y)]; - } - - orthographicRaw.invert = azimuthalInvert(asin$1); - - function geoOrthographic() { - return projection(orthographicRaw) - .scale(249.5) - .clipAngle(90 + epsilon$3); - } - - function stereographicRaw(x, y) { - var cy = cos$1(y), k = 1 + cos$1(x) * cy; - return [cy * sin$1(x) / k, sin$1(y) / k]; - } - - stereographicRaw.invert = azimuthalInvert(function(z) { - return 2 * atan(z); - }); - - function geoStereographic() { - return projection(stereographicRaw) - .scale(250) - .clipAngle(142); - } - - function transverseMercatorRaw(lambda, phi) { - return [log$3(tan((halfPi$1 + phi) / 2)), -lambda]; - } - - transverseMercatorRaw.invert = function(x, y) { - return [-y, 2 * atan(exp$1(x)) - halfPi$1]; - }; - - function geoTransverseMercator() { - var m = mercatorProjection(transverseMercatorRaw), - center = m.center, - rotate = m.rotate; - - m.center = function(_) { - return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); - }; - - m.rotate = function(_) { - return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]); - }; - - return rotate([0, 0, 90]) - .scale(159.155); - } - - var abs$2 = Math.abs; - var cos$2 = Math.cos; - var sin$2 = Math.sin; - - var epsilon$4 = 1e-6; - var pi$3 = Math.PI; - var halfPi$2 = pi$3 / 2; - var sqrt2 = sqrt$3(2); - - function asin$2(x) { - return x > 1 ? halfPi$2 : x < -1 ? -halfPi$2 : Math.asin(x); - } - - function sqrt$3(x) { - return x > 0 ? Math.sqrt(x) : 0; - } - - function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * sin$2(phi), i = 30, delta; - do phi -= delta = (phi + sin$2(phi) - cpsinPhi) / (1 + cos$2(phi)); - while (abs$2(delta) > epsilon$4 && --i > 0); - return phi / 2; - } - - function mollweideBromleyRaw(cx, cy, cp) { - - function forward(lambda, phi) { - return [cx * lambda * cos$2(phi = mollweideBromleyTheta(cp, phi)), cy * sin$2(phi)]; - } - - forward.invert = function(x, y) { - return y = asin$2(y / cy), [x / (cx * cos$2(y)), asin$2((2 * y + sin$2(2 * y)) / cp)]; - }; - - return forward; - } - - var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi$2, sqrt2, pi$3); - - function geoMollweide() { - return projection(mollweideRaw) - .scale(169.529); - } - - var defaultPath = geoPath(); - - var projectionProperties = [ - // standard properties in d3-geo - 'clipAngle', - 'clipExtent', - 'scale', - 'translate', - 'center', - 'rotate', - 'parallels', - 'precision', - 'reflectX', - 'reflectY', - - // extended properties in d3-geo-projections - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' - ]; - - /** - * Augment projections with their type and a copy method. - */ - function create$1(type, constructor) { - return function projection() { - var p = constructor(); - - p.type = type; - - p.path = geoPath().projection(p); - - p.copy = p.copy || function() { - var c = projection(); - projectionProperties.forEach(function(prop) { - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - - return p; - }; - } - - function projection$1(type, proj) { - if (!type || typeof type !== 'string') { - throw new Error('Projection type must be a name string.'); - } - type = type.toLowerCase(); - if (arguments.length > 1) { - projections[type] = create$1(type, proj); - return this; - } else { - return projections[type] || null; - } - } - - function getProjectionPath(proj) { - return (proj && proj.path) || defaultPath; - } - - var projections = { - // base d3-geo projection types - albers: geoAlbers, - albersusa: geoAlbersUsa, - azimuthalequalarea: geoAzimuthalEqualArea, - azimuthalequidistant: geoAzimuthalEquidistant, - conicconformal: geoConicConformal, - conicequalarea: geoConicEqualArea, - conicequidistant: geoConicEquidistant, - equalEarth: geoEqualEarth, - equirectangular: geoEquirectangular, - gnomonic: geoGnomonic, - identity: geoIdentity, - mercator: geoMercator, - mollweide: geoMollweide, - naturalEarth1: geoNaturalEarth1, - orthographic: geoOrthographic, - stereographic: geoStereographic, - transversemercator: geoTransverseMercator - }; - - for (var key$1 in projections) { - projection$1(key$1, projections[key$1]); - } - - /** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ - function GeoPath(params) { - Transform.call(this, null, params); - } - - GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] - }; - - var prototype$17 = inherits(GeoPath, Transform); - - prototype$17.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - path = this.value, - field = _.field || identity, - as = _.as || 'path', - flag = out.SOURCE; - - function set(t) { t[as] = path(field(t)); } - - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = getProjectionPath(_.projection); - out.materialize().reflow(); - } else { - flag = field === identity || pulse.modified(field.fields) - ? out.ADD_MOD - : out.ADD; - } - - var prev = initPath(path, _.pointRadius); - out.visit(flag, set); - path.pointRadius(prev); - - return out.modifies(as); - }; - - function initPath(path, pointRadius) { - var prev = path.pointRadius(); - path.context(null); - if (pointRadius != null) { - path.pointRadius(pointRadius); - } - return prev; - } - - /** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ - function GeoPoint(params) { - Transform.call(this, null, params); - } - - GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection', 'required': true }, - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true, 'length': 2 }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 2, 'default': ['x', 'y'] } - ] - }; - - var prototype$18 = inherits(GeoPoint, Transform); - - prototype$18.transform = function(_, pulse) { - var proj = _.projection, - lon = _.fields[0], - lat = _.fields[1], - as = _.as || ['x', 'y'], - x = as[0], - y = as[1], - mod; - - function set(t) { - var xy = proj([lon(t), lat(t)]); - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - - if (_.modified()) { - // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - } else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - - return pulse.modifies(as); - }; - - /** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ - function GeoShape(params) { - Transform.call(this, null, params); - } - - GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': {'modifies': true, 'nomod': true}, - 'params': [ - { 'name': 'projection', 'type': 'projection' }, - { 'name': 'field', 'type': 'field', 'default': 'datum' }, - { 'name': 'pointRadius', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'default': 'shape' } - ] - }; - - var prototype$19 = inherits(GeoShape, Transform); - - prototype$19.transform = function(_, pulse) { - var out = pulse.fork(pulse.ALL), - shape = this.value, - as = _.as || 'shape', - flag = out.ADD; - - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator( - getProjectionPath(_.projection), - _.field || field('datum'), - _.pointRadius - ); - out.materialize().reflow(); - flag = out.SOURCE; - } - - out.visit(flag, function(t) { t[as] = shape; }); - - return out.modifies(as); - }; - - function shapeGenerator(path, field, pointRadius) { - var shape = pointRadius == null - ? function(_) { return path(field(_)); } - : function(_) { - var prev = path.pointRadius(), - value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - shape.context = function(_) { - path.context(_); - return shape; - }; - - return shape; - } - - /** - * GeoJSON feature generator for creating graticules. - * @constructor - */ - function Graticule(params) { - Transform.call(this, [], params); - this.generator = graticule(); - } - - Graticule.Definition = { - 'type': 'Graticule', - 'metadata': {'changes': true, 'generates': true}, - 'params': [ - { 'name': 'extent', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMajor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'extentMinor', 'type': 'array', 'array': true, 'length': 2, - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'step', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'stepMajor', 'type': 'number', 'array': true, 'length': 2, 'default': [90, 360] }, - { 'name': 'stepMinor', 'type': 'number', 'array': true, 'length': 2, 'default': [10, 10] }, - { 'name': 'precision', 'type': 'number', 'default': 2.5 } - ] - }; - - var prototype$1a = inherits(Graticule, Transform); - - prototype$1a.transform = function(_, pulse) { - var src = this.value, - gen = this.generator, t; - - if (!src.length || _.modified()) { - for (var prop in _) { - if (isFunction(gen[prop])) { - gen[prop](_[prop]); - } - } - } - - t = gen(); - if (src.length) { - pulse.mod.push(replace(src[0], t)); - } else { - pulse.add.push(ingest(t)); - } - src[0] = t; - - return pulse; - }; - - /** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ - function Heatmap(params) { - Transform.call(this, null, params); - } - - Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'field', 'type': 'field' }, - { 'name': 'color', 'type': 'string', 'expr': true}, - { 'name': 'opacity', 'type': 'number', 'expr': true}, - { 'name': 'resolve', 'type': 'enum', 'values': ['shared', 'independent'], 'default': 'independent' }, - { 'name': 'as', 'type': 'string', 'default': 'image' } - ] - }; - - var prototype$1b = inherits(Heatmap, Transform); - - prototype$1b.transform = function(_, pulse) { - if (!pulse.changed() && !_.modified()) { - return pulse.StopPropagation; - } - - var source = pulse.materialize(pulse.SOURCE).source, - shared = _.resolve === 'shared', - field = _.field || identity, - opacity = opacity_(_.opacity, _), - color = color_(_.color, _), - as = _.as || 'image', - obj = { - $x: 0, $y: 0, $value: 0, - $max: shared ? max(source.map(t => max(field(t).values))) : 0 - }; - - source.forEach(t => { - const v = field(t); - - // build proxy data object - const o = extend({}, t, obj); - // set maximum value if not globally shared - if (!shared) o.$max = max(v.values || []); - - // generate canvas image - // optimize color/opacity if not pixel-dependent - t[as] = toCanvas(v, o, - color.dep ? color : constant(color(o)), - opacity.dep ? opacity : constant(opacity(o)) - ); - }); - - return pulse.reflow(true).modifies(as); - }; - - // get image color function - function color_(color, _) { - let f; - if (isFunction(color)) { - f = obj => rgb(color(obj, _)); - f.dep = dependency(color); - } else { - // default to mid-grey - f = constant(rgb(color || '#888')); - } - return f; - } - - // get image opacity function - function opacity_(opacity, _) { - let f; - if (isFunction(opacity)) { - f = obj => opacity(obj, _); - f.dep = dependency(opacity); - } else if (opacity) { - f = constant(opacity); - } else { - // default to [0, max] opacity gradient - f = obj => (obj.$value / obj.$max) || 0; - f.dep = true; - } - return f; - } - - // check if function depends on individual pixel data - function dependency(f) { - if (!isFunction(f)) return false; - const set = toSet(accessorFields(f)); - return set.$x || set.$y || set.$value || set.$max; - } - - // render raster grid to canvas - function toCanvas(grid, obj, color, opacity) { - const n = grid.width, - m = grid.height, - x1 = grid.x1 || 0, - y1 = grid.y1 || 0, - x2 = grid.x2 || n, - y2 = grid.y2 || m, - val = grid.values, - value = val ? i => val[i] : zero, - can = domCanvas(x2 - x1, y2 - y1), - ctx = can.getContext('2d'), - img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), - pix = img.data; - - for (let j=y1, k=0; j a.concat(featurize(f)), []) - }; - } - - function featurize(f) { - return f.type === FeatureCollection - ? f.features - : array(f).filter(d => d != null).map( - d => d.type === Feature ? d : {type: Feature, geometry: d} - ); - } - - var geo = /*#__PURE__*/Object.freeze({ - __proto__: null, - contour: Contour, - geojson: GeoJSON, - geopath: GeoPath, - geopoint: GeoPoint, - geoshape: GeoShape, - graticule: Graticule, - heatmap: Heatmap, - isocontour: Isocontour, - kde2d: KDE2D, - projection: Projection - }); - - function forceCenter(x, y) { - var nodes; - - if (x == null) x = 0; - if (y == null) y = 0; - - function force() { - var i, - n = nodes.length, - node, - sx = 0, - sy = 0; - - for (i = 0; i < n; ++i) { - node = nodes[i], sx += node.x, sy += node.y; - } - - for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) { - node = nodes[i], node.x -= sx, node.y -= sy; - } - } - - force.initialize = function(_) { - nodes = _; - }; - - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; - }; - - return force; - } - - function tree_add(d) { - var x = +this._x.call(null, d), - y = +this._y.call(null, d); - return add$4(this.cover(x, y), x, y, d); - } - - function add$4(tree, x, y, d) { - if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points - - var parent, - node = tree._root, - leaf = {data: d}, - x0 = tree._x0, - y0 = tree._y0, - x1 = tree._x1, - y1 = 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 = leaf, tree; - - // Find the existing leaf for the new point, or add it. - while (node.length) { - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; - } - - // Is the new point is exactly coincident with the existing point? - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; - - // Otherwise, split the leaf node until the old and new point are separated. - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm))); - return parent[j] = node, parent[i] = leaf, tree; - } - - function addAll(data) { - var d, i, n = data.length, - x, - y, - xz = new Array(n), - yz = new Array(n), - x0 = Infinity, - y0 = Infinity, - x1 = -Infinity, - y1 = -Infinity; - - // Compute the points and their extent. - for (i = 0; i < n; ++i) { - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; - xz[i] = x; - yz[i] = y; - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = 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 = 0; i < n; ++i) { - add$4(this, xz[i], yz[i], data[i]); - } - - return this; - } - - function tree_cover(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points - - var x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = 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’t change due to floating point error! - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; - } - - // Otherwise, double repeatedly to cover. - else { - var z = x1 - x0, - node = this._root, - parent, - i; - - while (x0 > x || x >= x1 || y0 > y || y >= y1) { - i = (y < y0) << 1 | (x < x0); - parent = new Array(4), parent[i] = node, node = parent, z *= 2; - switch (i) { - case 0: x1 = x0 + z, y1 = y0 + z; break; - case 1: x0 = x1 - z, y1 = y0 + z; break; - case 2: x1 = x0 + z, y0 = y1 - z; break; - case 3: x0 = x1 - z, y0 = y1 - z; break; - } - } - - if (this._root && this._root.length) this._root = node; - } - - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; - } - - function tree_data() { - var data = []; - this.visit(function(node) { - if (!node.length) do data.push(node.data); while (node = 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, this._y1]]; - } - - function Quad(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - } - - function tree_find(x, y, radius) { - var data, - x0 = this._x0, - y0 = this._y0, - x1, - y1, - x2, - y2, - x3 = this._x1, - y3 = this._y1, - quads = [], - node = this._root, - q, - i; - - if (node) quads.push(new Quad(node, x0, y0, x3, y3)); - if (radius == null) radius = Infinity; - else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; - } - - while (q = quads.pop()) { - - // Stop searching if this quadrant can’t contain a closer node. - if (!(node = q.node) - || (x1 = q.x0) > x3 - || (y1 = q.y0) > y3 - || (x2 = q.x1) < x0 - || (y2 = q.y1) < y0) continue; - - // Bisect the current quadrant. - if (node.length) { - var xm = (x1 + x2) / 2, - ym = (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 = (y >= ym) << 1 | (x >= xm)) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; - } - } - - // Visit this point. (Visiting coincident points isn’t necessary!) - else { - var dx = x - +this._x.call(null, node.data), - dy = y - +this._y.call(null, node.data), - d2 = dx * dx + dy * dy; - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } - } - - return data; - } - - function tree_remove(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points - - var parent, - node = this._root, - retainer, - previous, - next, - x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = 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 sibling. - if (node.length) while (true) { - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) return this; - if (!node.length) break; - if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i; - } - - // Find the point to remove. - while (node.data !== d) if (!(previous = node, node = node.next)) return this; - if (next = node.next) delete node.next; - - // If there are multiple coincident points, remove just the point. - if (previous) return (next ? previous.next = next : delete previous.next), this; - - // If this is the root point, remove it. - if (!parent) return this._root = next, this; - - // Remove this leaf. - next ? parent[i] = next : delete parent[i]; - - // If the parent now contains exactly one leaf, collapse superfluous parents. - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) - && node === (parent[3] || parent[2] || parent[1] || parent[0]) - && !node.length) { - if (retainer) retainer[j] = node; - else this._root = node; - } - - return this; - } - - function removeAll(data) { - for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]); - return this; - } - - function tree_root() { - return this._root; - } - - function tree_size() { - var size = 0; - this.visit(function(node) { - if (!node.length) do ++size; while (node = node.next) - }); - return size; - } - - function tree_visit(callback) { - var quads = [], q, node = this._root, child, x0, y0, x1, y1; - if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); - } - } - return this; - } - - function tree_visitAfter(callback) { - var quads = [], next = [], q; - if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - var node = q.node; - if (node.length) { - var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); - } - next.push(q); - } - while (q = next.pop()) { - callback(q.node, q.x0, q.y0, q.x1, q.y1); - } - return this; - } - - function defaultX(d) { - return d[0]; - } - - function tree_x(_) { - return arguments.length ? (this._x = _, this) : this._x; - } - - function defaultY(d) { - return d[1]; - } - - function tree_y(_) { - return arguments.length ? (this._y = _, this) : this._y; - } - - function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); - } - - function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = undefined; - } - - function leaf_copy(leaf) { - var copy = {data: leaf.data}, next = copy; - while (leaf = leaf.next) next = next.next = {data: leaf.data}; - return copy; - } - - var treeProto = quadtree.prototype = Quadtree.prototype; - - treeProto.copy = function() { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), - node = this._root, - nodes, - child; - - if (!node) return copy; - - if (!node.length) return copy._root = leaf_copy(node), copy; - - nodes = [{source: node, target: copy._root = new Array(4)}]; - while (node = nodes.pop()) { - for (var i = 0; i < 4; ++i) { - if (child = node.source[i]) { - if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)}); - else node.target[i] = leaf_copy(child); - } - } - } - - return copy; - }; - - treeProto.add = tree_add; - treeProto.addAll = addAll; - treeProto.cover = tree_cover; - treeProto.data = tree_data; - treeProto.extent = tree_extent; - treeProto.find = tree_find; - treeProto.remove = tree_remove; - treeProto.removeAll = removeAll; - treeProto.root = tree_root; - treeProto.size = tree_size; - treeProto.visit = tree_visit; - treeProto.visitAfter = tree_visitAfter; - treeProto.x = tree_x; - treeProto.y = tree_y; - - function constant$4(x) { - return function() { - return x; - }; - } - - function jiggle() { - return (Math.random() - 0.5) * 1e-6; - } - - function x$2(d) { - return d.x + d.vx; - } - - function y$2(d) { - return d.y + d.vy; - } - - function forceCollide(radius) { - var nodes, - radii, - strength = 1, - iterations = 1; - - if (typeof radius !== "function") radius = constant$4(radius == null ? 1 : +radius); - - function force() { - var i, n = nodes.length, - tree, - node, - xi, - yi, - ri, - ri2; - - for (var k = 0; k < iterations; ++k) { - tree = quadtree(nodes, x$2, y$2).visitAfter(prepare); - for (i = 0; i < n; ++i) { - node = nodes[i]; - ri = radii[node.index], ri2 = ri * ri; - xi = node.x + node.vx; - yi = node.y + node.vy; - tree.visit(apply); - } - } - - function apply(quad, x0, y0, x1, y1) { - var data = quad.data, rj = quad.r, r = ri + rj; - if (data) { - if (data.index > node.index) { - var x = xi - data.x - data.vx, - y = yi - data.y - data.vy, - l = x * x + y * y; - if (l < r * r) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y *= l) * r; - data.vx -= x * (r = 1 - r); - data.vy -= 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 = radii[quad.data.index]; - for (var i = quad.r = 0; i < 4; ++i) { - if (quad[i] && quad[i].r > quad.r) { - quad.r = quad[i].r; - } - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - radii = new Array(n); - for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes); - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : radius; - }; - - return force; - } - - function index(d) { - return d.index; - } - - function find$1(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) throw new Error("missing: " + nodeId); - return node; - } - - function forceLink(links) { - var id = index, - strength = defaultStrength, - strengths, - distance = constant$4(30), - distances, - nodes, - count, - bias, - iterations = 1; - - if (links == null) links = []; - - function defaultStrength(link) { - return 1 / Math.min(count[link.source.index], count[link.target.index]); - } - - function force(alpha) { - for (var k = 0, n = links.length; k < iterations; ++k) { - for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) { - link = links[i], source = link.source, target = link.target; - x = target.x + target.vx - source.x - source.vx || jiggle(); - y = target.y + target.vy - source.y - source.vy || jiggle(); - l = Math.sqrt(x * x + y * y); - l = (l - distances[i]) / l * alpha * strengths[i]; - x *= l, y *= l; - target.vx -= x * (b = bias[i]); - target.vy -= y * b; - source.vx += x * (b = 1 - b); - source.vy += y * b; - } - } - } - - function initialize() { - if (!nodes) return; - - var i, - n = nodes.length, - m = links.length, - nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d])), - link; - - for (i = 0, count = new Array(n); i < m; ++i) { - link = links[i], link.index = i; - if (typeof link.source !== "object") link.source = find$1(nodeById, link.source); - if (typeof link.target !== "object") link.target = find$1(nodeById, link.target); - count[link.source.index] = (count[link.source.index] || 0) + 1; - count[link.target.index] = (count[link.target.index] || 0) + 1; - } - - for (i = 0, bias = new Array(m); i < m; ++i) { - link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); - } - - strengths = new Array(m), initializeStrength(); - distances = new Array(m), initializeDistance(); - } - - function initializeStrength() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - strengths[i] = +strength(links[i], i, links); - } - } - - function initializeDistance() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - distances[i] = +distance(links[i], i, links); - } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - - force.id = function(_) { - return arguments.length ? (id = _, force) : id; - }; - - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant$4(+_), initializeStrength(), force) : strength; - }; - - force.distance = function(_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : constant$4(+_), initializeDistance(), force) : distance; - }; - - return force; - } - - var noop$5 = {value: function() {}}; - - function dispatch() { - for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { - if (!(t = arguments[i] + "") || (t in _) || /[\s.]/.test(t)) throw new Error("illegal type: " + t); - _[t] = []; - } - return new Dispatch(_); - } - - function Dispatch(_) { - this._ = _; - } - - function parseTypenames(typenames, types) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); - return {type: t, name: name}; - }); - } - - Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function(typename, callback) { - var _ = this._, - T = parseTypenames(typename + "", _), - t, - i = -1, - n = 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 = (typename = T[i]).type) && (t = get$4(_[t], typename.name))) return t; - return; - } - - // If a type was specified, set the callback for the given type and name. - // Otherwise, if a null callback was specified, remove callbacks of the given name. - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); - while (++i < n) { - if (t = (typename = T[i]).type) _[t] = set$3(_[t], typename.name, callback); - else if (callback == null) for (t in _) _[t] = set$3(_[t], typename.name, null); - } - - return this; - }, - copy: function() { - var copy = {}, _ = this._; - for (var t in _) copy[t] = _[t].slice(); - return new Dispatch(copy); - }, - call: function(type, that) { - if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); - }, - apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); - } - }; - - function get$4(type, name) { - for (var i = 0, n = type.length, c; i < n; ++i) { - if ((c = type[i]).name === name) { - return c.value; - } - } - } - - function set$3(type, name, callback) { - for (var i = 0, n = type.length; i < n; ++i) { - if (type[i].name === name) { - type[i] = noop$5, type = type.slice(0, i).concat(type.slice(i + 1)); - break; - } - } - if (callback != null) type.push({name: name, value: callback}); - return type; - } - - var frame = 0, // is an animation frame pending? - timeout = 0, // is a timeout pending? - interval = 0, // are any timers active? - pokeDelay = 1000, // how frequently we check for clock skew - taskHead, - taskTail, - clockLast = 0, - clockNow = 0, - clockSkew = 0, - clock = typeof performance === "object" && performance.now ? performance : Date, - setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); }; - - function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); - } - - function clearNow() { - clockNow = 0; - } - - function Timer() { - this._call = - this._time = - this._next = null; - } - - Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this; - else taskHead = this; - taskTail = this; - } - this._call = callback; - this._time = time; - sleep(); - }, - stop: function() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); - } - } - }; - - function timer(callback, delay, time) { - var t = new Timer; - t.restart(callback, delay, time); - return t; - } - - function timerFlush() { - now(); // Get the current time, if not already set. - ++frame; // Pretend we’ve set an alarm, if we haven’t already. - var t = taskHead, e; - while (t) { - if ((e = clockNow - t._time) >= 0) t._call.call(null, e); - t = t._next; - } - --frame; - } - - function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - try { - timerFlush(); - } finally { - frame = 0; - nap(); - clockNow = 0; - } - } - - function poke() { - var now = clock.now(), delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; - } - - function nap() { - var t0, t1 = taskHead, t2, time = Infinity; - while (t1) { - if (t1._call) { - if (time > t1._time) time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } - } - taskTail = t0; - sleep(time); - } - - function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - if (timeout) timeout = clearTimeout(timeout); - var delay = time - clockNow; // Strictly less than if we recomputed clockNow. - if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); - } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); - } - } - - function interval$1(callback, delay, time) { - var t = new Timer, total = delay; - if (delay == null) return t.restart(callback, delay, time), t; - delay = +delay, time = time == null ? now() : +time; - t.restart(function tick(elapsed) { - elapsed += total; - t.restart(tick, total += delay, time); - callback(elapsed); - }, delay, time); - return t; - } - - function x$3(d) { - return d.x; - } - - function y$3(d) { - return d.y; - } - - var initialRadius = 10, - initialAngle = Math.PI * (3 - Math.sqrt(5)); - - function forceSimulation(nodes) { - var simulation, - alpha = 1, - alphaMin = 0.001, - alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), - alphaTarget = 0, - velocityDecay = 0.6, - forces = new Map(), - stepper = timer(step), - event = dispatch("tick", "end"); - - if (nodes == null) nodes = []; - - function step() { - tick(); - event.call("tick", simulation); - if (alpha < alphaMin) { - stepper.stop(); - event.call("end", simulation); - } - } - - function tick(iterations) { - var i, n = nodes.length, node; - - if (iterations === undefined) iterations = 1; - - for (var k = 0; k < iterations; ++k) { - alpha += (alphaTarget - alpha) * alphaDecay; - - forces.forEach(function(force) { - force(alpha); - }); - - for (i = 0; i < n; ++i) { - node = nodes[i]; - if (node.fx == null) node.x += node.vx *= velocityDecay; - else node.x = node.fx, node.vx = 0; - if (node.fy == null) node.y += node.vy *= velocityDecay; - else node.y = node.fy, node.vy = 0; - } - } - - return simulation; - } - - function initializeNodes() { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.index = i; - if (node.fx != null) node.x = node.fx; - if (node.fy != null) node.y = node.fy; - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - if (isNaN(node.vx) || isNaN(node.vy)) { - node.vx = node.vy = 0; - } - } - } - - function initializeForce(force) { - if (force.initialize) force.initialize(nodes); - return force; - } - - initializeNodes(); - - return simulation = { - tick: tick, - - restart: function() { - return stepper.restart(step), simulation; - }, - - stop: function() { - return stepper.stop(), simulation; - }, - - nodes: function(_) { - return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes; - }, - - alpha: function(_) { - return arguments.length ? (alpha = +_, simulation) : alpha; - }, - - alphaMin: function(_) { - return arguments.length ? (alphaMin = +_, simulation) : alphaMin; - }, - - alphaDecay: function(_) { - return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; - }, - - alphaTarget: function(_) { - return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; - }, - - velocityDecay: function(_) { - return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; - }, - - force: function(name, _) { - return arguments.length > 1 ? ((_ == null ? forces.delete(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name); - }, - - find: function(x, y, radius) { - var i = 0, - n = nodes.length, - dx, - dy, - d2, - node, - closest; - - if (radius == null) radius = Infinity; - else radius *= radius; - - for (i = 0; i < n; ++i) { - node = nodes[i]; - dx = x - node.x; - dy = y - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) closest = node, radius = d2; - } - - return closest; - }, - - on: function(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); - } - }; - } - - function forceManyBody() { - var nodes, - node, - alpha, - strength = constant$4(-30), - strengths, - distanceMin2 = 1, - distanceMax2 = Infinity, - theta2 = 0.81; - - function force(_) { - var i, n = nodes.length, tree = quadtree(nodes, x$3, y$3).visitAfter(accumulate); - for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply); - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - strengths = new Array(n); - for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes); - } - - function accumulate(quad) { - var strength = 0, q, c, weight = 0, x, y, i; - - // For internal nodes, accumulate forces from child quadrants. - if (quad.length) { - for (x = y = i = 0; i < 4; ++i) { - if ((q = quad[i]) && (c = Math.abs(q.value))) { - strength += q.value, weight += c, x += c * q.x, y += c * q.y; - } - } - quad.x = x / weight; - quad.y = y / weight; - } - - // For leaf nodes, accumulate forces from coincident quadrants. - else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - do strength += strengths[q.data.index]; - while (q = q.next); - } - - quad.value = strength; - } - - function apply(quad, x1, _, x2) { - if (!quad.value) return true; - - var x = quad.x - node.x, - y = quad.y - node.y, - w = x2 - x1, - l = 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 === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - node.vx += x * quad.value * alpha / l; - node.vy += y * quad.value * alpha / l; - } - return true; - } - - // Otherwise, process points directly. - else if (quad.length || l >= distanceMax2) return; - - // Limit forces for very close nodes; randomize direction if coincident. - if (quad.data !== node || quad.next) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - } - - do if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x * w; - node.vy += y * w; - } while (quad = quad.next); - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : strength; - }; - - force.distanceMin = function(_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - - force.distanceMax = function(_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - - force.theta = function(_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); - }; - - return force; - } - - function forceX(x) { - var strength = constant$4(0.1), - nodes, - strengths, - xz; - - if (typeof x !== "function") x = constant$4(x == null ? 0 : +x); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : strength; - }; - - force.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : x; - }; - - return force; - } - - function forceY(y) { - var strength = constant$4(0.1), - nodes, - strengths, - yz; - - if (typeof y !== "function") y = constant$4(y == null ? 0 : +y); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; - } - } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : strength; - }; - - force.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : constant$4(+_), initialize(), force) : y; - }; - - return force; - } - - var ForceMap = { - center: forceCenter, - collide: forceCollide, - nbody: forceManyBody, - link: forceLink, - x: forceX, - y: forceY - }; - - var Forces = 'forces', - ForceParams = [ - 'alpha', 'alphaMin', 'alphaTarget', - 'velocityDecay', 'forces' - ], - ForceConfig = ['static', 'iterations'], - ForceOutput = ['x', 'y', 'vx', 'vy']; - - /** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.forces - The forces to apply. - */ - function Force(params) { - Transform.call(this, null, params); - } - - Force.Definition = { - 'type': 'Force', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'static', 'type': 'boolean', 'default': false }, - { 'name': 'restart', 'type': 'boolean', 'default': false }, - { 'name': 'iterations', 'type': 'number', 'default': 300 }, - { 'name': 'alpha', 'type': 'number', 'default': 1 }, - { 'name': 'alphaMin', 'type': 'number', 'default': 0.001 }, - { 'name': 'alphaTarget', 'type': 'number', 'default': 0 }, - { 'name': 'velocityDecay', 'type': 'number', 'default': 0.4 }, - { 'name': 'forces', 'type': 'param', 'array': true, - 'params': [ - { - 'key': {'force': 'center'}, - 'params': [ - { 'name': 'x', 'type': 'number', 'default': 0 }, - { 'name': 'y', 'type': 'number', 'default': 0 } - ] - }, - { - 'key': {'force': 'collide'}, - 'params': [ - { 'name': 'radius', 'type': 'number', 'expr': true }, - { 'name': 'strength', 'type': 'number', 'default': 0.7 }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'nbody'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': -30 }, - { 'name': 'theta', 'type': 'number', 'default': 0.9 }, - { 'name': 'distanceMin', 'type': 'number', 'default': 1 }, - { 'name': 'distanceMax', 'type': 'number' } - ] - }, - { - 'key': {'force': 'link'}, - 'params': [ - { 'name': 'links', 'type': 'data' }, - { 'name': 'id', 'type': 'field' }, - { 'name': 'distance', 'type': 'number', 'default': 30, 'expr': true }, - { 'name': 'strength', 'type': 'number', 'expr': true }, - { 'name': 'iterations', 'type': 'number', 'default': 1 } - ] - }, - { - 'key': {'force': 'x'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'x', 'type': 'field' } - ] - }, - { - 'key': {'force': 'y'}, - 'params': [ - { 'name': 'strength', 'type': 'number', 'default': 0.1 }, - { 'name': 'y', 'type': 'field' } - ] - } - ] }, - { - 'name': 'as', 'type': 'string', 'array': true, 'modify': false, - 'default': ForceOutput - } - ] - }; - - var prototype$1d = inherits(Force, Transform); - - prototype$1d.transform = function(_, pulse) { - var sim = this.value, - change = pulse.changed(pulse.ADD_REM), - params = _.modified(ForceParams), - iters = _.iterations || 300; - - // configure simulation - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - pulse.modifies('index'); - } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - if (params || pulse.changed(pulse.MOD)) { - setup(sim, _, 0, pulse); - } - } - - // run simulation - if (params || change || _.modified(ForceConfig) - || (pulse.changed() && _.restart)) - { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)) - .alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - - if (_.static) { - for (sim.stop(); --iters >= 0;) sim.tick(); - } else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } - } - - return this.finish(_, pulse); - }; - - prototype$1d.finish = function(_, pulse) { - var dataflow = pulse.dataflow; - - // inspect dependencies, touch link source data - for (var args=this._argops, j=0, m=args.length, arg; j= 0) sum += children[i].value; - node.value = sum; - } - - function node_count() { - return this.eachAfter(count); - } - - function node_each(callback) { - var node = this, current, next = [node], children, i, n; - do { - current = next.reverse(), next = []; - while (node = current.pop()) { - callback(node), children = node.children; - if (children) for (i = 0, n = children.length; i < n; ++i) { - next.push(children[i]); - } - } - } while (next.length); - return this; - } - - function node_eachBefore(callback) { - var node = this, nodes = [node], children, i; - while (node = nodes.pop()) { - callback(node), children = node.children; - if (children) for (i = children.length - 1; i >= 0; --i) { - nodes.push(children[i]); - } - } - return this; - } - - function node_eachAfter(callback) { - var node = this, nodes = [node], next = [], children, i, n; - while (node = nodes.pop()) { - next.push(node), children = node.children; - if (children) for (i = 0, n = children.length; i < n; ++i) { - nodes.push(children[i]); - } - } - while (node = next.pop()) { - callback(node); - } - return this; - } - - function node_sum(value) { - return this.eachAfter(function(node) { - var sum = +value(node.data) || 0, - children = node.children, - i = children && children.length; - while (--i >= 0) sum += children[i].value; - node.value = sum; - }); - } - - function node_sort(compare) { - return this.eachBefore(function(node) { - if (node.children) { - node.children.sort(compare); - } - }); - } - - function node_path(end) { - var start = this, - ancestor = leastCommonAncestor(start, end), - nodes = [start]; - while (start !== ancestor) { - start = start.parent; - nodes.push(start); - } - var k = nodes.length; - while (end !== ancestor) { - nodes.splice(k, 0, end); - end = end.parent; - } - return nodes; - } - - function leastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = a.ancestors(), - bNodes = b.ancestors(), - c = null; - a = aNodes.pop(); - b = bNodes.pop(); - while (a === b) { - c = a; - a = aNodes.pop(); - b = bNodes.pop(); - } - return c; - } - - function node_ancestors() { - var node = this, nodes = [node]; - while (node = node.parent) { - nodes.push(node); - } - return nodes; - } - - function node_descendants() { - var nodes = []; - this.each(function(node) { - nodes.push(node); - }); - return nodes; - } - - function node_leaves() { - var leaves = []; - this.eachBefore(function(node) { - if (!node.children) { - leaves.push(node); - } - }); - return leaves; - } - - function node_links() { - var root = this, links = []; - root.each(function(node) { - if (node !== root) { // Don’t include the root’s parent, if any. - links.push({source: node.parent, target: node}); - } - }); - return links; - } - - function hierarchy(data, children) { - var root = new Node(data), - valued = +data.value && (root.value = data.value), - node, - nodes = [root], - child, - childs, - i, - n; - - if (children == null) children = defaultChildren; - - while (node = nodes.pop()) { - if (valued) node.value = +node.data.value; - if ((childs = children(node.data)) && (n = childs.length)) { - node.children = new Array(n); - for (i = n - 1; i >= 0; --i) { - nodes.push(child = node.children[i] = new Node(childs[i])); - child.parent = node; - child.depth = 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 = node.data.data; - } - - function computeHeight(node) { - var height = 0; - do node.height = height; - while ((node = node.parent) && (node.height < ++height)); - } - - function Node(data) { - this.data = data; - this.depth = - this.height = 0; - this.parent = null; - } - - Node.prototype = hierarchy.prototype = { - 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$1 = Array.prototype.slice; - - function shuffle(array) { - var m = array.length, - t, - i; - - while (m) { - i = Math.random() * m-- | 0; - t = array[m]; - array[m] = array[i]; - array[i] = t; - } - - return array; - } - - function enclose(circles) { - var i = 0, n = (circles = shuffle(slice$1.call(circles))).length, B = [], p, e; - - while (i < n) { - p = circles[i]; - if (e && enclosesWeak(e, p)) ++i; - else e = encloseBasis(B = extendBasis(B, p)), i = 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 = 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 = 0; i < B.length - 1; ++i) { - for (j = 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 = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y; - return dr < 0 || dr * dr < dx * dx + dy * dy; - } - - function enclosesWeak(a, b) { - var dr = a.r - b.r + 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; - } - - function enclosesWeakAll(a, B) { - for (var i = 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 = a.x, y1 = a.y, r1 = a.r, - x2 = b.x, y2 = b.y, r2 = b.r, - x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, - l = 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 = a.x, y1 = a.y, r1 = a.r, - x2 = b.x, y2 = b.y, r2 = b.r, - x3 = c.x, y3 = c.y, r3 = c.r, - a2 = x1 - x2, - a3 = x1 - x3, - b2 = y1 - y2, - b3 = y1 - y3, - c2 = r2 - r1, - c3 = r3 - r1, - d1 = x1 * x1 + y1 * y1 - r1 * r1, - d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, - d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, - ab = a3 * b2 - a2 * b3, - xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, - xb = (b3 * c2 - b2 * c3) / ab, - ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, - yb = (a2 * c3 - a3 * c2) / ab, - A = xb * xb + yb * yb - 1, - B = 2 * (r1 + xa * xb + ya * yb), - C = xa * xa + ya * ya - r1 * r1, - r = -(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 = b.x - a.x, x, a2, - dy = b.y - a.y, y, b2, - d2 = dx * dx + dy * dy; - if (d2) { - a2 = a.r + c.r, a2 *= a2; - b2 = b.r + c.r, b2 *= b2; - if (a2 > b2) { - x = (d2 + b2 - a2) / (2 * d2); - y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); - c.x = b.x - x * dx - y * dy; - c.y = b.y - x * dy + y * dx; - } else { - x = (d2 + a2 - b2) / (2 * d2); - y = Math.sqrt(Math.max(0, a2 / d2 - x * x)); - c.x = a.x + x * dx - y * dy; - c.y = a.y + x * dy + y * dx; - } - } else { - c.x = a.x + c.r; - c.y = a.y; - } - } - - function intersects(a, b) { - var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; - } - - function score(node) { - var a = node._, - b = node.next._, - ab = a.r + b.r, - dx = (a.x * b.r + b.x * a.r) / ab, - dy = (a.y * b.r + b.y * a.r) / ab; - return dx * dx + dy * dy; - } - - function Node$1(circle) { - this._ = circle; - this.next = null; - this.previous = null; - } - - function packEnclose(circles) { - if (!(n = circles.length)) return 0; - - var a, b, c, n, aa, ca, i, j, k, sj, sk; - - // Place the first circle. - a = circles[0], a.x = 0, a.y = 0; - if (!(n > 1)) return a.r; - - // Place the second circle. - b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; - if (!(n > 2)) return a.r + b.r; - - // Place the third circle. - place(b, a, c = circles[2]); - - // Initialize the front-chain using the first three circles a, b and c. - a = new Node$1(a), b = new Node$1(b), c = new Node$1(c); - a.next = c.previous = b; - b.next = a.previous = c; - c.next = b.previous = a; - - // Attempt to place each remaining circle… - pack: for (i = 3; i < n; ++i) { - place(a._, b._, c = circles[i]), c = new Node$1(c); - - // Find the closest intersecting circle on the front-chain, if any. - // “Closeness” is determined by linear distance along the front-chain. - // “Ahead” or “behind” is likewise determined by linear distance. - j = b.next, k = a.previous, sj = b._.r, sk = a._.r; - do { - if (sj <= sk) { - if (intersects(j._, c._)) { - b = j, a.next = b, b.previous = a, --i; - continue pack; - } - sj += j._.r, j = j.next; - } else { - if (intersects(k._, c._)) { - a = k, a.next = b, b.previous = a, --i; - continue pack; - } - sk += k._.r, k = k.previous; - } - } while (j !== k.next); - - // Success! Insert the new circle c between a and b. - c.previous = a, c.next = b, a.next = b.previous = b = c; - - // Compute the new closest circle pair to the centroid. - aa = score(a); - while ((c = c.next) !== b) { - if ((ca = score(c)) < aa) { - a = c, aa = ca; - } - } - b = a.next; - } - - // Compute the enclosing circle of the front chain. - a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a); - - // Translate the circles to put the enclosing circle around the origin. - for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y; - - return c.r; - } - - function optional(f) { - return f == null ? null : required(f); - } - - function required(f) { - if (typeof f !== "function") throw new Error; - return f; - } - - function constantZero() { - return 0; - } - - function constant$5(x) { - return function() { - return x; - }; - } - - function defaultRadius(d) { - return Math.sqrt(d.value); - } - - function pack() { - var radius = null, - dx = 1, - dy = 1, - padding = constantZero; - - function pack(root) { - root.x = dx / 2, root.y = dy / 2; - if (radius) { - root.eachBefore(radiusLeaf(radius)) - .eachAfter(packChildren(padding, 0.5)) - .eachBefore(translateChild(1)); - } else { - root.eachBefore(radiusLeaf(defaultRadius)) - .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 = function(x) { - return arguments.length ? (radius = optional(x), pack) : radius; - }; - - pack.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy]; - }; - - pack.padding = function(x) { - return arguments.length ? (padding = typeof x === "function" ? x : constant$5(+x), pack) : padding; - }; - - return pack; - } - - function radiusLeaf(radius) { - return function(node) { - if (!node.children) { - node.r = Math.max(0, +radius(node) || 0); - } - }; - } - - function packChildren(padding, k) { - return function(node) { - if (children = node.children) { - var children, - i, - n = children.length, - r = padding(node) * k || 0, - e; - - if (r) for (i = 0; i < n; ++i) children[i].r += r; - e = packEnclose(children); - if (r) for (i = 0; i < n; ++i) children[i].r -= r; - node.r = e + r; - } - }; - } - - function translateChild(k) { - return function(node) { - var parent = node.parent; - node.r *= k; - if (parent) { - node.x = parent.x + k * node.x; - node.y = parent.y + k * node.y; - } - }; - } - - function roundNode(node) { - node.x0 = Math.round(node.x0); - node.y0 = Math.round(node.y0); - node.x1 = Math.round(node.x1); - node.y1 = Math.round(node.y1); - } - - function treemapDice(parent, x0, y0, x1, y1) { - var nodes = parent.children, - node, - i = -1, - n = nodes.length, - k = parent.value && (x1 - x0) / parent.value; - - while (++i < n) { - node = nodes[i], node.y0 = y0, node.y1 = y1; - node.x0 = x0, node.x1 = x0 += node.value * k; - } - } - - function partition$4() { - var dx = 1, - dy = 1, - padding = 0, - round = false; - - function partition(root) { - var n = root.height + 1; - root.x0 = - root.y0 = padding; - root.x1 = dx; - root.y1 = 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 = node.x0, - y0 = node.y0, - x1 = node.x1 - padding, - y1 = node.y1 - padding; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - }; - } - - partition.round = function(x) { - return arguments.length ? (round = !!x, partition) : round; - }; - - partition.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy]; - }; - - partition.padding = function(x) { - return arguments.length ? (padding = +x, partition) : padding; - }; - - return partition; - } - - var keyPrefix = "$", // Protect against keys like “__proto__”. - preroot = {depth: -1}, - ambiguous = {}; - - function defaultId(d) { - return d.id; - } - - function defaultParentId(d) { - return d.parentId; - } - - function stratify() { - var id = defaultId, - parentId = defaultParentId; - - function stratify(data) { - var d, - i, - n = data.length, - root, - parent, - node, - nodes = new Array(n), - nodeId, - nodeKey, - nodeByKey = {}; - - for (i = 0; i < n; ++i) { - d = data[i], node = nodes[i] = new Node(d); - if ((nodeId = id(d, i, data)) != null && (nodeId += "")) { - nodeKey = keyPrefix + (node.id = nodeId); - nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node; - } - } - - for (i = 0; i < n; ++i) { - node = nodes[i], nodeId = parentId(data[i], i, data); - if (nodeId == null || !(nodeId += "")) { - if (root) throw new Error("multiple roots"); - root = node; - } else { - parent = nodeByKey[keyPrefix + nodeId]; - if (!parent) throw new Error("missing: " + nodeId); - if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); - if (parent.children) parent.children.push(node); - else parent.children = [node]; - node.parent = parent; - } - } - - if (!root) throw new Error("no root"); - root.parent = preroot; - root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight); - root.parent = null; - if (n > 0) throw new Error("cycle"); - - return root; - } - - stratify.id = function(x) { - return arguments.length ? (id = required(x), stratify) : id; - }; - - stratify.parentId = function(x) { - return arguments.length ? (parentId = required(x), stratify) : parentId; - }; - - return stratify; - } - - function defaultSeparation$1(a, b) { - return a.parent === b.parent ? 1 : 2; - } - - // function radialSeparation(a, b) { - // return (a.parent === 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 successor is - // either given by the leftmost child of v or by the thread of v. The function - // returns null if and only if v is on the highest level of its subtree. - function nextLeft(v) { - var children = v.children; - return children ? children[0] : v.t; - } - - // This function works analogously to nextLeft. - function nextRight(v) { - var children = 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 = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.m += 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 = 0, - change = 0, - children = v.children, - i = children.length, - w; - while (--i >= 0) { - w = children[i]; - w.z += shift; - w.m += shift; - shift += w.s + (change += w.c); - } - } - - // If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, - // returns the specified (default) ancestor. - function nextAncestor(vim, v, ancestor) { - return vim.a.parent === v.parent ? vim.a : ancestor; - } - - function TreeNode(node, i) { - this._ = node; - this.parent = null; - this.children = null; - this.A = null; // default ancestor - this.a = this; // ancestor - this.z = 0; // prelim - this.m = 0; // mod - this.c = 0; // change - this.s = 0; // shift - this.t = null; // thread - this.i = i; // number - } - - TreeNode.prototype = Object.create(Node.prototype); - - function treeRoot(root) { - var tree = new TreeNode(root, 0), - node, - nodes = [tree], - child, - children, - i, - n; - - while (node = nodes.pop()) { - if (children = node._.children) { - node.children = new Array(n = children.length); - for (i = n - 1; i >= 0; --i) { - nodes.push(child = node.children[i] = new TreeNode(children[i], i)); - child.parent = node; - } - } - } - - (tree.parent = new TreeNode(null, 0)).children = [tree]; - return tree; - } - - // Node-link tree diagram using the Reingold-Tilford "tidy" algorithm - function tree() { - var separation = defaultSeparation$1, - dx = 1, - dy = 1, - nodeSize = null; - - function tree(root) { - var t = treeRoot(root); - - // Compute the layout using Buchheim et al.’s algorithm. - t.eachAfter(firstWalk), t.parent.m = -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 = root, - right = root, - bottom = root; - root.eachBefore(function(node) { - if (node.x < left.x) left = node; - if (node.x > right.x) right = node; - if (node.depth > bottom.depth) bottom = node; - }); - var s = left === right ? 1 : separation(left, right) / 2, - tx = s - left.x, - kx = dx / (right.x + s + tx), - ky = dy / (bottom.depth || 1); - root.eachBefore(function(node) { - node.x = (node.x + tx) * kx; - node.y = 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, the - // node v is placed to the midpoint of its outermost children. - function firstWalk(v) { - var children = v.children, - siblings = v.parent.children, - w = v.i ? siblings[v.i - 1] : null; - if (children) { - executeShifts(v); - var midpoint = (children[0].z + children[children.length - 1].z) / 2; - if (w) { - v.z = w.z + separation(v._, w._); - v.m = v.z - midpoint; - } else { - v.z = midpoint; - } - } else if (w) { - v.z = w.z + separation(v._, w._); - } - v.parent.A = apportion(v, w, v.parent.A || siblings[0]); - } - - // Computes all real x-coordinates by summing up the modifiers recursively. - function secondWalk(v) { - v._.x = v.z + v.parent.m; - v.m += 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 subtrees. - // Finally, we add a new thread (if necessary). - function apportion(v, w, ancestor) { - if (w) { - var vip = v, - vop = v, - vim = w, - vom = vip.parent.children[0], - sip = vip.m, - sop = vop.m, - sim = vim.m, - som = vom.m, - shift; - while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { - vom = nextLeft(vom); - vop = nextRight(vop); - vop.a = v; - shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); - if (shift > 0) { - moveSubtree(nextAncestor(vim, v, ancestor), v, shift); - sip += shift; - sop += shift; - } - sim += vim.m; - sip += vip.m; - som += vom.m; - sop += vop.m; - } - if (vim && !nextRight(vop)) { - vop.t = vim; - vop.m += sim - sop; - } - if (vip && !nextLeft(vom)) { - vom.t = vip; - vom.m += sip - som; - ancestor = v; - } - } - return ancestor; - } - - function sizeNode(node) { - node.x *= dx; - node.y = node.depth * dy; - } - - tree.separation = function(x) { - return arguments.length ? (separation = x, tree) : separation; - }; - - tree.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]); - }; - - tree.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null); - }; - - return tree; - } - - function treemapSlice(parent, x0, y0, x1, y1) { - var nodes = parent.children, - node, - i = -1, - n = nodes.length, - k = parent.value && (y1 - y0) / parent.value; - - while (++i < n) { - node = nodes[i], node.x0 = x0, node.x1 = x1; - node.y0 = y0, node.y1 = y0 += node.value * k; - } - } - - var phi = (1 + Math.sqrt(5)) / 2; - - function squarifyRatio(ratio, parent, x0, y0, x1, y1) { - var rows = [], - nodes = parent.children, - row, - nodeValue, - i0 = 0, - i1 = 0, - n = nodes.length, - dx, dy, - value = parent.value, - sumValue, - minValue, - maxValue, - newRatio, - minRatio, - alpha, - beta; - - while (i0 < n) { - dx = x1 - x0, dy = y1 - y0; - - // Find the next non-empty node. - do sumValue = nodes[i1++].value; while (!sumValue && i1 < n); - minValue = maxValue = sumValue; - alpha = Math.max(dy / dx, dx / dy) / (value * ratio); - beta = sumValue * sumValue * alpha; - minRatio = Math.max(maxValue / beta, beta / minValue); - - // Keep adding nodes while the aspect ratio maintains or improves. - for (; i1 < n; ++i1) { - sumValue += nodeValue = nodes[i1].value; - if (nodeValue < minValue) minValue = nodeValue; - if (nodeValue > maxValue) maxValue = nodeValue; - beta = sumValue * sumValue * alpha; - newRatio = Math.max(maxValue / beta, beta / minValue); - if (newRatio > minRatio) { sumValue -= nodeValue; break; } - minRatio = newRatio; - } - - // Position and record the row orientation. - rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)}); - if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); - else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); - value -= sumValue, i0 = i1; - } - - return rows; - } - - var treemapSquarify = (function custom(ratio) { - - function squarify(parent, x0, y0, x1, y1) { - squarifyRatio(ratio, parent, x0, y0, x1, y1); - } - - squarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - - return squarify; - })(phi); - - function treemap() { - var tile = treemapSquarify, - round = false, - dx = 1, - dy = 1, - paddingStack = [0], - paddingInner = constantZero, - paddingTop = constantZero, - paddingRight = constantZero, - paddingBottom = constantZero, - paddingLeft = constantZero; - - function treemap(root) { - root.x0 = - root.y0 = 0; - root.x1 = dx; - root.y1 = dy; - root.eachBefore(positionNode); - paddingStack = [0]; - if (round) root.eachBefore(roundNode); - return root; - } - - function positionNode(node) { - var p = paddingStack[node.depth], - x0 = node.x0 + p, - y0 = node.y0 + p, - x1 = node.x1 - p, - y1 = node.y1 - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - if (node.children) { - p = paddingStack[node.depth + 1] = paddingInner(node) / 2; - x0 += paddingLeft(node) - p; - y0 += paddingTop(node) - p; - x1 -= paddingRight(node) - p; - y1 -= paddingBottom(node) - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - tile(node, x0, y0, x1, y1); - } - } - - treemap.round = function(x) { - return arguments.length ? (round = !!x, treemap) : round; - }; - - treemap.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy]; - }; - - treemap.tile = function(x) { - return arguments.length ? (tile = required(x), treemap) : tile; - }; - - treemap.padding = function(x) { - return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); - }; - - treemap.paddingInner = function(x) { - return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$5(+x), treemap) : paddingInner; - }; - - treemap.paddingOuter = function(x) { - return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); - }; - - treemap.paddingTop = function(x) { - return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$5(+x), treemap) : paddingTop; - }; - - treemap.paddingRight = function(x) { - return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$5(+x), treemap) : paddingRight; - }; - - treemap.paddingBottom = function(x) { - return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$5(+x), treemap) : paddingBottom; - }; - - treemap.paddingLeft = function(x) { - return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$5(+x), treemap) : paddingLeft; - }; - - return treemap; - } - - function treemapBinary(parent, x0, y0, x1, y1) { - var nodes = parent.children, - i, n = nodes.length, - sum, sums = new Array(n + 1); - - for (sums[0] = sum = i = 0; i < n; ++i) { - sums[i + 1] = sum += nodes[i].value; - } - - partition(0, n, parent.value, x0, y0, x1, y1); - - function partition(i, j, value, x0, y0, x1, y1) { - if (i >= j - 1) { - var node = nodes[i]; - node.x0 = x0, node.y0 = y0; - node.x1 = x1, node.y1 = y1; - return; - } - - var valueOffset = sums[i], - valueTarget = (value / 2) + valueOffset, - k = i + 1, - hi = j - 1; - - while (k < hi) { - var mid = k + hi >>> 1; - if (sums[mid] < valueTarget) k = mid + 1; - else hi = mid; - } - - if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k; - - var valueLeft = sums[k] - valueOffset, - valueRight = value - valueLeft; - - if ((x1 - x0) > (y1 - y0)) { - var xk = (x0 * valueRight + x1 * valueLeft) / value; - partition(i, k, valueLeft, x0, y0, xk, y1); - partition(k, j, valueRight, xk, y0, x1, y1); - } else { - var yk = (y0 * valueRight + y1 * valueLeft) / value; - partition(i, k, valueLeft, x0, y0, x1, yk); - partition(k, j, valueRight, x0, yk, x1, y1); - } - } - } - - function treemapSliceDice(parent, x0, y0, x1, y1) { - (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1); - } - - var treemapResquarify = (function custom(ratio) { - - function resquarify(parent, x0, y0, x1, y1) { - if ((rows = parent._squarify) && (rows.ratio === ratio)) { - var rows, - row, - nodes, - i, - j = -1, - n, - m = rows.length, - value = parent.value; - - while (++j < m) { - row = rows[j], nodes = row.children; - for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; - if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value); - else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1); - value -= row.value; - } - } else { - parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1); - rows.ratio = ratio; - } - } - - resquarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - - return resquarify; - })(phi); - - /** - * Nest tuples into a tree structure, grouped by key values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ - function Nest(params) { - Transform.call(this, null, params); - } - - Nest.Definition = { - 'type': 'Nest', - 'metadata': {'treesource': true, 'changes': true}, - 'params': [ - { 'name': 'keys', 'type': 'field', 'array': true }, - { 'name': 'generate', 'type': 'boolean' } - ] - }; - - var prototype$1e = inherits(Nest, Transform); - - function children(n) { - return n.values; - } - - prototype$1e.transform = function(_, pulse) { - if (!pulse.source) { - error('Nest transform requires an upstream data source.'); - } - - var gen = _.generate, - mod = _.modified(), - out = pulse.clone(), - tree = this.value; - - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) { - tree.each(node => { - if (node.children && isTuple(node.data)) { - out.rem.push(node.data); - } - }); - } - - // generate new tree structure - this.value = tree = hierarchy({ - values: array(_.keys) - .reduce((n, k) => { n.key(k); return n; }, nest()) - .entries(out.source) - }, children); - - // collect nodes to add - if (gen) { - tree.each(node => { - if (node.children) { - node = ingest(node.data); - out.add.push(node); - out.source.push(node); - } - }); - } - - // build lookup table - lookup$3(tree, tupleid, tupleid); - } - - out.source.root = tree; - return out; - }; - - function nest() { - var keys = [], - nest; - - function apply(array, depth) { - if (depth >= keys.length) { - return array; - } - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - value, - valuesByKey = {}, - values, - result = {}; - - while (++i < n) { - keyValue = key(value = array[i]) + ''; - if (values = valuesByKey[keyValue]) { - values.push(value); - } else { - valuesByKey[keyValue] = [value]; - } - } - - for (keyValue in valuesByKey) { - result[keyValue] = apply(valuesByKey[keyValue], depth); - } - - return result; - } - - function entries(map, depth) { - if (++depth > keys.length) return map; - var array = [], k; - for (k in map) { - array.push({key: k, values: entries(map[k], depth)}); - } - return array; - } - - return nest = { - entries: array => entries(apply(array, 0), 0), - key: d => { keys.push(d); return nest; } - }; - } - - /** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ - function HierarchyLayout(params) { - Transform.call(this, null, params); - } - - var prototype$1f = inherits(HierarchyLayout, Transform); - - prototype$1f.transform = function(_, pulse) { - if (!pulse.source || !pulse.source.root) { - error(this.constructor.name - + ' transform requires a backing tree data source.'); - } - - var layout = this.layout(_.method), - fields = this.fields, - root = pulse.source.root, - as = _.as || fields; - - if (_.field) root.sum(_.field); else root.count(); - if (_.sort) root.sort(stableCompare(_.sort, d => d.data)); - - setParams(layout, this.params, _); - if (layout.separation) { - layout.separation(_.separation !== false ? defaultSeparation$2 : one); - } - - try { - this.value = layout(root); - } catch (err) { - error(err); - } - root.each(function(node) { setFields(node, fields, as); }); - - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); - }; - - function setParams(layout, params, _) { - for (var p, i=0, n=params.length; i} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ - function Loess(params) { - Transform.call(this, null, params); - } - - Loess.Definition = { - 'type': 'Loess', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'bandwidth', 'type': 'number', 'default': 0.3 }, - { 'name': 'as', 'type': 'string', 'array': true } - ] - }; - - var prototype$1m = inherits(Loess, Transform); - - prototype$1m.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition$5(source, _.groupby), - names = (_.groupby || []).map(accessorName), - m = names.length, - as = _.as || [accessorName(_.x), accessorName(_.y)], - values = []; - - groups.forEach(g => { - regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(p => { - const t = {}; - for (let i=0; i} [params.groupby] - An array of accessors to groupby. - * @param {Array} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ - function Regression(params) { - Transform.call(this, null, params); - } - - Regression.Definition = { - 'type': 'Regression', - 'metadata': {'generates': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'groupby', 'type': 'field', 'array': true }, - { 'name': 'method', 'type': 'string', 'default': 'linear', 'values': Object.keys(Methods$1) }, - { 'name': 'order', 'type': 'number', 'default': 3 }, - { 'name': 'extent', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'params', 'type': 'boolean', 'default': false }, - { 'name': 'as', 'type': 'string', 'array': true } - ] - }; - - var prototype$1n = inherits(Regression, Transform); - - prototype$1n.transform = function(_, pulse) { - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, - groups = partition$5(source, _.groupby), - names = (_.groupby || []).map(accessorName), - method = _.method || 'linear', - order = _.order || 3, - dof = degreesOfFreedom(method, order), - as = _.as || [accessorName(_.x), accessorName(_.y)], - fit = Methods$1[method], - values = []; - - let domain = _.extent; - - if (!hasOwnProperty(Methods$1, method)) { - error('Invalid regression method: ' + method); - } - - if (domain != null) { - if (method === 'log' && domain[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - domain = null; - } - } - - groups.forEach(g => { - const n = g.length; - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - - const model = fit(g, _.x, _.y, order); - - if (_.params) { - // if parameter vectors requested return those - values.push(ingest({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - return; - } - - const dom = domain || extent(g, _.x), - add = p => { - const t = {}; - for (let i=0; i add([x, model.predict(x)])); - } else { - // otherwise return trend line sample points - sampleCurve(model.predict, dom, 25, 200).forEach(add); - } - }); - - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - - return out; - }; - - var reg = /*#__PURE__*/Object.freeze({ - __proto__: null, - loess: Loess, - regression: Regression - }); - - const EPSILON$2 = Math.pow(2, -52); - const EDGE_STACK = new Uint32Array(512); - - class Delaunator { - - static from(points, getX = defaultGetX, getY = defaultGetY) { - const n = points.length; - const coords = new Float64Array(n * 2); - - for (let i = 0; i < n; i++) { - const p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - - return new Delaunator(coords); - } - - constructor(coords) { - const n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - - this.coords = coords; - - // arrays that will store the triangulation graph - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash - - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - - this.update(); - } - - update() { - const {coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash} = this; - const n = coords.length >> 1; - - // populate an array of point indices; calculate input data bbox - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - - for (let i = 0; i < n; i++) { - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - - let minDist = Infinity; - let i0, i1, i2; - - // pick a seed point close to the center - for (let i = 0; i < n; i++) { - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } - } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - - minDist = Infinity; - - // find the point closest to the seed - for (let i = 0; i < n; i++) { - if (i === i0) continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } - } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - - let minRadius = Infinity; - - // find the third point which forms the smallest circumcircle with the first two - for (let i = 0; i < n; i++) { - if (i === i0 || i === i1) continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } - } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for (let i = 0; i < n; i++) { - this._dists[i] = (coords[2 * i] - coords[0]) || (coords[2 * i + 1] - coords[1]); - } - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for (let i = 0, d0 = -Infinity; i < n; i++) { - const id = this._ids[i]; - if (this._dists[id] > d0) { - hull[j++] = id; - d0 = this._dists[id]; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } - - // swap the order of the seed points for counter-clockwise orientation - if (orient(i0x, i0y, i1x, i1y, i2x, i2y)) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - - for (let i = 0; i < n; i++) { - this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - } - - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - - // set up the seed triangle as the starting hull - this._hullStart = i0; - let hullSize = 3; - - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - - for (let k = 0, xp, yp; k < this._ids.length; k++) { - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - - // skip near-duplicate points - if (k > 0 && Math.abs(x - xp) <= EPSILON$2 && Math.abs(y - yp) <= EPSILON$2) continue; - xp = x; - yp = y; - - // skip seed triangle points - if (i === i0 || i === i1 || i === i2) continue; - - // find a visible edge on the convex hull using edge hash - let start = 0; - for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) { - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - - start = hullPrev[start]; - let e = start, q; - while (q = hullNext[e], !orient(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) { - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) continue; // likely a near-duplicate point; skip it - - // add the first triangle from the point - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - - // walk forward through the hull, adding more triangles and flipping recursively - let n = hullNext[e]; - while (q = hullNext[n], orient(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1])) { - t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]); - hullTri[i] = this._legalize(t + 2); - hullNext[n] = n; // mark as removed - hullSize--; - n = q; - } - - // walk backward from the other side, adding more triangles and flipping - if (e === start) { - while (q = hullPrev[e], orient(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) { - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - } - - // update the hull indices - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n] = i; - hullNext[i] = n; - - // save the two new edges in the hash table - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - - this.hull = new Uint32Array(hullSize); - for (let i = 0, e = this._hullStart; i < hullSize; i++) { - this.hull[i] = e; - e = hullNext[e]; - } - - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - - _legalize(a) { - const {_triangles: triangles, _halfedges: halfedges, coords} = this; - - let i = 0; - let ar = 0; - - // recursion eliminated with a fixed-size stack - while (true) { - const b = halfedges[a]; - - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ - const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - - if (b === -1) { // convex hull edge - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - - const illegal = inCircle( - coords[2 * p0], coords[2 * p0 + 1], - coords[2 * pr], coords[2 * pr + 1], - coords[2 * pl], coords[2 * pl + 1], - coords[2 * p1], coords[2 * p1 + 1]); - - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - - const hbl = halfedges[bl]; - - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - - const br = b0 + (b + 1) % 3; - - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = br; - } - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - - return ar; - } - - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } - - // add a new triangle given vertex indices and adjacent half-edge ids - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - - this.trianglesLen += 3; - - return t; - } - } - - // monotonically increases with real angle, but doesn't need expensive trigonometry - function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] - } - - function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; - } - - // return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check - function orientIfSure(px, py, rx, ry, qx, qy) { - const l = (ry - py) * (qx - px); - const r = (rx - px) * (qy - py); - return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0; - } - - // a more robust orientation test that's stable in a given triangle (to fix robustness issues) - function orient(rx, ry, qx, qy, px, py) { - const sign = orientIfSure(px, py, rx, ry, qx, qy) || - orientIfSure(rx, ry, qx, qy, px, py) || - orientIfSure(qx, qy, px, py, rx, ry); - return sign < 0; - } - - function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - - return dx * (ey * cp - bp * fy) - - dy * (ex * cp - bp * fx) + - ap * (ex * fy - ey * fx) < 0; - } - - function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - - return x * x + y * y; - } - - function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - - return {x, y}; - } - - function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (let i = left + 1; i <= right; i++) { - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; - ids[j + 1] = temp; - } - } else { - const median = (left + right) >> 1; - let i = left + 1; - let j = right; - swap$1(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) swap$1(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) swap$1(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) swap$1(ids, left, i); - - const temp = ids[i]; - const tempDist = dists[temp]; - while (true) { - do i++; while (dists[ids[i]] < tempDist); - do j--; while (dists[ids[j]] > tempDist); - if (j < i) break; - swap$1(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); - } - } - } - - function swap$1(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; - } - - function defaultGetX(p) { - return p[0]; - } - function defaultGetY(p) { - return p[1]; - } - - const epsilon$5 = 1e-6; - - class Path$1 { - constructor() { - this._x0 = this._y0 = // start of current subpath - this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; - } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; - } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon$5 || Math.abs(this._y1 - y0) > epsilon$5) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; - } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; - } - value() { - return this._ || null; - } - } - - class Polygon { - constructor() { - this._ = []; - } - moveTo(x, y) { - this._.push([x, y]); - } - closePath() { - this._.push(this._[0].slice()); - } - lineTo(x, y) { - this._.push([x, y]); - } - value() { - return this._.length ? this._ : null; - } - } - - class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); - } - update() { - this.delaunay.update(); - this._init(); - return this; - } - _init() { - const {delaunay: {points, hull, triangles}, vectors} = this; - - // Compute circumcenters. - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for (let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2) { - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x1 = points[t1]; - const y1 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - - const dx = x2 - x1; - const dy = y2 - y1; - const ex = x3 - x1; - const ey = y3 - y1; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const ab = (dx * ey - dy * ex) * 2; - - if (!ab) { - // degenerate case (collinear diagram) - x = (x1 + x3) / 2 - 1e8 * ey; - y = (y1 + y3) / 2 + 1e8 * ex; - } - else if (Math.abs(ab) < 1e-8) { - // almost equal points (degenerate triangle) - x = (x1 + x3) / 2; - y = (y1 + y3) / 2; - } else { - const d = 1 / ab; - x = x1 + (ey * bl - dy * cl) * d; - y = y1 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - - // Compute exterior cell rays. - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for (let i = 0; i < hull.length; ++i) { - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new Path$1 : undefined; - const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this; - if (hull.length <= 1) return null; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for (let i = 0; i < hull.length; ++i) { - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new Path$1 : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new Path$1 : undefined; - const points = this._clip(i); - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - let n = points.length; - while (points[0] === points[n-2] && points[1] === points[n-1] && n > 1) n -= 2; - for (let i = 2; i < n; i += 2) { - if (points[i] !== points[i-2] || points[i+1] !== points[i-1]) - context.lineTo(points[i], points[i + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - *cellPolygons() { - const {delaunay: {points}} = this; - for (let i = 0, n = points.length / 2; i < n; ++i) { - const cell = this.cellPolygon(i); - if (cell) cell.index = i, yield cell; - } - } - cellPolygon(i) { - const polygon = new Polygon; - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } - } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; - } - *neighbors(i) { - const ci = this._clip(i); - if (ci) for (const j of this.delaunay.neighbors(i)) { - const cj = this._clip(j); - // find the common edge - if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { - for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { - if (ci[ai] == cj[aj] - && ci[ai + 1] == cj[aj + 1] - && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] - && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj] - ) { - yield j; - break loop; - } - } - } - } - } - _cell(i) { - const {circumcenters, delaunay: {inedges, halfedges, triangles}} = this; - const e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - } while (e !== e0 && e !== -1); - return points; - } - _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - const points = this._cell(i); - if (points === null) return null; - const {vectors: V} = this; - const v = i * 4; - return V[v] || V[v + 1] - ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) - : this._clipFinite(i, points); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1; - for (let j = 0; j < n; j += 2) { - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1); - else P = [x1, y1]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0); - else P = [sx0, sy0]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1); - else P = [sx1, sy1]; - } - } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - while (true) { - if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1]; - if (c0 & c1) return null; - let x, y, c = c0 || c1; - if (c & 0b1000) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 0b0100) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 0b0010) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) { - for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; - } - return P; - } - _edge(i, e0, e1, P, j) { - while (e0 !== e1) { - let x, y; - switch (e0) { - case 0b0101: e0 = 0b0100; continue; // top-left - case 0b0100: e0 = 0b0110, x = this.xmax, y = this.ymin; break; // top - case 0b0110: e0 = 0b0010; continue; // top-right - case 0b0010: e0 = 0b1010, x = this.xmax, y = this.ymax; break; // right - case 0b1010: e0 = 0b1000; continue; // bottom-right - case 0b1000: e0 = 0b1001, x = this.xmin, y = this.ymax; break; // bottom - case 0b1001: e0 = 0b0001; continue; // bottom-left - case 0b0001: e0 = 0b0101, x = this.xmin, y = this.ymin; break; // left - } - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) { - P.splice(j, 0, x, y), j += 2; - } - } - if (P.length > 4) { - for (let i = 0; i < P.length; i+= 2) { - const j = (i + 2) % P.length, k = (i + 4) % P.length; - if (P[i] === P[j] && P[j] === P[k] - || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) - P.splice(j, 2), i -= 2; - } - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { // top - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { // bottom - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { // right - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { // left - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - return [x, y]; - } - _edgecode(x, y) { - return (x === this.xmin ? 0b0001 - : x === this.xmax ? 0b0010 : 0b0000) - | (y === this.ymin ? 0b0100 - : y === this.ymax ? 0b1000 : 0b0000); - } - _regioncode(x, y) { - return (x < this.xmin ? 0b0001 - : x > this.xmax ? 0b0010 : 0b0000) - | (y < this.ymin ? 0b0100 - : y > this.ymax ? 0b1000 : 0b0000); - } - } - - const tau$3 = 2 * Math.PI, pow$3 = Math.pow; - - function pointX(p) { - return p[0]; - } - - function pointY(p) { - return p[1]; - } - - // A triangulation is collinear if all its triangles have a non-null area - function collinear$1(d) { - const {triangles, coords} = d; - for (let i = 0; i < triangles.length; i += 3) { - const a = 2 * triangles[i], - b = 2 * triangles[i + 1], - c = 2 * triangles[i + 2], - cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1]) - - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]); - if (cross > 1e-10) return false; - } - return true; - } - - function jitter(x, y, r) { - return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r]; - } - - class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points - ? flatArray(points, fx, fy, that) - : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points) { - this._delaunator = new Delaunator(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); - } - update() { - this._delaunator.update(); - this._init(); - return this; - } - _init() { - const d = this._delaunator, points = this.points; - - // check for collinear - if (d.hull && d.hull.length > 2 && collinear$1(d)) { - this.collinear = Int32Array.from({length: points.length/2}, (_,i) => i) - .sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], - bounds = [ points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1] ], - r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for (let i = 0, n = points.length / 2; i < n; ++i) { - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new Delaunator(points); - } else { - delete this.collinear; - } - - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - - // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - for (let e = 0, n = halfedges.length; e < n; ++e) { - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; - } - for (let i = 0, n = hull.length; i < n; ++i) { - hullIndex[hull[i]] = i; - } - - // degenerate case: 1 or 2 (distinct) points - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - inedges[hull[0]] = 1; - if (hull.length === 2) inedges[hull[1]] = 0; - } - } - voronoi(bounds) { - return new Voronoi(this, bounds); - } - *neighbors(i) { - const {inedges, hull, _hullIndex, halfedges, triangles, collinear} = this; - - // degenerate case with several collinear points - if (collinear) { - const l = collinear.indexOf(i); - if (l > 0) yield collinear[l - 1]; - if (l < collinear.length - 1) yield collinear[l + 1]; - return; - } - - const e0 = inedges[i]; - if (e0 === -1) return; // coincident point - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) return; // bad triangulation - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) yield p; - return; - } - } while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - const i0 = i; - let c; - while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) i = c; - return c; - } - _step(i, x, y) { - const {inedges, hull, _hullIndex, halfedges, triangles, points} = this; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow$3(x - points[i * 2], 2) + pow$3(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow$3(x - points[t * 2], 2) + pow$3(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow$3(x - points[e * 2], 2) + pow$3(y - points[e * 2 + 1], 2) < dc) return e; - } - break; - } - } while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new Path$1 : undefined; - const {points, halfedges, triangles} = this; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r = 2) { - const buffer = context == null ? context = new Path$1 : undefined; - const {points} = this; - for (let i = 0, n = points.length; i < n; i += 2) { - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau$3); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new Path$1 : undefined; - const {hull, points} = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for (let i = 1; i < n; ++i) { - const h = 2 * hull[i]; - context.lineTo(points[h], points[h + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - hullPolygon() { - const polygon = new Polygon; - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new Path$1 : undefined; - const {points, triangles} = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); - } - *trianglePolygons() { - const {triangles} = this; - for (let i = 0, n = triangles.length / 3; i < n; ++i) { - yield this.trianglePolygon(i); - } - } - trianglePolygon(i) { - const polygon = new Polygon; - this.renderTriangle(i, polygon); - return polygon.value(); - } - } - - function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for (let i = 0; i < n; ++i) { - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; - } - - function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points) { - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; - } - } - - function Voronoi$1(params) { - Transform.call(this, null, params); - } - - Voronoi$1.Definition = { - 'type': 'Voronoi', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'x', 'type': 'field', 'required': true }, - { 'name': 'y', 'type': 'field', 'required': true }, - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'extent', 'type': 'array', 'array': true, 'length': 2, - 'default': [[-1e5, -1e5], [1e5, 1e5]], - 'content': {'type': 'number', 'array': true, 'length': 2} }, - { 'name': 'as', 'type': 'string', 'default': 'path' } - ] - }; - - const prototype$1o = inherits(Voronoi$1, Transform); - - const defaultExtent = [-1e5, -1e5, 1e5, 1e5]; - - prototype$1o.transform = function(_, pulse) { - const as = _.as || 'path', - data = pulse.source; - - // nothing to do if no data - if (!data || !data.length) return pulse; - - // configure and construct voronoi diagram - let s = _.size; - s = s ? [0, 0, s[0], s[1]] - : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] - : defaultExtent; - - const voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s); - - // map polygons to paths - for (let i=0, n=data.length; i> 5, - ch = 1 << 11; - - function cloud() { - var size = [256, 256], - text, - font, - fontSize, - fontStyle, - fontWeight, - rotate, - padding, - spiral = archimedeanSpiral, - words = [], - random = Math.random, - cloud = {}; - - cloud.layout = function() { - var contextAndRatio = getContext(domCanvas()), - board = zeroArray((size[0] >> 5) * size[1]), - bounds = null, - n = words.length, - i = -1, - tags = [], - data = words.map(function(d) { - return { - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - }; - }).sort(function(a, b) { return b.size - a.size; }); - - while (++i < n) { - var d = data[i]; - d.x = (size[0] * (random() + .5)) >> 1; - d.y = (size[1] * (random() + .5)) >> 1; - cloudSprite(contextAndRatio, d, data, i); - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d); - else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}]; - // Temporary hack - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - - return tags; - }; - - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - - return {context: context, ratio: ratio}; - } - - function place(board, tag, bounds) { - var startX = tag.x, - startY = tag.y, - maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), - s = spiral(size), - dt = random() < .5 ? 1 : -1, - t = -dt, - dxdy, - dx, - dy; - - while (dxdy = s(t += dt)) { - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - - tag.x = startX + dx; - tag.y = startY + dy; - - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || - tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; - // TODO only check for collisions within current bounds. - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, - w = tag.width >> 5, - sw = size[0] >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - } - x += sw; - } - tag.sprite = null; - return true; - } - } - } - return false; - } - - cloud.words = function(_) { - if (arguments.length) { - words = _; - return cloud; - } else { - return words; - } - }; - - cloud.size = function(_) { - if (arguments.length) { - size = [+_[0], +_[1]]; - return cloud; - } else { - return size; - } - }; - - cloud.font = function(_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else { - return font; - } - }; - - cloud.fontStyle = function(_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else { - return fontStyle; - } - }; - - cloud.fontWeight = function(_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else { - return fontWeight; - } - }; - - cloud.rotate = function(_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else { - return rotate; - } - }; - - cloud.text = function(_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else { - return text; - } - }; - - cloud.spiral = function(_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else { - return spiral; - } - }; - - cloud.fontSize = function(_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else { - return fontSize; - } - }; - - cloud.padding = function(_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else { - return padding; - } - }; - - cloud.random = function(_) { - if (arguments.length) { - random = _; - return cloud; - } else { - return random; - } - }; - - return cloud; - } - - // Fetches a monochrome sprite bitmap for the specified text. - // Load in batches for speed. - function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, - ratio = contextAndRatio.ratio; - - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, - y = 0, - maxh = 0, - n = data.length, - w, w32, h, i, j; - --di; - while (++di < n) { - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), - cr = Math.cos(d.rotate * cloudRadians), - wcr = w * cr, - wsr = w * sr, - hcr = h * cr, - hsr = h * sr; - w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else { - w = (w + 0x1f) >> 5 << 5; - } - if (h > maxh) maxh = h; - if (x + w >= (cw << 5)) { - x = 0; - y += maxh; - maxh = 0; - } - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, - sprite = []; - while (--di >= 0) { - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; - // Zero the buffer - for (i = 0; i < h * w32; i++) sprite[i] = 0; - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, - seenRow = -1; - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - var k = w32 * j + (i >> 5), - m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0; - sprite[k] |= m; - seen |= m; - } - if (seen) seenRow = j; - else { - d.y0++; - h--; - j--; - y++; - } - } - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); - } - } - - // Use mask-based collision detection. - function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, - w = tag.width >> 5, - lx = tag.x - (w << 4), - sx = lx & 0x7f, - msx = 32 - sx, - h = tag.y1 - tag.y0, - x = (tag.y + tag.y0) * sw + (lx >> 5), - last; - for (var j = 0; j < h; j++) { - last = 0; - for (var i = 0; i <= w; i++) { - if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) - & board[x + i]) return true; - } - x += sw; - } - return false; - } - - function cloudBounds(bounds, d) { - var b0 = bounds[0], - b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; - } - - function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; - } - - function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function(t) { - return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)]; - }; - } - - function rectangularSpiral(size) { - var dy = 4, - dx = dy * size[0] / size[1], - x = 0, - y = 0; - return function(t) { - var sign = t < 0 ? -1 : 1; - // See triangular numbers: T_n = n * (n + 1) / 2. - switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) { - case 0: x += dx; break; - case 1: y += dy; break; - case 2: x -= dx; break; - default: y -= dy; break; - } - return [x, y]; - }; - } - - // TODO reuse arrays? - function zeroArray(n) { - var a = [], - i = -1; - while (++i < n) a[i] = 0; - return a; - } - - function functor(d) { - return typeof d === 'function' ? d : function() { return d; }; - } - - var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral - }; - - var Output$5 = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle']; - - var Params$1 = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight']; - - function Wordcloud(params) { - Transform.call(this, cloud(), params); - } - - Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': {'modifies': true}, - 'params': [ - { 'name': 'size', 'type': 'number', 'array': true, 'length': 2 }, - { 'name': 'font', 'type': 'string', 'expr': true, 'default': 'sans-serif' }, - { 'name': 'fontStyle', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontWeight', 'type': 'string', 'expr': true, 'default': 'normal' }, - { 'name': 'fontSize', 'type': 'number', 'expr': true, 'default': 14 }, - { 'name': 'fontSizeRange', 'type': 'number', 'array': 'nullable', 'default': [10, 50] }, - { 'name': 'rotate', 'type': 'number', 'expr': true, 'default': 0 }, - { 'name': 'text', 'type': 'field' }, - { 'name': 'spiral', 'type': 'string', 'values': ['archimedean', 'rectangular'] }, - { 'name': 'padding', 'type': 'number', 'expr': true }, - { 'name': 'as', 'type': 'string', 'array': true, 'length': 7, 'default': Output$5 } - ] - }; - - var prototype$1p = inherits(Wordcloud, Transform); - - prototype$1p.transform = function(_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) { - error('Wordcloud size dimensions must be non-zero.'); - } - - function modp(param) { - var p = _[param]; - return isFunction(p) && pulse.modified(p.fields); - } - - var mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || Params$1.some(modp))) return; - - var data = pulse.materialize(pulse.SOURCE).source, - layout = this.value, - as = _.as || Output$5, - fontSize = _.fontSize || 14, - range; - - isFunction(fontSize) - ? (range = _.fontSizeRange) - : (fontSize = constant(fontSize)); - - // create font size scaling function as needed - if (range) { - var fsize = fontSize, - sizeScale = scale$2('sqrt')() - .domain(extent(data, fsize)) - .range(range); - fontSize = function(x) { return sizeScale(fsize(x)); }; - } - - data.forEach(function(t) { - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); - - // configure layout - var words = layout - .words(data) - .text(_.text) - .size(_.size || [500, 500]) - .padding(_.padding || 1) - .spiral(_.spiral || 'archimedean') - .rotate(_.rotate || 0) - .font(_.font || 'sans-serif') - .fontStyle(_.fontStyle || 'normal') - .fontWeight(_.fontWeight || 'normal') - .fontSize(fontSize) - .random(exports.random) - .layout(); - - var size = layout.size(), - dx = size[0] >> 1, - dy = size[1] >> 1, - i = 0, - n = words.length, - w, t; - - for (; i boolean (true => remove) - var n = data.length, - copy = Array(n - num), - reindex = data, // reuse old data array for index map - t, i, j; - - // seek forward to first removal - for (i=0; !map[i] && i k || m > width) { - width = Math.max(m, width); - curr = array$2(n, width, curr); - prev = array$2(n, width); - } - } - }; - } - - function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; - } - - function array$2(n, m, array) { - var copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; - } - - function Dimension(index, i, query) { - var bit = (1 << i); - - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - - onAdd: function(added, curr) { - var dim = this, - range = dim.bisect(dim.range, added.value), - idx = added.index, - lo = range[0], - hi = range[1], - n1 = idx.length, i; - - for (i=0; i 0) for (i=0; i remove - var n = size, - idx, i, j; - - // seek forward to first removal - for (i=0; !map[index[i]] && i y ? 1 : 0; - }); - return permute(values, index); - } - - function merge$2(base, value0, index0, n0, value1, index1, n1, value, index) { - var i0 = 0, i1 = 0, i; - - for (i=0; i0 < n0 && i1 < n1; ++i) { - if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - } - - for (; i0 < n0; ++i0, ++i) { - value[i] = value0[i0]; - index[i] = index0[i0]; - } - - for (; i1 < n1; ++i1, ++i) { - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } - } - - /** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ - function CrossFilter(params) { - Transform.call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; - } - - CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [ - { 'name': 'fields', 'type': 'field', 'array': true, 'required': true }, - { 'name': 'query', 'type': 'array', 'array': true, 'required': true, - 'content': {'type': 'number', 'array': true, 'length': 2} } - ] - }; - - var prototype$1q = inherits(CrossFilter, Transform); - - prototype$1q.transform = function(_, pulse) { - if (!this._dims) { - return this.init(_, pulse); - } else { - var init = _.modified('fields') - || _.fields.some(function(f) { return pulse.modified(f.fields); }); - - return init - ? this.reinit(_, pulse) - : this.eval(_, pulse); - } - }; - - prototype$1q.init = function(_, pulse) { - var fields = _.fields, - query = _.query, - indices = this._indices = {}, - dims = this._dims = [], - m = query.length, - i = 0, key, index; - - // instantiate indices and dimensions - for (; i lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - } - - dim.range = query.slice(); - }; - - prototype$1q.incrementOne = function(dim, query, add, rem) { - var bits = this.value, - curr = bits.curr(), - index = dim.index(), - old = dim.bisect(dim.range), - range = dim.bisect(query), - lo1 = range[0], - hi1 = range[1], - lo0 = old[0], - hi0 = old[1], - one = dim.one, - i, j, k; - - // Fast incremental update based on previous lo index. - if (lo1 < lo0) { - for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (lo1 > lo0) { - for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - // Fast incremental update based on previous hi index. - if (hi1 > hi0) { - for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - add.push(k); - } - } else if (hi1 < hi0) { - for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - } - - dim.range = query.slice(); - }; - - /** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ - function ResolveFilter(params) { - Transform.call(this, null, params); - } - - ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [ - { 'name': 'ignore', 'type': 'number', 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' }, - { 'name': 'filter', 'type': 'object', 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' } - ] - }; - - var prototype$1r = inherits(ResolveFilter, Transform); - - prototype$1r.transform = function(_, pulse) { - var ignore = ~(_.ignore || 0), // bit mask where zeros -> dims to ignore - bitmap = _.filter, - mask = bitmap.mask; - - // exit early if no relevant filter changes - if ((mask & ignore) === 0) return pulse.StopPropagation; - - var output = pulse.fork(pulse.ALL), - data = bitmap.data(), - curr = bitmap.curr(), - prev = bitmap.prev(), - pass = function(k) { - return !(curr[k] & ignore) ? data[k] : null; - }; - - // propagate all mod tuples that pass the filter - output.filter(output.MOD, pass); - - // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - - if (!(mask & (mask-1))) { // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, function(k) { - return (curr[k] & ignore) === mask ? data[k] : null; - }); - - } else { // multiple filters changed - output.filter(output.ADD, function(k) { - var c = curr[k] & ignore, - f = !c && (c ^ (prev[k] & ignore)); - return f ? data[k] : null; - }); - output.filter(output.REM, function(k) { - var c = curr[k] & ignore, - f = c && !(c ^ (c ^ (prev[k] & ignore))); - return f ? data[k] : null; - }); - } - - // add filter to source data in case of reflow... - return output.filter(output.SOURCE, function(t) { return pass(t._index); }); - }; - - var xf = /*#__PURE__*/Object.freeze({ - __proto__: null, - crossfilter: CrossFilter, - resolvefilter: ResolveFilter - }); - - var version = "5.13.0"; - - // initialize aria role and label attributes - function initializeAria(view) { - const el = view.container(); - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } - } - - // update aria-label if we have a DOM container element - function ariaLabel(el, desc) { - if (el) desc == null - ? el.removeAttribute('aria-label') - : el.setAttribute('aria-label', desc); - } - - function background$1(view) { - // respond to background signal - view.add(null, _ => { - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { bg: view._signals.background }); - } - - const Default = 'default'; - - function cursor(view) { - // get cursor signal, add to dataflow if needed - const cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); - - // evaluate cursor on each mousemove event - view.on(view.events('view', 'mousemove'), cursor, - function(_, event) { - const value = cursor.value, - user = value ? (isString(value) ? value : value.user) : Default, - item = event.item && event.item.cursor || null; - - return (value && user === value.user && item == value.item) - ? value - : {user: user, item: item}; - } - ); - - // when cursor signal updates, set visible cursor - view.add(null, function(_) { - let user = _.cursor, - item = this.value; - - if (!isString(user)) { - item = user.item; - user = user.user; - } - - setCursor(view, user && user !== Default ? user : (item || user)); - - return item; - }, {cursor: cursor}); - } - - function setCursor(view, cursor) { - const el = view.globalCursor() - ? (typeof document !== 'undefined' && document.body) - : view.container(); - - if (el) { - return cursor == null - ? el.style.removeProperty('cursor') - : (el.style.cursor = cursor); - } - } - - function dataref(view, name) { - var data = view._runtime.data; - if (!hasOwnProperty(data, name)) { - error('Unrecognized data set: ' + name); - } - return data[name]; - } - - function data(name, values) { - return arguments.length < 2 - ? dataref(this, name).values.value - : change.call(this, name, changeset().remove(truthy).insert(values)); - } - - function change(name, changes) { - if (!isChangeSet(changes)) { - error('Second argument to changes must be a changeset.'); - } - var dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); - } - - function insert(name, _) { - return change.call(this, name, changeset().insert(_)); - } - - function remove(name, _) { - return change.call(this, name, changeset().remove(_)); - } - - function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); - } - - function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); - } - - function offset$3(view) { - var padding = view.padding(), - origin = view._origin; - return [ - padding.left + origin[0], - padding.top + origin[1] - ]; - } - - function resizeRenderer(view) { - var origin = offset$3(view), - w = width(view), - h = height(view); - - view._renderer.background(view.background()); - view._renderer.resize(w, h, origin); - view._handler.origin(origin); - - view._resizeListeners.forEach(function(handler) { - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); - } - - /** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ - function eventExtend(view, event, item) { - var r = view._renderer, - el = r && r.canvas(), - p, e, translate; - - if (el) { - translate = offset$3(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = point$4(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; - } - - function extension(view, item, point) { - var itemGroup = item - ? item.mark.marktype === 'group' ? item : item.mark.group - : null; - - function group(name) { - var g = itemGroup, i; - if (name) for (i = item; i; i = i.mark.group) { - if (i.mark.name === name) { g = i; break; } - } - return g && g.mark && g.mark.interactive ? g : {}; - } - - function xy(item) { - if (!item) return point; - if (isString(item)) item = group(item); - - var p = point.slice(); - while (item) { - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - return p; - } - - return { - view: constant(view), - item: constant(item || {}), - group: group, - xy: xy, - x: function(item) { return xy(item)[0]; }, - y: function(item) { return xy(item)[1]; } - }; - } - - const VIEW = 'view', - TIMER = 'timer', - WINDOW = 'window', - NO_TRAP = {trap: false}; - - /** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ - function initializeEventConfig(config) { - const events = extend({defaults: {}}, config); - - const unpack = (obj, keys) => { - keys.forEach(k => { - if (isArray(obj[k])) obj[k] = toSet(obj[k]); - }); - }; - - unpack(events.defaults, ['prevent', 'allow']); - unpack(events, ['view', 'window', 'selector']); - - return events; - } - - function prevent(view, type) { - var def = view._eventConfig.defaults, - prevent = def.prevent, - allow = def.allow; - - return prevent === false || allow === true ? false - : prevent === true || allow === false ? true - : prevent ? prevent[type] - : allow ? !allow[type] - : view.preventDefault(); - } - - function permit(view, key, type) { - const rule = view._eventConfig && view._eventConfig[key]; - - if (rule === false || (isObject(rule) && !rule[type])) { - view.warn(`Blocked ${key} ${type} event listener.`); - return false; - } - - return true; - } - - /** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ - function events$1(source, type, filter) { - var view = this, - s = new EventStream(filter), - send = function(e, item) { - view.runAsync(null, () => { - if (source === VIEW && prevent(view, type)) { - e.preventDefault(); - } - s.receive(eventExtend(view, e, item)); - }); - }, - sources; - - if (source === TIMER) { - if (permit(view, 'timer', type)) { - view.timer(send, type); - } - } - - else if (source === VIEW) { - if (permit(view, 'view', type)) { - // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } - } - - else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') { - sources = [window]; - } - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) { - sources = document.querySelectorAll(source); - } - } - - if (!sources) { - view.warn('Can not resolve event source: ' + source); - } else { - for (var i=0, n=sources.length; i= 0) { - timers[n].stop(); - } - - n = listeners.length; - while (--n >= 0) { - e = listeners[n]; - m = e.sources.length; - while (--m >= 0) { - e.sources[m].removeEventListener(e.type, e.handler); - } - } - - if (tooltip) { - tooltip.call(this, this._handler, null, null, null); - } - - return this; - } - - function element$1(tag, attr, text) { - var el = document.createElement(tag); - for (var key in attr) el.setAttribute(key, attr[key]); - if (text != null) el.textContent = text; - return el; - } - - const BindClass = 'vega-bind', - NameClass = 'vega-bind-name', - RadioClass = 'vega-bind-radio'; - - /** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ - function bind$1(view, el, binding) { - if (!el) return; - - const param = binding.param; - let bind = binding.state; - - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: value => { - if (value !== view.signal(param.signal)) { - view.runAsync(null, function() { - bind.source = true; - view.signal(param.signal, value); - }); - } - } - }; - if (param.debounce) { - bind.update = debounce(param.debounce, bind.update); - } - } - - generate(bind, el, param, view.signal(param.signal)); - - if (!bind.active) { - view.on(view._signals[param.signal], null, () => { - bind.source - ? (bind.source = false) - : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - - return bind; - } - - /** - * Generate an HTML input form element and bind it to a signal. - */ - function generate(bind, el, param, value) { - const div = element$1('div', {'class': BindClass}); - - const wrapper = param.input === 'radio' - ? div - : div.appendChild(element$1('label')); - - wrapper.appendChild(element$1('span', - {'class': NameClass}, - (param.name || param.signal) - )); - - el.appendChild(div); - - let input = form; - switch (param.input) { - case 'checkbox': input = checkbox; break; - case 'select': input = select; break; - case 'radio': input = radio; break; - case 'range': input = range$2; break; - } - - input(bind, wrapper, param, value); - } - - /** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ - function form(bind, el, param, value) { - const node = element$1('input'); - - for (const key in param) { - if (key !== 'signal' && key !== 'element') { - node.setAttribute(key === 'input' ? 'type' : key, param[key]); - } - } - node.setAttribute('name', param.signal); - node.value = value; - - el.appendChild(node); - node.addEventListener('input', () => bind.update(node.value)); - - bind.elements = [node]; - bind.set = value => node.value = value; - } - - /** - * Generates a checkbox input element. - */ - function checkbox(bind, el, param, value) { - const attr = {type: 'checkbox', name: param.signal}; - if (value) attr.checked = true; - const node = element$1('input', attr); - - el.appendChild(node); - node.addEventListener('change', () => bind.update(node.checked)); - - bind.elements = [node]; - bind.set = value => node.checked = !!value || null; - } - - /** - * Generates a selection list input element. - */ - function select(bind, el, param, value) { - const node = element$1('select', {name: param.signal}), - labels = param.labels || []; - - param.options.forEach((option, i) => { - const attr = {value: option}; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element$1('option', attr, (labels[i] || option)+'')); - }); - - el.appendChild(node); - - node.addEventListener('change', () => { - bind.update(param.options[node.selectedIndex]); - }); - - bind.elements = [node]; - bind.set = value => { - for (let i = 0, n = param.options.length; i < n; ++i) { - if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; return; - } - } - }; - } - - /** - * Generates a radio button group. - */ - function radio(bind, el, param, value) { - const group = element$1('span', {'class': RadioClass}), - labels = param.labels || []; - - el.appendChild(group); - - bind.elements = param.options.map((option, i) => { - const attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - - const input = element$1('input', attr); - input.addEventListener('change', () => bind.update(option)); - - const label = element$1('label', {}, (labels[i] || option)+''); - label.prepend(input); - group.appendChild(label); - - return input; - }); - - bind.set = value => { - const nodes = bind.elements, - n = nodes.length; - for (let i = 0; i < n; ++i) { - if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - } - }; - } - - /** - * Generates a slider input element. - */ - function range$2(bind, el, param, value) { - value = value !== undefined ? value : ((+param.max) + (+param.min)) / 2; - - const max = param.max != null ? param.max : Math.max(100, +value) || 100, - min = param.min || Math.min(0, max, +value) || 0, - step = param.step || tickStep(min, max, 100); - - const node = element$1('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - - const span = element$1('span', {}, +value); - - el.appendChild(node); - el.appendChild(span); - - const update = () => { - span.textContent = node.value; - bind.update(+node.value); - }; - - // subscribe to both input and change - node.addEventListener('input', update); - node.addEventListener('change', update); - - bind.elements = [node]; - bind.set = value => { - node.value = value; - span.textContent = value; - }; - } - - function valuesEqual(a, b) { - return a === b || (a+'' === b+''); - } - - function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r - .initialize(el, width(view), height(view), offset$3(view), scaleFactor, opt) - .background(view.background()); - } - - function trap(view, fn) { - return !fn ? null : function() { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; - } - - function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - var handler = new constructor(view.loader(), trap(view, view.tooltip())) - .scene(view.scenegraph().root) - .initialize(el, offset$3(view), view); - - // transfer event handlers - if (prevHandler) { - prevHandler.handlers().forEach(function(h) { - handler.on(h.type, h.handler); - }); - } - - return handler; - } - - function initialize$1(el, elBind) { - const view = this, - type = view._renderType, - config = view._eventConfig.bind, - module = renderModule(type); - - // containing dom element - el = view._el = el ? lookup$4(view, el) : null; - - // initialize aria attributes - initializeAria(view); - - // select appropriate renderer & handler - if (!module) view.error('Unrecognized renderer type: ' + type); - const Handler = module.handler || CanvasHandler, - Renderer = (el ? module.renderer : module.headless); - - // initialize renderer and input handler - view._renderer = !Renderer ? null - : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; - - // initialize signal bindings - if (el && config !== 'none') { - elBind = elBind ? (view._elBind = lookup$4(view, elBind)) - : el.appendChild(element$1('form', {'class': 'vega-bindings'})); - - view._bind.forEach(function(_) { - if (_.param.element && config !== 'container') { - _.element = lookup$4(view, _.param.element); - } - }); - - view._bind.forEach(function(_) { - bind$1(view, _.element || elBind, _); - }); - } - - return view; - } - - function lookup$4(view, el) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; - } - } - if (el) { - try { - el.innerHTML = ''; - } catch (e) { - el = null; - view.error(e); - } - } - return el; - } - - const number$5 = _ => +_ || 0; - - const paddingObject = _ => ({top: _, bottom: _, left: _, right: _}); - - function padding(_) { - return isObject(_) - ? { - top: number$5(_.top), - bottom: number$5(_.bottom), - left: number$5(_.left), - right: number$5(_.right) - } - : paddingObject(number$5(_)); - } - - /** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ - async function renderHeadless(view, type, scaleFactor, opt) { - const module = renderModule(type), - ctr = module && module.headless; - - if (!ctr) error('Unrecognized renderer type: ' + type); - - await view.runAsync(); - return initializeRenderer(view, null, null, ctr, scaleFactor, opt) - .renderAsync(view._scenegraph.root); - } - - /** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ - async function renderToImageURL(type, scaleFactor) { - if (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG) { - error('Unrecognized image type: ' + type); - } - - const r = await renderHeadless(this, type, scaleFactor); - return type === RenderType.SVG - ? toBlobURL(r.svg(), 'image/svg+xml') - : r.canvas().toDataURL('image/png'); - } - - function toBlobURL(data, mime) { - var blob = new Blob([data], {type: mime}); - return window.URL.createObjectURL(blob); - } - - /** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ - async function renderToCanvas(scaleFactor, opt) { - const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt); - return r.canvas(); - } - - /** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ - async function renderToSVG(scaleFactor) { - const r = await renderHeadless(this, RenderType.SVG, scaleFactor); - return r.svg(); - } - - function data$1(name) { - const data = this.context.data[name]; - return data ? data.values.value : []; - } - - function indata(name, field, value) { - const index = this.context.data[name]['index:' + field], - entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; - } - - function setdata(name, tuples) { - const df = this.context.dataflow, - data = this.context.data[name], - input = data.input; - - df.pulse(input, df.changeset().remove(truthy).insert(tuples)); - return 1; - } - - function encode$1(item, name, retval) { - if (item) { - const df = this.context.dataflow, - target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - return retval !== undefined ? retval : item; - } - - const wrap = method => function(value, spec) { - const locale = this.context.dataflow.locale(); - return locale[method](spec)(value); - }; - - const format$3 = wrap('format'); - const timeFormat$1 = wrap('timeFormat'); - const utcFormat$1 = wrap('utcFormat'); - const timeParse$1 = wrap('timeParse'); - const utcParse$1 = wrap('utcParse'); - - var dateObj = new Date(2000, 0, 1); - - function time$1(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); - dateObj.setMonth(month); - dateObj.setDate(day); - return timeFormat$1.call(this, dateObj, specifier); - } - - function monthFormat(month) { - return time$1.call(this, month, 1, '%B'); - } - - function monthAbbrevFormat(month) { - return time$1.call(this, month, 1, '%b'); - } - - function dayFormat(day) { - return time$1.call(this, 0, 2 + day, '%A'); - } - - function dayAbbrevFormat(day) { - return time$1.call(this, 0, 2 + day, '%a'); - } - - const DataPrefix = ':'; - const IndexPrefix = '@'; - const ScalePrefix = '%'; - const SignalPrefix = '$'; - - var RawCode = 'RawCode'; - var Literal = 'Literal'; - var Property = 'Property'; - var Identifier$1 = 'Identifier'; - - var ArrayExpression = 'ArrayExpression'; - var BinaryExpression = 'BinaryExpression'; - var CallExpression = 'CallExpression'; - var ConditionalExpression = 'ConditionalExpression'; - var LogicalExpression = 'LogicalExpression'; - var MemberExpression = 'MemberExpression'; - var ObjectExpression = 'ObjectExpression'; - var UnaryExpression = 'UnaryExpression'; - - function ASTNode(type) { - this.type = type; - } - - ASTNode.prototype.visit = function(visitor) { - var node = this, c, i, n; - - if (visitor(node)) return 1; - - for (c=children$1(node), i=0, n=c.length; i - Copyright (C) 2013 Thaddee Tyl - Copyright (C) 2013 Mathias Bynens - Copyright (C) 2012 Ariya Hidayat - Copyright (C) 2012 Mathias Bynens - Copyright (C) 2012 Joost-Wim Boekesteijn - Copyright (C) 2012 Kris Kowal - Copyright (C) 2012 Yusuke Suzuki - Copyright (C) 2012 Arpad Borsos - Copyright (C) 2011 Ariya Hidayat - - 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. - - 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 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. - */ - - var TokenName, - source$1, - index$1, - length, - lookahead; - - var TokenBooleanLiteral = 1, - TokenEOF = 2, - TokenIdentifier = 3, - TokenKeyword = 4, - TokenNullLiteral = 5, - TokenNumericLiteral = 6, - TokenPunctuator = 7, - TokenStringLiteral = 8, - TokenRegularExpression = 9; - - TokenName = {}; - TokenName[TokenBooleanLiteral] = 'Boolean'; - TokenName[TokenEOF] = ''; - TokenName[TokenIdentifier] = 'Identifier'; - TokenName[TokenKeyword] = 'Keyword'; - TokenName[TokenNullLiteral] = 'Null'; - TokenName[TokenNumericLiteral] = 'Numeric'; - TokenName[TokenPunctuator] = 'Punctuator'; - TokenName[TokenStringLiteral] = 'String'; - TokenName[TokenRegularExpression] = 'RegularExpression'; - - var SyntaxArrayExpression = 'ArrayExpression', - SyntaxBinaryExpression = 'BinaryExpression', - SyntaxCallExpression = 'CallExpression', - SyntaxConditionalExpression = 'ConditionalExpression', - SyntaxIdentifier = 'Identifier', - SyntaxLiteral = 'Literal', - SyntaxLogicalExpression = 'LogicalExpression', - SyntaxMemberExpression = 'MemberExpression', - SyntaxObjectExpression = 'ObjectExpression', - SyntaxProperty = 'Property', - SyntaxUnaryExpression = 'UnaryExpression'; - - // Error messages should be identical to V8. - var MessageUnexpectedToken = 'Unexpected token %0', - MessageUnexpectedNumber = 'Unexpected number', - MessageUnexpectedString = 'Unexpected string', - MessageUnexpectedIdentifier = 'Unexpected identifier', - MessageUnexpectedReserved = 'Unexpected reserved word', - MessageUnexpectedEOS = 'Unexpected end of input', - MessageInvalidRegExp = 'Invalid regular expression', - MessageUnterminatedRegExp = 'Invalid regular expression: missing /', - MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', - MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; - - var ILLEGAL = 'ILLEGAL', - DISABLED = 'Disabled.'; - - // See also tools/generate-unicode-regex.py. - var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), - // eslint-disable-next-line no-misleading-character-class - RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3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\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); - - // Ensure the condition is true, otherwise throw an error. - // This is only to have a better contract semantic, i.e. another safety net - // to catch a logic error. The condition shall be fulfilled in normal case. - // Do NOT use this to enforce a certain condition on any user input. - - function assert(condition, message) { - /* istanbul ignore next */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - - function isDecimalDigit(ch) { - return (ch >= 0x30 && ch <= 0x39); // 0..9 - } - - function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; - } - - function isOctalDigit(ch) { - return '01234567'.indexOf(ch) >= 0; - } - - // 7.2 White Space - - function isWhiteSpace(ch) { - return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || - (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); - } - - // 7.3 Line Terminators - - function isLineTerminator(ch) { - return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); - } - - // 7.6 Identifier Names and Identifiers - - function isIdentifierStart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch))); - } - - function isIdentifierPart(ch) { - return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) - (ch >= 0x41 && ch <= 0x5A) || // A..Z - (ch >= 0x61 && ch <= 0x7A) || // a..z - (ch >= 0x30 && ch <= 0x39) || // 0..9 - (ch === 0x5C) || // \ (backslash) - ((ch >= 0x80) && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch))); - } - - // 7.6.1.1 Keywords - - var keywords = { - 'if':1, 'in':1, 'do':1, - 'var':1, 'for':1, 'new':1, 'try':1, 'let':1, - 'this':1, 'else':1, 'case':1, 'void':1, 'with':1, 'enum':1, - 'while':1, 'break':1, 'catch':1, 'throw':1, 'const':1, 'yield':1, 'class':1, 'super':1, - 'return':1, 'typeof':1, 'delete':1, 'switch':1, 'export':1, 'import':1, 'public':1, 'static':1, - 'default':1, 'finally':1, 'extends':1, 'package':1, 'private':1, - 'function':1, 'continue':1, 'debugger':1, - 'interface':1, 'protected':1, - 'instanceof':1, 'implements':1 - }; - - function skipComment() { - var ch; - - while (index$1 < length) { - ch = source$1.charCodeAt(index$1); - - if (isWhiteSpace(ch) || isLineTerminator(ch)) { - ++index$1; - } else { - break; - } - } - } - - function scanHexEscape(prefix) { - var i, len, ch, code = 0; - - len = (prefix === 'u') ? 4 : 2; - for (i = 0; i < len; ++i) { - if (index$1 < length && isHexDigit(source$1[index$1])) { - ch = source$1[index$1++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - return String.fromCharCode(code); - } - - function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - - ch = source$1[index$1]; - code = 0; - - // At least, one hex digit is required. - if (ch === '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - while (index$1 < length) { - ch = source$1[index$1++]; - if (!isHexDigit(ch)) { - break; - } - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - // UTF-16 Encoding - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } - cu1 = ((code - 0x10000) >> 10) + 0xD800; - cu2 = ((code - 0x10000) & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); - } - - function getEscapedIdentifier() { - var ch, id; - - ch = source$1.charCodeAt(index$1++); - id = String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source$1.charCodeAt(index$1) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index$1; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id = ch; - } - - while (index$1 < length) { - ch = source$1.charCodeAt(index$1); - if (!isIdentifierPart(ch)) { - break; - } - ++index$1; - id += String.fromCharCode(ch); - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source$1.charCodeAt(index$1) !== 0x75) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - ++index$1; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - id += ch; - } - } - - return id; - } - - function getIdentifier() { - var start, ch; - - start = index$1++; - while (index$1 < length) { - ch = source$1.charCodeAt(index$1); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index$1 = start; - return getEscapedIdentifier(); - } - if (isIdentifierPart(ch)) { - ++index$1; - } else { - break; - } - } - - return source$1.slice(start, index$1); - } - - function scanIdentifier() { - var start, id, type; - - start = index$1; - - // Backslash (U+005C) starts an escaped character. - id = (source$1.charCodeAt(index$1) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); - - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) { - type = TokenIdentifier; - } else if (keywords.hasOwnProperty(id)) { // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - } else if (id === 'null') { - type = TokenNullLiteral; - } else if (id === 'true' || id === 'false') { - type = TokenBooleanLiteral; - } else { - type = TokenIdentifier; - } - - return { - type: type, - value: id, - start: start, - end: index$1 - }; - } - - // 7.7 Punctuators - - function scanPunctuator() { - var start = index$1, - code = source$1.charCodeAt(index$1), - code2, - ch1 = source$1[index$1], - ch2, - ch3, - ch4; - - switch (code) { - - // Check for most common single-character punctuators. - case 0x2E: // . dot - case 0x28: // ( open bracket - case 0x29: // ) close bracket - case 0x3B: // ; semicolon - case 0x2C: // , comma - case 0x7B: // { open curly brace - case 0x7D: // } close curly brace - case 0x5B: // [ - case 0x5D: // ] - case 0x3A: // : - case 0x3F: // ? - case 0x7E: // ~ - ++index$1; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index$1 - }; - - default: - code2 = source$1.charCodeAt(index$1 + 1); - - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) { - switch (code) { - case 0x2B: // + - case 0x2D: // - - case 0x2F: // / - case 0x3C: // < - case 0x3E: // > - case 0x5E: // ^ - case 0x7C: // | - case 0x25: // % - case 0x26: // & - case 0x2A: // * - index$1 += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index$1 - }; - - case 0x21: // ! - case 0x3D: // = - index$1 += 2; - - // !== and === - if (source$1.charCodeAt(index$1) === 0x3D) { - ++index$1; - } - return { - type: TokenPunctuator, - value: source$1.slice(start, index$1), - start: start, - end: index$1 - }; - } - } - } - - // 4-character punctuator: >>>= - - ch4 = source$1.substr(index$1, 4); - - if (ch4 === '>>>=') { - index$1 += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index$1 - }; - } - - // 3-character punctuators: === !== >>> <<= >>= - - ch3 = ch4.substr(0, 3); - - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index$1 += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index$1 - }; - } - - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - - if ((ch1 === ch2[1] && ('+-<>&|'.indexOf(ch1) >= 0)) || ch2 === '=>') { - index$1 += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index$1 - }; - } - - // 1-character punctuators: < > = ! + - * % & | ^ / - - if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { - ++index$1; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index$1 - }; - } - - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - // 7.8.3 Numeric Literals - - function scanHexLiteral(start) { - var number = ''; - - while (index$1 < length) { - if (!isHexDigit(source$1[index$1])) { - break; - } - number += source$1[index$1++]; - } - - if (number.length === 0) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - if (isIdentifierStart(source$1.charCodeAt(index$1))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index$1 - }; - } - - function scanOctalLiteral(start) { - var number = '0' + source$1[index$1++]; - while (index$1 < length) { - if (!isOctalDigit(source$1[index$1])) { - break; - } - number += source$1[index$1++]; - } - - if (isIdentifierStart(source$1.charCodeAt(index$1)) || isDecimalDigit(source$1.charCodeAt(index$1))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index$1 - }; - } - - function scanNumericLiteral() { - var number, start, ch; - - ch = source$1[index$1]; - assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), - 'Numeric literal must start with a decimal digit or a decimal point'); - - start = index$1; - number = ''; - if (ch !== '.') { - number = source$1[index$1++]; - ch = source$1[index$1]; - - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index$1; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) { - return scanOctalLiteral(start); - } - - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - while (isDecimalDigit(source$1.charCodeAt(index$1))) { - number += source$1[index$1++]; - } - ch = source$1[index$1]; - } - - if (ch === '.') { - number += source$1[index$1++]; - while (isDecimalDigit(source$1.charCodeAt(index$1))) { - number += source$1[index$1++]; - } - ch = source$1[index$1]; - } - - if (ch === 'e' || ch === 'E') { - number += source$1[index$1++]; - - ch = source$1[index$1]; - if (ch === '+' || ch === '-') { - number += source$1[index$1++]; - } - if (isDecimalDigit(source$1.charCodeAt(index$1))) { - while (isDecimalDigit(source$1.charCodeAt(index$1))) { - number += source$1[index$1++]; - } - } else { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - } - - if (isIdentifierStart(source$1.charCodeAt(index$1))) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index$1 - }; - } - - // 7.8.4 String Literals - - function scanStringLiteral() { - var str = '', - quote, start, ch, code, octal = false; - - quote = source$1[index$1]; - assert((quote === '\'' || quote === '"'), - 'String literal must starts with a quote'); - - start = index$1; - ++index$1; - - while (index$1 < length) { - ch = source$1[index$1++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source$1[index$1++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source$1[index$1] === '{') { - ++index$1; - str += scanUnicodeCodePointEscape(); - } else { - str += scanHexEscape(ch); - } - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - - // \0 is not octal escape sequence - if (code !== 0) { - octal = true; - } - - if (index$1 < length && isOctalDigit(source$1[index$1])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source$1[index$1++]); - - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.indexOf(ch) >= 0 && - index$1 < length && - isOctalDigit(source$1[index$1])) { - code = code * 8 + '01234567'.indexOf(source$1[index$1++]); - } - } - str += String.fromCharCode(code); - } else { - str += ch; - } - break; - } - } else { - if (ch === '\r' && source$1[index$1] === '\n') { - ++index$1; - } - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } - - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index$1 - }; - } - - function testRegExp(pattern, flags) { - var tmp = pattern; - - if (flags.indexOf('u') >= 0) { - // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp - .replace(/\\u\{([0-9a-fA-F]+)\}/g, function($0, $1) { - if (parseInt($1, 16) <= 0x10FFFF) { - return 'x'; - } - throwError({}, MessageInvalidRegExp); - }) - .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - } - - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); - } - - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } - } - - function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - - ch = source$1[index$1]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source$1[index$1++]; - - classMarker = false; - terminated = false; - while (index$1 < length) { - ch = source$1[index$1++]; - str += ch; - if (ch === '\\') { - ch = source$1[index$1++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwError({}, MessageUnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwError({}, MessageUnterminatedRegExp); - } - - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; - } - - function scanRegExpFlags() { - var ch, str, flags; - - str = ''; - flags = ''; - while (index$1 < length) { - ch = source$1[index$1]; - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index$1; - if (ch === '\\' && index$1 < length) { - throwError({}, MessageUnexpectedToken, ILLEGAL); - } else { - flags += ch; - str += ch; - } - } - - if (flags.search(/[^gimuy]/g) >= 0) { - throwError({}, MessageInvalidRegExp, flags); - } - - return { - value: flags, - literal: str - }; - } - - function scanRegExp() { - var start, body, flags, value; - - lookahead = null; - skipComment(); - start = index$1; - - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index$1 - }; - } - - function isIdentifierName(token) { - return token.type === TokenIdentifier || - token.type === TokenKeyword || - token.type === TokenBooleanLiteral || - token.type === TokenNullLiteral; - } - - function advance() { - var ch; - - skipComment(); - - if (index$1 >= length) { - return { - type: TokenEOF, - start: index$1, - end: index$1 - }; - } - - ch = source$1.charCodeAt(index$1); - - if (isIdentifierStart(ch)) { - return scanIdentifier(); - } - - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { - return scanPunctuator(); - } - - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) { - return scanStringLiteral(); - } - - - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source$1.charCodeAt(index$1 + 1))) { - return scanNumericLiteral(); - } - return scanPunctuator(); - } - - if (isDecimalDigit(ch)) { - return scanNumericLiteral(); - } - - return scanPunctuator(); - } - - function lex() { - var token; - - token = lookahead; - index$1 = token.end; - - lookahead = advance(); - - index$1 = token.end; - - return token; - } - - function peek$1() { - var pos; - - pos = index$1; - - lookahead = advance(); - index$1 = pos; - } - - function finishArrayExpression(elements) { - var node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; - } - - function finishBinaryExpression(operator, left, right) { - var node = new ASTNode((operator === '||' || operator === '&&') ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; - } - - function finishCallExpression(callee, args) { - var node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; - } - - function finishConditionalExpression(test, consequent, alternate) { - var node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; - } - - function finishIdentifier(name) { - var node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; - } - - function finishLiteral(token) { - var node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source$1.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') { - node.raw = '/(?:)/'; - } - node.regex = token.regex; - } - return node; - } - - function finishMemberExpression(accessor, object, property) { - var node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; - } - - function finishObjectExpression(properties) { - var node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; - } - - function finishProperty(kind, key, value) { - var node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; - } - - function finishUnaryExpression(operator, argument) { - var node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; - } - - // Throw an exception - - function throwError(token, messageFormat) { - var error, - args = Array.prototype.slice.call(arguments, 2), - msg = messageFormat.replace( - /%(\d)/g, - function(whole, index) { - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - } - ); - - - error = new Error(msg); - error.index = index$1; - error.description = msg; - throw error; - } - - // Throw an exception because of the token. - - function throwUnexpected(token) { - if (token.type === TokenEOF) { - throwError(token, MessageUnexpectedEOS); - } - - if (token.type === TokenNumericLiteral) { - throwError(token, MessageUnexpectedNumber); - } - - if (token.type === TokenStringLiteral) { - throwError(token, MessageUnexpectedString); - } - - if (token.type === TokenIdentifier) { - throwError(token, MessageUnexpectedIdentifier); - } - - if (token.type === TokenKeyword) { - throwError(token, MessageUnexpectedReserved); - } - - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); - } - - // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - - function expect(value) { - var token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) { - throwUnexpected(token); - } - } - - // Return true if the next token matches the specified punctuator. - - function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; - } - - // Return true if the next token matches the specified keyword - - function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; - } - - // 11.1.4 Array Initialiser - - function parseArrayInitialiser() { - var elements = []; - - index$1 = lookahead.start; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - - return finishArrayExpression(elements); - } - - // 11.1.5 Object Initialiser - - function parseObjectPropertyKey() { - var token; - - index$1 = lookahead.start; - token = lex(); - - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) { - throwError(token, MessageStrictOctalLiteral); - } - return finishLiteral(token); - } - - return finishIdentifier(token.value); - } - - function parseObjectProperty() { - var token, key, id, value; - - index$1 = lookahead.start; - token = lookahead; - - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); - } - if (token.type === TokenEOF || token.type === TokenPunctuator) { - throwUnexpected(token); - } else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } - } - - function parseObjectInitialiser() { - var properties = [], - property, name, key, map = {}, - toString = String; - - index$1 = lookahead.start; - expect('{'); - - while (!match('}')) { - property = parseObjectProperty(); - - if (property.key.type === SyntaxIdentifier) { - name = property.key.name; - } else { - name = toString(property.key.value); - } - - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) { - throwError({}, MessageStrictDuplicateProperty); - } else { - map[key] = true; - } - - properties.push(property); - - if (!match('}')) { - expect(','); - } - } - - expect('}'); - - return finishObjectExpression(properties); - } - - // 11.1.6 The Grouping Operator - - function parseGroupExpression() { - var expr; - - expect('('); - - expr = parseExpression(); - - expect(')'); - - return expr; - } - - - // 11.1 Primary Expressions - - var legalKeywords = { - 'if': 1 - }; - - function parsePrimaryExpression() { - var type, token, expr; - - if (match('(')) { - return parseGroupExpression(); - } - - if (match('[')) { - return parseArrayInitialiser(); - } - - if (match('{')) { - return parseObjectInitialiser(); - } - - type = lookahead.type; - index$1 = lookahead.start; - - - if (type === TokenIdentifier || legalKeywords[lookahead.value]) { - expr = finishIdentifier(lex().value); - } else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) { - throwError(lookahead, MessageStrictOctalLiteral); - } - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) { - throw new Error(DISABLED); - } else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = (token.value === 'true'); - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek$1(); - } else { - throwUnexpected(lex()); - } - - return expr; - } - - // 11.2 Left-Hand-Side Expressions - - function parseArguments() { - var args = []; - - expect('('); - - if (!match(')')) { - while (index$1 < length) { - args.push(parseConditionalExpression()); - if (match(')')) { - break; - } - expect(','); - } - } - - expect(')'); - - return args; - } - - function parseNonComputedProperty() { - var token; - index$1 = lookahead.start; - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpected(token); - } - - return finishIdentifier(token.value); - } - - function parseNonComputedMember() { - expect('.'); - - return parseNonComputedProperty(); - } - - function parseComputedMember() { - var expr; - - expect('['); - - expr = parseExpression(); - - expect(']'); - - return expr; - } - - function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - - expr = parsePrimaryExpression(); - - for (;;) { - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else { - break; - } - } - - return expr; - } - - // 11.3 Postfix Expressions - - function parsePostfixExpression() { - var expr = parseLeftHandSideExpressionAllowCall(); - - if (lookahead.type === TokenPunctuator) { - if ((match('++') || match('--'))) { - throw new Error(DISABLED); - } - } - - return expr; - } - - // 11.4 Unary Operators - - function parseUnaryExpression() { - var token, expr; - - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - throw new Error(DISABLED); - } else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - throw new Error(DISABLED); - } else { - expr = parsePostfixExpression(); - } - - return expr; - } - - function binaryPrecedence(token) { - var prec = 0; - - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - } - - return prec; - } - - // 11.5 Multiplicative Operators - // 11.6 Additive Operators - // 11.7 Bitwise Shift Operators - // 11.8 Relational Operators - // 11.9 Equality Operators - // 11.10 Binary Bitwise Operators - // 11.11 Binary Logical Operators - - function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - - marker = lookahead; - left = parseUnaryExpression(); - - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) { - return left; - } - token.prec = prec; - lex(); - - markers = [marker, lookahead]; - right = parseUnaryExpression(); - - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead)) > 0) { - - // Reduce: make a binary expression from the three topmost entries. - while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while (i > 1) { - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; - } - - // 11.12 Conditional Operator - - function parseConditionalExpression() { - var expr, consequent, alternate; - - expr = parseBinaryExpression(); - - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - - expr = finishConditionalExpression(expr, consequent, alternate); - } - - return expr; - } - - // 11.14 Comma Operator - - function parseExpression() { - var expr = parseConditionalExpression(); - - if (match(',')) { - throw new Error(DISABLED); // no sequence expressions - } - - return expr; - } - - function parse$3(code) { - source$1 = code; - index$1 = 0; - length = source$1.length; - lookahead = null; - - peek$1(); - - var expr = parseExpression(); - - if (lookahead.type !== TokenEOF) { - throw new Error('Unexpect token after expression.'); - } - return expr; - } - - var constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' - }; - - function functions(codegen) { - - function fncall(name, args, cast, type) { - var obj = codegen(args[0]); - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - return obj + '.' + name + (type < 0 ? '' : type === 0 ? - '()' : - '(' + args.slice(1).map(codegen).join(',') + ')'); - } - - function fn(name, cast, type) { - return function(args) { - return fncall(name, args, cast, type); - }; - } - - var DATE = 'new Date', - STRING = 'String', - REGEXP = 'RegExp'; - - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - - clamp: function(args) { - if (args.length < 3) error('Missing arguments to clamp function.'); - if (args.length > 3) error('Too many arguments to clamp function.'); - var a = args.map(codegen); - return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))'; - }, - - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - - // sequence functions - length: fn('length', null, -1), - join: fn('join', null), - indexof: fn('indexOf', null), - lastindexof: fn('lastIndexOf', null), - slice: fn('slice', null), - - reverse: function(args) { - return '('+codegen(args[0])+').slice().reverse()'; - }, - - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - replace: fn('replace', STRING), - trim: fn('trim', STRING, 0), - - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - - // Control Flow functions - if: function(args) { - if (args.length < 3) error('Missing arguments to if function.'); - if (args.length > 3) error('Too many arguments to if function.'); - var a = args.map(codegen); - return '('+a[0]+'?'+a[1]+':'+a[2]+')'; - } - }; - } - - function stripQuotes(s) { - var n = s && s.length - 1; - return n && ( - (s[0]==='"' && s[n]==='"') || - (s[0]==='\'' && s[n]==='\'') - ) ? s.slice(1, -1) : s; - } - - function codegen(opt) { - opt = opt || {}; - - var whitelist = opt.whitelist ? toSet(opt.whitelist) : {}, - blacklist = opt.blacklist ? toSet(opt.blacklist) : {}, - constants$1 = opt.constants || constants, - functions$1 = (opt.functions || functions)(visit), - globalvar = opt.globalvar, - fieldvar = opt.fieldvar, - globals = {}, - fields = {}, - memberDepth = 0; - - var outputGlobal = isFunction(globalvar) - ? globalvar - : function (id) { return globalvar + '["' + id + '"]'; }; - - function visit(ast) { - if (isString(ast)) return ast; - var generator = Generators[ast.type]; - if (generator == null) error('Unsupported type: ' + ast.type); - return generator(ast); - } - - var Generators = { - Literal: function(n) { - return n.raw; - }, - - Identifier: function(n) { - var id = n.name; - if (memberDepth > 0) { - return id; - } else if (hasOwnProperty(blacklist, id)) { - return error('Illegal identifier: ' + id); - } else if (hasOwnProperty(constants$1, id)) { - return constants$1[id]; - } else if (hasOwnProperty(whitelist, id)) { - return id; - } else { - globals[id] = 1; - return outputGlobal(id); - } - }, - - MemberExpression: function(n) { - var d = !n.computed; - var o = visit(n.object); - if (d) memberDepth += 1; - var p = visit(n.property); - if (o === fieldvar) { - // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - } - if (d) memberDepth -= 1; - return o + (d ? '.'+p : '['+p+']'); - }, - - CallExpression: function(n) { - if (n.callee.type !== 'Identifier') { - error('Illegal callee type: ' + n.callee.type); - } - var callee = n.callee.name; - var args = n.arguments; - var fn = hasOwnProperty(functions$1, callee) && functions$1[callee]; - if (!fn) error('Unrecognized function: ' + callee); - return isFunction(fn) - ? fn(args) - : fn + '(' + args.map(visit).join(',') + ')'; - }, - - ArrayExpression: function(n) { - return '[' + n.elements.map(visit).join(',') + ']'; - }, - - BinaryExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - UnaryExpression: function(n) { - return '(' + n.operator + visit(n.argument) + ')'; - }, - - ConditionalExpression: function(n) { - return '(' + visit(n.test) + - '?' + visit(n.consequent) + - ':' + visit(n.alternate) + - ')'; - }, - - LogicalExpression: function(n) { - return '(' + visit(n.left) + n.operator + visit(n.right) + ')'; - }, - - ObjectExpression: function(n) { - return '{' + n.properties.map(visit).join(',') + '}'; - }, - - Property: function(n) { - memberDepth += 1; - var k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - - function codegen(ast) { - var result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; - } - - codegen.functions = functions$1; - codegen.constants = constants$1; - - return codegen; - } - - function dataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) { - error('First argument to data functions must be a string literal.'); - } - - const data = args[0].value, - dataName = DataPrefix + data; - - if (!hasOwnProperty(dataName, params)) { - try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) { - // if data set does not exist, there's nothing to track - } - } - } - - function indataVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to indata must be a string literal.'); - if (args[1].type !== Literal) error('Second argument to indata must be a string literal.'); - - const data = args[0].value, - field = args[1].value, - indexName = IndexPrefix + field; - - if (!hasOwnProperty(indexName, params)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - } - - function scaleVisitor(name, args, scope, params) { - if (args[0].type === Literal) { - // add scale dependency - addScaleDependency(scope, params, args[0].value); - } else { - // indirect scale lookup; add all scales as parameters - for (name in scope.scales) { - addScaleDependency(scope, params, name); - } - } - } - - function addScaleDependency(scope, params, name) { - const scaleName = ScalePrefix + name; - if (!hasOwnProperty(params, scaleName)) { - try { - params[scaleName] = scope.scaleRef(name); - } catch (err) { - // TODO: error handling? warning? - } - } - } - - function getScale(name, ctx) { - let s; - return isFunction(name) ? name - : isString(name) ? (s = ctx.scales[name]) && s.value - : undefined; - } - - function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = s => s && s.bandwidth ? s.bandwidth() : 0; - - // register AST visitors for internal scale functions - visitors._bandwidth = scaleVisitor; - visitors._range = scaleVisitor; - visitors._scale = scaleVisitor; - - // resolve scale reference directly to the signal hash argument - const ref = arg => '_[' + ( - arg.type === Literal - ? $(ScalePrefix + arg.value) - : $(ScalePrefix) + '+' + codegen(arg) - ) + ']'; - - // define and return internal scale function code generators - // these internal functions are called by mark encoders - return { - _bandwidth: args => `this.__bandwidth(${ref(args[0])})`, - _range: args => `${ref(args[0])}.range()`, - _scale: args => `${ref(args[0])}(${codegen(args[1])})` - }; - } - - function geoMethod(methodName, globalMethod) { - return function(projection, geojson, group) { - if (projection) { - // projection defined, use it - const p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else { - // projection undefined, use global method - return globalMethod(geojson); - } - }; - } - - const geoArea = geoMethod('area', area$3); - const geoBounds = geoMethod('bounds', bounds$1); - const geoCentroid = geoMethod('centroid', centroid); - - function inScope(item) { - let group = this.context.group, - value = false; - - if (group) while (item) { - if (item === group) { value = true; break; } - item = item.mark.group; - } - return value; - } - - function log$4(df, method, args) { - try { - df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args))); - } catch (err) { - df.warn(err); - } - return args[args.length-1]; - } - - function warn() { - return log$4(this.context.dataflow, 'warn', arguments); - } - - function info() { - return log$4(this.context.dataflow, 'info', arguments); - } - - function debug() { - return log$4(this.context.dataflow, 'debug', arguments); - } - - // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - function channel_luminance_value(channelValue) { - const val = channelValue / 255; - if (val <= 0.03928) { - return val / 12.92; - } - return Math.pow((val + 0.055) / 1.055, 2.4); - } - - function luminance(color) { - const c = rgb(color), - r = channel_luminance_value(c.r), - g = channel_luminance_value(c.g), - b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; - } - - // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef - function contrast(color1, color2) { - const lum1 = luminance(color1), - lum2 = luminance(color2), - lumL = Math.max(lum1, lum2), - lumD = Math.min(lum1, lum2); - return (lumL + 0.05) / (lumD + 0.05); - } - - function merge$3() { - var args = [].slice.call(arguments); - args.unshift({}); - return extend.apply(null, args); - } - - function equal(a, b) { - return a === b || a !== a && b !== b ? true - : isArray(a) ? ( - isArray(b) && a.length === b.length ? equalArray(a, b) : false - ) - : isObject(a) && isObject(b) ? equalObject(a, b) - : false; - } - - function equalArray(a, b) { - for (let i=0, n=a.length; i equalObject(props, _); - } - - function modify(name, insert, remove, toggle, modify, values) { - let df = this.context.dataflow, - data = this.context.data[name], - input = data.input, - changes = data.changes, - stamp = df.stamp(), - predicate, key; - - if (df._trigger === false || !(input.value.length || insert || toggle)) { - // nothing to do! - return 0; - } - - if (!changes || changes.stamp < stamp) { - data.changes = (changes = df.changeset()); - changes.stamp = stamp; - df.runAfter(function() { - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - - if (remove) { - predicate = remove === true ? truthy - : (isArray(remove) || isTuple(remove)) ? remove - : removePredicate(remove); - changes.remove(predicate); - } - - if (insert) { - changes.insert(insert); - } - - if (toggle) { - predicate = removePredicate(toggle); - if (input.value.some(predicate)) { - changes.remove(predicate); - } else { - changes.insert(toggle); - } - } - - if (modify) { - for (key in values) { - changes.modify(modify, key, values[key]); - } - } - - return 1; - } - - function pinchDistance(event) { - const t = event.touches, - dx = t[0].clientX - t[1].clientX, - dy = t[0].clientY - t[1].clientY; - return Math.sqrt(dx * dx + dy * dy); - } - - function pinchAngle(event) { - const t = event.touches; - return Math.atan2( - t[0].clientY - t[1].clientY, - t[0].clientX - t[1].clientX - ); - } - - function bandspace(count, paddingInner, paddingOuter) { - return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0); - } - - function bandwidth(name, group) { - const s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; - } - - function copy$2(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; - } - - function domain(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.domain() : []; - } - - function invert(name, range, group) { - const s = getScale(name, (group || this).context); - return !s ? undefined - : isArray(range) ? (s.invertRange || s.invert)(range) - : (s.invert || s.invertExtent)(range); - } - - function range$3(name, group) { - const s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; - } - - function scale$3(name, value, group) { - const s = getScale(name, (group || this).context); - return s ? s(value) : undefined; - } - - function scaleGradient(scale, p0, p1, count, group) { - scale = getScale(scale, (group || this).context); - - const gradient = Gradient(p0, p1); - - let stops = scale.domain(), - min = stops[0], - max = peek(stops), - fraction = identity; - - if (!(max - min)) { - // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator - ? scale$2('sequential')().interpolator(scale.interpolator()) - : scale$2('linear')().interpolate(scale.interpolate()).range(scale.range()) - ).domain([min=0, max=1]); - } else { - fraction = scaleFraction(scale, min, max); - } - - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== peek(stops)) stops.push(max); - } - - stops.forEach(_ => gradient.stop(fraction(_), scale(_))); - - return gradient; - } - - function geoShape(projection, geojson, group) { - const p = getScale(projection, (group || this).context); - return function(context) { - return p ? p.path.context(context)(geojson) : ''; - }; - } - - function pathShape(path) { - let p = null; - return function(context) { - return context - ? pathRender(context, (p = p || pathParse(path))) - : path; - }; - } - - const datum = d => d.data; - - function treeNodes(name, context) { - const tree = data$1.call(context, name); - return tree.root && tree.root.lookup || {}; - } - - function treePath(name, source, target) { - const nodes = treeNodes(name, this), - s = nodes[source], - t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; - } - - function treeAncestors(name, node) { - const n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; - } - - const _window = () => (typeof window !== 'undefined' && window) || null; - - function screen() { - const w = _window(); - return w ? w.screen : {}; - } - - function windowSize() { - const w = _window(); - return w - ? [w.innerWidth, w.innerHeight] - : [undefined, undefined]; - } - - function containerSize() { - const view = this.context.dataflow, - el = view.container && view.container(); - return el - ? [el.clientWidth, el.clientHeight] - : [undefined, undefined]; - } - - const Intersect = 'intersect'; - const Union = 'union'; - const VlMulti = 'vlMulti'; - const Or = 'or'; - const And = 'and'; - - var TYPE_ENUM = 'E', - TYPE_RANGE_INC = 'R', - TYPE_RANGE_EXC = 'R-E', - TYPE_RANGE_LE = 'R-LE', - TYPE_RANGE_RE = 'R-RE', - UNIT_INDEX = 'index:unit'; - - // TODO: revisit date coercion? - function testPoint(datum, entry) { - var fields = entry.fields, - values = entry.values, - n = fields.length, - i = 0, dval, f; - - for (; i, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ - function selectionTest(name, datum, op) { - var data = this.context.data[name], - entries = data ? data.values.value : [], - unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, - intersect = op === Intersect, - n = entries.length, - i = 0, - entry, miss, count, unit, b; - - for (; i (obj[fields[j].field] = curr, obj), {})); - } - } - - // Then resolve fields across units as per the op. - op = op || Union; - Object.keys(resolved).forEach(function (field) { - resolved[field] = Object.keys(resolved[field]) - .map(unit => resolved[field][unit]) - .reduce((acc, curr) => acc === undefined ? curr : ops[types[field] + '_' + op](acc, curr)); - }); - - entries = Object.keys(multiRes); - if (isMulti && entries.length) { - resolved[VlMulti] = op === Union - ? {[Or]: entries.reduce((acc, k) => (acc.push.apply(acc, multiRes[k]), acc), [])} - : {[And]: entries.map(k => ({[Or]: multiRes[k]}))}; - } - - return resolved; - } - - var ops = { - E_union: function(base, value) { - if (!base.length) return value; - - var i = 0, n = value.length; - for (; i= 0; }); - }, - - R_union: function(base, value) { - var lo = toNumber(value[0]), hi = toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; - }, - - R_intersect: function(base, value) { - var lo = toNumber(value[0]), hi = toNumber(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - - if (!base.length) return [lo, hi]; - if (hi < base[0] || base[1] < lo) { - return []; - } else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - return base; - } - }; - - const DataPrefix$1 = ':', - IndexPrefix$1 = '@'; - - function selectionVisitor(name, args, scope, params) { - if (args[0].type !== Literal) error('First argument to selection functions must be a string literal.'); - - const data = args[0].value, - op = args.length >= 2 && peek(args).value, - field = 'unit', - indexName = IndexPrefix$1 + field, - dataName = DataPrefix$1 + data; - - // eslint-disable-next-line no-prototype-builtins - if (op === Intersect && !hasOwnProperty(params, indexName)) { - params[indexName] = scope.getData(data).indataRef(scope, field); - } - - // eslint-disable-next-line no-prototype-builtins - if (!hasOwnProperty(params, dataName)) { - params[dataName] = scope.getData(data).tuplesRef(); - } - } - - function intersect$3(b, opt, group) { - if (!b) return []; - - const [u, v] = b, - box = new Bounds().set(u[0], u[1], v[0], v[1]), - scene = group || this.context.dataflow.scenegraph().root; - - return intersect$1(scene, box, filter$1(opt)); - } - - function filter$1(opt) { - let p = null; - - if (opt) { - const types = array(opt.marktype), - names = array(opt.markname); - p = _ => (!types.length || types.some(t => _.marktype === t)) - && (!names.length || names.some(s => _.name === s)); - } - - return p; - } - - // Expression function context object - const functionContext = { - random: function() { return exports.random(); }, // override default - cumulativeNormal, - cumulativeLogNormal, - cumulativeUniform, - densityNormal, - densityLogNormal, - densityUniform, - quantileNormal, - quantileLogNormal, - quantileUniform, - sampleNormal, - sampleLogNormal, - sampleUniform, - isArray, - isBoolean, - isDate, - isDefined: function(_) { return _ !== undefined; }, - isNumber, - isObject, - isRegExp, - isString, - isTuple, - isValid: function(_) { return _ != null && _ === _; }, - toBoolean, - toDate, - toNumber, - toString, - flush, - lerp, - merge: merge$3, - pad, - peek, - span, - inrange, - truncate, - rgb, - lab, - hcl, - hsl, - luminance, - contrast, - sequence, - format: format$3, - utcFormat: utcFormat$1, - utcParse: utcParse$1, - utcOffset, - utcSequence, - timeFormat: timeFormat$1, - timeParse: timeParse$1, - timeOffset, - timeSequence, - timeUnitSpecifier, - monthFormat, - monthAbbrevFormat, - dayFormat, - dayAbbrevFormat, - quarter, - utcquarter, - week, - utcweek, - dayofyear, - utcdayofyear, - warn, - info, - debug, - extent, - inScope, - intersect: intersect$3, - clampRange, - pinchDistance, - pinchAngle, - screen, - containerSize, - windowSize, - bandspace, - setdata, - pathShape, - panLinear, - panLog, - panPow, - panSymlog, - zoomLinear, - zoomLog, - zoomPow, - zoomSymlog, - encode: encode$1, - modify - }; - - const eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'], // event functions - eventPrefix = 'event.vega.', // event function prefix - thisPrefix = 'this.', // function context prefix - astVisitors = {}; // AST visitors for dependency analysis - - // Build expression function registry - function buildFunctions(codegen) { - const fn = functions(codegen); - eventFunctions.forEach(name => fn[name] = eventPrefix + name); - for (let name in functionContext) { fn[name] = thisPrefix + name; } - extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; - } - - // Register an expression function - function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) { - return functionContext[name]; - } - - // register with the functionContext - functionContext[name] = fn; - - // if there is an astVisitor register that, too - if (visitor) astVisitors[name] = visitor; - - // if the code generator has already been initialized, - // we need to also register the function with it - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; - } - - // register expression functions with ast visitors - expressionFunction('bandwidth', bandwidth, scaleVisitor); - expressionFunction('copy', copy$2, scaleVisitor); - expressionFunction('domain', domain, scaleVisitor); - expressionFunction('range', range$3, scaleVisitor); - expressionFunction('invert', invert, scaleVisitor); - expressionFunction('scale', scale$3, scaleVisitor); - expressionFunction('gradient', scaleGradient, scaleVisitor); - expressionFunction('geoArea', geoArea, scaleVisitor); - expressionFunction('geoBounds', geoBounds, scaleVisitor); - expressionFunction('geoCentroid', geoCentroid, scaleVisitor); - expressionFunction('geoShape', geoShape, scaleVisitor); - expressionFunction('indata', indata, indataVisitor); - expressionFunction('data', data$1, dataVisitor); - expressionFunction('treePath', treePath, dataVisitor); - expressionFunction('treeAncestors', treeAncestors, dataVisitor); - - // register Vega-Lite selection functions - expressionFunction('vlSelectionTest', selectionTest, selectionVisitor); - expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor); - - // Export code generator and parameters - const codegenParams = { - blacklist: ['_'], - whitelist: ['datum', 'event', 'item'], - fieldvar: 'datum', - globalvar: id => '_[' + $(SignalPrefix + id) + ']', - functions: buildFunctions, - constants: constants, - visitors: astVisitors - }; - - var codeGenerator = codegen(codegenParams); - - function parseExpression$1(expr, scope) { - var params = {}, ast, gen; - - // parse the expression to an abstract syntax tree (ast) - try { - expr = isString(expr) ? expr : ($(expr) + ''); - ast = parse$3(expr); - } catch (err) { - error('Expression parse error: ' + expr); - } - - // analyze ast function calls for dependencies - ast.visit(node => { - if (node.type !== CallExpression) return; - var name = node.callee.name, - visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); - }); - - // perform code generation - gen = codeGenerator(ast); - - // collect signal dependencies - gen.globals.forEach(name => { - var signalName = SignalPrefix + name; - if (!hasOwnProperty(params, signalName) && scope.getSignal(name)) { - params[signalName] = scope.signalRef(name); - } - }); - - // return generated expression code and dependencies - return { - $expr: extend({code: gen.code}, scope.options.ast ? {ast} : null), - $fields: gen.fields, - $params: params - }; - } - - /** - * Parse a serialized dataflow specification. - */ - function parse$4(spec) { - const ctx = this, - operators = spec.operators || []; - - // parse background - if (spec.background) { - ctx.background = spec.background; - } - - // parse event configuration - if (spec.eventConfig) { - ctx.eventConfig = spec.eventConfig; - } - - // parse locale configuration - if (spec.locale) { - ctx.locale = spec.locale; - } - - // parse operators - operators.forEach(entry => ctx.parseOperator(entry)); - - // parse operator parameters - operators.forEach(entry => ctx.parseOperatorParameters(entry)); - - // parse streams - (spec.streams || []).forEach(entry => ctx.parseStream(entry)); - - // parse updates - (spec.updates || []).forEach(entry => ctx.parseUpdate(entry)); - - return ctx.resolve(); - } - - const Skip = toSet(['rule']), - Swap = toSet(['group', 'image', 'rect']); - - function adjustSpatial(encode, marktype) { - let code = ''; - - if (Skip[marktype]) return code; - - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) { - code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - } - code += 'o.width=o.x2-o.x;'; - } else { - code += 'o.x=o.x2-(o.width||0);'; - } - } - - if (encode.xc) { - code += 'o.x=o.xc-(o.width||0)/2;'; - } - - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) { - code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - } - code += 'o.height=o.y2-o.y;'; - } else { - code += 'o.y=o.y2-(o.height||0);'; - } - } - - if (encode.yc) { - code += 'o.y=o.yc-(o.height||0)/2;'; - } - - return code; - } - - function canonicalType(type) { - return (type + '').toLowerCase(); - } - - function isOperator(type) { - return canonicalType(type) === 'operator'; - } - - function isCollect(type) { - return canonicalType(type) === 'collect'; - } - - function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (code[code.length-1] !== ';') { - code = 'return(' + code + ');'; - } - var fn = Function.apply(null, args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; - } - - // generate code for comparing a single field - function _compare(u, v, lt, gt) { - return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt} - : (u > v || v == null) && u != null ? ${gt} - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} - : v !== v && u === u ? ${gt} : `; - } - - var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ - operator: (ctx, expr) => expression(ctx, ['_'], expr.code), - - /** - * Parse an expression provided as an operator parameter value. - */ - parameter: (ctx, expr) => expression(ctx, ['datum', '_'], expr.code), - - /** - * Parse an expression applied to an event stream. - */ - event: (ctx, expr) => expression(ctx, ['event'], expr.code), - - /** - * Parse an expression used to handle an event-driven operator update. - */ - handler: (ctx, expr) => { - const code = `var datum=event.item&&event.item.datum;return ${expr.code};`; - return expression(ctx, ['_', 'event'], code); - }, - - /** - * Parse an expression that performs visual encoding. - */ - encode: (ctx, encode) => { - const {marktype, channels} = encode; - - let code = 'var o=item,datum=o.datum,m=0,$;'; - for (const name in channels) { - const o ='o[' + $(name) + ']'; - code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; - } - code += adjustSpatial(channels, marktype); - code += 'return m;'; - - return expression(ctx, ['item', '_'], code); - }, - - /** - * Optimized code generators for access and comparison. - */ - codegen: { - get(path) { - const ref = `[${path.map($).join('][')}]`; - const get = Function('_', `return _${ref};`); - get.path = ref; - return get; - }, - comparator(fields, orders) { - let t; - const map = (f, i) => { - const o = orders[i]; - let u, v; - if (f.path) { - u = `a${f.path}`; - v = `b${f.path}`; - } else { - (t = t || {})['f'+i] = f; - u = `this.f${i}(a)`; - v = `this.f${i}(b)`; - } - return _compare(u, v, -o, o); - }; - - const fn = Function('a', 'b', 'var u, v; return ' - + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } - }; - - /** - * Parse a dataflow operator. - */ - function parseOperator(spec) { - const ctx = this; - if (isOperator(spec.type) || !spec.type) { - ctx.operator( - spec, - spec.update ? ctx.operatorExpression(spec.update) : null - ); - } else { - ctx.transform(spec, spec.type); - } - } - - /** - * Parse and assign operator parameters. - */ - function parseOperatorParameters(spec) { - const ctx = this; - if (spec.params) { - const op = ctx.get(spec.id); - if (!op) error('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters( - ctx.parseParameters(spec.params), - spec.react, - spec.initonly - )); - } - } - - /** - * Parse a set of operator parameters. - */ - function parseParameters(spec, params) { - params = params || {}; - const ctx = this; - - for (const key in spec) { - const value = spec[key]; - params[key] = isArray(value) - ? value.map(v => parseParameter(v, ctx, params)) - : parseParameter(value, ctx, params); - } - - return params; - } - - /** - * Parse a single parameter. - */ - function parseParameter(spec, ctx, params) { - if (!spec || !isObject(spec)) return spec; - - for (let i=0, n=PARSERS.length, p; i (_ && _.$tupleid) ? tupleid : _); - return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen)); - } - - /** - * Resolve an encode operator reference. - */ - function getEncode(_, ctx) { - const spec = _.$encode, - encode = {}; - - for (const name in spec) { - const enc = spec[name]; - encode[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - return encode; - } - - /** - * Resolve a context reference. - */ - function getContext(_, ctx) { - return ctx; - } - - /** - * Resolve a recursive subflow specification. - */ - function getSubflow(_, ctx) { - const spec = _.$subflow; - return function(dataflow, key, parent) { - const subctx = ctx.fork().parse(spec), - op = subctx.get(spec.operators[0].id), - p = subctx.signals.parent; - if (p) p.set(parent); - op.detachSubflow = () => ctx.detach(subctx); - return op; - }; - } - - /** - * Resolve a tuple id reference. - */ - function getTupleId() { - return tupleid; - } - - /** - * Parse an event stream specification. - */ - function parseStream(spec) { - var ctx = this, - filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, - stream = spec.stream != null ? ctx.get(spec.stream) : undefined, - args; - - if (spec.source) { - stream = ctx.events(spec.source, spec.type, filter); - } - else if (spec.merge) { - args = spec.merge.map(_ => ctx.get(_)); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - - if (spec.between) { - args = spec.between.map(_ => ctx.get(_)); - stream = stream.between(args[0], args[1]); - } - - if (spec.filter) { - stream = stream.filter(filter); - } - - if (spec.throttle != null) { - stream = stream.throttle(+spec.throttle); - } - - if (spec.debounce != null) { - stream = stream.debounce(+spec.debounce); - } - - if (stream == null) { - error('Invalid stream definition: ' + JSON.stringify(spec)); - } - - if (spec.consume) stream.consume(true); - - ctx.stream(spec, stream); - } - - /** - * Parse an event-driven operator update. - */ - function parseUpdate(spec) { - var ctx = this, - srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid, - source = ctx.get(srcid), - target = null, - update = spec.update, - params = undefined; - - if (!source) error('Source not defined: ' + spec.source); - - target = spec.target && spec.target.$expr - ? ctx.eventExpression(spec.target.$expr) - : ctx.get(spec.target); - - if (update && update.$expr) { - if (update.$params) { - params = ctx.parseParameters(update.$params); - } - update = ctx.handlerExpression(update.$expr); - } - - ctx.update(spec, source, target, update, params); - } - - var SKIP$3 = {skip: true}; - - function getState(options) { - var ctx = this, - state = {}; - - if (options.signals) { - var signals = (state.signals = {}); - Object.keys(ctx.signals).forEach(key => { - var op = ctx.signals[key]; - if (options.signals(key, op)) { - signals[key] = op.value; - } - }); - } - - if (options.data) { - var data = (state.data = {}); - Object.keys(ctx.data).forEach(key => { - var dataset = ctx.data[key]; - if (options.data(key, dataset)) { - data[key] = dataset.input.value; - } - }); - } - - if (ctx.subcontext && options.recurse !== false) { - state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options)); - } - - return state; - } - - function setState(state) { - var ctx = this, - df = ctx.dataflow, - data = state.data, - signals = state.signals; - - Object.keys(signals || {}).forEach(key => { - df.update(ctx.signals[key], signals[key], SKIP$3); - }); - - Object.keys(data || {}).forEach(key => { - df.pulse( - ctx.data[key].input, - df.changeset().remove(truthy).insert(data[key]) - ); - }); - - (state.subcontext || []).forEach((substate, i) => { - var subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); - } - - /** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ - function context$2(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); - } - - function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, - this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } - } - - function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } - } - - Context.prototype = Subcontext.prototype = { - fork() { - const ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; - }, - detach(ctx) { - this.subcontext = this.subcontext.filter(c => c !== ctx); - - // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - const keys = Object.keys(ctx.nodes); - for (const key of keys) ctx.nodes[key]._targets = null; - for (const key of keys) ctx.nodes[key].detach(); - ctx.nodes = null; - }, - get(id) { - return this.nodes[id]; - }, - set(id, node) { - return this.nodes[id] = node; - }, - add(spec, op) { - const ctx = this, - df = ctx.dataflow, - data = spec.value; - - ctx.set(spec.id, op); - - if (isCollect(spec.type) && data) { - if (data.$ingest) { - df.ingest(op, data.$ingest, data.$format); - } else if (data.$request) { - df.preload(op, data.$request, data.$format); - } else { - df.pulse(op, df.changeset().insert(data)); - } - } - - if (spec.root) { - ctx.root = op; - } - - if (spec.parent) { - var p = ctx.get(spec.parent.$ref); - if (p) { - df.connect(p, [op]); - op.targets().add(p); - } else { - (ctx.unresolved = ctx.unresolved || []).push(() => { - p = ctx.get(spec.parent.$ref); - df.connect(p, [op]); - op.targets().add(p); - }); - } - } - - if (spec.signal) { - ctx.signals[spec.signal] = op; - } - - if (spec.scale) { - ctx.scales[spec.scale] = op; - } - - if (spec.data) { - for (const name in spec.data) { - const data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach(role => data[role] = op); - } - } - }, - resolve() { - (this.unresolved || []).forEach(fn => fn()); - delete this.unresolved; - return this; - }, - operator(spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); - }, - transform(spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); - }, - stream(spec, stream) { - this.set(spec.id, stream); - }, - update(spec, stream, target, update, params) { - this.dataflow.on(stream, target, update, params, spec.options); - }, - - // expression parsing - operatorExpression(expr) { - return this.expr.operator(this, expr); - }, - parameterExpression(expr) { - return this.expr.parameter(this, expr); - }, - eventExpression(expr) { - return this.expr.event(this, expr); - }, - handlerExpression(expr) { - return this.expr.handler(this, expr); - }, - encodeExpression(encode) { - return this.expr.encode(this, encode); - }, - - // parse methods - parse: parse$4, - parseOperator, - parseOperatorParameters, - parseParameters, - parseStream, - parseUpdate, - - // state methods - getState, - setState - }; - - function runtime(view, spec, expr) { - return context$2(view, transforms, functionContext, expr).parse(spec); - } - - function scale$4(name) { - var scales = this._runtime.scales; - if (!hasOwnProperty(scales, name)) { - error('Unrecognized scale or projection: ' + name); - } - return scales[name].value; - } - - var Width = 'width', - Height = 'height', - Padding$1 = 'padding', - Skip$1 = {skip: true}; - - function viewWidth(view, width) { - var a = view.autosize(), - p = view.padding(); - return width - (a && a.contains === Padding$1 ? p.left + p.right : 0); - } - - function viewHeight(view, height) { - var a = view.autosize(), - p = view.padding(); - return height - (a && a.contains === Padding$1 ? p.top + p.bottom : 0); - } - - function initializeResize(view) { - var s = view._signals, - w = s[Width], - h = s[Height], - p = s[Padding$1]; - - function resetSize() { - view._autosize = view._resize = 1; - } - - // respond to width signal - view._resizeWidth = view.add(null, - function(_) { - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, - {size: w} - ); - - // respond to height signal - view._resizeHeight = view.add(null, - function(_) { - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, - {size: h} - ); - - // respond to padding signal - var resizePadding = view.add(null, resetSize, {pad: p}); - - // set rank to run immediately after source signal - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; - } - - function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter(function(view) { - var rerun = 0; - - // reset autosize flag - view._autosize = 0; - - // width value changed: update signal, skip resize op - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip$1); // set width, skip update calc - view._resizeWidth.skip(true); // skip width resize handler - } - - // height value changed: update signal, skip resize op - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip$1); // set height, skip update calc - view._resizeHeight.skip(true); // skip height resize handler - } - - // view width changed: update view property, set resize flag - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } - - // view height changed: update view property, set resize flag - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } - - // origin changed: update view property, set resize flag - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } - - // run dataflow on width/height signal change - if (rerun) view.run('enter'); - if (auto) view.runAfter(v => v.resize()); - }, false, 1); - } - - /** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ - function getState$1(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); - } - - function dataTest(name, data) { - return data.modified - && isArray(data.input.value) - && name.indexOf('_:vega:_'); - } - - function signalTest(name, op) { - return !(name === 'parent' || op instanceof transforms.proxy); - } - - /** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ - function setState$1(state) { - this.runAsync(null, - v => { v._trigger = false; v._runtime.setState(state); }, - v => { v._trigger = true; } - ); - return this; - } - - function timer$1(callback, delay) { - function tick(elapsed) { - callback({timestamp: Date.now(), elapsed: elapsed}); - } - this._timers.push(interval$1(tick, delay)); - } - - function defaultTooltip$1(handler, event, item, value) { - var el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); - } - - function formatTooltip(value) { - return value == null ? '' - : isArray(value) ? formatArray(value) - : isObject(value) && !isDate(value) ? formatObject(value) - : value + ''; - } - - function formatObject(obj) { - return Object.keys(obj).map(function(key) { - var v = obj[key]; - return key + ': ' + (isArray(v) ? formatArray(v) : formatValue$1(v)); - }).join('\n'); - } - - function formatArray(value) { - return '[' + value.map(formatValue$1).join(', ') + ']'; - } - - function formatValue$1(value) { - return isArray(value) ? '[\u2026]' - : isObject(value) && !isDate(value) ? '{\u2026}' - : value; - } - - /** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ - function View(spec, options) { - const view = this; - options = options || {}; - - Dataflow.call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - if (options.locale || spec.locale) { - const loc = extend({}, spec.locale, options.locale); - view.locale(locale$2(loc.number, loc.time)); - } - - view._el = null; - view._elBind = null; - view._renderType = options.renderer || RenderType.Canvas; - view._scenegraph = new Scenegraph(); - const root = view._scenegraph.root; - - // initialize renderer, handler and event management - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip$1, - view._redraw = true; - view._handler = new CanvasHandler().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; - - // initialize event configuration - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); - - // initialize dataflow graph - const ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map(_ => ({ - state: null, - param: extend({}, _) - })); - - // initialize scenegraph - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse( - ctx.data.root.input, - view.changeset().insert(root.items) - ); - - // initialize view size - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [0, 0]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); - - // initialize background color - background$1(view); - - // initialize cursor - cursor(view); - - // initialize view description - view.description(spec.description); - - // initialize hover proessing, if requested - if (options.hover) view.hover(); - - // initialize DOM container(s) and renderer - if (options.container) view.initialize(options.container, options.bind); - } - - var prototype$1s = inherits(View, Dataflow); - - // -- DATAFLOW / RENDERING ---- - - prototype$1s.evaluate = async function(encode, prerun, postrun) { - // evaluate dataflow and prerun - await Dataflow.prototype.evaluate.call(this, encode, prerun); - - // render as needed - if (this._redraw || this._resize) { - try { - if (this._renderer) { - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - await this._renderer.renderAsync(this._scenegraph.root); - } - this._redraw = false; - } catch (e) { - this.error(e); - } - } - - // evaluate postrun - if (postrun) asyncCallback(this, postrun); - - return this; - }; - - prototype$1s.dirty = function(item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); - }; - - // -- GET / SET ---- - - prototype$1s.description = function(text) { - if (arguments.length) { - const desc = text != null ? (text + '') : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - return this._desc; - }; - - prototype$1s.container = function() { - return this._el; - }; - - prototype$1s.scenegraph = function() { - return this._scenegraph; - }; - - prototype$1s.origin = function() { - return this._origin.slice(); - }; - - function lookupSignal(view, name) { - return hasOwnProperty(view._signals, name) - ? view._signals[name] - : error('Unrecognized signal name: ' + $(name)); - } - - prototype$1s.signal = function(name, value, options) { - var op = lookupSignal(this, name); - return arguments.length === 1 - ? op.value - : this.update(op, value, options); - }; - - prototype$1s.width = function(_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); - }; - - prototype$1s.height = function(_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); - }; - - prototype$1s.padding = function(_) { - return arguments.length - ? this.signal('padding', padding(_)) - : padding(this.signal('padding')); - }; - - prototype$1s.autosize = function(_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); - }; - - prototype$1s.background = function(_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); - }; - - prototype$1s.renderer = function(type) { - if (!arguments.length) return this._renderType; - if (!renderModule(type)) error('Unrecognized renderer type: ' + type); - if (type !== this._renderType) { - this._renderType = type; - this._resetRenderer(); - } - return this; - }; - - prototype$1s.tooltip = function(handler) { - if (!arguments.length) return this._tooltip; - if (handler !== this._tooltip) { - this._tooltip = handler; - this._resetRenderer(); - } - return this; - }; - - prototype$1s.loader = function(loader) { - if (!arguments.length) return this._loader; - if (loader !== this._loader) { - Dataflow.prototype.loader.call(this, loader); - this._resetRenderer(); - } - return this; - }; - - prototype$1s.resize = function() { - // set flag to perform autosize - this._autosize = 1; - // touch autosize signal to ensure top-level ViewLayout runs - return this.touch(lookupSignal(this, 'autosize')); - }; - - prototype$1s._resetRenderer = function() { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } - }; - - // -- SIZING ---- - prototype$1s._resizeView = resizeView; - - // -- EVENT HANDLING ---- - - prototype$1s.addEventListener = function(type, handler, options) { - var callback = handler; - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - this._handler.on(type, callback); - return this; - }; - - prototype$1s.removeEventListener = function(type, handler) { - var handlers = this._handler.handlers(type), - i = handlers.length, h, t; - - // search registered handlers, remove if match found - while (--i >= 0) { - t = handlers[i].type; - h = handlers[i].handler; - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - break; - } - } - return this; - }; - - prototype$1s.addResizeListener = function(handler) { - var l = this._resizeListeners; - if (l.indexOf(handler) < 0) { - // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - } - return this; - }; - - prototype$1s.removeResizeListener = function(handler) { - var l = this._resizeListeners, - i = l.indexOf(handler); - if (i >= 0) { - l.splice(i, 1); - } - return this; - }; - - function findOperatorHandler(op, handler) { - const h = (op._targets || []) - .filter(op => op._update && op._update.handler === handler); - return h.length ? h[0] : null; - } - - function addOperatorListener(view, name, op, handler) { - var h = findOperatorHandler(op, handler); - if (!h) { - h = trap(view, () => handler(name, op.value)); - h.handler = handler; - view.on(op, null, h); - } - return view; - } - - function removeOperatorListener(view, op, handler) { - var h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; - } - - prototype$1s.addSignalListener = function(name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); - }; - - prototype$1s.removeSignalListener = function(name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); - }; - - prototype$1s.addDataListener = function(name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); - }; - - prototype$1s.removeDataListener = function(name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); - }; - - prototype$1s.globalCursor = function(_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - const prev = setCursor(this, null); // clear previous cursor - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - return this; - } else { - return this._globalCursor; - } - }; - - prototype$1s.preventDefault = function(_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else { - return this._preventDefault; - } - }; - - prototype$1s.timer = timer$1; - prototype$1s.events = events$1; - prototype$1s.finalize = finalize; - prototype$1s.hover = hover; - - // -- DATA ---- - prototype$1s.data = data; - prototype$1s.change = change; - prototype$1s.insert = insert; - prototype$1s.remove = remove; - - // -- SCALES -- - prototype$1s.scale = scale$4; - - // -- INITIALIZATION ---- - prototype$1s.initialize = initialize$1; - - // -- HEADLESS RENDERING ---- - prototype$1s.toImageURL = renderToImageURL; - prototype$1s.toCanvas = renderToCanvas; - prototype$1s.toSVG = renderToSVG; - - // -- SAVE / RESTORE STATE ---- - prototype$1s.getState = getState$1; - prototype$1s.setState = setState$1; - - function parseAutosize(spec) { - return isObject(spec) ? spec : {type: spec || 'pad'}; - } - - const number$6 = _ => +_ || 0; - - const paddingObject$1 = _ => ({top: _, bottom: _, left: _, right: _}); - - function parsePadding(spec) { - return !isObject(spec) ? paddingObject$1(number$6(spec)) - : spec.signal ? spec - : { - top: number$6(spec.top), - bottom: number$6(spec.bottom), - left: number$6(spec.left), - right: number$6(spec.right) - }; - } - - const encoder = _ => isObject(_) && !isArray(_) - ? extend({}, _) - : {value: _}; - - function addEncode(object, name, value, set) { - if (value != null) { - // Always assign signal to update, even if the signal is from the enter block - if (isObject(value) && !isArray(value)) { - object.update[name] = value; - } else { - object[set || 'enter'][name] = {value: value}; - } - return 1; - } else { - return 0; - } - } - - function addEncoders(object, enter, update) { - for (const name in enter) { - addEncode(object, name, enter[name]); - } - for (const name in update) { - addEncode(object, name, update[name], 'update'); - } - } - - function extendEncode(encode, extra, skip) { - for (const name in extra) { - if (skip && hasOwnProperty(skip, name)) continue; - encode[name] = extend(encode[name] || {}, extra[name]); - } - return encode; - } - - function has(key, encode) { - return encode && ( - (encode.enter && encode.enter[key]) || - (encode.update && encode.update[key]) - ); - } - - var MarkRole = 'mark'; - var FrameRole$1 = 'frame'; - var ScopeRole$1 = 'scope'; - - var AxisRole$1 = 'axis'; - var AxisDomainRole = 'axis-domain'; - var AxisGridRole = 'axis-grid'; - var AxisLabelRole = 'axis-label'; - var AxisTickRole = 'axis-tick'; - var AxisTitleRole = 'axis-title'; - - var LegendRole$1 = 'legend'; - var LegendBandRole = 'legend-band'; - var LegendEntryRole = 'legend-entry'; - var LegendGradientRole = 'legend-gradient'; - var LegendLabelRole = 'legend-label'; - var LegendSymbolRole = 'legend-symbol'; - var LegendTitleRole = 'legend-title'; - - var TitleRole$1 = 'title'; - var TitleTextRole = 'title-text'; - var TitleSubtitleRole = 'title-subtitle'; - - function applyDefaults(encode, type, role, style, config) { - const defaults = {}, enter = {}; - let update, key, skip, props; - - // if text mark, apply global lineBreak settings (#2370) - key = 'lineBreak'; - if (type === 'text' && config[key] != null && !has(key, encode)) { - applyDefault(defaults, key, config[key]); - } - - // ignore legend and axis roles - if (role == 'legend' || String(role).startsWith('axis')) { - role = null; - } - - // resolve mark config - props = role === FrameRole$1 ? config.group - : (role === MarkRole) ? extend({}, config.mark, config[type]) - : null; - - for (key in props) { - // do not apply defaults if relevant fields are defined - skip = has(key, encode) - || (key === 'fill' || key === 'stroke') - && (has('fill', encode) || has('stroke', encode)); - - if (!skip) applyDefault(defaults, key, props[key]); - } - - // resolve styles, apply with increasing precedence - array(style).forEach(name => { - const props = config.style && config.style[name]; - for (const key in props) { - if (!has(key, encode)) { - applyDefault(defaults, key, props[key]); - } - } - }); - - encode = extend({}, encode); // defensive copy - for (key in defaults) { - props = defaults[key]; - if (props.signal) { - (update = update || {})[key] = props; - } else { - enter[key] = props; - } - } - - encode.enter = extend(enter, encode.enter); - if (update) encode.update = extend(update, encode.update); - - return encode; - } - - function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal - ? {signal: value.signal} - : {value: value}; - } - - const scaleRef = scale => isString(scale) ? $(scale) - : scale.signal ? `(${scale.signal})` - : field$1(scale); - - function entry(enc) { - if (enc.gradient != null) { - return gradient$1(enc); - } - - let value = enc.signal ? `(${enc.signal})` - : enc.color ? color$2(enc.color) - : enc.field != null ? field$1(enc.field) - : enc.value !== undefined ? $(enc.value) - : undefined; - - if (enc.scale != null) { - value = scale$5(enc, value); - } - - if (value === undefined) { - value = null; - } - - if (enc.exponent != null) { - value = `pow(${value},${property(enc.exponent)})`; - } - - if (enc.mult != null) { - value += `*${property(enc.mult)}`; - } - - if (enc.offset != null) { - value += `+${property(enc.offset)}`; - } - - if (enc.round) { - value = `round(${value})`; - } - - return value; - } - - const _color = (type, x, y, z) => - `(${type}(${[x, y, z].map(entry).join(',')})+'')`; - - function color$2(enc) { - return (enc.c) ? _color('hcl', enc.h, enc.c, enc.l) - : (enc.h || enc.s) ? _color('hsl', enc.h, enc.s, enc.l) - : (enc.l || enc.a) ? _color('lab', enc.l, enc.a, enc.b) - : (enc.r || enc.g || enc.b) ? _color('rgb', enc.r, enc.g, enc.b) - : null; - } - - function gradient$1(enc) { - // map undefined to null; expression lang does not allow undefined - const args = [enc.start, enc.stop, enc.count] - .map(_ => _ == null ? null : $(_)); - - // trim null inputs from the end - while (args.length && peek(args) == null) args.pop(); - - args.unshift(scaleRef(enc.gradient)); - return `gradient(${args.join(',')})`; - } - - function property(property) { - return isObject(property) ? '(' + entry(property) + ')' : property; - } - - function field$1(ref) { - return resolveField(isObject(ref) ? ref : {datum: ref}); - } - - function resolveField(ref) { - let object, level, field; - - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - - while (level-- > 0) { - object += '.mark.group'; - } - - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else { - field = ref.group; - } - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else { - error('Invalid field reference: ' + $(ref)); - } - - if (!ref.signal) { - field = isString(field) - ? splitAccessPath(field).map($).join('][') - : resolveField(field); - } - - return object + '[' + field + ']'; - } - - function scale$5(enc, value) { - const scale = scaleRef(enc.scale); - - if (enc.range != null) { - // pull value from scale range - value = `lerp(_range(${scale}), ${+enc.range})`; - } else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = `_scale(${scale}, ${value})`; - - if (enc.band) { - value = (value ? value + '+' : '') - + `_bandwidth(${scale})` - + (+enc.band === 1 ? '' : '*' + property(enc.band)); - - if (enc.extra) { - // include logic to handle extraneous elements - value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`; - } - } - - if (value == null) value = '0'; - } - - return value; - } - - function rule$1(enc) { - let code = ''; - - enc.forEach(rule => { - const value = entry(rule); - code += rule.test ? `(${rule.test})?${value}:` : value; - }); - - // if no else clause, terminate with null (#1366) - if (peek(code) === ':') { - code += 'null'; - } - - return code; - } - - function parseEncode(encode, type, role, style, scope, params) { - const enc = {}; - params = params || {}; - params.encoders = {$encode: enc}; - - encode = applyDefaults(encode, type, role, style, scope.config); - for (const key in encode) { - enc[key] = parseBlock(encode[key], type, params, scope); - } - - return params; - } - - function parseBlock(block, marktype, params, scope) { - const channels = {}, - fields = {}; - - for (const name in block) { - if (block[name] != null) { // skip any null entries - channels[name] = parse$5(expr(block[name]), scope, params, fields); - } - } - - return { - $expr: {marktype, channels}, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; - } - - function expr(enc) { - return isArray(enc) ? rule$1(enc) : entry(enc); - } - - function parse$5(code, scope, params, fields) { - const expr = parseExpression$1(code, scope); - expr.$fields.forEach(name => fields[name] = 1); - extend(params, expr.$params); - return expr.$expr; - } - - var OUTER = 'outer', - OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind']; - - function outerError(prefix, name) { - error(prefix + ' for "outer" push: ' + $(name)); - } - - function parseSignal(signal, scope) { - var name = signal.name; - - if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); - // signal push must not use properties reserved for standard definition - OUTER_INVALID.forEach(function(prop) { - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); - } else { - // define a new signal in the current scope - var op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); - } - } - - function Entry(type, value, params, parent) { - this.id = -1; - this.type = type; - this.value = value; - this.params = params; - if (parent) this.parent = parent; - } - - function entry$1(type, value, params, parent) { - return new Entry(type, value, params, parent); - } - - function operator(value, params) { - return entry$1('operator', value, params); - } - - // ----- - - function ref(op) { - var ref = {$ref: op.id}; - // if operator not yet registered, cache ref to resolve later - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; - } - - function fieldRef(field, name) { - return name ? {$field: field, $name: name} : {$field: field}; - } - - var keyFieldRef = fieldRef('key'); - - function compareRef(fields, orders) { - return {$compare: fields, $order: orders}; - } - - function keyRef(fields, flat) { - var ref = {$key: fields}; - if (flat) ref.$flat = true; - return ref; - } - - // ----- - - var Ascending = 'ascending'; - - var Descending = 'descending'; - - function sortKey(sort) { - return !isObject(sort) ? '' - : (sort.order === Descending ? '-' : '+') - + aggrField(sort.op, sort.field); - } - - function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') - + (op && field ? '_' : '') - + (field && field.signal ? '$' + field.signal : field || ''); - } - - // ----- - - var Scope = 'scope'; - - var View$1 = 'view'; - - function isSignal(_) { - return _ && _.signal; - } - - function isExpr(_) { - return _ && _.expr; - } - - function hasSignal(_) { - if (isSignal(_)) return true; - if (isObject(_)) for (var key in _) { - if (hasSignal(_[key])) return true; - } - return false; - } - - function value$2(specValue, defaultValue) { - return specValue != null ? specValue : defaultValue; - } - - function deref(v) { - return v && v.signal || v; - } - - var Timer$1 = 'timer'; - - function parseStream$1(stream, scope) { - var method = stream.merge ? mergeStream - : stream.stream ? nestedStream - : stream.type ? eventStream - : error('Invalid stream specification: ' + $(stream)); - - return method(stream, scope); - } - - function eventSource(source) { - return source === Scope ? View$1 : (source || View$1); - } - - function mergeStream(stream, scope) { - var list = stream.merge.map(s => parseStream$1(s, scope)), - entry = streamParameters({merge: list}, stream, scope); - return scope.addStream(entry).id; - } - - function nestedStream(stream, scope) { - var id = parseStream$1(stream.stream, scope), - entry = streamParameters({stream: id}, stream, scope); - return scope.addStream(entry).id; - } - - function eventStream(stream, scope) { - var id, entry; - - if (stream.type === Timer$1) { - id = scope.event(Timer$1, stream.throttle); - stream = {between: stream.between, filter: stream.filter}; - } else { - id = scope.event(eventSource(stream.source), stream.type); - } - - entry = streamParameters({stream: id}, stream, scope); - return Object.keys(entry).length === 1 - ? id - : scope.addStream(entry).id; - } - - function streamParameters(entry, stream, scope) { - var param = stream.between; - - if (param) { - if (param.length !== 2) { - error('Stream "between" parameter must have 2 entries: ' + $(stream)); - } - entry.between = [ - parseStream$1(param[0], scope), - parseStream$1(param[1], scope) - ]; - } - - param = stream.filter ? [].concat(stream.filter) : []; - if (stream.marktype || stream.markname || stream.markrole) { - // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - } - if (stream.source === Scope) { - // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - } - if (param.length) { - entry.filter = parseExpression$1('(' + param.join(')&&(') + ')', scope).$expr; - } - - if ((param = stream.throttle) != null) { - entry.throttle = +param; - } - - if ((param = stream.debounce) != null) { - entry.debounce = +param; - } - - if (stream.consume) { - entry.consume = true; - } - - return entry; - } - - function filterMark(type, name, role) { - var item = 'event.item'; - return item - + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') - + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') - + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); - } - - /** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ - function selector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW$1; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); - } - - var VIEW$1 = 'view', - LBRACK = '[', - RBRACK = ']', - LBRACE = '{', - RBRACE = '}', - COLON = ':', - COMMA = ',', - NAME = '@', - GT = '>', - ILLEGAL$1 = /[[\]{}]/, - DEFAULT_SOURCE, - MARKS, - DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 - }; - - function isMarkType(type) { - return MARKS[type]; - } - - function find$2(s, i, endChar, pushChar, popChar) { - var count = 0, - n = s.length, - c; - for (; i= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - return i; - } - - function parseMerge(s) { - var output = [], - start = 0, - n = s.length, - i = 0; - - while (i < n) { - i = find$2(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - - if (output.length === 0) { - throw 'Empty event selector: ' + s; - } - return output; - } - - function parseSelector(s) { - return s[0] === '[' - ? parseBetween(s) - : parseStream$2(s); - } - - function parseBetween(s) { - var n = s.length, - i = 1, - b, stream; - - i = find$2(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) { - throw 'Empty between selector: ' + s; - } - - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) { - throw 'Between selector must have two elements: ' + s; - } - - s = s.slice(i + 1).trim(); - if (s[0] !== GT) { - throw 'Expected \'>\' after between selector: ' + s; - } - - b = b.map(parseSelector); - - stream = parseSelector(s.slice(1).trim()); - if (stream.between) { - return { - between: b, - stream: stream - }; - } else { - stream.between = b; - } - - return stream; - } - - function parseStream$2(s) { - var stream = {source: DEFAULT_SOURCE}, - source = [], - throttle = [0, 0], - markname = 0, - start = 0, - n = s.length, - i = 0, j, - filter; - - // extract throttle from end - if (s[n-1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i+1, n-1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - - if (!n) throw s; - - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - - // extract first part of multi-part stream selector - j = find$2(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } - - // extract remaining part of stream selector - i = find$2(s, i, LBRACK); - if (i === n) { - source.push(s.substring(start, n).trim()); - } else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - - // extract filters - while (i < n) { - i = find$2(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n-1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - - // marshall event stream specification - if (!(n = source.length) || ILLEGAL$1.test(source[n-1])) { - throw 'Invalid event selector: ' + s; - } - - if (n > 1) { - stream.type = source[1]; - if (markname) { - stream.markname = source[0].slice(1); - } else if (isMarkType(source[0])) { - stream.marktype = source[0]; - } else { - stream.source = source[0]; - } - } else { - stream.type = source[0]; - } - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - - return stream; - } - - function parseThrottle(s) { - var a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map(function(_) { - var x = +_; - if (x !== x) throw s; - return x; - }); - } - - // bypass expression parser for internal operator references - const OP_VALUE_EXPR = { - code: '_.$value', - ast: {type: 'Identifier', value: 'value'} - }; - - function parseUpdate$1(spec, scope, target) { - var events = spec.events, - update = spec.update, - encode = spec.encode, - sources = [], - entry = {target: target}; - - if (!events) { - error('Signal update missing events specification.'); - } - - // interpret as an event selector string - if (isString(events)) { - events = selector(events, scope.isSubscope() ? Scope : View$1); - } - - // separate event streams from signal updates - events = array(events) - .filter(s => s.signal || s.scale ? (sources.push(s), 0) : 1); - - // merge internal operator listeners - if (sources.length > 1) { - sources = [mergeSources(sources)]; - } - - // merge event streams, include as source - if (events.length) { - sources.push(events.length > 1 ? {merge: events} : events[0]); - } - - if (encode != null) { - if (update) error('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + $(encode) + ')'; - } - - // resolve update value - entry.update = isString(update) ? parseExpression$1(update, scope) - : update.expr != null ? parseExpression$1(update.expr, scope) - : update.value != null ? update.value - : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: {$value: scope.signalRef(update.signal)} - } - : error('Invalid signal update specification.'); - - if (spec.force) { - entry.options = {force: true}; - } - - sources.forEach(function(source) { - scope.addUpdate(extend(streamSource(source, scope), entry)); - }); - } - - function streamSource(stream, scope) { - return { - source: stream.signal ? scope.signalRef(stream.signal) - : stream.scale ? scope.scaleRef(stream.scale) - : parseStream$1(stream, scope) - }; - } - - function mergeSources(sources) { - return { - signal: '[' - + sources.map(s => s.scale ? 'scale("' + s.scale + '")' : s.signal) - + ']' - }; - } - - function parseSignalUpdates(signal, scope) { - var op = scope.getSignal(signal.name), - expr = signal.update; - - if (signal.init) { - if (expr) { - error('Signals can not include both init and update expressions.'); - } else { - expr = signal.init; - op.initonly = true; - } - } - - if (expr) { - expr = parseExpression$1(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - - if (signal.on) { - signal.on.forEach(function(_) { - parseUpdate$1(_, scope, op.id); - }); - } - } - - const transform$3 = name => (params, value, parent) => - entry$1(name, value, params || undefined, parent); - - var Aggregate$1 = transform$3('aggregate'); - var AxisTicks$1 = transform$3('axisticks'); - var Bound$1 = transform$3('bound'); - var Collect$1 = transform$3('collect'); - var Compare$1 = transform$3('compare'); - var DataJoin$1 = transform$3('datajoin'); - var Encode$1 = transform$3('encode'); - var Expression$1 = transform$3('expression'); - var Facet$1 = transform$3('facet'); - var Field$1 = transform$3('field'); - var Key$1 = transform$3('key'); - var LegendEntries$1 = transform$3('legendentries'); - var Load$1 = transform$3('load'); - var Mark$1 = transform$3('mark'); - var MultiExtent$1 = transform$3('multiextent'); - var MultiValues$1 = transform$3('multivalues'); - var Overlap$1 = transform$3('overlap'); - var Params$2 = transform$3('params'); - var PreFacet$1 = transform$3('prefacet'); - var Projection$1 = transform$3('projection'); - var Proxy$1 = transform$3('proxy'); - var Relay$1 = transform$3('relay'); - var Render$1 = transform$3('render'); - var Scale$1 = transform$3('scale'); - var Sieve$1 = transform$3('sieve'); - var SortItems$1 = transform$3('sortitems'); - var ViewLayout$1 = transform$3('viewlayout'); - var Values$1 = transform$3('values'); - - var FIELD_REF_ID = 0; - - var MULTIDOMAIN_SORT_OPS = {min: 'min', max: 'max', count: 'sum'}; - - function initScale(spec, scope) { - var type = spec.type || 'linear'; - - if (!isValidScaleType(type)) { - error('Unrecognized scale type: ' + $(type)); - } - - scope.addScale(spec.name, { - type: type, - domain: undefined - }); - } - - function parseScale(spec, scope) { - var params = scope.getScale(spec.name).params, - key; - - params.domain = parseScaleDomain(spec.domain, spec, scope); - - if (spec.range != null) { - params.range = parseScaleRange(spec, scope, params); - } - - if (spec.interpolate != null) { - parseScaleInterpolate(spec.interpolate, params); - } - - if (spec.nice != null) { - params.nice = parseScaleNice(spec.nice); - } - - if (spec.bins != null) { - params.bins = parseScaleBins(spec.bins, scope); - } - - for (key in spec) { - if (hasOwnProperty(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } - } - - function parseLiteral(v, scope) { - return !isObject(v) ? v - : v.signal ? scope.signalRef(v.signal) - : error('Unsupported object: ' + $(v)); - } - - function parseArray(v, scope) { - return v.signal - ? scope.signalRef(v.signal) - : v.map(v => parseLiteral(v, scope)); - } - - function dataLookupError(name) { - error('Can not find data set: ' + $(name)); - } - - // -- SCALE DOMAIN ---- - - function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) { - error('No scale domain defined for domainMin/domainMax to override.'); - } - return; // default domain - } - - return domain.signal ? scope.signalRef(domain.signal) - : (isArray(domain) ? explicitDomain - : domain.fields ? multipleDomain - : singularDomain)(domain, spec, scope); - } - - function explicitDomain(domain, spec, scope) { - return domain.map(function(v) { - return parseLiteral(v, scope); - }); - } - - function singularDomain(domain, spec, scope) { - var data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - - return isDiscrete(spec.type) - ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) - : isQuantile(spec.type) ? data.domainRef(scope, domain.field) - : data.extentRef(scope, domain.field); - } - - function multipleDomain(domain, spec, scope) { - var data = domain.data, - fields = domain.fields.reduce(function(dom, d) { - d = isString(d) ? {data: data, field: d} - : (isArray(d) || d.signal) ? fieldRef$1(d, scope) - : d; - dom.push(d); - return dom; - }, []); - - return (isDiscrete(spec.type) ? ordinalMultipleDomain - : isQuantile(spec.type) ? quantileMultipleDomain - : numericMultipleDomain)(domain, scope, fields); - } - - function fieldRef$1(data, scope) { - var name = '_:vega:_' + (FIELD_REF_ID++), - coll = Collect$1({}); - - if (isArray(data)) { - coll.value = {$ingest: data}; - } else if (data.signal) { - var code = 'setdata(' + $(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - scope.addDataPipeline(name, [coll, Sieve$1({})]); - return {data: name, field: 'data'}; - } - - function ordinalMultipleDomain(domain, scope, fields) { - var sort = parseSort(domain.sort, true), - counts, p, a, c, v; - - // get value counts for each domain field - counts = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); - }); - - // aggregate the results from each domain field - p = {groupby: keyFieldRef, pulse: counts}; - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [MULTIDOMAIN_SORT_OPS[a]]; - p.fields = [scope.fieldRef(v)]; - p.as = [v]; - } - a = scope.add(Aggregate$1(p)); - - // collect aggregate output - c = scope.add(Collect$1({pulse: ref(a)})); - - // extract values for combined domain - v = scope.add(Values$1({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) - })); - - return ref(v); - } - - function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if (isObject(sort)) sort.field = 'key'; - else sort = {field: 'key'}; - } else if (!sort.field && sort.op !== 'count') { - error('No field provided for sort aggregate op: ' + sort.op); - } else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) { - error('Multiple domain scales can not be sorted using ' + sort.op); - } - } - } - return sort; - } - - function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - var values = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); - }); - - // combine value arrays - return ref(scope.add(MultiValues$1({values: values}))); - } - - function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - var extents = fields.map(function(f) { - var data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); - }); - - // combine extents - return ref(scope.add(MultiExtent$1({extents: extents}))); - } - - // -- SCALE BINS ----- - - function parseScaleBins(v, scope) { - return v.signal || isArray(v) - ? parseArray(v, scope) - : scope.objectProperty(v); - } - - // -- SCALE NICE ----- - - function parseScaleNice(nice) { - return isObject(nice) - ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } - : parseLiteral(nice); - } - - // -- SCALE INTERPOLATION ----- - - function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - if (interpolate.gamma != null) { - params.interpolateGamma = parseLiteral(interpolate.gamma); - } - } - - // -- SCALE RANGE ----- - - function parseScaleRange(spec, scope, params) { - var range = spec.range, - config = scope.config.range; - - if (range.signal) { - return scope.signalRef(range.signal); - } else if (isString(range)) { - if (config && hasOwnProperty(config, range)) { - spec = extend({}, spec, {range: config[range]}); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') { - range = [0, {signal: 'width'}]; - } else if (range === 'height') { - range = isDiscrete(spec.type) - ? [0, {signal: 'height'}] - : [{signal: 'height'}, 0]; - } else { - error('Unrecognized scale range value: ' + $(range)); - } - } else if (range.scheme) { - params.scheme = isArray(range.scheme) - ? parseArray(range.scheme, scope) - : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if (isDiscrete(spec.type) && !isArray(range)) { - return parseScaleDomain(range, spec, scope); - } else if (!isArray(range)) { - error('Unsupported range type: ' + $(range)); - } - - return range.map(v => (isArray(v) ? parseArray : parseLiteral)(v, scope)); - } - - function parseProjection(proj, scope) { - var config = scope.config.projection || {}, - params = {}; - - for (var name in proj) { - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } - - // apply projection defaults from config - for (name in config) { - if (params[name] == null) { - params[name] = parseParameter$1(config[name], name, scope); - } - } - - scope.addProjection(proj.name, params); - } - - function parseParameter$1(_, name, scope) { - return isArray(_) ? _.map(function(_) { return parseParameter$1(_, name, scope); }) - : !isObject(_) ? _ - : _.signal ? scope.signalRef(_.signal) - : name === 'fit' ? _ - : error('Unsupported parameter object: ' + $(_)); - } - - const Top$1 = 'top'; - const Left$1 = 'left'; - const Right$1 = 'right'; - const Bottom$1 = 'bottom'; - const Center$1 = 'center'; - - const Vertical = 'vertical'; - - const Start$1 = 'start'; - const Middle$1 = 'middle'; - const End$1 = 'end'; - - const Index = 'index'; - const Label = 'label'; - const Offset = 'offset'; - const Perc = 'perc'; - const Perc2 = 'perc2'; - const Value = 'value'; - - const GuideLabelStyle = 'guide-label'; - const GuideTitleStyle = 'guide-title'; - const GroupTitleStyle = 'group-title'; - const GroupSubtitleStyle = 'group-subtitle'; - - const Symbols$1 = 'symbol'; - const Gradient$1 = 'gradient'; - const Discrete$1 = 'discrete'; - - const Size = 'size'; - const Shape = 'shape'; - const Fill = 'fill'; - const Stroke = 'stroke'; - const StrokeWidth = 'strokeWidth'; - const StrokeDash = 'strokeDash'; - const Opacity = 'opacity'; - - // Encoding channels supported by legends - // In priority order of 'canonical' scale - const LegendScales = [ - Size, - Shape, - Fill, - Stroke, - StrokeWidth, - StrokeDash, - Opacity - ]; - - const Skip$2 = { - name: 1, - style: 1, - interactive: 1 - }; - - const zero$2 = {value: 0}; - const one$2 = {value: 1}; - - var GroupMark = 'group'; - var RectMark = 'rect'; - var RuleMark = 'rule'; - var SymbolMark = 'symbol'; - var TextMark = 'text'; - - function guideGroup(mark) { - mark.type = GroupMark; - mark.interactive = mark.interactive || false; - return mark; - } - - function lookup$5(spec, config) { - const _ = (name, dflt) => value$2(spec[name], value$2(config[name], dflt)); - - _.isVertical = s => Vertical === value$2( - spec.direction, - config.direction || (s ? config.symbolDirection : config.gradientDirection) - ); - - _.gradientLength = () => value$2( - spec.gradientLength, - config.gradientLength || config.gradientWidth - ); - - _.gradientThickness = () => value$2( - spec.gradientThickness, - config.gradientThickness || config.gradientHeight - ); - - _.entryColumns = () => value$2( - spec.columns, - value$2(config.columns, +_.isVertical(true)) - ); - - return _; - } - - function getEncoding(name, encode) { - var v = encode && ( - (encode.update && encode.update[name]) || - (encode.enter && encode.enter[name]) - ); - return v && v.signal ? v : v ? v.value : null; - } - - function getStyle(name, scope, style) { - var s = scope.config.style[style]; - return s && s[name]; - } - - function anchorExpr(s, e, m) { - return `item.anchor === '${Start$1}' ? ${s} : item.anchor === '${End$1}' ? ${e} : ${m}`; - } - - const alignExpr = anchorExpr( - $(Left$1), - $(Right$1), - $(Center$1) - ); - - function tickBand(_) { - let v = _('tickBand'), - offset = _('tickOffset'), - band, extra; - - if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); - } else if (v.signal) { - // if signal, augment code to interpret values - band = {signal: `(${v.signal}) === 'extent' ? 1 : 0.5`}; - extra = {signal: `(${v.signal}) === 'extent'`}; - if (!isObject(offset)) { - offset = {signal: `(${v.signal}) === 'extent' ? 0 : ${offset}`}; - } - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; - } else { - band = 0.5; - extra = false; - } - - return {extra, band, offset}; - } - - function extendOffset(value, offset) { - return !offset ? value - : !value ? offset - : !isObject(value) ? { value, offset } - : Object.assign({}, value, { offset: extendOffset(value.offset, offset) }); - } - - function guideMark(mark, extras) { - if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip$2); - } else { - mark.interactive = false; - } - return mark; - } - - function legendGradient(spec, scale, config, userEncode) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, start, stop, width, height; - - if (vertical) { - start = [0, 1]; - stop = [0, 0]; - width = thickness; - height = length; - } else { - start = [0, 0]; - stop = [1, 0]; - width = length; - height = thickness; - } - - encode = { - enter: enter = { - opacity: zero$2, - x: zero$2, - y: zero$2, - width: encoder(width), - height: encoder(height) - }, - update: extend({}, enter, { - opacity: one$2, - fill: {gradient: scale, start: start, stop: stop} - }), - exit: { - opacity: zero$2 - } - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode - }, userEncode); - } - - function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = _.gradientThickness(), - length = _.gradientLength(), - encode, enter, u, v, uu, vv, adjust = ''; - - vertical - ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') - : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); - - enter = { - opacity: zero$2, - fill: {scale: scale, field: Value} - }; - enter[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - enter[v] = zero$2; - enter[uu] = {signal: adjust + 'datum.' + Perc2, mult: length}; - enter[vv] = encoder(thickness); - - encode = { - enter: enter, - update: extend({}, enter, {opacity: one$2}), - exit: {opacity: zero$2} - }; - - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') - }, { // update - opacity: _('gradientOpacity') - }); - - return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode - }, userEncode); - } - - const alignExpr$1 = `datum.${Perc}<=0?"${Left$1}":datum.${Perc}>=1?"${Right$1}":"${Center$1}"`, - baselineExpr = `datum.${Perc}<=0?"${Bottom$1}":datum.${Perc}>=1?"${Top$1}":"${Middle$1}"`; - - function legendGradientLabels(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - vertical = _.isVertical(), - thickness = encoder(_.gradientThickness()), - length = _.gradientLength(), - overlap = _('labelOverlap'), - encode, enter, update, u, v, adjust = ''; - - encode = { - enter: enter = { - opacity: zero$2 - }, - update: update = { - opacity: one$2, - text: {field: Label} - }, - exit: { - opacity: zero$2 - } - }; - - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value$2(spec.labelLimit, config.gradientLabelLimit) - }); - - if (vertical) { - enter.align = {value: 'left'}; - enter.baseline = update.baseline = {signal: baselineExpr}; - u = 'y'; v = 'x'; adjust = '1-'; - } else { - enter.align = update.align = {signal: alignExpr$1}; - enter.baseline = {value: 'top'}; - u = 'x'; v = 'y'; - } - - enter[u] = update[u] = {signal: adjust + 'datum.' + Perc, mult: length}; - - enter[v] = update[v] = thickness; - thickness.offset = value$2(spec.labelOffset, config.gradientLabelOffset) || 0; - - overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; - - // type, role, style, key, dataRef, encode, extras - return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); - } - - // userEncode is top-level, includes entries, symbols, labels - function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - var _ = lookup$5(spec, config), - entries = userEncode.entries, - interactive = !!(entries && entries.interactive), - name = entries ? entries.name : undefined, - height = _('clipHeight'), - symbolOffset = _('symbolOffset'), - valueRef = {data: 'value'}, - encode = {}, - xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, - yEncode = height ? encoder(height) : {field: Size}, - index = `datum.${Index}`, - ncols = `max(1, ${columns})`, - enter, update, labelOffset, symbols, labels, nrows, sort; - - yEncode.mult = 0.5; - - // -- LEGEND SYMBOLS -- - encode = { - enter: enter = { - opacity: zero$2, - x: {signal: xSignal, mult: 0.5, offset: symbolOffset}, - y: yEncode - }, - update: update = { - opacity: one$2, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$2 - } - }; - - var baseFill = null, - baseStroke = null; - if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') - }, { // update - opacity: _('symbolOpacity') - }); - - LegendScales.forEach(function(scale) { - if (spec[scale]) { - update[scale] = enter[scale] = {scale: spec[scale], field: Value}; - } - }); - - symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode - }, userEncode.symbols); - - // -- LEGEND LABELS -- - labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - - encode = { - enter: enter = { - opacity: zero$2, - x: {signal: xSignal, offset: labelOffset}, - y: yEncode - }, - update: update = { - opacity: one$2, - text: {field: Label}, - x: enter.x, - y: enter.y - }, - exit: { - opacity: zero$2 - } - }; - - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') - }); - - labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode - }, userEncode.labels); - - // -- LEGEND ENTRY GROUPS -- - encode = { - enter: { - noBound: {value: !height}, // ignore width/height in bounds calc - width: zero$2, - height: height ? encoder(height) : zero$2, - opacity: zero$2 - }, - exit: {opacity: zero$2}, - update: update = { - opacity: one$2, - row: {signal: null}, - column: {signal: null} - } - }; - - // annotate and sort groups to ensure correct ordering - if (_.isVertical(true)) { - nrows = `ceil(item.mark.items.length / ${ncols})`; - update.row.signal = `${index}%${nrows}`; - update.column.signal = `floor(${index} / ${nrows})`; - sort = {field: ['row', index]}; - } else { - update.row.signal = `floor(${index} / ${ncols})`; - update.column.signal = `${index} % ${ncols}`; - sort = {field: index}; - } - // handle zero column case (implies infinite columns) - update.column.signal = `(${columns})?${update.column.signal}:${index}`; - - // facet legend entries into sub-groups - dataRef = {facet: {data: dataRef, name: 'value', groupby: Index}}; - - return guideGroup({ - role: ScopeRole$1, - from: dataRef, - encode: extendEncode(encode, entries, Skip$2), - marks: [symbols, labels], - name, - interactive, - sort - }); - } - - function legendSymbolLayout(spec, config) { - const _ = lookup$5(spec, config); - - // layout parameters for legend entries - return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } - }; - } - - // expression logic for align, anchor, angle, and baseline calculation - const isL = 'item.orient === "left"', - isR = 'item.orient === "right"', - isLR = `(${isL} || ${isR})`, - isVG = `datum.vgrad && ${isLR}`, - baseline = anchorExpr('"top"', '"bottom"', '"middle"'), - alignFlip = anchorExpr('"right"', '"left"', '"center"'), - exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr}`, - exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, - exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, - exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; - - function legendTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), encode; - - encode = { - enter: {opacity: zero$2}, - update: { - opacity: one$2, - x: {field: {group: 'padding'}}, - y: {field: {group: 'padding'}} - }, - exit: {opacity: zero$2} - }; - - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: {signal: exprAnchor}, - angle: {signal: exprAngle}, - align: {signal: exprAlign}, - baseline: {signal: exprBaseline}, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - baseline: _('titleBaseline') - }); - - return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function clip$3(clip, scope) { - var expr; - - if (isObject(clip)) { - if (clip.signal) { - expr = clip.signal; - } else if (clip.path) { - expr = 'pathShape(' + param(clip.path) + ')'; - } else if (clip.sphere) { - expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - } - - return expr - ? scope.signalRef(expr) - : !!clip; - } - - function param(value) { - return isObject(value) && value.signal - ? value.signal - : $(value); - } - - function getRole(spec) { - var role = spec.role || ''; - return (!role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title')) - ? role - : spec.type === GroupMark ? ScopeRole$1 : (role || MarkRole); - } - - function definition$1(spec) { - return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; - } - - function interactive(spec, scope) { - return spec && spec.signal ? scope.signalRef(spec.signal) - : spec === false ? false - : true; - } - - /** - * Parse a data transform specification. - */ - function parseTransform(spec, scope) { - var def = definition(spec.type); - if (!def) error('Unrecognized transform type: ' + $(spec.type)); - - var t = entry$1(def.type.toLowerCase(), null, parseParameters$1(def, spec, scope)); - if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; - - return t; - } - - /** - * Parse all parameters of a data transform. - */ - function parseParameters$1(def, spec, scope) { - var params = {}, pdef, i, n; - for (i=0, n=def.params.length; i spec[s] - ? (scales[s] = spec[s], scale = scale || spec[s]) : 0 - ); - if (!scale) error('Missing valid scale for legend.'); - - // resolve legend type (symbol, gradient, or discrete gradient) - type = legendType(spec, scope.scaleType(scale)); - - // single-element data source for legend group - datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - dataRef = ref(scope.add(Collect$1(null, [datum]))); - - // encoding properties for legend group - legendEncode = extendEncode( - buildLegendEncode(_, spec, config), legendEncode, Skip$2 - ); - - // encoding properties for legend entry sub-group - entryEncode = {enter: {x: {value: 0}, y: {value: 0}}}; - - // data source for legend values - entryRef = ref(scope.add(LegendEntries$1(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // continuous gradient legend - if (type === Gradient$1) { - children = [ - legendGradient(spec, scale, config, encode.gradient), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - // adjust default tick count based on the gradient length - params.count = params.count || scope.signalRef( - `max(2,2*floor((${deref(_.gradientLength())})/100))` - ); - } - - // discrete gradient legend - else if (type === Discrete$1) { - children = [ - legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - } - - // symbol legend - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [ - legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns)) - ]; - // pass symbol size information to legend entry generator - params.size = sizeExpression(spec, scope, children[0].marks); - } - - // generate legend marks - children = [ - guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive - }) - ]; - - // include legend title if defined - if (datum.title) { - children.push(legendTitle(spec, config, encode.title, dataRef)); - } - - // parse legend specification - return parseMark( - guideGroup({ - role: LegendRole$1, - from: dataRef, - encode: legendEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); - } - - function legendType(spec, scaleType) { - var type = spec.type || Symbols$1; - - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { - type = isContinuous(scaleType) ? Gradient$1 - : isDiscretizing(scaleType) ? Discrete$1 - : Symbols$1; - } - - return type !== Gradient$1 ? type - : isDiscretizing(scaleType) ? Discrete$1 - : Gradient$1; - } - - function scaleCount(spec) { - return LegendScales.reduce(function(count, type) { - return count + (spec[type] ? 1 : 0); - }, 0); - } - - function buildLegendEncode(_, spec, config) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; - } - - function sizeExpression(spec, scope, marks) { - var size = deref(getChannel('size', spec, marks)), - strokeWidth = deref(getChannel('strokeWidth', spec, marks)), - fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - - return parseExpression$1( - `max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, - scope - ); - } - - function getChannel(name, spec, marks) { - return spec[name] - ? `scale("${spec[name]}",datum)` - : getEncoding(name, marks[0].encode); - } - - function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); - } - - const angleExpr = `item.orient==="${Left$1}"?-90:item.orient==="${Right$1}"?90:0`; - - function parseTitle(spec, scope) { - spec = isString(spec) ? {text: spec} : spec; - - var _ = lookup$5(spec, scope.config.title), - encode = spec.encode || {}, - userEncode = encode.group || {}, - name = userEncode.name || undefined, - interactive = userEncode.interactive, - style = userEncode.style, - children = [], - datum, dataRef; - - // single-element data source for group title - datum = {}; - dataRef = ref(scope.add(Collect$1(null, [datum]))); - - // include title text - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); - - // include subtitle text - if (spec.subtitle) { - children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - } - - // parse title specification - return parseMark( - guideGroup({ - role: TitleRole$1, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); - } - - // provide backwards-compatibility for title custom encode; - // the top-level encode block has been *deprecated*. - function titleEncode(spec) { - const encode = spec.encode; - return (encode && encode.title) || extend({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); - } - - function groupEncode(_, userEncode) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: {signal: alignExpr}, - angle: {signal: angleExpr}, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') - }); - - return extendEncode(encode, userEncode, Skip$2); - } - - function buildTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.text, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function buildSubTitle(spec, _, userEncode, dataRef) { - var zero = {value: 0}, - text = spec.subtitle, - encode = { - enter: {opacity: zero}, - update: {opacity: {value: 1}}, - exit: {opacity: zero} - }; - - addEncoders(encode, { - text: text, - align: {signal: 'item.mark.group.align'}, - angle: {signal: 'item.mark.group.angle'}, - limit: {signal: 'item.mark.group.limit'}, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') - }, { // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') - }); - - return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function parseData$1(data, scope) { - var transforms = []; - - if (data.transform) { - data.transform.forEach(function(tx) { - transforms.push(parseTransform(tx, scope)); - }); - } - - if (data.on) { - data.on.forEach(function(on) { - parseTrigger(on, scope, data.name); - }); - } - - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); - } - - /** - * Analyze a data pipeline, add needed operators. - */ - function analyze(data, scope, ops) { - var output = [], - source = null, - modify = false, - generate = false, - upstream, i, n, t, m; - - if (data.values) { - // hard-wired input data set - if (hasSignal(data.values) || hasSignal(data.format)) { - // if either values or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format - })); - } - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load$1(scope, data)); - output.push(source = collect()); - } else { - // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format - })); - } - } else if (data.source) { - // derives from one or more other data sets - source = upstream = array(data.source).map(function(d) { - return ref(scope.getData(d).output); - }); - output.push(null); // populate later - } - - // scan data transforms, add collectors as needed - for (i=0, n=ops.length; i orient === Bottom$1 || orient === Top$1; - - // get sign coefficient based on axis orient - const getSign = (orient, a, b) => isSignal(orient) - ? ifLeftTopExpr(orient.signal, a, b) - : orient === Left$1 || orient === Top$1 ? a : b; - - // condition on axis x-direction - const ifX = (orient, a, b) => isSignal(orient) - ? ifXEnc(orient.signal, a, b) - : isX(orient) ? a : b; - - // condition on axis y-direction - const ifY = (orient, a, b) => isSignal(orient) - ? ifYEnc(orient.signal, a, b) - : isX(orient) ? b : a; - - const ifTop = (orient, a, b) => isSignal(orient) - ? ifTopExpr(orient.signal, a, b) - : orient === Top$1 ? {value: a} : {value: b}; - - const ifRight = (orient, a, b) => isSignal(orient) - ? ifRightExpr(orient.signal, a, b) - : orient === Right$1 ? {value: a} : {value: b}; - - const ifXEnc = ($orient, a, b) => ifEnc( - `${$orient} === '${Top$1}' || ${$orient} === '${Bottom$1}'`, a, b - ); - - const ifYEnc = ($orient, a, b) => ifEnc( - `${$orient} !== '${Top$1}' && ${$orient} !== '${Bottom$1}'`, a, b - ); - - const ifLeftTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Left$1}' || ${$orient} === '${Top$1}'`, a, b - ); - - const ifTopExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Top$1}'`, a, b - ); - - const ifRightExpr = ($orient, a, b) => ifExpr( - `${$orient} === '${Right$1}'`, a, b - ); - - const ifEnc = (test, a, b) => { - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? (a.signal || $(a.value)) : null; - b = b ? (b.signal || $(b.value)) : null; - return {signal: `${test} ? (${a}) : (${b})`}; - } else { - // otherwise generate rule set - return [extend({test}, a)].concat(b || []); - } - }; - - const isSimple = enc => ( - enc == null || Object.keys(enc).length === 1 - ); - - const ifExpr = (test, a, b) => ({ - signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})` - }); - - const ifOrient = ($orient, t, b, l, r) => ({ - signal: (l != null ? `${$orient} === '${Left$1}' ? (${toExpr(l)}) : ` : '') - + (b != null ? `${$orient} === '${Bottom$1}' ? (${toExpr(b)}) : ` : '') - + (r != null ? `${$orient} === '${Right$1}' ? (${toExpr(r)}) : ` : '') - + (t != null ? `${$orient} === '${Top$1}' ? (${toExpr(t)}) : ` : '') - + '(null)' - }); - - const toExpr = v => isSignal(v) - ? v.signal - : v == null ? null : $(v); - - const mult = (sign, value) => value === 0 ? 0 : isSignal(sign) - ? {signal: `(${sign.signal}) * ${value}`} - : {value: sign * value}; - - const patch = (value, base) => { - const s = value.signal; - return s && s.endsWith('(null)') - ? {signal: s.slice(0, -6) + base.signal} - : value; - }; - - function fallback(prop, config, axisConfig, style) { - let styleProp; - - if (config && hasOwnProperty(config, prop)) { - return config[prop]; - } - else if (hasOwnProperty(axisConfig, prop)) { - return axisConfig[prop]; - } - else if (prop.startsWith('title')) { - switch (prop) { - case 'titleColor': - styleProp = 'fill'; - break; - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideTitleStyle][styleProp]; - } - else if (prop.startsWith('label')) { - switch (prop) { - case 'labelColor': - styleProp = 'fill'; - break; - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideLabelStyle][styleProp]; - } - - return null; - } - - function keys$1(objects) { - const map = {}; - for (const obj of objects) { - if (!obj) continue; - for (const key in obj) map[key] = 1; - } - return Object.keys(map); - } - - function axisConfig(spec, scope) { - var config = scope.config, - style = config.style, - axis = config.axis, - band = scope.scaleType(spec.scale) === 'band' && config.axisBand, - orient = spec.orient, - xy, or, key; - - if (isSignal(orient)) { - const xyKeys = keys$1([ - config.axisX, config.axisY - ]), - orientKeys = keys$1([ - config.axisTop, config.axisBottom, - config.axisLeft, config.axisRight - ]); - - xy = {}; - for (key of xyKeys) { - xy[key] = ifX( - orient, - fallback(key, config.axisX, axis, style), - fallback(key, config.axisY, axis, style) - ); - } - - or = {}; - for (key of orientKeys) { - or[key] = ifOrient( - orient.signal, - fallback(key, config.axisTop, axis, style), - fallback(key, config.axisBottom, axis, style), - fallback(key, config.axisLeft, axis, style), - fallback(key, config.axisRight, axis, style) - ); - } - } else { - xy = (orient === Top$1 || orient === Bottom$1) ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; - } - - var result = (xy || or || band) - ? extend({}, axis, xy, or, band) - : axis; - - return result; - } - - function axisDomain(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - encode, enter, update; - - encode = { - enter: enter = {opacity: zero$2}, - update: update = {opacity: one$2}, - exit: {opacity: zero$2} - }; - - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') - }); - - const pos0 = position(spec, 0); - const pos1 = position(spec, 1); - - enter.x = update.x = ifX(orient, pos0, zero$2); - enter.x2 = update.x2 = ifX(orient, pos1); - - enter.y = update.y = ifY(orient, pos0, zero$2); - enter.y2 = update.y2 = ifY(orient, pos1); - - return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode - }, userEncode); - } - - function position(spec, pos) { - return {scale: spec.scale, range: pos}; - } - - function axisGrid(spec, config, userEncode, dataRef, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - vscale = spec.gridScale, - sign = getSign(orient, 1, -1), - offset = offsetValue$1(spec.offset, sign), - encode, enter, exit, update, - tickPos, gridStart, gridEnd, sz; - - encode = { - enter: enter = {opacity: zero$2}, - update: update = {opacity: one$2}, - exit: exit = {opacity: zero$2} - }; - - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') - }); - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - sz = ifX(orient, {signal: 'height'}, {signal: 'width'}); - - gridStart = vscale - ? {scale: vscale, range: 0, mult: sign, offset: offset} - : {value: 0, offset: offset}; - - gridEnd = vscale - ? {scale: vscale, range: 1, mult: sign, offset: offset} - : extend(sz, {mult: sign, offset: offset}); - - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); - exit.x = ifX(orient, tickPos); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode - }, userEncode); - } - - function offsetValue$1(offset, sign) { - if (sign === 1) ; else if (!isObject(offset)) { - offset = isSignal(sign) - ? {signal: `(${sign.signal}) * (${offset || 0})`} - : sign * (offset || 0); - } else { - let entry = offset = extend({}, offset); - while (entry.mult != null) { - if (!isObject(entry.mult)) { - entry.mult = isSignal(sign) // no offset if sign === 1 - ? {signal: `(${entry.mult}) * (${sign.signal})`} - : entry.mult * sign; - return offset; - } else { - entry = entry.mult = extend({}, entry.mult); - } - } - entry.mult = sign; - } - - return offset; - } - - function axisTicks(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, exit, update, tickSize, tickPos; - - encode = { - enter: enter = {opacity: zero$2}, - update: update = {opacity: one$2}, - exit: exit = {opacity: zero$2} - }; - - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') - }); - - tickSize = encoder(size); - tickSize.mult = sign; - - tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - - update.y = enter.y = ifX(orient, zero$2, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); - exit.x = ifX(orient, tickPos); - - update.x = enter.x = ifY(orient, zero$2, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); - exit.y = ifY(orient, tickPos); - - return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode - }, userEncode); - } - - function flushExpr(scale, threshold, a, b, c) { - return { - signal: 'flush(range("' + scale + '"), ' - + 'scale("' + scale + '", datum.value), ' - + threshold + ',' + a + ',' + b + ',' + c + ')' - }; - } - - function axisLabels(spec, config, userEncode, dataRef, size, band) { - var _ = lookup$5(spec, config), - orient = spec.orient, - scale = spec.scale, - sign = getSign(orient, -1, 1), - flush = deref(_('labelFlush')), - flushOffset = deref(_('labelFlushOffset')), - flushOn = flush === 0 || !!flush, - labelAlign = _('labelAlign'), - labelBaseline = _('labelBaseline'), - encode, enter, update, tickSize, tickPos, - align, baseline, bound, overlap, offsetExpr; - - tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; - - tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - - align = ifX(orient, - flushOn - ? flushExpr(scale, flush, '"left"', '"right"', '"center"') - : {value: 'center'}, - ifRight(orient, 'left', 'right') - ); - - baseline = ifX(orient, - ifTop(orient, 'bottom', 'top'), - flushOn - ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') - : {value: 'middle'} - ); - - offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0); - flushOn = flushOn && flushOffset; - - enter = { - opacity: zero$2, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - - encode = { - enter: enter, - update: update = { - opacity: one$2, - text: {field: Label}, - x: enter.x, - y: enter.y, - align, - baseline - }, - exit: { - opacity: zero$2, - x: enter.x, - y: enter.y - } - }; - - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') - }, { - align: labelAlign, - baseline: labelBaseline - }); - - bound = _('labelBound'); - overlap = _('labelOverlap'); - - // if overlap method or bound defined, request label overlap removal - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? {scale, orient, tolerance: bound} : null - } : undefined; - - if (update.align !== align) { - update.align = patch(update.align, align); - } - if (update.baseline !== baseline) { - update.baseline = patch(update.baseline, baseline); - } - - return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap - }, userEncode); - } - - function axisTitle(spec, config, userEncode, dataRef) { - var _ = lookup$5(spec, config), - orient = spec.orient, - sign = getSign(orient, -1, 1), - encode, enter, update, titlePos; - - encode = { - enter: enter = { - opacity: zero$2, - anchor: encoder(_('titleAnchor', null)), - align: {signal: alignExpr} - }, - update: update = extend({}, enter, { - opacity: one$2, - text: encoder(spec.title) - }), - exit: { - opacity: zero$2 - } - }; - - titlePos = { - signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` - }; - - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero$2, mult(sign, 90)); - enter.baseline = ifX(orient, ifTop(orient, Bottom$1, Top$1), {value: Bottom$1}); - update.angle = enter.angle; - update.baseline = enter.baseline; - - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') - }, { // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); - - return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode - }, userEncode); - } - - function autoLayout(_, orient, encode, userEncode) { - const auto = (value, dim) => value != null - ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) - : !has(dim, userEncode) ? true : false; - - const autoY = auto(_('titleX'), 'x'), - autoX = auto(_('titleY'), 'y'); - - encode.enter.auto = autoX === autoY - ? encoder(autoX) - : ifX(orient, encoder(autoX), encoder(autoY)); - } - - function parseAxis(spec, scope) { - var config = axisConfig(spec, scope), - encode = spec.encode || {}, - axisEncode = encode.axis || {}, - name = axisEncode.name || undefined, - interactive = axisEncode.interactive, - style = axisEncode.style, - _ = lookup$5(spec, config), - band = tickBand(_), - datum, dataRef, ticksRef, size, children; - - // single-element data source for axis group - datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - dataRef = ref(scope.add(Collect$1({}, [datum]))); - - // encoding properties for axis group item - axisEncode = extendEncode( - buildAxisEncode(_, spec), axisEncode, Skip$2 - ); - - // data source for axis ticks - ticksRef = ref(scope.add(AxisTicks$1({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) - }))); - - // generate axis marks - children = []; - - // include axis gridlines if requested - if (datum.grid) { - children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - } - - // include axis ticks if requested - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } - - // include axis labels if requested - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } - - // include axis domain path if requested - if (datum.domain) { - children.push(axisDomain(spec, config, encode.domain, dataRef)); - } - - // include axis title if defined - if (datum.title) { - children.push(axisTitle(spec, config, encode.title, dataRef)); - } - - // parse axis specification - return parseMark( - guideGroup({ - role: AxisRole$1, - from: dataRef, - encode: axisEncode, - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style - }), - scope - ); - } - - function buildAxisEncode(_, spec) { - var encode = {enter: {}, update: {}}; - - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value$2(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: {signal: `abs(span(range("${spec.scale}")))`}, - translate: _('translate'), - - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - - return encode; - } - - function parseScope(spec, scope, preprocessed) { - var signals = array(spec.signals), - scales = array(spec.scales); - - // parse signal definitions, if not already preprocessed - if (!preprocessed) signals.forEach(_ => parseSignal(_, scope)); - - // parse cartographic projection definitions - array(spec.projections).forEach(_ => parseProjection(_, scope)); - - // initialize scale references - scales.forEach(_ => initScale(_, scope)); - - // parse data sources - array(spec.data).forEach(_ => parseData$1(_, scope)); - - // parse scale definitions - scales.forEach(_ => parseScale(_, scope)); - - // parse signal updates - (preprocessed || signals).forEach(_ => parseSignalUpdates(_, scope)); - - // parse axis definitions - array(spec.axes).forEach(_ => parseAxis(_, scope)); - - // parse mark definitions - array(spec.marks).forEach(_ => parseMark(_, scope)); - - // parse legend definitions - array(spec.legends).forEach(_ => parseLegend(_, scope)); - - // parse title, if defined - if (spec.title) parseTitle(spec.title, scope); - - // parse collected lambda (anonymous) expressions - scope.parseLambdas(); - - return scope; - } - - const rootEncode = spec => extendEncode( - { - enter: { - x: {value: 0}, - y: {value: 0} - }, - update: { - width: {signal: 'width'}, - height: {signal: 'height'} - } - }, - spec - ); - - function parseView(spec, scope) { - const config = scope.config; - - // add scenegraph root - const root = ref(scope.root = scope.add(operator())); - - // parse top-level signal definitions - const signals = collectSignals(spec, config); - signals.forEach(_ => parseSignal(_, scope)); - - // assign description, event, legend, and locale configuration - scope.description = spec.description || config.description; - scope.eventConfig = config.events; - scope.legends = scope.objectProperty(config.legend && config.legend.layout); - scope.locale = config.locale; - - // store root group item - const input = scope.add(Collect$1()); - - // encode root group item - const encode = scope.add(Encode$1(parseEncode( - rootEncode(spec.encode), GroupMark, FrameRole$1, - spec.style, scope, {pulse: ref(input)} - ))); - - // perform view layout - const parent = scope.add(ViewLayout$1({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) - })); - scope.operators.pop(); - - // parse remainder of specification - scope.pushState(ref(encode), ref(parent), null); - parseScope(spec, scope, signals); - scope.operators.push(parent); - - // bound / render / sieve root item - let op = scope.add(Bound$1({mark: root, pulse: ref(parent)})); - op = scope.add(Render$1({pulse: ref(op)})); - op = scope.add(Sieve$1({pulse: ref(op)})); - - // track metadata for root item - scope.addData('root', new DataScope(scope, input, input, op)); - - return scope; - } - - function signalObject(name, value) { - return value && value.signal - ? { name, update: value.signal } - : { name, value }; - } - - /** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ - function collectSignals(spec, config) { - const _ = name => value$2(spec[name], config[name]), - signals = [ - signalObject('background', _('background')), - signalObject('autosize', parseAutosize(_('autosize'))), - signalObject('padding', parsePadding(_('padding'))), - signalObject('width', _('width') || 0), - signalObject('height', _('height') || 0) - ], - pre = signals.reduce((p, s) => (p[s.name] = s, p), {}), - map = {}; - - // add spec signal array - array(spec.signals).forEach(s => { - if (hasOwnProperty(pre, s.name)) { - // merge if built-in signal - s = extend(pre[s.name], s); - } else { - // otherwise add to signal list - signals.push(s); - } - map[s.name] = s; - }); - - // add config signal array - array(config.signals).forEach(s => { - if (!hasOwnProperty(map, s.name) && !hasOwnProperty(pre, s.name)) { - // add to signal list if not already defined - signals.push(s); - } - }); - - return signals; - } - - function Scope$1(config, options) { - this.config = config || {}; - this.options = options || {}; - - this.bindings = []; - this.field = {}; - this.signals = {}; - this.lambdas = {}; - this.scales = {}; - this.events = {}; - this.data = {}; - - this.streams = []; - this.updates = []; - this.operators = []; - this.eventConfig = null; - this.locale = null; - - this._id = 0; - this._subid = 0; - this._nextsub = [0]; - - this._parent = []; - this._encode = []; - this._lookup = []; - this._markpath = []; - } - - function Subscope(scope) { - this.config = scope.config; - this.options = scope.options; - this.legends = scope.legends; - - this.field = Object.create(scope.field); - this.signals = Object.create(scope.signals); - this.lambdas = Object.create(scope.lambdas); - this.scales = Object.create(scope.scales); - this.events = Object.create(scope.events); - this.data = Object.create(scope.data); - - this.streams = []; - this.updates = []; - this.operators = []; - - this._id = 0; - this._subid = ++scope._nextsub[0]; - this._nextsub = scope._nextsub; - - this._parent = scope._parent.slice(); - this._encode = scope._encode.slice(); - this._lookup = scope._lookup.slice(); - this._markpath = scope._markpath; - } - - var prototype$1u = Scope$1.prototype = Subscope.prototype; - - // ---- - - prototype$1u.parse = function(spec) { - return parseScope(spec, this); - }; - - prototype$1u.fork = function() { - return new Subscope(this); - }; - - prototype$1u.isSubscope = function() { - return this._subid > 0; - }; - - prototype$1u.toRuntime = function() { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; - }; - - prototype$1u.id = function() { - return (this._subid ? this._subid + ':' : 0) + this._id++; - }; - - prototype$1u.add = function(op) { - this.operators.push(op); - op.id = this.id(); - // if pre-registration references exist, resolve them now - if (op.refs) { - op.refs.forEach(function(ref) { ref.$ref = op.id; }); - op.refs = null; - } - return op; - }; - - prototype$1u.proxy = function(op) { - var vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy$1({value: vref})); - }; - - prototype$1u.addStream = function(stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; - }; - - prototype$1u.addUpdate = function(update) { - this.updates.push(update); - return update; - }; - - // Apply metadata - prototype$1u.finish = function() { - var name, ds; - - // annotate root - if (this.root) this.root.root = true; - - // annotate signals - for (name in this.signals) { - this.signals[name].signal = name; - } - - // annotate scales - for (name in this.scales) { - this.scales[name].scale = name; - } - - // annotate data sets - function annotate(op, name, type) { - var data, list; - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } - } - for (name in this.data) { - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - for (var field in ds.index) { - annotate(ds.index[field], name, 'index:' + field); - } - } - - return this; - }; - - // ---- - - prototype$1u.pushState = function(encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve$1({pulse: encode})))); - this._parent.push(parent); - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - this._markpath.push(-1); - }; - - prototype$1u.popState = function() { - this._encode.pop(); - this._parent.pop(); - this._lookup.pop(); - this._markpath.pop(); - }; - - prototype$1u.parent = function() { - return peek(this._parent); - }; - - prototype$1u.encode = function() { - return peek(this._encode); - }; - - prototype$1u.lookup = function() { - return peek(this._lookup); - }; - - prototype$1u.markpath = function() { - var p = this._markpath; - return ++p[p.length-1]; - }; - - // ---- - - prototype$1u.fieldRef = function(field, name) { - if (isString(field)) return fieldRef(field, name); - if (!field.signal) { - error('Unsupported field reference: ' + $(field)); - } - - var s = field.signal, - f = this.field[s], - params; - - if (!f) { - params = {name: this.signalRef(s)}; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field$1(params))); - } - return f; - }; - - prototype$1u.compareRef = function(cmp) { - function check(_) { - if (isSignal(_)) { - signal = true; - return scope.signalRef(_.signal); - } else if (isExpr(_)) { - signal = true; - return scope.exprRef(_.expr); - } else { - return _; - } - } - - var scope = this, - signal = false, - fields = array(cmp.field).map(check), - orders = array(cmp.order).map(check); - - return signal - ? ref(this.add(Compare$1({fields: fields, orders: orders}))) - : compareRef(fields, orders); - }; - - prototype$1u.keyRef = function(fields, flat) { - function check(_) { - if (isSignal(_)) { - signal = true; - return ref(sig[_.signal]); - } else { - return _; - } - } - - var sig = this.signals, - signal = false; - fields = array(fields).map(check); - - return signal - ? ref(this.add(Key$1({fields: fields, flat: flat}))) - : keyRef(fields, flat); - }; - - prototype$1u.sortRef = function(sort) { - if (!sort) return sort; - - // including id ensures stable sorting - var a = aggrField(sort.op, sort.field), - o = sort.order || Ascending; - - return o.signal - ? ref(this.add(Compare$1({ - fields: a, - orders: this.signalRef(o.signal) - }))) - : compareRef(a, o); - }; - - // ---- - - prototype$1u.event = function(source, type) { - var key = source + ':' + type; - if (!this.events[key]) { - var id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - return this.events[key]; - }; - - // ---- - - prototype$1u.hasOwnSignal = function(name) { - return hasOwnProperty(this.signals, name); - }; - - prototype$1u.addSignal = function(name, value) { - if (this.hasOwnSignal(name)) { - error('Duplicate signal name: ' + $(name)); - } - var op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; - }; - - prototype$1u.getSignal = function(name) { - if (!this.signals[name]) { - error('Unrecognized signal name: ' + $(name)); - } - return this.signals[name]; - }; - - prototype$1u.signalRef = function(s) { - if (this.signals[s]) { - return ref(this.signals[s]); - } else if (!hasOwnProperty(this.lambdas, s)) { - this.lambdas[s] = this.add(operator(null)); - } - return ref(this.lambdas[s]); - }; - - prototype$1u.parseLambdas = function() { - var code = Object.keys(this.lambdas); - for (var i=0, n=code.length; i 0 ? ',' : '') - + (isObject(value) - ? (value.signal || propertyLambda(value)) - : $(value)); - } - return code + ']'; - } - - function objectLambda(obj) { - var code = '{', - i = 0, - key, value; - - for (key in obj) { - value = obj[key]; - code += (++i > 1 ? ',' : '') - + $(key) + ':' - + (isObject(value) - ? (value.signal || propertyLambda(value)) - : $(value)); - } - return code + '}'; - } - - prototype$1u.exprRef = function(code, name) { - var params = {expr: parseExpression$1(code, this)}; - if (name) params.expr.$name = name; - return ref(this.add(Expression$1(params))); - }; - - prototype$1u.addBinding = function(name, bind) { - if (!this.bindings) { - error('Nested signals do not support binding: ' + $(name)); - } - this.bindings.push(extend({signal: name}, bind)); - }; - - // ---- - - prototype$1u.addScaleProj = function(name, transform) { - if (hasOwnProperty(this.scales, name)) { - error('Duplicate scale or projection name: ' + $(name)); - } - this.scales[name] = this.add(transform); - }; - - prototype$1u.addScale = function(name, params) { - this.addScaleProj(name, Scale$1(params)); - }; - - prototype$1u.addProjection = function(name, params) { - this.addScaleProj(name, Projection$1(params)); - }; - - prototype$1u.getScale = function(name) { - if (!this.scales[name]) { - error('Unrecognized scale name: ' + $(name)); - } - return this.scales[name]; - }; - - prototype$1u.projectionRef = - prototype$1u.scaleRef = function(name) { - return ref(this.getScale(name)); - }; - - prototype$1u.projectionType = - prototype$1u.scaleType = function(name) { - return this.getScale(name).params.type; - }; - - // ---- - - prototype$1u.addData = function(name, dataScope) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - return (this.data[name] = dataScope); - }; - - prototype$1u.getData = function(name) { - if (!this.data[name]) { - error('Undefined data set name: ' + $(name)); - } - return this.data[name]; - }; - - prototype$1u.addDataPipeline = function(name, entries) { - if (hasOwnProperty(this.data, name)) { - error('Duplicate data set name: ' + $(name)); - } - return this.addData(name, DataScope.fromEntries(this, entries)); - }; - - /** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ - function defaults() { - const defaultFont = 'sans-serif', - defaultSymbolSize = 30, - defaultStrokeWidth = 2, - defaultColor = '#4c78a8', - black = '#000', - gray = '#888', - lightGray = '#ddd'; - - return { - // default visualization description - description: 'Vega visualization', - - // default padding around visualization - padding: 0, - - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - - // default view background color - // covers the entire view component - background: null, - - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: {allow: ['wheel']} - }, - - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - } - }, - - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 - }, - - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 - }, - - // correction for centering bias - axisBand: { - tickOffset: -0.5 - }, - - // defaults for cartographic projection - projection: { - type: 'mercator' - }, - - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { direction: 'vertical' }, - right: { direction: 'vertical' } - } - }, - - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [1, 0] - }, - symbol: [ - 'circle', - 'square', - 'triangle-up', - 'cross', - 'diamond', - 'triangle-right', - 'triangle-down', - 'triangle-left' - ] - } - }; - } - - function parse$6(spec, config, options) { - if (!isObject(spec)) { - error('Input Vega specification must be an object.'); - } - - config = mergeConfig(defaults(), config, spec.config); - return parseView(spec, new Scope$1(config, options)).toRuntime(); - } - - // -- Transforms ----- - extend(transforms, tx, vtx, encode, geo, force, tree$1, reg, voronoi, wordcloud, xf); - - exports.Bounds = Bounds; - exports.CanvasHandler = CanvasHandler; - exports.CanvasRenderer = CanvasRenderer; - exports.DATE = DATE; - exports.DAY = DAY; - exports.DAYOFYEAR = DAYOFYEAR; - exports.Dataflow = Dataflow; - exports.Debug = Debug; - exports.Error = Error$1; - exports.EventStream = EventStream; - exports.Gradient = Gradient; - exports.GroupItem = GroupItem; - exports.HOURS = HOURS; - exports.Handler = Handler; - exports.Info = Info; - exports.Item = Item; - exports.MILLISECONDS = MILLISECONDS; - exports.MINUTES = MINUTES; - exports.MONTH = MONTH; - exports.Marks = Marks; - exports.MultiPulse = MultiPulse; - exports.None = None; - exports.Operator = Operator; - exports.Parameters = Parameters; - exports.Pulse = Pulse; - exports.QUARTER = QUARTER; - exports.RenderType = RenderType; - exports.Renderer = Renderer; - exports.ResourceLoader = ResourceLoader; - exports.SECONDS = SECONDS; - exports.SVGHandler = SVGHandler; - exports.SVGRenderer = SVGRenderer; - exports.SVGStringRenderer = SVGStringRenderer; - exports.Scenegraph = Scenegraph; - exports.TIME_UNITS = TIME_UNITS; - exports.Transform = Transform; - exports.View = View; - exports.WEEK = WEEK; - exports.Warn = Warn; - exports.YEAR = YEAR; - exports.accessor = accessor; - exports.accessorFields = accessorFields; - exports.accessorName = accessorName; - exports.array = array; - exports.bandwidthNRD = bandwidthNRD; - exports.bin = bin; - exports.bootstrapCI = bootstrapCI; - exports.boundClip = boundClip; - exports.boundContext = context; - exports.boundItem = boundItem; - exports.boundMark = boundMark; - exports.boundStroke = boundStroke; - exports.changeset = changeset; - exports.clampRange = clampRange; - exports.closeTag = closeTag; - exports.compare = compare; - exports.constant = constant; - exports.cumulativeLogNormal = cumulativeLogNormal; - exports.cumulativeNormal = cumulativeNormal; - exports.cumulativeUniform = cumulativeUniform; - exports.dayofyear = dayofyear; - exports.debounce = debounce; - exports.defaultLocale = defaultLocale$2; - exports.definition = definition; - exports.densityLogNormal = densityLogNormal; - exports.densityNormal = densityNormal; - exports.densityUniform = densityUniform; - exports.domChild = domChild; - exports.domClear = domClear; - exports.domCreate = domCreate; - exports.domFind = domFind; - exports.dotbin = dotbin; - exports.error = error; - exports.expressionFunction = expressionFunction; - exports.extend = extend; - exports.extent = extent; - exports.extentIndex = extentIndex; - exports.falsy = falsy; - exports.fastmap = fastmap; - exports.field = field; - exports.flush = flush; - exports.font = font; - exports.fontFamily = fontFamily; - exports.fontSize = fontSize; - exports.format = format; - exports.formatLocale = numberFormatDefaultLocale; - exports.formats = formats; - exports.hasOwnProperty = hasOwnProperty; - exports.id = id; - exports.identity = identity; - exports.inferType = inferType; - exports.inferTypes = inferTypes; - exports.ingest = ingest; - exports.inherits = inherits; - exports.inrange = inrange; - exports.interpolate = interpolate$1; - exports.interpolateColors = interpolateColors; - exports.interpolateRange = interpolateRange; - exports.intersect = intersect$1; - exports.intersectBoxLine = intersectBoxLine; - exports.intersectPath = intersectPath; - exports.intersectPoint = intersectPoint; - exports.intersectRule = intersectRule; - exports.isArray = isArray; - exports.isBoolean = isBoolean; - exports.isDate = isDate; - exports.isFunction = isFunction; - exports.isNumber = isNumber; - exports.isObject = isObject; - exports.isRegExp = isRegExp; - exports.isString = isString; - exports.isTuple = isTuple; - exports.key = key; - exports.lerp = lerp; - exports.lineHeight = lineHeight; - exports.loader = loader; - exports.locale = locale$2; - exports.logger = logger; - exports.lruCache = lruCache; - exports.merge = merge; - exports.mergeConfig = mergeConfig; - exports.multiLineOffset = multiLineOffset; - exports.one = one; - exports.openTag = openTag; - exports.pad = pad; - exports.panLinear = panLinear; - exports.panLog = panLog; - exports.panPow = panPow; - exports.panSymlog = panSymlog; - exports.parse = parse$6; - exports.pathCurves = curves; - exports.pathEqual = pathEqual; - exports.pathParse = pathParse; - exports.pathRectangle = vg_rect; - exports.pathRender = pathRender; - exports.pathSymbols = symbols; - exports.pathTrail = vg_trail; - exports.peek = peek; - exports.point = point$4; - exports.projection = projection$1; - exports.quantileLogNormal = quantileLogNormal; - exports.quantileNormal = quantileNormal; - exports.quantileUniform = quantileUniform; - exports.quantiles = quantiles; - exports.quantizeInterpolator = quantizeInterpolator; - exports.quarter = quarter; - exports.quartiles = quartiles; - exports.randomInteger = integer; - exports.randomKDE = randomKDE; - exports.randomLCG = lcg; - exports.randomLogNormal = randomLogNormal; - exports.randomMixture = randomMixture; - exports.randomNormal = randomNormal; - exports.randomUniform = randomUniform; - exports.read = read; - exports.regressionExp = regressionExp; - exports.regressionLinear = regressionLinear; - exports.regressionLoess = regressionLoess; - exports.regressionLog = regressionLog; - exports.regressionPoly = regressionPoly; - exports.regressionPow = regressionPow; - exports.regressionQuad = regressionQuad; - exports.renderModule = renderModule; - exports.repeat = repeat; - exports.resetDefaultLocale = resetDefaultLocale; - exports.resetSVGClipId = resetSVGClipId; - exports.resetSVGDefIds = resetSVGDefIds; - exports.responseType = responseType; - exports.runtimeContext = context$2; - exports.sampleCurve = sampleCurve; - exports.sampleLogNormal = sampleLogNormal; - exports.sampleNormal = sampleNormal; - exports.sampleUniform = sampleUniform; - exports.scale = scale$2; - exports.sceneEqual = sceneEqual; - exports.sceneFromJSON = sceneFromJSON; - exports.scenePickVisit = pickVisit; - exports.sceneToJSON = sceneToJSON; - exports.sceneVisit = visit; - exports.sceneZOrder = zorder; - exports.scheme = scheme; - exports.setRandom = setRandom; - exports.span = span; - exports.splitAccessPath = splitAccessPath; - exports.stringValue = $; - exports.textMetrics = textMetrics; - exports.timeBin = timeBin; - exports.timeFloor = timeFloor; - exports.timeFormatLocale = timeFormatDefaultLocale; - exports.timeInterval = timeInterval; - exports.timeOffset = timeOffset; - exports.timeSequence = timeSequence; - exports.timeUnitSpecifier = timeUnitSpecifier; - exports.timeUnits = timeUnits; - exports.toBoolean = toBoolean; - exports.toDate = toDate; - exports.toNumber = toNumber; - exports.toSet = toSet; - exports.toString = toString; - exports.transform = transform$1; - exports.transforms = transforms; - exports.truncate = truncate; - exports.truthy = truthy; - exports.tupleid = tupleid; - exports.typeParsers = typeParsers; - exports.utcFloor = utcFloor; - exports.utcInterval = utcInterval; - exports.utcOffset = utcOffset; - exports.utcSequence = utcSequence; - exports.utcdayofyear = utcdayofyear; - exports.utcquarter = utcquarter; - exports.utcweek = utcweek; - exports.version = version; - exports.visitArray = visitArray; - exports.week = week; - exports.writeConfig = writeConfig; - exports.zero = zero; - exports.zoomLinear = zoomLinear; - exports.zoomLog = zoomLog; - exports.zoomPow = zoomPow; - exports.zoomSymlog = zoomSymlog; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/vega/build/vega.min.js b/node_modules/vega/build/vega.min.js deleted file mode 100644 index 36bf617..0000000 --- a/node_modules/vega/build/vega.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).vega={})}(this,(function(t){"use strict";function e(t,e,n){return t.fields=e||[],t.fname=n,t}function n(t){return null==t?null:t.fname}function r(t){return null==t?null:t.fields}function i(t){return 1===t.length?a(t[0]):o(t)}const a=t=>function(e){return e[t]},o=t=>{const e=t.length;return function(n){for(let r=0;re&&c(),o=e=n+1):"]"===r&&(o||u("Access path missing open bracket: "+t),o>0&&c(),o=0,e=n+1):n>e?c():e=n+1}return o&&u("Access path missing closing bracket: "+t),a&&u("Access path missing closing quote: "+t),n>e&&(n++,c()),i}function l(t,n,r){const a=s(t);return t=1===a.length?a[0]:t,e((r&&r.get||i)(a),[t],n||t)}var c=[],f=l("id"),h=e((function(t){return t}),c,"identity"),d=e((function(){return 0}),c,"zero"),p=e((function(){return 1}),c,"one"),g=e((function(){return!0}),c,"true"),m=e((function(){return!1}),c,"false");function v(t,e,n){var r=[e].concat([].slice.call(n));console[t].apply(console,r)}function y(t,e){var n=t||0;return{level:function(t){return arguments.length?(n=+t,this):n},error:function(){return n>=1&&v(e||"error","ERROR",arguments),this},warn:function(){return n>=2&&v(e||"warn","WARN",arguments),this},info:function(){return n>=3&&v(e||"log","INFO",arguments),this},debug:function(){return n>=4&&v(e||"log","DEBUG",arguments),this}}}var _=Array.isArray;function x(t){return t===Object(t)}const b=t=>"__proto__"!==t;function w(...t){return t.reduce((t,e)=>{for(var n in e)if("signals"===n)t.signals=A(t.signals,e.signals);else{var r="legend"===n?{layout:1}:"style"===n||null;k(t,n,e[n],r)}return t},{})}function k(t,e,n,r){var i,a;if(b(e))if(x(n)&&!_(n))for(i in a=x(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?k(a,i,n[i]):b(i)&&(a[i]=n[i]);else t[e]=n}function A(t,e){if(null==t)return e;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}function M(t){return t[t.length-1]}function E(t){return null==t||""===t?null:+t}function D(t){return function(e){return t*Math.exp(e)}}function C(t){return function(e){return Math.log(t*e)}}function F(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function S(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function B(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function T(t,e,n,r){var i=n(t[0]),a=n(M(t)),o=(a-i)*e;return[r(i-o),r(a-o)]}function z(t,e){return T(t,e,E,h)}function N(t,e){var n=Math.sign(t[0]);return T(t,e,C(n),D(n))}function O(t,e,n){return T(t,e,B(n),B(1/n))}function R(t,e,n){return T(t,e,F(n),S(n))}function q(t,e,n,r,i){var a=r(t[0]),o=r(M(t)),u=null!=e?r(e):(a+o)/2;return[i(u+(a-u)*n),i(u+(o-u)*n)]}function U(t,e,n){return q(t,e,n,E,h)}function L(t,e,n){var r=Math.sign(t[0]);return q(t,e,n,C(r),D(r))}function $(t,e,n,r){return q(t,e,n,B(r),B(1/r))}function P(t,e,n,r){return q(t,e,n,F(r),S(r))}function j(t){return 1+~~(new Date(t).getMonth()/3)}function I(t){return 1+~~(new Date(t).getUTCMonth()/3)}function W(t){return null!=t?_(t)?t:[t]:[]}function H(t,e,n){var r,i=t[0],a=t[1];return a=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]}function Y(t){return"function"==typeof t}function V(t,n,i){i=i||{},n=W(n)||[];const a=[],o=[],u={},s=i.comparator||X;return W(t).forEach((t,e)=>{null!=t&&(a.push("descending"===n[e]?-1:1),o.push(t=Y(t)?t:l(t,null,i)),(r(t)||[]).forEach(t=>u[t]=1))}),0===o.length?null:e(s(o,a),Object.keys(u))}const G=(t,e)=>(te||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0),X=(t,e)=>1===t.length?J(t[0],e[0]):Z(t,e,t.length),J=(t,e)=>function(n,r){return G(t(n),t(r))*e},Z=(t,e,n)=>(e.push(0),function(r,i){let a,o=0,u=-1;for(;0===o&&++ua&&(a=r))}else{for(r=e(t[o]);oa&&(a=r))}return[i,a]}function nt(t,e){var n,r,i,a,o,u=-1,s=t.length;if(null==e){for(;++u=r){n=i=r;break}if(u===s)return[-1,-1];for(a=o=u;++ur&&(n=r,a=u),i=r){n=i=r;break}if(u===s)return[-1,-1];for(a=o=u;++ur&&(n=r,a=u),ii(t)?r[t]:void 0,set(t,n){return i(t)||(++e.size,r[t]===at&&--e.empty),r[t]=n,this},delete(t){return i(t)&&(--e.size,++e.empty,r[t]=at),this},clear(){e.size=e.empty=0,e.object=r={}},test(t){return arguments.length?(n=t,e):n},clean(){var t,i,a={},o=0;for(t in r)(i=r[t])===at||n&&n(i)||(a[t]=i,++o);e.size=o,e.empty=0,e.object=r=a}},t&&Object.keys(t).forEach((function(n){e.set(n,t[n])})),e}function ut(t,e,n,r,i,a){if(!n&&0!==n)return a;var o,u,s=t[0],l=M(t),c=+n;return lo&&(i=a,a=o,o=i),r=void 0===r||r,((n=void 0===n||n)?a<=t:at.replace(/\\(.)/g,"$1")):W(t));const a=t&&t.length,o=r&&r.get||i,u=t=>o(n?[t]:s(t));let l;if(a)if(1===a){const e=u(t[0]);l=function(t){return""+e(t)}}else{const e=t.map(u);l=function(t){let n=""+e[0](t),r=0;for(;++r{e={},n={},r=0},a=(i,a)=>(++r>t&&(n=e,e={},r=1),e[i]=a);return i(),{clear:i,has:t=>it(e,t)||it(n,t),get:t=>it(e,t)?e[t]:it(n,t)?a(t,n[t]):void 0,set:(t,n)=>it(e,t)?e[t]=n:a(t,n)}}function yt(t,e,n,r){var i=e.length,a=n.length;if(!a)return e;if(!i)return n;for(var o=r||new e.constructor(i+a),u=0,s=0,l=0;u0?n[s++]:e[u++];for(;u=0;)n+=t;return n}function xt(t,e,n,r){var i=n||" ",a=t+"",o=e-a.length;return o<=0?a:"left"===r?_t(i,o)+a:"center"===r?_t(i,~~(o/2))+a+_t(i,Math.ceil(o/2)):a+_t(i,o)}function bt(t){return t&&M(t)-t[0]||0}function wt(t){return _(t)?"["+t.map(wt)+"]":x(t)||pt(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function kt(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}function At(t){return ht(t)||ft(t)?t:Date.parse(t)}function Mt(t,e){return e=e||At,null==t||""===t?null:e(t)}function Et(t){return null==t||""===t?null:t+""}function Dt(t){for(var e={},n=0,r=t.length;n=0&&n.splice(i,1)),n},n}async function Bt(t,e){try{await e(t)}catch(e){t.error(e)}}var Tt=Symbol("vega_id"),zt=1;function Nt(t){return!(!t||!Ot(t))}function Ot(t){return t[Tt]}function Rt(t,e){return t[Tt]=e,t}function qt(t){var e=t===Object(t)?t:{data:t};return Ot(e)?e:Rt(e,zt++)}function Ut(t){return Lt(t,qt({}))}function Lt(t,e){for(var n in t)e[n]=t[n];return e}function $t(t,e){return Rt(e,Ot(t))}function Pt(t,e){return t?e?(n,r)=>t(n,r)||Ot(e(n))-Ot(e(r)):(e,n)=>t(e,n)||Ot(e)-Ot(n):null}function jt(t){return t&&t.constructor===It}function It(){var t=[],e=[],n=[],r=[],i=[],a=null,o=!1;return{constructor:It,insert:function(e){for(var n=W(e),r=0,i=n.length;r0&&(v(d,h,f.value),u.modifies(h));for(l=0,c=i.length;l0&&v(t,f.field,f.value)})),u.modifies(f.field);if(o)u.mod=e.length||r.length?s.filter((function(t){return g[Ot(t)]>0})):s.slice();else for(p in m)u.mod.push(m[p]);return(a||null==a&&(e.length||r.length))&&u.clean(!0),u}}}var Wt="_:mod:_";function Ht(){Object.defineProperty(this,Wt,{writable:!0,value:{}})}var Yt=Ht.prototype;Yt.set=function(t,e,n,r){var i=this,a=i[t],o=i[Wt];return null!=e&&e>=0?(a[e]!==n||r)&&(a[e]=n,o[e+":"+t]=-1,o[t]=-1):(a!==n||r)&&(i[t]=n,o[t]=_(n)?1+n.length:-1),i},Yt.modified=function(t,e){var n,r=this[Wt];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(_(t)){for(n=0;n=0?e+1t?(e=n,1):0}))},ee.debounce=function(t){var e=te();return this.targets().add(te(null,null,K(t,(function(t){var n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},ee.between=function(t,e){var n=!1;return t.targets().add(te(null,null,(function(){n=!0}))),e.targets().add(te(null,null,(function(){n=!1}))),this.filter((function(){return n}))};const ne=/^([A-Za-z]+:)?\/\//,re=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,ie=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function ae(t,e){const n=await this.sanitize(t,e),r=n.href;return n.localFile?this.file(r):this.http(r,e)}async function oe(t,e){e=tt({},this.options,e);const n=this.fileAccess,r={href:null};let i,a,o;const s=re.test(t.replace(ie,""));null!=t&&"string"==typeof t&&s||u("Sanitize failure, invalid URI: "+wt(t));const l=ne.test(t);return(o=e.baseURL)&&!l&&(t.startsWith("/")||"/"===o[o.length-1]||(t="/"+t),t=o+t),a=(i=t.startsWith("file://"))||"file"===e.mode||"http"!==e.mode&&!l&&n,i?t=t.slice("file://".length):t.startsWith("//")&&("file"===e.defaultProtocol?(t=t.slice(2),a=!0):t=(e.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!a}),r.href=t,e.target&&(r.target=e.target+""),e.rel&&(r.rel=e.rel+""),"image"===e.context&&e.crossOrigin&&(r.crossOrigin=e.crossOrigin+""),r}function ue(t){return t?function(e){return new Promise((function(n,r){t.readFile(e,(function(t,e){t?r(t):n(e)}))}))}:se}async function se(){u("No file system access.")}function le(t){return t?async function(e,n){const r=tt({},this.options.http,n),i=n&&n.response,a=await t(e,r);return a.ok?Y(a[i])?a[i]():a.text():u(a.status+""+a.statusText)}:ce}async function ce(){u("No HTTP fetch method available.")}var fe={boolean:kt,integer:E,number:E,date:Mt,string:Et,unknown:h},he=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return me(t)&&Number.isInteger(+t)},me,function(t){return!Number.isNaN(Date.parse(t))}],de=["boolean","integer","number","date"];function pe(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=he.length,i=he.map((t,e)=>e+1);for(let o,u,s=0,l=0;s0===t?e:t,0)-1]}function ge(t,e){return e.reduce((function(e,n){return e[n]=pe(t,n),e}),{})}function me(t){return!(Number.isNaN(+t)||t instanceof Date)}var ve={},ye={};function _e(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function xe(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function be(t,e){var n=t+"",r=n.length;return r9999?"+"+be(t,6):be(t,4)}(t.getUTCFullYear())+"-"+be(t.getUTCMonth()+1,2)+"-"+be(t.getUTCDate(),2)+(i?"T"+be(e,2)+":"+be(n,2)+":"+be(r,2)+"."+be(i,3)+"Z":r?"T"+be(e,2)+":"+be(n,2)+":"+be(r,2)+"Z":n||e?"T"+be(e,2)+":"+be(n,2)+"Z":"")}function ke(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],a=t.length,o=0,u=0,s=a<=0,l=!1;function c(){if(s)return ye;if(l)return l=!1,ve;var e,r,i=o;if(34===t.charCodeAt(i)){for(;o++=a?s=!0:10===(r=t.charCodeAt(o++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(o)&&++o),t.slice(i+1,e-1).replace(/""/g,'"')}for(;o1)r=Ne(t,e,n);else for(i=0,r=new Array(a=t.arcs.length);it!==e,exterior:(t,e)=>t===e};function Re(t,e){let n,r,i,a;return t=Ee(t,e),e&&e.feature?(n=Ce,i=e.feature):e&&e.mesh?(n=Te,i=e.mesh,a=Oe[e.filter]):u("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?n(t,r,a):u("Invalid TopoJSON object: "+i),r&&r.features||[r]}Re.responseType="json";const qe={dsv:Me,csv:Ae(","),tsv:Ae("\t"),json:Ee,topojson:Re};function Ue(t,e){return arguments.length>1?(qe[t]=e,this):it(qe,t)?qe[t]:null}function Le(t){const e=Ue(t);return e&&e.responseType||"text"}function $e(t){const e={};return n=>e[n]||(e[n]=t(n))}function Pe(t,e){return te?1:t>=e?0:NaN}function je(t){var e;return 1===t.length&&(e=t,t=function(t,n){return Pe(e(t),n)}),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}var Ie=je(Pe),We=Ie.right,He=Ie.left;function Ye(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r0)return[t];if((r=e0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++u=0?(a>=Ve?10:a>=Ge?5:a>=Xe?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=Ve?10:a>=Ge?5:a>=Xe?2:1)}function Qe(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=Ve?i*=10:a>=Ge?i*=5:a>=Xe&&(i*=2),e=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function tn(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function en(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function nn(t){return null===t?NaN:+t}function rn(t,e,n){if(r=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n))).length){if((e=+e)<=0||r<2)return tn(t);if(e>=1)return Ke(t);var r,i=(r-1)*e,a=Math.floor(i),o=Ke(function t(e,n,r=0,i=e.length-1,a=Pe){for(;i>r;){if(i-r>600){const o=i-r+1,u=n-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(u-o/2<0?-1:1);t(e,n,Math.max(r,Math.floor(n-u*l/o+c)),Math.min(i,Math.floor(n+(o-u)*l/o+c)),a)}const o=e[n];let u=r,s=i;for(en(e,r,n),a(e[i],o)>0&&en(e,r,i);u0;)--s}0===a(e[r],o)?en(e,r,s):(++s,en(e,s,i)),s<=n&&(r=s+1),n<=s&&(i=s-1)}return e}(t,a).subarray(0,a+1));return o+(tn(t.subarray(a+1))-o)*(i-a)}}function an(t,e){return rn(t,.5,e)}function on(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n}function un(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function sn(t){return(t=un(Math.abs(t)))?t[1]:NaN}var ln,cn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fn(t){if(!(e=cn.exec(t)))throw new Error("invalid format: "+t);var e;return new hn({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function hn(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function dn(t,e){var n=un(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}fn.prototype=hn.prototype,hn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var pn={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return dn(100*t,e)},r:dn,s:function(t,e){var n=un(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(ln=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+un(t,Math.max(0,e+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function gn(t){return t}var mn,vn,yn,_n=Array.prototype.map,xn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function bn(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?gn:(e=_n.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,a=[],o=0,u=e[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),a.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=e[o=(o+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?gn:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(_n.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=fn(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,y=t.type;"n"===y?(g=!0,y="g"):pn[y]||(void 0===m&&(m=12),v=!0,y="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===h?a:/[%p]/.test(y)?s:"",b=pn[y],w=/[defgprs%]/.test(y);function k(t){var i,a,s,h=_,k=x;if("c"===y)k=b(t)+k,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==f&&(A=!1),h=(A?"("===f?f:l:"-"===f||"("===f?"":f)+h,k=("s"===y?xn[8+ln/3]:"")+k+(A&&"("===f?")":""),w)for(i=-1,a=t.length;++i(s=t.charCodeAt(i))||s>57){k=(46===s?o+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var M=h.length+t.length+k.length,E=M>1)+h+t+k+E.slice(M);break;default:t=E+h+t+k}return u(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,e){var n=f(((t=fn(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(sn(e)/3))),i=Math.pow(10,-r),a=xn[8+r/3];return function(t){return n(i*t)+a}}}}function wn(t){return Math.max(0,-sn(Math.abs(t)))}function kn(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(sn(e)/3)))-sn(Math.abs(t)))}function An(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,sn(e)-sn(t))+1}function Mn(t){const e=$e(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){var n,r,i=fn(t||",");if(null==i.precision){switch(i.precision=12,i.type){case"%":i.precision-=2;break;case"e":i.precision-=1}return n=e(i),r=e(".1f")(1)[1],t=>{var e,i,a=n(t),o=a.indexOf(r);if(o<0)return a;for(i=(e=function(t,e){var n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if((n=t.charCodeAt(r))>=48&&n<=57)return r+1}(a,o))o;)if("0"!==a[e]){++e;break}return a.slice(0,e)+i}}return e(i)},formatSpan(t,r,i,a){a=fn(null==a?",f":a);const o=Qe(t,r,i),u=Math.max(Math.abs(t),Math.abs(r));let s;if(null==a.precision)switch(a.type){case"s":return isNaN(s=kn(o,u))||(a.precision=s),n(a,u);case"":case"e":case"g":case"p":case"r":isNaN(s=An(o,u))||(a.precision=s-("e"===a.type));break;case"f":case"%":isNaN(s=wn(o))||(a.precision=s-2*("%"===a.type))}return e(a)}}}let En;function Dn(){return En=Mn({format:vn,formatPrefix:yn})}function Cn(t){return Mn(bn(t))}function Fn(t){return arguments.length?En=Cn(t):En}!function(t){mn=bn(t),vn=mn.format,yn=mn.formatPrefix}({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),Dn();const Sn="year",Bn="quarter",Tn="month",zn="week",Nn="date",On="day",Rn="hours",qn="minutes",Un="seconds",Ln=[Sn,Bn,Tn,zn,Nn,On,"dayofyear",Rn,qn,Un,"milliseconds"],$n=Ln.reduce((t,e,n)=>(t[e]=1+n,t),{});function Pn(t){const e=W(t).slice(),n={};e.length||u("Missing time unit."),e.forEach(t=>{it($n,t)?n[t]=1:u(`Invalid time unit: ${t}.`)});return(n[zn]||n.day?1:0)+(n[Bn]||n[Tn]||n[Nn]?1:0)+(n.dayofyear?1:0)>1&&u("Incompatible time units: "+t),e.sort((t,e)=>$n[t]-$n[e]),e}const jn={[Sn]:"%Y ",[Bn]:"Q%q ",[Tn]:"%b ",[Nn]:"%d ",[zn]:"W%U ",[On]:"%a ",dayofyear:"%j ",[Rn]:"%H:00",[qn]:"00:%M",[Un]:":%S",milliseconds:".%L","year-month":"%Y-%m ","year-month-date":"%Y-%m-%d ",["hours-"+qn]:"%H:%M"};function In(t,e){const n=tt({},jn,e),r=Pn(t),i=r.length;let a,o,u="",s=0;for(s=0;ss;--a)if(o=r.slice(s,a).join("-"),null!=n[o]){u+=n[o],s=a;break}return u.trim()}var Wn=new Date,Hn=new Date;function Yn(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e0))return u;do{u.push(o=new Date(+n)),e(n,a),t(n)}while(o=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return Wn.setTime(+e),Hn.setTime(+r),t(Wn),t(Hn),Math.floor(n(Wn,Hn))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var Vn=Yn((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));Vn.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Yn((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Vn:null};var Gn=Yn((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),Xn=Yn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),Jn=Yn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),Zn=Yn((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}));function Qn(t){return Yn((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var Kn=Qn(0),tr=Qn(1),er=(Qn(2),Qn(3),Qn(4)),nr=(Qn(5),Qn(6),Yn((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))),rr=Yn((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));rr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Yn((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var ir=Yn((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),ar=Yn((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),or=Yn((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}));function ur(t){return Yn((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var sr=ur(0),lr=ur(1),cr=(ur(2),ur(3),ur(4)),fr=(ur(5),ur(6),Yn((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))),hr=Yn((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));hr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Yn((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};const dr=new Date;function pr(t){return dr.setFullYear(t),dr.setMonth(0),dr.setDate(1),dr.setHours(0,0,0,0),dr}function gr(t){return vr(new Date(t))}function mr(t){return yr(new Date(t))}function vr(t){return Zn.count(pr(t.getFullYear())-1,t)}function yr(t){return Kn.count(pr(t.getFullYear())-1,t)}function _r(t){return pr(t).getDay()}function xr(t,e,n,r,i,a,o){if(0<=t&&t<100){var u=new Date(-1,e,n,r,i,a,o);return u.setFullYear(t),u}return new Date(t,e,n,r,i,a,o)}function br(t){return kr(new Date(t))}function wr(t){return Ar(new Date(t))}function kr(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return or.count(e-1,t)}function Ar(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return sr.count(e-1,t)}function Mr(t){return dr.setTime(Date.UTC(t,0,1)),dr.getUTCDay()}function Er(t,e,n,r,i,a,o){if(0<=t&&t<100){var u=new Date(Date.UTC(-1,e,n,r,i,a,o));return u.setUTCFullYear(n.y),u}return new Date(Date.UTC(t,e,n,r,i,a,o))}function Dr(t,e,n,r,i){const a=e||1,o=M(t),u=(t,e,i)=>function(t,e,n,r){const i=n<=1?t:r?(e,i)=>r+n*Math.floor((t(e,i)-r)/n):(e,r)=>n*Math.floor(t(e,r)/n);return e?(t,n)=>e(i(t,n),n):i}(n[i=i||t],r[i],t===o&&a,e),s=new Date,l=Dt(t),c=l[Sn]?u(Sn):Q(2012),f=l[Tn]?u(Tn):l[Bn]?u(Bn):d,h=l[zn]&&l.day?u(On,1,zn+On):l[zn]?u(zn,1):l.day?u(On,1):l[Nn]?u(Nn,1):l.dayofyear?u("dayofyear",1):p,g=l[Rn]?u(Rn):d,m=l[qn]?u(qn):d,v=l[Un]?u(Un):d,y=l.milliseconds?u("milliseconds"):d;return function(t){s.setTime(+t);const e=c(s);return i(e,f(s),h(s,e),g(s),m(s),v(s),y(s))}}function Cr(t,e,n){return e+7*t-(n+6)%7}const Fr={[Sn]:t=>t.getFullYear(),[Bn]:t=>Math.floor(t.getMonth()/3),[Tn]:t=>t.getMonth(),[Nn]:t=>t.getDate(),[Rn]:t=>t.getHours(),[qn]:t=>t.getMinutes(),[Un]:t=>t.getSeconds(),milliseconds:t=>t.getMilliseconds(),dayofyear:t=>vr(t),[zn]:t=>yr(t),[zn+On]:(t,e)=>Cr(yr(t),t.getDay(),_r(e)),[On]:(t,e)=>Cr(1,t.getDay(),_r(e))},Sr={[Bn]:t=>3*t,[zn]:(t,e)=>Cr(t,0,_r(e))};function Br(t,e){return Dr(t,e||1,Fr,Sr,xr)}const Tr={[Sn]:t=>t.getUTCFullYear(),[Bn]:t=>Math.floor(t.getUTCMonth()/3),[Tn]:t=>t.getUTCMonth(),[Nn]:t=>t.getUTCDate(),[Rn]:t=>t.getUTCHours(),[qn]:t=>t.getUTCMinutes(),[Un]:t=>t.getUTCSeconds(),milliseconds:t=>t.getUTCMilliseconds(),dayofyear:t=>kr(t),[zn]:t=>Ar(t),[On]:(t,e)=>Cr(1,t.getUTCDay(),Mr(e)),[zn+On]:(t,e)=>Cr(Ar(t),t.getUTCDay(),Mr(e))},zr={[Bn]:t=>3*t,[zn]:(t,e)=>Cr(t,0,Mr(e))};function Nr(t,e){return Dr(t,e||1,Tr,zr,Er)}const Or={[Sn]:rr,[Bn]:nr.every(3),[Tn]:nr,[zn]:Kn,[Nn]:Zn,[On]:Zn,dayofyear:Zn,[Rn]:Jn,[qn]:Xn,[Un]:Gn,milliseconds:Vn},Rr={[Sn]:hr,[Bn]:fr.every(3),[Tn]:fr,[zn]:sr,[Nn]:or,[On]:or,dayofyear:or,[Rn]:ar,[qn]:ir,[Un]:Gn,milliseconds:Vn};function qr(t){return Or[t]}function Ur(t){return Rr[t]}function Lr(t,e,n){return t?t.offset(e,n):void 0}function $r(t,e,n){return Lr(qr(t),e,n)}function Pr(t,e,n){return Lr(Ur(t),e,n)}function jr(t,e,n,r){return t?t.range(e,n,r):void 0}function Ir(t,e,n,r){return jr(qr(t),e,n,r)}function Wr(t,e,n,r){return jr(Ur(t),e,n,r)}const Hr=[Sn,Tn,Nn,Rn,qn,Un,"milliseconds"],Yr=Hr.slice(0,-1),Vr=Yr.slice(0,-1),Gr=Vr.slice(0,-1),Xr=Gr.slice(0,-1),Jr=[Sn,Tn],Zr=[Sn],Qr=[[Yr,1,1e3],[Yr,5,5e3],[Yr,15,15e3],[Yr,30,3e4],[Vr,1,6e4],[Vr,5,3e5],[Vr,15,9e5],[Vr,30,18e5],[Gr,1,36e5],[Gr,3,108e5],[Gr,6,216e5],[Gr,12,432e5],[Xr,1,864e5],[[Sn,zn],1,6048e5],[Jr,1,2592e6],[Jr,3,7776e6],[Zr,1,31536e6]];function Kr(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(bt(e))/n;let i,a,o=je(t=>t[2]).right(Qr,r);return o===Qr.length?(i=Zr,a=Qe(e[0]/31536e6,e[1]/31536e6,n)):o?(o=Qr[r/Qr[o-1][2]=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:ya,s:_a,S:Hi,u:Yi,U:Vi,V:Gi,w:Xi,W:Ji,x:null,X:null,y:Zi,Y:Qi,Z:Ki,"%":va},x={a:function(t){return o[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:ta,e:ta,f:aa,H:ea,I:na,j:ra,L:ia,m:oa,M:ua,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:ya,s:_a,S:sa,u:la,U:ca,V:fa,w:ha,W:da,x:null,X:null,y:pa,Y:ga,Z:ma,"%":va},b={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=h[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=m[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:Di,e:Di,f:zi,H:Fi,I:Fi,j:Ci,L:Ti,m:Ei,M:Si,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=c[r[0].toLowerCase()],n+r[0].length):-1},q:Mi,Q:Oi,s:Ri,S:Bi,u:yi,U:_i,V:xi,w:vi,W:bi,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:ki,Y:wi,Z:Ai,"%":Ni};function w(t,e){return function(n){var r,i,a,o=[],u=-1,s=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++u53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=ei(ni(a.y,0,1))).getUTCDay(),r=i>4||0===i?lr.ceil(r):lr(r),r=or.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=ti(ni(a.y,0,1))).getDay(),r=i>4||0===i?tr.ceil(r):tr(r),r=Zn.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?ei(ni(a.y,0,1)).getUTCDay():ti(ni(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,ei(a)):ti(a)}}function A(t,e,n,r){for(var i,a,o=0,u=e.length,s=n.length;o=s)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=b[i in li?e.charAt(o++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=w(n,_),_.X=w(r,_),_.c=w(e,_),x.x=w(n,x),x.X=w(r,x),x.c=w(e,x),{format:function(t){var e=w(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=k(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=k(t+="",!0);return e.toString=function(){return t},e}}}var ii,ai,oi,ui,si,li={"-":"",_:" ",0:"0"},ci=/^\s*\d+/,fi=/^%/,hi=/[\\^$*+?|[\]().{}]/g;function di(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a68?1900:2e3),n+r[0].length):-1}function Ai(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Mi(t,e,n){var r=ci.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Ei(t,e,n){var r=ci.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Di(t,e,n){var r=ci.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ci(t,e,n){var r=ci.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Fi(t,e,n){var r=ci.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Si(t,e,n){var r=ci.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Bi(t,e,n){var r=ci.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Ti(t,e,n){var r=ci.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function zi(t,e,n){var r=ci.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Ni(t,e,n){var r=fi.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Oi(t,e,n){var r=ci.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Ri(t,e,n){var r=ci.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function qi(t,e){return di(t.getDate(),e,2)}function Ui(t,e){return di(t.getHours(),e,2)}function Li(t,e){return di(t.getHours()%12||12,e,2)}function $i(t,e){return di(1+Zn.count(rr(t),t),e,3)}function Pi(t,e){return di(t.getMilliseconds(),e,3)}function ji(t,e){return Pi(t,e)+"000"}function Ii(t,e){return di(t.getMonth()+1,e,2)}function Wi(t,e){return di(t.getMinutes(),e,2)}function Hi(t,e){return di(t.getSeconds(),e,2)}function Yi(t){var e=t.getDay();return 0===e?7:e}function Vi(t,e){return di(Kn.count(rr(t)-1,t),e,2)}function Gi(t,e){var n=t.getDay();return t=n>=4||0===n?er(t):er.ceil(t),di(er.count(rr(t),t)+(4===rr(t).getDay()),e,2)}function Xi(t){return t.getDay()}function Ji(t,e){return di(tr.count(rr(t)-1,t),e,2)}function Zi(t,e){return di(t.getFullYear()%100,e,2)}function Qi(t,e){return di(t.getFullYear()%1e4,e,4)}function Ki(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+di(e/60|0,"0",2)+di(e%60,"0",2)}function ta(t,e){return di(t.getUTCDate(),e,2)}function ea(t,e){return di(t.getUTCHours(),e,2)}function na(t,e){return di(t.getUTCHours()%12||12,e,2)}function ra(t,e){return di(1+or.count(hr(t),t),e,3)}function ia(t,e){return di(t.getUTCMilliseconds(),e,3)}function aa(t,e){return ia(t,e)+"000"}function oa(t,e){return di(t.getUTCMonth()+1,e,2)}function ua(t,e){return di(t.getUTCMinutes(),e,2)}function sa(t,e){return di(t.getUTCSeconds(),e,2)}function la(t){var e=t.getUTCDay();return 0===e?7:e}function ca(t,e){return di(sr.count(hr(t)-1,t),e,2)}function fa(t,e){var n=t.getUTCDay();return t=n>=4||0===n?cr(t):cr.ceil(t),di(cr.count(hr(t),t)+(4===hr(t).getUTCDay()),e,2)}function ha(t){return t.getUTCDay()}function da(t,e){return di(lr.count(hr(t)-1,t),e,2)}function pa(t,e){return di(t.getUTCFullYear()%100,e,2)}function ga(t,e){return di(t.getUTCFullYear()%1e4,e,4)}function ma(){return"+0000"}function va(){return"%"}function ya(t){return+t}function _a(t){return Math.floor(+t/1e3)}function xa(t,e,n){x(n=n||{})||u("Invalid time multi-format specifier: "+n);const r=e(Un),i=e(qn),a=e(Rn),o=e(Nn),s=e(zn),l=e(Tn),c=e(Bn),f=e(Sn),h=t(n.milliseconds||".%L"),d=t(n[Un]||":%S"),p=t(n[qn]||"%I:%M"),g=t(n[Rn]||"%I %p"),m=t(n[Nn]||n.day||"%a %d"),v=t(n[zn]||"%b %d"),y=t(n[Tn]||"%B"),_=t(n[Bn]||"%B"),b=t(n[Sn]||"%Y");return t=>(r(t)pt(t)?e(t):xa(e,qr,t),utcFormat:t=>pt(t)?n(t):xa(n,Ur,t),timeParse:$e(t.parse),utcParse:$e(t.utcParse)}}let wa;function ka(){return wa=ba({format:ai,parse:oi,utcFormat:ui,utcParse:si})}function Aa(t){return ba(ri(t))}function Ma(t){return arguments.length?wa=Aa(t):wa}!function(t){ii=ri(t),ai=ii.format,oi=ii.parse,ui=ii.utcFormat,si=ii.utcParse}({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","Sep","Oct","Nov","Dec"]}),ka();const Ea=(t,e)=>tt({},t,e);function Da(t,e){const n=t?Cn(t):Fn(),r=e?Aa(e):Ma();return Ea(n,r)}function Ca(t,e){const n=arguments.length;return n&&2!==n&&u("defaultLocale expects either zero or two arguments."),n?Ea(Fn(t),Ma(e)):Ea(Fn(),Ma())}function Fa(t,e,n,r){const i=Ue((e=e||{}).type||"json");return i||u("Unknown data format type: "+e.type),t=i(t,e),e.parse&&function(t,e,n,r){if(!t.length)return;const i=Ma();n=n||i.timeParse,r=r||i.utcParse;var a,o,u,s,l,c,f,h=t.columns||Object.keys(t[0]);"auto"===e&&(e=ge(t,h));for(h=Object.keys(e),a=h.map((function(t){var i,a,o=e[t];if(o&&(o.startsWith("date:")||o.startsWith("utc:"))){("'"===(a=(i=o.split(/:(.+)?/,2))[1])[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1));return("utc"===i[0]?r:n)(a)}if(!fe[o])throw Error("Illegal format pattern: "+t+":"+o);return fe[o]})),s=0,c=t.length,f=h.length;st.touch(n(e)):Y(r)?(u=new Xt(null,r,i,!1),o=e=>{u.evaluate(e);const r=n(e),i=u.value;jt(i)?t.pulse(r,i,a):t.update(r,i,s)}):o=e=>t.update(n(e),r,s),e.apply(o)}function za(t,e,n,r,i,a){if(void 0===r)e.targets().add(n);else{const o=a||{},u=new Xt(null,function(t,e){return e=Y(e)?e:Q(e),t?function(n,r){const i=e(n,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:e}(n,r),i,!1);u.modified(o.force),u.rank=e.rank,e.targets().add(u),n&&(u.skip(!0),u.value=n.value,u.targets().add(n),t.connect(n,[u]))}}const Na={};function Oa(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}const Ra=Oa.prototype;function qa(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function Ua(t,e){var n=[];return Ft(t,e,t=>n.push(t)),n}function La(t,e){var n={};return t.visit(e,(function(t){n[Ot(t)]=1})),t=>n[Ot(t)]?null:t}function $a(t,e,n,r){var i,a,o,u,s,l=this,c=0;for(this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n,o=0,u=n.length;oe[t]=!0):e[t]=!0,this},Ra.modified=function(t,e){var n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?_(t)?t.some(t=>n[t]):n[t]:!!n)},Ra.filter=function(t,e){var n=this;return 1&t&&(n.addF=qa(n.addF,e)),2&t&&(n.remF=qa(n.remF,e)),4&t&&(n.modF=qa(n.modF,e)),16&t&&(n.srcF=qa(n.srcF,e)),n},Ra.materialize=function(t){var e=this;return 1&(t=t||7)&&e.addF&&(e.add=Ua(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=Ua(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=Ua(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},Ra.visit=function(t,e){var n,r,i=this,a=e;return 16&t?(Ft(i.source,i.srcF,a),i):(1&t&&Ft(i.add,i.addF,a),2&t&&Ft(i.rem,i.remF,a),4&t&&Ft(i.mod,i.modF,a),8&t&&(n=i.source)&&((r=i.add.length+i.mod.length)===n.length||Ft(n,r?La(i,5):i.srcF,a)),i)};var Pa=st($a,Oa);function ja(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}Pa.fork=function(t){var e=new Oa(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(function(t){return e.add.push(t)})),t&e.REM&&this.visit(e.REM,(function(t){return e.rem.push(t)})),t&e.MOD&&this.visit(e.MOD,(function(t){return e.mod.push(t)}))),e},Pa.changed=function(t){return this.changes&t},Pa.modified=function(t){var e=this,n=e.fields;return n&&e.changes&e.MOD?_(t)?t.some((function(t){return n[t]})):n[t]:0},Pa.filter=function(){u("MultiPulse does not support filtering.")},Pa.materialize=function(){u("MultiPulse does not support materialization.")},Pa.visit=function(t,e){var n=this,r=n.pulses,i=r.length,a=0;if(t&n.SOURCE)for(;ae=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),Ha(e,0,e.length-1,t)),pop:()=>{var n,r=e.pop();return e.length?(n=e[0],e[0]=r,function(t,e,n){var r,i=e,a=t.length,o=t[e],u=1+(e<<1);for(;u=0&&(u=r),t[e]=t[u],u=1+((e=u)<<1);t[e]=o,Ha(t,i,e,n)}(e,0,t)):n=r,n}}}function Ha(t,e,n,r){var i,a,o;for(i=t[n];n>e&&r(i,a=t[o=n-1>>1])<0;)t[n]=a,n=o;return t[n]=i}function Ya(){this.logger(y()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Ca();try{this._loader=Sa()}catch(t){}this._touched=St(f),this._input={},this._pulse=null,this._heap=Wa((t,e)=>t.qrank-e.qrank),this._postrun=[]}var Va=Ya.prototype;function Ga(t){return function(){return this._log[t].apply(this,arguments)}}function Xa(t,e){Xt.call(this,t,null,e)}Va.stamp=function(){return this._clock},Va.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},Va.locale=function(t){return arguments.length?(this._locale=t,this):this._locale},Va.cleanThreshold=1e4,Va.add=function(t,e,n,r){var i,a=1;return t instanceof Xt?i=t:t&&t.prototype instanceof Xt?i=new t:Y(t)?i=new Xt(null,t):(a=0,i=new Xt(t,e)),this.rank(i),a&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},Va.connect=function(t,e){var n,r,i=t.rank;for(n=0,r=e.length;n=0;)i.push(e=n[r]),e===t&&u("Cycle detected in dataflow graph.")},Va.pulse=function(t,e,n){this.touch(t,n||Ia);var r=new Oa(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,i),this},Va.touch=function(t,e){var n=e||Ia;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},Va.update=function(t,e,n){var r=n||Ia;return(t.set(e)||r.force)&&this.touch(t,r),this},Va.changeset=It,Va.ingest=function(t,e,n){return e=this.parse(e,n),this.pulse(t,this.changeset().insert(e))},Va.parse=function(t,e){const n=this.locale();return Fa(t,e,n.timeParse,n.utcParse)},Va.preload=async function(t,e,n){const r=this,i=r._pending||function(t){var e,n=new Promise((function(t){e=t}));return n.requests=0,n.done=function(){0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(r);i.requests+=1;const a=await r.request(e,n);return r.pulse(t,r.changeset().remove(g).insert(a.data||[])),i.done(),a},Va.request=async function(t,e){const n=this;let r,i=0;try{r=await n.loader().load(t,{context:"dataflow",response:Le(e&&e.type)});try{r=n.parse(r,e)}catch(e){i=-2,n.warn("Data ingestion failed",t,e)}}catch(e){i=-1,n.warn("Loading failed",t,e)}return{data:r,status:i}},Va.events=function(t,e,n,r){for(var i,a=this,o=te(n,r),u=function(t){t.dataflow=a;try{o.receive(t)}catch(t){a.error(t)}finally{a.run()}},s=0,l=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):W(t)).length;sr._enqueue(t,!0)),r._touched=St(f);let o,u,s,l=0;try{for(;r._heap.size()>0;)o=r._heap.pop(),o.rank===o.qrank?(u=o.run(r._getPulse(o,t)),u.then?u=await u:u.async&&(i.push(u.async),u=Na),u!==Na&&o._targets&&o._targets.forEach(t=>r._enqueue(t)),++l):r._enqueue(o,!0)}catch(t){r._heap.clear(),s=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${a}: ${l} operators`),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun.sort((t,e)=>e.priority-t.priority);r._postrun=[];for(let e=0;er.runAsync(null,()=>{t.forEach(t=>{try{t(r)}catch(t){r.error(t)}})})),r},Va.run=function(t,e,n){return this._pulse?ja(this):(this.evaluate(t,e,n),this)},Va.runAsync=async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},Va.runAfter=function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},Va._enqueue=function(t,e){var n=t.stampt.pulse),e):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==Na&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)},Va.logger=function(t){return arguments.length?(this._log=t,this):this._log},Va.error=Ga("error"),Va.warn=Ga("warn"),Va.info=Ga("info"),Va.debug=Ga("debug"),Va.logLevel=Ga("level");var Ja=st(Xa,Xt);Ja.run=function(t){return t.stampthis.pulse=t):e!==t.StopPropagation&&(this.pulse=e),e);var e},Ja.evaluate=function(t){var e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},Ja.transform=function(){};var Za={};function Qa(t){var e=Ka(t);return e&&e.Definition||null}function Ka(t){return t=t&&t.toLowerCase(),it(Za,t)?Za[t]:null}function to(t){return t&&t.length?1===t.length?t[0]:(e=t,function(t){for(var n=e.length,r=1,i=String(e[0](t));r{},ro={init:no,add:no,rem:no,idx:0},io={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.sum,add:(t,e)=>t.sum+=+e,rem:(t,e)=>t.sum-=e},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,e)=>t.product*=e,rem:(t,e)=>t.product/=e},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,e)=>(t.mean_d=e-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,e)=>(t.mean_d=e-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,e)=>t.dev+=t.mean_d*(e-t.mean),rem:(t,e)=>t.dev-=t.mean_d*(e-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,e)=>{(e{e<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,e)=>{(e>t.max||void 0===t.max)&&(t.max=e)},rem:(t,e)=>{e>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,e,n)=>{e{e<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,e,n)=>{e>t.max&&(t.argmax=n)},rem:(t,e)=>{e>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3}},ao=Object.keys(io);function oo(t,e){return io[t](e)}function uo(t,e){return t.idx-e.idx}function so(){this.valid=0,this.missing=0,this._ops.forEach(t=>t.init(this))}function lo(t,e){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach(n=>n.add(this,t,e))):++this.missing}function co(t,e){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach(n=>n.rem(this,t,e))):--this.missing}function fo(t){return this._out.forEach(e=>t[e.out]=e.value(this)),t}function ho(t,e){var n=e||h,r=function(t){const e={};t.forEach(t=>e[t.name]=t);const n=t=>{t.req&&t.req.forEach(t=>{e[t]||n(e[t]=io[t]())})};return t.forEach(n),Object.values(e).sort(uo)}(t),i=t.slice().sort(uo);function a(t){this._ops=r,this._out=i,this.cell=t,this.init()}return a.prototype.init=so,a.prototype.add=lo,a.prototype.rem=co,a.prototype.set=fo,a.prototype.get=n,a.fields=t.map(t=>t.out),a}function*po(t,e){if(null==e)for(let e of t)null!=e&&""!==e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)r=e(r,++n,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function go(t,e,n){var r=Float64Array.from(po(t,n));return r.sort(Pe),e.map(t=>function(t,e,n=nn){if(r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,a=Math.floor(i),o=+n(t[a],a,t);return o+(+n(t[a+1],a+1,t)-o)*(i-a)}}(r,t))}function mo(t,e){return go(t,[.25,.5,.75],e)}function vo(t,e){var n=t.length,r=function(t,e){const n=function(t,e){let n,r=0,i=0,a=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,a+=n*(e-i));else{let o=-1;for(let u of t)null!=(u=e(u,++o,t))&&(u=+u)>=u&&(n=u-i,i+=n/++r,a+=n*(u-i))}if(r>1)return a/(r-1)}(t,e);return n?Math.sqrt(n):n}(t,e),i=mo(t,e),a=(i[2]-i[0])/1.34;return 1.06*(r=Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function yo(t){var e,n,r,i,a,o,u,s,l=t.maxbins||20,c=t.base||10,f=Math.log(c),h=t.divide||[5,2],d=t.extent[0],p=t.extent[1],g=t.span||p-d||Math.abs(d)||1;if(t.step)e=t.step;else if(t.steps){for(a=g/l,o=0,u=t.steps.length;ol;)e*=c;for(o=0,u=h.length;o=r&&g/a<=l&&(e=a)}return i=(a=Math.log(e))>=0?0:1+~~(-a/f),s=Math.pow(c,-i-1),(t.nice||void 0===t.nice)&&(d=d<(a=Math.floor(d/e+s)*e)?a-e:a,p=Math.ceil(p/e)*e),{start:d,stop:p===d?d+e:p,step:e}}function _o(e,n,r,i){if(!e.length)return[void 0,void 0];var a,o,u,s,l=Float64Array.from(po(e,i)),c=l.length,f=n;for(u=0,s=Array(f);ut);let i,a=0,o=1,u=t.length,s=new Float64Array(u),l=r(t[0]),c=l,f=l+e;for(;o=f){for(c=(l+c)/2;a>1);ro;)t[r--]=t[a]}a=o,o=n}return t}(s,e+e/4):s}ao.forEach(t=>{io[t]=function(t,e){return n=>tt({name:t,out:n||t},ro,e)}(t,io[t])}),t.random=Math.random;const bo=Math.sqrt(2*Math.PI),wo=Math.SQRT2;let ko=NaN;function Ao(e,n){e=e||0,n=null==n?1:n;let r,i,a=0,o=0;if(ko==ko)a=ko,ko=NaN;else{do{a=2*t.random()-1,o=2*t.random()-1,r=a*a+o*o}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),a*=i,ko=o*i}return e+a*n}function Mo(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*bo)}function Eo(t,e,n){let r,i=(t-(e=e||0))/(n=null==n?1:n),a=Math.abs(i);if(a>37)r=0;else{let t,e=Math.exp(-a*a/2);a<7.07106781186547?(t=.0352624965998911*a+.700383064443688,t=t*a+6.37396220353165,t=t*a+33.912866078383,t=t*a+112.079291497871,t=t*a+221.213596169931,t=t*a+220.206867912376,r=e*t,t=.0883883476483184*a+1.75566716318264,t=t*a+16.064177579207,t=t*a+86.7807322029461,t=t*a+296.564248779674,t=t*a+637.333633378831,t=t*a+793.826512519948,t=t*a+440.413735824752,r/=t):(t=a+.65,t=a+4/t,t=a+3/t,t=a+2/t,t=a+1/t,r=e/t/2.506628274631)}return i>0?1-r:r}function Do(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*wo*function(t){let e,n=-Math.log((1-t)*(1+t));n<6.25?(n-=3.125,e=-364441206401782e-35,e=e*n-16850591381820166e-35,e=128584807152564e-32+e*n,e=11157877678025181e-33+e*n,e=e*n-1333171662854621e-31,e=20972767875968562e-33+e*n,e=6637638134358324e-30+e*n,e=e*n-4054566272975207e-29,e=e*n-8151934197605472e-29,e=26335093153082323e-28+e*n,e=e*n-12975133253453532e-27,e=e*n-5415412054294628e-26,e=1.0512122733215323e-9+e*n,e=e*n-4.112633980346984e-9,e=e*n-2.9070369957882005e-8,e=4.2347877827932404e-7+e*n,e=e*n-13654692000834679e-22,e=e*n-13882523362786469e-21,e=.00018673420803405714+e*n,e=e*n-.000740702534166267,e=e*n-.006033670871430149,e=.24015818242558962+e*n,e=1.6536545626831027+e*n):n<16?(n=Math.sqrt(n)-3.25,e=2.2137376921775787e-9,e=9.075656193888539e-8+e*n,e=e*n-2.7517406297064545e-7,e=1.8239629214389228e-8+e*n,e=15027403968909828e-22+e*n,e=e*n-4013867526981546e-21,e=29234449089955446e-22+e*n,e=12475304481671779e-21+e*n,e=e*n-47318229009055734e-21,e=6828485145957318e-20+e*n,e=24031110387097894e-21+e*n,e=e*n-.0003550375203628475,e=.0009532893797373805+e*n,e=e*n-.0016882755560235047,e=.002491442096107851+e*n,e=e*n-.003751208507569241,e=.005370914553590064+e*n,e=1.0052589676941592+e*n,e=3.0838856104922208+e*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,e=-27109920616438573e-27,e=e*n-2.555641816996525e-10,e=1.5076572693500548e-9+e*n,e=e*n-3.789465440126737e-9,e=7.61570120807834e-9+e*n,e=e*n-1.496002662714924e-8,e=2.914795345090108e-8+e*n,e=e*n-6.771199775845234e-8,e=2.2900482228026655e-7+e*n,e=e*n-9.9298272942317e-7,e=4526062597223154e-21+e*n,e=e*n-1968177810553167e-20,e=7599527703001776e-20+e*n,e=e*n-.00021503011930044477,e=e*n-.00013871931833623122,e=1.0103004648645344+e*n,e=4.849906401408584+e*n):e=1/0;return e*t}(2*t-1)}function Co(t,e){var n,r,i={mean:function(t){return arguments.length?(n=t||0,i):n},stdev:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Ao(n,r),pdf:t=>Mo(t,n,r),cdf:t=>Eo(t,n,r),icdf:t=>Do(t,n,r)};return i.mean(t).stdev(e)}function Fo(e,n){var r=Co(),i={},a=0;return i.data=function(t){return arguments.length?(e=t,a=t?t.length:0,i.bandwidth(n)):e},i.bandwidth=function(t){return arguments.length?(!(n=t)&&e&&(n=vo(e)),i):n},i.sample=function(){return e[~~(t.random()*a)]+n*r.sample()},i.pdf=function(t){for(var i=0,o=0;oSo(n,r),pdf:t=>Bo(t,n,r),cdf:t=>To(t,n,r),icdf:t=>zo(t,n,r)};return i.mean(t).stdev(e)}function Oo(e,n){var r,i={},a=0;function o(t){var e,n=[],r=0;for(e=0;e=e&&t<=n?1/(n-e):0}function Uo(t,e,n){return null==n&&(n=null==e?1:e,e=0),tn?1:(t-e)/(n-e)}function Lo(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function $o(t,e){var n,r,i={min:function(t){return arguments.length?(n=t||0,i):n},max:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Ro(n,r),pdf:t=>qo(t,n,r),cdf:t=>Uo(t,n,r),icdf:t=>Lo(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function Po(t,e,n,r){const i=r-t*t,a=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-a*t,a]}function jo(t,e,n,r){t=t.filter(t=>{let r=e(t),i=n(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i}),r&&t.sort((t,n)=>e(t)-e(n));const i=t.length,a=new Float64Array(i),o=new Float64Array(i);let u,s,l,c=0,f=0,h=0;for(l of t)a[c]=u=+e(l),o[c]=s=+n(l),++c,f+=(u-f)/c,h+=(s-h)/c;for(c=0;c=i&&null!=a&&(a=+a)>=a&&r(i,a,++o)}function Wo(t,e,n,r,i){let a=0,o=0;return Io(t,e,n,(t,e)=>{const n=e-i(t),u=e-r;a+=n*n,o+=u*u}),1-a/o}function Ho(t,e,n){let r=0,i=0,a=0,o=0,u=0;Io(t,e,n,(t,e)=>{++u,r+=(t-r)/u,i+=(e-i)/u,a+=(t*e-a)/u,o+=(t*t-o)/u});const s=Po(r,i,a,o),l=t=>s[0]+s[1]*t;return{coef:s,predict:l,rSquared:Wo(t,e,n,i,l)}}function Yo(t,e,n){let r=0,i=0,a=0,o=0,u=0;Io(t,e,n,(t,e)=>{++u,t=Math.log(t),r+=(t-r)/u,i+=(e-i)/u,a+=(t*e-a)/u,o+=(t*t-o)/u});const s=Po(r,i,a,o),l=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:l,rSquared:Wo(t,e,n,i,l)}}function Vo(t,e,n){const[r,i,a,o]=jo(t,e,n);let u,s,l,c=0,f=0,h=0,d=0,p=0;Io(t,e,n,(t,e)=>{u=r[p++],s=Math.log(e),l=u*e,c+=(e*s-c)/p,f+=(l-f)/p,h+=(l*s-h)/p,d+=(u*l-d)/p});const[g,m]=Po(f/o,c/o,h/o,d/o),v=t=>Math.exp(g+m*(t-a));return{coef:[Math.exp(g-m*a),m],predict:v,rSquared:Wo(t,e,n,o,v)}}function Go(t,e,n){let r=0,i=0,a=0,o=0,u=0,s=0;Io(t,e,n,(t,e)=>{const n=Math.log(t),l=Math.log(e);++s,r+=(n-r)/s,i+=(l-i)/s,a+=(n*l-a)/s,o+=(n*n-o)/s,u+=(e-u)/s});const l=Po(r,i,a,o),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Wo(t,e,n,u,c)}}function Xo(t,e,n){const[r,i,a,o]=jo(t,e,n),u=r.length;let s,l,c,f,h=0,d=0,p=0,g=0,m=0;for(s=0;s_*(t-=a)*t+x*t+b+o;return{coef:[b-x*a+_*a*a+o,x-2*_*a,_],predict:w,rSquared:Wo(t,e,n,o,w)}}function Jo(t,e,n,r){if(1===r)return Ho(t,e,n);if(2===r)return Xo(t,e,n);const[i,a,o,u]=jo(t,e,n),s=i.length,l=[],c=[],f=r+1;let h,d,p,g,m;for(h=0;hMath.abs(t[r][o])&&(o=i);for(a=r;a=r;a--)t[a][i]-=t[a][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(u=0,a=i+1;a{t-=o;let e=u+v[0]+v[1]*t+v[2]*t*t;for(h=3;h=0;--a)for(u=e[a],s=1,i[a]+=u,o=1;o<=a;++o)s*=(a+1-o)/o,i[a-o]+=u*Math.pow(n,o)*s;return i[0]+=r,i}function Qo(t,e,n,r){const[i,a,o,u]=jo(t,e,n,!0),s=i.length,l=Math.max(2,~~(r*s)),c=new Float64Array(s),f=new Float64Array(s),h=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const e=[0,l-1];for(let t=0;ti[o]-n?r:o;let s=0,l=0,d=0,p=0,g=0,m=1/Math.abs(i[u]-n||1);for(let t=r;t<=o;++t){const e=i[t],r=a[t],o=Ko(Math.abs(n-e)*m)*h[t],u=e*o;s+=o,l+=u,d+=r*o,p+=r*u,g+=e*u}const[v,y]=Po(l/s,d/s,p/s,g/s);c[t]=v+y*n,f[t]=Math.abs(a[t]-c[t]),tu(i,t+1,e)}if(2===t)break;const n=an(f);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r=1?1e-12:(e=1-t*t)*e}return function(t,e,n,r){const i=t.length,a=[];let o,u=0,s=0,l=[];for(;u=t.length))for(;e>i&&t[a]-r<=r-t[i];)n[0]=++i,n[1]=a,++a}const eu=.1*Math.PI/180;function nu(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],a=e[0],o=e[1],u=o-a,s=u/r,l=[i(a)],c=[];if(n===r){for(let t=1;t0;)c.push(i(a+t/n*u));let f=l[0],h=c[c.length-1];for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=s&&ru(f,t,h)>eu?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function ru(t,e,n){const r=Math.atan2(n[1]-t[1],n[0]-t[0]),i=Math.atan2(e[1]-t[1],e[0]-t[0]);return Math.abs(r-i)}function iu(t){this._key=t?l(t):Ot,this.reset()}var au=iu.prototype;function ou(t){Xa.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}au.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},au.add=function(t){this._add.push(t)},au.rem=function(t){this._rem.push(t)},au.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,e,n,r=this._add,i=this._rem,a=this._key,o=r.length,u=i.length,s=Array(o-u),l={};for(t=0;t=0;)it(i,e=t(n[r])+"")||(i[e]=1,++a);return a},au.extent=function(t){if(this._get!==t||!this._ext){var e=this.values(),n=nt(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},au.argmin=function(t){return this.extent(t)[0]||{}},au.argmax=function(t){return this.extent(t)[1]||{}},au.min=function(t){var e=this.extent(t)[0];return null!=e?t(e):void 0},au.max=function(t){var e=this.extent(t)[1];return null!=e?t(e):void 0},au.quartile=function(t){return this._get===t&&this._q||(this._q=mo(this.values(),t),this._get=t),this._q},au.q1=function(t){return this.quartile(t)[0]},au.q2=function(t){return this.quartile(t)[1]},au.q3=function(t){return this.quartile(t)[2]},au.ci=function(t){return this._get===t&&this._ci||(this._ci=_o(this.values(),1e3,.05,t),this._get=t),this._ci},au.ci0=function(t){return this.ci(t)[0]},au.ci1=function(t){return this.ci(t)[1]},ou.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:ao},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};var uu=st(ou,Xa);uu.transform=function(t,e){var n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.modified();return n.stamp=r.stamp,n.value&&(i||e.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(t):{},e.visit(e.SOURCE,t=>n.add(t))):(n.value=n.value||n.init(t),e.visit(e.REM,t=>n.rem(t)),e.visit(e.ADD,t=>n.add(t))),r.modifies(n._outputs),n._drop=!1!==t.drop,t.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),e.clean()&&n._drop&&r.clean(!0).runAfter(()=>this.clean()),n.changes(r)},uu.cross=function(){var t=this,e=t.value,n=t._dnames,r=n.map((function(){return{}})),i=n.length;function a(t){var e,a,o,u;for(e in t)for(o=t[e].tuple,a=0;ac?1/0:(e=Math.max(l,Math.min(e,c-s)),l+s*Math.floor(1e-14+(e-l)/s))};return f.start=l,f.stop=u.stop,f.step=s,this.value=e(f,r(o),t.name||"bin_"+n(o))},fu.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},st(fu,Xa).transform=function(t,e){var n=e.fork(e.ALL),r=cu(Ot,this.value,n.materialize(n.ADD).add),i=t.sort,a=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(Pt(i),a),e.source&&e.source.root&&(this.value.root=e.source.root),n},st(hu,Xt),pu.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};var gu=st(pu,Xa);function mu(t){Xa.call(this,null,t)}gu.transform=function(t,e){function n(e){return function(n){for(var r,i=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(u(n),t.case,a)||[],s=0,l=i.length;s{var e={};return e[s[0]]=t[0],e[s[1]]=t[1],qt(e)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n};function ku(t){Xa.call(this,null,t)}ku.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function Au(t){Xt.call(this,null,Mu,t),this.modified(!0)}function Mu(t){var i=t.expr;return this.value&&!t.modified("expr")?this.value:e(e=>i(e,t),r(i),n(i))}function Eu(t){Xa.call(this,[void 0,void 0],t)}function Du(t,e){Xt.call(this,t),this.parent=e,this.count=0}st(ku,Xa).transform=function(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=wu(e.source,t.groupby,h),i=t.smooth||!1,a=t.field,o=t.step||function(t,e){return bt(et(t,e))/30}(n,a),u=Pt((t,e)=>a(t)-a(e)),s=t.as||"bin",l=r.length;let c,f=1/0,d=-1/0,p=0;for(;pd&&(d=e),t[++c][s]=e}return this.value={start:f,stop:d,step:o},e.reflow(!0).modifies(s)},st(Au,Xt),Eu.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},st(Eu,Xa).transform=function(t,e){var r,i=this.value,a=t.field,o=i[0],u=i[1];if(((r=e.changed()||e.modified(a.fields)||t.modified("field"))||null==o)&&(o=1/0,u=-1/0),e.visit(r?e.SOURCE:e.ADD,(function(t){var e=E(a(t));null!=e&&(eu&&(u=e))})),!Number.isFinite(o)||!Number.isFinite(u)){let t=n(a);t&&(t=` for field "${t}"`),e.dataflow.warn(`Infinite extent${t}: [${o}, ${u}]`),o=u=void 0}this.value=[o,u]};var Cu=st(Du,Xt);function Fu(t){Xa.call(this,{},t),this._keys=ot();const e=this._targets=[];e.active=0,e.forEach=t=>{for(let n=0,r=e.active;nthis.subflow(t,i,e);return this._group=t.group||{},this.initTargets(),e.visit(e.REM,t=>{const e=Ot(t),n=a.get(e);void 0!==n&&(a.delete(e),u(n).rem(t))}),e.visit(e.ADD,t=>{const e=r(t);a.set(Ot(t),e),u(e).add(t)}),o||e.modified(r.fields)?e.visit(e.MOD,t=>{const e=Ot(t),n=a.get(e),i=r(t);n===i?u(i).mod(t):(a.set(e,i),u(n).rem(t),u(i).add(t))}):e.changed(e.MOD)&&e.visit(e.MOD,t=>{u(a.get(Ot(t))).mod(t)}),o&&e.visit(e.REFLOW,t=>{const e=Ot(t),n=a.get(e),i=r(t);n!==i&&(a.set(e,i),u(n).rem(t),u(i).add(t))}),e.clean()?n.runAfter(()=>{this.clean(),a.clean()}):a.empty>n.cleanThreshold&&n.runAfter(a.clean),e},st(Bu,Xt),zu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},st(zu,Xa).transform=function(t,e){var n=e.dataflow,r=this.value,i=e.fork(),a=i.add,o=i.rem,u=i.mod,s=t.expr,l=!0;function c(e){var n=Ot(e),i=s(e,t),c=r.get(n);i&&c?(r.delete(n),a.push(e)):i||c?l&&i&&!c&&u.push(e):(r.set(n,1),o.push(e))}return e.visit(e.REM,(function(t){var e=Ot(t);r.has(e)?r.delete(e):o.push(t)})),e.visit(e.ADD,(function(e){s(e,t)?a.push(e):r.set(Ot(e),1)})),e.visit(e.MOD,c),t.modified()&&(l=!1,e.visit(e.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i},Nu.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},st(Nu,Xa).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=t.fields,i=bu(r,t.as||[]),a=t.index||null,o=i.length;return n.rem=this.value,e.visit(e.SOURCE,(function(t){for(var e,u,s,l=r.map(e=>e(t)),c=l.reduce((t,e)=>Math.max(t,e.length),0),f=0;fe[r]=n(e,t))},st(qu,Xa).transform=function(t,e){var n,r,i,a=this.value,o=e.fork(e.ALL),u=t.size-a.length,s=t.generator;if(u>0){for(n=[];--u>=0;)n.push(i=qt(s(t))),a.push(i);o.add=o.add.length?o.materialize(o.ADD).add.concat(n):n}else r=a.slice(0,-u),o.rem=o.rem.length?o.materialize(o.REM).rem.concat(r):r,a=a.slice(-u);return o.source=this.value=a,o};var Uu={value:"value",median:an,mean:function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n},min:tn,max:Ke},Lu=[];function $u(t){Xa.call(this,[],t)}function Pu(t){ou.call(this,t)}$u.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},st($u,Xa).transform=function(t,e){var r,i,a,o,s,l,c,f,h,d,p=e.fork(e.ALL),g=function(t){var e,n=t.method||Uu.value;if(null!=Uu[n])return n===Uu.value?(e=void 0!==t.value?t.value:0,function(){return e}):Uu[n];u("Unrecognized imputation method: "+n)}(t),m=function(t){var e=t.field;return function(t){return t?e(t):NaN}}(t),v=n(t.field),y=n(t.key),_=(t.groupby||[]).map(n),x=function(t,e,n,r){var i,a,o,u,s,l,c,f,h=function(t){return t(f)},d=[],p=r?r.slice():[],g={},m={};for(p.forEach((function(t,e){g[t]=e+1})),u=0,c=t.length;ua&&(a=r[1]);return[i,a]}function Zu(t){Xt.call(this,null,Qu,t)}function Qu(t){return this.value&&!t.modified()?this.value:t.values.reduce((function(t,e){return t.concat(e)}),[])}function Ku(t){Xa.call(this,null,t)}function ts(t){ou.call(this,t)}ju.transform=function(t,e){var n,r=this,i=t.modified();return r.value&&(i||e.modified(r._inputs,!0))?(n=r.value=i?r.init(t):{},e.visit(e.SOURCE,(function(t){r.add(t)}))):(n=r.value=r.value||this.init(t),e.visit(e.REM,(function(t){r.rem(t)})),e.visit(e.ADD,(function(t){r.add(t)}))),r.changes(),e.visit(e.SOURCE,(function(t){tt(t,n[r.cellkey(t)].tuple)})),e.reflow(i).modifies(this._outputs)},ju.changes=function(){var t,e,n=this._adds,r=this._mods;for(t=0,e=this._alen;t{const n=Fo(e,s)[l],r=t.counts?e.length:1;nu(n,h||et(e),d,p).forEach(t=>{const n={};for(let t=0;t(this._pending=W(t.data),t=>t.touch(this)))}}return n.request(t.url,t.format).then(t=>Vu(this,e,W(t.data)))},Gu.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},st(Gu,Xa).transform=function(t,e){var r,i,a=e,o=t.as,s=t.fields,l=t.index,c=t.values,f=null==t.default?null:t.default,h=t.modified(),d=h?e.SOURCE:e.ADD,p=s.length;return c?(i=c.length,p>1&&!o&&u('Multi-field lookup requires explicit "as" parameter.'),o&&o.length!==p*i&&u('The "as" parameter has too few output field names.'),o=o||c.map(n),r=function(t){for(var e,n,r=0,a=0;re||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0)})),e?i.slice(0,e):i}(i,t.limit||0,n);n.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:s.map((function(){return o})),fields:s.map((function(t){return function(t,n,r,i){return e((function(e){return n(e)===t?r(e):NaN}),i,t+"")}(t,i,a,u)})),as:s.map((function(t){return t+""})),modified:t.modified.bind(t)}}(t,n),n)};function rs(t){Xa.call(this,null,t)}function is(t){Xa.call(this,null,t)}function as(t){Xa.call(this,null,t)}st(ns,Fu).transform=function(t,e){const n=t.subflow,i=t.field,a=t=>this.subflow(Ot(t),n,e,t);return(t.modified("field")||i&&e.modified(r(i)))&&u("PreFacet does not support field modification."),this.initTargets(),i?(e.visit(e.MOD,t=>{const e=a(t);i(t).forEach(t=>e.mod(t))}),e.visit(e.ADD,t=>{const e=a(t);i(t).forEach(t=>e.add(qt(t)))}),e.visit(e.REM,t=>{const e=a(t);i(t).forEach(t=>e.rem(t))})):(e.visit(e.MOD,t=>a(t).mod(t)),e.visit(e.ADD,t=>a(t).add(t)),e.visit(e.REM,t=>a(t).rem(t))),e.clean()&&e.runAfter(()=>this.clean()),e},rs.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},st(rs,Xa).transform=function(t,e){var n,r,i=t.fields,a=bu(t.fields,t.as||[]),o=i?function(t,e){return function(t,e,n,r){for(var i=0,a=n.length;i{const e=go(t,l);for(let n=0;n{var e=Ot(t);n.rem.push(r[e]),r[e]=null}),e.visit(e.ADD,t=>{var e=Ut(t);r[Ot(t)]=e,n.add.push(e)}),e.visit(e.MOD,t=>{var e,i=r[Ot(t)];for(e in t)i[e]=t[e],n.modifies(e);n.mod.push(i)})),n},ss.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},st(ss,Xa).transform=function(e,n){var r=n.fork(n.NO_SOURCE),i=e.modified("size"),a=e.size,o=this.value,u=this.count,s=0,l=o.reduce((function(t,e){return t[Ot(e)]=1,t}),{});function c(e){var n,i;o.length=s&&(n=o[i],l[Ot(n)]&&r.rem.push(n),o[i]=e),++u}if(n.rem.length&&(n.visit(n.REM,(function(t){var e=Ot(t);l[e]&&(l[e]=-1,r.rem.push(t)),--u})),o=o.filter((function(t){return-1!==l[Ot(t)]}))),(n.rem.length||i)&&o.lengtha){for(var f=0,h=o.length-a;fh&&(h=r))})),o.start=f,o.stop=h,e.modifies(i?s:l)},ds._floor=function(t,e){const n="utc"===t.timezone;let{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:Kr({extent:t.extent||et(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins});r=Pn(r);const a=this.value||{},o=(n?Nr:Br)(r,i);return o.unit=M(r),o.units=r,o.step=i,o.start=a.start,o.stop=a.stop,this.value=o},st(ps,Xa).transform=function(t,e){var n=e.dataflow,r=t.field,i=this.value,a=!0;function o(t){i.set(r(t),t)}return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,o)):e.changed()?(e.visit(e.REM,(function(t){i.delete(r(t))})),e.visit(e.ADD,o)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()},st(gs,Xa).transform=function(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(Pt(t.sort)):e.source).map(t.field))};const ms={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:e=>{let n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?t=n+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:e=>{let n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){let t=ms.rank(),e=t.next;return{init:t.init,next:t=>(e(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:e=>{let n=e.index,r=e.data,i=e.compare;if(t0||u("ntile num must be greater than zero.");let n=ms.cume_dist(),r=n.next;return{init:n.init,next:t=>Math.ceil(e*r(t))}},lag:function(t,e){return e=+e||1,{next:n=>{let r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:n=>{let r=n.index+e,i=n.data;return rt(e.data[e.i0])}},last_value:function(t){return{next:e=>t(e.data[e.i1-1])}},nth_value:function(t,e){return(e=+e)>0||u("nth_value nth must be greater than zero."),{next:n=>{let r=n.i0+(e-1);return re=null,next:n=>{let r=t(n.data[n.index]);return null!=r?e=r:e}}},next_value:function(t){let e,n;return{init:()=>(e=null,n=-1),next:r=>{let i=r.data;return r.index<=n?e:(n=function(t,e,n){for(let r=e.length;nf[t]=1)}v(t.sort),i.forEach((function(t,e){let r=a[e],i=n(r),f=eo(t,i,s[e]);if(v(r),l.push(f),it(ms,t))c.push(function(t,e,n,r){let i=ms[t](e,n);return{init:i.init||d,update:function(t,e){e[r]=i.next(t)}}}(t,a[e],o[e],f));else{if(null==r&&"count"!==t&&u("Null aggregate field specified."),"count"===t)return void g.push(f);p=!1;let e=h[i];e||(e=h[i]=[],e.field=r,m.push(e)),e.push(oo(t,f))}})),(g.length||m.length)&&(e.cell=function(t,e,n){t=t.map(t=>ho(t,t.field));let r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,a=r.agg=Array(i),o=0;ot.init()),this.cell&&this.cell.init()},_s.update=function(t,e){let n,r=this.cell,i=this.windows,a=t.data,o=i&&i.length;if(r){for(n=t.p0;n0&&!i(a[n],a[n-1])&&(t.i0=e.left(a,a[n])),r1e-6)if(Math.abs(c*u-s*l)>1e-6&&i){var h=n-a,d=r-o,p=u*u+s*s,g=h*h+d*d,m=Math.sqrt(p),v=Math.sqrt(f),y=i*Math.tan((Rs-Math.acos((p+f-g)/(2*m*v)))/2),_=y/v,x=y/m;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*l)+","+(e+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*h>l*d)+","+(this._x1=t+x*u)+","+(this._y1=e+x*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,a){t=+t,e=+e,a=!!a;var o=(n=+n)*Math.cos(r),u=n*Math.sin(r),s=t+o,l=e+u,c=1^a,f=a?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+s+","+l),n&&(f<0&&(f=f%qs+qs),f>Us?this._+="A"+n+","+n+",0,1,"+c+","+(t-o)+","+(e-u)+"A"+n+","+n+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>1e-6&&(this._+="A"+n+","+n+",0,"+ +(f>=Rs)+","+c+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var js=Math.abs,Is=Math.atan2,Ws=Math.cos,Hs=Math.max,Ys=Math.min,Vs=Math.sin,Gs=Math.sqrt,Xs=Math.PI,Js=Xs/2,Zs=2*Xs;function Qs(t){return t>1?0:t<-1?Xs:Math.acos(t)}function Ks(t){return t>=1?Js:t<=-1?-Js:Math.asin(t)}function tl(t){return t.innerRadius}function el(t){return t.outerRadius}function nl(t){return t.startAngle}function rl(t){return t.endAngle}function il(t){return t&&t.padAngle}function al(t,e,n,r,i,a,o,u){var s=n-t,l=r-e,c=o-i,f=u-a,h=f*s-c*l;if(!(h*h<1e-12))return[t+(h=(c*(e-a)-f*(t-i))/h)*s,e+h*l]}function ol(t,e,n,r,i,a,o){var u=t-n,s=e-r,l=(o?a:-a)/Gs(u*u+s*s),c=l*s,f=-l*u,h=t+c,d=e+f,p=n+c,g=r+f,m=(h+p)/2,v=(d+g)/2,y=p-h,_=g-d,x=y*y+_*_,b=i-a,w=h*g-p*d,k=(_<0?-1:1)*Gs(Hs(0,b*b*x-w*w)),A=(w*_-y*k)/x,M=(-w*y-_*k)/x,E=(w*_+y*k)/x,D=(-w*y+_*k)/x,C=A-m,F=M-v,S=E-m,B=D-v;return C*C+F*F>S*S+B*B&&(A=E,M=D),{cx:A,cy:M,x01:-c,y01:-f,x11:A*(i/b-1),y11:M*(i/b-1)}}function ul(t){this._context=t}function sl(t){return new ul(t)}function ll(t){return t[0]}function cl(t){return t[1]}function fl(){var t=ll,e=cl,n=Ps(!0),r=null,i=sl,a=null;function o(o){var u,s,l,c=o.length,f=!1;for(null==r&&(a=i(l=$s())),u=0;u<=c;++u)!(u=c;--f)u.point(m[f],v[f]);u.lineEnd(),u.areaEnd()}g&&(m[l]=+t(h,l,s),v[l]=+n(h,l,s),u.point(e?+e(h,l,s):m[l],r?+r(h,l,s):v[l]))}if(d)return u=null,d+""||null}function l(){return fl().defined(i).curve(o).context(a)}return s.x=function(n){return arguments.length?(t="function"==typeof n?n:Ps(+n),e=null,s):t},s.x0=function(e){return arguments.length?(t="function"==typeof e?e:Ps(+e),s):t},s.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:Ps(+t),s):e},s.y=function(t){return arguments.length?(n="function"==typeof t?t:Ps(+t),r=null,s):n},s.y0=function(t){return arguments.length?(n="function"==typeof t?t:Ps(+t),s):n},s.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Ps(+t),s):r},s.lineX0=s.lineY0=function(){return l().x(t).y(n)},s.lineY1=function(){return l().x(t).y(r)},s.lineX1=function(){return l().x(e).y(n)},s.defined=function(t){return arguments.length?(i="function"==typeof t?t:Ps(!!t),s):i},s.curve=function(t){return arguments.length?(o=t,null!=a&&(u=o(a)),s):o},s.context=function(t){return arguments.length?(null==t?a=u=null:u=o(a=t),s):a},s}ul.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var dl={draw:function(t,e){var n=Math.sqrt(e/Xs);t.moveTo(n,0),t.arc(0,0,n,0,Zs)}};function pl(){}function gl(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function ml(t){this._context=t}function vl(t){this._context=t}function yl(t){this._context=t}function _l(t,e){this._basis=new ml(t),this._beta=e}ml.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:gl(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:gl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},vl.prototype={areaStart:pl,areaEnd:pl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=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)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:gl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},yl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:gl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},_l.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],a=e[0],o=t[n]-i,u=e[n]-a,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*o),this._beta*e[s]+(1-this._beta)*(a+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var xl=function t(e){function n(t){return 1===e?new ml(t):new _l(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function bl(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function wl(t,e){this._context=t,this._k=(1-e)/6}wl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:bl(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:bl(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var kl=function t(e){function n(t){return new wl(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Al(t,e){this._context=t,this._k=(1-e)/6}Al.prototype={areaStart:pl,areaEnd:pl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=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)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:bl(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ml=function t(e){function n(t){return new Al(t,e)}return n.tension=function(e){return t(+e)},n}(0);function El(t,e){this._context=t,this._k=(1-e)/6}El.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:bl(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Dl=function t(e){function n(t){return new El(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Cl(t,e,n){var r=t._x1,i=t._y1,a=t._x2,o=t._y2;if(t._l01_a>1e-12){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>1e-12){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*l+t._x1*t._l23_2a-e*t._l12_2a)/c,o=(o*l+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,a,o,t._x2,t._y2)}function Fl(t,e){this._context=t,this._alpha=e}Fl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Cl(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Sl=function t(e){function n(t){return e?new Fl(t,e):new wl(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Bl(t,e){this._context=t,this._alpha=e}Bl.prototype={areaStart:pl,areaEnd:pl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=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)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Cl(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Tl=function t(e){function n(t){return e?new Bl(t,e):new Al(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function zl(t,e){this._context=t,this._alpha=e}zl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Cl(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Nl=function t(e){function n(t){return e?new zl(t,e):new El(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Ol(t){this._context=t}function Rl(t){return t<0?-1:1}function ql(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),u=(a*i+o*r)/(r+i);return(Rl(a)+Rl(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function Ul(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Ll(t,e,n){var r=t._x0,i=t._y0,a=t._x1,o=t._y1,u=(a-r)/3;t._context.bezierCurveTo(r+u,i+u*e,a-u,o-u*n,a,o)}function $l(t){this._context=t}function Pl(t){this._context=new jl(t)}function jl(t){this._context=t}function Il(t){this._context=t}function Wl(t){var e,n,r=t.length-1,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var Yl={basis:{curve:function(t){return new ml(t)}},"basis-closed":{curve:function(t){return new vl(t)}},"basis-open":{curve:function(t){return new yl(t)}},bundle:{curve:xl,tension:"beta",value:.85},cardinal:{curve:kl,tension:"tension",value:0},"cardinal-open":{curve:Dl,tension:"tension",value:0},"cardinal-closed":{curve:Ml,tension:"tension",value:0},"catmull-rom":{curve:Sl,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Tl,tension:"alpha",value:.5},"catmull-rom-open":{curve:Nl,tension:"alpha",value:.5},linear:{curve:sl},"linear-closed":{curve:function(t){return new Ol(t)}},monotone:{horizontal:function(t){return new Pl(t)},vertical:function(t){return new $l(t)}},natural:{curve:function(t){return new Il(t)}},step:{curve:function(t){return new Hl(t,.5)}},"step-after":{curve:function(t){return new Hl(t,1)}},"step-before":{curve:function(t){return new Hl(t,0)}}};function Vl(t,e,n){var r=it(Yl,t)&&Yl[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}var Gl={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},Xl=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function Jl(t){var e,n,r,i,a,o,u,s,l,c,f,h=[];for(s=0,c=(e=t.slice().replace(Xl[0],"###$1").split(Xl[1]).slice(1)).length;su)for(l=1,f=i.length;l1&&(n*=g=Math.sqrt(g),r*=g);var m=h/n,v=f/n,y=-f/r,_=h/r,x=m*u+v*s,b=y*u+_*s,w=m*t+v*e,k=y*t+_*e,A=(w-x)*(w-x)+(k-b)*(k-b),M=1/A-.25;M<0&&(M=0);var E=Math.sqrt(M);a==i&&(E=-E);var D=.5*(x+w)-E*(k-b),C=.5*(b+k)+E*(w-x),F=Math.atan2(b-C,x-D),S=Math.atan2(k-C,w-D),B=S-F;B<0&&1===a?B+=Kl:B>0&&0===a&&(B-=Kl);for(var T=Math.ceil(Math.abs(B/(Ql+.001))),z=[],N=0;N+t}function _c(t,e,n){return Math.max(e,Math.min(t,n))}function xc(){var t=pc,e=gc,n=mc,r=vc,i=yc(0),a=i,o=i,u=i,s=null;function l(l,c,f){var h,d=null!=c?c:+t.call(this,l),p=null!=f?f:+e.call(this,l),g=+n.call(this,l),m=+r.call(this,l),v=Math.min(g,m)/2,y=_c(+i.call(this,l),0,v),_=_c(+a.call(this,l),0,v),x=_c(+o.call(this,l),0,v),b=_c(+u.call(this,l),0,v);if(s||(s=h=$s()),y<=0&&_<=0&&x<=0&&b<=0)s.rect(d,p,g,m);else{var w=d+g,k=p+m;s.moveTo(d+y,p),s.lineTo(w-_,p),s.bezierCurveTo(w-dc*_,p,w,p+dc*_,w,p+_),s.lineTo(w,k-b),s.bezierCurveTo(w,k-dc*b,w-dc*b,k,w-b,k),s.lineTo(d+x,k),s.bezierCurveTo(d+dc*x,k,d,k-dc*x,d,k-x),s.lineTo(d,p+y),s.bezierCurveTo(d,p+dc*y,d+dc*y,p,d+y,p),s.closePath()}if(h)return s=null,h+""||null}return l.x=function(e){return arguments.length?(t=yc(e),l):t},l.y=function(t){return arguments.length?(e=yc(t),l):e},l.width=function(t){return arguments.length?(n=yc(t),l):n},l.height=function(t){return arguments.length?(r=yc(t),l):r},l.cornerRadius=function(t,e,n,r){return arguments.length?(i=yc(t),a=null!=e?yc(e):i,u=null!=n?yc(n):i,o=null!=r?yc(r):a,l):i},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function bc(){var t,e,n,r,i,a,o,u,s=null;function l(t,e,n){var r=n/2;if(i){var l=o-e,c=t-a;if(l||c){var f=Math.sqrt(l*l+c*c),h=(l/=f)*u,d=(c/=f)*u,p=Math.atan2(c,l);s.moveTo(a-h,o-d),s.lineTo(t-l*r,e-c*r),s.arc(t,e,r,p-Math.PI,p),s.lineTo(a+h,o+d),s.arc(a,o,u,p,p+Math.PI)}else s.arc(t,e,r,0,Kl);s.closePath()}else i=1;a=t,o=e,u=r}function c(a){var o,u,c,f=a.length,h=!1;for(null==s&&(s=c=$s()),o=0;o<=f;++o)!(ot.x||0,Ac=t=>t.y||0,Mc=t=>!(!1===t.defined),Ec=function(){var t=tl,e=el,n=Ps(0),r=null,i=nl,a=rl,o=il,u=null;function s(){var s,l,c=+t.apply(this,arguments),f=+e.apply(this,arguments),h=i.apply(this,arguments)-Js,d=a.apply(this,arguments)-Js,p=js(d-h),g=d>h;if(u||(u=s=$s()),f1e-12)if(p>Zs-1e-12)u.moveTo(f*Ws(h),f*Vs(h)),u.arc(0,0,f,h,d,!g),c>1e-12&&(u.moveTo(c*Ws(d),c*Vs(d)),u.arc(0,0,c,d,h,g));else{var m,v,y=h,_=d,x=h,b=d,w=p,k=p,A=o.apply(this,arguments)/2,M=A>1e-12&&(r?+r.apply(this,arguments):Gs(c*c+f*f)),E=Ys(js(f-c)/2,+n.apply(this,arguments)),D=E,C=E;if(M>1e-12){var F=Ks(M/c*Vs(A)),S=Ks(M/f*Vs(A));(w-=2*F)>1e-12?(x+=F*=g?1:-1,b-=F):(w=0,x=b=(h+d)/2),(k-=2*S)>1e-12?(y+=S*=g?1:-1,_-=S):(k=0,y=_=(h+d)/2)}var B=f*Ws(y),T=f*Vs(y),z=c*Ws(b),N=c*Vs(b);if(E>1e-12){var O,R=f*Ws(_),q=f*Vs(_),U=c*Ws(x),L=c*Vs(x);if(p1e-12?C>1e-12?(m=ol(U,L,B,T,f,C,g),v=ol(R,q,z,N,f,C,g),u.moveTo(m.cx+m.x01,m.cy+m.y01),C1e-12&&w>1e-12?D>1e-12?(m=ol(z,N,R,q,c,-D,g),v=ol(B,T,U,L,c,-D,g),u.lineTo(m.cx+m.x01,m.cy+m.y01),Dt.startAngle||0).endAngle(t=>t.endAngle||0).padAngle(t=>t.padAngle||0).innerRadius(t=>t.innerRadius||0).outerRadius(t=>t.outerRadius||0).cornerRadius(t=>t.cornerRadius||0),Dc=hl().x(kc).y1(Ac).y0(t=>(t.y||0)+(t.height||0)).defined(Mc),Cc=hl().y(Ac).x1(kc).x0(t=>(t.x||0)+(t.width||0)).defined(Mc),Fc=fl().x(kc).y(Ac).defined(Mc),Sc=xc().x(kc).y(Ac).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>wc(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>wc(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>wc(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>wc(t.cornerRadiusBottomLeft,t.cornerRadius)||0),Bc=function(){var t=Ps(dl),e=Ps(64),n=null;function r(){var r;if(n||(n=r=$s()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),r)return n=null,r+""||null}return r.type=function(e){return arguments.length?(t="function"==typeof e?e:Ps(e),r):t},r.size=function(t){return arguments.length?(e="function"==typeof t?t:Ps(+t),r):e},r.context=function(t){return arguments.length?(n=null==t?null:t,r):n},r}().type(t=>fc(t.shape||"circle")).size(t=>wc(t.size,64)),Tc=bc().x(kc).y(Ac).defined(Mc).size(t=>t.size||1);function zc(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Nc(t,e,n,r){return Sc.context(t)(e,n,r)}var Oc=1;function Rc(){Oc=1}function qc(t,e,n){var r=e.clip,i=t._defs,a=e.clip_id||(e.clip_id="clip"+Oc++),o=i.clipping[a]||(i.clipping[a]={id:a});return Y(r)?o.path=r(null):zc(n)?o.path=Nc(null,n,0,0):(o.width=n.width||0,o.height=n.height||0),"url(#"+a+")"}function Uc(t){this.clear(),t&&this.union(t)}var Lc=Uc.prototype;function $c(t){this.mark=t,this.bounds=this.bounds||new Uc}function Pc(t){$c.call(this,t),this.items=this.items||[]}function jc(t,e){if("undefined"!=typeof document&&document.createElement){var n=document.createElement("canvas");if(n&&n.getContext)return n.width=t,n.height=e,n}return null}function Ic(){return"undefined"!=typeof Image?Image:null}function Wc(t){this._pending=0,this._loader=t||Sa()}Lc.clone=function(){return new Uc(this)},Lc.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},Lc.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},Lc.equals=function(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},Lc.set=function(t,e,n,r){return nthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},Lc.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},Lc.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},Lc.scale=function(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},Lc.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},Lc.rotate=function(t,e,n){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},Lc.rotatedPoints=function(t,e,n){var{x1:r,y1:i,x2:a,y2:o}=this,u=Math.cos(t),s=Math.sin(t),l=e-e*u+n*s,c=n-e*s-n*u;return[u*r-s*i+l,s*r+u*i+c,u*r-s*o+l,s*r+u*o+c,u*a-s*i+l,s*a+u*i+c,u*a-s*o+l,s*a+u*o+c]},Lc.union=function(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},Lc.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},Lc.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},Lc.intersects=function(t){return t&&!(this.x2t.x2||this.y2t.y2)},Lc.contains=function(t,e){return!(tthis.x2||ethis.y2)},Lc.width=function(){return this.x2-this.x1},Lc.height=function(){return this.y2-this.y1},st(Pc,$c);var Hc=Wc.prototype;function Yc(t){t._pending+=1}function Vc(t){t._pending-=1}function Gc(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const r=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(r+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,r):0))}return t}Hc.pending=function(){return this._pending},Hc.sanitizeURL=function(t){var e=this;return Yc(e),e._loader.sanitize(t,{context:"href"}).then((function(t){return Vc(e),t})).catch((function(){return Vc(e),null}))},Hc.loadImage=function(t){const e=this,n=Ic();return Yc(e),e._loader.sanitize(t,{context:"image"}).then((function(t){const r=t.href;if(!r||!n)throw{url:r};const i=new n,a=it(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=a&&(i.crossOrigin=a),i.onload=()=>Vc(e),i.onerror=()=>Vc(e),i.src=r,i})).catch((function(t){return Vc(e),{complete:!1,width:0,height:0,src:t&&t.url||""}}))},Hc.ready=function(){var t=this;return new Promise((function(e){!function n(r){t.pending()?setTimeout((function(){n(!0)}),10):e(r)}(!1)}))};var Xc,Jc,Zc,Qc=Kl-1e-8;function Kc(t){return Xc=t,Kc}function tf(){}function ef(t,e){Xc.add(t,e)}function nf(t,e){ef(Jc=t,Zc=e)}function rf(t){ef(t,Xc.y1)}function af(t){ef(Xc.x1,t)}function of(t,e,n,r){const i=(t-e)/(t+n-2*e);01e-14?(s=o*o+u*a,s>=0&&(s=Math.sqrt(s),l=(-o+s)/a,c=(-o-s)/a)):l=.5*u/o,0Qc)ef(t-n,e-n),ef(t+n,e+n);else{const o=r=>ef(n*Math.cos(r)+t,n*Math.sin(r)+e);let u,s;if(o(r),o(i),i!==r)if((r%=Kl)<0&&(r+=Kl),(i%=Kl)<0&&(i+=Kl),ii;++s,u-=Ql)o(u);else for(u=r-r%Ql+Ql,s=0;s<4&&um)return!1;d>g&&(g=d)}else if(f>0){if(d0&&(t.globalAlpha=n,t.fillStyle=_f(t,e,e.fill),!0)}var bf=[];function wf(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=_f(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||bf),t.lineDashOffset=e.strokeDashOffset||0),!0))}function kf(t,e){return t.zindex-e.zindex||t.index-e.index}function Af(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,a=[];for(n=0,r=i.length;n=0;)if(n=e(i[r]))return n;if(i===a)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function Df(t){return function(e,n,r){Mf(n,(function(n){r&&!r.intersects(n.bounds)||Ff(t,e,n,n)}))}}function Cf(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||Ff(t,e,n.items[0],n.items)}}function Ff(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(mf(e,n),n.fill&&xf(e,n,i)&&e.fill(),n.stroke&&wf(e,n,i)&&e.stroke()))}function Sf(t){return t=t||g,function(e,n,r,i,a,o){return r*=e.pixelRatio,i*=e.pixelRatio,Ef(n,(function(n){var u=n.bounds;if((!u||u.contains(a,o))&&u)return t(e,n,r,i,a,o)?n:void 0}))}}function Bf(t,e){return function(n,r,i,a){var o,u,s=Array.isArray(r)?r[0]:r,l=null==e?s.fill:e,c=s.stroke&&n.isPointInStroke;return c&&(o=s.strokeWidth,u=s.strokeCap,n.lineWidth=null!=o?o:1,n.lineCap=null!=u?u:"butt"),!t(n,r)&&(l&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a))}}function Tf(t){return Sf(Bf(t))}function zf(t,e){return"translate("+t+","+e+")"}function Nf(t){return"rotate("+t+")"}function Of(t){return zf(t.x||0,t.y||0)}function Rf(t){return zf(t.x||0,t.y||0)+(t.angle?" "+Nf(t.angle):"")+(t.scaleX||t.scaleY?" "+(e=t.scaleX||1,n=t.scaleY||1,"scale("+e+","+n+")"):"");var e,n}function qf(t,e,n){function r(t,n){var r=n.x||0,i=n.y||0,a=n.angle||0;t.translate(r,i),a&&t.rotate(a*=Zl),t.beginPath(),e(t,n),a&&t.rotate(-a),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",Rf(n)),t("d",e(null,n))},bound:function(t,n){var r=n.x||0,i=n.y||0;return e(Kc(t),n),Gc(t,n).translate(r,i),n.angle&&t.rotate(n.angle*Zl,r,i),t},draw:Df(r),pick:Tf(r),isect:n||ff(r)}}var Uf=qf("arc",(function(t,e){return Ec.context(t)(e)}));function Lf(t,e,n){function r(t,n){t.beginPath(),e(t,n)}var i=Bf(r);return{type:t,tag:"path",nested:!0,attr:function(t,n){var r=n.mark.items;r.length&&t("d",e(null,r))},bound:function(t,n){var r=n.items;return 0===r.length?t:(e(Kc(t),r),Gc(t,r[0]))},draw:Cf(r),pick:function(t,e,n,r,a,o){var u=e.items,s=e.bounds;return!u||!u.length||s&&!s.contains(a,o)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,u,n,r)?u[0]:null)},isect:hf,tip:n}}var $f=Lf("area",(function(t,e){var n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Cc:Dc).curve(Vl(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],a="horizontal"===t[0].orient?"y":"x",o=t.length,u=1/0;--o>=0;)!1!==t[o].defined&&(r=Math.abs(t[o][a]-i)).5&&e<1.5?.5-Math.abs(e-1):0}function If(t,e){const n=jf(e);t("d",Nc(null,e,n,n))}function Wf(t,e,n,r){const i=jf(e);t.beginPath(),Nc(t,e,(n||0)+i,(r||0)+i)}const Hf=Bf(Wf),Yf=Bf(Wf,!1);var Vf={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Of(e))},bound:function(t,e){if(!e.clip&&e.items){const n=e.items,r=n.length;for(let e=0;e{const r=e.x||0,i=e.y||0,a=e.strokeForeground,o=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&o&&(Wf(t,e,r,i),mf(t,e),e.fill&&xf(t,e,o)&&t.fill(),e.stroke&&!a&&wf(t,e,o)&&t.stroke()),t.save(),t.translate(r,i),e.clip&&Pf(t,e),n&&n.translate(-r,-i),Mf(e,e=>{this.draw(t,e,n)}),n&&n.translate(r,i),t.restore(),a&&e.stroke&&o&&(Wf(t,e,r,i),mf(t,e),wf(t,e,o)&&t.stroke())})},pick:function(t,e,n,r,i,a){if(e.bounds&&!e.bounds.contains(i,a)||!e.items)return null;const o=n*t.pixelRatio,u=r*t.pixelRatio;return Ef(e,s=>{let l,c,f,h,d,p,g,m,v;if(m=s.bounds,(!m||m.contains(i,a))&&(h=s.x||0,d=s.y||0,p=h+(s.width||0),g=d+(s.height||0),v=s.clip,!v||!(ip||ag)))return t.save(),t.translate(h,d),h=i-h,d=a-d,v&&zc(s)&&!Hf(t,s,o,u)?(t.restore(),null):(c=s.strokeForeground,f=!1!==e.interactive,f&&c&&s.stroke&&Yf(t,s,o,u)?(t.restore(),s):(l=Ef(s,t=>function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,h,d)?this.pick(t,n,r,h,d):null),!l&&f&&(s.fill||!c&&s.stroke)&&Hf(t,s,o,u)&&(l=s),t.restore(),l||null))})},isect:df,content:function(t,e,n){t("clip-path",e.clip?qc(n,e,e):null)},background:function(t,e){t("class","background"),t("aria-hidden",!0),If(t,e)},foreground:function(t,e){t("class","foreground"),t("aria-hidden",!0),e.strokeForeground?If(t,e):t("d","")}},Gf={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function Xf(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then(e=>{t.image=e,t.image.url=t.url})),n}function Jf(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function Zf(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function Qf(t,e){return"center"===t?e/2:"right"===t?e:0}function Kf(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var th={type:"image",tag:"image",nested:!1,attr:function(t,e,n){const r=Xf(e,n),i=Jf(e,r),a=Zf(e,r),o=(e.x||0)-Qf(e.align,i),u=(e.y||0)-Kf(e.baseline,a);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",Gf["xmlns:xlink"],"xlink:href"),t("transform",zf(o,u)),t("width",i),t("height",a),t("preserveAspectRatio",!1===e.aspect?"none":"xMidYMid")},bound:function(t,e){const n=e.image,r=Jf(e,n),i=Zf(e,n),a=(e.x||0)-Qf(e.align,r),o=(e.y||0)-Kf(e.baseline,i);return t.set(a,o,a+r,o+i)},draw:function(t,e,n){Mf(e,e=>{if(n&&!n.intersects(e.bounds))return;let r,i,a,o,u=Xf(e,this),s=Jf(e,u),l=Zf(e,u),c=(e.x||0)-Qf(e.align,s),f=(e.y||0)-Kf(e.baseline,l);!1!==e.aspect&&(i=u.width/u.height,a=e.width/e.height,i==i&&a==a&&i!==a&&(a=0;)if(!1!==t[a].defined&&(n=t[a].x-e[0])*n+(r=t[a].y-e[1])*r1?e:e[0]:e;var e}function xh(t){const e=_h(t);return(_(e)?e.length-1:0)*yh(t)}function bh(t,e){const n=null==e?"":(e+"").trim();return t.limit>0&&n.length?function(t,e){var n=+t.limit,r=function(t){if(fh.width===gh){const e=kh(t);return t=>mh(t,e)}{const e=vh(t);return t=>ph(t,e)}}(t);if(r(e)>>1,r(e.slice(i))>n?u=i+1:s=i;return a+e.slice(u)}for(;u>>1),r(e.slice(0,i))Math.max(t,fh.width(e,n)),0)):r=fh.width(e,f),"center"===a?l-=r/2:"right"===a&&(l-=r),t.set(l+=u,c+=s,l+r,c+i),e.angle&&!n)t.rotate(e.angle*Zl,u,s);else if(2===n)return t.rotatedPoints(e.angle*Zl,u,s);return t}var Fh={arc:Uf,area:$f,group:Vf,image:th,line:eh,path:rh,rect:ah,rule:uh,shape:sh,symbol:lh,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+Ah(e),a=Dh(e),o=a.x1,u=a.y1,s=e.angle||0;t("text-anchor",Mh[e.align]||"start"),s?(n=zf(o,u)+" "+Nf(s),(r||i)&&(n+=" "+zf(r,i))):n=zf(o+r,u+i),t("transform",n)},bound:Ch,draw:function(t,e,n){Mf(e,(function(e){var r,i,a,o,u,s,l,c=null==e.opacity?1:e.opacity;if(!(n&&!n.intersects(e.bounds)||0===c||e.fontSize<=0||null==e.text||0===e.text.length)){if(t.font=kh(e),t.textAlign=e.align||"left",i=(r=Dh(e)).x1,a=r.y1,e.angle&&(t.save(),t.translate(i,a),t.rotate(e.angle*Zl),i=a=0),i+=e.dx||0,a+=(e.dy||0)+Ah(e),s=_h(e),mf(t,e),_(s))for(u=yh(e),o=0;o=0;)if(!1!==t[i].defined&&(n=t[i].x-e[0])*n+(r=t[i].y-e[1])*r<(n=t[i].size||1)*n)return t[i];return null}))};function Sh(t,e,n){var r=Fh[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new Uc),t,n)}var Bh={mark:null};function Th(t,e,n){var r,i,a,o,u=Fh[t.marktype],s=u.bound,l=t.items,c=l&&l.length;if(u.nested)return c?a=l[0]:(Bh.mark=t,a=Bh),o=Sh(a,s,n),e=e&&e.union(o)||o;if(e=e||t.bounds&&t.bounds.clear()||new Uc,c)for(r=0,i=l.length;re;)t.removeChild(n[--r]);return t}function Ih(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Wh(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Hh(t,e){this._active=null,this._handlers={},this._loader=t||Sa(),this._tooltip=e||Yh}function Yh(t,e,n,r){t.element().setAttribute("title",r||"")}qh.toJSON=function(t){return Nh(this.root,t||0)},qh.mark=function(t,e,n){var r=Uh(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r};const Vh=Hh.prototype;function Gh(t){this._el=null,this._bgcolor=null,this._loader=new Wc(t)}Vh.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Vh.element=function(){return this._el},Vh.canvas=function(){return this._el&&this._el.firstChild},Vh.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Vh.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Vh.on=function(){},Vh.off=function(){},Vh._handlerIndex=function(t,e,n){for(let r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1},Vh.handlers=function(t){const e=this._handlers,n=[];if(t)n.push.apply(n,e[this.eventName(t)]);else for(const t in e)n.push.apply(n,e[t]);return n},Vh.eventName=function(t){const e=t.indexOf(".");return e<0?t:t.slice(0,e)},Vh.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then(e=>{const n=new MouseEvent(t.type,t),r=Lh(null,"a");for(const t in e)r.setAttribute(t,e[t]);r.dispatchEvent(n)}).catch((function(){}))},Vh.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,a,o=t&&t.mark;if(o&&(i=Fh[o.marktype]).tip){for((a=Wh(e,n))[0]-=r[0],a[1]-=r[1];t=t.mark.group;)a[0]-=t.x||0,a[1]-=t.y||0;t=i.tip(o.items,a)}return t}(e,t,this.canvas(),this._origin);const r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}},Vh.getItemBoundingClientRect=function(t){const e=this.canvas();if(!e)return;const n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,a=i.width(),o=i.height();let u=i.x1+r[0]+n.left,s=i.y1+r[1]+n.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,s+=t.y||0;return{x:u,y:s,width:a,height:o,left:u,top:s,right:u+a,bottom:s+o}};var Xh=Gh.prototype;Xh.initialize=function(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)},Xh.element=function(){return this._el},Xh.canvas=function(){return this._el&&this._el.firstChild},Xh.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},Xh.resize=function(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this},Xh.dirty=function(){},Xh.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},Xh._render=function(){},Xh.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then((function(){return e})):Promise.resolve(e)},Xh._load=function(t,e){var n=this,r=n._loader[t](e);if(!n._ready){var i=n._call;n._ready=n._loader.ready().then((function(t){t&&i(),n._ready=null}))}return r},Xh.sanitizeURL=function(t){return this._load("sanitizeURL",t)},Xh.loadImage=function(t){return this._load("loadImage",t)};const Jh="dragleave",Zh="mousedown",Qh="mousemove",Kh="mouseout",td="click",ed=["keydown","keypress","keyup","dragenter",Jh,"dragover",Zh,"mouseup",Qh,Kh,"mouseover",td,"dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],nd=Qh,rd=Kh,id=td;function ad(t,e){Hh.call(this,t,e),this._down=null,this._touch=null,this._first=!0,this._events={}}const od=st(ad,Hh);od.initialize=function(t,e,n){return this._canvas=t&&$h(t,"canvas"),[td,Zh,Qh,Kh,Jh].forEach(t=>ud(this,t)),Hh.prototype.initialize.call(this,t,e,n)};function ud(t,e){(t=>"touchstart"===t||"touchmove"===t||"touchend"===t?["touchstart","touchmove","touchend"]:[t])(e).forEach(e=>function(t,e){const n=t.canvas();n&&!t._events[e]&&(t._events[e]=1,n.addEventListener(e,t[e]?n=>t[e](n):n=>t.fire(e,n)))}(t,e))}function sd(t,e,n){return function(r){const i=this._active,a=this.pickEvent(r);a===i||(i&&i.exit||this.fire(n,r),this._active=a,this.fire(e,r)),this.fire(t,r)}}function ld(t){return function(e){this.fire(t,e),this._active=null}}od.canvas=function(){return this._canvas},od.context=function(){return this._canvas.getContext("2d")},od.events=ed,od.DOMMouseScroll=function(t){this.fire("mousewheel",t)},od.mousemove=sd(Qh,"mouseover",Kh),od.dragover=sd("dragover","dragenter",Jh),od.mouseout=ld(Kh),od.dragleave=ld(Jh),od.mousedown=function(t){this._down=this._active,this.fire(Zh,t)},od.click=function(t){this._down===this._active&&(this.fire(td,t),this._down=null)},od.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},od.touchmove=function(t){this.fire("touchmove",t,!0)},od.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},od.fire=function(t,e,n){const r=n?this._touch:this._active,i=this._handlers[t];if(e.vegaType=t,t===id&&r&&r.href?this.handleHref(e,r,r.href):t!==nd&&t!==rd||this.handleTooltip(e,r,t!==rd),i)for(let t=0,n=i.length;t=0&&r.splice(i,1),this},od.pickEvent=function(t){const e=Wh(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},od.pick=function(t,e,n,r,i){const a=this.context();return Fh[t.marktype].pick.call(this,a,t,e,n,r,i)};var cd="undefined"!=typeof window&&window.devicePixelRatio||1;function fd(t){Gh.call(this,t),this._options={},this._redraw=!1,this._dirty=new Uc,this._tempb=new Uc}const hd=st(fd,Gh),dd=Gh.prototype;hd.initialize=function(t,e,n,r,i,a){return this._options=a||{},this._canvas=this._options.externalContext?null:jc(1,1,this._options.type),t&&this._canvas&&(jh(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),dd.initialize.call(this,t,e,n,r,i)},hd.resize=function(t,e,n,r){if(dd.resize.call(this,t,e,n,r),this._canvas)!function(t,e,n,r,i,a){const o="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),s=o?cd:i;t.width=e*s,t.height=n*s;for(const t in a)u[t]=a[t];o&&1!==s&&(t.style.width=e+"px",t.style.height=n+"px"),u.pixelRatio=s,u.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||u("CanvasRenderer is missing a valid canvas or context"),t.scale(this._scale,this._scale),t.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},hd.canvas=function(){return this._canvas},hd.context=function(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},hd.dirty=function(t){let e=this._tempb.clear().union(t.bounds),n=t.mark.group;for(;n;)e.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(e)};function pd(t,e){Hh.call(this,t,e);const n=this;n._hrefHandler=md(n,(t,e)=>{e&&e.href&&n.handleHref(t,e,e.href)}),n._tooltipHandler=md(n,(t,e)=>{n.handleTooltip(t,e,t.type!==rd)})}hd._render=function(t){const e=this.context(),n=this._origin,r=this._width,i=this._height,a=this._dirty,o=((t,e,n)=>(new Uc).set(0,0,e,n).translate(-t[0],-t[1]))(n,r,i);e.save();const u=this._redraw||a.empty()?(this._redraw=!1,o.expand(1)):function(t,e,n){return e.expand(1).round(),t.pixelRatio%1&&e.scale(t.pixelRatio).round().scale(1/t.pixelRatio),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,o.intersect(a),n);return this.clear(-n[0],-n[1],r,i),this.draw(e,t,u),e.restore(),a.clear(),this},hd.draw=function(t,e,n){const r=Fh[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),Y(n)?(t.beginPath(),n(t),t.clip()):Pf(t,e.group)}(t,e),r.draw.call(this,t,e,n),e.clip&&t.restore()},hd.clear=function(t,e,n,r){const i=this._options,a=this.context();"pdf"===i.type||i.externalContext||a.clearRect(t,e,n,r),null!=this._bgcolor&&(a.fillStyle=this._bgcolor,a.fillRect(t,e,n,r))};const gd=st(pd,Hh);gd.initialize=function(t,e,n){let r=this._svg;return r&&(r.removeEventListener(id,this._hrefHandler),r.removeEventListener(nd,this._tooltipHandler),r.removeEventListener(rd,this._tooltipHandler)),this._svg=r=t&&$h(t,"svg"),r&&(r.addEventListener(id,this._hrefHandler),r.addEventListener(nd,this._tooltipHandler),r.addEventListener(rd,this._tooltipHandler)),Hh.prototype.initialize.call(this,t,e,n)},gd.canvas=function(){return this._svg};const md=(t,e)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,e.call(t._obj,n,r)};function vd(t,e,n){var r=t-e+2*n;return t?r>0?r:1:0}gd.on=function(t,e){const n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){const i={type:t,handler:e,listener:md(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},gd.off=function(t,e){const n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this};const yd="log",_d="time",xd="utc",bd="continuous";function wd(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function kd(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Ad=Symbol("implicit");function Md(){var t=new Map,e=[],n=[],r=Ad;function i(i){var a=i+"",o=t.get(a);if(!o){if(r!==Ad)return r;t.set(a,o=e.push(i))}return n[(o-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Map;for(const r of n){const n=r+"";t.has(n)||t.set(n,e.push(r))}return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Md(e,n).unknown(r)},wd.apply(i,arguments),i}function Ed(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Dd(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Cd(){}var Fd="\\s*([+-]?\\d+)\\s*",Sd="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Bd="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Td=/^#([0-9a-f]{3,8})$/,zd=new RegExp("^rgb\\("+[Fd,Fd,Fd]+"\\)$"),Nd=new RegExp("^rgb\\("+[Bd,Bd,Bd]+"\\)$"),Od=new RegExp("^rgba\\("+[Fd,Fd,Fd,Sd]+"\\)$"),Rd=new RegExp("^rgba\\("+[Bd,Bd,Bd,Sd]+"\\)$"),qd=new RegExp("^hsl\\("+[Sd,Bd,Bd]+"\\)$"),Ud=new RegExp("^hsla\\("+[Sd,Bd,Bd,Sd]+"\\)$"),Ld={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function $d(){return this.rgb().formatHex()}function Pd(){return this.rgb().formatRgb()}function jd(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Td.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Id(e):3===n?new Vd(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Wd(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Wd(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=zd.exec(t))?new Vd(e[1],e[2],e[3],1):(e=Nd.exec(t))?new Vd(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Od.exec(t))?Wd(e[1],e[2],e[3],e[4]):(e=Rd.exec(t))?Wd(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=qd.exec(t))?Zd(e[1],e[2]/100,e[3]/100,1):(e=Ud.exec(t))?Zd(e[1],e[2]/100,e[3]/100,e[4]):Ld.hasOwnProperty(t)?Id(Ld[t]):"transparent"===t?new Vd(NaN,NaN,NaN,0):null}function Id(t){return new Vd(t>>16&255,t>>8&255,255&t,1)}function Wd(t,e,n,r){return r<=0&&(t=e=n=NaN),new Vd(t,e,n,r)}function Hd(t){return t instanceof Cd||(t=jd(t)),t?new Vd((t=t.rgb()).r,t.g,t.b,t.opacity):new Vd}function Yd(t,e,n,r){return 1===arguments.length?Hd(t):new Vd(t,e,n,null==r?1:r)}function Vd(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Gd(){return"#"+Jd(this.r)+Jd(this.g)+Jd(this.b)}function Xd(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"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))+(1===t?")":", "+t+")")}function Jd(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Zd(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new tp(t,e,n,r)}function Qd(t){if(t instanceof tp)return new tp(t.h,t.s,t.l,t.opacity);if(t instanceof Cd||(t=jd(t)),!t)return new tp;if(t instanceof tp)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,u=a-i,s=(a+i)/2;return u?(o=e===a?(n-r)/u+6*(n0&&s<1?0:o,new tp(o,u,s,t.opacity)}function Kd(t,e,n,r){return 1===arguments.length?Qd(t):new tp(t,e,n,null==r?1:r)}function tp(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function ep(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Ed(Cd,jd,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:$d,formatHex:$d,formatHsl:function(){return Qd(this).formatHsl()},formatRgb:Pd,toString:Pd}),Ed(Vd,Yd,Dd(Cd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Vd(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Vd(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Gd,formatHex:Gd,formatRgb:Xd,toString:Xd})),Ed(tp,Kd,Dd(Cd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new tp(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new tp(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Vd(ep(t>=240?t-240:t+120,i,r),ep(t,i,r),ep(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var np=Math.PI/180,rp=180/Math.PI,ip=6/29*3*(6/29);function ap(t){if(t instanceof up)return new up(t.l,t.a,t.b,t.opacity);if(t instanceof pp)return gp(t);t instanceof Vd||(t=Hd(t));var e,n,r=fp(t.r),i=fp(t.g),a=fp(t.b),o=sp((.2225045*r+.7168786*i+.0606169*a)/1);return r===i&&i===a?e=n=o:(e=sp((.4360747*r+.3850649*i+.1430804*a)/.96422),n=sp((.0139322*r+.0971045*i+.7141733*a)/.82521)),new up(116*o-16,500*(e-o),200*(o-n),t.opacity)}function op(t,e,n,r){return 1===arguments.length?ap(t):new up(t,e,n,null==r?1:r)}function up(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function sp(t){return t>6/29*(6/29)*(6/29)?Math.pow(t,1/3):t/ip+4/29}function lp(t){return t>6/29?t*t*t:ip*(t-4/29)}function cp(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function fp(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function hp(t){if(t instanceof pp)return new pp(t.h,t.c,t.l,t.opacity);if(t instanceof up||(t=ap(t)),0===t.a&&0===t.b)return new pp(NaN,0=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,u=r180||n<-180?n-360*Math.round(n/360):n):Sp(isNaN(t)?e:t)}function zp(t){return 1==(t=+t)?Np:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Sp(isNaN(e)?n:e)}}function Np(t,e){var n=e-t;return n?Bp(t,n):Sp(isNaN(t)?e:t)}Ed(Ep,Mp,Dd(Cd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ep(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Ep(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*np,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Vd(255*(e+n*(mp*r+vp*i)),255*(e+n*(yp*r+_p*i)),255*(e+n*(xp*r)),this.opacity)}}));var Op=function t(e){var n=zp(e);function r(t,e){var r=n((t=Yd(t)).r,(e=Yd(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),o=Np(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=o(e),t+""}}return r.gamma=t,r}(1);function Rp(t){return function(e){var n,r,i=e.length,a=new Array(i),o=new Array(i),u=new Array(i);for(n=0;na&&(i=e.slice(a,i),u[o]?u[o]+=i:u[++o]=i),(n=n[0])===(r=r[0])?u[o]?u[o]+=r:u[++o]=r:(u[++o]=null,s.push({i:o,x:Ip(n,r)})),a=Yp.lastIndex;return a180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ip(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,o.rotate,u,s),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ip(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,o.skewX,u,s),function(t,e,n,r,a,o){if(t!==n||e!==r){var u=a.push(i(a)+"scale(",null,",",null,")");o.push({i:u-4,x:Ip(t,n)},{i:u-2,x:Ip(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,u,s),a=o=null,function(t){for(var e,n=-1,r=s.length;++ne&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(o[0],o[t-1])),r=t>2?Ag:kg,i=a=null,f}function f(e){return isNaN(e=+e)?n:(i||(i=r(o.map(t),u,s)))(t(l(e)))}return f.invert=function(n){return l(e((a||(a=r(u,o.map(t),Ip)))(n)))},f.domain=function(t){return arguments.length?(o=Array.from(t,_g),c()):o.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),c()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),s=Xp,c()},f.clamp=function(t){return arguments.length?(l=!!t||bg,c()):l!==bg},f.interpolate=function(t){return arguments.length?(s=t,c()):s},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,c()}}function Dg(){return Eg()(bg,bg)}function Cg(t,e,n,r){var i,a=Qe(t,e,n);switch((r=fn(null==r?",f":r)).type){case"s":var o=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=kn(a,o))||(r.precision=i),yn(r,o);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=An(a,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=wn(a))||(r.precision=i-2*("%"===r.type))}return vn(r)}function Fg(t){var e=t.domain;return t.ticks=function(t){var n=e();return Je(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return Cg(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i=e(),a=0,o=i.length-1,u=i[a],s=i[o];return s0?r=Ze(u=Math.floor(u/r)*r,s=Math.ceil(s/r)*r,n):r<0&&(r=Ze(u=Math.ceil(u*r)/r,s=Math.floor(s*r)/r,n)),r>0?(i[a]=Math.floor(u/r)*r,i[o]=Math.ceil(s/r)*r,e(i)):r<0&&(i[a]=Math.ceil(u*r)/r,i[o]=Math.floor(s*r)/r,e(i)),t},t}function Sg(t,e){var n,r=0,i=(t=t.slice()).length-1,a=t[r],o=t[i];return o0){for(;h<=d;++h)for(c=1,l=n(h);cs)break;g.push(f)}}else for(;h<=d;++h)for(c=a-1,l=n(h);c>=1;--c)if(!((f=l*c)s)break;g.push(f)}2*g.lengtha[1-c])))return n=Math.max(0,We(f,s)-1),o=s===l?n:We(f,l)-1,s-f[n]>e+1e-10&&++n,c&&(u=n,n=h-o,o=h-u),n>o?void 0:r().slice(n,o+1)}},n.invert=function(t){var e=n.invertRange([t,t]);return e?e[0]:e},n.copy=function(){return em().domain(r()).range(a).round(o).paddingInner(u).paddingOuter(s).align(l)},c()}var nm=Array.prototype.map;function rm(t){return nm.call(t,(function(t){return+t}))}var im=Array.prototype.slice;const am={};function om(t,e,n){const r=function(){var n=e();return n.invertRange||(n.invertRange=n.invert?function(t){return function(e){var n,r=e[0],i=e[1];return i=u&&o[i]<=s&&(l<0&&(l=i),n=i);if(!(l<0))return u=t.invertExtent(o[l]),s=t.invertExtent(o[n]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=t,n};return r.metadata=Dt(W(n)),r}function um(t,e,n){return arguments.length>1?(am[t]=om(t,e,n),this):sm(t)?am[t]:void 0}function sm(t){return it(am,t)}function lm(t,e){const n=am[t];return n&&n.metadata[e]}function cm(t){return lm(t,bd)}function fm(t){return lm(t,"discrete")}function hm(t){return lm(t,"discretizing")}function dm(t){return lm(t,yd)}function pm(t){return lm(t,"interpolating")}function gm(t){return lm(t,"quantile")}um("identity",(function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,_g),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,_g):[0,1],Fg(r)})),um("linear",(function t(){var e=Dg();return e.copy=function(){return Mg(e,t())},wd.apply(e,arguments),Fg(e)}),bd),um(yd,(function t(){var e=qg(Eg()).domain([1,10]);return e.copy=function(){return Mg(e,t()).base(e.base())},wd.apply(e,arguments),e}),[bd,yd]),um("pow",Hg,bd),um("sqrt",(function(){return Hg.apply(null,arguments).exponent(.5)}),bd),um("symlog",(function t(){var e=$g(Eg());return e.copy=function(){return Mg(e,t()).constant(e.constant())},wd.apply(e,arguments)}),bd),um(_d,(function(){return wd.apply(Gg(rr,nr,Kn,Zn,Jn,Xn,Gn,Vn,ai).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[bd,"temporal"]),um(xd,(function(){return wd.apply(Gg(hr,fr,sr,or,ar,ir,Gn,Vn,ui).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[bd,"temporal"]),um("sequential",Zg,[bd,"interpolating"]),um("sequential-linear",Zg,[bd,"interpolating"]),um("sequential-log",(function t(){var e=qg(Xg()).domain([1,10]);return e.copy=function(){return Jg(e,t()).base(e.base())},kd.apply(e,arguments)}),[bd,"interpolating",yd]),um("sequential-pow",Qg,[bd,"interpolating"]),um("sequential-sqrt",(function(){return Qg.apply(null,arguments).exponent(.5)}),[bd,"interpolating"]),um("sequential-symlog",(function t(){var e=$g(Xg());return e.copy=function(){return Jg(e,t()).constant(e.constant())},kd.apply(e,arguments)}),[bd,"interpolating"]),um("diverging-linear",(function t(){var e=Fg(Kg()(bg));return e.copy=function(){return Jg(e,t())},kd.apply(e,arguments)}),[bd,"interpolating"]),um("diverging-log",(function t(){var e=qg(Kg()).domain([.1,1,10]);return e.copy=function(){return Jg(e,t()).base(e.base())},kd.apply(e,arguments)}),[bd,"interpolating",yd]),um("diverging-pow",tm,[bd,"interpolating"]),um("diverging-sqrt",(function(){return tm.apply(null,arguments).exponent(.5)}),[bd,"interpolating"]),um("diverging-symlog",(function t(){var e=$g(Kg());return e.copy=function(){return Jg(e,t()).constant(e.constant())},kd.apply(e,arguments)}),[bd,"interpolating"]),um("quantile",(function t(){var e,n=[],r=[],i=[];function a(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t0?i[e-1]:n[0],e=i?[a[i-1],r]:[a[e-1],a[e]]},u.unknown=function(t){return arguments.length?(e=t,u):u},u.thresholds=function(){return a.slice()},u.copy=function(){return t().domain([n,r]).range(o).unknown(e)},wd.apply(Fg(u),arguments)}),"discretizing"),um("threshold",(function t(){var e,n=[.5],r=[0,1],i=1;function a(t){return t<=t?r[We(n,t,0,i)]:e}return a.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),a):n.slice()},a.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},a.unknown=function(t){return arguments.length?(e=t,a):e},a.copy=function(){return t().domain(n).range(r).unknown(e)},wd.apply(a,arguments)}),"discretizing"),um("bin-ordinal",(function t(){var e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(We(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=rm(t),r):e.slice()},r.range=function(t){return arguments.length?(n=im.call(t),r):n.slice()},r.tickFormat=function(t,n){return Cg(e[0],M(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),["discrete","discretizing"]),um("ordinal",Md,"discrete"),um("band",em,"discrete"),um("point",(function(){return function t(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return t(n())},e}(em().paddingInner(1))}),"discrete");const mm=["clamp","base","constant","exponent"];function vm(t,e){var n=e[0],r=M(e)-n;return function(e){return t(n+e*r)}}function ym(t,e,n){return vg(bm(e||"rgb",n),t)}function _m(t,e){for(var n=new Array(e),r=e+1,i=0;it[e]?a[e](t[e]()):0),a):Q(.5)}function bm(t,e){var n=yg[function(t){return"interpolate"+t.toLowerCase().split("-").map((function(t){return t[0].toUpperCase()+t.slice(1)})).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function wm(t){for(var e=t.length/6|0,n=new Array(e),r=0;r1?(Am[t]=e,this):Am[t]}km({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},wm),km({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},t=>ym(wm(t)));const Em=t=>_(t)?t.map(t=>String(t)):String(t),Dm=(t,e)=>t[1]-e[1],Cm=(t,e)=>e[1]-t[1];function Fm(t,e,n){var r;return ht(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n&&(e=Math.min(e,Math.floor(bt(t.domain())/n||1)))),x(e)&&(r=e.step,e=e.interval),pt(e)&&(e=t.type===_d?qr(e):t.type==xd?Ur(e):u("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function Sm(t,e,n){let r=t.range(),i=r[0],a=M(r),o=Dm;if(i>a&&(r=a,a=i,i=r,o=Cm),i=Math.floor(i),a=Math.ceil(a),e=e.map(e=>[e,t(e)]).filter(t=>i<=t[1]&&t[1]<=a).sort(o).map(t=>t[0]),n>0&&e.length>1){const t=[e[0],M(e)];for(;e.length>n&&e.length>=3;)e=e.filter((t,e)=>!(e%2));e.length<3&&(e=t)}return e}function Bm(t,e){return t.bins?Sm(t,t.bins):t.ticks?t.ticks(e):t.domain()}function Tm(t,e,n,r,i,a){var o=e.type;let u=Em;if(o===_d||i===_d)u=t.timeFormat(r);else if(o===xd||i===xd)u=t.utcFormat(r);else if(dm(o)){const i=t.formatFloat(r);if(a||e.bins)u=i;else{const t=zm(e,n,!1);u=e=>t(e)?i(e):""}}else if(e.tickFormat){const i=e.domain();u=t.formatSpan(i[0],i[i.length-1],n,r)}else r&&(u=t.format(r));return u}function zm(t,e,n){const r=Bm(t,e),i=t.base(),a=Math.log(i),o=Math.max(1,i*e/r.length),u=t=>{let e=t/Math.pow(i,Math.round(Math.log(t)/a));return e*i1?i[1]-i[0]:i[0];for(r=1;r{var i=Um(r[n+1],Um(r.max,1/0)),a=Lm(e,t),o=Lm(i,t);return a&&o?a+" – "+o:o?"< "+o:"≥ "+a}}(u):"discrete"===r?function(t){return(e,n)=>n?t(e):null}(u):function(t){return e=>t(e)}(u)}function Um(t,e){return null!=t?t:e}function Lm(t,e){return Number.isFinite(t)?e(t):null}function $m(t,e,n,r){const i=r||e.type;return pt(n)&&function(t){return lm(t,"temporal")}(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||i!==_d?n||i!==xd?qm(t,e,5,null,n,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}function Pm(t,e,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=$m(t,e,n.format,n.formatType);if(hm(e.type)){const t=Rm(e).slice(1).map(i),n=t.length;return`${n} boundar${1===n?"y":"ies"}: ${t.join(", ")}`}if(fm(e.type)){const t=e.domain(),n=t.length;return`${n} value${1===n?"":"s"}: ${n>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=e.domain();return`values from ${i(t[0])} to ${i(M(t))}`}}const jm=(t,e,n)=>({role:t,"aria-roledescription":e,"aria-label":n||void 0}),Im=Dt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Wm={axis:{desc:"axis",caption:function(t){const e=t.datum,n=t.orient,r=e.title?Xm(t):null,i=t.context,a=i.scales[e.scale].value,o=i.dataflow.locale(),u=a.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(r?` titled '${r}'`:"")+` for a ${fm(u)?"discrete":u} scale with `+Pm(o,a,t)}},legend:{desc:"legend",caption:function(t){const e=t.datum,n=e.title?Xm(t):null,r=((e.type||"")+" legend").trim(),i=e.scales,a=Object.keys(i),o=t.context,u=o.scales[i[a[0]]].value,s=o.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?` titled '${n}'`:"")+" for "+function(t){return(t=t.map(t=>t+("fill"===t||"stroke"===t?" color":""))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+M(t)}(a)+" with "+Pm(s,u,t);var l}},"title-text":{desc:"title",caption:t=>`Title text '${Gm(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${Gm(t)}'`}},Hm={ariaRole:"role",ariaRoleDescription:"aria-roledescription",description:"aria-label"};function Ym(t,e){const n=!1===e.aria;if(t("aria-hidden",n||void 0),n||null==e.description)for(const e in Hm)t(Hm[e],void 0);else{const n=e.mark.marktype;t("aria-label",e.description),t("role",e.ariaRole||("group"===n?"graphics-object":"graphics-symbol")),t("aria-roledescription",e.ariaRoleDescription||n+" mark")}}function Vm(t){return!1===t.aria?{"aria-hidden":!0}:Im[t.role]?null:Wm[t.role]?function(t,e){try{const n=t.items[0],r=e.caption||(()=>"");return jm(e.role||"graphics-symbol",e.desc,n.description||r(n))}catch(t){return null}}(t,Wm[t.role]):function(t){const e=t.marktype,n="group"===e||"text"===e||t.items.some(t=>null!=t.description&&!1!==t.aria);return jm(n?"graphics-object":"graphics-symbol",e+" mark container",t.description)}(t)}function Gm(t){return W(t.text).join(" ")}function Xm(t){try{return W(M(t.items).items[0].text).join(" ")}catch(t){return null}}const Jm=t=>(t+"").replace(/&/g,"&").replace(/"/g,""");function Zm(t,e,n){var r,i,a="<"+t;if(e)for(r in e)null!=(i=e[r])&&(a+=" "+r+'="'+Jm(i)+'"');return n&&(a+=" "+n),a+">"}function Qm(t){return""}const Km={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity",blend:"mix-blend-mode"},tv={fill:"none","stroke-miterlimit":10},ev=Gf.xmlns;function nv(t){Gh.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var rv=st(nv,Gh),iv=Gh.prototype;function av(t,e,n){var r,i,a;if("radial"===e.gradient){var o=Ph(t,n++,"pattern",ev);o.setAttribute("id","p_"+e.id),o.setAttribute("viewBox","0,0,1,1"),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("preserveAspectRatio","xMidYMid slice"),(o=Ph(o,0,"rect",ev)).setAttribute("width","1"),o.setAttribute("height","1"),o.setAttribute("fill","url("+gv()+"#"+e.id+")"),(t=Ph(t,n++,"radialGradient",ev)).setAttribute("id",e.id),t.setAttribute("fx",e.x1),t.setAttribute("fy",e.y1),t.setAttribute("fr",e.r1),t.setAttribute("cx",e.x2),t.setAttribute("cy",e.y2),t.setAttribute("r",e.r2)}else(t=Ph(t,n++,"linearGradient",ev)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2);for(r=0,i=e.stops.length;r1&&t.previousSibling!=e}(o,n))&&e.insertBefore(o,n?n.nextSibling:e.firstChild),o}rv.initialize=function(t,e,n,r){if(this._defs={gradient:{},clipping:{}},t){this._svg=Ph(t,0,"svg",ev),this._svg.setAttribute("class","marks"),jh(t,1),this._root=Ph(this._svg,0,"g",ev);for(const t in tv)this._root.setAttribute(t,tv[t]);jh(this._svg,1)}return this.background(this._bgcolor),iv.initialize.call(this,t,e,n,r)},rv.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),iv.background.apply(this,arguments)},rv.resize=function(t,e,n,r){return iv.resize.call(this,t,e,n,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},rv.canvas=function(){return this._svg},rv.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in Gf)t[e]=Gf[e];var n=this._bgcolor?Zm("rect",{width:this._width,height:this._height,fill:this._bgcolor})+Qm("rect"):"";return Zm("svg",t)+(this._defs.el?this._defs.el.outerHTML:"")+n+this._root.outerHTML+Qm("svg")},rv._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),jh(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},rv.updateDefs=function(){const t=this._svg,e=this._defs;let n=e.el,r=0;for(const i in e.gradient)n||(e.el=n=Ph(t,0,"defs",ev)),r=av(n,e.gradient[i],r);for(const i in e.clipping)n||(e.el=n=Ph(t,0,"defs",ev)),r=ov(n,e.clipping[i],r);n&&(0===r?(t.removeChild(n),e.el=null):jh(n,r))},rv._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},rv.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},rv.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},rv._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length||!this._dirtyID)return!0;var e,n,r,i,a,o,u,s=++this._dirtyID;for(a=0,o=t.length;a{const e=this.isDirty(t),n=sv(t,r,s,a.tag,i);e&&(this._update(a,n,t),u&&function(t,e,n){e=e.lastChild.previousSibling;let r,i=0;Mf(n,n=>{r=t.draw(e,n,r),++i}),jh(e,1+i)}(this,n,t)),s=n,++l};return a.nested?e.items.length&&f(e.items[0]):Mf(e,f),jh(r,l),r};var lv=null,cv=null,fv={group:function(t,e,n){const r=lv=e.childNodes[2];cv=r.__values__,t.foreground(dv,n,this),cv=e.__values__,lv=e.childNodes[1],t.content(dv,n,this);const i=lv=e.childNodes[0];t.background(dv,n,this);const a=!1===n.mark.interactive?"none":null;if(a!==cv.events&&(pv(r,"pointer-events",a),pv(i,"pointer-events",a),cv.events=a),n.strokeForeground&&n.stroke){const t=n.fill;pv(r,"display",null),this.style(i,n),pv(i,"stroke",null),t&&(n.fill=null),cv=r.__values__,this.style(r,n),t&&(n.fill=t),lv=null}else pv(r,"display","none")},image:function(t,e,n){!1===n.smooth?(hv(e,"image-rendering","optimizeSpeed"),hv(e,"image-rendering","pixelated")):hv(e,"image-rendering",null)},text:function(t,e,n){let r,i,a,o,u=_h(n);_(u)?(i=u.map(t=>bh(n,t)),r=i.join("\n"),r!==cv.text&&(jh(e,0),a=e.ownerDocument,o=yh(n),i.forEach((t,r)=>{const i=Lh(a,"tspan",ev);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",o)),e.appendChild(i)}),cv.text=r)):(i=bh(n,u),i!==cv.text&&(e.textContent=i,cv.text=i)),pv(e,"font-family",wh(n)),pv(e,"font-size",vh(n)+"px"),pv(e,"font-style",n.fontStyle),pv(e,"font-variant",n.fontVariant),pv(e,"font-weight",n.fontWeight)}};function hv(t,e,n){n!==cv[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),cv[e]=n)}function dv(t,e,n){e!==cv[t]&&(n?function(t,e,n,r){null!=n?t.setAttributeNS(r,e,n):t.removeAttributeNS(r,e)}(lv,t,e,n):pv(lv,t,e),cv[t]=e)}function pv(t,e,n){null!=n?t.setAttribute(e,n):t.removeAttribute(e)}function gv(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function mv(t){Gh.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}rv._update=function(t,e,n){lv=e,cv=e.__values__,Ym(dv,n),t.attr(dv,n,this);const r=fv[t.type];r&&r.call(this,t,e,n),lv&&this.style(lv,n)},rv.style=function(t,e){if(null!=e)for(const n in Km){let r="font"===n?wh(e):e[n];if(r===cv[n])continue;const i=Km[n];null==r?t.removeAttribute(i):(Ts(r)&&(r=zs(r,this._defs.gradient,gv())),t.setAttribute(i,r+"")),cv[n]=r}};var vv=st(mv,Gh),yv=Gh.prototype;function _v(t){return t.replace(/&/g,"&").replace(//g,">")}vv.resize=function(t,e,n,r){yv.resize.call(this,t,e,n,r);var i=this._origin,a=this._text,o={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var u in Gf)o[u]=Gf[u];a.head=Zm("svg",o);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),a.bg=s?Zm("rect",{width:this._width,height:this._height,fill:s})+Qm("rect"):"",a.root=Zm("g",tt({},tv,{transform:"translate("+i+")"})),a.foot=Qm("g")+Qm("svg"),this},vv.background=function(){var t=yv.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},vv.svg=function(){var t=this._text;return t.head+t.defs+t.bg+t.root+t.body+t.foot},vv._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},vv.buildDefs=function(){let t,e="";for(const n in this._defs.gradient){const r=this._defs.gradient[n],i=r.stops;"radial"===r.gradient?(e+=Zm(t="pattern",{id:"p_"+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e+=Zm("rect",{width:"1",height:"1",fill:"url(#"+n+")"})+Qm("rect"),e+=Qm(t),e+=Zm(t="radialGradient",{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):e+=Zm(t="linearGradient",{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let t=0;t{i[r||t]=e};return Array.isArray(n)?n.forEach(t=>t(a,e,this)):n(a,e,this),r&&function(t,e,n,r,i){if(null==e)return t;"bgrect"===r&&!1===n.interactive&&(t["pointer-events"]="none");if("bgfore"===r&&(!1===n.interactive&&(t["pointer-events"]="none"),t.display="none",null!==e.fill))return t;"image"===r&&!1===e.smooth&&(t.style="image-rendering: optimizeSpeed; image-rendering: pixelated;");"text"===r&&(t["font-family"]=wh(e),t["font-size"]=vh(e)+"px",e.fontStyle&&(t["font-style"]=e.fontStyle),e.fontVariant&&(t["font-variant"]=e.fontVariant),e.fontWeight&&(t["font-weight"]=e.fontWeight));for(const n in Km){let r=e[n];const a=Km[n];("transparent"!==r||"fill"!==a&&"stroke"!==a)&&null!=r&&(Ts(r)&&(r=zs(r,i.gradient,"")),t[a]=r)}}(i,e,t,r,this._defs),i},vv.href=function(t){var e,n=this,r=t.href;if(r){if(e=n._hrefs&&n._hrefs[r])return e;n.sanitizeURL(r).then(t=>{t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[r]=t})}return null},vv.mark=function(t){const e=Fh[t.marktype],n=e.tag,r=[Ym,e.attr];let i="";i+=Zm("g",tt({class:Ih(t),"clip-path":t.clip?qc(this,t,t.group):null},Vm(t),{"pointer-events":"g"!==n&&!1===t.interactive?"none":null}));const a=a=>{const o=this.href(a);if(o&&(i+=Zm("a",o)),i+=Zm(n,this.attr(t,a,r,"g"!==n?n:null)),"text"===n){const t=_h(a);if(_(t)){const e={x:0,dy:yh(a)};for(let n=0;n{e+=this.mark(t)}),e};var xv={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},bv={};function wv(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(bv[t]=e,this):bv[t]}function kv(t,e,n){const r=[],i=(new Uc).union(e),a=t.marktype;return a?Av(t,i,n,r):"group"===a?Mv(t,i,n,r):u("Intersect scene must be mark node or group item.")}function Av(t,e,n,r){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const i=t.items,a=t.marktype,o=i.length;let u=0;if("group"===a)for(;u=0;r--)if(i[r]!=a[r])return!1;for(r=i.length-1;r>=0;r--)if(n=i[r],!Fv(t[n],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function Sv(t,e){return Fv(Jl(t),Jl(e))}function Bv(t){Xa.call(this,null,t)}function Tv(t,e,n){return e(t.bounds.clear(),t,n)}st(Bv,Xa).transform=function(t,e){var n,r=e.dataflow,i=t.mark,a=i.marktype,o=Fh[a],u=o.bound,s=i.bounds;if(o.nested)i.items.length&&r.dirty(i.items[0]),s=Tv(i,u),i.items.forEach((function(t){t.bounds.clear().union(s)}));else if("group"===a||t.modified())switch(e.visit(e.MOD,t=>r.dirty(t)),s.clear(),i.items.forEach(t=>s.union(Tv(t,u))),i.role){case"axis":case"legend":case"title":e.reflow()}else n=e.changed(e.REM),e.visit(e.ADD,t=>{s.union(Tv(t,u))}),e.visit(e.MOD,t=>{n=n||s.alignsWith(t.bounds),r.dirty(t),s.union(Tv(t,u))}),n&&(s.clear(),i.items.forEach(t=>s.union(t.bounds)));return Cv(i),e.modifies("bounds")};function zv(t){Xa.call(this,0,t)}function Nv(t){Xa.call(this,null,t)}function Ov(t){Xa.call(this,null,t)}zv.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},st(zv,Xa).transform=function(t,e){var n=function(t){var e=t._signals[":vega_identifier:"];e||(t._signals[":vega_identifier:"]=e=t.add(0));return e}(e.dataflow),r=n.value,i=t.as;return e.visit(e.ADD,t=>{t[i]||(t[i]=++r)}),n.set(this.value=r),e},st(Nv,Xa).transform=function(t,e){var n=this.value;n||((n=e.dataflow.scenegraph().mark(t.markdef,function(t){var e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=n.group),n.source=this.source,n.clip=t.clip,n.interactive=t.interactive,this.value=n);var r="group"===n.marktype?Pc:$c;return e.visit(e.ADD,t=>r.call(t,n)),(t.modified("clip")||t.modified("interactive"))&&(n.clip=t.clip,n.interactive=!!t.interactive,n.zdirty=!0,e.reflow()),n.items=e.source,e};var Rv=st(Ov,Xa),qv={parity:t=>t.filter((t,e)=>e%2?t.opacity=0:1),greedy:(t,e)=>{var n;return t.filter((t,r)=>r&&Uv(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1))}};function Uv(t,e,n){return n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function Lv(t,e){for(var n,r=1,i=t.length,a=t[0].bounds;r1&&e.height()>1}function Pv(t){return t.forEach(t=>t.opacity=1),t}function jv(t,e){return t.reflow(e.modified()).modifies("opacity")}function Iv(t){Xa.call(this,null,t)}Rv.transform=function(t,e){var n,r,i,a=qv[t.method]||qv.parity,o=e.materialize(e.SOURCE).source,u=t.separation||0;if(o&&o.length){if(!t.method)return t.modified("method")&&(Pv(o),e=jv(e,t)),e;if((o=o.filter($v)).length){if(t.sort&&(o=o.slice().sort(t.sort)),n=Pv(o),e=jv(e,t),n.length>=3&&Lv(n,u)){do{n=a(n,u)}while(n.length>=3&&Lv(n,u));n.length<3&&!M(o).opacity&&(n.length>1&&(M(n).opacity=0),M(o).opacity=1)}return t.boundScale&&t.boundTolerance>=0&&(r=function(t,e,n){var r=t.range(),i=new Uc;return e===Es||"bottom"===e?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),t=>i.encloses(t.bounds)}(t.boundScale,t.boundOrient,+t.boundTolerance),o.forEach(t=>{r(t)||(t.opacity=0)})),i=n[0].mark.bounds.clear(),o.forEach(t=>{t.opacity&&i.union(t.bounds)}),e}}},st(Iv,Xa).transform=function(t,e){var n=e.dataflow;if(e.visit(e.ALL,t=>n.dirty(t)),e.fields&&e.fields.zindex){var r=e.source&&e.source[0];r&&(r.mark.zdirty=!0)}};const Wv=new Uc;function Hv(t,e,n){return t[e]===n?0:(t[e]=n,1)}function Yv(t){var e=t.items[0].orient;return e===Ds||e===Cs}function Vv(t,e,n,r){var i,a,o=e.items[0],u=o.datum,s=null!=o.translate?o.translate:.5,l=o.orient,c=function(t){var e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(u),f=o.range,h=o.offset,d=o.position,p=o.minExtent,g=o.maxExtent,m=u.title&&o.items[c[2]].items[0],v=o.titlePadding,y=o.bounds,_=m&&xh(m),x=0,b=0;switch(Wv.clear().union(y),y.clear(),(i=c[0])>-1&&y.union(o.items[i].bounds),(i=c[1])>-1&&y.union(o.items[i].bounds),l){case Es:x=d||0,b=-h,a=Math.max(p,Math.min(g,-y.y1)),y.add(0,-a).add(f,0),m&&Gv(t,m,a,v,_,0,-1,y);break;case Ds:x=-h,b=d||0,a=Math.max(p,Math.min(g,-y.x1)),y.add(-a,0).add(0,f),m&&Gv(t,m,a,v,_,1,-1,y);break;case Cs:x=n+h,b=d||0,a=Math.max(p,Math.min(g,y.x2)),y.add(0,0).add(a,f),m&&Gv(t,m,a,v,_,1,1,y);break;case"bottom":x=d||0,b=r+h,a=Math.max(p,Math.min(g,y.y2)),y.add(0,0).add(f,a),m&&Gv(t,m,a,v,0,0,1,y);break;default:x=o.x,b=o.y}return Gc(y.translate(x,b),o),Hv(o,"x",x+s)|Hv(o,"y",b+s)&&(o.bounds=Wv,t.dirty(o),o.bounds=y,t.dirty(o)),o.mark.bounds.clear().union(y)}function Gv(t,e,n,r,i,a,o,u){const s=e.bounds;if(e.auto){const u=o*(n+i+r);let l=0,c=0;t.dirty(e),a?l=(e.x||0)-(e.x=u):c=(e.y||0)-(e.y=u),e.mark.bounds.clear().union(s.translate(-l,-c)),t.dirty(e)}u.union(s)}const Xv=(t,e)=>Math.floor(Math.min(t,e)),Jv=(t,e)=>Math.ceil(Math.max(t,e));function Zv(t){return(new Uc).set(0,0,t.width||0,t.height||0)}function Qv(t){var e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function Kv(t,e,n){var r=x(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function ty(t){return t<0?Math.ceil(-t):0}function ey(t,e,n){var r,i,a,o,u,s,l,c,f,h,d,p=!n.nodirty,g="flush"===n.bounds?Zv:Qv,m=Wv.set(0,0,0,0),v=Kv(n.align,"column"),y=Kv(n.align,Ss),_=Kv(n.padding,"column"),x=Kv(n.padding,Ss),b=n.columns||e.length,w=b<=0?1:Math.ceil(e.length/b),k=e.length,A=Array(k),M=Array(b),E=0,D=Array(k),C=Array(w),F=0,S=Array(k),B=Array(k),T=Array(k);for(i=0;i1)for(i=0;i0&&(S[i]+=f/2);if(y&&Kv(n.center,Ss)&&1!==b)for(i=0;i0&&(B[i]+=h/2);for(i=0;ii&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),A+=a,g=0,v=e.length;g=0&&null==(x=n[m]);m-=h);u?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=A):(b=A,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),y.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),M=o(M,y[l])}return M}function ay(t,e,n,r,i,a){if(e){t.dirty(e);var o=n,u=n;r?o=Math.round(i.x1+a*i.width()):u=Math.round(i.y1+a*i.height()),e.bounds.translate(o-(e.x||0),u-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=o,e.y=u,t.dirty(e)}}function oy(t,e,n,r,i,a,o){const u=function(t,e){const n=t[e]||{};return(e,r)=>null!=n[e]?n[e]:null!=t[e]?t[e]:r}(n,e),s=function(t,e){var n=-1/0;return t.forEach(t=>{null!=t.offset&&(n=Math.max(n,t.offset))}),n>-1/0?n:e}(t,u("offset",0)),l=u("anchor","start"),c=l===Fs?1:"middle"===l?.5:0,f={align:"each",bounds:u("bounds","flush"),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(e){case Ds:f.anchor={x:Math.floor(r.x1)-s,column:Fs,y:c*(o||r.height()+2*r.y1),row:l};break;case Cs:f.anchor={x:Math.ceil(r.x2)+s,y:c*(o||r.height()+2*r.y1),row:l};break;case Es:f.anchor={y:Math.floor(i.y1)-s,row:Fs,x:c*(a||i.width()+2*i.x1),column:l};break;case"bottom":f.anchor={y:Math.ceil(i.y2)+s,x:c*(a||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:a-s,y:s,column:Fs};break;case"bottom-left":f.anchor={x:s,y:o-s,row:Fs};break;case"bottom-right":f.anchor={x:a-s,y:o-s,column:Fs,row:Fs}}return f}function uy(t,e){var n,r,i,a,o=e.items[0],u=o.datum,s=o.orient,l=o.bounds,c=o.x,f=o.y;return o._bounds?o._bounds.clear().union(l):o._bounds=l.clone(),l.clear(),function(t,e,n){var r=e.padding,i=r-n.x,a=r-n.y;if(e.datum.title){var o=e.items[1].items[0],u=o.anchor,s=e.titlePadding||0,l=r-o.x,c=r-o.y;switch(o.orient){case Ds:i+=Math.ceil(o.bounds.width())+s;break;case Cs:case"bottom":break;default:a+=o.bounds.height()+s}switch((i||a)&&ly(t,n,i,a),o.orient){case Ds:c+=sy(e,n,o,u,1,1);break;case Cs:l+=sy(e,n,o,Fs,0,0)+s,c+=sy(e,n,o,u,1,1);break;case"bottom":l+=sy(e,n,o,u,0,0),c+=sy(e,n,o,Fs,-1,0,1)+s;break;default:l+=sy(e,n,o,u,0,0)}(l||c)&&ly(t,o,l,c),(l=Math.round(o.bounds.x1-r))<0&&(ly(t,n,-l,0),ly(t,o,-l,0))}else(i||a)&&ly(t,n,i,a)}(t,o,o.items[0].items[0]),l=function(t,e){return t.items.forEach(t=>e.union(t.bounds)),e.x1=t.padding,e.y1=t.padding,e}(o,l),n=2*o.padding,r=2*o.padding,l.empty()||(n=Math.ceil(l.width()+n),r=Math.ceil(l.height()+r)),"symbol"===u.type&&(i=o.items[0].items[0].items[0].items,a=i.reduce((t,e)=>(t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t),{}),i.forEach(t=>{t.width=a[t.column],t.height=t.bounds.y2-t.y})),"none"!==s&&(o.x=c=0,o.y=f=0),o.width=n,o.height=r,Gc(l.set(c,f,c+n,f+r),o),o.mark.bounds.clear().union(l),o}function sy(t,e,n,r,i,a,o){const u="symbol"!==t.datum.type,s=n.datum.vgrad,l=(!u||!a&&s||o?e:e.items[0]).bounds[i?"y2":"x2"]-t.padding,c=s&&a?l:0,f=s&&a?0:l,h=i<=0?0:xh(n);return Math.round("start"===r?c:r===Fs?f-h:.5*(l-h))}function ly(t,e,n,r){e.x+=n,e.y+=r,e.bounds.translate(n,r),e.mark.bounds.translate(n,r),t.dirty(e)}function cy(t){Xa.call(this,null,t)}st(cy,Xa).transform=function(t,e){var n=e.dataflow;return t.mark.items.forEach(e=>{t.layout&&function(t,e,n){var r,i,a,o,u,s,l,c=function(t){for(var e,n,r=t.items,i=r.length,a=0,o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a{"none"!==(a=t.orient||Cs)&&(e[a]||(e[a]=[])).push(t)});for(let r in e){const i=e[r];ey(t,i,oy(i,r,n.legends,h,d,l,c))}p.forEach(e=>{const r=e.bounds;if(r.equals(e._bounds)||(e.bounds=e._bounds,t.dirty(e),e.bounds=r,t.dirty(e)),n.autosize&&"fit"===n.autosize.type)switch(e.orient){case Ds:case Cs:f.add(r.x1,0).add(r.x2,0);break;case Es:case"bottom":f.add(0,r.y1).add(0,r.y2)}else f.union(r)})}f.union(h).union(d),r&&f.union(function(t,e,n,r,i){var a,o=e.items[0],u=o.frame,s=o.orient,l=o.anchor,c=o.offset,f=o.padding,h=o.items[0].items[0],d=o.items[1]&&o.items[1].items[0],p=s===Ds||s===Cs?r:n,g=0,m=0,v=0,y=0,_=0;if("group"!==u?s===Ds?(g=i.y2,p=i.y1):s===Cs?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):s===Ds&&(g=r,p=0),a="start"===l?g:l===Fs?p:(g+p)/2,d&&d.text){switch(s){case Es:case"bottom":_=h.bounds.height()+f;break;case Ds:y=h.bounds.width()+f;break;case Cs:y=-h.bounds.width()-f}Wv.clear().union(d.bounds),Wv.translate(y-(d.x||0),_-(d.y||0)),Hv(d,"x",y)|Hv(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(Wv),d.mark.bounds.clear().union(Wv),t.dirty(d)),Wv.clear().union(d.bounds)}else Wv.clear();switch(Wv.union(h.bounds),s){case Es:m=a,v=i.y1-Wv.height()-c;break;case Ds:m=i.x1-Wv.width()-c,v=a;break;case Cs:m=i.x2+Wv.width()+c,v=a;break;case"bottom":m=a,v=i.y2+c;break;default:m=o.x,v=o.y}return Hv(o,"x",m)|Hv(o,"y",v)&&(Wv.translate(m,v),t.dirty(o),o.bounds.clear().union(Wv),e.bounds.clear().union(Wv),t.dirty(o)),o.bounds}(t,r,l,c,f));e.clip&&f.set(0,0,e.width||0,e.height||0);!function(t,e,n,r){const i=r.autosize||{},a=i.type;if(t._autosize<1||!a)return;let o=t._width,u=t._height,s=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,Math.ceil(n.x2-s)),f=Math.max(0,e.height||0),h=Math.max(0,Math.ceil(-n.y1)),d=Math.max(0,Math.ceil(n.y2-f));if("padding"===i.contains){const e=t.padding();o-=e.left+e.right,u-=e.top+e.bottom}"none"===a?(l=0,h=0,s=o,f=u):"fit"===a?(s=Math.max(0,o-l-c),f=Math.max(0,u-h-d)):"fit-x"===a?(s=Math.max(0,o-l-c),u=f+h+d):"fit-y"===a?(o=s+l+c,f=Math.max(0,u-h-d)):"pad"===a&&(o=s+l+c,u=f+h+d);t._resizeView(o,u,s,f,[l,h],i.resize)}(t,e,f,n)}(n,e,t)}),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?e.reflow():e};var fy=Object.freeze({__proto__:null,bound:Bv,identifier:zv,mark:Nv,overlap:Ov,render:Iv,viewlayout:cy});function hy(t){Xa.call(this,null,t)}function dy(t){Xa.call(this,null,t)}function py(){return qt({})}function gy(t){Xa.call(this,null,t)}function my(t){Xa.call(this,[],t)}st(hy,Xa).transform=function(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.dataflow.locale(),r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=this.value,a=t.scale,o=Fm(a,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||Tm(n,a,o,t.formatSpecifier,t.formatType,!!t.values),s=t.values?Sm(a,t.values,o):Bm(a,o);return i&&(r.rem=i),i=s.map((function(t,e){return qt({index:e/(s.length-1||1),value:t,label:u(t)})})),t.extra&&i.length&&i.push(qt({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r},st(dy,Xa).transform=function(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||py,a=t.key||Ot,o=this.value;return _(r.encode)&&(r.encode=null),o&&(t.modified("key")||e.modified(a))&&u("DataJoin does not support modified key function or fields."),o||(e=e.addAll(),this.value=o=function(t){const e=ot().test(t=>t.exit);return e.lookup=n=>e.get(t(n)),e}(a)),e.visit(e.ADD,t=>{const e=a(t);let n=o.get(e);n?n.exit?(o.empty--,r.add.push(n)):r.mod.push(n):(n=i(t),o.set(e,n),r.add.push(n)),n.datum=t,n.exit=!1}),e.visit(e.MOD,t=>{const e=a(t),n=o.get(e);n&&(n.datum=t,r.mod.push(n))}),e.visit(e.REM,t=>{const e=a(t),n=o.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++o.empty)}),e.changed(e.ADD_MOD)&&r.modifies("datum"),(e.clean()||t.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),r},st(gy,Xa).transform=function(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,a=e.encode;if(_(a)){if(!n.changed()&&!a.every((function(t){return i[t]})))return e.StopPropagation;a=a[0],n.encode=null}var o="enter"===a,u=i.update||m,s=i.enter||m,l=i.exit||m,c=(a&&!o?i[a]:u)||m;if(e.changed(e.ADD)&&(e.visit(e.ADD,(function(e){s(e,t),u(e,t)})),n.modifies(s.output),n.modifies(u.output),c!==m&&c!==u&&(e.visit(e.ADD,(function(e){c(e,t)})),n.modifies(c.output))),e.changed(e.REM)&&l!==m&&(e.visit(e.REM,(function(e){l(e,t)})),n.modifies(l.output)),o||c!==m){var f=e.MOD|(t.modified()?e.REFLOW:0);o?(e.visit(f,(function(e){var i=s(e,t)||r;(c(e,t)||i)&&n.mod.push(e)})),n.mod.length&&n.modifies(s.output)):e.visit(f,(function(e){(c(e,t)||r)&&n.mod.push(e)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:e.StopPropagation},st(my,Xa).transform=function(t,e){if(null!=this.value&&!t.modified())return e.StopPropagation;var n,r,i,a,o,u=e.dataflow.locale(),s=e.fork(e.NO_SOURCE|e.NO_FIELDS),l=this.value,c=t.type||"symbol",f=t.scale,h=+t.limit,d=Fm(f,null==t.count?5:t.count,t.minstep),p=!!t.values||"symbol"===c,g=t.format||qm(u,f,d,c,t.formatSpecifier,t.formatType,p),m=t.values||Rm(f,d);return l&&(s.rem=l),"symbol"===c?(h&&m.length>h?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=m.slice(0,h-1),o=!0):l=m,Y(i=t.size)?(t.values||0!==f(l[0])||(l=l.slice(1)),a=l.reduce((function(e,n){return Math.max(e,i(n,t))}),0)):i=Q(a=i||8),l=l.map((function(e,n){return qt({index:n,label:g(e,n,l),value:e,offset:a,size:i(e,t)})})),o&&(o=m[l.length],l.push(qt({index:l.length,label:`…${m.length-l.length} entries`,value:o,offset:a,size:i(o,t)})))):"gradient"===c?(n=f.domain(),r=xm(f,n[0],M(n)),m.length<3&&!t.values&&n[0]!==M(n)&&(m=[n[0],M(n)]),l=m.map((function(t,e){return qt({index:e,label:g(t,e,m),value:t,perc:r(t)})}))):(i=m.length-1,r=function(t){var e=t.domain(),n=e.length-1,r=+e[0],i=+M(e),a=i-r;if("threshold"===t.type){const t=n?a/n:.1;a=(i+=t)-(r-=t)}return t=>(t-r)/a}(f),l=m.map((function(t,e){return qt({index:e,label:g(t,e,m),value:t,perc:e?r(t):0,perc2:e===i?1:r(m[e+1])})}))),s.source=l,s.add=l,this.value=l,s};var vy=ot({line:ky,"line-radial":function(t,e,n,r){return ky(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},arc:Ay,"arc-radial":function(t,e,n,r){return Ay(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},curve:My,"curve-radial":function(t,e,n,r){return My(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},"orthogonal-horizontal":function(t,e,n,r){return"M"+t+","+e+"V"+r+"H"+n},"orthogonal-vertical":function(t,e,n,r){return"M"+t+","+e+"H"+n+"V"+r},"orthogonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),o=Math.cos(n),u=Math.sin(n),s=Math.abs(n-t)>Math.PI?n<=t:n>t;return"M"+e*i+","+e*a+"A"+e+","+e+" 0 0,"+(s?1:0)+" "+e*o+","+e*u+"L"+r*o+","+r*u},"diagonal-horizontal":function(t,e,n,r){var i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":function(t,e,n,r){var i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),o=Math.cos(n),u=Math.sin(n),s=(e+r)/2;return"M"+e*i+","+e*a+"C"+s*i+","+s*a+" "+s*o+","+s*u+" "+r*o+","+r*u}});function yy(t){return t.source.x}function _y(t){return t.source.y}function xy(t){return t.target.x}function by(t){return t.target.y}function wy(t){Xa.call(this,{},t)}function ky(t,e,n,r){return"M"+t+","+e+"L"+n+","+r}function Ay(t,e,n,r){var i=n-t,a=r-e,o=Math.sqrt(i*i+a*a)/2;return"M"+t+","+e+"A"+o+","+o+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+n+","+r}function My(t,e,n,r){var i=n-t,a=r-e,o=.2*(i+a),u=.2*(a-i);return"M"+t+","+e+"C"+(t+o)+","+(e+u)+" "+(n+u)+","+(r-o)+" "+n+","+r}function Ey(t){Xa.call(this,null,t)}wy.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},st(wy,Xa).transform=function(t,e){var n=t.sourceX||yy,r=t.sourceY||_y,i=t.targetX||xy,a=t.targetY||by,o=t.as||"path",s=t.orient||"vertical",l=t.shape||"line",c=vy.get(l+"-"+s)||vy.get(l);return c||u("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,(function(t){t[o]=c(n(t),r(t),i(t),a(t))})),e.reflow(t.modified()).modifies(o)},Ey.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},st(Ey,Xa).transform=function(t,e){var n,r,i,a=t.as||["startAngle","endAngle"],o=a[0],u=a[1],s=t.field||p,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,h=f.map(s),d=h.length,g=l,m=(c-l)/on(h),v=Ye(d);for(t.sort&&v.sort((function(t,e){return h[t]-h[e]})),n=0;n0?1:0)}),0))!==e.length&&n.warn("Log scale domain includes zero: "+wt(e)));return e}function By(t,e,n){return Y(t)&&(e||n)?vm(t,Ty(e||[0,1],n)):t}function Ty(t,e){return e?t.slice().reverse():t}function zy(t){Xa.call(this,null,t)}st(Fy,Xa).transform=function(t,e){var n=e.dataflow,r=this.value,i=function(t){var e,n=t.type,r="";if("sequential"===n)return"sequential-linear";(function(t){const e=t.type;return cm(e)&&e!==_d&&e!==xd&&(t.scheme||t.range&&t.range.length&&t.range.every(pt))})(t)&&(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0,r=2===e?"sequential-":3===e?"diverging-":"");return(r+n||"linear").toLowerCase()}(t);for(i in r&&i===r.type||(this.value=r=um(i)()),t)if(!Cy[i]){if("padding"===i&&Dy(r.type))continue;Y(r[i])?r[i](t[i]):n.warn("Unsupported scale property: "+i)}return function(t,e,n){var r=t.type,i=e.round||!1,a=e.range;if(null!=e.rangeStep)a=function(t,e,n){"band"!==t&&"point"!==t&&u("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i="point"===t?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*vd(n,i,r)]}(r,e,n);else if(e.scheme&&(a=function(t,e,n){var r,i,a=e.schemeExtent;_(e.scheme)?i=ym(e.scheme,e.interpolate,e.interpolateGamma):(r=e.scheme.toLowerCase(),(i=Mm(r))||u("Unrecognized scheme name: "+e.scheme));return n="threshold"===t?n+1:"bin-ordinal"===t?n-1:"quantile"===t||"quantize"===t?+e.schemeCount||5:n,pm(t)?By(i,a,e.reverse):Y(i)?_m(By(i,a),n):"ordinal"===t?i:i.slice(0,n)}(r,e,n),Y(a))){if(t.interpolator)return t.interpolator(a);u(`Scale type ${r} does not support interpolating color schemes.`)}if(a&&pm(r))return t.interpolator(ym(Ty(a,e.reverse),e.interpolate,e.interpolateGamma));a&&e.interpolate&&t.interpolate?t.interpolate(bm(e.interpolate,e.interpolateGamma)):Y(t.round)?t.round(i):Y(t.rangeRound)&&t.interpolate(i?Xp:Gp);a&&t.range(Ty(a,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!_(r)){let e=t.domain(),n=e[0],i=M(e),a=null==r.start?n:r.start,o=null==r.stop?i:r.stop,s=r.step;s||u("Scale bins parameter missing step property."),ai&&(o=s*Math.floor(i/s)),r=Ye(a,o+s/2,s)}r?t.bins=r:t.bins&&delete t.bins;"bin-ordinal"===t.type&&(r?e.domain||e.domainRaw||(t.domain(r),n=r.length):t.bins=t.domain());return n}(r,t,function(t,e,n){var r=function(t,e,n){return e?(t.domain(Sy(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,a,o=e.domain,u=t.type,s=e.zero||void 0===e.zero&&function(t){const e=t.type;return!t.bins&&("linear"===e||"pow"===e||"sqrt"===e)}(t);if(!o)return 0;Dy(u)&&e.padding&&o[0]!==M(o)&&(o=function(t,e,n,r,i,a){var o=Math.abs(M(n)-n[0]),u=o/(o-2*r),s=t===yd?L(e,null,u):"sqrt"===t?$(e,null,u,.5):"pow"===t?$(e,null,u,i||1):"symlog"===t?P(e,null,u,a||1):U(e,null,u);return(e=e.slice())[0]=s[0],e[e.length-1]=s[1],e}(u,o,e.range,e.padding,e.exponent,e.constant));if((s||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(o=o.slice()).length-1||1,s&&(o[0]>0&&(o[0]=0),o[i]<0&&(o[i]=0)),null!=e.domainMin&&(o[0]=e.domainMin),null!=e.domainMax&&(o[i]=e.domainMax),null!=e.domainMid)){const t=(a=e.domainMid)>o[i]?i+1:ah&&(h=f),n&&c.sort(n)}return d.max=h,d}(e.source,t.groupby,l,c),r=0,i=n.length,a=n.max;ri(t,e))}function i(r,i){var o=[],u=[];return function(n,r,i){var o,u,s,l,c,f,h=new Array,d=new Array;o=u=-1,l=n[0]>=r,Py[l<<1].forEach(p);for(;++o=r,Py[s|l<<1].forEach(p);Py[l<<0].forEach(p);for(;++u=r,c=n[u*t]>=r,Py[l<<1|c<<2].forEach(p);++o=r,f=c,c=n[u*t+o+1]>=r,Py[s|l<<1|c<<2|f<<3].forEach(p);Py[l|c<<3].forEach(p)}o=-1,c=n[u*t]>=r,Py[c<<2].forEach(p);for(;++o=r,Py[c<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+o,t[0][1]+u],s=[t[1][0]+o,t[1][1]+u],l=a(r),c=a(s);(e=d[l])?(n=h[c])?(delete d[e.end],delete h[n.start],e===n?(e.ring.push(s),i(e.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(s),d[e.end=c]=e):(e=h[c])?(n=d[l])?(delete h[e.start],delete d[n.end],e===n?(e.ring.push(s),i(e.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[e.start],e.ring.unshift(r),h[e.start=l]=e):h[l]=d[c]={start:l,end:c,ring:[r,s]}}Py[c<<3].forEach(p)}(r,i,(function(t){n(t,r,i),function(t){var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];for(;++e0?o.push([t]):u.push(t)})),u.forEach((function(t){for(var e,n=0,r=o.length;n0&&o0&&u=0&&a>=0||u("invalid size"),t=i,e=a,r},r.smooth=function(t){return arguments.length?(n=t?o:$y,r):n===o},r}function Iy(t,e){for(var n,r=-1,i=e.length;++rr!=d>r&&n<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function Hy(t,e,n){var r,i,a,o;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],a=n[r],o=e[r],i<=a&&a<=o||o<=a&&a<=i)}function Yy(t,e,n){return function(r){var i=et(r),a=n?Math.min(i[0],0):i[0],o=i[1],u=o-a,s=e?Qe(a,o,t):u/(t+1);return Ye(s,o,s)}}function Vy(t){Xa.call(this,null,t)}function Gy(t,e,n,r,i){const a=t.x1||0,o=t.y1||0,u=e*n<0;function s(t){t.forEach(l)}function l(t){u&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-a)*e+r,t[1]=(t[1]-o)*n+i}return function(t){return t.coordinates.forEach(s),t}}function Xy(t,e,n){const r=t>=0?t:vo(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function Jy(t){return Y(t)?t:Q(+t)}function Zy(){var t=t=>t[0],e=t=>t[1],n=p,r=[-1,-1],i=960,a=500,o=2;function s(u,s){const l=Xy(r[0],u,t)>>o,c=Xy(r[1],u,e)>>o,f=l?l+2:0,h=c?c+2:0,d=2*f+(i>>o),p=2*h+(a>>o),g=new Float32Array(d*p),m=new Float32Array(d*p);let v=g;u.forEach(r=>{const i=f+(+t(r)>>o),a=h+(+e(r)>>o);i>=0&&i=0&&a0&&c>0?(Qy(d,p,g,m,l),Ky(d,p,m,g,c),Qy(d,p,g,m,l),Ky(d,p,m,g,c),Qy(d,p,g,m,l),Ky(d,p,m,g,c)):l>0?(Qy(d,p,g,m,l),Qy(d,p,m,g,l),Qy(d,p,g,m,l),v=m):c>0&&(Ky(d,p,g,m,c),Ky(d,p,m,g,c),Ky(d,p,g,m,c),v=m);let y=s?Math.pow(2,-2*o):1/on(v);for(let t=0,e=d*p;t>o),y2:h+(a>>o)}}return s.x=function(e){return arguments.length?(t=Jy(e),s):t},s.y=function(t){return arguments.length?(e=Jy(t),s):e},s.weight=function(t){return arguments.length?(n=Jy(t),s):n},s.size=function(t){if(!arguments.length)return[i,a];var e=+t[0],n=+t[1];return e>=0&&n>=0||u("invalid size"),i=e,a=n,s},s.cellSize=function(t){return arguments.length?((t=+t)>=1||u("invalid cell size"),o=Math.floor(Math.log(t)/Math.LN2),s):1<=i&&(e>=a&&(u-=n[e-a+o*t]),r[e-i+o*t]=u/Math.min(e+1,t-1+a-e,a))}function Ky(t,e,n,r,i){const a=1+(i<<1);for(let o=0;o=i&&(u>=a&&(s-=n[o+(u-a)*t]),r[o+(u-i)*t]=s/Math.min(u+1,e-1+a-u,a))}function t_(t){Xa.call(this,null,t)}Vy.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},st(Vy,Xa).transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=e.materialize(e.SOURCE).source,i=t.field||h,a=jy().smooth(!1!==t.smooth),o=t.thresholds||function(t,e,n){const r=Yy(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map(t=>Ke(e(t).values)))}(r,i,t),u=null===t.as?null:t.as||"contour",s=[];return r.forEach(e=>{const n=i(e),r=a.size([n.width,n.height])(n.values,_(o)?o:o(n.values));!function(t,e,n,r){let i=r.scale||e.scale,a=r.translate||e.translate;Y(i)&&(i=i(n,r));Y(a)&&(a=a(n,r));if((1===i||null==i)&&!a)return;const o=(ht(i)?i:i[0])||1,u=(ht(i)?i:i[1])||1,s=a&&a[0]||0,l=a&&a[1]||0;t.forEach(Gy(e,o,u,s,l))}(r,n,e,t),r.forEach(t=>{s.push(Lt(e,qt(null!=u?{[u]:t}:t)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=s,n},t_.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};var e_=st(t_,Xa);const n_=["x","y","weight","size","cellSize","bandwidth"];function r_(t,e){return n_.forEach(n=>null!=e[n]?t[n](e[n]):0),t}function i_(t){Xa.call(this,null,t)}e_.transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var r,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),a=function(t,e){var n,r,i,a,o,u,s=[],l=t=>t(a);if(null==e)s.push(t);else for(n={},r=0,i=t.length;rqt(function(t,e){for(let n=0;n0?1:t<0?-1:0},E_=Math.sqrt,D_=Math.tan;function C_(t){return t>1?0:t<-1?c_:Math.acos(t)}function F_(t){return t>1?f_:t<-1?-f_:Math.asin(t)}function S_(){}function B_(t,e){t&&z_.hasOwnProperty(t.type)&&z_[t.type](t,e)}var T_={Feature:function(t,e){B_(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,a=__(e=(e*=g_)/2+h_),o=A_(e),u=P_*o,s=$_*a+u*__(i),l=u*r*A_(i);j_.add(y_(l,s)),L_=t,$_=a,P_=o}function X_(t){return[y_(t[1],t[0]),F_(t[2])]}function J_(t){var e=t[0],n=t[1],r=__(n);return[r*__(e),r*A_(e),A_(n)]}function Z_(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Q_(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function K_(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function tx(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function ex(t){var e=E_(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var nx,rx,ix,ax,ox,ux,sx,lx,cx,fx,hx,dx,px,gx,mx,vx,yx,_x,xx,bx,wx,kx,Ax,Mx,Ex,Dx,Cx=o_(),Fx={point:Sx,lineStart:Tx,lineEnd:zx,polygonStart:function(){Fx.point=Nx,Fx.lineStart=Ox,Fx.lineEnd=Rx,Cx.reset(),W_.polygonStart()},polygonEnd:function(){W_.polygonEnd(),Fx.point=Sx,Fx.lineStart=Tx,Fx.lineEnd=zx,j_<0?(nx=-(ix=180),rx=-(ax=90)):Cx>1e-6?ax=90:Cx<-1e-6&&(rx=-90),fx[0]=nx,fx[1]=ix},sphere:function(){nx=-(ix=180),rx=-(ax=90)}};function Sx(t,e){cx.push(fx=[nx=t,ix=t]),eax&&(ax=e)}function Bx(t,e){var n=J_([t*g_,e*g_]);if(lx){var r=Q_(lx,n),i=Q_([r[1],-r[0],0],r);ex(i),i=X_(i);var a,o=t-ox,u=o>0?1:-1,s=i[0]*p_*u,l=m_(o)>180;l^(u*oxax&&(ax=a):l^(u*ox<(s=(s+360)%360-180)&&sax&&(ax=e)),l?tqx(nx,ix)&&(ix=t):qx(t,ix)>qx(nx,ix)&&(nx=t):ix>=nx?(tix&&(ix=t)):t>ox?qx(nx,t)>qx(nx,ix)&&(ix=t):qx(t,ix)>qx(nx,ix)&&(nx=t)}else cx.push(fx=[nx=t,ix=t]);eax&&(ax=e),lx=n,ox=t}function Tx(){Fx.point=Bx}function zx(){fx[0]=nx,fx[1]=ix,Fx.point=Sx,lx=null}function Nx(t,e){if(lx){var n=t-ox;Cx.add(m_(n)>180?n+(n>0?360:-360):n)}else ux=t,sx=e;W_.point(t,e),Bx(t,e)}function Ox(){W_.lineStart()}function Rx(){Nx(ux,sx),W_.lineEnd(),m_(Cx)>1e-6&&(nx=-(ix=180)),fx[0]=nx,fx[1]=ix,lx=null}function qx(t,e){return(e-=t)<0?e+360:e}function Ux(t,e){return t[0]-e[0]}function Lx(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ec_?t+Math.round(-t/d_)*d_:t,e]}function Kx(t,e,n){return(t%=d_)?e||n?Zx(eb(t),nb(e,n)):eb(t):e||n?nb(e,n):Qx}function tb(t){return function(e,n){return[(e+=t)>c_?e-d_:e<-c_?e+d_:e,n]}}function eb(t){var e=tb(t);return e.invert=tb(-t),e}function nb(t,e){var n=__(t),r=A_(t),i=__(e),a=A_(e);function o(t,e){var o=__(e),u=__(t)*o,s=A_(t)*o,l=A_(e),c=l*n+u*r;return[y_(s*i-c*a,u*n-l*r),F_(c*i+s*a)]}return o.invert=function(t,e){var o=__(e),u=__(t)*o,s=A_(t)*o,l=A_(e),c=l*i-s*a;return[y_(s*i+l*a,u*n+c*r),F_(c*n-u*r)]},o}function rb(t,e){(e=J_(e))[0]-=t,ex(e);var n=C_(-e[1]);return((-e[2]<0?-n:n)+d_-1e-6)%d_}function ib(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:S_,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function ab(t,e){return m_(t[0]-e[0])<1e-6&&m_(t[1]-e[1])<1e-6}function ob(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function ub(t,e,n,r,i){var a,o,u=[],s=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],o=t[e];if(ab(r,o)){if(!r[2]&&!o[2]){for(i.lineStart(),a=0;a=0;--a)i.point((c=l[a])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function sb(t){if(e=t.length){for(var e,n,r=0,i=t[0];++re?1:t>=e?0:NaN}!function(t){var e;1===t.length&&(e=t,t=function(t,n){return fb(e(t),n)})}(fb);function hb(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r=0;)for(e=(r=t[i]).length;--e>=0;)n[--o]=r[e];return n}function pb(t,e,n,r){return function(i){var a,o,u,s=e(i),l=ib(),c=e(l),f=!1,h={point:d,lineStart:g,lineEnd:m,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=_,o=[],a=[]},polygonEnd:function(){h.point=d,h.lineStart=g,h.lineEnd=m,o=db(o);var t=function(t,e){var n=cb(e),r=e[1],i=A_(r),a=[A_(n),-__(n),0],o=0,u=0;lb.reset(),1===i?r=f_+1e-6:-1===i&&(r=-f_-1e-6);for(var s=0,l=t.length;s=0?1:-1,M=A*k,E=M>c_,D=g*b;if(lb.add(y_(D*A*A_(M),m*w+D*__(M))),o+=E?k+A*d_:k,E^d>=n^_>=n){var C=Q_(J_(h),J_(y));ex(C);var F=Q_(a,C);ex(F);var S=(E^k>=0?-1:1)*F_(F[2]);(r>S||r===S&&(C[0]||C[1]))&&(u+=E^k>=0?1:-1)}}return(o<-1e-6||o<1e-6&&lb<-1e-6)^1&u}(a,r);o.length?(f||(i.polygonStart(),f=!0),ub(o,mb,t,n,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),o=a=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){s.point(t,e)}function g(){h.point=p,s.lineStart()}function m(){h.point=d,s.lineEnd()}function v(t,e){u.push([t,e]),c.point(t,e)}function y(){c.lineStart(),u=[]}function _(){v(u[0][0],u[0][1]),c.lineEnd();var t,e,n,r,s=c.clean(),h=l.result(),d=h.length;if(u.pop(),a.push(u),u=null,d)if(1&s){if((e=(n=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t1&&2&s&&h.push(h.pop().concat(h.shift())),o.push(h.filter(gb))}return h}}function gb(t){return t.length>1}function mb(t,e){return((t=t.x)[0]<0?t[1]-f_-1e-6:f_-t[1])-((e=e.x)[0]<0?e[1]-f_-1e-6:f_-e[1])}var vb=pb((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var u=a>0?c_:-c_,s=m_(a-n);m_(s-c_)<1e-6?(t.point(n,r=(r+o)/2>0?f_:-f_),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(a,r),e=0):i!==u&&s>=c_&&(m_(n-i)<1e-6&&(n-=1e-6*i),m_(a-u)<1e-6&&(a-=1e-6*u),r=function(t,e,n,r){var i,a,o=A_(t-n);return m_(o)>1e-6?v_((A_(e)*(a=__(r))*A_(n)-A_(r)*(i=__(e))*A_(t))/(i*a*o)):(e+r)/2}(n,r,a,o),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),e=0),t.point(n=a,r=o),i=u},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*f_,r.point(-c_,i),r.point(0,i),r.point(c_,i),r.point(c_,0),r.point(c_,-i),r.point(0,-i),r.point(-c_,-i),r.point(-c_,0),r.point(-c_,i);else if(m_(t[0]-e[0])>1e-6){var a=t[0]0,i=m_(e)>1e-6;function a(t,n){return __(t)*__(n)>e}function o(t,n,r){var i=[1,0,0],a=Q_(J_(t),J_(n)),o=Z_(a,a),u=a[0],s=o-u*u;if(!s)return!r&&t;var l=e*o/s,c=-e*u/s,f=Q_(i,a),h=tx(i,l);K_(h,tx(a,c));var d=f,p=Z_(h,d),g=Z_(d,d),m=p*p-g*(Z_(h,h)-1);if(!(m<0)){var v=E_(m),y=tx(d,(-p-v)/g);if(K_(y,h),y=X_(y),!r)return y;var _,x=t[0],b=n[0],w=t[1],k=n[1];b0^y[1]<(m_(y[0]-x)<1e-6?w:k):w<=y[1]&&y[1]<=k:A>c_^(x<=y[0]&&y[0]<=b)){var E=tx(d,(-p+v)/g);return K_(E,h),[y,X_(E)]}}}function u(e,n){var i=r?t:c_-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return pb(a,(function(t){var e,n,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var d,p=[f,h],g=a(f,h),m=r?g?0:u(f,h):g?u(f+(f<0?c_:-c_),h):0;if(!e&&(l=s=g)&&t.lineStart(),g!==s&&(!(d=o(e,p))||ab(e,d)||ab(p,d))&&(p[2]=1),g!==s)c=0,g?(t.lineStart(),d=o(p,e),t.point(d[0],d[1])):(d=o(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^g){var v;m&n||!(v=o(p,e,!0))||(c=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!g||e&&ab(e,p)||t.point(p[0],p[1]),e=p,s=g,n=m},lineEnd:function(){s&&t.lineEnd(),e=null},clean:function(){return c|(l&&s)<<1}}}),(function(e,r,i,a){!function(t,e,n,r,i,a){if(n){var o=__(e),u=A_(e),s=r*n;null==i?(i=e+r*d_,a=e-s/2):(i=rb(o,i),a=rb(o,a),(r>0?ia)&&(i+=r*d_));for(var l,c=i;r>0?c>a:c0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+u+4)%4)!==f);else l.point(a[0],a[1])}function o(r,i){return m_(r[0]-t)<1e-6?i>0?0:3:m_(r[0]-n)<1e-6?i>0?2:1:m_(r[1]-e)<1e-6?i>0?1:0:i>0?3:2}function u(t,e){return s(t.x,e.x)}function s(t,e){var n=o(t,1),r=o(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(o){var s,l,c,f,h,d,p,g,m,v,y,_=o,x=ib(),b={point:w,lineStart:function(){b.point=k,l&&l.push(c=[]);v=!0,m=!1,p=g=NaN},lineEnd:function(){s&&(k(f,h),d&&m&&x.rejoin(),s.push(x.result()));b.point=w,m&&_.lineEnd()},polygonStart:function(){_=x,s=[],l=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;nr&&(h-a)*(r-o)>(d-o)*(t-a)&&++e:d<=r&&(h-a)*(r-o)<(d-o)*(t-a)&&--e;return e}(),n=y&&e,i=(s=db(s)).length;(n||i)&&(o.polygonStart(),n&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),i&&ub(s,u,e,a,o),o.polygonEnd());_=o,s=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function k(a,o){var u=i(a,o);if(l&&c.push([a,o]),v)f=a,h=o,d=u,v=!1,u&&(_.lineStart(),_.point(a,o));else if(u&&m)_.point(a,o);else{var s=[p=Math.max(-1e9,Math.min(1e9,p)),g=Math.max(-1e9,Math.min(1e9,g))],x=[a=Math.max(-1e9,Math.min(1e9,a)),o=Math.max(-1e9,Math.min(1e9,o))];!function(t,e,n,r,i,a){var o,u=t[0],s=t[1],l=0,c=1,f=e[0]-u,h=e[1]-s;if(o=n-u,f||!(o>0)){if(o/=f,f<0){if(o0){if(o>c)return;o>l&&(l=o)}if(o=i-u,f||!(o<0)){if(o/=f,f<0){if(o>c)return;o>l&&(l=o)}else if(f>0){if(o0)){if(o/=h,h<0){if(o0){if(o>c)return;o>l&&(l=o)}if(o=a-s,h||!(o<0)){if(o/=h,h<0){if(o>c)return;o>l&&(l=o)}else if(h>0){if(o0&&(t[0]=u+l*f,t[1]=s+l*h),c<1&&(e[0]=u+c*f,e[1]=s+c*h),!0}}}}}(s,x,t,e,n,r)?u&&(_.lineStart(),_.point(a,o),y=!1):(m||(_.lineStart(),_.point(s[0],s[1])),_.point(x[0],x[1]),u||_.lineEnd(),y=!1)}p=a,g=o,m=u}return b}}function xb(t,e,n){var r=hb(t,e-1e-6,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function bb(t,e,n){var r=hb(t,e-1e-6,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}function wb(t){return t}var kb,Ab,Mb,Eb,Db=o_(),Cb=o_(),Fb={point:S_,lineStart:S_,lineEnd:S_,polygonStart:function(){Fb.lineStart=Sb,Fb.lineEnd=zb},polygonEnd:function(){Fb.lineStart=Fb.lineEnd=Fb.point=S_,Db.add(m_(Cb)),Cb.reset()},result:function(){var t=Db/2;return Db.reset(),t}};function Sb(){Fb.point=Bb}function Bb(t,e){Fb.point=Tb,kb=Mb=t,Ab=Eb=e}function Tb(t,e){Cb.add(Eb*t-Mb*e),Mb=t,Eb=e}function zb(){Tb(kb,Ab)}var Nb=1/0,Ob=Nb,Rb=-Nb,qb=Rb,Ub={point:function(t,e){tRb&&(Rb=t);eqb&&(qb=e)},lineStart:S_,lineEnd:S_,polygonStart:S_,polygonEnd:S_,result:function(){var t=[[Nb,Ob],[Rb,qb]];return Rb=qb=-(Ob=Nb=1/0),t}};var Lb,$b,Pb,jb,Ib=0,Wb=0,Hb=0,Yb=0,Vb=0,Gb=0,Xb=0,Jb=0,Zb=0,Qb={point:Kb,lineStart:tw,lineEnd:rw,polygonStart:function(){Qb.lineStart=iw,Qb.lineEnd=aw},polygonEnd:function(){Qb.point=Kb,Qb.lineStart=tw,Qb.lineEnd=rw},result:function(){var t=Zb?[Xb/Zb,Jb/Zb]:Gb?[Yb/Gb,Vb/Gb]:Hb?[Ib/Hb,Wb/Hb]:[NaN,NaN];return Ib=Wb=Hb=Yb=Vb=Gb=Xb=Jb=Zb=0,t}};function Kb(t,e){Ib+=t,Wb+=e,++Hb}function tw(){Qb.point=ew}function ew(t,e){Qb.point=nw,Kb(Pb=t,jb=e)}function nw(t,e){var n=t-Pb,r=e-jb,i=E_(n*n+r*r);Yb+=i*(Pb+t)/2,Vb+=i*(jb+e)/2,Gb+=i,Kb(Pb=t,jb=e)}function rw(){Qb.point=Kb}function iw(){Qb.point=ow}function aw(){uw(Lb,$b)}function ow(t,e){Qb.point=uw,Kb(Lb=Pb=t,$b=jb=e)}function uw(t,e){var n=t-Pb,r=e-jb,i=E_(n*n+r*r);Yb+=i*(Pb+t)/2,Vb+=i*(jb+e)/2,Gb+=i,Xb+=(i=jb*t-Pb*e)*(Pb+t),Jb+=i*(jb+e),Zb+=3*i,Kb(Pb=t,jb=e)}function sw(t){this._context=t}sw.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,d_)}},result:S_};var lw,cw,fw,hw,dw,pw=o_(),gw={point:S_,lineStart:function(){gw.point=mw},lineEnd:function(){lw&&vw(cw,fw),gw.point=S_},polygonStart:function(){lw=!0},polygonEnd:function(){lw=null},result:function(){var t=+pw;return pw.reset(),t}};function mw(t,e){gw.point=vw,cw=hw=t,fw=dw=e}function vw(t,e){hw-=t,dw-=e,pw.add(E_(hw*hw+dw*dw)),hw=t,dw=e}function yw(){this._string=[]}function _w(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function xw(t,e){var n,r,i=4.5;function a(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),R_(t,n(r))),r.result()}return a.area=function(t){return R_(t,n(Fb)),Fb.result()},a.measure=function(t){return R_(t,n(gw)),gw.result()},a.bounds=function(t){return R_(t,n(Ub)),Ub.result()},a.centroid=function(t){return R_(t,n(Qb)),Qb.result()},a.projection=function(e){return arguments.length?(n=null==e?(t=null,wb):(t=e).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(e=null,new yw):new sw(e=t),"function"!=typeof i&&r.pointRadius(i),a):e},a.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),a):i},a.projection(t).context(e)}function bw(t){return function(e){var n=new ww;for(var r in t)n[r]=t[r];return n.stream=e,n}}function ww(){}function kw(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),R_(n,t.stream(Ub)),e(Ub.result()),null!=r&&t.clipExtent(r),t}function Aw(t,e,n){return kw(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+e[0][0]+(r-a*(n[1][0]+n[0][0]))/2,u=+e[0][1]+(i-a*(n[1][1]+n[0][1]))/2;t.scale(150*a).translate([o,u])}),n)}function Mw(t,e,n){return Aw(t,[[0,0],e],n)}function Ew(t,e,n){return kw(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];t.scale(150*i).translate([a,o])}),n)}function Dw(t,e,n){return kw(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([a,o])}),n)}yw.prototype={_radius:4.5,_circle:_w(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=_w(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},ww.prototype={constructor:ww,point:function(t,e){this.stream.point(t,e)},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()}};var Cw=__(30*g_);function Fw(t,e){return+e?function(t,e){function n(r,i,a,o,u,s,l,c,f,h,d,p,g,m){var v=l-r,y=c-i,_=v*v+y*y;if(_>4*e&&g--){var x=o+h,b=u+d,w=s+p,k=E_(x*x+b*b+w*w),A=F_(w/=k),M=m_(m_(w)-1)<1e-6||m_(a-f)<1e-6?(a+f)/2:y_(b,x),E=t(M,A),D=E[0],C=E[1],F=D-r,S=C-i,B=y*F-v*S;(B*B/_>e||m_((v*F+y*S)/_-.5)>.3||o*h+u*d+s*p2?t[2]%360*g_:0,F()):[m*p_,v*p_,y*p_]},D.angle=function(t){return arguments.length?(_=t%360*g_,F()):_*p_},D.reflectX=function(t){return arguments.length?(x=t?-1:1,F()):x<0},D.reflectY=function(t){return arguments.length?(b=t?-1:1,F()):b<0},D.precision=function(t){return arguments.length?(o=Fw(u,E=t*t),S()):E_(E)},D.fitExtent=function(t,e){return Aw(D,t,e)},D.fitSize=function(t,e){return Mw(D,t,e)},D.fitWidth=function(t,e){return Ew(D,t,e)},D.fitHeight=function(t,e){return Dw(D,t,e)},function(){return e=t.apply(this,arguments),D.invert=e.invert&&C,F()}}function Ow(t){var e=0,n=c_/3,r=Nw(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*g_,n=t[1]*g_):[e*p_,n*p_]},i}function Rw(t,e){var n=A_(t),r=(n+A_(e))/2;if(m_(r)<1e-6)return function(t){var e=__(t);function n(t,n){return[t*e,A_(n)/e]}return n.invert=function(t,n){return[t/e,F_(n*e)]},n}(t);var i=1+n*(2*r-n),a=E_(i)/r;function o(t,e){var n=E_(i-2*r*A_(e))/r;return[n*A_(t*=r),a-n*__(t)]}return o.invert=function(t,e){var n=a-e,o=y_(t,m_(n))*M_(n);return n*r<0&&(o-=c_*M_(t)*M_(n)),[o/r,F_((i-(t*t+n*n)*r*r)/(2*r))]},o}function qw(){return Ow(Rw).scale(155.424).center([0,33.6442])}function Uw(){return qw().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Lw(t){return function(e,n){var r=__(e),i=__(n),a=t(r*i);return[a*i*A_(e),a*A_(n)]}}function $w(t){return function(e,n){var r=E_(e*e+n*n),i=t(r),a=A_(i),o=__(i);return[y_(e*a,r*o),F_(r&&n*a/r)]}}var Pw=Lw((function(t){return E_(2/(1+t))}));Pw.invert=$w((function(t){return 2*F_(t/2)}));var jw=Lw((function(t){return(t=C_(t))&&t/A_(t)}));function Iw(t,e){return[t,w_(D_((f_+e)/2))]}function Ww(t){var e,n,r,i=zw(t),a=i.center,o=i.scale,u=i.translate,s=i.clipExtent,l=null;function c(){var a=c_*o(),u=i(function(t){function e(e){return(e=t(e[0]*g_,e[1]*g_))[0]*=p_,e[1]*=p_,e}return t=Kx(t[0]*g_,t[1]*g_,t.length>2?t[2]*g_:0),e.invert=function(e){return(e=t.invert(e[0]*g_,e[1]*g_))[0]*=p_,e[1]*=p_,e},e}(i.rotate()).invert([0,0]));return s(null==l?[[u[0]-a,u[1]-a],[u[0]+a,u[1]+a]]:t===Iw?[[Math.max(u[0]-a,l),e],[Math.min(u[0]+a,n),r]]:[[l,Math.max(u[1]-a,e)],[n,Math.min(u[1]+a,r)]])}return i.scale=function(t){return arguments.length?(o(t),c()):o()},i.translate=function(t){return arguments.length?(u(t),c()):u()},i.center=function(t){return arguments.length?(a(t),c()):a()},i.clipExtent=function(t){return arguments.length?(null==t?l=e=n=r=null:(l=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,e],[n,r]]},c()}function Hw(t){return D_((f_+t)/2)}function Yw(t,e){var n=__(t),r=t===e?A_(t):w_(n/__(e))/w_(Hw(e)/Hw(t)),i=n*k_(Hw(t),r)/r;if(!r)return Iw;function a(t,e){i>0?e<1e-6-f_&&(e=1e-6-f_):e>f_-1e-6&&(e=f_-1e-6);var n=i/k_(Hw(e),r);return[n*A_(r*t),i-n*__(r*t)]}return a.invert=function(t,e){var n=i-e,a=M_(r)*E_(t*t+n*n),o=y_(t,m_(n))*M_(n);return n*r<0&&(o-=c_*M_(t)*M_(n)),[o/r,2*v_(k_(i/a,1/r))-f_]},a}function Vw(t,e){return[t,e]}function Gw(t,e){var n=__(t),r=t===e?A_(t):(n-__(e))/(e-t),i=n/r+t;if(m_(r)<1e-6)return Vw;function a(t,e){var n=i-e,a=r*t;return[n*A_(a),i-n*__(a)]}return a.invert=function(t,e){var n=i-e,a=y_(t,m_(n))*M_(n);return n*r<0&&(a-=c_*M_(t)*M_(n)),[a/r,i-M_(r)*E_(t*t+n*n)]},a}jw.invert=$w((function(t){return t})),Iw.invert=function(t,e){return[t,2*v_(b_(e))-f_]},Vw.invert=Vw;var Xw=1.340264,Jw=-.081106,Zw=893e-6,Qw=.003796,Kw=E_(3)/2;function tk(t,e){var n=F_(Kw*A_(e)),r=n*n,i=r*r*r;return[t*__(n)/(Kw*(Xw+3*Jw*r+i*(7*Zw+9*Qw*r))),n*(Xw+Jw*r+i*(Zw+Qw*r))]}function ek(t,e){var n=__(e),r=__(t)*n;return[n*A_(t)/r,A_(e)/r]}function nk(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function rk(t,e){return[__(e)*A_(t),A_(e)]}function ik(t,e){var n=__(e),r=1+__(t)*n;return[n*A_(t)/r,A_(e)/r]}function ak(t,e){return[w_(D_((f_+e)/2)),-t]}tk.invert=function(t,e){for(var n,r=e,i=r*r,a=i*i*i,o=0;o<12&&(a=(i=(r-=n=(r*(Xw+Jw*i+a*(Zw+Qw*i))-e)/(Xw+3*Jw*i+a*(7*Zw+9*Qw*i)))*r)*i*i,!(m_(n)<1e-12));++o);return[Kw*t*(Xw+3*Jw*i+a*(7*Zw+9*Qw*i))/__(r),F_(A_(r)/Kw)]},ek.invert=$w(v_),nk.invert=function(t,e){var n,r=e,i=25;do{var a=r*r,o=a*a;r-=n=(r*(1.007226+a*(.015085+o*(.028874*a-.044475-.005916*o)))-e)/(1.007226+a*(.045255+o*(.259866*a-.311325-.005916*11*o)))}while(m_(n)>1e-6&&--i>0);return[t/(.8707+(a=r*r)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),r]},rk.invert=$w(F_),ik.invert=$w((function(t){return 2*v_(t)})),ak.invert=function(t,e){return[-e,2*v_(b_(t))-f_]};var ok=Math.abs,uk=Math.cos,sk=Math.sin,lk=Math.PI,ck=lk/2,fk=function(t){return t>0?Math.sqrt(t):0}(2);function hk(t){return t>1?ck:t<-1?-ck:Math.asin(t)}function dk(t,e){var n,r=t*sk(e),i=30;do{e-=n=(e+sk(e)-r)/(1+uk(e))}while(ok(n)>1e-6&&--i>0);return e/2}var pk=function(t,e,n){function r(r,i){return[t*r*uk(i=dk(n,i)),e*sk(i)]}return r.invert=function(r,i){return i=hk(i/e),[r/(t*uk(i)),hk((2*i+sk(2*i))/n)]},r}(fk/ck,fk,lk);var gk=xw(),mk=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function vk(t,e){return function n(){var r=e();return r.type=t,r.path=xw().projection(r),r.copy=r.copy||function(){var t=n();return mk.forEach((function(e){r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},r}}function yk(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(xk[t]=vk(t,e),this):xk[t]||null}function _k(t){return t&&t.path||gk}var xk={albers:Uw,albersusa:function(){var t,e,n,r,i,a,o=Uw(),u=qw().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=qw().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,e){a=[t,e]}};function c(t){var e=t[0],o=t[1];return a=null,n.point(e,o),a||(r.point(e,o),a)||(i.point(e,o),a)}function f(){return t=e=null,c}return c.invert=function(t){var e=o.scale(),n=o.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:o).invert(t)},c.stream=function(n){return t&&e===n?t:(r=[o.stream(e=n),u.stream(n),s.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(var bk in xk)yk(bk,xk[bk]);function wk(t){Xa.call(this,null,t)}function kk(t){Xa.call(this,null,t)}function Ak(t){Xa.call(this,null,t)}function Mk(t){Xa.call(this,[],t),this.generator=function(){var t,e,n,r,i,a,o,u,s,l,c,f,h=10,d=h,p=90,g=360,m=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return hb(x_(r/p)*p,n,p).map(c).concat(hb(x_(u/g)*g,o,g).map(f)).concat(hb(x_(e/h)*h,t,h).filter((function(t){return m_(t%p)>1e-6})).map(s)).concat(hb(x_(a/d)*d,i,d).filter((function(t){return m_(t%g)>1e-6})).map(l))}return v.lines=function(){return y().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(o).slice(1),c(n).reverse().slice(1),f(u).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],u=+t[0][1],o=+t[1][1],r>n&&(t=r,r=n,n=t),u>o&&(t=u,u=o,o=t),v.precision(m)):[[r,u],[n,o]]},v.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],a=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),a>i&&(n=a,a=i,i=n),v.precision(m)):[[e,a],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],v):[p,g]},v.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],v):[h,d]},v.precision=function(h){return arguments.length?(m=+h,s=xb(a,i,90),l=bb(e,t,m),c=xb(u,o,90),f=bb(r,n,m),v):m},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function Ek(t){Xa.call(this,null,t)}function Dk(t){if(!Y(t))return!1;const e=Dt(r(t));return e.$x||e.$y||e.$value||e.$max}function Ck(t){Xa.call(this,null,t),this.modified(!0)}function Fk(t,e,n){Y(t[e])&&t[e](n)}wk.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},st(wk,Xa).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||h,a=t.as||"path",o=n.SOURCE;!r||t.modified()?(this.value=r=_k(t.projection),n.materialize().reflow()):o=i===h||e.modified(i.fields)?n.ADD_MOD:n.ADD;var u=function(t,e){var n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(o,(function(t){t[a]=r(i(t))})),r.pointRadius(u),n.modifies(a)},kk.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},st(kk,Xa).transform=function(t,e){var n,r=t.projection,i=t.fields[0],a=t.fields[1],o=t.as||["x","y"],u=o[0],s=o[1];function l(t){var e=r([i(t),a(t)]);e?(t[u]=e[0],t[s]=e[1]):(t[u]=void 0,t[s]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,l):(n=e.modified(i.fields)||e.modified(a.fields),e.visit(n?e.ADD_MOD:e.ADD,l)),e.modifies(o)},Ak.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},st(Ak,Xa).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.as||"shape",a=n.ADD;return r&&!t.modified()||(this.value=r=function(t,e,n){var r=null==n?function(n){return t(e(n))}:function(r){var i=t.pointRadius(),a=t.pointRadius(n)(e(r));return t.pointRadius(i),a};return r.context=function(e){return t.context(e),r},r}(_k(t.projection),t.field||l("datum"),t.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,(function(t){t[i]=r})),n.modifies(i)},Mk.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},st(Mk,Xa).transform=function(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(var a in t)Y(i[a])&&i[a](t[a]);return n=i(),r.length?e.mod.push($t(r[0],n)):e.add.push(qt(n)),r[0]=n,e},Ek.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},st(Ek,Xa).transform=function(t,e){if(!e.changed()&&!t.modified())return e.StopPropagation;var n=e.materialize(e.SOURCE).source,r="shared"===t.resolve,i=t.field||h,a=function(t,e){let n;Y(t)?(n=n=>t(n,e),n.dep=Dk(t)):t?n=Q(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),o=function(t,e){let n;Y(t)?(n=n=>Yd(t(n,e)),n.dep=Dk(t)):n=Q(Yd(t||"#888"));return n}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?Ke(n.map(t=>Ke(i(t).values))):0};return n.forEach(t=>{const e=i(t),n=tt({},t,s);r||(n.$max=Ke(e.values||[])),t[u]=function(t,e,n,r){const i=t.width,a=t.height,o=t.x1||0,u=t.y1||0,s=t.x2||i,l=t.y2||a,c=t.values,f=c?t=>c[t]:d,h=jc(s-o,l-u),p=h.getContext("2d"),g=p.getImageData(0,0,s-o,l-u),m=g.data;for(let t=u,a=0;tt.concat(function(t){return"FeatureCollection"===t.type?t.features:W(t).filter(t=>null!=t).map(t=>"Feature"===t.type?t:{type:"Feature",geometry:t})}(e)),[])}}(e.fit);e.extent?t.fitExtent(e.extent,n):e.size&&t.fitSize(e.size,n)}(n,t),e.fork(e.NO_SOURCE|e.NO_FIELDS)};var Sk=Object.freeze({__proto__:null,contour:i_,geojson:a_,geopath:wk,geopoint:kk,geoshape:Ak,graticule:Mk,heatmap:Ek,isocontour:Vy,kde2d:t_,projection:Ck});function Bk(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,a,o,u,s,l,c,f,h,d=t._root,p={data:r},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=e>=(a=(g+v)/2))?g=a:v=a,(c=n>=(o=(m+y)/2))?m=o:y=o,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),e===u&&n===s)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=e>=(a=(g+v)/2))?g=a:v=a,(c=n>=(o=(m+y)/2))?m=o:y=o}while((f=c<<1|l)==(h=(s>=o)<<1|u>=a));return i[h]=d,i[f]=p,t}function Tk(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function zk(t){return t[0]}function Nk(t){return t[1]}function Ok(t,e,n){var r=new Rk(null==e?zk:e,null==n?Nk:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Rk(t,e,n,r,i,a){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function qk(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Uk=Ok.prototype=Rk.prototype;function Lk(t){return function(){return t}}function $k(){return 1e-6*(Math.random()-.5)}function Pk(t){return t.x+t.vx}function jk(t){return t.y+t.vy}function Ik(t){return t.index}function Wk(t,e){var n=t.get(e);if(!n)throw new Error("missing: "+e);return n}Uk.copy=function(){var t,e,n=new Rk(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=qk(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=qk(e));return n},Uk.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return Bk(this.cover(e,n),e,n,t)},Uk.addAll=function(t){var e,n,r,i,a=t.length,o=new Array(a),u=new Array(a),s=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=r),if&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),n=0;nt||t>=i||r>e||e>=a;)switch(u=(eh||(a=s.y0)>d||(o=s.x1)=v)<<1|t>=m)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var y=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),x=y*y+_*_;if(x=(u=(p+m)/2))?p=u:m=u,(c=o>=(s=(g+v)/2))?g=s:v=s,e=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},Uk.removeAll=function(t){for(var e=0,n=t.length;e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Xk(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),a=0;a=0&&e._call.call(null,t),e=e._next;--Kk}()}finally{Kk=0,function(){var t,e,n=Zk,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Zk=e);Qk=t,dA(r)}(),rA=0}}function hA(){var t=aA.now(),e=t-nA;e>1e3&&(iA-=e,nA=t)}function dA(t){Kk||(tA&&(tA=clearTimeout(tA)),t-rA>24?(t<1/0&&(tA=setTimeout(fA,t-aA.now()-iA)),eA&&(eA=clearInterval(eA))):(eA||(nA=aA.now(),eA=setInterval(hA,1e3)),Kk=1,oA(fA)))}function pA(t){return t.x}function gA(t){return t.y}lA.prototype=cA.prototype={constructor:lA,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?uA():+n)+(null==e?0:+e),this._next||Qk===this||(Qk?Qk._next=this:Zk=this,Qk=this),this._call=t,this._time=n,dA()},stop:function(){this._call&&(this._call=null,this._time=1/0,dA())}};var mA=Math.PI*(3-Math.sqrt(5));var vA={center:function(t,e){var n;function r(){var r,i,a=n.length,o=0,u=0;for(r=0;rs+d||il+d||au.index){var p=s-o.x-o.vx,g=l-o.y-o.vy,m=p*p+g*g;mt.r&&(t.r=t[e].r)}function u(){if(e){var r,i,a=e.length;for(n=new Array(a),r=0;r=o)){(t.data!==e||t.next)&&(0===c&&(d+=(c=$k())*c),0===f&&(d+=(f=$k())*f),d[o(t,e,r),t]));for(u=0,i=new Array(l);u1?(null==n?u.delete(t):u.set(t,d(n)),e):u.get(t)},find:function(e,n,r){var i,a,o,u,s,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l1?(l.on(t,n),e):l.on(t)}}}(t),r=!1,i=n.stop,a=n.restart;return n.stopped=function(){return r},n.restart=function(){return r=!1,a()},n.stop=function(){return r=!0,i()},kA(n,e,!0).on("end",(function(){r=!0}))}(e.source,t),i.on("tick",(n=e.dataflow,r=this,function(){n.touch(r).run()})),t.static||(a=!0,i.tick()),e.modifies("index")),o||a||t.modified(_A)||e.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return e.StopPropagation;return this.finish(t,e)},wA.finish=function(t,e){for(var n,r=e.dataflow,i=this._argops,a=0,o=i.length;a=0;)e+=n[r].value;else e=1;t.value=e}function zA(t,e){var n,r,i,a,o,u=new qA(t),s=+t.value&&(u.value=t.value),l=[u];for(null==e&&(e=NA);n=l.pop();)if(s&&(n.value=+n.data.value),(i=e(n.data))&&(o=i.length))for(n.children=new Array(o),a=o-1;a>=0;--a)l.push(r=n.children[a]=new qA(i[a])),r.parent=n,r.depth=n.depth+1;return u.eachBefore(RA)}function NA(t){return t.children}function OA(t){t.data=t.data.data}function RA(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function qA(t){this.data=t,this.depth=this.height=0,this.parent=null}qA.prototype=zA.prototype={constructor:qA,count:function(){return this.eachAfter(TA)},each:function(t){var e,n,r,i,a=this,o=[a];do{for(e=o.reverse(),o=[];a=e.pop();)if(t(a),n=a.children)for(r=0,i=n.length;r=0;--n)i.push(e[n]);return this},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return zA(this).eachBefore(OA)}};var UA=Array.prototype.slice;function LA(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}(UA.call(t))).length,a=[];r0&&n*n>r*r+i*i}function IA(t,e){for(var n=0;n(o*=o)?(r=(l+o-i)/(2*l),a=Math.sqrt(Math.max(0,o/l-r*r)),n.x=t.x-r*u-a*s,n.y=t.y-r*s+a*u):(r=(l+i-o)/(2*l),a=Math.sqrt(Math.max(0,i/l-r*r)),n.x=e.x+r*u-a*s,n.y=e.y+r*s+a*u)):(n.x=e.x+n.r,n.y=e.y)}function GA(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function XA(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,a=(e.y*n.r+n.y*e.r)/r;return i*i+a*a}function JA(t){this._=t,this.next=null,this.previous=null}function ZA(t){return null==t?null:QA(t)}function QA(t){if("function"!=typeof t)throw new Error;return t}function KA(){return 0}function tM(t){return function(){return t}}function eM(t){return Math.sqrt(t.value)}function nM(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function rM(t,e){return function(n){if(r=n.children){var r,i,a,o=r.length,u=t(n)*e||0;if(u)for(i=0;i1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;VA(n,e,r=t[2]),e=new JA(e),n=new JA(n),r=new JA(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(u=3;u0)throw new Error("cycle");return a}return n.id=function(e){return arguments.length?(t=QA(e),n):t},n.parentId=function(t){return arguments.length?(e=QA(t),n):e},n}function hM(t,e){return t.parent===e.parent?1:2}function dM(t){var e=t.children;return e?e[0]:t.t}function pM(t){var e=t.children;return e?e[e.length-1]:t.t}function gM(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function mM(t,e,n){return t.a.parent===e.parent?t.a:n}function vM(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function yM(t,e,n,r,i){for(var a,o=t.children,u=-1,s=o.length,l=t.value&&(i-n)/t.value;++uh&&(h=u),m=c*c*g,(d=Math.max(h/m,m/f))>p){c-=u;break}p=d}v.push(o={value:c,dice:s1?e:1)},n}(_M);var wM=function t(e){function n(t,n,r,i,a){if((o=t._squarify)&&o.ratio===e)for(var o,u,s,l,c,f=-1,h=o.length,d=t.value;++f1?e:1)},n}(_M);function kM(t){Xa.call(this,null,t)}function AM(t){return t.values}function MM(){var t,e=[];return t={entries:t=>function t(n,r){if(++r>e.length)return n;var i,a=[];for(i in n)a.push({key:i,values:t(n[i],r)});return a}(function t(n,r){if(r>=e.length)return n;for(var i,a,o,u=-1,s=n.length,l=e[r++],c={},f={};++u(e.push(n),t)}}function EM(t){Xa.call(this,null,t)}function DM(t,e){return t.parent===e.parent?1:2}kM.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},st(kM,Xa).transform=function(t,e){e.source||u("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),i=e.clone(),a=this.value;return(!a||r||e.changed())&&(a&&a.each(t=>{t.children&&Nt(t.data)&&i.rem.push(t.data)}),this.value=a=zA({values:W(t.keys).reduce((t,e)=>(t.key(e),t),MM()).entries(i.source)},AM),n&&a.each(t=>{t.children&&(t=qt(t.data),i.add.push(t),i.source.push(t))}),CA(a,Ot,Ot)),i.source.root=a,i},st(EM,Xa).transform=function(t,e){e.source&&e.source.root||u(this.constructor.name+" transform requires a backing tree data source.");var n=this.layout(t.method),r=this.fields,i=e.source.root,a=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(Pt(t.sort,t=>t.data)),function(t,e,n){for(var r,i=0,a=e.length;i=0;--i)u.push(n=e.children[i]=new vM(r[i],i)),n.parent=e;return(o.parent=new vM(null,0)).children=[o],o}(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(o),r)i.eachBefore(u);else{var l=i,c=i,f=i;i.eachBefore((function(t){t.xc.x&&(c=t),t.depth>f.depth&&(f=t)}));var h=l===c?1:t(l,c)/2,d=h-l.x,p=e/(c.x+h+d),g=n/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function a(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,a=i.length;--a>=0;)(e=i[a]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var a=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-a):e.z=a}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,a=e,o=e,u=n,s=a.parent.children[0],l=a.m,c=o.m,f=u.m,h=s.m;u=pM(u),a=dM(a),u&&a;)s=dM(s),(o=pM(o)).a=e,(i=u.z+f-a.z-l+t(u._,a._))>0&&(gM(mM(u,e,r),e,i),l+=i,c+=i),f+=u.m,l+=a.m,h+=s.m,c+=o.m;u&&!pM(o)&&(o.t=u,o.m+=f-c),a&&!dM(s)&&(s.t=a,s.m+=l-h,r=e)}return r}(e,i,e.parent.A||r[0])}function o(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},cluster:function(){var t=FA,e=1,n=1,r=!1;function i(i){var a,o=0;i.eachAfter((function(e){var n=e.children;n?(e.x=function(t){return t.reduce(SA,0)/t.length}(n),e.y=function(t){return 1+t.reduce(BA,0)}(n)):(e.x=a?o+=t(e,a):0,e.y=0,a=e)}));var u=function(t){for(var e;e=t.children;)t=e[0];return t}(i),s=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),l=u.x-t(u,s)/2,c=s.x+t(s,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-l)/(c-l)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}},RM=["x","y","depth","children"];function qM(t){EM.call(this,t)}qM.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:RM.length,default:RM}]};var UM=st(qM,EM);function LM(t){Xa.call(this,[],t)}UM.layout=function(t){var e=t||"tidy";if(it(OM,e))return OM[e]();u("Unrecognized Tree layout method: "+e)},UM.params=["size","nodeSize"],UM.fields=RM,LM.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},st(LM,Xa).transform=function(t,e){var n=this.value,r=e.source&&e.source.root,i=e.fork(e.NO_SOURCE),a={};return r||u("TreeLinks transform requires a tree data source."),e.changed(e.ADD_REM)?(i.rem=n,e.visit(e.SOURCE,(function(t){a[Ot(t)]=1})),r.each((function(t){var e=t.data,n=t.parent&&t.parent.data;n&&a[Ot(e)]&&a[Ot(n)]&&i.add.push(qt({source:n,target:e}))})),this.value=i.add):e.changed(e.MOD)&&(e.visit(e.MOD,(function(t){a[Ot(t)]=1})),n.forEach((function(t){(a[Ot(t.source)]||a[Ot(t.target)])&&i.mod.push(t)}))),i};var $M={binary:function(t,e,n,r,i){var a,o,u=t.children,s=u.length,l=new Array(s+1);for(l[0]=o=a=0;a=n-1){var c=u[e];return c.x0=i,c.y0=a,c.x1=o,void(c.y1=s)}var f=l[e],h=r/2+f,d=e+1,p=n-1;for(;d>>1;l[g]s-a){var y=(i*v+o*m)/r;t(e,d,m,i,a,y,s),t(d,n,v,y,a,o,s)}else{var _=(a*v+s*m)/r;t(e,d,m,i,a,o,_),t(d,n,v,i,_,o,s)}}(0,s,t.value,e,n,r,i)},dice:oM,slice:yM,slicedice:function(t,e,n,r,i){(1&t.depth?yM:oM)(t,e,n,r,i)},squarify:bM,resquarify:wM},PM=["x0","y0","x1","y1","depth","children"];function jM(t){EM.call(this,t)}jM.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:PM.length,default:PM}]};var IM=st(jM,EM);IM.layout=function(){var t=function(){var t=bM,e=!1,n=1,r=1,i=[0],a=KA,o=KA,u=KA,s=KA,l=KA;function c(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(aM),t}function f(e){var n=i[e.depth],r=e.x0+n,c=e.y0+n,f=e.x1-n,h=e.y1-n;f{Qo(e,t.x,t.y,t.bandwidth||.3).forEach(t=>{const n={};for(let t=0;t{if(n.length<=l)return void e.dataflow.warn("Skipping regression with more parameters than data points.");const r=f(n,t.x,t.y,s);if(t.params)return void h.push(qt({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||et(n,t.x),u=t=>{const e={};for(let t=0;tu([t,r.predict(t)])):nu(r.predict,i,25,200).forEach(u)}),this.value&&(r.rem=this.value),this.value=r.add=r.source=h}return r};var XM=Object.freeze({__proto__:null,loess:YM,regression:GM});const JM=Math.pow(2,-52),ZM=new Uint32Array(512);class QM{static from(t,e=oE,n=uE){const r=t.length,i=new Float64Array(2*r);for(let a=0;a>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=t.length>>1;let o=1/0,u=1/0,s=-1/0,l=-1/0;for(let e=0;es&&(s=n),r>l&&(l=r),this._ids[e]=e}const c=(o+s)/2,f=(u+l)/2;let h,d,p,g=1/0;for(let e=0;e0&&(d=e,g=n)}let y=t[2*d],_=t[2*d+1],x=1/0;for(let e=0;er&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(eE(m,v,y,_,b,w)){const t=d,e=y,n=_;d=p,y=b,_=w,p=t,b=e,w=n}const k=function(t,e,n,r,i,a){const o=n-t,u=r-e,s=i-t,l=a-e,c=o*o+u*u,f=s*s+l*l,h=.5/(o*l-u*s);return{x:t+(l*c-u*f)*h,y:e+(o*f-s*c)*h}}(m,v,y,_,b,w);this._cx=k.x,this._cy=k.y;for(let e=0;e0&&Math.abs(l-a)<=JM&&Math.abs(c-o)<=JM)continue;if(a=l,o=c,s===h||s===d||s===p)continue;let f=0;for(let t=0,e=this._hashKey(l,c);t0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,a=0;for(;;){const o=n[t],u=t-t%3;if(a=u+(t+2)%3,-1===o){if(0===i)break;t=ZM[--i];continue}const s=o-o%3,l=u+(t+1)%3,c=s+(o+2)%3,f=e[a],h=e[t],d=e[l],p=e[c];if(nE(r[2*f],r[2*f+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[o]=f;const r=n[c];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(o,n[a]),this._link(a,c);const u=s+(o+1)%3;i=33306690738754716e-32*Math.abs(o+u)?o-u:0}function eE(t,e,n,r,i,a){return(tE(i,a,t,e,n,r)||tE(t,e,n,r,i,a)||tE(n,r,i,a,t,e))<0}function nE(t,e,n,r,i,a,o,u){const s=t-o,l=e-u,c=n-o,f=r-u,h=i-o,d=a-u,p=c*c+f*f,g=h*h+d*d;return s*(f*g-p*d)-l*(c*g-p*h)+(s*s+l*l)*(c*d-f*h)<0}function rE(t,e,n,r,i,a){const o=n-t,u=r-e,s=i-t,l=a-e,c=o*o+u*u,f=s*s+l*l,h=.5/(o*l-u*s),d=(l*c-u*f)*h,p=(o*f-s*c)*h;return d*d+p*p}function iE(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],a=e[r];let o=i-1;for(;o>=n&&e[t[o]]>a;)t[o+1]=t[o--];t[o+1]=r}else{let i=n+1,a=r;aE(t,n+r>>1,i),e[t[n]]>e[t[r]]&&aE(t,n,r),e[t[i]]>e[t[r]]&&aE(t,i,r),e[t[n]]>e[t[i]]&&aE(t,n,i);const o=t[i],u=e[o];for(;;){do{i++}while(e[t[i]]u);if(a=a-n?(iE(t,e,i,r),iE(t,e,n,a-1)):(iE(t,e,n,a-1),iE(t,e,i,r))}}function aE(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function oE(t){return t[0]}function uE(t){return t[1]}class sE{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class lE{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class cE{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,a=0,o=0,u=n.length;a1;)i-=2;for(let t=2;t4)for(let t=0;t0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)this.xmax?2:0)|(ethis.ymax?8:0)}}const fE=2*Math.PI,hE=Math.pow;function dE(t){return t[0]}function pE(t){return t[1]}function gE(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class mE{static from(t,e=dE,n=pE,r){return new mE("length"in t?function(t,e,n,r){const i=t.length,a=new Float64Array(2*i);for(let o=0;o2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},(t,e)=>e).sort((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]);const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],a[r[0]]=1,2===r.length&&(a[r[1]]=0))}voronoi(t){return new cE(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:o}=this;if(o){const e=o.indexOf(t);return e>0&&(yield o[e-1]),void(e=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:a,halfedges:o,triangles:u,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let l=t,c=hE(e-s[2*t],2)+hE(n-s[2*t+1],2);const f=r[t];let h=f;do{let r=u[h];const f=hE(e-s[2*r],2)+hE(n-s[2*r+1],2);if(f=f));)if(e.x=o+i,e.y=l+a,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>u[0]||e.y+e.y1>u[1])&&(!n||!ME(e,t,u[0]))&&(!n||DE(e,n))){for(var g,m=e.sprite,v=e.width>>5,y=u[0]>>5,_=e.x-(v<<4),x=127&_,b=32-x,w=e.y1-e.y0,k=(e.y+e.y0)*y+(_>>5),A=0;A>>x:0);k+=y}return e.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=2048/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(jc()),f=function(t){var e=[],n=-1;for(;++n>5)*u[1]),d=null,p=l.length,g=-1,m=[],v=l.map((function(u){return{text:t(u),font:e(u),style:r(u),weight:i(u),rotate:a(u),size:~~(n(u)+1e-14),padding:o(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}})).sort((function(t,e){return e.size-t.size}));++g>1,y.y=u[1]*(c()+.5)>>1,AE(s,y,v,g),y.hasText&&h(f,y,d)&&(m.push(y),d?EE(d,y):d=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=u[0]>>1,y.y-=u[1]>>1)}return m},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(u=[+t[0],+t[1]],f):u},f.font=function(t){return arguments.length?(e=FE(t),f):e},f.fontStyle=function(t){return arguments.length?(r=FE(t),f):r},f.fontWeight=function(t){return arguments.length?(i=FE(t),f):i},f.rotate=function(t){return arguments.length?(a=FE(t),f):a},f.text=function(e){return arguments.length?(t=FE(e),f):t},f.spiral=function(t){return arguments.length?(s=SE[t]||t,f):s},f.fontSize=function(t){return arguments.length?(n=FE(t),f):n},f.padding=function(t){return arguments.length?(o=FE(t),f):o},f.random=function(t){return arguments.length?(c=t,f):c},f}function AE(t,e,n,r){if(!e.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,2048/a,2048/a);var o,u,s,l,c,f=0,h=0,d=0,p=n.length;for(--r;++r>5<<5,s=~~Math.max(Math.abs(y+_),Math.abs(y-_))}else o=o+31>>5<<5;if(s>d&&(d=s),f+o>=2048&&(f=0,h+=d,d=0),h+s>=2048)break;i.translate((f+(o>>1))/a,(h+(s>>1))/a),e.rotate&&i.rotate(e.rotate*wE),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=o,e.height=s,e.xoff=f,e.yoff=h,e.x1=o>>1,e.y1=s>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=o}for(var b=i.getImageData(0,0,2048/a,2048/a).data,w=[];--r>=0;)if((e=n[r]).hasText){for(u=(o=e.width)>>5,s=e.y1-e.y0,l=0;l>5),E=b[2048*(h+c)+(f+l)<<2]?1<<31-l%32:0;w[M]|=E,k|=E}k?A=c:(e.y0++,s--,c--,h++)}e.y1=e.y0+A,e.sprite=w.slice(0,(e.y1-e.y0)*u)}}}function ME(t,e,n){n>>=5;for(var r,i=t.sprite,a=t.width>>5,o=t.x-(a<<4),u=127&o,s=32-u,l=t.y1-t.y0,c=(t.y+t.y0)*n+(o>>5),f=0;f>>u:0))&e[c+h])return!0;c+=n}return!1}function EE(t,e){var n=t[0],r=t[1];e.x+e.x0r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function DE(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0>1,v=g[1]>>1,y=0,_=p.length;y<_;++y)(d=(h=p[y]).datum)[s[0]]=h.x+m,d[s[1]]=h.y+v,d[s[2]]=h.font,d[s[3]]=h.size,d[s[4]]=h.style,d[s[5]]=h.weight,d[s[6]]=h.rotate;return n.reflow(r).modifies(s)}};var NE=Object.freeze({__proto__:null,wordcloud:zE});function OE(t){return new Uint8Array(t)}function RE(t){return new Uint16Array(t)}function qE(t){return new Uint32Array(t)}function UE(t,e,n){var r=(e<257?OE:e<65537?RE:qE)(t);return n&&r.set(n),r}function LE(t,e,n){var r=1<i?1:0})),function(t,e){return Array.from(e,e=>t[e])}(t,e)}(f,h),l)o=e,u=t,e=Array(l+c),t=qE(l+c),function(t,e,n,r,i,a,o,u,s){var l,c=0,f=0;for(l=0;c0)for(s=0;s=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length)},add:function(t){for(var n,r=0,i=e.length,a=t.length;rr.length||n>t)&&(t=Math.max(n,t),r=UE(e,t,r),i=UE(e,t))}}}(),t),this._indices=null,this._dims=null}PE.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]};var jE=st(PE,Xa);function IE(t){Xa.call(this,null,t)}jE.transform=function(t,e){return this._dims?t.modified("fields")||t.fields.some((function(t){return e.modified(t.fields)}))?this.reinit(t,e):this.eval(t,e):this.init(t,e)},jE.init=function(t,e){for(var n,r,i=t.fields,a=t.query,o=this._indices={},u=this._dims=[],s=a.length,l=0;lm)for(i=m,a=Math.min(p,v);iv)for(i=Math.max(p,v),a=g;id)for(i=d,a=Math.min(f,p);ip)for(i=Math.max(f,p),a=h;i{e!==t.signal(r.signal)&&t.runAsync(null,(function(){i.source=!0,t.signal(r.signal,e)}))}},r.debounce&&(i.update=K(r.debounce,i.update))),function(t,e,n,r){const i=iD("div",{class:"vega-bind"}),a="radio"===n.input?i:i.appendChild(iD("label"));a.appendChild(iD("span",{class:"vega-bind-name"},n.name||n.signal)),e.appendChild(i);let o=oD;switch(n.input){case"checkbox":o=uD;break;case"select":o=sD;break;case"radio":o=lD;break;case"range":o=cD}o(t,a,n,r)}(i,e,r,t.signal(r.signal)),i.active||(t.on(t._signals[r.signal],null,()=>{i.source?i.source=!1:i.set(t.signal(r.signal))}),i.active=!0),i}function oD(t,e,n,r){const i=iD("input");for(const t in n)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,n[t]);i.setAttribute("name",n.signal),i.value=r,e.appendChild(i),i.addEventListener("input",()=>t.update(i.value)),t.elements=[i],t.set=t=>i.value=t}function uD(t,e,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const a=iD("input",i);e.appendChild(a),a.addEventListener("change",()=>t.update(a.checked)),t.elements=[a],t.set=t=>a.checked=!!t||null}function sD(t,e,n,r){const i=iD("select",{name:n.signal}),a=n.labels||[];n.options.forEach((t,e)=>{const n={value:t};fD(t,r)&&(n.selected=!0),i.appendChild(iD("option",n,(a[e]||t)+""))}),e.appendChild(i),i.addEventListener("change",()=>{t.update(n.options[i.selectedIndex])}),t.elements=[i],t.set=t=>{for(let e=0,r=n.options.length;e{const u={type:"radio",name:n.signal,value:e};fD(e,r)&&(u.checked=!0);const s=iD("input",u);s.addEventListener("change",()=>t.update(e));const l=iD("label",{},(a[o]||e)+"");return l.prepend(s),i.appendChild(l),s}),t.set=e=>{const n=t.elements,r=n.length;for(let t=0;t{s.textContent=u.value,t.update(+u.value)};u.addEventListener("input",l),u.addEventListener("change",l),t.elements=[u],t.set=t=>{u.value=t,s.textContent=t}}function fD(t,e){return t===e||t+""==e+""}function hD(t,e,n,r,i,a){return(e=e||new r(t.loader())).initialize(n,XE(t),JE(t),ZE(t),i,a).background(t.background())}function dD(t,e){return e?function(){try{e.apply(this,arguments)}catch(e){t.error(e)}}:null}function pD(t,e){if("string"==typeof e){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(e=document.querySelector(e)))return t.error("Signal bind element not found: "+e),null}if(e)try{e.innerHTML=""}catch(n){e=null,t.error(n)}return e}const gD=t=>+t||0;function mD(t){return x(t)?{top:gD(t.top),bottom:gD(t.bottom),left:gD(t.left),right:gD(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(gD(t))}async function vD(t,e,n,r){const i=wv(e),a=i&&i.headless;return a||u("Unrecognized renderer type: "+e),await t.runAsync(),hD(t,null,null,a,n,r).renderAsync(t._scenegraph.root)}function yD(t){const e=this.context.data[t];return e?e.values.value:[]}const _D=t=>function(e,n){return this.context.dataflow.locale()[t](n)(e)},xD=_D("format"),bD=_D("timeFormat"),wD=_D("utcFormat"),kD=_D("timeParse"),AD=_D("utcParse");var MD=new Date(2e3,0,1);function ED(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(MD.setYear(2e3),MD.setMonth(t),MD.setDate(e),bD.call(this,MD,n)):""}var DD,CD,FD,SD,BD;function TD(t){this.type=t}TD.prototype.visit=function(t){var e,n,r;if(t(this))return 1;for(n=0,r=(e=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case"CallExpression":var e=t.arguments.slice();return e.unshift(t.callee),e;case"ConditionalExpression":return[t.test,t.consequent,t.alternate];case"MemberExpression":return[t.object,t.property];case"ObjectExpression":return t.properties;case"Property":return[t.key,t.value];case"UnaryExpression":return[t.argument];case"Identifier":case"Literal":case"RawCode":default:return[]}}(this)).length;n",DD[3]="Identifier",DD[4]="Keyword",DD[5]="Null",DD[6]="Numeric",DD[7]="Punctuator",DD[8]="String",DD[9]="RegularExpression";var zD="ILLEGAL",ND=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),OD=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u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EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function RD(t,e){if(!t)throw new Error("ASSERT: "+e)}function qD(t){return t>=48&&t<=57}function UD(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function LD(t){return"01234567".indexOf(t)>=0}function $D(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function PD(t){return 10===t||13===t||8232===t||8233===t}function jD(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&ND.test(String.fromCharCode(t))}function ID(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&OD.test(String.fromCharCode(t))}var WD={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function HD(){for(var t;FD1114111||"}"!==t)&&sC({},"Unexpected token %0",zD),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function GD(){var t,e;for(t=CD.charCodeAt(FD++),e=String.fromCharCode(t),92===t&&(117!==CD.charCodeAt(FD)&&sC({},"Unexpected token %0",zD),++FD,(t=YD("u"))&&"\\"!==t&&jD(t.charCodeAt(0))||sC({},"Unexpected token %0",zD),e=t);FD>>="===(r=CD.substr(FD,4))?{type:7,value:r,start:i,end:FD+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:FD+=3}:o===(e=n.substr(0,2))[1]&&"+-<>&|".indexOf(o)>=0||"=>"===e?{type:7,value:e,start:i,end:FD+=2}:"<>=!+-*%&|^/".indexOf(o)>=0?{type:7,value:o,start:i,end:++FD}:void sC({},"Unexpected token %0",zD)}function ZD(){var t,e,n;if(RD(qD((n=CD[FD]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=FD,t="","."!==n){if(t=CD[FD++],n=CD[FD],"0"===t){if("x"===n||"X"===n)return++FD,function(t){for(var e="";FD=0&&sC({},"Invalid regular expression",n),{value:n,literal:e}}(),r=function(t,e){var n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(t,e){if(parseInt(e,16)<=1114111)return"x";sC({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){sC({},"Invalid regular expression")}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:FD}}function KD(){var t;return HD(),FD>=SD?{type:2,start:FD,end:FD}:jD(t=CD.charCodeAt(FD))?XD():40===t||41===t||59===t?JD():39===t||34===t?function(){var t,e,n,r,i="",a=!1;for(RD("'"===(t=CD[FD])||'"'===t,"String literal must starts with a quote"),e=FD,++FD;FD=0&&FD":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function MC(){var t,e;return t=function(){var t,e,n,r,i,a,o,u,s,l;if(t=BD,s=kC(),0===(i=AC(r=BD)))return s;for(r.prec=i,tC(),e=[t,BD],a=[s,r,o=kC()];(i=AC(BD))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),u=a.pop().value,s=a.pop(),e.pop(),n=nC(u,s,o),a.push(n);(r=tC()).prec=i,a.push(r),e.push(BD),n=kC(),a.push(n)}for(n=a[l=a.length-1],e.pop();l>1;)e.pop(),n=nC(a[l-1].value,a[l-2],n),l-=2;return n}(),fC("?")&&(tC(),e=MC(),cC(":"),t=function(t,e,n){var r=new TD("ConditionalExpression");return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,MC())),t}function EC(){var t=MC();if(fC(","))throw new Error("Disabled.");return t}var DC={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function CC(t){function e(e,n,r){return function(i){return function(e,n,r,i){var a=t(n[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}}var n="new Date";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(e){e.length<3&&u("Missing arguments to clamp function."),e.length>3&&u("Too many arguments to clamp function.");var n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),join:e("join",null),indexof:e("indexOf",null),lastindexof:e("lastIndexOf",null),slice:e("slice",null),reverse:function(e){return"("+t(e[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase","String",0),lower:e("toLowerCase","String",0),substring:e("substring","String"),split:e("split","String"),replace:e("replace","String"),trim:e("trim","String",0),regexp:"RegExp",test:e("test","RegExp"),if:function(e){e.length<3&&u("Missing arguments to if function."),e.length>3&&u("Too many arguments to if function.");var n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function FC(t,e,n,r){"Literal"!==e[0].type&&u("First argument to data functions must be a string literal.");const i=e[0].value,a=":"+i;if(!it(a,r))try{r[a]=n.getData(i).tuplesRef()}catch(t){}}function SC(t,e,n,r){if("Literal"===e[0].type)BC(n,r,e[0].value);else for(t in n.scales)BC(n,r,t)}function BC(t,e,n){const r="%"+n;if(!it(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}function TC(t,e){let n;return Y(t)?t:pt(t)?(n=e.scales[t])&&n.value:void 0}function zC(t,e){return function(n,r,i){if(n){const e=TC(n,(i||this).context);return e&&e.path[t](r)}return e(r)}}const NC=zC("area",(function(t){return I_.reset(),R_(t,W_),2*I_})),OC=zC("bounds",(function(t){var e,n,r,i,a,o,u;if(ax=ix=-(nx=rx=1/0),cx=[],R_(t,Fx),n=cx.length){for(cx.sort(Ux),e=1,a=[r=cx[0]];eqx(r[0],r[1])&&(r[1]=i[1]),qx(i[0],r[1])>qx(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,e=0,r=a[n=a.length-1];e<=n;r=i,++e)i=a[e],(u=qx(r[1],i[0]))>o&&(o=u,nx=i[0],ix=r[1])}return cx=fx=null,nx===1/0||rx===1/0?[[NaN,NaN],[NaN,NaN]]:[[nx,rx],[ix,ax]]})),RC=zC("centroid",(function(t){hx=dx=px=gx=mx=vx=yx=_x=xx=bx=wx=0,R_(t,$x);var e=xx,n=bx,r=wx,i=e*e+n*n+r*r;return i<1e-12&&(e=vx,n=yx,r=_x,dx<1e-6&&(e=px,n=gx,r=mx),(i=e*e+n*n+r*r)<1e-12)?[NaN,NaN]:[y_(n,e)*p_,F_(r/E_(i))*p_]}));function qC(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}function UC(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function LC(t){const e=Yd(t);return.2126*UC(e.r)+.7152*UC(e.g)+.0722*UC(e.b)}function $C(t,e){return t===e||t!=t&&e!=e||(_(t)?!(!_(e)||t.length!==e.length)&&function(t,e){for(let n=0,r=t.length;nPC(t,e)}const IC=t=>t.data;function WC(t,e){const n=yD.call(e,t);return n.root&&n.root.lookup||{}}const HC=()=>"undefined"!=typeof window&&window||null;function YC(t,e){for(var n,r,i=e.fields,a=e.values,o=i.length,u=0;u=0})):e},R_union:function(t,e){var n=E(e[0]),r=E(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]r&&(n=e[1],r=e[0]),t.length?rr&&(t[1]=r),t):[n,r]}};function GC(t,e,n,r){"Literal"!==e[0].type&&u("First argument to selection functions must be a string literal.");const i=e[0].value,a=":"+i;"intersect"!==(e.length>=2&&M(e).value)||it(r,"@unit")||(r["@unit"]=n.getData(i).indataRef(n,"unit")),it(r,a)||(r[a]=n.getData(i).tuplesRef())}const XC={random:function(){return t.random()},cumulativeNormal:Eo,cumulativeLogNormal:To,cumulativeUniform:Uo,densityNormal:Mo,densityLogNormal:Bo,densityUniform:qo,quantileNormal:Do,quantileLogNormal:zo,quantileUniform:Lo,sampleNormal:Ao,sampleLogNormal:So,sampleUniform:Ro,isArray:_,isBoolean:ct,isDate:ft,isDefined:function(t){return void 0!==t},isNumber:ht,isObject:x,isRegExp:dt,isString:pt,isTuple:Nt,isValid:function(t){return null!=t&&t==t},toBoolean:kt,toDate:Mt,toNumber:E,toString:Et,flush:ut,lerp:mt,merge:function(){var t=[].slice.call(arguments);return t.unshift({}),tt.apply(null,t)},pad:xt,peek:M,span:bt,inrange:lt,truncate:Ct,rgb:Yd,lab:op,hcl:dp,hsl:Kd,luminance:LC,contrast:function(t,e){const n=LC(t),r=LC(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:Ye,format:xD,utcFormat:wD,utcParse:AD,utcOffset:Pr,utcSequence:Wr,timeFormat:bD,timeParse:kD,timeOffset:$r,timeSequence:Ir,timeUnitSpecifier:In,monthFormat:function(t){return ED.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return ED.call(this,t,1,"%b")},dayFormat:function(t){return ED.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return ED.call(this,0,2+t,"%a")},quarter:j,utcquarter:I,week:mr,utcweek:wr,dayofyear:gr,utcdayofyear:br,warn:function(){return qC(this.context.dataflow,"warn",arguments)},info:function(){return qC(this.context.dataflow,"info",arguments)},debug:function(){return qC(this.context.dataflow,"debug",arguments)},extent:et,inScope:function(t){let e=this.context.group,n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},intersect:function(t,e,n){if(!t)return[];const[r,i]=t,a=(new Uc).set(r[0],r[1],i[0],i[1]);return kv(n||this.context.dataflow.scenegraph().root,a,function(t){let e=null;if(t){const n=W(t.marktype),r=W(t.markname);e=t=>(!n.length||n.some(e=>t.marktype===e))&&(!r.length||r.some(e=>t.name===e))}return e}(e))},clampRange:H,pinchDistance:function(t){const e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(t){const e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){const t=HC();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){const t=HC();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,e,n){return vd(t||0,e||0,n||0)},setdata:function(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(g).insert(e)),1},pathShape:function(t){let e=null;return function(n){return n?uc(n,e=e||Jl(t)):t}},panLinear:z,panLog:N,panPow:O,panSymlog:R,zoomLinear:U,zoomLog:L,zoomPow:$,zoomSymlog:P,encode:function(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,a){let o,u,s=this.context.dataflow,l=this.context.data[t],c=l.input,f=l.changes,h=s.stamp();if(!1===s._trigger||!(c.value.length||e||r))return 0;if((!f||f.stampa.stop(l(e),t(e))),a}),SC),QC("geoArea",NC,SC),QC("geoBounds",OC,SC),QC("geoCentroid",RC,SC),QC("geoShape",(function(t,e,n){const r=TC(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}),SC),QC("indata",(function(t,e,n){const r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(t,e,n,r){"Literal"!==e[0].type&&u("First argument to indata must be a string literal."),"Literal"!==e[1].type&&u("Second argument to indata must be a string literal.");const i=e[0].value,a=e[1].value,o="@"+a;it(o,r)||(r[o]=n.getData(i).indataRef(n,a))})),QC("data",yD,FC),QC("treePath",(function(t,e,n){const r=WC(t,this),i=r[e],a=r[n];return i&&a?i.path(a).map(IC):void 0}),FC),QC("treeAncestors",(function(t,e){const n=WC(t,this)[e];return n?n.ancestors().map(IC):void 0}),FC),QC("vlSelectionTest",(function(t,e,n){for(var r,i,a,o,u,s=this.context.data[t],l=s?s.values.value:[],c=s?s["index:unit"]&&s["index:unit"].value:void 0,f="intersect"===n,h=l.length,d=0;d(t[i[n].field]=e,t),{}))}return e=e||"union",Object.keys(m).forEach((function(t){m[t]=Object.keys(m[t]).map(e=>m[t][e]).reduce((n,r)=>void 0===n?r:VC[y[t]+"_"+e](n,r))})),g=Object.keys(v),n&&g.length&&(m.vlMulti="union"===e?{or:g.reduce((t,e)=>(t.push.apply(t,v[e]),t),[])}:{and:g.map(t=>({or:v[t]}))}),m}),GC);const KC={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:t=>"_["+wt("$"+t)+"]",functions:function(t){const e=CC(t);JC.forEach(t=>e[t]="event.vega."+t);for(let t in XC)e[t]="this."+t;return tt(e,function(t,e,n){e.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,n._bandwidth=SC,n._range=SC,n._scale=SC;const r=e=>"_["+("Literal"===e.type?wt("%"+e.value):wt("%")+"+"+t(e))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>r(t[0])+".range()",_scale:e=>`${r(e[0])}(${t(e[1])})`}}(t,XC,ZC)),e},constants:DC,visitors:ZC};var tF=function(t){var e=(t=t||{}).whitelist?Dt(t.whitelist):{},n=t.blacklist?Dt(t.blacklist):{},r=t.constants||DC,i=(t.functions||CC)(h),a=t.globalvar,o=t.fieldvar,s={},l={},c=0,f=Y(a)?a:function(t){return a+'["'+t+'"]'};function h(t){if(pt(t))return t;var e=d[t.type];return null==e&&u("Unsupported type: "+t.type),e(t)}var d={Literal:function(t){return t.raw},Identifier:function(t){var i=t.name;return c>0?i:it(n,i)?u("Illegal identifier: "+i):it(r,i)?r[i]:it(e,i)?i:(s[i]=1,f(i))},MemberExpression:function(t){var e=!t.computed,n=h(t.object);e&&(c+=1);var r=h(t.property);return n===o&&(l[function(t){var e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(c-=1),n+(e?"."+r:"["+r+"]")},CallExpression:function(t){"Identifier"!==t.callee.type&&u("Illegal callee type: "+t.callee.type);var e=t.callee.name,n=t.arguments,r=it(i,e)&&i[e];return r||u("Unrecognized function: "+e),Y(r)?r(n):r+"("+n.map(h).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(h).join(",")+"]"},BinaryExpression:function(t){return"("+h(t.left)+t.operator+h(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+h(t.argument)+")"},ConditionalExpression:function(t){return"("+h(t.test)+"?"+h(t.consequent)+":"+h(t.alternate)+")"},LogicalExpression:function(t){return"("+h(t.left)+t.operator+h(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(h).join(",")+"}"},Property:function(t){c+=1;var e=h(t.key);return c-=1,e+":"+h(t.value)}};function p(t){var e={code:h(t),globals:Object.keys(s),fields:Object.keys(l)};return s={},l={},e}return p.functions=i,p.constants=r,p}(KC);function eF(t,e){var n,r,i={};try{n=function(t){FD=0,SD=(CD=t).length,BD=null,eC();var e=EC();if(2!==BD.type)throw new Error("Unexpect token after expression.");return e}(t=pt(t)?t:wt(t)+"")}catch(e){u("Expression parse error: "+t)}return n.visit(t=>{if("CallExpression"===t.type){var n=t.callee.name,r=KC.visitors[n];r&&r(n,t.arguments,e,i)}}),(r=tF(n)).globals.forEach(t=>{var n="$"+t;!it(i,n)&&e.getSignal(t)&&(i[n]=e.signalRef(t))}),{$expr:tt({code:r.code},e.options.ast?{ast:n}:null),$fields:r.fields,$params:i}}const nF=Dt(["rule"]),rF=Dt(["group","image","rect"]);function iF(t){return(t+"").toLowerCase()}function aF(t,e,n){";"!==n[n.length-1]&&(n="return("+n+");");var r=Function.apply(null,e.concat(n));return t&&t.functions?r.bind(t.functions):r}var oF={operator:(t,e)=>aF(t,["_"],e.code),parameter:(t,e)=>aF(t,["datum","_"],e.code),event:(t,e)=>aF(t,["event"],e.code),handler:(t,e)=>aF(t,["_","event"],`var datum=event.item&&event.item.datum;return ${e.code};`),encode:(t,e)=>{const{marktype:n,channels:r}=e;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const e="o["+wt(t)+"]";i+=`$=${r[t].code};if(${e}!==$)${e}=$,m=1;`}return i+=function(t,e){let n="";return nF[e]||(t.x2&&(t.x?(rF[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(rF[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(r,n),i+="return m;",aF(t,["item","_"],i)},codegen:{get(t){const e=`[${t.map(wt).join("][")}]`,n=Function("_",`return _${e};`);return n.path=e,n},comparator(t,e){let n;const r=Function("a","b","var u, v; return "+t.map((t,r)=>{const i=e[r];let a,o;return t.path?(a="a"+t.path,o="b"+t.path):((n=n||{})["f"+r]=t,a=`this.f${r}(a)`,o=`this.f${r}(b)`),function(t,e,n,r){return`((u = ${t}) < (v = ${e}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${r}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${r} : `}(a,o,-i,i)}).join("")+"0;");return n?r.bind(n):r}}};function uF(t,e,n){if(!t||!x(t))return t;for(let r,i=0,a=sF.length;it&&t.$tupleid?Ot:t);return e.fn[n]||(e.fn[n]=V(r,t.$order,e.expr.codegen))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,e){const n=t.$subflow;return function(t,r,i){const a=e.fork().parse(n),o=a.get(n.operators[0].id),u=a.signals.parent;return u&&u.set(i),o.detachSubflow=()=>e.detach(a),o}}},{key:"$tupleid",parse:function(){return Ot}}];var lF={skip:!0};function cF(t,e,n,r){return new fF(t,e,n,r)}function fF(t,e,n,r){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.expr=r||oF,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function hF(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}fF.prototype=hF.prototype={fork(){const t=new hF(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter(e=>e!==t);const e=Object.keys(t.nodes);for(const n of e)t.nodes[n]._targets=null;for(const n of e)t.nodes[n].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,e){return this.nodes[t]=e},add(t,e){const n=this,r=n.dataflow,i=t.value;if(n.set(t.id,e),function(t){return"collect"===iF(t)}(t.type)&&i&&(i.$ingest?r.ingest(e,i.$ingest,i.$format):i.$request?r.preload(e,i.$request,i.$format):r.pulse(e,r.changeset().insert(i))),t.root&&(n.root=e),t.parent){var a=n.get(t.parent.$ref);a?(r.connect(a,[e]),e.targets().add(a)):(n.unresolved=n.unresolved||[]).push(()=>{a=n.get(t.parent.$ref),r.connect(a,[e]),e.targets().add(a)})}if(t.signal&&(n.signals[t.signal]=e),t.scale&&(n.scales[t.scale]=e),t.data)for(const r in t.data){const i=n.data[r]||(n.data[r]={});t.data[r].forEach(t=>i[t]=e)}},resolve(){return(this.unresolved||[]).forEach(t=>t()),delete this.unresolved,this},operator(t,e){this.add(t,this.dataflow.add(t.value,e))},transform(t,e){this.add(t,this.dataflow.add(this.transforms[iF(e)]))},stream(t,e){this.set(t.id,e)},update(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const e=this,n=t.operators||[];return t.background&&(e.background=t.background),t.eventConfig&&(e.eventConfig=t.eventConfig),t.locale&&(e.locale=t.locale),n.forEach(t=>e.parseOperator(t)),n.forEach(t=>e.parseOperatorParameters(t)),(t.streams||[]).forEach(t=>e.parseStream(t)),(t.updates||[]).forEach(t=>e.parseUpdate(t)),e.resolve()},parseOperator:function(t){const e=this;!function(t){return"operator"===iF(t)}(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?e.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const e=this;if(t.params){const n=e.get(t.id);n||u("Invalid operator id: "+t.id),e.dataflow.connect(n,n.parameters(e.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,e){e=e||{};const n=this;for(const r in t){const i=t[r];e[r]=_(i)?i.map(t=>uF(t,n,e)):uF(i,n,e)}return e},parseStream:function(t){var e,n=this,r=null!=t.filter?n.eventExpression(t.filter):void 0,i=null!=t.stream?n.get(t.stream):void 0;t.source?i=n.events(t.source,t.type,r):t.merge&&(i=(e=t.merge.map(t=>n.get(t)))[0].merge.apply(e[0],e.slice(1))),t.between&&(e=t.between.map(t=>n.get(t)),i=i.between(e[0],e[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&u("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),n.stream(t,i)},parseUpdate:function(t){var e,n=x(n=t.source)?n.$ref:n,r=this.get(n),i=t.update,a=void 0;r||u("Source not defined: "+t.source),e=t.target&&t.target.$expr?this.eventExpression(t.target.$expr):this.get(t.target),i&&i.$expr&&(i.$params&&(a=this.parseParameters(i.$params)),i=this.handlerExpression(i.$expr)),this.update(t,r,e,i,a)},getState:function(t){var e=this,n={};if(t.signals){var r=n.signals={};Object.keys(e.signals).forEach(n=>{var i=e.signals[n];t.signals(n,i)&&(r[n]=i.value)})}if(t.data){var i=n.data={};Object.keys(e.data).forEach(n=>{var r=e.data[n];t.data(n,r)&&(i[n]=r.input.value)})}return e.subcontext&&!1!==t.recurse&&(n.subcontext=e.subcontext.map(e=>e.getState(t))),n},setState:function(t){var e=this,n=e.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach(t=>{n.update(e.signals[t],i[t],lF)}),Object.keys(r||{}).forEach(t=>{n.pulse(e.data[t].input,n.changeset().remove(g).insert(r[t]))}),(t.subcontext||[]).forEach((t,n)=>{var r=e.subcontext[n];r&&r.setState(t)})}};var dF={skip:!0};function pF(t,e){var n=t.autosize(),r=t.padding();return e-(n&&"padding"===n.contains?r.left+r.right:0)}function gF(t,e){var n=t.autosize(),r=t.padding();return e-(n&&"padding"===n.contains?r.top+r.bottom:0)}function mF(t,e){return e.modified&&_(e.input.value)&&t.indexOf("_:vega:_")}function vF(t,e){return!("parent"===t||e instanceof Za.proxy)}function yF(t,e,n,r){var i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":_(t)?_F(t):x(t)&&!ft(t)?(e=t,Object.keys(e).map((function(t){var n=e[t];return t+": "+(_(n)?_F(n):xF(n))})).join("\n")):t+"";var e}(r))}function _F(t){return"["+t.map(xF).join(", ")+"]"}function xF(t){return _(t)?"[…]":x(t)&&!ft(t)?"{…}":t}function bF(t,e){const n=this;if(e=e||{},Ya.call(n),e.loader&&n.loader(e.loader),e.logger&&n.logger(e.logger),null!=e.logLevel&&n.logLevel(e.logLevel),e.locale||t.locale){const r=tt({},t.locale,e.locale);n.locale(Da(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=e.renderer||xv.Canvas,n._scenegraph=new Rh;const r=n._scenegraph.root;n._renderer=null,n._tooltip=e.tooltip||yF,n._redraw=!0,n._handler=(new ad).scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(t){const e=tt({defaults:{}},t),n=(t,e)=>{e.forEach(e=>{_(t[e])&&(t[e]=Dt(t[e]))})};return n(e.defaults,["prevent","allow"]),n(e,["view","window","selector"]),e}(t.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=function(t,e,n){return cF(t,Za,XC,n).parse(e)}(n,t,e.expr);n._runtime=i,n._signals=i.signals,n._bind=(t.bindings||[]).map(t=>({state:null,param:tt({},t)})),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=pF(n,n._width),n._viewHeight=gF(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(t){var e=t._signals,n=e.width,r=e.height,i=e.padding;function a(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(function(e){t._width=e.size,t._viewWidth=pF(t,e.size),a()}),{size:n}),t._resizeHeight=t.add(null,(function(e){t._height=e.size,t._viewHeight=gF(t,e.size),a()}),{size:r});var o=t.add(null,a,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,o.rank=i.rank+1}(n),function(t){t.add(null,e=>(t._background=e.bg,t._resize=1,e.bg),{bg:t._signals.background})}(n),function(t){const e=t._signals.cursor||(t._signals.cursor=t.add({user:"default",item:null}));t.on(t.events("view","mousemove"),e,(function(t,n){const r=e.value,i=r?pt(r)?r:r.user:"default",a=n.item&&n.item.cursor||null;return r&&i===r.user&&a==r.item?r:{user:i,item:a}})),t.add(null,(function(e){let n=e.cursor,r=this.value;return pt(n)||(r=n.item,n=n.user),YE(t,n&&"default"!==n?n:r||n),r}),{cursor:e})}(n),n.description(t.description),e.hover&&n.hover(),e.container&&n.initialize(e.container,e.bind)}var wF=st(bF,Ya);function kF(t,e){return it(t._signals,e)?t._signals[e]:u("Unrecognized signal name: "+wt(e))}function AF(t,e){const n=(t._targets||[]).filter(t=>t._update&&t._update.handler===e);return n.length?n[0]:null}function MF(t,e,n,r){var i=AF(n,r);return i||((i=dD(t,()=>r(e,n.value))).handler=r,t.on(n,null,i)),t}function EF(t,e,n){var r=AF(e,n);return r&&e._targets.remove(r),t}function DF(t){return x(t)?t:{type:t||"pad"}}wF.evaluate=async function(t,e,n){if(await Ya.prototype.evaluate.call(this,t,e),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var e=ZE(t),n=XE(t),r=JE(t);t._renderer.background(t.background()),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach((function(e){try{e(n,r)}catch(e){t.error(e)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return n&&Bt(this,n),this},wF.dirty=function(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},wF.description=function(t){if(arguments.length){const e=null!=t?t+"":null;return e!==this._desc&&HE(this._el,this._desc=e),this}return this._desc},wF.container=function(){return this._el},wF.scenegraph=function(){return this._scenegraph},wF.origin=function(){return this._origin.slice()},wF.signal=function(t,e,n){var r=kF(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},wF.width=function(t){return arguments.length?this.signal("width",t):this.signal("width")},wF.height=function(t){return arguments.length?this.signal("height",t):this.signal("height")},wF.padding=function(t){return arguments.length?this.signal("padding",mD(t)):mD(this.signal("padding"))},wF.autosize=function(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},wF.background=function(t){return arguments.length?this.signal("background",t):this.signal("background")},wF.renderer=function(t){return arguments.length?(wv(t)||u("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},wF.tooltip=function(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},wF.loader=function(t){return arguments.length?(t!==this._loader&&(Ya.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},wF.resize=function(){return this._autosize=1,this.touch(kF(this,"autosize"))},wF._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},wF._resizeView=function(t,e,n,r,i,a){this.runAfter((function(o){var u=0;o._autosize=0,o.width()!==n&&(u=1,o.signal("width",n,dF),o._resizeWidth.skip(!0)),o.height()!==r&&(u=1,o.signal("height",r,dF),o._resizeHeight.skip(!0)),o._viewWidth!==t&&(o._resize=1,o._viewWidth=t),o._viewHeight!==e&&(o._resize=1,o._viewHeight=e),o._origin[0]===i[0]&&o._origin[1]===i[1]||(o._resize=1,o._origin=i),u&&o.run("enter"),a&&o.runAfter(t=>t.resize())}),!1,1)},wF.addEventListener=function(t,e,n){var r=e;return n&&!1===n.trap||((r=dD(this,e)).raw=e),this._handler.on(t,r),this},wF.removeEventListener=function(t,e){for(var n,r,i=this._handler.handlers(t),a=i.length;--a>=0;)if(r=i[a].type,n=i[a].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},wF.addResizeListener=function(t){var e=this._resizeListeners;return e.indexOf(t)<0&&e.push(t),this},wF.removeResizeListener=function(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},wF.addSignalListener=function(t,e){return MF(this,t,kF(this,t),e)},wF.removeSignalListener=function(t,e){return EF(this,kF(this,t),e)},wF.addDataListener=function(t,e){return MF(this,t,VE(this,t).values,e)},wF.removeDataListener=function(t,e){return EF(this,VE(this,t).values,e)},wF.globalCursor=function(t){if(arguments.length){if(this._globalCursor!==!!t){const e=YE(this,null);this._globalCursor=!!t,e&&YE(this,e)}return this}return this._globalCursor},wF.preventDefault=function(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},wF.timer=function(t,e){this._timers.push(function(t,e,n){var r=new lA,i=e;return null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?uA():+n,r.restart((function a(o){o+=i,r.restart(a,i+=e,n),t(o)}),e,n),r)}((function(e){t({timestamp:Date.now(),elapsed:e})}),e))},wF.events=function(t,e,n){var r,i=this,a=new Kt(n),o=function(n,r){i.runAsync(null,()=>{"view"===t&&function(t,e){var n=t._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault(),a.receive(QE(i,n,r))})};if("timer"===t)tD(i,"timer",e)&&i.timer(o,e);else if("view"===t)tD(i,"view",e)&&i.addEventListener(e,o,KE);else if("window"===t?tD(i,"window",e)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&tD(i,"selector",e)&&(r=document.querySelectorAll(t)),r){for(var u=0,s=r.length;u=0;)i[t].stop();for(t=a.length;--t>=0;)for(e=(n=a[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);return r&&r.call(this,this._handler,null,null,null),this},wF.hover=function(t,e){return e=[e||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",eD),nD,rD(t)),this.on(this.events("view","mouseout",eD),nD,rD(e)),this},wF.data=function(t,e){return arguments.length<2?VE(this,t).values.value:GE.call(this,t,It().remove(g).insert(e))},wF.change=GE,wF.insert=function(t,e){return GE.call(this,t,It().insert(e))},wF.remove=function(t,e){return GE.call(this,t,It().remove(e))},wF.scale=function(t){var e=this._runtime.scales;return it(e,t)||u("Unrecognized scale or projection: "+t),e[t].value},wF.initialize=function(t,e){const n=this,r=n._renderType,i=n._eventConfig.bind,a=wv(r);t=n._el=t?pD(n,t):null,function(t){const e=t.container();e&&(e.setAttribute("role","graphics-document"),e.setAttribute("aria-roleDescription","visualization"),HE(e,t.description()))}(n),a||n.error("Unrecognized renderer type: "+r);const o=a.handler||ad,u=t?a.renderer:a.headless;return n._renderer=u?hD(n,n._renderer,t,u):null,n._handler=function(t,e,n,r){var i=new r(t.loader(),dD(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,ZE(t),t);return e&&e.handlers().forEach((function(t){i.on(t.type,t.handler)})),i}(n,n._handler,t,o),n._redraw=!0,t&&"none"!==i&&(e=e?n._elBind=pD(n,e):t.appendChild(iD("form",{class:"vega-bindings"})),n._bind.forEach((function(t){t.param.element&&"container"!==i&&(t.element=pD(n,t.param.element))})),n._bind.forEach((function(t){aD(n,t.element||e,t)}))),n},wF.toImageURL=async function(t,e){t!==xv.Canvas&&t!==xv.SVG&&t!==xv.PNG&&u("Unrecognized image type: "+t);const n=await vD(this,t,e);return t===xv.SVG?function(t,e){var n=new Blob([t],{type:e});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},wF.toCanvas=async function(t,e){return(await vD(this,xv.Canvas,t,e)).canvas()},wF.toSVG=async function(t){return(await vD(this,xv.SVG,t)).svg()},wF.getState=function(t){return this._runtime.getState(t||{data:mF,signals:vF,recurse:!0})},wF.setState=function(t){return this.runAsync(null,e=>{e._trigger=!1,e._runtime.setState(t)},t=>{t._trigger=!0}),this};const CF=t=>+t||0;function FF(t){return x(t)?t.signal?t:{top:CF(t.top),bottom:CF(t.bottom),left:CF(t.left),right:CF(t.right)}:{top:e=CF(t),bottom:e,left:e,right:e};var e}const SF=t=>x(t)&&!_(t)?tt({},t):{value:t};function BF(t,e,n,r){return null!=n?(x(n)&&!_(n)?t.update[e]=n:t[r||"enter"][e]={value:n},1):0}function TF(t,e,n){for(const n in e)BF(t,n,e[n]);for(const e in n)BF(t,e,n[e],"update")}function zF(t,e,n){for(const r in e)n&&it(n,r)||(t[r]=tt(t[r]||{},e[r]));return t}function NF(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}function OF(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}const RF=t=>pt(t)?wt(t):t.signal?`(${t.signal})`:$F(t);function qF(t){if(null!=t.gradient)return function(t){const e=[t.start,t.stop,t.count].map(t=>null==t?null:wt(t));for(;e.length&&null==M(e);)e.pop();return e.unshift(RF(t.gradient)),`gradient(${e.join(",")})`}(t);let e=t.signal?`(${t.signal})`:t.color?function(t){return t.c?UF("hcl",t.h,t.c,t.l):t.h||t.s?UF("hsl",t.h,t.s,t.l):t.l||t.a?UF("lab",t.l,t.a,t.b):t.r||t.g||t.b?UF("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?$F(t.field):void 0!==t.value?wt(t.value):void 0;return null!=t.scale&&(e=function(t,e){const n=RF(t.scale);null!=t.range?e=`lerp(_range(${n}), ${+t.range})`:(void 0!==e&&(e=`_scale(${n}, ${e})`),t.band&&(e=(e?e+"+":"")+`_bandwidth(${n})`+(1==+t.band?"":"*"+LF(t.band)),t.extra&&(e=`(datum.extra ? _scale(${n}, datum.extra.value) : ${e})`)),null==e&&(e="0"));return e}(t,e)),void 0===e&&(e=null),null!=t.exponent&&(e=`pow(${e},${LF(t.exponent)})`),null!=t.mult&&(e+="*"+LF(t.mult)),null!=t.offset&&(e+="+"+LF(t.offset)),t.round&&(e=`round(${e})`),e}const UF=(t,e,n,r)=>`(${t}(${[e,n,r].map(qF).join(",")})+'')`;function LF(t){return x(t)?"("+qF(t)+")":t}function $F(t){return function t(e){let n,r,i;if(e.signal)n="datum",i=e.signal;else if(e.group||e.parent){for(r=Math.max(1,e.level||1),n="item";r-- >0;)n+=".mark.group";e.parent?(i=e.parent,n+=".datum"):i=e.group}else e.datum?(n="datum",i=e.datum):u("Invalid field reference: "+wt(e));e.signal||(i=pt(i)?s(i).map(wt).join("]["):t(i));return n+"["+i+"]"}(x(t)?t:{datum:t})}function PF(t,e,n,r,i,a){const o={};(a=a||{}).encoders={$encode:o},t=function(t,e,n,r,i){const a={},o={};let u,s,l,c;for(s in s="lineBreak","text"!==e||null==i[s]||NF(s,t)||OF(a,s,i[s]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c="frame"===n?i.group:"mark"===n?tt({},i.mark,i[e]):null,c)l=NF(s,t)||("fill"===s||"stroke"===s)&&(NF("fill",t)||NF("stroke",t)),l||OF(a,s,c[s]);for(s in W(r).forEach(e=>{const n=i.style&&i.style[e];for(const e in n)NF(e,t)||OF(a,e,n[e])}),t=tt({},t),a)c=a[s],c.signal?(u=u||{})[s]=c:o[s]=c;return t.enter=tt(o,t.enter),u&&(t.update=tt(u,t.update)),t}(t,e,n,r,i.config);for(const n in t)o[n]=jF(t[n],e,a,i);return a}function jF(t,e,n,r){const i={},a={};for(const e in t)null!=t[e]&&(i[e]=IF((o=t[e],_(o)?function(t){let e="";return t.forEach(t=>{const n=qF(t);e+=t.test?`(${t.test})?${n}:`:n}),":"===M(e)&&(e+="null"),e}(o):qF(o)),r,n,a));var o;return{$expr:{marktype:e,channels:i},$fields:Object.keys(a),$output:Object.keys(t)}}function IF(t,e,n,r){const i=eF(t,e);return i.$fields.forEach(t=>r[t]=1),tt(n,i.$params),i.$expr}var WF=["value","update","init","react","bind"];function HF(t,e){u(t+' for "outer" push: '+wt(e))}function YF(t,e){var n=t.name;if("outer"===t.push)e.signals[n]||HF("No prior signal definition",n),WF.forEach((function(e){void 0!==t[e]&&HF("Invalid property ",e)}));else{var r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}function VF(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function GF(t,e,n,r){return new VF(t,e,n,r)}function XF(t,e){return GF("operator",t,e)}function JF(t){var e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function ZF(t,e){return e?{$field:t,$name:e}:{$field:t}}var QF=ZF("key");function KF(t,e){return{$compare:t,$order:e}}function tS(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}function eS(t){return t&&t.signal}function nS(t){if(eS(t))return!0;if(x(t))for(var e in t)if(nS(t[e]))return!0;return!1}function rS(t,e){return null!=t?t:e}function iS(t){return t&&t.signal||t}function aS(t,e){return(t.merge?oS:t.stream?uS:t.type?sS:u("Invalid stream specification: "+wt(t)))(t,e)}function oS(t,e){var n=lS({merge:t.merge.map(t=>aS(t,e))},t,e);return e.addStream(n).id}function uS(t,e){var n=lS({stream:aS(t.stream,e)},t,e);return e.addStream(n).id}function sS(t,e){var n,r;return"timer"===t.type?(n=e.event("timer",t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return"scope"===t?"view":t||"view"}(t.source),t.type),r=lS({stream:n},t,e),1===Object.keys(r).length?n:e.addStream(r).id}function lS(t,e,n){var r=e.between;return r&&(2!==r.length&&u('Stream "between" parameter must have 2 entries: '+wt(e)),t.between=[aS(r[0],n),aS(r[1],n)]),r=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){var r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),"scope"===e.source&&r.push("inScope(event.item)"),r.length&&(t.filter=eF("("+r.join(")&&(")+")",n).$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}var cS,fS,hS="view",dS=/[[\]{}]/,pS={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function gS(t,e,n,r,i){for(var a,o=0,u=t.length;e=0?--o:r&&r.indexOf(a)>=0&&++o}return e}function mS(t){for(var e=[],n=0,r=t.length,i=0;i"!==(t=t.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+t;if(e=e.map(vS),(n=vS(t.slice(1).trim())).between)return{between:e,stream:n};n.between=e;return n}(t):function(t){var e,n,r={source:cS},i=[],a=[0,0],o=0,u=0,s=t.length,l=0;if("}"===t[s-1]){if(!((l=t.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+t;try{a=function(t){var e=t.split(",");if(!t.length||e.length>2)throw t;return e.map((function(e){var n=+e;if(n!=n)throw t;return n}))}(t.substring(l+1,s-1))}catch(e){throw"Invalid throttle specification: "+t}t=t.slice(0,l).trim(),s=t.length,l=0}if(!s)throw t;"@"===t[0]&&(o=++l);(e=gS(t,l,":"))1?(r.type=i[1],o?r.markname=i[0].slice(1):!function(t){return fS[t]}(i[0])?r.source=i[0]:r.marktype=i[0]):r.type=i[0];"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=n&&(r.filter=n);a[0]&&(r.throttle=a[0]);a[1]&&(r.debounce=a[1]);return r}(t)}const yS={code:"_.$value",ast:{type:"Identifier",value:"value"}};function _S(t,e,n){var r=t.events,i=t.update,a=t.encode,o=[],s={target:n};r||u("Signal update missing events specification."),pt(r)&&(r=function(t,e,n){return cS=e||hS,fS=n||pS,mS(t.trim()).map(vS)}(r,e.isSubscope()?"scope":"view")),r=W(r).filter(t=>t.signal||t.scale?(o.push(t),0):1),o.length>1&&(o=[xS(o)]),r.length&&o.push(r.length>1?{merge:r}:r[0]),null!=a&&(i&&u("Signal encode and update are mutually exclusive."),i="encode(item(),"+wt(a)+")"),s.update=pt(i)?eF(i,e):null!=i.expr?eF(i.expr,e):null!=i.value?i.value:null!=i.signal?{$expr:yS,$params:{$value:e.signalRef(i.signal)}}:u("Invalid signal update specification."),t.force&&(s.options={force:!0}),o.forEach((function(t){e.addUpdate(tt(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):aS(t,e)}}(t,e),s))}))}function xS(t){return{signal:"["+t.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}const bS=t=>(e,n,r)=>GF(t,n,e||void 0,r);var wS=bS("aggregate"),kS=bS("axisticks"),AS=bS("bound"),MS=bS("collect"),ES=bS("compare"),DS=bS("datajoin"),CS=bS("encode"),FS=bS("expression"),SS=bS("facet"),BS=bS("field"),TS=bS("key"),zS=bS("legendentries"),NS=bS("load"),OS=bS("mark"),RS=bS("multiextent"),qS=bS("multivalues"),US=bS("overlap"),LS=bS("params"),$S=bS("prefacet"),PS=bS("projection"),jS=bS("proxy"),IS=bS("relay"),WS=bS("render"),HS=bS("scale"),YS=bS("sieve"),VS=bS("sortitems"),GS=bS("viewlayout"),XS=bS("values"),JS=0,ZS={min:"min",max:"max",count:"sum"};function QS(t,e){var n,r=e.getScale(t.name).params;for(n in r.domain=nB(t.domain,t,e),null!=t.range&&(r.range=function t(e,n,r){var i=e.range,a=n.config.range;if(i.signal)return n.signalRef(i.signal);if(pt(i)){if(a&&it(a,i))return e=tt({},e,{range:a[i]}),t(e,n,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=fm(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:u("Unrecognized scale range value: "+wt(i))}else{if(i.scheme)return r.scheme=_(i.scheme)?tB(i.scheme,n):KS(i.scheme,n),i.extent&&(r.schemeExtent=tB(i.extent,n)),void(i.count&&(r.schemeCount=KS(i.count,n)));if(i.step)return void(r.rangeStep=KS(i.step,n));if(fm(e.type)&&!_(i))return nB(i,e,n);_(i)||u("Unsupported range type: "+wt(i))}return i.map(t=>(_(t)?tB:KS)(t,n))}(t,e,r)),null!=t.interpolate&&function(t,e){e.interpolate=KS(t.type||t),null!=t.gamma&&(e.interpolateGamma=KS(t.gamma))}(t.interpolate,r),null!=t.nice&&(r.nice=function(t){return x(t)?{interval:KS(t.interval),step:KS(t.step)}:KS(t)}(t.nice)),null!=t.bins&&(r.bins=function(t,e){return t.signal||_(t)?tB(t,e):e.objectProperty(t)}(t.bins,e)),t)it(r,n)||"name"===n||(r[n]=KS(t[n],e))}function KS(t,e){return x(t)?t.signal?e.signalRef(t.signal):u("Unsupported object: "+wt(t)):t}function tB(t,e){return t.signal?e.signalRef(t.signal):t.map(t=>KS(t,e))}function eB(t){u("Can not find data set: "+wt(t))}function nB(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(_(t)?rB:t.fields?aB:iB)(t,e,n);null==e.domainMin&&null==e.domainMax||u("No scale domain defined for domainMin/domainMax to override.")}function rB(t,e,n){return t.map((function(t){return KS(t,n)}))}function iB(t,e,n){var r=n.getData(t.data);return r||eB(t.data),fm(e.type)?r.valuesRef(n,t.field,uB(t.sort,!1)):gm(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)}function aB(t,e,n){var r=t.data,i=t.fields.reduce((function(t,e){return e=pt(e)?{data:r,field:e}:_(e)||e.signal?function(t,e){var n="_:vega:_"+JS++,r=MS({});if(_(t))r.value={$ingest:t};else if(t.signal){var i="setdata("+wt(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,YS({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t}),[]);return(fm(e.type)?oB:gm(e.type)?sB:lB)(t,n,i)}function oB(t,e,n){var r,i,a,o,u,s=uB(t.sort,!0);return r=n.map((function(t){var n=e.getData(t.data);return n||eB(t.data),n.countsRef(e,t.field,s)})),i={groupby:QF,pulse:r},s&&(a=s.op||"count",u=s.field?tS(a,s.field):"count",i.ops=[ZS[a]],i.fields=[e.fieldRef(u)],i.as=[u]),a=e.add(wS(i)),o=e.add(MS({pulse:JF(a)})),u=e.add(XS({field:QF,sort:e.sortRef(s),pulse:JF(o)})),JF(u)}function uB(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field&&t.op&&!ZS[t.op]&&u("Multiple domain scales can not be sorted using "+t.op):u("No field provided for sort aggregate op: "+t.op):x(t)?t.field="key":t={field:"key"}),t}function sB(t,e,n){var r=n.map((function(t){var n=e.getData(t.data);return n||eB(t.data),n.domainRef(e,t.field)}));return JF(e.add(qS({values:r})))}function lB(t,e,n){var r=n.map((function(t){var n=e.getData(t.data);return n||eB(t.data),n.extentRef(e,t.field)}));return JF(e.add(RS({extents:r})))}function cB(t,e,n){return _(t)?t.map((function(t){return cB(t,e,n)})):x(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:u("Unsupported parameter object: "+wt(t)):t}const fB="value",hB=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],dB={name:1,style:1,interactive:1},pB={value:0},gB={value:1};function mB(t){return t.type="group",t.interactive=t.interactive||!1,t}function vB(t,e){const n=(n,r)=>rS(t[n],rS(e[n],r));return n.isVertical=n=>"vertical"===rS(t.direction,e.direction||(n?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>rS(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>rS(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>rS(t.columns,rS(e.columns,+n.isVertical(!0))),n}function yB(t,e){var n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function _B(t,e,n){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${e} : ${n}`}const xB=_B(wt("left"),wt("right"),wt("center"));function bB(t,e){return e?t?x(t)?Object.assign({},t,{offset:bB(t.offset,e)}):{value:t,offset:e}:e:t}function wB(t,e){return e?(t.name=e.name,t.style=e.style||t.style,t.interactive=!!e.interactive,t.encode=zF(t.encode,e,dB)):t.interactive=!1,t}function kB(t,e,n,r){var i,a,o,u,s,l,c=vB(t,n),f=c.isVertical(),h=c.gradientThickness(),d=c.gradientLength();return f?(o=[0,1],u=[0,0],s=h,l=d):(o=[0,0],u=[1,0],s=d,l=h),TF(i={enter:a={opacity:pB,x:pB,y:pB,width:SF(s),height:SF(l)},update:tt({},a,{opacity:gB,fill:{gradient:e,start:o,stop:u}}),exit:{opacity:pB}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),wB({type:"rect",role:"legend-gradient",encode:i},r)}function AB(t,e,n,r,i){var a,o,u,s,l,c,f=vB(t,n),h=f.isVertical(),d=f.gradientThickness(),p=f.gradientLength(),g="";return h?(u="y",l="y2",s="x",c="width",g="1-"):(u="x",l="x2",s="y",c="height"),(o={opacity:pB,fill:{scale:e,field:fB}})[u]={signal:g+"datum.perc",mult:p},o[s]=pB,o[l]={signal:g+"datum.perc2",mult:p},o[c]=SF(d),TF(a={enter:o,update:tt({},o,{opacity:gB}),exit:{opacity:pB}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),wB({type:"rect",role:"legend-band",key:fB,from:i,encode:a},r)}function MB(t,e,n,r){var i,a,o,u,s,l=vB(t,e),c=l.isVertical(),f=SF(l.gradientThickness()),h=l.gradientLength(),d=l("labelOverlap"),p="";return TF(i={enter:a={opacity:pB},update:o={opacity:gB,text:{field:"label"}},exit:{opacity:pB}},{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:rS(t.labelLimit,e.gradientLabelLimit)}),c?(a.align={value:"left"},a.baseline=o.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},u="y",s="x",p="1-"):(a.align=o.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},a.baseline={value:"top"},u="x",s="y"),a[u]=o[u]={signal:p+"datum.perc",mult:h},a[s]=o[s]=f,f.offset=rS(t.labelOffset,e.gradientLabelOffset)||0,d=d?{separation:l("labelSeparation"),method:d,order:"datum.index"}:void 0,wB({type:"text",role:"legend-label",style:"guide-label",key:fB,from:r,encode:i,overlap:d},n)}function EB(t,e,n,r,i){var a,o,u,s,l,c,f,h=vB(t,e),d=n.entries,p=!(!d||!d.interactive),g=d?d.name:void 0,m=h("clipHeight"),v=h("symbolOffset"),y={data:"value"},_={},x=`(${i}) ? datum.offset : datum.size`,b=m?SF(m):{field:"size"},w="datum.index",k=`max(1, ${i})`;b.mult=.5,_={enter:a={opacity:pB,x:{signal:x,mult:.5,offset:v},y:b},update:o={opacity:gB,x:a.x,y:a.y},exit:{opacity:pB}};var A=null,M=null;return t.fill||(A=e.symbolBaseFillColor,M=e.symbolBaseStrokeColor),TF(_,{fill:h("symbolFillColor",A),shape:h("symbolType"),size:h("symbolSize"),stroke:h("symbolStrokeColor",M),strokeDash:h("symbolDash"),strokeDashOffset:h("symbolDashOffset"),strokeWidth:h("symbolStrokeWidth")},{opacity:h("symbolOpacity")}),hB.forEach((function(e){t[e]&&(o[e]=a[e]={scale:t[e],field:fB})})),s=wB({type:"symbol",role:"legend-symbol",key:fB,from:y,clip:!!m||void 0,encode:_},n.symbols),(u=SF(v)).offset=h("labelOffset"),TF(_={enter:a={opacity:pB,x:{signal:x,offset:u},y:b},update:o={opacity:gB,text:{field:"label"},x:a.x,y:a.y},exit:{opacity:pB}},{align:h("labelAlign"),baseline:h("labelBaseline"),fill:h("labelColor"),fillOpacity:h("labelOpacity"),font:h("labelFont"),fontSize:h("labelFontSize"),fontStyle:h("labelFontStyle"),fontWeight:h("labelFontWeight"),limit:h("labelLimit")}),l=wB({type:"text",role:"legend-label",style:"guide-label",key:fB,from:y,encode:_},n.labels),_={enter:{noBound:{value:!m},width:pB,height:m?SF(m):pB,opacity:pB},exit:{opacity:pB},update:o={opacity:gB,row:{signal:null},column:{signal:null}}},h.isVertical(!0)?(c=`ceil(item.mark.items.length / ${k})`,o.row.signal=`${w}%${c}`,o.column.signal=`floor(${w} / ${c})`,f={field:["row",w]}):(o.row.signal=`floor(${w} / ${k})`,o.column.signal=`${w} % ${k}`,f={field:w}),o.column.signal=`(${i})?${o.column.signal}:${w}`,mB({role:"scope",from:r={facet:{data:r,name:"value",groupby:"index"}},encode:zF(_,d,dB),marks:[s,l],name:g,interactive:p,sort:f})}const DB='item.orient === "left"',CB='item.orient === "right"',FB=`(${DB} || ${CB})`,SB="datum.vgrad && "+FB,BB=_B('"top"','"bottom"','"middle"'),TB=`datum.vgrad && ${CB} ? (${_B('"right"','"left"','"center"')}) : (${FB} && !(datum.vgrad && ${DB})) ? "left" : ${xB}`,zB=`item._anchor || (${FB} ? "middle" : "start")`,NB=`${SB} ? (${DB} ? -90 : 90) : 0`,OB=`${FB} ? (datum.vgrad ? (${CB} ? "bottom" : "top") : ${BB}) : "top"`;function RB(t,e){var n;return x(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+qB(t.path)+")":t.sphere&&(n="geoShape("+qB(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function qB(t){return x(t)&&t.signal?t.signal:wt(t)}function UB(t){var e=t.role||"";return e.indexOf("axis")&&e.indexOf("legend")&&e.indexOf("title")?"group"===t.type?"scope":e||"mark":e}function LB(t){return{marktype:t.type,name:t.name||void 0,role:t.role||UB(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function $B(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}function PB(t,e){var n=Qa(t.type);n||u("Unrecognized transform type: "+wt(t.type));var r=GF(n.type.toLowerCase(),null,jB(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r}function jB(t,e,n){var r,i,a,o={};for(i=0,a=t.params.length;it[e]?(y[e]=t[e],_=_||t[e]):0),_||u("Missing valid scale for legend."),o=function(t,e){var n=t.type||"symbol";t.type||1!==function(t){return hB.reduce((function(e,n){return e+(t[n]?1:0)}),0)}(t)||!t.fill&&!t.stroke||(n=cm(e)?"gradient":hm(e)?"discrete":"symbol");return"gradient"!==n?n:hm(e)?"discrete":"gradient"}(t,e.scaleType(_)),s={title:null!=t.title,scales:y,type:o,vgrad:"symbol"!==o&&v.isVertical()},l=JF(e.add(MS(null,[s]))),d=zF(function(t,e,n){var r={enter:{},update:{}};return TF(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:t("legendX"),y:t("legendY"),format:e.format,formatType:e.formatType}),r}(v,t,f),d,dB),n={enter:{x:{value:0},y:{value:0}}},c=JF(e.add(zS(i={type:o,scale:e.scaleRef(_),count:e.objectProperty(v("tickCount")),limit:e.property(v("symbolLimit")),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),"gradient"===o?(a=[kB(t,_,f,h.gradient),MB(t,f,h.labels,c)],i.count=i.count||e.signalRef(`max(2,2*floor((${iS(v.gradientLength())})/100))`)):"discrete"===o?a=[AB(t,_,f,h.gradient,c),MB(t,f,h.labels,c)]:(r=function(t,e){const n=vB(t,e);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(t,f),a=[EB(t,f,h,c,iS(r.columns))],i.size=function(t,e,n){var r=iS(iT("size",t,n)),i=iS(iT("strokeWidth",t,n)),a=iS(function(t,e,n){return yB("fontSize",t)||function(t,e,n){var r=e.config.style[n];return r&&r[t]}("fontSize",e,n)}(n[1].encode,e,"guide-label"));return eF(`max(ceil(sqrt(${r})+${i}),${a})`,e)}(t,e,a[0].marks)),a=[mB({role:"legend-entry",from:l,encode:n,marks:a,layout:r,interactive:g})],s.title&&a.push(function(t,e,n,r){var i,a=vB(t,e);return TF(i={enter:{opacity:pB},update:{opacity:gB,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:pB}},{orient:a("titleOrient"),_anchor:a("titleAnchor"),anchor:{signal:zB},angle:{signal:NB},align:{signal:TB},baseline:{signal:OB},text:t.title,fill:a("titleColor"),fillOpacity:a("titleOpacity"),font:a("titleFont"),fontSize:a("titleFontSize"),fontStyle:a("titleFontStyle"),fontWeight:a("titleFontWeight"),limit:a("titleLimit"),lineHeight:a("titleLineHeight")},{align:a("titleAlign"),baseline:a("titleBaseline")}),wB({type:"text",role:"legend-title",style:"guide-title",from:r,encode:i},n)}(t,f,h.title,l)),nT(mB({role:"legend",from:l,encode:d,marks:a,aria:v("aria"),description:v("description"),zindex:v("zindex"),name:p,interactive:g,style:m}),e)}function iT(t,e,n){return e[t]?`scale("${e[t]}",datum)`:yB(t,n[0].encode)}ZB.countsRef=function(t,e,n){var r,i,a,o=this.counts||(this.counts={}),u=QB(e);return null!=u&&(t=this.scope,r=o[u]),r?n&&n.field&&KB(t,r.agg.params,n):(a={groupby:t.fieldRef(e,"key"),pulse:JF(this.output)},n&&n.field&&KB(t,a,n),i=t.add(wS(a)),r=t.add(MS({pulse:JF(i)})),r={agg:i,ref:JF(r)},null!=u&&(o[u]=r)),r.ref},ZB.tuplesRef=function(){return JF(this.values)},ZB.extentRef=function(t,e){return tT(t,this,"extent","extent",e,!1)},ZB.domainRef=function(t,e){return tT(t,this,"domain","values",e,!1)},ZB.valuesRef=function(t,e,n){return tT(t,this,"vals","values",e,n||!0)},ZB.lookupRef=function(t,e){return tT(t,this,"lookup","tupleindex",e,!1)},ZB.indataRef=function(t,e){return tT(t,this,"indata","tupleindex",e,!0,!0)};function aT(t,e){var n,r,i=vB(t=pt(t)?{text:t}:t,e.config.title),a=t.encode||{},o=a.group||{},u=o.name||void 0,s=o.interactive,l=o.style,c=[];return n={},r=JF(e.add(MS(null,[n]))),c.push(function(t,e,n,r){var i={value:0},a=t.text,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return TF(o,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("color"),font:e("font"),fontSize:e("fontSize"),fontStyle:e("fontStyle"),fontWeight:e("fontWeight"),lineHeight:e("lineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),wB({type:"text",role:"title-text",style:"group-title",from:r,encode:o},n)}(t,i,function(t){const e=t.encode;return e&&e.title||tt({name:t.name,interactive:t.interactive,style:t.style},e)}(t),r)),t.subtitle&&c.push(function(t,e,n,r){var i={value:0},a=t.subtitle,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return TF(o,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("subtitleColor"),font:e("subtitleFont"),fontSize:e("subtitleFontSize"),fontStyle:e("subtitleFontStyle"),fontWeight:e("subtitleFontWeight"),lineHeight:e("subtitleLineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),wB({type:"text",role:"title-subtitle",style:"group-subtitle",from:r,encode:o},n)}(t,i,a.subtitle,r)),nT(mB({role:"title",from:r,encode:oT(i,o),marks:c,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:u,interactive:s,style:l}),e)}function oT(t,e){var n={enter:{},update:{}};return TF(n,{orient:t("orient"),anchor:t("anchor"),align:{signal:xB},angle:{signal:'item.orient==="left"?-90:item.orient==="right"?90:0'},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),zF(n,e,dB)}function uT(t,e){var n=[];t.transform&&t.transform.forEach((function(t){n.push(PB(t,e))})),t.on&&t.on.forEach((function(n){eT(n,e,t.name)})),e.addDataPipeline(t.name,function(t,e,n){var r,i,a,o,u,s=[],l=null,c=!1,f=!1;t.values?nS(t.values)||nS(t.format)?(s.push(lT(e,t)),s.push(l=sT())):s.push(l=sT({$ingest:t.values,$format:t.format})):t.url?nS(t.url)||nS(t.format)?(s.push(lT(e,t)),s.push(l=sT())):s.push(l=sT({$request:t.url,$format:t.format})):t.source&&(l=r=W(t.source).map((function(t){return JF(e.getData(t).output)})),s.push(null));for(i=0,a=n.length;i"bottom"===t||"top"===t,fT=(t,e,n)=>eS(t)?vT(t.signal,e,n):"left"===t||"top"===t?e:n,hT=(t,e,n)=>eS(t)?gT(t.signal,e,n):cT(t)?e:n,dT=(t,e,n)=>eS(t)?mT(t.signal,e,n):cT(t)?n:e,pT=(t,e,n)=>eS(t)?yT(t.signal,e,n):"top"===t?{value:e}:{value:n},gT=(t,e,n)=>xT(`${t} === 'top' || ${t} === 'bottom'`,e,n),mT=(t,e,n)=>xT(`${t} !== 'top' && ${t} !== 'bottom'`,e,n),vT=(t,e,n)=>wT(`${t} === 'left' || ${t} === 'top'`,e,n),yT=(t,e,n)=>wT(t+" === 'top'",e,n),_T=(t,e,n)=>wT(t+" === 'right'",e,n),xT=(t,e,n)=>(e=null!=e?SF(e):e,n=null!=n?SF(n):n,bT(e)&&bT(n)?{signal:`${t} ? (${e=e?e.signal||wt(e.value):null}) : (${n=n?n.signal||wt(n.value):null})`}:[tt({test:t},e)].concat(n||[])),bT=t=>null==t||1===Object.keys(t).length,wT=(t,e,n)=>({signal:`${t} ? (${AT(e)}) : (${AT(n)})`}),kT=(t,e,n,r,i)=>({signal:(null!=r?`${t} === 'left' ? (${AT(r)}) : `:"")+(null!=n?`${t} === 'bottom' ? (${AT(n)}) : `:"")+(null!=i?`${t} === 'right' ? (${AT(i)}) : `:"")+(null!=e?`${t} === 'top' ? (${AT(e)}) : `:"")+"(null)"}),AT=t=>eS(t)?t.signal:null==t?null:wt(t),MT=(t,e)=>{const n=t.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+e.signal}:t};function ET(t,e,n,r){let i;if(e&&it(e,t))return e[t];if(it(n,t))return n[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r["guide-title"][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r["guide-label"][i]}return null}function DT(t){const e={};for(const n of t)if(n)for(const t in n)e[t]=1;return Object.keys(e)}function CT(t,e){return{scale:t.scale,range:e}}function FT(t,e,n,r,i){var a,o,u,s,l,c,f,h,d=vB(t,e),p=t.orient,g=t.gridScale,m=fT(p,1,-1),v=function(t,e){if(1===e);else if(x(t)){let n=t=tt({},t);for(;null!=n.mult;){if(!x(n.mult))return n.mult=eS(e)?{signal:`(${n.mult}) * (${e.signal})`}:n.mult*e,t;n=n.mult=tt({},n.mult)}n.mult=e}else t=eS(e)?{signal:`(${e.signal}) * (${t||0})`}:e*(t||0);return t}(t.offset,m);return TF(a={enter:o={opacity:pB},update:s={opacity:gB},exit:u={opacity:pB}},{stroke:d("gridColor"),strokeCap:d("gridCap"),strokeDash:d("gridDash"),strokeDashOffset:d("gridDashOffset"),strokeOpacity:d("gridOpacity"),strokeWidth:d("gridWidth")}),l={scale:t.scale,field:fB,band:i.band,extra:i.extra,offset:i.offset,round:d("tickRound")},h=hT(p,{signal:"height"},{signal:"width"}),c=g?{scale:g,range:0,mult:m,offset:v}:{value:0,offset:v},f=g?{scale:g,range:1,mult:m,offset:v}:tt(h,{mult:m,offset:v}),o.x=s.x=hT(p,l,c),o.y=s.y=dT(p,l,c),o.x2=s.x2=dT(p,f),o.y2=s.y2=hT(p,f),u.x=hT(p,l),u.y=dT(p,l),wB({type:"rule",role:"axis-grid",key:fB,from:r,encode:a},n)}function ST(t,e,n,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+r+","+i+")"}}function BT(t,e,n,r,i,a){var o,u,s,l,c,f,h,d,p,g,m=vB(t,e),v=t.orient,y=t.scale,_=fT(v,-1,1),x=iS(m("labelFlush")),b=iS(m("labelFlushOffset")),w=0===x||!!x,k=m("labelAlign"),A=m("labelBaseline");return(l=SF(i)).mult=_,l.offset=SF(m("labelPadding")||0),l.offset.mult=_,c={scale:y,field:fB,band:.5,offset:bB(a.offset,m("labelOffset"))},f=hT(v,w?ST(y,x,'"left"','"right"','"center"'):{value:"center"},((t,e,n)=>eS(t)?_T(t.signal,e,n):"right"===t?{value:e}:{value:n})(v,"left","right")),h=hT(v,pT(v,"bottom","top"),w?ST(y,x,'"top"','"bottom"','"middle"'):{value:"middle"}),g=ST(y,x,`-(${b})`,b,0),w=w&&b,TF(o={enter:u={opacity:pB,x:hT(v,c,l),y:dT(v,c,l)},update:s={opacity:gB,text:{field:"label"},x:u.x,y:u.y,align:f,baseline:h},exit:{opacity:pB,x:u.x,y:u.y}},{dx:!k&&w?hT(v,g):null,dy:!A&&w?dT(v,g):null}),TF(o,{angle:m("labelAngle"),fill:m("labelColor"),fillOpacity:m("labelOpacity"),font:m("labelFont"),fontSize:m("labelFontSize"),fontWeight:m("labelFontWeight"),fontStyle:m("labelFontStyle"),limit:m("labelLimit"),lineHeight:m("labelLineHeight")},{align:k,baseline:A}),d=m("labelBound"),p=(p=m("labelOverlap"))||d?{separation:m("labelSeparation"),method:p,order:"datum.index",bound:d?{scale:y,orient:v,tolerance:d}:null}:void 0,s.align!==f&&(s.align=MT(s.align,f)),s.baseline!==h&&(s.baseline=MT(s.baseline,h)),wB({type:"text",role:"axis-label",style:"guide-label",key:fB,from:r,encode:o,overlap:p},n)}function TT(t,e,n,r){var i,a,o,u,s=vB(t,e),l=t.orient,c=fT(l,-1,1);return i={enter:a={opacity:pB,anchor:SF(s("titleAnchor",null)),align:{signal:xB}},update:o=tt({},a,{opacity:gB,text:SF(t.title)}),exit:{opacity:pB}},u={signal:`lerp(range("${t.scale}"), ${_B(0,1,.5)})`},o.x=hT(l,u),o.y=dT(l,u),a.angle=hT(l,pB,((t,e)=>0===e?0:eS(t)?{signal:`(${t.signal}) * ${e}`}:{value:t*e})(c,90)),a.baseline=hT(l,pT(l,"bottom","top"),{value:"bottom"}),o.angle=a.angle,o.baseline=a.baseline,TF(i,{fill:s("titleColor"),fillOpacity:s("titleOpacity"),font:s("titleFont"),fontSize:s("titleFontSize"),fontStyle:s("titleFontStyle"),fontWeight:s("titleFontWeight"),limit:s("titleLimit"),lineHeight:s("titleLineHeight")},{align:s("titleAlign"),angle:s("titleAngle"),baseline:s("titleBaseline")}),function(t,e,n,r){const i=(t,e)=>null!=t?(n.update[e]=MT(SF(t),n.update[e]),!1):!NF(e,r),a=i(t("titleX"),"x"),o=i(t("titleY"),"y");n.enter.auto=o===a?SF(o):hT(e,SF(o),SF(a))}(s,l,i,n),i.update.align=MT(i.update.align,a.align),i.update.angle=MT(i.update.angle,a.angle),i.update.baseline=MT(i.update.baseline,a.baseline),wB({type:"text",role:"axis-title",style:"guide-title",from:r,encode:i},n)}function zT(t,e){var n,r,i,a,o,u=function(t,e){var n,r,i,a=e.config,o=a.style,u=a.axis,s="band"===e.scaleType(t.scale)&&a.axisBand,l=t.orient;if(eS(l)){const t=DT([a.axisX,a.axisY]),e=DT([a.axisTop,a.axisBottom,a.axisLeft,a.axisRight]);for(i of(n={},t))n[i]=hT(l,ET(i,a.axisX,u,o),ET(i,a.axisY,u,o));for(i of(r={},e))r[i]=kT(l.signal,ET(i,a.axisTop,u,o),ET(i,a.axisBottom,u,o),ET(i,a.axisLeft,u,o),ET(i,a.axisRight,u,o))}else n="top"===l||"bottom"===l?a.axisX:a.axisY,r=a["axis"+l[0].toUpperCase()+l.slice(1)];return n||r||s?tt({},u,n,r,s):u}(t,e),s=t.encode||{},l=s.axis||{},c=l.name||void 0,f=l.interactive,h=l.style,d=vB(t,u),p=function(t){let e,n,r=t("tickBand"),i=t("tickOffset");return r?r.signal?(e={signal:`(${r.signal}) === 'extent' ? 1 : 0.5`},n={signal:`(${r.signal}) === 'extent'`},x(i)||(i={signal:`(${r.signal}) === 'extent' ? 0 : ${i}`})):"extent"===r?(e=1,n=!0,i=0):(e=.5,n=!1):(e=t("bandPosition"),n=t("tickExtra")),{extra:n,band:e,offset:i}}(d);return n={scale:t.scale,ticks:!!d("ticks"),labels:!!d("labels"),grid:!!d("grid"),domain:!!d("domain"),title:null!=t.title},r=JF(e.add(MS({},[n]))),l=zF(function(t,e){var n={enter:{},update:{}};return TF(n,{orient:t("orient"),offset:t("offset")||0,position:rS(e.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${e.scale}")))`},translate:t("translate"),format:e.format,formatType:e.formatType}),n}(d,t),l,dB),i=JF(e.add(kS({scale:e.scaleRef(t.scale),extra:e.property(p.extra),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),o=[],n.grid&&o.push(FT(t,u,s.grid,i,p)),n.ticks&&(a=d("tickSize"),o.push(function(t,e,n,r,i,a){var o,u,s,l,c,f,h=vB(t,e),d=t.orient,p=fT(d,-1,1);return TF(o={enter:u={opacity:pB},update:l={opacity:gB},exit:s={opacity:pB}},{stroke:h("tickColor"),strokeCap:h("tickCap"),strokeDash:h("tickDash"),strokeDashOffset:h("tickDashOffset"),strokeOpacity:h("tickOpacity"),strokeWidth:h("tickWidth")}),(c=SF(i)).mult=p,f={scale:t.scale,field:fB,band:a.band,extra:a.extra,offset:a.offset,round:h("tickRound")},l.y=u.y=hT(d,pB,f),l.y2=u.y2=hT(d,c),s.x=hT(d,f),l.x=u.x=dT(d,pB,f),l.x2=u.x2=dT(d,c),s.y=dT(d,f),wB({type:"rule",role:"axis-tick",key:fB,from:r,encode:o},n)}(t,u,s.ticks,i,a,p))),n.labels&&(a=n.ticks?a:0,o.push(BT(t,u,s.labels,i,a,p))),n.domain&&o.push(function(t,e,n,r){var i,a,o,u=vB(t,e),s=t.orient;TF(i={enter:a={opacity:pB},update:o={opacity:gB},exit:{opacity:pB}},{stroke:u("domainColor"),strokeCap:u("domainCap"),strokeDash:u("domainDash"),strokeDashOffset:u("domainDashOffset"),strokeWidth:u("domainWidth"),strokeOpacity:u("domainOpacity")});const l=CT(t,0),c=CT(t,1);return a.x=o.x=hT(s,l,pB),a.x2=o.x2=hT(s,c),a.y=o.y=dT(s,l,pB),a.y2=o.y2=dT(s,c),wB({type:"rule",role:"axis-domain",from:r,encode:i},n)}(t,u,s.domain,r)),n.title&&o.push(TT(t,u,s.title,r)),nT(mB({role:"axis",from:r,encode:l,marks:o,aria:d("aria"),description:d("description"),zindex:d("zindex"),name:c,interactive:f,style:h}),e)}function NT(t,e,n){var r=W(t.signals),i=W(t.scales);return n||r.forEach(t=>YF(t,e)),W(t.projections).forEach(t=>function(t,e){var n=e.config.projection||{},r={};for(var i in t)"name"!==i&&(r[i]=cB(t[i],i,e));for(i in n)null==r[i]&&(r[i]=cB(n[i],i,e));e.addProjection(t.name,r)}(t,e)),i.forEach(t=>function(t,e){var n=t.type||"linear";sm(n)||u("Unrecognized scale type: "+wt(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e)),W(t.data).forEach(t=>uT(t,e)),i.forEach(t=>QS(t,e)),(n||r).forEach(t=>function(t,e){var n=e.getSignal(t.name),r=t.update;t.init&&(r?u("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=eF(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach((function(t){_S(t,e,n.id)}))}(t,e)),W(t.axes).forEach(t=>zT(t,e)),W(t.marks).forEach(t=>nT(t,e)),W(t.legends).forEach(t=>rT(t,e)),t.title&&aT(t.title,e),e.parseLambdas(),e}function OT(t,e){const n=e.config,r=JF(e.root=e.add(XF())),i=function(t,e){const n=n=>rS(t[n],e[n]),r=[RT("background",n("background")),RT("autosize",DF(n("autosize"))),RT("padding",FF(n("padding"))),RT("width",n("width")||0),RT("height",n("height")||0)],i=r.reduce((t,e)=>(t[e.name]=e,t),{}),a={};return W(t.signals).forEach(t=>{it(i,t.name)?t=tt(i[t.name],t):r.push(t),a[t.name]=t}),W(e.signals).forEach(t=>{it(a,t.name)||it(i,t.name)||r.push(t)}),r}(t,n);i.forEach(t=>YF(t,e)),e.description=t.description||n.description,e.eventConfig=n.events,e.legends=e.objectProperty(n.legend&&n.legend.layout),e.locale=n.locale;const a=e.add(MS()),o=e.add(CS(PF((t=>zF({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t))(t.encode),"group","frame",t.style,e,{pulse:JF(a)}))),u=e.add(GS({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:r,pulse:JF(o)}));e.operators.pop(),e.pushState(JF(o),JF(u),null),NT(t,e,i),e.operators.push(u);let s=e.add(AS({mark:r,pulse:JF(u)}));return s=e.add(WS({pulse:JF(s)})),s=e.add(YS({pulse:JF(s)})),e.addData("root",new JB(e,a,a,s)),e}function RT(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function qT(t,e){this.config=t||{},this.options=e||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function UT(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}var LT=qT.prototype=UT.prototype;function $T(t){return(_(t)?PT:jT)(t)}function PT(t){for(var e,n="[",r=0,i=t.length;r0?",":"")+(x(e=t[r])?e.signal||$T(e):wt(e));return n+"]"}function jT(t){var e,n,r="{",i=0;for(e in t)n=t[e],r+=(++i>1?",":"")+wt(e)+":"+(x(n)?n.signal||$T(n):wt(n));return r+"}"}LT.parse=function(t){return NT(t,this)},LT.fork=function(){return new UT(this)},LT.isSubscope=function(){return this._subid>0},LT.toRuntime=function(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},LT.id=function(){return(this._subid?this._subid+":":0)+this._id++},LT.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((function(e){e.$ref=t.id})),t.refs=null),t},LT.proxy=function(t){var e=t instanceof VF?JF(t):t;return this.add(jS({value:e}))},LT.addStream=function(t){return this.streams.push(t),t.id=this.id(),t},LT.addUpdate=function(t){return this.updates.push(t),t},LT.finish=function(){var t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){var r;t&&((r=t.data||(t.data={}))[e]||(r[e]=[])).push(n)}for(t in this.data)for(var r in n((e=this.data[t]).input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values"),e.index)n(e.index[r],t,"index:"+r);return this},LT.pushState=function(t,e,n){this._encode.push(JF(this.add(YS({pulse:t})))),this._parent.push(e),this._lookup.push(n?JF(this.proxy(n)):null),this._markpath.push(-1)},LT.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},LT.parent=function(){return M(this._parent)},LT.encode=function(){return M(this._encode)},LT.lookup=function(){return M(this._lookup)},LT.markpath=function(){var t=this._markpath;return++t[t.length-1]},LT.fieldRef=function(t,e){if(pt(t))return ZF(t,e);t.signal||u("Unsupported field reference: "+wt(t));var n,r=t.signal,i=this.field[r];return i||(n={name:this.signalRef(r)},e&&(n.as=e),this.field[r]=i=JF(this.add(BS(n)))),i},LT.compareRef=function(t){function e(t){return eS(t)?(r=!0,n.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(r=!0,n.exprRef(t.expr)):t}var n=this,r=!1,i=W(t.field).map(e),a=W(t.order).map(e);return r?JF(this.add(ES({fields:i,orders:a}))):KF(i,a)},LT.keyRef=function(t,e){var n=this.signals,r=!1;return t=W(t).map((function(t){return eS(t)?(r=!0,JF(n[t.signal])):t})),r?JF(this.add(TS({fields:t,flat:e}))):function(t,e){var n={$key:t};return e&&(n.$flat=!0),n}(t,e)},LT.sortRef=function(t){if(!t)return t;var e=tS(t.op,t.field),n=t.order||"ascending";return n.signal?JF(this.add(ES({fields:e,orders:this.signalRef(n.signal)}))):KF(e,n)},LT.event=function(t,e){var n=t+":"+e;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},LT.hasOwnSignal=function(t){return it(this.signals,t)},LT.addSignal=function(t,e){this.hasOwnSignal(t)&&u("Duplicate signal name: "+wt(t));var n=e instanceof VF?e:this.add(XF(e));return this.signals[t]=n},LT.getSignal=function(t){return this.signals[t]||u("Unrecognized signal name: "+wt(t)),this.signals[t]},LT.signalRef=function(t){return this.signals[t]?JF(this.signals[t]):(it(this.lambdas,t)||(this.lambdas[t]=this.add(XF(null))),JF(this.lambdas[t]))},LT.parseLambdas=function(){for(var t=Object.keys(this.lambdas),e=0,n=t.length;e=r&&t=i?1:(e-r+1)/a},o.icdf=function(t){return t>=0&&t<=1?r-1+Math.floor(t*a):NaN},o.min(e).max(n)},t.randomKDE=Fo,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=No,t.randomMixture=Oo,t.randomNormal=Co,t.randomUniform=$o,t.read=Fa,t.regressionExp=Vo,t.regressionLinear=Ho,t.regressionLoess=Qo,t.regressionLog=Yo,t.regressionPoly=Jo,t.regressionPow=Go,t.regressionQuad=Xo,t.renderModule=wv,t.repeat=_t,t.resetDefaultLocale=function(){return Dn(),ka(),Ca()},t.resetSVGClipId=Rc,t.resetSVGDefIds=function(){Rc(),Bs=0},t.responseType=Le,t.runtimeContext=cF,t.sampleCurve=nu,t.sampleLogNormal=So,t.sampleNormal=Ao,t.sampleUniform=Ro,t.scale=um,t.sceneEqual=Fv,t.sceneFromJSON=Oh,t.scenePickVisit=Ef,t.sceneToJSON=Nh,t.sceneVisit=Mf,t.sceneZOrder=Af,t.scheme=Mm,t.setRandom=function(e){t.random=e},t.span=bt,t.splitAccessPath=s,t.stringValue=wt,t.textMetrics=fh,t.timeBin=Kr,t.timeFloor=Br,t.timeFormatLocale=Ma,t.timeInterval=qr,t.timeOffset=$r,t.timeSequence=Ir,t.timeUnitSpecifier=In,t.timeUnits=Pn,t.toBoolean=kt,t.toDate=Mt,t.toNumber=E,t.toSet=Dt,t.toString=Et,t.transform=Ka,t.transforms=Za,t.truncate=Ct,t.truthy=g,t.tupleid=Ot,t.typeParsers=fe,t.utcFloor=Nr,t.utcInterval=Ur,t.utcOffset=Pr,t.utcSequence=Wr,t.utcdayofyear=br,t.utcquarter=I,t.utcweek=wr,t.version="5.13.0",t.visitArray=Ft,t.week=mr,t.writeConfig=k,t.zero=d,t.zoomLinear=U,t.zoomLog=L,t.zoomPow=$,t.zoomSymlog=P,Object.defineProperty(t,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/node_modules/vega/index.d.ts b/node_modules/vega/index.d.ts deleted file mode 100644 index aa58dc1..0000000 --- a/node_modules/vega/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'vega' { - export * from 'vega-typings'; -} diff --git a/node_modules/vega/index.js b/node_modules/vega/index.js deleted file mode 100644 index f7e33c1..0000000 --- a/node_modules/vega/index.js +++ /dev/null @@ -1,86 +0,0 @@ -// -- Transforms ----- - -import {extend} from 'vega-util'; -import {transforms} from 'vega-dataflow'; -import * as tx from 'vega-transforms'; -import * as vtx from 'vega-view-transforms'; -import * as encode from 'vega-encode'; -import * as geo from 'vega-geo'; -import * as force from 'vega-force'; -import * as tree from 'vega-hierarchy'; -import * as reg from 'vega-regression'; -import * as voronoi from 'vega-voronoi'; -import * as wordcloud from 'vega-wordcloud'; -import * as xf from 'vega-crossfilter'; -extend(transforms, tx, vtx, encode, geo, force, tree, reg, voronoi, wordcloud, xf); - - -// -- Exports ----- - -export { - version -} from './package.json'; - -export * from 'vega-statistics'; - -export * from 'vega-time'; - -export * from 'vega-util'; - -export * from 'vega-loader'; - -export * from 'vega-scenegraph'; - -export { - Dataflow, - EventStream, - Parameters, - Pulse, - MultiPulse, - Operator, - Transform, - changeset, - ingest, - isTuple, - definition, - transform, - transforms, - tupleid -} from 'vega-dataflow'; - -export { - scale, - scheme, - interpolate, - interpolateColors, - interpolateRange, - quantizeInterpolator -} from 'vega-scale'; - -export { - projection -} from 'vega-projection'; - -export { - View -} from 'vega-view'; - -export { - numberFormatDefaultLocale as formatLocale, - timeFormatDefaultLocale as timeFormatLocale, - locale, - defaultLocale, - resetDefaultLocale -} from 'vega-format'; - -export { - expressionFunction -} from 'vega-functions'; - -export { - parse -} from 'vega-parser'; - -export { - context as runtimeContext -} from 'vega-runtime'; diff --git a/node_modules/vega/package.json b/node_modules/vega/package.json deleted file mode 100644 index 1a711be..0000000 --- a/node_modules/vega/package.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "_from": "vega@5.13.0", - "_id": "vega@5.13.0", - "_inBundle": false, - "_integrity": "sha512-3X6ptCqQrfYg1xdy6rCkywKXOiIQIIJBFESV5JJOXaqm1ye9LRD3NOmZukqenLJXlg6aaPbP6kFFqpjBzmAefg==", - "_location": "/vega", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "vega@5.13.0", - "name": "vega", - "escapedName": "vega", - "rawSpec": "5.13.0", - "saveSpec": null, - "fetchSpec": "5.13.0" - }, - "_requiredBy": [ - "/vega-cli" - ], - "_resolved": "https://registry.npmjs.org/vega/-/vega-5.13.0.tgz", - "_shasum": "12253667d203e8f82fe317014084c55b479057ee", - "_spec": "vega@5.13.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-cli", - "author": { - "name": "UW Interactive Data Lab", - "url": "http://idl.cs.washington.edu" - }, - "bugs": { - "url": "https://github.com/vega/vega/issues" - }, - "bundleDependencies": false, - "dependencies": { - "vega-crossfilter": "~4.0.2", - "vega-dataflow": "~5.7.0", - "vega-encode": "~4.8.0", - "vega-event-selector": "~2.0.3", - "vega-expression": "~2.6.5", - "vega-force": "~4.0.4", - "vega-format": "~1.0.1", - "vega-functions": "~5.7.1", - "vega-geo": "~4.3.4", - "vega-hierarchy": "~4.0.6", - "vega-loader": "~4.3.0", - "vega-parser": "~6.0.2", - "vega-projection": "~1.4.2", - "vega-regression": "~1.0.6", - "vega-runtime": "~6.1.0", - "vega-scale": "~7.0.0", - "vega-scenegraph": "~4.8.3", - "vega-statistics": "~1.7.6", - "vega-time": "~2.0.1", - "vega-transforms": "~4.9.0", - "vega-typings": "~0.18.0", - "vega-util": "~1.14.1", - "vega-view": "~5.8.0", - "vega-view-transforms": "~4.5.5", - "vega-voronoi": "~4.1.2", - "vega-wordcloud": "~4.1.0" - }, - "deprecated": false, - "description": "The Vega visualization grammar.", - "devDependencies": { - "vega-schema": "*" - }, - "gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137", - "homepage": "https://github.com/vega/vega#readme", - "jsdelivr": "build/vega.min.js", - "keywords": [ - "vega", - "visualization", - "interaction", - "dataflow", - "library", - "data", - "d3" - ], - "license": "BSD-3-Clause", - "main": "build/vega-node.js", - "module": "index", - "name": "vega", - "repository": { - "type": "git", - "url": "git+https://github.com/vega/vega.git" - }, - "scripts": { - "build": "yarn rollup && node rollup -e && node rollup -m && babel build --out-dir build-es5 --config-file ../../babel.config.js", - "postbuild": "terser build/vega.js -c -m -o build/vega.min.js && terser build/vega-core.js -c -m -o build/vega-core.min.js && terser build-es5/vega.js -c -m -o build-es5/vega.min.js && terser build-es5/vega-core.js -c -m -o build-es5/vega-core.min.js", - "postpublish": "git push && git push --tags && ./schema-deploy.sh", - "prebuild": "rimraf build && mkdirp build", - "prepublishOnly": "yarn test && yarn build", - "pretest": "yarn prebuild && yarn rollup", - "rollup": "node rollup-node && node rollup && node schema-copy", - "test": "TZ=America/Los_Angeles tape 'test/**/*-test.js'" - }, - "types": "index.d.ts", - "unpkg": "build/vega.min.js", - "version": "5.13.0" -} diff --git a/node_modules/which-module/CHANGELOG.md b/node_modules/which-module/CHANGELOG.md deleted file mode 100644 index 863d469..0000000 --- a/node_modules/which-module/CHANGELOG.md +++ /dev/null @@ -1,26 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - - -# [2.0.0](https://github.com/nexdrew/which-module/compare/v1.0.0...v2.0.0) (2017-05-01) - - -### Features - -* remove Node < 4 from official testing/support ([#22](https://github.com/nexdrew/which-module/issues/22)) ([ee7aff4](https://github.com/nexdrew/which-module/commit/ee7aff4)) - - -### BREAKING CHANGES - -* Node 0.10 or 0.12 no longer supported, please update to Node 4+ or use which-module@1.0.0 - - - - -# 1.0.0 (2016-06-06) - - -### Features - -* initial code ([08074cd](https://github.com/nexdrew/which-module/commit/08074cd)) diff --git a/node_modules/which-module/LICENSE b/node_modules/which-module/LICENSE deleted file mode 100644 index ab601b6..0000000 --- a/node_modules/which-module/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2016, Contributors - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. diff --git a/node_modules/which-module/README.md b/node_modules/which-module/README.md deleted file mode 100644 index a8c4bf8..0000000 --- a/node_modules/which-module/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# which-module - -> Find the module object for something that was require()d - -[![Build Status](https://travis-ci.org/nexdrew/which-module.svg?branch=master)](https://travis-ci.org/nexdrew/which-module) -[![Coverage Status](https://coveralls.io/repos/github/nexdrew/which-module/badge.svg?branch=master)](https://coveralls.io/github/nexdrew/which-module?branch=master) -[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) - -Find the `module` object in `require.cache` for something that was `require()`d -or `import`ed - essentially a reverse `require()` lookup. - -Useful for libs that want to e.g. lookup a filename for a module or submodule -that it did not `require()` itself. - -## Install and Usage - -``` -npm install --save which-module -``` - -```js -const whichModule = require('which-module') - -console.log(whichModule(require('something'))) -// Module { -// id: '/path/to/project/node_modules/something/index.js', -// exports: [Function], -// parent: ..., -// filename: '/path/to/project/node_modules/something/index.js', -// loaded: true, -// children: [], -// paths: [ '/path/to/project/node_modules/something/node_modules', -// '/path/to/project/node_modules', -// '/path/to/node_modules', -// '/path/node_modules', -// '/node_modules' ] } -``` - -## API - -### `whichModule(exported)` - -Return the [`module` object](https://nodejs.org/api/modules.html#modules_the_module_object), -if any, that represents the given argument in the `require.cache`. - -`exported` can be anything that was previously `require()`d or `import`ed as a -module, submodule, or dependency - which means `exported` is identical to the -`module.exports` returned by this method. - -If `exported` did not come from the `exports` of a `module` in `require.cache`, -then this method returns `null`. - -## License - -ISC © Contributors diff --git a/node_modules/which-module/index.js b/node_modules/which-module/index.js deleted file mode 100644 index 45559b7..0000000 --- a/node_modules/which-module/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict' - -module.exports = function whichModule (exported) { - for (var i = 0, files = Object.keys(require.cache), mod; i < files.length; i++) { - mod = require.cache[files[i]] - if (mod.exports === exported) return mod - } - return null -} diff --git a/node_modules/which-module/package.json b/node_modules/which-module/package.json deleted file mode 100644 index 4de878b..0000000 --- a/node_modules/which-module/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "_from": "which-module@^2.0.0", - "_id": "which-module@2.0.0", - "_inBundle": false, - "_integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "_location": "/which-module", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "which-module@^2.0.0", - "name": "which-module", - "escapedName": "which-module", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "_shasum": "d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a", - "_spec": "which-module@^2.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "nexdrew" - }, - "bugs": { - "url": "https://github.com/nexdrew/which-module/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Find the module object for something that was require()d", - "devDependencies": { - "ava": "^0.19.1", - "coveralls": "^2.13.1", - "nyc": "^10.3.0", - "standard": "^10.0.2", - "standard-version": "^4.0.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/nexdrew/which-module#readme", - "keywords": [ - "which", - "module", - "exports", - "filename", - "require", - "reverse", - "lookup" - ], - "license": "ISC", - "main": "index.js", - "name": "which-module", - "repository": { - "type": "git", - "url": "git+https://github.com/nexdrew/which-module.git" - }, - "scripts": { - "coverage": "nyc report --reporter=text-lcov | coveralls", - "pretest": "standard", - "release": "standard-version", - "test": "nyc ava" - }, - "version": "2.0.0" -} diff --git a/node_modules/wide-align/LICENSE b/node_modules/wide-align/LICENSE deleted file mode 100644 index f4be44d..0000000 --- a/node_modules/wide-align/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2015, Rebecca Turner - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - diff --git a/node_modules/wide-align/README.md b/node_modules/wide-align/README.md deleted file mode 100644 index 32f1be0..0000000 --- a/node_modules/wide-align/README.md +++ /dev/null @@ -1,47 +0,0 @@ -wide-align ----------- - -A wide-character aware text alignment function for use in terminals / on the -console. - -### Usage - -``` -var align = require('wide-align') - -// Note that if you view this on a unicode console, all of the slashes are -// aligned. This is because on a console, all narrow characters are -// an en wide and all wide characters are an em. In browsers, this isn't -// held to and wide characters like "古" can be less than two narrow -// characters even with a fixed width font. - -console.log(align.center('abc', 10)) // ' abc ' -console.log(align.center('古古古', 10)) // ' 古古古 ' -console.log(align.left('abc', 10)) // 'abc ' -console.log(align.left('古古古', 10)) // '古古古 ' -console.log(align.right('abc', 10)) // ' abc' -console.log(align.right('古古古', 10)) // ' 古古古' -``` - -### Functions - -#### `align.center(str, length)` → `str` - -Returns *str* with spaces added to both sides such that that it is *length* -chars long and centered in the spaces. - -#### `align.left(str, length)` → `str` - -Returns *str* with spaces to the right such that it is *length* chars long. - -### `align.right(str, length)` → `str` - -Returns *str* with spaces to the left such that it is *length* chars long. - -### Origins - -These functions were originally taken from -[cliui](https://npmjs.com/package/cliui). Changes include switching to the -MUCH faster pad generation function from -[lodash](https://npmjs.com/package/lodash), making center alignment pad -both sides and adding left alignment. diff --git a/node_modules/wide-align/align.js b/node_modules/wide-align/align.js deleted file mode 100644 index 4f94ca4..0000000 --- a/node_modules/wide-align/align.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict' -var stringWidth = require('string-width') - -exports.center = alignCenter -exports.left = alignLeft -exports.right = alignRight - -// lodash's way of generating pad characters. - -function createPadding (width) { - var result = '' - var string = ' ' - var n = width - do { - if (n % 2) { - result += string; - } - n = Math.floor(n / 2); - string += string; - } while (n); - - return result; -} - -function alignLeft (str, width) { - var trimmed = str.trimRight() - if (trimmed.length === 0 && str.length >= width) return str - var padding = '' - var strWidth = stringWidth(trimmed) - - if (strWidth < width) { - padding = createPadding(width - strWidth) - } - - return trimmed + padding -} - -function alignRight (str, width) { - var trimmed = str.trimLeft() - if (trimmed.length === 0 && str.length >= width) return str - var padding = '' - var strWidth = stringWidth(trimmed) - - if (strWidth < width) { - padding = createPadding(width - strWidth) - } - - return padding + trimmed -} - -function alignCenter (str, width) { - var trimmed = str.trim() - if (trimmed.length === 0 && str.length >= width) return str - var padLeft = '' - var padRight = '' - var strWidth = stringWidth(trimmed) - - if (strWidth < width) { - var padLeftBy = parseInt((width - strWidth) / 2, 10) - padLeft = createPadding(padLeftBy) - padRight = createPadding(width - (strWidth + padLeftBy)) - } - - return padLeft + trimmed + padRight -} diff --git a/node_modules/wide-align/package.json b/node_modules/wide-align/package.json deleted file mode 100644 index e0a99be..0000000 --- a/node_modules/wide-align/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "_from": "wide-align@^1.1.0", - "_id": "wide-align@1.1.3", - "_inBundle": false, - "_integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "_location": "/wide-align", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "wide-align@^1.1.0", - "name": "wide-align", - "escapedName": "wide-align", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/gauge" - ], - "_resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "_shasum": "ae074e6bdc0c14a431e804e624549c633b000457", - "_spec": "wide-align@^1.1.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/gauge", - "author": { - "name": "Rebecca Turner", - "email": "me@re-becca.org", - "url": "http://re-becca.org/" - }, - "bugs": { - "url": "https://github.com/iarna/wide-align/issues" - }, - "bundleDependencies": false, - "dependencies": { - "string-width": "^1.0.2 || 2" - }, - "deprecated": false, - "description": "A wide-character aware text alignment function for use on the console or with fixed width fonts.", - "devDependencies": { - "tap": "10 || 11 || 12" - }, - "files": [ - "align.js" - ], - "homepage": "https://github.com/iarna/wide-align#readme", - "keywords": [ - "wide", - "double", - "unicode", - "cjkv", - "pad", - "align" - ], - "license": "ISC", - "main": "align.js", - "name": "wide-align", - "repository": { - "type": "git", - "url": "git+https://github.com/iarna/wide-align.git" - }, - "scripts": { - "test": "tap --coverage test/*.js", - "version": "perl -pi -e 's/^( \"version\": $ENV{npm_config_node_version}\").*?\",/$1abc\",/' package-lock.json ; git add package-lock.json" - }, - "version": "1.1.3" -} diff --git a/node_modules/wrap-ansi/index.js b/node_modules/wrap-ansi/index.js deleted file mode 100755 index a6e5443..0000000 --- a/node_modules/wrap-ansi/index.js +++ /dev/null @@ -1,186 +0,0 @@ -'use strict'; -const stringWidth = require('string-width'); -const stripAnsi = require('strip-ansi'); -const ansiStyles = require('ansi-styles'); - -const ESCAPES = new Set([ - '\u001B', - '\u009B' -]); - -const END_CODE = 39; - -const wrapAnsi = code => `${ESCAPES.values().next().value}[${code}m`; - -// Calculate the length of words split on ' ', ignoring -// the extra characters added by ansi escape codes -const wordLengths = string => string.split(' ').map(character => stringWidth(character)); - -// Wrap a long word across multiple rows -// Ansi escape codes do not count towards length -const wrapWord = (rows, word, columns) => { - const characters = [...word]; - - let isInsideEscape = false; - let visible = stringWidth(stripAnsi(rows[rows.length - 1])); - - for (const [index, character] of characters.entries()) { - const characterLength = stringWidth(character); - - if (visible + characterLength <= columns) { - rows[rows.length - 1] += character; - } else { - rows.push(character); - visible = 0; - } - - if (ESCAPES.has(character)) { - isInsideEscape = true; - } else if (isInsideEscape && character === 'm') { - isInsideEscape = false; - continue; - } - - if (isInsideEscape) { - continue; - } - - visible += characterLength; - - if (visible === columns && index < characters.length - 1) { - rows.push(''); - visible = 0; - } - } - - // It's possible that the last row we copy over is only - // ansi escape characters, handle this edge-case - if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) { - rows[rows.length - 2] += rows.pop(); - } -}; - -// Trims spaces from a string ignoring invisible sequences -const stringVisibleTrimSpacesRight = str => { - const words = str.split(' '); - let last = words.length; - - while (last > 0) { - if (stringWidth(words[last - 1]) > 0) { - break; - } - - last--; - } - - if (last === words.length) { - return str; - } - - return words.slice(0, last).join(' ') + words.slice(last).join(''); -}; - -// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode -// -// 'hard' will never allow a string to take up more than columns characters -// -// 'soft' allows long words to expand past the column length -const exec = (string, columns, options = {}) => { - if (options.trim !== false && string.trim() === '') { - return ''; - } - - let pre = ''; - let ret = ''; - let escapeCode; - - const lengths = wordLengths(string); - let rows = ['']; - - for (const [index, word] of string.split(' ').entries()) { - if (options.trim !== false) { - rows[rows.length - 1] = rows[rows.length - 1].trimLeft(); - } - - let rowLength = stringWidth(rows[rows.length - 1]); - - if (index !== 0) { - if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) { - // If we start with a new word but the current row length equals the length of the columns, add a new row - rows.push(''); - rowLength = 0; - } - - if (rowLength > 0 || options.trim === false) { - rows[rows.length - 1] += ' '; - rowLength++; - } - } - - // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns' - if (options.hard && lengths[index] > columns) { - const remainingColumns = (columns - rowLength); - const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns); - const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns); - if (breaksStartingNextLine < breaksStartingThisLine) { - rows.push(''); - } - - wrapWord(rows, word, columns); - continue; - } - - if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) { - if (options.wordWrap === false && rowLength < columns) { - wrapWord(rows, word, columns); - continue; - } - - rows.push(''); - } - - if (rowLength + lengths[index] > columns && options.wordWrap === false) { - wrapWord(rows, word, columns); - continue; - } - - rows[rows.length - 1] += word; - } - - if (options.trim !== false) { - rows = rows.map(stringVisibleTrimSpacesRight); - } - - pre = rows.join('\n'); - - for (const [index, character] of [...pre].entries()) { - ret += character; - - if (ESCAPES.has(character)) { - const code = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4))); - escapeCode = code === END_CODE ? null : code; - } - - const code = ansiStyles.codes.get(Number(escapeCode)); - - if (escapeCode && code) { - if (pre[index + 1] === '\n') { - ret += wrapAnsi(code); - } else if (character === '\n') { - ret += wrapAnsi(escapeCode); - } - } - } - - return ret; -}; - -// For each newline, invoke the method separately -module.exports = (string, columns, options) => { - return String(string) - .normalize() - .replace(/\r\n/g, '\n') - .split('\n') - .map(line => exec(line, columns, options)) - .join('\n'); -}; diff --git a/node_modules/wrap-ansi/license b/node_modules/wrap-ansi/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/wrap-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/wrap-ansi/node_modules/ansi-regex/index.d.ts b/node_modules/wrap-ansi/node_modules/ansi-regex/index.d.ts deleted file mode 100644 index 2dbf6af..0000000 --- a/node_modules/wrap-ansi/node_modules/ansi-regex/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare namespace ansiRegex { - interface Options { - /** - Match only the first ANSI escape. - - @default false - */ - onlyFirst: boolean; - } -} - -/** -Regular expression for matching ANSI escape codes. - -@example -``` -import ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` -*/ -declare function ansiRegex(options?: ansiRegex.Options): RegExp; - -export = ansiRegex; diff --git a/node_modules/wrap-ansi/node_modules/ansi-regex/index.js b/node_modules/wrap-ansi/node_modules/ansi-regex/index.js deleted file mode 100644 index 35054aa..0000000 --- a/node_modules/wrap-ansi/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = ({onlyFirst = false} = {}) => { - const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' - ].join('|'); - - return new RegExp(pattern, onlyFirst ? undefined : 'g'); -}; diff --git a/node_modules/wrap-ansi/node_modules/ansi-regex/license b/node_modules/wrap-ansi/node_modules/ansi-regex/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/wrap-ansi/node_modules/ansi-regex/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/wrap-ansi/node_modules/ansi-regex/package.json b/node_modules/wrap-ansi/node_modules/ansi-regex/package.json deleted file mode 100644 index eb01a32..0000000 --- a/node_modules/wrap-ansi/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "_from": "ansi-regex@^5.0.0", - "_id": "ansi-regex@5.0.0", - "_inBundle": false, - "_integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "_location": "/wrap-ansi/ansi-regex", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ansi-regex@^5.0.0", - "name": "ansi-regex", - "escapedName": "ansi-regex", - "rawSpec": "^5.0.0", - "saveSpec": null, - "fetchSpec": "^5.0.0" - }, - "_requiredBy": [ - "/wrap-ansi/strip-ansi" - ], - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "_shasum": "388539f55179bf39339c81af30a654d69f87cb75", - "_spec": "ansi-regex@^5.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/wrap-ansi/node_modules/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/ansi-regex/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Regular expression for matching ANSI escape codes", - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.9.0", - "xo": "^0.25.3" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/chalk/ansi-regex#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "license": "MIT", - "name": "ansi-regex", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/ansi-regex.git" - }, - "scripts": { - "test": "xo && ava && tsd", - "view-supported": "node fixtures/view-codes.js" - }, - "version": "5.0.0" -} diff --git a/node_modules/wrap-ansi/node_modules/ansi-regex/readme.md b/node_modules/wrap-ansi/node_modules/ansi-regex/readme.md deleted file mode 100644 index 3c2b77c..0000000 --- a/node_modules/wrap-ansi/node_modules/ansi-regex/readme.md +++ /dev/null @@ -1,78 +0,0 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) - -> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install ansi-regex -``` - - -## Usage - -```js -const ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` - - -## API - -### ansiRegex(options?) - -Returns a regex for matching ANSI escape codes. - -#### options - -Type: `object` - -##### onlyFirst - -Type: `boolean`
-Default: `false` *(Matches any ANSI escape codes in a string)* - -Match only the first ANSI escape. - - -## FAQ - -### Why do you test for codes not in the ECMA 48 standard? - -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. - -On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/index.d.ts b/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/index.d.ts deleted file mode 100644 index 729d202..0000000 --- a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms). - -@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - -@example -``` -import isFullwidthCodePoint from 'is-fullwidth-code-point'; - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` -*/ -export default function isFullwidthCodePoint(codePoint: number): boolean; diff --git a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/index.js b/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/index.js deleted file mode 100644 index 671f97f..0000000 --- a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable yoda */ -'use strict'; - -const isFullwidthCodePoint = codePoint => { - if (Number.isNaN(codePoint)) { - return false; - } - - // Code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - codePoint >= 0x1100 && ( - codePoint <= 0x115F || // Hangul Jamo - codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET - codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= codePoint && codePoint <= 0x4DBF) || - // CJK Unified Ideographs .. Yi Radicals - (0x4E00 <= codePoint && codePoint <= 0xA4C6) || - // Hangul Jamo Extended-A - (0xA960 <= codePoint && codePoint <= 0xA97C) || - // Hangul Syllables - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - // CJK Compatibility Ideographs - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - // Vertical Forms - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - // CJK Compatibility Forms .. Small Form Variants - (0xFE30 <= codePoint && codePoint <= 0xFE6B) || - // Halfwidth and Fullwidth Forms - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || - // Kana Supplement - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - // Enclosed Ideographic Supplement - (0x1F200 <= codePoint && codePoint <= 0x1F251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= codePoint && codePoint <= 0x3FFFD) - ) - ) { - return true; - } - - return false; -}; - -module.exports = isFullwidthCodePoint; -module.exports.default = isFullwidthCodePoint; diff --git a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/license b/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/package.json b/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/package.json deleted file mode 100644 index 09eff03..0000000 --- a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "is-fullwidth-code-point@^3.0.0", - "_id": "is-fullwidth-code-point@3.0.0", - "_inBundle": false, - "_integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "_location": "/wrap-ansi/is-fullwidth-code-point", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "is-fullwidth-code-point@^3.0.0", - "name": "is-fullwidth-code-point", - "escapedName": "is-fullwidth-code-point", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/wrap-ansi/string-width" - ], - "_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "_shasum": "f116f8064fe90b3f7844a38997c0b75051269f1d", - "_spec": "is-fullwidth-code-point@^3.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/wrap-ansi/node_modules/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Check if the character represented by a given Unicode code point is fullwidth", - "devDependencies": { - "ava": "^1.3.1", - "tsd-check": "^0.5.0", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme", - "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", - "string", - "codepoint", - "code", - "point", - "is", - "detect", - "check" - ], - "license": "MIT", - "name": "is-fullwidth-code-point", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git" - }, - "scripts": { - "test": "xo && ava && tsd-check" - }, - "version": "3.0.0" -} diff --git a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/readme.md b/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/readme.md deleted file mode 100644 index 4236bba..0000000 --- a/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) - -> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) - - -## Install - -``` -$ npm install is-fullwidth-code-point -``` - - -## Usage - -```js -const isFullwidthCodePoint = require('is-fullwidth-code-point'); - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` - - -## API - -### isFullwidthCodePoint(codePoint) - -#### codePoint - -Type: `number` - -The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/wrap-ansi/node_modules/string-width/index.d.ts b/node_modules/wrap-ansi/node_modules/string-width/index.d.ts deleted file mode 100644 index 12b5309..0000000 --- a/node_modules/wrap-ansi/node_modules/string-width/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare const stringWidth: { - /** - Get the visual width of a string - the number of columns required to display it. - - Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - - @example - ``` - import stringWidth = require('string-width'); - - stringWidth('a'); - //=> 1 - - stringWidth('古'); - //=> 2 - - stringWidth('\u001B[1m古\u001B[22m'); - //=> 2 - ``` - */ - (string: string): number; - - // TODO: remove this in the next major version, refactor the whole definition to: - // declare function stringWidth(string: string): number; - // export = stringWidth; - default: typeof stringWidth; -} - -export = stringWidth; diff --git a/node_modules/wrap-ansi/node_modules/string-width/index.js b/node_modules/wrap-ansi/node_modules/string-width/index.js deleted file mode 100644 index a348067..0000000 --- a/node_modules/wrap-ansi/node_modules/string-width/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; -const stripAnsi = require('strip-ansi'); -const isFullwidthCodePoint = require('is-fullwidth-code-point'); -const emojiRegex = require('emoji-regex'); - -const stringWidth = string => { - string = string.replace(emojiRegex(), ' '); - - if (typeof string !== 'string' || string.length === 0) { - return 0; - } - - string = stripAnsi(string); - - let width = 0; - - for (let i = 0; i < string.length; i++) { - const code = string.codePointAt(i); - - // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { - continue; - } - - // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { - continue; - } - - // Surrogates - if (code > 0xFFFF) { - i++; - } - - width += isFullwidthCodePoint(code) ? 2 : 1; - } - - return width; -}; - -module.exports = stringWidth; -// TODO: remove this in the next major version -module.exports.default = stringWidth; diff --git a/node_modules/wrap-ansi/node_modules/string-width/license b/node_modules/wrap-ansi/node_modules/string-width/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/wrap-ansi/node_modules/string-width/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/wrap-ansi/node_modules/string-width/package.json b/node_modules/wrap-ansi/node_modules/string-width/package.json deleted file mode 100644 index fabadf6..0000000 --- a/node_modules/wrap-ansi/node_modules/string-width/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_from": "string-width@^4.1.0", - "_id": "string-width@4.2.0", - "_inBundle": false, - "_integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "_location": "/wrap-ansi/string-width", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "string-width@^4.1.0", - "name": "string-width", - "escapedName": "string-width", - "rawSpec": "^4.1.0", - "saveSpec": null, - "fetchSpec": "^4.1.0" - }, - "_requiredBy": [ - "/wrap-ansi" - ], - "_resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "_shasum": "952182c46cc7b2c313d1596e623992bd163b72b5", - "_spec": "string-width@^4.1.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/wrap-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/string-width/issues" - }, - "bundleDependencies": false, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "deprecated": false, - "description": "Get the visual width of a string - the number of columns required to display it", - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/string-width#readme", - "keywords": [ - "string", - "character", - "unicode", - "width", - "visual", - "column", - "columns", - "fullwidth", - "full-width", - "full", - "ansi", - "escape", - "codes", - "cli", - "command-line", - "terminal", - "console", - "cjk", - "chinese", - "japanese", - "korean", - "fixed-width" - ], - "license": "MIT", - "name": "string-width", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/string-width.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "4.2.0" -} diff --git a/node_modules/wrap-ansi/node_modules/string-width/readme.md b/node_modules/wrap-ansi/node_modules/string-width/readme.md deleted file mode 100644 index 705f206..0000000 --- a/node_modules/wrap-ansi/node_modules/string-width/readme.md +++ /dev/null @@ -1,50 +0,0 @@ -# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width) - -> Get the visual width of a string - the number of columns required to display it - -Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - -Useful to be able to measure the actual width of command-line output. - - -## Install - -``` -$ npm install string-width -``` - - -## Usage - -```js -const stringWidth = require('string-width'); - -stringWidth('a'); -//=> 1 - -stringWidth('古'); -//=> 2 - -stringWidth('\u001B[1m古\u001B[22m'); -//=> 2 -``` - - -## Related - -- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module -- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string -- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/wrap-ansi/node_modules/strip-ansi/index.d.ts b/node_modules/wrap-ansi/node_modules/strip-ansi/index.d.ts deleted file mode 100644 index 907fccc..0000000 --- a/node_modules/wrap-ansi/node_modules/strip-ansi/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. - -@example -``` -import stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` -*/ -declare function stripAnsi(string: string): string; - -export = stripAnsi; diff --git a/node_modules/wrap-ansi/node_modules/strip-ansi/index.js b/node_modules/wrap-ansi/node_modules/strip-ansi/index.js deleted file mode 100644 index 9a593df..0000000 --- a/node_modules/wrap-ansi/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -const ansiRegex = require('ansi-regex'); - -module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/node_modules/wrap-ansi/node_modules/strip-ansi/license b/node_modules/wrap-ansi/node_modules/strip-ansi/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/wrap-ansi/node_modules/strip-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/wrap-ansi/node_modules/strip-ansi/package.json b/node_modules/wrap-ansi/node_modules/strip-ansi/package.json deleted file mode 100644 index 16aa653..0000000 --- a/node_modules/wrap-ansi/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "_from": "strip-ansi@^6.0.0", - "_id": "strip-ansi@6.0.0", - "_inBundle": false, - "_integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "_location": "/wrap-ansi/strip-ansi", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "strip-ansi@^6.0.0", - "name": "strip-ansi", - "escapedName": "strip-ansi", - "rawSpec": "^6.0.0", - "saveSpec": null, - "fetchSpec": "^6.0.0" - }, - "_requiredBy": [ - "/wrap-ansi", - "/wrap-ansi/string-width" - ], - "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "_shasum": "0b1571dd7669ccd4f3e06e14ef1eed26225ae532", - "_spec": "strip-ansi@^6.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/wrap-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/strip-ansi/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "deprecated": false, - "description": "Strip ANSI escape codes from a string", - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.10.0", - "xo": "^0.25.3" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/chalk/strip-ansi#readme", - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "strip-ansi", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/strip-ansi.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "6.0.0" -} diff --git a/node_modules/wrap-ansi/node_modules/strip-ansi/readme.md b/node_modules/wrap-ansi/node_modules/strip-ansi/readme.md deleted file mode 100644 index 7c4b56d..0000000 --- a/node_modules/wrap-ansi/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,46 +0,0 @@ -# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) - -> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string - - -## Install - -``` -$ npm install strip-ansi -``` - - -## Usage - -```js -const stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` - - -## strip-ansi for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - - -## Related - -- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module -- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module -- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - diff --git a/node_modules/wrap-ansi/package.json b/node_modules/wrap-ansi/package.json deleted file mode 100644 index d54ce7b..0000000 --- a/node_modules/wrap-ansi/package.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "_from": "wrap-ansi@^6.2.0", - "_id": "wrap-ansi@6.2.0", - "_inBundle": false, - "_integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "_location": "/wrap-ansi", - "_phantomChildren": { - "emoji-regex": "8.0.0" - }, - "_requested": { - "type": "range", - "registry": true, - "raw": "wrap-ansi@^6.2.0", - "name": "wrap-ansi", - "escapedName": "wrap-ansi", - "rawSpec": "^6.2.0", - "saveSpec": null, - "fetchSpec": "^6.2.0" - }, - "_requiredBy": [ - "/cliui" - ], - "_resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "_shasum": "e9393ba07102e6c91a3b221478f0257cd2856e53", - "_spec": "wrap-ansi@^6.2.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/cliui", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/wrap-ansi/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "deprecated": false, - "description": "Wordwrap a string with ANSI escape codes", - "devDependencies": { - "ava": "^2.1.0", - "chalk": "^2.4.2", - "coveralls": "^3.0.3", - "has-ansi": "^3.0.0", - "nyc": "^14.1.1", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/wrap-ansi#readme", - "keywords": [ - "wrap", - "break", - "wordwrap", - "wordbreak", - "linewrap", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "wrap-ansi", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/wrap-ansi.git" - }, - "scripts": { - "test": "xo && nyc ava" - }, - "version": "6.2.0" -} diff --git a/node_modules/wrap-ansi/readme.md b/node_modules/wrap-ansi/readme.md deleted file mode 100644 index d81a4d5..0000000 --- a/node_modules/wrap-ansi/readme.md +++ /dev/null @@ -1,97 +0,0 @@ -# wrap-ansi [![Build Status](https://travis-ci.org/chalk/wrap-ansi.svg?branch=master)](https://travis-ci.org/chalk/wrap-ansi) [![Coverage Status](https://coveralls.io/repos/github/chalk/wrap-ansi/badge.svg?branch=master)](https://coveralls.io/github/chalk/wrap-ansi?branch=master) - -> Wordwrap a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) - - -## Install - -``` -$ npm install wrap-ansi -``` - - -## Usage - -```js -const chalk = require('chalk'); -const wrapAnsi = require('wrap-ansi'); - -const input = 'The quick brown ' + chalk.red('fox jumped over ') + - 'the lazy ' + chalk.green('dog and then ran away with the unicorn.'); - -console.log(wrapAnsi(input, 20)); -``` - - - - -## API - -### wrapAnsi(string, columns, options?) - -Wrap words to the specified column width. - -#### string - -Type: `string` - -String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`. - -#### columns - -Type: `number` - -Number of columns to wrap the text to. - -#### options - -Type: `object` - -##### hard - -Type: `boolean`
-Default: `false` - -By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width. - -##### wordWrap - -Type: `boolean`
-Default: `true` - -By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary. - -##### trim - -Type: `boolean`
-Default: `true` - -Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim. - - -## Related - -- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes -- [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right -- [jsesc](https://github.com/mathiasbynens/jsesc) - Generate ASCII-only output from Unicode strings. Useful for creating test fixtures. - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) -- [Benjamin Coe](https://github.com/bcoe) - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/wrappy/LICENSE b/node_modules/wrappy/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/wrappy/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/wrappy/README.md b/node_modules/wrappy/README.md deleted file mode 100644 index 98eab25..0000000 --- a/node_modules/wrappy/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# wrappy - -Callback wrapping utility - -## USAGE - -```javascript -var wrappy = require("wrappy") - -// var wrapper = wrappy(wrapperFunction) - -// make sure a cb is called only once -// See also: http://npm.im/once for this specific use case -var once = wrappy(function (cb) { - var called = false - return function () { - if (called) return - called = true - return cb.apply(this, arguments) - } -}) - -function printBoo () { - console.log('boo') -} -// has some rando property -printBoo.iAmBooPrinter = true - -var onlyPrintOnce = once(printBoo) - -onlyPrintOnce() // prints 'boo' -onlyPrintOnce() // does nothing - -// random property is retained! -assert.equal(onlyPrintOnce.iAmBooPrinter, true) -``` diff --git a/node_modules/wrappy/package.json b/node_modules/wrappy/package.json deleted file mode 100644 index e41f057..0000000 --- a/node_modules/wrappy/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "_from": "wrappy@1", - "_id": "wrappy@1.0.2", - "_inBundle": false, - "_integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "_location": "/wrappy", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "wrappy@1", - "name": "wrappy", - "escapedName": "wrappy", - "rawSpec": "1", - "saveSpec": null, - "fetchSpec": "1" - }, - "_requiredBy": [ - "/inflight", - "/once" - ], - "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "_shasum": "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f", - "_spec": "wrappy@1", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/inflight", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/npm/wrappy/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Callback wrapping utility", - "devDependencies": { - "tap": "^2.3.1" - }, - "directories": { - "test": "test" - }, - "files": [ - "wrappy.js" - ], - "homepage": "https://github.com/npm/wrappy", - "license": "ISC", - "main": "wrappy.js", - "name": "wrappy", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/wrappy.git" - }, - "scripts": { - "test": "tap --coverage test/*.js" - }, - "version": "1.0.2" -} diff --git a/node_modules/wrappy/wrappy.js b/node_modules/wrappy/wrappy.js deleted file mode 100644 index bb7e7d6..0000000 --- a/node_modules/wrappy/wrappy.js +++ /dev/null @@ -1,33 +0,0 @@ -// Returns a wrapper function that returns a wrapped callback -// The wrapper function should do some stuff, and return a -// presumably different callback function. -// This makes sure that own properties are retained, so that -// decorations and such are not lost along the way. -module.exports = wrappy -function wrappy (fn, cb) { - if (fn && cb) return wrappy(fn)(cb) - - if (typeof fn !== 'function') - throw new TypeError('need wrapper function') - - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k] - }) - - return wrapper - - function wrapper() { - var args = new Array(arguments.length) - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - var ret = fn.apply(this, args) - var cb = args[args.length-1] - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k] - }) - } - return ret - } -} diff --git a/node_modules/y18n/CHANGELOG.md b/node_modules/y18n/CHANGELOG.md deleted file mode 100644 index c259076..0000000 --- a/node_modules/y18n/CHANGELOG.md +++ /dev/null @@ -1,21 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - - -# [4.0.0](https://github.com/yargs/y18n/compare/v3.2.1...v4.0.0) (2017-10-10) - - -### Bug Fixes - -* allow support for falsy values like 0 in tagged literal ([#45](https://github.com/yargs/y18n/issues/45)) ([c926123](https://github.com/yargs/y18n/commit/c926123)) - - -### Features - -* **__:** added tagged template literal support ([#44](https://github.com/yargs/y18n/issues/44)) ([0598daf](https://github.com/yargs/y18n/commit/0598daf)) - - -### BREAKING CHANGES - -* **__:** dropping Node 0.10/Node 0.12 support diff --git a/node_modules/y18n/LICENSE b/node_modules/y18n/LICENSE deleted file mode 100644 index 3c157f0..0000000 --- a/node_modules/y18n/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2015, Contributors - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. diff --git a/node_modules/y18n/README.md b/node_modules/y18n/README.md deleted file mode 100644 index 826474f..0000000 --- a/node_modules/y18n/README.md +++ /dev/null @@ -1,109 +0,0 @@ -# y18n - -[![Build Status][travis-image]][travis-url] -[![Coverage Status][coveralls-image]][coveralls-url] -[![NPM version][npm-image]][npm-url] -[![js-standard-style][standard-image]][standard-url] -[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) - -The bare-bones internationalization library used by yargs. - -Inspired by [i18n](https://www.npmjs.com/package/i18n). - -## Examples - -_simple string translation:_ - -```js -var __ = require('y18n').__ - -console.log(__('my awesome string %s', 'foo')) -``` - -output: - -`my awesome string foo` - -_using tagged template literals_ - -```js -var __ = require('y18n').__ -var str = 'foo' - -console.log(__`my awesome string ${str}`) -``` - -output: - -`my awesome string foo` - -_pluralization support:_ - -```js -var __n = require('y18n').__n - -console.log(__n('one fish %s', '%d fishes %s', 2, 'foo')) -``` - -output: - -`2 fishes foo` - -## JSON Language Files - -The JSON language files should be stored in a `./locales` folder. -File names correspond to locales, e.g., `en.json`, `pirate.json`. - -When strings are observed for the first time they will be -added to the JSON file corresponding to the current locale. - -## Methods - -### require('y18n')(config) - -Create an instance of y18n with the config provided, options include: - -* `directory`: the locale directory, default `./locales`. -* `updateFiles`: should newly observed strings be updated in file, default `true`. -* `locale`: what locale should be used. -* `fallbackToLanguage`: should fallback to a language-only file (e.g. `en.json`) - be allowed if a file matching the locale does not exist (e.g. `en_US.json`), - default `true`. - -### y18n.\_\_(str, arg, arg, arg) - -Print a localized string, `%s` will be replaced with `arg`s. - -This function can also be used as a tag for a template literal. You can use it -like this: __`hello ${'world'}`. This will be equivalent to -`__('hello %s', 'world')`. - -### y18n.\_\_n(singularString, pluralString, count, arg, arg, arg) - -Print a localized string with appropriate pluralization. If `%d` is provided -in the string, the `count` will replace this placeholder. - -### y18n.setLocale(str) - -Set the current locale being used. - -### y18n.getLocale() - -What locale is currently being used? - -### y18n.updateLocale(obj) - -Update the current locale with the key value pairs in `obj`. - -## License - -ISC - -[travis-url]: https://travis-ci.org/yargs/y18n -[travis-image]: https://img.shields.io/travis/yargs/y18n.svg -[coveralls-url]: https://coveralls.io/github/yargs/y18n -[coveralls-image]: https://img.shields.io/coveralls/yargs/y18n.svg -[npm-url]: https://npmjs.org/package/y18n -[npm-image]: https://img.shields.io/npm/v/y18n.svg -[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg -[standard-url]: https://github.com/feross/standard diff --git a/node_modules/y18n/index.js b/node_modules/y18n/index.js deleted file mode 100644 index d720681..0000000 --- a/node_modules/y18n/index.js +++ /dev/null @@ -1,188 +0,0 @@ -var fs = require('fs') -var path = require('path') -var util = require('util') - -function Y18N (opts) { - // configurable options. - opts = opts || {} - this.directory = opts.directory || './locales' - this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true - this.locale = opts.locale || 'en' - this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true - - // internal stuff. - this.cache = {} - this.writeQueue = [] -} - -Y18N.prototype.__ = function () { - if (typeof arguments[0] !== 'string') { - return this._taggedLiteral.apply(this, arguments) - } - var args = Array.prototype.slice.call(arguments) - var str = args.shift() - var cb = function () {} // start with noop. - - if (typeof args[args.length - 1] === 'function') cb = args.pop() - cb = cb || function () {} // noop. - - if (!this.cache[this.locale]) this._readLocaleFile() - - // we've observed a new string, update the language file. - if (!this.cache[this.locale][str] && this.updateFiles) { - this.cache[this.locale][str] = str - - // include the current directory and locale, - // since these values could change before the - // write is performed. - this._enqueueWrite([this.directory, this.locale, cb]) - } else { - cb() - } - - return util.format.apply(util, [this.cache[this.locale][str] || str].concat(args)) -} - -Y18N.prototype._taggedLiteral = function (parts) { - var args = arguments - var str = '' - parts.forEach(function (part, i) { - var arg = args[i + 1] - str += part - if (typeof arg !== 'undefined') { - str += '%s' - } - }) - return this.__.apply(null, [str].concat([].slice.call(arguments, 1))) -} - -Y18N.prototype._enqueueWrite = function (work) { - this.writeQueue.push(work) - if (this.writeQueue.length === 1) this._processWriteQueue() -} - -Y18N.prototype._processWriteQueue = function () { - var _this = this - var work = this.writeQueue[0] - - // destructure the enqueued work. - var directory = work[0] - var locale = work[1] - var cb = work[2] - - var languageFile = this._resolveLocaleFile(directory, locale) - var serializedLocale = JSON.stringify(this.cache[locale], null, 2) - - fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) { - _this.writeQueue.shift() - if (_this.writeQueue.length > 0) _this._processWriteQueue() - cb(err) - }) -} - -Y18N.prototype._readLocaleFile = function () { - var localeLookup = {} - var languageFile = this._resolveLocaleFile(this.directory, this.locale) - - try { - localeLookup = JSON.parse(fs.readFileSync(languageFile, 'utf-8')) - } catch (err) { - if (err instanceof SyntaxError) { - err.message = 'syntax error in ' + languageFile - } - - if (err.code === 'ENOENT') localeLookup = {} - else throw err - } - - this.cache[this.locale] = localeLookup -} - -Y18N.prototype._resolveLocaleFile = function (directory, locale) { - var file = path.resolve(directory, './', locale + '.json') - if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) { - // attempt fallback to language only - var languageFile = path.resolve(directory, './', locale.split('_')[0] + '.json') - if (this._fileExistsSync(languageFile)) file = languageFile - } - return file -} - -// this only exists because fs.existsSync() "will be deprecated" -// see https://nodejs.org/api/fs.html#fs_fs_existssync_path -Y18N.prototype._fileExistsSync = function (file) { - try { - return fs.statSync(file).isFile() - } catch (err) { - return false - } -} - -Y18N.prototype.__n = function () { - var args = Array.prototype.slice.call(arguments) - var singular = args.shift() - var plural = args.shift() - var quantity = args.shift() - - var cb = function () {} // start with noop. - if (typeof args[args.length - 1] === 'function') cb = args.pop() - - if (!this.cache[this.locale]) this._readLocaleFile() - - var str = quantity === 1 ? singular : plural - if (this.cache[this.locale][singular]) { - str = this.cache[this.locale][singular][quantity === 1 ? 'one' : 'other'] - } - - // we've observed a new string, update the language file. - if (!this.cache[this.locale][singular] && this.updateFiles) { - this.cache[this.locale][singular] = { - one: singular, - other: plural - } - - // include the current directory and locale, - // since these values could change before the - // write is performed. - this._enqueueWrite([this.directory, this.locale, cb]) - } else { - cb() - } - - // if a %d placeholder is provided, add quantity - // to the arguments expanded by util.format. - var values = [str] - if (~str.indexOf('%d')) values.push(quantity) - - return util.format.apply(util, values.concat(args)) -} - -Y18N.prototype.setLocale = function (locale) { - this.locale = locale -} - -Y18N.prototype.getLocale = function () { - return this.locale -} - -Y18N.prototype.updateLocale = function (obj) { - if (!this.cache[this.locale]) this._readLocaleFile() - - for (var key in obj) { - this.cache[this.locale][key] = obj[key] - } -} - -module.exports = function (opts) { - var y18n = new Y18N(opts) - - // bind all functions to y18n, so that - // they can be used in isolation. - for (var key in y18n) { - if (typeof y18n[key] === 'function') { - y18n[key] = y18n[key].bind(y18n) - } - } - - return y18n -} diff --git a/node_modules/y18n/package.json b/node_modules/y18n/package.json deleted file mode 100644 index a2616f5..0000000 --- a/node_modules/y18n/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_from": "y18n@^4.0.0", - "_id": "y18n@4.0.0", - "_inBundle": false, - "_integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "_location": "/y18n", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "y18n@^4.0.0", - "name": "y18n", - "escapedName": "y18n", - "rawSpec": "^4.0.0", - "saveSpec": null, - "fetchSpec": "^4.0.0" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "_shasum": "95ef94f85ecc81d007c264e190a120f0a3c8566b", - "_spec": "y18n@^4.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "Ben Coe", - "email": "ben@npmjs.com" - }, - "bugs": { - "url": "https://github.com/yargs/y18n/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "the bare-bones internationalization library used by yargs", - "devDependencies": { - "chai": "^4.0.1", - "coveralls": "^3.0.0", - "mocha": "^4.0.1", - "nyc": "^11.0.1", - "rimraf": "^2.5.0", - "standard": "^10.0.0-beta.0", - "standard-version": "^4.2.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/yargs/y18n", - "keywords": [ - "i18n", - "internationalization", - "yargs" - ], - "license": "ISC", - "main": "index.js", - "name": "y18n", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/yargs/y18n.git" - }, - "scripts": { - "coverage": "nyc report --reporter=text-lcov | coveralls", - "pretest": "standard", - "release": "standard-version", - "test": "nyc mocha" - }, - "version": "4.0.0" -} diff --git a/node_modules/yallist/LICENSE b/node_modules/yallist/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/yallist/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/yallist/README.md b/node_modules/yallist/README.md deleted file mode 100644 index f586101..0000000 --- a/node_modules/yallist/README.md +++ /dev/null @@ -1,204 +0,0 @@ -# yallist - -Yet Another Linked List - -There are many doubly-linked list implementations like it, but this -one is mine. - -For when an array would be too big, and a Map can't be iterated in -reverse order. - - -[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist) - -## basic usage - -```javascript -var yallist = require('yallist') -var myList = yallist.create([1, 2, 3]) -myList.push('foo') -myList.unshift('bar') -// of course pop() and shift() are there, too -console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo'] -myList.forEach(function (k) { - // walk the list head to tail -}) -myList.forEachReverse(function (k, index, list) { - // walk the list tail to head -}) -var myDoubledList = myList.map(function (k) { - return k + k -}) -// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo'] -// mapReverse is also a thing -var myDoubledListReverse = myList.mapReverse(function (k) { - return k + k -}) // ['foofoo', 6, 4, 2, 'barbar'] - -var reduced = myList.reduce(function (set, entry) { - set += entry - return set -}, 'start') -console.log(reduced) // 'startfoo123bar' -``` - -## api - -The whole API is considered "public". - -Functions with the same name as an Array method work more or less the -same way. - -There's reverse versions of most things because that's the point. - -### Yallist - -Default export, the class that holds and manages a list. - -Call it with either a forEach-able (like an array) or a set of -arguments, to initialize the list. - -The Array-ish methods all act like you'd expect. No magic length, -though, so if you change that it won't automatically prune or add -empty spots. - -### Yallist.create(..) - -Alias for Yallist function. Some people like factories. - -#### yallist.head - -The first node in the list - -#### yallist.tail - -The last node in the list - -#### yallist.length - -The number of nodes in the list. (Change this at your peril. It is -not magic like Array length.) - -#### yallist.toArray() - -Convert the list to an array. - -#### yallist.forEach(fn, [thisp]) - -Call a function on each item in the list. - -#### yallist.forEachReverse(fn, [thisp]) - -Call a function on each item in the list, in reverse order. - -#### yallist.get(n) - -Get the data at position `n` in the list. If you use this a lot, -probably better off just using an Array. - -#### yallist.getReverse(n) - -Get the data at position `n`, counting from the tail. - -#### yallist.map(fn, thisp) - -Create a new Yallist with the result of calling the function on each -item. - -#### yallist.mapReverse(fn, thisp) - -Same as `map`, but in reverse. - -#### yallist.pop() - -Get the data from the list tail, and remove the tail from the list. - -#### yallist.push(item, ...) - -Insert one or more items to the tail of the list. - -#### yallist.reduce(fn, initialValue) - -Like Array.reduce. - -#### yallist.reduceReverse - -Like Array.reduce, but in reverse. - -#### yallist.reverse - -Reverse the list in place. - -#### yallist.shift() - -Get the data from the list head, and remove the head from the list. - -#### yallist.slice([from], [to]) - -Just like Array.slice, but returns a new Yallist. - -#### yallist.sliceReverse([from], [to]) - -Just like yallist.slice, but the result is returned in reverse. - -#### yallist.toArray() - -Create an array representation of the list. - -#### yallist.toArrayReverse() - -Create a reversed array representation of the list. - -#### yallist.unshift(item, ...) - -Insert one or more items to the head of the list. - -#### yallist.unshiftNode(node) - -Move a Node object to the front of the list. (That is, pull it out of -wherever it lives, and make it the new head.) - -If the node belongs to a different list, then that list will remove it -first. - -#### yallist.pushNode(node) - -Move a Node object to the end of the list. (That is, pull it out of -wherever it lives, and make it the new tail.) - -If the node belongs to a list already, then that list will remove it -first. - -#### yallist.removeNode(node) - -Remove a node from the list, preserving referential integrity of head -and tail and other nodes. - -Will throw an error if you try to have a list remove a node that -doesn't belong to it. - -### Yallist.Node - -The class that holds the data and is actually the list. - -Call with `var n = new Node(value, previousNode, nextNode)` - -Note that if you do direct operations on Nodes themselves, it's very -easy to get into weird states where the list is broken. Be careful :) - -#### node.next - -The next node in the list. - -#### node.prev - -The previous node in the list. - -#### node.value - -The data the node contains. - -#### node.list - -The list to which this node belongs. (Null if it does not belong to -any list.) diff --git a/node_modules/yallist/iterator.js b/node_modules/yallist/iterator.js deleted file mode 100644 index d41c97a..0000000 --- a/node_modules/yallist/iterator.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' -module.exports = function (Yallist) { - Yallist.prototype[Symbol.iterator] = function* () { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value - } - } -} diff --git a/node_modules/yallist/package.json b/node_modules/yallist/package.json deleted file mode 100644 index 3ea0343..0000000 --- a/node_modules/yallist/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "_from": "yallist@^3.0.3", - "_id": "yallist@3.1.1", - "_inBundle": false, - "_integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "_location": "/yallist", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "yallist@^3.0.3", - "name": "yallist", - "escapedName": "yallist", - "rawSpec": "^3.0.3", - "saveSpec": null, - "fetchSpec": "^3.0.3" - }, - "_requiredBy": [ - "/minipass", - "/tar" - ], - "_resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "_shasum": "dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd", - "_spec": "yallist@^3.0.3", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/tar", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/yallist/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Yet Another Linked List", - "devDependencies": { - "tap": "^12.1.0" - }, - "directories": { - "test": "test" - }, - "files": [ - "yallist.js", - "iterator.js" - ], - "homepage": "https://github.com/isaacs/yallist#readme", - "license": "ISC", - "main": "yallist.js", - "name": "yallist", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/yallist.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js --100" - }, - "version": "3.1.1" -} diff --git a/node_modules/yallist/yallist.js b/node_modules/yallist/yallist.js deleted file mode 100644 index ed4e730..0000000 --- a/node_modules/yallist/yallist.js +++ /dev/null @@ -1,426 +0,0 @@ -'use strict' -module.exports = Yallist - -Yallist.Node = Node -Yallist.create = Yallist - -function Yallist (list) { - var self = this - if (!(self instanceof Yallist)) { - self = new Yallist() - } - - self.tail = null - self.head = null - self.length = 0 - - if (list && typeof list.forEach === 'function') { - list.forEach(function (item) { - self.push(item) - }) - } else if (arguments.length > 0) { - for (var i = 0, l = arguments.length; i < l; i++) { - self.push(arguments[i]) - } - } - - return self -} - -Yallist.prototype.removeNode = function (node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list') - } - - var next = node.next - var prev = node.prev - - if (next) { - next.prev = prev - } - - if (prev) { - prev.next = next - } - - if (node === this.head) { - this.head = next - } - if (node === this.tail) { - this.tail = prev - } - - node.list.length-- - node.next = null - node.prev = null - node.list = null - - return next -} - -Yallist.prototype.unshiftNode = function (node) { - if (node === this.head) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var head = this.head - node.list = this - node.next = head - if (head) { - head.prev = node - } - - this.head = node - if (!this.tail) { - this.tail = node - } - this.length++ -} - -Yallist.prototype.pushNode = function (node) { - if (node === this.tail) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var tail = this.tail - node.list = this - node.prev = tail - if (tail) { - tail.next = node - } - - this.tail = node - if (!this.head) { - this.head = node - } - this.length++ -} - -Yallist.prototype.push = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - push(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.unshift = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - unshift(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.pop = function () { - if (!this.tail) { - return undefined - } - - var res = this.tail.value - this.tail = this.tail.prev - if (this.tail) { - this.tail.next = null - } else { - this.head = null - } - this.length-- - return res -} - -Yallist.prototype.shift = function () { - if (!this.head) { - return undefined - } - - var res = this.head.value - this.head = this.head.next - if (this.head) { - this.head.prev = null - } else { - this.tail = null - } - this.length-- - return res -} - -Yallist.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.head, i = 0; walker !== null; i++) { - fn.call(thisp, walker.value, i, this) - walker = walker.next - } -} - -Yallist.prototype.forEachReverse = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { - fn.call(thisp, walker.value, i, this) - walker = walker.prev - } -} - -Yallist.prototype.get = function (n) { - for (var i = 0, walker = this.head; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.next - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.getReverse = function (n) { - for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.map = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.head; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.next - } - return res -} - -Yallist.prototype.mapReverse = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.tail; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.prev - } - return res -} - -Yallist.prototype.reduce = function (fn, initial) { - var acc - var walker = this.head - if (arguments.length > 1) { - acc = initial - } else if (this.head) { - walker = this.head.next - acc = this.head.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = 0; walker !== null; i++) { - acc = fn(acc, walker.value, i) - walker = walker.next - } - - return acc -} - -Yallist.prototype.reduceReverse = function (fn, initial) { - var acc - var walker = this.tail - if (arguments.length > 1) { - acc = initial - } else if (this.tail) { - walker = this.tail.prev - acc = this.tail.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = this.length - 1; walker !== null; i--) { - acc = fn(acc, walker.value, i) - walker = walker.prev - } - - return acc -} - -Yallist.prototype.toArray = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.head; walker !== null; i++) { - arr[i] = walker.value - walker = walker.next - } - return arr -} - -Yallist.prototype.toArrayReverse = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.tail; walker !== null; i++) { - arr[i] = walker.value - walker = walker.prev - } - return arr -} - -Yallist.prototype.slice = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { - walker = walker.next - } - for (; walker !== null && i < to; i++, walker = walker.next) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.sliceReverse = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { - walker = walker.prev - } - for (; walker !== null && i > from; i--, walker = walker.prev) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.splice = function (start, deleteCount /*, ...nodes */) { - if (start > this.length) { - start = this.length - 1 - } - if (start < 0) { - start = this.length + start; - } - - for (var i = 0, walker = this.head; walker !== null && i < start; i++) { - walker = walker.next - } - - var ret = [] - for (var i = 0; walker && i < deleteCount; i++) { - ret.push(walker.value) - walker = this.removeNode(walker) - } - if (walker === null) { - walker = this.tail - } - - if (walker !== this.head && walker !== this.tail) { - walker = walker.prev - } - - for (var i = 2; i < arguments.length; i++) { - walker = insert(this, walker, arguments[i]) - } - return ret; -} - -Yallist.prototype.reverse = function () { - var head = this.head - var tail = this.tail - for (var walker = head; walker !== null; walker = walker.prev) { - var p = walker.prev - walker.prev = walker.next - walker.next = p - } - this.head = tail - this.tail = head - return this -} - -function insert (self, node, value) { - var inserted = node === self.head ? - new Node(value, null, node, self) : - new Node(value, node, node.next, self) - - if (inserted.next === null) { - self.tail = inserted - } - if (inserted.prev === null) { - self.head = inserted - } - - self.length++ - - return inserted -} - -function push (self, item) { - self.tail = new Node(item, self.tail, null, self) - if (!self.head) { - self.head = self.tail - } - self.length++ -} - -function unshift (self, item) { - self.head = new Node(item, null, self.head, self) - if (!self.tail) { - self.tail = self.head - } - self.length++ -} - -function Node (value, prev, next, list) { - if (!(this instanceof Node)) { - return new Node(value, prev, next, list) - } - - this.list = list - this.value = value - - if (prev) { - prev.next = this - this.prev = prev - } else { - this.prev = null - } - - if (next) { - next.prev = this - this.next = next - } else { - this.next = null - } -} - -try { - // add if support for Symbol.iterator is present - require('./iterator.js')(Yallist) -} catch (er) {} diff --git a/node_modules/yargs-parser/CHANGELOG.md b/node_modules/yargs-parser/CHANGELOG.md deleted file mode 100644 index d91dc51..0000000 --- a/node_modules/yargs-parser/CHANGELOG.md +++ /dev/null @@ -1,601 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -### [18.1.3](https://www.github.com/yargs/yargs-parser/compare/v18.1.2...v18.1.3) (2020-04-16) - - -### Bug Fixes - -* **setArg:** options using camel-case and dot-notation populated twice ([#268](https://www.github.com/yargs/yargs-parser/issues/268)) ([f7e15b9](https://www.github.com/yargs/yargs-parser/commit/f7e15b9800900b9856acac1a830a5f35847be73e)) - -### [18.1.2](https://www.github.com/yargs/yargs-parser/compare/v18.1.1...v18.1.2) (2020-03-26) - - -### Bug Fixes - -* **array, nargs:** support -o=--value and --option=--value format ([#262](https://www.github.com/yargs/yargs-parser/issues/262)) ([41d3f81](https://www.github.com/yargs/yargs-parser/commit/41d3f8139e116706b28de9b0de3433feb08d2f13)) - -### [18.1.1](https://www.github.com/yargs/yargs-parser/compare/v18.1.0...v18.1.1) (2020-03-16) - - -### Bug Fixes - -* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential -prototype pollution vulnerability. This was reported by the Snyk Security Research Team.([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2)) - -## [18.1.0](https://www.github.com/yargs/yargs-parser/compare/v18.0.0...v18.1.0) (2020-03-07) - - -### Features - -* introduce single-digit boolean aliases ([#255](https://www.github.com/yargs/yargs-parser/issues/255)) ([9c60265](https://www.github.com/yargs/yargs-parser/commit/9c60265fd7a03cb98e6df3e32c8c5e7508d9f56f)) - -## [18.0.0](https://www.github.com/yargs/yargs-parser/compare/v17.1.0...v18.0.0) (2020-03-02) - - -### ⚠ BREAKING CHANGES - -* the narg count is now enforced when parsing arrays. - -### Features - -* NaN can now be provided as a value for nargs, indicating "at least" one value is expected for array ([#251](https://www.github.com/yargs/yargs-parser/issues/251)) ([9db4be8](https://www.github.com/yargs/yargs-parser/commit/9db4be81417a2c7097128db34d86fe70ef4af70c)) - -## [17.1.0](https://www.github.com/yargs/yargs-parser/compare/v17.0.1...v17.1.0) (2020-03-01) - - -### Features - -* introduce greedy-arrays config, for specifying whether arrays consume multiple positionals ([#249](https://www.github.com/yargs/yargs-parser/issues/249)) ([60e880a](https://www.github.com/yargs/yargs-parser/commit/60e880a837046314d89fa4725f923837fd33a9eb)) - -### [17.0.1](https://www.github.com/yargs/yargs-parser/compare/v17.0.0...v17.0.1) (2020-02-29) - - -### Bug Fixes - -* normalized keys were not enumerable ([#247](https://www.github.com/yargs/yargs-parser/issues/247)) ([57119f9](https://www.github.com/yargs/yargs-parser/commit/57119f9f17cf27499bd95e61c2f72d18314f11ba)) - -## [17.0.0](https://www.github.com/yargs/yargs-parser/compare/v16.1.0...v17.0.0) (2020-02-10) - - -### ⚠ BREAKING CHANGES - -* this reverts parsing behavior of booleans to that of yargs@14 -* objects used during parsing are now created with a null -prototype. There may be some scenarios where this change in behavior -leaks externally. - -### Features - -* boolean arguments will not be collected into an implicit array ([#236](https://www.github.com/yargs/yargs-parser/issues/236)) ([34c4e19](https://www.github.com/yargs/yargs-parser/commit/34c4e19bae4e7af63e3cb6fa654a97ed476e5eb5)) -* introduce nargs-eats-options config option ([#246](https://www.github.com/yargs/yargs-parser/issues/246)) ([d50822a](https://www.github.com/yargs/yargs-parser/commit/d50822ac10e1b05f2e9643671ca131ac251b6732)) - - -### Bug Fixes - -* address bugs with "uknown-options-as-args" ([bc023e3](https://www.github.com/yargs/yargs-parser/commit/bc023e3b13e20a118353f9507d1c999bf388a346)) -* array should take precedence over nargs, but enforce nargs ([#243](https://www.github.com/yargs/yargs-parser/issues/243)) ([4cbc188](https://www.github.com/yargs/yargs-parser/commit/4cbc188b7abb2249529a19c090338debdad2fe6c)) -* support keys that collide with object prototypes ([#234](https://www.github.com/yargs/yargs-parser/issues/234)) ([1587b6d](https://www.github.com/yargs/yargs-parser/commit/1587b6d91db853a9109f1be6b209077993fee4de)) -* unknown options terminated with digits now handled by unknown-options-as-args ([#238](https://www.github.com/yargs/yargs-parser/issues/238)) ([d36cdfa](https://www.github.com/yargs/yargs-parser/commit/d36cdfa854254d7c7e0fe1d583818332ac46c2a5)) - -## [16.1.0](https://www.github.com/yargs/yargs-parser/compare/v16.0.0...v16.1.0) (2019-11-01) - - -### ⚠ BREAKING CHANGES - -* populate error if incompatible narg/count or array/count options are used (#191) - -### Features - -* options that have had their default value used are now tracked ([#211](https://www.github.com/yargs/yargs-parser/issues/211)) ([a525234](https://www.github.com/yargs/yargs-parser/commit/a525234558c847deedd73f8792e0a3b77b26e2c0)) -* populate error if incompatible narg/count or array/count options are used ([#191](https://www.github.com/yargs/yargs-parser/issues/191)) ([84a401f](https://www.github.com/yargs/yargs-parser/commit/84a401f0fa3095e0a19661670d1570d0c3b9d3c9)) - - -### Reverts - -* revert 16.0.0 CHANGELOG entry ([920320a](https://www.github.com/yargs/yargs-parser/commit/920320ad9861bbfd58eda39221ae211540fc1daf)) - -## [15.0.0](https://github.com/yargs/yargs-parser/compare/v14.0.0...v15.0.0) (2019-10-07) - - -### Features - -* rework `collect-unknown-options` into `unknown-options-as-args`, providing more comprehensive functionality ([ef771ca](https://github.com/yargs/yargs-parser/commit/ef771ca)) - - -### BREAKING CHANGES - -* rework `collect-unknown-options` into `unknown-options-as-args`, providing more comprehensive functionality - - - -## [14.0.0](https://github.com/yargs/yargs-parser/compare/v13.1.1...v14.0.0) (2019-09-06) - - -### Bug Fixes - -* boolean arrays with default values ([#185](https://github.com/yargs/yargs-parser/issues/185)) ([7d42572](https://github.com/yargs/yargs-parser/commit/7d42572)) -* boolean now behaves the same as other array types ([#184](https://github.com/yargs/yargs-parser/issues/184)) ([17ca3bd](https://github.com/yargs/yargs-parser/commit/17ca3bd)) -* eatNargs() for 'opt.narg === 0' and boolean typed options ([#188](https://github.com/yargs/yargs-parser/issues/188)) ([c5a1db0](https://github.com/yargs/yargs-parser/commit/c5a1db0)) -* maybeCoerceNumber now takes precedence over coerce return value ([#182](https://github.com/yargs/yargs-parser/issues/182)) ([2f26436](https://github.com/yargs/yargs-parser/commit/2f26436)) -* take into account aliases when appending arrays from config object ([#199](https://github.com/yargs/yargs-parser/issues/199)) ([f8a2d3f](https://github.com/yargs/yargs-parser/commit/f8a2d3f)) - - -### Features - -* add configuration option to "collect-unknown-options" ([#181](https://github.com/yargs/yargs-parser/issues/181)) ([7909cc4](https://github.com/yargs/yargs-parser/commit/7909cc4)) -* maybeCoerceNumber() now takes into account arrays ([#187](https://github.com/yargs/yargs-parser/issues/187)) ([31c204b](https://github.com/yargs/yargs-parser/commit/31c204b)) - - -### BREAKING CHANGES - -* unless "parse-numbers" is set to "false", arrays of numeric strings are now parsed as numbers, rather than strings. -* we have dropped the broken "defaulted" functionality; we would like to revisit adding this in the future. -* maybeCoerceNumber now takes precedence over coerce return value (#182) - - - -### [13.1.1](https://www.github.com/yargs/yargs-parser/compare/v13.1.0...v13.1.1) (2019-06-10) - - -### Bug Fixes - -* convert values to strings when tokenizing ([#167](https://www.github.com/yargs/yargs-parser/issues/167)) ([57b7883](https://www.github.com/yargs/yargs-parser/commit/57b7883)) -* nargs should allow duplicates when duplicate-arguments-array=false ([#164](https://www.github.com/yargs/yargs-parser/issues/164)) ([47ccb0b](https://www.github.com/yargs/yargs-parser/commit/47ccb0b)) -* should populate "_" when given config with "short-option-groups" false ([#179](https://www.github.com/yargs/yargs-parser/issues/179)) ([6055974](https://www.github.com/yargs/yargs-parser/commit/6055974)) - -## [13.1.0](https://github.com/yargs/yargs-parser/compare/v13.0.0...v13.1.0) (2019-05-05) - - -### Features - -* add `strip-aliased` and `strip-dashed` configuration options. ([#172](https://github.com/yargs/yargs-parser/issues/172)) ([a3936aa](https://github.com/yargs/yargs-parser/commit/a3936aa)) -* support boolean which do not consume next argument. ([#171](https://github.com/yargs/yargs-parser/issues/171)) ([0ae7fcb](https://github.com/yargs/yargs-parser/commit/0ae7fcb)) - - - - -# [13.0.0](https://github.com/yargs/yargs-parser/compare/v12.0.0...v13.0.0) (2019-02-02) - - -### Features - -* don't coerce number from string with leading '0' or '+' ([#158](https://github.com/yargs/yargs-parser/issues/158)) ([18d0fd5](https://github.com/yargs/yargs-parser/commit/18d0fd5)) - - -### BREAKING CHANGES - -* options with leading '+' or '0' now parse as strings - - - - -# [12.0.0](https://github.com/yargs/yargs-parser/compare/v11.1.1...v12.0.0) (2019-01-29) - - -### Bug Fixes - -* better handling of quoted strings ([#153](https://github.com/yargs/yargs-parser/issues/153)) ([2fb71b2](https://github.com/yargs/yargs-parser/commit/2fb71b2)) - - -### Features - -* default value is now used if no right-hand value provided for numbers/strings ([#156](https://github.com/yargs/yargs-parser/issues/156)) ([5a7c46a](https://github.com/yargs/yargs-parser/commit/5a7c46a)) - - -### BREAKING CHANGES - -* a flag with no right-hand value no longer populates defaulted options with `undefined`. -* quotes at beginning and endings of strings are not removed during parsing. - - - - -## [11.1.1](https://github.com/yargs/yargs-parser/compare/v11.1.0...v11.1.1) (2018-11-19) - - -### Bug Fixes - -* ensure empty string is added into argv._ ([#140](https://github.com/yargs/yargs-parser/issues/140)) ([79cda98](https://github.com/yargs/yargs-parser/commit/79cda98)) - - -### Reverts - -* make requiresArg work in conjunction with arrays ([#136](https://github.com/yargs/yargs-parser/issues/136)) ([f4a3063](https://github.com/yargs/yargs-parser/commit/f4a3063)) - - - - -# [11.1.0](https://github.com/yargs/yargs-parser/compare/v11.0.0...v11.1.0) (2018-11-10) - - -### Bug Fixes - -* handling of one char alias ([#139](https://github.com/yargs/yargs-parser/issues/139)) ([ee56e31](https://github.com/yargs/yargs-parser/commit/ee56e31)) - - -### Features - -* add halt-at-non-option configuration option ([#130](https://github.com/yargs/yargs-parser/issues/130)) ([a849fce](https://github.com/yargs/yargs-parser/commit/a849fce)) - - - - -# [11.0.0](https://github.com/yargs/yargs-parser/compare/v10.1.0...v11.0.0) (2018-10-06) - - -### Bug Fixes - -* flatten-duplicate-arrays:false for more than 2 arrays ([#128](https://github.com/yargs/yargs-parser/issues/128)) ([2bc395f](https://github.com/yargs/yargs-parser/commit/2bc395f)) -* hyphenated flags combined with dot notation broke parsing ([#131](https://github.com/yargs/yargs-parser/issues/131)) ([dc788da](https://github.com/yargs/yargs-parser/commit/dc788da)) -* make requiresArg work in conjunction with arrays ([#136](https://github.com/yargs/yargs-parser/issues/136)) ([77ae1d4](https://github.com/yargs/yargs-parser/commit/77ae1d4)) - - -### Chores - -* update dependencies ([6dc42a1](https://github.com/yargs/yargs-parser/commit/6dc42a1)) - - -### Features - -* also add camelCase array options ([#125](https://github.com/yargs/yargs-parser/issues/125)) ([08c0117](https://github.com/yargs/yargs-parser/commit/08c0117)) -* array.type can now be provided, supporting coercion ([#132](https://github.com/yargs/yargs-parser/issues/132)) ([4b8cfce](https://github.com/yargs/yargs-parser/commit/4b8cfce)) - - -### BREAKING CHANGES - -* drops Node 4 support -* the argv object is now populated differently (correctly) when hyphens and dot notation are used in conjunction. - - - - -# [10.1.0](https://github.com/yargs/yargs-parser/compare/v10.0.0...v10.1.0) (2018-06-29) - - -### Features - -* add `set-placeholder-key` configuration ([#123](https://github.com/yargs/yargs-parser/issues/123)) ([19386ee](https://github.com/yargs/yargs-parser/commit/19386ee)) - - - - -# [10.0.0](https://github.com/yargs/yargs-parser/compare/v9.0.2...v10.0.0) (2018-04-04) - - -### Bug Fixes - -* do not set boolean flags if not defined in `argv` ([#119](https://github.com/yargs/yargs-parser/issues/119)) ([f6e6599](https://github.com/yargs/yargs-parser/commit/f6e6599)) - - -### BREAKING CHANGES - -* `boolean` flags defined without a `default` value will now behave like other option type and won't be set in the parsed results when the user doesn't set the corresponding CLI arg. - -Previous behavior: -```js -var parse = require('yargs-parser'); - -parse('--flag', {boolean: ['flag']}); -// => { _: [], flag: true } - -parse('--no-flag', {boolean: ['flag']}); -// => { _: [], flag: false } - -parse('', {boolean: ['flag']}); -// => { _: [], flag: false } -``` - -New behavior: -```js -var parse = require('yargs-parser'); - -parse('--flag', {boolean: ['flag']}); -// => { _: [], flag: true } - -parse('--no-flag', {boolean: ['flag']}); -// => { _: [], flag: false } - -parse('', {boolean: ['flag']}); -// => { _: [] } => flag not set similarly to other option type -``` - - - - -## [9.0.2](https://github.com/yargs/yargs-parser/compare/v9.0.1...v9.0.2) (2018-01-20) - - -### Bug Fixes - -* nargs was still aggressively consuming too many arguments ([9b28aad](https://github.com/yargs/yargs-parser/commit/9b28aad)) - - - - -## [9.0.1](https://github.com/yargs/yargs-parser/compare/v9.0.0...v9.0.1) (2018-01-20) - - -### Bug Fixes - -* nargs was consuming too many arguments ([4fef206](https://github.com/yargs/yargs-parser/commit/4fef206)) - - - - -# [9.0.0](https://github.com/yargs/yargs-parser/compare/v8.1.0...v9.0.0) (2018-01-20) - - -### Features - -* narg arguments no longer consume flag arguments ([#114](https://github.com/yargs/yargs-parser/issues/114)) ([60bb9b3](https://github.com/yargs/yargs-parser/commit/60bb9b3)) - - -### BREAKING CHANGES - -* arguments of form --foo, -abc, will no longer be consumed by nargs - - - - -# [8.1.0](https://github.com/yargs/yargs-parser/compare/v8.0.0...v8.1.0) (2017-12-20) - - -### Bug Fixes - -* allow null config values ([#108](https://github.com/yargs/yargs-parser/issues/108)) ([d8b14f9](https://github.com/yargs/yargs-parser/commit/d8b14f9)) -* ensure consistent parsing of dot-notation arguments ([#102](https://github.com/yargs/yargs-parser/issues/102)) ([c9bd79c](https://github.com/yargs/yargs-parser/commit/c9bd79c)) -* implement [@antoniom](https://github.com/antoniom)'s fix for camel-case expansion ([3087e1d](https://github.com/yargs/yargs-parser/commit/3087e1d)) -* only run coercion functions once, despite aliases. ([#76](https://github.com/yargs/yargs-parser/issues/76)) ([#103](https://github.com/yargs/yargs-parser/issues/103)) ([507aaef](https://github.com/yargs/yargs-parser/commit/507aaef)) -* scientific notation circumvented bounds check ([#110](https://github.com/yargs/yargs-parser/issues/110)) ([3571f57](https://github.com/yargs/yargs-parser/commit/3571f57)) -* tokenizer should ignore spaces at the beginning of the argString ([#106](https://github.com/yargs/yargs-parser/issues/106)) ([f34ead9](https://github.com/yargs/yargs-parser/commit/f34ead9)) - - -### Features - -* make combining arrays a configurable option ([#111](https://github.com/yargs/yargs-parser/issues/111)) ([c8bf536](https://github.com/yargs/yargs-parser/commit/c8bf536)) -* merge array from arguments with array from config ([#83](https://github.com/yargs/yargs-parser/issues/83)) ([806ddd6](https://github.com/yargs/yargs-parser/commit/806ddd6)) - - - - -# [8.0.0](https://github.com/yargs/yargs-parser/compare/v7.0.0...v8.0.0) (2017-10-05) - - -### Bug Fixes - -* Ignore multiple spaces between arguments. ([#100](https://github.com/yargs/yargs-parser/issues/100)) ([d137227](https://github.com/yargs/yargs-parser/commit/d137227)) - - -### Features - -* allow configuration of prefix for boolean negation ([#94](https://github.com/yargs/yargs-parser/issues/94)) ([00bde7d](https://github.com/yargs/yargs-parser/commit/00bde7d)) -* reworking how numbers are parsed ([#104](https://github.com/yargs/yargs-parser/issues/104)) ([fba00eb](https://github.com/yargs/yargs-parser/commit/fba00eb)) - - -### BREAKING CHANGES - -* strings that fail `Number.isSafeInteger()` are no longer coerced into numbers. - - - - -# [7.0.0](https://github.com/yargs/yargs-parser/compare/v6.0.1...v7.0.0) (2017-05-02) - - -### Chores - -* revert populate-- logic ([#91](https://github.com/yargs/yargs-parser/issues/91)) ([6003e6d](https://github.com/yargs/yargs-parser/commit/6003e6d)) - - -### BREAKING CHANGES - -* populate-- now defaults to false. - - - - -## [6.0.1](https://github.com/yargs/yargs-parser/compare/v6.0.0...v6.0.1) (2017-05-01) - - -### Bug Fixes - -* default '--' to undefined when not provided; this is closer to the array API ([#90](https://github.com/yargs/yargs-parser/issues/90)) ([4e739cc](https://github.com/yargs/yargs-parser/commit/4e739cc)) - - - - -# [6.0.0](https://github.com/yargs/yargs-parser/compare/v4.2.1...v6.0.0) (2017-05-01) - - -### Bug Fixes - -* environment variables should take precedence over config file ([#81](https://github.com/yargs/yargs-parser/issues/81)) ([76cee1f](https://github.com/yargs/yargs-parser/commit/76cee1f)) -* parsing hints should apply for dot notation keys ([#86](https://github.com/yargs/yargs-parser/issues/86)) ([3e47d62](https://github.com/yargs/yargs-parser/commit/3e47d62)) - - -### Chores - -* upgrade to newest version of camelcase ([#87](https://github.com/yargs/yargs-parser/issues/87)) ([f1903aa](https://github.com/yargs/yargs-parser/commit/f1903aa)) - - -### Features - -* add -- option which allows arguments after the -- flag to be returned separated from positional arguments ([#84](https://github.com/yargs/yargs-parser/issues/84)) ([2572ca8](https://github.com/yargs/yargs-parser/commit/2572ca8)) -* when parsing stops, we now populate "--" by default ([#88](https://github.com/yargs/yargs-parser/issues/88)) ([cd666db](https://github.com/yargs/yargs-parser/commit/cd666db)) - - -### BREAKING CHANGES - -* rather than placing arguments in "_", when parsing is stopped via "--"; we now populate an array called "--" by default. -* camelcase now requires Node 4+. -* environment variables will now override config files (args, env, config-file, config-object) - - - - -# [5.0.0](https://github.com/yargs/yargs-parser/compare/v4.2.1...v5.0.0) (2017-02-18) - - -### Bug Fixes - -* environment variables should take precedence over config file ([#81](https://github.com/yargs/yargs-parser/issues/81)) ([76cee1f](https://github.com/yargs/yargs-parser/commit/76cee1f)) - - -### BREAKING CHANGES - -* environment variables will now override config files (args, env, config-file, config-object) - - - - -## [4.2.1](https://github.com/yargs/yargs-parser/compare/v4.2.0...v4.2.1) (2017-01-02) - - -### Bug Fixes - -* flatten/duplicate regression ([#75](https://github.com/yargs/yargs-parser/issues/75)) ([68d68a0](https://github.com/yargs/yargs-parser/commit/68d68a0)) - - - - -# [4.2.0](https://github.com/yargs/yargs-parser/compare/v4.1.0...v4.2.0) (2016-12-01) - - -### Bug Fixes - -* inner objects in configs had their keys appended to top-level key when dot-notation was disabled ([#72](https://github.com/yargs/yargs-parser/issues/72)) ([0b1b5f9](https://github.com/yargs/yargs-parser/commit/0b1b5f9)) - - -### Features - -* allow multiple arrays to be provided, rather than always combining ([#71](https://github.com/yargs/yargs-parser/issues/71)) ([0f0fb2d](https://github.com/yargs/yargs-parser/commit/0f0fb2d)) - - - - -# [4.1.0](https://github.com/yargs/yargs-parser/compare/v4.0.2...v4.1.0) (2016-11-07) - - -### Features - -* apply coercions to default options ([#65](https://github.com/yargs/yargs-parser/issues/65)) ([c79052b](https://github.com/yargs/yargs-parser/commit/c79052b)) -* handle dot notation boolean options ([#63](https://github.com/yargs/yargs-parser/issues/63)) ([02c3545](https://github.com/yargs/yargs-parser/commit/02c3545)) - - - - -## [4.0.2](https://github.com/yargs/yargs-parser/compare/v4.0.1...v4.0.2) (2016-09-30) - - -### Bug Fixes - -* whoops, let's make the assign not change the Object key order ([29d069a](https://github.com/yargs/yargs-parser/commit/29d069a)) - - - - -## [4.0.1](https://github.com/yargs/yargs-parser/compare/v4.0.0...v4.0.1) (2016-09-30) - - -### Bug Fixes - -* lodash.assign was deprecated ([#59](https://github.com/yargs/yargs-parser/issues/59)) ([5e7eb11](https://github.com/yargs/yargs-parser/commit/5e7eb11)) - - - - -# [4.0.0](https://github.com/yargs/yargs-parser/compare/v3.2.0...v4.0.0) (2016-09-26) - - -### Bug Fixes - -* coerce should be applied to the final objects and arrays created ([#57](https://github.com/yargs/yargs-parser/issues/57)) ([4ca69da](https://github.com/yargs/yargs-parser/commit/4ca69da)) - - -### BREAKING CHANGES - -* coerce is no longer applied to individual arguments in an implicit array. - - - - -# [3.2.0](https://github.com/yargs/yargs-parser/compare/v3.1.0...v3.2.0) (2016-08-13) - - -### Features - -* coerce full array instead of each element ([#51](https://github.com/yargs/yargs-parser/issues/51)) ([cc4dc56](https://github.com/yargs/yargs-parser/commit/cc4dc56)) - - - - -# [3.1.0](https://github.com/yargs/yargs-parser/compare/v3.0.0...v3.1.0) (2016-08-09) - - -### Bug Fixes - -* address pkgConf parsing bug outlined in [#37](https://github.com/yargs/yargs-parser/issues/37) ([#45](https://github.com/yargs/yargs-parser/issues/45)) ([be76ee6](https://github.com/yargs/yargs-parser/commit/be76ee6)) -* better parsing of negative values ([#44](https://github.com/yargs/yargs-parser/issues/44)) ([2e43692](https://github.com/yargs/yargs-parser/commit/2e43692)) -* check aliases when guessing defaults for arguments fixes [#41](https://github.com/yargs/yargs-parser/issues/41) ([#43](https://github.com/yargs/yargs-parser/issues/43)) ([f3e4616](https://github.com/yargs/yargs-parser/commit/f3e4616)) - - -### Features - -* added coerce option, for providing specialized argument parsing ([#42](https://github.com/yargs/yargs-parser/issues/42)) ([7b49cd2](https://github.com/yargs/yargs-parser/commit/7b49cd2)) - - - - -# [3.0.0](https://github.com/yargs/yargs-parser/compare/v2.4.1...v3.0.0) (2016-08-07) - - -### Bug Fixes - -* parsing issue with numeric character in group of options ([#19](https://github.com/yargs/yargs-parser/issues/19)) ([f743236](https://github.com/yargs/yargs-parser/commit/f743236)) -* upgraded lodash.assign ([5d7fdf4](https://github.com/yargs/yargs-parser/commit/5d7fdf4)) - -### BREAKING CHANGES - -* subtle change to how values are parsed in a group of single-character arguments. -* _first released in 3.1.0, better handling of negative values should be considered a breaking change._ - - - - -## [2.4.1](https://github.com/yargs/yargs-parser/compare/v2.4.0...v2.4.1) (2016-07-16) - - -### Bug Fixes - -* **count:** do not increment a default value ([#39](https://github.com/yargs/yargs-parser/issues/39)) ([b04a189](https://github.com/yargs/yargs-parser/commit/b04a189)) - - - - -# [2.4.0](https://github.com/yargs/yargs-parser/compare/v2.3.0...v2.4.0) (2016-04-11) - - -### Features - -* **environment:** Support nested options in environment variables ([#26](https://github.com/yargs/yargs-parser/issues/26)) thanks [@elas7](https://github.com/elas7) \o/ ([020778b](https://github.com/yargs/yargs-parser/commit/020778b)) - - - - -# [2.3.0](https://github.com/yargs/yargs-parser/compare/v2.2.0...v2.3.0) (2016-04-09) - - -### Bug Fixes - -* **boolean:** fix for boolean options with non boolean defaults (#20) ([2dbe86b](https://github.com/yargs/yargs-parser/commit/2dbe86b)), closes [(#20](https://github.com/(/issues/20) -* **package:** remove tests from tarball ([0353c0d](https://github.com/yargs/yargs-parser/commit/0353c0d)) -* **parsing:** handle calling short option with an empty string as the next value. ([a867165](https://github.com/yargs/yargs-parser/commit/a867165)) -* boolean flag when next value contains the strings 'true' or 'false'. ([69941a6](https://github.com/yargs/yargs-parser/commit/69941a6)) -* update dependencies; add standard-version bin for next release (#24) ([822d9d5](https://github.com/yargs/yargs-parser/commit/822d9d5)) - -### Features - -* **configuration:** Allow to pass configuration objects to yargs-parser ([0780900](https://github.com/yargs/yargs-parser/commit/0780900)) -* **normalize:** allow normalize to work with arrays ([e0eaa1a](https://github.com/yargs/yargs-parser/commit/e0eaa1a)) diff --git a/node_modules/yargs-parser/LICENSE.txt b/node_modules/yargs-parser/LICENSE.txt deleted file mode 100644 index 836440b..0000000 --- a/node_modules/yargs-parser/LICENSE.txt +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2016, Contributors - -Permission to use, copy, modify, and/or distribute this software -for any purpose with or without fee is hereby granted, provided -that the above copyright notice and this permission notice -appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE -LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/yargs-parser/README.md b/node_modules/yargs-parser/README.md deleted file mode 100644 index bae61c2..0000000 --- a/node_modules/yargs-parser/README.md +++ /dev/null @@ -1,449 +0,0 @@ -# yargs-parser - -[![Build Status](https://travis-ci.org/yargs/yargs-parser.svg)](https://travis-ci.org/yargs/yargs-parser) -[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser) -[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) - - -The mighty option parser used by [yargs](https://github.com/yargs/yargs). - -visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions. - - - -## Example - -```sh -npm i yargs-parser --save -``` - -```js -var argv = require('yargs-parser')(process.argv.slice(2)) -console.log(argv) -``` - -```sh -node example.js --foo=33 --bar hello -{ _: [], foo: 33, bar: 'hello' } -``` - -_or parse a string!_ - -```js -var argv = require('yargs-parser')('--foo=99 --bar=33') -console.log(argv) -``` - -```sh -{ _: [], foo: 99, bar: 33 } -``` - -Convert an array of mixed types before passing to `yargs-parser`: - -```js -var parse = require('yargs-parser') -parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string -parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings -``` - -## API - -### require('yargs-parser')(args, opts={}) - -Parses command line arguments returning a simple mapping of keys and values. - -**expects:** - -* `args`: a string or array of strings representing the options to parse. -* `opts`: provide a set of hints indicating how `args` should be parsed: - * `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`. - * `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.
- Indicate that keys should be parsed as an array and coerced to booleans / numbers:
- `{array: [{ key: 'foo', boolean: true }, {key: 'bar', number: true}]}`. - * `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`. - * `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided - (or throws an error). For arrays the function is called only once for the entire array:
- `{coerce: {foo: function (arg) {return modifiedArg}}}`. - * `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed). - * `opts.configObjects`: configuration objects to parse, their properties will be set as arguments:
- `{configObjects: [{'x': 5, 'y': 33}, {'z': 44}]}`. - * `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)). - * `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`. - * `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`. - * `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed. - * `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`. - * `opts.normalize`: `path.normalize()` will be applied to values set to this key. - * `opts.number`: keys should be treated as numbers. - * `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`). - -**returns:** - -* `obj`: an object representing the parsed value of `args` - * `key/value`: key value pairs for each argument and their aliases. - * `_`: an array representing the positional arguments. - * [optional] `--`: an array with arguments after the end-of-options flag `--`. - -### require('yargs-parser').detailed(args, opts={}) - -Parses a command line string, returning detailed information required by the -yargs engine. - -**expects:** - -* `args`: a string or array of strings representing options to parse. -* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`. - -**returns:** - -* `argv`: an object representing the parsed value of `args` - * `key/value`: key value pairs for each argument and their aliases. - * `_`: an array representing the positional arguments. - * [optional] `--`: an array with arguments after the end-of-options flag `--`. -* `error`: populated with an error object if an exception occurred during parsing. -* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`. -* `newAliases`: any new aliases added via camel-case expansion: - * `boolean`: `{ fooBar: true }` -* `defaulted`: any new argument created by `opts.default`, no aliases included. - * `boolean`: `{ foo: true }` -* `configuration`: given by default settings and `opts.configuration`. - - - -### Configuration - -The yargs-parser applies several automated transformations on the keys provided -in `args`. These features can be turned on and off using the `configuration` field -of `opts`. - -```js -var parsed = parser(['--no-dice'], { - configuration: { - 'boolean-negation': false - } -}) -``` - -### short option groups - -* default: `true`. -* key: `short-option-groups`. - -Should a group of short-options be treated as boolean flags? - -```sh -node example.js -abc -{ _: [], a: true, b: true, c: true } -``` - -_if disabled:_ - -```sh -node example.js -abc -{ _: [], abc: true } -``` - -### camel-case expansion - -* default: `true`. -* key: `camel-case-expansion`. - -Should hyphenated arguments be expanded into camel-case aliases? - -```sh -node example.js --foo-bar -{ _: [], 'foo-bar': true, fooBar: true } -``` - -_if disabled:_ - -```sh -node example.js --foo-bar -{ _: [], 'foo-bar': true } -``` - -### dot-notation - -* default: `true` -* key: `dot-notation` - -Should keys that contain `.` be treated as objects? - -```sh -node example.js --foo.bar -{ _: [], foo: { bar: true } } -``` - -_if disabled:_ - -```sh -node example.js --foo.bar -{ _: [], "foo.bar": true } -``` - -### parse numbers - -* default: `true` -* key: `parse-numbers` - -Should keys that look like numbers be treated as such? - -```sh -node example.js --foo=99.3 -{ _: [], foo: 99.3 } -``` - -_if disabled:_ - -```sh -node example.js --foo=99.3 -{ _: [], foo: "99.3" } -``` - -### boolean negation - -* default: `true` -* key: `boolean-negation` - -Should variables prefixed with `--no` be treated as negations? - -```sh -node example.js --no-foo -{ _: [], foo: false } -``` - -_if disabled:_ - -```sh -node example.js --no-foo -{ _: [], "no-foo": true } -``` - -### combine arrays - -* default: `false` -* key: `combine-arrays` - -Should arrays be combined when provided by both command line arguments and -a configuration file. - -### duplicate arguments array - -* default: `true` -* key: `duplicate-arguments-array` - -Should arguments be coerced into an array when duplicated: - -```sh -node example.js -x 1 -x 2 -{ _: [], x: [1, 2] } -``` - -_if disabled:_ - -```sh -node example.js -x 1 -x 2 -{ _: [], x: 2 } -``` - -### flatten duplicate arrays - -* default: `true` -* key: `flatten-duplicate-arrays` - -Should array arguments be coerced into a single array when duplicated: - -```sh -node example.js -x 1 2 -x 3 4 -{ _: [], x: [1, 2, 3, 4] } -``` - -_if disabled:_ - -```sh -node example.js -x 1 2 -x 3 4 -{ _: [], x: [[1, 2], [3, 4]] } -``` - -### greedy arrays - -* default: `true` -* key: `greedy-arrays` - -Should arrays consume more than one positional argument following their flag. - -```sh -node example --arr 1 2 -{ _[], arr: [1, 2] } -``` - -_if disabled:_ - -```sh -node example --arr 1 2 -{ _[2], arr: [1] } -``` - -**Note: in `v18.0.0` we are considering defaulting greedy arrays to `false`.** - -### nargs eats options - -* default: `false` -* key: `nargs-eats-options` - -Should nargs consume dash options as well as positional arguments. - -### negation prefix - -* default: `no-` -* key: `negation-prefix` - -The prefix to use for negated boolean variables. - -```sh -node example.js --no-foo -{ _: [], foo: false } -``` - -_if set to `quux`:_ - -```sh -node example.js --quuxfoo -{ _: [], foo: false } -``` - -### populate -- - -* default: `false`. -* key: `populate--` - -Should unparsed flags be stored in `--` or `_`. - -_If disabled:_ - -```sh -node example.js a -b -- x y -{ _: [ 'a', 'x', 'y' ], b: true } -``` - -_If enabled:_ - -```sh -node example.js a -b -- x y -{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true } -``` - -### set placeholder key - -* default: `false`. -* key: `set-placeholder-key`. - -Should a placeholder be added for keys not set via the corresponding CLI argument? - -_If disabled:_ - -```sh -node example.js -a 1 -c 2 -{ _: [], a: 1, c: 2 } -``` - -_If enabled:_ - -```sh -node example.js -a 1 -c 2 -{ _: [], a: 1, b: undefined, c: 2 } -``` - -### halt at non-option - -* default: `false`. -* key: `halt-at-non-option`. - -Should parsing stop at the first positional argument? This is similar to how e.g. `ssh` parses its command line. - -_If disabled:_ - -```sh -node example.js -a run b -x y -{ _: [ 'b' ], a: 'run', x: 'y' } -``` - -_If enabled:_ - -```sh -node example.js -a run b -x y -{ _: [ 'b', '-x', 'y' ], a: 'run' } -``` - -### strip aliased - -* default: `false` -* key: `strip-aliased` - -Should aliases be removed before returning results? - -_If disabled:_ - -```sh -node example.js --test-field 1 -{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 } -``` - -_If enabled:_ - -```sh -node example.js --test-field 1 -{ _: [], 'test-field': 1, testField: 1 } -``` - -### strip dashed - -* default: `false` -* key: `strip-dashed` - -Should dashed keys be removed before returning results? This option has no effect if -`camel-case-expansion` is disabled. - -_If disabled:_ - -```sh -node example.js --test-field 1 -{ _: [], 'test-field': 1, testField: 1 } -``` - -_If enabled:_ - -```sh -node example.js --test-field 1 -{ _: [], testField: 1 } -``` - -### unknown options as args - -* default: `false` -* key: `unknown-options-as-args` - -Should unknown options be treated like regular arguments? An unknown option is one that is not -configured in `opts`. - -_If disabled_ - -```sh -node example.js --unknown-option --known-option 2 --string-option --unknown-option2 -{ _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true } -``` - -_If enabled_ - -```sh -node example.js --unknown-option --known-option 2 --string-option --unknown-option2 -{ _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' } -``` - -## Special Thanks - -The yargs project evolves from optimist and minimist. It owes its -existence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \o/ - -## License - -ISC diff --git a/node_modules/yargs-parser/index.js b/node_modules/yargs-parser/index.js deleted file mode 100644 index c14c1fc..0000000 --- a/node_modules/yargs-parser/index.js +++ /dev/null @@ -1,1032 +0,0 @@ -const camelCase = require('camelcase') -const decamelize = require('decamelize') -const path = require('path') -const tokenizeArgString = require('./lib/tokenize-arg-string') -const util = require('util') - -function parse (args, opts) { - opts = Object.assign(Object.create(null), opts) - // allow a string argument to be passed in rather - // than an argv array. - args = tokenizeArgString(args) - - // aliases might have transitive relationships, normalize this. - const aliases = combineAliases(Object.assign(Object.create(null), opts.alias)) - const configuration = Object.assign({ - 'boolean-negation': true, - 'camel-case-expansion': true, - 'combine-arrays': false, - 'dot-notation': true, - 'duplicate-arguments-array': true, - 'flatten-duplicate-arrays': true, - 'greedy-arrays': true, - 'halt-at-non-option': false, - 'nargs-eats-options': false, - 'negation-prefix': 'no-', - 'parse-numbers': true, - 'populate--': false, - 'set-placeholder-key': false, - 'short-option-groups': true, - 'strip-aliased': false, - 'strip-dashed': false, - 'unknown-options-as-args': false - }, opts.configuration) - const defaults = Object.assign(Object.create(null), opts.default) - const configObjects = opts.configObjects || [] - const envPrefix = opts.envPrefix - const notFlagsOption = configuration['populate--'] - const notFlagsArgv = notFlagsOption ? '--' : '_' - const newAliases = Object.create(null) - const defaulted = Object.create(null) - // allow a i18n handler to be passed in, default to a fake one (util.format). - const __ = opts.__ || util.format - const flags = { - aliases: Object.create(null), - arrays: Object.create(null), - bools: Object.create(null), - strings: Object.create(null), - numbers: Object.create(null), - counts: Object.create(null), - normalize: Object.create(null), - configs: Object.create(null), - nargs: Object.create(null), - coercions: Object.create(null), - keys: [] - } - const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/ - const negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)') - - ;[].concat(opts.array).filter(Boolean).forEach(function (opt) { - const key = opt.key || opt - - // assign to flags[bools|strings|numbers] - const assignment = Object.keys(opt).map(function (key) { - return ({ - boolean: 'bools', - string: 'strings', - number: 'numbers' - })[key] - }).filter(Boolean).pop() - - // assign key to be coerced - if (assignment) { - flags[assignment][key] = true - } - - flags.arrays[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.boolean).filter(Boolean).forEach(function (key) { - flags.bools[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.string).filter(Boolean).forEach(function (key) { - flags.strings[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.number).filter(Boolean).forEach(function (key) { - flags.numbers[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.count).filter(Boolean).forEach(function (key) { - flags.counts[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.normalize).filter(Boolean).forEach(function (key) { - flags.normalize[key] = true - flags.keys.push(key) - }) - - Object.keys(opts.narg || {}).forEach(function (k) { - flags.nargs[k] = opts.narg[k] - flags.keys.push(k) - }) - - Object.keys(opts.coerce || {}).forEach(function (k) { - flags.coercions[k] = opts.coerce[k] - flags.keys.push(k) - }) - - if (Array.isArray(opts.config) || typeof opts.config === 'string') { - ;[].concat(opts.config).filter(Boolean).forEach(function (key) { - flags.configs[key] = true - }) - } else { - Object.keys(opts.config || {}).forEach(function (k) { - flags.configs[k] = opts.config[k] - }) - } - - // create a lookup table that takes into account all - // combinations of aliases: {f: ['foo'], foo: ['f']} - extendAliases(opts.key, aliases, opts.default, flags.arrays) - - // apply default values to all aliases. - Object.keys(defaults).forEach(function (key) { - (flags.aliases[key] || []).forEach(function (alias) { - defaults[alias] = defaults[key] - }) - }) - - let error = null - checkConfiguration() - - let notFlags = [] - - const argv = Object.assign(Object.create(null), { _: [] }) - // TODO(bcoe): for the first pass at removing object prototype we didn't - // remove all prototypes from objects returned by this API, we might want - // to gradually move towards doing so. - const argvReturn = {} - - for (let i = 0; i < args.length; i++) { - const arg = args[i] - let broken - let key - let letters - let m - let next - let value - - // any unknown option (except for end-of-options, "--") - if (arg !== '--' && isUnknownOptionAsArg(arg)) { - argv._.push(arg) - // -- separated by = - } else if (arg.match(/^--.+=/) || ( - !configuration['short-option-groups'] && arg.match(/^-.+=/) - )) { - // Using [\s\S] instead of . because js doesn't support the - // 'dotall' regex modifier. See: - // http://stackoverflow.com/a/1068308/13216 - m = arg.match(/^--?([^=]+)=([\s\S]*)$/) - - // arrays format = '--f=a b c' - if (checkAllAliases(m[1], flags.arrays)) { - i = eatArray(i, m[1], args, m[2]) - } else if (checkAllAliases(m[1], flags.nargs) !== false) { - // nargs format = '--f=monkey washing cat' - i = eatNargs(i, m[1], args, m[2]) - } else { - setArg(m[1], m[2]) - } - } else if (arg.match(negatedBoolean) && configuration['boolean-negation']) { - key = arg.match(negatedBoolean)[1] - setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false) - - // -- separated by space. - } else if (arg.match(/^--.+/) || ( - !configuration['short-option-groups'] && arg.match(/^-[^-]+/) - )) { - key = arg.match(/^--?(.+)/)[1] - - if (checkAllAliases(key, flags.arrays)) { - // array format = '--foo a b c' - i = eatArray(i, key, args) - } else if (checkAllAliases(key, flags.nargs) !== false) { - // nargs format = '--foo a b c' - // should be truthy even if: flags.nargs[key] === 0 - i = eatNargs(i, key, args) - } else { - next = args[i + 1] - - if (next !== undefined && (!next.match(/^-/) || - next.match(negative)) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next) - i++ - } else if (/^(true|false)$/.test(next)) { - setArg(key, next) - i++ - } else { - setArg(key, defaultValue(key)) - } - } - - // dot-notation flag separated by '='. - } else if (arg.match(/^-.\..+=/)) { - m = arg.match(/^-([^=]+)=([\s\S]*)$/) - setArg(m[1], m[2]) - - // dot-notation flag separated by space. - } else if (arg.match(/^-.\..+/) && !arg.match(negative)) { - next = args[i + 1] - key = arg.match(/^-(.\..+)/)[1] - - if (next !== undefined && !next.match(/^-/) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next) - i++ - } else { - setArg(key, defaultValue(key)) - } - } else if (arg.match(/^-[^-]+/) && !arg.match(negative)) { - letters = arg.slice(1, -1).split('') - broken = false - - for (let j = 0; j < letters.length; j++) { - next = arg.slice(j + 2) - - if (letters[j + 1] && letters[j + 1] === '=') { - value = arg.slice(j + 3) - key = letters[j] - - if (checkAllAliases(key, flags.arrays)) { - // array format = '-f=a b c' - i = eatArray(i, key, args, value) - } else if (checkAllAliases(key, flags.nargs) !== false) { - // nargs format = '-f=monkey washing cat' - i = eatNargs(i, key, args, value) - } else { - setArg(key, value) - } - - broken = true - break - } - - if (next === '-') { - setArg(letters[j], next) - continue - } - - // current letter is an alphabetic character and next value is a number - if (/[A-Za-z]/.test(letters[j]) && - /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { - setArg(letters[j], next) - broken = true - break - } - - if (letters[j + 1] && letters[j + 1].match(/\W/)) { - setArg(letters[j], next) - broken = true - break - } else { - setArg(letters[j], defaultValue(letters[j])) - } - } - - key = arg.slice(-1)[0] - - if (!broken && key !== '-') { - if (checkAllAliases(key, flags.arrays)) { - // array format = '-f a b c' - i = eatArray(i, key, args) - } else if (checkAllAliases(key, flags.nargs) !== false) { - // nargs format = '-f a b c' - // should be truthy even if: flags.nargs[key] === 0 - i = eatNargs(i, key, args) - } else { - next = args[i + 1] - - if (next !== undefined && (!/^(-|--)[^-]/.test(next) || - next.match(negative)) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next) - i++ - } else if (/^(true|false)$/.test(next)) { - setArg(key, next) - i++ - } else { - setArg(key, defaultValue(key)) - } - } - } - } else if (arg.match(/^-[0-9]$/) && - arg.match(negative) && - checkAllAliases(arg.slice(1), flags.bools)) { - // single-digit boolean alias, e.g: xargs -0 - key = arg.slice(1) - setArg(key, defaultValue(key)) - } else if (arg === '--') { - notFlags = args.slice(i + 1) - break - } else if (configuration['halt-at-non-option']) { - notFlags = args.slice(i) - break - } else { - argv._.push(maybeCoerceNumber('_', arg)) - } - } - - // order of precedence: - // 1. command line arg - // 2. value from env var - // 3. value from config file - // 4. value from config objects - // 5. configured default value - applyEnvVars(argv, true) // special case: check env vars that point to config file - applyEnvVars(argv, false) - setConfig(argv) - setConfigObjects() - applyDefaultsAndAliases(argv, flags.aliases, defaults, true) - applyCoercions(argv) - if (configuration['set-placeholder-key']) setPlaceholderKeys(argv) - - // for any counts either not in args or without an explicit default, set to 0 - Object.keys(flags.counts).forEach(function (key) { - if (!hasKey(argv, key.split('.'))) setArg(key, 0) - }) - - // '--' defaults to undefined. - if (notFlagsOption && notFlags.length) argv[notFlagsArgv] = [] - notFlags.forEach(function (key) { - argv[notFlagsArgv].push(key) - }) - - if (configuration['camel-case-expansion'] && configuration['strip-dashed']) { - Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => { - delete argv[key] - }) - } - - if (configuration['strip-aliased']) { - ;[].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => { - if (configuration['camel-case-expansion']) { - delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')] - } - - delete argv[alias] - }) - } - - // how many arguments should we consume, based - // on the nargs option? - function eatNargs (i, key, args, argAfterEqualSign) { - let ii - let toEat = checkAllAliases(key, flags.nargs) - // NaN has a special meaning for the array type, indicating that one or - // more values are expected. - toEat = isNaN(toEat) ? 1 : toEat - - if (toEat === 0) { - if (!isUndefined(argAfterEqualSign)) { - error = Error(__('Argument unexpected for: %s', key)) - } - setArg(key, defaultValue(key)) - return i - } - - let available = isUndefined(argAfterEqualSign) ? 0 : 1 - if (configuration['nargs-eats-options']) { - // classic behavior, yargs eats positional and dash arguments. - if (args.length - (i + 1) + available < toEat) { - error = Error(__('Not enough arguments following: %s', key)) - } - available = toEat - } else { - // nargs will not consume flag arguments, e.g., -abc, --foo, - // and terminates when one is observed. - for (ii = i + 1; ii < args.length; ii++) { - if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii])) available++ - else break - } - if (available < toEat) error = Error(__('Not enough arguments following: %s', key)) - } - - let consumed = Math.min(available, toEat) - if (!isUndefined(argAfterEqualSign) && consumed > 0) { - setArg(key, argAfterEqualSign) - consumed-- - } - for (ii = i + 1; ii < (consumed + i + 1); ii++) { - setArg(key, args[ii]) - } - - return (i + consumed) - } - - // if an option is an array, eat all non-hyphenated arguments - // following it... YUM! - // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"] - function eatArray (i, key, args, argAfterEqualSign) { - let argsToSet = [] - let next = argAfterEqualSign || args[i + 1] - // If both array and nargs are configured, enforce the nargs count: - const nargsCount = checkAllAliases(key, flags.nargs) - - if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) { - argsToSet.push(true) - } else if (isUndefined(next) || - (isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))) { - // for keys without value ==> argsToSet remains an empty [] - // set user default value, if available - if (defaults[key] !== undefined) { - const defVal = defaults[key] - argsToSet = Array.isArray(defVal) ? defVal : [defVal] - } - } else { - // value in --option=value is eaten as is - if (!isUndefined(argAfterEqualSign)) { - argsToSet.push(processValue(key, argAfterEqualSign)) - } - for (let ii = i + 1; ii < args.length; ii++) { - if ((!configuration['greedy-arrays'] && argsToSet.length > 0) || - (nargsCount && argsToSet.length >= nargsCount)) break - next = args[ii] - if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next)) break - i = ii - argsToSet.push(processValue(key, next)) - } - } - - // If both array and nargs are configured, create an error if less than - // nargs positionals were found. NaN has special meaning, indicating - // that at least one value is required (more are okay). - if ((nargsCount && argsToSet.length < nargsCount) || - (isNaN(nargsCount) && argsToSet.length === 0)) { - error = Error(__('Not enough arguments following: %s', key)) - } - - setArg(key, argsToSet) - return i - } - - function setArg (key, val) { - if (/-/.test(key) && configuration['camel-case-expansion']) { - const alias = key.split('.').map(function (prop) { - return camelCase(prop) - }).join('.') - addNewAlias(key, alias) - } - - const value = processValue(key, val) - const splitKey = key.split('.') - setKey(argv, splitKey, value) - - // handle populating aliases of the full key - if (flags.aliases[key]) { - flags.aliases[key].forEach(function (x) { - x = x.split('.') - setKey(argv, x, value) - }) - } - - // handle populating aliases of the first element of the dot-notation key - if (splitKey.length > 1 && configuration['dot-notation']) { - ;(flags.aliases[splitKey[0]] || []).forEach(function (x) { - x = x.split('.') - - // expand alias with nested objects in key - const a = [].concat(splitKey) - a.shift() // nuke the old key. - x = x.concat(a) - - // populate alias only if is not already an alias of the full key - // (already populated above) - if (!(flags.aliases[key] || []).includes(x.join('.'))) { - setKey(argv, x, value) - } - }) - } - - // Set normalize getter and setter when key is in 'normalize' but isn't an array - if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) { - const keys = [key].concat(flags.aliases[key] || []) - keys.forEach(function (key) { - Object.defineProperty(argvReturn, key, { - enumerable: true, - get () { - return val - }, - set (value) { - val = typeof value === 'string' ? path.normalize(value) : value - } - }) - }) - } - } - - function addNewAlias (key, alias) { - if (!(flags.aliases[key] && flags.aliases[key].length)) { - flags.aliases[key] = [alias] - newAliases[alias] = true - } - if (!(flags.aliases[alias] && flags.aliases[alias].length)) { - addNewAlias(alias, key) - } - } - - function processValue (key, val) { - // strings may be quoted, clean this up as we assign values. - if (typeof val === 'string' && - (val[0] === "'" || val[0] === '"') && - val[val.length - 1] === val[0] - ) { - val = val.substring(1, val.length - 1) - } - - // handle parsing boolean arguments --foo=true --bar false. - if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) { - if (typeof val === 'string') val = val === 'true' - } - - let value = Array.isArray(val) - ? val.map(function (v) { return maybeCoerceNumber(key, v) }) - : maybeCoerceNumber(key, val) - - // increment a count given as arg (either no value or value parsed as boolean) - if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) { - value = increment - } - - // Set normalized value when key is in 'normalize' and in 'arrays' - if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) { - if (Array.isArray(val)) value = val.map(path.normalize) - else value = path.normalize(val) - } - return value - } - - function maybeCoerceNumber (key, value) { - if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) { - const shouldCoerceNumber = isNumber(value) && configuration['parse-numbers'] && ( - Number.isSafeInteger(Math.floor(value)) - ) - if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) value = Number(value) - } - return value - } - - // set args from config.json file, this should be - // applied last so that defaults can be applied. - function setConfig (argv) { - const configLookup = Object.create(null) - - // expand defaults/aliases, in-case any happen to reference - // the config.json file. - applyDefaultsAndAliases(configLookup, flags.aliases, defaults) - - Object.keys(flags.configs).forEach(function (configKey) { - const configPath = argv[configKey] || configLookup[configKey] - if (configPath) { - try { - let config = null - const resolvedConfigPath = path.resolve(process.cwd(), configPath) - - if (typeof flags.configs[configKey] === 'function') { - try { - config = flags.configs[configKey](resolvedConfigPath) - } catch (e) { - config = e - } - if (config instanceof Error) { - error = config - return - } - } else { - config = require(resolvedConfigPath) - } - - setConfigObject(config) - } catch (ex) { - if (argv[configKey]) error = Error(__('Invalid JSON config file: %s', configPath)) - } - } - }) - } - - // set args from config object. - // it recursively checks nested objects. - function setConfigObject (config, prev) { - Object.keys(config).forEach(function (key) { - const value = config[key] - const fullKey = prev ? prev + '.' + key : key - - // if the value is an inner object and we have dot-notation - // enabled, treat inner objects in config the same as - // heavily nested dot notations (foo.bar.apple). - if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) { - // if the value is an object but not an array, check nested object - setConfigObject(value, fullKey) - } else { - // setting arguments via CLI takes precedence over - // values within the config file. - if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) { - setArg(fullKey, value) - } - } - }) - } - - // set all config objects passed in opts - function setConfigObjects () { - if (typeof configObjects === 'undefined') return - configObjects.forEach(function (configObject) { - setConfigObject(configObject) - }) - } - - function applyEnvVars (argv, configOnly) { - if (typeof envPrefix === 'undefined') return - - const prefix = typeof envPrefix === 'string' ? envPrefix : '' - Object.keys(process.env).forEach(function (envVar) { - if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) { - // get array of nested keys and convert them to camel case - const keys = envVar.split('__').map(function (key, i) { - if (i === 0) { - key = key.substring(prefix.length) - } - return camelCase(key) - }) - - if (((configOnly && flags.configs[keys.join('.')]) || !configOnly) && !hasKey(argv, keys)) { - setArg(keys.join('.'), process.env[envVar]) - } - } - }) - } - - function applyCoercions (argv) { - let coerce - const applied = new Set() - Object.keys(argv).forEach(function (key) { - if (!applied.has(key)) { // If we haven't already coerced this option via one of its aliases - coerce = checkAllAliases(key, flags.coercions) - if (typeof coerce === 'function') { - try { - const value = maybeCoerceNumber(key, coerce(argv[key])) - ;([].concat(flags.aliases[key] || [], key)).forEach(ali => { - applied.add(ali) - argv[ali] = value - }) - } catch (err) { - error = err - } - } - } - }) - } - - function setPlaceholderKeys (argv) { - flags.keys.forEach((key) => { - // don't set placeholder keys for dot notation options 'foo.bar'. - if (~key.indexOf('.')) return - if (typeof argv[key] === 'undefined') argv[key] = undefined - }) - return argv - } - - function applyDefaultsAndAliases (obj, aliases, defaults, canLog = false) { - Object.keys(defaults).forEach(function (key) { - if (!hasKey(obj, key.split('.'))) { - setKey(obj, key.split('.'), defaults[key]) - if (canLog) defaulted[key] = true - - ;(aliases[key] || []).forEach(function (x) { - if (hasKey(obj, x.split('.'))) return - setKey(obj, x.split('.'), defaults[key]) - }) - } - }) - } - - function hasKey (obj, keys) { - let o = obj - - if (!configuration['dot-notation']) keys = [keys.join('.')] - - keys.slice(0, -1).forEach(function (key) { - o = (o[key] || {}) - }) - - const key = keys[keys.length - 1] - - if (typeof o !== 'object') return false - else return key in o - } - - function setKey (obj, keys, value) { - let o = obj - - if (!configuration['dot-notation']) keys = [keys.join('.')] - - keys.slice(0, -1).forEach(function (key, index) { - // TODO(bcoe): in the next major version of yargs, switch to - // Object.create(null) for dot notation: - key = sanitizeKey(key) - - if (typeof o === 'object' && o[key] === undefined) { - o[key] = {} - } - - if (typeof o[key] !== 'object' || Array.isArray(o[key])) { - // ensure that o[key] is an array, and that the last item is an empty object. - if (Array.isArray(o[key])) { - o[key].push({}) - } else { - o[key] = [o[key], {}] - } - - // we want to update the empty object at the end of the o[key] array, so set o to that object - o = o[key][o[key].length - 1] - } else { - o = o[key] - } - }) - - // TODO(bcoe): in the next major version of yargs, switch to - // Object.create(null) for dot notation: - const key = sanitizeKey(keys[keys.length - 1]) - - const isTypeArray = checkAllAliases(keys.join('.'), flags.arrays) - const isValueArray = Array.isArray(value) - let duplicate = configuration['duplicate-arguments-array'] - - // nargs has higher priority than duplicate - if (!duplicate && checkAllAliases(key, flags.nargs)) { - duplicate = true - if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) { - o[key] = undefined - } - } - - if (value === increment) { - o[key] = increment(o[key]) - } else if (Array.isArray(o[key])) { - if (duplicate && isTypeArray && isValueArray) { - o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]) - } else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) { - o[key] = value - } else { - o[key] = o[key].concat([value]) - } - } else if (o[key] === undefined && isTypeArray) { - o[key] = isValueArray ? value : [value] - } else if (duplicate && !( - o[key] === undefined || - checkAllAliases(key, flags.counts) || - checkAllAliases(key, flags.bools) - )) { - o[key] = [o[key], value] - } else { - o[key] = value - } - } - - // extend the aliases list with inferred aliases. - function extendAliases (...args) { - args.forEach(function (obj) { - Object.keys(obj || {}).forEach(function (key) { - // short-circuit if we've already added a key - // to the aliases array, for example it might - // exist in both 'opts.default' and 'opts.key'. - if (flags.aliases[key]) return - - flags.aliases[key] = [].concat(aliases[key] || []) - // For "--option-name", also set argv.optionName - flags.aliases[key].concat(key).forEach(function (x) { - if (/-/.test(x) && configuration['camel-case-expansion']) { - const c = camelCase(x) - if (c !== key && flags.aliases[key].indexOf(c) === -1) { - flags.aliases[key].push(c) - newAliases[c] = true - } - } - }) - // For "--optionName", also set argv['option-name'] - flags.aliases[key].concat(key).forEach(function (x) { - if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) { - const c = decamelize(x, '-') - if (c !== key && flags.aliases[key].indexOf(c) === -1) { - flags.aliases[key].push(c) - newAliases[c] = true - } - } - }) - flags.aliases[key].forEach(function (x) { - flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) { - return x !== y - })) - }) - }) - }) - } - - // return the 1st set flag for any of a key's aliases (or false if no flag set) - function checkAllAliases (key, flag) { - const toCheck = [].concat(flags.aliases[key] || [], key) - const keys = Object.keys(flag) - const setAlias = toCheck.find(key => keys.includes(key)) - return setAlias ? flag[setAlias] : false - } - - function hasAnyFlag (key) { - const toCheck = [].concat(Object.keys(flags).map(k => flags[k])) - return toCheck.some(function (flag) { - return Array.isArray(flag) ? flag.includes(key) : flag[key] - }) - } - - function hasFlagsMatching (arg, ...patterns) { - const toCheck = [].concat(...patterns) - return toCheck.some(function (pattern) { - const match = arg.match(pattern) - return match && hasAnyFlag(match[1]) - }) - } - - // based on a simplified version of the short flag group parsing logic - function hasAllShortFlags (arg) { - // if this is a negative number, or doesn't start with a single hyphen, it's not a short flag group - if (arg.match(negative) || !arg.match(/^-[^-]+/)) { return false } - let hasAllFlags = true - let next - const letters = arg.slice(1).split('') - for (let j = 0; j < letters.length; j++) { - next = arg.slice(j + 2) - - if (!hasAnyFlag(letters[j])) { - hasAllFlags = false - break - } - - if ((letters[j + 1] && letters[j + 1] === '=') || - next === '-' || - (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) || - (letters[j + 1] && letters[j + 1].match(/\W/))) { - break - } - } - return hasAllFlags - } - - function isUnknownOptionAsArg (arg) { - return configuration['unknown-options-as-args'] && isUnknownOption(arg) - } - - function isUnknownOption (arg) { - // ignore negative numbers - if (arg.match(negative)) { return false } - // if this is a short option group and all of them are configured, it isn't unknown - if (hasAllShortFlags(arg)) { return false } - // e.g. '--count=2' - const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/ - // e.g. '-a' or '--arg' - const normalFlag = /^-+([^=]+?)$/ - // e.g. '-a-' - const flagEndingInHyphen = /^-+([^=]+?)-$/ - // e.g. '-abc123' - const flagEndingInDigits = /^-+([^=]+?\d+)$/ - // e.g. '-a/usr/local' - const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/ - // check the different types of flag styles, including negatedBoolean, a pattern defined near the start of the parse method - return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters) - } - - // make a best effor to pick a default value - // for an option based on name and type. - function defaultValue (key) { - if (!checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts) && - `${key}` in defaults) { - return defaults[key] - } else { - return defaultForType(guessType(key)) - } - } - - // return a default value, given the type of a flag., - // e.g., key of type 'string' will default to '', rather than 'true'. - function defaultForType (type) { - const def = { - boolean: true, - string: '', - number: undefined, - array: [] - } - - return def[type] - } - - // given a flag, enforce a default type. - function guessType (key) { - let type = 'boolean' - if (checkAllAliases(key, flags.strings)) type = 'string' - else if (checkAllAliases(key, flags.numbers)) type = 'number' - else if (checkAllAliases(key, flags.bools)) type = 'boolean' - else if (checkAllAliases(key, flags.arrays)) type = 'array' - return type - } - - function isNumber (x) { - if (x === null || x === undefined) return false - // if loaded from config, may already be a number. - if (typeof x === 'number') return true - // hexadecimal. - if (/^0x[0-9a-f]+$/i.test(x)) return true - // don't treat 0123 as a number; as it drops the leading '0'. - if (x.length > 1 && x[0] === '0') return false - return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x) - } - - function isUndefined (num) { - return num === undefined - } - - // check user configuration settings for inconsistencies - function checkConfiguration () { - // count keys should not be set as array/narg - Object.keys(flags.counts).find(key => { - if (checkAllAliases(key, flags.arrays)) { - error = Error(__('Invalid configuration: %s, opts.count excludes opts.array.', key)) - return true - } else if (checkAllAliases(key, flags.nargs)) { - error = Error(__('Invalid configuration: %s, opts.count excludes opts.narg.', key)) - return true - } - }) - } - - return { - argv: Object.assign(argvReturn, argv), - error: error, - aliases: Object.assign({}, flags.aliases), - newAliases: Object.assign({}, newAliases), - defaulted: Object.assign({}, defaulted), - configuration: configuration - } -} - -// if any aliases reference each other, we should -// merge them together. -function combineAliases (aliases) { - const aliasArrays = [] - const combined = Object.create(null) - let change = true - - // turn alias lookup hash {key: ['alias1', 'alias2']} into - // a simple array ['key', 'alias1', 'alias2'] - Object.keys(aliases).forEach(function (key) { - aliasArrays.push( - [].concat(aliases[key], key) - ) - }) - - // combine arrays until zero changes are - // made in an iteration. - while (change) { - change = false - for (let i = 0; i < aliasArrays.length; i++) { - for (let ii = i + 1; ii < aliasArrays.length; ii++) { - const intersect = aliasArrays[i].filter(function (v) { - return aliasArrays[ii].indexOf(v) !== -1 - }) - - if (intersect.length) { - aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]) - aliasArrays.splice(ii, 1) - change = true - break - } - } - } - } - - // map arrays back to the hash-lookup (de-dupe while - // we're at it). - aliasArrays.forEach(function (aliasArray) { - aliasArray = aliasArray.filter(function (v, i, self) { - return self.indexOf(v) === i - }) - combined[aliasArray.pop()] = aliasArray - }) - - return combined -} - -// this function should only be called when a count is given as an arg -// it is NOT called to set a default value -// thus we can start the count at 1 instead of 0 -function increment (orig) { - return orig !== undefined ? orig + 1 : 1 -} - -function Parser (args, opts) { - const result = parse(args.slice(), opts) - return result.argv -} - -// parse arguments and return detailed -// meta information, aliases, etc. -Parser.detailed = function (args, opts) { - return parse(args.slice(), opts) -} - -// TODO(bcoe): in the next major version of yargs, switch to -// Object.create(null) for dot notation: -function sanitizeKey (key) { - if (key === '__proto__') return '___proto___' - return key -} - -module.exports = Parser diff --git a/node_modules/yargs-parser/lib/tokenize-arg-string.js b/node_modules/yargs-parser/lib/tokenize-arg-string.js deleted file mode 100644 index 260c67c..0000000 --- a/node_modules/yargs-parser/lib/tokenize-arg-string.js +++ /dev/null @@ -1,40 +0,0 @@ -// take an un-split argv string and tokenize it. -module.exports = function (argString) { - if (Array.isArray(argString)) { - return argString.map(e => typeof e !== 'string' ? e + '' : e) - } - - argString = argString.trim() - - let i = 0 - let prevC = null - let c = null - let opening = null - const args = [] - - for (let ii = 0; ii < argString.length; ii++) { - prevC = c - c = argString.charAt(ii) - - // split on spaces unless we're in quotes. - if (c === ' ' && !opening) { - if (!(prevC === ' ')) { - i++ - } - continue - } - - // don't split the string if we're in matching - // opening or closing single and double quotes. - if (c === opening) { - opening = null - } else if ((c === "'" || c === '"') && !opening) { - opening = c - } - - if (!args[i]) args[i] = '' - args[i] += c - } - - return args -} diff --git a/node_modules/yargs-parser/package.json b/node_modules/yargs-parser/package.json deleted file mode 100644 index c109d71..0000000 --- a/node_modules/yargs-parser/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "_from": "yargs-parser@^18.1.2", - "_id": "yargs-parser@18.1.3", - "_inBundle": false, - "_integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "_location": "/yargs-parser", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "yargs-parser@^18.1.2", - "name": "yargs-parser", - "escapedName": "yargs-parser", - "rawSpec": "^18.1.2", - "saveSpec": null, - "fetchSpec": "^18.1.2" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "_shasum": "be68c4975c6b2abf469236b0c870362fab09a7b0", - "_spec": "yargs-parser@^18.1.2", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "Ben Coe", - "email": "ben@npmjs.com" - }, - "bugs": { - "url": "https://github.com/yargs/yargs-parser/issues" - }, - "bundleDependencies": false, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "deprecated": false, - "description": "the mighty option parser used by yargs", - "devDependencies": { - "c8": "^7.0.1", - "chai": "^4.2.0", - "mocha": "^7.0.0", - "standard": "^14.3.1" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "lib", - "index.js" - ], - "homepage": "https://github.com/yargs/yargs-parser#readme", - "keywords": [ - "argument", - "parser", - "yargs", - "command", - "cli", - "parsing", - "option", - "args", - "argument" - ], - "license": "ISC", - "main": "index.js", - "name": "yargs-parser", - "repository": { - "type": "git", - "url": "git+https://github.com/yargs/yargs-parser.git" - }, - "scripts": { - "coverage": "c8 report --check-coverage check-coverage --lines=100 --branches=97 --statements=100", - "fix": "standard --fix", - "posttest": "standard", - "test": "c8 --reporter=text --reporter=html mocha test/*.js" - }, - "version": "18.1.3" -} diff --git a/node_modules/yargs/CHANGELOG.md b/node_modules/yargs/CHANGELOG.md deleted file mode 100644 index a010cf3..0000000 --- a/node_modules/yargs/CHANGELOG.md +++ /dev/null @@ -1,420 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -## [15.4.0](https://www.github.com/yargs/yargs/compare/v15.3.1...v15.4.0) (2020-06-30) - - -### Features - -* adds deprecation option for commands ([027a636](https://www.github.com/yargs/yargs/commit/027a6365b737e13116811a8ef43670196e1fa00a)) -* support array of examples ([#1682](https://www.github.com/yargs/yargs/issues/1682)) ([225ab82](https://www.github.com/yargs/yargs/commit/225ab8271938bed3a48d23175f3d580ce8cd1306)) - - -### Bug Fixes - -* **docs:** describe usage of `.check()` in more detail ([932cd11](https://www.github.com/yargs/yargs/commit/932cd1177e93f5cc99edfe57a4028e30717bf8fb)) -* **i18n:** Japanese translation phrasing ([#1619](https://www.github.com/yargs/yargs/issues/1619)) ([0894175](https://www.github.com/yargs/yargs/commit/089417550ef5a5b8ce3578dd2a989191300b64cd)) -* **strict mode:** report default command unknown arguments ([#1626](https://www.github.com/yargs/yargs/issues/1626)) ([69f29a9](https://www.github.com/yargs/yargs/commit/69f29a9cd429d4bb99481238305390107ac75b02)) -* **usage:** translate 'options' group only when displaying help ([#1600](https://www.github.com/yargs/yargs/issues/1600)) ([e60b39b](https://www.github.com/yargs/yargs/commit/e60b39b9d3a912c06db43f87c86ba894142b6c1c)) - - -### Reverts - -* Revert "chore(deps): update dependency eslint to v7 (#1656)" (#1673) ([34949f8](https://www.github.com/yargs/yargs/commit/34949f89ee7cdf88f7b315659df4b5f62f714842)), closes [#1656](https://www.github.com/yargs/yargs/issues/1656) [#1673](https://www.github.com/yargs/yargs/issues/1673) - -### [15.3.1](https://www.github.com/yargs/yargs/compare/v15.3.0...v15.3.1) (2020-03-16) - - -### Bug Fixes - -* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential -prototype pollution vulnerability. This was reported by the Snyk Security Research Team. ([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2)) - -## [15.3.0](https://www.github.com/yargs/yargs/compare/v15.2.0...v15.3.0) (2020-03-08) - - -### Features - -* **yargs-parser:** introduce single-digit boolean aliases ([#1576](https://www.github.com/yargs/yargs/issues/1576)) ([3af7f04](https://www.github.com/yargs/yargs/commit/3af7f04cdbfcbd4b3f432aca5144d43f21958c39)) -* add usage for single-digit boolean aliases ([#1580](https://www.github.com/yargs/yargs/issues/1580)) ([6014e39](https://www.github.com/yargs/yargs/commit/6014e39bca3a1e8445aa0fb2a435f6181e344c45)) - - -### Bug Fixes - -* address ambiguity between nargs of 1 and requiresArg ([#1572](https://www.github.com/yargs/yargs/issues/1572)) ([a5edc32](https://www.github.com/yargs/yargs/commit/a5edc328ecb3f90d1ba09cfe70a0040f68adf50a)) - -## [15.2.0](https://www.github.com/yargs/yargs/compare/v15.1.0...v15.2.0) (2020-03-01) - - -### ⚠ BREAKING CHANGES - -* **deps:** yargs-parser@17.0.0 no longer implicitly creates arrays out of boolean -arguments when duplicates are provided - -### Features - -* **completion:** takes negated flags into account when boolean-negation is set ([#1509](https://www.github.com/yargs/yargs/issues/1509)) ([7293ad5](https://www.github.com/yargs/yargs/commit/7293ad50d20ea0fb7dd1ac9b925e90e1bd95dea8)) -* **deps:** pull in yargs-parser@17.0.0 ([#1553](https://www.github.com/yargs/yargs/issues/1553)) ([b9409da](https://www.github.com/yargs/yargs/commit/b9409da199ebca515a848489c206b807fab2e65d)) -* deprecateOption ([#1559](https://www.github.com/yargs/yargs/issues/1559)) ([8aae333](https://www.github.com/yargs/yargs/commit/8aae3332251d09fa136db17ef4a40d83fa052bc4)) -* display appropriate $0 for electron apps ([#1536](https://www.github.com/yargs/yargs/issues/1536)) ([d0e4379](https://www.github.com/yargs/yargs/commit/d0e437912917d6a66bb5128992fa2f566a5f830b)) -* introduces strictCommands() subset of strict mode ([#1540](https://www.github.com/yargs/yargs/issues/1540)) ([1d4cca3](https://www.github.com/yargs/yargs/commit/1d4cca395a98b395e6318f0505fc73bef8b01350)) -* **deps:** yargs-parser with 'greedy-array' configuration ([#1569](https://www.github.com/yargs/yargs/issues/1569)) ([a03a320](https://www.github.com/yargs/yargs/commit/a03a320dbf5c0ce33d829a857fc04a651c0bb53e)) - - -### Bug Fixes - -* help always displayed for the first command parsed having an async handler ([#1535](https://www.github.com/yargs/yargs/issues/1535)) ([d585b30](https://www.github.com/yargs/yargs/commit/d585b303a43746201b05c9c9fda94a444634df33)) -* **deps:** fix enumeration for normalized path arguments ([#1567](https://www.github.com/yargs/yargs/issues/1567)) ([0b5b1b0](https://www.github.com/yargs/yargs/commit/0b5b1b0e5f4f9baf393c48e9cc2bc85c1b67a47a)) -* **locales:** only translate default option group name ([acc16de](https://www.github.com/yargs/yargs/commit/acc16de6b846ea7332db753646a9cec76b589162)) -* **locales:** remove extra space in French for 'default' ([#1564](https://www.github.com/yargs/yargs/issues/1564)) ([ecfc2c4](https://www.github.com/yargs/yargs/commit/ecfc2c474575c6cdbc6d273c94c13181bd1dbaa6)) -* **translations:** add French translation for unknown command ([#1563](https://www.github.com/yargs/yargs/issues/1563)) ([18b0b75](https://www.github.com/yargs/yargs/commit/18b0b752424bf560271e670ff95a0f90c8386787)) -* **translations:** fix pluralization in error messages. ([#1557](https://www.github.com/yargs/yargs/issues/1557)) ([94fa38c](https://www.github.com/yargs/yargs/commit/94fa38cbab8d86943e87bf41d368ed56dffa6835)) -* **yargs:** correct support of bundled electron apps ([#1554](https://www.github.com/yargs/yargs/issues/1554)) ([a0b61ac](https://www.github.com/yargs/yargs/commit/a0b61ac21e2b554aa73dbf1a66d4a7af94047c2f)) - -## [15.1.0](https://www.github.com/yargs/yargs/compare/v15.0.2...v15.1.0) (2020-01-02) - - -### Features - -* **lang:** add Finnish localization (language code fi) ([222c8fe](https://www.github.com/yargs/yargs/commit/222c8fef2e2ad46e314c337dec96940f896bec35)) -* complete short options with a single dash ([#1507](https://www.github.com/yargs/yargs/issues/1507)) ([99011ab](https://www.github.com/yargs/yargs/commit/99011ab5ba90232506ece0a17e59e2001a1ab562)) -* onFinishCommand handler ([#1473](https://www.github.com/yargs/yargs/issues/1473)) ([fe380cd](https://www.github.com/yargs/yargs/commit/fe380cd356aa33aef0449facd59c22cab8930ac9)) - - -### Bug Fixes - -* getCompletion() was not working for options ([#1495](https://www.github.com/yargs/yargs/issues/1495)) ([463feb2](https://www.github.com/yargs/yargs/commit/463feb2870158eb9df670222b0f0a40a05cf18d0)) -* misspelling of package.json `engines` field ([0891d0e](https://www.github.com/yargs/yargs/commit/0891d0ed35b30c83a6d9e9f6a5c5f84d13c546a0)) -* populate positionals when unknown-options-as-args is set ([#1508](https://www.github.com/yargs/yargs/issues/1508)) ([bb0f2eb](https://www.github.com/yargs/yargs/commit/bb0f2eb996fa4e19d330b31a01c2036cafa99a7e)), closes [#1444](https://www.github.com/yargs/yargs/issues/1444) -* show 2 dashes on help for single digit option key or alias ([#1493](https://www.github.com/yargs/yargs/issues/1493)) ([63b3dd3](https://www.github.com/yargs/yargs/commit/63b3dd31a455d428902220c1992ae930e18aff5c)) -* **docs:** use recommended cjs import syntax for ts examples ([#1513](https://www.github.com/yargs/yargs/issues/1513)) ([f9a18bf](https://www.github.com/yargs/yargs/commit/f9a18bfd624a5013108084f690cd8a1de794c430)) - -### [15.0.2](https://www.github.com/yargs/yargs/compare/v15.0.1...v15.0.2) (2019-11-19) - - -### Bug Fixes - -* temporary fix for libraries that call Object.freeze() ([#1483](https://www.github.com/yargs/yargs/issues/1483)) ([99c2dc8](https://www.github.com/yargs/yargs/commit/99c2dc850e67c606644f8b0c0bca1a59c87dcbcd)) - -### [15.0.1](https://www.github.com/yargs/yargs/compare/v15.0.0...v15.0.1) (2019-11-16) - - -### Bug Fixes - -* **deps:** cliui, find-up, and string-width, all drop Node 6 support ([#1479](https://www.github.com/yargs/yargs/issues/1479)) ([6a9ebe2](https://www.github.com/yargs/yargs/commit/6a9ebe2d955e3e979e76c07ffbb1c17fef64cb49)) - -## [15.0.0](https://www.github.com/yargs/yargs/compare/v14.2.0...v15.0.0) (2019-11-10) - - -### ⚠ BREAKING CHANGES - -* **deps:** yargs-parser now throws on invalid combinations of config (#1470) -* yargs-parser@16.0.0 drops support for Node 6 -* drop Node 6 support (#1461) -* remove package.json-based parserConfiguration (#1460) - -### Features - -* **deps:** yargs-parser now throws on invalid combinations of config ([#1470](https://www.github.com/yargs/yargs/issues/1470)) ([c10c38c](https://www.github.com/yargs/yargs/commit/c10c38cca04298f96b55a7e374a9a134abefffa7)) -* expose `Parser` from `require('yargs/yargs')` ([#1477](https://www.github.com/yargs/yargs/issues/1477)) ([1840ba2](https://www.github.com/yargs/yargs/commit/1840ba22f1a24c0ece8e32bbd31db4134a080aee)) - - -### Bug Fixes - -* **docs:** TypeScript import to prevent a future major release warning ([#1441](https://www.github.com/yargs/yargs/issues/1441)) ([b1b156a](https://www.github.com/yargs/yargs/commit/b1b156a3eb4ddd6803fbbd56c611a77919293000)) -* stop-parse was not being respected by commands ([#1459](https://www.github.com/yargs/yargs/issues/1459)) ([12c82e6](https://www.github.com/yargs/yargs/commit/12c82e62663e928148a7ee2f51629aa26a0f9bb2)) -* update to yargs-parser with fix for array default values ([#1463](https://www.github.com/yargs/yargs/issues/1463)) ([ebee59d](https://www.github.com/yargs/yargs/commit/ebee59d9022da538410e69a5c025019ed46d13d2)) -* **docs:** update boolean description and examples in docs ([#1474](https://www.github.com/yargs/yargs/issues/1474)) ([afd5b48](https://www.github.com/yargs/yargs/commit/afd5b4871bfeb90d58351ac56c5c44a83ef033e6)) - - -### Miscellaneous Chores - -* drop Node 6 support ([#1461](https://www.github.com/yargs/yargs/issues/1461)) ([2ba8ce0](https://www.github.com/yargs/yargs/commit/2ba8ce05e8fefbeffc6cb7488d9ebf6e86cceb1d)) - - -### Code Refactoring - -* remove package.json-based parserConfiguration ([#1460](https://www.github.com/yargs/yargs/issues/1460)) ([0d3642b](https://www.github.com/yargs/yargs/commit/0d3642b6f829b637938774c0c6ce5f6bfe1afa51)) - -## [14.2.0](https://github.com/yargs/yargs/compare/v14.1.0...v14.2.0) (2019-10-07) - - -### Bug Fixes - -* async middleware was called twice ([#1422](https://github.com/yargs/yargs/issues/1422)) ([9a42b63](https://github.com/yargs/yargs/commit/9a42b63)) -* fix promise check to accept any spec conform object ([#1424](https://github.com/yargs/yargs/issues/1424)) ([0be43d2](https://github.com/yargs/yargs/commit/0be43d2)) -* groups were not being maintained for nested commands ([#1430](https://github.com/yargs/yargs/issues/1430)) ([d38650e](https://github.com/yargs/yargs/commit/d38650e)) -* **docs:** broken markdown link ([#1426](https://github.com/yargs/yargs/issues/1426)) ([236e24e](https://github.com/yargs/yargs/commit/236e24e)) -* support merging deeply nested configuration ([#1423](https://github.com/yargs/yargs/issues/1423)) ([bae66fe](https://github.com/yargs/yargs/commit/bae66fe)) - - -### Features - -* **deps:** introduce yargs-parser with support for unknown-options-as-args ([#1440](https://github.com/yargs/yargs/issues/1440)) ([4d21520](https://github.com/yargs/yargs/commit/4d21520)) - -## [14.1.0](https://github.com/yargs/yargs/compare/v14.0.0...v14.1.0) (2019-09-06) - - -### Bug Fixes - -* **docs:** fix incorrect parserConfiguration documentation ([2a99124](https://github.com/yargs/yargs/commit/2a99124)) -* detect zsh when zsh isnt run as a login prompt ([#1395](https://github.com/yargs/yargs/issues/1395)) ([8792d13](https://github.com/yargs/yargs/commit/8792d13)) -* populate correct value on yargs.parsed and stop warning on access ([#1412](https://github.com/yargs/yargs/issues/1412)) ([bb0eb52](https://github.com/yargs/yargs/commit/bb0eb52)) -* showCompletionScript was logging script twice ([#1388](https://github.com/yargs/yargs/issues/1388)) ([07c8537](https://github.com/yargs/yargs/commit/07c8537)) -* strict() should not ignore hyphenated arguments ([#1414](https://github.com/yargs/yargs/issues/1414)) ([b774b5e](https://github.com/yargs/yargs/commit/b774b5e)) -* **docs:** formalize existing callback argument to showHelp ([#1386](https://github.com/yargs/yargs/issues/1386)) ([d217764](https://github.com/yargs/yargs/commit/d217764)) - - -### Features - -* make it possible to merge configurations when extending other config. ([#1411](https://github.com/yargs/yargs/issues/1411)) ([5d7ad98](https://github.com/yargs/yargs/commit/5d7ad98)) - -## [14.0.0](https://github.com/yargs/yargs/compare/v13.3.0...v14.0.0) (2019-07-30) - - -### ⚠ BREAKING CHANGES - -* we now only officially support yargs.$0 parameter and discourage direct access to yargs.parsed -* previously to this fix methods like `yargs.getOptions()` contained the state of the last command to execute. -* do not allow additional positionals in strict mode - -### Bug Fixes - -* calling parse multiple times now appropriately maintains state ([#1137](https://github.com/yargs/yargs/issues/1137)) ([#1369](https://github.com/yargs/yargs/issues/1369)) ([026b151](https://github.com/yargs/yargs/commit/026b151)) -* prefer user supplied script name in usage ([#1383](https://github.com/yargs/yargs/issues/1383)) ([28c74b9](https://github.com/yargs/yargs/commit/28c74b9)) -* **deps:** use decamelize from npm instead of vendored copy ([#1377](https://github.com/yargs/yargs/issues/1377)) ([015eeb9](https://github.com/yargs/yargs/commit/015eeb9)) -* **examples:** fix usage-options.js to reflect current API ([#1375](https://github.com/yargs/yargs/issues/1375)) ([6e5b76b](https://github.com/yargs/yargs/commit/6e5b76b)) -* do not allow additional positionals in strict mode ([35d777c](https://github.com/yargs/yargs/commit/35d777c)) -* properties accessed on singleton now reflect current state of instance ([#1366](https://github.com/yargs/yargs/issues/1366)) ([409d35b](https://github.com/yargs/yargs/commit/409d35b)) -* tolerate null prototype for config objects with `extends` ([#1376](https://github.com/yargs/yargs/issues/1376)) ([3d26d11](https://github.com/yargs/yargs/commit/3d26d11)), closes [#1372](https://github.com/yargs/yargs/issues/1372) -* yargs.parsed now populated before returning, when yargs.parse() called with no args (#1382) ([e3981fd](https://github.com/yargs/yargs/commit/e3981fd)), closes [#1382](https://github.com/yargs/yargs/issues/1382) - -### Features - -* adds support for multiple epilog messages ([#1384](https://github.com/yargs/yargs/issues/1384)) ([07a5554](https://github.com/yargs/yargs/commit/07a5554)) -* allow completionCommand to be set via showCompletionScript ([#1385](https://github.com/yargs/yargs/issues/1385)) ([5562853](https://github.com/yargs/yargs/commit/5562853)) - -## [13.3.0](https://www.github.com/yargs/yargs/compare/v13.2.4...v13.3.0) (2019-06-10) - - -### Bug Fixes - -* **deps:** yargs-parser update addressing several parsing bugs ([#1357](https://www.github.com/yargs/yargs/issues/1357)) ([e230d5b](https://www.github.com/yargs/yargs/commit/e230d5b)) - - -### Features - -* **i18n:** swap out os-locale dependency for simple inline implementation ([#1356](https://www.github.com/yargs/yargs/issues/1356)) ([4dfa19b](https://www.github.com/yargs/yargs/commit/4dfa19b)) -* support defaultDescription for positional arguments ([812048c](https://www.github.com/yargs/yargs/commit/812048c)) - -### [13.2.4](https://github.com/yargs/yargs/compare/v13.2.3...v13.2.4) (2019-05-13) - - -### Bug Fixes - -* **i18n:** rename unclear 'implication failed' to 'missing dependent arguments' ([#1317](https://github.com/yargs/yargs/issues/1317)) ([bf46813](https://github.com/yargs/yargs/commit/bf46813)) - - - -### [13.2.3](https://github.com/yargs/yargs/compare/v13.2.2...v13.2.3) (2019-05-05) - - -### Bug Fixes - -* **deps:** upgrade cliui for compatibility with latest chalk. ([#1330](https://github.com/yargs/yargs/issues/1330)) ([b20db65](https://github.com/yargs/yargs/commit/b20db65)) -* address issues with dutch translation ([#1316](https://github.com/yargs/yargs/issues/1316)) ([0295132](https://github.com/yargs/yargs/commit/0295132)) - - -### Tests - -* accept differently formatted output ([#1327](https://github.com/yargs/yargs/issues/1327)) ([c294d1b](https://github.com/yargs/yargs/commit/c294d1b)) - - - -## [13.2.2](https://github.com/yargs/yargs/compare/v13.2.1...v13.2.2) (2019-03-06) - - - -## [13.2.1](https://github.com/yargs/yargs/compare/v13.2.0...v13.2.1) (2019-02-18) - - -### Bug Fixes - -* add zsh script to files array ([3180224](https://github.com/yargs/yargs/commit/3180224)) -* support options/sub-commands in zsh completion ([0a96394](https://github.com/yargs/yargs/commit/0a96394)) - - -# [13.2.0](https://github.com/yargs/yargs/compare/v13.1.0...v13.2.0) (2019-02-15) - - -### Features - -* zsh auto completion ([#1292](https://github.com/yargs/yargs/issues/1292)) ([16c5d25](https://github.com/yargs/yargs/commit/16c5d25)), closes [#1156](https://github.com/yargs/yargs/issues/1156) - - - -# [13.1.0](https://github.com/yargs/yargs/compare/v13.0.0...v13.1.0) (2019-02-12) - - -### Features - -* add applyBeforeValidation, for applying sync middleware before validation ([5be206a](https://github.com/yargs/yargs/commit/5be206a)) - - - - -# [13.0.0](https://github.com/yargs/yargs/compare/v12.0.5...v13.0.0) (2019-02-02) - - -### Bug Fixes - -* **deps:** Update os-locale to avoid security vulnerability ([#1270](https://github.com/yargs/yargs/issues/1270)) ([27bf739](https://github.com/yargs/yargs/commit/27bf739)) -* **validation:** Use the error as a message when none exists otherwise ([#1268](https://github.com/yargs/yargs/issues/1268)) ([0510fe6](https://github.com/yargs/yargs/commit/0510fe6)) -* better bash path completion ([#1272](https://github.com/yargs/yargs/issues/1272)) ([da75ea2](https://github.com/yargs/yargs/commit/da75ea2)) -* middleware added multiple times due to reference bug ([#1282](https://github.com/yargs/yargs/issues/1282)) ([64af518](https://github.com/yargs/yargs/commit/64af518)) - - -### Chores - -* ~drop Node 6 from testing matrix ([#1287](https://github.com/yargs/yargs/issues/1287)) ([ef16792](https://github.com/yargs/yargs/commit/ef16792))~ - * _opting to not drop Node 6 support until April, [see](https://github.com/nodejs/Release)._ -* update dependencies ([#1284](https://github.com/yargs/yargs/issues/1284)) ([f25de4f](https://github.com/yargs/yargs/commit/f25de4f)) - - -### Features - -* Add `.parserConfiguration()` method, deprecating package.json config ([#1262](https://github.com/yargs/yargs/issues/1262)) ([3c6869a](https://github.com/yargs/yargs/commit/3c6869a)) -* adds config option for sorting command output ([#1256](https://github.com/yargs/yargs/issues/1256)) ([6916ce9](https://github.com/yargs/yargs/commit/6916ce9)) -* options/positionals with leading '+' and '0' no longer parse as numbers ([#1286](https://github.com/yargs/yargs/issues/1286)) ([e9dc3aa](https://github.com/yargs/yargs/commit/e9dc3aa)) -* support promises in middleware ([f3a4e4f](https://github.com/yargs/yargs/commit/f3a4e4f)) - - -### BREAKING CHANGES - -* options with leading '+' or '0' now parse as strings -* dropping Node 6 which hits end of life in April 2019 -* see [yargs-parser@12.0.0 CHANGELOG](https://github.com/yargs/yargs-parser/blob/master/CHANGELOG.md#breaking-changes) -* we now warn if the yargs stanza package.json is used. - - - - -## [12.0.5](https://github.com/yargs/yargs/compare/v12.0.4...v12.0.5) (2018-11-19) - - -### Bug Fixes - -* allows camel-case, variadic arguments, and strict mode to be combined ([#1247](https://github.com/yargs/yargs/issues/1247)) ([eacc035](https://github.com/yargs/yargs/commit/eacc035)) - - - - -## [12.0.4](https://github.com/yargs/yargs/compare/v12.0.3...v12.0.4) (2018-11-10) - - -### Bug Fixes - -* don't load config when processing positionals ([5d0dc92](https://github.com/yargs/yargs/commit/5d0dc92)) - - - - -## [12.0.3](https://github.com/yargs/yargs/compare/v12.0.2...v12.0.3) (2018-10-06) - - -### Bug Fixes - -* $0 contains first arg in bundled electron apps ([#1206](https://github.com/yargs/yargs/issues/1206)) ([567820b](https://github.com/yargs/yargs/commit/567820b)) -* accept single function for middleware ([66fd6f7](https://github.com/yargs/yargs/commit/66fd6f7)), closes [#1214](https://github.com/yargs/yargs/issues/1214) [#1214](https://github.com/yargs/yargs/issues/1214) -* hide `hidden` options from help output even if they are in a group ([#1221](https://github.com/yargs/yargs/issues/1221)) ([da54028](https://github.com/yargs/yargs/commit/da54028)) -* improve Norwegian Bokmål translations ([#1208](https://github.com/yargs/yargs/issues/1208)) ([a458fa4](https://github.com/yargs/yargs/commit/a458fa4)) -* improve Norwegian Nynorsk translations ([#1207](https://github.com/yargs/yargs/issues/1207)) ([d422eb5](https://github.com/yargs/yargs/commit/d422eb5)) - - - - -## [12.0.2](https://github.com/yargs/yargs/compare/v12.0.1...v12.0.2) (2018-09-04) - - -### Bug Fixes - -* middleware should work regardless of when method is called ([664b265](https://github.com/yargs/yargs/commit/664b265)), closes [#1178](https://github.com/yargs/yargs/issues/1178) -* translation not working when using __ with a single parameter ([#1183](https://github.com/yargs/yargs/issues/1183)) ([f449aea](https://github.com/yargs/yargs/commit/f449aea)) -* upgrade os-locale to version that addresses license issue ([#1195](https://github.com/yargs/yargs/issues/1195)) ([efc0970](https://github.com/yargs/yargs/commit/efc0970)) - - - - -## [12.0.1](https://github.com/yargs/yargs/compare/v12.0.0...v12.0.1) (2018-06-29) - - - - -# [12.0.0](https://github.com/yargs/yargs/compare/v11.1.0...v12.0.0) (2018-06-26) - - -### Bug Fixes - -* .argv and .parse() now invoke identical code path ([#1126](https://github.com/yargs/yargs/issues/1126)) ([f13ebf4](https://github.com/yargs/yargs/commit/f13ebf4)) -* remove the trailing white spaces from the help output ([#1090](https://github.com/yargs/yargs/issues/1090)) ([3f0746c](https://github.com/yargs/yargs/commit/3f0746c)) -* **completion:** Avoid default command and recommendations during completion ([#1123](https://github.com/yargs/yargs/issues/1123)) ([036e7c5](https://github.com/yargs/yargs/commit/036e7c5)) - - -### Chores - -* test Node.js 6, 8 and 10 ([#1160](https://github.com/yargs/yargs/issues/1160)) ([84f9d2b](https://github.com/yargs/yargs/commit/84f9d2b)) -* upgrade to version of yargs-parser that does not populate value for unset boolean ([#1104](https://github.com/yargs/yargs/issues/1104)) ([d4705f4](https://github.com/yargs/yargs/commit/d4705f4)) - - -### Features - -* add support for global middleware, useful for shared tasks like metrics ([#1119](https://github.com/yargs/yargs/issues/1119)) ([9d71ac7](https://github.com/yargs/yargs/commit/9d71ac7)) -* allow setting scriptName $0 ([#1143](https://github.com/yargs/yargs/issues/1143)) ([a2f2eae](https://github.com/yargs/yargs/commit/a2f2eae)) -* remove `setPlaceholderKeys` ([#1105](https://github.com/yargs/yargs/issues/1105)) ([6ee2c82](https://github.com/yargs/yargs/commit/6ee2c82)) - - -### BREAKING CHANGES - -* Options absent from `argv` (not set via CLI argument) are now absent from the parsed result object rather than being set with `undefined` -* drop Node 4 from testing matrix, such that we'll gradually start drifting away from supporting Node 4. -* yargs-parser does not populate 'false' when boolean flag is not passed -* tests that assert against help output will need to be updated - - - - -# [11.1.0](https://github.com/yargs/yargs/compare/v11.0.0...v11.1.0) (2018-03-04) - - -### Bug Fixes - -* choose correct config directory when require.main does not exist ([#1056](https://github.com/yargs/yargs/issues/1056)) ([a04678c](https://github.com/yargs/yargs/commit/a04678c)) - - -### Features - -* allow hidden options to be displayed with --show-hidden ([#1061](https://github.com/yargs/yargs/issues/1061)) ([ea862ae](https://github.com/yargs/yargs/commit/ea862ae)) -* extend *.rc files in addition to json ([#1080](https://github.com/yargs/yargs/issues/1080)) ([11691a6](https://github.com/yargs/yargs/commit/11691a6)) - - - - -# [11.0.0](https://github.com/yargs/yargs/compare/v10.1.2...v11.0.0) (2018-01-22) - - -### Bug Fixes - -* Set implicit nargs=1 when type=number requiresArg=true ([#1050](https://github.com/yargs/yargs/issues/1050)) ([2b56812](https://github.com/yargs/yargs/commit/2b56812)) - - -### Features - -* requiresArg is now simply an alias for nargs(1) ([#1054](https://github.com/yargs/yargs/issues/1054)) ([a3ddacc](https://github.com/yargs/yargs/commit/a3ddacc)) - - -### BREAKING CHANGES - -* requiresArg now has significantly different error output, matching nargs. - -[Historical Versions](/docs/CHANGELOG-historical.md) diff --git a/node_modules/yargs/LICENSE b/node_modules/yargs/LICENSE deleted file mode 100644 index b0145ca..0000000 --- a/node_modules/yargs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/yargs/README.md b/node_modules/yargs/README.md deleted file mode 100644 index 0db992b..0000000 --- a/node_modules/yargs/README.md +++ /dev/null @@ -1,140 +0,0 @@ -

- -

-

Yargs

-

- Yargs be a node.js library fer hearties tryin' ter parse optstrings -

- -
- -[![Build Status][travis-image]][travis-url] -[![NPM version][npm-image]][npm-url] -[![js-standard-style][standard-image]][standard-url] -[![Coverage][coverage-image]][coverage-url] -[![Conventional Commits][conventional-commits-image]][conventional-commits-url] -[![Slack][slack-image]][slack-url] - -## Description : -Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. - -It gives you: - -* commands and (grouped) options (`my-program.js serve --port=5000`). -* a dynamically generated help menu based on your arguments. - -> - -* bash-completion shortcuts for commands and options. -* and [tons more](/docs/api.md). - -## Installation - -Stable version: -```bash -npm i yargs -``` - -Bleeding edge version with the most recent features: -```bash -npm i yargs@next -``` - -## Usage : - -### Simple Example - -```javascript -#!/usr/bin/env node -const {argv} = require('yargs') - -if (argv.ships > 3 && argv.distance < 53.5) { - console.log('Plunder more riffiwobbles!') -} else { - console.log('Retreat from the xupptumblers!') -} -``` - -```bash -$ ./plunder.js --ships=4 --distance=22 -Plunder more riffiwobbles! - -$ ./plunder.js --ships 12 --distance 98.7 -Retreat from the xupptumblers! -``` - -### Complex Example - -```javascript -#!/usr/bin/env node -require('yargs') // eslint-disable-line - .command('serve [port]', 'start the server', (yargs) => { - yargs - .positional('port', { - describe: 'port to bind on', - default: 5000 - }) - }, (argv) => { - if (argv.verbose) console.info(`start server on :${argv.port}`) - serve(argv.port) - }) - .option('verbose', { - alias: 'v', - type: 'boolean', - description: 'Run with verbose logging' - }) - .argv -``` - -Run the example above with `--help` to see the help for the application. - -## TypeScript - -yargs has type definitions at [@types/yargs][type-definitions]. - -``` -npm i @types/yargs --save-dev -``` - -See usage examples in [docs](/docs/typescript.md). - -## Webpack - -See usage examples of yargs with webpack in [docs](/docs/webpack.md). - -## Community : - -Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com). - -## Documentation : - -### Table of Contents - -* [Yargs' API](/docs/api.md) -* [Examples](/docs/examples.md) -* [Parsing Tricks](/docs/tricks.md) - * [Stop the Parser](/docs/tricks.md#stop) - * [Negating Boolean Arguments](/docs/tricks.md#negate) - * [Numbers](/docs/tricks.md#numbers) - * [Arrays](/docs/tricks.md#arrays) - * [Objects](/docs/tricks.md#objects) - * [Quotes](/docs/tricks.md#quotes) -* [Advanced Topics](/docs/advanced.md) - * [Composing Your App Using Commands](/docs/advanced.md#commands) - * [Building Configurable CLI Apps](/docs/advanced.md#configuration) - * [Customizing Yargs' Parser](/docs/advanced.md#customizing) -* [Contributing](/contributing.md) - -[travis-url]: https://travis-ci.org/yargs/yargs -[travis-image]: https://img.shields.io/travis/yargs/yargs/master.svg -[npm-url]: https://www.npmjs.com/package/yargs -[npm-image]: https://img.shields.io/npm/v/yargs.svg -[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg -[standard-url]: http://standardjs.com/ -[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg -[conventional-commits-url]: https://conventionalcommits.org/ -[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg -[slack-url]: http://devtoolscommunity.herokuapp.com -[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs -[coverage-image]: https://img.shields.io/nycrc/yargs/yargs -[coverage-url]: https://github.com/yargs/yargs/blob/master/.nycrc diff --git a/node_modules/yargs/build/lib/apply-extends.d.ts b/node_modules/yargs/build/lib/apply-extends.d.ts deleted file mode 100644 index 5a9aca7..0000000 --- a/node_modules/yargs/build/lib/apply-extends.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { Dictionary } from './common-types'; -export declare function applyExtends(config: Dictionary, cwd: string, mergeExtends?: boolean): Dictionary; diff --git a/node_modules/yargs/build/lib/apply-extends.js b/node_modules/yargs/build/lib/apply-extends.js deleted file mode 100644 index 005734a..0000000 --- a/node_modules/yargs/build/lib/apply-extends.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.applyExtends = void 0; -const fs = require("fs"); -const path = require("path"); -const yerror_1 = require("./yerror"); -let previouslyVisitedConfigs = []; -function checkForCircularExtends(cfgPath) { - if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) { - throw new yerror_1.YError(`Circular extended configurations: '${cfgPath}'.`); - } -} -function getPathToDefaultConfig(cwd, pathToExtend) { - return path.resolve(cwd, pathToExtend); -} -function mergeDeep(config1, config2) { - const target = {}; - function isObject(obj) { - return obj && typeof obj === 'object' && !Array.isArray(obj); - } - Object.assign(target, config1); - for (const key of Object.keys(config2)) { - if (isObject(config2[key]) && isObject(target[key])) { - target[key] = mergeDeep(config1[key], config2[key]); - } - else { - target[key] = config2[key]; - } - } - return target; -} -function applyExtends(config, cwd, mergeExtends = false) { - let defaultConfig = {}; - if (Object.prototype.hasOwnProperty.call(config, 'extends')) { - if (typeof config.extends !== 'string') - return defaultConfig; - const isPath = /\.json|\..*rc$/.test(config.extends); - let pathToDefault = null; - if (!isPath) { - try { - pathToDefault = require.resolve(config.extends); - } - catch (err) { - // most likely this simply isn't a module. - } - } - else { - pathToDefault = getPathToDefaultConfig(cwd, config.extends); - } - // maybe the module uses key for some other reason, - // err on side of caution. - if (!pathToDefault && !isPath) - return config; - if (!pathToDefault) - throw new yerror_1.YError(`Unable to find extended config '${config.extends}' in '${cwd}'.`); - checkForCircularExtends(pathToDefault); - previouslyVisitedConfigs.push(pathToDefault); - defaultConfig = isPath ? JSON.parse(fs.readFileSync(pathToDefault, 'utf8')) : require(config.extends); - delete config.extends; - defaultConfig = applyExtends(defaultConfig, path.dirname(pathToDefault), mergeExtends); - } - previouslyVisitedConfigs = []; - return mergeExtends ? mergeDeep(defaultConfig, config) : Object.assign({}, defaultConfig, config); -} -exports.applyExtends = applyExtends; diff --git a/node_modules/yargs/build/lib/argsert.d.ts b/node_modules/yargs/build/lib/argsert.d.ts deleted file mode 100644 index 6f7a83f..0000000 --- a/node_modules/yargs/build/lib/argsert.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function argsert(callerArguments: any[], length?: number): void; -export declare function argsert(expected: string, callerArguments: any[], length?: number): void; diff --git a/node_modules/yargs/build/lib/argsert.js b/node_modules/yargs/build/lib/argsert.js deleted file mode 100644 index 40cb091..0000000 --- a/node_modules/yargs/build/lib/argsert.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.argsert = void 0; -const yerror_1 = require("./yerror"); -const parse_command_1 = require("./parse-command"); -const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']; -function argsert(arg1, arg2, arg3) { - function parseArgs() { - return typeof arg1 === 'object' - ? [{ demanded: [], optional: [] }, arg1, arg2] - : [parse_command_1.parseCommand(`cmd ${arg1}`), arg2, arg3]; - } - // TODO: should this eventually raise an exception. - try { - // preface the argument description with "cmd", so - // that we can run it through yargs' command parser. - let position = 0; - let [parsed, callerArguments, length] = parseArgs(); - const args = [].slice.call(callerArguments); - while (args.length && args[args.length - 1] === undefined) - args.pop(); - length = length || args.length; - if (length < parsed.demanded.length) { - throw new yerror_1.YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`); - } - const totalCommands = parsed.demanded.length + parsed.optional.length; - if (length > totalCommands) { - throw new yerror_1.YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`); - } - parsed.demanded.forEach((demanded) => { - const arg = args.shift(); - const observedType = guessType(arg); - const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*'); - if (matchingTypes.length === 0) - argumentTypeError(observedType, demanded.cmd, position); - position += 1; - }); - parsed.optional.forEach((optional) => { - if (args.length === 0) - return; - const arg = args.shift(); - const observedType = guessType(arg); - const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*'); - if (matchingTypes.length === 0) - argumentTypeError(observedType, optional.cmd, position); - position += 1; - }); - } - catch (err) { - console.warn(err.stack); - } -} -exports.argsert = argsert; -function guessType(arg) { - if (Array.isArray(arg)) { - return 'array'; - } - else if (arg === null) { - return 'null'; - } - return typeof arg; -} -function argumentTypeError(observedType, allowedTypes, position) { - throw new yerror_1.YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`); -} diff --git a/node_modules/yargs/build/lib/command.d.ts b/node_modules/yargs/build/lib/command.d.ts deleted file mode 100644 index 9db6ab5..0000000 --- a/node_modules/yargs/build/lib/command.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// -import { Dictionary } from './common-types'; -import { Middleware } from './middleware'; -import { Positional } from './parse-command'; -import { RequireDirectoryOptions } from 'require-directory'; -import { UsageInstance } from './usage'; -import { ValidationInstance } from './validation'; -import { YargsInstance, Options, OptionDefinition, Context, Arguments, DetailedArguments } from './yargs'; -export declare function command(yargs: YargsInstance, usage: UsageInstance, validation: ValidationInstance, globalMiddleware?: Middleware[]): CommandInstance; -/** Instance of the command module. */ -export interface CommandInstance { - addDirectory(dir: string, context: Context, req: NodeRequireFunction, callerFile: string, opts?: RequireDirectoryOptions): void; - addHandler(handler: CommandHandlerDefinition): void; - addHandler(cmd: string | string[], description: CommandHandler['description'], builder?: CommandBuilderDefinition | CommandBuilder, handler?: CommandHandlerCallback, commandMiddleware?: Middleware[], deprecated?: boolean): void; - cmdToParseOptions(cmdString: string): Positionals; - freeze(): void; - getCommandHandlers(): Dictionary; - getCommands(): string[]; - hasDefaultCommand(): boolean; - reset(): CommandInstance; - runCommand(command: string | null, yargs: YargsInstance, parsed: DetailedArguments, commandIndex?: number): Arguments | Promise; - runDefaultBuilderOn(yargs: YargsInstance): void; - unfreeze(): void; -} -export interface CommandHandlerDefinition extends Partial> { - aliases?: string[]; - builder?: CommandBuilder | CommandBuilderDefinition; - command?: string | string[]; - desc?: CommandHandler['description']; - describe?: CommandHandler['description']; -} -export declare function isCommandHandlerDefinition(cmd: string | string[] | CommandHandlerDefinition): cmd is CommandHandlerDefinition; -export interface CommandBuilderDefinition { - builder?: CommandBuilder; - deprecated?: boolean; - handler: CommandHandlerCallback; - middlewares?: Middleware[]; -} -export declare function isCommandBuilderDefinition(builder?: CommandBuilder | CommandBuilderDefinition): builder is CommandBuilderDefinition; -export interface CommandHandlerCallback { - (argv: Arguments): any; -} -export interface CommandHandler { - builder: CommandBuilder; - demanded: Positional[]; - deprecated?: boolean; - description?: string | false; - handler: CommandHandlerCallback; - middlewares: Middleware[]; - optional: Positional[]; - original: string; -} -export declare type CommandBuilder = CommandBuilderCallback | Dictionary; -interface CommandBuilderCallback { - (y: YargsInstance): YargsInstance | void; -} -export declare function isCommandBuilderCallback(builder: CommandBuilder): builder is CommandBuilderCallback; -interface Positionals extends Pick { - demand: Dictionary; -} -export interface FinishCommandHandler { - (handlerResult: any): any; -} -export {}; diff --git a/node_modules/yargs/build/lib/command.js b/node_modules/yargs/build/lib/command.js deleted file mode 100644 index d90c455..0000000 --- a/node_modules/yargs/build/lib/command.js +++ /dev/null @@ -1,416 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isCommandBuilderCallback = exports.isCommandBuilderDefinition = exports.isCommandHandlerDefinition = exports.command = void 0; -const common_types_1 = require("./common-types"); -const is_promise_1 = require("./is-promise"); -const middleware_1 = require("./middleware"); -const parse_command_1 = require("./parse-command"); -const path = require("path"); -const util_1 = require("util"); -const yargs_1 = require("./yargs"); -const requireDirectory = require("require-directory"); -const whichModule = require("which-module"); -const Parser = require("yargs-parser"); -const DEFAULT_MARKER = /(^\*)|(^\$0)/; -// handles parsing positional arguments, -// and populating argv with said positional -// arguments. -function command(yargs, usage, validation, globalMiddleware = []) { - const self = {}; - let handlers = {}; - let aliasMap = {}; - let defaultCommand; - self.addHandler = function addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) { - let aliases = []; - const middlewares = middleware_1.commandMiddlewareFactory(commandMiddleware); - handler = handler || (() => { }); - if (Array.isArray(cmd)) { - aliases = cmd.slice(1); - cmd = cmd[0]; - } - else if (isCommandHandlerDefinition(cmd)) { - let command = (Array.isArray(cmd.command) || typeof cmd.command === 'string') ? cmd.command : moduleName(cmd); - if (cmd.aliases) - command = [].concat(command).concat(cmd.aliases); - self.addHandler(command, extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated); - return; - } - // allow a module to be provided instead of separate builder and handler - if (isCommandBuilderDefinition(builder)) { - self.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated); - return; - } - // parse positionals out of cmd string - const parsedCommand = parse_command_1.parseCommand(cmd); - // remove positional args from aliases only - aliases = aliases.map(alias => parse_command_1.parseCommand(alias).cmd); - // check for default and filter out '*'' - let isDefault = false; - const parsedAliases = [parsedCommand.cmd].concat(aliases).filter((c) => { - if (DEFAULT_MARKER.test(c)) { - isDefault = true; - return false; - } - return true; - }); - // standardize on $0 for default command. - if (parsedAliases.length === 0 && isDefault) - parsedAliases.push('$0'); - // shift cmd and aliases after filtering out '*' - if (isDefault) { - parsedCommand.cmd = parsedAliases[0]; - aliases = parsedAliases.slice(1); - cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd); - } - // populate aliasMap - aliases.forEach((alias) => { - aliasMap[alias] = parsedCommand.cmd; - }); - if (description !== false) { - usage.command(cmd, description, isDefault, aliases, deprecated); - } - handlers[parsedCommand.cmd] = { - original: cmd, - description, - handler, - builder: builder || {}, - middlewares, - deprecated, - demanded: parsedCommand.demanded, - optional: parsedCommand.optional - }; - if (isDefault) - defaultCommand = handlers[parsedCommand.cmd]; - }; - self.addDirectory = function addDirectory(dir, context, req, callerFile, opts) { - opts = opts || {}; - // disable recursion to support nested directories of subcommands - if (typeof opts.recurse !== 'boolean') - opts.recurse = false; - // exclude 'json', 'coffee' from require-directory defaults - if (!Array.isArray(opts.extensions)) - opts.extensions = ['js']; - // allow consumer to define their own visitor function - const parentVisit = typeof opts.visit === 'function' ? opts.visit : (o) => o; - // call addHandler via visitor function - opts.visit = function visit(obj, joined, filename) { - const visited = parentVisit(obj, joined, filename); - // allow consumer to skip modules with their own visitor - if (visited) { - // check for cyclic reference - // each command file path should only be seen once per execution - if (~context.files.indexOf(joined)) - return visited; - // keep track of visited files in context.files - context.files.push(joined); - self.addHandler(visited); - } - return visited; - }; - requireDirectory({ require: req, filename: callerFile }, dir, opts); - }; - // lookup module object from require()d command and derive name - // if module was not require()d and no name given, throw error - function moduleName(obj) { - const mod = whichModule(obj); - if (!mod) - throw new Error(`No command name given for module: ${util_1.inspect(obj)}`); - return commandFromFilename(mod.filename); - } - // derive command name from filename - function commandFromFilename(filename) { - return path.basename(filename, path.extname(filename)); - } - function extractDesc({ describe, description, desc }) { - for (const test of [describe, description, desc]) { - if (typeof test === 'string' || test === false) - return test; - common_types_1.assertNotStrictEqual(test, true); - } - return false; - } - self.getCommands = () => Object.keys(handlers).concat(Object.keys(aliasMap)); - self.getCommandHandlers = () => handlers; - self.hasDefaultCommand = () => !!defaultCommand; - self.runCommand = function runCommand(command, yargs, parsed, commandIndex) { - let aliases = parsed.aliases; - const commandHandler = handlers[command] || handlers[aliasMap[command]] || defaultCommand; - const currentContext = yargs.getContext(); - let numFiles = currentContext.files.length; - const parentCommands = currentContext.commands.slice(); - // what does yargs look like after the builder is run? - let innerArgv = parsed.argv; - let positionalMap = {}; - if (command) { - currentContext.commands.push(command); - currentContext.fullCommands.push(commandHandler.original); - } - const builder = commandHandler.builder; - if (isCommandBuilderCallback(builder)) { - // a function can be provided, which builds - // up a yargs chain and possibly returns it. - const builderOutput = builder(yargs.reset(parsed.aliases)); - const innerYargs = yargs_1.isYargsInstance(builderOutput) ? builderOutput : yargs; - if (shouldUpdateUsage(innerYargs)) { - innerYargs.getUsageInstance().usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description); - } - innerArgv = innerYargs._parseArgs(null, null, true, commandIndex); - aliases = innerYargs.parsed.aliases; - } - else if (isCommandBuilderOptionDefinitions(builder)) { - // as a short hand, an object can instead be provided, specifying - // the options that a command takes. - const innerYargs = yargs.reset(parsed.aliases); - if (shouldUpdateUsage(innerYargs)) { - innerYargs.getUsageInstance().usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description); - } - Object.keys(commandHandler.builder).forEach((key) => { - innerYargs.option(key, builder[key]); - }); - innerArgv = innerYargs._parseArgs(null, null, true, commandIndex); - aliases = innerYargs.parsed.aliases; - } - if (!yargs._hasOutput()) { - positionalMap = populatePositionals(commandHandler, innerArgv, currentContext); - } - const middlewares = globalMiddleware.slice(0).concat(commandHandler.middlewares); - middleware_1.applyMiddleware(innerArgv, yargs, middlewares, true); - // we apply validation post-hoc, so that custom - // checks get passed populated positional arguments. - if (!yargs._hasOutput()) { - yargs._runValidation(innerArgv, aliases, positionalMap, yargs.parsed.error, !command); - } - if (commandHandler.handler && !yargs._hasOutput()) { - yargs._setHasOutput(); - // to simplify the parsing of positionals in commands, - // we temporarily populate '--' rather than _, with arguments - const populateDoubleDash = !!yargs.getOptions().configuration['populate--']; - if (!populateDoubleDash) - yargs._copyDoubleDash(innerArgv); - innerArgv = middleware_1.applyMiddleware(innerArgv, yargs, middlewares, false); - let handlerResult; - if (is_promise_1.isPromise(innerArgv)) { - handlerResult = innerArgv.then(argv => commandHandler.handler(argv)); - } - else { - handlerResult = commandHandler.handler(innerArgv); - } - const handlerFinishCommand = yargs.getHandlerFinishCommand(); - if (is_promise_1.isPromise(handlerResult)) { - yargs.getUsageInstance().cacheHelpMessage(); - handlerResult - .then(value => { - if (handlerFinishCommand) { - handlerFinishCommand(value); - } - }) - .catch(error => { - try { - yargs.getUsageInstance().fail(null, error); - } - catch (err) { - // fail's throwing would cause an unhandled rejection. - } - }) - .then(() => { - yargs.getUsageInstance().clearCachedHelpMessage(); - }); - } - else { - if (handlerFinishCommand) { - handlerFinishCommand(handlerResult); - } - } - } - if (command) { - currentContext.commands.pop(); - currentContext.fullCommands.pop(); - } - numFiles = currentContext.files.length - numFiles; - if (numFiles > 0) - currentContext.files.splice(numFiles * -1, numFiles); - return innerArgv; - }; - function shouldUpdateUsage(yargs) { - return !yargs.getUsageInstance().getUsageDisabled() && - yargs.getUsageInstance().getUsage().length === 0; - } - function usageFromParentCommandsCommandHandler(parentCommands, commandHandler) { - const c = DEFAULT_MARKER.test(commandHandler.original) ? commandHandler.original.replace(DEFAULT_MARKER, '').trim() : commandHandler.original; - const pc = parentCommands.filter((c) => { return !DEFAULT_MARKER.test(c); }); - pc.push(c); - return `$0 ${pc.join(' ')}`; - } - self.runDefaultBuilderOn = function (yargs) { - common_types_1.assertNotStrictEqual(defaultCommand, undefined); - if (shouldUpdateUsage(yargs)) { - // build the root-level command string from the default string. - const commandString = DEFAULT_MARKER.test(defaultCommand.original) - ? defaultCommand.original : defaultCommand.original.replace(/^[^[\]<>]*/, '$0 '); - yargs.getUsageInstance().usage(commandString, defaultCommand.description); - } - const builder = defaultCommand.builder; - if (isCommandBuilderCallback(builder)) { - builder(yargs); - } - else { - Object.keys(builder).forEach((key) => { - yargs.option(key, builder[key]); - }); - } - }; - // transcribe all positional arguments "command [apple]" - // onto argv. - function populatePositionals(commandHandler, argv, context) { - argv._ = argv._.slice(context.commands.length); // nuke the current commands - const demanded = commandHandler.demanded.slice(0); - const optional = commandHandler.optional.slice(0); - const positionalMap = {}; - validation.positionalCount(demanded.length, argv._.length); - while (demanded.length) { - const demand = demanded.shift(); - populatePositional(demand, argv, positionalMap); - } - while (optional.length) { - const maybe = optional.shift(); - populatePositional(maybe, argv, positionalMap); - } - argv._ = context.commands.concat(argv._); - postProcessPositionals(argv, positionalMap, self.cmdToParseOptions(commandHandler.original)); - return positionalMap; - } - function populatePositional(positional, argv, positionalMap) { - const cmd = positional.cmd[0]; - if (positional.variadic) { - positionalMap[cmd] = argv._.splice(0).map(String); - } - else { - if (argv._.length) - positionalMap[cmd] = [String(argv._.shift())]; - } - } - // we run yargs-parser against the positional arguments - // applying the same parsing logic used for flags. - function postProcessPositionals(argv, positionalMap, parseOptions) { - // combine the parsing hints we've inferred from the command - // string with explicitly configured parsing hints. - const options = Object.assign({}, yargs.getOptions()); - options.default = Object.assign(parseOptions.default, options.default); - for (const key of Object.keys(parseOptions.alias)) { - options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]); - } - options.array = options.array.concat(parseOptions.array); - delete options.config; // don't load config when processing positionals. - const unparsed = []; - Object.keys(positionalMap).forEach((key) => { - positionalMap[key].map((value) => { - if (options.configuration['unknown-options-as-args']) - options.key[key] = true; - unparsed.push(`--${key}`); - unparsed.push(value); - }); - }); - // short-circuit parse. - if (!unparsed.length) - return; - const config = Object.assign({}, options.configuration, { - 'populate--': true - }); - const parsed = Parser.detailed(unparsed, Object.assign({}, options, { - configuration: config - })); - if (parsed.error) { - yargs.getUsageInstance().fail(parsed.error.message, parsed.error); - } - else { - // only copy over positional keys (don't overwrite - // flag arguments that were already parsed). - const positionalKeys = Object.keys(positionalMap); - Object.keys(positionalMap).forEach((key) => { - positionalKeys.push(...parsed.aliases[key]); - }); - Object.keys(parsed.argv).forEach((key) => { - if (positionalKeys.indexOf(key) !== -1) { - // any new aliases need to be placed in positionalMap, which - // is used for validation. - if (!positionalMap[key]) - positionalMap[key] = parsed.argv[key]; - argv[key] = parsed.argv[key]; - } - }); - } - } - self.cmdToParseOptions = function (cmdString) { - const parseOptions = { - array: [], - default: {}, - alias: {}, - demand: {} - }; - const parsed = parse_command_1.parseCommand(cmdString); - parsed.demanded.forEach((d) => { - const [cmd, ...aliases] = d.cmd; - if (d.variadic) { - parseOptions.array.push(cmd); - parseOptions.default[cmd] = []; - } - parseOptions.alias[cmd] = aliases; - parseOptions.demand[cmd] = true; - }); - parsed.optional.forEach((o) => { - const [cmd, ...aliases] = o.cmd; - if (o.variadic) { - parseOptions.array.push(cmd); - parseOptions.default[cmd] = []; - } - parseOptions.alias[cmd] = aliases; - }); - return parseOptions; - }; - self.reset = () => { - handlers = {}; - aliasMap = {}; - defaultCommand = undefined; - return self; - }; - // used by yargs.parse() to freeze - // the state of commands such that - // we can apply .parse() multiple times - // with the same yargs instance. - const frozens = []; - self.freeze = () => { - frozens.push({ - handlers, - aliasMap, - defaultCommand - }); - }; - self.unfreeze = () => { - const frozen = frozens.pop(); - common_types_1.assertNotStrictEqual(frozen, undefined); - ({ - handlers, - aliasMap, - defaultCommand - } = frozen); - }; - return self; -} -exports.command = command; -function isCommandHandlerDefinition(cmd) { - return typeof cmd === 'object'; -} -exports.isCommandHandlerDefinition = isCommandHandlerDefinition; -function isCommandBuilderDefinition(builder) { - return typeof builder === 'object' && - !!builder.builder && - typeof builder.handler === 'function'; -} -exports.isCommandBuilderDefinition = isCommandBuilderDefinition; -function isCommandBuilderCallback(builder) { - return typeof builder === 'function'; -} -exports.isCommandBuilderCallback = isCommandBuilderCallback; -function isCommandBuilderOptionDefinitions(builder) { - return typeof builder === 'object'; -} diff --git a/node_modules/yargs/build/lib/common-types.d.ts b/node_modules/yargs/build/lib/common-types.d.ts deleted file mode 100644 index f83c0dd..0000000 --- a/node_modules/yargs/build/lib/common-types.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * An object whose all properties have the same type. - */ -export declare type Dictionary = { - [key: string]: T; -}; -/** - * Returns the keys of T that match Dictionary and are not arrays. - */ -export declare type DictionaryKeyof = Exclude>, KeyOf>; -/** - * Returns the keys of T that match U. - */ -export declare type KeyOf = Exclude<{ - [K in keyof T]: T[K] extends U ? K : never; -}[keyof T], undefined>; -/** - * An array whose first element is not undefined. - */ -export declare type NotEmptyArray = [T, ...T[]]; -/** - * Returns the type of a Dictionary or array values. - */ -export declare type ValueOf = T extends (infer U)[] ? U : T[keyof T]; -/** - * Typing wrapper around assert.notStrictEqual() - */ -export declare function assertNotStrictEqual(actual: T | N, expected: N, message?: string | Error): asserts actual is Exclude; -/** - * Asserts actual is a single key, not a key array or a key map. - */ -export declare function assertSingleKey(actual: string | string[] | Dictionary): asserts actual is string; -/** - * Typing wrapper around Object.keys() - */ -export declare function objectKeys(object: T): (keyof T)[]; diff --git a/node_modules/yargs/build/lib/common-types.js b/node_modules/yargs/build/lib/common-types.js deleted file mode 100644 index 3064cbf..0000000 --- a/node_modules/yargs/build/lib/common-types.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.objectKeys = exports.assertSingleKey = exports.assertNotStrictEqual = void 0; -const assert_1 = require("assert"); -/** - * Typing wrapper around assert.notStrictEqual() - */ -function assertNotStrictEqual(actual, expected, message) { - assert_1.notStrictEqual(actual, expected, message); -} -exports.assertNotStrictEqual = assertNotStrictEqual; -/** - * Asserts actual is a single key, not a key array or a key map. - */ -function assertSingleKey(actual) { - assert_1.strictEqual(typeof actual, 'string'); -} -exports.assertSingleKey = assertSingleKey; -/** - * Typing wrapper around Object.keys() - */ -function objectKeys(object) { - return Object.keys(object); -} -exports.objectKeys = objectKeys; diff --git a/node_modules/yargs/build/lib/completion-templates.d.ts b/node_modules/yargs/build/lib/completion-templates.d.ts deleted file mode 100644 index 67bcd30..0000000 --- a/node_modules/yargs/build/lib/completion-templates.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const completionShTemplate = "###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word=\"${COMP_WORDS[COMP_CWORD]}\"\n args=(\"${COMP_WORDS[@]}\")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions \"${args[@]}\")\n\n COMPREPLY=( $(compgen -W \"${type_list}\" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o default -F _yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n"; -export declare const completionZshTemplate = "###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$'\n' reply=($(COMP_CWORD=\"$((CURRENT-1))\" COMP_LINE=\"$BUFFER\" COMP_POINT=\"$CURSOR\" {{app_path}} --get-yargs-completions \"${words[@]}\"))\n IFS=$si\n _describe 'values' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n"; diff --git a/node_modules/yargs/build/lib/completion-templates.js b/node_modules/yargs/build/lib/completion-templates.js deleted file mode 100644 index 3ee0e06..0000000 --- a/node_modules/yargs/build/lib/completion-templates.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.completionZshTemplate = exports.completionShTemplate = void 0; -exports.completionShTemplate = `###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc -# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX. -# -_yargs_completions() -{ - local cur_word args type_list - - cur_word="\${COMP_WORDS[COMP_CWORD]}" - args=("\${COMP_WORDS[@]}") - - # ask yargs to generate completions. - type_list=$({{app_path}} --get-yargs-completions "\${args[@]}") - - COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) ) - - # if no match was found, fall back to filename completion - if [ \${#COMPREPLY[@]} -eq 0 ]; then - COMPREPLY=() - fi - - return 0 -} -complete -o default -F _yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`; -exports.completionZshTemplate = `###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc -# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local reply - local si=$IFS - IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}")) - IFS=$si - _describe 'values' reply -} -compdef _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`; diff --git a/node_modules/yargs/build/lib/completion.d.ts b/node_modules/yargs/build/lib/completion.d.ts deleted file mode 100644 index 176a91b..0000000 --- a/node_modules/yargs/build/lib/completion.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { CommandInstance } from './command'; -import { UsageInstance } from './usage'; -import { YargsInstance } from './yargs'; -import { Arguments, DetailedArguments } from 'yargs-parser'; -export declare function completion(yargs: YargsInstance, usage: UsageInstance, command: CommandInstance): CompletionInstance; -/** Instance of the completion module. */ -export interface CompletionInstance { - completionKey: string; - generateCompletionScript($0: string, cmd: string): string; - getCompletion(args: string[], done: (completions: string[]) => any): any; - registerFunction(fn: CompletionFunction): void; - setParsed(parsed: DetailedArguments): void; -} -export declare type CompletionFunction = SyncCompletionFunction | AsyncCompletionFunction; -interface SyncCompletionFunction { - (current: string, argv: Arguments): string[] | Promise; -} -interface AsyncCompletionFunction { - (current: string, argv: Arguments, done: (completions: string[]) => any): any; -} -export {}; diff --git a/node_modules/yargs/build/lib/completion.js b/node_modules/yargs/build/lib/completion.js deleted file mode 100644 index d65925a..0000000 --- a/node_modules/yargs/build/lib/completion.js +++ /dev/null @@ -1,135 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.completion = void 0; -const command_1 = require("./command"); -const templates = require("./completion-templates"); -const is_promise_1 = require("./is-promise"); -const parse_command_1 = require("./parse-command"); -const path = require("path"); -const common_types_1 = require("./common-types"); -// add bash completions to your -// yargs-powered applications. -function completion(yargs, usage, command) { - const self = { - completionKey: 'get-yargs-completions' - }; - let aliases; - self.setParsed = function setParsed(parsed) { - aliases = parsed.aliases; - }; - const zshShell = (process.env.SHELL && process.env.SHELL.indexOf('zsh') !== -1) || - (process.env.ZSH_NAME && process.env.ZSH_NAME.indexOf('zsh') !== -1); - // get a list of completion commands. - // 'args' is the array of strings from the line to be completed - self.getCompletion = function getCompletion(args, done) { - const completions = []; - const current = args.length ? args[args.length - 1] : ''; - const argv = yargs.parse(args, true); - const parentCommands = yargs.getContext().commands; - // a custom completion function can be provided - // to completion(). - function runCompletionFunction(argv) { - common_types_1.assertNotStrictEqual(completionFunction, null); - if (isSyncCompletionFunction(completionFunction)) { - const result = completionFunction(current, argv); - // promise based completion function. - if (is_promise_1.isPromise(result)) { - return result.then((list) => { - process.nextTick(() => { done(list); }); - }).catch((err) => { - process.nextTick(() => { throw err; }); - }); - } - // synchronous completion function. - return done(result); - } - else { - // asynchronous completion function - return completionFunction(current, argv, (completions) => { - done(completions); - }); - } - } - if (completionFunction) { - return is_promise_1.isPromise(argv) ? argv.then(runCompletionFunction) : runCompletionFunction(argv); - } - const handlers = command.getCommandHandlers(); - for (let i = 0, ii = args.length; i < ii; ++i) { - if (handlers[args[i]] && handlers[args[i]].builder) { - const builder = handlers[args[i]].builder; - if (command_1.isCommandBuilderCallback(builder)) { - const y = yargs.reset(); - builder(y); - return y.argv; - } - } - } - if (!current.match(/^-/) && parentCommands[parentCommands.length - 1] !== current) { - usage.getCommands().forEach((usageCommand) => { - const commandName = parse_command_1.parseCommand(usageCommand[0]).cmd; - if (args.indexOf(commandName) === -1) { - if (!zshShell) { - completions.push(commandName); - } - else { - const desc = usageCommand[1] || ''; - completions.push(commandName.replace(/:/g, '\\:') + ':' + desc); - } - } - }); - } - if (current.match(/^-/) || (current === '' && completions.length === 0)) { - const descs = usage.getDescriptions(); - const options = yargs.getOptions(); - Object.keys(options.key).forEach((key) => { - const negable = !!options.configuration['boolean-negation'] && options.boolean.includes(key); - // If the key and its aliases aren't in 'args', add the key to 'completions' - let keyAndAliases = [key].concat(aliases[key] || []); - if (negable) - keyAndAliases = keyAndAliases.concat(keyAndAliases.map(key => `no-${key}`)); - function completeOptionKey(key) { - const notInArgs = keyAndAliases.every(val => args.indexOf(`--${val}`) === -1); - if (notInArgs) { - const startsByTwoDashes = (s) => /^--/.test(s); - const isShortOption = (s) => /^[^0-9]$/.test(s); - const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--'; - if (!zshShell) { - completions.push(dashes + key); - } - else { - const desc = descs[key] || ''; - completions.push(dashes + `${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`); - } - } - } - completeOptionKey(key); - if (negable && !!options.default[key]) - completeOptionKey(`no-${key}`); - }); - } - done(completions); - }; - // generate the completion script to add to your .bashrc. - self.generateCompletionScript = function generateCompletionScript($0, cmd) { - let script = zshShell ? templates.completionZshTemplate : templates.completionShTemplate; - const name = path.basename($0); - // add ./to applications not yet installed as bin. - if ($0.match(/\.js$/)) - $0 = `./${$0}`; - script = script.replace(/{{app_name}}/g, name); - script = script.replace(/{{completion_command}}/g, cmd); - return script.replace(/{{app_path}}/g, $0); - }; - // register a function to perform your own custom - // completions., this function can be either - // synchrnous or asynchronous. - let completionFunction = null; - self.registerFunction = (fn) => { - completionFunction = fn; - }; - return self; -} -exports.completion = completion; -function isSyncCompletionFunction(completionFunction) { - return completionFunction.length < 3; -} diff --git a/node_modules/yargs/build/lib/is-promise.d.ts b/node_modules/yargs/build/lib/is-promise.d.ts deleted file mode 100644 index 19b5566..0000000 --- a/node_modules/yargs/build/lib/is-promise.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function isPromise(maybePromise: T | Promise): maybePromise is Promise; diff --git a/node_modules/yargs/build/lib/is-promise.js b/node_modules/yargs/build/lib/is-promise.js deleted file mode 100644 index c24f9a8..0000000 --- a/node_modules/yargs/build/lib/is-promise.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isPromise = void 0; -function isPromise(maybePromise) { - return !!maybePromise && - !!maybePromise.then && - (typeof maybePromise.then === 'function'); -} -exports.isPromise = isPromise; diff --git a/node_modules/yargs/build/lib/levenshtein.d.ts b/node_modules/yargs/build/lib/levenshtein.d.ts deleted file mode 100644 index 08b6b7f..0000000 --- a/node_modules/yargs/build/lib/levenshtein.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function levenshtein(a: string, b: string): number; diff --git a/node_modules/yargs/build/lib/levenshtein.js b/node_modules/yargs/build/lib/levenshtein.js deleted file mode 100644 index 84c0831..0000000 --- a/node_modules/yargs/build/lib/levenshtein.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -/* -Copyright (c) 2011 Andrei Mackenzie - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.levenshtein = void 0; -// levenshtein distance algorithm, pulled from Andrei Mackenzie's MIT licensed. -// gist, which can be found here: https://gist.github.com/andrei-m/982927 -// Compute the edit distance between the two given strings -function levenshtein(a, b) { - if (a.length === 0) - return b.length; - if (b.length === 0) - return a.length; - const matrix = []; - // increment along the first column of each row - let i; - for (i = 0; i <= b.length; i++) { - matrix[i] = [i]; - } - // increment each column in the first row - let j; - for (j = 0; j <= a.length; j++) { - matrix[0][j] = j; - } - // Fill in the rest of the matrix - for (i = 1; i <= b.length; i++) { - for (j = 1; j <= a.length; j++) { - if (b.charAt(i - 1) === a.charAt(j - 1)) { - matrix[i][j] = matrix[i - 1][j - 1]; - } - else { - matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution - Math.min(matrix[i][j - 1] + 1, // insertion - matrix[i - 1][j] + 1)); // deletion - } - } - } - return matrix[b.length][a.length]; -} -exports.levenshtein = levenshtein; diff --git a/node_modules/yargs/build/lib/middleware.d.ts b/node_modules/yargs/build/lib/middleware.d.ts deleted file mode 100644 index 8fa7c34..0000000 --- a/node_modules/yargs/build/lib/middleware.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { YargsInstance, Arguments } from './yargs'; -export declare function globalMiddlewareFactory(globalMiddleware: Middleware[], context: T): (callback: MiddlewareCallback | MiddlewareCallback[], applyBeforeValidation?: boolean) => T; -export declare function commandMiddlewareFactory(commandMiddleware?: MiddlewareCallback[]): Middleware[]; -export declare function applyMiddleware(argv: Arguments | Promise, yargs: YargsInstance, middlewares: Middleware[], beforeValidation: boolean): Arguments | Promise; -export interface MiddlewareCallback { - (argv: Arguments, yargs: YargsInstance): Partial | Promise>; -} -export interface Middleware extends MiddlewareCallback { - applyBeforeValidation: boolean; -} diff --git a/node_modules/yargs/build/lib/middleware.js b/node_modules/yargs/build/lib/middleware.js deleted file mode 100644 index e93b6d2..0000000 --- a/node_modules/yargs/build/lib/middleware.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.applyMiddleware = exports.commandMiddlewareFactory = exports.globalMiddlewareFactory = void 0; -const argsert_1 = require("./argsert"); -const is_promise_1 = require("./is-promise"); -function globalMiddlewareFactory(globalMiddleware, context) { - return function (callback, applyBeforeValidation = false) { - argsert_1.argsert(' [boolean]', [callback, applyBeforeValidation], arguments.length); - if (Array.isArray(callback)) { - for (let i = 0; i < callback.length; i++) { - if (typeof callback[i] !== 'function') { - throw Error('middleware must be a function'); - } - callback[i].applyBeforeValidation = applyBeforeValidation; - } - Array.prototype.push.apply(globalMiddleware, callback); - } - else if (typeof callback === 'function') { - callback.applyBeforeValidation = applyBeforeValidation; - globalMiddleware.push(callback); - } - return context; - }; -} -exports.globalMiddlewareFactory = globalMiddlewareFactory; -function commandMiddlewareFactory(commandMiddleware) { - if (!commandMiddleware) - return []; - return commandMiddleware.map(middleware => { - middleware.applyBeforeValidation = false; - return middleware; - }); -} -exports.commandMiddlewareFactory = commandMiddlewareFactory; -function applyMiddleware(argv, yargs, middlewares, beforeValidation) { - const beforeValidationError = new Error('middleware cannot return a promise when applyBeforeValidation is true'); - return middlewares - .reduce((acc, middleware) => { - if (middleware.applyBeforeValidation !== beforeValidation) { - return acc; - } - if (is_promise_1.isPromise(acc)) { - return acc - .then(initialObj => Promise.all([initialObj, middleware(initialObj, yargs)])) - .then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj)); - } - else { - const result = middleware(acc, yargs); - if (beforeValidation && is_promise_1.isPromise(result)) - throw beforeValidationError; - return is_promise_1.isPromise(result) - ? result.then(middlewareObj => Object.assign(acc, middlewareObj)) - : Object.assign(acc, result); - } - }, argv); -} -exports.applyMiddleware = applyMiddleware; diff --git a/node_modules/yargs/build/lib/obj-filter.d.ts b/node_modules/yargs/build/lib/obj-filter.d.ts deleted file mode 100644 index 031ae28..0000000 --- a/node_modules/yargs/build/lib/obj-filter.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function objFilter(original?: T, filter?: (k: keyof T, v: T[keyof T]) => boolean): T; diff --git a/node_modules/yargs/build/lib/obj-filter.js b/node_modules/yargs/build/lib/obj-filter.js deleted file mode 100644 index 790f947..0000000 --- a/node_modules/yargs/build/lib/obj-filter.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.objFilter = void 0; -const common_types_1 = require("./common-types"); -function objFilter(original = {}, filter = () => true) { - const obj = {}; - common_types_1.objectKeys(original).forEach((key) => { - if (filter(key, original[key])) { - obj[key] = original[key]; - } - }); - return obj; -} -exports.objFilter = objFilter; diff --git a/node_modules/yargs/build/lib/parse-command.d.ts b/node_modules/yargs/build/lib/parse-command.d.ts deleted file mode 100644 index fc57836..0000000 --- a/node_modules/yargs/build/lib/parse-command.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NotEmptyArray } from './common-types'; -export declare function parseCommand(cmd: string): ParsedCommand; -export interface ParsedCommand { - cmd: string; - demanded: Positional[]; - optional: Positional[]; -} -export interface Positional { - cmd: NotEmptyArray; - variadic: boolean; -} diff --git a/node_modules/yargs/build/lib/parse-command.js b/node_modules/yargs/build/lib/parse-command.js deleted file mode 100644 index aaf2327..0000000 --- a/node_modules/yargs/build/lib/parse-command.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseCommand = void 0; -function parseCommand(cmd) { - const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' '); - const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/); - const bregex = /\.*[\][<>]/g; - const firstCommand = splitCommand.shift(); - if (!firstCommand) - throw new Error(`No command found in: ${cmd}`); - const parsedCommand = { - cmd: firstCommand.replace(bregex, ''), - demanded: [], - optional: [] - }; - splitCommand.forEach((cmd, i) => { - let variadic = false; - cmd = cmd.replace(/\s/g, ''); - if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1) - variadic = true; - if (/^\[/.test(cmd)) { - parsedCommand.optional.push({ - cmd: cmd.replace(bregex, '').split('|'), - variadic - }); - } - else { - parsedCommand.demanded.push({ - cmd: cmd.replace(bregex, '').split('|'), - variadic - }); - } - }); - return parsedCommand; -} -exports.parseCommand = parseCommand; diff --git a/node_modules/yargs/build/lib/process-argv.d.ts b/node_modules/yargs/build/lib/process-argv.d.ts deleted file mode 100644 index 18fd43b..0000000 --- a/node_modules/yargs/build/lib/process-argv.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function getProcessArgvWithoutBin(): string[]; -export declare function getProcessArgvBin(): string; diff --git a/node_modules/yargs/build/lib/process-argv.js b/node_modules/yargs/build/lib/process-argv.js deleted file mode 100644 index a9201dd..0000000 --- a/node_modules/yargs/build/lib/process-argv.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getProcessArgvBin = exports.getProcessArgvWithoutBin = void 0; -function getProcessArgvBinIndex() { - // The binary name is the first command line argument for: - // - bundled Electron apps: bin argv1 argv2 ... argvn - if (isBundledElectronApp()) - return 0; - // or the second one (default) for: - // - standard node apps: node bin.js argv1 argv2 ... argvn - // - unbundled Electron apps: electron bin.js argv1 arg2 ... argvn - return 1; -} -function isBundledElectronApp() { - // process.defaultApp is either set by electron in an electron unbundled app, or undefined - // see https://github.com/electron/electron/blob/master/docs/api/process.md#processdefaultapp-readonly - return isElectronApp() && !process.defaultApp; -} -function isElectronApp() { - // process.versions.electron is either set by electron, or undefined - // see https://github.com/electron/electron/blob/master/docs/api/process.md#processversionselectron-readonly - return !!process.versions.electron; -} -function getProcessArgvWithoutBin() { - return process.argv.slice(getProcessArgvBinIndex() + 1); -} -exports.getProcessArgvWithoutBin = getProcessArgvWithoutBin; -function getProcessArgvBin() { - return process.argv[getProcessArgvBinIndex()]; -} -exports.getProcessArgvBin = getProcessArgvBin; diff --git a/node_modules/yargs/build/lib/usage.d.ts b/node_modules/yargs/build/lib/usage.d.ts deleted file mode 100644 index d9dd1fa..0000000 --- a/node_modules/yargs/build/lib/usage.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Dictionary } from './common-types'; -import { YargsInstance } from './yargs'; -import { YError } from './yerror'; -import { Y18N } from 'y18n'; -export declare function usage(yargs: YargsInstance, y18n: Y18N): UsageInstance; -/** Instance of the usage module. */ -export interface UsageInstance { - cacheHelpMessage(): void; - clearCachedHelpMessage(): void; - command(cmd: string, description: string | undefined, isDefault: boolean, aliases: string[], deprecated?: boolean): void; - deferY18nLookup(str: string): string; - describe(keys: string | string[] | Dictionary, desc?: string): void; - epilog(msg: string): void; - example(cmd: string, description?: string): void; - fail(msg?: string | null, err?: YError | string): void; - failFn(f: FailureFunction): void; - freeze(): void; - functionDescription(fn: { - name?: string; - }): string; - getCommands(): [string, string, boolean, string[], boolean][]; - getDescriptions(): Dictionary; - getPositionalGroupName(): string; - getUsage(): [string, string][]; - getUsageDisabled(): boolean; - help(): string; - reset(localLookup: Dictionary): UsageInstance; - showHelp(level: 'error' | 'log' | ((message: string) => void)): void; - showHelpOnFail(enabled?: boolean | string, message?: string): UsageInstance; - showVersion(): void; - stringifiedValues(values?: any[], separator?: string): string; - unfreeze(): void; - usage(msg: string | null, description?: string | false): UsageInstance; - version(ver: any): void; - wrap(cols: number | null | undefined): void; -} -export interface FailureFunction { - (msg: string | undefined | null, err: YError | string | undefined, usage: UsageInstance): void; -} -export interface FrozenUsageInstance { - failMessage: string | undefined | null; - failureOutput: boolean; - usages: [string, string][]; - usageDisabled: boolean; - epilogs: string[]; - examples: [string, string][]; - commands: [string, string, boolean, string[], boolean][]; - descriptions: Dictionary; -} diff --git a/node_modules/yargs/build/lib/usage.js b/node_modules/yargs/build/lib/usage.js deleted file mode 100644 index 73f7b24..0000000 --- a/node_modules/yargs/build/lib/usage.js +++ /dev/null @@ -1,540 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.usage = void 0; -// this file handles outputting usage instructions, -// failures, etc. keeps logging in one place. -const common_types_1 = require("./common-types"); -const obj_filter_1 = require("./obj-filter"); -const path = require("path"); -const yerror_1 = require("./yerror"); -const decamelize = require("decamelize"); -const setBlocking = require("set-blocking"); -const stringWidth = require("string-width"); -function usage(yargs, y18n) { - const __ = y18n.__; - const self = {}; - // methods for ouputting/building failure message. - const fails = []; - self.failFn = function failFn(f) { - fails.push(f); - }; - let failMessage = null; - let showHelpOnFail = true; - self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) { - function parseFunctionArgs() { - return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2]; - } - const [enabled, message] = parseFunctionArgs(); - failMessage = message; - showHelpOnFail = enabled; - return self; - }; - let failureOutput = false; - self.fail = function fail(msg, err) { - const logger = yargs._getLoggerInstance(); - if (fails.length) { - for (let i = fails.length - 1; i >= 0; --i) { - fails[i](msg, err, self); - } - } - else { - if (yargs.getExitProcess()) - setBlocking(true); - // don't output failure message more than once - if (!failureOutput) { - failureOutput = true; - if (showHelpOnFail) { - yargs.showHelp('error'); - logger.error(); - } - if (msg || err) - logger.error(msg || err); - if (failMessage) { - if (msg || err) - logger.error(''); - logger.error(failMessage); - } - } - err = err || new yerror_1.YError(msg); - if (yargs.getExitProcess()) { - return yargs.exit(1); - } - else if (yargs._hasParseCallback()) { - return yargs.exit(1, err); - } - else { - throw err; - } - } - }; - // methods for ouputting/building help (usage) message. - let usages = []; - let usageDisabled = false; - self.usage = (msg, description) => { - if (msg === null) { - usageDisabled = true; - usages = []; - return self; - } - usageDisabled = false; - usages.push([msg, description || '']); - return self; - }; - self.getUsage = () => { - return usages; - }; - self.getUsageDisabled = () => { - return usageDisabled; - }; - self.getPositionalGroupName = () => { - return __('Positionals:'); - }; - let examples = []; - self.example = (cmd, description) => { - examples.push([cmd, description || '']); - }; - let commands = []; - self.command = function command(cmd, description, isDefault, aliases, deprecated = false) { - // the last default wins, so cancel out any previously set default - if (isDefault) { - commands = commands.map((cmdArray) => { - cmdArray[2] = false; - return cmdArray; - }); - } - commands.push([cmd, description || '', isDefault, aliases, deprecated]); - }; - self.getCommands = () => commands; - let descriptions = {}; - self.describe = function describe(keyOrKeys, desc) { - if (Array.isArray(keyOrKeys)) { - keyOrKeys.forEach((k) => { - self.describe(k, desc); - }); - } - else if (typeof keyOrKeys === 'object') { - Object.keys(keyOrKeys).forEach((k) => { - self.describe(k, keyOrKeys[k]); - }); - } - else { - descriptions[keyOrKeys] = desc; - } - }; - self.getDescriptions = () => descriptions; - let epilogs = []; - self.epilog = (msg) => { - epilogs.push(msg); - }; - let wrapSet = false; - let wrap; - self.wrap = (cols) => { - wrapSet = true; - wrap = cols; - }; - function getWrap() { - if (!wrapSet) { - wrap = windowWidth(); - wrapSet = true; - } - return wrap; - } - const deferY18nLookupPrefix = '__yargsString__:'; - self.deferY18nLookup = str => deferY18nLookupPrefix + str; - self.help = function help() { - if (cachedHelpMessage) - return cachedHelpMessage; - normalizeAliases(); - // handle old demanded API - const base$0 = yargs.customScriptName ? yargs.$0 : path.basename(yargs.$0); - const demandedOptions = yargs.getDemandedOptions(); - const demandedCommands = yargs.getDemandedCommands(); - const deprecatedOptions = yargs.getDeprecatedOptions(); - const groups = yargs.getGroups(); - const options = yargs.getOptions(); - let keys = []; - keys = keys.concat(Object.keys(descriptions)); - keys = keys.concat(Object.keys(demandedOptions)); - keys = keys.concat(Object.keys(demandedCommands)); - keys = keys.concat(Object.keys(options.default)); - keys = keys.filter(filterHiddenOptions); - keys = Object.keys(keys.reduce((acc, key) => { - if (key !== '_') - acc[key] = true; - return acc; - }, {})); - const theWrap = getWrap(); - const ui = require('cliui')({ - width: theWrap, - wrap: !!theWrap - }); - // the usage string. - if (!usageDisabled) { - if (usages.length) { - // user-defined usage. - usages.forEach((usage) => { - ui.div(`${usage[0].replace(/\$0/g, base$0)}`); - if (usage[1]) { - ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] }); - } - }); - ui.div(); - } - else if (commands.length) { - let u = null; - // demonstrate how commands are used. - if (demandedCommands._) { - u = `${base$0} <${__('command')}>\n`; - } - else { - u = `${base$0} [${__('command')}]\n`; - } - ui.div(`${u}`); - } - } - // your application's commands, i.e., non-option - // arguments populated in '_'. - if (commands.length) { - ui.div(__('Commands:')); - const context = yargs.getContext(); - const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : ''; - if (yargs.getParserConfiguration()['sort-commands'] === true) { - commands = commands.sort((a, b) => a[0].localeCompare(b[0])); - } - commands.forEach((command) => { - const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}`; // drop $0 from default commands. - ui.span({ - text: commandString, - padding: [0, 2, 0, 2], - width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4 - }, { text: command[1] }); - const hints = []; - if (command[2]) - hints.push(`[${__('default')}]`); - if (command[3] && command[3].length) { - hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`); - } - if (command[4]) { - if (typeof command[4] === 'string') { - hints.push(`[${__('deprecated: %s', command[4])}]`); - } - else { - hints.push(`[${__('deprecated')}]`); - } - } - if (hints.length) { - ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' }); - } - else { - ui.div(); - } - }); - ui.div(); - } - // perform some cleanup on the keys array, making it - // only include top-level keys not their aliases. - const aliasKeys = (Object.keys(options.alias) || []) - .concat(Object.keys(yargs.parsed.newAliases) || []); - keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1)); - // populate 'Options:' group with any keys that have not - // explicitly had a group set. - const defaultGroup = __('Options:'); - if (!groups[defaultGroup]) - groups[defaultGroup] = []; - addUngroupedKeys(keys, options.alias, groups, defaultGroup); - // display 'Options:' table along with any custom tables: - Object.keys(groups).forEach((groupName) => { - if (!groups[groupName].length) - return; - // if we've grouped the key 'f', but 'f' aliases 'foobar', - // normalizedKeys should contain only 'foobar'. - const normalizedKeys = groups[groupName].filter(filterHiddenOptions).map((key) => { - if (~aliasKeys.indexOf(key)) - return key; - for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) { - if (~(options.alias[aliasKey] || []).indexOf(key)) - return aliasKey; - } - return key; - }); - if (normalizedKeys.length < 1) - return; - ui.div(groupName); - // actually generate the switches string --foo, -f, --bar. - const switches = normalizedKeys.reduce((acc, key) => { - acc[key] = [key].concat(options.alias[key] || []) - .map(sw => { - // for the special positional group don't - // add '--' or '-' prefix. - if (groupName === self.getPositionalGroupName()) - return sw; - else { - return ( - // matches yargs-parser logic in which single-digits - // aliases declared with a boolean type are now valid - /^[0-9]$/.test(sw) - ? ~options.boolean.indexOf(key) ? '-' : '--' - : sw.length > 1 ? '--' : '-') + sw; - } - }) - .join(', '); - return acc; - }, {}); - normalizedKeys.forEach((key) => { - const kswitch = switches[key]; - let desc = descriptions[key] || ''; - let type = null; - if (~desc.lastIndexOf(deferY18nLookupPrefix)) - desc = __(desc.substring(deferY18nLookupPrefix.length)); - if (~options.boolean.indexOf(key)) - type = `[${__('boolean')}]`; - if (~options.count.indexOf(key)) - type = `[${__('count')}]`; - if (~options.string.indexOf(key)) - type = `[${__('string')}]`; - if (~options.normalize.indexOf(key)) - type = `[${__('string')}]`; - if (~options.array.indexOf(key)) - type = `[${__('array')}]`; - if (~options.number.indexOf(key)) - type = `[${__('number')}]`; - const deprecatedExtra = (deprecated) => typeof deprecated === 'string' - ? `[${__('deprecated: %s', deprecated)}]` - : `[${__('deprecated')}]`; - const extra = [ - (key in deprecatedOptions) ? deprecatedExtra(deprecatedOptions[key]) : null, - type, - (key in demandedOptions) ? `[${__('required')}]` : null, - options.choices && options.choices[key] ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]` : null, - defaultString(options.default[key], options.defaultDescription[key]) - ].filter(Boolean).join(' '); - ui.span({ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 }, desc); - if (extra) - ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' }); - else - ui.div(); - }); - ui.div(); - }); - // describe some common use-cases for your application. - if (examples.length) { - ui.div(__('Examples:')); - examples.forEach((example) => { - example[0] = example[0].replace(/\$0/g, base$0); - }); - examples.forEach((example) => { - if (example[1] === '') { - ui.div({ - text: example[0], - padding: [0, 2, 0, 2] - }); - } - else { - ui.div({ - text: example[0], - padding: [0, 2, 0, 2], - width: maxWidth(examples, theWrap) + 4 - }, { - text: example[1] - }); - } - }); - ui.div(); - } - // the usage string. - if (epilogs.length > 0) { - const e = epilogs.map(epilog => epilog.replace(/\$0/g, base$0)).join('\n'); - ui.div(`${e}\n`); - } - // Remove the trailing white spaces - return ui.toString().replace(/\s*$/, ''); - }; - // return the maximum width of a string - // in the left-hand column of a table. - function maxWidth(table, theWrap, modifier) { - let width = 0; - // table might be of the form [leftColumn], - // or {key: leftColumn} - if (!Array.isArray(table)) { - table = Object.values(table).map(v => [v]); - } - table.forEach((v) => { - width = Math.max(stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]), width); - }); - // if we've enabled 'wrap' we should limit - // the max-width of the left-column. - if (theWrap) - width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10)); - return width; - } - // make sure any options set for aliases, - // are copied to the keys being aliased. - function normalizeAliases() { - // handle old demanded API - const demandedOptions = yargs.getDemandedOptions(); - const options = yargs.getOptions(); - (Object.keys(options.alias) || []).forEach((key) => { - options.alias[key].forEach((alias) => { - // copy descriptions. - if (descriptions[alias]) - self.describe(key, descriptions[alias]); - // copy demanded. - if (alias in demandedOptions) - yargs.demandOption(key, demandedOptions[alias]); - // type messages. - if (~options.boolean.indexOf(alias)) - yargs.boolean(key); - if (~options.count.indexOf(alias)) - yargs.count(key); - if (~options.string.indexOf(alias)) - yargs.string(key); - if (~options.normalize.indexOf(alias)) - yargs.normalize(key); - if (~options.array.indexOf(alias)) - yargs.array(key); - if (~options.number.indexOf(alias)) - yargs.number(key); - }); - }); - } - // if yargs is executing an async handler, we take a snapshot of the - // help message to display on failure: - let cachedHelpMessage; - self.cacheHelpMessage = function () { - cachedHelpMessage = this.help(); - }; - // however this snapshot must be cleared afterwards - // not to be be used by next calls to parse - self.clearCachedHelpMessage = function () { - cachedHelpMessage = undefined; - }; - // given a set of keys, place any keys that are - // ungrouped under the 'Options:' grouping. - function addUngroupedKeys(keys, aliases, groups, defaultGroup) { - let groupedKeys = []; - let toCheck = null; - Object.keys(groups).forEach((group) => { - groupedKeys = groupedKeys.concat(groups[group]); - }); - keys.forEach((key) => { - toCheck = [key].concat(aliases[key]); - if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) { - groups[defaultGroup].push(key); - } - }); - return groupedKeys; - } - function filterHiddenOptions(key) { - return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt]; - } - self.showHelp = (level) => { - const logger = yargs._getLoggerInstance(); - if (!level) - level = 'error'; - const emit = typeof level === 'function' ? level : logger[level]; - emit(self.help()); - }; - self.functionDescription = (fn) => { - const description = fn.name ? decamelize(fn.name, '-') : __('generated-value'); - return ['(', description, ')'].join(''); - }; - self.stringifiedValues = function stringifiedValues(values, separator) { - let string = ''; - const sep = separator || ', '; - const array = [].concat(values); - if (!values || !array.length) - return string; - array.forEach((value) => { - if (string.length) - string += sep; - string += JSON.stringify(value); - }); - return string; - }; - // format the default-value-string displayed in - // the right-hand column. - function defaultString(value, defaultDescription) { - let string = `[${__('default:')} `; - if (value === undefined && !defaultDescription) - return null; - if (defaultDescription) { - string += defaultDescription; - } - else { - switch (typeof value) { - case 'string': - string += `"${value}"`; - break; - case 'object': - string += JSON.stringify(value); - break; - default: - string += value; - } - } - return `${string}]`; - } - // guess the width of the console window, max-width 80. - function windowWidth() { - const maxWidth = 80; - // CI is not a TTY - /* c8 ignore next 2 */ - if (typeof process === 'object' && process.stdout && process.stdout.columns) { - return Math.min(maxWidth, process.stdout.columns); - } - else { - return maxWidth; - } - } - // logic for displaying application version. - let version = null; - self.version = (ver) => { - version = ver; - }; - self.showVersion = () => { - const logger = yargs._getLoggerInstance(); - logger.log(version); - }; - self.reset = function reset(localLookup) { - // do not reset wrap here - // do not reset fails here - failMessage = null; - failureOutput = false; - usages = []; - usageDisabled = false; - epilogs = []; - examples = []; - commands = []; - descriptions = obj_filter_1.objFilter(descriptions, k => !localLookup[k]); - return self; - }; - const frozens = []; - self.freeze = function freeze() { - frozens.push({ - failMessage, - failureOutput, - usages, - usageDisabled, - epilogs, - examples, - commands, - descriptions - }); - }; - self.unfreeze = function unfreeze() { - const frozen = frozens.pop(); - common_types_1.assertNotStrictEqual(frozen, undefined); - ({ - failMessage, - failureOutput, - usages, - usageDisabled, - epilogs, - examples, - commands, - descriptions - } = frozen); - }; - return self; -} -exports.usage = usage; diff --git a/node_modules/yargs/build/lib/validation.d.ts b/node_modules/yargs/build/lib/validation.d.ts deleted file mode 100644 index e2d7854..0000000 --- a/node_modules/yargs/build/lib/validation.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Dictionary } from './common-types'; -import { UsageInstance } from './usage'; -import { YargsInstance, Arguments } from './yargs'; -import { DetailedArguments } from 'yargs-parser'; -import { Y18N } from 'y18n'; -export declare function validation(yargs: YargsInstance, usage: UsageInstance, y18n: Y18N): ValidationInstance; -/** Instance of the validation module. */ -export interface ValidationInstance { - check(f: CustomCheck['func'], global: boolean): void; - conflicting(argv: Arguments): void; - conflicts(key: string | Dictionary, value?: string | string[]): void; - customChecks(argv: Arguments, aliases: DetailedArguments['aliases']): void; - freeze(): void; - getConflicting(): Dictionary<(string | undefined)[]>; - getImplied(): Dictionary; - implications(argv: Arguments): void; - implies(key: string | Dictionary, value?: KeyOrPos | KeyOrPos[]): void; - isValidAndSomeAliasIsNotNew(key: string, aliases: DetailedArguments['aliases']): boolean; - limitedChoices(argv: Arguments): void; - nonOptionCount(argv: Arguments): void; - positionalCount(required: number, observed: number): void; - recommendCommands(cmd: string, potentialCommands: string[]): void; - requiredArguments(argv: Arguments): void; - reset(localLookup: Dictionary): ValidationInstance; - unfreeze(): void; - unknownArguments(argv: Arguments, aliases: DetailedArguments['aliases'], positionalMap: Dictionary, isDefaultCommand: boolean): void; - unknownCommands(argv: Arguments): boolean; -} -interface CustomCheck { - func: (argv: Arguments, aliases: DetailedArguments['aliases']) => any; - global: boolean; -} -export declare type KeyOrPos = string | number; -export {}; diff --git a/node_modules/yargs/build/lib/validation.js b/node_modules/yargs/build/lib/validation.js deleted file mode 100644 index 60c5e43..0000000 --- a/node_modules/yargs/build/lib/validation.js +++ /dev/null @@ -1,330 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validation = void 0; -const argsert_1 = require("./argsert"); -const common_types_1 = require("./common-types"); -const levenshtein_1 = require("./levenshtein"); -const obj_filter_1 = require("./obj-filter"); -const specialKeys = ['$0', '--', '_']; -// validation-type-stuff, missing params, -// bad implications, custom checks. -function validation(yargs, usage, y18n) { - const __ = y18n.__; - const __n = y18n.__n; - const self = {}; - // validate appropriate # of non-option - // arguments were provided, i.e., '_'. - self.nonOptionCount = function nonOptionCount(argv) { - const demandedCommands = yargs.getDemandedCommands(); - // don't count currently executing commands - const _s = argv._.length - yargs.getContext().commands.length; - if (demandedCommands._ && (_s < demandedCommands._.min || _s > demandedCommands._.max)) { - if (_s < demandedCommands._.min) { - if (demandedCommands._.minMsg !== undefined) { - usage.fail( - // replace $0 with observed, $1 with expected. - demandedCommands._.minMsg - ? demandedCommands._.minMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.min.toString()) - : null); - } - else { - usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s, demandedCommands._.min)); - } - } - else if (_s > demandedCommands._.max) { - if (demandedCommands._.maxMsg !== undefined) { - usage.fail( - // replace $0 with observed, $1 with expected. - demandedCommands._.maxMsg - ? demandedCommands._.maxMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.max.toString()) - : null); - } - else { - usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s, demandedCommands._.max)); - } - } - } - }; - // validate the appropriate # of - // positional arguments were provided: - self.positionalCount = function positionalCount(required, observed) { - if (observed < required) { - usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed, required)); - } - }; - // make sure all the required arguments are present. - self.requiredArguments = function requiredArguments(argv) { - const demandedOptions = yargs.getDemandedOptions(); - let missing = null; - for (const key of Object.keys(demandedOptions)) { - if (!Object.prototype.hasOwnProperty.call(argv, key) || typeof argv[key] === 'undefined') { - missing = missing || {}; - missing[key] = demandedOptions[key]; - } - } - if (missing) { - const customMsgs = []; - for (const key of Object.keys(missing)) { - const msg = missing[key]; - if (msg && customMsgs.indexOf(msg) < 0) { - customMsgs.push(msg); - } - } - const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : ''; - usage.fail(__n('Missing required argument: %s', 'Missing required arguments: %s', Object.keys(missing).length, Object.keys(missing).join(', ') + customMsg)); - } - }; - // check for unknown arguments (strict-mode). - self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand) { - const commandKeys = yargs.getCommandInstance().getCommands(); - const unknown = []; - const currentContext = yargs.getContext(); - Object.keys(argv).forEach((key) => { - if (specialKeys.indexOf(key) === -1 && - !Object.prototype.hasOwnProperty.call(positionalMap, key) && - !Object.prototype.hasOwnProperty.call(yargs._getParseContext(), key) && - !self.isValidAndSomeAliasIsNotNew(key, aliases)) { - unknown.push(key); - } - }); - if ((currentContext.commands.length > 0) || (commandKeys.length > 0) || isDefaultCommand) { - argv._.slice(currentContext.commands.length).forEach((key) => { - if (commandKeys.indexOf(key) === -1) { - unknown.push(key); - } - }); - } - if (unknown.length > 0) { - usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.join(', '))); - } - }; - self.unknownCommands = function unknownCommands(argv) { - const commandKeys = yargs.getCommandInstance().getCommands(); - const unknown = []; - const currentContext = yargs.getContext(); - if ((currentContext.commands.length > 0) || (commandKeys.length > 0)) { - argv._.slice(currentContext.commands.length).forEach((key) => { - if (commandKeys.indexOf(key) === -1) { - unknown.push(key); - } - }); - } - if (unknown.length > 0) { - usage.fail(__n('Unknown command: %s', 'Unknown commands: %s', unknown.length, unknown.join(', '))); - return true; - } - else { - return false; - } - }; - // check for a key that is not an alias, or for which every alias is new, - // implying that it was invented by the parser, e.g., during camelization - self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) { - if (!Object.prototype.hasOwnProperty.call(aliases, key)) { - return false; - } - const newAliases = yargs.parsed.newAliases; - for (const a of [key, ...aliases[key]]) { - if (!Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]) { - return true; - } - } - return false; - }; - // validate arguments limited to enumerated choices - self.limitedChoices = function limitedChoices(argv) { - const options = yargs.getOptions(); - const invalid = {}; - if (!Object.keys(options.choices).length) - return; - Object.keys(argv).forEach((key) => { - if (specialKeys.indexOf(key) === -1 && - Object.prototype.hasOwnProperty.call(options.choices, key)) { - [].concat(argv[key]).forEach((value) => { - // TODO case-insensitive configurability - if (options.choices[key].indexOf(value) === -1 && - value !== undefined) { - invalid[key] = (invalid[key] || []).concat(value); - } - }); - } - }); - const invalidKeys = Object.keys(invalid); - if (!invalidKeys.length) - return; - let msg = __('Invalid values:'); - invalidKeys.forEach((key) => { - msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`; - }); - usage.fail(msg); - }; - // custom checks, added using the `check` option on yargs. - let checks = []; - self.check = function check(f, global) { - checks.push({ - func: f, - global - }); - }; - self.customChecks = function customChecks(argv, aliases) { - for (let i = 0, f; (f = checks[i]) !== undefined; i++) { - const func = f.func; - let result = null; - try { - result = func(argv, aliases); - } - catch (err) { - usage.fail(err.message ? err.message : err, err); - continue; - } - if (!result) { - usage.fail(__('Argument check failed: %s', func.toString())); - } - else if (typeof result === 'string' || result instanceof Error) { - usage.fail(result.toString(), result); - } - } - }; - // check implications, argument foo implies => argument bar. - let implied = {}; - self.implies = function implies(key, value) { - argsert_1.argsert(' [array|number|string]', [key, value], arguments.length); - if (typeof key === 'object') { - Object.keys(key).forEach((k) => { - self.implies(k, key[k]); - }); - } - else { - yargs.global(key); - if (!implied[key]) { - implied[key] = []; - } - if (Array.isArray(value)) { - value.forEach((i) => self.implies(key, i)); - } - else { - common_types_1.assertNotStrictEqual(value, undefined); - implied[key].push(value); - } - } - }; - self.getImplied = function getImplied() { - return implied; - }; - function keyExists(argv, val) { - // convert string '1' to number 1 - const num = Number(val); - val = isNaN(num) ? val : num; - if (typeof val === 'number') { - // check length of argv._ - val = argv._.length >= val; - } - else if (val.match(/^--no-.+/)) { - // check if key/value doesn't exist - val = val.match(/^--no-(.+)/)[1]; - val = !argv[val]; - } - else { - // check if key/value exists - val = argv[val]; - } - return val; - } - self.implications = function implications(argv) { - const implyFail = []; - Object.keys(implied).forEach((key) => { - const origKey = key; - (implied[key] || []).forEach((value) => { - let key = origKey; - const origValue = value; - key = keyExists(argv, key); - value = keyExists(argv, value); - if (key && !value) { - implyFail.push(` ${origKey} -> ${origValue}`); - } - }); - }); - if (implyFail.length) { - let msg = `${__('Implications failed:')}\n`; - implyFail.forEach((value) => { - msg += (value); - }); - usage.fail(msg); - } - }; - let conflicting = {}; - self.conflicts = function conflicts(key, value) { - argsert_1.argsert(' [array|string]', [key, value], arguments.length); - if (typeof key === 'object') { - Object.keys(key).forEach((k) => { - self.conflicts(k, key[k]); - }); - } - else { - yargs.global(key); - if (!conflicting[key]) { - conflicting[key] = []; - } - if (Array.isArray(value)) { - value.forEach((i) => self.conflicts(key, i)); - } - else { - conflicting[key].push(value); - } - } - }; - self.getConflicting = () => conflicting; - self.conflicting = function conflictingFn(argv) { - Object.keys(argv).forEach((key) => { - if (conflicting[key]) { - conflicting[key].forEach((value) => { - // we default keys to 'undefined' that have been configured, we should not - // apply conflicting check unless they are a value other than 'undefined'. - if (value && argv[key] !== undefined && argv[value] !== undefined) { - usage.fail(__('Arguments %s and %s are mutually exclusive', key, value)); - } - }); - } - }); - }; - self.recommendCommands = function recommendCommands(cmd, potentialCommands) { - const threshold = 3; // if it takes more than three edits, let's move on. - potentialCommands = potentialCommands.sort((a, b) => b.length - a.length); - let recommended = null; - let bestDistance = Infinity; - for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) { - const d = levenshtein_1.levenshtein(cmd, candidate); - if (d <= threshold && d < bestDistance) { - bestDistance = d; - recommended = candidate; - } - } - if (recommended) - usage.fail(__('Did you mean %s?', recommended)); - }; - self.reset = function reset(localLookup) { - implied = obj_filter_1.objFilter(implied, k => !localLookup[k]); - conflicting = obj_filter_1.objFilter(conflicting, k => !localLookup[k]); - checks = checks.filter(c => c.global); - return self; - }; - const frozens = []; - self.freeze = function freeze() { - frozens.push({ - implied, - checks, - conflicting - }); - }; - self.unfreeze = function unfreeze() { - const frozen = frozens.pop(); - common_types_1.assertNotStrictEqual(frozen, undefined); - ({ - implied, - checks, - conflicting - } = frozen); - }; - return self; -} -exports.validation = validation; diff --git a/node_modules/yargs/build/lib/yargs.d.ts b/node_modules/yargs/build/lib/yargs.d.ts deleted file mode 100644 index 8e6e27c..0000000 --- a/node_modules/yargs/build/lib/yargs.d.ts +++ /dev/null @@ -1,274 +0,0 @@ -/// -import { CommandInstance, CommandHandler, CommandBuilderDefinition, CommandBuilder, CommandHandlerCallback, FinishCommandHandler } from './command'; -import { Dictionary } from './common-types'; -import { Arguments as ParserArguments, DetailedArguments as ParserDetailedArguments, Configuration as ParserConfiguration, Options as ParserOptions, ConfigCallback, CoerceCallback } from 'yargs-parser'; -import { YError } from './yerror'; -import { UsageInstance, FailureFunction } from './usage'; -import { CompletionFunction } from './completion'; -import { ValidationInstance, KeyOrPos } from './validation'; -import { Y18N } from 'y18n'; -import { MiddlewareCallback, Middleware } from './middleware'; -import { RequireDirectoryOptions } from 'require-directory'; -export declare function Yargs(processArgs?: string | string[], cwd?: string, parentRequire?: NodeRequire): YargsInstance; -export declare function rebase(base: string, dir: string): string; -/** Instance of the yargs module. */ -export interface YargsInstance { - $0: string; - argv: Arguments; - customScriptName: boolean; - parsed: DetailedArguments | false; - _copyDoubleDash>(argv: T): T; - _getLoggerInstance(): LoggerInstance; - _getParseContext(): Object; - _hasOutput(): boolean; - _hasParseCallback(): boolean; - _parseArgs: { - (args: null, shortCircuit: null, _calledFromCommand: boolean, commandIndex?: number): Arguments | Promise; - (args: string | string[], shortCircuit?: boolean): Arguments | Promise; - }; - _runValidation(argv: Arguments, aliases: Dictionary, positionalMap: Dictionary, parseErrors: Error | null, isDefaultCommand?: boolean): void; - _setHasOutput(): void; - addHelpOpt: { - (opt?: string | false): YargsInstance; - (opt?: string, msg?: string): YargsInstance; - }; - addShowHiddenOpt: { - (opt?: string | false): YargsInstance; - (opt?: string, msg?: string): YargsInstance; - }; - alias: { - (keys: string | string[], aliases: string | string[]): YargsInstance; - (keyAliases: Dictionary): YargsInstance; - }; - array(keys: string | string[]): YargsInstance; - boolean(keys: string | string[]): YargsInstance; - check(f: (argv: Arguments, aliases: Dictionary) => any, _global?: boolean): YargsInstance; - choices: { - (keys: string | string[], choices: string | string[]): YargsInstance; - (keyChoices: Dictionary): YargsInstance; - }; - coerce: { - (keys: string | string[], coerceCallback: CoerceCallback): YargsInstance; - (keyCoerceCallbacks: Dictionary): YargsInstance; - }; - command(cmd: string | string[], description: CommandHandler['description'], builder?: CommandBuilderDefinition | CommandBuilder, handler?: CommandHandlerCallback, commandMiddleware?: Middleware[], deprecated?: boolean): YargsInstance; - commandDir(dir: string, opts?: RequireDirectoryOptions): YargsInstance; - completion: { - (cmd?: string, fn?: CompletionFunction): YargsInstance; - (cmd?: string, desc?: string | false, fn?: CompletionFunction): YargsInstance; - }; - config: { - (config: Dictionary): YargsInstance; - (keys?: string | string[], configCallback?: ConfigCallback): YargsInstance; - (keys?: string | string[], msg?: string, configCallback?: ConfigCallback): YargsInstance; - }; - conflicts: { - (key: string, conflictsWith: string | string[]): YargsInstance; - (keyConflicts: Dictionary): YargsInstance; - }; - count(keys: string | string[]): YargsInstance; - default: { - (key: string, value: any, defaultDescription?: string): YargsInstance; - (keys: string[], value: Exclude): YargsInstance; - (keys: Dictionary): YargsInstance; - }; - defaults: YargsInstance['default']; - demand: { - (min: number, max?: number | string, msg?: string): YargsInstance; - (keys: string | string[], msg?: string | true): YargsInstance; - (keys: string | string[], max: string[], msg?: string | true): YargsInstance; - (keyMsgs: Dictionary): YargsInstance; - (keyMsgs: Dictionary, max: string[], msg?: string): YargsInstance; - }; - demandCommand(): YargsInstance; - demandCommand(min: number, minMsg?: string): YargsInstance; - demandCommand(min: number, max: number, minMsg?: string | null, maxMsg?: string | null): YargsInstance; - demandOption: { - (keys: string | string[], msg?: string): YargsInstance; - (keyMsgs: Dictionary): YargsInstance; - }; - deprecateOption(option: string, message?: string | boolean): YargsInstance; - describe: { - (keys: string | string[], description?: string): YargsInstance; - (keyDescriptions: Dictionary): YargsInstance; - }; - detectLocale(detect: boolean): YargsInstance; - env(prefix?: string | false): YargsInstance; - epilog: YargsInstance['epilogue']; - epilogue(msg: string): YargsInstance; - example(cmd: string | [string, string?][], description?: string): YargsInstance; - exit(code: number, err?: YError | string): void; - exitProcess(enabled: boolean): YargsInstance; - fail(f: FailureFunction): YargsInstance; - getCommandInstance(): CommandInstance; - getCompletion(args: string[], done: (completions: string[]) => any): void; - getContext(): Context; - getDemandedCommands(): Options['demandedCommands']; - getDemandedOptions(): Options['demandedOptions']; - getDeprecatedOptions(): Options['deprecatedOptions']; - getDetectLocale(): boolean; - getExitProcess(): boolean; - getGroups(): Dictionary; - getHandlerFinishCommand(): FinishCommandHandler | null; - getOptions(): Options; - getParserConfiguration(): Configuration; - getStrict(): boolean; - getStrictCommands(): boolean; - getUsageInstance(): UsageInstance; - getValidationInstance(): ValidationInstance; - global(keys: string | string[], global?: boolean): YargsInstance; - group(keys: string | string[], groupName: string): YargsInstance; - help: YargsInstance['addHelpOpt']; - hide(key: string): YargsInstance; - implies: { - (key: string, implication: KeyOrPos | KeyOrPos[]): YargsInstance; - (keyImplications: Dictionary): YargsInstance; - }; - locale: { - (): string; - (locale: string): YargsInstance; - }; - middleware(callback: MiddlewareCallback | MiddlewareCallback[], applyBeforeValidation?: boolean): YargsInstance; - nargs: { - (keys: string | string[], nargs: number): YargsInstance; - (keyNargs: Dictionary): YargsInstance; - }; - normalize(keys: string | string[]): YargsInstance; - number(keys: string | string[]): YargsInstance; - onFinishCommand(f: FinishCommandHandler): YargsInstance; - option: { - (key: string, optionDefinition: OptionDefinition): YargsInstance; - (keyOptionDefinitions: Dictionary): YargsInstance; - }; - options: YargsInstance['option']; - parse: { - (): Arguments | Promise; - (args: string | string[], context: object, parseCallback?: ParseCallback): Arguments | Promise; - (args: string | string[], parseCallback: ParseCallback): Arguments | Promise; - (args: string | string[], shortCircuit: boolean): Arguments | Promise; - }; - parserConfiguration(config: Configuration): YargsInstance; - pkgConf(key: string, rootPath?: string): YargsInstance; - positional(key: string, positionalDefinition: PositionalDefinition): YargsInstance; - recommendCommands(recommend: boolean): YargsInstance; - require: YargsInstance['demand']; - required: YargsInstance['demand']; - requiresArg(keys: string | string[] | Dictionary): YargsInstance; - reset(aliases?: DetailedArguments['aliases']): YargsInstance; - resetOptions(aliases?: DetailedArguments['aliases']): YargsInstance; - scriptName(scriptName: string): YargsInstance; - showCompletionScript($0?: string, cmd?: string): YargsInstance; - showHelp(level: 'error' | 'log' | ((message: string) => void)): YargsInstance; - showHelpOnFail: { - (message?: string): YargsInstance; - (enabled: boolean, message: string): YargsInstance; - }; - showHidden: YargsInstance['addShowHiddenOpt']; - skipValidation(keys: string | string[]): YargsInstance; - strict(enable?: boolean): YargsInstance; - strictCommands(enable?: boolean): YargsInstance; - string(key: string | string[]): YargsInstance; - terminalWidth(): number | null; - updateStrings(obj: Dictionary): YargsInstance; - updateLocale: YargsInstance['updateStrings']; - usage: { - (msg: string | null): YargsInstance; - (msg: string, description: CommandHandler['description'], builder?: CommandBuilderDefinition | CommandBuilder, handler?: CommandHandlerCallback): YargsInstance; - }; - version: { - (ver?: string | false): YargsInstance; - (key?: string, ver?: string): YargsInstance; - (key?: string, msg?: string, ver?: string): YargsInstance; - }; - wrap(cols: number | null | undefined): YargsInstance; -} -export declare function isYargsInstance(y: YargsInstance | void): y is YargsInstance; -/** Yargs' context. */ -export interface Context { - commands: string[]; - files: string[]; - fullCommands: string[]; -} -declare type LoggerInstance = Pick; -export interface Options extends ParserOptions { - __: Y18N['__']; - alias: Dictionary; - array: string[]; - boolean: string[]; - choices: Dictionary; - config: Dictionary; - configObjects: Dictionary[]; - configuration: Configuration; - count: string[]; - defaultDescription: Dictionary; - demandedCommands: Dictionary<{ - min: number; - max: number; - minMsg?: string | null; - maxMsg?: string | null; - }>; - demandedOptions: Dictionary; - deprecatedOptions: Dictionary; - hiddenOptions: string[]; - /** Manually set keys */ - key: Dictionary; - local: string[]; - normalize: string[]; - number: string[]; - showHiddenOpt: string; - skipValidation: string[]; - string: string[]; -} -export interface Configuration extends Partial { - /** Should a config object be deep-merged with the object config it extends? */ - 'deep-merge-config'?: boolean; - /** Should commands be sorted in help? */ - 'sort-commands'?: boolean; -} -export interface OptionDefinition { - alias?: string | string[]; - array?: boolean; - boolean?: boolean; - choices?: string | string[]; - coerce?: CoerceCallback; - config?: boolean; - configParser?: ConfigCallback; - conflicts?: string | string[]; - count?: boolean; - default?: any; - defaultDescription?: string; - deprecate?: string | boolean; - deprecated?: OptionDefinition['deprecate']; - desc?: string; - describe?: OptionDefinition['desc']; - description?: OptionDefinition['desc']; - demand?: string | true; - demandOption?: OptionDefinition['demand']; - global?: boolean; - group?: string; - hidden?: boolean; - implies?: string | number | KeyOrPos[]; - nargs?: number; - normalize?: boolean; - number?: boolean; - require?: OptionDefinition['demand']; - required?: OptionDefinition['demand']; - requiresArg?: boolean; - skipValidation?: boolean; - string?: boolean; - type?: 'array' | 'boolean' | 'count' | 'number' | 'string'; -} -interface PositionalDefinition extends Pick { - type?: 'boolean' | 'number' | 'string'; -} -interface ParseCallback { - (err: YError | string | undefined | null, argv: Arguments | Promise, output: string): void; -} -export interface Arguments extends ParserArguments { - /** The script name or node command */ - $0: string; -} -export interface DetailedArguments extends ParserDetailedArguments { - argv: Arguments; -} -export {}; diff --git a/node_modules/yargs/build/lib/yargs.js b/node_modules/yargs/build/lib/yargs.js deleted file mode 100644 index 316f3d6..0000000 --- a/node_modules/yargs/build/lib/yargs.js +++ /dev/null @@ -1,1190 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isYargsInstance = exports.rebase = exports.Yargs = void 0; -const command_1 = require("./command"); -const common_types_1 = require("./common-types"); -const yerror_1 = require("./yerror"); -const usage_1 = require("./usage"); -const argsert_1 = require("./argsert"); -const fs = require("fs"); -const completion_1 = require("./completion"); -const path = require("path"); -const validation_1 = require("./validation"); -const obj_filter_1 = require("./obj-filter"); -const apply_extends_1 = require("./apply-extends"); -const middleware_1 = require("./middleware"); -const processArgv = require("./process-argv"); -const is_promise_1 = require("./is-promise"); -const Parser = require("yargs-parser"); -const y18nFactory = require("y18n"); -const setBlocking = require("set-blocking"); -const findUp = require("find-up"); -const requireMainFilename = require("require-main-filename"); -function Yargs(processArgs = [], cwd = process.cwd(), parentRequire = require) { - const self = {}; - let command; - let completion = null; - let groups = {}; - const globalMiddleware = []; - let output = ''; - const preservedGroups = {}; - let usage; - let validation; - let handlerFinishCommand = null; - const y18n = y18nFactory({ - directory: path.resolve(__dirname, '../../locales'), - updateFiles: false - }); - self.middleware = middleware_1.globalMiddlewareFactory(globalMiddleware, self); - self.scriptName = function (scriptName) { - self.customScriptName = true; - self.$0 = scriptName; - return self; - }; - // ignore the node bin, specify this in your - // bin file with #!/usr/bin/env node - let default$0; - if (/\b(node|iojs|electron)(\.exe)?$/.test(process.argv[0])) { - default$0 = process.argv.slice(1, 2); - } - else { - default$0 = process.argv.slice(0, 1); - } - self.$0 = default$0 - .map(x => { - const b = rebase(cwd, x); - return x.match(/^(\/|([a-zA-Z]:)?\\)/) && b.length < x.length ? b : x; - }) - .join(' ').trim(); - if (process.env._ !== undefined && processArgv.getProcessArgvBin() === process.env._) { - self.$0 = process.env._.replace(`${path.dirname(process.execPath)}/`, ''); - } - // use context object to keep track of resets, subcommand execution, etc - // submodules should modify and check the state of context as necessary - const context = { resets: -1, commands: [], fullCommands: [], files: [] }; - self.getContext = () => context; - // puts yargs back into an initial state. any keys - // that have been set to "global" will not be reset - // by this action. - let options; - self.resetOptions = self.reset = function resetOptions(aliases = {}) { - context.resets++; - options = options || {}; - // put yargs back into an initial state, this - // logic is used to build a nested command - // hierarchy. - const tmpOptions = {}; - tmpOptions.local = options.local ? options.local : []; - tmpOptions.configObjects = options.configObjects ? options.configObjects : []; - // if a key has been explicitly set as local, - // we should reset it before passing options to command. - const localLookup = {}; - tmpOptions.local.forEach((l) => { - localLookup[l] = true; - (aliases[l] || []).forEach((a) => { - localLookup[a] = true; - }); - }); - // add all groups not set to local to preserved groups - Object.assign(preservedGroups, Object.keys(groups).reduce((acc, groupName) => { - const keys = groups[groupName].filter(key => !(key in localLookup)); - if (keys.length > 0) { - acc[groupName] = keys; - } - return acc; - }, {})); - // groups can now be reset - groups = {}; - const arrayOptions = [ - 'array', 'boolean', 'string', 'skipValidation', - 'count', 'normalize', 'number', - 'hiddenOptions' - ]; - const objectOptions = [ - 'narg', 'key', 'alias', 'default', 'defaultDescription', - 'config', 'choices', 'demandedOptions', 'demandedCommands', 'coerce', - 'deprecatedOptions' - ]; - arrayOptions.forEach(k => { - tmpOptions[k] = (options[k] || []).filter(k => !localLookup[k]); - }); - objectOptions.forEach((k) => { - tmpOptions[k] = obj_filter_1.objFilter(options[k], k => !localLookup[k]); - }); - tmpOptions.envPrefix = options.envPrefix; - options = tmpOptions; - // if this is the first time being executed, create - // instances of all our helpers -- otherwise just reset. - usage = usage ? usage.reset(localLookup) : usage_1.usage(self, y18n); - validation = validation ? validation.reset(localLookup) : validation_1.validation(self, usage, y18n); - command = command ? command.reset() : command_1.command(self, usage, validation, globalMiddleware); - if (!completion) - completion = completion_1.completion(self, usage, command); - completionCommand = null; - output = ''; - exitError = null; - hasOutput = false; - self.parsed = false; - return self; - }; - self.resetOptions(); - // temporary hack: allow "freezing" of reset-able state for parse(msg, cb) - const frozens = []; - function freeze() { - frozens.push({ - options, - configObjects: options.configObjects.slice(0), - exitProcess, - groups, - strict, - strictCommands, - completionCommand, - output, - exitError, - hasOutput, - parsed: self.parsed, - parseFn, - parseContext, - handlerFinishCommand - }); - usage.freeze(); - validation.freeze(); - command.freeze(); - } - function unfreeze() { - const frozen = frozens.pop(); - common_types_1.assertNotStrictEqual(frozen, undefined); - let configObjects; - ({ - options, - configObjects, - exitProcess, - groups, - output, - exitError, - hasOutput, - parsed: self.parsed, - strict, - strictCommands, - completionCommand, - parseFn, - parseContext, - handlerFinishCommand - } = frozen); - options.configObjects = configObjects; - usage.unfreeze(); - validation.unfreeze(); - command.unfreeze(); - } - self.boolean = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('boolean', keys); - return self; - }; - self.array = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('array', keys); - return self; - }; - self.number = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('number', keys); - return self; - }; - self.normalize = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('normalize', keys); - return self; - }; - self.count = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('count', keys); - return self; - }; - self.string = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('string', keys); - return self; - }; - self.requiresArg = function (keys) { - // the 2nd paramter [number] in the argsert the assertion is mandatory - // as populateParserHintSingleValueDictionary recursively calls requiresArg - // with Nan as a 2nd parameter, although we ignore it - argsert_1.argsert(' [number]', [keys], arguments.length); - // If someone configures nargs at the same time as requiresArg, - // nargs should take precedent, - // see: https://github.com/yargs/yargs/pull/1572 - // TODO: make this work with aliases, using a check similar to - // checkAllAliases() in yargs-parser. - if (typeof keys === 'string' && options.narg[keys]) { - return self; - } - else { - populateParserHintSingleValueDictionary(self.requiresArg, 'narg', keys, NaN); - } - return self; - }; - self.skipValidation = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('skipValidation', keys); - return self; - }; - function populateParserHintArray(type, keys) { - keys = [].concat(keys); - keys.forEach((key) => { - key = sanitizeKey(key); - options[type].push(key); - }); - } - self.nargs = function (key, value) { - argsert_1.argsert(' [number]', [key, value], arguments.length); - populateParserHintSingleValueDictionary(self.nargs, 'narg', key, value); - return self; - }; - self.choices = function (key, value) { - argsert_1.argsert(' [string|array]', [key, value], arguments.length); - populateParserHintArrayDictionary(self.choices, 'choices', key, value); - return self; - }; - self.alias = function (key, value) { - argsert_1.argsert(' [string|array]', [key, value], arguments.length); - populateParserHintArrayDictionary(self.alias, 'alias', key, value); - return self; - }; - // TODO: actually deprecate self.defaults. - self.default = self.defaults = function (key, value, defaultDescription) { - argsert_1.argsert(' [*] [string]', [key, value, defaultDescription], arguments.length); - if (defaultDescription) { - common_types_1.assertSingleKey(key); - options.defaultDescription[key] = defaultDescription; - } - if (typeof value === 'function') { - common_types_1.assertSingleKey(key); - if (!options.defaultDescription[key]) - options.defaultDescription[key] = usage.functionDescription(value); - value = value.call(); - } - populateParserHintSingleValueDictionary(self.default, 'default', key, value); - return self; - }; - self.describe = function (key, desc) { - argsert_1.argsert(' [string]', [key, desc], arguments.length); - setKey(key, true); - usage.describe(key, desc); - return self; - }; - function setKey(key, set) { - populateParserHintSingleValueDictionary(setKey, 'key', key, set); - return self; - } - function demandOption(keys, msg) { - argsert_1.argsert(' [string]', [keys, msg], arguments.length); - populateParserHintSingleValueDictionary(self.demandOption, 'demandedOptions', keys, msg); - return self; - } - self.demandOption = demandOption; - self.coerce = function (keys, value) { - argsert_1.argsert(' [function]', [keys, value], arguments.length); - populateParserHintSingleValueDictionary(self.coerce, 'coerce', keys, value); - return self; - }; - function populateParserHintSingleValueDictionary(builder, type, key, value) { - populateParserHintDictionary(builder, type, key, value, (type, key, value) => { - options[type][key] = value; - }); - } - function populateParserHintArrayDictionary(builder, type, key, value) { - populateParserHintDictionary(builder, type, key, value, (type, key, value) => { - options[type][key] = (options[type][key] || []).concat(value); - }); - } - function populateParserHintDictionary(builder, type, key, value, singleKeyHandler) { - if (Array.isArray(key)) { - // an array of keys with one value ['x', 'y', 'z'], function parse () {} - key.forEach((k) => { - builder(k, value); - }); - } - else if (((key) => typeof key === 'object')(key)) { - // an object of key value pairs: {'x': parse () {}, 'y': parse() {}} - for (const k of common_types_1.objectKeys(key)) { - builder(k, key[k]); - } - } - else { - singleKeyHandler(type, sanitizeKey(key), value); - } - } - function sanitizeKey(key) { - if (key === '__proto__') - return '___proto___'; - return key; - } - function deleteFromParserHintObject(optionKey) { - // delete from all parsing hints: - // boolean, array, key, alias, etc. - common_types_1.objectKeys(options).forEach((hintKey) => { - // configObjects is not a parsing hint array - if (((key) => key === 'configObjects')(hintKey)) - return; - const hint = options[hintKey]; - if (Array.isArray(hint)) { - if (~hint.indexOf(optionKey)) - hint.splice(hint.indexOf(optionKey), 1); - } - else if (typeof hint === 'object') { - delete hint[optionKey]; - } - }); - // now delete the description from usage.js. - delete usage.getDescriptions()[optionKey]; - } - self.config = function config(key = 'config', msg, parseFn) { - argsert_1.argsert('[object|string] [string|function] [function]', [key, msg, parseFn], arguments.length); - // allow a config object to be provided directly. - if ((typeof key === 'object') && !Array.isArray(key)) { - key = apply_extends_1.applyExtends(key, cwd, self.getParserConfiguration()['deep-merge-config']); - options.configObjects = (options.configObjects || []).concat(key); - return self; - } - // allow for a custom parsing function. - if (typeof msg === 'function') { - parseFn = msg; - msg = undefined; - } - self.describe(key, msg || usage.deferY18nLookup('Path to JSON config file')); - (Array.isArray(key) ? key : [key]).forEach((k) => { - options.config[k] = parseFn || true; - }); - return self; - }; - self.example = function (cmd, description) { - argsert_1.argsert(' [string]', [cmd, description], arguments.length); - if (Array.isArray(cmd)) { - cmd.forEach((exampleParams) => self.example(...exampleParams)); - } - else { - usage.example(cmd, description); - } - return self; - }; - self.command = function (cmd, description, builder, handler, middlewares, deprecated) { - argsert_1.argsert(' [string|boolean] [function|object] [function] [array] [boolean|string]', [cmd, description, builder, handler, middlewares, deprecated], arguments.length); - command.addHandler(cmd, description, builder, handler, middlewares, deprecated); - return self; - }; - self.commandDir = function (dir, opts) { - argsert_1.argsert(' [object]', [dir, opts], arguments.length); - const req = parentRequire || require; - command.addDirectory(dir, self.getContext(), req, require('get-caller-file')(), opts); - return self; - }; - // TODO: deprecate self.demand in favor of - // .demandCommand() .demandOption(). - self.demand = self.required = self.require = function demand(keys, max, msg) { - // you can optionally provide a 'max' key, - // which will raise an exception if too many '_' - // options are provided. - if (Array.isArray(max)) { - max.forEach((key) => { - common_types_1.assertNotStrictEqual(msg, true); - demandOption(key, msg); - }); - max = Infinity; - } - else if (typeof max !== 'number') { - msg = max; - max = Infinity; - } - if (typeof keys === 'number') { - common_types_1.assertNotStrictEqual(msg, true); - self.demandCommand(keys, max, msg, msg); - } - else if (Array.isArray(keys)) { - keys.forEach((key) => { - common_types_1.assertNotStrictEqual(msg, true); - demandOption(key, msg); - }); - } - else { - if (typeof msg === 'string') { - demandOption(keys, msg); - } - else if (msg === true || typeof msg === 'undefined') { - demandOption(keys); - } - } - return self; - }; - self.demandCommand = function demandCommand(min = 1, max, minMsg, maxMsg) { - argsert_1.argsert('[number] [number|string] [string|null|undefined] [string|null|undefined]', [min, max, minMsg, maxMsg], arguments.length); - if (typeof max !== 'number') { - minMsg = max; - max = Infinity; - } - self.global('_', false); - options.demandedCommands._ = { - min, - max, - minMsg, - maxMsg - }; - return self; - }; - self.getDemandedOptions = () => { - argsert_1.argsert([], 0); - return options.demandedOptions; - }; - self.getDemandedCommands = () => { - argsert_1.argsert([], 0); - return options.demandedCommands; - }; - self.deprecateOption = function deprecateOption(option, message) { - argsert_1.argsert(' [string|boolean]', [option, message], arguments.length); - options.deprecatedOptions[option] = message; - return self; - }; - self.getDeprecatedOptions = () => { - argsert_1.argsert([], 0); - return options.deprecatedOptions; - }; - self.implies = function (key, value) { - argsert_1.argsert(' [number|string|array]', [key, value], arguments.length); - validation.implies(key, value); - return self; - }; - self.conflicts = function (key1, key2) { - argsert_1.argsert(' [string|array]', [key1, key2], arguments.length); - validation.conflicts(key1, key2); - return self; - }; - self.usage = function (msg, description, builder, handler) { - argsert_1.argsert(' [string|boolean] [function|object] [function]', [msg, description, builder, handler], arguments.length); - if (description !== undefined) { - common_types_1.assertNotStrictEqual(msg, null); - // .usage() can be used as an alias for defining - // a default command. - if ((msg || '').match(/^\$0( |$)/)) { - return self.command(msg, description, builder, handler); - } - else { - throw new yerror_1.YError('.usage() description must start with $0 if being used as alias for .command()'); - } - } - else { - usage.usage(msg); - return self; - } - }; - self.epilogue = self.epilog = function (msg) { - argsert_1.argsert('', [msg], arguments.length); - usage.epilog(msg); - return self; - }; - self.fail = function (f) { - argsert_1.argsert('', [f], arguments.length); - usage.failFn(f); - return self; - }; - self.onFinishCommand = function (f) { - argsert_1.argsert('', [f], arguments.length); - handlerFinishCommand = f; - return self; - }; - self.getHandlerFinishCommand = () => handlerFinishCommand; - self.check = function (f, _global) { - argsert_1.argsert(' [boolean]', [f, _global], arguments.length); - validation.check(f, _global !== false); - return self; - }; - self.global = function global(globals, global) { - argsert_1.argsert(' [boolean]', [globals, global], arguments.length); - globals = [].concat(globals); - if (global !== false) { - options.local = options.local.filter(l => globals.indexOf(l) === -1); - } - else { - globals.forEach((g) => { - if (options.local.indexOf(g) === -1) - options.local.push(g); - }); - } - return self; - }; - self.pkgConf = function pkgConf(key, rootPath) { - argsert_1.argsert(' [string]', [key, rootPath], arguments.length); - let conf = null; - // prefer cwd to require-main-filename in this method - // since we're looking for e.g. "nyc" config in nyc consumer - // rather than "yargs" config in nyc (where nyc is the main filename) - const obj = pkgUp(rootPath || cwd); - // If an object exists in the key, add it to options.configObjects - if (obj[key] && typeof obj[key] === 'object') { - conf = apply_extends_1.applyExtends(obj[key], rootPath || cwd, self.getParserConfiguration()['deep-merge-config']); - options.configObjects = (options.configObjects || []).concat(conf); - } - return self; - }; - const pkgs = {}; - function pkgUp(rootPath) { - const npath = rootPath || '*'; - if (pkgs[npath]) - return pkgs[npath]; - let obj = {}; - try { - let startDir = rootPath || requireMainFilename(parentRequire); - // When called in an environment that lacks require.main.filename, such as a jest test runner, - // startDir is already process.cwd(), and should not be shortened. - // Whether or not it is _actually_ a directory (e.g., extensionless bin) is irrelevant, find-up handles it. - if (!rootPath && path.extname(startDir)) { - startDir = path.dirname(startDir); - } - const pkgJsonPath = findUp.sync('package.json', { - cwd: startDir - }); - common_types_1.assertNotStrictEqual(pkgJsonPath, undefined); - obj = JSON.parse(fs.readFileSync(pkgJsonPath).toString()); - } - catch (noop) { } - pkgs[npath] = obj || {}; - return pkgs[npath]; - } - let parseFn = null; - let parseContext = null; - self.parse = function parse(args, shortCircuit, _parseFn) { - argsert_1.argsert('[string|array] [function|boolean|object] [function]', [args, shortCircuit, _parseFn], arguments.length); - freeze(); - if (typeof args === 'undefined') { - const argv = self._parseArgs(processArgs); - const tmpParsed = self.parsed; - unfreeze(); - // TODO: remove this compatibility hack when we release yargs@15.x: - self.parsed = tmpParsed; - return argv; - } - // a context object can optionally be provided, this allows - // additional information to be passed to a command handler. - if (typeof shortCircuit === 'object') { - parseContext = shortCircuit; - shortCircuit = _parseFn; - } - // by providing a function as a second argument to - // parse you can capture output that would otherwise - // default to printing to stdout/stderr. - if (typeof shortCircuit === 'function') { - parseFn = shortCircuit; - shortCircuit = false; - } - // completion short-circuits the parsing process, - // skipping validation, etc. - if (!shortCircuit) - processArgs = args; - if (parseFn) - exitProcess = false; - const parsed = self._parseArgs(args, !!shortCircuit); - completion.setParsed(self.parsed); - if (parseFn) - parseFn(exitError, parsed, output); - unfreeze(); - return parsed; - }; - self._getParseContext = () => parseContext || {}; - self._hasParseCallback = () => !!parseFn; - self.option = self.options = function option(key, opt) { - argsert_1.argsert(' [object]', [key, opt], arguments.length); - if (typeof key === 'object') { - Object.keys(key).forEach((k) => { - self.options(k, key[k]); - }); - } - else { - if (typeof opt !== 'object') { - opt = {}; - } - options.key[key] = true; // track manually set keys. - if (opt.alias) - self.alias(key, opt.alias); - const deprecate = opt.deprecate || opt.deprecated; - if (deprecate) { - self.deprecateOption(key, deprecate); - } - const demand = opt.demand || opt.required || opt.require; - // A required option can be specified via "demand: true". - if (demand) { - self.demand(key, demand); - } - if (opt.demandOption) { - self.demandOption(key, typeof opt.demandOption === 'string' ? opt.demandOption : undefined); - } - if (opt.conflicts) { - self.conflicts(key, opt.conflicts); - } - if ('default' in opt) { - self.default(key, opt.default); - } - if (opt.implies !== undefined) { - self.implies(key, opt.implies); - } - if (opt.nargs !== undefined) { - self.nargs(key, opt.nargs); - } - if (opt.config) { - self.config(key, opt.configParser); - } - if (opt.normalize) { - self.normalize(key); - } - if (opt.choices) { - self.choices(key, opt.choices); - } - if (opt.coerce) { - self.coerce(key, opt.coerce); - } - if (opt.group) { - self.group(key, opt.group); - } - if (opt.boolean || opt.type === 'boolean') { - self.boolean(key); - if (opt.alias) - self.boolean(opt.alias); - } - if (opt.array || opt.type === 'array') { - self.array(key); - if (opt.alias) - self.array(opt.alias); - } - if (opt.number || opt.type === 'number') { - self.number(key); - if (opt.alias) - self.number(opt.alias); - } - if (opt.string || opt.type === 'string') { - self.string(key); - if (opt.alias) - self.string(opt.alias); - } - if (opt.count || opt.type === 'count') { - self.count(key); - } - if (typeof opt.global === 'boolean') { - self.global(key, opt.global); - } - if (opt.defaultDescription) { - options.defaultDescription[key] = opt.defaultDescription; - } - if (opt.skipValidation) { - self.skipValidation(key); - } - const desc = opt.describe || opt.description || opt.desc; - self.describe(key, desc); - if (opt.hidden) { - self.hide(key); - } - if (opt.requiresArg) { - self.requiresArg(key); - } - } - return self; - }; - self.getOptions = () => options; - self.positional = function (key, opts) { - argsert_1.argsert(' ', [key, opts], arguments.length); - if (context.resets === 0) { - throw new yerror_1.YError(".positional() can only be called in a command's builder function"); - } - // .positional() only supports a subset of the configuration - // options available to .option(). - const supportedOpts = ['default', 'defaultDescription', 'implies', 'normalize', - 'choices', 'conflicts', 'coerce', 'type', 'describe', - 'desc', 'description', 'alias']; - opts = obj_filter_1.objFilter(opts, (k, v) => { - let accept = supportedOpts.indexOf(k) !== -1; - // type can be one of string|number|boolean. - if (k === 'type' && ['string', 'number', 'boolean'].indexOf(v) === -1) - accept = false; - return accept; - }); - // copy over any settings that can be inferred from the command string. - const fullCommand = context.fullCommands[context.fullCommands.length - 1]; - const parseOptions = fullCommand ? command.cmdToParseOptions(fullCommand) : { - array: [], - alias: {}, - default: {}, - demand: {} - }; - common_types_1.objectKeys(parseOptions).forEach((pk) => { - const parseOption = parseOptions[pk]; - if (Array.isArray(parseOption)) { - if (parseOption.indexOf(key) !== -1) - opts[pk] = true; - } - else { - if (parseOption[key] && !(pk in opts)) - opts[pk] = parseOption[key]; - } - }); - self.group(key, usage.getPositionalGroupName()); - return self.option(key, opts); - }; - self.group = function group(opts, groupName) { - argsert_1.argsert(' ', [opts, groupName], arguments.length); - const existing = preservedGroups[groupName] || groups[groupName]; - if (preservedGroups[groupName]) { - // we now only need to track this group name in groups. - delete preservedGroups[groupName]; - } - const seen = {}; - groups[groupName] = (existing || []).concat(opts).filter((key) => { - if (seen[key]) - return false; - return (seen[key] = true); - }); - return self; - }; - // combine explicit and preserved groups. explicit groups should be first - self.getGroups = () => Object.assign({}, groups, preservedGroups); - // as long as options.envPrefix is not undefined, - // parser will apply env vars matching prefix to argv - self.env = function (prefix) { - argsert_1.argsert('[string|boolean]', [prefix], arguments.length); - if (prefix === false) - delete options.envPrefix; - else - options.envPrefix = prefix || ''; - return self; - }; - self.wrap = function (cols) { - argsert_1.argsert('', [cols], arguments.length); - usage.wrap(cols); - return self; - }; - let strict = false; - self.strict = function (enabled) { - argsert_1.argsert('[boolean]', [enabled], arguments.length); - strict = enabled !== false; - return self; - }; - self.getStrict = () => strict; - let strictCommands = false; - self.strictCommands = function (enabled) { - argsert_1.argsert('[boolean]', [enabled], arguments.length); - strictCommands = enabled !== false; - return self; - }; - self.getStrictCommands = () => strictCommands; - let parserConfig = {}; - self.parserConfiguration = function parserConfiguration(config) { - argsert_1.argsert('', [config], arguments.length); - parserConfig = config; - return self; - }; - self.getParserConfiguration = () => parserConfig; - self.showHelp = function (level) { - argsert_1.argsert('[string|function]', [level], arguments.length); - if (!self.parsed) - self._parseArgs(processArgs); // run parser, if it has not already been executed. - if (command.hasDefaultCommand()) { - context.resets++; // override the restriction on top-level positoinals. - command.runDefaultBuilderOn(self); - } - usage.showHelp(level); - return self; - }; - let versionOpt = null; - self.version = function version(opt, msg, ver) { - const defaultVersionOpt = 'version'; - argsert_1.argsert('[boolean|string] [string] [string]', [opt, msg, ver], arguments.length); - // nuke the key previously configured - // to return version #. - if (versionOpt) { - deleteFromParserHintObject(versionOpt); - usage.version(undefined); - versionOpt = null; - } - if (arguments.length === 0) { - ver = guessVersion(); - opt = defaultVersionOpt; - } - else if (arguments.length === 1) { - if (opt === false) { // disable default 'version' key. - return self; - } - ver = opt; - opt = defaultVersionOpt; - } - else if (arguments.length === 2) { - ver = msg; - msg = undefined; - } - versionOpt = typeof opt === 'string' ? opt : defaultVersionOpt; - msg = msg || usage.deferY18nLookup('Show version number'); - usage.version(ver || undefined); - self.boolean(versionOpt); - self.describe(versionOpt, msg); - return self; - }; - function guessVersion() { - const obj = pkgUp(); - return obj.version || 'unknown'; - } - let helpOpt = null; - self.addHelpOpt = self.help = function addHelpOpt(opt, msg) { - const defaultHelpOpt = 'help'; - argsert_1.argsert('[string|boolean] [string]', [opt, msg], arguments.length); - // nuke the key previously configured - // to return help. - if (helpOpt) { - deleteFromParserHintObject(helpOpt); - helpOpt = null; - } - if (arguments.length === 1) { - if (opt === false) - return self; - } - // use arguments, fallback to defaults for opt and msg - helpOpt = typeof opt === 'string' ? opt : defaultHelpOpt; - self.boolean(helpOpt); - self.describe(helpOpt, msg || usage.deferY18nLookup('Show help')); - return self; - }; - const defaultShowHiddenOpt = 'show-hidden'; - options.showHiddenOpt = defaultShowHiddenOpt; - self.addShowHiddenOpt = self.showHidden = function addShowHiddenOpt(opt, msg) { - argsert_1.argsert('[string|boolean] [string]', [opt, msg], arguments.length); - if (arguments.length === 1) { - if (opt === false) - return self; - } - const showHiddenOpt = typeof opt === 'string' ? opt : defaultShowHiddenOpt; - self.boolean(showHiddenOpt); - self.describe(showHiddenOpt, msg || usage.deferY18nLookup('Show hidden options')); - options.showHiddenOpt = showHiddenOpt; - return self; - }; - self.hide = function hide(key) { - argsert_1.argsert('', [key], arguments.length); - options.hiddenOptions.push(key); - return self; - }; - self.showHelpOnFail = function showHelpOnFail(enabled, message) { - argsert_1.argsert('[boolean|string] [string]', [enabled, message], arguments.length); - usage.showHelpOnFail(enabled, message); - return self; - }; - var exitProcess = true; - self.exitProcess = function (enabled = true) { - argsert_1.argsert('[boolean]', [enabled], arguments.length); - exitProcess = enabled; - return self; - }; - self.getExitProcess = () => exitProcess; - var completionCommand = null; - self.completion = function (cmd, desc, fn) { - argsert_1.argsert('[string] [string|boolean|function] [function]', [cmd, desc, fn], arguments.length); - // a function to execute when generating - // completions can be provided as the second - // or third argument to completion. - if (typeof desc === 'function') { - fn = desc; - desc = undefined; - } - // register the completion command. - completionCommand = cmd || completionCommand || 'completion'; - if (!desc && desc !== false) { - desc = 'generate completion script'; - } - self.command(completionCommand, desc); - // a function can be provided - if (fn) - completion.registerFunction(fn); - return self; - }; - self.showCompletionScript = function ($0, cmd) { - argsert_1.argsert('[string] [string]', [$0, cmd], arguments.length); - $0 = $0 || self.$0; - _logger.log(completion.generateCompletionScript($0, cmd || completionCommand || 'completion')); - return self; - }; - self.getCompletion = function (args, done) { - argsert_1.argsert(' ', [args, done], arguments.length); - completion.getCompletion(args, done); - }; - self.locale = function (locale) { - argsert_1.argsert('[string]', [locale], arguments.length); - if (!locale) { - guessLocale(); - return y18n.getLocale(); - } - detectLocale = false; - y18n.setLocale(locale); - return self; - }; - self.updateStrings = self.updateLocale = function (obj) { - argsert_1.argsert('', [obj], arguments.length); - detectLocale = false; - y18n.updateLocale(obj); - return self; - }; - let detectLocale = true; - self.detectLocale = function (detect) { - argsert_1.argsert('', [detect], arguments.length); - detectLocale = detect; - return self; - }; - self.getDetectLocale = () => detectLocale; - var hasOutput = false; - var exitError = null; - // maybe exit, always capture - // context about why we wanted to exit. - self.exit = (code, err) => { - hasOutput = true; - exitError = err; - if (exitProcess) - process.exit(code); - }; - // we use a custom logger that buffers output, - // so that we can print to non-CLIs, e.g., chat-bots. - const _logger = { - log(...args) { - if (!self._hasParseCallback()) - console.log(...args); - hasOutput = true; - if (output.length) - output += '\n'; - output += args.join(' '); - }, - error(...args) { - if (!self._hasParseCallback()) - console.error(...args); - hasOutput = true; - if (output.length) - output += '\n'; - output += args.join(' '); - } - }; - self._getLoggerInstance = () => _logger; - // has yargs output an error our help - // message in the current execution context. - self._hasOutput = () => hasOutput; - self._setHasOutput = () => { - hasOutput = true; - }; - let recommendCommands; - self.recommendCommands = function (recommend = true) { - argsert_1.argsert('[boolean]', [recommend], arguments.length); - recommendCommands = recommend; - return self; - }; - self.getUsageInstance = () => usage; - self.getValidationInstance = () => validation; - self.getCommandInstance = () => command; - self.terminalWidth = () => { - argsert_1.argsert([], 0); - return typeof process.stdout.columns !== 'undefined' ? process.stdout.columns : null; - }; - Object.defineProperty(self, 'argv', { - get: () => self._parseArgs(processArgs), - enumerable: true - }); - self._parseArgs = function parseArgs(args, shortCircuit, _calledFromCommand, commandIndex) { - let skipValidation = !!_calledFromCommand; - args = args || processArgs; - options.__ = y18n.__; - options.configuration = self.getParserConfiguration(); - const populateDoubleDash = !!options.configuration['populate--']; - const config = Object.assign({}, options.configuration, { - 'populate--': true - }); - const parsed = Parser.detailed(args, Object.assign({}, options, { - configuration: config - })); - let argv = parsed.argv; - if (parseContext) - argv = Object.assign({}, argv, parseContext); - const aliases = parsed.aliases; - argv.$0 = self.$0; - self.parsed = parsed; - try { - guessLocale(); // guess locale lazily, so that it can be turned off in chain. - // while building up the argv object, there - // are two passes through the parser. If completion - // is being performed short-circuit on the first pass. - if (shortCircuit) { - return (populateDoubleDash || _calledFromCommand) ? argv : self._copyDoubleDash(argv); - } - // if there's a handler associated with a - // command defer processing to it. - if (helpOpt) { - // consider any multi-char helpOpt alias as a valid help command - // unless all helpOpt aliases are single-char - // note that parsed.aliases is a normalized bidirectional map :) - const helpCmds = [helpOpt] - .concat(aliases[helpOpt] || []) - .filter(k => k.length > 1); - // check if help should trigger and strip it from _. - if (~helpCmds.indexOf(argv._[argv._.length - 1])) { - argv._.pop(); - argv[helpOpt] = true; - } - } - const handlerKeys = command.getCommands(); - const requestCompletions = completion.completionKey in argv; - const skipRecommendation = argv[helpOpt] || requestCompletions; - const skipDefaultCommand = skipRecommendation && (handlerKeys.length > 1 || handlerKeys[0] !== '$0'); - if (argv._.length) { - if (handlerKeys.length) { - let firstUnknownCommand; - for (let i = (commandIndex || 0), cmd; argv._[i] !== undefined; i++) { - cmd = String(argv._[i]); - if (~handlerKeys.indexOf(cmd) && cmd !== completionCommand) { - // commands are executed using a recursive algorithm that executes - // the deepest command first; we keep track of the position in the - // argv._ array that is currently being executed. - const innerArgv = command.runCommand(cmd, self, parsed, i + 1); - return populateDoubleDash ? innerArgv : self._copyDoubleDash(innerArgv); - } - else if (!firstUnknownCommand && cmd !== completionCommand) { - firstUnknownCommand = cmd; - break; - } - } - // run the default command, if defined - if (command.hasDefaultCommand() && !skipDefaultCommand) { - const innerArgv = command.runCommand(null, self, parsed); - return populateDoubleDash ? innerArgv : self._copyDoubleDash(innerArgv); - } - // recommend a command if recommendCommands() has - // been enabled, and no commands were found to execute - if (recommendCommands && firstUnknownCommand && !skipRecommendation) { - validation.recommendCommands(firstUnknownCommand, handlerKeys); - } - } - // generate a completion script for adding to ~/.bashrc. - if (completionCommand && ~argv._.indexOf(completionCommand) && !requestCompletions) { - if (exitProcess) - setBlocking(true); - self.showCompletionScript(); - self.exit(0); - } - } - else if (command.hasDefaultCommand() && !skipDefaultCommand) { - const innerArgv = command.runCommand(null, self, parsed); - return populateDoubleDash ? innerArgv : self._copyDoubleDash(innerArgv); - } - // we must run completions first, a user might - // want to complete the --help or --version option. - if (requestCompletions) { - if (exitProcess) - setBlocking(true); - // we allow for asynchronous completions, - // e.g., loading in a list of commands from an API. - args = [].concat(args); - const completionArgs = args.slice(args.indexOf(`--${completion.completionKey}`) + 1); - completion.getCompletion(completionArgs, (completions) => { - ; - (completions || []).forEach((completion) => { - _logger.log(completion); - }); - self.exit(0); - }); - return (populateDoubleDash || _calledFromCommand) ? argv : self._copyDoubleDash(argv); - } - // Handle 'help' and 'version' options - // if we haven't already output help! - if (!hasOutput) { - Object.keys(argv).forEach((key) => { - if (key === helpOpt && argv[key]) { - if (exitProcess) - setBlocking(true); - skipValidation = true; - self.showHelp('log'); - self.exit(0); - } - else if (key === versionOpt && argv[key]) { - if (exitProcess) - setBlocking(true); - skipValidation = true; - usage.showVersion(); - self.exit(0); - } - }); - } - // Check if any of the options to skip validation were provided - if (!skipValidation && options.skipValidation.length > 0) { - skipValidation = Object.keys(argv).some(key => options.skipValidation.indexOf(key) >= 0 && argv[key] === true); - } - // If the help or version options where used and exitProcess is false, - // or if explicitly skipped, we won't run validations. - if (!skipValidation) { - if (parsed.error) - throw new yerror_1.YError(parsed.error.message); - // if we're executed via bash completion, don't - // bother with validation. - if (!requestCompletions) { - self._runValidation(argv, aliases, {}, parsed.error); - } - } - } - catch (err) { - if (err instanceof yerror_1.YError) - usage.fail(err.message, err); - else - throw err; - } - return (populateDoubleDash || _calledFromCommand) ? argv : self._copyDoubleDash(argv); - }; - // to simplify the parsing of positionals in commands, - // we temporarily populate '--' rather than _, with arguments - // after the '--' directive. After the parse, we copy these back. - self._copyDoubleDash = function (argv) { - if (is_promise_1.isPromise(argv) || !argv._ || !argv['--']) - return argv; - argv._.push.apply(argv._, argv['--']); - // TODO(bcoe): refactor command parsing such that this delete is not - // necessary: https://github.com/yargs/yargs/issues/1482 - try { - delete argv['--']; - } - catch (_err) { } - return argv; - }; - self._runValidation = function runValidation(argv, aliases, positionalMap, parseErrors, isDefaultCommand = false) { - if (parseErrors) - throw new yerror_1.YError(parseErrors.message); - validation.nonOptionCount(argv); - validation.requiredArguments(argv); - let failedStrictCommands = false; - if (strictCommands) { - failedStrictCommands = validation.unknownCommands(argv); - } - if (strict && !failedStrictCommands) { - validation.unknownArguments(argv, aliases, positionalMap, isDefaultCommand); - } - validation.customChecks(argv, aliases); - validation.limitedChoices(argv); - validation.implications(argv); - validation.conflicting(argv); - }; - function guessLocale() { - if (!detectLocale) - return; - const locale = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || process.env.LANGUAGE || 'en_US'; - self.locale(locale.replace(/[.:].*/, '')); - } - // an app should almost always have --version and --help, - // if you *really* want to disable this use .help(false)/.version(false). - self.help(); - self.version(); - return self; -} -exports.Yargs = Yargs; -// rebase an absolute path to a relative one with respect to a base directory -// exported for tests -function rebase(base, dir) { - return path.relative(base, dir); -} -exports.rebase = rebase; -function isYargsInstance(y) { - return !!y && (typeof y._parseArgs === 'function'); -} -exports.isYargsInstance = isYargsInstance; diff --git a/node_modules/yargs/build/lib/yerror.d.ts b/node_modules/yargs/build/lib/yerror.d.ts deleted file mode 100644 index 024d0c7..0000000 --- a/node_modules/yargs/build/lib/yerror.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare class YError extends Error { - name: string; - constructor(msg?: string | null); -} diff --git a/node_modules/yargs/build/lib/yerror.js b/node_modules/yargs/build/lib/yerror.js deleted file mode 100644 index 0fa146e..0000000 --- a/node_modules/yargs/build/lib/yerror.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.YError = void 0; -class YError extends Error { - constructor(msg) { - super(msg || 'yargs error'); - this.name = 'YError'; - Error.captureStackTrace(this, YError); - } -} -exports.YError = YError; diff --git a/node_modules/yargs/index.js b/node_modules/yargs/index.js deleted file mode 100644 index 7dc62de..0000000 --- a/node_modules/yargs/index.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict' -// classic singleton yargs API, to use yargs -// without running as a singleton do: -// require('yargs/yargs')(process.argv.slice(2)) -const yargs = require('./yargs') -const processArgv = require('./build/lib/process-argv') - -Argv(processArgv.getProcessArgvWithoutBin()) - -module.exports = Argv - -function Argv (processArgs, cwd) { - const argv = yargs(processArgs, cwd, require) - singletonify(argv) - return argv -} - -/* Hack an instance of Argv with process.argv into Argv - so people can do - require('yargs')(['--beeble=1','-z','zizzle']).argv - to parse a list of args and - require('yargs').argv - to get a parsed version of process.argv. -*/ -function singletonify (inst) { - Object.keys(inst).forEach((key) => { - if (key === 'argv') { - Argv.__defineGetter__(key, inst.__lookupGetter__(key)) - } else if (typeof inst[key] === 'function') { - Argv[key] = inst[key].bind(inst) - } else { - Argv.__defineGetter__('$0', () => { - return inst.$0 - }) - Argv.__defineGetter__('parsed', () => { - return inst.parsed - }) - } - }) -} diff --git a/node_modules/yargs/locales/be.json b/node_modules/yargs/locales/be.json deleted file mode 100644 index e28fa30..0000000 --- a/node_modules/yargs/locales/be.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Каманды:", - "Options:": "Опцыі:", - "Examples:": "Прыклады:", - "boolean": "булевы тып", - "count": "падлік", - "string": "радковы тып", - "number": "лік", - "array": "масіў", - "required": "неабходна", - "default": "па змаўчанні", - "default:": "па змаўчанні:", - "choices:": "магчымасці:", - "aliases:": "аліасы:", - "generated-value": "згенераванае значэнне", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s", - "other": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s", - "other": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s" - }, - "Missing argument value: %s": { - "one": "Не хапае значэння аргументу: %s", - "other": "Не хапае значэнняў аргументаў: %s" - }, - "Missing required argument: %s": { - "one": "Не хапае неабходнага аргументу: %s", - "other": "Не хапае неабходных аргументаў: %s" - }, - "Unknown argument: %s": { - "one": "Невядомы аргумент: %s", - "other": "Невядомыя аргументы: %s" - }, - "Invalid values:": "Несапраўдныя значэння:", - "Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Дадзенае значэнне: %s, Магчымасці: %s", - "Argument check failed: %s": "Праверка аргументаў не ўдалася: %s", - "Implications failed:": "Дадзены аргумент патрабуе наступны дадатковы аргумент:", - "Not enough arguments following: %s": "Недастаткова наступных аргументаў: %s", - "Invalid JSON config file: %s": "Несапраўдны файл канфігурацыі JSON: %s", - "Path to JSON config file": "Шлях да файла канфігурацыі JSON", - "Show help": "Паказаць дапамогу", - "Show version number": "Паказаць нумар версіі", - "Did you mean %s?": "Вы мелі на ўвазе %s?" -} diff --git a/node_modules/yargs/locales/de.json b/node_modules/yargs/locales/de.json deleted file mode 100644 index dc73ec3..0000000 --- a/node_modules/yargs/locales/de.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Kommandos:", - "Options:": "Optionen:", - "Examples:": "Beispiele:", - "boolean": "boolean", - "count": "Zähler", - "string": "string", - "number": "Zahl", - "array": "array", - "required": "erforderlich", - "default": "Standard", - "default:": "Standard:", - "choices:": "Möglichkeiten:", - "aliases:": "Aliase:", - "generated-value": "Generierter-Wert", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt", - "other": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt", - "other": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt" - }, - "Missing argument value: %s": { - "one": "Fehlender Argumentwert: %s", - "other": "Fehlende Argumentwerte: %s" - }, - "Missing required argument: %s": { - "one": "Fehlendes Argument: %s", - "other": "Fehlende Argumente: %s" - }, - "Unknown argument: %s": { - "one": "Unbekanntes Argument: %s", - "other": "Unbekannte Argumente: %s" - }, - "Invalid values:": "Unzulässige Werte:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeben: %s, Möglichkeiten: %s", - "Argument check failed: %s": "Argumente-Check fehlgeschlagen: %s", - "Implications failed:": "Fehlende abhängige Argumente:", - "Not enough arguments following: %s": "Nicht genügend Argumente nach: %s", - "Invalid JSON config file: %s": "Fehlerhafte JSON-Config Datei: %s", - "Path to JSON config file": "Pfad zur JSON-Config Datei", - "Show help": "Hilfe anzeigen", - "Show version number": "Version anzeigen", - "Did you mean %s?": "Meintest du %s?" -} diff --git a/node_modules/yargs/locales/en.json b/node_modules/yargs/locales/en.json deleted file mode 100644 index d794947..0000000 --- a/node_modules/yargs/locales/en.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Commands:": "Commands:", - "Options:": "Options:", - "Examples:": "Examples:", - "boolean": "boolean", - "count": "count", - "string": "string", - "number": "number", - "array": "array", - "required": "required", - "default": "default", - "default:": "default:", - "choices:": "choices:", - "aliases:": "aliases:", - "generated-value": "generated-value", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Not enough non-option arguments: got %s, need at least %s", - "other": "Not enough non-option arguments: got %s, need at least %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Too many non-option arguments: got %s, maximum of %s", - "other": "Too many non-option arguments: got %s, maximum of %s" - }, - "Missing argument value: %s": { - "one": "Missing argument value: %s", - "other": "Missing argument values: %s" - }, - "Missing required argument: %s": { - "one": "Missing required argument: %s", - "other": "Missing required arguments: %s" - }, - "Unknown argument: %s": { - "one": "Unknown argument: %s", - "other": "Unknown arguments: %s" - }, - "Invalid values:": "Invalid values:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s", - "Argument check failed: %s": "Argument check failed: %s", - "Implications failed:": "Missing dependent arguments:", - "Not enough arguments following: %s": "Not enough arguments following: %s", - "Invalid JSON config file: %s": "Invalid JSON config file: %s", - "Path to JSON config file": "Path to JSON config file", - "Show help": "Show help", - "Show version number": "Show version number", - "Did you mean %s?": "Did you mean %s?", - "Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive", - "Positionals:": "Positionals:", - "command": "command", - "deprecated": "deprecated", - "deprecated: %s": "deprecated: %s" -} diff --git a/node_modules/yargs/locales/es.json b/node_modules/yargs/locales/es.json deleted file mode 100644 index d77b461..0000000 --- a/node_modules/yargs/locales/es.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Comandos:", - "Options:": "Opciones:", - "Examples:": "Ejemplos:", - "boolean": "booleano", - "count": "cuenta", - "string": "cadena de caracteres", - "number": "número", - "array": "tabla", - "required": "requerido", - "default": "defecto", - "default:": "defecto:", - "choices:": "selección:", - "aliases:": "alias:", - "generated-value": "valor-generado", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s", - "other": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s", - "other": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s" - }, - "Missing argument value: %s": { - "one": "Falta argumento: %s", - "other": "Faltan argumentos: %s" - }, - "Missing required argument: %s": { - "one": "Falta argumento requerido: %s", - "other": "Faltan argumentos requeridos: %s" - }, - "Unknown argument: %s": { - "one": "Argumento desconocido: %s", - "other": "Argumentos desconocidos: %s" - }, - "Invalid values:": "Valores inválidos:", - "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Seleccionados: %s", - "Argument check failed: %s": "Verificación de argumento ha fallado: %s", - "Implications failed:": "Implicaciones fallidas:", - "Not enough arguments following: %s": "No hay suficientes argumentos después de: %s", - "Invalid JSON config file: %s": "Archivo de configuración JSON inválido: %s", - "Path to JSON config file": "Ruta al archivo de configuración JSON", - "Show help": "Muestra ayuda", - "Show version number": "Muestra número de versión", - "Did you mean %s?": "Quisiste decir %s?" -} diff --git a/node_modules/yargs/locales/fi.json b/node_modules/yargs/locales/fi.json deleted file mode 100644 index 0728c57..0000000 --- a/node_modules/yargs/locales/fi.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "Komennot:", - "Options:": "Valinnat:", - "Examples:": "Esimerkkejä:", - "boolean": "totuusarvo", - "count": "lukumäärä", - "string": "merkkijono", - "number": "numero", - "array": "taulukko", - "required": "pakollinen", - "default": "oletusarvo", - "default:": "oletusarvo:", - "choices:": "vaihtoehdot:", - "aliases:": "aliakset:", - "generated-value": "generoitu-arvo", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s", - "other": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s", - "other": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s" - }, - "Missing argument value: %s": { - "one": "Argumentin arvo puuttuu: %s", - "other": "Argumentin arvot puuttuvat: %s" - }, - "Missing required argument: %s": { - "one": "Pakollinen argumentti puuttuu: %s", - "other": "Pakollisia argumentteja puuttuu: %s" - }, - "Unknown argument: %s": { - "one": "Tuntematon argumenttn: %s", - "other": "Tuntemattomia argumentteja: %s" - }, - "Invalid values:": "Virheelliset arvot:", - "Argument: %s, Given: %s, Choices: %s": "Argumentti: %s, Annettu: %s, Vaihtoehdot: %s", - "Argument check failed: %s": "Argumentin tarkistus epäonnistui: %s", - "Implications failed:": "Riippuvia argumentteja puuttuu:", - "Not enough arguments following: %s": "Argumentin perässä ei ole tarpeeksi argumentteja: %s", - "Invalid JSON config file: %s": "Epävalidi JSON-asetustiedosto: %s", - "Path to JSON config file": "JSON-asetustiedoston polku", - "Show help": "Näytä ohje", - "Show version number": "Näytä versionumero", - "Did you mean %s?": "Tarkoititko %s?", - "Arguments %s and %s are mutually exclusive" : "Argumentit %s ja %s eivät ole yhteensopivat", - "Positionals:": "Sijaintiparametrit:", - "command": "komento" -} diff --git a/node_modules/yargs/locales/fr.json b/node_modules/yargs/locales/fr.json deleted file mode 100644 index edd743f..0000000 --- a/node_modules/yargs/locales/fr.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "Commands:": "Commandes :", - "Options:": "Options :", - "Examples:": "Exemples :", - "boolean": "booléen", - "count": "compteur", - "string": "chaîne de caractères", - "number": "nombre", - "array": "tableau", - "required": "requis", - "default": "défaut", - "default:": "défaut :", - "choices:": "choix :", - "aliases:": "alias :", - "generated-value": "valeur générée", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Pas assez d'arguments (hors options) : reçu %s, besoin d'au moins %s", - "other": "Pas assez d'arguments (hors options) : reçus %s, besoin d'au moins %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Trop d'arguments (hors options) : reçu %s, maximum de %s", - "other": "Trop d'arguments (hors options) : reçus %s, maximum de %s" - }, - "Missing argument value: %s": { - "one": "Argument manquant : %s", - "other": "Arguments manquants : %s" - }, - "Missing required argument: %s": { - "one": "Argument requis manquant : %s", - "other": "Arguments requis manquants : %s" - }, - "Unknown argument: %s": { - "one": "Argument inconnu : %s", - "other": "Arguments inconnus : %s" - }, - "Unknown command: %s": { - "one": "Commande inconnue : %s", - "other": "Commandes inconnues : %s" - }, - "Invalid values:": "Valeurs invalides :", - "Argument: %s, Given: %s, Choices: %s": "Argument : %s, donné : %s, choix : %s", - "Argument check failed: %s": "Echec de la vérification de l'argument : %s", - "Implications failed:": "Arguments dépendants manquants :", - "Not enough arguments following: %s": "Pas assez d'arguments après : %s", - "Invalid JSON config file: %s": "Fichier de configuration JSON invalide : %s", - "Path to JSON config file": "Chemin du fichier de configuration JSON", - "Show help": "Affiche l'aide", - "Show version number": "Affiche le numéro de version", - "Did you mean %s?": "Vouliez-vous dire %s ?", - "Arguments %s and %s are mutually exclusive" : "Les arguments %s et %s sont mutuellement exclusifs", - "Positionals:": "Arguments positionnels :", - "command": "commande" -} diff --git a/node_modules/yargs/locales/hi.json b/node_modules/yargs/locales/hi.json deleted file mode 100644 index a9de77c..0000000 --- a/node_modules/yargs/locales/hi.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "आदेश:", - "Options:": "विकल्प:", - "Examples:": "उदाहरण:", - "boolean": "सत्यता", - "count": "संख्या", - "string": "वर्णों का तार ", - "number": "अंक", - "array": "सरणी", - "required": "आवश्यक", - "default": "डिफॉल्ट", - "default:": "डिफॉल्ट:", - "choices:": "विकल्प:", - "aliases:": "उपनाम:", - "generated-value": "उत्पन्न-मूल्य", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है", - "other": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य", - "other": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य" - }, - "Missing argument value: %s": { - "one": "कुछ तर्को के मूल्य गुम हैं: %s", - "other": "कुछ तर्को के मूल्य गुम हैं: %s" - }, - "Missing required argument: %s": { - "one": "आवश्यक तर्क गुम हैं: %s", - "other": "आवश्यक तर्क गुम हैं: %s" - }, - "Unknown argument: %s": { - "one": "अज्ञात तर्क प्राप्त: %s", - "other": "अज्ञात तर्क प्राप्त: %s" - }, - "Invalid values:": "अमान्य मूल्य:", - "Argument: %s, Given: %s, Choices: %s": "तर्क: %s, प्राप्त: %s, विकल्प: %s", - "Argument check failed: %s": "तर्क जांच विफल: %s", - "Implications failed:": "दिए गए तर्क के लिए अतिरिक्त तर्क की अपेक्षा है:", - "Not enough arguments following: %s": "निम्नलिखित के बाद पर्याप्त तर्क नहीं प्राप्त: %s", - "Invalid JSON config file: %s": "अमान्य JSON config फाइल: %s", - "Path to JSON config file": "JSON config फाइल का पथ", - "Show help": "सहायता दिखाएँ", - "Show version number": "Version संख्या दिखाएँ", - "Did you mean %s?": "क्या आपका मतलब है %s?", - "Arguments %s and %s are mutually exclusive" : "तर्क %s और %s परस्पर अनन्य हैं", - "Positionals:": "स्थानीय:", - "command": "आदेश" -} diff --git a/node_modules/yargs/locales/hu.json b/node_modules/yargs/locales/hu.json deleted file mode 100644 index 21492d0..0000000 --- a/node_modules/yargs/locales/hu.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Parancsok:", - "Options:": "Opciók:", - "Examples:": "Példák:", - "boolean": "boolean", - "count": "számláló", - "string": "szöveg", - "number": "szám", - "array": "tömb", - "required": "kötelező", - "default": "alapértelmezett", - "default:": "alapértelmezett:", - "choices:": "lehetőségek:", - "aliases:": "aliaszok:", - "generated-value": "generált-érték", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell", - "other": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet", - "other": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet" - }, - "Missing argument value: %s": { - "one": "Hiányzó argumentum érték: %s", - "other": "Hiányzó argumentum értékek: %s" - }, - "Missing required argument: %s": { - "one": "Hiányzó kötelező argumentum: %s", - "other": "Hiányzó kötelező argumentumok: %s" - }, - "Unknown argument: %s": { - "one": "Ismeretlen argumentum: %s", - "other": "Ismeretlen argumentumok: %s" - }, - "Invalid values:": "Érvénytelen érték:", - "Argument: %s, Given: %s, Choices: %s": "Argumentum: %s, Megadott: %s, Lehetőségek: %s", - "Argument check failed: %s": "Argumentum ellenőrzés sikertelen: %s", - "Implications failed:": "Implikációk sikertelenek:", - "Not enough arguments following: %s": "Nem elég argumentum követi: %s", - "Invalid JSON config file: %s": "Érvénytelen JSON konfigurációs file: %s", - "Path to JSON config file": "JSON konfigurációs file helye", - "Show help": "Súgo megjelenítése", - "Show version number": "Verziószám megjelenítése", - "Did you mean %s?": "Erre gondoltál %s?" -} diff --git a/node_modules/yargs/locales/id.json b/node_modules/yargs/locales/id.json deleted file mode 100644 index 125867c..0000000 --- a/node_modules/yargs/locales/id.json +++ /dev/null @@ -1,50 +0,0 @@ - -{ - "Commands:": "Perintah:", - "Options:": "Pilihan:", - "Examples:": "Contoh:", - "boolean": "boolean", - "count": "jumlah", - "number": "nomor", - "string": "string", - "array": "larik", - "required": "diperlukan", - "default": "bawaan", - "default:": "bawaan:", - "aliases:": "istilah lain:", - "choices:": "pilihan:", - "generated-value": "nilai-yang-dihasilkan", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Argumen wajib kurang: hanya %s, minimal %s", - "other": "Argumen wajib kurang: hanya %s, minimal %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Terlalu banyak argumen wajib: ada %s, maksimal %s", - "other": "Terlalu banyak argumen wajib: ada %s, maksimal %s" - }, - "Missing argument value: %s": { - "one": "Kurang argumen: %s", - "other": "Kurang argumen: %s" - }, - "Missing required argument: %s": { - "one": "Kurang argumen wajib: %s", - "other": "Kurang argumen wajib: %s" - }, - "Unknown argument: %s": { - "one": "Argumen tak diketahui: %s", - "other": "Argumen tak diketahui: %s" - }, - "Invalid values:": "Nilai-nilai tidak valid:", - "Argument: %s, Given: %s, Choices: %s": "Argumen: %s, Diberikan: %s, Pilihan: %s", - "Argument check failed: %s": "Pemeriksaan argument gagal: %s", - "Implications failed:": "Implikasi gagal:", - "Not enough arguments following: %s": "Kurang argumen untuk: %s", - "Invalid JSON config file: %s": "Berkas konfigurasi JSON tidak valid: %s", - "Path to JSON config file": "Alamat berkas konfigurasi JSON", - "Show help": "Lihat bantuan", - "Show version number": "Lihat nomor versi", - "Did you mean %s?": "Maksud Anda: %s?", - "Arguments %s and %s are mutually exclusive" : "Argumen %s dan %s saling eksklusif", - "Positionals:": "Posisional-posisional:", - "command": "perintah" -} diff --git a/node_modules/yargs/locales/it.json b/node_modules/yargs/locales/it.json deleted file mode 100644 index fde5756..0000000 --- a/node_modules/yargs/locales/it.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Comandi:", - "Options:": "Opzioni:", - "Examples:": "Esempi:", - "boolean": "booleano", - "count": "contatore", - "string": "stringa", - "number": "numero", - "array": "vettore", - "required": "richiesto", - "default": "predefinito", - "default:": "predefinito:", - "choices:": "scelte:", - "aliases:": "alias:", - "generated-value": "valore generato", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s", - "other": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s", - "other": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s" - }, - "Missing argument value: %s": { - "one": "Argomento mancante: %s", - "other": "Argomenti mancanti: %s" - }, - "Missing required argument: %s": { - "one": "Argomento richiesto mancante: %s", - "other": "Argomenti richiesti mancanti: %s" - }, - "Unknown argument: %s": { - "one": "Argomento sconosciuto: %s", - "other": "Argomenti sconosciuti: %s" - }, - "Invalid values:": "Valori non validi:", - "Argument: %s, Given: %s, Choices: %s": "Argomento: %s, Richiesto: %s, Scelte: %s", - "Argument check failed: %s": "Controllo dell'argomento fallito: %s", - "Implications failed:": "Argomenti dipendenti mancanti:", - "Not enough arguments following: %s": "Argomenti insufficienti dopo: %s", - "Invalid JSON config file: %s": "File di configurazione JSON non valido: %s", - "Path to JSON config file": "Percorso del file di configurazione JSON", - "Show help": "Mostra la schermata di aiuto", - "Show version number": "Mostra il numero di versione", - "Did you mean %s?": "Intendi forse %s?" -} diff --git a/node_modules/yargs/locales/ja.json b/node_modules/yargs/locales/ja.json deleted file mode 100644 index 3954ae6..0000000 --- a/node_modules/yargs/locales/ja.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Commands:": "コマンド:", - "Options:": "オプション:", - "Examples:": "例:", - "boolean": "真偽", - "count": "カウント", - "string": "文字列", - "number": "数値", - "array": "配列", - "required": "必須", - "default": "デフォルト", - "default:": "デフォルト:", - "choices:": "選択してください:", - "aliases:": "エイリアス:", - "generated-value": "生成された値", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:", - "other": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:", - "other": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:" - }, - "Missing argument value: %s": { - "one": "引数の値が見つかりません: %s", - "other": "引数の値が見つかりません: %s" - }, - "Missing required argument: %s": { - "one": "必須の引数が見つかりません: %s", - "other": "必須の引数が見つかりません: %s" - }, - "Unknown argument: %s": { - "one": "未知の引数です: %s", - "other": "未知の引数です: %s" - }, - "Invalid values:": "不正な値です:", - "Argument: %s, Given: %s, Choices: %s": "引数は %s です。与えられた値: %s, 選択してください: %s", - "Argument check failed: %s": "引数のチェックに失敗しました: %s", - "Implications failed:": "オプションの組み合わせで不正が生じました:", - "Not enough arguments following: %s": "次の引数が不足しています。: %s", - "Invalid JSON config file: %s": "JSONの設定ファイルが不正です: %s", - "Path to JSON config file": "JSONの設定ファイルまでのpath", - "Show help": "ヘルプを表示", - "Show version number": "バージョンを表示", - "Did you mean %s?": "もしかして %s?", - "Arguments %s and %s are mutually exclusive" : "引数 %s と %s は同時に指定できません", - "Positionals:": "位置:", - "command": "コマンド", - "deprecated": "非推奨", - "deprecated: %s": "非推奨: %s" -} diff --git a/node_modules/yargs/locales/ko.json b/node_modules/yargs/locales/ko.json deleted file mode 100644 index e3187ea..0000000 --- a/node_modules/yargs/locales/ko.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "명령:", - "Options:": "옵션:", - "Examples:": "예시:", - "boolean": "여부", - "count": "개수", - "string": "문자열", - "number": "숫자", - "array": "배열", - "required": "필수", - "default": "기본", - "default:": "기본:", - "choices:": "선택:", - "aliases:": "별칭:", - "generated-value": "생성된 값", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다", - "other": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다", - "other": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다" - }, - "Missing argument value: %s": { - "one": "인자값을 받지 못했습니다: %s", - "other": "인자값들을 받지 못했습니다: %s" - }, - "Missing required argument: %s": { - "one": "필수 인자를 받지 못했습니다: %s", - "other": "필수 인자들을 받지 못했습니다: %s" - }, - "Unknown argument: %s": { - "one": "알 수 없는 인자입니다: %s", - "other": "알 수 없는 인자들입니다: %s" - }, - "Invalid values:": "잘못된 값입니다:", - "Argument: %s, Given: %s, Choices: %s": "인자: %s, 입력받은 값: %s, 선택지: %s", - "Argument check failed: %s": "유효하지 않은 인자입니다: %s", - "Implications failed:": "옵션의 조합이 잘못되었습니다:", - "Not enough arguments following: %s": "인자가 충분하게 주어지지 않았습니다: %s", - "Invalid JSON config file: %s": "유효하지 않은 JSON 설정파일입니다: %s", - "Path to JSON config file": "JSON 설정파일 경로", - "Show help": "도움말을 보여줍니다", - "Show version number": "버전 넘버를 보여줍니다", - "Did you mean %s?": "찾고계신게 %s입니까?", - "Arguments %s and %s are mutually exclusive" : "%s와 %s 인자는 같이 사용될 수 없습니다", - "Positionals:": "위치:", - "command": "명령" -} diff --git a/node_modules/yargs/locales/nb.json b/node_modules/yargs/locales/nb.json deleted file mode 100644 index 6f410ed..0000000 --- a/node_modules/yargs/locales/nb.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "Commands:": "Kommandoer:", - "Options:": "Alternativer:", - "Examples:": "Eksempler:", - "boolean": "boolsk", - "count": "antall", - "string": "streng", - "number": "nummer", - "array": "matrise", - "required": "obligatorisk", - "default": "standard", - "default:": "standard:", - "choices:": "valg:", - "generated-value": "generert-verdi", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s", - "other": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s", - "other": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s" - }, - "Missing argument value: %s": { - "one": "Mangler argument verdi: %s", - "other": "Mangler argument verdier: %s" - }, - "Missing required argument: %s": { - "one": "Mangler obligatorisk argument: %s", - "other": "Mangler obligatoriske argumenter: %s" - }, - "Unknown argument: %s": { - "one": "Ukjent argument: %s", - "other": "Ukjente argumenter: %s" - }, - "Invalid values:": "Ugyldige verdier:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gitt: %s, Valg: %s", - "Argument check failed: %s": "Argumentsjekk mislyktes: %s", - "Implications failed:": "Konsekvensene mislyktes:", - "Not enough arguments following: %s": "Ikke nok følgende argumenter: %s", - "Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s", - "Path to JSON config file": "Bane til JSON konfigurasjonsfil", - "Show help": "Vis hjelp", - "Show version number": "Vis versjonsnummer" -} diff --git a/node_modules/yargs/locales/nl.json b/node_modules/yargs/locales/nl.json deleted file mode 100644 index 9ff95c5..0000000 --- a/node_modules/yargs/locales/nl.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "Commando's:", - "Options:": "Opties:", - "Examples:": "Voorbeelden:", - "boolean": "booleaans", - "count": "aantal", - "string": "string", - "number": "getal", - "array": "lijst", - "required": "verplicht", - "default": "standaard", - "default:": "standaard:", - "choices:": "keuzes:", - "aliases:": "aliassen:", - "generated-value": "gegenereerde waarde", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig", - "other": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s", - "other": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s" - }, - "Missing argument value: %s": { - "one": "Missende argumentwaarde: %s", - "other": "Missende argumentwaarden: %s" - }, - "Missing required argument: %s": { - "one": "Missend verplicht argument: %s", - "other": "Missende verplichte argumenten: %s" - }, - "Unknown argument: %s": { - "one": "Onbekend argument: %s", - "other": "Onbekende argumenten: %s" - }, - "Invalid values:": "Ongeldige waarden:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeven: %s, Keuzes: %s", - "Argument check failed: %s": "Argumentcontrole mislukt: %s", - "Implications failed:": "Ontbrekende afhankelijke argumenten:", - "Not enough arguments following: %s": "Niet genoeg argumenten na: %s", - "Invalid JSON config file: %s": "Ongeldig JSON-config-bestand: %s", - "Path to JSON config file": "Pad naar JSON-config-bestand", - "Show help": "Toon help", - "Show version number": "Toon versienummer", - "Did you mean %s?": "Bedoelde u misschien %s?", - "Arguments %s and %s are mutually exclusive": "Argumenten %s en %s kunnen niet tegelijk gebruikt worden", - "Positionals:": "Positie-afhankelijke argumenten", - "command": "commando" -} diff --git a/node_modules/yargs/locales/nn.json b/node_modules/yargs/locales/nn.json deleted file mode 100644 index 24479ac..0000000 --- a/node_modules/yargs/locales/nn.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "Commands:": "Kommandoar:", - "Options:": "Alternativ:", - "Examples:": "Døme:", - "boolean": "boolsk", - "count": "mengd", - "string": "streng", - "number": "nummer", - "array": "matrise", - "required": "obligatorisk", - "default": "standard", - "default:": "standard:", - "choices:": "val:", - "generated-value": "generert-verdi", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s", - "other": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "For mange ikkje-alternativ argument: fekk %s, maksimum %s", - "other": "For mange ikkje-alternativ argument: fekk %s, maksimum %s" - }, - "Missing argument value: %s": { - "one": "Manglar argumentverdi: %s", - "other": "Manglar argumentverdiar: %s" - }, - "Missing required argument: %s": { - "one": "Manglar obligatorisk argument: %s", - "other": "Manglar obligatoriske argument: %s" - }, - "Unknown argument: %s": { - "one": "Ukjent argument: %s", - "other": "Ukjende argument: %s" - }, - "Invalid values:": "Ugyldige verdiar:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gjeve: %s, Val: %s", - "Argument check failed: %s": "Argumentsjekk mislukkast: %s", - "Implications failed:": "Konsekvensane mislukkast:", - "Not enough arguments following: %s": "Ikkje nok fylgjande argument: %s", - "Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s", - "Path to JSON config file": "Bane til JSON konfigurasjonsfil", - "Show help": "Vis hjelp", - "Show version number": "Vis versjonsnummer" -} diff --git a/node_modules/yargs/locales/pirate.json b/node_modules/yargs/locales/pirate.json deleted file mode 100644 index dcb5cb7..0000000 --- a/node_modules/yargs/locales/pirate.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "Commands:": "Choose yer command:", - "Options:": "Options for me hearties!", - "Examples:": "Ex. marks the spot:", - "required": "requi-yar-ed", - "Missing required argument: %s": { - "one": "Ye be havin' to set the followin' argument land lubber: %s", - "other": "Ye be havin' to set the followin' arguments land lubber: %s" - }, - "Show help": "Parlay this here code of conduct", - "Show version number": "'Tis the version ye be askin' fer", - "Arguments %s and %s are mutually exclusive" : "Yon scurvy dogs %s and %s be as bad as rum and a prudish wench" -} diff --git a/node_modules/yargs/locales/pl.json b/node_modules/yargs/locales/pl.json deleted file mode 100644 index a41d4bd..0000000 --- a/node_modules/yargs/locales/pl.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "Polecenia:", - "Options:": "Opcje:", - "Examples:": "Przykłady:", - "boolean": "boolean", - "count": "ilość", - "string": "ciąg znaków", - "number": "liczba", - "array": "tablica", - "required": "wymagany", - "default": "domyślny", - "default:": "domyślny:", - "choices:": "dostępne:", - "aliases:": "aliasy:", - "generated-value": "wygenerowana-wartość", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s", - "other": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s", - "other": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s" - }, - "Missing argument value: %s": { - "one": "Brak wartości dla argumentu: %s", - "other": "Brak wartości dla argumentów: %s" - }, - "Missing required argument: %s": { - "one": "Brak wymaganego argumentu: %s", - "other": "Brak wymaganych argumentów: %s" - }, - "Unknown argument: %s": { - "one": "Nieznany argument: %s", - "other": "Nieznane argumenty: %s" - }, - "Invalid values:": "Nieprawidłowe wartości:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Otrzymano: %s, Dostępne: %s", - "Argument check failed: %s": "Weryfikacja argumentów nie powiodła się: %s", - "Implications failed:": "Założenia nie zostały spełnione:", - "Not enough arguments following: %s": "Niewystarczająca ilość argumentów następujących po: %s", - "Invalid JSON config file: %s": "Nieprawidłowy plik konfiguracyjny JSON: %s", - "Path to JSON config file": "Ścieżka do pliku konfiguracyjnego JSON", - "Show help": "Pokaż pomoc", - "Show version number": "Pokaż numer wersji", - "Did you mean %s?": "Czy chodziło Ci o %s?", - "Arguments %s and %s are mutually exclusive": "Argumenty %s i %s wzajemnie się wykluczają", - "Positionals:": "Pozycyjne:", - "command": "polecenie" -} diff --git a/node_modules/yargs/locales/pt.json b/node_modules/yargs/locales/pt.json deleted file mode 100644 index 0c8ac99..0000000 --- a/node_modules/yargs/locales/pt.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "Commands:": "Comandos:", - "Options:": "Opções:", - "Examples:": "Exemplos:", - "boolean": "boolean", - "count": "contagem", - "string": "cadeia de caracteres", - "number": "número", - "array": "arranjo", - "required": "requerido", - "default": "padrão", - "default:": "padrão:", - "choices:": "escolhas:", - "generated-value": "valor-gerado", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s", - "other": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Excesso de argumentos não opcionais: recebido %s, máximo de %s", - "other": "Excesso de argumentos não opcionais: recebido %s, máximo de %s" - }, - "Missing argument value: %s": { - "one": "Falta valor de argumento: %s", - "other": "Falta valores de argumento: %s" - }, - "Missing required argument: %s": { - "one": "Falta argumento obrigatório: %s", - "other": "Faltando argumentos obrigatórios: %s" - }, - "Unknown argument: %s": { - "one": "Argumento desconhecido: %s", - "other": "Argumentos desconhecidos: %s" - }, - "Invalid values:": "Valores inválidos:", - "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Escolhas: %s", - "Argument check failed: %s": "Verificação de argumento falhou: %s", - "Implications failed:": "Implicações falharam:", - "Not enough arguments following: %s": "Insuficientes argumentos a seguir: %s", - "Invalid JSON config file: %s": "Arquivo de configuração em JSON esta inválido: %s", - "Path to JSON config file": "Caminho para o arquivo de configuração em JSON", - "Show help": "Mostra ajuda", - "Show version number": "Mostra número de versão", - "Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos" -} diff --git a/node_modules/yargs/locales/pt_BR.json b/node_modules/yargs/locales/pt_BR.json deleted file mode 100644 index eae1ec6..0000000 --- a/node_modules/yargs/locales/pt_BR.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Commands:": "Comandos:", - "Options:": "Opções:", - "Examples:": "Exemplos:", - "boolean": "booleano", - "count": "contagem", - "string": "string", - "number": "número", - "array": "array", - "required": "obrigatório", - "default:": "padrão:", - "choices:": "opções:", - "aliases:": "sinônimos:", - "generated-value": "valor-gerado", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s", - "other": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Excesso de argumentos: recebido %s, máximo de %s", - "other": "Excesso de argumentos: recebido %s, máximo de %s" - }, - "Missing argument value: %s": { - "one": "Falta valor de argumento: %s", - "other": "Falta valores de argumento: %s" - }, - "Missing required argument: %s": { - "one": "Falta argumento obrigatório: %s", - "other": "Faltando argumentos obrigatórios: %s" - }, - "Unknown argument: %s": { - "one": "Argumento desconhecido: %s", - "other": "Argumentos desconhecidos: %s" - }, - "Invalid values:": "Valores inválidos:", - "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Opções: %s", - "Argument check failed: %s": "Verificação de argumento falhou: %s", - "Implications failed:": "Implicações falharam:", - "Not enough arguments following: %s": "Argumentos insuficientes a seguir: %s", - "Invalid JSON config file: %s": "Arquivo JSON de configuração inválido: %s", - "Path to JSON config file": "Caminho para o arquivo JSON de configuração", - "Show help": "Exibe ajuda", - "Show version number": "Exibe a versão", - "Did you mean %s?": "Você quis dizer %s?", - "Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos", - "Positionals:": "Posicionais:", - "command": "comando" -} diff --git a/node_modules/yargs/locales/ru.json b/node_modules/yargs/locales/ru.json deleted file mode 100644 index 5f7f768..0000000 --- a/node_modules/yargs/locales/ru.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Команды:", - "Options:": "Опции:", - "Examples:": "Примеры:", - "boolean": "булевый тип", - "count": "подсчет", - "string": "строковой тип", - "number": "число", - "array": "массив", - "required": "необходимо", - "default": "по умолчанию", - "default:": "по умолчанию:", - "choices:": "возможности:", - "aliases:": "алиасы:", - "generated-value": "генерированное значение", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s", - "other": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s", - "other": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s" - }, - "Missing argument value: %s": { - "one": "Не хватает значения аргумента: %s", - "other": "Не хватает значений аргументов: %s" - }, - "Missing required argument: %s": { - "one": "Не хватает необходимого аргумента: %s", - "other": "Не хватает необходимых аргументов: %s" - }, - "Unknown argument: %s": { - "one": "Неизвестный аргумент: %s", - "other": "Неизвестные аргументы: %s" - }, - "Invalid values:": "Недействительные значения:", - "Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Данное значение: %s, Возможности: %s", - "Argument check failed: %s": "Проверка аргументов не удалась: %s", - "Implications failed:": "Данный аргумент требует следующий дополнительный аргумент:", - "Not enough arguments following: %s": "Недостаточно следующих аргументов: %s", - "Invalid JSON config file: %s": "Недействительный файл конфигурации JSON: %s", - "Path to JSON config file": "Путь к файлу конфигурации JSON", - "Show help": "Показать помощь", - "Show version number": "Показать номер версии", - "Did you mean %s?": "Вы имели в виду %s?" -} diff --git a/node_modules/yargs/locales/th.json b/node_modules/yargs/locales/th.json deleted file mode 100644 index 33b048e..0000000 --- a/node_modules/yargs/locales/th.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "คอมมาน", - "Options:": "ออฟชั่น", - "Examples:": "ตัวอย่าง", - "boolean": "บูลีน", - "count": "นับ", - "string": "สตริง", - "number": "ตัวเลข", - "array": "อาเรย์", - "required": "จำเป็น", - "default": "ค่าเริ่มต้", - "default:": "ค่าเริ่มต้น", - "choices:": "ตัวเลือก", - "aliases:": "เอเลียส", - "generated-value": "ค่าที่ถูกสร้างขึ้น", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า", - "other": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า", - "other": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า" - }, - "Missing argument value: %s": { - "one": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s", - "other": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s" - }, - "Missing required argument: %s": { - "one": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s", - "other": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s" - }, - "Unknown argument: %s": { - "one": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s", - "other": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s" - }, - "Invalid values:": "ค่าไม่ถูกต้อง:", - "Argument: %s, Given: %s, Choices: %s": "อาร์กิวเมนต์: %s, ได้รับ: %s, ตัวเลือก: %s", - "Argument check failed: %s": "ตรวจสอบพบอาร์กิวเมนต์ที่ไม่ถูกต้อง: %s", - "Implications failed:": "Implications ไม่สำเร็จ:", - "Not enough arguments following: %s": "ใส่อาร์กิวเมนต์ไม่ครบ: %s", - "Invalid JSON config file: %s": "ไฟล์คอนฟิค JSON ไม่ถูกต้อง: %s", - "Path to JSON config file": "พาทไฟล์คอนฟิค JSON", - "Show help": "ขอความช่วยเหลือ", - "Show version number": "แสดงตัวเลขเวอร์ชั่น", - "Did you mean %s?": "คุณหมายถึง %s?" -} diff --git a/node_modules/yargs/locales/tr.json b/node_modules/yargs/locales/tr.json deleted file mode 100644 index 0d0d2cc..0000000 --- a/node_modules/yargs/locales/tr.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Commands:": "Komutlar:", - "Options:": "Seçenekler:", - "Examples:": "Örnekler:", - "boolean": "boolean", - "count": "sayı", - "string": "string", - "number": "numara", - "array": "array", - "required": "zorunlu", - "default": "varsayılan", - "default:": "varsayılan:", - "choices:": "seçimler:", - "aliases:": "takma adlar:", - "generated-value": "oluşturulan-değer", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli", - "other": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s", - "other": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s" - }, - "Missing argument value: %s": { - "one": "Eksik argüman değeri: %s", - "other": "Eksik argüman değerleri: %s" - }, - "Missing required argument: %s": { - "one": "Eksik zorunlu argüman: %s", - "other": "Eksik zorunlu argümanlar: %s" - }, - "Unknown argument: %s": { - "one": "Bilinmeyen argüman: %s", - "other": "Bilinmeyen argümanlar: %s" - }, - "Invalid values:": "Geçersiz değerler:", - "Argument: %s, Given: %s, Choices: %s": "Argüman: %s, Verilen: %s, Seçimler: %s", - "Argument check failed: %s": "Argüman kontrolü başarısız oldu: %s", - "Implications failed:": "Sonuçlar başarısız oldu:", - "Not enough arguments following: %s": "%s için yeterli argüman bulunamadı", - "Invalid JSON config file: %s": "Geçersiz JSON yapılandırma dosyası: %s", - "Path to JSON config file": "JSON yapılandırma dosya konumu", - "Show help": "Yardım detaylarını göster", - "Show version number": "Versiyon detaylarını göster", - "Did you mean %s?": "Bunu mu demek istediniz: %s?", - "Positionals:": "Sıralılar:", - "command": "komut" -} diff --git a/node_modules/yargs/locales/zh_CN.json b/node_modules/yargs/locales/zh_CN.json deleted file mode 100644 index 257d26b..0000000 --- a/node_modules/yargs/locales/zh_CN.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Commands:": "命令:", - "Options:": "选项:", - "Examples:": "示例:", - "boolean": "布尔", - "count": "计数", - "string": "字符串", - "number": "数字", - "array": "数组", - "required": "必需", - "default": "默认值", - "default:": "默认值:", - "choices:": "可选值:", - "generated-value": "生成的值", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个", - "other": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个", - "other": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个" - }, - "Missing argument value: %s": { - "one": "没有给此选项指定值:%s", - "other": "没有给这些选项指定值:%s" - }, - "Missing required argument: %s": { - "one": "缺少必须的选项:%s", - "other": "缺少这些必须的选项:%s" - }, - "Unknown argument: %s": { - "one": "无法识别的选项:%s", - "other": "无法识别这些选项:%s" - }, - "Invalid values:": "无效的选项值:", - "Argument: %s, Given: %s, Choices: %s": "选项名称: %s, 传入的值: %s, 可选的值:%s", - "Argument check failed: %s": "选项值验证失败:%s", - "Implications failed:": "缺少依赖的选项:", - "Not enough arguments following: %s": "没有提供足够的值给此选项:%s", - "Invalid JSON config file: %s": "无效的 JSON 配置文件:%s", - "Path to JSON config file": "JSON 配置文件的路径", - "Show help": "显示帮助信息", - "Show version number": "显示版本号", - "Did you mean %s?": "是指 %s?", - "Arguments %s and %s are mutually exclusive" : "选项 %s 和 %s 是互斥的", - "Positionals:": "位置:", - "command": "命令" -} diff --git a/node_modules/yargs/locales/zh_TW.json b/node_modules/yargs/locales/zh_TW.json deleted file mode 100644 index e3c7bcf..0000000 --- a/node_modules/yargs/locales/zh_TW.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "Commands:": "命令:", - "Options:": "選項:", - "Examples:": "例:", - "boolean": "布林", - "count": "次數", - "string": "字串", - "number": "數字", - "array": "陣列", - "required": "必須", - "default": "預設值", - "default:": "預設值:", - "choices:": "可選值:", - "aliases:": "別名:", - "generated-value": "生成的值", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個", - "other": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個", - "other": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個" - }, - "Missing argument value: %s": { - "one": "此引數無指定值:%s", - "other": "這些引數無指定值:%s" - }, - "Missing required argument: %s": { - "one": "缺少必須的引數:%s", - "other": "缺少這些必須的引數:%s" - }, - "Unknown argument: %s": { - "one": "未知的引數:%s", - "other": "未知的這些引數:%s" - }, - "Invalid values:": "無效的選項值:", - "Argument: %s, Given: %s, Choices: %s": "引數名稱: %s, 傳入的值: %s, 可選的值:%s", - "Argument check failed: %s": "引數驗證失敗:%s", - "Implications failed:": "缺少依賴的選項:", - "Not enough arguments following: %s": "沒有提供足夠的值給此引數:%s", - "Invalid JSON config file: %s": "無效的 JSON 設置文件:%s", - "Path to JSON config file": "JSON 設置文件的路徑", - "Show help": "顯示說明", - "Show version number": "顯示版本", - "Did you mean %s?": "是指 %s?", - "Arguments %s and %s are mutually exclusive" : "引數 %s 和 %s 是互斥的" -} diff --git a/node_modules/yargs/node_modules/ansi-regex/index.d.ts b/node_modules/yargs/node_modules/ansi-regex/index.d.ts deleted file mode 100644 index 2dbf6af..0000000 --- a/node_modules/yargs/node_modules/ansi-regex/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare namespace ansiRegex { - interface Options { - /** - Match only the first ANSI escape. - - @default false - */ - onlyFirst: boolean; - } -} - -/** -Regular expression for matching ANSI escape codes. - -@example -``` -import ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` -*/ -declare function ansiRegex(options?: ansiRegex.Options): RegExp; - -export = ansiRegex; diff --git a/node_modules/yargs/node_modules/ansi-regex/index.js b/node_modules/yargs/node_modules/ansi-regex/index.js deleted file mode 100644 index 35054aa..0000000 --- a/node_modules/yargs/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = ({onlyFirst = false} = {}) => { - const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' - ].join('|'); - - return new RegExp(pattern, onlyFirst ? undefined : 'g'); -}; diff --git a/node_modules/yargs/node_modules/ansi-regex/license b/node_modules/yargs/node_modules/ansi-regex/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/yargs/node_modules/ansi-regex/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/yargs/node_modules/ansi-regex/package.json b/node_modules/yargs/node_modules/ansi-regex/package.json deleted file mode 100644 index df59d04..0000000 --- a/node_modules/yargs/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "_from": "ansi-regex@^5.0.0", - "_id": "ansi-regex@5.0.0", - "_inBundle": false, - "_integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "_location": "/yargs/ansi-regex", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ansi-regex@^5.0.0", - "name": "ansi-regex", - "escapedName": "ansi-regex", - "rawSpec": "^5.0.0", - "saveSpec": null, - "fetchSpec": "^5.0.0" - }, - "_requiredBy": [ - "/yargs/strip-ansi" - ], - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "_shasum": "388539f55179bf39339c81af30a654d69f87cb75", - "_spec": "ansi-regex@^5.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs/node_modules/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/ansi-regex/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Regular expression for matching ANSI escape codes", - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.9.0", - "xo": "^0.25.3" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/chalk/ansi-regex#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "license": "MIT", - "name": "ansi-regex", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/ansi-regex.git" - }, - "scripts": { - "test": "xo && ava && tsd", - "view-supported": "node fixtures/view-codes.js" - }, - "version": "5.0.0" -} diff --git a/node_modules/yargs/node_modules/ansi-regex/readme.md b/node_modules/yargs/node_modules/ansi-regex/readme.md deleted file mode 100644 index 3c2b77c..0000000 --- a/node_modules/yargs/node_modules/ansi-regex/readme.md +++ /dev/null @@ -1,78 +0,0 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) - -> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install ansi-regex -``` - - -## Usage - -```js -const ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` - - -## API - -### ansiRegex(options?) - -Returns a regex for matching ANSI escape codes. - -#### options - -Type: `object` - -##### onlyFirst - -Type: `boolean`
-Default: `false` *(Matches any ANSI escape codes in a string)* - -Match only the first ANSI escape. - - -## FAQ - -### Why do you test for codes not in the ECMA 48 standard? - -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. - -On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/yargs/node_modules/is-fullwidth-code-point/index.d.ts b/node_modules/yargs/node_modules/is-fullwidth-code-point/index.d.ts deleted file mode 100644 index 729d202..0000000 --- a/node_modules/yargs/node_modules/is-fullwidth-code-point/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms). - -@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - -@example -``` -import isFullwidthCodePoint from 'is-fullwidth-code-point'; - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` -*/ -export default function isFullwidthCodePoint(codePoint: number): boolean; diff --git a/node_modules/yargs/node_modules/is-fullwidth-code-point/index.js b/node_modules/yargs/node_modules/is-fullwidth-code-point/index.js deleted file mode 100644 index 671f97f..0000000 --- a/node_modules/yargs/node_modules/is-fullwidth-code-point/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable yoda */ -'use strict'; - -const isFullwidthCodePoint = codePoint => { - if (Number.isNaN(codePoint)) { - return false; - } - - // Code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - codePoint >= 0x1100 && ( - codePoint <= 0x115F || // Hangul Jamo - codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET - codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= codePoint && codePoint <= 0x4DBF) || - // CJK Unified Ideographs .. Yi Radicals - (0x4E00 <= codePoint && codePoint <= 0xA4C6) || - // Hangul Jamo Extended-A - (0xA960 <= codePoint && codePoint <= 0xA97C) || - // Hangul Syllables - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - // CJK Compatibility Ideographs - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - // Vertical Forms - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - // CJK Compatibility Forms .. Small Form Variants - (0xFE30 <= codePoint && codePoint <= 0xFE6B) || - // Halfwidth and Fullwidth Forms - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || - // Kana Supplement - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - // Enclosed Ideographic Supplement - (0x1F200 <= codePoint && codePoint <= 0x1F251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= codePoint && codePoint <= 0x3FFFD) - ) - ) { - return true; - } - - return false; -}; - -module.exports = isFullwidthCodePoint; -module.exports.default = isFullwidthCodePoint; diff --git a/node_modules/yargs/node_modules/is-fullwidth-code-point/license b/node_modules/yargs/node_modules/is-fullwidth-code-point/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/yargs/node_modules/is-fullwidth-code-point/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/yargs/node_modules/is-fullwidth-code-point/package.json b/node_modules/yargs/node_modules/is-fullwidth-code-point/package.json deleted file mode 100644 index 5d89ab1..0000000 --- a/node_modules/yargs/node_modules/is-fullwidth-code-point/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "is-fullwidth-code-point@^3.0.0", - "_id": "is-fullwidth-code-point@3.0.0", - "_inBundle": false, - "_integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "_location": "/yargs/is-fullwidth-code-point", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "is-fullwidth-code-point@^3.0.0", - "name": "is-fullwidth-code-point", - "escapedName": "is-fullwidth-code-point", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/yargs/string-width" - ], - "_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "_shasum": "f116f8064fe90b3f7844a38997c0b75051269f1d", - "_spec": "is-fullwidth-code-point@^3.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs/node_modules/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Check if the character represented by a given Unicode code point is fullwidth", - "devDependencies": { - "ava": "^1.3.1", - "tsd-check": "^0.5.0", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme", - "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", - "string", - "codepoint", - "code", - "point", - "is", - "detect", - "check" - ], - "license": "MIT", - "name": "is-fullwidth-code-point", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git" - }, - "scripts": { - "test": "xo && ava && tsd-check" - }, - "version": "3.0.0" -} diff --git a/node_modules/yargs/node_modules/is-fullwidth-code-point/readme.md b/node_modules/yargs/node_modules/is-fullwidth-code-point/readme.md deleted file mode 100644 index 4236bba..0000000 --- a/node_modules/yargs/node_modules/is-fullwidth-code-point/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) - -> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) - - -## Install - -``` -$ npm install is-fullwidth-code-point -``` - - -## Usage - -```js -const isFullwidthCodePoint = require('is-fullwidth-code-point'); - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` - - -## API - -### isFullwidthCodePoint(codePoint) - -#### codePoint - -Type: `number` - -The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/yargs/node_modules/string-width/index.d.ts b/node_modules/yargs/node_modules/string-width/index.d.ts deleted file mode 100644 index 12b5309..0000000 --- a/node_modules/yargs/node_modules/string-width/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare const stringWidth: { - /** - Get the visual width of a string - the number of columns required to display it. - - Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - - @example - ``` - import stringWidth = require('string-width'); - - stringWidth('a'); - //=> 1 - - stringWidth('古'); - //=> 2 - - stringWidth('\u001B[1m古\u001B[22m'); - //=> 2 - ``` - */ - (string: string): number; - - // TODO: remove this in the next major version, refactor the whole definition to: - // declare function stringWidth(string: string): number; - // export = stringWidth; - default: typeof stringWidth; -} - -export = stringWidth; diff --git a/node_modules/yargs/node_modules/string-width/index.js b/node_modules/yargs/node_modules/string-width/index.js deleted file mode 100644 index a348067..0000000 --- a/node_modules/yargs/node_modules/string-width/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; -const stripAnsi = require('strip-ansi'); -const isFullwidthCodePoint = require('is-fullwidth-code-point'); -const emojiRegex = require('emoji-regex'); - -const stringWidth = string => { - string = string.replace(emojiRegex(), ' '); - - if (typeof string !== 'string' || string.length === 0) { - return 0; - } - - string = stripAnsi(string); - - let width = 0; - - for (let i = 0; i < string.length; i++) { - const code = string.codePointAt(i); - - // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { - continue; - } - - // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { - continue; - } - - // Surrogates - if (code > 0xFFFF) { - i++; - } - - width += isFullwidthCodePoint(code) ? 2 : 1; - } - - return width; -}; - -module.exports = stringWidth; -// TODO: remove this in the next major version -module.exports.default = stringWidth; diff --git a/node_modules/yargs/node_modules/string-width/license b/node_modules/yargs/node_modules/string-width/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/yargs/node_modules/string-width/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/yargs/node_modules/string-width/package.json b/node_modules/yargs/node_modules/string-width/package.json deleted file mode 100644 index ecf9c7a..0000000 --- a/node_modules/yargs/node_modules/string-width/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_from": "string-width@^4.2.0", - "_id": "string-width@4.2.0", - "_inBundle": false, - "_integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "_location": "/yargs/string-width", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "string-width@^4.2.0", - "name": "string-width", - "escapedName": "string-width", - "rawSpec": "^4.2.0", - "saveSpec": null, - "fetchSpec": "^4.2.0" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "_shasum": "952182c46cc7b2c313d1596e623992bd163b72b5", - "_spec": "string-width@^4.2.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/string-width/issues" - }, - "bundleDependencies": false, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "deprecated": false, - "description": "Get the visual width of a string - the number of columns required to display it", - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/string-width#readme", - "keywords": [ - "string", - "character", - "unicode", - "width", - "visual", - "column", - "columns", - "fullwidth", - "full-width", - "full", - "ansi", - "escape", - "codes", - "cli", - "command-line", - "terminal", - "console", - "cjk", - "chinese", - "japanese", - "korean", - "fixed-width" - ], - "license": "MIT", - "name": "string-width", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/string-width.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "4.2.0" -} diff --git a/node_modules/yargs/node_modules/string-width/readme.md b/node_modules/yargs/node_modules/string-width/readme.md deleted file mode 100644 index 705f206..0000000 --- a/node_modules/yargs/node_modules/string-width/readme.md +++ /dev/null @@ -1,50 +0,0 @@ -# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width) - -> Get the visual width of a string - the number of columns required to display it - -Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - -Useful to be able to measure the actual width of command-line output. - - -## Install - -``` -$ npm install string-width -``` - - -## Usage - -```js -const stringWidth = require('string-width'); - -stringWidth('a'); -//=> 1 - -stringWidth('古'); -//=> 2 - -stringWidth('\u001B[1m古\u001B[22m'); -//=> 2 -``` - - -## Related - -- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module -- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string -- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/yargs/node_modules/strip-ansi/index.d.ts b/node_modules/yargs/node_modules/strip-ansi/index.d.ts deleted file mode 100644 index 907fccc..0000000 --- a/node_modules/yargs/node_modules/strip-ansi/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. - -@example -``` -import stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` -*/ -declare function stripAnsi(string: string): string; - -export = stripAnsi; diff --git a/node_modules/yargs/node_modules/strip-ansi/index.js b/node_modules/yargs/node_modules/strip-ansi/index.js deleted file mode 100644 index 9a593df..0000000 --- a/node_modules/yargs/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -const ansiRegex = require('ansi-regex'); - -module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/node_modules/yargs/node_modules/strip-ansi/license b/node_modules/yargs/node_modules/strip-ansi/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/yargs/node_modules/strip-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/yargs/node_modules/strip-ansi/package.json b/node_modules/yargs/node_modules/strip-ansi/package.json deleted file mode 100644 index 197fe9b..0000000 --- a/node_modules/yargs/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "_from": "strip-ansi@^6.0.0", - "_id": "strip-ansi@6.0.0", - "_inBundle": false, - "_integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "_location": "/yargs/strip-ansi", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "strip-ansi@^6.0.0", - "name": "strip-ansi", - "escapedName": "strip-ansi", - "rawSpec": "^6.0.0", - "saveSpec": null, - "fetchSpec": "^6.0.0" - }, - "_requiredBy": [ - "/yargs/string-width" - ], - "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "_shasum": "0b1571dd7669ccd4f3e06e14ef1eed26225ae532", - "_spec": "strip-ansi@^6.0.0", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/yargs/node_modules/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/strip-ansi/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "deprecated": false, - "description": "Strip ANSI escape codes from a string", - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.10.0", - "xo": "^0.25.3" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/chalk/strip-ansi#readme", - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "strip-ansi", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/strip-ansi.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "6.0.0" -} diff --git a/node_modules/yargs/node_modules/strip-ansi/readme.md b/node_modules/yargs/node_modules/strip-ansi/readme.md deleted file mode 100644 index 7c4b56d..0000000 --- a/node_modules/yargs/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,46 +0,0 @@ -# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) - -> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string - - -## Install - -``` -$ npm install strip-ansi -``` - - -## Usage - -```js -const stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` - - -## strip-ansi for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - - -## Related - -- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module -- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module -- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - diff --git a/node_modules/yargs/package.json b/node_modules/yargs/package.json deleted file mode 100644 index 214e87e..0000000 --- a/node_modules/yargs/package.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "_from": "yargs@15", - "_id": "yargs@15.4.1", - "_inBundle": false, - "_integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "_location": "/yargs", - "_phantomChildren": { - "emoji-regex": "8.0.0" - }, - "_requested": { - "type": "range", - "registry": true, - "raw": "yargs@15", - "name": "yargs", - "escapedName": "yargs", - "rawSpec": "15", - "saveSpec": null, - "fetchSpec": "15" - }, - "_requiredBy": [ - "/vega-cli", - "/vega-lite" - ], - "_resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "_shasum": "0d87a16de01aee9d8bec2bfbf74f67851730f4f8", - "_spec": "yargs@15", - "_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega-cli", - "bugs": { - "url": "https://github.com/yargs/yargs/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Yargs Contributors", - "url": "https://github.com/yargs/yargs/graphs/contributors" - } - ], - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "deprecated": false, - "description": "yargs the modern, pirate-themed, successor to optimist.", - "devDependencies": { - "@types/chai": "^4.2.11", - "@types/decamelize": "^1.2.0", - "@types/mocha": "^7.0.2", - "@types/node": "^10.0.3", - "@typescript-eslint/eslint-plugin": "^3.0.0", - "@typescript-eslint/parser": "^3.0.0", - "c8": "^7.0.0", - "chai": "^4.2.0", - "chalk": "^4.0.0", - "coveralls": "^3.0.9", - "cpr": "^3.0.1", - "cross-spawn": "^7.0.0", - "es6-promise": "^4.2.5", - "eslint": "^6.8.0", - "eslint-plugin-import": "^2.20.1", - "eslint-plugin-node": "^11.0.0", - "gts": "^2.0.0-alpha.4", - "hashish": "0.0.4", - "mocha": "^7.0.0", - "rimraf": "^3.0.2", - "standardx": "^5.0.0", - "typescript": "^3.7.0", - "which": "^2.0.0", - "yargs-test-extends": "^1.0.1" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "yargs.js", - "build", - "locales", - "LICENSE" - ], - "homepage": "https://yargs.js.org/", - "keywords": [ - "argument", - "args", - "option", - "parser", - "parsing", - "cli", - "command" - ], - "license": "MIT", - "main": "./index.js", - "name": "yargs", - "repository": { - "type": "git", - "url": "git+https://github.com/yargs/yargs.git" - }, - "scripts": { - "check": "standardx && standardx **/*.ts", - "compile": "rimraf build && tsc", - "coverage": "c8 report --check-coverage", - "fix": "standardx --fix && standardx --fix **/*.ts", - "posttest": "npm run check", - "prepare": "npm run compile", - "pretest": "npm run compile -- -p tsconfig.test.json", - "test": "c8 mocha --require ./test/before.js --timeout=12000 --check-leaks" - }, - "standardx": { - "ignore": [ - "build", - "**/example/**" - ] - }, - "version": "15.4.1" -} diff --git a/node_modules/yargs/yargs.js b/node_modules/yargs/yargs.js deleted file mode 100644 index 93e8059..0000000 --- a/node_modules/yargs/yargs.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -// an async function fails early in Node.js versions prior to 8. -async function requiresNode8OrGreater () {} -requiresNode8OrGreater() - -const { Yargs, rebase } = require('./build/lib/yargs') -const Parser = require('yargs-parser') - -exports = module.exports = Yargs -exports.rebase = rebase - -// allow consumers to directly use the version of yargs-parser used by yargs -exports.Parser = Parser

- - Get professional support for 'camelcase' with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-